summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrus <rus@138bc75d-0d04-0410-961f-82ee72b054a4>2008-08-15 21:37:08 +0000
committerrus <rus@138bc75d-0d04-0410-961f-82ee72b054a4>2008-08-15 21:37:08 +0000
commitaa24789524caa6f92c525a108d8deb60e832a0cd (patch)
treeb8926c2ce7008c13ca80a5fe0c2e86bfbe68f63b
parentc8ff8146c681ec3d932f9a378755fd0b3314564c (diff)
downloadgcc-aa24789524caa6f92c525a108d8deb60e832a0cd.tar.gz
Merged revisions 137858-137859,137862,137868,137872-137875,137883-137884,137886,137888-137890,137893-137896,137903-137904,137907,137909-137910,137912-137914,137918,137921-137924,137937,137939,137941,137949-137950,137954-137956,137958-137963,137965-137970,137973,137975-137976,137980-137986,137989-137991,137995,138005-138007,138009-138010,138012-138013,138016,138018-138022,138024,138026-138027,138031-138032,138034,138036,138038,138040-138043,138047,138049-138050,138057-138058,138063-138064,138069,138072-138073,138075,138078,138082,138087,138089,138091-138092,138096-138097,138100,138104,138106-138107,138110,138112,138119-138120,138122-138123,138127-138128,138131,138139-138143,138145-138146,138148,138150-138151,138154,138159,138165,138167,138179-138181,138184,138186,138189-138191,138194,138198,138201,138206-138208,138211,138213-138217,138219,138221,138224,138226,138233-138238,138245-138246,138248-138252,138254-138258,138260-138261,138263,138274-138275,138277,138289,138291,138293-138298,138300-138308,138310,138313-138314,138316-138318,138320-138325,138327-138333,138335-138336,138340,138347-138348,138351,138353,138355-138358,138360-138367,138370-138402,138404-138422,138424-138429,138432,138434-138440,138444,138446,138448,138450,138455-138470,138472-138475,138479-138503,138506-138520,138522,138524-138525,138530,138537,138541,138544,138552-138553,138555,138560,138562,138564-138566,138568,138573,138575-138606,138608-138620,138631,138633,138635-138638,138640,138642-138643,138645,138647-138652,138661,138664,138667-138676,138678-138697,138700-138706,138708-138711,138714,138716-138728,138732-138733,138735,138737-138738,138740,138747-138748,138751,138756-138759,138763-138793,138797,138799-138800,138804,138806-138817,138819,138829,138832,138834-138835,138837,138839-138844,138846-138851,138854,138859,138862-138882,138884-138887,138889-138893,138896,138898,138903-138912,138914-138917,138921,138924-138925,138932-138934,138936,138939,138950-138951,138953-138954,138957,138966-138967,138970,138974,138978,138988,138995,139004-139005,139008-139009,139011,139013-139017,139019,139024-139026,139028-139029,139031,139034-139040,139042,139045,139048-139054,139061-139065,139072,139074-139075,139082,139084,139086,139089,139091-139093,139095-139097,139099-139100,139111,139114,139116-139117,139121,139124-139126,139129,139135 via svnmerge from
svn+ssh://gcc.gnu.org/svn/gcc/trunk ........ r137858 | paolo | 2008-07-15 16:23:23 -0700 (Tue, 15 Jul 2008) | 36 lines 2008-07-15 Chris Fairles <chris.fairles@gmail.com> * include/std/chrono: New, as per N2661. * src/chrono.cc: New. * include/Makefile.am: Update. * src/Makefile.am: Likewise. * include/Makefile.in: Regenerate. * src/Makefile.in: Likewise. * acinclude.m4: Add tests for clock_gettime and gettimeofday that define _GLIBCXX_HAS_CLOCK_GETTIME and/or _GLIBCXX_HAS_GETTIMEOFDAY. * configure.ac: Use them. * configure: Regenerate. * config.h.in: Likewise. * config/abi/pre/gnu.ver: Add symbols for system_clock::now() and system_clock::is_monotonic. * testsuite/20_util/duration/cons/1.cc: New. * testsuite/20_util/duration/cons/2.cc: Likewise. * testsuite/20_util/duration/cons/1_neg.cc: Likewise. * testsuite/20_util/duration/requirements/explicit_instantiation/ explicit_instantiation.cc: Likewise. * testsuite/20_util/duration/arithmetic/1.cc: Likewise. * testsuite/20_util/duration/arithmetic/2.cc: Likewise. * testsuite/20_util/duration/comparisons/1.cc: Likewise. * testsuite/20_util/time_point/requirements/explicit_instantiation/ explicit_instantiation.cc: Likewise. * testsuite/20_util/time_point/1.cc: Likewise. * testsuite/20_util/time_point/2.cc: Likewise. * testsuite/20_util/time_point/3.cc: Likewise. * testsuite/20_util/clocks/1.cc: Likewise. * testsuite/17_intro/headers/c++200x/all_multiple_inclusion.cc: Add missing headers. * testsuite/17_intro/headers/c++200x/all.cc: Likewise. * include/precompiled/stdc++.h: Likewise and remove <date_time>. * doc/doxygen/user.cfg.in: Likewise. ........ r137859 | dberlin | 2008-07-15 16:50:52 -0700 (Tue, 15 Jul 2008) | 12 lines 2008-07-15 Daniel Berlin <dberlin@dberlin.org> * tree-ssa-sccvn.c (expressions_equal_p): Check type equality. * tree-ssa-pre.c (pre_expr_eq): Ditto (get_constant_for_value_id): Take a type as an argument. (fully_constant_expression): Pass in type. (find_or_generate_expression): Short circuit constant case. (create_expression_by_pieces): Remove special casing of pointer_plus. (do_regular_insertion): Short circuit constant case. (do_partial_partial_insertion): Ditto. ........ r137862 | gccadmin | 2008-07-15 17:16:37 -0700 (Tue, 15 Jul 2008) | 1 line Daily bump. ........ r137868 | bkoz | 2008-07-16 00:01:23 -0700 (Wed, 16 Jul 2008) | 13 lines 2008-07-15 Benjamin Kosnik <bkoz@redhat.com> * doc/doxygen/user.cfg.in: Add complex, ratio, intializer_list. (PREDEFINED): Add _GLIBCXX_USE_C99_STDINT_TR1. * doc/doxygen/doxygroups.cc: Add std::chrono. * include/bits/unique_ptr.h (default_delete, unique_ptr): Add markup. * libsupc++/initializer_list (initializer_list): Same. * include/std/ratio: Same. * include/std/chrono: Same. * include/std/complex: Disambiguate file markup. ........ r137872 | paolo | 2008-07-16 02:04:16 -0700 (Wed, 16 Jul 2008) | 4 lines 2008-07-16 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/unique_ptr.h: Remove stray character. ........ r137873 | espindola | 2008-07-16 02:14:27 -0700 (Wed, 16 Jul 2008) | 6 lines 2007-07-16 Rafael Avila de Espindola <espindola@google.com> * c-decl.c (merge_decls): Keep DECL_SOURCE_LOCATION and DECL_IN_SYSTEM_HEADER in sync. ........ r137874 | paolo | 2008-07-16 03:10:41 -0700 (Wed, 16 Jul 2008) | 9 lines 2008-07-16 Paolo Carlini <paolo.carlini@oracle.com> * testsuite/30_threads/recursive_mutex/cons/assign_neg.cc: Adjust dg-error lines. * testsuite/30_threads/recursive_mutex/cons/copy_neg.cc: Likewise. * testsuite/20_util/duration/cons/1_neg.cc: Likewise. * include/tr1_impl/type_traits: Fix comment typo. ........ r137875 | jsm28 | 2008-07-16 03:45:57 -0700 (Wed, 16 Jul 2008) | 5 lines PR target/36827 * config/m32c/m32c.c (BIG_FB_ADJ): Move definition earlier. (m32c_legitimate_address_p): Handle "++rii" addresses created by m32c_legitimize_reload_address. ........ r137883 | kkojima | 2008-07-16 06:57:35 -0700 (Wed, 16 Jul 2008) | 4 lines * src/sh/ffi.c (ffi_prep_closure_loc): Turn INSN into an unsigned int. ........ r137884 | dje | 2008-07-16 08:33:30 -0700 (Wed, 16 Jul 2008) | 3 lines * config/rs6000/rs6000.c (processor_target_table): Add MASK_PPC_GPOPT for power4, power5, power5+, power6, and power6x. ........ r137886 | jakub | 2008-07-16 08:35:26 -0700 (Wed, 16 Jul 2008) | 3 lines * team.c (gomp_team_end): Free team immediately if it has just one thread. ........ r137888 | bwilson | 2008-07-16 08:36:43 -0700 (Wed, 16 Jul 2008) | 6 lines 2008-07-16 Anatoly Sokolov <aesok@post.ru> * config/xtensa/xtensa.h (FUNCTION_OUTGOING_VALUE, XTENSA_FUNCTION_VALUE, XTENSA_FUNCTION_VALUE): Remove. * config/xtensa/xtensa.c (xtensa_function_value): New function. (TARGET_FUNCTION_VALUE): Define. ........ r137889 | hainque | 2008-07-16 09:20:31 -0700 (Wed, 16 Jul 2008) | 4 lines * collect2.c (scan_prog_file, COFF version): Use CONST_CAST instead of bare conversion to cast const-ness away. ........ r137890 | dje | 2008-07-16 09:34:25 -0700 (Wed, 16 Jul 2008) | 3 lines * config/rs6000/rs6000.c (processor_target_table): Remove duplicate MASK_POWERPC64 for power4 in previous commit. ........ r137893 | ghazi | 2008-07-16 10:49:20 -0700 (Wed, 16 Jul 2008) | 23 lines * cfg.c (dump_reg_info): Avoid C++ keywords. * dwarf2asm.c (dw2_force_const_mem, dw2_asm_output_encoded_addr_rtx): Likewise. * except.c (gen_eh_region, add_action_record, output_ttype): Likewise. * expmed.c (expand_shift): Likewise. * global.c (find_reg): Likewise. * graph.c (draw_edge): Likewise. * local-alloc.c (reg_meets_class_p, find_free_reg): Likewise. * optabs.c (expand_binop, expand_twoval_unop, expand_twoval_binop, widen_clz, widen_bswap, expand_parity, expand_unop, emit_cmp_and_jump_insn_1): Likewise. * postreload.c (reload_cse_simplify_operands): Likewise. * ra.h (add_neighbor): Likewise. * reg-stack.c (remove_regno_note, change_stack): Likewise. * regclass.c (memory_move_secondary_cost, dump_regclass, regclass, record_reg_classes, copy_cost, record_address_regs, invalid_mode_change_p): Likewise. * regrename.c (regrename_optimize, scan_rtx_reg, dump_def_use_chain, find_oldest_value_reg, replace_oldest_value_reg, copyprop_hardreg_forward_1): Likewise. ........ r137894 | ghazi | 2008-07-16 10:52:19 -0700 (Wed, 16 Jul 2008) | 19 lines * recog.c (validate_change_1, validate_change, validate_unshare_change, validate_replace_rtx_1, struct funny_match, constrain_operands, peephole2_optimize): Avoid C++ keywords. * reload.c (push_secondary_reload, secondary_reload_class, scratch_reload_class, find_valid_class, find_reusable_reload, push_reload, find_dummy_reload, find_reloads_address_1, find_reloads_address_part, find_equiv_reg): Likewise. * reload1.c (spill_failure, eliminate_regs_1, allocate_reload_reg, choose_reload_regs): Likewise. * rtlanal.c (replace_rtx, nonzero_bits1, num_sign_bit_copies1): Likewise. * rtlhooks.c (gen_lowpart_if_possible): Likewise. * sched-ebb.c (add_deps_for_risky_insns): Likewise. * sched-rgn.c (concat_INSN_LIST): Likewise. * stor-layout.c (mode_for_size, mode_for_size_tree, smallest_mode_for_size): Likewise. ........ r137895 | ghazi | 2008-07-16 10:55:42 -0700 (Wed, 16 Jul 2008) | 15 lines * c-pch.c (get_ident): Avoid C++ keywords. * combine-stack-adj.c (single_set_for_csa): Likewise. * final.c (asm_insn_count, final_scan_insn, alter_subreg, output_asm_insn): Likewise. * reload.c (push_secondary_reload, find_reusable_reload, push_reload, combine_reloads, find_reloads, debug_reload_to_stream): Likewise. * reload.h (struct reload): Likewise. * reload1.c (reload_reg_class_lower, find_reg, find_reload_regs, allocate_reload_reg, choose_reload_regs, emit_input_reload_insns, emit_output_reload_insns): Likewise. * targhooks.c (default_secondary_reload): Likewise. * varasm.c (section_entry_eq, object_block_entry_eq): Likewise. ........ r137896 | ghazi | 2008-07-16 11:19:55 -0700 (Wed, 16 Jul 2008) | 3 lines * recog.c (peephole2_optimize): Fix formatting. ........ r137903 | hubicka | 2008-07-16 14:38:15 -0700 (Wed, 16 Jul 2008) | 8 lines * cgraph.h (varpool_empty_needed_queue): Declare. * cgraphunit.c (output_in_order): Mark all variables as needed; empty the queue. * varpool.c (varpool_assemble_node): Update debug queue. (varpool_assemble_pending_decls): Don't do it here. (varpool_empty_needed_queue): New function. ........ r137904 | dodji | 2008-07-16 16:44:02 -0700 (Wed, 16 Jul 2008) | 9 lines 2008-07-16 Dodji Seketeli <dseketel@redhat.com> PR c++/13699 * gcc/cp/name-lookup.c (lookup_extern_c_fun_binding_in_all_ns): New function. (pushdecl_maybe_friend): Check if a redeclaration of extern C function complies with exception specification constraints. ........ r137907 | gccadmin | 2008-07-16 17:16:28 -0700 (Wed, 16 Jul 2008) | 1 line Daily bump. ........ r137909 | hjl | 2008-07-16 22:13:27 -0700 (Wed, 16 Jul 2008) | 6 lines 2008-07-17 H.J. Lu <hongjiu.lu@intel.com> PR testsuite/36443 * objc.dg/gnu-encoding/gnu-encoding.exp: Temporarily unset GCC_EXEC_PREFIX from environment when running $HOSTCC. ........ r137910 | burnus | 2008-07-16 22:54:42 -0700 (Wed, 16 Jul 2008) | 16 lines 2008-07-17 Tobias Burnus <burnus@net-b.de> PR fortran/36825 PR fortran/36824 * array.c (gfc_match_array_spec): Fix array-rank check. * resolve.c (resolve_fl_derived): Fix constentness check for the array dimensions. 2008-07-17 Tobias Burnus <burnus@net-b.de> PR fortran/36825 PR fortran/36824 * gfortran.dg/rank_2.f90: Add additional array-rank test. * gfortran.dg/array_4.f90: New. ........ r137912 | bonzini | 2008-07-17 01:58:15 -0700 (Thu, 17 Jul 2008) | 5 lines 2008-07-16 Roger Sayle <roger@eyesopen.com> Paolo Bonzini <bonzini@gnu.org> * scripts/jar.in: Fix portability problems with Solaris /bin/sh. ........ r137913 | bonzini | 2008-07-17 02:07:31 -0700 (Thu, 17 Jul 2008) | 14 lines gcc: 2008-07-17 Paolo Bonzini <bonzini@gnu.org> PR rtl-optimization/36753 * fwprop.c (use_killed_between): Don't shortcut single-definition global registers. gcc/testsuite: 2008-07-17 Paolo Bonzini <bonzini@gnu.org> PR rtl-optimization/36753 * gcc.target/i386/pr36753.c: New. ........ r137914 | paolo | 2008-07-17 02:11:11 -0700 (Thu, 17 Jul 2008) | 15 lines /cp 2008-07-17 Paolo Carlini <paolo.carlini@oracle.com> PR c++/36855 * semantics.c (trait_expr_value): Update __has_trivial_destructor semantics to the current WP (N2691). /testsuite 2008-07-17 Paolo Carlini <paolo.carlini@oracle.com> PR c++/36855 * g++.dg/ext/has_trivial_destructor.C: Rename to... * g++.dg/ext/has_trivial_destructor-1.C: ... this. * g++.dg/ext/has_trivial_destructor-2.C: New. ........ r137918 | doko | 2008-07-17 03:04:51 -0700 (Thu, 17 Jul 2008) | 5 lines 2008-07-17 Roman Zippel <zippel@linux-m68k.org> PR target/25343 * config/host-linux.c (TRY_EMPTY_VM_SPACE): Define for __mc68000__. ........ r137921 | jamborm | 2008-07-17 06:23:32 -0700 (Thu, 17 Jul 2008) | 21 lines 2008-07-17 Martin Jambor <mjambor@suse.cz> * ipa-cp.c (ipcp_print_all_lattices): New variable info, check that nodes are relevant by examining the node->analyzed flag. (ipcp_init_stage): Check which nodes are relevant, assert that the relevant ones are also required. (ipcp_propagate_stage): Check on the side arrays are properly allocated. (ipcp_print_all_jump_functions): Make sure not to touch any node that is not analyzed or an edge that does not have a corresponding entry in the on-the-side vectors. (ipcp_function_scale_print): Likewise. (ipcp_update_callgraph): Check that the node is relevant. (ipcp_insert_stage): Check that the node is relevant. Check there is an info for every node and edge. * ipa-prop.c (ipa_init_func_list): Check the nodes are relevant. (ipa_print_all_tree_maps): Likewise and a new variable info. (ipa_print_all_params_modified): Likewise. * ipa-prop.h (ipa_edge_args_info_available_for_edge_p): New function. ........ r137922 | jules | 2008-07-17 07:03:50 -0700 (Thu, 17 Jul 2008) | 14 lines gcc/cp/ * decl2.c (determine_visibility): Allow target to override visibility of class data. gcc/ * config/arm/arm.c (arm_cxx_determine_class_data_visibility): Make no-op for targets which don't use DLLs. gcc/testsuite/ * g++.dg/ext/visibility/arm3.C: Add explanatory text. Skip on non-DLL targets. * g++.dg/ext/visibility/arm1.C: Skip on non-DLL targets. ........ r137923 | hainque | 2008-07-17 07:18:27 -0700 (Thu, 17 Jul 2008) | 13 lines ada/ * utils.c (create_var_decl_1): Relax expectations on the PUBLIC_FLAG argument, to apply to references in addition to definitions. Prevent setting TREE_STATIC on externals. (gnat_pushdecl): Always clear DECL_CONTEXT on public externals. testsuite/ * gnat.dg/tree_static_def.ad[bs]: Support for ... * gnat.dg/tree_static_use.adb: New test. * gnat.dg/decl_ctx_def.ads: Support for ... * gnat.dg/decl_ctx_use.ad[bs]: New test. ........ r137924 | hainque | 2008-07-17 07:37:58 -0700 (Thu, 17 Jul 2008) | 5 lines * adaint.c (__MINGW32__ section): Include ctype.h and define a fallback ISALPHA if IN_RTS. (__gnat_is_absolute_path): Use ISALPHA instead of isalpha. ........ r137937 | gccadmin | 2008-07-17 17:16:37 -0700 (Thu, 17 Jul 2008) | 1 line Daily bump. ........ r137939 | doko | 2008-07-18 01:15:27 -0700 (Fri, 18 Jul 2008) | 15 lines boehm-gc/ 2008-07-18 Matthias Klose <doko@ubuntu.com> * configure.ac (AC_CONFIG_FILES): Add threads.mk. * threads.mk.in: New. * Makefile.in, configure: Regenerate. libobjc/ 2008-07-18 Matthias Klose <doko@ubuntu.com> * Makefile.in: Include ../boehm-gc/threads.mk. (OBJC_BOEHM_GC_LIBS): Define, (libobjc_gc$(libsuffix).la): Use it. ........ r137941 | doko | 2008-07-18 03:37:22 -0700 (Fri, 18 Jul 2008) | 2 lines - checkin threads.mk.in. ........ r137949 | burnus | 2008-07-18 06:17:49 -0700 (Fri, 18 Jul 2008) | 6 lines The new file gfortran.dg/array_4.f90 was missing from the commit 137910 2008-07-17 Tobias Burnus <burnus@net-b.de> PR fortran/36824 * gfortran.dg/array_4.f90: New. ........ r137950 | burnus | 2008-07-18 06:20:35 -0700 (Fri, 18 Jul 2008) | 5 lines 2008-07-18 Tobias Burnus <burnus@net-b.de> * gfortran.dg/parameter_array_init_4.f90: Silence pedantic warning. ........ r137954 | hjl | 2008-07-18 08:42:59 -0700 (Fri, 18 Jul 2008) | 14 lines gcc/ 2008-07-18 H.J. Lu <hongjiu.lu@intel.com> PR middle-end/36858 * function.c (locate_and_pad_parm): Cap boundary earlier. testsuite/ 2008-07-18 H.J. Lu <hongjiu.lu@intel.com> PR middle-end/36858 * gcc.target/i386/vararg-1.c: New. ........ r137955 | hjl | 2008-07-18 08:48:04 -0700 (Fri, 18 Jul 2008) | 16 lines gcc/ 2008-07-18 H.J. Lu <hongjiu.lu@intel.com> PR middle-end/36859 * builtins.c (std_gimplify_va_arg_expr): Limit alignment to PREFERRED_STACK_BOUNDARY. * config/i386/i386.c (ix86_gimplify_va_arg): Likewise. testsuite/ 2008-07-18 H.J. Lu <hongjiu.lu@intel.com> PR middle-end/36859 * gcc.target/i386/vararg-2.c: New. ........ r137956 | doko | 2008-07-18 09:30:04 -0700 (Fri, 18 Jul 2008) | 4 lines 2008-07-18 Matthias Klose <doko@ubuntu.com> * Makefile.in: Ignore missing ../boehm-gc/threads.mk. ........ r137958 | ghazi | 2008-07-18 10:16:25 -0700 (Fri, 18 Jul 2008) | 9 lines * objc-act.c (objc_start_class_interface, objc_start_category_interface, objc_start_class_implementation, objc_start_category_implementation, objc_build_struct, generate_static_references, build_private_template, lookup_category, objc_add_method, add_category, add_instance_variable, objc_is_public, conforms_to_protocol, start_class, continue_class, finish_class): Avoid C++ keywords. ........ r137959 | ghazi | 2008-07-18 10:19:03 -0700 (Fri, 18 Jul 2008) | 19 lines * cvt.c (convert_to_void): Avoid C++ keywords. * decl.c (walk_namespaces_r, wrapup_globals_for_namespace): Likewise. * friend.c (is_friend): Likewise. * init.c (perform_member_init): Likewise. * mangle.c (write_template_prefix, write_template_template_param): Likewise. * name-lookup.c (do_namespace_alias, do_using_directive, parse_using_directive, ambiguous_decl, arg_assoc): Likewise. * parser.c (cp_parser_template_id, cp_parser_namespace_definition, cp_parser_objc_typename, cp_parser_objc_method_keyword_params): Likewise. * pt.c (is_specialization_of_friend, lookup_template_class, push_tinst_level, instantiate_class_template, tsubst_copy_and_build): Likewise. * tree.c (add_stmt_to_compound): Likewise. * typeck.c (finish_class_member_access_expr): Likewise. ........ r137960 | ghazi | 2008-07-18 10:54:46 -0700 (Fri, 18 Jul 2008) | 4 lines * arith.c (eval_type_intrinsic0): Avoid C++ keywords. * gfortran.h (try, protected, operator, new): Likewise. ........ r137961 | paolo | 2008-07-18 11:40:53 -0700 (Fri, 18 Jul 2008) | 5 lines 2008-07-18 Paolo Carlini <paolo.carlini@oracle.com> * testsuite/lib/libstdc++.exp (check_v3_target_c_std): Avoid unused variable warnings leading to spurious fails of the test. ........ r137962 | paolo | 2008-07-18 13:11:21 -0700 (Fri, 18 Jul 2008) | 7 lines 2008-07-16 Paolo Carlini <paolo.carlini@oracle.com> * include/debug/vector (insert(iterator, _Tp&&), push_back(_Tp&&)): Enable only when _Tp != bool. * testsuite/25_algorithms/heap/1.cc: Avoid unused variable warnings. ........ r137963 | paolo | 2008-07-18 13:11:50 -0700 (Fri, 18 Jul 2008) | 7 lines 2008-07-16 Paolo Carlini <paolo.carlini@oracle.com> * include/debug/vector (insert(iterator, _Tp&&), push_back(_Tp&&)): Enable only when _Tp != bool. * testsuite/25_algorithms/heap/1.cc: Avoid unused variable warnings. ........ r137965 | kvanhees | 2008-07-18 13:23:42 -0700 (Fri, 18 Jul 2008) | 37 lines gcc/ChangeLog: 2008-07-16 Kris Van Hees <kris.van.hees@oracle.com> * c-common.c (c_stddef_cpp_builtins): Define __CHAR16_TYPE__ and __CHAR32_TYPE__. * c-typeck.c (digest_init): Support char16_t and char32_t. (set_nonincremental_init_from_string): Idem. gcc/cp/ChangeLog: 2008-07-16 Kris Van Hees <kris.van.hees@oracle.com> * rtti.c (emit_support_tinfos): Add char16_type_node and char32_type_node. * typeck2.c (digest_init): Support char16_t and char32_t. gcc/testsuite/ChangeLog: 2008-07-16 Kris Van Hees <kris.van.hees@oracle.com> Tests for char16_t and char32_t support. * g++.dg/ext/utf-array.C: New * g++.dg/ext/utf-array-short-wchar.C: New * g++.dg/ext/utf-rtti.C: New * g++.dg/ext/utf-type.c: New * gcc.dg/utf-array.c: New * gcc.dg/utf-array-short-wchar.c: New * gcc.dg/utf-inc-init.c: New * gcc.dg/utf-type.c: New libstdc++-v3/ChangeLog: 2008-07-16 Kris Van Hees <kris.van.hees@oracle.com> Holger Hopp <holger.hopp@sap.com> * config/abi/pre/gnu.ver: Support char16_t and char32_t. * testsuite/util/testsuite_abi.cc (check_version): Add CXXABI_1.3.3 to known_versions. ........ r137966 | dodji | 2008-07-18 13:40:42 -0700 (Fri, 18 Jul 2008) | 7 lines 2008-07-18 Dodji Seketeli <dseketel@redhat.com> PR c++/36407 * call.c (convert_like_real): Don't take the error code path when a rvalue or base conversion has the bad_p field set. ........ r137967 | uros | 2008-07-18 14:01:59 -0700 (Fri, 18 Jul 2008) | 16 lines PR target/36786 * config/i386/i386.md (x86_64_shift_adj_1): Rename from x86_64_shift_adj. (x86_64_shift_adj_2): New expander. (x86_64_shift_adj_3): Ditto. * config/i386/i386.c (ix86_split_ashr): Use gen_x86_64_shift_adj_3 to split TImode operands. (ix86_split_ashl): Use gen_x86_64_shift_adj_2 to split TImode operands. (ix86_split_lshr): Ditto. testsuite/ChangeLog: PR target/36786 * gcc.target/i386/pr36786.c: New test. ........ r137968 | jsm28 | 2008-07-18 15:05:43 -0700 (Fri, 18 Jul 2008) | 3 lines * gcc.dg/fshort-wchar.c: Use -Wl,--no-wchar-size-warning on arm*-*-*eabi. ........ r137969 | paolo | 2008-07-18 15:37:34 -0700 (Fri, 18 Jul 2008) | 4 lines 2008-07-18 Paolo Carlini <paolo.carlini@oracle.com> Remove spurious blank line from ChangeLog. ........ r137970 | kvanhees | 2008-07-18 15:37:42 -0700 (Fri, 18 Jul 2008) | 8 lines 2008-07-18 Kris Van Hees <kris.van.hees@oracle.com> * g++.dg/ext/utf-array.C: Fix broken merge/checkin. * g++.dg/ext/utf-array-short-wchar.C: Idem * gcc.dg/utf-array.c: Idem * gcc.dg/utf-array-short-wchar.c: Idem ........ r137973 | gccadmin | 2008-07-18 17:16:39 -0700 (Fri, 18 Jul 2008) | 1 line Daily bump. ........ r137975 | hainque | 2008-07-18 23:41:30 -0700 (Fri, 18 Jul 2008) | 8 lines * dwarf2out.c (add_subscript_info): New explicit COLLAPSE_P argument, saying whether nested array are to be collapsed into a single array type DIE with multiple subscripts. (gen_array_type_die): Factorize comments about the MIPS_DEBUG_INFO issues, centralize the nested array types collapsing control and disable the transformation for Ada. ........ r137976 | jsm28 | 2008-07-19 04:14:13 -0700 (Sat, 19 Jul 2008) | 15 lines PR target/36780 PR target/36827 * reload.c (find_reloads_subreg_address): Only reload address if reloaded == 0, not for reloaded != 1. Revert: 2008-07-16 Joseph Myers <joseph@codesourcery.com> * config/m32c/m32c.c (BIG_FB_ADJ): Move definition earlier. (m32c_legitimate_address_p): Handle "++rii" addresses created by m32c_legitimize_reload_address. 2008-07-15 Kaz Kojima <kkojima@gcc.gnu.org> * config/sh/sh.h (GO_IF_LEGITIMATE_ADDRESS): Allow (plus (plus (reg) (const_int)) (const_int)) when reload_in_progress. ........ r137980 | ghazi | 2008-07-19 09:19:27 -0700 (Sat, 19 Jul 2008) | 18 lines * gfortran.h (protected): Remove macro. * dump-parse-tree.c (show_attr): Avoid C++ keywords. * expr.c (gfc_check_pointer_assign): Likewise. * interface.c (compare_parameter_protected): Likewise. * intrinsic.c (enum class, add_sym, add_sym_0, add_sym_1, add_sym_1s, add_sym_1m, add_sym_2, add_sym_2s, add_sym_3, add_sym_3ml, add_sym_3red, add_sym_3s, add_sym_4, add_sym_4s, add_sym_5s): Likewise. * match.c (gfc_match_assignment, gfc_match_pointer_assignment): Likewise. * module.c (mio_symbol_attribute): Likewise. * primary.c (match_variable): Likewise. * resolve.c (resolve_equivalence): Likewise. * symbol.c (check_conflict, gfc_add_protected, gfc_copy_attr): Likewise. * trans-types.c (gfc_get_array_type_bounds): Likewise. ........ r137981 | ghazi | 2008-07-19 09:22:12 -0700 (Sat, 19 Jul 2008) | 30 lines * gfortran.h (operator): Remove macro. (gfc_namespace, gfc_expr): Avoid C++ keywords. * arith.c (eval_intrinsic, eval_intrinsic_f2, eval_intrinsic_f3): Likewise. * decl.c (access_attr_decl): Likewise. * dependency.c (gfc_dep_compare_expr): Likewise. * dump-parse-tree.c (show_expr, show_uop, show_namespace): Likewise. * expr.c (gfc_copy_expr, gfc_type_convert_binary, simplify_intrinsic_op, check_intrinsic_op): Likewise. * interface.c (fold_unary, gfc_match_generic_spec, gfc_match_interface, gfc_match_end_interface, check_operator_interface, check_uop_interfaces, gfc_check_interfaces, gfc_extend_expr, gfc_extend_assign, gfc_add_interface, gfc_current_interface_head, gfc_set_current_interface_head): Likewise. * iresolve.c (gfc_resolve_dot_product, gfc_resolve_matmul): Likewise. * matchexp.c (gfc_get_parentheses, build_node): Likewise. * module.c (gfc_use_rename, gfc_match_use, find_use_name_n, number_use_names, mio_expr, load_operator_interfaces, read_module, write_operator, write_module): Likewise. * openmp.c (resolve_omp_atomic): Likewise. * resolve.c (resolve_operator, gfc_resolve_character_operator, gfc_resolve_uops): Likewise. * symbol.c (free_uop_tree, gfc_free_namespace): Likewise. * trans-expr.c (gfc_conv_expr_op): Likewise. * trans-openmp.c (gfc_trans_omp_atomic): Likewise. ........ r137982 | ghazi | 2008-07-19 09:23:52 -0700 (Sat, 19 Jul 2008) | 28 lines * gfortran.h (new): Remove macro. * array.c (gfc_append_constructor, match_array_list, gfc_match_array_constructor): Likewise. * bbt.c (insert, gfc_insert_bbt): Likewise. * decl.c (var_element, top_var_list, top_val_list, gfc_match_data, get_proc_name): Likewise. * expr.c (gfc_copy_actual_arglist): Likewise. * interface.c (compare_actual_formal, check_new_interface, gfc_add_interface): Likewise. * intrinsic.c gfc_convert_type_warn, gfc_convert_chartype): Likewise. * io.c (match_io_iterator, match_io_list): Likewise. * match.c (match_forall_header): Likewise. * matchexp.c (build_node): Likewise. * module.c (gfc_match_use): Likewise. * scanner.c (load_file): Likewise. * st.c (gfc_append_code): Likewise. * symbol.c (save_symbol_data, gfc_get_sym_tree, gfc_undo_symbols, gfc_commit_symbols): Likewise. * trans-common.c (build_field): Likewise. * trans-decl.c (gfc_finish_var_decl): Likewise. * trans-expr.c (gfc_free_interface_mapping, gfc_get_interface_mapping_charlen, gfc_add_interface_mapping, gfc_finish_interface_mapping, gfc_apply_interface_mapping_to_expr): Likewise. * trans.h (gfc_interface_sym_mapping): Likewise. ........ r137983 | burnus | 2008-07-19 10:20:26 -0700 (Sat, 19 Jul 2008) | 12 lines 2008-07-19 Tobias Burnus <burnus@net-b.de> * check.c (gfc_check_cshift,gfc_check_eoshift,gfc_check_unpack): Add rank checks for cshift's shift and eoshift's shift and boundary args. (gfc_check_unpack): Add rank and shape tests for unpack. 2008-07-19 Tobias Burnus <burnus@net-b.de> * gfortran.dg/intrinsic_argument_conformance_2.f90: New. * gfortran.dg/zero_sized_1.f90: Fix conformance bugs. ........ r137984 | hainque | 2008-07-19 10:49:18 -0700 (Sat, 19 Jul 2008) | 14 lines * doc/tm.texi (MALLOC_ABI_ALIGNMENT): New macro. Alignment, in bits, a C conformant malloc implementation has to provide. * defaults.h (MALLOC_ABI_ALIGNMENT): Default to BITS_PER_WORD. ada/ * targtyps.c (get_target_default_allocator_alignment): Use it. testsuite/ * gcc.dg/mallign.c: New test. * gnat.dg/allocator_maxalign1.adb: New test. * gnat.dg/test_allocator_maxalign2.adb: Main caller for ... * gnat.dg/allocator_maxalign2.ad[bs]: New test. ........ r137985 | burnus | 2008-07-19 11:27:00 -0700 (Sat, 19 Jul 2008) | 8 lines 2008-07-19 Tobias Burnus <burnus@net-b.de> PR fortran/36342 * scanner.c (load_file): Add argument to destinguish between true filename and displayed filename. (include_line,gfc_new_file): Adapt accordingly. ........ r137986 | burnus | 2008-07-19 11:29:18 -0700 (Sat, 19 Jul 2008) | 13 lines 2008-07-19 Tobias Burnus <burnus@net-b.de> PR fortran/36795 * matchexp.c (gfc_get_parentheses): Remove obsolete workaround, which caused the generation of wrong code. 2008-07-19 Tobias Burnus <burnus@net-b.de> PR fortran/36795 * char_expr_1.f90: New. * char_expr_2.f90: New. ........ r137989 | jakub | 2008-07-19 12:22:51 -0700 (Sat, 19 Jul 2008) | 6 lines PR middle-end/36877 * omp-low.c (expand_omp_atomic_fetch_op): Make sure the return value of the builtin is ignored. * gcc.dg/gomp/atomic-11.c: New test. ........ r137990 | paolo | 2008-07-19 12:58:52 -0700 (Sat, 19 Jul 2008) | 13 lines 2008-07-19 Paolo Carlini <paolo.carlini@oracle.com> * include/ext/pb_ds/detail/binomial_heap_base_/debug_fn_imps.hpp (assert_node_consistent): Avoid ambiguous else warning. * include/ext/pb_ds/detail/debug_map_base.hpp: Include <iostream>. * include/bits/c++config: In debug-mode (and parallel-mode) set _GLIBCXX_EXTERN_TEMPLATE to -1, not 0, thus disabling extern templates only for basic_string (per libstdc++/21674). * include/bits/basic_string.tcc: Use extern templates when _GLIBCXX_EXTERN_TEMPLATE > 0. ........ r137991 | andreast | 2008-07-19 13:02:29 -0700 (Sat, 19 Jul 2008) | 9 lines 2008-07-19 Richard Guenther <rguenther@suse.de> PR bootstrap/36864 * tree-ssa-sccvn.h (get_constant_value_id): Declare. * tree-ssa-sccvn.c (get_constant_value_id): New function. * tree-ssa-pre.c (get_expr_value_id): For newly created constant value-ids make sure to add the expression to its expression-set. ........ r137995 | gccadmin | 2008-07-19 17:16:33 -0700 (Sat, 19 Jul 2008) | 1 line Daily bump. ........ r138005 | dberlin | 2008-07-19 22:21:48 -0700 (Sat, 19 Jul 2008) | 12 lines 2008-07-20 Daniel Berlin <dberlin@dberlin.org> * gcc.dg/tree-ssa/ssa-fre-7.c: XFAIL. * gcc.dg/tree-ssa/ssa-fre-8.c: Ditto. * gcc.dg/tree-ssa/ssa-fre-9.c: Ditto. * gcc.dg/tree-ssa/ssa-fre-13.c: Ditto. * gcc.dg/tree-ssa/ssa-fre-14.c: Ditto. * gcc.dg/tree-ssa/ssa-fre-17.c: Ditto. * gcc.dg/tree-ssa/ssa-pre-15.c: Ditto. * gcc.dg/tree-ssa/loadpre1.c: PASS. ........ r138006 | hubicka | 2008-07-20 02:50:30 -0700 (Sun, 20 Jul 2008) | 5 lines * builtins.c (expand_builtin_int_roundingfn, expand_builtin_int_roundingfn_2): Do not take subtarget argument; it is not useful. ........ r138007 | hp | 2008-07-20 07:12:04 -0700 (Sun, 20 Jul 2008) | 2 lines * gcc.dg/tree-ssa/data-dep-1.c: XFAIL. ........ r138009 | hubicka | 2008-07-20 07:57:17 -0700 (Sun, 20 Jul 2008) | 17 lines * doc/extend.texi (flatten attribute): Remove note about unit-at-a-time * doc/invoke.texi (--combine): Likewise. (-finline-functions-called-once): Update levels when enabled. (-funit-at-a-time): Document new behaviour. (-ftoplevel-reorder): Document that it is enabled -O0 and imply -fno-section-anchors when disabled explicitly. (inline params): They are not ignored now. (precompiled headers): Remove unit-at-a-time as being incompatible. * opts.c (decode_options): Handle unit-at-a-time as alias; imply -fno-section-anchors when toplevel reorder is disabled explicitly. * common.opt (ftoplevel-reorder): Set default value to 2. (funit-at-a-time): Set default value to 1. * config/rs6000/rs6000.c (optimization_options): Set section anchors to 2. ........ r138010 | hubicka | 2008-07-20 09:06:51 -0700 (Sun, 20 Jul 2008) | 16 lines * cgraph.c (cgraph_add_new_function): Do early local passes. * tree-nrv.c (gate_pass_return_slot): New gate. (pass_nrv): Add the gate. * tree-ssa-coalese.c (hash_ssa_name_by_var, eq_ssa_name_by_var): New functions. (coalesce_ssa_name): Coalesce SSA names. * tree-ssa-live.c (remove_unused_locals): Be more conservative when not optimizing so unused user vars remains visible. * common.opt (flag_tree_ter): Always enable by default. * tree-ssa-ter.c: Include flags.h (is_replaceable_p): Check that locations match; when aliasing is missing be conservative about loads. * tree-optimize.c (gate_init_datastructures): Remove. (pass_init_datastructures): New. * passes.c: Reorder passes so we always go into SSA. ........ r138012 | pinskia | 2008-07-20 10:51:48 -0700 (Sun, 20 Jul 2008) | 13 lines 2008-07-20 Andrew Pinski <andrew_pinski@playstation.sony.com> PR tree-opt/36879 * tree-switch-conversion.c (build_one_array): Call varpool_mark_needed_node and varpool_finalize_decl instead of assemble_variable. 2008-07-20 Andrew Pinski <andrew_pinski@playstation.sony.com> PR tree-opt/36879 * gcc.c-torture/execute/20080719-1.c: New testcase. ........ r138013 | charlet | 2008-07-20 13:31:59 -0700 (Sun, 20 Jul 2008) | 2 lines * gnathtml.pl: New file. ........ r138016 | gccadmin | 2008-07-20 17:16:30 -0700 (Sun, 20 Jul 2008) | 1 line Daily bump. ........ r138018 | hp | 2008-07-20 18:15:18 -0700 (Sun, 20 Jul 2008) | 3 lines PR middle-end/36509 * gcc.dg/Wstrict-aliasing-float-ptr-int-obj.c: XFAIL. ........ r138019 | hp | 2008-07-20 18:37:55 -0700 (Sun, 20 Jul 2008) | 4 lines PR rtl-optimization/33642 * gcc.c-torture/compile/pr11832.c: Skip for CRIS. * gcc.c-torture/compile/pr33009.c: Likewise. ........ r138020 | hp | 2008-07-20 19:37:36 -0700 (Sun, 20 Jul 2008) | 3 lines PR middle-end/36143 * g++.dg/tree-ssa/pr19637.C: XFAIL. ........ r138021 | jvdelisle | 2008-07-20 21:44:10 -0700 (Sun, 20 Jul 2008) | 6 lines 2008-07-20 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/36857 * io/write_float.def: Comment out locale dependent code and fix general comments. ........ r138022 | krebbel | 2008-07-20 23:54:34 -0700 (Sun, 20 Jul 2008) | 12 lines 2008-07-21 Andreas Krebbel <krebbel1@de.ibm.com> PR target/36822 * recog.c (asm_operand_ok): Change the order of the extra memory constraint checks. 2008-07-17 Andreas Krebbel <krebbel1@de.ibm.com> PR target/36822 * gcc.target/s390/pr36822.c: New testcase. ........ r138024 | paolo | 2008-07-21 02:08:41 -0700 (Mon, 21 Jul 2008) | 19 lines /cp 2008-07-21 Paolo Carlini <paolo.carlini@oracle.com> PR c++/36870 * semantics.c (classtype_has_nothrow_assign_or_copy_p): Use TYPE_NOTHROW_P, not TREE_NOTHROW. (trait_expr_value): Likewise. /testsuite 2008-07-21 Paolo Carlini <paolo.carlini@oracle.com> PR c++/36870 * g++.dg/ext/has_nothrow_assign_odr.C: New. * g++.dg/ext/has_nothrow_copy_odr.C: Likewise. * g++.dg/ext/has_nothrow_constructor_odr.C: Likewise. * g++.dg/ext/has_nothrow_assign.C: Adjust. * g++.dg/ext/has_nothrow_copy.C: Likewise. * g++.dg/ext/has_nothrow_constructor.C: Likewise. ........ r138026 | manu | 2008-07-21 02:33:38 -0700 (Mon, 21 Jul 2008) | 21 lines 2008-07-21 Manuel Lopez-Ibanez <manu@gcc.gnu.org> * include/line-map.h (linenum_type): New typedef. (struct line_map): Use it. (SOURCE_LINE): Second arguments is a LOCATION not a LINE. (SOURCE_COLUMN): Likewise. * macro.c (_cpp_builtin_macro_text): Use linenum_type. Don't store source_location values in a variable of type linenum_type. * directives.c (struct if_stack): Use linenum_type. (strtoul_for_line): Rename as strtolinenum. (do_line): Use linenum_type. (do_linemarker): Use linenum_type and strtolinenum. (_cpp_do_file_change): Use linenum_t. * line-map.c (linemap_add): Likewise. (linemap_line_start): Likewise. * traditional.c (struct fun_macro): 'line' is a source_location. * errors.c (print_location): Use linenum_type. * directives-only.c (_cpp_preprocess_dir_only): Likewise. * internal.h (CPP_INCREMENT_LINE): Likewise. * lex.c (_cpp_skip_block_comment): Use source_location. ........ r138027 | tkoenig | 2008-07-21 03:05:32 -0700 (Mon, 21 Jul 2008) | 31 lines 2008-07-21 Thomas Koenig <tkoenig@gcc.gnu.org> PR libfortran/36773 * intrinsics/cshift0.c (cshift0): Return early if size of array is zero. * intrinsics/eoshift0.c (eoshift0): Return early if size of return array is zero. * intrinsics/eoshift2.c (eoshift2): Likewise. * m4/eoshift1.m4 (eoshift1): Return early if size of array is zero. * m4/eoshift3.m4 (eoshift3): Likewise. * m4/eoshift2.m4 (eoshift2): Return early if size of return array is zero. * m4/eoshift4.m4 (eoshift2): Return early if size of return array is zero. * generated/cshift1_16.c: Regenerated. * generated/cshift1_4.c: Regenerated. * generated/cshift1_8.c: Regenerated. * generated/eoshift1_16.c: Regenerated. * generated/eoshift1_4.c: Regenerated. * generated/eoshift1_8.c: Regenerated. * generated/eoshift3_16.c: Regenerated. * generated/eoshift3_4.c: Regenerated. * generated/eoshift3_8.c: Regenerated. 2008-07-21 Thomas Koenig <tkoenig@gcc.gnu.org> PR libfortran/36773 * gfortran.dg/zero_sized_5.f90: New test case. ........ r138031 | espindola | 2008-07-21 07:29:27 -0700 (Mon, 21 Jul 2008) | 46 lines 2007-07-21 Rafael Avila de Espindola <espindola@google.com> * Makefile.in: Replace toplev.h with TOPLEV_H. * c-decl.c (merge_decls): Don't set DECL_IN_SYSTEM_HEADER. * c-lex.c (fe_file_change): Don't set in_system_header. * c-parser.c (c_token): Remove in_system_header. (c_lex_one_token): Don't set in_system_header. (c_parser_set_source_position_from_token): Don't set in_system_header. * diagnostic.c (diagnostic_report_diagnostic): Use location from diagnostic_info. (warning_at): New. * diagnostic.h (diagnostic_report_warnings_p): Add LOC argument. * flags.h (in_system_header): Remove. * function.c (saved_in_system_header): Remove. (push_cfun): Don't set in_system_header. (pop_cfun): Don't set in_system_header. (push_struct_function): Don't set in_system_header. * input.h (expanded_location): Add sysp. (in_system_header_at): New. (in_system_header): New. * toplev.c (in_system_header): Remove. * toplev.h: Include input.h (warning_at): New. * tree-cfg.c (execute_warn_function_return): Call warning_at. * tree-ssa.c (warn_uninit): Call warning_at. (warn_uninitialized_var): Update calls to warn_uninit. (warn_uninitialized_phi): Update calls to warn_uninit. * tree.c (make_node_stat): Don't set DECL_IN_SYSTEM_HEADER. (expand_location): Initialize xloc.sysp. * tree.h (DECL_IN_SYSTEM_HEADER): Use in_system_header_at. (tree_decl_with_vis): Remove in_system_header_flag. 2007-07-21 Rafael Avila de Espindola <espindola@google.com> * parser.c (cp_token): Remove in_system_header. (eof_token): Remove in_system_header. (cp_lexer_get_preprocessor_token): Don't set in_system_header. (cp_lexer_set_source_position_from_token): Don't set in_system_header. (cp_parser_member_declaration): Use in_system_header_at. * pt.c (lookup_template_class): Don't set DECL_IN_SYSTEM_HEADER. (pop_tinst_level): Don't set in_system_header. (instantiate_class_template): Don't set in_system_header. (instantiate_decl): Don't set in_system_header. (instantiate_pending_templates): Don't set in_system_header. ........ r138032 | espindola | 2008-07-21 07:45:07 -0700 (Mon, 21 Jul 2008) | 2 lines Fix the year on the ChangeLog. ........ r138034 | paolo | 2008-07-21 09:18:38 -0700 (Mon, 21 Jul 2008) | 22 lines /cp 2008-07-21 Paolo Carlini <paolo.carlini@oracle.com> PR c++/36871 PR c++/36872 * semantics.c (classtype_has_nothrow_assign_or_copy_p): Only check copy constructors and copy assignment operators proper. /testsuite 2008-07-21 Paolo Carlini <paolo.carlini@oracle.com> PR c++/36871 PR c++/36872 * g++.dg/ext/has_nothrow_copy.C: Rename to... * g++.dg/ext/has_nothrow_copy-1.C: ... this. * g++.dg/ext/has_nothrow_copy-2.C: New. * g++.dg/ext/has_nothrow_copy-3.C: Likewise. * g++.dg/ext/has_nothrow_copy-4.C: Likewise. * g++.dg/ext/has_nothrow_copy-5.C: Likewise. * g++.dg/ext/has_nothrow_copy-6.C: Likewise. * g++.dg/ext/has_nothrow_copy-7.C: Likewise. ........ r138036 | uweigand | 2008-07-21 10:15:22 -0700 (Mon, 21 Jul 2008) | 9 lines * config/spu/spu.md ("div<mode>3"): Convert into expander, move original insn and splitter contents into ... ("*div<mode>3_fast"): ... this new pattern. Enable only if flag_unsafe_math_optimizations. Add dummy scratch register. ("*div<mode>3_adjusted"): New insn and splitter. Enable only if !flag_unsafe_math_optimizations. Returns number with next highest magnitude if this is still less or equal to the true quotient in magnitude. ........ r138038 | dj | 2008-07-21 10:41:13 -0700 (Mon, 21 Jul 2008) | 3 lines * config/h8300/h8300.c (h8300_hard_regno_scratch_ok): New. (TARGET_HARD_REGNO_SCRATCH_OK): Define. ........ r138040 | rwild | 2008-07-21 12:17:08 -0700 (Mon, 21 Jul 2008) | 31 lines gcc/testsuite/ * gfortran.dg/fmt_g0_3.f08: Fix typo in expected error message. gcc/fortran/ * expr.c (gfc_check_pointer_assign): Fix typo in string. * io.c (check_format): Fix typo in string. Fix comment typos. * parse.c (gfc_global_used): Likewise. * resolve.c (resolve_allocate_expr): Likewise. * symbol.c (gfc_set_default_type): Likewise. * arith.c: Fix typos in comments. * array.c: Likewise. * data.c: Likewise. * decl.c: Likewise. * dependency.c: Likewise. * f95-lang.c: Likewise. * gfortran.h: Likewise. * matchexp.c: Likewise. * module.c: Likewise. * primary.c: Likewise. * scanner.c: Likewise. * trans-array.c: Likewise. * trans-common.c: Likewise. * trans-decl.c: Likewise. * trans-expr.c: Likewise. * trans-intrinsic.c: Likewise. * trans-types.c: Likewise. * trans.c: Likewise. * trans.h: Likewise. ........ r138041 | mmitchel | 2008-07-21 12:21:45 -0700 (Mon, 21 Jul 2008) | 3 lines * config/os/gnu-linux/arm-eabi-extra.ver: New file. * configure.host: Use it for arm*-*-linux-*eabi. ........ r138042 | rwild | 2008-07-21 12:29:07 -0700 (Mon, 21 Jul 2008) | 19 lines gcc/objc/ * objc-act.c: Fix comment typos. gcc/cp/ * call.c: Fix comment typos. * class.c: Likewise. * cp-tree.h: Likewise. * cxx-pretty-print.c: Likewise. * decl.c: Likewise. * init.c: Likewise. * name-lookup.c: Likewise. * operators.def: Likewise. * parser.c: Likewise. * pt.c: Likewise. * tree.c: Likewise. * typeck.c: Likewise. ........ r138043 | jason | 2008-07-21 12:40:39 -0700 (Mon, 21 Jul 2008) | 36 lines Add initializer_list support as per N2679. * include/debug/unordered_map: Add initializer_list support. * include/debug/safe_association.h: Likewise. * include/debug/unordered_set: Likewise. * include/debug/vector: Likewise. * include/debug/deque: Likewise. * include/debug/map.h: Likewise. * include/debug/set.h: Likewise. * include/debug/string: Likewise. * include/debug/list: Likewise. * include/debug/multimap.h: Likewise. * include/tr1_impl/unordered_map: Likewise. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/tr1_impl/regex: Likewise. * include/std/valarray: Likewise. * include/std/unordered_map: Likewise. * include/std/unordered_set: Likewise. * include/bits/stl_list.h: Likewise. * include/bits/stl_map.h: Likewise. * include/bits/stl_set.h: Likewise. * include/bits/basic_string.h: Likewise. * include/bits/basic_string.tcc: Likewise. * include/bits/stl_multimap.h: Likewise. * include/bits/stl_vector.h: Likewise. * include/bits/stl_deque.h: Likewise. * include/bits/stl_multiset.h: Likewise. * include/bits/stl_bvector.h: Likewise. * include/ext/vstring.h: Likewise. * include/ext/rc_string_base.h: Likewise. * include/ext/sso_string_base.h: Likewise. * src/Makefile.am (w?string-inst): Build with -std=gnu++0x. * src/Makefile.in: Likewise. * config/abi/pre/gnu.ver: Add new w?string exports. ... ........ r138047 | gccadmin | 2008-07-21 17:16:39 -0700 (Mon, 21 Jul 2008) | 1 line Daily bump. ........ r138049 | manu | 2008-07-22 02:45:58 -0700 (Tue, 22 Jul 2008) | 11 lines 2008-07-22 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR 28079 libcpp/ * directives.c (strtolinenum): Handle overflow. (do_line): Give a warning if line number overflowed. (do_linemarker): Update call to strtolinenum. gcc/testsuite/ * gcc.dg/cpp/line6.c: New. ........ r138050 | tkoenig | 2008-07-22 03:27:10 -0700 (Tue, 22 Jul 2008) | 7 lines 2008-07-22 Thomas Koenig <tkoenig@gcc.gnu.org> PR libfortran/36890 * io/file_pos.c: Declare READ_CHUNK as signed to avoid signed/unsigned comparison warning in formatted_backspace. ........ r138057 | espindola | 2008-07-22 06:29:31 -0700 (Tue, 22 Jul 2008) | 6 lines 2008-07-22 Rafael Avila de Espindola <espindola@google.com> * c-typeck.c (build_external_ref): Don't call assemble_external. * final.c (output_operand): Call assemble_external. ........ r138058 | paolo | 2008-07-22 06:52:14 -0700 (Tue, 22 Jul 2008) | 12 lines 2008-07-22 Paolo Carlini <paolo.carlini@oracle.com> * include/ext/sso_string_base.h (__sso_string_base<>::__sso_string_base(std::initializer_list<_CharT>, const _Alloc&)): Remove. * include/ext/rc_string_base.h (__rc_string_base<>::__rc_string_base(std::initializer_list<_CharT>, const _Alloc&)): Likewise. * include/ext/vstring.h (__versa_string<>::__versa_string(std::initializer_list<_CharT>, const _Alloc&)): Adjust. ........ r138063 | domob | 2008-07-22 10:05:55 -0700 (Tue, 22 Jul 2008) | 30 lines 2008-07-22 Daniel Kraft <d@domob.eu> PR fortran/29835 * io.c (error_element), (format_locus): New static globals. (unexpected_element): Spelled out this message fully. (next_char): Keep track of locus when not MODE_STRING. (next_char_not_space): Remember last parsed element in error_element. (format_lex): Fix two indentation errors. (check_format): Use format_locus and possibly error_element for a slightly better error message on invalid format. (check_format_string): Set format_locus to start of the string expression used as format. 2008-07-22 Daniel Kraft <d@domob.eu> PR fortran/29835 * io/format.c (struct format_data): New member error_element. (unexpected_element): Added '%c' to message. (next_char): Keep track of last parsed character in fmt->error_element. (format_error): If the message is unexpected_element, output the offending character, too. 2008-07-22 Daniel Kraft <d@domob.eu> PR fortran/29835 * gfortran.dg/fmt_error_3.f90: New test. * gfortran.dg/fmt_error_4.f90: New test. * gfortran.dg/fmt_error_5.f90: New test. ........ r138064 | uweigand | 2008-07-22 10:21:12 -0700 (Tue, 22 Jul 2008) | 5 lines * lib/target-supports.exp (check_effective_target_spu_auto_overlay): New procedure. * lib/compat.exp (compat-execute): Use it to test whether toolchain supports automatic overlay generation for the SPU. ........ r138069 | gccadmin | 2008-07-22 17:16:34 -0700 (Tue, 22 Jul 2008) | 1 line Daily bump. ........ r138072 | jvdelisle | 2008-07-22 21:29:15 -0700 (Tue, 22 Jul 2008) | 6 lines 2008-07-22 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/36852 * io/list_read.c: If variable rank is zero, do not adjust the found namelist object pointer. ........ r138073 | jvdelisle | 2008-07-22 21:36:54 -0700 (Tue, 22 Jul 2008) | 5 lines 2008-07-22 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/36852 * gfortran.dg/namelist_52.f90: New test. ........ r138075 | meissner | 2008-07-23 03:28:06 -0700 (Wed, 23 Jul 2008) | 1 line Add ability to set target options (ix86 only) and optimization options on a function specific basis ........ r138078 | meissner | 2008-07-23 04:06:42 -0700 (Wed, 23 Jul 2008) | 1 line undo 138077 ........ r138082 | meissner | 2008-07-23 04:18:03 -0700 (Wed, 23 Jul 2008) | 1 line Add missing ChangeLog from 138075 ........ r138087 | paolo | 2008-07-23 07:49:00 -0700 (Wed, 23 Jul 2008) | 13 lines 2008-07-23 Chris Fairles <chris.fairles@gmail.com> * acinclude.m4 ([GLIBCXX_CHECK_CLOCK_GETTIME]): Define GLIBCXX_LIBS. Holds the lib that defines clock_gettime (-lrt or -lposix4). * src/Makefile.am: Use it. * configure: Regenerate. * configure.in: Likewise. * Makefile.in: Likewise. * src/Makefile.in: Likewise. * libsup++/Makefile.in: Likewise. * po/Makefile.in: Likewise. * doc/Makefile.in: Likewise. ........ r138089 | manu | 2008-07-23 08:57:49 -0700 (Wed, 23 Jul 2008) | 35 lines 2008-07-23 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR 35058 * diagnostic.c (pedwarn): Add opt parameter. (pedwarn0): New. * c-tree.h (pedwarn_init): Add opt parameter. (pedwarn_c90): Likewise. (pedwarn_c99): Likewise. * c-errors.c (pedwarn_c99): Likewise. (pedwarn_c90): Likewise. * toplev.h (pedwarn): Update declaration. (pedwarn0): Declare. * c-lex.c: All calls to pedwarn changed. * builtins.c: All calls to pedwarn changed. * toplev.c: All calls to pedwarn changed. * c-decl.c: All calls to pedwarn changed. * c-typeck.c: All calls to pedwarn changed. * c-common.c: All calls to pedwarn changed. * c-parser.c: All calls to pedwarn changed. cp/ * typeck.c: All calls to pedwarn changed. * decl.c: All calls to pedwarn changed. * call.c: All calls to pedwarn changed. * error.c: All calls to pedwarn changed. * typeck2.c: All calls to pedwarn changed. * pt.c: All calls to pedwarn changed. * name-lookup.c: All calls to pedwarn changed. * parser.c: All calls to pedwarn changed. fortran/ * f95-lang.c (gfc_mark_addressable): All calls to pedwarn changed. testsuite/ * gcc.dg/Wdeclaration-after-statement-3.c: New. * gcc/testsuite/gcc.dg/Wpointer-arith.c: New. ........ r138091 | meissner | 2008-07-23 12:03:40 -0700 (Wed, 23 Jul 2008) | 1 line Fix PR 36907, breakage in building libobj with function specific changes ........ r138092 | jamborm | 2008-07-23 12:45:45 -0700 (Wed, 23 Jul 2008) | 129 lines 2008-07-23 Martin Jambor <mjambor@suse.cz> * ipa-cp.c (ipcp_print_edge_profiles): Test for node->analyzed rather than for DECL_SAVED_TREE. * ipa-prop.c: Include diagnostic.h. (ipa_check_stmt_modifications): Check LHS of GIMPLE_MODIFY_EXPRs thoroughly. (ipa_detect_param_modifications): Function rewritten from scratch. (ipa_compute_jump_functions): Changed accesses to modification flags. (ipa_free_node_params_substructures): Update flags destruction. (ipa_node_duplication_hook): Update flags duplication. (ipa_print_all_params_modified): Updated flag access. * ipa-prop.h (struct ipa_param_flags): New structure. (struct ipa_node_params): New field modification_analysis_done, modified_flags changed into param_flags. (ipa_is_ith_param_modified): Changed to use new flags. * Makefile.in (ipa-prop.o): Add $(DIAGNOSTIC_H) to dependencies. * ipa-prop.c (ipa_print_all_jump_functions): Moved here from ipa-cp.c and split into two functions. (ipa_print_node_jump_functions): New function. (compute_scalar_jump_functions): New function. (type_like_member_ptr_p): New function. (compute_pass_through_member_ptrs): New function. (fill_member_ptr_cst_jump_function): New function. (determine_cst_member_ptr): New function. (compute_cst_member_ptr_arguments): New function. (ipa_compute_jump_functions): Complete rewrite. * ipa-prop.h (enum jump_func_type): Make explicit that we depend on IPA_UNKNOWN being zero. Added value IPA_CONST_MEMBER_PTR. (struct ipa_member_ptr_cst): New structure. (union jump_func_value): New field member_cst. * ipa-cp.c (ipcp_lat_is_insertable): New function. (ipcp_lattice_from_jfunc): Produces bottom lattices for unhandled jump function types. (ipcp_print_all_lattices): Slight fprintf rearrangement. (ipcp_print_all_structures): Call ipa_print_all_jump_functions instead of ipcp_print_all_jump_functions. (ipcp_insert_stage): Use ipcp_lat_is_insertable, create replace maps only for replacable scalars. * doc/invoke.texi (Optimize options): Add description of -findirect-inlining. * common.opt (flag_indirect_inlining): New flag. * opts.c (decode_options): Set flag_indirect_inlining when optimize >= 3. * ipa-inline.c: Include ipa-prop.h. (inline_indirect_intraprocedural_analysis): New function. (inline_generate_summary): Allocate parameter and argument info structures, call inline_indirect_intraprocedural_analysis on each node when doing indirect inlining and deallocate indirect inlining data structures in the end. * ipa-prop.c (ipa_create_param_decls_array): Return if already done. (free_all_ipa_structures_after_iinln): New function. (free_all_ipa_structures_after_ipa_cp): Checks whether iinln will be done. * Makefile.in (ipa-inline.o): Added $(IPA_PROP_H) to dependencies. * cgraphbuild.c (compute_call_stmt_bb_frequency): New function. (build_cgraph_edges): Call compute_call_stmt_bb_frequency instead of computing the frequency separately. (rebuild_cgraph_edges): Call compute_call_stmt_bb_frequency instead of computing the frequency separately. * ipa-cp.c (ipcp_print_all_structures): Replace a call to ipa_print_all_param_modified with a call to ipa_print_all_param_flags. * ipa-prop.c (ipa_get_member_ptr_load_param): New function. (ipa_get_stmt_member_ptr_load_param): New function. (ipa_is_ssa_with_stmt_def): New function. (ipa_note_param_call): New function. (ipa_analyze_call_uses): New function. (ipa_analyze_stmt_uses): New function. (ipa_analyze_params_uses): New function. (ipa_free_node_params_substructures): Also free the param_calls linked list. (ipa_node_duplication_hook): Also duplicate the param_calls linked list. (ipa_print_node_param_flags): New function. (ipa_print_all_params_modified): Renamed to ipa_print_all_param_flags. (ipa_print_all_param_flags): Calls ipa_print_node_param_flags. * ipa-prop.h (struct ipa_param_flags): New field called. (struct ipa_param_call_note): New structure. (struct ipa_node_params): New fields param_calls and uses_analysis_done. (ipa_is_ith_param_called): New function. * ipa-inline.c (inline_indirect_intraprocedural_analysis): Call ipa_analyze_params_uses and dump parameter flags. * ipa-inline.c (cgraph_decide_recursive_inlining): Call ipa_propagate_indirect_call_infos if performing indirect inlining, pass a new parameter new_edges to it. (add_new_edges_to_heap): New fucntion. (cgraph_decide_inlining_of_small_functions): New vector new_indirect_edges for newly found indirect edges , call ipa_propagate_indirect_call_infos after inlining. (cgraph_decide_inlining): Call ipa_propagate_indirect_call_infos after inlining if performing indirect inlining. Call free_all_ipa_structures_after_iinln when doing so too. (inline_generate_summary): Do not call free_all_ipa_structures_after_iinln here. * ipa-prop.c (update_jump_functions_after_inlining): New function. (print_edge_addition_message): New function. (update_call_notes_after_inlining): New function. (propagate_info_to_inlined_callees): New function. (ipa_propagate_indirect_call_infos): New function. * ipa-prop.h: Include cgraph.h (struct ipa_param_call_note): Fields reordered, new field processed. * cgraph.h (cgraph_edge): Shrink loop_nest field to 31 bits, add a new flag indirect_call. * cgraphunit.c (verify_cgraph_node): Allow indirect edges not to have rediscovered call statements. * cgraph.c (cgraph_create_edge): Initialize indirect_call to zero. (dump_cgraph_node): Dump also the indirect_call flag. (cgraph_clone_edge): Copy also the indirect_call flag. * tree-inline.c (copy_bb): Do not check for fndecls from call expressions, check for edge availability when moving clones. (get_indirect_callee_fndecl): New function. (expand_call_inline): If callee declaration is not apprent from the statement, try calling get_indirect_callee_fndecl. Do not issue warnings or call sorry when not inlinings an indirect edge. * Makefile.in (IPA_PROP_H): Added $(CGRAPH_H) to dependencies. * ipa-prop.c (ipa_print_node_param_flags): Make the dump format a bit more frandly to matching. * testsuite/g++.dg/ipa/iinline-1.C: New testcase. * testsuite/gcc.dg/ipa/iinline-1.c: New testcase. * testsuite/gcc.dg/ipa/modif-1.c: New testcase. ........ r138096 | paolo | 2008-07-23 15:17:31 -0700 (Wed, 23 Jul 2008) | 9 lines 2008-07-23 Chris Fairles <chris.fairles@gmail.com> * include/std/condition_variable: Update to N2691 WD. * include/std/mutex: Likewise. * testsuite/30_threads/mutex/cons/assign_neg.cc: Adjust line numbers. * testsuite/30_threads/mutex/cons/copy_neg.cc: Likewise. * testsuite/30_threads/recursive_mutex/cons/assign_neg.cc: Likewise. * testsuite/30_threads/recursive_mutex/cons/copy_neg.cc: Likewise. ........ r138097 | aaronwl | 2008-07-23 15:50:42 -0700 (Wed, 23 Jul 2008) | 6 lines 2008-07-23 Aaron W. LaFramboise <aaronavay62@aaronwl.com> * configure: Regenerate. * configure.ac: Require texinfo 4.7. * doc/install.texi: Document texinfo 4.7 requirement. ........ r138100 | gccadmin | 2008-07-23 17:16:34 -0700 (Wed, 23 Jul 2008) | 1 line Daily bump. ........ r138104 | bje | 2008-07-23 20:35:02 -0700 (Wed, 23 Jul 2008) | 3 lines * config/rs6000/rs6000-c.c: Move GTY(()) markers to match conventional usage. ........ r138106 | bje | 2008-07-23 20:59:55 -0700 (Wed, 23 Jul 2008) | 12 lines gcc/ * config/spu/spu-c.c (__vector_keyword): New variable. (vector_keyword): Likewise. (spu_categorize_keyword): New function. (spu_macro_to_expand): Likewise. (spu_cpu_cpp_builtins): Enable context-sensitive macros if not compiling an ISO C dialect. gcc/testsuite/ * gcc.target/spu/vector.c: New test. * gcc.target/spu/vector-ansi.c: Likewise. ........ r138107 | ian | 2008-07-23 21:51:12 -0700 (Wed, 23 Jul 2008) | 6 lines ./: * tree-vrp.c (infer_value_range): Ignore asm statements when looking for memory accesses for -fdelete-null-pointer-checks. testsuite/: * gcc.target/i386/20080723-1.c: New test. ........ r138110 | rwild | 2008-07-23 23:35:21 -0700 (Wed, 23 Jul 2008) | 7 lines libiberty/ * maint-tool (deps): Output config.h instead of stamp-h. * Makefile.in: Rebuild deps. (maintainer-clean-subdir): Depend on stamp-h rather than config.h. Reverts 2007-07-11 change. ........ r138112 | tkoenig | 2008-07-24 02:26:43 -0700 (Thu, 24 Jul 2008) | 67 lines 2008-07-24 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/29952 * gfortran.h: Add "warn_array_temp" to gfc_option_t. * lang.opt: Add -Warray-temporaries. * invoke.texi: Document -Warray-temporaries * trans-array.h (gfc_trans_create_temp_array): Add argument of type *locus. (gfc_conv_loop_setup): Likewise. * trans-array.c (gfc_trans_create_temp_array): If -Warray-temporaries is given and locus is present, warn about creation of array temporaries. (gfc_trans_array_constructor_subarray): Add locus to call of gfc_conv_loop_setup. (gfc_trans_array_constructor): Add where argument. Pass where argument to call of gfc_trans_create_temp_array. (gfc_add_loop_ss_code): Add where argument. Pass where argument to recursive call of gfc_add_loop_ss_code and to call of gfc_trans_array_constructor. (gfc_conv_loop_setup): Add where argument. Pass where argument to calls to gfc_add_loop_ss_code and to gfc_trans_create_temp_array. (gfc_conv_expr_descriptor): Pass location to call of gfc_conv_loop_setup. (gfc_conv_array_parameter): If -Warray-temporaries is given, warn about creation of temporary arrays. * trans-expr.c (gfc_conv_subref_array_arg): Add where argument to call to gfc_conv_loop_setup. (gfc_conv_function_call): Add where argument to call to gfc_trans_creat_temp_array. (gfc_trans_subarray_assign): Likewise. (gfc_trans_assignment_1): Add where argument to call to gfc_conv_loop_setup. * trans-stmt.c (gfc_conv_elemental_dependencies): Add where argument to call to gfc_trans_create_temp_array. (gfc_trans_call): Add where argument to call to gfc_conv_loop_setup. (generate_loop_for_temp_to_lhs): Likewise. (generate_loop_for_rhs_to_temp): Likewise. (compute_inner_temp_size): Likewise. (gfc_trans-pointer_assign_need_temp): Likewise. (gfc_evaluate_where_mask): Likewise. (gfc_trans_where_assign): Likewise. (gfc_trans_where_3): Likewise. * trans-io.c (transfer_srray_component): Add where argument to function. Add where argument to call to gfc_conv_loop_setup. (transfer_expr): Add where argument to call to transfer_array_component. (gfc_trans_transfer): Add where expression to call to gfc_conv_loop_setup. * trans-intrinsic.c (gfc_conv_intrinsic_anyall): Add where argument to call to gfc_conv_loop_setup. (gfc_conv_intrinsic_count): Likewise. (gfc_conv_intrinsic_arith): Likewise. (gfc_conv_intrinsic_dot_product): Likewise. (gfc_conv_intrinsic_minmaxloc): Likewise. (gfc_conv_intrinsic_minmaxval): Likewise. (gfc_conv_intrinsic_array_transfer): Warn about creation of temporary array. Add where argument to call to gfc_trans_create_temp_array. * options.c (gfc_init_options): Initialize gfc_option.warn_array_temp. (gfc_handle_option): Set gfc_option.warn_array_temp. 2008-07-24 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/29952 * gfortran.dg/array_temporaries_1.f90: New test case. ........ r138119 | ktietz | 2008-07-24 08:47:17 -0700 (Thu, 24 Jul 2008) | 7 lines 2008-07-24 Kai Tietz <kai.tietz@onevision.com> * config/i386/i386.c (get_dllimport_decl): Treat user_label_prefix for imp symbol extension. ........ r138120 | domob | 2008-07-24 09:06:55 -0700 (Thu, 24 Jul 2008) | 6 lines 2008-07-24 Daniel Kraft <d@domob.eu> * match.c (gfc_match): Add assertion to catch wrong calls trying to match upper-case characters. ........ r138122 | domob | 2008-07-24 11:52:51 -0700 (Thu, 24 Jul 2008) | 63 lines 2008-07-24 Daniel Kraft <d@domob.eu> PR fortran/33141 * lang.opt (Wnonstd-intrinsics): Removed option. (Wintrinsics-std), (Wintrinsic-shadow): New options. * invoke.texi (Option Summary): Removed -Wnonstd-intrinsics from the list and added -Wintrinsics-std and -Wintrinsic-shadow. (Error and Warning Options): Documented the new options and removed the documentation for -Wnonstd-intrinsics. * gfortran.h (gfc_option_t): New members warn_intrinsic_shadow and warn_intrinsics_std, removed warn_nonstd_intrinsics. (gfc_is_intrinsic): Renamed from gfc_intrinsic_name. (gfc_warn_intrinsic_shadow), (gfc_check_intrinsic_standard): New. * decl.c (match_procedure_decl): Replaced gfc_intrinsic_name by the new name gfc_is_intrinsic. (warn_intrinsic_shadow): New helper method. (gfc_match_function_decl), (gfc_match_subroutine): Call the new method warn_intrinsic_shadow to check the just-parsed procedure. * expr.c (check_init_expr): Call new gfc_is_intrinsic to check whether the function called is really an intrinsic in the selected standard. * intrinsic.c (gfc_is_intrinsic): Renamed from gfc_intrinsic_name and extended to take into account the selected standard settings when trying to find out whether a symbol is an intrinsic or not. (gfc_check_intrinsic_standard): Made public and extended. (gfc_intrinsic_func_interface), (gfc_intrinsic_sub_interface): Removed the calls to check_intrinsic_standard, this check now happens inside gfc_is_intrinsic. (gfc_warn_intrinsic_shadow): New method defined. * options.c (gfc_init_options): Initialize new warning flags to false and removed intialization of Wnonstd-intrinsics flag. (gfc_post_options): Removed logic for Wnonstd-intrinsics flag. (set_Wall): Set new warning flags and removed Wnonstd-intrinsics flag. (gfc_handle_option): Handle the new flags and removed handling of the old Wnonstd-intrinsics flag. * primary.c (gfc_match_rvalue): Replaced call to gfc_intrinsic_name by the new name gfc_is_intrinsic. * resolve.c (resolve_actual_arglist): Ditto. (resolve_generic_f), (resolve_unknown_f): Ditto. (is_external_proc): Ditto. (resolve_generic_s), (resolve_unknown_s): Ditto. (resolve_symbol): Ditto and ensure for symbols declared INTRINSIC that they are really available in the selected standard setting. 2008-07-24 Daniel Kraft <d@domob.eu> PR fortran/33141 * gfortran.dg/intrinsic_shadow_1.f03: New test for -Wintrinsic-shadow. * gfortran.dg/intrinsic_shadow_2.f03: Ditto. * gfortran.dg/intrinsic_shadow_3.f03: Ditto. * gfortran.dg/intrinsic_std_1.f90: New test for -Wintrinsics-std. * gfortran.dg/intrinsic_std_2.f90: Ditto. * gfortran.dg/intrinsic_std_3.f90: Ditto. * gfortran.dg/intrinsic_std_4.f90: Ditto. * gfortran.dg/warn_std_1.f90: Removed option -Wnonstd-intrinsics. * gfortran.dg/warn_std_2.f90: Replaced -Wnonstd-intrinsics by -Wintrinsics-std and adapted expected errors/warnings. * gfortran.dg/warn_std_3.f90: Ditto. * gfortran.dg/c_sizeof_2.f90: Adapted expected error/warning message. * gfortran.dg/gamma_2.f90: Ditto. * gfortran.dg/selected_char_kind_3.f90: Ditto. * gfortran.dg/fmt_g0_2.f08: Call with -fall-intrinsics to allow abort. ........ r138123 | jason | 2008-07-24 12:15:00 -0700 (Thu, 24 Jul 2008) | 29 lines Implement defaulted/deleted functions as per N2346 * cp-tree.h (struct lang_decl_flags): Add defaulted_p bitfield. (DECL_DELETED_FN): New macro. (DECL_DEFAULTED_FN): New macro. * class.c (user_provided_p): New fn. (defaultable_fn_p): New fn. (type_has_user_provided_constructor): New fn. (type_has_user_provided_default_constructor): New fn. (check_methods): A defaulted fn is still trivial. (check_bases_and_members): Likewise. * decl.c (grok_special_member_properties): Likewise. (duplicate_decls): Complain about redeclaring a function as deleted. (start_decl): initialized==2 means deleted. (cp_finish_decl): Handle deleted/defaulted semantics. * decl2.c (grokfield): Likewise. (mark_used): Check DECL_DEFAULTED_FN instead of DECL_ARTIFICIAL. Complain about using a deleted fn. * init.c (build_value_init_1): Use type_has_user_provided_constructor. (perform_member_init): Check for a user-provided default constructor even if TYPE_NEEDS_CONSTRUCTING. (build_new_1): Likewise. * call.c (build_over_call): Don't call mark_used twice. * method.c (implicitly_declare_fn): Set DECL_DEFAULTED_FN. * search.c (check_final_overrider): Check for deleted mismatch. * parser.c (cp_parser_init_declarator): Tell start_decl about =delete. (cp_parser_pure_specifier): Handle =default and =delete. * error.c (maybe_warn_cpp0x): Suggest -std=gnu++0x as well. ........ r138127 | paolo | 2008-07-24 15:47:26 -0700 (Thu, 24 Jul 2008) | 17 lines 2008-07-24 Paolo Carlini <paolo.carlini@oracle.com> PR libstdc++/36924 Revert: 2008-07-23 Chris Fairles <chris.fairles@gmail.com> * acinclude.m4 ([GLIBCXX_CHECK_CLOCK_GETTIME]): Define GLIBCXX_LIBS. Holds the lib that defines clock_gettime (-lrt or -lposix4). * src/Makefile.am: Use it. * configure: Regenerate. * configure.in: Likewise. * Makefile.in: Likewise. * src/Makefile.in: Likewise. * libsup++/Makefile.in: Likewise. * po/Makefile.in: Likewise. * doc/Makefile.in: Likewise. ........ r138128 | kkojima | 2008-07-24 17:14:57 -0700 (Thu, 24 Jul 2008) | 6 lines * config/sh/sh.h (OPTIMIZATION_OPTIONS): Set flag_omit_frame_pointer to 2 instead of -1. (OVERRIDE_OPTIONS): Check if flag_omit_frame_pointer is equal to 2. ........ r138131 | gccadmin | 2008-07-24 17:16:48 -0700 (Thu, 24 Jul 2008) | 1 line Daily bump. ........ r138139 | ro | 2008-07-25 05:27:29 -0700 (Fri, 25 Jul 2008) | 2 lines * raise-gcc.c: Move tsystem.h before tm.h. ........ r138140 | hubicka | 2008-07-25 06:11:32 -0700 (Fri, 25 Jul 2008) | 102 lines * cgraphbuild.c (record_reference): Drop non-unit-at-a-time code. (build_cgraph_edges): Likewise. * cgraph.c (cgraph_node): Do not update assembler hash. (cgraph_remove_node): Drop non-unit-at-a-time code. * tree-pass.h (pass_O0_always_inline): Remove. * ipa-reference.c (gate_reference): Remove unit-at-a-time check. * toplev.c (process_options): Flag unit-at-a-time does not imply no section anchors. * cgraphunit.c: Update comments. (decide_is_function_needed): Drop non-unit-at-a-time mode. (cgraph_assemble_pending_functions): Remove. (cgraph_reset_node): Drop non-unit-at-a-time code. (cgraph_finalize_function): Likewise. (cgraph_analyze_function): Likewise. (cgraph_finalize_compilation_unit): Likewise. (cgraph_expand_function): Likewise. (cgraph_optimize): Likesise. (save_inline_function_body): Likewise. * ipa-pure-const.c (gate_pure_const): Drop flag_unit_at_a_time check. * tree-ssa-alias.c (maybe_be_aliased): Likewise. * ipa-inline.c: Update comments. (enum inlining_mode): remove INLINE_SPEED. (cgraph_clone_inlined_nodes): Drop unit-at-a-time check. (cgraph_mark_inline_edge): Likewise. (try_inline): Likewise. (cgraph_decide_inlining_incrementally): Likewise. (cgraph_gate_inlining): Remove. (cgraph_early_inlining): Remove flag_unit_at_a_time checks. (cgraph_gate_early_inlining): Likewise. (gate_inline_passes): Remove. (pass_inline_parameters, pass_ipa_inline): Remove gates. (cgraph_gate_O0_always_inline, cgraph_O0_always_inline, pass_O0_always_inline): Remove. * c-pch.c (c_pch_matching): Remove -funit-at-a-time. * dwarf2out.c (reference_to_unused): Remove flag_unit_at_a_time check. * opts.c (no_unit_at_a_time_default): Remove. (decode_options): Remove flag_unit_at_a_time reset and warning. * opts.h (no_unit_at_a_time_default): Remove. * c-decl.c (diagnose_mismatched_decls): Do not require inline keyword early in GNU dialect. (merge_decls): Update comment; drop unit-at-a-time check. (finish_decl): Likewise. (grok_declaration): Remove flag_inline_trees code. (finish_functions): Return on function returning non-void on all statics. * ipa-tye-escape.c (gate_type_escape_vars): Remove. * cfgexpand.c (expand_one_static_var): Remove. (expand_one_var): Remove expand_one_static_var call. (expand_used_vars_for_block): Remove flag_unit_a_time check. * c-opts.c (c_common_post_options): Remove flag_inline_trees code and flag_unit_at_a-time compatibility checks. * varasm.c (assemble_alias): Remove flag_unit_at_a_time check. * tree-inline.c (flag_inline_trees): Remove. (inlinable_function_p): Don't check it. (expand_call_inline): Remove non-unit-at-a-time code. * tree-inline.h (flag_inline_trees): Remove. * tree-optimize.c (execute_early_local_optimizations): Remove unit-at-a-time checks. (tree_rest_of_compilation): Likewise. * combine.c (setup_incoming_promotions): Likewise. * tree-profile.c (tree_gen_ic_func_profiler): Likewise. * tree-ssa-structalias.c (delete_points_to_sets): Likewise. * passes.c (pass_inline_parameters): Update comments; remove O0_alwaysinline pass. (execute_one_ipa_transform_pass): Do not reset in_gimple_form. (execute_one_pass): Likewise. * i386.c (ix86_function_regparm): Remove unit-at-a-time check. (ix86_function_sseregparm): Likewise. * arm.c (arm_function_in_section_p): Likewise. * bfin.c (bfin_load_pic_reg, bfin_function_ok_for_sibcall): Likewise. * varpool.c: Update comments. (decide_is_variable_needed): Remove unit-at-a-time checks. (varpool_finalize_decl): Likewise. * ada/utils.c (end_subprog_body): Remove inline trees check. * ada/misc.c (gnat_post_options): Do not set flag_inline_trees. * fortran/options.c (gfc_post_options): Remove flag_unline_trees code. * gcc.dg/winline-4.c: Remove. * gcc.dg/pch/valid-3.hs: Remove. * gcc.dg/pch/valid-3.c: Remove. * g++.old-deja/g++.brendan/crash52.C: Accept returning void warning * g++.old-deja/g++.jason/report.C: Likewise. * testsuite/g++.dg/warn/pr23075.C: We get returning void warning instead of control flow warning. * cp/decl.c (duplicate_decls): Update comment and unit-at-a-time. (grogfndecl): Drop flag_inline_trees code. * cp/pt.c (instantiate_decl): Drop flag_iline_trees code. * cp/lex.c (cxx_init): Do not set unit-at-a-time. * java/decl.c: Include cgraph.h (end_java_method): Remove non-unit-at-a-time code. (java_mark_decl_local): Likewise; sanity check that we don't touch finalized nodes. ........ r138141 | hubicka | 2008-07-25 07:25:39 -0700 (Fri, 25 Jul 2008) | 2 lines Remove files that was intended to be removed in last commit. ........ r138142 | jason | 2008-07-25 08:18:16 -0700 (Fri, 25 Jul 2008) | 3 lines * class.c (type_has_user_provided_default_constructor): Handle templates. ........ r138143 | jsm28 | 2008-07-25 08:49:36 -0700 (Fri, 25 Jul 2008) | 4 lines * lib/target-supports.exp (check_effective_target_arm_thumb1_ok): New. * g++.dg/inherit/thunk8.C: Use it. ........ r138145 | andreast | 2008-07-25 08:59:12 -0700 (Fri, 25 Jul 2008) | 6 lines 2008-07-25 Andreas Tobler <a.tobler@schweiz.org> PR bootstrap/36918 * config/sparc/sparc.h (DEFAULT_PCC_STRUCT_RETURN): Define DEFAULT_PCC_STRUCT_RETURN to 127. ........ r138146 | jsm28 | 2008-07-25 09:21:05 -0700 (Fri, 25 Jul 2008) | 3 lines * config/arm/iwmmxt.md (movv8qi_internal, movv4hi_internal, movv2si_internal): Add mem = reg alternative. ........ r138148 | hjl | 2008-07-25 13:30:35 -0700 (Fri, 25 Jul 2008) | 6 lines 2008-07-25 Martin Jambor <mjambor@suse.cz> PR tree-optimization/36926 * ipa-prop.c (ipa_analyze_call_uses): Call ipa_is_ssa_with_stmt_def instead of SSA_NAME_IS_DEFAULT_DEF. ........ r138150 | hubicka | 2008-07-25 14:03:34 -0700 (Fri, 25 Jul 2008) | 15 lines * typeck.c (inline_conversion): Remove. (cp_build_function_call): Do not use inline_conversion. * decl.c (duplicate_decls): Do not insist on inline being declared early. (start_cleanup_fn): Do not assume that INLINE flags prevent function from being output. We now remove static functions always. (finish_function): Do return warning on all static functions. * call.c (build_over_call): Do not use inline_conversion. * cp-tree.h (possibly_inlined_p): Declare. (inline_conversion): Remove. * pt.c (instantiate_decl): Use possibly_inlined_p predicate. * decl2.c (cp_write_global_declarations): Likewise. (mark_used): Likewise. (possibly_inlined_p): New functions. ........ r138151 | hubicka | 2008-07-25 14:05:23 -0700 (Fri, 25 Jul 2008) | 2 lines Fix changelog entry of my earlier commit. ........ r138154 | meissner | 2008-07-25 16:44:24 -0700 (Fri, 25 Jul 2008) | 1 line Fix IA-64 breakage; Make hot/cold optimization conversation port specific; Move disabling of scheduling from OVERRIDE_OPTIONS to OPTIMIZATION_OPTIONS ........ r138159 | gccadmin | 2008-07-25 17:16:56 -0700 (Fri, 25 Jul 2008) | 1 line Daily bump. ........ r138165 | hubicka | 2008-07-26 03:03:01 -0700 (Sat, 26 Jul 2008) | 7 lines * cgraph.c (cgraph_function_possibly_inlined_p): Do not rely on DECL_INLINE. * cgraphunit.c (record_cdtor_fn): Do not initialize DECL_INLINE (cgraph_preserve_function_body_p): Do not rely on DECL_INLINE. * dojump.c (clear_pending_stack_adjust): Likewise. * print-tree.c (print_node): Ignore DECL_INLINE. * tree-inline.c (inlinable_function_p): Likewise. ........ r138167 | tkoenig | 2008-07-26 03:30:50 -0700 (Sat, 26 Jul 2008) | 6 lines 2008-07-26 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/36934 * gfortran.dg/allocatable_module_1.f90: New test case. ........ r138179 | hainque | 2008-07-26 07:26:45 -0700 (Sat, 26 Jul 2008) | 6 lines * collect2.c (symkind): New enum. Symbol kinds we care about. (is_ctor_dtor): Return symkind instead of int. Adjust prototype, code and head comment accordingly. (scan_prog_file): Use symkind names instead of bare integers. ........ r138180 | ebotcazou | 2008-07-26 12:03:37 -0700 (Sat, 26 Jul 2008) | 1 line Fix nits. ........ r138181 | gerald | 2008-07-26 14:41:15 -0700 (Sat, 26 Jul 2008) | 3 lines * doc/install.texi (powerpc-*-netbsd*): Remove redundant texinfo version requirements. ........ r138184 | gccadmin | 2008-07-26 17:16:44 -0700 (Sat, 26 Jul 2008) | 1 line Daily bump. ........ r138186 | burnus | 2008-07-27 03:45:44 -0700 (Sun, 27 Jul 2008) | 52 lines 2008-07-27 Tobias Burnus <burnus@net-b.de> PR fortran/36132 PR fortran/29952 PR fortran/36909 * trans.c (gfc_trans_runtime_check): Allow run-time warning * besides run-time error. * trans.h (gfc_trans_runtime_check): Update declaration. * trans-array.c * (gfc_trans_array_ctor_element,gfc_trans_array_bound_check, gfc_conv_array_ref,gfc_conv_ss_startstride,gfc_trans_dummy_array_bias): Updated gfc_trans_runtime_check calls. (gfc_conv_array_parameter): Implement flag_check_array_temporaries, fix packing/unpacking for nonpresent optional actuals to optional formals. * trans-array.h (gfc_conv_array_parameter): Update declaration. * trans-expr.c (gfc_conv_substring,gfc_trans_arrayfunc_assign, gfc_conv_function_call): Updated gfc_trans_runtime_check calls. (gfc_conv_function_call): Update gfc_conv_array_parameter calls. * trans-expr.c (gfc_trans_goto): Updated gfc_trans_runtime_check calls. * trans-io.c (set_string,gfc_conv_intrinsic_repeat): Ditto. (gfc_conv_intrinsic_transfer,gfc_conv_intrinsic_loc): Same for gfc_conv_array_parameter. * trans-intrinsics.c (gfc_conv_intrinsic_bound): Ditto. * trans-decl.c (gfc_build_builtin_function_decls): Add gfor_fndecl_runtime_warning_at. * lang.opt: New option fcheck-array-temporaries. * gfortran.h (gfc_options): New flag_check_array_temporaries. * options.c (gfc_init_options, gfc_handle_option): Handle flag. * invoke.texi: New option fcheck-array-temporaries. 2008-07-27 Tobias Burnus <burnus@net-b.de> PR fortran/36132 PR fortran/29952 PR fortran/36909 * runtime/error.c: New function runtime_error_at. * gfortran.map: Ditto. * libgfortran.h: Ditto. 2008-07-27 Tobias Burnus <burnus@net-b.de> PR fortran/36132 PR fortran/29952 PR fortran/36909 gfortran.dg/internal_pack_4.f90: New. gfortran.dg/internal_pack_5.f90: New. gfortran.dg/array_temporaries_2.f90: New. ........ r138189 | paolo | 2008-07-27 08:49:12 -0700 (Sun, 27 Jul 2008) | 14 lines 2008-07-27 Paolo Carlini <paolo.carlini@oracle.com> * decl.c (push_library_fn): Add a parameter for the exceptions that the function may throw. (push_void_library_fn, push_throw_library_fn, expand_static_init): Adjust. (build_library_fn): Change to static. * cp-tree.h: Adjust declarations. * except.c (declare_nothrow_library_fn): New. (do_get_exception_ptr, do_begin_catch, do_free_exception, do_allocate_exception): Use the latter, adjust the declarations (ie, add empty exception-specification), consistently with the actual implementation in libsupc++. ........ r138190 | dfranke | 2008-07-27 09:32:14 -0700 (Sun, 27 Jul 2008) | 6 lines 2008-07-27 Daniel Franke <franke.daniel@gmail.com> PR fortran/36724 * gfortran.dg/pointer_to_substring.f90: New test. ........ r138191 | ebotcazou | 2008-07-27 09:55:31 -0700 (Sun, 27 Jul 2008) | 4 lines PR tree-optimization/36830 * tree-ssa-sccvn.c (vn_reference_op_compute_hash): Hash operand #2. (expressions_equal_p): Return false if only one operand is null. ........ r138194 | hjl | 2008-07-27 10:40:04 -0700 (Sun, 27 Jul 2008) | 15 lines gcc/cp/ 2008-07-27 H.J. Lu <hongjiu.lu@intel.com> PR c++/36944 * class.c (type_has_user_provided_default_constructor): Handle default parameters. gcc/testsuite/ 2008-07-27 H.J. Lu <hongjiu.lu@intel.com> PR c++/36944 * g++.dg/other/pr36944.C: New. ........ r138198 | victork | 2008-07-27 14:44:25 -0700 (Sun, 27 Jul 2008) | 14 lines 2008-07-27 Victor Kaplansky <victork@il.ibm.com> PR tree-optimization/35252 * tree-vect-analyze.c (vect_build_slp_tree): Make IMAGPART_EXPR and REALPART_EXPR to be considered as same load operation. testsuite PR tree-optimization/35252 * gcc.dg/vect/vect-complex-1.c, gcc.dg/vect/vect-complex-2.c, gcc.dg/vect/fast-math-vect-complex-3.c, gcc.dg/vect/vect-complex-4.c: New tests. ........ r138201 | gccadmin | 2008-07-27 17:16:51 -0700 (Sun, 27 Jul 2008) | 1 line Daily bump. ........ r138206 | simonb | 2008-07-28 04:55:11 -0700 (Mon, 28 Jul 2008) | 9 lines * c-pragma.c (handle_pragma_message): New function. (init_pragma): Register handle_pragma_message. * doc/extend.texi (Diagnostic Pragmas): Added #pragma message documentation. * gcc.dg/pragma-message.c: New. ........ r138207 | rguenth | 2008-07-28 07:33:56 -0700 (Mon, 28 Jul 2008) | 201 lines 2008-07-28 Richard Guenther <rguenther@suse.de> Merge from gimple-tuples-branch. * ChangeLog.tuples: ChangeLog from gimple-tuples-branch. * gimple.def: New file. * gsstruct.def: Likewise. * gimple-iterator.c: Likewise. * gimple-pretty-print.c: Likewise. * tree-gimple.c: Removed. Merged into ... * gimple.c: ... here. New file. * tree-gimple.h: Removed. Merged into ... * gimple.h: ... here. New file. * Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h. * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the --enable-checking=gimple flag. * config.in: Likewise. * configure: Regenerated. * tree-ssa-operands.h: Tuplified. * tree-vrp.c: Likewise. * tree-loop-linear.c: Likewise. * tree-into-ssa.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-dump.c: Likewise. * tree-complex.c: Likewise. * cgraphbuild.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-pretty-print.c: Likewise. * tracer.c: Likewise. * gengtype.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * tree-ssa-loop-manip.c: Likewise. * value-prof.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-tailcall.c: Likewise. * value-prof.h: Likewise. * tree.c: Likewise. * tree.h: Likewise. * tree-pass.h: Likewise. * ipa-cp.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h: Likewise. * target.h: Likewise. * lambda-mat.c: Likewise. * tree-phinodes.c: Likewise. * diagnostic.h: Likewise. * builtins.c: Likewise. * tree-ssa-alias-warnings.c: Likewise. * cfghooks.c: Likewise. * fold-const.c: Likewise. * cfghooks.h: Likewise. * omp-low.c: Likewise. * tree-ssa-dse.c: Likewise. * ipa-reference.c: Likewise. * tree-ssa-uncprop.c: Likewise. * toplev.c: Likewise. * tree-gimple.c: Likewise. * tree-gimple.h: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * cgraphunit.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-nomudflap.c: Likewise. * tree-call-cdce.c: Likewise. * ipa-pure-const.c: Likewise. * c-format.c: Likewise. * tree-stdarg.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-nrv.c: Likewise. * tree-ssa-propagate.c: Likewise. * ipa-utils.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-alias.c: Likewise. * gimple-low.c: Likewise. * tree-ssa-sink.c: Likewise. * ipa-inline.c: Likewise. * c-semantics.c: Likewise. * dwarf2out.c: Likewise. * expr.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * predict.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-parloops.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * matrix-reorg.c: Likewise. * c-decl.c: Likewise. * tree-eh.c: Likewise. * c-pretty-print.c: Likewise. * lambda-trans.c: Likewise. * function.c: Likewise. * langhooks.c: Likewise. * ebitmap.h: Likewise. * tree-vectorizer.c: Likewise. * function.h: Likewise. * langhooks.h: Likewise. * tree-vectorizer.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * domwalk.c: Likewise. * tree-if-conv.c: Likewise. * profile.c: Likewise. * domwalk.h: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-flow-inline.h: Likewise. * tree-affine.c: Likewise. * tree-vect-analyze.c: Likewise. * c-typeck.c: Likewise. * gimplify.c: Likewise. * coretypes.h: Likewise. * tree-ssa-phiopt.c: Likewise. * calls.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree.def: Likewise. * tree-dfa.c: Likewise. * except.c: Likewise. * except.h: Likewise. * cfgexpand.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-live.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.h: Likewise. * tree-predcom.c: Likewise. * lambda.h: Likewise. * tree-mudflap.c: Likewise. * ipa-prop.c: Likewise. * print-tree.c: Likewise. * tree-ssa-copy.c: Likewise. * ipa-prop.h: Likewise. * tree-ssa-forwprop.c: Likewise. * ggc-page.c: Likewise. * c-omp.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-nested.c: Likewise. * tree-ssa.c: Likewise. * lambda-code.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-iterator.c: Likewise. * tree-optimize.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-vect-transform.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * cfgloop.c: Likewise. * system.h: Likewise. * tree-profile.c: Likewise. * cfgloop.h: Likewise. * c-gimplify.c: Likewise. * c-common.c: Likewise. * tree-vect-generic.c: Likewise. * tree-flow.h: Likewise. * c-common.h: Likewise. * basic-block.h: Likewise. * tree-ssa-structalias.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-ssa-structalias.h: Likewise. * tree-cfg.c: Likewise. * passes.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * tree-ssa-reassoc.c: Likewise. * cfgrtl.c: Likewise. * varpool.c: Likewise. * stmt.c: Likewise. * tree-ssanames.c: Likewise. * tree-ssa-threadedge.c: Likewise. * langhooks-def.h: Likewise. * tree-ssa-operands.c: Likewise. * config/alpha/alpha.c: Likewise. * config/frv/frv.c: Likewise. * config/s390/s390.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32c/m32c-protos.h: Likewise. * config/spu/spu.c: Likewise. * config/sparc/sparc.c: Likewise. * config/i386/i386.c: Likewise. * config/sh/sh.c: Likewise. * config/xtensa/xtensa.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/ia64/ia64.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/pa/pa.c: Likewise. * config/mips/mips.c: Likewise. ........ r138208 | burnus | 2008-07-28 09:02:51 -0700 (Mon, 28 Jul 2008) | 5 lines 2008-07-28 Tobias Burnus <burnus@net-b.de> * Make-lang.in: Remove -Wno-* from fortran-warn. ........ r138211 | aldyh | 2008-07-28 10:37:05 -0700 (Mon, 28 Jul 2008) | 3 lines * MAINTAINERS: Add Jakub and myself as gimple maintainers. ........ r138213 | rguenth | 2008-07-28 11:29:04 -0700 (Mon, 28 Jul 2008) | 11 lines 2008-07-28 Richard Guenther <rguenther@suse.de> * tree-ssa-pre.c (insert_into_preds_of_block): Remove dead code. (insert_fake_stores): Remove. (realify_fake_stores): Likewise. (execute_pre): Remove dead code. * tree-ssa-structalias.c (get_constraint_for_1): Remove tcc_unary case. (find_func_aliases): Deal with it here instead. Re-enable gcc_unreachable call. ........ r138214 | chaoyingfu | 2008-07-28 11:47:44 -0700 (Mon, 28 Jul 2008) | 3 lines * configure.tgt: Enable futex for MIPS. * config/linux/mips/futex.h: New file. ........ r138215 | aldyh | 2008-07-28 12:50:50 -0700 (Mon, 28 Jul 2008) | 2 lines fix typo ........ r138216 | andreast | 2008-07-28 13:30:00 -0700 (Mon, 28 Jul 2008) | 7 lines 2008-07-28 Andreas Tobler <a.tobler@schweiz.org> * configure.ac: Use the m4_do macro to concatenate the warnings into one string in ACX_PROG_CC_WARNING_OPTS, ACX_PROG_CC_WARNING_ALMOST_PEDANTIC and ACX_PROG_CC_WARNINGS_ARE_ERRORS. * configure: Regenerate. ........ r138217 | rguenth | 2008-07-28 13:32:32 -0700 (Mon, 28 Jul 2008) | 12 lines 2008-07-28 Richard Guenther <rguenther@suse.de> PR tree-optimization/36957 * tree-flow.h (tree_ssa_useless_type_conversion): Remove. (useless_type_conversion_p): Remove. (types_compatible_p): Remove. * gimple.h (tree_ssa_useless_type_conversion): Declare. (useless_type_conversion_p): Declare. (types_compatible_p): Declare. (gimple_expr_type): Return the base type only if it is trivially convertible to the subtype. ........ r138219 | paolo | 2008-07-28 16:28:16 -0700 (Mon, 28 Jul 2008) | 8 lines 2008-07-28 Paolo Carlini <paolo.carlini@oracle.com> PR libstdc++/36949 * include/tr1_impl/boost_shared_ptr.h (__shared_ptr(_Sp_make_shared_tag, _Alloc, _Args&&...): Call __enable_shared_from_this_helper. * testsuite/20_util/shared_ptr/creation/36949.cc: New. ........ r138221 | jason | 2008-07-28 17:06:08 -0700 (Mon, 28 Jul 2008) | 3 lines PR c++/36943 * decl.c (reshape_init_r): Allow C++0x initializer lists. ........ r138224 | gccadmin | 2008-07-28 17:16:58 -0700 (Mon, 28 Jul 2008) | 1 line Daily bump. ........ r138226 | ghazi | 2008-07-28 17:45:52 -0700 (Mon, 28 Jul 2008) | 27 lines * gfortran.h (try): Remove macro. Replace try with gfc_try throughout. * array.c: Likewise. * check.c: Likewise. * cpp.c: Likewise. * cpp.h: Likewise. * data.c: Likewise. * data.h: Likewise. * decl.c: Likewise. * error.c: Likewise. * expr.c: Likewise. * interface.c: Likewise. * intrinsic.c: Likewise. * intrinsic.h: Likewise. * io.c: Likewise. * match.h: Likewise. * parse.c: Likewise. * parse.h: Likewise. * resolve.c: Likewise. * scanner.c: Likewise. * simplify.c: Likewise. * symbol.c: Likewise. * trans-openmp.c: Likewise. * trans-types.c: Likewise. ........ r138233 | kkojima | 2008-07-29 02:07:49 -0700 (Tue, 29 Jul 2008) | 5 lines * config/sh/sh.c (sh_gimplify_va_arg_expr): Unshare the addr, valist, next_fp, next_fp_tmp, next_fp_limit, next_o, next_o_limit, next_stack, lab_false and lab_over trees. ........ r138234 | domob | 2008-07-29 02:11:51 -0700 (Tue, 29 Jul 2008) | 16 lines 2008-07-29 Daniel Kraft <d@domob.eu> PR fortran/36403 * trans-intrinsic.c (conv_generic_with_optional_char_arg): New method to append a string-length even if the string argument is missing, e.g. for EOSHIFT. (gfc_conv_intrinsic_function): Call the new method for EOSHIFT, PACK and RESHAPE. 2008-07-29 Daniel Kraft <d@domob.eu> PR fortran/36403 * gfortran.dg/char_eoshift_5.f90: New test. * gfortran.dg/intrinsic_optional_char_arg_1.f90: New test. ........ r138235 | manu | 2008-07-29 03:00:25 -0700 (Tue, 29 Jul 2008) | 11 lines 2008-07-29 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR 34985 * c-decl.c (merge_decls): Merge USED flags. cp/ * decl.c (duplicate_decls): Merge USED flags. testsuite/ * gcc.dg/pr34985.c: New. * g++.dg/warn/pr34985.C: New. ........ r138236 | hubicka | 2008-07-29 03:49:30 -0700 (Tue, 29 Jul 2008) | 11 lines * optimize.c (maybe_clone_body): Remove DECL_INLINE. * decl.c (duplicate_decls): Likewise. (grokfndecl): Likewise. (start_method): Likewise. * method.c (make_thunk, make_alias_for, implicitly_declare_fn): Likewise. * pt.c (register_specialization, regenerate_decl_from_template): Likewise. * decl2.c (grokfield): Likewise. ........ r138237 | hubicka | 2008-07-29 03:52:16 -0700 (Tue, 29 Jul 2008) | 19 lines * predict.c (always_optimize_for_size_p): New function. (optimize_bb_for_size_p, optimize_bb_for_speed_p, optimize_edge_for_size_p, optimize_edge_for_speed_p, optimize_insn_for_size_p, optimize_insn_for_speed_p): New global functions. (rtl_profile_for_bb, rtl_profile_for_edge, rtl_default_profile): New. * function.c (prepare_function_start): Set default profile. * function.h (rtl_data): Add maybe_hot_insn_p. * cfgexpand.c (expand_gimple_basic_block): Set RTL profile. (construct_exit_block): Likewise. (tree_expand_cfg): Likewise. * basic-block.h (optimize_bb_for_size_p, optimize_bb_for_speed_p, optimize_edge_for_size_p, optimize_edge_for_speed_p, optimize_insn_for_size_p, optimize_insn_for_speed_p): Declare. (rtl_profile_for_bb, rtl_profile_for_edge, default_rtl_profile): Declare. ........ r138238 | hubicka | 2008-07-29 04:00:58 -0700 (Tue, 29 Jul 2008) | 22 lines * flags.h (flag_really_no_inline): Remove. * cgraph.c (cgraph_function_possibly_inlined_p): Simplify. * toplev.c (flag_really_no_inline): Remove. * c-cppbuiltin.c (c_cpp_builtins): Use flag_no_inline. * ipa-inline.c (cgraph_decide_inlining): Do not check flag_no_inline. (cgraph_decide_inlining_incrementally): Likewise. (compute_inline_parameters): Likewise. * opts.c (decode_options): Simplify. * c-opts.c (c_common_post_options): Do not set flag_no_inline. * common.opt (finline): Initialize to 1. * tree-inline.c (inlinable_function_p): Check flag_no_inline. * lang.c (java_post_options): Remove handling of flag_no_inline. * misc.c (gnat_post_options): Do not set flag_no_inline. * options.c (gfc_post_options): Do not set flag_no_inline. ........ r138245 | aaronwl | 2008-07-29 07:10:03 -0700 (Tue, 29 Jul 2008) | 5 lines 2008-07-29 Aaron W. LaFramboise <aaronavay62@aaronwl.com> * Makefile.in (EXTRA_GNATRTL_NONTASKING_OBJS): Remove extra s-win32.o. ........ r138246 | charlet | 2008-07-29 08:46:37 -0700 (Tue, 29 Jul 2008) | 7 lines * gcc-interface: New directory. * ada-tree.def, cuintp.c, gigi.h, Makefile.in, targtyps.c, ada.h, utils.c, ada-tree.h, decl.c, lang.opt, Make-lang.in, trans.c, config-lang.in, deftarg.c, lang-specs.h, misc.c, utils2.c: Moved to gcc-interface subdirectory. ........ r138248 | charlet | 2008-07-29 08:50:16 -0700 (Tue, 29 Jul 2008) | 2 lines Resync. ........ r138249 | jakub | 2008-07-29 09:27:50 -0700 (Tue, 29 Jul 2008) | 2 lines * c-format.c (check_format_types): Revert unwanted checkin. ........ r138250 | jakub | 2008-07-29 09:29:33 -0700 (Tue, 29 Jul 2008) | 7 lines PR c++/36852 * tree.c (cplus_array_hash, build_cplus_array_type_1): Hash on TYPE_UID instead of pointers. * g++.dg/pch/array-1.C: New test. * g++.dg/pch/array-1.Hs: New file. ........ r138251 | jakub | 2008-07-29 09:30:32 -0700 (Tue, 29 Jul 2008) | 3 lines * class.c (build_utf8_ref): Pad initializer string to utf8const_type's alignment. ........ r138252 | jakub | 2008-07-29 09:31:18 -0700 (Tue, 29 Jul 2008) | 3 lines * class.c (build_utf8_ref): Set DECL_SIZE and DECL_SIZE_UNIT from ctype's sizes. ........ r138254 | hubicka | 2008-07-29 10:02:45 -0700 (Tue, 29 Jul 2008) | 4 lines * trans.c (process_inlined_subprograms): Remove tree_really_inline check. ........ r138255 | paolo | 2008-07-29 10:06:24 -0700 (Tue, 29 Jul 2008) | 11 lines 2008-07-29 Paolo Carlini <paolo.carlini@oracle.com> * include/std/utility: Include <initializer_list>, per the current WP. * testsuite/lib/libstdc++.exp (check_v3_target_cstdint): Tweak, don't use -std=gnu++0x unnecessarily. * testsuite/18_support/numeric_limits/char16_32_t.cc: Use dg-require-cstdint. * testsuite/18_support/headers/cstdint/types_std_c++0x.cc: Likewise. * testsuite/tr1/8_c_compatibility/cstdint/types_std_tr1.cc: Likewise. ........ r138256 | rguenth | 2008-07-29 10:07:42 -0700 (Tue, 29 Jul 2008) | 5 lines 2008-07-29 Richard Guenther <rguenther@suse.de> * gimplify.c (gimplify_expr): Clear TREE_SIDE_EFFECTS for OBJ_TYPE_REF. ........ r138257 | rguenth | 2008-07-29 10:09:26 -0700 (Tue, 29 Jul 2008) | 18 lines 2008-07-29 Richard Guenther <rguenther@suse.de> PR tree-optimization/36945 * tree-ssa-sccvn.h (copy_reference_ops_from_ref): Declare. * tree-ssa-sccvn.c (copy_reference_ops_from_ref): Export. Record invariant addresses un-decomposed. (copy_reference_ops_from_call): Record reference call arguments properly. Simplify. * tree-ssa-pre.c (create_component_ref_by_pieces_1): New helper split out from ... (create_component_ref_by_pieces): ... here. Simplify. Prepare for recursive invocation for call arguments. (create_expression_by_pieces): Adjust call to create_component_ref_by_pieces. (compute_avail): Process operand 2 of reference ops. * gcc.dg/tree-ssa/ssa-pre-18.c: New testcase. ........ r138258 | hubicka | 2008-07-29 10:10:55 -0700 (Tue, 29 Jul 2008) | 7 lines * c-decl.c (merge_decls): Do not handle DECL_INLINE. (grokdeclarator): Likewise. * langhooks.c (lhd_warn_unused_global_decl): Use DECL_DECLARED_INLINE_P. * print-tree.c (print_node): Remove DECL_INLINE check. ........ r138260 | charlet | 2008-07-29 11:51:30 -0700 (Tue, 29 Jul 2008) | 2 lines Moved to gcc-interface. ........ r138261 | charlet | 2008-07-29 11:52:26 -0700 (Tue, 29 Jul 2008) | 3 lines * trans.c (process_inlined_subprograms): Remove tree_really_inline check. ........ r138263 | paolo | 2008-07-29 12:34:36 -0700 (Tue, 29 Jul 2008) | 17 lines 2008-07-29 Paolo Carlini <paolo.carlini@oracle.com> * include/debug/set.h: Minor formatting fixes. * include/debug/multiset.h: Likewise. * include/debug/safe_association.h: Likewise. * include/debug/vector: Likewise. * include/debug/map.h: Likewise. * include/debug/string: Likewise. * include/debug/multimap.h: Likewise. * include/bits/stl_list.h: Likewise. * include/bits/stl_map.h: Likewise. * include/bits/stl_set.h: Likewise. * include/bits/stl_multimap.h: Likewise. * include/bits/stl_vector.h: Likewise. * include/bits/stl_multiset.h: Likewise. * include/bits/stl_bvector.h: Likewise. ........ r138274 | charlet | 2008-07-29 13:43:33 -0700 (Tue, 29 Jul 2008) | 2 lines Moved to gcc-interface directory. ........ r138275 | pault | 2008-07-29 13:44:09 -0700 (Tue, 29 Jul 2008) | 1420 lines Index: gcc/fortran/trans-expr.c =================================================================== *** gcc/fortran/trans-expr.c (revision 138273) --- gcc/fortran/trans-expr.c (working copy) *************** *** 1,6 **** /* Expression translation ! Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software ! Foundation, Inc. Contributed by Paul Brook <paul@nowt.org> and Steven Bosscher <s.bosscher@student.tudelft.nl> --- 1,6 ---- /* Expression translation ! Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 ! Free Software Foundation, Inc. Contributed by Paul Brook <paul@nowt.org> and Steven Bosscher <s.bosscher@student.tudelft.nl> *************** gfc_conv_component_ref (gfc_se * se, gfc *** 395,400 **** --- 395,434 ---- } + /* This function deals with component references to components of the + parent type for derived type extensons. */ + static void + conv_parent_component_references (gfc_se * se, gfc_ref * ref) + { + gfc_component *c; + gfc_component *cmp; + gfc_symbol *dt; + gfc_ref parent; + + dt = ref->u.c.sym; + c = ref->u.c.component; + + /* Build a gfc_ref to recursively call gfc_conv_component_ref. */ + parent.type = REF_COMPONENT; + parent.next = NULL; + parent.u.c.sym = dt; + parent.u.c.component = dt->components; + + if (dt->attr.extension && dt->components) + { + /* Return if the component is not in the parent type. */ + for (cmp = dt->components->next; cmp; cmp = cmp->next) + if (strcmp (c->name, cmp->name) == 0) + return; + + /* Otherwise build the reference and call self. */ + gfc_conv_component_ref (se, &parent); + parent.u.c.sym = dt->components->ts.derived; + parent.u.c.component = c; + conv_parent_component_references (se, &parent); + } + } + /* Return the contents of a variable. Also handles reference/pointer variables (all Fortran pointer references are implicit). */ *************** gfc_conv_variable (gfc_se * se, gfc_expr *** 561,566 **** --- 595,603 ---- break; case REF_COMPONENT: + if (ref->u.c.sym->attr.extension) + conv_parent_component_references (se, ref); + gfc_conv_component_ref (se, ref); break; Index: gcc/fortran/trans-array.c =================================================================== *** gcc/fortran/trans-array.c (revision 138273) --- gcc/fortran/trans-array.c (working copy) *************** gfc_conv_resolve_dependencies (gfc_loopi *** 3257,3270 **** if (ss->type != GFC_SS_SECTION) continue; ! if (gfc_could_be_alias (dest, ss) ! || gfc_are_equivalenced_arrays (dest->expr, ss->expr)) { ! nDepend = 1; ! break; } ! ! if (dest->expr->symtree->n.sym == ss->expr->symtree->n.sym) { lref = dest->expr->ref; rref = ss->expr->ref; --- 3257,3272 ---- if (ss->type != GFC_SS_SECTION) continue; ! if (dest->expr->symtree->n.sym != ss->expr->symtree->n.sym) { ! if (gfc_could_be_alias (dest, ss) ! || gfc_are_equivalenced_arrays (dest->expr, ss->expr)) ! { ! nDepend = 1; ! break; ! } } ! else { lref = dest->expr->ref; rref = ss->expr->ref; Index: gcc/fortran/symbol.c =================================================================== *** gcc/fortran/symbol.c (revision 138273) --- gcc/fortran/symbol.c (working copy) *************** gfc_add_component (gfc_symbol *sym, cons *** 1701,1706 **** --- 1701,1714 ---- tail = p; } + if (sym->attr.extension + && gfc_find_component (sym->components->ts.derived, name)) + { + gfc_error ("Component '%s' at %C already in the parent type " + "at %L", name, &sym->components->ts.derived->declared_at); + return FAILURE; + } + /* Allocate a new component. */ p = gfc_get_component (); *************** gfc_find_component (gfc_symbol *sym, con *** 1830,1846 **** if (strcmp (p->name, name) == 0) break; if (p == NULL) gfc_error ("'%s' at %C is not a member of the '%s' structure", name, sym->name); ! else { ! if (sym->attr.use_assoc && (sym->component_access == ACCESS_PRIVATE ! || p->access == ACCESS_PRIVATE)) { gfc_error ("Component '%s' at %C is a PRIVATE component of '%s'", name, sym->name); ! p = NULL; } } --- 1838,1873 ---- if (strcmp (p->name, name) == 0) break; + if (p == NULL + && sym->attr.extension + && sym->components->ts.type == BT_DERIVED) + { + p = gfc_find_component (sym->components->ts.derived, name); + /* Do not overwrite the error. */ + if (p == NULL) + return p; + } + if (p == NULL) gfc_error ("'%s' at %C is not a member of the '%s' structure", name, sym->name); ! ! else if (sym->attr.use_assoc) { ! if (p->access == ACCESS_PRIVATE) { gfc_error ("Component '%s' at %C is a PRIVATE component of '%s'", name, sym->name); ! return NULL; ! } ! ! /* If there were components given and all components are private, error ! out at this place. */ ! if (p->access != ACCESS_PUBLIC && sym->component_access == ACCESS_PRIVATE) ! { ! gfc_error ("All components of '%s' are PRIVATE in structure" ! " constructor at %C", sym->name); ! return NULL; } } Index: gcc/fortran/decl.c =================================================================== *** gcc/fortran/decl.c (revision 138273) --- gcc/fortran/decl.c (working copy) *************** match_data_constant (gfc_expr **result) *** 367,373 **** return MATCH_ERROR; } else if (sym->attr.flavor == FL_DERIVED) ! return gfc_match_structure_constructor (sym, result); /* Check to see if the value is an initialization array expression. */ if (sym->value->expr_type == EXPR_ARRAY) --- 367,373 ---- return MATCH_ERROR; } else if (sym->attr.flavor == FL_DERIVED) ! return gfc_match_structure_constructor (sym, result, false); /* Check to see if the value is an initialization array expression. */ if (sym->value->expr_type == EXPR_ARRAY) *************** syntax: *** 6250,6255 **** --- 6250,6298 ---- } + /* Check a derived type that is being extended. */ + static gfc_symbol* + check_extended_derived_type (char *name) + { + gfc_symbol *extended; + + if (gfc_find_symbol (name, gfc_current_ns, 1, &extended)) + { + gfc_error ("Ambiguous symbol in TYPE definition at %C"); + return NULL; + } + + if (!extended) + { + gfc_error ("No such symbol in TYPE definition at %C"); + return NULL; + } + + if (extended->attr.flavor != FL_DERIVED) + { + gfc_error ("'%s' in EXTENDS expression at %C is not a " + "derived type", name); + return NULL; + } + + if (extended->attr.is_bind_c) + { + gfc_error ("'%s' cannot be extended at %C because it " + "is BIND(C)", extended->name); + return NULL; + } + + if (extended->attr.sequence) + { + gfc_error ("'%s' cannot be extended at %C because it " + "is a SEQUENCE type", extended->name); + return NULL; + } + + return extended; + } + + /* Match the optional attribute specifiers for a type declaration. Return MATCH_ERROR if an error is encountered in one of the handled attributes (public, private, bind(c)), MATCH_NO if what's found is *************** syntax: *** 6257,6263 **** checking on attribute conflicts needs to be done. */ match ! gfc_get_type_attr_spec (symbol_attribute *attr) { /* See if the derived type is marked as private. */ if (gfc_match (" , private") == MATCH_YES) --- 6300,6306 ---- checking on attribute conflicts needs to be done. */ match ! gfc_get_type_attr_spec (symbol_attribute *attr, char *name) { /* See if the derived type is marked as private. */ if (gfc_match (" , private") == MATCH_YES) *************** gfc_get_type_attr_spec (symbol_attribute *** 6295,6300 **** --- 6338,6349 ---- /* TODO: attr conflicts need to be checked, probably in symbol.c. */ } + else if (name && gfc_match(" , extends ( %n )", name) == MATCH_YES) + { + if (gfc_notify_std (GFC_STD_F2003, "Fortran 2003: derived type " + "extended at %C") == FAILURE) + return MATCH_ERROR; + } else return MATCH_NO; *************** match *** 6311,6318 **** --- 6360,6369 ---- gfc_match_derived_decl (void) { char name[GFC_MAX_SYMBOL_LEN + 1]; + char parent[GFC_MAX_SYMBOL_LEN + 1]; symbol_attribute attr; gfc_symbol *sym; + gfc_symbol *extended; match m; match is_type_attr_spec = MATCH_NO; bool seen_attr = false; *************** gfc_match_derived_decl (void) *** 6320,6336 **** if (gfc_current_state () == COMP_DERIVED) return MATCH_NO; gfc_clear_attr (&attr); do { ! is_type_attr_spec = gfc_get_type_attr_spec (&attr); if (is_type_attr_spec == MATCH_ERROR) return MATCH_ERROR; if (is_type_attr_spec == MATCH_YES) seen_attr = true; } while (is_type_attr_spec == MATCH_YES); if (gfc_match (" ::") != MATCH_YES && seen_attr) { gfc_error ("Expected :: in TYPE definition at %C"); --- 6371,6397 ---- if (gfc_current_state () == COMP_DERIVED) return MATCH_NO; + name[0] = '\0'; + parent[0] = '\0'; gfc_clear_attr (&attr); + extended = NULL; do { ! is_type_attr_spec = gfc_get_type_attr_spec (&attr, parent); if (is_type_attr_spec == MATCH_ERROR) return MATCH_ERROR; if (is_type_attr_spec == MATCH_YES) seen_attr = true; } while (is_type_attr_spec == MATCH_YES); + /* Deal with derived type extensions. */ + if (parent[0]) + extended = check_extended_derived_type (parent); + + if (parent[0] && !extended) + return MATCH_ERROR; + if (gfc_match (" ::") != MATCH_YES && seen_attr) { gfc_error ("Expected :: in TYPE definition at %C"); *************** gfc_match_derived_decl (void) *** 6383,6392 **** --- 6444,6477 ---- if (attr.is_bind_c != 0) sym->attr.is_bind_c = attr.is_bind_c; + /* Construct the f2k_derived namespace if it is not yet there. */ if (!sym->f2k_derived) sym->f2k_derived = gfc_get_namespace (NULL, 0); + + if (extended && !sym->components) + { + gfc_component *p; + gfc_symtree *st; + + /* Add the extended derived type as the first component. */ + gfc_add_component (sym, parent, &p); + sym->attr.extension = 1; + extended->refs++; + gfc_set_sym_referenced (extended); + + p->ts.type = BT_DERIVED; + p->ts.derived = extended; + p->initializer = gfc_default_initializer (&p->ts); + + /* Provide the links between the extended type and its extension. */ + if (!extended->f2k_derived) + extended->f2k_derived = gfc_get_namespace (NULL, 0); + st = gfc_new_symtree (&extended->f2k_derived->sym_root, sym->name); + st->n.sym = sym; + } + gfc_new_block = sym; return MATCH_YES; Index: gcc/fortran/gfortran.h =================================================================== *** gcc/fortran/gfortran.h (revision 138273) --- gcc/fortran/gfortran.h (working copy) *************** typedef struct *** 638,643 **** --- 638,644 ---- unsigned untyped:1; /* No implicit type could be found. */ unsigned is_bind_c:1; /* say if is bound to C */ + unsigned extension:1; /* extends a derived type */ /* These flags are both in the typespec and attribute. The attribute list is what gets read from/written to a module file. The typespec *************** typedef struct gfc_symbol *** 1016,1024 **** gfc_formal_arglist *formal; struct gfc_namespace *formal_ns; - - /* The namespace containing type-associated procedure symbols. */ - /* TODO: Make this union with formal? */ struct gfc_namespace *f2k_derived; struct gfc_expr *value; /* Parameter/Initializer value */ --- 1017,1022 ---- Index: gcc/fortran/ChangeLog =================================================================== *** gcc/fortran/ChangeLog (revision 138273) --- gcc/fortran/ChangeLog (working copy) *************** *** 1,3 **** --- 1,42 ---- + 2008-07-29 Paul Thomas <pault@gcc.gnu.org> + + * trans-expr.c (conv_parent_component_references): New function + to build missing parent references. + (gfc_conv_variable): Call it + * symbol.c (gfc_add_component): Check that component name in a + derived type extension does not appear in parent. + (gfc_find_component): For a derived type extension, check if + the component appears in the parent derived type by calling + self. Separate errors for private components and private types. + * decl.c (match_data_constant): Add extra arg to call to + gfc_match_structure_constructor. + (check_extended_derived_type): New function to check that a + parent derived type exists and that it is OK for exension. + (gfc_get_type_attr_spec): Add extra argument 'name' and return + it if extends is specified. + (gfc_match_derived_decl): Match derived type extension and + build a first component of the parent derived type if OK. Add + the f2k namespace if not present. + * gfortran.h : Add the extension attribute. + * module.c : Handle attribute 'extension'. + * match.h : Modify prototypes for gfc_get_type_attr_spec and + gfc_match_structure_constructor. + * primary.c (build_actual_constructor): New function extracted + from gfc_match_structure_constructor and modified to call self + iteratively to build derived type extensions, when f2k named + components are used. + (gfc_match_structure_constructor): Do not throw error for too + many components if a parent type is being handled. Use + gfc_find_component to generate errors for non-existent or + private components. Iteratively call self for derived type + extensions so that parent constructor is built. If extension + and components left over, throw error. + (gfc_match_rvalue): Add extra arg to call to + gfc_match_structure_constructor. + + * trans-array.c (gfc_conv_resolve_dependencies): If lhs and rhs + are the same symbol, aliassing does not matter. + 2008-07-29 Jan Hubicka <jh@suse.cz> * options.c (gfc_post_options): Do not set flag_no_inline. Index: gcc/fortran/module.c =================================================================== *** gcc/fortran/module.c (revision 138273) --- gcc/fortran/module.c (working copy) *************** typedef enum *** 1648,1654 **** AB_ELEMENTAL, AB_PURE, AB_RECURSIVE, AB_GENERIC, AB_ALWAYS_EXPLICIT, AB_CRAY_POINTER, AB_CRAY_POINTEE, AB_THREADPRIVATE, AB_ALLOC_COMP, AB_POINTER_COMP, AB_PRIVATE_COMP, AB_VALUE, AB_VOLATILE, AB_PROTECTED, ! AB_IS_BIND_C, AB_IS_C_INTEROP, AB_IS_ISO_C, AB_ABSTRACT, AB_ZERO_COMP } ab_attribute; --- 1648,1655 ---- AB_ELEMENTAL, AB_PURE, AB_RECURSIVE, AB_GENERIC, AB_ALWAYS_EXPLICIT, AB_CRAY_POINTER, AB_CRAY_POINTEE, AB_THREADPRIVATE, AB_ALLOC_COMP, AB_POINTER_COMP, AB_PRIVATE_COMP, AB_VALUE, AB_VOLATILE, AB_PROTECTED, ! AB_IS_BIND_C, AB_IS_C_INTEROP, AB_IS_ISO_C, AB_ABSTRACT, AB_ZERO_COMP, ! AB_EXTENSION } ab_attribute; *************** static const mstring attr_bits[] = *** 1688,1693 **** --- 1689,1695 ---- minit ("ZERO_COMP", AB_ZERO_COMP), minit ("PROTECTED", AB_PROTECTED), minit ("ABSTRACT", AB_ABSTRACT), + minit ("EXTENSION", AB_EXTENSION), minit (NULL, -1) }; *************** mio_symbol_attribute (symbol_attribute * *** 1801,1806 **** --- 1803,1810 ---- MIO_NAME (ab_attribute) (AB_PRIVATE_COMP, attr_bits); if (attr->zero_comp) MIO_NAME (ab_attribute) (AB_ZERO_COMP, attr_bits); + if (attr->extension) + MIO_NAME (ab_attribute) (AB_EXTENSION, attr_bits); mio_rparen (); *************** mio_symbol_attribute (symbol_attribute * *** 1919,1924 **** --- 1923,1931 ---- case AB_ZERO_COMP: attr->zero_comp = 1; break; + case AB_EXTENSION: + attr->extension = 1; + break; } } } Index: gcc/fortran/trans-io.c =================================================================== *** gcc/fortran/trans-io.c (revision 138273) --- gcc/fortran/trans-io.c (working copy) *************** *** 1,6 **** /* IO Code translation/library interface ! Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software ! Foundation, Inc. Contributed by Paul Brook This file is part of GCC. --- 1,6 ---- /* IO Code translation/library interface ! Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 ! Free Software Foundation, Inc. Contributed by Paul Brook This file is part of GCC. Index: gcc/fortran/match.h =================================================================== *** gcc/fortran/match.h (revision 138273) --- gcc/fortran/match.h (working copy) *************** gfc_try get_bind_c_idents (void); *** 182,191 **** match gfc_match_bind_c_stmt (void); match gfc_match_suffix (gfc_symbol *, gfc_symbol **); match gfc_match_bind_c (gfc_symbol *, bool); ! match gfc_get_type_attr_spec (symbol_attribute *); /* primary.c. */ ! match gfc_match_structure_constructor (gfc_symbol *, gfc_expr **); match gfc_match_variable (gfc_expr **, int); match gfc_match_equiv_variable (gfc_expr **); match gfc_match_actual_arglist (int, gfc_actual_arglist **); --- 182,191 ---- match gfc_match_bind_c_stmt (void); match gfc_match_suffix (gfc_symbol *, gfc_symbol **); match gfc_match_bind_c (gfc_symbol *, bool); ! match gfc_get_type_attr_spec (symbol_attribute *, char*); /* primary.c. */ ! match gfc_match_structure_constructor (gfc_symbol *, gfc_expr **, bool); match gfc_match_variable (gfc_expr **, int); match gfc_match_equiv_variable (gfc_expr **); match gfc_match_actual_arglist (int, gfc_actual_arglist **); Index: gcc/fortran/primary.c =================================================================== *** gcc/fortran/primary.c (revision 138273) --- gcc/fortran/primary.c (working copy) *************** gfc_free_structure_ctor_component (gfc_s *** 1984,1994 **** gfc_free_expr (comp->val); } ! match ! gfc_match_structure_constructor (gfc_symbol *sym, gfc_expr **result) { - gfc_structure_ctor_component *comp_head, *comp_tail; gfc_structure_ctor_component *comp_iter; gfc_constructor *ctor_head, *ctor_tail; gfc_component *comp; /* Is set NULL when named component is first seen */ gfc_expr *e; --- 1984,2086 ---- gfc_free_expr (comp->val); } ! ! /* Translate the component list into the actual constructor by sorting it in ! the order required; this also checks along the way that each and every ! component actually has an initializer and handles default initializers ! for components without explicit value given. */ ! static gfc_try ! build_actual_constructor (gfc_structure_ctor_component **comp_head, ! gfc_constructor **ctor_head, gfc_symbol *sym) { gfc_structure_ctor_component *comp_iter; + gfc_constructor *ctor_tail = NULL; + gfc_component *comp; + + for (comp = sym->components; comp; comp = comp->next) + { + gfc_structure_ctor_component **next_ptr; + gfc_expr *value = NULL; + + /* Try to find the initializer for the current component by name. */ + next_ptr = comp_head; + for (comp_iter = *comp_head; comp_iter; comp_iter = comp_iter->next) + { + if (!strcmp (comp_iter->name, comp->name)) + break; + next_ptr = &comp_iter->next; + } + + /* If an extension, try building the parent derived type by building + a value expression for the parent derived type and calling self. */ + if (!comp_iter && comp == sym->components && sym->attr.extension) + { + value = gfc_get_expr (); + value->expr_type = EXPR_STRUCTURE; + value->value.constructor = NULL; + value->ts = comp->ts; + value->where = gfc_current_locus; + + if (build_actual_constructor (comp_head, &value->value.constructor, + comp->ts.derived) == FAILURE) + { + gfc_free_expr (value); + return FAILURE; + } + *ctor_head = ctor_tail = gfc_get_constructor (); + ctor_tail->expr = value; + continue; + } + + /* If it was not found, try the default initializer if there's any; + otherwise, it's an error. */ + if (!comp_iter) + { + if (comp->initializer) + { + if (gfc_notify_std (GFC_STD_F2003, "Fortran 2003: Structure" + " constructor with missing optional arguments" + " at %C") == FAILURE) + return FAILURE; + value = gfc_copy_expr (comp->initializer); + } + else + { + gfc_error ("No initializer for component '%s' given in the" + " structure constructor at %C!", comp->name); + return FAILURE; + } + } + else + value = comp_iter->val; + + /* Add the value to the constructor chain built. */ + if (ctor_tail) + { + ctor_tail->next = gfc_get_constructor (); + ctor_tail = ctor_tail->next; + } + else + *ctor_head = ctor_tail = gfc_get_constructor (); + gcc_assert (value); + ctor_tail->expr = value; + + /* Remove the entry from the component list. We don't want the expression + value to be free'd, so set it to NULL. */ + if (comp_iter) + { + *next_ptr = comp_iter->next; + comp_iter->val = NULL; + gfc_free_structure_ctor_component (comp_iter); + } + } + return SUCCESS; + } + + match + gfc_match_structure_constructor (gfc_symbol *sym, gfc_expr **result, bool parent) + { + gfc_structure_ctor_component *comp_tail, *comp_head, *comp_iter; gfc_constructor *ctor_head, *ctor_tail; gfc_component *comp; /* Is set NULL when named component is first seen */ gfc_expr *e; *************** gfc_match_structure_constructor (gfc_sym *** 1996,2005 **** match m; const char* last_name = NULL; ! comp_head = comp_tail = NULL; ctor_head = ctor_tail = NULL; ! if (gfc_match_char ('(') != MATCH_YES) goto syntax; where = gfc_current_locus; --- 2088,2097 ---- match m; const char* last_name = NULL; ! comp_tail = comp_head = NULL; ctor_head = ctor_tail = NULL; ! if (!parent && gfc_match_char ('(') != MATCH_YES) goto syntax; where = gfc_current_locus; *************** gfc_match_structure_constructor (gfc_sym *** 2047,2053 **** if (last_name) gfc_error ("Component initializer without name after" " component named %s at %C!", last_name); ! else gfc_error ("Too many components in structure constructor at" " %C!"); goto cleanup; --- 2139,2145 ---- if (last_name) gfc_error ("Component initializer without name after" " component named %s at %C!", last_name); ! else if (!parent) gfc_error ("Too many components in structure constructor at" " %C!"); goto cleanup; *************** gfc_match_structure_constructor (gfc_sym *** 2057,2095 **** strncpy (comp_tail->name, comp->name, GFC_MAX_SYMBOL_LEN + 1); } ! /* Find the current component in the structure definition; this is ! needed to get its access attribute in the private check below. */ if (comp) ! this_comp = comp; else { ! for (comp = sym->components; comp; comp = comp->next) ! if (!strcmp (comp->name, comp_tail->name)) ! { ! this_comp = comp; ! break; ! } comp = NULL; /* Reset needed! */ - - /* Here we can check if a component name is given which does not - correspond to any component of the defined structure. */ - if (!this_comp) - { - gfc_error ("Component '%s' in structure constructor at %C" - " does not correspond to any component in the" - " constructed structure!", comp_tail->name); - goto cleanup; - } } - gcc_assert (this_comp); ! /* Check the current component's access status. */ ! if (sym->attr.use_assoc && this_comp->access == ACCESS_PRIVATE) ! { ! gfc_error ("Component '%s' is PRIVATE in structure constructor" ! " at %C!", comp_tail->name); ! goto cleanup; ! } /* Check if this component is already given a value. */ for (comp_iter = comp_head; comp_iter != comp_tail; --- 2149,2168 ---- strncpy (comp_tail->name, comp->name, GFC_MAX_SYMBOL_LEN + 1); } ! /* Find the current component in the structure definition and check its ! access is not private. */ if (comp) ! this_comp = gfc_find_component (sym, comp->name); else { ! this_comp = gfc_find_component (sym, (const char *)comp_tail->name); comp = NULL; /* Reset needed! */ } ! /* Here we can check if a component name is given which does not ! correspond to any component of the defined structure. */ ! if (!this_comp) ! goto cleanup; /* Check if this component is already given a value. */ for (comp_iter = comp_head; comp_iter != comp_tail; *************** gfc_match_structure_constructor (gfc_sym *** 2111,2199 **** if (m == MATCH_ERROR) goto cleanup; ! if (comp) comp = comp->next; } while (gfc_match_char (',') == MATCH_YES); ! if (gfc_match_char (')') != MATCH_YES) goto syntax; - - /* If there were components given and all components are private, error - out at this place. */ - if (sym->attr.use_assoc && sym->component_access == ACCESS_PRIVATE) - { - gfc_error ("All components of '%s' are PRIVATE in structure" - " constructor at %C", sym->name); - goto cleanup; - } } ! /* Translate the component list into the actual constructor by sorting it in ! the order required; this also checks along the way that each and every ! component actually has an initializer and handles default initializers ! for components without explicit value given. */ ! for (comp = sym->components; comp; comp = comp->next) ! { ! gfc_structure_ctor_component **next_ptr; ! gfc_expr *value = NULL; ! /* Try to find the initializer for the current component by name. */ ! next_ptr = &comp_head; for (comp_iter = comp_head; comp_iter; comp_iter = comp_iter->next) { ! if (!strcmp (comp_iter->name, comp->name)) ! break; ! next_ptr = &comp_iter->next; ! } ! ! /* If it was not found, try the default initializer if there's any; ! otherwise, it's an error. */ ! if (!comp_iter) ! { ! if (comp->initializer) ! { ! if (gfc_notify_std (GFC_STD_F2003, "Fortran 2003: Structure" ! " constructor with missing optional arguments" ! " at %C") == FAILURE) ! goto cleanup; ! value = gfc_copy_expr (comp->initializer); ! } ! else ! { ! gfc_error ("No initializer for component '%s' given in the" ! " structure constructor at %C!", comp->name); ! goto cleanup; ! } ! } ! else ! value = comp_iter->val; ! ! /* Add the value to the constructor chain built. */ ! if (ctor_tail) ! { ! ctor_tail->next = gfc_get_constructor (); ! ctor_tail = ctor_tail->next; ! } ! else ! ctor_head = ctor_tail = gfc_get_constructor (); ! gcc_assert (value); ! ctor_tail->expr = value; ! ! /* Remove the entry from the component list. We don't want the expression ! value to be free'd, so set it to NULL. */ ! if (comp_iter) ! { ! *next_ptr = comp_iter->next; ! comp_iter->val = NULL; ! gfc_free_structure_ctor_component (comp_iter); } } ! ! /* No component should be left, as this should have caused an error in the ! loop constructing the component-list (name that does not correspond to any ! component in the structure definition). */ ! gcc_assert (!comp_head); e = gfc_get_expr (); --- 2184,2239 ---- if (m == MATCH_ERROR) goto cleanup; ! /* If not explicitly a parent constructor, gather up the components ! and build one. */ ! if (comp && comp == sym->components ! && sym->attr.extension ! && (comp_tail->val->ts.type != BT_DERIVED ! || ! comp_tail->val->ts.derived != this_comp->ts.derived)) ! { ! gfc_current_locus = where; ! gfc_free_expr (comp_tail->val); ! ! m = gfc_match_structure_constructor (comp->ts.derived, ! &comp_tail->val, true); ! if (m == MATCH_NO) ! goto syntax; ! if (m == MATCH_ERROR) ! goto cleanup; ! } ! ! if (comp) comp = comp->next; + + if (parent && !comp) + break; } + while (gfc_match_char (',') == MATCH_YES); ! if (!parent && gfc_match_char (')') != MATCH_YES) goto syntax; } ! if (build_actual_constructor (&comp_head, &ctor_head, sym) == FAILURE) ! goto cleanup; ! /* No component should be left, as this should have caused an error in the ! loop constructing the component-list (name that does not correspond to any ! component in the structure definition). */ ! if (comp_head && sym->attr.extension) ! { for (comp_iter = comp_head; comp_iter; comp_iter = comp_iter->next) { ! gfc_error ("component '%s' at %L has already been set by a " ! "parent derived type constructor", comp_iter->name, ! &comp_iter->where); } + goto cleanup; } ! else ! gcc_assert (!comp_head); e = gfc_get_expr (); *************** gfc_match_rvalue (gfc_expr **result) *** 2396,2402 **** if (sym == NULL) m = MATCH_ERROR; else ! m = gfc_match_structure_constructor (sym, &e); break; /* If we're here, then the name is known to be the name of a --- 2436,2442 ---- if (sym == NULL) m = MATCH_ERROR; else ! m = gfc_match_structure_constructor (sym, &e, false); break; /* If we're here, then the name is known to be the name of a Index: gcc/testsuite/ChangeLog =================================================================== *** gcc/testsuite/ChangeLog (revision 138273) --- gcc/testsuite/ChangeLog (working copy) *************** *** 1,3 **** --- 1,15 ---- + 2008-07-29 Paul Thomas <pault@gcc.gnu.org> + + * gfortran.dg/extends_1.f03: New test. + * gfortran.dg/extends_2.f03: New test. + * gfortran.dg/extends_3.f03: New test. + * gfortran.dg/extends_4.f03: New test. + * gfortran.dg/extends_5.f03: New test. + * gfortran.dg/extends_6.f03: New test. + * gfortran.dg/private_type_6.f90: Modify error message. + * gfortran.dg/structure_constructor_7.f03: Modify error message. + * gfortran.dg/structure_constructor_8.f03: Modify error message. + 2008-07-29 Richard Guenther <rguenther@suse.de> PR tree-optimization/36945 Index: gcc/testsuite/gfortran.dg/extends_1.f03 =================================================================== *** gcc/testsuite/gfortran.dg/extends_1.f03 (revision 0) --- gcc/testsuite/gfortran.dg/extends_1.f03 (revision 0) *************** *** 0 **** --- 1,73 ---- + ! { dg-do run } + ! A basic functional test of derived type extension. + ! + ! Contributed by Paul Thomas <pault@gcc.gnu.org> + ! + module persons + type :: person + character(24) :: name = "" + integer :: ss = 1 + end type person + end module persons + + module person_education + use persons + type, extends(person) :: education + integer :: attainment = 0 + character(24) :: institution = "" + end type education + end module person_education + + use person_education + type, extends(education) :: service + integer :: personnel_number = 0 + character(24) :: department = "" + end type service + + type, extends(service) :: person_record + type (person_record), pointer :: supervisor => NULL () + end type person_record + + type(person_record), pointer :: recruit, supervisor + + ! Check that references by ultimate component work + + allocate (supervisor) + supervisor%name = "Joe Honcho" + supervisor%ss = 123455 + supervisor%attainment = 100 + supervisor%institution = "Celestial University" + supervisor%personnel_number = 1 + supervisor%department = "Directorate" + + recruit => entry ("John Smith", 123456, 1, "Bog Hill High School", & + 99, "Records", supervisor) + + if (trim (recruit%name) /= "John Smith") call abort + if (recruit%name /= recruit%service%name) call abort + if (recruit%supervisor%ss /= 123455) call abort + if (recruit%supervisor%ss /= supervisor%person%ss) call abort + + deallocate (supervisor) + deallocate (recruit) + contains + function entry (name, ss, attainment, institution, & + personnel_number, department, supervisor) result (new_person) + integer :: ss, attainment, personnel_number + character (*) :: name, institution, department + type (person_record), pointer :: supervisor, new_person + + allocate (new_person) + + ! Check mixtures of references + new_person%person%name = name + new_person%service%education%person%ss = ss + new_person%service%attainment = attainment + new_person%education%institution = institution + new_person%personnel_number = personnel_number + new_person%service%department = department + new_person%supervisor => supervisor + end function + end + + ! { dg-final { cleanup-modules "persons person_education" } } Index: gcc/testsuite/gfortran.dg/extends_2.f03 =================================================================== *** gcc/testsuite/gfortran.dg/extends_2.f03 (revision 0) --- gcc/testsuite/gfortran.dg/extends_2.f03 (revision 0) *************** *** 0 **** --- 1,66 ---- + ! { dg-do run } + ! A test of f95 style constructors with derived type extension. + ! + ! Contributed by Paul Thomas <pault@gcc.gnu.org> + ! + module persons + type :: person + character(24) :: name = "" + integer :: ss = 1 + end type person + end module persons + + module person_education + use persons + type, extends(person) :: education + integer :: attainment = 0 + character(24) :: institution = "" + end type education + end module person_education + + use person_education + type, extends(education) :: service + integer :: personnel_number = 0 + character(24) :: department = "" + end type service + + type, extends(service) :: person_record + type (person_record), pointer :: supervisor => NULL () + end type person_record + + type(person_record), pointer :: recruit, supervisor + + ! Check that simple constructor works + allocate (supervisor) + supervisor%service = service ("Joe Honcho", 123455, 100, & + "Celestial University", 1, & + "Directorate") + + recruit => entry ("John Smith", 123456, 1, "Bog Hill High School", & + 99, "Records", supervisor) + + if (trim (recruit%name) /= "John Smith") call abort + if (recruit%name /= recruit%service%name) call abort + if (recruit%supervisor%ss /= 123455) call abort + if (recruit%supervisor%ss /= supervisor%person%ss) call abort + + deallocate (supervisor) + deallocate (recruit) + contains + function entry (name, ss, attainment, institution, & + personnel_number, department, supervisor) result (new_person) + integer :: ss, attainment, personnel_number + character (*) :: name, institution, department + type (person_record), pointer :: supervisor, new_person + + allocate (new_person) + + ! Check nested constructors + new_person = person_record (education (person (name, ss), & + attainment, institution), & + personnel_number, department, & + supervisor) + end function + end + + ! { dg-final { cleanup-modules "persons person_education" } } Index: gcc/testsuite/gfortran.dg/extends_3.f03 =================================================================== *** gcc/testsuite/gfortran.dg/extends_3.f03 (revision 0) --- gcc/testsuite/gfortran.dg/extends_3.f03 (revision 0) *************** *** 0 **** --- 1,71 ---- + ! { dg-do run } + ! A test of f2k style constructors with derived type extension. + ! + ! Contributed by Paul Thomas <pault@gcc.gnu.org> + ! + module persons + type :: person + character(24) :: name = "" + integer :: ss = 1 + end type person + end module persons + + module person_education + use persons + type, extends(person) :: education + integer :: attainment = 0 + character(24) :: institution = "" + end type education + end module person_education + + use person_education + type, extends(education) :: service + integer :: personnel_number = 0 + character(24) :: department = "" + end type service + + type, extends(service) :: person_record + type (person_record), pointer :: supervisor => NULL () + end type person_record + + type(person_record), pointer :: recruit, supervisor + + ! Check that F2K constructor with missing entries works + allocate (supervisor) + supervisor%service = service (NAME = "Joe Honcho", SS= 123455) + + recruit => entry ("John Smith", 123456, 1, "Bog Hill High School", & + 99, "Records", supervisor) + + if (supervisor%ss /= 123455) call abort + if (trim (supervisor%name) /= "Joe Honcho") call abort + if (trim (supervisor%institution) /= "") call abort + if (supervisor%attainment /= 0) call abort + + if (trim (recruit%name) /= "John Smith") call abort + if (recruit%name /= recruit%service%name) call abort + if (recruit%supervisor%ss /= 123455) call abort + if (recruit%supervisor%ss /= supervisor%person%ss) call abort + + deallocate (supervisor) + deallocate (recruit) + contains + function entry (name, ss, attainment, institution, & + personnel_number, department, supervisor) result (new_person) + integer :: ss, attainment, personnel_number + character (*) :: name, institution, department + type (person_record), pointer :: supervisor, new_person + + allocate (new_person) + + ! Check F2K constructor with order shuffled a bit + new_person = person_record (NAME = name, SS =ss, & + DEPARTMENT = department, & + INSTITUTION = institution, & + PERSONNEL_NUMBER = personnel_number, & + ATTAINMENT = attainment, & + SUPERVISOR = supervisor) + end function + end + + ! { dg-final { cleanup-modules "persons person_education" } } Index: gcc/testsuite/gfortran.dg/extends_4.f03 =================================================================== *** gcc/testsuite/gfortran.dg/extends_4.f03 (revision 0) --- gcc/testsuite/gfortran.dg/extends_4.f03 (revision 0) *************** *** 0 **** --- 1,52 ---- + ! { dg-do run } + ! Check that derived type extension is compatible with renaming + ! the parent type and that allocatable components are OK. At + ! the same time, private type and components are checked. + ! + ! Contributed by Paul Thomas <pault@gcc.gnu.org> + ! + module mymod + type :: a + real, allocatable :: x(:) + integer, private :: ia = 0 + end type a + type :: b + private + real, allocatable :: x(:) + integer :: i + end type b + contains + function set_b () result (res) + type(b) :: res + allocate (res%x(2)) + res%x = [10.0, 20.0] + res%i = 1 + end function + subroutine check_b (arg) + type(b) :: arg + if (any (arg%x /= [10.0, 20.0])) call abort + if (arg%i /= 1) call abort + end subroutine + end module mymod + + use mymod, e => a + type, extends(e) :: f + integer :: if + end type f + type, extends(b) :: d + integer :: id + end type d + + type(f) :: p + type(d) :: q + + p = f (x = [1.0, 2.0], if = 3) + if (any (p%e%x /= [1.0, 2.0])) call abort + + q%b = set_b () + call check_b (q%b) + q = d (b = set_b (), id = 99) + call check_b (q%b) + end + + ! { dg-final { cleanup-modules "persons person_education" } } Index: gcc/testsuite/gfortran.dg/extends_5.f03 =================================================================== *** gcc/testsuite/gfortran.dg/extends_5.f03 (revision 0) --- gcc/testsuite/gfortran.dg/extends_5.f03 (revision 0) *************** *** 0 **** --- 1,27 ---- + ! { dg-do compile } + ! Some errors for derived type extension. + ! + ! Contributed by Paul Thomas <pault@gcc.gnu.org> + ! + module m + use iso_c_binding + type :: date + sequence + integer :: yr, mon + integer,public :: day + end type + type, bind(c) :: dt + integer(c_int) :: yr, mon + integer(c_int) :: day + end type + end module m + + use m + type, extends(date) :: datetime ! { dg-error "because it is a SEQUENCE type" } + end type ! { dg-error "Expecting END PROGRAM" } + + type, extends(dt) :: dt_type ! { dg-error "because it is BIND" } + end type ! { dg-error "Expecting END PROGRAM" } + end + + ! { dg-final { cleanup-modules "m" } } Index: gcc/testsuite/gfortran.dg/extends_6.f03 =================================================================== *** gcc/testsuite/gfortran.dg/extends_6.f03 (revision 0) --- gcc/testsuite/gfortran.dg/extends_6.f03 (revision 0) *************** *** 0 **** --- 1,49 ---- + ! { dg-do compile } + ! Some errors pointed out in the development of the patch. + ! + ! Contributed by Tobias Burnus <burnus@net-b.de> + ! + module m + type :: date + private + integer :: yr, mon + integer,public :: day + end type + type :: dt + integer :: yr, mon + integer :: day + end type + end module m + + use m + type, extends(date) :: datetime + integer :: hr, min, sec + end type + type(datetime) :: o_dt + + type :: one + integer :: i + end type one + + type, extends(one) :: two + real :: r + end type two + + o_dt%day = 5 ! VALID but failed in first version of EXTENDS patch + o_dt%yr = 5 ! { dg-error "All components of 'date' are PRIVATE" } + + t = two(one = one(4), i = 5, r=4.4) ! { dg-error "has already been set" } + + call foo + contains + subroutine foo + use m, date_type => dt + type, extends(date_type) :: dt_type + end type + type (dt_type) :: foo_dt + foo_dt%date_type%day = 1 + foo_dt%dt%day = 1 ! { dg-error "not a member" } + end subroutine + end + + ! { dg-final { cleanup-modules "m" } } Index: gcc/testsuite/gfortran.dg/private_type_6.f90 =================================================================== *** gcc/testsuite/gfortran.dg/private_type_6.f90 (revision 138273) --- gcc/testsuite/gfortran.dg/private_type_6.f90 (working copy) *************** program foo_test *** 19,25 **** TYPE(footype) :: foo TYPE(bartype) :: foo2 foo = footype(1) ! { dg-error "All components of 'footype' are PRIVATE" } ! foo2 = bartype(1,2) ! { dg-error "'dummy2' is PRIVATE" } foo2%dummy2 = 5 ! { dg-error "is a PRIVATE component" } end program foo_test ! { dg-final { cleanup-modules "foomod" } } --- 19,25 ---- TYPE(footype) :: foo TYPE(bartype) :: foo2 foo = footype(1) ! { dg-error "All components of 'footype' are PRIVATE" } ! foo2 = bartype(1,2) ! { dg-error "is a PRIVATE component" } foo2%dummy2 = 5 ! { dg-error "is a PRIVATE component" } end program foo_test ! { dg-final { cleanup-modules "foomod" } } Index: gcc/testsuite/gfortran.dg/structure_constructor_7.f03 =================================================================== *** gcc/testsuite/gfortran.dg/structure_constructor_7.f03 (revision 138273) --- gcc/testsuite/gfortran.dg/structure_constructor_7.f03 (working copy) *************** PROGRAM test *** 13,18 **** TYPE(basics_t) :: basics basics = basics_t (42, 1.5, 1000) ! { dg-error "Too many components" } ! basics = basics_t (42, xxx = 1000) ! { dg-error "Component 'xxx'" } END PROGRAM test --- 13,18 ---- TYPE(basics_t) :: basics basics = basics_t (42, 1.5, 1000) ! { dg-error "Too many components" } ! basics = basics_t (42, xxx = 1000) ! { dg-error "is not a member" } END PROGRAM test Index: gcc/testsuite/gfortran.dg/structure_constructor_8.f03 =================================================================== *** gcc/testsuite/gfortran.dg/structure_constructor_8.f03 (revision 138273) --- gcc/testsuite/gfortran.dg/structure_constructor_8.f03 (working copy) *************** PROGRAM test *** 47,54 **** struct2 = allpriv_t () ! These should fail ! struct1 = haspriv_t (1, 2) ! { dg-error "'b' is PRIVATE" } ! struct1 = haspriv_t (b = 2, a = 1) ! { dg-error "'b' is PRIVATE" } ! This should fail as all components are private struct2 = allpriv_t (5) ! { dg-error "of 'allpriv_t' are PRIVATE" } --- 47,54 ---- struct2 = allpriv_t () ! These should fail ! struct1 = haspriv_t (1, 2) ! { dg-error "is a PRIVATE component" } ! struct1 = haspriv_t (b = 2, a = 1) ! { dg-error "is a PRIVATE component" } ! This should fail as all components are private struct2 = allpriv_t (5) ! { dg-error "of 'allpriv_t' are PRIVATE" } ........ r138277 | sje | 2008-07-29 15:32:32 -0700 (Tue, 29 Jul 2008) | 2 lines * gcc.dg/pr32370.c: Force 64 bits on IA64. ........ r138289 | gccadmin | 2008-07-29 17:16:57 -0700 (Tue, 29 Jul 2008) | 1 line Daily bump. ........ r138291 | amodra | 2008-07-29 19:43:05 -0700 (Tue, 29 Jul 2008) | 5 lines PR target/36955 * config/rs6000/rs6000.c (rs6000_legitimize_tls_address): Add a use of pic_offset_table_rtx for -msecure-plt __tls_get_addr calls. ........ r138293 | rwild | 2008-07-29 22:28:53 -0700 (Tue, 29 Jul 2008) | 30 lines gcc/ada/ PR documentation/15479 * gnat-style.texi: Remove AdaCore copyright statement and GPL statement for GNAT. Add @copying stanza, use it. Update to GFDL 1.2. Do not list GFDL as Invariant Section, do not list title as Front-Cover Text. * gnat_rm.texi: Likewise. * gnat_ugn.texi: Likewise. gcc/ * doc/cpp.texi: Update to GFDL 1.2. * doc/gcc.texi: Do not list GPL as Invariant Section. * doc/gccint.texi: Likewise. Update copyright years. * doc/install.texi: Update copyright years. gcc/fortran/ * gfc-internals.texi: Update to GFDL 1.2. Do not list GPL as Invariant Section. * gfortran.texi: Likewise. * intrinsic.texi: Do not list GPL as Invariant Section. * invoke.texi: Likewise. Update copyright years. gcc/java/ * gcj.texi: Update copyright years. Do not list GPL as Invariant Section. libgomp/ * libgomp.texi: Update to GFDL 1.2. Update copyright years. Do not list GPL as Invariant Section. ........ r138294 | guerby | 2008-07-29 23:45:39 -0700 (Tue, 29 Jul 2008) | 18 lines gcc/ChangeLog 2008-07-29 Laurent Guerby <laurent@guerby.net> PR ada/5911 * gnattools/Makefile.in: Replace stamp-gnatlib by stamp-gnatlib-rts. gcc/ada/ChangeLog 2008-07-29 Laurent Guerby <laurent@guerby.net> PR ada/5911 * gcc-interface/Makefile.in (MULTISUBDIR, RTSDIR): New variables. Pass MULTISUBDIR to recursive make. Use $(RTSDIR) instead of rts. Replace stamp-gnatlib* by stamp-gnatlib*-rts. * gcc-interface/Make-lang.in: Replace stamp-gnatlib2 by stamp-gnatlib2-rts. ........ r138295 | hainque | 2008-07-30 00:44:09 -0700 (Wed, 30 Jul 2008) | 5 lines * scan.c (make_sstring_space): Add explicit conversions of allocator's return value. * fix-header.c (recognized_function): Likewise. ........ r138296 | manu | 2008-07-30 01:30:32 -0700 (Wed, 30 Jul 2008) | 15 lines 2008-07-30 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR 34389 * c-typeck.c (build_binary_op): Encapsulate code into... * c-common.c (shorten_binary_op): ...this new function. (conversion_warning): Use the new function. Handle non-negative constant in bitwise-and. * c-common.h (shorten_binary_op): Declare. cp/ * typeck.c (build_binary_op): Encapsulate code into shorten_binary_op. testsuite/ * gcc.dg/Wconversion-pr34389.c: New. * g++.dg/warn/Wconversion-pr34389.C: New. ........ r138297 | hainque | 2008-07-30 03:13:46 -0700 (Wed, 30 Jul 2008) | 5 lines * config/mips/irix-crti.asm: .hide __gcc_init and __gcc_fini. * config/mips/iris6.h (IRIX_SUBTARGET_LINK_SPEC, irix ld): Hide __dso_handle explicitly here. ........ r138298 | hainque | 2008-07-30 03:15:19 -0700 (Wed, 30 Jul 2008) | 3 lines Fix date on entry headline. ........ r138300 | bonzini | 2008-07-30 05:09:47 -0700 (Wed, 30 Jul 2008) | 2 lines move wrong gcc/ChangeLog entry to gnattools/ChangeLog ........ r138301 | bonzini | 2008-07-30 05:17:17 -0700 (Wed, 30 Jul 2008) | 55 lines 2008-07-30 Paolo Bonzini <bonzini@gnu.org> * configure.ac: Add makefile fragments for hpux. * Makefile.def (flags_to_pass): Add ADA_CFLAGS. * Makefile.tpl (HOST_EXPORTS): Pass ADA_CFLAGS. * configure: Regenerate. * Makefile.in: Regenerate. config: 2008-07-30 Paolo Bonzini <bonzini@gnu.org> * mh-pa: New, from gcc/config/pa/x-ada. * mh-pa-hpux10: New, from gcc/config/pa/x-ada-hpux10. gcc: 2008-07-30 Paolo Bonzini <bonzini@gnu.org> * configure.ac: Substitute ADA_CFLAGS. * configure: Regenerate. * config.host: Remove mention of pa/x-ada and pa/x-ada-hpux10 files. * Makefile.in: Remove mention of X_* variables. * config/pa/x-ada-hpux10: Remove. * config/pa/x-ada: Remove. * doc/fragments.texi: Update. gcc/ada: 2008-07-30 Paolo Bonzini <bonzini@gnu.org> * gcc-interface/Make-lang.in (ALL_ADAFLAGS): Remove X_ADAFLAGS and T_ADAFLAGS, replace ALL_ADA_CFLAGS with ADA_CFLAGS. (ALL_ADA_CFLAGS): Remove, replace throughout with ADA_CFLAGS. * gcc-interface/Makefile.in (XCFLAGS, X_CFLAGS, X_CPPFLAGS, T_CPPFLAGS, X_ADA_CFLAGS, T_ADA_CFLAGS, X_ADAFLAGS, T_ADAFLAGS, ADA_CFLAGS, ALL_ADA_CFLAGS): Remove. (ALL_ADAFLAGS, MOST_ADAFLAGS): Remove X_ADAFLAGS and T_ADAFLAGS, replace ALL_ADA_CFLAGS with ADA_CFLAGS. (GCC_CFLAGS): Remove X_CFLAGS. (LOOSE_CFLAGS): Remove X_CFLAGS and XCFLAGS. (ALL_CPPFLAGS): Remove X_CPPFLAGS and T_CPPFLAGS. (ADA_CFLAGS): Substitute. gnattools: 2008-07-30 Paolo Bonzini <bonzini@gnu.org> * configure.ac (x_ada_cflags): Remove. (ADA_CFLAGS): Substitute. * configure: Regenerate. * Makefile.in (ADA_CFLAGS): Substitute. (T_ADA_CFLAGS, X_ADA_CFLAGS, ALL_ADA_CFLAGS): Remove. (TOOLS_FLAGS_TO_PASS_1, TOOLS_FLAGS_TO_PASS_1re, TOOLS_FLAGS_TO_PASS_NATIVE, TOOLS_FLAGS_TO_PASS_CROSS): Pass ADA_CFLAGS. ........ r138302 | charlet | 2008-07-30 06:02:21 -0700 (Wed, 30 Jul 2008) | 4 lines 2008-07-30 Robert Dewar <dewar@adacore.com> * make.adb: Minor reformatting ........ r138303 | charlet | 2008-07-30 06:02:30 -0700 (Wed, 30 Jul 2008) | 4 lines 2008-07-30 Robert Dewar <dewar@adacore.com> * mlib-utl.adb: Minor reformatting ........ r138304 | charlet | 2008-07-30 06:02:39 -0700 (Wed, 30 Jul 2008) | 4 lines 2008-07-30 Robert Dewar <dewar@adacore.com> * osint.ads: Minor reformatting ........ r138305 | charlet | 2008-07-30 06:03:32 -0700 (Wed, 30 Jul 2008) | 32 lines 2008-07-30 Jose Ruiz <ruiz@adacore.com> * adaint.c (__gnat_file_exists): Do not use __gnat_stat for RTX. (__main for RTX in RTSS mode): Create this dummy procedure symbol to avoid the use of this symbol from libgcc.a in RTX kernel mode. * cio.c (put_int, put_int_stderr, put_char, put_char_stderr): For RTX we call the function RtPrintf for console output. * argv.c Do not use the environ variable for RTX. * gnatlink.adb (gnatlink): The part that handles the --RTS option has been moved before the call to Osint.Add_Default_Search_Dirs in order to take into account the flags in system.ads (RTX_RTSS_Kernel_Module) from the appropriate run time. * targparm.ads (RTX_RTSS_Kernel_Module_On_Target): Add this flag that is set to True if target is a RTSS module for RTX. * targparm.adb (Targparm_Tags, RTX_Str, Targparm_Str): Add tag RTX for RTX_RTSS_Kernel_Module (Get_Target_Parameters): Add processing of RTX_RTSS_Kernel_Module flag. * gcc-interface/Makefile.in (LIBGNAT_TARGET_PAIRS for RTX): Use gcc exception handling mechanism for Windows and RTX in Win32 mode, but not for RTX in kernel mode (RTSS). (LIBGNAT_SRCS): Remove ada.h ........ r138306 | charlet | 2008-07-30 06:04:41 -0700 (Wed, 30 Jul 2008) | 2 lines Resync ........ r138307 | charlet | 2008-07-30 06:06:45 -0700 (Wed, 30 Jul 2008) | 21 lines 2008-07-30 Doug Rupp <rupp@adacore.com> * gigi.h (build_vms_descriptor64): New function prototype. (fill_vms_descriptor): Modified function prototype. * utils.c (build_vms_descriptor64): New function. * utils2.c (fill_vms_descriptor): Fix handling on 32bit systems. * trans.c (call_to_gnu): Call fill_vms_descriptor with new third argument. * decl.c (gnat_to_gnu_tree): For By_Descriptor mech, build both a 64bit and 32bit descriptor and save the 64bit version as an alternate TREE_TYPE in the parameter. (make_type_from_size) <RECORD_TYPE>: Use the appropriate mode for the thin pointer. * ada-tree.h (DECL_PARM_ALT, SET_DECL_PARM_ALT): New macros. ........ r138308 | dodji | 2008-07-30 06:07:50 -0700 (Wed, 30 Jul 2008) | 9 lines 2008-07-30 Dodji Seketeli <dseketel@redhat.com> PR c++/36767 * decl2.c (fix_temporary_vars_context_r): New function. (one_static_initialization_or_destruction): Make sure temporary variables part of the initialiser have their DECL_CONTEXT() properly set. ........ r138310 | espindola | 2008-07-30 06:59:58 -0700 (Wed, 30 Jul 2008) | 15 lines 2008-07-30 Rafael Avila de Espindola <espindola@google.com> * final.c (call_from_call_insn): New. (final_scan_insn): Call assemble_external on FUNCTION_DECLs. 2008-07-30 Rafael Avila de Espindola <espindola@google.com> * gcc.dg/visibility-14.c: New test. * gcc.dg/visibility-15.c: New test. * gcc.dg/visibility-16.c: New test. * gcc.dg/visibility-17.c: New test. * gcc.dg/visibility-18.c: New test. * gcc.dg/visibility-19.c: New test. ........ r138313 | bonzini | 2008-07-30 07:57:07 -0700 (Wed, 30 Jul 2008) | 8 lines config: sync with src 2008-07-25 Keith Seitz <keiths@redhat.com> * acinclude.m4: Remove libide, libgui, and all the other Tcl functions. * tcl.m4: New file. ........ r138314 | bonzini | 2008-07-30 08:04:24 -0700 (Wed, 30 Jul 2008) | 2 lines sync with src ........ r138316 | froydnj | 2008-07-30 08:30:59 -0700 (Wed, 30 Jul 2008) | 5 lines PR target/35866 * config/rs6000/rs6000.h (SLOW_UNALIGNED_ACCESS): Add clause for vector modes. ........ r138317 | froydnj | 2008-07-30 08:32:34 -0700 (Wed, 30 Jul 2008) | 3 lines * config/arm/arm.c (arm_expand_prologue): Use 0-length rtvec instead of NULL_RTVEC. ........ r138318 | rguenth | 2008-07-30 08:43:42 -0700 (Wed, 30 Jul 2008) | 8 lines 2008-07-30 Richard Guenther <rguenther@suse.de> PR tree-optimization/36967 * tree-predcom.c (remove_stmt): Use gimple_assign_ssa_name_copy_p. Release defs of statements we remove. * gfortran.dg/pr36967.f: New testcase. ........ r138320 | charlet | 2008-07-30 08:52:36 -0700 (Wed, 30 Jul 2008) | 4 lines 2008-07-30 Robert Dewar <dewar@adacore.com> * gnatlink.adb: Minor reformatting ........ r138321 | charlet | 2008-07-30 08:52:47 -0700 (Wed, 30 Jul 2008) | 7 lines 2008-07-30 Thomas Quinot <quinot@adacore.com> * rtsfind.adb (Check_RPC): Check version consistency even when not generating RCI stubs. Provide more detailed error message in case of mismatch. ........ r138322 | charlet | 2008-07-30 08:52:58 -0700 (Wed, 30 Jul 2008) | 11 lines 2008-07-30 Ed Schonberg <schonberg@adacore.com> * sem_ch8.adb (Analyze_Subprogram_Renaming): When renaming an attribute as a actual in an instance, check for a missing attribute to prevent program_error on an illegal program. * exp_util.adb (Find_Prim_Op): Rather than Assert (False), raise program error if primitive is not found, so that exception can be handled elsewhere on illegal programs. ........ r138323 | charlet | 2008-07-30 08:53:08 -0700 (Wed, 30 Jul 2008) | 4 lines 2008-07-30 Robert Dewar <dewar@adacore.com> * uintp.adb (UI_GCD): Fix potential overflow ........ r138324 | charlet | 2008-07-30 08:53:21 -0700 (Wed, 30 Jul 2008) | 59 lines 2008-07-30 Hristian Kirtchev <kirtchev@adacore.com> * einfo.adb: Flag245 is now used. (Is_Primitive_Wrapper, Set_Is_Primitive_Wrapper): Relax the assertion check to include functions. (Is_Private_Primitive, Set_Is_Private_Primitive): New subprograms. (Wrapped_Entity, Set_Wrapped_Entity): Relax the assertion check to include functions. (Write_Entity_Flags): Move flag Is_Primitive, add Is_Private_Primitive to the list of displayed flags. * einfo.ads: Update comment on the usage of Is_Primitive_Wrapper and Wrapped_Entity. These two flags are now present in functions. New flag Is_Private_Primitive. (Is_Private_Primitive, Set_Is_Private_Primitive): New subprograms. * exp_ch9.adb: (Build_Wrapper_Bodies): New subprogram. (Build_Wrapper_Body): The spec and body have been moved to in Build_Wrapper_ Bodies. Code cleanup. (Build_Wrapper_Spec): Moved to the spec of Exp_Ch9. Code cleanup. Wrappers are now generated for primitives declared between the private and full view of a concurrent type that implements an interface. (Build_Wrapper_Specs): New subprogram. (Expand_N_Protected_Body): Code reformatting. Replace the wrapper body creation mechanism with a call to Build_Wrapper_Bodies. (Expand_N_Protected_Type_Declaration): Code reformatting. Replace the wrapper spec creation mechanism with a call to Build_Wrapper_Specs. (Expand_N_Task_Body): Replace the wrapper body creation mechanism with a call to Build_Wrapper_Bodies. (Expand_N_Task_Type_Declaration): Replace the wrapper spec creation mechanism with a call to Build_Wrapper_Specs. (Is_Private_Primitive_Subprogram): New subprogram. (Overriding_Possible): Code cleanup. (Replicate_Entry_Formals): Renamed to Replicate_Formals, code cleanup. * exp_ch9.ads (Build_Wrapper_Spec): Moved from the body of Exp_Ch9. * sem_ch3.adb: Add with and use clause for Exp_Ch9. (Process_Full_View): Build wrapper specs for all primitives that belong to a private view completed by a concurrent type implementing an interface. * sem_ch6.adb (Analyze_Subprogram_Body): When the current subprogram is a primitive of a concurrent type with a private view that implements an interface, try to find the proper spec. (Analyze_Subprogram_Declaration): Mark a subprogram as a private primitive if the type of its first parameter is a non-generic tagged private type. (Analyze_Subprogram_Specification): Code reformatting. (Disambiguate_Spec): New routine. (Find_Corresponding_Spec): Add a flag to controll the output of errors. (Is_Private_Concurrent_Primitive): New routine. * sem_ch6.ads: (Find_Corresponding_Spec): Add a formal to control the output of errors. ........ r138325 | charlet | 2008-07-30 08:56:34 -0700 (Wed, 30 Jul 2008) | 2 lines Resync. ........ r138327 | andrewjenner | 2008-07-30 09:28:01 -0700 (Wed, 30 Jul 2008) | 12 lines * config/arm/arm.c (arm_compute_static_chain_stack_bytes): New function. (arm_compute_initial_elimination_offset): Use it. (arm_compute_save_reg_mask): Include static chain save slot when calculating alignment. (arm_get_frame_offsets): Ditto. (thumb1_compute_save_reg_mask): Ensure we have a low register saved that we can use to decrement the stack when the stack decrement could be too big for an immediate value in a single insn. (thumb1_expand_prologue): Avoid using r12 for stack decrement. ........ r138328 | charlet | 2008-07-30 10:38:04 -0700 (Wed, 30 Jul 2008) | 4 lines 2008-07-30 Robert Dewar <dewar@adacore.com> * exp_ch9.adb: Minor reformatting ........ r138329 | charlet | 2008-07-30 10:38:16 -0700 (Wed, 30 Jul 2008) | 8 lines 2008-07-30 Robert Dewar <dewar@adacore.com> * exp_util.ads (Find_Prim_Op): Document that Program_Error is raised if no primitive operation is found. * exp_util.adb: (Find_Prim_Op): Add comments for previous change ........ r138330 | charlet | 2008-07-30 10:38:25 -0700 (Wed, 30 Jul 2008) | 4 lines 2008-07-30 Robert Dewar <dewar@adacore.com> * sem_ch8.adb: Minor reformatting ........ r138331 | charlet | 2008-07-30 10:38:55 -0700 (Wed, 30 Jul 2008) | 11 lines 2008-07-30 Laurent Pautet <pautet@adacore.com> * g-pehage.adb: Remove a limitation on the length of the words handled by the minimal perfect hash function generator. * g-pehage.ads: Detail the use of subprograms Insert, Initialize, Compute and Finalize. Fix some typos. ........ r138332 | charlet | 2008-07-30 10:39:56 -0700 (Wed, 30 Jul 2008) | 2 lines Resync. ........ r138333 | schwab | 2008-07-30 11:22:50 -0700 (Wed, 30 Jul 2008) | 5 lines PR rtl-optimization/36929 * dse.c (replace_inc_dec): Use emit_insn_before instead of add_insn_before and fix argument order. (replace_inc_dec_mem): Handle NULL rtx. ........ r138335 | hjl | 2008-07-30 12:20:43 -0700 (Wed, 30 Jul 2008) | 166 lines 2008-07-30 Joey Ye <joey.ye@intel.com> H.J. Lu <hongjiu.lu@intel.com> * builtins.c (expand_builtin_setjmp_receiver): Replace virtual_incoming_args_rtx with crtl->args.internal_arg_pointer. (expand_builtin_apply_args_1): Likewise. (expand_builtin_longjmp): Need DRAP for stack alignment. (expand_builtin_apply): Likewise. * caller-save.c (setup_save_areas): Call assign_stack_local_1 instead of assign_stack_local to allow alignment reduction. * calls.c (emit_call_1): Need DRAP for stack alignment if return pops. (expand_call): Replace virtual_incoming_args_rtx with crtl->args.internal_arg_pointer. * stmt.c (expand_nl_goto_receiver): Likewise. * cfgexpand.c (get_decl_align_unit): Estimate stack variable alignment and store to stack_alignment_estimated and max_used_stack_slot_alignment. (expand_one_var): Likewise. (expand_stack_alignment): New function. (tree_expand_cfg): Initialize max_used_stack_slot_alignment and stack_alignment_estimated fields in rtl_data. Call expand_stack_alignment at end. * defaults.h (INCOMING_STACK_BOUNDARY): New. (MAX_STACK_ALIGNMENT): Likewise. (MAX_SUPPORTED_STACK_ALIGNMENT): Likewise. (SUPPORTS_STACK_ALIGNMENT): Likewise. * emit-rtl.c (gen_reg_rtx): Estimate stack alignment for stack alignment when generating virtual registers. * function.c (assign_stack_local): Renamed to ... (assign_stack_local_1): This. Add a parameter to indicate if it is OK to reduce alignment. (assign_stack_local): Use it. (instantiate_new_reg): Instantiate virtual incoming args rtx to vDRAP if stack realignment and DRAP is needed. (assign_parms): Collect parameter/return type alignment and contribute to stack_alignment_estimated. (locate_and_pad_parm): Likewise. (get_arg_pointer_save_area): Replace virtual_incoming_args_rtx with crtl->args.internal_arg_pointer. * function.h (rtl_data): Add new field drap_reg, max_used_stack_slot_alignment, stack_alignment_estimated, stack_realign_needed, need_drap, stack_realign_processed and stack_realign_finalized. (stack_realign_fp): New macro. (stack_realign_drap): Likewise. * global.c (compute_regsets): Frame pointer is needed when stack is realigned. Can eliminate frame pointer when stack is realigned and dynamic realigned argument pointer isn't used. * reload1.c (update_eliminables): Frame pointer is needed when stack is realigned. (init_elim_table): Can eliminate frame pointer when stack is realigned and dynamic realigned argument pointer isn't used. * rtl.h (assign_stack_local_1): Declare new funtion. * target-def.h (TARGET_UPDATE_STACK_BOUNDARY): New. (TARGET_GET_DRAP_RTX): Likewise. (TARGET_CALLS): Add TARGET_UPDATE_STACK_BOUNDARY and TARGET_GET_DRAP_RTX. * target.h (gcc_target): Add update_stack_boundary and get_drap_rtx. * tree-vectorizer.c (vect_can_force_dr_alignment_p): Replace STACK_BOUNDARY with MAX_STACK_ALIGNMENT. 2008-07-30 Xuepeng Guo <xuepeng.guo@intel.com> H.J. Lu <hongjiu.lu@intel.com> * dwarf2out.c (dw_fde_struct): Add stack_realignment, drap_reg, vdrap_reg, stack_realign and drap_reg_saved. (add_cfi): Don't allow redefining CFA when DRAP is used. (reg_save): Handle stack alignment. (dwarf2out_frame_debug_expr): Add rules 16-20 to handle stack alignment. Don't generate DWARF information for (set fp sp) when DRAP is used. (dwarf2out_begin_prologue): Initialize drap_reg and vdrap_reg to INVALID_REGNUM. (int_loc_descriptor): Move prototype forward. Also define if DWARF2_UNWIND_INFO is true. (output_cfa_loc): Handle DW_CFA_expression. (build_cfa_aligned_loc): New. (based_loc_descr): Update assert for stack realign. For local variables, use sp+offset when stack is aligned without drap and fp+offset when stack is aligned with drap. For arguments, use cfa+offset when drap is used to align stack. 2008-07-30 Joey Ye <joey.ye@intel.com> H.J. Lu <hongjiu.lu@intel.com> * config/i386/i386.c (ix86_force_align_arg_pointer_string): Break long line. (ix86_gen_andsp): New. (ix86_user_incoming_stack_boundary): Likewise. (ix86_default_incoming_stack_boundary): Likewise. (ix86_incoming_stack_boundary): Likewise. (ix86_can_eliminate): Likewise. (find_drap_reg): Likewise. (ix86_update_stack_boundary): Likewise. (ix86_get_drap_rtx): Likewise. (ix86_finalize_stack_realign_flags): Likewise. (TARGET_UPDATE_STACK_BOUNDARY): Likewise. (TARGET_GET_DRAP_RTX): Likewise. (override_options): Overide option value for new options. (ix86_function_ok_for_sibcall): Remove check for force_align_arg_pointer. (ix86_handle_cconv_attribute): Likewise. (ix86_function_regparm): Likewise. (setup_incoming_varargs_64): Don't set stack_alignment_needed here. (ix86_va_start): Replace virtual_incoming_args_rtx with crtl->args.internal_arg_pointer. (ix86_select_alt_pic_regnum): Check DRAP register. (ix86_save_reg): Replace force_align_arg_pointer with drap_reg. (ix86_compute_frame_layout): Compute frame layout wrt stack realignment. (ix86_internal_arg_pointer): Just return virtual_incoming_args_rtx. (ix86_expand_prologue): Decide if stack realignment is needed and generate prologue code accordingly. (ix86_expand_epilogue): Generate epilogue code wrt stack realignment is really needed or not. * config/i386/i386.h (MAIN_STACK_BOUNDARY): New. (ABI_STACK_BOUNDARY): Likewise. (PREFERRED_STACK_BOUNDARY_DEFAULT): Likewise. (STACK_REALIGN_DEFAULT): Likewise. (INCOMING_STACK_BOUNDARY): Likewise. (MAX_STACK_ALIGNMENT): Likewise. (ix86_incoming_stack_boundary): Likewise. (FORCE_PREFERRED_STACK_BOUNDARY_IN_MAIN): Removed. (REAL_PIC_OFFSET_TABLE_REGNUM): Updated to use BX_REG. (CAN_ELIMINATE): Defined with ix86_can_eliminate. (machine_function): Remove force_align_arg_pointer. * config/i386/i386.md (BX_REG): New. (R13_REG): Likewise. * config/i386/i386.opt (mforce_drap): New. (mincoming-stack-boundary): Likewise. (mstackrealign): Add Init(-1). * config/i386/i386-protos.h (ix86_can_eliminate): New 2008-07-30 H.J. Lu <hongjiu.lu@intel.com> * doc/extend.texi: Update force_align_arg_pointer. * doc/invoke.texi: Document -mincoming-stack-boundary. Update -mstackrealign. * doc/tm.texi (MAX_STACK_ALIGNMENT): Add macro. (INCOMING_STACK_BOUNDARY): Likewise. (TARGET_UPDATE_STACK_BOUNDARY): New target hook. (TARGET_GET_DRAP_RTX): Likewise. ........ r138336 | hjl | 2008-07-30 12:24:02 -0700 (Wed, 30 Jul 2008) | 90 lines 2008-07-30 H.J. Lu <hongjiu.lu@intel.com> Joey Ye <joey.ye@intel.com> * gcc.dg/dfp/func-vararg-alternate-d128-2.c: New. * gcc.dg/dfp/func-vararg-mixed-2.c: Likewise. * gcc.dg/torture/stackalign/alloca-1.c: Likewise. * gcc.dg/torture/stackalign/builtin-apply-1.c: Likewise. * gcc.dg/torture/stackalign/builtin-apply-2.c: Likewise. * gcc.dg/torture/stackalign/builtin-apply-3.c: Likewise. * gcc.dg/torture/stackalign/builtin-apply-4.c: Likewise. * gcc.dg/torture/stackalign/builtin-return-1.c: Likewise. * gcc.dg/torture/stackalign/check.h: Likewise. * gcc.dg/torture/stackalign/comp-goto-1.c: Likewise. * gcc.dg/torture/stackalign/fastcall-1.c: Likewise. * gcc.dg/torture/stackalign/global-1.c: Likewise. * gcc.dg/torture/stackalign/inline-1.c: Likewise. * gcc.dg/torture/stackalign/inline-2.c: Likewise. * gcc.dg/torture/stackalign/nested-1.c: Likewise. * gcc.dg/torture/stackalign/nested-2.c: Likewise. * gcc.dg/torture/stackalign/nested-3.c: Likewise. * gcc.dg/torture/stackalign/nested-4.c: Likewise. * gcc.dg/torture/stackalign/nested-5.c: Likewise. * gcc.dg/torture/stackalign/nested-6.c: Likewise. * gcc.dg/torture/stackalign/non-local-goto-1.c: Likewise. * gcc.dg/torture/stackalign/non-local-goto-2.c: Likewise. * gcc.dg/torture/stackalign/non-local-goto-3.c: Likewise. * gcc.dg/torture/stackalign/non-local-goto-4.c: Likewise. * gcc.dg/torture/stackalign/non-local-goto-5.c: Likewise. * gcc.dg/torture/stackalign/pr16660-1.c: Likewise. * gcc.dg/torture/stackalign/pr16660-2.c: Likewise. * gcc.dg/torture/stackalign/pr16660-3.c: Likewise. * gcc.dg/torture/stackalign/regparm-1.c: Likewise. * gcc.dg/torture/stackalign/ret-struct-1.c: Likewise. * gcc.dg/torture/stackalign/setjmp-1.c: Likewise. * gcc.dg/torture/stackalign/setjmp-2.c: Likewise. * gcc.dg/torture/stackalign/setjmp-3.c: Likewise. * gcc.dg/torture/stackalign/setjmp-4.c: Likewise. * gcc.dg/torture/stackalign/sibcall-1.c: Likewise. * gcc.dg/torture/stackalign/stackalign.exp: Likewise. * gcc.dg/torture/stackalign/struct-1.c: Likewise. * gcc.dg/torture/stackalign/vararg-1.c: Likewise. * gcc.dg/torture/stackalign/vararg-2.c: Likewise. * gcc.target/i386/align-main-1.c: Likewise. * gcc.target/i386/align-main-2.c: Likewise. * gcc.target/i386/pr32000-2.c: Likewise. * gcc.target/i386/stackalign/asm-1.c: Likewise. * gcc.target/i386/stackalign/return-1.c: Likewise. * gcc.target/i386/stackalign/return-2.c: Likewise. * gcc.target/i386/stackalign/return-3.c: Likewise. * gcc.target/i386/stackalign/return-4.c: Likewise. * gcc.target/i386/stackalign/return-5.c: Likewise. * gcc.target/i386/stackalign/return-6.c: Likewise. * gcc.target/i386/stackalign/stackalign.exp: Likewise. * g++.dg/torture/stackalign/check.h: Likewise. * g++.dg/torture/stackalign/eh-alloca-1.C: Likewise. * g++.dg/torture/stackalign/eh-fastcall-1.C: Likewise. * g++.dg/torture/stackalign/eh-global-1.C: Likewise. * g++.dg/torture/stackalign/eh-inline-1.C: Likewise. * g++.dg/torture/stackalign/eh-inline-2.C: Likewise. * g++.dg/torture/stackalign/eh-vararg-1.C: Likewise. * g++.dg/torture/stackalign/eh-vararg-2.C: Likewise. * g++.dg/torture/stackalign/stackalign.exp: Likewise. * g++.dg/torture/stackalign/stdcall-1.C: Likewise. * g++.dg/torture/stackalign/test-unwind.h: Likewise. * g++.dg/torture/stackalign/throw-1.C: Likewise. * g++.dg/torture/stackalign/throw-2.C: Likewise. * g++.dg/torture/stackalign/throw-3.C: Likewise. * g++.dg/torture/stackalign/throw-4.C: Likewise. * g++.dg/torture/stackalign/unwind-0.C: Likewise. * g++.dg/torture/stackalign/unwind-1.C: Likewise. * g++.dg/torture/stackalign/unwind-2.C: Likewise. * g++.dg/torture/stackalign/unwind-3.C: Likewise. * g++.dg/torture/stackalign/unwind-4.C: Likewise. * g++.dg/torture/stackalign/unwind-5.C: Likewise. * g++.dg/torture/stackalign/unwind-6.C: Likewise. * gcc.target/i386/20060512-1.c: Add -mpreferred-stack-boundary=4. (main): Move "popl" after check. * gcc.target/i386/20060512-3.c: Likewise. * gcc.target/i386/20060512-2.c: Add -mpreferred-stack-boundary=4. Remove dg-error. * gcc.target/i386/20060512-4.c: Add -mpreferred-stack-boundary=4. Remove dg-warning. * lib/target-supports.exp (check_effective_target_unaligned_stack): Always return 0. (check_effective_target_automatic_stack_alignment): New. ........ r138340 | hjl | 2008-07-30 13:19:53 -0700 (Wed, 30 Jul 2008) | 6 lines 2008-07-30 H.J. Lu <hongjiu.lu@intel.com> * builtins.c (std_gimplify_va_arg_expr): Replace PREFERRED_STACK_BOUNDARY with MAX_SUPPORTED_STACK_ALIGNMENT. * config/i386/i386.c (ix86_gimplify_va_arg): Likewise. ........ r138347 | espindola | 2008-07-30 16:23:33 -0700 (Wed, 30 Jul 2008) | 6 lines 2008-07-30 Rafael Avila de Espindola <espindola@google.com> PR 36974 * final.c (call_from_call_insn): Handle COND_EXEC ........ r138348 | ebotcazou | 2008-07-30 16:54:56 -0700 (Wed, 30 Jul 2008) | 20 lines PR ada/36554 * dwarf2out.c (is_subrange_type): Deal with BOOLEAN_TYPE. ada/ * back_end.adb (Call_Back_End): Pass Standard_Boolean to gigi. * gcc-interface/gigi.h (gigi): Take new standard_boolean parameter. * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Enumeration_Subtype>: Set precision to 1 for subtype of BOOLEAN_TYPE. (set_rm_size): Set TYPE_RM_SIZE_NUM for BOOLEAN_TYPE. (make_type_from_size): Deal with BOOLEAN_TYPE. * gcc-interface/misc.c (gnat_print_type): Likewise. * gcc-interface/trans.c (gigi): Take new standard_boolean parameter. Set boolean_type_node as its translation in the table, as well as boolean_false_node for False and boolean_true_node for True. * gcc-interface/utils.c (gnat_init_decl_processing): Create custom 8-bit boolean_type_node and set its TYPE_RM_SIZE_NUM. (create_param_decl): Deal with BOOLEAN_TYPE. (build_vms_descriptor): Likewise. (build_vms_descriptor64): Likewise. (convert): Deal with BOOLEAN_TYPE like with ENUMERAL_TYPE. ........ r138351 | gccadmin | 2008-07-30 17:16:40 -0700 (Wed, 30 Jul 2008) | 1 line Daily bump. ........ r138353 | aaronwl | 2008-07-30 17:18:07 -0700 (Wed, 30 Jul 2008) | 6 lines 2008-07-30 Aaron W. LaFramboise <aaronavay62@aaronwl.com> * Makefile.in (EXTRA_GNATRTL_NONTASKING_OBJS) [WINDOWS]: Add s-winext.o. ........ r138355 | jason | 2008-07-30 22:07:10 -0700 (Wed, 30 Jul 2008) | 9 lines PR c++/11309 * tree.c (build_aggr_init_expr): Split out... (build_cplus_new): ...from here. (stabilize_init): Don't mess with AGGR_INIT_EXPR either. * init.c (build_new_1): new T() means value-initialization, not default-initialization. (build_vec_init): Likewise. (build_value_init_1): Use build_aggr_init_expr. ........ r138356 | charlet | 2008-07-31 00:51:32 -0700 (Thu, 31 Jul 2008) | 5 lines 2008-07-31 Robert Dewar <dewar@adacore.com> * g-pehage.adb, g-pehage.ads: Minor reformatting ........ r138357 | charlet | 2008-07-31 00:51:44 -0700 (Thu, 31 Jul 2008) | 2 lines * mlib-utl.ads, prj-makr.ads: Add comments. ........ r138358 | charlet | 2008-07-31 00:52:12 -0700 (Thu, 31 Jul 2008) | 2 lines Resync ........ r138360 | jakub | 2008-07-31 00:59:18 -0700 (Thu, 31 Jul 2008) | 9 lines PR preprocessor/36649 * c-pch.c (c_common_read_pch): Save and restore line_table->trace_includes across PCH restore. * gcc.dg/pch/cpp-3.c: New test. * gcc.dg/pch/cpp-3.hs: New file. * gcc.dg/pch/cpp-3a.h: New file. * gcc.dg/pch/cpp-3b.h: New file. ........ r138361 | jakub | 2008-07-31 01:01:25 -0700 (Thu, 31 Jul 2008) | 9 lines PR debug/36278 * dwarf2out.c (get_context_die): New function. (force_decl_die, force_type_die): Use it. (dwarf2out_imported_module_or_decl): Likewise. If base_type_die returns NULL, force generation of DW_TAG_typedef and put that into DW_AT_import. * g++.dg/debug/namespace2.C: New test. ........ r138362 | jakub | 2008-07-31 01:02:49 -0700 (Thu, 31 Jul 2008) | 8 lines PR c/36970 * builtins.c (maybe_emit_free_warning): New function. (expand_builtin): Process BUILT_IN_FREE even at -O0. Call maybe_emit_free_warning for BUILT_IN_FREE. * gcc.dg/free-1.c: New test. * gcc.dg/free-2.c: New test. ........ r138363 | charlet | 2008-07-31 01:17:03 -0700 (Thu, 31 Jul 2008) | 4 lines 2008-07-31 Robert Dewar <dewar@adacore.com> * mlib-utl.ads: Minor reformatting ........ r138364 | charlet | 2008-07-31 01:17:31 -0700 (Thu, 31 Jul 2008) | 11 lines 2008-07-31 Ed Schonberg <schonberg@adacore.com> sem_attr.adb: 'Result can have an ambiguous prefix, and is resolved from context. This attribute must be usable in Ada95 mode. The attribute can appear in the body of a function marked Inline_Always, but in this case the postocondition is not enforced. sem_prag.adb (Check_Precondition_Postcondition): within the expansion of an inlined call pre- and postconditions are legal ........ r138365 | charlet | 2008-07-31 01:18:53 -0700 (Thu, 31 Jul 2008) | 5 lines 2008-07-31 Vincent Celier <celier@adacore.com> * prj.adb, clean.adb, prj-nmsc.adb, prj.ads: Remove declarations that were for gprmake only ........ r138366 | charlet | 2008-07-31 01:19:24 -0700 (Thu, 31 Jul 2008) | 8 lines 2008-07-31 Robert Dewar <dewar@adacore.com> * gnat_ugn.texi: Update -gnatN documentation. * gnat_rm.texi: Add note about pre/postcondition pragmas not checked in conjunction with front-end inlining. ........ r138367 | charlet | 2008-07-31 01:30:58 -0700 (Thu, 31 Jul 2008) | 2 lines Resync ........ r138370 | charlet | 2008-07-31 02:42:14 -0700 (Thu, 31 Jul 2008) | 10 lines 2008-07-31 Robert Dewar <dewar@adacore.com> * einfo.adb (Spec_PPC): Now defined for generic subprograms * einfo.ads (Spec_PPC): Now defined for generic subprograms * sem_prag.adb (Check_Precondition_Postcondition): Handle generic subprogram case ........ r138371 | charlet | 2008-07-31 02:42:39 -0700 (Thu, 31 Jul 2008) | 4 lines 2008-07-31 Vincent Celier <celier@adacore.com> * s-os_lib.adb: Minor comment fix ........ r138372 | charlet | 2008-07-31 02:42:51 -0700 (Thu, 31 Jul 2008) | 13 lines 2008-07-31 Ed Schonberg <schonberg@adacore.com> * sem_ch6.adb (Analyze_Generic_Subprogram_Body): After analysis, transfer pre/postconditions from generic copy to original tree, so that they will appear in each instance. (Process_PPCs): Do not transform postconditions into a procedure in a generic context, to prevent double expansion of check pragmas. * sem_attr.adb: In an instance, the prefix of the 'result attribute can be the renaming of the current instance, so check validity of the name accordingly. ........ r138373 | charlet | 2008-07-31 02:43:09 -0700 (Thu, 31 Jul 2008) | 2 lines Resync ........ r138374 | charlet | 2008-07-31 02:46:03 -0700 (Thu, 31 Jul 2008) | 2 lines * gnat.dg/specs/genericppc.ads: New test ........ r138375 | charlet | 2008-07-31 03:25:05 -0700 (Thu, 31 Jul 2008) | 2 lines * mlib-utl.ads: Fix typo. ........ r138376 | rguenth | 2008-07-31 03:25:11 -0700 (Thu, 31 Jul 2008) | 36 lines 2008-07-31 Richard Guenther <rguenther@suse.de> * passes.c (init_optimization_passes): Always call pass_early_warn_uninitialized. * opts.c (decode_options): Do not warn about -Wuninitialized at -O0. * doc/invoke.texi (-Wuninitialized): Correct for enabling at -O0. * doc/passes.texi (Warn for uninitialized variables): Adjust. * gcc.dg/uninit-1-O0.c: New testcase. * gcc.dg/uninit-2-O0.c: Likewise. * gcc.dg/uninit-3-O0.c: Likewise. * gcc.dg/uninit-4-O0.c: Likewise. * gcc.dg/uninit-5-O0.c: Likewise. * gcc.dg/uninit-6-O0.c: Likewise. * gcc.dg/uninit-8-O0.c: Likewise. * gcc.dg/uninit-9-O0.c: Likewise. * gcc.dg/uninit-A-O0.c: Likewise. * gcc.dg/uninit-B-O0.c: Likewise. * gcc.dg/uninit-C-O0.c: Likewise. * gcc.dg/uninit-D-O0.c: Likewise. * gcc.dg/uninit-E-O0.c: Likewise. * gcc.dg/uninit-F-O0.c: Likewise. * gcc.dg/uninit-G-O0.c: Likewise. * gcc.dg/uninit-H-O0.c: Likewise. * gcc.dg/uninit-I-O0.c: Likewise. * gcc.dg/uninit-10-O0.c: Likewise. * gcc.dg/uninit-11-O0.c: Likewise. * gcc.dg/uninit-12-O0.c: Likewise. * gcc.dg/uninit-13-O0.c: Likewise. * gcc.dg/uninit-14-O0.c: Likewise. * gcc.dg/uninit-15-O0.c: Likewise. * gcc.dg/Wall.c: Avoid uninitialized warning. * gcc.dg/Wno-all.c: Likewise. * gcc.dg/pr3074-1.c: Likewise. ........ r138377 | charlet | 2008-07-31 03:25:14 -0700 (Thu, 31 Jul 2008) | 4 lines 2008-07-31 Robert Dewar <dewar@adacore.com> * sem_ch12.adb: Minor reformatting ........ r138378 | charlet | 2008-07-31 03:25:35 -0700 (Thu, 31 Jul 2008) | 7 lines 2008-07-31 Sergey Rybin <rybin@adacore.com> * gnat_ugn.texi: Change the description of the Overly_Nested_Control_Structures: now the rule always requires a positive parameter for '+R' option ........ r138379 | charlet | 2008-07-31 03:25:50 -0700 (Thu, 31 Jul 2008) | 4 lines 2008-07-31 Thomas Quinot <quinot@adacore.com> * g-pehage.adb: Minor reformatting ........ r138380 | charlet | 2008-07-31 03:26:05 -0700 (Thu, 31 Jul 2008) | 4 lines 2008-07-31 Pascal Obry <obry@adacore.com> * s-finimp.ads: Minor reformatting. ........ r138381 | charlet | 2008-07-31 03:26:12 -0700 (Thu, 31 Jul 2008) | 4 lines 2008-07-31 Vincent Celier <celier@adacore.com> * s-regexp.ads: Minor comment fix ........ r138382 | charlet | 2008-07-31 03:26:43 -0700 (Thu, 31 Jul 2008) | 3 lines * s-direio.adb (Reset): Replace pragma Unmodified by Warnings (Off), so that we can compile this file successfully with -gnatc. ........ r138383 | charlet | 2008-07-31 03:27:04 -0700 (Thu, 31 Jul 2008) | 10 lines 2008-07-31 Hristian Kirtchev <kirtchev@adacore.com> * exp_attr.adb (Find_Stream_Subprogram): Check the base type instead of the type when looking for stream subprograms for type String, Wide_String and Wide_Wide_String. * s-ststop.adb: Change the initialization expression of constant Use_Block_IO. ........ r138384 | charlet | 2008-07-31 03:27:20 -0700 (Thu, 31 Jul 2008) | 26 lines 2008-07-31 Geert Bosch <bosch@adacore.com> * arit64.c: New file implementing __gnat_mulv64 signed integer multiplication with overflow checking * fe.h (Backend_Overflow_Checks_On_Target): Define for use by Gigi * gcc-interface/gigi.h: (standard_types): Add ADT_mulv64_decl (mulv64_decl): Define subprogram declaration for __gnat_mulv64 * gcc-interface/utils.c: (init_gigi_decls): Add initialization of mulv64_decl * gcc-interface/trans.c: (build_unary_op_trapv): New function (build_binary_op_trapv): New function (gnat_to_gnu): Use the above functions instead of build_{unary,binary}_op * gcc-interface/Makefile.in (LIBGNAT_SRCS): Add arit64.c (LIBGNAT_OBJS): Add arit64.o ........ r138385 | charlet | 2008-07-31 03:27:30 -0700 (Thu, 31 Jul 2008) | 6 lines 2008-07-31 Vincent Celier <celier@adacore.com> * prj-nmsc.adb (Check_Library_Attributes): Check if Linker'Switches or Linker'Default_Switches are declared. Warn if they are declared. ........ r138386 | charlet | 2008-07-31 03:27:42 -0700 (Thu, 31 Jul 2008) | 8 lines 2008-07-31 Ed Schonberg <schonberg@adacore.com> * exp_ch6.adb (Make_Build_In_Place_Call_In_Object_Declaration): Use Insert_Actions to place the pointer declaration in the code, rather than Insert_Before_And_Analyze, so that insertions of temporaries are kept in the proper order when transient scopes are present. ........ r138387 | charlet | 2008-07-31 04:04:00 -0700 (Thu, 31 Jul 2008) | 12 lines 2008-07-31 Vincent Celier <celier@adacore.com> * prj-nmsc.adb: (Record_Ada_Source): Do not set Data.Sources, component has been removed * prj.adb: Remove component Sources in record Project_Data * prj.ads: Remove component Sources in record Project_Data * sinput.ads, prj-util.ads: Minor reformatting ........ r138388 | charlet | 2008-07-31 04:04:10 -0700 (Thu, 31 Jul 2008) | 18 lines 2008-07-31 Gary Dismukes <dismukes@adacore.com> * exp_attr.adb (Enclosing_Object): New function local to handling of access attributes, for retrieving the innermost enclosing object prefix of a compound name. (Expand_N_Attribute_Reference, N_Attribute_Access): In the case where an Access attribute has a prefix that is a dereference of an access parameter (or the prefix is a subcomponent selected from such a dereference), apply an accessibility check to the access parameter. Replaces code that rewrote the prefix as a type conversion (and that didn't handle subcomponent cases). Also, this is now only applied in the case of 'Access. * exp_ch6.adb (Expand_Call): Add handling for the case of an access discriminant passed as an actual to an access formal, passing the Object_Access_Level of the object containing the access discriminant. ........ r138389 | charlet | 2008-07-31 05:31:12 -0700 (Thu, 31 Jul 2008) | 2 lines * gnat.dg/missing_acc_check.adb: New test. ........ r138390 | charlet | 2008-07-31 05:37:04 -0700 (Thu, 31 Jul 2008) | 6 lines 2008-07-31 Bob Duff <duff@adacore.com> * sinput.adb (Skip_Line_Terminators): Fix handling of LF/CR -- it was recognized as two end-of-lines, but it should be just one. ........ r138391 | charlet | 2008-07-31 05:37:14 -0700 (Thu, 31 Jul 2008) | 4 lines 2008-07-31 Thomas Quinot <quinot@adacore.com> * exp_ch9.adb: Minor reformatting ........ r138392 | charlet | 2008-07-31 05:37:24 -0700 (Thu, 31 Jul 2008) | 5 lines 2008-07-31 Thomas Quinot <quinot@adacore.com> * tbuild.ads: Fix several occurrences of incorrectly referring to Name_Find as Find_Name. ........ r138393 | charlet | 2008-07-31 05:37:33 -0700 (Thu, 31 Jul 2008) | 7 lines 2008-07-31 Ed Schonberg <schonberg@adacore.com> * exp_aggr.adb (Aggr_Size_OK): If the aggregate has a single component and the context is an object declaration with non-static bounds, treat the aggregate as non-static. ........ r138394 | charlet | 2008-07-31 05:37:42 -0700 (Thu, 31 Jul 2008) | 11 lines 2008-07-31 Vincent Celier <celier@adacore.com> * prj-part.adb, prj-part.ads, prj.adb, prj.ads, prj-env.adb: Move back spec of Parse_Single_Project to body, as it is not called outside of package Prj.Part. (Project_Data): Remove components Linker_Name, Linker_Path and Minimum_Linker_Options as they are no longer set. Remove function There_Are_Ada_Sources from package Prj and move code in the only place it was used, in Prj.Env.Set_Ada_Paths. ........ r138395 | charlet | 2008-07-31 05:40:15 -0700 (Thu, 31 Jul 2008) | 2 lines Resync. ........ r138396 | charlet | 2008-07-31 05:41:23 -0700 (Thu, 31 Jul 2008) | 2 lines Resync. ........ r138397 | hjl | 2008-07-31 05:43:34 -0700 (Thu, 31 Jul 2008) | 5 lines 2008-07-31 H.J. Lu <hongjiu.lu@intel.com> * gcc.dg/torture/stackalign/pr16660-1.c: Include "check.h". (f): Align to 64 byte. Use check instead of asm statement. ........ r138398 | charlet | 2008-07-31 05:46:11 -0700 (Thu, 31 Jul 2008) | 6 lines 2008-07-31 Vincent Celier <celier@adacore.com> * makeutl.adb (Executable_Prefix_Path): If Locate_Exec_On_Path fails, return the empty string, instead of raising Constraint_Error. ........ r138399 | charlet | 2008-07-31 05:46:23 -0700 (Thu, 31 Jul 2008) | 22 lines 2008-07-31 Gary Dismukes <dismukes@adacore.com> * checks.ads (Apply_Accessibility_Check): Add parameter Insert_Node. * checks.adb (Apply_Accessibility_Check): Insert the check on Insert_Node. * exp_attr.adb: (Expand_N_Attribute_Refernce, Attribute_Access): Pass attribute node to new parameter Insert_Node on call to Apply_Accessibility_Check. Necessary to distinguish the insertion node because the dereferenced formal may come from a rename, but the check must be inserted in front of the attribute. * exp_ch4.adb: (Expand_N_Allocator): Pass actual for new Insert_Node parameter on call to Apply_Accessibility_Check. (Expand_N_Type_Conversion): Pass actual for new Insert_Node parameter on call to Apply_Accessibility_Check. Minor reformatting ........ r138400 | charlet | 2008-07-31 05:46:35 -0700 (Thu, 31 Jul 2008) | 17 lines 2008-07-31 Javier Miranda <miranda@adacore.com> * sem_type.adb (Has_Compatible_Type): Complete support for synchronized types when the candidate type is a synchronized type. * sem_res.adb (Resolve_Actuals): Reorganize code handling synchronized types, and complete management of synchronized types adding missing code to handle formal that is a synchronized type. * sem_ch4.adb (Try_Primitive_Operation): Avoid testing attributes that are not available and cause the compiler to blowup. Found compiling test with switch -gnatc * sem_ch6.adb (Check_Synchronized_Overriding): Remove local subprogram Has_Correct_Formal_Mode plus code cleanup. ........ r138401 | charlet | 2008-07-31 05:47:08 -0700 (Thu, 31 Jul 2008) | 2 lines Resync. ........ r138402 | charlet | 2008-07-31 05:49:43 -0700 (Thu, 31 Jul 2008) | 2 lines * gnat.dg/specs/sync_iface_test.ads: New test. ........ r138404 | charlet | 2008-07-31 06:25:48 -0700 (Thu, 31 Jul 2008) | 7 lines 2008-07-31 Javier Miranda <miranda@adacore.com> * sem_ch4.adb (Valid_First_Argument_Of): Complete its functionality to handle synchronized types. Required to handle well the object.operation notation applied to synchronized types. ........ r138405 | charlet | 2008-07-31 06:26:20 -0700 (Thu, 31 Jul 2008) | 10 lines 2008-07-31 Quentin Ochem <ochem@adacore.com> * s-stausa.ad? (Fill_Stack): Stack_Used_When_Filling is now stored anymore - just used internally. Added handling of very small tasks - when the theoretical size is already full at the point of the call. (Report_Result): Fixed result computation, Stack_Used_When_Filling does not need to be added to the result. ........ r138406 | charlet | 2008-07-31 06:26:40 -0700 (Thu, 31 Jul 2008) | 6 lines 2008-07-31 Hristian Kirtchev <kirtchev@adacore.com> * sem_ch6.adb (Disambiguate_Spec): Continue the disambiguation if the corresponding spec is a primitive wrapper. Update comment. ........ r138407 | charlet | 2008-07-31 06:27:47 -0700 (Thu, 31 Jul 2008) | 37 lines 2008-07-31 Hristian Kirtchev <kirtchev@adacore.com> * bindgen.adb Comment reformatting. Update the list of run-time globals. (Gen_Adainit_Ada): Add the declaration, import and value set for configuration flag Canonical_Streams. (Gen_Adainit_C): Add the declaration and initial value of external symbol __gl_canonical_streams. * init.c: Update the list of global values computed by the binder. * opt.ads: Add flag Canonical_Streams. * par-prag.adb (Prag): Include Pragma_Canonical_Streams to the list of semantically handled pragmas. * sem_prag.adb: Add an entry into enumeration type Sig_Flags. (Analyze_Pragma): Add case for pragma Canonical_Streams. * snames.adb: Add character value for name Canonical_Streams. * snames.ads: Add Name_Canonical_Streams to the list of configuration pragmas. Add Pragma_Canonical_Streams to enumeration type Pragma_Id. * snames.h: Add a definition for Pragma_Canonical_Streams. * s-ststop.adb: Add a flag and import to seize the value of external symbol __gl_canonical_streams. Update comment and initial value of constant Use_Block_IO. * gnat_rm.texi: Add section of pragma Canonical_Streams. * gnat_ugn.texi: Add pragma Canonical_Streams to the list of configuration pragmas. ........ r138408 | charlet | 2008-07-31 06:31:37 -0700 (Thu, 31 Jul 2008) | 7 lines 2008-07-31 Ed Schonberg <schonberg@adacore.com> * sem_ch10.adb (Build_Unit_Name): If the unit name in a with_clause has the form A.B.C and B is a unit renaming, analyze its compilation unit and add a with_clause on A.b to the context. ........ r138409 | charlet | 2008-07-31 06:42:37 -0700 (Thu, 31 Jul 2008) | 2 lines Resync. ........ r138410 | charlet | 2008-07-31 06:45:32 -0700 (Thu, 31 Jul 2008) | 2 lines * gnat.dg/sync_iface_test.ad[s,b]: New test. ........ r138411 | charlet | 2008-07-31 06:53:45 -0700 (Thu, 31 Jul 2008) | 6 lines 2008-07-31 Hristian Kirtchev <kirtchev@adacore.com> * exp_disp.adb (Prim_Op_Kind): Retrieve the full view when a private tagged type is completed by a concurrent type. ........ r138412 | charlet | 2008-07-31 06:53:55 -0700 (Thu, 31 Jul 2008) | 9 lines 2008-07-31 Gary Dismukes <dismukes@adacore.com> * sem_aggr.adb: (Resolve_Record_Aggregate): Bypass error that a type without components must have a "null record" aggregate when compiling for Ada 2005, since it's legal to give an aggregate of form (others => <>) for such a type. ........ r138413 | charlet | 2008-07-31 06:55:12 -0700 (Thu, 31 Jul 2008) | 2 lines * gnat.dg/specs/null_aggr_bug.ads: New test. ........ r138414 | charlet | 2008-07-31 06:58:21 -0700 (Thu, 31 Jul 2008) | 2 lines Resync. ........ r138415 | rguenth | 2008-07-31 07:12:24 -0700 (Thu, 31 Jul 2008) | 8 lines 2008-07-31 Richard Guenther <rguenther@suse.de> PR tree-optimization/36978 * tree-ssa-loop-unswitch.c (tree_may_unswitch_on): Do not fold the generated condition. * gcc.dg/torture/pr36978.c: New testcase. ........ r138416 | hjl | 2008-07-31 07:33:43 -0700 (Thu, 31 Jul 2008) | 7 lines 2008-07-31 H.J. Lu <hongjiu.lu@intel.com> PR debug/36976 * dwarf2out.c (dwarf2out_args_size_adjust): New. (dwarf2out_stack_adjust): Use it. (dwarf2out_frame_debug_expr): Likewise. ........ r138417 | charlet | 2008-07-31 07:40:48 -0700 (Thu, 31 Jul 2008) | 5 lines 2008-07-31 Pascal Obry <obry@adacore.com> * prj-nmsc.adb: Keep Object and Exec directory casing. ........ r138418 | charlet | 2008-07-31 07:41:01 -0700 (Thu, 31 Jul 2008) | 12 lines 2008-07-31 Jose Ruiz <ruiz@adacore.com> * s-parame-vxworks.adb Document that this body is used for RTX in RTSS (kernel) mode. * gcc-interface/Makefile.in (LIBGNAT_TARGET_PAIRS for the rtx_rtss run time): Use the s-parame-vxworks.adb body in order to have reasonable stack sizes in RTX RTSS kernel mode. Virtual memory is not used in that case, so we cannot ask for too big values. ........ r138419 | charlet | 2008-07-31 07:41:10 -0700 (Thu, 31 Jul 2008) | 4 lines 2008-07-31 Robert Dewar <dewar@adacore.com> * exp_aggr.adb: Minor reformatting ........ r138420 | charlet | 2008-07-31 07:41:22 -0700 (Thu, 31 Jul 2008) | 4 lines 2008-07-31 Robert Dewar <dewar@adacore.com> * makeutl.adb: Minor reformatting ........ r138421 | charlet | 2008-07-31 07:41:32 -0700 (Thu, 31 Jul 2008) | 4 lines 2008-07-31 Robert Dewar <dewar@adacore.com> * prj-env.adb: Minor reformatting ........ r138422 | charlet | 2008-07-31 07:46:14 -0700 (Thu, 31 Jul 2008) | 2 lines Resync. ........ r138424 | hjl | 2008-07-31 08:32:51 -0700 (Thu, 31 Jul 2008) | 6 lines 2008-07-31 H.J. Lu <hongjiu.lu@intel.com> PR debug/36980 * dwarf2out.c (dwarf2out_frame_debug_expr): Move rule 17 before rule 19. ........ r138425 | jason | 2008-07-31 10:38:08 -0700 (Thu, 31 Jul 2008) | 4 lines PR c++/36633 * init.c (build_new_1): Don't convert pointer to the data type until we're actually going to treat it as that type. ........ r138426 | jakub | 2008-07-31 11:07:20 -0700 (Thu, 31 Jul 2008) | 6 lines PR c++/36405 * rtti.c (get_tinfo_decl_dynamic, get_typeid): Call complete_type_or_else even for UNKNOWN_TYPE to get diagnostics. * g++.dg/rtti/typeid8.C: New test. ........ r138427 | jakub | 2008-07-31 11:08:36 -0700 (Thu, 31 Jul 2008) | 11 lines PR rtl-optimization/36419 * dwarf2out.c (barrier_args_size): New variable. (compute_barrier_args_size, compute_barrier_args_size_1): New functions. (dwarf2out_stack_adjust): For BARRIERs call compute_barrier_args_size if not called yet in the current function, use barrier_args_size array to find the new args_size value. (dwarf2out_frame_debug): Free and clear barrier_args_size. * g++.dg/eh/async-unwind2.C: New test. ........ r138428 | paolo | 2008-07-31 11:43:08 -0700 (Thu, 31 Jul 2008) | 6 lines 2008-07-31 Paolo Carlini <paolo.carlini@oracle.com> * testsuite/lib/libstdc++.exp (libstdc++_init): Set v3-libgomp. (check_v3_target_parallel_mode): Robustify, just follow the structure of testsuite/Makefile.am. ........ r138429 | jakub | 2008-07-31 11:56:35 -0700 (Thu, 31 Jul 2008) | 6 lines * mkstemps.c (mkstemps): If open failed with errno other than EEXIST, return immediately. * make-temp-file.c: Include errno.h. (make_temp_file): If mkstemps failed, print an error message before aborting. ........ r138432 | jakub | 2008-07-31 12:12:14 -0700 (Thu, 31 Jul 2008) | 17 lines PR preprocessor/36649 * files.c (struct report_missing_guard_data): New type. (report_missing_guard): Put paths into an array instead of printing them right away. Return 1 rather than 0. (report_missing_guard_cmp): New function. (_cpp_report_missing_guards): Sort and print paths gathered by report_missing_guard callback. * gcc.dg/pch/cpp-3.hs: Add include guards. * gcc.dg/pch/cpp-3a.h: Likewise. * gcc.dg/pch/cpp-3b.h: Likewise. * gcc.dg/cpp/mi8.c: New test. * gcc.dg/cpp/mi8a.h: New file. * gcc.dg/cpp/mi8b.h: New file. * gcc.dg/cpp/mi8c.h: New file. * gcc.dg/cpp/mi8d.h: New file. ........ r138434 | paolo | 2008-07-31 12:37:21 -0700 (Thu, 31 Jul 2008) | 10 lines 2008-07-31 Chris Fairles <chris.fairles@gmail.com> * include/std/chrono (duration): Use explicitly defaulted ctor, cctor, dtor and assignment. Add diagnostics as per 20.8.3 paragraphs 2, 3 and 4 in WD. Other minor tweaks. * testsuite/20_util/duration/cons/1_neg.cc: Adjust line numbers. * testsuite/20_util/duration/requirements/typedefs_neg1.cc: New. * testsuite/20_util/duration/requirements/typedefs_neg2.cc: Likewise. * testsuite/20_util/duration/requirements/typedefs_neg3.cc: Likewise. ........ r138435 | jakub | 2008-07-31 13:37:21 -0700 (Thu, 31 Jul 2008) | 3 lines PR target/35100 * gcc.target/powerpc/longcall-1.c: New test. ........ r138436 | jakub | 2008-07-31 14:22:09 -0700 (Thu, 31 Jul 2008) | 2 lines * mkstemps.c (mkstemps): Keep looping even for EISDIR. ........ r138437 | kkojima | 2008-07-31 14:23:04 -0700 (Thu, 31 Jul 2008) | 4 lines * config/sh/sh.c (sh_canonical_va_list_type): Remove. (TARGET_CANONICAL_VA_LIST_TYPE): Remove. ........ r138438 | hjl | 2008-07-31 14:28:54 -0700 (Thu, 31 Jul 2008) | 11 lines 2008-07-31 H.J. Lu <hongjiu.lu@intel.com> PR debug/36977 * cfgexpand.c (expand_stack_alignment): Set stack_realign_tried. * dwarf2out.c (based_loc_descr): Check crtl->stack_realign_tried for stack alignment. * function.h (rtl_data): Add stack_realign_tried. Update comments. ........ r138439 | sje | 2008-07-31 14:42:16 -0700 (Thu, 31 Jul 2008) | 2 lines * expr.c (expand_assignment): Check for complete type. ........ r138440 | ebotcazou | 2008-07-31 15:04:03 -0700 (Thu, 31 Jul 2008) | 3 lines * gcc-interface/decl.c (gnat_to_gnu_entity): Fix formatting. * gcc-interface/utils.c (create_field_decl): Avoid superfluous work. ........ r138444 | gccadmin | 2008-07-31 17:16:31 -0700 (Thu, 31 Jul 2008) | 1 line Daily bump. ........ r138446 | hjl | 2008-07-31 17:31:46 -0700 (Thu, 31 Jul 2008) | 4 lines 2008-07-31 H.J. Lu <hongjiu.lu@intel.com> * config/i386/darwin.h (MAIN_STACK_BOUNDARY): Define to 128. ........ r138448 | nemet | 2008-07-31 18:18:16 -0700 (Thu, 31 Jul 2008) | 24 lines * config.gcc (mipsisa64*-*-linux*): New configuration. Set ISA to MIPS64r2 for mipsisa64r2*. * config/mips/mips.h (GENERATE_MIPS16E): Update comment. (ISA_MIPS64R2): New macro. (TARGET_CPU_CPP_BUILTINS, MULTILIB_ISA_DEFAULT): Handle it. (ISA_HAS_64BIT_REGS, ISA_HAS_MUL3, ISA_HAS_FP_CONDMOVE, ISA_HAS_8CC, ISA_HAS_FP4, ISA_HAS_PAIRED_SINGLE, ISA_HAS_MADD_MSUB, ISA_HAS_NMADD4_NMSUB4, ISA_HAS_CLZ_CLO, ISA_HAS_ROR, ISA_HAS_PREFETCH, ISA_HAS_PREFETCHX, ISA_HAS_SEB_SEH, ISA_HAS_EXT_INS, ISA_HAS_MXHC1, ISA_HAS_HILO_INTERLOCKS, ISA_HAS_SYNCI, MIN_FPRS_PER_FMT): Return true for ISA_MIPS64R2. (MIPS_ISA_LEVEL_SPEC, ASM_SPEC, LINK_SPEC): Handle -mips64r2. (TARGET_LOONGSON_2E, TARGET_LOONGSON_2F, TARGET_LOONGSON_2EF): Move up to keep list alphabetically sorted. (TUNE_20KC, TUNE_24K, TUNE_74K, TUNE_LOONGSON_2EF): Likewise. * config/mips/mips.c (mips_cpu_info_table): Add default MIPS64r2 processor. * doc/invoke.texi (MIPS Options): Add -mips64r2. (-march=@var{arch}): Add mips64r2. testsuite/ * gcc.target/mips/ext-1.c: New test. ........ r138450 | bstarynk | 2008-07-31 22:19:40 -0700 (Thu, 31 Jul 2008) | 9 lines 2008-08-01 Basile Starynkevitch <basile@starynkevitch> * gcc/tree-pass.h: Added comment about not dumping passes with name starting with star in struct opt_pass. * gcc/passes.c (register_dump_files_1): Don't do dump for a pass with name starting with star. * gcc/doc/passes.texi (Pass manager): Mention pass names and special meaning of star prefix to avoid dump. ........ r138455 | charlet | 2008-08-01 00:37:28 -0700 (Fri, 01 Aug 2008) | 5 lines 2008-08-01 Robert Dewar <dewar@adacore.com> * gnat_ugn.texi: Minor editing, remove uncomfortable use of semicolon ........ r138456 | charlet | 2008-08-01 00:37:40 -0700 (Fri, 01 Aug 2008) | 4 lines 2008-08-01 Robert Dewar <dewar@adacore.com> * s-ststop.adb: Add some ??? comments ........ r138457 | charlet | 2008-08-01 00:37:50 -0700 (Fri, 01 Aug 2008) | 4 lines 2008-08-01 Robert Dewar <dewar@adacore.com> * sem_ch10.adb: Minor reformatting ........ r138458 | charlet | 2008-08-01 00:37:59 -0700 (Fri, 01 Aug 2008) | 6 lines 2008-08-01 Robert Dewar <dewar@adacore.com> * snames.ads: Minor comment fixes, some pragmas were not properly categorized in the comments, documentation change only ........ r138459 | charlet | 2008-08-01 00:38:08 -0700 (Fri, 01 Aug 2008) | 4 lines 2008-08-01 Robert Dewar <dewar@adacore.com> * xref_lib.adb: Minor reformatting ........ r138460 | charlet | 2008-08-01 00:38:17 -0700 (Fri, 01 Aug 2008) | 5 lines 2008-08-01 Jose Ruiz <ruiz@adacore.com> * cstreams.c (__gnat_full_name): RTSS applications cannot ask for the current directory so only fully qualified names are allowed. ........ r138461 | charlet | 2008-08-01 00:38:26 -0700 (Fri, 01 Aug 2008) | 4 lines 2008-08-01 Robert Dewar <dewar@adacore.com> * sinput.adb: Minor reformatting ........ r138462 | charlet | 2008-08-01 00:38:36 -0700 (Fri, 01 Aug 2008) | 4 lines 2008-08-01 Robert Dewar <dewar@adacore.com> * gnatchop.adb: Minor reformatting ........ r138463 | charlet | 2008-08-01 00:38:45 -0700 (Fri, 01 Aug 2008) | 6 lines 2008-08-01 Ed Schonberg <schonberg@adacore.com> * exp_disp.adb (Expand_Interface_Conversion): If the target type is a tagged synchronized type, use corresponding record type. ........ r138464 | charlet | 2008-08-01 00:38:54 -0700 (Fri, 01 Aug 2008) | 8 lines 2008-08-01 Doug Rupp <rupp@adacore.com> * mlib-tgt-specific-vms-alpha.adb (Build_Dynamic_Library): Output a dummy transfer address for debugging. * mlib-tgt-specific-vms-ia64.adb (Build_Dynamic_Library): Likewise. ........ r138465 | charlet | 2008-08-01 00:39:03 -0700 (Fri, 01 Aug 2008) | 4 lines 2008-08-01 Robert Dewar <dewar@adacore.com> * sem_util.ads: Minor reformatting. ........ r138466 | charlet | 2008-08-01 00:39:11 -0700 (Fri, 01 Aug 2008) | 4 lines 2008-08-01 Robert Dewar <dewar@adacore.com> * opt.ads: Minor documentation fix ........ r138467 | charlet | 2008-08-01 00:39:22 -0700 (Fri, 01 Aug 2008) | 4 lines 2008-08-01 Doug Rupp <rupp@adacore.com> * vms_data.ads: vms_data.ads: New qualfier /MACHINE_CODE_LISTING ........ r138468 | charlet | 2008-08-01 00:39:30 -0700 (Fri, 01 Aug 2008) | 4 lines 2008-08-01 Robert Dewar <dewar@adacore.com> * scng.adb: Minor reformatting ........ r138469 | charlet | 2008-08-01 00:41:55 -0700 (Fri, 01 Aug 2008) | 2 lines Update comments. ........ r138470 | charlet | 2008-08-01 00:43:16 -0700 (Fri, 01 Aug 2008) | 2 lines Resync. ........ r138472 | charlet | 2008-08-01 00:56:07 -0700 (Fri, 01 Aug 2008) | 4 lines 2008-08-01 Robert Dewar <dewar@adacore.com> * scng.adb (Error_Illegal_Wide_Character): Bump scan pointer ........ r138473 | charlet | 2008-08-01 00:56:20 -0700 (Fri, 01 Aug 2008) | 47 lines 2008-08-01 Doug Rupp <rupp@adacore.com> * gnat_rm.texi: Document new mechanism Short_Descriptor. * types.ads (Mechanism_Type): Modify range for new Short_Descriptor mechanism values. * sem_prag.adb (Set_Mechanism_Value): Enhance for Short_Descriptor mechanism and Short_Descriptor mechanism values. * snames.adb (preset_names): Add short_descriptor entry. * snames.ads: Add Name_Short_Descriptor. * types.h: Add new By_Short_Descriptor mechanism values. * sem_mech.adb (Set_Mechanism_Value): Enhance for Short_Descriptor mechanism and Short_Descriptor mechanism values. * sem_mech.ads (Mechanism_Type): Add new By_Short_Descriptor mechanism values. (Descriptor_Codes): Modify range for new mechanism values. * treepr.adb (Print_Entity_Enfo): Handle new By_Short_Descriptor mechanism values. * gcc-interface/decl.c (gnat_to_gnu_entity): Handle By_Short_Descriptor. (gnat_to_gnu_param): Handle By_Short_Descriptor. * gcc-interface/gigi.h (build_vms_descriptor64): Remove prototype. (build_vms_descriptor32): New prototype. (fill_vms_descriptor): Remove unneeded gnat_actual parameter. * gcc-interface/trans.c (call_to_gnu): Removed unneeded gnat_actual argument in call fill_vms_descriptor. * gcc-interface/utils.c (build_vms_descriptor32): Renamed from build_vms_descriptor and enhanced to hande Short_Descriptor mechanism. (build_vms_descriptor): Renamed from build_vms_descriptor64. (convert_vms_descriptor32): New function. (convert_vms_descriptor64): New function. (convert_vms_descriptor): Rewrite to handle both 32bit and 64bit descriptors. * gcc-interface/utils2.c (fill_vms_descriptor): Revert previous changes, no longer needed. ........ r138474 | charlet | 2008-08-01 00:56:32 -0700 (Fri, 01 Aug 2008) | 6 lines 2008-08-01 Jose Ruiz <ruiz@adacore.com> * adaint.c (__gnat_tmp_name): RTSS applications do not support tempnam nor tmpnam, so we always use c:\WINDOWS\Temp\gnat-XXXXXX as temporary name. ........ r138475 | charlet | 2008-08-01 00:56:48 -0700 (Fri, 01 Aug 2008) | 2 lines Resync. ........ r138479 | bonzini | 2008-08-01 01:18:13 -0700 (Fri, 01 Aug 2008) | 36 lines gcc: 2008-08-01 Paolo Bonzini <bonzini@gnu.org> * configure.ac: Do not generate libada-mk. Do not subst host_cc_for_libada. * libada-mk.in: Remove. * Makefile.in: Pass TARGET_LIBGCC2_CFLAGS to libgcc.mvars. * configure: Regenerate. libada: 2008-08-01 Paolo Bonzini <bonzini@gnu.org> * configure.ac (warn_cflags): Substitute. * configure: Regenerate. * Makefile.in (libdir, WARN_CFLAGS): Substitute. (GCC_WARN_CFLAGS): Remove NOCOMMON_FLAG. (ADA_CFLAGS, T_ADA_CFLAGS, X_ADA_CFLAGS, ALL_ADA_CFLAGS): Remove, they were unused. (libada-mk): Do not include. Include libgcc.mvars instead. (tmake_file): Remove, do not include. (FLAGS_TO_PASS): Pass dummy values for exeext and CC. * configure: Regenerate. gnattools: 2008-08-01 Paolo Bonzini <bonzini@gnu.org> * configure.ac (warn_cflags): Substitute. * configure: Regenerate. * Makefile.in (libdir, exeext, WARN_CFLAGS): Substitute. (GCC_WARN_CFLAGS): Remove NOCOMMON_FLAG. (ADA_INCLUDE_DIR, ADA_RTL_OBJ_DIR): Remove as they were unused. (libsubdir): Remove. (libada-mk): Do not include. Include libgcc.mvars instead. (xmake_file): Remove, do not include. ........ r138480 | charlet | 2008-08-01 01:19:04 -0700 (Fri, 01 Aug 2008) | 14 lines 2008-08-01 Ed Schonberg <schonberg@adacore.com> * sem_ch12.ads (Need_Subprogram_Instance_Body): new function, to create a pending instantiation for the body of a subprogram that is to be inlined. * sem_ch12.adb: (Analyze_Subprogram_Instantiation): use Need_Subprogram_Instance_Body. * sem_prag.adb (Make_Inline): If the pragma applies to an instance, create a pending instance for its body, so that calls to the subprogram can be inlined by the back-end. ........ r138481 | charlet | 2008-08-01 01:19:29 -0700 (Fri, 01 Aug 2008) | 6 lines 2008-08-01 Jose Ruiz <ruiz@adacore.com> * gnat_ugn.texi: Document the RTX run times (rts-rtx-rtss and rts-rtx-w32). ........ r138482 | charlet | 2008-08-01 01:34:50 -0700 (Fri, 01 Aug 2008) | 6 lines 2008-08-01 Jose Ruiz <ruiz@adacore.com> * adaint.c (__gnat_tmp_name): Refine the generation of temporary names for RTX. Adding a suffix that is incremented at each iteration. ........ r138483 | charlet | 2008-08-01 01:35:04 -0700 (Fri, 01 Aug 2008) | 6 lines 2008-08-01 Robert Dewar <dewar@adacore.com> * sem_ch6.adb (Analyze_Subprogram_Body): Remove special casing of Raise_Exception ........ r138484 | charlet | 2008-08-01 01:35:21 -0700 (Fri, 01 Aug 2008) | 7 lines 2008-08-01 Jerome Lambourg <lambourg@adacore.com> * s-os_lib.adb (Normalize_Pathname): Take care of double-quotes in paths, which are authorized by Windows but can lead to errors when used elsewhere. ........ r138485 | charlet | 2008-08-01 02:02:34 -0700 (Fri, 01 Aug 2008) | 6 lines 2008-08-01 Robert Dewar <dewar@adacore.com> * sem_ch6.adb (Process_PPCs): Don't copy spec PPC to body if not generating code ........ r138486 | charlet | 2008-08-01 02:02:44 -0700 (Fri, 01 Aug 2008) | 8 lines 2008-08-01 Ed Schonberg <schonberg@adacore.com> * checks.adb (Apply_Float_Conversion_Check): If the expression to be converted is a real literal and the target type has static bounds, perform the conversion exactly to prevent floating-point anomalies on some targets. ........ r138487 | charlet | 2008-08-01 02:02:58 -0700 (Fri, 01 Aug 2008) | 20 lines 2008-08-01 Vincent Celier <celier@adacore.com> * prj-attr.adb: New attribute Compiler'Name_Syntax (<lang>) * prj-nmsc.adb (Process_Compiler): Recognize attribute Name_Syntax * prj.adb (Object_Exist_For): Use Object_Generated, not Objects_Generated that is removed and was never modified anyway. * prj.ads: (Path_Syntax_Kind): New enumeration type (Language_Config): New component Path_Syntax, defaulted to Host. Components PIC_Option and Objects_Generated removed, as they are not used. * snames.adb: New standard name Path_Syntax * snames.ads: New standard name Path_Syntax ........ r138488 | charlet | 2008-08-01 02:03:11 -0700 (Fri, 01 Aug 2008) | 11 lines 2008-08-01 Vincent Celier <celier@adacore.com> * mlib-utl.adb: (Adalib_Path): New variable to store the path of the adalib directory when procedure Specify_Adalib_Dir is called. (Lib_Directory): If Adalib_Path is not null, return its value (Specify_Adalib_Dir): New procedure * mlib-utl.ads (Specify_Adalib_Dir): New procedure ........ r138489 | charlet | 2008-08-01 02:03:23 -0700 (Fri, 01 Aug 2008) | 8 lines 2008-08-01 Ed Schonberg <schonberg@adacore.com> * sem_prag.adb: (Check_Precondition_Postcondition): If not generating code, analyze the expression in a postcondition that appears in a subprogram body, so that it is properly decorated for ASIS use. ........ r138490 | charlet | 2008-08-01 02:03:35 -0700 (Fri, 01 Aug 2008) | 10 lines 2008-08-01 Gary Dismukes <dismukes@adacore.com> * exp_ch6.adb (Expand_Call): Remove ugly special-case code that resets Orig_Prev to Prev in the case where the actual is N_Function_Call or N_Identifier. This was interfering with other cases that are rewritten as N_Identifier, such as allocators, resulting in passing of the wrong accessibility level, and based on testing this code is apparently no longer needed at all. ........ r138491 | charlet | 2008-08-01 02:04:06 -0700 (Fri, 01 Aug 2008) | 7 lines 2008-08-01 Ed Schonberg <schonberg@adacore.com> * sem_ch4.adb (Analyze_One_Call): Handle complex overloading of a procedure call whose prefix is a parameterless function call that returns an access_to_procedure. ........ r138492 | charlet | 2008-08-01 02:10:16 -0700 (Fri, 01 Aug 2008) | 7 lines 2008-08-01 Eric Botcazou <ebotcazou@adacore.com> * gcc-interface/utils.c (convert_vms_descriptor): Add gnu_expr_alt_type parameter. Convert the expression to it instead of changing its type in place. (build_function_stub): Adjust call to above function. ........ r138493 | charlet | 2008-08-01 02:29:30 -0700 (Fri, 01 Aug 2008) | 8 lines 2008-08-01 Gary Dismukes <dismukes@adacore.com> * exp_ch6.adb (Expand_Call): Adjustment to previous fix for passing correct accessibility levels. In the "when others" case, retrieve the access level of the Etype of Prev rather than Prev_Orig, because the original exression has not always been analyzed. ........ r138494 | charlet | 2008-08-01 02:29:39 -0700 (Fri, 01 Aug 2008) | 4 lines 2008-08-01 Robert Dewar <dewar@adacore.com> * prj-nmsc.adb: Minor reformatting ........ r138495 | charlet | 2008-08-01 02:29:48 -0700 (Fri, 01 Aug 2008) | 5 lines 2008-08-01 Robert Dewar <dewar@adacore.com> * sem_ch4.adb: Minor reformatting Minor code reorganization ........ r138496 | charlet | 2008-08-01 02:30:05 -0700 (Fri, 01 Aug 2008) | 4 lines 2008-08-01 Robert Dewar <dewar@adacore.com> * prj.ads: Minor reformatting ........ r138497 | charlet | 2008-08-01 02:30:14 -0700 (Fri, 01 Aug 2008) | 4 lines 2008-08-01 Robert Dewar <dewar@adacore.com> * s-os_lib.adb: Minor reformatting ........ r138498 | charlet | 2008-08-01 02:30:26 -0700 (Fri, 01 Aug 2008) | 5 lines 2008-08-01 Robert Dewar <dewar@adacore.com> * par-prag.adb (Prag, case Wide_Character_Encoding): Deal with upper half encodings ........ r138499 | charlet | 2008-08-01 02:30:37 -0700 (Fri, 01 Aug 2008) | 4 lines 2008-08-01 Robert Dewar <dewar@adacore.com> * scans.ads: Minor reformatting. ........ r138500 | charlet | 2008-08-01 02:30:53 -0700 (Fri, 01 Aug 2008) | 5 lines 2008-08-01 Robert Dewar <dewar@adacore.com> * sem_prag.adb (Analyze_Pragma): Put entries in alpha order (Analyze_Pragma): Make sure all GNAT pragmas call GNAT_Pragma ........ r138501 | charlet | 2008-08-01 02:31:06 -0700 (Fri, 01 Aug 2008) | 5 lines 2008-08-01 Robert Dewar <dewar@adacore.com> * sem_res.adb: (Resolve_Call): Check violation of No_Specific_Termination_Handlers ........ r138502 | charlet | 2008-08-01 02:31:18 -0700 (Fri, 01 Aug 2008) | 4 lines 2008-08-01 Thomas Quinot <quinot@adacore.com> * sem_ch12.adb: Minor comment reformatting ........ r138503 | charlet | 2008-08-01 02:31:42 -0700 (Fri, 01 Aug 2008) | 5 lines 2008-08-01 Robert Dewar <dewar@adacore.com> * par-ch3.adb (P_Type_Declaration): Properly handle missing type keyword ........ r138506 | charlet | 2008-08-01 03:33:21 -0700 (Fri, 01 Aug 2008) | 6 lines 2008-08-01 Robert Dewar <dewar@adacore.com> * sem_prag.adb (Check_Form_Of_Interface_Name): Refine and improve warnings ........ r138507 | charlet | 2008-08-01 03:33:29 -0700 (Fri, 01 Aug 2008) | 5 lines 2008-08-01 Robert Dewar <dewar@adacore.com> * lib-xref.adb: Add error defense. ........ r138508 | charlet | 2008-08-01 03:33:45 -0700 (Fri, 01 Aug 2008) | 4 lines 2008-08-01 Bob Duff <duff@adacore.com> * ioexcept.ads, sequenio.ads, directio.ads: Correct comment. ........ r138509 | hainque | 2008-08-01 03:36:01 -0700 (Fri, 01 Aug 2008) | 10 lines ada/ * decl.c (gnat_to_gnu_entity) <case E_Function>: Do not turn Ada Pure into GCC const, now implicitely implying nothrow as well. testsuite/ * gnat.dg/raise_from_pure.ad[bs], * gnat.dg/wrap_raise_from_pure.ad[bs]: Support for ... * gnat.dg/test_raise_from_pure.adb: New test. ........ r138510 | charlet | 2008-08-01 03:44:17 -0700 (Fri, 01 Aug 2008) | 6 lines 2008-08-01 Robert Dewar <dewar@adacore.com> * par-ch3.adb (P_Defining_Identifier): Avoid repeated attempt to convert plain identifier into defining identifier. ........ r138511 | charlet | 2008-08-01 03:47:27 -0700 (Fri, 01 Aug 2008) | 21 lines 2008-08-01 Hristian Kirtchev <kirtchev@adacore.com> * rtsfind.ads: Add block IO versions of stream routines for Strings. * bindgen.adb, gnat_rm.texi, gnat_ugn.texi, opt.ads, sem_prag.adb, snames.adb, snames.ads, snames.h, par-prag.adb: Undo Canonical_Streams related changes. * s-rident.ads: Add new restriction No_Stream_Optimizations. * s-ststop.ads, s-ststop.adb: Comment reformatting. Define enumeration type to designate different IO mechanisms. Enchance generic package Stream_Ops_Internal to include an implementation of Input and Output. * exp_attr.adb (Find_Stream_Subprogram): If restriction No_Stream_Optimization is active, choose the default byte IO implementations of stream attributes for Strings. Otherwise use the corresponding block IO version. ........ r138512 | rguenth | 2008-08-01 04:18:36 -0700 (Fri, 01 Aug 2008) | 8 lines 2008-08-01 Richard Guenther <rguenther@suse.de> PR tree-optimization/36988 * tree-ssa-ccp.c (ccp_fold): Conversions of constants only do not matter if that doesn't change volatile qualification. * gcc.c-torture/compile/pr36988.c: New testcase. ........ r138513 | ebotcazou | 2008-08-01 05:39:57 -0700 (Fri, 01 Aug 2008) | 16 lines 2008-08-01  Eric Botcazou  <ebotcazou@adacore.com> * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Constant>: Remove dead code.  Do not get full definition of deferred constants with address clause for a use.  Do not ignore deferred constant definitions with address clause.  Ignore constant definitions already marked with the error node. <object>: Remove obsolete comment.  For a deferred constant with address clause, get the initializer from the full view. * gcc-interface/trans.c (gnat_to_gnu) <N_Attribute_Definition_Clause>: Rework and remove obsolete comment. <N_Object_Declaration>: For a deferred constant with address clause, mark the full view with the error node. *  gcc-interface/utils.c (convert_to_fat_pointer): Rework and fix formatting nits. ........ r138514 | ebotcazou | 2008-08-01 06:11:51 -0700 (Fri, 01 Aug 2008) | 2 lines Revert incorrect patch. ........ r138515 | rguenth | 2008-08-01 06:12:38 -0700 (Fri, 01 Aug 2008) | 7 lines 2008-08-01 Richard Guenther <rguenther@suse.de> PR middle-end/36997 * gimplify.c (gimplify_call_expr): Set error_mark_node on GS_ERROR. * gcc.dg/pr36997.c: New testcase. ........ r138516 | schwab | 2008-08-01 06:14:39 -0700 (Fri, 01 Aug 2008) | 2 lines Remove conflict marker. ........ r138517 | hjl | 2008-08-01 06:30:03 -0700 (Fri, 01 Aug 2008) | 11 lines 2008-08-01 H.J. Lu <hongjiu.lu@intel.com> * config/i386/i386.c (override_options): Replace ABI_STACK_BOUNDARY with MIN_STACK_BOUNDARY. (ix86_update_stack_boundary): Likewise. (ix86_expand_prologue): Assert MIN_STACK_BOUNDARY instead of STACK_BOUNDARY. * config/i386/i386.h (ABI_STACK_BOUNDARY): Renamed to ... (MIN_STACK_BOUNDARY): This. ........ r138518 | ebotcazou | 2008-08-01 07:02:10 -0700 (Fri, 01 Aug 2008) | 8 lines * gcc-interface/ada-tree.h (DECL_PARM_ALT): Now DECL_PARM_ALT_TYPE. * gcc-interface/decl.c (gnat_to_gnu_param): Fix formatting, simplify and adjust for above renaming. * gcc-interface/utils.c (convert_vms_descriptor): Likewise. Add new gnu_expr_alt_type parameter. Convert the expression to it instead of changing its type in place. (build_function_stub): Adjust call to above function. ........ r138519 | paolo | 2008-08-01 07:06:38 -0700 (Fri, 01 Aug 2008) | 14 lines 2008-08-01 Paolo Bonzini <bonzini@gnu.org> Chris Fairles <chris.fairles@gmail.com> * acinclude.m4 ([GLIBCXX_CHECK_CLOCK_GETTIME]): Reinstate clock_gettime search, but only in libposix4, never link librt. * src/Makefile.am: Reinstate previous change to add GLIBCXX_LIBS. * configure: Regenerate. * configure.in: Likewise. * Makefile.in: Likewise. * src/Makefile.in: Likewise. * libsup++/Makefile.in: Likewise. * po/Makefile.in: Likewise. * doc/Makefile.in: Likewise. ........ r138520 | ebotcazou | 2008-08-01 07:10:10 -0700 (Fri, 01 Aug 2008) | 2 lines * gnat.dg/boolean_expr.ad[sb]: Rename to boolean_expr1.ad[sb]. ........ r138522 | rguenth | 2008-08-01 07:42:42 -0700 (Fri, 01 Aug 2008) | 9 lines 2008-08-01 Richard Guenther <rguenther@suse.de> * tree-ssa-pre.c (fini_pre): Take in_fre parameter. Free loop information only if we initialized it. (execute_pre): Call fini_pre with in_fre. * tree-ssa-loop-ivcanon (try_unroll_loop_completely): Dump if we do not unroll because we hit max-completely-peeled-insns. Use our estimation for consistency, do allow shrinking. ........ r138524 | hjl | 2008-08-01 09:05:50 -0700 (Fri, 01 Aug 2008) | 9 lines 2008-08-01 H.J. Lu <hongjiu.lu@intel.com> * cfgexpand.c (expand_stack_alignment): Assert that stack_realign_drap and drap_rtx must match. * function.c (instantiate_new_reg): If DRAP is used to realign stack, replace virtual_incoming_args_rtx with internal arg pointer. ........ r138525 | hjl | 2008-08-01 09:10:28 -0700 (Fri, 01 Aug 2008) | 2 lines Add missing ChangeLog entry for revision 138517. ........ r138530 | jakub | 2008-08-01 12:01:33 -0700 (Fri, 01 Aug 2008) | 5 lines 2008-08-01 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/36991 * gcc.dg/pr36991.c: New test. ........ r138537 | jakub | 2008-08-01 13:30:09 -0700 (Fri, 01 Aug 2008) | 6 lines * dwarf2out.c (compute_barrier_args_size): Set barrier_args_size for labels for which it hasn't been set yet. If it has been set, stop walking insns and continue with next worklist item. (dwarf2out_stack_adjust): Don't call compute_barrier_args_size if the only BARRIER is at the very end of a function. ........ r138541 | gccadmin | 2008-08-01 17:16:48 -0700 (Fri, 01 Aug 2008) | 1 line Daily bump. ........ r138544 | dougkwan | 2008-08-01 18:25:48 -0700 (Fri, 01 Aug 2008) | 44 lines 2008-08-01 Doug Kwan <dougkwan@google.com> * matrix-reorg.c: Re-enable all code. (struct malloc_call_data): Change CALL_STMT to gimple type. (collect_data_for_malloc_call): Tuplify. (struct access_site_info): Change STMT to gimple type. (struct matrix_info): Change MIN_INDIRECT_LEVEL_ESCAPE_STMT, and MALLOC_FOR_LEVEL to gimple and gimple pointer type. (struct free_info): Change STMT to gimple type. (struct matrix_access_phi_node): Change PHI to gimple type. (get_inner_of_cast_expr): Remove. (may_flatten_matrices_1): Tuplify. (may_flatten_matrices): Ditto. (mark_min_matrix_escape_level): Ditto. (ssa_accessed_in_tree): Refactor statement RHS related code into ... (ssa_accessed_in_call_rhs): New (ssa_accessed_in_assign_rhs): New (record_access_alloc_site_info): Tuplify. (add_allocation_site): Ditto. (analyze_matrix_allocation_site): Ditto. (analyze_transpose): Ditto. (get_index_from_offset): Ditto. (update_type_size): Ditto. (analyze_accesses_for_call_expr): Tuplify and renamed into ... (analyze_accesses_for_call_stmt): New. Also handle LHS of a call. (analyze_accesses_for_phi_node): Tuplify. (analyze_accesses_for_modify_stmt): Tuplify and renamed into ... (analyze_accesses_for_assign_stmt): Remove code for handling call LHS. (analyze_matrix_accesses): Tuplify. (check_var_data): New call-back type for check_var_notmodified_p. (check_var_notmodified_p): Tuplify and use call-back struct to return statement found. (can_calculate_expr_before_stmt): Factor out statement related code into ... (can_calculate_stmt_before_stmt): New. (check_allocation_function): Tuplify. (find_sites_in_func): Ditto. (record_all_accesses_in_func): Ditto. (transform_access_sites): Ditto. (transform_allocation_sites): Ditto. (matrix_reorg): Re-enable. (gate_matrix_reorg): Re-enable. ........ r138552 | ebotcazou | 2008-08-02 03:49:51 -0700 (Sat, 02 Aug 2008) | 3 lines * gcc-interface/utils2.c (build_binary_op) <PLUS_EXPR, MINUS_EXPR>: New case. Convert BOOLEAN_TYPE operation to the default integer type. ........ r138553 | rguenth | 2008-08-02 05:05:47 -0700 (Sat, 02 Aug 2008) | 33 lines 2008-08-02 Richard Guenther <rguenther@suse.de> PR target/35252 * config/i386/sse.md (SSEMODE4S, SSEMODE2D): New mode iterators. (ssedoublesizemode): New mode attribute. (sse_shufps): Call gen_sse_shufps_v4sf. (sse_shufps_1): Macroize. (sse2_shufpd): Call gen_Sse_shufpd_v2df. (sse2_shufpd_1): Macroize. (vec_extract_odd, vec_extract_even): New expanders. (vec_interleave_highv4sf, vec_interleave_lowv4sf, vec_interleave_highv2df, vec_interleave_lowv2df): Likewise. * i386.c (ix86_expand_vector_init_one_nonzero): Call gen_sse_shufps_v4sf instead of gen_sse_shufps_1. (ix86_expand_vector_set): Likewise. (ix86_expand_reduc_v4sf): Likewise. * lib/target-supports.exp (vect_extract_even_odd_wide) Add. (vect_strided_wide): Likewise. * gcc.dg/vect/fast-math-pr35982.c: Enable for vect_extract_even_odd_wide. * gcc.dg/vect/fast-math-vect-complex-3.c: Likewise. * gcc.dg/vect/vect-1.c: Likewise. * gcc.dg/vect/vect-107.c: Likewise. * gcc.dg/vect/vect-98.c: Likewise. * gcc.dg/vect/vect-strided-float.c: Likewise. * gcc.dg/vect/slp-11.c: Enable for vect_strided_wide. * gcc.dg/vect/slp-12a.c: Likewise. * gcc.dg/vect/slp-12b.c: Likewise. * gcc.dg/vect/slp-19.c: Likewise. * gcc.dg/vect/slp-23.c: Likewise. * gcc.dg/vect/slp-5.c: Likewise. ........ r138555 | kseitz | 2008-08-02 15:56:04 -0700 (Sat, 02 Aug 2008) | 4 lines * tcl.m4 (SC_PATH_TCLCONFIG): Add some simple logic to deal with cygwin. (SC_PATH_TKCONFIG): Likewise. ........ r138560 | gccadmin | 2008-08-02 17:16:39 -0700 (Sat, 02 Aug 2008) | 1 line Daily bump. ........ r138562 | amodra | 2008-08-02 20:37:55 -0700 (Sat, 02 Aug 2008) | 3 lines * mt-spu (all-ld): Update for ld Makefile changes. ........ r138564 | uros | 2008-08-02 23:13:04 -0700 (Sat, 02 Aug 2008) | 17 lines PR target/36992 * config/i386/sse.md (vec_concatv2di): Add Y2 constraint to alternative 0 of operand 1. (*vec_concatv2di_rex64_sse): Ditto. (*vec_concatv2di_rex64_sse4_1): Add x constraint to alternative 0 of operand 1. (*sse2_storeq_rex64): Penalize allocation of "r" registers. * config/i386/mmx.md (*mov<mode>_internal_rex64): Penalize allocation of "Y2" registers to avoid SSE <-> MMX conversions for DImode moves. (*movv2sf_internal_rex64): Ditto. testsuite/ChangeLog: PR target/36992 * gcc.target/i386/pr36992-1.c: New test. * gcc.target/i386/pr36992-2.c: Ditto. ........ r138565 | hubicka | 2008-08-03 05:04:49 -0700 (Sun, 03 Aug 2008) | 4 lines * optabs.c (expand_binop, expand_builtin_pow, expand_builtin_powi, expand_builtin_strcat): Upse optimize_insn_for_speed predicate. * expmed.c (expand_smod_pow2): Likewise. ........ r138566 | uros | 2008-08-03 11:45:17 -0700 (Sun, 03 Aug 2008) | 5 lines * config/i386/mmx.md (*mov<mode>_internal_rex64): Use Yi instead of x to avoid inter-unit moves for !TARGET_INTER_UNIT_MOVES. (*movv2sf_internal_rex64): Ditto. ........ r138568 | jvdelisle | 2008-08-03 15:02:22 -0700 (Sun, 03 Aug 2008) | 4 lines 2008-08-03 Jerry DeLisle <jvdelisle@gcc.gnu.org> * gfortran.dg/fmt_t_7.f: Replace CR-LF with LF. ........ r138573 | gccadmin | 2008-08-03 17:16:36 -0700 (Sun, 03 Aug 2008) | 1 line Daily bump. ........ r138575 | charlet | 2008-08-04 01:37:31 -0700 (Mon, 04 Aug 2008) | 9 lines 2008-08-04 Robert Dewar <dewar@adacore.com> * restrict.adb: Improved messages for restriction warnings * restrict.ads: Improved messages for restriction messages * s-rident.ads (Profile_Name): Add No_Profile ........ r138576 | charlet | 2008-08-04 01:37:40 -0700 (Mon, 04 Aug 2008) | 5 lines 2008-08-04 Robert Dewar <dewar@adacore.com> * system-darwin-x86.ads: Correct bad definition of Max_Nonbinary_Modulus ........ r138577 | charlet | 2008-08-04 01:37:47 -0700 (Mon, 04 Aug 2008) | 5 lines 2008-08-04 Robert Dewar <dewar@adacore.com> * freeze.adb (Freeze_Entity): Check for size clause for boolean warning ........ r138578 | charlet | 2008-08-04 01:37:57 -0700 (Mon, 04 Aug 2008) | 7 lines 2008-08-04 Vincent Celier <celier@adacore.com> * prj-proc.adb: (Copy_Package_Declarations): When inheriting package Naming from a project being extended, do not inherit source exception names. ........ r138579 | charlet | 2008-08-04 01:38:06 -0700 (Mon, 04 Aug 2008) | 7 lines 2008-08-04 Ed Schonberg <schonberg@adacore.com> * sem_prag.adb (Check_Precondition_Postcondition): When scanning the list of declaration to find previous subprogram, do not go to the original node of a generic unit. ........ r138580 | charlet | 2008-08-04 01:40:22 -0700 (Mon, 04 Aug 2008) | 2 lines Resync. ........ r138581 | charlet | 2008-08-04 02:05:01 -0700 (Mon, 04 Aug 2008) | 4 lines 2008-08-04 Robert Dewar <dewar@adacore.com> * par-ch10.adb: Minor reformatting ........ r138582 | charlet | 2008-08-04 02:05:29 -0700 (Mon, 04 Aug 2008) | 4 lines 2008-08-04 Pascal Obry <obry@adacore.com> * i-cobol.adb: Minor reformatting. ........ r138583 | charlet | 2008-08-04 02:05:40 -0700 (Mon, 04 Aug 2008) | 7 lines 2008-08-04 Ed Schonberg <schonberg@adacore.com> * sem_ch3.adb (Access_Definition): Create an itype reference for an anonymous access return type of a regular function that is not a compilation unit. ........ r138584 | charlet | 2008-08-04 02:05:56 -0700 (Mon, 04 Aug 2008) | 9 lines 2008-08-04 Vincent Celier <celier@adacore.com> * prj-attr.adb: New Builder attribute Global_Compilation_Switches * snames.adb: New standard name Global_Compilation_Switches * snames.ads: New standard name Global_Compilation_Switches ........ r138585 | charlet | 2008-08-04 02:06:16 -0700 (Mon, 04 Aug 2008) | 4 lines 2008-08-04 Vincent Celier <celier@adacore.com> * make.adb: Correct spelling error in comment ........ r138586 | charlet | 2008-08-04 02:06:36 -0700 (Mon, 04 Aug 2008) | 6 lines 2008-08-04 Arnaud Charlet <charlet@adacore.com> * sem_prag.adb (Check_Form_Of_Interface_Name): Fix handling for CLI target. ........ r138587 | charlet | 2008-08-04 02:06:45 -0700 (Mon, 04 Aug 2008) | 4 lines 2008-08-04 Thomas Quinot <quinot@adacore.com> * sem_ch10.adb: Minor comment fix. ........ r138588 | charlet | 2008-08-04 02:07:31 -0700 (Mon, 04 Aug 2008) | 7 lines 2008-08-04 Doug Rupp <rupp@adacore.com> * gcc-interface/utils2.c: (fill_vms_descriptor): Raise CE if attempt made to pass 64bit pointer in 32bit descriptor. ........ r138589 | charlet | 2008-08-04 02:16:54 -0700 (Mon, 04 Aug 2008) | 6 lines 2008-08-04 Doug Rupp <rupp@adacore.com> * utils2.c (fill_vms_descriptor): Use long_integer for comparison. Call add_stmt_with_node to set locus. ........ r138590 | charlet | 2008-08-04 02:17:44 -0700 (Mon, 04 Aug 2008) | 31 lines 2008-08-04 Vincent Celier <celier@adacore.com> * gprep.adb (Process_One_File): Call Prep.Preprocess with a Boolean variable, but don't check the resulting value as it has no impact on the processing. * opt.ads: (Generate_Processed_File): New Boolean flag, set to True in the compiler when switch -gnateG is used. * prep.adb: (Preprocess): new Boolean out parameter Source_Modified. Set it to True when the source is modified by the preprocessor and there is no preprocessing errors. * prep.ads (Preprocess): new Boolean out parameter Source_Modified * sinput-l.adb: (Load_File): Output the result of preprocessing if the source text was modified. * switch-c.adb (Scan_Front_End_Switches): Recognize switch -gnateG * switch-m.adb (Normalize_Compiler_Switches): Normalize switch -gnateG * ug_words: Add VMS equivalent for -gnateG * vms_data.ads: Add VMS option /GENERATE_PROCESSED_SOURCE, equivalent to switch -gnateG ........ r138591 | charlet | 2008-08-04 02:36:10 -0700 (Mon, 04 Aug 2008) | 19 lines 2008-08-04 Ed Schonberg <schonberg@adacore.com> * sem_ch3.adb (Access_Definition): A formal object declaration is a legal context for an anonymous access to subprogram. * sem_ch4.adb (Analyze_One_Call): If the call can be interpreted as an indirect call, report success to the caller to include possible interpretation. * sem_ch6.adb (Check_Return_Type_Indication): Apply proper conformance check when the type of the extended return is an anonymous access_to_subprogram type. * sem_res.adb: (Resolve_Call): Insert a dereference if the type of the subprogram is an access_to_subprogram and the context requires its return type, and a dereference has not been introduced previously. ........ r138592 | charlet | 2008-08-04 02:36:26 -0700 (Mon, 04 Aug 2008) | 6 lines 2008-08-04 Arnaud Charlet <charlet@adacore.com> * usage.adb (Usage): Minor rewording of -gnatwz switch, to improve gnatcheck support in GPS. ........ r138593 | charlet | 2008-08-04 02:36:46 -0700 (Mon, 04 Aug 2008) | 6 lines 2008-08-04 Vincent Celier <celier@adacore.com> * mlib.adb (Create_Sym_Links): Create relative symbolic links when requested ........ r138594 | charlet | 2008-08-04 02:38:06 -0700 (Mon, 04 Aug 2008) | 8 lines 2008-08-04 Doug Rupp <rupp@adacore.com> * gigi.h (fill_vms_descriptor): Add third parameter gnat_actual * trans.c (call_to_gnu): Call fill_vms_descriptor with new parameter. * utils2.c (fill_vms_descriptor): Add third parameter for error sloc and use it. Calculate pointer range overflow using 64bit types. ........ r138595 | charlet | 2008-08-04 02:40:33 -0700 (Mon, 04 Aug 2008) | 2 lines Minor reformatting. ........ r138596 | charlet | 2008-08-04 02:49:33 -0700 (Mon, 04 Aug 2008) | 8 lines 2008-08-04 Jerome Lambourg <lambourg@adacore.com> * g-comlin.adb (Group_Switches): Preserve the switch order when grouping and allow switch grouping of switches with more than one character extension (e.g. gnatw.x). (Args_From_Expanded): Remove this now obsolete method. ........ r138597 | charlet | 2008-08-04 02:49:42 -0700 (Mon, 04 Aug 2008) | 7 lines 2008-08-04 Ed Schonberg <schonberg@adacore.com> * exp_ch4.adb (Get_Allocator_Final_List): Freeze anonymous type for chain at once, to ensure that type is properly decorated for back-end, when allocator appears within a loop. ........ r138598 | charlet | 2008-08-04 02:50:09 -0700 (Mon, 04 Aug 2008) | 15 lines 2008-08-04 Kevin Pouget <pouget@adacore.com> * snames.h, snames.adb, snames.ads: Add Attr_To_Any, Attr_From_Any and Attr_TypeCode defines. * exp_dist.ads, exp_dist.adb: Add Build_From_Any_Call, Build_To_Any_Call and Build_TypeCode_Call procedures. * exp_attr.adb, sem_attr.adb: Add corresponding cases. * rtsfind.ads: Add corresponding names. * tbuild.adb: Update prefix restrictions to allow '_' character. ........ r138599 | charlet | 2008-08-04 03:22:39 -0700 (Mon, 04 Aug 2008) | 4 lines 2008-08-04 Ed Schonberg <schonberg@adacore.com> * sem_ch12.adb: Add comments ........ r138600 | charlet | 2008-08-04 03:22:48 -0700 (Mon, 04 Aug 2008) | 7 lines 2008-08-04 Ed Schonberg <schonberg@adacore.com> * sem_ch4.adb (Analyze_Allocator): If the designated type is a non-null access type and the allocator is not initialized, warn rather than reporting an error. ........ r138601 | charlet | 2008-08-04 03:22:58 -0700 (Mon, 04 Aug 2008) | 4 lines 2008-08-04 Robert Dewar <dewar@adacore.com> * exp_ch4.adb: Minor reformatting ........ r138602 | charlet | 2008-08-04 03:23:07 -0700 (Mon, 04 Aug 2008) | 4 lines 2008-08-04 Robert Dewar <dewar@adacore.com> * exp_dist.adb: Minor reformatting ........ r138603 | charlet | 2008-08-04 03:23:16 -0700 (Mon, 04 Aug 2008) | 19 lines 2008-08-04 Gary Dismukes <dismukes@adacore.com> * exp_aggr.adb (Build_Record_Aggr_Code): Perform a conversion of the target to the type of the aggregate in the case where the target object is class-wide. * exp_ch5.adb (Expand_Simple_Function_Return): When the function's result type is class-wide and inherently limited, and the expression has a specific type, create a return object of the specific type, for more efficient handling of returns of build-in-place aggregates (avoids conversions of the class-wide return object to the specific type on component assignments). * sem_ch6.adb (Check_Return_Subtype_Indication): Suppress the error about a type mismatch for a class-wide function with a return object having a specific type when the object declaration doesn't come from source. Such an object can result from the expansion of a simple return. ........ r138604 | charlet | 2008-08-04 03:23:25 -0700 (Mon, 04 Aug 2008) | 4 lines 2008-08-04 Robert Dewar <dewar@adacore.com> * g-comlin.adb: Minor reformatting ........ r138605 | charlet | 2008-08-04 03:25:26 -0700 (Mon, 04 Aug 2008) | 8 lines 2008-08-04 Vasiliy Fofanov <fofanov@adacore.com> * g-soccon-mingw-64.ads, system-mingw-x86_64.ads: New files. * gcc-interface/Makefile.in: Use 64bit-specific system files when compiling for 64bit windows. ........ r138606 | charlet | 2008-08-04 03:28:30 -0700 (Mon, 04 Aug 2008) | 2 lines * gnat.dg/bip_aggregate_bug.adb: New test. ........ r138608 | paolo | 2008-08-04 05:05:41 -0700 (Mon, 04 Aug 2008) | 9 lines 2008-08-04 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/postypes.h: Reinstate inclusion of <stdint.h>; also define the __STDC_* macros. (streamoff): Adjust. * include/tr1_impl/cstdint: Check that the __STDC_* macros are not defined before defining. ........ r138609 | charlet | 2008-08-04 05:13:10 -0700 (Mon, 04 Aug 2008) | 2 lines * gnat.dg/test_ai254.adb: New test. ........ r138610 | charlet | 2008-08-04 05:14:25 -0700 (Mon, 04 Aug 2008) | 38 lines 2008-08-04 Javier Miranda <miranda@adacore.com> * sem_ch3.adb (Access_Subprogram_Declaration): Adding missing support for N_Formal_Object_Declaration nodes. Adding kludge required by First_Formal to provide its functionality with access to functions. (Replace_Anonymous_Access_To_Protected_Subprogram): Add missing support for anonymous access types returned by functions. * sem_ch5.adb (Analyze_Assignment): Code cleanup to avoid duplicate conversion of null-excluding access types (required only once to force the generation of the required runtime check). * sem_type.adb (Covers): minor reformating * checks.adb (Null_Exclusion_Static_Checks): Avoid reporting errors with internally generated nodes. Avoid generating the error inside init procs. * sem_res.adb (Resolve_Membership_Test): Minor reformating. (Resolve_Null): Generate the null-excluding check in case of assignment to a null-excluding object. (Valid_Conversion): Add missing support for anonymous access to subprograms. * sem_ch6.adb (Check_Return_Subtype_Indication): Add missing support for anonymous access types whose designated type is an itype. This case occurs with anonymous access to protected subprograms types. (Analyze_Return_Type): Add missing support for anonymous access to protected subprogram. * sem_eval.adb (Subtypes_Statically_Match): In case of access to subprograms addition of missing check on matching convention. Required to properly handle access to protected subprogram types. * exp_ch3 (Build_Assignment): Code cleanup removing duplicated check on null excluding access types. ........ r138611 | hjl | 2008-08-04 05:29:08 -0700 (Mon, 04 Aug 2008) | 5 lines 2008-08-04 H.J. Lu <hongjiu.lu@intel.com> * config/i386/i386.c (ix86_compute_frame_layout): Fix a typo in comments. ........ r138612 | charlet | 2008-08-04 05:34:16 -0700 (Mon, 04 Aug 2008) | 7 lines 2008-08-04 Robert Dewar <dewar@adacore.com> * sem_ch13.ads: Minor comment update * sem_res.adb: (Large_Storage_Type): Improve previous change. ........ r138613 | charlet | 2008-08-04 05:35:08 -0700 (Mon, 04 Aug 2008) | 6 lines 2008-08-04 Pascal Obry <obry@adacore.com> * adaint.c, s-os_lib.adb, s-os_lib.ads: Use Windows ACL to deal with file attributes. ........ r138614 | charlet | 2008-08-04 05:50:41 -0700 (Mon, 04 Aug 2008) | 5 lines 2008-08-04 Pascal Obry <obry@adacore.com> * adaint.h: Add missing prototype. ........ r138615 | charlet | 2008-08-04 05:51:00 -0700 (Mon, 04 Aug 2008) | 7 lines 2008-08-04 Robert Dewar <dewar@adacore.com> * sem_res.adb: (Valid_Conversion): Catch case of designated types having different sizes, even though they statically match. ........ r138616 | charlet | 2008-08-04 05:51:10 -0700 (Mon, 04 Aug 2008) | 6 lines 2008-08-04 Javier Miranda <miranda@adacore.com> * sem_eval.adb (Subtypes_Statically_Match): Remove superfluous patch added in previous patch to handle access to subprograms. ........ r138617 | charlet | 2008-08-04 05:51:19 -0700 (Mon, 04 Aug 2008) | 7 lines 2008-08-04 Robert Dewar <dewar@adacore.com> * freeze.adb: (Freeze_Entity): Only check No_Default_Initialization restriction for constructs that come from source ........ r138618 | charlet | 2008-08-04 05:51:30 -0700 (Mon, 04 Aug 2008) | 4 lines 2008-08-04 Thomas Quinot <quinot@adacore.com> * exp_ch6.adb: Minor comment fix. ........ r138619 | charlet | 2008-08-04 05:51:41 -0700 (Mon, 04 Aug 2008) | 4 lines 2008-08-04 Thomas Quinot <quinot@adacore.com> * sem_ch4.adb: Minor reformatting. ........ r138620 | charlet | 2008-08-04 05:52:38 -0700 (Mon, 04 Aug 2008) | 5 lines 2008-08-04 Pascal Obry <obry@adacore.com> * adaint.c: Refine support for Windows file attributes. ........ r138631 | hjl | 2008-08-04 07:56:12 -0700 (Mon, 04 Aug 2008) | 7 lines 2008-08-04 H.J. Lu <hongjiu.lu@intel.com> PR target/37012 * config/i386/i386.c (ix86_expand_prologue): Use UNITS_PER_WORD instead of STACK_BOUNDARY / BITS_PER_UNIT to align stack. (ix86_expand_epilogue): Likewise. ........ r138633 | simonb | 2008-08-04 08:09:56 -0700 (Mon, 04 Aug 2008) | 7 lines PR c++/36999 * parser.c (cp_parser_elaborated_type_specifier): Warn only when the declaration's id is followed by a semicolon. * g++.dg/warn/pr36999.C: New. ........ r138635 | charlet | 2008-08-04 08:33:55 -0700 (Mon, 04 Aug 2008) | 4 lines 2008-08-04 Thomas Quinot <quinot@adacore.com> * sem_type.adb, sem_ch4.adb, sprint.adb, exp_ch3.adb: Minor reformatting ........ r138636 | charlet | 2008-08-04 08:34:04 -0700 (Mon, 04 Aug 2008) | 4 lines 2008-08-04 Vasiliy Fofanov <fofanov@adacore.com> * g-soccon-mingw.ads: Fix value for MSG_WAITALL ........ r138637 | charlet | 2008-08-04 08:34:13 -0700 (Mon, 04 Aug 2008) | 6 lines 2008-08-04 Javier Miranda <miranda@adacore.com> * sem_prag.adb (Process_Convention): Add missing support for N_Private_Extension_Declaration nodes. ........ r138638 | charlet | 2008-08-04 08:34:39 -0700 (Mon, 04 Aug 2008) | 4 lines 2008-08-04 Robert Dewar <dewar@adacore.com> * exp_ch4.adb: Minor reformatting ........ r138640 | pbrook | 2008-08-04 09:27:17 -0700 (Mon, 04 Aug 2008) | 10 lines 2008-08-04 Paul Brook <paul@codesourcery.com> gcc/ * cofig/arm/arm.c (thumb_core_reg_alloc_order): New. (arm_order_regs_for_local_alloc): New function. * config/arm/arm-protos.h (arm_order_regs_for_local_alloc): Add prototype. * config/arm/arm.h (ORDER_REGS_FOR_LOCAL_ALLOC): Define. ........ r138642 | rguenth | 2008-08-04 10:22:17 -0700 (Mon, 04 Aug 2008) | 4 lines 2008-08-04 Richard Guenther <rguenther@suse.de> * tree-vect-transform.c (vectorizable_call): Fix tuplification. ........ r138643 | victork | 2008-08-04 10:25:13 -0700 (Mon, 04 Aug 2008) | 5 lines 2008-08-04 Victor Kaplansky <victork@il.ibm.com> * gcc.dg/vect/vect-complex-5.c: New test. ........ r138645 | rguenth | 2008-08-04 11:29:08 -0700 (Mon, 04 Aug 2008) | 8 lines 2008-08-04 Richard Guenther <rguenther@suse.de> PR middle-end/36691 * tree-ssa-loop-niter.c (number_of_iterations_lt_to_ne): Correctly check for no_overflow. * gcc.c-torture/execute/pr36691.c: New testcase. ........ r138647 | rguenth | 2008-08-04 11:35:20 -0700 (Mon, 04 Aug 2008) | 6 lines 2008-08-04 Richard Guenther <rguenther@suse.de> * tree-ssa-loop-ivopts.c (add_iv_value_candidates): Also add the candidate with the stripped base if that base is different from the original base even for offset zero. ........ r138648 | jason | 2008-08-04 11:39:16 -0700 (Mon, 04 Aug 2008) | 4 lines PR c++/37006 * pt.c (tsubst_decl): Leave DECL_INITIAL set on deleted instantiations. ........ r138649 | charlet | 2008-08-04 11:50:33 -0700 (Mon, 04 Aug 2008) | 5 lines 2008-08-04 Robert Dewar <dewar@adacore.com> * exp_ch4.adb (Expand_N_In): Suppress range warnings in instances ........ r138650 | charlet | 2008-08-04 11:50:45 -0700 (Mon, 04 Aug 2008) | 16 lines 2008-08-04 Ed Schonberg <schonberg@adacore.com> * sem_ch3.adb: (Replace_Anonymous_Access_To_Protected_Subprogram): Handle properly an anonymous access to protected subprogram that is the return type of the specification of a subprogram body. * sem_ch6.adb: (Analyze_Subprogram_Body): if the return type is an anonymous access to subprogram, freeze it now to prevent access anomalies in the back-end. * exp_ch9.adb: Minor code cleanup. Make sure that new declarations are inserted into the tree before analysis (from code reading). ........ r138651 | charlet | 2008-08-04 11:51:10 -0700 (Mon, 04 Aug 2008) | 7 lines 2008-08-04 Robert Dewar <dewar@adacore.com> * exp_ch5.adb: (Expand_Simple_Function_Return): Check No_Secondary_Stack restriction at point of return. ........ r138652 | jason | 2008-08-04 12:53:57 -0700 (Mon, 04 Aug 2008) | 4 lines PR c++/36963 * typeck2.c (check_narrowing): Allow narrowing conversion from an explicit floating-point constant. ........ r138661 | gccadmin | 2008-08-04 17:16:33 -0700 (Mon, 04 Aug 2008) | 1 line Daily bump. ........ r138664 | tromey | 2008-08-04 18:28:26 -0700 (Mon, 04 Aug 2008) | 2 lines PR libgcj/31890: * gcj/javaprims.h: Regenerate class list. ........ r138667 | charlet | 2008-08-05 01:16:11 -0700 (Tue, 05 Aug 2008) | 4 lines 2008-08-05 Robert Dewar <dewar@adacore.com> * sem_ch3.adb: Minor reformatting ........ r138668 | charlet | 2008-08-05 01:16:22 -0700 (Tue, 05 Aug 2008) | 4 lines 2008-08-05 Robert Dewar <dewar@adacore.com> * checks.adb: Minor reformatting ........ r138669 | charlet | 2008-08-05 01:16:33 -0700 (Tue, 05 Aug 2008) | 6 lines 2008-08-05 Thomas Quinot <quinot@adacore.com> * tbuild.ads (New_External_Name): Update spec to reflect relaxed restriction on Prefix. ........ r138670 | charlet | 2008-08-05 01:16:44 -0700 (Tue, 05 Aug 2008) | 17 lines 2008-08-05 Jerome Lambourg <lambourg@adacore.com> * g-comlin.adb (Sort_Sections, Group_Switches): New/Modified internal methods needed to handle switch sections when building a command line. (Define_Section, Add_Switch, Remove_Switch, Is_New_Section, Current_Section): New public methods or methods modified to handle building command lines with sections. (Set_Command_Line): Take into account sections when analysing a switch string. (Start): Sort the switches by sections before iterating the command line elements. * g-comlin.ads (Define_Section, Add_Switch, Remove_Switch, Is_New_Section, Current_Section): New methods or methods modified to handle building command lines with sections. ........ r138671 | charlet | 2008-08-05 01:17:02 -0700 (Tue, 05 Aug 2008) | 8 lines 2008-08-05 Ed Schonberg <schonberg@adacore.com> * exp_strm.adb (Build_Record_Or_Elementary_Input_Function): For access discriminants, indicate that the corresponding object declaration has no initialization, to prevent spurious warnings when the access type is null-excluding. ........ r138672 | charlet | 2008-08-05 01:17:24 -0700 (Tue, 05 Aug 2008) | 6 lines 2008-08-05 Ed Schonberg <schonberg@adacore.com> * sem_res.adb (Resolve_Call): If this is a call to the predefined Abort_Task, warn if the call appears within a protected operation. ........ r138673 | charlet | 2008-08-05 01:21:05 -0700 (Tue, 05 Aug 2008) | 2 lines * gnat.dg/access_discr2.adb: New test. ........ r138674 | charlet | 2008-08-05 01:34:58 -0700 (Tue, 05 Aug 2008) | 6 lines 2008-08-05 Thomas Quinot <quinot@adacore.com> * exp_strm.adb: Minor reformatting (comments) * sem_ch12.adb: Minor reformatting. ........ r138675 | charlet | 2008-08-05 01:41:07 -0700 (Tue, 05 Aug 2008) | 7 lines 2008-08-05 Javier Miranda <miranda@adacore.com> * sem_util.adb (Collect_Interfaces_Info): Minor reformating. * exp_ch3.adb (Build_Offset_To_Top_Functions): Code cleanup: the implementation of this routine has been simplified. ........ r138676 | charlet | 2008-08-05 01:41:30 -0700 (Tue, 05 Aug 2008) | 5 lines 2008-08-05 Pascal Obry <obry@adacore.com> * adaint.c, adaint.h, s-os_lib.adb, s-os_lib.ads: Fix the Set_Read_Only Win32 implementation. ........ r138678 | charlet | 2008-08-05 02:04:18 -0700 (Tue, 05 Aug 2008) | 4 lines 2008-08-05 Thomas Quinot <quinot@adacore.com> * a-rttiev.adb: Minor reformatting (comments) ........ r138679 | charlet | 2008-08-05 02:05:08 -0700 (Tue, 05 Aug 2008) | 9 lines 2008-08-05 Thomas Quinot <quinot@adacore.com> * gen-soccon.c: Rename to gen-oscons.c * gen-oscons.c: New file. Now generate System.OS_Constants instead of GNAT.Sockets.Constants. Add new constants for GNAT.Serial_Communications and System.File_IO. ........ r138680 | charlet | 2008-08-05 02:13:53 -0700 (Tue, 05 Aug 2008) | 5 lines 2008-08-05 Vincent Celier <celier@adacore.com> * mlib.adb: Update comments. ........ r138681 | charlet | 2008-08-05 02:14:03 -0700 (Tue, 05 Aug 2008) | 7 lines 2008-08-05 Vincent Celier <celier@adacore.com> * prj-proc.adb: (Process_Declarative_Items): Skip associative array attribute when index is reserved word "others". ........ r138682 | charlet | 2008-08-05 02:14:13 -0700 (Tue, 05 Aug 2008) | 5 lines 2008-08-05 Vasiliy Fofanov <fofanov@adacore.com> * gen-oscons.c: Adapt for VMS where termios.h is not available. ........ r138683 | charlet | 2008-08-05 02:14:48 -0700 (Tue, 05 Aug 2008) | 38 lines 2008-08-05 Vincent Celier <celier@adacore.com> * make.adb (Switches_Of): Check for Switches (others), before checking for Default_Switches ("Ada"). (Gnatmake): Use Builder'Switches (others) in preference to Builder'Default_Switches ("Ada") if there are several mains. * prj-attr-pm.adb: (Add_Attribute): Add component Others_Allowed in Attribute_Record aggregate. * prj-attr.adb: Add markers to indicates that attributes Switches allow others as index (Others_Allowed_For): New Boolean function, returning True for attributes with the mark. (Initialize): Recognize optional letter 'O' as the marker for associative array attributes where others is allowed as the index. * prj-attr.ads: (Others_Allowed_For): New Boolean function (Attribute_Record): New Boolean component Others_Allowed * prj-dect.adb: (Parse_Attribute_Declaration): For associative array attribute where others is allowed as the index, allow others as an index. * prj-nmsc.adb: (Process_Binder): Skip associative array attributes with index others (Process_Compiler): Ditto * prj-util.adb: (Value_Of (Index, In_Array)): Make no attempt to put in lower case when index is All_Other_Names. * prj.ads: (All_Other_Names): New constant ........ r138684 | charlet | 2008-08-05 02:27:49 -0700 (Tue, 05 Aug 2008) | 13 lines 2008-08-05 Jose Ruiz <ruiz@adacore.com> * init.c (__gnat_install_handler for linux): If we are building the Xenomai run time then we need to do two additional things: avoid memory swapping and transform the Linux environment task into a native Xenomai task. * gcc-interface/Makefile.in (LIBGNAT_TARGET_PAIRS for xenomai run time): Use interface to Xenomai native skin and avoid linux-specific way of setting CPU affinity. (EH_MECHANISM for the xenomai run time): Use sjlj exception mechanism. ........ r138685 | charlet | 2008-08-05 02:28:03 -0700 (Tue, 05 Aug 2008) | 4 lines 2008-08-05 Bob Duff <duff@adacore.com> * checks.ads: Minor comment fix ........ r138686 | charlet | 2008-08-05 02:28:12 -0700 (Tue, 05 Aug 2008) | 4 lines 2008-08-05 Robert Dewar <dewar@adacore.com> * make.adb: Minor reformatting ........ r138687 | charlet | 2008-08-05 02:28:44 -0700 (Tue, 05 Aug 2008) | 7 lines 2008-08-05 Thomas Quinot <quinot@adacore.com> * g-sercom.adb, g-sercom.ads, g-sercom-mingw.adb, g-sercom-linux.adb (Data_Bits): Change literals B7 and B8 to CS7 and CS8. ........ r138688 | charlet | 2008-08-05 02:28:55 -0700 (Tue, 05 Aug 2008) | 5 lines 2008-08-05 Robert Dewar <dewar@adacore.com> * mlib.adb: Minor code reorganization Minor reformatting ........ r138689 | charlet | 2008-08-05 02:29:03 -0700 (Tue, 05 Aug 2008) | 4 lines 2008-08-05 Robert Dewar <dewar@adacore.com> * prj-attr.ads: Minor reformatting ........ r138690 | charlet | 2008-08-05 02:29:12 -0700 (Tue, 05 Aug 2008) | 4 lines 2008-08-05 Robert Dewar <dewar@adacore.com> * s-os_lib.adb: Minor reformatting ........ r138691 | charlet | 2008-08-05 02:29:20 -0700 (Tue, 05 Aug 2008) | 5 lines 2008-08-05 Robert Dewar <dewar@adacore.com> * s-fileio.adb: Minor code reorganization Minor reformatting ........ r138692 | charlet | 2008-08-05 02:29:28 -0700 (Tue, 05 Aug 2008) | 4 lines 2008-08-05 Robert Dewar <dewar@adacore.com> * prj.ads: Minor reformatting ........ r138693 | charlet | 2008-08-05 02:30:53 -0700 (Tue, 05 Aug 2008) | 7 lines 2008-08-05 Bob Duff <duff@adacore.com> * sem_ch3.adb (Analyze_Object_Declaration): Avoid type Any_Access in unresolved initial value of "null", because it causes implicitly generated "=" operators to be ambiguous, and because this type should not be passed to gigi. ........ r138694 | charlet | 2008-08-05 02:33:21 -0700 (Tue, 05 Aug 2008) | 2 lines * gnat.dg/not_null.adb: New test. ........ r138695 | charlet | 2008-08-05 02:39:05 -0700 (Tue, 05 Aug 2008) | 4 lines 2008-08-05 Robert Dewar <dewar@adacore.com> * sem_ch3.adb: Minor reformatting ........ r138696 | charlet | 2008-08-05 02:39:23 -0700 (Tue, 05 Aug 2008) | 4 lines 2008-08-05 Robert Dewar <dewar@adacore.com> * prj-nmsc.adb: Minor reformatting ........ r138697 | charlet | 2008-08-05 02:40:19 -0700 (Tue, 05 Aug 2008) | 6 lines 2008-08-05 Ed Schonberg <schonberg@adacore.com> * sem_ch12.adb (Validate_Array_Type_Instance): Only apply complex visibility check on the component type if the simple test fails. ........ r138700 | rguenth | 2008-08-05 04:42:33 -0700 (Tue, 05 Aug 2008) | 5 lines 2008-08-05 Richard Guenther <rguenther@suse.de> PR middle-end/37026 * gcc.c-torture/compile/pr37026.c: New testcase. ........ r138701 | charlet | 2008-08-05 06:23:44 -0700 (Tue, 05 Aug 2008) | 5 lines 2008-08-05 Pascal Obry <obry@adacore.com> * a-coinve.adb: Reorder the code to avoid uninitialized warning. ........ r138702 | charlet | 2008-08-05 06:23:53 -0700 (Tue, 05 Aug 2008) | 4 lines 2008-08-05 Thomas Quinot <quinot@adacore.com> * socket.c: Minor reformatting. ........ r138703 | charlet | 2008-08-05 06:24:02 -0700 (Tue, 05 Aug 2008) | 4 lines 2008-08-05 Pascal Obry <obry@adacore.com> * adaint.c: In UNIX cases do not call __gnat_stat but stat directly. ........ r138704 | charlet | 2008-08-05 06:24:27 -0700 (Tue, 05 Aug 2008) | 16 lines 2008-08-05 Robert Dewar <dewar@adacore.com> * opt.ads (Warn_On_Biased_Representation): New flag * sem_ch13.adb: (Analyze_Attribute_Definition_Clause): Issue warning when biased representation is required. (Minimum_Size): Don't allow biasing if enum rep clause case * sem_warn.adb: (Set_Dot_Warning_Switch): Add handling of -gnatw.b/B switches (Set_Warning_Switch): Include -gnatw.b in -gnatwa, -gnatw.B in gnatws * usage.adb: Add lines for -gnatw.b/B switches ........ r138705 | charlet | 2008-08-05 06:26:24 -0700 (Tue, 05 Aug 2008) | 7 lines 2008-08-05 Thomas Quinot <quinot@adacore.com> * xoscons.adb, xutil.ads, xutil.adb, s-oscons-tmplt.c: New files. * gcc-interface/Makefile.in, gcc-interface/Make-lang.in: Generate s-oscons.ads ........ r138706 | charlet | 2008-08-05 06:29:05 -0700 (Tue, 05 Aug 2008) | 3 lines * Makefile.in (gnatlib*): Now depend on oscons target. (oscons): New target. ........ r138708 | charlet | 2008-08-05 06:42:08 -0700 (Tue, 05 Aug 2008) | 12 lines 2008-08-05 Vincent Celier <celier@adacore.com> * s-wchwts.adb: (Wide_String_To_String): Returns a String with the same 'First as its parameter S. (Wide_Wide_String_To_String): Ditto * s-wchwts.ads: (Wide_String_To_String): Document that the lowest index of the returned String is equal to S'First. ........ r138709 | charlet | 2008-08-05 06:42:47 -0700 (Tue, 05 Aug 2008) | 5 lines 2008-08-05 Pascal Obry <obry@adacore.com> * adaint.c, adaint.h, s-os_lib.adb, s-os_lib.ads: Add support for the readable attribute. ........ r138710 | charlet | 2008-08-05 06:53:04 -0700 (Tue, 05 Aug 2008) | 8 lines 2008-08-05 Vincent Celier <celier@adacore.com> * a-wtdeio.adb (Put (Current_Output)): Use Fore in the call to Put (File). * a-ztdeio.adb: Ditto. ........ r138711 | uweigand | 2008-08-05 06:53:20 -0700 (Tue, 05 Aug 2008) | 5 lines * config/spu/spu.h (CANNOT_CHANGE_MODE_CLASS): Allow (multi)word-sized SUBREG of multi-word hard register. * config/spu/spu.c (valid_subreg): Likewise. (adjust_operand): Handle SUBREGs of multi-word hard registers. ........ r138714 | uweigand | 2008-08-05 07:04:56 -0700 (Tue, 05 Aug 2008) | 27 lines * config/spu_spu_mfcio.h: Wrap in extern "C" if __cplusplus. Reword some comments throughout the file. (MFC_MIN_DMA_LIST_ELEMENTS): New define. (MFC_MAX_DMA_LIST_ELEMENTS): Likewise. (MFC_MIN_DMA_LIST_SIZE): Redefine in terms of MFC_MIN_DMA_LIST_ELEMENTS. (MFC_MAX_DMA_LIST_SIZE): Redefine in terms of MFC_MAX_DMA_LIST_ELEMENTS. (MFC_START_ENABLE): Remove PPU-only define. (MFC_PUTS_CMD, MFC_PUTFS_CMD, MFC_PUTBS_CMD): Likewise. (MFC_GETS_CMD, MFC_GETFS_CMD, MFC_GETBS_CMD): Likewise. (MFC_PUTB_CMD, MFC_PUTF_CMD): Reimplement using symbolic constants. (MFC_PUTL_CMD, MFC_PUTLB_CMD, MFC_PUTLF_CMD): Likewise. (MFC_PUTR_CMD, MFC_PUTRB_CMD, MFC_PUTRF_CMD): Likewise. (MFC_PUTRL_CMD, MFC_PUTRLB_CMD, MFC_PUTRLF_CMD): Likewise. (MFC_GETB_CMD, MFC_GETF_CMD): Likewise. (MFC_GETL_CMD, MFC_GETLB_CMD, MFC_GETLF_CMD): Likewise. (MFC_SNDSIGB_CMD, MFC_SNDSIGF_CMD): Likewise. (MFC_SDCRT_CMD, MFC_SDCRTST_CMD): New defines. (MFC_SDCRZ_CMD, MFC_SDCRST_CMD, MFC_SDCRF_CMD): Likewise. (mfc_sdcrt, mfc_sdcrtst): Likewise. (mfc_sdcrz, mfc_sdcrst, mfc_sdcrf): Likewise. (spu_read_machine_status): Fix typo. ........ r138716 | charlet | 2008-08-05 07:10:38 -0700 (Tue, 05 Aug 2008) | 7 lines 2008-08-05 Sergey Rybin <rybin@adacore.com> * gnat_ugn.texi: Changing the description of the gnatcheck metrics rule according to the change in the rule option. Add documentation for -gnatw.b/-gnatw.B ........ r138717 | charlet | 2008-08-05 07:10:54 -0700 (Tue, 05 Aug 2008) | 6 lines 2008-08-05 Robert Dewar <dewar@adacore.com> * ug_words: Add entries for -gnatw.b/-gnatw.B * vms_data.ads: Add entries for -gnatw.b/-gnatw.B ........ r138718 | pbrook | 2008-08-05 07:24:08 -0700 (Tue, 05 Aug 2008) | 16 lines 2008-08-05 Paul Brook <paul@codesourcery.com> gcc/ * doc/invoke.texi: Document new ARM -mfpu= and -mcpu= options. * config/arm/arm.c (all_fpus): Add vfpv3 and vfpv3-d16. (fp_model_for_fpu): Add entry for FPUTYPE_VFP3D16. (arm_file_start): Add FPUTYPE_VFP3D16. Rename vfp3 to vfpv3. * config/arm/arm.h (TARGET_VFPD32): Define. (TARGET_VFP3): Use TARGET_VFPD32. (fputype): Add FPUTYPE_VFP3D16. (LAST_VFP_REGNUM): Use TARGET_VFPD32. * config/arm/constraints.md ("w"): Use TARGET_VFPD32. * config/arm/arm-cores.def: Add cortex-r4f. * config/arm/arm-tune.md: Regenerate. ........ r138719 | charlet | 2008-08-05 07:36:21 -0700 (Tue, 05 Aug 2008) | 2 lines * gnat.dg/post_block.adb: New test. ........ r138720 | charlet | 2008-08-05 07:37:01 -0700 (Tue, 05 Aug 2008) | 8 lines 2008-08-05 Thomas Quinot <quinot@adacore.com> * gsocket.h: Make this file includable in a Nucleus environment, which does not support sockets. * socket.c: Remove Nucleus-specific hack. ........ r138721 | charlet | 2008-08-05 07:37:10 -0700 (Tue, 05 Aug 2008) | 5 lines 2008-08-05 Pascal Obry <obry@adacore.com> * adaint.c: Remove support for readable attribute on vxworks and nucleus ........ r138722 | charlet | 2008-08-05 07:37:19 -0700 (Tue, 05 Aug 2008) | 8 lines 2008-08-05 Ed Schonberg <schonberg@adacore.com> * sem_attr.adb: (Analyze_Attribute, case 'Result): handle properly the case where some operand of the expression in a post-condition generates a transient block. ........ r138723 | charlet | 2008-08-05 07:37:44 -0700 (Tue, 05 Aug 2008) | 7 lines 2008-08-05 Ed Schonberg <schonberg@adacore.com> * sem_ch5.adb (Analyze_Assignment_Statement): Apply conversion to right-hand side when it is an anonymous access_to_subprogram, to force static accessibility check when needed. ........ r138724 | charlet | 2008-08-05 07:49:51 -0700 (Tue, 05 Aug 2008) | 2 lines Remove test, premature. ........ r138725 | charlet | 2008-08-05 08:11:19 -0700 (Tue, 05 Aug 2008) | 7 lines 2008-08-05 Ed Schonberg <schonberg@adacore.com> * freeze.adb: (Freeze_Entity): A deferred constant does not violate the restriction No_Default_Initialization, ........ r138726 | charlet | 2008-08-05 08:13:05 -0700 (Tue, 05 Aug 2008) | 5 lines 2008-08-05 Thomas Quinot <quinot@adacore.com> * Makefile.rtl: Compile s-oscons.ads as part of the runtime library. ........ r138727 | charlet | 2008-08-05 08:13:25 -0700 (Tue, 05 Aug 2008) | 5 lines 2008-08-05 Doug Rupp <rupp@adacore.com> * vms_data.ads: Translation for /POINTER_SIZE qualifier. ........ r138728 | charlet | 2008-08-05 08:14:29 -0700 (Tue, 05 Aug 2008) | 13 lines 2008-08-05 Ed Schonberg <schonberg@adacore.com> * sem_ch3.adb (Process_Subtype): An allocator is a valid construct that can carry a null exclusion indicator, and on which an error may be posted if the indicator is redundant. * sem_ch8.adb (Analyze_Object_Renaming): Verify that a null exclusion does not apply to a subtype mark that already excludes null. * sem_ch12.adb (Formal_Object_Declaration): Verify that a null exclusion does not apply to a subtype mark that already excludes null. ........ r138732 | doko | 2008-08-05 08:46:22 -0700 (Tue, 05 Aug 2008) | 4 lines 2008-08-05 Matthias Klose <doko@ubuntu.com> * HACKING: Update instructions how to build gcj/javaprims.h. ........ r138733 | rth | 2008-08-05 10:24:37 -0700 (Tue, 05 Aug 2008) | 20 lines * Makefile.in (c-cppbuiltin.o): Depend on debug.h. * c-cppbuiltin.c (c_cpp_builtins): Define __GCC_HAVE_DWARF2_CFI_ASM. * doc/cpp.texi (__GCC_HAVE_DWARF2_CFI_ASM): Document it. * common.opt (fdwarf2-cfi-asm): New. * configure.ac (HAVE_GAS_CFI_DIRECTIVE): New. * config.in, configure: Rebuild. * dwarf2asm.c (dw2_asm_output_data_raw): New. (dw2_asm_output_data_uleb128_raw, dw2_asm_output_data_sleb128_raw): New. (dw2_force_const_mem): Externalize. * dwarf2asm.h: Update. * dwarf2out.c (dwarf2out_cfi_label): If flag_dwarf2_cfi_asm, don't generate a real label. (output_cfi_directive): New. (add_fde_cfi): If flag_dwarf2_cfi_asm, use it. (output_call_frame_info): Do nothing if flag_dwarf2_cfi_asm. (dwarf2out_begin_prologue): Emit .cfi_startproc, .cfi_personality, and .cfi_lsda. (dwarf2out_end_epilogue): Emit .cfi_endproc. (output_loc_operands_raw, output_loc_sequence_raw): New. (output_cfa_loc_raw): New. ........ r138735 | pinskia | 2008-08-05 11:23:07 -0700 (Tue, 05 Aug 2008) | 13 lines 2008-08-05 Andrew Pinski <andrew_pinski@playstation.sony.com> PR tree-opt/37024 * tree-tailcall.c (process_assignment): Use gimple_assign_cast_p instead of IS_CONVERT_EXPR_CODE_P for seeing if the assignment is a conversion. 2008-08-05 Andrew Pinski <andrew_pinski@playstation.sony.com> PR tree-opt/37024 * gcc.dg/tree-ssa/tailcall-4.c: New testcase. ........ r138737 | paolo | 2008-08-05 13:39:48 -0700 (Tue, 05 Aug 2008) | 28 lines 2008-08-05 Paolo Carlini <paolo.carlini@oracle.com> * testsuite/util/testsuite_api.h (diamond_derivation<>::test): Expect ambiguity together with the standard exception classes. * testsuite/27_io/ios_base/failure/cons_virtual_derivation.cc: Remove xfail. * testsuite/19_diagnostics/logic_error/cons_virtual_derivation.cc: Likewise. * testsuite/19_diagnostics/runtime_error/cons_virtual_derivation.cc: Likewise. * testsuite/19_diagnostics/system_error/cons_virtual_derivation.cc: Likewise. * testsuite/18_support/bad_alloc/cons_virtual_derivation.cc: Likewise. * testsuite/18_support/bad_cast/cons_virtual_derivation.cc: Likewise. * testsuite/18_support/bad_exception/cons_virtual_derivation.cc: Likewise. * testsuite/18_support/bad_typeid/cons_virtual_derivation.cc: Likewise. * testsuite/ext/concurrence_lock_error/cons_virtual_derivation.cc: Likewise. * testsuite/ext/forced_exception_error/cons_virtual_derivation.cc: Likewise. * testsuite/ext/concurrence_unlock_error/cons_virtual_derivation.cc: Likewise. * testsuite/20_util/bad_function_call/cons_virtual_derivation.cc: Likewise. ........ r138738 | rth | 2008-08-05 14:25:48 -0700 (Tue, 05 Aug 2008) | 2 lines * configure.ac (HAVE_GAS_CFI_DIRECTIVE): Check .cfi_personality. * configure: Rebuild. ........ r138740 | jason | 2008-08-05 15:22:00 -0700 (Tue, 05 Aug 2008) | 4 lines PR c++/37016 * tree-ssa.c (useless_type_conversion_p_1): Call langhook if TYPE_STRUCTURAL_EQUALITY_P is true for both types. ........ r138747 | bwilson | 2008-08-05 16:06:33 -0700 (Tue, 05 Aug 2008) | 4 lines * config/xtensa/xtensa.c (xtensa_va_start): Unshare valist. (xtensa_gimplify_va_arg_expr): Unshare valist, orig_ndx, ndx, array, va_size, and type_size. ........ r138748 | bwilson | 2008-08-05 16:16:51 -0700 (Tue, 05 Aug 2008) | 2 lines * config/xtensa/t-xtensa: Remove dependency for gt-xtensa.h. ........ r138751 | gccadmin | 2008-08-05 17:16:51 -0700 (Tue, 05 Aug 2008) | 1 line Daily bump. ........ r138756 | jason | 2008-08-05 19:25:20 -0700 (Tue, 05 Aug 2008) | 8 lines PR c++/37016 * decl.c (build_ptrmemfunc_type): Don't require structural comparison of PMF types. * tree.c (cp_build_qualified_type_real): Don't clear a valid TYPE_PTRMEMFUNC_TYPE. * typeck.c (cp_build_unary_op): Still do build_ptrmemfunc in templates. ........ r138757 | mkuvyrkov | 2008-08-05 23:20:02 -0700 (Tue, 05 Aug 2008) | 4 lines * sched-rgn.c (new_ready): Check if instruction can be speculatively scheduled before attempting speculation. (debug_rgn_dependencies): Remove wrongful assert. ........ r138758 | mkuvyrkov | 2008-08-05 23:22:33 -0700 (Tue, 05 Aug 2008) | 6 lines * haifa-sched.c (extend_global): Split to extend_global_data and extend_region_data. Update all uses. (extend_all): Rename to extend_block_data. * gcc.target/ia64/20080802-1.c: New test. ........ r138759 | mkuvyrkov | 2008-08-05 23:23:47 -0700 (Tue, 05 Aug 2008) | 7 lines PR target/35659 * haifa-sched.c (sched_insn_is_legitimate_for_speculation_p): Move ... * sched-deps.c (sched_insn_is_legitimate_for_speculation_p): ... here. Don't allow predicated instructions for data speculation. * sched-int.h (sched_insn_is_legitimate_for_speculation_p): Move declaration. ........ r138763 | krebbel | 2008-08-05 23:51:11 -0700 (Tue, 05 Aug 2008) | 11 lines 2008-08-06 Andreas Krebbel <krebbel1@de.ibm.com> * reload.c (find_reloads): Force constants into literal pool also if they are wrapped in a SUBREG. 2008-08-06 Andreas Krebbel <krebbel1@de.ibm.com> * gcc.c-torture/compile/20080806-1.c: New testcase. ........ r138764 | hubicka | 2008-08-06 00:50:52 -0700 (Wed, 06 Aug 2008) | 3 lines * predict.c (maybe_hot_frequency_p): When profile is absent, all frequencies might be hot. ........ r138765 | charlet | 2008-08-06 00:56:04 -0700 (Wed, 06 Aug 2008) | 12 lines 2008-08-06 Ed Schonberg <schonberg@adacore.com> * sem_ch3.adb (Process_Discriminants): diagnose redundant or improper null exclusion in a discriminant declaration * sem_ch8.adb (Analyze_Object_Renaming): diagnose null exclusion indicators when type is not an access type. * sem_ch12.adb (Formal_Object_Declaration): diagnose null exclusion indicators when type is not an access type. ........ r138766 | charlet | 2008-08-06 00:56:23 -0700 (Wed, 06 Aug 2008) | 7 lines 2008-08-06 Javier Miranda <miranda@adacore.com> * exp_disp (Expand_Interface_Conversion): Freeze the entity associated with the target interface before expanding the code of the interface conversion. ........ r138767 | charlet | 2008-08-06 00:57:04 -0700 (Wed, 06 Aug 2008) | 8 lines 2008-08-06 Doug Rupp <rupp@adacore.com> * gcc-interface/utils2.c (snames.h) Include (TARGET_ABI_OPEN_VMS): Initialize. (build_call_alloc_dealloc); [TARGET_ABI_OPEN_VMS] Allocate on 32bit heap for Convention C. ........ r138768 | charlet | 2008-08-06 01:07:32 -0700 (Wed, 06 Aug 2008) | 12 lines 2008-08-06 Doug Rupp <rupp@adacore.com> * gcc-interface/decl.c (gnat_to_gnu_param): Force 32bit descriptor if TARGET_MALLOC64 clear. * gcc-interface/utils2.c (build_call_alloc_dealloc): Force 32bit malloc if TARGET_MALLOC64 clear. * gcc-interface/gigi.h (TARGET_ABI_OPEN_VMS): Move here from utils2.c (TARGET_MALLC64): New macro. Default to clear. ........ r138769 | charlet | 2008-08-06 01:31:51 -0700 (Wed, 06 Aug 2008) | 5 lines 2008-08-06 Thomas Quinot <quinot@adacore.com> * xnmake.adb: Use new XUtil package for platform independent text output. ........ r138770 | charlet | 2008-08-06 01:32:00 -0700 (Wed, 06 Aug 2008) | 5 lines 2008-08-06 Vincent Celier <celier@adacore.com> * gnat_ugn.texi: Document compiler switch -gnateG ........ r138771 | charlet | 2008-08-06 01:32:09 -0700 (Wed, 06 Aug 2008) | 9 lines 2008-08-06 Quentin Ochem <ochem@adacore.com> * s-stausa.adb (Fill_Stack): Fixed pragma assert and top pattern mark in the case of an empty pattern size. (Compute_Result): Do not do any computation in the case of an empty pattern size. (Report_Result): Fixed computation of the overflow guard. ........ r138772 | charlet | 2008-08-06 01:32:32 -0700 (Wed, 06 Aug 2008) | 7 lines 2008-08-06 Ed Schonberg <schonberg@adacore.com> * g-awk.adb (Finalize): Do not use directly objects of the type in the finalization routine to prevent elaboration order anomalies in new finalization scheme. ........ r138773 | charlet | 2008-08-06 01:32:42 -0700 (Wed, 06 Aug 2008) | 6 lines 2008-08-06 Ed Schonberg <schonberg@adacore.com> * sem_ch3.adb (Find_Type_Name): protect against duplicate incomplete declaration for the same type. ........ r138774 | charlet | 2008-08-06 01:32:52 -0700 (Wed, 06 Aug 2008) | 4 lines 2008-08-06 Thomas Quinot <quinot@adacore.com> * sem.adb: Minor rewording (comment) ........ r138775 | charlet | 2008-08-06 01:33:21 -0700 (Wed, 06 Aug 2008) | 29 lines 2008-08-06 Jerome Lambourg <lambourg@adacore.com> * g-comlin.adb (Define_Switch, Get_Switches): New. (Can_Have_Parameter, Require_Parameter, Actual_Switch): New, used when ungrouping switches. (For_Each_Simple_Switch): Allow more control over parameters handling. This generic method now allows ungrouping of switches with parameters and switches with more than one letter after the prefix. (Set_Command_Line): Take care of switches that are prefixed with a switch handling parameters without delimiter (-gnatya and -gnaty3 for example). (Add_Switch, Remove_Switch): Handle parameters possibly present inside a group, as in gnaty3aM80 (3 and 80 are parameters). Report status of the operation. (Start, Alias_Switches, Group_Switches): Take care of parameters possibly present inside a group. * g-comlin.ads (Define_Switch): New method used to define a list of expected switches, that are necessary for correctly ungrouping switches with more that one character after the prefix. (Get_Switches): Method that builds a getopt string from the list of switches as set previously by Define_Switch. (Add_Switch, Remove_Switch): New versions of the methods, reporting the status of the operation. Also allow the removal of switches with parameters only. (Command_Line_Configuration_Record): Maintain a list of expected switches. ........ r138776 | charlet | 2008-08-06 01:52:10 -0700 (Wed, 06 Aug 2008) | 4 lines 2008-08-06 Thomas Quinot <quinot@adacore.com> * sem_ch3.adb: Minor reformatting ........ r138777 | charlet | 2008-08-06 01:52:19 -0700 (Wed, 06 Aug 2008) | 5 lines 2008-08-06 Pascal Obry <obry@adacore.com> * adaint.c: Another fix for ACL support on Windows. ........ r138778 | charlet | 2008-08-06 01:52:28 -0700 (Wed, 06 Aug 2008) | 6 lines 2008-08-06 Javier Miranda <miranda@adacore.com> * exp_disp (Expand_Interface_Actuals): Adds missing support for expansion of calls to subprograms using selected components. ........ r138779 | charlet | 2008-08-06 01:52:36 -0700 (Wed, 06 Aug 2008) | 7 lines 2008-08-06 Ed Schonberg <schonberg@adacore.com> * sem_res.adb (Resolve_Call): Use base type to determine whether a dereference is needed because a subtype of an access_to_subprogram is simply an access-subtype ........ r138780 | charlet | 2008-08-06 01:52:44 -0700 (Wed, 06 Aug 2008) | 6 lines 2008-08-06 Jerome Lambourg <lambourg@adacore.com> * g-comlin.adb (Set_Command_Line): Now that aliases can contain parameters, always specify the expected separator. ........ r138781 | charlet | 2008-08-06 01:57:21 -0700 (Wed, 06 Aug 2008) | 10 lines 2008-08-06 Thomas Quinot <quinot@adacore.com> * g-socket-dummy.adb, g-socket-dummy.ads, g-sothco-dummy.adb, g-sothco-dummy.ads, g-socthi-dummy.adb, g-socthi-dummy.ads, g-sttsne-dummy.ads: New files. * gcc-interface/Makefile.in, Makefile.rtl: Use placeholder sources with pragma Unimplemented_Unit for sockets packages on Nucleus. ........ r138782 | charlet | 2008-08-06 02:16:07 -0700 (Wed, 06 Aug 2008) | 2 lines New tests. ........ r138783 | charlet | 2008-08-06 02:35:06 -0700 (Wed, 06 Aug 2008) | 4 lines 2008-08-06 Thomas Quinot <quinot@adacore.com> * sem_res.adb: Minor reformatting ........ r138784 | charlet | 2008-08-06 02:35:17 -0700 (Wed, 06 Aug 2008) | 10 lines 2008-08-06 Ed Schonberg <schonberg@adacore.com> * sem_ch3.adb (Access_Subprogram_Declaration): If the return type is incomplete, add the access_to_subprogram type to the list of private dependents only if the incomplete type will be completed in the current scope. (Build_Discriminant_Constraints): If the type of the discriminant is access_to_variable, reject a constraint that is access_to_constant. ........ r138785 | charlet | 2008-08-06 02:35:27 -0700 (Wed, 06 Aug 2008) | 4 lines 2008-08-06 Thomas Quinot <quinot@adacore.com> * exp_ch11.adb: Minor reformatting ........ r138786 | charlet | 2008-08-06 02:41:04 -0700 (Wed, 06 Aug 2008) | 7 lines 2008-08-06 Thomas Quinot <quinot@adacore.com> * s-fileio.adb (Open): When file open operation fails, raise Name_Error only when the operating system reports a non-existing file or directory (ENOENT), otherwise raise Name_Error. ........ r138787 | charlet | 2008-08-06 02:42:31 -0700 (Wed, 06 Aug 2008) | 9 lines 2008-08-06 Thomas Quinot <quinot@adacore.com> * gcc-interface/Makefile.in, gcc-interface/Make-lang.in: Remove obsolete targets referencing gen-soccon When generating s-oscons.ads, use a file name that includes the THREAD_KIND, to ensure that the (potentially different) version from a previous build with a different threads flavour does not get reused. ........ r138788 | charlet | 2008-08-06 02:43:10 -0700 (Wed, 06 Aug 2008) | 8 lines 2008-08-06 Thomas Quinot <quinot@adacore.com> * gcc-interface/Makefile.in, gcc-interface/Make-lang.in: Remove obsolete targets referencing gen-soccon When generating s-oscons.ads, use a file name that includes the THREAD_KIND, to ensure that the (potentially different) version from a previous build with a different threads flavour does not get reused. ........ r138789 | charlet | 2008-08-06 02:43:33 -0700 (Wed, 06 Aug 2008) | 4 lines 2008-08-06 Thomas Quinot <quinot@adacore.com> * Makefile.in: Now generate s-oscons-$(THREAD_KIND). ........ r138790 | charlet | 2008-08-06 03:03:21 -0700 (Wed, 06 Aug 2008) | 10 lines 2008-08-06 Ed Schonberg <schonberg@adacore.com> * sem_ch3.adb (Analyze_Component_Declaration): Protect against misuse of incomplete type. * sem_ch8.adb (Analyze_Object_Renaming): Diagnose properly a renaming of a formal parameter of an incomplete type. Improve error message for other improper uses of incomplete types. ........ r138791 | charlet | 2008-08-06 03:03:52 -0700 (Wed, 06 Aug 2008) | 5 lines 2008-08-06 Robert Dewar <dewar@adacore.com> * gnat_ugn.texi: Clarify -gnato documentation ........ r138792 | charlet | 2008-08-06 03:08:09 -0700 (Wed, 06 Aug 2008) | 16 lines 2008-08-06 Thomas Quinot <quinot@adacore.com> * gcc-interface/Makefile.in, g-socthi-vxworks.adb, g-socthi-mingw.adb, g-sttsne-vxworks.adb, g-socthi.adb, g-socket.adb, g-socket.ads, g-sothco.ads, g-soccon-linux-x86.ads, g-soccon-vxworks.ads, g-soccon-mingw.ads, g-soccon-hpux-ia64.ads, g-soccon-irix.ads, g-soccon-linux-64.ads, g-soccon-aix.ads, g-soccon-solaris.ads, g-soccon-lynxos.ads, g-soccon-vms.ads, g-soccon.ads, g-soccon-freebsd.ads, g-soccon-linux-ppc.ads, g-soccon-tru64.ads, g-soccon-hpux.ads, g-soccon-solaris-64.ads, gen-oscons.c, g-soccon-darwin.ads, g-soccon-mingw-64.ads, g-soccon-linux-mips.ads, g-soccon-rtems.ads: Remove GNAT.Sockets.Constants. This internal package is replaced by System.OS_Constants. ........ r138793 | aldyh | 2008-08-06 03:25:22 -0700 (Wed, 06 Aug 2008) | 7 lines PR middle-end/35432 * gimplify.c (gimplify_modify_expr): Do not optimize zero-sized types if want_value. testsuite/ * gcc.c-torture/compile/pr35432.c: New file. ........ r138797 | paolo | 2008-08-06 05:25:00 -0700 (Wed, 06 Aug 2008) | 9 lines 2008-08-06 Paolo Carlini <paolo.carlini@oracle.com> * acinclude.m4 ([GLIBCXX_CHECK_INT64_T]): Also check whether int64_t is actually a typedef to long or long long. * include/bits/postypes.h: If int64_t is actually a typedef for long or long long don't include <stdint.h> unnecessarily. * configure: Regenerate. * config.h.in: Likewise. ........ r138799 | sam | 2008-08-06 06:54:31 -0700 (Wed, 06 Aug 2008) | 2 lines gcc/ada/ * gcc-interface/Make-lang.in (OSCONS_CPPFLAGS): Remove. ........ r138800 | sam | 2008-08-06 06:55:07 -0700 (Wed, 06 Aug 2008) | 7 lines gcc/ada/ * gcc-interface/Make-lang.in: Use GCC_FOR_TARGET when dealing with s-oscons-tmplt.i. libada/ * Makefile.in: Pass FLAGS_TO_PASS to sub-make for target oscons. ........ r138804 | jsm28 | 2008-08-06 08:20:14 -0700 (Wed, 06 Aug 2008) | 4 lines * jump.c (rtx_renumbered_equal_p): Do not call subreg_regno_offset for unrepresentable subregs or treat them as equal to other regs or subregs with the same register number. ........ r138806 | hjl | 2008-08-06 08:29:37 -0700 (Wed, 06 Aug 2008) | 31 lines gcc/ 2008-08-06 H.J. Lu <hongjiu.lu@intel.com> PR middle-end/37009 * cfgexpand.c (expand_stack_alignment): Check parm_stack_boundary for incoming stack boundary. * function.c (assign_parm_find_entry_rtl): Update parm_stack_boundary. * function.h (rtl_data): Add parm_stack_boundary. * config/i386/i386.c (ix86_finalize_stack_realign_flags): Check parm_stack_boundary for incoming stack boundary. gcc/testsuite/ 2008-08-06 H.J. Lu <hongjiu.lu@intel.com> PR middle-end/37009 * gcc.dg/torture/stackalign/alloca-2.c: New. * gcc.dg/torture/stackalign/alloca-3.c: Likewise. * gcc.dg/torture/stackalign/alloca-4.c: Likewise. * gcc.dg/torture/stackalign/vararg-3.c: Likewise. * gcc.target/i386/incoming-1.c: Likewise. * gcc.target/i386/incoming-2.c: Likewise. * gcc.target/i386/incoming-3.c: Likewise. * gcc.target/i386/incoming-4.c: Likewise. * gcc.target/i386/incoming-5.c: Likewise. ........ r138807 | matz | 2008-08-06 08:34:45 -0700 (Wed, 06 Aug 2008) | 7 lines PR target/36613 * reload.c (push_reload): Merge in,out,in_reg,out_reg members for reused reload, instead of overwriting them. * gcc.target/i386/pr36613.c: New testcase. ........ r138808 | hjl | 2008-08-06 08:43:46 -0700 (Wed, 06 Aug 2008) | 15 lines gcc/ 2008-08-06 H.J. Lu <hongjiu.lu@intel.com> PR middle-end/37010 * calls.c (expand_call): Use the biggest preferred stack boundary. gcc/testsuite/ 2008-08-06 H.J. Lu <hongjiu.lu@intel.com> PR middle-end/37010 * gcc.dg/torture/stackalign/push-1.c: New. ........ r138809 | ghazi | 2008-08-06 08:57:09 -0700 (Wed, 06 Aug 2008) | 44 lines * builtins.c (expand_builtin_profile_func): Avoid C++ keywords. * calls.c (avoid_likely_spilled_reg): Likewise. * cfgexpand.c (gimple_assign_rhs_to_tree): Likewise. * cgraph.c (cgraph_clone_edge, cgraph_clone_node): Likewise. * config/i386/i386.c (ix86_expand_special_args_builtin, ix86_secondary_reload): Likewise. * except.c (struct eh_region, gen_eh_region_catch, remove_unreachable_regions, duplicate_eh_regions, assign_filter_values, build_post_landing_pads, sjlj_find_directly_reachable_regions, remove_eh_handler, reachable_next_level, foreach_reachable_handler, can_throw_internal_1, can_throw_external_1, collect_one_action_chain): Likewise. * expr.c (expand_expr_real_1, vector_mode_valid_p): Likewise. * fold-const.c (twoval_comparison_p, eval_subst): Likewise. * function.c (update_temp_slot_address, instantiate_new_reg, instantiate_virtual_regs_in_rtx, instantiate_virtual_regs_in_insn): Likewise. * gimple.c (extract_ops_from_tree, gimple_seq_copy): Likewise. * gimplify.c (gimplify_call_expr, gimplify_init_constructor, gimplify_cleanup_point_expr): Likewise. * ipa-cp.c (ipcp_lattice_changed): Likewise. * passes.c (next_pass_1): Likewise. * print-tree.c (print_node_brief, print_node): Likewise. * profile.c (branch_prob): Likewise. * tree-dump.c (dump_register): Likewise. * tree-eh.c (replace_goto_queue_cond_clause, lower_catch): Likewise. * tree-inline.c (remap_ssa_name, remap_type_1, remap_blocks, copy_statement_list, remap_gimple_op_r, copy_tree_body_r, copy_edges_for_bb, copy_cfg_body, copy_tree_r, copy_arguments_for_versioning, copy_static_chain): Likewise. * tree-into-ssa.c (names_replaced_by, add_to_repl_tbl, add_new_name_mapping, register_new_name_mapping): Likewise. * tree-mudflap.c (mf_xform_derefs): Likewise. * tree-predcom.c (struct chain, dump_chain, replace_ref_with, get_init_expr, combine_chains): Likewise. * tree-pretty-print.c (dump_generic_node): Likewise. * tree-ssa-structalias.c (create_variable_info_for): Likewise. * tree-vrp.c (simplify_cond_using_ranges): Likewise. * tree.c (substitute_in_expr, iterative_hash_expr): Likewise. * value-prof.c (gimple_duplicate_stmt_histograms): Likewise. ........ r138810 | bwilson | 2008-08-06 09:02:16 -0700 (Wed, 06 Aug 2008) | 14 lines 2008-08-06 Marc Gauthier <marc@tensilica.com> * config.gcc: Match more processor names for Xtensa. * configure.ac: Likewise. * doc/install.texi (Specific): Likewise. * configure: Regenerate. testsuite/ * lib/target-supports.exp (check_profiling_available): Match more processor names for Xtensa. * g++.old-deja/g++.jason/thunk3.C: Likewise. * gcc.dg/intmax_t-1.c: Likewise. * gcc.dg/sibcall-3.c: Likewise. * gcc.dg/sibcall-4.c: Likewise. * gcc.c-torture/compile/20001226-1.c: Likewise. ........ r138811 | bwilson | 2008-08-06 09:03:03 -0700 (Wed, 06 Aug 2008) | 3 lines libgcc/ * config.host: Match more processor names for Xtensa. ........ r138812 | matz | 2008-08-06 09:10:22 -0700 (Wed, 06 Aug 2008) | 3 lines * Makefile.in (write_entries_to_file): Quote words. * gengtype.c: (read_input_line): Skip over leading white-space. ........ r138813 | ghazi | 2008-08-06 09:12:51 -0700 (Wed, 06 Aug 2008) | 89 lines * config/alpha/alpha.c (alpha_preferred_reload_class, alpha_secondary_reload, alpha_emit_set_const_1, function_value, alpha_output_mi_thunk_osf): Avoid C++ keywords. * config/arm/arm.c (output_move_vfp, output_move_neon): Likewise. * config/arm/arm.md: Likewise. * config/avr/avr-protos.h (preferred_reload_class, test_hard_reg_class, avr_simplify_comparison_p, out_shift_with_cnt, class_max_nregs): Likewise. * config/avr/avr.c (class_max_nregs, avr_simplify_comparison_p, output_movqi, output_movhi, output_movsisf, out_shift_with_cnt, preferred_reload_class, test_hard_reg_class): Likewise. * config/bfin/bfin.c (legitimize_pic_address, hard_regno_mode_ok, bfin_memory_move_cost, bfin_secondary_reload, bfin_output_mi_thunk): Likewise. * config/crx/crx.c (crx_secondary_reload_class, crx_memory_move_cost): Likewise. * config/frv/frv-protos.h (frv_secondary_reload_class, frv_class_likely_spilled_p, frv_class_max_nregs): Likewise. * config/frv/frv.c (frv_override_options, frv_alloc_temp_reg, frv_secondary_reload_class, frv_class_likely_spilled_p, frv_class_max_nregs): Likewise. * config/h8300/h8300.c (h8300_classify_operand, h8300_unary_length, h8300_bitfield_length, h8300_asm_insn_count): Likewise. * config/i386/winnt.c (i386_pe_declare_function_type): Likewise. * config/ia64/ia64.c (ia64_preferred_reload_class, ia64_secondary_reload_class, ia64_output_mi_thunk): Likewise. * config/iq2000/iq2000.c (gen_int_relational): Likewise. * config/m32c/m32c.c (class_can_hold_mode, m32c_output_compare): Likewise. * config/m68hc11/m68hc11.c (preferred_reload_class, m68hc11_memory_move_cost): Likewise. * config/mcore/mcore.c (mcore_secondary_reload_class, mcore_reload_class): Likewise. * config/mips/mips.c (mips_hard_regno_mode_ok_p, mips_class_max_nregs, mips_cannot_change_mode_class, mips_preferred_reload_class, mips_secondary_reload_class, mips_output_mi_thunk): Likewise. * config/mmix/mmix.c (mmix_preferred_reload_class, mmix_preferred_output_reload_class, mmix_secondary_reload_class): Likewise. * config/mn10300/mn10300.c (mn10300_secondary_reload_class): Likewise. * config/pa/pa.c (pa_secondary_reload, pa_combine_instructions, pa_can_combine_p, pa_cannot_change_mode_class): Likewise. * config/pa/pa.h (LEGITIMIZE_RELOAD_ADDRESS): Likewise. * config/rs6000/rs6000.c (paired_expand_vector_init, rs6000_secondary_reload_class, rs6000_output_mi_thunk, compare_section_name, rs6000_memory_move_cost): Likewise. * config/s390/s390.c (s390_emit_compare_and_swap, s390_preferred_reload_class, s390_secondary_reload, legitimize_pic_address, legitimize_tls_address, legitimize_reload_address, s390_expand_cs_hqi, s390_expand_atomic, s390_class_max_nregs): Likewise. * config/s390/s390.h (LEGITIMIZE_RELOAD_ADDRESS): Likewise. * config/s390/s390.md: Likewise. * config/score/score-protos.h (score_secondary_reload_class, score_preferred_reload_class): Likewise. * config/score/score.c (score_preferred_reload_class, score_secondary_reload_class): Likewise. * config/score/score3.c (score3_output_mi_thunk, score3_preferred_reload_class, score3_secondary_reload_class, score3_hard_regno_mode_ok): Likewise. * config/score/score3.h (score3_preferred_reload_class, score3_secondary_reload_class): Likewise. * config/score/score7.c (score7_output_mi_thunk, score7_preferred_reload_class, score7_secondary_reload_class, score7_hard_regno_mode_ok): Likewise. * config/score/score7.h (score7_preferred_reload_class, score7_secondary_reload_class): Likewise. * config/sh/sh.c (prepare_move_operands, output_far_jump, output_branchy_insn, add_constant, gen_block_redirect, sh_insn_length_adjustment, sh_cannot_change_mode_class, sh_output_mi_thunk, replace_n_hard_rtx, sh_secondary_reload): Likewise. * config/sparc/sparc.c (sparc_output_mi_thunk): Likewise. * config/stormy16/stormy16.c (xstormy16_output_cbranch_hi, xstormy16_output_cbranch_si, xstormy16_secondary_reload_class, xstormy16_preferred_reload_class): Likewise. * config/xtensa/xtensa.c (xtensa_expand_compare_and_swap, xtensa_expand_atomic, override_options, xtensa_preferred_reload_class, xtensa_secondary_reload_class): Likewise. * reorg.c (try_merge_delay_insns): Likewise. * tree.c (merge_dllimport_decl_attributes): Likewise. * config/frv/frv.c (frv_print_operand): Change isalpha to ISALPHA. ........ r138814 | manu | 2008-08-06 09:17:41 -0700 (Wed, 06 Aug 2008) | 12 lines 2008-08-06 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR 8715 * c-common.c (warn_for_sign_compare): New. Handle separately the case that 'constant' is zero. * c-typeck.c (build_binary_op): Move code to c-common.c cp/ * typeck.c (cp_build_binary_op): Move code to c-common.c. testsuite/ * gcc.dg/pr8715.c: New. * g++.dg/warn/pr8715.C: New. ........ r138815 | victork | 2008-08-06 09:26:46 -0700 (Wed, 06 Aug 2008) | 19 lines 2008-08-06 Victor Kaplansky <victork@il.ibm.com> Ira Rosen <irar@il.ibm.com> * tree-vect-transform.c (vect_model_simple_cost): Return immediately if stmt is pure SLP. (vect_model_store_cost): Ditto. (vect_model_load_cost): Ditto. (vectorizable_store): Remove PURE_SLP check before call to vect_model_store_cost. (vect_model_store_cost): When checking whether stmt describe strided access, add a check that it is not slp_node. Testsute * gcc.dg/vect/costmodel/ppc/costmodel-slp-34.c: New test. ........ r138816 | manu | 2008-08-06 09:37:06 -0700 (Wed, 06 Aug 2008) | 11 lines 2008-08-06 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR 26785 * diagnostic.c (permerror_at): New. * toplev.h (permerror_at): Declare. cp/ * decl.c (grokdeclarator): Use explicit location with permerror_at. testsuite/ * g++.dg/warn/pr26785.C: New. ........ r138817 | ghazi | 2008-08-06 10:22:05 -0700 (Wed, 06 Aug 2008) | 9 lines * matrix-reorg.c (compute_offset): Avoid C++ keywords. * c-common.c: Fix typo. (c_common_reswords): Activate more C++ keyword warnings. testsuite: * gcc.dg/Wcxx-compat-2.c: Adjust test for more warnings. ........ r138819 | dgregor | 2008-08-06 12:08:12 -0700 (Wed, 06 Aug 2008) | 14 lines 2008-08-06 Douglas Gregor <doug.gregor@gmail.com> PR c++/36460 * parser.c (cp_parser_template_argument): Don't assume that '>>' following a type-id is an error when in C++0x mode. 2008-08-06 Douglas Gregor <doug.gregor@gmail.com> PR c++/36460 * g++.dg/cpp0x/bracket3.C: Add another test case for the >> warning under -Wc++0x-compat. * g++.dg/cpp0x/bracket4.C: Add testcase for PR c++/36460. ........ r138829 | paolo | 2008-08-06 16:17:05 -0700 (Wed, 06 Aug 2008) | 14 lines 2008-08-06 Paolo Carlini <paolo.carlini@oracle.com> * acinclude.m4 ([GLIBCXX_CHECK_STDIO_MACROS]): New, checks for common values of EOF, SEEK_CUR, SEEK_END. * configure.ac: Use it. * include/bits/ios_base.h: Likewise. * include/bits/char_traits.h: Likewise. * config/locale/gnu/ctype_members.cc: Include <cstdio>. * config/locale/generic/ctype_members.cc: Likewise. * testsuite/27_io/ios_base/cons/assign_neg.cc: Adjust dg-error lines. * testsuite/27_io/ios_base/cons/copy_neg.cc: Likewise. * configure: Regenerate. * config.h.in: Likewise. ........ r138832 | gccadmin | 2008-08-06 17:16:41 -0700 (Wed, 06 Aug 2008) | 1 line Daily bump. ........ r138834 | krebbel | 2008-08-07 00:18:53 -0700 (Thu, 07 Aug 2008) | 6 lines 2008-08-07 Andreas Krebbel <krebbel1@de.ibm.com> * gcc.c-torture/compile/20080806-1.c: Move testcase ... * gcc.target/s390/20080806-1.c: ... to here. ........ r138835 | hubicka | 2008-08-07 00:35:51 -0700 (Thu, 07 Aug 2008) | 21 lines * optabs.c (emit_unop_insn): Break out to ... (maybe_emit_unop_insn): ... this one. (expand_sfix_optab): Use maybe variant. * optabs.h (maybe_emit_unop_insn): Declare. * i386.md (mov0 patterns): Enable by default. (FP conversion expanders): Disable expansion of code expanding sequences when instruction should be optimized for size. (single strinop patterns): Enable when optimizing for size. (string expanders): Disable expanding of code expanding sequences when optimizning instruction for size. * i386.c (ix86_expand_vector_move_misalign): Do code size optimization per BB basis. (ix86_fp_comparison_sahf_cost): Likewise. (ix86_expand_branch): Likewise. (ix86_expand_ashl_const): Likewise. (ix86_split_ashl): Likewise. (ix86_expand_strlen): Likewise. (ix86_emit_fp_unordered_jump): Likewie. ........ r138837 | rguenth | 2008-08-07 03:01:48 -0700 (Thu, 07 Aug 2008) | 8 lines 2008-08-07 Richard Guenther <rguenther@suse.de> PR middle-end/37042 * tree-ssa-alias-warnings.c (nonstandard_alias_p): Ref-all pointers can access anything. * gcc.dg/Wstrict-aliasing-bogus-ref-all-2.c: New testcase. ........ r138839 | hjl | 2008-08-07 06:16:23 -0700 (Thu, 07 Aug 2008) | 24 lines gcc/ 2008-08-07 H.J. Lu <hongjiu.lu@intel.com> PR target/36992 * config/i386/emmintrin.h (_mm_move_epi64): Use __builtin_ia32_movq128. * config/i386/i386.c (ix86_builtins): Add IX86_BUILTIN_MOVQ128. (bdesc_args): Add IX86_BUILTIN_MOVQ128. * config/i386/sse.md (sse2_movq128): New. * doc/extend.texi: Document __builtin_ia32_movq128. gcc/testsuite/ 2008-08-07 H.J. Lu <hongjiu.lu@intel.com> PR target/36992 * gcc.target/i386/pr36992-1.c: Scan movq. * gcc.target/i386/pr36992-2.c: Use "-O2 -msse4" instead of "-O0 -msse2". Scan movq. ........ r138840 | aph | 2008-08-07 07:19:15 -0700 (Thu, 07 Aug 2008) | 5 lines 2008-08-07 Andrew Haley <aph@redhat.com> * testsuite/libjava.lang/StackTrace2.java: Rewrite to prevent spurious failure when some methods are inlined. ........ r138841 | hubicka | 2008-08-07 07:55:32 -0700 (Thu, 07 Aug 2008) | 3 lines PR target/37048 * i386.md (single stringop patterns): Enable unconditionally. ........ r138842 | smw | 2008-08-07 08:06:28 -0700 (Thu, 07 Aug 2008) | 1 line * include/tr1_impl/regex (match_results): Add cbegin()/cend() per N2691 WD. ........ r138843 | dgregor | 2008-08-07 08:38:59 -0700 (Thu, 07 Aug 2008) | 9 lines 2008-08-07 Douglas Gregor <doug.gregor@gmail.com> * semantics.c (finish_decltype_type): Handle calls to function pointers and references to functions properly. 2008-08-07 Douglas Gregor <doug.gregor@gmail.com> * g++.dg/cpp0x/decltype12.C: New. ........ r138844 | jsm28 | 2008-08-07 08:43:28 -0700 (Thu, 07 Aug 2008) | 4 lines * config/arm/iwmmxt.md (movv8qi_internal, movv4hi_internal, movv2si_internal): Combine into mov<mode>_internal. (movv2si_internal_2): Remove. ........ r138846 | rth | 2008-08-07 09:29:22 -0700 (Thu, 07 Aug 2008) | 7 lines * configure.ac (HAVE_GAS_CFI_PERSONALITY_DIRECTIVE): New. * configure, config.in: Rebuild. * debug.h (dwarf2out_do_cfi_asm): Declare. * c-cppbuiltin.c (c_cpp_builtins): Use it. * dwarf2out.c (dwarf2out_do_cfi_asm): New. (dwarf2out_cfi_label, add_fde_cfi, output_call_frame_info, dwarf2out_begin_prologue, dwarf2out_end_epilogue): Use it. ........ r138847 | jsm28 | 2008-08-07 09:58:29 -0700 (Thu, 07 Aug 2008) | 9 lines * config/arm/arm.c (output_move_neon): Update comment describing big-endian vector layout. (arm_assemble_integer): Do not handle big-endian NEON vectors specially. * config/arm/neon.md (vec_set<mode>_internal, vec_extract<mode>, neon_vget_lane<mode>_sext_internal, neon_vget_lane<mode>_zext_internal, neon_vget_lane<mode>): Adjust element indices for big-endian. ........ r138848 | hjl | 2008-08-07 11:28:23 -0700 (Thu, 07 Aug 2008) | 4 lines 2008-08-07 H.J. Lu <hongjiu.lu@intel.com> * semantics.c (finish_decltype_type): Initialize type. ........ r138849 | aaronwl | 2008-08-07 12:30:14 -0700 (Thu, 07 Aug 2008) | 5 lines 2008-08-07 Aaron W. LaFramboise <aaronavay62@aaronwl.com> * pex-win32.c (argv_to_argc): New function. (spawn_script): Duplicate argv before calling win32_spawn. ........ r138850 | rth | 2008-08-07 13:06:36 -0700 (Thu, 07 Aug 2008) | 2 lines PR debug/37033 * gcc.c (cpp_options): Pass along -g*. ........ r138851 | bwilson | 2008-08-07 16:44:31 -0700 (Thu, 07 Aug 2008) | 3 lines * config/xtensa/xtensa.c (xtensa_copy_incoming_a7): Copy incoming value in a6 after the set_frame_ptr insn. ........ r138854 | gccadmin | 2008-08-07 17:16:46 -0700 (Thu, 07 Aug 2008) | 1 line Daily bump. ........ r138859 | ghazi | 2008-08-07 18:42:33 -0700 (Thu, 07 Aug 2008) | 6 lines * c-common.c (c_common_reswords): Also warn about keyword "bool". testsuite: * gcc.dg/Wcxx-compat-2.c: Check for bool/_Bool. ........ r138862 | paolo | 2008-08-08 02:54:09 -0700 (Fri, 08 Aug 2008) | 6 lines 2008-08-08 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/ios_base.h: Undef _IOS_BASE_SEEK_CUR and _IOS_BASE_SEEK_END at the end of the file. * include/bits/char_traits.h: Likewise for _CHAR_TRAITS_EOF. ........ r138863 | hubicka | 2008-08-08 03:04:51 -0700 (Fri, 08 Aug 2008) | 6 lines * recog.c (split_all_insns): Set RTL profile (peephole2_optimize): Likewise. * function.c (thread_prologue_and_epilogue_insns): Likewise. * combine.c (combine_instructions): Likewise. ........ r138864 | hubicka | 2008-08-08 03:09:37 -0700 (Fri, 08 Aug 2008) | 14 lines * i386.h (ix86_size_cost): Declare. (ix86_cur_cost): New function macro. * i386.md (peepholes expanding size and splitters): Predicate by optimize_insn_for_speed_p. (peepholes reduce size and splitters): Predicate by optimize_insn_for_size_p. * i386.c (ix86_size_cost): Rename from ... (size_cost): This one. (override_options): Update. (decide_alg): Likewise. (ix86_expand_clear): Use RTL profile. (ix86_pad_returns): Use RTL profile. ........ r138865 | rguenth | 2008-08-08 04:30:13 -0700 (Fri, 08 Aug 2008) | 9 lines 2008-08-08 Richard Guenther <rguenther@suse.de> PR tree-optimization/37056 * gimple.h (gimple_assign_rhs_class): New helper function. * tree-ssa-loop-niter.c (get_val_for): Fix tuplification, handle unary operations properly. * gcc.c-torture/compile/pr37056.c: New testcase. ........ r138866 | charlet | 2008-08-08 05:22:02 -0700 (Fri, 08 Aug 2008) | 6 lines 2008-08-08 Robert Dewar <dewar@adacore.com> * g-comlin.adb: Minor code reorganization Minor reformatting ........ r138867 | charlet | 2008-08-08 05:22:10 -0700 (Fri, 08 Aug 2008) | 4 lines 2008-08-08 Robert Dewar <dewar@adacore.com> * g-comlin.ads: Minor reformatting ........ r138868 | charlet | 2008-08-08 05:22:18 -0700 (Fri, 08 Aug 2008) | 5 lines 2008-08-08 Robert Dewar <dewar@adacore.com> * s-fileio.adb: Minor reformatting ........ r138869 | charlet | 2008-08-08 05:22:26 -0700 (Fri, 08 Aug 2008) | 5 lines 2008-08-08 Robert Dewar <dewar@adacore.com> * sem_attr.adb: Minor code reorganization (use Nkind_In) Minor reformatting ........ r138870 | charlet | 2008-08-08 05:22:51 -0700 (Fri, 08 Aug 2008) | 6 lines 2008-08-08 Ed Schonberg <schonberg@adacore.com> * exp_ch4.adb (Expand_Allocator_Expression): add check if null exclusion indicator is present ........ r138871 | charlet | 2008-08-08 05:23:28 -0700 (Fri, 08 Aug 2008) | 6 lines 2008-08-08 Thomas Quinot <quinot@adacore.com> * gcc-interface/Makefile.in, gcc-interface/Make-lang.in: Revert previous change, not needed after all. ........ r138872 | charlet | 2008-08-08 05:23:48 -0700 (Fri, 08 Aug 2008) | 5 lines 2008-08-06 Thomas Quinot <quinot@adacore.com> * Makefile.in: generate s-oscons.ads again, previous change was unneeded. ........ r138873 | charlet | 2008-08-08 05:37:51 -0700 (Fri, 08 Aug 2008) | 7 lines 2008-08-08 Thomas Quinot <quinot@adacore.com> * g-sercom.ads: (Name): Document application scope (only legacy PC serial ports on Linux and Windows). ........ r138874 | charlet | 2008-08-08 05:58:36 -0700 (Fri, 08 Aug 2008) | 7 lines 2008-08-08 Thomas Quinot <quinot@adacore.com> * gsocket.h: On Windows, include <errno.h> and redefine only selected errno values from their <winsock2.h> definitions. ........ r138875 | charlet | 2008-08-08 05:58:46 -0700 (Fri, 08 Aug 2008) | 4 lines 2008-08-08 Thomas Quinot <quinot@adacore.com> * s-osinte-freebsd.ads: Minor reformatting ........ r138876 | charlet | 2008-08-08 05:59:14 -0700 (Fri, 08 Aug 2008) | 4 lines 2008-08-08 Thomas Quinot <quinot@adacore.com> * s-osinte-hpux.ads, s-osinte-irix.ads: Minor reformatting ........ r138877 | charlet | 2008-08-08 05:59:28 -0700 (Fri, 08 Aug 2008) | 12 lines 2008-08-08 Thomas Quinot <quinot@adacore.com> * g-soccon.ads: New file. * g-stheme.adb, g-socthi-vms.adb, g-socthi-vxworks.adb, g-socthi-mingw.adb, g-sttsne-vxworks.adb, g-socthi.adb, g-stsifd-sockets.adb, g-socket.adb, g-socket.ads, g-sothco.adb, g-sothco.ads: Add back GNAT.Sockets.Constants as a child unit, to allow building software that depends on this internal unit with both older and newer compilers. ........ r138878 | charlet | 2008-08-08 05:59:38 -0700 (Fri, 08 Aug 2008) | 4 lines 2008-08-08 Robert Dewar <dewar@adacore.com> * s-strxdr.adb: Minor reformatting ........ r138879 | charlet | 2008-08-08 06:00:00 -0700 (Fri, 08 Aug 2008) | 10 lines 2008-08-08 Bob Duff <duff@adacore.com> * gnat_ugn.texi: The "Run-Time Checks" section said "arithmetic overflow checking for integer operations (including division by zero)", which is wrong -- divide by zero is not part of overflow checking. Also added misc clarification about what check-suppression means. * gnat_rm.texi: Clarify the meaning of pragma Suppress. ........ r138880 | charlet | 2008-08-08 06:03:37 -0700 (Fri, 08 Aug 2008) | 5 lines 2008-08-08 Thomas Quinot <quinot@adacore.com> * gcc-interface/Makefile.in: Reintroduce g-soccon.ads as a compatibility shim. ........ r138881 | charlet | 2008-08-08 06:09:37 -0700 (Fri, 08 Aug 2008) | 7 lines 2008-08-08 Ed Schonberg <schonberg@adacore.com> * freeze.adb (Generate_Prim_Op_References): New procedure, abstracted from Freeze_Entity. Used to generate cross-reference information for types declared in generic packages. ........ r138882 | rguenth | 2008-08-08 08:01:05 -0700 (Fri, 08 Aug 2008) | 9 lines 2008-08-08 Richard Guenther <rguenther@suse.de> * tree-ssa-ccp.c (likely_value): Calls are not all varying. (surely_varying_stmt_p): Calls are varying only if they are non-builtin and not indirect or have no result. (ccp_fold): Re-instantiate code before the tuples merge. * gcc.dg/tree-ssa/ssa-ccp-20.c: New testcase. ........ r138884 | domob | 2008-08-08 11:19:46 -0700 (Fri, 08 Aug 2008) | 23 lines 2008-08-08 Daniel Kraft <d@domob.eu> * gfortran.h (gfc_finalizer): Replaced member `procedure' by two new members `proc_sym' and `proc_tree' to store the symtree after resolution. (gfc_find_sym_in_symtree): Made public. * decl.c (gfc_match_final_decl): Adapted for new member name. * interface.c (gfc_find_sym_in_symtree): Made public. (gfc_extend_expr), (gfc_extend_assign): Changed call accordingly. * module.c (mio_finalizer), (mio_f2k_derived), (mio_full_f2k_derived): New methods for module-file IO of f2k_derived. (mio_symbol): Do IO of f2k_derived namespace. * resolve.c (gfc_resolve_finalizers): Adapted for new member name and finding the symtree for the symbol here. * symbol.c (gfc_free_finalizer): Adapted for new members. 2008-08-08 Daniel Kraft <d@domob.eu> * gfortran.dg/finalize_9.f03: New test. * gfortran.dg/module_md5_1.f90: Adapted MD5-sum for changed module file format. ........ r138885 | dorit | 2008-08-08 12:00:36 -0700 (Fri, 08 Aug 2008) | 15 lines 2008-08-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-transform.c (vectorizable_conversion): Pass the integral type to vectorize.builtin_conversion. (vectorizable_conversion): Likewise. * config/i386/i386.c (ix86_vectorize_builtin_conversion): Always takes integral type as input. * config/rs6000/rs6000.c (rs6000_builtin_conversion): Add case for FIX_TRUNC_EXPR. (rs6000_expand_builtin): Add case for ALTIVEC_BUILTIN_VCTUXS and ALTIVEC_BUILTIN_VCTSXS. (rs6000_builtin_mul_widen_even. rs6000_builtin_mul_widen_odd): Fix formatting. ........ r138886 | reichelt | 2008-08-08 14:17:54 -0700 (Fri, 08 Aug 2008) | 6 lines PR c++/35985 * decl.c (xref_basetypes): Check base for MAYBE_CLASS_TYPE_P, and make sure it is not a union. * g++.dg/inherit/base3.C: New. ........ r138887 | pthaugen | 2008-08-08 14:40:18 -0700 (Fri, 08 Aug 2008) | 15 lines 2008-08-08 Peter Bergner <bergner@vnet.ibm.com> * doc/invoke.texi: Add cpu_type power7. * config.in (HAVE_AS_VSX): New. * config.gcc: Add cpu_type power7. * configure.ac (HAVE_AS_VSX): Check for assembler support of the VSX instructions. * configure: Regenerate. * config/rs6000/rs6000.c (rs6000_override_options): Alias power7 to power5. * config/rs6000/rs6000.h (ASM_CPU_POWER7_SPEC): Define. (ASM_CPU_SPEC): Pass %(asm_cpu_power7) for -mcpu=power7. (EXTRA_SPECS): Add asm_cpu_power7 spec string. ........ r138889 | manu | 2008-08-08 16:07:49 -0700 (Fri, 08 Aug 2008) | 12 lines Property changes on: libcpp ___________________________________________________________________ Name: svn:ignore - autom4te.cache + TAGS TAGS.sub GPATH GRTAGS GSYMS GTAGS autom4te.cache ........ r138890 | manu | 2008-08-08 16:15:31 -0700 (Fri, 08 Aug 2008) | 26 lines 2008-08-08 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR 28875 * flags.h (set_Wunused): Delete * toplev.c (process_options): Handle Wunused flags here. * opts.c (maybe_warn_unused_parameter): Delete. (common_handle_option): Replace set_Wunused by warn_unused. (set_Wextra): Do not handle Wunused-parameter here. (set_Wunused): Delete. * c-opts.c (c_common_handle_option): Replace set_Wunused by warn_unused. * common.opt (Wunused): Add Var and Init. (Wunused-function): Likewise. (Wunused-label): Likewise. (Wunused-parameter): Likewise. (Wunused-value): Likewise. (Wunused-variable): Likewise. fortran/ * options.c (set_Wall): Replace set_Wunused by warn_unused. java/ * lang.c (java_handle_option): Replace set_Wunused with warn_unused. testsuite/ * gcc.dg/unused-6-no.c: New. * gcc.dg/unused-6-WallWextra.c: New. ........ r138891 | pault | 2008-08-08 16:22:51 -0700 (Fri, 08 Aug 2008) | 9 lines 2008-08-09 Paul Thomas <pault@gcc.gnu.org> PR fortran/37011 * symbol.c (gfc_add_extension): New function. * decl.c (gfc_get_type_attr_spec): Call it. (gfc_match_derived_decl): Set symbol extension attribute from attr.extension. * gfortran.h : Add prototype for gfc_add_extension. ........ r138892 | manu | 2008-08-08 16:32:23 -0700 (Fri, 08 Aug 2008) | 12 lines 2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR 7651 * doc/invoke.texi (-Wextra): Move warning from here... (-Wuninitialized): ... to here. cp/ * class.c (check_bases_and_members): Warn with -Wuninitialized instead of -Wextra. testsuite/ * g++.dg/warn/Wuninitializable-member.C: New. * g++.dg/warn/Wuninitializable-member-no.C: New. ........ r138893 | manu | 2008-08-08 16:57:19 -0700 (Fri, 08 Aug 2008) | 111 lines 2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR 36901 * diagnostic.def (DK_PEDWARN, DK_PERMERROR): New. * diagnostic.c (pedantic_warning_kind, permissive_error_kind): Moved from diagnostic.h (diagnostic_report_diagnostic): Return bool. Handle DK_PEDWARN and DK_PERMERROR. (emit_diagnostic): New. (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * diagnostic.h (pedantic_warning_kind, permissive_error_kind): Moved to diagnostic.c. (struct diagnostic_context): Use correct type for classify_diagnostic. (diagnostic_report_diagnostic): Update declaration. (emit_diagnostic): Declare. * errors.c (warning): Return bool. * errors.h (warning): Update declaration. * toplev.h (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * c-errors.c (pedwarn_c99, pedwarn_c90): Use DK_PEDWARN. * c-decl.c (locate_old_decl): Delete 'diag' argument. Always use inform. Update all calls. (diagnose_mismatched_decls): Check return value of warning/pedwarn before giving informative note. (implicit_decl_warning): Likewise. * c-typeck.c (build_function_call): Likewise. * tree-sssa.c (warn_uninit): Likewise. * builtins.c (gimplify_va_arg_expr): Likewise. fortran/ * f95-lang.c (gfc_mark_addressable): Use "pedwarn (0," instead of 'pedwarn0'. cp/ * cp-tree.h (struct diagnostic_context, struct diagnostic_info): Delete forward declarations. Check that toplev.h has not been included before this file. Include toplev.h and diagnostic.h. * error.c (cp_cpp_error): Use DK_PEDWARN. (cxx_incomplete_type_diagnostic): Update declaration. (cxx_incomplete_type_error): Use DK_ERROR. * typeck2.c (cxx_incomplete_type_diagnostic): Take a diagnostic_t as argument. Use emit_diagnostic. (cxx_incomplete_type_error): Use DK_ERROR. (add_exception_specifier): Use diagnostic_t instead of custom codes. * typeck.c (complete_type_or_else): Update call to cxx_incomplete_type_diagnostic. * init.c (build_delete): Likewise. * call.c (diagnostic_fn_t): Remove unused typedef. (build_temp): Pass a pointer to diagnostic_t. (convert_like_real): Use emit_diagnostic. (joust): Check return value of warning before giving informative note. * friend.c (do_friend): Check return value of warning before giving informative note. * parser.c (cp_parser_template_id): Likewise. testsuite/ * gcc.dg/pr36901-1.c: New. * gcc.dg/pr36901-3.c: New. * gcc.dg/pr36901-2.c: New. * gcc.dg/pr36901-4.c: New. * gcc.dg/pr36901-system.h: New. * gcc.dg/pr36901.h: New. * gcc.target/powerpc/altivec-macros.c: Update. * gcc.target/i386/regparm.c: Update. * gcc.dg/funcdef-var-1.c: Update. * gcc.dg/parm-mismatch-1.c: Update. * gcc.dg/attr-noinline.c: Update. * gcc.dg/wtr-static-1.c: Update. * gcc.dg/redecl-11.c: Update. * gcc.dg/pr27953.c: Update. * gcc.dg/proto-1.c: Update. * gcc.dg/decl-3.c: Update. * gcc.dg/redecl-13.c: Update. * gcc.dg/pr15360-1.c: Update. * gcc.dg/redecl-15.c: Update. * gcc.dg/enum-compat-1.c: Update. * gcc.dg/dll-3.c: Update. * gcc.dg/array-5.c: Update. * gcc.dg/Wredundant-decls-2.c: Update. * gcc.dg/inline4.c: Update. * gcc.dg/redecl-2.c: Update. * gcc.dg/inline-14.c: Update. * gcc.dg/tls/diag-3.c: Update. * gcc.dg/funcdef-var-2.c: Update. * gcc.dg/20041213-1.c: Update. * gcc.dg/old-style-then-proto-1.c: Update. * gcc.dg/decl-2.c: Update. * gcc.dg/redecl-12.c: Update. * gcc.dg/decl-4.c: Update. * gcc.dg/Wshadow-1.c: Update. * gcc.dg/transparent-union-2.c: Update. * gcc.dg/visibility-7.c: Update. * gcc.dg/dll-2.c: Update. * gcc.dg/redecl-16.c: Update. * gcc.dg/inline1.c: Update. * gcc.dg/decl-8.c: Update. * gcc.dg/nested-redef-1.c: Update. * gcc.dg/inline3.c: Update. * gcc.dg/redecl-1.c: Update. * gcc.dg/inline5.c: Update. * gcc.dg/pr35899.c: Update. * gcc.dg/noncompile/label-lineno-1.c: Update. * gcc.dg/noncompile/label-1.c: Update. * gcc.dg/noncompile/20020220-1.c: Update. * gcc.dg/noncompile/redecl-1.c: Update. * gcc.dg/redecl-5.c: Update. * gcc.dg/qual-return-3.c: Update. * gcc.dg/label-decl-4.c: Update. ........ r138896 | gccadmin | 2008-08-08 17:16:37 -0700 (Fri, 08 Aug 2008) | 1 line Daily bump. ........ r138898 | manu | 2008-08-08 17:30:41 -0700 (Fri, 08 Aug 2008) | 9 lines 2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR c++/12242 cp/ * cvt.c (ocp_convert): Warn for out-of-range conversions to enum. testsuite/ * g++.dg/warn/pr12242.C: New. ........ r138903 | manu | 2008-08-09 02:37:57 -0700 (Sat, 09 Aug 2008) | 6 lines 2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org> ada/ * gcc-interface/misc.c (gnat_handle_option): Replace set_Wunused by warn_unused. ........ r138904 | manu | 2008-08-09 05:37:32 -0700 (Sat, 09 Aug 2008) | 15 lines 2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR c/17880 * c-typeck.c (digest_init): Call verify_sequence_points from here. (c_finish_return): Likewise. (c_start_case): Likewise. * c-common.c (warn_for_collisions_1): Use explicit location in warning. * c-parser.c (c_parser_condition): New. Call verify_sequence_points. (c_parser_paren_condition): Call c_parser_condition. (c_parser_for_statement): Call c_parser_condition. testsuite/ * gcc.dg/sequence-pt-pr17880.c: New. ........ r138905 | paolo | 2008-08-09 08:02:30 -0700 (Sat, 09 Aug 2008) | 5 lines 2008-08-09 Paolo Carlini <paolo.carlini@oracle.com> * config/locale/darwin/ctype_members.cc: Include <cstdio>. ........ r138906 | paolo | 2008-08-09 08:58:52 -0700 (Sat, 09 Aug 2008) | 8 lines 2008-08-09 Paolo Carlini <paolo.carlini@oracle.com> Revert fix for libstdc++/35637, thanks to other/36901. * include/tr1_impl/type_traits (__is_function_helper): New, uses variadic templates. (is_function): Forward to the latter. (__in_array): Remove. ........ r138907 | rguenth | 2008-08-09 10:28:39 -0700 (Sat, 09 Aug 2008) | 31 lines 2008-08-09 Richard Guenther <rguenther@suse.de> * gimple.c (gimple_build_call_1): Deal with FUNCTION_DECL fn. * gimple.h (gimple_call_fn): Adjust comment. (gimple_call_set_fndecl): New function. (gimple_call_fndecl): Adjust for GIMPLE_CALL no longer having bare FUNCTION_DECL operand. (gimple_call_return_type): Likewise. * tree-cfg.c (verify_stmt): Verify function operand of a GIMPLE_CALL. * value-prof.c (gimple_divmod_fixed_value): Do not emit labels. (gimple_mod_pow2): Likewise. (gimple_mod_subtract): Likewise. (gimple_ic): Likewise. (gimple_stringop_fixed_value): Likewise. (gimple_indirect_call_to_profile): Fix for GIMPLE_CALL no longer having bare FUNCTION_DECL operand. * ipa-cp.c (ipcp_update_callgraph): Use gimple_call_set_fndecl. * omp-low.c (optimize_omp_library_calls): Likewise. * cgraphunit.c (update_call_expr): Likewise. * tree-ssa-math-opts.c (execute_cse_reciprocals): Likewise. (execute_convert_to_rsqrt): Likewise. * cfgexpand.c (gimple_to_tree): Simplify. (release_stmt_tree): Fix for GIMPLE_CALL no longer having bare FUNCTION_DECL operand. * tree-nested.c (init_tmp_var_with_call): Use gimple_call_return_type. (convert_gimple_call): Use gimple_call_fndecl. * c-common.c (c_warn_unused_result): Likewise. * gcc.dg/tree-ssa/inline-2.c: New testcase. ........ r138908 | rsandifo | 2008-08-09 11:10:18 -0700 (Sat, 09 Aug 2008) | 15 lines gcc/ 2008-08-09 Richard Sandiford <rdsandiford@googlemail.com> Daniel Jacobowitz <dan@codesourcery.com> * config/mips/mips.h (FUNCTION_NAME_ALREADY_DECLARED): Delete. * config/mips/linux.h (ASM_DECLARE_FUNCTION_NAME): Delete. (ASM_DECLARE_FUNCTION_SIZE, FUNCTION_NAME_ALREADY_DECLARED): Delete. * config/mips/mips.c (mips_start_function_definition): New function. (mips_end_function_definition): Likewise. (mips_output_function_prologue): Use mips_start_function_definition. (mips_output_function_epilogue): Use mips_end_function_definition. (build_mips16_function_stub): Use mips_start_function_definition and mips_end_function_definition. (build_mips16_call_stub): Likewise. ........ r138909 | rsandifo | 2008-08-09 11:11:19 -0700 (Sat, 09 Aug 2008) | 13 lines gcc/ * config/mips/mips.h (STATIC_CHAIN_REGNUM): Remap to $15. (FUNCTION_PROFILER): Save the static chain pointer into $2 beforehand and restore it aftewards. (TRAMPOLINE_TEMPLATE): Adjust accordingly. Load the target address directly into $25 and call the function through $25; do not clobber $3. Pad the DImode version to cover the space left by the deleted $25 <- $3 move. (TRAMPOLINE_SIZE): Adjust the size of the SImode version after the removal of the $25 <- $3 move. (INITIALIZE_TRAMPOLINE): Update offsets accordingly. * config/mips/sdemtk.h (FUNCTION_PROFILER): As for mips.h. ........ r138910 | rsandifo | 2008-08-09 11:19:32 -0700 (Sat, 09 Aug 2008) | 5 lines gcc/ * config/mips/mips.h (MASK_RETURN_ADDR): Expand commentary. * config/mips/linux-unwind.h (mips_fallback_frame_state): Add 2 rather than 4 to PC. ........ r138911 | rsandifo | 2008-08-09 11:21:50 -0700 (Sat, 09 Aug 2008) | 6 lines gcc/ * config/mips/mips.c (mips_unspec_address_offset): Move earlier in file. (mips_unspec_address, mips_unspec_offset_high): Likewise. (mips_ok_for_lazy_binding_p, mips_load_call_address): Likewise. (mips16_cfun_returns_in_fpr_p): Likewise. ........ r138912 | rsandifo | 2008-08-09 12:08:15 -0700 (Sat, 09 Aug 2008) | 148 lines * configure.ac (mips*-*-*linux*, mips*-*-gnu*): Use mt-mips-gnu. * configure: Regenerate. config/ * mt-mips16-compat: New file, taken from mt-mips-elfoabi. * mt-mips-elfoabi: Include mt-mips16-compat. * mt-mips-gnu: New file. gcc/ * config.gcc (mips*-*-linux*, mips64*-*-linux*): Add mips/t-libgcc-mips16 to tmake_file. * config/mips/mips-protos.h (mips_call_type): New enum. (mips_pic_base_register, mips_got_load): Declare. (mips_restore_gp): Take an rtx argument. (mips_use_pic_fn_addr_reg_p): Declare. (mips_expand_call): Replace the sibcall_p argument with a mips_call_type argument. Add a lazy_p parameter. (mips_split_call): Declare. * config/mips/mips.h (MIPS16_PIC_TEMP_REGNUM): New macro. (MIPS16_PIC_TEMP): Likewise. (reg_class): Delete M16_NA_REGS. (REG_CLASS_NAMES, REG_CLASS_CONTENTS): Update accordingly. (SYMBOL_FLAG_BIND_NOW, SYMBOL_REF_BIND_NOW_P): New macros. (mips_split_hi_p): Declare. * config/mips/mips.c (mips_split_hi_p): New array. (mips_regno_to_class): Change M16_NA_REGS entries to M16_REGS. (mips_got_symbol_type_p): New function. (mips_global_symbol_p): Check SYMBOL_REF_EXTERNAL_P. (mips16_stub_function_p): New function. (mips16_local_function_p): Likewise. (mips_use_pic_fn_addr_reg_p): Likewise. (mips_cannot_force_const_mem): Return false for HIGHs. Extend CONST_INT and symbolic handling to MIPS16, using mips_symbol_insns to check that the base symbol type is a legitimate constant. Reject GOT-based constants if TARGET_MIPS16_PCREL_LOADS. (mips_const_insns): Check targetm.cannot_force_const_mem when decomposing a symbolic base and a large offset. (mips_emit_call_insn): Add ORIG_ADDR and ADDR parameters. When calling a function that needs $25 from MIPS16 code, move the target address into $25 separately and add a USE to the call insn. (mips16_gp_pseudo_reg): Insert the initializer immediately before the first real insn. (mips_pic_base_register, mips_got_load): New functions. (mips_split_symbol): Generalize the name of the LO_SUM_OUT parameter to LOW_OUT. Say that it can be any valid SET_SRC when splitting a load-address operation. Split SYMBOL_GOT_DISP constants and highs of SYMBOL_GOT_PAGE_OFST constants. (mips_call_tls_get_addr): Update the call to mips_expand_call, also passing NULL_RTX rather than const0_rtx as the aux argument. (mips_rewrite_small_data_p): Check mips_lo_relocs and mips_split_p instead of TARGET_EXPLICIT_RELOCS. (mips_ok_for_lazy_binding_p): Check SYMBOL_REF_BIND_NOW_P. (mips_load_call_address): Replace the sibcall_p argument with a mips_call_type argument. Use mips_got_load. (mips16_local_alias): New structure. (mips16_local_aliases): New variable. (mips16_local_aliases_hash): New function. (mips16_local_aliases_eq): Likewise. (mips16_local_alias): Likewise. (mips16_stub_function): Likewise. (mips16_build_function_stub): Create a local alias for the target function. Handle TARGET_ABICALLS. For PIC abicalls, emit a .cpload directive and an R_MIPS_NONE relocation for the target function, then load the alias rather than the function itself. Wrap the non-PIC abicalls version in ".option pic0/.option pic2". (mips16_copy_fpr_return_value): Use mips16_stub_function and mips_expand_call. Set SYMBOL_REF_BIND_NOW on the symbol. (mips16_build_call_stub): Replace the FN parameter with an FN_PTR parameter. Force the address into a register if it isn't a call_insn_operand; don't rely on the caller to do this. If a call to a locally-defined and locally-binding MIPS16 function must be made indirectly, redirect the call to the function's local alias. Use mips16_stub_function_p, mips16_stub_function, mips_expand_call and use_reg. Set SYMBOL_FLAG_BIND_NOW on __mips_call_* symbols. Use explicit %hi and %lo accesses where possible. Use MIPS_CALL to generate the correct code form of a jal instruction. Add clobbers of $18 instead of uses. Update the call to mips_emit_call_insn. (mips_expand_call): Replace the SIBCALL_P argument with a mips_call_type argument and handle the new MIPS_CALL_EPILOGUE value. Take a LAZY_P parameter. Call mips16_build_call_stub first, allowing it to modify the call address. Update the calls to mips_load_call_address and mips_emit_call_insn. (mips_split_call): New function. (mips_init_relocs): Clear mips_split_hi_p. Only use %gp_rel if !TARGET_MIPS16. Split SYMBOL_GOT_DISP, and the high parts of SYMBOL_GOT_PAGE_OFST, for MIPS16 code. (mips_global_pointer): Check mips16_cfun_returns_in_fpr_p. (mips_extra_live_on_entry): Include MIPS16_PIC_TEMP_REGNUM if TARGET_MIPS16. (mips_cprestore_slot): New function. (mips_restore_gp): Take a TEMP parameter. Handle TARGET_MIPS16 and use mips_cprestore_slot. (mips_output_function_prologue): Handle TARGET_MIPS16 for LOADGP_OLDABI. (mips_emit_loadgp): Move into MIPS16_PIC_TEMP for MIPS16, then use a copygp_mips16 instruction to set up $28. (mips_expand_prologue): Initialize the cprestore slot for MIPS16 too. (mips16_lay_out_constants): Call split_all_insns_noflow. (mips_reorg_process_insns): Explicitly set all_noreorder_p to false if TARGET_MIPS16. (mips_reorg): Don't call vr4130_align_insns if TARGET_MIPS16. (mips_output_mi_thunk): Use mips_got_symbol_type_p. Use the mips_dangerous_for_la25_p approach for MIPS16 PIC calls too. (mips_set_mips16_mode): Always set MASK_EXPLICIT_RELOCS for MIPS16 code. Allow MIPS16 o32 PIC. (mips_override_options): Allow MIPS16 o32 PIC. * config/mips/mips.md: Lower CONST_GP_P moves into register moves after reload if TARGET_USE_GOT. (UNSPEC_COPYGP): New constant. (length): Use a default length of 8 for MIPS16 GOT loads. (*got_disp<mode>): Check mips_split_p instead of TARGET_XGOT. (*got_page<mode>): Check mips_split_hi_p. (*got_disp<mode>, *got_page<mode>): Use mips_got_load. (unspec_got<mode>, unspec_call<mode>): New expanders. (load_got<mode>, load_call<mode>): Remove the length attributes. Use a got attribute instead of a type attribute. (copygp_mips16): New insn. (restore_gp): Add a scratch clobber and pass it to mips_restore_gp. (load_call<mode>): Use a "d" constraint instead of an "r" constraint. (sibcall, sibcall_value, call, call_value): Update the calls to mips_expand_call. (call_internal, call_value_internal): Use mips_split_call. (call_value_multiple_internal): Likewise. (call_split): Move after call_internal (the insn it is split from). (call_internal_direct, call_value_internal_direct): Turn into define_insn_and_splits. Split if TARGET_SPLIT_CALLS. (call_direct_split, call_value_direct_split): New patterns. * config/mips/constraints.md (c): Handle TARGET_MIPS16 first and use M16_REGS instead of M16_NA_REGS. * config/mips/predicates.md (const_call_insn_operand): Replace the TARGET_ABSOLUTE_ABICALLS-based check with a more general mips_use_pic_fn_addr_reg_p check. (move_operand): Reject HIGHs if mips_split_hi_p. * config/mips/mips16.S: Assembly as empty if the ABI is not suitable. (__mips16_floatunsisf): Inline __mips16_floatsisf. (CALL_STUB_NO_RET, CALL_STUB_REG): Copy the target register to $25. * config/mips/libgcc-mips16.ver: New file. * config/mips/t-libgcc-mips16 (SHLIB_MAPFILES): Add $(srcdir)/config/mips/libgcc-mips16.ver. gcc/testsuite/ * lib/target-supports.exp (check_profiling_available): Return false for -p and -pg on MIPS16 targets. ........ r138914 | jvdelisle | 2008-08-09 12:17:24 -0700 (Sat, 09 Aug 2008) | 6 lines 2008-07-22 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/36582 * io/list_read.c: If variable rank is zero, do not adjust the found namelist object pointer. Fix ChangeLog. ........ r138915 | aesok | 2008-08-09 12:58:25 -0700 (Sat, 09 Aug 2008) | 6 lines * config/avr/avr.c (avr_mcu_types): Move the AT43USB320 device to avr31 architecture. * config/avr/avr.h (CRT_BINUTILS_SPECS): (Ditto.). * config/avr/t-avr (MULTILIB_MATCHES): (Ditto.). ........ r138916 | hjl | 2008-08-09 14:47:28 -0700 (Sat, 09 Aug 2008) | 8 lines 2008-08-09 Jan Hubicka <jh@suse.cz> PR target/37055 * optabs.c (maybe_emit_unop_insn): Remove produced code if expansion failed. (expand_fix): Be prepared for expansion to fail. (expand_sfix_optab): Remove instructions if expansion failed. ........ r138917 | jsm28 | 2008-08-09 16:30:44 -0700 (Sat, 09 Aug 2008) | 2 lines * sv.po: Update. ........ r138921 | gccadmin | 2008-08-09 17:16:36 -0700 (Sat, 09 Aug 2008) | 1 line Daily bump. ........ r138924 | pinskia | 2008-08-09 21:54:37 -0700 (Sat, 09 Aug 2008) | 13 lines 2008-08-09 Andrew Pinski <andrew_pinski@playstation.sony.com> PR middle-end/36238 * reload1.c (gen_reload): Guard calls to get_secondary_mem for memory subregs. 2008-08-09 Andrew Pinski <andrew_pinski@playstation.sony.com> PR middle-end/36238 * gcc.c-torture/compile/pr36238.c: New testcase. ........ r138925 | paolo | 2008-08-10 03:11:46 -0700 (Sun, 10 Aug 2008) | 14 lines 2008-08-10 Paolo Carlini <paolo.carlini@oracle.com> * include/tr1_impl/type_traits (_DEFINE_SPEC*): Simplify. (_DEFINE_SPEC_BODY): Remove. (__is_void_helper, __is_integral_helper, __is_floating_point_helper, __is_member_object_pointer_helper, __is_member_function_pointer_helper, __remove_pointer_helper): Add. (is_void, is_integral, is_floating_point, is_member_object_pointer, is_member_function_pointer, remove_pointer): Use the latter. * include/tr1/type_traits (_DEFINE_SPEC): Simplify. (_DEFINE_SPEC_HELPER): Remove. (__is_signed_helper, __is_unsigned_helper): Add. (is_signed, is_unsigned): Use the latter. ........ r138932 | manu | 2008-08-10 11:32:52 -0700 (Sun, 10 Aug 2008) | 8 lines 2008-08-10 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR 36901 testsuite/ * gcc.dg/pr36901.h: Do not depend on limits.h. * gcc.dg/pr36901-3.c: Update. * gcc.dg/pr36901-4.c: Update. ........ r138933 | manu | 2008-08-10 11:46:10 -0700 (Sun, 10 Aug 2008) | 13 lines 2008-08-10 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR middle-end/20644 * tree-ssa.c (struct walk_data): Add new flag warn_possibly_uninitialized. (warn_uninitialized_var): Use it. (warn_uninitialized_vars): New. (execute_early_warn_uninitialized): Call it. (execute_late_warn_uninitialized): Likewise. testsuite/ * gcc.dg/uninit-pr20644-O0.c: New. * gcc.dg/uninit-pr20644.c: New. ........ r138934 | sam | 2008-08-10 13:13:24 -0700 (Sun, 10 Aug 2008) | 13 lines 2008-08-10 Samuel Tardieu <sam@rfc1149.net> Robert Dewar <dewar@adacore.com> gcc/ada/ * exp_ch4.adb (Expand_N_Op_Expon): Force evaluation of left argument even when right argument is 0. (Expand_N_Op_Mod): Ditto when right argument is 1. (Expand_N_Op_Multiply): Ditto when any argument is 0. (Expand_N_Op_Rem): Ditto when right argument is 1. 2008-08-10 Samuel Tardieu <sam@rfc1149.net> gcc/testsuite/ * gnat.dg/exp0_eval.adb: New. ........ r138936 | dje | 2008-08-10 16:37:04 -0700 (Sun, 10 Aug 2008) | 2 lines Fix typo in "Software". ........ r138939 | gccadmin | 2008-08-10 17:16:51 -0700 (Sun, 10 Aug 2008) | 1 line Daily bump. ........ r138950 | krebbel | 2008-08-10 23:55:39 -0700 (Sun, 10 Aug 2008) | 7 lines 2008-08-11 Andreas Krebbel <krebbel1@de.ibm.com> * gcc.target/s390/20080806-1.c: Move testcase ... * gcc.c-torture/compile/20080806-1.c: ... to here and make it stack size sensitive. ........ r138951 | jakub | 2008-08-11 03:23:08 -0700 (Mon, 11 Aug 2008) | 6 lines PR rtl-optimization/36998 * dwarf2out.c (compute_barrier_args_size_1, compute_barrier_args_size): Temporarily remove assertions. * gcc.dg/pr36998.c: New test. ........ r138953 | matz | 2008-08-11 05:15:37 -0700 (Mon, 11 Aug 2008) | 4 lines * i386/i386.c: (override_options): Move initialisation from flag_schedule_insns_after_reload to here from ... (optimization_options): ... here. ........ r138954 | paolo | 2008-08-11 08:08:20 -0700 (Mon, 11 Aug 2008) | 5 lines 2008-08-11 Paolo Carlini <paolo.carlini@oracle.com> * configure.ac: Run GLIBCXX_CHECK_STDIO_MACROS unconditionally. * configure: Regenerate. ........ r138957 | sam | 2008-08-11 10:04:07 -0700 (Mon, 11 Aug 2008) | 6 lines 2008-08-11 Joel Sherrill <joel.sherrill@oarcorp.com> gcc/ada/ * s-oscons-tmplt.c: RTEMS defines AF_INET6 but does support it. * gsocket.h, socket.c: Update to support RTEMS. * gcc-interface/Make-lang.in: Include CFLAGS_FOR_TARGET when cross. ........ r138966 | paolo | 2008-08-11 12:28:35 -0700 (Mon, 11 Aug 2008) | 4 lines 2008-08-11 Paolo Carlini <paolo.carlini@oracle.com> * config/locale/generic/c_locale.cc: Include <cstdio>. ........ r138967 | smw | 2008-08-11 14:06:00 -0700 (Mon, 11 Aug 2008) | 1 line Formatting fixes for include/tr1_impl/regex. ........ r138970 | gccadmin | 2008-08-11 17:16:43 -0700 (Mon, 11 Aug 2008) | 1 line Daily bump. ........ r138974 | dannysmith | 2008-08-11 22:42:28 -0700 (Mon, 11 Aug 2008) | 5 lines * g-stsifd-sockets.adb (Create): Replace Constants.SOCK_STREAM with SOSC.SOCK__STREAM. * g-socthi-mingw.adb (C_Select) Replace Constants.MSG_OOB with SOSC.MSG_OOB. ........ r138978 | dannysmith | 2008-08-11 23:01:59 -0700 (Mon, 11 Aug 2008) | 4 lines * gcc-interface/Makefile.in (EXTRA_GNATRTL_NONTASKING_OBJS) [WINDOWS]: Remove duplicate s-win32.o. Add s-winext.o. ........ r138988 | irar | 2008-08-11 23:31:57 -0700 (Mon, 11 Aug 2008) | 15 lines * tree-vectorizer.c: Depend on langhooks.h. (supportable_widening_operation): Add two arguments. Support double type conversions. (supportable_narrowing_operation): Likewise. * tree-vectorizer.h (supportable_widening_operation): Add two arguments. (supportable_narrowing_operation): Likewise. * tree-vect-patterns.c (vect_recog_widen_mult_pattern) : Call supportable_widening_operation with correct arguments. * tree-vect-transform.c (vectorizable_conversion): Likewise. (vectorizable_type_demotion): Support double type conversions. (vectorizable_type_promotion): Likewise. * Makefile.in (tree-vectorizer.o): Depend on langhooks.h. ........ r138995 | reichelt | 2008-08-11 23:57:53 -0700 (Mon, 11 Aug 2008) | 2 lines Fix my email address. ........ r139004 | jakub | 2008-08-12 01:07:57 -0700 (Tue, 12 Aug 2008) | 6 lines PR c++/36688 * gimplify.c (gimplify_modify_expr_rhs): Test TREE_READONLY on the VAR_DECL instead of TYPE_READONLY on its type. * g++.dg/init/const6.C: New test. ........ r139005 | jakub | 2008-08-12 01:28:30 -0700 (Tue, 12 Aug 2008) | 2 lines dg-do run the test instead of compile. ........ r139008 | paolo | 2008-08-12 03:41:26 -0700 (Tue, 12 Aug 2008) | 10 lines 2008-08-12 Paolo Carlini <paolo.carlini@oracle.com> * configure.ac: Run unconditionally GLIBCXX_CHECK_INT64_T and GLIBCXX_CHECK_C99_TR1; remove sigsetjmp and mmap checks (unused). * crossconfig.m4: Adjust; remove HAVE_GETPAGESIZE defines (unused). * configure: Regenerate. * config.h.in: Likewise. * acinclude.m4: Minor formatting fixes. ........ r139009 | uweigand | 2008-08-12 06:06:32 -0700 (Tue, 12 Aug 2008) | 2 lines * config/spu/spu.h (DWARF_FRAME_RETURN_COLUMN): Define. ........ r139011 | uweigand | 2008-08-12 06:09:09 -0700 (Tue, 12 Aug 2008) | 2 lines * config/spu/spu.c (spu_safe_dma): Respect TARGET_SAFE_DMA. ........ r139013 | uweigand | 2008-08-12 06:13:38 -0700 (Tue, 12 Aug 2008) | 17 lines ChangeLog: * real.c (spu_single_format): New variable. * real.h (spu_single_format): Declare. * config/spu/spu.c (spu_override_options): Install SFmode format. (spu_split_immediate): Use integer mode to operate on pieces of floating-point values in all cases. * config/spu/spu.md (UNSPEC_FLOAT_EXTEND, UNSPEC_FLOAT_TRUNCATE): New. ("extendsfdf2"): Use UNSPEC_FLOAT_EXTEND instead of FLOAT_EXTEND. ("truncdfsf2"): Use UNSPEC_FLOAT_TRUNCATE instead of FLOAT_TRUNCATE. testsuite/ChangeLog: * gcc.c-torture/execute/ieee/inf-2.c (testf): Skip on the SPU. ........ r139014 | uweigand | 2008-08-12 06:19:40 -0700 (Tue, 12 Aug 2008) | 38 lines ChangeLog: * real.h (struct real_format): New member round_towards_zero. * real.c (round_for_format): Respect fmt->round_towards_zero. (ieee_single_format, mips_single_format, motorola_single_format, spu_single_format, ieee_double_format, mips_double_format, motorola_double_format, ieee_extended_motorola_format, ieee_extended_intel_96_format, ieee_extended_intel_128_format, ieee_extended_intel_96_round_53_format, ibm_extended_format, mips_extended_format, ieee_quad_format, mips_quad_format, vax_f_format, vax_d_format, vax_g_format): Initialize it. * config/pdp11/pdp11.c (pdp11_f_format, pdp11_d_format): Likewise. * builtins.s (do_mpfr_arg1): Consider round_towards_zero member of real_format to choose rounding mode when calling MPFR functions. (do_mpfr_arg2, do_mpfr_arg3, do_mpfr_sincos): Likewise. (do_mpfr_bessel_n, do_mpfr_remquo, do_mpfr_lgamma_r): Likewise. * real.h (real_to_decimal_for_mode): Add prototype. * real.c (real_to_decimal_for_mode): Renames old real_to_decimal. Respect target rounding mode when generating decimal representation. (real_to_decimal): New stub for backwards compatibility. * c-cppbuiltin.c (builtin_define_with_hex_fp_value): Use real_to_decimal_for_mode instead of real_to_decimal. * config/spu/spu.md ("floatdisf2", "floatunsdisf2"): New. testsuite/ChangeLog: * gcc.c-torture/execute/20031003-1.c (main): Update test to accommodate SPU single-precision rounding mode. * gcc.c-torture/execute/conversion.c (test_float_to_integer, test_float_to_longlong_integer): Likewise. * gcc.c-torture/execute/ieee/rbug.c (main): Likewise. * gcc.dg/hex-round-1.c: Skip test on SPU. * gcc.dg/hex-round-2.c: Likewise. ........ r139015 | uweigand | 2008-08-12 06:22:27 -0700 (Tue, 12 Aug 2008) | 5 lines * config/spu/float_disf.c: New file. * config/spu/float_unsdisf.c: New file. * config/spu/t-elf (LIB2FUNCS_STATIC_EXTRA): Add them. (LIB2FUNCS_EXCLUDE): Define. ........ r139016 | uweigand | 2008-08-12 06:25:22 -0700 (Tue, 12 Aug 2008) | 36 lines * real.h (struct real_format): New member has_sign_dependent_rounding. * real.c (ieee_single_format, mips_single_format, motorola_single_format, spu_single_format, ieee_double_format, mips_double_format, motorola_double_format, ieee_extended_motorola_format, ieee_extended_intel_96_format, ieee_extended_intel_128_format, ieee_extended_intel_96_round_53_format, ibm_extended_format, mips_extended_format, ieee_quad_format, mips_quad_format, vax_f_format, vax_d_format, vax_g_format): Initialize it. * config/pdp11/pdp11.c (pdp11_f_format, pdp11_d_format): Likewise. * defaults.h (MODE_HAS_NANS, MODE_HAS_INFINITIES, MODE_HAS_SIGNED_ZEROS, MODE_HAS_SIGN_DEPENDENT_ROUNDING): Remove. * config/spu/spu.h (MODE_HAS_NANS, MODE_HAS_INFINITIES, MODE_HAS_SIGN_DEPENDENT_ROUNDING): Remove. (ROUND_TOWARDS_ZERO): Likewise. * real.h (REAL_MODE_FORMAT): Protect MODE against macro expansion. (FLOAT_MODE_FORMAT): New macro. (REAL_MODE_FORMAT_COMPOSITE_P): Remove, replace by ... (MODE_COMPOSITE_P): ... this new macro. (MODE_HAS_NANS, MODE_HAS_INFINITIES, MODE_HAS_SIGNED_ZEROS, MODE_HAS_SIGN_DEPENDENT_ROUNDING): New macros. * machmode.h (GET_MODE_INNER): Cast result to enum machine_mode. * flags.h: Include "real.h". * fold-const.c (const_binop): Use MODE_COMPOSITE_P instead of REAL_MODE_FORMAT_COMPOSITE_P. * simplify-rtx.c (simplify_const_binary_operation): Likewise. * doc/tm.texi (Storage Layout): Remove documentation of MODE_HAS_NANS, MODE_HAS_INFINITIES, MODE_HAS_SIGNED_ZEROS, MODE_HAS_SIGN_DEPENDENT_ROUNDING. Update documentation of ROUND_TOWARDS_ZERO and LARGEST_EXPONENT_IS_NORMAL to clarify they only apply to libgcc2.a. ........ r139017 | uweigand | 2008-08-12 06:27:30 -0700 (Tue, 12 Aug 2008) | 21 lines ChangeLog: * defaults.h (TARGET_FLOAT_FORMAT): Remove. (UNKNOWN_FLOAT_FORMAT, IEEE_FLOAT_FORMAT, VAX_FLOAT_FORMAT): Remove. * config/alpha/alpha.h (TARGET_FLOAT_FORMAT): Remove. * config/iq2000/iq2000.h (TARGET_FLOAT_FORMAT): Remove. * config/pdp11/pdp11.h (TARGET_FLOAT_FORMAT): Remove. * config/score/score.h (TARGET_FLOAT_FORMAT): Remove. * config/vax/vax.h (TARGET_FLOAT_FORMAT): Remove. * doc/tm.texi (Storage Layout): Remove documentation for TARGET_FLOAT_FORMAT. * simplify-rtx.c (simplify_binary_operation_1): Replace TARGET_FLOAT_FORMAT check by appropriate HONOR_... checks. java/ChangeLog: * typeck.c (convert): Do not check for TARGET_FLOAT_FORMAT. ........ r139019 | uweigand | 2008-08-12 07:35:54 -0700 (Tue, 12 Aug 2008) | 8 lines PR bootstrap/37097 * builtins.c (do_mpfr_bessel_n): Fix copy-and-paste bug introduced by last change. -This line, and those below, will be ignored-- M gcc/builtins.c M gcc/ChangeLog ........ r139024 | aesok | 2008-08-12 10:13:45 -0700 (Tue, 12 Aug 2008) | 2 lines * final.c (final_scan_insn): Use app_enable/app_disable functions. ........ r139025 | aesok | 2008-08-12 10:22:28 -0700 (Tue, 12 Aug 2008) | 1 line Fix final.c. ........ r139026 | singler | 2008-08-12 10:23:00 -0700 (Tue, 12 Aug 2008) | 7 lines 2008-08-12 Johannes Singler <singler@ira.uka.de> * include/paralle/losertree.h (LoserTreePointerBase<>::~LoserTreePointerBase): Replace delete by appropriate delete[]. ........ r139028 | jakub | 2008-08-12 10:57:49 -0700 (Tue, 12 Aug 2008) | 6 lines PR tree-optimization/37084 * tree-inline.c (copy_bb): Call gimple_regimplify_operands if id->regimplify, don't assume stmt is a cast assignment. * g++.dg/tree-ssa/pr37084.C: New test. ........ r139029 | jakub | 2008-08-12 11:05:43 -0700 (Tue, 12 Aug 2008) | 7 lines PR middle-end/37014 * expr.c (expand_expr_real_1): Handle TRUTH_ANDIF_EXPR and TRUTH_ORIF_EXPR. * dojump.c (do_jump): Likewise. * gcc.c-torture/compile/20080812-1.c: New test. ........ r139031 | froydnj | 2008-08-12 11:19:08 -0700 (Tue, 12 Aug 2008) | 4 lines PR libgomp/26165 * gcc.c (include_spec_function): Tweak call to find_a_file. ........ r139034 | paolo | 2008-08-12 12:38:02 -0700 (Tue, 12 Aug 2008) | 15 lines /cp 2008-08-12 Paolo Carlini <paolo.carlini@oracle.com> PR c++/37087 * parser.c (cp_parser_class_head): Early return error_mark_node in case of global qualification of class name or qualified name that does not name a class. /testsuite 2008-08-12 Paolo Carlini <paolo.carlini@oracle.com> PR c++/37087 * g++.dg/template/crash80.C: New. * g++.old-deja/g++.other/decl5.C: Adjust. ........ r139035 | paolo | 2008-08-12 13:05:02 -0700 (Tue, 12 Aug 2008) | 4 lines 2008-08-12 Paolo Carlini <paolo.carlini@oracle.com> * g++.old-deja/g++.other/decl5.C: Expand new expected errors. ........ r139036 | paolo | 2008-08-12 13:05:15 -0700 (Tue, 12 Aug 2008) | 4 lines 2008-08-12 Paolo Carlini <paolo.carlini@oracle.com> * g++.old-deja/g++.other/decl5.C: Expand new expected errors. ........ r139037 | janis | 2008-08-12 14:18:54 -0700 (Tue, 12 Aug 2008) | 3 lines PR testsuite/36087 * gcc.dg/var-expand3.c: Fix name of dump file. ........ r139038 | janis | 2008-08-12 14:20:57 -0700 (Tue, 12 Aug 2008) | 2 lines * doc/invoke.texi: Revert unintended checkin. ........ r139039 | janis | 2008-08-12 14:23:11 -0700 (Tue, 12 Aug 2008) | 6 lines * gcc.target/i386/pr32000-2.c: Use dg-skip-if for target expression. * gcc.target/i386/stackalign/return-3.c: Ditto. * gcc.target/sparc/ultrasp3.c: Ditto. * lib/target-supports-dg.exp (dg-require-effective-target): Error if argument is not a single effective-target keyword. ........ r139040 | paolo | 2008-08-12 16:14:10 -0700 (Tue, 12 Aug 2008) | 5 lines 2008-08-12 Paolo Carlini <paolo.carlini@oracle.com> PR libstdc++/37100 * include/bits/stl_pair.h: Fix documentation URL in comment. ........ r139042 | janis | 2008-08-12 16:46:45 -0700 (Tue, 12 Aug 2008) | 2 lines * doc/invoke.texi (-fipa-pta): Say the option is experimental. ........ r139045 | gccadmin | 2008-08-12 17:16:36 -0700 (Tue, 12 Aug 2008) | 1 line Daily bump. ........ r139048 | rguenth | 2008-08-13 01:57:20 -0700 (Wed, 13 Aug 2008) | 30 lines 2008-08-13 Richard Guenther <rguenther@suse.de> PR tree-optimization/15255 * tree-ssa-reassoc.c (linearize_expr_tree): Declare. (struct oecount_s): New struct and VEC types. (cvec): New global. (oecount_hash): New function. (oecount_eq): Likewise. (oecount_cmp): Likewise. (zero_one_operation): New function. (build_and_add_sum): Likewise. (undistribute_ops_list): Perform un-distribution of multiplication and division on the chain of summands. (should_break_up_subtract): Also break up subtracts for factors. (reassociate_bb): Delete dead visited statements. Call undistribute_ops_list. Re-sort and optimize if it did something. * passes.c (init_optimization_passes): Move DSE before reassociation. * tree-ssa-loop-niter.c (stmt_dominates_stmt_p): Correctly handle PHI nodes. * gcc.dg/tree-ssa/reassoc-14.c: New testcase. * gcc.dg/tree-ssa/reassoc-15.c: Likewise. * gcc.dg/tree-ssa/reassoc-16.c: Likewise. * gcc.dg/torture/reassoc-1.c: Likewise. * gcc.dg/tree-ssa/recip-2.c: Adjust. * gcc.dg/tree-ssa/recip-6.c: Likewise. * gcc.dg/tree-ssa/recip-7.c: Likewise. * gfortran.dg/reassoc_4.f: Likewise. ........ r139049 | manu | 2008-08-13 03:01:52 -0700 (Wed, 13 Aug 2008) | 15 lines 2008-08-13 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR 35635 * c-common.c (conversion_warning): Use a switch. Ignore boolean expressions except for conversions to signed:1 bitfields. Handle COND_EXPR with constant operands. testsuite/ * gcc.dg/pr35635.c: New. * gcc.dg/Wconversion-integer.c: Update. * gcc.dg/Wconversion-integer-no-sign.c: Update. * gcc.dg/Wsign-conversion.c: Update. * g++.dg/warn/pr35635.C: New. * g++.dg/warn/Wconversion-integer.C: Update. * g++.dg/warn/Wsign-conversion.C: Update. ........ r139050 | manu | 2008-08-13 03:19:03 -0700 (Wed, 13 Aug 2008) | 15 lines 2008-08-13 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR c/15236 * diagnostic.c (pedwarn_at): New. * toplev.h (pedwarn_at): Declare. * c-tree.h (build_enumerator): Update declaration. * c-decl.c (finish_enum): Update comment. (build_enumerator): Take a location parameter. Give a pedwarn but do not perform any conversion. * c-parser.c (c_parser_enum_specifier): Set correct location for enumerator. testsuite/ * gcc.dg/pr15236.c: New. * gcc.dg/torture/pr25183.c: Update. ........ r139051 | sam | 2008-08-13 03:57:43 -0700 (Wed, 13 Aug 2008) | 14 lines gcc/ada/ PR ada/36777 * sem_util.ads, sem_util.adb (Is_Protected_Self_Reference): New. * sem_attr.adb (Check_Type): The current instance of a protected object is not a type name. (Analyze_Access_Attribute): Accept instances of protected objects. (Analyze_Attribute, Attribute_Address clause): Ditto. * exp_attr.adb (Expand_N_Attribute_Reference): Rewrite the prefix as being the current instance if needed. gcc/testsuite/ PR ada/36777 * gnat.dg/protected_self_ref1.adb, gnat.dg/protected_self_ref2.adb: New. ........ r139052 | aldyh | 2008-08-13 03:58:47 -0700 (Wed, 13 Aug 2008) | 2 lines new file ........ r139053 | jsm28 | 2008-08-13 04:51:41 -0700 (Wed, 13 Aug 2008) | 3 lines * config/sparc/linux64.h (LINK_ARCH32_SPEC, LINK_ARCH64_SPEC, LINK_SPEC): Use %R in -Y P argument. ........ r139054 | manu | 2008-08-13 05:26:18 -0700 (Wed, 13 Aug 2008) | 4 lines 2008-08-13 Manuel Lopez-Ibanez <manu@gcc.gnu.org> * toplev.h (pedwarn_at): Fix declaration. ........ r139061 | rguenth | 2008-08-13 07:22:19 -0700 (Wed, 13 Aug 2008) | 17 lines 2008-08-13 Richard Guenther <rguenther@suse.de> * tree.h (maybe_fold_offset_to_address): Declare. * tree-ssa-ccp.c (surely_varying_stmt_p): Fix typo in last commit. (ccp_fold): Handle pointer conversions the same as fold_stmt. Likewise for POINTER_PLUS_EXPR. (maybe_fold_offset_to_reference): Enable disabled code. (maybe_fold_offset_to_address): New function. (fold_stmt_r): Use it. (fold_gimple_assign): Likewise. * gimplify.c (gimplify_conversion): Use maybe_fold_offset_to_address. (gimplify_expr): Likewise. * gcc.dg/tree-ssa/ssa-ccp-21.c: New testcase. * gcc.dg/tree-ssa/ssa-ccp-22.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-23.c: Likewise. ........ r139062 | hjl | 2008-08-13 09:20:42 -0700 (Wed, 13 Aug 2008) | 6 lines 2008-08-13 H.J. Lu <hongjiu.lu@intel.com> PR middle-end/36701 * expr.c (emit_group_store): Allocate stack temp with the largest alignment when copying from register to stack. ........ r139063 | manu | 2008-08-13 10:57:47 -0700 (Wed, 13 Aug 2008) | 30 lines 2008-08-13 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR 30551 * doc/invoke.texi (Wmain): Update. * c-decl.c (start_decl): warn_main is only 0 or 1. (start_function): Likewise. Fix formatting. (finish_function): Delete redundant warning. * c.opt (Wmain): Add Var(warn_main) and Init(-1). * c-opts (c_common_handle_option): -Wall only has effect if warn_main is uninitialized. OPT_Wmain is automatically handled. -pedantic also enables Wmain. (c_common_post_options): Handle all logic for Wmain here. * c-common.c (warn_main): Delete. (check_main_parameter_types): Make pedwarns conditional on OPT_Wmain. * c-common.h (warn_main): Delete. cp/ * decl.c (grokfndecl): Call check_main_parameters_type only if -Wmain. testsuite/ * gcc.dg/pr30551.c: New. * gcc.dg/pr30551-2.c: New. * gcc.dg/pr30551-3.c: New. * gcc.dg/pr30551-4.c: New. * gcc.dg/pr30551-5.c: New. * gcc.dg/pr30551-6.c: New. * gcc.dg/tree-ssa/reassoc-3.c: Don't compile with -pedantic-errors. * g++.dg/warn/pr30551.C: New. * g++.dg/warn/pr30551-2.C: New. ........ r139064 | paolo | 2008-08-13 11:14:51 -0700 (Wed, 13 Aug 2008) | 35 lines 2008-08-13 Sebastian Redl <sebastian.redl@getdesigned.at> Add exception propagation support as per N2179. * libsupc++/exception_ptr.h (exception_ptr, current_exception, copy_exception, rethrow_exception): New file, implement exception propagation. * libsupc++/eh_ptr.cc (exception_ptr, current_exception, rethrow_exception, __gxx_dependent_exception_cleanup): Likewise. * libsupc++/unwind-cxx.h (__cxa_exception): Add reference count. (__cxa_dependent_exception, __cxa_allocate_dependent_exception, __cxa_free_dependent_exception, __get_dependent_exception_from_ue, __GXX_INIT_DEPENDENT_EXCEPTION_CLASS, __is_dependent_exception, __gxx_dependent_exception_class, __get_object_from_ue, __get_object_from_ambiguous_exception): Add. (__GXX_INIT_EXCEPTION_CLASS, __gxx_exception_class): Rename. (__is_gxx_exception_class): Handle dependent exceptions. * libsupc++/eh_arm.cc (__cxa_type_match): Likewise. * libsupc++/eh_call.cc (__cxa_call_unexpected): Likewise. * libsupc++/eh_personality.cc (__gxx_personality_*): Likewise. * libsupc++/eh_type.cc (__cxa_current_exception_type): Likewise. * libsupc++/eh_alloc.cc (__cxa_allocate_dependent_exception, __cxa_free_dependent_exception): Add. * libsupc++/eh_throw.cc (__gxx_exception_cleanup): Handle reference counting. * libsupc++/exception: Conditionally include exception_ptr.h. * libsupc++/Makefile.am: Register new files. * libsupc++/Makefile.in: Regenerate. * config/abi/pre/gnu.ver: Add new symbols. * testsuite/18_support/exception_ptr/current_exception.cc: Test the core functionality of current_exception(). * testsuite/18_support/exception_ptr/rethrow_exception.cc: Test the core functionality of rethrow_exception(). * testsuite/18_support/exception_ptr/lifespan.cc: Test the life span of exception objects during exception propagation. ........ r139065 | hjl | 2008-08-13 11:25:14 -0700 (Wed, 13 Aug 2008) | 15 lines 2008-08-13 H.J. Lu <hongjiu.lu@intel.com> * dwarf2out.c (dwarf_stack_op_name): Remove prototype. (new_loc_descr): Likewise. (add_loc_descr): Likewise. (size_of_loc_descr): Likewise. (size_of_locs): Likewise. (output_loc_operands): Likewise. (output_loc_sequence): Likewise. (new_reg_loc_descr): New. (build_cfa_loc): Use it. (build_cfa_aligned_loc): Likewise. (one_reg_loc_descriptor): Likewise. (based_loc_descr): Likewise. ........ r139072 | ebotcazou | 2008-08-13 12:38:39 -0700 (Wed, 13 Aug 2008) | 6 lines * gimple.h (gimple_call_set_chain): Accept SSA variables. * tree-ssa-pre.c (create_component_ref_by_pieces_1) <CALL_EXPR>: Rematerialize the static chain, if any. * tree-ssa-sccvn.c (copy_reference_ops_from_call): Also copy the static chain. ........ r139074 | paolo | 2008-08-13 13:08:55 -0700 (Wed, 13 Aug 2008) | 4 lines 2008-08-13 Paolo Carlini <paolo.carlini@oracle.com> Revert the last patch. ........ r139075 | paolo | 2008-08-13 13:10:42 -0700 (Wed, 13 Aug 2008) | 4 lines 2008-08-13 Paolo Carlini <paolo.carlini@oracle.com> Revert the last patch. ........ r139082 | uweigand | 2008-08-13 13:36:57 -0700 (Wed, 13 Aug 2008) | 3 lines * config/rs6000/rs6000-c.c (rs6000_cpu_cpp_builtins): Predefine __PPU__ when targeting the Cell/B.E. PPU processor. ........ r139084 | jsm28 | 2008-08-13 13:52:22 -0700 (Wed, 13 Aug 2008) | 4 lines * config/sparc/sparc.c (emit_soft_tfmode_cvt): Explicitly sign or zero extend SImode values being converted to TFmode before passing to libcalls. ........ r139086 | kazu | 2008-08-13 16:21:12 -0700 (Wed, 13 Aug 2008) | 4 lines * gcc.dg/arm-g2.c, gcc.dg/arm-mmx-1.c, gcc.dg/arm-scd42-2.c: Skip if the multilib testing specifies -march that does not agree with the one specified in the testcase. ........ r139089 | gccadmin | 2008-08-13 17:16:36 -0700 (Wed, 13 Aug 2008) | 1 line Daily bump. ........ r139091 | paolo | 2008-08-13 18:17:09 -0700 (Wed, 13 Aug 2008) | 5 lines 2008-08-13 Paolo Carlini <paolo.carlini@oracle.com> Re-instate last patch, amended to use __exchange_and_add_dispatch and __atomic_add_dispatch in eh_ptr.cc and eh_throw.cc. ........ r139092 | hjl | 2008-08-13 21:35:32 -0700 (Wed, 13 Aug 2008) | 8 lines 2008-08-13 H.J. Lu <hongjiu.lu@intel.com> * gcc.target/i386/incoming-1.c: Skip *-*-darwin*. * gcc.target/i386/incoming-2.c: Likewise. * gcc.target/i386/incoming-3.c: Likewise. * gcc.target/i386/incoming-4.c: Likewise. * gcc.target/i386/incoming-5.c: Likewise. ........ r139093 | jakub | 2008-08-14 02:02:46 -0700 (Thu, 14 Aug 2008) | 7 lines PR middle-end/37103 * fold-const.c (fold_widened_comparison): Do not allow sign changes that change the result even if shorter type is wider than arg1_unw's type. * gcc.c-torture/execute/20080813-1.c: New test. ........ r139095 | uros | 2008-08-14 04:57:18 -0700 (Thu, 14 Aug 2008) | 11 lines PR target/37101 * config/i386/sse.md (vec_concatv2di): Remove movlps alternative. (*vec_concatv2di_rex64_sse4_1): Ditto. (*vec_concatv2di_rex64_sse): Ditto. testsuite/ChangeLog: PR target/37101 * gcc.target/i386/pr37101.c: New test. ........ r139096 | dorit | 2008-08-14 05:47:56 -0700 (Thu, 14 Aug 2008) | 20 lines 2008-08-14 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-transform.c (vect_create_epilog_for_reduction): Takes an additional argument. Support reduction when duplication is needed due to data-types of different sizes in the loop. (get_initial_def_for_induction): Fix printout. (vect_get_vec_def_for_stmt_copy): Support case where the vec_stmt_for_operand is a phi node. (vectorizable_reduction): Support reduction when duplication is needed due to data-types of different sizes in the loop. (vectorizable_call): Remove restriction to not vectorize in case we have data-types of different sizes in the loop. (vectorizable_conversion): Likewise. (vectorizable_operation): Likewise. (vectorizable_type_demotion): Likewise. (vectorizable_type_promotion): Likewise. (vectorizable_induction): Add restriction to not vectorize in case we have data-types of different sizes in the loop. ........ r139097 | manu | 2008-08-14 06:01:58 -0700 (Thu, 14 Aug 2008) | 10 lines 2008-08-08 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR c/28152 * c-parser.c (c_lex_one_token): Do not store the canonical spelling for keywords. testsuite/ * gcc.dg/parser-pr28152.c: New. * gcc.dg/parser-pr28152-2.c: New. ........ r139099 | paolo | 2008-08-14 08:11:01 -0700 (Thu, 14 Aug 2008) | 13 lines /cp 2008-08-14 Paolo Carlini <paolo.carlini@oracle.com> PR c++/34600 * decl.c (grokdeclarator): In case of extern and initializer, return error_mark_node after the error. /testsuite 2008-08-14 Paolo Carlini <paolo.carlini@oracle.com> PR c++/34600 * g++.dg/parse/crash43.C: New. ........ r139100 | espindola | 2008-08-14 09:05:36 -0700 (Thu, 14 Aug 2008) | 10 lines 2008-08-14 Rafael Avila de Espindola <espindola@google.com> * gcc.dg/visibility-14.c: New test. * gcc.dg/visibility-15.c: New test. * gcc.dg/visibility-16.c: New test. * gcc.dg/visibility-17.c: New test. * gcc.dg/visibility-18.c: New test. * gcc.dg/visibility-19.c: New test. ........ r139111 | tkoenig | 2008-08-14 11:31:32 -0700 (Thu, 14 Aug 2008) | 39 lines 2008-08-14 Thomas Koenig <tkoenig@gcc.gnu.org> PR libfortran/36886 * Makefile.am: Added $(i_cshift0_c). Added $(i_cshift0_c) to gfor_built_specific_src. Add rule to build from cshift0.m4. * Makefile.in: Regenerated. * libgfortran.h: Addedd prototypes for cshift0_i1, cshift0_i2, cshift0_i4, cshift0_i8, cshift0_i16, cshift0_r4, cshift0_r8, cshift0_r10, cshift0_r16, cshift0_c4, cshift0_c8, cshift0_c10, cshift0_c16. Define Macros GFC_UNALIGNED_C4 and GFC_UNALIGNED_C8. * intrinsics/cshift0.c: Remove helper functions for the innter shift loop. (cshift0): Call specific functions depending on type of array argument. Only call specific functions for correct alignment for other types. * m4/cshift0.m4: New file. * generated/cshift0_i1.c: New file. * generated/cshift0_i2.c: New file. * generated/cshift0_i4.c: New file. * generated/cshift0_i8:.c New file. * generated/cshift0_i16.c: New file. * generated/cshift0_r4.c: New file. * generated/cshift0_r8.c: New file. * generated/cshift0_r10.c: New file. * generated/cshift0_r16.c: New file. * generated/cshift0_c4.c: New file. * generated/cshift0_c8.c: New file. * generated/cshift0_c10.c: New file. * generated/cshift0_c16.c: New file. 2008-08-14 Thomas Koenig <tkoenig@gcc.gnu.org> PR libfortran/36886 * gfortran.dg/cshift_char_3.f90: New test case. * gfortran.dg/cshift_nan_1.f90: New test case. ........ r139114 | paolo | 2008-08-14 12:04:05 -0700 (Thu, 14 Aug 2008) | 18 lines /cp 2008-08-14 Paolo Carlini <paolo.carlini@oracle.com> PR c++/34485 * pt.c (check_template_shadow): Change to return a bool. * name-lookup.c (push_class_level_binding): Early return if check_template_shadow returns false. * cp-tree.h (check_template_shadow): Adjust declaration. /testsuite 2008-08-14 Paolo Carlini <paolo.carlini@oracle.com> PR c++/34485 * g++.dg/template/crash81.C: New. * g++.old-deja/g++.benjamin/tem03.C: Adjust. * g++.old-deja/g++.benjamin/tem04.C: Likewise. * g++.old-deja/g++.brendan/crash7.C: Likewise. ........ r139116 | janus | 2008-08-14 14:15:59 -0700 (Thu, 14 Aug 2008) | 15 lines 2008-08-14 Janus Weil <janus@gcc.gnu.org> PR fortran/36705 * symbol.c (check_conflict): Move conflict checks for (procedure,save) and (procedure,intent) to resolve_fl_procedure. * resolve.c (resolve_fl_procedure): Ditto. 2008-08-14 Janus Weil <janus@gcc.gnu.org> PR fortran/36705 * gfortran.dg/argument_checking_7.f90: Modified. * gfortran.dg/conflicts.f90: Modified. * gfortran.dg/proc_decl_1.f90: Modified. * gfortran.dg/proc_ptr_9.f90: New. ........ r139117 | hjl | 2008-08-14 14:36:31 -0700 (Thu, 14 Aug 2008) | 5 lines 2008-08-14 H.J. Lu <hongjiu.lu@intel.com> PR libfortran/37123 * intrinsics/cshift0.c (cshift0): Fix 2 typos. ........ r139121 | gccadmin | 2008-08-14 17:17:25 -0700 (Thu, 14 Aug 2008) | 1 line Daily bump. ........ r139124 | krebbel | 2008-08-15 00:36:40 -0700 (Fri, 15 Aug 2008) | 20 lines 2008-08-15 Wolfgang Gellerich <gellerich@de.ibm.com> * config/s390/2097.md New file. * config/s390/s390.md ("z10prop" attribute): Define none, z10_super, z10_super_E1, z10_super_A1, z10_super_c, z10_super_c_E1, z10_fwd, z10_fwd_A1, z10_fwd_A3, z10_fwd_E1, z10_rec, z10_fr, z10_fr_A3, z10_fr_E1, z10_c, and z10_cobra as possible values and apply them to insns as appropriate. ("type" attribute): Removed itof and added ftrunctf,ftruncdf, ftruncsd, ftruncdd, itoftf, itofdf, itofsf, itofdd, itoftd, fdivdd, fdivtd, floaddd, floadsd, fmuldd, fmultd, fsimpdd, fsimpsd, fsimptd, fstoredd, fstoresd, ftoidfp as possible values. ("bfp" mode attribute): Removed. Every occurence replaced with <mode>. * config/s390/s390.c (struct "z10_cost"): Updated entries. * config/s390/2084.md (insn_reservation "x_itof"): Updated type attribute. ........ r139125 | ebotcazou | 2008-08-15 02:10:25 -0700 (Fri, 15 Aug 2008) | 1 line Fix long line. ........ r139126 | manu | 2008-08-15 04:23:20 -0700 (Fri, 15 Aug 2008) | 9 lines 2008-08-15 Manuel Lopez-Ibanez <manu@gcc.gnu.org> testsuite/ * gcc.dg/pr30551-6.c: Skip for SPU. * gcc.dg/pr30551-3.c: Likewise. * gcc.dg/pr30551.c: Likewise. * g++.dg/warn/pr30551-2.C: Likewise. * g++.dg/warn/pr30551.C: Likewise. ........ r139129 | rguenth | 2008-08-15 05:59:16 -0700 (Fri, 15 Aug 2008) | 5 lines 2008-08-15 Richard Guenther <rguenther@suse.de> * tree-ssa-ccp.c (maybe_fold_offset_to_reference): Do not strip components for unknown size accesses. ........ r139135 | jsm28 | 2008-08-15 13:12:01 -0700 (Fri, 15 Aug 2008) | 5 lines * config/arm/arm.c (add_minipool_backward_ref): Check for 8-byte-aligned entries in second case of forcing insertion after a particular entry. Change third case to avoid inserting non-8-byte-aligned entries before 8-byte-aligned ones. ........ git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/profile-stdlib@139138 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--ChangeLog17
-rw-r--r--MAINTAINERS2
-rw-r--r--Makefile.def1
-rw-r--r--Makefile.in2
-rw-r--r--Makefile.tpl1
-rw-r--r--boehm-gc/ChangeLog6
-rw-r--r--boehm-gc/Makefile.in10
-rwxr-xr-xboehm-gc/configure3
-rw-r--r--boehm-gc/configure.ac2
-rw-r--r--boehm-gc/threads.mk.in3
-rw-r--r--config/ChangeLog27
-rw-r--r--config/acinclude.m41277
-rw-r--r--config/mh-pa (renamed from gcc/config/pa/x-ada)2
-rw-r--r--config/mh-pa-hpux10 (renamed from gcc/config/pa/x-ada-hpux10)2
-rw-r--r--config/mt-mips-elfoabi7
-rw-r--r--config/mt-mips-gnu2
-rw-r--r--config/mt-mips16-compat5
-rw-r--r--config/mt-spu6
-rw-r--r--config/tcl.m43248
-rwxr-xr-xconfigure15
-rw-r--r--configure.ac15
-rw-r--r--gcc/ChangeLog3593
-rw-r--r--gcc/ChangeLog-20072
-rw-r--r--gcc/ChangeLog.tuples8231
-rw-r--r--gcc/DATESTAMP2
-rw-r--r--gcc/Makefile.in514
-rw-r--r--gcc/ada/ChangeLog1850
-rw-r--r--gcc/ada/Makefile.in2297
-rw-r--r--gcc/ada/Makefile.rtl8
-rw-r--r--gcc/ada/a-coinve.adb5
-rw-r--r--gcc/ada/a-rttiev.adb12
-rw-r--r--gcc/ada/a-wtdeio.adb6
-rw-r--r--gcc/ada/a-ztdeio.adb6
-rw-r--r--gcc/ada/adaint.c308
-rw-r--r--gcc/ada/adaint.h5
-rw-r--r--gcc/ada/argv.c4
-rw-r--r--gcc/ada/arit64.c58
-rw-r--r--gcc/ada/back_end.adb2
-rw-r--r--gcc/ada/bindgen.adb84
-rw-r--r--gcc/ada/checks.adb59
-rw-r--r--gcc/ada/checks.ads8
-rw-r--r--gcc/ada/cio.c23
-rw-r--r--gcc/ada/clean.adb39
-rw-r--r--gcc/ada/config-lang.in35
-rw-r--r--gcc/ada/cstreams.c15
-rw-r--r--gcc/ada/directio.ads6
-rw-r--r--gcc/ada/einfo.adb40
-rw-r--r--gcc/ada/einfo.ads33
-rw-r--r--gcc/ada/exp_aggr.adb55
-rw-r--r--gcc/ada/exp_attr.adb237
-rw-r--r--gcc/ada/exp_ch11.adb4
-rw-r--r--gcc/ada/exp_ch3.adb44
-rw-r--r--gcc/ada/exp_ch4.adb108
-rw-r--r--gcc/ada/exp_ch5.adb42
-rw-r--r--gcc/ada/exp_ch6.adb85
-rw-r--r--gcc/ada/exp_ch9.adb1044
-rw-r--r--gcc/ada/exp_ch9.ads12
-rw-r--r--gcc/ada/exp_disp.adb26
-rw-r--r--gcc/ada/exp_dist.adb89
-rw-r--r--gcc/ada/exp_dist.ads33
-rw-r--r--gcc/ada/exp_strm.adb14
-rw-r--r--gcc/ada/exp_util.adb14
-rw-r--r--gcc/ada/exp_util.ads8
-rw-r--r--gcc/ada/fe.h2
-rw-r--r--gcc/ada/freeze.adb175
-rw-r--r--gcc/ada/g-awk.adb79
-rw-r--r--gcc/ada/g-comlin.adb849
-rw-r--r--gcc/ada/g-comlin.ads107
-rw-r--r--gcc/ada/g-pehage.adb229
-rw-r--r--gcc/ada/g-pehage.ads32
-rw-r--r--gcc/ada/g-sercom-linux.adb4
-rw-r--r--gcc/ada/g-sercom-mingw.adb2
-rw-r--r--gcc/ada/g-sercom.adb2
-rw-r--r--gcc/ada/g-sercom.ads10
-rw-r--r--gcc/ada/g-soccon-aix.ads208
-rw-r--r--gcc/ada/g-soccon-darwin.ads208
-rw-r--r--gcc/ada/g-soccon-freebsd.ads208
-rw-r--r--gcc/ada/g-soccon-hpux-ia64.ads208
-rw-r--r--gcc/ada/g-soccon-hpux.ads208
-rw-r--r--gcc/ada/g-soccon-irix.ads208
-rw-r--r--gcc/ada/g-soccon-linux-64.ads208
-rw-r--r--gcc/ada/g-soccon-linux-mips.ads197
-rw-r--r--gcc/ada/g-soccon-linux-ppc.ads208
-rw-r--r--gcc/ada/g-soccon-linux-x86.ads208
-rw-r--r--gcc/ada/g-soccon-lynxos.ads208
-rw-r--r--gcc/ada/g-soccon-mingw.ads220
-rw-r--r--gcc/ada/g-soccon-rtems.ads196
-rw-r--r--gcc/ada/g-soccon-solaris-64.ads208
-rw-r--r--gcc/ada/g-soccon-solaris.ads208
-rw-r--r--gcc/ada/g-soccon-tru64.ads208
-rw-r--r--gcc/ada/g-soccon-vms.ads208
-rw-r--r--gcc/ada/g-soccon-vxworks.ads218
-rw-r--r--gcc/ada/g-soccon.ads187
-rw-r--r--gcc/ada/g-socket-dummy.adb34
-rw-r--r--gcc/ada/g-socket-dummy.ads39
-rw-r--r--gcc/ada/g-socket.adb95
-rw-r--r--gcc/ada/g-socket.ads16
-rw-r--r--gcc/ada/g-socthi-dummy.adb34
-rw-r--r--gcc/ada/g-socthi-dummy.ads39
-rw-r--r--gcc/ada/g-socthi-mingw.adb9
-rw-r--r--gcc/ada/g-socthi-vms.adb43
-rw-r--r--gcc/ada/g-socthi-vxworks.adb41
-rw-r--r--gcc/ada/g-socthi.adb41
-rw-r--r--gcc/ada/g-sothco-dummy.adb34
-rw-r--r--gcc/ada/g-sothco-dummy.ads39
-rw-r--r--gcc/ada/g-sothco.adb2
-rw-r--r--gcc/ada/g-sothco.ads28
-rw-r--r--gcc/ada/g-stheme.adb10
-rw-r--r--gcc/ada/g-stsifd-sockets.adb12
-rw-r--r--gcc/ada/g-sttsne-dummy.ads39
-rw-r--r--gcc/ada/g-sttsne-vxworks.adb11
-rw-r--r--gcc/ada/gcc-interface/Make-lang.in (renamed from gcc/ada/Make-lang.in)131
-rw-r--r--gcc/ada/gcc-interface/Makefile.in2303
-rw-r--r--gcc/ada/gcc-interface/ada-tree.def (renamed from gcc/ada/ada-tree.def)0
-rw-r--r--gcc/ada/gcc-interface/ada-tree.h (renamed from gcc/ada/ada-tree.h)8
-rw-r--r--gcc/ada/gcc-interface/ada.h (renamed from gcc/ada/ada.h)0
-rw-r--r--gcc/ada/gcc-interface/config-lang.in43
-rw-r--r--gcc/ada/gcc-interface/cuintp.c (renamed from gcc/ada/cuintp.c)0
-rw-r--r--gcc/ada/gcc-interface/decl.c (renamed from gcc/ada/decl.c)163
-rw-r--r--gcc/ada/gcc-interface/deftarg.c (renamed from gcc/ada/deftarg.c)0
-rw-r--r--gcc/ada/gcc-interface/gigi.h (renamed from gcc/ada/gigi.h)44
-rw-r--r--gcc/ada/gcc-interface/lang-specs.h (renamed from gcc/ada/lang-specs.h)0
-rw-r--r--gcc/ada/gcc-interface/lang.opt (renamed from gcc/ada/lang.opt)0
-rw-r--r--gcc/ada/gcc-interface/misc.c (renamed from gcc/ada/misc.c)10
-rw-r--r--gcc/ada/gcc-interface/targtyps.c (renamed from gcc/ada/targtyps.c)6
-rw-r--r--gcc/ada/gcc-interface/trans.c (renamed from gcc/ada/trans.c)298
-rw-r--r--gcc/ada/gcc-interface/utils.c (renamed from gcc/ada/utils.c)693
-rw-r--r--gcc/ada/gcc-interface/utils2.c (renamed from gcc/ada/utils2.c)62
-rw-r--r--gcc/ada/gen-soccon.c747
-rw-r--r--gcc/ada/gnat-style.texi46
-rw-r--r--gcc/ada/gnat_rm.texi74
-rw-r--r--gcc/ada/gnat_ugn.texi278
-rw-r--r--gcc/ada/gnatchop.adb60
-rw-r--r--gcc/ada/gnathtml.pl1115
-rw-r--r--gcc/ada/gnatlink.adb278
-rw-r--r--gcc/ada/gprep.adb7
-rw-r--r--gcc/ada/gsocket.h139
-rw-r--r--gcc/ada/i-cobol.adb19
-rw-r--r--gcc/ada/init.c25
-rw-r--r--gcc/ada/ioexcept.ads6
-rw-r--r--gcc/ada/layout.adb380
-rw-r--r--gcc/ada/lib-xref.adb6
-rw-r--r--gcc/ada/make.adb102
-rw-r--r--gcc/ada/makeutl.adb10
-rw-r--r--gcc/ada/mlib-tgt-specific-vms-alpha.adb39
-rw-r--r--gcc/ada/mlib-tgt-specific-vms-ia64.adb78
-rw-r--r--gcc/ada/mlib-utl.adb26
-rw-r--r--gcc/ada/mlib-utl.ads17
-rw-r--r--gcc/ada/mlib.adb34
-rw-r--r--gcc/ada/opt.ads11
-rw-r--r--gcc/ada/osint.ads31
-rw-r--r--gcc/ada/par-ch10.adb9
-rw-r--r--gcc/ada/par-ch3.adb27
-rw-r--r--gcc/ada/par-prag.adb4
-rw-r--r--gcc/ada/prep.adb330
-rw-r--r--gcc/ada/prep.ads7
-rw-r--r--gcc/ada/prj-attr-pm.adb3
-rw-r--r--gcc/ada/prj-attr.adb51
-rw-r--r--gcc/ada/prj-attr.ads4
-rw-r--r--gcc/ada/prj-dect.adb37
-rw-r--r--gcc/ada/prj-env.adb44
-rw-r--r--gcc/ada/prj-makr.ads5
-rw-r--r--gcc/ada/prj-nmsc.adb1045
-rw-r--r--gcc/ada/prj-part.adb23
-rw-r--r--gcc/ada/prj-part.ads26
-rw-r--r--gcc/ada/prj-proc.adb196
-rw-r--r--gcc/ada/prj-util.adb16
-rw-r--r--gcc/ada/prj-util.ads10
-rw-r--r--gcc/ada/prj.adb361
-rw-r--r--gcc/ada/prj.ads309
-rw-r--r--gcc/ada/raise-gcc.c4
-rw-r--r--gcc/ada/restrict.adb250
-rw-r--r--gcc/ada/restrict.ads38
-rw-r--r--gcc/ada/rtsfind.adb71
-rw-r--r--gcc/ada/rtsfind.ads35
-rw-r--r--gcc/ada/s-direio.adb10
-rw-r--r--gcc/ada/s-fileio.adb18
-rw-r--r--gcc/ada/s-finimp.ads6
-rwxr-xr-xgcc/ada/s-os_lib.adb137
-rwxr-xr-xgcc/ada/s-os_lib.ads69
-rw-r--r--gcc/ada/s-oscons-tmplt.c1203
-rw-r--r--gcc/ada/s-osinte-freebsd.ads10
-rw-r--r--gcc/ada/s-osinte-hpux.ads3
-rw-r--r--gcc/ada/s-osinte-irix.ads3
-rw-r--r--gcc/ada/s-parame-vxworks.adb4
-rwxr-xr-xgcc/ada/s-regexp.ads4
-rw-r--r--gcc/ada/s-rident.ads40
-rw-r--r--gcc/ada/s-stausa.adb68
-rw-r--r--gcc/ada/s-stausa.ads4
-rw-r--r--gcc/ada/s-strxdr.adb18
-rw-r--r--gcc/ada/s-ststop.adb380
-rw-r--r--gcc/ada/s-ststop.ads50
-rw-r--r--gcc/ada/s-wchwts.adb12
-rw-r--r--gcc/ada/s-wchwts.ads3
-rw-r--r--gcc/ada/scans.ads3
-rw-r--r--gcc/ada/scng.adb3
-rw-r--r--gcc/ada/sem.adb2
-rw-r--r--gcc/ada/sem_aggr.adb12
-rw-r--r--gcc/ada/sem_attr.adb169
-rw-r--r--gcc/ada/sem_ch10.adb32
-rw-r--r--gcc/ada/sem_ch12.adb113
-rw-r--r--gcc/ada/sem_ch12.ads10
-rw-r--r--gcc/ada/sem_ch13.adb29
-rw-r--r--gcc/ada/sem_ch3.adb274
-rw-r--r--gcc/ada/sem_ch4.adb102
-rw-r--r--gcc/ada/sem_ch5.adb24
-rw-r--r--gcc/ada/sem_ch6.adb509
-rw-r--r--gcc/ada/sem_ch6.ads8
-rw-r--r--gcc/ada/sem_ch8.adb76
-rw-r--r--gcc/ada/sem_mech.adb82
-rw-r--r--gcc/ada/sem_mech.ads10
-rw-r--r--gcc/ada/sem_prag.adb463
-rw-r--r--gcc/ada/sem_res.adb174
-rw-r--r--gcc/ada/sem_type.adb13
-rw-r--r--gcc/ada/sem_util.adb38
-rw-r--r--gcc/ada/sem_util.ads6
-rw-r--r--gcc/ada/sem_warn.adb10
-rw-r--r--gcc/ada/sequenio.ads6
-rw-r--r--gcc/ada/sinput-l.adb58
-rw-r--r--gcc/ada/sinput.adb4
-rw-r--r--gcc/ada/sinput.ads12
-rw-r--r--gcc/ada/snames.adb9
-rw-r--r--gcc/ada/snames.ads1499
-rw-r--r--gcc/ada/snames.h57
-rw-r--r--gcc/ada/socket.c20
-rw-r--r--gcc/ada/sprint.adb7
-rw-r--r--gcc/ada/switch-c.adb10
-rw-r--r--gcc/ada/switch-m.adb11
-rw-r--r--gcc/ada/system-darwin-x86.ads2
-rw-r--r--gcc/ada/system-mingw-x86_64.ads199
-rw-r--r--gcc/ada/targparm.adb6
-rw-r--r--gcc/ada/targparm.ads3
-rw-r--r--gcc/ada/tbuild.adb2
-rw-r--r--gcc/ada/tbuild.ads14
-rw-r--r--gcc/ada/treepr.adb49
-rw-r--r--gcc/ada/types.ads2
-rw-r--r--gcc/ada/types.h9
-rw-r--r--gcc/ada/ug_words3
-rw-r--r--gcc/ada/uintp.adb2
-rw-r--r--gcc/ada/usage.adb29
-rw-r--r--gcc/ada/vms_data.ads54
-rw-r--r--gcc/ada/xnmake.adb19
-rw-r--r--gcc/ada/xoscons.adb419
-rw-r--r--gcc/ada/xref_lib.adb1
-rw-r--r--gcc/ada/xutil.adb77
-rw-r--r--gcc/ada/xutil.ads44
-rw-r--r--gcc/attribs.c36
-rw-r--r--gcc/basic-block.h33
-rw-r--r--gcc/builtins.c537
-rw-r--r--gcc/c-common.c851
-rw-r--r--gcc/c-common.h20
-rw-r--r--gcc/c-cppbuiltin.c65
-rw-r--r--gcc/c-decl.c509
-rw-r--r--gcc/c-errors.c10
-rw-r--r--gcc/c-gimplify.c21
-rw-r--r--gcc/c-lex.c11
-rw-r--r--gcc/c-omp.c2
-rw-r--r--gcc/c-opts.c58
-rw-r--r--gcc/c-parser.c175
-rw-r--r--gcc/c-pch.c8
-rw-r--r--gcc/c-pragma.c344
-rw-r--r--gcc/c-pretty-print.c6
-rw-r--r--gcc/c-semantics.c3
-rw-r--r--gcc/c-tree.h8
-rw-r--r--gcc/c-typeck.c490
-rw-r--r--gcc/c.opt2
-rw-r--r--gcc/caller-save.c12
-rw-r--r--gcc/calls.c48
-rw-r--r--gcc/cfg.c14
-rw-r--r--gcc/cfgexpand.c651
-rw-r--r--gcc/cfghooks.c8
-rw-r--r--gcc/cfghooks.h6
-rw-r--r--gcc/cfgloop.c11
-rw-r--r--gcc/cfgloop.h2
-rw-r--r--gcc/cfgrtl.c4
-rw-r--r--gcc/cgraph.c130
-rw-r--r--gcc/cgraph.h23
-rw-r--r--gcc/cgraphbuild.c142
-rw-r--r--gcc/cgraphunit.c261
-rw-r--r--gcc/collect2.c70
-rw-r--r--gcc/combine-stack-adj.c10
-rw-r--r--gcc/combine.c5
-rw-r--r--gcc/common.opt46
-rw-r--r--gcc/config.gcc68
-rw-r--r--gcc/config.host16
-rw-r--r--gcc/config.in24
-rw-r--r--gcc/config/alpha/alpha.c140
-rw-r--r--gcc/config/alpha/alpha.h4
-rw-r--r--gcc/config/arm/arm-cores.def1
-rw-r--r--gcc/config/arm/arm-protos.h2
-rw-r--r--gcc/config/arm/arm-tune.md2
-rw-r--r--gcc/config/arm/arm.c258
-rw-r--r--gcc/config/arm/arm.h26
-rw-r--r--gcc/config/arm/arm.md10
-rw-r--r--gcc/config/arm/constraints.md2
-rw-r--r--gcc/config/arm/iwmmxt.md72
-rw-r--r--gcc/config/arm/neon.md67
-rw-r--r--gcc/config/avr/avr-protos.h10
-rw-r--r--gcc/config/avr/avr.c42
-rw-r--r--gcc/config/avr/avr.h4
-rw-r--r--gcc/config/avr/t-avr2
-rw-r--r--gcc/config/bfin/bfin.c59
-rw-r--r--gcc/config/crx/crx.c12
-rw-r--r--gcc/config/frv/frv-protos.h6
-rw-r--r--gcc/config/frv/frv.c88
-rw-r--r--gcc/config/h8300/h8300.c66
-rw-r--r--gcc/config/host-linux.c2
-rw-r--r--gcc/config/i386/darwin.h7
-rw-r--r--gcc/config/i386/emmintrin.h2
-rw-r--r--gcc/config/i386/i386-c.c344
-rw-r--r--gcc/config/i386/i386-protos.h8
-rw-r--r--gcc/config/i386/i386.c1859
-rw-r--r--gcc/config/i386/i386.h261
-rw-r--r--gcc/config/i386/i386.md501
-rw-r--r--gcc/config/i386/i386.opt173
-rw-r--r--gcc/config/i386/mmx.md8
-rw-r--r--gcc/config/i386/sse.md175
-rw-r--r--gcc/config/i386/t-i38613
-rw-r--r--gcc/config/i386/winnt.c6
-rw-r--r--gcc/config/ia64/ia64.c56
-rw-r--r--gcc/config/iq2000/iq2000.c8
-rw-r--r--gcc/config/iq2000/iq2000.h2
-rw-r--r--gcc/config/m32c/m32c-protos.h4
-rw-r--r--gcc/config/m32c/m32c.c30
-rw-r--r--gcc/config/m68hc11/m68hc11.c70
-rw-r--r--gcc/config/mcore/mcore.c14
-rw-r--r--gcc/config/mips/constraints.md6
-rw-r--r--gcc/config/mips/iris6.h24
-rw-r--r--gcc/config/mips/irix-crti.asm7
-rw-r--r--gcc/config/mips/libgcc-mips16.ver68
-rw-r--r--gcc/config/mips/linux-unwind.h13
-rw-r--r--gcc/config/mips/linux.h30
-rw-r--r--gcc/config/mips/mips-protos.h24
-rw-r--r--gcc/config/mips/mips.c1224
-rw-r--r--gcc/config/mips/mips.h190
-rw-r--r--gcc/config/mips/mips.md159
-rw-r--r--gcc/config/mips/mips16.S15
-rw-r--r--gcc/config/mips/predicates.md16
-rw-r--r--gcc/config/mips/sdemtk.h8
-rw-r--r--gcc/config/mips/t-libgcc-mips163
-rw-r--r--gcc/config/mmix/mmix.c16
-rw-r--r--gcc/config/mn10300/mn10300.c22
-rw-r--r--gcc/config/pa/pa.c53
-rw-r--r--gcc/config/pa/pa.h14
-rw-r--r--gcc/config/pdp11/pdp11.c4
-rw-r--r--gcc/config/pdp11/pdp11.h2
-rw-r--r--gcc/config/rs6000/rs6000-c.c14
-rw-r--r--gcc/config/rs6000/rs6000.c214
-rw-r--r--gcc/config/rs6000/rs6000.h13
-rw-r--r--gcc/config/s390/2084.md2
-rw-r--r--gcc/config/s390/2097.md764
-rw-r--r--gcc/config/s390/s390.c389
-rw-r--r--gcc/config/s390/s390.h6
-rw-r--r--gcc/config/s390/s390.md883
-rw-r--r--gcc/config/score/score-protos.h4
-rw-r--r--gcc/config/score/score.c12
-rw-r--r--gcc/config/score/score.h2
-rw-r--r--gcc/config/score/score3.c44
-rw-r--r--gcc/config/score/score3.h4
-rw-r--r--gcc/config/score/score7.c44
-rw-r--r--gcc/config/score/score7.h4
-rw-r--r--gcc/config/sh/sh.c279
-rw-r--r--gcc/config/sh/sh.h17
-rw-r--r--gcc/config/sparc/linux64.h6
-rw-r--r--gcc/config/sparc/sparc.c36
-rw-r--r--gcc/config/sparc/sparc.h7
-rw-r--r--gcc/config/spu/float_disf.c30
-rw-r--r--gcc/config/spu/float_unsdisf.c30
-rw-r--r--gcc/config/spu/spu-c.c74
-rw-r--r--gcc/config/spu/spu.c66
-rw-r--r--gcc/config/spu/spu.h31
-rw-r--r--gcc/config/spu/spu.md132
-rw-r--r--gcc/config/spu/spu_mfcio.h98
-rw-r--r--gcc/config/spu/t-spu-elf7
-rw-r--r--gcc/config/stormy16/stormy16.c55
-rw-r--r--gcc/config/vax/vax.h4
-rw-r--r--gcc/config/xtensa/t-xtensa1
-rw-r--r--gcc/config/xtensa/xtensa.c136
-rw-r--r--gcc/config/xtensa/xtensa.h16
-rwxr-xr-xgcc/configure220
-rw-r--r--gcc/configure.ac82
-rw-r--r--gcc/coretypes.h11
-rw-r--r--gcc/cp/ChangeLog1432
-rw-r--r--gcc/cp/Make-lang.in8
-rw-r--r--gcc/cp/call.c56
-rw-r--r--gcc/cp/class.c128
-rw-r--r--gcc/cp/cp-gimplify.c243
-rw-r--r--gcc/cp/cp-tree.h75
-rw-r--r--gcc/cp/cvt.c46
-rw-r--r--gcc/cp/cxx-pretty-print.c6
-rw-r--r--gcc/cp/decl.c259
-rw-r--r--gcc/cp/decl2.c107
-rw-r--r--gcc/cp/error.c4
-rw-r--r--gcc/cp/except.c45
-rw-r--r--gcc/cp/friend.c16
-rw-r--r--gcc/cp/init.c154
-rw-r--r--gcc/cp/lex.c11
-rw-r--r--gcc/cp/mangle.c31
-rw-r--r--gcc/cp/method.c4
-rw-r--r--gcc/cp/name-lookup.c146
-rw-r--r--gcc/cp/operators.def4
-rw-r--r--gcc/cp/optimize.c29
-rw-r--r--gcc/cp/parser.c175
-rw-r--r--gcc/cp/pt.c250
-rw-r--r--gcc/cp/rtti.c8
-rw-r--r--gcc/cp/search.c14
-rw-r--r--gcc/cp/semantics.c52
-rw-r--r--gcc/cp/tree.c75
-rw-r--r--gcc/cp/typeck.c262
-rw-r--r--gcc/cp/typeck2.c109
-rw-r--r--gcc/debug.h1
-rw-r--r--gcc/defaults.h63
-rw-r--r--gcc/diagnostic.c139
-rw-r--r--gcc/diagnostic.def4
-rw-r--r--gcc/diagnostic.h26
-rw-r--r--gcc/doc/c-tree.texi13
-rw-r--r--gcc/doc/cpp.texi6
-rw-r--r--gcc/doc/extend.texi336
-rw-r--r--gcc/doc/fragments.texi40
-rw-r--r--gcc/doc/gcc.texi10
-rw-r--r--gcc/doc/gccint.texi12
-rw-r--r--gcc/doc/install.texi27
-rw-r--r--gcc/doc/invoke.texi160
-rw-r--r--gcc/doc/options.texi15
-rw-r--r--gcc/doc/passes.texi6
-rw-r--r--gcc/doc/tm.texi184
-rw-r--r--gcc/dojump.c7
-rw-r--r--gcc/domwalk.c24
-rw-r--r--gcc/domwalk.h4
-rw-r--r--gcc/dse.c21
-rw-r--r--gcc/dwarf2asm.c84
-rw-r--r--gcc/dwarf2asm.h7
-rw-r--r--gcc/dwarf2out.c1081
-rw-r--r--gcc/ebitmap.h2
-rw-r--r--gcc/emit-rtl.c9
-rw-r--r--gcc/errors.c3
-rw-r--r--gcc/errors.h2
-rw-r--r--gcc/except.c154
-rw-r--r--gcc/except.h11
-rw-r--r--gcc/expmed.c10
-rw-r--r--gcc/expr.c122
-rw-r--r--gcc/final.c122
-rw-r--r--gcc/fix-header.c5
-rw-r--r--gcc/flags.h17
-rw-r--r--gcc/fold-const.c86
-rw-r--r--gcc/fortran/ChangeLog523
-rw-r--r--gcc/fortran/Make-lang.in4
-rw-r--r--gcc/fortran/arith.c46
-rw-r--r--gcc/fortran/array.c114
-rw-r--r--gcc/fortran/bbt.c14
-rw-r--r--gcc/fortran/check.c420
-rw-r--r--gcc/fortran/cpp.c2
-rw-r--r--gcc/fortran/cpp.h2
-rw-r--r--gcc/fortran/data.c10
-rw-r--r--gcc/fortran/data.h2
-rw-r--r--gcc/fortran/decl.c240
-rw-r--r--gcc/fortran/dependency.c28
-rw-r--r--gcc/fortran/dump-parse-tree.c8
-rw-r--r--gcc/fortran/error.c2
-rw-r--r--gcc/fortran/expr.c106
-rw-r--r--gcc/fortran/f95-lang.c14
-rw-r--r--gcc/fortran/gfc-internals.texi7
-rw-r--r--gcc/fortran/gfortran.h256
-rw-r--r--gcc/fortran/gfortran.texi7
-rw-r--r--gcc/fortran/interface.c226
-rw-r--r--gcc/fortran/intrinsic.c334
-rw-r--r--gcc/fortran/intrinsic.h316
-rw-r--r--gcc/fortran/intrinsic.texi7
-rw-r--r--gcc/fortran/invoke.texi64
-rw-r--r--gcc/fortran/io.c83
-rw-r--r--gcc/fortran/iresolve.c4
-rw-r--r--gcc/fortran/lang.opt16
-rw-r--r--gcc/fortran/match.c21
-rw-r--r--gcc/fortran/match.h12
-rw-r--r--gcc/fortran/matchexp.c29
-rw-r--r--gcc/fortran/module.c172
-rw-r--r--gcc/fortran/openmp.c8
-rw-r--r--gcc/fortran/options.c38
-rw-r--r--gcc/fortran/parse.c12
-rw-r--r--gcc/fortran/parse.h2
-rw-r--r--gcc/fortran/primary.c260
-rw-r--r--gcc/fortran/resolve.c277
-rw-r--r--gcc/fortran/scanner.c31
-rw-r--r--gcc/fortran/simplify.c2
-rw-r--r--gcc/fortran/st.c10
-rw-r--r--gcc/fortran/symbol.c223
-rw-r--r--gcc/fortran/trans-array.c269
-rw-r--r--gcc/fortran/trans-array.h14
-rw-r--r--gcc/fortran/trans-common.c8
-rw-r--r--gcc/fortran/trans-decl.c23
-rw-r--r--gcc/fortran/trans-expr.c168
-rw-r--r--gcc/fortran/trans-intrinsic.c187
-rw-r--r--gcc/fortran/trans-io.c44
-rw-r--r--gcc/fortran/trans-openmp.c59
-rw-r--r--gcc/fortran/trans-stmt.c155
-rw-r--r--gcc/fortran/trans-types.c24
-rw-r--r--gcc/fortran/trans.c74
-rw-r--r--gcc/fortran/trans.h22
-rw-r--r--gcc/function.c334
-rw-r--r--gcc/function.h63
-rw-r--r--gcc/fwprop.c9
-rw-r--r--gcc/gcc.c4
-rw-r--r--gcc/gengtype.c6
-rw-r--r--gcc/ggc-page.c4
-rw-r--r--gcc/gimple-iterator.c771
-rw-r--r--gcc/gimple-low.c575
-rw-r--r--gcc/gimple-pretty-print.c1857
-rw-r--r--gcc/gimple.c3146
-rw-r--r--gcc/gimple.def357
-rw-r--r--gcc/gimple.h4573
-rw-r--r--gcc/gimplify.c2723
-rw-r--r--gcc/global.c10
-rw-r--r--gcc/graph.c10
-rw-r--r--gcc/gsstruct.def48
-rw-r--r--gcc/haifa-sched.c75
-rw-r--r--gcc/input.h5
-rw-r--r--gcc/ipa-cp.c160
-rw-r--r--gcc/ipa-inline.c284
-rw-r--r--gcc/ipa-prop.c1035
-rw-r--r--gcc/ipa-prop.h106
-rw-r--r--gcc/ipa-pure-const.c167
-rw-r--r--gcc/ipa-reference.c222
-rw-r--r--gcc/ipa-struct-reorg.c532
-rw-r--r--gcc/ipa-struct-reorg.h8
-rw-r--r--gcc/ipa-type-escape.c519
-rw-r--r--gcc/ipa-type-escape.h4
-rw-r--r--gcc/ipa-utils.c2
-rw-r--r--gcc/java/ChangeLog79
-rw-r--r--gcc/java/Make-lang.in5
-rw-r--r--gcc/java/class.c14
-rw-r--r--gcc/java/decl.c24
-rw-r--r--gcc/java/expr.c15
-rw-r--r--gcc/java/gcj.texi13
-rw-r--r--gcc/java/java-gimplify.c25
-rw-r--r--gcc/java/java-tree.h4
-rw-r--r--gcc/java/lang.c8
-rw-r--r--gcc/java/typeck.c3
-rw-r--r--gcc/jump.c20
-rw-r--r--gcc/lambda-code.c380
-rw-r--r--gcc/lambda-mat.c1
-rw-r--r--gcc/lambda-trans.c1
-rw-r--r--gcc/lambda.h4
-rw-r--r--gcc/langhooks-def.h2
-rw-r--r--gcc/langhooks.c11
-rw-r--r--gcc/langhooks.h2
-rw-r--r--gcc/libada-mk.in29
-rw-r--r--gcc/local-alloc.c16
-rw-r--r--gcc/machmode.h2
-rw-r--r--gcc/matrix-reorg.c772
-rw-r--r--gcc/objc/ChangeLog30
-rw-r--r--gcc/objc/Make-lang.in4
-rw-r--r--gcc/objc/objc-act.c182
-rw-r--r--gcc/objc/objc-act.h4
-rw-r--r--gcc/objcp/Make-lang.in6
-rw-r--r--gcc/omp-low.c2738
-rw-r--r--gcc/opt-functions.awk17
-rw-r--r--gcc/optabs.c122
-rw-r--r--gcc/optabs.h1
-rw-r--r--gcc/optc-gen.awk319
-rw-r--r--gcc/opth-gen.awk171
-rw-r--r--gcc/opts.c393
-rw-r--r--gcc/opts.h1
-rw-r--r--gcc/passes.c71
-rw-r--r--gcc/po/ChangeLog4
-rw-r--r--gcc/po/sv.po4
-rw-r--r--gcc/postreload.c12
-rw-r--r--gcc/predict.c388
-rw-r--r--gcc/print-tree.c64
-rw-r--r--gcc/profile.c51
-rw-r--r--gcc/ra.h8
-rw-r--r--gcc/real.c172
-rw-r--r--gcc/real.h35
-rw-r--r--gcc/recog.c81
-rw-r--r--gcc/reg-stack.c76
-rw-r--r--gcc/regclass.c136
-rw-r--r--gcc/regrename.c138
-rw-r--r--gcc/reload.c341
-rw-r--r--gcc/reload.h2
-rw-r--r--gcc/reload1.c138
-rw-r--r--gcc/reorg.c12
-rw-r--r--gcc/rtl.h1
-rw-r--r--gcc/rtlanal.c28
-rw-r--r--gcc/rtlhooks.c8
-rw-r--r--gcc/scan.c2
-rw-r--r--gcc/sched-deps.c40
-rw-r--r--gcc/sched-ebb.c6
-rw-r--r--gcc/sched-int.h2
-rw-r--r--gcc/sched-rgn.c24
-rw-r--r--gcc/simplify-rtx.c8
-rw-r--r--gcc/stmt.c14
-rw-r--r--gcc/stor-layout.c14
-rw-r--r--gcc/system.h6
-rw-r--r--gcc/target-def.h50
-rw-r--r--gcc/target.h52
-rw-r--r--gcc/targhooks.c52
-rw-r--r--gcc/targhooks.h3
-rw-r--r--gcc/testsuite/ChangeLog1146
-rw-r--r--gcc/testsuite/ChangeLog-1993-20074
-rw-r--r--gcc/testsuite/g++.dg/conversion/op5.C20
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/bracket3.C5
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/bracket4.C10
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/decltype12.C38
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/defaulted1.C43
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/defaulted2.C66
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/defaulted3.C16
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/initlist1.C3
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/initlist5.C4
-rw-r--r--gcc/testsuite/g++.dg/debug/namespace2.C8
-rw-r--r--gcc/testsuite/g++.dg/eh/async-unwind2.C254
-rw-r--r--gcc/testsuite/g++.dg/expr/anew4.C3
-rw-r--r--gcc/testsuite/g++.dg/ext/has_nothrow_assign.C12
-rw-r--r--gcc/testsuite/g++.dg/ext/has_nothrow_assign_odr.C16
-rw-r--r--gcc/testsuite/g++.dg/ext/has_nothrow_constructor.C4
-rw-r--r--gcc/testsuite/g++.dg/ext/has_nothrow_constructor_odr.C16
-rw-r--r--gcc/testsuite/g++.dg/ext/has_nothrow_copy-1.C (renamed from gcc/testsuite/g++.dg/ext/has_nothrow_copy.C)12
-rw-r--r--gcc/testsuite/g++.dg/ext/has_nothrow_copy-2.C12
-rw-r--r--gcc/testsuite/g++.dg/ext/has_nothrow_copy-3.C13
-rw-r--r--gcc/testsuite/g++.dg/ext/has_nothrow_copy-4.C13
-rw-r--r--gcc/testsuite/g++.dg/ext/has_nothrow_copy-5.C13
-rw-r--r--gcc/testsuite/g++.dg/ext/has_nothrow_copy-6.C12
-rw-r--r--gcc/testsuite/g++.dg/ext/has_nothrow_copy-7.C13
-rw-r--r--gcc/testsuite/g++.dg/ext/has_nothrow_copy_odr.C16
-rw-r--r--gcc/testsuite/g++.dg/ext/has_trivial_destructor-1.C (renamed from gcc/testsuite/g++.dg/ext/has_trivial_destructor.C)0
-rw-r--r--gcc/testsuite/g++.dg/ext/has_trivial_destructor-2.C3
-rw-r--r--gcc/testsuite/g++.dg/ext/utf-array-short-wchar.C36
-rw-r--r--gcc/testsuite/g++.dg/ext/utf-array.C36
-rw-r--r--gcc/testsuite/g++.dg/ext/utf-rtti.C12
-rw-r--r--gcc/testsuite/g++.dg/ext/utf-type.C15
-rw-r--r--gcc/testsuite/g++.dg/ext/visibility/arm1.C1
-rw-r--r--gcc/testsuite/g++.dg/ext/visibility/arm3.C26
-rw-r--r--gcc/testsuite/g++.dg/inherit/base3.C8
-rw-r--r--gcc/testsuite/g++.dg/inherit/thunk8.C2
-rw-r--r--gcc/testsuite/g++.dg/init/const6.C27
-rw-r--r--gcc/testsuite/g++.dg/init/value3.C31
-rw-r--r--gcc/testsuite/g++.dg/ipa/iinline-1.C47
-rw-r--r--gcc/testsuite/g++.dg/lookup/extern-c-redecl.C11
-rw-r--r--gcc/testsuite/g++.dg/lookup/new1.C4
-rw-r--r--gcc/testsuite/g++.dg/opt/pmf1.C76
-rw-r--r--gcc/testsuite/g++.dg/other/pr36944.C26
-rw-r--r--gcc/testsuite/g++.dg/parse/crash27.C3
-rw-r--r--gcc/testsuite/g++.dg/parse/crash42.C9
-rw-r--r--gcc/testsuite/g++.dg/parse/crash43.C9
-rw-r--r--gcc/testsuite/g++.dg/parse/error15.C2
-rw-r--r--gcc/testsuite/g++.dg/pch/array-1.C15
-rw-r--r--gcc/testsuite/g++.dg/pch/array-1.Hs4
-rw-r--r--gcc/testsuite/g++.dg/rtti/typeid8.C26
-rw-r--r--gcc/testsuite/g++.dg/template/crash60.C2
-rw-r--r--gcc/testsuite/g++.dg/template/crash7.C6
-rw-r--r--gcc/testsuite/g++.dg/template/crash80.C9
-rw-r--r--gcc/testsuite/g++.dg/template/crash81.C6
-rw-r--r--gcc/testsuite/g++.dg/torture/pr36826.C166
-rw-r--r--gcc/testsuite/g++.dg/torture/stackalign/check.h36
-rw-r--r--gcc/testsuite/g++.dg/torture/stackalign/eh-alloca-1.C56
-rw-r--r--gcc/testsuite/g++.dg/torture/stackalign/eh-fastcall-1.C43
-rw-r--r--gcc/testsuite/g++.dg/torture/stackalign/eh-global-1.C39
-rw-r--r--gcc/testsuite/g++.dg/torture/stackalign/eh-inline-1.C39
-rw-r--r--gcc/testsuite/g++.dg/torture/stackalign/eh-inline-2.C57
-rw-r--r--gcc/testsuite/g++.dg/torture/stackalign/eh-vararg-1.C72
-rw-r--r--gcc/testsuite/g++.dg/torture/stackalign/eh-vararg-2.C77
-rw-r--r--gcc/testsuite/g++.dg/torture/stackalign/stackalign.exp39
-rw-r--r--gcc/testsuite/g++.dg/torture/stackalign/stdcall-1.C17
-rw-r--r--gcc/testsuite/g++.dg/torture/stackalign/test-unwind.h132
-rw-r--r--gcc/testsuite/g++.dg/torture/stackalign/throw-1.C61
-rw-r--r--gcc/testsuite/g++.dg/torture/stackalign/throw-2.C52
-rw-r--r--gcc/testsuite/g++.dg/torture/stackalign/throw-3.C52
-rw-r--r--gcc/testsuite/g++.dg/torture/stackalign/throw-4.C54
-rw-r--r--gcc/testsuite/g++.dg/torture/stackalign/unwind-0.C12
-rw-r--r--gcc/testsuite/g++.dg/torture/stackalign/unwind-1.C16
-rw-r--r--gcc/testsuite/g++.dg/torture/stackalign/unwind-2.C29
-rw-r--r--gcc/testsuite/g++.dg/torture/stackalign/unwind-3.C35
-rw-r--r--gcc/testsuite/g++.dg/torture/stackalign/unwind-4.C17
-rw-r--r--gcc/testsuite/g++.dg/torture/stackalign/unwind-5.C31
-rw-r--r--gcc/testsuite/g++.dg/torture/stackalign/unwind-6.C31
-rw-r--r--gcc/testsuite/g++.dg/tree-ssa/new1.C42
-rw-r--r--gcc/testsuite/g++.dg/tree-ssa/pr19637.C3
-rw-r--r--gcc/testsuite/g++.dg/tree-ssa/pr31146-2.C2
-rw-r--r--gcc/testsuite/g++.dg/tree-ssa/pr37084.C16
-rw-r--r--gcc/testsuite/g++.dg/warn/Wconversion-integer.C4
-rw-r--r--gcc/testsuite/g++.dg/warn/Wconversion-pr34389.C53
-rw-r--r--gcc/testsuite/g++.dg/warn/Wsign-conversion.C8
-rw-r--r--gcc/testsuite/g++.dg/warn/Wuninitializable-member-no.C15
-rw-r--r--gcc/testsuite/g++.dg/warn/Wuninitializable-member.C14
-rw-r--r--gcc/testsuite/g++.dg/warn/pr12242.C57
-rw-r--r--gcc/testsuite/g++.dg/warn/pr23075.C2
-rw-r--r--gcc/testsuite/g++.dg/warn/pr26785.C10
-rw-r--r--gcc/testsuite/g++.dg/warn/pr30551-2.C6
-rw-r--r--gcc/testsuite/g++.dg/warn/pr30551.C6
-rw-r--r--gcc/testsuite/g++.dg/warn/pr34985.C9
-rw-r--r--gcc/testsuite/g++.dg/warn/pr35635.C89
-rw-r--r--gcc/testsuite/g++.dg/warn/pr36999.C40
-rw-r--r--gcc/testsuite/g++.dg/warn/pr8715.C11
-rw-r--r--gcc/testsuite/g++.old-deja/g++.benjamin/tem03.C8
-rw-r--r--gcc/testsuite/g++.old-deja/g++.benjamin/tem04.C2
-rw-r--r--gcc/testsuite/g++.old-deja/g++.brendan/crash52.C2
-rw-r--r--gcc/testsuite/g++.old-deja/g++.brendan/crash7.C2
-rw-r--r--gcc/testsuite/g++.old-deja/g++.jason/report.C4
-rw-r--r--gcc/testsuite/g++.old-deja/g++.jason/thunk3.C2
-rw-r--r--gcc/testsuite/g++.old-deja/g++.other/decl5.C4
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/error2.C2
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20001226-1.c2
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20080704-1.c2
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20080721-1.c15
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20080806-1.c41
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20080812-1.c21
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr11832.c4
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr33009.c4
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr35432.c11
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr36238.c27
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr36988.c11
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr37026.c12
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr37056.c28
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20031003-1.c6
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20080719-1.c65
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20080813-1.c30
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/conversion.c12
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/ieee/inf-2.c4
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/ieee/rbug.c6
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr36691.c17
-rw-r--r--gcc/testsuite/gcc.dg/20040206-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/20041213-1.c20
-rw-r--r--gcc/testsuite/gcc.dg/20080615-1.c25
-rw-r--r--gcc/testsuite/gcc.dg/Wall.c3
-rw-r--r--gcc/testsuite/gcc.dg/Wconversion-integer-no-sign.c4
-rw-r--r--gcc/testsuite/gcc.dg/Wconversion-integer.c8
-rw-r--r--gcc/testsuite/gcc.dg/Wconversion-pr34389.c53
-rw-r--r--gcc/testsuite/gcc.dg/Wcxx-compat-2.c53
-rw-r--r--gcc/testsuite/gcc.dg/Wdeclaration-after-statement-3.c24
-rw-r--r--gcc/testsuite/gcc.dg/Wno-all.c3
-rw-r--r--gcc/testsuite/gcc.dg/Wpointer-arith.c10
-rw-r--r--gcc/testsuite/gcc.dg/Wredundant-decls-2.c10
-rw-r--r--gcc/testsuite/gcc.dg/Wshadow-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/Wsign-conversion.c8
-rw-r--r--gcc/testsuite/gcc.dg/Wstrict-aliasing-bogus-ref-all-2.c24
-rw-r--r--gcc/testsuite/gcc.dg/Wstrict-aliasing-float-ptr-int-obj.c4
-rw-r--r--gcc/testsuite/gcc.dg/arm-g2.c1
-rw-r--r--gcc/testsuite/gcc.dg/arm-mmx-1.c5
-rw-r--r--gcc/testsuite/gcc.dg/arm-scd42-2.c1
-rw-r--r--gcc/testsuite/gcc.dg/array-5.c2
-rw-r--r--gcc/testsuite/gcc.dg/attr-noinline.c12
-rw-r--r--gcc/testsuite/gcc.dg/cpp/line6.c7
-rw-r--r--gcc/testsuite/gcc.dg/cpp/mi8.c8
-rw-r--r--gcc/testsuite/gcc.dg/cpp/mi8a.h1
-rw-r--r--gcc/testsuite/gcc.dg/cpp/mi8b.h4
-rw-r--r--gcc/testsuite/gcc.dg/cpp/mi8c.h4
-rw-r--r--gcc/testsuite/gcc.dg/cpp/mi8d.h1
-rw-r--r--gcc/testsuite/gcc.dg/decl-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/decl-3.c2
-rw-r--r--gcc/testsuite/gcc.dg/decl-4.c4
-rw-r--r--gcc/testsuite/gcc.dg/decl-8.c4
-rw-r--r--gcc/testsuite/gcc.dg/dfp/func-vararg-alternate-d128-2.c21
-rw-r--r--gcc/testsuite/gcc.dg/dfp/func-vararg-mixed-2.c118
-rw-r--r--gcc/testsuite/gcc.dg/dll-2.c4
-rw-r--r--gcc/testsuite/gcc.dg/dll-3.c2
-rw-r--r--gcc/testsuite/gcc.dg/enum-compat-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/fold-alloca-1.c6
-rw-r--r--gcc/testsuite/gcc.dg/free-1.c26
-rw-r--r--gcc/testsuite/gcc.dg/free-2.c26
-rw-r--r--gcc/testsuite/gcc.dg/fshort-wchar.c1
-rw-r--r--gcc/testsuite/gcc.dg/funcdef-var-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/funcdef-var-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/gomp/atomic-11.c17
-rw-r--r--gcc/testsuite/gcc.dg/gomp/block-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/gomp/block-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/gomp/block-3.c6
-rw-r--r--gcc/testsuite/gcc.dg/gomp/block-4.c2
-rw-r--r--gcc/testsuite/gcc.dg/gomp/block-5.c4
-rw-r--r--gcc/testsuite/gcc.dg/gomp/block-6.c2
-rw-r--r--gcc/testsuite/gcc.dg/gomp/block-7.c12
-rw-r--r--gcc/testsuite/gcc.dg/gomp/block-8.c2
-rw-r--r--gcc/testsuite/gcc.dg/hex-round-1.c1
-rw-r--r--gcc/testsuite/gcc.dg/hex-round-2.c1
-rw-r--r--gcc/testsuite/gcc.dg/inline-14.c4
-rw-r--r--gcc/testsuite/gcc.dg/inline1.c2
-rw-r--r--gcc/testsuite/gcc.dg/inline3.c2
-rw-r--r--gcc/testsuite/gcc.dg/inline4.c2
-rw-r--r--gcc/testsuite/gcc.dg/inline5.c2
-rw-r--r--gcc/testsuite/gcc.dg/intmax_t-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/ipa/iinline-1.c26
-rw-r--r--gcc/testsuite/gcc.dg/ipa/modif-1.c44
-rw-r--r--gcc/testsuite/gcc.dg/label-decl-4.c4
-rw-r--r--gcc/testsuite/gcc.dg/mallign.c15
-rw-r--r--gcc/testsuite/gcc.dg/nested-redef-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/noncompile/20020220-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/noncompile/label-1.c6
-rw-r--r--gcc/testsuite/gcc.dg/noncompile/label-lineno-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/noncompile/redecl-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/old-style-then-proto-1.c18
-rw-r--r--gcc/testsuite/gcc.dg/parm-mismatch-1.c8
-rw-r--r--gcc/testsuite/gcc.dg/parser-pr28152-2.c11
-rw-r--r--gcc/testsuite/gcc.dg/parser-pr28152.c11
-rw-r--r--gcc/testsuite/gcc.dg/pch/cpp-3.c13
-rw-r--r--gcc/testsuite/gcc.dg/pch/cpp-3.hs4
-rw-r--r--gcc/testsuite/gcc.dg/pch/cpp-3a.h4
-rw-r--r--gcc/testsuite/gcc.dg/pch/cpp-3b.h4
-rw-r--r--gcc/testsuite/gcc.dg/pch/valid-3.c6
-rw-r--r--gcc/testsuite/gcc.dg/pch/valid-3.hs3
-rw-r--r--gcc/testsuite/gcc.dg/pr15236.c9
-rw-r--r--gcc/testsuite/gcc.dg/pr15360-1.c4
-rw-r--r--gcc/testsuite/gcc.dg/pr27953.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr30551-2.c8
-rw-r--r--gcc/testsuite/gcc.dg/pr30551-3.c7
-rw-r--r--gcc/testsuite/gcc.dg/pr30551-4.c8
-rw-r--r--gcc/testsuite/gcc.dg/pr30551-5.c7
-rw-r--r--gcc/testsuite/gcc.dg/pr30551-6.c7
-rw-r--r--gcc/testsuite/gcc.dg/pr30551.c7
-rw-r--r--gcc/testsuite/gcc.dg/pr3074-1.c3
-rw-r--r--gcc/testsuite/gcc.dg/pr32370.c4
-rw-r--r--gcc/testsuite/gcc.dg/pr34985.c9
-rw-r--r--gcc/testsuite/gcc.dg/pr35635.c90
-rw-r--r--gcc/testsuite/gcc.dg/pr35746.c13
-rw-r--r--gcc/testsuite/gcc.dg/pr35899.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr36901-1.c7
-rw-r--r--gcc/testsuite/gcc.dg/pr36901-2.c7
-rw-r--r--gcc/testsuite/gcc.dg/pr36901-3.c9
-rw-r--r--gcc/testsuite/gcc.dg/pr36901-4.c9
-rw-r--r--gcc/testsuite/gcc.dg/pr36901-system.h3
-rw-r--r--gcc/testsuite/gcc.dg/pr36901.h2
-rw-r--r--gcc/testsuite/gcc.dg/pr36991.c12
-rw-r--r--gcc/testsuite/gcc.dg/pr36997.c8
-rw-r--r--gcc/testsuite/gcc.dg/pr36998.c23
-rw-r--r--gcc/testsuite/gcc.dg/pr8715.c13
-rw-r--r--gcc/testsuite/gcc.dg/pragma-message.c53
-rw-r--r--gcc/testsuite/gcc.dg/proto-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/qual-return-3.c2
-rw-r--r--gcc/testsuite/gcc.dg/redecl-1.c24
-rw-r--r--gcc/testsuite/gcc.dg/redecl-11.c2
-rw-r--r--gcc/testsuite/gcc.dg/redecl-12.c2
-rw-r--r--gcc/testsuite/gcc.dg/redecl-13.c2
-rw-r--r--gcc/testsuite/gcc.dg/redecl-15.c2
-rw-r--r--gcc/testsuite/gcc.dg/redecl-16.c2
-rw-r--r--gcc/testsuite/gcc.dg/redecl-2.c16
-rw-r--r--gcc/testsuite/gcc.dg/redecl-5.c2
-rw-r--r--gcc/testsuite/gcc.dg/sequence-pt-pr17880.c54
-rw-r--r--gcc/testsuite/gcc.dg/sibcall-3.c2
-rw-r--r--gcc/testsuite/gcc.dg/sibcall-4.c2
-rw-r--r--gcc/testsuite/gcc.dg/tls/diag-3.c4
-rw-r--r--gcc/testsuite/gcc.dg/torture/20080716-1.c58
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr25183.c10
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr36978.c14
-rw-r--r--gcc/testsuite/gcc.dg/torture/reassoc-1.c24
-rw-r--r--gcc/testsuite/gcc.dg/torture/stackalign/alloca-1.c44
-rw-r--r--gcc/testsuite/gcc.dg/torture/stackalign/alloca-2.c56
-rw-r--r--gcc/testsuite/gcc.dg/torture/stackalign/alloca-3.c56
-rw-r--r--gcc/testsuite/gcc.dg/torture/stackalign/alloca-4.c41
-rw-r--r--gcc/testsuite/gcc.dg/torture/stackalign/builtin-apply-1.c9
-rw-r--r--gcc/testsuite/gcc.dg/torture/stackalign/builtin-apply-2.c30
-rw-r--r--gcc/testsuite/gcc.dg/torture/stackalign/builtin-apply-3.c31
-rw-r--r--gcc/testsuite/gcc.dg/torture/stackalign/builtin-apply-4.c29
-rw-r--r--gcc/testsuite/gcc.dg/torture/stackalign/builtin-return-1.c34
-rw-r--r--gcc/testsuite/gcc.dg/torture/stackalign/check.h36
-rw-r--r--gcc/testsuite/gcc.dg/torture/stackalign/comp-goto-1.c41
-rw-r--r--gcc/testsuite/gcc.dg/torture/stackalign/fastcall-1.c31
-rw-r--r--gcc/testsuite/gcc.dg/torture/stackalign/global-1.c27
-rw-r--r--gcc/testsuite/gcc.dg/torture/stackalign/inline-1.c28
-rw-r--r--gcc/testsuite/gcc.dg/torture/stackalign/inline-2.c45
-rw-r--r--gcc/testsuite/gcc.dg/torture/stackalign/nested-1.c44
-rw-r--r--gcc/testsuite/gcc.dg/torture/stackalign/nested-2.c45
-rw-r--r--gcc/testsuite/gcc.dg/torture/stackalign/nested-3.c62
-rw-r--r--gcc/testsuite/gcc.dg/torture/stackalign/nested-4.c33
-rw-r--r--gcc/testsuite/gcc.dg/torture/stackalign/nested-5.c38
-rw-r--r--gcc/testsuite/gcc.dg/torture/stackalign/nested-6.c28
-rw-r--r--gcc/testsuite/gcc.dg/torture/stackalign/non-local-goto-1.c55
-rw-r--r--gcc/testsuite/gcc.dg/torture/stackalign/non-local-goto-2.c56
-rw-r--r--gcc/testsuite/gcc.dg/torture/stackalign/non-local-goto-3.c42
-rw-r--r--gcc/testsuite/gcc.dg/torture/stackalign/non-local-goto-4.c38
-rw-r--r--gcc/testsuite/gcc.dg/torture/stackalign/non-local-goto-5.c11
-rw-r--r--gcc/testsuite/gcc.dg/torture/stackalign/pr16660-1.c17
-rw-r--r--gcc/testsuite/gcc.dg/torture/stackalign/pr16660-2.c12
-rw-r--r--gcc/testsuite/gcc.dg/torture/stackalign/pr16660-3.c14
-rw-r--r--gcc/testsuite/gcc.dg/torture/stackalign/push-1.c59
-rw-r--r--gcc/testsuite/gcc.dg/torture/stackalign/regparm-1.c60
-rw-r--r--gcc/testsuite/gcc.dg/torture/stackalign/ret-struct-1.c34
-rw-r--r--gcc/testsuite/gcc.dg/torture/stackalign/setjmp-1.c43
-rw-r--r--gcc/testsuite/gcc.dg/torture/stackalign/setjmp-2.c46
-rw-r--r--gcc/testsuite/gcc.dg/torture/stackalign/setjmp-3.c37
-rw-r--r--gcc/testsuite/gcc.dg/torture/stackalign/setjmp-4.c39
-rw-r--r--gcc/testsuite/gcc.dg/torture/stackalign/sibcall-1.c35
-rw-r--r--gcc/testsuite/gcc.dg/torture/stackalign/stackalign.exp52
-rw-r--r--gcc/testsuite/gcc.dg/torture/stackalign/struct-1.c28
-rw-r--r--gcc/testsuite/gcc.dg/torture/stackalign/vararg-1.c59
-rw-r--r--gcc/testsuite/gcc.dg/torture/stackalign/vararg-2.c65
-rw-r--r--gcc/testsuite/gcc.dg/torture/stackalign/vararg-3.c84
-rw-r--r--gcc/testsuite/gcc.dg/transparent-union-2.c8
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/20030728-1.c6
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/20080530.c22
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/data-dep-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/inline-2.c17
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/loadpre1.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr21658.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr30375.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/reassoc-14.c23
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/reassoc-15.c19
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/reassoc-16.c16
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/reassoc-17.c16
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/reassoc-18.c12
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/reassoc-3.c1
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/recip-2.c11
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/recip-6.c8
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/recip-7.c8
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-20.c15
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-21.c25
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-22.c15
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-23.c19
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-13.c4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-14.c4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-17.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-7.c10
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-8.c4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-9.c4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-15.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-18.c21
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/tailcall-3.c28
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/tailcall-4.c16
-rw-r--r--gcc/testsuite/gcc.dg/uninit-1-O0.c30
-rw-r--r--gcc/testsuite/gcc.dg/uninit-10-O0.c109
-rw-r--r--gcc/testsuite/gcc.dg/uninit-11-O0.c42
-rw-r--r--gcc/testsuite/gcc.dg/uninit-12-O0.c12
-rw-r--r--gcc/testsuite/gcc.dg/uninit-13-O0.c10
-rw-r--r--gcc/testsuite/gcc.dg/uninit-14-O0.c20
-rw-r--r--gcc/testsuite/gcc.dg/uninit-15-O0.c20
-rw-r--r--gcc/testsuite/gcc.dg/uninit-2-O0.c52
-rw-r--r--gcc/testsuite/gcc.dg/uninit-3-O0.c33
-rw-r--r--gcc/testsuite/gcc.dg/uninit-4-O0.c52
-rw-r--r--gcc/testsuite/gcc.dg/uninit-5-O0.c39
-rw-r--r--gcc/testsuite/gcc.dg/uninit-6-O0.c47
-rw-r--r--gcc/testsuite/gcc.dg/uninit-8-O0.c32
-rw-r--r--gcc/testsuite/gcc.dg/uninit-9-O0.c41
-rw-r--r--gcc/testsuite/gcc.dg/uninit-A-O0.c117
-rw-r--r--gcc/testsuite/gcc.dg/uninit-B-O0.c15
-rw-r--r--gcc/testsuite/gcc.dg/uninit-C-O0.c21
-rw-r--r--gcc/testsuite/gcc.dg/uninit-D-O0.c9
-rw-r--r--gcc/testsuite/gcc.dg/uninit-E-O0.c9
-rw-r--r--gcc/testsuite/gcc.dg/uninit-F-O0.c9
-rw-r--r--gcc/testsuite/gcc.dg/uninit-G-O0.c9
-rw-r--r--gcc/testsuite/gcc.dg/uninit-H-O0.c33
-rw-r--r--gcc/testsuite/gcc.dg/uninit-I-O0.c8
-rw-r--r--gcc/testsuite/gcc.dg/uninit-pr20644-O0.c24
-rw-r--r--gcc/testsuite/gcc.dg/uninit-pr20644.c24
-rw-r--r--gcc/testsuite/gcc.dg/unused-6-WallWextra.c11
-rw-r--r--gcc/testsuite/gcc.dg/unused-6-no.c11
-rw-r--r--gcc/testsuite/gcc.dg/utf-array-short-wchar.c41
-rw-r--r--gcc/testsuite/gcc.dg/utf-array.c41
-rw-r--r--gcc/testsuite/gcc.dg/utf-inc-init.c45
-rw-r--r--gcc/testsuite/gcc.dg/utf-type.c18
-rw-r--r--gcc/testsuite/gcc.dg/var-expand3.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-slp-34.c74
-rw-r--r--gcc/testsuite/gcc.dg/vect/fast-math-pr35982.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/fast-math-vect-complex-3.c61
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-11.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-12a.c8
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-12b.c8
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-19.c8
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-23.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-5.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-1.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-107.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-112.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-35.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-72.c3
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-98.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-complex-1.c56
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-complex-2.c56
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-complex-4.c109
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-complex-5.c45
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-multitypes-12.c44
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-multitypes-13.c63
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-multitypes-14.c50
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-multitypes-15.c50
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-4a.c9
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-4b.c9
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-4f.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-4g.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-4i.c29
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-4j.c5
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-4k.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-4l.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-reduc-dot-s8c.c6
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-reduc-dot-u8a.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-reduc-dot-u8b.c5
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1b.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-2b.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-strided-float.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-strided-store-a-u8-i2.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-widen-mult-u8.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/wrapv-vect-reduc-dot-s8b.c4
-rw-r--r--gcc/testsuite/gcc.dg/visibility-14.c9
-rw-r--r--gcc/testsuite/gcc.dg/visibility-15.c11
-rw-r--r--gcc/testsuite/gcc.dg/visibility-16.c9
-rw-r--r--gcc/testsuite/gcc.dg/visibility-17.c9
-rw-r--r--gcc/testsuite/gcc.dg/visibility-18.c7
-rw-r--r--gcc/testsuite/gcc.dg/visibility-19.c8
-rw-r--r--gcc/testsuite/gcc.dg/visibility-7.c2
-rw-r--r--gcc/testsuite/gcc.dg/winline-4.c11
-rw-r--r--gcc/testsuite/gcc.dg/wtr-static-1.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/20060512-1.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/20060512-2.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/20060512-3.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/20060512-4.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/20080723-1.c49
-rw-r--r--gcc/testsuite/gcc.target/i386/align-main-1.c25
-rw-r--r--gcc/testsuite/gcc.target/i386/align-main-2.c25
-rw-r--r--gcc/testsuite/gcc.target/i386/cmov8.c13
-rw-r--r--gcc/testsuite/gcc.target/i386/cold-1.c13
-rw-r--r--gcc/testsuite/gcc.target/i386/funcspec-1.c34
-rw-r--r--gcc/testsuite/gcc.target/i386/funcspec-10.c15
-rw-r--r--gcc/testsuite/gcc.target/i386/funcspec-11.c15
-rw-r--r--gcc/testsuite/gcc.target/i386/funcspec-2.c99
-rw-r--r--gcc/testsuite/gcc.target/i386/funcspec-3.c66
-rw-r--r--gcc/testsuite/gcc.target/i386/funcspec-4.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/funcspec-5.c125
-rw-r--r--gcc/testsuite/gcc.target/i386/funcspec-6.c71
-rw-r--r--gcc/testsuite/gcc.target/i386/funcspec-7.c13
-rw-r--r--gcc/testsuite/gcc.target/i386/funcspec-8.c161
-rw-r--r--gcc/testsuite/gcc.target/i386/funcspec-9.c36
-rw-r--r--gcc/testsuite/gcc.target/i386/hot-1.c33
-rw-r--r--gcc/testsuite/gcc.target/i386/incoming-1.c19
-rw-r--r--gcc/testsuite/gcc.target/i386/incoming-2.c19
-rw-r--r--gcc/testsuite/gcc.target/i386/incoming-3.c19
-rw-r--r--gcc/testsuite/gcc.target/i386/incoming-4.c20
-rw-r--r--gcc/testsuite/gcc.target/i386/incoming-5.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/opt-1.c35
-rw-r--r--gcc/testsuite/gcc.target/i386/opt-2.c38
-rw-r--r--gcc/testsuite/gcc.target/i386/pr32000-2.c26
-rw-r--r--gcc/testsuite/gcc.target/i386/pr36613.c44
-rw-r--r--gcc/testsuite/gcc.target/i386/pr36753.c31
-rw-r--r--gcc/testsuite/gcc.target/i386/pr36786.c13
-rw-r--r--gcc/testsuite/gcc.target/i386/pr36992-1.c12
-rw-r--r--gcc/testsuite/gcc.target/i386/pr36992-2.c12
-rw-r--r--gcc/testsuite/gcc.target/i386/pr37101.c64
-rw-r--r--gcc/testsuite/gcc.target/i386/regparm.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/sse-22.c171
-rw-r--r--gcc/testsuite/gcc.target/i386/sse-23.c108
-rw-r--r--gcc/testsuite/gcc.target/i386/stackalign/asm-1.c7
-rw-r--r--gcc/testsuite/gcc.target/i386/stackalign/return-1.c11
-rw-r--r--gcc/testsuite/gcc.target/i386/stackalign/return-2.c18
-rw-r--r--gcc/testsuite/gcc.target/i386/stackalign/return-3.c10
-rw-r--r--gcc/testsuite/gcc.target/i386/stackalign/return-4.c10
-rw-r--r--gcc/testsuite/gcc.target/i386/stackalign/return-5.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/stackalign/return-6.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/stackalign/stackalign.exp47
-rw-r--r--gcc/testsuite/gcc.target/i386/vararg-1.c32
-rw-r--r--gcc/testsuite/gcc.target/i386/vararg-2.c40
-rw-r--r--gcc/testsuite/gcc.target/ia64/20080802-1.c19
-rw-r--r--gcc/testsuite/gcc.target/mips/ext-1.c18
-rw-r--r--gcc/testsuite/gcc.target/powerpc/altivec-macros.c12
-rw-r--r--gcc/testsuite/gcc.target/powerpc/longcall-1.c13
-rw-r--r--gcc/testsuite/gcc.target/s390/pr36822.c16
-rw-r--r--gcc/testsuite/gcc.target/sparc/ultrasp3.c2
-rw-r--r--gcc/testsuite/gcc.target/spu/vector-ansi.c35
-rw-r--r--gcc/testsuite/gcc.target/spu/vector.c32
-rw-r--r--gcc/testsuite/gfortran.dg/allocatable_module_1.f9018
-rw-r--r--gcc/testsuite/gfortran.dg/argument_checking_7.f902
-rw-r--r--gcc/testsuite/gfortran.dg/array_4.f9012
-rw-r--r--gcc/testsuite/gfortran.dg/array_temporaries_1.f9019
-rw-r--r--gcc/testsuite/gfortran.dg/array_temporaries_2.f9015
-rw-r--r--gcc/testsuite/gfortran.dg/c_sizeof_2.f905
-rw-r--r--gcc/testsuite/gfortran.dg/char_cshift_3.f9013
-rw-r--r--gcc/testsuite/gfortran.dg/char_eoshift_5.f9024
-rw-r--r--gcc/testsuite/gfortran.dg/char_expr_1.f9020
-rw-r--r--gcc/testsuite/gfortran.dg/char_expr_2.f9015
-rw-r--r--gcc/testsuite/gfortran.dg/conflicts.f908
-rw-r--r--gcc/testsuite/gfortran.dg/cshift_nan_1.f9024
-rw-r--r--gcc/testsuite/gfortran.dg/extends_1.f0373
-rw-r--r--gcc/testsuite/gfortran.dg/extends_2.f0366
-rw-r--r--gcc/testsuite/gfortran.dg/extends_3.f0371
-rw-r--r--gcc/testsuite/gfortran.dg/extends_4.f0352
-rw-r--r--gcc/testsuite/gfortran.dg/extends_5.f0327
-rw-r--r--gcc/testsuite/gfortran.dg/extends_6.f0349
-rw-r--r--gcc/testsuite/gfortran.dg/finalize_9.f038
-rw-r--r--gcc/testsuite/gfortran.dg/fmt_error_3.f9036
-rw-r--r--gcc/testsuite/gfortran.dg/fmt_error_4.f9022
-rw-r--r--gcc/testsuite/gfortran.dg/fmt_error_5.f9022
-rw-r--r--gcc/testsuite/gfortran.dg/fmt_g0_2.f082
-rw-r--r--gcc/testsuite/gfortran.dg/fmt_g0_3.f082
-rw-r--r--gcc/testsuite/gfortran.dg/fmt_t_7.f32
-rw-r--r--gcc/testsuite/gfortran.dg/gamma_2.f9024
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/block-1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/internal_pack_4.f9031
-rw-r--r--gcc/testsuite/gfortran.dg/internal_pack_5.f9021
-rw-r--r--gcc/testsuite/gfortran.dg/intrinsic_argument_conformance_2.f9044
-rw-r--r--gcc/testsuite/gfortran.dg/intrinsic_optional_char_arg_1.f9031
-rw-r--r--gcc/testsuite/gfortran.dg/intrinsic_shadow_1.f0357
-rw-r--r--gcc/testsuite/gfortran.dg/intrinsic_shadow_2.f0329
-rw-r--r--gcc/testsuite/gfortran.dg/intrinsic_shadow_3.f0327
-rw-r--r--gcc/testsuite/gfortran.dg/intrinsic_std_1.f9048
-rw-r--r--gcc/testsuite/gfortran.dg/intrinsic_std_2.f9015
-rw-r--r--gcc/testsuite/gfortran.dg/intrinsic_std_3.f9015
-rw-r--r--gcc/testsuite/gfortran.dg/intrinsic_std_4.f9046
-rw-r--r--gcc/testsuite/gfortran.dg/module_md5_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_52.f9032
-rw-r--r--gcc/testsuite/gfortran.dg/parameter_array_init_4.f908
-rw-r--r--gcc/testsuite/gfortran.dg/pointer_to_substring.f9010
-rw-r--r--gcc/testsuite/gfortran.dg/pr36967.f25
-rw-r--r--gcc/testsuite/gfortran.dg/private_type_6.f902
-rw-r--r--gcc/testsuite/gfortran.dg/proc_decl_1.f904
-rw-r--r--gcc/testsuite/gfortran.dg/proc_ptr_9.f9018
-rw-r--r--gcc/testsuite/gfortran.dg/rank_2.f904
-rw-r--r--gcc/testsuite/gfortran.dg/reassoc_4.f43
-rw-r--r--gcc/testsuite/gfortran.dg/selected_char_kind_3.f904
-rw-r--r--gcc/testsuite/gfortran.dg/structure_constructor_7.f032
-rw-r--r--gcc/testsuite/gfortran.dg/structure_constructor_8.f034
-rw-r--r--gcc/testsuite/gfortran.dg/warn_std_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/warn_std_2.f908
-rw-r--r--gcc/testsuite/gfortran.dg/warn_std_3.f906
-rw-r--r--gcc/testsuite/gfortran.dg/zero_sized_1.f9010
-rw-r--r--gcc/testsuite/gfortran.dg/zero_sized_5.f9015
-rw-r--r--gcc/testsuite/gnat.dg/access_discr2.adb10
-rw-r--r--gcc/testsuite/gnat.dg/allocator_maxalign1.adb42
-rw-r--r--gcc/testsuite/gnat.dg/allocator_maxalign2.adb33
-rw-r--r--gcc/testsuite/gnat.dg/allocator_maxalign2.ads12
-rw-r--r--gcc/testsuite/gnat.dg/bip_aggregate_bug.adb49
-rw-r--r--gcc/testsuite/gnat.dg/boolean_expr1.adb30
-rw-r--r--gcc/testsuite/gnat.dg/boolean_expr1.ads5
-rw-r--r--gcc/testsuite/gnat.dg/boolean_expr2.adb18
-rw-r--r--gcc/testsuite/gnat.dg/decl_ctx_def.ads4
-rw-r--r--gcc/testsuite/gnat.dg/decl_ctx_use.adb14
-rw-r--r--gcc/testsuite/gnat.dg/decl_ctx_use.ads5
-rw-r--r--gcc/testsuite/gnat.dg/deferred_const1.adb12
-rw-r--r--gcc/testsuite/gnat.dg/deferred_const2.adb11
-rw-r--r--gcc/testsuite/gnat.dg/deferred_const2_pkg.adb11
-rw-r--r--gcc/testsuite/gnat.dg/deferred_const2_pkg.ads12
-rw-r--r--gcc/testsuite/gnat.dg/deferred_const3.adb19
-rw-r--r--gcc/testsuite/gnat.dg/deferred_const3_pkg.adb19
-rw-r--r--gcc/testsuite/gnat.dg/deferred_const3_pkg.ads21
-rw-r--r--gcc/testsuite/gnat.dg/discr10.adb8
-rw-r--r--gcc/testsuite/gnat.dg/discr10.ads23
-rw-r--r--gcc/testsuite/gnat.dg/exp0_eval.adb31
-rw-r--r--gcc/testsuite/gnat.dg/iface_test.adb28
-rw-r--r--gcc/testsuite/gnat.dg/iface_test.ads18
-rw-r--r--gcc/testsuite/gnat.dg/missing_acc_check.adb39
-rw-r--r--gcc/testsuite/gnat.dg/not_null.adb24
-rw-r--r--gcc/testsuite/gnat.dg/protected_self_ref1.adb25
-rw-r--r--gcc/testsuite/gnat.dg/protected_self_ref2.adb18
-rw-r--r--gcc/testsuite/gnat.dg/raise_from_pure.adb11
-rw-r--r--gcc/testsuite/gnat.dg/raise_from_pure.ads5
-rw-r--r--gcc/testsuite/gnat.dg/specs/genericppc.ads7
-rw-r--r--gcc/testsuite/gnat.dg/specs/null_aggr_bug.ads20
-rw-r--r--gcc/testsuite/gnat.dg/specs/sync_iface_test.ads14
-rw-r--r--gcc/testsuite/gnat.dg/sync_iface_test.adb19
-rw-r--r--gcc/testsuite/gnat.dg/sync_iface_test.ads11
-rw-r--r--gcc/testsuite/gnat.dg/test_ai254.adb12
-rw-r--r--gcc/testsuite/gnat.dg/test_allocator_maxalign2.adb8
-rw-r--r--gcc/testsuite/gnat.dg/test_call.adb24
-rw-r--r--gcc/testsuite/gnat.dg/test_raise_from_pure.adb9
-rw-r--r--gcc/testsuite/gnat.dg/tree_static_def.adb11
-rw-r--r--gcc/testsuite/gnat.dg/tree_static_def.ads10
-rw-r--r--gcc/testsuite/gnat.dg/tree_static_use.adb12
-rw-r--r--gcc/testsuite/gnat.dg/wrap_raise_from_pure.adb10
-rw-r--r--gcc/testsuite/gnat.dg/wrap_raise_from_pure.ads4
-rw-r--r--gcc/testsuite/lib/compat.exp2
-rw-r--r--gcc/testsuite/lib/target-supports-dg.exp3
-rw-r--r--gcc/testsuite/lib/target-supports.exp91
-rw-r--r--gcc/testsuite/objc.dg/gnu-encoding/gnu-encoding.exp12
-rw-r--r--gcc/toplev.c30
-rw-r--r--gcc/toplev.h17
-rw-r--r--gcc/tracer.c8
-rw-r--r--gcc/tree-affine.c66
-rw-r--r--gcc/tree-call-cdce.c205
-rw-r--r--gcc/tree-cfg.c3518
-rw-r--r--gcc/tree-cfgcleanup.c179
-rw-r--r--gcc/tree-chrec.c20
-rw-r--r--gcc/tree-chrec.h4
-rw-r--r--gcc/tree-complex.c811
-rw-r--r--gcc/tree-data-ref.c264
-rw-r--r--gcc/tree-data-ref.h16
-rw-r--r--gcc/tree-dfa.c209
-rw-r--r--gcc/tree-dump.c26
-rw-r--r--gcc/tree-eh.c1799
-rw-r--r--gcc/tree-flow-inline.h406
-rw-r--r--gcc/tree-flow.h322
-rw-r--r--gcc/tree-gimple.c653
-rw-r--r--gcc/tree-gimple.h235
-rw-r--r--gcc/tree-if-conv.c284
-rw-r--r--gcc/tree-inline.c2313
-rw-r--r--gcc/tree-inline.h27
-rw-r--r--gcc/tree-into-ssa.c322
-rw-r--r--gcc/tree-iterator.c2
-rw-r--r--gcc/tree-loop-distribution.c134
-rw-r--r--gcc/tree-loop-linear.c24
-rw-r--r--gcc/tree-mudflap.c316
-rw-r--r--gcc/tree-nested.c1000
-rw-r--r--gcc/tree-nomudflap.c2
-rw-r--r--gcc/tree-nrv.c98
-rw-r--r--gcc/tree-object-size.c391
-rw-r--r--gcc/tree-optimize.c73
-rw-r--r--gcc/tree-outof-ssa.c272
-rw-r--r--gcc/tree-parloops.c516
-rw-r--r--gcc/tree-pass.h8
-rw-r--r--gcc/tree-phinodes.c216
-rw-r--r--gcc/tree-predcom.c444
-rw-r--r--gcc/tree-pretty-print.c521
-rw-r--r--gcc/tree-profile.c188
-rw-r--r--gcc/tree-scalar-evolution.c597
-rw-r--r--gcc/tree-scalar-evolution.h4
-rw-r--r--gcc/tree-sra.c750
-rw-r--r--gcc/tree-ssa-address.c32
-rw-r--r--gcc/tree-ssa-alias-warnings.c159
-rw-r--r--gcc/tree-ssa-alias.c206
-rw-r--r--gcc/tree-ssa-ccp.c1553
-rw-r--r--gcc/tree-ssa-coalesce.c152
-rw-r--r--gcc/tree-ssa-copy.c235
-rw-r--r--gcc/tree-ssa-copyrename.c35
-rw-r--r--gcc/tree-ssa-dce.c242
-rw-r--r--gcc/tree-ssa-dom.c1662
-rw-r--r--gcc/tree-ssa-dse.c185
-rw-r--r--gcc/tree-ssa-forwprop.c595
-rw-r--r--gcc/tree-ssa-ifcombine.c258
-rw-r--r--gcc/tree-ssa-live.c123
-rw-r--r--gcc/tree-ssa-live.h4
-rw-r--r--gcc/tree-ssa-loop-ch.c46
-rw-r--r--gcc/tree-ssa-loop-im.c573
-rw-r--r--gcc/tree-ssa-loop-ivcanon.c96
-rw-r--r--gcc/tree-ssa-loop-ivopts.c383
-rw-r--r--gcc/tree-ssa-loop-manip.c153
-rw-r--r--gcc/tree-ssa-loop-niter.c386
-rw-r--r--gcc/tree-ssa-loop-prefetch.c65
-rw-r--r--gcc/tree-ssa-loop-unswitch.c28
-rw-r--r--gcc/tree-ssa-loop.c15
-rw-r--r--gcc/tree-ssa-math-opts.c217
-rw-r--r--gcc/tree-ssa-operands.c723
-rw-r--r--gcc/tree-ssa-operands.h37
-rw-r--r--gcc/tree-ssa-phiopt.c396
-rw-r--r--gcc/tree-ssa-phiprop.c88
-rw-r--r--gcc/tree-ssa-pre.c965
-rw-r--r--gcc/tree-ssa-propagate.c684
-rw-r--r--gcc/tree-ssa-propagate.h38
-rw-r--r--gcc/tree-ssa-reassoc.c851
-rw-r--r--gcc/tree-ssa-sccvn.c743
-rw-r--r--gcc/tree-ssa-sccvn.h35
-rw-r--r--gcc/tree-ssa-sink.c112
-rw-r--r--gcc/tree-ssa-structalias.c389
-rw-r--r--gcc/tree-ssa-structalias.h4
-rw-r--r--gcc/tree-ssa-ter.c101
-rw-r--r--gcc/tree-ssa-threadedge.c258
-rw-r--r--gcc/tree-ssa-threadupdate.c48
-rw-r--r--gcc/tree-ssa-uncprop.c58
-rw-r--r--gcc/tree-ssa.c294
-rw-r--r--gcc/tree-ssanames.c18
-rw-r--r--gcc/tree-stdarg.c227
-rw-r--r--gcc/tree-switch-conversion.c262
-rw-r--r--gcc/tree-tailcall.c477
-rw-r--r--gcc/tree-vect-analyze.c411
-rw-r--r--gcc/tree-vect-generic.c191
-rw-r--r--gcc/tree-vect-patterns.c289
-rw-r--r--gcc/tree-vect-transform.c1811
-rw-r--r--gcc/tree-vectorizer.c588
-rw-r--r--gcc/tree-vectorizer.h116
-rw-r--r--gcc/tree-vrp.c991
-rw-r--r--gcc/tree.c485
-rw-r--r--gcc/tree.def79
-rw-r--r--gcc/tree.h353
-rw-r--r--gcc/treestruct.def3
-rw-r--r--gcc/value-prof.c740
-rw-r--r--gcc/value-prof.h24
-rw-r--r--gcc/varasm.c12
-rw-r--r--gcc/varpool.c51
-rw-r--r--gnattools/ChangeLog28
-rw-r--r--gnattools/Makefile.in35
-rwxr-xr-xgnattools/configure995
-rw-r--r--gnattools/configure.ac17
-rw-r--r--libada/ChangeLog32
-rw-r--r--libada/Makefile.in46
-rwxr-xr-xlibada/configure983
-rw-r--r--libada/configure.ac14
-rw-r--r--libcpp/ChangeLog38
-rw-r--r--libcpp/directives-only.c3
-rw-r--r--libcpp/directives.c47
-rw-r--r--libcpp/errors.c2
-rw-r--r--libcpp/files.c55
-rw-r--r--libcpp/include/line-map.h17
-rw-r--r--libcpp/internal.h4
-rw-r--r--libcpp/lex.c2
-rw-r--r--libcpp/line-map.c6
-rw-r--r--libcpp/macro.c11
-rw-r--r--libcpp/traditional.c2
-rw-r--r--libffi/ChangeLog5
-rw-r--r--libffi/src/sh/ffi.c5
-rw-r--r--libgcc/ChangeLog4
-rw-r--r--libgcc/config.host4
-rw-r--r--libgfortran/ChangeLog98
-rw-r--r--libgfortran/Makefile.am21
-rw-r--r--libgfortran/Makefile.in167
-rw-r--r--libgfortran/generated/cshift0_c10.c176
-rw-r--r--libgfortran/generated/cshift0_c16.c176
-rw-r--r--libgfortran/generated/cshift0_c4.c176
-rw-r--r--libgfortran/generated/cshift0_c8.c176
-rw-r--r--libgfortran/generated/cshift0_i1.c176
-rw-r--r--libgfortran/generated/cshift0_i16.c176
-rw-r--r--libgfortran/generated/cshift0_i2.c176
-rw-r--r--libgfortran/generated/cshift0_i4.c176
-rw-r--r--libgfortran/generated/cshift0_i8.c176
-rw-r--r--libgfortran/generated/cshift0_r10.c176
-rw-r--r--libgfortran/generated/cshift0_r16.c176
-rw-r--r--libgfortran/generated/cshift0_r4.c176
-rw-r--r--libgfortran/generated/cshift0_r8.c176
-rw-r--r--libgfortran/generated/cshift1_16.c8
-rw-r--r--libgfortran/generated/cshift1_4.c8
-rw-r--r--libgfortran/generated/cshift1_8.c8
-rw-r--r--libgfortran/generated/eoshift1_16.c5
-rw-r--r--libgfortran/generated/eoshift1_4.c5
-rw-r--r--libgfortran/generated/eoshift1_8.c5
-rw-r--r--libgfortran/generated/eoshift3_16.c5
-rw-r--r--libgfortran/generated/eoshift3_4.c5
-rw-r--r--libgfortran/generated/eoshift3_8.c5
-rw-r--r--libgfortran/gfortran.map1
-rw-r--r--libgfortran/intrinsics/cshift0.c340
-rw-r--r--libgfortran/intrinsics/eoshift0.c5
-rw-r--r--libgfortran/intrinsics/eoshift2.c13
-rw-r--r--libgfortran/io/file_pos.c2
-rw-r--r--libgfortran/io/format.c10
-rw-r--r--libgfortran/io/list_read.c2
-rw-r--r--libgfortran/io/write_float.def53
-rw-r--r--libgfortran/libgfortran.h60
-rw-r--r--libgfortran/m4/cshift0.m4177
-rw-r--r--libgfortran/m4/cshift1.m48
-rw-r--r--libgfortran/m4/eoshift1.m45
-rw-r--r--libgfortran/m4/eoshift3.m45
-rw-r--r--libgfortran/runtime/error.c15
-rw-r--r--libgomp/ChangeLog16
-rw-r--r--libgomp/config/linux/mips/futex.h75
-rw-r--r--libgomp/configure.tgt4
-rw-r--r--libgomp/libgomp.texi7
-rw-r--r--libgomp/team.c3
-rw-r--r--libiberty/ChangeLog24
-rw-r--r--libiberty/Makefile.in150
-rw-r--r--libiberty/functions.texi16
-rw-r--r--libiberty/maint-tool4
-rw-r--r--libiberty/make-temp-file.c12
-rw-r--r--libiberty/mkstemps.c7
-rw-r--r--libiberty/pex-win32.c37
-rw-r--r--libjava/ChangeLog19
-rw-r--r--libjava/HACKING4
-rw-r--r--libjava/gcj/javaprims.h8
-rw-r--r--libjava/scripts/jar.in7
-rw-r--r--libjava/testsuite/libjava.lang/StackTrace2.jarbin1990 -> 3165 bytes
-rw-r--r--libjava/testsuite/libjava.lang/StackTrace2.java12
-rw-r--r--libjava/testsuite/libjava.lang/StackTrace2.out2
-rw-r--r--libobjc/ChangeLog9
-rw-r--r--libobjc/Makefile.in5
-rw-r--r--libstdc++-v3/ChangeLog472
-rw-r--r--libstdc++-v3/Makefile.in1
-rw-r--r--libstdc++-v3/acinclude.m4168
-rw-r--r--libstdc++-v3/config.h.in27
-rw-r--r--libstdc++-v3/config/abi/pre/gnu.ver85
-rw-r--r--libstdc++-v3/config/locale/darwin/ctype_members.cc3
-rw-r--r--libstdc++-v3/config/locale/generic/c_locale.cc3
-rw-r--r--libstdc++-v3/config/locale/generic/ctype_members.cc3
-rw-r--r--libstdc++-v3/config/locale/gnu/ctype_members.cc3
-rw-r--r--libstdc++-v3/config/os/gnu-linux/arm-eabi-extra.ver18
-rwxr-xr-xlibstdc++-v3/configure3939
-rw-r--r--libstdc++-v3/configure.ac32
-rw-r--r--libstdc++-v3/configure.host5
-rw-r--r--libstdc++-v3/crossconfig.m436
-rw-r--r--libstdc++-v3/doc/Makefile.in1
-rw-r--r--libstdc++-v3/doc/doxygen/doxygroups.cc7
-rw-r--r--libstdc++-v3/doc/doxygen/user.cfg.in16
-rw-r--r--libstdc++-v3/include/Makefile.am1
-rw-r--r--libstdc++-v3/include/Makefile.in2
-rw-r--r--libstdc++-v3/include/bits/basic_string.h87
-rw-r--r--libstdc++-v3/include/bits/basic_string.tcc10
-rw-r--r--libstdc++-v3/include/bits/c++config6
-rw-r--r--libstdc++-v3/include/bits/char_traits.h16
-rw-r--r--libstdc++-v3/include/bits/ios_base.h17
-rw-r--r--libstdc++-v3/include/bits/postypes.h22
-rw-r--r--libstdc++-v3/include/bits/stl_bvector.h30
-rw-r--r--libstdc++-v3/include/bits/stl_deque.h68
-rw-r--r--libstdc++-v3/include/bits/stl_list.h58
-rw-r--r--libstdc++-v3/include/bits/stl_map.h37
-rw-r--r--libstdc++-v3/include/bits/stl_multimap.h49
-rw-r--r--libstdc++-v3/include/bits/stl_multiset.h49
-rw-r--r--libstdc++-v3/include/bits/stl_pair.h2
-rw-r--r--libstdc++-v3/include/bits/stl_set.h49
-rw-r--r--libstdc++-v3/include/bits/stl_vector.h72
-rw-r--r--libstdc++-v3/include/bits/unique_ptr.h5
-rw-r--r--libstdc++-v3/include/debug/deque28
-rw-r--r--libstdc++-v3/include/debug/list26
-rw-r--r--libstdc++-v3/include/debug/map.h19
-rw-r--r--libstdc++-v3/include/debug/multimap.h19
-rw-r--r--libstdc++-v3/include/debug/multiset.h19
-rw-r--r--libstdc++-v3/include/debug/safe_association.h14
-rw-r--r--libstdc++-v3/include/debug/set.h19
-rw-r--r--libstdc++-v3/include/debug/string56
-rw-r--r--libstdc++-v3/include/debug/unordered_map33
-rw-r--r--libstdc++-v3/include/debug/unordered_set33
-rw-r--r--libstdc++-v3/include/debug/vector44
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/debug_fn_imps.hpp33
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/debug_map_base.hpp3
-rw-r--r--libstdc++-v3/include/ext/rc_string_base.h2
-rw-r--r--libstdc++-v3/include/ext/sso_string_base.h2
-rw-r--r--libstdc++-v3/include/ext/vstring.h85
-rw-r--r--libstdc++-v3/include/parallel/losertree.h2
-rw-r--r--libstdc++-v3/include/precompiled/stdc++.h3
-rw-r--r--libstdc++-v3/include/std/chrono637
-rw-r--r--libstdc++-v3/include/std/complex2
-rw-r--r--libstdc++-v3/include/std/condition_variable75
-rw-r--r--libstdc++-v3/include/std/mutex129
-rw-r--r--libstdc++-v3/include/std/ratio10
-rw-r--r--libstdc++-v3/include/std/unordered_map1
-rw-r--r--libstdc++-v3/include/std/unordered_set1
-rw-r--r--libstdc++-v3/include/std/utility1
-rw-r--r--libstdc++-v3/include/std/valarray36
-rw-r--r--libstdc++-v3/include/tr1/type_traits51
-rw-r--r--libstdc++-v3/include/tr1_impl/boost_shared_ptr.h9
-rw-r--r--libstdc++-v3/include/tr1_impl/cstdint12
-rw-r--r--libstdc++-v3/include/tr1_impl/hashtable6
-rw-r--r--libstdc++-v3/include/tr1_impl/regex718
-rw-r--r--libstdc++-v3/include/tr1_impl/type_traits193
-rw-r--r--libstdc++-v3/include/tr1_impl/unordered_map34
-rw-r--r--libstdc++-v3/include/tr1_impl/unordered_set34
-rw-r--r--libstdc++-v3/libmath/Makefile.in1
-rw-r--r--libstdc++-v3/libsupc++/Makefile.am3
-rw-r--r--libstdc++-v3/libsupc++/Makefile.in10
-rw-r--r--libstdc++-v3/libsupc++/eh_alloc.cc68
-rw-r--r--libstdc++-v3/libsupc++/eh_arm.cc8
-rw-r--r--libstdc++-v3/libsupc++/eh_call.cc4
-rw-r--r--libstdc++-v3/libsupc++/eh_personality.cc22
-rw-r--r--libstdc++-v3/libsupc++/eh_ptr.cc236
-rw-r--r--libstdc++-v3/libsupc++/eh_throw.cc21
-rw-r--r--libstdc++-v3/libsupc++/eh_type.cc12
-rw-r--r--libstdc++-v3/libsupc++/exception7
-rw-r--r--libstdc++-v3/libsupc++/exception_ptr.h169
-rw-r--r--libstdc++-v3/libsupc++/initializer_list5
-rw-r--r--libstdc++-v3/libsupc++/unwind-cxx.h143
-rw-r--r--libstdc++-v3/po/Makefile.in1
-rw-r--r--libstdc++-v3/src/Makefile.am22
-rw-r--r--libstdc++-v3/src/Makefile.in35
-rw-r--r--libstdc++-v3/src/chrono.cc76
-rw-r--r--libstdc++-v3/testsuite/17_intro/headers/c++200x/all.cc2
-rw-r--r--libstdc++-v3/testsuite/17_intro/headers/c++200x/all_multiple_inclusion.cc5
-rw-r--r--libstdc++-v3/testsuite/18_support/bad_alloc/cons_virtual_derivation.cc3
-rw-r--r--libstdc++-v3/testsuite/18_support/bad_cast/cons_virtual_derivation.cc3
-rw-r--r--libstdc++-v3/testsuite/18_support/bad_exception/cons_virtual_derivation.cc3
-rw-r--r--libstdc++-v3/testsuite/18_support/bad_typeid/cons_virtual_derivation.cc3
-rw-r--r--libstdc++-v3/testsuite/18_support/exception_ptr/current_exception.cc90
-rw-r--r--libstdc++-v3/testsuite/18_support/exception_ptr/lifespan.cc188
-rw-r--r--libstdc++-v3/testsuite/18_support/exception_ptr/rethrow_exception.cc113
-rw-r--r--libstdc++-v3/testsuite/18_support/headers/cstdint/types_std_c++0x.cc9
-rw-r--r--libstdc++-v3/testsuite/18_support/numeric_limits/char16_32_t.cc5
-rw-r--r--libstdc++-v3/testsuite/19_diagnostics/logic_error/cons_virtual_derivation.cc3
-rw-r--r--libstdc++-v3/testsuite/19_diagnostics/runtime_error/cons_virtual_derivation.cc3
-rw-r--r--libstdc++-v3/testsuite/19_diagnostics/system_error/cons_virtual_derivation.cc3
-rw-r--r--libstdc++-v3/testsuite/20_util/bad_function_call/cons_virtual_derivation.cc3
-rw-r--r--libstdc++-v3/testsuite/20_util/clocks/1.cc39
-rw-r--r--libstdc++-v3/testsuite/20_util/duration/arithmetic/1.cc94
-rw-r--r--libstdc++-v3/testsuite/20_util/duration/arithmetic/2.cc62
-rw-r--r--libstdc++-v3/testsuite/20_util/duration/comparisons/1.cc56
-rw-r--r--libstdc++-v3/testsuite/20_util/duration/cons/1.cc138
-rw-r--r--libstdc++-v3/testsuite/20_util/duration/cons/1_neg.cc46
-rw-r--r--libstdc++-v3/testsuite/20_util/duration/cons/2.cc120
-rw-r--r--libstdc++-v3/testsuite/20_util/duration/requirements/explicit_instantiation/explicit_instantiation.cc27
-rw-r--r--libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg1.cc45
-rw-r--r--libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg2.cc46
-rw-r--r--libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg3.cc47
-rw-r--r--libstdc++-v3/testsuite/20_util/shared_ptr/creation/36949.cc35
-rw-r--r--libstdc++-v3/testsuite/20_util/time_point/1.cc49
-rw-r--r--libstdc++-v3/testsuite/20_util/time_point/2.cc72
-rw-r--r--libstdc++-v3/testsuite/20_util/time_point/3.cc53
-rw-r--r--libstdc++-v3/testsuite/20_util/time_point/requirements/explicit_instantiation/explicit_instantiation.cc25
-rw-r--r--libstdc++-v3/testsuite/21_strings/basic_string/init-list.cc81
-rw-r--r--libstdc++-v3/testsuite/23_containers/deque/init-list.cc69
-rw-r--r--libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/init-list.cc74
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/map/init-list.cc63
-rw-r--r--libstdc++-v3/testsuite/23_containers/multimap/init-list.cc72
-rw-r--r--libstdc++-v3/testsuite/23_containers/multiset/init-list.cc68
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/init-list.cc68
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/init-list.cc63
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_multimap/init-list.cc77
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_multiset/init-list.cc68
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_set/init-list.cc68
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/init-list.cc69
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/25_algorithms/heap/1.cc2
-rw-r--r--libstdc++-v3/testsuite/26_numerics/valarray/init-list.cc58
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/cons/assign_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/cons/copy_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/failure/cons_virtual_derivation.cc3
-rw-r--r--libstdc++-v3/testsuite/28_regex/init-list.cc58
-rw-r--r--libstdc++-v3/testsuite/30_threads/mutex/cons/assign_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/30_threads/mutex/cons/copy_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/30_threads/recursive_mutex/cons/assign_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/30_threads/recursive_mutex/cons/copy_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/Makefile.in1
-rw-r--r--libstdc++-v3/testsuite/ext/concurrence_lock_error/cons_virtual_derivation.cc3
-rw-r--r--libstdc++-v3/testsuite/ext/concurrence_unlock_error/cons_virtual_derivation.cc3
-rw-r--r--libstdc++-v3/testsuite/ext/forced_exception_error/cons_virtual_derivation.cc3
-rw-r--r--libstdc++-v3/testsuite/ext/vstring/init-list.cc79
-rw-r--r--libstdc++-v3/testsuite/lib/libstdc++.exp37
-rw-r--r--libstdc++-v3/testsuite/tr1/7_regular_expressions/regex_traits/char/value.cc49
-rw-r--r--libstdc++-v3/testsuite/tr1/7_regular_expressions/regex_traits/wchar_t/value.cc49
-rw-r--r--libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdint/types_std_tr1.cc7
-rw-r--r--libstdc++-v3/testsuite/util/testsuite_abi.cc1
-rw-r--r--libstdc++-v3/testsuite/util/testsuite_api.h28
1503 files changed, 115151 insertions, 51178 deletions
diff --git a/ChangeLog b/ChangeLog
index 69d15720422..156f55d9b30 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2008-08-09 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * configure.ac (mips*-*-*linux*, mips*-*-gnu*): Use mt-mips-gnu.
+ * configure: Regenerate.
+
+2008-07-30 Paolo Bonzini <bonzini@gnu.org>
+
+ * configure.ac: Add makefile fragments for hpux.
+ * Makefile.def (flags_to_pass): Add ADA_CFLAGS.
+ * Makefile.tpl (HOST_EXPORTS): Pass ADA_CFLAGS.
+ * configure: Regenerate.
+ * Makefile.in: Regenerate.
+
+2008-07-28 Aldy Hernandez <aldyh@redhat.com>
+
+ * MAINTAINERS: Add Jakub and myself as gimple maintainers.
+
2008-07-11 Dodji Seketeli <dseketel@redhat.com>
* MAINTAINERS (Write after Approval): Add myself.
diff --git a/MAINTAINERS b/MAINTAINERS
index ba77126fee1..ffc183e3c5e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -166,6 +166,8 @@ c++ runtime libs Loren J. Rittle ljrittle@acm.org
*synthetic multiply Torbjorn Granlund tege@swox.com
*c-torture Torbjorn Granlund tege@swox.com
fixincludes Bruce Korb bkorb@gnu.org
+*gimpl* Jakub Jelinek jakub@redhat.com
+*gimpl* Aldy Hernandez aldyh@redhat.com
gcse.c Jeff Law law@redhat.com
global opt framework Jeff Law law@redhat.com
jump.c David S. Miller davem@redhat.com
diff --git a/Makefile.def b/Makefile.def
index 3924617ebd3..832fc4236e9 100644
--- a/Makefile.def
+++ b/Makefile.def
@@ -226,6 +226,7 @@ flags_to_pass = { flag= YACC ; };
// Host tools
flags_to_pass = { flag= ADAFLAGS ; optional=true ; };
+flags_to_pass = { flag= ADA_CFLAGS ; };
flags_to_pass = { flag= AR_FLAGS ; };
flags_to_pass = { flag= BOOT_ADAFLAGS ; optional=true ; };
flags_to_pass = { flag= BOOT_CFLAGS ; };
diff --git a/Makefile.in b/Makefile.in
index 81bf0e9011c..d9ef0681497 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -164,6 +164,7 @@ HOST_SUBDIR = @host_subdir@
HOST_EXPORTS = \
$(BASE_EXPORTS) \
CC="$(CC)"; export CC; \
+ ADA_CFLAGS="$(ADA_CFLAGS)"; export ADA_CFLAGS; \
CFLAGS="$(CFLAGS)"; export CFLAGS; \
CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
CXX="$(CXX)"; export CXX; \
@@ -514,6 +515,7 @@ BASE_FLAGS_TO_PASS = \
"SHELL=$(SHELL)" \
"YACC=$(YACC)" \
"`echo 'ADAFLAGS=$(ADAFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
+ "ADA_CFLAGS=$(ADA_CFLAGS)" \
"AR_FLAGS=$(AR_FLAGS)" \
"`echo 'BOOT_ADAFLAGS=$(BOOT_ADAFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
"BOOT_CFLAGS=$(BOOT_CFLAGS)" \
diff --git a/Makefile.tpl b/Makefile.tpl
index 4c744eba394..1f0c318012f 100644
--- a/Makefile.tpl
+++ b/Makefile.tpl
@@ -167,6 +167,7 @@ HOST_SUBDIR = @host_subdir@
HOST_EXPORTS = \
$(BASE_EXPORTS) \
CC="$(CC)"; export CC; \
+ ADA_CFLAGS="$(ADA_CFLAGS)"; export ADA_CFLAGS; \
CFLAGS="$(CFLAGS)"; export CFLAGS; \
CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
CXX="$(CXX)"; export CXX; \
diff --git a/boehm-gc/ChangeLog b/boehm-gc/ChangeLog
index d6d37671c3c..a7eeec051c2 100644
--- a/boehm-gc/ChangeLog
+++ b/boehm-gc/ChangeLog
@@ -1,3 +1,9 @@
+2008-07-18 Matthias Klose <doko@ubuntu.com>
+
+ * configure.ac (AC_CONFIG_FILES): Add threads.mk.
+ * threads.mk.in: New.
+ * Makefile.in, configure: Regenerate.
+
2008-06-17 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* Makefile.in: Regenerate.
diff --git a/boehm-gc/Makefile.in b/boehm-gc/Makefile.in
index 91918f2075a..e3a2e30160b 100644
--- a/boehm-gc/Makefile.in
+++ b/boehm-gc/Makefile.in
@@ -41,7 +41,7 @@ check_PROGRAMS = gctest$(EXEEXT)
DIST_COMMON = $(srcdir)/../config.guess $(srcdir)/../config.sub \
ChangeLog $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/configure $(am__configure_deps) \
- $(srcdir)/../mkinstalldirs $(srcdir)/../compile \
+ $(srcdir)/../mkinstalldirs $(srcdir)/threads.mk.in \
$(srcdir)/../compile $(srcdir)/../compile $(srcdir)/../compile \
$(srcdir)/../compile $(srcdir)/../compile $(srcdir)/../compile \
$(srcdir)/../compile $(srcdir)/../compile $(srcdir)/../compile \
@@ -62,8 +62,8 @@ DIST_COMMON = $(srcdir)/../config.guess $(srcdir)/../config.sub \
$(srcdir)/../compile $(srcdir)/../compile $(srcdir)/../compile \
$(srcdir)/../compile $(srcdir)/../compile $(srcdir)/../compile \
$(srcdir)/../compile $(srcdir)/../compile $(srcdir)/../compile \
- $(srcdir)/../ltmain.sh $(srcdir)/../config.guess \
- $(srcdir)/../config.sub
+ $(srcdir)/../compile $(srcdir)/../ltmain.sh \
+ $(srcdir)/../config.guess $(srcdir)/../config.sub
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
@@ -82,7 +82,7 @@ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno configure.status.lineno
CONFIG_HEADER = $(top_builddir)/include/gc_config.h \
$(top_builddir)/include/gc_ext_config.h
-CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_FILES = threads.mk
LTLIBRARIES = $(noinst_LTLIBRARIES)
am__DEPENDENCIES_1 =
@POWERPC_DARWIN_TRUE@am__objects_1 = powerpc_darwin_mach_dep.lo
@@ -387,6 +387,8 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+threads.mk: $(top_builddir)/config.status $(srcdir)/threads.mk.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
clean-noinstLTLIBRARIES:
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
diff --git a/boehm-gc/configure b/boehm-gc/configure
index 97cb19130ad..5308c77043c 100755
--- a/boehm-gc/configure
+++ b/boehm-gc/configure
@@ -16103,7 +16103,7 @@ fi
ac_config_headers="$ac_config_headers include/gc_config.h include/gc_ext_config.h"
- ac_config_files="$ac_config_files Makefile include/Makefile"
+ ac_config_files="$ac_config_files Makefile include/Makefile threads.mk"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@@ -17035,6 +17035,7 @@ do
# Handling of arguments.
"Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
"include/Makefile" ) CONFIG_FILES="$CONFIG_FILES include/Makefile" ;;
+ "threads.mk" ) CONFIG_FILES="$CONFIG_FILES threads.mk" ;;
"default-1" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
"depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
"libtool" ) CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
diff --git a/boehm-gc/configure.ac b/boehm-gc/configure.ac
index 29331e607d6..326a051f767 100644
--- a/boehm-gc/configure.ac
+++ b/boehm-gc/configure.ac
@@ -547,5 +547,5 @@ fi
AC_CONFIG_HEADERS([include/gc_config.h include/gc_ext_config.h])
-AC_CONFIG_FILES(Makefile include/Makefile)
+AC_CONFIG_FILES(Makefile include/Makefile threads.mk)
AC_OUTPUT
diff --git a/boehm-gc/threads.mk.in b/boehm-gc/threads.mk.in
new file mode 100644
index 00000000000..31119df2018
--- /dev/null
+++ b/boehm-gc/threads.mk.in
@@ -0,0 +1,3 @@
+# to be used in libobjc for libobjc_gc
+
+thread_libs_and_flags = @THREADLIBS@ @extra_ldflags_libgc@
diff --git a/config/ChangeLog b/config/ChangeLog
index e64c1cab72e..1062d8ee5e2 100644
--- a/config/ChangeLog
+++ b/config/ChangeLog
@@ -1,3 +1,30 @@
+2008-08-09 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * mt-mips16-compat: New file, taken from mt-mips-elfoabi.
+ * mt-mips-elfoabi: Include mt-mips16-compat.
+ * mt-mips-gnu: New file.
+
+2008-08-03 Alan Modra <amodra@bigpond.net.au>
+
+ * mt-spu (all-ld): Update for ld Makefile changes.
+
+2008-08-02 Keith Seitz <keiths@redhat.com>
+
+ * tcl.m4 (SC_PATH_TCLCONFIG): Add some simple logic to deal
+ with cygwin.
+ (SC_PATH_TKCONFIG): Likewise.
+
+2008-07-30 Paolo Bonzini <bonzini@gnu.org>
+
+ * mh-pa: New, from gcc/config/pa/x-ada.
+ * mh-pa-hpux10: New, from gcc/config/pa/x-ada-hpux10.
+
+2008-07-25 Keith Seitz <keiths@redhat.com>
+
+ * acinclude.m4: Remove libide, libgui, and all the other Tcl
+ functions.
+ * tcl.m4: New file.
+
2008-07-11 Joseph Myers <joseph@codesourcery.com>
* mh-mingw (LDFLAGS): Append to rather than replacing previous
diff --git a/config/acinclude.m4 b/config/acinclude.m4
index c7c0ab5dc11..8242b2c7a8a 100644
--- a/config/acinclude.m4
+++ b/config/acinclude.m4
@@ -497,99 +497,6 @@ AC_SUBST(DEVOHDIR)
])
dnl ====================================================================
-dnl find the IDE library and headers.
-AC_DEFUN([CYG_AC_PATH_IDE], [
-AC_MSG_CHECKING(for IDE headers in the source tree)
-dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
-IDEHDIR=
-IDELIB=
-AC_CACHE_VAL(ac_cv_c_ideh,[
-for i in $dirlist; do
- if test -f "${srcdir}/$i/libide/src/event.h" ; then
- ac_cv_c_ideh=`(cd ${srcdir}/$i/libide/src; ${PWDCMD-pwd})`;
- fi
-done
-])
-if test x"${ac_cv_c_ideh}" != x; then
- IDEHDIR="-I${ac_cv_c_ideh}"
- AC_MSG_RESULT(${ac_cv_c_ideh})
-else
- AC_MSG_RESULT(none)
-fi
-
-AC_MSG_CHECKING(for LIBIDE TCL headers in the source tree)
-AC_CACHE_VAL(ac_cv_c_idetclh,[
-for i in $dirlist; do
- if test -f "${srcdir}/$i/libidetcl/src/idetcl.h" ; then
- ac_cv_c_idetclh=`(cd ${srcdir}/$i/libidetcl/src; ${PWDCMD-pwd})`;
- fi
-done
-])
-if test x"${ac_cv_c_idetclh}" != x; then
- IDEHDIR="${IDEHDIR} -I${ac_cv_c_idetclh}"
- AC_MSG_RESULT(${ac_cv_c_idetclh})
-else
- AC_MSG_RESULT(none)
-fi
-
-AC_MSG_CHECKING(for IDE headers in the build tree)
-AC_CACHE_VAL(ac_cv_c_ideh2,[
-for i in $dirlist; do
- if test -f "$i/libide/src/Makefile" ; then
- ac_cv_c_ideh2=`(cd $i/libide/src; ${PWDCMD-pwd})`;
- fi
-done
-])
-if test x"${ac_cv_c_ideh2}" != x; then
- IDEHDIR="${IDEHDIR} -I${ac_cv_c_ideh2}"
- AC_MSG_RESULT(${ac_cv_c_ideh2})
-else
- AC_MSG_RESULT(none)
-fi
-
-dnl look for the library
-AC_MSG_CHECKING(for IDE library)
-AC_CACHE_VAL(ac_cv_c_idelib,[
-if test x"${ac_cv_c_idelib}" = x ; then
- for i in $dirlist; do
- if test -f "$i/libide/src/Makefile" ; then
- ac_cv_c_idelib=`(cd $i/libide/src; ${PWDCMD-pwd})`
- break
- fi
- done
-fi])
-if test x"${ac_cv_c_idelib}" != x ; then
- IDELIB="-L${ac_cv_c_idelib}"
- AC_MSG_RESULT(${ac_cv_c_idelib})
-else
- AC_MSG_RESULT(none)
-fi
-
-dnl find libiddetcl.a if it exists
-AC_MSG_CHECKING(for IDE TCL library)
-AC_CACHE_VAL(ac_cv_c_idetcllib,[
-if test x"${ac_cv_c_idetcllib}" = x ; then
- for i in $dirlist; do
- if test -f "$i/libidetcl/src/Makefile" ; then
- ac_cv_c_idetcllib=`(cd $i/libidetcl/src; ${PWDCMD-pwd})`
- break
- fi
- done
-fi
-])
-if test x"${ac_cv_c_idetcllib}" != x ; then
- IDELIB="${IDELIB} -L${ac_cv_c_idetcllib}"
- IDETCLLIB="-lidetcl"
- AC_MSG_RESULT(${ac_cv_c_idetcllib})
-else
- AC_MSG_RESULT(none)
-fi
-AC_SUBST(IDEHDIR)
-AC_SUBST(IDELIB)
-AC_SUBST(IDETCLLIB)
-])
-
-dnl ====================================================================
dnl Find all the ILU headers and libraries
AC_DEFUN([CYG_AC_PATH_ILU], [
AC_MSG_CHECKING(for ILU kernel headers in the source tree)
@@ -837,1187 +744,3 @@ fi
AC_LANG_RESTORE
AC_SUBST(LIBGCC)
])
-
-dnl ====================================================================
-dnl Ok, lets find the tcl source trees so we can use the headers
-dnl Warning: transition of version 9 to 10 will break this algorithm
-dnl because 10 sorts before 9. We also look for just tcl. We have to
-dnl be careful that we don't match stuff like tclX by accident.
-dnl the alternative search directory is involked by --with-tclinclude
-AC_DEFUN([CYG_AC_PATH_TCL], [
- CYG_AC_PATH_TCLH
- CYG_AC_PATH_TCLCONFIG
- CYG_AC_LOAD_TCLCONFIG
-])
-AC_DEFUN([CYG_AC_PATH_TCLH], [
-dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
-no_tcl=true
-AC_MSG_CHECKING(for Tcl headers in the source tree)
-AC_ARG_WITH(tclinclude, [ --with-tclinclude directory where tcl headers are], with_tclinclude=${withval})
-AC_CACHE_VAL(ac_cv_c_tclh,[
-dnl first check to see if --with-tclinclude was specified
-if test x"${with_tclinclude}" != x ; then
- if test -f ${with_tclinclude}/tcl.h ; then
- ac_cv_c_tclh=`(cd ${with_tclinclude}; ${PWDCMD-pwd})`
- elif test -f ${with_tclinclude}/generic/tcl.h ; then
- ac_cv_c_tclh=`(cd ${with_tclinclude}/generic; ${PWDCMD-pwd})`
- else
- AC_MSG_ERROR([${with_tclinclude} directory doesn't contain headers])
- fi
-fi
-
-dnl next check if it came with Tcl configuration file
-if test x"${ac_cv_c_tclconfig}" != x ; then
- for i in $dirlist; do
- if test -f $ac_cv_c_tclconfig/$i/generic/tcl.h ; then
- ac_cv_c_tclh=`(cd $ac_cv_c_tclconfig/$i/generic; ${PWDCMD-pwd})`
- break
- fi
- done
-fi
-
-dnl next check in private source directory
-dnl since ls returns lowest version numbers first, reverse its output
-if test x"${ac_cv_c_tclh}" = x ; then
- dnl find the top level Tcl source directory
- for i in $dirlist; do
- if test -n "`ls -dr $srcdir/$i/tcl* 2>/dev/null`" ; then
- tclpath=$srcdir/$i
- break
- fi
- done
-
- dnl find the exact Tcl source dir. We do it this way, cause there
- dnl might be multiple version of Tcl, and we want the most recent one.
- for i in `ls -dr $tclpath/tcl* 2>/dev/null ` ; do
- if test -f $i/generic/tcl.h ; then
- ac_cv_c_tclh=`(cd $i/generic; ${PWDCMD-pwd})`
- break
- fi
- done
-fi
-
-dnl check if its installed with the compiler
-if test x"${ac_cv_c_tclh}" = x ; then
- dnl Get the path to the compiler
- ccpath=`which ${CC} | sed -e 's:/bin/.*::'`/include
- if test -f $ccpath/tcl.h; then
- ac_cv_c_tclh=$ccpath
- fi
-fi
-
-dnl see if one is installed
-if test x"${ac_cv_c_tclh}" = x ; then
- AC_MSG_RESULT(none)
- AC_CHECK_HEADER(tcl.h, ac_cv_c_tclh=installed, ac_cv_c_tclh="")
-else
- AC_MSG_RESULT(${ac_cv_c_tclh})
-fi
-])
- TCLHDIR=""
-if test x"${ac_cv_c_tclh}" = x ; then
- AC_MSG_ERROR([Can't find any Tcl headers])
-fi
-if test x"${ac_cv_c_tclh}" != x ; then
- no_tcl=""
- if test x"${ac_cv_c_tclh}" != x"installed" ; then
- if test x"${CC}" = xcl ; then
- tmp="`cygpath --windows ${ac_cv_c_tclh}`"
- ac_cv_c_tclh="`echo $tmp | sed -e s#\\\\\\\\#/#g`"
- fi
- AC_MSG_RESULT(${ac_cv_c_tclh})
- TCLHDIR="-I${ac_cv_c_tclh}"
- fi
-fi
-
-AC_SUBST(TCLHDIR)
-])
-
-dnl ====================================================================
-dnl Ok, lets find the tcl configuration
-AC_DEFUN([CYG_AC_PATH_TCLCONFIG], [
-dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
-dnl First, look for one uninstalled.
-dnl the alternative search directory is invoked by --with-tclconfig
-if test x"${no_tcl}" = x ; then
- dnl we reset no_tcl in case something fails here
- no_tcl=true
- AC_ARG_WITH(tclconfig, [ --with-tclconfig directory containing tcl configuration (tclConfig.sh)],
- with_tclconfig=${withval})
- AC_MSG_CHECKING([for Tcl configuration script])
- AC_CACHE_VAL(ac_cv_c_tclconfig,[
-
- dnl First check to see if --with-tclconfig was specified.
- if test x"${with_tclconfig}" != x ; then
- if test -f "${with_tclconfig}/tclConfig.sh" ; then
- ac_cv_c_tclconfig=`(cd ${with_tclconfig}; ${PWDCMD-pwd})`
- else
- AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
- fi
- fi
-
- dnl next check if it came with Tcl configuration file in the source tree
- if test x"${ac_cv_c_tclconfig}" = x ; then
- for i in $dirlist; do
- dnl need to test both unix and win directories, since
- dnl cygwin's tkConfig.sh could be in either directory depending
- dnl on the cygwin port of tcl.
- if test -f $srcdir/$i/unix/tclConfig.sh ; then
- ac_cv_c_tclconfig=`(cd $srcdir/$i/unix; ${PWDCMD-pwd})`
- break
- fi
- if test -f $srcdir/$i/win/tclConfig.sh ; then
- ac_cv_c_tclconfig=`(cd $srcdir/$i/win; ${PWDCMD-pwd})`
- break
- fi
- done
- fi
- dnl check in a few other locations
- if test x"${ac_cv_c_tclconfig}" = x ; then
- dnl find the top level Tcl source directory
- for i in $dirlist; do
- if test -n "`ls -dr $i/tcl* 2>/dev/null`" ; then
- tclconfpath=$i
- break
- fi
- done
-
- dnl find the exact Tcl dir. We do it this way, cause there
- dnl might be multiple version of Tcl, and we want the most recent one.
- for i in `ls -dr $tclconfpath/tcl* 2>/dev/null ` ; do
- dnl need to test both unix and win directories, since
- dnl cygwin's tclConfig.sh could be in either directory depending
- dnl on the cygwin port of tcl.
- if test -f $i/unix/tclConfig.sh ; then
- ac_cv_c_tclconfig=`(cd $i/unix; ${PWDCMD-pwd})`
- break
- fi
- if test -f $i/win/tclConfig.sh ; then
- ac_cv_c_tclconfig=`(cd $i/win; ${PWDCMD-pwd})`
- break
- fi
- done
- fi
-
- dnl Check to see if it's installed. We have to look in the $CC path
- dnl to find it, cause our $prefix may not match the compilers.
- if test x"${ac_cv_c_tclconfig}" = x ; then
- dnl Get the path to the compiler
- ccpath=`which ${CC} | sed -e 's:/bin/.*::'`/lib
- if test -f $ccpath/tclConfig.sh; then
- ac_cv_c_tclconfig=$ccpath
- fi
- fi
- ]) dnl end of cache_val
-
- if test x"${ac_cv_c_tclconfig}" = x ; then
- TCLCONFIG=""
- AC_MSG_WARN(Can't find Tcl configuration definitions)
- else
- no_tcl=""
- TCLCONFIG=${ac_cv_c_tclconfig}/tclConfig.sh
- AC_MSG_RESULT(${TCLCONFIG})
- fi
-fi
-AC_SUBST(TCLCONFIG)
-])
-
-dnl Defined as a separate macro so we don't have to cache the values
-dnl from PATH_TCLCONFIG (because this can also be cached).
-AC_DEFUN([CYG_AC_LOAD_TCLCONFIG], [
- . $TCLCONFIG
-
-dnl AC_SUBST(TCL_VERSION)
-dnl AC_SUBST(TCL_MAJOR_VERSION)
-dnl AC_SUBST(TCL_MINOR_VERSION)
-dnl AC_SUBST(TCL_CC)
- AC_SUBST(TCL_DEFS)
-
-dnl not used, don't export to save symbols
- AC_SUBST(TCL_LIB_FILE)
- AC_SUBST(TCL_LIB_FULL_PATH)
- AC_SUBST(TCL_LIBS)
-dnl not used, don't export to save symbols
-dnl AC_SUBST(TCL_PREFIX)
-
- AC_SUBST(TCL_CFLAGS)
-
-dnl not used, don't export to save symbols
-dnl AC_SUBST(TCL_EXEC_PREFIX)
-
- AC_SUBST(TCL_SHLIB_CFLAGS)
- AC_SUBST(TCL_SHLIB_LD)
-dnl don't export, not used outside of configure
-dnl AC_SUBST(TCL_SHLIB_LD_LIBS)
-dnl AC_SUBST(TCL_SHLIB_SUFFIX)
-dnl not used, don't export to save symbols
-dnl AC_SUBST(TCL_DL_LIBS)
- AC_SUBST(TCL_LD_FLAGS)
- AC_SUBST(TCL_LD_SEARCH_FLAGS)
-dnl don't export, not used outside of configure
-dnl AC_SUBST(TCL_COMPAT_OBJS)
- AC_SUBST(TCL_RANLIB)
- AC_SUBST(TCL_BUILD_LIB_SPEC)
- AC_SUBST(TCL_LIB_SPEC)
- AC_SUBST(TCL_BIN_DIR)
-dnl AC_SUBST(TCL_LIB_VERSIONS_OK)
-
-dnl not used, don't export to save symbols
-dnl AC_SUBST(TCL_SHARED_LIB_SUFFIX)
-
-dnl not used, don't export to save symbols
-dnl AC_SUBST(TCL_UNSHARED_LIB_SUFFIX)
-])
-
-dnl ====================================================================
-AC_DEFUN([CYG_AC_PATH_TK], [
- CYG_AC_PATH_TKH
- CYG_AC_PATH_TKCONFIG
- CYG_AC_LOAD_TKCONFIG
-])
-AC_DEFUN([CYG_AC_PATH_TKH], [
-#
-# Ok, lets find the tk source trees so we can use the headers
-# If the directory (presumably symlink) named "tk" exists, use that one
-# in preference to any others. Same logic is used when choosing library
-# and again with Tcl. The search order is the best place to look first, then in
-# decreasing significance. The loop breaks if the trigger file is found.
-# Note the gross little conversion here of srcdir by cd'ing to the found
-# directory. This converts the path from a relative to an absolute, so
-# recursive cache variables for the path will work right. We check all
-# the possible paths in one loop rather than many separate loops to speed
-# things up.
-# the alternative search directory is involked by --with-tkinclude
-#
-dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
-no_tk=true
-AC_MSG_CHECKING(for Tk headers in the source tree)
-AC_ARG_WITH(tkinclude, [ --with-tkinclude directory where tk headers are], with_tkinclude=${withval})
-AC_CACHE_VAL(ac_cv_c_tkh,[
-dnl first check to see if --with-tkinclude was specified
-if test x"${with_tkinclude}" != x ; then
- if test -f ${with_tkinclude}/tk.h ; then
- ac_cv_c_tkh=`(cd ${with_tkinclude}; ${PWDCMD-pwd})`
- elif test -f ${with_tkinclude}/generic/tk.h ; then
- ac_cv_c_tkh=`(cd ${with_tkinclude}/generic; ${PWDCMD-pwd})`
- else
- AC_MSG_ERROR([${with_tkinclude} directory doesn't contain headers])
- fi
-fi
-
-dnl next check if it came with Tk configuration file
-if test x"${ac_cv_c_tkconfig}" != x ; then
- for i in $dirlist; do
- if test -f $ac_cv_c_tkconfig/$i/generic/tk.h ; then
- ac_cv_c_tkh=`(cd $ac_cv_c_tkconfig/$i/generic; ${PWDCMD-pwd})`
- break
- fi
- done
-fi
-
-dnl next check in private source directory
-dnl since ls returns lowest version numbers first, reverse its output
-if test x"${ac_cv_c_tkh}" = x ; then
- dnl find the top level Tk source directory
- for i in $dirlist; do
- if test -n "`ls -dr $srcdir/$i/tk* 2>/dev/null`" ; then
- tkpath=$srcdir/$i
- break
- fi
- done
-
- dnl find the exact Tk source dir. We do it this way, cause there
- dnl might be multiple version of Tk, and we want the most recent one.
- for i in `ls -dr $tkpath/tk* 2>/dev/null ` ; do
- if test -f $i/generic/tk.h ; then
- ac_cv_c_tkh=`(cd $i/generic; ${PWDCMD-pwd})`
- break
- fi
- done
-fi
-
-dnl see if one is installed
-if test x"${ac_cv_c_tkh}" = x ; then
- AC_MSG_RESULT(none)
- dnl Get the path to the compiler. We do it this way instead of using
- dnl AC_CHECK_HEADER, cause this doesn't depend in having X configured.
- ccpath=`which ${CC} | sed -e 's:/bin/.*::'`/include
- if test -f $ccpath/tk.h; then
- ac_cv_c_tkh=$ccpath
- fi
-else
- AC_MSG_RESULT(${ac_cv_c_tkh})
-fi
-])
- TKHDIR=""
-if test x"${ac_cv_c_tkh}" = x ; then
- AC_MSG_ERROR([Can't find any Tk headers])
-fi
-if test x"${ac_cv_c_tkh}" != x ; then
- no_tk=""
- if test x"${ac_cv_c_tkh}" != x"installed" ; then
- if test x"${CC}" = xcl ; then
- tmp="`cygpath --windows ${ac_cv_c_tkh}`"
- ac_cv_c_tkh="`echo $tmp | sed -e s#\\\\\\\\#/#g`"
- fi
- AC_MSG_RESULT([found in ${ac_cv_c_tkh}])
- TKHDIR="-I${ac_cv_c_tkh}"
- fi
-fi
-
-AC_SUBST(TKHDIR)
-])
-
-AC_DEFUN([CYG_AC_PATH_TKCONFIG], [
-dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
-dnl First, look for one uninstalled.
-dnl the alternative search directory is invoked by --with-tkconfig
-if test x"${no_tk}" = x ; then
- dnl we reset no_tk in case something fails here
- no_tk=true
- AC_ARG_WITH(tkconfig, [ --with-tkconfig directory containing tk configuration (tkConfig.sh)],
- with_tkconfig=${withval})
- AC_MSG_CHECKING([for Tk configuration script])
- AC_CACHE_VAL(ac_cv_c_tkconfig,[
-
- dnl First check to see if --with-tkconfig was specified.
- if test x"${with_tkconfig}" != x ; then
- if test -f "${with_tkconfig}/tkConfig.sh" ; then
- ac_cv_c_tkconfig=`(cd ${with_tkconfig}; ${PWDCMD-pwd})`
- else
- AC_MSG_ERROR([${with_tkconfig} directory doesn't contain tkConfig.sh])
- fi
- fi
-
- dnl next check if it came with Tk configuration file in the source tree
- if test x"${ac_cv_c_tkconfig}" = x ; then
- for i in $dirlist; do
- dnl need to test both unix and win directories, since
- dnl cygwin's tkConfig.sh could be in either directory depending
- dnl on the cygwin port of tk.
- if test -f $srcdir/$i/unix/tkConfig.sh ; then
- ac_cv_c_tkconfig=`(cd $srcdir/$i/unix; ${PWDCMD-pwd})`
- break
- fi
- if test -f $srcdir/$i/win/tkConfig.sh ; then
- ac_cv_c_tkconfig=`(cd $srcdir/$i/unix; ${PWDCMD-pwd})`
- break
- fi
- done
- fi
- dnl check in a few other locations
- if test x"${ac_cv_c_tkconfig}" = x ; then
- dnl find the top level Tk source directory
- for i in $dirlist; do
- if test -n "`ls -dr $i/tk* 2>/dev/null`" ; then
- tkconfpath=$i
- break
- fi
- done
-
- dnl find the exact Tk dir. We do it this way, cause there
- dnl might be multiple version of Tk, and we want the most recent one.
- for i in `ls -dr $tkconfpath/tk* 2>/dev/null ` ; do
- dnl need to test both unix and win directories, since
- dnl cygwin's tkConfig.sh could be in either directory depending
- dnl on the cygwin port of tk.
- if test -f $i/unix/tkConfig.sh ; then
- ac_cv_c_tkconfig=`(cd $i/unix; ${PWDCMD-pwd})`
- break
- fi
- if test -f $i/win/tkConfig.sh ; then
- ac_cv_c_tkconfig=`(cd $i/win; ${PWDCMD-pwd})`
- break
- fi
- done
- fi
-
- dnl Check to see if it's installed. We have to look in the $CC path
- dnl to find it, cause our $prefix may not match the compilers.
- if test x"${ac_cv_c_tkconfig}" = x ; then
- dnl Get the path to the compiler
- ccpath=`which ${CC} | sed -e 's:/bin/.*::'`/lib
- if test -f $ccpath/tkConfig.sh; then
- ac_cv_c_tkconfig=$ccpath
- fi
- fi
- ]) dnl end of cache_val
-
- if test x"${ac_cv_c_tkconfig}" = x ; then
- TKCONFIG=""
- AC_MSG_WARN(Can't find Tk configuration definitions)
- else
- no_tk=""
- TKCONFIG=${ac_cv_c_tkconfig}/tkConfig.sh
- AC_MSG_RESULT(${TKCONFIG})
- fi
-fi
-AC_SUBST(TKCONFIG)
-])
-
-dnl Defined as a separate macro so we don't have to cache the values
-dnl from PATH_TKCONFIG (because this can also be cached).
-AC_DEFUN([CYG_AC_LOAD_TKCONFIG], [
- if test -f "$TKCONFIG" ; then
- . $TKCONFIG
- fi
-
- AC_SUBST(TK_VERSION)
-dnl not actually used, don't export to save symbols
-dnl AC_SUBST(TK_MAJOR_VERSION)
-dnl AC_SUBST(TK_MINOR_VERSION)
- AC_SUBST(TK_DEFS)
-
-dnl not used, don't export to save symbols
- AC_SUBST(TK_LIB_FILE)
- AC_SUBST(TK_LIB_FULL_PATH)
- AC_SUBST(TK_LIBS)
-dnl not used, don't export to save symbols
-dnl AC_SUBST(TK_PREFIX)
-
-dnl not used, don't export to save symbols
-dnl AC_SUBST(TK_EXEC_PREFIX)
- AC_SUBST(TK_BUILD_INCLUDES)
- AC_SUBST(TK_XINCLUDES)
- AC_SUBST(TK_XLIBSW)
- AC_SUBST(TK_BUILD_LIB_SPEC)
- AC_SUBST(TK_LIB_SPEC)
-])
-
-dnl ====================================================================
-dnl Ok, lets find the itcl source trees so we can use the headers
-dnl the alternative search directory is involked by --with-itclinclude
-AC_DEFUN([CYG_AC_PATH_ITCL], [
- CYG_AC_PATH_ITCLH
- CYG_AC_PATH_ITCLLIB
- CYG_AC_PATH_ITCLSH
- CYG_AC_PATH_ITCLMKIDX
-])
-AC_DEFUN([CYG_AC_PATH_ITCLH], [
-dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
-no_itcl=true
-AC_MSG_CHECKING(for Itcl headers in the source tree)
-AC_ARG_WITH(itclinclude, [ --with-itclinclude directory where itcl headers are], with_itclinclude=${withval})
-AC_CACHE_VAL(ac_cv_c_itclh,[
-dnl first check to see if --with-itclinclude was specified
-if test x"${with_itclinclude}" != x ; then
- if test -f ${with_itclinclude}/itcl.h ; then
- ac_cv_c_itclh=`(cd ${with_itclinclude}; ${PWDCMD-pwd})`
- elif test -f ${with_itclinclude}/src/itcl.h ; then
- ac_cv_c_itclh=`(cd ${with_itclinclude}/src; ${PWDCMD-pwd})`
- else
- AC_MSG_ERROR([${with_itclinclude} directory doesn't contain headers])
- fi
-fi
-
-dnl next check if it came with Itcl configuration file
-if test x"${ac_cv_c_itclconfig}" != x ; then
- for i in $dirlist; do
- if test -f $ac_cv_c_itclconfig/$i/src/itcl.h ; then
- ac_cv_c_itclh=`(cd $ac_cv_c_itclconfig/$i/src; ${PWDCMD-pwd})`
- break
- fi
- done
-fi
-
-dnl next check in private source directory
-dnl since ls returns lowest version numbers first, reverse its output
-if test x"${ac_cv_c_itclh}" = x ; then
- dnl find the top level Itcl source directory
- for i in $dirlist; do
- if test -n "`ls -dr $srcdir/$i/itcl* 2>/dev/null`" ; then
- itclpath=$srcdir/$i
- break
- fi
- done
-
- dnl find the exact Itcl source dir. We do it this way, cause there
- dnl might be multiple version of Itcl, and we want the most recent one.
- for i in `ls -dr $itclpath/itcl* 2>/dev/null ` ; do
- if test -f $i/src/itcl.h ; then
- ac_cv_c_itclh=`(cd $i/src; ${PWDCMD-pwd})`
- break
- fi
- done
-fi
-
-dnl see if one is installed
-if test x"${ac_cv_c_itclh}" = x ; then
- AC_MSG_RESULT(none)
- AC_CHECK_HEADER(itcl.h, ac_cv_c_itclh=installed, ac_cv_c_itclh="")
-else
- AC_MSG_RESULT(${ac_cv_c_itclh})
-fi
-])
- ITCLHDIR=""
-if test x"${ac_cv_c_itclh}" = x ; then
- AC_MSG_ERROR([Can't find any Itcl headers])
-fi
-if test x"${ac_cv_c_itclh}" != x ; then
- no_itcl=""
- if test x"${ac_cv_c_itclh}" != x"installed" ; then
- AC_MSG_RESULT(${ac_cv_c_itclh})
- ITCLHDIR="-I${ac_cv_c_itclh}"
- fi
-fi
-
-AC_SUBST(ITCLHDIR)
-])
-
-dnl Ok, lets find the itcl library
-dnl First, look for one uninstalled.
-dnl the alternative search directory is invoked by --with-itcllib
-AC_DEFUN([CYG_AC_PATH_ITCLLIB], [
-dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
-if test x"${no_itcl}" = x ; then
- dnl we reset no_itcl incase something fails here
- no_itcl=true
- AC_ARG_WITH(itcllib,
- [ --with-itcllib directory where the itcl library is],
- with_itcllib=${withval})
- AC_MSG_CHECKING([for Itcl library])
- AC_CACHE_VAL(ac_cv_c_itcllib,[
- dnl First check to see if --with-itcllib was specified.
- if test x"${with_itcllib}" != x ; then
- if test -f "${with_itcllib}/libitcl$TCL_SHARED_LIB_SUFFIX" ; then
- ac_cv_c_itcllib=`(cd ${with_itcllib}; ${PWDCMD-pwd})`/libitcl$TCL_SHARED_LIB_SUFFIX
- else
- if test -f "${with_itcllib}/libitcl$TCL_UNSHARED_LIB_SUFFIX"; then
- ac_cv_c_itcllib=`(cd ${with_itcllib}; ${PWDCMD-pwd})`/libitcl$TCL_UNSHARED_LIB_SUFFIX
- fi
- fi
- fi
- dnl then check for a Itcl library. Since these are uninstalled,
- dnl use the simple lib name root.
- if test x"${ac_cv_c_itcllib}" = x ; then
- dnl find the top level Itcl build directory
- for i in $dirlist; do
- if test -n "`ls -dr $i/itcl* 2>/dev/null`" ; then
- itclpath=$i/itcl
- break
- fi
- done
- dnl Itcl 7.5 and greater puts library in subdir. Look there first.
- if test -f "$itclpath/src/libitcl.$TCL_SHLIB_SUFFIX" ; then
- ac_cv_c_itcllib=`(cd $itclpath/src; ${PWDCMD-pwd})`
- elif test -f "$itclpath/src/libitcl.a"; then
- ac_cv_c_itcllib=`(cd $itclpath/src; ${PWDCMD-pwd})`
- fi
- fi
- dnl check in a few other private locations
- if test x"${ac_cv_c_itcllib}" = x ; then
- for i in ${dirlist}; do
- if test -n "`ls -dr ${srcdir}/$i/itcl* 2>/dev/null`" ; then
- itclpath=${srcdir}/$i
- break
- fi
- done
- for i in `ls -dr ${itclpath}/itcl* 2>/dev/null` ; do
- dnl Itcl 7.5 and greater puts library in subdir. Look there first.
- if test -f "$i/src/libitcl$TCL_SHLIB_SUFFIX" ; then
- ac_cv_c_itcllib=`(cd $i/src; ${PWDCMD-pwd})`
- break
- elif test -f "$i/src/libitcl.a"; then
- ac_cv_c_itcllib=`(cd $i/src; ${PWDCMD-pwd})`
- break
- fi
- done
- fi
-
- dnl see if one is conveniently installed with the compiler
- if test x"${ac_cv_c_itcllib}" = x ; then
- dnl Get the path to the compiler
- ccpath=`which ${CC} | sed -e 's:/bin/.*::'`/lib
- dnl Itcl 7.5 and greater puts library in subdir. Look there first.
- if test -f "${ccpath}/libitcl$TCL_SHLIB_SUFFIX" ; then
- ac_cv_c_itcllib=`(cd ${ccpath}; ${PWDCMD-pwd})`
- elif test -f "${ccpath}/libitcl.a"; then
- ac_cv_c_itcllib=`(cd ${ccpath}; ${PWDCMD-pwd})`
- fi
- fi
- ])
- if test x"${ac_cv_c_itcllib}" = x ; then
- ITCLLIB=""
- AC_MSG_WARN(Can't find Itcl library)
- else
- ITCLLIB="-L${ac_cv_c_itcllib}"
- AC_MSG_RESULT(${ac_cv_c_itcllib})
- no_itcl=""
- fi
-fi
-
-AC_PROVIDE([$0])
-AC_SUBST(ITCLLIB)
-])
-
-
-dnl ====================================================================
-dnl Ok, lets find the itcl source trees so we can use the itcl_sh script
-dnl the alternative search directory is involked by --with-itclinclude
-AC_DEFUN([CYG_AC_PATH_ITCLSH], [
-dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
-no_itcl=true
-AC_MSG_CHECKING(for the itcl_sh script)
-AC_ARG_WITH(itclinclude, [ --with-itclinclude directory where itcl headers are], with_itclinclude=${withval})
-AC_CACHE_VAL(ac_cv_c_itclsh,[
-dnl first check to see if --with-itclinclude was specified
-if test x"${with_itclinclude}" != x ; then
- if test -f ${with_itclinclude}/itcl_sh ; then
- ac_cv_c_itclsh=`(cd ${with_itclinclude}; ${PWDCMD-pwd})`
- elif test -f ${with_itclinclude}/src/itcl_sh ; then
- ac_cv_c_itclsh=`(cd ${with_itclinclude}/src; ${PWDCMD-pwd})`
- else
- AC_MSG_ERROR([${with_itclinclude} directory doesn't contain itcl_sh])
- fi
-fi
-
-dnl next check in private source directory
-dnl since ls returns lowest version numbers first, reverse its output
-if test x"${ac_cv_c_itclsh}" = x ; then
- dnl find the top level Itcl source directory
- for i in $dirlist; do
- if test -n "`ls -dr $srcdir/$i/itcl* 2>/dev/null`" ; then
- itclpath=$srcdir/$i
- break
- fi
- done
-
- dnl find the exact Itcl source dir. We do it this way, cause there
- dnl might be multiple version of Itcl, and we want the most recent one.
- for i in `ls -dr $itclpath/itcl* 2>/dev/null ` ; do
- if test -f $i/src/itcl_sh ; then
- ac_cv_c_itclsh=`(cd $i/src; ${PWDCMD-pwd})`/itcl_sh
- break
- fi
- done
-fi
-
-dnl see if one is installed
-if test x"${ac_cv_c_itclsh}" = x ; then
- AC_MSG_RESULT(none)
- AC_PATH_PROG(ac_cv_c_itclsh, itcl_sh)
-else
- AC_MSG_RESULT(${ac_cv_c_itclsh})
-fi
-])
-
-if test x"${ac_cv_c_itclsh}" = x ; then
- AC_MSG_ERROR([Can't find the itcl_sh script])
-fi
-if test x"${ac_cv_c_itclsh}" != x ; then
- no_itcl=""
- AC_MSG_RESULT(${ac_cv_c_itclsh})
- ITCLSH="${ac_cv_c_itclsh}"
-fi
-AC_SUBST(ITCLSH)
-])
-
-
-dnl ====================================================================
-dnl Ok, lets find the itcl source trees so we can use the itcl_sh script
-dnl the alternative search directory is involked by --with-itclinclude
-AC_DEFUN([CYG_AC_PATH_ITCLMKIDX], [
-dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
-no_itcl=true
-AC_MSG_CHECKING(for itcl_mkindex.tcl script)
-AC_ARG_WITH(itclinclude, [ --with-itclinclude directory where itcl headers are], with_itclinclude=${withval})
-AC_CACHE_VAL(ac_cv_c_itclmkidx,[
-dnl first check to see if --with-itclinclude was specified
-if test x"${with_itclinclude}" != x ; then
- if test -f ${with_itclinclude}/itcl_sh ; then
- ac_cv_c_itclmkidx=`(cd ${with_itclinclude}; ${PWDCMD-pwd})`
- elif test -f ${with_itclinclude}/src/itcl_sh ; then
- ac_cv_c_itclmkidx=`(cd ${with_itclinclude}/src; ${PWDCMD-pwd})`
- else
- AC_MSG_ERROR([${with_itclinclude} directory doesn't contain itcl_sh])
- fi
-fi
-
-dnl next check in private source directory
-dnl since ls returns lowest version numbers first, reverse its output
-if test x"${ac_cv_c_itclmkidx}" = x ; then
- dnl find the top level Itcl source directory
- for i in $dirlist; do
- if test -n "`ls -dr $srcdir/$i/itcl* 2>/dev/null`" ; then
- itclpath=$srcdir/$i
- break
- fi
- done
-
- dnl find the exact Itcl source dir. We do it this way, cause there
- dnl might be multiple version of Itcl, and we want the most recent one.
- for i in `ls -dr $itclpath/itcl* 2>/dev/null ` ; do
- if test -f $i/library/itcl_mkindex.tcl ; then
- ac_cv_c_itclmkidx=`(cd $i/library; ${PWDCMD-pwd})`/itcl_mkindex.tcl
- break
- fi
- done
-fi
-if test x"${ac_cv_c_itclmkidx}" = x ; then
- dnl Get the path to the compiler
- ccpath=`which ${CC} | sed -e 's:/bin/.*::'`/share
- dnl Itcl 7.5 and greater puts library in subdir. Look there first.
- for i in `ls -dr $ccpath/itcl* 2>/dev/null ` ; do
- if test -f $i/itcl_mkindex.tcl ; then
- ac_cv_c_itclmkidx=`(cd $i; ${PWDCMD-pwd})`/itcl_mkindex.tcl
- break
- fi
- done
-fi
-])
-
-if test x"${ac_cv_c_itclmkidx}" = x ; then
- AC_MSG_ERROR([Can't find the itcl_mkindex.tcl script])
-fi
-if test x"${ac_cv_c_itclmkidx}" != x ; then
- no_itcl=""
- AC_MSG_RESULT(${ac_cv_c_itclmkidx})
- ITCLMKIDX="${ac_cv_c_itclmkidx}"
-else
- AC_MSG_RESULT(none)
-fi
-AC_SUBST(ITCLMKIDX)
-])
-
-dnl ====================================================================
-dnl Ok, lets find the tix source trees so we can use the headers
-dnl the alternative search directory is involked by --with-tixinclude
-AC_DEFUN([CYG_AC_PATH_TIX], [
- CYG_AC_PATH_TIXH
- CYG_AC_PATH_TIXLIB
-])
-AC_DEFUN([CYG_AC_PATH_TIXH], [
-dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
-no_tix=true
-AC_MSG_CHECKING(for Tix headers in the source tree)
-AC_ARG_WITH(tixinclude, [ --with-tixinclude directory where tix headers are], with_tixinclude=${withval})
-AC_CACHE_VAL(ac_cv_c_tixh,[
-dnl first check to see if --with-tixinclude was specified
-if test x"${with_tixinclude}" != x ; then
- if test -f ${with_tixinclude}/tix.h ; then
- ac_cv_c_tixh=`(cd ${with_tixinclude}; ${PWDCMD-pwd})`
- elif test -f ${with_tixinclude}/generic/tix.h ; then
- ac_cv_c_tixh=`(cd ${with_tixinclude}/generic; ${PWDCMD-pwd})`
- else
- AC_MSG_ERROR([${with_tixinclude} directory doesn't contain headers])
- fi
-fi
-
-dnl next check if it came with Tix configuration file
-if test x"${ac_cv_c_tixconfig}" != x ; then
- for i in $dirlist; do
- if test -f $ac_cv_c_tixconfig/$i/generic/tix.h ; then
- ac_cv_c_tixh=`(cd $ac_cv_c_tixconfig/$i/generic; ${PWDCMD-pwd})`
- break
- fi
- done
-fi
-
-dnl next check in private source directory
-dnl since ls returns lowest version numbers first, reverse its output
-if test x"${ac_cv_c_tixh}" = x ; then
- dnl find the top level Tix source directory
- for i in $dirlist; do
- if test -n "`ls -dr $srcdir/$i/tix* 2>/dev/null`" ; then
- tixpath=$srcdir/$i
- break
- fi
- done
-
- dnl find the exact Tix source dir. We do it this way, cause there
- dnl might be multiple version of Tix, and we want the most recent one.
- for i in `ls -dr $tixpath/tix* 2>/dev/null ` ; do
- if test -f $i/generic/tix.h ; then
- ac_cv_c_tixh=`(cd $i/generic; ${PWDCMD-pwd})`
- break
- fi
- done
-fi
-
-dnl see if one is installed
-if test x"${ac_cv_c_tixh}" = x ; then
- AC_MSG_RESULT(none)
- dnl Get the path to the compiler
-
- dnl Get the path to the compiler. We do it this way instead of using
- dnl AC_CHECK_HEADER, cause this doesn't depend in having X configured.
- ccpath=`which ${CC} | sed -e 's:/bin/.*::'`/include
- if test -f $ccpath/tix.h; then
- ac_cv_c_tixh=installed
- fi
-else
- AC_MSG_RESULT(${ac_cv_c_tixh})
-fi
-])
-if test x"${ac_cv_c_tixh}" = x ; then
- AC_MSG_ERROR([Can't find any Tix headers])
-fi
-if test x"${ac_cv_c_tixh}" != x ; then
- no_tix=""
- AC_MSG_RESULT(${ac_cv_c_tixh})
- if test x"${ac_cv_c_tixh}" != x"installed" ; then
- TIXHDIR="-I${ac_cv_c_tixh}"
- fi
-fi
-
-AC_SUBST(TIXHDIR)
-])
-
-AC_DEFUN([CYG_AC_PATH_TIXCONFIG], [
-#
-# Ok, lets find the tix configuration
-# First, look for one uninstalled.
-# the alternative search directory is invoked by --with-tixconfig
-#
-
-if test x"${no_tix}" = x ; then
- # we reset no_tix in case something fails here
- no_tix=true
- AC_ARG_WITH(tixconfig, [ --with-tixconfig directory containing tix configuration (tixConfig.sh)],
- with_tixconfig=${withval})
- AC_MSG_CHECKING([for Tix configuration])
- AC_CACHE_VAL(ac_cv_c_tixconfig,[
-
- # First check to see if --with-tixconfig was specified.
- if test x"${with_tixconfig}" != x ; then
- if test -f "${with_tixconfig}/tixConfig.sh" ; then
- ac_cv_c_tixconfig=`(cd ${with_tixconfig}; ${PWDCMD-pwd})`
- else
- AC_MSG_ERROR([${with_tixconfig} directory doesn't contain tixConfig.sh])
- fi
- fi
-
- # then check for a private Tix library
- if test x"${ac_cv_c_tixconfig}" = x ; then
- for i in \
- ../tix \
- `ls -dr ../tix[[4]]* 2>/dev/null` \
- ../../tix \
- `ls -dr ../../tix[[4]]* 2>/dev/null` \
- ../../../tix \
- `ls -dr ../../../tix[[4]]* 2>/dev/null` ; do
- if test -f "$i/tixConfig.sh" ; then
- ac_cv_c_tixconfig=`(cd $i; ${PWDCMD-pwd})`
- break
- fi
- done
- fi
- # check in a few common install locations
- if test x"${ac_cv_c_tixconfig}" = x ; then
- for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do
- if test -f "$i/tixConfig.sh" ; then
- ac_cv_c_tkconfig=`(cd $i; ${PWDCMD-pwd})`
- break
- fi
- done
- fi
- # check in a few other private locations
- if test x"${ac_cv_c_tixconfig}" = x ; then
- for i in \
- ${srcdir}/../tix \
- `ls -dr ${srcdir}/../tix[[4-9]]* 2>/dev/null` ; do
- if test -f "$i/tixConfig.sh" ; then
- ac_cv_c_tixconfig=`(cd $i; ${PWDCMD-pwd})`
- break
- fi
- done
- fi
- ])
- if test x"${ac_cv_c_tixconfig}" = x ; then
- TIXCONFIG="# no Tix configs found"
- AC_MSG_WARN(Can't find Tix configuration definitions)
- else
- no_tix=
- TIXCONFIG=${ac_cv_c_tixconfig}/tixConfig.sh
- AC_MSG_RESULT(found $TIXCONFIG)
- fi
-fi
-
-])
-
-# Defined as a separate macro so we don't have to cache the values
-# from PATH_TIXCONFIG (because this can also be cached).
-AC_DEFUN([CYG_AC_LOAD_TIXCONFIG], [
- if test -f "$TIXCONFIG" ; then
- . $TIXCONFIG
- fi
-
- AC_SUBST(TIX_BUILD_LIB_SPEC)
- AC_SUBST(TIX_LIB_FULL_PATH)
-])
-
-AC_DEFUN([CYG_AC_PATH_ITCLCONFIG], [
-#
-# Ok, lets find the itcl configuration
-# First, look for one uninstalled.
-# the alternative search directory is invoked by --with-itclconfig
-#
-
-if test x"${no_itcl}" = x ; then
- # we reset no_itcl in case something fails here
- no_itcl=true
- AC_ARG_WITH(itclconfig, [ --with-itclconfig directory containing itcl configuration (itclConfig.sh)],
- with_itclconfig=${withval})
- AC_MSG_CHECKING([for Itcl configuration])
- AC_CACHE_VAL(ac_cv_c_itclconfig,[
-
- # First check to see if --with-itclconfig was specified.
- if test x"${with_itclconfig}" != x ; then
- if test -f "${with_itclconfig}/itclConfig.sh" ; then
- ac_cv_c_itclconfig=`(cd ${with_itclconfig}; ${PWDCMD-pwd})`
- else
- AC_MSG_ERROR([${with_itclconfig} directory doesn't contain itclConfig.sh])
- fi
- fi
-
- # then check for a private itcl library
- if test x"${ac_cv_c_itclconfig}" = x ; then
- for i in \
- ../itcl/itcl \
- `ls -dr ../itcl/itcl[[3]]* 2>/dev/null` \
- ../../itcl/itcl \
- `ls -dr ../../itcl/itcl[[3]]* 2>/dev/null` \
- ../../../itcl/itcl \
- `ls -dr ../../../itcl/itcl[[3]]* 2>/dev/null` ; do
- if test -f "$i/itclConfig.sh" ; then
- ac_cv_c_itclconfig=`(cd $i; ${PWDCMD-pwd})`
- break
- fi
- done
- fi
- # check in a few common install locations
- if test x"${ac_cv_c_itclconfig}" = x ; then
- for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do
- if test -f "$i/itclConfig.sh" ; then
- ac_cv_c_itclconfig=`(cd $i; ${PWDCMD-pwd})`
- break
- fi
- done
- fi
- # check in a few other private locations
- if test x"${ac_cv_c_itclconfig}" = x ; then
- for i in \
- ${srcdir}/../itcl/itcl \
- `ls -dr ${srcdir}/../itcl/itcl[[3]]* 2>/dev/null` ; do
- if test -f "$i/itcl/itclConfig.sh" ; then
- ac_cv_c_itclconfig=`(cd $i; ${PWDCMD-pwd})`
- break
- fi
- done
- fi
- ])
- if test x"${ac_cv_c_itclconfig}" = x ; then
- ITCLCONFIG="# no itcl configs found"
- AC_MSG_WARN(Can't find itcl configuration definitions)
- else
- no_itcl=
- ITCLCONFIG=${ac_cv_c_itclconfig}/itclConfig.sh
- AC_MSG_RESULT(found $ITCLCONFIG)
- fi
-fi
-
-])
-
-# Defined as a separate macro so we don't have to cache the values
-# from PATH_ITCLCONFIG (because this can also be cached).
-AC_DEFUN([CYG_AC_LOAD_ITCLCONFIG], [
- if test -f "$ITCLCONFIG" ; then
- . $ITCLCONFIG
- fi
-
- AC_SUBST(ITCL_BUILD_LIB_SPEC)
- AC_SUBST(ITCL_SH)
- AC_SUBST(ITCL_LIB_FILE)
- AC_SUBST(ITCL_LIB_FULL_PATH)
-
-])
-
-
-AC_DEFUN([CYG_AC_PATH_ITKCONFIG], [
-#
-# Ok, lets find the itk configuration
-# First, look for one uninstalled.
-# the alternative search directory is invoked by --with-itkconfig
-#
-
-if test x"${no_itk}" = x ; then
- # we reset no_itk in case something fails here
- no_itk=true
- AC_ARG_WITH(itkconfig, [ --with-itkconfig directory containing itk configuration (itkConfig.sh)],
- with_itkconfig=${withval})
- AC_MSG_CHECKING([for Itk configuration])
- AC_CACHE_VAL(ac_cv_c_itkconfig,[
-
- # First check to see if --with-itkconfig was specified.
- if test x"${with_itkconfig}" != x ; then
- if test -f "${with_itkconfig}/itkConfig.sh" ; then
- ac_cv_c_itkconfig=`(cd ${with_itkconfig}; ${PWDCMD-pwd})`
- else
- AC_MSG_ERROR([${with_itkconfig} directory doesn't contain itkConfig.sh])
- fi
- fi
-
- # then check for a private itk library
- if test x"${ac_cv_c_itkconfig}" = x ; then
- for i in \
- ../itcl/itk \
- `ls -dr ../itcl/itk[[3]]* 2>/dev/null` \
- ../../itcl/itk \
- `ls -dr ../../itcl/itk[[3]]* 2>/dev/null` \
- ../../../itcl/itk \
- `ls -dr ../../../itcl/itk[[3]]* 2>/dev/null` ; do
- if test -f "$i/itkConfig.sh" ; then
- ac_cv_c_itkconfig=`(cd $i; ${PWDCMD-pwd})`
- break
- fi
- done
- fi
- # check in a few common install locations
- if test x"${ac_cv_c_itkconfig}" = x ; then
- for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do
- if test -f "$i/itcl/itkConfig.sh" ; then
- ac_cv_c_itkconfig=`(cd $i; ${PWDCMD-pwd})`
- break
- fi
- done
- fi
- # check in a few other private locations
- if test x"${ac_cv_c_itkconfig}" = x ; then
- for i in \
- ${srcdir}/../itcl/itk \
- `ls -dr ${srcdir}/../itcl/itk[[3]]* 2>/dev/null` ; do
- if test -f "$i/itkConfig.sh" ; then
- ac_cv_c_itkconfig=`(cd $i; ${PWDCMD-pwd})`
- break
- fi
- done
- fi
- ])
- if test x"${ac_cv_c_itkconfig}" = x ; then
- ITCLCONFIG="# no itk configs found"
- AC_MSG_WARN(Can't find itk configuration definitions)
- else
- no_itk=
- ITKCONFIG=${ac_cv_c_itkconfig}/itkConfig.sh
- AC_MSG_RESULT(found $ITKCONFIG)
- fi
-fi
-
-])
-
-# Defined as a separate macro so we don't have to cache the values
-# from PATH_ITKCONFIG (because this can also be cached).
-AC_DEFUN([CYG_AC_LOAD_ITKCONFIG], [
- if test -f "$ITKCONFIG" ; then
- . $ITKCONFIG
- fi
-
- AC_SUBST(ITK_BUILD_LIB_SPEC)
- AC_SUBST(ITK_LIB_FILE)
- AC_SUBST(ITK_LIB_FULL_PATH)
-])
-
-
-dnl ====================================================================
-dnl Ok, lets find the libgui source trees so we can use the headers
-dnl the alternative search directory is involked by --with-libguiinclude
-AC_DEFUN([CYG_AC_PATH_LIBGUI], [
- CYG_AC_PATH_LIBGUIH
- CYG_AC_PATH_LIBGUILIB
-])
-AC_DEFUN([CYG_AC_PATH_LIBGUIH], [
-dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../..../../../../../../../../../../.."
-no_libgui=true
-AC_MSG_CHECKING(for Libgui headers in the source tree)
-AC_ARG_WITH(libguiinclude, [ --with-libguiinclude directory where libgui headers are], with_libguiinclude=${withval})
-AC_CACHE_VAL(ac_cv_c_libguih,[
-dnl first check to see if --with-libguiinclude was specified
-if test x"${with_libguiinclude}" != x ; then
- if test -f ${with_libguiinclude}/guitcl.h ; then
- ac_cv_c_libguih=`(cd ${with_libguiinclude}; ${PWDCMD-pwd})`
- elif test -f ${with_libguiinclude}/src/guitcl.h ; then
- ac_cv_c_libguih=`(cd ${with_libguiinclude}/src; ${PWDCMD-pwd})`
- else
- AC_MSG_ERROR([${with_libguiinclude} directory doesn't contain headers])
- fi
-fi
-
-dnl next check if it came with Libgui configuration file
-if test x"${ac_cv_c_libguiconfig}" != x ; then
- for i in $dirlist; do
- if test -f $ac_cv_c_libguiconfig/$i/src/guitcl.h ; then
- ac_cv_c_libguih=`(cd $ac_cv_c_libguiconfig/$i/src; ${PWDCMD-pwd})`
- break
- fi
- done
-fi
-
-dnl next check in private source directory
-dnl since ls returns lowest version numbers first, reverse its output
-if test x"${ac_cv_c_libguih}" = x ; then
- dnl find the top level Libgui source directory
- for i in $dirlist; do
- if test -n "`ls -dr $srcdir/$i/libgui* 2>/dev/null`" ; then
- libguipath=$srcdir/$i
- break
- fi
- done
-
- dnl find the exact Libgui source dir. We do it this way, cause there
- dnl might be multiple version of Libgui, and we want the most recent one.
- for i in `ls -dr $libguipath/libgui* 2>/dev/null ` ; do
- if test -f $i/src/guitcl.h ; then
- ac_cv_c_libguih=`(cd $i/src; ${PWDCMD-pwd})`
- break
- fi
- done
-fi
-
-dnl see if one is installed
-if test x"${ac_cv_c_libguih}" = x ; then
- AC_MSG_RESULT(none)
- AC_CHECK_HEADER(guitcl.h, ac_cv_c_libguih=installed, ac_cv_c_libguih="")
-fi
-])
-LIBGUIHDIR=""
-if test x"${ac_cv_c_libguih}" = x ; then
- AC_MSG_WARN([Can't find any Libgui headers])
-fi
-if test x"${ac_cv_c_libguih}" != x ; then
- no_libgui=""
- if test x"${ac_cv_c_libguih}" != x"installed" ; then
- LIBGUIHDIR="-I${ac_cv_c_libguih}"
- fi
-fi
-AC_MSG_RESULT(${ac_cv_c_libguih})
-AC_SUBST(LIBGUIHDIR)
-])
-
-dnl ====================================================================
-dnl find the GUI library
-AC_DEFUN([CYG_AC_PATH_LIBGUILIB], [
-AC_MSG_CHECKING(for GUI library in the build tree)
-dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
-dnl look for the library
-AC_MSG_CHECKING(for GUI library)
-AC_CACHE_VAL(ac_cv_c_libguilib,[
-if test x"${ac_cv_c_libguilib}" = x ; then
- for i in $dirlist; do
- if test -f "$i/libgui/src/Makefile" ; then
- ac_cv_c_libguilib=`(cd $i/libgui/src; ${PWDCMD-pwd})`
- break
- fi
- done
-fi
-])
-if test x"${ac_cv_c_libguilib}" != x ; then
- GUILIB="${GUILIB} -L${ac_cv_c_libguilib}"
- LIBGUILIB="-lgui"
- AC_MSG_RESULT(${ac_cv_c_libguilib})
-else
- AC_MSG_RESULT(none)
-fi
-
-AC_SUBST(GUILIB)
-AC_SUBST(LIBGUILIB)
-])
diff --git a/gcc/config/pa/x-ada b/config/mh-pa
index b60b3d7925b..b0005a25d4d 100644
--- a/gcc/config/pa/x-ada
+++ b/config/mh-pa
@@ -1,4 +1,4 @@
# The ada virtual array implementation requires that indexing be disabled on
# hosts such as hpux that use a segmented memory architecture. Both the c
# and ada files need to be compiled with this option for correct operation.
-X_ADA_CFLAGS=-mdisable-indexing
+ADA_CFLAGS = -mdisable-indexing
diff --git a/gcc/config/pa/x-ada-hpux10 b/config/mh-pa-hpux10
index d2b70753088..99a2278f281 100644
--- a/gcc/config/pa/x-ada-hpux10
+++ b/config/mh-pa-hpux10
@@ -1,4 +1,4 @@
# The ada virtual array implementation requires that indexing be disabled on
# hosts such as hpux that use a segmented memory architecture. Both the c
# and ada files need to be compiled with this option for correct operation.
-X_ADA_CFLAGS = -mdisable-indexing -D_X_HPUX10
+ADA_CFLAGS = -mdisable-indexing -D_X_HPUX10
diff --git a/config/mt-mips-elfoabi b/config/mt-mips-elfoabi
index 988ca1eaa2e..a9f9cbec7d2 100644
--- a/config/mt-mips-elfoabi
+++ b/config/mt-mips-elfoabi
@@ -1,6 +1 @@
-# The *-elfoabi configurations are intended to be usable for both
-# MIPS16 and non-MIPS16 code, but the libraries are all non-MIPS16.
-# Add -minterlink-mips16 so that the libraries can be used with both
-# ISA modes.
-CFLAGS_FOR_TARGET += -minterlink-mips16
-CXXFLAGS_FOR_TARGET += -minterlink-mips16
+include $(srcdir)/config/mt-mips16-compat
diff --git a/config/mt-mips-gnu b/config/mt-mips-gnu
new file mode 100644
index 00000000000..a8198c03ff8
--- /dev/null
+++ b/config/mt-mips-gnu
@@ -0,0 +1,2 @@
+include $(srcdir)/config/mt-gnu
+include $(srcdir)/config/mt-mips16-compat
diff --git a/config/mt-mips16-compat b/config/mt-mips16-compat
new file mode 100644
index 00000000000..7e36791e67f
--- /dev/null
+++ b/config/mt-mips16-compat
@@ -0,0 +1,5 @@
+# Configurations use this fragment if they support MIPS16 and non-MIPS16 code,
+# but if the libraries are all non-MIPS16. Add -minterlink-mips16 so
+# that the libraries can be used with both ISA modes.
+CFLAGS_FOR_TARGET += -minterlink-mips16
+CXXFLAGS_FOR_TARGET += -minterlink-mips16
diff --git a/config/mt-spu b/config/mt-spu
index c2dbc66e999..7efa74ca41e 100644
--- a/config/mt-spu
+++ b/config/mt-spu
@@ -1,4 +1,2 @@
-# spu ld makefile invokes as-new in maintainer mode.
-all-ld: $(MAINT) all-gas
-# spu ld makefile invokes bin2c
-all-ld: all-binutils
+# spu ld makefile invokes as-new and bin2c in maintainer mode.
+all-ld: $(MAINT) all-gas all-binutils
diff --git a/config/tcl.m4 b/config/tcl.m4
new file mode 100644
index 00000000000..be0129b1bdf
--- /dev/null
+++ b/config/tcl.m4
@@ -0,0 +1,3248 @@
+#------------------------------------------------------------------------
+# SC_PATH_TCLCONFIG --
+#
+# Locate the tclConfig.sh file and perform a sanity check on
+# the Tcl compile flags
+#
+# Arguments:
+# none
+#
+# Results:
+#
+# Adds the following arguments to configure:
+# --with-tcl=...
+#
+# Defines the following vars:
+# TCL_BIN_DIR Full path to the directory containing
+# the tclConfig.sh file
+#------------------------------------------------------------------------
+
+AC_DEFUN([SC_PATH_TCLCONFIG], [
+ #
+ # Ok, lets find the tcl configuration
+ # First, look for one uninstalled.
+ # the alternative search directory is invoked by --with-tcl
+ #
+
+ if test x"${no_tcl}" = x ; then
+ # we reset no_tcl in case something fails here
+ no_tcl=true
+ AC_ARG_WITH(tcl, [ --with-tcl directory containing tcl configuration (tclConfig.sh)], with_tclconfig=${withval})
+ AC_MSG_CHECKING([for Tcl configuration])
+ AC_CACHE_VAL(ac_cv_c_tclconfig,[
+
+ # First check to see if --with-tcl was specified.
+ case "${host}" in
+ *-*-cygwin*) platDir="win" ;;
+ *) platDir="unix" ;;
+ esac
+ if test x"${with_tclconfig}" != x ; then
+ if test -f "${with_tclconfig}/tclConfig.sh" ; then
+ ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
+ else
+ AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
+ fi
+ fi
+
+ # then check for a private Tcl installation
+ if test x"${ac_cv_c_tclconfig}" = x ; then
+ for i in \
+ ../tcl \
+ `ls -dr ../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
+ `ls -dr ../tcl[[8-9]].[[0-9]] 2>/dev/null` \
+ `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
+ ../../tcl \
+ `ls -dr ../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
+ `ls -dr ../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
+ `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
+ ../../../tcl \
+ `ls -dr ../../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
+ `ls -dr ../../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
+ `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
+ if test -f "$i/$platDir/tclConfig.sh" ; then
+ ac_cv_c_tclconfig=`(cd $i/$platDir; pwd)`
+ break
+ fi
+ done
+ fi
+
+ # on Darwin, check in Framework installation locations
+ if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tclconfig}" = x ; then
+ for i in `ls -d ~/Library/Frameworks 2>/dev/null` \
+ `ls -d /Library/Frameworks 2>/dev/null` \
+ `ls -d /Network/Library/Frameworks 2>/dev/null` \
+ `ls -d /System/Library/Frameworks 2>/dev/null` \
+ ; do
+ if test -f "$i/Tcl.framework/tclConfig.sh" ; then
+ ac_cv_c_tclconfig=`(cd $i/Tcl.framework; pwd)`
+ break
+ fi
+ done
+ fi
+
+ # check in a few common install locations
+ if test x"${ac_cv_c_tclconfig}" = x ; then
+ for i in `ls -d ${libdir} 2>/dev/null` \
+ `ls -d ${exec_prefix}/lib 2>/dev/null` \
+ `ls -d ${prefix}/lib 2>/dev/null` \
+ `ls -d /usr/local/lib 2>/dev/null` \
+ `ls -d /usr/contrib/lib 2>/dev/null` \
+ `ls -d /usr/lib 2>/dev/null` \
+ ; do
+ if test -f "$i/tclConfig.sh" ; then
+ ac_cv_c_tclconfig=`(cd $i; pwd)`
+ break
+ fi
+ done
+ fi
+
+ # check in a few other private locations
+ if test x"${ac_cv_c_tclconfig}" = x ; then
+ for i in \
+ ${srcdir}/../tcl \
+ `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
+ `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]] 2>/dev/null` \
+ `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
+ if test -f "$i/$platDir/tclConfig.sh" ; then
+ ac_cv_c_tclconfig=`(cd $i/$platDir; pwd)`
+ break
+ fi
+ done
+ fi
+ ])
+
+ if test x"${ac_cv_c_tclconfig}" = x ; then
+ TCL_BIN_DIR="# no Tcl configs found"
+ AC_MSG_WARN([Can't find Tcl configuration definitions])
+ exit 0
+ else
+ no_tcl=
+ TCL_BIN_DIR=${ac_cv_c_tclconfig}
+ AC_MSG_RESULT([found ${TCL_BIN_DIR}/tclConfig.sh])
+ fi
+ fi
+])
+
+#------------------------------------------------------------------------
+# SC_PATH_TKCONFIG --
+#
+# Locate the tkConfig.sh file
+#
+# Arguments:
+# none
+#
+# Results:
+#
+# Adds the following arguments to configure:
+# --with-tk=...
+#
+# Defines the following vars:
+# TK_BIN_DIR Full path to the directory containing
+# the tkConfig.sh file
+#------------------------------------------------------------------------
+
+AC_DEFUN([SC_PATH_TKCONFIG], [
+ #
+ # Ok, lets find the tk configuration
+ # First, look for one uninstalled.
+ # the alternative search directory is invoked by --with-tk
+ #
+
+ if test x"${no_tk}" = x ; then
+ # we reset no_tk in case something fails here
+ no_tk=true
+ AC_ARG_WITH(tk, [ --with-tk directory containing tk configuration (tkConfig.sh)], with_tkconfig=${withval})
+ AC_MSG_CHECKING([for Tk configuration])
+ AC_CACHE_VAL(ac_cv_c_tkconfig,[
+
+ # First check to see if --with-tkconfig was specified.
+ if test x"${with_tkconfig}" != x ; then
+ if test -f "${with_tkconfig}/tkConfig.sh" ; then
+ ac_cv_c_tkconfig=`(cd ${with_tkconfig}; pwd)`
+ else
+ AC_MSG_ERROR([${with_tkconfig} directory doesn't contain tkConfig.sh])
+ fi
+ fi
+
+ # then check for a private Tk library
+ case "${host}" in
+ *-*-cygwin*) platDir="win" ;;
+ *) platDir="unix" ;;
+ esac
+ if test x"${ac_cv_c_tkconfig}" = x ; then
+ for i in \
+ ../tk \
+ `ls -dr ../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
+ `ls -dr ../tk[[8-9]].[[0-9]] 2>/dev/null` \
+ `ls -dr ../tk[[8-9]].[[0-9]]* 2>/dev/null` \
+ ../../tk \
+ `ls -dr ../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
+ `ls -dr ../../tk[[8-9]].[[0-9]] 2>/dev/null` \
+ `ls -dr ../../tk[[8-9]].[[0-9]]* 2>/dev/null` \
+ ../../../tk \
+ `ls -dr ../../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
+ `ls -dr ../../../tk[[8-9]].[[0-9]] 2>/dev/null` \
+ `ls -dr ../../../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
+ if test -f "$i/$platDir/tkConfig.sh" ; then
+ ac_cv_c_tkconfig=`(cd $i/$platDir; pwd)`
+ break
+ fi
+ done
+ fi
+
+ # on Darwin, check in Framework installation locations
+ if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tkconfig}" = x ; then
+ for i in `ls -d ~/Library/Frameworks 2>/dev/null` \
+ `ls -d /Library/Frameworks 2>/dev/null` \
+ `ls -d /Network/Library/Frameworks 2>/dev/null` \
+ `ls -d /System/Library/Frameworks 2>/dev/null` \
+ ; do
+ if test -f "$i/Tk.framework/tkConfig.sh" ; then
+ ac_cv_c_tkconfig=`(cd $i/Tk.framework; pwd)`
+ break
+ fi
+ done
+ fi
+
+ # check in a few common install locations
+ if test x"${ac_cv_c_tkconfig}" = x ; then
+ for i in `ls -d ${libdir} 2>/dev/null` \
+ `ls -d ${exec_prefix}/lib 2>/dev/null` \
+ `ls -d ${prefix}/lib 2>/dev/null` \
+ `ls -d /usr/local/lib 2>/dev/null` \
+ `ls -d /usr/contrib/lib 2>/dev/null` \
+ `ls -d /usr/lib 2>/dev/null` \
+ ; do
+ if test -f "$i/tkConfig.sh" ; then
+ ac_cv_c_tkconfig=`(cd $i; pwd)`
+ break
+ fi
+ done
+ fi
+ # check in a few other private locations
+ if test x"${ac_cv_c_tkconfig}" = x ; then
+ for i in \
+ ${srcdir}/../tk \
+ `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
+ `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]] 2>/dev/null` \
+ `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
+ if test -f "$i/$platDir/tkConfig.sh" ; then
+ ac_cv_c_tkconfig=`(cd $i/$platDir; pwd)`
+ break
+ fi
+ done
+ fi
+ ])
+
+ if test x"${ac_cv_c_tkconfig}" = x ; then
+ TK_BIN_DIR="# no Tk configs found"
+ AC_MSG_WARN([Can't find Tk configuration definitions])
+ exit 0
+ else
+ no_tk=
+ TK_BIN_DIR=${ac_cv_c_tkconfig}
+ AC_MSG_RESULT([found ${TK_BIN_DIR}/tkConfig.sh])
+ fi
+ fi
+])
+
+#------------------------------------------------------------------------
+# SC_LOAD_TCLCONFIG --
+#
+# Load the tclConfig.sh file
+#
+# Arguments:
+#
+# Requires the following vars to be set:
+# TCL_BIN_DIR
+#
+# Results:
+#
+# Subst the following vars:
+# TCL_BIN_DIR
+# TCL_SRC_DIR
+# TCL_LIB_FILE
+#
+#------------------------------------------------------------------------
+
+AC_DEFUN([SC_LOAD_TCLCONFIG], [
+ AC_MSG_CHECKING([for existence of ${TCL_BIN_DIR}/tclConfig.sh])
+
+ if test -f "${TCL_BIN_DIR}/tclConfig.sh" ; then
+ AC_MSG_RESULT([loading])
+ . ${TCL_BIN_DIR}/tclConfig.sh
+ else
+ AC_MSG_RESULT([could not find ${TCL_BIN_DIR}/tclConfig.sh])
+ fi
+
+ # eval is required to do the TCL_DBGX substitution
+ eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
+ eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
+
+ # If the TCL_BIN_DIR is the build directory (not the install directory),
+ # then set the common variable name to the value of the build variables.
+ # For example, the variable TCL_LIB_SPEC will be set to the value
+ # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC
+ # instead of TCL_BUILD_LIB_SPEC since it will work with both an
+ # installed and uninstalled version of Tcl.
+ if test -f ${TCL_BIN_DIR}/Makefile ; then
+ TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC}
+ TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC}
+ TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH}
+ elif test "`uname -s`" = "Darwin"; then
+ # If Tcl was built as a framework, attempt to use the libraries
+ # from the framework at the given location so that linking works
+ # against Tcl.framework installed in an arbitary location.
+ case ${TCL_DEFS} in
+ *TCL_FRAMEWORK*)
+ if test -f ${TCL_BIN_DIR}/${TCL_LIB_FILE}; then
+ for i in "`cd ${TCL_BIN_DIR}; pwd`" \
+ "`cd ${TCL_BIN_DIR}/../..; pwd`"; do
+ if test "`basename "$i"`" = "${TCL_LIB_FILE}.framework"; then
+ TCL_LIB_SPEC="-F`dirname "$i"` -framework ${TCL_LIB_FILE}"
+ break
+ fi
+ done
+ fi
+ if test -f ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}; then
+ TCL_STUB_LIB_SPEC="-L${TCL_BIN_DIR} ${TCL_STUB_LIB_FLAG}"
+ TCL_STUB_LIB_PATH="${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}"
+ fi
+ ;;
+ esac
+ fi
+
+ # eval is required to do the TCL_DBGX substitution
+ eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\""
+ eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\""
+ eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
+ eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""
+
+ AC_SUBST(TCL_VERSION)
+ AC_SUBST(TCL_PATCH_LEVEL)
+ AC_SUBST(TCL_BIN_DIR)
+ AC_SUBST(TCL_SRC_DIR)
+
+ AC_SUBST(TCL_LIB_FILE)
+ AC_SUBST(TCL_LIB_FLAG)
+ AC_SUBST(TCL_LIB_SPEC)
+
+ AC_SUBST(TCL_STUB_LIB_FILE)
+ AC_SUBST(TCL_STUB_LIB_FLAG)
+ AC_SUBST(TCL_STUB_LIB_SPEC)
+])
+
+#------------------------------------------------------------------------
+# SC_LOAD_TKCONFIG --
+#
+# Load the tkConfig.sh file
+#
+# Arguments:
+#
+# Requires the following vars to be set:
+# TK_BIN_DIR
+#
+# Results:
+#
+# Sets the following vars that should be in tkConfig.sh:
+# TK_BIN_DIR
+#------------------------------------------------------------------------
+
+AC_DEFUN([SC_LOAD_TKCONFIG], [
+ AC_MSG_CHECKING([for existence of ${TK_BIN_DIR}/tkConfig.sh])
+
+ if test -f "${TK_BIN_DIR}/tkConfig.sh" ; then
+ AC_MSG_RESULT([loading])
+ . ${TK_BIN_DIR}/tkConfig.sh
+ else
+ AC_MSG_RESULT([could not find ${TK_BIN_DIR}/tkConfig.sh])
+ fi
+
+ # eval is required to do the TK_DBGX substitution
+ eval "TK_LIB_FILE=\"${TK_LIB_FILE}\""
+ eval "TK_STUB_LIB_FILE=\"${TK_STUB_LIB_FILE}\""
+
+ # If the TK_BIN_DIR is the build directory (not the install directory),
+ # then set the common variable name to the value of the build variables.
+ # For example, the variable TK_LIB_SPEC will be set to the value
+ # of TK_BUILD_LIB_SPEC. An extension should make use of TK_LIB_SPEC
+ # instead of TK_BUILD_LIB_SPEC since it will work with both an
+ # installed and uninstalled version of Tcl.
+ if test -f ${TK_BIN_DIR}/Makefile ; then
+ TK_LIB_SPEC=${TK_BUILD_LIB_SPEC}
+ TK_STUB_LIB_SPEC=${TK_BUILD_STUB_LIB_SPEC}
+ TK_STUB_LIB_PATH=${TK_BUILD_STUB_LIB_PATH}
+ elif test "`uname -s`" = "Darwin"; then
+ # If Tk was built as a framework, attempt to use the libraries
+ # from the framework at the given location so that linking works
+ # against Tk.framework installed in an arbitary location.
+ case ${TK_DEFS} in
+ *TK_FRAMEWORK*)
+ if test -f ${TK_BIN_DIR}/${TK_LIB_FILE}; then
+ for i in "`cd ${TK_BIN_DIR}; pwd`" \
+ "`cd ${TK_BIN_DIR}/../..; pwd`"; do
+ if test "`basename "$i"`" = "${TK_LIB_FILE}.framework"; then
+ TK_LIB_SPEC="-F`dirname "$i"` -framework ${TK_LIB_FILE}"
+ break
+ fi
+ done
+ fi
+ if test -f ${TK_BIN_DIR}/${TK_STUB_LIB_FILE}; then
+ TK_STUB_LIB_SPEC="-L${TK_BIN_DIR} ${TK_STUB_LIB_FLAG}"
+ TK_STUB_LIB_PATH="${TK_BIN_DIR}/${TK_STUB_LIB_FILE}"
+ fi
+ ;;
+ esac
+ fi
+
+ # eval is required to do the TK_DBGX substitution
+ eval "TK_LIB_FLAG=\"${TK_LIB_FLAG}\""
+ eval "TK_LIB_SPEC=\"${TK_LIB_SPEC}\""
+ eval "TK_STUB_LIB_FLAG=\"${TK_STUB_LIB_FLAG}\""
+ eval "TK_STUB_LIB_SPEC=\"${TK_STUB_LIB_SPEC}\""
+
+ AC_SUBST(TK_VERSION)
+ AC_SUBST(TK_BIN_DIR)
+ AC_SUBST(TK_SRC_DIR)
+
+ AC_SUBST(TK_LIB_FILE)
+ AC_SUBST(TK_LIB_FLAG)
+ AC_SUBST(TK_LIB_SPEC)
+
+ AC_SUBST(TK_STUB_LIB_FILE)
+ AC_SUBST(TK_STUB_LIB_FLAG)
+ AC_SUBST(TK_STUB_LIB_SPEC)
+])
+
+#------------------------------------------------------------------------
+# SC_PROG_TCLSH
+# Locate a tclsh shell installed on the system path. This macro
+# will only find a Tcl shell that already exists on the system.
+# It will not find a Tcl shell in the Tcl build directory or
+# a Tcl shell that has been installed from the Tcl build directory.
+# If a Tcl shell can't be located on the PATH, then TCLSH_PROG will
+# be set to "". Extensions should take care not to create Makefile
+# rules that are run by default and depend on TCLSH_PROG. An
+# extension can't assume that an executable Tcl shell exists at
+# build time.
+#
+# Arguments
+# none
+#
+# Results
+# Subst's the following values:
+# TCLSH_PROG
+#------------------------------------------------------------------------
+
+AC_DEFUN([SC_PROG_TCLSH], [
+ AC_MSG_CHECKING([for tclsh])
+ AC_CACHE_VAL(ac_cv_path_tclsh, [
+ search_path=`echo ${PATH} | sed -e 's/:/ /g'`
+ for dir in $search_path ; do
+ for j in `ls -r $dir/tclsh[[8-9]]* 2> /dev/null` \
+ `ls -r $dir/tclsh* 2> /dev/null` ; do
+ if test x"$ac_cv_path_tclsh" = x ; then
+ if test -f "$j" ; then
+ ac_cv_path_tclsh=$j
+ break
+ fi
+ fi
+ done
+ done
+ ])
+
+ if test -f "$ac_cv_path_tclsh" ; then
+ TCLSH_PROG="$ac_cv_path_tclsh"
+ AC_MSG_RESULT([$TCLSH_PROG])
+ else
+ # It is not an error if an installed version of Tcl can't be located.
+ TCLSH_PROG=""
+ AC_MSG_RESULT([No tclsh found on PATH])
+ fi
+ AC_SUBST(TCLSH_PROG)
+])
+
+#------------------------------------------------------------------------
+# SC_BUILD_TCLSH
+# Determine the fully qualified path name of the tclsh executable
+# in the Tcl build directory. This macro will correctly determine
+# the name of the tclsh executable even if tclsh has not yet
+# been built in the build directory. The build tclsh must be used
+# when running tests from an extension build directory. It is not
+# correct to use the TCLSH_PROG in cases like this.
+#
+# Arguments
+# none
+#
+# Results
+# Subst's the following values:
+# BUILD_TCLSH
+#------------------------------------------------------------------------
+
+AC_DEFUN([SC_BUILD_TCLSH], [
+ AC_MSG_CHECKING([for tclsh in Tcl build directory])
+ BUILD_TCLSH=${TCL_BIN_DIR}/tclsh
+ AC_MSG_RESULT([$BUILD_TCLSH])
+ AC_SUBST(BUILD_TCLSH)
+])
+
+#------------------------------------------------------------------------
+# SC_ENABLE_SHARED --
+#
+# Allows the building of shared libraries
+#
+# Arguments:
+# none
+#
+# Results:
+#
+# Adds the following arguments to configure:
+# --enable-shared=yes|no
+#
+# Defines the following vars:
+# STATIC_BUILD Used for building import/export libraries
+# on Windows.
+#
+# Sets the following vars:
+# SHARED_BUILD Value of 1 or 0
+#------------------------------------------------------------------------
+
+AC_DEFUN([SC_ENABLE_SHARED], [
+ AC_MSG_CHECKING([how to build libraries])
+ AC_ARG_ENABLE(shared,
+ [ --enable-shared build and link with shared libraries [--enable-shared]],
+ [tcl_ok=$enableval], [tcl_ok=yes])
+
+ if test "${enable_shared+set}" = set; then
+ enableval="$enable_shared"
+ tcl_ok=$enableval
+ else
+ tcl_ok=yes
+ fi
+
+ if test "$tcl_ok" = "yes" ; then
+ AC_MSG_RESULT([shared])
+ SHARED_BUILD=1
+ else
+ AC_MSG_RESULT([static])
+ SHARED_BUILD=0
+ AC_DEFINE(STATIC_BUILD)
+ fi
+])
+
+#------------------------------------------------------------------------
+# SC_ENABLE_FRAMEWORK --
+#
+# Allows the building of shared libraries into frameworks
+#
+# Arguments:
+# none
+#
+# Results:
+#
+# Adds the following arguments to configure:
+# --enable-framework=yes|no
+#
+# Sets the following vars:
+# FRAMEWORK_BUILD Value of 1 or 0
+#------------------------------------------------------------------------
+
+AC_DEFUN([SC_ENABLE_FRAMEWORK], [
+ if test "`uname -s`" = "Darwin" ; then
+ AC_MSG_CHECKING([how to package libraries])
+ AC_ARG_ENABLE(framework,
+ [ --enable-framework package shared libraries in MacOSX frameworks [--disable-framework]],
+ [enable_framework=$enableval], [enable_framework=no])
+ if test $enable_framework = yes; then
+ if test $SHARED_BUILD = 0; then
+ AC_MSG_WARN([Frameworks can only be built if --enable-shared is yes])
+ enable_framework=no
+ fi
+ if test $tcl_corefoundation = no; then
+ AC_MSG_WARN([Frameworks can only be used when CoreFoundation is available])
+ enable_framework=no
+ fi
+ fi
+ if test $enable_framework = yes; then
+ AC_MSG_RESULT([framework])
+ FRAMEWORK_BUILD=1
+ else
+ if test $SHARED_BUILD = 1; then
+ AC_MSG_RESULT([shared library])
+ else
+ AC_MSG_RESULT([static library])
+ fi
+ FRAMEWORK_BUILD=0
+ fi
+ fi
+])
+
+#------------------------------------------------------------------------
+# SC_ENABLE_THREADS --
+#
+# Specify if thread support should be enabled. TCL_THREADS is
+# checked so that if you are compiling an extension against a
+# threaded core, your extension must be compiled threaded as well.
+#
+# Arguments:
+# none
+#
+# Results:
+#
+# Adds the following arguments to configure:
+# --enable-threads
+#
+# Sets the following vars:
+# THREADS_LIBS Thread library(s)
+#
+# Defines the following vars:
+# TCL_THREADS
+# _REENTRANT
+# _THREAD_SAFE
+#
+#------------------------------------------------------------------------
+
+AC_DEFUN([SC_ENABLE_THREADS], [
+ AC_ARG_ENABLE(threads, [ --enable-threads build with threads],
+ [tcl_ok=$enableval], [tcl_ok=no])
+
+ if test "${TCL_THREADS}" = 1; then
+ tcl_threaded_core=1;
+ fi
+
+ if test "$tcl_ok" = "yes" -o "${TCL_THREADS}" = 1; then
+ TCL_THREADS=1
+ # USE_THREAD_ALLOC tells us to try the special thread-based
+ # allocator that significantly reduces lock contention
+ AC_DEFINE(USE_THREAD_ALLOC)
+ AC_DEFINE(_REENTRANT)
+ if test "`uname -s`" = "SunOS" ; then
+ AC_DEFINE(_POSIX_PTHREAD_SEMANTICS)
+ fi
+ AC_DEFINE(_THREAD_SAFE)
+ AC_CHECK_LIB(pthread,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
+ if test "$tcl_ok" = "no"; then
+ # Check a little harder for __pthread_mutex_init in the same
+ # library, as some systems hide it there until pthread.h is
+ # defined. We could alternatively do an AC_TRY_COMPILE with
+ # pthread.h, but that will work with libpthread really doesn't
+ # exist, like AIX 4.2. [Bug: 4359]
+ AC_CHECK_LIB(pthread, __pthread_mutex_init,
+ tcl_ok=yes, tcl_ok=no)
+ fi
+
+ if test "$tcl_ok" = "yes"; then
+ # The space is needed
+ THREADS_LIBS=" -lpthread"
+ else
+ AC_CHECK_LIB(pthreads, pthread_mutex_init,
+ tcl_ok=yes, tcl_ok=no)
+ if test "$tcl_ok" = "yes"; then
+ # The space is needed
+ THREADS_LIBS=" -lpthreads"
+ else
+ AC_CHECK_LIB(c, pthread_mutex_init,
+ tcl_ok=yes, tcl_ok=no)
+ if test "$tcl_ok" = "no"; then
+ AC_CHECK_LIB(c_r, pthread_mutex_init,
+ tcl_ok=yes, tcl_ok=no)
+ if test "$tcl_ok" = "yes"; then
+ # The space is needed
+ THREADS_LIBS=" -pthread"
+ else
+ TCL_THREADS=0
+ AC_MSG_WARN([Don't know how to find pthread lib on your system - you must disable thread support or edit the LIBS in the Makefile...])
+ fi
+ fi
+ fi
+ fi
+
+ # Does the pthread-implementation provide
+ # 'pthread_attr_setstacksize' ?
+
+ ac_saved_libs=$LIBS
+ LIBS="$LIBS $THREADS_LIBS"
+ AC_CHECK_FUNCS(pthread_attr_setstacksize)
+ AC_CHECK_FUNCS(pthread_atfork)
+ LIBS=$ac_saved_libs
+ else
+ TCL_THREADS=0
+ fi
+ # Do checking message here to not mess up interleaved configure output
+ AC_MSG_CHECKING([for building with threads])
+ if test "${TCL_THREADS}" = 1; then
+ AC_DEFINE(TCL_THREADS, 1, [Are we building with threads enabled?])
+ if test "${tcl_threaded_core}" = 1; then
+ AC_MSG_RESULT([yes (threaded core)])
+ else
+ AC_MSG_RESULT([yes])
+ fi
+ else
+ AC_MSG_RESULT([no (default)])
+ fi
+
+ AC_SUBST(TCL_THREADS)
+])
+
+#------------------------------------------------------------------------
+# SC_ENABLE_SYMBOLS --
+#
+# Specify if debugging symbols should be used.
+# Memory (TCL_MEM_DEBUG) and compile (TCL_COMPILE_DEBUG) debugging
+# can also be enabled.
+#
+# Arguments:
+# none
+#
+# Requires the following vars to be set in the Makefile:
+# CFLAGS_DEBUG
+# CFLAGS_OPTIMIZE
+# LDFLAGS_DEBUG
+# LDFLAGS_OPTIMIZE
+#
+# Results:
+#
+# Adds the following arguments to configure:
+# --enable-symbols
+#
+# Defines the following vars:
+# CFLAGS_DEFAULT Sets to $(CFLAGS_DEBUG) if true
+# Sets to $(CFLAGS_OPTIMIZE) if false
+# LDFLAGS_DEFAULT Sets to $(LDFLAGS_DEBUG) if true
+# Sets to $(LDFLAGS_OPTIMIZE) if false
+# DBGX Debug library extension
+#
+#------------------------------------------------------------------------
+
+AC_DEFUN([SC_ENABLE_SYMBOLS], [
+ AC_MSG_CHECKING([for build with symbols])
+ AC_ARG_ENABLE(symbols, [ --enable-symbols build with debugging symbols [--disable-symbols]], [tcl_ok=$enableval], [tcl_ok=no])
+# FIXME: Currently, LDFLAGS_DEFAULT is not used, it should work like CFLAGS_DEFAULT.
+ if test "$tcl_ok" = "no"; then
+ CFLAGS_DEFAULT='$(CFLAGS_OPTIMIZE)'
+ LDFLAGS_DEFAULT='$(LDFLAGS_OPTIMIZE)'
+ DBGX=""
+ AC_MSG_RESULT([no])
+ else
+ CFLAGS_DEFAULT='$(CFLAGS_DEBUG)'
+ LDFLAGS_DEFAULT='$(LDFLAGS_DEBUG)'
+ DBGX=g
+ if test "$tcl_ok" = "yes"; then
+ AC_MSG_RESULT([yes (standard debugging)])
+ fi
+ fi
+ AC_SUBST(CFLAGS_DEFAULT)
+ AC_SUBST(LDFLAGS_DEFAULT)
+
+ if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then
+ AC_DEFINE(TCL_MEM_DEBUG)
+ fi
+
+ if test "$tcl_ok" = "compile" -o "$tcl_ok" = "all"; then
+ AC_DEFINE(TCL_COMPILE_DEBUG)
+ AC_DEFINE(TCL_COMPILE_STATS)
+ fi
+
+ if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then
+ if test "$tcl_ok" = "all"; then
+ AC_MSG_RESULT([enabled symbols mem compile debugging])
+ else
+ AC_MSG_RESULT([enabled $tcl_ok debugging])
+ fi
+ fi
+])
+
+#------------------------------------------------------------------------
+# SC_ENABLE_LANGINFO --
+#
+# Allows use of modern nl_langinfo check for better l10n.
+# This is only relevant for Unix.
+#
+# Arguments:
+# none
+#
+# Results:
+#
+# Adds the following arguments to configure:
+# --enable-langinfo=yes|no (default is yes)
+#
+# Defines the following vars:
+# HAVE_LANGINFO Triggers use of nl_langinfo if defined.
+#
+#------------------------------------------------------------------------
+
+AC_DEFUN([SC_ENABLE_LANGINFO], [
+ AC_ARG_ENABLE(langinfo,
+ [ --enable-langinfo use nl_langinfo if possible to determine
+ encoding at startup, otherwise use old heuristic],
+ [langinfo_ok=$enableval], [langinfo_ok=yes])
+
+ HAVE_LANGINFO=0
+ if test "$langinfo_ok" = "yes"; then
+ AC_CHECK_HEADER(langinfo.h,[langinfo_ok=yes],[langinfo_ok=no])
+ fi
+ AC_MSG_CHECKING([whether to use nl_langinfo])
+ if test "$langinfo_ok" = "yes"; then
+ AC_CACHE_VAL(tcl_cv_langinfo_h, [
+ AC_TRY_COMPILE([#include <langinfo.h>], [nl_langinfo(CODESET);],
+ [tcl_cv_langinfo_h=yes],[tcl_cv_langinfo_h=no])])
+ AC_MSG_RESULT([$tcl_cv_langinfo_h])
+ if test $tcl_cv_langinfo_h = yes; then
+ AC_DEFINE(HAVE_LANGINFO)
+ fi
+ else
+ AC_MSG_RESULT([$langinfo_ok])
+ fi
+])
+
+#--------------------------------------------------------------------
+# SC_CONFIG_MANPAGES
+#
+# Decide whether to use symlinks for linking the manpages,
+# whether to compress the manpages after installation, and
+# whether to add a package name suffix to the installed
+# manpages to avoidfile name clashes.
+# If compression is enabled also find out what file name suffix
+# the given compression program is using.
+#
+# Arguments:
+# none
+#
+# Results:
+#
+# Adds the following arguments to configure:
+# --enable-man-symlinks
+# --enable-man-compression=PROG
+# --enable-man-suffix[=STRING]
+#
+# Defines the following variable:
+#
+# MAN_FLAGS - The apropriate flags for installManPage
+# according to the user's selection.
+#
+#--------------------------------------------------------------------
+
+AC_DEFUN([SC_CONFIG_MANPAGES], [
+ AC_MSG_CHECKING([whether to use symlinks for manpages])
+ AC_ARG_ENABLE(man-symlinks,
+ [ --enable-man-symlinks use symlinks for the manpages],
+ test "$enableval" != "no" && MAN_FLAGS="$MAN_FLAGS --symlinks",
+ enableval="no")
+ AC_MSG_RESULT([$enableval])
+
+ AC_MSG_CHECKING([whether to compress the manpages])
+ AC_ARG_ENABLE(man-compression,
+ [ --enable-man-compression=PROG
+ compress the manpages with PROG],
+ [case $enableval in
+ yes) AC_MSG_ERROR([missing argument to --enable-man-compression]);;
+ no) ;;
+ *) MAN_FLAGS="$MAN_FLAGS --compress $enableval";;
+ esac],
+ enableval="no")
+ AC_MSG_RESULT([$enableval])
+ if test "$enableval" != "no"; then
+ AC_MSG_CHECKING([for compressed file suffix])
+ touch TeST
+ $enableval TeST
+ Z=`ls TeST* | sed 's/^....//'`
+ rm -f TeST*
+ MAN_FLAGS="$MAN_FLAGS --extension $Z"
+ AC_MSG_RESULT([$Z])
+ fi
+
+ AC_MSG_CHECKING([whether to add a package name suffix for the manpages])
+ AC_ARG_ENABLE(man-suffix,
+ [ --enable-man-suffix=STRING
+ use STRING as a suffix to manpage file names
+ (default: $1)],
+ [case $enableval in
+ yes) enableval="$1" MAN_FLAGS="$MAN_FLAGS --suffix $enableval";;
+ no) ;;
+ *) MAN_FLAGS="$MAN_FLAGS --suffix $enableval";;
+ esac],
+ enableval="no")
+ AC_MSG_RESULT([$enableval])
+
+ AC_SUBST(MAN_FLAGS)
+])
+
+#--------------------------------------------------------------------
+# SC_CONFIG_SYSTEM
+#
+# Determine what the system is (some things cannot be easily checked
+# on a feature-driven basis, alas). This can usually be done via the
+# "uname" command, but there are a few systems, like Next, where
+# this doesn't work.
+#
+# Arguments:
+# none
+#
+# Results:
+# Defines the following var:
+#
+# system - System/platform/version identification code.
+#
+#--------------------------------------------------------------------
+
+AC_DEFUN([SC_CONFIG_SYSTEM], [
+ AC_CACHE_CHECK([system version], tcl_cv_sys_version, [
+ if test -f /usr/lib/NextStep/software_version; then
+ tcl_cv_sys_version=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
+ else
+ tcl_cv_sys_version=`uname -s`-`uname -r`
+ if test "$?" -ne 0 ; then
+ AC_MSG_WARN([can't find uname command])
+ tcl_cv_sys_version=unknown
+ else
+ # Special check for weird MP-RAS system (uname returns weird
+ # results, and the version is kept in special file).
+
+ if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
+ tcl_cv_sys_version=MP-RAS-`awk '{print $[3]}' /etc/.relid`
+ fi
+ if test "`uname -s`" = "AIX" ; then
+ tcl_cv_sys_version=AIX-`uname -v`.`uname -r`
+ fi
+ fi
+ fi
+ ])
+ system=$tcl_cv_sys_version
+])
+
+#--------------------------------------------------------------------
+# SC_CONFIG_CFLAGS
+#
+# Try to determine the proper flags to pass to the compiler
+# for building shared libraries and other such nonsense.
+#
+# Arguments:
+# none
+#
+# Results:
+#
+# Defines and substitutes the following vars:
+#
+# DL_OBJS - Name of the object file that implements dynamic
+# loading for Tcl on this system.
+# DL_LIBS - Library file(s) to include in tclsh and other base
+# applications in order for the "load" command to work.
+# LDFLAGS - Flags to pass to the compiler when linking object
+# files into an executable application binary such
+# as tclsh.
+# LD_SEARCH_FLAGS-Flags to pass to ld, such as "-R /usr/local/tcl/lib",
+# that tell the run-time dynamic linker where to look
+# for shared libraries such as libtcl.so. Depends on
+# the variable LIB_RUNTIME_DIR in the Makefile. Could
+# be the same as CC_SEARCH_FLAGS if ${CC} is used to link.
+# CC_SEARCH_FLAGS-Flags to pass to ${CC}, such as "-Wl,-rpath,/usr/local/tcl/lib",
+# that tell the run-time dynamic linker where to look
+# for shared libraries such as libtcl.so. Depends on
+# the variable LIB_RUNTIME_DIR in the Makefile.
+# MAKE_LIB - Command to execute to build the a library;
+# differs when building shared or static.
+# MAKE_STUB_LIB -
+# Command to execute to build a stub library.
+# INSTALL_LIB - Command to execute to install a library;
+# differs when building shared or static.
+# INSTALL_STUB_LIB -
+# Command to execute to install a stub library.
+# STLIB_LD - Base command to use for combining object files
+# into a static library.
+# SHLIB_CFLAGS - Flags to pass to cc when compiling the components
+# of a shared library (may request position-independent
+# code, among other things).
+# SHLIB_LD - Base command to use for combining object files
+# into a shared library.
+# SHLIB_LD_LIBS - Dependent libraries for the linker to scan when
+# creating shared libraries. This symbol typically
+# goes at the end of the "ld" commands that build
+# shared libraries. The value of the symbol is
+# "${LIBS}" if all of the dependent libraries should
+# be specified when creating a shared library. If
+# dependent libraries should not be specified (as on
+# SunOS 4.x, where they cause the link to fail, or in
+# general if Tcl and Tk aren't themselves shared
+# libraries), then this symbol has an empty string
+# as its value.
+# SHLIB_SUFFIX - Suffix to use for the names of dynamically loadable
+# extensions. An empty string means we don't know how
+# to use shared libraries on this platform.
+# TCL_SHLIB_LD_EXTRAS - Additional element which are added to SHLIB_LD_LIBS
+# TK_SHLIB_LD_EXTRAS for the build of Tcl and Tk, but not recorded in the
+# tclConfig.sh, since they are only used for the build
+# of Tcl and Tk.
+# Examples: MacOS X records the library version and
+# compatibility version in the shared library. But
+# of course the Tcl version of this is only used for Tcl.
+# LIB_SUFFIX - Specifies everything that comes after the "libfoo"
+# in a static or shared library name, using the $VERSION variable
+# to put the version in the right place. This is used
+# by platforms that need non-standard library names.
+# Examples: ${VERSION}.so.1.1 on NetBSD, since it needs
+# to have a version after the .so, and ${VERSION}.a
+# on AIX, since a shared library needs to have
+# a .a extension whereas shared objects for loadable
+# extensions have a .so extension. Defaults to
+# ${VERSION}${SHLIB_SUFFIX}.
+# TCL_NEEDS_EXP_FILE -
+# 1 means that an export file is needed to link to a
+# shared library.
+# TCL_EXP_FILE - The name of the installed export / import file which
+# should be used to link to the Tcl shared library.
+# Empty if Tcl is unshared.
+# TCL_BUILD_EXP_FILE -
+# The name of the built export / import file which
+# should be used to link to the Tcl shared library.
+# Empty if Tcl is unshared.
+# CFLAGS_DEBUG -
+# Flags used when running the compiler in debug mode
+# CFLAGS_OPTIMIZE -
+# Flags used when running the compiler in optimize mode
+# CFLAGS - Additional CFLAGS added as necessary (usually 64-bit)
+#
+#--------------------------------------------------------------------
+
+AC_DEFUN([SC_CONFIG_CFLAGS], [
+
+ # Step 0.a: Enable 64 bit support?
+
+ AC_MSG_CHECKING([if 64bit support is requested])
+ AC_ARG_ENABLE(64bit,[ --enable-64bit enable 64bit support (where applicable)],
+ [do64bit=$enableval], [do64bit=no])
+ AC_MSG_RESULT([$do64bit])
+
+ # Step 0.b: Enable Solaris 64 bit VIS support?
+
+ AC_MSG_CHECKING([if 64bit Sparc VIS support is requested])
+ AC_ARG_ENABLE(64bit-vis,[ --enable-64bit-vis enable 64bit Sparc VIS support],
+ [do64bitVIS=$enableval], [do64bitVIS=no])
+ AC_MSG_RESULT([$do64bitVIS])
+
+ if test "$do64bitVIS" = "yes"; then
+ # Force 64bit on with VIS
+ do64bit=yes
+ fi
+
+ # Step 1: set the variable "system" to hold the name and version number
+ # for the system.
+
+ SC_CONFIG_SYSTEM
+
+ # Step 2: check for existence of -ldl library. This is needed because
+ # Linux can use either -ldl or -ldld for dynamic loading.
+
+ AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no)
+
+ # Require ranlib early so we can override it in special cases below.
+
+ AC_REQUIRE([AC_PROG_RANLIB])
+
+ # Step 3: set configuration options based on system name and version.
+
+ do64bit_ok=no
+ LDFLAGS_ORIG="$LDFLAGS"
+ TCL_EXPORT_FILE_SUFFIX=""
+ UNSHARED_LIB_SUFFIX=""
+ TCL_TRIM_DOTS='`echo ${VERSION} | tr -d .`'
+ ECHO_VERSION='`echo ${VERSION}`'
+ TCL_LIB_VERSIONS_OK=ok
+ CFLAGS_DEBUG=-g
+ CFLAGS_OPTIMIZE=-O
+ if test "$GCC" = "yes" ; then
+ CFLAGS_WARNING="-Wall -Wno-implicit-int -fno-strict-aliasing"
+ else
+ CFLAGS_WARNING=""
+ fi
+ TCL_NEEDS_EXP_FILE=0
+ TCL_BUILD_EXP_FILE=""
+ TCL_EXP_FILE=""
+dnl FIXME: Replace AC_CHECK_PROG with AC_CHECK_TOOL once cross compiling is fixed.
+dnl AC_CHECK_TOOL(AR, ar)
+ AC_CHECK_PROG(AR, ar, ar)
+ if test "${AR}" = "" ; then
+ AC_MSG_ERROR([Required archive tool 'ar' not found on PATH.])
+ fi
+ STLIB_LD='${AR} cr'
+ LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH"
+ PLAT_OBJS=""
+ PLAT_SRCS=""
+ case $system in
+ AIX-*)
+ if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes" ; then
+ # AIX requires the _r compiler when gcc isn't being used
+ case "${CC}" in
+ *_r)
+ # ok ...
+ ;;
+ *)
+ CC=${CC}_r
+ ;;
+ esac
+ AC_MSG_RESULT([Using $CC for compiling with threads])
+ fi
+ LIBS="$LIBS -lc"
+ SHLIB_CFLAGS=""
+ # Note: need the LIBS below, otherwise Tk won't find Tcl's
+ # symbols when dynamically loaded into tclsh.
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+
+ DL_OBJS="tclLoadDl.o"
+ LD_LIBRARY_PATH_VAR="LIBPATH"
+
+ # Check to enable 64-bit flags for compiler/linker on AIX 4+
+ if test "$do64bit" = "yes" -a "`uname -v`" -gt "3" ; then
+ if test "$GCC" = "yes" ; then
+ AC_MSG_WARN([64bit mode not supported with GCC on $system])
+ else
+ do64bit_ok=yes
+ CFLAGS="$CFLAGS -q64"
+ LDFLAGS="$LDFLAGS -q64"
+ RANLIB="${RANLIB} -X64"
+ AR="${AR} -X64"
+ SHLIB_LD_FLAGS="-b64"
+ fi
+ fi
+
+ if test "`uname -m`" = "ia64" ; then
+ # AIX-5 uses ELF style dynamic libraries on IA-64, but not PPC
+ SHLIB_LD="/usr/ccs/bin/ld -G -z text"
+ # AIX-5 has dl* in libc.so
+ DL_LIBS=""
+ if test "$GCC" = "yes" ; then
+ CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
+ else
+ CC_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}'
+ fi
+ LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
+ else
+ if test "$GCC" = "yes" ; then
+ SHLIB_LD="gcc -shared"
+ else
+ SHLIB_LD="/bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry"
+ fi
+ SHLIB_LD="${TCL_SRC_DIR}/unix/ldAix ${SHLIB_LD} ${SHLIB_LD_FLAGS}"
+ DL_LIBS="-ldl"
+ CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
+ TCL_NEEDS_EXP_FILE=1
+ TCL_EXPORT_FILE_SUFFIX='${VERSION}\$\{DBGX\}.exp'
+ fi
+
+ # AIX v<=4.1 has some different flags than 4.2+
+ if test "$system" = "AIX-4.1" -o "`uname -v`" -lt "4" ; then
+ LIBOBJS="$LIBOBJS tclLoadAix.o"
+ DL_LIBS="-lld"
+ fi
+
+ # On AIX <=v4 systems, libbsd.a has to be linked in to support
+ # non-blocking file IO. This library has to be linked in after
+ # the MATH_LIBS or it breaks the pow() function. The way to
+ # insure proper sequencing, is to add it to the tail of MATH_LIBS.
+ # This library also supplies gettimeofday.
+ #
+ # AIX does not have a timezone field in struct tm. When the AIX
+ # bsd library is used, the timezone global and the gettimeofday
+ # methods are to be avoided for timezone deduction instead, we
+ # deduce the timezone by comparing the localtime result on a
+ # known GMT value.
+
+ AC_CHECK_LIB(bsd, gettimeofday, libbsd=yes, libbsd=no)
+ if test $libbsd = yes; then
+ MATH_LIBS="$MATH_LIBS -lbsd"
+ AC_DEFINE(USE_DELTA_FOR_TZ)
+ fi
+ ;;
+ BeOS*)
+ SHLIB_CFLAGS="-fPIC"
+ SHLIB_LD="${CC} -nostart"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+
+ #-----------------------------------------------------------
+ # Check for inet_ntoa in -lbind, for BeOS (which also needs
+ # -lsocket, even if the network functions are in -lnet which
+ # is always linked to, for compatibility.
+ #-----------------------------------------------------------
+ AC_CHECK_LIB(bind, inet_ntoa, [LIBS="$LIBS -lbind -lsocket"])
+ ;;
+ BSD/OS-2.1*|BSD/OS-3*)
+ SHLIB_CFLAGS=""
+ SHLIB_LD="shlicc -r"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ CC_SEARCH_FLAGS=""
+ LD_SEARCH_FLAGS=""
+ ;;
+ BSD/OS-4.*)
+ SHLIB_CFLAGS="-export-dynamic -fPIC"
+ SHLIB_LD="cc -shared"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ LDFLAGS="$LDFLAGS -export-dynamic"
+ CC_SEARCH_FLAGS=""
+ LD_SEARCH_FLAGS=""
+ ;;
+ dgux*)
+ SHLIB_CFLAGS="-K PIC"
+ SHLIB_LD="cc -G"
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ CC_SEARCH_FLAGS=""
+ LD_SEARCH_FLAGS=""
+ ;;
+ HP-UX-*.11.*)
+ # Use updated header definitions where possible
+ AC_DEFINE(_XOPEN_SOURCE) # Use the XOPEN network library
+ AC_DEFINE(_XOPEN_SOURCE_EXTENDED) # Use the XOPEN network library
+ LIBS="$LIBS -lxnet" # Use the XOPEN network library
+
+ if test "`uname -m`" = "ia64" ; then
+ SHLIB_SUFFIX=".so"
+ else
+ SHLIB_SUFFIX=".sl"
+ fi
+ AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
+ if test "$tcl_ok" = yes; then
+ SHLIB_CFLAGS="+z"
+ SHLIB_LD="ld -b"
+ SHLIB_LD_LIBS='${LIBS}'
+ DL_OBJS="tclLoadShl.o"
+ DL_LIBS="-ldld"
+ LDFLAGS="$LDFLAGS -Wl,-E"
+ CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
+ LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
+ LD_LIBRARY_PATH_VAR="SHLIB_PATH"
+ fi
+ if test "$GCC" = "yes" ; then
+ SHLIB_LD="gcc -shared"
+ SHLIB_LD_LIBS='${LIBS}'
+ LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
+ fi
+
+ # Users may want PA-RISC 1.1/2.0 portable code - needs HP cc
+ #CFLAGS="$CFLAGS +DAportable"
+
+ # Check to enable 64-bit flags for compiler/linker
+ if test "$do64bit" = "yes" ; then
+ if test "$GCC" = "yes" ; then
+ hpux_arch=`${CC} -dumpmachine`
+ case $hpux_arch in
+ hppa64*)
+ # 64-bit gcc in use. Fix flags for GNU ld.
+ do64bit_ok=yes
+ SHLIB_LD="${CC} -shared"
+ SHLIB_LD_LIBS='${LIBS}'
+ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
+ ;;
+ *)
+ AC_MSG_WARN([64bit mode not supported with GCC on $system])
+ ;;
+ esac
+ else
+ do64bit_ok=yes
+ CFLAGS="$CFLAGS +DD64"
+ LDFLAGS="$LDFLAGS +DD64"
+ fi
+ fi
+ ;;
+ HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*)
+ SHLIB_SUFFIX=".sl"
+ AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
+ if test "$tcl_ok" = yes; then
+ SHLIB_CFLAGS="+z"
+ SHLIB_LD="ld -b"
+ SHLIB_LD_LIBS=""
+ DL_OBJS="tclLoadShl.o"
+ DL_LIBS="-ldld"
+ LDFLAGS="$LDFLAGS -Wl,-E"
+ CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
+ LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
+ LD_LIBRARY_PATH_VAR="SHLIB_PATH"
+ fi
+ ;;
+ IRIX-4.*)
+ SHLIB_CFLAGS="-G 0"
+ SHLIB_SUFFIX=".a"
+ SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
+ SHLIB_LD_LIBS='${LIBS}'
+ DL_OBJS="tclLoadAout.o"
+ DL_LIBS=""
+ LDFLAGS="$LDFLAGS -Wl,-D,08000000"
+ CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
+ SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a'
+ ;;
+ IRIX-5.*)
+ SHLIB_CFLAGS=""
+ SHLIB_LD="ld -shared -rdata_shared"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS=""
+ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
+ ;;
+ IRIX-6.*)
+ SHLIB_CFLAGS=""
+ SHLIB_LD="ld -n32 -shared -rdata_shared"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS=""
+ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
+ if test "$GCC" = "yes" ; then
+ CFLAGS="$CFLAGS -mabi=n32"
+ LDFLAGS="$LDFLAGS -mabi=n32"
+ else
+ case $system in
+ IRIX-6.3)
+ # Use to build 6.2 compatible binaries on 6.3.
+ CFLAGS="$CFLAGS -n32 -D_OLD_TERMIOS"
+ ;;
+ *)
+ CFLAGS="$CFLAGS -n32"
+ ;;
+ esac
+ LDFLAGS="$LDFLAGS -n32"
+ fi
+ ;;
+ IRIX64-6.*)
+ SHLIB_CFLAGS=""
+ SHLIB_LD="ld -n32 -shared -rdata_shared"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS=""
+ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
+
+ # Check to enable 64-bit flags for compiler/linker
+
+ if test "$do64bit" = "yes" ; then
+ if test "$GCC" = "yes" ; then
+ AC_MSG_WARN([64bit mode not supported by gcc])
+ else
+ do64bit_ok=yes
+ SHLIB_LD="ld -64 -shared -rdata_shared"
+ CFLAGS="$CFLAGS -64"
+ LDFLAGS="$LDFLAGS -64"
+ fi
+ fi
+ ;;
+ Linux*)
+ SHLIB_CFLAGS="-fPIC"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+
+ CFLAGS_OPTIMIZE=-O2
+ # egcs-2.91.66 on Redhat Linux 6.0 generates lots of warnings
+ # when you inline the string and math operations. Turn this off to
+ # get rid of the warnings.
+ #CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES"
+
+ if test "$have_dl" = yes; then
+ SHLIB_LD='${CC} -shared ${CFLAGS} ${LDFLAGS}'
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
+ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
+ else
+ AC_CHECK_HEADER(dld.h, [
+ SHLIB_LD="ld -shared"
+ DL_OBJS="tclLoadDld.o"
+ DL_LIBS="-ldld"
+ CC_SEARCH_FLAGS=""
+ LD_SEARCH_FLAGS=""])
+ fi
+ if test "`uname -m`" = "alpha" ; then
+ CFLAGS="$CFLAGS -mieee"
+ fi
+ if test $do64bit = yes; then
+ AC_CACHE_CHECK([if compiler accepts -m64 flag], tcl_cv_cc_m64, [
+ hold_cflags=$CFLAGS
+ CFLAGS="$CFLAGS -m64"
+ AC_TRY_LINK(,, tcl_cv_cc_m64=yes, tcl_cv_cc_m64=no)
+ CFLAGS=$hold_cflags])
+ if test $tcl_cv_cc_m64 = yes; then
+ CFLAGS="$CFLAGS -m64"
+ do64bit_ok=yes
+ fi
+ fi
+
+ # The combo of gcc + glibc has a bug related
+ # to inlining of functions like strtod(). The
+ # -fno-builtin flag should address this problem
+ # but it does not work. The -fno-inline flag
+ # is kind of overkill but it works.
+ # Disable inlining only when one of the
+ # files in compat/*.c is being linked in.
+ if test x"${LIBOBJS}" != x ; then
+ CFLAGS="$CFLAGS -fno-inline"
+ fi
+
+ # XIM peeking works under XFree86.
+ AC_DEFINE(PEEK_XCLOSEIM)
+
+ ;;
+ GNU*)
+ SHLIB_CFLAGS="-fPIC"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+
+ if test "$have_dl" = yes; then
+ SHLIB_LD="${CC} -shared"
+ DL_OBJS=""
+ DL_LIBS="-ldl"
+ LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
+ CC_SEARCH_FLAGS=""
+ LD_SEARCH_FLAGS=""
+ else
+ AC_CHECK_HEADER(dld.h, [
+ SHLIB_LD="ld -shared"
+ DL_OBJS=""
+ DL_LIBS="-ldld"
+ CC_SEARCH_FLAGS=""
+ LD_SEARCH_FLAGS=""])
+ fi
+ if test "`uname -m`" = "alpha" ; then
+ CFLAGS="$CFLAGS -mieee"
+ fi
+ ;;
+ Lynx*)
+ SHLIB_CFLAGS="-fPIC"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ CFLAGS_OPTIMIZE=-02
+ SHLIB_LD="${CC} -shared "
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-mshared -ldl"
+ LD_FLAGS="-Wl,--export-dynamic"
+ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ ;;
+ MP-RAS-02*)
+ SHLIB_CFLAGS="-K PIC"
+ SHLIB_LD="cc -G"
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ CC_SEARCH_FLAGS=""
+ LD_SEARCH_FLAGS=""
+ ;;
+ MP-RAS-*)
+ SHLIB_CFLAGS="-K PIC"
+ SHLIB_LD="cc -G"
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ LDFLAGS="$LDFLAGS -Wl,-Bexport"
+ CC_SEARCH_FLAGS=""
+ LD_SEARCH_FLAGS=""
+ ;;
+ NetBSD-*|FreeBSD-[[1-2]].*)
+ # Not available on all versions: check for include file.
+ AC_CHECK_HEADER(dlfcn.h, [
+ # NetBSD/SPARC needs -fPIC, -fpic will not do.
+ SHLIB_CFLAGS="-fPIC"
+ SHLIB_LD="ld -Bshareable -x"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS=""
+ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
+ AC_CACHE_CHECK([for ELF], tcl_cv_ld_elf, [
+ AC_EGREP_CPP(yes, [
+#ifdef __ELF__
+ yes
+#endif
+ ], tcl_cv_ld_elf=yes, tcl_cv_ld_elf=no)])
+ if test $tcl_cv_ld_elf = yes; then
+ SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so'
+ else
+ SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'
+ fi
+ ], [
+ SHLIB_CFLAGS=""
+ SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".a"
+ DL_OBJS="tclLoadAout.o"
+ DL_LIBS=""
+ CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
+ SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
+ ])
+
+ # FreeBSD doesn't handle version numbers with dots.
+
+ UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
+ TCL_LIB_VERSIONS_OK=nodots
+ ;;
+ OpenBSD-*)
+ case `arch -s` in
+ m88k|vax)
+ SHLIB_CFLAGS=""
+ SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".a"
+ DL_OBJS="tclLoadAout.o"
+ DL_LIBS=""
+ LDFLAGS=""
+ CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
+ SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
+ ;;
+ *)
+ # OpenBSD/SPARC[64] needs -fPIC, -fpic will not do.
+ case `machine` in
+ sparc|sparc64)
+ SHLIB_CFLAGS="-fPIC";;
+ *)
+ SHLIB_CFLAGS="-fpic";;
+ esac
+ SHLIB_LD="${CC} -shared ${SHLIB_CFLAGS}"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS=""
+ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
+ SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'
+ AC_CACHE_CHECK([for ELF], tcl_cv_ld_elf, [
+ AC_EGREP_CPP(yes, [
+#ifdef __ELF__
+ yes
+#endif
+ ], tcl_cv_ld_elf=yes, tcl_cv_ld_elf=no)])
+ if test $tcl_cv_ld_elf = yes; then
+ LDFLAGS=-Wl,-export-dynamic
+ else
+ LDFLAGS=""
+ fi
+ ;;
+ esac
+
+ # OpenBSD doesn't do version numbers with dots.
+ UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
+ TCL_LIB_VERSIONS_OK=nodots
+ ;;
+ FreeBSD-*)
+ # FreeBSD 3.* and greater have ELF.
+ SHLIB_CFLAGS="-fPIC"
+ SHLIB_LD="ld -Bshareable -x"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS=""
+ LDFLAGS="$LDFLAGS -export-dynamic"
+ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
+ if test "${TCL_THREADS}" = "1" ; then
+ # The -pthread needs to go in the CFLAGS, not LIBS
+ LIBS=`echo $LIBS | sed s/-pthread//`
+ CFLAGS="$CFLAGS -pthread"
+ LDFLAGS="$LDFLAGS -pthread"
+ fi
+ case $system in
+ FreeBSD-3.*)
+ # FreeBSD-3 doesn't handle version numbers with dots.
+ UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
+ SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so'
+ TCL_LIB_VERSIONS_OK=nodots
+ ;;
+ esac
+ ;;
+ Darwin-*)
+ CFLAGS_OPTIMIZE="-Os"
+ SHLIB_CFLAGS="-fno-common"
+ # To avoid discrepancies between what headers configure sees during
+ # preprocessing tests and compiling tests, move any -isysroot and
+ # -mmacosx-version-min flags from CFLAGS to CPPFLAGS:
+ CPPFLAGS="${CPPFLAGS} `echo " ${CFLAGS}" | \
+ awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \
+ if ([$]i~/^(isysroot|mmacosx-version-min)/) print "-"[$]i}'`"
+ CFLAGS="`echo " ${CFLAGS}" | \
+ awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \
+ if (!([$]i~/^(isysroot|mmacosx-version-min)/)) print "-"[$]i}'`"
+ if test $do64bit = yes; then
+ case `arch` in
+ ppc)
+ AC_CACHE_CHECK([if compiler accepts -arch ppc64 flag],
+ tcl_cv_cc_arch_ppc64, [
+ hold_cflags=$CFLAGS
+ CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
+ AC_TRY_LINK(,, tcl_cv_cc_arch_ppc64=yes,
+ tcl_cv_cc_arch_ppc64=no)
+ CFLAGS=$hold_cflags])
+ if test $tcl_cv_cc_arch_ppc64 = yes; then
+ CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
+ do64bit_ok=yes
+ fi;;
+ i386)
+ AC_CACHE_CHECK([if compiler accepts -arch x86_64 flag],
+ tcl_cv_cc_arch_x86_64, [
+ hold_cflags=$CFLAGS
+ CFLAGS="$CFLAGS -arch x86_64"
+ AC_TRY_LINK(,, tcl_cv_cc_arch_x86_64=yes,
+ tcl_cv_cc_arch_x86_64=no)
+ CFLAGS=$hold_cflags])
+ if test $tcl_cv_cc_arch_x86_64 = yes; then
+ CFLAGS="$CFLAGS -arch x86_64"
+ do64bit_ok=yes
+ fi;;
+ *)
+ AC_MSG_WARN([Don't know how enable 64-bit on architecture `arch`]);;
+ esac
+ else
+ # Check for combined 32-bit and 64-bit fat build
+ echo "$CFLAGS " | grep -E -q -- '-arch (ppc64|x86_64) ' && \
+ echo "$CFLAGS " | grep -E -q -- '-arch (ppc|i386) ' && \
+ fat_32_64=yes
+ fi
+ SHLIB_LD='${CC} -dynamiclib ${CFLAGS} ${LDFLAGS}'
+ AC_CACHE_CHECK([if ld accepts -single_module flag], tcl_cv_ld_single_module, [
+ hold_ldflags=$LDFLAGS
+ LDFLAGS="$LDFLAGS -dynamiclib -Wl,-single_module"
+ AC_TRY_LINK(, [int i;], tcl_cv_ld_single_module=yes, tcl_cv_ld_single_module=no)
+ LDFLAGS=$hold_ldflags])
+ if test $tcl_cv_ld_single_module = yes; then
+ SHLIB_LD="${SHLIB_LD} -Wl,-single_module"
+ fi
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".dylib"
+ DL_OBJS="tclLoadDyld.o"
+ DL_LIBS=""
+ # Don't use -prebind when building for Mac OS X 10.4 or later only:
+ test "`echo "${MACOSX_DEPLOYMENT_TARGET}" | awk -F '10\\.' '{print int([$]2)}'`" -lt 4 -a \
+ "`echo "${CPPFLAGS}" | awk -F '-mmacosx-version-min=10\\.' '{print int([$]2)}'`" -lt 4 && \
+ LDFLAGS="$LDFLAGS -prebind"
+ LDFLAGS="$LDFLAGS -headerpad_max_install_names"
+ AC_CACHE_CHECK([if ld accepts -search_paths_first flag], tcl_cv_ld_search_paths_first, [
+ hold_ldflags=$LDFLAGS
+ LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
+ AC_TRY_LINK(, [int i;], tcl_cv_ld_search_paths_first=yes, tcl_cv_ld_search_paths_first=no)
+ LDFLAGS=$hold_ldflags])
+ if test $tcl_cv_ld_search_paths_first = yes; then
+ LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
+ fi
+ CC_SEARCH_FLAGS=""
+ LD_SEARCH_FLAGS=""
+ LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH"
+ PLAT_OBJS=\$\(MAC\_OSX_OBJS\)
+ PLAT_SRCS=\$\(MAC\_OSX_SRCS\)
+ AC_MSG_CHECKING([whether to use CoreFoundation])
+ AC_ARG_ENABLE(corefoundation, [ --enable-corefoundation use CoreFoundation API [--enable-corefoundation]],
+ [tcl_corefoundation=$enableval], [tcl_corefoundation=yes])
+ AC_MSG_RESULT([$tcl_corefoundation])
+ if test $tcl_corefoundation = yes; then
+ AC_CACHE_CHECK([for CoreFoundation.framework], tcl_cv_lib_corefoundation, [
+ hold_libs=$LIBS
+ if test "$fat_32_64" = yes; then for v in CFLAGS CPPFLAGS LDFLAGS; do
+ # On Tiger there is no 64-bit CF, so remove 64-bit archs
+ # from CFLAGS et al. while testing for presence of CF.
+ # 64-bit CF is disabled in tclUnixPort.h if necessary.
+ eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc64 / /g" -e "s/-arch x86_64 / /g"`"'
+ done; fi
+ LIBS="$LIBS -framework CoreFoundation"
+ AC_TRY_LINK([#include <CoreFoundation/CoreFoundation.h>],
+ [CFBundleRef b = CFBundleGetMainBundle();],
+ tcl_cv_lib_corefoundation=yes, tcl_cv_lib_corefoundation=no)
+ if test "$fat_32_64" = yes; then for v in CFLAGS CPPFLAGS LDFLAGS; do
+ eval $v'="$hold_'$v'"'
+ done; fi; LIBS=$hold_libs])
+ if test $tcl_cv_lib_corefoundation = yes; then
+ LIBS="$LIBS -framework CoreFoundation"
+ AC_DEFINE(HAVE_COREFOUNDATION)
+ else
+ tcl_corefoundation=no
+ fi
+ if test "$fat_32_64" = yes -a $tcl_corefoundation = yes; then
+ AC_CACHE_CHECK([for 64-bit CoreFoundation], tcl_cv_lib_corefoundation_64, [
+ for v in CFLAGS CPPFLAGS LDFLAGS; do
+ eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc / /g" -e "s/-arch i386 / /g"`"'
+ done
+ AC_TRY_LINK([#include <CoreFoundation/CoreFoundation.h>],
+ [CFBundleRef b = CFBundleGetMainBundle();],
+ tcl_cv_lib_corefoundation_64=yes, tcl_cv_lib_corefoundation_64=no)
+ for v in CFLAGS CPPFLAGS LDFLAGS; do
+ eval $v'="$hold_'$v'"'
+ done])
+ if test $tcl_cv_lib_corefoundation_64 = no; then
+ AC_DEFINE(NO_COREFOUNDATION_64)
+ fi
+ fi
+ fi
+ AC_DEFINE(MAC_OSX_TCL)
+ ;;
+ NEXTSTEP-*)
+ SHLIB_CFLAGS=""
+ SHLIB_LD="cc -nostdlib -r"
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadNext.o"
+ DL_LIBS=""
+ CC_SEARCH_FLAGS=""
+ LD_SEARCH_FLAGS=""
+ ;;
+ OS/390-*)
+ CFLAGS_OPTIMIZE="" # Optimizer is buggy
+ AC_DEFINE(_OE_SOCKETS) # needed in sys/socket.h
+ ;;
+ OSF1-1.0|OSF1-1.1|OSF1-1.2)
+ # OSF/1 1.[012] from OSF, and derivatives, including Paragon OSF/1
+ SHLIB_CFLAGS=""
+ # Hack: make package name same as library name
+ SHLIB_LD='ld -R -export $@:'
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadOSF.o"
+ DL_LIBS=""
+ CC_SEARCH_FLAGS=""
+ LD_SEARCH_FLAGS=""
+ ;;
+ OSF1-1.*)
+ # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2
+ SHLIB_CFLAGS="-fPIC"
+ if test "$SHARED_BUILD" = "1" ; then
+ SHLIB_LD="ld -shared"
+ else
+ SHLIB_LD="ld -non_shared"
+ fi
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS=""
+ CC_SEARCH_FLAGS=""
+ LD_SEARCH_FLAGS=""
+ ;;
+ OSF1-V*)
+ # Digital OSF/1
+ SHLIB_CFLAGS=""
+ if test "$SHARED_BUILD" = "1" ; then
+ SHLIB_LD='ld -shared -expect_unresolved "*"'
+ else
+ SHLIB_LD='ld -non_shared -expect_unresolved "*"'
+ fi
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS=""
+ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
+ if test "$GCC" = "yes" ; then
+ CFLAGS="$CFLAGS -mieee"
+ else
+ CFLAGS="$CFLAGS -DHAVE_TZSET -std1 -ieee"
+ fi
+ # see pthread_intro(3) for pthread support on osf1, k.furukawa
+ if test "${TCL_THREADS}" = "1" ; then
+ CFLAGS="$CFLAGS -DHAVE_PTHREAD_ATTR_SETSTACKSIZE"
+ CFLAGS="$CFLAGS -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64"
+ LIBS=`echo $LIBS | sed s/-lpthreads//`
+ if test "$GCC" = "yes" ; then
+ LIBS="$LIBS -lpthread -lmach -lexc"
+ else
+ CFLAGS="$CFLAGS -pthread"
+ LDFLAGS="$LDFLAGS -pthread"
+ fi
+ fi
+
+ ;;
+ QNX-6*)
+ # QNX RTP
+ # This may work for all QNX, but it was only reported for v6.
+ SHLIB_CFLAGS="-fPIC"
+ SHLIB_LD="ld -Bshareable -x"
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ # dlopen is in -lc on QNX
+ DL_LIBS=""
+ CC_SEARCH_FLAGS=""
+ LD_SEARCH_FLAGS=""
+ ;;
+ RISCos-*)
+ SHLIB_CFLAGS="-G 0"
+ SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".a"
+ DL_OBJS="tclLoadAout.o"
+ DL_LIBS=""
+ LDFLAGS="$LDFLAGS -Wl,-D,08000000"
+ CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
+ ;;
+ SCO_SV-3.2*)
+ # Note, dlopen is available only on SCO 3.2.5 and greater. However,
+ # this test works, since "uname -s" was non-standard in 3.2.4 and
+ # below.
+ if test "$GCC" = "yes" ; then
+ SHLIB_CFLAGS="-fPIC -melf"
+ LDFLAGS="$LDFLAGS -melf -Wl,-Bexport"
+ else
+ SHLIB_CFLAGS="-Kpic -belf"
+ LDFLAGS="$LDFLAGS -belf -Wl,-Bexport"
+ fi
+ SHLIB_LD="ld -G"
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS=""
+ CC_SEARCH_FLAGS=""
+ LD_SEARCH_FLAGS=""
+ ;;
+ SINIX*5.4*)
+ SHLIB_CFLAGS="-K PIC"
+ SHLIB_LD="cc -G"
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ CC_SEARCH_FLAGS=""
+ LD_SEARCH_FLAGS=""
+ ;;
+ SunOS-4*)
+ SHLIB_CFLAGS="-PIC"
+ SHLIB_LD="ld"
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
+
+ # SunOS can't handle version numbers with dots in them in library
+ # specs, like -ltcl7.5, so use -ltcl75 instead. Also, it
+ # requires an extra version number at the end of .so file names.
+ # So, the library has to have a name like libtcl75.so.1.0
+
+ SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'
+ UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
+ TCL_LIB_VERSIONS_OK=nodots
+ ;;
+ SunOS-5.[[0-6]])
+ # Careful to not let 5.10+ fall into this case
+
+ # Note: If _REENTRANT isn't defined, then Solaris
+ # won't define thread-safe library routines.
+
+ AC_DEFINE(_REENTRANT)
+ AC_DEFINE(_POSIX_PTHREAD_SEMANTICS)
+
+ SHLIB_CFLAGS="-KPIC"
+
+ # Note: need the LIBS below, otherwise Tk won't find Tcl's
+ # symbols when dynamically loaded into tclsh.
+
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ if test "$GCC" = "yes" ; then
+ SHLIB_LD="$CC -shared"
+ CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
+ else
+ SHLIB_LD="/usr/ccs/bin/ld -G -z text"
+ CC_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
+ fi
+ ;;
+ SunOS-5*)
+ # Note: If _REENTRANT isn't defined, then Solaris
+ # won't define thread-safe library routines.
+
+ AC_DEFINE(_REENTRANT)
+ AC_DEFINE(_POSIX_PTHREAD_SEMANTICS)
+
+ SHLIB_CFLAGS="-KPIC"
+
+ # Check to enable 64-bit flags for compiler/linker
+ if test "$do64bit" = "yes" ; then
+ arch=`isainfo`
+ if test "$arch" = "sparcv9 sparc" ; then
+ if test "$GCC" = "yes" ; then
+ if test "`gcc -dumpversion | awk -F. '{print [$]1}'`" -lt "3" ; then
+ AC_MSG_WARN([64bit mode not supported with GCC < 3.2 on $system])
+ else
+ do64bit_ok=yes
+ CFLAGS="$CFLAGS -m64 -mcpu=v9"
+ LDFLAGS="$LDFLAGS -m64 -mcpu=v9"
+ SHLIB_CFLAGS="-fPIC"
+ fi
+ else
+ do64bit_ok=yes
+ if test "$do64bitVIS" = "yes" ; then
+ CFLAGS="$CFLAGS -xarch=v9a"
+ LDFLAGS="$LDFLAGS -xarch=v9a"
+ else
+ CFLAGS="$CFLAGS -xarch=v9"
+ LDFLAGS="$LDFLAGS -xarch=v9"
+ fi
+ # Solaris 64 uses this as well
+ #LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH_64"
+ fi
+ elif test "$arch" = "amd64 i386" ; then
+ if test "$GCC" = "yes" ; then
+ AC_MSG_WARN([64bit mode not supported with GCC on $system])
+ else
+ do64bit_ok=yes
+ CFLAGS="$CFLAGS -xarch=amd64"
+ LDFLAGS="$LDFLAGS -xarch=amd64"
+ fi
+ else
+ AC_MSG_WARN([64bit mode not supported for $arch])
+ fi
+ fi
+
+ # Note: need the LIBS below, otherwise Tk won't find Tcl's
+ # symbols when dynamically loaded into tclsh.
+
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ if test "$GCC" = "yes" ; then
+ SHLIB_LD="$CC -shared"
+ CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
+ if test "$do64bit_ok" = "yes" ; then
+ # We need to specify -static-libgcc or we need to
+ # add the path to the sparv9 libgcc.
+ SHLIB_LD="$SHLIB_LD -m64 -mcpu=v9 -static-libgcc"
+ # for finding sparcv9 libgcc, get the regular libgcc
+ # path, remove so name and append 'sparcv9'
+ #v9gcclibdir="`gcc -print-file-name=libgcc_s.so` | ..."
+ #CC_SEARCH_FLAGS="${CC_SEARCH_FLAGS},-R,$v9gcclibdir"
+ fi
+ else
+ case $system in
+ SunOS-5.[[1-9]][[0-9]]*)
+ SHLIB_LD='${CC} -G -z text';;
+ *)
+ SHLIB_LD="/usr/ccs/bin/ld -G -z text";;
+ esac
+ CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
+ fi
+ ;;
+ ULTRIX-4.*)
+ SHLIB_CFLAGS="-G 0"
+ SHLIB_SUFFIX=".a"
+ SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
+ SHLIB_LD_LIBS='${LIBS}'
+ DL_OBJS="tclLoadAout.o"
+ DL_LIBS=""
+ LDFLAGS="$LDFLAGS -Wl,-D,08000000"
+ CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
+ if test "$GCC" != "yes" ; then
+ CFLAGS="$CFLAGS -DHAVE_TZSET -std1"
+ fi
+ ;;
+ UNIX_SV* | UnixWare-5*)
+ SHLIB_CFLAGS="-KPIC"
+ SHLIB_LD="cc -G"
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers
+ # that don't grok the -Bexport option. Test that it does.
+ AC_CACHE_CHECK([for ld accepts -Bexport flag], tcl_cv_ld_Bexport, [
+ hold_ldflags=$LDFLAGS
+ LDFLAGS="$LDFLAGS -Wl,-Bexport"
+ AC_TRY_LINK(, [int i;], tcl_cv_ld_Bexport=yes, tcl_cv_ld_Bexport=no)
+ LDFLAGS=$hold_ldflags])
+ if test $tcl_cv_ld_Bexport = yes; then
+ LDFLAGS="$LDFLAGS -Wl,-Bexport"
+ fi
+ CC_SEARCH_FLAGS=""
+ LD_SEARCH_FLAGS=""
+ ;;
+ esac
+
+ if test "$do64bit" = "yes" -a "$do64bit_ok" = "no" ; then
+ AC_MSG_WARN([64bit support being disabled -- don't know magic for this platform])
+ fi
+
+dnl # Add any CPPFLAGS set in the environment to our CFLAGS, but delay doing so
+dnl # until the end of configure, as configure's compile and link tests use
+dnl # both CPPFLAGS and CFLAGS (unlike our compile and link) but configure's
+dnl # preprocessing tests use only CPPFLAGS.
+ SC_CONFIG_COMMANDS_PRE([CFLAGS="${CFLAGS} ${CPPFLAGS}"; CPPFLAGS=""])
+
+ # Step 4: If pseudo-static linking is in use (see K. B. Kenny, "Dynamic
+ # Loading for Tcl -- What Became of It?". Proc. 2nd Tcl/Tk Workshop,
+ # New Orleans, LA, Computerized Processes Unlimited, 1994), then we need
+ # to determine which of several header files defines the a.out file
+ # format (a.out.h, sys/exec.h, or sys/exec_aout.h). At present, we
+ # support only a file format that is more or less version-7-compatible.
+ # In particular,
+ # - a.out files must begin with `struct exec'.
+ # - the N_TXTOFF on the `struct exec' must compute the seek address
+ # of the text segment
+ # - The `struct exec' must contain a_magic, a_text, a_data, a_bss
+ # and a_entry fields.
+ # The following compilation should succeed if and only if either sys/exec.h
+ # or a.out.h is usable for the purpose.
+ #
+ # Note that the modified COFF format used on MIPS Ultrix 4.x is usable; the
+ # `struct exec' includes a second header that contains information that
+ # duplicates the v7 fields that are needed.
+
+ if test "x$DL_OBJS" = "xtclLoadAout.o" ; then
+ AC_CACHE_CHECK([sys/exec.h], tcl_cv_sysexec_h, [
+ AC_TRY_COMPILE([#include <sys/exec.h>],[
+ struct exec foo;
+ unsigned long seek;
+ int flag;
+#if defined(__mips) || defined(mips)
+ seek = N_TXTOFF (foo.ex_f, foo.ex_o);
+#else
+ seek = N_TXTOFF (foo);
+#endif
+ flag = (foo.a_magic == OMAGIC);
+ return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
+ ], tcl_cv_sysexec_h=usable, tcl_cv_sysexec_h=unusable)])
+ if test $tcl_cv_sysexec_h = usable; then
+ AC_DEFINE(USE_SYS_EXEC_H)
+ else
+ AC_CACHE_CHECK([a.out.h], tcl_cv_aout_h, [
+ AC_TRY_COMPILE([#include <a.out.h>],[
+ struct exec foo;
+ unsigned long seek;
+ int flag;
+#if defined(__mips) || defined(mips)
+ seek = N_TXTOFF (foo.ex_f, foo.ex_o);
+#else
+ seek = N_TXTOFF (foo);
+#endif
+ flag = (foo.a_magic == OMAGIC);
+ return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
+ ], tcl_cv_aout_h=usable, tcl_cv_aout_h=unusable)])
+ if test $tcl_cv_aout_h = usable; then
+ AC_DEFINE(USE_A_OUT_H)
+ else
+ AC_CACHE_CHECK([sys/exec_aout.h], tcl_cv_sysexecaout_h, [
+ AC_TRY_COMPILE([#include <sys/exec_aout.h>],[
+ struct exec foo;
+ unsigned long seek;
+ int flag;
+#if defined(__mips) || defined(mips)
+ seek = N_TXTOFF (foo.ex_f, foo.ex_o);
+#else
+ seek = N_TXTOFF (foo);
+#endif
+ flag = (foo.a_midmag == OMAGIC);
+ return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
+ ], tcl_cv_sysexecaout_h=usable, tcl_cv_sysexecaout_h=unusable)])
+ if test $tcl_cv_sysexecaout_h = usable; then
+ AC_DEFINE(USE_SYS_EXEC_AOUT_H)
+ else
+ DL_OBJS=""
+ fi
+ fi
+ fi
+ fi
+
+ # Step 5: disable dynamic loading if requested via a command-line switch.
+
+ AC_ARG_ENABLE(load, [ --disable-load disallow dynamic loading and "load" command],
+ [tcl_ok=$enableval], [tcl_ok=yes])
+ if test "$tcl_ok" = "no"; then
+ DL_OBJS=""
+ fi
+
+ if test "x$DL_OBJS" != "x" ; then
+ BUILD_DLTEST="\$(DLTEST_TARGETS)"
+ else
+ echo "Can't figure out how to do dynamic loading or shared libraries"
+ echo "on this system."
+ SHLIB_CFLAGS=""
+ SHLIB_LD=""
+ SHLIB_SUFFIX=""
+ DL_OBJS="tclLoadNone.o"
+ DL_LIBS=""
+ LDFLAGS="$LDFLAGS_ORIG"
+ CC_SEARCH_FLAGS=""
+ LD_SEARCH_FLAGS=""
+ BUILD_DLTEST=""
+ fi
+
+ # If we're running gcc, then change the C flags for compiling shared
+ # libraries to the right flags for gcc, instead of those for the
+ # standard manufacturer compiler.
+
+ if test "$DL_OBJS" != "tclLoadNone.o" ; then
+ if test "$GCC" = "yes" ; then
+ case $system in
+ AIX-*)
+ ;;
+ BSD/OS*)
+ ;;
+ IRIX*)
+ ;;
+ NetBSD-*|FreeBSD-*|OpenBSD-*)
+ ;;
+ Darwin-*)
+ ;;
+ RISCos-*)
+ ;;
+ SCO_SV-3.2*)
+ ;;
+ ULTRIX-4.*)
+ ;;
+ *)
+ SHLIB_CFLAGS="-fPIC"
+ ;;
+ esac
+ fi
+ fi
+
+ if test "$SHARED_LIB_SUFFIX" = "" ; then
+ SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}${SHLIB_SUFFIX}'
+ fi
+ if test "$UNSHARED_LIB_SUFFIX" = "" ; then
+ UNSHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a'
+ fi
+
+ if test "${SHARED_BUILD}" = "1" && test "${SHLIB_SUFFIX}" != "" ; then
+ LIB_SUFFIX=${SHARED_LIB_SUFFIX}
+ MAKE_LIB='${SHLIB_LD} -o [$]@ ${OBJS} ${SHLIB_LD_LIBS} ${TCL_SHLIB_LD_EXTRAS} ${TK_SHLIB_LD_EXTRAS} ${LD_SEARCH_FLAGS}'
+ INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE)'
+ else
+ LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}
+
+ if test "$RANLIB" = "" ; then
+ MAKE_LIB='$(STLIB_LD) [$]@ ${OBJS}'
+ INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE)'
+ else
+ MAKE_LIB='${STLIB_LD} [$]@ ${OBJS} ; ${RANLIB} [$]@'
+ INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE) ; (cd $(LIB_INSTALL_DIR) ; $(RANLIB) $(LIB_FILE))'
+ fi
+
+dnl Not at all clear what this was doing in Tcl's configure.in
+dnl or why it was needed was needed. In any event, this sort of
+dnl things needs to be done in the big loop above.
+dnl REMOVE THIS BLOCK LATER! (mdejong)
+dnl case $system in
+dnl BSD/OS*)
+dnl ;;
+dnl AIX-[[1-4]].*)
+dnl ;;
+dnl *)
+dnl SHLIB_LD_LIBS=""
+dnl ;;
+dnl esac
+ fi
+
+
+ # Stub lib does not depend on shared/static configuration
+ if test "$RANLIB" = "" ; then
+ MAKE_STUB_LIB='${STLIB_LD} [$]@ ${STUB_LIB_OBJS}'
+ INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) $(LIB_INSTALL_DIR)/$(STUB_LIB_FILE)'
+ else
+ MAKE_STUB_LIB='${STLIB_LD} [$]@ ${STUB_LIB_OBJS} ; ${RANLIB} [$]@'
+ INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) $(LIB_INSTALL_DIR)/$(STUB_LIB_FILE) ; (cd $(LIB_INSTALL_DIR) ; $(RANLIB) $(STUB_LIB_FILE))'
+ fi
+
+
+ AC_SUBST(DL_LIBS)
+
+ AC_SUBST(DL_OBJS)
+ AC_SUBST(PLAT_OBJS)
+ AC_SUBST(PLAT_SRCS)
+ AC_SUBST(CFLAGS)
+ AC_SUBST(CFLAGS_DEBUG)
+ AC_SUBST(CFLAGS_OPTIMIZE)
+ AC_SUBST(CFLAGS_WARNING)
+
+ AC_SUBST(LDFLAGS)
+ AC_SUBST(LDFLAGS_DEBUG)
+ AC_SUBST(LDFLAGS_OPTIMIZE)
+ AC_SUBST(CC_SEARCH_FLAGS)
+ AC_SUBST(LD_SEARCH_FLAGS)
+
+ AC_SUBST(STLIB_LD)
+ AC_SUBST(SHLIB_LD)
+ AC_SUBST(TCL_SHLIB_LD_EXTRAS)
+ AC_SUBST(TK_SHLIB_LD_EXTRAS)
+ AC_SUBST(SHLIB_LD_LIBS)
+ AC_SUBST(SHLIB_CFLAGS)
+ AC_SUBST(SHLIB_SUFFIX)
+
+ AC_SUBST(MAKE_LIB)
+ AC_SUBST(MAKE_STUB_LIB)
+ AC_SUBST(INSTALL_LIB)
+ AC_SUBST(INSTALL_STUB_LIB)
+ AC_SUBST(RANLIB)
+])
+
+#--------------------------------------------------------------------
+# SC_SERIAL_PORT
+#
+# Determine which interface to use to talk to the serial port.
+# Note that #include lines must begin in leftmost column for
+# some compilers to recognize them as preprocessor directives,
+# and some build environments have stdin not pointing at a
+# pseudo-terminal (usually /dev/null instead.)
+#
+# Arguments:
+# none
+#
+# Results:
+#
+# Defines only one of the following vars:
+# HAVE_SYS_MODEM_H
+# USE_TERMIOS
+# USE_TERMIO
+# USE_SGTTY
+#
+#--------------------------------------------------------------------
+
+AC_DEFUN([SC_SERIAL_PORT], [
+ AC_CHECK_HEADERS(sys/modem.h)
+ AC_CACHE_CHECK([termios vs. termio vs. sgtty], tcl_cv_api_serial, [
+ AC_TRY_RUN([
+#include <termios.h>
+
+int main() {
+ struct termios t;
+ if (tcgetattr(0, &t) == 0) {
+ cfsetospeed(&t, 0);
+ t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB;
+ return 0;
+ }
+ return 1;
+}], tcl_cv_api_serial=termios, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
+ if test $tcl_cv_api_serial = no ; then
+ AC_TRY_RUN([
+#include <termio.h>
+
+int main() {
+ struct termio t;
+ if (ioctl(0, TCGETA, &t) == 0) {
+ t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB;
+ return 0;
+ }
+ return 1;
+}], tcl_cv_api_serial=termio, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
+ fi
+ if test $tcl_cv_api_serial = no ; then
+ AC_TRY_RUN([
+#include <sgtty.h>
+
+int main() {
+ struct sgttyb t;
+ if (ioctl(0, TIOCGETP, &t) == 0) {
+ t.sg_ospeed = 0;
+ t.sg_flags |= ODDP | EVENP | RAW;
+ return 0;
+ }
+ return 1;
+}], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
+ fi
+ if test $tcl_cv_api_serial = no ; then
+ AC_TRY_RUN([
+#include <termios.h>
+#include <errno.h>
+
+int main() {
+ struct termios t;
+ if (tcgetattr(0, &t) == 0
+ || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
+ cfsetospeed(&t, 0);
+ t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB;
+ return 0;
+ }
+ return 1;
+}], tcl_cv_api_serial=termios, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
+ fi
+ if test $tcl_cv_api_serial = no; then
+ AC_TRY_RUN([
+#include <termio.h>
+#include <errno.h>
+
+int main() {
+ struct termio t;
+ if (ioctl(0, TCGETA, &t) == 0
+ || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
+ t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB;
+ return 0;
+ }
+ return 1;
+ }], tcl_cv_api_serial=termio, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
+ fi
+ if test $tcl_cv_api_serial = no; then
+ AC_TRY_RUN([
+#include <sgtty.h>
+#include <errno.h>
+
+int main() {
+ struct sgttyb t;
+ if (ioctl(0, TIOCGETP, &t) == 0
+ || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
+ t.sg_ospeed = 0;
+ t.sg_flags |= ODDP | EVENP | RAW;
+ return 0;
+ }
+ return 1;
+}], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=none, tcl_cv_api_serial=none)
+ fi])
+ case $tcl_cv_api_serial in
+ termios) AC_DEFINE(USE_TERMIOS);;
+ termio) AC_DEFINE(USE_TERMIO);;
+ sgtty) AC_DEFINE(USE_SGTTY);;
+ esac
+])
+
+#--------------------------------------------------------------------
+# SC_MISSING_POSIX_HEADERS
+#
+# Supply substitutes for missing POSIX header files. Special
+# notes:
+# - stdlib.h doesn't define strtol, strtoul, or
+# strtod insome versions of SunOS
+# - some versions of string.h don't declare procedures such
+# as strstr
+#
+# Arguments:
+# none
+#
+# Results:
+#
+# Defines some of the following vars:
+# NO_DIRENT_H
+# NO_ERRNO_H
+# NO_VALUES_H
+# HAVE_LIMITS_H or NO_LIMITS_H
+# NO_STDLIB_H
+# NO_STRING_H
+# NO_SYS_WAIT_H
+# NO_DLFCN_H
+# HAVE_UNISTD_H
+# HAVE_SYS_PARAM_H
+#
+# HAVE_STRING_H ?
+#
+#--------------------------------------------------------------------
+
+AC_DEFUN([SC_MISSING_POSIX_HEADERS], [
+ AC_CACHE_CHECK([dirent.h], tcl_cv_dirent_h, [
+ AC_TRY_LINK([#include <sys/types.h>
+#include <dirent.h>], [
+#ifndef _POSIX_SOURCE
+# ifdef __Lynx__
+ /*
+ * Generate compilation error to make the test fail: Lynx headers
+ * are only valid if really in the POSIX environment.
+ */
+
+ missing_procedure();
+# endif
+#endif
+DIR *d;
+struct dirent *entryPtr;
+char *p;
+d = opendir("foobar");
+entryPtr = readdir(d);
+p = entryPtr->d_name;
+closedir(d);
+], tcl_cv_dirent_h=yes, tcl_cv_dirent_h=no)])
+
+ if test $tcl_cv_dirent_h = no; then
+ AC_DEFINE(NO_DIRENT_H)
+ fi
+
+ AC_CHECK_HEADER(errno.h, , [AC_DEFINE(NO_ERRNO_H)])
+ AC_CHECK_HEADER(float.h, , [AC_DEFINE(NO_FLOAT_H)])
+ AC_CHECK_HEADER(values.h, , [AC_DEFINE(NO_VALUES_H)])
+ AC_CHECK_HEADER(limits.h,
+ [AC_DEFINE(HAVE_LIMITS_H)], [AC_DEFINE(NO_LIMITS_H)])
+ AC_CHECK_HEADER(stdlib.h, tcl_ok=1, tcl_ok=0)
+ AC_EGREP_HEADER(strtol, stdlib.h, , tcl_ok=0)
+ AC_EGREP_HEADER(strtoul, stdlib.h, , tcl_ok=0)
+ AC_EGREP_HEADER(strtod, stdlib.h, , tcl_ok=0)
+ if test $tcl_ok = 0; then
+ AC_DEFINE(NO_STDLIB_H)
+ fi
+ AC_CHECK_HEADER(string.h, tcl_ok=1, tcl_ok=0)
+ AC_EGREP_HEADER(strstr, string.h, , tcl_ok=0)
+ AC_EGREP_HEADER(strerror, string.h, , tcl_ok=0)
+
+ # See also memmove check below for a place where NO_STRING_H can be
+ # set and why.
+
+ if test $tcl_ok = 0; then
+ AC_DEFINE(NO_STRING_H)
+ fi
+
+ AC_CHECK_HEADER(sys/wait.h, , [AC_DEFINE(NO_SYS_WAIT_H)])
+ AC_CHECK_HEADER(dlfcn.h, , [AC_DEFINE(NO_DLFCN_H)])
+
+ # OS/390 lacks sys/param.h (and doesn't need it, by chance).
+ AC_HAVE_HEADERS(unistd.h sys/param.h)
+])
+
+#--------------------------------------------------------------------
+# SC_PATH_X
+#
+# Locate the X11 header files and the X11 library archive. Try
+# the ac_path_x macro first, but if it doesn't find the X stuff
+# (e.g. because there's no xmkmf program) then check through
+# a list of possible directories. Under some conditions the
+# autoconf macro will return an include directory that contains
+# no include files, so double-check its result just to be safe.
+#
+# Arguments:
+# none
+#
+# Results:
+#
+# Sets the the following vars:
+# XINCLUDES
+# XLIBSW
+#
+#--------------------------------------------------------------------
+
+AC_DEFUN([SC_PATH_X], [
+ AC_PATH_X
+ not_really_there=""
+ if test "$no_x" = ""; then
+ if test "$x_includes" = ""; then
+ AC_TRY_CPP([#include <X11/XIntrinsic.h>], , not_really_there="yes")
+ else
+ if test ! -r $x_includes/X11/Intrinsic.h; then
+ not_really_there="yes"
+ fi
+ fi
+ fi
+ if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then
+ AC_MSG_CHECKING([for X11 header files])
+ found_xincludes="no"
+ AC_TRY_CPP([#include <X11/Intrinsic.h>], found_xincludes="yes", found_xincludes="no")
+ if test "$found_xincludes" = "no"; then
+ dirs="/usr/unsupported/include /usr/local/include /usr/X386/include /usr/X11R6/include /usr/X11R5/include /usr/include/X11R5 /usr/include/X11R4 /usr/openwin/include /usr/X11/include /usr/sww/include"
+ for i in $dirs ; do
+ if test -r $i/X11/Intrinsic.h; then
+ AC_MSG_RESULT([$i])
+ XINCLUDES=" -I$i"
+ found_xincludes="yes"
+ break
+ fi
+ done
+ fi
+ else
+ if test "$x_includes" != ""; then
+ XINCLUDES="-I$x_includes"
+ found_xincludes="yes"
+ fi
+ fi
+ if test found_xincludes = "no"; then
+ AC_MSG_RESULT([couldn't find any!])
+ fi
+
+ if test "$no_x" = yes; then
+ AC_MSG_CHECKING([for X11 libraries])
+ XLIBSW=nope
+ dirs="/usr/unsupported/lib /usr/local/lib /usr/X386/lib /usr/X11R6/lib /usr/X11R5/lib /usr/lib/X11R5 /usr/lib/X11R4 /usr/openwin/lib /usr/X11/lib /usr/sww/X11/lib"
+ for i in $dirs ; do
+ if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl; then
+ AC_MSG_RESULT([$i])
+ XLIBSW="-L$i -lX11"
+ x_libraries="$i"
+ break
+ fi
+ done
+ else
+ if test "$x_libraries" = ""; then
+ XLIBSW=-lX11
+ else
+ XLIBSW="-L$x_libraries -lX11"
+ fi
+ fi
+ if test "$XLIBSW" = nope ; then
+ AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow)
+ fi
+ if test "$XLIBSW" = nope ; then
+ AC_MSG_RESULT([could not find any! Using -lX11.])
+ XLIBSW=-lX11
+ fi
+])
+
+#--------------------------------------------------------------------
+# SC_BLOCKING_STYLE
+#
+# The statements below check for systems where POSIX-style
+# non-blocking I/O (O_NONBLOCK) doesn't work or is unimplemented.
+# On these systems (mostly older ones), use the old BSD-style
+# FIONBIO approach instead.
+#
+# Arguments:
+# none
+#
+# Results:
+#
+# Defines some of the following vars:
+# HAVE_SYS_IOCTL_H
+# HAVE_SYS_FILIO_H
+# USE_FIONBIO
+# O_NONBLOCK
+#
+#--------------------------------------------------------------------
+
+AC_DEFUN([SC_BLOCKING_STYLE], [
+ AC_CHECK_HEADERS(sys/ioctl.h)
+ AC_CHECK_HEADERS(sys/filio.h)
+ SC_CONFIG_SYSTEM
+ AC_MSG_CHECKING([FIONBIO vs. O_NONBLOCK for nonblocking I/O])
+ case $system in
+ # There used to be code here to use FIONBIO under AIX. However, it
+ # was reported that FIONBIO doesn't work under AIX 3.2.5. Since
+ # using O_NONBLOCK seems fine under AIX 4.*, I removed the FIONBIO
+ # code (JO, 5/31/97).
+
+ OSF*)
+ AC_DEFINE(USE_FIONBIO)
+ AC_MSG_RESULT([FIONBIO])
+ ;;
+ SunOS-4*)
+ AC_DEFINE(USE_FIONBIO)
+ AC_MSG_RESULT([FIONBIO])
+ ;;
+ ULTRIX-4.*)
+ AC_DEFINE(USE_FIONBIO)
+ AC_MSG_RESULT([FIONBIO])
+ ;;
+ *)
+ AC_MSG_RESULT([O_NONBLOCK])
+ ;;
+ esac
+])
+
+#--------------------------------------------------------------------
+# SC_TIME_HANLDER
+#
+# Checks how the system deals with time.h, what time structures
+# are used on the system, and what fields the structures have.
+#
+# Arguments:
+# none
+#
+# Results:
+#
+# Defines some of the following vars:
+# USE_DELTA_FOR_TZ
+# HAVE_TM_GMTOFF
+# HAVE_TM_TZADJ
+# HAVE_TIMEZONE_VAR
+#
+#--------------------------------------------------------------------
+
+AC_DEFUN([SC_TIME_HANDLER], [
+ AC_CHECK_HEADERS(sys/time.h)
+ AC_HEADER_TIME
+ AC_STRUCT_TIMEZONE
+
+ AC_CHECK_FUNCS(gmtime_r localtime_r)
+
+ AC_CACHE_CHECK([tm_tzadj in struct tm], tcl_cv_member_tm_tzadj, [
+ AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_tzadj;],
+ tcl_cv_member_tm_tzadj=yes, tcl_cv_member_tm_tzadj=no)])
+ if test $tcl_cv_member_tm_tzadj = yes ; then
+ AC_DEFINE(HAVE_TM_TZADJ)
+ fi
+
+ AC_CACHE_CHECK([tm_gmtoff in struct tm], tcl_cv_member_tm_gmtoff, [
+ AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_gmtoff;],
+ tcl_cv_member_tm_gmtoff=yes, tcl_cv_member_tm_gmtoff=no)])
+ if test $tcl_cv_member_tm_gmtoff = yes ; then
+ AC_DEFINE(HAVE_TM_GMTOFF)
+ fi
+
+ #
+ # Its important to include time.h in this check, as some systems
+ # (like convex) have timezone functions, etc.
+ #
+ AC_CACHE_CHECK([long timezone variable], tcl_cv_timezone_long, [
+ AC_TRY_COMPILE([#include <time.h>],
+ [extern long timezone;
+ timezone += 1;
+ exit (0);],
+ tcl_cv_timezone_long=yes, tcl_cv_timezone_long=no)])
+ if test $tcl_cv_timezone_long = yes ; then
+ AC_DEFINE(HAVE_TIMEZONE_VAR)
+ else
+ #
+ # On some systems (eg IRIX 6.2), timezone is a time_t and not a long.
+ #
+ AC_CACHE_CHECK([time_t timezone variable], tcl_cv_timezone_time, [
+ AC_TRY_COMPILE([#include <time.h>],
+ [extern time_t timezone;
+ timezone += 1;
+ exit (0);],
+ tcl_cv_timezone_time=yes, tcl_cv_timezone_time=no)])
+ if test $tcl_cv_timezone_time = yes ; then
+ AC_DEFINE(HAVE_TIMEZONE_VAR)
+ fi
+ fi
+])
+
+#--------------------------------------------------------------------
+# SC_BUGGY_STRTOD
+#
+# Under Solaris 2.4, strtod returns the wrong value for the
+# terminating character under some conditions. Check for this
+# and if the problem exists use a substitute procedure
+# "fixstrtod" (provided by Tcl) that corrects the error.
+# Also, on Compaq's Tru64 Unix 5.0,
+# strtod(" ") returns 0.0 instead of a failure to convert.
+#
+# Arguments:
+# none
+#
+# Results:
+#
+# Might defines some of the following vars:
+# strtod (=fixstrtod)
+#
+#--------------------------------------------------------------------
+
+AC_DEFUN([SC_BUGGY_STRTOD], [
+ AC_CHECK_FUNC(strtod, tcl_strtod=1, tcl_strtod=0)
+ if test "$tcl_strtod" = 1; then
+ AC_CACHE_CHECK([for Solaris2.4/Tru64 strtod bugs], tcl_cv_strtod_buggy,[
+ AC_TRY_RUN([
+ extern double strtod();
+ int main() {
+ char *infString="Inf", *nanString="NaN", *spaceString=" ";
+ char *term;
+ double value;
+ value = strtod(infString, &term);
+ if ((term != infString) && (term[-1] == 0)) {
+ exit(1);
+ }
+ value = strtod(nanString, &term);
+ if ((term != nanString) && (term[-1] == 0)) {
+ exit(1);
+ }
+ value = strtod(spaceString, &term);
+ if (term == (spaceString+1)) {
+ exit(1);
+ }
+ exit(0);
+ }], tcl_cv_strtod_buggy=ok, tcl_cv_strtod_buggy=buggy,
+ tcl_cv_strtod_buggy=buggy)])
+ if test "$tcl_cv_strtod_buggy" = buggy; then
+ LIBOBJS="$LIBOBJS fixstrtod.o"
+ AC_DEFINE(strtod, fixstrtod)
+ fi
+ fi
+])
+
+#--------------------------------------------------------------------
+# SC_TCL_LINK_LIBS
+#
+# Search for the libraries needed to link the Tcl shell.
+# Things like the math library (-lm) and socket stuff (-lsocket vs.
+# -lnsl) are dealt with here.
+#
+# Arguments:
+# Requires the following vars to be set in the Makefile:
+# DL_LIBS
+# LIBS
+# MATH_LIBS
+#
+# Results:
+#
+# Subst's the following var:
+# TCL_LIBS
+# MATH_LIBS
+#
+# Might append to the following vars:
+# LIBS
+#
+# Might define the following vars:
+# HAVE_NET_ERRNO_H
+#
+#--------------------------------------------------------------------
+
+AC_DEFUN([SC_TCL_LINK_LIBS], [
+ #--------------------------------------------------------------------
+ # On a few very rare systems, all of the libm.a stuff is
+ # already in libc.a. Set compiler flags accordingly.
+ # Also, Linux requires the "ieee" library for math to work
+ # right (and it must appear before "-lm").
+ #--------------------------------------------------------------------
+
+ AC_CHECK_FUNC(sin, MATH_LIBS="", MATH_LIBS="-lm")
+ AC_CHECK_LIB(ieee, main, [MATH_LIBS="-lieee $MATH_LIBS"])
+
+ #--------------------------------------------------------------------
+ # Interactive UNIX requires -linet instead of -lsocket, plus it
+ # needs net/errno.h to define the socket-related error codes.
+ #--------------------------------------------------------------------
+
+ AC_CHECK_LIB(inet, main, [LIBS="$LIBS -linet"])
+ AC_CHECK_HEADER(net/errno.h, [AC_DEFINE(HAVE_NET_ERRNO_H)])
+
+ #--------------------------------------------------------------------
+ # Check for the existence of the -lsocket and -lnsl libraries.
+ # The order here is important, so that they end up in the right
+ # order in the command line generated by make. Here are some
+ # special considerations:
+ # 1. Use "connect" and "accept" to check for -lsocket, and
+ # "gethostbyname" to check for -lnsl.
+ # 2. Use each function name only once: can't redo a check because
+ # autoconf caches the results of the last check and won't redo it.
+ # 3. Use -lnsl and -lsocket only if they supply procedures that
+ # aren't already present in the normal libraries. This is because
+ # IRIX 5.2 has libraries, but they aren't needed and they're
+ # bogus: they goof up name resolution if used.
+ # 4. On some SVR4 systems, can't use -lsocket without -lnsl too.
+ # To get around this problem, check for both libraries together
+ # if -lsocket doesn't work by itself.
+ #--------------------------------------------------------------------
+
+ tcl_checkBoth=0
+ AC_CHECK_FUNC(connect, tcl_checkSocket=0, tcl_checkSocket=1)
+ if test "$tcl_checkSocket" = 1; then
+ AC_CHECK_FUNC(setsockopt, , [AC_CHECK_LIB(socket, setsockopt,
+ LIBS="$LIBS -lsocket", tcl_checkBoth=1)])
+ fi
+ if test "$tcl_checkBoth" = 1; then
+ tk_oldLibs=$LIBS
+ LIBS="$LIBS -lsocket -lnsl"
+ AC_CHECK_FUNC(accept, tcl_checkNsl=0, [LIBS=$tk_oldLibs])
+ fi
+ AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname,
+ [LIBS="$LIBS -lnsl"])])
+
+ # Don't perform the eval of the libraries here because DL_LIBS
+ # won't be set until we call SC_CONFIG_CFLAGS
+
+ TCL_LIBS='${DL_LIBS} ${LIBS} ${MATH_LIBS}'
+ AC_SUBST(TCL_LIBS)
+ AC_SUBST(MATH_LIBS)
+])
+
+#--------------------------------------------------------------------
+# SC_TCL_EARLY_FLAGS
+#
+# Check for what flags are needed to be passed so the correct OS
+# features are available.
+#
+# Arguments:
+# None
+#
+# Results:
+#
+# Might define the following vars:
+# _ISOC99_SOURCE
+# _LARGEFILE64_SOURCE
+# _LARGEFILE_SOURCE64
+#
+#--------------------------------------------------------------------
+
+AC_DEFUN([SC_TCL_EARLY_FLAG],[
+ AC_CACHE_VAL([tcl_cv_flag_]translit($1,[A-Z],[a-z]),
+ AC_TRY_COMPILE([$2], $3, [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no,
+ AC_TRY_COMPILE([[#define ]$1[ 1
+]$2], $3,
+ [tcl_cv_flag_]translit($1,[A-Z],[a-z])=yes,
+ [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no)))
+ if test ["x${tcl_cv_flag_]translit($1,[A-Z],[a-z])[}" = "xyes"] ; then
+ AC_DEFINE($1)
+ tcl_flags="$tcl_flags $1"
+ fi
+])
+
+AC_DEFUN([SC_TCL_EARLY_FLAGS],[
+ AC_MSG_CHECKING([for required early compiler flags])
+ tcl_flags=""
+ SC_TCL_EARLY_FLAG(_ISOC99_SOURCE,[#include <stdlib.h>],
+ [char *p = (char *)strtoll; char *q = (char *)strtoull;])
+ SC_TCL_EARLY_FLAG(_LARGEFILE64_SOURCE,[#include <sys/stat.h>],
+ [struct stat64 buf; int i = stat64("/", &buf);])
+ SC_TCL_EARLY_FLAG(_LARGEFILE_SOURCE64,[#include <sys/stat.h>],
+ [char *p = (char *)open64;])
+ if test "x${tcl_flags}" = "x" ; then
+ AC_MSG_RESULT([none])
+ else
+ AC_MSG_RESULT([${tcl_flags}])
+ fi
+])
+
+#--------------------------------------------------------------------
+# SC_TCL_64BIT_FLAGS
+#
+# Check for what is defined in the way of 64-bit features.
+#
+# Arguments:
+# None
+#
+# Results:
+#
+# Might define the following vars:
+# TCL_WIDE_INT_IS_LONG
+# TCL_WIDE_INT_TYPE
+# HAVE_STRUCT_DIRENT64
+# HAVE_STRUCT_STAT64
+# HAVE_TYPE_OFF64_T
+#
+#--------------------------------------------------------------------
+
+AC_DEFUN([SC_TCL_64BIT_FLAGS], [
+ AC_MSG_CHECKING([for 64-bit integer type])
+ AC_CACHE_VAL(tcl_cv_type_64bit,[
+ tcl_cv_type_64bit=none
+ # See if the compiler knows natively about __int64
+ AC_TRY_COMPILE(,[__int64 value = (__int64) 0;],
+ tcl_type_64bit=__int64, tcl_type_64bit="long long")
+ # See if we should use long anyway Note that we substitute in the
+ # type that is our current guess for a 64-bit type inside this check
+ # program, so it should be modified only carefully...
+ AC_TRY_COMPILE(,[switch (0) {
+ case 1: case (sizeof(]${tcl_type_64bit}[)==sizeof(long)): ;
+ }],tcl_cv_type_64bit=${tcl_type_64bit})])
+ if test "${tcl_cv_type_64bit}" = none ; then
+ AC_DEFINE(TCL_WIDE_INT_IS_LONG)
+ AC_MSG_RESULT([using long])
+ else
+ AC_DEFINE_UNQUOTED(TCL_WIDE_INT_TYPE,${tcl_cv_type_64bit})
+ AC_MSG_RESULT([${tcl_cv_type_64bit}])
+
+ # Now check for auxiliary declarations
+ AC_CACHE_CHECK([for struct dirent64], tcl_cv_struct_dirent64,[
+ AC_TRY_COMPILE([#include <sys/types.h>
+#include <sys/dirent.h>],[struct dirent64 p;],
+ tcl_cv_struct_dirent64=yes,tcl_cv_struct_dirent64=no)])
+ if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then
+ AC_DEFINE(HAVE_STRUCT_DIRENT64)
+ fi
+
+ AC_CACHE_CHECK([for struct stat64], tcl_cv_struct_stat64,[
+ AC_TRY_COMPILE([#include <sys/stat.h>],[struct stat64 p;
+],
+ tcl_cv_struct_stat64=yes,tcl_cv_struct_stat64=no)])
+ if test "x${tcl_cv_struct_stat64}" = "xyes" ; then
+ AC_DEFINE(HAVE_STRUCT_STAT64)
+ fi
+
+ AC_CHECK_FUNCS(open64 lseek64)
+ AC_MSG_CHECKING([for off64_t])
+ AC_CACHE_VAL(tcl_cv_type_off64_t,[
+ AC_TRY_COMPILE([#include <sys/types.h>],[off64_t offset;
+],
+ tcl_cv_type_off64_t=yes,tcl_cv_type_off64_t=no)])
+ dnl Define HAVE_TYPE_OFF64_T only when the off64_t type and the
+ dnl functions lseek64 and open64 are defined.
+ if test "x${tcl_cv_type_off64_t}" = "xyes" && \
+ test "x${ac_cv_func_lseek64}" = "xyes" && \
+ test "x${ac_cv_func_open64}" = "xyes" ; then
+ AC_DEFINE(HAVE_TYPE_OFF64_T)
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ fi
+ fi
+])
+
+#--------------------------------------------------------------------
+# SC_TCL_GETHOSTBYADDR_R
+#
+# Check if we have MT-safe variant of gethostbyaddr().
+#
+# Arguments:
+# None
+#
+# Results:
+#
+# Might define the following vars:
+# HAVE_GETHOSTBYADDR_R
+# HAVE_GETHOSTBYADDR_R_7
+# HAVE_GETHOSTBYADDR_R_8
+#
+#--------------------------------------------------------------------
+
+AC_DEFUN([SC_TCL_GETHOSTBYADDR_R], [AC_CHECK_FUNC(gethostbyaddr_r, [
+ AC_CACHE_CHECK([for gethostbyaddr_r with 7 args], tcl_cv_api_gethostbyaddr_r_7, [
+ AC_TRY_COMPILE([
+ #include <netdb.h>
+ ], [
+ char *addr;
+ int length;
+ int type;
+ struct hostent *result;
+ char buffer[2048];
+ int buflen = 2048;
+ int h_errnop;
+
+ (void) gethostbyaddr_r(addr, length, type, result, buffer, buflen,
+ &h_errnop);
+ ], tcl_cv_api_gethostbyaddr_r_7=yes, tcl_cv_api_gethostbyaddr_r_7=no)])
+ tcl_ok=$tcl_cv_api_gethostbyaddr_r_7
+ if test "$tcl_ok" = yes; then
+ AC_DEFINE(HAVE_GETHOSTBYADDR_R_7)
+ else
+ AC_CACHE_CHECK([for gethostbyaddr_r with 8 args], tcl_cv_api_gethostbyaddr_r_8, [
+ AC_TRY_COMPILE([
+ #include <netdb.h>
+ ], [
+ char *addr;
+ int length;
+ int type;
+ struct hostent *result, *resultp;
+ char buffer[2048];
+ int buflen = 2048;
+ int h_errnop;
+
+ (void) gethostbyaddr_r(addr, length, type, result, buffer, buflen,
+ &resultp, &h_errnop);
+ ], tcl_cv_api_gethostbyaddr_r_8=yes, tcl_cv_api_gethostbyaddr_r_8=no)])
+ tcl_ok=$tcl_cv_api_gethostbyaddr_r_8
+ if test "$tcl_ok" = yes; then
+ AC_DEFINE(HAVE_GETHOSTBYADDR_R_8)
+ fi
+ fi
+ if test "$tcl_ok" = yes; then
+ AC_DEFINE(HAVE_GETHOSTBYADDR_R)
+ fi
+])])
+
+#--------------------------------------------------------------------
+# SC_TCL_GETHOSTBYNAME_R
+#
+# Check to see what variant of gethostbyname_r() we have.
+# Based on David Arnold's example from the comp.programming.threads
+# FAQ Q213
+#
+# Arguments:
+# None
+#
+# Results:
+#
+# Might define the following vars:
+# HAVE_GETHOSTBYADDR_R
+# HAVE_GETHOSTBYADDR_R_3
+# HAVE_GETHOSTBYADDR_R_5
+# HAVE_GETHOSTBYADDR_R_6
+#
+#--------------------------------------------------------------------
+
+AC_DEFUN([SC_TCL_GETHOSTBYNAME_R], [AC_CHECK_FUNC(gethostbyname_r, [
+ AC_CACHE_CHECK([for gethostbyname_r with 6 args], tcl_cv_api_gethostbyname_r_6, [
+ AC_TRY_COMPILE([
+ #include <netdb.h>
+ ], [
+ char *name;
+ struct hostent *he, *res;
+ char buffer[2048];
+ int buflen = 2048;
+ int h_errnop;
+
+ (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop);
+ ], tcl_cv_api_gethostbyname_r_6=yes, tcl_cv_api_gethostbyname_r_6=no)])
+ tcl_ok=$tcl_cv_api_gethostbyname_r_6
+ if test "$tcl_ok" = yes; then
+ AC_DEFINE(HAVE_GETHOSTBYNAME_R_6)
+ else
+ AC_CACHE_CHECK([for gethostbyname_r with 5 args], tcl_cv_api_gethostbyname_r_5, [
+ AC_TRY_COMPILE([
+ #include <netdb.h>
+ ], [
+ char *name;
+ struct hostent *he;
+ char buffer[2048];
+ int buflen = 2048;
+ int h_errnop;
+
+ (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop);
+ ], tcl_cv_api_gethostbyname_r_5=yes, tcl_cv_api_gethostbyname_r_5=no)])
+ tcl_ok=$tcl_cv_api_gethostbyname_r_5
+ if test "$tcl_ok" = yes; then
+ AC_DEFINE(HAVE_GETHOSTBYNAME_R_5)
+ else
+ AC_CACHE_CHECK([for gethostbyname_r with 3 args], tcl_cv_api_gethostbyname_r_3, [
+ AC_TRY_COMPILE([
+ #include <netdb.h>
+ ], [
+ char *name;
+ struct hostent *he;
+ struct hostent_data data;
+
+ (void) gethostbyname_r(name, he, &data);
+ ], tcl_cv_api_gethostbyname_r_3=yes, tcl_cv_api_gethostbyname_r_3=no)])
+ tcl_ok=$tcl_cv_api_gethostbyname_r_3
+ if test "$tcl_ok" = yes; then
+ AC_DEFINE(HAVE_GETHOSTBYNAME_R_3)
+ fi
+ fi
+ fi
+ if test "$tcl_ok" = yes; then
+ AC_DEFINE(HAVE_GETHOSTBYNAME_R)
+ fi
+])])
+
+#--------------------------------------------------------------------
+# SC_TCL_GETPWUID_R
+#
+# Check if we have MT-safe variant of getpwuid() and if yes,
+# which one exactly.
+#
+# Arguments:
+# None
+#
+# Results:
+#
+# Might define the following vars:
+# HAVE_GETPWUID_R
+# HAVE_GETPWUID_R_4
+# HAVE_GETPWUID_R_5
+#
+#--------------------------------------------------------------------
+
+AC_DEFUN([SC_TCL_GETPWUID_R], [AC_CHECK_FUNC(getpwuid_r, [
+ AC_CACHE_CHECK([for getpwuid_r with 5 args], tcl_cv_api_getpwuid_r_5, [
+ AC_TRY_COMPILE([
+ #include <sys/types.h>
+ #include <pwd.h>
+ ], [
+ uid_t uid;
+ struct passwd pw, *pwp;
+ char buf[512];
+ int buflen = 512;
+
+ (void) getpwuid_r(uid, &pw, buf, buflen, &pwp);
+ ], tcl_cv_api_getpwuid_r_5=yes, tcl_cv_api_getpwuid_r_5=no)])
+ tcl_ok=$tcl_cv_api_getpwuid_r_5
+ if test "$tcl_ok" = yes; then
+ AC_DEFINE(HAVE_GETPWUID_R_5)
+ else
+ AC_CACHE_CHECK([for getpwuid_r with 4 args], tcl_cv_api_getpwuid_r_4, [
+ AC_TRY_COMPILE([
+ #include <sys/types.h>
+ #include <pwd.h>
+ ], [
+ uid_t uid;
+ struct passwd pw;
+ char buf[512];
+ int buflen = 512;
+
+ (void)getpwnam_r(uid, &pw, buf, buflen);
+ ], tcl_cv_api_getpwuid_r_4=yes, tcl_cv_api_getpwuid_r_4=no)])
+ tcl_ok=$tcl_cv_api_getpwuid_r_4
+ if test "$tcl_ok" = yes; then
+ AC_DEFINE(HAVE_GETPWUID_R_4)
+ fi
+ fi
+ if test "$tcl_ok" = yes; then
+ AC_DEFINE(HAVE_GETPWUID_R)
+ fi
+])])
+
+#--------------------------------------------------------------------
+# SC_TCL_GETPWNAM_R
+#
+# Check if we have MT-safe variant of getpwnam() and if yes,
+# which one exactly.
+#
+# Arguments:
+# None
+#
+# Results:
+#
+# Might define the following vars:
+# HAVE_GETPWNAM_R
+# HAVE_GETPWNAM_R_4
+# HAVE_GETPWNAM_R_5
+#
+#--------------------------------------------------------------------
+
+AC_DEFUN([SC_TCL_GETPWNAM_R], [AC_CHECK_FUNC(getpwnam_r, [
+ AC_CACHE_CHECK([for getpwnam_r with 5 args], tcl_cv_api_getpwnam_r_5, [
+ AC_TRY_COMPILE([
+ #include <sys/types.h>
+ #include <pwd.h>
+ ], [
+ char *name;
+ struct passwd pw, *pwp;
+ char buf[512];
+ int buflen = 512;
+
+ (void) getpwnam_r(name, &pw, buf, buflen, &pwp);
+ ], tcl_cv_api_getpwnam_r_5=yes, tcl_cv_api_getpwnam_r_5=no)])
+ tcl_ok=$tcl_cv_api_getpwnam_r_5
+ if test "$tcl_ok" = yes; then
+ AC_DEFINE(HAVE_GETPWNAM_R_5)
+ else
+ AC_CACHE_CHECK([for getpwnam_r with 4 args], tcl_cv_api_getpwnam_r_4, [
+ AC_TRY_COMPILE([
+ #include <sys/types.h>
+ #include <pwd.h>
+ ], [
+ char *name;
+ struct passwd pw;
+ char buf[512];
+ int buflen = 512;
+
+ (void)getpwnam_r(name, &pw, buf, buflen);
+ ], tcl_cv_api_getpwnam_r_4=yes, tcl_cv_api_getpwnam_r_4=no)])
+ tcl_ok=$tcl_cv_api_getpwnam_r_4
+ if test "$tcl_ok" = yes; then
+ AC_DEFINE(HAVE_GETPWNAM_R_4)
+ fi
+ fi
+ if test "$tcl_ok" = yes; then
+ AC_DEFINE(HAVE_GETPWNAM_R)
+ fi
+])])
+
+#--------------------------------------------------------------------
+# SC_TCL_GETGRGID_R
+#
+# Check if we have MT-safe variant of getgrgid() and if yes,
+# which one exactly.
+#
+# Arguments:
+# None
+#
+# Results:
+#
+# Might define the following vars:
+# HAVE_GETGRGID_R
+# HAVE_GETGRGID_R_4
+# HAVE_GETGRGID_R_5
+#
+#--------------------------------------------------------------------
+
+AC_DEFUN([SC_TCL_GETGRGID_R], [AC_CHECK_FUNC(getgrgid_r, [
+ AC_CACHE_CHECK([for getgrgid_r with 5 args], tcl_cv_api_getgrgid_r_5, [
+ AC_TRY_COMPILE([
+ #include <sys/types.h>
+ #include <grp.h>
+ ], [
+ gid_t gid;
+ struct group gr, *grp;
+ char buf[512];
+ int buflen = 512;
+
+ (void) getgrgid_r(gid, &gr, buf, buflen, &grp);
+ ], tcl_cv_api_getgrgid_r_5=yes, tcl_cv_api_getgrgid_r_5=no)])
+ tcl_ok=$tcl_cv_api_getgrgid_r_5
+ if test "$tcl_ok" = yes; then
+ AC_DEFINE(HAVE_GETGRGID_R_5)
+ else
+ AC_CACHE_CHECK([for getgrgid_r with 4 args], tcl_cv_api_getgrgid_r_4, [
+ AC_TRY_COMPILE([
+ #include <sys/types.h>
+ #include <grp.h>
+ ], [
+ gid_t gid;
+ struct group gr;
+ char buf[512];
+ int buflen = 512;
+
+ (void)getgrgid_r(gid, &gr, buf, buflen);
+ ], tcl_cv_api_getgrgid_r_4=yes, tcl_cv_api_getgrgid_r_4=no)])
+ tcl_ok=$tcl_cv_api_getgrgid_r_4
+ if test "$tcl_ok" = yes; then
+ AC_DEFINE(HAVE_GETGRGID_R_4)
+ fi
+ fi
+ if test "$tcl_ok" = yes; then
+ AC_DEFINE(HAVE_GETGRGID_R)
+ fi
+])])
+
+#--------------------------------------------------------------------
+# SC_TCL_GETGRNAM_R
+#
+# Check if we have MT-safe variant of getgrnam() and if yes,
+# which one exactly.
+#
+# Arguments:
+# None
+#
+# Results:
+#
+# Might define the following vars:
+# HAVE_GETGRNAM_R
+# HAVE_GETGRNAM_R_4
+# HAVE_GETGRNAM_R_5
+#
+#--------------------------------------------------------------------
+
+AC_DEFUN([SC_TCL_GETGRNAM_R], [AC_CHECK_FUNC(getgrnam_r, [
+ AC_CACHE_CHECK([for getgrnam_r with 5 args], tcl_cv_api_getgrnam_r_5, [
+ AC_TRY_COMPILE([
+ #include <sys/types.h>
+ #include <grp.h>
+ ], [
+ char *name;
+ struct group gr, *grp;
+ char buf[512];
+ int buflen = 512;
+
+ (void) getgrnam_r(name, &gr, buf, buflen, &grp);
+ ], tcl_cv_api_getgrnam_r_5=yes, tcl_cv_api_getgrnam_r_5=no)])
+ tcl_ok=$tcl_cv_api_getgrnam_r_5
+ if test "$tcl_ok" = yes; then
+ AC_DEFINE(HAVE_GETGRNAM_R_5)
+ else
+ AC_CACHE_CHECK([for getgrnam_r with 4 args], tcl_cv_api_getgrnam_r_4, [
+ AC_TRY_COMPILE([
+ #include <sys/types.h>
+ #include <grp.h>
+ ], [
+ char *name;
+ struct group gr;
+ char buf[512];
+ int buflen = 512;
+
+ (void)getgrnam_r(name, &gr, buf, buflen);
+ ], tcl_cv_api_getgrnam_r_4=yes, tcl_cv_api_getgrnam_r_4=no)])
+ tcl_ok=$tcl_cv_api_getgrnam_r_4
+ if test "$tcl_ok" = yes; then
+ AC_DEFINE(HAVE_GETGRNAM_R_4)
+ fi
+ fi
+ if test "$tcl_ok" = yes; then
+ AC_DEFINE(HAVE_GETGRNAM_R)
+ fi
+])])
+
+#--------------------------------------------------------------------
+# SC_CONFIG_COMMANDS_PRE(CMDS)
+#
+# Replacement for autoconf 2.5x AC_COMMANDS_PRE:
+# Commands to run right before config.status is
+# created. Accumulates.
+#
+# Requires presence of SC_OUTPUT_COMMANDS_PRE at the end
+# of configure.in (right before AC_OUTPUT).
+#
+#--------------------------------------------------------------------
+
+AC_DEFUN([SC_CONFIG_COMMANDS_PRE], [
+ define([SC_OUTPUT_COMMANDS_PRE], defn([SC_OUTPUT_COMMANDS_PRE])[$1
+])])
+AC_DEFUN([SC_OUTPUT_COMMANDS_PRE])
+
diff --git a/configure b/configure
index 1c190078943..b69f90d7009 100755
--- a/configure
+++ b/configure
@@ -2844,10 +2844,18 @@ fi
# without overflowing the jump tables (-J says to use a 32 bit table)
tentative_cc="cc -J"
;;
- *-hp-hpux*)
+ hppa*-hp-hpux10*)
tentative_cc="cc -Wp,-H256000"
+ host_makefile_frag="config/mh-pa-hpux10"
;;
- *-*-hiux*)
+ hppa*-hp-hpux* | hppa*-*-hiux*)
+ tentative_cc="cc -Wp,-H256000"
+ host_makefile_frag="config/mh-pa"
+ ;;
+ hppa*-*)
+ host_makefile_frag="config/mh-pa"
+ ;;
+ *-hp-hpux* | *-*-hiux*)
tentative_cc="cc -Wp,-H256000"
;;
rs6000-*-lynxos*)
@@ -5440,6 +5448,9 @@ case "${target}" in
mipsisa*-*-elfoabi*)
target_makefile_frag="config/mt-mips-elfoabi"
;;
+ mips*-*-*linux* | mips*-*-gnu*)
+ target_makefile_frag="config/mt-mips-gnu"
+ ;;
*-*-netware*)
target_makefile_frag="config/mt-netware"
;;
diff --git a/configure.ac b/configure.ac
index b7fb222298d..1804731774e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1067,10 +1067,18 @@ case "${host}" in
# without overflowing the jump tables (-J says to use a 32 bit table)
tentative_cc="cc -J"
;;
- *-hp-hpux*)
+ hppa*-hp-hpux10*)
tentative_cc="cc -Wp,-H256000"
+ host_makefile_frag="config/mh-pa-hpux10"
;;
- *-*-hiux*)
+ hppa*-hp-hpux* | hppa*-*-hiux*)
+ tentative_cc="cc -Wp,-H256000"
+ host_makefile_frag="config/mh-pa"
+ ;;
+ hppa*-*)
+ host_makefile_frag="config/mh-pa"
+ ;;
+ *-hp-hpux* | *-*-hiux*)
tentative_cc="cc -Wp,-H256000"
;;
rs6000-*-lynxos*)
@@ -1896,6 +1904,9 @@ case "${target}" in
mipsisa*-*-elfoabi*)
target_makefile_frag="config/mt-mips-elfoabi"
;;
+ mips*-*-*linux* | mips*-*-gnu*)
+ target_makefile_frag="config/mt-mips-gnu"
+ ;;
*-*-netware*)
target_makefile_frag="config/mt-netware"
;;
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index cbb23eae063..3fd1b410392 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,13 +1,3153 @@
+2008-08-15 Joseph Myers <joseph@codesourcery.com>
+
+ * config/arm/arm.c (add_minipool_backward_ref): Check for
+ 8-byte-aligned entries in second case of forcing insertion after a
+ particular entry. Change third case to avoid inserting
+ non-8-byte-aligned entries before 8-byte-aligned ones.
+
+2008-08-15 Richard Guenther <rguenther@suse.de>
+
+ * tree-ssa-ccp.c (maybe_fold_offset_to_reference): Do not
+ strip components for unknown size accesses.
+
+2008-08-15 Wolfgang Gellerich <gellerich@de.ibm.com>
+
+ * config/s390/2097.md New file.
+ * config/s390/s390.md ("z10prop" attribute): Define none,
+ z10_super, z10_super_E1, z10_super_A1, z10_super_c,
+ z10_super_c_E1, z10_fwd, z10_fwd_A1, z10_fwd_A3, z10_fwd_E1,
+ z10_rec, z10_fr, z10_fr_A3, z10_fr_E1, z10_c, and z10_cobra as
+ possible values and apply them to insns as appropriate.
+ ("type" attribute): Removed itof and added ftrunctf,ftruncdf,
+ ftruncsd, ftruncdd, itoftf, itofdf, itofsf, itofdd, itoftd,
+ fdivdd, fdivtd, floaddd, floadsd, fmuldd, fmultd, fsimpdd,
+ fsimpsd, fsimptd, fstoredd, fstoresd, ftoidfp as possible
+ values.
+ ("bfp" mode attribute): Removed. Every occurence replaced
+ with <mode>.
+ * config/s390/s390.c (struct "z10_cost"): Updated entries.
+ * config/s390/2084.md (insn_reservation "x_itof"): Updated
+ type attribute.
+
+2008-08-14 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR c/28152
+ * c-parser.c (c_lex_one_token): Do not store the canonical spelling
+ for keywords.
+
+2008-08-14 Dorit Nuzman <dorit@il.ibm.com>
+
+ * tree-vect-transform.c (vect_create_epilog_for_reduction): Takes an
+ additional argument. Support reduction when duplication is needed due
+ to data-types of different sizes in the loop.
+ (get_initial_def_for_induction): Fix printout.
+ (vect_get_vec_def_for_stmt_copy): Support case where the
+ vec_stmt_for_operand is a phi node.
+ (vectorizable_reduction): Support reduction when duplication is needed
+ due to data-types of different sizes in the loop.
+ (vectorizable_call): Remove restriction to not vectorize in case we
+ have data-types of different sizes in the loop.
+ (vectorizable_conversion): Likewise.
+ (vectorizable_operation): Likewise.
+ (vectorizable_type_demotion): Likewise.
+ (vectorizable_type_promotion): Likewise.
+ (vectorizable_induction): Add restriction to not vectorize in case
+ we have data-types of different sizes in the loop.
+
+2008-08-14 Christophe Saout <christophe@saout.de>
+ Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/37101
+ * config/i386/sse.md (vec_concatv2di): Remove movlps alternative.
+ (*vec_concatv2di_rex64_sse4_1): Ditto.
+ (*vec_concatv2di_rex64_sse): Ditto.
+
+2008-08-14 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/37103
+ * fold-const.c (fold_widened_comparison): Do not allow
+ sign changes that change the result even if shorter type
+ is wider than arg1_unw's type.
+
+2008-08-13 Kazu Hirata <kazu@codesourcery.com>
+
+ * gcc.dg/arm-g2.c, gcc.dg/arm-mmx-1.c, gcc.dg/arm-scd42-2.c:
+ Skip if the multilib testing specifies -march that does not
+ agree with the one specified in the testcase.
+
+2008-08-13 Joseph Myers <joseph@codesourcery.com>
+
+ * config/sparc/sparc.c (emit_soft_tfmode_cvt): Explicitly sign or
+ zero extend SImode values being converted to TFmode before passing
+ to libcalls.
+
+2008-08-13 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
+
+ * config/rs6000/rs6000-c.c (rs6000_cpu_cpp_builtins): Predefine
+ __PPU__ when targeting the Cell/B.E. PPU processor.
+
+2008-08-13 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gimple.h (gimple_call_set_chain): Accept SSA variables.
+ * tree-ssa-pre.c (create_component_ref_by_pieces_1) <CALL_EXPR>:
+ Rematerialize the static chain, if any.
+ * tree-ssa-sccvn.c (copy_reference_ops_from_call): Also copy the
+ static chain.
+
+2008-08-13 H.J. Lu <hongjiu.lu@intel.com>
+
+ * dwarf2out.c (dwarf_stack_op_name): Remove prototype.
+ (new_loc_descr): Likewise.
+ (add_loc_descr): Likewise.
+ (size_of_loc_descr): Likewise.
+ (size_of_locs): Likewise.
+ (output_loc_operands): Likewise.
+ (output_loc_sequence): Likewise.
+ (new_reg_loc_descr): New.
+ (build_cfa_loc): Use it.
+ (build_cfa_aligned_loc): Likewise.
+ (one_reg_loc_descriptor): Likewise.
+ (based_loc_descr): Likewise.
+
+2008-08-13 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR 30551
+ * doc/invoke.texi (Wmain): Update.
+ * c-decl.c (start_decl): warn_main is only 0 or 1.
+ (start_function): Likewise. Fix formatting.
+ (finish_function): Delete redundant warning.
+ * c.opt (Wmain): Add Var(warn_main) and Init(-1).
+ * c-opts (c_common_handle_option): -Wall only has effect if
+ warn_main is uninitialized. OPT_Wmain is automatically
+ handled. -pedantic also enables Wmain.
+ (c_common_post_options): Handle all logic for Wmain here.
+ * c-common.c (warn_main): Delete.
+ (check_main_parameter_types): Make pedwarns conditional on
+ OPT_Wmain.
+ * c-common.h (warn_main): Delete.
+
+2008-08-13 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR middle-end/36701
+ * expr.c (emit_group_store): Allocate stack temp with the
+ largest alignment when copying from register to stack.
+
+2008-08-13 Richard Guenther <rguenther@suse.de>
+
+ * tree.h (maybe_fold_offset_to_address): Declare.
+ * tree-ssa-ccp.c (surely_varying_stmt_p): Fix typo in last commit.
+ (ccp_fold): Handle pointer conversions the same as fold_stmt.
+ Likewise for POINTER_PLUS_EXPR.
+ (maybe_fold_offset_to_reference): Enable disabled code.
+ (maybe_fold_offset_to_address): New function.
+ (fold_stmt_r): Use it.
+ (fold_gimple_assign): Likewise.
+ * gimplify.c (gimplify_conversion): Use maybe_fold_offset_to_address.
+ (gimplify_expr): Likewise.
+
+2008-08-13 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ * toplev.h (pedwarn_at): Fix declaration.
+
+2008-08-13 Joseph Myers <joseph@codesourcery.com>
+
+ * config/sparc/linux64.h (LINK_ARCH32_SPEC, LINK_ARCH64_SPEC,
+ LINK_SPEC): Use %R in -Y P argument.
+
+2008-08-13 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR c/15236
+ * diagnostic.c (pedwarn_at): New.
+ * toplev.h (pedwarn_at): Declare.
+ * c-tree.h (build_enumerator): Update declaration.
+ * c-decl.c (finish_enum): Update comment.
+ (build_enumerator): Take a location parameter. Give a pedwarn but do
+ not perform any conversion.
+ * c-parser.c (c_parser_enum_specifier): Set correct location for
+ enumerator.
+
+2008-08-13 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR 35635
+ * c-common.c (conversion_warning): Use a switch. Ignore boolean
+ expressions except for conversions to signed:1 bitfields. Handle
+ COND_EXPR with constant operands.
+
+2008-08-13 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/15255
+ * tree-ssa-reassoc.c (linearize_expr_tree): Declare.
+ (struct oecount_s): New struct and VEC types.
+ (cvec): New global.
+ (oecount_hash): New function.
+ (oecount_eq): Likewise.
+ (oecount_cmp): Likewise.
+ (zero_one_operation): New function.
+ (build_and_add_sum): Likewise.
+ (undistribute_ops_list): Perform un-distribution of multiplication
+ and division on the chain of summands.
+ (should_break_up_subtract): Also break up subtracts for factors.
+ (reassociate_bb): Delete dead visited statements.
+ Call undistribute_ops_list. Re-sort and optimize if it did something.
+ * passes.c (init_optimization_passes): Move DSE before
+ reassociation.
+ * tree-ssa-loop-niter.c (stmt_dominates_stmt_p): Correctly handle
+ PHI nodes.
+
+2008-08-12 Janis Johnson <janis187@us.ibm.com>
+
+ * doc/invoke.texi (-fipa-pta): Say the option is experimental.
+
+ * doc/invoke.texi: Revert unintended checkin.
+
+2008-08-12 Nathan Froyd <froydnj@codesourcery.com>
+
+ PR libgomp/26165
+ * gcc.c (include_spec_function): Tweak call to find_a_file.
+
+2008-08-12 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/37014
+ * expr.c (expand_expr_real_1): Handle TRUTH_ANDIF_EXPR
+ and TRUTH_ORIF_EXPR.
+ * dojump.c (do_jump): Likewise.
+
+ PR tree-optimization/37084
+ * tree-inline.c (copy_bb): Call gimple_regimplify_operands
+ if id->regimplify, don't assume stmt is a cast assignment.
+
+2008-08-12 Anatoly Sokolov <aesok@post.ru>
+
+ * final.c (final_scan_insn): Use app_enable/app_disable functions.
+
+2008-08-12 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
+
+ PR bootstrap/37097
+ * builtins.c (do_mpfr_bessel_n): Fix copy-and-paste bug introduced
+ by last change.
+
+2008-08-12 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
+
+ * defaults.h (TARGET_FLOAT_FORMAT): Remove.
+ (UNKNOWN_FLOAT_FORMAT, IEEE_FLOAT_FORMAT, VAX_FLOAT_FORMAT): Remove.
+
+ * config/alpha/alpha.h (TARGET_FLOAT_FORMAT): Remove.
+ * config/iq2000/iq2000.h (TARGET_FLOAT_FORMAT): Remove.
+ * config/pdp11/pdp11.h (TARGET_FLOAT_FORMAT): Remove.
+ * config/score/score.h (TARGET_FLOAT_FORMAT): Remove.
+ * config/vax/vax.h (TARGET_FLOAT_FORMAT): Remove.
+
+ * doc/tm.texi (Storage Layout): Remove documentation for
+ TARGET_FLOAT_FORMAT.
+
+ * simplify-rtx.c (simplify_binary_operation_1): Replace
+ TARGET_FLOAT_FORMAT check by appropriate HONOR_... checks.
+
+2008-08-12 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
+
+ * real.h (struct real_format): New member has_sign_dependent_rounding.
+ * real.c (ieee_single_format, mips_single_format, motorola_single_format,
+ spu_single_format, ieee_double_format, mips_double_format,
+ motorola_double_format, ieee_extended_motorola_format,
+ ieee_extended_intel_96_format, ieee_extended_intel_128_format,
+ ieee_extended_intel_96_round_53_format, ibm_extended_format,
+ mips_extended_format, ieee_quad_format, mips_quad_format,
+ vax_f_format, vax_d_format, vax_g_format): Initialize it.
+ * config/pdp11/pdp11.c (pdp11_f_format, pdp11_d_format): Likewise.
+
+ * defaults.h (MODE_HAS_NANS, MODE_HAS_INFINITIES,
+ MODE_HAS_SIGNED_ZEROS, MODE_HAS_SIGN_DEPENDENT_ROUNDING): Remove.
+ * config/spu/spu.h (MODE_HAS_NANS, MODE_HAS_INFINITIES,
+ MODE_HAS_SIGN_DEPENDENT_ROUNDING): Remove.
+ (ROUND_TOWARDS_ZERO): Likewise.
+
+ * real.h (REAL_MODE_FORMAT): Protect MODE against macro expansion.
+ (FLOAT_MODE_FORMAT): New macro.
+ (REAL_MODE_FORMAT_COMPOSITE_P): Remove, replace by ...
+ (MODE_COMPOSITE_P): ... this new macro.
+ (MODE_HAS_NANS, MODE_HAS_INFINITIES, MODE_HAS_SIGNED_ZEROS,
+ MODE_HAS_SIGN_DEPENDENT_ROUNDING): New macros.
+ * machmode.h (GET_MODE_INNER): Cast result to enum machine_mode.
+
+ * flags.h: Include "real.h".
+
+ * fold-const.c (const_binop): Use MODE_COMPOSITE_P instead of
+ REAL_MODE_FORMAT_COMPOSITE_P.
+ * simplify-rtx.c (simplify_const_binary_operation): Likewise.
+
+ * doc/tm.texi (Storage Layout): Remove documentation of
+ MODE_HAS_NANS, MODE_HAS_INFINITIES, MODE_HAS_SIGNED_ZEROS,
+ MODE_HAS_SIGN_DEPENDENT_ROUNDING. Update documentation of
+ ROUND_TOWARDS_ZERO and LARGEST_EXPONENT_IS_NORMAL to clarify
+ they only apply to libgcc2.a.
+
+2008-08-12 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
+
+ * config/spu/float_disf.c: New file.
+ * config/spu/float_unsdisf.c: New file.
+ * config/spu/t-elf (LIB2FUNCS_STATIC_EXTRA): Add them.
+ (LIB2FUNCS_EXCLUDE): Define.
+
+2008-08-12 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
+ Trevor Smigiel <trevor_smigiel@playstation.sony.com>
+
+ * real.h (struct real_format): New member round_towards_zero.
+ * real.c (round_for_format): Respect fmt->round_towards_zero.
+ (ieee_single_format, mips_single_format, motorola_single_format,
+ spu_single_format, ieee_double_format, mips_double_format,
+ motorola_double_format, ieee_extended_motorola_format,
+ ieee_extended_intel_96_format, ieee_extended_intel_128_format,
+ ieee_extended_intel_96_round_53_format, ibm_extended_format,
+ mips_extended_format, ieee_quad_format, mips_quad_format,
+ vax_f_format, vax_d_format, vax_g_format): Initialize it.
+ * config/pdp11/pdp11.c (pdp11_f_format, pdp11_d_format): Likewise.
+
+ * builtins.s (do_mpfr_arg1): Consider round_towards_zero member of
+ real_format to choose rounding mode when calling MPFR functions.
+ (do_mpfr_arg2, do_mpfr_arg3, do_mpfr_sincos): Likewise.
+ (do_mpfr_bessel_n, do_mpfr_remquo, do_mpfr_lgamma_r): Likewise.
+
+ * real.h (real_to_decimal_for_mode): Add prototype.
+ * real.c (real_to_decimal_for_mode): Renames old real_to_decimal.
+ Respect target rounding mode when generating decimal representation.
+ (real_to_decimal): New stub for backwards compatibility.
+ * c-cppbuiltin.c (builtin_define_with_hex_fp_value): Use
+ real_to_decimal_for_mode instead of real_to_decimal.
+
+ * config/spu/spu.md ("floatdisf2", "floatunsdisf2"): New.
+
+2008-08-12 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
+ Trevor Smigiel <trevor_smigiel@playstation.sony.com>
+
+ * real.c (spu_single_format): New variable.
+ * real.h (spu_single_format): Declare.
+
+ * config/spu/spu.c (spu_override_options): Install SFmode format.
+ (spu_split_immediate): Use integer mode to operate on pieces of
+ floating-point values in all cases.
+
+ * config/spu/spu.md (UNSPEC_FLOAT_EXTEND, UNSPEC_FLOAT_TRUNCATE): New.
+ ("extendsfdf2"): Use UNSPEC_FLOAT_EXTEND instead of FLOAT_EXTEND.
+ ("truncdfsf2"): Use UNSPEC_FLOAT_TRUNCATE instead of FLOAT_TRUNCATE.
+
+2008-08-12 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
+
+ * config/spu/spu.c (spu_safe_dma): Respect TARGET_SAFE_DMA.
+
+2008-08-12 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
+
+ * config/spu/spu.h (DWARF_FRAME_RETURN_COLUMN): Define.
+
+2008-08-12 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/36688
+ * gimplify.c (gimplify_modify_expr_rhs): Test TREE_READONLY
+ on the VAR_DECL instead of TYPE_READONLY on its type.
+
+2008-08-12 Ira Rosen <irar@il.ibm.com>
+
+ * tree-vectorizer.c: Depend on langhooks.h.
+ (supportable_widening_operation): Add two arguments. Support double
+ type conversions.
+ (supportable_narrowing_operation): Likewise.
+ * tree-vectorizer.h (supportable_widening_operation): Add two
+ arguments.
+ (supportable_narrowing_operation): Likewise.
+ * tree-vect-patterns.c (vect_recog_widen_mult_pattern) : Call
+ supportable_widening_operation with correct arguments.
+ * tree-vect-transform.c (vectorizable_conversion): Likewise.
+ (vectorizable_type_demotion): Support double type conversions.
+ (vectorizable_type_promotion): Likewise.
+ * Makefile.in (tree-vectorizer.o): Depend on langhooks.h.
+
+2008-08-11 Michael Matz <matz@suse.de>
+
+ * i386/i386.c (override_options): Move initialisation from
+ flag_schedule_insns_after_reload to here from ...
+ (optimization_options): ... here.
+
+2008-08-11 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/36998
+ * dwarf2out.c (compute_barrier_args_size_1,
+ compute_barrier_args_size): Temporarily remove assertions.
+
+2008-08-10 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR middle-end/20644
+ * tree-ssa.c (struct walk_data): Add new flag
+ warn_possibly_uninitialized.
+ (warn_uninitialized_var): Use it.
+ (warn_uninitialized_vars): New.
+ (execute_early_warn_uninitialized): Call it.
+ (execute_late_warn_uninitialized): Likewise.
+
+2008-08-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
+
+ PR middle-end/36238
+ * reload1.c (gen_reload): Guard calls to get_secondary_mem
+ for memory subregs.
+
+2008-08-09 Jan Hubicka <jh@suse.cz>
+
+ PR target/37055
+ * optabs.c (maybe_emit_unop_insn): Remove produced code if
+ expansion failed.
+ (expand_fix): Be prepared for expansion to fail.
+ (expand_sfix_optab): Remove instructions if expansion failed.
+
+2008-08-09 Anatoly Sokolov <aesok@post.ru>
+
+ * config/avr/avr.c (avr_mcu_types): Move the AT43USB320 device to
+ avr31 architecture.
+ * config/avr/avr.h (CRT_BINUTILS_SPECS): (Ditto.).
+ * config/avr/t-avr (MULTILIB_MATCHES): (Ditto.).
+
+2008-08-09 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * config.gcc (mips*-*-linux*, mips64*-*-linux*): Add
+ mips/t-libgcc-mips16 to tmake_file.
+ * config/mips/mips-protos.h (mips_call_type): New enum.
+ (mips_pic_base_register, mips_got_load): Declare.
+ (mips_restore_gp): Take an rtx argument.
+ (mips_use_pic_fn_addr_reg_p): Declare.
+ (mips_expand_call): Replace the sibcall_p argument with
+ a mips_call_type argument. Add a lazy_p parameter.
+ (mips_split_call): Declare.
+ * config/mips/mips.h (MIPS16_PIC_TEMP_REGNUM): New macro.
+ (MIPS16_PIC_TEMP): Likewise.
+ (reg_class): Delete M16_NA_REGS.
+ (REG_CLASS_NAMES, REG_CLASS_CONTENTS): Update accordingly.
+ (SYMBOL_FLAG_BIND_NOW, SYMBOL_REF_BIND_NOW_P): New macros.
+ (mips_split_hi_p): Declare.
+ * config/mips/mips.c (mips_split_hi_p): New array.
+ (mips_regno_to_class): Change M16_NA_REGS entries to M16_REGS.
+ (mips_got_symbol_type_p): New function.
+ (mips_global_symbol_p): Check SYMBOL_REF_EXTERNAL_P.
+ (mips16_stub_function_p): New function.
+ (mips16_local_function_p): Likewise.
+ (mips_use_pic_fn_addr_reg_p): Likewise.
+ (mips_cannot_force_const_mem): Return false for HIGHs.
+ Extend CONST_INT and symbolic handling to MIPS16, using
+ mips_symbol_insns to check that the base symbol type is a
+ legitimate constant. Reject GOT-based constants if
+ TARGET_MIPS16_PCREL_LOADS.
+ (mips_const_insns): Check targetm.cannot_force_const_mem when
+ decomposing a symbolic base and a large offset.
+ (mips_emit_call_insn): Add ORIG_ADDR and ADDR parameters.
+ When calling a function that needs $25 from MIPS16 code,
+ move the target address into $25 separately and add a USE
+ to the call insn.
+ (mips16_gp_pseudo_reg): Insert the initializer immediately
+ before the first real insn.
+ (mips_pic_base_register, mips_got_load): New functions.
+ (mips_split_symbol): Generalize the name of the LO_SUM_OUT
+ parameter to LOW_OUT. Say that it can be any valid SET_SRC
+ when splitting a load-address operation. Split SYMBOL_GOT_DISP
+ constants and highs of SYMBOL_GOT_PAGE_OFST constants.
+ (mips_call_tls_get_addr): Update the call to mips_expand_call,
+ also passing NULL_RTX rather than const0_rtx as the aux argument.
+ (mips_rewrite_small_data_p): Check mips_lo_relocs and mips_split_p
+ instead of TARGET_EXPLICIT_RELOCS.
+ (mips_ok_for_lazy_binding_p): Check SYMBOL_REF_BIND_NOW_P.
+ (mips_load_call_address): Replace the sibcall_p argument with
+ a mips_call_type argument. Use mips_got_load.
+ (mips16_local_alias): New structure.
+ (mips16_local_aliases): New variable.
+ (mips16_local_aliases_hash): New function.
+ (mips16_local_aliases_eq): Likewise.
+ (mips16_local_alias): Likewise.
+ (mips16_stub_function): Likewise.
+ (mips16_build_function_stub): Create a local alias for the target
+ function. Handle TARGET_ABICALLS. For PIC abicalls, emit a
+ .cpload directive and an R_MIPS_NONE relocation for the target
+ function, then load the alias rather than the function itself.
+ Wrap the non-PIC abicalls version in ".option pic0/.option pic2".
+ (mips16_copy_fpr_return_value): Use mips16_stub_function and
+ mips_expand_call. Set SYMBOL_REF_BIND_NOW on the symbol.
+ (mips16_build_call_stub): Replace the FN parameter with an
+ FN_PTR parameter. Force the address into a register if it
+ isn't a call_insn_operand; don't rely on the caller to do this.
+ If a call to a locally-defined and locally-binding MIPS16
+ function must be made indirectly, redirect the call to the
+ function's local alias. Use mips16_stub_function_p,
+ mips16_stub_function, mips_expand_call and use_reg.
+ Set SYMBOL_FLAG_BIND_NOW on __mips_call_* symbols.
+ Use explicit %hi and %lo accesses where possible.
+ Use MIPS_CALL to generate the correct code form of a
+ jal instruction. Add clobbers of $18 instead of uses.
+ Update the call to mips_emit_call_insn.
+ (mips_expand_call): Replace the SIBCALL_P argument with a
+ mips_call_type argument and handle the new MIPS_CALL_EPILOGUE value.
+ Take a LAZY_P parameter. Call mips16_build_call_stub first,
+ allowing it to modify the call address. Update the calls to
+ mips_load_call_address and mips_emit_call_insn.
+ (mips_split_call): New function.
+ (mips_init_relocs): Clear mips_split_hi_p. Only use %gp_rel if
+ !TARGET_MIPS16. Split SYMBOL_GOT_DISP, and the high parts of
+ SYMBOL_GOT_PAGE_OFST, for MIPS16 code.
+ (mips_global_pointer): Check mips16_cfun_returns_in_fpr_p.
+ (mips_extra_live_on_entry): Include MIPS16_PIC_TEMP_REGNUM
+ if TARGET_MIPS16.
+ (mips_cprestore_slot): New function.
+ (mips_restore_gp): Take a TEMP parameter. Handle TARGET_MIPS16
+ and use mips_cprestore_slot.
+ (mips_output_function_prologue): Handle TARGET_MIPS16 for
+ LOADGP_OLDABI.
+ (mips_emit_loadgp): Move into MIPS16_PIC_TEMP for MIPS16,
+ then use a copygp_mips16 instruction to set up $28.
+ (mips_expand_prologue): Initialize the cprestore slot for MIPS16 too.
+ (mips16_lay_out_constants): Call split_all_insns_noflow.
+ (mips_reorg_process_insns): Explicitly set all_noreorder_p to
+ false if TARGET_MIPS16.
+ (mips_reorg): Don't call vr4130_align_insns if TARGET_MIPS16.
+ (mips_output_mi_thunk): Use mips_got_symbol_type_p. Use the
+ mips_dangerous_for_la25_p approach for MIPS16 PIC calls too.
+ (mips_set_mips16_mode): Always set MASK_EXPLICIT_RELOCS for
+ MIPS16 code. Allow MIPS16 o32 PIC.
+ (mips_override_options): Allow MIPS16 o32 PIC.
+ * config/mips/mips.md: Lower CONST_GP_P moves into register moves
+ after reload if TARGET_USE_GOT.
+ (UNSPEC_COPYGP): New constant.
+ (length): Use a default length of 8 for MIPS16 GOT loads.
+ (*got_disp<mode>): Check mips_split_p instead of TARGET_XGOT.
+ (*got_page<mode>): Check mips_split_hi_p.
+ (*got_disp<mode>, *got_page<mode>): Use mips_got_load.
+ (unspec_got<mode>, unspec_call<mode>): New expanders.
+ (load_got<mode>, load_call<mode>): Remove the length attributes.
+ Use a got attribute instead of a type attribute.
+ (copygp_mips16): New insn.
+ (restore_gp): Add a scratch clobber and pass it to mips_restore_gp.
+ (load_call<mode>): Use a "d" constraint instead of an "r" constraint.
+ (sibcall, sibcall_value, call, call_value): Update the calls
+ to mips_expand_call.
+ (call_internal, call_value_internal): Use mips_split_call.
+ (call_value_multiple_internal): Likewise.
+ (call_split): Move after call_internal (the insn it is split from).
+ (call_internal_direct, call_value_internal_direct): Turn into
+ define_insn_and_splits. Split if TARGET_SPLIT_CALLS.
+ (call_direct_split, call_value_direct_split): New patterns.
+ * config/mips/constraints.md (c): Handle TARGET_MIPS16 first
+ and use M16_REGS instead of M16_NA_REGS.
+ * config/mips/predicates.md (const_call_insn_operand): Replace
+ the TARGET_ABSOLUTE_ABICALLS-based check with a more general
+ mips_use_pic_fn_addr_reg_p check.
+ (move_operand): Reject HIGHs if mips_split_hi_p.
+ * config/mips/mips16.S: Assembly as empty if the ABI is not suitable.
+ (__mips16_floatunsisf): Inline __mips16_floatsisf.
+ (CALL_STUB_NO_RET, CALL_STUB_REG): Copy the target register to $25.
+ * config/mips/libgcc-mips16.ver: New file.
+ * config/mips/t-libgcc-mips16 (SHLIB_MAPFILES): Add
+ $(srcdir)/config/mips/libgcc-mips16.ver.
+
+2008-08-09 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * config/mips/mips.c (mips_unspec_address_offset): Move earlier in file.
+ (mips_unspec_address, mips_unspec_offset_high): Likewise.
+ (mips_ok_for_lazy_binding_p, mips_load_call_address): Likewise.
+ (mips16_cfun_returns_in_fpr_p): Likewise.
+
+2008-08-09 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * config/mips/mips.h (MASK_RETURN_ADDR): Expand commentary.
+ * config/mips/linux-unwind.h (mips_fallback_frame_state): Add 2
+ rather than 4 to PC.
+
+2008-08-09 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * config/mips/mips.h (STATIC_CHAIN_REGNUM): Remap to $15.
+ (FUNCTION_PROFILER): Save the static chain pointer into $2
+ beforehand and restore it aftewards.
+ (TRAMPOLINE_TEMPLATE): Adjust accordingly. Load the target
+ address directly into $25 and call the function through $25;
+ do not clobber $3. Pad the DImode version to cover the space
+ left by the deleted $25 <- $3 move.
+ (TRAMPOLINE_SIZE): Adjust the size of the SImode version after
+ the removal of the $25 <- $3 move.
+ (INITIALIZE_TRAMPOLINE): Update offsets accordingly.
+ * config/mips/sdemtk.h (FUNCTION_PROFILER): As for mips.h.
+
+2008-08-09 Richard Sandiford <rdsandiford@googlemail.com>
+ Daniel Jacobowitz <dan@codesourcery.com>
+
+ * config/mips/mips.h (FUNCTION_NAME_ALREADY_DECLARED): Delete.
+ * config/mips/linux.h (ASM_DECLARE_FUNCTION_NAME): Delete.
+ (ASM_DECLARE_FUNCTION_SIZE, FUNCTION_NAME_ALREADY_DECLARED): Delete.
+ * config/mips/mips.c (mips_start_function_definition): New function.
+ (mips_end_function_definition): Likewise.
+ (mips_output_function_prologue): Use mips_start_function_definition.
+ (mips_output_function_epilogue): Use mips_end_function_definition.
+ (build_mips16_function_stub): Use mips_start_function_definition
+ and mips_end_function_definition.
+ (build_mips16_call_stub): Likewise.
+
+2008-08-09 Richard Guenther <rguenther@suse.de>
+
+ * gimple.c (gimple_build_call_1): Deal with FUNCTION_DECL fn.
+ * gimple.h (gimple_call_fn): Adjust comment.
+ (gimple_call_set_fndecl): New function.
+ (gimple_call_fndecl): Adjust for GIMPLE_CALL no
+ longer having bare FUNCTION_DECL operand.
+ (gimple_call_return_type): Likewise.
+ * tree-cfg.c (verify_stmt): Verify function operand of a GIMPLE_CALL.
+
+ * value-prof.c (gimple_divmod_fixed_value): Do not emit labels.
+ (gimple_mod_pow2): Likewise.
+ (gimple_mod_subtract): Likewise.
+ (gimple_ic): Likewise.
+ (gimple_stringop_fixed_value): Likewise.
+ (gimple_indirect_call_to_profile): Fix for GIMPLE_CALL no
+ longer having bare FUNCTION_DECL operand.
+ * ipa-cp.c (ipcp_update_callgraph): Use gimple_call_set_fndecl.
+ * omp-low.c (optimize_omp_library_calls): Likewise.
+ * cgraphunit.c (update_call_expr): Likewise.
+ * tree-ssa-math-opts.c (execute_cse_reciprocals): Likewise.
+ (execute_convert_to_rsqrt): Likewise.
+ * cfgexpand.c (gimple_to_tree): Simplify.
+ (release_stmt_tree): Fix for GIMPLE_CALL no longer having
+ bare FUNCTION_DECL operand.
+ * tree-nested.c (init_tmp_var_with_call): Use gimple_call_return_type.
+ (convert_gimple_call): Use gimple_call_fndecl.
+ * c-common.c (c_warn_unused_result): Likewise.
+
+2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR c/17880
+ * c-typeck.c (digest_init): Call verify_sequence_points from here.
+ (c_finish_return): Likewise.
+ (c_start_case): Likewise.
+ * c-common.c (warn_for_collisions_1): Use explicit location in
+ warning.
+ * c-parser.c (c_parser_condition): New. Call
+ verify_sequence_points.
+ (c_parser_paren_condition): Call c_parser_condition.
+ (c_parser_for_statement): Call c_parser_condition.
+
+2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR 36901
+ * diagnostic.def (DK_PEDWARN, DK_PERMERROR): New.
+ * diagnostic.c (pedantic_warning_kind, permissive_error_kind):
+ Moved from diagnostic.h
+ (diagnostic_report_diagnostic): Return bool. Handle DK_PEDWARN and
+ DK_PERMERROR.
+ (emit_diagnostic): New.
+ (warning0, pedwarn0): Delete.
+ (warning, warning_at, pedwarn, permerror): Return bool.
+ * diagnostic.h (pedantic_warning_kind, permissive_error_kind):
+ Moved to diagnostic.c.
+ (struct diagnostic_context): Use correct type for
+ classify_diagnostic.
+ (diagnostic_report_diagnostic): Update declaration.
+ (emit_diagnostic): Declare.
+ * errors.c (warning): Return bool.
+ * errors.h (warning): Update declaration.
+ * toplev.h (warning0, pedwarn0): Delete.
+ (warning, warning_at, pedwarn, permerror): Return bool.
+ * c-errors.c (pedwarn_c99, pedwarn_c90): Use DK_PEDWARN.
+ * c-decl.c (locate_old_decl): Delete 'diag' argument. Always use
+ inform. Update all calls.
+ (diagnose_mismatched_decls): Check return value of warning/pedwarn
+ before giving informative note.
+ (implicit_decl_warning): Likewise.
+ * c-typeck.c (build_function_call): Likewise.
+ * tree-sssa.c (warn_uninit): Likewise.
+ * builtins.c (gimplify_va_arg_expr): Likewise.
+
+2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR 7651
+ * doc/invoke.texi (-Wextra): Move warning from here...
+ (-Wuninitialized): ... to here.
+
+2008-08-08 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR 28875
+ * flags.h (set_Wunused): Delete
+ * toplev.c (process_options): Handle Wunused flags here.
+ * opts.c (maybe_warn_unused_parameter): Delete.
+ (common_handle_option): Replace set_Wunused by warn_unused.
+ (set_Wextra): Do not handle Wunused-parameter here.
+ (set_Wunused): Delete.
+ * c-opts.c (c_common_handle_option): Replace set_Wunused by
+ warn_unused.
+ * common.opt (Wunused): Add Var and Init.
+ (Wunused-function): Likewise.
+ (Wunused-label): Likewise.
+ (Wunused-parameter): Likewise.
+ (Wunused-value): Likewise.
+ (Wunused-variable): Likewise.
+
+2008-08-08 Peter Bergner <bergner@vnet.ibm.com>
+
+ * doc/invoke.texi: Add cpu_type power7.
+ * config.in (HAVE_AS_VSX): New.
+ * config.gcc: Add cpu_type power7.
+ * configure.ac (HAVE_AS_VSX): Check for assembler support of the
+ VSX instructions.
+ * configure: Regenerate.
+ * config/rs6000/rs6000.c (rs6000_override_options): Alias power7 to
+ power5.
+ * config/rs6000/rs6000.h (ASM_CPU_POWER7_SPEC): Define.
+ (ASM_CPU_SPEC): Pass %(asm_cpu_power7) for -mcpu=power7.
+ (EXTRA_SPECS): Add asm_cpu_power7 spec string.
+
+2008-08-08 Dorit Nuzman <dorit@il.ibm.com>
+
+ * tree-vect-transform.c (vectorizable_conversion): Pass the integral
+ type to vectorize.builtin_conversion.
+ (vectorizable_conversion): Likewise.
+ * config/i386/i386.c (ix86_vectorize_builtin_conversion): Always takes
+ integral type as input.
+ * config/rs6000/rs6000.c (rs6000_builtin_conversion): Add case for
+ FIX_TRUNC_EXPR.
+ (rs6000_expand_builtin): Add case for ALTIVEC_BUILTIN_VCTUXS
+ and ALTIVEC_BUILTIN_VCTSXS.
+ (rs6000_builtin_mul_widen_even. rs6000_builtin_mul_widen_odd): Fix
+ formatting.
+
+2008-08-08 Richard Guenther <rguenther@suse.de>
+
+ * tree-ssa-ccp.c (likely_value): Calls are not all varying.
+ (surely_varying_stmt_p): Calls are varying only if they are
+ non-builtin and not indirect or have no result.
+ (ccp_fold): Re-instantiate code before the tuples merge.
+
+2008-08-08 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/37056
+ * gimple.h (gimple_assign_rhs_class): New helper function.
+ * tree-ssa-loop-niter.c (get_val_for): Fix tuplification, handle
+ unary operations properly.
+
+2008-08-07 Jan Hubicka <jh@suse.cz>
+
+ * i386.h (ix86_size_cost): Declare.
+ (ix86_cur_cost): New function macro.
+ * i386.md (peepholes expanding size and splitters): Predicate by
+ optimize_insn_for_speed_p.
+ (peepholes reduce size and splitters): Predicate by
+ optimize_insn_for_size_p.
+ * i386.c (ix86_size_cost): Rename from ...
+ (size_cost): This one.
+ (override_options): Update.
+ (decide_alg): Likewise.
+ (ix86_expand_clear): Use RTL profile.
+ (ix86_pad_returns): Use RTL profile.
+
+2008-08-07 Jan Hubicka <jh@suse.cz>
+
+ * recog.c (split_all_insns): Set RTL profile
+ (peephole2_optimize): Likewise.
+ * function.c (thread_prologue_and_epilogue_insns): Likewise.
+ * combine.c (combine_instructions): Likewise.
+
+2008-08-07 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * c-common.c (c_common_reswords): Also warn about keyword "bool".
+
+2008-08-07 Bob Wilson <bob.wilson@acm.org>
+
+ * config/xtensa/xtensa.c (xtensa_copy_incoming_a7): Copy incoming
+ value in a6 after the set_frame_ptr insn.
+
+2008-08-07 Richard Henderson <rth@redhat.com>
+
+ PR debug/37033
+ * gcc.c (cpp_options): Pass along -g*.
+
+2008-08-07 Joseph Myers <joseph@codesourcery.com>
+
+ * config/arm/arm.c (output_move_neon): Update comment describing
+ big-endian vector layout.
+ (arm_assemble_integer): Do not handle big-endian NEON vectors
+ specially.
+ * config/arm/neon.md (vec_set<mode>_internal, vec_extract<mode>,
+ neon_vget_lane<mode>_sext_internal,
+ neon_vget_lane<mode>_zext_internal, neon_vget_lane<mode>): Adjust
+ element indices for big-endian.
+
+2008-08-07 Richard Henderson <rth@redhat.com>
+
+ * configure.ac (HAVE_GAS_CFI_PERSONALITY_DIRECTIVE): New.
+ * configure, config.in: Rebuild.
+ * debug.h (dwarf2out_do_cfi_asm): Declare.
+ * c-cppbuiltin.c (c_cpp_builtins): Use it.
+ * dwarf2out.c (dwarf2out_do_cfi_asm): New.
+ (dwarf2out_cfi_label, add_fde_cfi, output_call_frame_info,
+ dwarf2out_begin_prologue, dwarf2out_end_epilogue): Use it.
+
+2008-08-07 Joseph Myers <joseph@codesourcery.com>
+
+ * config/arm/iwmmxt.md (movv8qi_internal, movv4hi_internal,
+ movv2si_internal): Combine into mov<mode>_internal.
+ (movv2si_internal_2): Remove.
+
+2008-08-07 Jan Hubicka <jh@suse.cz>
+
+ PR target/37048
+ * i386.md (single stringop patterns): Enable unconditionally.
+
+2008-08-07 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/36992
+ * config/i386/emmintrin.h (_mm_move_epi64): Use
+ __builtin_ia32_movq128.
+
+ * config/i386/i386.c (ix86_builtins): Add IX86_BUILTIN_MOVQ128.
+ (bdesc_args): Add IX86_BUILTIN_MOVQ128.
+
+ * config/i386/sse.md (sse2_movq128): New.
+
+ * doc/extend.texi: Document __builtin_ia32_movq128.
+
+2008-08-07 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/37042
+ * tree-ssa-alias-warnings.c (nonstandard_alias_p): Ref-all
+ pointers can access anything.
+
+2008-08-06 Jan Hubicka <jh@suse.cz>
+
+ * optabs.c (emit_unop_insn): Break out to ...
+ (maybe_emit_unop_insn): ... this one.
+ (expand_sfix_optab): Use maybe variant.
+ * optabs.h (maybe_emit_unop_insn): Declare.
+
+ * i386.md (mov0 patterns): Enable by default.
+ (FP conversion expanders): Disable expansion of code expanding
+ sequences when instruction should be optimized for size.
+ (single strinop patterns): Enable when optimizing for size.
+ (string expanders): Disable expanding of code expanding sequences
+ when optimizning instruction for size.
+ * i386.c (ix86_expand_vector_move_misalign): Do code size optimization
+ per BB basis.
+ (ix86_fp_comparison_sahf_cost): Likewise.
+ (ix86_expand_branch): Likewise.
+ (ix86_expand_ashl_const): Likewise.
+ (ix86_split_ashl): Likewise.
+ (ix86_expand_strlen): Likewise.
+ (ix86_emit_fp_unordered_jump): Likewie.
+
+2008-08-06 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * c-common.c: Fix typo.
+ (c_common_reswords): Activate more C++ keyword warnings.
+
+ * matrix-reorg.c (compute_offset): Avoid C++ keywords.
+
+2008-08-06 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR 26785
+ * diagnostic.c (permerror_at): New.
+ * toplev.h (permerror_at): Declare.
+
+2008-08-06 Victor Kaplansky <victork@il.ibm.com>
+ Ira Rosen <irar@il.ibm.com>
+
+ * tree-vect-transform.c (vect_model_simple_cost): Return
+ immediately if stmt is pure SLP.
+ (vect_model_store_cost): Ditto.
+ (vect_model_load_cost): Ditto.
+ (vectorizable_store): Remove PURE_SLP check before call
+ to vect_model_store_cost.
+ (vect_model_store_cost): When checking whether stmt describe
+ strided access, add a check that it is not slp_node.
+
+2008-08-06 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR 8715
+ * c-common.c (warn_for_sign_compare): New. Handle separately the
+ case that 'constant' is zero.
+ * c-typeck.c (build_binary_op): Move code to c-common.c
+
+2008-08-06 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * config/alpha/alpha.c (alpha_preferred_reload_class,
+ alpha_secondary_reload, alpha_emit_set_const_1, function_value,
+ alpha_output_mi_thunk_osf): Avoid C++ keywords.
+ * config/arm/arm.c (output_move_vfp, output_move_neon): Likewise.
+ * config/arm/arm.md: Likewise.
+ * config/avr/avr-protos.h (preferred_reload_class,
+ test_hard_reg_class, avr_simplify_comparison_p,
+ out_shift_with_cnt, class_max_nregs): Likewise.
+ * config/avr/avr.c (class_max_nregs, avr_simplify_comparison_p,
+ output_movqi, output_movhi, output_movsisf, out_shift_with_cnt,
+ preferred_reload_class, test_hard_reg_class): Likewise.
+ * config/bfin/bfin.c (legitimize_pic_address, hard_regno_mode_ok,
+ bfin_memory_move_cost, bfin_secondary_reload,
+ bfin_output_mi_thunk): Likewise.
+ * config/crx/crx.c (crx_secondary_reload_class,
+ crx_memory_move_cost): Likewise.
+ * config/frv/frv-protos.h (frv_secondary_reload_class,
+ frv_class_likely_spilled_p, frv_class_max_nregs): Likewise.
+ * config/frv/frv.c (frv_override_options, frv_alloc_temp_reg,
+ frv_secondary_reload_class, frv_class_likely_spilled_p,
+ frv_class_max_nregs): Likewise.
+ * config/h8300/h8300.c (h8300_classify_operand,
+ h8300_unary_length, h8300_bitfield_length, h8300_asm_insn_count):
+ Likewise.
+ * config/i386/winnt.c (i386_pe_declare_function_type): Likewise.
+ * config/ia64/ia64.c (ia64_preferred_reload_class,
+ ia64_secondary_reload_class, ia64_output_mi_thunk): Likewise.
+ * config/iq2000/iq2000.c (gen_int_relational): Likewise.
+ * config/m32c/m32c.c (class_can_hold_mode, m32c_output_compare):
+ Likewise.
+ * config/m68hc11/m68hc11.c (preferred_reload_class,
+ m68hc11_memory_move_cost): Likewise.
+ * config/mcore/mcore.c (mcore_secondary_reload_class,
+ mcore_reload_class): Likewise.
+ * config/mips/mips.c (mips_hard_regno_mode_ok_p,
+ mips_class_max_nregs, mips_cannot_change_mode_class,
+ mips_preferred_reload_class, mips_secondary_reload_class,
+ mips_output_mi_thunk): Likewise.
+ * config/mmix/mmix.c (mmix_preferred_reload_class,
+ mmix_preferred_output_reload_class, mmix_secondary_reload_class):
+ Likewise.
+ * config/mn10300/mn10300.c (mn10300_secondary_reload_class):
+ Likewise.
+ * config/pa/pa.c (pa_secondary_reload, pa_combine_instructions,
+ pa_can_combine_p, pa_cannot_change_mode_class): Likewise.
+ * config/pa/pa.h (LEGITIMIZE_RELOAD_ADDRESS): Likewise.
+ * config/rs6000/rs6000.c (paired_expand_vector_init,
+ rs6000_secondary_reload_class, rs6000_output_mi_thunk,
+ compare_section_name, rs6000_memory_move_cost): Likewise.
+ * config/s390/s390.c (s390_emit_compare_and_swap,
+ s390_preferred_reload_class, s390_secondary_reload,
+ legitimize_pic_address, legitimize_tls_address,
+ legitimize_reload_address, s390_expand_cs_hqi, s390_expand_atomic,
+ s390_class_max_nregs): Likewise.
+ * config/s390/s390.h (LEGITIMIZE_RELOAD_ADDRESS): Likewise.
+ * config/s390/s390.md: Likewise.
+ * config/score/score-protos.h (score_secondary_reload_class,
+ score_preferred_reload_class): Likewise.
+ * config/score/score.c (score_preferred_reload_class,
+ score_secondary_reload_class): Likewise.
+ * config/score/score3.c (score3_output_mi_thunk,
+ score3_preferred_reload_class, score3_secondary_reload_class,
+ score3_hard_regno_mode_ok): Likewise.
+ * config/score/score3.h (score3_preferred_reload_class,
+ score3_secondary_reload_class): Likewise.
+ * config/score/score7.c (score7_output_mi_thunk,
+ score7_preferred_reload_class, score7_secondary_reload_class,
+ score7_hard_regno_mode_ok): Likewise.
+ * config/score/score7.h (score7_preferred_reload_class,
+ score7_secondary_reload_class): Likewise.
+ * config/sh/sh.c (prepare_move_operands, output_far_jump,
+ output_branchy_insn, add_constant, gen_block_redirect,
+ sh_insn_length_adjustment, sh_cannot_change_mode_class,
+ sh_output_mi_thunk, replace_n_hard_rtx, sh_secondary_reload):
+ Likewise.
+ * config/sparc/sparc.c (sparc_output_mi_thunk): Likewise.
+ * config/stormy16/stormy16.c (xstormy16_output_cbranch_hi,
+ xstormy16_output_cbranch_si, xstormy16_secondary_reload_class,
+ xstormy16_preferred_reload_class): Likewise.
+ * config/xtensa/xtensa.c (xtensa_expand_compare_and_swap,
+ xtensa_expand_atomic, override_options,
+ xtensa_preferred_reload_class, xtensa_secondary_reload_class):
+ Likewise.
+ * reorg.c (try_merge_delay_insns): Likewise.
+ * tree.c (merge_dllimport_decl_attributes): Likewise.
+
+ * config/frv/frv.c (frv_print_operand): Change isalpha to ISALPHA.
+
+2008-08-06 Michael Matz <matz@suse.de>
+
+ * Makefile.in (write_entries_to_file): Quote words.
+ * gengtype.c: (read_input_line): Skip over leading white-space.
+
+2008-08-06 Marc Gauthier <marc@tensilica.com>
+
+ * config.gcc: Match more processor names for Xtensa.
+ * configure.ac: Likewise.
+ * doc/install.texi (Specific): Likewise.
+ * configure: Regenerate.
+
+2008-08-06 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * builtins.c (expand_builtin_profile_func): Avoid C++ keywords.
+ * calls.c (avoid_likely_spilled_reg): Likewise.
+ * cfgexpand.c (gimple_assign_rhs_to_tree): Likewise.
+ * cgraph.c (cgraph_clone_edge, cgraph_clone_node): Likewise.
+ * config/i386/i386.c (ix86_expand_special_args_builtin,
+ ix86_secondary_reload): Likewise.
+ * except.c (struct eh_region, gen_eh_region_catch,
+ remove_unreachable_regions, duplicate_eh_regions,
+ assign_filter_values, build_post_landing_pads,
+ sjlj_find_directly_reachable_regions, remove_eh_handler,
+ reachable_next_level, foreach_reachable_handler,
+ can_throw_internal_1, can_throw_external_1,
+ collect_one_action_chain): Likewise.
+ * expr.c (expand_expr_real_1, vector_mode_valid_p): Likewise.
+ * fold-const.c (twoval_comparison_p, eval_subst): Likewise.
+ * function.c (update_temp_slot_address, instantiate_new_reg,
+ instantiate_virtual_regs_in_rtx,
+ instantiate_virtual_regs_in_insn): Likewise.
+ * gimple.c (extract_ops_from_tree, gimple_seq_copy): Likewise.
+ * gimplify.c (gimplify_call_expr, gimplify_init_constructor,
+ gimplify_cleanup_point_expr): Likewise.
+ * ipa-cp.c (ipcp_lattice_changed): Likewise.
+ * passes.c (next_pass_1): Likewise.
+ * print-tree.c (print_node_brief, print_node): Likewise.
+ * profile.c (branch_prob): Likewise.
+ * tree-dump.c (dump_register): Likewise.
+ * tree-eh.c (replace_goto_queue_cond_clause, lower_catch):
+ Likewise.
+ * tree-inline.c (remap_ssa_name, remap_type_1, remap_blocks,
+ copy_statement_list, remap_gimple_op_r, copy_tree_body_r,
+ copy_edges_for_bb, copy_cfg_body, copy_tree_r,
+ copy_arguments_for_versioning, copy_static_chain): Likewise.
+ * tree-into-ssa.c (names_replaced_by, add_to_repl_tbl,
+ add_new_name_mapping, register_new_name_mapping): Likewise.
+ * tree-mudflap.c (mf_xform_derefs): Likewise.
+ * tree-predcom.c (struct chain, dump_chain, replace_ref_with,
+ get_init_expr, combine_chains): Likewise.
+ * tree-pretty-print.c (dump_generic_node): Likewise.
+ * tree-ssa-structalias.c (create_variable_info_for): Likewise.
+ * tree-vrp.c (simplify_cond_using_ranges): Likewise.
+ * tree.c (substitute_in_expr, iterative_hash_expr): Likewise.
+ * value-prof.c (gimple_duplicate_stmt_histograms): Likewise.
+
+2008-08-06 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR middle-end/37010
+ * calls.c (expand_call): Use the biggest preferred stack
+ boundary.
+
+2008-08-06 Michael Matz <matz@suse.de>
+
+ PR target/36613
+ * reload.c (push_reload): Merge in,out,in_reg,out_reg members
+ for reused reload, instead of overwriting them.
+
+2008-08-06 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR middle-end/37009
+ * cfgexpand.c (expand_stack_alignment): Check parm_stack_boundary
+ for incoming stack boundary.
+
+ * function.c (assign_parm_find_entry_rtl): Update
+ parm_stack_boundary.
+
+ * function.h (rtl_data): Add parm_stack_boundary.
+
+ * config/i386/i386.c (ix86_finalize_stack_realign_flags): Check
+ parm_stack_boundary for incoming stack boundary.
+
+2008-08-06 Joseph Myers <joseph@codesourcery.com>
+
+ * jump.c (rtx_renumbered_equal_p): Do not call subreg_regno_offset
+ for unrepresentable subregs or treat them as equal to other regs
+ or subregs with the same register number.
+
+2008-08-06 Aldy Hernandez <aldyh@redhat.com>
+
+ PR middle-end/35432
+ * gimplify.c (gimplify_modify_expr): Do not optimize zero-sized types
+ if want_value.
+
+2008-08-06 Jan Hubicka <jh@suse.cz>
+
+ * predict.c (maybe_hot_frequency_p): When profile is absent, all
+ frequencies might be hot.
+
+2008-08-06 Andreas Krebbel <krebbel1@de.ibm.com>
+
+ * reload.c (find_reloads): Force constants into literal pool
+ also if they are wrapped in a SUBREG.
+
+2008-08-06 Maxim Kuvyrkov <maxim@codesourcery.com>
+
+ PR target/35659
+ * haifa-sched.c (sched_insn_is_legitimate_for_speculation_p): Move ...
+ * sched-deps.c (sched_insn_is_legitimate_for_speculation_p): ... here.
+ Don't allow predicated instructions for data speculation.
+ * sched-int.h (sched_insn_is_legitimate_for_speculation_p): Move
+ declaration.
+
+2008-08-06 Maxim Kuvyrkov <maxim@codesourcery.com>
+
+ * haifa-sched.c (extend_global): Split to extend_global_data and
+ extend_region_data. Update all uses.
+ (extend_all): Rename to extend_block_data.
+
+2008-08-06 Maxim Kuvyrkov <maxim@codesourcery.com>
+
+ * sched-rgn.c (new_ready): Check if instruction can be
+ speculatively scheduled before attempting speculation.
+ (debug_rgn_dependencies): Remove wrongful assert.
+
+2008-08-05 Bob Wilson <bob.wilson@acm.org>
+
+ * config/xtensa/t-xtensa: Remove dependency for gt-xtensa.h.
+
+2008-08-05 Bob Wilson <bob.wilson@acm.org>
+
+ * config/xtensa/xtensa.c (xtensa_va_start): Unshare valist.
+ (xtensa_gimplify_va_arg_expr): Unshare valist, orig_ndx, ndx, array,
+ va_size, and type_size.
+
+2008-08-04 Jason Merrill <jason@redhat.com>
+
+ PR c++/37016
+ * tree-ssa.c (useless_type_conversion_p_1): Call langhook
+ if TYPE_STRUCTURAL_EQUALITY_P is true for both types.
+
+2008-08-05 Richard Henderson <rth@redhat.com>
+
+ * configure.ac (HAVE_GAS_CFI_DIRECTIVE): Check .cfi_personality.
+ * configure: Rebuild.
+
+2008-08-05 Andrew Pinski <andrew_pinski@playstation.sony.com>
+
+ PR tree-opt/37024
+ * tree-tailcall.c (process_assignment): Use gimple_assign_cast_p
+ instead of IS_CONVERT_EXPR_CODE_P for seeing if the assignment
+ is a conversion.
+
+2008-08-05 Richard Henderson <rth@redhat.com>
+
+ * Makefile.in (c-cppbuiltin.o): Depend on debug.h.
+ * c-cppbuiltin.c (c_cpp_builtins): Define __GCC_HAVE_DWARF2_CFI_ASM.
+ * doc/cpp.texi (__GCC_HAVE_DWARF2_CFI_ASM): Document it.
+ * common.opt (fdwarf2-cfi-asm): New.
+ * configure.ac (HAVE_GAS_CFI_DIRECTIVE): New.
+ * config.in, configure: Rebuild.
+ * dwarf2asm.c (dw2_asm_output_data_raw): New.
+ (dw2_asm_output_data_uleb128_raw, dw2_asm_output_data_sleb128_raw): New.
+ (dw2_force_const_mem): Externalize.
+ * dwarf2asm.h: Update.
+ * dwarf2out.c (dwarf2out_cfi_label): If flag_dwarf2_cfi_asm, don't
+ generate a real label.
+ (output_cfi_directive): New.
+ (add_fde_cfi): If flag_dwarf2_cfi_asm, use it.
+ (output_call_frame_info): Do nothing if flag_dwarf2_cfi_asm.
+ (dwarf2out_begin_prologue): Emit .cfi_startproc, .cfi_personality,
+ and .cfi_lsda.
+ (dwarf2out_end_epilogue): Emit .cfi_endproc.
+ (output_loc_operands_raw, output_loc_sequence_raw): New.
+ (output_cfa_loc_raw): New.
+
+2008-08-05 Paul Brook <paul@codesourcery.com>
+
+ * doc/invoke.texi: Document new ARM -mfpu= and -mcpu= options.
+ * config/arm/arm.c (all_fpus): Add vfpv3 and vfpv3-d16.
+ (fp_model_for_fpu): Add entry for FPUTYPE_VFP3D16.
+ (arm_file_start): Add FPUTYPE_VFP3D16. Rename vfp3 to vfpv3.
+ * config/arm/arm.h (TARGET_VFPD32): Define.
+ (TARGET_VFP3): Use TARGET_VFPD32.
+ (fputype): Add FPUTYPE_VFP3D16.
+ (LAST_VFP_REGNUM): Use TARGET_VFPD32.
+ * config/arm/constraints.md ("w"): Use TARGET_VFPD32.
+ * config/arm/arm-cores.def: Add cortex-r4f.
+ * config/arm/arm-tune.md: Regenerate.
+
+2008-08-05 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
+
+ * config/spu_spu_mfcio.h: Wrap in extern "C" if __cplusplus.
+ Reword some comments throughout the file.
+
+ (MFC_MIN_DMA_LIST_ELEMENTS): New define.
+ (MFC_MAX_DMA_LIST_ELEMENTS): Likewise.
+ (MFC_MIN_DMA_LIST_SIZE): Redefine in terms of MFC_MIN_DMA_LIST_ELEMENTS.
+ (MFC_MAX_DMA_LIST_SIZE): Redefine in terms of MFC_MAX_DMA_LIST_ELEMENTS.
+
+ (MFC_START_ENABLE): Remove PPU-only define.
+ (MFC_PUTS_CMD, MFC_PUTFS_CMD, MFC_PUTBS_CMD): Likewise.
+ (MFC_GETS_CMD, MFC_GETFS_CMD, MFC_GETBS_CMD): Likewise.
+
+ (MFC_PUTB_CMD, MFC_PUTF_CMD): Reimplement using symbolic constants.
+ (MFC_PUTL_CMD, MFC_PUTLB_CMD, MFC_PUTLF_CMD): Likewise.
+ (MFC_PUTR_CMD, MFC_PUTRB_CMD, MFC_PUTRF_CMD): Likewise.
+ (MFC_PUTRL_CMD, MFC_PUTRLB_CMD, MFC_PUTRLF_CMD): Likewise.
+ (MFC_GETB_CMD, MFC_GETF_CMD): Likewise.
+ (MFC_GETL_CMD, MFC_GETLB_CMD, MFC_GETLF_CMD): Likewise.
+ (MFC_SNDSIGB_CMD, MFC_SNDSIGF_CMD): Likewise.
+
+ (MFC_SDCRT_CMD, MFC_SDCRTST_CMD): New defines.
+ (MFC_SDCRZ_CMD, MFC_SDCRST_CMD, MFC_SDCRF_CMD): Likewise.
+ (mfc_sdcrt, mfc_sdcrtst): Likewise.
+ (mfc_sdcrz, mfc_sdcrst, mfc_sdcrf): Likewise.
+
+ (spu_read_machine_status): Fix typo.
+
+2008-08-05 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
+
+ * config/spu/spu.h (CANNOT_CHANGE_MODE_CLASS): Allow (multi)word-sized
+ SUBREG of multi-word hard register.
+ * config/spu/spu.c (valid_subreg): Likewise.
+ (adjust_operand): Handle SUBREGs of multi-word hard registers.
+
+2008-08-04 Richard Guenther <rguenther@suse.de>
+
+ * tree-ssa-loop-ivopts.c (add_iv_value_candidates): Also add
+ the candidate with the stripped base if that base is different
+ from the original base even for offset zero.
+
+2008-08-04 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/36691
+ * tree-ssa-loop-niter.c (number_of_iterations_lt_to_ne): Correctly
+ check for no_overflow.
+
+2008-08-04 Richard Guenther <rguenther@suse.de>
+
+ * tree-vect-transform.c (vectorizable_call): Fix tuplification.
+
+2008-08-04 Paul Brook <paul@codesourcery.com>
+
+ * cofig/arm/arm.c (thumb_core_reg_alloc_order): New.
+ (arm_order_regs_for_local_alloc): New function.
+ * config/arm/arm-protos.h (arm_order_regs_for_local_alloc): Add
+ prototype.
+ * config/arm/arm.h (ORDER_REGS_FOR_LOCAL_ALLOC): Define.
+
+2008-08-04 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/37012
+ * config/i386/i386.c (ix86_expand_prologue): Use UNITS_PER_WORD
+ instead of STACK_BOUNDARY / BITS_PER_UNIT to align stack.
+ (ix86_expand_epilogue): Likewise.
+
+2008-08-04 H.J. Lu <hongjiu.lu@intel.com>
+
+ * config/i386/i386.c (ix86_compute_frame_layout): Fix a typo
+ in comments.
+
+2008-08-03 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/i386/mmx.md (*mov<mode>_internal_rex64): Use Yi instead of x
+ to avoid inter-unit moves for !TARGET_INTER_UNIT_MOVES.
+ (*movv2sf_internal_rex64): Ditto.
+
+2008-08-03 Jan Hubicka <jh@suse.cz>
+
+ * optabs.c (expand_binop, expand_builtin_pow, expand_builtin_powi,
+ expand_builtin_strcat): Upse optimize_insn_for_speed predicate.
+ * expmed.c (expand_smod_pow2): Likewise.
+
+2008-08-03 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/36992
+ * config/i386/sse.md (vec_concatv2di): Add Y2 constraint to
+ alternative 0 of operand 1.
+ (*vec_concatv2di_rex64_sse): Ditto.
+ (*vec_concatv2di_rex64_sse4_1): Add x constraint to alternative 0
+ of operand 1.
+ (*sse2_storeq_rex64): Penalize allocation of "r" registers.
+ * config/i386/mmx.md (*mov<mode>_internal_rex64): Penalize allocation
+ of "Y2" registers to avoid SSE <-> MMX conversions for DImode moves.
+ (*movv2sf_internal_rex64): Ditto.
+
+2008-08-02 Richard Guenther <rguenther@suse.de>
+
+ PR target/35252
+ * config/i386/sse.md (SSEMODE4S, SSEMODE2D): New mode iterators.
+ (ssedoublesizemode): New mode attribute.
+ (sse_shufps): Call gen_sse_shufps_v4sf.
+ (sse_shufps_1): Macroize.
+ (sse2_shufpd): Call gen_Sse_shufpd_v2df.
+ (sse2_shufpd_1): Macroize.
+ (vec_extract_odd, vec_extract_even): New expanders.
+ (vec_interleave_highv4sf, vec_interleave_lowv4sf,
+ vec_interleave_highv2df, vec_interleave_lowv2df): Likewise.
+ * i386.c (ix86_expand_vector_init_one_nonzero): Call
+ gen_sse_shufps_v4sf instead of gen_sse_shufps_1.
+ (ix86_expand_vector_set): Likewise.
+ (ix86_expand_reduc_v4sf): Likewise.
+
+2008-08-01 Doug Kwan <dougkwan@google.com>
+
+ * matrix-reorg.c: Re-enable all code.
+ (struct malloc_call_data): Change CALL_STMT to gimple type.
+ (collect_data_for_malloc_call): Tuplify.
+ (struct access_site_info): Change STMT to gimple type.
+ (struct matrix_info): Change MIN_INDIRECT_LEVEL_ESCAPE_STMT,
+ and MALLOC_FOR_LEVEL to gimple and gimple pointer type.
+ (struct free_info): Change STMT to gimple type.
+ (struct matrix_access_phi_node): Change PHI to gimple type.
+ (get_inner_of_cast_expr): Remove.
+ (may_flatten_matrices_1): Tuplify.
+ (may_flatten_matrices): Ditto.
+ (mark_min_matrix_escape_level): Ditto.
+ (ssa_accessed_in_tree): Refactor statement RHS related code into ...
+ (ssa_accessed_in_call_rhs): New
+ (ssa_accessed_in_assign_rhs): New
+ (record_access_alloc_site_info): Tuplify.
+ (add_allocation_site): Ditto.
+ (analyze_matrix_allocation_site): Ditto.
+ (analyze_transpose): Ditto.
+ (get_index_from_offset): Ditto.
+ (update_type_size): Ditto.
+ (analyze_accesses_for_call_expr): Tuplify and renamed into ...
+ (analyze_accesses_for_call_stmt): New. Also handle LHS of a call.
+ (analyze_accesses_for_phi_node): Tuplify.
+ (analyze_accesses_for_modify_stmt): Tuplify and renamed into ...
+ (analyze_accesses_for_assign_stmt): Remove code for handling call LHS.
+ (analyze_matrix_accesses): Tuplify.
+ (check_var_data): New call-back type for check_var_notmodified_p.
+ (check_var_notmodified_p): Tuplify and use call-back struct to
+ return statement found.
+ (can_calculate_expr_before_stmt): Factor out statement related code
+ into ...
+ (can_calculate_stmt_before_stmt): New.
+ (check_allocation_function): Tuplify.
+ (find_sites_in_func): Ditto.
+ (record_all_accesses_in_func): Ditto.
+ (transform_access_sites): Ditto.
+ (transform_allocation_sites): Ditto.
+ (matrix_reorg): Re-enable.
+ (gate_matrix_reorg): Re-enable.
+
+2008-08-01 Jakub Jelinek <jakub@redhat.com>
+
+ * dwarf2out.c (compute_barrier_args_size): Set barrier_args_size
+ for labels for which it hasn't been set yet. If it has been set,
+ stop walking insns and continue with next worklist item.
+ (dwarf2out_stack_adjust): Don't call compute_barrier_args_size
+ if the only BARRIER is at the very end of a function.
+
+2008-08-01 H.J. Lu <hongjiu.lu@intel.com>
+
+ * cfgexpand.c (expand_stack_alignment): Assert that
+ stack_realign_drap and drap_rtx must match.
+
+ * function.c (instantiate_new_reg): If DRAP is used to realign
+ stack, replace virtual_incoming_args_rtx with internal arg
+ pointer.
+
+2008-08-01 Richard Guenther <rguenther@suse.de>
+
+ * tree-ssa-pre.c (fini_pre): Take in_fre parameter. Free
+ loop information only if we initialized it.
+ (execute_pre): Call fini_pre with in_fre.
+ * tree-ssa-loop-ivcanon (try_unroll_loop_completely): Dump
+ if we do not unroll because we hit max-completely-peeled-insns.
+ Use our estimation for consistency, do allow shrinking.
+
+2008-08-01 H.J. Lu <hongjiu.lu@intel.com>
+
+ * config/i386/i386.c (override_options): Replace ABI_STACK_BOUNDARY
+ with MIN_STACK_BOUNDARY.
+ (ix86_update_stack_boundary): Likewise.
+ (ix86_expand_prologue): Assert MIN_STACK_BOUNDARY instead of
+ STACK_BOUNDARY.
+
+ * config/i386/i386.h (ABI_STACK_BOUNDARY): Renamed to ...
+ (MIN_STACK_BOUNDARY): This.
+
+2008-08-01 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/36997
+ * gimplify.c (gimplify_call_expr): Set error_mark_node on GS_ERROR.
+
+2008-08-01 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/36988
+ * tree-ssa-ccp.c (ccp_fold): Conversions of constants only
+ do not matter if that doesn't change volatile qualification.
+
+2008-08-01 Paolo Bonzini <bonzini@gnu.org>
+
+ * configure.ac: Do not generate libada-mk. Do not subst
+ host_cc_for_libada.
+ * libada-mk.in: Remove.
+ * Makefile.in: Pass TARGET_LIBGCC2_CFLAGS to libgcc.mvars.
+ * configure: Regenerate.
+
+2008-08-01 Basile Starynkevitch <basile@starynkevitch.net>
+
+ * tree-pass.h: Added comment about not dumping passes with name
+ starting with star in struct opt_pass.
+ * passes.c (register_dump_files_1): Don't do dump for a pass with
+ name starting with star.
+ * doc/passes.texi (Pass manager): Mention pass names and special
+ meaning of star prefix to avoid dump.
+
+2008-07-31 Adam Nemet <anemet@caviumnetworks.com>
+
+ * config.gcc (mipsisa64r2*-*-linux*): New configuration. Set ISA
+ to MIPS64r2.
+ * config/mips/mips.h (GENERATE_MIPS16E): Update comment.
+ (ISA_MIPS64R2): New macro.
+ (TARGET_CPU_CPP_BUILTINS, MULTILIB_ISA_DEFAULT): Handle it.
+ (ISA_HAS_64BIT_REGS, ISA_HAS_MUL3, ISA_HAS_FP_CONDMOVE,
+ ISA_HAS_8CC, ISA_HAS_FP4, ISA_HAS_PAIRED_SINGLE,
+ ISA_HAS_MADD_MSUB, ISA_HAS_NMADD4_NMSUB4, ISA_HAS_CLZ_CLO,
+ ISA_HAS_ROR, ISA_HAS_PREFETCH, ISA_HAS_PREFETCHX, ISA_HAS_SEB_SEH,
+ ISA_HAS_EXT_INS, ISA_HAS_MXHC1, ISA_HAS_HILO_INTERLOCKS,
+ ISA_HAS_SYNCI, MIN_FPRS_PER_FMT): Return true for ISA_MIPS64R2.
+ (MIPS_ISA_LEVEL_SPEC, ASM_SPEC, LINK_SPEC): Handle -mips64r2.
+ (TARGET_LOONGSON_2E, TARGET_LOONGSON_2F, TARGET_LOONGSON_2EF):
+ Move up to keep list alphabetically sorted.
+ (TUNE_20KC, TUNE_24K, TUNE_74K, TUNE_LOONGSON_2EF): Likewise.
+ * config/mips/mips.c (mips_cpu_info_table): Add default MIPS64r2
+ processor.
+ * doc/invoke.texi (MIPS Options): Add -mips64r2.
+ (-march=@var{arch}): Add mips64r2.
+
+2008-07-31 H.J. Lu <hongjiu.lu@intel.com>
+
+ * config/i386/darwin.h (MAIN_STACK_BOUNDARY): Define to 128.
+
+2008-07-31 Steve Ellcey <sje@cup.hp.com>
+
+ * expr.c (expand_assignment): Check for complete type.
+
+2008-07-31 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR debug/36977
+ * cfgexpand.c (expand_stack_alignment): Set stack_realign_tried.
+
+ * dwarf2out.c (based_loc_descr): Check crtl->stack_realign_tried
+ for stack alignment.
+
+ * function.h (rtl_data): Add stack_realign_tried. Update comments.
+
+2008-07-31 Kaz Kojima <kkojima@gcc.gnu.org>
+
+ * config/sh/sh.c (sh_canonical_va_list_type): Remove.
+ (TARGET_CANONICAL_VA_LIST_TYPE): Remove.
+
+2008-07-31 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/36419
+ * dwarf2out.c (barrier_args_size): New variable.
+ (compute_barrier_args_size, compute_barrier_args_size_1): New
+ functions.
+ (dwarf2out_stack_adjust): For BARRIERs call compute_barrier_args_size
+ if not called yet in the current function, use barrier_args_size
+ array to find the new args_size value.
+ (dwarf2out_frame_debug): Free and clear barrier_args_size.
+
+2008-07-31 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR debug/36980
+ * dwarf2out.c (dwarf2out_frame_debug_expr): Move rule 17 before
+ rule 19.
+
+2008-07-31 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR debug/36976
+ * dwarf2out.c (dwarf2out_args_size_adjust): New.
+ (dwarf2out_stack_adjust): Use it.
+ (dwarf2out_frame_debug_expr): Likewise.
+
+2008-07-31 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/36978
+ * tree-ssa-loop-unswitch.c (tree_may_unswitch_on): Do not fold
+ the generated condition.
+
+2008-07-31 Richard Guenther <rguenther@suse.de>
+
+ * passes.c (init_optimization_passes): Always call
+ pass_early_warn_uninitialized.
+ * opts.c (decode_options): Do not warn about -Wuninitialized at -O0.
+ * doc/invoke.texi (-Wuninitialized): Correct for enabling at -O0.
+ * doc/passes.texi (Warn for uninitialized variables): Adjust.
+
+2008-07-31 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/36970
+ * builtins.c (maybe_emit_free_warning): New function.
+ (expand_builtin): Process BUILT_IN_FREE even at -O0. Call
+ maybe_emit_free_warning for BUILT_IN_FREE.
+
+ PR debug/36278
+ * dwarf2out.c (get_context_die): New function.
+ (force_decl_die, force_type_die): Use it.
+ (dwarf2out_imported_module_or_decl): Likewise. If base_type_die
+ returns NULL, force generation of DW_TAG_typedef and put that into
+ DW_AT_import.
+
+ PR preprocessor/36649
+ * c-pch.c (c_common_read_pch): Save and restore
+ line_table->trace_includes across PCH restore.
+
+2008-07-30 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR ada/36554
+ * dwarf2out.c (is_subrange_type): Deal with BOOLEAN_TYPE.
+
+2008-07-30 Rafael Avila de Espindola <espindola@google.com>
+
+ PR 36974
+ * final.c (call_from_call_insn): Handle COND_EXEC.
+
+2008-07-30 H.J. Lu <hongjiu.lu@intel.com>
+
+ * builtins.c (std_gimplify_va_arg_expr): Replace
+ PREFERRED_STACK_BOUNDARY with MAX_SUPPORTED_STACK_ALIGNMENT.
+ * config/i386/i386.c (ix86_gimplify_va_arg): Likewise.
+
+2008-07-30 Joey Ye <joey.ye@intel.com>
+ H.J. Lu <hongjiu.lu@intel.com>
+
+ * builtins.c (expand_builtin_setjmp_receiver): Replace
+ virtual_incoming_args_rtx with crtl->args.internal_arg_pointer.
+ (expand_builtin_apply_args_1): Likewise.
+ (expand_builtin_longjmp): Need DRAP for stack alignment.
+ (expand_builtin_apply): Likewise.
+
+ * caller-save.c (setup_save_areas): Call assign_stack_local_1
+ instead of assign_stack_local to allow alignment reduction.
+
+ * calls.c (emit_call_1): Need DRAP for stack alignment if
+ return pops.
+ (expand_call): Replace virtual_incoming_args_rtx with
+ crtl->args.internal_arg_pointer.
+ * stmt.c (expand_nl_goto_receiver): Likewise.
+
+ * cfgexpand.c (get_decl_align_unit): Estimate stack variable
+ alignment and store to stack_alignment_estimated and
+ max_used_stack_slot_alignment.
+ (expand_one_var): Likewise.
+ (expand_stack_alignment): New function.
+ (tree_expand_cfg): Initialize max_used_stack_slot_alignment
+ and stack_alignment_estimated fields in rtl_data. Call
+ expand_stack_alignment at end.
+
+ * defaults.h (INCOMING_STACK_BOUNDARY): New.
+ (MAX_STACK_ALIGNMENT): Likewise.
+ (MAX_SUPPORTED_STACK_ALIGNMENT): Likewise.
+ (SUPPORTS_STACK_ALIGNMENT): Likewise.
+
+ * emit-rtl.c (gen_reg_rtx): Estimate stack alignment for
+ stack alignment when generating virtual registers.
+
+ * function.c (assign_stack_local): Renamed to ...
+ (assign_stack_local_1): This. Add a parameter to indicate
+ if it is OK to reduce alignment.
+ (assign_stack_local): Use it.
+ (instantiate_new_reg): Instantiate virtual incoming args rtx
+ to vDRAP if stack realignment and DRAP is needed.
+ (assign_parms): Collect parameter/return type alignment and
+ contribute to stack_alignment_estimated.
+ (locate_and_pad_parm): Likewise.
+ (get_arg_pointer_save_area): Replace virtual_incoming_args_rtx
+ with crtl->args.internal_arg_pointer.
+
+ * function.h (rtl_data): Add new field drap_reg,
+ max_used_stack_slot_alignment, stack_alignment_estimated,
+ stack_realign_needed, need_drap, stack_realign_processed and
+ stack_realign_finalized.
+ (stack_realign_fp): New macro.
+ (stack_realign_drap): Likewise.
+
+ * global.c (compute_regsets): Frame pointer is needed when
+ stack is realigned. Can eliminate frame pointer when stack is
+ realigned and dynamic realigned argument pointer isn't used.
+
+ * reload1.c (update_eliminables): Frame pointer is needed
+ when stack is realigned.
+ (init_elim_table): Can eliminate frame pointer when stack is
+ realigned and dynamic realigned argument pointer isn't used.
+
+ * rtl.h (assign_stack_local_1): Declare new funtion.
+
+ * target-def.h (TARGET_UPDATE_STACK_BOUNDARY): New.
+ (TARGET_GET_DRAP_RTX): Likewise.
+ (TARGET_CALLS): Add TARGET_UPDATE_STACK_BOUNDARY and
+ TARGET_GET_DRAP_RTX.
+
+ * target.h (gcc_target): Add update_stack_boundary and get_drap_rtx.
+
+ * tree-vectorizer.c (vect_can_force_dr_alignment_p): Replace
+ STACK_BOUNDARY with MAX_STACK_ALIGNMENT.
+
+2008-07-30 Xuepeng Guo <xuepeng.guo@intel.com>
+ H.J. Lu <hongjiu.lu@intel.com>
+
+ * dwarf2out.c (dw_fde_struct): Add stack_realignment, drap_reg,
+ vdrap_reg, stack_realign and drap_reg_saved.
+ (add_cfi): Don't allow redefining CFA when DRAP is used.
+ (reg_save): Handle stack alignment.
+ (dwarf2out_frame_debug_expr): Add rules 16-20 to handle stack
+ alignment. Don't generate DWARF information for (set fp sp)
+ when DRAP is used.
+ (dwarf2out_begin_prologue): Initialize drap_reg and vdrap_reg
+ to INVALID_REGNUM.
+ (int_loc_descriptor): Move prototype forward. Also define if
+ DWARF2_UNWIND_INFO is true.
+ (output_cfa_loc): Handle DW_CFA_expression.
+ (build_cfa_aligned_loc): New.
+ (based_loc_descr): Update assert for stack realign. For local
+ variables, use sp+offset when stack is aligned without drap and
+ fp+offset when stack is aligned with drap. For arguments, use
+ cfa+offset when drap is used to align stack.
+
+2008-07-30 Joey Ye <joey.ye@intel.com>
+ H.J. Lu <hongjiu.lu@intel.com>
+
+ * config/i386/i386.c (ix86_force_align_arg_pointer_string):
+ Break long line.
+ (ix86_gen_andsp): New.
+ (ix86_user_incoming_stack_boundary): Likewise.
+ (ix86_default_incoming_stack_boundary): Likewise.
+ (ix86_incoming_stack_boundary): Likewise.
+ (ix86_can_eliminate): Likewise.
+ (find_drap_reg): Likewise.
+ (ix86_update_stack_boundary): Likewise.
+ (ix86_get_drap_rtx): Likewise.
+ (ix86_finalize_stack_realign_flags): Likewise.
+ (TARGET_UPDATE_STACK_BOUNDARY): Likewise.
+ (TARGET_GET_DRAP_RTX): Likewise.
+ (override_options): Overide option value for new options.
+ (ix86_function_ok_for_sibcall): Remove check for
+ force_align_arg_pointer.
+ (ix86_handle_cconv_attribute): Likewise.
+ (ix86_function_regparm): Likewise.
+ (setup_incoming_varargs_64): Don't set stack_alignment_needed here.
+ (ix86_va_start): Replace virtual_incoming_args_rtx with
+ crtl->args.internal_arg_pointer.
+ (ix86_select_alt_pic_regnum): Check DRAP register.
+ (ix86_save_reg): Replace force_align_arg_pointer with drap_reg.
+ (ix86_compute_frame_layout): Compute frame layout wrt stack
+ realignment.
+ (ix86_internal_arg_pointer): Just return virtual_incoming_args_rtx.
+ (ix86_expand_prologue): Decide if stack realignment is needed
+ and generate prologue code accordingly.
+ (ix86_expand_epilogue): Generate epilogue code wrt stack
+ realignment is really needed or not.
+
+ * config/i386/i386.h (MAIN_STACK_BOUNDARY): New.
+ (ABI_STACK_BOUNDARY): Likewise.
+ (PREFERRED_STACK_BOUNDARY_DEFAULT): Likewise.
+ (STACK_REALIGN_DEFAULT): Likewise.
+ (INCOMING_STACK_BOUNDARY): Likewise.
+ (MAX_STACK_ALIGNMENT): Likewise.
+ (ix86_incoming_stack_boundary): Likewise.
+ (FORCE_PREFERRED_STACK_BOUNDARY_IN_MAIN): Removed.
+ (REAL_PIC_OFFSET_TABLE_REGNUM): Updated to use BX_REG.
+ (CAN_ELIMINATE): Defined with ix86_can_eliminate.
+ (machine_function): Remove force_align_arg_pointer.
+
+ * config/i386/i386.md (BX_REG): New.
+ (R13_REG): Likewise.
+
+ * config/i386/i386.opt (mforce_drap): New.
+ (mincoming-stack-boundary): Likewise.
+ (mstackrealign): Add Init(-1).
+
+ * config/i386/i386-protos.h (ix86_can_eliminate): New
+
+2008-07-30 H.J. Lu <hongjiu.lu@intel.com>
+
+ * doc/extend.texi: Update force_align_arg_pointer.
+
+ * doc/invoke.texi: Document -mincoming-stack-boundary. Update
+ -mstackrealign.
+
+ * doc/tm.texi (MAX_STACK_ALIGNMENT): Add macro.
+ (INCOMING_STACK_BOUNDARY): Likewise.
+ (TARGET_UPDATE_STACK_BOUNDARY): New target hook.
+ (TARGET_GET_DRAP_RTX): Likewise.
+
+2008-07-30 Andreas Schwab <schwab@suse.de>
+
+ PR rtl-optimization/36929
+ * dse.c (replace_inc_dec): Use emit_insn_before instead of
+ add_insn_before and fix argument order.
+ (replace_inc_dec_mem): Handle NULL rtx.
+
+2008-07-30 Andrew Jenner <andrew@codesourcery.com>
+
+ * config/arm/arm.c (arm_compute_static_chain_stack_bytes): New
+ function.
+ (arm_compute_initial_elimination_offset): Use it.
+ (arm_compute_save_reg_mask): Include static chain save slot when
+ calculating alignment.
+ (arm_get_frame_offsets): Ditto.
+ (thumb1_compute_save_reg_mask): Ensure we have a low register saved
+ that we can use to decrement the stack when the stack decrement
+ could be too big for an immediate value in a single insn.
+ (thumb1_expand_prologue): Avoid using r12 for stack decrement.
+
+2008-07-30 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/36967
+ * tree-predcom.c (remove_stmt): Use gimple_assign_ssa_name_copy_p.
+ Release defs of statements we remove.
+
+2008-07-30 Nathan Froyd <froydnj@codesourcery.com>
+
+ * config/arm/arm.c (arm_expand_prologue): Use 0-length rtvec
+ instead of NULL_RTVEC.
+
+2008-07-30 Nathan Froyd <froydnj@codesourcery.com>
+
+ PR target/35866
+
+ * config/rs6000/rs6000.h (SLOW_UNALIGNED_ACCESS): Add clause for
+ vector modes.
+
+2008-07-30 Rafael Avila de Espindola <espindola@google.com>
+
+ * final.c (call_from_call_insn): New.
+ (final_scan_insn): Call assemble_external on FUNCTION_DECLs.
+
+2008-07-30 Paolo Bonzini <bonzini@gnu.org>
+
+ * configure.ac: Substitute ADA_CFLAGS.
+ * configure: Regenerate.
+ * config.host: Remove mention of pa/x-ada and pa/x-ada-hpux10 files.
+ * Makefile.in: Remove mention of X_* variables.
+ * config/pa/x-ada-hpux10: Remove.
+ * config/pa/x-ada: Remove.
+
+ * doc/fragments.texi: Update.
+
+2008-07-30 Olivier Hainque <hainque@adacore.com>
+
+ * config/mips/irix-crti.asm: .hide __gcc_init and __gcc_fini.
+ * config/mips/iris6.h (IRIX_SUBTARGET_LINK_SPEC, irix ld): Hide
+ __dso_handle explicitly here.
+
+2008-07-30 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR 34389
+ * c-typeck.c (build_binary_op): Encapsulate code into...
+ * c-common.c (shorten_binary_op): ...this new function.
+ (conversion_warning): Use the new function. Handle non-negative
+ constant in bitwise-and.
+ * c-common.h (shorten_binary_op): Declare.
+
+2008-07-30 Olivier Hainque <hainque@adacore.com>
+
+ * scan.c (make_sstring_space): Add explicit conversions of
+ allocator's return value.
+ * fix-header.c (recognized_function): Likewise.
+
+2008-07-30 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * doc/cpp.texi: Update to GFDL 1.2.
+ * doc/gcc.texi: Do not list GPL as Invariant Section.
+ * doc/gccint.texi: Likewise. Update copyright years.
+ * doc/install.texi: Update copyright years.
+
+2008-07-30 Alan Modra <amodra@bigpond.net.au>
+
+ PR target/36955
+ * config/rs6000/rs6000.c (rs6000_legitimize_tls_address): Add
+ a use of pic_offset_table_rtx for -msecure-plt __tls_get_addr calls.
+
+2008-07-29 Jan Hubicka <jh@suse.cz>
+
+ * c-decl.c (merge_decls): Do not handle DECL_INLINE.
+ (grokdeclarator): Likewise.
+ * langhooks.c (lhd_warn_unused_global_decl): Use
+ DECL_DECLARED_INLINE_P.
+ * print-tree.c (print_node): Remove DECL_INLINE check.
+
+2008-07-29 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/36945
+ * tree-ssa-sccvn.h (copy_reference_ops_from_ref): Declare.
+ * tree-ssa-sccvn.c (copy_reference_ops_from_ref): Export.
+ Record invariant addresses un-decomposed.
+ (copy_reference_ops_from_call): Record reference call
+ arguments properly. Simplify.
+ * tree-ssa-pre.c (create_component_ref_by_pieces_1): New
+ helper split out from ...
+ (create_component_ref_by_pieces): ... here. Simplify.
+ Prepare for recursive invocation for call arguments.
+ (create_expression_by_pieces): Adjust call to
+ create_component_ref_by_pieces.
+ (compute_avail): Process operand 2 of reference ops.
+
+2008-07-29 Richard Guenther <rguenther@suse.de>
+
+ * gimplify.c (gimplify_expr): Clear TREE_SIDE_EFFECTS for OBJ_TYPE_REF.
+
+2008-07-29 Jakub Jelinek <jakub@redhat.com>
+
+ * c-format.c (check_format_types): Revert unwanted checkin.
+
+2008-07-29 Jan Hubicka <jh@suse.cz>
+
+ * flags.h (flag_really_no_inline): Remove.
+ * cgraph.c (cgraph_function_possibly_inlined_p): Simplify.
+ * toplev.c (flag_really_no_inline): Remove.
+ * c-cppbuiltin.c (c_cpp_builtins): Use flag_no_inline.
+ * ipa-inline.c (cgraph_decide_inlining): Do not check flag_no_inline.
+ (cgraph_decide_inlining_incrementally): Likewise.
+ (compute_inline_parameters): Likewise.
+ * opts.c (decode_options): Simplify.
+ * c-opts.c (c_common_post_options): Do not set flag_no_inline.
+ * common.opt (finline): Initialize to 1.
+ * tree-inline.c (inlinable_function_p): Check flag_no_inline.
+
+2008-07-29 Jan Hubicka <jh@suse.cz>
+
+ * predict.c (always_optimize_for_size_p): New function.
+ (optimize_bb_for_size_p, optimize_bb_for_speed_p,
+ optimize_edge_for_size_p, optimize_edge_for_speed_p,
+ optimize_insn_for_size_p, optimize_insn_for_speed_p): New global
+ functions.
+ (rtl_profile_for_bb, rtl_profile_for_edge, rtl_default_profile): New.
+ * function.c (prepare_function_start): Set default profile.
+ * function.h (rtl_data): Add maybe_hot_insn_p.
+ * cfgexpand.c (expand_gimple_basic_block): Set RTL profile.
+ (construct_exit_block): Likewise.
+ (tree_expand_cfg): Likewise.
+ * basic-block.h
+ (optimize_bb_for_size_p, optimize_bb_for_speed_p,
+ optimize_edge_for_size_p, optimize_edge_for_speed_p,
+ optimize_insn_for_size_p, optimize_insn_for_speed_p): Declare.
+ (rtl_profile_for_bb, rtl_profile_for_edge, default_rtl_profile):
+ Declare.
+
+2008-07-29 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR 34985
+ * c-decl.c (merge_decls): Merge USED flags.
+
+2008-07-29 Kaz Kojima <kkojima@gcc.gnu.org>
+
+ * config/sh/sh.c (sh_gimplify_va_arg_expr): Unshare the addr,
+ valist, next_fp, next_fp_tmp, next_fp_limit, next_o, next_o_limit,
+ next_stack, lab_false and lab_over trees.
+
+2008-07-28 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/36957
+ * tree-flow.h (tree_ssa_useless_type_conversion): Remove.
+ (useless_type_conversion_p): Remove.
+ (types_compatible_p): Remove.
+ * gimple.h (tree_ssa_useless_type_conversion): Declare.
+ (useless_type_conversion_p): Declare.
+ (types_compatible_p): Declare.
+ (gimple_expr_type): Return the base type only if it is
+ trivially convertible to the subtype.
+
+2008-07-28 Andreas Tobler <a.tobler@schweiz.org>
+
+ * configure.ac: Use the m4_do macro to concatenate the warnings into
+ one string in ACX_PROG_CC_WARNING_OPTS,
+ ACX_PROG_CC_WARNING_ALMOST_PEDANTIC and ACX_PROG_CC_WARNINGS_ARE_ERRORS.
+ * configure: Regenerate.
+
+2008-07-28 Richard Guenther <rguenther@suse.de>
+
+ * tree-ssa-pre.c (insert_into_preds_of_block): Remove dead code.
+ (insert_fake_stores): Remove.
+ (realify_fake_stores): Likewise.
+ (execute_pre): Remove dead code.
+ * tree-ssa-structalias.c (get_constraint_for_1): Remove tcc_unary case.
+ (find_func_aliases): Deal with it here instead.
+ Re-enable gcc_unreachable call.
+
+2008-07-28 Richard Guenther <rguenther@suse.de>
+
+ Merge from gimple-tuples-branch.
+
+ * ChangeLog.tuples: ChangeLog from gimple-tuples-branch.
+ * gimple.def: New file.
+ * gsstruct.def: Likewise.
+ * gimple-iterator.c: Likewise.
+ * gimple-pretty-print.c: Likewise.
+ * tree-gimple.c: Removed. Merged into ...
+ * gimple.c: ... here. New file.
+ * tree-gimple.h: Removed. Merged into ...
+ * gimple.h: ... here. New file.
+
+ * Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h.
+ * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the
+ --enable-checking=gimple flag.
+ * config.in: Likewise.
+ * configure: Regenerated.
+
+ * tree-ssa-operands.h: Tuplified.
+ * tree-vrp.c: Likewise.
+ * tree-loop-linear.c: Likewise.
+ * tree-into-ssa.c: Likewise.
+ * tree-ssa-loop-im.c: Likewise.
+ * tree-dump.c: Likewise.
+ * tree-complex.c: Likewise.
+ * cgraphbuild.c: Likewise.
+ * tree-ssa-threadupdate.c: Likewise.
+ * tree-ssa-loop-niter.c: Likewise.
+ * tree-pretty-print.c: Likewise.
+ * tracer.c: Likewise.
+ * gengtype.c: Likewise.
+ * tree-loop-distribution.c: Likewise.
+ * tree-ssa-loop-unswitch.c: Likewise.
+ * cgraph.c: Likewise.
+ * cgraph.h: Likewise.
+ * tree-ssa-loop-manip.c: Likewise.
+ * value-prof.c: Likewise.
+ * tree-ssa-loop-ch.c: Likewise.
+ * tree-tailcall.c: Likewise.
+ * value-prof.h: Likewise.
+ * tree.c: Likewise.
+ * tree.h: Likewise.
+ * tree-pass.h: Likewise.
+ * ipa-cp.c: Likewise.
+ * tree-scalar-evolution.c: Likewise.
+ * tree-scalar-evolution.h: Likewise.
+ * target.h: Likewise.
+ * lambda-mat.c: Likewise.
+ * tree-phinodes.c: Likewise.
+ * diagnostic.h: Likewise.
+ * builtins.c: Likewise.
+ * tree-ssa-alias-warnings.c: Likewise.
+ * cfghooks.c: Likewise.
+ * fold-const.c: Likewise.
+ * cfghooks.h: Likewise.
+ * omp-low.c: Likewise.
+ * tree-ssa-dse.c: Likewise.
+ * ipa-reference.c: Likewise.
+ * tree-ssa-uncprop.c: Likewise.
+ * toplev.c: Likewise.
+ * tree-gimple.c: Likewise.
+ * tree-gimple.h: Likewise.
+ * tree-chrec.c: Likewise.
+ * tree-chrec.h: Likewise.
+ * tree-ssa-sccvn.c: Likewise.
+ * tree-ssa-sccvn.h: Likewise.
+ * cgraphunit.c: Likewise.
+ * tree-ssa-copyrename.c: Likewise.
+ * tree-ssa-ccp.c: Likewise.
+ * tree-ssa-loop-ivopts.c: Likewise.
+ * tree-nomudflap.c: Likewise.
+ * tree-call-cdce.c: Likewise.
+ * ipa-pure-const.c: Likewise.
+ * c-format.c: Likewise.
+ * tree-stdarg.c: Likewise.
+ * tree-ssa-math-opts.c: Likewise.
+ * tree-ssa-dom.c: Likewise.
+ * tree-nrv.c: Likewise.
+ * tree-ssa-propagate.c: Likewise.
+ * ipa-utils.c: Likewise.
+ * tree-ssa-propagate.h: Likewise.
+ * tree-ssa-alias.c: Likewise.
+ * gimple-low.c: Likewise.
+ * tree-ssa-sink.c: Likewise.
+ * ipa-inline.c: Likewise.
+ * c-semantics.c: Likewise.
+ * dwarf2out.c: Likewise.
+ * expr.c: Likewise.
+ * tree-ssa-loop-ivcanon.c: Likewise.
+ * predict.c: Likewise.
+ * tree-ssa-loop.c: Likewise.
+ * tree-parloops.c: Likewise.
+ * tree-ssa-address.c: Likewise.
+ * tree-ssa-ifcombine.c: Likewise.
+ * matrix-reorg.c: Likewise.
+ * c-decl.c: Likewise.
+ * tree-eh.c: Likewise.
+ * c-pretty-print.c: Likewise.
+ * lambda-trans.c: Likewise.
+ * function.c: Likewise.
+ * langhooks.c: Likewise.
+ * ebitmap.h: Likewise.
+ * tree-vectorizer.c: Likewise.
+ * function.h: Likewise.
+ * langhooks.h: Likewise.
+ * tree-vectorizer.h: Likewise.
+ * ipa-type-escape.c: Likewise.
+ * ipa-type-escape.h: Likewise.
+ * domwalk.c: Likewise.
+ * tree-if-conv.c: Likewise.
+ * profile.c: Likewise.
+ * domwalk.h: Likewise.
+ * tree-data-ref.c: Likewise.
+ * tree-data-ref.h: Likewise.
+ * tree-flow-inline.h: Likewise.
+ * tree-affine.c: Likewise.
+ * tree-vect-analyze.c: Likewise.
+ * c-typeck.c: Likewise.
+ * gimplify.c: Likewise.
+ * coretypes.h: Likewise.
+ * tree-ssa-phiopt.c: Likewise.
+ * calls.c: Likewise.
+ * tree-ssa-coalesce.c: Likewise.
+ * tree.def: Likewise.
+ * tree-dfa.c: Likewise.
+ * except.c: Likewise.
+ * except.h: Likewise.
+ * cfgexpand.c: Likewise.
+ * tree-cfgcleanup.c: Likewise.
+ * tree-ssa-pre.c: Likewise.
+ * tree-ssa-live.c: Likewise.
+ * tree-sra.c: Likewise.
+ * tree-ssa-live.h: Likewise.
+ * tree-predcom.c: Likewise.
+ * lambda.h: Likewise.
+ * tree-mudflap.c: Likewise.
+ * ipa-prop.c: Likewise.
+ * print-tree.c: Likewise.
+ * tree-ssa-copy.c: Likewise.
+ * ipa-prop.h: Likewise.
+ * tree-ssa-forwprop.c: Likewise.
+ * ggc-page.c: Likewise.
+ * c-omp.c: Likewise.
+ * tree-ssa-dce.c: Likewise.
+ * tree-vect-patterns.c: Likewise.
+ * tree-ssa-ter.c: Likewise.
+ * tree-nested.c: Likewise.
+ * tree-ssa.c: Likewise.
+ * lambda-code.c: Likewise.
+ * tree-ssa-loop-prefetch.c: Likewise.
+ * tree-inline.c: Likewise.
+ * tree-inline.h: Likewise.
+ * tree-iterator.c: Likewise.
+ * tree-optimize.c: Likewise.
+ * tree-ssa-phiprop.c: Likewise.
+ * tree-vect-transform.c: Likewise.
+ * tree-object-size.c: Likewise.
+ * tree-outof-ssa.c: Likewise.
+ * cfgloop.c: Likewise.
+ * system.h: Likewise.
+ * tree-profile.c: Likewise.
+ * cfgloop.h: Likewise.
+ * c-gimplify.c: Likewise.
+ * c-common.c: Likewise.
+ * tree-vect-generic.c: Likewise.
+ * tree-flow.h: Likewise.
+ * c-common.h: Likewise.
+ * basic-block.h: Likewise.
+ * tree-ssa-structalias.c: Likewise.
+ * tree-switch-conversion.c: Likewise.
+ * tree-ssa-structalias.h: Likewise.
+ * tree-cfg.c: Likewise.
+ * passes.c: Likewise.
+ * ipa-struct-reorg.c: Likewise.
+ * ipa-struct-reorg.h: Likewise.
+ * tree-ssa-reassoc.c: Likewise.
+ * cfgrtl.c: Likewise.
+ * varpool.c: Likewise.
+ * stmt.c: Likewise.
+ * tree-ssanames.c: Likewise.
+ * tree-ssa-threadedge.c: Likewise.
+ * langhooks-def.h: Likewise.
+ * tree-ssa-operands.c: Likewise.
+ * config/alpha/alpha.c: Likewise.
+ * config/frv/frv.c: Likewise.
+ * config/s390/s390.c: Likewise.
+ * config/m32c/m32c.c: Likewise.
+ * config/m32c/m32c-protos.h: Likewise.
+ * config/spu/spu.c: Likewise.
+ * config/sparc/sparc.c: Likewise.
+ * config/i386/i386.c: Likewise.
+ * config/sh/sh.c: Likewise.
+ * config/xtensa/xtensa.c: Likewise.
+ * config/stormy16/stormy16.c: Likewise.
+ * config/ia64/ia64.c: Likewise.
+ * config/rs6000/rs6000.c: Likewise.
+ * config/pa/pa.c: Likewise.
+ * config/mips/mips.c: Likewise.
+
+2008-07-28 Simon Baldwin <simonb@google.com>
+
+ * c-pragma.c (handle_pragma_message): New function.
+ (init_pragma): Register handle_pragma_message.
+ * doc/extend.texi (Diagnostic Pragmas): Added #pragma message
+ documentation.
+
+2008-07-27 Victor Kaplansky <victork@il.ibm.com>
+
+ PR tree-optimization/35252
+ * tree-vect-analyze.c (vect_build_slp_tree): Make IMAGPART_EXPR and
+ REALPART_EXPR to be considered as same load operation.
+
+2008-07-27 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR tree-optimization/36830
+ * tree-ssa-sccvn.c (vn_reference_op_compute_hash): Hash operand #2.
+ (expressions_equal_p): Return false if only one operand is null.
+
+2008-07-26 Gerald Pfeifer <gerald@pfeifer.com>
+
+ * doc/install.texi (powerpc-*-netbsd*): Remove redundant texinfo
+ version requirements.
+
+2008-07-26 Olivier Hainque <hainque@adacore.com>
+
+ * collect2.c (symkind): New enum. Symbol kinds we care about.
+ (is_ctor_dtor): Return symkind instead of int. Adjust prototype,
+ code and head comment accordingly.
+ (scan_prog_file): Use symkind names instead of bare integers.
+
+2008-07-25 Jan Hubicka <jh@suse.cz>
+
+ * cgraph.c (cgraph_function_possibly_inlined_p): Do not rely on
+ DECL_INLINE.
+ * cgraphunit.c (record_cdtor_fn): Do not initialize DECL_INLINE
+ (cgraph_preserve_function_body_p): Do not rely on DECL_INLINE.
+ * dojump.c (clear_pending_stack_adjust): Likewise.
+ * print-tree.c (print_node): Ignore DECL_INLINE.
+ * tree-inline.c (inlinable_function_p): Likewise.
+
+2008-07-25 Michael Meissner <gnu@the-meissners.org>
+
+ * doc/extend.texi (hot attribute): Document that the hot attribute
+ turns on -O3 for some ports.
+ (cold attribute): Document that the cold attribute turns on -Os
+ for some ports
+
+ * doc/tm.texi (OPTIMIZATION_OPTIONS): Update documentation to
+ reflect function specific option support.
+
+ * target.h (struct target_option_hooks): Add fields to say whether
+ the cold attribute implies -Os and the hot attribute implies -O3.
+
+ * target-def.h (TARGET_OPTION_COLD_ATTRIBUTE_SETS_OPTIMIZATION):
+ By default, do not turn on -Os for cold functions.
+ (TARGET_OPTION_COLD_ATTRIBUTE_SETS_OPTIMIZATION): By default, do
+ not turn on -O3 for hot functions.
+
+ * c-common.c (handle_hot_attribute): Use target hook to determine
+ if hot functions should enable -O3.
+ (handle_cold_attribute): Use target hook to determine if cold
+ functions should enable -Os.
+
+ * config/i386/i386.c (ix86_target_string): Add -m3dnowa support.
+ (override_options): Move disable scheduling to
+ optimization_options.
+ (optimization_options): Disable scheduling here, not
+ override_options.
+ (TARGET_OPTION_COLD_ATTRIBUTE_SETS_OPTIMIZATION): Define.
+ (TARGET_OPTION_HOT_ATTRIBUTE_SETS_OPTIMIZATION): Define.
+
+ * config/ia64/ia64.c (ia64_override_options): Move setting
+ scheduling flags to ia64_optimization_options.
+ (ia64_optimization_options): Disable scheduling options here, and
+ not in ia64_override_options.
+ (TARGET_OPTION_COLD_ATTRIBUTE_SETS_OPTIMIZATION): Define.
+ (TARGET_OPTION_HOT_ATTRIBUTE_SETS_OPTIMIZATION): Define.
+
+2008-07-25 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/36936
+ * config/i386/i386.c (override_options): Don't clear TARGET_CMOVE.
+
+2008-07-25 Martin Jambor <mjambor@suse.cz>
+
+ PR tree-optimization/36926
+ * ipa-prop.c (ipa_analyze_call_uses): Call
+ ipa_is_ssa_with_stmt_def instead of SSA_NAME_IS_DEFAULT_DEF.
+
+2008-07-25 Joseph Myers <joseph@codesourcery.com>
+
+ * config/arm/iwmmxt.md (movv8qi_internal, movv4hi_internal,
+ movv2si_internal): Add mem = reg alternative.
+
+2008-07-25 Andreas Tobler <a.tobler@schweiz.org>
+
+ PR bootstrap/36918
+ * config/sparc/sparc.h (DEFAULT_PCC_STRUCT_RETURN): Define
+ DEFAULT_PCC_STRUCT_RETURN to 127.
+
+2008-07-24 Jan Hubicka <jh@suse.cz>
+
+ * cgraphbuild.c (record_reference): Drop non-unit-at-a-time code.
+ (build_cgraph_edges): Likewise.
+ * cgraph.c (cgraph_node): Do not update assembler hash.
+ (cgraph_remove_node): Drop non-unit-at-a-time code.
+ * tree-pass.h (pass_O0_always_inline): Remove.
+ * ipa-reference.c (gate_reference): Remove unit-at-a-time check.
+ * toplev.c (process_options): Flag unit-at-a-time does not imply
+ no section anchors.
+ * cgraphunit.c: Update comments.
+ (decide_is_function_needed): Drop non-unit-at-a-time mode.
+ (cgraph_assemble_pending_functions): Remove.
+ (cgraph_reset_node): Drop non-unit-at-a-time code.
+ (cgraph_finalize_function): Likewise.
+ (cgraph_analyze_function): Likewise.
+ (cgraph_finalize_compilation_unit): Likewise.
+ (cgraph_expand_function): Likewise.
+ (cgraph_optimize): Likesise.
+ (save_inline_function_body): Likewise.
+ * ipa-pure-const.c (gate_pure_const): Drop flag_unit_at_a_time check.
+ * tree-ssa-alias.c (maybe_be_aliased): Likewise.
+ * ipa-inline.c: Update comments.
+ (enum inlining_mode): remove INLINE_SPEED.
+ (cgraph_clone_inlined_nodes): Drop unit-at-a-time check.
+ (cgraph_mark_inline_edge): Likewise.
+ (try_inline): Likewise.
+ (cgraph_decide_inlining_incrementally): Likewise.
+ (cgraph_gate_inlining): Remove.
+ (cgraph_early_inlining): Remove flag_unit_at_a_time checks.
+ (cgraph_gate_early_inlining): Likewise.
+ (gate_inline_passes): Remove.
+ (pass_inline_parameters, pass_ipa_inline): Remove gates.
+ (cgraph_gate_O0_always_inline, cgraph_O0_always_inline,
+ pass_O0_always_inline): Remove.
+ * c-pch.c (c_pch_matching): Remove -funit-at-a-time.
+ * dwarf2out.c (reference_to_unused): Remove flag_unit_at_a_time check.
+ * opts.c (no_unit_at_a_time_default): Remove.
+ (decode_options): Remove flag_unit_at_a_time reset and warning.
+ * opts.h (no_unit_at_a_time_default): Remove.
+ * c-decl.c (diagnose_mismatched_decls): Do not require inline keyword
+ early in GNU dialect.
+ (merge_decls): Update comment; drop unit-at-a-time check.
+ (finish_decl): Likewise.
+ (grok_declaration): Remove flag_inline_trees code.
+ (finish_functions): Return on function returning non-void on all
+ statics.
+ * ipa-tye-escape.c (gate_type_escape_vars): Remove.
+ * cfgexpand.c (expand_one_static_var): Remove.
+ (expand_one_var): Remove expand_one_static_var call.
+ (expand_used_vars_for_block): Remove flag_unit_a_time check.
+ * c-opts.c (c_common_post_options): Remove flag_inline_trees code
+ and flag_unit_at_a-time compatibility checks.
+ * varasm.c (assemble_alias): Remove flag_unit_at_a_time check.
+ * tree-inline.c (flag_inline_trees): Remove.
+ (inlinable_function_p): Don't check it.
+ (expand_call_inline): Remove non-unit-at-a-time code.
+ * tree-inline.h (flag_inline_trees): Remove.
+ * tree-optimize.c (execute_early_local_optimizations): Remove
+ unit-at-a-time checks.
+ (tree_rest_of_compilation): Likewise.
+ * combine.c (setup_incoming_promotions): Likewise.
+ * tree-profile.c (tree_gen_ic_func_profiler): Likewise.
+ * tree-ssa-structalias.c (delete_points_to_sets): Likewise.
+ * passes.c (pass_inline_parameters): Update comments; remove
+ O0_alwaysinline pass.
+ (execute_one_ipa_transform_pass): Do not reset in_gimple_form.
+ (execute_one_pass): Likewise.
+ * i386.c (ix86_function_regparm): Remove unit-at-a-time check.
+ (ix86_function_sseregparm): Likewise.
+ * arm.c (arm_function_in_section_p): Likewise.
+ * bfin.c (bfin_load_pic_reg, bfin_function_ok_for_sibcall): Likewise.
+ * varpool.c: Update comments.
+ (decide_is_variable_needed): Remove unit-at-a-time checks.
+ (varpool_finalize_decl): Likewise.
+
+2008-07-24 Kaz Kojima <kkojima@gcc.gnu.org>
+
+ * config/sh/sh.h (OPTIMIZATION_OPTIONS): Set flag_omit_frame_pointer
+ to 2 instead of -1.
+ (OVERRIDE_OPTIONS): Check if flag_omit_frame_pointer is equal to 2.
+
+2008-07-24 Kai Tietz <kai.tietz@onevision.com>
+
+ * config/i386/i386.c (get_dllimport_decl): Treat user_label_prefix for
+ imp symbol extension.
+
+ 2008-07-23 Ian Lance Taylor <iant@google.com>
+
+ * tree-vrp.c (infer_value_range): Ignore asm statements when
+ looking for memory accesses for -fdelete-null-pointer-checks.
+
+2008-07-24 Ben Elliston <bje@au.ibm.com>
+
+ * config/spu/spu-c.c (__vector_keyword): New variable.
+ (vector_keyword): Likewise.
+ (spu_categorize_keyword): New function.
+ (spu_macro_to_expand): Likewise.
+ (spu_cpu_cpp_builtins): Enable context-sensitive macros if not
+ compiling an ISO C dialect.
+
+2008-07-24 Ben Elliston <bje@au.ibm.com>
+
+ * config/rs6000/rs6000-c.c: Move GTY(()) markers to match
+ conventional usage.
+
+2008-07-23 Aaron W. LaFramboise <aaronavay62@aaronwl.com>
+
+ * configure: Regenerate.
+ * configure.ac: Require texinfo 4.7.
+ * doc/install.texi: Document texinfo 4.7 requirement.
+
+2008-07-23 Martin Jambor <mjambor@suse.cz>
+
+ * ipa-cp.c (ipcp_print_edge_profiles): Test for node->analyzed
+ rather than for DECL_SAVED_TREE.
+ * ipa-prop.c: Include diagnostic.h.
+ (ipa_check_stmt_modifications): Check LHS of GIMPLE_MODIFY_EXPRs
+ thoroughly.
+ (ipa_detect_param_modifications): Function rewritten from scratch.
+ (ipa_compute_jump_functions): Changed accesses to modification flags.
+ (ipa_free_node_params_substructures): Update flags destruction.
+ (ipa_node_duplication_hook): Update flags duplication.
+ (ipa_print_all_params_modified): Updated flag access.
+ * ipa-prop.h (struct ipa_param_flags): New structure.
+ (struct ipa_node_params): New field modification_analysis_done,
+ modified_flags changed into param_flags.
+ (ipa_is_ith_param_modified): Changed to use new flags.
+ * Makefile.in (ipa-prop.o): Add $(DIAGNOSTIC_H) to dependencies.
+
+ * ipa-prop.c (ipa_print_all_jump_functions): Moved here from
+ ipa-cp.c and split into two functions.
+ (ipa_print_node_jump_functions): New function.
+ (compute_scalar_jump_functions): New function.
+ (type_like_member_ptr_p): New function.
+ (compute_pass_through_member_ptrs): New function.
+ (fill_member_ptr_cst_jump_function): New function.
+ (determine_cst_member_ptr): New function.
+ (compute_cst_member_ptr_arguments): New function.
+ (ipa_compute_jump_functions): Complete rewrite.
+ * ipa-prop.h (enum jump_func_type): Make explicit that we depend
+ on IPA_UNKNOWN being zero. Added value IPA_CONST_MEMBER_PTR.
+ (struct ipa_member_ptr_cst): New structure.
+ (union jump_func_value): New field member_cst.
+ * ipa-cp.c (ipcp_lat_is_insertable): New function.
+ (ipcp_lattice_from_jfunc): Produces bottom lattices for unhandled
+ jump function types.
+ (ipcp_print_all_lattices): Slight fprintf rearrangement.
+ (ipcp_print_all_structures): Call ipa_print_all_jump_functions
+ instead of ipcp_print_all_jump_functions.
+ (ipcp_insert_stage): Use ipcp_lat_is_insertable, create replace maps
+ only for replacable scalars.
+
+ * doc/invoke.texi (Optimize options): Add description of
+ -findirect-inlining.
+ * common.opt (flag_indirect_inlining): New flag.
+ * opts.c (decode_options): Set flag_indirect_inlining when
+ optimize >= 3.
+
+ * ipa-inline.c: Include ipa-prop.h.
+ (inline_indirect_intraprocedural_analysis): New function.
+ (inline_generate_summary): Allocate parameter and argument info
+ structures, call inline_indirect_intraprocedural_analysis on each
+ node when doing indirect inlining and deallocate indirect inlining
+ data structures in the end.
+ * ipa-prop.c (ipa_create_param_decls_array): Return if already done.
+ (free_all_ipa_structures_after_iinln): New function.
+ (free_all_ipa_structures_after_ipa_cp): Checks whether iinln will be
+ done.
+ * Makefile.in (ipa-inline.o): Added $(IPA_PROP_H) to dependencies.
+
+ * cgraphbuild.c (compute_call_stmt_bb_frequency): New function.
+ (build_cgraph_edges): Call compute_call_stmt_bb_frequency instead
+ of computing the frequency separately.
+ (rebuild_cgraph_edges): Call compute_call_stmt_bb_frequency instead
+ of computing the frequency separately.
+ * ipa-cp.c (ipcp_print_all_structures): Replace a call to
+ ipa_print_all_param_modified with a call to ipa_print_all_param_flags.
+ * ipa-prop.c (ipa_get_member_ptr_load_param): New function.
+ (ipa_get_stmt_member_ptr_load_param): New function.
+ (ipa_is_ssa_with_stmt_def): New function.
+ (ipa_note_param_call): New function.
+ (ipa_analyze_call_uses): New function.
+ (ipa_analyze_stmt_uses): New function.
+ (ipa_analyze_params_uses): New function.
+ (ipa_free_node_params_substructures): Also free the param_calls linked
+ list.
+ (ipa_node_duplication_hook): Also duplicate the param_calls linked list.
+ (ipa_print_node_param_flags): New function.
+ (ipa_print_all_params_modified): Renamed to ipa_print_all_param_flags.
+ (ipa_print_all_param_flags): Calls ipa_print_node_param_flags.
+ * ipa-prop.h (struct ipa_param_flags): New field called.
+ (struct ipa_param_call_note): New structure.
+ (struct ipa_node_params): New fields param_calls and
+ uses_analysis_done.
+ (ipa_is_ith_param_called): New function.
+ * ipa-inline.c (inline_indirect_intraprocedural_analysis): Call
+ ipa_analyze_params_uses and dump parameter flags.
+
+ * ipa-inline.c (cgraph_decide_recursive_inlining): Call
+ ipa_propagate_indirect_call_infos if performing indirect inlining,
+ pass a new parameter new_edges to it.
+ (add_new_edges_to_heap): New fucntion.
+ (cgraph_decide_inlining_of_small_functions): New vector
+ new_indirect_edges for newly found indirect edges , call
+ ipa_propagate_indirect_call_infos after inlining.
+ (cgraph_decide_inlining): Call ipa_propagate_indirect_call_infos after
+ inlining if performing indirect inlining. Call
+ free_all_ipa_structures_after_iinln when doing so too.
+ (inline_generate_summary): Do not call
+ free_all_ipa_structures_after_iinln here.
+ * ipa-prop.c (update_jump_functions_after_inlining): New function.
+ (print_edge_addition_message): New function.
+ (update_call_notes_after_inlining): New function.
+ (propagate_info_to_inlined_callees): New function.
+ (ipa_propagate_indirect_call_infos): New function.
+ * ipa-prop.h: Include cgraph.h
+ (struct ipa_param_call_note): Fields reordered, new field processed.
+ * cgraph.h (cgraph_edge): Shrink loop_nest field to 31 bits, add a new
+ flag indirect_call.
+ * cgraphunit.c (verify_cgraph_node): Allow indirect edges not to have
+ rediscovered call statements.
+ * cgraph.c (cgraph_create_edge): Initialize indirect_call to zero.
+ (dump_cgraph_node): Dump also the indirect_call flag.
+ (cgraph_clone_edge): Copy also the indirect_call flag.
+ * tree-inline.c (copy_bb): Do not check for fndecls from call
+ expressions, check for edge availability when moving clones.
+ (get_indirect_callee_fndecl): New function.
+ (expand_call_inline): If callee declaration is not apprent from
+ the statement, try calling get_indirect_callee_fndecl. Do not
+ issue warnings or call sorry when not inlinings an indirect edge.
+ * Makefile.in (IPA_PROP_H): Added $(CGRAPH_H) to dependencies.
+
+ * ipa-prop.c (ipa_print_node_param_flags): Make the dump format a
+ bit more frandly to matching.
+ * testsuite/g++.dg/ipa/iinline-1.C: New testcase.
+ * testsuite/gcc.dg/ipa/iinline-1.c: New testcase.
+ * testsuite/gcc.dg/ipa/modif-1.c: New testcase.
+
+2008-07-23 Michael Meissner <gnu@the-meissners.org>
+
+ PR 36907
+ * opth-gen.awk: Suppress function specific features when building
+ target libraries.
+ * optc-gen.awk: Ditto.
+
+2008-07-23 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR 35058
+ * diagnostic.c (pedwarn): Add opt parameter.
+ (pedwarn0): New.
+ * c-tree.h (pedwarn_init): Add opt parameter.
+ (pedwarn_c90): Likewise.
+ (pedwarn_c99): Likewise.
+ * c-errors.c (pedwarn_c99): Likewise.
+ (pedwarn_c90): Likewise.
+ * toplev.h (pedwarn): Update declaration.
+ (pedwarn0): Declare.
+ * c-lex.c: All calls to pedwarn changed.
+ * builtins.c: All calls to pedwarn changed.
+ * toplev.c: All calls to pedwarn changed.
+ * c-decl.c: All calls to pedwarn changed.
+ * c-typeck.c: All calls to pedwarn changed.
+ * c-common.c: All calls to pedwarn changed.
+ * c-parser.c: All calls to pedwarn changed.
+
+2008-07-23 Michael Meissner <gnu@the-meissners.org>
+ Karthik Kumar <karthikkumar@gmail.com>
+
+ * attribs.c (file scope): Include c-common.h.
+ (decl_attributes): Add support for #pragma GCC optimize and
+ #pragma GCC option.
+
+ * targhooks.c (default_can_inline_p): New function that is the
+ default for the TARGET_CAN_INLINE_P target hook.
+
+ * targhooks.h (default_can_inline_p): Add declaration.
+
+ * tree.c (cl_optimization_node): New static tree for building
+ OPTIMIZATION_NODE tree.
+ (cl_target_option_node): New static tree for building
+ TARGET_OPTION_NODE tree.
+ (cl_option_hash_table): New hash table for hashing
+ OPTIMIZATION_NODE and TARGET_OPTION_NODE trees.
+ (cl_option_hash_hash): New function to provide the hash value for
+ OPTIMIZATION_NODE and TARGET_OPTION_NODE trees.
+ (cl_option_hash_eq): New function to provide an equality test for
+ OPTIMIZATION_NODE and TARGET_OPTION_NODE trees.
+ (tree_code_size): Add support for OPTIMIZATION_NODE and
+ TARGET_OPTION_NODE trees.
+ (tree_code_structure): Add support for OPTIMIZATION_NODE and
+ TARGET_OPTION_NODE trees.
+ (build_optimization_node): Build a tree that has all of the
+ current optimization options.
+ (build_target_option_node): Build a tree that has the target
+ options that might be changed on a per function basis.
+
+ * tree.h (file scope): Include options.h.
+ (DECL_FUNCTION_SPECIFIC_TARGET): New accessor macro.
+ (DECL_FUNCTION_SPECIFIC_OPTIMIZATION): Ditto.
+ (TREE_OPTIMIZATION): Ditto.
+ (TREE_TARGET_SPECIFIC): Ditto.
+ (struct tree_function_decl): Add fields for remembering the
+ current optimization options and target specific options.
+ (struct tree_optimization_option): New tree variant that remembers
+ the optimization options.
+ (struct tree_target_option): New tree variant that remembers the
+ target specific flags that might change for compiling a particular
+ function.
+ (union tree_node): Include tree_optimization_option and
+ tree_target_option fields.
+ (enum tree_index): Add TI_OPTIMIZATION_DEFAULT,
+ TI_OPTIMIZATION_CURRENT, TI_OPTIMIZATION_COLD,
+ TI_OPTIMIZATION_HOT, TI_TARGET_OPTION_DEFAULT,
+ TI_TARGET_OPTION_CURRENT, TI_CURRENT_OPTION_PRAGMA,
+ TI_CURRENT_OPTIMIZE_PRAGMA entries for saving function specific
+ optimization and target options.
+ (optimization_default_node): New macro to refer to global_trees
+ field.
+ (optimization_current_node): Ditto.
+ (optimization_cold_node): Ditto.
+ (optimization_hot_node): Ditto.
+ (target_option_default_node): Ditto.
+ (target_option_current_node): Ditto.
+ (current_option_pragma): Ditto.
+ (current_optimize_pragma): Ditto.
+
+ * target.h (struct gcc_target): Add valid_option_attribute_p,
+ target_option_save, target_option_restore, target_option_print,
+ target_option_pragma_parse, and can_inline_p hooks.
+
+ * toplev.h (parse_optimize_options): Add declaration.
+ (fast_math_flags_struct_set_p): Ditto.
+
+ * c-cppbuiltin.c (c_cpp_builtins_optimize_pragma): New function to
+ adjust the current __OPTIMIZE__, etc. macros when #pragma GCC
+ optimize is used.
+
+ * ipa-inline.c (cgraph_decide_inlining_of_small_function): Call
+ tree_can_inline_p hook to see if one function can inline another.
+ (cgraph_decide_inlining): Ditto.
+ (cgraph_decide_inlining_incrementally): Ditto.
+
+ * opts.c (decode_options): Add support for running multiple times
+ to allow functions with different target or optimization options
+ than was specified on the command line.
+ (fast_math_flags_struct_set_p): New function that is similar to
+ fast_math_flags_set_p, except it uses the values in the
+ cl_optimization structure instead of global variables.
+
+ * optc-gen.awk: Add support for TargetSave to allow a back end to
+ declare new fields that need to be saved when using function
+ specific options. Include flags.h and target.h in the options.c
+ source. Add support for Save to indicate which options can be set
+ for individual functions. Generate cl_optimize_save,
+ cl_optimize_restore, cl_optimize_print, cl_target_option_save,
+ cl_target_option_restore, cl_target_option_print functions to
+ allow functions to use different optimization or target options.
+
+ * opt-functions.awk (var_type_struct): Return the type used for
+ storing the field in a structure.
+
+ * opth-gen.awk: Add support for TargetSave to allow a back end to
+ declare new fields that need to be saved when using function
+ specific options. Add support for Save to indicate which options
+ can be set for individual functions. Only generate one extern for
+ Mask fields. Generate cl_optimization and cl_target_option
+ structures to remember optimization and target options.
+
+ * treestruct.def (TS_OPTIMIZATION): Add support for garbage
+ collecting new tree nodes.
+ (TS_TARGET_OPTION): Ditto.
+
+ * c-decl.c (merge_decls): Merge function specific target and
+ optimization options.
+
+ * function.c (invoke_set_current_function_hook): If the function
+ uses different optimization options, change the global variables
+ to reflect this.
+
+ * coretypes.h (struct cl_optimization): Add forward reference.
+ (struct cl_target_option): Ditto.
+
+ * c-pragma.c (option_stack): New static vector to remember the
+ current #pragma GCC option stack.
+ (handle_pragma_option): New function to support #pragma GCC option
+ to change target options.
+ (optimize_stack): New static vector to remember the current
+ #pragma GCC optimize stack.
+ (handle_pragma_optimize): New function to support #pragma GCC
+ optimize to change optimization options.
+ (init_pragma): Add support for #pragma GCC optimize and #pragma
+ GCC option.
+
+ * tree.def (OPTIMIZATION_NODE): New tree code for remembering
+ optimization options.
+ (TARGET_OPTION_NODE): New tree code for remembering certain target
+ options.
+
+ * print-tree.c (print_node): Add support for OPTIMIZATION_NODE and
+ TARGET_OPTION_NODE trees.
+
+ * common.opt (-O): Add Optimization flag.
+ (-Os): Ditto.
+ (-fmath-errno): Ditto.
+ (-falign-functions): Add UInteger flag to make sure flag gets full
+ int in cl_optimization structure.
+ (-falign-jumps): Ditto.
+ (-falign-labels): Ditto.
+ (-falign-loops): Ditto.
+ (-fsched-stalled-insns): Ditto.
+ (-fsched-stalled-insns-dep): Ditto.
+
+ * target-def.h (TARGET_VALID_OPTION_ATTRIBUTE_P): Add default
+ definition.
+ (TARGET_OPTION_SAVE): Ditto.
+ (TARGET_OPTION_RESTORE): Ditto.
+ (TARGET_OPTION_PRINT): Ditto.
+ (TARGET_OPTION_PRAGMA_PARSE): Ditto.
+ (TARGET_CAN_INLINE_P): Ditto.
+ (TARGET_INITIALIZER): Add new hooks.
+
+ * tree-inline.c (tree_can_inline_p): New function to determine
+ whether one function can inline another. Check if the functions
+ use compatible optimization options, and also call the backend
+ can_inline_p hook.
+
+ * tree-inline.h (tree_can_inline_p): Add declaration.
+
+ * c-common.c (c_common_attribute): Add support for option and
+ optimize attributes.
+ (handle_option_attribute): Add support for the option attribute to
+ allow the user to specify different target options for compiling a
+ specific function.
+ (handle_optimize_attribute): Add support for the optimize
+ attribute to allow the user to specify different optimization
+ options for compiling a specific function.
+ (handle_hot_attribute): Turn on -O3 optimization for this one
+ function if it isn't the default optimization level.
+ (handle_cold_attribute): Turn on -Os optimization for this one
+ function if it insn't the default optimization.
+ (const_char_p): New const char * typedef.
+ (optimize_args): New static vector to remember the optimization
+ arguments.
+ (parse_optimize_options): New function to set up the optimization
+ arguments from either the optimize attribute or #pragma GCC optimize.
+
+ * c-common.h (c_cpp_builtins_optimize_pragma): Add declaration.
+ (builtin_define_std): Ditto.
+
+ * config.gcc (i[3467]86-*-*): Add i386-c.o to C/C++ languages.
+ Add t-i386 Makefile fragment to add i386-c.o and i386.o dependencies.
+ (x86_64-*-*): Ditto.
+
+ * Makefile.in (TREE_H): Add options.h.
+ (options.o): Add $(TARGET_H) $(FLAGS_H) dependencies.
+
+ * doc/extend.texi (option attribute): Document new attribute.
+ (optimize attribute): Ditto.
+ (hot attribute): Document hot attribute sets -O3.
+ (cold attribute): Document cold attribute sets -Os.
+ (#pragma GCC option): Document new pragma.
+ (#pragma GCC optimize): Ditto.
+
+ * doc/options.texi (TargetSave): Document TargetSave syntax.
+ (UInteger): Document UInteger must be used for certain flags.
+ (Save): Document Save option to create target specific options
+ that can be saved/restored on a function specific context.
+
+ * doc/c-tree.texi (DECL_FUNCTION_SPECIFIC_TARGET): Document new macro.
+ (DECL_FUNCTION_SPECIFIC_OPTIMIZATION): Ditto.
+
+ * doc/tm.texi (TARGET_VALID_OPTION_ATTRIBUTE_P): Document new hook.
+ (TARGET_OPTION_SAVE): Ditto.
+ (TARGET_OPTION_RESTORE): Ditto.
+ (TARGET_OPTION_PRINT): Ditto.
+ (TARGET_OPTION_PRAGMA_PARSE): Ditto.
+ (TARGET_CAN_INLINE_P): Ditto.
+
+ * doc/invoke.texi (-mfpmath=sse+387): Document as an alias for
+ -mfpmath=sse,387.
+ (-mfpmath=both): Ditto.
+
+2008-07-23 Michael Meissner <gnu@the-meissners.org>
+ Karthik Kumar <karthikkumar@gmail.com>
+
+ * config/i386/i386.h (TARGET_ABM): Move switch into ix86_isa_flags.
+ (TARGET_POPCNT): Ditto.
+ (TARGET_SAHF): Ditto.
+ (TARGET_AES): Ditto.
+ (TARGET_PCLMUL): Ditto.
+ (TARGET_CMPXCHG16B): Ditto.
+ (TARGET_RECIP): Move switch into target_flags.
+ (TARGET_FUSED_MADD): Ditto.
+ (ix86_arch_features): Make an unsigned char type.
+ (ix86_tune_features): Ditto.
+ (OVERRIDE_OPTIONS): Add bool argument to override_options call.
+ (TARGET_CPU_CPP_BUILTINS): Move into ix86_target_macros.
+ (REGISTER_TARGET_PRAGMAS): Define, call ix86_register_pragmas.
+
+ * config/i386/i386.opt (arch): New TargetSave field to define
+ fields that need to be saved for function specific option support.
+ (tune): Ditto.
+ (fpmath): Ditto.
+ (branch_cost): Ditto.
+ (ix86_isa_flags_explicit): Ditto.
+ (tune_defaulted): Ditto.
+ (arch_specified): Ditto.
+ (-m128-long-double): Add Save flag to save option for target
+ specific option support.
+ (-m80387): Ditto.
+ (-maccumulate-outgoing-args): Ditto.
+ (-malign-double): Ditto.
+ (-malign-stringops): Ditto.
+ (-mfancy-math-387): Ditto.
+ (-mhard-float): Ditto.
+ (-mieee-fp): Ditto.
+ (-minline-all-stringops): Ditto.
+ (-minline-stringops-dynamically): Ditto.
+ (-mms-bitfields): Ditto.
+ (-mno-align-stringops): Ditto.
+ (-mno-fancy-math-387): Ditto.
+ (-mno-push-args): Ditto.
+ (-mno-red-zone): Ditto.
+ (-mpush-args): Ditto.
+ (-mred-zone): Ditto.
+ (-mrtd): Ditto.
+ (-msseregparm): Ditto.
+ (-mstack-arg-probe): Ditto.
+ (-m32): Ditto.
+ (-m64): Ditto.
+ (-mmmx): Ditto.
+ (-m3dnow): Ditto.
+ (-m3dnowa): Ditto.
+ (-msse): Ditto.
+ (-msse2): Ditto.
+ (-msse3): Ditto.
+ (-msse4.1): Ditto.
+ (-msse4.2): Ditto.
+ (-msse4): Ditto.
+ (-mno-sse4): Ditto.
+ (-msse4a): Ditto.
+ (-msse5): Ditto.
+ (-mrecip): Move flag into target_flags.
+ (-mcld): Ditto.
+ (-mno-fused-madd): Ditto.
+ (-mfused-madd): Ditto.
+ (-mabm): Move flag into ix86_isa_flags.
+ (-mcx16): Ditto.
+ (-mpopcnt): Ditto.
+ (-msahf): Ditto.
+ (-maes): Ditto.
+ (-mpclmul): Ditto.
+
+ * config/i386/i386-c.c: New file for #pragma support.
+ (ix86_target_macros_internal): New function to #define or #undef
+ target macros based when the user uses the #pragma GCC option to
+ change target options.
+ (ix86_pragma_option_parse): New function to add #pragma GCC option
+ support.
+ (ix86_target_macros): Move defining the target macros here from
+ TARGET_CPU_CPP_BUILTINS in i386.h.
+ (ix86_register_pragmas): Register the #pragma GCC option hook. If
+ defined, initialize any subtarget #pragmas.
+
+ * config/i386/darwin.h (REGISTER_SUBTARGET_PRAGMAS): Rename from
+ REGISTER_TARGET_PRAGMAS.
+
+ * config/i386/t-i386: New file for x86 dependencies.
+ (i386.o): Make dependencies mirror the include files used.
+ (i386-c.o): New file, add dependencies.
+
+ * config/i386/i386-protos.h (override_options): Add bool argument.
+ (ix86_valid_option_attribute_tree): Add declaration.
+ (ix86_target_macros): Ditto.
+ (ix86_register_macros): Ditto.
+
+ * config/i386/i386.c (ix86_tune_features): Move initialization of
+ the target masks to initial_ix86_tune_features to allow functions
+ to have different target options. Make type unsigned char,
+ instead of unsigned int.
+ (initial_ix86_tune_features): New static vector to hold processor
+ masks for the tune variables.
+ (ix86_arch_features): Move initialization of the target masks to
+ initial_ix86_arch_features to allow functions to have different
+ target options. Make type unsigned char, instead of unsigned int.
+ (initial_ix86_arch_features): New static vector to hold processor
+ masks for the arch variables.
+ (enum ix86_function_specific_strings): New enum to describe the
+ string options used for attribute((option(...))).
+ (ix86_target_string): New function to return a string that
+ describes the target options.
+ (ix86_debug_options): New function to print the current options in
+ the debugger.
+ (ix86_function_specific_save): New function hook to save the
+ function specific global variables in the cl_target_option structure.
+ (ix86_function_specific_restore): New function hook to restore the
+ function specific variables from the cl_target_option structure to
+ the global variables.
+ (ix86_function_specific_print): New function hook to print the
+ target specific options in the cl_target_option structure.
+ (ix86_valid_option_attribute_p): New function hook to validate
+ attribute((option(...))) arguments.
+ (ix86_valid_option_attribute_tree): New function that is common
+ code between attribute((option(...))) and #pragma GCC option
+ support that parses the options and returns a tree holding the options.
+ (ix86_valid_option_attribute_inner_p): New helper function for
+ ix86_valid_option_attribute_tree.
+ (ix86_can_inline_p): New function hook to decide if one function
+ can inline another on a target specific basis.
+ (ix86_set_current_function); New function hook to switch target
+ options if the user used attribute((option(...))) or #pragma GCC
+ option.
+ (ix86_tune_defaulted): Move to static file scope from
+ override_options.
+ (ix86_arch_specified): Ditto.
+ (OPTION_MASK_ISA_AES_SET): New macro for moving switches into
+ ix86_isa_flags.
+ (OPTION_MASK_ISA_PCLMUL_SET): Ditto.
+ (OPTION_MASK_ISA_ABM_SET): Ditto.
+ (OPTION_MASK_ISA_POPCNT_SET): Ditto.
+ (OPTION_MASK_ISA_CX16_SET): Ditto.
+ (OPTION_MASK_ISA_SAHF_SET): Ditto.
+ (OPTION_MASK_ISA_AES_UNSET): Ditto.
+ (OPTION_MASK_ISA_PCLMUL_UNSET): Ditto.
+ (OPTION_MASK_ISA_ABM_UNSET): Ditto.
+ (OPTION_MASK_ISA_POPCNT_UNSET): Ditto.
+ (OPTION_MASK_ISA_CX16_UNSET): Ditto.
+ (OPTION_MASK_ISA_SAHF_UNSET): Ditto.
+ (struct ptt): Move to static file scope from override_options.
+ (processor_target_table): Ditto.
+ (cpu_names): Ditto.
+ (ix86_handle_option): Add support for options that are now isa options.
+ (override_options): Add support for declaring functions that
+ support different target options than were specified on the
+ command line. Move struct ptt, processor_target_table, cpu_names,
+ ix86_tune_defaulted, ix86_arch_specified to static file scope.
+ Add bool argument. Fix up error messages so the appropriate error
+ is given for either command line or attribute.
+ (ix86_previous_fndecl): New static to remember previous function
+ declaration to see if we need to change target options.
+ (ix86_builtins_isa): New array to record the ISA of each builtin
+ function.
+ (def_builtin): Always create the builtin function, even if the
+ current ISA doesn't support it.
+ (ix86_init_mmx_sse_builtins): Remove TARGET_AES and TARGET_PCLMUL
+ tests for those builtins.
+ (ix86_init_builtins): Remove TARGET_MMX test for calling
+ ix86_init_mmx_sse_builtins.
+ (ix86_expand_builtin): If the current ISA doesn't support a given
+ builtin, signal an error.
+ (TARGET_VALID_OPTION_ATTRIBUTE_P): Set target hook.
+ (TARGET_SET_CURRENT_FUNCTION): Ditto.
+ (TARGET_OPTION_SAVE): Ditto.
+ (TARGET_OPTION_RESTORE): Ditto.
+ (TARGET_OPTION_PRINT): Ditto.
+ (TARGET_CAN_INLINE_P): Ditto.
+
+2008-07-22 Rafael Avila de Espindola <espindola@google.com>
+
+ * c-typeck.c (build_external_ref): Don't call assemble_external.
+ * final.c (output_operand): Call assemble_external.
+
+2008-07-21 DJ Delorie <dj@redhat.com>
+
+ * config/h8300/h8300.c (h8300_hard_regno_scratch_ok): New.
+ (TARGET_HARD_REGNO_SCRATCH_OK): Define.
+
+2008-07-21 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
+
+ * config/spu/spu.md ("div<mode>3"): Convert into expander, move
+ original insn and splitter contents into ...
+ ("*div<mode>3_fast"): ... this new pattern. Enable only if
+ flag_unsafe_math_optimizations. Add dummy scratch register.
+ ("*div<mode>3_adjusted"): New insn and splitter. Enable only if
+ !flag_unsafe_math_optimizations. Returns number with next
+ highest magnitude if this is still less or equal to the true
+ quotient in magnitude.
+
+2008-07-21 Rafael Avila de Espindola <espindola@google.com>
+
+ * Makefile.in: Replace toplev.h with TOPLEV_H.
+ * c-decl.c (merge_decls): Don't set DECL_IN_SYSTEM_HEADER.
+ * c-lex.c (fe_file_change): Don't set in_system_header.
+ * c-parser.c (c_token): Remove in_system_header.
+ (c_lex_one_token): Don't set in_system_header.
+ (c_parser_set_source_position_from_token): Don't set in_system_header.
+ * diagnostic.c (diagnostic_report_diagnostic): Use location from
+ diagnostic_info.
+ (warning_at): New.
+ * diagnostic.h (diagnostic_report_warnings_p): Add LOC argument.
+ * flags.h (in_system_header): Remove.
+ * function.c (saved_in_system_header): Remove.
+ (push_cfun): Don't set in_system_header.
+ (pop_cfun): Don't set in_system_header.
+ (push_struct_function): Don't set in_system_header.
+ * input.h (expanded_location): Add sysp.
+ (in_system_header_at): New.
+ (in_system_header): New.
+ * toplev.c (in_system_header): Remove.
+ * toplev.h: Include input.h
+ (warning_at): New.
+ * tree-cfg.c (execute_warn_function_return): Call warning_at.
+ * tree-ssa.c (warn_uninit): Call warning_at.
+ (warn_uninitialized_var): Update calls to warn_uninit.
+ (warn_uninitialized_phi): Update calls to warn_uninit.
+ * tree.c (make_node_stat): Don't set DECL_IN_SYSTEM_HEADER.
+ (expand_location): Initialize xloc.sysp.
+ * tree.h (DECL_IN_SYSTEM_HEADER): Use in_system_header_at.
+ (tree_decl_with_vis): Remove in_system_header_flag.
+
+2008-07-21 Andreas Krebbel <krebbel1@de.ibm.com>
+
+ PR target/36822
+ * recog.c (asm_operand_ok): Change the order of the extra
+ memory constraint checks.
+
+2008-07-20 Andrew Pinski <andrew_pinski@playstation.sony.com>
+
+ PR tree-opt/36879
+ * tree-switch-conversion.c (build_one_array): Call
+ varpool_mark_needed_node and varpool_finalize_decl
+ instead of assemble_variable.
+
+2008-07-19 Jan Hubicka <jh@suse.cz>
+
+ * cgraph.c (cgraph_add_new_function): Do early local passes.
+ * tree-nrv.c (gate_pass_return_slot): New gate.
+ (pass_nrv): Add the gate.
+ * tree-ssa-coalese.c (hash_ssa_name_by_var, eq_ssa_name_by_var): New
+ functions.
+ (coalesce_ssa_name): Coalesce SSA names.
+ * tree-ssa-live.c (remove_unused_locals): Be more conservative when
+ not optimizing so unused user vars remains visible.
+ * common.opt (flag_tree_ter): Always enable by default.
+ * tree-ssa-ter.c: Include flags.h
+ (is_replaceable_p): Check that locations match; when aliasing is missing
+ be conservative about loads.
+ * tree-optimize.c (gate_init_datastructures): Remove.
+ (pass_init_datastructures): New.
+ * passes.c: Reorder passes so we always go into SSA.
+
+2008-07-19 Jan Hubicka <jh@suse.cz>
+
+ * doc/extend.texi (flatten attribute): Remove note about unit-at-a-time
+ * doc/invoke.texi (--combine): Likewise.
+ (-finline-functions-called-once): Update levels when enabled.
+ (-funit-at-a-time): Document new behaviour.
+ (-ftoplevel-reorder): Document that it is enabled -O0 and imply
+ -fno-section-anchors when disabled explicitly.
+ (inline params): They are not ignored now.
+ (precompiled headers): Remove unit-at-a-time as being incompatible.
+ * opts.c (decode_options): Handle unit-at-a-time as alias;
+ imply -fno-section-anchors when toplevel reorder is disabled
+ explicitly.
+ * common.opt (ftoplevel-reorder): Set default value to 2.
+ (funit-at-a-time): Set default value to 1.
+ * config/rs6000/rs6000.c (optimization_options): Set section anchors
+ to 2.
+
+2008-07-19 Jan Hubicka <jh@suse.cz>
+
+ * builtins.c (expand_builtin_int_roundingfn,
+ expand_builtin_int_roundingfn_2): Do not take subtarget argument;
+ it is not useful.
+
+2008-07-19 Richard Guenther <rguenther@suse.de>
+
+ PR bootstrap/36864
+ * tree-ssa-sccvn.h (get_constant_value_id): Declare.
+ * tree-ssa-sccvn.c (get_constant_value_id): New function.
+ * tree-ssa-pre.c (get_expr_value_id): For newly created
+ constant value-ids make sure to add the expression to its
+ expression-set.
+
+2008-07-19 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/36877
+ * omp-low.c (expand_omp_atomic_fetch_op): Make sure the
+ return value of the builtin is ignored.
+
+2008-07-19 Olivier Hainque <hainque@adacore.com>
+
+ * doc/tm.texi (MALLOC_ABI_ALIGNMENT): New macro. Alignment, in
+ bits, a C conformant malloc implementation has to provide.
+ * defaults.h (MALLOC_ABI_ALIGNMENT): Default to BITS_PER_WORD.
+
+2008-07-19 Joseph Myers <joseph@codesourcery.com>
+
+ PR target/36780
+ PR target/36827
+ * reload.c (find_reloads_subreg_address): Only reload address if
+ reloaded == 0, not for reloaded != 1.
+
+ Revert:
+ 2008-07-16 Joseph Myers <joseph@codesourcery.com>
+ * config/m32c/m32c.c (BIG_FB_ADJ): Move definition earlier.
+ (m32c_legitimate_address_p): Handle "++rii" addresses created by
+ m32c_legitimize_reload_address.
+
+ 2008-07-15 Kaz Kojima <kkojima@gcc.gnu.org>
+ * config/sh/sh.h (GO_IF_LEGITIMATE_ADDRESS): Allow
+ (plus (plus (reg) (const_int)) (const_int)) when reload_in_progress.
+
+2008-07-19 Olivier Hainque <hainque@adacore.com>
+
+ * dwarf2out.c (add_subscript_info): New explicit COLLAPSE_P
+ argument, saying whether nested array are to be collapsed
+ into a single array type DIE with multiple subscripts.
+ (gen_array_type_die): Factorize comments about the MIPS_DEBUG_INFO
+ issues, centralize the nested array types collapsing control and
+ disable the transformation for Ada.
+
+2008-07-18 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/36786
+ * config/i386/i386.md (x86_64_shift_adj_1): Rename from
+ x86_64_shift_adj.
+ (x86_64_shift_adj_2): New expander.
+ (x86_64_shift_adj_3): Ditto.
+ * config/i386/i386.c (ix86_split_ashr): Use gen_x86_64_shift_adj_3
+ to split TImode operands.
+ (ix86_split_ashl): Use gen_x86_64_shift_adj_2 to split TImode operands.
+ (ix86_split_lshr): Ditto.
+
+2008-07-18 Kris Van Hees <kris.van.hees@oracle.com>
+
+ * c-common.c (c_stddef_cpp_builtins): Define __CHAR16_TYPE__
+ and __CHAR32_TYPE__.
+ * c-typeck.c (digest_init): Support char16_t and char32_t.
+ (set_nonincremental_init_from_string): Idem.
+
+2008-07-18 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR middle-end/36859
+ * builtins.c (std_gimplify_va_arg_expr): Limit alignment to
+ PREFERRED_STACK_BOUNDARY.
+ * config/i386/i386.c (ix86_gimplify_va_arg): Likewise.
+
+2008-07-18 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR middle-end/36858
+ * function.c (locate_and_pad_parm): Cap boundary earlier.
+
+2008-07-17 Julian Brown <julian@codesourcery.com>
+
+ * config/arm/arm.c (arm_cxx_determine_class_data_visibility): Make
+ no-op for targets which don't use DLLs.
+
+2008-07-17 Martin Jambor <mjambor@suse.cz>
+
+ * ipa-cp.c (ipcp_print_all_lattices): New variable info, check
+ that nodes are relevant by examining the node->analyzed flag.
+ (ipcp_init_stage): Check which nodes are relevant, assert that the
+ relevant ones are also required.
+ (ipcp_propagate_stage): Check on the side arrays are properly
+ allocated.
+ (ipcp_print_all_jump_functions): Make sure not to touch any node
+ that is not analyzed or an edge that does not have a corresponding
+ entry in the on-the-side vectors.
+ (ipcp_function_scale_print): Likewise.
+ (ipcp_update_callgraph): Check that the node is relevant.
+ (ipcp_insert_stage): Check that the node is relevant. Check there is
+ an info for every node and edge.
+ * ipa-prop.c (ipa_init_func_list): Check the nodes are relevant.
+ (ipa_print_all_tree_maps): Likewise and a new variable info.
+ (ipa_print_all_params_modified): Likewise.
+ * ipa-prop.h (ipa_edge_args_info_available_for_edge_p): New function.
+
+2008-07-17 Roman Zippel <zippel@linux-m68k.org>
+
+ PR target/25343
+ * config/host-linux.c (TRY_EMPTY_VM_SPACE): Define for __mc68000__.
+
+2008-07-17 Paolo Bonzini <bonzini@gnu.org>
+
+ PR rtl-optimization/36753
+ * fwprop.c (use_killed_between): Don't shortcut
+ single-definition global registers.
+
+2008-07-16 Jan Hubicka <jh@suse.cz>
+
+ * cgraph.h (varpool_empty_needed_queue): Declare.
+ * cgraphunit.c (output_in_order): Mark all variables as needed;
+ empty the queue.
+ * varpool.c (varpool_assemble_node): Update debug queue.
+ (varpool_assemble_pending_decls): Don't do it here.
+ (varpool_empty_needed_queue): New function.
+
+2008-07-16 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * recog.c (peephole2_optimize): Fix formatting.
+
+2008-07-16 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * c-pch.c (get_ident): Avoid C++ keywords.
+ * combine-stack-adj.c (single_set_for_csa): Likewise.
+ * final.c (asm_insn_count, final_scan_insn, alter_subreg,
+ output_asm_insn): Likewise.
+ * reload.c (push_secondary_reload, find_reusable_reload,
+ push_reload, combine_reloads, find_reloads,
+ debug_reload_to_stream): Likewise.
+ * reload.h (struct reload): Likewise.
+ * reload1.c (reload_reg_class_lower, find_reg, find_reload_regs,
+ allocate_reload_reg, choose_reload_regs, emit_input_reload_insns,
+ emit_output_reload_insns): Likewise.
+ * targhooks.c (default_secondary_reload): Likewise.
+ * varasm.c (section_entry_eq, object_block_entry_eq): Likewise.
+
+2008-07-16 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * recog.c (validate_change_1, validate_change,
+ validate_unshare_change, validate_replace_rtx_1, struct
+ funny_match, constrain_operands, peephole2_optimize): Avoid C++
+ keywords.
+ * reload.c (push_secondary_reload, secondary_reload_class,
+ scratch_reload_class, find_valid_class, find_reusable_reload,
+ push_reload, find_dummy_reload, find_reloads_address_1,
+ find_reloads_address_part, find_equiv_reg): Likewise.
+ * reload1.c (spill_failure, eliminate_regs_1, allocate_reload_reg,
+ choose_reload_regs): Likewise.
+ * rtlanal.c (replace_rtx, nonzero_bits1, num_sign_bit_copies1):
+ Likewise.
+ * rtlhooks.c (gen_lowpart_if_possible): Likewise.
+ * sched-ebb.c (add_deps_for_risky_insns): Likewise.
+ * sched-rgn.c (concat_INSN_LIST): Likewise.
+ * stor-layout.c (mode_for_size, mode_for_size_tree,
+ smallest_mode_for_size): Likewise.
+
+2008-07-16 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * cfg.c (dump_reg_info): Avoid C++ keywords.
+ * dwarf2asm.c (dw2_force_const_mem,
+ dw2_asm_output_encoded_addr_rtx): Likewise.
+ * except.c (gen_eh_region, add_action_record, output_ttype): Likewise.
+ * expmed.c (expand_shift): Likewise.
+ * global.c (find_reg): Likewise.
+ * graph.c (draw_edge): Likewise.
+ * local-alloc.c (reg_meets_class_p, find_free_reg): Likewise.
+ * optabs.c (expand_binop, expand_twoval_unop, expand_twoval_binop,
+ widen_clz, widen_bswap, expand_parity, expand_unop,
+ emit_cmp_and_jump_insn_1): Likewise.
+ * postreload.c (reload_cse_simplify_operands): Likewise.
+ * ra.h (add_neighbor): Likewise.
+ * reg-stack.c (remove_regno_note, change_stack): Likewise.
+ * regclass.c (memory_move_secondary_cost, dump_regclass, regclass,
+ record_reg_classes, copy_cost, record_address_regs,
+ invalid_mode_change_p): Likewise.
+ * regrename.c (regrename_optimize, scan_rtx_reg,
+ dump_def_use_chain, find_oldest_value_reg,
+ replace_oldest_value_reg, copyprop_hardreg_forward_1): Likewise.
+
+2008-07-16 David Edelsohn <edelsohn@gnu.org>
+
+ * config/rs6000/rs6000.c (processor_target_table): Remove duplicate
+ MASK_POWERPC64 for power4 in previous commit.
+
+2008-07-16 Olivier Hainque <hainque@adacore.com>
+
+ * collect2.c (scan_prog_file, COFF version): Use CONST_CAST
+ instead of bare conversion to cast const-ness away.
+
+2008-07-16 Anatoly Sokolov <aesok@post.ru>
+
+ * config/xtensa/xtensa.h (FUNCTION_OUTGOING_VALUE,
+ XTENSA_FUNCTION_VALUE, XTENSA_FUNCTION_VALUE): Remove.
+ * config/xtensa/xtensa.c (xtensa_function_value): New function.
+ (TARGET_FUNCTION_VALUE): Define.
+
+2008-07-16 David Edelsohn <edelsohn@gnu.org>
+
+ * config/rs6000/rs6000.c (processor_target_table): Add
+ MASK_PPC_GPOPT for power4, power5, power5+, power6, and power6x.
+
+2008-07-16 Joseph Myers <joseph@codesourcery.com>
+
+ PR target/36827
+ * config/m32c/m32c.c (BIG_FB_ADJ): Move definition earlier.
+ (m32c_legitimate_address_p): Handle "++rii" addresses created by
+ m32c_legitimize_reload_address.
+
+2007-07-16 Rafael Avila de Espindola <espindola@google.com>
+
+ * c-decl.c (merge_decls): Keep DECL_SOURCE_LOCATION and
+ DECL_IN_SYSTEM_HEADER in sync.
+
+2008-07-15 Daniel Berlin <dberlin@dberlin.org>
+
+ * tree-ssa-sccvn.c (expressions_equal_p): Check type equality.
+ * tree-ssa-pre.c (pre_expr_eq): Ditto
+ (get_constant_for_value_id): Take a type as an argument.
+ (fully_constant_expression): Pass in type.
+ (find_or_generate_expression): Short circuit constant case.
+ (create_expression_by_pieces): Remove special casing of
+ pointer_plus.
+ (do_regular_insertion): Short circuit constant case.
+ (do_partial_partial_insertion): Ditto.
+
2008-07-15 Kaz Kojima <kkojima@gcc.gnu.org>
PR target/36782
* config/sh/sh.md (symGOT_load): Don't add REG_EQUAL note.
2008-07-15 Bob Wilson <bob.wilson@acm.org>
-
+
* config/xtensa/libgcc-xtensa.ver: New file.
* config/xtensa/t-linux (SHLIB_MAPFILES): Append libgcc-xtensa.ver.
-
+
2008-07-15 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* df-problems.c (df_set_note): Avoid C++ keywords.
@@ -35,11 +3175,9 @@
* caller-save.c (insert_restore, insert_save, insert_one_insn):
Likewise.
* combine.c (subst, simplify_set, make_extraction,
- make_compound_operation, known_cond, simplify_shift_const_1):
- Likewise.
+ make_compound_operation, known_cond, simplify_shift_const_1): Likewise.
* cse.c (make_regs_eqv, merge_equiv_classes, validate_canon_reg,
- fold_rtx, equiv_constant, cse_insn, cse_process_notes_1):
- Likewise.
+ fold_rtx, equiv_constant, cse_insn, cse_process_notes_1): Likewise.
2008-07-15 Richard Guenther <rguenther@suse.de>
@@ -143,8 +3281,7 @@
* tree-ssa-sccvn.c (pre_info): Remove.
(switch_to_PRE_table): Likewise.
- (free_scc_vn): Do not clear SSA_NAME_VALUE.
- Do not free pre_info.
+ (free_scc_vn): Do not clear SSA_NAME_VALUE. Do not free pre_info.
(set_hashtable_value_ids): Do not create value-ids for the
optimistic tables.
(run_scc_vn): Remove double test. Remove bogus special-case
@@ -166,8 +3303,7 @@
2008-07-14 Richard Guenther <rguenther@suse.de>
- * tree-ssa-pre.c (insert_into_preds_of_block): Do not call
- convert.
+ * tree-ssa-pre.c (insert_into_preds_of_block): Do not call convert.
2008-07-14 Andreas Krebbel <krebbel1@de.ibm.com>
@@ -197,8 +3333,7 @@
2008-07-13 Daniel Berlin <dberlin@dberlin.org>
- * tree-ssa-pre.c (fully_constant_expression): Add fold_convert
- calls.
+ * tree-ssa-pre.c (fully_constant_expression): Add fold_convert calls.
(create_expression_by_pieces): Fix typo.
(do_regular_insertion): Use debug counter here too.
@@ -264,7 +3399,7 @@
* config/h8300/h8300.md (length): Fix branch offset limit.
-2008-07-11 Anatoly Sokolov <aesok@post.ru>
+2008-07-11 Anatoly Sokolov <aesok@post.ru>
* config/avr/avr-protos.h (avr_peep2_scratch_safe): Remove prototype.
* config/avr/avr.c (avr_peep2_scratch_safe): Remove.
@@ -329,8 +3464,7 @@
2008-07-10 Daniel Berlin <dberlin@dberlin.org>
- * tree-ssa-pre.c (create_expression_by_pieces): Add fold_convert
- calls.
+ * tree-ssa-pre.c (create_expression_by_pieces): Add fold_convert calls.
(eliminate): Ditto.
(execute_pre): Call loop_optimizer_finalize in early exit.
@@ -404,7 +3538,7 @@
callers.
* omp-low.c (lower_omp_sections, lower_omp_single, lower_omp_master,
lower_omp_ordered, lower_omp_critical, lower_omp_for,
- create_task_copyfn, lower_omp_taskreg, execute_lower_omp):
+ create_task_copyfn, lower_omp_taskreg, execute_lower_omp):
* tree-ssa-ccp.c (convert_to_gimple_builtin): Likewise.
* tree-sra.c (generate_element_init): Likewise.
* tree-mudflap.c (execute_mudflap_function_ops,
@@ -510,16 +3644,15 @@
2008-07-08 Jakub Jelinek <jakub@redhat.com>
- * tree-sra.c (sra_build_assignment): Handle CONVERT_EXPR_P
- dst.
+ * tree-sra.c (sra_build_assignment): Handle CONVERT_EXPR_P dst.
2008-07-05 Daniel Berlin <dberlin@dberlin.org>
-
+
Fix PR tree-optimization/23455
Fix PR tree-optimization/35286
Fix PR tree-optimization/35287
* Makefile.in (OBJS-common): Remove tree-vn.o.
- tree-vn.o: Remove.
+ (tree-vn.o): Remove.
* dbgcnt.def: Add treepre_insert debug counter.
* gcc/tree-flow.h (add_to_value): Updated for other changes.
(debug_value_expressions): Ditto.
@@ -557,30 +3690,26 @@
(value_id_constant_p): Ditto.
(vn_reference_compute_hash): De-staticify.
(copy_reference_ops_from_ref): Don't use get_callee_fndecl.
- Disable some code with a FIXME.
- Remove VALUE_HANDLE use.
- (valueize_refs): Update opcode if it changes from ssa name to
- constant.
+ Disable some code with a FIXME. Remove VALUE_HANDLE use.
+ (valueize_refs): Update opcode if it changes from ssa name to constant.
(vn_reference_lookup_1): Add new argument.
(vn_reference_lookup): Ditto.
(vn_reference_lookup_pieces): New function.
- (vn_reference_insert): Add return type. Modify to deal with value
- ids.
+ (vn_reference_insert): Add return type. Modify to deal with value ids.
(vn_reference_insert_pieces): New function.
(vn_nary_op_compute_hash): De-staticify.
(vn_nary_op_eq): Ditto.
(vn_nary_op_lookup_pieces): New function.
- (vn_nary_op_lookup): Add new argument.
+ (vn_nary_op_lookup): Add new argument.
(vn_nary_op_insert_pieces): New function.
- (vn_nary_op_insert): Add return type. Modify to deal with value
- ids.
+ (vn_nary_op_insert): Add return type. Modify to deal with value ids.
(vn_phi_insert): Ditto.
(visit_unary_op): Update for callee changes.
(visit_binary_op): Ditto.
(visit_reference_op_load): Ditto.
(visit_reference_op_store): Ditto.
(init_scc_vn): Init next_value_id, constant_to_value_id and
- constant_value_ids.
+ constant_value_ids.
(free_scc_vn): Free them.
(set_hashtable_value_ids): New function.
(run_scc_vn): Use it.
@@ -593,7 +3722,7 @@
above).
* tree.c (iterative_hash_hashval_t): Made non-static
* tree.h (iterative_hash_hashval_t): Declare it.
-
+
2008-07-08 Martin Jambor <mjambor@suse.cz>
* ipa-cp.c (ipcp_init_cloned_node): Call ipa_check_create_node_params
@@ -625,7 +3754,7 @@
(ipa_register_cgraph_hooks): New function.
(ipa_unregister_cgraph_hooks): New function.
(free_all_ipa_structures_after_ipa_cp): New function.
-
+
* ipa-prop.h: Include vec.h.
(ipa_node_params_t): New typedef with vector types for it.
(ipa_edge_args_t): New typedef with vector types for it.
@@ -633,10 +3762,10 @@
(IPA_EDGE_REF): Changed to access an on-the-side vector.
(ipa_check_create_node_params): New function.
(ipa_check_create_edge_args): New function.
-
+
* Makefile.in (IPA_PROP_H): New variable for ipa-prop.h. Converted
all users.
-
+
2008-07-07 Tom Tromey <tromey@redhat.com>
* configure, config.in: Rebuilt.
@@ -653,17 +3782,16 @@
2008-07-07 Fernando Pereira <fernando@cs.ucla.edu>
- * tree-ssa-structalias.c (compute_points_to_sets): Add call to
- dump_constraint_graph.
- (dump_constraint_edge): New function.
- (dump_constraint_graph): New function.
- (debug_constraint_graph): New function.
- (dump_constraint): Removed useless comparison.
- * tree-ssa-structalias.h (dump_constraint_edge): Declare.
- (dump_constraint_graph): Declare.
- (debug_constraint_graph): Declare.
- * tree-dump.c (struct dump_option_value_info): Declare
- TDF_GRAPH.
+ * tree-ssa-structalias.c (compute_points_to_sets): Add call to
+ dump_constraint_graph.
+ (dump_constraint_edge): New function.
+ (dump_constraint_graph): New function.
+ (debug_constraint_graph): New function.
+ (dump_constraint): Removed useless comparison.
+ * tree-ssa-structalias.h (dump_constraint_edge): Declare.
+ (dump_constraint_graph): Declare.
+ (debug_constraint_graph): Declare.
+ * tree-dump.c (struct dump_option_value_info): Declare TDF_GRAPH.
2008-07-07 Kai Tietz <kai.tietz@onevision.com>
@@ -720,7 +3848,7 @@
-print-sysroot option.
(main): Print the sysroot if requested.
* doc/invoke.texi (Debugging Options): Document -print-sysroot.
-
+
2008-07-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
PR target/34780
@@ -728,8 +3856,7 @@
2008-07-07 Daniel Jacobowitz <dan@codesourcery.com>
- * function.c (assign_parm_remove_parallels): Check mode of
- entry_parm.
+ * function.c (assign_parm_remove_parallels): Check mode of entry_parm.
(assign_parm_setup_block_p): Also check mode of entry_parm.
2008-07-07 Richard Guenther <rguenther@suse.de>
@@ -774,7 +3901,7 @@
2008-07-07 Maxim Kuvyrkov <maxim@codesourcery.com>
* config/m68k/m68k.c (m68k_return_in_memory): Fix arguments types.
-
+
2008-07-07 Mark Shinwell <shinwell@codesourcery.com>
* config/m68k/lb1sf68.asm: Add PIC macros for Linux targets.
@@ -899,14 +4026,13 @@
2008-07-04 Roger Sayle <roger@eyesopen.com>
- * config/rs6000/host-darwin.c (darwin_rs6000_extra_siganls): Cast
+ * config/rs6000/host-darwin.c (darwin_rs6000_extra_signals): Cast
the "void*" result of xmalloc to "char*" to fix bootstrap breakage.
2008-07-04 Kaz Kojima <kkojima@gcc.gnu.org>
PR target/36684
- * config/sh/sh.h (OVERRIDE_OPTIONS): Disable -fschedule-insns
- for PIC.
+ * config/sh/sh.h (OVERRIDE_OPTIONS): Disable -fschedule-insns for PIC.
2008-07-04 Jakub Jelinek <jakub@redhat.com>
@@ -951,8 +4077,7 @@
Likewise.
* ggc-common.c (hash_descriptor, eq_descriptor, hash_ptr, eq_ptr,
loc_descriptor, ggc_prune_ptr, ggc_free_overhead,
- final_cmp_statistic, cmp_statistic, dump_ggc_loc_statistics):
- Likewise.
+ final_cmp_statistic, cmp_statistic, dump_ggc_loc_statistics): Likewise.
* varray.c (hash_descriptor, eq_descriptor, varray_descriptor):
Likewise.
@@ -1174,7 +4299,7 @@
2008-07-02 Martin Jambor <mjambor@suse.cz>
* tree-switch-conversion.c: Included timevar.h which I forgot before.
-
+
2008-07-02 Martin Jambor <mjambor@suse.cz>
* tree-switch-conversion.c: Included timevar.h
@@ -1302,7 +4427,7 @@
2008-06-30 Kenneth Zadeck <zadeck@naturalbridge.com>
* ifcvt.c (cond_move_process_if_block): Free vectors on false return.
-
+
2008-06-30 Kenneth Zadeck <zadeck@naturalbridge.com>
PR rtl-optimization/34744
@@ -1331,7 +4456,7 @@
(ix86_init_builtins): Here.
(ix86_scalar_mode_supported_p): Always return true for TFmode.
(ix86_c_mode_for_suffix): Always return TFmode and XFmode for
- 'q' and 'w', respectively.
+ 'q' and 'w', respectively.
* config/i386/i386.md (movtf): Check TARGET_SSE2 instead of
TARGET_64BIT.
@@ -2215,7 +5340,7 @@
2008-06-22 Andy Hutchinson <hutchinsonandy@aim.com>
* config/avr/avr.h (SUPPORTS_INIT_PRIORITY): Define.
-
+
2008-06-22 Laurynas Biveinis <laurynas.biveinis@gmail.com>
PR middle-end/34906
@@ -2363,7 +5488,7 @@
* tree-ssa-loop-im.c (mem_ref_in_stmt, memref_hash, memref_eq,
memref_free, gather_mem_refs_stmt, vtoe_hash, vtoe_eq, vtoe_free,
record_vop_access, get_vop_accesses, get_vop_stores): Likewise.
- * tree-ssa-loop-prefetch.c (determine_loop_nest_reuse): Likewise.
+ * tree-ssa-loop-prefetch.c (determine_loop_nest_reuse): Likewise.
* tree-ssa-sccvn.c (VN_INFO_GET, free_phi, free_reference,
vn_nary_op_insert): Likewise.
* tree-ssa.c (redirect_edge_var_map_add,
@@ -2689,20 +5814,20 @@
2008-06-17 Eric B. Weddington <eric.weddington@atmel.com>
* config/avr/avr.c (avr_mcu_t): Remove atmega32hvb.
- * config/avr/avr.h (LINK_SPEC, CRT_BINUTILS_SPECS): Likewise.
- * config/avr/t-avr (MULTILIB_MATCHES): Likewise.
+ * config/avr/avr.h (LINK_SPEC, CRT_BINUTILS_SPECS): Likewise.
+ * config/avr/t-avr (MULTILIB_MATCHES): Likewise.
2008-06-17 Eric B. Weddington <eric.weddington@atmel.com>
* config/avr/avr.c (avr_mcu_t): Add attiny167.
- * config/avr/avr.h (LINK_SPEC, CRT_BINUTILS_SPECS): Likewise.
- * gcc/config/avr/t-avr (MULTILIB_MATCHES): Likewise.
+ * config/avr/avr.h (LINK_SPEC, CRT_BINUTILS_SPECS): Likewise.
+ * gcc/config/avr/t-avr (MULTILIB_MATCHES): Likewise.
2008-06-17 Eric B. Weddington <eric.weddington@atmel.com>
* config/avr/avr.c (avr_mcu_t): Add atmega32u4.
- * config/avr/avr.h (LINK_SPEC, CRT_BINUTILS_SPECS): Likewise.
- * config/avr/t-avr (MULTILIB_MATCHES): Likewise.
+ * config/avr/avr.h (LINK_SPEC, CRT_BINUTILS_SPECS): Likewise.
+ * config/avr/t-avr (MULTILIB_MATCHES): Likewise.
2008-06-17 Bernhard Fischer <aldot@gcc.gnu.org>
@@ -2763,7 +5888,7 @@
(delete_unmarked_insns): Don't handle libcall blocks.
(preserve_libcall_for_dce): Remove.
(prescan_insns_for_dce): Don't special-case libcall block insns.
- * reload1 (reload): Don't handle libcall notes.
+ * reload1 (reload): Don't handle libcall notes.
* doc/rtl.texi (REG_LIBCALL, REG_RETVAL, REG_LIBCALL_ID): Remove
documentation.
@@ -2777,7 +5902,7 @@
* config/avr/avr.c (avr_mcu_t): Add atmega32m1.
* config/avr/avr.h (LINK_SPEC, CRT_BINUTILS_SPECS): Likewise.
- * config/avr/t-avr (MULTILIB_MATCHES): Likewise.
+ * config/avr/t-avr (MULTILIB_MATCHES): Likewise.
2008-06-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
@@ -2798,7 +5923,7 @@
2008-06-015 Andy Hutchinson <hutchinsonandy@aim.com>
PR target/36336
- * config/avr/avr.h (LEGITIMIZE_RELOAD_ADDRESS): Add check for
+ * config/avr/avr.h (LEGITIMIZE_RELOAD_ADDRESS): Add check for
reg_equiv_constant.
2008-06-15 Maxim Kuvyrkov <maxim@codesourcery.com>
@@ -2874,7 +5999,7 @@
Nathan Sidwell <nathan@codesourcery.com>
Maxim Kuvyrkov <maxim@codesourcery.com>
Richard Sandiford <rdsandiford@googlemail.com>
-
+
* config/mips/mips-modes.def: Add V8QI, V4HI and V2SI modes.
* config/mips/mips-protos.h (mips_expand_vector_init): New.
* config/mips/mips-ftypes.def: Add function types for Loongson-2E/2F
@@ -3177,7 +6302,7 @@
2008-06-09 Andy Hutchinson <hutchinsonandy@aim.com>
PR middle-end/36447
- * simplify-rtx.c (simplify_subreg): Add check for shift count
+ * simplify-rtx.c (simplify_subreg): Add check for shift count
greater than size.
2008-06-09 Richard Sandiford <rdsandiford@googlemail.com>
@@ -3292,7 +6417,7 @@
* doc/invoke.texi (Wenum-compare): Mention that it is enabled by
default.
-
+
2008-06-08 Joseph Myers <joseph@codesourcery.com>
PR tree-optimization/36218
@@ -3306,8 +6431,8 @@
PR target/36424
* config/avr/avr.h (HARD_REGNO_RENAME_OK): Define.
- * config/avr/avr.c (avr_hard_regno_rename_ok): New function.
- * config/avr/avr-protos.h (avr_hard_regno_rename_ok): New prototype.
+ * config/avr/avr.c (avr_hard_regno_rename_ok): New function.
+ * config/avr/avr-protos.h (avr_hard_regno_rename_ok): New prototype.
2008-06-07 Danny Smith <dannysmith@users.sourceforge.net>
@@ -3635,7 +6760,7 @@
Rename parallel_nesting_level to taskreg_nesting_level.
(scan_omp_task): New function.
(lower_rec_input_clauses): Don't run constructors for firstprivate
- explicit task vars which are initialized by *_omp_cpyfn*.
+ explicit task vars which are initialized by *_omp_cpyfn*.
Pass outer var ref to omp_clause_default_ctor hook if
OMP_CLAUSE_PRIVATE_OUTER_REF or OMP_CLAUSE_LASTPRIVATE.
Replace OMP_CLAUSE_REDUCTION_PLACEHOLDER decls in
@@ -3909,11 +7034,11 @@
PR target/30243
* builtins.c (expand_builtin_signbit): Don't take lowpart when
- register is already smaller or equal to required mode.
+ register is already smaller or equal to required mode.
2008-06-04 Xinliang David Li <davidxl@google.com>
- * tree-call-cdce.c: New file.
+ * tree-call-cdce.c: New file.
(cond_dead_built_in_calls): New static variable.
(input_domain): New struct.
(check_pow): New function.
@@ -4088,7 +7213,7 @@
* config/i386/mingw32.h (EXTRA_OS_CPP_BUILTINS): Replace
TARGET_64BIT_MS_ABI by DEFAULT_ABI compare to MS_ABI.
-2008-06-02 Andy Hutchinson <hutchinsonandy@aim.com>
+2008-06-02 Andy Hutchinson <hutchinsonandy@aim.com>
PR target/34879
* config/avr/avr.c (TARGET_BUILTIN_SETJMP_FRAME_VALUE): Redefine.
@@ -4224,10 +7349,10 @@
* config/avr/avr.md (UNSPECV_WRITE_SP_IRQ_ON): New constants.
(UNSPECV_WRITE_SP_IRQ_OFF): (Ditto.).
(movhi_sp_r_irq_off, movhi_sp_r_irq_on): New insn.
- * config/avr/avr.c (expand_prologue, expand_epilogue): Use
- movhi_sp_r_irq_off and movhi_sp_r_irq_on insns for writing to the
+ * config/avr/avr.c (expand_prologue, expand_epilogue): Use
+ movhi_sp_r_irq_off and movhi_sp_r_irq_on insns for writing to the
stack pointer register.
- (output_movhi): Remove code for interrupt specific writing to the
+ (output_movhi): Remove code for interrupt specific writing to the
stack pointer register.
2008-05-31 Richard Guenther <rguenther@suse.de>
@@ -4356,7 +7481,7 @@
call clobber check for NMTs.
2008-05-28 Seongbae Park <seongbae.park@gmail.com>
-
+
* value-prof.c (tree_ic_transform): Use HOST_WIDEST_INT_PRINT_DEC
for printing gcov_type.
@@ -4594,9 +7719,9 @@
that the bitfield is of integral type before testing its precision.
2008-05-27 Trevor Smigiel <trevor_smigiel@playstation.sony.com>
- Sa Liu <saliu@de.ibm.com>
+ Sa Liu <saliu@de.ibm.com>
- * config/spu/spu.c (spu_init_libfuncs): Add __multi3, __divti3,
+ * config/spu/spu.c (spu_init_libfuncs): Add __multi3, __divti3,
__modti3, __udivti3, __umodti3 and __udivmodti4.
* config/spu/t-spu-elf (LIB2FUNCS_STATIC_EXTRA): Add files
that implement TImode mul and div functions.
@@ -4635,7 +7760,7 @@
* config/avr/avr.md ("call_prologue_saves"): Use hi8(gs())/lo8(gs())
instead of pm_lo8/pm_hi8 to makes this call working on avr6.
- * config/avr/avr.c (expand_prologue): Tune "call_prologue"
+ * config/avr/avr.c (expand_prologue): Tune "call_prologue"
optimization for 'avr6' architecture.
2008-05-26 Andy Hutchinson <hutchinsonandy@aim.com>
@@ -5173,7 +8298,7 @@
* tree-data-ref.c (dr_analyze_indices): Replace resolve_mixers with
instantiate_scev.
(analyze_siv_subscript): Pass in the loop nest number.
- Call evolution_function_is_affine_in_loop instead of
+ Call evolution_function_is_affine_in_loop instead of
evolution_function_is_affine_p.
(analyze_overlapping_iterations): Pass in the loop nest number.
@@ -5239,7 +8364,7 @@
2008-05-19 Xinliang David Li <davidxl@google.com>
- * tree-ssa-dce.c: Revert patches of 2008-05-17 and 2008-05-18.
+ * tree-ssa-dce.c: Revert patches of 2008-05-17 and 2008-05-18.
* opts.c: Ditto.
* common.opt: Ditto.
* doc/invoke.texi: Ditto.
@@ -5298,7 +8423,7 @@
2008-05-18 Xinliang David Li <davidxl@google.com>
* gcc/tree-ssa-dce.c: Coding style fix.
- (check_pow): Documentation comment.
+ (check_pow): Documentation comment.
(check_log): Documenation comment. Coding style fix.
(is_unnecessary_except_errno_call): Ditto.
(gen_conditions_for_pow): Ditto.
@@ -5306,7 +8431,7 @@
(gen_shrink_wrap_conditions): Ditto.
(shrink_wrap_one_built_in_calls): Ditto.
* gcc/doc/invoke.texi: Better documentation string.
- * ChangeLog: Fix wrong change log entries from
+ * ChangeLog: Fix wrong change log entries from
May 17 checkin on function call DCE.
2008-05-17 Kaz Kojima <kkojima@gcc.gnu.org>
@@ -5318,7 +8443,7 @@
* doc/rtl.texi (RTL_CONST_CALL_P, RTL_PURE_CALL_P): Fixed typos.
* df-problems.c (simulation routines): Fixed block comment to
properly say how to add forwards scanning functions.
-
+
2008-05-17 Eric Botcazou <ebotcazou@adacore.com>
* tree-inline.c (setup_one_parameter): Remove dead code.
@@ -5331,8 +8456,8 @@
2008-05-17 Xinliang David Li <davidxl@google.com>
* gcc/tree-ssa-dce.c (cond_dead_built_in_calls): New static variable.
- (check_pow, check_log, is_unnecessary_except_errno_call): New
- functions to check for eliminating math functions that are pure
+ (check_pow, check_log, is_unnecessary_except_errno_call): New
+ functions to check for eliminating math functions that are pure
except for setting errno.
(gen_conditions_for_pow, gen_conditionas_for_log): New functions to
general condition expressions for shrink-wrapping pow/log calls.
@@ -5395,7 +8520,7 @@
2008-05-16 Kenneth Zadeck <zadeck@naturalbridge.com>
* tree-ssa-dse (max_stmt_uid): Removed.
- (get_stmt_uid, dse_possible_dead_store_p, dse_optimize_stmt,
+ (get_stmt_uid, dse_possible_dead_store_p, dse_optimize_stmt,
tree_ssa_dse): Encapsulate all uses of stmt_ann->uid.
* tree-ssa-sccvn.c (compare_ops, init_scc_vn): Ditto.
* function.h (cfun.last_stmt_uid): New field.
@@ -5474,7 +8599,7 @@
write_summary, read_summary.
* cgraphunit.c (cgraph_process_new_functions): Changed call from
pass_ipa_inline.function_generate_summary, to
- compute_inline_parameters.
+ compute_inline_parameters.
* ipa-inline.c (compute_inline_parameters): Made public and added
node parameter.
(compute_inline_parameters_for_current): New function.
@@ -5484,19 +8609,19 @@
(pass_ipa_inline): Updated for new IPA_PASS structure.
* passes.c (execute_ipa_summary_passes): Now is called once per
pass rather than once per node*pass.
-
+
2008-05-15 Anatoly Sokolov <aesok@post.ru>
- * config/avr/avr.c (avr_base_arch_macro, avr_have_movw_lpmx_p,
+ * config/avr/avr.c (avr_base_arch_macro, avr_have_movw_lpmx_p,
avr_have_mul_p, avr_asm_only_p): Remove variables.
(avr_override_options): Remove initialization of removed variables.
- (avr_file_start): Convert removed variables to fields of
- 'struct base_arch_s *avr_current_arch'.
+ (avr_file_start): Convert removed variables to fields of
+ 'struct base_arch_s *avr_current_arch'.
* config/avr/avr.h (TARGET_CPU_CPP_BUILTINS): (Ditto.).
(AVR_HAVE_MUL): (Ditto.).
(AVR_HAVE_MOVW): (Ditto.).
- (AVR_HAVE_LPMX): (Ditto.).
- (avr_base_arch_macro, avr_have_movw_lpmx_p, avr_have_mul_p,
+ (AVR_HAVE_LPMX): (Ditto.).
+ (avr_base_arch_macro, avr_have_movw_lpmx_p, avr_have_mul_p,
avr_asm_only_p): Remove declaration.
2008-05-15 Diego Novillo <dnovillo@google.com>
@@ -5512,7 +8637,7 @@
(record_truncated_value): Turn it into a for_each_rtx callback.
(record_truncated_values): New function.
(combine_instructions): Call note_uses with record_truncated_values.
- Change name of check_conversion to check_promoted_subreg.
+ Change name of check_conversion to check_promoted_subreg.
2008-05-15 Janis Johnson <janis187@us.ibm.com>
@@ -5796,14 +8921,14 @@
* optabs.c (prepare_cmp_insn): Changed LCT_PURE_MAKE_BLOCK to
LCT_PURE and LCT_CONST_MAKE_BLOCK to LCT_CONST in calls to
- emit_library_call_value.
+ emit_library_call_value.
* builtins.c (expand_builtin_powi, expand_builtin_memcmp): Ditto.
* tree.h (ECF_LIBCALL_BLOCK): Removed.
- * calls.c (initialize_argument_information, precompute_arguments,
+ * calls.c (initialize_argument_information, precompute_arguments,
expand_call, emit_library_call_value_1): Remove ECF_LIBCALL_BLOCK.
(precompute_arguments): Removed flags parameter.
* rtl.h (LCT_CONST_MAKE_BLOCK, LCT_PURE_MAKE_BLOCK): Removed.
-
+
2008-05-14 Richard Guenther <rguenther@suse.de>
* tree-ssa-dse.c (dse_possible_dead_store_p): Remove dead code.
@@ -5991,7 +9116,7 @@
2008-05-10 Kenneth Zadeck <zadeck@naturalbridge.com>
* gcse.c (store_killed_in_insn): Negated call to RTL_CONST_CALL_P.
-
+
2008-05-10 H.J. Lu <hongjiu.lu@intel.com>
* config/i386/i386.c (bdesc_ptest): Removed.
@@ -6134,7 +9259,7 @@
CONVERT_EXPR_P.
(CONVERT_EXPR_P): Define.
(CASE_CONVERT): Define.
-
+
2008-05-08 Kenneth Zadeck <zadeck@naturalbridge.com>
PR middle-end/36117
@@ -6218,7 +9343,7 @@
2008-05-08 David Daney <ddaney@avtrex.com>
Richard Sandiford <rsandifo@nildram.co.uk>
-
+
* config/mips/mips.md (mips_expand_compare_and_swap_12): Handle
special case of constant zero operands.
* config/mips/mips.c (mips_expand_compare_and_swap_12): Zero extend
@@ -6443,9 +9568,9 @@
(analyze_function): Rename DECL_IS_PURE to DECL_PURE_P.
(static_execute): Set looping true for recursive functions.
Undo setting state to IPA_NEITHER for recursive functions.
- * cse.c (cse_insn):
+ * cse.c (cse_insn):
* ifcvt.c (noce_can_store_speculate_p): Changed
- CONST_OR_PURE_CALL_P and pure_call_p to RTL_CONST_CALL_P or
+ CONST_OR_PURE_CALL_P and pure_call_p to RTL_CONST_CALL_P or
RTL_CONST_OR_PURE_CALL_P.
* dse.c (scan_insn): Ditto.
* local-alloc.c (validate_equiv_mem, memref_used_between_p): Ditto.
@@ -6487,7 +9612,7 @@
DECL_PURE_P.
* tree-cfg.c (update_call_expr_flags): Do not clear tree side
effects for looping pure or const calls.
- (verify_gimple_expr): Added verification code.
+ (verify_gimple_expr): Added verification code.
* config/alpha/alpha.c (alpha_legitimize_address,
alpha_emit_xfloating_libcall): Changed CONST_OR_PURE_CALL_P to
RTL_CONST_CALL_P.
@@ -6781,14 +9906,14 @@
(ipcp_redirect): Removed newly unused local variable callee.
(ipcp_redirect): Removed (a bit confusing) local variable type.
(ipcp_insert_stage): Added local variable info.
- (ipcp_cval_changed): Renamed to ipcp_lattice_changed, parameters
+ (ipcp_cval_changed): Renamed to ipcp_lattice_changed, parameters
renamed too
(ipcp_formal_create): Removed.
(ipcp_method_cval_set): Removed.
(ipcp_propagate_stage): Renamed lattice variables.
(ipcp_method_cval_set_cvalue_type): Removed.
(ipcp_method_cval_print): Renamed to ipcp_print_all_lattices
- (ipcp_print_all_lattices): Changed printed strings to refer to
+ (ipcp_print_all_lattices): Changed printed strings to refer to
lattices rather than cvals.
(ipcp_method_cval_init): Renamed to ipcp_initialize_node_lattices
(ipcp_propagate_const): Changed formal parameters.
@@ -6799,7 +9924,7 @@
(ipcp_after_propagate): Renamed to ipcp_change_tops_to_bottom
(ipcp_callsite_param_print): Renamed to ipcp_print_all_jump_functions
(ipcp_profile_mt_count_print): Renamed to ipcp_print_func_profile_counts
- (ipcp_print_func_profile_counts): Changed string from "method" to
+ (ipcp_print_func_profile_counts): Changed string from "method" to
"function"
(ipcp_profile_cs_count_print): Renamed to ipcp_print_call_profile_counts
(ipcp_profile_edge_print): Renamed to ipcp_print_edge_profiles
@@ -6809,7 +9934,7 @@
(ipcp_lat_is_const): Changed parameters and made inline.
(ipcp_replace_map_create): Renamed to ipcp_create_replace_map
(ipcp_redirect): Renamed to ipcp_need_redirect_p
- (ipcp_need_redirect_p): Calls ipcp_lat_is_const instead of using
+ (ipcp_need_redirect_p): Calls ipcp_lat_is_const instead of using
the predicate condition directly
(ipcp_propagate_stage): Added local variable args. Removed local
variable callee. (Both are mere code simplifications.)
@@ -6936,13 +10061,13 @@
* gthr-single.h: Add in required interface elements as per gthr.h.
Add stub types for __gthread_key_t, __gthread_once_t. Add defines
for __GTHREAD_ONCE_INIT, __GTHREAD_RECURSIVE_MUTEX_INIT.
- Generalize UNUSED macro.
+ Generalize UNUSED macro.
(__gthread_once): Add.
(__gthread_key_create): Add.
(__gthread_key_delete): Add.
(__gthread_getspecific): Add.
(__gthread_setspecific): Add.
-
+
2008-05-05 Andrew Pinski <Andrew.Pinski@playstation.sony.com>
* tree-ssa-forwprop.c (forward_propagate_addr_expr_1): If we have
@@ -7024,7 +10149,7 @@
* doc/invoke.texi (max-flow-memory-locations): Removed.
* params.def (PARAM_MAX_FLOW_MEMORY_LOCATIONS): Removed.
-
+
2008-05-03 Richard Guenther <rguenther@suse.de>
PR middle-end/34973
@@ -7306,13 +10431,13 @@
* ipa-cp.c (ipcp_init_stage): Calls ipa_set_called_with_variable_arg
instead of setting number of formal parameters to zero.
- (ipcp_init_stage): Do not set the number of actual parameters to zero
+ (ipcp_init_stage): Do not set the number of actual parameters to zero
either.
(ipcp_propagate_stage): Explicitly skipping all calls to nodes
which are called with variable number of arguments.
(ipcp_insert_stage): Explicitely skipping all nodes which are
called with variable number of arguments.
- (ipcp_callsite_param_print): Skipps callsites to nodes with varaible
+ (ipcp_callsite_param_print): Skipps callsites to nodes with varaible
number of parameters.
* ipa-prop.h (struct ipa_node_params): Added flag
@@ -7324,13 +10449,13 @@
(ipa_is_called_with_var_arguments): Added.
(ipa_get_ith_param): Added. All readers of param_decls converted
to use it instead.
- (ipa_set_cs_argument_count): Added, sole writer to argument_count
- changed to use it.
+ (ipa_set_cs_argument_count): Added, sole writer to argument_count
+ changed to use it.
(ipa_get_cs_argument_count): Added, all readers of argument_count
changed to cal it.
- (ipa_get_ith_jump_func): Added. Accessors of jump values changed
+ (ipa_get_ith_jump_func): Added. Accessors of jump values changed
to use it.
-
+
* ipa-prop.h (struct ipcp_formal): Renamed to ipcp_lattice
(struct ipcp_lattice): Renamed cval_type to type
(struct ipa_node_params): ipcp_cval renamed to ipcp_lattices
@@ -7342,9 +10467,9 @@
(build_const_val): Changed the type of parameter cvalue to tree
(ipcp_propagate_const): Changed the type of parameter cvalue to tree
(ipcp_method_cval_set_cvalue_type): Renamed parameter cval_type1 to type
-
- * ipa-prop.h (struct ipcp_formal): Replaced cvalue with tree called
- constant
+
+ * ipa-prop.h (struct ipcp_formal): Replaced cvalue with tree called
+ constant
* ipa-prop.c (ipa_methodlist_init): Renamed to ipa_init_func_list
(ipa_methodlist_not_empty): Removed, the sole user now checks directly
@@ -7362,7 +10487,7 @@
(ipa_method_tree_map_create): Removed.
(ipa_method_compute_tree_map): Renamed to ipa_create_param_decls_array
(ipa_create_param_decls_array): Creates the array itself
- (ipa_create_param_decls_array): Temporary variable info instead of
+ (ipa_create_param_decls_array): Temporary variable info instead of
a few dereferences.
(ipa_method_formal_compute_count): Renamed to ipa_count_formal_params
(ipa_method_compute_modify): Renamed to ipa_detect_param_modifications
@@ -7374,7 +10499,7 @@
(ipa_edges_create): Renamed to ipa_create_all_edge_args
(ipa_edges_free): Renamed to ipa_free_all_edge_args
(ipa_nodes_free): Integrated into ipa_free_all_node_params and removed
- (ipa_free_all_node_params): Deallocation to jump_functions moved to
+ (ipa_free_all_node_params): Deallocation to jump_functions moved to
ipa_free_all_edge_args
(ipa_method_tree_print): Renamed to ipa_print_all_tree_maps
(ipa_method_modify_print): Renamed to ipa_print_all_params_modified
@@ -7385,22 +10510,22 @@
(ipa_methodlist_next_method_set): Removed.
(ipa_method_is_modified): Removed.
(ipa_method_modify_create): Removed.
- (ipa_method_modify_init): Temporary variable info instead of a few
+ (ipa_method_modify_init): Temporary variable info instead of a few
dereferences.
- (ipa_detect_param_modifications): Temporary variable info instead of
+ (ipa_detect_param_modifications): Temporary variable info instead of
a few dereferences.
- (ipa_compute_jump_functions): Temporary variable info instead of
+ (ipa_compute_jump_functions): Temporary variable info instead of
a few dereferences.
(ipa_method_modify_set): Removed.
(ipa_method_tree_map): Renamed to ipa_get_param_decl_index
- (ipa_get_param_decl_index): Now accepts struct ipa_node_params rather
+ (ipa_get_param_decl_index): Now accepts struct ipa_node_params rather
than craph_node as the first parameter.
(ipa_method_modify_stmt): Renamed to ipa_check_stmt_modifications
(ipa_method_modify_init): Removed.
- (ipa_compute_jump_functions): Added a temp variable instead of
+ (ipa_compute_jump_functions): Added a temp variable instead of
repeatadly dereferencing the cgraph_edge.aux pointer
(ipa_callsite_param_set_type): Removed.
- (ipa_compute_jump_functions): i renamed to index and moved to
+ (ipa_compute_jump_functions): i renamed to index and moved to
an inner block
(ipa_callsite_param_set_info_type_formal): Removed.
(ipa_callsite_param_set_info_type): Removed.
@@ -7411,9 +10536,9 @@
* ipa-prop.h (enum cvalue_type): Renamed to ipa_lattice_type,
prefixed all values with IPA_. Changed all users.
- (enum jump_func_type): Rnamed UNKNOWN_IPATYPE to IPA_UNKNOWN,
- CONST_IPATYPE to IPA_CONST, CONST_IPATYPE_REF to IPA_CONST_REF
- and FORMAL_IPATYPE IPA_PASS_THROUGH.
+ (enum jump_func_type): Rnamed UNKNOWN_IPATYPE to IPA_UNKNOWN,
+ CONST_IPATYPE to IPA_CONST, CONST_IPATYPE_REF to IPA_CONST_REF
+ and FORMAL_IPATYPE IPA_PASS_THROUGH.
(union parameter_info): Renamed to jump_func_value.
(union jump_func_value): Renamed value to constant
(struct ipa_jump_func): Renamed info_type to value
@@ -7570,7 +10695,7 @@
* tree-ssa-loop-manip.c (find_uses_to_rename_use): Only record
uses outside of the loop.
(tree_duplicate_loop_to_header_edge): Only verify loop-closed SSA
- form if it is available.
+ form if it is available.
* tree-flow.h (tree_unroll_loops_completely): Add extra parameter.
* passes.c (init_optimization_passes): Schedule complete inner
loop unrolling pass before the first CCP pass after final inlining.
@@ -7912,9 +11037,9 @@
(init_elim_table): Update.
2008-04-25 Bob Wilson <bob.wilson@acm.org>
-
+
* optabs.c (expand_float): Fix REG_EQUAL for UNSIGNED_FLOAT libcall.
-
+
2008-04-25 H.J. Lu <hongjiu.lu@intel.com>
* config/i386/sse.md (mov<mode>): Replace SSEMODEI with SSEMODE.
@@ -7985,7 +11110,7 @@
of code delimited by two edges in the CFG.
(separate_decls_in_loop_name): Renamed separate_decls_in_region_name.
(separate_decls_in_loop_stmt): Renamed separate_decls_in_region_stmt.
- (separate_decls_in_loop): Renamed separate_decls_in_region. Isolate
+ (separate_decls_in_loop): Renamed separate_decls_in_region. Isolate
the case of parallelisation of reductions.
(expr_invariant_in_region_p): New.
@@ -8152,7 +11277,7 @@
PR middle-end/36003
* passes.c (init_optimization_passes): Remove
pass_fast_rtl_byte_dce.
-
+
2008-04-22 Uros Bizjak <ubizjak@gmail.com>
PR target/29096
@@ -8243,14 +11368,14 @@
* dbgcnt.def (ra_byte_scan): Added.
* dbgcnt.c (dbg_cnt): Added code to print message to dump_file
- when the last hit happens for a counter.
+ when the last hit happens for a counter.
* timevar.def (TV_DF_BYTE_LR): New variable.
* tree-pass.h (pass_fast_rtl_byte_dce): New pass.
* passes.c (pass_fast_rtl_byte_dce): New pass.
* fwprop.c (update_df): Added mode to call df_ref_create.
Renamed DF_REF_WIDTH and DF_REF_OFFSET to DF_REF_EXTRACT_WIDTH and
DF_REF_EXTRACT_OFFSET.
- * df.h (DF_BYTE_LR, DF_BYTE_LR_BB_INFO, DF_BYTE_LR_IN,
+ * df.h (DF_BYTE_LR, DF_BYTE_LR_BB_INFO, DF_BYTE_LR_IN,
DF_BYTE_LR_OUT, df_byte_lr): New macro.
(df_mm): New enum.
(df_ref_extract): Added mode field.
@@ -8258,7 +11383,7 @@
DF_REF_EXTRACT_OFFSET.
(DF_REF_EXTRACT_MODE): New macro.
(df_byte_lr_bb_info): New structure.
- (df_print_byte_regset, df_compute_accessed_bytes,
+ (df_print_byte_regset, df_compute_accessed_bytes,
df_byte_lr_add_problem, df_byte_lr_get_regno_start,
df_byte_lr_get_regno_len, df_byte_lr_simulate_defs,
df_byte_lr_simulate_uses,
@@ -8269,9 +11394,9 @@
(df_byte_lr_get_bb_info): New inline function.
* df-scan.c (df_ref_record, df_uses_record,
df_ref_create_structure): Added mode parameter.
- (df_ref_create, df_notes_rescan, df_ref_record, df_def_record_1,
+ (df_ref_create, df_notes_rescan, df_ref_record, df_def_record_1,
df_defs_record, df_uses_record, df_get_conditional_uses,
- df_get_call_refs, df_insn_refs_collect, df_bb_refs_collect,
+ df_get_call_refs, df_insn_refs_collect, df_bb_refs_collect,
df_entry_block_defs_collect, df_exit_block_uses_collect):
Added mode parameter to calls to df_ref_record, df_uses_record,
df_ref_create_structure.
@@ -8282,25 +11407,25 @@
* df-core.c (df_print_byte_regset): New function.
* df-byte-scan.c: New file.
* df-problems.c (df_rd_transfer_function): Removed unnecessary
- calls to BITMAP_FREE.
+ calls to BITMAP_FREE.
(df_byte_lr_problem_data, df_problem problem_BYTE_LR): New structure.
(df_byte_lr_get_regno_start, df_byte_lr_get_regno_len,
- df_byte_lr_set_bb_info, df_byte_lr_free_bb_info,
- df_byte_lr_check_regs, df_byte_lr_expand_bitmap,
+ df_byte_lr_set_bb_info, df_byte_lr_free_bb_info,
+ df_byte_lr_check_regs, df_byte_lr_expand_bitmap,
df_byte_lr_alloc, df_byte_lr_reset, df_byte_lr_bb_local_compute,
df_byte_lr_local_compute, df_byte_lr_init,
- df_byte_lr_confluence_0, df_byte_lr_confluence_n,
- df_byte_lr_transfer_function, df_byte_lr_free,
+ df_byte_lr_confluence_0, df_byte_lr_confluence_n,
+ df_byte_lr_transfer_function, df_byte_lr_free,
df_byte_lr_top_dump, df_byte_lr_bottom_dump,
- df_byte_lr_add_problem, df_byte_lr_simulate_defs,
+ df_byte_lr_add_problem, df_byte_lr_simulate_defs,
df_byte_lr_simulate_uses,
df_byte_lr_simulate_artificial_refs_at_top,
df_byte_lr_simulate_artificial_refs_at_end): New function.
* dce.c (byte_dce_process_block): New function.
(dce_process_block): au is now passed in rather than computed
locally. Changed loops that look at artificial defs to not look
- for conditional or partial ones, because there never are any.
- (fast_dce): Now is able to drive byte_dce_process_block or
+ for conditional or partial ones, because there never are any.
+ (fast_dce): Now is able to drive byte_dce_process_block or
dce_process_block depending on the kind of dce being done.
(rest_of_handle_fast_dce): Add parameter to fast_dce.
(rest_of_handle_fast_byte_dce): New function.
@@ -8348,14 +11473,14 @@
pointer_may_wrap_p to disable some false positives.
2008-04-18 Kris Van Hees <kris.van.hees@oracle.com>
-
+
* c-common.c (CHAR16_TYPE, CHAR32_TYPE): New macros.
(fname_as_string): Match updated cpp_interpret_string prototype.
(fix_string_type): Support char16_t* and char32_t*.
(c_common_nodes_and_builtins): Add char16_t and char32_t (and
derivative) nodes. Register as builtin if C++0x.
(c_parse_error): Support CPP_CHAR{16,32}.
- * c-common.h (RID_CHAR16, RID_CHAR32): New elements.
+ * c-common.h (RID_CHAR16, RID_CHAR32): New elements.
(enum c_tree_index) <CTI_CHAR16_TYPE, CTI_SIGNED_CHAR16_TYPE,
CTI_UNSIGNED_CHAR16_TYPE, CTI_CHAR32_TYPE, CTI_SIGNED_CHAR32_TYPE,
CTI_UNSIGNED_CHAR32_TYPE, CTI_CHAR16_ARRAY_TYPE,
@@ -8521,7 +11646,7 @@
* config/sh/sh.c (expand_cbranchdi4): Use original operands for
msw_skip comparison.
-
+
2008-04-16 Jakub Jelinek <jakub@redhat.com>
PR c/35739
@@ -8577,7 +11702,7 @@
unused.
Move filter, exc_ptr, ttype_data, ehspec_data, action_record_data and
exception_handler_label_map, ehr_stackadj, ehr_handler, ehr_label,
- sjlj_fc, sjlj_exit_after to rth_eh in function.h.
+ sjlj_fc, sjlj_exit_after to rth_eh in function.h.
Remove call_site_data_used, call_site_data_size.
Turn call_site_record into vector in function.h.
(note_current_region_may_contain_throw): Remove.
@@ -8587,7 +11712,7 @@
add_ttypes_entry, add_ehspec_entry, assign_filter_values,
build_post_landing_pads, dw2_build_landing_pads,
sjlj_assign_call_site_values, sjlj_mark_call_sites,
- sjlj_emit_function_enter, sjlj_emit_function_enter,
+ sjlj_emit_function_enter, sjlj_emit_function_enter,
sjlj_emit_function_exit, sjlj_emit_dispatch_table,
sjlj_build_landing_pads, finish_eh_generation,
remove_exception_handler_label, remove_eh_handler,
@@ -8813,7 +11938,7 @@
(*<code>extendsfdf2): Macroize insn pattern from *absextendsfdf2 and
*negextendsfdf2 patterns using absneg code iterator.
* config/i386/sse.md (<code><mode>2): Macroize expander from
- abs<mode>2 and neg<mode>2 patterns using absneg code iterator.
+ abs<mode>2 and neg<mode>2 patterns using absneg code iterator.
2008-04-10 Andreas Krebbel <krebbel1@de.ibm.com>
@@ -9053,10 +12178,10 @@
2008-04-08 Anatoly Sokolov <aesok@post.ru>
- * config/avr/avr.h (TARGET_CPU_CPP_BUILTINS): Define
- __AVR_HAVE_EIJMP_EICALL__ macro if device have EIJMP and EICALL
+ * config/avr/avr.h (TARGET_CPU_CPP_BUILTINS): Define
+ __AVR_HAVE_EIJMP_EICALL__ macro if device have EIJMP and EICALL
instructions.
- * config/avr/avr.c (avr_mcu_types): Set AVR31 architecture for
+ * config/avr/avr.c (avr_mcu_types): Set AVR31 architecture for
atmega103 device.
2008-04-07 Jan Hubicka <jh@suse.cz>
@@ -9077,7 +12202,7 @@
(assign_stack_local): Update
(expand_function_end): Update.
(get_art_pointer_save_area): Update
- * function.h
+ * function.h
* emit-rtl.c (rtl): Declare.
(regno_reg_rtx): Declare.
(first_insn, last_insn, cur_insn_uid, last_location, first_label_num):
@@ -9172,7 +12297,7 @@
(avr_asm_init_sections): (Ditto.).
(avr_rtx_costs): (Ditto.).
* config/avr/avr.md: (Ditto.).
- * config/avr/avr.h: Use '__AVR_HAVE_JMP_CALL__' instead of
+ * config/avr/avr.h: Use '__AVR_HAVE_JMP_CALL__' instead of
'__AVR_MEGA__'.
2008-04-06 Richard Guenther <rguenther@suse.de>
@@ -9340,7 +12465,7 @@
* c-objc-common.h (LANG_HOOKS_FUNCTION_MISSING_NORETURN_OK_P):
Rename to LANG_HOOKS_MISSING_NORETURN_OK_P.
-
+
2008-04-04 Jakub Jelinek <jakub@redhat.com>
PR c/35440
@@ -9536,10 +12661,10 @@
2008-04-02 Anatoly Sokolov <aesok@post.ru>
- * config/avr/predicates.md (io_address_operand): New predicate.
+ * config/avr/predicates.md (io_address_operand): New predicate.
* config/avr/avr-protos.h (avr_io_address_p): Remove declaration.
* config/avr/avr.c (avr_io_address_p): Remove function.
- (out_movqi_r_mr): Use 'io_address_operand' predicate instead of
+ (out_movqi_r_mr): Use 'io_address_operand' predicate instead of
'avr_io_address_p' function.
(out_movhi_r_mr): (Ditto.).
(out_movqi_mr_r): (Ditto.).
@@ -10236,7 +13361,7 @@
* config/alpha/x-vms (EXTRA_PROGRAMS): Remove.
* config/t-openbsd-thread: Remove commented out lines.
-
+
* config/x-interix: Remove.
* config/m68hc11/t-m68hc11-gas: Rename to...
@@ -10360,7 +13485,7 @@
(reload_reg_rtx_for_input): New variable.
(reload_reg_rtx_for_output): Likewise.
(emit_input_reload_insns): Use reloadreg rather than rl->reg_rtx
- when reassigning a pseudo register. Load reloadreg from
+ when reassigning a pseudo register. Load reloadreg from
reload_reg_rtx_for_input, moving the mode and register
calculation to...
(do_input_reload): ...here. Use the mode-adjusted reg_rtx
@@ -10402,12 +13527,12 @@
(build/genflags.o): Likewise.
2008-03-25 Bob Wilson <bob.wilson@acm.org>
-
+
* config/xtensa/xtensa.c (xtensa_va_start): Use build_int_cst
instead of size_int for integer types.
(xtensa_gimplify_va_arg_expr): Likewise. Convert index to sizetype
to match type of MINUS_EXPR.
-
+
2008-03-25 Tom Tromey <tromey@redhat.com>
* configure: Rebuilt.
@@ -10525,7 +13650,7 @@
2008-03-25 Naveen.H.S <naveen.hs@kpitcummins.com>
* config/sh/sh.md (prefetch): Add condition for SH2A target.
- (prefetch_sh2a): New.
+ (prefetch_sh2a): New.
2008-03-25 Jayant Sonar <Jayant.sonar@kpitcummins.com>
Naveen.H.S <naveen.hs@kpitcummins.com>
@@ -10578,7 +13703,7 @@
* diagnostic.c (diagnostic_count_diagnostic): Delete.
(diagnostic_report_diagnostic): Update. Handle ICEs here.
-
+
2008-03-24 Nathan Sidwell <nathan@codesourcery.com>
* gthr-vxworks.h (UNUSED): Define.
@@ -10591,7 +13716,7 @@
* doc/extend.texi (Function Attributes): Add missing comma in the
example of the "alloc_size" attribute.
-
+
2008-03-23 Uros Bizjak <ubizjak@gmail.com>
Revert:
@@ -10888,7 +14013,7 @@
(finish_optimization_passes): Update.
(all_passes, all_ipa_passes, all_lowering_passes): Update declaration.
(register_one_dump_file, register_dump_files_1, next_pass_1):
- Update arguments.
+ Update arguments.
(init_optimization_passes): Update handling of new types.
(execute_one_pass, execute_pass_list, execute_ipa_pass_list): Update.
* ipa-struct-reorg.c: Update tree_pass descriptors.
@@ -11069,22 +14194,22 @@
* config/avr/avr.c (avr_arch_types): Add avr6 entry.
(avr_arch): Add ARCH_AVR6.
(avr_mcu_types): Add 'atmega2560' and 'atmega2561' entry.
- (initial_elimination_offset): Initialize and use 'avr_pc_size'
+ (initial_elimination_offset): Initialize and use 'avr_pc_size'
instead of fixed value 2.
(print_operand_address): Use gs() asm specifier instead of pm().
(avr_assemble_integer): (Ditto.).
(avr_output_addr_vec_elt): (Ditto.).
(print_operand): Handle "!" code.
- * config/avr/avr.h (TARGET_CPU_CPP_BUILTINS): Add
+ * config/avr/avr.h (TARGET_CPU_CPP_BUILTINS): Add
__AVR_3_BYTE_PC__, __AVR_2_BYTE_PC__ and __AVR_HAVE_JMP_CALL__.
(AVR_HAVE_EIJMP_EICALL): Define.
(AVR_3_BYTE_PC): Redefine.
(AVR_2_BYTE_PC): (Ditto.).
(PRINT_OPERAND_PUNCT_VALID_P): Add '!' code.
(LINK_SPEC): Add atmega2560 and atmega2561.
- (CRT_BINUTILS_SPEC): Add atmega2560 (crtm2560.o) and atmega2561
+ (CRT_BINUTILS_SPEC): Add atmega2560 (crtm2560.o) and atmega2561
(crtm2561.o).
- * config/avr/avr.md (call_insn): Use eicall instead of icall
+ * config/avr/avr.md (call_insn): Use eicall instead of icall
for 3 byte PC devices.
(call_value_insn): (Ditto.).
(*tablejump_enh): Use eijmp instead of ijmp for 3 byte PC devices.
@@ -11092,11 +14217,11 @@
(*tablejump): (Ditto.).
(*indirect_jump_avr6): Add insn.
(*tablejump_rjmp): Don't use for 3 byte PC devices.
- * config/avr/libgcc.S (__prologue_saves__): Use eijmp
+ * config/avr/libgcc.S (__prologue_saves__): Use eijmp
instead of ijmp for 3 byte PC devices.
(__tablejump2__): (Ditto.).
* config/avr/t-avr (MULITLIB_OPTIONS): Add avr6 architecture.
- (MULITLIB_DIRNAMES): (Ditto.).
+ (MULITLIB_DIRNAMES): (Ditto.).
(MULTILIB_MATCHES): Add atmega2560 and atmega2561 to list.
2008-03-15 Uros Bizjak <ubizjak@gmail.com>
@@ -11123,7 +14248,7 @@
being a PHI_NODE.
2008-03-14 Bob Wilson <bob.wilson@acm.org>
-
+
* doc/invoke.texi (Option Summary, Xtensa Options): Document
-mserialize-volatile and -mno-serialize-volatile Xtensa options.
* config/xtensa/xtensa.c (print_operand): Do not emit MEMW instructions
@@ -11741,7 +14866,7 @@
(df_ref_create_structure): Allocate df_ref_extract if offset and
width fields are used.
(df_def_record_1): Get offset and width from ZERO_EXTRACT.
- (df_uses_record): Get offset and width from ZERO_EXTRACT
+ (df_uses_record): Get offset and width from ZERO_EXTRACT
and SIGN_EXTRACT.
* global.c (build_insn_chain): Change DF_REF_EXTRACT to either
DF_REF_ZERO_EXTRACT or DF_REF_SIGN_EXTRACT. Change
@@ -11752,7 +14877,7 @@
(df_ref_extract): New structure.
(DF_REF_WIDTH, DF_REF_OFFSET): New macros.
(df_ref_create): Add width and offset parameters.
-
+
2008-03-05 Richard Guenther <rguenther@suse.de>
* tree-ssa-structalias.c (get_constraint_for_component_ref):
@@ -11983,7 +15108,7 @@
* Makefile.in (OBJS-common): Remove struct-equiv.o.
(struct-equiv.o): Remove rule.
* basic-block.h (struct_equiv_checkpoint, STRUCT_EQUIV_*,
- insns_match_p, struct_equiv_block_eq, struct_equiv_init,
+ insns_match_p, struct_equiv_block_eq, struct_equiv_init,
rtx_equiv_p, condjump_equiv_p): Remove prototypes.
2008-03-01 Alexandre Oliva <aoliva@redhat.com>
@@ -12170,7 +15295,7 @@
* tree-vect-analyze.c: Remove unused static decls.
* lambda.h (dependence_level): New.
* common.opt (ftree-loop-distribution): New.
- * tree-flow.h (mark_virtual_ops_in_bb,
+ * tree-flow.h (mark_virtual_ops_in_bb,
slpeel_tree_duplicate_loop_to_edge_cfg,
rename_variables_in_loop): Declared.
* Makefile.in (TREE_DATA_REF_H): Depend on tree-chrec.h.
@@ -12380,7 +15505,7 @@
2008-02-26 Jason Merrill <jason@redhat.com>
PR c++/35315
- * attribs.c (decl_attributes): Leave ATTR_FLAG_TYPE_IN_PLACE
+ * attribs.c (decl_attributes): Leave ATTR_FLAG_TYPE_IN_PLACE
alone if it's the naming decl for the type's main variant.
2008-02-26 Tom Tromey <tromey@redhat.com>
@@ -12474,7 +15599,7 @@
* builtins.c (expand_builtin): Remove BUILT_IN_STDARG_START.
* tree-stdarg.c (execute_optimize_stdarg): Likewise.
* tree-inline.c (inline_forbidden_p_1): Likewise.
-
+
2008-02-26 Richard Guenther <rguenther@suse.de>
* tree-flow.h (uid_decl_map_hash, uid_decl_map_eq): Move ...
@@ -12543,7 +15668,7 @@
Wvolatile-register-var.
* common.opt: Move Wvolatile-register-var to...
* c.opt: ...here.
-
+
2008-02-26 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
* common.opt (Wlarger-than=): New.
@@ -12554,7 +15679,7 @@
* opth-gen.awk: Likewise.
* stor-layout.c (layout_decl): Use -Wlarger-than= for warning.
* tree-optimize.c (tree_rest_of_compilation): Likewise.
-
+
2008-02-26 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
* c-common.c (match_case_to_enum_1): Add appropriate
@@ -12577,7 +15702,7 @@
(print_ignored_options): New.
(handle_option): Postpone errors for unknown -Wno-* options.
* opts.h (print_ignored_options): Declare.
-
+
2008-02-25 Richard Sandiford <rsandifo@nildram.co.uk>
* config/mips/mips.md (loadgp_blockage, blockage): Change type
@@ -12656,7 +15781,7 @@
PR c/35162
* doc/invoke.texi (-fcx-limited-range): Correct to be in line with
actual behaviour and C99.
-
+
2008-02-26 Ben Elliston <bje@au.ibm.com>
* config/rs6000/rs6000.h (ASM_CPU_POWER5_SPEC): Define.
@@ -12759,7 +15884,7 @@
unused local variable `has_hot_blocks'.
(fix_crossing_conditional_branches): Remove unused local variable
`prev_bb'.
-
+
2008-02-25 Uros Bizjak <ubizjak@gmail.com>
PR middle-end/19984
@@ -12851,7 +15976,7 @@
2008-02-23 Uros Bizjak <ubizjak@gmail.com>
PR target/22076
- PR target/34256
+ PR target/34256
* config/i386/mmx.md (*mov<mode>_internal_rex64): Use "!y" to
prevent reload from using MMX registers.
(*mov<mode>_internal): Ditto.
@@ -12986,7 +16111,7 @@
* config/h8300/h8300.c (h8300_expand_epilogue): Emit return insn
as a jump, not as a plain insn.
-
+
2008-02-20 Seongbae Park <seongbae.park@gmail.com>
* doc/invoke.texi (Warning Options): Add new option
@@ -13039,7 +16164,7 @@
* doc/install.texi: Correct references to CFLAGS, replacing them
with BOOT_CFLAGS. Document flags used during bootstrap for
target libraries.
-
+
2008-02-20 Uros Bizjak <ubizjak@gmail.com>
* config/i386/i386.h (SSE_VEC_FLOAT_MODE_P): New define.
@@ -13172,7 +16297,7 @@
cannot be disambiguated.
* c.opt (v): Pass on to the common option handler.
-2008-02-19 Revital Eres <eres@il.ibm.com>
+2008-02-19 Revital Eres <eres@il.ibm.com>
* modulo-sched.c (sms_schedule): Change dump message when
create_ddg function fails.
@@ -13294,7 +16419,7 @@
2008-02-17 Uros Bizjak <ubizjak@gmail.com>
Revert:
- 2008-02-15 Uros Bizjak <ubizjak@gmail.com>
+ 2008-02-15 Uros Bizjak <ubizjak@gmail.com>
* config/i386/sfp-machine.h (CMPtype): Define as typedef using
libgcc_cmp_return mode.
@@ -13470,7 +16595,7 @@
Add -fdump-ipa-inline.
* tree-dump.c (dump_files): Remove tree-inlined dump.
* tree-pass.h (tree_dump_index): Remove TDI_inlined.
-
+
2008-02-12 Richard Guenther <rguenther@suse.de>
PR tree-optimization/35171
@@ -13560,7 +16685,7 @@
2008-02-08 Sa Liu <saliu@de.ibm.com>
- * config/spu/spu-builtins.def: Fixed wrong parameter type in spu
+ * config/spu/spu-builtins.def: Fixed wrong parameter type in spu
intrinsics spu_convts, spu_convtu, spu_convtf.
2008-02-08 Hans-Peter Nilsson <hp@axis.com>
@@ -13575,7 +16700,7 @@
optc-gen.awk.
* opts-common.c: Likewise.
* optc-gen.awk: Likewise.
-
+
2008-02-07 Andreas Krebbel <krebbel1@de.ibm.com>
* config/s390/s390.h (FUNCTION_ARG_REGNO_P): Fix fprs for 64 bit.
@@ -13584,7 +16709,7 @@
PR rtl-opt/33410
* config/alpha/alpha.c (alpha_emit_xfloating_compare): Use an
- EXPR_LIST for the REG_EQUAL instead of a comparison with a
+ EXPR_LIST for the REG_EQUAL instead of a comparison with a
funny mode.
2008-02-07 Uros Bizjak <ubizjak@gmail.com>
@@ -13621,7 +16746,7 @@
2008-02-06 Ralf Corsepius <ralf.corsepius@rtems.org>
- * config/arm/rtems-elf.h (TARGET_OS_CPP_BUILTINS): Add
+ * config/arm/rtems-elf.h (TARGET_OS_CPP_BUILTINS): Add
builtin_define ("__USE_INIT_FINI__").
* config/h8300/t-rtems (MULTILIB_OPTION,MULTILIB_DIRNAMES): Add
-msx multilibs.
@@ -13754,16 +16879,16 @@
* doc/c-tree.texi (Types): Fix grammar.
(Expression trees): Ditto.
* doc/passes.texi (Tree-SSA passes): Ditto.
-
+
* doc/configterms.texi (Configure Terms): Fix typo.
* doc/cpp.texi (Common Predefined Macros): Ditto.
* doc/md.texi (Machine Constraints): Ditto.
-
+
* doc/makefile.texi (Makefile): Add comma.
2008-01-31 Tom Browder <tom.browder@gmail.com>
Gerald Pfeifer <gerald@pfeifer.com>
-
+
* doc/sourcebuild.texi (Front End): Remove references to CVS
and CVSROOT/modules.
(Texinfo Manuals): Replace reference to CVS by one to SVN.
@@ -13784,7 +16909,7 @@
options. Minor fixes.
(-std): Move reference to standards closer to where language
standards are first mentioned.
-
+
2008-01-31 Richard Sandiford <rsandifo@nildram.co.uk>
PR rtl-optimization/34995
@@ -13880,7 +17005,7 @@
2008-01-28 Andy Hutchinson <hutchinsonandy@netscape.net>
PR target/34412
- * config/avr/avr.c (expand_prologue): Use correct QI mode frame
+ * config/avr/avr.c (expand_prologue): Use correct QI mode frame
pointer for tiny stack.
2008-01-28 Bernhard Fischer <aldot@gcc.gnu.org>
@@ -13965,7 +17090,7 @@
Change type of cost to comp_cost.
(determine_iv_cost): Increase cost of non-original ivs, instead
of decreasing the cost of original ones.
- (get_address_cost): Indicate the complexity of the addressing mode
+ (get_address_cost): Indicate the complexity of the addressing mode
in comp_cost.
(try_add_cand_for): Prefer using ivs not specific to some object.
* tree-flow.h (force_expr_to_var_cost): Declaration removed.
@@ -14208,10 +17333,10 @@
* ipa-struct-reorg.c (remove_str_allocs_in_func, remove_str_allocs):
New functions.
(remove_structure): Update allocations list before removing structure.
-
+
2008-01-25 Golovanevsky Olga <olga@il.ibm.com>
- * ipa-struct-reorg.c (is_safe_cond_expr,
+ * ipa-struct-reorg.c (is_safe_cond_expr,
create_new_stmts_for_cond_expr): Use integer_zerop function,
that recognize not only zero-pointer, but zero-integer too.
@@ -14267,7 +17392,7 @@
PR c++/25701
* doc/gcc.texi (Software development): Add a direntry for g++.
-
+
2008-01-23 Hans-Peter Nilsson <hp@axis.com>
* config/cris/cris.h (CC1PLUS_SPEC, OPTIMIZATION_OPTIONS): Drop
@@ -14295,18 +17420,18 @@
(avr_arch_types): Add 'avr31' and 'avr51' entries.
(avr_arch): Add 'ARCH_AVR31' and 'ARCH_AVR51'.
(avr_mcu_types): Add 'avr31' and 'avr51' architectures.
- (avr_override_options): Init 'avr_current_arch'.
+ (avr_override_options): Init 'avr_current_arch'.
(base_arch_s): Move from here...
- * config/avr/avr.h (base_arch_s): ... here. Add new members
- 'have_elpm', 'have_elpmx', 'have_eijmp_eicall', 'reserved'. Rename
+ * config/avr/avr.h (base_arch_s): ... here. Add new members
+ 'have_elpm', 'have_elpmx', 'have_eijmp_eicall', 'reserved'. Rename
'mega' to 'have_jmp_call'.
- (TARGET_CPU_CPP_BUILTINS): Define "__AVR_HAVE_JMP_CALL__",
- "__AVR_HAVE_RAMPZ__", "__AVR_HAVE_ELPM__" and "__AVR_HAVE_ELPMX__"
+ (TARGET_CPU_CPP_BUILTINS): Define "__AVR_HAVE_JMP_CALL__",
+ "__AVR_HAVE_RAMPZ__", "__AVR_HAVE_ELPM__" and "__AVR_HAVE_ELPMX__"
macros.
- (LINK_SPEC, CRT_BINUTILS_SPECS, ASM_SPEC): Add 'avr31' and 'avr51'
+ (LINK_SPEC, CRT_BINUTILS_SPECS, ASM_SPEC): Add 'avr31' and 'avr51'
architectures.
- * config/avr/t-avr (MULTILIB_OPTIONS, MULTILIB_DIRNAMES,
- MULTILIB_MATCHES): (Ditto.).
+ * config/avr/t-avr (MULTILIB_OPTIONS, MULTILIB_DIRNAMES,
+ MULTILIB_MATCHES): Ditto.
2008-01-23 Richard Guenther <rguenther@suse.de>
@@ -14475,7 +17600,7 @@
2008-01-21 Alon Dayan <alond@il.ibm.com>
Olga Golovanevsky <olga@il.ibm.com>
-
+
PR tree-optimization/34701
* ipa-struct-reorg.c (gen_size): Fix the malloc parameter calculation
when the structure size is not a power of 2.
@@ -14483,7 +17608,7 @@
2008-01-20 Kenneth Zadeck <zadeck@naturalbridge.com>
* doc/install.texi: Add doc for --enable-checking=df.
-
+
2008-01-20 Kaz Kojima <kkojima@gcc.gnu.org>
PR rtl-optimization/34808
@@ -14557,7 +17682,7 @@
(df_live_init): Init the df_live sets only with the variables
found live by df_lr.
(df_live_transfer_function): Use the df_lr sets to prune the
- df_live sets as they are being computed.
+ df_live sets as they are being computed.
(df_live_free): Free df_live_scratch.
2008-01-18 Ian Lance Taylor <iant@google.com>
@@ -14739,7 +17864,7 @@
2008-01-16 Sebastian Pop <sebastian.pop@amd.com>
- * tree-data-ref.c (subscript_dependence_tester_1): Call
+ * tree-data-ref.c (subscript_dependence_tester_1): Call
free_conflict_function.
(compute_self_dependence): Same.
@@ -14778,7 +17903,7 @@
PR c++/24924
* c-opts (c_common_post_options): Do not enable CPP
flag_pedantic_errors by default.
-
+
2008-01-14 Eric Botcazou <ebotcazou@adacore.com>
PR rtl-optimization/31944
@@ -14840,9 +17965,9 @@
correct type.
2008-01-11 Bob Wilson <bob.wilson@acm.org>
-
+
* config/xtensa/xtensa.c (override_options): Set flag_shlib.
-
+
2008-01-11 James E. Wilson <wilson@specifix.com>
PR target/26015
@@ -14850,8 +17975,8 @@
2008-01-11 Anatoly Sokolov <aesok@post.ru>
- * config/avr/avr.c (expand_prologue, expand_epilogue): Don't
- save/restore frame pointer register and don't use 'call-prologues'
+ * config/avr/avr.c (expand_prologue, expand_epilogue): Don't
+ save/restore frame pointer register and don't use 'call-prologues'
optimization in function with "OS_task" attribute.
2008-01-11 Eric Botcazou <ebotcazou@adacore.com>
@@ -14977,13 +18102,13 @@
2008-01-05 Uros Bizjak <ubizjak@gmail.com>
* config/i386/i386.c (ix86_builtin_reciprocal): Remove check
- for TARGET_RECIP.
-
+ for TARGET_RECIP.
+
2008-01-08 Jan Sjodin <jan.sjodin@amd.com>
-
+
* config/i386/i386.c (k8_cost, amdfam10_cost): Branch costs
for vectorization tuned.
-
+
2008-01-08 Richard Guenther <rguenther@suse.de>
PR tree-optimization/34683
diff --git a/gcc/ChangeLog-2007 b/gcc/ChangeLog-2007
index 5327a6cf8c1..004ef92911d 100644
--- a/gcc/ChangeLog-2007
+++ b/gcc/ChangeLog-2007
@@ -26440,7 +26440,7 @@
* tree-ssa-coalesce.c (fail_abnormal_edge_coalesce): Remove
spurious whitespace from error message.
-2007-03-08 Volker Reichelt <reichelt@netcologne.de>
+2007-03-08 Volker Reichelt <v.reichelt@netcologne.de>
PR c++/30852
* c-common.c (fold_offsetof_1): Handle COMPOUND_EXPR.
diff --git a/gcc/ChangeLog.tuples b/gcc/ChangeLog.tuples
new file mode 100644
index 00000000000..d5e338368b5
--- /dev/null
+++ b/gcc/ChangeLog.tuples
@@ -0,0 +1,8231 @@
+2008-07-28 Richard Guenther <rguenther@suse.de>
+
+ Merge with mainline @138201.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2008-07-27 Jakub Jelinek <jakub@redhat.com>
+
+ * omp-low.c (expand_omp_atomic_fetch_op): Fix a merge glitch.
+
+2008-07-27 Andrew Pinski <andrew_pinski@playstation.sony.com>
+
+ * config/spu/spu.c (spu_gimplify_va_arg_expr): Unshare the args
+ and skip trees.
+
+2008-07-27 Richard Guenther <rguenther@suse.de>
+
+ * tree-eh.c (lookup_expr_eh_region): Do not allocate a tree
+ annotation.
+ * tree-dfa.c (create_tree_common_ann): Set eh region to -1.
+ * tree-flow.h (struct tree_ann_common_d): Reorder rn member
+ to pack with type.
+
+2008-07-26 Richard Guenther <rguenther@suse.de>
+
+ Merge with mainline @138159.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2008-07-26 Richard Guenther <rguenther@suse.de>
+
+ * gimple.h (CALL_STMT_CANNOT_INLINE_P): Remove.
+
+2008-07-26 Jan Hubicka <jh@suse.cz>
+
+ * ipa-inline.c (cgraph_decide_inlining_of_small_function): Use
+ gimple_call_set_cannot_inline.
+ (cgraph_decide_inlining): Likewise.
+ (cgraph_decide_inlining_incrementally): Likewise.
+
+2008-07-26 Richard Guenther <rguenther@suse.de>
+
+ Merge with mainline @138092.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2008-07-26 Richard Guenther <rguenther@suse.de>
+
+ Merge with mainline @138091.
+
+2008-07-25 Richard Guenther <rguenther@suse.de>
+
+ * config/ia64/ia64.c (ia64_gimplify_va_arg): Unshare valist
+ before reusing it.
+
+2008-07-25 Andreas Krebbel <krebbel1@de.ibm.com>
+
+ * tree-tailcall.c (process_assignment): Prevent tail call
+ optimization if the modes of the return types don't match.
+
+2008-07-24 Aldy Hernandez <aldyh@redhat.com>
+
+ * tree-inline.c (expand_call_inline): Allow casts in assert.
+
+2008-07-24 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/36885
+ * tree.c (walk_tree_1): Also walk CHANGE_DYNAMIC_TYPE_EXPR operands.
+ * gimple.c (gss_for_code): GIMPLE_CHANGE_DYNAMIC_TYPE is GSS_WITH_OPS.
+ * gsstruct.def (GSS_CHANGE_DYNAMIC_TYPE): Remove.
+
+2008-07-24 Richard Guenther <rguenther@suse.de>
+
+ * tree-sra.c (sra_walk_expr): Also handle CONVERT_EXPR.
+ (sra_walk_gimple_assign): Correctly detect assigns we can handle.
+ * expr.c (expand_expr_real_1): Pass MOVE_NONTEMPORAL to
+ expand_assignment.
+
+2008-07-23 Richard Guenther <rguenther@suse.de>
+
+ * tree-ssa-dse.c (get_kill_of_stmt_lhs): Tuplify correct.
+ * gimple-pretty-print.c (dump_gimple_label): Dump non-local flag.
+ * tree.h (maybe_fold_stmt_addition): Declare.
+ * tree-ssa-ccp.c (maybe_fold_stmt_addition): Export.
+ (fold_gimple_assign): Return the new rhs instead of modifying the stmt.
+ (fold_stmt): Deal with that.
+ (fold_stmt_inplace): Only replace the rhs of a statement if
+ that has enough operand space to hold the new operands.
+ * tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Fix
+ POINTER_PLUS_EXPR handling.
+
+2008-07-23 Richard Guenther <rguenther@suse.de>
+
+ * tree-eh.c (record_in_goto_queue): Fix bootstrap with
+ --disable-checking.
+
+2008-07-23 Aldy Hernandez <aldyh@redhat.com>
+
+ Merge with mainline @138071.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2008-07-23 Richard Guenther <rguenther@suse.de>
+
+ * tree-eh.c (union treemple): Add tree * member.
+ (find_goto_replacement): Adjust.
+ (replace_goto_queue_cond_clause): Use the address of the
+ individual labels as unique identifier.
+ (replace_goto_queue_1): Use the statement as unique identifier
+ for GIMPLE_GOTO.
+ (record_in_goto_queue): Add checking.
+ (record_in_goto_queue_label): Adjust.
+ (maybe_record_in_goto_queue): Likewise.
+ (do_goto_redirection): Get leh_tf_state.
+ (lower_try_finally_nofallthru): Pass it.
+ (lower_try_finally_onedest): Likewise.
+ (lower_try_finally_copy): Likewise.
+ (lower_try_finally_switch): Likewise.
+
+2008-07-22 Aldy Hernandez <aldyh@redhat.com>
+ Jakub Jelinek <jakub@redhat.com>
+
+ * gimplify.c (gimple_do_not_emit_location_p): New.
+ (gimple_set_do_not_emit_location): New.
+ (annotate_one_with_location): Do not annotate if
+ gimple_do_not_emit_location_p.
+ (gimplify_cond_expr): Do not optimize if the COND_EXPR and
+ GOTO_EXPR have different locations.
+ Do not emit location information for some GIMPLE_COND's.
+
+2008-07-22 Richard Guenther <rguenther@suse.de>
+
+ * tree-ssa-ccp.c (ccp_fold): Use gimple_expr_type.
+ (fold_gimple_assign): Likewise.
+ * tree-inline.c (remap_gimple_op_r): Do not set TREE_BLOCK on
+ non-statements. Recurse to copy_tree_body_r with NULL block.
+ (copy_phis_for_bb): Likewise.
+ * tree-cfg.c (move_stmt_op): Do not set TREE_BLOCK on
+ non-statements.
+
+2008-07-22 Diego Novillo <dnovillo@google.com>
+ Richard Guenther <rguenther@suse.de>
+
+ * tree-ssa-dom.c (hashable_expr_equal_p): Do nothing if
+ either TYPE0 or TYPE1 is NULL.
+
+2008-07-21 Diego Novillo <dnovillo@google.com>
+
+ * tree-ssa-alias-warnings.c (struct gimple_tree_map): New.
+ Change every use of struct tree_map to struct gimple_tree_map.
+ (gimple_tree_map_eq): New.
+ (gimple_tree_map_hash): New.
+ * tree-ssa-ccp.c (evaluate_stmt): Remove stale FIXME note.
+ * gimplify.c (gimplify_expr): Remove stale FIXME note.
+ * tree-ssa-pre.c: Remove stale references to GIMPLE_MODIFY_STMT.
+ * tree-vect-generic.c (expand_vector_operations_1): Change
+ FIXME tuples to NOTE.
+
+2008-07-21 Richard Guenther <rguenther@suse.de>
+
+ * tree-ssa-phiprop.c (propagate_with_phi): Only look through
+ SSA_NAME copies.
+
+2008-07-21 Richard Guenther <rguenther@suse.de>
+
+ * gimplify.c (gimplify_init_constructor): Clear TREE_SIDE_EFFECTS
+ on the remaining empty constructor.
+
+2008-07-21 Richard Guenther <rguenther@suse.de>
+
+ * tree-ssa-ccp.c (fold_gimple_assign): Handle pointer conversions
+ like fold_stmt_r did.
+ * gimple-pretty-print.c (dump_gimple_cond): Place semicolons
+ where trunk did.
+ * tree-inline.c (copy_bb): Do not insert GIMPLE_NOPs.
+
+2008-07-21 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/36826
+ * tree-ssa-pre.c (eliminate): Do not eliminate in unused
+ statements.
+
+2008-07-20 Richard Guenther <rguenther@suse.de>
+
+ * gimple.h (gimple_expr_type): The expression type is always
+ the base type of an integral sub-type result type.
+ * tree-eh.c (replace_goto_queue_cond_clause): Copy the sequence
+ before handing it off to gsi_insert_seq_after.
+ * tree-sra.c (insert_edge_copies_seq): Make sure to not keep an
+ uninserted but marked for update sequence.
+
+2008-07-20 Richard Guenther <rguenther@suse.de>
+
+ * gimple.c (DEFTREECODE): Add REALIGN_LOAD_EXPR.
+
+2008-07-19 Richard Guenther <rguenther@suse.de>
+
+ * tree-ssa-sccvn.h (get_constant_value_id): Declare.
+ (vn_constant_eq_with_type): Make sure an integral type is
+ never equal to a non-integral type.
+ (vn_hash_constant_with_type): Adjust.
+ * tree-ssa-sccvn.c (get_constant_value_id): New function.
+ * tree-ssa-pre.c (get_expr_value_id): For newly created
+ constant value-ids make sure to add the expression to its
+ expression-set.
+
+2008-07-18 Jakub Jelinek <jakub@redhat.com>
+
+ * gimple.c (gimple_regimplify_operands): Moved to...
+ * gimplify.c (gimple_regimplify_operands): ... here. Rework using
+ lower_omp_1 regimplification code, if regimplified LHS of
+ GIMPLE_ASSIGN or GIMPLE_CALL requires simpler RHS, create a temporary.
+ * omp-low.c (gimple_regimplify_operands): Use
+ gimple_regimplify_operands.
+
+2008-07-18 Richard Guenther <rguenther@suse.de>
+
+ * tree-ssa-reassoc.c (get_rank): For single rhs process its
+ operands.
+
+2008-07-18 Richard Guenther <rguenther@suse.de>
+
+ * tree-ssa-loop-niter.c (expand_simple_operations): Expand
+ as much as trunk does.
+ * tree-ssa-sccvn.c (simplify_binary_expression): For comparisons
+ always expand the first operand.
+
+2008-07-18 Jakub Jelinek <jakub@redhat.com>
+
+ * gimple-pretty-print.c (dump_gimple_cond): Print a semicolon if
+ goto or else goto has been printed.
+ (dump_gimple_goto): Print as goto instead of gimple_goto, print
+ a semicolon at the end.
+ (dump_gimple_asm): Print a semicolon at the end.
+
+ * gimplify.c (gimplify_cond_expr): If COND_EXPR has both non-trivial
+ THEN and ELSE statements and the THEN sequence can't fallthru, avoid
+ adding label_cont and jump to it.
+
+2008-07-18 Aldy Hernandez <aldyh@redhat.com>
+
+ * Makefile.in. Remove TREE_GIMPLE_H definition.
+ Rename all TREE_GIMPLE_H uses to GIMPLE_H.
+ Depend on tree-iterator.h when necessary.
+ * tree-into-ssa.c: Include gimple.h instead of tree-gimple.h.
+ * tree-complex.c: Same.
+ * cgraphbuild.c: Same.
+ * cgraph.c: Same.
+ * builtins.c: Same.
+ * tree-ssa-sccvn.c: Same.
+ * tree-ssa-copyrename.c: Same.
+ * tree-nomudflap.c: Same.
+ * tree-call-cdce.c: Same.
+ * ipa-pure-const.c: Same.
+ * ipa-utils.c: Same.
+ * tree-ssa-alias.c: Same.
+ * tree-ssa-sink.c: Same.
+ * langhooks.c: Same.
+ * function.c: Same.
+ * ipa-type-escape.c: Same.
+ * tree-affine.c: Same.
+ * c-typeck.c: Same.
+ * tree-dfa.c: Same.
+ * tree-ssa-pre.c: Same.
+ * tree-sra.c: Same.
+ * c-omp.c: Same.
+ * tree-ssa-dce.c: Same.
+ * tree-nested.c: Same.
+ * tree-ssa.c: Same.
+ * tree-inline.c: Same.
+ * tree-iterator.c: Same.
+ * c-gimplify.c: Same.
+ * tree-vect-generic.c: Same.
+ * tree-flow.h: Same.
+ * tree-ssa-structalias.c: Same.
+ * ipa-struct-reorg.c: Same.
+ * tree-ssa-reassoc.c: Same.
+ * config/alpha/alpha.c: Same.
+ * config/s390/s390.c: Same.
+ * config/m32c/m32c.c: Same.
+ * config/spu/spu.c: Same.
+ * config/sparc/sparc.c: Same.
+ * config/i386/i386.c: Same.
+ * config/sh/sh.c: Same.
+ * config/xtensa/xtensa.c: Same.
+ * config/stormy16/stormy16.c: Same.
+ * config/ia64/ia64.c: Same.
+ * config/rs6000/rs6000: Same.
+ * config/mips/mips.c: Same.
+ * varpool.c: Same.
+ * cgraphunit.c: Same. Include tree-iterator.h
+ * tree-mudflap.c: Same.
+ * gimplify.c: Same.
+ * c-decl.c: Same.
+ * omp-low.c: Same.
+ * c-semantics: Same.
+ * gimple-low.c: Same.
+ * tree-gimple.c: Merge contents into...
+ * gimple.c: ...here.
+ * tree-gimple.h: Merge contents into...
+ * gimple.h: ...here.
+
+2008-07-17 Jakub Jelinek <jakub@redhat.com>
+
+ * omp-low.c (expand_omp_atomic_pipeline): Call
+ force_gimple_operand_gsi on RHS for IADDR initialization.
+
+ * gimplify.c (gimplify_cond_expr): Push statements in between
+ gimple_push_condition and gimple_pop_condition into a new
+ gimple_seq, append it after gimple_pop_condition cleanups.
+
+2008-07-17 Richard Guenther <rguenther@suse.de>
+
+ * tree-complex.c (init_dont_simulate_again): Handle
+ {REAL,IMAG}PART_EXPR correctly.
+ * gimple-pretty-print.c (dump_unary_rhs): Dump VIEW_CONVERT_EXPR
+ and ASSERT_EXPR the same way as on trunk.
+ * tree-ssa-dom.c (initialize_hash_element): Do not record
+ the type for single rhs assigns.
+ (hashable_expr_equal_p): Deal with NULL types.
+ (eliminate_redundant_computations): Use print_gimple_expr.
+ * tree-vrp.c (stmt_interesting_for_vrp): Fix builtin call check.
+ (vrp_visit_stmt): Likewise.
+ * tree-ssa-forwprop.c (simplify_gimple_switch): Fix typo.
+
+2008-07-16 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/36792
+ * tree-ssa-pre.c (get_or_alloc_expr_for): Handle unary
+ expressions inserted by SCCVN.
+ (do_SCCVN_insertion): Adjust comment.
+ (execute_pre): Allow insertion for FRE again.
+
+ * tree-ssa-sccvn.c (simplify_unary_expression): Deal with
+ the GIMPLE_SINGLE_RHS statemens we get.
+ (init_scc_vn): Init VN_INFO->expr to NULL.
+
+2008-07-16 Richard Guenther <rguenther@suse.de>
+
+ Revert
+ 2008-07-16 Richard Guenther <rguenther@suse.de>
+ * tree-ssa-pre.c (get_constant_for_value_id): Only hand out
+ constants of the correct type.
+ (fully_constant_expression): Pass the required type to
+ get_constant_for_value_id.
+
+ * tree-ssa-sccvn.h (vn_hash_constant_with_type): New function.
+ (vn_constant_eq_with_type): Likewise.
+ * tree-ssa-sccvn.c (vn_constant_eq): Use vn_constant_eq_with_type.
+ (get_or_alloc_constant_value_id): Use vn_hash_constant_with_type.
+ * tree-ssa-pre.c (pre_expr_eq): Use vn_constant_eq_with_type.
+ (pre_expr_hash): Use vn_hash_constant_with_type.
+ (get_representative_for): Use constants as their representative.
+ (fully_constant_expression): Use constant parts in expressions
+ directly.
+
+2008-07-15 Aldy Hernandez <aldyh@redhat.com>
+
+ * tree-ssa-propagate.c (valid_gimple_expression_p): Remove.
+ * tree-ssa-propagate.h (valid_gimple_expression_p): Remove.
+ * tree-eh.c: Factor out common code in operation_could_trap_p and
+ stmt_could_throw_1_p into...
+ (operation_could_trap_helper_p): New.
+ * gimplify.c (gimplify_expr): Rephrase fixme.
+ * tree-mudflap.c: Remove fixme.
+
+2008-07-17 Jakub Jelinek <jakub@redhat.com>
+
+ * tree-eh.c (collect_finally_tree): Call collect_finally_tree_1
+ with region as second argument for GIMPLE_TRY_FINALLY's cleanup.
+
+ * gimplify.c (gimplify_expr): Call gimple_try_set_catch_is_cleanup
+ for TRY_CATCH_EXPR.
+
+2008-07-16 Jakub Jelinek <jakub@redhat.com>
+
+ * tree-gimple.c (is_gimple_reg_rhs): Don't check for CALL_EXPRs
+ with side-effects.
+ * gimple.c (extract_ops_from_tree): Remove assert.
+ * gimplify.c (is_gimple_reg_or_call_rhs): New function.
+ (rhs_predicate_for): Return it instead of is_gimple_reg_rhs.
+ (gimplify_expr): Handle is_gimple_reg_or_call_rhs.
+
+ * tree-ssa-threadedge.c (record_temporary_equivalences_for_stmts,
+ simplify_control_stmt_condition): Pass stmt instead of NULL as second
+ argument to simplify callback.
+
+ * tree-vect-patterns.c (vect_recog_pow_pattern): Don't call
+ gimple_call_set_lhs with lhs of last_stmt.
+ * tree-vect-transform.c (vectorizable_call): Build a new dummy
+ assignment, replace the call with it and move over stmt_info.
+
+ * tree-ssa-loop-niter.c (infer_loop_bounds_from_array): Use
+ is_gimple_assign instead of gimple_code () == GIMPLE_ASSIGN and
+ is_gimple_call instead of gimple_code () == GIMPLE_CALL.
+ * tree-ssa-propagate.c (update_call_from_tree, substitute_and_fold):
+ Likewise.
+ * tree-ssa-sccvn.c (visit_use): Likewise.
+ * tree-eh.c (stmt_could_throw_p): Likewise.
+ * tree-optimize.c (execute_fixup_cfg): Likewise.
+ * omp-low.c (check_omp_nesting_restrictions, scan_omp_1_stmt,
+ optimize_omp_library_calls): Likewise.
+ * tree-ssa-loop-im.c (movement_possibility, stmt_cost,
+ determine_invariantness_stmt): Likewise.
+ * tree-ssa-phiprop.c (phivn_valid_p, phiprop_insert_phi,
+ propagate_with_phi): Likewise.
+ * tree-ssa-ccp.c (get_default_value, surely_varying_stmt_p,
+ ccp_fold_builtin, gimplify_and_update_call_from_tree): Likewise.
+ * ipa-struct-reorg.c (is_result_of_mult, create_general_new_stmt):
+ Likewise.
+ * tree-ssa-coalesce.c (build_ssa_conflict_graph): Likewise.
+ * tree-object-size.c (alloc_object_size, call_object_size,
+ check_for_plus_in_loops): Likewise.
+ * tree-ssa.c (verify_ssa): Likewise.
+ * predict.c (expr_expected_value_1, tree_bb_level_predictions,
+ tree_estimate_probability): Likewise.
+ * tree-cfg.c (verify_stmt): Likewise.
+ * tree-ssa-loop-ch.c (should_duplicate_loop_header_p,
+ copy_loop_headers): Likewise.
+ * tree-ssa-ter.c (is_replaceable_p): Likewise.
+ * ipa-prop.c (ipa_count_arguments, ipa_compute_jump_functions):
+ Likewise.
+ * tree-ssa-dom.c (gimple_assign_unary_useless_conversion_p,
+ record_equivalences_from_stmt, optimize_stmt,
+ get_lhs_or_phi_result): Likewise.
+ * tree-ssa-sink.c (is_hidden_global_store): Likewise.
+ * tree-nrv.c (tree_nrv, execute_return_slot_opt): Likewise.
+ * value-prof.c (gimple_divmod_fixed_value,
+ gimple_mod_pow2, gimple_mod_subtract): Likewise.
+ * tree-predcom.c (name_for_ref, find_looparound_phi,
+ replace_ref_with, remove_name_from_operation): Likewise.
+ * tree-ssa-math-opts.c (is_division_by, execute_cse_reciprocals,
+ execute_cse_sincos, execute_convert_to_rsqrt): Likewise.
+ * tree-complex.c (expand_complex_move, expand_complex_operations_1):
+ Likewise.
+ * tree-outof-ssa.c (identical_copies_p): Likewise.
+ * tree-ssa-pre.c (is_exception_related): Likewise.
+ * tree-sra.c (scalarize_use, scalarize_copy): Likewise.
+ * tree-ssa-alias.c (count_uses_and_derefs, update_alias_info_1,
+ is_escape_site): Likewise.
+ * lambda-code.c (can_put_in_inner_loop,
+ cannot_convert_bb_to_perfect_nest): Likewise.
+ * tree-tailcall.c (find_tail_calls, eliminate_tail_call): Likewise.
+ * ipa-type-escape.c (look_for_casts_stmt, is_cast_from_non_pointer):
+ Likewise.
+ * tree-vect-transform.c (vectorizable_reduction): Likewise.
+ * tree-ssa-threadedge.c (record_temporary_equivalences_from_stmts):
+ Likewise.
+ * tree-ssa-phiopt.c (nt_init_block): Likewise.
+ * tree-ssa-structalias.c (find_func_aliases): Likewise.
+ * tree-ssa-forwprop.c (can_propagate_from,
+ forward_propagate_comparison, simplify_not_neg_expr,
+ simplify_gimple_switch, tree_ssa_forward_propagate_single_use_vars):
+ Likewise.
+ * tree-ssa-dce.c (eliminate_unnecessary_stmts): Likewise.
+ * tree-ssa-dse.c (get_kill_of_stmt_lhs, dse_possible_dead_store_p,
+ dse_optimize_stmt, execute_simple_dse): Likewise.
+ * tree-ssa-loop-ivopts.c (find_interesting_uses_op,
+ find_interesting_uses_stmt, rewrite_use_nonlinear_expr): Likewise.
+ * tree-vrp.c (stmt_overflow_infinity, vrp_stmt_computes_nonzero,
+ register_edge_assert_for_2, register_edge_assert_for,
+ find_assert_locations, check_all_array_refs,
+ remove_range_assertions, stmt_interesting_for_vrp, vrp_visit_stmt,
+ simplify_stmt_using_ranges): Likewise.
+ * tree-ssa-loop-prefetch.c (gather_memory_references): Likewise.
+ * tree-ssa-copy.c (may_propagate_copy_into_stmt,
+ propagate_tree_value_into_stmt): Likewise.
+ * tree-inline.c (copy_bb, expand_call_inline,
+ gimple_expand_calls_inline, fold_marked_statements): Likewise.
+
+ * tree-ssa-copyrename.c (rename_ssa_copies): Use
+ gimple_assign_ssa_name_copy_p.
+
+ * tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Check
+ gimple_assign_rhs_code, type of rhs is TREE_TYPE (lhs), update
+ rhs_code.
+
+2008-07-16 Richard Guenther <rguenther@suse.de>
+
+ * tree-ssa-pre.c (get_constant_for_value_id): Only hand out
+ constants of the correct type.
+ (fully_constant_expression): Pass the required type to
+ get_constant_for_value_id.
+
+2008-07-15 Aldy Hernandez <aldyh@redhat.com>
+
+ Merge with mainline @137837.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2008-07-15 Jakub Jelinek <jakub@redhat.com>
+
+ * common.opt (-fgimple-conversion=): Remove.
+
+ * tree-affine.c (aff_combination_expand): Tuplify.
+ * cfgexpand.c (gimple_assign_rhs_to_tree): Remove prototype.
+ * tree-outof-ssa.c (gimple_assign_rhs_to_tree): Likewise.
+ * tree-gimple.h (gimple_assign_rhs_to_tree): New prototype.
+
+2008-07-15 Aldy Hernandez <aldyh@redhat.com>
+
+ * tree.h: Remove gimple_unreachable_1 prototype.
+
+2008-07-15 Aldy Hernandez <aldyh@redhat.com>
+
+ * Makefile.in (gimple-dummy.o): Remove.
+ * gimple-dummy.c: Delete.
+ * tree-ssa-propagate.c (valid_gimple_expression_p): Change
+ gimple_unreachable to gcc_unreachable.
+ * tree-affine.c (aff_combination_expand): Same.
+ * tree-vect-transform.c (vectorizable_call): Same.
+
+2008-07-15 Richard Guenther <rguenther@suse.de>
+
+ * gimplify.c (gimplify_expr): Gimplify an unused volatile load
+ properly.
+
+2008-07-15 Richard Guenther <rguenther@suse.de>
+
+ * tree-ssa-pre.c: Tuplify. Enable FRE and PRE.
+ (execute_pre): Disable SCCVN insertion even for FRE.
+ * tree-ssa-sccvn.h (copy_reference_ops_from_call): Declare.
+ * tree-ssa-sccvn.c (copy_reference_ops_from_call): Export.
+ (vn_get_expr_for): Handle more expression kinds.
+ (visit_reference_op_load): Properly set a value id for
+ inserted names.
+ (simplify_binary_expression): Use valid_gimple_rhs_p instead of
+ valid_gimple_expression_p.
+ (simplify_unary_expression): Likewise.
+ (process_scc): Clear the cached/simplified expressions at the
+ start of the iteration.
+ (free_scc_vn): Do not clear SSA_NAME_VALUE.
+ (run_scc_vn): Remove broken special case in printing VNs.
+ * tree-ssa-propagate.c (valid_gimple_rhs_p): Allow
+ gimple-min-invariants and SSA names.
+
+2008-07-14 Andreas Krebbel <krebbel1@de.ibm.com>
+
+ * config/s390/s390.c: (s390_gimplify_va_arg) Unshare the args* tree.
+
+2008-07-14 Richard Guenther <rguenther@suse.de>
+
+ * tree-ssa-math-opts.c (execute_cse_reciprocals): Process
+ SSA_NAME defs of calls.
+ * gimple-pretty-print.c (dump_unary_rhs): Do not prefix
+ CONSTRUCTOR with [constructor].
+
+2008-07-14 Aldy Hernandez <aldyh@redhat.com>
+
+ * config/alpha/alpha.c (va_list_skip_additions): Change
+ GIMPLE_STMT_OPERAND to TREE_OPERAND.
+
+2008-07-14 Jakub Jelinek <jakub@redhat.com>
+
+ * tree-vect-transform.c (vect_create_data_ref_ptr): Update comment.
+ * config/s390/s390.c (s390_va_start): Build MODIFY_EXPR instead of
+ GIMPLE_MODIFY_STMT.
+ (s390_gimplify_va_arg): Use gimplify_assign.
+ * config/sh/sh.c (sh_va_start): Build MODIFY_EXPR instead of
+ GIMPLE_MODIFY_STMT.
+ (sh_gimplify_va_arg_expr): Use gimplify_assign.
+ * config/sparc/sparc.c (sparc_gimplify_va_arg): Likewise.
+ * config/spu/spu.c (spu_va_start): Build MODIFY_EXPR instead of
+ GIMPLE_MODIFY_STMT.
+ (spu_gimplify_va_arg_expr): Use gimplify_assign.
+ * config/stormy16/stormy16.c (xstormy16_expand_builtin_va_start):
+ Build MODIFY_EXPR instead of GIMPLE_MODIFY_STMT.
+ (xstormy16_gimplify_va_arg_expr): Likewise. Use gimplify_assign.
+ * config/xtensa/xtensa.c (xtensa_va_start): Build MODIFY_EXPR
+ instead of GIMPLE_MODIFY_STMT.
+ (xtensa_gimplify_va_arg_expr): Use gimplify_assign.
+
+2008-07-14 Aldy Hernandez <aldyh@redhat.com>
+
+ * config/alpha/alpha.c (va_list_skip_additions): Rename
+ GIMPLE_MODIFY_STMT to MODIFY_EXPR.
+ (alpha_va_start): Same.
+ (alpha_gimplify_va_arg_1): Use gimplify_assign.
+ (alpha_gimplify_va_arg): Same.
+ * config/frv/frv.c (frv_expand_builtin_va_start): Rename
+ GIMPLE_MODIFY_STMT to MODIFY_EXPR.
+ * config/ia64/ia64.c (ia64_gimplify_va_arg): Use gimplify_assign.
+ * config/alpha/mips.c (mips_va_start): Rename GIMPLE_MODIFY_STMT to
+ MODIFY_EXPR or use gimplify_assign when appropriate.
+ (mips_gimplify_va_arg_expr): Same.
+
+2008-07-14 Aldy Hernandez <aldyh@redhat.com>
+
+ * config/rs6000/rs6000.c (rs6000_va_start): Change
+ GIMPLE_MODIFY_STMT to MODIFY_EXPR.
+ (rs6000_gimplify_va_arg): Use gimplify_assign.
+ Build GIMPLE_GOTO directly.
+
+2008-07-14 Aldy Hernandez <aldyh@redhat.com>
+
+ * tree-dump.c (dequeue_and_dump): Remove GIMPLE_MODIFY_STMT case.
+ * tree-ssa-loop-niter.c (simplify_replace_tree): Remove GIMPLE_STMT_P
+ call.
+ * tree-pretty-print.c (dump_generic_node): Remove any references to
+ GIMPLE_MODIFY_STMT, GIMPLE_STMT_P, GIMPLE_TUPLE_P.
+ (op_prio): Same.
+ (op_symbol_code): Same.
+ * java/java-gimplify.c (java_gimplify_expr): Same.
+ (java_gimplify_modify_expr): Same.
+ * java/java-tree.h: Rename GENERIC_NEXT to TREE_CHAIN.
+ * tree-tailcall.c (find_tail_calls): Update comment.
+ * tree.c (tree_code_class_string): Remove "gimple_stmt".
+ (tree_node_kind): Remove "gimple statments".
+ (tree_code_size): Remove tcc_gimple_stmt.
+ (make_node_stat): Same.
+ (copy_node_stat): Remove any references to
+ GIMPLE_MODIFY_STMT, GIMPLE_STMT_P, GIMPLE_TUPLE_P, tcc_gimple_stmt,
+ TS_GIMPLE_STATEMENT, GENERIC_TREE_OPERAND, GENERIC_TREE_TYPE,
+ GIMPLE_TUPLE_HAS_LOCUS_P, GIMPLE_STMT_LOCUS, GIMPLE_STMT_BLOCK,
+ IS_GIMPLE_STMT_CODE_CLASS, GIMPLE_STMT_BLOCK.
+ (expr_align): Same.
+ (tree_node_structure): Same.
+ (build2_stat): Same.
+ (set_expr_locus): Same.
+ (walk_tree_1): Same.
+ (tree_block): Same.
+ (build_gimple_modify_stmt_stat): Remove.
+ (expr_location): Remove.
+ (set_expr_location): Remove.
+ (expr_hash_location): Remove.
+ (expr_locus): Remove.
+ (expr_filename): Remove.
+ (expr_lineno): Remove.
+ (generic_tree_operand): Remove.
+ (generic_tree_type): Remove.
+ * tree.h (tree_code_class): Remove tcc_gimple_stmt.
+ (IS_GIMPLE_STMT_CODE_CLASS): Remove.
+ (struct gimple_stmt): Remove.
+ (GIMPLE_STMT_CHECK): Remove.
+ (TREE_OPERAND_CHECK): Remove GIMPLE_TUPLE_P.
+ (TREE_CHAIN): Same.
+ (GIMPLE_STMT_OPERAND_CHECK): Remove.
+ (GIMPLE_STMT_OPERAND_CHECK): Remove.
+ (GIMPLE_STMT_P): Remove.
+ (GIMPLE_TUPLE_P): Remove.
+ (GIMPLE_TUPLE_HAS_LOCUS_P): Remove.
+ (GENERIC_TREE_OPERAND): Remove.
+ (GENERIC_TREE_TYPE): Remove.
+ (GENERIC_NEXT): Remove.
+ (IS_CONVERT_EXPR_CODE_P): Rename GENERIC_TREE_TYPE to TREE_TYPE.
+ (MOVE_NONTEMPORAL): Remove GIMPLE_MODIFY_STMT_CHECK.
+ Remove GIMPLE_STMT_OPERAND, GIMPLE_STMT_LOCUS, GIMPLE_STMT_BLOCK.
+ (EXPR_LOCATION, SET_EXPR_LOCATION, EXPR_HAS_LOCATION, EXPR_LOCUS,
+ EXPR_FILENAME, EXPR_LINENO): Do ont call functions.
+ (CAN_HAVE_LOCATION_P): Remove GIMPLE_STMT_P.
+ (union tree_node): Remove gstmt.
+ (build_gimple_modify_stmt*): Remove.
+ (expr_location, set_expr_location, expr_has_location,
+ expr_locus, expr_filename, expr_lineno, generic_tree_operand,
+ generic_tree_type): Remove.
+ * tree-scalar-evolution.c (follow_ssa_edge): Update comment.
+ (interpret_condition_phi): Same.
+ * gimple.h (gimplify_assign): New.
+ * builtins.c, fold-const.c, omp-low.c, tree-ssa-dse.c, tree-gimple.c,
+ tree-ssa-math-opts.c, tree-nrv.c, gimple-low.c, dwarf2out.c,
+ expr.c, tree-parloops.c, matrix-reorg.c, c-decl.c, tree-eh.c,
+ c-pretty-print.c, langhooks.c, function.c, tree-affine.c,
+ gimplify.c, tree.def, cfgexpand.c, tree-predcom.c, print-tree.c,
+ tree-ssa-ter.c, tree-ssa.c, tree-inline.c, gimple.c, gimple.h,
+ tree-cfg.c, config/i386/i386.c, stmt.c, tree-ssa-operands.c)
+ Remove any references to
+ GIMPLE_MODIFY_STMT, GIMPLE_STMT_P, GIMPLE_TUPLE_P, tcc_gimple_stmt,
+ TS_GIMPLE_STATEMENT, GENERIC_TREE_OPERAND, GENERIC_TREE_TYPE,
+ GIMPLE_TUPLE_HAS_LOCUS_P, GIMPLE_STMT_LOCUS, GIMPLE_STMT_BLOCK,
+ IS_GIMPLE_STMT_CODE_CLASS, GIMPLE_STMT_BLOCK.
+ Call gimplify_assign or generate a GIMPLE_ASSIGN directly when
+ appropriate.
+
+2008-07-14 Jakub Jelinek <jakub@redhat.com>
+
+ * cfgexpand.c (gimple_cond_pred_to_tree): New function.
+ (gimple_to_tree) <case GIMPLE_COND>: Use it.
+ (release_stmt_tree): New function.
+ (expand_gimple_cond): Call just gimple_cond_pred_to_tree
+ instead of gimple_to_tree, ggc_free pred before returning.
+ (expand_gimple_tailcall): Call release_stmt_tree.
+ (expand_gimple_basic_block): Call release_stmt_tree instead
+ of ggc_free.
+
+ * gimplify.c (internal_get_tmp_var, gimplify_decl_expr,
+ gimplify_init_ctor_eval, gimplify_target_expr): Call ggc_free
+ on the INIT_EXPR.
+
+2008-07-14 Richard Guenther <rguenther@suse.de>
+
+ * tree-ssa-ccp.c (ccp_fold): Move ADDR_EXPR handing to
+ GIMPLE_SINGLE_RHS case.
+ * tree-ssa-ifcombine.c (ifcombine_iforif): Fix typo.
+
+2008-07-14 Jakub Jelinek <jakub@redhat.com>
+
+ * system.h (CONST_CAST2): Avoid using a union for all GCCs <= 4.0.x.
+
+2008-07-12 Diego Novillo <dnovillo@google.com>
+
+ * tree-loop-distribution.c: Tuplify.
+ * tree-ssa-propagate.c (substitute_and_fold): Remove
+ stale FIXME tuples note.
+
+2008-07-11 Jakub Jelinek <jakub@redhat.com>
+
+ * tree-dump.c (dump_options): Don't set TDF_RHS_ONLY for -all.
+
+ * omp-low.c (lower_omp_1): Only use rhs_predicate_for if
+ GIMPLE_SINGLE_RHS.
+
+ * tree-vect-analyze.c (vect_determine_vectorization_factor): Handle
+ GIMPLE_CALL with non-NULL lhs.
+ (vect_build_slp_tree): Likewise. Fix reversed check for references.
+ * tree-vectorizer.c (stmt_vec_info_htab, stmt_vec_info_eq,
+ stmt_vec_info_hash, init_stmt_vec_info_htab,
+ free_stmt_vec_info_htab): Remove.
+ (stmt_vec_info_vec): New variable.
+ (init_stmt_vec_info_vec, free_stmt_vec_info_vec): New functions.
+ (new_loop_vec_info): Clear stmt uid before calling
+ set_vinfo_for_stmt.
+ (vect_is_simple_use): Handle GIMPLE_CALL with non-NULL lhs.
+ (vectorize_loops): Call {init,free}_stmt_vec_info_vec instead of
+ {init,free}_stmt_vec_info_htab.
+ * tree-parloops.c (parallelize_loops): Likewise.
+ * tree-ssa-operands.c (get_expr_operands): Handle VEC_COND_EXPR.
+ * tree-vectorizer.h (stmt_vec_info_htab): Removed.
+ (init_stmt_vec_info_htab, free_stmt_vec_info_htab): Remove
+ prototypes.
+ (stmt_vec_info_vec): New extern decl.
+ (init_stmt_vec_info_vec, free_stmt_vec_info_vec): New prototypes.
+ (vinfo_for_stmt, set_vinfo_for_stmt): Rewritten using stmt uid
+ and vector instead of a hash table.
+ * tree-vect-patterns.c (vect_recog_pow_pattern): Request
+ a GIMPLE_CALL with non-NULL lhs instead of GIMPLE_ASSIGN.
+ (vect_pattern_recog_1): Use is_gimple_call instead of comparing
+ gimple_code with GIMPLE_CALL.
+ * gimple.c (gimple_rhs_class_table): Use GIMPLE_SINGLE_RHS for
+ DOT_PROD_EXPR and VEC_COND_EXPR.
+ * tree-vect-transform.c (vect_get_slp_vect_defs): Use gimple_get_lhs
+ instead of gimple_assign_lhs.
+ (get_initial_def_for_induction): Use build_int_cst even for
+ pointers. Use POINTER_PLUS_EXPR for POINTER_TYPE_P (scalar_type).
+ (vect_get_vec_def_for_operand): Use is_gimple_call instead of
+ comparing gimple_code with GIMPLE_CALL.
+ (vectorizable_call): Likewise. Use gimple_call_lhs instead of
+ gimple_assign_lhs. Build a vector of arguments, use
+ gimple_build_call_vec.
+ (vect_get_vec_def_for_stmt_copy): Use gimple_get_lhs.
+ (vectorizable_live_operation): Handle GIMPLE_SINGLE_RHS operands.
+
+2008-07-11 Doug Kwan <dougkwan@google.com>
+
+ * gimple-dummy.c (vectorizable_induction, vectorizable_type_promotion,
+ vectorizable_type_demotion, vectorizable_conversion,
+ vectorizable_operation, vectorizable_assignment,
+ vectorizable_load, vectorizable_call, vectorizable_store,
+ vectorizable_condition, vectorizable_reduction,
+ vectorizable_live_operation, vectorizable_function,
+ vect_estimate_min_profitable_iters, vect_model_simple_cost,
+ vect_model_store_cost, vect_model_load_cost, vect_transform_loop):
+ Remove DUMMY_FNs.
+ * tree-ssa-loop.c (gate_tree_vectorize): Reenable vectorizer.
+ * tree-vectorizer.c (vect_is_simple_use): Fix handling of
+ GIMPLE_NOP.
+ * tree-vectorizer.h (vectorizable_load, vectorizable_store,
+ vectorizable_operation, vectorizable_type_promotion,
+ vectorizable_type_demotion, vectorizable_conversion,
+ vectorizable_assignment, vectorizable_call, vectorizable_condition,
+ vectorizable_live_operation, vectorizable_reduction,
+ vectorizable_induction): Adjust prototypes.
+ * tree-vect-transform.c (vectorizable_load, vectorizable_store,
+ vectorizable_operation, vectorizable_type_promotion,
+ vectorizable_type_demotion, vectorizable_conversion,
+ vectorizable_assignment, vectorizable_call, vectorizable_condition,
+ vectorizable_live_operation, vectorizable_reduction,
+ vectorizable_induction, vect_transform_stmt,
+ vect_create_data_ref_ptr, vect_create_addr_base_for_vector_ref,
+ vect_get_vec_def_for_operand, vect_init_vector,
+ vect_finish_stmt_generation, vect_create_epilog_for_reduction,
+ get_initial_def_for_reduction, cost_for_stmt,
+ vect_estimate_min_profitable_iters, vect_model_reduction_cost,
+ vect_cost_strided_group_size, vect_model_load_cost, bump_vector_ptr,
+ vect_get_constant_vectors, vect_get_slp_vect_defs,
+ vect_get_slp_defs, get_initial_def_for_induction,
+ vect_get_vec_def_for_stmt_copy, vect_get_vec_defs,
+ vectorizable_function, vect_gen_widened_results_half,
+ vect_permute_store_chain, vect_setup_realignment,
+ vect_permute_load_chain, vect_transform_strided_load,
+ vect_is_simple_cond, vect_build_loop_niters,
+ vect_generate_tmps_on_preheader, vect_update_ivs_after_vectorizer,
+ vect_do_peeling_for_loop_bound, vect_gen_niters_for_prolog_loop,
+ vect_do_peeling_for_alignment, vect_create_cond_for_align_checks,
+ vect_create_cond_for_alias_checks, vect_loop_versioning,
+ vect_remove_stores, vect_schedule_slp_instance,
+ vect_transform_loop): Tuplify.
+
+2008-07-10 Richard Guenther <rguenther@suse.de>
+
+ * gimple.h (gimple_assign_ssa_name_copy_p): Declare.
+ (gimple_has_lhs): New function.
+ * gimple.c (gimple_assign_ssa_name_copy_p): New function.
+ * tree-ssa-copy.c (propagate_tree_value_into_stmt): Remove
+ redundant gimple_set_location call.
+ * gimple-iterator.c (gsi_remove): Do not free stmt operands.
+ * tree-ssa-structalias.c (find_func_aliases): Correctly let
+ all things with pointers escape.
+ * tree-pass.h (TDF_RHS_ONLY): New flag.
+ * diagnostic.h (print_gimple_expr): Declare.
+ * gimple-pretty-print.c (print_gimple_expr): New function.
+ (dump_gimple_assign): Dump the RHS as expression if TDF_RHS_ONLY.
+ (dump_gimple_call): Likewise.
+ (dump_gimple_cond): Likewise.
+ * tree-ssa-propagate.c (fold_predicate_in): Use print_gimple_expr.
+ * tree-ssa-sccvn.c (visit_use): Use gimple_has_lhs.
+ Use print_gimple_expr. Handle tcc_expression correctly.
+
+2008-07-09 Jakub Jelinek <jakub@redhat.com>
+
+ * gimplify.c (struct gimplify_ctx): Move to tree-gimple.h.
+ (push_gimplify_context): Don't allocate bind_expr_stack,
+ temp_htab nor c itself here. Add c argument.
+ (pop_gimplify_context): Allow bind_expr_stack being NULL. Check
+ c->temp_htab instead of optimize whether htab_delete should be called.
+ Don't free c.
+ (gimple_push_bind_expr): Create bind_expr_stack lazily.
+ (lookup_tmp_var): Create temp_htab lazily.
+ (gimplify_scan_omp_clauses, gimplify_omp_parallel, gimplify_omp_task,
+ gimplify_body, force_gimple_operand): Adjust push_gimplify_context
+ callers.
+ * omp-low.c (lower_omp_sections, lower_omp_single, lower_omp_master,
+ lower_omp_ordered, lower_omp_critical, lower_omp_for,
+ create_task_copyfn, lower_omp_taskreg, execute_lower_omp):
+ * tree-ssa-ccp.c (gimplify_and_update_call_from_tree): Likewise.
+ * tree-sra.c (generate_element_init): Likewise.
+ * tree-mudflap.c (execute_mudflap_function_ops,
+ execute_mudflap_function_decls): Likewise.
+ * tree-inline.c (setup_one_parameter, optimize_inline_calls): Likewise.
+ * tree-gimple.h (struct gimplify_ctx): New type.
+ (push_gimplify_context): Adjust prototype.
+
+ * gimple.h (gimple_rhs_class_table): New extern decl.
+ (get_gimple_rhs_class): Change into inline.
+ * gimple.c (get_gimple_rhs_class): Removed.
+ (gimple_rhs_class_table): New variable.
+
+2008-07-09 Doug Kwan <dougkwan@google.com>
+ Diego Novillo <dnovillo@google.com>
+
+ * tree-ssa-ccp.c (fold_stmt_r): Remove gcc_unreachable
+ call from COND_EXPR handler.
+ * tree-if-conv.c: Tuplify.
+ * gimple.c (gimple_could_trap_p_1): Factor out of ...
+ (gimple_could_trap_p): ... here.
+ Call it.
+ (gimple_assign_rhs_could_trap_p): New.
+ * gimple.h (gimple_assign_rhs_could_trap_p): Declare.
+ * tree-ssa-operands.c (get_expr_operands): Handle
+ COND_EXPR.
+
+2008-07-08 Jakub Jelinek <jakub@redhat.com>
+
+ Merge with mainline @137633.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2008-07-08 Jakub Jelinek <jakub@redhat.com>
+
+ * tree-cfg.c (remove_useless_stmts_cond): Avoid calling
+ fold_binary.
+
+2008-07-07 Jakub Jelinek <jakub@redhat.com>
+
+ * gimple-pretty-print.c (dump_gimple_return): Don't print space
+ after return if return has no argument.
+ (dump_gimple_seq): Don't print newline after last statement in
+ the sequence.
+ (dump_gimple_fmt, dump_gimple_try, dump_gimple_omp_for,
+ dump_gimple_omp_single, dump_gimple_omp_sections,
+ dump_gimple_omp_block, dump_gimple_omp_critical,
+ dump_gimple_omp_parallel, dump_gimple_omp_task): Use
+ newline_and_indent after dump_gimple_seq instead of INDENT.
+ (dump_gimple_bind): Likewise. If there are no bind vars, don't
+ print two newlines before the sequence, just one.
+ * tree-cfg.c (dump_function_to_file): Fix dumping lowered gimple
+ before CFG is built.
+
+2008-07-07 Diego Novillo <dnovillo@google.com>
+
+ * tree-vrp.c (ssa_name_nonnegative_p): Tuplify.
+ (ssa_name_nonzero_p): Tuplify.
+ (extract_range_from_comparison): Tidy.
+ (vrp_evaluate_conditional_warnv_with_ops): Tidy.
+ (vrp_evaluate_conditional): Change STMT argument to gimple.
+ Update all users.
+ (simplify_stmt_for_jump_threading): Change WITHIN_STMT argument
+ to gimple.
+ Update all users.
+ (identify_jump_threads): Tidy.
+ * tree-tailcall.c (find_tail_calls): Remove stale FIXME note.
+ * tree.c (tree_node_structure): Likewise.
+ * tree.h (struct tree_base): Likewise.
+ (struct gimple_stmt): Likewise.
+ * builtins.c (expand_builtin_memcpy): Likewise.
+ (expand_builtin_memset_args): Likewise.
+ * tree-chrec.h (build_polynomial_chrec): Do not initialize VAL.
+ * tree-ssa-ccp.c (fold_stmt_r): Do not handle COND_EXPR.
+ (fold_stmt): Remove #if 0 code.
+ * tree-ssa-dom.c (EXTRA_DETAILS): Remove.
+ Update all users.
+ (hashable_expr_equal_p): Remove stale FIXME note.
+ (simplify_stmt_for_jump_threading): Convert WITHIN_STMT
+ argument to gimple. Update all users.
+ * tree-ssa-propagate.c: Include gimple.h
+ (get_rhs): Remove.
+ (set_rhs): Remove.
+ (fold_predicate_in): Tuplify.
+ * Makefile.in (tree-ssa-propagate.o): Add dependency on
+ GIMPLE_H.
+ * tree-ssa-propagate.h (get_rhs, set_rhs): Remove.
+ * tree-parloops.c (create_parallel_loop): Remove FIXME
+ tuples note.
+ * tree-eh.c (lookup_stmt_eh_region): Remove FIXME tuples
+ editorial note.
+ * cfgexpand.c (gimple_to_tree): Likewise.
+ * tree-ssa-dce.c (mark_stmt_if_obviously_necessary): Tidy.
+ Do not handle GIMPLE_BIND.
+ * tree-inline.c (remap_gimple_op_r): Remove stale FIXME notes.
+ * tree-optimize.c (execute_fixup_cfg): Likewise.
+ * tree-flow.h (struct tree_ann_common_d): Remove stale
+ FIXME tuples notes.
+ (tree_vrp_evaluate_conditional): Change last argument type to
+ gimple. Update all users.
+ (thread_across_edge): Likewise.
+ * gimple.c (gimple_has_side_effects): If any argument has
+ TREE_SIDE_EFFECTS set, assert that S has volatile operands.
+ (gimple_rhs_has_side_effects): Likewise.
+ * gimple.h (gimple_phi_capacity): Remove stale FIXME tuples note.
+ * tree-cfg.c (group_case_labels): Remove FIXME tuples note.
+ Assert that the new size is smaller than the old size.
+ (remove_useless_stmts_warn_notreached): Remove #if 0 code.
+ (remove_useless_stmts_cond): Remove stale FIXME tuples note.
+ (remove_useless_stmts_1): Likewise.
+ (verify_types_in_gimple_assign): Likewise.
+ * passes.c (init_optimization_passes): Re-enable
+ pass_ipa_increase_alignment.
+ * tree-ssa-threadedge.c
+ (record_temporary_equivalences_from_stmts_at_dest):
+ Change SIMPLIFY to accept two arguments of type gimple.
+ Update all users.
+ (simplify_control_stmt_condition): Likewise.
+ (thread_accross_edge): Likewise.
+ * tree-ssa-operands.c (add_call_clobber_ops): Re-enable
+ calls to ipa_reference_get_not_read_globals and
+ ipa_reference_get_not_written_global.
+
+2008-07-07 Aldy Hernandez <aldyh@redhat.com>
+
+ * tree-ssa-dom.c: Remove FIXME tuples.
+
+2008-07-07 Aldy Hernandez <aldyh@redhat.com>
+
+ * tree-cfg.c (verify_types_in_gimple_assign): Remove
+ FIXME tuples.
+
+2008-07-04 Jakub Jelinek <jakub@redhat.com>
+
+ * cfgexpand.c (gimple_to_tree) <case GIMPLE_CALL>: Copy
+ CALL_EXPR_VA_ARG_PACK.
+
+ * gimple.c (gimple_build_bind): Set gimple_bind_block rather
+ than gimple_block.
+ (gimple_copy) <case GIMPLE_BIND>: Don't unshare gimple_bind_block.
+
+ * gimple.h (GF_ASM_INPUT, GF_ASM_VOLATILE, GF_CALL_CANNOT_INLINE,
+ GF_CALL_FROM_TRUNK, GF_CALL_RETURN_SLOT_OPT, GF_CALL_TAILCALL,
+ GF_CALL_VA_ARG_PACK, GF_OMP_PARALLEL_COMBINED, GF_OMP_RETURN_NOWAIT,
+ GF_OMP_SECTION_LAST, GF_PREDICT_TAKEN): Change from static const ints
+ into enum values.
+ (struct gimple_statement_base): Move subcode after flags to make it
+ 16-bit aligned.
+
+ * tree-ssa-structalias.c (find_func_aliases): Handle ADDR_EXPR
+ as GIMPLE_SINGLE_RHS instead of GIMPLE_UNARY_RHS.
+
+ * tree-ssa-operands.c (get_expr_operands): Don't handle
+ OMP_FOR, OMP_PARALLEL, OMP_TASK, OMP_SECTIONS and PREDICT_EXPR
+ here.
+
+ * gimple.def (GIMPLE_PREDICT): New.
+ * gimple.h: Update comment above GF_* flags.
+ (GF_PREDICT_TAKEN): New.
+ (gimple_build_predict): New prototype.
+ (gimple_predict_predictor, gimple_predict_outcome,
+ gimple_predict_set_predictor, gimple_predict_set_outcome): New
+ inlines.
+ * gimple.c (gss_for_code): Handle GIMPLE_PREDICT.
+ (gimple_size, walk_gimple_op): Likewise.
+ (gimple_build_predict): New function.
+ * gimple-pretty-print.c (dump_gimple_stmt): Handle GIMPLE_PREDICT.
+ * predict.c (tree_bb_level_predictions): Likewise.
+ * cfgexpand.c (gimple_to_tree): Likewise.
+ * tree-inline.c (estimate_num_insns): Likewise.
+ * tree-ssa-dce.c (mark_stmt_if_obviously_necessary): Likewise.
+ * gimple-low.c (lower_stmt): Likewise.
+ * tree-cfg.c (verify_types_in_gimple_seq_2): Likewise.
+ (verify_types_in_gimple_stmt): Likewise. Don't handle PREDICT_EXPR.
+ * gimplify.c (gimplify_expr): Gimplify PREDICT_EXPR into
+ GIMPLE_PREDICT.
+ * expr.c (expand_expr_real): Don't handle PREDICT_EXPR.
+
+2008-07-04 Aldy Hernandez <aldyh@redhat.com>
+
+ * tree-ssa-forwprop.c (rhs_to_tree): Remove fixme.
+ (forward_propagate_into_cond): Add comment.
+ (forward_propagate_into_gimple_cond): Add comment.
+ (forward_propagate_addr_expr_1): Enable optimization.
+
+2008-07-04 David Edelsohn <edelsohn@gnu.org>
+
+ Revert:
+ * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Unshare t.
+
+ * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Unshare reg.
+
+2008-07-03 David Edelsohn <edelsohn@gnu.org>
+
+ * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Unshare t.
+
+2008-07-03 Doug Kwan <dougkwan@google.com>
+
+ * gimple-dummy.c (vectorizable_function): New dummy.
+ (vect_pattern_recog): Remove dummy.
+ * tree-vectorizer.h (vect_recog_func_ptr): Adjust types for tuples.
+ * tree-vect-patterns.c (File): Re-enable all code.
+ (widened_name_p): Tuplify.
+ (vect_recog_temp_ssa_var): New.
+ (vect_recog_dot_prod_pattern): Tuplify.
+ (vect_recog_widen_mult_pattern): Same.
+ (vect_recog_pow_pattern): Same.
+ (vect_recog_widen_sum_pattern): Same.
+ (vect_pattern_recog_1): Tuplify. Factor out code to create SSA
+ temporaries to vect_recog_temp_ssa_var. Remove code for building
+ assignment statement.
+ (vect_pattern_recog): Tuplify.
+
+2008-07-03 Janis Johnson <janis187@us.ibm.com>
+ David Edelsohn <edelsohn@gnu.org>
+
+ * config/rs6000/rs6000.c (rs6000_va_start): Unshare valist.
+ (rs6000_gimplify_va_arg): Unshare valist, reg, addr, ovf.
+
+2008-07-03 Jakub Jelinek <jakub@redhat.com>
+
+ * tree-inline.c (remap_gimple_op_r): Remap TREE_BLOCK of
+ expressions.
+
+ * tree-switch-conversion.c (gen_inbound_check): Force RHS to be
+ gimple operand. Use fold_build* instead of build*.
+ (build_arrays): Likewise. Convert RHS to LHS's type.
+
+ * tree-switch-conversion.c (struct switch_conv_info): Change
+ arr_ref_first and arr_ref_last to gimple.
+ (check_range, check_final_bb, gather_default_values,
+ build_constructors, build_one_array, build_arrays, gen_def_assign,
+ fix_phi_nodes, gen_inbound_check, process_switch, do_switchconv):
+ Tuplify.
+ (create_temp_arrays): Formatting.
+
+ * gimple.h (gimple_try_set_kind): New inline function.
+ * tree-eh.c (same_handler_p, optimize_double_finally,
+ refactor_eh_r, refactor_eh): Tuplify.
+ * passes.c (init_optimization_passes): Reenable pass_refactor_eh.
+
+2008-07-02 Jakub Jelinek <jakub@redhat.com>
+
+ * tree-parloops.c (struct reduction_info): Change reduc_stmt,
+ reduc_phi, keep_res and new_phi field types to gimple.
+ (struct elv_data): Add info field.
+ (reduction_phi, loop_parallel_p, take_address_of,
+ initialize_reductions, eliminate_local_variables_stmt,
+ eliminate_local_variables, expr_invariant_in_region_p,
+ separate_decls_in_region_name, separate_decls_in_region_stmt,
+ create_phi_for_local_result, create_call_for_reduction_1,
+ create_call_for_reduction, create_loads_for_reductions,
+ create_final_loads_for_reduction, create_stores_for_reduction,
+ create_loads_and_stores_for_name, separate_decls_in_region,
+ canonicalize_loop_ivs, transform_to_exit_first_loop,
+ create_parallel_loop, gen_parallel_loop,
+ loop_has_vector_phi_nodes, parallelize_loops): Tuplify.
+ * tree-cfg.c (gimple_duplicate_sese_tail): Tuplify.
+ (move_block_to_fn): Don't call gsi_next after calling
+ remove_phi_node.
+
+2008-07-02 Aldy Hernandez <aldyh@redhat.com>
+ Richard Guenther <rguenther@suse.de>
+
+ * tree-ssa-forwprop.c (can_propagate_from): Exclude loads
+ from decls explicitly.
+ (gate_forwprop): Enable.
+
+2008-07-02 Jakub Jelinek <jakub@redhat.com>
+
+ * tree-vectorizer.h (vinfo_for_stmt): Use htab_find_slot_with_hash.
+ (set_vinfo_for_stmt): Likewise. If info is NULL, delete entry from
+ hash table.
+ * tree-vectorizer.c (stmt_vec_info_eq, stmt_vec_info_hash): New
+ functions.
+ (init_stmt_vec_info_htab): Use them instead of htab_hash_pointer
+ and htab_eq_pointer.
+ (free_stmt_vec_info): Free stmt_info only after set_vinfo_for_stmt
+ call.
+
+ Merge with mainline @137346.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+ * builtins.c (gimple_rewrite_call_expr): Fix -Wc++-compat and/or
+ -Wcast-qual warnings.
+ * gimple.c (gimple_alloc_stat, gimple_build_omp_for,
+ gimple_range_check_failed, gimple_copy): Likewise.
+ * tree-mudflap.c (mx_xfn_xform_decls): Likewise.
+ * tree-nested.c (convert_nonlocal_reference_stmt,
+ convert_local_reference_stmt): Likewise.
+ * gimple-iterator.c (gsi_insert_before_without_update,
+ gsi_insert_after_without_update): Likewise.
+ * tree-ssa-loop-im.c (init_lim_data, get_lim_data,
+ clear_lim_data): Likewise.
+ * tree-ssa-sccvn.c (vn_nary_op_insert_stmt): Likewise.
+ * tree-vrp.c (check_all_array_refs): Likewise.
+ * value-prof.c (histogram_eq): Likewise.
+ * cgraphbuild.c (record_reference): Don't handle OMP_PARALLEL
+ and OMP_TASK here.
+ (build_cgraph_edges): Handle GIMPLE_OMP_{PARALLEL,TASK}.
+ * cgraph.c (cgraph_add_new_function): Call gimple_register_cfg_hooks
+ instead of tree_register_cfg_hooks.
+ * omp-low.c (finalize_task_copyfn): Ensure the new function's
+ body is a gimple_seq with just GIMPLE_BIND in it.
+ (scan_omp_1_stmt): Fix -Wc++-compat and/or -Wcast-qual warnings.
+ * tree-cfg.c (move_stmt_op, have_similar_memory_accesses_1,
+ ref_base_address_1): Likewise.
+ (move_stmt_r): Handle gimple_block updating.
+ * tree-ssa-alias.c (update_alias_info_1): Tuplify.
+ (update_alias_info): Likewise.
+ * tree-switch-conversion.c: Stub out temporarily.
+
+2008-06-30 Aldy Hernandez <aldyh@redhat.com>
+
+ * tree-ssa-forwprop.c: Remove obsolete comment.
+ (get_prop_source_stmt): Wrap call to gimple_assign_lhs with a
+ TREE_TYPE.
+ (forward_propagate_comparison): Use build2 instead of
+ fold_binary.
+
+2008-06-27 Diego Novillo <dnovillo@google.com>
+
+ * cfgexpand.c (gimple_assign_rhs_to_tree): Factor out of ...
+ (gimple_to_tree): ... here.
+ Update comments referring to mainline merge.
+ * tree-ssa-ter.c: Tuplify.
+ * tree-outof-ssa.c (gimple_assign_rhs_to_tree): Declare.
+ (replace_use_variable): Call it.
+ (rewrite_trees): Tuplify.
+ (remove_ssa_form): Call it.
+ * gimple.h: Tidy some formatting.
+ * ipa-struct-reorg.c: Include gimple.h
+ * Makefile.in (ipa-struct-reorg.o): Add dependency on
+ GIMPLE_H.
+
+2008-06-27 Richard Guenther <rguenther@suse.de>
+
+ * tree-ssa-sccvn.c (vn_get_expr_for): New function.
+ (vuses_to_vec): Tuplify.
+ (copy_vuses_from_stmt): Likewise.
+ (vdefs_to_vec): Likewise.
+ (copy_vdefs_from_stmt): Likewise.
+ (shared_vuses_from_stmt): Likewise.
+ (copy_reference_ops_from_call): New function split out from
+ copy_reference_ops_from_ref.
+ (create_reference_ops_from_call): New function.
+ (shared_reference_ops_from_call): Likewise.
+ (get_def_ref_stmt_vuses): Tuplify.
+ (vn_reference_lookup): Likewise.
+ (vn_nary_op_lookup_stmt): New function.
+ (vn_nary_op_insert_stmt): Likewise.
+ (vn_phi_lookup): Tuplify.
+ (vn_phi_insert): Likewise.
+ (defs_to_varying): Likewise.
+ (visit_unary_op): Likewise.
+ (visit_binary_op): Likewise.
+ (visit_reference_op_call): New function.
+ (visit_reference_op_load): Tuplify.
+ (visit_reference_op_store): Likewise.
+ (visit_phi): Likewise.
+ (stmt_has_constants): New function.
+ (simplify_binary_expression): Tuplify.
+ (simplify_unary_expression): Likewise.
+ (try_to_simplify): Likewise.
+ (visit_use): Likewise.
+ (compare_ops): Likewise.
+ (DFS): Likewise.
+ (run_scc_vn): Likewise.
+ * tree-ssa-sccvn.h (shared_vuses_from_stmt): Adjust prototype.
+ (copy_vuses_from_stmt): Likewise.
+ (vn_get_expr_for): Declare.
+ (vn_nary_op_lookup_stmt): Likewise.
+ (vn_nary_op_insert_stmt): Likewise.
+ * tree-dfa.c (get_single_def_stmt): Tuplify.
+ (get_single_def_stmt_from_phi): Likewise.
+ (get_single_def_stmt_with_phi): Likewise.
+ * tree-ssa-pre.c (do_SCCVN_insertion): Use vn_get_expr_for.
+ (eliminate): Likewise.
+ (execute_pre): Enable SCCVN.
+ (gate_fre): Enable.
+ * tree-flow.h (get_single_def_stmt): Adjust prototype.
+ (get_single_def_stmt_from_phi): Likewise.
+ (get_single_def_stmt_with_phi): Likewise.
+ (vn_lookup_or_add_with_stmt): Likewise.
+ (vn_lookup_with_stmt): Likewise.
+ * gimple.c (gimple_fold): Fix.
+ * tree-vn.c (vn_add): Disable call to add_to_value.
+ (vn_add_with_vuses): Likewise.
+ (vn_lookup_with_stmt): Tuplify.
+ (vn_lookup_or_add_with_stmt): Likewise.
+
+2008-06-27 Aldy Hernandez <aldyh@redhat.com>
+
+ * gimple.c (gimple_cond_get_ops_from_tree): Handle TRUTH_NOT_EXPR.
+
+2008-06-25 Diego Novillo <dnovillo@google.com>
+
+ * gimple.h (enum gimple_rhs_class): Move from tree-gimple.h
+ (struct gimple_statement_base): Change CODE field to 8
+ bits.
+ Change SUBCODE field to 16 bits.
+ (gimple_set_subcode): Move to gimple.c.
+ (gimple_subcode): Remove.
+ (gimple_expr_type): Handle GIMPLE_ASSIGN, GIMPLE_CALL and
+ GIMPLE_COND explicitly.
+ Move earlier in the file.
+ (gimple_expr_code): New.
+ (gimple_omp_subcode): New.
+ (gimple_omp_set_subcode): New.
+ (gimple_omp_return_nowait_p): Call gimple_omp_subcode.
+ (gimple_omp_section_last_p): Likewise.
+ (gimple_omp_parallel_combined_p): Likewise.
+ (gimple_assign_rhs_code): New.
+ (gimple_assign_set_rhs_code): New.
+ (gimple_assign_cast_p): Call gimple_assign_rhs_code.
+ Handle VIEW_CONVERT_EXPR.
+ (gimple_call_tail_p): Access subcode field directly.
+ (gimple_call_cannot_inline_p): Likewise.
+ (gimple_call_return_slot_opt_p): Likewise.
+ (gimple_call_from_thunk_p): Likewise.
+ (gimple_call_va_arg_pack_p): Likewise.
+ (gimple_call_copy_flags): Likewise.
+ (gimple_cond_code): Likewise.
+ (gimple_cond_set_code): Likewise.
+ (gimple_cond_make_false): Likewise.
+ (gimple_cond_make_true): Likewise.
+ (gimple_asm_volatile_p): Likewise.
+ (gimple_asm_input_p): Likewise.
+ (gimple_eh_filter_must_not_throw): Likewise.
+ (gimple_eh_filter_set_must_not_throw): Likewise.
+ (gimple_try_kind): Likewise.
+ (gimple_try_catch_is_cleanup): Likewise.
+ (gimple_wce_cleanup_eh_only): Likewise.
+
+ * tree-vrp.c (simplify_div_or_mod_using_ranges): Call
+ gimple_assign_set_rhs_code instead of gimple_set_subcode.
+ (simplify_abs_using_ranges): Likewise.
+ * tree-complex.c (init_dont_simulate_again): Call
+ gimple_expr_code instead of gimple_subcode.
+ (complex_visit_stmt): Likewise.
+ (expand_complex_move): Call gimple_assign_rhs_code
+ instead of gimple_subcode.
+ (expand_complex_operations_1): Likewise.
+ * value-prof.c (gimple_divmod_fixed_value): Likewise.
+ (gimple_mod_pow2): Likewise.
+ (gimple_mod_subtract): Likewise.
+ (gimple_divmod_values_to_profile): Likewise.
+ * tree-ssa-alias-warnings.c (find_alias_site_helper):
+ Call gimple_assign_cast_p.
+ (already_warned_in_frontend_p): Likewise.
+ * gimple.def: Add comments warning about code orderings.
+ * omp-low.c (expand_omp_taskreg): Call gimple_omp_set_subcode.
+ (expand_omp_atomic_fetch_op): Call gimple_assign_rhs_code.
+ * tree-gimple.c (get_gimple_rhs_class): Move to gimple.c
+ (get_gimple_rhs_num_ops): Likewise.
+ (gimple_assign_rhs_code): Move to gimple.h.
+ * tree-gimple.h (enum gimple_rhs_class): Move to gimple.h.
+ * tree-ssa-ccp.c (fold_gimple_assign): Call
+ gimple_assign_rhs_code instead of gimple_subcode.
+ * tree-stdarg.c (va_list_counter_bump): Likewise.
+ (check_all_va_list_escapes): Likewise.
+ (execute_optimize_stdarg): Likewise.
+ * tree-ssa-math-opts.c (is_division_by): Likewise.
+ (replace_reciprocal): Likewise.
+ (execute_cse_reciprocals): Likewise.
+ (execute_convert_to_rsqrt): Likewise.
+ * tree-ssa-dom.c (initialize_hash_element): Likewise.
+ (simple_iv_increment_p): Likewise.
+ (gimple_assign_unary_useless_conversion_p): Likewise.
+ * tree-ssa-alias.c (is_escape_site): Call gimple_assign_cast_p.
+ * predict.c (expr_expected_value_1): Call gimple_assign_rhs_code
+ instead of gimple_subcode.
+ * tree-eh.c (tree_could_trap_p): Call gimple_expr_code
+ instead of gimple_subcode.
+ * ipa-type-escape.c (is_array_access_through_pointer_and_index):
+ Call gimple_assign_rhs_code instead of gimple_subcode.
+ (check_assign): Likewise.
+ * gimplify.c (gimplify_omp_parallel): Call gimple_omp_set_subcode
+ instead of gimple_set_subcode.
+ * tree-mudflap.c (mf_xform_derefs): Call gimple_assign_rhs_code
+ instead of gimple_subcode.
+ * tree-ssa-forwprop.c (get_prop_source_stmt): Likewise.
+ (can_propagate_from): Likewise.
+ (remove_prop_source_from_use): Likewise.
+ (forward_propagate_addr_into_variable_array): Likewise.
+ * tree-object-size.c (plus_stmt_object_size): Likewise.
+ (collect_object_sizes_for): Likewise.
+ (check_for_plus_in_loops_1): Likewise.
+ (check_for_plus_in_loops): Likewise.
+ * gimple.c (gimple_set_subcode): Move from gimple.h
+ (gimple_check_failed): Access subcode field directly.
+ (gimple_assign_single_p): Call gimple_assign_rhs_code
+ instead of gimple_subcode.
+ (gimple_assign_unary_nop_p): Likewise.
+ (gimple_get_lhs): Change argument type to const_gimple.
+ (gimple_could_trap_p): Call gimple_assign_rhs_code
+ instead of gimple_subcode.
+ (get_gimple_rhs_class): Move from tree-gimple.c.
+ (get_gimple_rhs_num_ops): Likewise.
+ * tree-ssa-structalias.c (update_alias_info): Call
+ gimple_assign_rhs_code instead of gimple_subcode.
+ (find_func_aliases): Likewise.
+ * tree-ssa-threadedge.c (record_temporary_equivalences_from_phis):
+ Likewise.
+
+2008-06-25 Doug Kwan <dougkwan@google.com>
+
+ * gimple-dummy.c: (vect_free_slp_tree) Remove dummy.
+ (vect_analyze_loop): Same.
+ (vectorizable_induction): New dummy.
+ (vectorizable_type_promotion): Same.
+ (vectorizable_type_demotion): Same.
+ (vectorizable_conversion): Same.
+ (vectorizable_operation): Same.
+ (vectorizable_assignment): Same.
+ (vectorizable_load): Same.
+ (vectorizable_call): Same.
+ (vectorizable_store): Same.
+ (vectorizable_condition): Same.
+ (vectorizable_reduction): Same.
+ (vectorizable_live_operation): Same.
+ (vect_estimate_min_profitable_iters): Same.
+ (vect_model_simple_cost): Same.
+ (vect_model_store_cost): Same.
+ (vect_model_load_cost): Same.
+ (vect_pattern_recog): Same.
+ * tree-vectorizer.h (struct _stmt_vec_info): Change fields FIRST_DR
+ and NEXT_DR from tree to gimple type.
+ (vectorizable_load): Change type of parameter STMT to gimple.
+ (vectorizable_store): Same.
+ (vectorizable_operation): Same.
+ (vectorizable_type_promotion): Same.
+ (vectorizable_type_demotion): Same.
+ (vectorizable_conversion): Same.
+ (vectorizable_assignment): Same.
+ (vectorizable_function): Same.
+ (vectorizable_call): Same.
+ (vectorizable_condition): Same.
+ (vectorizable_live_operation): Same.
+ (vectorizable_reduction): Same.
+ (vectorizable_induction): Same.
+ * tree-vect-analyze.c (File): Re-enable all previously disabled code.
+ (vect_determine_vectorization_factor): Tuplify.
+ (vect_analyze_operations): Same.
+ (exist_non_indexing_operands_for_use_p): Same.
+ (vect_analyze_scalar_cycles_1): Same.
+ (vect_insert_into_interleaving_chain): Same.
+ (vect_same_range_drs): Same.
+ (vect_compute_data_ref_alignment): Same.
+ (vect_verify_datarefs_alignment): Same.
+ (vector_alignment_reachable_p): Same.
+ (vect_enhance_data_refs_alignment): Same.
+ (vect_analyze_group_access): Same.
+ (vect_analyze_data_ref_access): Same.
+ (vect_free_slp_tree): Same.
+ (vect_get_and_check_slp_defs): Same.
+ (vect_build_slp_tree): Same.
+ (vect_print_slp_tree): Same.
+ (vect_mark_slp_stmts): Same.
+ (vect_analyze_slp_instance): Same.
+ (vect_analyze_slp): Same.
+ (vect_detect_hybrid_slp_stmts): Same.
+ (vect_analyze_data_refs): Same.
+ (vect_mark_relevant): Same.
+ (process_use): Same.
+ (vect_mark_stmts_to_be_vectorized): Same.
+ (vect_can_advance_ivs_p): Same.
+ (vect_get_loop_niters): Same.
+ (vect_analyze_loop_form): Same.
+
+2008-06-25 Diego Novillo <dnovillo@google.com>
+
+ * tree-vectorizer.c (hash_gimple_stmt): Remove.
+ (eq_gimple_stmt): Remove.
+ (init_stmt_vec_info_htab): Use htab_hash_pointer and
+ htab_eq_pointer for STMT_VEC_INFO_HTAB.
+
+2008-06-24 Doug Kwan <dougkwan@google.com>
+
+ * gimple-dummy.c (vect_set_verbosity_level): Remove.
+ (vectorize_loops): Same.
+ (vect_free_slp_tree): New dummy.
+ (vect_analyze_loop): Same.
+ (vect_transform_loop): Same.
+ * tree-vectorize.c (hashtab.h): New include.
+ (File): Re-enable all previously commented out code.
+ (stmt_vec_info_htab): New var.
+ (rename_variables_in_bb): Tuplify.
+ (slpeel_update_phis_for_duplicate_loop): Same.
+ (slpeel_update_phi_nodes_for_guard1): Same.
+ (slpeel_update_phi_nodes_for_guard2): Same.
+ (slpeel_make_loop_iterate_ntimes): Same.
+ (slpeel_tree_duplicate_loop_to_edge_cfg): Same.
+ (slpeel_add_loop_guard): Same.
+ (slpeel_can_duplicate_loop_p): Same.
+ (set_prologue_iterations): Same.
+ (find_loop_location): Same.
+ (new_stmt_vec_info): Same.
+ (hash_gimple_stmt): New function.
+ (init_stmt_vec_info_htab): New function.
+ (free_stmt_vec_info_htab): New function.
+ (free_stmt_vec_info): Replace statement info with hash table entry.
+ (new_loop_vec_info): Tuplify.
+ (destroy_loop_vec_info): Same.
+ (vect_supportable_dr_alignment): Same
+ (vect_is_simple_use): Same.
+ (supportable_widening_operation): Same.
+ (supportable_narrowing_operation): Same.
+ (report_vec_op): New function. Code factored out from ...
+ (vect_is_simple_reduction): Call it. Tuplify.
+ (vectorize_loops): Set up and tear down stmt_vec_info hash table.
+ * tree-vectorizer.h (struct _slp_tree): Change statement fields
+ (struct _loop_vec_info): Same.
+ (struct _stmt_vec_info):
+ (nested_in_vect_loop): Re-enable.
+ (init_stmt_vec_info_htab): New prototype.
+ (free_stmt_vec_info_htab): New prototype.
+ (vinfo_for_stmt): Use hash table instead of statement info.
+ (set_stmt_info): Remove.
+ (set_vinfo_for_stmt): New inline.
+ (is_pattern_stmt_p): Tuplify.
+ (vect_is_simple_use): Tuplify prototype.
+ (vect_is_simple_reduction): Same.
+ (supportable_widening_operation): Same.
+ (supportable_narrowing_operation): Same.
+ (new_stmt_vec_info): Same.
+ (free_stmt_vec_info): Same.
+ Makefile.in (tree-vectorize.o): Add HASTAB_H dependency.
+
+2008-06-22 Andrew Pinski <pinskia@gmail.com>
+
+ * gimple-pretty-print.c (dump_binary_rhs): Print out MIN_EXPR and
+ MAX_EXPR specially.
+
+2008-06-20 Doug Kwan <dougkwan@google.com>
+
+ * tree-loop-linear.c (File): Re-enable all previously disabled code.
+ (gather_interchange_stats): Tuplify.
+ (linear_transform_loops): Likewise.
+ * gimple-dummy.c (get_type): Remove unused dummy.
+ (ipa_add_method): Same.
+ (ipa_callsite_callee): Same.
+ (ipa_callsite_compute_count): Same.
+ (ipa_callsite_compute_param): Same.
+ (ipa_callsite_param): Same.
+ (ipa_callsite_param_count): Same.
+ (ipa_callsite_param_count_set): Same.
+ (ipa_edges_create): Same.
+ (ipa_edges_free): Same.
+ (ipa_free): Same.
+ (ipa_jf_get_info_type): Same.
+ (ipa_method_compute_modify): Same.
+ (ipa_method_compute_tree_map): Same.
+ (ipa_method_formal_compute_count): Same.
+ (ipa_method_formal_count): Same.
+ (ipa_method_formal_count_set): Same.
+ (ipa_method_get_tree): Same.
+ (ipa_method_modify_print): Same.
+ (ipa_method_tree_print): Same.
+ (ipa_methodlist_init): Same.
+ (ipa_methodlist_not_empty): Same.
+ (ipa_node_create): Same.
+ (ipa_nodes_create): Same.
+ (ipa_nodes_free): Same.
+ (ipa_remove_method): Same.
+ (vec_set_verbosity_level): Same.
+ * tree-ssa-loop.c (tree_linear_transform): Re-enable.
+
+2008-06-19 Jan Hubicka <jh@suse.cz>
+
+ * gimple.c (gimple_alloc): Annotate with MEM_STAT_INFO
+ (gimple_build_with_ops): Likewise.
+ (gimple_build_assign): Likewise.
+ (gimple_build_assign_with_ops): Likewise.
+ * gimple.h (gimple_build_assign, gimple_build_assign_with_ops):
+ Annotate with MEM_STAT_INFO.
+
+2008-06-17 Jan Hubicka <jh@suse.cz>
+
+ * config/i386.c (ix86_gimplify_va_arg): Fix sharing issue.
+
+2008-06-17 Jan Hubicka <jh@suse.cz>
+
+ * gimplify.c (gimplify_modify_expr): Unshare only returned value when
+ want_value is set instead of copying operands all the time.
+
+2008-06-17 Diego Novillo <dnovillo@google.com>
+
+ * tree-ssa-loop-niter.c (get_val_for): Fix FIXME note.
+
+2008-06-17 Steven Bosscher <stevenb.gcc@gmail.com>
+
+ * gimple-dummy.c (canonicalize_induction_variables): Remove dummy.
+ (remove_empty_loops): Likewise.
+ (tree_unroll_loops_completely): Likewise.
+ * tree-ssa-ivcanon.c (tree_num_loop_insns): Replace bsi with gsi.
+ (create_canonical_iv): Convert to tuples.
+ (try_unroll_loop_completely): Likewise.
+ (empty_loop_p): Likewise.
+ (remove_empty_loop): Likewise.
+ * tree-ssa-loop.c (tree_ssa_loop_ivcanon): Re-enable.
+ (tree_ssa_empty_loop): Likewise.
+ (tree_complete_unroll): Likewise.
+ (tree_complete_unroll_inner): Likewise.
+
+2008-06-16 Doug Kwan <dougkwan@google.com>
+
+ * tree-ssa-ifcombine.c (File): Re-enable all previously diabled code.
+ (bb_no_side_effects_p): Tuplify.
+ (same_phi_args_p): Likewise.
+ (get_name_for_bit_test): Likewise.
+ (operand_precision): New.
+ (integral_operand_p): New.
+ (recognize_single_bit_test): Tuplify.
+ (regcognize_bits_test): Tuplify.
+ (ifcombine_ifandif): Likewise.
+ (ifcombine_iforif): Likewise.
+ (tree_ssa_ifcombine): Likewise.
+ * passes.c: Re-enable pass_tree_ifcombine.
+
+2008-06-16 Doug Kwan <dougkwan@google.com>
+
+ * tree-ssa-loop-unswitch.c (File): Re-enable all previously disabled
+ code.
+ (tree_may_unswitch_on): Tuplify.
+ (simplify_using_entry_checks): Likewise.
+ (tree_unswitch_single_loop): Likewise.
+ * gimple-dummy.c (tree_ssa_unswitch_loops): Remove dummy.
+ * tree-ssa-loop.c (gate_tree_ssa_loop_unswitch): Re-enable.
+
+2008-06-16 Steven Bosscher <steven@gcc.gnu.org>
+
+ * tree-ssa-reassoc.c: Convrt to tuples.
+
+2008-06-15 Diego Novillo <dnovillo@google.com>
+
+ * tree-ssa-live.c (mark_all_vars_used_1): Mark as used
+ the TREE_BLOCK of any _EXPR node.
+
+2008-06-13 Doug Kwan <dougkwan@google.com>
+
+ * tree-mudflap.c (File): Re-enable previously disabled code.
+ (mf_decl_cache_locals): Tuplify.
+ (mf_build_check_statement_for): Likewise.
+ (mf_xform_derefs_1): Re-enable.
+ (mf_xform_derefs): Tuplify.
+ (execute_mudflap_function_decls): Likewise.
+ (mx_register_decls): Tuplify. Add a new formal parameter for
+ the location of newly generated statements. Change function to
+ return modified gimple sequence instead of of modifying in-place.
+ (mx_xfn_xform_decls): Tuplify.
+ (mf_xform_decls): Tuplify.
+ * passes.c (init_optimization_passes): Re-enable mudflap passes.
+
+2008-06-13 Jakub Jelinek <jakub@redhat.com>
+
+ Merge with mainline @136757.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2008-06-13 Doug Kwan <dougkwan@google.com>
+
+ * ipa-reference.c (scan_stmt_for_static_refs): Rename walk_subtrees
+ parameter to handled_ops_p and correct bug of using walk_tree callback
+ semantics.
+ * ipa-pure-const.c (scan_function_stmt): Likewise.
+ * tree-inline.c (mark_local_labes_stmt): Rename walk_subtrees
+ parameter to handle_ops_p.
+ (replace_locals_stmt): Likewise.
+
+2008-06-10 Steven Bosscher <steven@gcc.gnu.org>
+
+ * passes.c (init_optimization_passes): Re-enable pass_uncprop.
+ * tree-ssa-uncprop (associate_equivalences_with_edges): Convert
+ to tuples.
+ (uncprop_into_successor_phis): Likewise.
+
+2008-06-09 Diego Novillo <dnovillo@google.com>
+
+ * ipa-cp.c (cgraph_gate_cp): Fix 'FIXME tuples' note.
+ * cfg.c (compact_blocks): Likewise.
+ * dominance.c (free_dominance_info): Likewise.
+ * gimple-low.c (gimple_stmt_may_fallthru): Likewise
+ * c-gimplify.c (add_block_to_enclosing): Likewise.
+ * lambda-mat.c: Include tree-flow.h.
+ * lambda-trans.c: Likewise.
+ * Makefile.in (lambda-mat.o, lambda-trans.o): Add dependency
+ on $(TREE_FLOW_H).
+ * builtins.c (expand_builtin_setjmp_receiver): Remove #if 0 markers.
+ (fold_call_stmt): Call gimple_call_va_arg_pack_p.
+ * tree-gimple.h (gimple_bind_expr_stack): Declare.
+ * cgraphunit.c (update_call_expr): Do not try to access operand 0
+ of a FUNCTION_DECL.
+ * tree-ssa-loop-ivopts.c (stmt_invariant_in_loop_p): New.
+ * tree-flow.h (stmt_invariant_in_loop_p): Declare.
+ * gimple-dummy.c (remove_iv): Remove.
+ (gimple_stmt_may_fallthru):
+ * ipa-type-escape.c (check_tree): Call DECL_P before testing
+ DECL_INITIAL.
+ (check_assign): Do not access TREE_OPERAND 0 on the RHS
+ operand.
+ * gimplify.c (gimple_bind_expr_stack): New.
+ * gimple.h (struct gimple_statement_bind): Add more comments
+ for field BLOCK.
+ (gimple_cond_set_condition): New.
+ * gimple.c (gimple_cond_set_condition_from_tree): Call it.
+ (gimple_copy_no_def_use): Remove. Update all users.
+ (gimple_has_side_effects):
+ (gimple_rhs_has_side_effects):
+ * passes.c (init_optimization_passes): Enable
+ pass_release_ssa_names, pass_ipa_type_escape, pass_ipa_pta,
+ pass_ipa_struct_reorg, pass_record_bounds,
+ pass_late_warn_uninitialized and pass_rename_ssa_copies.
+
+ * lambda-code.c: Tuplify.
+ * ipa-struct-reorg.c: Tuplify.
+ * ipa-struct-reorg.h: Tuplify.
+
+2008-06-09 Jakub Jelinek <jakub@redhat.com>
+
+ * gimplify.c (gimplify_omp_for): Call gimple_omp_for_set_incr
+ with the RHS of the GIMPLE_MODIFY_STMT instead of the
+ GIMPLE_MODIFY_STMT itself.
+ * gimple-pretty-print.c (dump_gimple_omp_for): Adjust for it.
+ * tree-nested.c (walk_gimple_omp_for): Likewise.
+ * omp-low.c (extract_omp_for_data, lower_omp_for): Likewise.
+
+2008-06-09 Aldy Hernandez <aldyh@redhat.com>
+
+ * tree-ssa-forwprop.c (forward_propagate_into_cond): First argument is
+ a GSI.
+ (forward_propagate_addr_into_variable_array_index): Accept a GSI
+ instead of a gimple statement. Update accordingly.
+ (forward_propagate_addr_expr_1): Same.
+ (forward_propagate_addr_expr): Pass a GSI to
+ forward_propagate_addr_expr_1.
+ (simplify_not_neg_expr): Argument is a GSI.
+ Adjust accordingly.
+ (tree_ssa_forward_propagate_single_use_va): Pass GSI to
+ simplify_not_neg_expr and forward_propagate_into_cond.
+
+2008-06-09 Aldy Hernandez <aldyh@redhat.com>
+
+ * tree.h (IS_CONVERT_EXPR_P): New.
+ (CONVERT_EXPR_P): Use IS_CONVERT_EXPR_P.
+ * tree-ssa-forwprop.c (get_prop_dest_stmt): Convert to tuples.
+ (get_prop_source_stmt): Same.
+ (can_propagate_from): Same.
+ (remove_prop_source_from_use): Same.
+ (combine_cond_expr_cond): Same.
+ (forward_propagate_into_cond): Same.
+ (tidy_after_forward_propagate_addr): Same.
+ (forward_propagate_addr_into_variable_array_index): Same.
+ (forward_propagate_addr_expr_1): Same.
+ (forward_propagate_addr_expr): Same.
+ (forward_propagate_comparison): Same.
+ (simplify_not_neg_expr): Same.
+ (tree_ssa_forward_propagate_single_use_vars): Same.
+ (simplify_gimple_switch): Rename from -simplify_switch_expr.
+ (rhs_to_tree): New.
+ (forward_propagate_into_gimple_cond): New.
+ * Makefile.in (tree-ssa-forwprop.o): Depend on GIMPLE_H.
+ * passes.c (init_optimization_passes): Enable pass_forwprop.
+
+2008-06-09 Jakub Jelinek <jakub@redhat.com>
+
+ * tree.def (OMP_SECTIONS_SWITCH, OMP_ATOMIC_LOAD, OMP_ATOMIC_STORE):
+ Removed.
+ * tree-gimple.c (is_gimple_stmt): Don't handle them.
+ * gimplify.c (gimplify_expr): Likewise.
+ * tree-pretty-print.c (dump_generic_node): Likewise.
+ * tree-ssa-operands.c (get_expr_operands): Likewise.
+ * expr.c (expand_expr_real_1): Likewise.
+ * omp-low.c (expand_omp_atomic_pipeline): Adjust comment.
+
+2008-06-09 Jakub Jelinek <jakub@redhat.com>
+
+ Merge with mainline @136433.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2008-06-08 Diego Novillo <dnovillo@google.com>
+
+ Merge with mainline @136432.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2008-06-08 Diego Novillo <dnovillo@google.com>
+
+ * tree-call-cdce.c: Tuplify.
+
+2008-06-06 Diego Novillo <dnovillo@google.com>
+
+ http://gcc.gnu.org/ml/gcc-patches/2008-06/msg00353.html
+
+ * gimple.def: Add a third argument to all GIMPLE codes.
+ Update all users.
+ * calls.c (gimple_alloca_call_p): Fix comment.
+ * system.h (CONST_CAST_GIMPLE): Define.
+ * gimple.c (gimple_ops_offset_): Declare. Fill in from
+ third argument in gimple.def.
+ (gimple_set_stored_syms, gimple_set_loaded_syms): Move
+ from tree-ssa-operands.c
+ (gimple_alloc): Add argument NUM_OPS. Update all users.
+ Compute size by adding enough space for NUM_OPS operands.
+ (gimple_alloc_ops): Remove. Update all users.
+ (gimple_assign_set_rhs_from_tree): Change first argument
+ to gimple_stmt_iterator *. Update all users.
+ Allocate a new statement, if there are more operands that
+ can fit in the old one.
+ (gimple_assign_set_rhs_with_ops): Likewise.
+ (gimple_copy): Fix clearing of stores/loads sets in the
+ copied statement.
+ * gimple.h (struct gimple_statement_base): Remove fields
+ UNUSED_1, UNUSED_2, UNUSED_3.
+ Add fields MODIFIED, HAS_VOLATILE_OPS, REFERENCES_MEMORY_P,
+ UID and NUM_OPS.
+ Re-organize existing fields to eliminate holes on 64 bit
+ hosts.
+ Update all users.
+ (struct gimple_statement_with_ops_base): Define.
+ Factor out struct gimple_statement_with_ops. Include fields GSBASE,
+ ADDRESSES_TAKEN, DEF_OPS and USE_OPS.
+ (struct gimple_statement_with_ops): Include struct
+ gimple_statement_with_ops_base.
+ Remove field NUM_OPS.
+ (struct gimple_statement_with_memory_ops_base): Define.
+ Factor out of struct gimple_statement_with_memory_ops.
+ Include fields OPBASE, VDEF_OPS, VUSE_OPS, STORES and
+ LOADS.
+ Remove fields HAS_VOLATILE_OPS and REFERENCES_MEMORY_P.
+ (struct gimple_statement_with_memory_ops): Include
+ struct gimple_statement_with_memory_ops_base.
+ (struct gimple_statement_phi): Change size_t fields to
+ unsigned. Update all users.
+ (struct gimple_statement_asm): Include struct
+ gimple_statement_with_memory_ops_base.
+ Change fields NI and NO to unsigned char.
+ Change field NC to short.
+ Update all users.
+ Add field OP.
+ (struct gimple_statement_change_dynamic_type): Remove.
+ Update all users.
+ (union gimple_statement_d): Rename field WITH_OPS to GSOPS.
+ Rename field WITH_MEM_OPS to GSMEM.
+ Update all users.
+ (gimple_addresses_taken): New.
+ (gimple_addresses_taken_ptr): New.
+ (gimple_set_addresses_taken): New.
+ (gimple_num_ops): Move earlier.
+ (gimple_ops): Use gimple_ops_offset_ to compute address
+ of the operand vector.
+ (gimple_op): Call gimple_ops.
+ (gimple_op_ptr): Likewise.
+ (gimple_set_op): Likewise.
+ (gimple_switch_num_labels): Call gimple_num_ops.
+ (gimple_switch_set_num_labels): Call gimple_set_num_ops.
+ (gimple_switch_set_label): Call gimple_num_ops.
+ (gimple_return_retval_ptr): Likewise.
+ (gimple_return_retval): Likewise.
+ (gimple_set_retval): Likewise.
+ (gimple_cdt_new_type): Use operand 1.
+ (gimple_cdt_new_type_ptr): Likewise.
+ (gimple_cdt_set_new_type): Likewise.
+ * tree-cfg.c (gimple_block_ends_with_call_p): Use
+ CONST_CAST_BB.
+ * tree-ssa-operands.c (gimple_set_stored_syms,
+ gimple_set_loaded_syms): Declare.
+ * value-prof.c (gimple_divmod_fixed_value_transform,
+ gimple_mod_pow2_value_transform,
+ gimple_mod_subtract_transform): Change argument to
+ gimple_stmt_iterator *. Update all users.
+ * tree-ssa-ccp.c (fold_gimple_assign): Change parameter
+ to gimple_stmt_iterator *. Update all users
+
+2008-06-05 Jakub Jelinek <jakub@redhat.com>
+
+ * gimplify.c (gimplify_modify_expr_to_memcpy): Use gimplify_arg
+ for gimplification of call arguments.
+ (gimplify_modify_expr_to_memset): Likewise.
+
+2008-06-02 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/36389
+ * gimplify.c (gimplify_cond_expr): If one or both branches are
+ GOTO_EXPRs jumping to LABEL_DECLs, don't create unnecessary
+ extra LABEL_DECLs and jumps around.
+ * tree-cfg.c (remove_useless_stmts_cond): Set may_branch also
+ for GIMPLE_COND stmts.
+ * tree-eh.c (replace_goto_queue_cond_clause): Set label to
+ create_artificial_label () rather than LABEL_EXPR.
+
+2008-05-30 Diego Novillo <dnovillo@google.com>
+
+ * calls.c (gimple_alloca_call_p): Fix detection of
+ alloca() calls.
+
+2008-05-30 Diego Novillo <dnovillo@google.com>
+
+ * toplev.c: Include gimple.h.
+ (dump_memory_report): Call dump_gimple_statistics.
+ * Makefile.in (toplev.o): Add dependency on GIMPLE_H.
+ * gimple-low.c (pass_lower_cf): Restore disabled bits.
+ * tree-dfa.c (pass_referenced_vars): Likewise.
+ * cfgexpand.c (pass_expand): Likewise.
+ * tree-outof-ssa.c (pass_del_ssa): Likewise.
+ * gimple.c (gimple_alloc): Fix non-C99 declaration.
+ * gimplify.c (gimplify_function_tree): Remove calls to
+ dump_tree_statistics and dump_gimple_statistics.
+
+2008-05-30 Jakub Jelinek <jakub@redhat.com>
+
+ * omp-low.c (diagnose_omp_structured_block_errors): Temporarily
+ switch cfun to DECL_STRUCT_FUNCTION (fndecl).
+
+ * omp-low.c (scan_sharing_clauses): Call scan_omp on
+ OMP_CLAUSE_REDUCTION_GIMPLE_{INIT,MERGE} instead of
+ scan_omp_op on OMP_CLAUSE_REDUCTION_{INIT,MERGE}.
+ (lower_rec_input_clauses): Clear
+ OMP_CLAUSE_REDUCTION_GIMPLE_{INIT,MERGE} instead of
+ OMP_CLAUSE_REDUCTION_{INIT,MERGE}. Call lower_omp
+ on OMP_CLAUSE_REDUCTION_GIMPLE_MERGE before gimple_seq_add_seq
+ to replace all occurences of placeholder in the seq.
+ * gimplify.c (gimplify_scan_omp_clauses): Clear
+ OMP_CLAUSE_REDUCTION_{INIT,MERGE} after gimplifying it.
+
+ * tree-nested.c (init_tmp_var_with_call, init_tmp_var, save_tmp_var):
+ Only set location if not gsi_end_p.
+ (walk_gimple_omp_for): Avoid adding an empty statement to seq.
+
+ * tree-inline.c (remap_gimple_stmt): Remap body of
+ GIMPLE_OMP_{MASTER,ORDERED,SECTION,SECTIONS,SINGLE}.
+
+2008-05-28 Andrew Pinski <pinskia@gmail.com>
+
+ * gimple-pretty-print.c (dump_unary_rhs): Handle conversions correctly.
+ Handle PAREN_EXPR, ABS_EXPR, and NEGATE_EXPR.
+
+2008-05-29 Jakub Jelinek <jakub@redhat.com>
+
+ * omp-low.c (lower_omp_1): Handle regimplification of GIMPLE_ASM.
+ Fix GIMPLE_ASSIGN regimplification.
+ * gimple-pretty-print.c (dump_gimple_omp_sections,
+ dump_gimple_omp_block, dump_gimple_omp_critical): New functions.
+ (dump_gimple_omp_parallel): Formatting.
+ (dump_gimple_stmt): Handle remaining GIMPLE_OMP_* statements.
+
+2008-05-29 Aldy Hernandez <aldyh@redhat.com>
+
+ * tree-inline.c (remap_gimple_stmt): Handle GIMPLE_OMP_* cases.
+
+2008-05-29 Aldy Hernandez <aldyh@redhat.com>
+
+ * gimple-pretty-print.c (dump_gimple_stmt): Add cases for
+ GIMPLE_OMP_MASTER and GIMPLE_OMP_ORDERED.
+
+2008-05-29 Aldy Hernandez <aldyh@redhat.com>
+
+ * omp-low.c (expand_omp_parallel): Parse an assignment from an
+ ADDR_EXPR correctly.
+ * gimple-pretty-print.c (dump_gimple_omp_parallel): Print braces when
+ appropriate.
+
+2008-05-29 Jakub Jelinek <jakub@redhat.com>
+
+ * omp-low.c (lower_omp_1): Fix regimplification of GIMPLE_COND and
+ GIMPLE_CALL.
+
+2008-05-28 Jakub Jelinek <jakub@redhat.com>
+
+ * gimple.c (gimple_regimplify_operands): Don't call gimple_num_ops
+ twice. Write regimplified operand to the correct operand slot.
+ * gimplify.c (rhs_predicate_for): No longer static.
+ * tree-gimple.h (rhs_predicate_for): New prototype.
+ * omp-low.c (lower_omp_1): Don't call gimple_regimplify_operands,
+ instead forcefully gimplify_expr each operand with the right
+ predicate.
+
+ * gimple.h (gimple_omp_atomic_store_val_ptr,
+ gimple_omp_atomic_load_lhs_ptr, gimple_omp_atomic_load_rhs_ptr): New
+ inlines.
+ * gimple.c (walk_gimple_op): Handle GIMPLE_OMP_ATOMIC_LOAD and
+ GIMPLE_OMP_ATOMIC_STORE.
+ * omp-low.c (lower_omp_1): Handle GIMPLE_OMP_ATOMIC_LOAD.
+
+ * gimple-pretty-print.c (dump_gimple_omp_for): Don't indent twice
+ before gimple_omp_body, don't emit extra newline after it.
+ (dump_gimple_omp_single): Likewise.
+
+2008-05-27 Aldy Hernandez <aldyh@redhat.com>
+
+ * tree-nested.c (walk_omp_for): Rename to...
+ (walk_gimple_omp_for): Enable and convert to tuples.
+ (convert_nonlocal_reference_stmt): Enable call to walk_gimple_omp_for.
+ (convert_local_reference_stmt): Same.
+ * gimple.c (walk_gimple_op): Remove fixme note.
+
+2008-05-27 Diego Novillo <dnovillo@google.com>
+
+ * tree-gimple.c (get_gimple_rhs_class): Handle
+ POLYNOMIAL_CHREC.
+ * tree-cfg.c (verify_types_in_gimple_assign): Do not
+ check every operand against the LHS type for tcc_binary
+ expressions.
+
+2008-05-26 Diego Novillo <dnovillo@google.com>
+
+ Merge with mainline @135951.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2008-05-22 Aldy Hernandez <aldyh@redhat.com>
+
+ * tree-cfg.c (make_edges): Change OMP_SECTION to GIMPLE_OMP_SECTIONS.
+ Update comments.
+ (verify_types_in_gimple_stmt): Update comments.
+ (verify_stmt): Same.
+
+2008-05-21 Andreas Tobler <a.tobler@schweiz.org>
+
+ * ../configure: Regenerate with the correct autoconf version: 2.59.
+
+2008-05-21 Aldy Hernandez <aldyh@redhat.com>
+
+ * omp-low.c (lower_reduction_clauses): Generate OMP_ATOMIC_* directly.
+ Concatenate atomic code correctly.
+
+2008-05-20 Aldy Hernandez <aldyh@redhat.com>
+
+ * omp-low.c (WALK_SUBSTMTS): New.
+ (check_combined_parallel): Walk sub-statements.
+ (diagnose_sb_1): Same.
+ (diagnose_sb_2): Same.
+ Handle switch labels and return statements correctly.
+ * testsuite/gcc.dg/gomp/block-7.c: Adjust for new error message.
+ * testsuite/gcc.dg/gomp/block-2.c: Same.
+ * testsuite/gcc.dg/gomp/block-4.c: Same.
+ * testsuite/gcc.dg/gomp/block-6.c: Same.
+ * testsuite/gcc.dg/gomp/block-8.c: Same.
+ * testsuite/gcc.dg/gomp/block-1.c: Same.
+ * testsuite/gcc.dg/gomp/block-3.c: Same.
+ * testsuite/gcc.dg/gomp/block-5.c: Same.
+
+2008-05-20 Aldy Hernandez <aldyh@redhat.com>
+
+ * omp-low.c (lower_omp_single): Append to bind variables.
+ (lower_omp_master): Same.
+ (lower_omp_ordered): Same.
+ (lower_omp_critical): Same.
+ * gimplify.c (gimplify_modify_expr_to_memcpy): Make sure we are
+ fully gimplified.
+ (gimplify_omp_for): Same.
+ * gimple.h (gimple_bind_set_vars): New.
+
+2008-05-16 Andreas Tobler <a.tobler@schweiz.org>
+
+ * config/alpha/alpha.c (alpha_gimplify_va_arg): Adjust arguments.
+ * config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise.
+ * config/pa/pa.c (hppa_gimplify_va_arg_expr): Likewise.
+ * config/m32c/m32c-protos.h (m32c_gimplify_va_arg_expr): Likewise.
+ * config/spu/spu.c (spu_gimplify_va_arg_expr): Likewise.
+ * config/stormy16/stormy16.c (xstormy16_gimplify_va_arg_expr): Likewise.
+ * config/xtensa/xtensa.c (xtensa_gimplify_va_arg_expr): Likewise.
+
+ * config/sparc/sparc.c (sparc_gimplify_va_arg): Adjust arguments.
+
+2008-05-16 Diego Novillo <dnovillo@google.com>
+
+ * tree-into-ssa.c (rewrite_uses_p): Fix return type.
+ * tree-vectorizer.h (nested_in_vect_loop_p): Add return value.
+ * tree-ssa-pre.c (execute_pre): Add return value.
+
+2008-05-15 Aldy Hernandez <aldyh@redhat.com>
+
+ * config/s390/s390.c (s390_gimplify_va_arg): Adjust for tuples.
+
+2008-05-15 Diego Novillo <dnovillo@google.com>
+
+ * Makefile.in (STRICT_WARN): Revert to mainline behaviour.
+ (builtins.o-warn, expr.o-warn, dse.o-warn,
+ ebitmap.o-warn, lower-subreg.o-warn, tree-chrec.o-warn,
+ tree-ssa-structalias.o-warn, varasm.o-warn): Remove.
+ * config/arm/arm.c (arm_return_in_memory): Fix return type.
+ * config/arm/arm-protos.h (arm_return_in_memory): Likewise.
+
+2008-05-15 Aldy Hernandez <aldyh@redhat.com>
+
+ * gimplify.c (gimplify_omp_for): Handle a MODIFY_EXPR in
+ gimple_omp_for_incr.
+ * cfgexpand.c (gimple_to_tree): Do not die on compile errors.
+
+2008-05-15 Aldy Hernandez <aldyh@redhat.com>
+
+ * omp-low.c (check_omp_nesting_restrictions): Fetch clauses from for.
+ (expand_omp_atomic): Parse GIMPLE_OMP_ATOMIC correctly.
+ (lower_omp_single_simple): Create GIMPLE_COND with both tlabel and
+ flabel.
+ (lower_omp_for): Make sure we have a body before look inside.
+ * gimple-low.c (lower_stmt): Add case for GIMPLE_OMP_SECTIONS_SWITCH.
+ * gimple-pretty-print.c (dump_gimple_omp_single): New.
+ (dump_gimple_stmt): Add case for GIMPLE_OMP_SINGLE.
+ * gimplify.c (gimplify_omp_workshare): Remove fixme. Enable code.
+ * gimple.c (gss_for_code): Add case for GIMPLE_OMP_{RETURN,
+ SECTIONS_SWITCH}.
+ (gimple_regimplify_operands): Do not regimplify GIMPLE_ASM
+ operands. Do not look inside empty operands.
+ * gimple.h (is_gimple_omp): Fix typo for GIMPLE_OMP_ATOMIC*.
+ * tree-cfg.c (make_edges): Rename OMP_SECTION to GIMPLE_OMP_SECTION.
+
+2008-05-14 Aldy Hernandez <aldyh@redhat.com>
+
+ * omp-low.c (optimize_omp_library_calls): Make sure statement is
+ a GIMPLE_CALL before we look inside of it.
+ * tree-cfg.c (move_stmt_op): Exit gracefully.
+
+2008-05-13 Aldy Hernandez <aldyh@redhat.com>
+
+ * omp-low.c (scan_omp_op): Remove walk_subtrees. Call walk_tree.
+ (scan_omp_for): Scan OMP body.
+ (scan_omp_1_stmt): Set handled_ops_p.
+ (expand_omp_parallel): Parse ADDR_EXPR correctly.
+ (diagnose_sb_1): Rename walk_subtrees to handled_ops_p and set
+ appropriately.
+ (diagnose_sb_2): Same.
+ * gimple-pretty-print.c (dump_gimple_omp_for): Print braces around
+ OMP body.
+ * tree-inline.c (estimate_num_insns): GIMPLE_OMP_CONTINUE does not
+ have a body.
+ * tree-cfg.c (move_stmt_op): Parse move_stmt_d out of data correctly.
+ (move_stmt_r): Rename walk_subtrees to handled_ops_p and set
+ appropriately.
+
+2008-05-12 Diego Novillo <dnovillo@google.com>
+
+ Merge with mainline @135126.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2008-05-11 Doug Kwan <dougkwan@google.com>
+
+ * gimplify.c (gimple_pop_condition): Clear
+ conditional_cleanups field after the associated gimple sequence has
+ been freed implicitly.
+ (gimplify_cleanup_point_expr): Clear conditional_cleanups field
+ of gimplfiy_ctxp after resetting the conditions field.
+ * gimple.h (gimple_call_return_type): Handle REFERENCE_TYPE like
+ POINTER_TYPE.
+
+2008-05-10 Kaz Kojima <kkojima@gcc.gnu.org>
+
+ * config/sh/sh.c (sh_gimplify_va_arg_expr): Change pre_p and
+ post_p types to gimple_seq *.
+
+2008-05-09 Aldy Hernandez <aldyh@redhat.com>
+
+ * omp-low.c (maybe_catch_exception): Return body when no exceptions.
+ (gate_lower_omp): Enable pass.
+ * gimple-low.c (lower_stmt): Add GIMPLE_OMP_ATOMIC_* cases.
+
+2008-05-08 Aldy Hernandez <aldyh@redhat.com>
+
+ * omp-low.c (extract_omp_for_data): Update comment.
+ (get_ws_args_for): Same.
+ (lower_send_shared_vars): Same.
+ (expand_omp_parallel): Same.
+ (expand_omp_for_static_nochunk): Same.
+ (expand_omp_for_static_chunk): Same.
+ (expand_omp_sections): Same.
+ (expand_omp_atomic_fetch_op): Same.
+ (expand_omp_atomic_pipeline): Same.
+ (build_omp_regions_1): Same.
+ (lower_omp_for): Same.
+ (expand_omp_atomic_mutex): Change OMP_ATOMIC_STORE to
+ GIMPLE_OMP_ATOMIC_STORE.
+ * gimple-pretty-print.c (dump_gimple_omp_parallel): Print child fn
+ and data_arg.
+ * tree-cfg.c (make_edges): Enable commented out code and convert
+ to tuples.
+ (replace_by_duplicate_decl): Same.
+ (replace_ssa_name): Same.
+ (move_stmt_r): Same.
+ (move_stmt_op): New.
+ (mark_virtual_ops_in_bb): Enable and convert to tuples.
+ (makr_virtual_ops_in_region): Same.
+ (move_block_to_fn): Convert to tuples.
+ (find_outermost_region_in_block): Enable and convert to tuples.
+ (move_sese_region_to_fn): Same.
+
+2008-05-05 Aldy Hernandez <aldyh@redhat.com>
+
+ * omp-low.c (expand_omp_parallel): Remove fixmes.
+ (expand_omp_for_static_chunk): Enable and tuplify code.
+ (expand_omp_sections): Remove fixmes. Tuplify.
+ (lower_omp_sections): Same.
+ (diagnose_sb_0): Remove fixme.
+ * tree-ssa.c (redirect_edge_var_map_dup): Fix typo in comment.
+ * gimple.c (gimple_size): Add case for GIMPLE_OMP_SECTIONS_SWITCH.
+ (gimple_build_omp_sections): New.
+ * gimple.h (gimple_build_omp_sections_switch): New prototype.
+
+2008-05-03 Aldy Hernandez <aldyh@redhat.com>
+
+ * omp-low.c (diagnose_sb_0): Tuplify and enable.
+ (diagnose_sb_1): Same.
+ (diagnose_sb_2): Same.
+ (diagnose_omp_structured_block_errors): Tuplify.
+ * gimple-dummy.c (DUMMY_FN): Remove
+ diagnose_omp_structured_block_errors.
+ * c-decl.c (c_gimple_diagnostics_recursively): Remove fixme
+ and enable call to diagnose_omp_structured_block_errors.
+ * Makefile.in (GTFILES): Add omp-low.c again.
+
+2008-05-02 Rafael Espindola <espindola@google.com>
+
+ * tree-gimple.c (is_gimple_condexpr): Do not allow
+ trapping comparisons.
+ * tree-eh.c (tree_could_trap_p): Fix handling of floating
+ point comparisons.
+
+2008-05-02 Doug Kwan <dougkwan@google.com>
+
+ * value-prof.c (gimple_divmod_fixed_value): Remove formal parameters
+ OPERATION, OP1 and OP2 and derive their values from parameter STMT
+ instead. Update prototype and caller.
+ (gimple_mod_pow2): Remove formal parameters OPERATION, OP1 and OP2
+ and derive their values from parameter STMT instead. Update prototype
+ and caller.
+ (gimple_mod_pow2_value_transform): Remove temporares OP, OP1 and OP2.
+ Use a new tempory LHS_TYPE to store assignment LHS type.
+ (gimple_mode_subtract): Remove formal parameters OPERATION, OP1 and OP2
+ and derive their values from parameter STMT instead. Update prototype
+ and caller. Fix a bug in a call to gimple_build_assign_with_ops.
+ (gimple_mod_subtract_transform): Remove temporares OP, OP1 and OP2.
+ Use a new tempory LHS_TYPE to store assignment LHS type.
+ (gimple_ic, gimple_indirect_call_to_profile): Fix bug in tree-code
+ tests.
+ * tree-profile.c (File): Re-enable all previously disabled code.
+ (tree_gen_edge_profiler): Tuplify.
+ (prepare_instrumented_value): Ditto.
+ (tree_gen_interval_profiler): Ditto.
+ (tree_gen_pow2_profiler): Ditto.
+ (tree_gen_one_value_profiler): Ditto.
+ (tree_gen_ic_profiler): Ditto.
+ (tree_gen_ic_func_profiler): Ditto.
+ (tree_gen_const_delta_profiler): Re-format formal parameters for
+ proper alignement.
+ (tree_gen_average_profiler): Tuplify.
+ (tree_gen_ior_profiler): Ditto.
+ (do_tree_profiling): Re-enable previously disabled code. Remove
+ FIXME.
+ (tree_profiling): Ditto.
+ * gimple.c (gimple_set_bb): Remove assertion.
+ * tree-cfg.c (change_bb_for_stmt): Remove. Redirect callers to
+ gimple_set_bb.
+ (gimple_merge_blocks): Call gimple_set_bb instead of
+ change_bb_for_stmt.
+ (gimple_split_block): Ditto.
+ (verify_stmts): Add code to check that label_to_block_map and labels
+ are consistent.
+
+2008-04-22 Rafael Espindola <espindola@google.com>
+
+ Merge with mainline @134843.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2008-05-01 Diego Novillo <dnovillo@google.com>
+
+ http://gcc.gnu.org/ml/gcc-patches/2008-05/msg00053.html
+
+ * tree-vrp.c (vrp_visit_phi_node): Cast variable I to int
+ for printing.
+ * cgraph.c (cgraph_release_function_body): Only call
+ gimple_set_body if NODE->DECL has a struct function.
+ * tree.c (make_node_stat): Do not call gimple_set_body.
+ * cp/Make-lang.in (cp/semantics.o): Add dependency on
+ $(GIMPLE_H).
+ * cp/semantics.c: Include gimple.h
+ (expand_or_defer_fn): Assert that FN has a gimple body.
+ * function.h (struct function): Add field GIMPLE_BODY.
+ * gimple.c (gimple_bodies_vec): Remove.
+ (gimple_bodies_map): Remove.
+ (gimple_set_body): Re-write to use GIMPLE_BODY in FN's
+ function object.
+ (gimple_body): Likewise.
+
+2008-05-01 Oleg Ryjkov <olegr@google.com>
+
+ http://gcc.gnu.org/ml/gcc-patches/2008-05/msg00053.html
+
+ * tree-eh.c (record_in_goto_queue, record_in_goto_queue_label):
+ New functions.
+ (maybe_record_in_goto_queue): Refactored and added support for
+ recording labels embedded in GIMPLE_CONDs.
+ (lower_catch, lower_cleanup): Fix 3 typos that were introduced
+ during the conversion to tuples.
+ (lower_eh_constructs_2): Call maybe_record_in_goto_queue for
+ GIMPLE_CONDs.
+
+2008-05-01 Rafael Espindola <espindola@google.com>
+
+ * gimple-pretty-print.c (dump_gimple_try): Print like trunk does.
+ (dump_gimple_catch): Print like trunk does.
+
+2008-05-01 Rafael Espindola <espindola@google.com>
+
+ * passes.c (gimple_verify_flow_info): Enable remaining
+ pass_rename_ssa_copies passes.
+
+2008-05-01 Rafael Espindola <espindola@google.com>
+
+ * tree-cfg.c (gimple_verify_flow_info): Handle switches with only the
+ default label.
+
+2008-04-30 Doug Kwan <dougkwan@google.com>
+
+ * cfgexpand.c (gimple_to_tree): Change code to annotate EH region
+ numbers only if numbers are greater than zero. Also propagate EH
+ region number to CALL_EXPRs nested in assignments.
+
+2008-04-29 Doug Kwan <dougkwan@google.com>
+
+ * tree-eh.c (lower_try_finally_dup_block): Call
+ copy_gimple_seq_and_replace_locals instead of gimple_seq_copy.
+ (optimize_double_finally): Add a note about replacing unsave_expr_now
+ with copy_gimple_seq_and_replace_locals.
+ * tree-inline.c (mark_local_labels_stmt, replace_locals_op,
+ replace_locals_stmt, copy_gimple_seq_and_replace_locals): New.
+ * tree-inline.h (copy_gimple_seq_and_replace_locals): New prototype.
+
+2008-04-29 Rafael Espindola <espindola@google.com>
+
+ * gimple-pretty-print.c (dump_gimple_return): Add missing space.
+ * tree-ssa-threadedge.c (simplify_control_stmt_condition): Fix type
+ of variable.
+
+2008-04-29 Rafael Espindola <espindola@google.com>
+
+ * gimple-pretty-print.c (pp_cfg_jump): add missing ";".
+
+2008-04-29 Rafael Espindola <espindola@google.com>
+
+ * gimple-pretty-print.c (dump_gimple_assign): print ";" at the end.
+ (dump_gimple_return):print ";" at the end.
+ (dump_gimple_call): print ";" at the end.
+ (dump_gimple_cond): use op_symbol_code instead of tree_code_name.
+ (pp_cfg_jump): print ";" at the end.
+
+2008-04-29 Rafael Espindola <espindola@google.com>
+
+ * ipa-cp.c (ipcp_driver): Disable.
+ * matrix-reorg.c (matrix_reorg): Comment body.
+ (gate_matrix_reorg): Disable.
+ * passes.c (init_optimization_passes): Enable first pass_merge_phi,
+ pass_ipa_cp and pass_ipa_matrix_reorg.
+
+2008-04-29 Doug Kwan <dougkwan@google.com>
+
+ * tree-eh.c (lower_catch): Fix bug of accessing sub-statements
+ using gimple_catch_handler. Fix bug of mixing up GIMPLE_GOTO and
+ GIMPLE_LABEL in statement building.
+ (lower_cleanup): Fix bug of mixing up gimple_try_clean and
+ gimple_try_eval.
+ (lower_cleanup): Use gimple codes instead of tree codes in switch
+ statement.
+ (tree-cfg.c): Add code to generate EH edges of GIMPLE_ASSIGN.
+
+2008-04-28 Diego Novillo <dnovillo@google.com>
+
+ http://gcc.gnu.org/ml/gcc-patches/2008-04/msg02051.html
+
+ * tree-ssa-phiprop.c (phiprop_insert_phi): Remove
+ OLD_ARG_CODE. Use TREE_CODE (ARG) instead.
+ Assert that NEW_VAR is a GIMPLE register.
+ (propagate_with_phi): Fix test of is_gimple_reg_type for
+ ARG.
+ Do not set subcode of USE_STMT to NOP_EXPR.
+
+2008-04-28 Doug Kwan <dougkwan@google.com>
+
+ * tree-inline.c (remap_gimple_op_r): Remove code to handle RESX_EXPR
+ region number remapping.
+ (remap_gimple_stmt): Add code to handle GIMPLE_RESX region number
+ remapping.
+
+2008-04-28 Rafael Espindola <espindola@google.com>
+
+ * cfgexpand.c (gimple_to_tree): Add support for switch stmts without
+ a default label.
+ * fold-const.c (tree_call_nonnegative_warnv_p): Remove the code
+ argument.
+ (tree_invalid_nonnegative_warnv_p): Update call to
+ tree_call_nonnegative_warnv_p.
+ * gimple.h (gimple_location_ptr): New.
+ * tree-flow.h (simplify_stmt_using_ranges): Change signature.
+ * tree-ssa-propagate.c (substitute_and_fold): Call
+ simplify_stmt_using_ranges.
+ * tree-vrp.c (struct assert_locus_d): Tuplify.
+ (switch_update): Tuplify.
+ (stmt_overflow_infinity): New.
+ (gimple_assign_nonnegative_warnv_p): New.
+ (gimple_call_nonnegative_warnv_p): New.
+ (gimple_stmt_nonnegative_warnv_p): New.
+ (gimple_assign_nonzero_warnv_p): New.
+ (gimple_stmt_nonzero_warnv_p): New.
+ (vrp_stmt_computes_nonzero): Tuplify.
+ (extract_range_basic): Tuplify.
+ (extract_range_from_expr): Tuplify. Rename to
+ extract_range_from_assignment.
+ (adjust_range_with_scev): Tuplify.
+ (vrp_var_may_overflow): Tuplify.
+ (build_assert_expr_for): Tuplify.
+ (fp_predicate): Tuplify.
+ (infer_value_range): Tuplify.
+ (dump_asserts_for): Tuplify.
+ (register_new_assert_for): Tuplify.
+ (register_edge_assert_for_2): Tuplify.
+ (register_edge_assert_for_1): Tuplify.
+ (register_edge_assert_for): Tuplify.
+ (find_conditional_asserts): Tuplify.
+ (find_switch_asserts): Tuplify.
+ (find_assert_locations): Tuplify.
+ (process_assert_insertions_for): Tuplify.
+ (process_assert_insertions): Tuplify.
+ (check_array_ref): Tuplify.
+ (search_for_addr_array): Tuplify.
+ (check_array_bounds): Tuplify.
+ (check_all_array_refs): Tuplify.
+ (remove_range_assertions): Tuplify.
+ (stmt_interesting_for_vrp): Tuplify.
+ (vrp_initialize): Tuplify.
+ (vrp_visit_assignment): Tuplify. Rename to vrp_visit_assignment_or_call.
+ (vrp_visit_cond_stmt): Tuplify.
+ (find_case_label_index): Tuplify.
+ (find_case_label_range): Tuplify.
+ (vrp_visit_switch_stmt): Tuplify.
+ (vrp_visit_stmt): Tuplify.
+ (vrp_visit_phi_node): Tuplify.
+ (simplify_div_or_mod_using_ranges): Tuplify.
+ (simplify_abs_using_ranges): Tuplify.
+ (simplify_cond_using_ranges): Tuplify.
+ (simplify_switch_using_ranges): Tuplify.
+ (simplify_stmt_using_ranges): Tuplify.
+ (simplify_stmt_for_jump_threading): Tuplify.
+ (identify_jump_threads): Tuplify.
+ (execute_vrp): Tuplify.
+ (gate_vrp): Enable.
+ * tree.h (tree_call_nonnegative_warnv_p): Remove the code argument.
+
+2008-04-28 Doug Kwan <dougkwan@google.com>
+
+ * cp/cp-gimplify.c (finish_bc_block): Tuplify.
+ (build_bc_goto): Renamed to get_bc_label. Return a label
+ only. Uupdate callers.
+ (get_bc_label): New
+ (gimplify_cp_loop): Tuplify. Also check COND for error_mark_node
+ before gimplifying it.
+ (gimplify_for_stmt): Tuplify.
+ (gimplify_while_stmt): Tuplify.
+ (gimplify_for_stmt): Tuplify.
+ (gimplify_do_stmt): Tuplify.
+ (gimplify_switch_stmt): Tuplify.
+ (cp_gimplify_omp_switch_stmt): Add temporary code to pop block
+ label stack.
+ (cp_gimplify_expr): Pass pre_p to gimplify_while_stmt,
+ gimplify_do_stmt and gimplify_switch_stmt. Tuplify
+ gimplification of CONTINUE_STMT and BREAK_STMT.
+
+2008-04-26 Rafael Espindola <espindola@google.com>
+
+ * gimple.c (gimple_build_assign_with_ops): Don't set SSA_NAME_DEF_STMT.
+ * gimple.h (gimple_assign_set_lhs): Set SSA_NAME_DEF_STMT.
+ (gimple_call_set_lhs): Set SSA_NAME_DEF_STMT.
+ * omp-low.c (expand_parallel_call): Don't set SSA_NAME_DEF_STMT if not
+ needed.
+ (expand_omp_for_generic): Same.
+ (expand_omp_for_static_nochunk): Same.
+ (expand_omp_for_static_chunk): Same.
+ (expand_omp_sections): Same.
+ (expand_omp_atomic_mutex): Same.
+ * predict.c (strip_builtin_expect): Same.
+ * tree-cfg.c (gimple_merge_blocks): Same.
+ * tree-inline.c (remap_ssa_name): Same.
+ (setup_one_parameter): Same.
+ * tree-predcom.c (replace_ref_with): Same.
+ (replace_ref_with): Same.
+ (initialize_root_vars_lm): Same.
+ (reassociate_to_the_same_stmt): Same.
+ * tree-scalar-evolution.c (scev_const_prop): Same.
+ * tree-ssa-loop-im.c (rewrite_reciprocal): Same.
+ * tree-ssa-loop-ivopts.c (rewrite_use_nonlinear_expr): Same.
+ * tree-ssa-loop-manip.c (create_iv): Same.
+ * tree-ssa-math-opts.c (execute_cse_sincos_1): Same.
+ * tree-ssa-phiopt.c (minmax_replacement): Same.
+ (abs_replacement): Same.
+
+2008-04-25 Diego Novillo <dnovillo@google.com>
+
+ http://gcc.gnu.org/ml/gcc-patches/2008-04/msg01965.html
+
+ * gimplify.c (annotate_all_with_location_after): New.
+ (gimplify_expr): Call it.
+
+2008-04-25 Diego Novillo <dnovillo@google.com>
+
+ Merge with mainline @134692.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2008-04-25 Doug Kwan <dougkwan@google.com>
+
+ * tree-inline.c (expand_call_inline): Save old call statement
+ and use it to look up correct EH region.
+
+2008-04-24 Doug Kwan <dougkwan@google.com>
+
+ * Makefile.in (STRICT_WARN): Remove -Wno-format and
+ -Wno-missing-format-attribute.
+ * gimplify.c (gimple_pop_condition): Remove redundant and incorrect
+ gimple_seq_free.
+ (gimplify_init_ctor_eval_range): Add a fall-through label for
+ GIMPLE_COND statement.
+
+2008-04-25 Rafael Espindola <espindola@google.com>
+
+ * tree-ssa-dom.c (avail_expr_eq): Return false if the hashes don't
+ match.
+
+2008-04-24 Oleg Ryjkov <olegr@google.com>
+
+ * gimplify.c (gimplify_expr): Fix the assertion that verifies validity
+ of parameters.
+ * tree-inline.c (estimate_num_insns): Handle
+ GIMPLE_CHANGE_DYNAMIC_TYPE.
+ * tree-cfg.c (verify_types_in_gimple_stmt): Likewise.
+
+2008-04-24 Rafael Espindola <espindola@google.com>
+
+ * tree-ssa-dom.c (initialize_hash_element): Fix the type of the code
+ variable.
+
+2008-04-23 Rafael Espindola <espindola@google.com>
+
+ * omp-low.c (gate_lower_omp): Return 0.
+ * passes.c (init_optimization_passes): Enable all passes whose
+ corresponding dump options are used in the testsuite.
+ * tree-loop-distribution.c (tree_loop_distribution): Comment body.
+ (gate_tree_loop_distribution): Return 0.
+ * tree-ssa-forwprop.c (tree_ssa_forward_propagate_single_use_vars):
+ Comment body.
+ (gate_forwprop): Return 0.
+ * tree-ssa-loop.c (gate_tree_ssa_loop_unswitch): Return 0.
+ (gate_tree_vectorize): Return 0.
+ (gate_tree_ssa_loop_ivcanon): Return 0.
+ (tree_ssa_empty_loop): Return 0.
+ (gate_tree_complete_unroll): Return 0.
+ * tree-ssa-pre.c (gate_fre): Return 0.
+ * tree-ssa-reassoc.c (execute_reassoc): Comment body.
+ (gate_tree_ssa_reassoc): Return 0.
+ * tree-stdarg.c (gate_optimize_stdarg): Return 0.
+ (execute_optimize_stdarg): Comment body.
+ * tree-vrp.c (execute_vrp): Comment body.
+ (gate_vrp): Return 0.
+
+2008-04-22 Aldy Hernandez <aldyh@redhat.com>
+
+ * omp-low.c (lower_omp_parallel): Add new argument to
+ gimple_omp_parallel_set_combined_p.
+ (lower_omp_1): Remove debugging code.
+ * gimple.h (gimple_omp_parallel_combined_p): Add new argument.
+
+2008-04-22 Rafael Espindola <espindola@google.com>
+
+ Merge with mainline @134552.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2008-04-21 Doug Kwan <dougkwan@google.com>
+
+ * tree-ssa-phiopt.c (FILE): Uncomment all previously disabled code.
+ (tree_ssa_phiopt): Remove FIXME and re-enable code.
+ (tree_ssa_cs_elim): Remove FIXME and re-enable code.
+ (tree_ssa_phiopt_worker): Tuplify.
+ (replace_phi_edge_with_variable): Tuplify.
+ (conditional_replacement): Tuplify and simplify optimization logic.
+ Construct a boolean tree and let fold and force_gimple_operand_gsi
+ do optimization and code genaration.
+ (value_replacement): Tuplify.
+ (minmax_replacement): Tuplify.
+ (abs_replacement): Tuplify.
+ (nt_init_block): Tuplify.
+ (cond_store_replacement): Tuplify.
+ * gimple.h (gimple_seq_singleton_p): Fix empty sequence bug.
+ * passes.c (init_optimization_passes): Re-enable pass_cselim
+ and pass_phiopt.
+
+2008-04-21 Diego Novillo <dnovillo@google.com>
+
+ * tree.c (make_node_stat): Clear gimple_body() for newly
+ created FUNCTION_DECLs.
+ * tree-gimple.c (rhs_predicate_for): Move to gimplify.c.
+ * tree-gimple.h (rhs_predicate_for): Remove declaration.
+ * gimple-pretty-print.c (dump_gimple_assign): Add support
+ for showing volatile operands.
+ (dump_gimple_call): Likewise.
+ Add support for showing __builtin_va_arg_pack, static
+ chains, return slot optimized and tail calls.
+ (dump_gimple_phi): Remove code to print memory symbols.
+ * gimplify.c (is_gimple_formal_tmp_or_call_rhs): New.
+ (is_gimple_mem_or_call_rhs): New.
+ (rhs_predicate_for): Call them.
+ (internal_get_tmp_var): Use is_gimple_formal_tmp_or_call_rhs as
+ the gimplification predicate.
+ Use the last statement in *PRE_P to get the temporary to
+ be updated when in SSA form.
+ (gimplify_bind_expr): Clear out *EXPR_P before returning.
+ (gimplify_call_expr): Do not build a GIMPLE_CALL if
+ WANT_VALUE is true.
+ Call gimple_build_call_from_tree if WANT_VALUE is false.
+ Remove local variable ARGS.
+ (gimplify_modify_expr): If after gimplification *FROM_P
+ is a CALL_EXPR, create a GIMPLE_CALL instead of a
+ GIMPLE_ASSIGN.
+ Document why the gimplification of the RHS should accept
+ CALL_EXPRs.
+ (gimplify_expr): Document where the generated statement
+ is stored.
+ Accept is_gimple_formal_tmp_or_call_rhs and
+ is_gimple_mem_or_call_rhs as gimplification predicates.
+ When gimplifying statements, clear out *EXPR_P before
+ returning.
+ When generating an rvalue, call is_gimple_formal_tmp_or_call_rhs
+ to test *EXPR_P.
+ * tree-dfa.c (mark_symbols_for_renaming): Remove
+ ATTRIBUTE_UNUSED.
+ * tree-flow.h (stmt_references_memory_p): Remove.
+ * gimple.c (gimple_build_call_from_tree): New.
+ * gimple.h (struct gimple_statement_with_memory_ops): Add
+ bitfield references_memory_p.
+ (gimple_build_call_from_tree): Declare.
+ (gimple_references_memory_p): Rename from
+ stmt_references_memory_p. Move here. Update all users.
+ (gimple_set_references_memory): New.
+ (gimple_assign_set_rhs1): When the assignment has more
+ than one operand on the RHS, assert that the operands are
+ gimple values.
+ (gimple_assign_set_rhs2): Assert that the operand is a
+ gimple value.
+ (gimple_call_set_return_slot_opt): Fix mask clearing.
+ (gimple_call_set_from_thunk): Likewise.
+ (gimple_call_set_va_arg_pack): Likewise.
+ * tree-cfg.c (dump_function_to_file): Do not indent when
+ doing a GIMPLE dump.
+ * tree-ssa-operands.c (add_virtual_operand): Call
+ gimple_set_references_memory.
+ (get_addr_dereference_operands): Likewise.
+ (get_tmr_operands): Likewise.
+ (maybe_add_call_clobbered_vops): Likewise.
+ (get_asm_expr_operands): Likewise.
+ (parse_ssa_operands): Likewise.
+ (build_ssa_operands): Likewise.
+ (stmt_references_memory_p): Remove.
+
+2008-04-21 Rafael Espindola <espindola@google.com>
+
+ Cherry pick http://gcc.gnu.org/ml/gcc-patches/2008-04/msg01213.html
+
+ * params.def (PARAM_MAX_FIELDS_FOR_FIELD_SENSITIVE): Set default
+ to zero, thus disable creation of SFTs.
+ * gcc.dg/tree-ssa/salias-1.c: Remove.
+ * gcc.dg/tree-ssa/pr26421.c: Adjust pattern.
+ * gcc.dg/tree-ssa/alias-15.c: Likewise.
+ * gcc.dg/tree-ssa/ssa-lim-3.c: Run at -O2.
+
+2008-04-20 Zdenek Dvorak <ook@ucw.cz>
+
+ * passes.c (init_optimization_passes): Enable pass_dce_loop.
+
+2008-04-20 Zdenek Dvorak <ook@ucw.cz>
+
+ * tree-data-ref.c (split_constant_offset_1): Use POINTER_PLUS_EXPR
+ for pointer addition.
+ (split_constant_offset): Set VAR to EXP before conversions are
+ stripped, when no offset is removed. Handle chrec_dont_know.
+ * tree-predcom.c: Tuplified.
+ * passes.c (init_optimization_passes): Enable pass_predcom.
+
+2008-04-18 Aldy Hernandez <aldyh@redhat.com>
+
+ * omp-low.c (lower_rec_input_clauses): Remove fixme and
+ ATTRIBUTE_UNUSED.
+ (lower_lastprivate_clauses): Same.
+ (lower_reduction_clauses): Same.
+ (lower_copyprivate_clauses): Same.
+ (lower_send_clauses): Same.
+ (lower_send_shared_vars): Same.
+ (maybe_catch_exception): Convert to tuples.
+ (lower_omp_sections): Same.
+ (lower_omp_single_simple): Same.
+ (lower_omp_single_copy): Same.
+ (lower_omp_single): Same.
+ (lower_omp_master): Same.
+ (lower_omp_ordered): Same.
+ (lower_omp_critical): Same.
+ (lower_omp_for_lastprivate): Same.
+ (lower_omp_for): Same.
+ (check_combined_parallel): Same.
+ (lower_omp_parallel): Same.
+ (lower_omp_1): Same.
+ (execute_lower_omp): Enable.
+ * gimple-dummy.c: Remove dummy functions for lower_omp_*.
+ * gimple-low.c (lower_omp_directive): Convert to tuples.
+ (lower_stmt): Remove fixme.
+ * gimple.h (gimple_seq_alloc_with_stmt): New.
+ (gimple_omp_section_set_last): New.
+ (gimple_omp_parallel_set_combined_p): New.
+ (gimple_bind_add_stmt): New.
+ (gimple_bind_add_seq): New.
+ * tree-cfg.c (verify_node_sharing): Fix typo in comment.
+
+2008-04-17 Oleg Ryjkov <olegr@google.com>
+
+ * Reverting forwprop patch.
+
+ 2008-04-16 Oleg Ryjkov <olegr@google.com>
+
+ * tree-ssa-forwprop.c (get_prop_dest_stmtm get_prop_source_stmt,
+ can_propagate_from, remove_prop_source_from_use,
+ tidy_after_forward_propagate_addr,
+ forward_propagate_addr_into_variable_array_index,
+ forward_propagate_addr_expr_1, forward_propagate_addr_expr,
+ forward_propagate_comparison, simplify_not_neg_expr,
+ simplify_switch_expr,
+ tree_ssa_forward_propagate_single_use_variables): Tuplified.
+ (forward_propagate_into_cond): Tuplified and moved some functionality
+ into forward_propagate_into_cond_gimple.
+ (rhs_to_tree, forward_propagate_into_cond_gimple): New functions.
+ * passes.c (init_optimization_passes): Enabled pass_forwprop.
+ * tree-cfg.c (find_taken_edge_cond_expr): Fixed comment.
+
+2008-04-16 Oleg Ryjkov <olegr@google.com>
+
+ * tree-ssa-forwprop.c (get_prop_dest_stmtm get_prop_source_stmt,
+ can_propagate_from, remove_prop_source_from_use,
+ tidy_after_forward_propagate_addr,
+ forward_propagate_addr_into_variable_array_index,
+ forward_propagate_addr_expr_1, forward_propagate_addr_expr,
+ forward_propagate_comparison, simplify_not_neg_expr,
+ simplify_switch_expr,
+ tree_ssa_forward_propagate_single_use_variables): Tuplified.
+ (forward_propagate_into_cond): Tuplified and moved some functionality
+ into forward_propagate_into_cond_gimple.
+ (rhs_to_tree, forward_propagate_into_cond_gimple): New functions.
+ * passes.c (init_optimization_passes): Enabled pass_forwprop.
+ * tree-cfg.c (find_taken_edge_cond_expr): Fixed comment.
+
+2008-04-16 Doug Kwan <dougkwan@google.com>
+
+ * Makefile.in (STRICT_WARN): Disable -Wmissing-format-attribute
+ and -Wformat temporarily for bootstrapping.
+ * lambda-code.c (invariant_in_loop_and_outer_loops): Comment out
+ to avoid defined-and-not-used warning.
+ * tree-cfg.c (gather_blocks_in_sese_region): Comment out to avoid
+ defined-and-not-used warning.
+
+2008-04-16 Doug Kwan <dougkwan@google.com>
+
+ * Makefile.in (GTFILES): Add back ipa-reference.h and ipa-reference.c.
+ * gimple-dummy.c (memory_identifier_string): Remove.
+ * ipa-cp.c (constant_val_insert): Tuplify.
+ * ipa-prop.c (File): Uncomment all previously disabled code.
+ (ipa_method_modify_stmt): Tuplify.
+ (ipa_method_compute_modify): Tuplify.
+ (ipa_callsite_tree): Renamed to ipa_callsite_stmt. Update callers.
+ (ipa_callsite_stmt): New.
+ (ipa_callsite_compute_count): Tuplify.
+ (ipa_callsite_compute_param): Tuplify.
+ * ipa-reference.c (File): Uncomment all previously disabled code.
+ (get_asm_stmt_operands): Tuplify.
+ (check_call): Tuplify. Also add code to handle assignment of
+ returned value.
+ (scan_for_static_refs): Remove. Tuplify body and split into two
+ new functions scan_stmt_for_static_refs and scan_op_for_static_refs.
+ Update callers.
+ (scan_stmt_for_static_refs): New. Split from scan_for_static_refs.
+ (scan_op_for_static_refs): New. Split from scan_for_static_refs.
+ (analyze_variable): Update walk_tree call.
+ (analyze_function): Tuplify.
+ * passes.c (init_optimization_passes): Re-enable pass_ipa_reference.
+ * tree-flow.h (struct function_ann_d): Uncomment field
+ ipa_reference_vars_info.
+
+2008-04-15 Doug Kwan <dougkwan@google.com>
+
+ * tree-eh.c (operation_could_trap_p): Fix filtering logic.
+
+2008-04-15 Bill Maddox <maddox@google.com>
+
+ * tree-ssa-dom.c: (degenerate_phi_result, remove_stmt_or_phi,
+ get_rhs_or_phi_arg, get_lhs_or_phi_result, propagate_rhs_into_lhs,
+ eliminate_const_or_copy, eliminate_degenerate_phis_1,
+ eliminate_degenerate_phis): Convert to tuples.
+ * passes.c (init_optimization_passes): Enable pass_phi_only_cprop.
+
+2008-04-15 Oleg Ryjkov <olegr@google.com>
+
+ * tree-ssa-dom.c (record_const_or_copy): Moving a variable declaration to
+ the top of a block.
+
+2008-04-15 Doug Kwan <dougkwan@google.com>
+
+ * tree-ssa-sink.c (File): Uncomment all previously disabled code.
+ (find_bb_for_arg): Tuplify.
+ (all_immediate_uses_sample_place): Tuplify.
+ (nearest_common_dominator_of_uses): Tuplify.
+ (statement_sink_location): Tuplify. Remove parameter tobb and update
+ caller.
+ (sink_code_in_bb): Tuplify.
+ * passes.c (init_optimization_passes): Re-enable pass_sink_code.
+
+2008-04-14 Bill Maddox <maddox@google.com>
+
+ * tree-ssa-threadupdate.c (remove_ctrl_stmt_and_useless_edge,
+ create_edge_and_update_destination_phis, redirection_block_p):
+ Convert to tuples.
+ * tree.c (iterative_hash_exprs_commutative): New function.
+ * tree.h (iterative_hash_exprs_commutative): Declare.
+ * tree-ssa_dom.c (enum expr_kind, struct hashable_expr,
+ struct cond_equivalence): New types.
+ (struct edge_info): Use struct cond_equivalence.
+ (avail_exprs_stack): Stack of expr_hash_elt*, not expressions.
+ (stmts_to_rescan): Use type gimple for statements.
+ (struct expr_hash_elt): Represent statement RHS with hashable_expr,
+ not a tree. Add unique stamp to each entry for efficient and reliable
+ element removal.
+ (struct eq_expr_value): Delete unused type.
+ (initialize_hash_element): Convert to tuples. Now applies
+ only to statements.
+ (initialize_expr_from_cond, initialize_hash_element_from_expr):
+ New functions. Replace former functionality of initialize_hash_element
+ for conditions presented as trees.
+ (hashable_expr_equal_p, iterative_hash_hashable_expr): New functions.
+ (print_expr_hash_elt): New function.
+ (free_expr_hash_elt): New function.
+ (tree_ssa_dominator_optimize): Convert to tuples
+ (canonicalize_comparison): Convert to tuples.
+ (remove_local_expressions_from_table): Use new avail_exprs_stack
+ representation. Add optional extra diagnostic details.
+ (simplify_stmt_for_jump_threading, dom_thread_across_edge,
+ dom_opt_finalize_block): Convert to tuples.
+ (record_cond, build_and_record_new_cond): Convert to tuples.
+ Use new hashable_expr type. Extra diagnostic details.
+ (record_const_or_copy_1): Extra diagnostic details.
+ (record_const_or_copy): Add assertion.
+ (simple_iv_increment_p, cprop_into_successor_phis, record_edge_info):
+ Convert to tuples.
+ (eliminate_redundant_computations): Convert to tuples.
+ Additional diagnostic details.
+ (gimple_assign_unary_useless_conversion_p): New function.
+ (record_equivalences_from_statement): Convert to tuples.
+ Additional diagnostic details.
+ (cprop_operand, cprop_into_stmt): Convert to tuples.
+ (optimize_stmt): Convert to tuples.
+ (lookup_avail_expr): Use hashable_expr. Additional diagnostic details.
+ (avail_expr_hash, avail_expr_eq): Use hashable_expr.
+ * tree-ssa-copy.c (may_propagate_copy_into_stmt,
+ propagate_tree_value_into_stmt): New functions.
+ * tree-flow.h: (may_propagate_copy_into_stmt,
+ propagate_tree_value_into_stmt): Declare.
+ (thread_across_edge): Change declaration of callback to accept a
+ gimple statement.
+ * gimple.c (gimple_call_flags): Declare argument as a constant.
+ (gimple_has_side_effects): Declare argument as a constant.
+ Examine function arguments for side-effects.
+ (gimple_rhs_has_side_effects): New function.
+ * gimple.h (gimple_call_flags): Declare argument as a constant.
+ (gimple_has_side_effects): Declare argument as a constant.
+ (gimple_rhs_has_side_effects): Declare new function.
+ (is_gimple_assign): New inline function.
+ (gimple_switch_index_ptr): New function.
+ * passes.c (init_optimization_passes): Enable pass_dominator.
+ * tree-ssa_threadedge.c (potentially_threadable_block,
+ lhs_of_dominating_assert, record_temporary_equivalences_from_phis):
+ Convert to tuples.
+ (fold_assignment_stmt): New function.
+ (record_temporary_equivalences_from_stmts_at_dest,
+ simplify_control_stmt_condition, thread_across_edge): Convert to tuples.
+
+2008-04-14 Doug Kwan <dougkwan@google.com>
+
+ * c-typeck.c (convert_for_assignment): Call c_common_unsigned_type
+
+2008-04-14 Doug Kwan <dougkwan@google.com>
+
+ * gimple-iterator.c (gsi_move_to_bb_end): Use gsi_last_bb
+ instead of calling both gsi_last and bb_seq.
+ * passes.c (init_optimization_passes): Re-eanble second tail-recursion
+ pass.
+
+2008-04-14 Doug Kwan <dougkwan@google.com>
+
+ * tree-nrv.c (dest_safe_for_nrv_p): Uncomment.
+ (execute_return_slot_opt): Tuplify.
+ * passes.c (init_optimization_passes): Re-enable pass_return_slot.
+
+2008-04-14 Aldy Hernandez <aldyh@redhat.com>
+
+ * tree-cfg.c (gimple_can_merge_blocks_p): Fix typo.
+ * omp-low.c (maybe_lookup_ctx): Uncomment and set ATTRIBUTE_UNUSED.
+ (lower_lastprivate_clauses): Same.
+ (lower_reduction_clauses): Same.
+ (lower_send_clauses): Same.
+ (expand_omp_for_generic): Uncomment and convert for tuples.
+ (expand_omp_for): Remove fixme.
+ (expand_omp_sections): Same.
+ (lower_omp_parallel): Partially convert for tuples.
+ (lower_omp_regimplify_p): Rename from lower_omp_2.
+ (lower_omp_1): Convert for tuples.
+ (lower_omp): Same.
+ (gimple-dummy.c): Add lower_omp_parallel, lower_omp_for,
+ lower_omp_sections, lower_omp_single, lower_omp_master,
+ lower_omp_ordered, lower_omp_critical.
+
+2008-04-13 Diego Novillo <dnovillo@google.com>
+
+ * tree-cfg.c (need_fake_edge_p): Initialize CALL_FLAGS.
+
+2008-04-12 Rafael Espindola <espindola@google.com>
+
+ Merge with mainline @134237.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2008-04-13 Rafael Espindola <espindola@google.com>
+
+ * config/extensions.m4: Add. Was missing from previous merge.
+
+2008-04-12 Rafael Espindola <espindola@google.com>
+
+ Merge with mainline @133860.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2008-04-11 Oleg Ryjkov <olegr@google.com>
+
+ * tree-sra.c (scalarize_use): Moving a variable declaration to
+ the top of a block.
+
+2008-04-11 Oleg Ryjkov <olegr@google.com>
+
+ * tree-sra.c (insert_edge_copies_seq): Removed unused variable.
+
+2008-04-11 Oleg Ryjkov <olegr@google.com>
+
+ * tree-sra.c (sra_build_assignment): Tuplified.
+ (mark_all_v_defs): Removed.
+ (mark_all_v_defs_seq, mark_all_v_defs_stmt): New functions.
+ (sra_walk_expr): Tuplified.
+ (sra_walk_tree_list): Removed.
+ (sra_walk_call_expr, sra_walk_gimple_asm,
+ sra_walk_gimple_modifY_stmt, ): Tuplified and renamed.
+ (sra_walk_gimple_call, sra_walk_gimple_asm,
+ sra_walk_gimple_assign): New names for tuplified functions.
+ (sra_walk_function, find_candidates_for_sra, scan_use, scan_copy,
+ scan_ldst, instantiate_element, decide_instantiations,
+ mark_all_v_defs_1, sra_build_assignment, sra_build_bf_assignment,
+ sra_build_elt_assignment, generate_copy_inout,
+ generate_element_copy, generate_element_zero,
+ generate_one_element_init, generate_element_init_1): Tuplified.
+ (insert_edge_copies): Removed.
+ (insert_edge_copies_seq): New function.
+ (sra_insert_before, sra_insert_after, sra_replace,
+ sra_explode_bitfield_assignment, sra_sync_for_bitfield_assignment,
+ scalarize_use, scalarize_copy, scalarize_init, mark_no_trap,
+ scalarize_ldst, scalarize_parms, scalarize_function): Tuplified.
+ (tree_sra, tree_sra_early): Enabled
+ (sra_init_cache): Removed extra space.
+ * tree-flow.h (insert_edge_copies_seq): New declaration.
+ * gimple.h (gimple_asm_input_op_ptr, gimple_asm_output_op_ptr,
+ gimple_return_retval_ptr): New functions.
+ * passes.c (init_optimization_passes): Enabled pass_sra,
+ pass_early_sra.
+
+2008-04-11 Doug Kwan <dougkwan@google.com>
+
+ * ipa-pure-const.c (get_asm_expr_operands): Tuplify.
+ (get_asm_expr_operands): Tuplify.
+ (check_call): Tuplify. Add code to handle return value assignment.
+ (scan_function): Remove. Original code is tuplified and split into
+ two new functions scan_function_op and scan_function_stmt.
+ (scan_function_op): New function.
+ (scan_function_stmt): New function.
+ (analyze_function): Tuplify and re-enable previously disabled code.
+ * passes.c (init_optimization_passes): Re-enable pass_ipa_pure_const.
+
+2008-04-11 Oleg Ryjkov <olegr@google.com>
+
+ * builtins.c (fold_call_stmt): Return the proper value.
+ * tree-ssa-ccp.c (maybe_fold_stmt_addition): Modify arguments to
+ allow this function to be called on a GIMPLE_ASSIGN.
+ (fold_stmt_r): Update the call to maybe_fold_stmt_addition.
+ (fold_gimple_assign): Manually call maybe_fold_stmt_addition to
+ fold a POINTER_PLUS_EXPR.
+
+2008-04-11 Doug Kwan <dougkwan@google.com>
+
+ * tree-ssa-phiprop.c (File): Uncomment all previously disabled code.
+ (struct phiprop_d): Change type of vop_stmt to gimple.
+ (phivn_valid_p): Tuplify.
+ (phiprop_insert_phi): Tuplify.
+ (propagate_with_phi): Tuplify.
+ (tree_ssa_phiprop_1): Tuplify.
+ (tree_ssa_phiprop): Tuplify.
+ * passes.c (init_optimization_passes): Re-enable pass_phiprop.
+
+2008-04-11 Rafael Espindola <espindola@google.com>
+
+ * tree-ssa-math-opts.c (execute_cse_sincos_1): fix warning.
+
+2008-04-10 Diego Novillo <dnovillo@google.com>
+
+ http://gcc.gnu.org/ml/gcc-patches/2008-04/msg00913.html
+
+ * ipa-inline.c (cgraph_clone_inlined_nodes): Change uses
+ of DECL_SAVED_TREE with gimple_body.
+ (cgraph_decide_inlining_incrementally): Likewise.
+ * gimple-iterator.c (gsi_insert_seq_before_without_update):
+ Do nothing if SEQ is NULL.
+ (gsi_insert_seq_after_without_update): Likewise.
+ * tree-ssa-live.c (mark_all_vars_used_1): Do not handle
+ EXPR trees.
+ (remove_unused_locals): Mark the gimple_block of every
+ statement as used.
+ * tree-inline.c (remap_gimple_stmt): Forward declare.
+ (remap_decls): Tidy comments.
+ (remap_gimple_seq): New.
+ (copy_gimple_bind): New.
+ (remap_gimple_stmt): Call it.
+ Handle High GIMPLE statements.
+ (copy_bb): Regimplify operands on COPY_GSI instead of
+ GSI.
+ (copy_cfg_body): Tidy.
+ (copy_generic_body): Remove unused function.
+ (clone_body): Tuplify.
+ * c-common.c (c_warn_unused_result): Remove assertion for
+ FUNCTION_TYPE.
+ * gimple.c (gimple_seq_copy): Rename from
+ gimple_seq_deep_copy. Update all users.
+ (walk_gimple_stmt): Assert that STMT has no substatements
+ in the default case.
+ (gimple_copy_1): Merge into gimple_copy.
+ (gimple_copy): Always do deep copying.
+ Handle statements with substatements.
+ (gimple_shallow_copy): Remove unused function.
+ (gimple_deep_copy): Remove. Update all users.
+ * gimple.h: Tidy comments and structure fields
+ everywhere.
+ (gimple_has_substatements): New.
+ (walk_stmt_fn): Change last argument to struct walk_stmt_info *.
+ Update all users.
+
+2008-04-10 Oleg Ryjkov <olegr@google.com>
+
+ * tree.h (struct tree_base): Added a new flag default_def_flag.
+ (SSA_NAME_IS_DEFAULT_DEF): Changed to use the new flag.
+
+2008-04-08 Doug Kwan <dougkwan@google.com>
+
+ * gimplify.c (gimple_push_cleanup): Initialize cleanup_stmts to NULL.
+
+2008-04-08 Doug Kwan <dougkwan@google.com>
+
+ * tree-tailcall.c (struct tailcall): Remove call_block and replace
+ call_bsi by call_gsi.
+ (independent_of_stmt_p): Change type of parameter 'at' to GIMPLE and
+ change all tree using code to GIMPLE using equivalent.
+ Remove parameter block_stmt_iterator type parameter bsi with
+ gimple_stmt_iterator type parameter gsi. Replace uses of bsi with
+ that of gsi in function body as appropriate.
+ (process_assignment): Remove parameter 'ass' and change type of
+ parameter 'stmt' to GIMPLE. Change all tree using code to GIMPLE
+ using equivalent.
+ (propagate_through_phis, eliminate_tail_call, optimize_tail_call):
+ Change all tree using code to GIMPLE using equivalent.
+ (find_tail_calls): Change all tree using code to GIMPLE using
+ equivalent. Remove code that handles GIMPLE_MODIFY_STMT containing
+ a CALL_EXPR.
+ (add_successor_phi_arg, adjust_return_value_with_ops,
+ update_accumulator_with_ops, adjust_accumulator_values,
+ create_tailcall_accumulator): New functions from refactoring of
+ duplicated logic.
+ (adjust_accumulator_values, adjust_return_value): Refactor.
+ (tree_optimize_tail_calls_1): Refactor and change all tree using code
+ to GIMPLE using equivalent. Remove code to reverse phi list.
+ * passes.c (init_optimization_passes): Re-enable pass_tail_recursion
+ and pass_tail_calls.
+
+2008-04-04 Doug Kwan <dougkwan@google.com>
+
+ * tree-ssa-math-opts.c (struct occurrence): Change field type of
+ recip_def_stmt to gimple.
+ (is_division_by): Tuplify.
+ (insert_reciprocals): Tuplify.
+ (replace_reciprocals): Tuplify.
+ (execute_cse_reciprocals_1): Tuplify.
+ (execute_cse_reciprocals): Tuplify.
+ (maybe_record_sincos): Use vector of gimples instead of vector of
+ trees.
+ (execute_cse_sincos_1): Tuplify. When adjusting recorded old call
+ sites, generate new gimple assign statements and remove old gimple
+ call statements.
+ (execute_cse_sincos): Tuplify.
+ (execute_convert_to_rsqrt): Tuplify.
+ * passes.c (init_optimization_passes): Enable pass_cse_sincos,
+ pass_cse_reciprocals and pass_convert_to_rsqrt.
+
+2008-04-04 Aldy Hernandez <aldyh@redhat.com>
+
+ * omp-low.c (gimple_build_cond_empty): New.
+ (expand_parallel_call): Convert COND_EXPR to GIMPLE_COND.
+ (expand_omp_for_generic): Same.
+ (expand_omp_for_static_nochunk): Same.
+ (expand_omp_for_static_chunk): Same.
+ (expand_omp_atomic_pipeline): Same.
+
+2008-04-04 Diego Novillo <dnovillo@google.com>
+
+ http://gcc.gnu.org/ml/gcc-patches/2008-04/msg00413.html
+
+ * tree-ssa-loop-im.c (movement_possibility): Return
+ MOVE_IMPOSSIBLE if that statement makes no assignment.
+ * tree-complex.c (get_component_ssa_name): Fix comment.
+ (set_component_ssa_name): Assert that COMP's definition
+ is LAST.
+ * cgraph.c (cgraph_update_edges_for_call_stmt): Tuplify.
+ (dump_cgraph_node): Likewise.
+ * tree.c (auto_var_in_fn_p): Fix comment.
+ * cgraphunit.c (verify_cgraph_node): Remove tuples hack
+ that avoided verifying nodes.
+ * gimple-pretty-print.c (dump_gimple_asm): Show the
+ volatile flag.
+
+ * gimple-dummy.c (optimize_inline_calls): Remove.
+ (tree_function_versioning): Remove.
+ (tree_versionalbe_function_p): Remove.
+ * ipa-inline.c (cgraph_clone_inlined_bodies): Re-format.
+ (cgraph_decide_inlining): Re-format.
+ (cgraph_decide_inlining_incrementally): Re-format.
+ (pass_ipa_inline): Re-format.
+ * gimplify.c (gimplify_call_expr): Carry all the
+ CALL_EXPR flags to the newly created GIMPLE_CALL.
+ (gimplify_asm_expr): Carry ASM_VOLATILE_P and ASM_INPUT_P
+ over to the new GIMPLE_ASM.
+ * tree-dfa.c (find_new_referenced_vars): Change argument
+ to gimple. Update all callers.
+ * cfgexpand.c (set_expr_location_r): New private.
+ (gimple_to_tree): Call it.
+ Set ASM_VOLATILE_P and ASM_INPUT_P for ASM_EXPRs.
+ Carry flags from GIMPLE_CALL for CALL_EXPRs.
+ Set TREE_BLOCK on the newly created expression.
+ * tree-inline.c: Tuplify.
+ * tree-inline.h: Tuplify.
+ * tree-optimize.c (execute_fixup_cfg): Tuplify.
+ * gimple.c (gimple_build_call_vec): Change second
+ argument type to VEC(tree, heap). Update all callers.
+ (gimple_build_assign_with_ops): If the LHS is an
+ SSA_NAME, set SSA_NAME_DEF_STMT on it.
+ (walk_gimple_seq): Change return type to gimple. Update
+ all users.
+ If walk_gimple_stmt returned a value, store it in
+ WI->CALLBACK_RESULT.
+ (walk_gimple_op): Walk gimple_call_chain_ptr() and
+ gimple_call_fn_ptr() for GIMPLE_CALL.
+ (walk_gimple_stmt): Add new local HANDLED_OPS.
+ If callback_stmt() sets HANDLED_OPS, return its return
+ value.
+ If any call to walk_gimple_seq returns a non-NULL value,
+ return WI->CALLBACK_RESULT.
+ (gimple_copy_1): New function.
+ (gimple_deep_copy): Rename from gimple_copy. Update all
+ users.
+ Call gimple_copy_1.
+ (gimple_shallow_copy): New.
+ (gimple_regimplify_operands): New.
+ * gimple.h (GF_ASM_INPUT): Define.
+ (GF_ASM_VOLATILE): Define.
+ (GF_CALL_CANNOT_INLINE): Define.
+ (GF_CALL_FROM_THUNK): Define.
+ (GF_CALL_RETURN_SLOT_OPT): Define.
+ (GF_CALL_VA_ARG_PACK): Define.
+ (gimple_stmt_iterator): Move earlier in the file.
+ (gimple_omp_return_nowait_p): Fix return expression.
+ (gimple_omp_section_last_p): Likewise.
+ (gimple_omp_parallel_combined_p): Likewise.
+ (gimple_call_noreturn_p): Likewise.
+ (gimple_call_nothrow_p): Likewise.
+ (gimple_asm_volatile_p): Likewise.
+ (gimple_try_catch_is_cleanup): Likewise.
+ (gimple_assign_set_rhs1): assert that RHS is a gimple
+ operand.
+ (is_gimple_call): New. Change all users that tested
+ gimple_code() == GIMPLE_CALL.
+ (gimple_call_fn_ptr): New.
+ (gimple_call_chain_ptr): New.
+ (gimple_call_set_chain): Accept NULL values for CHAIN.
+ (gimple_call_set_tail): Add bool argument specifying the
+ value of the flag. Update all users.
+ (gimple_asm_set_volatile): Likewise.
+ (gimple_call_set_cannot_inline): Rename from
+ gimple_call_mark_uninlinable. Add bool argument
+ specifying the value of the flag. Update all users.
+ (gimple_call_set_return_slot_opt): New.
+ (gimple_call_return_slot_opt_p): New.
+ (gimple_call_set_from_thunk): New.
+ (gimple_call_from_thunk_p): New.
+ (gimple_call_va_arg_pack_p): New.
+ (gimple_call_copy_flags): New.
+ (gimple_asm_set_input): New.
+ (gimple_asm_input_p): New.
+ (gimple_asm_clear_volatile): Remove.
+ (walk_stmt_fn): Add second argument bool *. Update all
+ users.
+ (struct walk_stmt_info): Add new field callback_result.
+ * tree-cfg.c (gimple_split_block): Tuplify.
+ (gimple_block_ends_with_condjump_p): Tuplify.
+ (need_fake_edge_p): Tuplify.
+ (gimple_flow_call_edges_add): Tuplify.
+ (gimple_purge_dead_abnormal_call_edges): Tuplify.
+ (gimple_purge_dead_eh_edges): Remove ATTRIBUTE_UNUSED.
+ (gimple_cfg_hooks): Add gimple_block_ends_with_condjump_p
+ and gimple_flow_call_edges_add
+ * passes.c (init_optimization_passes): Enable
+ pass_cleanup_cfg, pass_inline_parameters,
+ pass_ipa_inline and pass_apply_inline.
+ (execute_todo): Re-enable check for TODO_update_ssa_any
+ if need_ssa_update_p() returns true.
+ * tree-ssa-operands.c (ssa_operands_active): Return false
+ if cfun is NULL.
+
+
+2008-04-04 Rafael Espindola <espindola@google.com>
+
+ Merge with mainline @133632.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2008-04-04 Rafael Espindola <espindola@google.com>
+
+ Merge with mainline @133631.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2008-04-04 Rafael Espindola <espindola@google.com>
+
+ Merge with mainline @133630.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2008-04-03 Aldy Hernandez <aldyh@redhat.com>
+
+ * omp-low.c (expand_omp_sections): Use
+ gimple_omp_sections_control.
+ (lower_omp_sections): Same.
+ * gimplify.c (gimplify_omp_workshare): Adjust OMP clauses before
+ creating gimple tuple.
+ Add gimple tuple to sequence.
+ Set OMP_SECTIONS_CONTROL in newly created tuple.
+ * gimple.h (gimple_statement_omp_sections): Add control.
+ (gimple_omp_sections_control): New.
+ (gimple_omp_sections_control_ptr): New.
+ (gimple_omp_sections_set_control): New.
+
+2008-04-03 Oleg Ryjkov <olegr@google.com>
+
+ * tree-nested.c (convert_nl_goto_receiver): Changed to hadle gimple
+ statements instead of trees.
+ (lower_nested_functions): Pass convert_nl_goto_receiver as the first
+ parameter to walk_all_functions.
+
+2008-04-03 Rafael Espindola <espindola@google.com>
+
+ Merge with mainline @133624.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2008-04-03 Rafael Espindola <espindola@google.com>
+
+ Merge with mainline @133612.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2008-04-03 Aldy Hernandez <aldyh@redhat.com>
+
+ * tree-pretty-print.c (dump_generic_node): Remove
+ OMP_{RETURN,CONTINUE} cases.
+ * tree.h (OMP_RETURN_NOWAIT): Remove.
+ * omp-low.c (dump_omp_region): Rename OMP_{CONTINUE,RETURN} to
+ GIMPLE_OMP_{CONTINUE,RETURN}.
+ (expand_omp_for_generic): Handle new arguments to
+ GIMPLE_OMP_CONTINUE.
+ (expand_omp_for_static_nochunk): Same.
+ (expand_omp_for_static_chunk): Same.
+ (expand_omp_sections): Same.
+ (expand_omp): Rename all OMP_* to GIMPLE_OMP_*.
+ (lower_omp_sections): Rename OMP_CONTINUE to GIMPLE_OMP_CONTINUE.
+ (lower_omp_for): Same.
+ * tree-gimple.c (is_gimple_stmt): Remove OMP_{RETURN,CONTINUE}
+ cases.
+ * gsstruct.def: Add GSS_OMP_CONTINUE.
+ * gimple-pretty-print.c (dump_gimple_omp_continue): New.
+ (dump_gimple_omp_return): New.
+ (dump_gimple_stmt): Add cases for GIMPLE_OMP_{CONTINUE,RETURN}.
+ * gimplify.c (gimplify_expr): Remove cases for
+ OMP_{CONTINUE,RETURN}.
+ * tree.def (DEFTREECODE): Remove OMP_{RETURN,CONTINUE}.
+ * tree-cfgcleanup.c (cleanup_omp_return): Rename
+ OMP_SECTIONS_SWITCH to GIMPLE_OMP_SECTIONS_SWITCH.
+ * gimple.c (gss_for_code): GIMPLE_OMP_RETURN returns GSS_BASE.
+ GIMPLE_OMP_CONTINUE return GSS_OMP_CONTINUE.
+ (gimple_size): Adjust size of GIMPLE_OMP_{RETURN,CONTINUE}.
+ (gimple_build_omp_continue): Change arguments.
+ (walk_gimple_op): Walk GIMPLE_OMP_CONTINUE operands.
+ (walk_gimple_stmt): Remove GIMPLE_OMP_CONTINUE case.
+ * gimple.h (struct gimple_statement_omp_continue): New.
+ (union gimple_statement_d): Add gimple_omp_continue.
+ (gimple_build_omp_continue): Change argument types in prototype.
+ (gimple_omp_return_set_nowait): Rename OMP_RETURN to
+ GIMPLE_OMP_RETURN.
+ (gimple_omp_continue_control_def): New.
+ (gimple_omp_continue_control_def_ptr): New.
+ (gimple_omp_continue_set_control_def): New.
+ (gimple_omp_continue_control_use): New.
+ (gimple_omp_continue_control_use_ptr): New.
+ (gimple_omp_continue_set_control_use): New.
+ * tree-cfg.c (make_edges): Rename OMP_ to GIMPLE_OMP_.
+ (gimple_redirect_edge_and_branch): Same.
+ * tree-ssa-operands.c (get_expr_operands): Remove OMP_CONTINUE
+ case.
+
+2008-04-02 Doug Kwan <dougkwan@google.com>
+
+ * tree-complex.c (expand_complex_comparison): Set condition code
+ correctly for the NE_EXPR case.
+ * cfgexpand.c (gimple_to_tree): Generate assignment to return value
+ if necessary.
+
+2008-04-02 Rafael Espindola <espindola@google.com>
+
+ Merge with mainline @133597.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2008-04-02 Rafael Espindola <espindola@google.com>
+
+ Merge with mainline @133527.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2008-04-02 Rafael Espindola <espindola@google.com>
+
+ Merge with mainline @133519.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2008-04-02 Rafael Espindola <espindola@google.com>
+
+ Merge with mainline @133453.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2008-04-01 Doug Kwan <dougkwan@google.com>
+ Bill Maddox <maddox@google.com>.
+
+ * value-prof.c (interesting_stringop_to_profile_p) Call
+ validate_gimple_arglist instead of validate_arglist.
+ * tree.h (validate_arglist): New declaration.
+ * builtins.c (expand_builtin_setjmp_receiver, expand_builtin_longjmp,
+ expand_builtin_nonlocal_goto, expand_builtin_nonlocal_goto,
+ expand_builtin_update_setjmp_buf, expand_builtin_prefetch,
+ expand_builtin_apply, expand_builtin_return, expand_builtin_mathfn,
+ expand_builtin_mathfn_2, expand_builtin_mathfn_3,
+ expand_builtin_interclass_mathfn, expand_builtin_sincos,
+ expand_builtin_cexpi, expand_builtin_int_roundingfn,
+ expand_builtin_int_roundingfn_2, expand_builtin_pow,
+ expand_builtin_powi, expand_builtin_strlen, expand_builtin_strlen,
+ expand_builtin_strstr, expand_builtin_strchr, expand_builtin_strrchr,
+ expand_builtin_memcpy, expand_builtin_memcpy,
+ expand_builtin_mempcpy_args, expand_builtin_bcopy, expand_movstr,
+ expand_builtin_stpcpy, expand_builtin_strncpy, builtin_memset_gen_str,
+ expand_builtin_bzero, expand_builtin_memchr, expand_builtin_memcmp,
+ expand_builtin_strcmp, expand_builtin_strncmp, expand_builtin_strcat,
+ expand_builtin_strncat, expand_builtin_strspn, expand_builtin_alloca,
+ expand_builtin_bswap, expand_builtin_unop, expand_builtin_fputs,
+ expand_builtin_fabs, expand_builtin_copysign,
+ expand_builtin___clear_cache, expand_builtin_init_trampoline,
+ expand_builtin_adjust_trampoline, expand_builtin_signbit,
+ expand_builtin, validate_arg, expand_builtin_object_size,
+ expand_builtin_object_size, expand_builtin_memory_chk) Re-enable code
+ previously disabled for GIMPLE.
+ (expand_builtin_memcpy, expand_builtin_memset_args): Re-enable code
+ previously disabled for GIMPLE. Look up tree attribute for original
+ GIMPLE statement.
+ (validate_arglist): Use old interface of tree node instead of GIMPLE
+ statement.
+ (validate_gimple_arglist): New function.
+ * cfgexpand.c (gimple_to_tree): Set GIMPLE statement tree attribute
+ for builtin function calls.
+ * tree-flow.h (struct tree_ann_common_d): New field stmt.
+ * gimple.h (validate_gimple_arglist): New declaration.
+ (validate_arglist): Moved to tree.h.
+
+2008-03-31 Oleg Ryjkov <olegr@google.com>
+
+ * gimplify.c (gimplify_switch_expr): Verify the return value from
+ gimplify_expr.
+
+2008-03-31 Rafael Espindola <espindola@google.com>
+
+ Merge with mainline @133452.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2008-03-31 Rafael Espindola <espindola@google.com>
+
+ Merge with mainline @133440.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2008-03-31 Rafael Espindola <espindola@google.com>
+
+ Merge with mainline @133423.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2008-03-30 Rafael Espindola <espindola@google.com>
+
+ Merge with mainline @133342.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2008-03-28 Rafael Espindola <espindola@google.com>
+
+ Merge with mainline @133341.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2008-03-28 Oleg Ryjkov <olegr@google.com>
+
+ * tree-eh.c (replace_goto_queue_1): Do a deep copy of the replacement
+ sequence.
+ (maybe_record_in_goto_queue): Set is_label flag when recording
+ GIMPLE_GOTOs.
+ (do_return_redirection, do_return_redirection): Changed to set
+ cont_stmt.
+ (lower_try_finally_onedest): Fix the code that assumes that gotos
+ themselves(instead of the labels) are recorded in the goto_queue.
+ (lower_try_finally_copy): Likewise.
+ (lower_try_finally_switch): Likewise, also fix the VEC_* operations.
+ * gimple.h (gimple_build_switch): Fixed comment.
+
+2008-03-28 Doug Kwan <dougkwan@google.com>
+
+ * omp-low.c (expand_omp_sections): Fix build breakage due to an
+ uninitialized variable.
+
+2008-03-28 Rafael Espindola <espindola@google.com>
+
+ Merge with mainline @133315.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2008-03-28 Diego Novillo <dnovillo@google.com>
+
+ * omp-low.c (expand_omp_for_static_chunk): Initialize
+ V_MAIN and V_BACK.
+ (expand_omp_for): Initialize VIN.
+
+2008-03-28 Rafael Espindola <espindola@google.com>
+
+ Merge with mainline @133313.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2008-03-27 Doug Kwan <dougkwan@google.com>
+
+ * c-decl.c (merge_decls): Also copy gimple bodies of decls.
+ * gimplify.c (gimplify_call_expr): Do not exit early when
+ gimplifying __builtin_va_start().
+
+2008-03-27 Oleg Ryjkov <olegr@google.com>
+
+ * gimple.c (walk_gimple_op): Add a check for assignments with more
+ than one operand on the LHS.
+
+2008-03-27 Aldy Hernandez <aldyh@redhat.com>
+
+ * tree.c (empty_body_p): Remove.
+ * tree.h (empty_body_p): Remove prototype.
+ * omp-low.c (struct omp_context): Convert to tuples.
+ (struct omp_context): Comment and convert to tuples.
+ (scan_omp_op): New.
+ (is_parallel_ctx): Convert to tuples.
+ (extract_omp_for_data): Same.
+ (workshare_safe_to_combine_p): Same.
+ (get_ws_args_for): Same.
+ (determine_parallel_type): Same.
+ (use_pointer_for_field): Same.
+ (dump_omp_region): Same.
+ (debug_all_omp_regions): Same.
+ (new_omp_region): Same.
+ (new_omp_context): Same.
+ (scan_sharing_clauses): Same.
+ (create_omp_child_function): Same.
+ (scan_omp_parallel): Same.
+ (scan_omp_for): Same.
+ (scan_omp_sections): Same.
+ (scan_omp_single): Same.
+ (check_omp_nesting_restrictions): Same.
+ (scan_omp_1_op): New.
+ (scan_omp_1_stmt): Rename from scan_omp_1. Rewrite for tuples.
+ (scan_omp): Convert to tuples.
+ (build_omp_barrier): Same.
+ (maybe_lookup_ctx): Same.
+ (lower_rec_input_clauses): Same.
+ (lower_lastprivate_clauses): Same.
+ (lower_reduction_clauses): Same.
+ (lower_copyprivate_clauses): Same.
+ (lower_send_clauses): Same.
+ (lower_send_shared_vars): Same.
+ (expand_parallel_call): Same.
+ (remove_exit_barrier): Same.
+ (remove_exit_barriers): Same.
+ (optimize_omp_library_calls): Same.
+ (expand_omp_parallel): Same.
+ (expand_omp_for_generic): Comment out, and convert to tuples.
+ (expand_omp_for_static_nochunk): Convert to tuples.
+ (expand_omp_for_static_chunk): Same.
+ (expand_omp_for): Same.
+ (expand_omp_sections): Same.
+ (expand_omp_synch): Same.
+ (expand_omp_atomic_fetch_op): Same.
+ (expand_omp_atomic_pipeline): Same.
+ (expand_omp_atomic_mutex): Same.
+ (expand_omp_atomic): Same.
+ (expand_omp): Same.
+ (build_omp_regions_1): Same.
+ (execute_expand_omp): Enable.
+ (execute_lower_omp): Enable and convert to tuples.
+ * gimple-dummy.c (omp_reduction_init): Remove.
+ * tree-flow.h (struct omp_region): Convert 'type' to tuples.
+ (new_omp_region): Adjust prototype for tuples.
+ * gimple.c (empty_stmt_p): New.
+ (empty_body_p): New.
+ * gimple.h (empty_body_p): New prototype.
+ (gimple_has_location): Remove fixmes.
+ * tree-cfg.c (gimple_block_label): Remove ATTRIBUTE_UNUSED.
+
+2008-03-27 Rafael Espindola <espindola@google.com>
+
+ Merge with mainline @133311.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2008-03-27 Rafael Espindola <espindola@google.com>
+
+ * gcc/tree-nested.c (save_tmp_var): Use gsi_insert_after_without_update
+ instead of gsi_insert_after.
+
+2008-03-26 Jakub Staszak <kuba@et.pl>
+
+ * gimple.h (gimple_uid, gimple_set_uid): Defined.
+ (gimple_statement_base): Field UID added.
+ * tree-ssa-dse.c (execute_simple_dse): #if 0 removed, bitmap_empty_p
+ condition added. (memory_ssa_name_same, memory_address_same,
+ get_kill_of_stmt_lhs, dse_possible_dead_store_p, dse_optimize_stmt,
+ dse_record_phis, dse_finalize_block, tree_ssa_dse): Tuplified.
+ * passes.c (init_optimization_passes): pass_simple_dse and pass_dse
+ enabled.
+ * testsuite/gcc.dg/tree-ssa/ssa-dse-10.c: {dg-final} changed.
+ * testsuite/gcc.dg/tree-ssa/pr30375.c: {dg-final} changed.
+
+2008-03-26 Rafael Espindola <espindola@google.com>
+ * gcc/tree-ssa-operands.c (ssa_operands_active): Assert that cfun is
+ not NULL.
+ * gcc/tree-nested.c (init_tmp_var): Use
+ gsi_insert_before_without_update instead of gsi_insert_before.
+
+2008-03-25 Rafael Espindola <espindola@google.com>
+
+ Merge with mainline @133309.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2008-03-25 Rafael Espindola <espindola@google.com>
+
+ Merge with mainline @133306.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2008-03-25 Bill Maddox <maddox@google.com>
+
+ * tree-ssa-dom.c (loop_depth_of_name): Tuplify.
+ * tree-ssa-copy.c (stmt_may_generate_copy,
+ copy_prop_visit_assignment, copy_prop_visi_cond_stmt,
+ copy_prop_visit_stmt, copy_prop_visit_phi_node,
+ init_copy_prop, execute_copy_prop): Tuplify.
+ * passes.c (init_optimization_passes):
+ Enable pass_copy_prop.
+
+2008-03-25 Rafael Espindola <espindola@google.com>
+
+ Merge with mainline @133257.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2008-03-25 Oleg Ryjkov <olegr@google.com>
+
+ * gimple.c (gimple_build_bind): Added a new parameter - the
+ containing block.
+ * gimple.h (gimple_build_bind): Changed the header accordingly.
+ * gimplify.c (gimplify_bind_expr, gimplify_function_tree): Updated
+ the callers of gimple_build_bind.
+ (gimplify_body): Updated the call to gimple_build_bind and moved
+ the copying of block information into gimplify_bind_expr.
+
+2008-03-25 Rafael Espindola <espindola@google.com>
+
+ Merge with mainline @133255.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2008-03-25 Rafael Espindola <espindola@google.com>
+
+ Merge with mainline @133251.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2008-03-25 Rafael Espindola <espindola@google.com>
+
+ Merge with mainline @133250.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2008-03-24 Rafael Espindola <espindola@google.com>
+
+ Merge with mainline @133246.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2008-03-24 Rafael Espindola <espindola@google.com>
+
+ Merge with mainline @133222.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2008-03-24 Andrew Pinski <pinskia@gmail.com>
+
+ * passes.c (init_optimization_passes): Enable pass_split_crit_edges.
+
+2008-03-24 Rafael Espindola <espindola@google.com>
+
+ Merge with mainline @133169.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2008-03-21 Rafael Espindola <espindola@google.com>
+
+ Merge with mainline @133168.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2008-03-21 Rafael Espindola <espindola@google.com>
+
+ Merge with mainline @133167.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2008-03-20 Oleg Ryjkov <olegr@google.com>
+
+ * tree-eh.c (lower_try_finally): Correctly set the lowered sequence.
+
+2008-03-20 Jakub Staszak <kuba@et.pl>
+ Oleg Ryjkov <olegr@google.com>
+
+ * tree-ssa-sink.c (is_hidden_global_store): Tuplified.
+ * tree-ssa-dce.c (mark_stmt_necessary, mark_operand_necessary,
+ mark_stmt_if_obviously_necessary,
+ mark_control_dependent_edges_necessary,
+ find_obviously_necessary_stmts, propagate_necessity,
+ remove_dead_phis, eliminate_unnecessary_stmts, tree_dce_init,
+ tree_dce_done): Tuplified.
+ * tree-flow.h (is_hidden_global_store): Tuplified the declaration.
+ * passes.c (init_optimization_passes): Enabled pass_dce and
+ pass_cd_dce.
+
+2008-03-20 Oleg Ryjkov <olegr@google.com>
+
+ * tree-complex.c (init_dont_simulate_again, complex_visit_stmt,
+ update_complex_components, expand_complex_operations_1): Consider
+ GIMPLE_CALLs with a lhs, not only GIMPLE_ASSIGNs.
+ * gimplify.c (get_tmp_var_for): Removed.
+ (gimplify_call_expr): Remove call to get_tmp_var_for, set
+ gimple_register on a new lhs in some cases.
+
+2008-03-20 Rafael Espindola <espindola@google.com>
+
+ Merge with mainline @133162.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2008-03-20 Rafael Espindola <espindola@google.com>
+
+ Merge with mainline @133161.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2008-03-20 Rafael Espindola <espindola@google.com>
+
+ Merge with mainline @133140.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2008-03-20 Rafael Espindola <espindola@google.com>
+
+ Merge with mainline @133138.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2008-03-18 Bill Maddox <maddox@google.com>
+
+ * builtins.c (fold_builtin_object_size):
+ Enable call to compute_builtin_object_size, previously
+ stubbed out awaiting tuplification.
+ * tree-ssa-ccp.c (valid_gimple_rhs_p, valid_gimple_call_p,
+ move_ssa_defining_stmt_for_defs, update_call_from_tree):
+ Deleted, moved to tree-ssa-propagate.c.
+ (get_maxval_strlen): Use gimple_assign_single_p.
+ Handle assignment with unary NOP correctly.
+ * tree-ssa-propagate.c (valid_gimple_rhs_p, valid_gimple_call_p,
+ move_ssa_defining_stmt_for_defs, update_call_from_tree):
+ Moved here from tree-ssa-ccp.c.
+ * tree-ssa-propagate.h (valid_gimple_rhs_p, valid_gimple_call_p,
+ move_ssa_defining_stmt_for_defs, update_call_from_tree): Declared.
+ * gimple-dummy.c (compute_builtin_object_size): Removed dummy.
+ * tree_object_size.c (addr_object_size, alloc_object_size)
+ Tuplified.
+ (pass_through_call, compute_builtin_object_size): Tuplified.
+ (expr_object_size): Tuplified. Some cases broken out.
+ (plus_expr_object_size): Deleted.
+ (call_object_size, unknown_object_size, plus_stmt_object_size):
+ New functions. Handle cases broken out from expr_object_size.
+ (cond_expr_object_size): Fix comment.
+ (collect_object_sizes_for): Tuplify.
+ (check_for_plus_in_loops_1, check_for_plus_in_loops): Tuplify.
+ (compute_object_sizes): Tuplify.
+ * gimple.c (gimple_assign_single_p, gimple_assign_unary_nop_p):
+ New functions.
+ * gimple.h (gimple_assign_single_p, gimple_assign_unary_nop_p):
+ Declare.
+ * passes.c (init_optimization_passes): Enable pass_object_sizes.
+
+2008-03-18 Diego Novillo <dnovillo@google.com>
+ Oleg Ryjkov <olegr@google.com>
+
+ * gimplify.c (gimplify_body): Copy the block information from
+ the tree function body to gimple function body.
+ (gimplify_function_tree): Correctly wrap the function body
+ into the try/finally block if creating one.
+ * gimple.c (gimple_seq_has_side_effects): Removed.
+ * gimple.h (gimple_seq_has_side_effects): Removed declaration.
+ * tree-cfg.c (remove_useless_stmts_tf, remove_useless_stmts_tc):
+ Modified to use gimple_seq_empty_p instead of
+ gimple_seq_has_side_effects.
+
+2008-03-18 Aldy Hernandez <aldyh@redhat.com>
+
+ * gimple.c (walk_gimple_stmt): Collapse common code.
+ Add case for GIMPLE_WITH_CLEANUP_EXPR.
+
+2008-03-17 Zdenek Dvorak <ook@ucw.cz>
+
+ * gimple-iterator.c (gsi_for_stmt): Use gsi_start_phis.
+ (gsi_start_phis): New function.
+ * gimple.h (gsi_start_phis): Declare.
+ * tree-into-ssa.c (initialize_flags_in_bb, rewrite_initialize_block,
+ rewrite_add_phi_arguments, rewrite_update_init_block,
+ prepare_block_for_update): Use gsi_start_phis.
+ * tree-complex.c (init_dont_simulate_again, update_phi_components):
+ Ditto.
+ * tree-ssa-loop-manip.c (find_uses_to_rename_bb,
+ verify_loop_closed_ssa, split_loop_exit_edge,
+ tree_transform_and_unroll_loop): Ditto.
+ * tree-scalar-evolution.c (loop_closed_phi_def,
+ analyze_scalar_evolution_for_all_loop_phi_nodes, scev_const_prop):
+ Ditto.
+ * tree-phinodes.c (reserve_phi_args_for_new_edge, remove_phi_args):
+ Ditto.
+ * tree-ssa-copyrename.c (rename_ssa_copies): Ditto.
+ * tree-ssa-ccp.c (ccp_initialize): Ditto.
+ * tree-ssa-loop-ivopts.c (find_bivs, mark_bivs,
+ find_interesting_uses_outside, find_interesting_uses,
+ determine_set_costs): Ditto.
+ * tree-ssa-propagate.c (simulate_block, ssa_prop_init,
+ substitute_and_fold): Ditto.
+ * tree-ssa-alias.c (dump_points_to_info, create_structure_vars): Ditto.
+ * gimple-pretty-print.c (dump_phi_nodes): Ditto.
+ * tree-data-ref.c (stmts_from_loop): Ditto.
+ * tree-ssa-coalesce.c (build_ssa_conflict_graph,
+ create_outofssa_var_map, coalesce_partitions): Ditto.
+ * tree-dfa.c (collect_dfa_stats): Ditto.
+ * tree-cfgcleanup.c (phi_alternatives_equal, remove_forwarder_block,
+ remove_forwarder_block_with_phi, merge_phi_nodes): Ditto.
+ * tree-ssa-live.c (remove_unused_locals, calculate_live_on_exit,
+ verify_live_on_entry): Ditto.
+ * tree-ssa.c (ssa_redirect_edge, flush_pending_stmts, verify_ssa,
+ execute_late_warn_uninitialized, execute_update_addresses_taken):
+ Ditto.
+ * tree-outof-ssa.c (eliminate_build, eliminate_virtual_phis,
+ rewrite_trees, remove_ssa_form, insert_backedge_copies):
+ Ditto.
+ * cfgloop.c (find_subloop_latch_edge_by_ivs): Ditto.
+ * tree-ssa-structalias.c (compute_points_to_sets, ipa_pta_execute):
+ Ditto.
+ * tree-cfg.c (remove_phi_nodes_and_edges_for_unreachable_block,
+ reinstall_phi_args, verify_stmts, gimple_make_forwarder_block,
+ add_phi_args_after_copy_edge, gimple_lv_adjust_loop_header_phi):
+ Ditto.
+
+2008-03-16 Zdenek Dvorak <ook@ucw.cz>
+
+ * tree-ssa-loop-ivopts.c: Tuplify.
+ * gimple-dummy.c (multiplier_allowed_in_address_p, multiply_by_cost,
+ tree_ssa_iv_optimize): Removed.
+ * tree-ssa-phiopt.c (empty_block_p): Tuplify.
+ * gimple.h (gimple_cond_lhs_ptr, gimple_cond_rhs_ptr): New.
+ * passes.c (init_optimization_passes): Enable pass_iv_optimize.
+
+ * gimplify.c (gimplify_omp_workshare, gimplify_expr): Avoid using
+ uninitialized sequence.
+
+2008-03-13 Bill Maddox <maddox@google.com>
+
+ * tree.h (fold_call_stmt, gimple_fold_builtin_snprintf_chk):
+ Declare new functions.
+ * builtins.c (fold_builtin_object_size): Disable call to
+ compute_builtin_object_size, which has not been converted.
+ (gimple_rewrite_call_expr, gimple_fold_builtin_sprintf_chk,
+ gimple_fold_builtin_snprintf_chk, gimple_fold_builtin_varargs,
+ fold_call_stmt): New functions.
+ * tree-chrec.h (build_polynomial_chrec): Silence uninitialized
+ variable warning.
+ * tree-ssa-ccp.c (likely_value): Recognize additional cases
+ of constant values.
+ (surely_varying_stmt_p): Note that return statements are not
+ interesting to CCP as they no longer contain assignments.
+ (ccp_fold): Add missing spaces.
+ (valid_gimple_call_p): New function.
+ (get_maxval_strlen): Don't trip over unary operator.
+ (ccp_fold_builtin): Use fold_call_stmt and
+ gimple_fold_builtin_snprintf_chk. Enable disabled
+ call now that target has been converted for tuples.
+ Add missing spaces.
+ (move_ssa_defining_stmt_for_defs): New function.
+ (update_call_from_tree): New function.
+ (fold_gimple_call): Use update_call_from_tree.
+ (fold_stmt_inplace): Assert that operand folding tree
+ walk goes to completion, i.e., does not return non-null.
+ (optimize_stack_restore, optimize_stdarg_builtin):
+ Convert to tuples
+ (convert_to_gimple_builtin): Removed.
+ (gimplify_and_update_call_from_tree): New function.
+ Replaces convert_to_gimple_builtin.
+ (execute_fold_all_builtins): Convert to tuples.
+ * tree-ssa-propagate.c (replace_uses_in): Removed
+ replaced_address argument. Made function static.
+ (replace_vuses_in): Removed replaced_address argument.
+ (substitute_and_fold): Removed replaced_address boolean,
+ which was set but never examined.
+ * tree-ssa-propagate.h (replace_uses_in): Removed declaration.
+ * gimple-iterator.c (update_modified_stmt): Moved to
+ head of file to avoid a forward declaration.
+ (update_modified_stmts): New function.
+ (gsi_insert_seq_before_without_update,
+ gsi_insert_before_without_update,
+ gsi_insert_seq_after_without_update,
+ gsi_insert_after_without_update): New functions.
+ (gsi_insert_before, gsi_insert_seq_before,
+ gsi_insert_after, gsi_insert_seq_after): Call the
+ _without_update variants.
+ * gimplify.c (gimplify_seq_add_stmt, gimplify_seq_add_seq):
+ New functions.
+ (gimple_pop_condition, gimplify_return_expr, gimplify_loop_expr,
+ gimplify_switch_expr, gimplify_case_label_expr,
+ gimplify_self_mod_expr, gimplify_call_expr,
+ gimplify_modify_expr_to_memcpy, gimplify_modify_expr_to_memset,
+ gimplify_init_ctor_eval_range, gimpllify_modify_expr_complex_part,
+ gimplify_modify_expr, gimplify_asm_expr, gimplify_cleanup_point_expr,
+ gimple_push_cleanup, gimplify_omp_parallel, gimplify_omp_atomic,
+ gimplify_expr, gimplify_body, gimplify_function_tree): When adding
+ to statement sequences in the gimplifier, do not update operands.
+ * tree-dfa.c (find_new_referenced_vars): Convert to tuples.
+ * tree-flow.h (find_new_referenced_vars): Declare with new signature.
+ * gimple.h (gimple_return_set_retval): Fix argument validation.
+ (gsi_insert_seq_before_without_update,
+ gsi_insert_before_without_update,
+ gsi_insert_seq_after_without_update,
+ gsi_insert_after_without_update): Declare new functions.
+ * gimple.c (gimple_build_return): Rely on gimple_return_set_retval
+ to perform argument validation.
+ * passes.c (init_optimization_passes): Enable pass_fold_builtins.
+
+2008-03-13 Oleg Ryjkov <olegr@google.com>
+
+ * tree-cfg.c (gimplify_val): Removed.
+ (gimplify_build1, gimplify_build2, gimplify_build3): Use
+ force_gimple_operand_gsi instead of gimplify_val.
+ * tree-complex.c (extract_component): Use force_gimple_operand_gsi
+ instead of gimplify_val.
+ * tree-vect-generic.c (expand_vector_parallel): Ditto.
+
+2008-03-13 Diego Novillo <dnovillo@google.com>
+ Oleg Ryjkov <olegr@google.com>
+
+ * tree-ssa-operands.c (get_expr_operands): Handle FILTER_EXPR and
+ EXC_PTR_EXPR.
+
+2008-03-12 Diego Novillo <dnovillo@google.com>
+ Oleg Ryjkov <olegr@google.com>
+
+ * cfgexpand.c (gimple_to_tree): Record the correct type when
+ converting GIMPLE_CALL.
+
+2008-03-12 Zdenek Dvorak <ook@ucw.cz>
+
+ * tree-ssa-loop-im.c (stmt_cost, rewrite_bittest,
+ determine_invariantness_stmt, gather_mem_refs_stmt):
+ Use gimple_assign_rhs_code.
+ * cfgexpand.c (gimple_to_tree): Ditto.
+ * tree-inline.c (estimate_num_insns): Ditto.
+ * tree-vect-generic.c (expand_vector_operations_1): Ditto.
+ * tree-ssa-ccp.c (likely_value, ccp_fold, evaluate_stmt,
+ * gimple.c (gimple_fold, gimple_assign_set_rhs_with_ops): Ditto.
+ * tree-ssa-structalias.c (handle_ptr_arith): Ditto.
+ fold_gimple_assign): Ditto.
+ * value-prof.c (gimple_divmod_fixed_value_transform): Ditto.
+ * tree-ssa-loop-ch.c (copy_loop_headers): Ditto.
+ * tree-ssa-propagate.c (stmt_makes_single_load,
+ substitute_and_fold): Ditto.
+ * tree-ssa-loop-niter.c (chain_of_csts_start): Exclude memory loads.
+ (get_val_for): Assert that the statement is an assignment.
+ (derive_constant_upper_bound_assign,
+ expand_simple_operations): Use gimple_assign_rhs_code.
+ * tree-ssa-loop-manip.c (create_iv, ip_normal_pos,
+ standard_iv_increment_position, determine_exit_conditions,
+ tree_transform_and_unroll_loop): Tuplify.
+ * tree-scalar-evolution.c (interpret_expr): Fail for chrecs.
+ (interpret_gimple_assign, follow_ssa_edge_in_rhs): Use
+ gimple_assign_rhs_code.
+ * tree-gimple.c (gimple_assign_rhs_code): New function.
+ * tree-gimple.h (gimple_assign_rhs_code): Declare.
+ * tree-ssa-loop-ivopts.c (single_dom_exit): Enable.
+ * gimple-dummy.c (compute_data_dependences_for_loop, dump_ddrs,
+ free_data_refs, free_dependence_relations,
+ gimple_duplicate_loop_to_header_edge, tree_ssa_prefetch_arrays,
+ estimated_loop_iterations_int): Removed.
+ * tree-ssa-loop-ivcanon.c (tree_num_loop_insns): Tuplify.
+ * predict.c, tree-data-ref.c, tree-ssa-loop-prefetch.c: Tuplify.
+ * tree-data-ref.h (struct data_reference, struct rdg_vertex): Change
+ the type of stmt to gimple.
+ (get_references_in_stmt, create_data_ref, rdg_vertex_for_stmt,
+ stores_from_loop, remove_similar_memory_refs,
+ have_similar_memory_accesses): Declaration changed.
+ * gimple-iterator.c (gsi_insert_seq_on_edge_immediate): New.
+ * gimple-pretty-print.c (dump_gimple_assign): Dump nontemporal
+ move. Use gimple_assign_rhs_code.
+ (dump_unary_rhs, dump_binary_rhs): Use gimple_assign_rhs_code.
+ * gimplify.c (gimplify_modify_expr): Set lhs of the assignment to
+ the new SSA name.
+ * tree-ssa-coalesce.c (build_ssa_conflict_graph,
+ create_outofssa_var_map): Use gimple_assign_copy_p.
+ * tree-predcom.c (mark_virtual_ops_for_renaming): Enable.
+ * tree-inline.c (estimate_num_insns): Use gimple_assign_rhs_code.
+ * tree-flow.h (mark_virtual_ops_for_renaming): Declaration changed.
+ * gimple.h (struct gimple_statement_base): Change unused_4 flag
+ to nontemporal_move flag.
+ (gimple_assign_nontemporal_move_p, gimple_assign_set_nontemporal_move):
+ New functions.
+ (gsi_insert_seq_on_edge_immediate): Declare.
+ (gimple_assign_rhs2): Return NULL if the statement does not have two
+ operands.
+ (gimple_assign_subcode): Removed.
+ * tree-cfg.c (verify_types_in_gimple_assign): Use
+ gimple_assign_rhs_code.
+ (gimple_lv_adjust_loop_header_phi, gimple_lv_add_condition_to_bb):
+ Tuplify.
+ (gimple_cfg_hooks): Enable lv_add_condition_to_bb and
+ lv_adjust_loop_header_phi hooks.
+ * passes.c (init_optimization_passes): Enable pass_profile,
+ pass_check_data_deps and pass_loop_prefetch.
+
+2008-03-11 Diego Novillo <dnovillo@google.com>
+
+ * tree-ssa-operands.h: Added declaration of add_to_addressable_set.
+ * tree-ssa-operands.h (add_to_addressable_set): New function.
+ (gimple_add_to_addresses_taken): Moved most of the logic to
+ add_addressable_set.
+ * tree-ssa-structalias.c (update_alias_info): Record the variables
+ whose address is taken inside a phi node.
+
+2008-03-11 Aldy Hernandez <aldyh@redhat.com>
+
+ * tree-phinodes.c (allocate_phi_node): Update for tuples.
+ * gimplify.c (gimplify_function_tree): Dump memory stats.
+ * gimple.c: Declare gimple_alloc_counts, gimple_alloc_sizes,
+ and gimple_alloc_kind_names.
+ (gimple_alloc): Gather statistics for tuples.
+ (gimple_build_asm_1): Same.
+ (gimple_seq_alloc): Same.
+ (dump_gimple_statistics): New.
+ * gimple.h: Define gimple_alloc_kind.
+ (gimple_alloc_kind): New.
+ (dump_gimple_statistics): Protoize.
+ * tree-ssa-copy.c (replace_exp_1): Mark for_propagation as unused
+ (merged from mainline).
+
+2008-03-11 Diego Novillo <dnovillo@google.com>
+
+ Merge with mainline @133081.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2008-03-06 Diego Novillo <dnovillo@google.com>
+
+ Merge with mainline @132948
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2008-03-06 Diego Novillo <dnovillo@google.com>
+
+ * config/rs6000/rs6000.c (rs6000_alloc_sdmode_stack_slot):
+ Call walk_gimple_op.
+ * tree-complex.c (expand_complex_div_wide): Call
+ split_block with STMT.
+
+2008-03-06 Diego Novillo <dnovillo@google.com>
+
+ * gimple.h (struct gimple_statement_base): Rename field
+ 'locus' to 'location'. Update all users.
+ (gimple_location): Rename from gimple_locus. Update all
+ users.
+ (gimple_set_location): Rename from gimple_set_locus.
+ Update all users.
+ (gimple_has_location): Rename from gimple_location_empty_p.
+ Change sign of return value. Update all users.
+ * gimplify.c (tree_annotate_all_with_location): Rename
+ from tree_annotate_all_with_locus.
+ (annotate_all_with_location): Rename from
+ annotate_all_with_locus.
+
+2008-03-05 Diego Novillo <dnovillo@google.com>
+
+ * gimple.c (gimple_set_lhs): Remove return keywords.
+
+2008-03-05 David Daney <ddaney@avtrex.com>
+
+ * builtins.c (expand_builtin___clear_cache): Disable call to
+ validate_arglist.
+ * config/mips/mips.c (mips_gimplify_va_arg_expr): Tuplify.
+
+2008-03-05 Bill Maddox <maddox@google.com>
+
+ * tree-ssa-ccp.c (dump_lattice_value, debug_lattice_value):
+ Re-enable functions #if'd out.
+ (test_default_value, likely_value, surely_varying_stmt_p,
+ ccp_initialize, ccp_visit_phi_node, ccp_fold, evaluate_stmt,
+ visit_assignment, visit_cond_stmt, ccp_visit_stmt):
+ Convert to tuples.
+ (fold_gimple_call): Don't trip over call that simplifies to
+ another call, not a constant.
+ * tree-ssa-propagate.c (ssa_prop_init): Initialize in-worklist
+ flag for phi nodes as well as statements.
+ (valid_gimple_expression_p): Add fixme comment to remove this.
+ function. It currently has static uses, but asserts when called.
+ (stmt_makes_single_load, stmt_makes_single_store):
+ Convert to tuples
+ (replace_phi_args_in): Convert to tuples. Fix typo in comment.
+ * gimple.c (gimple_copy_no_def_use, gimple_get_lhs,
+ gimple_set_lhs): New function.
+ * gimple.h (gimple_copy_no_def_use, gimple_get_lhs,
+ gimple_set_lhs): Declare new function.
+ * tree-cfg.c (replace_uses_by): Add comment regarding empty
+ operands.
+ * passes.c (init_optimization_passes): Enable pass_ccp and
+ pass_store_ccp.
+
+2008-03-05 David Daney <ddaney@avtrex.com>
+
+ * tree-phinodes.c (allocate_phi_node): Fix syntax errors from
+ previous commit.
+
+2008-03-05 Rafael Espindola <espindola@google.com>
+
+ * tree-phinodes.c (allocate_phi_node): free free_phinodes[bucket]
+ if empty.
+
+2008-03-05 Diego Novillo <dnovillo@google.com>
+
+ http://gcc.gnu.org/ml/gcc/2008-03/msg00256.html
+
+ * fold-const.c (tree_binary_nonnegative_warnv_p): Fix
+ invalid C90 declaration.
+ (tree_single_nonnegative_warnv_p): Likewise.
+ * gimplify.c (gimplify_bind_expr): Likewise.
+ (gimplify_return_expr): Likewise.
+
+2008-03-04 Zdenek Dvorak <ook@ucw.cz>
+
+ * tree-ssa-loop-niter.c, tree-scalar-evolution.c: Tuplified.
+ * tree-ssa-loop-manip.c (split_loop_exit_edge): Ditto.
+ * tree-chrec.c (chrec_fold_plus, chrec_apply, chrec_convert_1,
+ convert_affine_scev, chrec_convert_rhs, chrec_convert,
+ chrec_convert_aggressive): Pass statements as gimple.
+ * tree-scalar-evolution.h (get_loop_exit_condition, simple_iv):
+ Type changed.
+ * tree-chrec.h (chrec_convert, chrec_convert_rhs): Ditto.
+ * tree-ssa-loop-ivopts.c (abnormal_ssa_name_p,
+ idx_contains_abnormal_ssa_name_p, contains_abnormal_ssa_name_p,
+ expr_invariant_in_loop_p, tree_int_cst_sign_bit): Enabled.
+ * gimple-dummy.c (chrec_dont_know, chrec_known, chrec_not_analyzed_yet,
+ analyze_scalar_evolution, chrec_contains_symbols_defined_in_loop,
+ estimate_numbers_of_iterations, expr_invariant_in_loop_p,
+ free_numbers_of_iterations_estimates,
+ free_numbers_of_iterations_estimates_loop, get_loop_exit_condition,
+ instantiate_parameters, nowrap_type_p. scev_const_prop. scev_finalize,
+ scev_initialize, scev_probably_wraps_p, scev_reset,
+ tree_int_cst_sign_bit, number_of_iterations_exit, loop_niter_by_eval,
+ substitute_in_loop_info): Removed.
+ * tree-ssa-loop.c (tree_loop_optimizer_init): Merged into...
+ (tree_ssa_loop_init): ... here. Enable scev_initialize call.
+ (tree_ssa_loop_done): Enable scev finalization.
+ * gimple-iterator.c (gsi_insert_seq_nodes_before): Allow inserting
+ at the end of basic block.
+ (gsi_for_stmt): Handle phi nodes.
+ * cfgloop.h (struct nb_iter_bound): Change type of stmt field to gimple.
+ * tree-flow.h (scev_probably_wraps_p, convert_affine_scev,
+ stmt_dominates_stmt_p): Types changed.
+ * Makefile.in (gt-tree-scalar-evolution.h): Enable.
+ * gimple.c (extract_ops_from_tree): Export.
+ (gimple_copy): Do not share bitmaps.
+ * gimple.h (extract_ops_from_tree): Declare.
+ (gimple_call_set_lhs): Allow lhs to be NULL.
+ * tree-cfg.c (add_phi_args_after_copy_edge,
+ add_phi_args_after_copy_bb): Tuplify.
+ * passes.c (init_optimization_passes): Enable pass_ch, pass_scev_cprop.
+
+2008-03-04 Oleg Ryjkov <olegr@google.com>
+
+ * tree-ssa-dse.c (execute_simple_dse): Commented out.
+ * passes.c (init_optimization_passes): Disabling pass_simple_dse.
+
+2008-03-04 Bill Maddox <maddox@google.com>
+
+ * tree-cfg.c (remove_useless_stmts_1):
+ Correctly distinguish try-catch and try-finally.
+
+2008-03-04 Oleg Ryjkov <olegr@google.com>
+
+ * tree-ssa-dse.c (execute_simple_dse): Tuplified.
+ * gimplify.c (gimplify_return_expr): Copy the NO_WARNING flag
+ to the newly created expr from the tree.
+ * tree-cfg.c (gimplify_build1): Tuplified.
+ * passes.c (init_optimization_passes): Enabled
+ pass_warn_function_return, pass_update_address_taken,
+ pass_simple_dse and pass_build_alias passes.
+
+2008-03-04 Rafael Espindola <espindola@google.com>
+
+ * fold-const.c (tree_simple_nonnegative_warnv_p): New.
+ (tree_unary_nonnegative_warnv_p): New.
+ (tree_binary_nonnegative_warnv_p): New.
+ (tree_single_nonnegative_warnv_p): New.
+ (tree_invalid_nonnegative_warnv_p): New.
+ (tree_expr_nonnegative_warnv_p): Redefine in term of the new functions.
+
+2008-03-04 Aldy Hernandez <aldyh@redhat.com>
+
+ * gimple.c (walk_gimple_seq): Do not set wi->gsi.
+ (walk_gimple_stmt): Set wi->gsi.
+ * tree-cfg.c (verify_stmt): Use walk_gimple_op instead of
+ walk_gimple_stmt.
+ (verify_stmts): Same.
+
+2008-03-04 Diego Novillo <dnovillo@google.com>
+
+ http://gcc.gnu.org/ml/gcc-patches/2008-03/msg00219.html
+
+ * expr.c (expand_expr_real): Call lookup_expr_eh_region.
+ * tree-eh.c (lookup_stmt_eh_region_fn):
+ (lookup_stmt_eh_region): Fix comment.
+ (lookup_expr_eh_region): Handle missing cfun and missing
+ EH table.
+ (record_in_finally_tree): Fix comment.
+ (collect_finally_tree_1): Remove handler for
+ GIMPLE_SWITCH.
+ (maybe_record_in_goto_queue): Remove local variable
+ NEW_IS_LABEL.
+ Record GIMPLE_GOTOs instead of their label.
+ (verify_norecord_switch_expr): Retrieve the CASE_LABEL
+ from the case label expression.
+ (do_return_redirection): Change sign of assertion.
+ (lower_try_finally_onedest): Assert that
+ TF->GOTO_QUEUE[0] contains a GIMPLE statement.
+ (lower_try_finally_copy): Assert that Q contains a GIMPLE
+ statement.
+ (lower_try_finally_switch): Build a new GIMPLE label for
+ CONT_STMT.
+ (mark_eh_edge): Tuplify.
+ (verify_eh_edges): Tuplify.
+ (tree_can_throw_external): Remove unused function.
+ (optimize_double_finally): Remove #if 0.
+ * gimple-pretty-print.c (GIMPLE_NIY): Tidy.
+ (dump_gimple_resx): Fix format string for
+ dump_gimple_fmt.
+ * gimplify.c (gimplify_cleanup_point_expr): Initialize
+ BODY_SEQUENCE.
+ * calls.c (emit_call_1): Remove ATTRIBUTE_UNUSED markers.
+ * cfgexpand.c (gimple_to_tree) <GIMPLE_NOP>: Assign new
+ expression to T.
+ <GIMPLE_RESX>: Handle.
+ Always assign the value from lookup_stmt_eh_region to
+ ANN->RN.
+ * tree-cfg.c (start_recording_case_labels):
+ (recording_case_labels_p): Re-enable.
+ (get_cases_for_edge): Likewise.
+ (gimple_verify_flow_info): Re-enable call to
+ verify_eh_edges.
+ (gimple_redirect_edge_and_branch): Re-enable handling of
+ GIMPLE_SWITCH.
+ (gimple_block_ends_with_call_p): Tuplify.
+ (struct gimple_cfg_hooks): Enable block_ends_with_call_p
+ callback.
+
+2008-03-04 Rafael Espindola <espindola@google.com>
+
+ * fold-const.c (tree_unary_nonzero_warnv_p): New.
+ (tree_binary_nonzero_warnv_p): New.
+ (tree_single_nonzero_warnv_p): New.
+ (tree_expr_nonzero_warnv_p): Redefine using the new functions.
+
+2008-03-04 Aldy Hernandez <aldyh@redhat.com>
+
+ * gimple.c (walk_gimple_op): Update comment.
+ (walk_gimple_stmt): Same.
+
+2008-03-03 Aldy Hernandez <aldyh@redhat.com>
+
+ * cgraphbuild.c (build_cgraph_edges): Use walk_gimple_op instead of
+ walk_gimple_stmt.
+ * tree-ssa-alias-warnings.c (find_references_in_function): Same.
+ * tree-ssa-ccp.c (fold_stmt): Change walk_gimple_stmt call to
+ walk_gimple_op.
+ * tree-nrv.c (tree_nrv): Same.
+ * tree-ssa-alias.c (count_uses_and_derefs): Same.
+ * cfgexpand.c (discover_nonconstant_array_refs_r): Same.
+ * tree-nested.c (convert_nonlocal_reference_stmt): Make first
+ argument a GSI.
+ (convert_local_reference_op): Same.
+ (convert_nl_goto_reference): Same.
+ (convert_tramp_reference_stmt): Same.
+ (convert_gimple_call): Same.
+ * tree-inline.c (inline_forbidden_p_stmt): Same.
+ * tree-ssa.c (execute_early_warn_uninitialized): Change
+ walk_gimple_stmt call to walk_gimple_op.
+ * gimple.c (walk_gimple_seq): Pass GSI to walk_gimple_stmt.
+ (walk_gimple_stmt): Move operand walking code to...
+ (walk_gimple_op): ...here.
+ (walk_gimple_stmt): First argument is now a GSI.
+ * gimple.h: Change walk_stmt_fn argument to a GSI.
+ (walk_gimple_stmt): Make first argument is a GSI.
+ (walk_gimple_op): New prototype.
+ * tree-cfg.c (verify_stmt): Change argument to a GSI. Adjust
+ accordingly.
+
+2008-02-29 Zdenek Dvorak <ook@ucw.cz>
+
+ * tree-ssa-alias.c (is_escape_site): Detect pure/const functions
+ correctly.
+
+2008-02-28 Zdenek Dvorak <ook@ucw.cz>
+
+ * tree-ssa-loop-im.c: Tuplify.
+ * tree-ssa-loop-manip.c (add_exit_phis_edge, find_uses_to_rename_stmt,
+ find_uses_to_rename_bb, check_loop_closed_ssa_use,
+ check_loop_closed_ssa_stmt, verify_loop_closed_ssa): Ditto.
+ * gimple-dummy.c (rewrite_into_loop_closed_ssa, tree_ssa_lim,
+ verify_loop_closed_ssa, replace_exp): Removed.
+ * tree-ssa-loop.c (tree_ssa_loop_init, tree_ssa_loop_done): Comment
+ out scev initialization and finalization.
+ * gimple-iterator.c (gsi_remove): Rename remove_eh_info to
+ remove_permanently. Do not free operands if remove_permanently
+ is false.
+ (gimple_find_edge_insert_loc): Use gsi_last_bb.
+ * tree-eh.c (operation_could_trap_p): Factored out of ...
+ (tree_could_trap_p): ... here.
+ * tree-ssa-copy.c (replace_exp): Enable.
+ * tree-flow.h (movement_possibility): Declaration changed.
+ (operation_could_trap_p): Declare.
+ * Makefile.in (tree-ssa-loop-im.o): Add pointer-set.h dependency.
+ (gimple.o): Add FLAGS_H dependency.
+ * gimple.c: Include flags.h.
+ (gimple_could_trap_p): New function.
+ * gimple.h (gimple_could_trap_p): Declare.
+ * tree-cfg.c (replace_uses_by): Check that op is not null.
+ * passes.c (init_optimization_passes): Enable pass_lim.
+
+2008-02-28 Rafael Espindola <espindola@google.com>
+
+ * tree-outof-ssa.c (insert_backedge_copies): Don't build
+ uninitialized assignment.
+
+2008-02-28 Rafael Espindola <espindola@google.com>
+
+ * tree-dfa.c (dump_dfa_stats): cast dfa_stats.max_num_phi_args to long.
+
+2008-02-26 Diego Novillo <dnovillo@google.com>
+
+ * tree-ssa-copyrename.c (rename_ssa_copies): Do not mix
+ declarations with code.
+ * tree-ssa-coalesce.c (create_outofssa_var_map): Likewise.
+ * tree-dfa.c (dump_dfa_stats): Use %ld for
+ dfa_stats.max_num_phi_args.
+
+2008-02-26 Bill Maddox <maddox@google.com>
+
+ * tree-ssa-ccp.c (maybe_fold_stmt_addition):
+ Reinstated this function for tuples as-is.
+ (valid_gimple_rhs_p): New function. Mostly lifted from
+ valid_gimple_epxression_p, which is likely obsolete.
+ (fold_stmt_r): Reinstated commented-out cases for
+ tuples. Replaced call to obsolete function set_rhs.
+ (get_maxval_strlen): Convert to tuples.
+ (ccp_fold_builtin): Partial conversion to tuples.
+ (fold_gimple_assign): New function.
+ (fold_gimple_cond): New function.
+ (fold_gimple_call): New function.
+ (fold_stmt): Convert to tuples.
+ (fold_stmt_inplace): Convert to tuples.
+ * tree-ssa-propagate.c (substitute_and_fold):
+ Update call to fold_stmt for revised argument signature.
+ * gimple-dummy.c (fold_stmt): Removed dummy definition.
+ * gimplify.c (gimplify_call_expr): Removed obsolete
+ manipulation of TREE_NOTHROW flag.
+ * cfgexpand.c (gimple_to_tree): Set nothrow flag
+ of call expression based on call statement flags.
+ Handle GIMPLE_NOP statement.
+ * tree-flow.h (notice_special_calls, fold_stmt):
+ Update prototypes for tuples.
+ * gimple.c (gimple_cond_set_condition_from_tree):
+ New function.
+ (gimple_seq_has_side_effects): New function.
+ * gimple.h (gimple_cond_set_condition_from_tree,
+ gimple_seq_has_side_effects): New prototypes.
+ (gimple_call_nothrow_p): New function.
+ (gsi_stmt_ptr): Add comment regarding usage of this
+ function vs. gsi_replace.
+ * tree-cfg.c (struct rus_data): Convert to tuples.
+ (remove_useless_stmts_1, remove_useless_stmts_warn_notreached,
+ remove_useless_stmts_cond, remove_useless_stmts_tf,
+ remove_useless_stmts_tc, remove_useless_stmts_goto,
+ remove_useless_stmts_label, notice_special_calls,
+ remove_useless_stmts): Convert to tuples.
+ (update_call_expr_flags): Removed.
+ * passes.c (init_optimization_passes): Enable
+ pass_remove_useless_stmts.
+
+2008-02-25 Bill Maddox <maddox@google.com>
+
+ * tree-into-ssa.c (rewrite_initialize_block):
+ Avoid declaration following statement in block.
+ * tree-nrv.c (tree_nrv):
+ Avoid declaration following statement in block.
+ * tree-eh.c (collect_finally_tree): Fix typo in comment.
+ Avoid cast to union type.
+ (replace_goto_queue_cond_clause, replace_goto_queue_1,
+ maybe_record_in_goto_queue, verify_norecord_switch_expr,
+ lower_try_finally_fallthru_label): Avoid cast to union type.
+ * fortran/Make-lang.in: Add -Wno-missing-format-attribute
+ to fortran-warn options to avoid conflict with -Wno-format.
+ * gimplify.c (gimplify_switch_expr): Change assignment
+ to initialiation.
+ (gimplify_case_label_expr): Avoid declaration following
+ statement in block.
+ * tree-ssa-coalesce.c (create_outofssa_var_map): Avoid
+ declaration following statement in block.
+ * tree-ssa.c (ssa_redirect_edge, flush_pending_stmts):
+ Avoid declaration following statements in block.
+ * Makefile.in: Add -Wno-missing-format-attribute
+ to builtins.o-warn and expr.o-warn options to avoid conflict
+ with -Wno-format. Removed fortran/*-warn options, -Wno-format
+ and -Wno-uninitialized, which belong in fortran/Make-lang.in,
+ and are applied to all fortran files there.
+
+2008-02-25 Oleg Ryjkov <olegr@google.com>
+
+ http://gcc.gnu.org/ml/gcc-patches/2008-02/msg01236.html
+
+ * tree-ssa-copyrename.c: Include gimple.h
+ Tuplify.
+ * tree-ssa.c (warn_uninit): Pass &LOCUS to warning().
+ * passes.c (init_optimization_passes): Enable
+ pass_early_warn_uninitialized, pass_rebuild_cgraph_edges
+ and pass_early_inline.
+
+2008-02-25 Diego Novillo <dnovillo@google.com>
+
+ * Makefile.in (tree-ssa-copyrename.o): Add dependency on
+ gimple.h.
+
+2008-02-25 Diego Novillo <dnovillo@google.com>
+
+ * tree-cfgcleanup.c (tree_forwarder_block_p): Revert
+ previous change.
+
+2008-02-25 Diego Novillo <dnovillo@google.com>
+
+ http://gcc.gnu.org/ml/gcc-patches/2008-02/msg01217.html
+
+ * tree-ssa-alias-warnings.c: Tuplify.
+ * cgraphunit.c (cgraph_process_new_functions): Remove
+ calls to gimple_unreachable.
+ (cgraph_expand_function): Likewise.
+ * omp-low.c (execute_expand_omp): Return 0 after call to
+ gimple_unreachable.
+ * tree-scalar-evolution.c (scev_const_prop): Likewise.
+ (execute_lower_omp): Likewise.
+ * tree-ssa-dse.c (execute_simple_dse): Likewise.
+ * tree-ssa-dom.c (tree_ssa_dominator_optimize): Likewise.
+ (eliminate_degenerate_phis): Likewise.
+ * tree-ssa-propagate.c (get_rhs): Likewise.
+ (valid_gimple_expression_p): Likewise.
+ (set_rhs): Likewise.
+ (fold_predicate_in): Likewise.
+ * tree-nrv.c (execute_return_slot_opt): Likewise.
+ * predict.c (tree_estimate_probability): Likewise.
+ * tree-parloops.c (parallelize_loops): Likewise.
+ * tree-if-conv.c (main_tree_if_conversion): Likewise.
+ * tree-ssa-phiopt.c (tree_ssa_phiopt): Likewise.
+ (tree_ssa_cs_elim): Likewise.
+ * tree-sra.c (tree_sra): Likewise.
+ (tree_sra_early): Likewise.
+ * tree-predcom.c (tree_predictive_commoning): Likewise.
+ * tree-ssa-copy.c (execute_copy_prop): Likewise.
+ * lambda-code.c (gcc_loop_to_lambda_loop): Likewise.
+ (perfect_nest_p): Likewise.
+ (can_convert_to_perfect_nest): Likewise.
+ (perfect_nestify): Likewise.
+ * tree-optimize.c (execute_fixup_cfg): Likewise.
+ * tree-object-size.c (compute_object_sizes): Likewise.
+ * tree-cfg.c (remove_useless_stmts): Likewise.
+ (gimple_duplicate_sese_tail): Likewise.
+ (move_sese_region_to_fn): Likewise.
+ (gimple_purge_dead_abnormal_call_edges): Likewise.
+ (execute_warn_function_return): Likewise.
+ * value-prof.c (gimple_histogram_value): Remove calls to
+ gimple_unreachable.
+ (gimple_stringop_fixed_value): Likewise.
+ * tree-flow-inline.h (op_iter_next_use): Likewise.
+ * tree-dfa.c (dump_variable): Likewise.
+ * tree-ssa-copy.c (may_propagate_copy): Likewise.
+ (may_propagate_copy_into_asm): Likewise.
+ (merge_alias_info): Likewise.
+ (replace_exp_1): Likewise.
+ * tree-ssa.c (delete_tree_ssa): Likewise.
+ * tree-cfg.c (make_edges): Likewise.
+ (remove_useless_stmts): Likewise.
+ (gimple_duplicate_sese_tail): Likewise.
+ (move_sese_region_to_fn): Likewise.
+ (gimple_purge_dead_abnormal_call_edges): Likewise.
+ (execute_warn_function_return): Likewise.
+ * passes.c (finish_optimization_passes): Likewise.
+ (init_optimization_passes): Likewise.
+ * tree-ssa-operands.c (add_call_clobber_ops): Likewise.
+ * tree-eh.c (lookup_expr_eh_region): New.
+ (tree_can_throw_external): Return false after call to
+ gimple_unreachable.
+ (maybe_clean_or_replace_eh_stmt): Re-enable.
+ Call stmt_could_throw_p.
+ * expr.c (expand_expr_real): Call lookup_expr_eh_region.
+ * profile.c: Tuplify.
+ * calls.c: Include tree-flow.h.
+ (emit_call_1): Call lookup_expr_eh_region.
+ (expand_call): Likewise.
+ * cfgexpand.c (gimple_to_tree): Call SET_EXPR_LOCATION on
+ generated expression tree T.
+ Set EH region number on T's annotation.
+ * common.opt (fgimple-conversion=): Add RejectNegative
+ and Joined attributes.
+ * tree-inline.c (unsave_r): Abort if *TP is a
+ STATEMENT_LIST.
+ (unsave_expr_now): Re-enable.
+ * tree-flow.h (struct tree_ann_common_d): Add field RN.
+ * Makefile.in (builtins.o-warn): Add -Wno-format.
+ (expr.o-warn): Likewise.
+ (fortran/check.o-warn): Likewise.
+ (fortran/interface.o-warn): Likewise.
+ (fortran/resolve.o-warn): Likewise.
+ (fortran/simplify.o-warn): Likewise.
+ (fortran/target-memory.o-warn): Likewise.
+ (calls.o): Add dependency on tree-flow.h
+ * gimple.c (gimple_build_asm_1): Call ggc_alloc_string to
+ copy STRING.
+ * gimple.h (gimple_filename): New.
+ (gimple_lineno): New.
+ * passes.c (init_optimization_passes): Disable
+ pass_remove_useless_stmts pass_mudflap_1,
+ pass_warn_function_return and pass_lower_omp.
+ * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Tuplify.
+ (rs6000_alloc_sdmode_stack_slot): Likewise.
+ * tree-cfgcleanup.c (tree_forwarder_block_p): Fix test
+ for PHI_WANTED.
+
+2008-02-25 Rafael Espindola <espindola@google.com>
+
+ * tree-cfgcleanup.c (tree_forwarder_block_p): fix thinko.
+
+2008-02-24 Rafael Espindola <espindola@google.com>
+
+ * gimple-iterator.c (gsi_split_seq_before): Don't abort if at the
+ beginning.
+
+2008-02-23 Diego Novillo <dnovillo@google.com>
+
+ http://gcc.gnu.org/ml/gcc-patches/2008-02/msg01025.html
+
+ * gimplify.c (gimplify_one_sizepos): Call gimplify_expr with
+ STMT_P.
+
+2008-02-22 Zdenek Dvorak <ook@ucw.cz>
+
+ * gimple.c (gimple_assign_copy_p): Do not consider unary operations
+ to be copies.
+
+2008-02-22 Diego Novillo <dnovillo@google.com>
+
+ * Makefile.in (fortran/parse.o-warn,
+ fortran/simplify.o-warn): New.
+
+2008-02-22 Diego Novillo <dnovillo@google.com>
+
+ http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00961.html
+
+ Revert
+
+ 2008-02-20 Zdenek Dvorak <ook@ucw.cz>
+
+ * tree-tailcall.c: Tuplify.
+ * gimplify.c (force_gimple_operand): Remove ATTRIBUTE_UNUSED.
+ * gimple.c (gimple_assign_copy_p): Do not
+ consider unary operations to be copies.
+ (copy_or_nop_cast_stmt_rhs): New.
+ * gimple.h (copy_or_nop_cast_stmt_rhs): Declare.
+
+2008-02-21 Rafael Espindola <espindola@google.com>
+
+ * gimple.h (gimple_cond_true_p): Define.
+ (gimple_cond_false_p): Define.
+ (gimple_cond_single_var_p): Define.
+
+2008-02-21 Rafael Espindola <espindola@google.com>
+
+ * tree-tailcall.c (adjust_accumulator_values): Check that a phi was
+ found.
+
+2008-02-21 Rafael Espindola <espindola@google.com>
+
+ * tree-tailcall.c (adjust_accumulator_values): Initialize phi.
+
+2008-02-20 Zdenek Dvorak <ook@ucw.cz>
+
+ * tree-tailcall.c: Tuplify.
+ * gimplify.c (force_gimple_operand): Remove ATTRIBUTE_UNUSED.
+ * gimple.c (gimple_assign_copy_p): Do not consider unary operations
+ to be copies.
+ (copy_or_nop_cast_stmt_rhs): New.
+ * gimple.h (copy_or_nop_cast_stmt_rhs): Declare.
+
+2008-02-20 Oleg Ryjkov <olegr@google.com>
+
+ * gimplify.c (gimplify_expr): Save locus into the right
+ sequence.
+
+2008-02-20 Rafael Espindola <espindola@google.com>
+
+ * passes.c (init_optimization_passes): Enable pass_mark_used_blocks
+ and pass_cleanup_cfg_post_optimizing.
+ * tree-optimize.c (execute_cleanup_cfg_post_optimizing): call cleanup_tree_cfg.
+
+2008-02-20 Rafael Espindola <espindola@google.com>
+
+ * passes.c (init_optimization_passes): Enable pass_nrv.
+ * tree-nrv.c (finalize_nrv_r): data is now a walk_stmt_info.
+ (tree_nrv): port to gimple.
+
+2008-02-19 Oleg Ryjkov <olegr@google.com>
+
+ * gimple-pretty-print.c: Introduce support for TDF_RAW
+ flag.
+ (dump_gimple_fmt): New function.
+ (dump_gimple_assign, dump_gimple_return): Update to print
+ RAW gimple.
+ (dump_gimple_call_args): New function.
+ (dump_gimple_call, dump_gimple_switch, dump_gimple_cond,
+ dump_gimple_label, dump_gimple_bind, dump_gimple_try):
+ Update to print RAW gimple.
+ (dump_gimple_catch, dump_gimple_eh_filter,
+ dump_gimple_resx): New functions.
+ (dump_gimple_omp_for, dump_gimple_asm, dump_gimple_phi):
+ Update to print RAW gimple.
+ (dump_gimple_omp_parallel, dump_gimple_omp_atomic_load,
+ dump_gimple_omp_atomic_store): New, code moved from
+ dump_gimple_stmt, then added support to print RAW gimple.
+ (gimple_dump_stmt): Some code refactored into helper
+ subroutines.
+ * tree-cfg.c(dump_function_to_file): Print RAW gimple when
+ TDF_RAW is set.
+
+2008-02-19 Diego Novillo <dnovillo@google.com>
+
+ http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00793.html
+
+ * tree-complex.c (expand_complex_div_wide): Call gsi_bb.
+ * tree.h (std_gimplify_va_arg_expr): Change gimple_seq
+ arguments to gimple_seq *.
+ Update all users.
+ (gimplify_parameters): Change return type to gimple_seq.
+ Update all users.
+ * target.h (struct gcc_target)<gimplify_va_arg_expr>:
+ Change gimple_seq arguments to gimple_seq *.
+ Update all users.
+ * tree-phinodes.c (free_phinodes): Convert to VEC.
+ Update all users.
+ * omp-low.c (lower_rec_input_clauses): Change gimple_seq
+ arguments to gimple_seq *. Update all users.
+ (lower_reduction_clauses): Convert sub_list to
+ gimple_seq.
+ (lower_regimplify): Convert PRE to gimple_seq.
+ (lower_regimplify): Call gimple_seq_insert_before instead
+ of tsi_link_before.
+ * tree-gimple.h (get_initialized_tmp_var,
+ get_formal_tmp_var, gimplify_expr, gimplify_type_sizes,
+ gimplify_one_sizepos, gimplify_stmt, gimplify_and_add,
+ gimplify_va_arg_expr): Change gimple_seq arguments to
+ gimple_seq *. Update all users.
+ * gimple-iterator.c: Include value-prof.h.
+ (gsi_link_seq_before): Remove. Update all users.
+ (gsi_link_seq_after): Remove. Update all users.
+ (gsi_link_after): Remove. Update all users.
+ (gsi_link_before): Remove. Update all users.
+ (update_bb_for_stmts): New.
+ (gsi_insert_seq_nodes_before): New.
+ (gsi_insert_seq_nodes_after): New.
+ (gsi_insert_seq_before): Re-write. Call
+ gsi_insert_seq_nodes_before.
+ (gsi_insert_seq_after): Re-write. Call
+ gsi_insert_seq_nodes_after.
+ (gsi_replace): Re-enable EH updating.
+ (update_modified_stmt): Move earlier in the file.
+ (gsi_insert_after): Re-write. Call
+ gsi_insert_seq_nodes_after.
+ (gsi_insert_before): Re-write. Call
+ gsi_insert_seq_nodes_before.
+ (gsi_remove): Move from gimple.h. Re-write.
+ * langhooks.h (struct lang_hooks): Change gimple_seq
+ arguments for gimplify_expr to gimple_seq *.
+ Update all users.
+ * coretypes.h (struct gimple_seq_d): Rename from struct
+ gimple_sequence. Update all users.
+ (struct gimple_seq_node_d): New.
+ (gimple_seq_node): New.
+ (const_gimple_seq_node): New.
+ * tree-flow.h (force_gimple_operand): Change gimple_seq
+ argument to gimple_seq *. Update all users.
+ * c-common.h (c_gimplify_expr): Change gimple_seq
+ argument to gimple_seq *. Update all users.
+ * Makefile.in (build):
+ * gimple.c (gimple_seq_cache): New.
+ (gimple_seq_alloc): Take sequences from gimple_seq_cache,
+ if possible.
+ (gimple_seq_free): New.
+ (gimple_seq_add_stmt): Rename from gimple_seq_add.
+ Change gimple_seq argument to gimple_seq *. Update all users.
+ (gimple_seq_add_seq): Rename from gimple_seq_append.
+ Update all users.
+ (gimple_remove): Remove. Update all users.
+ (gimple_seq_reverse): Remove unused function.
+ (gimple_set_bb): Only update block-to-labels map if
+ CFUN->CFG exists.
+ * gimple.h (struct gimple_seq_node_d): New.
+ (struct gimple_seq_d): Change fields 'first' and 'last'
+ to type gimple_seq_node. Update all users.
+ Add field 'next_free'.
+ (gimple_seq_first): Change return type to
+ gimple_seq_node. Update all users.
+ (gimple_seq_first_stmt): New.
+ (gimple_seq_last): Change return type to gimple_seq_node.
+ Update all users.
+ (gimple_seq_last_stmt): New.
+ (gimple_seq_set_first): Change second argument to type
+ gimple_seq_node. Update all users.
+ (gimple_seq_set_last): Change second argument to type
+ gimple_seq_node. Update all users.
+ (gimple_seq_init): Remove. Update all users.
+ (struct gimple_statement_base): Remove field 'next' and
+ 'prev'. Update all users.
+ (struct gimple_statement_omp): Change fields of type
+ struct gimple_sequence to type gimple_seq. Update all
+ users.
+ (struct gimple_statement_bind): Likewise.
+ (struct gimple_statement_catch): Likewise.
+ (struct gimple_statement_eh_filter): Likewise.
+ (struct gimple_statement_try): Likewise.
+ (struct gimple_statement_wce): Likewise.
+ (struct gimple_statement_omp_for): Likewise.
+ (gimple_set_prev): Remove. Update all users.
+ (gimple_set_next): Remove. Update all users.
+ (gimple_next): Remove. Update all users.
+ (gimple_prev): Remove. Update all users.
+ (gimple_seq_bb): New.
+ (gimple_catch_handler_ptr): New.
+ (gimple_stmt_iterator): Remove field 'stmt'.
+ Add field 'ptr'. Update all users.
+ (gsi_remove): Move to gimple-iterator.c
+ * tree-cfg.c (pass_build_cfg): Re-enable PROP_gimple_leh.
+ * Makefile.in (builtins.o-warn, expr.o-warn, dse.o-warn,
+ ebitmap.o-warn, lower-subreg.o-warn, tree-chrec.o-warn):
+ Change -Wno-error to -Wno-uninitialized.
+
+2008-02-19 Rafael Espindola <espindola@google.com>
+
+ * tree-eh.c (collect_finally_tree): handle GIMPLE_SWITCH.
+
+2008-02-19 Aldy Hernandez <aldyh@redhat.com>
+
+ * gimple.h (gimple_cond_invert): Remove prototype.
+ (update_stmt_if_modified): Fix typo in comment.
+ * gimple.c (walk_gimple_asm): Fix typo in comment.
+
+2008-02-13 Bill Maddox <maddox@google.com>
+
+ * tree-inline.c (estimate_operator_cost):
+ Removed operators superseded by tuplified statement forms.
+ Small cosmetic reordering of a few switch cases.
+
+2008-02-13 Oleg Ryjkov <olegr@google.com>
+
+ * tree.h: New function declaration.
+ * gimple-dummy.c (tree_inlinable_function_p): Removed.
+ * ipa-inline.c (compute_inline_parameters): Removed
+ gcc_unreachable ().
+ * calls.c (gimple_alloca_call_p): New function.
+ * tree-inline.c (inline_forbidden_p_1): Split in two and removed.
+ (inline_forbidden_p_op, inline_forbidden_p_stmt): New functions.
+ (inline_forbidden_p): Tuplified.
+ (estimate_operator_cost): Added missing cases.
+ * passes.c (init_optimization_passes): Enabled pass_inline_parameters,
+ pass_ipa_function_and_variable_visibility, pass_ipa_early_inline,
+ pass_inline_parameters, pass_rebuild_cgraph_edges passes.
+
+2008-02-13 Diego Novillo <dnovillo@google.com>
+
+ http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00459.html
+
+ * gimple.def (GIMPLE_TRY): Tidy comment.
+ * gimple-pretty-print.c (dump_gimple_stmt): Handle TDF_VOPS and
+ TDF_MEMSYMS.
+
+2008-02-13 Diego Novillo <dnovillo@google.com>
+
+ http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00455.html
+
+ * tree-complex.c (update_complex_components): Handle
+ GIMPLE_CALL and GIMPLE_ASSIGN.
+ (expand_complex_libcall): Set SSA_NAME_DEF_STMT on LHS.
+ * tree-ssa-operands.c (maybe_add_call_clobbered_vops):
+ Rename from get_call_expr_operands. Update all users.
+ Convert to handle GIMPLE_CALL instead of CALL_EXPR.
+ (get_modify_stmt_operands): Remove. Update all users.
+ (get_expr_operands): Do not handle CALL_EXPR, COND_EXPR,
+ VEC_COND_EXPR, GIMPLE_MODIFY_STMT, BLOCK, EXC_PTR_EXPR
+ and FILTER_EXPR.
+ (parse_ssa_operands): Call maybe_add_call_clobbered_vops
+ after parsing operands if STMT is a GIMPLE_CALL.
+
+2008-02-12 Zdenek Dvorak <ook@ucw.cz>
+ Bill Maddox <maddox@google.com>
+
+ http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00429.html
+
+ * tree-inline.h (estimate_num_insns_fn): Declare.
+ * cgraphunit.c (cgraph_process_new_functions):
+ Use estimate_num_insns_fn.
+ * ipa-inline.c (compute_inline_parameters): Ditto.
+ * gimple-dummy.c (estimate_move_cost, estimate_num_insns):
+ Removed.
+ * tree-inline.c (struct eni_data, estimate_num_insns_1):
+ Removed.
+ (estimate_num_insns): Rewritten.
+ (operation_cost, estimate_num_insns_fn): New functions.
+ * gimple.c (gimple_copy): Unshare operands. Update
+ operand caches.
+ * gimple.h (gimple_set_no_warning): New.
+ (gimple_cond_set_true_label, gimple_cond_set_false_label):
+ Allow setting the label to NULL.
+ * tree-ssa-operands.c (copy_virtual_operands): Handle statements
+ without virtual operands.
+
+2008-02-12 Zdenek Dvorak <ook@ucw.cz>
+
+ http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00429.html
+
+ * tree-into-ssa.c (update_ssa): Remove ATTRIBUTE_UNUSED.
+ * tree-ssa-loop-ch.c: Tuplified.
+ * gimple-iterator.c (gsi_commit_one_edge_insert): Ditto.
+ * tree-cfg.c (gimple_redirect_edge_and_branch,
+ gimple_try_redirect_by_replacing_jump, gimple_merge_blocks,
+ gimple_block_label, gimple_redirect_edge_and_branch_force,
+ gimple_duplicate_bb): Ditto.
+ (make_cond_expr_edges): Remove the labels.
+ (cleanup_dead_labels): Handle conditions without labels.
+ (gimple_make_forwarder_block): Do not reverse the list
+ of phi nodes.
+ (gimple_duplicate_sese_region): Enable ssa updates.
+ (gimple_cfg_hooks): Enable edge redirection and bb duplication.
+ * gimple-pretty-print.c (dump_gimple_cond): Do not dump
+ branches if labels are null.
+ (dump_implicit_edges): Dump implicit GIMPLE_COND edges.
+
+2008-02-12 Diego Novillo <dnovillo@google.com>
+
+ http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00429.html
+
+ * tree-vrp.c (range_includes_zero_p): Partially re-enable.
+ (ssa_name_nonnegative_p): Partially re-enable.
+ (ssa_name_nonzero_p): Likewise.
+ * gimple-dummy.c (ssa_name_nonzero_p): Remove.
+ (ssa_name_nonnegative_p): Remove.
+ * tree-cfg.c (gimple_split_block): Convert to tuples.
+
+2008-02-12 Aldy Hernandez <aldyh@redhat.com>
+
+ Merge with mainline @132177
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2008-02-08 Diego Novillo <dnovillo@google.com>
+
+ http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00273.html
+
+ * gimplify.c (gimplify_call_expr): Remove code to set
+ TREE_SIDE_EFFECTS.
+ * gimple.c (gimple_has_side_effects): New.
+ * gimple.h (gimple_has_side_effects): Declare.
+ * tree-cfg.c (stmt_can_make_abnormal_goto): Call.
+
+2008-02-07 Diego Novillo <dnovillo@google.com>
+
+ * gimple.h (gimple_call_num_args): Rename from
+ gimple_call_nargs. Update all users.
+
+2008-02-07 Aldy Hernandez <aldyh@redhat.com>
+
+ * gimplify.c: Remove various FIXMEs that have been resolved.
+
+2008-02-06 Aldy Hernandez <aldyh@redhat.com>
+
+ * gimple.def: Add GIMPLE_OMP_ATOMIC_{LOAD,STORE} entires.
+ * gsstruct.def: Add GSS_OMP_ATOMIC_{LOAD,STORE} entries.
+ * gimple-pretty-print.c (dump_gimple_stmt): Add case for
+ GIMPLE_OMP_ATOMIC_{LOAD,STORE}.
+ * gimplify.c (gimplify_omp_atomic): Enable and convert to tuples.
+ * tree.def: Add FIXME notes.
+ * gimple.c (gss_for_code): Add cases for
+ GIMPLE_OMP_ATOMIC_{LOAD,STORE}.
+ (gimple_size): Same.
+ (gimple_build_omp_atomic_load): New.
+ (gimple_build_omp_atomic_store): New.
+ * gimple.h (struct gimple_statement_omp_atomic_{load,store}): New.
+ (union gimple_statement_d): Add gimple_omp_atomic_{load,store}.
+ (gimple_omp_atomic_store_set_val): New.
+ (gimple_omp_atomic_store_val): New.
+ (gimple_omp_atomic_load_set_lhs): New.
+ (gimple_omp_atomic_load_lhs): New.
+ (gimple_omp_atomic_load_set_rhs): New.
+ (gimple_omp_atomic_load_rhs): New.
+ * tree-cfg.c (verify_types_in_gimple_seq_2): Add cases for
+ GIMPLE_OMP_ATOMIC_{LOAD,STORE}.
+
+2008-02-05 Diego Novillo <dnovillo@google.com>
+
+ http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00161.html
+
+ * gimple-iterator.c (gsi_split_seq_after): Change
+ argument type to gimple_stmt_iterator. Update all users.
+ (gsi_for_stmt): Return gimple_stmt_iterator. Update all users.
+ (gimple_find_edge_insert_loc): Change GSI argument to
+ gimple_stmt_iterator. Update all users.
+ * gimple.c (gimple_seq_deep_copy): Change argument to gimple_seq.
+ Update all users.
+ * gimple.h (gsi_alloc): Remove. Update all users.
+ (gsi_start): Return gimple_stmt_iterator. Update all users.
+ (gsi_start_bb): Likewise.
+ (gsi_last): Likewise.
+ (gsi_last_bb): Likewise.
+ (gsi_end_p): Change argument to gimple_stmt_iterator.
+ Update all users.
+ (gsi_one_before_end_p): Likewise.
+ (gsi_stmt): Likewise.
+ (gsi_bb): Likewise.
+ (gsi_seq): Likewise.
+ (gsi_split_seq_after): Likewise.
+ (gsi_for_stmt): Likewise.
+ (gsi_after_labels): Return gimple_stmt_iterator. Update all users.
+
+2008-02-05 Aldy Hernandez <aldyh@redhat.com>
+
+ * gimple-pretty-print.c (dump_gimple_stmt): Print clauses for
+ GIMPLE_OMP_PARALLEL.
+ Handle GIMPLE_OMP_FOR.
+ (dump_gimple_omp_for): New.
+ * tree-pretty-print.c (dump_omp_clauses): Remove static.
+ * diagnostic.h (dump_omp_clauses): Add prototype.
+ * gimplify.c (gimplify_omp_for): Convert to tuples and enable.
+ (gimplify_omp_workshare): Same.
+ (gimplify_expr) [OMP_MASTER, OMP_ORDERED, OMP_CRITICAL]: Same.
+
+2008-02-04 Oleg Ryjkov <olegr@google.com>
+
+ * tree-gimple.c (get_gimple_rhs_class): Handle
+ FILTER_EXPR.
+ * tree-eh.c (union treemple): Declare.
+ Convert to tuples.
+ * except.c:
+ * except.h (lang_protect_cleanup_actions): Change return
+ type to 'gimple'. Update all users.
+ * tree-inline.c (count_insns_seq): New.
+ * tree-inline.h (count_insns_seq): Declare.
+ * gimple.c (gimple_seq_deep_copy): New.
+ * gimple.h (gimple_seq_deep_copy): Declare.
+ (gimple_singleton_p): New.
+ * passes.c (init_optimization_passes): Enable
+ pass_lower_eh.
+
+2008-02-02 Aldy Hernandez <aldyh@redhat.com>
+
+ * tree.h (OMP_CLAUSE_REDUCTION_GIMPLE_INIT): New.
+ (OMP_CLAUSE_REDUCTION_GIMPLE_MERGE): New.
+ (struct tree_omp_clause): Add gimple_reduction_{init,merge} fields.
+ * gimplify.c (gimplify_scan_omp_clauses): Gimplify reduction
+ init/merge fields into separate sequences.
+ (gimplify_and_add): Use gimplify_expr directly.
+ * omp-low.c (lower_rec_input_clauses): Extract reduction info from
+ gimple tuples in structure.
+ (lower_reduction_clauses): Same.
+
+2008-02-01 Diego Novillo <dnovillo@google.com>
+
+ http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00036.html
+
+ * tree-complex.c (expand_complex_comparison): Set the RHS
+ of the new comparison to boolean_true_node.
+ * gimplify.c (gimplify_call_expr): Fix creation of new
+ GIMPLE_CALL. Create the vector of arguments in the same
+ order as the original expression.
+
+2008-02-01 Diego Novillo <dnovillo@google.com>
+
+ http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00032.html
+
+ * tree-pas.h (struct tree_opt_pass): Remove field
+ WORKS_WITH_TUPLES_P. Adjust all users.
+ * opts.c (decode_options): Force -O0.
+ * cfgexpand.c (gimple_to_tree): Handle GIMPLE_RETURN,
+ GIMPLE_ASM, GIMPLE_CALL and GIMPLE_SWITCH.
+ Show unrecognized tuple when failing.
+ (expand_gimple_basic_block): Do not use
+ gimple_stmt_iterator to go through the statements in BB.
+ Handle GIMPLE_CALL instead of CALL_EXPR.
+ (gimple_expand_cfg): Rename from tree_expand_cfg. Update
+ all users.
+ Remove PROP_gimple_leh.
+ * gimple.c (walk_gimple_seq): Guard against WI == NULL.
+ * tree-cfg.c (execute_warn_function_return): Move #if 0
+ markers.
+ * passes.c (init_optimization_passes): Adjust #if 0
+ markers to execute pass_expand.
+ Guard more passes under #if 0.
+
+2008-02-01 Rafael Espindola <espindola@google.com>
+
+ * passes.c (init_optimization_passes): Enable pass_del_ssa.
+
+ * tree-outof-ssa.c (insert_copy_on_edge): Port to tuples.
+ (eliminate_build): Likewise.
+ (eliminate_virtual_phis): Likewise.
+ (rewrite_trees): Likewise. Remove stmt_ann_t ann.
+ (stmt_list): Changed from tree to gimple_seq.
+ (identical_copies_p): Port to tuples.
+ (identical_stmt_lists_p): Likewise.
+ (init_analyze_edges_for_bb): Likewise.
+ (fini_analyze_edges_for_bb): Likewise.
+ (process_single_block_loop_latch): Likewise.
+ (analyze_edges_for_bb): LIkewise.
+ (remove_ssa_form): Likewise.
+ (insert_backedge_copies):
+ (rewrite_out_of_ssa):Likewise.
+ (pass_del_ssa): flip works_with_tuples_p. Don't require PROP_alias.
+
+ * tree-ssa-coalesce.c (build_ssa_conflict_graph): Port to tuples.
+ (abnormal_corrupt): Port to tuples.
+ (fail_abnormal_edge_coalesce): Port to tuples.
+ (create_outofssa_var_map):Port to tuples.
+ (coalesce_partitions): Port to tuples.
+
+2008-02-01 Rafael Espindola <espindola@google.com>
+
+ * tree-ssa-operands.c (free_stmt_operands): Only free
+ with_ops.addresses_taken if stmt has ops.
+
+2008-01-31 Rafael Espindola <espindola@google.com>
+
+ * tree-optimize.c (pass_free_cfg_annotations): Flip
+ works_with_tuples_p.
+ * passes.c (init_optimization_passes): Enable
+ pass_free_cfg_annotations.
+
+2008-01-30 Diego Novillo <dnovillo@google.com>
+
+ http://gcc.gnu.org/ml/gcc-patches/2008-01/msg01461.html
+
+ * tree-into-ssa.c (compute_global_livein): Initialize
+ PHI with call to gsi_stmt.
+ (rewrite_update_init_block): Likewise.
+ * tree-complex.c (expand_complex_comparison): Initialize
+ TYPE.
+ (expand_complex_operations_1): Initialize BR and BI.
+ * ebitmap.h (ebitmap_iter_init): Initialize OURN.
+ * Makefile.in (dse.o-warn, ebitmap.o-warn,
+ lower-subreg.o-warn, tree-chrec.o-warn, varasm.o-warn):
+ New.
+
+2008-01-30 Rafael Espindola <espindola@google.com>
+
+ * gimplify.c (gimplify_scan_omp_clauses): Comment out
+ pop_gimplify_context calls
+
+2008-01-30 Rafael Espindola <espindola@google.com>
+
+ * gimple.h (gsi_after_labels): Add.
+
+2008-01-30 Rafael Espindola <espindola@google.com>
+
+ * Makefile.in (tree-complex.o): Uncomment gt-tree-vect-generic.h.
+ (GTFILES): Add tree-vect-generic.c.
+ * passes.c (init_optimization_passes): Enable pass_lower_vector.
+ * tree-vect-generic.c: uncomment all the file.
+ (elem_op_func): Use gimple_stmt_iterator instead of
+ block_stmt_iterator.
+ (tree_vec_extract): Likewise. Rename bsi to gsi.
+ (do_unop): Likewise.
+ (do_binop): Likewise.
+ (do_plus_minus): Likewise.
+ (do_negate): Likewise.
+ (expand_vector_piecewise): Likewise.
+ (expand_vector_parallel): Likewise.
+ (expand_vector_addition): Likewise.
+ (expand_vector_operation): Likewise. Remove "tree rhs" param. Add
+ "gimple assign" param. Use gimple_assign_rhs1|2 instead of
+ TREE_OPERAND.
+ (expand_vector_operations_1): Use gimple_stmt_iterator instead of
+ block_stmt_iterator. Rename bsi to gsi. Use gsi_stmt instead of
+ bsi_stmt. Use gimple_assign_* instead of GIMPLE_STMT_OPERAND. Use
+ gimple_assign_set_rhs_from_tree instead of setting *p_rhs.
+ (gate_expand_vector_operations): Use gimple_stmt_iterator instead
+ of block_stmt_iterator. Use gsi_* instead of bsi_*
+ (pass_lower_vector): flip works_with_tuples_p
+ (pass_lower_vector_ssa) flip works_with_tuples_
+
+2008-01-29 Rafael Espindola <espindola@google.com>
+
+ http://gcc.gnu.org/ml/gcc-patches/2008-01/msg01434.html
+
+ * gimple.c (gimple_assign_set_rhs_with_ops): Fix
+ allocation of operand vector.
+
+2008-01-29 Diego Novillo <dnovillo@google.com>
+
+ http://gcc.gnu.org/ml/gcc-patches/2008-01/msg01434.html
+
+ * tree-into-ssa.c (prepare_block_for_update): Initialize
+ PHI.
+ * tree.c (build_gimple_modify_stmt): Fix documentation.
+
+ * tree-complex.c: Convert to tuples.
+ (pass_lower_complex_O0): Re-enable.
+
+ * ipa-cp.c (constant_val_insert): Disable.
+ * tree-gimple.c (get_gimple_rhs_class): Handle SSA_NAME.
+
+ * tree-ssa-propagate.c: Fix documentation to refer to
+ prop_simulate_again_p.
+ (add_ssa_edge): Call prop_simulate_again_p.
+ (simulate_stmt): Likewise.
+ (simulate_block): Fix loop iterating over PHI nodes.
+ * tree-ssa-propagate.h (prop_set_simulate_again): New.
+ (prop_simulate_again_p): New.
+ * gimple-iterator.c (gsi_insert_seq_after): Re-write to
+ avoid use of gimple_stmt_iterator.
+ (gimple_find_edge_insert_loc): Move from tree-cfg.c.
+ Re-enable.
+ (gsi_commit_edge_inserts): Likewise.
+ (gsi_commit_one_edge_insert): Likewise.
+ (gsi_insert_on_edge): Likewise.
+ (gsi_insert_on_edge_immediate): Likewise.
+ (gsi_insert_seq_on_edge): New.
+ * gimplify.c (gimplify_cond_expr): Call
+ gimple_cond_get_ops_from_tree.
+ * tree-optimize.c (pass_all_optimizations): Enable.
+ * gimple.c (gimple_cond_get_ops_from_tree): New.
+ (gimple_build_cond_from_tree): New.
+ * basic-block.h (struct edge_def): Replace field
+ edge_def_insns.t with gimple_seq edge_def_insns.g.
+ Update all users.
+ * gimple.h (gimple_stmt_iterator):
+ * tree-cfg.c (change_bb_for_stmt):
+ * passes.c (init_optimization_passes): Move #if0 around
+ to disable passes in groups instead of individually.
+ (execute_function_todo): Re-enable call to update_ssa.
+
+2008-01-25 Aldy Hernandez <aldyh@redhat.com>
+
+ * gimple-pretty-print.c (dump_gimple_stmt): Handle
+ GIMPLE_OMP_PARALLEL.
+ * gimplify.c (pop_gimplify_context): Add comment.
+ (gimplify_and_return_first): New.
+ (gimplify_scan_omp_clauses): Remove unused 'gs'.
+ Remove #if 0.
+ (gimplify_omp_parallel): Convert to tuples.
+ (gimplify_omp_workshare): Remove redundant retval.
+ (gimplify_expr): Adapt to lack of retval for gimplify_omp_variable and
+ gimplify_omp_workshare.
+ Abort on OMP_ATOMIC_{LOAD,STORE} case.
+
+2008-01-21 Diego Novillo <dnovillo@google.com>
+
+ Merge with mainline @131695
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge
+ string.
+ * configure: Regenerate.
+
+2008-01-15 Diego Novillo <dnovillo@google.com>
+
+ http://gcc.gnu.org/ml/gcc-patches/2008-01/msg00674.html
+
+ * tree-into-ssa.c (mark_def_sites): Force operand scan.
+ * gimple.def (GIMPLE_ASSIGN): Move into section of
+ statements with memory operands.
+ * gimple-dummy.c (remove_unused_locals): Remove.
+ * tree-flow-inline.h (noreturn_call_p,
+ mark_stmt_modified, update_stmt, update_stmt_if_modified,
+ stmt_modified_p): Remove.
+ * tree-ssa-live.c: Convert to tuples.
+ * gimple.c (gimple_set_modified): Replace
+ mark_stmt_modified. Update all callers.
+ (gimple_remove): Call free_stmt_operands.
+ * gimple.h: Include tree-ssa-operands.h
+ Move extern function declarations earlier in the file.
+ (GIMPLE_CHECK2): Remove.
+ (GIMPLE_RANGE_CHECK): Remove.
+ (struct gimple_statement_with_ops): Fix GTY markers.
+ (struct gimple_statement_with_memory_ops): Likewise.
+ (gimple_modified_p): Replace stmt_modifed_p. Update all
+ users.
+ (update_stmt): Move from tree-flow-inline.h. Update all
+ users.
+ (update_stmt_if_modified): Likewise.
+ (gimple_has_ops): Use range GIMPLE_COND ... GIMPLE_RETURN
+ (gimple_has_mem_ops): Use range GIMPLE_ASSIGN ... GIMPLE_RETURN
+ (gimple_num_ops): Call gimple_has_ops.
+ (gimple_ops): Likewise.
+ (gimple_op): Likewise.
+ (gimple_op_ptr): Likewise.
+ (gimple_set_op): Likewise.
+ (gimple_set_addresses_taken): Remove. Update all users.
+ (gimple_add_to_addresses_taken): Likewise.
+ (gimple_call_noreturn_p): Replace noreturn_call_p.
+ Update all users.
+ (gimple_phi_arg): Assert that INDEX is smaller than
+ CAPACITY.
+ * passes.c (init_optimization_passes): Enable
+ pass_referenced_vars, pass_reset_cc_flags and pass_build_ssa.
+ * tree-ssa-operands.c (gimple_set_stored_syms): Do not
+ free the STORES field if SYMS is empty.
+ (gimple_set_loaded_syms): Likewise.
+ (finalize_ssa_stmt_operands): Only call
+ finalize_ssa_vdefs and finalize_ssa_vuses if STMT has
+ memory operands.
+ (get_expr_operands): Handle CASE_LABEL_EXPR.
+ (free_stmt_operands): Free bitmaps ADDRESSES_TAKEN,
+ STORES and LOADS.
+ (gimple_add_to_addresses_taken): Rename from
+ add_to_addressable_set.
+
+2008-01-14 Aldy Hernandez <aldyh@redhat.com>
+
+ * tree-dfa.c (dump_dfa_stats): Add %z modifier to size_t argument.
+
+2008-01-11 Andrew MacLeod <amacleod@redhat.com>
+ Diego Novillo <dnovillo@google.com>
+
+ http://gcc.gnu.org/ml/gcc-patches/2008-01/msg00493.html
+
+ * tree.h (struct ssa_use_operand_d): Replace field STMT
+ with a union field LOC containing the fields STMT and
+ SSA_NAME.
+ Update all users.
+ * tree-flow.h (struct immediate_use_iterator_d): Document
+ how immediate use iteration works.
+
+2008-01-10 Diego Novillo <dnovillo@google.com>
+
+ http://gcc.gnu.org/ml/gcc-patches/2008-01/msg00444.html
+
+ * Makefile.in (tree-complex.o): Remove gt-tree-vect-generic.h
+
+2008-01-10 Diego Novillo <dnovillo@google.com>
+
+ http://gcc.gnu.org/ml/gcc-patches/2008-01/msg00436.html
+
+ * tree-ssa-operands.h (PHI_RESULT_PTR): Call
+ gimple_phi_result_ptr.
+ (PHI_ARG_DEF_PTR): Call gimple_phi_arg_imm_use_ptr.
+ (free_ssa_operands): Remove.
+ (copy_virtual_operands, create_ssa_artificial_load_stmt,
+ add_to_addressable_set, discard_stmt_changes,
+ FOR_EACH_PHI_OR_STMT_USE, FOR_EACH_PHI_OR_STMT_DEF): Convert
+ to use 'gimple'.
+ * tree-into-ssa.c: Convert to use 'gimple'.
+ (rewrite_uses_p): New. Use instead of REWRITE_THIS_STMT.
+ (set_rewrite_uses): New. Use instead of REWRITE_THIS_STMT.
+ (register_defs_p): New. Use instead of
+ REGISTER_DEFS_IN_THIS_STMT.
+ (set_register_defs): New. Use instead of
+ REGISTER_DEFS_IN_THIS_STMT.
+ (REWRITE_THIS_STMT): Remove.
+ (REGISTER_DEFS_IN_THIS_STMT): Remove.
+ * tree-pretty-print.c (dump_vops): Remove. Update all
+ users.
+ (dump_generic_node): Do not handle PHI_NODE.
+ * tree.c (tree_node_kind): Remove "phi_nodes" entry.
+ (tree_code_size): Do not handle PHI_NODE.
+ (tree_size): Likewise.
+ (make_node_stat): Likewise.
+ (tree_node_structure): Likewise.
+ (phi_node_elt_check_failed): Remove.
+ * tree.h (PHI_NODE_ELT_CHECK): Remove.
+ (PHI_RESULT_TREE): Remove.
+ (PHI_ARG_DEF_TREE): Remove.
+ (PHI_CHAIN): Remove.
+ (PHI_NUM_ARGS): Remove.
+ (PHI_ARG_CAPACITY): Remove.
+ (PHI_ARG_ELT): Remove.
+ (PHI_ARG_EDGE): Remove.
+ (PHI_BB): Remove.
+ (PHI_ARG_IMM_USE_NODE): Remove.
+ (struct tree_phi_node): Remove.
+ (union tree_node): Remove field 'phi'.
+ (release_phi_node): Change argument to gimple.
+ (duplicate_ssa_name): Change second argument to gimple.
+ (swap_tree_operands): Remove.
+ (enum tree_node_kind): Remove phi_kind entry.
+ * tree-phinodes.c: Convert to use gimple.
+ * tree-gimple.c (is_gimple_stmt): Do not handle PHI_NODE.
+ * cgraphunit.c (cgraph_process_new_functions): Call
+ gimple_unreachable to mark unconverted sections.
+ (verify_cgraph_node): Do not ICE if THIS_CFUN is NULL.
+ Convert statement verification to use gimple.
+ (cgraph_expand_function): Call gimple_unreachable to mark
+ unconverted sections.
+ * tree-ssa-propagate.c: Convert to use gimple.
+ (STMT_IN_SSA_EDGE_WORKLIST): Use flag GF_PLF_1 as marker.
+ (DONT_SIMULATE_AGAIN): Remove. Use gimple_visited.
+ * gimple-dummy.c: Remove converted functions.
+ * tree-ssa-alias.c (may_be_aliased): Re-enable.
+ * tree-flow-inline.h (gimple_phi_arg_imm_use_ptr): Rename
+ from get_phi_arg_def_ptr.
+ (bsi_start, bsi_after_labels, bsi_last, bsi_end_p,
+ bsi_next, bsi_prev, bsi_stmt, bsi_stmt_ptr): Remove.
+ * tree.def (PHI_NODE): Remove. Update most users.
+ * tree-dfa.c: Convert to use gimple.
+ * common.opt (fgimple-conversion): Default to 0.
+ * tree-ssa.c: Convert to use gimple.
+ * tree-optimize.c (pass_early_local_passes,
+ pass_all_early_optimization, pass_init_datastructures):
+ Enable.
+ * tree-flow.h (tree_ann_type): Remove STMT_ANN. Update
+ all users.
+ (struct stmt_ann_d): Remove. Update all users.
+ * Makefile.in (GIMPLE_H): Add tree-ssa-operands.h.
+ (tree-ssa-copy.o, tree-phi-nodes.o, tree-complex.o):
+ Re-enable.
+ * gimple.h (enum plf_mask): Define.
+ (GF_NO_WARNING): Remove
+ (bb_seq): Return NULL if BB->il.gimple is NULL.
+ (struct gimple_statement_base): Add bitfields no_warning,
+ visited, unused_1, unused_2, unused_3, unused_4 and plf.
+ (gimple_flags, gimple_set_flags, gimple_add_flag):
+ Remove. Update all users.
+ (gimple_set_visited): New.
+ (gimple_visited_p): New.
+ (gimple_set_plf): New.
+ (gimple_plf): New.
+ (gimple_has_volatile_ops): New.
+ (gimple_set_has_volatile_ops): New.
+ (gimple_addresses_taken): New.
+ (gimple_set_addresses_taken): New.
+ (gimple_add_to_addresses_taken): New.
+ (gimple_phi_result_ptr): New.
+ (gsi_stmt_ptr): New.
+ (gsi_bb): New.
+ (gsi_seq): New.
+ * tree-cfg.c (execute_build_cfg): Do not call
+ gimple_set_body after building the CFG.
+ (pass_build_cfg): Do not require PROP_gimple_leh.
+ (gimplify_val): Convert to gimple.
+ * passes.c (init_optimization_passes): Disable all of
+ pass_all_early_optimizations.
+ * tree-ssanames.c: Convert to gimple.
+ * tree-ssa-operands.c: Convert to gimple.
+ (gimple_set_stored_syms): New.
+ (gimple_set_loaded_syms): New.
+
+2008-01-03 Diego Novillo <dnovillo@google.com>
+
+ Merge with mainline @131303
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge
+ string.
+ * configure: Regenerate.
+
+2007-12-20 Diego Novillo <dnovillo@google.com>
+
+ * Makefile.in (builtins.o-warn, expr.o-warn): Add
+ -Wno-error.
+
+2007-12-05 Diego Novillo <dnovillo@google.com>
+
+ http://gcc.gnu.org/ml/gcc-patches/2007-12/msg00221.html
+
+ * gimple.c (walk_gimple_asm): Guard against WI being
+ NULL.
+ (walk_gimple_stmt): Likewise.
+
+2007-12-05 Diego Novillo <dnovillo@google.com>
+
+ http://gcc.gnu.org/ml/gcc-patches/2007-12/msg00216.html
+
+ * tree.h (gimple_unreachable_1): Declare.
+ (gimple_unreachable): Define.
+ Replace calls to gcc_unreachable with gimple_unreachable
+ in unconverted code.
+ * gimple-dummy.c (gimple_unreachable_1): New function.
+ * common.opt (fgimple-only): Remove.
+ (fgimple-conversion): Define.
+ * Makefile.in (STRICT_WARN): Add -Wno-return-type.
+
+2007-11-30 Diego Novillo <dnovillo@google.com>
+
+ Merge with mainline @130470
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge
+ string.
+ * configure: Regenerate.
+ * tree-inline.c (copy_decl_no_change,
+ copy_decl_for_dup_finish): Re-enable.
+
+2007-11-26 Aldy Hernandez <aldyh@redhat.com>
+
+ * gimple.h (gimple_bind_block): Update comment.
+
+2007-11-19 Diego Novillo <dnovillo@google.com>
+
+ Merge with mainline @130291.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2007-11-19 Diego Novillo <dnovillo@google.com>
+
+ * tree-flow-inline.h (get_lineno): Call IS_LOCATION_EMPTY
+ and LOCATION_LINE instead of accessing location fields
+ directly.
+ * gimple-low.c (lower_function_body): Use
+ UNKNOWN_LOCATION instead of unknown_location.
+
+2007-11-16 Diego Novillo <dnovillo@google.com>
+
+ * cgraph.c (cgraph_create_edge): Call gimple_body
+ instead of DECL_SAVED_TREE.
+ (dump_cgraph_node): Likewise.
+ * cgraphunit.c (verify_cgraph_node): Likewise.
+ (cgraph_analyze_functions): Likewise.
+ (cgraph_mark_functions_to_output): Likewise.
+ (cgraph_optimize): Likewise.
+ * tree-eh.c (lower_eh_constructs): Add notes for future
+ changes to calls to DECL_SAVED_TREE.
+ (refactor_eh_r): Likewise.
+ * cfgexpand.c (gimple_to_tree): New function.
+ (maybe_dump_rtl_for_gimple_stmt): Rename from
+ maybe_dump_rtl_for_tree_stmt. Convert to tuples.
+ (label_rtx_for_bb): Convert to tuples.
+ (expand_gimple_cond): Rename from
+ expand_gimple_cond_expr. Convert to tuples.
+ (expand_gimple_tailcall): Convert to tuples.
+ (expand_gimple_basic_block): Convert to tuples.
+ (discover_nonconstant_array_refs_r): Convert to tuples.
+ (discover_nonconstant_array_refs): Convert to tuples.
+ * tree-mudflap.c (execute_mudflap_function_decls): Add
+ deprecation comment for DECL_SAVED_TREE call.
+ * tree-inline.c (copy_generic_body): Call gimple_body
+ instead of DECL_SAVED_TREE.
+ (inlinable_function_p): Likewise.
+ (clone_body): Add deprecation comment for DECL_SAVED_TREE
+ call.
+ * tree-cfg.c (remove_useless_stmts_bind): Call
+ gimple_body instead of DECL_SAVED_TREE.
+ (remove_useless_stmts): Likewise.
+
+2007-11-10 Aldy Hernandez <aldyh@redhat.com>
+
+ * tree-cfg.c (verify_types_in_gimple_call): OBJ_TYPE_REF are allowed
+ as function types.
+
+ [objc]
+ * objc-act.c (objc_gimplify_expr): Change pre and post to sequences.
+ * objc-act.h (objc_gimplify_expr): Change prototype accordingly.
+
+ [testsuite]
+ * lib/objc.exp: Set -I regardless of libobjc.
+
+2007-11-10 Aldy Hernandez <aldyh@redhat.com>
+
+ * tree-gimple.h (tree_annotate_all_with_locus): New.
+ * gimple-dummy.c: Add omp_reduction_init and
+ diagnose_omp_structured_block_errors.
+ * gimplify.c (tree_should_carry_locus_p): New.
+ (tree_annotate_one_with_locus): New.
+ (tree_annotate_all_with_locus): New.
+
+2007-11-08 Diego Novillo <dnovillo@google.com>
+
+ Merge with mainline @129982
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2007-11-01 Diego Novillo <dnovillo@google.com>
+
+ * cgraphbuild.c (initialize_inline_failed): Re-enable.
+ (build_cgraph_edges): Adapt to use tuples.
+ (pass_build_cgraph): Re-enable.
+ (rebuild_cgraph_edges): Adapt to use tuples.
+ * cgraph.c (cgraph_release_function_body): Also NULLify the
+ gimple body.
+ (debug_cgraph_node): New.
+ (debug_cgraph): New.
+ * cgraph.h (struct cgraph_edge): Change field CALL_STMT to
+ type gimple. Update all users.
+ * cgraphunit.c (cgraph_analyze_functions): If DECL does not
+ have a struct function entry, discard it.
+ * gimple.h (GF_CALL_CANNOT_INLINE): New.
+ (gimple_call_lhs_ptr): New.
+ (gimple_call_mark_uninlinable): New.
+ (gimple_call_cannot_inline_p): New.
+ (struct walk_stmt_info): Add field PSET.
+
+2007-11-01 Diego Novillo <dnovillo@google.com>
+
+ * tree-optimize.c (tree_rest_of_compilation): Call
+ gimple_set_body to remove the body if not inlining.
+ * gimple.c (walk_gimple_stmt): Update documentation.
+ Pass WI->PSET to every call to walk_tree.
+
+2007-11-01 Diego Novillo <dnovillo@google.com>
+
+ * langhooks.h (struct lang_hooks_for_callgraph): Remove third
+ argument from function pointer ANALYZE_EXPR. Update all
+ users.
+
+2007-10-30 Diego Novillo <dnovillo@google.com>
+
+ * gimple.c (gimple_build_omp_return): Call
+ gimple_omp_return_set_nowait if needed.
+ * gimple.h (GIMPLE_CHECK, GIMPLE_CHECK2, GIMPLE_RANGE_CHECK):
+ Move earlier in the file.
+ (GF_NO_WARNING): Change to static const unsigned.
+ (GF_CALL_TAILCALL): New.
+ (GF_OMP_PARALLEL_COMBINED): Rename from
+ OMP_PARALLEL_COMBINED_FLAG. Change to static const unsigned.
+ Update all users.
+ (GF_OMP_RETURN_NOWAIT): Rename from OMP_RETURN_NOWAIT_FLAG.
+ Change to static const unsigned.
+ Update all users.
+ (GF_OMP_SECTION_LAST): Rename from OMP_SECTION_LAST_FLAG.
+ Change to static const unsigned.
+ Update all users.
+ (gimple_omp_return_set_nowait): New.
+ (gimple_call_set_tail): New.
+ (gimple_call_tail_p): New.
+
+2007-10-30 Aldy Hernandez <aldyh@redhat.com>
+
+ * gimplify.c (get_tmp_var_for): Remove reference to IS_FORMAL in
+ opening comment.
+ (gimplify_return_expr): Return GS_ERROR if we have errored.
+ (gimplify_statement_list): Handle case where voidify_wrapper returns a
+ temporary.
+ (gimplify_call_expr): Return gracefully on error.
+ (gimplify_cond_expr): Same.
+ * gimple.h (gimple_call_return_type): Do not error on methods.
+
+2007-10-29 Diego Novillo <dnovillo@google.com>
+ Tom Tromey <tromey@redhat.com>
+
+ * gimple.h (gimple_locus): Update comment.
+ (gimple_set_locus): Likewise.
+ (gimple_locus_empty_p): Add support for mapped locations.
+
+2007-10-29 Diego Novillo <dnovillo@google.com>
+
+ * tree-optimize.c (execute_cleanup_cfg_pre_ipa): Re-enable.
+ * gimple.c (walk_gimple_asm): Tidy comment.
+
+2007-10-29 Aldy Hernandez <aldyh@redhat.com>
+
+ * tree-gimple.h (build_gimple_eh_filter_tree): Remove.
+ * gimplify.c (build_gimple_eh_filter_tree): Move from here...
+ * cp/cp-gimplify.c: ...to here.
+ (cp_gimplify_init_expr): Convert to tuples.
+ (gimplify_must_not_throw_expr): Make function return a
+ gimplify_status and convert to tuples.
+ (cp_gimplify_expr): Convert MUST_NOT_THROW_EXPR, INIT_EXPR, and
+ USING_STMT to tuples.
+
+2007-10-28 Aldy Hernandez <aldyh@redhat.com>
+
+ * gimplify.c (gimplify_body): Make work when body contains more than
+ a GIMPLE_BIND statement.
+
+2007-10-26 Diego Novillo <dnovillo@google.com>
+
+ Merge with mainline @129659.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2007-10-26 Diego Novillo <dnovillo@google.com>
+
+ * gimple-low.c (lower_builtin_setjmp): Pass ARG to first
+ call to gimple_build_call.
+
+2007-10-17 Aldy Hernandez <aldyh@redhat.com>
+
+ * tree-gimple.c (get_gimple_rhs_class): Add case for EXC_PTR_EXPR.
+ * gimplify.c (gimple_conditional_context): Enable.
+ (gimplify_cleanup_point_expr): Enable. Adjust for tuples.
+ (gimple_push_cleanup): Enable.
+ (gimplify_target_expr): Do not gimplify TARGET_EXPR_CLEANUP before
+ calling gimple_push_cleanup.
+ (gimplify_expr): Rename `try' to `try_'.
+ Enable CLEANUP_POINT_EXPR case.
+ Gimplify CATCH_EXPR and EH_FILTER_EXPR cases correctly.
+
+2007-10-17 Aldy Hernandez <aldyh@redhat.com>
+
+ * gimple.c (gimple_size): Handle GIMPLE_WITH_CLEANUP_EXPR.
+ * gimple.h (struct gimple_statement_catch): Make handler a structure,
+ not a pointer.
+ (struct gimple_statement_eh_filter): Make failure a structure, not a
+ pointer.
+ document EH_FILTER_MUST_NOT_THROW subcode flag.
+ (gimple_catch_handler): Handler is now a struct.
+ (gimple_catch_set_handler): Same.
+ (gimple_eh_filter_failure): Failure is now a struct.
+ (gimple_eh_filter_set_failure): Same.
+ (gimple_eh_filter_must_not_throw): New.
+ (gimple_eh_filter_set_must_not_throw): New.
+ (gsi_next): Update comment.
+ (gsi_prev): Same.
+ * tree-cfg.c (verify_types_in_gimple_seq_2): Handle GIMPLE_EH_FILTER.
+
+2007-10-18 Diego Novillo <dnovillo@google.com>
+
+ * gimple-iterator.c (gsi_delink): Remove.
+ * gimple.h (gsi_delink): Remove.
+
+2007-10-17 Diego Novillo <dnovillo@google.com>
+
+ * coretypes.h (const_gimple_seq): New typedef.
+ * gimple.h (gimple_seq_first): Constify argument.
+ (gimple_seq_last): Likewise.
+ (gimple_seq_copy): Likewise.
+ (gimple_seq_empty_p): Likewise.
+ (gimple_set_prev): Rename from set_gimple_prev.
+ Update all users.
+ (gimple_set_next): Rename from set_gimple_next.
+ Update all users.
+ (gimple_set_flags): Rename from set_gimple_flags.
+ Update all users.
+ (gimple_add_flag): Rename from add_gimple_flag.
+ Update all users.
+ (gimple_set_subcode): Rename from set_gimple_subcode.
+ Update all users.
+ (gimple_set_block): Rename from set_gimple_block.
+ Update all users.
+ (gimple_set_locus): Rename from set_gimple_locus.
+ Update all users.
+ (gimple_locus_empty_p): Constify argument.
+ (gimple_has_ops): Likewise.
+ (gimple_has_mem_ops): Likewise.
+ (gimple_def_ops): Likewise.
+ (gimple_set_def_ops): Rename from set_gimple_def_ops.
+ Update all users.
+ (gimple_use_ops): Constify argument.
+ (gimple_set_use_ops): Rename from set_gimple_use_ops.
+ Update all users.
+ (gimple_vuse_ops): Constify argument.
+ (gimple_set_vuse_ops): Rename from set_gimple_vuse_ops.
+ Update all users.
+ (gimple_vdef_ops): Constify argument.
+ (gimple_set_vdef_ops): Rename from set_gimple_vdef_ops.
+ Update all users.
+ (gimple_loaded_syms): Constify argument.
+ (gimple_stored_syms): Constify argument.
+ (gimple_modified): Constify argument.
+ (gimple_set_modified): Rename from set_gimple_modified.
+ Update all users.
+ (gimple_omp_return_nowait_p): Constify argument.
+ (gimple_omp_section_last_p): Constify argument.
+ (gimple_omp_parallel_combined_p): Constify argument.
+ (gimple_build_return): Rename from build_gimple_return.
+ Update all users.
+ (gimple_build_assign): Rename from build_gimple_assign.
+ Update all users.
+ (gimple_build_assign_with_ops): Rename from
+ build_gimple_assign_with_ops.
+ Update all users.
+ (gimple_build_call_vec): Rename from build_gimple_call_vec.
+ Update all users.
+ (gimple_build_call): Rename from build_gimple_call.
+ Update all users.
+ (gimple_build_cond): Rename from build_gimple_cond.
+ Update all users.
+ (gimple_build_label): Rename from build_gimple_label.
+ Update all users.
+ (gimple_build_goto): Rename from build_gimple_goto.
+ Update all users.
+ (gimple_build_nop): Rename from build_gimple_nop.
+ Update all users.
+ (gimple_build_asm): Rename from build_gimple_asm.
+ Update all users.
+ (gimple_build_asm_vec): Rename from build_gimple_asm_vec.
+ Update all users.
+ (gimple_build_catch): Rename from build_gimple_catch.
+ Update all users.
+ (gimple_build_eh_filter): Rename from build_gimple_eh_filter.
+ Update all users.
+ (gimple_build_try): Rename from build_gimple_try.
+ Update all users.
+ (gimple_build_wce): Rename from build_gimple_wce.
+ Update all users.
+ (gimple_build_resx): Rename from build_gimple_resx.
+ Update all users.
+ (gimple_build_switch): Rename from build_gimple_switch.
+ Update all users.
+ (gimple_build_switch_vec): Rename from
+ build_gimple_switch_vec. Update all users.
+ (gimple_build_omp_parallel): Rename from
+ build_gimple_omp_parallel. Update all users.
+ (gimple_build_omp_for): Rename from build_gimple_omp_for.
+ Update all users.
+ (gimple_build_omp_critical): Rename from
+ build_gimple_omp_critical.
+ Update all users.
+ (gimple_build_omp_section): Rename from
+ build_gimple_omp_section. Update all users.
+ (gimple_build_omp_continue): Rename from
+ build_gimple_omp_continue. Update all users.
+ (gimple_build_omp_master): Rename from
+ build_gimple_omp_master. Update all users.
+ (gimple_build_omp_ordered): Rename from
+ build_gimple_omp_ordered. Update all users.
+ (gimple_build_omp_sections): Rename from
+ build_gimple_omp_sections. Update all users.
+ (gimple_build_omp_single): Rename from
+ build_gimple_omp_single. Update all users.
+ (gimple_set_body): Rename from set_gimple_body. Update all
+ users.
+ (gimple_set_bb): Rename from set_gimple_bb. Update all users.
+ (is_gimple_operand): Constify argument.
+ (gimple_ops): Likewise.
+ (gimple_op_ptr): Likewise.
+ (gimple_call_lhs): Likewise.
+ (gimple_call_return_type): Likewise.
+ (gimple_call_chain): Likewise.
+ (gimple_call_arg_ptr): Likewise.
+ (gimple_cond_true_label): Likewise.
+ (gimple_bind_vars): Likewise.
+ (gimple_bind_set_body): Likewise.
+ (gimple_bind_block): Likewise.
+ (gimple_asm_ninputs): Likewise.
+ (gimple_asm_noutputs): Likewise.
+ (gimple_asm_nclobbers): Likewise.
+ (gimple_asm_input_op): Likewise.
+ (gimple_asm_output_op): Likewise.
+ (gimple_asm_clobber_op): Likewise.
+ (gimple_asm_string): Likewise.
+ (gimple_asm_volatile_p): Likewise.
+ (gimple_catch_types): Likewise.
+ (gimple_catch_handler): Likewise.
+ (gimple_eh_filter_types): Likewise.
+ (gimple_eh_filter_failure): Likewise.
+ (gimple_try_kind): Likewise.
+ (gimple_try_set_eval): Likewise.
+ (gimple_try_set_cleanup): Likewise.
+ (gimple_wce_set_cleanup): Likewise.
+ (gimple_wce_cleanup_eh_only): Likewise.
+ (gimple_phi_capacity): Likewise.
+ (gimple_phi_num_args): Likewise.
+ (gimple_phi_result): Likewise.
+ (gimple_resx_region): Likewise.
+ (gimple_switch_num_labels): Likewise.
+ (gimple_switch_label): Likewise.
+ (gimple_switch_default_label): Likewise.
+ (gimple_omp_set_body): Likewise.
+ (gimple_omp_critical_name): Likewise.
+ (gimple_omp_for_clauses): Likewise.
+ (gimple_omp_for_index): Likewise.
+ (gimple_omp_for_initial): Likewise.
+ (gimple_omp_for_final): Likewise.
+ (gimple_omp_for_incr): Likewise.
+ (gimple_omp_for_set_pre_body): Likewise.
+ (gimple_omp_parallel_clauses): Likewise.
+ (gimple_omp_parallel_child_fn): Likewise.
+ (gimple_omp_parallel_data_arg): Likewise.
+ (gimple_omp_single_clauses): Likewise.
+ (gimple_omp_sections_clauses): Likewise.
+ (gimple_omp_for_cond): Likewise.
+ (gimple_return_retval): Likewise.
+ (is_gimple_omp): Likewise.
+ (gimple_nop_p): Likewise.
+ (gimple_expr_type): Likewise.
+
+2007-10-17 Diego Novillo <dnovillo@google.com>
+
+ * tree-ssa-loop-manip.c (gimple_duplicate_loop_to_header_edge): Rename
+ from tree_duplicate_loop_to_header_edge.
+ Update all users.
+ * value-prof.c: Convert and enable all functions in the file.
+ (gimple_divmod_fixed_value): Rename from
+ tree_divmod_fixed_value.
+ (gimple_mod_pow2): Rename from tree_mod_pow2.
+ (gimple_mod_subtract): Rename from tree_mod_subtract.
+ (gimple_divmod_fixed_value_transform): Rename from
+ tree_divmod_fixed_value_transform.
+ (gimple_mod_pow2_value_transform): Rename from
+ tree_mod_pow2_value_transform.
+ (gimple_mod_subtract_transform): Rename from
+ tree_mod_subtract_transform.
+ (gimple_stringops_transform): Rename from tree_stringops_transform.
+ (gimple_ic_transform): Rename from tree_ic_transform.
+ Update all users.
+ * value-prof.h (gimple_register_value_prof_hooks): Rename from
+ tree_register_value_prof_hooks. Update all users.
+ * tree.h (OMP_DIRECTIVE_P): Remove. Update all users.
+ (validate_arglist): Move to gimple.h.
+ * builtins.c: (validate_arglist): Change first argument to
+ const_gimple. Disable most callers.
+ * gimple.def: Document all GIMPLE codes.
+ * tree-gimple.c (is_gimple_operand): New.
+ (get_gimple_rhs_class)<ADDR_EXPR>: Accept as a
+ GIMPLE_SINGLE_RHS.
+ <WITH_SIZE_EXPR>: Likewise.
+ (get_gimple_rhs_num_ops): New.
+ (is_gimple_call_addr): Tidy.
+ * tree-gimple.h (get_gimple_rhs_num_ops): Declare.
+ * gimple-dummy.c (free_histograms, stringop_block_profile):
+ Remove.
+ * gimple-low.c (lower_function_body): Tidy.
+ * predict.c (gimple_predicted_by_p): Rename from
+ tree_predicted_by_p. Update all users.
+ (gimple_predict_edge): Rename from tree_predict_edge. Update
+ all users.
+ * gimple-iterator.c (gsi_link_seq_after): Update documentation.
+ (gsi_link_after): Likewise.
+ * tree-eh.c (stmt_could_throw_1_p): New.
+ (stmt_could_throw_p): New.
+ * gimple-pretty-print.c (dump_unary_rhs): Print ADDR_EXPR as
+ a single operand.
+ (dump_gimple_switch): Support NULL case labels.
+ (dump_gimple_asm): Dump outputs first.
+ * gimplify.c (compare_case_labels): Make the default label
+ sort first.
+ (sort_case_labels): Do not special case the default label.
+ (gimplify_init_ctor_eval): Gimplify initializer expressions.
+ (gimplify_modify_expr): Unshare the operands before setting
+ them on the new GIMPLE_ASSIGN statement.
+ (gimplify_asm_expr): NULLify the chain on operands before
+ putting them on the input/output vectors.
+ * tree-cfgcleanup.c: Convert and enable CFG cleanup functions.
+ (cleanup_control_expr_graph): Call gimple_fold.
+ * tree-flow.h (gimple_block_label): Rename from
+ tree_block_label. Update all users.
+ (gimple_duplicate_sese_region): Rename from
+ tree_duplicate_sese_region. Update all users.
+ (gimple_duplicate_sese_tail): Rename from
+ tree_duplicate_sese_tail. Update all users.
+ (gimple_purge_dead_abnormal_call_edges): Rename from
+ tree_purge_dead_abnormal_call_edges. Update all users.
+ (gimple_purge_all_dead_eh_edges): Rename from
+ tree_purge_all_dead_eh_edges. Update all users.
+ (stmt_could_throw_p): Declare.
+ (add_stmt_to_eh_region_fn): Move from except.h.
+ (remove_stmt_from_eh_region_fn): Likewise.
+ (lookup_stmt_eh_region_fn): Likewise.
+ (lookup_stmt_eh_region): Likewise.
+ (verify_eh_edges): Likewise.
+ * Makefile.in (GIMPLE_H): Add dependencies on GGC_H, TM_H and
+ TARGET_H.
+ (ipa-inline.o): Add dependency on TREE_FLOW_H.
+ (out_object_file): Add dependency on TREE_GIMPLE_H.
+ * gimple.c (gimple_set_code): Rename from set_gimple_code.
+ (gimple_size): New.
+ (gimple_alloc): New.
+ (gimple_alloc_ops): New.
+ (build_gimple_with_ops): Call them.
+ (build_gimple_return): Only call gimple_return_set_retval if
+ RETVAL is not NULL.
+ (build_gimple_call): Validate argument FN.
+ (extract_ops_from_tree): New.
+ (build_gimple_assign_with_ops): New.
+ (build_gimple_assign): Call them.
+ (build_gimple_nop): Call gimple_alloc.
+ (build_gimple_bind): Likewise.
+ (build_gimple_asm_1): Tidy.
+ (build_gimple_asm_vec): Tidy.
+ (build_gimple_asm): Tidy.
+ (build_gimple_catch): Call gimple_alloc.
+ (build_gimple_eh_filter): Likewise.
+ (build_gimple_try): Likewise.
+ (build_gimple_wce): Likewise.
+ (build_gimple_phi): Remove.
+ (build_gimple_resx): Call gimple_alloc.
+ (build_gimple_switch_1): Tidy.
+ (build_gimple_switch): Tidy.
+ (build_gimple_omp_critical): Call gimple_alloc.
+ (build_gimple_omp_for): Likewise.
+ (build_gimple_omp_parallel): Likewise.
+ (build_gimple_omp_section): Likewise.
+ (build_gimple_omp_master): Likewise.
+ (build_gimple_omp_continue): Likewise.
+ (build_gimple_omp_ordered): Likewise.
+ (build_gimple_omp_return): Likewise.
+ (build_gimple_omp_sections): Likewise.
+ (build_gimple_omp_single): Likewise.
+ (gimple_check_failed): Change GS to const_gimple. Update all
+ users.
+ (gimple_range_check_failed): Likewise.
+ (walk_gimple_seq): Change return type to tree. Update all
+ users.
+ If the call to walk_gimple_stmt returns non-NULL,
+ return it immediately.
+ (walk_gimple_asm): Change return type to tree. Update all
+ users.
+ If the call to walk_tree returns non-NULL, return it.
+ (walk_gimple_stmt): Likewise.
+ (gimple_fold): New.
+ (gimple_assign_set_rhs_from_tree): New.
+ (gimple_assign_set_rhs_with_ops): New.
+ (gimple_copy): New.
+ * basic-block.h (gimple_predicted_by_p): Rename from
+ tree_predicted_by_p. Update all users.
+ (gimple_predict_edge): Rename from tree_predict_edge. Update
+ all users.
+ * gimple.h: Add documentation to all inline functions.
+ (gimple_seq_first): Return NULL if S is NULL.
+ (gimple_seq_last): Likewise.
+ (GF_ASM_VOLATILE): Define.
+ (GF_NO_WARNING): Rename from GIMPLE_NO_WARNING. Update all
+ users.
+ (build_gimple_assign_with_ops): Declare.
+ (build_gimple_asm): Change unsigned arguments to size_t.
+ Update all users.
+ (build_gimple_switch): Likewise.
+ (build_gimple_phi): Remove.
+ (validate_arglist): Declare.
+ (gimple_fold): Declare.
+ (gimple_assign_set_rhs_from_tree): Declare.
+ (gimple_assign_set_rhs_with_ops): Declare.
+ (gimple_copy): Declare.
+ (is_gimple_operand): Declare.
+ (gimple_num_ops): Change argument to const_gimple.
+ Return 0 if GS is not one of the statements that has tree
+ operands.
+ (gimple_ops): New.
+ (gimple_op): Change argument to const_gimple.
+ If GS is not a statement that has tree operands, return NULL.
+ (gimple_op_ptr): Likewise.
+ (gimple_assign_subcode): Change argument to const_gimple.
+ (gimple_assign_operand): Remove. Update all users.
+ (gimple_assign_set_operand): Remove. Update all users.
+ (gimple_assign_lhs): Change argument type to const_gimple.
+ (gimple_assign_rhs1): Likewise.
+ (gimple_assign_rhs2): Likewise.
+ (gimple_assign_set_rhs1): Assert that RHS is a valid operand.
+ (gimple_assign_set_rhs2): Likewise.
+ (gimple_call_lhs): Call gimple_op.
+ (gimple_call_set_lhs): Assert that LHS is a valid operand.
+ Call gimple_set_op.
+ (gimple_call_set_fn): New.
+ (gimple_call_fndecl): Change argument type to const_gimple.
+ Call gimple_call_fn.
+ (gimple_call_chain): Call gimple_op.
+ (gimple_call_set_chain): Assert that CHAIN is valid.
+ Call gimple_set_op.
+ (gimple_call_nargs): Change argument to const_gimple.
+ Call gimple_op.
+ (gimple_call_arg_ptr): Call gimple_op_ptr.
+ (gimple_call_set_arg): Assert that ARG is valid.
+ Call gimple_set_op.
+ (gimple_cond_code): Change argument to const_gimple.
+ (gimple_cond_lhs): Change argument to const_gimple.
+ (gimple_cond_set_lhs): Assert that the operand is valid.
+ Call gimple_set_op.
+ (gimple_cond_rhs): Change argument to const_gimple.
+ Call gimple_op.
+ (gimple_cond_true_label): Call gimple_op.
+ (gimple_cond_false_label): Likewise.
+ (gimple_label_label): Likewise.
+ (gimple_cond_set_true_label): Assert that the operand is
+ valid.
+ Call gimple_set_op.
+ (gimple_cond_set_false_label): Likewise.
+ (gimple_goto_dest): Change argument to const_gimple.
+ Call gimple_set_op.
+ (gimple_goto_set_dest): Assert that the operand is valid.
+ Call gimple_set_op.
+ (gimple_asm_ninputs): Change return type to size_t. Update
+ all users.
+ (gimple_asm_noutputs): Likewise.
+ (gimple_asm_nclobbers): Rename from gimple_asm_nclobbered.
+ Change return type to size_t.
+ Update all users.
+ (gimple_asm_set_input_op): Assert that the argument is
+ valid.
+ (gimple_asm_set_output_op): Likewise.
+ (gimple_asm_set_clobber_op): Likewise.
+ (gimple_asm_volatile_p): New.
+ (gimple_asm_set_volatile): New.
+ (gimple_asm_clear_volatile): New.
+ (gimple_phi_set_capacity): Remove.
+ (gimple_phi_set_nargs): Remove.
+ (gimple_expr_type): New.
+ (struct walk_stmt_info): Remove fields want_bind_expr and
+ want_return_expr. Update all users.
+ * tree-cfg.c: Convert all functions for CFG cleanup and
+ verification.
+ (gimple_redirect_edge_and_branch): Rename from
+ tree_redirect_edge_and_branch.
+ (gimple_try_redirect_by_replacing_jump): Rename from
+ tree_try_redirect_by_replacing_jump.
+ (gimple_verify_flow_info): Rename from tree_verify_flow_info.
+ (gimple_make_forwarder_block): Rename from
+ tree_make_forwarder_block.
+ (gimple_cfg2vcg): Rename from tree_cfg2vcg.
+ (gimple_merge_blocks): Rename from tree_merge_blocks.
+ (gimple_can_merge_blocks_p): Rename from tree_merge_blocks_p.
+ (gimple_can_remove_branch_p): Rename from tree_can_remove_branch_p.
+ (gimple_redirect_edge_and_branch): Rename from
+ tree_redirect_edge_and_branch.
+ (gimple_move_block_after): Rename from tree_move_block_after.
+ (gimple_predict_edge): Rename from tree_predict_edge.
+ (gimple_predicted_by_p): Rename from tree_predicted_by_p.
+ (gimple_duplicate_bb): Rename from tree_duplicate_bb.
+ (gimple_can_duplicate_bb_p): Rename from tree_can_duplicate_bb_p.
+ (gimple_split_edge): Rename from tree_split_edge.
+ (gimple_make_forwarder_block): Rename from tree_make_forwarder_block.
+ (gimple_block_ends_with_call_p): Rename from
+ tree_block_ends_with_call_p.
+ (gimple_block_ends_with_condjump_p): Rename from
+ tree_block_ends_with_condjump_p.
+ (gimple_flow_call_edges_add): Rename from
+ tree_flow_call_edges_add.
+ (gimple_execute_on_growing_pred): Rename from
+ tree_execute_on_growing_pred.
+ (gimple_execute_on_shrinking_pred): Rename from
+ tree_execute_on_shrinking_pred.
+ (gimple_duplicate_loop_to_header_edge): Rename from
+ tree_duplicate_loop_to_header_edge.
+ (gimple_lv_add_condition_to_bb): Rename from
+ tree_lv_add_condition_to_bb.
+ (gimple_lv_adjust_loop_header_phi): Rename from
+ tree_lv_adjust_loop_header_phi.
+ (struct pass_build_cfg): Enable TODO_verify_stmts and
+ TODO_cleanup_cfg.
+ * passes.c (execute_function_todo): Enable call to
+ cleanup_tree_cfg.
+
+2007-10-17 Aldy Hernandez <aldyh@redhat.com>
+
+ * gimple.def: Add GIMPLE_WITH_CLEANUP_EXPR.
+ * gsstruct.def: Add GSS_WCE.
+ * gimple-iterator.c (gsi_delink): New.
+ (gsi_split_seq_*): Update comment.
+ * gimple.c (gss_for_code): Handle GIMPLE_WCE. Adjust whitespace.
+ (build_gimple_wce): New.
+ * gimple.h (struct gimple_statement_wce): New.
+ (union gimple_statement_d): Add gimple_wce.
+ (build_gimple_wce): Protoize.
+ (gimple_wce_cleanup): New.
+ (gimple_wce_set_cleanup): New.
+ (gimple_wce_cleanup_eh_only): New.
+ (gimple_wce_set_cleanup_eh_only): New.
+ (gsi_delink): Protoize.
+
+2007-10-12 Aldy Hernandez <aldyh@redhat.com>
+
+ * Makefile.in (GIMPLE_H): Depend on TARGET_H.
+ * gimple.h (gsi_alloc): New.
+ (_ALLOC_GSI): Remove.
+ Replace _ALLOC_GSI uses by gsi_alloc.
+
+2007-10-12 Aldy Hernandez <aldyh@redhat.com>
+
+ * gimple.h (_ALLOC_GSI): New.
+ Use it throughout when allocating a new gimple_stmt_iterator.
+
+2007-10-11 Aldy Hernandez <aldyh@redhat.com>
+
+ Merge with mainline @129233.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2007-10-11 Aldy Hernandez <aldyh@redhat.com>
+
+ * cfg.c: Include tree-flow.h.
+ (remove_edge_raw): Call redirect_edge_var_map_clear.
+ (redirect_edge_succ_nodup): Call redirect_edge_var_map_dup.
+ * tree-flow-inline.h (redirect_edge_var_map_def): New.
+ (redirect_edge_var_map_result): New.
+ * tree-cfgcleanup.c (remove_forwarder_block_with_phi): Replace
+ PENDING_STMT use with redirect_edge_var_map_*.
+ * tree-ssa.c (edge_var_maps): New definition.
+ (redirect_edge_var_map_add): New.
+ (redirect_edge_var_map_clear): New.
+ (redirect_edge_var_map_dup): New.
+ (redirect_edge_var_map_vector): New.
+ (redirect_edge_var_map_destroy): New.
+ (ssa_redirect_edge): Replace PENDING_STMT use with
+ redirect_edge_var_map_*.
+ (flush_pending_stmts): Same.
+ (delete_tree_ssa): Destroy edge var map.
+ * tree-flow.h (struct _edge_var_map): New.
+ Define edge_var_map vector type.
+ Declare redirect_edge_var_map_* prototypes.
+ * Makefile.in (cfg.o): Depend on TREE_FLOW_H.
+ * tree-cfg.c (reinstall_phi_args): Replace
+ PENDING_STMT use with redirect_edge_var_map_*.
+
+2007-10-02 Diego Novillo <dnovillo@google.com>
+
+ Merge with mainline @128957.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2007-09-24 Diego Novillo <dnovillo@google.com>
+
+ Merge with mainline @128708.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2007-09-24 Diego Novillo <dnovillo@google.com>
+
+ * gimple.h (gimple_code): Change argument type to
+ const_gimple.
+ (gimple_flags): Likewise.
+ (gimple_subcode): Likewise.
+ (gimple_next): Likewise.
+ (gimple_prev): Likewise.
+ (gimple_bb): Likewise.
+ (gimple_block): Likewise.
+ (gimple_locus): Likewise.
+
+2007-09-15 Diego Novillo <dnovillo@google.com>
+
+ * gimple-iterator.c (gsi_replace): Call gsi_insert_before and
+ gsi_remove to do the replacement.
+ (gsi_insert_before): Take the basic block from the iterator.
+ (gsi_insert_after): Likewise.
+ * gimple-iterator.h: Move inside gimple.h.
+ * tree-eh.c (make_eh_edge, make_eh_edges): Enable.
+ * gimple-pretty-print.c (dump_gimple_seq, dump_gimple_cond,
+ dump_gimple_bind, dump_gimple_try): Do not handle TDF_DETAILS.
+ (dump_gimple_switch): Fix display of case labels.
+ (dump_gimple_stmt): Handle TDF_DIAGNOSTIC.
+ (pp_cfg_jump): New.
+ (dump_implicit_edges): New.
+ (gimple_dump_bb_buff): Call it.
+ * domwalk.c (walk_dominator_tree):
+ * gimplify.c (gimplify_switch_expr): Fix generation of
+ GIMPLE_SWITCH labels.
+ (gimplify_case_label_expr): Emit a label for CASE_LABEL
+ instead of the CASE_LABEL_EXPR.
+ * Makefile.in (GIMPLE_H): Add dependency on BASIC_BLOCK_H.
+ * gimple.c (walk_gimple_stmt): Reverse meaning of return value
+ of CALLBACK_STMT. Update all users.
+ Walk sub-statements of statements with bodies.
+ * gimple.h (GCC_GIMPLE_H): Rename from GCC_GIMPLE_IR_H.
+ Include vec.h, tm.h, hard-reg-set.h and basic-block.h.
+ (bb_seq, set_bb_seq): Move from tree-flow-inline.h
+ (gimple_label_set_label): Do not allow CASE_LABEL_EXPR.
+ (gsi_start_bb): New. Update all users that were calling
+ gsi_start (bb_seq ()).
+ (struct gimple_stmt_iterator): Add field 'bb'.
+ * tree-cfg.c (build_gimple_cfg): Enable.
+ (create_bb): Create a new sequence if the given one is NULL.
+ (make_gimple_switch_edges): Rename from make_switch_expr_edges.
+ Update all users.
+ (cleanup_dead_labels): Fix handling of GIMPLE_SWITCH.
+ (group_case_labels): Likewise.
+ (verify_types_in_gimple_stmt): Do not allow CASE_LABEL_EXPR in
+ a GIMPLE_LABEL.
+
+2007-09-13 Diego Novillo <dnovillo@google.com>
+
+ * tree-pretty-print.c (dump_symbols, dump_generic_bb,
+ dump_bb_header, dump_bb_end, dump_phi_nodes, pp_cfg_jump,
+ dump_implicit_edges, dump_generic_bb_buff): Remove.
+ * value-prof.c (histogram_eq): Enable.
+ (dump_histograms_for_stmt): Adapt to tuples.
+ * value-prof.h (struct):
+ * cfghooks.h (struct cfg_hooks)<dump_bb>: Add int argument.
+ Update all users.
+ * gimple-dummy.c (gimple_remove_stmt_histograms,
+ remove_stmt_from_eh_region): Remove.
+ * gimple-iterator.h (gsi_start): Support NULL sequences.
+ * tree-eh.c (add_stmt_to_eh_region): Enable.
+ (remove_stmt_from_eh_region): Enable.
+ (lookup_stmt_eh_region): Enable.
+ (tree_could_throw_p): Enable.
+ (stmt_can_throw_internal): Enable.
+ * gimple-pretty-print.c: Include value-prof.h
+ (dump_gimple_cond): Do not insert a newline initially.
+ (dump_gimple_bind): Likewise.
+ (dump_gimple_try): Likewise.
+ (dump_gimple_asm): Likewise.
+ (dump_symbols): Move from tree-pretty-print.c
+ (dump_gimple_phi): New.
+ (dump_gimple_stmt): Call it..
+ (dump_bb_header): Move from tree-pretty-print.c
+ (dump_bb_end): Likewise.
+ (dump_phi_nodes): Likewise.
+ (gimple_dump_bb_buff): New.
+ (gimple_dump_bb): New.
+ * Makefile.in (gimple-pretty-print.o): Add dependency
+ value-prof.h
+ * tree-cfg.c (fold_cond_expr_cond): Handle cases where
+ fold_binary returns NULL.
+ (make_cond_expr_edges): Take locus from the first statement of
+ the destination blocks.
+ (tree_dump_bb): Remove.
+ (gimple_debug_bb): Rename from debug_tree_bb.
+ Update all users.
+ (gimple_debug_bb_n): Rename from debug_tree_bb_n.
+ Update all users.
+ (gimple_debug_cfg): Rename from debug_tree_cfg.
+ Update all users.
+ (gimple_dump_cfg): Rename from dump_tree_cfg.
+ Update all users.
+ (is_ctrl_altering_stmt): Call gimple_call_flags to determine
+ whether the function is const/pure.
+ * tree-ssa-operands.c (stmt_references_memory_p): Enable.
+
+2007-09-11 Diego Novillo <dnovillo@google.com>
+
+ * tree.h (struct tree_ssa_name): Add field def_stmt.
+ (SSA_NAME_DEF_STMT): Return it.
+ * tree-phinodes.c (create_phi_node): Return gimple.
+ Update all callers.
+ (add_phi_args): Change PHI argument to gimple. Update all
+ callers.
+ (remove_phi_node): Call gimple_remove.
+ (phi_reverse): Remove. Update all users.
+ * tree-ssa-alias-warnings.c: Disable.
+ * input.h (IS_LOCATION_EMPTY): Fix comparison of LOCATION_LINE.
+ * fold-const.c: Include gimple.h.
+ (fold_undefer_overflow_warnings): Change type of argument STMT to
+ gimple. Update all users.
+ * cfghooks.h (struct cfg_hooks)<can_merge_blocks_p>: Change
+ arguments to basic_block. Update all users.
+ * tree-gimple.c (get_gimple_rhs_class): Change argument to
+ enum tree_code. Update all users. Move calls to
+ is_gimple_lvalue and is gimple_val...
+ (is_gimple_formal_tmp_rhs): ... here.
+ * tree-ssa-ccp.c (fold_stmt_r): Enable.
+ (fold_stmt): Enable.
+ (fold_stmt_inplace): Enable. Adapt to tuples.
+ * ipa-pure-const.c (analyze_function): Disable.
+ * tree-ssa-propagate.c (get_rhs): Adapt to tuples. Update all
+ users.
+ * gimple-dummy.c (ssa_operands_active): Remove dummy function.
+ (remove_stmt_from_eh_region, create_phi_node, add_phi_arg,
+ substitute_in_loop_info, release_defs, push_stmt_changes,
+ pop_stmt_changes, replace_exp): Add dummy functions.
+ * predict.c: Disable.
+ * gimple-iterator.c: Include tm.h and tree-flow.h
+ (gsi_delink): Remove. Update all users.
+ (update_modified_stmt): Move from tree-cfg.c.
+ (gsi_insert_before): New.
+ (gsi_insert_seq_before): New.
+ (gsi_insert_after): New.
+ (gsi_insert_seq_after): New.
+ (gsi_for_stmt): New.
+ (gsi_move_after): New.
+ (gsi_move_before): New.
+ (gsi_move_to_bb_end): New.
+ * gimple-iterator.h (gsi_remove): New.
+ * tree-eh.c (add_stmt_to_eh_region_fn): Add comment
+ (add_stmt_to_eh_region): Likewise.
+ (remove_stmt_from_eh_region_fn): Likewise.
+ (remove_stmt_from_eh_region): Likewise.
+ (lookup_stmt_eh_region_fn): Likewise.
+ (lookup_stmt_eh_region): Likewise.
+ (tree_could_throw_p): Likewise.
+ (stmt_can_throw_internal): Likewise.
+ (tree_can_throw_external): Likewise.
+ * gimple-pretty-print.c (op_gimple_cond): Remove. Update all
+ users.
+ * tree-affine.c (tree_to_aff_combination_expand): Disable.
+ * tree-flow-inline.h (op_iter_init_vdef): Call gimple_code
+ instead of TREE_CODE.
+ * gimplify.c (gimplify_cond_expr): Use enum tree_code instead
+ of enum gimple_cond as the subcode for GIMPLE_COND.
+ Do not switch around the conditional when the then clause is empty.
+ (tree_to_gimple_tuple): Remove. Update all users.
+ (gimplify_omp_for):
+ (force_gimple_operand_gsi): Rename from force_gimple_operand_bsi. Update all users.
+ * tree-dfa.c (find_referenced_vars): Disable.
+ (collect_dfa_stats): Likewise.
+ (collect_dfa_stats_r): Likewise.
+ * cfgexpand.c: Disable.
+ * tree-mudflap.c: Disable.
+ * print-tree.c: Include diagnostic.h.
+ (print_node): Call print_gimple_stmt when printing SSA_NAMEs.
+ * lambda-code.c: Disable.
+ * tree-profile.c (tree_init_edge_profiler): Disable.
+ (tree_gen_edge_profiler): Disable.
+ * tree-flow.h (block_stmt_iterator): Remove. Update all users.
+ (const_block_stmt_iterator): Likewise.
+ * Makefile.in (print-tree.o): Add dependency on $(DIAGNOSTIC_H).
+ (gimple-iterator.o): Add dependency on $(TREE_FLOW_H) and
+ value-prof.h.
+ (gimple.o): Likewise.
+ (fold-const.o): Add dependency on $(GIMPLE_H).
+ * gimple.c: Include tm.h, hard-reg-set.h, basic-block.h,
+ tree-flow.h and value-prof.h.
+ (build_gimple_with_ops): Do not allocate operands if NUM_OPS == 0.
+ (build_gimple_return): Remove argument RESULT_DECL_P. Update
+ all users.
+ (build_gimple_cond): Use enum tree_code instead of enum
+ gimple_cond as the subcode. Update all users.
+ (gimple_cond_invert): Remove. Update all users.
+ (walk_gimple_seq): Add arguments CALLBACK_STMT and
+ CALLBACK_OP. Update all users.
+ (walk_gimple_asm): Likewise.
+ (walk_gimple_stmt): Likewise.
+ (gimple_remove): New.
+ (gimple_seq_reverse): New.
+ (set_gimple_bb): New.
+ * gimple.h (gimple_statement_base): Split field 'flags' into
+ fields 'subcode' and 'flags'. Update all users.
+ (gimple_statement_with_ops): Rename field 'base' to
+ 'gsbase'. Update all users.
+ (gimple_statement_omp): Likewise.
+ (gimple_statement_bind): Likewise.
+ (gimple_statement_catch): Likewise.
+ (gimple_statement_eh_filter): Likewise.
+ (gimple_statement_phi): Likewise.
+ (gimple_statement_resx): Likewise.
+ (gimple_statement_try): Likewise.
+ (gimple_statement_omp_parallel): Likewise.
+ (enum gimple_cond): Remove. Update all users.
+ (GIMPLE_NO_WARNING): Define.
+ (set_gimple_flags): Assert that FLAGS fits in 8 bits.
+ (add_gimple_flag): Likewise.
+ (set_gimple_subcode): New. Use instead of set_gimple_flags
+ everywhere.
+ (gimple_subcode): New. Use instead of gimple_flags
+ everywhere.
+ (gimple_no_warning_p): New.
+ (gimple_cond_set_code): New.
+ (gimple_cond_make_false): New.
+ (gimple_cond_make_true): New.
+ (gimple_phi_num_args): Rename from gimple_phi_nargs. Update
+ all users.
+ * tree-cfg.c (build_gimple_cfg): Return immediately.
+ (set_bb_for_stmt): Remove. Move functionality to
+ set_gimple_bb. Update all users.
+ (factor_computed_gotos):
+ (bsi_for_stmt): Remove.
+ (bsi_insert_before): Remove.
+ (bsi_insert_seq_before): Remove.
+ (bsi_insert_after): Remove.
+ (bsi_insert_seq_after): Remove.
+ (bsi_remove): Remove.
+ (bsi_move_after): Remove.
+ (bsi_move_before): Remove.
+ (bsi_move_to_bb_end): Remove.
+ (bsi_replace): Remove.
+ (tree_verify_flow_info): Adapt to tuples.
+ (tree_make_forwarder_block): Likewise.
+ (tree_try_redirect_by_replacing_jump): Likewise.
+ (tree_redirect_edge_and_branch): Likewise.
+ (tree_purge_dead_eh_edges): Likewise.
+ (gimple_cfg_hooks): Enable some hooks.
+ * tree-ssanames.c (make_ssa_name): Change type of STMT to
+ gimple. Update all users.
+ * tree-ssa-operands.c (ssa_operands_active): Enable.
+
+2007-08-31 Diego Novillo <dnovillo@google.com>
+
+ * tree-gimple.c (is_gimple_addressable): Tidy.
+ * Makefile.in (tree-ssa-structalias.o): Disable dependency on
+ GTY header file.
+ (tree-ssa-propagate.o): Likewise.
+ (tree-phinodes.o): Likewise.
+ (tree-scalar-evolution.o): Likewise.
+ (tree-vect-generic.o): Likewise.
+ * gimple.h (struct gimple_statement_phi): Change type of
+ fields 'capacity' and 'nargs' to size_t.
+ Update all users.
+ * tree-cfg.c (verify_gimple_unary_expr): Remove. Update all
+ users.
+ (verify_gimple_binary_expr): Remove. Update all users.
+ (verify_types_in_gimple_min_lval): Rename from
+ verify_gimple_min_lval.
+ (verify_types_in_gimple_reference): Rename from
+ verify_gimple_reference.
+ (verify_gimple_tree_expr): Remove.
+ Move checks to verify_types_in_gimple_assign.
+ (verify_types_in_gimple_call): Rename from verify_gimple_call.
+ (verify_types_in_gimple_cond): Rename from verify_gimple_cond.
+ (verify_types_in_gimple_assign): Rename from verify_gimple_assign.
+ (verify_types_in_gimple_switch): Rename from verify_gimple_switch.
+ (verify_types_in_gimple_phi): New.
+ verify_types_in_gimple_return): Rename from
+ verify_gimple_return.
+ (verify_types_in_gimple_stmt): Rename from verify_gimple_stmt.
+ (verify_types_in_gimple_seq): Rename from verify_gimple_seq.
+
+2007-08-30 Chris Matthews <chrismatthews@google.com>
+ Diego Novillo <dnovillo@google.com>
+
+ * gimplify.c (gimplify_body): Call verify_gimple_seq if
+ ENABLE_TYPES_CHECKING is set.
+ * gimple.h (is_gimple_omp): New.
+ * tree-cfg.c (verify_gimple_tree_expr): Rename from
+ verify_gimple_expr.
+ Verify tree nodes that should disappear after conversion to
+ GIMPLE.
+ Do not handle COND_EXPR, CALL_EXPR.
+ (verify_gimple_modify_stmt): Remove.
+ (verify_gimple_call): New.
+ (verify_gimple_cond): New.
+ (verify_gimple_assign): New.
+ (verify_gimple_return): New.
+ (verify_gimple_switch): New.
+ (verify_gimple_stmt): Change input argument to type gimple.
+ Call new verifiers.
+ (verify_gimple_seq): Rename from verify_gimple_1.
+
+2007-08-30 Diego Novillo <dnovillo@google.com>
+
+ * gimple-low.c (gimple_try_catch_may_fallthru): Call
+ gimple_code instead of gimple_flags.
+ * gimple.c (set_gimple_body): Use gimple_seq instead of gimple
+ when accessing vector gimple_bodies_vec.
+ (gimple_body): Likewise.
+ (gimple_assign_copy_p): New.
+ * gimple.h (enum gimple_try_kind): New.
+ (GIMPLE_TRY_CATCH): Move inside enum gimple_try_kind.
+ (GIMPLE_TRY_FINALLY): Likewise.
+ (gimple_assign_copy_p): Declare.
+ (gimple_assign_rhs_code): New.
+ Update callers that used to call gimple_flags.
+ (gimple_cond_code): New.
+ Update callers that used to call gimple_flags.
+ (gimple_try_kind): New.
+ (gimple_nop_p): Tidy comment.
+ * gimple-pretty-print.c (dump_unary_rhs): New.
+ (dump_gimple_assign): Call it.
+
+2007-08-30 Diego Novillo <dnovillo@google.com>
+
+ * gimplify.c (gimplify_cond_expr): When gimplifying a ?: call
+ gimplify_stmt with the expression just built instead of the
+ original expression.
+ Use the correct labels when calling build_gimple_cond.
+
+
+2007-08-30 Diego Novillo <dnovillo@google.com>
+
+ * tree-vrp.c: Disable.
+ * tree-loop-linear.c: Disable.
+ * tree-into-ssa.c: Disable.
+ * tree-ssa-loop-im.c: Disable.
+ * tree-complex.c: Disable.
+ * cgraphbuild.c: Disable most functions.
+ * tree-ssa-threadupdate.c: Disable.
+ * tree-ssa-loop-niter.c: Disable.
+ * tree-pretty-print.c: Disable.
+ * tree-ssa-loop-unswitch.c: Disable.
+ * tree-ssa-loop-manip.c: Disable.
+ * value-prof.c: Disable.
+ * tree-tailcall.c: Disable.
+ * tree-ssa-loop-ch.c: Disable.
+ * tree-scalar-evolution.c: Disable.
+ * tree-phinodes.c: Disable.
+ * omp-low.c: Disable.
+ * tree-ssa-dse.c: Disable.
+ * ipa-reference.c: Disable.
+ * tree-ssa-uncprop.c: Disable.
+ * tree-ssa-sccvn.c: Disable.
+ * cgraphunit.c (verify_cgraph_node): Disable basic block traversal.
+ * tree-ssa-copyrename.c: Disable.
+ * tree-ssa-ccp.c: Disable most functions.
+ * tree-ssa-loop-ivopts.c: Disable.
+ * tree-stdarg.c: Disable.
+ * tree-ssa-math-opts.c: Disable.
+ * tree-ssa-dom.c: Disable most functions.
+ * tree-nrv.c: Disable.
+ * tree-ssa-propagate.c: Disable.
+ * gimple-dummy.c: New file.
+ * tree-ssa-alias.c: Disable most functions.
+ * tree-ssa-sink.c: Disable.
+ * expr.c (expand_expr_real): Disable call to
+ lookup_stmt_eh_region.
+ * tree-ssa-loop-ivcanon.c: Disable.
+ * predict.c (strip_builtin_expect): Disable.
+ (tree_predict_by_opcode): Disable.
+ (return_prediction): Disable.
+ (apply_return_prediction): Disable.
+ (tree_bb_level_predictions): Disable.
+ (tree_estimate_probability): Disable.
+ (predict_paths_leading_to): Disable.
+ * gimple-iterator.c (gsi_replace): Mark unused arguments with
+ ATTRIBUTE_UNUSED.
+ * tree-ssa-ifcombine.c: Disable.
+ * matrix-reorg.c: Disable.
+ * c-decl.c (c_gimple_diagnostics_recursively): Disable call to
+ diagnose_omp_structured_block_errors.
+ * tree-eh.c: Disable most functions.
+ * tree-vectorizer.c: Disable.
+ * tree-vectorizer.h (nested_in_vect_loop_p): Disable.
+ * ipa-type-escape.c: Disable.
+ * tree-if-conv.c: Disable.
+ * profile.c: Disable.
+ * tree-data-ref.c: Disable.
+ * tree-flow-inline.h (bsi_start): Set bsi.gsi to NULL if the
+ block is invalid.
+ (bsi_last): Likewise.
+ (op_iter_next_use): Disable call to PHI_ARG_DEF_PTR.
+ * tree-vect-analyze.c: Disable.
+ * gimplify.c (gimple_conditional_context): Disable.
+ (gimple_push_cleanup): Disable.
+ (gimplify_omp_parallel): Disable calls to
+ push_gimplify_context and pop_gimplify_context.
+ * tree-ssa-phiopt.c: Disable.
+ * calls.c (emit_call_1): Disable calls to lookup_stmt_eh_region.
+ (expand_call): Likewise.
+ (emit_library_call_value_1): Initialize low_to_save and
+ high_to_save.
+ * tree-ssa-coalesce.c: Disable.
+ * tree-dfa.c (make_rename_temp): Disable call to
+ mark_sym_for_renaming.
+ (find_new_referenced_vars_1): Likewise.
+ (collect_dfa_stats): Disable CFG iteration.
+ (collect_dfa_stats_r): Disable.
+ (mark_symbols_for_renaming): Disable.
+ * cfgexpand.c (maybe_dump_rtl_for_tree_stmt): Disable.
+ (label_rtx_for_bb): Disable.
+ (expand_gimple_cond_expr): Disable.
+ (expand_gimple_tailcall): Disable.
+ (expand_gimple_basic_block): Disable.
+ * tree-cfgcleanup.c: Disable.
+ * tree-ssa-pre.c: Disable.
+ * tree-ssa-live.c: Disable.
+ * tree-sra.c: Disable most functions..
+ * tree-predcom.c: Disable.
+ * tree-mudflap.c: Disable.
+ * ipa-prop.c: Disable.
+ * tree-ssa-copy.c (may_propagate_copy): Disable.
+ (propagate_value): Disable.
+ (execute_copy_prop): Disable.
+ (do_copy_prop): Disable.
+ (store_copy_prop): Disable.
+ * tree-ssa-forwprop.c: Disable.
+ * tree-ssa-dce.c: Disable.
+ * tree-vect-patterns.c: Disable.
+ * tree-ssa-ter.c: Disable.
+ * tree-ssa.c: Disable.
+ * lambda-code.c: Disable.
+ * tree-ssa-loop-prefetch.c: Disable.
+ * tree-inline.c: Disable most functions.
+ * tree-optimize.c (execute_fixup_cfg_pre_ipa): Disable.
+ (execute_fixup_cfg): Disable.
+ (execute_cleanup_cfg_post_optimizing): Disable.
+ (execute_fixup_cfg): Disable.
+ * tree-vect-transform.c: Disable.
+ * tree-object-size.c: Disable.
+ * tree-outof-ssa.c: Disable.
+ * cfgloop.c (find_subloop_latch_edge_by_profile): Disable.
+ (find_subloop_latch_edge_by_ivs): Disable.
+ * tree-profile.c: Disable most functions.
+ * c-gimplify.c (add_block_to_enclosing): Disable.
+ * tree-vect-generic.c: Disable.
+ * tree-flow.h (struct function_ann_d): Disable field
+ reference_vars_info.
+ * Makefile.in: Force -Werror even during stage 1.
+ (OBJS-common): Add gimple-dummy.o.
+ (GTFILES): Remove tree-scalar-evolution.c,
+ tree-ssa-propagate.c, tree-vect-generic.c,
+ tree-ssa-structalias.h, tree-ssa-structalias.c,
+ ipa-reference.h, omp-low.c, tree-phinodes.c, ipa-reference.c
+ * tree-ssa-structalias.c: Disable.
+ * tree-cfg.c: Disable most functions.
+ * passes.c (finish_optimization_passes): Disable call to
+ end_branch_prob.
+ (init_optimization_passes): Disable the registration of
+ several passes.
+ (execute_function_todo): Disable calls to update_ssa and
+ need_ssa_update_p.
+ * tree-ssa-reassoc.c: Disable.
+ * tree-ssanames.c: Disable.
+ * tree-ssa-threadedge.c: Disable.
+ * tree-ssa-operands.c: Disable.
+
+2007-08-29 Aldy Hernandez <aldyh@redhat.com>
+
+ * tree-ssa-operands.h (pop_stmt_changes, push_stmt_changes):
+ Argument is gimple.
+ (struct ssa_operand_iterator_d): Member phi_stmt is gimple.
+ * value-prof.c (gimple_add_histogram_value): Adjust for tuples.
+ (gimple_duplicate_stmt_histograms): Same.
+ * value-prof.h (gimple_add_histogram_value): Same.
+ (gimple_duplicate_stmt_histograms): Same.
+ * tree-flow-inline.h (clear_and_done_ssa_iter): Same.
+ (op_iter_init): Same.
+ (op_iter_init_phiuse): Same.
+ * tree-flow.h (stmt_references_memory_p): Same.
+ * tree-cfg.c (tree_can_merge_blocks_p): Same.
+ (remove_bb): Same.
+ (find_taken_edge): Same.
+ (tree_cfg2vcg): Same.
+ (first_stmt): Same.
+ (last_stmt): Same.
+ (bsi_move_after): Same.
+ (bsi_move_before): Same.
+ (tree_find_edge_insert_loc): Same.
+ Remove code handling a GIMPLE_MODIFY_STMT inside a RETURN_EXPR.
+ (delete_tree_cfg_annotations): Remove code to remove annotations.
+ * tree-ssa-operands.c (struct scb_d): Stmt_p is a gimple *.
+ (push_stmt_changes): Adjust for tuples.
+ (mark_difference_for_renaming): Same.
+ (pop_stmt_changes): Same.
+ (stmt_references_memory_p): Same.
+
+2007-08-29 Aldy Hernandez <aldyh@redhat.com>
+
+ * tree-ssa-operands.h: Remove DEF_OPS, USE_OPS, VUSE_OPS,
+ VDEF_OPS, LOADED_SYMS, STORED_SYMS.
+ * tree-pretty-print.c (dump_generic_node): Adjust accordingly.
+ (dump_vops): use gimple_v*_ops. Adjust accordingly.
+ * gimple.def: Add to comment.
+ * tree-ssa-alias.c (create_structure_vars): Adjust for tuples.
+ * tree-flow-inline.h (op_iter_init): Make stmt gimple. Use
+ gimple_*_ops functions.
+ (op_iter_init_use): Make stmt gimple.
+ (op_iter_init_def): Same.
+ (op_iter_init_vdef): Same.
+ (single_ssa_tree_operand): Same.
+ (single_ssa_use_operand): Same.
+ (single_ssa_def_operand): Same.
+ (zero_ssa_operands): Same.
+ (num_ssa_operands): Same.
+ (compare_ssa_operands_equal): Make stmt[12] gimple.
+ (link_use_stmts_after): Adjust for tuples.
+ * tree-ssa-structalias.c (update_alias_info): Use
+ gimple_stored_syms and gimple_loaded_syms.
+ * gimple.h (gimple_has_mem_ops): New.
+ (gimple_def_ops): New.
+ (set_gimple_def_ops): New.
+ (gimple_use_ops): New.
+ (set_gimple_use_ops): New.
+ (gimple_vuse_ops): New.
+ (set_gimple_vuse_ops): New.
+ (gimple_vdef_ops): New.
+ (set_gimple_vdef_ops): New.
+ (gimple_loaded_syms): New.
+ (gimple_stored_syms): New.
+ * tree-ssa-operands.c (finalize_ssa_defs): Adjust for tuples.
+ (copy_virtual_operands): Same.
+ (swap_tree_operands): Same.
+
+2007-08-28 Aldy Hernandez <aldyh@redhat.com>
+
+ * Revert the parts of Kaveh's constification patch.that duplicate
+ API calls.
+
+2007-08-27 Diego Novillo <dnovillo@google.com>
+
+ Merge with mainline @127831.
+
+ * configure.ac (ACX_PKGVERSION): Update revision merge string.
+ * configure: Regenerate.
+
+2007-08-25 Diego Novillo <dnovillo@google.com>
+
+ * tree.c (build_gimple_modify_stmt_stat): Add depecrate note.
+ * omp-low.c (scan_omp_1): Disable.
+ (scan_omp): Likewise.
+ (lower_omp_for): Likewise.
+ (lower_omp_parallel): Likewise.
+ (lower_omp_1): Likewise.
+ (lower_omp): Likewise.
+ (diagnose_sb_1): Likewise.
+ (diagnose_sb_2): Likewise.
+ (diagnose_omp_structured_block_errors): Likewise.
+ * tree-gimple.h (_TREE_GIMPLE_H): Rename from _TREE_SIMPLE_H.
+ (gimplify_body): Return the new GIMPLE body.
+ (struct walk_stmt_info): Move to gimple.h.
+ * gimple-low.c (lower_function_body): Assert that the function
+ body is a single GIMPLE_BIND statement.
+ Create a new gimple sequence to lower the existing body.
+ Replace the function body with the new lowered sequence.
+ (pass_lower_cf): Enable GIMPLE lowering.
+ (lower_omp_directive): Disable.
+ (lower_stmt): Do not call lower_omp_directive.
+ (gimple_stmt_may_fallthru): Factor out of ...
+ (gimple_seq_may_fallthru): ... here.
+ * gimple-iterator.c (gsi_replace): New.
+ * gimple-iterator.h (gsi_replace): Declare.
+ * gimple-pretty-print.c: Do not include gimple-iterator.h
+ * gimplify.c (gimplify_asm_expr): Tidy.
+ Store the whole TREE_LIST node in the inputs and outputs vectors.
+ (gimple_push_cleanup): Disable completely.
+ (gimplify_body): Return a GIMPLE_BIND holding the gimplified
+ body.
+ Update all users.
+ (gimplify_function_tree): Create a GIMPLE sequence to hold
+ the gimplified body.
+ * tree-flow.h (gimple_stmt_may_fallthru): Declare.
+ * Makefile.in (GIMPLE_H): Add gimple-iterator.h.
+
+2007-08-25 Diego Novillo <dnovillo@google.com>
+
+ * tree-nested.c: Re-implement to use GIMPLE tuples.
+ (init_tmp_var_with_call): New.
+ (init_tmp_var): Adapt to GIMPLE tuples.
+ (save_tmp_var): Likewise.
+ (convert_nl_goto_receiver): Likewise.
+ (finalize_nesting_tree_1): Likewise.
+ (gsi_gimplify_val): Likewise.
+ Rename from tsi_gimplify_val. Update all users.
+ (walk_asm_expr): Remove.
+ (walk_stmts): Remove.
+ (walk_body): Call walk_gimple_seq.
+ Add new argument callback_op. Update all users.
+ (walk_function): Add argument callback_op. Update all users.
+ (convert_nonlocal_reference_op): Rename from
+ convert_nonlocal_omp_reference. Update all users.
+ (convert_nonlocal_reference_stmt): New. Handle GIMPLE
+ statements that used to be tree nodes.
+ (convert_local_reference_op): Rename from
+ convert_local_reference. Update all users.
+ (convert_local_reference_stmt): New. Handle GIMPLE statements
+ that used to be tree nodes.
+ (convert_nl_goto_reference): Convert to walk_stmt_fn callback.
+ Update all users.
+ (convert_tramp_reference_op): Rename from
+ convert_tramp_reference. Update all users.
+ (convert_tramp_reference_stmt): New. Handle GIMPLE statements
+ that used to be tree nodes.
+ (convert_gimple_call): Rename from convert_call_expr. Convert
+ to be a walk_stmt_fn callback.
+ * gimple.c (gimple_seq_add): Rename from gimple_add. Update
+ all users.
+ (walk_gimple_seq): Rename from walk_seq_ops. Update all
+ users.
+ (walk_gimple_stmt): Rename from walk_tuple_ops. Update all
+ users.
+ Use two callback functions one for statements and another for
+ operands. If either is NULL do not invoke it.
+ Allow callbacks to replace operands.
+ (WALKIT): Remove.
+ (walk_gimple_asm): New.
+ * gimple.h: Include ggc.h
+ (gimple_seq_alloc): New. Use everywhere a GIMPLE sequence is
+ allocated.
+ (gimple_op_ptr): New.
+ (gimple_call_arg_ptr): New.
+ (gimple_catch_types_ptr): New.
+ (gimple_eh_filter_types_ptr): New.
+ (gimple_omp_critical_name_ptr): New.
+ (gimple_omp_for_clauses_ptr): New.
+ (gimple_omp_for_index_ptr): New.
+ (gimple_omp_for_initial_ptr): New.
+ (gimple_omp_for_final_ptr): New.
+ (gimple_omp_for_incr_ptr): New.
+ (gimple_omp_parallel_clauses_ptr): New.
+ (gimple_omp_parallel_child_fn_ptr): New.
+ (gimple_omp_parallel_data_arg_ptr): New.
+ (gimple_omp_single_clauses_ptr): New.
+ (gimple_omp_sections_clauses_ptr): New.
+ (walk_stmt_fn): New type.
+ (struct walk_stmt_info): Move from tree-gimple.h.
+ Rename field callback to callback_op.
+ Add new field callback_stmt.
+ Replace field tsi with gsi of type gimple_stmt_iterator.
+ (walk_gimple_seq): Declare.
+ (walk_gimple_stmt): Declare.
+ * tree-cfg.c (execute_build_cfg): Do not call
+ build_gimple_cfg.
+ (pass_build_cfg): Enable.
+ Disable TODO_verify_stmts and TODO_cleanup_cfg.
+
+2007-08-22 Aldy Hernandez <aldyh@redhat.com>
+
+ * tree-phinodes.c (reserve_phi_args_for_new_edge): Comment out
+ call to phi_nodes_ptr.
+ (remove_phi_node): Same.
+ * tree-flow-inline.h (get_lineno): Work with empty statements or
+ empty locations.
+ (phi_nodes_ptr): Remove.
+ (phi_arg_index_from_use): Adjust for tuples.
+ (bsi_stmt_ptr): Add ATTRIBUTE_UNUSED.
+ (op_iter_init): Remove assertion.
+ (next_imm_use_stmt): Change NULL_TREE to NULL.
+ * tree-dfa.c (mark_symbols_for_renaming): Adjust for tuples.
+ * tree-flow.h: Remove bb_for_stmt prototype.
+ (mark_symbols_for_renaming): Make argument gimple.
+
+2007-08-22 Aldy Hernandez <aldyh@redhat.com>
+
+ Change all instances of bb_for_stmt to gimple_bb throughout.
+
+ * gimple.h (gimple_omp_parallel_combined_p): New.
+ * tree-ssa-operands.h (update_stmt_operands): Argument is now
+ gimple.
+ * tree-ssa-threadupdate.c (rederiction_block_p): Use gimple_nop_p
+ instead of IS_EMPTY_STMT.
+ * tree-ssa-loop-niter.c: Disable use of COND_EXPR_COND.
+ * tree-pretty-print.c (dump_bb_header): Adjust for tuples.
+ * cgraph.c (cgraph_add_new_function): Rename
+ tree_register_cfg_hooks to gimple_register_cfg_hooks.
+ * value-prof.c (set_histogram_value): Stmt type is now gimple.
+ (gimple_histogram_value): Same.
+ (gimple_remove_histogram_value): Same.
+ (gimple_remove_stmt_histograms): Same.
+ * tree.h (struct ssa_use_operand_d): Same.
+ * value-prof.h (struct histogram_value_t): Same.
+ Change gimple_*histogram* prototypes to use gimple instead of
+ tree.
+ * ipa-cp.c (ipcp_insert_stage): Rename tree_register_cfg_hooks to
+ gimple_register_cfg_hooks.
+ * cfghooks.c (gimple_register_cfg_hooks): Rename from
+ tree_register_cfg_hooks. Initialize cfg_hooks to gimple_cfg_hooks.
+ (current_ir_type): Rename tree_cfg_hooks to gimple_cfg_hooks.
+ * input.h (IS_LOCATION_EMPTY): New.
+ * cfghooks.h: Rename tree_cfg_hooks to gimple_cfg_hooks. Rename
+ tree_register_cfg_hooks to gimple_register_cfg_hooks.
+ * omp-low.c (determine_parallel_type): Adjust for tuples.
+ (expand_omp_parallel): Rename bb_stmt_list to bb_seq.
+ (expand_omp_for_generic): Call gimple_omp_return_nowait_p.
+ (expand_omp_for_static_nochunk): Same.
+ (expand_omp_sections): Call gimple_omp_section_last_p.
+ (expand_omp_single): Comment out call to find_omp_clause.
+ Call gimple_omp_return_nowait_p.
+ * cgraphunit.c: Rename tree_register_cfg_hooks to
+ gimple_register_cfg_hooks.
+ * tree-ssa-propagate.c: Comment out non working code.
+ * matrix-reorg.c (matrix_reorg): Rename tree_register_cfg_hooks to
+ gimple_register_cfg_hooks.
+ * tree-eh.c (add_stmt_to_eh_region_fn): Change `t' type to gimple.
+ Adjust accordingly.
+ (add_stmt_to_eh_region): Same.
+ (remove_stmt_from_eh_region_fn): Same.
+ (remove_stmt_from_eh_region): Same.
+ (lookup_stmt_eh_region_fn): Same.
+ (lookup_stmt_eh_region): Same.
+ (make_eh_edges): Adjust for tuples.
+ (stmt_can_throw_internal): Rename from tree_can_throw_internal.
+ Adjust for tuples.
+ (maybe_clean_or_replace_eh_stmt): Arg types are now gimple.
+ * tree-vectorizer.c: Rename tree_register_cfg_hooks to
+ gimple_register_cfg_hooks.
+ * tree-if-conv.c (combine_blocks): Adjust for tuples.
+ * profile.c (branch_prob): Same.
+ * tree-flow-inline.h (bb_for_stmt): Remove.
+ (get_lineno): Adjust for tuples.
+ (noreturn_call_p): Same.
+ (mark_stmt_modified): Same.
+ (update_stmt): Same.
+ (update_stmt_if_modified): Same.
+ (stmt_modified_p): Same.
+ (link_imm_use_stmt): Same.
+ (relink_imm_use_stmt): Same.
+ (single_imm_use): Same.
+ (gimple_phi_arg_def): New.
+ (gimple_phi_arg_edge): New.
+ (phi_nodes): Adjust for tuples.
+ (phi_nodes_ptr): Same.
+ (set_phi_nodes): Same.
+ (bb_seq): Rename from bb_stmt_list and adjust for tuples.
+ (set_bb_seq): Rename from set_bb_stmt_list and adjust for tuples.
+ (bsi_start): Adjust for tuples.
+ (bsi_after_labels): Adjust for tuples.
+ (bsi_last): Same.
+ (bsi_next): Same.
+ (bsi_prev): Same.
+ (bsi_stmt): Same.
+ (bsi_stmt_ptr): Same.
+ (loop_containing_stmt): Same.
+ (delink_stmt_imm_use): Same.
+ (first_imm_use_stmt): Same.
+ (next_imm_use_stmt): Same.
+ * gimplify.c (force_gimple_operand_bsi): Same.
+ * coretypes.h (const_gimple): New.
+ * tree-ssa-phiopt.c (empty_block_p): Call gimple_nop_p.
+ (conditional_replacement): Comment out COND_EXPR_COND.
+ (value_replacement): Comment out COND_EXPR_COND.
+ (minmax_replacement): Same.
+ (abs_replacement): Same.
+ * except.h (*eh_region*): Change trees to gimple.
+ (struct throw_stmt_node): Change stmt type to gimple.
+ * cfgexpand.c (label_rtx_for_bb): Adjust for tuples.
+ (expand_gimple_cond_expr): Same.
+ (expand_gimple_basic_block): Same.
+ * tree-cfgcleanup.c (split_bbs_on_noreturn_calls): Same.
+ * tree-ssa-pre.c (realify_fake_stores): Comment out non working
+ code.
+ * tree-ssa-forwprop.c (propagate_with_phi): Rename
+ tree_can_throw_internal stmt_can_throw_internal.
+ * tree-inline.c (copy_edges_for_bb): Rename
+ tree_can_throw_internal to stmt_can_throw_internal.
+ (initialize_cfun): Same.
+ (copy_cfg_body): Same.
+ (gimple_expand_calls_inline): Same.
+ (make_nonlocal_label_edges): Rename tree_can_make_abnormal_goto to
+ stmt_can_make_abnormal_goto.
+ * tree-optimize.c (tree_lowering_passes): Rename
+ tree_register_cfg_hooks to gimple_register_cfg_hooks.
+ (tree_rest_of_compilation): Same.
+ * tree-flow.h (struct gimple_df): Make modified_noreturn_calls a
+ vector of gimple types.
+ Adjust prototypes for tuples.
+ (struct block_stmt_iterator): Make iterator a gimple iterator.
+ (enum bsi_iterator_update): Remove BSI_CHAIN_START and
+ BSI_CHAIN_END.
+ * Makefile.in (tree-cfg.o): Depend on GIMPLE_H.
+ (GTFILES): Move gimple.[hc] entries before tree-flow.h.
+ * basic-block.h (struct edge_def): Make goto_locus of type
+ location_t.
+ (union basic_block_il_dependent): Adjust for tuples.
+ (gimple_bb_info): Rename from tree_bb_info. Adjust for tuples.
+ * tree-cfg.c: Include gimple.h.
+ Adjust prototypes for tuples.
+ (build_gimple_cfg): Rename from build_tree_cfg. Adjust for
+ tuples.
+ (execute_build_cfg): Rename build_tree_cfg call to
+ build_gimple_cfg.
+ (factor_computed_gotos): Adjust for tuples.
+ (make_blocks): Same.
+ (create_bb): Same.
+ (fold_cond_expr_cond): Same.
+ (make_edges): Same.
+ (make_cond_expr_edges): Same.
+ (make_switch_expr_edges): Same.
+ (make_goto_expr_edges): Same.
+ (cleanup_dead_labels): Same.
+ (group_case_labels): Same.
+ (tree_can_merge_blocks_p): Same.
+ (replace_uses_by): Same.
+ (tree_merge_blocks): Same.
+ (is_ctrl): Same.
+ (is_ctrl_altering_stmt): Same.
+ (computed_goto_p): Same.
+ (simple_goto_p): Same.
+ (stmt_can_make_abnormal_goto): Rename from
+ tree_can_make_abnormal_goto.
+ Adjust for tuples.
+ (stmt_starts_bb_p): Adjust for tuples.
+ (stmt_ends_bb_p): Same.
+ (first_stmt): Same.
+ (last_stmt): Same.
+ (last_and_only_stmt): Same.
+ (set_bb_for_stmt): Same.
+ (change_bb_for_stmt): Same.
+ (bsi_for_stmt): Same.
+ (update_modified_stmt): Rename from update_modified_stmts.
+ Adjust for tuples.
+ Handle only one statement.
+ (bsi_insert_before): Adjust for tuples.
+ (bsi_insert_after): Same.
+ (bsi_insert_seq_before): New.
+ (bsi_insert_seq_after): New.
+ (bsi_remove): Ajust for tuples.
+ (bsi_replace): Same.
+ (verify_stmt): Same.
+ (gimple_split_block): Rename from tree_split_block.
+ Adjust for tuples.
+ (tree_purge_dead_abnormal_call_edges): Adjust for tuples.
+ (tree_cfg_hooks): Same.
+ * tree-ssa-operands.c (update_stmt_operands): Same.
+
+2007-08-22 Aldy Hernandez <aldyh@redhat.com>
+
+ * Makefile.in (TREE_GIMPLE_H): Depend on GIMPLE_H.
+ * gimple-iterator.h: Do not include gimple.h.
+ * gimple.h (OMP_SECTION_LAST_FLAG): New.
+ (gimple_omp_return_nowait_p): New.
+ (gimple_omp_section_last_p): New.
+ (gimple_switch_set_num_labels): New.
+ (gimple_nop_p): New.
+
+2007-08-17 Aldy Hernandez <aldyh@redhat.com>
+
+ Revert this change:
+
+ 2007-08-14 Aldy Hernandez <aldyh@redhat.com>
+
+ * gimple.c (gimple_call_flags): Make sure this is a GIMPLE_CALL.
+
+2007-08-14 Aldy Hernandez <aldyh@redhat.com>
+
+ * gimple-iterator.c (gsi_split_seq_after): New.
+ (gsi_split_seq_before): New.
+ * gimple-iterator.h: Prototype above two functions.
+
+2007-08-14 Aldy Hernandez <aldyh@redhat.com>
+
+ * gimple.h (gimple_has_ops): New.
+ (gimple_modified): New.
+ (set_gimple_modified): New.
+ (gimple_switch_default_label): Call gimple_switch_label.
+ (gimple_switch_set_default_label): Call gimple_switch_set_label.
+
+2007-08-14 Aldy Hernandez <aldyh@redhat.com>
+
+ * gimple.c (gimple_call_flags): Make sure this is a GIMPLE_CALL.
+
+2007-08-14 Diego Novillo <dnovillo@google.com>
+
+ Merge with mainline @127480.
+
+ * version.c (VERSUFFIX): Update.
+
+2007-08-09 Diego Novillo <dnovillo@google.com>
+
+ * gimple-low.c: Document conversion to Low GIMPLE.
+ * Makefile.in (gimple.o): Add dependency on gt-gimple.h
+ (GTFILES): Add gimple.c.
+ * gimple.c (gimple_bodies_vec): New.
+ (gimple_bodies_map): Rename from gimple_bodies.
+ (gss_for_code): Return GSS_ASM for GIMPLE_ASM.
+ (walk_tuple_ops): Handle GSS_ASM like GSS_WITH_OPS.
+ (set_gimple_body): Push body into gimple_bodies_vec and create
+ a mapping to array index in gimple_bodies_map.
+ (gimple_body): Corresponding changes to use gimple_bodies_map
+ and gimple_bodies_vec.
+ * gimple.h: Create VEC templates for gimple_seq.
+
+2007-08-08 Aldy Hernandez <aldy@quesejoda.com>
+
+ * gimple-low.c (struct return_statements_t): Declare.
+ (struct lower_data): Make return_statements a vector.
+ (lower_function_body): Adjust for tuples.
+ (pass_lower_cf): Add PROP_gimple_any to properties_required.
+ (lower_sequence): Rename from lower_stmt_body.
+ Adjust for tuples.
+ (lower_omp_directive): Adjust for tuples.
+ (lower_stmt): Same.
+ (lower_gimple_bind): Rename from lower_bind_expr.
+ Adjust for tuples.
+ (gimple_try_catch_may_fallthru): New.
+ (gimple_seq_may_fallthru): New.
+ (lower_gimple_return): Rename from lower_return_expr and adjust
+ for tuples.
+ (lower_builtin_setjmp): Adjust for tuples.
+ * gimple-iterator.c: New.
+ * gimple-iterator.h: Include gimple.h.
+ (enum gsi_iterator_update): Declare.
+ (gsi_link_seq_before): New prototype.
+ (gsi_link_before): Same.
+ (gsi_link_seq_after): Same.
+ (gsi_link_after): Same.
+ (gsi_delink): Same.
+ * gimplify.c (gimplify_body): Comment out verify_gimple_1 call.
+ * tree-flow.h (gimple_seq_may_fallthru): New prototype.
+ * Makefile.in (OBJS-common): Add gimple-iterator.o.
+ (gimple-iterator.o): New.
+ (gimple-pretty-print.o): Do not depend on gimple-iterator.h.
+ * gimple.c (set_gimple_prev): Move to gimple.h.
+ (set_gimple_next): Same.
+ (gimple_call_flags): New.
+ * gimple.h (struct gimple_sequence): Add GTY marker.
+ (struct gimple_statement_bind): Add block field.
+ (set_gimple_prev): New.
+ (set_gimple_next): New.
+ (gimple_call_flags): Protoize.
+ (gimple_call_fndecl): New.
+ (gimple_bind_block): New.
+ (gimple_bind_set_block): New.
+
+
+2007-08-08 Diego Novillo <dnovillo@google.com>
+
+ * gimple.h (GIMPLE_CHECK, GIMPLE_CHECK2, GIMPLE_RANGE_CHECK):
+ Do not return the checked statement. Update all users.
+ Enable on compilers other than GCC.
+
+2007-08-07 Chris Matthews <chrismatthews@google.com>
+
+ * gimple_iterator.h (gsi_start): Changed to produce a pointer instead of
+ struct. Updated clients.
+ (gsi_last): Same.
+ (gsi_end_p): Changed to operate on a pointer instead of struct. Updated
+ clients.
+ (gsi_one_before_end_p): Same.
+ (gsi_next): Same.
+ (gsi_prev): Same.
+ (gsi_stmt): Same.
+
+2007-08-07 Diego Novillo <dnovillo@google.com>
+
+ Merge with mainline @127277.
+
+ * version.c (VERSUFFIX): Update.
+
+2007-08-07 Diego Novillo <dnovillo@google.com>
+
+ * gimple.h (gimple_call_return): New.
+ * gimplify.c (get_tmp_var_for): Call it.
+
+2007-08-02 Chris Matthews <chrismatthews@google.com>
+
+ * gimplify.c (gimplify_asm_expr): Created new gimple tuple.
+ * gimple-pretty-printer.c (dump_gimple_asm): Added function to dump a
+ GIMPLE_ASM statement.
+ (dump_gimple_stmt): Updated to use the dump_gimple_asm function.
+ * gimple.c (gss_for_code): Made asm statements return as with_mem_ops.
+ (build_gimple_with_ops): Asm statements are added as a specal case for
+ allocation because they have extra fields that are not
+ allocated correctly in the current generic op allocator.
+ (build_gimple_asm_1): Added a helper function to setup the basics of a
+ GIMPLE_ASM tuple.
+ (build_gimple_asm_vec): Create a GIMPLE_ASM tuple from vector arguments.
+ (build_gimple_asm): Changed to call the new helper function.
+
+2007-08-03 Diego Novillo <dnovillo@google.com>
+
+ * gimple-pretty-print.c (INDENT): Tidy.
+ (dump_binary_rhs): New.
+ (dump_gimple_assign): Call it.
+ * gimplify.c (gimplify_modify_expr_complex_part): If the value
+ is not interesting, nullify *EXPR_P.
+ (gimplify_body): Do not add the sequence to the GIMPLE_BIND more
+ than once.
+
+2007-08-01 Diego Novillo <dnovillo@google.com>
+
+ * gimplify.c (gimplify_switch_expr): Remove switch_body_seq_.
+ Change switch_body_seq to struct gimple_sequence.
+ Adjust all uses.
+ Call gimplify_stmt instead of gimplify_statement_list
+ (gimplify_to_stmt_list): Remove.
+ Update all users.
+ * tree-mudflap.c: Include gimple.h
+ (mf_decl_cache_locals): Convert to emit GIMPLE.
+ (mf_build_check_statement_for): Add FIXME and unreachable
+ markers to convert to GIMPLE.
+ * Makefile.in (tree-mudflap.o): Depend on $(GIMPLE_H).
+ * config/i386/i386.c (ix86_gimplify_va_arg): Adapt to emit
+ GIMPLE.
+
+2007-08-01 Diego Novillo <dnovillo@google.com>
+
+ * gimplify.c (gimplify_switch_expr): Do not call sort_case_labels
+ if there are no labels other than 'default'.
+ * gimple.h (gimple_num_ops, gimple_op, gimple_set_op): Use
+ result of GIMPLE_RANGE_CHECK call.
+
+2007-08-01 Diego Novillo <dnovillo@google.com>
+
+ * DEV-PHASE: Revert to mainline version.
+ * version.c (VERSUFFIX): Add branch name and revision number
+ of latest mainline merge.
+
+2007-07-31 Diego Novillo <dnovillo@google.com>
+
+ Mainline merge (@127100).
+ * DEV-PHASE: Updated.
+
+2007-07-31 Diego Novillo <dnovillo@google.com>
+
+ * dominance.c (free_dominance_info): If there is no CFG,
+ do nothing.
+ * cfg.c (compact_blocks): Likewise.
+
+2007-07-30 Diego Novillo <dnovillo@google.com>
+
+ * gimplify.c (get_tmp_var_for): When creating a new temporary
+ for a GIMPLE_CALL, use the type returned by the function call
+ instead of the type of the function decl.
+ * gimple.c (build_gimple_return): Accept NULL and RESULT_DECL
+ return values.
+
+2007-07-30 Diego Novillo <dnovillo@google.com>
+
+ * gimplify.c (gimplify_init_constructor): If both sides
+ of the constructor are in GIMPLE form but the assignment
+ has not been emitted, emit it.
+
+2007-07-28 Diego Novillo <dnovillo@google.com>
+
+ * gimplify.c (gimplify_return_expr): Do not create a MODIFY_EXPR
+ as return argument
+ * gimple.c (build_gimple_return): Assert that the returned value
+ is a GIMPLE value.
+
+2007-07-27 Diego Novillo <dnovillo@google.com>
+
+ * tree-gimple.c (get_gimple_rhs_class): New.
+ (is_gimple_formal_tmp_rhs): Call it.
+ * tree-gimple.h (enum gimple_rhs_class): New.
+ * gimple-iterator.h (gsi_next): Assert that there is nothing
+ beyond the end of the sequence.
+ (gsi_prev): Assert that there is nothing before the start of
+ the sequence.
+ * gimplify.c (gimplify_switch_expr): Tidy creation of default label.
+ (gimplify_expr): Fix concatenation of internal sequences to PRE_P.
+ * gimple.c (get_num_ops_for): Remove. Update users.
+ (build_gimple_assign): Call get_gimple_rhs_class to determine
+ how many operands to allocate.
+ (gimple_add): Assert that GS does not have previous or next
+ statements.
+ (gimple_seq_append): Move from gimple.h.
+
+2007-07-27 Aldy Hernandez <aldy@quesejoda.com>
+
+ * cgraph.c: Fix line wrap.
+ * cgraph.h: Same.
+ * tree-pass.h (struct tree_opt_pass): Add works_with_tuples_p
+ field.
+ * cgraphunit.c (cgraph_analyze_functions): Remove check for
+ DECL_SAVED_TREE.
+ (cgraph_expand_function): Comment out TREE_ASM_WRITTEN assertion.
+ * tree-optimize.c (tree_lowering_passes): Comment out call to
+ compact_blocks.
+ * passes.c (execute_one_pass): Return if pass has not been
+ converted to tuples.
+ * tree-vrp.c, regrename.c, fwprop.c, tree-into-ssa.c,
+ tree-complex.c, see.c, cgraphbuild.c, tracer.c, cgraph.c,
+ postreload-gcse.c, postreload.c, tree-ssa-loop-ch.c,
+ tree-tailcall.c, tree-pass.h, ipa-cp.c, final.c, omp-low.c,
+ tree-ssa-dse.c, ipa-reference.c, tree-ssa-uncprop.c,
+ auto-inc-dec.c, reorg.c, tree-ssa-copyrename.c, tree-ssa-ccp.c,
+ df-core.c, mode-switching.c, tree-nomudflap.c, modulo-sched.c,
+ ipa-pure-const.c, cse.c, web.c, tree-stdarg.c,
+ tree-ssa-math-opts.c, tree-ssa-dom.c, tree-nrv.c,
+ tree-ssa-alias.c, loop-init.c, gimple-low.c, tree-ssa-sink.c,
+ ipa-inline.c, global.c, jump.c, ifcvt.c, predict.c,
+ tree-ssa-loop.c, recog.c, dse.c, tree-ssa-ifcombine.c,
+ matrix-reorg.c, c-decl.c, tree-eh.c, regmove.c, local-alloc.c,
+ function.c, tree-vectorizer.c, gcse.c, ipa-type-escape.c,
+ tree-if-conv.c, init-regs.c, ipa.c, tree-ssa-phiopt.c,
+ rtl-factoring.c, lower-subreg.c, bt-load.c, tree-dfa.c except.c,
+ emit-rtl.c, cfgexpand.c, tree-cfgcleanup.c, cfgcleanup.c,
+ tree-ssa-pre.c, tree-sra.c, tree-mudflap.c, tree-ssa-copy.c,
+ cfglayout.c, tree-ssa-forwprop.c, tree-ssa-dce.c, tree-ssa.c,
+ regclass.c, integrate.c, tree-optimize.c, tree-object-size.c,
+ combine.c, tree-outof-ssa.c, bb-reorder.c, stack-ptr-mod.c,
+ var-tracking.c, tree-profile.c, tree-vect-generic.c, reg-stack.c,
+ sched-rgn.c, tree-ssa-structalias.c, tree-cfg.c, passes.c,
+ tree-ssa-reassoc.c, combine-stack-adj.c, cfgrtl.c, dce.c,
+ tree-ssanames.c: Set works_with_tuples_p field to 0.
+
+2007-07-25 Diego Novillo <dnovillo@google.com>
+
+ * gimple.c: Use ENABLE_GIMPLE_CHECKING instead of
+ ENABLE_TREE_CHECKING.
+ (set_gimple_code): New.
+ (set_gimple_prev): New.
+ (set_gimple_next): New.
+ * gimple.h: Use ENABLE_GIMPLE_CHECKING instead of
+ ENABLE_TREE_CHECKING.
+ (gimple_code): Inline function replacement for GIMPLE_CODE.
+ (gimple_flags): Inline function replacement for GIMPLE_SUBCODE_FLAGS.
+ (gimple_next): Inline function replacement for GIMPLE_NEXT.
+ (gimple_prev): Inline function replacement for GIMPLE_PREV.
+ (gimple_locus): Inline function replacement for GIMPLE_LOCUS.
+ (gimple_locus_empty_p): Inline function replacement for
+ GIMPLE_LOCUS_EMPTY_P.
+ (struct gimple_statement_base): Rename field 'subcode_flags'
+ to 'flags'.
+ (set_gimple_flags): New.
+ (gimple_bb): New.
+ (set_gimple_bb): New.
+ (set_gimple_block): New.
+ (set_gimple_locus): New.
+ (add_gimple_flag): Rename from gimple_add_subcode_flag.
+
+2007-07-25 Diego Novillo <dnovillo@google.com>
+
+ * tree-gimple.h (build_gimple_eh_filter_tree): Rename from
+ gimple_build_eh_filter_tree.
+ * gimple.h (build_gimple_return): Rename from gimple_build_return.
+ (build_gimple_assign): Rename from gimple_build_assign.
+ (build_gimple_call_vec): Rename from gimple_build_call_vec.
+ (build_gimple_call): Rename from gimple_build_call.
+ (build_gimple_label): Rename from gimple_build_label.
+ (build_gimple_goto): Rename from gimple_build_goto.
+ (build_gimple_nop): Rename from gimple_build_nop.
+ (build_gimple_bind): Rename from gimple_build_bind.
+ (build_gimple_asm): Rename from gimple_build_asm.
+ (build_gimple_catch): Rename from gimple_build_catch.
+ (build_gimple_eh_filter): Rename from gimple_build_eh_filter.
+ (build_gimple_try): Rename from gimple_build_try.
+ (build_gimple_phi): Rename from gimple_build_phi.
+ (build_gimple_resx): Rename from gimple_build_resx.
+ (build_gimple_switch): Rename from gimple_build_switch.
+ (build_gimple_switch_vec): Rename from gimple_build_switch_vec.
+ (build_gimple_omp_parallel): Rename from gimple_build_omp_parallel.
+ (build_gimple_omp_for): Rename from gimple_build_omp_for.
+ (build_gimple_omp_critical): Rename from gimple_build_omp_critical.
+ (build_gimple_omp_section): Rename from gimple_build_omp_section.
+ (build_gimple_omp_continue): Rename from gimple_build_omp_continue.
+ (build_gimple_omp_master): Rename from gimple_build_omp_master.
+ (build_gimple_omp_return): Rename from gimple_build_omp_return.
+ (build_gimple_omp_ordered): Rename from gimple_build_omp_ordered.
+ (build_gimple_omp_sections): Rename from gimple_build_omp_sections.
+ (build_gimple_omp_single): Rename from gimple_build_omp_single.
+ Update all users.
+
+2007-07-24 Chris Matthews <chrismatthews@google.com>
+
+ * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the
+ --enable-checking=gimple flag.
+ * config.in: Same.
+ * configure: Regenerated.
+ * gimplify.c (cpt_same_type): Same.
+ (gimple_push_condition): Same.
+ (gimplify_addr_expr): Same.
+ (gimplify_expr): Same.
+ (gimplify_body): Same.
+ (check_pointer_types_r): Same.
+
+2007-07-24 Diego Novillo <dnovillo@google.com>
+
+ * gimple.def: Re-organize codes that take tree operands so
+ they are consecutive.
+ * gsstruct.def (GSS_LABEL, GSS_ASSIGN_BINARY, GSS_ASSIGN_UNARY_REG,
+ GSS_ASSIGN_UNARY_MEM, GSS_COND, GSS_GOTO, GSS_SWITCH, GSS_CALL,
+ GSS_RETURN): Remove. Update al users.
+ * gimple.c (gss_for_code): New.
+ (gimple_statement_structure): Call it.
+ (get_num_ops_for): New.
+ (gimple_build_with_ops): New.
+ (gimple_build_return, gimple_build_call_1, gimple_build_assign,
+ gimple_build_cond, gimple_build_label, gimple_build_goto,
+ gimple_build_switch_1, ): Call it.
+ (gss_for_assign): Remove. Update all users.
+ (gimple_check_failed): Do not assume that subcode is a valid tree
+ code.
+ (gimple_range_check_failed): New.
+ (walk_tuple_ops): Implement in terms of gimple_num_ops and
+ gimple_op when dealing with GSS_WITH_OPS and GSS_WITH_MEM_OPS
+ statements.
+ * gimple.h (struct gimple_statement_with_ops): Add fields 'num_ops'
+ and 'op'.
+ (struct gimple_statement_label, gimple_statement_assign_binary,
+ gimple_statement_assign_unary_reg, gimple_statement_assign_unary_mem,
+ gimple_statement_cond, gimple_statement_goto, gimple_statement_switch,
+ gimple_statement_call, gimple_statement_return): Remove.
+ Update all users.
+ (gimple_range_check_failed): Declare.
+ (GIMPLE_RANGE_CHECK): Define.
+ (gimple_num_ops): New.
+ (gimple_op): New.
+ (gimple_set_op): New.
+ (gimple_assign_rhs1): Rename from gimple_assign_binary_rhs1.
+ (gimple_assign_set_rhs1): Rename from gimple_assign_binary_set_rhs1.
+ (gimple_assign_rhs2): Rename from gimple_assign_binary_rhs2.
+ (gimple_assign_set_rhs2): Rename from gimple_assign_binary_set_rhs2.
+ (gimple_assign_unary_rhs): Remove. Update all users.
+ (gimple_assign_unary_set_rhs): Likewise.
+ (gimple_switch_num_labels): Rename from gimple_switch_nlabels.
+ (gimple_call_fn, gimple_call_lhs, gimple_call_chain,
+ gimple_call_set_chain, gimple_call_nargs, gimple_call_arg,
+ gimple_call_set_arg, gimple_cond_lhs, gimple_cond_set_lhs,
+ gimple_cond_rhs, gimple_cond_set_rhs, gimple_cond_true_label,
+ gimple_cond_false_label, gimple_cond_set_true_label,
+ gimple_cond_set_false_label, gimple_label_label,
+ gimple_label_set_label, gimple_goto_dest,
+ gimple_goto_set_dest, gimple_asm_input_op,
+ gimple_asm_set_input_op, gimple_asm_output_op,
+ gimple_asm_set_output_op, gimple_asm_clobber_op,
+ gimple_asm_set_clobber_op, gimple_switch_num_labels,
+ gimple_switch_index, gimple_switch_set_index,
+ gimple_switch_default_label, gimple_switch_set_default_label,
+ gimple_switch_label, gimple_switch_set_label,
+ gimple_return_retval, gimple_return_set_retval): Implement
+ using the array of operands in field 'with_ops'.
+ (gimple_asm_set_ninputs, gimple_asm_set_noutputs,
+ gimple_asm_set_nclobbered, gimple_asm_set_string): Remove.
+ Update all users.
+
+
+2007-07-24 Aldy Hernandez <aldyh@redhat.com>
+
+ * tree.c (get_callee_fndecl): Revert previous change.
+ * gimplify.c (gimplify_call_expr): Use result from
+ get_callee_fndecl if available.
+ * c-common.c (c_warn_unused_result): Do not use
+ get_callee_fndecl.
+ Add assertion.
+
+2007-07-24 Diego Novillo <dnovillo@google.com>
+
+ Merge with mainline (@126872)
+
+2007-07-23 Aldy Hernandez <aldyh@redhat.com>
+
+ * tree.c (get_callee_fndecl): Work when only the CALL_EXPR_FN has
+ been passed.
+ * c-common.c (c_warn_unused_result): Use get_callee_fndecl.
+
+2007-07-23 Aldy Hernandez <aldyh@redhat.com>
+
+ * c-decl.c: Include gimple.h.
+ (c_gimple_diagnostics_recursively): Call c_warn_unused_result with
+ tuplified body.
+ Exit if -fgimple-only.
+ * gimplify.c (gimplify_call_expr): Call gimple_build_call_vec with
+ the correct callee.
+ * c-gimplify.c (c_genericize): Remove exit.
+ * c-common.c: Include gimple.h.
+ (c_warn_unused_result): Tuplify.
+ * c-common.h (c_warn_unused_result): Protoize.
+ * Makefile.in (c-decl.o): Depend on GIMPLE_H.
+ (c-common.o): Same.
+ * gimple.c (gimple_build_catch): Handler is a sequence.
+ Adjust accordingly.
+ (gimple_build_eh_filter): Failure is a sequence.
+ Adjust accordingly.
+ (walk_tuple_ops): case GIMPLE_CATCH: Walk handler as a sequence.
+ case GIMPLE_EH_FILTER: Walkder failure as a sequence.
+ * gimple.h (gimple_statement_catch): Make handler a sequence.
+ (gimple_statement_eh_filter): Make failure a sequence.
+ (gimple_build_catch): Make second argument a sequence.
+ (gimple_build_eh_filter): Same.
+ (gimple_catch_handler): Return a sequence.
+ (gimple_catch_set_handler): Make second argument a sequence.
+ (gimple_eh_filter_failure): Return a sequence.
+ (gimple_eh_filter_set_failture): Make second argument a sequence.
+
+2007-07-20 Aldy Hernandez <aldyh@redhat.com>
+
+ * gimplify.c (gimplify_return_expr): Handle an empty ret_expr
+ gracefully.
+
+2007-07-19 Aldy Hernandez <aldyh@redhat.com>
+
+ * testsuite/gcc.dg/gimple/instrument.c: New.
+ * gimplify.c (gimplify_function_tree): Generate tuples for function
+ instrumentation.
+
+2007-07-18 Aldy Hernandez <aldyh@redhat.com>
+
+ * gimplify.c (gimple_add_tmp_var): Remove abort. Add comment.
+
+2007-07-18 Aldy Hernandez <aldyh@redhat.com>
+
+ * gimplify.c (gimple_add_tmp_var): Remove abort. Add comment.
+
+2007-07-18 Aldy Hernandez <aldyh@redhat.com>
+
+ * gimplify.c (gimplify_and_add): Remove unecessary temporary sequence.
+ Remove fixme. Add comment.
+ (gimplify_loop_expr): Tuplefy.
+ (gimplify_bind_expr): Streamline GIMPLE_TRY_FINALLY tuple.
+ (gimplify_expr): Tuplefy TRY_*_EXPR cases.
+ * gimple.c: Fix some spacing.
+ (gimple_build_try, gimple_omp_build_*): Handle empty sequences.
+ (gimple_push): Remove.
+ * gimple.h (gimple_push): Remove.
+
+2007-07-18 Aldy Hernandez <aldyh@redhat.com>
+
+ * tree-gimple.h (declare_vars): Update arguments.
+ * gimplify.c (pop_gimplify_context): Enable call to declare_vars.
+ (declare_vars): Convert to use tuples.
+ (gimple_add_tmp_var): Same.
+ * gimple.h (GIMPLE_BLOCK): New.
+
+2007-07-17 Chris Matthews <chrismatthews@google.com>
+
+ * gimplify.c (gs_build_eh_filter): Renamed to gs_build_eh_filter_tree
+ to avoid name conflict.
+ * gimple-pretty-print.c: Renamed to debug_gs_* to debug_gimple_*.
+ Updated all users.
+ * gimple.h: Renamed all functions with GS and gs prefixes to GIMPLE and
+ gimple, and updated users.
+ Renamed gs_seq_* functions to gimple_seq_*. Updated all users.
+ * gimple.def: Definitions changed to from GS_* to GIMPLE_*.
+
+2007-07-16 Chris Matthews <chrismatthews@google.com>
+
+ * gimple.c (gs_build_switch): Changed nlabels to represent total number
+ of labels including the default.
+ (gs_build_switch_1): Same.
+ (walk_tuple_ops): Same.
+ * gimple-pretty-print.c (dump_gs_switch): Same.
+
+2007-07-16 Aldy Hernandez <aldyh@redhat.com>
+
+ * gimplify.c (gimplify_ctx): Rename current_bind_expr_seq to
+ bind_expr_stack and make it a vector.
+ (push_gimplify_context): Adjust bind_expr_stack for vectors.
+ (pop_gimplify_context): Same.
+ (gimple_push_bind_expr): Same.
+ (gimple_pop_bind_expr): Same.
+ (gimple_current_bind_expr): Same.
+ (get_tmp_var_for): Use ``code''.
+ (gimplify_bind_expr): Remove comment.
+ (gimplify_case_label_expr): Add whitespace.
+ * gimple.c (gs_pop): Remove.
+ * gimple.h: Define vectors of a gimple type.
+ (gs_pop): Remove prototype.
+ * Makefile.in (GIMPLE_H): Add vec.h.
+
+2007-07-15 Diego Novillo <dnovillo@google.com>
+
+ * gimple.c: Rename from gimple-ir.c.
+ Update all users.
+ * gimple.h: Rename from gimple-ir.h.
+ Update all users.
+
+2007-07-15 Diego Novillo <dnovillo@google.com>
+
+ * gimple-ir.c (gimple_statement_structure): Remove code
+ after gcc_unreachable call.
+ * gimplify.c (get_tmp_var_for): New.
+ (gimplify_call_expr): Call it.
+
+2007-07-14 Aldy Hernandez <aldyh@redhat.com>
+
+ * testsuite/gcc.dg/gimple/with_size_expr.c: Check for GS_TRY.
+ * Makefile.in (gimple-ir.o): Add diagnostic.h dependency.
+ * gimple-pretty-print.c (dump_gs_call): Dump LHS if available.
+ (dump_gs_try): New.
+ (dump_gimple_stmt): Add case for GS_TRY.
+ * gimple-ir.c. Include diagnostic.h.
+ (gs_build_try): Cleanup and eval are sequences.
+ Remove catch_p and finally_p arguments. Add catch_finally argument.
+ (gs_omp_build_critical): Body is a gs_seq.
+ (gs_omp_build_parallel): Same.
+ (gs_omp_build_section): Same.
+ (gs_omp_build_master): Same.
+ (gs_omp_build_continue): Same.
+ (gs_omp_build_ordered): Same.
+ (gs_omp_build_sections): Same.
+ (gs_omp_build_single): Same.
+ (gs_omp_build_for): Body and pre_body is a gs_seq.
+ (gs_push): New.
+ (gs_pop): New.
+ (walk_tuple_ops): Walk GS_TRY tuples eval and cleanups correctly.
+ Dump tuple before we ICE.
+ * gimple-ir.h (gs_seq_copy): New.
+ (struct gimple_statement_try): Eval and cleanups are gs_seq's.
+ (gs_bind_set_body): Use gs_seq_copy.
+ (gs_try_eval): Return address of eval.
+ (gs_try_cleanup): Return address of cleanup.
+ (gs_try_set_eval): Use gs_seq_copy.
+ (gs_try_set_cleanup): Same.
+ (gs_omp_set_body): Same.
+ (gs_omp_for_set_pre_body): Same.
+ * gimplify.c (struct gimplify_ctx): Rename current_bind_expr to
+ current_bind_expr_seq, and make it a sequence.
+ (pop_gimplify_context): Adjust for current_bind_expr_seq.
+ (gimple_push_bind_expr): Same.
+ (gimple_pop_bind_expr): Same.
+ (gimple_current_bind_expr): Same.
+ (build_stack_save_restore): Generate tuples.
+ (gimplify_bind_expr): Same.
+
+2007-07-13 Diego Novillo <dnovillo@google.com>
+
+ * gimple-ir.c (gs_add): Swap arguments.
+ Update all users.
+ * gimple-ir.h (gs_seq_append): Likewise.
+
+2007-07-12 Diego Novillo <dnovillo@google.com>
+
+ * tree.c (create_artificial_label): Move from gimplify.c
+ (get_name): Likewise.
+ * tree.h (create_artificial_label, get_name): Move
+ declarations earlier in the file.
+ * diagnostic.h (dump_gimple_stmt, print_gimple_stmt,
+ dump_gimple_seq): Rearrange.
+ * tree-gimple.h (gimplify_function_tree): Move from tree.h.
+ * gimple-pretty-print.c (do_niy): Tidy.
+ (maybe_init_pretty_print): Add comment.
+ (newline_and_indent): Likewise.
+ Remove "gimpleir: " prefix.
+ (debug_gimple_stmt): Add comment.
+ (dump_gs_seq): Remove.
+ (dump_gimple_seq): Add argument SPC.
+ Update all users.
+ If FLAGS contains TDF_DETAILS, emit "gimpleir:" prefix.
+ (dump_gs_cond): If FLAGS contains TDF_DETAILS, emit
+ "gimpleir:" prefix.
+ (dump_gs_bind): Likewise.
+ * function.h (struct function): Remove field 'gimplified'.
+ * gimple-ir.c (gimple_bodies): New private variable.
+ (set_gimple_body): New.
+ (gimple_body): New.
+ * gimple-ir.h: Include pointer-set.h.
+ Add comment before data structure definitons.
+ (set_gimple_body): Declare.
+ (gimple_body): Declare.
+ * gimplify.c (create_artificial_label): Move to tree.c
+ (get_name): Likewise.
+ (gimplify_function_tree): Change return type to void.
+ Call set_gimple_body after gimplification and nullify
+ DECL_SAVED_TREE.
+ Update all callers.
+ * common.opt (fgimple-only): New option.
+ * tree-optimize.c (tree_rest_of_compilation): Do not nullify
+ DECL_SAVED_TREE.
+ * c-gimplify.c (c_genericize): Restore gimplification logic to
+ mainline version.
+ If -fgimple-only was given, exit.
+ * Makefile.in (GIMPLE_IR_H): Add pointer-set.h
+ * tree-cfg.c (execute_build_cfg): Nullify GIMPLE body after
+ building the CFG.
+ (dump_function_to_file): If DECL_SAVED_TREE is NULL dump the
+ GIMPLE body of the function.
+
+2007-07-12 Diego Novillo <dnovillo@google.com>
+
+ * omp-low.c (lower_regimplify): Use a local GIMPLE sequence to
+ hold the result from gimplification.
+ * tree-gimple.c (is_gimple_min_val): Reformat.
+ * tree-gimple.h (enum fallback_t): Document values.
+ (gimplify_expr): Remove IS_STATEMENT argument.
+ Update all users.
+ * langhooks.c (lhd_gimplify_expr): Likewise.
+ * gimplify.c (gimplify_statement_list): If a temporary
+ was returned from voidify_wrapper_expr abort to mark the failure.
+ (gimplify_expr): Remove argument IS_STATEMENT.
+ Update all users.
+ Assert that FALLBACK is used with the appropriate GIMPLE_TEST_F
+ Restore logic to use internal queue.
+ Do not abort if on return from gimplify_call_expr, *EXPR_P has
+ a CALL_EXPR.
+
+2007-07-12 Aldy Hernandez <aldyh@redhat.com>
+
+ * gimple-ir.c (gs_build_switch_1): Allocate one less tree.
+ (gs_build_switch_1): Offset labels by one.
+ (gs_switch_label): Same.
+ (gs_switch_set_label): Same.
+
+2007-07-12 Aldy Hernandez <aldyh@redhat.com>
+
+ * gimple-ir.c (walk_seq_ops): Rename from walk_tree_seq.
+ (walk_tuple_ops): Rename from walk_tree_tuple.
+ * gimple-ir.h, gimplify.c, gimple-ir.c: Rename all calls to
+ walk_tree_seq and walk_tree_tuple accordingly.
+
+2007-07-12 Aldy Hernandez <aldyh@redhat.com>
+
+ * gimple-ir.c (gs_build_switch_1): Fix spacing.
+ Allocate one more tree.
+ (gs_build_switch): Set labels starting at 1.
+ (walk_tree_seq): New.
+ (walk_tree_tuple): New.
+ * gimple-ir.h: Add prototypes for walk_tree_tuple and walk_tree_seq.
+ * gimplify.c (check_pointer_types_r): Uncomment.
+ (gimplify_body): Walk gimple sequence with check_pointer_types_r.
+
+2007-07-11 Chris Matthews <chrismatthews@google.com>
+
+ * tree-pretty-print.c (dump_generic_node): Removed space before default
+ label colon.
+ * tree.h (sort_case_labels): Moved to gimple-ir.h.
+ * gimplify.c (sort_case_labels): Changed to a vector instead of tree
+ vector.
+ (gimplify_switch_expr): Initial implementation with tuples.
+ (gimplify_expr): Changed gimplify_case_label_expr parameter.
+ (gimplify_case_label_expr): Added a gs_seq parameter, and put cases in
+ that.
+ (dump_gimple_stmt): Removed semicolon.
+ (dump_gs_label): Refactored from dump_gimple_expr.
+ (dump_gs_switch): Added.
+ (gs_build_switch_vec): Added.
+ * gimple-ir.c (gs_build_switch_1): Added.
+ (gs_build_switch): Refactored to use gs_build_switch_1.
+ (gs_build_switch_vec): Added.
+ * gs_switch.c: New test case.
+ * gs_switch1.c: New test case.
+ * gs_switch2.c: New test case.
+
+2007-07-05 Aldy Hernandez <aldyh@redhat.com>
+
+ * gimple-pretty-print.c (dump_gimple_stmt): Alphabetize cases.
+ Add case for GS_NOP.
+ * gimplify.c (gimplify_body): Handle null bodies.
+ Use GS_CODE instead of GS_SUBCODE_FLAGS.
+
+2007-07-05 Aldy Hernandez <aldyh@redhat.com>
+
+ * testsuite/gcc.dg/gimple/with_size_expr.c: Clean up dump.
+ * testsuite/gcc.dg/gimple/gs_bind.c: Clean up dump.
+ * gimplify.c (struct gimplify_ctx): Make current_bind_expr a tuple.
+ (pop_gimplify_context): Accept gimple.
+ Comment out call to declare_vars.
+ (gimple_current_bind_expr): Return gimple.
+ (unshare_all_trees): Remove.
+ (gimplify_self_mod_expr): Remove comment.
+ (gimplify_cleanup_point_expr): Correct typo in call to gs_seq_init.
+ (gimplify_body): Remove body local.
+ Build GS_BIND tuples when needed.
+ Do not call unshare_all_trees.
+ Call pop_gimplify_context with appropriate argument.
+ Comment out call to walk_tree.
+ * tree-pretty-print.c (print_declaration): Remove static.
+ * diagnostic.h (print_declaration): Prototype.
+ * tree-gimple.h (pop_gimplify_context): Accept gimple tuple.
+ (gimple_current_bind_expr): Return tuple.
+ * gimple-pretty-print.c (dump_gs_seq): New.
+ (dump_gs_bind): New.
+ (dump_gimple_stmt): Add case for GS_BIND. Print semi-colons after
+ each statement.
+
+2007-06-29 Aldy Hernandez <aldyh@redhat.com>
+
+ * gimplify.c (gimple_push_condition): Enable. Call gs_seq_init with
+ address.
+ (gimplify_cond_expr): Push and pop conditions. Use other GS_COND
+ predicates when appropriate
+
+2007-06-28 Aldy Hernandez <aldyh@redhat.com>
+
+ * testsuite/gcc.dg/gimple/gs_goto.c: New.
+ * testsuite/gcc.dg/gimple/gs_cond.c: New.
+ * tree-gimple.h (gimplify_stmt): Return bool.
+ * gimple-pretty-print.c (INDENT): New.
+ (newline_and_indent): New.
+ (op_gs_cond): New.
+ (dump_gs_cond): New.
+ (dump_gimple_stmt): New.
+ * gimple-ir.c (gs_cond_invert): New.
+ * gimple-ir.h (enum gs_cond): Add comment.
+ (gs_cond_invert): Protoize.
+ * gimplify.c (gimplify_cond_expr): Rewrite for tuples.
+ (gimplify_stmt): Return true if we added a statement to the queue.
+ (gimplify_expr): Enable gimplify_cond_expr.
+ Build tuples for GOTO_EXPRs and LABEL_EXPRs.
+
+2007-06-27 Aldy Hernandez <aldyh@redhat.com>
+
+ * gimple-ir.h (gs_seq_last): Return last statement.
+ * testsuite/gcc.dg/gimple/compound_expr.c: Add checks.
+ * testsuite/gcc.dg/gimple/gs_call.c: Same.
+ * testsuite/gcc.dg/gimple/constructors.c: Same.
+ * testsuite/gcc.dg/gimple/gs_assign.c: Same.
+
+2007-06-27 Aldy Hernandez <aldyh@redhat.com>
+
+ Put this patch back in.
+
+ 2007-06-22 Aldy Hernandez <aldyh@redhat.com>
+
+ * gimplify.c (gimplify_modify_expr): Return after a successful
+ call to gimplify_modify_expr_rhs.
+
+2007-06-26 Aldy Hernandez <aldyh@redhat.com>
+
+ * testsuite/gcc.dg/gimple/gimple.exp: Pass -fdump-tree-gimple-details
+ * testsuite/gcc.dg/gimple/compound_expr.c: Add dg-final.
+ * testsuite/gcc.dg/gimple/gs_return.c: Same.
+ * tree.h (gimplify_function_tree): Add return value.
+ * diagnostic.h (debug_c_tree): Move under tree-pretty-print.c section.
+ (dump_gimple_seq): New.
+ to tests.
+ * gimple-pretty-print.c (dump_gimple_seq): New.
+ * gimplify.c (gimplify_function_tree): Add return value.
+ Remove debug call and exit.
+ Comment out non-working code.
+ * c-gimplify.c (c_genericize): Dump gimple IR. Exit.
+
+2007-06-26 Diego Novillo <dnovillo@google.com>
+
+ * gimple-ir.c (gs_build_call_1): Fix formatting.
+
+2007-06-26 Diego Novillo <dnovillo@google.com>
+
+ * gimple-pretty-print.c (dump_gs_assign, dump_gs_return,
+ dump_gs_call): New functions.
+ (dump_gimple_stmt): Call them.
+ * gimple-ir.c (gs_build_call_1): Factor out of gs_build_call.
+ (gs_build_call): Call it.
+ (gs_build_call_vec): New function.
+ * gimple-ir.h (struct gimple_statement_call): Change type of
+ field 'nargs' to size_t. Update all users.
+ (gs_build_call_vec): Declare.
+ (gs_call_set_fn): Remove.
+ (gs_call_set_nargs): Remove.
+ * gimplify.c: Include "vec.h"
+ (gimplify_return_expr): Fix formatting
+ (gimplify_call_expr): Call gs_build_call_vec.
+ (gimplify_expr): Do not try to test if NULL expressions
+ are in GIMPLE form.
+ (gimplify_function_tree): Do not call debug_gimple_seq.
+ * Makefile.in (gimplify.o): Include vec.h
+
+2007-06-25 Chris Matthews <chrismatthews@google.com>
+
+ * gimplify.c (gimple_current_bind_expr): Changed to work with gs_seq
+ accessors
+ (gimplify_and_add): Same.
+ (annotate_all_with_locus): Same.
+ (gimplify_self_mod_expr): Same.
+ (gimplify_cleanup_point_expr): Same.
+ (gimplify_expr): Same.
+ (gimplify_body): Same.
+ (force_gimple_operand): Same.
+ (gimplify_init_ctor_eval_range): Added GS_ prefix.
+ * gimple-iterator.h (gsi_last): Changed to gs_seq accessors. Changed
+ gimple_stmt_iterator to use a gimple instead of gimple *.
+ (gsi_one_before_end_p): Same.
+ (gsi_start): Same.
+ * gimple-ir.h (gs_cond): Prepended GS_ to names.
+ (gs_seq_first): Replaced macro.
+ (gs_seq_last): Same.
+ (gs_seq_set_first): Same.
+ (gs_seq_set_last): Same.
+ (gs_seq_init): Same.
+ (gs_seq_empty_p): Same.
+ (gs_assign_operand) Changed opno to be a size_t to match set.
+ (gs_bind_body): Changed to use gs_seq.
+ (gs_bind_set_body): Changed to use gs_seq, and gs_seq_set_first, and last.
+ (gs_asm_ninputs): Renamed.
+ (gs_asm_noutputs): Renamed.
+ (gs_asm_nclobbered): Renamed.
+ (gs_asm_set_ninputs): Renamed.
+ (gs_asm_set_noutputs): Renamed.
+ (gs_asm_set_nclobbered): Renamed.
+ (gs_asm_set_input_op): Renamed.
+ (gs_asm_input_op): Renamed.
+ (gs_asm_set_output_op): Renamed.
+ (gs_asm_output_op): Renamed.
+ (gs_omp_body): Changed to use gs_seq.
+ (gs_omp_set_body): Changed to use gs_seq accessors.
+ (gs_omp_for_pre_body): Changed to use gs_seq.
+ (gs_omp_for_set_pre_body): Changed to use gs_seq accessors.
+ (gs_seq_append): Changed to use gs_seq accessors.
+ * gimple-ir.c (gs_add): Same.
+ (gs_build_asm): Changed argument names to match accessors, and changed
+ functions to new accessor names.
+ (gs_build_cond): Reformatted.
+ (gs_build_phi): Same.
+ (gs_build_try): Renamed args to try_p and catch_p.
+ (gs_build_omp_return): Change to correct arguments, and added a subcode
+ flag.
+ * function.c (gimplify-oaraneters): Changed to gs_seq accessors.
+
+2007-06-22 Aldy Hernandez <aldyh@redhat.com>
+
+ * gimplify.c (gimplify_modify_expr): Return after a successful
+ call to gimplify_modify_expr_rhs.
+
+2007-06-21 Aldy Hernandez <aldyh@redhat.com>
+
+ * gimple-ir.h (gs_assign_binary_rhs1): Add assertion for
+ GSS_ASSIGN_BINARY.
+ (gs_assign_binary_set_rhs1): Same.
+ (gs_assign_binary_rhs2): Same.
+ (gs_assign_binary_set_rhs2): Same.
+ (gs_assign_unary_rhs): Same.
+ (gs_assign_unary_set_rhs): Same.
+
+2007-06-21 Aldy Hernandez <aldyh@redhat.com>
+
+ * gcc.dg/gimple/gimple.exp: New.
+ * gcc.dg/gimple/compound_expr.c: New.
+ * gcc.dg/gimple/with_size_expr.c: New.
+ * gcc.dg/gimple/compound_expr.c: New.
+ * gcc.dg/gimple/gs_call.c: New.
+ * gcc.dg/gimple/constructors.c: New.
+ * gcc.dg/gimple/gs_return.c: New.
+ * gcc.dg/gimple/gs_assign.c: New.
+
+2007-06-21 Aldy Hernandez <aldyh@redhat.com>
+
+ * gimple-ir.c (gs_build_cond): Change order of arguments. Make labels
+ of type tree.
+ (gs_build_asm): Fix formatting.
+ * gimple-ir.h (gimple_statement_cond): Make labels of type tree.
+ (gs_build_cond): Change order and type of arguments.
+ (gs_build_asm): Fix formatting.
+ (gs_omp_build_for): Same.
+ (gs_assign_binary_rhs1): Remove assert.
+ (gs_assign_binary_set_rhs1): Same.
+ (gs_assign_binary_rhs2): Same.
+ (gs_assign_binary_set_rhs2): Same.
+ (gs_assign_unary_rhs): Same.
+ (gs_cond_true_label): Return a tree.
+ (gs_cond_set_true_label): Make label a tree.
+ (gs_cond_set_false_label): Make label a tree.
+ (gs_cond_false_label): Return a tree.
+ * gimplify.c (gimplify_init_ctor_eval_range): Build tuples.
+ (gimplify_init_ctor_eval): Same.
+ (gimplify_init_constructor): Enable. Adjust for tuples.
+ (gimplify_modify_expr_rhs): Uncomment call to
+ gimplify_init_constructor.
+
+2007-06-21 Diego Novillo <dnovillo@google.com>
+
+ * gimple.def: Rename from gs.def.
+ Adjust all users.
+
+2007-06-21 Diego Novillo <dnovillo@google.com>
+
+ * tree-pretty-print.c (pred_symbol_code, do_gs_niy,
+ debug_gimple_stmt, debug_gimple_seq, print_gimple_stmt,
+ dump_gimple_stmt): Move to gimple-pretty-print.c
+ * diagnostic.h: Add comment for functions in gimple-pretty-print.c
+ * gimple-pretty-print.c: New file.
+ * gimple-ir.c (gs_build_return): Fix spacing.
+ (gs_build_assign): Likewise.
+ * gimple-ir.h: Fix spacing.
+ (gs_assign_set_operand): Change OPNO to size_t.
+ Add assertions for OPNO's value.
+ (gs_assign_lhs): Rename from gs_assign_operand_lhs.
+ (gs_assign_binary_rhs1): Rename from gs_assign_operand_rhs.
+ Assert that GS is GSS_ASSIGN_BINARY
+ (gs_assign_binary_set_rhs1): Rename from gs_assign_set_rhs.
+ Assert that GS is GSS_ASSIGN_BINARY.
+ (gs_assign_binary_set_rhs2): Rename from gs_assign_set_rhs2.
+ Assert that GS is GSS_ASSIGN_BINARY.
+ (gs_assign_unary_rhs): New.
+ (gs_assign_unary_set_rhs): New.
+ (gs_call_fn, gs_call_lhs, gs_call_chain, gs_call_arg,
+ gs_cond_lhs, gs_cond_rhs, gs_label_label, gs_goto_dest,
+ gs_bind_vars, gs_asm_in_op, gs_asm_out_op, gs_asm_clobber_op,
+ gs_catch_types, gs_catch_handler, gs_eh_filter_types,
+ gs_eh_filter_failure, gs_try_eval, gs_try_cleanup,
+ gs_phi_result, gs_switch_index, gs_switch_default_label,
+ gs_switch_label,gs_omp_critical_name, gs_omp_for_clauses,
+ gs_omp_for_index, gs_omp_for_initial, gs_omp_for_final,
+ gs_omp_for_incr, gs_omp_parallel_clauses,
+ gs_omp_parallel_child_fn, gs_omp_parallel_data_arg,
+ gs_omp_single_clauses, gs_omp_sections_clauses,
+ gs_return_retval): Change return type to 'tree'.
+ * Makefile.in (OBJS-common): Add gimple-pretty-print.o.
+ (gimple-pretty-print.o): New rule.
+
+2007-06-20 Aldy Hernandez <aldyh@redhat.com>
+
+ * tree-pretty-print.c (dump_gimple_stmt): Change pred_symbol_code
+ to op_symbol_code.
+
+2007-06-19 Aldy Hernandez <aldyh@redhat.com>
+
+ * gimplify.c (gimplify_modify_expr_rhs): Enable. Adjust for tuples.
+ (gimplify_modify_expr): Call gimplify_modify_expr_rhs.
+ (gimplify_compound_expr): Enable. Adjust for tuples. Remove comment
+ that no longer applies.
+ (gimplify_expr): Enable call to gimplify_compound_expr.
+
+2007-06-18 Chris Matthews <chrismatthews@google.com>
+
+ * Makefile.in (GTFILES): Added gimeple-ir.h.
+
+ * gimple-ir.c (gs_build_return, gs_build_call, gs_build_assign):
+ Changed to use new accessors.
+ (gs_build_cond, gs_build_label, gs_build_goto,
+ gs_build_nop, gs_build_bind gs_build_asm, gs_build_catch,
+ gs_build_eh_filter, gs_build_try, gs_build_phi,
+ gs_build_resx, gs_build_switch, gs_omp_build_critical,
+ gs_omp_build_for, gs_omp_build_parallel,
+ gs_omp_build_section, gs_omp_build_master,
+ gs_omp_build_ordered, gs_omp_continue,
+ gs_omp_build_ordered, gs_omp_build_return,
+ gs_omp_build_sections, gs_omp_build_single): New
+ functions.
+
+ * gimple-ir.h (struct gimple_statement_switch): Changed
+ default label to be in labels[0].
+
+ (struct gimple_statement_asm): Corrected the allocation
+ length.
+
+ (enum gs_cond): New enum.
+ (gs_assign_set_operand): Changed to work with new accessors.
+ (gs_assign_operand_lhs, gs_assign_operand_rhs,
+ gs_assign_operand_set_lhs, gs_assign_set_rhs,
+ gs_assign_operand_rhs2, gs_assign_set_rhs2, gs_call_fn,
+ gs_call_set_fn, gs_call_lhs, gs_call_set_lhs,
+ gs_call_chain, gs_call_set_chain, gs_call_nargs,
+ gs_call_set_nargs, gs_call_arg, gs_call_set_arg,
+ gs_cond_lhs, gs_cond_set_lhs, gs_cond_rhs,
+ gs_cond_set_rhs, gs_cond_true_label,
+ gs_cond_set_true_label, gs_cond_set_false_label,
+ gs_cond_false_label, gs_label_label, gs_label_set_label,
+ gs_goto_dest, gs_goto_set_dest, gs_bind_vars,
+ gs_bind_set_vars, gs_bind_body, gs_bind_set_body,
+ gs_asm_ni, gs_asm_set_ni, gs_asm_no, gs_asm_set_no,
+ gs_asm_nc, gs_asm_set_nc, gs_asm_in_op, gs_asm_set_in_op,
+ gs_asm_out_op, gs_asm_set_out_op, gs_asm_clobber_op,
+ gs_asm_set_clobber_op, gs_asm_string, gs_asm_set_string,
+ gs_catch_types, gs_catch_handler, gs_catch_set_types,
+ gs_catch_set_handler, gs_eh_filter_types,
+ gs_eh_filter_failure, gs_eh_filter_set_types,
+ gs_eh_filter_set_failure, gs_try_eval, gs_try_cleanup,
+ gs_try_set_eval, gs_try_set_cleanup, gs_phi_capacity,
+ gs_phi_set_capacity, gs_phi_nargs, gs_phi_set_nargs,
+ gs_phi_result, gs_phi_set_result, gs_phi_arg,
+ gs_phi_set_arg, gs_resx_region, gs_resx_set_region,
+ gs_switch_nlabels, gs_switch_set_nlabels,
+ gs_switch_index, gs_switch_set_index,
+ gs_switch_default_label, gs_switch_set_default_label,
+ gs_switch_label, gs_switch_set_label, gs_omp_body,
+ gs_omp_set_body, gs_omp_critical_name,
+ gs_omp_critical_set_name, gs_omp_for_clauses,
+ gs_omp_for_set_clauses, gs_omp_for_index,
+ gs_omp_for_set_index, gs_omp_for_initial,
+ gs_omp_for_set_initial, gs_omp_for_final,
+ gs_omp_for_set_final, gs_omp_for_incr,
+ gs_omp_for_set_incr, gs_omp_for_pre_body,
+ gs_omp_for_set_pre_body, gs_omp_parallel_clauses,
+ gs_omp_parallel_set_clauses, gs_omp_parallel_child_fn,
+ gs_omp_parallel_set_child_fn, gs_omp_parallel_data_arg,
+ gs_omp_parallel_set_data_arg, gs_omp_single_clauses,
+ gs_omp_single_set_clauses, gs_omp_sections_clauses,
+ gs_omp_sections_set_clauses, gs_assign_omp_for_cond,
+ gs_omp_for_cond gs_return_set_retval,
+ gs_add_subcode_flag): New accessor functions.
+ (gs_return_retval): Renamed gs_return_operand_retval to match accessor
+ conventions.
+
+2007-05-31 Aldy Hernandez <aldyh@redhat.com>
+
+ * gimple-ir.c (gs_build_call): New.
+ * gimple-ir.h (GS_CALL_LHS): New.
+ (GS_CALL_FN): New.
+ (GS_CALL_CHAIN): New.
+ (GS_CALL_NARGS): New.
+ (GS_CALL_ARG): New.
+ (gs_call_lhs): New.
+ (gs_call_fn): New.
+ (gs_call_chain): New.
+ (gs_call_nargs): New.
+ (gs_call_arg): New.
+ * gimplify.c (gimplify_modify_expr_to_memcpy): Enable and rewrite for
+ tuples.
+ (gimplify_modify_expr_to_memset): Same.
+ (gimplify_statement_list): Same.
+ (gimplify_expr): Enable STATEMENT_LIST case.
+
+2007-05-29 Aldy Hernandez <aldyh@redhat.com>
+
+ Merged revisions 124007-125166 from mainline.
+
+2007-05-23 Aldy Hernandez <aldyh@redhat.com>
+
+ * builtins.c (std_gimplify_va_arg_expr): Add argument to gimplify_expr.
+ Remove seq argument.
+ (gimplify_va_arg_expr): Same.
+ * tree-gimple.h: Same.
+ * langhooks.c (lhd_gimplify_expr): Change pre_p and post_p types to
+ sequences.
+ * langhooks-def.h (lhd_gimplify_expr): Change
+ * langhooks.h (struct lang_hooks): Remove argument.
+ * gimplify.c (internal_get_tmp_var): Adjust calls to gimplify_expr
+ for new arguments.
+ (gimplify_switch_expr): Same.
+ (gimplify_var_or_parm_decl): Same.
+ (gimplify_compound_lval): Same.
+ (gimplify_self_mod_expr): Same.
+ (gimplify_arg): Same.
+ (gimplify_call_expr): Same.
+ (gimplify_init_ctor_preeval): Same.
+ (gimplify_init_constructor): Same.
+ (gimplify_modify_expr_rhs): Same.
+ (gimplify_modify_expr): Same.
+ (gimplify_save_expr): Same.
+ (gimplify_addr_expr): Same.
+ (gimplify_asm_expr): Same.
+ (gimplify_target_expr): Same.
+ (omp_check_private): Same.
+ (gimplify_scan_omp_clauses): Same.
+ (gimplify_omp_parallel): Same.
+ (gimplify_omp_for): Same.
+ (goa_stabilize_expr): Same.
+ (gimplify_omp_atomic): Same.
+ (gimplify_one_sizepos): Same.
+ (force_gimple_operand): Same.
+ (gimplify_expr): Remove seq_p argument. Add new is_statement
+ argument. Adjust accordingly. Make seq_p required.
+
+2007-05-07 Aldy Hernandez <aldyh@redhat.com>
+
+ * function.c (gimplify_parameters): Use new GS_SEQ_INIT definition.
+ * gimple-ir.h (GS_SEQ_INIT): Do not use C99 constructs.
+ * gimplify.c: Disable non working code throughout.
+ Pass additional call to gimplify_expr throughout.
+ (gimplify_ctx): Make conditional_cleanups a sequence.
+ (gimple_push_condition): Use GS_SEQ_EMPTY_P.
+ (gimple_pop_condition): Adapt for sequences.
+ (gimplify_and_add): Use gs_seq_append regardless of side effects.
+ (internal_get_tmp_var): Use sequences.
+ (get_formal_tmp_var): Same.
+ (get_initialized_tmp_var): Same.
+ (annotate_one_with_locus): Change GS_LOCUS to GS_LOCUS_EMPTY_P.
+ (gimplify_bind_expr): Use sequences.
+ Change append_to_statement_list to gimplify_and_add.
+ (gimplify_return_expr): Add gimplified code to pre_p.
+ (gimplify_decl_expr): New seq_p parameter.
+ (gimplify_loop_expr): Adapt for sequences.
+ Use gimplify_and_add instead of append_to_statement_list.
+ (gimplify_switch_expr): Same.
+ (gimplify_compound_lval): Use sequences.
+ (gimplify_self_mod_expr): Same.
+ Use gs_seq_append instead of append_to_statement_list.
+ (gimplify_arg): Use sequences.
+ (gimplify_call_expr): Same.
+ (gimplify_cond_expr): Use sequences.
+ (gimplify_init_ctor_preeval): Use sequences.
+ (gimplify_init_ctor_eval_range): Same.
+ Use gimplify_and_add instead of append_to_statement_list.
+ (gimplify_init_ctor_eval): Use sequences.
+ (gimplify_init_constructor): Same.
+ Remove one call to append_to_statement_list.
+ (gimplify_modify_expr_rhs): Use sequences.
+ (gimplify_modify_expr_complex_part): Use sequences.
+ Remove call to tree_to_gimple_tuple.
+ Build GS_ASSIGN tuple.
+ (gimplify_modify_expr): Use new argument. Use sequences.
+ Do not call append_to_statement_list.
+ Build GS_ASSIGN tuple.
+ Do not call tree_to_gimple_tuple.
+ Set *expr_p to NULL when we do not want the value.
+ (gimplify_compound_expr): Use sequences.
+ (gimplify_save_expr): Same.
+ (gimplify_addr_expr): Same.
+ (gimplify_asm_expr): Same.
+ (gimplify_cleanup_point_expr): Same.
+ (gimple_push_cleanup): Same.
+ Build GS_ASSIGN tuples.
+ (gimplify_target_expr): Use sequences.
+ (gimplify_scan_omp_clauses): Same.
+ Add argument to gimplify_stmt calls.
+ (gimplify_omp_parallel): Same.
+ (gimplify_omp_for): Use sequences.
+ (gimplify_omp_workshare): Same.
+ (goa_stabilize_expr): Same.
+ (gimplify_omp_atomic_pipeline): Same.
+ (gimplify_omp_atomic_mutex): Same.
+ (gimplify_omp_atomic): Same.
+ (gimplify_expr): Same.
+ Call GS_SEQ_INIT with argument.
+ Use new seq_p argument.
+ Do not call tree_to_gimple_tuple.
+ Pass additional argument to gimplify_decl_expr.
+ Do not pass seq_p argument to gimplify_return_expr.
+ Call gs_seq_append instead of append_to_statement_list.
+ Check that all statements have been converted to tuples.
+ Make pre_p and seq_p sequences coexist.
+ (gimplify_type_sizes): Use sequences.
+ (gimplify_one_sizepos): Same.
+ (gimplify_body): Make parm_stmts a sequence.
+ Add argument to seq_p.
+ (gimplify_function_tree): Call debug_gimple_seq.
+ (force_gimple_operand): Use sequences.
+ (force_gimple_operand_bsi): Use sequences.
+
+2007-05-04 Aldy Hernandez <aldyh@redhat.com>
+
+ * omp-low.c (build_omp_barrier): Adjust arguments for sequences.
+ (lower_rec_input_clauses): Disable non working code.
+ (lower_regimplify): Pass additional argument to gimplify_expr.
+ * tree-mudflap.c (mx_register_decls): Disable non working code.
+ * tree-inline.c (copy_bb): Disable non working code.
+ (setup_one_parameter): Same.
+ * tree-cfg.c (make_edges): Same.
+
+2007-05-04 Aldy Hernandez <aldyh@redhat.com>
+
+ * tree-gimple.h (get_initialized_tmp_var): Adjust prototype
+ for sequences.
+ (get_formal_tmp_var): Same.
+ (gimplify_type_sizes): Same.
+ (gimplify_one_sizepos): Same.
+ (gimplify_stmt): Same.
+ (gimplify_and_add): Same.
+ (gimplify_va_arg_expr): Same.
+ * langhooks.h (lang_hooks): Same.
+ * function.c (gimplify_parm_type): Adjust for sequences.
+ (gimplify_parameters): Same.
+ * c-gimplify.c (gimplify_compound_literal_expr): Same.
+ (c_gimplify_expr): Same.
+ * tree-flow.h (force_gimple_operand): Same.
+ * c-common.h (c_gimplify_expr): Adjust prototype for sequences.
+ * config/i386/i386.c (ix86_gimplify_va_arg): Adjust for sequences.
+ Change call to append_to_statement_list to gimplify_and_add.
+ Add parameter to gimplify_expr.
+
+2007-05-04 Aldy Hernandez <aldyh@redhat.com>
+
+ * gimple-ir.c (gs_code_name): Constify.
+ (gs_build_assign): New.
+ (gimple_statement_structure): Abstract code out to...
+ (gss_for_assign): ...here.
+ (gs_add): Set the last item correctly.
+ * gimple-ir.h (GS_LOCUS_EMPTY_P): New.
+ (GS_SEQ_INIT): Add a cast.
+ (gimple_statement_base): Make code a gs_code enum.
+ (gimple_statement_with_ops): Remove address_taken.
+ (GS_ASSIGN_BINARY_LHS): New.
+ (GS_ASSIGN_BINARY_RHS1): New.
+ (GS_ASSIGN_BINARY_RHS2): New.
+ (GS_ASSIGN_UNARY_REG_LHS): New.
+ (GS_ASSIGN_UNARY_REG_RHS): New.
+ (GS_ASSIGN_UNARY_MEM_LHS): New.
+ (GS_ASSIGN_UNARY_MEM_RHS): New.
+ (gs_seq_append): New.
+ Move gs_seq typedef to...
+ * coretypes.h: ...here.
+ * gimple-iterator.h (gsi_stmt_ptr): Add FIXME note.
+
+2007-05-04 Aldy Hernandez <aldyh@redhat.com>
+
+ * tree.h (std_gimplify_va_arg_expr): Change tree * to a sequence
+ in prototype.
+ (gimplify_parameters): Return a sequence.
+ * target.h (gimplify_va_arg_expr): Change tree * to a sequence.
+ * builtins.c (std_gimplify_va_arg_expr): Same.
+ Pass additional argument to gimplify_expr.
+ (gimplify_va_arg_expr): Change tree * to a sequence.
+ Change append_to_statement_list call to gimplify_and_add.
+ Pass additional argument to gimplify_expr calls.
+
+2007-05-04 Aldy Hernandez <aldyh@redhat.com>
+
+ * tree-pretty-print.c (do_gs_niy): New.
+ (debug_gimple_stmt): New.
+ (debug_gimple_seq): New.
+ (print_gimple_stmt): New.
+ (dump_gimple_stmt): New.
+ * diagnostic.h: Add prototypes for dump_gimple_stmt,
+ print_gimple_stmt, debug_gimple_stmt, debug_gimple_seq.
+
+2007-04-26 Aldy Hernandez <aldyh@redhat.com>
+
+ * tree-gimple.h (annotate_all_with_locus): First argument is now a
+ sequence.
+ * gimple-ir.h (GS_LOCUS): New.
+ (gimple_statement_base): Locus is of type location_t.
+ * gimplify.c (internal_get_tmp_var): Use sequences.
+ (should_carry_locus_p): Adjust for gimple ir.
+ (annotate_one_with_locus): Same.
+ (annotate_all_with_locus): Same.
+ (gimplify_stmt): Adjust for sequences.
+ (gimplify_expr): Same.
+
+2007-04-25 Aldy Hernandez <aldyh@redhat.com>
+
+ * gimple-ir.h (GS_SEQ_EMPTY_P): New.
+ Move gs_build_return, gs_add, and gimple_statement_structure
+ prototypes.
+ (gs_assign_operand): Fix typos in gss.
+ Include gimple-iterator.h.
+ * Makefile.in (GIMPLE_IR_H): Add gimple-iterator.h.
+ (TREE_GIMPLE_H): Same.
+
+2007-04-25 Aldy Hernandez <aldyh@redhat.com>
+
+ * gimple-iterator.h (gsi_one_before_end_p): Use GS_SEQ_LAST.
+
+2007-04-25 Aldy Hernandez <aldyh@redhat.com>
+
+ * gimple-iterator.h: New file.
+
+2007-04-23 Aldy Hernandez <aldyh@redhat.com>
+
+ * gimple-ir.c: New file.
+ * gimple-ir.h: New file.
+ * gsstruct.def: New file.
+ * gs.def: New file.
+ * gengtype.c (open_base_files): Add gimple-ir.h.
+ * tree-gimple.h: Include gimple-ir.h.
+ Add sequence to gimplify_expr and gimplify_body prototypes.
+ * gimplify.c: Include gimple-ir.h.
+ (gimplify_and_add): Adjust for gimple IR.
+ (gimplify_return_expr): Same.
+ (gimplify_stmt): Add seq_p argument.
+ (gimplify_expr): Add seq_p sequence and adjust accordingly.
+ (gimplify_body): Same.
+ * coretypes.h: Add gimple_statement_d and gimple definitions.
+ * Makefile.in (GIMPLE_IR_H): New.
+ (TREE_GIMPLE_H): Add gimple-ir.h.
+ (OBJS-common): Add gimple-ir.o.
+ (gimplify.o): Add GIMPLE_IR_H.
+ (gimple-ir.o): New.
+ (build/gencheck.o): Add gs.def.
+
+Local Variables:
+mode: change-log
+End:
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 153ee5ea3fa..ea1b9d61631 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20080715
+20080815
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 430de8bb425..8970d1bf6a3 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -113,15 +113,6 @@ VPATH = @srcdir@
vpath %.texi $(gcc_docdir)
vpath %.texi $(gcc_docdir)/include
-# ----
-# Default values for variables overridden in Makefile fragments.
-# These need to be quite early in the Makefile so as to avoid
-# trouble induced by changes in fragment ordering.
-# ----
-
-# For ada/Make-lang.in; overridden in, for example, config/pa/x-ada.
-X_ADA_CFLAGS =
-
# --------
# UNSORTED
# --------
@@ -136,9 +127,11 @@ SUBDIRS =@subdirs@ build
CONFIG_LANGUAGES = @all_selected_languages@
LANGUAGES = c gcov$(exeext) gcov-dump$(exeext) $(CONFIG_LANGUAGES)
-# Various ways of specifying flags for compilations:
+# Default values for variables overridden in Makefile fragments.
# CFLAGS is for the user to override to, e.g., do a cross build with -O2.
# TCFLAGS is used for compilations with the GCC just built.
+# T_CFLAGS is used for all compilations and is overridden by t-* files.
+T_CFLAGS =
TCFLAGS =
CFLAGS = @CFLAGS@
LDFLAGS = @LDFLAGS@
@@ -198,9 +191,6 @@ WARN_CFLAGS = @warn_cflags@
CPPFLAGS = @CPPFLAGS@
-# These exists to be overridden by the x-* and t-* files, respectively.
-T_CFLAGS =
-
AWK = @AWK@
CC = @CC@
BISON = @BISON@
@@ -269,8 +259,8 @@ write_entries_to_file = $(shell rm -f $(2) || :) $(shell touch $(2)) \
$(foreach range, \
$(shell i=1; while test $$i -le $(words $(1)); do \
echo $$i; i=`expr $$i + $(write_entries_to_file_split)`; done), \
- $(shell echo $(wordlist $(range), \
- $(shell expr $(range) + $(write_entries_to_file_split) - 1), $(1)) \
+ $(shell echo "$(wordlist $(range), \
+ $(shell expr $(range) + $(write_entries_to_file_split) - 1), $(1))" \
| tr ' ' '\n' >> $(2)))
# --------
@@ -778,6 +768,7 @@ REVISION_s :=
endif
# Shorthand variables for dependency lists.
+TOPLEV_H = toplev.h input.h
TARGET_H = $(TM_H) target.h insn-modes.h
MACHMODE_H = machmode.h mode-classes.def insn-modes.h
HOOKS_H = hooks.h $(MACHMODE_H)
@@ -793,10 +784,12 @@ BUILTINS_DEF = builtins.def sync-builtins.def omp-builtins.def
TREE_H = tree.h all-tree.def tree.def c-common.def $(lang_tree_files) \
$(MACHMODE_H) tree-check.h $(BUILTINS_DEF) \
$(INPUT_H) statistics.h vec.h treestruct.def $(HASHTAB_H) \
- double-int.h alias.h $(SYMTAB_H)
+ double-int.h alias.h $(SYMTAB_H) options.h
BASIC_BLOCK_H = basic-block.h $(BITMAP_H) sbitmap.h varray.h $(PARTITION_H) \
hard-reg-set.h $(PREDICT_H) vec.h $(FUNCTION_H) \
cfghooks.h $(OBSTACK_H)
+GIMPLE_H = gimple.h gimple.def gsstruct.def pointer-set.h vec.h \
+ $(GGC_H) $(BASIC_BLOCK_H) $(TM_H) $(TARGET_H) tree-ssa-operands.h
GCOV_IO_H = gcov-io.h gcov-iov.h auto-host.h
COVERAGE_H = coverage.h $(GCOV_IO_H)
DEMANGLE_H = $(srcdir)/../include/demangle.h
@@ -828,7 +821,7 @@ INSN_ATTR_H = insn-attr.h $(INSN_ADDR_H) $(srcdir)/varray.h
INSN_ADDR_H = $(srcdir)/insn-addr.h vecprim.h
C_COMMON_H = c-common.h $(SPLAY_TREE_H) $(CPPLIB_H) $(GGC_H)
C_PRAGMA_H = c-pragma.h $(CPPLIB_H)
-C_TREE_H = c-tree.h $(C_COMMON_H) toplev.h $(DIAGNOSTIC_H)
+C_TREE_H = c-tree.h $(C_COMMON_H) $(TOPLEV_H) $(DIAGNOSTIC_H)
SYSTEM_H = system.h hwint.h $(srcdir)/../include/libiberty.h \
$(srcdir)/../include/safe-ctype.h $(srcdir)/../include/filenames.h
PREDICT_H = predict.h predict.def
@@ -843,9 +836,8 @@ SYMTAB_H = $(srcdir)/../libcpp/include/symtab.h $(OBSTACK_H)
CPP_ID_DATA_H = $(CPPLIB_H) $(srcdir)/../libcpp/include/cpp-id-data.h
CPP_INTERNAL_H = $(srcdir)/../libcpp/internal.h $(CPP_ID_DATA_H)
TREE_DUMP_H = tree-dump.h $(SPLAY_TREE_H) tree-pass.h
-TREE_GIMPLE_H = tree-gimple.h tree-iterator.h
TREE_FLOW_H = tree-flow.h tree-flow-inline.h tree-ssa-operands.h \
- $(BITMAP_H) $(BASIC_BLOCK_H) hard-reg-set.h $(TREE_GIMPLE_H) \
+ $(BITMAP_H) $(BASIC_BLOCK_H) hard-reg-set.h $(GIMPLE_H) \
$(HASHTAB_H) $(CGRAPH_H) $(IPA_REFERENCE_H)
TREE_SSA_LIVE_H = tree-ssa-live.h $(PARTITION_H) vecprim.h
PRETTY_PRINT_H = pretty-print.h $(INPUT_H) $(OBSTACK_H)
@@ -859,7 +851,7 @@ TREE_INLINE_H = tree-inline.h $(VARRAY_H) pointer-set.h
REAL_H = real.h $(MACHMODE_H)
DBGCNT_H = dbgcnt.h dbgcnt.def
EBIMAP_H = ebitmap.h sbitmap.h
-IPA_PROP_H = ipa-prop.h $(TREE_H) vec.h
+IPA_PROP_H = ipa-prop.h $(TREE_H) vec.h $(CGRAPH_H)
GSTAB_H = gstab.h stab.def
BITMAP_H = bitmap.h $(HASHTAB_H) statistics.h
@@ -1090,7 +1082,10 @@ OBJS-common = \
gcse.o \
genrtl.o \
ggc-common.o \
+ gimple.o \
+ gimple-iterator.o \
gimple-low.o \
+ gimple-pretty-print.o \
gimplify.o \
global.o \
graph.o \
@@ -1181,7 +1176,6 @@ OBJS-common = \
tree-dfa.o \
tree-dump.o \
tree-eh.o \
- tree-gimple.o \
tree-if-conv.o \
tree-into-ssa.o \
tree-iterator.o \
@@ -1686,6 +1680,7 @@ libgcc.mvars: config.status Makefile $(LIB2ADD) $(LIB2ADD_ST) specs \
echo SHLIB_MAPFILES = '$(call srcdirify,$(SHLIB_MAPFILES))' >> tmp-libgcc.mvars
echo SHLIB_NM_FLAGS = '$(SHLIB_NM_FLAGS)' >> tmp-libgcc.mvars
echo LIBGCC2_CFLAGS = '$(LIBGCC2_CFLAGS)' >> tmp-libgcc.mvars
+ echo TARGET_LIBGCC2_CFLAGS = '$(TARGET_LIBGCC2_CFLAGS)' >> tmp-libgcc.mvars
echo LIBGCC_SYNC = '$(LIBGCC_SYNC)' >> tmp-libgcc.mvars
echo LIBGCC_SYNC_CFLAGS = '$(LIBGCC_SYNC_CFLAGS)' >> tmp-libgcc.mvars
echo CRTSTUFF_CFLAGS = '$(CRTSTUFF_CFLAGS)' >> tmp-libgcc.mvars
@@ -1775,7 +1770,7 @@ s-crt0: $(CRT0_S) $(MCRT0_S) $(GCC_PASSES) $(CONFIG_H)
c-errors.o: c-errors.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
$(C_TREE_H) $(FLAGS_H) $(DIAGNOSTIC_H) $(TM_P_H)
c-parser.o : c-parser.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
- $(GGC_H) $(TIMEVAR_H) $(C_TREE_H) $(INPUT_H) $(FLAGS_H) toplev.h output.h \
+ $(GGC_H) $(TIMEVAR_H) $(C_TREE_H) $(INPUT_H) $(FLAGS_H) $(TOPLEV_H) output.h \
$(CPPLIB_H) gt-c-parser.h $(RTL_H) langhooks.h $(C_COMMON_H) $(C_PRAGMA_H) \
vec.h $(TARGET_H) $(CGRAPH_H)
@@ -1790,15 +1785,15 @@ incpath.o: incpath.c incpath.h $(CONFIG_H) $(SYSTEM_H) $(CPPLIB_H) \
c-decl.o : c-decl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
$(RTL_H) $(C_TREE_H) $(GGC_H) $(TARGET_H) $(FLAGS_H) $(FUNCTION_H) output.h \
- $(EXPR_H) debug.h toplev.h intl.h $(TM_P_H) $(TREE_INLINE_H) $(TIMEVAR_H) \
+ $(EXPR_H) debug.h $(TOPLEV_H) intl.h $(TM_P_H) $(TREE_INLINE_H) $(TIMEVAR_H) \
opts.h $(C_PRAGMA_H) gt-c-decl.h $(CGRAPH_H) $(HASHTAB_H) libfuncs.h \
except.h $(LANGHOOKS_DEF_H) $(TREE_DUMP_H) $(C_COMMON_H) $(CPPLIB_H) \
- $(DIAGNOSTIC_H) $(INPUT_H) langhooks.h $(TREE_GIMPLE_H) tree-mudflap.h \
- pointer-set.h $(BASIC_BLOCK_H)
+ $(DIAGNOSTIC_H) $(INPUT_H) langhooks.h $(GIMPLE_H) tree-mudflap.h \
+ pointer-set.h $(BASIC_BLOCK_H) $(GIMPLE_H) tree-iterator.h
c-typeck.o : c-typeck.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(TREE_H) $(C_TREE_H) $(TARGET_H) $(FLAGS_H) intl.h output.h $(EXPR_H) \
- $(RTL_H) toplev.h $(TM_P_H) langhooks.h $(GGC_H) $(TREE_FLOW_H) \
- $(TREE_GIMPLE_H) tree-iterator.h
+ $(RTL_H) $(TOPLEV_H) $(TM_P_H) langhooks.h $(GGC_H) $(TREE_FLOW_H) \
+ $(GIMPLE_H) tree-iterator.h
c-lang.o : c-lang.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
$(C_TREE_H) $(DIAGNOSTIC_H) \
$(GGC_H) langhooks.h $(LANGHOOKS_DEF_H) $(C_COMMON_H) gtype-c.h \
@@ -1807,25 +1802,25 @@ stub-objc.o : stub-objc.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TREE_H) \
$(C_COMMON_H)
c-lex.o : c-lex.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
$(RTL_H) debug.h $(C_TREE_H) $(C_COMMON_H) $(REAL_H) $(SPLAY_TREE_H) \
- $(C_PRAGMA_H) $(INPUT_H) intl.h $(FLAGS_H) toplev.h output.h \
+ $(C_PRAGMA_H) $(INPUT_H) intl.h $(FLAGS_H) $(TOPLEV_H) output.h \
$(CPPLIB_H) $(TARGET_H) $(TIMEVAR_H) $(TM_P_H)
c-ppoutput.o : c-ppoutput.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(C_COMMON_H) $(TREE_H) $(CPPLIB_H) $(CPP_INTERNAL_H) $(C_PRAGMA_H)
c-objc-common.o : c-objc-common.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(TREE_H) $(C_TREE_H) $(RTL_H) insn-config.h $(INTEGRATE_H) \
- $(FUNCTION_H) $(FLAGS_H) toplev.h $(TREE_INLINE_H) $(DIAGNOSTIC_H) $(VARRAY_H) \
+ $(FUNCTION_H) $(FLAGS_H) $(TOPLEV_H) $(TREE_INLINE_H) $(DIAGNOSTIC_H) $(VARRAY_H) \
langhooks.h $(GGC_H) $(TARGET_H) $(C_PRETTY_PRINT_H) c-objc-common.h \
tree-mudflap.h
c-aux-info.o : c-aux-info.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
- $(C_TREE_H) $(FLAGS_H) toplev.h
+ $(C_TREE_H) $(FLAGS_H) $(TOPLEV_H)
c-convert.o : c-convert.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(TREE_H) $(FLAGS_H) toplev.h $(C_COMMON_H) convert.h $(C_TREE_H) \
+ $(TREE_H) $(FLAGS_H) $(TOPLEV_H) $(C_COMMON_H) convert.h $(C_TREE_H) \
langhooks.h $(TARGET_H)
c-pragma.o: c-pragma.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
- $(TREE_H) $(FUNCTION_H) $(C_PRAGMA_H) toplev.h output.h $(GGC_H) $(TM_P_H) \
+ $(TREE_H) $(FUNCTION_H) $(C_PRAGMA_H) $(TOPLEV_H) output.h $(GGC_H) $(TM_P_H) \
$(C_COMMON_H) $(TARGET_H) gt-c-pragma.h $(CPPLIB_H) $(FLAGS_H) $(DIAGNOSTIC_H) \
opts.h
-graph.o: graph.c $(SYSTEM_H) coretypes.h $(TM_H) toplev.h $(FLAGS_H) output.h \
+graph.o: graph.c $(SYSTEM_H) coretypes.h $(TM_H) $(TOPLEV_H) $(FLAGS_H) output.h \
$(RTL_H) $(FUNCTION_H) hard-reg-set.h $(BASIC_BLOCK_H) graph.h $(OBSTACK_H) \
$(CONFIG_H)
sbitmap.o: sbitmap.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
@@ -1854,19 +1849,20 @@ tlink.o: tlink.c $(DEMANGLE_H) $(HASHTAB_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h
# A file used by all variants of C.
c-common.o : c-common.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
- $(OBSTACK_H) $(C_COMMON_H) $(FLAGS_H) toplev.h output.h $(C_PRAGMA_H) \
+ $(OBSTACK_H) $(C_COMMON_H) $(FLAGS_H) $(TOPLEV_H) output.h $(C_PRAGMA_H) \
$(GGC_H) $(EXPR_H) $(TM_P_H) builtin-types.def builtin-attrs.def \
$(DIAGNOSTIC_H) gt-c-common.h langhooks.h $(VARRAY_H) $(RTL_H) \
$(TARGET_H) $(C_TREE_H) tree-iterator.h langhooks.h tree-mudflap.h \
intl.h opts.h $(REAL_H) $(CPPLIB_H) $(TREE_INLINE_H) $(HASHTAB_H) \
- $(BUILTINS_DEF) $(CGRAPH_H) $(BASIC_BLOCK_H) $(TARGET_DEF_H)
+ $(BUILTINS_DEF) $(CGRAPH_H) $(BASIC_BLOCK_H) $(TARGET_DEF_H) \
+ $(GIMPLE_H)
c-pretty-print.o : c-pretty-print.c $(C_PRETTY_PRINT_H) \
$(C_TREE_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(REAL_H) \
$(DIAGNOSTIC_H) tree-iterator.h fixed-value.h
c-opts.o : c-opts.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(TREE_H) $(C_PRAGMA_H) $(FLAGS_H) toplev.h langhooks.h \
+ $(TREE_H) $(C_PRAGMA_H) $(FLAGS_H) $(TOPLEV_H) langhooks.h \
$(TREE_INLINE_H) $(DIAGNOSTIC_H) intl.h debug.h $(C_COMMON_H) \
opts.h options.h $(MKDEPS_H) incpath.h cppdefault.h $(TARGET_H) \
$(TM_P_H) $(VARRAY_H)
@@ -1874,39 +1870,40 @@ c-opts.o : c-opts.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$< $(OUTPUT_OPTION) @TARGET_SYSTEM_ROOT_DEFINE@
c-cppbuiltin.o : c-cppbuiltin.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(TREE_H) version.h $(C_COMMON_H) $(C_PRAGMA_H) $(FLAGS_H) toplev.h \
- output.h except.h $(REAL_H) $(TARGET_H) $(TM_P_H) $(BASEVER)
+ $(TREE_H) version.h $(C_COMMON_H) $(C_PRAGMA_H) $(FLAGS_H) \
+ $(TOPLEV_H) output.h except.h $(REAL_H) $(TARGET_H) $(TM_P_H) \
+ $(BASEVER) debug.h
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) -DBASEVER=$(BASEVER_s) \
$< $(OUTPUT_OPTION)
# A file used by all variants of C and some other languages.
attribs.o : attribs.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
- $(FLAGS_H) toplev.h output.h $(RTL_H) $(GGC_H) $(TM_P_H) \
+ $(FLAGS_H) $(TOPLEV_H) output.h $(RTL_H) $(GGC_H) $(TM_P_H) \
$(TARGET_H) langhooks.h $(CPPLIB_H)
c-format.o : c-format.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) langhooks.h \
- $(C_COMMON_H) $(FLAGS_H) toplev.h intl.h $(DIAGNOSTIC_H) alloc-pool.h \
+ $(C_COMMON_H) $(FLAGS_H) $(TOPLEV_H) intl.h $(DIAGNOSTIC_H) alloc-pool.h \
c-format.h
c-semantics.o : c-semantics.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(TREE_H) $(FLAGS_H) toplev.h output.h $(RTL_H) $(GGC_H) \
+ $(TREE_H) $(FLAGS_H) $(TOPLEV_H) output.h $(RTL_H) $(GGC_H) \
$(PREDICT_H) $(TREE_INLINE_H) $(C_COMMON_H) except.h $(FUNCTION_H) \
- langhooks.h $(SPLAY_TREE_H) $(TIMEVAR_H) $(TREE_GIMPLE_H) \
- $(VARRAY_H)
+ langhooks.h $(SPLAY_TREE_H) $(TIMEVAR_H) $(GIMPLE_H) \
+ $(VARRAY_H) tree-iterator.h
c-dump.o : c-dump.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
$(C_TREE_H) $(TREE_DUMP_H)
c-pch.o : c-pch.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(CPPLIB_H) $(TREE_H) \
- $(C_COMMON_H) output.h toplev.h $(C_PRAGMA_H) $(GGC_H) debug.h \
+ $(C_COMMON_H) output.h $(TOPLEV_H) $(C_PRAGMA_H) $(GGC_H) debug.h \
langhooks.h $(FLAGS_H) hosthooks.h version.h $(TARGET_H) opts.h
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) \
-DHOST_MACHINE=\"$(host)\" -DTARGET_MACHINE=\"$(target)\" \
$< $(OUTPUT_OPTION)
c-omp.o : c-omp.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
- $(FUNCTION_H) $(C_COMMON_H) toplev.h $(TREE_GIMPLE_H) $(BITMAP_H) \
+ $(FUNCTION_H) $(C_COMMON_H) $(TOPLEV.H) $(GIMPLE_H) $(BITMAP_H) \
langhooks.h
# Language-independent files.
@@ -1964,7 +1961,8 @@ s-options-h: optionlist $(srcdir)/opt-functions.awk $(srcdir)/opth-gen.awk
$(SHELL) $(srcdir)/../move-if-change tmp-options.h options.h
$(STAMP) $@
-options.o: options.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) opts.h intl.h
+options.o: options.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TARGET_H) $(FLAGS_H) \
+ $(TM_H) opts.h intl.h
gcc-options.o: options.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) opts.h intl.h
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(OUTPUT_OPTION) -DGCC_DRIVER options.c
@@ -1991,13 +1989,13 @@ gtype-desc.o: gtype-desc.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(CFGLOOP_H)
ggc-common.o: ggc-common.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(GGC_H) \
- $(HASHTAB_H) toplev.h $(PARAMS_H) hosthooks.h $(HOSTHOOKS_DEF_H)
+ $(HASHTAB_H) $(TOPLEV_H) $(PARAMS_H) hosthooks.h $(HOSTHOOKS_DEF_H)
ggc-page.o: ggc-page.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_H) \
- $(FLAGS_H) toplev.h $(GGC_H) $(TIMEVAR_H) $(TM_P_H) $(PARAMS_H) $(TREE_FLOW_H)
+ $(FLAGS_H) $(TOPLEV_H) $(GGC_H) $(TIMEVAR_H) $(TM_P_H) $(PARAMS_H) $(TREE_FLOW_H)
ggc-zone.o: ggc-zone.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
- $(TREE_H) $(FLAGS_H) toplev.h $(GGC_H) $(TIMEVAR_H) $(TM_P_H) \
+ $(TREE_H) $(FLAGS_H) $(TOPLEV_H) $(GGC_H) $(TIMEVAR_H) $(TM_P_H) \
$(PARAMS_H) $(BITMAP_H) $(VARRAY_H)
ggc-none.o: ggc-none.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(GGC_H) \
@@ -2013,62 +2011,63 @@ prefix.o: prefix.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) prefix.h \
-c $(srcdir)/prefix.c $(OUTPUT_OPTION)
convert.o: convert.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
- $(FLAGS_H) convert.h toplev.h langhooks.h $(REAL_H) fixed-value.h
+ $(FLAGS_H) convert.h $(TOPLEV_H) langhooks.h $(REAL_H) fixed-value.h
double-int.o: double-int.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H)
langhooks.o : langhooks.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(TREE_H) toplev.h $(TREE_INLINE_H) $(RTL_H) insn-config.h $(INTEGRATE_H) \
+ $(TREE_H) $(TOPLEV_H) $(TREE_INLINE_H) $(RTL_H) insn-config.h $(INTEGRATE_H) \
langhooks.h $(TARGET_H) $(LANGHOOKS_DEF_H) $(FLAGS_H) $(GGC_H) $(DIAGNOSTIC_H) \
- intl.h $(TREE_GIMPLE_H)
+ intl.h $(GIMPLE_H)
tree.o : tree.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
all-tree.def $(FLAGS_H) $(FUNCTION_H) $(PARAMS_H) \
- toplev.h $(GGC_H) $(HASHTAB_H) $(TARGET_H) output.h $(TM_P_H) langhooks.h \
+ $(TOPLEV_H) $(GGC_H) $(HASHTAB_H) $(TARGET_H) output.h $(TM_P_H) langhooks.h \
$(REAL_H) gt-tree.h tree-iterator.h $(BASIC_BLOCK_H) $(TREE_FLOW_H) \
$(OBSTACK_H) pointer-set.h fixed-value.h
tree-dump.o: tree-dump.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(TREE_H) langhooks.h toplev.h $(SPLAY_TREE_H) $(TREE_DUMP_H) \
+ $(TREE_H) langhooks.h $(TOPLEV_H) $(SPLAY_TREE_H) $(TREE_DUMP_H) \
tree-iterator.h tree-pass.h $(DIAGNOSTIC_H) $(REAL_H) fixed-value.h
tree-inline.o : tree-inline.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(TREE_H) $(RTL_H) $(EXPR_H) $(FLAGS_H) $(PARAMS_H) $(INPUT_H) insn-config.h \
- $(VARRAY_H) $(HASHTAB_H) toplev.h langhooks.h $(TREE_INLINE_H) $(CGRAPH_H) \
- intl.h $(FUNCTION_H) $(GGC_H) $(TREE_GIMPLE_H) \
+ $(VARRAY_H) $(HASHTAB_H) $(TOPLEV_H) langhooks.h $(TREE_INLINE_H) $(CGRAPH_H) \
+ intl.h $(FUNCTION_H) $(GGC_H) $(GIMPLE_H) \
debug.h $(DIAGNOSTIC_H) except.h $(TREE_FLOW_H) tree-iterator.h tree-mudflap.h \
$(IPA_PROP_H) value-prof.h tree-pass.h $(TARGET_H) $(INTEGRATE_H)
print-tree.o : print-tree.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
- $(GGC_H) langhooks.h $(REAL_H) tree-iterator.h fixed-value.h $(TREE_FLOW_H)
+ $(GGC_H) langhooks.h $(REAL_H) tree-iterator.h fixed-value.h \
+ $(DIAGNOSTIC_H) $(TREE_FLOW_H)
stor-layout.o : stor-layout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(TREE_H) $(PARAMS_H) $(FLAGS_H) $(FUNCTION_H) $(EXPR_H) output.h $(RTL_H) \
$(GGC_H) $(TM_P_H) $(TARGET_H) langhooks.h $(REGS_H) gt-stor-layout.h \
- toplev.h
+ $(TOPLEV_H)
tree-ssa-structalias.o: tree-ssa-structalias.c tree-ssa-structalias.h \
$(SYSTEM_H) $(CONFIG_H) coretypes.h $(TM_H) $(GGC_H) $(OBSTACK_H) $(BITMAP_H) \
$(FLAGS_H) $(RTL_H) $(TM_P_H) hard-reg-set.h $(BASIC_BLOCK_H) output.h errors.h \
$(DIAGNOSTIC_H) $(TREE_H) $(C_COMMON_H) $(TREE_FLOW_H) $(TREE_INLINE_H) varray.h \
- $(C_TREE_H) $(TREE_GIMPLE_H) $(HASHTAB_H) $(FUNCTION_H) $(CGRAPH_H) tree-pass.h \
+ $(C_TREE_H) $(GIMPLE_H) $(HASHTAB_H) $(FUNCTION_H) $(CGRAPH_H) tree-pass.h \
$(TIMEVAR_H) alloc-pool.h $(SPLAY_TREE_H) $(PARAMS_H) gt-tree-ssa-structalias.h \
$(CGRAPH_H) $(ALIAS_H) pointer-set.h
tree-ssa.o : tree-ssa.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
$(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) output.h $(DIAGNOSTIC_H) \
- toplev.h $(FUNCTION_H) $(TIMEVAR_H) $(TM_H) coretypes.h \
+ $(TOPLEV_H) $(FUNCTION_H) $(TIMEVAR_H) $(TM_H) coretypes.h \
$(TREE_DUMP_H) langhooks.h tree-pass.h $(BASIC_BLOCK_H) $(BITMAP_H) \
$(FLAGS_H) $(GGC_H) hard-reg-set.h $(HASHTAB_H) pointer-set.h \
- $(TREE_GIMPLE_H) $(TREE_INLINE_H) $(VARRAY_H)
+ $(GIMPLE_H) $(TREE_INLINE_H) $(VARRAY_H)
tree-into-ssa.o : tree-into-ssa.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
$(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) output.h $(DIAGNOSTIC_H) \
$(FUNCTION_H) $(TIMEVAR_H) $(TM_H) coretypes.h $(TREE_DUMP_H) \
langhooks.h domwalk.h tree-pass.h $(GGC_H) $(PARAMS_H) $(BASIC_BLOCK_H) \
$(BITMAP_H) $(CFGLOOP_H) $(FLAGS_H) hard-reg-set.h $(HASHTAB_H) \
- $(TREE_GIMPLE_H) $(TREE_INLINE_H) $(VARRAY_H) vecprim.h
+ $(GIMPLE_H) $(TREE_INLINE_H) $(VARRAY_H) vecprim.h
tree-ssa-ter.o : tree-ssa-ter.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
$(TREE_H) $(DIAGNOSTIC_H) $(TM_H) coretypes.h $(TREE_DUMP_H) \
$(TREE_SSA_LIVE_H) $(BITMAP_H)
tree-ssa-coalesce.o : tree-ssa-coalesce.c $(TREE_FLOW_H) $(CONFIG_H) \
$(SYSTEM_H) $(TREE_H) $(DIAGNOSTIC_H) $(TM_H) coretypes.h $(TREE_DUMP_H) \
- $(TREE_SSA_LIVE_H) $(BITMAP_H) $(FLAGS_H) $(HASHTAB_H) toplev.h
+ $(TREE_SSA_LIVE_H) $(BITMAP_H) $(FLAGS_H) $(HASHTAB_H) $(TOPLEV_H)
tree-outof-ssa.o : tree-outof-ssa.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
$(TREE_H) $(DIAGNOSTIC_H) $(TIMEVAR_H) $(TM_H) coretypes.h $(TREE_DUMP_H) \
- tree-pass.h $(TREE_SSA_LIVE_H) $(BASIC_BLOCK_H) $(BITMAP_H) $(GGC_H) toplev.h
+ tree-pass.h $(TREE_SSA_LIVE_H) $(BASIC_BLOCK_H) $(BITMAP_H) $(GGC_H) $(TOPLEV_H)
tree-ssa-dse.o : tree-ssa-dse.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(GGC_H) $(TREE_H) $(RTL_H) $(TM_P_H) $(BASIC_BLOCK_H) \
$(TREE_FLOW_H) tree-pass.h $(TREE_DUMP_H) domwalk.h $(FLAGS_H) \
@@ -2076,7 +2075,7 @@ tree-ssa-dse.o : tree-ssa-dse.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
tree-ssa-forwprop.o : tree-ssa-forwprop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(GGC_H) $(TREE_H) $(RTL_H) $(TM_P_H) $(BASIC_BLOCK_H) \
$(TREE_FLOW_H) tree-pass.h $(TREE_DUMP_H) $(DIAGNOSTIC_H) $(TIMEVAR_H) \
- langhooks.h $(FLAGS_H)
+ langhooks.h $(FLAGS_H) $(GIMPLE_H)
tree-ssa-phiprop.o : tree-ssa-phiprop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(GGC_H) $(TREE_H) $(RTL_H) $(TM_P_H) $(BASIC_BLOCK_H) \
$(TREE_FLOW_H) tree-pass.h $(TREE_DUMP_H) $(DIAGNOSTIC_H) $(TIMEVAR_H) \
@@ -2101,7 +2100,7 @@ tree-ssa-propagate.o : tree-ssa-propagate.c $(TREE_FLOW_H) $(CONFIG_H) \
$(DIAGNOSTIC_H) $(FUNCTION_H) $(TIMEVAR_H) $(TM_H) coretypes.h \
$(TREE_DUMP_H) $(BASIC_BLOCK_H) tree-pass.h langhooks.h \
tree-ssa-propagate.h vec.h value-prof.h gt-tree-ssa-propagate.h $(FLAGS_H) \
- $(VARRAY_H)
+ $(VARRAY_H) $(GIMPLE_H)
tree-ssa-dom.o : tree-ssa-dom.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
$(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) $(GGC_H) output.h $(DIAGNOSTIC_H) \
$(FUNCTION_H) $(TIMEVAR_H) $(TM_H) coretypes.h $(TREE_DUMP_H) \
@@ -2125,44 +2124,44 @@ tree-ssanames.o : tree-ssanames.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(TREE_H) $(VARRAY_H) $(GGC_H) $(TREE_FLOW_H)
tree-phinodes.o : tree-phinodes.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(TREE_H) $(VARRAY_H) $(GGC_H) $(BASIC_BLOCK_H) $(TREE_FLOW_H) \
- gt-tree-phinodes.h $(RTL_H) toplev.h
+ gt-tree-phinodes.h $(RTL_H) $(TOPLEV.H) $(GIMPLE_H)
domwalk.o : domwalk.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(TREE_H) $(BASIC_BLOCK_H) $(TREE_FLOW_H) domwalk.h $(GGC_H)
tree-ssa-live.o : tree-ssa-live.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
$(TREE_H) $(DIAGNOSTIC_H) $(TM_H) coretypes.h $(TREE_DUMP_H) \
- $(TREE_SSA_LIVE_H) $(BITMAP_H) toplev.h debug.h $(FLAGS_H)
+ $(TREE_SSA_LIVE_H) $(BITMAP_H) $(TOPLEV_H) debug.h $(FLAGS_H)
tree-ssa-copyrename.o : tree-ssa-copyrename.c $(TREE_FLOW_H) $(CONFIG_H) \
$(SYSTEM_H) $(TREE_H) $(DIAGNOSTIC_H) $(FUNCTION_H) $(TIMEVAR_H) tree-pass.h \
$(TM_H) coretypes.h $(TREE_DUMP_H) $(TREE_SSA_LIVE_H) $(BASIC_BLOCK_H) \
- $(BITMAP_H) $(FLAGS_H) $(HASHTAB_H) langhooks.h $(TREE_GIMPLE_H) \
- $(TREE_INLINE_H)
+ $(BITMAP_H) $(FLAGS_H) $(HASHTAB_H) langhooks.h $(GIMPLE_H) \
+ $(TREE_INLINE_H) $(GIMPLE_H)
tree-ssa-pre.o : tree-ssa-pre.c $(TREE_FLOW_H) $(CONFIG_H) \
$(SYSTEM_H) $(TREE_H) $(GGC_H) $(DIAGNOSTIC_H) $(TIMEVAR_H) $(FIBHEAP_H) \
$(TM_H) coretypes.h $(TREE_DUMP_H) tree-pass.h $(FLAGS_H) langhooks.h $(CFGLOOP_H) \
- alloc-pool.h $(BASIC_BLOCK_H) $(BITMAP_H) $(HASHTAB_H) $(TREE_GIMPLE_H) \
+ alloc-pool.h $(BASIC_BLOCK_H) $(BITMAP_H) $(HASHTAB_H) $(GIMPLE_H) \
$(TREE_INLINE_H) tree-iterator.h tree-ssa-sccvn.h $(PARAMS_H) \
$(DBGCNT_H)
tree-ssa-sccvn.o : tree-ssa-sccvn.c $(TREE_FLOW_H) $(CONFIG_H) \
$(SYSTEM_H) $(TREE_H) $(GGC_H) $(DIAGNOSTIC_H) $(TIMEVAR_H) $(FIBHEAP_H) \
$(TM_H) coretypes.h $(TREE_DUMP_H) tree-pass.h $(FLAGS_H) $(CFGLOOP_H) \
- alloc-pool.h $(BASIC_BLOCK_H) $(BITMAP_H) langhooks.h $(HASHTAB_H) $(TREE_GIMPLE_H) \
+ alloc-pool.h $(BASIC_BLOCK_H) $(BITMAP_H) langhooks.h $(HASHTAB_H) $(GIMPLE_H) \
$(TREE_INLINE_H) tree-iterator.h tree-ssa-propagate.h tree-ssa-sccvn.h \
$(PARAMS_H)
tree-vrp.o : tree-vrp.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
$(TREE_FLOW_H) tree-pass.h $(TREE_DUMP_H) $(DIAGNOSTIC_H) $(GGC_H) \
$(BASIC_BLOCK_H) tree-ssa-propagate.h $(FLAGS_H) $(TREE_DUMP_H) \
- $(CFGLOOP_H) tree-chrec.h $(TIMEVAR_H) toplev.h intl.h
+ $(CFGLOOP_H) tree-chrec.h $(TIMEVAR_H) $(TOPLEV_H) intl.h
tree-cfg.o : tree-cfg.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
$(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) $(GGC_H) $(FLAGS_H) output.h \
$(DIAGNOSTIC_H) $(FUNCTION_H) $(TIMEVAR_H) $(TM_H) coretypes.h \
$(TREE_DUMP_H) except.h langhooks.h $(CFGLOOP_H) tree-pass.h \
- $(CFGLAYOUT_H) $(BASIC_BLOCK_H) hard-reg-set.h toplev.h \
+ $(CFGLAYOUT_H) $(BASIC_BLOCK_H) hard-reg-set.h $(TOPLEV_H) \
value-prof.h tree-ssa-propagate.h $(TREE_INLINE_H)
tree-cfgcleanup.o : tree-cfgcleanup.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
$(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) $(GGC_H) $(FLAGS_H) output.h \
- $(DIAGNOSTIC_H) toplev.h $(FUNCTION_H) $(TIMEVAR_H) $(TM_H) coretypes.h \
+ $(DIAGNOSTIC_H) $(TOPLEV_H) $(FUNCTION_H) $(TIMEVAR_H) $(TM_H) coretypes.h \
$(TREE_DUMP_H) except.h langhooks.h $(CFGLOOP_H) tree-pass.h \
- $(CFGLAYOUT_H) $(BASIC_BLOCK_H) hard-reg-set.h $(HASHTAB_H) toplev.h \
+ $(CFGLAYOUT_H) $(BASIC_BLOCK_H) hard-reg-set.h $(HASHTAB_H) $(TOPLEV_H) \
tree-ssa-propagate.h tree-scalar-evolution.h
rtl-factoring.o : rtl-factoring.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) \
coretypes.h $(TM_H) $(BASIC_BLOCK_H) $(RESOURCE_H) $(GGC_H) $(REGS_H) \
@@ -2176,10 +2175,10 @@ tree-ssa-sink.o : tree-ssa-sink.c $(TREE_FLOW_H) $(CONFIG_H) \
$(SYSTEM_H) $(TREE_H) $(GGC_H) $(DIAGNOSTIC_H) $(TIMEVAR_H) \
$(TM_H) coretypes.h $(TREE_DUMP_H) tree-pass.h $(FLAGS_H) alloc-pool.h \
$(BASIC_BLOCK_H) $(BITMAP_H) $(CFGLOOP_H) $(FIBHEAP_H) $(HASHTAB_H) \
- langhooks.h $(REAL_H) $(TREE_GIMPLE_H) $(TREE_INLINE_H) tree-iterator.h
+ langhooks.h $(REAL_H) $(GIMPLE_H) $(TREE_INLINE_H) tree-iterator.h
tree-nested.o: tree-nested.c $(CONFIG_H) $(SYSTEM_H) $(TM_H) $(TREE_H) \
$(RTL_H) $(TM_P_H) $(FUNCTION_H) $(TREE_DUMP_H) $(TREE_INLINE_H) \
- tree-iterator.h $(TREE_GIMPLE_H) $(CGRAPH_H) $(EXPR_H) langhooks.h \
+ tree-iterator.h $(GIMPLE_H) $(CGRAPH_H) $(EXPR_H) langhooks.h \
$(GGC_H) gt-tree-nested.h coretypes.h $(TREE_FLOW_H) pointer-set.h
tree-if-conv.o: tree-if-conv.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(TREE_H) $(FLAGS_H) $(TIMEVAR_H) $(BASIC_BLOCK_H) $(TREE_FLOW_H) \
@@ -2187,21 +2186,21 @@ tree-if-conv.o: tree-if-conv.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(SCEV_H) tree-pass.h $(DIAGNOSTIC_H) $(TARGET_H) $(TREE_DUMP_H) \
$(VARRAY_H)
tree-iterator.o : tree-iterator.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) \
- coretypes.h $(GGC_H) tree-iterator.h $(TREE_GIMPLE_H) gt-tree-iterator.h
+ coretypes.h $(GGC_H) tree-iterator.h $(GIMPLE_H) gt-tree-iterator.h
tree-dfa.o : tree-dfa.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
$(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) $(GGC_H) output.h $(DIAGNOSTIC_H) \
$(TREE_INLINE_H) $(HASHTAB_H) pointer-set.h $(FLAGS_H) $(FUNCTION_H) \
$(TIMEVAR_H) convert.h $(TM_H) coretypes.h langhooks.h $(TREE_DUMP_H) \
tree-pass.h $(PARAMS_H) $(CGRAPH_H) $(BASIC_BLOCK_H) hard-reg-set.h \
- $(TREE_GIMPLE_H)
+ $(GIMPLE_H)
tree-ssa-operands.o : tree-ssa-operands.c $(TREE_FLOW_H) $(CONFIG_H) \
$(SYSTEM_H) $(TREE_H) $(GGC_H) $(DIAGNOSTIC_H) $(TREE_INLINE_H) \
- $(FLAGS_H) $(FUNCTION_H) $(TM_H) $(TIMEVAR_H) tree-pass.h toplev.h \
+ $(FLAGS_H) $(FUNCTION_H) $(TM_H) $(TIMEVAR_H) tree-pass.h $(TOPLEV_H) \
coretypes.h langhooks.h $(IPA_REFERENCE_H)
tree-eh.o : tree-eh.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
$(RTL_H) $(TREE_H) $(TM_H) $(FLAGS_H) $(FUNCTION_H) except.h langhooks.h \
$(GGC_H) tree-pass.h coretypes.h $(TIMEVAR_H) $(TM_P_H) pointer-set.h \
- $(TREE_DUMP_H) $(TREE_INLINE_H) tree-iterator.h toplev.h
+ $(TREE_DUMP_H) $(TREE_INLINE_H) tree-iterator.h $(TOPLEV_H)
tree-ssa-loop.o : tree-ssa-loop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(TREE_H) $(RTL_H) $(TM_P_H) hard-reg-set.h $(BASIC_BLOCK_H) output.h \
$(DIAGNOSTIC_H) $(TREE_FLOW_H) $(TREE_DUMP_H) tree-pass.h $(TIMEVAR_H) \
@@ -2219,7 +2218,7 @@ tree-ssa-address.o : tree-ssa-address.c $(TREE_FLOW_H) $(CONFIG_H) \
tree-ssa-loop-niter.o : tree-ssa-loop-niter.c $(TREE_FLOW_H) $(CONFIG_H) \
$(SYSTEM_H) $(RTL_H) $(TREE_H) $(TM_P_H) $(CFGLOOP_H) $(PARAMS_H) \
$(TREE_INLINE_H) output.h $(DIAGNOSTIC_H) $(TM_H) coretypes.h $(TREE_DUMP_H) \
- toplev.h $(FLAGS_H) tree-pass.h $(SCEV_H) $(TREE_DATA_REF_H) $(BASIC_BLOCK_H) \
+ $(TOPLEV_H) $(FLAGS_H) tree-pass.h $(SCEV_H) $(TREE_DATA_REF_H) $(BASIC_BLOCK_H) \
$(GGC_H) hard-reg-set.h tree-chrec.h intl.h
tree-ssa-loop-ivcanon.o : tree-ssa-loop-ivcanon.c $(TREE_FLOW_H) $(CONFIG_H) \
$(SYSTEM_H) $(RTL_H) $(TREE_H) $(TM_P_H) $(CFGLOOP_H) $(PARAMS_H) \
@@ -2235,7 +2234,7 @@ tree-ssa-loop-prefetch.o: tree-ssa-loop-prefetch.c $(TREE_FLOW_H) $(CONFIG_H) \
output.h $(DIAGNOSTIC_H) $(TIMEVAR_H) $(TM_H) coretypes.h $(TREE_DUMP_H) \
tree-pass.h $(GGC_H) $(RECOG_H) insn-config.h $(HASHTAB_H) $(SCEV_H) \
$(CFGLOOP_H) $(PARAMS_H) langhooks.h $(BASIC_BLOCK_H) hard-reg-set.h \
- tree-chrec.h toplev.h langhooks.h $(TREE_INLINE_H) $(TREE_DATA_REF_H) \
+ tree-chrec.h $(TOPLEV_H) langhooks.h $(TREE_INLINE_H) $(TREE_DATA_REF_H) \
$(OPTABS_H)
tree-predcom.o: tree-predcom.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(TM_P_H) \
$(CFGLOOP_H) $(TREE_FLOW_H) $(GGC_H) $(TREE_DATA_REF_H) $(SCEV_H) \
@@ -2248,7 +2247,7 @@ tree-ssa-loop-ivopts.o : tree-ssa-loop-ivopts.c $(TREE_FLOW_H) $(CONFIG_H) \
$(CFGLOOP_H) $(PARAMS_H) langhooks.h $(BASIC_BLOCK_H) hard-reg-set.h \
tree-chrec.h $(VARRAY_H) tree-affine.h pointer-set.h $(TARGET_H)
tree-affine.o : tree-affine.c tree-affine.h $(CONFIG_H) pointer-set.h \
- $(SYSTEM_H) $(RTL_H) $(TREE_H) $(TM_P_H) hard-reg-set.h $(TREE_GIMPLE_H) \
+ $(SYSTEM_H) $(RTL_H) $(TREE_H) $(TM_P_H) hard-reg-set.h $(GIMPLE_H) \
output.h $(DIAGNOSTIC_H) $(TM_H) coretypes.h $(TREE_DUMP_H) $(FLAGS_H)
tree-ssa-loop-manip.o : tree-ssa-loop-manip.c $(TREE_FLOW_H) $(CONFIG_H) \
$(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(RTL_H) $(TM_P_H) hard-reg-set.h \
@@ -2265,47 +2264,50 @@ tree-ssa-math-opts.o : tree-ssa-math-opts.c $(CONFIG_H) $(SYSTEM_H) coretypes.h
alloc-pool.h $(BASIC_BLOCK_H) $(TARGET_H)
tree-ssa-alias-warnings.o : tree-ssa-alias-warnings.c \
$(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(TREE_DUMP_H) \
- $(TREE_FLOW_H) $(PARAMS_H) $(FUNCTION_H) $(EXPR_H) toplev.h \
+ $(TREE_FLOW_H) $(PARAMS_H) $(FUNCTION_H) $(EXPR_H) $(TOPLEV_H) \
tree-ssa-structalias.h tree-ssa-propagate.h langhooks.h alloc-pool.h \
$(DIAGNOSTIC_H)
tree-ssa-alias.o : tree-ssa-alias.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
$(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) $(GGC_H) $(TREE_INLINE_H) $(FLAGS_H) \
$(FUNCTION_H) $(TIMEVAR_H) convert.h $(TM_H) coretypes.h langhooks.h \
$(TREE_DUMP_H) tree-pass.h $(PARAMS_H) $(BASIC_BLOCK_H) $(DIAGNOSTIC_H) \
- hard-reg-set.h $(TREE_GIMPLE_H) vec.h tree-ssa-structalias.h \
+ hard-reg-set.h $(GIMPLE_H) vec.h tree-ssa-structalias.h \
$(IPA_TYPE_ESCAPE_H) vecprim.h pointer-set.h alloc-pool.h
tree-ssa-reassoc.o : tree-ssa-reassoc.c $(TREE_FLOW_H) $(CONFIG_H) \
$(SYSTEM_H) $(TREE_H) $(GGC_H) $(DIAGNOSTIC_H) errors.h $(TIMEVAR_H) \
$(TM_H) coretypes.h $(TREE_DUMP_H) tree-pass.h $(FLAGS_H) tree-iterator.h\
- $(BASIC_BLOCK_H) $(TREE_GIMPLE_H) $(TREE_INLINE_H) vec.h langhooks.h \
+ $(BASIC_BLOCK_H) $(GIMPLE_H) $(TREE_INLINE_H) vec.h langhooks.h \
alloc-pool.h pointer-set.h $(CFGLOOP_H)
tree-optimize.o : tree-optimize.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
$(RTL_H) $(TREE_H) $(TM_P_H) hard-reg-set.h $(EXPR_H) $(GGC_H) output.h \
$(DIAGNOSTIC_H) $(BASIC_BLOCK_H) $(FLAGS_H) $(TIMEVAR_H) $(TM_H) coretypes.h \
- $(TREE_DUMP_H) toplev.h $(FUNCTION_H) langhooks.h $(FLAGS_H) $(CGRAPH_H) \
+ $(TREE_DUMP_H) $(TOPLEV_H) $(FUNCTION_H) langhooks.h $(FLAGS_H) $(CGRAPH_H) \
$(TREE_INLINE_H) tree-mudflap.h $(GGC_H) graph.h $(CGRAPH_H) tree-pass.h \
$(CFGLOOP_H) except.h
c-gimplify.o : c-gimplify.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) \
- $(C_TREE_H) $(C_COMMON_H) $(DIAGNOSTIC_H) $(TREE_GIMPLE_H) $(VARRAY_H) \
- $(FLAGS_H) langhooks.h toplev.h $(RTL_H) $(TREE_FLOW_H) $(LANGHOOKS_DEF_H) \
+ $(C_TREE_H) $(C_COMMON_H) $(DIAGNOSTIC_H) $(GIMPLE_H) $(VARRAY_H) \
+ $(FLAGS_H) langhooks.h $(TOPLEV_H) $(RTL_H) $(TREE_FLOW_H) $(LANGHOOKS_DEF_H) \
$(TM_H) coretypes.h $(C_PRETTY_PRINT_H) $(CGRAPH_H) $(BASIC_BLOCK_H) \
hard-reg-set.h $(TREE_DUMP_H) $(TREE_INLINE_H)
-gimplify.o : gimplify.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) \
- $(DIAGNOSTIC_H) $(TREE_GIMPLE_H) $(TREE_INLINE_H) $(VARRAY_H) langhooks.h \
+gimplify.o : gimplify.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(GIMPLE_H) \
+ $(DIAGNOSTIC_H) $(GIMPLE_H) $(TREE_INLINE_H) $(VARRAY_H) langhooks.h \
$(LANGHOOKS_DEF_H) $(TREE_FLOW_H) $(CGRAPH_H) $(TIMEVAR_H) $(TM_H) \
coretypes.h except.h $(FLAGS_H) $(RTL_H) $(FUNCTION_H) $(EXPR_H) output.h \
- $(GGC_H) gt-gimplify.h $(HASHTAB_H) $(TARGET_H) toplev.h $(OPTABS_H) \
- $(REAL_H) $(SPLAY_TREE_H)
+ $(GGC_H) gt-gimplify.h $(HASHTAB_H) $(TARGET_H) $(TOPLEV_H) $(OPTABS_H) \
+ $(REAL_H) $(SPLAY_TREE_H) vec.h tree-iterator.h
+gimple-iterator.o : gimple-iterator.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
+ $(TREE_H) $(GIMPLE_H) $(TREE_FLOW_H) value-prof.h
gimple-low.o : gimple-low.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) \
- $(DIAGNOSTIC_H) $(TREE_GIMPLE_H) $(TREE_INLINE_H) $(VARRAY_H) langhooks.h \
+ $(DIAGNOSTIC_H) $(GIMPLE_H) $(TREE_INLINE_H) $(VARRAY_H) langhooks.h \
$(LANGHOOKS_DEF_H) $(TREE_FLOW_H) $(TIMEVAR_H) $(TM_H) coretypes.h \
except.h $(FLAGS_H) $(RTL_H) $(FUNCTION_H) $(EXPR_H) tree-pass.h \
- $(HASHTAB_H) toplev.h
+ $(HASHTAB_H) $(TOPLEV.H) tree-iterator.h
omp-low.o : omp-low.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
- $(RTL_H) $(TREE_GIMPLE_H) $(TREE_INLINE_H) langhooks.h $(DIAGNOSTIC_H) \
- $(TREE_FLOW_H) $(TIMEVAR_H) $(FLAGS_H) $(EXPR_H) toplev.h tree-pass.h \
- $(GGC_H) except.h $(SPLAY_TREE_H) $(OPTABS_H) $(CFGLOOP_H)
+ $(RTL_H) $(GIMPLE_H) $(TREE_INLINE_H) langhooks.h $(DIAGNOSTIC_H) \
+ $(TREE_FLOW_H) $(TIMEVAR_H) $(FLAGS_H) $(EXPR_H) $(TOPLEV_H) tree-pass.h \
+ $(GGC_H) except.h $(SPLAY_TREE_H) $(OPTABS_H) $(CFGLOOP_H) \
+ tree-iterator.h
tree-browser.o : tree-browser.c tree-browser.def $(CONFIG_H) $(SYSTEM_H) \
$(TREE_H) $(TREE_INLINE_H) $(DIAGNOSTIC_H) $(HASHTAB_H) \
$(TM_H) coretypes.h
@@ -2327,22 +2329,22 @@ tree-vect-analyze.o: tree-vect-analyze.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(GGC_H) $(OPTABS_H) $(TREE_H) $(RECOG_H) $(BASIC_BLOCK_H) \
$(DIAGNOSTIC_H) $(TREE_FLOW_H) $(TREE_DUMP_H) $(TIMEVAR_H) $(CFGLOOP_H) \
tree-vectorizer.h $(TREE_DATA_REF_H) $(SCEV_H) $(EXPR_H) tree-chrec.h \
- toplev.h $(RECOG_H)
+ $(TOPLEV_H) $(RECOG_H)
tree-vect-patterns.o: tree-vect-patterns.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(GGC_H) $(TREE_H) $(TARGET_H) $(BASIC_BLOCK_H) $(DIAGNOSTIC_H) \
$(TREE_FLOW_H) $(TREE_DUMP_H) $(TIMEVAR_H) $(CFGLOOP_H) $(EXPR_H) \
- $(OPTABS_H) $(PARAMS_H) $(TREE_DATA_REF_H) tree-vectorizer.h $(RECOG_H) toplev.h
+ $(OPTABS_H) $(PARAMS_H) $(TREE_DATA_REF_H) tree-vectorizer.h $(RECOG_H) $(TOPLEV_H)
tree-vect-transform.o: tree-vect-transform.c $(CONFIG_H) $(SYSTEM_H) \
coretypes.h $(TM_H) $(GGC_H) $(OPTABS_H) $(RECOG_H) $(TREE_H) $(RTL_H) \
$(BASIC_BLOCK_H) $(DIAGNOSTIC_H) $(TREE_FLOW_H) $(TREE_DUMP_H) \
$(TIMEVAR_H) $(CFGLOOP_H) $(TARGET_H) tree-pass.h $(EXPR_H) \
- tree-vectorizer.h $(TREE_DATA_REF_H) $(SCEV_H) langhooks.h toplev.h \
+ tree-vectorizer.h $(TREE_DATA_REF_H) $(SCEV_H) langhooks.h $(TOPLEV_H) \
tree-chrec.h
tree-vectorizer.o: tree-vectorizer.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(GGC_H) $(OPTABS_H) $(TREE_H) $(RTL_H) $(BASIC_BLOCK_H) \
$(DIAGNOSTIC_H) $(TREE_FLOW_H) $(TREE_DUMP_H) $(TIMEVAR_H) $(CFGLOOP_H) \
tree-pass.h $(EXPR_H) $(RECOG_H) tree-vectorizer.h $(TREE_DATA_REF_H) $(SCEV_H) \
- $(INPUT_H) $(TARGET_H) $(CFGLAYOUT_H) toplev.h tree-chrec.h
+ $(INPUT_H) $(TARGET_H) $(CFGLAYOUT_H) $(TOPLEV_H) tree-chrec.h langhooks.h
tree-loop-linear.o: tree-loop-linear.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(GGC_H) $(OPTABS_H) $(TREE_H) $(RTL_H) $(BASIC_BLOCK_H) \
$(DIAGNOSTIC_H) $(TREE_FLOW_H) $(TREE_DUMP_H) $(TIMEVAR_H) $(CFGLOOP_H) \
@@ -2361,57 +2363,61 @@ tree-stdarg.o: tree-stdarg.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(TREE_H) $(FUNCTION_H) $(DIAGNOSTIC_H) $(TREE_FLOW_H) tree-pass.h \
tree-stdarg.h $(TARGET_H) langhooks.h
tree-object-size.o: tree-object-size.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) $(TREE_H) toplev.h $(DIAGNOSTIC_H) $(TREE_FLOW_H) tree-pass.h \
+ $(TM_H) $(TREE_H) $(TOPLEV_H) $(DIAGNOSTIC_H) $(TREE_FLOW_H) tree-pass.h \
tree-ssa-propagate.h
-tree-gimple.o : tree-gimple.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(EXPR_H) \
- $(RTL_H) $(TREE_GIMPLE_H) $(TM_H) coretypes.h $(BITMAP_H) $(GGC_H) \
- output.h $(TREE_FLOW_H)
+gimple.o : gimple.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TREE_H) \
+ $(GGC_H) $(GIMPLE_H) $(GIMPLE_H) $(DIAGNOSTIC_H) gt-gimple.h \
+ $(TREE_FLOW_H) value-prof.h $(FLAGS_H)
+gimple-pretty-print.o : gimple-pretty-print.c $(CONFIG_H) $(SYSTEM_H) \
+ $(TREE_H) $(DIAGNOSTIC_H) $(REAL_H) $(HASHTAB_H) $(TREE_FLOW_H) \
+ $(TM_H) coretypes.h tree-pass.h $(GIMPLE_H) value-prof.h
tree-mudflap.o : $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(TREE_INLINE_H) \
- $(TREE_GIMPLE_H) $(DIAGNOSTIC_H) $(HASHTAB_H) langhooks.h tree-mudflap.h \
+ $(GIMPLE_H) $(DIAGNOSTIC_H) $(HASHTAB_H) langhooks.h tree-mudflap.h \
$(TM_H) coretypes.h $(TREE_DUMP_H) tree-pass.h $(CGRAPH_H) $(GGC_H) \
gt-tree-mudflap.h $(BASIC_BLOCK_H) $(FLAGS_H) $(FUNCTION_H) hard-reg-set.h \
- $(RTL_H) $(TM_P_H) $(TREE_FLOW_H) toplev.h
+ $(RTL_H) $(TM_P_H) $(TREE_FLOW_H) $(TOPLEV.H) $(GIMPLE_H) tree-iterator.h
tree-nomudflap.o : $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(TREE_INLINE_H) \
- $(C_TREE_H) $(C_COMMON_H) $(TREE_GIMPLE_H) $(DIAGNOSTIC_H) $(HASHTAB_H) \
+ $(C_TREE_H) $(C_COMMON_H) $(GIMPLE_H) $(DIAGNOSTIC_H) $(HASHTAB_H) \
output.h $(VARRAY_H) langhooks.h tree-mudflap.h $(TM_H) coretypes.h \
- $(GGC_H) gt-tree-mudflap.h tree-pass.h toplev.h
+ $(GGC_H) gt-tree-mudflap.h tree-pass.h $(TOPLEV_H)
tree-pretty-print.o : tree-pretty-print.c $(CONFIG_H) $(SYSTEM_H) \
$(TREE_H) $(DIAGNOSTIC_H) $(REAL_H) $(HASHTAB_H) $(TREE_FLOW_H) \
$(TM_H) coretypes.h tree-iterator.h tree-chrec.h langhooks.h tree-pass.h \
value-prof.h fixed-value.h output.h
fold-const.o : fold-const.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(TREE_H) $(FLAGS_H) $(REAL_H) toplev.h $(HASHTAB_H) $(EXPR_H) $(RTL_H) \
- $(GGC_H) $(TM_P_H) langhooks.h $(MD5_H) intl.h fixed-value.h $(TARGET_H)
+ $(TREE_H) $(FLAGS_H) $(REAL_H) $(TOPLEV_H) $(HASHTAB_H) $(EXPR_H) $(RTL_H) \
+ $(GGC_H) $(TM_P_H) langhooks.h $(MD5_H) intl.h fixed-value.h $(TARGET_H) \
+ $(GIMPLE_H)
diagnostic.o : diagnostic.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(TREE_H) version.h $(TM_P_H) $(FLAGS_H) $(INPUT_H) toplev.h intl.h \
+ $(TREE_H) version.h $(TM_P_H) $(FLAGS_H) $(INPUT_H) $(TOPLEV_H) intl.h \
$(DIAGNOSTIC_H) langhooks.h $(LANGHOOKS_DEF_H) diagnostic.def opts.h
-opts.o : opts.c opts.h options.h toplev.h $(CONFIG_H) $(SYSTEM_H) \
+opts.o : opts.c opts.h options.h $(TOPLEV_H) $(CONFIG_H) $(SYSTEM_H) \
coretypes.h $(TREE_H) $(TM_H) langhooks.h $(GGC_H) $(RTL_H) \
output.h $(DIAGNOSTIC_H) $(TM_P_H) $(INSN_ATTR_H) intl.h $(TARGET_H) \
$(FLAGS_H) $(PARAMS_H) tree-pass.h $(DBGCNT_H) debug.h varray.h
opts-common.o : opts-common.c opts.h $(CONFIG_H) $(SYSTEM_H) \
coretypes.h intl.h
targhooks.o : targhooks.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TREE_H) \
- $(EXPR_H) $(TM_H) $(RTL_H) $(TM_P_H) $(FUNCTION_H) output.h toplev.h \
+ $(EXPR_H) $(TM_H) $(RTL_H) $(TM_P_H) $(FUNCTION_H) output.h $(TOPLEV_H) \
$(MACHMODE_H) $(TARGET_DEF_H) $(TARGET_H) $(GGC_H) gt-targhooks.h \
$(OPTABS_H) $(RECOG_H) reload.h
toplev.o : toplev.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
version.h $(RTL_H) $(FUNCTION_H) $(FLAGS_H) xcoffout.h $(INPUT_H) \
$(INSN_ATTR_H) output.h $(DIAGNOSTIC_H) debug.h insn-config.h intl.h \
- $(RECOG_H) Makefile toplev.h dwarf2out.h sdbout.h dbxout.h $(EXPR_H) \
+ $(RECOG_H) Makefile $(TOPLEV_H) dwarf2out.h sdbout.h dbxout.h $(EXPR_H) \
hard-reg-set.h $(BASIC_BLOCK_H) graph.h except.h $(REGS_H) $(TIMEVAR_H) \
value-prof.h $(PARAMS_H) $(TM_P_H) reload.h dwarf2asm.h $(TARGET_H) \
langhooks.h insn-flags.h $(CFGLAYOUT_H) $(CFGLOOP_H) hosthooks.h \
$(CGRAPH_H) $(COVERAGE_H) alloc-pool.h $(GGC_H) $(INTEGRATE_H) \
- opts.h params.def tree-mudflap.h $(REAL_H) tree-pass.h
+ opts.h params.def tree-mudflap.h $(REAL_H) tree-pass.h $(GIMPLE_H)
$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) \
-DTARGET_NAME=\"$(target_noncanonical)\" \
-c $(srcdir)/toplev.c $(OUTPUT_OPTION)
passes.o : passes.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
$(RTL_H) $(FUNCTION_H) $(FLAGS_H) xcoffout.h $(INPUT_H) $(INSN_ATTR_H) output.h \
- $(DIAGNOSTIC_H) debug.h insn-config.h intl.h $(RECOG_H) toplev.h \
+ $(DIAGNOSTIC_H) debug.h insn-config.h intl.h $(RECOG_H) $(TOPLEV_H) \
dwarf2out.h sdbout.h dbxout.h $(EXPR_H) hard-reg-set.h $(BASIC_BLOCK_H) \
graph.h except.h $(REGS_H) $(TIMEVAR_H) value-prof.h \
$(PARAMS_H) $(TM_P_H) reload.h dwarf2asm.h $(TARGET_H) \
@@ -2420,54 +2426,54 @@ passes.o : passes.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
$(GGC_H) $(INTEGRATE_H) $(CPPLIB_H) opts.h $(TREE_FLOW_H) $(TREE_INLINE_H) \
gt-passes.h $(DF_H) $(PREDICT_H)
-main.o : main.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) toplev.h
+main.o : main.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TOPLEV_H)
host-default.o : host-default.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
hosthooks.h $(HOSTHOOKS_DEF_H)
rtl-error.o: rtl-error.c $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
- $(INSN_ATTR_H) insn-config.h $(INPUT_H) toplev.h intl.h $(DIAGNOSTIC_H) \
+ $(INSN_ATTR_H) insn-config.h $(INPUT_H) $(TOPLEV_H) intl.h $(DIAGNOSTIC_H) \
$(CONFIG_H) varray.h
rtl.o : rtl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
- $(GGC_H) $(BCONFIG_H) insn-notes.def reg-notes.def toplev.h $(REAL_H)
+ $(GGC_H) $(BCONFIG_H) insn-notes.def reg-notes.def $(TOPLEV_H) $(REAL_H)
print-rtl.o : print-rtl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(RTL_H) $(TREE_H) hard-reg-set.h $(BASIC_BLOCK_H) $(FLAGS_H) \
$(BCONFIG_H) $(REAL_H)
-rtlanal.o : rtlanal.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) toplev.h \
+rtlanal.o : rtlanal.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TOPLEV_H) \
$(RTL_H) hard-reg-set.h $(TM_P_H) insn-config.h $(RECOG_H) $(REAL_H) \
$(FLAGS_H) $(REGS_H) output.h $(TARGET_H) $(FUNCTION_H) $(TREE_H) \
$(DF_H)
varasm.o : varasm.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
$(RTL_H) $(FLAGS_H) $(FUNCTION_H) $(EXPR_H) hard-reg-set.h $(REGS_H) \
- output.h $(C_PRAGMA_H) toplev.h xcoffout.h debug.h $(GGC_H) $(TM_P_H) \
+ output.h $(C_PRAGMA_H) $(TOPLEV_H) xcoffout.h debug.h $(GGC_H) $(TM_P_H) \
$(HASHTAB_H) $(TARGET_H) langhooks.h gt-varasm.h $(BASIC_BLOCK_H) \
$(CFGLAYOUT_H) $(CGRAPH_H) targhooks.h tree-mudflap.h $(REAL_H) tree-iterator.h
function.o : function.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
- $(TREE_H) $(CFGLAYOUT_H) $(TREE_GIMPLE_H) $(FLAGS_H) $(FUNCTION_H) $(EXPR_H) \
+ $(TREE_H) $(CFGLAYOUT_H) $(GIMPLE_H) $(FLAGS_H) $(FUNCTION_H) $(EXPR_H) \
$(OPTABS_H) libfuncs.h $(REGS_H) hard-reg-set.h insn-config.h $(RECOG_H) \
- output.h toplev.h except.h $(HASHTAB_H) $(GGC_H) $(TM_P_H) langhooks.h \
+ output.h $(TOPLEV_H) except.h $(HASHTAB_H) $(GGC_H) $(TM_P_H) langhooks.h \
gt-function.h $(TARGET_H) $(BASIC_BLOCK_H) $(INTEGRATE_H) $(PREDICT_H) \
tree-pass.h $(DF_H) $(TIMEVAR_H) vecprim.h
statistics.o : statistics.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
tree-pass.h $(TREE_DUMP_H) $(HASHTAB_H) statistics.h $(TM_H) $(FUNCTION_H)
stmt.o : stmt.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(TREE_H) $(FLAGS_H) $(FUNCTION_H) insn-config.h hard-reg-set.h $(EXPR_H) \
- libfuncs.h except.h $(RECOG_H) toplev.h output.h $(GGC_H) $(TM_P_H) \
+ libfuncs.h except.h $(RECOG_H) $(TOPLEV_H) output.h $(GGC_H) $(TM_P_H) \
langhooks.h $(PREDICT_H) $(OPTABS_H) $(TARGET_H) $(MACHMODE_H) \
$(REGS_H) alloc-pool.h
except.o : except.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(TREE_H) $(FLAGS_H) except.h $(FUNCTION_H) $(EXPR_H) libfuncs.h \
langhooks.h insn-config.h hard-reg-set.h $(BASIC_BLOCK_H) output.h \
- dwarf2asm.h dwarf2out.h toplev.h $(HASHTAB_H) intl.h $(GGC_H) \
+ dwarf2asm.h dwarf2out.h $(TOPLEV_H) $(HASHTAB_H) intl.h $(GGC_H) \
gt-except.h $(CGRAPH_H) $(INTEGRATE_H) $(DIAGNOSTIC_H) dwarf2.h \
$(TARGET_H) $(TM_P_H) tree-pass.h $(TIMEVAR_H)
expr.o : expr.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(TREE_H) $(FLAGS_H) $(FUNCTION_H) $(REGS_H) $(EXPR_H) $(OPTABS_H) \
libfuncs.h $(INSN_ATTR_H) insn-config.h $(RECOG_H) output.h \
- typeclass.h hard-reg-set.h toplev.h hard-reg-set.h except.h reload.h \
+ typeclass.h hard-reg-set.h $(TOPLEV_H) hard-reg-set.h except.h reload.h \
$(GGC_H) langhooks.h intl.h $(TM_P_H) $(REAL_H) $(TARGET_H) \
tree-iterator.h gt-expr.h $(MACHMODE_H) $(TIMEVAR_H) $(TREE_FLOW_H) \
tree-pass.h $(DF_H) $(DIAGNOSTIC_H) vecprim.h
@@ -2475,39 +2481,39 @@ dojump.o : dojump.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_
$(FLAGS_H) $(FUNCTION_H) $(EXPR_H) $(OPTABS_H) $(INSN_ATTR_H) insn-config.h \
langhooks.h $(GGC_H) gt-dojump.h vecprim.h
builtins.o : builtins.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
- $(TREE_H) $(TREE_GIMPLE_H) $(FLAGS_H) $(TARGET_H) $(FUNCTION_H) $(REGS_H) \
+ $(TREE_H) $(GIMPLE_H) $(FLAGS_H) $(TARGET_H) $(FUNCTION_H) $(REGS_H) \
$(EXPR_H) $(OPTABS_H) insn-config.h $(RECOG_H) output.h typeclass.h \
- hard-reg-set.h toplev.h hard-reg-set.h except.h $(TM_P_H) $(PREDICT_H) \
+ hard-reg-set.h $(TOPLEV_H) hard-reg-set.h except.h $(TM_P_H) $(PREDICT_H) \
libfuncs.h $(REAL_H) langhooks.h $(BASIC_BLOCK_H) tree-mudflap.h \
$(BUILTINS_DEF) $(MACHMODE_H) $(DIAGNOSTIC_H) $(TREE_FLOW_H) value-prof.h
calls.o : calls.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(TREE_H) $(FLAGS_H) $(EXPR_H) $(OPTABS_H) langhooks.h $(TARGET_H) \
- libfuncs.h $(REGS_H) toplev.h output.h $(FUNCTION_H) $(TIMEVAR_H) $(TM_P_H) \
- $(CGRAPH_H) except.h sbitmap.h $(DBGCNT_H)
+ libfuncs.h $(REGS_H) $(TOPLEV_H) output.h $(FUNCTION_H) $(TIMEVAR_H) $(TM_P_H) \
+ $(CGRAPH_H) except.h sbitmap.h $(DBGCNT_H) $(TREE_FLOW_H)
expmed.o : expmed.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_H) \
$(FLAGS_H) insn-config.h $(EXPR_H) $(OPTABS_H) $(RECOG_H) $(REAL_H) \
- toplev.h $(TM_P_H) langhooks.h $(DF_H) $(TARGET_H)
+ $(TOPLEV_H) $(TM_P_H) langhooks.h $(DF_H) $(TARGET_H)
explow.o : explow.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_H) \
$(FLAGS_H) hard-reg-set.h insn-config.h $(EXPR_H) $(OPTABS_H) $(RECOG_H) \
- toplev.h $(FUNCTION_H) $(GGC_H) $(TM_P_H) langhooks.h gt-explow.h \
+ $(TOPLEV_H) $(FUNCTION_H) $(GGC_H) $(TM_P_H) langhooks.h gt-explow.h \
$(TARGET_H) output.h
optabs.o : optabs.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(TREE_H) $(FLAGS_H) insn-config.h $(EXPR_H) $(OPTABS_H) libfuncs.h \
- $(RECOG_H) reload.h toplev.h $(GGC_H) $(REAL_H) $(TM_P_H) except.h \
+ $(RECOG_H) reload.h $(TOPLEV_H) $(GGC_H) $(REAL_H) $(TM_P_H) except.h \
gt-optabs.h $(BASIC_BLOCK_H) $(TARGET_H) $(FUNCTION_H)
dbxout.o : dbxout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
$(RTL_H) $(FLAGS_H) $(REGS_H) debug.h $(TM_P_H) $(TARGET_H) $(FUNCTION_H) \
langhooks.h insn-config.h reload.h $(GSTAB_H) xcoffout.h output.h dbxout.h \
- toplev.h $(GGC_H) $(OBSTACK_H) $(EXPR_H) gt-dbxout.h
+ $(TOPLEV_H) $(GGC_H) $(OBSTACK_H) $(EXPR_H) gt-dbxout.h
debug.o : debug.c debug.h $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H)
sdbout.o : sdbout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) debug.h \
$(TREE_H) $(GGC_H) $(RTL_H) $(REGS_H) $(FLAGS_H) insn-config.h \
- output.h toplev.h $(TM_P_H) gsyms.h langhooks.h $(TARGET_H) sdbout.h \
+ output.h $(TOPLEV_H) $(TM_P_H) gsyms.h langhooks.h $(TARGET_H) sdbout.h \
gt-sdbout.h reload.h $(VARRAY_H)
dwarf2out.o : dwarf2out.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(TREE_H) version.h $(RTL_H) dwarf2.h debug.h $(FLAGS_H) insn-config.h \
output.h $(DIAGNOSTIC_H) $(REAL_H) hard-reg-set.h $(REGS_H) $(EXPR_H) \
- libfuncs.h toplev.h dwarf2out.h reload.h $(GGC_H) except.h dwarf2asm.h \
+ libfuncs.h $(TOPLEV_H) dwarf2out.h reload.h $(GGC_H) except.h dwarf2asm.h \
$(TM_P_H) langhooks.h $(HASHTAB_H) gt-dwarf2out.h $(TARGET_H) $(CGRAPH_H) \
$(MD5_H) $(INPUT_H) $(FUNCTION_H) $(VARRAY_H)
dwarf2asm.o : dwarf2asm.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
@@ -2516,54 +2522,54 @@ dwarf2asm.o : dwarf2asm.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
vmsdbgout.o : vmsdbgout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) version.h \
$(FLAGS_H) $(RTL_H) output.h vmsdbg.h debug.h langhooks.h $(FUNCTION_H) $(TARGET_H)
xcoffout.o : xcoffout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(TREE_H) $(RTL_H) xcoffout.h $(FLAGS_H) toplev.h output.h dbxout.h \
+ $(TREE_H) $(RTL_H) xcoffout.h $(FLAGS_H) $(TOPLEV_H) output.h dbxout.h \
$(GGC_H) $(TARGET_H) debug.h $(GSTAB_H) xcoff.h
emit-rtl.o : emit-rtl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(TREE_H) $(FLAGS_H) $(FUNCTION_H) $(REGS_H) insn-config.h $(RECOG_H) \
- $(GGC_H) $(EXPR_H) hard-reg-set.h $(BITMAP_H) toplev.h $(BASIC_BLOCK_H) \
+ $(GGC_H) $(EXPR_H) hard-reg-set.h $(BITMAP_H) $(TOPLEV_H) $(BASIC_BLOCK_H) \
$(HASHTAB_H) $(TM_P_H) debug.h langhooks.h tree-pass.h gt-emit-rtl.h \
$(REAL_H) $(DF_H)
real.o : real.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
- toplev.h $(TM_P_H) $(REAL_H) dfp.h
+ $(TOPLEV_H) $(TM_P_H) $(REAL_H) dfp.h
dfp.o : dfp.c dfp.h $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
- toplev.h $(TM_P_H) $(REAL_H) $(DECNUM_H)
+ $(TOPLEV_H) $(TM_P_H) $(REAL_H) $(DECNUM_H)
fixed-value.o: fixed-value.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(TREE_H) fixed-value.h $(REAL_H) toplev.h
+ $(TREE_H) fixed-value.h $(REAL_H) $(TOPLEV_H)
integrate.o : integrate.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(RTL_H) $(TREE_H) $(FLAGS_H) debug.h $(INTEGRATE_H) insn-config.h \
$(EXPR_H) $(REAL_H) $(REGS_H) intl.h $(FUNCTION_H) output.h $(RECOG_H) \
- except.h toplev.h $(PARAMS_H) $(TM_P_H) $(TARGET_H) langhooks.h \
+ except.h $(TOPLEV_H) $(PARAMS_H) $(TM_P_H) $(TARGET_H) langhooks.h \
gt-integrate.h $(GGC_H) tree-pass.h $(DF_H)
jump.o : jump.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(FLAGS_H) hard-reg-set.h $(REGS_H) insn-config.h $(RECOG_H) $(EXPR_H) \
$(REAL_H) except.h $(FUNCTION_H) tree-pass.h $(DIAGNOSTIC_H) \
- toplev.h $(INSN_ATTR_H) $(TM_P_H) reload.h $(PREDICT_H) \
+ $(TOPLEV_H) $(INSN_ATTR_H) $(TM_P_H) reload.h $(PREDICT_H) \
$(TIMEVAR_H) $(TARGET_H)
simplify-rtx.o : simplify-rtx.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(RTL_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) $(REAL_H) insn-config.h \
- $(RECOG_H) $(EXPR_H) toplev.h output.h $(FUNCTION_H) $(GGC_H) $(TM_P_H) \
+ $(RECOG_H) $(EXPR_H) $(TOPLEV_H) output.h $(FUNCTION_H) $(GGC_H) $(TM_P_H) \
$(TREE_H) $(TARGET_H)
cgraph.o : cgraph.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
- langhooks.h toplev.h $(FLAGS_H) $(GGC_H) $(TARGET_H) $(CGRAPH_H) \
+ langhooks.h $(TOPLEV_H) $(FLAGS_H) $(GGC_H) $(TARGET_H) $(CGRAPH_H) \
gt-cgraph.h output.h intl.h $(BASIC_BLOCK_H) debug.h $(HASHTAB_H) \
$(TREE_INLINE_H) $(VARRAY_H) $(TREE_DUMP_H) $(TREE_FLOW_H)
cgraphunit.o : cgraphunit.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(TREE_H) langhooks.h $(TREE_INLINE_H) toplev.h $(FLAGS_H) $(GGC_H) \
- $(TARGET_H) $(CGRAPH_H) intl.h pointer-set.h $(FUNCTION_H) $(TREE_GIMPLE_H) \
+ $(TREE_H) langhooks.h $(TREE_INLINE_H) $(TOPLEV_H) $(FLAGS_H) $(GGC_H) \
+ $(TARGET_H) $(CGRAPH_H) intl.h pointer-set.h $(FUNCTION_H) $(GIMPLE_H) \
$(TREE_FLOW_H) tree-pass.h $(C_COMMON_H) debug.h $(DIAGNOSTIC_H) \
$(FIBHEAP_H) output.h $(PARAMS_H) $(RTL_H) $(TIMEVAR_H) $(IPA_PROP_H) \
- gt-cgraphunit.h
+ gt-cgraphunit.h tree-iterator.h
cgraphbuild.o : cgraphbuild.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(TREE_H) langhooks.h $(CGRAPH_H) intl.h pointer-set.h $(TREE_GIMPLE_H) \
+ $(TREE_H) langhooks.h $(CGRAPH_H) intl.h pointer-set.h $(GIMPLE_H) \
$(TREE_FLOW_H) tree-pass.h
varpool.o : varpool.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(TREE_H) $(CGRAPH_H) langhooks.h $(DIAGNOSTIC_H) $(HASHTAB_H) \
- $(GGC_H) $(TIMEVAR_H) debug.h $(TARGET_H) output.h $(TREE_GIMPLE_H) \
+ $(GGC_H) $(TIMEVAR_H) debug.h $(TARGET_H) output.h $(GIMPLE_H) \
$(TREE_FLOW_H) gt-varpool.h
ipa.o : ipa.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(CGRAPH_H) \
tree-pass.h $(TIMEVAR_H)
-ipa-prop.o : ipa-prop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- langhooks.h $(GGC_H) $(TARGET_H) $(CGRAPH_H) $(IPA_PROP_H) \
+ipa-prop.o : ipa-prop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
+ langhooks.h $(GGC_H) $(TARGET_H) $(CGRAPH_H) $(IPA_PROP_H) $(DIAGNOSTIC_H) \
$(TREE_FLOW_H) $(TM_H) tree-pass.h $(FLAGS_H) $(TREE_H) $(TREE_INLINE_H) \
$(TIMEVAR_H)
ipa-cp.o : ipa-cp.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
@@ -2571,7 +2577,7 @@ ipa-cp.o : ipa-cp.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(FLAGS_H) $(TIMEVAR_H) $(DIAGNOSTIC_H) $(TREE_DUMP_H) $(TREE_INLINE_H)
matrix-reorg.o : matrix-reorg.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(TREE_H) $(RTL_H) $(C_TREE_H) $(TREE_INLINE_H) $(TREE_FLOW_H) \
- tree-flow-inline.h langhooks.h $(HASHTAB_H) toplev.h $(FLAGS_H) $(GGC_H) \
+ tree-flow-inline.h langhooks.h $(HASHTAB_H) $(TOPLEV_H) $(FLAGS_H) $(GGC_H) \
debug.h $(TARGET_H) $(CGRAPH_H) $(DIAGNOSTIC_H) $(TIMEVAR_H) $(PARAMS_H) \
$(FIBHEAP_H) $(C_COMMON_H) intl.h $(FUNCTION_H) $(BASIC_BLOCK_H) $(CFGLOOP_H) \
tree-iterator.h tree-pass.h opts.h $(TREE_DATA_REF_H) tree-chrec.h \
@@ -2579,44 +2585,45 @@ matrix-reorg.o : matrix-reorg.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
ipa-inline.o : ipa-inline.c gt-ipa-inline.h $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(TREE_H) langhooks.h $(TREE_INLINE_H) $(FLAGS_H) $(CGRAPH_H) intl.h \
$(DIAGNOSTIC_H) $(FIBHEAP_H) $(PARAMS_H) $(TIMEVAR_H) tree-pass.h \
- $(HASHTAB_H) $(COVERAGE_H) $(GGC_H) $(TREE_FLOW_H) $(RTL_H)
+ $(HASHTAB_H) $(COVERAGE_H) $(GGC_H) $(TREE_FLOW_H) $(RTL_H) $(IPA_PROP_H)
ipa-utils.o : ipa-utils.c $(IPA_UTILS_H) $(CONFIG_H) $(SYSTEM_H) \
coretypes.h $(TM_H) $(TREE_H) $(TREE_FLOW_H) $(TREE_INLINE_H) langhooks.h \
- pointer-set.h $(GGC_H) $(C_COMMON_H) $(TREE_GIMPLE_H) \
+ pointer-set.h $(GGC_H) $(C_COMMON_H) $(GIMPLE_H) \
$(CGRAPH_H) output.h $(FLAGS_H) tree-pass.h $(TIMEVAR_H) $(DIAGNOSTIC_H)
ipa-reference.o : ipa-reference.c $(CONFIG_H) $(SYSTEM_H) \
coretypes.h $(TM_H) $(TREE_H) $(TREE_FLOW_H) $(TREE_INLINE_H) langhooks.h \
pointer-set.h $(GGC_H) $(IPA_REFERENCE_H) $(IPA_UTILS_H) $(C_COMMON_H) \
- $(TREE_GIMPLE_H) $(CGRAPH_H) output.h $(FLAGS_H) tree-pass.h \
+ $(GIMPLE_H) $(CGRAPH_H) output.h $(FLAGS_H) tree-pass.h \
$(TIMEVAR_H) $(DIAGNOSTIC_H) $(FUNCTION_H)
ipa-pure-const.o : ipa-pure-const.c $(CONFIG_H) $(SYSTEM_H) \
coretypes.h $(TM_H) $(TREE_H) $(TREE_FLOW_H) $(TREE_INLINE_H) langhooks.h \
pointer-set.h $(GGC_H) $(IPA_UTILS_H) $(C_COMMON_H) $(TARGET_H) \
- $(TREE_GIMPLE_H) $(CGRAPH_H) output.h $(FLAGS_H) tree-pass.h $(TIMEVAR_H) \
+ $(GIMPLE_H) $(CGRAPH_H) output.h $(FLAGS_H) tree-pass.h $(TIMEVAR_H) \
$(DIAGNOSTIC_H)
ipa-type-escape.o : ipa-type-escape.c $(CONFIG_H) $(SYSTEM_H) \
coretypes.h $(TM_H) $(TREE_H) $(TREE_FLOW_H) $(TREE_INLINE_H) langhooks.h \
pointer-set.h $(GGC_H) $(IPA_TYPE_ESCAPE_H) $(IPA_UTILS_H) $(C_COMMON_H) \
- $(TREE_GIMPLE_H) $(CGRAPH_H) output.h $(FLAGS_H) tree-pass.h \
+ $(GIMPLE_H) $(CGRAPH_H) output.h $(FLAGS_H) tree-pass.h \
$(TIMEVAR_H) $(DIAGNOSTIC_H) $(FUNCTION_H)
ipa-struct-reorg.o: ipa-struct-reorg.c ipa-struct-reorg.h $(CONFIG_H) $(SYSTEM_H) \
- coretypes.h $(TM_H) $(GGC_H) $(TREE_H) $(RTL_H) $(TREE_GIMPLE_H) tree-inline.h \
- $(TREE_FLOW_H) langhooks.h pointer-set.h $(HASHTAB_H) $(C_TREE_H) toplev.h \
+ coretypes.h $(TM_H) $(GGC_H) $(TREE_H) $(RTL_H) $(GIMPLE_H) tree-inline.h \
+ $(TREE_FLOW_H) langhooks.h pointer-set.h $(HASHTAB_H) $(C_TREE_H) $(TOPLEV_H) \
$(FLAGS_H) debug.h $(TARGET_H) $(CGRAPH_H) $(DIAGNOSTIC_H) $(TIMEVAR_H) \
$(PARAMS_H) $(FIBHEAP_H) intl.h $(FUNCTION_H) $(BASIC_BLOCK_H) tree-iterator.h \
- tree-pass.h opts.h $(IPA_TYPE_ESCAPE_H) $(TREE_DUMP_H) $(C_COMMON_H)
+ tree-pass.h opts.h $(IPA_TYPE_ESCAPE_H) $(TREE_DUMP_H) $(C_COMMON_H) \
+ $(GIMPLE_H)
coverage.o : coverage.c $(GCOV_IO_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(RTL_H) $(TREE_H) $(FLAGS_H) output.h $(REGS_H) $(EXPR_H) \
- $(FUNCTION_H) toplev.h $(GGC_H) langhooks.h $(COVERAGE_H) gt-coverage.h \
+ $(FUNCTION_H) $(TOPLEV_H) $(GGC_H) langhooks.h $(COVERAGE_H) gt-coverage.h \
$(HASHTAB_H) tree-iterator.h $(CGRAPH_H) tree-pass.h gcov-io.c
cselib.o : cselib.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(REGS_H) hard-reg-set.h $(FLAGS_H) $(REAL_H) insn-config.h $(RECOG_H) \
- $(EMIT_RTL_H) toplev.h output.h $(FUNCTION_H) cselib.h $(GGC_H) $(TM_P_H) \
+ $(EMIT_RTL_H) $(TOPLEV_H) output.h $(FUNCTION_H) cselib.h $(GGC_H) $(TM_P_H) \
gt-cselib.h $(PARAMS_H) alloc-pool.h $(HASHTAB_H) $(TARGET_H)
cse.o : cse.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(REGS_H) \
- hard-reg-set.h $(FLAGS_H) insn-config.h $(RECOG_H) $(EXPR_H) toplev.h \
+ hard-reg-set.h $(FLAGS_H) insn-config.h $(RECOG_H) $(EXPR_H) $(TOPLEV_H) \
output.h $(FUNCTION_H) $(BASIC_BLOCK_H) $(GGC_H) $(TM_P_H) $(TIMEVAR_H) \
except.h $(TARGET_H) $(PARAMS_H) rtlhooks-def.h tree-pass.h $(REAL_H) \
$(DF_H) $(DBGCNT_H)
@@ -2628,11 +2635,11 @@ dse.o : dse.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(RECOG_H) $(EXPR_H) $(DF_H) cselib.h $(DBGCNT_H) $(TIMEVAR_H) tree-pass.h \
alloc-pool.h $(ALIAS_H) dse.h $(OPTABS_H)
fwprop.o : fwprop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
- toplev.h insn-config.h $(RECOG_H) $(FLAGS_H) $(OBSTACK_H) $(BASIC_BLOCK_H) \
+ $(TOPLEV_H) insn-config.h $(RECOG_H) $(FLAGS_H) $(OBSTACK_H) $(BASIC_BLOCK_H) \
output.h $(DF_H) alloc-pool.h $(TIMEVAR_H) tree-pass.h $(TARGET_H) $(TM_P_H) \
$(CFGLOOP_H) $(EMIT_RTL_H)
web.o : web.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
- hard-reg-set.h $(FLAGS_H) $(BASIC_BLOCK_H) $(FUNCTION_H) output.h toplev.h \
+ hard-reg-set.h $(FLAGS_H) $(BASIC_BLOCK_H) $(FUNCTION_H) output.h $(TOPLEV_H) \
$(DF_H) $(OBSTACK_H) $(TIMEVAR_H) tree-pass.h
see.o : see.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
hard-reg-set.h $(FLAGS_H) $(BASIC_BLOCK_H) $(FUNCTION_H) output.h \
@@ -2640,12 +2647,12 @@ see.o : see.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(HASHTAB_H) $(REGS_H) dce.h
gcse.o : gcse.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(REGS_H) hard-reg-set.h $(FLAGS_H) $(REAL_H) insn-config.h $(GGC_H) \
- $(RECOG_H) $(EXPR_H) $(BASIC_BLOCK_H) $(FUNCTION_H) output.h toplev.h \
+ $(RECOG_H) $(EXPR_H) $(BASIC_BLOCK_H) $(FUNCTION_H) output.h $(TOPLEV_H) \
$(TM_P_H) $(PARAMS_H) except.h gt-gcse.h $(TREE_H) cselib.h $(TIMEVAR_H) \
intl.h $(OBSTACK_H) tree-pass.h $(DF_H) $(DBGCNT_H)
resource.o : resource.c $(CONFIG_H) $(RTL_H) hard-reg-set.h $(SYSTEM_H) \
coretypes.h $(TM_H) $(REGS_H) $(FLAGS_H) output.h $(RESOURCE_H) $(DF_H) \
- $(FUNCTION_H) toplev.h $(INSN_ATTR_H) except.h $(PARAMS_H) $(TM_P_H)
+ $(FUNCTION_H) $(TOPLEV_H) $(INSN_ATTR_H) except.h $(PARAMS_H) $(TM_P_H)
lcm.o : lcm.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(REGS_H) \
hard-reg-set.h $(FLAGS_H) insn-config.h $(INSN_ATTR_H) $(RECOG_H) \
$(BASIC_BLOCK_H) $(TM_P_H) $(FUNCTION_H) output.h $(REAL_H)
@@ -2656,32 +2663,32 @@ mode-switching.o : mode-switching.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
tree-ssa-dce.o : tree-ssa-dce.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) \
$(RTL_H) $(TM_P_H) $(TREE_FLOW_H) $(DIAGNOSTIC_H) $(TIMEVAR_H) $(TM_H) \
coretypes.h $(TREE_DUMP_H) tree-pass.h $(FLAGS_H) $(BASIC_BLOCK_H) \
- $(GGC_H) hard-reg-set.h $(OBSTACK_H) $(TREE_GIMPLE_H) $(CFGLOOP_H) \
+ $(GGC_H) hard-reg-set.h $(OBSTACK_H) $(GIMPLE_H) $(CFGLOOP_H) \
tree-scalar-evolution.h
tree-call-cdce.o : tree-call-cdce.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) \
$(RTL_H) $(TM_P_H) $(TREE_FLOW_H) $(DIAGNOSTIC_H) $(TIMEVAR_H) $(TM_H) \
coretypes.h $(TREE_DUMP_H) tree-pass.h $(FLAGS_H) $(BASIC_BLOCK_H) \
- $(GGC_H) hard-reg-set.h $(OBSTACK_H) $(TREE_GIMPLE_H)
+ $(GGC_H) hard-reg-set.h $(OBSTACK_H) $(GIMPLE_H)
tree-ssa-ccp.o : tree-ssa-ccp.c $(TREE_FLOW_H) $(CONFIG_H) \
$(SYSTEM_H) $(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) $(GGC_H) output.h \
$(DIAGNOSTIC_H) $(FUNCTION_H) $(TIMEVAR_H) $(TM_H) coretypes.h \
$(TREE_DUMP_H) $(BASIC_BLOCK_H) tree-pass.h langhooks.h \
- tree-ssa-propagate.h value-prof.h $(FLAGS_H) $(TARGET_H) toplev.h
+ tree-ssa-propagate.h value-prof.h $(FLAGS_H) $(TARGET_H) $(TOPLEV_H)
tree-sra.o : tree-sra.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) \
$(TM_P_H) $(TREE_FLOW_H) $(DIAGNOSTIC_H) $(TREE_INLINE_H) \
- $(TIMEVAR_H) $(TM_H) coretypes.h $(TREE_DUMP_H) $(TREE_GIMPLE_H) \
+ $(TIMEVAR_H) $(TM_H) coretypes.h $(TREE_DUMP_H) $(GIMPLE_H) \
langhooks.h tree-pass.h $(FLAGS_H) $(EXPR_H) $(BASIC_BLOCK_H) \
$(BITMAP_H) $(GGC_H) hard-reg-set.h $(OBSTACK_H) $(PARAMS_H) $(TARGET_H)
tree-switch-conversion.o : tree-switch-conversion.c $(CONFIG_H) $(SYSTEM_H) \
$(TREE_H) $(TM_P_H) $(TREE_FLOW_H) $(DIAGNOSTIC_H) $(TREE_INLINE_H) \
- $(TIMEVAR_H) $(TM_H) coretypes.h $(TREE_DUMP_H) $(TREE_GIMPLE_H) \
+ $(TIMEVAR_H) $(TM_H) coretypes.h $(TREE_DUMP_H) $(GIMPLE_H) \
tree-pass.h $(FLAGS_H) $(EXPR_H) $(BASIC_BLOCK_H) output.h \
$(GGC_H) $(OBSTACK_H) $(PARAMS_H) $(CPPLIB_H) $(PARAMS_H)
tree-complex.o : tree-complex.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TREE_H) \
- $(TM_H) $(RTL_H) $(REAL_H) $(FLAGS_H) $(TREE_FLOW_H) $(TREE_GIMPLE_H) \
+ $(TM_H) $(RTL_H) $(REAL_H) $(FLAGS_H) $(TREE_FLOW_H) $(GIMPLE_H) \
tree-iterator.h tree-pass.h tree-ssa-propagate.h $(DIAGNOSTIC_H)
tree-vect-generic.o : tree-vect-generic.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) \
- $(TM_H) $(TREE_FLOW_H) $(TREE_GIMPLE_H) tree-iterator.h tree-pass.h \
+ $(TM_H) $(TREE_FLOW_H) $(GIMPLE_H) tree-iterator.h tree-pass.h \
$(FLAGS_H) $(OPTABS_H) $(RTL_H) $(MACHMODE_H) $(EXPR_H) \
langhooks.h $(FLAGS_H) $(DIAGNOSTIC_H) gt-tree-vect-generic.h $(GGC_H) \
coretypes.h insn-codes.h
@@ -2709,55 +2716,55 @@ var-tracking.o : var-tracking.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(REGS_H) $(EXPR_H) $(TIMEVAR_H) tree-pass.h
profile.o : profile.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(TREE_H) $(FLAGS_H) output.h $(REGS_H) $(EXPR_H) $(FUNCTION_H) \
- toplev.h $(COVERAGE_H) $(TREE_FLOW_H) value-prof.h cfghooks.h \
+ $(TOPLEV_H) $(COVERAGE_H) $(TREE_FLOW_H) value-prof.h cfghooks.h \
$(CFGLOOP_H) $(TIMEVAR_H) tree-pass.h
tree-profile.o : tree-profile.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(RTL_H) $(TREE_H) $(FLAGS_H) output.h $(REGS_H) $(EXPR_H) \
- $(FUNCTION_H) toplev.h $(COVERAGE_H) $(TREE_H) value-prof.h $(TREE_DUMP_H) \
+ $(FUNCTION_H) $(TOPLEV_H) $(COVERAGE_H) $(TREE_H) value-prof.h $(TREE_DUMP_H) \
tree-pass.h $(TREE_FLOW_H) $(TIMEVAR_H) $(GGC_H) gt-tree-profile.h $(CGRAPH_H)
value-prof.o : value-prof.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(BASIC_BLOCK_H) hard-reg-set.h value-prof.h $(EXPR_H) output.h $(FLAGS_H) \
$(RECOG_H) insn-config.h $(OPTABS_H) $(REGS_H) $(GGC_H) $(DIAGNOSTIC_H) \
$(TREE_H) $(COVERAGE_H) $(RTL_H) $(GCOV_IO_H) $(TREE_FLOW_H) \
- tree-flow-inline.h $(TIMEVAR_H) tree-pass.h toplev.h pointer-set.h
+ tree-flow-inline.h $(TIMEVAR_H) tree-pass.h $(TOPLEV_H) pointer-set.h
loop-doloop.o : loop-doloop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(RTL_H) $(FLAGS_H) $(EXPR_H) hard-reg-set.h $(BASIC_BLOCK_H) $(TM_P_H) \
- toplev.h $(CFGLOOP_H) output.h $(PARAMS_H) $(TARGET_H)
+ $(TOPLEV_H) $(CFGLOOP_H) output.h $(PARAMS_H) $(TARGET_H)
alloc-pool.o : alloc-pool.c $(CONFIG_H) $(SYSTEM_H) alloc-pool.h $(HASHTAB_H)
auto-inc-dec.o : auto-inc-dec.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(TREE_H) $(RTL_H) $(TM_P_H) hard-reg-set.h $(BASIC_BLOCK_H) insn-config.h \
- $(REGS_H) $(FLAGS_H) output.h $(FUNCTION_H) except.h toplev.h $(RECOG_H) \
+ $(REGS_H) $(FLAGS_H) output.h $(FUNCTION_H) except.h $(TOPLEV_H) $(RECOG_H) \
$(EXPR_H) $(TIMEVAR_H) tree-pass.h $(DF_H) $(DBGCNT_H)
cfg.o : cfg.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(FLAGS_H) \
- $(REGS_H) hard-reg-set.h output.h toplev.h $(FUNCTION_H) except.h $(GGC_H) \
+ $(REGS_H) hard-reg-set.h output.h $(TOPLEV_H) $(FUNCTION_H) except.h $(GGC_H) \
$(TM_P_H) $(TIMEVAR_H) $(OBSTACK_H) $(TREE_H) alloc-pool.h \
$(HASHTAB_H) $(DF_H) $(CFGLOOP_H) $(TREE_FLOW_H) tree-pass.h
cfghooks.o: cfghooks.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
- $(TREE_H) $(BASIC_BLOCK_H) $(TREE_FLOW_H) $(TIMEVAR_H) toplev.h $(CFGLOOP_H)
+ $(TREE_H) $(BASIC_BLOCK_H) $(TREE_FLOW_H) $(TIMEVAR_H) $(TOPLEV_H) $(CFGLOOP_H)
cfgexpand.o : cfgexpand.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
$(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) $(FUNCTION_H) $(TIMEVAR_H) $(TM_H) \
coretypes.h $(TREE_DUMP_H) except.h langhooks.h tree-pass.h $(RTL_H) \
- $(DIAGNOSTIC_H) toplev.h $(BASIC_BLOCK_H) $(FLAGS_H) debug.h $(PARAMS_H) \
+ $(DIAGNOSTIC_H) $(TOPLEV_H) $(BASIC_BLOCK_H) $(FLAGS_H) debug.h $(PARAMS_H) \
value-prof.h $(TREE_INLINE_H) $(TARGET_H)
cfgrtl.o : cfgrtl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(FLAGS_H) insn-config.h $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h \
- output.h toplev.h $(FUNCTION_H) except.h $(TM_P_H) insn-config.h $(EXPR_H) \
+ output.h $(TOPLEV_H) $(FUNCTION_H) except.h $(TM_P_H) insn-config.h $(EXPR_H) \
$(CFGLAYOUT_H) $(CFGLOOP_H) $(OBSTACK_H) $(TARGET_H) $(TREE_H) \
tree-pass.h $(DF_H) $(GGC_H)
cfganal.o : cfganal.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(BASIC_BLOCK_H) hard-reg-set.h insn-config.h $(RECOG_H) $(TM_P_H) \
- $(TIMEVAR_H) $(OBSTACK_H) toplev.h vecprim.h
+ $(TIMEVAR_H) $(OBSTACK_H) $(TOPLEV_H) vecprim.h
cfgbuild.o : cfgbuild.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
- $(FLAGS_H) $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h output.h toplev.h \
+ $(FLAGS_H) $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h output.h $(TOPLEV_H) \
$(FUNCTION_H) except.h $(TIMEVAR_H) $(TREE_H)
cfgcleanup.o : cfgcleanup.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(RTL_H) $(TIMEVAR_H) hard-reg-set.h output.h $(FLAGS_H) $(RECOG_H) \
- toplev.h insn-config.h cselib.h $(TARGET_H) $(TM_P_H) $(PARAMS_H) \
+ $(TOPLEV_H) insn-config.h cselib.h $(TARGET_H) $(TM_P_H) $(PARAMS_H) \
$(REGS_H) $(EMIT_RTL_H) $(CFGLAYOUT_H) tree-pass.h $(CFGLOOP_H) $(EXPR_H) \
$(DF_H) $(DBGCNT_H) dce.h
cfgloop.o : cfgloop.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) coretypes.h $(TM_H) \
$(BASIC_BLOCK_H) hard-reg-set.h $(CFGLOOP_H) $(FLAGS_H) $(FUNCTION_H) \
- $(OBSTACK_H) toplev.h $(TREE_FLOW_H) $(TREE_H) pointer-set.h output.h \
+ $(OBSTACK_H) $(TOPLEV_H) $(TREE_FLOW_H) $(TREE_H) pointer-set.h output.h \
$(GGC_H)
cfgloopanal.o : cfgloopanal.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) \
$(BASIC_BLOCK_H) hard-reg-set.h $(CFGLOOP_H) $(EXPR_H) coretypes.h $(TM_H) \
@@ -2766,7 +2773,7 @@ graphds.o : graphds.c graphds.h $(CONFIG_H) $(SYSTEM_H) $(BITMAP_H) $(OBSTACK_H)
coretypes.h vec.h vecprim.h
loop-iv.o : loop-iv.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(BASIC_BLOCK_H) \
hard-reg-set.h $(CFGLOOP_H) $(EXPR_H) coretypes.h $(TM_H) $(OBSTACK_H) \
- output.h intl.h toplev.h $(DF_H) $(HASHTAB_H)
+ output.h intl.h $(TOPLEV_H) $(DF_H) $(HASHTAB_H)
loop-invariant.o : loop-invariant.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) \
$(BASIC_BLOCK_H) hard-reg-set.h $(CFGLOOP_H) $(EXPR_H) $(RECOG_H) coretypes.h \
$(TM_H) $(TM_P_H) $(FUNCTION_H) $(FLAGS_H) $(DF_H) $(OBSTACK_H) output.h \
@@ -2785,45 +2792,45 @@ loop-unroll.o: loop-unroll.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TM_H) \
output.h $(EXPR_H) coretypes.h $(TM_H) $(HASHTAB_H) $(RECOG_H) \
$(OBSTACK_H)
dominance.o : dominance.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
- hard-reg-set.h $(BASIC_BLOCK_H) et-forest.h $(OBSTACK_H) toplev.h \
+ hard-reg-set.h $(BASIC_BLOCK_H) et-forest.h $(OBSTACK_H) $(TOPLEV_H) \
$(TIMEVAR_H) graphds.h vecprim.h pointer-set.h
et-forest.o : et-forest.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
et-forest.h alloc-pool.h $(BASIC_BLOCK_H)
combine.o : combine.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(FLAGS_H) $(FUNCTION_H) insn-config.h $(INSN_ATTR_H) $(REGS_H) $(EXPR_H) \
rtlhooks-def.h $(BASIC_BLOCK_H) $(RECOG_H) $(REAL_H) hard-reg-set.h \
- toplev.h $(TM_P_H) $(TREE_H) $(TARGET_H) output.h $(PARAMS_H) $(OPTABS_H) \
+ $(TOPLEV_H) $(TM_P_H) $(TREE_H) $(TARGET_H) output.h $(PARAMS_H) $(OPTABS_H) \
insn-codes.h $(TIMEVAR_H) tree-pass.h $(DF_H) vecprim.h $(CGRAPH_H)
regclass.o : regclass.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
hard-reg-set.h $(FLAGS_H) $(BASIC_BLOCK_H) addresses.h $(REGS_H) insn-config.h \
- $(RECOG_H) reload.h $(REAL_H) toplev.h $(FUNCTION_H) output.h $(GGC_H) \
+ $(RECOG_H) reload.h $(REAL_H) $(TOPLEV_H) $(FUNCTION_H) output.h $(GGC_H) \
$(TM_P_H) $(EXPR_H) $(TIMEVAR_H) gt-regclass.h $(HASHTAB_H) \
$(TARGET_H) tree-pass.h $(DF_H)
local-alloc.o : local-alloc.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(RTL_H) $(FLAGS_H) $(REGS_H) hard-reg-set.h insn-config.h $(RECOG_H) \
- output.h $(FUNCTION_H) $(INSN_ATTR_H) toplev.h except.h reload.h $(TM_P_H) \
+ output.h $(FUNCTION_H) $(INSN_ATTR_H) $(TOPLEV_H) except.h reload.h $(TM_P_H) \
$(GGC_H) $(INTEGRATE_H) $(TIMEVAR_H) tree-pass.h $(DF_H) $(DBGCNT_H)
bitmap.o : bitmap.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(FLAGS_H) $(GGC_H) gt-bitmap.h $(BITMAP_H) $(OBSTACK_H) $(HASHTAB_H)
global.o : global.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(FLAGS_H) reload.h $(FUNCTION_H) $(RECOG_H) $(REGS_H) hard-reg-set.h \
- insn-config.h output.h toplev.h $(TM_P_H) $(MACHMODE_H) tree-pass.h \
+ insn-config.h output.h $(TOPLEV_H) $(TM_P_H) $(MACHMODE_H) tree-pass.h \
$(TIMEVAR_H) vecprim.h $(DF_H) $(DBGCNT_H) $(RA_H)
ra-conflict.o : ra-conflict.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(FLAGS_H) reload.h $(FUNCTION_H) $(RECOG_H) $(REGS_H) hard-reg-set.h \
- insn-config.h output.h toplev.h $(TM_P_H) $(MACHMODE_H) tree-pass.h \
+ insn-config.h output.h $(TOPLEV_H) $(TM_P_H) $(MACHMODE_H) tree-pass.h \
$(TIMEVAR_H) vecprim.h $(DF_H) $(RA_H) sbitmap.h sparseset.h
varray.o : varray.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(GGC_H) \
- $(HASHTAB_H) $(BCONFIG_H) $(VARRAY_H) toplev.h
+ $(HASHTAB_H) $(BCONFIG_H) $(VARRAY_H) $(TOPLEV_H)
vec.o : vec.c $(CONFIG_H) $(SYSTEM_H) coretypes.h vec.h $(GGC_H) \
- toplev.h
+ $(TOPLEV_H)
reload.o : reload.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(FLAGS_H) output.h $(EXPR_H) $(OPTABS_H) reload.h $(RECOG_H) \
- hard-reg-set.h insn-config.h $(REGS_H) $(FUNCTION_H) real.h toplev.h \
+ hard-reg-set.h insn-config.h $(REGS_H) $(FUNCTION_H) real.h $(TOPLEV_H) \
addresses.h $(TM_P_H) $(PARAMS_H) $(TARGET_H) $(REAL_H) $(DF_H)
reload1.o : reload1.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(EXPR_H) $(OPTABS_H) reload.h $(REGS_H) hard-reg-set.h insn-config.h \
- $(BASIC_BLOCK_H) $(RECOG_H) output.h $(FUNCTION_H) toplev.h $(TM_P_H) \
+ $(BASIC_BLOCK_H) $(RECOG_H) output.h $(FUNCTION_H) $(TOPLEV_H) $(TM_P_H) \
addresses.h except.h $(TREE_H) $(REAL_H) $(FLAGS_H) $(MACHMODE_H) \
$(OBSTACK_H) $(DF_H) $(TARGET_H) dse.h
rtlhooks.o : rtlhooks.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
@@ -2831,28 +2838,28 @@ rtlhooks.o : rtlhooks.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
postreload.o : postreload.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(RTL_H) $(REAL_H) $(FLAGS_H) $(EXPR_H) $(OPTABS_H) reload.h $(REGS_H) \
hard-reg-set.h insn-config.h $(BASIC_BLOCK_H) $(RECOG_H) output.h \
- $(FUNCTION_H) toplev.h cselib.h $(TM_P_H) except.h $(TREE_H) $(MACHMODE_H) \
+ $(FUNCTION_H) $(TOPLEV_H) cselib.h $(TM_P_H) except.h $(TREE_H) $(MACHMODE_H) \
$(OBSTACK_H) $(TIMEVAR_H) tree-pass.h $(DF_H) $(DBGCNT_H)
postreload-gcse.o : postreload-gcse.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(RTL_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) insn-config.h \
- $(RECOG_H) $(EXPR_H) $(BASIC_BLOCK_H) $(FUNCTION_H) output.h toplev.h \
+ $(RECOG_H) $(EXPR_H) $(BASIC_BLOCK_H) $(FUNCTION_H) output.h $(TOPLEV_H) \
$(TM_P_H) except.h $(TREE_H) $(TARGET_H) $(HASHTAB_H) intl.h $(OBSTACK_H) \
$(PARAMS_H) $(TIMEVAR_H) tree-pass.h $(REAL_H) $(DBGCNT_H)
caller-save.o : caller-save.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(FLAGS_H) $(REGS_H) hard-reg-set.h insn-config.h $(BASIC_BLOCK_H) $(FUNCTION_H) \
- addresses.h $(RECOG_H) reload.h $(EXPR_H) toplev.h $(TM_P_H) $(DF_H) \
+ addresses.h $(RECOG_H) reload.h $(EXPR_H) $(TOPLEV_H) $(TM_P_H) $(DF_H) \
gt-caller-save.h $(GGC_H)
bt-load.o : bt-load.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) except.h \
$(RTL_H) hard-reg-set.h $(REGS_H) $(TM_P_H) $(FIBHEAP_H) output.h $(EXPR_H) \
- $(TARGET_H) $(FLAGS_H) $(INSN_ATTR_H) $(FUNCTION_H) tree-pass.h toplev.h \
+ $(TARGET_H) $(FLAGS_H) $(INSN_ATTR_H) $(FUNCTION_H) tree-pass.h $(TOPLEV_H) \
$(DF_H) vecprim.h $(RECOG_H)
reorg.o : reorg.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
conditions.h hard-reg-set.h $(BASIC_BLOCK_H) $(REGS_H) insn-config.h \
$(INSN_ATTR_H) except.h $(RECOG_H) $(FUNCTION_H) $(FLAGS_H) output.h \
- $(EXPR_H) toplev.h $(PARAMS_H) $(TM_P_H) $(OBSTACK_H) $(RESOURCE_H) \
+ $(EXPR_H) $(TOPLEV_H) $(PARAMS_H) $(TM_P_H) $(OBSTACK_H) $(RESOURCE_H) \
$(TIMEVAR_H) $(TARGET_H) tree-pass.h
alias.o : alias.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
- $(FLAGS_H) hard-reg-set.h $(BASIC_BLOCK_H) $(REGS_H) toplev.h output.h \
+ $(FLAGS_H) hard-reg-set.h $(BASIC_BLOCK_H) $(REGS_H) $(TOPLEV_H) output.h \
$(ALIAS_H) $(EMIT_RTL_H) $(GGC_H) $(FUNCTION_H) cselib.h $(TREE_H) $(TM_P_H) \
langhooks.h $(TARGET_H) gt-alias.h $(TIMEVAR_H) $(CGRAPH_H) \
$(SPLAY_TREE_H) $(VARRAY_H) $(IPA_TYPE_ESCAPE_H) $(DF_H) tree-pass.h
@@ -2865,37 +2872,37 @@ init-regs.o : init-regs.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
regmove.o : regmove.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
insn-config.h $(TIMEVAR_H) tree-pass.h $(DF_H)\
$(RECOG_H) output.h $(REGS_H) hard-reg-set.h $(FLAGS_H) $(FUNCTION_H) \
- $(EXPR_H) $(BASIC_BLOCK_H) toplev.h $(TM_P_H) except.h reload.h
+ $(EXPR_H) $(BASIC_BLOCK_H) $(TOPLEV_H) $(TM_P_H) except.h reload.h
combine-stack-adj.o : combine-stack-adj.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(RTL_H) insn-config.h $(TIMEVAR_H) tree-pass.h \
$(RECOG_H) output.h $(REGS_H) hard-reg-set.h $(FLAGS_H) $(FUNCTION_H) \
- $(EXPR_H) $(BASIC_BLOCK_H) toplev.h $(TM_P_H) $(DF_H) except.h reload.h
+ $(EXPR_H) $(BASIC_BLOCK_H) $(TOPLEV_H) $(TM_P_H) $(DF_H) except.h reload.h
ddg.o : ddg.c $(DDG_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TARGET_H) \
- toplev.h $(RTL_H) $(TM_P_H) $(REGS_H) $(FUNCTION_H) \
+ $(TOPLEV_H) $(RTL_H) $(TM_P_H) $(REGS_H) $(FUNCTION_H) \
$(FLAGS_H) insn-config.h $(INSN_ATTR_H) except.h $(RECOG_H) \
$(SCHED_INT_H) $(CFGLAYOUT_H) $(CFGLOOP_H) $(EXPR_H) $(BITMAP_H) \
hard-reg-set.h sbitmap.h $(TM_H)
modulo-sched.o : modulo-sched.c $(DDG_H) $(CONFIG_H) $(CONFIG_H) $(SYSTEM_H) \
- coretypes.h $(TARGET_H) toplev.h $(RTL_H) $(TM_P_H) $(REGS_H) $(FUNCTION_H) \
+ coretypes.h $(TARGET_H) $(TOPLEV_H) $(RTL_H) $(TM_P_H) $(REGS_H) $(FUNCTION_H) \
$(FLAGS_H) insn-config.h $(INSN_ATTR_H) except.h $(RECOG_H) \
$(SCHED_INT_H) $(CFGLAYOUT_H) $(CFGLOOP_H) $(EXPR_H) $(PARAMS_H) \
cfghooks.h $(GCOV_IO_H) hard-reg-set.h $(TM_H) $(TIMEVAR_H) tree-pass.h \
$(DF_H) $(DBGCNT_H)
haifa-sched.o : haifa-sched.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(SCHED_INT_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) insn-config.h $(FUNCTION_H) \
- $(INSN_ATTR_H) toplev.h $(RECOG_H) except.h $(TM_P_H) $(TARGET_H) output.h \
+ $(INSN_ATTR_H) $(TOPLEV_H) $(RECOG_H) except.h $(TM_P_H) $(TARGET_H) output.h \
$(PARAMS_H) $(DBGCNT_H)
sched-deps.o : sched-deps.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(RTL_H) $(SCHED_INT_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) insn-config.h \
- $(FUNCTION_H) $(INSN_ATTR_H) toplev.h $(RECOG_H) except.h cselib.h \
+ $(FUNCTION_H) $(INSN_ATTR_H) $(TOPLEV_H) $(RECOG_H) except.h cselib.h \
$(PARAMS_H) $(TM_P_H)
sched-rgn.o : sched-rgn.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(RTL_H) $(SCHED_INT_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) insn-config.h \
- $(FUNCTION_H) $(INSN_ATTR_H) toplev.h $(RECOG_H) except.h $(PARAMS_H) \
+ $(FUNCTION_H) $(INSN_ATTR_H) $(TOPLEV_H) $(RECOG_H) except.h $(PARAMS_H) \
$(TM_P_H) $(TARGET_H) $(CFGLAYOUT_H) $(TIMEVAR_H) tree-pass.h $(DBGCNT_H)
sched-ebb.o : sched-ebb.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(RTL_H) $(SCHED_INT_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) insn-config.h \
- $(FUNCTION_H) $(INSN_ATTR_H) toplev.h $(RECOG_H) except.h $(TM_P_H) \
+ $(FUNCTION_H) $(INSN_ATTR_H) $(TOPLEV_H) $(RECOG_H) except.h $(TM_P_H) \
$(PARAMS_H) $(CFGLAYOUT_H) $(TARGET_H) output.h
sched-vis.o : sched-vis.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(RTL_H) $(SCHED_INT_H) hard-reg-set.h $(BASIC_BLOCK_H) $(OBSTACK_H) \
@@ -2903,33 +2910,33 @@ sched-vis.o : sched-vis.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
final.o : final.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(TREE_H) $(FLAGS_H) intl.h $(REGS_H) $(RECOG_H) conditions.h \
insn-config.h $(INSN_ATTR_H) $(FUNCTION_H) output.h hard-reg-set.h \
- except.h debug.h xcoffout.h toplev.h reload.h dwarf2out.h tree-pass.h \
+ except.h debug.h xcoffout.h $(TOPLEV_H) reload.h dwarf2out.h tree-pass.h \
$(BASIC_BLOCK_H) $(TM_P_H) $(TARGET_H) $(EXPR_H) $(CFGLAYOUT_H) dbxout.h \
$(TIMEVAR_H) $(CGRAPH_H) $(COVERAGE_H) $(REAL_H) $(DF_H) vecprim.h $(GGC_H) \
$(CFGLOOP_H) $(PARAMS_H)
recog.o : recog.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(FUNCTION_H) $(BASIC_BLOCK_H) $(REGS_H) $(RECOG_H) $(EXPR_H) \
- $(FLAGS_H) insn-config.h $(INSN_ATTR_H) toplev.h output.h reload.h \
+ $(FLAGS_H) insn-config.h $(INSN_ATTR_H) $(TOPLEV_H) output.h reload.h \
addresses.h $(TM_P_H) $(TIMEVAR_H) tree-pass.h hard-reg-set.h $(REAL_H) \
$(DF_H) $(DBGCNT_H) $(TARGET_H)
reg-stack.o : reg-stack.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(RTL_H) $(TREE_H) $(RECOG_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) \
- insn-config.h toplev.h reload.h $(FUNCTION_H) $(TM_P_H) $(GGC_H) \
+ insn-config.h $(TOPLEV_H) reload.h $(FUNCTION_H) $(TM_P_H) $(GGC_H) \
$(BASIC_BLOCK_H) $(CFGLAYOUT_H) output.h $(VARRAY_H) $(TIMEVAR_H) \
tree-pass.h $(TARGET_H) vecprim.h $(DF_H)
sreal.o: sreal.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) sreal.h
predict.o: predict.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(TREE_H) $(FLAGS_H) insn-config.h $(BASIC_BLOCK_H) $(REGS_H) \
- hard-reg-set.h output.h toplev.h $(RECOG_H) $(FUNCTION_H) except.h \
+ hard-reg-set.h output.h $(TOPLEV_H) $(RECOG_H) $(FUNCTION_H) except.h \
$(TM_P_H) $(PREDICT_H) sreal.h $(PARAMS_H) $(TARGET_H) $(CFGLOOP_H) \
$(COVERAGE_H) $(SCEV_H) $(GGC_H) predict.def $(TIMEVAR_H) $(TREE_DUMP_H) \
$(TREE_FLOW_H) tree-pass.h $(EXPR_H) pointer-set.h
-lists.o: lists.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) toplev.h \
+lists.o: lists.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TOPLEV_H) \
$(RTL_H) $(GGC_H) gt-lists.h
bb-reorder.o : bb-reorder.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(RTL_H) $(FLAGS_H) $(TIMEVAR_H) output.h $(CFGLAYOUT_H) $(FIBHEAP_H) \
$(TARGET_H) $(FUNCTION_H) $(TM_P_H) $(OBSTACK_H) $(EXPR_H) $(REGS_H) \
- $(PARAMS_H) toplev.h tree-pass.h $(DF_H)
+ $(PARAMS_H) $(TOPLEV_H) tree-pass.h $(DF_H)
tracer.o : tracer.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(TREE_H) $(BASIC_BLOCK_H) hard-reg-set.h output.h $(CFGLAYOUT_H) \
$(FLAGS_H) $(TIMEVAR_H) $(PARAMS_H) $(COVERAGE_H) $(FIBHEAP_H) \
@@ -2940,26 +2947,26 @@ cfglayout.o : cfglayout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(GGC_H) alloc-pool.h $(FLAGS_H) $(OBSTACK_H) tree-pass.h vecprim.h \
$(DF_H)
timevar.o : timevar.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(TIMEVAR_H) $(FLAGS_H) intl.h toplev.h $(RTL_H) timevar.def
+ $(TIMEVAR_H) $(FLAGS_H) intl.h $(TOPLEV_H) $(RTL_H) timevar.def
regrename.o : regrename.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(RTL_H) insn-config.h $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h \
output.h $(RECOG_H) $(FUNCTION_H) $(OBSTACK_H) $(FLAGS_H) $(TM_P_H) \
- addresses.h reload.h toplev.h $(TIMEVAR_H) tree-pass.h $(DF_H)
+ addresses.h reload.h $(TOPLEV_H) $(TIMEVAR_H) tree-pass.h $(DF_H)
ifcvt.o : ifcvt.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
- $(REGS_H) toplev.h $(FLAGS_H) insn-config.h $(FUNCTION_H) $(RECOG_H) \
+ $(REGS_H) $(TOPLEV_H) $(FLAGS_H) insn-config.h $(FUNCTION_H) $(RECOG_H) \
$(TARGET_H) $(BASIC_BLOCK_H) $(EXPR_H) output.h except.h $(TM_P_H) \
$(REAL_H) $(OPTABS_H) $(CFGLOOP_H) hard-reg-set.h $(TIMEVAR_H) tree-pass.h \
$(DF_H) $(DBGCNT_H)
lambda-mat.o : lambda-mat.c $(LAMBDA_H) $(GGC_H) $(SYSTEM_H) $(CONFIG_H) \
- $(TM_H) coretypes.h $(TREE_H)
+ $(TM_H) coretypes.h $(TREE_H) $(TREE_FLOW_H)
lambda-trans.o: lambda-trans.c $(LAMBDA_H) $(GGC_H) $(SYSTEM_H) $(CONFIG_H) \
- $(TM_H) coretypes.h $(TARGET_H) $(TREE_H)
+ $(TM_H) coretypes.h $(TARGET_H) $(TREE_H) $(TREE_FLOW_H)
lambda-code.o: lambda-code.c $(LAMBDA_H) $(GGC_H) $(SYSTEM_H) $(CONFIG_H) \
$(TM_H) $(OPTABS_H) $(TREE_H) $(RTL_H) $(BASIC_BLOCK_H) \
$(DIAGNOSTIC_H) $(TREE_FLOW_H) $(TREE_DUMP_H) $(TIMEVAR_H) $(CFGLOOP_H) \
$(TREE_DATA_REF_H) $(SCEV_H) $(EXPR_H) coretypes.h $(TARGET_H) \
tree-chrec.h tree-pass.h vec.h vecprim.h $(OBSTACK_H) pointer-set.h
-params.o : params.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(PARAMS_H) toplev.h
+params.o : params.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(PARAMS_H) $(TOPLEV_H)
pointer-set.o: pointer-set.c pointer-set.h $(CONFIG_H) $(SYSTEM_H)
hooks.o: hooks.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(HOOKS_H)
pretty-print.o: $(CONFIG_H) $(SYSTEM_H) coretypes.h intl.h $(PRETTY_PRINT_H) \
@@ -2974,9 +2981,9 @@ lower-subreg.o : lower-subreg.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(out_object_file): $(out_file) $(CONFIG_H) coretypes.h $(TM_H) $(TREE_H) \
$(RTL_H) $(REGS_H) hard-reg-set.h insn-config.h conditions.h \
- output.h $(INSN_ATTR_H) $(SYSTEM_H) toplev.h $(TARGET_H) libfuncs.h \
+ output.h $(INSN_ATTR_H) $(SYSTEM_H) $(TOPLEV_H) $(TARGET_H) libfuncs.h \
$(TARGET_DEF_H) $(FUNCTION_H) $(SCHED_INT_H) $(TM_P_H) $(EXPR_H) \
- langhooks.h $(GGC_H) $(OPTABS_H) $(REAL_H) tm-constrs.h
+ langhooks.h $(GGC_H) $(OPTABS_H) $(REAL_H) tm-constrs.h $(GIMPLE_H)
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) \
$(out_file) $(OUTPUT_OPTION)
@@ -3030,17 +3037,17 @@ genrtl.o : genrtl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H)\
$(GGC_H) $(OBSTACK_H)
insn-attrtab.o : insn-attrtab.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(RTL_H) $(REGS_H) $(REAL_H) output.h $(INSN_ATTR_H) \
- insn-config.h toplev.h $(RECOG_H) $(TM_P_H) $(FLAGS_H)
+ insn-config.h $(TOPLEV_H) $(RECOG_H) $(TM_P_H) $(FLAGS_H)
insn-automata.o : insn-automata.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(RTL_H) $(REGS_H) $(REAL_H) output.h $(INSN_ATTR_H) \
- insn-config.h toplev.h $(RECOG_H) $(TM_P_H) $(FLAGS_H)
+ insn-config.h $(TOPLEV_H) $(RECOG_H) $(TM_P_H) $(FLAGS_H)
insn-emit.o : insn-emit.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(RTL_H) $(TM_P_H) $(FUNCTION_H) $(EXPR_H) $(OPTABS_H) $(REAL_H) \
dfp.h $(FLAGS_H) output.h insn-config.h hard-reg-set.h $(RECOG_H) \
- $(RESOURCE_H) reload.h toplev.h $(REGS_H) tm-constrs.h $(GGC_H) \
+ $(RESOURCE_H) reload.h $(TOPLEV_H) $(REGS_H) tm-constrs.h $(GGC_H) \
$(BASIC_BLOCK_H) $(INTEGRATE_H)
insn-extract.o : insn-extract.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) $(RTL_H) toplev.h insn-config.h $(RECOG_H)
+ $(TM_H) $(RTL_H) $(TOPLEV_H) insn-config.h $(RECOG_H)
insn-modes.o : insn-modes.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(MACHMODE_H) $(REAL_H)
insn-opinit.o : insn-opinit.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
@@ -3049,18 +3056,18 @@ insn-opinit.o : insn-opinit.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
insn-output.o : insn-output.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(RTL_H) $(GGC_H) $(REGS_H) $(REAL_H) conditions.h \
hard-reg-set.h insn-config.h $(INSN_ATTR_H) $(EXPR_H) output.h \
- $(RECOG_H) $(FUNCTION_H) toplev.h $(FLAGS_H) insn-codes.h $(TM_P_H) \
+ $(RECOG_H) $(FUNCTION_H) $(TOPLEV_H) $(FLAGS_H) insn-codes.h $(TM_P_H) \
$(TARGET_H) tm-constrs.h
insn-peep.o : insn-peep.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
insn-config.h $(RTL_H) $(TM_P_H) $(REGS_H) output.h $(REAL_H) \
- $(RECOG_H) except.h $(FUNCTION_H) toplev.h $(FLAGS_H) tm-constrs.h
+ $(RECOG_H) except.h $(FUNCTION_H) $(TOPLEV_H) $(FLAGS_H) tm-constrs.h
insn-preds.o : insn-preds.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(RTL_H) $(TREE_H) insn-config.h $(RECOG_H) output.h \
$(FLAGS_H) $(FUNCTION_H) hard-reg-set.h $(RESOURCE_H) $(TM_P_H) \
- toplev.h reload.h $(REGS_H) $(REAL_H) tm-constrs.h
+ $(TOPLEV_H) reload.h $(REGS_H) $(REAL_H) tm-constrs.h
insn-recog.o : insn-recog.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(RTL_H) insn-config.h $(RECOG_H) output.h $(FLAGS_H) \
- $(FUNCTION_H) hard-reg-set.h $(RESOURCE_H) $(TM_P_H) toplev.h \
+ $(FUNCTION_H) hard-reg-set.h $(RESOURCE_H) $(TM_P_H) $(TOPLEV_H) \
reload.h $(REAL_H) $(REGS_H) tm-constrs.h
# For each of the files generated by running a generator program over
@@ -3201,6 +3208,7 @@ GTFILES = $(CPP_ID_DATA_H) $(srcdir)/input.h $(srcdir)/coretypes.h \
$(srcdir)/alias.c $(srcdir)/bitmap.c $(srcdir)/cselib.c $(srcdir)/cgraph.c \
$(srcdir)/ipa-prop.c $(srcdir)/ipa-cp.c $(srcdir)/ipa-inline.c $(srcdir)/matrix-reorg.c \
$(srcdir)/dbxout.c $(srcdir)/ipa-struct-reorg.c $(srcdir)/dwarf2out.c $(srcdir)/dwarf2asm.c \
+ $(srcdir)/tree-vect-generic.c \
$(srcdir)/dojump.c \
$(srcdir)/emit-rtl.c $(srcdir)/except.c $(srcdir)/explow.c $(srcdir)/expr.c \
$(srcdir)/function.c $(srcdir)/except.h \
@@ -3209,18 +3217,24 @@ GTFILES = $(CPP_ID_DATA_H) $(srcdir)/input.h $(srcdir)/coretypes.h \
$(srcdir)/reg-stack.c $(srcdir)/cfglayout.c $(srcdir)/cfglayout.h \
$(srcdir)/sdbout.c $(srcdir)/stor-layout.c \
$(srcdir)/stringpool.c $(srcdir)/tree.c $(srcdir)/varasm.c \
- $(srcdir)/tree-mudflap.c $(srcdir)/tree-flow.h $(srcdir)/tree-scalar-evolution.c \
+ $(srcdir)/gimple.h $(srcdir)/gimple.c \
+ $(srcdir)/tree-mudflap.c $(srcdir)/tree-flow.h \
$(srcdir)/tree-ssanames.c $(srcdir)/tree-eh.c $(srcdir)/tree-ssa-address.c \
- $(srcdir)/tree-phinodes.c $(srcdir)/tree-cfg.c \
- $(srcdir)/tree-dfa.c $(srcdir)/tree-ssa-propagate.c \
+ $(srcdir)/tree-cfg.c \
+ $(srcdir)/tree-dfa.c \
$(srcdir)/tree-iterator.c $(srcdir)/gimplify.c \
- $(srcdir)/tree-chrec.h $(srcdir)/tree-vect-generic.c \
+ $(srcdir)/tree-chrec.h \
+ $(srcdir)/tree-scalar-evolution.c \
$(srcdir)/tree-ssa-operands.h \
$(srcdir)/tree-profile.c $(srcdir)/tree-nested.c \
- $(srcdir)/ipa-reference.c $(srcdir)/tree-ssa-structalias.h \
- $(srcdir)/tree-ssa-structalias.c $(srcdir)/tree-parloops.c \
- $(srcdir)/omp-low.c $(srcdir)/varpool.c \
+ $(srcdir)/varpool.c \
+ $(srcdir)/tree-parloops.c \
+ $(srcdir)/omp-low.c \
$(srcdir)/targhooks.c $(out_file) $(srcdir)/passes.c $(srcdir)/cgraphunit.c \
+ $(srcdir)/tree-ssa-propagate.c \
+ $(srcdir)/tree-phinodes.c \
+ $(srcdir)/ipa-reference.c $(srcdir)/tree-ssa-structalias.h \
+ $(srcdir)/tree-ssa-structalias.c \
@all_gtfiles@
# Compute the list of GT header files from the corresponding C sources,
@@ -3278,11 +3292,11 @@ build/read-rtl.o: read-rtl.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h \
build/rtl.o: rtl.c $(BCONFIG_H) coretypes.h $(GTM_H) $(SYSTEM_H) \
$(RTL_H) $(REAL_H) $(GGC_H) errors.h
build/vec.o : vec.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h vec.h \
- $(GGC_H) toplev.h
+ $(GGC_H) $(TOPLEV_H)
build/gencondmd.o : build/gencondmd.c $(BCONFIG_H) $(SYSTEM_H) \
coretypes.h $(GTM_H) insn-constants.h $(RTL_H) $(TM_P_H) \
$(FUNCTION_H) $(REGS_H) $(RECOG_H) $(REAL_H) output.h $(FLAGS_H) \
- $(RESOURCE_H) toplev.h reload.h except.h tm-constrs.h
+ $(RESOURCE_H) $(TOPLEV_H) reload.h except.h tm-constrs.h
# This pulls in tm-pred.h which contains inline functions wrapping up
# predicates from the back-end so those functions must be discarded.
# No big deal since gencondmd.c is a dummy file for non-GCC compilers.
@@ -3299,7 +3313,7 @@ build/genautomata.o : genautomata.c $(RTL_BASE_H) $(OBSTACK_H) \
$(BCONFIG_H) $(SYSTEM_H) coretypes.h $(GTM_H) errors.h vec.h \
$(HASHTAB_H) gensupport.h
build/gencheck.o : gencheck.c tree.def $(BCONFIG_H) $(GTM_H) \
- $(SYSTEM_H) coretypes.h $(lang_tree_files)
+ $(SYSTEM_H) coretypes.h $(lang_tree_files) gimple.def
build/genchecksum.o : genchecksum.c $(BCONFIG_H) $(SYSTEM_H) $(MD5_H)
build/gencodes.o : gencodes.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) \
coretypes.h $(GTM_H) errors.h gensupport.h
@@ -3330,7 +3344,7 @@ build/genopinit.o : genopinit.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) \
build/genoutput.o : genoutput.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) \
coretypes.h $(GTM_H) errors.h gensupport.h
build/genpeep.o : genpeep.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) \
- coretypes.h $(GTM_H) errors.h gensupport.h toplev.h
+ coretypes.h $(GTM_H) errors.h gensupport.h $(TOPLEV_H)
build/genpreds.o : genpreds.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) \
coretypes.h $(GTM_H) errors.h gensupport.h $(OBSTACK_H)
build/genrecog.o : genrecog.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) \
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 92f6d7bb16d..39f8cd17ae9 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,1847 @@
+2008-08-13 Samuel Tardieu <sam@rfc1149.net>
+
+ PR ada/36777
+ * sem_util.ads, sem_util.adb (Is_Protected_Self_Reference): New.
+ * sem_attr.adb (Check_Type): The current instance of a protected
+ object is not a type name.
+ (Analyze_Access_Attribute): Accept instances of protected objects.
+ (Analyze_Attribute, Attribute_Address clause): Ditto.
+ * exp_attr.adb (Expand_N_Attribute_Reference): Rewrite
+ the prefix as being the current instance if needed.
+
+2008-08-12 Danny Smith <danyssmith@users.sourceforge.net>
+
+ * gcc-interface/Makefile.in (EXTRA_GNATRTL_NONTASKING_OBJS) [WINDOWS]:
+ Remove duplicate s-win32.o. Add s-winext.o.
+
+2008-08-12 Danny Smith <danyssmith@users.sourceforge.net>
+
+ * g-stsifd-sockets.adb (Create): Replace Constants.SOCK_STREAM
+ with SOSC.SOCK__STREAM.
+ * g-socthi-mingw.adb (C_Select) Replace Constants.MSG_OOB with
+ SOSC.MSG_OOB.
+
+2008-08-11 Joel Sherrill <joel.sherrill@oarcorp.com>
+
+ * s-oscons-tmplt.c: RTEMS defines AF_INET6 but does support it.
+ * gsocket.h, socket.c: Update to support RTEMS.
+ * gcc-interface/Make-lang.in: Include CFLAGS_FOR_TARGET when cross.
+
+2008-08-10 Samuel Tardieu <sam@rfc1149.net>
+ Robert Dewar <dewar@adacore.com>
+
+ * exp_ch4.adb (Expand_N_Op_Expon): Force evaluation of
+ left argument even when right argument is 0.
+ (Expand_N_Op_Mod): Ditto when right argument is 1.
+ (Expand_N_Op_Multiply): Ditto when any argument is 0.
+ (Expand_N_Op_Rem): Ditto when right argument is 1.
+
+2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ * gcc-interface/misc.c (gnat_handle_option): Replace set_Wunused
+ by warn_unused.
+
+2008-08-08 Ed Schonberg <schonberg@adacore.com>
+
+ * freeze.adb (Generate_Prim_Op_References): New procedure, abstracted
+ from Freeze_Entity. Used to generate cross-reference information for
+ types declared in generic packages.
+
+2008-08-08 Thomas Quinot <quinot@adacore.com>
+
+ * gcc-interface/Makefile.in: Reintroduce g-soccon.ads as a
+ compatibility shim.
+
+2008-08-08 Thomas Quinot <quinot@adacore.com>
+
+ * gsocket.h:
+ On Windows, include <errno.h> and redefine only selected errno values
+ from their <winsock2.h> definitions.
+
+ * s-osinte-freebsd.ads: Minor reformatting
+
+ * s-osinte-hpux.ads, s-osinte-irix.ads: Minor reformatting
+
+ * g-soccon.ads: New file.
+
+ * g-stheme.adb, g-socthi-vms.adb, g-socthi-vxworks.adb,
+ g-socthi-mingw.adb, g-sttsne-vxworks.adb, g-socthi.adb,
+ g-stsifd-sockets.adb, g-socket.adb, g-socket.ads,
+ g-sothco.adb, g-sothco.ads: Add back GNAT.Sockets.Constants as a child
+ unit, to allow building software that depends on this internal unit
+ with both older and newer compilers.
+
+2008-08-08 Robert Dewar <dewar@adacore.com>
+
+ * s-strxdr.adb: Minor reformatting
+
+2008-08-08 Bob Duff <duff@adacore.com>
+
+ * gnat_ugn.texi: The "Run-Time Checks" section said "arithmetic overflow
+ checking for integer operations (including division by zero)", which
+ is wrong -- divide by zero is not part of overflow checking.
+ Also added misc clarification about what check-suppression means.
+
+ * gnat_rm.texi: Clarify the meaning of pragma Suppress.
+
+2008-08-08 Jerome Lambourg <lambourg@adacore.com>
+
+ * g-comlin.adb (Add_Switch): Handle addition of switches at the
+ begining of the command line.
+ (Append, Add): Renaming of Append to Add as this now allows addition
+ at the begining of the list.
+
+ * g-comlin.ads (Add_Switch): Handle addition of switches at the
+ begining of the command line.
+
+2008-08-08 Thomas Quinot <quinot@adacore.com>
+
+ * g-sercom.ads:
+ (Name): Document application scope (only legacy PC serial ports on
+ Linux and Windows).
+
+2008-08-08 Thomas Quinot <quinot@adacore.com>
+
+ * gcc-interface/Makefile.in, gcc-interface/Make-lang.in: Revert
+ previous change, not needed after all.
+
+2008-08-08 Ed Schonberg <schonberg@adacore.com>
+
+ * exp_ch4.adb (Expand_Allocator_Expression): add check if null
+ exclusion indicator is present
+
+2008-08-08 Robert Dewar <dewar@adacore.com>
+
+ * g-comlin.adb: Minor code reorganization
+ Minor reformatting
+
+ * g-comlin.ads: Minor reformatting
+
+ * s-fileio.adb: Minor reformatting
+
+ * sem_attr.adb: Minor code reorganization (use Nkind_In)
+ Minor reformatting
+
+2008-08-06 Samuel Tardieu <sam@rfc1149.net>
+
+ * gcc-interface/Make-lang.in: Use GCC_FOR_TARGET when dealing
+ with s-oscons-tmplt.i.
+
+2008-08-06 Samuel Tardieu <sam@rfc1149.net>
+
+ * gcc-interface/Make-lang.in (OSCONS_CPPFLAGS): Remove.
+
+2008-08-06 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch3.adb (Analyze_Component_Declaration): Protect against misuse
+ of incomplete type.
+
+ * sem_ch8.adb (Analyze_Object_Renaming): Diagnose properly a renaming
+ of a formal parameter of an incomplete type. Improve error message for
+ other improper uses of incomplete types.
+
+2008-08-06 Robert Dewar <dewar@adacore.com>
+
+ * gnat_ugn.texi: Clarify -gnato documentation
+
+2008-08-06 Thomas Quinot <quinot@adacore.com>
+
+ * gcc-interface/Makefile.in,
+ g-socthi-vxworks.adb, g-socthi-mingw.adb, g-sttsne-vxworks.adb,
+ g-socthi.adb, g-socket.adb, g-socket.ads, g-sothco.ads,
+ g-soccon-linux-x86.ads, g-soccon-vxworks.ads, g-soccon-mingw.ads,
+ g-soccon-hpux-ia64.ads, g-soccon-irix.ads, g-soccon-linux-64.ads,
+ g-soccon-aix.ads, g-soccon-solaris.ads, g-soccon-lynxos.ads,
+ g-soccon-vms.ads, g-soccon.ads, g-soccon-freebsd.ads,
+ g-soccon-linux-ppc.ads, g-soccon-tru64.ads, g-soccon-hpux.ads,
+ g-soccon-solaris-64.ads, gen-oscons.c, g-soccon-darwin.ads,
+ g-soccon-mingw-64.ads, g-soccon-linux-mips.ads, g-soccon-rtems.ads:
+ Remove GNAT.Sockets.Constants. This internal package is replaced by
+ System.OS_Constants.
+
+2008-08-06 Thomas Quinot <quinot@adacore.com>
+
+ * gcc-interface/Makefile.in, gcc-interface/Make-lang.in:
+ Remove obsolete targets referencing gen-soccon
+ When generating s-oscons.ads, use a file name that includes the
+ THREAD_KIND, to ensure that the (potentially different) version from a
+ previous build with a different threads flavour does not get reused.
+
+2008-08-06 Thomas Quinot <quinot@adacore.com>
+
+ * sem_res.adb: Minor reformatting
+
+ * s-fileio.adb (Open): When file open operation fails, raise Name_Error
+ only when the operating system reports a non-existing file or directory
+ (ENOENT), otherwise raise Name_Error.
+
+ * exp_ch11.adb: Minor reformatting
+
+2008-08-06 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch3.adb (Access_Subprogram_Declaration): If the return type is
+ incomplete, add the access_to_subprogram type to the list of private
+ dependents only if the incomplete type will be completed in the current
+ scope.
+ (Build_Discriminant_Constraints): If the type of the discriminant is
+ access_to_variable, reject a constraint that is access_to_constant.
+
+2008-08-06 Thomas Quinot <quinot@adacore.com>
+
+ * g-socket-dummy.adb, g-socket-dummy.ads, g-sothco-dummy.adb,
+ g-sothco-dummy.ads, g-socthi-dummy.adb, g-socthi-dummy.ads,
+ g-sttsne-dummy.ads: New files.
+
+ * gcc-interface/Makefile.in, Makefile.rtl: Use placeholder sources
+ with pragma Unimplemented_Unit for sockets packages on Nucleus.
+
+2008-08-06 Pascal Obry <obry@adacore.com>
+
+ * adaint.c: Another fix for ACL support on Windows.
+
+2008-08-06 Javier Miranda <miranda@adacore.com>
+
+ * exp_disp (Expand_Interface_Actuals): Adds missing support for
+ expansion of calls to subprograms using selected components.
+
+2008-08-06 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_res.adb (Resolve_Call): Use base type to determine whether a
+ dereference is needed because a subtype of an access_to_subprogram is
+ simply an access-subtype
+
+2008-08-06 Jerome Lambourg <lambourg@adacore.com>
+
+ * g-comlin.adb (Set_Command_Line): Now that aliases can contain
+ parameters, always specify the expected separator.
+
+2008-08-06 Thomas Quinot <quinot@adacore.com>
+
+ * xnmake.adb: Use new XUtil package for platform independent text
+ output.
+
+2008-08-06 Vincent Celier <celier@adacore.com>
+
+ * gnat_ugn.texi: Document compiler switch -gnateG
+
+2008-08-06 Quentin Ochem <ochem@adacore.com>
+
+ * s-stausa.adb (Fill_Stack): Fixed pragma assert and top pattern mark
+ in the case of an empty pattern size.
+ (Compute_Result): Do not do any computation in the case of an empty
+ pattern size.
+ (Report_Result): Fixed computation of the overflow guard.
+
+2008-08-06 Ed Schonberg <schonberg@adacore.com>
+
+ * g-awk.adb (Finalize): Do not use directly objects of the type in the
+ finalization routine to prevent elaboration order anomalies in new
+ finalization scheme.
+
+2008-08-06 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch3.adb (Find_Type_Name): protect against duplicate incomplete
+ declaration for the same type.
+
+2008-08-06 Thomas Quinot <quinot@adacore.com>
+
+ * sem.adb: Minor rewording (comment)
+
+2008-08-06 Jerome Lambourg <lambourg@adacore.com>
+
+ * g-comlin.adb (Define_Switch, Get_Switches): New.
+ (Can_Have_Parameter, Require_Parameter, Actual_Switch): New, used when
+ ungrouping switches.
+ (For_Each_Simple_Switch): Allow more control over parameters handling.
+ This generic method now allows ungrouping of switches with parameters
+ and switches with more than one letter after the prefix.
+ (Set_Command_Line): Take care of switches that are prefixed with a
+ switch handling parameters without delimiter (-gnatya and -gnaty3 for
+ example).
+ (Add_Switch, Remove_Switch): Handle parameters possibly present inside
+ a group, as in gnaty3aM80 (3 and 80 are parameters). Report status of
+ the operation.
+ (Start, Alias_Switches, Group_Switches): Take care of parameters
+ possibly present inside a group.
+
+ * g-comlin.ads (Define_Switch): New method used to define a list of
+ expected switches, that are necessary for correctly ungrouping switches
+ with more that one character after the prefix.
+ (Get_Switches): Method that builds a getopt string from the list of
+ switches as set previously by Define_Switch.
+ (Add_Switch, Remove_Switch): New versions of the methods, reporting the
+ status of the operation. Also allow the removal of switches with
+ parameters only.
+ (Command_Line_Configuration_Record): Maintain a list of expected
+ switches.
+
+2008-08-06 Doug Rupp <rupp@adacore.com>
+
+ * gcc-interface/decl.c (gnat_to_gnu_param): Force 32bit descriptor if
+ TARGET_MALLOC64 clear.
+
+ * gcc-interface/utils2.c (build_call_alloc_dealloc): Force 32bit malloc
+ if TARGET_MALLOC64 clear.
+
+ * gcc-interface/gigi.h (TARGET_ABI_OPEN_VMS): Move here from utils2.c
+ (TARGET_MALLC64): New macro. Default to clear.
+
+2008-08-06 Doug Rupp <rupp@adacore.com>
+
+ * gcc-interface/utils2.c (snames.h) Include
+ (TARGET_ABI_OPEN_VMS): Initialize.
+ (build_call_alloc_dealloc); [TARGET_ABI_OPEN_VMS] Allocate on 32bit heap
+ for Convention C.
+
+2008-08-06 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch3.adb (Process_Discriminants): diagnose redundant or improper
+ null exclusion in a discriminant declaration
+
+ * sem_ch8.adb (Analyze_Object_Renaming): diagnose null exclusion
+ indicators when type is not an access type.
+
+ * sem_ch12.adb (Formal_Object_Declaration): diagnose null exclusion
+ indicators when type is not an access type.
+
+2008-08-06 Javier Miranda <miranda@adacore.com>
+
+ * exp_disp (Expand_Interface_Conversion): Freeze the entity associated
+ with the target interface before expanding the code of the interface
+ conversion.
+
+2008-08-05 Ed Schonberg <schonberg@adacore.com>
+
+ * freeze.adb:
+ (Freeze_Entity): A deferred constant does not violate the restriction
+ No_Default_Initialization,
+
+ * sem_ch3.adb (Process_Subtype): An allocator is a valid construct that
+ can carry a null exclusion indicator, and on which an error may be
+ posted if the indicator is redundant.
+
+ * sem_ch8.adb (Analyze_Object_Renaming): Verify that a null exclusion
+ does not apply to a subtype mark that already excludes null.
+
+ * sem_ch12.adb (Formal_Object_Declaration): Verify that a null
+ exclusion does not apply to a subtype mark that already excludes null.
+
+2008-08-05 Thomas Quinot <quinot@adacore.com>
+
+ * Makefile.rtl: Compile s-oscons.ads as part of the runtime library.
+
+2008-08-05 Doug Rupp <rupp@adacore.com>
+
+ * vms_data.ads: Translation for /POINTER_SIZE qualifier.
+
+2008-08-05 Thomas Quinot <quinot@adacore.com>
+
+ * gsocket.h: Make this file includable in a Nucleus environment, which
+ does not support sockets.
+
+ * socket.c: Remove Nucleus-specific hack.
+
+2008-08-05 Pascal Obry <obry@adacore.com>
+
+ * adaint.c: Remove support for readable attribute on vxworks and nucleus
+
+2008-08-05 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_attr.adb:
+ (Analyze_Attribute, case 'Result): handle properly the case where some
+ operand of the expression in a post-condition generates a transient
+ block.
+
+ * sem_ch5.adb (Analyze_Assignment_Statement): Apply conversion to
+ right-hand side when it is an anonymous access_to_subprogram, to force
+ static accessibility check when needed.
+
+2008-08-05 Sergey Rybin <rybin@adacore.com>
+
+ * gnat_ugn.texi: Changing the description of the gnatcheck metrics
+ rule according to the change in the rule option.
+ Add documentation for -gnatw.b/-gnatw.B
+
+2008-08-05 Robert Dewar <dewar@adacore.com>
+
+ * ug_words: Add entries for -gnatw.b/-gnatw.B
+
+ * vms_data.ads: Add entries for -gnatw.b/-gnatw.B
+
+2008-08-05 Vincent Celier <celier@adacore.com>
+
+ * a-wtdeio.adb (Put (Current_Output)): Use Fore in the call to Put
+ (File).
+
+ * a-ztdeio.adb: Ditto.
+
+2008-08-05 Pascal Obry <obry@adacore.com>
+
+ * adaint.c, adaint.h, s-os_lib.adb, s-os_lib.ads: Add support for the
+ readable attribute.
+
+2008-08-05 Vincent Celier <celier@adacore.com>
+
+ * s-wchwts.adb:
+ (Wide_String_To_String): Returns a String with the same 'First as its
+ parameter S.
+ (Wide_Wide_String_To_String): Ditto
+
+ * s-wchwts.ads:
+ (Wide_String_To_String): Document that the lowest index of the returned
+ String is equal to S'First.
+
+2008-08-05 Thomas Quinot <quinot@adacore.com>
+
+ * xoscons.adb, xutil.ads, xutil.adb, s-oscons-tmplt.c: New files.
+
+ * gcc-interface/Makefile.in, gcc-interface/Make-lang.in: Generate
+ s-oscons.ads
+
+2008-08-05 Robert Dewar <dewar@adacore.com>
+
+ * opt.ads (Warn_On_Biased_Representation): New flag
+
+ * sem_ch13.adb:
+ (Analyze_Attribute_Definition_Clause): Issue warning when biased
+ representation is required.
+ (Minimum_Size): Don't allow biasing if enum rep clause case
+
+ * sem_warn.adb:
+ (Set_Dot_Warning_Switch): Add handling of -gnatw.b/B switches
+ (Set_Warning_Switch): Include -gnatw.b in -gnatwa, -gnatw.B in gnatws
+
+ * usage.adb: Add lines for -gnatw.b/B switches
+
+2008-08-05 Pascal Obry <obry@adacore.com>
+
+ * a-coinve.adb: Reorder the code to avoid uninitialized warning.
+
+ * adaint.c: In UNIX cases do not call __gnat_stat but stat directly.
+
+2008-08-05 Thomas Quinot <quinot@adacore.com>
+
+ * socket.c: Minor reformatting.
+
+2008-08-05 Robert Dewar <dewar@adacore.com>
+
+ * sem_ch3.adb: Minor reformatting
+
+ * prj-nmsc.adb: Minor reformatting
+
+2008-08-05 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch12.adb (Validate_Array_Type_Instance): Only apply complex
+ visibility check on the component type if the simple test fails.
+
+2008-08-05 Jose Ruiz <ruiz@adacore.com>
+
+ * init.c (__gnat_install_handler for linux): If we are building the
+ Xenomai run time then we need to do two additional things: avoid
+ memory swapping and transform the Linux environment task into a native
+ Xenomai task.
+
+ * gcc-interface/Makefile.in (LIBGNAT_TARGET_PAIRS for xenomai run
+ time): Use interface to Xenomai native skin and avoid linux-specific
+ way of setting CPU affinity.
+ (EH_MECHANISM for the xenomai run time): Use sjlj exception mechanism.
+
+2008-08-05 Bob Duff <duff@adacore.com>
+
+ * checks.ads: Minor comment fix
+
+2008-08-05 Thomas Quinot <quinot@adacore.com>
+
+ * g-sercom.adb, g-sercom.ads, g-sercom-mingw.adb,
+ g-sercom-linux.adb (Data_Bits): Change literals B7 and B8 to CS7 and
+ CS8.
+
+2008-08-05 Robert Dewar <dewar@adacore.com>
+
+ * mlib.adb: Minor code reorganization
+ Minor reformatting
+
+ * make.adb: Minor reformatting
+
+ * prj-attr.ads: Minor reformatting
+
+ * s-os_lib.adb: Minor reformatting
+
+ * s-fileio.adb: Minor code reorganization
+ Minor reformatting
+
+ * prj.ads: Minor reformatting
+
+2008-08-05 Bob Duff <duff@adacore.com>
+
+ * sem_ch3.adb (Analyze_Object_Declaration): Avoid type Any_Access in
+ unresolved initial value of "null", because it causes implicitly
+ generated "=" operators to be ambiguous, and because this type should
+ not be passed to gigi.
+
+2008-08-05 Vincent Celier <celier@adacore.com>
+
+ * mlib.adb: Update comments.
+
+ * make.adb (Switches_Of): Check for Switches (others), before checking
+ for Default_Switches ("Ada").
+ (Gnatmake): Use Builder'Switches (others) in preference to
+ Builder'Default_Switches ("Ada") if there are several mains.
+
+ * prj-attr-pm.adb:
+ (Add_Attribute): Add component Others_Allowed in Attribute_Record
+ aggregate.
+
+ * prj-attr.adb:
+ Add markers to indicates that attributes Switches allow others as index
+ (Others_Allowed_For): New Boolean function, returning True for
+ attributes with the mark.
+ (Initialize): Recognize optional letter 'O' as the marker for
+ associative array attributes where others is allowed as the index.
+
+ * prj-attr.ads:
+ (Others_Allowed_For): New Boolean function
+ (Attribute_Record): New Boolean component Others_Allowed
+
+ * prj-dect.adb:
+ (Parse_Attribute_Declaration): For associative array attribute where
+ others is allowed as the index, allow others as an index.
+
+ * prj-nmsc.adb:
+ (Process_Binder): Skip associative array attributes with index others
+ (Process_Compiler): Ditto
+
+ * prj-util.adb:
+ (Value_Of (Index, In_Array)): Make no attempt to put in lower case when
+ index is All_Other_Names.
+
+ * prj.ads:
+ (All_Other_Names): New constant
+
+ * prj-proc.adb:
+ (Process_Declarative_Items): Skip associative array attribute when index
+ is reserved word "others".
+
+2008-08-05 Vasiliy Fofanov <fofanov@adacore.com>
+
+ * gen-oscons.c: Adapt for VMS where termios.h is not available.
+
+2008-08-05 Thomas Quinot <quinot@adacore.com>
+
+ * a-rttiev.adb: Minor reformatting (comments)
+
+ * gen-soccon.c: Rename to gen-oscons.c
+
+ * gen-oscons.c: New file. Now generate System.OS_Constants instead of
+ GNAT.Sockets.Constants.
+ Add new constants for GNAT.Serial_Communications and System.File_IO.
+
+2008-08-05 Javier Miranda <miranda@adacore.com>
+
+ * sem_util.adb (Collect_Interfaces_Info): Minor reformating.
+ * exp_ch3.adb (Build_Offset_To_Top_Functions): Code cleanup: the
+ implementation of this routine has been simplified.
+
+2008-08-05 Pascal Obry <obry@adacore.com>
+
+ * adaint.c, adaint.h, s-os_lib.adb, s-os_lib.ads: Fix the
+ Set_Read_Only Win32 implementation.
+
+2008-08-05 Thomas Quinot <quinot@adacore.com>
+
+ * exp_strm.adb: Minor reformatting (comments)
+
+ * sem_ch12.adb: Minor reformatting.
+
+2008-08-05 Robert Dewar <dewar@adacore.com>
+
+ * sem_ch3.adb: Minor reformatting
+
+ * checks.adb: Minor reformatting
+
+2008-08-05 Thomas Quinot <quinot@adacore.com>
+
+ * tbuild.ads (New_External_Name): Update spec to reflect relaxed
+ restriction on Prefix.
+
+2008-08-05 Jerome Lambourg <lambourg@adacore.com>
+
+ * g-comlin.adb (Sort_Sections, Group_Switches): New/Modified internal
+ methods needed to handle switch sections when building a command line.
+ (Define_Section, Add_Switch, Remove_Switch, Is_New_Section,
+ Current_Section): New public methods or methods modified to handle
+ building command lines with sections.
+ (Set_Command_Line): Take into account sections when analysing a switch
+ string.
+ (Start): Sort the switches by sections before iterating the command line
+ elements.
+
+ * g-comlin.ads (Define_Section, Add_Switch, Remove_Switch,
+ Is_New_Section, Current_Section): New methods or methods modified to
+ handle building command lines with sections.
+
+2008-08-05 Ed Schonberg <schonberg@adacore.com>
+
+ * exp_strm.adb (Build_Record_Or_Elementary_Input_Function): For access
+ discriminants, indicate that the corresponding object declaration has
+ no initialization, to prevent spurious warnings when the access type is
+ null-excluding.
+
+2008-08-05 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_res.adb (Resolve_Call): If this is a call to the predefined
+ Abort_Task, warn if the call appears within a protected operation.
+
+2008-08-04 Robert Dewar <dewar@adacore.com>
+
+ * exp_ch4.adb (Expand_N_In): Suppress range warnings in instances
+
+2008-08-04 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch3.adb:
+ (Replace_Anonymous_Access_To_Protected_Subprogram): Handle properly an
+ anonymous access to protected subprogram that is the return type of the
+ specification of a subprogram body.
+
+ * sem_ch6.adb:
+ (Analyze_Subprogram_Body): if the return type is an anonymous access to
+ subprogram, freeze it now to prevent access anomalies in the back-end.
+
+ * exp_ch9.adb: Minor code cleanup.
+ Make sure that new declarations are inserted into the tree before
+ analysis (from code reading).
+
+2008-08-04 Robert Dewar <dewar@adacore.com>
+
+ * exp_ch5.adb:
+ (Expand_Simple_Function_Return): Check No_Secondary_Stack restriction
+ at point of return.
+
+2008-08-04 Thomas Quinot <quinot@adacore.com>
+
+ * sem_type.adb, sem_ch4.adb, sprint.adb, exp_ch3.adb: Minor reformatting
+
+2008-08-04 Vasiliy Fofanov <fofanov@adacore.com>
+
+ * g-soccon-mingw.ads: Fix value for MSG_WAITALL
+
+2008-08-04 Javier Miranda <miranda@adacore.com>
+
+ * sem_prag.adb (Process_Convention): Add missing support for
+ N_Private_Extension_Declaration nodes.
+
+2008-08-04 Robert Dewar <dewar@adacore.com>
+
+ * exp_ch4.adb: Minor reformatting
+
+2008-08-04 Pascal Obry <obry@adacore.com>
+
+ * adaint.h: Add missing prototype.
+
+ * adaint.c: Refine support for Windows file attributes.
+
+2008-08-04 Robert Dewar <dewar@adacore.com>
+
+ * sem_res.adb:
+ (Valid_Conversion): Catch case of designated types having different
+ sizes, even though they statically match.
+
+2008-08-04 Javier Miranda <miranda@adacore.com>
+
+ * sem_eval.adb (Subtypes_Statically_Match): Remove superfluous patch
+ added in previous patch to handle access to subprograms.
+
+2008-08-04 Robert Dewar <dewar@adacore.com>
+
+ * freeze.adb:
+ (Freeze_Entity): Only check No_Default_Initialization restriction for
+ constructs that come from source
+
+2008-08-04 Thomas Quinot <quinot@adacore.com>
+
+ * exp_ch6.adb: Minor comment fix.
+
+ * sem_ch4.adb: Minor reformatting.
+
+2008-08-04 Robert Dewar <dewar@adacore.com>
+
+ * sem_res.adb: (Large_Storage_Type): Improve previous change.
+
+2008-08-04 Pascal Obry <obry@adacore.com>
+
+ * adaint.c, s-os_lib.adb, s-os_lib.ads: Use Windows ACL to deal with
+ file attributes.
+
+2008-08-04 Javier Miranda <miranda@adacore.com>
+
+ * sem_ch3.adb (Access_Subprogram_Declaration): Adding missing support
+ for N_Formal_Object_Declaration nodes. Adding kludge required by
+ First_Formal to provide its functionality with access to functions.
+ (Replace_Anonymous_Access_To_Protected_Subprogram): Add missing support
+ for anonymous access types returned by functions.
+
+ * sem_ch5.adb (Analyze_Assignment): Code cleanup to avoid duplicate
+ conversion of null-excluding access types (required only once to force
+ the generation of the required runtime check).
+
+ * sem_type.adb (Covers): minor reformating
+
+ * checks.adb (Null_Exclusion_Static_Checks): Avoid reporting errors
+ with internally generated nodes. Avoid generating the error inside init
+ procs.
+
+ * sem_res.adb (Resolve_Membership_Test): Minor reformating.
+ (Resolve_Null): Generate the null-excluding check in case of assignment
+ to a null-excluding object.
+ (Valid_Conversion): Add missing support for anonymous access to
+ subprograms.
+
+ * sem_ch6.adb (Check_Return_Subtype_Indication): Add missing support for
+ anonymous access types whose designated type is an itype. This case
+ occurs with anonymous access to protected subprograms types.
+ (Analyze_Return_Type): Add missing support for anonymous access to
+ protected subprogram.
+
+ * sem_eval.adb (Subtypes_Statically_Match): In case of access to
+ subprograms addition of missing check on matching convention. Required
+ to properly handle access to protected subprogram types.
+
+ * exp_ch3 (Build_Assignment): Code cleanup removing duplicated check on
+ null excluding access types.
+
+2008-08-04 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch12.adb: Add comments
+
+ * sem_ch4.adb (Analyze_Allocator): If the designated type is a non-null
+ access type and the allocator is not initialized, warn rather than
+ reporting an error.
+
+2008-08-04 Robert Dewar <dewar@adacore.com>
+
+ * exp_ch4.adb: Minor reformatting
+
+ * exp_dist.adb: Minor reformatting
+
+ * g-comlin.adb: Minor reformatting
+
+2008-08-04 Gary Dismukes <dismukes@adacore.com>
+
+ * exp_aggr.adb (Build_Record_Aggr_Code): Perform a conversion of the
+ target to the type of the aggregate in the case where the target object
+ is class-wide.
+
+ * exp_ch5.adb (Expand_Simple_Function_Return): When the function's
+ result type is class-wide and inherently limited, and the expression
+ has a specific type, create a return object of the specific type, for
+ more efficient handling of returns of build-in-place aggregates (avoids
+ conversions of the class-wide return object to the specific type on
+ component assignments).
+
+ * sem_ch6.adb (Check_Return_Subtype_Indication): Suppress the error
+ about a type mismatch for a class-wide function with a return object
+ having a specific type when the object declaration doesn't come from
+ source. Such an object can result from the expansion of a simple return.
+
+2008-08-04 Vasiliy Fofanov <fofanov@adacore.com>
+
+ * g-soccon-mingw-64.ads, system-mingw-x86_64.ads: New files.
+
+ * gcc-interface/Makefile.in: Use 64bit-specific system files when
+ compiling for 64bit windows.
+
+2008-08-04 Jerome Lambourg <lambourg@adacore.com>
+
+ * g-comlin.adb (Group_Switches): Preserve the switch order when
+ grouping and allow switch grouping of switches with more than one
+ character extension (e.g. gnatw.x).
+ (Args_From_Expanded): Remove this now obsolete method.
+
+2008-08-04 Ed Schonberg <schonberg@adacore.com>
+
+ * exp_ch4.adb (Get_Allocator_Final_List): Freeze anonymous type for
+ chain at once, to ensure that type is properly decorated for back-end,
+ when allocator appears within a loop.
+
+2008-08-04 Kevin Pouget <pouget@adacore.com>
+
+ * snames.h, snames.adb, snames.ads:
+ Add Attr_To_Any, Attr_From_Any and Attr_TypeCode defines.
+
+ * exp_dist.ads, exp_dist.adb: Add Build_From_Any_Call,
+ Build_To_Any_Call and Build_TypeCode_Call procedures.
+
+ * exp_attr.adb, sem_attr.adb: Add corresponding cases.
+
+ * rtsfind.ads: Add corresponding names.
+
+ * tbuild.adb: Update prefix restrictions to allow '_' character.
+
+2008-08-04 Doug Rupp <rupp@adacore.com>
+
+ * gigi.h (fill_vms_descriptor): Add third parameter gnat_actual
+ * trans.c (call_to_gnu): Call fill_vms_descriptor with new parameter.
+ * utils2.c (fill_vms_descriptor): Add third parameter for error sloc and
+ use it. Calculate pointer range overflow using 64bit types.
+
+2008-08-04 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch3.adb (Access_Definition): A formal object declaration is a
+ legal context for an anonymous access to subprogram.
+
+ * sem_ch4.adb (Analyze_One_Call): If the call can be interpreted as an
+ indirect call, report success to the caller to include possible
+ interpretation.
+
+ * sem_ch6.adb (Check_Return_Type_Indication): Apply proper conformance
+ check when the type
+ of the extended return is an anonymous access_to_subprogram type.
+
+ * sem_res.adb:
+ (Resolve_Call): Insert a dereference if the type of the subprogram is an
+ access_to_subprogram and the context requires its return type, and a
+ dereference has not been introduced previously.
+
+2008-08-04 Arnaud Charlet <charlet@adacore.com>
+
+ * usage.adb (Usage): Minor rewording of -gnatwz switch, to improve
+ gnatcheck support in GPS.
+
+2008-08-04 Vincent Celier <celier@adacore.com>
+
+ * mlib.adb (Create_Sym_Links): Create relative symbolic links when
+ requested
+
+2008-08-04 Vincent Celier <celier@adacore.com>
+
+ * gprep.adb (Process_One_File): Call Prep.Preprocess with a Boolean
+ variable, but don't check the resulting value as it has no impact on
+ the processing.
+
+ * opt.ads:
+ (Generate_Processed_File): New Boolean flag, set to True in the compiler
+ when switch -gnateG is used.
+
+ * prep.adb:
+ (Preprocess): new Boolean out parameter Source_Modified. Set it to True
+ when the source is modified by the preprocessor and there is no
+ preprocessing errors.
+
+ * prep.ads (Preprocess): new Boolean out parameter Source_Modified
+
+ * sinput-l.adb:
+ (Load_File): Output the result of preprocessing if the source text was
+ modified.
+
+ * switch-c.adb (Scan_Front_End_Switches): Recognize switch -gnateG
+
+ * switch-m.adb (Normalize_Compiler_Switches): Normalize switch -gnateG
+
+ * ug_words: Add VMS equivalent for -gnateG
+
+ * vms_data.ads:
+ Add VMS option /GENERATE_PROCESSED_SOURCE, equivalent to switch -gnateG
+
+2008-08-04 Doug Rupp <rupp@adacore.com>
+
+ * gcc-interface/utils2.c:
+ (fill_vms_descriptor): Raise CE if attempt made to pass 64bit pointer
+ in 32bit descriptor.
+
+2008-08-04 Robert Dewar <dewar@adacore.com>
+
+ * par-ch10.adb: Minor reformatting
+
+ * i-cobol.adb: Minor reformatting.
+
+2008-08-04 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch3.adb (Access_Definition): Create an itype reference for an
+ anonymous access return type of a regular function that is not a
+ compilation unit.
+
+2008-08-04 Vincent Celier <celier@adacore.com>
+
+ * prj-attr.adb: New Builder attribute Global_Compilation_Switches
+
+ * snames.adb: New standard name Global_Compilation_Switches
+
+ * snames.ads: New standard name Global_Compilation_Switches
+
+ * make.adb: Correct spelling error in comment
+
+2008-08-04 Arnaud Charlet <charlet@adacore.com>
+
+ * sem_prag.adb (Check_Form_Of_Interface_Name): Fix handling for CLI
+ target.
+
+2008-08-04 Thomas Quinot <quinot@adacore.com>
+
+ * sem_ch10.adb: Minor comment fix.
+
+2008-08-04 Robert Dewar <dewar@adacore.com>
+
+ * restrict.adb: Improved messages for restriction warnings
+
+ * restrict.ads: Improved messages for restriction messages
+
+ * s-rident.ads (Profile_Name): Add No_Profile
+
+2008-08-04 Robert Dewar <dewar@adacore.com>
+
+ * system-darwin-x86.ads: Correct bad definition of Max_Nonbinary_Modulus
+
+2008-08-04 Robert Dewar <dewar@adacore.com>
+
+ * freeze.adb (Freeze_Entity): Check for size clause for boolean warning
+
+2008-08-04 Vincent Celier <celier@adacore.com>
+
+ * prj-proc.adb:
+ (Copy_Package_Declarations): When inheriting package Naming from a
+ project being extended, do not inherit source exception names.
+
+2008-08-04 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_prag.adb (Check_Precondition_Postcondition): When scanning the
+ list of declaration to find previous subprogram, do not go to the
+ original node of a generic unit.
+
+2008-08-02 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/utils2.c (build_binary_op) <PLUS_EXPR, MINUS_EXPR>:
+ New case. Convert BOOLEAN_TYPE operation to the default integer type.
+
+2008-08-01 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/ada-tree.h (DECL_PARM_ALT): Now DECL_PARM_ALT_TYPE.
+ * gcc-interface/decl.c (gnat_to_gnu_param): Fix formatting, simplify
+ and adjust for above renaming.
+ * gcc-interface/utils.c (convert_vms_descriptor): Likewise. Add new
+ gnu_expr_alt_type parameter. Convert the expression to it instead
+ of changing its type in place.
+ (build_function_stub): Adjust call to above function.
+
+2008-08-01 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Constant>: Remove dead
+ code. Do not get full definition of deferred constants with address
+ clause for a use. Do not ignore deferred constant definitions with
+ address clause. Ignore constant definitions already marked with the
+ error node.
+ <object>: Remove obsolete comment. For a deferred constant with
+ address clause, get the initializer from the full view.
+ * gcc-interface/trans.c (gnat_to_gnu) <N_Attribute_Definition_Clause>:
+ Rework and remove obsolete comment.
+ <N_Object_Declaration>: For a deferred constant with address clause,
+ mark the full view with the error node.
+ * gcc-interface/utils.c (convert_to_fat_pointer): Rework and fix
+ formatting nits.
+
+2008-08-01 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * rtsfind.ads: Add block IO versions of stream routines for Strings.
+
+ * bindgen.adb, gnat_rm.texi, gnat_ugn.texi, opt.ads,
+ sem_prag.adb, snames.adb, snames.ads, snames.h,
+ par-prag.adb: Undo previous stream related changes.
+
+ * s-rident.ads: Add new restriction No_Stream_Optimizations.
+
+ * s-ststop.ads, s-ststop.adb: Comment reformatting.
+ Define enumeration type to designate different IO mechanisms.
+ Enchance generic package Stream_Ops_Internal to include an
+ implementation of Input and Output.
+
+ * exp_attr.adb (Find_Stream_Subprogram): If restriction
+ No_Stream_Optimization is active, choose the default byte IO
+ implementations of stream attributes for Strings.
+ Otherwise use the corresponding block IO version.
+
+2008-08-01 Olivier Hainque <hainque@adacore.com>
+
+ * gcc-interface/decl.c (gnat_to_gnu_entity) <case E_Function>: Do not
+ turn Ada Pure into GCC const, now implicitely implying nothrow as well.
+
+2008-08-01 Robert Dewar <dewar@adacore.com>
+
+ * par-ch3.adb (P_Defining_Identifier): Avoid repeated attempt to
+ convert plain identifier into defining identifier.
+
+2008-08-01 Robert Dewar <dewar@adacore.com>
+
+ * sem_prag.adb (Check_Form_Of_Interface_Name): Refine and improve
+ warnings
+
+ * lib-xref.adb: Add error defense.
+
+2008-08-01 Bob Duff <duff@adacore.com>
+
+ * ioexcept.ads, sequenio.ads, directio.ads: Correct comment.
+
+2008-08-01 Gary Dismukes <dismukes@adacore.com>
+
+ * exp_ch6.adb (Expand_Call): Adjustment to previous fix for passing
+ correct accessibility levels. In the "when others" case, retrieve the
+ access level of the Etype of Prev rather than Prev_Orig, because the
+ original exression has not always been analyzed.
+
+2008-08-01 Robert Dewar <dewar@adacore.com>
+
+ * prj-nmsc.adb: Minor reformatting
+
+ * sem_ch4.adb: Minor reformatting
+ Minor code reorganization
+
+ * prj.ads: Minor reformatting
+
+ * s-os_lib.adb: Minor reformatting
+
+ * par-prag.adb (Prag, case Wide_Character_Encoding): Deal with upper
+ half encodings
+
+ * scans.ads: Minor reformatting.
+
+ * sem_prag.adb (Analyze_Pragma): Put entries in alpha order
+ (Analyze_Pragma): Make sure all GNAT pragmas call GNAT_Pragma
+
+ * sem_res.adb:
+ (Resolve_Call): Check violation of No_Specific_Termination_Handlers
+
+ * sem_ch12.adb: Minor comment reformatting
+
+ * par-ch3.adb (P_Type_Declaration): Properly handle missing type
+ keyword
+
+2008-08-01 Robert Dewar <dewar@adacore.com>
+
+ * sem_ch6.adb (Process_PPCs): Don't copy spec PPC to body if not
+ generating code
+
+2008-08-01 Ed Schonberg <schonberg@adacore.com>
+
+ * checks.adb (Apply_Float_Conversion_Check): If the expression to be
+ converted is a real literal and the target type has static bounds,
+ perform the conversion exactly to prevent floating-point anomalies on
+ some targets.
+
+2008-08-01 Vincent Celier <celier@adacore.com>
+
+ * prj-attr.adb: New attribute Compiler'Name_Syntax (<lang>)
+
+ * prj-nmsc.adb (Process_Compiler): Recognize attribute Name_Syntax
+
+ * prj.adb (Object_Exist_For): Use Object_Generated, not
+ Objects_Generated that is removed and was never modified anyway.
+
+ * prj.ads:
+ (Path_Syntax_Kind): New enumeration type
+ (Language_Config): New component Path_Syntax, defaulted to Host.
+ Components PIC_Option and Objects_Generated removed, as they are not
+ used.
+
+ * snames.adb: New standard name Path_Syntax
+
+ * snames.ads: New standard name Path_Syntax
+
+2008-08-01 Vincent Celier <celier@adacore.com>
+
+ * mlib-utl.adb:
+ (Adalib_Path): New variable to store the path of the adalib directory
+ when procedure Specify_Adalib_Dir is called.
+ (Lib_Directory): If Adalib_Path is not null, return its value
+ (Specify_Adalib_Dir): New procedure
+
+ * mlib-utl.ads (Specify_Adalib_Dir): New procedure
+
+2008-08-01 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_prag.adb:
+ (Check_Precondition_Postcondition): If not generating code, analyze the
+ expression in a postcondition that appears in a subprogram body, so that
+ it is properly decorated for ASIS use.
+
+2008-08-01 Gary Dismukes <dismukes@adacore.com>
+
+ * exp_ch6.adb (Expand_Call): Remove ugly special-case code that resets
+ Orig_Prev to Prev in the case where the actual is N_Function_Call or
+ N_Identifier. This was interfering with other cases that are rewritten
+ as N_Identifier, such as allocators, resulting in passing of the wrong
+ accessibility level, and based on testing this code is apparently no
+ longer needed at all.
+
+2008-08-01 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch4.adb (Analyze_One_Call): Handle complex overloading of a
+ procedure call whose prefix
+ is a parameterless function call that returns an access_to_procedure.
+
+2008-08-01 Jose Ruiz <ruiz@adacore.com>
+
+ * adaint.c (__gnat_tmp_name): Refine the generation of temporary names
+ for RTX. Adding a suffix that is incremented at each iteration.
+
+2008-08-01 Robert Dewar <dewar@adacore.com>
+
+ * sem_ch6.adb (Analyze_Subprogram_Body): Remove special casing of
+ Raise_Exception
+
+2008-08-01 Jerome Lambourg <lambourg@adacore.com>
+
+ * s-os_lib.adb (Normalize_Pathname): Take care of double-quotes in
+ paths, which are authorized by Windows but can lead to errors when used
+ elsewhere.
+
+2008-08-01 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch12.ads (Need_Subprogram_Instance_Body): new function, to create
+ a pending instantiation for the body of a subprogram that is to be
+ inlined.
+
+ * sem_ch12.adb:
+ (Analyze_Subprogram_Instantiation): use Need_Subprogram_Instance_Body.
+
+ * sem_prag.adb (Make_Inline): If the pragma applies to an instance,
+ create a pending instance for its body, so that calls to the subprogram
+ can be inlined by the back-end.
+
+2008-08-01 Jose Ruiz <ruiz@adacore.com>
+
+ * gnat_ugn.texi: Document the RTX run times (rts-rtx-rtss and
+ rts-rtx-w32).
+
+2008-08-01 Robert Dewar <dewar@adacore.com>
+
+ * scng.adb (Error_Illegal_Wide_Character): Bump scan pointer
+
+2008-08-01 Doug Rupp <rupp@adacore.com>
+
+ * gnat_rm.texi: Document new mechanism Short_Descriptor.
+
+ * types.ads (Mechanism_Type): Modify range for new Short_Descriptor
+ mechanism values.
+
+ * sem_prag.adb (Set_Mechanism_Value): Enhance for Short_Descriptor
+ mechanism and Short_Descriptor mechanism values.
+
+ * snames.adb (preset_names): Add short_descriptor entry.
+
+ * snames.ads: Add Name_Short_Descriptor.
+
+ * types.h: Add new By_Short_Descriptor mechanism values.
+
+ * sem_mech.adb (Set_Mechanism_Value): Enhance for Short_Descriptor
+ mechanism and Short_Descriptor mechanism values.
+
+ * sem_mech.ads (Mechanism_Type): Add new By_Short_Descriptor mechanism
+ values.
+ (Descriptor_Codes): Modify range for new mechanism values.
+
+ * treepr.adb (Print_Entity_Enfo): Handle new By_Short_Descriptor
+ mechanism values.
+
+ * gcc-interface/decl.c (gnat_to_gnu_entity): Handle By_Short_Descriptor.
+ (gnat_to_gnu_param): Handle By_Short_Descriptor.
+
+ * gcc-interface/gigi.h (build_vms_descriptor64): Remove prototype.
+ (build_vms_descriptor32): New prototype.
+ (fill_vms_descriptor): Remove unneeded gnat_actual parameter.
+
+ * gcc-interface/trans.c (call_to_gnu): Removed unneeded gnat_actual
+ argument in call fill_vms_descriptor.
+
+ * gcc-interface/utils.c (build_vms_descriptor32): Renamed from
+ build_vms_descriptor and enhanced to hande Short_Descriptor mechanism.
+ (build_vms_descriptor): Renamed from build_vms_descriptor64.
+ (convert_vms_descriptor32): New function.
+ (convert_vms_descriptor64): New function.
+ (convert_vms_descriptor): Rewrite to handle both 32bit and 64bit
+ descriptors.
+
+ * gcc-interface/utils2.c (fill_vms_descriptor): Revert previous changes,
+ no longer needed.
+
+2008-08-01 Jose Ruiz <ruiz@adacore.com>
+
+ * adaint.c (__gnat_tmp_name): RTSS applications do not support tempnam
+ nor tmpnam, so we always use c:\WINDOWS\Temp\gnat-XXXXXX as temporary
+ name.
+
+2008-08-01 Jose Ruiz <ruiz@adacore.com>
+
+ * cstreams.c (__gnat_full_name): RTSS applications cannot ask for the
+ current directory so only fully qualified names are allowed.
+
+2008-08-01 Robert Dewar <dewar@adacore.com>
+
+ * gnat_ugn.texi:
+ Minor editing, remove uncomfortable use of semicolon
+
+ * s-ststop.adb: Add some ??? comments
+
+ * sem_ch10.adb: Minor reformatting
+
+ * snames.ads:
+ Minor comment fixes, some pragmas were not properly
+ categorized in the comments, documentation change only
+
+ * xref_lib.adb: Minor reformatting
+
+ * sinput.adb: Minor reformatting
+
+ * gnatchop.adb: Minor reformatting
+
+ * sem_util.ads: Minor reformatting.
+
+ * opt.ads: Minor documentation fix
+
+ * scng.adb: Minor reformatting
+
+ * prj-part.adb: Update comments
+
+2008-08-01 Ed Schonberg <schonberg@adacore.com>
+
+ * exp_disp.adb (Expand_Interface_Conversion): If the target type is a
+ tagged synchronized type, use corresponding record type.
+
+2008-08-01 Doug Rupp <rupp@adacore.com>
+
+ * mlib-tgt-specific-vms-alpha.adb (Build_Dynamic_Library): Output a
+ dummy transfer address for debugging.
+
+ * mlib-tgt-specific-vms-ia64.adb (Build_Dynamic_Library): Likewise.
+
+ * vms_data.ads: vms_data.ads: New qualfier /MACHINE_CODE_LISTING
+
+2008-07-31 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/decl.c (gnat_to_gnu_entity): Fix formatting.
+ * gcc-interface/utils.c (create_field_decl): Avoid superfluous work.
+
+2008-07-31 Pascal Obry <obry@adacore.com>
+
+ * prj-nmsc.adb: Keep Object and Exec directory casing.
+
+2008-07-31 Jose Ruiz <ruiz@adacore.com>
+
+ * system-rtx-rtss.ads
+ Change the default stack size. It is important to set the commit part.
+
+ * s-taprop-rtx.adb
+ (Initialize): Get the clock resolution.
+ (RT_Resolution): Return the clock resolution that is indicated by the
+ system.
+
+ * s-parame-vxworks.adb
+ Document that this body is used for RTX in RTSS (kernel) mode.
+
+ * gcc-interface/Makefile.in
+ (LIBGNAT_TARGET_PAIRS for the rtx_rtss run time): Use the
+ s-parame-vxworks.adb body in order to have reasonable stack sizes in
+ RTX RTSS kernel mode. Virtual memory is not used in that case, so we
+ cannot ask for too big values.
+
+2008-07-31 Robert Dewar <dewar@adacore.com>
+
+ * exp_aggr.adb: Minor reformatting
+
+ * makeutl.adb: Minor reformatting
+
+ * prj-env.adb: Minor reformatting
+
+2008-07-31 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * exp_disp.adb (Prim_Op_Kind): Retrieve the full view when a private
+ tagged type is completed by a concurrent type.
+
+2008-07-31 Gary Dismukes <dismukes@adacore.com>
+
+ * sem_aggr.adb:
+ (Resolve_Record_Aggregate): Bypass error that a type without
+ components must have a "null record" aggregate when compiling for Ada
+ 2005, since it's legal to give an aggregate of form (others => <>)
+ for such a type.
+
+2008-07-31 Javier Miranda <miranda@adacore.com>
+
+ * sem_ch4.adb (Valid_First_Argument_Of): Complete its functionality to
+ handle synchronized types. Required to handle well the object.operation
+ notation applied to synchronized types.
+
+2008-07-31 Quentin Ochem <ochem@adacore.com>
+
+ * s-stausa.adb (Fill_Stack): Stack_Used_When_Filling is now stored
+ anymore - just used internally.
+ Added handling of very small tasks - when the theoretical size is
+ already full at the point of the call.
+ (Report_Result): Fixed result computation, Stack_Used_When_Filling does
+ not need to be added to the result.
+
+2008-07-31 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * sem_ch6.adb (Disambiguate_Spec): Continue the disambiguation if the
+ corresponding spec is a primitive wrapper. Update comment.
+
+2008-07-31 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * bindgen.adb Comment reformatting. Update the list of run-time globals.
+ (Gen_Adainit_Ada): Add the declaration, import and value set for
+ configuration flag Canonical_Streams.
+ (Gen_Adainit_C): Add the declaration and initial value of external
+ symbol __gl_canonical_streams.
+
+ * init.c: Update the list of global values computed by the binder.
+
+ * opt.ads: Add flag Canonical_Streams.
+
+ * par-prag.adb (Prag): Include Pragma_Canonical_Streams to the list of
+ semantically handled pragmas.
+
+ * sem_prag.adb: Add an entry into enumeration type Sig_Flags.
+ (Analyze_Pragma): Add case for pragma Canonical_Streams.
+
+ * snames.adb: Add character value for name Canonical_Streams.
+
+ * snames.ads:
+ Add Name_Canonical_Streams to the list of configuration pragmas.
+ Add Pragma_Canonical_Streams to enumeration type Pragma_Id.
+
+ * snames.h: Add a definition for Pragma_Canonical_Streams.
+
+ * s-ststop.adb:
+ Add a flag and import to seize the value of external symbol
+ __gl_canonical_streams. Update comment and initial value of constant
+ Use_Block_IO.
+
+ * gnat_rm.texi: Add section of pragma Canonical_Streams.
+
+ * gnat_ugn.texi:
+ Add pragma Canonical_Streams to the list of configuration pragmas.
+
+2008-07-31 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch10.adb (Build_Unit_Name): If the unit name in a with_clause
+ has the form A.B.C and B is a unit renaming, analyze its compilation
+ unit and add a with_clause on A.b to the context.
+
+2008-07-31 Vincent Celier <celier@adacore.com>
+
+ * makeutl.adb (Executable_Prefix_Path): If Locate_Exec_On_Path fails,
+ return the empty string, instead of raising Constraint_Error.
+
+2008-07-31 Gary Dismukes <dismukes@adacore.com>
+
+ * checks.ads (Apply_Accessibility_Check): Add parameter Insert_Node.
+
+ * checks.adb (Apply_Accessibility_Check): Insert the check on
+ Insert_Node.
+
+ * exp_attr.adb:
+ (Expand_N_Attribute_Refernce, Attribute_Access): Pass attribute node
+ to new parameter Insert_Node on call to Apply_Accessibility_Check.
+ Necessary to distinguish the insertion node because the dereferenced
+ formal may come from a rename, but the check must be inserted in
+ front of the attribute.
+
+ * exp_ch4.adb:
+ (Expand_N_Allocator): Pass actual for new Insert_Node parameter on
+ call to Apply_Accessibility_Check.
+ (Expand_N_Type_Conversion): Pass actual for new Insert_Node parameter
+ on call to Apply_Accessibility_Check.
+ Minor reformatting
+
+2008-07-31 Javier Miranda <miranda@adacore.com>
+
+ * sem_type.adb (Has_Compatible_Type): Complete support for synchronized
+ types when the candidate type is a synchronized type.
+
+ * sem_res.adb (Resolve_Actuals): Reorganize code handling synchronized
+ types, and complete management of synchronized types adding missing
+ code to handle formal that is a synchronized type.
+
+ * sem_ch4.adb (Try_Primitive_Operation): Avoid testing attributes that
+ are not available and cause the compiler to blowup. Found compiling
+ test with switch -gnatc
+
+ * sem_ch6.adb (Check_Synchronized_Overriding): Remove local subprogram
+ Has_Correct_Formal_Mode plus code cleanup.
+
+2008-07-31 Bob Duff <duff@adacore.com>
+
+ * sinput.adb (Skip_Line_Terminators): Fix handling of LF/CR -- it was
+ recognized as two end-of-lines, but it should be just one.
+
+2008-07-31 Thomas Quinot <quinot@adacore.com>
+
+ * exp_ch9.adb: Minor reformatting
+
+ * tbuild.ads: Fix several occurrences of incorrectly referring to
+ Name_Find as Find_Name.
+
+2008-07-31 Ed Schonberg <schonberg@adacore.com>
+
+ * exp_aggr.adb (Aggr_Size_OK): If the aggregate has a single component
+ and the context is an object declaration with non-static bounds, treat
+ the aggregate as non-static.
+
+2008-07-31 Vincent Celier <celier@adacore.com>
+
+ * prj-part.adb, prj-part.ads, prj.adb, prj.ads, prj-env.adb:
+ Move back spec of Parse_Single_Project to body, as it is not called
+ outside of package Prj.Part.
+ (Project_Data): Remove components Linker_Name, Linker_Path and
+ Minimum_Linker_Options as they are no longer set.
+ Remove function There_Are_Ada_Sources from package Prj and move code
+ in the only place it was used, in Prj.Env.Set_Ada_Paths.
+
+2008-07-31 Arnaud Charlet <charlet@adacore.com>
+
+ * mlib-utl.ads: Fix typo.
+
+2008-07-31 Robert Dewar <dewar@adacore.com>
+
+ * sem_ch12.adb: Minor reformatting
+
+2008-07-31 Sergey Rybin <rybin@adacore.com>
+
+ * gnat_ugn.texi: Change the description of the
+ Overly_Nested_Control_Structures: now the rule always requires a
+ positive parameter for '+R' option
+
+2008-07-31 Thomas Quinot <quinot@adacore.com>
+
+ * g-pehage.adb: Minor reformatting
+
+2008-07-31 Pascal Obry <obry@adacore.com>
+
+ * s-finimp.ads: Minor reformatting.
+
+2008-07-31 Vincent Celier <celier@adacore.com>
+
+ * s-regexp.ads: Minor comment fix
+
+2008-07-31 Arnaud Charlet <charlet@adacore.com>
+
+ * s-direio.adb (Reset): Replace pragma Unmodified by Warnings (Off),
+ so that we can compile this file successfully with -gnatc.
+
+2008-07-31 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * exp_attr.adb (Find_Stream_Subprogram): Check the base type instead
+ of the type when looking for stream subprograms for type String,
+ Wide_String and Wide_Wide_String.
+
+ * s-ststop.adb: Change the initialization expression of constant
+ Use_Block_IO.
+
+2008-07-31 Geert Bosch <bosch@adacore.com>
+
+ * arit64.c:
+ New file implementing __gnat_mulv64 signed integer multiplication with
+ overflow checking
+
+ * fe.h (Backend_Overflow_Checks_On_Target): Define for use by Gigi
+
+ * gcc-interface/gigi.h:
+ (standard_types): Add ADT_mulv64_decl
+ (mulv64_decl): Define subprogram declaration for __gnat_mulv64
+
+ * gcc-interface/utils.c:
+ (init_gigi_decls): Add initialization of mulv64_decl
+
+ * gcc-interface/trans.c:
+ (build_unary_op_trapv): New function
+ (build_binary_op_trapv): New function
+ (gnat_to_gnu): Use the above functions instead of
+ build_{unary,binary}_op
+
+ * gcc-interface/Makefile.in
+ (LIBGNAT_SRCS): Add arit64.c
+ (LIBGNAT_OBJS): Add arit64.o
+
+2008-07-31 Vincent Celier <celier@adacore.com>
+
+ * prj-nmsc.adb (Check_Library_Attributes): Check if Linker'Switches or
+ Linker'Default_Switches are declared. Warn if they are declared.
+
+2008-07-31 Ed Schonberg <schonberg@adacore.com>
+
+ * exp_ch6.adb (Make_Build_In_Place_Call_In_Object_Declaration): Use
+ Insert_Actions to place the pointer declaration in the code, rather
+ than Insert_Before_And_Analyze, so that insertions of temporaries are
+ kept in the proper order when transient scopes are present.
+
+
+2008-07-31 Robert Dewar <dewar@adacore.com>
+
+ * einfo.adb (Spec_PPC): Now defined for generic subprograms
+
+ * einfo.ads (Spec_PPC): Now defined for generic subprograms
+
+ * sem_prag.adb (Check_Precondition_Postcondition): Handle generic
+ subprogram case
+
+2008-07-31 Vincent Celier <celier@adacore.com>
+
+ * s-os_lib.adb: Minor comment fix
+
+2008-07-31 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch6.adb (Analyze_Generic_Subprogram_Body): After analysis,
+ transfer pre/postconditions from generic copy to original tree, so that
+ they will appear in each instance.
+ (Process_PPCs): Do not transform postconditions into a procedure in a
+ generic context, to prevent double expansion of check pragmas.
+
+ * sem_attr.adb: In an instance, the prefix of the 'result attribute
+ can be the renaming of the
+ current instance, so check validity of the name accordingly.
+
+2008-07-31 Robert Dewar <dewar@adacore.com>
+
+ * mlib-utl.ads: Minor reformatting
+
+2008-07-31 Ed Schonberg <schonberg@adacore.com>
+
+ sem_attr.adb: 'Result can have an ambiguous prefix, and is resolved
+ from context. This attribute must be usable in Ada95 mode.
+ The attribute can appear in the body of a function marked
+ Inline_Always, but in this case the postocondition is not enforced.
+
+ sem_prag.adb (Check_Precondition_Postcondition): within the expansion
+ of an inlined call pre- and postconditions are legal
+
+2008-07-31 Vincent Celier <celier@adacore.com>
+
+ * prj.adb, prj.ads, clean.adb, prj-nmsc.adb: Remove declarations that
+ were for gprmake only
+
+2008-07-31 Robert Dewar <dewar@adacore.com>
+
+ * gnat_ugn.texi: Update -gnatN documentation.
+
+ * gnat_rm.texi: Add note about pre/postcondition
+ pragmas not checked in conjunction with front-end inlining.
+
+2008-07-31 Robert Dewar <dewar@adacore.com>
+
+ * g-pehage.adb, g-pehage.ads: Minor reformatting
+
+2008-07-31 Arnaud Charlet <charlet@adacore.com>
+
+ * mlib-utl.ads, prj-makr.ads: Add comments.
+
+2008-07-30 Aaron W. LaFramboise <aaronavay62@aaronwl.com>
+
+ * gcc-interface/Makefile.in (EXTRA_GNATRTL_NONTASKING_OBJS)
+ [WINDOWS]: Add s-winext.o.
+
+2008-07-30 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR ada/36554
+ * back_end.adb (Call_Back_End): Pass Standard_Boolean to gigi.
+ * gcc-interface/gigi.h (gigi): Take new standard_boolean parameter.
+ * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Enumeration_Subtype>:
+ Set precision to 1 for subtype of BOOLEAN_TYPE.
+ (set_rm_size): Set TYPE_RM_SIZE_NUM for BOOLEAN_TYPE.
+ (make_type_from_size): Deal with BOOLEAN_TYPE.
+ * gcc-interface/misc.c (gnat_print_type): Likewise.
+ * gcc-interface/trans.c (gigi): Take new standard_boolean parameter.
+ Set boolean_type_node as its translation in the table, as well
+ as boolean_false_node for False and boolean_true_node for True.
+ * gcc-interface/utils.c (gnat_init_decl_processing): Create custom
+ 8-bit boolean_type_node and set its TYPE_RM_SIZE_NUM.
+ (create_param_decl): Deal with BOOLEAN_TYPE.
+ (build_vms_descriptor): Likewise.
+ (build_vms_descriptor64): Likewise.
+ (convert): Deal with BOOLEAN_TYPE like with ENUMERAL_TYPE.
+
+2008-07-30 Robert Dewar <dewar@adacore.com>
+
+ * exp_ch9.adb: Minor reformatting
+
+ * exp_util.ads (Find_Prim_Op): Document that Program_Error is raised
+ if no primitive operation is found.
+
+ * exp_util.adb: (Find_Prim_Op): Add comments for previous change
+
+ * sem_ch8.adb: Minor reformatting
+
+2008-07-30 Laurent Pautet <pautet@adacore.com>
+
+ * g-pehage.adb:
+ Remove a limitation on the length of the words handled by the minimal
+ perfect hash function generator.
+
+ * g-pehage.ads:
+ Detail the use of subprograms Insert, Initialize, Compute and Finalize.
+ Fix some typos.
+
+2008-07-30 Robert Dewar <dewar@adacore.com>
+
+ * gnatlink.adb: Minor reformatting
+
+2008-07-30 Thomas Quinot <quinot@adacore.com>
+
+ * rtsfind.adb (Check_RPC): Check version consistency even when not
+ generating RCI stubs. Provide more detailed error message in case of
+ mismatch.
+
+2008-07-30 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch8.adb (Analyze_Subprogram_Renaming): When renaming an attribute
+ as a actual in an instance, check for a missing attribute to prevent
+ program_error on an illegal program.
+
+ * exp_util.adb (Find_Prim_Op): Rather than Assert (False), raise program
+ error if primitive is not found, so that exception can be handled
+ elsewhere on illegal programs.
+
+2008-07-30 Robert Dewar <dewar@adacore.com>
+
+ * uintp.adb (UI_GCD): Fix potential overflow
+
+2008-07-30 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * einfo.adb: Flag245 is now used.
+ (Is_Primitive_Wrapper, Set_Is_Primitive_Wrapper): Relax the assertion
+ check to include functions.
+ (Is_Private_Primitive, Set_Is_Private_Primitive): New subprograms.
+ (Wrapped_Entity, Set_Wrapped_Entity): Relax the assertion check to
+ include functions.
+ (Write_Entity_Flags): Move flag Is_Primitive, add Is_Private_Primitive
+ to the list of displayed flags.
+
+ * einfo.ads: Update comment on the usage of Is_Primitive_Wrapper and
+ Wrapped_Entity. These two flags are now present in functions.
+ New flag Is_Private_Primitive.
+ (Is_Private_Primitive, Set_Is_Private_Primitive): New subprograms.
+
+ * exp_ch9.adb:
+ (Build_Wrapper_Bodies): New subprogram.
+ (Build_Wrapper_Body): The spec and body have been moved to in
+ Build_Wrapper_ Bodies. Code cleanup.
+ (Build_Wrapper_Spec): Moved to the spec of Exp_Ch9. Code cleanup.
+ Wrappers are now generated for primitives declared between the private
+ and full view of a concurrent type that implements an interface.
+ (Build_Wrapper_Specs): New subprogram.
+ (Expand_N_Protected_Body): Code reformatting. Replace the wrapper body
+ creation mechanism with a call to Build_Wrapper_Bodies.
+ (Expand_N_Protected_Type_Declaration): Code reformatting. Replace the
+ wrapper spec creation mechanism with a call to Build_Wrapper_Specs.
+ (Expand_N_Task_Body): Replace the wrapper body creation
+ mechanism with a call to Build_Wrapper_Bodies.
+ (Expand_N_Task_Type_Declaration): Replace the wrapper spec
+ creation mechanism with a call to Build_Wrapper_Specs.
+ (Is_Private_Primitive_Subprogram): New subprogram.
+ (Overriding_Possible): Code cleanup.
+ (Replicate_Entry_Formals): Renamed to Replicate_Formals, code cleanup.
+
+ * exp_ch9.ads (Build_Wrapper_Spec): Moved from the body of Exp_Ch9.
+
+ * sem_ch3.adb: Add with and use clause for Exp_Ch9.
+ (Process_Full_View): Build wrapper specs for all primitives
+ that belong to a private view completed by a concurrent type
+ implementing an interface.
+
+ * sem_ch6.adb (Analyze_Subprogram_Body): When the current subprogram
+ is a primitive of a
+ concurrent type with a private view that implements an interface, try to
+ find the proper spec.
+ (Analyze_Subprogram_Declaration): Mark a subprogram as a private
+ primitive if the type of its first parameter is a non-generic tagged
+ private type.
+ (Analyze_Subprogram_Specification): Code reformatting.
+ (Disambiguate_Spec): New routine.
+ (Find_Corresponding_Spec): Add a flag to controll the output of errors.
+ (Is_Private_Concurrent_Primitive): New routine.
+
+ * sem_ch6.ads:
+ (Find_Corresponding_Spec): Add a formal to control the output of errors.
+
+2008-07-30 Doug Rupp <rupp@adacore.com>
+
+ * gigi.h (build_vms_descriptor64): New function prototype.
+ (fill_vms_descriptor): Modified function prototype.
+
+ * utils.c (build_vms_descriptor64): New function.
+
+ * utils2.c (fill_vms_descriptor): Fix handling on 32bit systems.
+
+ * trans.c (call_to_gnu): Call fill_vms_descriptor with new third
+ argument.
+
+ * decl.c (gnat_to_gnu_tree): For By_Descriptor mech, build both a
+ 64bit and 32bit descriptor and save the 64bit version as an alternate
+ TREE_TYPE in the parameter.
+ (make_type_from_size) <RECORD_TYPE>: Use the appropriate mode for the
+ thin pointer.
+
+ * ada-tree.h (DECL_PARM_ALT, SET_DECL_PARM_ALT): New macros.
+
+2008-07-30 Robert Dewar <dewar@adacore.com>
+
+ * make.adb: Minor reformatting
+
+ * mlib-utl.adb: Minor reformatting
+
+ * osint.ads: Minor reformatting
+
+2008-07-30 Jose Ruiz <ruiz@adacore.com>
+
+ * adaint.c
+ (__gnat_file_exists): Do not use __gnat_stat for RTX.
+ (__main for RTX in RTSS mode): Create this dummy procedure symbol to
+ avoid the use of this symbol from libgcc.a in RTX kernel mode.
+
+ * cio.c
+ (put_int, put_int_stderr, put_char, put_char_stderr): For RTX we call
+ the function RtPrintf for console output.
+
+ * argv.c Do not use the environ variable for RTX.
+
+ * gnatlink.adb (gnatlink): The part that handles the --RTS option has
+ been moved before the call to Osint.Add_Default_Search_Dirs in order
+ to take into account the flags in system.ads (RTX_RTSS_Kernel_Module)
+ from the appropriate run time.
+
+ * targparm.ads
+ (RTX_RTSS_Kernel_Module_On_Target): Add this flag that is set to True if
+ target is a RTSS module for RTX.
+
+ * targparm.adb (Targparm_Tags, RTX_Str, Targparm_Str): Add tag RTX for
+ RTX_RTSS_Kernel_Module
+ (Get_Target_Parameters): Add processing of RTX_RTSS_Kernel_Module flag.
+
+ * gcc-interface/Makefile.in (LIBGNAT_TARGET_PAIRS for RTX): Use gcc
+ exception handling mechanism for Windows and RTX in Win32 mode, but
+ not for RTX in kernel mode (RTSS).
+ (LIBGNAT_SRCS): Remove ada.h
+
+2008-07-30 Paolo Bonzini <bonzini@gnu.org>
+
+ * gcc-interface/Make-lang.in (ALL_ADAFLAGS): Remove X_ADAFLAGS and
+ T_ADAFLAGS, replace ALL_ADA_CFLAGS with ADA_CFLAGS.
+ (ALL_ADA_CFLAGS): Remove, replace throughout with ADA_CFLAGS.
+ * gcc-interface/Makefile.in (XCFLAGS, X_CFLAGS, X_CPPFLAGS, T_CPPFLAGS,
+ X_ADA_CFLAGS, T_ADA_CFLAGS, X_ADAFLAGS, T_ADAFLAGS, ADA_CFLAGS,
+ ALL_ADA_CFLAGS): Remove.
+ (ALL_ADAFLAGS, MOST_ADAFLAGS): Remove X_ADAFLAGS and T_ADAFLAGS,
+ replace ALL_ADA_CFLAGS with ADA_CFLAGS.
+ (GCC_CFLAGS): Remove X_CFLAGS.
+ (LOOSE_CFLAGS): Remove X_CFLAGS and XCFLAGS.
+ (ALL_CPPFLAGS): Remove X_CPPFLAGS and T_CPPFLAGS.
+ (ADA_CFLAGS): Substitute.
+
+2008-07-30 Laurent Guerby <laurent@guerby.net>
+
+ PR ada/5911
+ * gcc-interface/Makefile.in (MULTISUBDIR, RTSDIR): New variables.
+ Pass MULTISUBDIR to recursive make. Use $(RTSDIR) instead of rts.
+ Replace stamp-gnatlib* by stamp-gnatlib*-rts.
+ * gcc-interface/Make-lang.in: Replace stamp-gnatlib2
+ by stamp-gnatlib2-rts.
+
+2008-07-30 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ PR documentation/15479
+ * gnat-style.texi: Remove AdaCore copyright statement and GPL
+ statement for GNAT. Add @copying stanza, use it. Update to
+ GFDL 1.2. Do not list GFDL as Invariant Section, do not list
+ title as Front-Cover Text.
+ * gnat_rm.texi: Likewise.
+ * gnat_ugn.texi: Likewise.
+
+2008-07-29 Jan Hubicka <jh@suse.cz>
+
+ * trans.c (process_inlined_subprograms): Remove tree_really_inline
+ check.
+
+2008-07-29 Arnaud Charlet <charlet@adacore.com>
+
+ * gcc-interface: New directory.
+
+ * ada-tree.def, cuintp.c, gigi.h, Makefile.in, targtyps.c, ada.h,
+ utils.c, ada-tree.h, decl.c, lang.opt, Make-lang.in, trans.c,
+ config-lang.in, deftarg.c, lang-specs.h, misc.c, utils2.c: Moved
+ to gcc-interface subdirectory.
+
+2008-07-29 Aaron W. LaFramboise <aaronavay62@aaronwl.com>
+
+ * Makefile.in (EXTRA_GNATRTL_NONTASKING_OBJS): Remove extra s-win32.o.
+
+2008-07-28 Jan Hubicka <jh@suse.cz>
+
+ * misc.c (gnat_post_options): Do not set flag_no_inline.
+
+2008-07-28 Richard Guenther <rguenther@suse.de>
+
+ Merge from gimple-tuples-branch.
+
+ 2008-07-22 Olivier Hainque <hainque@adacore.com>
+
+ * gigi.h (end_subprog_body): New ELAB_P argument, saying if
+ this is called for an elab proc to be discarded if empty.
+ * utils.c (end_subprog_body): Honor ELAB_P.
+ (build_function_stub): Adjust call to end_subprog_body.
+ * trans.c (Subprogram_Body_to_gnu): Likewise.
+ (gigi): Reorganize processing of elab procs to prevent
+ gimplifying twice, using the new end_subprog_body argument.
+
+ 2008-07-19 Richard Guenther <rguenther@suse.de>
+
+ * Make-lang.in (trans.o): Add tree-iterator.h dependency.
+ (utils.o): Likewise.
+ * trans.c: Include tree-iterator.h.
+ (gnat_gimplify_expr): Adjust prototype. Fix typo.
+ (gnat_gimplify_stmt): Use SET_EXPR_LOCATION.
+ (set_expr_location_from_node): Likewise.
+ (gigi): Tuplify.
+ * ada-tree.h (union lang_tree_node): Use TREE_CHAIN instead
+ of GENERIC_NEXT.
+ * utils.c: Include tree-iterator.h.
+ * gigi.h (gnat_gimplify_expr): Adjust prototype.
+
+ 2008-07-18 Aldy Hernandez <aldyh@redhat.com>
+
+ * trans.c: Include gimple.h instead of tree-gimple.h.
+ * utils.c: Same.
+
+ 2008-07-14 Aldy Hernandez <aldyh@redhat.com>
+
+ * trans.c (gnat_gimplify_expr): Use gimplify_assign.
+
+2008-07-25 Jan Hubicka <jh@suse.cz>
+
+ * utils.c (end_subprog_body): Remove inline trees check.
+ * misc.c (gnat_post_options): Do not set flag_inline_trees.
+
+2008-07-25 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
+
+ * raise-gcc.c: Move tsystem.h before tm.h.
+
+2008-07-20 Arnaud Charlet <charlet@adacore.com>
+
+ * gnathtml.pl: New file.
+
+2008-07-19 Olivier Hainque <hainque@adacore.com>
+
+ * targtyps.c (get_target_default_allocator_alignment): Use
+ MALLOC_ABI_ALIGNMENT.
+
+2008-07-17 Olivier Hainque <hainque@adacore.com>
+
+ * adaint.c (__MINGW32__ section): Include ctype.h and define
+ a fallback ISALPHA if IN_RTS.
+ (__gnat_is_absolute_path): Use ISALPHA instead of isalpha.
+
+2008-07-17 Olivier Hainque <hainque@adacore.com>
+
+ * utils.c (create_var_decl_1): Relax expectations on the PUBLIC_FLAG
+ argument, to apply to references in addition to definitions. Prevent
+ setting TREE_STATIC on externals.
+ (gnat_pushdecl): Always clear DECL_CONTEXT on public externals.
+
2008-07-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
PR documentation/15479
@@ -16662,7 +18506,7 @@ PR ada/10768
* utils.c (create_var_decl): Use have_global_bss_p when deciding
whether to make the decl common.
-2006-02-20 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
+2006-02-20 Rafael �vila de Esp�ndola <rafael.espindola@gmail.com>
* Make-lang.in (Ada): Remove.
(.PHONY): Remove Ada
@@ -19120,11 +20964,11 @@ PR ada/10768
* s-bitops.adb: Clarify comment for Bits_Array
-2005-12-07 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
+2005-12-07 Rafael �vila de Esp�ndola <rafael.espindola@gmail.com>
* Make-lang.in (ada.install-normal): Remove.
-2005-12-07 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
+2005-12-07 Rafael �vila de Esp�ndola <rafael.espindola@gmail.com>
* Make-lang.in: Remove all dependencies on s-gtype.
diff --git a/gcc/ada/Makefile.in b/gcc/ada/Makefile.in
index b3b4d080ef0..9f223c4195c 100644
--- a/gcc/ada/Makefile.in
+++ b/gcc/ada/Makefile.in
@@ -1,2296 +1,3 @@
-# Makefile for GNU Ada Compiler (GNAT).
-# Copyright (C) 1994-2008 Free Software Foundation, Inc.
-
-#This file is part of GCC.
-
-#GCC is free software; you can redistribute it and/or modify
-#it under the terms of the GNU General Public License as published by
-#the Free Software Foundation; either version 3, or (at your option)
-#any later version.
-
-#GCC is distributed in the hope that it will be useful,
-#but WITHOUT ANY WARRANTY; without even the implied warranty of
-#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-#GNU General Public License for more details.
-
-#You should have received a copy of the GNU General Public License
-#along with GCC; see the file COPYING3. If not see
-#<http://www.gnu.org/licenses/>.
-
-# The makefile built from this file lives in the language subdirectory.
-# Its purpose is to provide support for:
-#
-# 1) recursion where necessary, and only then (building .o's), and
-# 2) building and debugging cc1 from the language subdirectory, and
-# 3) nothing else.
-#
-# The parent makefile handles all other chores, with help from the
-# language makefile fragment, of course.
-#
-# The targets for external use are:
-# all, TAGS, ???mostlyclean, ???clean.
-
-# This makefile will only work with Gnu make.
-# The rules are written assuming a minimum subset of tools are available:
-#
-# Required:
-# MAKE: Only Gnu make will work.
-# MV: Must accept (at least) one, maybe wildcard, source argument,
-# a file or directory destination, and support creation/
-# modification date preservation. Gnu mv -f works.
-# RM: Must accept an arbitrary number of space separated file
-# arguments, or one wildcard argument. Gnu rm works.
-# RMDIR: Must delete a directory and all its contents. Gnu rm -rf works.
-# ECHO: Must support command line redirection. Any Unix-like
-# shell will typically provide this, otherwise a custom version
-# is trivial to write.
-# AR: Gnu ar works.
-# MKDIR: Gnu mkdir works.
-# CHMOD: Gnu chmod works.
-# true: Does nothing and returns a normal successful return code.
-# pwd: Prints the current directory on stdout.
-# cd: Change directory.
-#
-# Optional:
-# BISON: Gnu bison works.
-# FLEX: Gnu flex works.
-# Other miscellaneous tools for obscure targets.
-
-# Suppress smart makes who think they know how to automake Yacc files
-.y.c:
-
-# Variables that exist for you to override.
-# See below for how to change them for certain systems.
-
-# Various ways of specifying flags for compilations:
-# CFLAGS is for the user to override to, e.g., do a bootstrap with -O2.
-# BOOT_CFLAGS is the value of CFLAGS to pass
-# to the stage2 and stage3 compilations
-# XCFLAGS is used for most compilations but not when using the GCC just built.
-XCFLAGS =
-CFLAGS = -g
-BOOT_CFLAGS = -O $(CFLAGS)
-# These exists to be overridden by the x-* and t-* files, respectively.
-X_CFLAGS =
-T_CFLAGS =
-
-X_CPPFLAGS =
-T_CPPFLAGS =
-
-X_ADA_CFLAGS =
-T_ADA_CFLAGS =
-
-X_ADAFLAGS =
-T_ADAFLAGS =
-
-CC = cc
-BISON = bison
-BISONFLAGS =
-ECHO = echo
-LEX = flex
-LEXFLAGS =
-CHMOD = chmod
-LN = ln
-LN_S = ln -s
-CP = cp -p
-MV = mv -f
-RM = rm -f
-RMDIR = rm -rf
-MKDIR = mkdir -p
-AR = ar
-AR_FLAGS = rc
-LS = ls
-RANLIB = @RANLIB@
-RANLIB_FLAGS = @ranlib_flags@
-
-SHELL = @SHELL@
-PWD_COMMAND = $${PWDCMD-pwd}
-# How to copy preserving the date
-INSTALL_DATA_DATE = cp -p
-MAKEINFO = makeinfo
-TEXI2DVI = texi2dvi
-TEXI2PDF = texi2pdf
-GNATBIND_FLAGS = -static -x
-ADA_CFLAGS =
-ADAFLAGS = -W -Wall -gnatpg -gnata
-SOME_ADAFLAGS =-gnata
-FORCE_DEBUG_ADAFLAGS = -g
-GNATLIBFLAGS = -gnatpg -nostdinc
-GNATLIBCFLAGS = -g -O2
-GNATLIBCFLAGS_FOR_C = $(GNATLIBCFLAGS) $(TARGET_LIBGCC2_CFLAGS) -fexceptions \
- -DIN_RTS
-ALL_ADA_CFLAGS = $(X_ADA_CFLAGS) $(T_ADA_CFLAGS) $(ADA_CFLAGS)
-ALL_ADAFLAGS = $(CFLAGS) $(ALL_ADA_CFLAGS) $(X_ADAFLAGS) $(T_ADAFLAGS) \
- $(ADAFLAGS)
-MOST_ADAFLAGS = $(CFLAGS) $(ALL_ADA_CFLAGS) $(X_ADAFLAGS) $(T_ADAFLAGS) \
- $(SOME_ADAFLAGS)
-THREAD_KIND = native
-THREADSLIB =
-GMEM_LIB =
-MISCLIB =
-SYMDEPS = $(LIBINTL_DEP)
-OUTPUT_OPTION = @OUTPUT_OPTION@
-
-objext = .o
-exeext =
-arext = .a
-soext = .so
-shext =
-hyphen = -
-
-# Define this as & to perform parallel make on a Sequent.
-# Note that this has some bugs, and it seems currently necessary
-# to compile all the gen* files first by hand to avoid erroneous results.
-P =
-
-# This is used instead of ALL_CFLAGS when compiling with GCC_FOR_TARGET.
-# It omits XCFLAGS, and specifies -B./.
-# It also specifies -B$(tooldir)/ to find as and ld for a cross compiler.
-GCC_CFLAGS = $(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(CFLAGS)
-
-# Tools to use when building a cross-compiler.
-# These are used because `configure' appends `cross-make'
-# to the makefile when making a cross-compiler.
-
-# We don't use cross-make. Instead we use the tools from the build tree,
-# if they are available.
-# program_transform_name and objdir are set by configure.in.
-program_transform_name =
-objdir = .
-
-target_alias=@target_alias@
-target=@target@
-xmake_file = @xmake_file@
-tmake_file = @tmake_file@
-host_canonical=@host@
-#version=`sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/' < $(srcdir)/version.c`
-#mainversion=`sed -e 's/.*\"\([0-9]*\.[0-9]*\).*/\1/' < $(srcdir)/version.c`
-
-# Directory where sources are, from where we are.
srcdir = @srcdir@
-VPATH = $(srcdir)
-
-fsrcdir := $(shell cd $(srcdir);${PWD_COMMAND})
-fsrcpfx := $(shell cd $(srcdir);${PWD_COMMAND})/
-fcurdir := $(shell ${PWD_COMMAND})
-fcurpfx := $(shell ${PWD_COMMAND})/
-
-# Top build directory, relative to here.
-top_builddir = ../..
-
-# Internationalization library.
-LIBINTL = @LIBINTL@
-LIBINTL_DEP = @LIBINTL_DEP@
-
-# Any system libraries needed just for GNAT.
-SYSLIBS = @GNAT_LIBEXC@
-
-# List of extra object files linked in with various programs.
-EXTRA_GNATTOOLS_OBJS = ../../prefix.o ../../version.o
-
-# List of target dependent sources, overridden below as necessary
-TARGET_ADA_SRCS =
-
-# Type of tools build we are doing; default is not compiling tools.
-TOOLSCASE =
-
-# End of variables for you to override.
-
-all: all.indirect
-
-# This tells GNU Make version 3 not to put all variables in the environment.
-.NOEXPORT:
-
-# tmake_file and xmake_file expand to lists with entries of the form
-# $(srcdir)/config/... but here $(srcdir) is the ada subdirectory so we
-# need to adjust the paths. There can't be spaces in the subst arguments
-# or we get spurious spaces in the actual list of files to include.
-
-# target overrides
-ifneq ($(tmake_file),)
-include $(subst /config,/../config,$(tmake_file))
-endif
-
-# host overrides
-ifneq ($(xmake_file),)
-include $(subst /config,/../config,$(xmake_file))
-endif
-
-# Now figure out from those variables how to compile and link.
-
-all.indirect: Makefile ../gnat1$(exeext)
-
-# IN_GCC distinguishes between code compiled into GCC itself and other
-# programs built during a bootstrap.
-# autoconf inserts -DCROSS_DIRECTORY_STRUCTURE if we are building a cross
-# compiler which does not use the native libraries and headers.
-INTERNAL_CFLAGS = @CROSS@ -DIN_GCC
-
-# This is the variable actually used when we compile.
-LOOSE_CFLAGS = `echo $(CFLAGS) $(WARN2_CFLAGS)|sed -e 's/-pedantic//g' -e 's/-Wtraditional//g'`
-ALL_CFLAGS = $(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(LOOSE_CFLAGS) \
- $(XCFLAGS)
-
-# Likewise.
-ALL_CPPFLAGS = $(CPPFLAGS) $(X_CPPFLAGS) $(T_CPPFLAGS)
-
-# This is where we get libiberty.a from.
-LIBIBERTY = ../../libiberty/libiberty.a
-
-# How to link with both our special library facilities
-# and the system's installed libraries.
-LIBS = $(LIBINTL) $(LIBIBERTY) $(SYSLIBS)
-LIBDEPS = $(LIBINTL_DEP) $(LIBIBERTY)
-# Default is no TGT_LIB; one might be passed down or something
-TGT_LIB =
-TOOLS_LIBS = $(EXTRA_GNATTOOLS_OBJS) targext.o link.o $(LIBGNAT) ../../../libiberty/libiberty.a $(SYSLIBS) $(TGT_LIB)
-
-# Specify the directories to be searched for header files.
-# Both . and srcdir are used, in that order,
-# so that tm.h and config.h will be found in the compilation
-# subdirectory rather than in the source directory.
-INCLUDES = -I- -I. -I.. -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../config \
- -I$(srcdir)/../../include
-
-ADA_INCLUDES = -I- -I. -I$(srcdir)
-
-INCLUDES_FOR_SUBDIR = -I. -I.. -I../.. -I$(fsrcdir) -I$(fsrcdir)/../config \
- -I$(fsrcdir)/../../include -I$(fsrcdir)/..
-ADA_INCLUDES_FOR_SUBDIR = -I. -I$(fsrcdir)
-
-# Avoid a lot of time thinking about remaking Makefile.in and *.def.
-.SUFFIXES: .in .def
-
-# Say how to compile Ada programs.
-.SUFFIXES: .ada .adb .ads .asm
-
-# Always use -I$(srcdir)/config when compiling.
-.asm.o:
- $(CC) -c -x assembler $< $(OUTPUT_OPTION)
-
-.c.o:
- $(CC) -c $(ALL_CFLAGS) $(ADA_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< \
- $(OUTPUT_OPTION)
-
-.adb.o:
- $(CC) -c $(ALL_ADAFLAGS) $(ADA_INCLUDES) $< $(OUTPUT_OPTION)
-
-.ads.o:
- $(CC) -c $(ALL_ADAFLAGS) $(ADA_INCLUDES) $< $(OUTPUT_OPTION)
-
-# how to regenerate this file
-Makefile: ../config.status $(srcdir)/Makefile.in $(srcdir)/../version.c
- cd ..; \
- LANGUAGES="$(CONFIG_LANGUAGES)" \
- CONFIG_HEADERS= \
- CONFIG_FILES=ada/Makefile $(SHELL) config.status
-
-# This tells GNU make version 3 not to export all the variables
-# defined in this file into the environment.
-.NOEXPORT:
-
-# Lists of files for various purposes.
-
-GNATLINK_OBJS = gnatlink.o \
- a-except.o ali.o alloc.o butil.o casing.o csets.o debug.o fmap.o fname.o \
- gnatvsn.o hostparm.o indepsw.o interfac.o i-c.o i-cstrin.o namet.o opt.o \
- osint.o output.o rident.o s-exctab.o s-secsta.o s-stalib.o s-stoele.o \
- sdefault.o snames.o stylesw.o switch.o system.o table.o targparm.o tree_io.o \
- types.o validsw.o widechar.o
-
-GNATMAKE_OBJS = a-except.o ali.o ali-util.o s-casuti.o \
- alloc.o atree.o binderr.o butil.o casing.o csets.o debug.o elists.o einfo.o\
- erroutc.o errutil.o err_vars.o fmap.o fname.o fname-uf.o fname-sf.o \
- gnatmake.o gnatvsn.o hostparm.o interfac.o i-c.o i-cstrin.o krunch.o lib.o \
- make.o makeusg.o makeutl.o mlib.o mlib-fil.o mlib-prj.o mlib-tgt.o \
- mlib-tgt-specific.o mlib-utl.o namet.o nlists.o opt.o osint.o osint-m.o output.o \
- prj.o prj-attr.o prj-attr-pm.o prj-com.o prj-dect.o prj-env.o prj-err.o prj-ext.o prj-nmsc.o \
- prj-pars.o prj-part.o prj-proc.o prj-strt.o prj-tree.o prj-util.o \
- rident.o s-exctab.o s-secsta.o s-stalib.o s-stoele.o \
- scans.o scng.o sdefault.o sfn_scan.o s-purexc.o s-htable.o \
- sinfo.o sinput.o sinput-c.o sinput-p.o \
- snames.o stand.o stringt.o styleg.o stylesw.o system.o validsw.o switch.o switch-m.o \
- table.o targparm.o tempdir.o tree_io.o types.o \
- uintp.o uname.o urealp.o usage.o widechar.o \
- $(EXTRA_GNATMAKE_OBJS)
-
-# Convert the target variable into a space separated list of architecture,
-# manufacturer, and operating system and assign each of those to its own
-# variable.
-
-host:=$(subst -, ,$(host_canonical))
-targ:=$(subst -, ,$(target))
-arch:=$(word 1,$(targ))
-ifeq ($(words $(targ)),2)
- manu:=
- osys:=$(word 2,$(targ))
-else
- manu:=$(word 2,$(targ))
- osys:=$(word 3,$(targ))
-endif
-
-# LIBGNAT_TARGET_PAIRS is a list of pairs of filenames.
-# The members of each pair must be separated by a '<' and no whitespace.
-# Each pair must be separated by some amount of whitespace from the following
-# pair.
-
-# Non-tasking case:
-
-LIBGNAT_TARGET_PAIRS = \
-a-intnam.ads<a-intnam-dummy.ads \
-s-inmaop.adb<s-inmaop-dummy.adb \
-s-intman.adb<s-intman-dummy.adb \
-s-osinte.ads<s-osinte-dummy.ads \
-s-osprim.adb<s-osprim-posix.adb \
-s-taprop.adb<s-taprop-dummy.adb \
-s-taspri.ads<s-taspri-dummy.ads
-
-# When using the GCC exception handling mechanism, we need to use an
-# alternate body for a-exexpr.adb (a-exexpr-gcc.adb)
-
-EH_MECHANISM=
-
-# Default shared object option. Note that we rely on the fact that the "soname"
-# option will always be present and last in this flag, so that we can have
-# $(SO_OPTS)libgnat-x.xx
-
-SO_OPTS = -Wl,-soname,
-
-# Default gnatlib-shared target.
-# By default, equivalent to gnatlib.
-# Set to gnatlib-shared-default, gnatlib-shared-dual, or a platform specific
-# target when supported.
-GNATLIB_SHARED = gnatlib
-
-# default value for gnatmake's target dependent file
-MLIB_TGT = mlib-tgt
-
-# By default, do not distribute prefix.o (in libgccprefix), since it is only
-# needed by external GNAT tools such as gnatdist and Glide.
-# Override this variable on native platforms when needed.
-PREFIX_OBJS =
-
-# To avoid duplicate code, use this variable to set PREFIX_OBJS when needed:
-PREFIX_REAL_OBJS = ../prefix.o \
- ../../libiberty/concat.o \
- ../../libiberty/xmalloc.o \
- ../../libiberty/xstrdup.o \
- ../../libiberty/xexit.o
-
-LIB_VERSION = $(strip $(shell grep ' Library_Version :' $(fsrcpfx)gnatvsn.ads | sed -e 's/.*"\(.*\)".*/\1/'))
-
-# $(filter-out PATTERN...,TEXT) removes all PATTERN words from TEXT.
-# $(strip STRING) removes leading and trailing spaces from STRING.
-# If what's left is null then it's a match.
-
-ifeq ($(strip $(filter-out m68k% wrs vx%,$(targ))),)
- LIBGNAT_TARGET_PAIRS = \
- a-intnam.ads<a-intnam-vxworks.ads \
- a-numaux.ads<a-numaux-vxworks.ads \
- s-inmaop.adb<s-inmaop-posix.adb \
- s-interr.adb<s-interr-vxworks.adb \
- s-intman.ads<s-intman-vxworks.ads \
- s-intman.adb<s-intman-vxworks.adb \
- s-osinte.adb<s-osinte-vxworks.adb \
- s-osinte.ads<s-osinte-vxworks.ads \
- s-osprim.adb<s-osprim-vxworks.adb \
- s-parame.ads<s-parame-vxworks.ads \
- s-parame.adb<s-parame-vxworks.adb \
- s-stchop.ads<s-stchop-limit.ads \
- s-stchop.adb<s-stchop-vxworks.adb \
- s-taprop.adb<s-taprop-vxworks.adb \
- s-taspri.ads<s-taspri-vxworks.ads \
- s-tpopsp.adb<s-tpopsp-vxworks.adb \
- s-vxwork.ads<s-vxwork-m68k.ads \
- g-soccon.ads<g-soccon-vxworks.ads \
- g-socthi.ads<g-socthi-vxworks.ads \
- g-socthi.adb<g-socthi-vxworks.adb \
- g-stsifd.adb<g-stsifd-sockets.adb \
- g-sttsne.adb<g-sttsne-vxworks.adb \
- g-sttsne.ads<g-sttsne-locking.ads \
- system.ads<system-vxworks-m68k.ads
-
- TOOLS_TARGET_PAIRS=mlib-tgt-specific.adb<mlib-tgt-specific-vxworks.adb
-
- EXTRA_GNATRTL_NONTASKING_OBJS=i-vxwork.o i-vxwoio.o
- EXTRA_GNATRTL_TASKING_OBJS=s-vxwork.o
-
- EXTRA_LIBGNAT_SRCS+=vx_stack_info.c
- EXTRA_LIBGNAT_OBJS+=vx_stack_info.o
-
- ifeq ($(strip $(filter-out yes,$(TRACE))),)
- LIBGNAT_TARGET_PAIRS += \
- s-traces.adb<s-traces-default.adb \
- s-tratas.adb<s-tratas-default.adb \
- s-trafor.adb<s-trafor-default.adb \
- s-trafor.ads<s-trafor-default.ads \
- s-tfsetr.adb<s-tfsetr-vxworks.adb
- endif
-endif
-
-ifeq ($(strip $(filter-out powerpc% wrs vxworks,$(targ))),)
- LIBGNAT_TARGET_PAIRS = \
- a-intnam.ads<a-intnam-vxworks.ads \
- a-numaux.ads<a-numaux-vxworks.ads \
- s-inmaop.adb<s-inmaop-posix.adb \
- s-intman.ads<s-intman-vxworks.ads \
- s-intman.adb<s-intman-vxworks.adb \
- s-osprim.adb<s-osprim-vxworks.adb \
- s-parame.ads<s-parame-vxworks.ads \
- s-parame.adb<s-parame-vxworks.adb \
- s-stchop.ads<s-stchop-limit.ads \
- s-stchop.adb<s-stchop-vxworks.adb \
- s-taprop.adb<s-taprop-vxworks.adb \
- s-taspri.ads<s-taspri-vxworks.ads \
- s-vxwork.ads<s-vxwork-ppc.ads \
- g-soccon.ads<g-soccon-vxworks.ads \
- g-socthi.ads<g-socthi-vxworks.ads \
- g-socthi.adb<g-socthi-vxworks.adb \
- g-stsifd.adb<g-stsifd-sockets.adb \
- g-sttsne.adb<g-sttsne-vxworks.adb \
- g-sttsne.ads<g-sttsne-locking.ads
-
- TOOLS_TARGET_PAIRS=mlib-tgt-specific.adb<mlib-tgt-specific-vxworks.adb
-
- ifeq ($(strip $(filter-out yes,$(TRACE))),)
- LIBGNAT_TARGET_PAIRS += \
- s-traces.adb<s-traces-default.adb \
- s-trafor.adb<s-trafor-default.adb \
- s-trafor.ads<s-trafor-default.ads \
- s-tratas.adb<s-tratas-default.adb \
- s-tfsetr.adb<s-tfsetr-vxworks.adb
- endif
-
- ifeq ($(strip $(filter-out rtp,$(THREAD_KIND))),)
- LIBGNAT_TARGET_PAIRS += \
- s-osinte.adb<s-osinte-vxworks-rtp.adb \
- s-osinte.ads<s-osinte-vxworks6.ads \
- s-tpopsp.adb<s-tpopsp-vxworks-rtp.adb \
- system.ads<system-vxworks-ppc-rtp.ads
-
- EXTRA_GNATRTL_NONTASKING_OBJS=s-vxwexc.o
- else
- LIBGNAT_TARGET_PAIRS += \
- s-interr.adb<s-interr-vxworks.adb \
- s-tpopsp.adb<s-tpopsp-vxworks.adb \
- system.ads<system-vxworks-ppc.ads
-
- ifeq ($(strip $(filter-out kernel,$(THREAD_KIND))),)
- LIBGNAT_TARGET_PAIRS += \
- s-osinte.ads<s-osinte-vxworks6.ads \
- s-osinte.adb<s-osinte-vxworks-kernel.adb
- else
- LIBGNAT_TARGET_PAIRS += \
- s-osinte.ads<s-osinte-vxworks.ads \
- s-osinte.adb<s-osinte-vxworks.adb
- endif
-
- EXTRA_GNATRTL_NONTASKING_OBJS=i-vxwork.o i-vxwoio.o s-vxwexc.o
- endif
-
- EXTRA_GNATRTL_TASKING_OBJS=s-vxwork.o
-
- EXTRA_LIBGNAT_SRCS+=vx_stack_info.c
- EXTRA_LIBGNAT_OBJS+=vx_stack_info.o
-endif
-
-# vxworksae / vxworks 653
-ifeq ($(strip $(filter-out powerpc% wrs vxworksae,$(targ))),)
- # target pairs for kernel + vthreads runtime
- LIBGNAT_TARGET_PAIRS = \
- a-elchha.adb<a-elchha-vxworks-ppc-full.adb \
- a-intnam.ads<a-intnam-vxworks.ads \
- a-numaux.ads<a-numaux-vxworks.ads \
- g-io.adb<g-io-vxworks-ppc-cert.adb \
- g-io.ads<g-io-vxworks-ppc-cert.ads \
- s-inmaop.adb<s-inmaop-posix.adb \
- s-interr.adb<s-interr-vxworks.adb \
- s-intman.ads<s-intman-vxworks.ads \
- s-intman.adb<s-intman-vxworks.adb \
- s-osinte.adb<s-osinte-vxworks.adb \
- s-osinte.ads<s-osinte-vxworks.ads \
- s-osprim.adb<s-osprim-vxworks.adb \
- s-parame.ads<s-parame-ae653.ads \
- s-parame.adb<s-parame-vxworks.adb \
- s-taprop.adb<s-taprop-vxworks.adb \
- s-taspri.ads<s-taspri-vxworks.ads \
- s-tpopsp.adb<s-tpopsp-vxworks.adb \
- s-vxwork.ads<s-vxwork-ppc.ads \
- g-soccon.ads<g-soccon-vxworks.ads \
- g-socthi.ads<g-socthi-vxworks.ads \
- g-socthi.adb<g-socthi-vxworks.adb \
- g-stsifd.adb<g-stsifd-sockets.adb \
- g-sttsne.adb<g-sttsne-vxworks.adb \
- g-sttsne.ads<g-sttsne-locking.ads \
- system.ads<system-vxworks-ppc-vthread.ads
-
- TOOLS_TARGET_PAIRS=mlib-tgt-specific.adb<mlib-tgt-specific-vxworks.adb
-
- EXTRA_GNATRTL_NONTASKING_OBJS=i-vxwork.o i-vxwoio.o s-vxwexc.o
- EXTRA_GNATRTL_TASKING_OBJS=s-vxwork.o
-
- # Extra pairs for the vthreads runtime
- ifeq ($(strip $(filter-out vthreads,$(THREAD_KIND))),)
- LIBGNAT_TARGET_PAIRS += \
- s-thread.adb<s-thread-ae653.adb
- EXTRA_GNATRTL_NONTASKING_OBJS += s-thread.o
- endif
-
- ifeq ($(strip $(filter-out yes,$(TRACE))),)
- LIBGNAT_TARGET_PAIRS += \
- s-traces.adb<s-traces-default.adb \
- s-trafor.adb<s-trafor-default.adb \
- s-trafor.ads<s-trafor-default.ads \
- s-tratas.adb<s-tratas-default.adb \
- s-tfsetr.adb<s-tfsetr-vxworks.adb
- endif
-endif
-
-ifeq ($(strip $(filter-out sparc% wrs vx%,$(targ))),)
- LIBGNAT_TARGET_PAIRS = \
- a-intnam.ads<a-intnam-vxworks.ads \
- a-numaux.ads<a-numaux-vxworks.ads \
- s-inmaop.adb<s-inmaop-posix.adb \
- s-interr.adb<s-interr-vxworks.adb \
- s-intman.ads<s-intman-vxworks.ads \
- s-intman.adb<s-intman-vxworks.adb \
- s-osinte.adb<s-osinte-vxworks.adb \
- s-osinte.ads<s-osinte-vxworks.ads \
- s-osprim.adb<s-osprim-vxworks.adb \
- s-parame.ads<s-parame-vxworks.ads \
- s-parame.adb<s-parame-vxworks.adb \
- s-stchop.ads<s-stchop-limit.ads \
- s-stchop.adb<s-stchop-vxworks.adb \
- s-taprop.adb<s-taprop-vxworks.adb \
- s-taspri.ads<s-taspri-vxworks.ads \
- s-tpopsp.adb<s-tpopsp-vxworks.adb \
- s-vxwork.ads<s-vxwork-sparcv9.ads \
- g-soccon.ads<g-soccon-vxworks.ads \
- g-socthi.ads<g-socthi-vxworks.ads \
- g-socthi.adb<g-socthi-vxworks.adb \
- g-stsifd.adb<g-stsifd-sockets.adb \
- g-sttsne.adb<g-sttsne-vxworks.adb \
- g-sttsne.ads<g-sttsne-locking.ads \
- system.ads<system-vxworks-sparcv9.ads \
-
- TOOLS_TARGET_PAIRS=mlib-tgt-specific.adb<mlib-tgt-specific-vxworks.adb
-
- EXTRA_GNATRTL_NONTASKING_OBJS=i-vxwork.o i-vxwoio.o
- EXTRA_GNATRTL_TASKING_OBJS=s-vxwork.o
-
- EXTRA_LIBGNAT_SRCS+=vx_stack_info.c
- EXTRA_LIBGNAT_OBJS+=vx_stack_info.o
-endif
-
-ifeq ($(strip $(filter-out %86 wrs vxworks,$(targ))),)
- LIBGNAT_TARGET_PAIRS = \
- a-intnam.ads<a-intnam-vxworks.ads \
- i-vxwork.ads<i-vxwork-x86.ads \
- s-inmaop.adb<s-inmaop-posix.adb \
- s-intman.ads<s-intman-vxworks.ads \
- s-intman.adb<s-intman-vxworks.adb \
- a-numaux.adb<a-numaux-x86.adb \
- a-numaux.ads<a-numaux-x86.ads \
- s-osprim.adb<s-osprim-vxworks.adb \
- s-parame.ads<s-parame-vxworks.ads \
- s-parame.adb<s-parame-vxworks.adb \
- s-stchop.ads<s-stchop-limit.ads \
- s-stchop.adb<s-stchop-vxworks.adb \
- s-taprop.adb<s-taprop-vxworks.adb \
- s-taspri.ads<s-taspri-vxworks.ads \
- s-vxwork.ads<s-vxwork-x86.ads \
- g-bytswa.adb<g-bytswa-x86.adb \
- g-soccon.ads<g-soccon-vxworks.ads \
- g-socthi.ads<g-socthi-vxworks.ads \
- g-socthi.adb<g-socthi-vxworks.adb \
- g-stsifd.adb<g-stsifd-sockets.adb \
- g-sttsne.adb<g-sttsne-vxworks.adb \
- g-sttsne.ads<g-sttsne-locking.ads
-
- TOOLS_TARGET_PAIRS=mlib-tgt-specific.adb<mlib-tgt-specific-vxworks.adb
-
- ifeq ($(strip $(filter-out yes,$(TRACE))),)
- LIBGNAT_TARGET_PAIRS += \
- s-traces.adb<s-traces-default.adb \
- s-trafor.adb<s-trafor-default.adb \
- s-trafor.ads<s-trafor-default.ads \
- s-tratas.adb<s-tratas-default.adb \
- s-tfsetr.adb<s-tfsetr-vxworks.adb
- endif
-
- ifeq ($(strip $(filter-out rtp,$(THREAD_KIND))),)
- LIBGNAT_TARGET_PAIRS += \
- s-osinte.adb<s-osinte-vxworks-rtp.adb \
- s-osinte.ads<s-osinte-vxworks6.ads \
- s-tpopsp.adb<s-tpopsp-vxworks-rtp.adb \
- system.ads<system-vxworks-x86-rtp.ads
-
- EXTRA_GNATRTL_NONTASKING_OBJS=s-vxwexc.o
- else
- LIBGNAT_TARGET_PAIRS += \
- s-interr.adb<s-interr-vxworks.adb \
- s-tpopsp.adb<s-tpopsp-vxworks.adb \
- system.ads<system-vxworks-x86.ads
-
- ifeq ($(strip $(filter-out kernel,$(THREAD_KIND))),)
- LIBGNAT_TARGET_PAIRS += \
- s-osinte.ads<s-osinte-vxworks6.ads \
- s-osinte.adb<s-osinte-vxworks-kernel.adb
- else
- LIBGNAT_TARGET_PAIRS += \
- s-osinte.ads<s-osinte-vxworks.ads \
- s-osinte.adb<s-osinte-vxworks.adb
- endif
-
- EXTRA_GNATRTL_NONTASKING_OBJS=i-vxwork.o i-vxwoio.o s-vxwexc.o
- endif
-
- EXTRA_GNATRTL_TASKING_OBJS=s-vxwork.o
-
- EXTRA_LIBGNAT_SRCS+=vx_stack_info.c
- EXTRA_LIBGNAT_OBJS+=vx_stack_info.o
-endif
-
-ifeq ($(strip $(filter-out arm% coff wrs vx%,$(targ))),)
- LIBGNAT_TARGET_PAIRS = \
- a-intnam.ads<a-intnam-vxworks.ads \
- a-numaux.ads<a-numaux-vxworks.ads \
- s-inmaop.adb<s-inmaop-posix.adb \
- s-interr.adb<s-interr-vxworks.adb \
- s-intman.ads<s-intman-vxworks.ads \
- s-intman.adb<s-intman-vxworks.adb \
- s-osinte.adb<s-osinte-vxworks.adb \
- s-osinte.ads<s-osinte-vxworks.ads \
- s-osprim.adb<s-osprim-vxworks.adb \
- s-parame.ads<s-parame-vxworks.ads \
- s-parame.adb<s-parame-vxworks.adb \
- s-stchop.ads<s-stchop-limit.ads \
- s-stchop.adb<s-stchop-vxworks.adb \
- s-taprop.adb<s-taprop-vxworks.adb \
- s-taspri.ads<s-taspri-vxworks.ads \
- s-tpopsp.adb<s-tpopsp-vxworks.adb \
- s-vxwork.ads<s-vxwork-arm.ads \
- g-soccon.ads<g-soccon-vxworks.ads \
- g-socthi.ads<g-socthi-vxworks.ads \
- g-socthi.adb<g-socthi-vxworks.adb \
- g-stsifd.adb<g-stsifd-sockets.adb \
- g-sttsne.adb<g-sttsne-vxworks.adb \
- g-sttsne.ads<g-sttsne-locking.ads \
- system.ads<system-vxworks-arm.ads
-
- TOOLS_TARGET_PAIRS=mlib-tgt-specific.adb<mlib-tgt-specific-vxworks.adb
-
- EXTRA_GNATRTL_NONTASKING_OBJS=i-vxwork.o i-vxwoio.o
- EXTRA_GNATRTL_TASKING_OBJS=s-vxwork.o
-
- EXTRA_LIBGNAT_SRCS+=vx_stack_info.c
- EXTRA_LIBGNAT_OBJS+=vx_stack_info.o
-endif
-
-ifeq ($(strip $(filter-out mips% wrs vx%,$(targ))),)
- LIBGNAT_TARGET_PAIRS = \
- a-intnam.ads<a-intnam-vxworks.ads \
- a-numaux.ads<a-numaux-vxworks.ads \
- s-inmaop.adb<s-inmaop-posix.adb \
- s-interr.adb<s-interr-vxworks.adb \
- s-intman.ads<s-intman-vxworks.ads \
- s-intman.adb<s-intman-vxworks.adb \
- s-osinte.adb<s-osinte-vxworks.adb \
- s-osinte.ads<s-osinte-vxworks.ads \
- s-osprim.adb<s-osprim-vxworks.adb \
- s-parame.ads<s-parame-vxworks.ads \
- s-parame.adb<s-parame-vxworks.adb \
- s-stchop.ads<s-stchop-limit.ads \
- s-stchop.adb<s-stchop-vxworks.adb \
- s-taprop.adb<s-taprop-vxworks.adb \
- s-taspri.ads<s-taspri-vxworks.ads \
- s-tpopsp.adb<s-tpopsp-vxworks.adb \
- s-vxwork.ads<s-vxwork-mips.ads \
- g-soccon.ads<g-soccon-vxworks.ads \
- g-socthi.ads<g-socthi-vxworks.ads \
- g-socthi.adb<g-socthi-vxworks.adb \
- g-stsifd.adb<g-stsifd-sockets.adb \
- g-sttsne.adb<g-sttsne-vxworks.adb \
- g-sttsne.ads<g-sttsne-locking.ads \
- system.ads<system-vxworks-mips.ads
-
- TOOLS_TARGET_PAIRS=mlib-tgt-specific.adb<mlib-tgt-specific-vxworks.adb
-
- EXTRA_GNATRTL_NONTASKING_OBJS=i-vxwork.o i-vxwoio.o
- EXTRA_GNATRTL_TASKING_OBJS=s-vxwork.o
-
- EXTRA_LIBGNAT_SRCS+=vx_stack_info.c
- EXTRA_LIBGNAT_OBJS+=vx_stack_info.o
-endif
-
-ifeq ($(strip $(filter-out sparc% sun solaris%,$(targ))),)
- LIBGNAT_TARGET_PAIRS_32 = \
- a-intnam.ads<a-intnam-solaris.ads \
- s-inmaop.adb<s-inmaop-posix.adb \
- s-intman.adb<s-intman-solaris.adb \
- s-osinte.adb<s-osinte-solaris.adb \
- s-osinte.ads<s-osinte-solaris.ads \
- s-osprim.adb<s-osprim-solaris.adb \
- s-taprop.adb<s-taprop-solaris.adb \
- s-tasinf.adb<s-tasinf-solaris.adb \
- s-tasinf.ads<s-tasinf-solaris.ads \
- s-taspri.ads<s-taspri-solaris.ads \
- s-tpopsp.adb<s-tpopsp-solaris.adb \
- g-soccon.ads<g-soccon-solaris.ads \
- g-soliop.ads<g-soliop-solaris.ads \
- system.ads<system-solaris-sparc.ads
-
- LIBGNAT_TARGET_PAIRS_64 = \
- a-intnam.ads<a-intnam-solaris.ads \
- s-inmaop.adb<s-inmaop-posix.adb \
- s-intman.adb<s-intman-solaris.adb \
- s-osinte.adb<s-osinte-solaris.adb \
- s-osinte.ads<s-osinte-solaris.ads \
- s-osprim.adb<s-osprim-solaris.adb \
- s-taprop.adb<s-taprop-solaris.adb \
- s-tasinf.adb<s-tasinf-solaris.adb \
- s-tasinf.ads<s-tasinf-solaris.ads \
- s-taspri.ads<s-taspri-solaris.ads \
- s-tpopsp.adb<s-tpopsp-solaris.adb \
- g-soccon.ads<g-soccon-solaris-64.ads \
- g-soliop.ads<g-soliop-solaris.ads \
- system.ads<system-solaris-sparcv9.ads
-
- ifeq ($(strip $(filter-out sparc sun solaris%,$(targ))),)
- LIBGNAT_TARGET_PAIRS = $(LIBGNAT_TARGET_PAIRS_32)
- else
- LIBGNAT_TARGET_PAIRS = $(LIBGNAT_TARGET_PAIRS_64)
- endif
-
- TOOLS_TARGET_PAIRS=mlib-tgt-specific.adb<mlib-tgt-specific-solaris.adb
-
- EH_MECHANISM=-gcc
- THREADSLIB = -lposix4 -lthread
- MISCLIB = -lposix4 -lnsl -lsocket
- SO_OPTS = -Wl,-h,
- GNATLIB_SHARED = gnatlib-shared-dual
- GMEM_LIB = gmemlib
- PREFIX_OBJS = $(PREFIX_REAL_OBJS)
- LIBRARY_VERSION := $(LIB_VERSION)
-
- ifeq ($(strip $(filter-out pthread PTHREAD,$(THREAD_KIND))),)
- LIBGNAT_TARGET_PAIRS = \
- a-intnam.ads<a-intnam-solaris.ads \
- s-inmaop.adb<s-inmaop-posix.adb \
- s-intman.adb<s-intman-posix.adb \
- s-osinte.adb<s-osinte-posix.adb \
- s-osinte.ads<s-osinte-solaris-posix.ads \
- s-osprim.adb<s-osprim-solaris.adb \
- s-taprop.adb<s-taprop-posix.adb \
- s-taspri.ads<s-taspri-posix.ads \
- s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
- g-soccon.ads<g-soccon-solaris.ads \
- g-soliop.ads<g-soliop-solaris.ads \
- system.ads<system-solaris-sparc.ads
-
- THREADSLIB = -lposix4 -lpthread
- endif
-
- ifeq ($(strip $(filter-out m64,$(THREAD_KIND))),)
- LIBGNAT_TARGET_PAIRS = $(LIBGNAT_TARGET_PAIRS_64)
- endif
-endif
-
-ifeq ($(strip $(filter-out %86 solaris2%,$(arch) $(osys))),)
- LIBGNAT_TARGET_PAIRS = \
- a-numaux.adb<a-numaux-x86.adb \
- a-numaux.ads<a-numaux-x86.ads \
- a-intnam.ads<a-intnam-solaris.ads \
- s-inmaop.adb<s-inmaop-posix.adb \
- s-intman.adb<s-intman-solaris.adb \
- s-osinte.adb<s-osinte-solaris.adb \
- s-osinte.ads<s-osinte-solaris.ads \
- s-osprim.adb<s-osprim-solaris.adb \
- s-taprop.adb<s-taprop-solaris.adb \
- s-tasinf.adb<s-tasinf-solaris.adb \
- s-tasinf.ads<s-tasinf-solaris.ads \
- s-taspri.ads<s-taspri-solaris.ads \
- s-tpopsp.adb<s-tpopsp-solaris.adb \
- g-bytswa.adb<g-bytswa-x86.adb \
- g-soccon.ads<g-soccon-solaris.ads \
- g-soliop.ads<g-soliop-solaris.ads \
- system.ads<system-solaris-x86.ads
-
- TOOLS_TARGET_PAIRS=mlib-tgt-specific.adb<mlib-tgt-specific-solaris.adb
-
- EH_MECHANISM=-gcc
- THREADSLIB = -lposix4 -lthread
- MISCLIB = -lposix4 -lnsl -lsocket
- SO_OPTS = -Wl,-h,
- GNATLIB_SHARED = gnatlib-shared-dual
- GMEM_LIB = gmemlib
- PREFIX_OBJS = $(PREFIX_REAL_OBJS)
- LIBRARY_VERSION := $(LIB_VERSION)
-endif
-
-ifeq ($(strip $(filter-out %86 linux%,$(arch) $(osys))),)
- LIBGNAT_TARGET_PAIRS = \
- a-intnam.ads<a-intnam-linux.ads \
- a-numaux.adb<a-numaux-x86.adb \
- a-numaux.ads<a-numaux-x86.ads \
- g-bytswa.adb<g-bytswa-x86.adb \
- s-inmaop.adb<s-inmaop-posix.adb \
- s-intman.adb<s-intman-posix.adb \
- s-osprim.adb<s-osprim-posix.adb \
- s-taspri.ads<s-taspri-posix.ads \
- s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
- g-sercom.adb<g-sercom-linux.adb \
- system.ads<system-linux-x86.ads
-
- ifeq ($(strip $(filter-out marte,$(THREAD_KIND))),)
- LIBGNAT_TARGET_PAIRS += \
- a-exetim.adb<a-exetim-linux-marte.adb \
- a-exetim.ads<a-exetim-linux-marte.ads \
- a-extiti.adb<a-extiti-linux-marte.adb \
- a-extiti.ads<a-extiti-linux-marte.ads \
- a-rttiev.adb<a-rttiev-linux-marte.adb \
- a-rttiev.ads<a-rttiev-linux-marte.ads \
- g-soccon.ads<g-soccon-linux-x86-marte.ads \
- s-osinte.adb<s-osinte-linux-marte.adb \
- s-osinte.ads<s-osinte-linux-marte.ads \
- s-taprop.adb<s-taprop-linux-marte.adb
-
- EXTRA_GNATRTL_TASKING_OBJS=a-exetim.o a-extiti.o
-
- EH_MECHANISM=
- THREADSLIB = -lmarte
- else
- LIBGNAT_TARGET_PAIRS += \
- g-soccon.ads<g-soccon-linux-x86.ads \
- s-linux.ads<s-linux.ads \
- s-osinte.adb<s-osinte-posix.adb \
- s-osinte.ads<s-osinte-linux.ads \
- s-tasinf.ads<s-tasinf-linux.ads \
- s-tasinf.adb<s-tasinf-linux.adb \
- s-taprop.adb<s-taprop-linux.adb
-
- EH_MECHANISM=-gcc
- THREADSLIB = -lpthread
- EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
- endif
-
- TOOLS_TARGET_PAIRS = \
- mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
- indepsw.adb<indepsw-gnu.adb
-
- GNATLIB_SHARED = gnatlib-shared-dual
- GMEM_LIB = gmemlib
- PREFIX_OBJS = $(PREFIX_REAL_OBJS)
- LIBRARY_VERSION := $(LIB_VERSION)
-endif
-
-ifeq ($(strip $(filter-out %86 kfreebsd%,$(arch) $(osys))),)
- LIBGNAT_TARGET_PAIRS = \
- a-intnam.ads<a-intnam-freebsd.ads \
- a-numaux.adb<a-numaux-x86.adb \
- a-numaux.ads<a-numaux-x86.ads \
- s-inmaop.adb<s-inmaop-posix.adb \
- s-intman.adb<s-intman-posix.adb \
- g-soccon.ads<g-soccon-freebsd.ads \
- s-osinte.adb<s-osinte-posix.adb \
- s-osinte.ads<s-osinte-kfreebsd-gnu.ads \
- s-osprim.adb<s-osprim-posix.adb \
- s-taprop.adb<s-taprop-linux.adb \
- s-tasinf.ads<s-tasinf-linux.ads \
- s-tasinf.adb<s-tasinf-linux.adb \
- s-taspri.ads<s-taspri-posix.ads \
- s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
- system.ads<system-freebsd-x86.ads
-
- TOOLS_TARGET_PAIRS = \
- mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
- indepsw.adb<indepsw-gnu.adb
-
- EH_MECHANISM=-gcc
- THREADSLIB = -lpthread
- GNATLIB_SHARED = gnatlib-shared-dual
- GMEM_LIB = gmemlib
- PREFIX_OBJS = $(PREFIX_REAL_OBJS)
- LIBRARY_VERSION := $(LIB_VERSION)
-endif
-
-ifeq ($(strip $(filter-out %86 freebsd%,$(arch) $(osys))),)
- LIBGNAT_TARGET_PAIRS = \
- a-intnam.ads<a-intnam-freebsd.ads \
- a-numaux.adb<a-numaux-x86.adb \
- a-numaux.ads<a-numaux-x86.ads \
- g-bytswa.adb<g-bytswa-x86.adb \
- g-soccon.ads<g-soccon-freebsd.ads \
- s-inmaop.adb<s-inmaop-posix.adb \
- s-intman.adb<s-intman-posix.adb \
- s-osinte.adb<s-osinte-freebsd.adb \
- s-osinte.ads<s-osinte-freebsd.ads \
- s-osprim.adb<s-osprim-posix.adb \
- s-taprop.adb<s-taprop-posix.adb \
- s-taspri.ads<s-taspri-posix.ads \
- s-tpopsp.adb<s-tpopsp-posix.adb \
- system.ads<system-freebsd-x86.ads
-
- TOOLS_TARGET_PAIRS = \
- mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb
- GNATLIB_SHARED = gnatlib-shared-dual
-
- EH_MECHANISM=-gcc
- THREADSLIB= -lpthread
- GMEM_LIB = gmemlib
- PREFIX_OBJS = $(PREFIX_REAL_OBJS)
- LIBRARY_VERSION := $(LIB_VERSION)
-endif
-
-ifeq ($(strip $(filter-out s390% linux%,$(arch) $(osys))),)
- ifeq ($(strip $(filter-out s390x,$(arch))),)
- LIBGNAT_TARGET_PAIRS = \
- a-intnam.ads<a-intnam-linux.ads \
- s-inmaop.adb<s-inmaop-posix.adb \
- s-intman.adb<s-intman-posix.adb \
- s-linux.ads<s-linux.ads \
- s-osinte.adb<s-osinte-posix.adb \
- s-osinte.ads<s-osinte-linux.ads \
- s-osprim.adb<s-osprim-posix.adb \
- s-taprop.adb<s-taprop-linux.adb \
- s-tasinf.ads<s-tasinf-linux.ads \
- s-tasinf.adb<s-tasinf-linux.adb \
- s-taspri.ads<s-taspri-posix-noaltstack.ads \
- s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
- system.ads<system-linux-s390x.ads
- else
- LIBGNAT_TARGET_PAIRS = \
- a-intnam.ads<a-intnam-linux.ads \
- s-inmaop.adb<s-inmaop-posix.adb \
- s-intman.adb<s-intman-posix.adb \
- s-linux.ads<s-linux.ads \
- s-osinte.adb<s-osinte-posix.adb \
- s-osinte.ads<s-osinte-linux.ads \
- s-osprim.adb<s-osprim-posix.adb \
- s-taprop.adb<s-taprop-linux.adb \
- s-tasinf.ads<s-tasinf-linux.ads \
- s-tasinf.adb<s-tasinf-linux.adb \
- s-taspri.ads<s-taspri-posix-noaltstack.ads \
- s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
- system.ads<system-linux-s390.ads
- endif
-
- TOOLS_TARGET_PAIRS = \
- mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb
-
- EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
- EH_MECHANISM=-gcc
- THREADSLIB = -lpthread
- GNATLIB_SHARED = gnatlib-shared-dual
- PREFIX_OBJS = $(PREFIX_REAL_OBJS)
- LIBRARY_VERSION := $(LIB_VERSION)
-endif
-
-ifeq ($(strip $(filter-out mips sgi irix%,$(targ))),)
- ifeq ($(strip $(filter-out mips sgi irix6%,$(targ))),)
- LIBGNAT_TARGET_PAIRS = \
- a-intnam.ads<a-intnam-irix.ads \
- s-inmaop.adb<s-inmaop-posix.adb \
- s-intman.adb<s-intman-irix.adb \
- s-mastop.adb<s-mastop-irix.adb \
- s-osinte.adb<s-osinte-irix.adb \
- s-osinte.ads<s-osinte-irix.ads \
- s-osprim.adb<s-osprim-posix.adb \
- s-proinf.adb<s-proinf-irix-athread.adb \
- s-proinf.ads<s-proinf-irix-athread.ads \
- s-taprop.adb<s-taprop-irix.adb \
- s-tasinf.ads<s-tasinf-irix.ads \
- s-taspri.ads<s-taspri-posix.ads \
- s-tpopsp.adb<s-tpopsp-posix.adb \
- s-traceb.adb<s-traceb-mastop.adb \
- g-soccon.ads<g-soccon-irix.ads \
- system.ads<system-irix-n32.ads
-
- THREADSLIB = -lpthread
- GNATLIB_SHARED = gnatlib-shared-default
-
- else
- LIBGNAT_TARGET_PAIRS += \
- s-mastop.adb<s-mastop-irix.adb \
- s-osprim.adb<s-osprim-posix.adb \
- s-traceb.adb<s-traceb-mastop.adb \
- g-soccon.ads<g-soccon-irix.ads \
- system.ads<system-irix-o32.ads
- endif
-
- EH_MECHANISM=-gcc
- TOOLS_TARGET_PAIRS = mlib-tgt-specific.adb<mlib-tgt-specific-irix.adb
- TGT_LIB = -lexc
- MISCLIB = -lexc
- PREFIX_OBJS = $(PREFIX_REAL_OBJS)
- LIBRARY_VERSION := $(LIB_VERSION)
- GMEM_LIB = gmemlib
-endif
-
-ifeq ($(strip $(filter-out hppa% hp hpux10%,$(targ))),)
- LIBGNAT_TARGET_PAIRS = \
- a-excpol.adb<a-excpol-abort.adb \
- a-intnam.ads<a-intnam-hpux.ads \
- s-inmaop.adb<s-inmaop-posix.adb \
- s-interr.adb<s-interr-sigaction.adb \
- s-intman.adb<s-intman-posix.adb \
- s-osinte.adb<s-osinte-hpux-dce.adb \
- s-osinte.ads<s-osinte-hpux-dce.ads \
- s-parame.ads<s-parame-hpux.ads \
- s-osprim.adb<s-osprim-posix.adb \
- s-taprop.adb<s-taprop-hpux-dce.adb \
- s-taspri.ads<s-taspri-hpux-dce.ads \
- s-tpopsp.adb<s-tpopsp-posix.adb \
- g-soccon.ads<g-soccon-hpux.ads \
- system.ads<system-hpux.ads
-
- EH_MECHANISM=-gcc
- PREFIX_OBJS = $(PREFIX_REAL_OBJS)
-endif
-
-ifeq ($(strip $(filter-out hppa% hp hpux11%,$(targ))),)
- LIBGNAT_TARGET_PAIRS = \
- a-intnam.ads<a-intnam-hpux.ads \
- s-inmaop.adb<s-inmaop-posix.adb \
- s-intman.adb<s-intman-posix.adb \
- s-osinte.adb<s-osinte-posix.adb \
- s-osinte.ads<s-osinte-hpux.ads \
- s-parame.ads<s-parame-hpux.ads \
- s-osprim.adb<s-osprim-posix.adb \
- s-traceb.adb<s-traceb-hpux.adb \
- s-taprop.adb<s-taprop-posix.adb \
- s-taspri.ads<s-taspri-posix.ads \
- s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
- g-soccon.ads<g-soccon-hpux.ads \
- system.ads<system-hpux.ads
-
- TOOLS_TARGET_PAIRS = mlib-tgt-specific.adb<mlib-tgt-specific-hpux.adb
- EH_MECHANISM=-gcc
- TGT_LIB = /usr/lib/libcl.a
- THREADSLIB = -lpthread
- GMEM_LIB = gmemlib
- soext = .sl
- SO_OPTS = -Wl,+h,
- PREFIX_OBJS = $(PREFIX_REAL_OBJS)
- GNATLIB_SHARED = gnatlib-shared-dual
- LIBRARY_VERSION := $(LIB_VERSION)
-endif
-
-ifeq ($(strip $(filter-out ibm aix%,$(manu) $(osys))),)
- LIBGNAT_TARGET_PAIRS = \
- a-intnam.ads<a-intnam-aix.ads \
- s-inmaop.adb<s-inmaop-posix.adb \
- s-intman.adb<s-intman-posix.adb \
- s-osinte.adb<s-osinte-aix.adb \
- s-osinte.ads<s-osinte-aix.ads \
- s-osprim.adb<s-osprim-posix.adb \
- s-taprop.adb<s-taprop-posix.adb \
- s-taspri.ads<s-taspri-posix.ads \
- s-tpopsp.adb<s-tpopsp-posix.adb \
- g-soccon.ads<g-soccon-aix.ads \
- system.ads<system-aix.ads
-
- THREADSLIB = -lpthreads
- PREFIX_OBJS=$(PREFIX_REAL_OBJS)
-
- TOOLS_TARGET_PAIRS = \
- mlib-tgt-specific.adb<mlib-tgt-specific-aix.adb \
- indepsw.adb<indepsw-aix.adb
-
- GMEM_LIB = gmemlib
-endif
-
-ifeq ($(strip $(filter-out lynxos,$(osys))),)
- TOOLS_TARGET_PAIRS = \
- mlib-tgt-specific.adb<mlib-tgt-specific-lynxos.adb \
- indepsw.adb<indepsw-gnu.adb
-
- ifeq ($(strip $(filter-out %86 lynxos,$(arch) $(osys))),)
- LIBGNAT_TARGET_PAIRS = \
- a-numaux.adb<a-numaux-x86.adb \
- a-numaux.ads<a-numaux-x86.ads \
- a-intnam.ads<a-intnam-lynxos.ads \
- g-bytswa.adb<g-bytswa-x86.adb \
- g-soccon.ads<g-soccon-lynxos.ads \
- g-sttsne.adb<g-sttsne-locking.adb \
- g-sttsne.ads<g-sttsne-locking.ads \
- s-inmaop.adb<s-inmaop-posix.adb \
- s-intman.adb<s-intman-posix.adb \
- s-osinte.adb<s-osinte-lynxos.adb \
- s-osinte.ads<s-osinte-lynxos.ads \
- s-osprim.adb<s-osprim-posix.adb \
- s-taprop.adb<s-taprop-lynxos.adb \
- s-taspri.ads<s-taspri-lynxos.ads \
- s-tpopsp.adb<s-tpopsp-lynxos.adb \
- system.ads<system-lynxos-x86.ads
-
- PREFIX_OBJS=$(PREFIX_REAL_OBJS)
-
- else
- LIBGNAT_TARGET_PAIRS = \
- a-intnam.ads<a-intnam-lynxos.ads \
- g-soccon.ads<g-soccon-lynxos.ads \
- g-sttsne.adb<g-sttsne-locking.adb \
- g-sttsne.ads<g-sttsne-locking.ads \
- s-inmaop.adb<s-inmaop-posix.adb \
- s-intman.adb<s-intman-posix.adb \
- s-osinte.adb<s-osinte-lynxos.adb \
- s-osinte.ads<s-osinte-lynxos.ads \
- s-osprim.adb<s-osprim-posix.adb \
- s-taprop.adb<s-taprop-lynxos.adb \
- s-taspri.ads<s-taspri-lynxos.ads \
- s-tpopsp.adb<s-tpopsp-lynxos.adb \
- system.ads<system-lynxos-ppc.ads
- endif
-endif
-
-ifeq ($(strip $(filter-out rtems%,$(osys))),)
- LIBGNAT_TARGET_PAIRS = \
- system.ads<system-rtems.ads \
- a-intnam.ads<a-intnam-rtems.ads \
- s-inmaop.adb<s-inmaop-posix.adb \
- s-intman.adb<s-intman-posix.adb \
- s-osinte.adb<s-osinte-rtems.adb \
- s-osinte.ads<s-osinte-rtems.ads \
- s-osprim.adb<s-osprim-posix.adb \
- s-parame.adb<s-parame-rtems.adb \
- s-taprop.adb<s-taprop-posix.adb \
- s-taspri.ads<s-taspri-posix.ads \
- s-tpopsp.adb<s-tpopsp-rtems.adb \
- g-soccon.ads<g-soccon-rtems.ads \
- s-stchop.adb<s-stchop-rtems.adb
-endif
-
-ifeq ($(strip $(filter-out alpha% dec osf%,$(targ))),)
- LIBGNAT_TARGET_PAIRS = \
- a-intnam.ads<a-intnam-tru64.ads \
- s-inmaop.adb<s-inmaop-posix.adb \
- s-intman.adb<s-intman-posix.adb \
- s-mastop.adb<s-mastop-tru64.adb \
- s-osinte.adb<s-osinte-tru64.adb \
- s-osinte.ads<s-osinte-tru64.ads \
- s-osprim.adb<s-osprim-unix.adb \
- s-taprop.adb<s-taprop-tru64.adb \
- s-tasinf.ads<s-tasinf-tru64.ads \
- s-taspri.ads<s-taspri-tru64.ads \
- s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
- s-traceb.adb<s-traceb-mastop.adb \
- g-soccon.ads<g-soccon-tru64.ads \
- system.ads<system-tru64.ads
-
- TOOLS_TARGET_PAIRS=mlib-tgt-specific.adb<mlib-tgt-specific-tru64.adb
-
- EH_MECHANISM=-gcc
- GMEM_LIB=gmemlib
- THREADSLIB = -lpthread -lmach -lexc -lrt
- PREFIX_OBJS = $(PREFIX_REAL_OBJS)
- GNATLIB_SHARED = gnatlib-shared-default
- LIBRARY_VERSION := $(LIB_VERSION)
-endif
-
-ifeq ($(strip $(filter-out alpha64 ia64 dec hp vms% openvms% alphavms%,$(host))),)
-
-soext = .exe
-hyphen = _
-LN = cp -p
-LN_S = cp -p
-
-.SUFFIXES: .sym
-
-.o.sym:
- @ gnu:[bin]vmssymvec $<
-endif
-
-ifeq ($(strip $(filter-out alpha64 ia64 dec hp vms% openvms% alphavms%,$(targ))),)
-ifeq ($(strip $(filter-out ia64 hp vms% openvms%,$(targ))),)
- LIBGNAT_TARGET_PAIRS_AUX1 = \
- g-enblsp.adb<g-enblsp-vms-ia64.adb \
- g-trasym.adb<g-trasym-vms-ia64.adb \
- s-asthan.adb<s-asthan-vms-ia64.adb \
- s-osinte.adb<s-osinte-vms-ia64.adb \
- s-osinte.ads<s-osinte-vms-ia64.ads \
- s-vaflop.adb<s-vaflop-vms-ia64.adb \
- system.ads<system-vms-ia64.ads
-
- LIBGNAT_TARGET_PAIRS_AUX2 = \
- s-parame.ads<s-parame-vms-ia64.ads
-else
-ifeq ($(strip $(filter-out alpha64 dec vms% openvms% alphavms%,$(targ))),)
- LIBGNAT_TARGET_PAIRS_AUX1 = \
- g-enblsp.adb<g-enblsp-vms-alpha.adb \
- g-trasym.adb<g-trasym-vms-alpha.adb \
- s-traent.adb<s-traent-vms.adb \
- s-traent.ads<s-traent-vms.ads \
- s-asthan.adb<s-asthan-vms-alpha.adb \
- s-osinte.adb<s-osinte-vms.adb \
- s-osinte.ads<s-osinte-vms.ads \
- s-vaflop.adb<s-vaflop-vms-alpha.adb \
- system.ads<system-vms_64.ads
-
-ifeq ($(strip $(filter-out express EXPRESS,$(THREAD_KIND))),)
- LIBGNAT_TARGET_PAIRS_AUX2 = \
- s-parame.ads<s-parame-vms-restrict.ads
-else
- LIBGNAT_TARGET_PAIRS_AUX2 = \
- s-parame.ads<s-parame-vms-alpha.ads
-endif
-endif
-endif
-
- LIBGNAT_TARGET_PAIRS = \
- a-caldel.adb<a-caldel-vms.adb \
- a-calend.adb<a-calend-vms.adb \
- a-calend.ads<a-calend-vms.ads \
- a-dirval.adb<a-dirval-vms.adb \
- a-excpol.adb<a-excpol-abort.adb \
- a-intnam.ads<a-intnam-vms.ads \
- a-numaux.ads<a-numaux-vms.ads \
- g-expect.adb<g-expect-vms.adb \
- g-soccon.ads<g-soccon-vms.ads \
- g-socthi.ads<g-socthi-vms.ads \
- g-socthi.adb<g-socthi-vms.adb \
- g-stsifd.adb<g-stsifd-sockets.adb \
- g-sttsne.adb<g-sttsne-locking.adb \
- g-sttsne.ads<g-sttsne-locking.ads \
- i-c.ads<i-c-vms_64.ads \
- i-cstrin.ads<i-cstrin-vms_64.ads \
- i-cstrin.adb<i-cstrin-vms_64.adb \
- i-cpoint.ads<i-cpoint-vms_64.ads \
- i-cpoint.adb<i-cpoint-vms_64.adb \
- i-cstrea.adb<i-cstrea-vms.adb \
- memtrack.adb<memtrack-vms_64.adb \
- s-auxdec.ads<s-auxdec-vms_64.ads \
- s-crtl.ads<s-crtl-vms_64.ads \
- s-inmaop.adb<s-inmaop-vms.adb \
- s-interr.adb<s-interr-vms.adb \
- s-intman.adb<s-intman-vms.adb \
- s-intman.ads<s-intman-vms.ads \
- s-memory.adb<s-memory-vms_64.adb \
- s-memory.ads<s-memory-vms_64.ads \
- s-osprim.adb<s-osprim-vms.adb \
- s-osprim.ads<s-osprim-vms.ads \
- s-taprop.adb<s-taprop-vms.adb \
- s-taspri.ads<s-taspri-vms.ads \
- s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
- s-tpopde.adb<s-tpopde-vms.adb \
- s-tpopde.ads<s-tpopde-vms.ads \
- $(LIBGNAT_TARGET_PAIRS_AUX1) \
- $(LIBGNAT_TARGET_PAIRS_AUX2)
-
-ifeq ($(strip $(filter-out ia64 hp vms% openvms%,$(targ))),)
- TOOLS_TARGET_PAIRS= \
- mlib-tgt-specific.adb<mlib-tgt-specific-vms-ia64.adb \
- symbols.adb<symbols-vms.adb \
- symbols-processing.adb<symbols-processing-vms-ia64.adb
-else
- TOOLS_TARGET_PAIRS= \
- mlib-tgt-specific.adb<mlib-tgt-specific-vms-alpha.adb \
- symbols.adb<symbols-vms.adb \
- symbols-processing.adb<symbols-processing-vms-alpha.adb
-endif
-
-adamsg.o: adamsg.msg
- -$(DECC) --cc=message adamsg.msg -o adamsg.o
-
- EXTRA_GNATMAKE_OBJS = mlib-tgt-vms_common.o
-
- GMEM_LIB = gmemlib
- EH_MECHANISM=-gcc
- GNATLIB_SHARED=gnatlib-shared-vms
-ifeq ($(strip $(filter-out alpha64 dec vms% openvms% alphavms%,$(targ))),)
- EXTRA_LIBGNAT_SRCS=vmshandler.asm
- EXTRA_LIBGNAT_OBJS=vmshandler.o
-endif
- EXTRA_LIBGNAT_SRCS+=adamsg.msg
- EXTRA_LIBGNAT_OBJS+=adamsg.o
- EXTRA_GNATRTL_TASKING_OBJS=s-tpopde.o
- EXTRA_GNATTOOLS = \
- ../../gnatlbr$(exeext) \
- ../../gnatsym$(exeext) \
- ../../vms_help$(exeext) \
- ../../gnat.hlp
- # This command transforms (YYYYMMDD) into YY,MMDD
- GSMATCH_VERSION := $(shell grep "^ *Gnat_Static_Version_String" $(fsrcpfx)gnatvsn.ads | sed -e 's/.*(\(.*\)).*/\1/' -e 's/\(..\)\(..\)\(....\).*/\2,\3/')
- TOOLS_LIBS_LO := --for-linker=sys\\$$\$$library:trace.exe
- LIBRARY_VERSION := $(subst .,_,$(LIB_VERSION))
-endif
-
-ifeq ($(strip $(filter-out cygwin32% mingw32% pe,$(osys))),)
- LIBGNAT_TARGET_PAIRS = \
- a-dirval.adb<a-dirval-mingw.adb \
- a-excpol.adb<a-excpol-abort.adb \
- a-numaux.adb<a-numaux-x86.adb \
- a-numaux.ads<a-numaux-x86.ads \
- s-gloloc.adb<s-gloloc-mingw.adb \
- s-inmaop.adb<s-inmaop-dummy.adb \
- s-memory.adb<s-memory-mingw.adb \
- s-taspri.ads<s-taspri-mingw.ads \
- s-tasinf.adb<s-tasinf-mingw.adb \
- s-tasinf.ads<s-tasinf-mingw.ads \
- g-bytswa.adb<g-bytswa-x86.adb \
- g-socthi.ads<g-socthi-mingw.ads \
- g-socthi.adb<g-socthi-mingw.adb \
- g-stsifd.adb<g-stsifd-sockets.adb \
- g-soccon.ads<g-soccon-mingw.ads \
- g-soliop.ads<g-soliop-mingw.ads
-
- ifeq ($(strip $(filter-out rtx_w32 rtx_rtss,$(THREAD_KIND))),)
- LIBGNAT_TARGET_PAIRS += \
- s-intman.adb<s-intman-dummy.adb \
- s-osinte.ads<s-osinte-rtx.ads \
- s-osprim.adb<s-osprim-rtx.adb \
- s-taprop.adb<s-taprop-rtx.adb \
- system.ads<system-rtx.ads
-
- EXTRA_GNATRTL_NONTASKING_OBJS = s-win32.o
-
- MISCLIB = -lwsock32 -lrtapi_w32
- THREADSLIB=-lrtapi_w32
- else
- LIBGNAT_TARGET_PAIRS += \
- a-exetim.adb<a-exetim-mingw.adb \
- a-exetim.ads<a-exetim-mingw.ads \
- a-intnam.ads<a-intnam-mingw.ads \
- g-sercom.adb<g-sercom-mingw.adb \
- s-interr.adb<s-interr-sigaction.adb \
- s-intman.adb<s-intman-mingw.adb \
- s-osinte.ads<s-osinte-mingw.ads \
- s-osprim.adb<s-osprim-mingw.adb \
- s-taprop.adb<s-taprop-mingw.adb \
- system.ads<system-mingw.ads
-
- EXTRA_GNATRTL_NONTASKING_OBJS = s-win32.o s-win32.o g-regist.o
- EXTRA_GNATRTL_TASKING_OBJS = a-exetim.o
-
- MISCLIB = -lwsock32
-
- # ??? This will be replaced by gnatlib-shared-dual-win32 when GNAT
- # auto-import support for array/record will be done.
- GNATLIB_SHARED = gnatlib-shared-win32
- endif
-
- TOOLS_TARGET_PAIRS= \
- mlib-tgt-specific.adb<mlib-tgt-specific-mingw.adb \
- indepsw.adb<indepsw-mingw.adb
-
- EH_MECHANISM=-gcc
- GMEM_LIB = gmemlib
- PREFIX_OBJS = $(PREFIX_REAL_OBJS)
- EXTRA_GNATTOOLS = ../../gnatdll$(exeext)
- EXTRA_GNATMAKE_OBJS = mdll.o mdll-utl.o mdll-fil.o
- soext = .dll
- LIBRARY_VERSION := $(LIB_VERSION)
-endif
-
-ifeq ($(strip $(filter-out mips linux%,$(arch) $(osys))),)
- LIBGNAT_TARGET_PAIRS = \
- a-intnam.ads<a-intnam-linux.ads \
- g-soccon.ads<g-soccon-linux-mips.ads \
- s-inmaop.adb<s-inmaop-posix.adb \
- s-intman.adb<s-intman-posix.adb \
- s-linux.ads<s-linux.ads \
- s-osinte.adb<s-osinte-posix.adb \
- s-osinte.ads<s-osinte-linux.ads \
- s-osprim.adb<s-osprim-posix.adb \
- s-taprop.adb<s-taprop-linux.adb \
- s-tasinf.ads<s-tasinf-linux.ads \
- s-tasinf.adb<s-tasinf-linux.adb \
- s-taspri.ads<s-taspri-posix.ads \
- s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
- system.ads<system-linux-mips.ads
-
- EH_MECHANISM=-gcc
- THREADSLIB = -lpthread
- GNATLIB_SHARED = gnatlib-shared-dual
- GMEM_LIB = gmemlib
- PREFIX_OBJS = $(PREFIX_REAL_OBJS)
- LIBRARY_VERSION := $(LIB_VERSION)
-endif
-
-ifeq ($(strip $(filter-out mipsel linux%,$(arch) $(osys))),)
- LIBGNAT_TARGET_PAIRS = \
- a-intnam.ads<a-intnam-linux.ads \
- g-soccon.ads<g-soccon-linux-mips.ads \
- s-inmaop.adb<s-inmaop-posix.adb \
- s-intman.adb<s-intman-posix.adb \
- s-linux.ads<s-linux.ads \
- s-osinte.adb<s-osinte-posix.adb \
- s-osinte.ads<s-osinte-linux.ads \
- s-osprim.adb<s-osprim-posix.adb \
- s-taprop.adb<s-taprop-linux.adb \
- s-tasinf.ads<s-tasinf-linux.ads \
- s-tasinf.adb<s-tasinf-linux.adb \
- s-taspri.ads<s-taspri-posix.ads \
- s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
- system.ads<system-linux-mipsel.ads
-
- EH_MECHANISM=-gcc
- THREADSLIB = -lpthread
- GNATLIB_SHARED = gnatlib-shared-dual
- GMEM_LIB = gmemlib
- PREFIX_OBJS = $(PREFIX_REAL_OBJS)
- LIBRARY_VERSION := $(LIB_VERSION)
-endif
-
-ifeq ($(strip $(filter-out powerpc% linux%,$(arch) $(osys))),)
- LIBGNAT_TARGET_PAIRS = \
- a-intnam.ads<a-intnam-linux.ads \
- g-soccon.ads<g-soccon-linux-ppc.ads \
- s-inmaop.adb<s-inmaop-posix.adb \
- s-intman.adb<s-intman-posix.adb \
- s-linux.ads<s-linux.ads \
- s-osinte.adb<s-osinte-posix.adb \
- s-osinte.ads<s-osinte-linux.ads \
- s-osprim.adb<s-osprim-posix.adb \
- s-taprop.adb<s-taprop-linux.adb \
- s-tasinf.ads<s-tasinf-linux.ads \
- s-tasinf.adb<s-tasinf-linux.adb \
- s-taspri.ads<s-taspri-posix-noaltstack.ads \
- s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
- g-sercom.adb<g-sercom-linux.adb \
- system.ads<system-linux-ppc.ads
-
- TOOLS_TARGET_PAIRS = \
- mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
- indepsw.adb<indepsw-gnu.adb
-
- EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
- EH_MECHANISM=-gcc
- THREADSLIB = -lpthread
- GNATLIB_SHARED = gnatlib-shared-dual
- GMEM_LIB = gmemlib
- PREFIX_OBJS = $(PREFIX_REAL_OBJS)
- LIBRARY_VERSION := $(LIB_VERSION)
-endif
-
-ifeq ($(strip $(filter-out sparc% linux%,$(arch) $(osys))),)
- LIBGNAT_TARGET_PAIRS = \
- a-intnam.ads<a-intnam-linux.ads \
- s-inmaop.adb<s-inmaop-posix.adb \
- s-intman.adb<s-intman-posix.adb \
- s-linux.ads<s-linux.ads \
- s-osinte.adb<s-osinte-posix.adb \
- s-osinte.ads<s-osinte-linux.ads \
- s-osprim.adb<s-osprim-posix.adb \
- s-taprop.adb<s-taprop-linux.adb \
- s-tasinf.ads<s-tasinf-linux.ads \
- s-tasinf.adb<s-tasinf-linux.adb \
- s-taspri.ads<s-taspri-posix-noaltstack.ads \
- s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
- system.ads<system-linux-sparc.ads
-
- TOOLS_TARGET_PAIRS = \
- mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
- indepsw.adb<indepsw-gnu.adb
-
- EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
- EH_MECHANISM=-gcc
- THREADSLIB = -lpthread
- GNATLIB_SHARED = gnatlib-shared-dual
- GMEM_LIB = gmemlib
- PREFIX_OBJS = $(PREFIX_REAL_OBJS)
- LIBRARY_VERSION := $(LIB_VERSION)
-endif
-
-ifeq ($(strip $(filter-out hppa% linux%,$(arch) $(osys))),)
- LIBGNAT_TARGET_PAIRS = \
- a-intnam.ads<a-intnam-linux.ads \
- s-inmaop.adb<s-inmaop-posix.adb \
- s-intman.adb<s-intman-posix.adb \
- s-linux.ads<s-linux-hppa.ads \
- s-osinte.adb<s-osinte-posix.adb \
- s-osinte.ads<s-osinte-linux.ads \
- s-osprim.adb<s-osprim-posix.adb \
- s-taprop.adb<s-taprop-linux.adb \
- s-tasinf.ads<s-tasinf-linux.ads \
- s-tasinf.adb<s-tasinf-linux.adb \
- s-taspri.ads<s-taspri-posix-noaltstack.ads \
- s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
- system.ads<system-linux-hppa.ads
-
- TOOLS_TARGET_PAIRS = \
- mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
- indepsw.adb<indepsw-gnu.adb
-
- EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
- EH_MECHANISM=-gcc
- THREADSLIB = -lpthread
- GNATLIB_SHARED = gnatlib-shared-dual
- GMEM_LIB = gmemlib
- PREFIX_OBJS = $(PREFIX_REAL_OBJS)
- LIBRARY_VERSION := $(LIB_VERSION)
-endif
-
-ifeq ($(strip $(filter-out sh4% linux%,$(arch) $(osys))),)
- LIBGNAT_TARGET_PAIRS = \
- a-intnam.ads<a-intnam-linux.ads \
- s-inmaop.adb<s-inmaop-posix.adb \
- s-intman.adb<s-intman-posix.adb \
- s-linux.ads<s-linux.ads \
- s-osinte.adb<s-osinte-posix.adb \
- s-osinte.ads<s-osinte-linux.ads \
- s-osprim.adb<s-osprim-posix.adb \
- s-taprop.adb<s-taprop-linux.adb \
- s-tasinf.ads<s-tasinf-linux.ads \
- s-tasinf.adb<s-tasinf-linux.adb \
- s-taspri.ads<s-taspri-posix-noaltstack.ads \
- s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
- system.ads<system-linux-sh4.ads
-
- TOOLS_TARGET_PAIRS = \
- mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
- indepsw.adb<indepsw-linux.adb
-
- EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
- EH_MECHANISM=-gcc
- MISCLIB=
- THREADSLIB = -lpthread
- GNATLIB_SHARED = gnatlib-shared-dual
- GMEM_LIB = gmemlib
- PREFIX_OBJS = $(PREFIX_REAL_OBJS)
- LIBRARY_VERSION := $(LIB_VERSION)
-endif
-
-ifeq ($(strip $(filter-out %ia64 linux%,$(arch) $(osys))),)
- LIBGNAT_TARGET_PAIRS = \
- a-intnam.ads<a-intnam-linux.ads \
- a-numaux.ads<a-numaux-libc-x86.ads \
- g-soccon.ads<g-soccon-linux-64.ads \
- s-inmaop.adb<s-inmaop-posix.adb \
- s-intman.adb<s-intman-posix.adb \
- s-linux.ads<s-linux.ads \
- s-osinte.ads<s-osinte-linux.ads \
- s-osinte.adb<s-osinte-posix.adb \
- s-osprim.adb<s-osprim-posix.adb \
- s-taprop.adb<s-taprop-linux.adb \
- s-tasinf.ads<s-tasinf-linux.ads \
- s-tasinf.adb<s-tasinf-linux.adb \
- s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
- s-taspri.ads<s-taspri-posix-noaltstack.ads \
- g-sercom.adb<g-sercom-linux.adb \
- system.ads<system-linux-ia64.ads
-
- TOOLS_TARGET_PAIRS = \
- mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
- indepsw.adb<indepsw-gnu.adb
-
- EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
- EH_MECHANISM=-gcc
- MISCLIB=
- THREADSLIB=-lpthread
- GNATLIB_SHARED=gnatlib-shared-dual
- GMEM_LIB = gmemlib
- PREFIX_OBJS=$(PREFIX_REAL_OBJS)
- LIBRARY_VERSION := $(LIB_VERSION)
-endif
-
-ifeq ($(strip $(filter-out alpha% linux%,$(arch) $(osys))),)
- LIBGNAT_TARGET_PAIRS = \
- a-intnam.ads<a-intnam-linux.ads \
- s-inmaop.adb<s-inmaop-posix.adb \
- s-intman.adb<s-intman-posix.adb \
- s-linux.ads<s-linux-alpha.ads \
- s-osinte.ads<s-osinte-linux.ads \
- s-osinte.adb<s-osinte-posix.adb \
- s-osprim.adb<s-osprim-posix.adb \
- s-taprop.adb<s-taprop-linux.adb \
- s-tasinf.ads<s-tasinf-linux.ads \
- s-tasinf.adb<s-tasinf-linux.adb \
- s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
- s-taspri.ads<s-taspri-posix-noaltstack.ads \
- system.ads<system-linux-alpha.ads
-
- TOOLS_TARGET_PAIRS = \
- mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
- indepsw.adb<indepsw-gnu.adb
-
- EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
- EH_MECHANISM=-gcc
- MISCLIB=
- THREADSLIB=-lpthread
- GNATLIB_SHARED=gnatlib-shared-dual
- PREFIX_OBJS=$(PREFIX_REAL_OBJS)
- LIBRARY_VERSION := $(LIB_VERSION)
-endif
-
-ifeq ($(strip $(filter-out %x86_64 linux%,$(arch) $(osys))),)
- LIBGNAT_TARGET_PAIRS = \
- a-intnam.ads<a-intnam-linux.ads \
- a-numaux.adb<a-numaux-x86.adb \
- a-numaux.ads<a-numaux-x86.ads \
- g-soccon.ads<g-soccon-linux-64.ads \
- s-inmaop.adb<s-inmaop-posix.adb \
- s-intman.adb<s-intman-posix.adb \
- s-linux.ads<s-linux.ads \
- s-osinte.ads<s-osinte-linux.ads \
- s-osinte.adb<s-osinte-posix.adb \
- s-osprim.adb<s-osprim-posix.adb \
- s-taprop.adb<s-taprop-linux.adb \
- s-tasinf.ads<s-tasinf-linux.ads \
- s-tasinf.adb<s-tasinf-linux.adb \
- s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
- s-taspri.ads<s-taspri-posix.ads \
- g-sercom.adb<g-sercom-linux.adb \
- system.ads<system-linux-x86_64.ads
-
- TOOLS_TARGET_PAIRS = \
- mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
- indepsw.adb<indepsw-gnu.adb
-
- EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
- EH_MECHANISM=-gcc
- THREADSLIB=-lpthread
- GNATLIB_SHARED=gnatlib-shared-dual
- GMEM_LIB = gmemlib
- PREFIX_OBJS=$(PREFIX_REAL_OBJS)
- LIBRARY_VERSION := $(LIB_VERSION)
-endif
-
-ifeq ($(strip $(filter-out darwin%,$(osys))),)
- ifeq ($(strip $(filter-out %86,$(arch))),)
- LIBGNAT_TARGET_PAIRS = \
- a-intnam.ads<a-intnam-darwin.ads \
- s-inmaop.adb<s-inmaop-posix.adb \
- s-intman.adb<s-intman-posix.adb \
- s-osinte.adb<s-osinte-darwin.adb \
- s-osinte.ads<s-osinte-darwin.ads \
- s-osprim.adb<s-osprim-posix.adb \
- s-taprop.adb<s-taprop-posix.adb \
- s-taspri.ads<s-taspri-posix.ads \
- s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
- g-soccon.ads<g-soccon-darwin.ads \
- a-numaux.ads<a-numaux-x86.ads \
- a-numaux.adb<a-numaux-x86.adb \
- system.ads<system-darwin-x86.ads
- else
- LIBGNAT_TARGET_PAIRS = \
- a-intnam.ads<a-intnam-darwin.ads \
- s-inmaop.adb<s-inmaop-posix.adb \
- s-intman.adb<s-intman-posix.adb \
- s-osinte.adb<s-osinte-darwin.adb \
- s-osinte.ads<s-osinte-darwin.ads \
- s-osprim.adb<s-osprim-posix.adb \
- s-taprop.adb<s-taprop-posix.adb \
- s-taspri.ads<s-taspri-posix.ads \
- s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
- g-soccon.ads<g-soccon-darwin.ads \
- a-numaux.ads<a-numaux-darwin.ads \
- a-numaux.adb<a-numaux-darwin.adb \
- system.ads<system-darwin-ppc.ads
- endif
-
- TOOLS_TARGET_PAIRS = \
- mlib-tgt-specific.adb<mlib-tgt-specific-darwin.adb
-
- EH_MECHANISM=-gcc
- GNATLIB_SHARED = gnatlib-shared-darwin
- SO_OPTS = -Wl,-flat_namespace -shared-libgcc
- RANLIB = ranlib -c
- GMEM_LIB = gmemlib
- PREFIX_OBJS=$(PREFIX_REAL_OBJS)
- LIBRARY_VERSION := $(LIB_VERSION)
- soext = .dylib
-endif
-
-ifneq ($(EH_MECHANISM),)
- LIBGNAT_TARGET_PAIRS += a-exexpr.adb<a-exexpr$(EH_MECHANISM).adb
- EXTRA_LIBGNAT_SRCS+=raise$(EH_MECHANISM).c
- EXTRA_LIBGNAT_OBJS+=raise$(EH_MECHANISM).o
-endif
-
-# Use the Ada 2005 version of Ada.Exceptions by default, unless specified
-# explicitly already. The base files (a-except.ad?) are used only for building
-# the compiler and other basic tools.
-# These base versions lack Ada 2005 additions which would cause bootstrap
-# problems if included in the compiler and other basic tools.
-
-ifeq ($(filter-out a-except%,$(LIBGNAT_TARGET_PAIRS)),$(LIBGNAT_TARGET_PAIRS))
- LIBGNAT_TARGET_PAIRS += \
- a-except.ads<a-except-2005.ads \
- a-except.adb<a-except-2005.adb
-endif
-
-# The runtime library for gnat comprises two directories. One contains the
-# Ada source files that the compiler (gnat1) needs -- these files are listed
-# by ADA_INCLUDE_SRCS -- and the other contains the object files and their
-# corresponding .ali files for the parts written in Ada, libgnat.a for
-# the parts of the runtime written in C, and libgthreads.a for the pthreads
-# emulation library. LIBGNAT_OBJS lists the objects that go into libgnat.a,
-# while GNATRTL_OBJS lists the object files compiled from Ada sources that
-# go into the directory. The pthreads emulation is built in the threads
-# subdirectory and copied.
-LIBGNAT_SRCS = ada.h adaint.c adaint.h argv.c cio.c cstreams.c \
- errno.c exit.c cal.c ctrl_c.c env.c env.h \
- raise.h raise.c sysdep.c aux-io.c init.c initialize.c seh_init.c \
- final.c tracebak.c tb-alvms.c tb-alvxw.c tb-gcc.c expect.c mkdir.c \
- socket.c gsocket.h targext.c $(EXTRA_LIBGNAT_SRCS)
-
-LIBGNAT_OBJS = adaint.o argv.o cio.o cstreams.o ctrl_c.o errno.o exit.o env.o \
- raise.o sysdep.o aux-io.o init.o initialize.o seh_init.o cal.o \
- final.o tracebak.o expect.o mkdir.o socket.o targext.o $(EXTRA_LIBGNAT_OBJS)
-
-# NOTE ??? - when the -I option for compiling Ada code is made to work,
-# the library installation will change and there will be a
-# GNAT_RTL_SRCS. Right now we count on being able to build GNATRTL_OBJS
-# from ADA_INCLUDE_SRCS.
-
-# GNATRTL_NONTASKING_OBJS and GNATRTL_TASKING_OBJS can be found in
-# the following include file:
-
-include $(fsrcdir)/Makefile.rtl
-
-GNATRTL_LINEARALGEBRA_OBJS = a-nlcoar.o a-nllcar.o a-nllrar.o a-nlrear.o \
- a-nucoar.o a-nurear.o i-forbla.o i-forlap.o s-gearop.o
-
-GNATRTL_OBJS = $(GNATRTL_NONTASKING_OBJS) $(GNATRTL_TASKING_OBJS) \
- $(GNATRTL_LINEARALGEBRA_OBJS) g-trasym.o memtrack.o
-
-# Default run time files
-
-ADA_INCLUDE_SRCS =\
- ada.ads calendar.ads directio.ads gnat.ads interfac.ads ioexcept.ads \
- machcode.ads text_io.ads unchconv.ads unchdeal.ads \
- sequenio.ads system.ads memtrack.adb \
- a-[a-o]*.adb a-[p-z]*.adb a-[a-o]*.ads a-[p-z]*.ads g-*.ad? i-*.ad? \
- s-[a-o]*.adb s-[p-z]*.adb s-[a-o]*.ads s-[p-z]*.ads
-
-LIBGNAT=../rts/libgnat.a
-
-GCC_LINK=$(CC) -static-libgcc $(ADA_INCLUDES)
-
-# when compiling the tools, the runtime has to be first on the path so that
-# it hides the runtime files lying with the rest of the sources
-ifeq ($(TOOLSCASE),native)
- vpath %.ads ../rts ../
- vpath %.adb ../rts ../
- vpath %.c ../rts ../
- vpath %.h ../rts ../
-endif
-
-# in the cross tools case, everything is compiled with the native
-# gnatmake/link. Therefore only -I needs to be modified in ADA_INCLUDES
-ifeq ($(TOOLSCASE),cross)
- vpath %.ads ../
- vpath %.adb ../
- vpath %.c ../
- vpath %.h ../
-endif
-
-common-tools:
- $(GNATMAKE) -c -b $(ADA_INCLUDES) \
- --GNATBIND="$(GNATBIND)" --GCC="$(CC) $(ALL_ADAFLAGS)" \
- gnatchop gnatcmd gnatkr gnatls gnatprep gnatxref gnatfind gnatname \
- gnatclean -bargs $(ADA_INCLUDES) $(GNATBIND_FLAGS)
- $(GNATLINK) -v gnatcmd -o ../../gnat$(exeext) \
- --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
- $(GNATLINK) -v gnatchop -o ../../gnatchop$(exeext) \
- --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
- $(GNATLINK) -v gnatkr -o ../../gnatkr$(exeext) \
- --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
- $(GNATLINK) -v gnatls -o ../../gnatls$(exeext) \
- --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
- $(GNATLINK) -v gnatprep -o ../../gnatprep$(exeext) \
- --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
- $(GNATLINK) -v gnatxref -o ../../gnatxref$(exeext) \
- --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
- $(GNATLINK) -v gnatfind -o ../../gnatfind$(exeext) \
- --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
- $(GNATLINK) -v gnatname -o ../../gnatname$(exeext) \
- --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
- $(GNATLINK) -v gnatclean -o ../../gnatclean$(exeext) \
- --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
-
-../../gnatsym$(exeext):
- $(GNATMAKE) -c $(ADA_INCLUDES) gnatsym --GCC="$(CC) $(ALL_ADAFLAGS)"
- $(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatsym
- $(GNATLINK) -v gnatsym -o $@ --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
-
-../../gnatdll$(exeext):
- $(GNATMAKE) -c $(ADA_INCLUDES) gnatdll --GCC="$(CC) $(ALL_ADAFLAGS)"
- $(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatdll
- $(GNATLINK) -v gnatdll -o $@ --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
-
-../../vxaddr2line$(exeext): targext.o
- $(GNATMAKE) -c $(ADA_INCLUDES) vxaddr2line --GCC="$(CC) $(ALL_ADAFLAGS)"
- $(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) vxaddr2line
- $(GNATLINK) -v vxaddr2line -o $@ --GCC="$(GCC_LINK)" targext.o $(CLIB)
-
-gnatmake-re: link.o targext.o
- $(GNATMAKE) $(ADA_INCLUDES) -u sdefault --GCC="$(CC) $(MOST_ADA_FLAGS)"
- $(GNATMAKE) -c $(ADA_INCLUDES) gnatmake --GCC="$(CC) $(ALL_ADAFLAGS)"
- $(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatmake
- $(GNATLINK) -v gnatmake -o ../../gnatmake$(exeext) \
- --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
-
-# Note the use of the "mv" command in order to allow gnatlink to be linked with
-# with the former version of gnatlink itself which cannot override itself.
-gnatlink-re: link.o targext.o
- $(GNATMAKE) -c $(ADA_INCLUDES) gnatlink --GCC="$(CC) $(ALL_ADAFLAGS)"
- $(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatlink
- $(GNATLINK) -v gnatlink -o ../../gnatlinknew$(exeext) \
- --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
- $(MV) ../../gnatlinknew$(exeext) ../../gnatlink$(exeext)
-
-# Needs to be built with CC=gcc
-# Since the RTL should be built with the latest compiler, remove the
-# stamp target in the parent directory whenever gnat1 is rebuilt
-
-# Likewise for the tools
-../../gnatmake$(exeext): $(P) b_gnatm.o link.o targext.o $(GNATMAKE_OBJS)
- $(GCC_LINK) $(ALL_CFLAGS) $(LDFLAGS) -o $@ b_gnatm.o $(GNATMAKE_OBJS) \
- $(TOOLS_LIBS)
-
-../../gnatlink$(exeext): $(P) b_gnatl.o link.o targext.o $(GNATLINK_OBJS)
- $(GCC_LINK) $(ALL_CFLAGS) $(LDFLAGS) -o $@ b_gnatl.o $(GNATLINK_OBJS) \
- $(TOOLS_LIBS)
-
-../stamp-gnatlib:
- @if [ ! -f stamp-gnatlib ] ; \
- then \
- $(ECHO) You must first build the GNAT library: make gnatlib; \
- false; \
- else \
- true; \
- fi
-
-install-gnatlib: ../stamp-gnatlib
-# Create the directory before deleting it, in case the directory is
-# a list of directories (as it may be on VMS). This ensures we are
-# deleting the right one.
- -$(MKDIR) $(DESTDIR)$(ADA_RTL_OBJ_DIR)
- -$(MKDIR) $(DESTDIR)$(ADA_INCLUDE_DIR)
- $(RMDIR) $(DESTDIR)$(ADA_RTL_OBJ_DIR)
- $(RMDIR) $(DESTDIR)$(ADA_INCLUDE_DIR)
- -$(MKDIR) $(DESTDIR)$(ADA_RTL_OBJ_DIR)
- -$(MKDIR) $(DESTDIR)$(ADA_INCLUDE_DIR)
- for file in rts/*.ali; do \
- $(INSTALL_DATA_DATE) $$file $(DESTDIR)$(ADA_RTL_OBJ_DIR); \
- done
- -$(INSTALL_DATA) rts/g-trasym$(objext) $(DESTDIR)$(ADA_RTL_OBJ_DIR)
- -cd rts; for file in *$(arext);do \
- $(INSTALL_DATA) $$file $(DESTDIR)$(ADA_RTL_OBJ_DIR); \
- $(RANLIB_FOR_TARGET) $(DESTDIR)$(ADA_RTL_OBJ_DIR)/$$file; \
- done
- -$(foreach file, $(EXTRA_ADALIB_FILES), \
- $(INSTALL_DATA_DATE) rts/$(file) $(DESTDIR)$(ADA_RTL_OBJ_DIR) && \
- ) true
-# Install the shared libraries, if any, using $(INSTALL) instead
-# of $(INSTALL_DATA). The latter may force a mode inappropriate
-# for shared libraries on some targets, e.g. on HP-UX where the x
-# permission is required.
- for file in gnat gnarl; do \
- if [ -f rts/lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext) ]; then \
- $(INSTALL) rts/lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext) \
- $(DESTDIR)$(ADA_RTL_OBJ_DIR); \
- fi; \
- if [ -f rts/lib$${file}$(soext) ]; then \
- $(LN_S) lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext) \
- $(DESTDIR)$(ADA_RTL_OBJ_DIR)/lib$${file}$(soext); \
- fi; \
- done
-# This copy must be done preserving the date on the original file.
- for file in rts/*.ad?; do \
- $(INSTALL_DATA_DATE) $$file $(DESTDIR)$(ADA_INCLUDE_DIR); \
- done
- cd $(DESTDIR)$(ADA_INCLUDE_DIR); $(CHMOD) a-wx *.adb
- cd $(DESTDIR)$(ADA_INCLUDE_DIR); $(CHMOD) a-wx *.ads
-
-../stamp-gnatlib2:
- $(RM) rts/s-*.ali
- $(RM) rts/s-*$(objext)
- $(RM) rts/a-*.ali
- $(RM) rts/a-*$(objext)
- $(RM) rts/*.ali
- $(RM) rts/*$(objext)
- $(RM) rts/*$(arext)
- $(RM) rts/*$(soext)
- touch ../stamp-gnatlib2
- $(RM) ../stamp-gnatlib
-
-# NOTE: The $(foreach ...) commands assume ";" is the valid separator between
-# successive target commands. Although the Gnu make documentation
-# implies this is true on all systems, I suspect it may not be, So care
-# has been taken to allow a sed script to look for ";)" and substitue
-# for ";" the appropriate character in the range of lines below
-# beginning with "GNULLI Begin" and ending with "GNULLI End"
-
-# GNULLI Begin ###########################################################
-
-../stamp-gnatlib1: Makefile ../stamp-gnatlib2
- $(RMDIR) rts
- $(MKDIR) rts
- $(CHMOD) u+w rts
-# Copy target independent sources
- $(foreach f,$(ADA_INCLUDE_SRCS) $(LIBGNAT_SRCS), \
- $(LN_S) $(fsrcpfx)$(f) rts ;) true
-# Remove files to be replaced by target dependent sources
- $(RM) $(foreach PAIR,$(LIBGNAT_TARGET_PAIRS), \
- rts/$(word 1,$(subst <, ,$(PAIR))))
- $(RM) rts/*-*-*.ads rts/*-*-*.adb
-# Copy new target dependent sources
- $(foreach PAIR,$(LIBGNAT_TARGET_PAIRS), \
- $(LN_S) $(fsrcpfx)$(word 2,$(subst <, ,$(PAIR))) \
- rts/$(word 1,$(subst <, ,$(PAIR)));)
- $(RM) ../stamp-gnatlib
- touch ../stamp-gnatlib1
-
-# GNULLI End #############################################################
-
-# Don't use semicolon separated shell commands that involve list expansions.
-# The semicolon triggers a call to DCL on VMS and DCL can't handle command
-# line lengths in excess of 256 characters.
-# Example: cd rts; ar rc libfoo.a $(LONG_LIST_OF_OBJS)
-# is guaranteed to overflow the buffer.
-
-gnatlib: ../stamp-gnatlib1 ../stamp-gnatlib2
- $(MAKE) -C rts \
- CC="`echo \"$(GCC_FOR_TARGET)\" \
- | sed -e 's,^\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'`" \
- INCLUDES="$(INCLUDES_FOR_SUBDIR) -I./../.." \
- CFLAGS="$(GNATLIBCFLAGS_FOR_C)" \
- FORCE_DEBUG_ADAFLAGS="$(FORCE_DEBUG_ADAFLAGS)" \
- srcdir=$(fsrcdir) \
- -f ../Makefile $(LIBGNAT_OBJS)
- $(MAKE) -C rts \
- CC="`echo \"$(GCC_FOR_TARGET)\" \
- | sed -e 's,^\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'`" \
- ADA_INCLUDES="" \
- CFLAGS="$(GNATLIBCFLAGS)" \
- ADAFLAGS="$(GNATLIBFLAGS)" \
- FORCE_DEBUG_ADAFLAGS="$(FORCE_DEBUG_ADAFLAGS)" \
- srcdir=$(fsrcdir) \
- -f ../Makefile \
- $(GNATRTL_OBJS)
- $(RM) rts/libgnat$(arext) rts/libgnarl$(arext)
- $(AR_FOR_TARGET) $(AR_FLAGS) rts/libgnat$(arext) \
- $(addprefix rts/,$(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS))
- ifneq ($(PREFIX_OBJS),)
- $(AR_FOR_TARGET) $(AR_FLAGS) rts/libgccprefix$(arext) \
- $(PREFIX_OBJS);
- $(RANLIB_FOR_TARGET) rts/libgccprefix$(arext)
- endif
- $(RANLIB_FOR_TARGET) rts/libgnat$(arext)
- $(AR_FOR_TARGET) $(AR_FLAGS) rts/libgnarl$(arext) \
- $(addprefix rts/,$(GNATRTL_TASKING_OBJS))
- $(RANLIB_FOR_TARGET) rts/libgnarl$(arext)
- $(AR_FOR_TARGET) $(AR_FLAGS) rts/libgnala$(arext) \
- $(addprefix rts/,$(GNATRTL_LINEARALGEBRA_OBJS))
- $(RANLIB_FOR_TARGET) rts/libgnala$(arext)
- ifeq ($(GMEM_LIB),gmemlib)
- $(AR_FOR_TARGET) $(AR_FLAGS) rts/libgmem$(arext) \
- rts/memtrack.o
- $(RANLIB_FOR_TARGET) rts/libgmem$(arext)
- endif
- $(CHMOD) a-wx rts/*.ali
- touch ../stamp-gnatlib
-
-# Warning: this target assumes that LIBRARY_VERSION has been set correctly.
-gnatlib-shared-default:
- $(MAKE) $(FLAGS_TO_PASS) \
- GNATLIBFLAGS="$(GNATLIBFLAGS)" \
- GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(TARGET_LIBGCC2_CFLAGS)" \
- THREAD_KIND="$(THREAD_KIND)" \
- gnatlib
- $(RM) rts/libgna*$(soext)
- cd rts; ../../xgcc -B../../ -shared $(GNATLIBCFLAGS) \
- $(TARGET_LIBGCC2_CFLAGS) \
- -o libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
- $(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) \
- $(SO_OPTS)libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
- $(MISCLIB) -lm
- cd rts; ../../xgcc -B../../ -shared $(GNATLIBCFLAGS) \
- $(TARGET_LIBGCC2_CFLAGS) \
- -o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
- $(GNATRTL_TASKING_OBJS) \
- $(SO_OPTS)libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
- $(THREADSLIB)
- cd rts; $(LN_S) libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
- libgnat$(soext)
- cd rts; $(LN_S) libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
- libgnarl$(soext)
-
-gnatlib-shared-dual:
- $(MAKE) $(FLAGS_TO_PASS) \
- GNATLIBFLAGS="$(GNATLIBFLAGS)" \
- GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
- THREAD_KIND="$(THREAD_KIND)" \
- gnatlib-shared-default
- $(MV) rts/libgna*$(soext) .
- $(RM) ../stamp-gnatlib2
- $(MAKE) $(FLAGS_TO_PASS) \
- GNATLIBFLAGS="$(GNATLIBFLAGS)" \
- GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
- THREAD_KIND="$(THREAD_KIND)" \
- gnatlib
- $(MV) libgna*$(soext) rts
-
-gnatlib-shared-dual-win32:
- $(MAKE) $(FLAGS_TO_PASS) \
- GNATLIBFLAGS="$(GNATLIBFLAGS)" \
- GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(TARGET_LIBGCC2_CFLAGS)" \
- THREAD_KIND="$(THREAD_KIND)" \
- gnatlib-shared-win32
- $(MV) rts/libgna*$(soext) .
- $(RM) ../stamp-gnatlib2
- $(MAKE) $(FLAGS_TO_PASS) \
- GNATLIBFLAGS="$(GNATLIBFLAGS)" \
- GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
- THREAD_KIND="$(THREAD_KIND)" \
- gnatlib
- $(MV) libgna*$(soext) rts
-
-# ??? we need to add the option to support auto-import of arrays/records to
-# the GNATLIBFLAGS when this will be supported by GNAT. At this point we will
-# use the gnatlib-shared-dual-win32 target to build the GNAT runtimes on
-# Windows.
-gnatlib-shared-win32:
- $(MAKE) $(FLAGS_TO_PASS) \
- GNATLIBFLAGS="$(GNATLIBFLAGS)" \
- GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(TARGET_LIBGCC2_CFLAGS)" \
- THREAD_KIND="$(THREAD_KIND)" \
- gnatlib
- $(RM) rts/libgna*$(soext)
- cd rts; ../../xgcc -B../../ -shared $(TARGET_LIBGCC2_CFLAGS) \
- -o libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
- $(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) \
- $(SO_OPTS)libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) $(MISCLIB)
- cd rts; ../../xgcc -B../../ -shared $(TARGET_LIBGCC2_CFLAGS) \
- -o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
- $(GNATRTL_TASKING_OBJS) \
- $(SO_OPTS)libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
- $(THREADSLIB) -Wl,libgnat$(hyphen)$(LIBRARY_VERSION)$(soext)
-
-gnatlib-shared-darwin:
- $(MAKE) $(FLAGS_TO_PASS) \
- GNATLIBFLAGS="$(GNATLIBFLAGS)" \
- GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(TARGET_LIBGCC2_CFLAGS) \
- -fno-common" \
- THREAD_KIND="$(THREAD_KIND)" \
- gnatlib
- $(RM) rts/libgnat$(soext) rts/libgnarl$(soext)
- cd rts; ../../xgcc -B../../ -dynamiclib $(TARGET_LIBGCC2_CFLAGS) \
- -o libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
- $(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) \
- $(SO_OPTS) \
- $(MISCLIB) -lm
- cd rts; ../../xgcc -B../../ -dynamiclib $(TARGET_LIBGCC2_CFLAGS) \
- -o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
- $(GNATRTL_TASKING_OBJS) \
- $(SO_OPTS) \
- $(THREADSLIB) -Wl,libgnat$(hyphen)$(LIBRARY_VERSION)$(soext)
- cd rts; $(LN_S) libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
- libgnat$(soext)
- cd rts; $(LN_S) libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
- libgnarl$(soext)
-
-gnatlib-shared-vms:
- $(MAKE) $(FLAGS_TO_PASS) \
- GNATLIBFLAGS="$(GNATLIBFLAGS)" \
- GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
- THREAD_KIND="$(THREAD_KIND)" \
- gnatlib
- $(RM) rts/libgna*$(soext)
- cd rts && \
- ../../gnatsym -s SYMVEC_$$$$.opt \
- $(LIBGNAT_OBJS) $(GNATRTL_NONTASKING_OBJS) && \
- ../../xgcc -g -B../../ -shared -shared-libgcc \
- -o libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) libgnat.a \
- sys\$$library:trace.exe \
- --for-linker=/noinform \
- --for-linker=SYMVEC_$$$$.opt \
- --for-linker=gsmatch=equal,$(GSMATCH_VERSION)
- cd rts && \
- ../../gnatsym -s SYMVEC_$$$$.opt \
- $(GNATRTL_TASKING_OBJS) && \
- ../../xgcc -g -B../../ -shared -shared-libgcc \
- -o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
- libgnarl.a libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
- sys\$$library:trace.exe \
- --for-linker=/noinform \
- --for-linker=SYMVEC_$$$$.opt \
- --for-linker=gsmatch=equal,$(GSMATCH_VERSION)
-
-gnatlib-shared:
- $(MAKE) $(FLAGS_TO_PASS) \
- GNATLIBFLAGS="$(GNATLIBFLAGS)" \
- GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
- THREAD_KIND="$(THREAD_KIND)" \
- TARGET_LIBGCC2_CFLAGS="$(TARGET_LIBGCC2_CFLAGS)" \
- $(GNATLIB_SHARED)
-
-gnatlib-sjlj:
- $(MAKE) $(FLAGS_TO_PASS) EH_MECHANISM="" ../stamp-gnatlib1
- sed -e 's/ZCX_By_Default.*/ZCX_By_Default : constant Boolean := False;/' rts/system.ads > rts/s.ads
- $(MV) rts/s.ads rts/system.ads
- $(MAKE) $(FLAGS_TO_PASS) \
- EH_MECHANISM="" \
- GNATLIBFLAGS="$(GNATLIBFLAGS)" \
- GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
- THREAD_KIND="$(THREAD_KIND)" \
- TARGET_LIBGCC2_CFLAGS="$(TARGET_LIBGCC2_CFLAGS)" gnatlib
-
-gnatlib-zcx:
- $(MAKE) $(FLAGS_TO_PASS) EH_MECHANISM="-gcc" ../stamp-gnatlib1
- sed -e 's/ZCX_By_Default.*/ZCX_By_Default : constant Boolean := True;/' rts/system.ads > rts/s.ads
- $(MV) rts/s.ads rts/system.ads
- $(MAKE) $(FLAGS_TO_PASS) \
- EH_MECHANISM="-gcc" \
- GNATLIBFLAGS="$(GNATLIBFLAGS)" \
- GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
- THREAD_KIND="$(THREAD_KIND)" \
- TARGET_LIBGCC2_CFLAGS="$(TARGET_LIBGCC2_CFLAGS)" gnatlib
-
-# .s files for cross-building
-gnat-cross: force
- make $(GNAT1_ADA_OBJS) CC="gcc -B../stage1/" CFLAGS="-S -gnatp"
-
-# Compiling object files from source files.
-
-# Note that dependencies on obstack.h are not written
-# because that file is not part of GCC.
-# Dependencies on gvarargs.h are not written
-# because all that file does, when not compiling with GCC,
-# is include the system varargs.h.
-
-b_gnatl.c : $(GNATLINK_OBJS)
- $(GNATBIND) -C $(ADA_INCLUDES) -o b_gnatl.c gnatlink.ali
-b_gnatl.o : b_gnatl.c
-
-b_gnatm.c : $(GNATMAKE_OBJS)
- $(GNATBIND) -C $(ADA_INCLUDES) -o b_gnatm.c gnatmake.ali
-b_gnatm.o : b_gnatm.c
-
-ADA_INCLUDE_DIR = $(libsubdir)/adainclude
-ADA_RTL_OBJ_DIR = $(libsubdir)/adalib
-
-# force no sibling call optimization on s-traceb.o so the number of stack
-# frames to be skipped when computing a call chain is not modified by
-# optimization. However we can do that only when building the runtime
-# (not the compiler) because the -fno-optimize-sibling-calls option exists
-# only in GCC 3 and above.
-
-ifneq (,$(findstring xgcc,$(CC)))
-NO_SIBLING_ADAFLAGS=-fno-optimize-sibling-calls
-else
-NO_SIBLING_ADAFLAGS=
-endif
-
-s-traceb.o : s-traceb.adb
- $(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) \
- $(NO_SIBLING_ADAFLAGS) $(ADA_INCLUDES) \
- $< $(OUTPUT_OPTION)
-
-# force debugging information on s-tasdeb.o so that it is always
-# possible to set conditional breakpoints on tasks.
-
-s-tasdeb.o : s-tasdeb.adb s-tasdeb.ads
- $(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) -O0 $(ADA_INCLUDES) \
- $< $(OUTPUT_OPTION)
-
-# force no function reordering on a-except.o because of the exclusion bounds
-# mechanism (see the source file for more detailed information). However we
-# can do that only when building the runtime (not the compiler) because the
-# -fno-toplevel-reorder option exists only in GCC 4.2 and above.
-
-ifneq (,$(findstring xgcc,$(CC)))
-NO_REORDER_ADAFLAGS=-fno-toplevel-reorder
-else
-NO_REORDER_ADAFLAGS=
-endif
-
-# force debugging information on a-except.o so that it is always
-# possible to set conditional breakpoints on exceptions.
-# use -O1 otherwise gdb isn't able to get a full backtrace on mips targets.
-
-a-except.o : a-except.adb a-except.ads
- $(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) -O1 -fno-inline \
- $(NO_REORDER_ADAFLAGS) $(ADA_INCLUDES) $< $(OUTPUT_OPTION)
-
-# compile s-except.o without optimization and with debug info to let the
-# debugger set breakpoints and inspect subprogram parameters on exception
-# related events.
-
-s-except.o : s-except.adb s-except.ads
- $(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) -O0 $(ADA_INCLUDES) \
- $< $(OUTPUT_OPTION)
-
-# force debugging information on s-assert.o so that it is always
-# possible to set breakpoint on assert failures.
-
-s-assert.o : s-assert.adb s-assert.ads a-except.ads
- $(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) -O2 $(ADA_INCLUDES) \
- $< $(OUTPUT_OPTION)
-
-adadecode.o : adadecode.c adadecode.h
-aux-io.o : aux-io.c
-argv.o : argv.c
-cal.o : cal.c
-deftarg.o : deftarg.c
-errno.o : errno.c
-exit.o : adaint.h exit.c
-expect.o : expect.c
-final.o : final.c
-gmem.o : gmem.c
-link.o : link.c
-mkdir.o : mkdir.c
-socket.o : socket.c gsocket.h
-sysdep.o : sysdep.c
-raise-gcc.o : raise-gcc.c raise.h
-raise.o : raise.c raise.h
-vx_stack_info.o : vx_stack_info.c
-
-gen-soccon: gen-soccon.c gsocket.h
- $(CC) $(ALL_CFLAGS) $(ADA_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
- -UIN_GCC -DTARGET=\"$(target_alias)\" \
- $< $(OUTPUT_OPTION)
-
-cio.o : cio.c
- $(CC) -c $(ALL_CFLAGS) $(ADA_CFLAGS) \
- $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
-
-init.o : init.c adaint.h raise.h
- $(CC) -c $(ALL_CFLAGS) $(ADA_CFLAGS) \
- $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
-
-initialize.o : initialize.c raise.h
- $(CC) -c $(ALL_CFLAGS) $(ADA_CFLAGS) \
- $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
-
-targext.o : targext.c
- $(CC) -c $(ALL_CFLAGS) $(ADA_CFLAGS) \
- $(ALL_CPPFLAGS) $(INCLUDES_FOR_SUBDIR) \
- $< $(OUTPUT_OPTION)
-
-# No optimization to compile this file as optimizations (-O1 or above) breaks
-# the SEH handling on Windows. The reasons are not clear.
-seh_init.o : seh_init.c raise.h
- $(CC) -c $(ALL_CFLAGS) $(ADA_CFLAGS) -O0 \
- $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
-
-# Need to keep the frame pointer in this file to pop the stack properly on
-# some targets.
-tracebak.o : tracebak.c tb-alvms.c tb-alvxw.c tb-gcc.c
- $(CC) -c $(ALL_CFLAGS) $(ADA_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
- -fno-omit-frame-pointer $< $(OUTPUT_OPTION)
-
-# In GNU Make, ignore whether `stage*' exists.
-.PHONY: stage1 stage2 stage3 stage4 clean realclean TAGS bootstrap
-.PHONY: risky-stage1 risky-stage2 risky-stage3 risky-stage4
-
-force:
-
-# Gnatlbr, Vms_help, and Gnat.hlp are only used on VMS
-
-../../gnatlbr$(exeext): ../../prefix.o
- $(GNATMAKE) -c $(ADA_INCLUDES) gnatlbr --GCC="$(CC) $(ALL_ADAFLAGS)"
- $(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatlbr
- $(GNATLINK) -v gnatlbr -o $@ --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
-
-../../vms_help$(exeext):
- $(GNATMAKE) -c $(ADA_INCLUDES) vms_help --GCC="$(CC) $(ALL_ADAFLAGS)"
- $(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) vms_help
- $(GNATLINK) -v vms_help -o $@ --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
-
-../../gnat.hlp: ../../vms_help$(exeext)
- ../../vms_help$(exeext) $(fsrcdir)/gnat.help_in \
- $(fsrcdir)/vms_data.ads ../../gnat.hlp
+-include ./gcc-interface/Makefile
+-include ../gcc-interface/Makefile
diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl
index 66dfea8ed73..d5234c2b1ab 100644
--- a/gcc/ada/Makefile.rtl
+++ b/gcc/ada/Makefile.rtl
@@ -46,6 +46,7 @@ GNATRTL_TASKING_OBJS= \
s-inmaop$(objext) \
s-interr$(objext) \
s-intman$(objext) \
+ s-oscons$(objext) \
s-osinte$(objext) \
s-proinf$(objext) \
s-solita$(objext) \
@@ -364,11 +365,6 @@ GNATRTL_NONTASKING_OBJS= \
g-sercom$(objext) \
g-sestin$(objext) \
g-sha1$(objext) \
- g-soccon$(objext) \
- g-socket$(objext) \
- g-socthi$(objext) \
- g-soliop$(objext) \
- g-sothco$(objext) \
g-souinf$(objext) \
g-speche$(objext) \
g-spchge$(objext) \
@@ -379,7 +375,6 @@ GNATRTL_NONTASKING_OBJS= \
g-sptavs$(objext) \
g-string$(objext) \
g-strspl$(objext) \
- g-sttsne$(objext) \
g-table$(objext) \
g-tasloc$(objext) \
g-timsta$(objext) \
@@ -608,4 +603,5 @@ GNATRTL_NONTASKING_OBJS= \
text_io$(objext) \
unchconv$(objext) \
unchdeal$(objext) \
+ $(GNATRTL_SOCKETS_OBJS) \
$(EXTRA_GNATRTL_NONTASKING_OBJS)
diff --git a/gcc/ada/a-coinve.adb b/gcc/ada/a-coinve.adb
index c97f4eb2406..0f107be4356 100644
--- a/gcc/ada/a-coinve.adb
+++ b/gcc/ada/a-coinve.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2004-2007, Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2008, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -1124,13 +1124,12 @@ package body Ada.Containers.Indefinite_Vectors is
Index : constant Index_Type := Index_Type (Index_As_Int);
- J : Index_Type'Base;
+ J : Index_Type'Base := Before;
begin
E (Index .. New_Last) := E (Before .. Container.Last);
Container.Last := New_Last;
- J := Before;
while J < Index loop
E (J) := new Element_Type'(New_Item);
J := J + 1;
diff --git a/gcc/ada/a-rttiev.adb b/gcc/ada/a-rttiev.adb
index 72ae4df0be4..2b1dacf1925 100644
--- a/gcc/ada/a-rttiev.adb
+++ b/gcc/ada/a-rttiev.adb
@@ -152,8 +152,8 @@ package body Ada.Real_Time.Timing_Events is
return;
end if;
- -- We have an event that has timed out so we will process it. It
- -- must be the first in the queue so no search is needed.
+ -- We have an event that has timed out so we will process it. It must
+ -- be the first in the queue so no search is needed.
All_Events.Delete_First;
@@ -174,7 +174,7 @@ package body Ada.Real_Time.Timing_Events is
declare
Handler : constant Timing_Event_Handler := Next_Event.Handler;
begin
- -- The first act is to clear the event, per D.15 (13/2). Besides,
+ -- The first act is to clear the event, per D.15(13/2). Besides,
-- we cannot clear the handler pointer *after* invoking the
-- handler because the handler may have re-inserted the event via
-- Set_Event. Thus we take a copy and then clear the component.
@@ -186,7 +186,7 @@ package body Ada.Real_Time.Timing_Events is
end if;
-- Ignore exceptions propagated by Handler.all, as required by
- -- RM-D.15(21/2)
+ -- RM D.15(21/2).
exception
when others =>
@@ -266,7 +266,7 @@ package body Ada.Real_Time.Timing_Events is
Remove_From_Queue (Event'Unchecked_Access);
Event.Handler := null;
- -- RM-D.15(15/2) requires that at this point, we check whether the time
+ -- RM D.15(15/2) requires that at this point, we check whether the time
-- has already passed, and if so, call Handler.all directly from here
-- instead of doing the enqueuing below. However, this causes a nasty
-- race condition and potential deadlock. If the current task has
@@ -294,7 +294,7 @@ package body Ada.Real_Time.Timing_Events is
Remove_From_Queue (Event'Unchecked_Access);
Event.Handler := null;
- -- See comment in the other Set_Handler above.
+ -- See comment in the other Set_Handler above
if Handler /= null then
Event.Timeout := Clock + In_Time;
diff --git a/gcc/ada/a-wtdeio.adb b/gcc/ada/a-wtdeio.adb
index 910165060fc..bdc11f3ad34 100644
--- a/gcc/ada/a-wtdeio.adb
+++ b/gcc/ada/a-wtdeio.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2006, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -139,10 +139,8 @@ package body Ada.Wide_Text_IO.Decimal_IO is
Aft : Field := Default_Aft;
Exp : Field := Default_Exp)
is
- pragma Unreferenced (Fore);
- -- ??? how come this is unreferenced, sounds wrong ???
begin
- Put (Current_Output, Item, Aft, Exp);
+ Put (Current_Output, Item, Fore, Aft, Exp);
end Put;
procedure Put
diff --git a/gcc/ada/a-ztdeio.adb b/gcc/ada/a-ztdeio.adb
index 796dfc80456..564431c17aa 100644
--- a/gcc/ada/a-ztdeio.adb
+++ b/gcc/ada/a-ztdeio.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -139,10 +139,8 @@ package body Ada.Wide_Wide_Text_IO.Decimal_IO is
Aft : Field := Default_Aft;
Exp : Field := Default_Exp)
is
- pragma Unreferenced (Fore);
- -- ??? how come this is unreferenced, sounds wrong ???
begin
- Put (Current_Output, Item, Aft, Exp);
+ Put (Current_Output, Item, Fore, Aft, Exp);
end Put;
procedure Put
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index 8ace0a1c827..b7fdd08d252 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -85,7 +85,15 @@
#include "mingw32.h"
#include <sys/utime.h>
+
+/* For isalpha-like tests in the compiler, we're expected to resort to
+ safe-ctype.h/ISALPHA. This isn't available for the runtime library
+ build, so we fallback on ctype.h/isalpha there. */
+
+#ifdef IN_RTS
#include <ctype.h>
+#define ISALPHA isalpha
+#endif
#elif defined (__Lynx__)
@@ -179,6 +187,8 @@ struct vstring
#if defined (_WIN32)
#include <dir.h>
#include <windows.h>
+#include <accctrl.h>
+#include <aclapi.h>
#undef DIR_SEPARATOR
#define DIR_SEPARATOR '\\'
#endif
@@ -974,7 +984,15 @@ __gnat_named_file_length (char *name)
void
__gnat_tmp_name (char *tmp_filename)
{
-#ifdef __MINGW32__
+#ifdef RTX
+ /* Variable used to create a series of unique names */
+ static int counter = 0;
+
+ /* RTX in RTSS mode does not support tempnam nor tmpnam so we emulate it */
+ strcpy (tmp_filename, "c:\\WINDOWS\\Temp\\gnat-");
+ sprintf (&tmp_filename[strlen (tmp_filename)], "%d\0", counter++);
+
+#elif defined (__MINGW32__)
{
char *pname;
@@ -1053,6 +1071,7 @@ __gnat_readdir (DIR *dirp, char *buffer, int *len)
/* Not supported in RTX */
return NULL;
+
#elif defined (__MINGW32__)
struct _tdirent *dirent = _treaddir ((_TDIR*)dirp);
@@ -1495,10 +1514,6 @@ __gnat_set_file_time_name (char *name, time_t time_stamp)
#endif
}
-#ifdef _WIN32
-#include <windows.h>
-#endif
-
/* Get the list of installed standard libraries from the
HKEY_LOCAL_MACHINE\SOFTWARE\Ada Core Technologies\GNAT\Standard Libraries
key. */
@@ -1598,7 +1613,7 @@ __gnat_stat (char *name, struct stat *statbuf)
int
__gnat_file_exists (char *name)
{
-#if defined (__MINGW32__) && !defined (RTX)
+#ifdef __MINGW32__
/* On Windows do not use __gnat_stat() because a bug in Microsoft
_stat() routine. When the system time-zone is set with a negative
offset the _stat() routine fails on specific files like CON: */
@@ -1642,7 +1657,7 @@ __gnat_is_absolute_path (char *name, int length)
return (length != 0) &&
(*name == '/' || *name == DIR_SEPARATOR
#if defined (__EMX__) || defined (MSDOS) || defined (WINNT)
- || (length > 1 && isalpha (name[0]) && name[1] == ':')
+ || (length > 1 && ISALPHA (name[0]) && name[1] == ':')
#endif
);
#endif
@@ -1668,69 +1683,295 @@ __gnat_is_directory (char *name)
return (!ret && S_ISDIR (statbuf.st_mode));
}
+#if defined (_WIN32) && !defined (RTX)
+/* This MingW section contains code to work with ACL. */
+static int
+__gnat_check_OWNER_ACL
+(TCHAR *wname,
+ DWORD CheckAccessDesired,
+ GENERIC_MAPPING CheckGenericMapping)
+{
+ DWORD dwAccessDesired, dwAccessAllowed;
+ PRIVILEGE_SET PrivilegeSet;
+ DWORD dwPrivSetSize = sizeof (PRIVILEGE_SET);
+ BOOL fAccessGranted = FALSE;
+ HANDLE hToken;
+ DWORD nLength;
+ SECURITY_DESCRIPTOR* pSD = NULL;
+
+ GetFileSecurity
+ (wname, OWNER_SECURITY_INFORMATION |
+ GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION,
+ NULL, 0, &nLength);
+
+ if ((pSD = (PSECURITY_DESCRIPTOR) HeapAlloc
+ (GetProcessHeap (), HEAP_ZERO_MEMORY, nLength)) == NULL)
+ return 0;
+
+ /* Obtain the security descriptor. */
+
+ if (!GetFileSecurity
+ (wname, OWNER_SECURITY_INFORMATION |
+ GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION,
+ pSD, nLength, &nLength))
+ return 0;
+
+ if (!ImpersonateSelf (SecurityImpersonation))
+ return 0;
+
+ if (!OpenThreadToken
+ (GetCurrentThread(), TOKEN_DUPLICATE | TOKEN_QUERY, FALSE, &hToken))
+ return 0;
+
+ /* Undoes the effect of ImpersonateSelf. */
+
+ RevertToSelf ();
+
+ /* We want to test for write permissions. */
+
+ dwAccessDesired = CheckAccessDesired;
+
+ MapGenericMask (&dwAccessDesired, &CheckGenericMapping);
+
+ if (!AccessCheck
+ (pSD , /* security descriptor to check */
+ hToken, /* impersonation token */
+ dwAccessDesired, /* requested access rights */
+ &CheckGenericMapping, /* pointer to GENERIC_MAPPING */
+ &PrivilegeSet, /* receives privileges used in check */
+ &dwPrivSetSize, /* size of PrivilegeSet buffer */
+ &dwAccessAllowed, /* receives mask of allowed access rights */
+ &fAccessGranted))
+ return 0;
+
+ return fAccessGranted;
+}
+
+static void
+__gnat_set_OWNER_ACL
+(TCHAR *wname,
+ DWORD AccessMode,
+ DWORD AccessPermissions)
+{
+ ACL* pOldDACL = NULL;
+ ACL* pNewDACL = NULL;
+ SECURITY_DESCRIPTOR* pSD = NULL;
+ EXPLICIT_ACCESS ea;
+ TCHAR username [100];
+ DWORD unsize = 100;
+
+ /* Get current user, he will act as the owner */
+
+ if (!GetUserName (username, &unsize))
+ return;
+
+ if (GetNamedSecurityInfo
+ (wname,
+ SE_FILE_OBJECT,
+ DACL_SECURITY_INFORMATION,
+ NULL, NULL, &pOldDACL, NULL, &pSD) != ERROR_SUCCESS)
+ return;
+
+ BuildExplicitAccessWithName
+ (&ea, username, AccessPermissions, AccessMode, NO_INHERITANCE);
+
+ if (AccessMode == SET_ACCESS)
+ {
+ /* SET_ACCESS, we want to set an explicte set of permissions, do not
+ merge with current DACL. */
+ if (SetEntriesInAcl (1, &ea, NULL, &pNewDACL) != ERROR_SUCCESS)
+ return;
+ }
+ else
+ if (SetEntriesInAcl (1, &ea, pOldDACL, &pNewDACL) != ERROR_SUCCESS)
+ return;
+
+ if (SetNamedSecurityInfo
+ (wname, SE_FILE_OBJECT,
+ DACL_SECURITY_INFORMATION, NULL, NULL, pNewDACL, NULL) != ERROR_SUCCESS)
+ return;
+
+ LocalFree (pSD);
+ LocalFree (pNewDACL);
+}
+#endif /* defined (_WIN32) && !defined (RTX) */
+
int
__gnat_is_readable_file (char *name)
{
+#if defined (_WIN32) && !defined (RTX)
+ TCHAR wname [GNAT_MAX_PATH_LEN + 2];
+ GENERIC_MAPPING GenericMapping;
+
+ S2WSU (wname, name, GNAT_MAX_PATH_LEN + 2);
+
+ ZeroMemory (&GenericMapping, sizeof (GENERIC_MAPPING));
+ GenericMapping.GenericRead = GENERIC_READ;
+
+ return __gnat_check_OWNER_ACL (wname, FILE_READ_DATA, GenericMapping);
+#else
int ret;
int mode;
struct stat statbuf;
- ret = __gnat_stat (name, &statbuf);
+ ret = stat (name, &statbuf);
mode = statbuf.st_mode & S_IRUSR;
return (!ret && mode);
+#endif
}
int
__gnat_is_writable_file (char *name)
{
+#if defined (_WIN32) && !defined (RTX)
+ TCHAR wname [GNAT_MAX_PATH_LEN + 2];
+ GENERIC_MAPPING GenericMapping;
+
+ S2WSU (wname, name, GNAT_MAX_PATH_LEN + 2);
+
+ ZeroMemory (&GenericMapping, sizeof (GENERIC_MAPPING));
+ GenericMapping.GenericWrite = GENERIC_WRITE;
+
+ return __gnat_check_OWNER_ACL
+ (wname, FILE_WRITE_DATA | FILE_APPEND_DATA, GenericMapping)
+ && !(GetFileAttributes (wname) & FILE_ATTRIBUTE_READONLY);
+#else
int ret;
int mode;
struct stat statbuf;
- ret = __gnat_stat (name, &statbuf);
+ ret = stat (name, &statbuf);
mode = statbuf.st_mode & S_IWUSR;
return (!ret && mode);
+#endif
+}
+
+int
+__gnat_is_executable_file (char *name)
+{
+#if defined (_WIN32) && !defined (RTX)
+ TCHAR wname [GNAT_MAX_PATH_LEN + 2];
+ GENERIC_MAPPING GenericMapping;
+
+ S2WSU (wname, name, GNAT_MAX_PATH_LEN + 2);
+
+ ZeroMemory (&GenericMapping, sizeof (GENERIC_MAPPING));
+ GenericMapping.GenericExecute = GENERIC_EXECUTE;
+
+ return __gnat_check_OWNER_ACL (wname, FILE_EXECUTE, GenericMapping);
+#else
+ int ret;
+ int mode;
+ struct stat statbuf;
+
+ ret = stat (name, &statbuf);
+ mode = statbuf.st_mode & S_IXUSR;
+ return (!ret && mode);
+#endif
}
void
__gnat_set_writable (char *name)
{
-#if ! defined (__vxworks) && ! defined(__nucleus__)
+#if defined (_WIN32) && !defined (RTX)
+ TCHAR wname [GNAT_MAX_PATH_LEN + 2];
+
+ S2WSU (wname, name, GNAT_MAX_PATH_LEN + 2);
+
+ __gnat_set_OWNER_ACL (wname, GRANT_ACCESS, FILE_GENERIC_WRITE);
+ SetFileAttributes
+ (wname, GetFileAttributes (wname) & ~FILE_ATTRIBUTE_READONLY);
+#elif ! defined (__vxworks) && ! defined(__nucleus__)
struct stat statbuf;
if (stat (name, &statbuf) == 0)
- {
- statbuf.st_mode = statbuf.st_mode | S_IWUSR;
- chmod (name, statbuf.st_mode);
- }
+ {
+ statbuf.st_mode = statbuf.st_mode | S_IWUSR;
+ chmod (name, statbuf.st_mode);
+ }
#endif
}
void
__gnat_set_executable (char *name)
{
-#if ! defined (__vxworks) && ! defined(__nucleus__)
+#if defined (_WIN32) && !defined (RTX)
+ TCHAR wname [GNAT_MAX_PATH_LEN + 2];
+
+ S2WSU (wname, name, GNAT_MAX_PATH_LEN + 2);
+
+ __gnat_set_OWNER_ACL (wname, GRANT_ACCESS, FILE_GENERIC_EXECUTE);
+#elif ! defined (__vxworks) && ! defined(__nucleus__)
struct stat statbuf;
if (stat (name, &statbuf) == 0)
- {
- statbuf.st_mode = statbuf.st_mode | S_IXUSR;
- chmod (name, statbuf.st_mode);
- }
+ {
+ statbuf.st_mode = statbuf.st_mode | S_IXUSR;
+ chmod (name, statbuf.st_mode);
+ }
#endif
}
void
-__gnat_set_readonly (char *name)
+__gnat_set_non_writable (char *name)
{
-#if ! defined (__vxworks) && ! defined(__nucleus__)
+#if defined (_WIN32) && !defined (RTX)
+ TCHAR wname [GNAT_MAX_PATH_LEN + 2];
+
+ S2WSU (wname, name, GNAT_MAX_PATH_LEN + 2);
+
+ __gnat_set_OWNER_ACL
+ (wname, DENY_ACCESS,
+ FILE_WRITE_DATA | FILE_APPEND_DATA |
+ FILE_WRITE_PROPERTIES | FILE_WRITE_ATTRIBUTES);
+ SetFileAttributes
+ (wname, GetFileAttributes (wname) | FILE_ATTRIBUTE_READONLY);
+#elif ! defined (__vxworks) && ! defined(__nucleus__)
struct stat statbuf;
if (stat (name, &statbuf) == 0)
- {
- statbuf.st_mode = statbuf.st_mode & 07577;
- chmod (name, statbuf.st_mode);
- }
+ {
+ statbuf.st_mode = statbuf.st_mode & 07577;
+ chmod (name, statbuf.st_mode);
+ }
+#endif
+}
+
+void
+__gnat_set_readable (char *name)
+{
+#if defined (_WIN32) && !defined (RTX)
+ TCHAR wname [GNAT_MAX_PATH_LEN + 2];
+
+ S2WSU (wname, name, GNAT_MAX_PATH_LEN + 2);
+
+ __gnat_set_OWNER_ACL (wname, GRANT_ACCESS, FILE_GENERIC_READ);
+#elif ! defined (__vxworks) && ! defined(__nucleus__)
+ struct stat statbuf;
+
+ if (stat (name, &statbuf) == 0)
+ {
+ chmod (name, statbuf.st_mode | S_IREAD);
+ }
+#endif
+}
+
+void
+__gnat_set_non_readable (char *name)
+{
+#if defined (_WIN32) && !defined (RTX)
+ TCHAR wname [GNAT_MAX_PATH_LEN + 2];
+
+ S2WSU (wname, name, GNAT_MAX_PATH_LEN + 2);
+
+ __gnat_set_OWNER_ACL (wname, DENY_ACCESS, FILE_GENERIC_READ);
+#elif ! defined (__vxworks) && ! defined(__nucleus__)
+ struct stat statbuf;
+
+ if (stat (name, &statbuf) == 0)
+ {
+ chmod (name, statbuf.st_mode & (~S_IREAD));
+ }
#endif
}
@@ -2996,7 +3237,7 @@ get_gcc_version (void)
int
__gnat_set_close_on_exec (int fd ATTRIBUTE_UNUSED,
- int close_on_exec_p ATTRIBUTE_UNUSED)
+ int close_on_exec_p ATTRIBUTE_UNUSED)
{
#if defined (F_GETFD) && defined (FD_CLOEXEC) && ! defined (__vxworks)
int flags = fcntl (fd, F_GETFD, 0);
@@ -3040,11 +3281,14 @@ __gnat_sals_init_using_constructors ()
#endif
}
+#ifdef RTX
+
/* In RTX mode, the procedure to get the time (as file time) is different
in RTSS mode and Win32 mode. In order to avoid duplicating an Ada file,
we introduce an intermediate procedure to link against the corresponding
one in each situation. */
-#ifdef RTX
+
+extern void GetTimeAsFileTime(LPFILETIME pTime);
void GetTimeAsFileTime(LPFILETIME pTime)
{
@@ -3054,6 +3298,16 @@ void GetTimeAsFileTime(LPFILETIME pTime)
GetSystemTimeAsFileTime (pTime); /* w32 interface */
#endif
}
+
+#ifdef RTSS
+/* Add symbol that is required to link. It would otherwise be taken from
+ libgcc.a and it would try to use the gcc constructors that are not
+ supported by Microsoft linker. */
+
+extern void __main (void);
+
+void __main (void) {}
+#endif
#endif
#if defined (linux) || defined(__GLIBC__)
diff --git a/gcc/ada/adaint.h b/gcc/ada/adaint.h
index 7b1e86df960..3c8abc54979 100644
--- a/gcc/ada/adaint.h
+++ b/gcc/ada/adaint.h
@@ -101,9 +101,12 @@ extern int __gnat_is_absolute_path (char *,int);
extern int __gnat_is_directory (char *);
extern int __gnat_is_writable_file (char *);
extern int __gnat_is_readable_file (char *name);
-extern void __gnat_set_readonly (char *name);
+extern int __gnat_is_executable_file (char *name);
+extern void __gnat_set_non_writable (char *name);
extern void __gnat_set_writable (char *name);
extern void __gnat_set_executable (char *name);
+extern void __gnat_set_readable (char *name);
+extern void __gnat_set_non_readable (char *name);
extern int __gnat_is_symbolic_link (char *name);
extern int __gnat_portable_spawn (char *[]);
extern int __gnat_portable_no_block_spawn (char *[]);
diff --git a/gcc/ada/argv.c b/gcc/ada/argv.c
index 276edf7e0f2..0adfa4ea948 100644
--- a/gcc/ada/argv.c
+++ b/gcc/ada/argv.c
@@ -6,7 +6,7 @@
* *
* C Implementation File *
* *
- * Copyright (C) 1992-2007, Free Software Foundation, Inc. *
+ * Copyright (C) 1992-2008, Free Software Foundation, Inc. *
* *
* GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- *
@@ -61,7 +61,7 @@ int gnat_argc = 0;
const char **gnat_argv = (const char **) 0;
const char **gnat_envp = (const char **) 0;
-#ifdef _WIN32
+#if defined (_WIN32) && !defined (RTX)
/* Note that on Windows environment the environ point to a buffer that could
be reallocated if needed. It means that gnat_envp needs to be updated
before using gnat_envp to point to the right environment space */
diff --git a/gcc/ada/arit64.c b/gcc/ada/arit64.c
new file mode 100644
index 00000000000..c21f67c9418
--- /dev/null
+++ b/gcc/ada/arit64.c
@@ -0,0 +1,58 @@
+/****************************************************************************
+ * *
+ * GNAT COMPILER COMPONENTS *
+ * *
+ * A R I T 6 4 . C *
+ * *
+ * C Implementation File *
+ * *
+ * Copyright (C) 2008, Free Software Foundation, Inc. *
+ * *
+ * GNAT is free software; you can redistribute it and/or modify it under *
+ * terms of the GNU General Public License as published by the Free Soft- *
+ * ware Foundation; either version 2, or (at your option) any later ver- *
+ * sion. GNAT is distributed in the hope that it will be useful, but WITH- *
+ * OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License *
+ * for more details. You should have received a copy of the GNU General *
+ * Public License distributed with GNAT; see file COPYING. If not, write *
+ * to the Free Software Foundation, 51 Franklin Street, Fifth Floor, *
+ * Boston, MA 02110-1301, USA. *
+ * *
+ * As a special exception, if you link this file with other files to *
+ * produce an executable, this file does not by itself cause the resulting *
+ * executable to be covered by the GNU General Public License. This except- *
+ * ion does not however invalidate any other reasons why the executable *
+ * file might be covered by the GNU Public License. *
+ * *
+ * GNAT was originally developed by the GNAT team at New York University. *
+ * Extensive contributions were provided by Ada Core Technologies Inc. *
+ * *
+ ****************************************************************************/
+
+extern void __gnat_rcheck_10(char *file, int line)
+ __attribute__ ((__noreturn__));
+
+long long int __gnat_mulv64 (long long int x, long long int y)
+{
+ unsigned neg = (x >= 0) ^ (y >= 0);
+ long long unsigned xa = x >= 0 ? (long long unsigned) x
+ : -(long long unsigned) x;
+ long long unsigned ya = y >= 0 ? (long long unsigned) y
+ : -(long long unsigned) y;
+ unsigned xhi = (unsigned) (xa >> 32);
+ unsigned yhi = (unsigned) (ya >> 32);
+ unsigned xlo = (unsigned) xa;
+ unsigned ylo = (unsigned) ya;
+ long long unsigned mid
+ = xhi ? (long long unsigned) xhi * (long long unsigned) ylo
+ : (long long unsigned) yhi * (long long unsigned) xlo;
+ long long unsigned low = (long long unsigned) xlo * (long long unsigned) ylo;
+
+ if ((xhi && yhi) || mid + (low >> 32) > 0x7fffffff + neg)
+ __gnat_rcheck_10 (__FILE__, __LINE__);
+
+ low += ((long long unsigned) (unsigned) mid) << 32;
+
+ return (long long int) (neg ? -low : low);
+}
diff --git a/gcc/ada/back_end.adb b/gcc/ada/back_end.adb
index a6600764988..7a4e4dadf0f 100644
--- a/gcc/ada/back_end.adb
+++ b/gcc/ada/back_end.adb
@@ -76,6 +76,7 @@ package body Back_End is
number_file : Nat;
file_info_ptr : Address;
+ gigi_standard_boolean : Entity_Id;
gigi_standard_integer : Entity_Id;
gigi_standard_long_long_float : Entity_Id;
gigi_standard_exception_type : Entity_Id;
@@ -112,6 +113,7 @@ package body Back_End is
number_file => Num_Source_Files,
file_info_ptr => File_Info_Array'Address,
+ gigi_standard_boolean => Standard_Boolean,
gigi_standard_integer => Standard_Integer,
gigi_standard_long_long_float => Standard_Long_Long_Float,
gigi_standard_exception_type => Standard_Exception_Type,
diff --git a/gcc/ada/bindgen.adb b/gcc/ada/bindgen.adb
index d29857fb5fc..070651cbd6a 100644
--- a/gcc/ada/bindgen.adb
+++ b/gcc/ada/bindgen.adb
@@ -127,38 +127,37 @@ package body Bindgen is
-- Default_Stack_Size : Integer;
-- Leap_Seconds_Support : Integer;
- -- Main_Priority is the priority value set by pragma Priority in the
- -- main program. If no such pragma is present, the value is -1.
-
- -- Time_Slice_Value is the time slice value set by pragma Time_Slice
- -- in the main program, or by the use of a -Tnnn parameter for the
- -- binder (if both are present, the binder value overrides). The
- -- value is in milliseconds. A value of zero indicates that time
- -- slicing should be suppressed. If no pragma is present, and no
- -- -T switch was used, the value is -1.
-
- -- WC_Encoding shows the wide character encoding method used for
- -- the main program. This is one of the encoding letters defined
- -- in System.WCh_Con.WC_Encoding_Letters.
-
- -- Locking_Policy is a space if no locking policy was specified
- -- for the partition. If a locking policy was specified, the value
- -- is the upper case first character of the locking policy name,
- -- for example, 'C' for Ceiling_Locking.
-
- -- Queuing_Policy is a space if no queuing policy was specified
- -- for the partition. If a queuing policy was specified, the value
- -- is the upper case first character of the queuing policy name
- -- for example, 'F' for FIFO_Queuing.
-
- -- Task_Dispatching_Policy is a space if no task dispatching policy
- -- was specified for the partition. If a task dispatching policy
- -- was specified, the value is the upper case first character of
- -- the policy name, e.g. 'F' for FIFO_Within_Priorities.
-
- -- Priority_Specific_Dispatching is the address of a string used to
- -- store the task dispatching policy specified for the different priorities
- -- in the partition. The length of this string is determined by the last
+ -- Main_Priority is the priority value set by pragma Priority in the main
+ -- program. If no such pragma is present, the value is -1.
+
+ -- Time_Slice_Value is the time slice value set by pragma Time_Slice in the
+ -- main program, or by the use of a -Tnnn parameter for the binder (if both
+ -- are present, the binder value overrides). The value is in milliseconds.
+ -- A value of zero indicates that time slicing should be suppressed. If no
+ -- pragma is present, and no -T switch was used, the value is -1.
+
+ -- WC_Encoding shows the wide character encoding method used for the main
+ -- program. This is one of the encoding letters defined in
+ -- System.WCh_Con.WC_Encoding_Letters.
+
+ -- Locking_Policy is a space if no locking policy was specified for the
+ -- partition. If a locking policy was specified, the value is the upper
+ -- case first character of the locking policy name, for example, 'C' for
+ -- Ceiling_Locking.
+
+ -- Queuing_Policy is a space if no queuing policy was specified for the
+ -- partition. If a queuing policy was specified, the value is the upper
+ -- case first character of the queuing policy name for example, 'F' for
+ -- FIFO_Queuing.
+
+ -- Task_Dispatching_Policy is a space if no task dispatching policy was
+ -- specified for the partition. If a task dispatching policy was specified,
+ -- the value is the upper case first character of the policy name, e.g. 'F'
+ -- for FIFO_Within_Priorities.
+
+ -- Priority_Specific_Dispatching is the address of a string used to store
+ -- the task dispatching policy specified for the different priorities in
+ -- the partition. The length of this string is determined by the last
-- priority for which such a pragma applies (the string will be a null
-- string if no specific dispatching policies were used). If pragma were
-- present, the entries apply to the priorities in sequence from the first
@@ -182,12 +181,12 @@ package body Bindgen is
-- such a pragma is given (the string will be a null string if no pragmas
-- were used). If pragma were present the entries apply to the interrupts
-- in sequence from the first interrupt, and are set to one of four
- -- possible settings: 'n' for not specified, 'u' for user, 'r' for
- -- run time, 's' for system, see description of Interrupt_State pragma
- -- for further details.
+ -- possible settings: 'n' for not specified, 'u' for user, 'r' for run
+ -- time, 's' for system, see description of Interrupt_State pragma for
+ -- further details.
- -- Num_Interrupt_States is the length of the Interrupt_States string.
- -- It will be set to zero if no Interrupt_State pragmas are present.
+ -- Num_Interrupt_States is the length of the Interrupt_States string. It
+ -- will be set to zero if no Interrupt_State pragmas are present.
-- Unreserve_All_Interrupts is set to one if at least one unit in the
-- partition had a pragma Unreserve_All_Interrupts, and zero otherwise.
@@ -201,13 +200,12 @@ package body Bindgen is
-- this partition, and to zero if longjmp/setjmp exceptions are used.
-- the use of zero
- -- Detect_Blocking indicates whether pragma Detect_Blocking is
- -- active or not. A value of zero indicates that the pragma is not
- -- present, while a value of 1 signals its presence in the
- -- partition.
+ -- Detect_Blocking indicates whether pragma Detect_Blocking is active or
+ -- not. A value of zero indicates that the pragma is not present, while a
+ -- value of 1 signals its presence in the partition.
- -- Default_Stack_Size is the default stack size used when creating an
- -- Ada task with no explicit Storize_Size clause.
+ -- Default_Stack_Size is the default stack size used when creating an Ada
+ -- task with no explicit Storize_Size clause.
-- Leap_Seconds_Support denotes whether leap seconds have been enabled or
-- disabled. A value of zero indicates that leap seconds are turned "off",
diff --git a/gcc/ada/checks.adb b/gcc/ada/checks.adb
index aea61397dc9..40e3057001f 100644
--- a/gcc/ada/checks.adb
+++ b/gcc/ada/checks.adb
@@ -470,7 +470,11 @@ package body Checks is
-- Apply_Accessibility_Check --
-------------------------------
- procedure Apply_Accessibility_Check (N : Node_Id; Typ : Entity_Id) is
+ procedure Apply_Accessibility_Check
+ (N : Node_Id;
+ Typ : Entity_Id;
+ Insert_Node : Node_Id)
+ is
Loc : constant Source_Ptr := Sloc (N);
Param_Ent : constant Entity_Id := Param_Entity (N);
Param_Level : Node_Id;
@@ -501,7 +505,7 @@ package body Checks is
-- Raise Program_Error if the accessibility level of the the access
-- parameter is deeper than the level of the target access type.
- Insert_Action (N,
+ Insert_Action (Insert_Node,
Make_Raise_Program_Error (Loc,
Condition =>
Make_Op_Gt (Loc,
@@ -1629,11 +1633,36 @@ package body Checks is
end;
end if;
- -- Get the bounds of the target type
+ -- Get the (static) bounds of the target type
Ifirst := Expr_Value (LB);
Ilast := Expr_Value (HB);
+ -- A simple optimization: if the expression is a universal literal,
+ -- we can do the comparison with the bounds and the conversion to
+ -- an integer type statically. The range checks are unchanged.
+
+ if Nkind (Ck_Node) = N_Real_Literal
+ and then Etype (Ck_Node) = Universal_Real
+ and then Is_Integer_Type (Target_Typ)
+ and then Nkind (Parent (Ck_Node)) = N_Type_Conversion
+ then
+ declare
+ Int_Val : constant Uint := UR_To_Uint (Realval (Ck_Node));
+
+ begin
+ if Int_Val <= Ilast and then Int_Val >= Ifirst then
+
+ -- Conversion is safe
+
+ Rewrite (Parent (Ck_Node),
+ Make_Integer_Literal (Loc, UI_To_Int (Int_Val)));
+ Analyze_And_Resolve (Parent (Ck_Node), Target_Typ);
+ return;
+ end if;
+ end;
+ end if;
+
-- Check against lower bound
if Truncate and then Ifirst > 0 then
@@ -2842,11 +2871,7 @@ package body Checks is
-- be applied to a [sub]type that does not exclude null already.
elsif Can_Never_Be_Null (Typ)
-
- -- No need to check itypes that have a null exclusion because
- -- they are already examined at their point of creation.
-
- and then not Is_Itype (Typ)
+ and then Comes_From_Source (Typ)
then
Error_Msg_NE
("`NOT NULL` not allowed (& already excludes null)",
@@ -5277,10 +5302,20 @@ package body Checks is
-- If known to be null, here is where we generate a compile time check
if Known_Null (N) then
- Apply_Compile_Time_Constraint_Error
- (N,
- "null value not allowed here?",
- CE_Access_Check_Failed);
+
+ -- Avoid generating warning message inside init procs
+
+ if not Inside_Init_Proc then
+ Apply_Compile_Time_Constraint_Error
+ (N,
+ "null value not allowed here?",
+ CE_Access_Check_Failed);
+ else
+ Insert_Action (N,
+ Make_Raise_Constraint_Error (Loc,
+ Reason => CE_Access_Check_Failed));
+ end if;
+
Mark_Non_Null;
return;
end if;
diff --git a/gcc/ada/checks.ads b/gcc/ada/checks.ads
index 0c9049471b4..4a721021823 100644
--- a/gcc/ada/checks.ads
+++ b/gcc/ada/checks.ads
@@ -102,11 +102,15 @@ package Checks is
-- Determines whether an expression node requires a runtime access
-- check and if so inserts the appropriate run-time check.
- procedure Apply_Accessibility_Check (N : Node_Id; Typ : Entity_Id);
+ procedure Apply_Accessibility_Check
+ (N : Node_Id;
+ Typ : Entity_Id;
+ Insert_Node : Node_Id);
-- Given a name N denoting an access parameter, emits a run-time
-- accessibility check (if necessary), checking that the level of
-- the object denoted by the access parameter is not deeper than the
-- level of the type Typ. Program_Error is raised if the check fails.
+ -- Insert_Node indicates the node where the check should be inserted.
procedure Apply_Address_Clause_Check (E : Entity_Id; N : Node_Id);
-- E is the entity for an object which has an address clause. If checks
@@ -132,7 +136,7 @@ package Checks is
No_Sliding : Boolean := False);
-- Top-level procedure, calls all the others depending on the class of Typ.
-- Checks that expression N verifies the constraint of type Typ. No_Sliding
- -- is only relevant for constrained array types, id set to true, it
+ -- is only relevant for constrained array types, if set to True, it
-- checks that indexes are in range.
procedure Apply_Discriminant_Check
diff --git a/gcc/ada/cio.c b/gcc/ada/cio.c
index 6fba5a0b0cb..67dcfc3dd36 100644
--- a/gcc/ada/cio.c
+++ b/gcc/ada/cio.c
@@ -6,7 +6,7 @@
* *
* C Implementation File *
* *
- * Copyright (C) 1992-2005, Free Software Foundation, Inc. *
+ * Copyright (C) 1992-2008, Free Software Foundation, Inc. *
* *
* GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- *
@@ -56,6 +56,11 @@
#undef getchar
#endif
+#ifdef RTX
+#include <windows.h>
+#include <Rtapi.h>
+#endif
+
int
get_char (void)
{
@@ -78,27 +83,43 @@ get_int (void)
void
put_int (int x)
{
+#ifdef RTX
+ RtPrintf ("%d", x);
+#else
/* Use fprintf rather than printf, since the latter is unbuffered
on vxworks */
fprintf (stdout, "%d", x);
+#endif
}
void
put_int_stderr (int x)
{
+#ifdef RTX
+ RtPrintf ("%d", x);
+#else
fprintf (stderr, "%d", x);
+#endif
}
void
put_char (int c)
{
+#ifdef RTX
+ RtPrintf ("%c", c);
+#else
putchar (c);
+#endif
}
void
put_char_stderr (int c)
{
+#ifdef RTX
+ RtPrintf ("%c", c);
+#else
fputc (c, stderr);
+#endif
}
#ifdef __vxworks
diff --git a/gcc/ada/clean.adb b/gcc/ada/clean.adb
index 5db4c4efc67..30aa9a45c41 100644
--- a/gcc/ada/clean.adb
+++ b/gcc/ada/clean.adb
@@ -826,9 +826,6 @@ package body Clean is
Index2 : Int;
Lib_File : File_Name_Type;
- Source_Id : Other_Source_Id;
- Source : Other_Source;
-
Global_Archive : Boolean := False;
begin
@@ -881,7 +878,7 @@ package body Clean is
-- Source_Dirs or Source_Files is specified as an empty list,
-- so always look for Ada units in extending projects.
- if Data.Langs (Ada_Language_Index)
+ if Data.Ada_Sources_Present
or else Data.Extends /= No_Project
then
for Unit in Unit_Table.First ..
@@ -1044,40 +1041,6 @@ package body Clean is
end if;
end if;
- if Data.Other_Sources_Present then
-
- -- There is non-Ada code: delete the object files and
- -- the dependency files if they exist.
-
- Source_Id := Data.First_Other_Source;
- while Source_Id /= No_Other_Source loop
- Source :=
- Project_Tree.Other_Sources.Table (Source_Id);
-
- if Is_Regular_File
- (Get_Name_String (Source.Object_Name))
- then
- Delete (Obj_Dir, Get_Name_String (Source.Object_Name));
- end if;
-
- if
- Is_Regular_File (Get_Name_String (Source.Dep_Name))
- then
- Delete (Obj_Dir, Get_Name_String (Source.Dep_Name));
- end if;
-
- Source_Id := Source.Next;
- end loop;
-
- -- If it is a library with only non Ada sources, delete
- -- the fake archive and the dependency file, if they exist.
-
- if Data.Library
- and then not Data.Langs (Ada_Language_Index)
- then
- Clean_Archive (Project, Global => False);
- end if;
- end if;
end;
end if;
diff --git a/gcc/ada/config-lang.in b/gcc/ada/config-lang.in
index e5922d5c905..ad76864cd61 100644
--- a/gcc/ada/config-lang.in
+++ b/gcc/ada/config-lang.in
@@ -1,11 +1,11 @@
# Top level configure fragment for GNU Ada (GNAT).
-# Copyright (C) 1994-2003, 2007 Free Software Foundation, Inc.
+# Copyright (C) 1994-2008 Free Software Foundation, Inc.
#This file is part of GCC.
#GCC is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
-#the Free Software Foundation; either version 3, or (at your option)
+#the Free Software Foundation; either version 2, or (at your option)
#any later version.
#GCC is distributed in the hope that it will be useful,
@@ -14,28 +14,15 @@
#GNU General Public License for more details.
#You should have received a copy of the GNU General Public License
-#along with GCC; see the file COPYING3. If not see
-#<http://www.gnu.org/licenses/>.
-
-# Configure looks for the existence of this file to auto-config each language.
-# We define several parameters used by configure:
-#
-# language - name of language as it would appear in $(LANGUAGES)
-# boot_language - "yes" if we need to build this language in stage1
-# compilers - value to add to $(COMPILERS)
+#along with GCC; see the file COPYING. If not, write to
+#the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+#Boston, MA 02110-1301, USA.
language="ada"
-boot_language=yes
-boot_language_boot_flags='ADAFLAGS="$(BOOT_ADAFLAGS)"'
-
-compilers="gnat1\$(exeext)"
-
-gtfiles="\$(srcdir)/ada/ada-tree.h \$(srcdir)/ada/gigi.h \$(srcdir)/ada/decl.c \$(srcdir)/ada/trans.c \$(srcdir)/ada/utils.c"
-
-outputs=ada/Makefile
-
-target_libs="target-libada"
-lang_dirs="gnattools"
+gcc_subdir="ada/gcc-interface"
-# Ada will not work until the front end starts emitting GIMPLE trees.
-build_by_default=no
+if [ -f ${srcdir}/gcc/ada/gcc-interface/config-lang.in ]; then
+ . ${srcdir}/gcc/ada/gcc-interface/config-lang.in
+else
+ . ${srcdir}/ada/gcc-interface/config-lang.in
+fi
diff --git a/gcc/ada/cstreams.c b/gcc/ada/cstreams.c
index fe81bcbe97e..79dde9331c0 100644
--- a/gcc/ada/cstreams.c
+++ b/gcc/ada/cstreams.c
@@ -6,7 +6,7 @@
* *
* Auxiliary C functions for Interfaces.C.Streams *
* *
- * Copyright (C) 1992-2007, Free Software Foundation, Inc. *
+ * Copyright (C) 1992-2008, Free Software Foundation, Inc. *
* *
* GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- *
@@ -156,7 +156,18 @@ __gnat_constant_stdout (void)
char *
__gnat_full_name (char *nam, char *buffer)
{
-#if defined(__EMX__) || defined (__MINGW32__)
+#ifdef RTSS
+ /* RTSS applications have no current-directory notion, so RTSS file I/O
+ requests must use fully qualified path names, such as:
+ c:\temp\MyFile.txt (for a file system object)
+ \\.\MyDevice0 (for a device object)
+ */
+ if (nam[1] == ':' || nam[0] == '\\')
+ strcpy (buffer, nam);
+ else
+ buffer[0] = '\0';
+
+#elif defined(__EMX__) || defined (__MINGW32__)
/* If this is a device file return it as is; under Windows NT and
OS/2 a device file end with ":". */
if (nam[strlen (nam) - 1] == ':')
diff --git a/gcc/ada/directio.ads b/gcc/ada/directio.ads
index b69ca4467e1..c09f77270b9 100644
--- a/gcc/ada/directio.ads
+++ b/gcc/ada/directio.ads
@@ -15,9 +15,9 @@
pragma Ada_2005;
-- Explicit setting of Ada 2005 mode is required here, since we want to with a
--- child unit (not possible in Ada 83 mode), and Text_IO is not considered to
--- be an internal unit that is automatically compiled in Ada 2005 mode (since
--- a user is allowed to redeclare Direct_IO).
+-- child unit (not possible in Ada 83 mode), and Direct_IO is not considered
+-- to be an internal unit that is automatically compiled in Ada 2005 mode
+-- (since a user is allowed to redeclare Direct_IO).
with Ada.Direct_IO;
diff --git a/gcc/ada/einfo.adb b/gcc/ada/einfo.adb
index 49dffae047b..255b7a0cdcc 100644
--- a/gcc/ada/einfo.adb
+++ b/gcc/ada/einfo.adb
@@ -504,9 +504,8 @@ package body Einfo is
-- Optimize_Alignment_Time Flag242
-- Overlays_Constant Flag243
-- Is_RACW_Stub_Type Flag244
+ -- Is_Private_Primitive Flag245
- -- (unused) Flag169
- -- (unused) Flag245
-- (unused) Flag246
-- (unused) Flag247
@@ -1929,7 +1928,8 @@ package body Einfo is
function Is_Primitive_Wrapper (Id : E) return B is
begin
- pragma Assert (Ekind (Id) = E_Procedure);
+ pragma Assert (Ekind (Id) = E_Function
+ or else Ekind (Id) = E_Procedure);
return Flag195 (Id);
end Is_Primitive_Wrapper;
@@ -1944,6 +1944,13 @@ package body Einfo is
return Flag53 (Id);
end Is_Private_Descendant;
+ function Is_Private_Primitive (Id : E) return B is
+ begin
+ pragma Assert (Ekind (Id) = E_Function
+ or else Ekind (Id) = E_Procedure);
+ return Flag245 (Id);
+ end Is_Private_Primitive;
+
function Is_Protected_Interface (Id : E) return B is
begin
pragma Assert (Is_Interface (Id));
@@ -2572,7 +2579,7 @@ package body Einfo is
function Spec_PPC_List (Id : E) return N is
begin
- pragma Assert (Is_Subprogram (Id));
+ pragma Assert (Is_Subprogram (Id) or else Is_Generic_Subprogram (Id));
return Node24 (Id);
end Spec_PPC_List;
@@ -2702,8 +2709,9 @@ package body Einfo is
function Wrapped_Entity (Id : E) return E is
begin
- pragma Assert (Ekind (Id) = E_Procedure
- and then Is_Primitive_Wrapper (Id));
+ pragma Assert ((Ekind (Id) = E_Function
+ or else Ekind (Id) = E_Procedure)
+ and then Is_Primitive_Wrapper (Id));
return Node27 (Id);
end Wrapped_Entity;
@@ -4372,7 +4380,8 @@ package body Einfo is
procedure Set_Is_Primitive_Wrapper (Id : E; V : B := True) is
begin
- pragma Assert (Ekind (Id) = E_Procedure);
+ pragma Assert (Ekind (Id) = E_Function
+ or else Ekind (Id) = E_Procedure);
Set_Flag195 (Id, V);
end Set_Is_Primitive_Wrapper;
@@ -4387,6 +4396,13 @@ package body Einfo is
Set_Flag53 (Id, V);
end Set_Is_Private_Descendant;
+ procedure Set_Is_Private_Primitive (Id : E; V : B := True) is
+ begin
+ pragma Assert (Ekind (Id) = E_Function
+ or else Ekind (Id) = E_Procedure);
+ Set_Flag245 (Id, V);
+ end Set_Is_Private_Primitive;
+
procedure Set_Is_Protected_Interface (Id : E; V : B := True) is
begin
pragma Assert (Is_Interface (Id));
@@ -5028,7 +5044,7 @@ package body Einfo is
procedure Set_Spec_PPC_List (Id : E; V : N) is
begin
- pragma Assert (Is_Subprogram (Id));
+ pragma Assert (Is_Subprogram (Id) or else Is_Generic_Subprogram (Id));
Set_Node24 (Id, V);
end Set_Spec_PPC_List;
@@ -5168,8 +5184,9 @@ package body Einfo is
procedure Set_Wrapped_Entity (Id : E; V : E) is
begin
- pragma Assert (Ekind (Id) = E_Procedure
- and then Is_Primitive_Wrapper (Id));
+ pragma Assert ((Ekind (Id) = E_Function
+ or else Ekind (Id) = E_Procedure)
+ and then Is_Primitive_Wrapper (Id));
Set_Node27 (Id, V);
end Set_Wrapped_Entity;
@@ -7597,9 +7614,11 @@ package body Einfo is
W ("Is_Packed_Array_Type", Flag138 (Id));
W ("Is_Potentially_Use_Visible", Flag9 (Id));
W ("Is_Preelaborated", Flag59 (Id));
+ W ("Is_Primitive", Flag218 (Id));
W ("Is_Primitive_Wrapper", Flag195 (Id));
W ("Is_Private_Composite", Flag107 (Id));
W ("Is_Private_Descendant", Flag53 (Id));
+ W ("Is_Private_Primitive", Flag245 (Id));
W ("Is_Protected_Interface", Flag198 (Id));
W ("Is_Public", Flag10 (Id));
W ("Is_Pure", Flag44 (Id));
@@ -7666,7 +7685,6 @@ package body Einfo is
W ("Suppress_Init_Proc", Flag105 (Id));
W ("Suppress_Style_Checks", Flag165 (Id));
W ("Suppress_Value_Tracking_On_Call", Flag217 (Id));
- W ("Is_Primitive", Flag218 (Id));
W ("Treat_As_Volatile", Flag41 (Id));
W ("Universal_Aliasing", Flag216 (Id));
W ("Used_As_Generic_Actual", Flag222 (Id));
diff --git a/gcc/ada/einfo.ads b/gcc/ada/einfo.ads
index 43e0e17ab1d..c7182dbe04f 100644
--- a/gcc/ada/einfo.ads
+++ b/gcc/ada/einfo.ads
@@ -2513,9 +2513,9 @@ package Einfo is
-- indicators in bodies.
-- Is_Primitive_Wrapper (Flag195)
--- Present in all entities. Set for procedure entries that are used as
--- primitive wrappers. which are generated by the expander to wrap
--- entries of protected or task types implementing a limited interface.
+-- Present in functions and procedures created by the expander to serve
+-- as an indirection mechanism to overriding primitives of concurrent
+-- types, entries and protected procedures.
-- Is_Prival (synthesized)
-- Applies to all entities, true for renamings of private protected
@@ -2533,6 +2533,10 @@ package Einfo is
-- functions, procedures). Set if the library unit is itself a private
-- child unit, or if it is the descendent of a private child unit.
+-- Is_Private_Primitive (Flag245)
+-- Present in subprograms. Set if the first parameter of the subprogram
+-- is of concurrent tagged type with a private view.
+
-- Is_Private_Type (synthesized)
-- Applies to all entities, true for private types and subtypes,
-- as well as for record with private types as subtypes
@@ -3523,10 +3527,11 @@ package Einfo is
-- the corresponding parameter entities in the spec.
-- Spec_PPC_List (Node24)
--- Present in subprogram entities. Points to a list of Precondition
--- and Postcondition N_Pragma nodes for preconditions and postconditions
--- declared in the spec. The last pragma encountered is at the head of
--- this list, so it is in reverse order of textual appearance.
+-- Present in subprogram and generic subprogram entities. Points to a
+-- list of Precondition and Postcondition pragma nodes for preconditions
+-- and postconditions declared in the spec. The last pragma encountered
+-- is at the head of this list, so it is in reverse order of textual
+-- appearance.
-- Storage_Size_Variable (Node15) [implementation base type only]
-- Present in access types and task type entities. This flag is set
@@ -3723,8 +3728,8 @@ package Einfo is
-- attribute when the limited-view is installed (Ada 2005: AI-217).
-- Wrapped_Entity (Node27)
--- Present in an E_Procedure classified as an Is_Primitive_Wrapper. Set
--- to the entity that is being wrapped.
+-- Present in functions and procedures which have been classified as
+-- Is_Primitive_Wrapper. Set to the entity being wrapper.
------------------
-- Access Kinds --
@@ -5013,6 +5018,7 @@ package Einfo is
-- Protection_Object (Node23) (for concurrent kind)
-- Interface_Alias (Node25)
-- Overridden_Operation (Node26)
+ -- Wrapped_Entity (Node27) (non-generic case only)
-- Extra_Formals (Node28)
-- Body_Needed_For_SAL (Flag40)
-- Elaboration_Entity_Required (Flag174)
@@ -5039,7 +5045,9 @@ package Einfo is
-- Is_Machine_Code_Subprogram (Flag137) (non-generic case only)
-- Is_Overriding_Operation (Flag39) (non-generic case only)
-- Is_Primitive (Flag218)
+ -- Is_Primitive_Wrapper (Flag195) (non-generic case only)
-- Is_Private_Descendant (Flag53)
+ -- Is_Private_Primitive (Flag245) (non-generic case only)
-- Is_Pure (Flag44)
-- Is_Thunk (Flag225)
-- Is_Visible_Child_Unit (Flag116)
@@ -5270,7 +5278,7 @@ package Einfo is
-- Generic_Renamings (Elist23) (for instance)
-- Inner_Instances (Elist23) (for generic proc)
-- Protection_Object (Node23) (for concurrent kind)
- -- Spec_PPC_List (Node24) (non-generic case only)
+ -- Spec_PPC_List (Node24)
-- Interface_Alias (Node25)
-- Static_Initialization (Node26) (init_proc only)
-- Overridden_Operation (Node26)
@@ -5305,6 +5313,7 @@ package Einfo is
-- Is_Primitive (Flag218)
-- Is_Primitive_Wrapper (Flag195) (non-generic case only)
-- Is_Private_Descendant (Flag53)
+ -- Is_Private_Primitive (Flag245) (non-generic case only)
-- Is_Pure (Flag44)
-- Is_Thunk (Flag225)
-- Is_Valued_Procedure (Flag127)
@@ -5974,6 +5983,7 @@ package Einfo is
function Is_Primitive_Wrapper (Id : E) return B;
function Is_Private_Composite (Id : E) return B;
function Is_Private_Descendant (Id : E) return B;
+ function Is_Private_Primitive (Id : E) return B;
function Is_Protected_Interface (Id : E) return B;
function Is_Public (Id : E) return B;
function Is_Pure (Id : E) return B;
@@ -6538,6 +6548,7 @@ package Einfo is
procedure Set_Is_Primitive_Wrapper (Id : E; V : B := True);
procedure Set_Is_Private_Composite (Id : E; V : B := True);
procedure Set_Is_Private_Descendant (Id : E; V : B := True);
+ procedure Set_Is_Private_Primitive (Id : E; V : B := True);
procedure Set_Is_Protected_Interface (Id : E; V : B := True);
procedure Set_Is_Public (Id : E; V : B := True);
procedure Set_Is_Pure (Id : E; V : B := True);
@@ -7216,6 +7227,7 @@ package Einfo is
pragma Inline (Is_Primitive_Wrapper);
pragma Inline (Is_Private_Composite);
pragma Inline (Is_Private_Descendant);
+ pragma Inline (Is_Private_Primitive);
pragma Inline (Is_Private_Type);
pragma Inline (Is_Protected_Interface);
pragma Inline (Is_Protected_Type);
@@ -7609,6 +7621,7 @@ package Einfo is
pragma Inline (Set_Is_Primitive_Wrapper);
pragma Inline (Set_Is_Private_Composite);
pragma Inline (Set_Is_Private_Descendant);
+ pragma Inline (Set_Is_Private_Primitive);
pragma Inline (Set_Is_Protected_Interface);
pragma Inline (Set_Is_Public);
pragma Inline (Set_Is_Pure);
diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb
index 40ff3796671..bc3b954fb6c 100644
--- a/gcc/ada/exp_aggr.adb
+++ b/gcc/ada/exp_aggr.adb
@@ -28,6 +28,7 @@ with Checks; use Checks;
with Debug; use Debug;
with Einfo; use Einfo;
with Elists; use Elists;
+with Errout; use Errout;
with Expander; use Expander;
with Exp_Util; use Exp_Util;
with Exp_Ch3; use Exp_Ch3;
@@ -169,12 +170,15 @@ package body Exp_Aggr is
-- Local Subprograms for Array Aggregate Expansion --
-----------------------------------------------------
- function Aggr_Size_OK (Typ : Entity_Id) return Boolean;
+ function Aggr_Size_OK (N : Node_Id; Typ : Entity_Id) return Boolean;
-- Very large static aggregates present problems to the back-end, and
-- are transformed into assignments and loops. This function verifies
-- that the total number of components of an aggregate is acceptable
-- for transformation into a purely positional static form. It is called
-- prior to calling Flatten.
+ -- This function also detects and warns about one-component aggregates
+ -- that appear in a non-static context. Even if the component value is
+ -- static, such an aggregate must be expanded into an assignment.
procedure Convert_Array_Aggr_In_Allocator
(Decl : Node_Id;
@@ -291,7 +295,7 @@ package body Exp_Aggr is
-- Aggr_Size_OK --
------------------
- function Aggr_Size_OK (Typ : Entity_Id) return Boolean is
+ function Aggr_Size_OK (N : Node_Id; Typ : Entity_Id) return Boolean is
Lo : Node_Id;
Hi : Node_Id;
Indx : Node_Id;
@@ -399,6 +403,43 @@ package body Exp_Aggr is
return True;
end if;
+ -- One-component aggregates are suspicious, and if the context type
+ -- is an object declaration with non-static bounds it will trip gcc;
+ -- such an aggregate must be expanded into a single assignment.
+
+ if Hiv = Lov
+ and then Nkind (Parent (N)) = N_Object_Declaration
+ then
+ declare
+ Index_Type : constant Entity_Id :=
+ Etype
+ (First_Index
+ (Etype (Defining_Identifier (Parent (N)))));
+ Indx : Node_Id;
+
+ begin
+ if not Compile_Time_Known_Value (Type_Low_Bound (Index_Type))
+ or else not Compile_Time_Known_Value
+ (Type_High_Bound (Index_Type))
+ then
+ if Present (Component_Associations (N)) then
+ Indx :=
+ First (Choices (First (Component_Associations (N))));
+ if Is_Entity_Name (Indx)
+ and then not Is_Type (Entity (Indx))
+ then
+ Error_Msg_N
+ ("single component aggregate in non-static context?",
+ Indx);
+ Error_Msg_N ("\maybe subtype name was meant?", Indx);
+ end if;
+ end if;
+
+ return False;
+ end if;
+ end;
+ end if;
+
declare
Rng : constant Uint := Hiv - Lov + 1;
@@ -2395,8 +2436,12 @@ package body Exp_Aggr is
-- to the actual type of the aggregate, so that the proper components
-- are visible. We know already that the types are compatible.
+ -- There should also be a comment here explaining why the conversion
+ -- is needed in the case of interfaces.???
+
if Present (Etype (Lhs))
- and then Is_Interface (Etype (Lhs))
+ and then (Is_Interface (Etype (Lhs))
+ or else Is_Class_Wide_Type (Etype (Lhs)))
then
Target := Unchecked_Convert_To (Typ, Lhs);
else
@@ -3847,7 +3892,7 @@ package body Exp_Aggr is
-- assignments to the target anyway, but it is conceivable that
-- it will eventually be able to treat such aggregates statically???
- if Aggr_Size_OK (Typ)
+ if Aggr_Size_OK (N, Typ)
and then Flatten (N, First_Index (Typ), First_Index (Base_Type (Typ)))
then
if Static_Components then
@@ -6383,7 +6428,7 @@ package body Exp_Aggr is
elsif Nkind (Expression (Expr)) /= N_Integer_Literal then
return False;
- elsif not Aggr_Size_OK (Typ) then
+ elsif not Aggr_Size_OK (N, Typ) then
return False;
end if;
diff --git a/gcc/ada/exp_attr.adb b/gcc/ada/exp_attr.adb
index 1637863cf45..80cd34d5593 100644
--- a/gcc/ada/exp_attr.adb
+++ b/gcc/ada/exp_attr.adb
@@ -33,6 +33,7 @@ with Exp_Ch2; use Exp_Ch2;
with Exp_Ch3; use Exp_Ch3;
with Exp_Ch6; use Exp_Ch6;
with Exp_Ch9; use Exp_Ch9;
+with Exp_Dist; use Exp_Dist;
with Exp_Imgv; use Exp_Imgv;
with Exp_Pakd; use Exp_Pakd;
with Exp_Strm; use Exp_Strm;
@@ -635,6 +636,14 @@ package body Exp_Attr is
Make_Build_In_Place_Call_In_Anonymous_Context (Pref);
end if;
+ -- If prefix is a protected type name, this is a reference to
+ -- the current instance of the type.
+
+ if Is_Protected_Self_Reference (Pref) then
+ Rewrite (Pref, Concurrent_Ref (Pref));
+ Analyze (Pref);
+ end if;
+
-- Remaining processing depends on specific attribute
case Id is
@@ -651,6 +660,37 @@ package body Exp_Attr is
Btyp_DDT : constant Entity_Id := Directly_Designated_Type (Btyp);
Ref_Object : constant Node_Id := Get_Referenced_Object (Pref);
+ function Enclosing_Object (N : Node_Id) return Node_Id;
+ -- If N denotes a compound name (selected component, indexed
+ -- component, or slice), returns the name of the outermost
+ -- such enclosing object. Otherwise returns N. If the object
+ -- is a renaming, then the renamed object is returned.
+
+ ----------------------
+ -- Enclosing_Object --
+ ----------------------
+
+ function Enclosing_Object (N : Node_Id) return Node_Id is
+ Obj_Name : Node_Id;
+
+ begin
+ Obj_Name := N;
+ while Nkind_In (Obj_Name, N_Selected_Component,
+ N_Indexed_Component,
+ N_Slice)
+ loop
+ Obj_Name := Prefix (Obj_Name);
+ end loop;
+
+ return Get_Referenced_Object (Obj_Name);
+ end Enclosing_Object;
+
+ -- Local declarations
+
+ Enc_Object : constant Node_Id := Enclosing_Object (Ref_Object);
+
+ -- Start of processing for Access_Cases
+
begin
-- In order to improve the text of error messages, the designated
-- type of access-to-subprogram itypes is set by the semantics as
@@ -800,35 +840,31 @@ package body Exp_Attr is
end;
-- If the prefix of an Access attribute is a dereference of an
- -- access parameter (or a renaming of such a dereference) and
- -- the context is a general access type (but not an anonymous
- -- access type), then rewrite the attribute as a conversion of
- -- the access parameter to the context access type. This will
- -- result in an accessibility check being performed, if needed.
-
- -- (X.all'Access => Acc_Type (X))
-
- -- Note: Limit the expansion of an attribute applied to a
- -- dereference of an access parameter so that it's only done
- -- for 'Access. This fixes a problem with 'Unrestricted_Access
- -- that leads to errors in the case where the attribute type
- -- is access-to-variable and the access parameter is
- -- access-to-constant. The conversion is only done to get
- -- accessibility checks, so it makes sense to limit it to
- -- 'Access.
-
- elsif Nkind (Ref_Object) = N_Explicit_Dereference
- and then Is_Entity_Name (Prefix (Ref_Object))
+ -- access parameter (or a renaming of such a dereference, or a
+ -- subcomponent of such a dereference) and the context is a
+ -- general access type (but not an anonymous access type), then
+ -- apply an accessibility check to the access parameter. We used
+ -- to rewrite the access parameter as a type conversion, but that
+ -- could only be done if the immediate prefix of the Access
+ -- attribute was the dereference, and didn't handle cases where
+ -- the attribute is applied to a subcomponent of the dereference,
+ -- since there's generally no available, appropriate access type
+ -- to convert to in that case. The attribute is passed as the
+ -- point to insert the check, because the access parameter may
+ -- come from a renaming, possibly in a different scope, and the
+ -- check must be associated with the attribute itself.
+
+ elsif Id = Attribute_Access
+ and then Nkind (Enc_Object) = N_Explicit_Dereference
+ and then Is_Entity_Name (Prefix (Enc_Object))
and then Ekind (Btyp) = E_General_Access_Type
- and then Ekind (Entity (Prefix (Ref_Object))) in Formal_Kind
- and then Ekind (Etype (Entity (Prefix (Ref_Object))))
+ and then Ekind (Entity (Prefix (Enc_Object))) in Formal_Kind
+ and then Ekind (Etype (Entity (Prefix (Enc_Object))))
= E_Anonymous_Access_Type
and then Present (Extra_Accessibility
- (Entity (Prefix (Ref_Object))))
+ (Entity (Prefix (Enc_Object))))
then
- Rewrite (N,
- Convert_To (Typ, New_Copy_Tree (Prefix (Ref_Object))));
- Analyze_And_Resolve (N, Typ);
+ Apply_Accessibility_Check (Prefix (Enc_Object), Typ, N);
-- Ada 2005 (AI-251): If the designated type is an interface we
-- add an implicit conversion to force the displacement of the
@@ -2048,6 +2084,22 @@ package body Exp_Attr is
Expand_Fpt_Attribute_R (N);
--------------
+ -- From_Any --
+ --------------
+
+ when Attribute_From_Any => From_Any : declare
+ P_Type : constant Entity_Id := Etype (Pref);
+ Decls : constant List_Id := New_List;
+ begin
+ Rewrite (N,
+ Build_From_Any_Call (P_Type,
+ Relocate_Node (First (Exprs)),
+ Decls));
+ Insert_Actions (N, Decls);
+ Analyze_And_Resolve (N, P_Type);
+ end From_Any;
+
+ --------------
-- Identity --
--------------
@@ -4369,6 +4421,22 @@ package body Exp_Attr is
Relocate_Node (First (Exprs))));
Analyze_And_Resolve (N, RTE (RE_Address));
+ ------------
+ -- To_Any --
+ ------------
+
+ when Attribute_To_Any => To_Any : declare
+ P_Type : constant Entity_Id := Etype (Pref);
+ Decls : constant List_Id := New_List;
+ begin
+ Rewrite (N,
+ Build_To_Any_Call
+ (Convert_To (P_Type,
+ Relocate_Node (First (Exprs))), Decls));
+ Insert_Actions (N, Decls);
+ Analyze_And_Resolve (N, RTE (RE_Any));
+ end To_Any;
+
----------------
-- Truncation --
----------------
@@ -4382,6 +4450,19 @@ package body Exp_Attr is
Expand_Fpt_Attribute_R (N);
end if;
+ --------------
+ -- TypeCode --
+ --------------
+
+ when Attribute_TypeCode => TypeCode : declare
+ P_Type : constant Entity_Id := Etype (Pref);
+ Decls : constant List_Id := New_List;
+ begin
+ Rewrite (N, Build_TypeCode_Call (Loc, P_Type, Decls));
+ Insert_Actions (N, Decls);
+ Analyze_And_Resolve (N, RTE (RE_TypeCode));
+ end TypeCode;
+
-----------------------
-- Unbiased_Rounding --
-----------------------
@@ -5314,7 +5395,8 @@ package body Exp_Attr is
(Typ : Entity_Id;
Nam : TSS_Name_Type) return Entity_Id
is
- Ent : constant Entity_Id := TSS (Typ, Nam);
+ Base_Typ : constant Entity_Id := Base_Type (Typ);
+ Ent : constant Entity_Id := TSS (Typ, Nam);
begin
if Present (Ent) then
@@ -5337,53 +5419,100 @@ package body Exp_Attr is
and then
not Is_Predefined_File_Name (Unit_File_Name (Current_Sem_Unit))
then
-
-- String as defined in package Ada
- if Typ = Standard_String then
- if Nam = TSS_Stream_Input then
- return RTE (RE_String_Input);
+ if Base_Typ = Standard_String then
+ if Restriction_Active (No_Stream_Optimizations) then
+ if Nam = TSS_Stream_Input then
+ return RTE (RE_String_Input);
- elsif Nam = TSS_Stream_Output then
- return RTE (RE_String_Output);
+ elsif Nam = TSS_Stream_Output then
+ return RTE (RE_String_Output);
- elsif Nam = TSS_Stream_Read then
- return RTE (RE_String_Read);
+ elsif Nam = TSS_Stream_Read then
+ return RTE (RE_String_Read);
- else pragma Assert (Nam = TSS_Stream_Write);
- return RTE (RE_String_Write);
+ else pragma Assert (Nam = TSS_Stream_Write);
+ return RTE (RE_String_Write);
+ end if;
+
+ else
+ if Nam = TSS_Stream_Input then
+ return RTE (RE_String_Input_Blk_IO);
+
+ elsif Nam = TSS_Stream_Output then
+ return RTE (RE_String_Output_Blk_IO);
+
+ elsif Nam = TSS_Stream_Read then
+ return RTE (RE_String_Read_Blk_IO);
+
+ else pragma Assert (Nam = TSS_Stream_Write);
+ return RTE (RE_String_Write_Blk_IO);
+ end if;
end if;
-- Wide_String as defined in package Ada
- elsif Typ = Standard_Wide_String then
- if Nam = TSS_Stream_Input then
- return RTE (RE_Wide_String_Input);
+ elsif Base_Typ = Standard_Wide_String then
+ if Restriction_Active (No_Stream_Optimizations) then
+ if Nam = TSS_Stream_Input then
+ return RTE (RE_Wide_String_Input);
- elsif Nam = TSS_Stream_Output then
- return RTE (RE_Wide_String_Output);
+ elsif Nam = TSS_Stream_Output then
+ return RTE (RE_Wide_String_Output);
- elsif Nam = TSS_Stream_Read then
- return RTE (RE_Wide_String_Read);
+ elsif Nam = TSS_Stream_Read then
+ return RTE (RE_Wide_String_Read);
- else pragma Assert (Nam = TSS_Stream_Write);
- return RTE (RE_Wide_String_Write);
+ else pragma Assert (Nam = TSS_Stream_Write);
+ return RTE (RE_Wide_String_Write);
+ end if;
+
+ else
+ if Nam = TSS_Stream_Input then
+ return RTE (RE_Wide_String_Input_Blk_IO);
+
+ elsif Nam = TSS_Stream_Output then
+ return RTE (RE_Wide_String_Output_Blk_IO);
+
+ elsif Nam = TSS_Stream_Read then
+ return RTE (RE_Wide_String_Read_Blk_IO);
+
+ else pragma Assert (Nam = TSS_Stream_Write);
+ return RTE (RE_Wide_String_Write_Blk_IO);
+ end if;
end if;
-- Wide_Wide_String as defined in package Ada
- elsif Typ = Standard_Wide_Wide_String then
- if Nam = TSS_Stream_Input then
- return RTE (RE_Wide_Wide_String_Input);
+ elsif Base_Typ = Standard_Wide_Wide_String then
+ if Restriction_Active (No_Stream_Optimizations) then
+ if Nam = TSS_Stream_Input then
+ return RTE (RE_Wide_Wide_String_Input);
- elsif Nam = TSS_Stream_Output then
- return RTE (RE_Wide_Wide_String_Output);
+ elsif Nam = TSS_Stream_Output then
+ return RTE (RE_Wide_Wide_String_Output);
- elsif Nam = TSS_Stream_Read then
- return RTE (RE_Wide_Wide_String_Read);
+ elsif Nam = TSS_Stream_Read then
+ return RTE (RE_Wide_Wide_String_Read);
- else pragma Assert (Nam = TSS_Stream_Write);
- return RTE (RE_Wide_Wide_String_Write);
+ else pragma Assert (Nam = TSS_Stream_Write);
+ return RTE (RE_Wide_Wide_String_Write);
+ end if;
+
+ else
+ if Nam = TSS_Stream_Input then
+ return RTE (RE_Wide_Wide_String_Input_Blk_IO);
+
+ elsif Nam = TSS_Stream_Output then
+ return RTE (RE_Wide_Wide_String_Output_Blk_IO);
+
+ elsif Nam = TSS_Stream_Read then
+ return RTE (RE_Wide_Wide_String_Read_Blk_IO);
+
+ else pragma Assert (Nam = TSS_Stream_Write);
+ return RTE (RE_Wide_Wide_String_Write_Blk_IO);
+ end if;
end if;
end if;
end if;
diff --git a/gcc/ada/exp_ch11.adb b/gcc/ada/exp_ch11.adb
index 2cfde4df912..a8219fe7c9f 100644
--- a/gcc/ada/exp_ch11.adb
+++ b/gcc/ada/exp_ch11.adb
@@ -1386,7 +1386,7 @@ package body Exp_Ch11 is
-- Raise_Exception (exception-name'Identity, string);
- -- and there is nothing else to do
+ -- and there is nothing else to do.
if Present (Expression (N)) then
Rewrite (N,
@@ -1394,7 +1394,7 @@ package body Exp_Ch11 is
Name => New_Occurrence_Of (RTE (RE_Raise_Exception), Loc),
Parameter_Associations => New_List (
Make_Attribute_Reference (Loc,
- Prefix => Name (N),
+ Prefix => Name (N),
Attribute_Name => Name_Identity),
Expression (N))));
Analyze (N);
diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb
index b110121bc5e..b5fac5c8594 100644
--- a/gcc/ada/exp_ch3.adb
+++ b/gcc/ada/exp_ch3.adb
@@ -1543,7 +1543,7 @@ package body Exp_Ch3 is
end if;
end if;
- -- Ada 2005 (AI-287) In case of default initialized components,
+ -- Ada 2005 (AI-287): In case of default initialized components,
-- we need to generate the corresponding selected component node
-- to access the discriminant value. In other cases this is not
-- required because we are inside the init proc and we use the
@@ -1826,23 +1826,6 @@ package body Exp_Ch3 is
Attribute_Name => Name_Unrestricted_Access);
end if;
- -- Ada 2005 (AI-231): Add the run-time check if required
-
- if Ada_Version >= Ada_05
- and then Can_Never_Be_Null (Etype (Id)) -- Lhs
- then
- if Known_Null (Exp) then
- return New_List (
- Make_Raise_Constraint_Error (Sloc (Exp),
- Reason => CE_Null_Not_Allowed));
-
- elsif Present (Etype (Exp))
- and then not Can_Never_Be_Null (Etype (Exp))
- then
- Install_Null_Excluding_Check (Exp);
- end if;
- end if;
-
-- Take a copy of Exp to ensure that later copies of this component
-- declaration in derived types see the original tree, not a node
-- rewritten during expansion of the init_proc.
@@ -2139,13 +2122,9 @@ package body Exp_Ch3 is
-- Local variables
- Ifaces_List : Elist_Id;
Ifaces_Comp_List : Elist_Id;
- Ifaces_Tag_List : Elist_Id;
- Iface_Elmt : Elmt_Id;
- Comp_Elmt : Elmt_Id;
-
- pragma Warnings (Off, Ifaces_Tag_List);
+ Iface_Comp_Elmt : Elmt_Id;
+ Iface_Comp : Node_Id;
-- Start of processing for Build_Offset_To_Top_Functions
@@ -2163,26 +2142,25 @@ package body Exp_Ch3 is
return;
end if;
- Collect_Interfaces_Info
- (Rec_Type, Ifaces_List, Ifaces_Comp_List, Ifaces_Tag_List);
+ Collect_Interface_Components (Rec_Type, Ifaces_Comp_List);
-- For each interface type with secondary dispatch table we generate
-- the Offset_To_Top_Functions (required to displace the pointer in
-- interface conversions)
- Iface_Elmt := First_Elmt (Ifaces_List);
- Comp_Elmt := First_Elmt (Ifaces_Comp_List);
- while Present (Iface_Elmt) loop
+ Iface_Comp_Elmt := First_Elmt (Ifaces_Comp_List);
+ while Present (Iface_Comp_Elmt) loop
+ Iface_Comp := Node (Iface_Comp_Elmt);
+ pragma Assert (Is_Interface (Related_Type (Iface_Comp)));
-- If the interface is a parent of Rec_Type it shares the primary
-- dispatch table and hence there is no need to build the function
- if not Is_Ancestor (Node (Iface_Elmt), Rec_Type) then
- Build_Offset_To_Top_Function (Iface_Comp => Node (Comp_Elmt));
+ if not Is_Ancestor (Related_Type (Iface_Comp), Rec_Type) then
+ Build_Offset_To_Top_Function (Iface_Comp);
end if;
- Next_Elmt (Iface_Elmt);
- Next_Elmt (Comp_Elmt);
+ Next_Elmt (Iface_Comp_Elmt);
end loop;
end Build_Offset_To_Top_Functions;
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index 798da67036e..2f95a84207d 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -944,6 +944,11 @@ package body Exp_Ch4 is
Rewrite (N, New_Reference_To (Temp, Loc));
Analyze_And_Resolve (N, PtrT);
+ elsif Is_Access_Type (T)
+ and then Can_Never_Be_Null (T)
+ then
+ Install_Null_Excluding_Check (Exp);
+
elsif Is_Access_Type (DesigT)
and then Nkind (Exp) = N_Allocator
and then Nkind (Expression (Exp)) /= N_Qualified_Expression
@@ -977,8 +982,7 @@ package body Exp_Ch4 is
-- not allow sliding, but this check does (a relaxation from Ada 83).
if Is_Constrained (DesigT)
- and then not Subtypes_Statically_Match
- (T, DesigT)
+ and then not Subtypes_Statically_Match (T, DesigT)
then
Apply_Constraint_Check
(Exp, DesigT, No_Sliding => False);
@@ -2637,7 +2641,7 @@ package body Exp_Ch4 is
New_Reference_To (Ind_Typ, Loc),
New_Reference_To (Defining_Identifier (I_Decl), Loc)));
- -- For other index types, computation is safe.
+ -- For other index types, computation is safe
else
H_Init := Ind_Val (Make_Op_Add (Loc, H_Init, L_Pos));
@@ -2668,7 +2672,7 @@ package body Exp_Ch4 is
Declare_Decls := New_List (P_Decl, H_Decl, R_Decl);
- -- Add constraint check for the modular index case.
+ -- Add constraint check for the modular index case
if Is_Modular_Integer_Type (Ind_Typ)
and then Esize (Ind_Typ) < Esize (Standard_Integer)
@@ -3440,7 +3444,8 @@ package body Exp_Ch4 is
and then
Ekind (Etype (Nod)) = E_Anonymous_Access_Type
then
- Apply_Accessibility_Check (Nod, Typ);
+ Apply_Accessibility_Check
+ (Nod, Typ, Insert_Node => Nod);
end if;
Next_Elmt (Discr);
@@ -3873,6 +3878,12 @@ package body Exp_Ch4 is
and then Compile_Time_Known_Value (Hi)
and then Expr_Value (Type_High_Bound (Ltyp)) = Expr_Value (Hi)
and then Expr_Value (Type_Low_Bound (Ltyp)) = Expr_Value (Lo)
+
+ -- Kill warnings in instances, since they may be cases where we
+ -- have a test in the generic that makes sense with some types
+ -- and not with other types.
+
+ and then not In_Instance
then
Substitute_Valid_Check;
return;
@@ -3886,7 +3897,7 @@ package body Exp_Ch4 is
-- legality checks, because we are constant-folding beyond RM 4.9.
if Lcheck = LT or else Ucheck = GT then
- if Warn1 then
+ if Warn1 and then not In_Instance then
Error_Msg_N ("?range test optimized away", N);
Error_Msg_N ("\?value is known to be out of range", N);
end if;
@@ -3902,7 +3913,7 @@ package body Exp_Ch4 is
-- since we know we are in range.
elsif Lcheck in Compare_GE and then Ucheck in Compare_LE then
- if Warn1 then
+ if Warn1 and then not In_Instance then
Error_Msg_N ("?range test optimized away", N);
Error_Msg_N ("\?value is known to be in range", N);
end if;
@@ -3919,7 +3930,7 @@ package body Exp_Ch4 is
-- a comparison against the upper bound.
elsif Lcheck in Compare_GE then
- if Warn2 then
+ if Warn2 and then not In_Instance then
Error_Msg_N ("?lower bound test optimized away", Lo);
Error_Msg_N ("\?value is known to be in range", Lo);
end if;
@@ -3937,7 +3948,7 @@ package body Exp_Ch4 is
-- a comparison against the lower bound.
elsif Ucheck in Compare_LE then
- if Warn2 then
+ if Warn2 and then not In_Instance then
Error_Msg_N ("?upper bound test optimized away", Hi);
Error_Msg_N ("\?value is known to be in range", Hi);
end if;
@@ -5460,6 +5471,13 @@ package body Exp_Ch4 is
-- X ** 0 = 1 (or 1.0)
if Expv = 0 then
+
+ -- Call Remove_Side_Effects to ensure that any side effects
+ -- in the ignored left operand (in particular function calls
+ -- to user defined functions) are properly executed.
+
+ Remove_Side_Effects (Base);
+
if Ekind (Typ) in Integer_Kind then
Xnode := Make_Integer_Literal (Loc, Intval => 1);
else
@@ -5934,6 +5952,12 @@ package body Exp_Ch4 is
and then Compile_Time_Known_Value (Right)
and then Expr_Value (Right) = Uint_1
then
+ -- Call Remove_Side_Effects to ensure that any side effects in
+ -- the ignored left operand (in particular function calls to
+ -- user defined functions) are properly executed.
+
+ Remove_Side_Effects (Left);
+
Rewrite (N, Make_Integer_Literal (Loc, 0));
Analyze_And_Resolve (N, Typ);
return;
@@ -5982,17 +6006,17 @@ package body Exp_Ch4 is
--------------------------
procedure Expand_N_Op_Multiply (N : Node_Id) is
- Loc : constant Source_Ptr := Sloc (N);
- Lop : constant Node_Id := Left_Opnd (N);
- Rop : constant Node_Id := Right_Opnd (N);
+ Loc : constant Source_Ptr := Sloc (N);
+ Lop : constant Node_Id := Left_Opnd (N);
+ Rop : constant Node_Id := Right_Opnd (N);
- Lp2 : constant Boolean :=
- Nkind (Lop) = N_Op_Expon
- and then Is_Power_Of_2_For_Shift (Lop);
+ Lp2 : constant Boolean :=
+ Nkind (Lop) = N_Op_Expon
+ and then Is_Power_Of_2_For_Shift (Lop);
- Rp2 : constant Boolean :=
- Nkind (Rop) = N_Op_Expon
- and then Is_Power_Of_2_For_Shift (Rop);
+ Rp2 : constant Boolean :=
+ Nkind (Rop) = N_Op_Expon
+ and then Is_Power_Of_2_For_Shift (Rop);
Ltyp : constant Entity_Id := Etype (Lop);
Rtyp : constant Entity_Id := Etype (Rop);
@@ -6005,14 +6029,28 @@ package body Exp_Ch4 is
if Is_Integer_Type (Typ) then
- -- N * 0 = 0 * N = 0 for integer types
+ -- N * 0 = 0 for integer types
- if (Compile_Time_Known_Value (Rop)
- and then Expr_Value (Rop) = Uint_0)
- or else
- (Compile_Time_Known_Value (Lop)
- and then Expr_Value (Lop) = Uint_0)
+ if Compile_Time_Known_Value (Rop)
+ and then Expr_Value (Rop) = Uint_0
+ then
+ -- Call Remove_Side_Effects to ensure that any side effects in
+ -- the ignored left operand (in particular function calls to
+ -- user defined functions) are properly executed.
+
+ Remove_Side_Effects (Lop);
+
+ Rewrite (N, Make_Integer_Literal (Loc, Uint_0));
+ Analyze_And_Resolve (N, Typ);
+ return;
+ end if;
+
+ -- Similar handling for 0 * N = 0
+
+ if Compile_Time_Known_Value (Lop)
+ and then Expr_Value (Lop) = Uint_0
then
+ Remove_Side_Effects (Rop);
Rewrite (N, Make_Integer_Literal (Loc, Uint_0));
Analyze_And_Resolve (N, Typ);
return;
@@ -6491,6 +6529,12 @@ package body Exp_Ch4 is
and then Compile_Time_Known_Value (Right)
and then Expr_Value (Right) = Uint_1
then
+ -- Call Remove_Side_Effects to ensure that any side effects in the
+ -- ignored left operand (in particular function calls to user defined
+ -- functions) are properly executed.
+
+ Remove_Side_Effects (Left);
+
Rewrite (N, Make_Integer_Literal (Loc, 0));
Analyze_And_Resolve (N, Typ);
return;
@@ -7552,9 +7596,9 @@ package body Exp_Ch4 is
-- Apply an accessibility check when the conversion operand is an
-- access parameter (or a renaming thereof), unless conversion was
- -- expanded from an unchecked or unrestricted access attribute. Note
- -- that other checks may still need to be applied below (such as
- -- tagged type checks).
+ -- expanded from an Unchecked_ or Unrestricted_Access attribute.
+ -- Note that other checks may still need to be applied below (such
+ -- as tagged type checks).
if Is_Entity_Name (Operand)
and then
@@ -7568,9 +7612,10 @@ package body Exp_Ch4 is
and then (Nkind (Original_Node (N)) /= N_Attribute_Reference
or else Attribute_Name (Original_Node (N)) = Name_Access)
then
- Apply_Accessibility_Check (Operand, Target_Type);
+ Apply_Accessibility_Check
+ (Operand, Target_Type, Insert_Node => Operand);
- -- If the level of the operand type is statically deeper then the
+ -- If the level of the operand type is statically deeper than the
-- level of the target type, then force Program_Error. Note that this
-- can only occur for cases where the attribute is within the body of
-- an instantiation (otherwise the conversion will already have been
@@ -8352,7 +8397,9 @@ package body Exp_Ch4 is
-- chain. The Final_Chain that is thus created is shared by the
-- access parameter. The access type is tested against the result
-- type of the function to exclude allocators whose type is an
- -- anonymous access result type.
+ -- anonymous access result type. We freeze the type at once to
+ -- ensure that it is properly decorated for the back-end, even
+ -- if the context and current scope is a loop.
if Nkind (Associated_Node_For_Itype (PtrT))
in N_Subprogram_Specification
@@ -8369,6 +8416,7 @@ package body Exp_Ch4 is
Subtype_Indication =>
New_Occurrence_Of (T, Loc))));
+ Freeze_Before (N, Owner);
Build_Final_List (N, Owner);
Set_Associated_Final_Chain (PtrT, Associated_Final_Chain (Owner));
diff --git a/gcc/ada/exp_ch5.adb b/gcc/ada/exp_ch5.adb
index 18ea8fe44db..2215912b22c 100644
--- a/gcc/ada/exp_ch5.adb
+++ b/gcc/ada/exp_ch5.adb
@@ -3695,22 +3695,39 @@ package body Exp_Ch5 is
Return_Object_Entity : constant Entity_Id :=
Make_Defining_Identifier (Loc,
New_Internal_Name ('R'));
+ Subtype_Ind : Node_Id;
- Subtype_Ind : constant Node_Id := New_Occurrence_Of (R_Type, Loc);
+ begin
+ -- If the result type of the function is class-wide and the
+ -- expression has a specific type, then we use the expression's
+ -- type as the type of the return object. In cases where the
+ -- expression is an aggregate that is built in place, this avoids
+ -- the need for an expensive conversion of the return object to
+ -- the specific type on assignments to the individual components.
+
+ if Is_Class_Wide_Type (R_Type)
+ and then not Is_Class_Wide_Type (Etype (Exp))
+ then
+ Subtype_Ind := New_Occurrence_Of (Etype (Exp), Loc);
+ else
+ Subtype_Ind := New_Occurrence_Of (R_Type, Loc);
+ end if;
- Obj_Decl : constant Node_Id :=
- Make_Object_Declaration (Loc,
- Defining_Identifier => Return_Object_Entity,
- Object_Definition => Subtype_Ind,
- Expression => Exp);
+ declare
+ Obj_Decl : constant Node_Id :=
+ Make_Object_Declaration (Loc,
+ Defining_Identifier => Return_Object_Entity,
+ Object_Definition => Subtype_Ind,
+ Expression => Exp);
- Ext : constant Node_Id := Make_Extended_Return_Statement (Loc,
- Return_Object_Declarations => New_List (Obj_Decl));
+ Ext : constant Node_Id := Make_Extended_Return_Statement (Loc,
+ Return_Object_Declarations => New_List (Obj_Decl));
- begin
- Rewrite (N, Ext);
- Analyze (N);
- return;
+ begin
+ Rewrite (N, Ext);
+ Analyze (N);
+ return;
+ end;
end;
end if;
@@ -3889,6 +3906,7 @@ package body Exp_Ch5 is
-- secondary stack.
else
+ Check_Restriction (No_Secondary_Stack, N);
Set_Storage_Pool (N, RTE (RE_SS_Pool));
-- If we are generating code for the VM do not use
diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb
index cddc0210241..4c3f3da63f9 100644
--- a/gcc/ada/exp_ch6.adb
+++ b/gcc/ada/exp_ch6.adb
@@ -1,4 +1,4 @@
------------------------------------------------------------------------------
+------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
@@ -2034,15 +2034,6 @@ package body Exp_Ch6 is
Prev := Actual;
Prev_Orig := Original_Node (Prev);
- -- The original actual may have been a call written in prefix
- -- form, and rewritten before analysis.
-
- if not Analyzed (Prev_Orig)
- and then Nkind_In (Actual, N_Function_Call, N_Identifier)
- then
- Prev_Orig := Prev;
- end if;
-
-- Ada 2005 (AI-251): Check if any formal is a class-wide interface
-- to expand it in a further round.
@@ -2070,16 +2061,16 @@ package body Exp_Ch6 is
if Ekind (Etype (Prev)) in Private_Kind
and then not Has_Discriminants (Base_Type (Etype (Prev)))
then
- Add_Extra_Actual (
- New_Occurrence_Of (Standard_False, Loc),
- Extra_Constrained (Formal));
+ Add_Extra_Actual
+ (New_Occurrence_Of (Standard_False, Loc),
+ Extra_Constrained (Formal));
elsif Is_Constrained (Etype (Formal))
or else not Has_Discriminants (Etype (Prev))
then
- Add_Extra_Actual (
- New_Occurrence_Of (Standard_True, Loc),
- Extra_Constrained (Formal));
+ Add_Extra_Actual
+ (New_Occurrence_Of (Standard_True, Loc),
+ Extra_Constrained (Formal));
-- Do not produce extra actuals for Unchecked_Union parameters.
-- Jump directly to the end of the loop.
@@ -2220,7 +2211,7 @@ package body Exp_Ch6 is
else
Add_Extra_Actual
(Make_Integer_Literal (Loc,
- Intval => Scope_Depth (Standard_Standard)),
+ Intval => Scope_Depth (Standard_Standard)),
Extra_Accessibility (Formal));
end if;
end;
@@ -2231,11 +2222,25 @@ package body Exp_Ch6 is
else
Add_Extra_Actual
(Make_Integer_Literal (Loc,
- Intval => Type_Access_Level (Etype (Prev_Orig))),
+ Intval => Type_Access_Level (Etype (Prev_Orig))),
Extra_Accessibility (Formal));
end if;
- -- All cases other than thunks
+ -- If the actual is an access discriminant, then pass the level
+ -- of the enclosing object (RM05-3.10.2(12.4/2)).
+
+ elsif Nkind (Prev_Orig) = N_Selected_Component
+ and then Ekind (Entity (Selector_Name (Prev_Orig))) =
+ E_Discriminant
+ and then Ekind (Etype (Entity (Selector_Name (Prev_Orig)))) =
+ E_Anonymous_Access_Type
+ then
+ Add_Extra_Actual
+ (Make_Integer_Literal (Loc,
+ Intval => Object_Access_Level (Prefix (Prev_Orig))),
+ Extra_Accessibility (Formal));
+
+ -- All other cases
else
case Nkind (Prev_Orig) is
@@ -2246,20 +2251,20 @@ package body Exp_Ch6 is
-- For X'Access, pass on the level of the prefix X
when Attribute_Access =>
- Add_Extra_Actual (
- Make_Integer_Literal (Loc,
- Intval =>
- Object_Access_Level (Prefix (Prev_Orig))),
- Extra_Accessibility (Formal));
+ Add_Extra_Actual
+ (Make_Integer_Literal (Loc,
+ Intval =>
+ Object_Access_Level (Prefix (Prev_Orig))),
+ Extra_Accessibility (Formal));
-- Treat the unchecked attributes as library-level
when Attribute_Unchecked_Access |
Attribute_Unrestricted_Access =>
- Add_Extra_Actual (
- Make_Integer_Literal (Loc,
- Intval => Scope_Depth (Standard_Standard)),
- Extra_Accessibility (Formal));
+ Add_Extra_Actual
+ (Make_Integer_Literal (Loc,
+ Intval => Scope_Depth (Standard_Standard)),
+ Extra_Accessibility (Formal));
-- No other cases of attributes returning access
-- values that can be passed to access parameters
@@ -2274,19 +2279,21 @@ package body Exp_Ch6 is
-- current scope level.
when N_Allocator =>
- Add_Extra_Actual (
- Make_Integer_Literal (Loc,
- Scope_Depth (Current_Scope) + 1),
- Extra_Accessibility (Formal));
+ Add_Extra_Actual
+ (Make_Integer_Literal (Loc,
+ Intval => Scope_Depth (Current_Scope) + 1),
+ Extra_Accessibility (Formal));
- -- For other cases we simply pass the level of the
- -- actual's access type.
+ -- For other cases we simply pass the level of the actual's
+ -- access type. The type is retrieved from Prev rather than
+ -- Prev_Orig, because in some cases Prev_Orig denotes an
+ -- original expression that has not been analyzed.
when others =>
- Add_Extra_Actual (
- Make_Integer_Literal (Loc,
- Intval => Type_Access_Level (Etype (Prev_Orig))),
- Extra_Accessibility (Formal));
+ Add_Extra_Actual
+ (Make_Integer_Literal (Loc,
+ Intval => Type_Access_Level (Etype (Prev))),
+ Extra_Accessibility (Formal));
end case;
end if;
@@ -5496,7 +5503,7 @@ package body Exp_Ch6 is
if Is_Constrained (Underlying_Type (Result_Subt)) then
Insert_After_And_Analyze (Object_Decl, Ptr_Typ_Decl);
else
- Insert_Before_And_Analyze (Object_Decl, Ptr_Typ_Decl);
+ Insert_Action (Object_Decl, Ptr_Typ_Decl);
end if;
-- Finally, create an access object initialized to a reference to the
diff --git a/gcc/ada/exp_ch9.adb b/gcc/ada/exp_ch9.adb
index 572dae04ea0..53de7a0e9d5 100644
--- a/gcc/ada/exp_ch9.adb
+++ b/gcc/ada/exp_ch9.adb
@@ -152,29 +152,25 @@ package body Exp_Ch9 is
-- <formalN> : AnnN;
-- end record;
- function Build_Wrapper_Body
- (Loc : Source_Ptr;
- Proc_Nam : Entity_Id;
- Obj_Typ : Entity_Id;
- Formals : List_Id) return Node_Id;
- -- Ada 2005 (AI-345): Build the body that wraps a primitive operation
- -- associated with a protected or task type. This is required to implement
- -- dispatching calls through interfaces. Proc_Nam is the entry name to be
- -- wrapped, Obj_Typ is the type of the newly added formal parameter to
- -- handle object notation, Formals are the original entry formals that will
- -- be explicitly replicated.
-
- function Build_Wrapper_Spec
- (Loc : Source_Ptr;
- Proc_Nam : Entity_Id;
- Obj_Typ : Entity_Id;
- Formals : List_Id) return Node_Id;
- -- Ada 2005 (AI-345): Build the specification of a primitive operation
- -- associated with a protected or task type. This is required implement
- -- dispatching calls through interfaces. Proc_Nam is the entry name to be
- -- wrapped, Obj_Typ is the type of the newly added formal parameter to
- -- handle object notation, Formals are the original entry formals that will
- -- be explicitly replicated.
+ procedure Build_Wrapper_Bodies
+ (Loc : Source_Ptr;
+ Typ : Entity_Id;
+ N : Node_Id);
+ -- Ada 2005 (AI-345): Typ is either a concurrent type or the corresponding
+ -- record of a concurrent type. N is the insertion node where all bodies
+ -- will be placed. This routine builds the bodies of the subprograms which
+ -- serve as an indirection mechanism to overriding primitives of concurrent
+ -- types, entries and protected procedures. Any new body is analyzed.
+
+ procedure Build_Wrapper_Specs
+ (Loc : Source_Ptr;
+ Typ : Entity_Id;
+ N : in out Node_Id);
+ -- Ada 2005 (AI-345): Typ is either a concurrent type or the corresponding
+ -- record of a concurrent type. N is the insertion node where all specs
+ -- will be placed. This routine builds the specs of the subprograms which
+ -- serve as an indirection mechanism to overriding primitives of concurrent
+ -- types, entries and protected procedures. Any new spec is analyzed.
function Build_Find_Body_Index (Typ : Entity_Id) return Node_Id;
-- Build the function that translates the entry index in the call
@@ -359,6 +355,10 @@ package body Exp_Ch9 is
Lo : Node_Id;
Hi : Node_Id) return Boolean;
+ function Is_Private_Primitive_Subprogram (Id : Entity_Id) return Boolean;
+ -- Determine whether Id is a function or a procedure and is marked as a
+ -- private primitive.
+
function Null_Statements (Stats : List_Id) return Boolean;
-- Used to check DO-END sequence. Checks for equivalent of DO NULL; END.
-- Allows labels, and pragma Warnings/Unreferenced in the sequence as
@@ -1541,144 +1541,241 @@ package body Exp_Ch9 is
return Rec_Nam;
end Build_Parameter_Block;
- ------------------------
- -- Build_Wrapper_Body --
- ------------------------
+ --------------------------
+ -- Build_Wrapper_Bodies --
+ --------------------------
- function Build_Wrapper_Body
- (Loc : Source_Ptr;
- Proc_Nam : Entity_Id;
- Obj_Typ : Entity_Id;
- Formals : List_Id) return Node_Id
+ procedure Build_Wrapper_Bodies
+ (Loc : Source_Ptr;
+ Typ : Entity_Id;
+ N : Node_Id)
is
- Actuals : List_Id := No_List;
- Body_Spec : Node_Id;
- Conv_Id : Node_Id;
- First_Formal : Node_Id;
- Formal : Node_Id;
-
- begin
- Body_Spec := Build_Wrapper_Spec (Loc, Proc_Nam, Obj_Typ, Formals);
+ Rec_Typ : Entity_Id;
- -- If we did not generate the specification do have nothing else to do
+ function Build_Wrapper_Body
+ (Loc : Source_Ptr;
+ Subp_Id : Entity_Id;
+ Obj_Typ : Entity_Id;
+ Formals : List_Id) return Node_Id;
+ -- Ada 2005 (AI-345): Build the body that wraps a primitive operation
+ -- associated with a protected or task type. Subp_Id is the subprogram
+ -- name which will be wrapped. Obj_Typ is the type of the new formal
+ -- parameter which handles dispatching and object notation. Formals are
+ -- the original formals of Subp_Id which will be explicitly replicated.
+
+ ------------------------
+ -- Build_Wrapper_Body --
+ ------------------------
+
+ function Build_Wrapper_Body
+ (Loc : Source_Ptr;
+ Subp_Id : Entity_Id;
+ Obj_Typ : Entity_Id;
+ Formals : List_Id) return Node_Id
+ is
+ Body_Spec : Node_Id;
- if Body_Spec = Empty then
- return Empty;
- end if;
+ begin
+ Body_Spec := Build_Wrapper_Spec (Loc, Subp_Id, Obj_Typ, Formals);
- -- Map formals to actuals. Use the list built for the wrapper spec,
- -- skipping the object notation parameter.
+ -- The subprogram is not overriding or is not a primitive declared
+ -- between two views.
- First_Formal := First (Parameter_Specifications (Body_Spec));
+ if No (Body_Spec) then
+ return Empty;
+ end if;
- Formal := First_Formal;
- Next (Formal);
+ declare
+ Actuals : List_Id := No_List;
+ Conv_Id : Node_Id;
+ First_Formal : Node_Id;
+ Formal : Node_Id;
+ Nam : Node_Id;
- if Present (Formal) then
- Actuals := New_List;
+ begin
+ -- Map formals to actuals. Use the list built for the wrapper
+ -- spec, skipping the object notation parameter.
- while Present (Formal) loop
- Append_To (Actuals,
- Make_Identifier (Loc, Chars =>
- Chars (Defining_Identifier (Formal))));
+ First_Formal := First (Parameter_Specifications (Body_Spec));
+ Formal := First_Formal;
Next (Formal);
- end loop;
- end if;
- -- An access-to-variable first parameter will require an explicit
- -- dereference in the unchecked conversion. This case occurs when
- -- a protected entry wrapper must override an interface-level
- -- procedure with interface access as first parameter.
+ if Present (Formal) then
+ Actuals := New_List;
- -- SubprgName (O.all).Proc_Nam (Formal_1 .. Formal_N)
+ while Present (Formal) loop
+ Append_To (Actuals,
+ Make_Identifier (Loc, Chars =>
+ Chars (Defining_Identifier (Formal))));
- if Nkind (Parameter_Type (First_Formal)) = N_Access_Definition then
- Conv_Id :=
- Make_Explicit_Dereference (Loc,
- Prefix =>
- Make_Identifier (Loc, Chars => Name_uO));
+ Next (Formal);
+ end loop;
+ end if;
+
+ -- Special processing for primitives declared between a private
+ -- type and its completion.
+
+ if Is_Private_Primitive_Subprogram (Subp_Id) then
+ if No (Actuals) then
+ Actuals := New_List;
+ end if;
+
+ Prepend_To (Actuals,
+ Unchecked_Convert_To (
+ Corresponding_Concurrent_Type (Obj_Typ),
+ Make_Identifier (Loc, Name_uO)));
+
+ Nam := New_Reference_To (Subp_Id, Loc);
+
+ else
+ -- An access-to-variable object parameter requires an explicit
+ -- dereference in the unchecked conversion. This case occurs
+ -- when a protected entry wrapper must override an interface
+ -- level procedure with interface access as first parameter.
+
+ -- O.all.Subp_Id (Formal_1, ..., Formal_N)
+
+ if Nkind (Parameter_Type (First_Formal)) =
+ N_Access_Definition
+ then
+ Conv_Id :=
+ Make_Explicit_Dereference (Loc,
+ Prefix => Make_Identifier (Loc, Name_uO));
+ else
+ Conv_Id := Make_Identifier (Loc, Name_uO);
+ end if;
+
+ Nam :=
+ Make_Selected_Component (Loc,
+ Prefix =>
+ Unchecked_Convert_To (
+ Corresponding_Concurrent_Type (Obj_Typ),
+ Conv_Id),
+ Selector_Name =>
+ New_Reference_To (Subp_Id, Loc));
+ end if;
+
+ -- Create the subprogram body
+
+ if Ekind (Subp_Id) = E_Function then
+ return
+ Make_Subprogram_Body (Loc,
+ Specification => Body_Spec,
+ Declarations => Empty_List,
+ Handled_Statement_Sequence =>
+ Make_Handled_Sequence_Of_Statements (Loc,
+ Statements => New_List (
+ Make_Simple_Return_Statement (Loc,
+ Make_Function_Call (Loc,
+ Name => Nam,
+ Parameter_Associations => Actuals)))));
+
+ else
+ return
+ Make_Subprogram_Body (Loc,
+ Specification => Body_Spec,
+ Declarations => Empty_List,
+ Handled_Statement_Sequence =>
+ Make_Handled_Sequence_Of_Statements (Loc,
+ Statements => New_List (
+ Make_Procedure_Call_Statement (Loc,
+ Name => Nam,
+ Parameter_Associations => Actuals))));
+ end if;
+ end;
+ end Build_Wrapper_Body;
+
+ -- Start of processing for Build_Wrapper_Bodies
+
+ begin
+ if Is_Concurrent_Type (Typ) then
+ Rec_Typ := Corresponding_Record_Type (Typ);
else
- Conv_Id :=
- Make_Identifier (Loc, Chars => Name_uO);
+ Rec_Typ := Typ;
end if;
- if Ekind (Proc_Nam) = E_Function then
- return
- Make_Subprogram_Body (Loc,
- Specification => Body_Spec,
- Declarations => Empty_List,
- Handled_Statement_Sequence =>
- Make_Handled_Sequence_Of_Statements (Loc,
- Statements =>
- New_List (
- Make_Simple_Return_Statement (Loc,
- Make_Function_Call (Loc,
- Name =>
- Make_Selected_Component (Loc,
- Prefix =>
- Unchecked_Convert_To (
- Corresponding_Concurrent_Type (Obj_Typ),
- Conv_Id),
- Selector_Name =>
- New_Reference_To (Proc_Nam, Loc)),
- Parameter_Associations => Actuals)))));
- else
- return
- Make_Subprogram_Body (Loc,
- Specification => Body_Spec,
- Declarations => Empty_List,
- Handled_Statement_Sequence =>
- Make_Handled_Sequence_Of_Statements (Loc,
- Statements =>
- New_List (
- Make_Procedure_Call_Statement (Loc,
- Name =>
- Make_Selected_Component (Loc,
- Prefix =>
- Unchecked_Convert_To (
- Corresponding_Concurrent_Type (Obj_Typ),
- Conv_Id),
- Selector_Name =>
- New_Reference_To (Proc_Nam, Loc)),
- Parameter_Associations => Actuals))));
+ -- Generate wrapper bodies for a concurrent type which implements an
+ -- interface.
+
+ if Present (Interfaces (Rec_Typ)) then
+ declare
+ Insert_Nod : Node_Id;
+ Prim : Entity_Id;
+ Prim_Elmt : Elmt_Id;
+ Prim_Decl : Node_Id;
+ Subp : Entity_Id;
+ Wrap_Body : Node_Id;
+ Wrap_Id : Entity_Id;
+
+ begin
+ Insert_Nod := N;
+
+ -- Examine all primitive operations of the corresponding record
+ -- type, looking for wrapper specs. Generate bodies in order to
+ -- complete them.
+
+ Prim_Elmt := First_Elmt (Primitive_Operations (Rec_Typ));
+ while Present (Prim_Elmt) loop
+ Prim := Node (Prim_Elmt);
+
+ if (Ekind (Prim) = E_Function
+ or else Ekind (Prim) = E_Procedure)
+ and then Is_Primitive_Wrapper (Prim)
+ then
+ Subp := Wrapped_Entity (Prim);
+ Prim_Decl := Parent (Parent (Prim));
+
+ Wrap_Body :=
+ Build_Wrapper_Body (Loc,
+ Subp_Id => Subp,
+ Obj_Typ => Rec_Typ,
+ Formals => Parameter_Specifications (Parent (Subp)));
+ Wrap_Id := Defining_Unit_Name (Specification (Wrap_Body));
+
+ Set_Corresponding_Spec (Wrap_Body, Prim);
+ Set_Corresponding_Body (Prim_Decl, Wrap_Id);
+
+ Insert_After (Insert_Nod, Wrap_Body);
+ Insert_Nod := Wrap_Body;
+
+ Analyze (Wrap_Body);
+ end if;
+
+ Next_Elmt (Prim_Elmt);
+ end loop;
+ end;
end if;
- end Build_Wrapper_Body;
+ end Build_Wrapper_Bodies;
------------------------
-- Build_Wrapper_Spec --
------------------------
function Build_Wrapper_Spec
- (Loc : Source_Ptr;
- Proc_Nam : Entity_Id;
- Obj_Typ : Entity_Id;
- Formals : List_Id) return Node_Id
+ (Loc : Source_Ptr;
+ Subp_Id : Entity_Id;
+ Obj_Typ : Entity_Id;
+ Formals : List_Id) return Node_Id
is
- New_Name_Id : constant Entity_Id :=
- Make_Defining_Identifier (Loc, Chars (Proc_Nam));
-
- First_Param : Node_Id := Empty;
- Iface : Entity_Id;
- Iface_Elmt : Elmt_Id := No_Elmt;
- New_Formals : List_Id;
- Obj_Param : Node_Id;
- Obj_Param_Typ : Node_Id;
- Iface_Prim_Op : Entity_Id;
- Iface_Prim_Op_Elmt : Elmt_Id;
+ First_Param : Node_Id;
+ Iface : Entity_Id;
+ Iface_Elmt : Elmt_Id;
+ Iface_Op : Entity_Id;
+ Iface_Op_Elmt : Elmt_Id;
function Overriding_Possible
- (Iface_Prim_Op : Entity_Id;
- Proc_Nam : Entity_Id) return Boolean;
- -- Determine whether a primitive operation can be overridden by the
- -- wrapper. Iface_Prim_Op is the candidate primitive operation of an
- -- abstract interface type, Proc_Nam is the generated entry wrapper.
+ (Iface_Op : Entity_Id;
+ Wrapper : Entity_Id) return Boolean;
+ -- Determine whether a primitive operation can be overridden by Wrapper.
+ -- Iface_Op is the candidate primitive operation of an interface type,
+ -- Wrapper is the generated entry wrapper.
- function Replicate_Entry_Formals
+ function Replicate_Formals
(Loc : Source_Ptr;
Formals : List_Id) return List_Id;
- -- An explicit parameter replication is required due to the
- -- Is_Entry_Formal flag being set for all the formals. The explicit
+ -- An explicit parameter replication is required due to the Is_Entry_
+ -- Formal flag being set for all the formals of an entry. The explicit
-- replication removes the flag that would otherwise cause a different
-- path of analysis.
@@ -1687,18 +1784,15 @@ package body Exp_Ch9 is
-------------------------
function Overriding_Possible
- (Iface_Prim_Op : Entity_Id;
- Proc_Nam : Entity_Id) return Boolean
+ (Iface_Op : Entity_Id;
+ Wrapper : Entity_Id) return Boolean
is
- Prim_Op_Spec : constant Node_Id := Parent (Iface_Prim_Op);
- Proc_Spec : constant Node_Id := Parent (Proc_Nam);
-
- Is_Access_To_Variable : Boolean;
- Is_Out_Present : Boolean;
+ Iface_Op_Spec : constant Node_Id := Parent (Iface_Op);
+ Wrapper_Spec : constant Node_Id := Parent (Wrapper);
function Type_Conformant_Parameters
- (Prim_Op_Param_Specs : List_Id;
- Proc_Param_Specs : List_Id) return Boolean;
+ (Iface_Op_Params : List_Id;
+ Wrapper_Params : List_Id) return Boolean;
-- Determine whether the parameters of the generated entry wrapper
-- and those of a primitive operation are type conformant. During
-- this check, the first parameter of the primitive operation is
@@ -1709,40 +1803,40 @@ package body Exp_Ch9 is
--------------------------------
function Type_Conformant_Parameters
- (Prim_Op_Param_Specs : List_Id;
- Proc_Param_Specs : List_Id) return Boolean
+ (Iface_Op_Params : List_Id;
+ Wrapper_Params : List_Id) return Boolean
is
- Prim_Op_Param : Node_Id;
- Prim_Op_Typ : Entity_Id;
- Proc_Param : Node_Id;
- Proc_Typ : Entity_Id;
+ Iface_Op_Param : Node_Id;
+ Iface_Op_Typ : Entity_Id;
+ Wrapper_Param : Node_Id;
+ Wrapper_Typ : Entity_Id;
begin
-- Skip the first parameter of the primitive operation
- Prim_Op_Param := Next (First (Prim_Op_Param_Specs));
- Proc_Param := First (Proc_Param_Specs);
- while Present (Prim_Op_Param)
- and then Present (Proc_Param)
+ Iface_Op_Param := Next (First (Iface_Op_Params));
+ Wrapper_Param := First (Wrapper_Params);
+ while Present (Iface_Op_Param)
+ and then Present (Wrapper_Param)
loop
- Prim_Op_Typ := Find_Parameter_Type (Prim_Op_Param);
- Proc_Typ := Find_Parameter_Type (Proc_Param);
+ Iface_Op_Typ := Find_Parameter_Type (Iface_Op_Param);
+ Wrapper_Typ := Find_Parameter_Type (Wrapper_Param);
-- The two parameters must be mode conformant
if not Conforming_Types
- (Prim_Op_Typ, Proc_Typ, Mode_Conformant)
+ (Iface_Op_Typ, Wrapper_Typ, Mode_Conformant)
then
return False;
end if;
- Next (Prim_Op_Param);
- Next (Proc_Param);
+ Next (Iface_Op_Param);
+ Next (Wrapper_Param);
end loop;
-- One of the lists is longer than the other
- if Present (Prim_Op_Param) or else Present (Proc_Param) then
+ if Present (Iface_Op_Param) or else Present (Wrapper_Param) then
return False;
end if;
@@ -1752,47 +1846,41 @@ package body Exp_Ch9 is
-- Start of processing for Overriding_Possible
begin
- if Chars (Iface_Prim_Op) /= Chars (Proc_Nam) then
+ if Chars (Iface_Op) /= Chars (Wrapper) then
return False;
end if;
- -- Special check for protected procedures: If an inherited subprogram
- -- is implemented by a protected procedure or an entry, then the
- -- first parameter of the inherited subprogram shall be of mode OUT
- -- or IN OUT, or an access-to-variable parameter.
-
- if Ekind (Iface_Prim_Op) = E_Procedure then
-
- Is_Out_Present :=
- Present (Parameter_Specifications (Prim_Op_Spec))
- and then
- Out_Present (First (Parameter_Specifications (Prim_Op_Spec)));
+ -- If an inherited subprogram is implemented by a protected procedure
+ -- or an entry, then the first parameter of the inherited subprogram
+ -- shall be of mode OUT or IN OUT, or access-to-variable parameter.
- Is_Access_To_Variable :=
- Present (Parameter_Specifications (Prim_Op_Spec))
- and then
- Nkind (Parameter_Type
- (First
- (Parameter_Specifications (Prim_Op_Spec)))) =
- N_Access_Definition;
-
- if not Is_Out_Present
- and then not Is_Access_To_Variable
- then
- return False;
- end if;
+ if Ekind (Iface_Op) = E_Procedure
+ and then Present (Parameter_Specifications (Iface_Op_Spec))
+ then
+ declare
+ Obj_Param : constant Node_Id :=
+ First (Parameter_Specifications (Iface_Op_Spec));
+ begin
+ if not Out_Present (Obj_Param)
+ and then Nkind (Parameter_Type (Obj_Param)) /=
+ N_Access_Definition
+ then
+ return False;
+ end if;
+ end;
end if;
- return Type_Conformant_Parameters (
- Parameter_Specifications (Prim_Op_Spec),
- Parameter_Specifications (Proc_Spec));
+ return
+ Type_Conformant_Parameters (
+ Parameter_Specifications (Iface_Op_Spec),
+ Parameter_Specifications (Wrapper_Spec));
end Overriding_Possible;
- -----------------------------
- -- Replicate_Entry_Formals --
- -----------------------------
+ -----------------------
+ -- Replicate_Formals --
+ -----------------------
- function Replicate_Entry_Formals
+ function Replicate_Formals
(Loc : Source_Ptr;
Formals : List_Id) return List_Id
is
@@ -1802,6 +1890,14 @@ package body Exp_Ch9 is
begin
Formal := First (Formals);
+
+ -- Skip the object parameter when dealing with primitives declared
+ -- between two views.
+
+ if Is_Private_Primitive_Subprogram (Subp_Id) then
+ Formal := Next (Formal);
+ end if;
+
while Present (Formal) loop
-- Create an explicit copy of the entry parameter
@@ -1835,166 +1931,229 @@ package body Exp_Ch9 is
end loop;
return New_Formals;
- end Replicate_Entry_Formals;
+ end Replicate_Formals;
-- Start of processing for Build_Wrapper_Spec
begin
- -- The mode is determined by the first parameter of the interface-level
- -- procedure that the current entry is trying to override.
+ -- There is no point in building wrappers for non-tagged concurrent
+ -- types.
- pragma Assert (Is_Non_Empty_List (Abstract_Interface_List (Obj_Typ)));
+ pragma Assert (Is_Tagged_Type (Obj_Typ));
- -- We must examine all the protected operations of the implemented
- -- interfaces in order to discover a possible overriding candidate.
+ -- An entry or a protected procedure can override a routine where the
+ -- controlling formal is either IN OUT, OUT or is of access-to-variable
+ -- type. Since the wrapper must have the exact same signature as that of
+ -- the overridden subprogram, we try to find the overriding candidate
+ -- and use its controlling formal.
- Iface := Etype (First (Abstract_Interface_List (Obj_Typ)));
+ First_Param := Empty;
- Examine_Parents : loop
- if Present (Primitive_Operations (Iface)) then
- Iface_Prim_Op_Elmt := First_Elmt (Primitive_Operations (Iface));
- while Present (Iface_Prim_Op_Elmt) loop
- Iface_Prim_Op := Node (Iface_Prim_Op_Elmt);
-
- if not Is_Predefined_Dispatching_Operation (Iface_Prim_Op) then
- while Present (Alias (Iface_Prim_Op)) loop
- Iface_Prim_Op := Alias (Iface_Prim_Op);
- end loop;
+ -- Check every implemented interface
- -- The current primitive operation can be overridden by the
- -- generated entry wrapper.
-
- if Overriding_Possible (Iface_Prim_Op, Proc_Nam) then
- First_Param := First (Parameter_Specifications
- (Parent (Iface_Prim_Op)));
-
- goto Found;
- end if;
- end if;
-
- Next_Elmt (Iface_Prim_Op_Elmt);
- end loop;
- end if;
-
- exit Examine_Parents when Etype (Iface) = Iface;
-
- Iface := Etype (Iface);
- end loop Examine_Parents;
-
- if Present (Interfaces
- (Corresponding_Record_Type (Scope (Proc_Nam))))
- then
- Iface_Elmt := First_Elmt
- (Interfaces
- (Corresponding_Record_Type (Scope (Proc_Nam))));
- Examine_Interfaces : while Present (Iface_Elmt) loop
+ if Present (Interfaces (Obj_Typ)) then
+ Iface_Elmt := First_Elmt (Interfaces (Obj_Typ));
+ Search : while Present (Iface_Elmt) loop
Iface := Node (Iface_Elmt);
+ -- Check every interface primitive
+
if Present (Primitive_Operations (Iface)) then
- Iface_Prim_Op_Elmt := First_Elmt (Primitive_Operations (Iface));
- while Present (Iface_Prim_Op_Elmt) loop
- Iface_Prim_Op := Node (Iface_Prim_Op_Elmt);
+ Iface_Op_Elmt := First_Elmt (Primitive_Operations (Iface));
+ while Present (Iface_Op_Elmt) loop
+ Iface_Op := Node (Iface_Op_Elmt);
- if not Is_Predefined_Dispatching_Operation
- (Iface_Prim_Op)
- then
- while Present (Alias (Iface_Prim_Op)) loop
- Iface_Prim_Op := Alias (Iface_Prim_Op);
- end loop;
+ -- Ignore predefined primitives
+
+ if not Is_Predefined_Dispatching_Operation (Iface_Op) then
+ Iface_Op := Ultimate_Alias (Iface_Op);
-- The current primitive operation can be overridden by
-- the generated entry wrapper.
- if Overriding_Possible (Iface_Prim_Op, Proc_Nam) then
- First_Param := First (Parameter_Specifications
- (Parent (Iface_Prim_Op)));
+ if Overriding_Possible (Iface_Op, Subp_Id) then
+ First_Param :=
+ First (Parameter_Specifications (Parent (Iface_Op)));
- goto Found;
+ exit Search;
end if;
end if;
- Next_Elmt (Iface_Prim_Op_Elmt);
+ Next_Elmt (Iface_Op_Elmt);
end loop;
end if;
Next_Elmt (Iface_Elmt);
- end loop Examine_Interfaces;
+ end loop Search;
end if;
- -- Return if no interface primitive can be overridden
+ -- If the subprogram to be wrapped is not overriding anything or is not
+ -- a primitive declared between two views, do not produce anything. This
+ -- avoids spurious errors involving overriding.
- return Empty;
+ if No (First_Param)
+ and then not Is_Private_Primitive_Subprogram (Subp_Id)
+ then
+ return Empty;
+ end if;
- <<Found>>
+ declare
+ Wrapper_Id : constant Entity_Id :=
+ Make_Defining_Identifier (Loc, Chars (Subp_Id));
+ New_Formals : List_Id;
+ Obj_Param : Node_Id;
+ Obj_Param_Typ : Entity_Id;
- New_Formals := Replicate_Entry_Formals (Loc, Formals);
+ begin
+ -- Minimum decoration is needed to catch the entity in
+ -- Sem_Ch6.Override_Dispatching_Operation.
- -- ??? Certain source packages contain protected or task types that do
- -- not implement any interfaces and are compiled with the -gnat05
- -- switch. In this case, a default first parameter is created.
+ if Ekind (Subp_Id) = E_Function then
+ Set_Ekind (Wrapper_Id, E_Function);
+ else
+ Set_Ekind (Wrapper_Id, E_Procedure);
+ end if;
- -- If the interface operation has an access parameter, create a copy
- -- of it, with the same null exclusion indicator if present.
+ Set_Is_Primitive_Wrapper (Wrapper_Id);
+ Set_Wrapped_Entity (Wrapper_Id, Subp_Id);
+ Set_Is_Private_Primitive (Wrapper_Id,
+ Is_Private_Primitive_Subprogram (Subp_Id));
- if Present (First_Param) then
- if Nkind (Parameter_Type (First_Param)) = N_Access_Definition then
- Obj_Param_Typ :=
- Make_Access_Definition (Loc,
- Subtype_Mark =>
- New_Reference_To (Obj_Typ, Loc));
- Set_Null_Exclusion_Present (Obj_Param_Typ,
- Null_Exclusion_Present (Parameter_Type (First_Param)));
+ -- Process the formals
+
+ New_Formals := Replicate_Formals (Loc, Formals);
+
+ -- Routine Subp_Id has been found to override an interface primitive.
+ -- If the interface operation has an access parameter, create a copy
+ -- of it, with the same null exclusion indicator if present.
+
+ if Present (First_Param) then
+ if Nkind (Parameter_Type (First_Param)) = N_Access_Definition then
+ Obj_Param_Typ :=
+ Make_Access_Definition (Loc,
+ Subtype_Mark =>
+ New_Reference_To (Obj_Typ, Loc));
+ Set_Null_Exclusion_Present (Obj_Param_Typ,
+ Null_Exclusion_Present (Parameter_Type (First_Param)));
+
+ else
+ Obj_Param_Typ := New_Reference_To (Obj_Typ, Loc);
+ end if;
+
+ Obj_Param :=
+ Make_Parameter_Specification (Loc,
+ Defining_Identifier =>
+ Make_Defining_Identifier (Loc,
+ Chars => Name_uO),
+ In_Present => In_Present (First_Param),
+ Out_Present => Out_Present (First_Param),
+ Parameter_Type => Obj_Param_Typ);
+
+ -- If we are dealing with a primitive declared between two views,
+ -- create a default parameter.
+
+ else pragma Assert (Is_Private_Primitive_Subprogram (Subp_Id));
+ Obj_Param :=
+ Make_Parameter_Specification (Loc,
+ Defining_Identifier =>
+ Make_Defining_Identifier (Loc, Name_uO),
+ In_Present => True,
+ Out_Present => Ekind (Subp_Id) /= E_Function,
+ Parameter_Type => New_Reference_To (Obj_Typ, Loc));
+ end if;
+
+ Prepend_To (New_Formals, Obj_Param);
+
+ -- Build the final spec
+ if Ekind (Subp_Id) = E_Function then
+ return
+ Make_Function_Specification (Loc,
+ Defining_Unit_Name => Wrapper_Id,
+ Parameter_Specifications => New_Formals,
+ Result_Definition =>
+ New_Copy (Result_Definition (Parent (Subp_Id))));
else
- Obj_Param_Typ := New_Reference_To (Obj_Typ, Loc);
+ return
+ Make_Procedure_Specification (Loc,
+ Defining_Unit_Name => Wrapper_Id,
+ Parameter_Specifications => New_Formals);
end if;
+ end;
+ end Build_Wrapper_Spec;
- Obj_Param :=
- Make_Parameter_Specification (Loc,
- Defining_Identifier =>
- Make_Defining_Identifier (Loc, Name_uO),
- In_Present => In_Present (First_Param),
- Out_Present => Out_Present (First_Param),
- Parameter_Type => Obj_Param_Typ);
+ -------------------------
+ -- Build_Wrapper_Specs --
+ -------------------------
- else
- Obj_Param :=
- Make_Parameter_Specification (Loc,
- Defining_Identifier =>
- Make_Defining_Identifier (Loc, Name_uO),
- In_Present => True,
- Out_Present => True,
- Parameter_Type => New_Reference_To (Obj_Typ, Loc));
+ procedure Build_Wrapper_Specs
+ (Loc : Source_Ptr;
+ Typ : Entity_Id;
+ N : in out Node_Id)
+ is
+ Def : Node_Id;
+ Rec_Typ : Entity_Id;
+
+ begin
+ if Is_Protected_Type (Typ) then
+ Def := Protected_Definition (Parent (Typ));
+ else pragma Assert (Is_Task_Type (Typ));
+ Def := Task_Definition (Parent (Typ));
end if;
- Prepend_To (New_Formals, Obj_Param);
+ Rec_Typ := Corresponding_Record_Type (Typ);
- -- Minimum decoration needed to catch the entity in
- -- Sem_Ch6.Override_Dispatching_Operation
+ -- Generate wrapper specs for a concurrent type which implements an
+ -- interface and has visible entries and/or protected procedures.
- if Ekind (Proc_Nam) = E_Procedure
- or else Ekind (Proc_Nam) = E_Entry
+ if Present (Interfaces (Rec_Typ))
+ and then Present (Def)
+ and then Present (Visible_Declarations (Def))
then
- Set_Ekind (New_Name_Id, E_Procedure);
- Set_Is_Primitive_Wrapper (New_Name_Id);
- Set_Wrapped_Entity (New_Name_Id, Proc_Nam);
+ declare
+ Decl : Node_Id;
+ Wrap_Decl : Node_Id;
+ Wrap_Spec : Node_Id;
- return
- Make_Procedure_Specification (Loc,
- Defining_Unit_Name => New_Name_Id,
- Parameter_Specifications => New_Formals);
+ begin
+ Decl := First (Visible_Declarations (Def));
+ while Present (Decl) loop
+ Wrap_Spec := Empty;
- else pragma Assert (Ekind (Proc_Nam) = E_Function);
- Set_Ekind (New_Name_Id, E_Function);
+ if Nkind (Decl) = N_Entry_Declaration
+ and then Ekind (Defining_Identifier (Decl)) = E_Entry
+ then
+ Wrap_Spec :=
+ Build_Wrapper_Spec (Loc,
+ Subp_Id => Defining_Identifier (Decl),
+ Obj_Typ => Rec_Typ,
+ Formals => Parameter_Specifications (Decl));
- return
- Make_Function_Specification (Loc,
- Defining_Unit_Name => New_Name_Id,
- Parameter_Specifications => New_Formals,
- Result_Definition =>
- New_Copy (Result_Definition (Parent (Proc_Nam))));
+ elsif Nkind (Decl) = N_Subprogram_Declaration then
+ Wrap_Spec :=
+ Build_Wrapper_Spec (Loc,
+ Subp_Id => Defining_Unit_Name (Specification (Decl)),
+ Obj_Typ => Rec_Typ,
+ Formals =>
+ Parameter_Specifications (Specification (Decl)));
+ end if;
+
+ if Present (Wrap_Spec) then
+ Wrap_Decl :=
+ Make_Subprogram_Declaration (Loc,
+ Specification => Wrap_Spec);
+
+ Insert_After (N, Wrap_Decl);
+ N := Wrap_Decl;
+
+ Analyze (Wrap_Decl);
+ end if;
+
+ Next (Decl);
+ end loop;
+ end;
end if;
- end Build_Wrapper_Spec;
+ end Build_Wrapper_Specs;
---------------------------
-- Build_Find_Body_Index --
@@ -4574,9 +4733,9 @@ package body Exp_Ch9 is
Def1 : Node_Id;
begin
- -- Create access to protected subprogram with full signature
+ -- Create access to subprogram with full signature
- if Nkind (Type_Definition (N)) = N_Access_Function_Definition then
+ if Etype (D_T) /= Standard_Void_Type then
Def1 :=
Make_Access_Function_Definition (Loc,
Parameter_Specifications => P_List,
@@ -4594,8 +4753,8 @@ package body Exp_Ch9 is
Defining_Identifier => D_T2,
Type_Definition => Def1);
- Analyze (Decl1);
Insert_After (N, Decl1);
+ Analyze (Decl1);
-- Create Equivalent_Type, a record with two components for an access to
-- object and an access to subprogram.
@@ -4627,8 +4786,8 @@ package body Exp_Ch9 is
Make_Component_List (Loc,
Component_Items => Comps)));
- Analyze (Decl2);
Insert_After (Decl1, Decl2);
+ Analyze (Decl2);
Set_Equivalent_Type (T, E_T);
end Expand_Access_Protected_Subprogram_Type;
@@ -6903,13 +7062,17 @@ package body Exp_Ch9 is
procedure Expand_N_Protected_Body (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
Pid : constant Entity_Id := Corresponding_Spec (N);
- Op_Body : Node_Id;
- Op_Decl : Node_Id;
- Op_Id : Entity_Id;
+
+ Current_Node : Node_Id;
Disp_Op_Body : Node_Id;
New_Op_Body : Node_Id;
- Current_Node : Node_Id;
Num_Entries : Natural := 0;
+ Op_Body : Node_Id;
+ Op_Decl : Node_Id;
+ Op_Id : Entity_Id;
+
+ Chain : Entity_Id := Empty;
+ -- Finalization chain that may be attached to new body
function Build_Dispatching_Subprogram_Body
(N : Node_Id;
@@ -7002,14 +7165,12 @@ package body Exp_Ch9 is
return;
end if;
- if Nkind (Parent (N)) = N_Subunit then
-
- -- This is the proper body corresponding to a stub. The declarations
- -- must be inserted at the point of the stub, which is in the decla-
- -- rative part of the parent unit.
+ -- This is the proper body corresponding to a stub. The declarations
+ -- must be inserted at the point of the stub, which in turn is in the
+ -- declarative part of the parent unit.
+ if Nkind (Parent (N)) = N_Subunit then
Current_Node := Corresponding_Stub (Parent (N));
-
else
Current_Node := N;
end if;
@@ -7046,13 +7207,13 @@ package body Exp_Ch9 is
-- entity is not further elaborated, and so the chain
-- properly belongs to the newly created subprogram body.
- if Present
- (Finalization_Chain_Entity (Defining_Entity (Op_Body)))
- then
+ Chain :=
+ Finalization_Chain_Entity (Defining_Entity (Op_Body));
+
+ if Present (Chain) then
Set_Finalization_Chain_Entity
(Protected_Body_Subprogram
- (Corresponding_Spec (Op_Body)),
- Finalization_Chain_Entity (Defining_Entity (Op_Body)));
+ (Corresponding_Spec (Op_Body)), Chain);
Set_Analyzed
(Handled_Statement_Sequence (New_Op_Body), False);
end if;
@@ -7171,63 +7332,12 @@ package body Exp_Ch9 is
Analyze (New_Op_Body);
end if;
- -- Ada 2005 (AI-345): Construct the primitive entry wrapper bodies after
- -- the protected body. At this point the entry specs have been created,
+ -- Ada 2005 (AI-345): Construct the primitive wrapper bodies after the
+ -- protected body. At this point all wrapper specs have been created,
-- frozen and included in the dispatch table for the protected type.
- pragma Assert (Present (Corresponding_Record_Type (Pid)));
-
- if Ada_Version >= Ada_05
- and then Present (Protected_Definition (Parent (Pid)))
- and then Present (Interfaces (Corresponding_Record_Type (Pid)))
- then
- declare
- Vis_Decl : Node_Id :=
- First (Visible_Declarations
- (Protected_Definition (Parent (Pid))));
- Wrap_Body : Node_Id;
-
- begin
- -- Examine the visible declarations of the protected type, looking
- -- for an entry declaration. We do not consider entry families
- -- since they cannot have dispatching operations, thus they do not
- -- need entry wrappers.
-
- while Present (Vis_Decl) loop
- if Nkind (Vis_Decl) = N_Entry_Declaration then
- Wrap_Body :=
- Build_Wrapper_Body (Loc,
- Proc_Nam => Defining_Identifier (Vis_Decl),
- Obj_Typ => Corresponding_Record_Type (Pid),
- Formals => Parameter_Specifications (Vis_Decl));
-
- if Wrap_Body /= Empty then
- Insert_After (Current_Node, Wrap_Body);
- Current_Node := Wrap_Body;
-
- Analyze (Wrap_Body);
- end if;
-
- elsif Nkind (Vis_Decl) = N_Subprogram_Declaration then
- Wrap_Body :=
- Build_Wrapper_Body (Loc,
- Proc_Nam => Defining_Unit_Name
- (Specification (Vis_Decl)),
- Obj_Typ => Corresponding_Record_Type (Pid),
- Formals => Parameter_Specifications
- (Specification (Vis_Decl)));
-
- if Wrap_Body /= Empty then
- Insert_After (Current_Node, Wrap_Body);
- Current_Node := Wrap_Body;
-
- Analyze (Wrap_Body);
- end if;
- end if;
-
- Next (Vis_Decl);
- end loop;
- end;
+ if Ada_Version >= Ada_05 then
+ Build_Wrapper_Bodies (Loc, Pid, Current_Node);
end if;
end Expand_N_Protected_Body;
@@ -7625,67 +7735,11 @@ package body Exp_Ch9 is
Analyze (Rec_Decl, Suppress => All_Checks);
-- Ada 2005 (AI-345): Construct the primitive entry wrappers before
- -- the corresponding record is frozen
-
- if Ada_Version >= Ada_05
- and then Present (Visible_Declarations (Pdef))
- and then Present (Corresponding_Record_Type
- (Defining_Identifier (Parent (Pdef))))
- and then Present (Interfaces
- (Corresponding_Record_Type
- (Defining_Identifier (Parent (Pdef)))))
- then
- declare
- Current_Node : Node_Id := Rec_Decl;
- Vis_Decl : Node_Id;
- Wrap_Spec : Node_Id;
- New_N : Node_Id;
-
- begin
- -- Examine the visible declarations of the protected type, looking
- -- for declarations of entries, and subprograms. We do not
- -- consider entry families since they cannot have dispatching
- -- operations, thus they do not need entry wrappers.
-
- Vis_Decl := First (Visible_Declarations (Pdef));
-
- while Present (Vis_Decl) loop
-
- Wrap_Spec := Empty;
-
- if Nkind (Vis_Decl) = N_Entry_Declaration
- and then No (Discrete_Subtype_Definition (Vis_Decl))
- then
- Wrap_Spec :=
- Build_Wrapper_Spec (Loc,
- Proc_Nam => Defining_Identifier (Vis_Decl),
- Obj_Typ => Defining_Identifier (Rec_Decl),
- Formals => Parameter_Specifications (Vis_Decl));
-
- elsif Nkind (Vis_Decl) = N_Subprogram_Declaration then
- Wrap_Spec :=
- Build_Wrapper_Spec (Loc,
- Proc_Nam => Defining_Unit_Name
- (Specification (Vis_Decl)),
- Obj_Typ => Defining_Identifier (Rec_Decl),
- Formals => Parameter_Specifications
- (Specification (Vis_Decl)));
-
- end if;
-
- if Wrap_Spec /= Empty then
- New_N := Make_Subprogram_Declaration (Loc,
- Specification => Wrap_Spec);
-
- Insert_After (Current_Node, New_N);
- Current_Node := New_N;
+ -- the corresponding record is frozen. If any wrappers are generated,
+ -- Current_Node is updated accordingly.
- Analyze (New_N);
- end if;
-
- Next (Vis_Decl);
- end loop;
- end;
+ if Ada_Version >= Ada_05 then
+ Build_Wrapper_Specs (Loc, Prot_Typ, Current_Node);
end if;
-- Collect pointers to entry bodies and their barriers, to be placed
@@ -7694,9 +7748,7 @@ package body Exp_Ch9 is
-- this array. The array is declared after all protected subprograms.
if Has_Entries (Prot_Typ) then
- Entries_Aggr :=
- Make_Aggregate (Loc, Expressions => New_List);
-
+ Entries_Aggr := Make_Aggregate (Loc, Expressions => New_List);
else
Entries_Aggr := Empty;
end if;
@@ -9461,6 +9513,9 @@ package body Exp_Ch9 is
Call : Node_Id;
New_N : Node_Id;
+ Insert_Nod : Node_Id;
+ -- Used to determine the proper location of wrapper body insertions
+
begin
-- Add renaming declarations for discriminals and a declaration for the
-- entry family index (if applicable).
@@ -9527,56 +9582,17 @@ package body Exp_Ch9 is
end if;
-- Ada 2005 (AI-345): Construct the primitive entry wrapper bodies after
- -- the task body. At this point the entry specs have been created,
+ -- the task body. At this point all wrapper specs have been created,
-- frozen and included in the dispatch table for the task type.
- pragma Assert (Present (Corresponding_Record_Type (Ttyp)));
-
- if Ada_Version >= Ada_05
- and then Present (Task_Definition (Parent (Ttyp)))
- and then Present (Interfaces (Corresponding_Record_Type (Ttyp)))
- then
- declare
- Current_Node : Node_Id;
- Vis_Decl : Node_Id :=
- First (Visible_Declarations (Task_Definition (Parent (Ttyp))));
- Wrap_Body : Node_Id;
-
- begin
- if Nkind (Parent (N)) = N_Subunit then
- Current_Node := Corresponding_Stub (Parent (N));
- else
- Current_Node := N;
- end if;
-
- -- Examine the visible declarations of the task type, looking for
- -- an entry declaration. We do not consider entry families since
- -- they cannot have dispatching operations, thus they do not need
- -- entry wrappers.
-
- while Present (Vis_Decl) loop
- if Nkind (Vis_Decl) = N_Entry_Declaration
- and then Ekind (Defining_Identifier (Vis_Decl)) = E_Entry
- then
- -- Create the specification of the wrapper
-
- Wrap_Body :=
- Build_Wrapper_Body (Loc,
- Proc_Nam => Defining_Identifier (Vis_Decl),
- Obj_Typ => Corresponding_Record_Type (Ttyp),
- Formals => Parameter_Specifications (Vis_Decl));
-
- if Wrap_Body /= Empty then
- Insert_After (Current_Node, Wrap_Body);
- Current_Node := Wrap_Body;
-
- Analyze (Wrap_Body);
- end if;
- end if;
+ if Ada_Version >= Ada_05 then
+ if Nkind (Parent (N)) = N_Subunit then
+ Insert_Nod := Corresponding_Stub (Parent (N));
+ else
+ Insert_Nod := N;
+ end if;
- Next (Vis_Decl);
- end loop;
- end;
+ Build_Wrapper_Bodies (Loc, Ttyp, Insert_Nod);
end if;
end Expand_N_Task_Body;
@@ -10025,51 +10041,8 @@ package body Exp_Ch9 is
-- Ada 2005 (AI-345): Construct the primitive entry wrapper specs before
-- the corresponding record has been frozen.
- if Ada_Version >= Ada_05
- and then Present (Taskdef)
- and then Present (Corresponding_Record_Type
- (Defining_Identifier (Parent (Taskdef))))
- and then Present (Interfaces
- (Corresponding_Record_Type
- (Defining_Identifier (Parent (Taskdef)))))
- then
- declare
- Current_Node : Node_Id := Rec_Decl;
- Vis_Decl : Node_Id := First (Visible_Declarations (Taskdef));
- Wrap_Spec : Node_Id;
- New_N : Node_Id;
-
- begin
- -- Examine the visible declarations of the task type, looking for
- -- an entry declaration. We do not consider entry families since
- -- they cannot have dispatching operations, thus they do not need
- -- entry wrappers.
-
- while Present (Vis_Decl) loop
- if Nkind (Vis_Decl) = N_Entry_Declaration
- and then Ekind (Defining_Identifier (Vis_Decl)) = E_Entry
- then
- Wrap_Spec :=
- Build_Wrapper_Spec (Loc,
- Proc_Nam => Defining_Identifier (Vis_Decl),
- Obj_Typ => Etype (Rec_Ent),
- Formals => Parameter_Specifications (Vis_Decl));
-
- if Wrap_Spec /= Empty then
- New_N :=
- Make_Subprogram_Declaration (Loc,
- Specification => Wrap_Spec);
-
- Insert_After (Current_Node, New_N);
- Current_Node := New_N;
-
- Analyze (New_N);
- end if;
- end if;
-
- Next (Vis_Decl);
- end loop;
- end;
+ if Ada_Version >= Ada_05 then
+ Build_Wrapper_Specs (Loc, Tasktyp, Rec_Decl);
end if;
-- Ada 2005 (AI-345): We must defer freezing to allow further
@@ -11408,6 +11381,17 @@ package body Exp_Ch9 is
or else Denotes_Discriminant (Hi, True));
end Is_Potentially_Large_Family;
+ -------------------------------------
+ -- Is_Private_Primitive_Subprogram --
+ -------------------------------------
+
+ function Is_Private_Primitive_Subprogram (Id : Entity_Id) return Boolean is
+ begin
+ return
+ (Ekind (Id) = E_Function or else Ekind (Id) = E_Procedure)
+ and then Is_Private_Primitive (Id);
+ end Is_Private_Primitive_Subprogram;
+
------------------
-- Index_Object --
------------------
diff --git a/gcc/ada/exp_ch9.ads b/gcc/ada/exp_ch9.ads
index a4c618a61cb..1cfa74d3635 100644
--- a/gcc/ada/exp_ch9.ads
+++ b/gcc/ada/exp_ch9.ads
@@ -153,6 +153,18 @@ package Exp_Ch9 is
-- aggregate. It replaces the call to Init (Args) done by
-- Build_Task_Allocate_Block.
+ function Build_Wrapper_Spec
+ (Loc : Source_Ptr;
+ Subp_Id : Entity_Id;
+ Obj_Typ : Entity_Id;
+ Formals : List_Id) return Node_Id;
+ -- Ada 2005 (AI-345): Build the specification of a primitive operation
+ -- associated with a protected or task type. This is required to implement
+ -- dispatching calls through interfaces. Subp_Id is the primitive to be
+ -- wrapped, Obj_Typ is the type of the newly added formal parameter to
+ -- handle object notation, Formals are the original entry formals that
+ -- will be explicitly replicated.
+
function Concurrent_Ref (N : Node_Id) return Node_Id;
-- Given the name of a concurrent object (task or protected object), or
-- the name of an access to a concurrent object, this function returns an
diff --git a/gcc/ada/exp_disp.adb b/gcc/ada/exp_disp.adb
index 864206951f6..591150101fc 100644
--- a/gcc/ada/exp_disp.adb
+++ b/gcc/ada/exp_disp.adb
@@ -766,6 +766,18 @@ package body Exp_Disp is
Iface_Typ := Root_Type (Iface_Typ);
end if;
+ -- If the target type is a tagged synchronized type, the dispatch table
+ -- info is in the correspondoing record type.
+
+ if Is_Concurrent_Type (Iface_Typ) then
+ Iface_Typ := Corresponding_Record_Type (Iface_Typ);
+ end if;
+
+ -- Freeze the entity associated with the target interface to have
+ -- available the attribute Access_Disp_Table.
+
+ Freeze_Before (N, Iface_Typ);
+
pragma Assert (not Is_Static
or else (not Is_Class_Wide_Type (Iface_Typ)
and then Is_Interface (Iface_Typ)));
@@ -1042,7 +1054,12 @@ package body Exp_Disp is
if Nkind (Name (Call_Node)) = N_Explicit_Dereference then
Subp := Etype (Name (Call_Node));
- -- Normal case
+ -- Call using selected component
+
+ elsif Nkind (Name (Call_Node)) = N_Selected_Component then
+ Subp := Entity (Selector_Name (Name (Call_Node)));
+
+ -- Call using direct name
else
Subp := Entity (Name (Call_Node));
@@ -6042,6 +6059,13 @@ package body Exp_Disp is
Full_Typ := Corresponding_Concurrent_Type (Typ);
end if;
+ -- When a private tagged type is completed by a concurrent type,
+ -- retrieve the full view.
+
+ if Is_Private_Type (Full_Typ) then
+ Full_Typ := Full_View (Full_Typ);
+ end if;
+
if Ekind (Prim_Op) = E_Function then
-- Protected function
diff --git a/gcc/ada/exp_dist.adb b/gcc/ada/exp_dist.adb
index c22239277bf..38693f13b6a 100644
--- a/gcc/ada/exp_dist.adb
+++ b/gcc/ada/exp_dist.adb
@@ -858,6 +858,25 @@ package body Exp_Dist is
end PolyORB_Support;
+ -- The following PolyORB-specific subprograms are made visible to Exp_Attr:
+
+ function Build_From_Any_Call
+ (Typ : Entity_Id;
+ N : Node_Id;
+ Decls : List_Id) return Node_Id
+ renames PolyORB_Support.Helpers.Build_From_Any_Call;
+
+ function Build_To_Any_Call
+ (N : Node_Id;
+ Decls : List_Id) return Node_Id
+ renames PolyORB_Support.Helpers.Build_To_Any_Call;
+
+ function Build_TypeCode_Call
+ (Loc : Source_Ptr;
+ Typ : Entity_Id;
+ Decls : List_Id) return Node_Id
+ renames PolyORB_Support.Helpers.Build_TypeCode_Call;
+
------------------------------------
-- Local variables and structures --
------------------------------------
@@ -8218,12 +8237,11 @@ package body Exp_Dist is
-- point type from Standard, or the smallest unsigned (modular) type
-- from System.Unsigned_Types, whose range encompasses that of Typ.
- function Make_Stream_Procedure_Function_Name
+ function Make_Helper_Function_Name
(Loc : Source_Ptr;
Typ : Entity_Id;
Nam : Name_Id) return Entity_Id;
- -- Return the name to be assigned for stream subprogram Nam of Typ.
- -- (copied from exp_strm.adb, should be shared???)
+ -- Return the name to be assigned for helper subprogram Nam of Typ
------------------------------------------------------------
-- Common subprograms for building various tree fragments --
@@ -8432,6 +8450,11 @@ package body Exp_Dist is
elsif U_Type = Standard_String then
Lib_RE := RE_FA_String;
+ -- Special DSA types
+
+ elsif Is_RTE (U_Type, RE_Any_Content_Ptr) then
+ Lib_RE := RE_FA_A;
+
-- Other (non-primitive) types
else
@@ -8493,8 +8516,7 @@ package body Exp_Dist is
return;
end if;
- Fnam :=
- Make_Stream_Procedure_Function_Name (Loc, Typ, Name_uFrom_Any);
+ Fnam := Make_Helper_Function_Name (Loc, Typ, Name_From_Any);
Spec :=
Make_Function_Specification (Loc,
@@ -9293,7 +9315,13 @@ package body Exp_Dist is
elsif U_Type = Standard_String then
Lib_RE := RE_TA_String;
+ -- Special DSA types
+
+ elsif Is_RTE (U_Type, RE_Any_Content_Ptr) then
+ Lib_RE := RE_TA_A;
+
elsif U_Type = Underlying_Type (RTE (RE_TypeCode)) then
+ -- No corresponding FA_TC ???
Lib_RE := RE_TA_TC;
-- Other (non-primitive) types
@@ -9358,8 +9386,7 @@ package body Exp_Dist is
return;
end if;
- Fnam :=
- Make_Stream_Procedure_Function_Name (Loc, Typ, Name_uTo_Any);
+ Fnam := Make_Helper_Function_Name (Loc, Typ, Name_To_Any);
Spec :=
Make_Function_Specification (Loc,
@@ -9976,7 +10003,7 @@ package body Exp_Dist is
-- not been set yet, so can't call Find_Inherited_TSS.
if Typ = RTE (RE_Any) then
- Fnam := RTE (RE_TC_Any);
+ Fnam := RTE (RE_TC_A);
else
-- First simple case where the TypeCode is present
@@ -10057,6 +10084,11 @@ package body Exp_Dist is
elsif U_Type = Standard_String then
Lib_RE := RE_TC_String;
+ -- Special DSA types
+
+ elsif Is_RTE (U_Type, RE_Any_Content_Ptr) then
+ Lib_RE := RE_TC_A;
+
-- Other (non-primitive) types
else
@@ -10100,8 +10132,7 @@ package body Exp_Dist is
Stms : constant List_Id := New_List;
TCNam : constant Entity_Id :=
- Make_Stream_Procedure_Function_Name (Loc,
- Typ, Name_uTypeCode);
+ Make_Helper_Function_Name (Loc, Typ, Name_TypeCode);
Parameters : List_Id;
@@ -10964,30 +10995,40 @@ package body Exp_Dist is
end;
end Append_Array_Traversal;
- -----------------------------------------
- -- Make_Stream_Procedure_Function_Name --
- -----------------------------------------
+ -------------------------------
+ -- Make_Helper_Function_Name --
+ -------------------------------
- function Make_Stream_Procedure_Function_Name
+ function Make_Helper_Function_Name
(Loc : Source_Ptr;
Typ : Entity_Id;
Nam : Name_Id) return Entity_Id
is
begin
- -- For tagged types, we use a canonical name so that it matches
- -- the primitive spec. For all other cases, we use a serialized
- -- name so that multiple generations of the same procedure do not
- -- clash.
+ declare
+ Serial : Nat := 0;
+ -- For tagged types, we use a canonical name so that it matches
+ -- the primitive spec. For all other cases, we use a serialized
+ -- name so that multiple generations of the same procedure do
+ -- not clash.
+
+ begin
+ if not Is_Tagged_Type (Typ) then
+ Serial := Increment_Serial_Number;
+ end if;
+
+ -- Use prefixed underscore to avoid potential clash with used
+ -- identifier (we use attribute names for Nam).
- if Is_Tagged_Type (Typ) then
- return Make_Defining_Identifier (Loc, Nam);
- else
return
Make_Defining_Identifier (Loc,
Chars =>
- New_External_Name (Nam, ' ', Increment_Serial_Number));
- end if;
- end Make_Stream_Procedure_Function_Name;
+ New_External_Name
+ (Related_Id => Nam,
+ Suffix => ' ', Suffix_Index => Serial,
+ Prefix => '_'));
+ end;
+ end Make_Helper_Function_Name;
end Helpers;
-----------------------------------
diff --git a/gcc/ada/exp_dist.ads b/gcc/ada/exp_dist.ads
index a1418d3f6bb..26995a8b9f9 100644
--- a/gcc/ada/exp_dist.ads
+++ b/gcc/ada/exp_dist.ads
@@ -129,4 +129,37 @@ package Exp_Dist is
-- a remote call) satisfies the requirements for being transportable
-- across partitions, raising Program_Error if it does not.
+ ----------------------------------------------------------------
+ -- Functions for expansion of PolyORB/DSA specific attributes --
+ ----------------------------------------------------------------
+
+ function Build_From_Any_Call
+ (Typ : Entity_Id;
+ N : Node_Id;
+ Decls : List_Id) return Node_Id;
+ -- Build call to From_Any attribute function of type Typ with expression
+ -- N as actual parameter. Decls is the declarations list for an appropriate
+ -- enclosing scope of the point where the call will be inserted; if the
+ -- From_Any attribute for Typ needs to be generated at this point, its
+ -- declaration is appended to Decls.
+
+ function Build_To_Any_Call
+ (N : Node_Id;
+ Decls : List_Id) return Node_Id;
+ -- Build call to To_Any attribute function with expression as actual
+ -- parameter. Decls is the declarations list for an appropriate
+ -- enclosing scope of the point where the call will be inserted; if
+ -- the To_Any attribute for Typ needs to be generated at this point,
+ -- its declaration is appended to Decls.
+
+ function Build_TypeCode_Call
+ (Loc : Source_Ptr;
+ Typ : Entity_Id;
+ Decls : List_Id) return Node_Id;
+ -- Build call to TypeCode attribute function for Typ. Decls is the
+ -- declarations list for an appropriate enclosing scope of the point
+ -- where the call will be inserted; if the To_Any attribute for Typ
+ -- needs to be generated at this point, its declaration is appended
+ -- to Decls.
+
end Exp_Dist;
diff --git a/gcc/ada/exp_strm.adb b/gcc/ada/exp_strm.adb
index 2ffa26a4cf9..6f34cae3c4c 100644
--- a/gcc/ada/exp_strm.adb
+++ b/gcc/ada/exp_strm.adb
@@ -1113,12 +1113,22 @@ package body Exp_Strm is
while Present (Discr) loop
Cn := New_External_Name ('C', J);
- Append_To (Decls,
+ Decl :=
Make_Object_Declaration (Loc,
Defining_Identifier => Make_Defining_Identifier (Loc, Cn),
Object_Definition =>
- New_Occurrence_Of (Etype (Discr), Loc)));
+ New_Occurrence_Of (Etype (Discr), Loc));
+
+ -- If this is an access discriminant, do not perform default
+ -- initialization. The discriminant is about to get its value
+ -- from Read, and if the type is null excluding we do not want
+ -- spurious warnings on an initial null value.
+
+ if Is_Access_Type (Etype (Discr)) then
+ Set_No_Initialization (Decl);
+ end if;
+ Append_To (Decls, Decl);
Append_To (Decls,
Make_Attribute_Reference (Loc,
Prefix => New_Occurrence_Of (Etype (Discr), Loc),
diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb
index d41a6bc383c..09850f644d4 100644
--- a/gcc/ada/exp_util.adb
+++ b/gcc/ada/exp_util.adb
@@ -1581,7 +1581,12 @@ package body Exp_Util is
or else Etype (First_Entity (Op)) = Etype (Last_Entity (Op)));
Next_Elmt (Prim);
- pragma Assert (Present (Prim));
+
+ -- Raise Program_Error if no primitive found
+
+ if No (Prim) then
+ raise Program_Error;
+ end if;
end loop;
return Node (Prim);
@@ -1608,7 +1613,12 @@ package body Exp_Util is
Prim := First_Elmt (Primitive_Operations (Typ));
while not Is_TSS (Node (Prim), Name) loop
Next_Elmt (Prim);
- pragma Assert (Present (Prim));
+
+ -- Raise program error if no primitive found
+
+ if No (Prim) then
+ raise Program_Error;
+ end if;
end loop;
return Node (Prim);
diff --git a/gcc/ada/exp_util.ads b/gcc/ada/exp_util.ads
index 5e57147b720..5848d5d7171 100644
--- a/gcc/ada/exp_util.ads
+++ b/gcc/ada/exp_util.ads
@@ -360,7 +360,10 @@ package Exp_Util is
-- Find the first primitive operation of type T whose name is 'Name'.
-- This function allows the use of a primitive operation which is not
-- directly visible. If T is a class wide type, then the reference is
- -- to an operation of the corresponding root type.
+ -- to an operation of the corresponding root type. Raises Program_Error
+ -- exception if no primitive operation is found. This is normally an
+ -- internal error, but in some cases is an expected consequence of
+ -- illegalities elsewhere.
function Find_Prim_Op
(T : Entity_Id;
@@ -370,6 +373,9 @@ package Exp_Util is
-- with the indicated suffix). This function allows use of a primitive
-- operation which is not directly visible. If T is a class wide type,
-- then the reference is to an operation of the corresponding root type.
+ -- Raises Program_Error exception if no primitive operation is found.
+ -- This is normally an internal error, but in some cases is an expected
+ -- consequence of illegalities elsewhere.
function Find_Protection_Object (Scop : Entity_Id) return Entity_Id;
-- Traverse the scope stack starting from Scop and look for an entry,
diff --git a/gcc/ada/fe.h b/gcc/ada/fe.h
index 2e21af503de..e69f798db5d 100644
--- a/gcc/ada/fe.h
+++ b/gcc/ada/fe.h
@@ -219,8 +219,10 @@ extern void Set_Has_No_Elaboration_Code (Node_Id, Boolean);
/* targparm: */
+#define Backend_Overflow_Checks_On_Target targparm__backend_overflow_checks_on_target
#define Stack_Check_Probes_On_Target targparm__stack_check_probes_on_target
#define Stack_Check_Limits_On_Target targparm__stack_check_limits_on_target
+extern Boolean Backend_Overflow_Checks_On_Target;
extern Boolean Stack_Check_Probes_On_Target;
extern Boolean Stack_Check_Limits_On_Target;
diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb
index 31f93985c44..5e069f4c7a4 100644
--- a/gcc/ada/freeze.adb
+++ b/gcc/ada/freeze.adb
@@ -134,6 +134,11 @@ package body Freeze is
-- the designated type. Otherwise freezing the access type does not freeze
-- the designated type.
+ procedure Generate_Prim_Op_References
+ (Typ : Entity_Id);
+ -- For a tagged type, generate implicit references to its primitive
+ -- operations, for source navigation.
+
procedure Process_Default_Expressions
(E : Entity_Id;
After : in out Node_Id);
@@ -2398,6 +2403,8 @@ package body Freeze is
elsif Root_Type (F_Type) = Standard_Boolean
and then Convention (F_Type) = Convention_Ada
+ and then not Has_Warnings_Off (F_Type)
+ and then not Has_Size_Clause (F_Type)
then
Error_Msg_N
("?& is an 8-bit Ada Boolean, "
@@ -2543,6 +2550,7 @@ package body Freeze is
and then Convention (R_Type) = Convention_Ada
and then not Has_Warnings_Off (E)
and then not Has_Warnings_Off (R_Type)
+ and then not Has_Size_Clause (R_Type)
then
Error_Msg_N
("?return type of & is an 8-bit "
@@ -2597,6 +2605,10 @@ package body Freeze is
--
-- type T is tagged;
-- function F (X : Boolean) return T; -- ERROR
+ -- The type must be declared in the current scope
+ -- for the use to be legal, and the full view
+ -- must be available when the construct that mentions
+ -- it is frozen.
elsif Ekind (Etype (E)) = E_Incomplete_Type
and then Is_Tagged_Type (Etype (E))
@@ -2605,7 +2617,7 @@ package body Freeze is
then
Error_Msg_N
("(Ada 2005): invalid use of tagged incomplete type",
- E);
+ E);
end if;
end if;
end;
@@ -2632,10 +2644,30 @@ package body Freeze is
-- Here for other than a subprogram or type
else
+ -- For a generic package, freeze types within, so that proper
+ -- cross-reference information is generated for tagged types.
+ -- This is the only freeze processing needed for generic packages.
+
+ if Ekind (E) = E_Generic_Package then
+ declare
+ T : Entity_Id;
+
+ begin
+ T := First_Entity (E);
+
+ while Present (T) loop
+ if Is_Type (T) then
+ Generate_Prim_Op_References (T);
+ end if;
+
+ Next_Entity (T);
+ end loop;
+ end;
+
-- If entity has a type, and it is not a generic unit, then
-- freeze it first (RM 13.14(10)).
- if Present (Etype (E))
+ elsif Present (Etype (E))
and then Ekind (E) /= E_Generic_Function
then
Freeze_And_Append (Etype (E), Loc, Result);
@@ -2661,8 +2693,16 @@ package body Freeze is
-- The check doesn't apply to imported objects, which are not
-- ever default initialized, and is why the check is deferred
-- until freezing, at which point we know if Import applies.
+ -- Deferred constants are also exempted from this test because
+ -- their completion is explicit, or through an import pragma.
- if not Is_Imported (E)
+ if Ekind (E) = E_Constant
+ and then Present (Full_View (E))
+ then
+ null;
+
+ elsif Comes_From_Source (E)
+ and then not Is_Imported (E)
and then not Has_Init_Expression (Declaration_Node (E))
and then
((Has_Non_Null_Base_Init_Proc (Etype (E))
@@ -3617,66 +3657,9 @@ package body Freeze is
end if;
end if;
- -- Generate primitive operation references for a tagged type
-
- if Is_Tagged_Type (E)
- and then not Is_Class_Wide_Type (E)
- then
- declare
- Prim_List : Elist_Id;
- Prim : Elmt_Id;
- Ent : Entity_Id;
- Aux_E : Entity_Id;
-
- begin
- -- Handle subtypes
-
- if Ekind (E) = E_Protected_Subtype
- or else Ekind (E) = E_Task_Subtype
- then
- Aux_E := Etype (E);
- else
- Aux_E := E;
- end if;
-
- -- Ada 2005 (AI-345): In case of concurrent type generate
- -- reference to the wrapper that allow us to dispatch calls
- -- through their implemented abstract interface types.
-
- -- The check for Present here is to protect against previously
- -- reported critical errors.
-
- if Is_Concurrent_Type (Aux_E)
- and then Present (Corresponding_Record_Type (Aux_E))
- then
- Prim_List := Primitive_Operations
- (Corresponding_Record_Type (Aux_E));
- else
- Prim_List := Primitive_Operations (Aux_E);
- end if;
-
- -- Loop to generate references for primitive operations
-
- if Present (Prim_List) then
- Prim := First_Elmt (Prim_List);
- while Present (Prim) loop
-
- -- If the operation is derived, get the original for
- -- cross-reference purposes (it is the original for
- -- which we want the xref, and for which the comes
- -- from source test needs to be performed).
-
- Ent := Node (Prim);
- while Present (Alias (Ent)) loop
- Ent := Alias (Ent);
- end loop;
+ -- Generate references to primitive operations for a tagged type
- Generate_Reference (E, Ent, 'p', Set_Ref => False);
- Next_Elmt (Prim);
- end loop;
- end if;
- end;
- end if;
+ Generate_Prim_Op_References (E);
-- Now that all types from which E may depend are frozen, see if the
-- size is known at compile time, if it must be unsigned, or if
@@ -5221,6 +5204,74 @@ package body Freeze is
end Is_Fully_Defined;
---------------------------------
+ -- Generate_Prim_Op_References --
+ ---------------------------------
+
+ procedure Generate_Prim_Op_References
+ (Typ : Entity_Id)
+ is
+ Base_T : Entity_Id;
+ Prim : Elmt_Id;
+ Prim_List : Elist_Id;
+ Ent : Entity_Id;
+
+ begin
+ -- Handle subtypes of synchronized types.
+
+ if Ekind (Typ) = E_Protected_Subtype
+ or else Ekind (Typ) = E_Task_Subtype
+ then
+ Base_T := Etype (Typ);
+ else
+ Base_T := Typ;
+ end if;
+
+ -- References to primitive operations are only relevant for tagged types
+
+ if not Is_Tagged_Type (Base_T)
+ or else Is_Class_Wide_Type (Base_T)
+ then
+ return;
+ end if;
+
+ -- Ada 2005 (AI-345): For synchronized types generate reference
+ -- to the wrapper that allow us to dispatch calls through their
+ -- implemented abstract interface types.
+
+ -- The check for Present here is to protect against previously
+ -- reported critical errors.
+
+ if Is_Concurrent_Type (Base_T)
+ and then Present (Corresponding_Record_Type (Base_T))
+ then
+ Prim_List := Primitive_Operations
+ (Corresponding_Record_Type (Base_T));
+ else
+ Prim_List := Primitive_Operations (Base_T);
+ end if;
+
+ if No (Prim_List) then
+ return;
+ end if;
+
+ Prim := First_Elmt (Prim_List);
+ while Present (Prim) loop
+
+ -- If the operation is derived, get the original for cross-reference
+ -- reference purposes (it is the original for which we want the xref
+ -- and for which the comes_from_source test must be performed).
+
+ Ent := Node (Prim);
+ while Present (Alias (Ent)) loop
+ Ent := Alias (Ent);
+ end loop;
+
+ Generate_Reference (Typ, Ent, 'p', Set_Ref => False);
+ Next_Elmt (Prim);
+ end loop;
+ end Generate_Prim_Op_References;
+
+ ---------------------------------
-- Process_Default_Expressions --
---------------------------------
diff --git a/gcc/ada/g-awk.adb b/gcc/ada/g-awk.adb
index 57045bf5661..0dee657b140 100644
--- a/gcc/ada/g-awk.adb
+++ b/gcc/ada/g-awk.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2000-2007, AdaCore --
+-- Copyright (C) 2000-2008, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -36,10 +36,6 @@ pragma Ada_95;
-- Default_Session (see below) do not work when compiling clients of this
-- package that instantiate generic units herein.
-pragma Style_Checks (All_Checks);
--- Turn off alpha ordering check for subprograms, since we cannot
--- Put Finalize and Initialize in alpha order (see comments).
-
with Ada.Exceptions;
with Ada.Text_IO;
with Ada.Strings.Unbounded;
@@ -56,6 +52,18 @@ package body GNAT.AWK is
use Ada;
use Ada.Strings.Unbounded;
+ -----------------------
+ -- Local subprograms --
+ -----------------------
+
+ -- The following two subprograms provide a functional interface to the
+ -- two special session variables, that are manipulated explicitly by
+ -- Finalize, but must be declared after Finalize to prevent static
+ -- elaboration warnings.
+
+ function Get_Def return Session_Data_Access;
+ procedure Set_Cur;
+
----------------
-- Split mode --
----------------
@@ -277,6 +285,24 @@ package body GNAT.AWK is
procedure Free is
new Unchecked_Deallocation (Session_Data, Session_Data_Access);
+ --------------
+ -- Finalize --
+ --------------
+
+ procedure Finalize (Session : in out Session_Type) is
+ begin
+ -- We release the session data only if it is not the default session
+
+ if Session.Data /= Get_Def then
+ Free (Session.Data);
+
+ -- Since we have closed the current session, set it to point now to
+ -- the default session.
+
+ Set_Cur;
+ end if;
+ end Finalize;
+
----------------
-- Initialize --
----------------
@@ -301,34 +327,9 @@ package body GNAT.AWK is
-- Session Variables --
-----------------------
- -- These must come after the body of Initialize, since they make
- -- implicit calls to Initialize at elaboration time.
-
Def_Session : Session_Type;
Cur_Session : Session_Type;
- --------------
- -- Finalize --
- --------------
-
- -- Note: Finalize must come after Initialize and the definition
- -- of the Def_Session and Cur_Session variables, since it references
- -- the latter.
-
- procedure Finalize (Session : in out Session_Type) is
- begin
- -- We release the session data only if it is not the default session
-
- if Session.Data /= Def_Session.Data then
- Free (Session.Data);
-
- -- Since we have closed the current session, set it to point now to
- -- the default session.
-
- Cur_Session.Data := Def_Session.Data;
- end if;
- end Finalize;
-
----------------------
-- Private Services --
----------------------
@@ -1480,6 +1481,24 @@ package body GNAT.AWK is
Split.Current_Line (Session.Data.Separators.all, Session);
end Split_Line;
+ -------------
+ -- Get_Def --
+ -------------
+
+ function Get_Def return Session_Data_Access is
+ begin
+ return Def_Session.Data;
+ end Get_Def;
+
+ -------------
+ -- Set_Cur --
+ -------------
+
+ procedure Set_Cur is
+ begin
+ Cur_Session.Data := Def_Session.Data;
+ end Set_Cur;
+
begin
-- We have declared two sessions but both should share the same data.
-- The current session must point to the default session as its initial
diff --git a/gcc/ada/g-comlin.adb b/gcc/ada/g-comlin.adb
index c9cb4dbad25..11ed78a3476 100644
--- a/gcc/ada/g-comlin.adb
+++ b/gcc/ada/g-comlin.adb
@@ -32,7 +32,9 @@
------------------------------------------------------------------------------
with Ada.Unchecked_Deallocation;
-with GNAT.OS_Lib; use GNAT.OS_Lib;
+with Ada.Strings.Unbounded;
+
+with GNAT.OS_Lib; use GNAT.OS_Lib;
package body GNAT.Command_Line is
@@ -101,8 +103,6 @@ package body GNAT.Command_Line is
procedure Unchecked_Free is new Ada.Unchecked_Deallocation
(Command_Line_Configuration_Record, Command_Line_Configuration);
- type Boolean_Chars is array (Character) of Boolean;
-
procedure Remove (Line : in out Argument_List_Access; Index : Integer);
-- Remove a specific element from Line
@@ -111,22 +111,38 @@ package body GNAT.Command_Line is
Str : String_Access);
-- Append a new element to Line
- function Args_From_Expanded (Args : Boolean_Chars) return String;
- -- Return the string made of all characters with True in Args
+ function Can_Have_Parameter (S : String) return Boolean;
+ -- Tell if S can have a parameter.
+
+ function Require_Parameter (S : String) return Boolean;
+ -- Tell if S requires a paramter.
+
+ function Actual_Switch (S : String) return String;
+ -- Remove any possible trailing '!', ':', '?' and '='
generic
- with procedure Callback (Simple_Switch : String);
+ with procedure Callback (Simple_Switch : String; Parameter : String);
procedure For_Each_Simple_Switch
- (Cmd : Command_Line;
- Switch : String);
+ (Cmd : Command_Line;
+ Switch : String;
+ Parameter : String := "";
+ Unalias : Boolean := True);
-- Breaks Switch into as simple switches as possible (expanding aliases and
-- ungrouping common prefixes when possible), and call Callback for each of
-- these.
+ procedure Sort_Sections
+ (Line : GNAT.OS_Lib.Argument_List_Access;
+ Sections : GNAT.OS_Lib.Argument_List_Access;
+ Params : GNAT.OS_Lib.Argument_List_Access);
+ -- Reorder the command line switches so that the switches belonging to a
+ -- section are grouped together.
+
procedure Group_Switches
- (Cmd : Command_Line;
- Result : Argument_List_Access;
- Params : Argument_List_Access);
+ (Cmd : Command_Line;
+ Result : Argument_List_Access;
+ Sections : Argument_List_Access;
+ Params : Argument_List_Access);
-- Group switches with common prefixes whenever possible.
-- Once they have been grouped, we also check items for possible aliasing
@@ -1050,25 +1066,6 @@ package body GNAT.Command_Line is
end if;
end Free;
- ------------------------
- -- Args_From_Expanded --
- ------------------------
-
- function Args_From_Expanded (Args : Boolean_Chars) return String is
- Result : String (1 .. Args'Length);
- Index : Natural := Result'First;
-
- begin
- for A in Args'Range loop
- if Args (A) then
- Result (Index) := A;
- Index := Index + 1;
- end if;
- end loop;
-
- return Result (1 .. Index - 1);
- end Args_From_Expanded;
-
------------------
-- Define_Alias --
------------------
@@ -1103,6 +1100,69 @@ package body GNAT.Command_Line is
Append (Config.Prefixes, new String'(Prefix));
end Define_Prefix;
+ -------------------
+ -- Define_Switch --
+ -------------------
+
+ procedure Define_Switch
+ (Config : in out Command_Line_Configuration;
+ Switch : String)
+ is
+ begin
+ if Config = null then
+ Config := new Command_Line_Configuration_Record;
+ end if;
+
+ Append (Config.Switches, new String'(Switch));
+ end Define_Switch;
+
+ --------------------
+ -- Define_Section --
+ --------------------
+
+ procedure Define_Section
+ (Config : in out Command_Line_Configuration;
+ Section : String)
+ is
+ begin
+ if Config = null then
+ Config := new Command_Line_Configuration_Record;
+ end if;
+
+ Append (Config.Sections, new String'(Section));
+ end Define_Section;
+
+ ------------------
+ -- Get_Switches --
+ ------------------
+
+ function Get_Switches
+ (Config : Command_Line_Configuration;
+ Switch_Char : Character)
+ return String
+ is
+ Ret : Ada.Strings.Unbounded.Unbounded_String;
+ use type Ada.Strings.Unbounded.Unbounded_String;
+
+ begin
+ if Config = null or else Config.Switches = null then
+ return "";
+ end if;
+
+ for J in Config.Switches'Range loop
+ if Config.Switches (J) (Config.Switches (J)'First) = Switch_Char then
+ Ret :=
+ Ret & " " &
+ Config.Switches (J)
+ (Config.Switches (J)'First + 1 .. Config.Switches (J)'Last);
+ else
+ Ret := Ret & " " & Config.Switches (J).all;
+ end if;
+ end loop;
+
+ return Ada.Strings.Unbounded.To_String (Ret);
+ end Get_Switches;
+
-----------------------
-- Set_Configuration --
-----------------------
@@ -1135,9 +1195,34 @@ package body GNAT.Command_Line is
Getopt_Description : String := "";
Switch_Char : Character := '-')
is
- Tmp : Argument_List_Access;
- Parser : Opt_Parser;
- S : Character;
+ Tmp : Argument_List_Access;
+ Parser : Opt_Parser;
+ S : Character;
+ Section : String_Access := null;
+
+ function Real_Full_Switch
+ (S : Character;
+ Parser : Opt_Parser) return String;
+ -- Ensure that the returned switch value contains the
+ -- Switch_Char prefix if needed.
+
+ ----------------------
+ -- Real_Full_Switch --
+ ----------------------
+
+ function Real_Full_Switch
+ (S : Character;
+ Parser : Opt_Parser) return String
+ is
+ begin
+ if S = '*' then
+ return Full_Switch (Parser);
+ else
+ return Switch_Char & Full_Switch (Parser);
+ end if;
+ end Real_Full_Switch;
+
+ -- Start of processing for Set_Command_Line
begin
Free (Cmd.Expanded);
@@ -1154,20 +1239,82 @@ package body GNAT.Command_Line is
Parser => Parser);
exit when S = ASCII.NUL;
- if S = '*' then
- Add_Switch (Cmd, Full_Switch (Parser), Parameter (Parser),
- Separator (Parser));
- else
- Add_Switch
- (Cmd, Switch_Char & Full_Switch (Parser),
- Parameter (Parser), Separator (Parser));
- end if;
+ declare
+ Sw : constant String :=
+ Real_Full_Switch (S, Parser);
+ Is_Section : Boolean := False;
+
+ begin
+ if Cmd.Config /= null
+ and then Cmd.Config.Sections /= null
+ then
+ Section_Search :
+ for S in Cmd.Config.Sections'Range loop
+ if Sw = Cmd.Config.Sections (S).all then
+ Section := Cmd.Config.Sections (S);
+ Is_Section := True;
+
+ exit Section_Search;
+ end if;
+ end loop Section_Search;
+ end if;
+
+ if not Is_Section then
+ if Section = null then
+
+ -- Workaround some weird cases: some switches may
+ -- expect parameters, but have the same value as
+ -- longer switches: -gnaty3 (-gnaty, parameter=3) and
+ -- -gnatya (-gnatya, no parameter).
+
+ -- So we are calling add_switch here with parameter
+ -- attached. This will be anyway correctly handled by
+ -- Add_Switch if -gnaty3 is actually furnished.
+
+ if Separator (Parser) = ASCII.NUL then
+ Add_Switch
+ (Cmd, Sw & Parameter (Parser), "");
+ else
+ Add_Switch
+ (Cmd, Sw, Parameter (Parser), Separator (Parser));
+ end if;
+ else
+ if Separator (Parser) = ASCII.NUL then
+ Add_Switch
+ (Cmd, Sw & Parameter (Parser), "",
+ Separator (Parser),
+ Section.all);
+ else
+ Add_Switch
+ (Cmd, Sw,
+ Parameter (Parser),
+ Separator (Parser),
+ Section.all);
+ end if;
+ end if;
+ end if;
+ end;
exception
when Invalid_Parameter =>
+
-- Add it with no parameter, if that's the way the user
- -- wants it
- Add_Switch (Cmd, Switch_Char & Full_Switch (Parser));
+ -- wants it.
+
+ -- Specify the separator in all cases, as the switch might
+ -- need to be unaliased, and the alias might contain
+ -- switches with parameters.
+
+ if Section = null then
+ Add_Switch
+ (Cmd, Switch_Char & Full_Switch (Parser),
+ Separator => Separator (Parser));
+ else
+ Add_Switch
+ (Cmd, Switch_Char & Full_Switch (Parser),
+ Separator => Separator (Parser),
+ Section => Section.all);
+ end if;
end;
end loop;
@@ -1188,14 +1335,175 @@ package body GNAT.Command_Line is
and then Type_Str (Index .. Index + Substring'Length - 1) = Substring;
end Looking_At;
+ ------------------------
+ -- Can_Have_Parameter --
+ ------------------------
+
+ function Can_Have_Parameter (S : String) return Boolean is
+ begin
+ if S'Length <= 1 then
+ return False;
+ end if;
+
+ case S (S'Last) is
+ when '!' | ':' | '?' | '=' =>
+ return True;
+ when others =>
+ return False;
+ end case;
+ end Can_Have_Parameter;
+
+ -----------------------
+ -- Require_Parameter --
+ -----------------------
+
+ function Require_Parameter (S : String) return Boolean is
+ begin
+ if S'Length <= 1 then
+ return False;
+ end if;
+
+ case S (S'Last) is
+ when '!' | ':' | '=' =>
+ return True;
+ when others =>
+ return False;
+ end case;
+ end Require_Parameter;
+
+ -------------------
+ -- Actual_Switch --
+ -------------------
+
+ function Actual_Switch (S : String) return String is
+ begin
+ if S'Length <= 1 then
+ return S;
+ end if;
+
+ case S (S'Last) is
+ when '!' | ':' | '?' | '=' =>
+ return S (S'First .. S'Last - 1);
+ when others =>
+ return S;
+ end case;
+ end Actual_Switch;
+
----------------------------
-- For_Each_Simple_Switch --
----------------------------
procedure For_Each_Simple_Switch
- (Cmd : Command_Line;
- Switch : String)
+ (Cmd : Command_Line;
+ Switch : String;
+ Parameter : String := "";
+ Unalias : Boolean := True)
is
+ function Group_Analysis
+ (Prefix : String;
+ Group : String) return Boolean;
+ -- Perform the analysis of a group of switches.
+
+ --------------------
+ -- Group_Analysis --
+ --------------------
+
+ function Group_Analysis
+ (Prefix : String;
+ Group : String) return Boolean
+ is
+ Idx : Natural;
+ Found : Boolean;
+
+ begin
+ Idx := Group'First;
+ while Idx <= Group'Last loop
+ Found := False;
+
+ for S in Cmd.Config.Switches'Range loop
+ declare
+ Sw : constant String :=
+ Actual_Switch
+ (Cmd.Config.Switches (S).all);
+ Full : constant String :=
+ Prefix & Group (Idx .. Group'Last);
+ Last : Natural;
+ Param : Natural;
+
+ begin
+ if Sw'Length >= Prefix'Length
+
+ -- Verify that sw starts with Prefix
+
+ and then Looking_At (Sw, Sw'First, Prefix)
+
+ -- Verify that the group starts with sw
+
+ and then Looking_At (Full, Full'First, Sw)
+ then
+ Last := Idx + Sw'Length - Prefix'Length - 1;
+ Param := Last + 1;
+
+ if Can_Have_Parameter (Cmd.Config.Switches (S).all) then
+
+ -- Include potential parameter to the recursive call.
+ -- Only numbers are allowed.
+
+ while Last < Group'Last
+ and then Group (Last + 1) in '0' .. '9'
+ loop
+ Last := Last + 1;
+ end loop;
+ end if;
+
+ if not Require_Parameter (Cmd.Config.Switches (S).all)
+ or else Last >= Param
+ then
+ if Idx = Group'First
+ and then Last = Group'Last
+ and then Last < Param
+ then
+ -- The group only concerns a single switch. Do not
+ -- perform recursive call.
+
+ -- Note that we still perform a recursive call if
+ -- a parameter is detected in the switch, as this
+ -- is a way to correctly identify such a parameter
+ -- in aliases.
+
+ return False;
+ end if;
+
+ Found := True;
+
+ -- Recursive call, using the detected parameter if any
+
+ if Last >= Param then
+ For_Each_Simple_Switch
+ (Cmd,
+ Prefix & Group (Idx .. Param - 1),
+ Group (Param .. Last));
+ else
+ For_Each_Simple_Switch
+ (Cmd, Prefix & Group (Idx .. Last), "");
+ end if;
+
+ Idx := Last + 1;
+ exit;
+ end if;
+ end if;
+ end;
+ end loop;
+
+ if not Found then
+ For_Each_Simple_Switch (Cmd, Prefix & Group (Idx), "");
+ Idx := Idx + 1;
+ end if;
+ end loop;
+
+ return True;
+ end Group_Analysis;
+
begin
-- Are we adding a switch that can in fact be expanded through aliases ?
-- If yes, we add separately each of its expansion.
@@ -1205,13 +1513,16 @@ package body GNAT.Command_Line is
-- in which we do things here, the expansion of the alias will itself
-- be checked for a common prefix and further split into simple switches
- if Cmd.Config /= null
+ if Unalias
+ and then Cmd.Config /= null
and then Cmd.Config.Aliases /= null
then
for A in Cmd.Config.Aliases'Range loop
- if Cmd.Config.Aliases (A).all = Switch then
+ if Cmd.Config.Aliases (A).all = Switch
+ and then Parameter = ""
+ then
For_Each_Simple_Switch
- (Cmd, Cmd.Config.Expansions (A).all);
+ (Cmd, Cmd.Config.Expansions (A).all, "");
return;
end if;
end loop;
@@ -1229,19 +1540,31 @@ package body GNAT.Command_Line is
(Switch, Switch'First, Cmd.Config.Prefixes (P).all)
then
-- Alias expansion will be done recursively
+ if Cmd.Config.Switches = null then
+ for S in Switch'First + Cmd.Config.Prefixes (P)'Length
+ .. Switch'Last
+ loop
+ For_Each_Simple_Switch
+ (Cmd, Cmd.Config.Prefixes (P).all & Switch (S), "");
+ end loop;
- for S in Switch'First + Cmd.Config.Prefixes (P)'Length
- .. Switch'Last
- loop
- For_Each_Simple_Switch
- (Cmd, Cmd.Config.Prefixes (P).all & Switch (S));
- end loop;
- return;
+ return;
+
+ elsif Group_Analysis
+ (Cmd.Config.Prefixes (P).all,
+ Switch
+ (Switch'First + Cmd.Config.Prefixes (P)'Length
+ .. Switch'Last))
+ then
+ -- Recursive calls already done on each switch of the
+ -- group. Let's return to not call Callback.
+ return;
+ end if;
end if;
end loop;
end if;
- Callback (Switch);
+ Callback (Switch, Parameter);
end For_Each_Simple_Switch;
----------------
@@ -1252,9 +1575,28 @@ package body GNAT.Command_Line is
(Cmd : in out Command_Line;
Switch : String;
Parameter : String := "";
- Separator : Character := ' ')
+ Separator : Character := ' ';
+ Section : String := "")
+ is
+ Success : Boolean;
+ pragma Unreferenced (Success);
+ begin
+ Add_Switch (Cmd, Switch, Parameter, Separator, Section, Success);
+ end Add_Switch;
+
+ ----------------
+ -- Add_Switch --
+ ----------------
+
+ procedure Add_Switch
+ (Cmd : in out Command_Line;
+ Switch : String;
+ Parameter : String := "";
+ Separator : Character := ' ';
+ Section : String := "";
+ Success : out Boolean)
is
- procedure Add_Simple_Switch (Simple : String);
+ procedure Add_Simple_Switch (Simple : String; Param : String);
-- Add a new switch that has had all its aliases expanded, and switches
-- ungrouped. We know there is no more aliases in Switches
@@ -1262,15 +1604,25 @@ package body GNAT.Command_Line is
-- Add_Simple_Switch --
-----------------------
- procedure Add_Simple_Switch (Simple : String) is
+ procedure Add_Simple_Switch (Simple : String; Param : String) is
begin
if Cmd.Expanded = null then
Cmd.Expanded := new Argument_List'(1 .. 1 => new String'(Simple));
- if Parameter = "" then
+
+ if Param /= "" then
+ Cmd.Params := new Argument_List'
+ (1 .. 1 => new String'(Separator & Param));
+
+ else
Cmd.Params := new Argument_List'(1 .. 1 => null);
+ end if;
+
+ if Section = "" then
+ Cmd.Sections := new Argument_List'(1 .. 1 => null);
+
else
- Cmd.Params := new Argument_List'
- (1 .. 1 => new String'(Separator & Parameter));
+ Cmd.Sections := new Argument_List'
+ (1 .. 1 => new String'(Section));
end if;
else
@@ -1279,21 +1631,35 @@ package body GNAT.Command_Line is
for C in Cmd.Expanded'Range loop
if Cmd.Expanded (C).all = Simple
and then
- ((Cmd.Params (C) = null and then Parameter = "")
+ ((Cmd.Params (C) = null and then Param = "")
or else
(Cmd.Params (C) /= null
- and then Cmd.Params (C).all = Separator & Parameter))
+ and then Cmd.Params (C).all = Separator & Param))
+ and then
+ ((Cmd.Sections (C) = null and then Section = "")
+ or else
+ (Cmd.Sections (C) /= null
+ and then Cmd.Sections (C).all = Section))
then
return;
end if;
end loop;
+ -- Inserting at least one switch
+ Success := True;
Append (Cmd.Expanded, new String'(Simple));
- if Parameter = "" then
+ if Param /= "" then
+ Append (Cmd.Params, new String'(Separator & Param));
+
+ else
Append (Cmd.Params, null);
+ end if;
+
+ if Section = "" then
+ Append (Cmd.Sections, null);
else
- Append (Cmd.Params, new String'(Separator & Parameter));
+ Append (Cmd.Sections, new String'(Section));
end if;
end if;
end Add_Simple_Switch;
@@ -1304,7 +1670,8 @@ package body GNAT.Command_Line is
-- Start of processing for Add_Switch
begin
- Add_Simple_Switches (Cmd, Switch);
+ Success := False;
+ Add_Simple_Switches (Cmd, Switch, Parameter);
Free (Cmd.Coalesce);
end Add_Switch;
@@ -1357,27 +1724,58 @@ package body GNAT.Command_Line is
-------------------
procedure Remove_Switch
- (Cmd : in out Command_Line;
- Switch : String;
- Remove_All : Boolean := False)
+ (Cmd : in out Command_Line;
+ Switch : String;
+ Remove_All : Boolean := False;
+ Has_Parameter : Boolean := False;
+ Section : String := "")
+ is
+ Success : Boolean;
+ pragma Unreferenced (Success);
+ begin
+ Remove_Switch (Cmd, Switch, Remove_All, Has_Parameter, Section, Success);
+ end Remove_Switch;
+
+ -------------------
+ -- Remove_Switch --
+ -------------------
+
+ procedure Remove_Switch
+ (Cmd : in out Command_Line;
+ Switch : String;
+ Remove_All : Boolean := False;
+ Has_Parameter : Boolean := False;
+ Section : String := "";
+ Success : out Boolean)
is
- procedure Remove_Simple_Switch (Simple : String);
+ procedure Remove_Simple_Switch (Simple : String; Param : String);
-- Removes a simple switch, with no aliasing or grouping
--------------------------
-- Remove_Simple_Switch --
--------------------------
- procedure Remove_Simple_Switch (Simple : String) is
+ procedure Remove_Simple_Switch (Simple : String; Param : String) is
C : Integer;
+ pragma Unreferenced (Param);
begin
if Cmd.Expanded /= null then
C := Cmd.Expanded'First;
while C <= Cmd.Expanded'Last loop
- if Cmd.Expanded (C).all = Simple then
+ if Cmd.Expanded (C).all = Simple
+ and then
+ (Remove_All
+ or else (Cmd.Sections (C) = null
+ and then Section = "")
+ or else (Cmd.Sections (C) /= null
+ and then Section = Cmd.Sections (C).all))
+ and then (not Has_Parameter or else Cmd.Params (C) /= null)
+ then
Remove (Cmd.Expanded, C);
Remove (Cmd.Params, C);
+ Remove (Cmd.Sections, C);
+ Success := True;
if not Remove_All then
return;
@@ -1396,7 +1794,8 @@ package body GNAT.Command_Line is
-- Start of processing for Remove_Switch
begin
- Remove_Simple_Switches (Cmd, Switch);
+ Success := False;
+ Remove_Simple_Switches (Cmd, Switch, "", Unalias => not Has_Parameter);
Free (Cmd.Coalesce);
end Remove_Switch;
@@ -1407,16 +1806,17 @@ package body GNAT.Command_Line is
procedure Remove_Switch
(Cmd : in out Command_Line;
Switch : String;
- Parameter : String)
+ Parameter : String;
+ Section : String := "")
is
- procedure Remove_Simple_Switch (Simple : String);
+ procedure Remove_Simple_Switch (Simple : String; Param : String);
-- Removes a simple switch, with no aliasing or grouping
--------------------------
-- Remove_Simple_Switch --
--------------------------
- procedure Remove_Simple_Switch (Simple : String) is
+ procedure Remove_Simple_Switch (Simple : String; Param : String) is
C : Integer;
begin
@@ -1425,7 +1825,13 @@ package body GNAT.Command_Line is
while C <= Cmd.Expanded'Last loop
if Cmd.Expanded (C).all = Simple
and then
- ((Cmd.Params (C) = null and then Parameter = "")
+ ((Cmd.Sections (C) = null
+ and then Section = "")
+ or else
+ (Cmd.Sections (C) /= null
+ and then Section = Cmd.Sections (C).all))
+ and then
+ ((Cmd.Params (C) = null and then Param = "")
or else
(Cmd.Params (C) /= null
and then
@@ -1434,10 +1840,11 @@ package body GNAT.Command_Line is
Cmd.Params (C) (Cmd.Params (C)'First + 1
.. Cmd.Params (C)'Last) =
- Parameter))
+ Param))
then
Remove (Cmd.Expanded, C);
Remove (Cmd.Params, C);
+ Remove (Cmd.Sections, C);
-- The switch is necessarily unique by construction of
-- Add_Switch
@@ -1457,7 +1864,7 @@ package body GNAT.Command_Line is
-- Start of processing for Remove_Switch
begin
- Remove_Simple_Switches (Cmd, Switch);
+ Remove_Simple_Switches (Cmd, Switch, Parameter);
Free (Cmd.Coalesce);
end Remove_Switch;
@@ -1466,16 +1873,50 @@ package body GNAT.Command_Line is
--------------------
procedure Group_Switches
- (Cmd : Command_Line;
- Result : Argument_List_Access;
- Params : Argument_List_Access)
+ (Cmd : Command_Line;
+ Result : Argument_List_Access;
+ Sections : Argument_List_Access;
+ Params : Argument_List_Access)
is
- type Boolean_Array is array (Result'Range) of Boolean;
+ function Compatible_Parameter (Param : String_Access) return Boolean;
+ -- Tell if the parameter can be part of a group
+
+ --------------------------
+ -- Compatible_Parameter --
+ --------------------------
+
+ function Compatible_Parameter (Param : String_Access) return Boolean is
+ begin
+ -- No parameter OK
+
+ if Param = null then
+ return True;
+
+ -- We need parameters without separators
- Matched : Boolean_Array;
- Count : Natural;
- First : Natural;
- From_Args : Boolean_Chars;
+ elsif Param (Param'First) /= ASCII.NUL then
+ return False;
+
+ -- Parameters must be all digits
+
+ else
+ for J in Param'First + 1 .. Param'Last loop
+ if Param (J) not in '0' .. '9' then
+ return False;
+ end if;
+ end loop;
+
+ return True;
+ end if;
+ end Compatible_Parameter;
+
+ -- Local declarations
+
+ Group : Ada.Strings.Unbounded.Unbounded_String;
+ First : Natural;
+ use type Ada.Strings.Unbounded.Unbounded_String;
+
+ -- Start of processing for Group_Switches
begin
if Cmd.Config = null
@@ -1485,41 +1926,68 @@ package body GNAT.Command_Line is
end if;
for P in Cmd.Config.Prefixes'Range loop
- Matched := (others => False);
- Count := 0;
+ Group := Ada.Strings.Unbounded.Null_Unbounded_String;
+ First := 0;
for C in Result'Range loop
if Result (C) /= null
- and then Params (C) = null -- ignored if has a parameter
+ and then Compatible_Parameter (Params (C))
and then Looking_At
(Result (C).all, Result (C)'First, Cmd.Config.Prefixes (P).all)
then
- Matched (C) := True;
- Count := Count + 1;
- end if;
- end loop;
-
- if Count > 1 then
- From_Args := (others => False);
- First := 0;
+ -- If we are still in the same section, group the switches
+
+ if First = 0
+ or else
+ (Sections (C) = null
+ and then Sections (First) = null)
+ or else
+ (Sections (C) /= null
+ and then Sections (First) /= null
+ and then Sections (C).all = Sections (First).all)
+ then
+ Group :=
+ Group &
+ Result (C)
+ (Result (C)'First + Cmd.Config.Prefixes (P)'Length ..
+ Result (C)'Last);
+
+ if Params (C) /= null then
+ Group :=
+ Group &
+ Params (C) (Params (C)'First + 1 .. Params (C)'Last);
+ Free (Params (C));
+ end if;
- for M in Matched'Range loop
- if Matched (M) then
if First = 0 then
- First := M;
+ First := C;
end if;
- for A in Result (M)'First + Cmd.Config.Prefixes (P)'Length
- .. Result (M)'Last
- loop
- From_Args (Result (M)(A)) := True;
- end loop;
- Free (Result (M));
+ Free (Result (C));
+
+ else
+ -- We changed section: we put the grouped switches to the
+ -- first place, on continue with the new section.
+
+ Result (First) :=
+ new String'
+ (Cmd.Config.Prefixes (P).all &
+ Ada.Strings.Unbounded.To_String (Group));
+ Group :=
+ Ada.Strings.Unbounded.To_Unbounded_String
+ (Result (C)
+ (Result (C)'First + Cmd.Config.Prefixes (P)'Length ..
+ Result (C)'Last));
+ First := C;
end if;
- end loop;
+ end if;
+ end loop;
- Result (First) := new String'
- (Cmd.Config.Prefixes (P).all & Args_From_Expanded (From_Args));
+ if First > 0 then
+ Result (First) :=
+ new String'
+ (Cmd.Config.Prefixes (P).all &
+ Ada.Strings.Unbounded.To_String (Group));
end if;
end loop;
end Group_Switches;
@@ -1536,22 +2004,25 @@ package body GNAT.Command_Line is
Found : Boolean;
First : Natural;
- procedure Check_Cb (Switch : String);
+ procedure Check_Cb (Switch : String; Param : String);
-- Comment required ???
- procedure Remove_Cb (Switch : String);
+ procedure Remove_Cb (Switch : String; Param : String);
-- Comment required ???
--------------
-- Check_Cb --
--------------
- procedure Check_Cb (Switch : String) is
+ procedure Check_Cb (Switch : String; Param : String) is
begin
if Found then
for E in Result'Range loop
if Result (E) /= null
- and then Params (E) = null -- Ignore if has a param
+ and then
+ (Params (E) = null
+ or else Params (E) (Params (E)'First + 1
+ .. Params (E)'Last) = Param)
and then Result (E).all = Switch
then
return;
@@ -1566,14 +2037,21 @@ package body GNAT.Command_Line is
-- Remove_Cb --
---------------
- procedure Remove_Cb (Switch : String) is
+ procedure Remove_Cb (Switch : String; Param : String) is
begin
for E in Result'Range loop
- if Result (E) /= null and then Result (E).all = Switch then
+ if Result (E) /= null
+ and then
+ (Params (E) = null
+ or else Params (E) (Params (E)'First + 1
+ .. Params (E)'Last) = Param)
+ and then Result (E).all = Switch
+ then
if First > E then
First := E;
end if;
Free (Result (E));
+ Free (Params (E));
return;
end if;
end loop;
@@ -1608,6 +2086,70 @@ package body GNAT.Command_Line is
end loop;
end Alias_Switches;
+ -------------------
+ -- Sort_Sections --
+ -------------------
+
+ procedure Sort_Sections
+ (Line : GNAT.OS_Lib.Argument_List_Access;
+ Sections : GNAT.OS_Lib.Argument_List_Access;
+ Params : GNAT.OS_Lib.Argument_List_Access)
+ is
+ Sections_List : Argument_List_Access :=
+ new Argument_List'(1 .. 1 => null);
+ Found : Boolean;
+ Old_Line : constant Argument_List := Line.all;
+ Old_Sections : constant Argument_List := Sections.all;
+ Old_Params : constant Argument_List := Params.all;
+ Index : Natural;
+
+ begin
+ if Line = null then
+ return;
+ end if;
+
+ -- First construct a list of all sections
+
+ for E in Line'Range loop
+ if Sections (E) /= null then
+ Found := False;
+ for S in Sections_List'Range loop
+ if (Sections_List (S) = null and then Sections (E) = null)
+ or else
+ (Sections_List (S) /= null
+ and then Sections (E) /= null
+ and then Sections_List (S).all = Sections (E).all)
+ then
+ Found := True;
+ exit;
+ end if;
+ end loop;
+
+ if not Found then
+ Append (Sections_List, Sections (E));
+ end if;
+ end if;
+ end loop;
+
+ Index := Line'First;
+
+ for S in Sections_List'Range loop
+ for E in Old_Line'Range loop
+ if (Sections_List (S) = null and then Old_Sections (E) = null)
+ or else
+ (Sections_List (S) /= null
+ and then Old_Sections (E) /= null
+ and then Sections_List (S).all = Old_Sections (E).all)
+ then
+ Line (Index) := Old_Line (E);
+ Sections (Index) := Old_Sections (E);
+ Params (Index) := Old_Params (E);
+ Index := Index + 1;
+ end if;
+ end loop;
+ end loop;
+ end Sort_Sections;
+
-----------
-- Start --
-----------
@@ -1623,6 +2165,10 @@ package body GNAT.Command_Line is
return;
end if;
+ -- Reorder the expanded line so that sections are grouped
+
+ Sort_Sections (Cmd.Expanded, Cmd.Sections, Cmd.Params);
+
-- Coalesce the switches as much as possible
if not Expanded
@@ -1633,25 +2179,46 @@ package body GNAT.Command_Line is
Cmd.Coalesce (E) := new String'(Cmd.Expanded (E).all);
end loop;
+ Cmd.Coalesce_Sections := new Argument_List (Cmd.Sections'Range);
+ for E in Cmd.Sections'Range loop
+ if Cmd.Sections (E) = null then
+ Cmd.Coalesce_Sections (E) := null;
+ else
+ Cmd.Coalesce_Sections (E) := new String'(Cmd.Sections (E).all);
+ end if;
+ end loop;
+
+ Cmd.Coalesce_Params := new Argument_List (Cmd.Params'Range);
+ for E in Cmd.Params'Range loop
+ if Cmd.Params (E) = null then
+ Cmd.Coalesce_Params (E) := null;
+ else
+ Cmd.Coalesce_Params (E) := new String'(Cmd.Params (E).all);
+ end if;
+ end loop;
+
-- Not a clone, since we will not modify the parameters anyway
- Cmd.Coalesce_Params := Cmd.Params;
- Alias_Switches (Cmd, Cmd.Coalesce, Cmd.Params);
- Group_Switches (Cmd, Cmd.Coalesce, Cmd.Params);
+ Alias_Switches (Cmd, Cmd.Coalesce, Cmd.Coalesce_Params);
+ Group_Switches
+ (Cmd, Cmd.Coalesce, Cmd.Coalesce_Sections, Cmd.Coalesce_Params);
end if;
if Expanded then
- Iter.List := Cmd.Expanded;
- Iter.Params := Cmd.Params;
+ Iter.List := Cmd.Expanded;
+ Iter.Params := Cmd.Params;
+ Iter.Sections := Cmd.Sections;
else
- Iter.List := Cmd.Coalesce;
- Iter.Params := Cmd.Coalesce_Params;
+ Iter.List := Cmd.Coalesce;
+ Iter.Params := Cmd.Coalesce_Params;
+ Iter.Sections := Cmd.Coalesce_Sections;
end if;
if Iter.List = null then
Iter.Current := Integer'Last;
else
Iter.Current := Iter.List'First;
+
while Iter.Current <= Iter.List'Last
and then Iter.List (Iter.Current) = null
loop
@@ -1669,6 +2236,40 @@ package body GNAT.Command_Line is
return Iter.List (Iter.Current).all;
end Current_Switch;
+ --------------------
+ -- Is_New_Section --
+ --------------------
+
+ function Is_New_Section (Iter : Command_Line_Iterator) return Boolean is
+ Section : constant String := Current_Section (Iter);
+ begin
+ if Iter.Sections = null then
+ return False;
+ elsif Iter.Current = Iter.Sections'First
+ or else Iter.Sections (Iter.Current - 1) = null
+ then
+ return Section /= "";
+ end if;
+
+ return Section /= Iter.Sections (Iter.Current - 1).all;
+ end Is_New_Section;
+
+ ---------------------
+ -- Current_Section --
+ ---------------------
+
+ function Current_Section (Iter : Command_Line_Iterator) return String is
+ begin
+ if Iter.Sections = null
+ or else Iter.Current > Iter.Sections'Last
+ or else Iter.Sections (Iter.Current) = null
+ then
+ return "";
+ end if;
+
+ return Iter.Sections (Iter.Current).all;
+ end Current_Section;
+
-----------------------
-- Current_Separator --
-----------------------
diff --git a/gcc/ada/g-comlin.ads b/gcc/ada/g-comlin.ads
index 6c63b2d6222..41cdfb8e36d 100644
--- a/gcc/ada/g-comlin.ads
+++ b/gcc/ada/g-comlin.ads
@@ -513,6 +513,27 @@ package GNAT.Command_Line is
-- characters whose order is irrelevant. In fact, this package will sort
-- them alphabetically.
+ procedure Define_Switch
+ (Config : in out Command_Line_Configuration;
+ Switch : String);
+ -- Indicates a new switch. The format of this switch follows the getopt
+ -- format (trailing ':', '?', etc for defining a switch with parameters).
+ -- The switches defined in the command_line_configuration object are used
+ -- when ungrouping switches with more that one character after the prefix.
+
+ procedure Define_Section
+ (Config : in out Command_Line_Configuration;
+ Section : String);
+ -- Indicates a new switch section. Every switch belonging to the same
+ -- section are ordered together, preceded by the section. They are placed
+ -- at the end of the command line (as in 'gnatmake somefile.adb -cargs -g')
+
+ function Get_Switches
+ (Config : Command_Line_Configuration;
+ Switch_Char : Character) return String;
+ -- Get the switches list as expected by getopt. This list is built using
+ -- all switches defined previously via Define_Switch above.
+
procedure Free (Config : in out Command_Line_Configuration);
-- Free the memory used by Config
@@ -549,13 +570,17 @@ package GNAT.Command_Line is
-- Command_Line_Iterator (which might be fine depending on your
-- application).
--
+ -- If the command line has sections (such as -bargs -largs -cargs), then
+ -- they should be listed in the Sections parameter (as "-bargs -cargs")
+ --
-- This function can be used to reset Cmd by passing an empty string.
procedure Add_Switch
(Cmd : in out Command_Line;
Switch : String;
Parameter : String := "";
- Separator : Character := ' ');
+ Separator : Character := ' ';
+ Section : String := "");
-- Add a new switch to the command line, and combine/group it with existing
-- switches if possible. Nothing is done if the switch already exists with
-- the same parameter.
@@ -578,11 +603,28 @@ package GNAT.Command_Line is
-- Separator is the character that goes between the switches and its
-- parameter on the command line. If it is set to ASCII.NUL, then no
-- separator is applied, and they are concatenated
+ --
+ -- If the switch is part of a section, then it should be specified so that
+ -- the switch is correctly placed in the command line, and the section
+ -- added if not already present. For example, to add the -g switch into the
+ -- -cargs section, you need to call (Cmd, "-g", Section => "-cargs")
+
+ procedure Add_Switch
+ (Cmd : in out Command_Line;
+ Switch : String;
+ Parameter : String := "";
+ Separator : Character := ' ';
+ Section : String := "";
+ Success : out Boolean);
+ -- Same as above, returning the status of
+ -- the operation
procedure Remove_Switch
- (Cmd : in out Command_Line;
- Switch : String;
- Remove_All : Boolean := False);
+ (Cmd : in out Command_Line;
+ Switch : String;
+ Remove_All : Boolean := False;
+ Has_Parameter : Boolean := False;
+ Section : String := "");
-- Remove Switch from the command line, and ungroup existing switches if
-- necessary.
--
@@ -592,16 +634,36 @@ package GNAT.Command_Line is
--
-- If Remove_All is True, then all matching switches are removed, otherwise
-- only the first matching one is removed.
+ --
+ -- If Has_Parameter is set to True, then only switches having a parameter
+ -- are removed.
+ --
+ -- If the switch belongs to a section, then this section should be
+ -- specified: Remove_Switch (Cmd_Line, "-g", Section => "-cargs") called
+ -- on the command line "-g -cargs -g" will result in "-g", while if
+ -- called with (Cmd_Line, "-g") this will result in "-cargs -g".
+ -- If Remove_All is set, then both "-g" will be removed.
+
+ procedure Remove_Switch
+ (Cmd : in out Command_Line;
+ Switch : String;
+ Remove_All : Boolean := False;
+ Has_Parameter : Boolean := False;
+ Section : String := "";
+ Success : out Boolean);
+ -- Same as above, reporting the success of the operation (Success is False
+ -- if no switch was removed).
procedure Remove_Switch
(Cmd : in out Command_Line;
Switch : String;
- Parameter : String);
+ Parameter : String;
+ Section : String := "");
-- Remove a switch with a specific parameter. If Parameter is the empty
-- string, then only a switch with no parameter will be removed.
---------------
- -- Iterating --
+ -- Iteration --
---------------
type Command_Line_Iterator is private;
@@ -618,6 +680,8 @@ package GNAT.Command_Line is
-- call to Add_Switch, Remove_Switch or Set_Command_Line.
function Current_Switch (Iter : Command_Line_Iterator) return String;
+ function Is_New_Section (Iter : Command_Line_Iterator) return Boolean;
+ function Current_Section (Iter : Command_Line_Iterator) return String;
function Current_Separator (Iter : Command_Line_Iterator) return String;
function Current_Parameter (Iter : Command_Line_Iterator) return String;
-- Return the current switch and its parameter (or the empty string if
@@ -742,9 +806,15 @@ private
Prefixes : GNAT.OS_Lib.Argument_List_Access;
-- The list of prefixes
+ Sections : GNAT.OS_Lib.Argument_List_Access;
+ -- The list of sections
+
Aliases : GNAT.OS_Lib.Argument_List_Access;
Expansions : GNAT.OS_Lib.Argument_List_Access;
- -- The aliases. Both arrays have the same indices
+ -- The aliases (Both arrays have the same bounds)
+
+ Switches : GNAT.OS_Lib.Argument_List_Access;
+ -- List of expected switches (Used when expanding switch groups)
end record;
type Command_Line_Configuration is access Command_Line_Configuration_Record;
@@ -754,19 +824,24 @@ private
Params : GNAT.OS_Lib.Argument_List_Access;
-- Parameter for the corresponding switch in Expanded. The first
- -- character is the separator (or ASCII.NUL if there is no separator)
-
- Coalesce : GNAT.OS_Lib.Argument_List_Access;
- Coalesce_Params : GNAT.OS_Lib.Argument_List_Access;
- -- Cached version of the command line. This is recomputed every time the
- -- command line changes. Switches are grouped as much as possible, and
- -- aliases are used to reduce the length of the command line.
- -- The parameters are not allocated, they point into Params, so must not
- -- be freed.
+ -- character is the separator (or ASCII.NUL if there is no separator).
+
+ Sections : GNAT.OS_Lib.Argument_List_Access;
+ -- The list of sections
+
+ Coalesce : GNAT.OS_Lib.Argument_List_Access;
+ Coalesce_Params : GNAT.OS_Lib.Argument_List_Access;
+ Coalesce_Sections : GNAT.OS_Lib.Argument_List_Access;
+ -- Cached version of the command line. This is recomputed every time
+ -- the command line changes. Switches are grouped as much as possible,
+ -- and aliases are used to reduce the length of the command line. The
+ -- parameters are not allocated, they point into Params, so they must
+ -- not be freed.
end record;
type Command_Line_Iterator is record
List : GNAT.OS_Lib.Argument_List_Access;
+ Sections : GNAT.OS_Lib.Argument_List_Access;
Params : GNAT.OS_Lib.Argument_List_Access;
Current : Natural;
end record;
diff --git a/gcc/ada/g-pehage.adb b/gcc/ada/g-pehage.adb
index 8d4733334d6..129cecc7659 100644
--- a/gcc/ada/g-pehage.adb
+++ b/gcc/ada/g-pehage.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2002-2007, AdaCore --
+-- Copyright (C) 2002-2008, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -49,10 +49,10 @@ package body GNAT.Perfect_Hash_Generators is
-- h (w) = (g (f1 (w)) + g (f2 (w))) mod m
- -- where f1 and f2 are functions that map strings into integers, and g is a
- -- function that maps integers into [0, m-1]. h can be order preserving.
- -- For instance, let W = {w_0, ..., w_i, ...,
- -- w_m-1}, h can be defined such that h (w_i) = i.
+ -- where f1 and f2 are functions that map strings into integers, and g is
+ -- a function that maps integers into [0, m-1]. h can be order preserving.
+ -- For instance, let W = {w_0, ..., w_i, ..., w_m-1}, h can be defined
+ -- such that h (w_i) = i.
-- This algorithm defines two possible constructions of f1 and f2. Method
-- b) stores the hash function in less memory space at the expense of
@@ -82,10 +82,10 @@ package body GNAT.Perfect_Hash_Generators is
-- probability of generating an acyclic graph, n >= 2m. If it is not
-- acyclic, Tk have to be regenerated.
- -- In the assignment step, the algorithm builds function g. As is acyclic,
- -- there is a vertex v1 with only one neighbor v2. Let w_i be the word such
- -- that v1 = f1 (w_i) and v2 = f2 (w_i). Let g (v1) = 0 by construction and
- -- g (v2) = (i - g (v1)) mod n (or to be general, (h (i) - g (v1) mod n).
+ -- In the assignment step, the algorithm builds function g. As G is
+ -- acyclic, there is a vertex v1 with only one neighbor v2. Let w_i be
+ -- the word such that v1 = f1 (w_i) and v2 = f2 (w_i). Let g (v1) = 0 by
+ -- construction and g (v2) = (i - g (v1)) mod n (or h (i) - g (v1) mod n).
-- If word w_j is such that v2 = f1 (w_j) and v3 = f2 (w_j), g (v3) = (j -
-- g (v2)) mod (or to be general, (h (j) - g (v2)) mod n). If w_i has no
-- neighbor, then another vertex is selected. The algorithm traverses G to
@@ -102,11 +102,12 @@ package body GNAT.Perfect_Hash_Generators is
No_Edge : constant Edge_Id := -1;
No_Table : constant Table_Id := -1;
- Max_Word_Length : constant := 32;
- subtype Word_Type is String (1 .. Max_Word_Length);
- Null_Word : constant Word_Type := (others => ASCII.NUL);
- -- Store keyword in a word. Note that the length of word is limited to 32
- -- characters.
+ type Word_Type is new String_Access;
+ procedure Free_Word (W : in out Word_Type);
+ function New_Word (S : String) return Word_Type;
+
+ procedure Resize_Word (W : in out Word_Type; Len : Natural);
+ -- Resize string W to have a length Len
type Key_Type is record
Edge : Edge_Id;
@@ -130,8 +131,12 @@ package body GNAT.Perfect_Hash_Generators is
package WT is new GNAT.Table (Word_Type, Word_Id, 0, 32, 32);
package IT is new GNAT.Table (Integer, Integer, 0, 32, 32);
- -- The two main tables. IT is used to store several tables of components
- -- containing only integers.
+ -- The two main tables. WT is used to store the words in their initial
+ -- version and in their reduced version (that is words reduced to their
+ -- significant characters). As an instance of GNAT.Table, WT does not
+ -- initialize string pointers to null. This initialization has to be done
+ -- manually when the table is allocated. IT is used to store several
+ -- tables of components containing only integers.
function Image (Int : Integer; W : Natural := 0) return String;
function Image (Str : String; W : Natural := 0) return String;
@@ -298,9 +303,6 @@ package body GNAT.Perfect_Hash_Generators is
function Allocate (N : Natural; S : Natural := 1) return Table_Id;
-- Allocate N * S ints from IT table
- procedure Free_Tmp_Tables;
- -- Deallocate the tables used by the algorithm (but not the keys table)
-
----------
-- Keys --
----------
@@ -408,7 +410,7 @@ package body GNAT.Perfect_Hash_Generators is
-- Optimization mode (memory vs CPU)
Max_Key_Len : Natural := 0;
- Min_Key_Len : Natural := Max_Word_Length;
+ Min_Key_Len : Natural := 0;
-- Maximum and minimum of all the word length
S : Natural;
@@ -530,26 +532,27 @@ package body GNAT.Perfect_Hash_Generators is
procedure Apply_Position_Selection is
begin
- WT.Set_Last (2 * NK);
for J in 0 .. NK - 1 loop
declare
- I_Word : constant Word_Type := WT.Table (Initial (J));
- R_Word : Word_Type := Null_Word;
- Index : Natural := I_Word'First - 1;
+ IW : constant String := WT.Table (Initial (J)).all;
+ RW : String (1 .. IW'Length) := (others => ASCII.NUL);
+ N : Natural := IW'First - 1;
begin
-- Select the characters of Word included in the position
-- selection.
for C in 0 .. Char_Pos_Set_Len - 1 loop
- exit when I_Word (Get_Char_Pos (C)) = ASCII.NUL;
- Index := Index + 1;
- R_Word (Index) := I_Word (Get_Char_Pos (C));
+ exit when IW (Get_Char_Pos (C)) = ASCII.NUL;
+ N := N + 1;
+ RW (N) := IW (Get_Char_Pos (C));
end loop;
- -- Build the new table with the reduced word
+ -- Build the new table with the reduced word. Be careful
+ -- to deallocate the old version to avoid memory leaks.
- WT.Table (Reduced (J)) := R_Word;
+ Free_Word (WT.Table (Reduced (J)));
+ WT.Table (Reduced (J)) := New_Word (RW);
Set_Key (J, (Edge => No_Edge));
end;
end loop;
@@ -628,9 +631,9 @@ package body GNAT.Perfect_Hash_Generators is
Success : Boolean := False;
begin
- NV := Natural (K2V * Float (NK));
-
- Keys := Allocate (NK);
+ if NK = 0 then
+ raise Program_Error with "keywords set cannot be empty";
+ end if;
if Verbose then
Put_Initial_Keys (Output, "Initial Key Table");
@@ -861,23 +864,16 @@ package body GNAT.Perfect_Hash_Generators is
procedure Finalize is
begin
- Free_Tmp_Tables;
+ -- Deallocate all the WT components (both initial and reduced
+ -- ones) to avoid memory leaks.
+ for W in 0 .. WT.Last loop
+ Free_Word (WT.Table (W));
+ end loop;
WT.Release;
IT.Release;
- NK := 0;
- Max_Key_Len := 0;
- Min_Key_Len := Max_Word_Length;
- end Finalize;
-
- ---------------------
- -- Free_Tmp_Tables --
- ---------------------
-
- procedure Free_Tmp_Tables is
- begin
- IT.Init;
+ -- Reset all variables for next usage
Keys := No_Table;
@@ -901,7 +897,22 @@ package body GNAT.Perfect_Hash_Generators is
Vertices := No_Table;
NV := 0;
- end Free_Tmp_Tables;
+
+ NK := 0;
+ Max_Key_Len := 0;
+ Min_Key_Len := 0;
+ end Finalize;
+
+ ---------------
+ -- Free_Word --
+ ---------------
+
+ procedure Free_Word (W : in out Word_Type) is
+ begin
+ if W /= null then
+ Free (W);
+ end if;
+ end Free_Word;
----------------------------
-- Generate_Mapping_Table --
@@ -1130,20 +1141,75 @@ package body GNAT.Perfect_Hash_Generators is
Tries : Positive := Default_Tries)
is
begin
- -- Free previous tables (the settings may have changed between two runs)
+ -- Deallocate the part of the table concerning the reduced words.
+ -- Initial words are already present in the table. We may have reduced
+ -- words already there because a previous computation failed. We are
+ -- currently retrying and the reduced words have to be deallocated.
- Free_Tmp_Tables;
+ for W in NK .. WT.Last loop
+ Free_Word (WT.Table (W));
+ end loop;
+ IT.Init;
- if K_To_V <= 2.0 then
- Put (Output, "K to V ratio cannot be lower than 2.0");
- New_Line (Output);
- raise Program_Error;
- end if;
+ -- Initialize of computation variables
+
+ Keys := No_Table;
+
+ Char_Pos_Set := No_Table;
+ Char_Pos_Set_Len := 0;
+
+ Used_Char_Set := No_Table;
+ Used_Char_Set_Len := 0;
+
+ T1 := No_Table;
+ T2 := No_Table;
+
+ T1_Len := 0;
+ T2_Len := 0;
+
+ G := No_Table;
+ G_Len := 0;
+
+ Edges := No_Table;
+ Edges_Len := 0;
+
+ Vertices := No_Table;
+ NV := 0;
S := Seed;
K2V := K_To_V;
Opt := Optim;
NT := Tries;
+
+ if K2V <= 2.0 then
+ raise Program_Error with "K to V ratio cannot be lower than 2.0";
+ end if;
+
+ -- Do not accept a value of K2V too close to 2.0 such that once
+ -- rounded up, NV = 2 * NK because the algorithm would not converge.
+
+ NV := Natural (Float (NK) * K2V);
+ if NV <= 2 * NK then
+ NV := 2 * NK + 1;
+ end if;
+
+ Keys := Allocate (NK);
+
+ -- Resize initial words to have all of them at the same size
+ -- (so the size of the largest one).
+
+ for K in 0 .. NK - 1 loop
+ Resize_Word (WT.Table (Initial (K)), Max_Key_Len);
+ end loop;
+
+ -- Allocated the table to store the reduced words. As WT is a
+ -- GNAT.Table (using C memory management), pointers have to be
+ -- explicitly initialized to null.
+
+ WT.Set_Last (Reduced (NK - 1));
+ for W in 0 .. NK - 1 loop
+ WT.Table (Reduced (W)) := null;
+ end loop;
end Initialize;
------------
@@ -1151,28 +1217,18 @@ package body GNAT.Perfect_Hash_Generators is
------------
procedure Insert (Value : String) is
- Word : Word_Type := Null_Word;
Len : constant Natural := Value'Length;
begin
- Word (1 .. Len) := Value (Value'First .. Value'First + Len - 1);
WT.Set_Last (NK);
- WT.Table (NK) := Word;
+ WT.Table (NK) := New_Word (Value);
NK := NK + 1;
- NV := Natural (Float (NK) * K2V);
-
- -- Do not accept a value of K2V too close to 2.0 such that once rounded
- -- up, NV = 2 * NK because the algorithm would not converge.
-
- if NV <= 2 * NK then
- NV := 2 * NK + 1;
- end if;
if Max_Key_Len < Len then
Max_Key_Len := Len;
end if;
- if Len < Min_Key_Len then
+ if Min_Key_Len = 0 or else Len < Min_Key_Len then
Min_Key_Len := Len;
end if;
end Insert;
@@ -1188,6 +1244,15 @@ package body GNAT.Perfect_Hash_Generators is
end if;
end New_Line;
+ --------------
+ -- New_Word --
+ --------------
+
+ function New_Word (S : String) return Word_Type is
+ begin
+ return new String'(S);
+ end New_Word;
+
------------------------------
-- Parse_Position_Selection --
------------------------------
@@ -1761,7 +1826,7 @@ package body GNAT.Perfect_Hash_Generators is
K := Get_Key (J);
Put (File, Image (J, M), F1, L1, J, 1, 3, 1);
Put (File, Image (K.Edge, M), F1, L1, J, 1, 3, 2);
- Put (File, WT.Table (Initial (J)), F1, L1, J, 1, 3, 3);
+ Put (File, WT.Table (Initial (J)).all, F1, L1, J, 1, 3, 3);
end loop;
end Put_Initial_Keys;
@@ -1842,7 +1907,7 @@ package body GNAT.Perfect_Hash_Generators is
K := Get_Key (J);
Put (File, Image (J, M), F1, L1, J, 1, 3, 1);
Put (File, Image (K.Edge, M), F1, L1, J, 1, 3, 2);
- Put (File, WT.Table (Reduced (J)), F1, L1, J, 1, 3, 3);
+ Put (File, WT.Table (Reduced (J)).all, F1, L1, J, 1, 3, 3);
end loop;
end Put_Reduced_Keys;
@@ -1920,6 +1985,22 @@ package body GNAT.Perfect_Hash_Generators is
return K + NK + 1;
end Reduced;
+ -----------------
+ -- Resize_Word --
+ -----------------
+
+ procedure Resize_Word (W : in out Word_Type; Len : Natural) is
+ S1 : constant String := W.all;
+ S2 : String (1 .. Len) := (others => ASCII.NUL);
+ L : constant Natural := S1'Length;
+ begin
+ if L /= Len then
+ Free_Word (W);
+ S2 (1 .. L) := S1;
+ W := New_Word (S2);
+ end if;
+ end Resize_Word;
+
--------------------------
-- Select_Char_Position --
--------------------------
@@ -1985,11 +2066,11 @@ package body GNAT.Perfect_Hash_Generators is
begin
if L = 0 then
- Left := Reduced (0) - 1;
+ Left := NK;
Right := Offset + R;
elsif R = 0 then
Left := Offset + L;
- Right := Reduced (0) - 1;
+ Right := NK;
else
Left := Offset + L;
Right := Offset + R;
@@ -2007,17 +2088,18 @@ package body GNAT.Perfect_Hash_Generators is
begin
if From = 0 then
- Source := Reduced (0) - 1;
+ Source := NK;
Target := Offset + To;
elsif To = 0 then
Source := Offset + From;
- Target := Reduced (0) - 1;
+ Target := NK;
else
Source := Offset + From;
Target := Offset + To;
end if;
WT.Table (Target) := WT.Table (Source);
+ WT.Table (Source) := null;
end Move;
package Sorting is new GNAT.Heap_Sort_G (Move, Lt);
@@ -2120,9 +2202,8 @@ package body GNAT.Perfect_Hash_Generators is
begin
-- Initialize the reduced words set
- WT.Set_Last (2 * NK);
for K in 0 .. NK - 1 loop
- WT.Table (Reduced (K)) := WT.Table (Initial (K));
+ WT.Table (Reduced (K)) := New_Word (WT.Table (Initial (K)).all);
end loop;
declare
@@ -2220,7 +2301,7 @@ package body GNAT.Perfect_Hash_Generators is
Same_Keys_Sets_Table (J).First ..
Same_Keys_Sets_Table (J).Last
loop
- Put (Output, WT.Table (Reduced (K)));
+ Put (Output, WT.Table (Reduced (K)).all);
New_Line (Output);
end loop;
Put (Output, "--");
diff --git a/gcc/ada/g-pehage.ads b/gcc/ada/g-pehage.ads
index b2aea490eed..8b75f2e8803 100644
--- a/gcc/ada/g-pehage.ads
+++ b/gcc/ada/g-pehage.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2002-2005, AdaCore --
+-- Copyright (C) 2002-2008, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -60,7 +60,7 @@
-- The hash table size corresponds to the exact size of W and *no larger*.
-- This represents the "minimal" property.
--- The functions generated by this package require the key set to be known in
+-- The functions generated by this package require the words to be known in
-- advance (they are "static" hash functions). The hash functions are also
-- order preserving. If w2 is inserted after w1 in the generator, then (w1)
-- < f (w2). These hashing functions are convenient for use with realtime
@@ -101,25 +101,31 @@ package GNAT.Perfect_Hash_Generators is
Tries : Positive := Default_Tries);
-- Initialize the generator and its internal structures. Set the ratio of
-- vertices over keys in the random graphs. This value has to be greater
- -- than 2.0 in order for the algorithm to succeed. The key set is not
+ -- than 2.0 in order for the algorithm to succeed. The word set is not
-- modified (in particular when it is already set). For instance, it is
-- possible to run several times the generator with different settings on
- -- the same key set.
+ -- the same words.
+ --
+ -- A classical way of doing is to Insert all the words and then to invoke
+ -- Initialize and Compute. If Compute fails to find a perfect hash
+ -- function, invoke Initialize another time with other configuration
+ -- parameters (probably with a greater K_To_V ratio). Once successful,
+ -- invoke Produce and Finalize.
procedure Finalize;
- -- Deallocate the internal structures and the key table
+ -- Deallocate the internal structures and the words table
procedure Insert (Value : String);
- -- Insert a new key in the table
+ -- Insert a new word in the table
Too_Many_Tries : exception;
-- Raised after Tries unsuccessful runs
procedure Compute (Position : String := Default_Position);
-- Compute the hash function. Position allows to define selection of
- -- character positions used in the keywords hash function. Positions can be
+ -- character positions used in the word hash function. Positions can be
-- separated by commas and range like x-y may be used. Character '$'
- -- represents the final character of a key. With an empty position, the
+ -- represents the final character of a word. With an empty position, the
-- generator automatically produces positions to reduce the memory usage.
-- Raise Too_Many_Tries in case that the algorithm does not succeed in less
-- than Tries attempts (see Initialize).
@@ -144,7 +150,7 @@ package GNAT.Perfect_Hash_Generators is
-- F1 and F2 are two functions based on two function tables T1 and T2.
-- Their definition depends on the chosen optimization mode.
- -- Only some character positions are used in the keys because they are
+ -- Only some character positions are used in the words because they are
-- significant. They are listed in a character position table (P in the
-- pseudo-code below). For instance, in {"jan", "feb", "mar", "apr", "jun",
-- "jul", "aug", "sep", "oct", "nov", "dec"}, only positions 2 and 3 are
@@ -152,7 +158,7 @@ package GNAT.Perfect_Hash_Generators is
-- {2, 3}
-- When Optimization is CPU_Time, the first dimension of T1 and T2
- -- corresponds to the character position in the key and the second to the
+ -- corresponds to the character position in the word and the second to the
-- character set. As all the character set is not used, we define a used
-- character table which associates a distinct index to each used character
-- (unused characters are mapped to zero). In this case, the second
@@ -177,7 +183,7 @@ package GNAT.Perfect_Hash_Generators is
-- end Hash;
-- When Optimization is Memory_Space, the first dimension of T1 and T2
- -- corresponds to the character position in the key and the second
+ -- corresponds to the character position in the word and the second
-- dimension is ignored. T1 and T2 are no longer matrices but vectors.
-- Therefore, the used character table is not available. The hash function
-- has the following form:
@@ -213,8 +219,8 @@ package GNAT.Perfect_Hash_Generators is
Length_2 : out Natural);
-- Return the definition of the table Name. This includes the length of
-- dimensions 1 and 2 and the size of an unsigned integer item. When
- -- Length_2 is zero, the table has only one dimension. All the ranges start
- -- from zero.
+ -- Length_2 is zero, the table has only one dimension. All the ranges
+ -- start from zero.
function Value
(Name : Table_Name;
diff --git a/gcc/ada/g-sercom-linux.adb b/gcc/ada/g-sercom-linux.adb
index cf8f805eb74..1be595a2f63 100644
--- a/gcc/ada/g-sercom-linux.adb
+++ b/gcc/ada/g-sercom-linux.adb
@@ -84,7 +84,7 @@ package body GNAT.Serial_Communications is
B115200 => 8#010002#);
C_Bits : constant array (Data_Bits) of unsigned :=
- (B7 => 8#040#, B8 => 8#060#);
+ (CS7 => 8#040#, CS8 => 8#060#);
C_Stop_Bits : constant array (Stop_Bits_Number) of unsigned :=
(One => 0, Two => CSTOPB);
@@ -181,7 +181,7 @@ package body GNAT.Serial_Communications is
procedure Set
(Port : Serial_Port;
Rate : Data_Rate := B9600;
- Bits : Data_Bits := B8;
+ Bits : Data_Bits := CS8;
Stop_Bits : Stop_Bits_Number := One;
Parity : Parity_Check := None;
Block : Boolean := True;
diff --git a/gcc/ada/g-sercom-mingw.adb b/gcc/ada/g-sercom-mingw.adb
index 76f0aa08954..abb32274e4c 100644
--- a/gcc/ada/g-sercom-mingw.adb
+++ b/gcc/ada/g-sercom-mingw.adb
@@ -168,7 +168,7 @@ package body GNAT.Serial_Communications is
procedure Set
(Port : Serial_Port;
Rate : Data_Rate := B9600;
- Bits : Data_Bits := B8;
+ Bits : Data_Bits := CS8;
Stop_Bits : Stop_Bits_Number := One;
Parity : Parity_Check := None;
Block : Boolean := True;
diff --git a/gcc/ada/g-sercom.adb b/gcc/ada/g-sercom.adb
index ead5c868c6e..c1b4b8e481b 100644
--- a/gcc/ada/g-sercom.adb
+++ b/gcc/ada/g-sercom.adb
@@ -79,7 +79,7 @@ package body GNAT.Serial_Communications is
procedure Set
(Port : Serial_Port;
Rate : Data_Rate := B9600;
- Bits : Data_Bits := B8;
+ Bits : Data_Bits := CS8;
Stop_Bits : Stop_Bits_Number := One;
Parity : Parity_Check := None;
Block : Boolean := True;
diff --git a/gcc/ada/g-sercom.ads b/gcc/ada/g-sercom.ads
index 3d327cec76f..8b4c5590684 100644
--- a/gcc/ada/g-sercom.ads
+++ b/gcc/ada/g-sercom.ads
@@ -45,13 +45,17 @@ package GNAT.Serial_Communications is
-- A serial com port name
function Name (Number : Positive) return Port_Name;
- -- Returns the port name for the given port number
+ -- Returns a possible port name for the given legacy PC architecture serial
+ -- port number (COM<number>: on Windows, ttyS<number-1> on Linux).
+ -- Note that this function does not support other kinds of serial ports
+ -- nor operating systems other than Windows and Linux. For all other
+ -- cases, an explicit port name can be passed directly to Open.
type Data_Rate is
(B1200, B2400, B4800, B9600, B19200, B38400, B57600, B115200);
-- Speed of the communication
- type Data_Bits is (B8, B7);
+ type Data_Bits is (CS8, CS7);
-- Communication bits
type Stop_Bits_Number is (One, Two);
@@ -71,7 +75,7 @@ package GNAT.Serial_Communications is
procedure Set
(Port : Serial_Port;
Rate : Data_Rate := B9600;
- Bits : Data_Bits := B8;
+ Bits : Data_Bits := CS8;
Stop_Bits : Stop_Bits_Number := One;
Parity : Parity_Check := None;
Block : Boolean := True;
diff --git a/gcc/ada/g-soccon-aix.ads b/gcc/ada/g-soccon-aix.ads
deleted file mode 100644
index c0a1503f363..00000000000
--- a/gcc/ada/g-soccon-aix.ads
+++ /dev/null
@@ -1,208 +0,0 @@
-------------------------------------------------------------------------------
--- --
--- GNAT COMPILER COMPONENTS --
--- --
--- G N A T . S O C K E T S . C O N S T A N T S --
--- --
--- S p e c --
--- --
--- Copyright (C) 2000-2008, Free Software Foundation, Inc. --
--- --
--- GNAT is free software; you can redistribute it and/or modify it under --
--- terms of the GNU General Public License as published by the Free Soft- --
--- ware Foundation; either version 2, or (at your option) any later ver- --
--- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
--- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
--- for more details. You should have received a copy of the GNU General --
--- Public License distributed with GNAT; see file COPYING. If not, write --
--- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
--- Boston, MA 02110-1301, USA. --
--- --
--- As a special exception, if other files instantiate generics from this --
--- unit, or you link this unit with other files to produce an executable, --
--- this unit does not by itself cause the resulting executable to be --
--- covered by the GNU General Public License. This exception does not --
--- however invalidate any other reasons why the executable file might be --
--- covered by the GNU Public License. --
--- --
--- GNAT was originally developed by the GNAT team at New York University. --
--- Extensive contributions were provided by Ada Core Technologies Inc. --
--- --
-------------------------------------------------------------------------------
-
--- This package provides target dependent definitions of constant for use
--- by the GNAT.Sockets package (g-socket.ads). This package should not be
--- directly with'ed by an applications program.
-
--- This is the version for powerpc-ibm-aix5.3.0.0
--- This file is generated automatically, do not modify it by hand! Instead,
--- make changes to gen-soccon.c and re-run it on each target.
-
-with Interfaces.C;
-package GNAT.Sockets.Constants is
-
- --------------
- -- Families --
- --------------
-
- AF_INET : constant := 2; -- IPv4 address family
- AF_INET6 : constant := 24; -- IPv6 address family
-
- -----------
- -- Modes --
- -----------
-
- SOCK_STREAM : constant := 1; -- Stream socket
- SOCK_DGRAM : constant := 2; -- Datagram socket
-
- -------------------
- -- Socket errors --
- -------------------
-
- EACCES : constant := 13; -- Permission denied
- EADDRINUSE : constant := 67; -- Address already in use
- EADDRNOTAVAIL : constant := 68; -- Cannot assign address
- EAFNOSUPPORT : constant := 66; -- Addr family not supported
- EALREADY : constant := 56; -- Operation in progress
- EBADF : constant := 9; -- Bad file descriptor
- ECONNABORTED : constant := 72; -- Connection aborted
- ECONNREFUSED : constant := 79; -- Connection refused
- ECONNRESET : constant := 73; -- Connection reset by peer
- EDESTADDRREQ : constant := 58; -- Destination addr required
- EFAULT : constant := 14; -- Bad address
- EHOSTDOWN : constant := 80; -- Host is down
- EHOSTUNREACH : constant := 81; -- No route to host
- EINPROGRESS : constant := 55; -- Operation now in progress
- EINTR : constant := 4; -- Interrupted system call
- EINVAL : constant := 22; -- Invalid argument
- EIO : constant := 5; -- Input output error
- EISCONN : constant := 75; -- Socket already connected
- ELOOP : constant := 85; -- Too many symbolic links
- EMFILE : constant := 24; -- Too many open files
- EMSGSIZE : constant := 59; -- Message too long
- ENAMETOOLONG : constant := 86; -- Name too long
- ENETDOWN : constant := 69; -- Network is down
- ENETRESET : constant := 71; -- Disconn. on network reset
- ENETUNREACH : constant := 70; -- Network is unreachable
- ENOBUFS : constant := 74; -- No buffer space available
- ENOPROTOOPT : constant := 61; -- Protocol not available
- ENOTCONN : constant := 76; -- Socket not connected
- ENOTSOCK : constant := 57; -- Operation on non socket
- EOPNOTSUPP : constant := 64; -- Operation not supported
- EPFNOSUPPORT : constant := 65; -- Unknown protocol family
- EPROTONOSUPPORT : constant := 62; -- Unknown protocol
- EPROTOTYPE : constant := 60; -- Unknown protocol type
- ESHUTDOWN : constant := 77; -- Cannot send once shutdown
- ESOCKTNOSUPPORT : constant := 63; -- Socket type not supported
- ETIMEDOUT : constant := 78; -- Connection timed out
- ETOOMANYREFS : constant := 115; -- Too many references
- EWOULDBLOCK : constant := 11; -- Operation would block
-
- -----------------
- -- Host errors --
- -----------------
-
- HOST_NOT_FOUND : constant := 1; -- Unknown host
- TRY_AGAIN : constant := 2; -- Host name lookup failure
- NO_DATA : constant := 4; -- No data record for name
- NO_RECOVERY : constant := 3; -- Non recoverable errors
-
- -------------------
- -- Control flags --
- -------------------
-
- FIONBIO : constant := -2147195266; -- Set/clear non-blocking io
- FIONREAD : constant := 1074030207; -- How many bytes to read
-
- --------------------
- -- Shutdown modes --
- --------------------
-
- SHUT_RD : constant := 0; -- No more recv
- SHUT_WR : constant := 1; -- No more send
- SHUT_RDWR : constant := 2; -- No more recv/send
-
- ---------------------
- -- Protocol levels --
- ---------------------
-
- SOL_SOCKET : constant := 65535; -- Options for socket level
- IPPROTO_IP : constant := 0; -- Dummy protocol for IP
- IPPROTO_UDP : constant := 17; -- UDP
- IPPROTO_TCP : constant := 6; -- TCP
-
- -------------------
- -- Request flags --
- -------------------
-
- MSG_OOB : constant := 1; -- Process out-of-band data
- MSG_PEEK : constant := 2; -- Peek at incoming data
- MSG_EOR : constant := 8; -- Send end of record
- MSG_WAITALL : constant := 64; -- Wait for full reception
- MSG_NOSIGNAL : constant := -1; -- No SIGPIPE on send
- MSG_Forced_Flags : constant := 0;
- -- Flags set on all send(2) calls
-
- --------------------
- -- Socket options --
- --------------------
-
- TCP_NODELAY : constant := 1; -- Do not coalesce packets
- SO_REUSEADDR : constant := 4; -- Bind reuse local address
- SO_REUSEPORT : constant := 512; -- Bind reuse port number
- SO_KEEPALIVE : constant := 8; -- Enable keep-alive msgs
- SO_LINGER : constant := 128; -- Defer close to flush data
- SO_BROADCAST : constant := 32; -- Can send broadcast msgs
- SO_SNDBUF : constant := 4097; -- Set/get send buffer size
- SO_RCVBUF : constant := 4098; -- Set/get recv buffer size
- SO_SNDTIMEO : constant := 4101; -- Emission timeout
- SO_RCVTIMEO : constant := 4102; -- Reception timeout
- SO_ERROR : constant := 4103; -- Get/clear error status
- IP_MULTICAST_IF : constant := 9; -- Set/get mcast interface
- IP_MULTICAST_TTL : constant := 10; -- Set/get multicast TTL
- IP_MULTICAST_LOOP : constant := 11; -- Set/get mcast loopback
- IP_ADD_MEMBERSHIP : constant := 12; -- Join a multicast group
- IP_DROP_MEMBERSHIP : constant := 13; -- Leave a multicast group
- IP_PKTINFO : constant := -1; -- Get datagram info
-
- -------------------
- -- System limits --
- -------------------
-
- IOV_MAX : constant := 16; -- Maximum writev iovcnt
-
- ----------------------
- -- Type definitions --
- ----------------------
-
- -- Sizes (in bytes) of the components of struct timeval
-
- SIZEOF_tv_sec : constant := 4; -- tv_sec
- SIZEOF_tv_usec : constant := 4; -- tv_usec
-
- -- Sizes of protocol specific address types (for sockaddr.sa_len)
-
- SIZEOF_sockaddr_in : constant := 16; -- struct sockaddr_in
- SIZEOF_sockaddr_in6 : constant := 28; -- struct sockaddr_in6
-
- -- Size of file descriptor sets
-
- SIZEOF_fd_set : constant := 8192; -- fd_set
-
- -- Fields of struct hostent
-
- subtype H_Addrtype_T is Interfaces.C.int;
- subtype H_Length_T is Interfaces.C.int;
-
- ----------------------------------------
- -- Properties of supported interfaces --
- ----------------------------------------
-
- Need_Netdb_Buffer : constant := 0; -- Need buffer for Netdb ops
- Has_Sockaddr_Len : constant := 0; -- Sockaddr has sa_len field
-
- Thread_Blocking_IO : constant Boolean := True;
- -- Set False for contexts where socket i/o are process blocking
-
-end GNAT.Sockets.Constants;
diff --git a/gcc/ada/g-soccon-darwin.ads b/gcc/ada/g-soccon-darwin.ads
deleted file mode 100644
index 7e7922405eb..00000000000
--- a/gcc/ada/g-soccon-darwin.ads
+++ /dev/null
@@ -1,208 +0,0 @@
-------------------------------------------------------------------------------
--- --
--- GNAT COMPILER COMPONENTS --
--- --
--- G N A T . S O C K E T S . C O N S T A N T S --
--- --
--- S p e c --
--- --
--- Copyright (C) 2000-2008, Free Software Foundation, Inc. --
--- --
--- GNAT is free software; you can redistribute it and/or modify it under --
--- terms of the GNU General Public License as published by the Free Soft- --
--- ware Foundation; either version 2, or (at your option) any later ver- --
--- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
--- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
--- for more details. You should have received a copy of the GNU General --
--- Public License distributed with GNAT; see file COPYING. If not, write --
--- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
--- Boston, MA 02110-1301, USA. --
--- --
--- As a special exception, if other files instantiate generics from this --
--- unit, or you link this unit with other files to produce an executable, --
--- this unit does not by itself cause the resulting executable to be --
--- covered by the GNU General Public License. This exception does not --
--- however invalidate any other reasons why the executable file might be --
--- covered by the GNU Public License. --
--- --
--- GNAT was originally developed by the GNAT team at New York University. --
--- Extensive contributions were provided by Ada Core Technologies Inc. --
--- --
-------------------------------------------------------------------------------
-
--- This package provides target dependent definitions of constant for use
--- by the GNAT.Sockets package (g-socket.ads). This package should not be
--- directly with'ed by an applications program.
-
--- This is the version for i386-apple-darwin8.8.4
--- This file is generated automatically, do not modify it by hand! Instead,
--- make changes to gen-soccon.c and re-run it on each target.
-
-with Interfaces.C;
-package GNAT.Sockets.Constants is
-
- --------------
- -- Families --
- --------------
-
- AF_INET : constant := 2; -- IPv4 address family
- AF_INET6 : constant := 30; -- IPv6 address family
-
- -----------
- -- Modes --
- -----------
-
- SOCK_STREAM : constant := 1; -- Stream socket
- SOCK_DGRAM : constant := 2; -- Datagram socket
-
- -------------------
- -- Socket errors --
- -------------------
-
- EACCES : constant := 13; -- Permission denied
- EADDRINUSE : constant := 48; -- Address already in use
- EADDRNOTAVAIL : constant := 49; -- Cannot assign address
- EAFNOSUPPORT : constant := 47; -- Addr family not supported
- EALREADY : constant := 37; -- Operation in progress
- EBADF : constant := 9; -- Bad file descriptor
- ECONNABORTED : constant := 53; -- Connection aborted
- ECONNREFUSED : constant := 61; -- Connection refused
- ECONNRESET : constant := 54; -- Connection reset by peer
- EDESTADDRREQ : constant := 39; -- Destination addr required
- EFAULT : constant := 14; -- Bad address
- EHOSTDOWN : constant := 64; -- Host is down
- EHOSTUNREACH : constant := 65; -- No route to host
- EINPROGRESS : constant := 36; -- Operation now in progress
- EINTR : constant := 4; -- Interrupted system call
- EINVAL : constant := 22; -- Invalid argument
- EIO : constant := 5; -- Input output error
- EISCONN : constant := 56; -- Socket already connected
- ELOOP : constant := 62; -- Too many symbolic links
- EMFILE : constant := 24; -- Too many open files
- EMSGSIZE : constant := 40; -- Message too long
- ENAMETOOLONG : constant := 63; -- Name too long
- ENETDOWN : constant := 50; -- Network is down
- ENETRESET : constant := 52; -- Disconn. on network reset
- ENETUNREACH : constant := 51; -- Network is unreachable
- ENOBUFS : constant := 55; -- No buffer space available
- ENOPROTOOPT : constant := 42; -- Protocol not available
- ENOTCONN : constant := 57; -- Socket not connected
- ENOTSOCK : constant := 38; -- Operation on non socket
- EOPNOTSUPP : constant := 45; -- Operation not supported
- EPFNOSUPPORT : constant := 46; -- Unknown protocol family
- EPROTONOSUPPORT : constant := 43; -- Unknown protocol
- EPROTOTYPE : constant := 41; -- Unknown protocol type
- ESHUTDOWN : constant := 58; -- Cannot send once shutdown
- ESOCKTNOSUPPORT : constant := 44; -- Socket type not supported
- ETIMEDOUT : constant := 60; -- Connection timed out
- ETOOMANYREFS : constant := 59; -- Too many references
- EWOULDBLOCK : constant := 35; -- Operation would block
-
- -----------------
- -- Host errors --
- -----------------
-
- HOST_NOT_FOUND : constant := 1; -- Unknown host
- TRY_AGAIN : constant := 2; -- Host name lookup failure
- NO_DATA : constant := 4; -- No data record for name
- NO_RECOVERY : constant := 3; -- Non recoverable errors
-
- -------------------
- -- Control flags --
- -------------------
-
- FIONBIO : constant := -2147195266; -- Set/clear non-blocking io
- FIONREAD : constant := 1074030207; -- How many bytes to read
-
- --------------------
- -- Shutdown modes --
- --------------------
-
- SHUT_RD : constant := 0; -- No more recv
- SHUT_WR : constant := 1; -- No more send
- SHUT_RDWR : constant := 2; -- No more recv/send
-
- ---------------------
- -- Protocol levels --
- ---------------------
-
- SOL_SOCKET : constant := 65535; -- Options for socket level
- IPPROTO_IP : constant := 0; -- Dummy protocol for IP
- IPPROTO_UDP : constant := 17; -- UDP
- IPPROTO_TCP : constant := 6; -- TCP
-
- -------------------
- -- Request flags --
- -------------------
-
- MSG_OOB : constant := 1; -- Process out-of-band data
- MSG_PEEK : constant := 2; -- Peek at incoming data
- MSG_EOR : constant := 8; -- Send end of record
- MSG_WAITALL : constant := 64; -- Wait for full reception
- MSG_NOSIGNAL : constant := -1; -- No SIGPIPE on send
- MSG_Forced_Flags : constant := 0;
- -- Flags set on all send(2) calls
-
- --------------------
- -- Socket options --
- --------------------
-
- TCP_NODELAY : constant := 1; -- Do not coalesce packets
- SO_REUSEADDR : constant := 4; -- Bind reuse local address
- SO_REUSEPORT : constant := 512; -- Bind reuse port number
- SO_KEEPALIVE : constant := 8; -- Enable keep-alive msgs
- SO_LINGER : constant := 128; -- Defer close to flush data
- SO_BROADCAST : constant := 32; -- Can send broadcast msgs
- SO_SNDBUF : constant := 4097; -- Set/get send buffer size
- SO_RCVBUF : constant := 4098; -- Set/get recv buffer size
- SO_SNDTIMEO : constant := 4101; -- Emission timeout
- SO_RCVTIMEO : constant := 4102; -- Reception timeout
- SO_ERROR : constant := 4103; -- Get/clear error status
- IP_MULTICAST_IF : constant := 9; -- Set/get mcast interface
- IP_MULTICAST_TTL : constant := 10; -- Set/get multicast TTL
- IP_MULTICAST_LOOP : constant := 11; -- Set/get mcast loopback
- IP_ADD_MEMBERSHIP : constant := 12; -- Join a multicast group
- IP_DROP_MEMBERSHIP : constant := 13; -- Leave a multicast group
- IP_PKTINFO : constant := -1; -- Get datagram info
-
- -------------------
- -- System limits --
- -------------------
-
- IOV_MAX : constant := 1024; -- Maximum writev iovcnt
-
- ----------------------
- -- Type definitions --
- ----------------------
-
- -- Sizes (in bytes) of the components of struct timeval
-
- SIZEOF_tv_sec : constant := 4; -- tv_sec
- SIZEOF_tv_usec : constant := 4; -- tv_usec
-
- -- Sizes of protocol specific address types (for sockaddr.sa_len)
-
- SIZEOF_sockaddr_in : constant := 16; -- struct sockaddr_in
- SIZEOF_sockaddr_in6 : constant := 28; -- struct sockaddr_in6
-
- -- Size of file descriptor sets
-
- SIZEOF_fd_set : constant := 128; -- fd_set
-
- -- Fields of struct hostent
-
- subtype H_Addrtype_T is Interfaces.C.int;
- subtype H_Length_T is Interfaces.C.int;
-
- ----------------------------------------
- -- Properties of supported interfaces --
- ----------------------------------------
-
- Need_Netdb_Buffer : constant := 0; -- Need buffer for Netdb ops
- Has_Sockaddr_Len : constant := 0; -- Sockaddr has sa_len field
-
- Thread_Blocking_IO : constant Boolean := True;
- -- Set False for contexts where socket i/o are process blocking
-
-end GNAT.Sockets.Constants;
diff --git a/gcc/ada/g-soccon-freebsd.ads b/gcc/ada/g-soccon-freebsd.ads
deleted file mode 100644
index 8af0908ef97..00000000000
--- a/gcc/ada/g-soccon-freebsd.ads
+++ /dev/null
@@ -1,208 +0,0 @@
-------------------------------------------------------------------------------
--- --
--- GNAT COMPILER COMPONENTS --
--- --
--- G N A T . S O C K E T S . C O N S T A N T S --
--- --
--- S p e c --
--- --
--- Copyright (C) 2000-2008, Free Software Foundation, Inc. --
--- --
--- GNAT is free software; you can redistribute it and/or modify it under --
--- terms of the GNU General Public License as published by the Free Soft- --
--- ware Foundation; either version 2, or (at your option) any later ver- --
--- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
--- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
--- for more details. You should have received a copy of the GNU General --
--- Public License distributed with GNAT; see file COPYING. If not, write --
--- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
--- Boston, MA 02110-1301, USA. --
--- --
--- As a special exception, if other files instantiate generics from this --
--- unit, or you link this unit with other files to produce an executable, --
--- this unit does not by itself cause the resulting executable to be --
--- covered by the GNU General Public License. This exception does not --
--- however invalidate any other reasons why the executable file might be --
--- covered by the GNU Public License. --
--- --
--- GNAT was originally developed by the GNAT team at New York University. --
--- Extensive contributions were provided by Ada Core Technologies Inc. --
--- --
-------------------------------------------------------------------------------
-
--- This package provides target dependent definitions of constant for use
--- by the GNAT.Sockets package (g-socket.ads). This package should not be
--- directly with'ed by an applications program.
-
--- This is the version for i386-unknown-freebsd6.2
--- This file is generated automatically, do not modify it by hand! Instead,
--- make changes to gen-soccon.c and re-run it on each target.
-
-with Interfaces.C;
-package GNAT.Sockets.Constants is
-
- --------------
- -- Families --
- --------------
-
- AF_INET : constant := 2; -- IPv4 address family
- AF_INET6 : constant := 28; -- IPv6 address family
-
- -----------
- -- Modes --
- -----------
-
- SOCK_STREAM : constant := 1; -- Stream socket
- SOCK_DGRAM : constant := 2; -- Datagram socket
-
- -------------------
- -- Socket errors --
- -------------------
-
- EACCES : constant := 13; -- Permission denied
- EADDRINUSE : constant := 48; -- Address already in use
- EADDRNOTAVAIL : constant := 49; -- Cannot assign address
- EAFNOSUPPORT : constant := 47; -- Addr family not supported
- EALREADY : constant := 37; -- Operation in progress
- EBADF : constant := 9; -- Bad file descriptor
- ECONNABORTED : constant := 53; -- Connection aborted
- ECONNREFUSED : constant := 61; -- Connection refused
- ECONNRESET : constant := 54; -- Connection reset by peer
- EDESTADDRREQ : constant := 39; -- Destination addr required
- EFAULT : constant := 14; -- Bad address
- EHOSTDOWN : constant := 64; -- Host is down
- EHOSTUNREACH : constant := 65; -- No route to host
- EINPROGRESS : constant := 36; -- Operation now in progress
- EINTR : constant := 4; -- Interrupted system call
- EINVAL : constant := 22; -- Invalid argument
- EIO : constant := 5; -- Input output error
- EISCONN : constant := 56; -- Socket already connected
- ELOOP : constant := 62; -- Too many symbolic links
- EMFILE : constant := 24; -- Too many open files
- EMSGSIZE : constant := 40; -- Message too long
- ENAMETOOLONG : constant := 63; -- Name too long
- ENETDOWN : constant := 50; -- Network is down
- ENETRESET : constant := 52; -- Disconn. on network reset
- ENETUNREACH : constant := 51; -- Network is unreachable
- ENOBUFS : constant := 55; -- No buffer space available
- ENOPROTOOPT : constant := 42; -- Protocol not available
- ENOTCONN : constant := 57; -- Socket not connected
- ENOTSOCK : constant := 38; -- Operation on non socket
- EOPNOTSUPP : constant := 45; -- Operation not supported
- EPFNOSUPPORT : constant := 46; -- Unknown protocol family
- EPROTONOSUPPORT : constant := 43; -- Unknown protocol
- EPROTOTYPE : constant := 41; -- Unknown protocol type
- ESHUTDOWN : constant := 58; -- Cannot send once shutdown
- ESOCKTNOSUPPORT : constant := 44; -- Socket type not supported
- ETIMEDOUT : constant := 60; -- Connection timed out
- ETOOMANYREFS : constant := 59; -- Too many references
- EWOULDBLOCK : constant := 35; -- Operation would block
-
- -----------------
- -- Host errors --
- -----------------
-
- HOST_NOT_FOUND : constant := 1; -- Unknown host
- TRY_AGAIN : constant := 2; -- Host name lookup failure
- NO_DATA : constant := 4; -- No data record for name
- NO_RECOVERY : constant := 3; -- Non recoverable errors
-
- -------------------
- -- Control flags --
- -------------------
-
- FIONBIO : constant := -2147195266; -- Set/clear non-blocking io
- FIONREAD : constant := 1074030207; -- How many bytes to read
-
- --------------------
- -- Shutdown modes --
- --------------------
-
- SHUT_RD : constant := 0; -- No more recv
- SHUT_WR : constant := 1; -- No more send
- SHUT_RDWR : constant := 2; -- No more recv/send
-
- ---------------------
- -- Protocol levels --
- ---------------------
-
- SOL_SOCKET : constant := 65535; -- Options for socket level
- IPPROTO_IP : constant := 0; -- Dummy protocol for IP
- IPPROTO_UDP : constant := 17; -- UDP
- IPPROTO_TCP : constant := 6; -- TCP
-
- -------------------
- -- Request flags --
- -------------------
-
- MSG_OOB : constant := 1; -- Process out-of-band data
- MSG_PEEK : constant := 2; -- Peek at incoming data
- MSG_EOR : constant := 8; -- Send end of record
- MSG_WAITALL : constant := 64; -- Wait for full reception
- MSG_NOSIGNAL : constant := 131072; -- No SIGPIPE on send
- MSG_Forced_Flags : constant := 0;
- -- Flags set on all send(2) calls
-
- --------------------
- -- Socket options --
- --------------------
-
- TCP_NODELAY : constant := 1; -- Do not coalesce packets
- SO_REUSEADDR : constant := 4; -- Bind reuse local address
- SO_REUSEPORT : constant := 512; -- Bind reuse port number
- SO_KEEPALIVE : constant := 8; -- Enable keep-alive msgs
- SO_LINGER : constant := 128; -- Defer close to flush data
- SO_BROADCAST : constant := 32; -- Can send broadcast msgs
- SO_SNDBUF : constant := 4097; -- Set/get send buffer size
- SO_RCVBUF : constant := 4098; -- Set/get recv buffer size
- SO_SNDTIMEO : constant := 4101; -- Emission timeout
- SO_RCVTIMEO : constant := 4102; -- Reception timeout
- SO_ERROR : constant := 4103; -- Get/clear error status
- IP_MULTICAST_IF : constant := 9; -- Set/get mcast interface
- IP_MULTICAST_TTL : constant := 10; -- Set/get multicast TTL
- IP_MULTICAST_LOOP : constant := 11; -- Set/get mcast loopback
- IP_ADD_MEMBERSHIP : constant := 12; -- Join a multicast group
- IP_DROP_MEMBERSHIP : constant := 13; -- Leave a multicast group
- IP_PKTINFO : constant := -1; -- Get datagram info
-
- -------------------
- -- System limits --
- -------------------
-
- IOV_MAX : constant := 1024; -- Maximum writev iovcnt
-
- ----------------------
- -- Type definitions --
- ----------------------
-
- -- Sizes (in bytes) of the components of struct timeval
-
- SIZEOF_tv_sec : constant := 4; -- tv_sec
- SIZEOF_tv_usec : constant := 4; -- tv_usec
-
- -- Sizes of protocol specific address types (for sockaddr.sa_len)
-
- SIZEOF_sockaddr_in : constant := 16; -- struct sockaddr_in
- SIZEOF_sockaddr_in6 : constant := 28; -- struct sockaddr_in6
-
- -- Size of file descriptor sets
-
- SIZEOF_fd_set : constant := 128; -- fd_set
-
- -- Fields of struct hostent
-
- subtype H_Addrtype_T is Interfaces.C.int;
- subtype H_Length_T is Interfaces.C.int;
-
- ----------------------------------------
- -- Properties of supported interfaces --
- ----------------------------------------
-
- Need_Netdb_Buffer : constant := 0; -- Need buffer for Netdb ops
- Has_Sockaddr_Len : constant := 1; -- Sockaddr has sa_len field
-
- Thread_Blocking_IO : constant Boolean := True;
- -- Set False for contexts where socket i/o are process blocking
-
-end GNAT.Sockets.Constants;
diff --git a/gcc/ada/g-soccon-hpux-ia64.ads b/gcc/ada/g-soccon-hpux-ia64.ads
deleted file mode 100644
index 4c364bd9532..00000000000
--- a/gcc/ada/g-soccon-hpux-ia64.ads
+++ /dev/null
@@ -1,208 +0,0 @@
-------------------------------------------------------------------------------
--- --
--- GNAT COMPILER COMPONENTS --
--- --
--- G N A T . S O C K E T S . C O N S T A N T S --
--- --
--- S p e c --
--- --
--- Copyright (C) 2000-2008, Free Software Foundation, Inc. --
--- --
--- GNAT is free software; you can redistribute it and/or modify it under --
--- terms of the GNU General Public License as published by the Free Soft- --
--- ware Foundation; either version 2, or (at your option) any later ver- --
--- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
--- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
--- for more details. You should have received a copy of the GNU General --
--- Public License distributed with GNAT; see file COPYING. If not, write --
--- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
--- Boston, MA 02110-1301, USA. --
--- --
--- As a special exception, if other files instantiate generics from this --
--- unit, or you link this unit with other files to produce an executable, --
--- this unit does not by itself cause the resulting executable to be --
--- covered by the GNU General Public License. This exception does not --
--- however invalidate any other reasons why the executable file might be --
--- covered by the GNU Public License. --
--- --
--- GNAT was originally developed by the GNAT team at New York University. --
--- Extensive contributions were provided by Ada Core Technologies Inc. --
--- --
-------------------------------------------------------------------------------
-
--- This package provides target dependent definitions of constant for use
--- by the GNAT.Sockets package (g-socket.ads). This package should not be
--- directly with'ed by an applications program.
-
--- This is the version for ia64-hp-hpux11.23
--- This file is generated automatically, do not modify it by hand! Instead,
--- make changes to gen-soccon.c and re-run it on each target.
-
-with Interfaces.C;
-package GNAT.Sockets.Constants is
-
- --------------
- -- Families --
- --------------
-
- AF_INET : constant := 2; -- IPv4 address family
- AF_INET6 : constant := 22; -- IPv6 address family
-
- -----------
- -- Modes --
- -----------
-
- SOCK_STREAM : constant := 1; -- Stream socket
- SOCK_DGRAM : constant := 2; -- Datagram socket
-
- -------------------
- -- Socket errors --
- -------------------
-
- EACCES : constant := 13; -- Permission denied
- EADDRINUSE : constant := 226; -- Address already in use
- EADDRNOTAVAIL : constant := 227; -- Cannot assign address
- EAFNOSUPPORT : constant := 225; -- Addr family not supported
- EALREADY : constant := 244; -- Operation in progress
- EBADF : constant := 9; -- Bad file descriptor
- ECONNABORTED : constant := 231; -- Connection aborted
- ECONNREFUSED : constant := 239; -- Connection refused
- ECONNRESET : constant := 232; -- Connection reset by peer
- EDESTADDRREQ : constant := 217; -- Destination addr required
- EFAULT : constant := 14; -- Bad address
- EHOSTDOWN : constant := 241; -- Host is down
- EHOSTUNREACH : constant := 242; -- No route to host
- EINPROGRESS : constant := 245; -- Operation now in progress
- EINTR : constant := 4; -- Interrupted system call
- EINVAL : constant := 22; -- Invalid argument
- EIO : constant := 5; -- Input output error
- EISCONN : constant := 234; -- Socket already connected
- ELOOP : constant := 249; -- Too many symbolic links
- EMFILE : constant := 24; -- Too many open files
- EMSGSIZE : constant := 218; -- Message too long
- ENAMETOOLONG : constant := 248; -- Name too long
- ENETDOWN : constant := 228; -- Network is down
- ENETRESET : constant := 230; -- Disconn. on network reset
- ENETUNREACH : constant := 229; -- Network is unreachable
- ENOBUFS : constant := 233; -- No buffer space available
- ENOPROTOOPT : constant := 220; -- Protocol not available
- ENOTCONN : constant := 235; -- Socket not connected
- ENOTSOCK : constant := 216; -- Operation on non socket
- EOPNOTSUPP : constant := 223; -- Operation not supported
- EPFNOSUPPORT : constant := 224; -- Unknown protocol family
- EPROTONOSUPPORT : constant := 221; -- Unknown protocol
- EPROTOTYPE : constant := 219; -- Unknown protocol type
- ESHUTDOWN : constant := 236; -- Cannot send once shutdown
- ESOCKTNOSUPPORT : constant := 222; -- Socket type not supported
- ETIMEDOUT : constant := 238; -- Connection timed out
- ETOOMANYREFS : constant := 237; -- Too many references
- EWOULDBLOCK : constant := 246; -- Operation would block
-
- -----------------
- -- Host errors --
- -----------------
-
- HOST_NOT_FOUND : constant := 1; -- Unknown host
- TRY_AGAIN : constant := 2; -- Host name lookup failure
- NO_DATA : constant := 4; -- No data record for name
- NO_RECOVERY : constant := 3; -- Non recoverable errors
-
- -------------------
- -- Control flags --
- -------------------
-
- FIONBIO : constant := -2147195266; -- Set/clear non-blocking io
- FIONREAD : constant := 1074030207; -- How many bytes to read
-
- --------------------
- -- Shutdown modes --
- --------------------
-
- SHUT_RD : constant := 0; -- No more recv
- SHUT_WR : constant := 1; -- No more send
- SHUT_RDWR : constant := 2; -- No more recv/send
-
- ---------------------
- -- Protocol levels --
- ---------------------
-
- SOL_SOCKET : constant := 65535; -- Options for socket level
- IPPROTO_IP : constant := 0; -- Dummy protocol for IP
- IPPROTO_UDP : constant := 17; -- UDP
- IPPROTO_TCP : constant := 6; -- TCP
-
- -------------------
- -- Request flags --
- -------------------
-
- MSG_OOB : constant := 1; -- Process out-of-band data
- MSG_PEEK : constant := 2; -- Peek at incoming data
- MSG_EOR : constant := 8; -- Send end of record
- MSG_WAITALL : constant := 64; -- Wait for full reception
- MSG_NOSIGNAL : constant := -1; -- No SIGPIPE on send
- MSG_Forced_Flags : constant := 0;
- -- Flags set on all send(2) calls
-
- --------------------
- -- Socket options --
- --------------------
-
- TCP_NODELAY : constant := 1; -- Do not coalesce packets
- SO_REUSEADDR : constant := 4; -- Bind reuse local address
- SO_REUSEPORT : constant := 512; -- Bind reuse port number
- SO_KEEPALIVE : constant := 8; -- Enable keep-alive msgs
- SO_LINGER : constant := 128; -- Defer close to flush data
- SO_BROADCAST : constant := 32; -- Can send broadcast msgs
- SO_SNDBUF : constant := 4097; -- Set/get send buffer size
- SO_RCVBUF : constant := 4098; -- Set/get recv buffer size
- SO_SNDTIMEO : constant := 4101; -- Emission timeout
- SO_RCVTIMEO : constant := 4102; -- Reception timeout
- SO_ERROR : constant := 4103; -- Get/clear error status
- IP_MULTICAST_IF : constant := 2; -- Set/get mcast interface
- IP_MULTICAST_TTL : constant := 3; -- Set/get multicast TTL
- IP_MULTICAST_LOOP : constant := 4; -- Set/get mcast loopback
- IP_ADD_MEMBERSHIP : constant := 5; -- Join a multicast group
- IP_DROP_MEMBERSHIP : constant := 6; -- Leave a multicast group
- IP_PKTINFO : constant := -1; -- Get datagram info
-
- -------------------
- -- System limits --
- -------------------
-
- IOV_MAX : constant := 16; -- Maximum writev iovcnt
-
- ----------------------
- -- Type definitions --
- ----------------------
-
- -- Sizes (in bytes) of the components of struct timeval
-
- SIZEOF_tv_sec : constant := 8; -- tv_sec
- SIZEOF_tv_usec : constant := 8; -- tv_usec
-
- -- Sizes of protocol specific address types (for sockaddr.sa_len)
-
- SIZEOF_sockaddr_in : constant := 16; -- struct sockaddr_in
- SIZEOF_sockaddr_in6 : constant := 28; -- struct sockaddr_in6
-
- -- Size of file descriptor sets
-
- SIZEOF_fd_set : constant := 256; -- fd_set
-
- -- Fields of struct hostent
-
- subtype H_Addrtype_T is Interfaces.C.int;
- subtype H_Length_T is Interfaces.C.int;
-
- ----------------------------------------
- -- Properties of supported interfaces --
- ----------------------------------------
-
- Need_Netdb_Buffer : constant := 0; -- Need buffer for Netdb ops
- Has_Sockaddr_Len : constant := 0; -- Sockaddr has sa_len field
-
- Thread_Blocking_IO : constant Boolean := True;
- -- Set False for contexts where socket i/o are process blocking
-
-end GNAT.Sockets.Constants;
diff --git a/gcc/ada/g-soccon-hpux.ads b/gcc/ada/g-soccon-hpux.ads
deleted file mode 100644
index c49075def5a..00000000000
--- a/gcc/ada/g-soccon-hpux.ads
+++ /dev/null
@@ -1,208 +0,0 @@
-------------------------------------------------------------------------------
--- --
--- GNAT COMPILER COMPONENTS --
--- --
--- G N A T . S O C K E T S . C O N S T A N T S --
--- --
--- S p e c --
--- --
--- Copyright (C) 2000-2008, Free Software Foundation, Inc. --
--- --
--- GNAT is free software; you can redistribute it and/or modify it under --
--- terms of the GNU General Public License as published by the Free Soft- --
--- ware Foundation; either version 2, or (at your option) any later ver- --
--- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
--- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
--- for more details. You should have received a copy of the GNU General --
--- Public License distributed with GNAT; see file COPYING. If not, write --
--- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
--- Boston, MA 02110-1301, USA. --
--- --
--- As a special exception, if other files instantiate generics from this --
--- unit, or you link this unit with other files to produce an executable, --
--- this unit does not by itself cause the resulting executable to be --
--- covered by the GNU General Public License. This exception does not --
--- however invalidate any other reasons why the executable file might be --
--- covered by the GNU Public License. --
--- --
--- GNAT was originally developed by the GNAT team at New York University. --
--- Extensive contributions were provided by Ada Core Technologies Inc. --
--- --
-------------------------------------------------------------------------------
-
--- This package provides target dependent definitions of constant for use
--- by the GNAT.Sockets package (g-socket.ads). This package should not be
--- directly with'ed by an applications program.
-
--- This is the version for hppa1.1-hp-hpux11.00
--- This file is generated automatically, do not modify it by hand! Instead,
--- make changes to gen-soccon.c and re-run it on each target.
-
-with Interfaces.C;
-package GNAT.Sockets.Constants is
-
- --------------
- -- Families --
- --------------
-
- AF_INET : constant := 2; -- IPv4 address family
- AF_INET6 : constant := -1; -- IPv6 address family
-
- -----------
- -- Modes --
- -----------
-
- SOCK_STREAM : constant := 1; -- Stream socket
- SOCK_DGRAM : constant := 2; -- Datagram socket
-
- -------------------
- -- Socket errors --
- -------------------
-
- EACCES : constant := 13; -- Permission denied
- EADDRINUSE : constant := 226; -- Address already in use
- EADDRNOTAVAIL : constant := 227; -- Cannot assign address
- EAFNOSUPPORT : constant := 225; -- Addr family not supported
- EALREADY : constant := 244; -- Operation in progress
- EBADF : constant := 9; -- Bad file descriptor
- ECONNABORTED : constant := 231; -- Connection aborted
- ECONNREFUSED : constant := 239; -- Connection refused
- ECONNRESET : constant := 232; -- Connection reset by peer
- EDESTADDRREQ : constant := 217; -- Destination addr required
- EFAULT : constant := 14; -- Bad address
- EHOSTDOWN : constant := 241; -- Host is down
- EHOSTUNREACH : constant := 242; -- No route to host
- EINPROGRESS : constant := 245; -- Operation now in progress
- EINTR : constant := 4; -- Interrupted system call
- EINVAL : constant := 22; -- Invalid argument
- EIO : constant := 5; -- Input output error
- EISCONN : constant := 234; -- Socket already connected
- ELOOP : constant := 249; -- Too many symbolic links
- EMFILE : constant := 24; -- Too many open files
- EMSGSIZE : constant := 218; -- Message too long
- ENAMETOOLONG : constant := 248; -- Name too long
- ENETDOWN : constant := 228; -- Network is down
- ENETRESET : constant := 230; -- Disconn. on network reset
- ENETUNREACH : constant := 229; -- Network is unreachable
- ENOBUFS : constant := 233; -- No buffer space available
- ENOPROTOOPT : constant := 220; -- Protocol not available
- ENOTCONN : constant := 235; -- Socket not connected
- ENOTSOCK : constant := 216; -- Operation on non socket
- EOPNOTSUPP : constant := 223; -- Operation not supported
- EPFNOSUPPORT : constant := 224; -- Unknown protocol family
- EPROTONOSUPPORT : constant := 221; -- Unknown protocol
- EPROTOTYPE : constant := 219; -- Unknown protocol type
- ESHUTDOWN : constant := 236; -- Cannot send once shutdown
- ESOCKTNOSUPPORT : constant := 222; -- Socket type not supported
- ETIMEDOUT : constant := 238; -- Connection timed out
- ETOOMANYREFS : constant := 237; -- Too many references
- EWOULDBLOCK : constant := 246; -- Operation would block
-
- -----------------
- -- Host errors --
- -----------------
-
- HOST_NOT_FOUND : constant := 1; -- Unknown host
- TRY_AGAIN : constant := 2; -- Host name lookup failure
- NO_DATA : constant := 4; -- No data record for name
- NO_RECOVERY : constant := 3; -- Non recoverable errors
-
- -------------------
- -- Control flags --
- -------------------
-
- FIONBIO : constant := -2147195266; -- Set/clear non-blocking io
- FIONREAD : constant := 1074030207; -- How many bytes to read
-
- --------------------
- -- Shutdown modes --
- --------------------
-
- SHUT_RD : constant := 0; -- No more recv
- SHUT_WR : constant := 1; -- No more send
- SHUT_RDWR : constant := 2; -- No more recv/send
-
- ---------------------
- -- Protocol levels --
- ---------------------
-
- SOL_SOCKET : constant := 65535; -- Options for socket level
- IPPROTO_IP : constant := 0; -- Dummy protocol for IP
- IPPROTO_UDP : constant := 17; -- UDP
- IPPROTO_TCP : constant := 6; -- TCP
-
- -------------------
- -- Request flags --
- -------------------
-
- MSG_OOB : constant := 1; -- Process out-of-band data
- MSG_PEEK : constant := 2; -- Peek at incoming data
- MSG_EOR : constant := 8; -- Send end of record
- MSG_WAITALL : constant := 64; -- Wait for full reception
- MSG_NOSIGNAL : constant := -1; -- No SIGPIPE on send
- MSG_Forced_Flags : constant := 0;
- -- Flags set on all send(2) calls
-
- --------------------
- -- Socket options --
- --------------------
-
- TCP_NODELAY : constant := 1; -- Do not coalesce packets
- SO_REUSEADDR : constant := 4; -- Bind reuse local address
- SO_REUSEPORT : constant := 512; -- Bind reuse port number
- SO_KEEPALIVE : constant := 8; -- Enable keep-alive msgs
- SO_LINGER : constant := 128; -- Defer close to flush data
- SO_BROADCAST : constant := 32; -- Can send broadcast msgs
- SO_SNDBUF : constant := 4097; -- Set/get send buffer size
- SO_RCVBUF : constant := 4098; -- Set/get recv buffer size
- SO_SNDTIMEO : constant := 4101; -- Emission timeout
- SO_RCVTIMEO : constant := 4102; -- Reception timeout
- SO_ERROR : constant := 4103; -- Get/clear error status
- IP_MULTICAST_IF : constant := 2; -- Set/get mcast interface
- IP_MULTICAST_TTL : constant := 3; -- Set/get multicast TTL
- IP_MULTICAST_LOOP : constant := 4; -- Set/get mcast loopback
- IP_ADD_MEMBERSHIP : constant := 5; -- Join a multicast group
- IP_DROP_MEMBERSHIP : constant := 6; -- Leave a multicast group
- IP_PKTINFO : constant := -1; -- Get datagram info
-
- -------------------
- -- System limits --
- -------------------
-
- IOV_MAX : constant := 16; -- Maximum writev iovcnt
-
- ----------------------
- -- Type definitions --
- ----------------------
-
- -- Sizes (in bytes) of the components of struct timeval
-
- SIZEOF_tv_sec : constant := 4; -- tv_sec
- SIZEOF_tv_usec : constant := 4; -- tv_usec
-
- -- Sizes of protocol specific address types (for sockaddr.sa_len)
-
- SIZEOF_sockaddr_in : constant := 16; -- struct sockaddr_in
- SIZEOF_sockaddr_in6 : constant := 0; -- struct sockaddr_in6
-
- -- Size of file descriptor sets
-
- SIZEOF_fd_set : constant := 256; -- fd_set
-
- -- Fields of struct hostent
-
- subtype H_Addrtype_T is Interfaces.C.int;
- subtype H_Length_T is Interfaces.C.int;
-
- ----------------------------------------
- -- Properties of supported interfaces --
- ----------------------------------------
-
- Need_Netdb_Buffer : constant := 0; -- Need buffer for Netdb ops
- Has_Sockaddr_Len : constant := 0; -- Sockaddr has sa_len field
-
- Thread_Blocking_IO : constant Boolean := True;
- -- Set False for contexts where socket i/o are process blocking
-
-end GNAT.Sockets.Constants;
diff --git a/gcc/ada/g-soccon-irix.ads b/gcc/ada/g-soccon-irix.ads
deleted file mode 100644
index 3952a599efe..00000000000
--- a/gcc/ada/g-soccon-irix.ads
+++ /dev/null
@@ -1,208 +0,0 @@
-------------------------------------------------------------------------------
--- --
--- GNAT COMPILER COMPONENTS --
--- --
--- G N A T . S O C K E T S . C O N S T A N T S --
--- --
--- S p e c --
--- --
--- Copyright (C) 2000-2008, Free Software Foundation, Inc. --
--- --
--- GNAT is free software; you can redistribute it and/or modify it under --
--- terms of the GNU General Public License as published by the Free Soft- --
--- ware Foundation; either version 2, or (at your option) any later ver- --
--- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
--- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
--- for more details. You should have received a copy of the GNU General --
--- Public License distributed with GNAT; see file COPYING. If not, write --
--- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
--- Boston, MA 02110-1301, USA. --
--- --
--- As a special exception, if other files instantiate generics from this --
--- unit, or you link this unit with other files to produce an executable, --
--- this unit does not by itself cause the resulting executable to be --
--- covered by the GNU General Public License. This exception does not --
--- however invalidate any other reasons why the executable file might be --
--- covered by the GNU Public License. --
--- --
--- GNAT was originally developed by the GNAT team at New York University. --
--- Extensive contributions were provided by Ada Core Technologies Inc. --
--- --
-------------------------------------------------------------------------------
-
--- This package provides target dependent definitions of constant for use
--- by the GNAT.Sockets package (g-socket.ads). This package should not be
--- directly with'ed by an applications program.
-
--- This is the version for mips-sgi-irix6.5
--- This file is generated automatically, do not modify it by hand! Instead,
--- make changes to gen-soccon.c and re-run it on each target.
-
-with Interfaces.C;
-package GNAT.Sockets.Constants is
-
- --------------
- -- Families --
- --------------
-
- AF_INET : constant := 2; -- IPv4 address family
- AF_INET6 : constant := 24; -- IPv6 address family
-
- -----------
- -- Modes --
- -----------
-
- SOCK_STREAM : constant := 2; -- Stream socket
- SOCK_DGRAM : constant := 1; -- Datagram socket
-
- -------------------
- -- Socket errors --
- -------------------
-
- EACCES : constant := 13; -- Permission denied
- EADDRINUSE : constant := 125; -- Address already in use
- EADDRNOTAVAIL : constant := 126; -- Cannot assign address
- EAFNOSUPPORT : constant := 124; -- Addr family not supported
- EALREADY : constant := 149; -- Operation in progress
- EBADF : constant := 9; -- Bad file descriptor
- ECONNABORTED : constant := 130; -- Connection aborted
- ECONNREFUSED : constant := 146; -- Connection refused
- ECONNRESET : constant := 131; -- Connection reset by peer
- EDESTADDRREQ : constant := 96; -- Destination addr required
- EFAULT : constant := 14; -- Bad address
- EHOSTDOWN : constant := 147; -- Host is down
- EHOSTUNREACH : constant := 148; -- No route to host
- EINPROGRESS : constant := 150; -- Operation now in progress
- EINTR : constant := 4; -- Interrupted system call
- EINVAL : constant := 22; -- Invalid argument
- EIO : constant := 5; -- Input output error
- EISCONN : constant := 133; -- Socket already connected
- ELOOP : constant := 90; -- Too many symbolic links
- EMFILE : constant := 24; -- Too many open files
- EMSGSIZE : constant := 97; -- Message too long
- ENAMETOOLONG : constant := 78; -- Name too long
- ENETDOWN : constant := 127; -- Network is down
- ENETRESET : constant := 129; -- Disconn. on network reset
- ENETUNREACH : constant := 128; -- Network is unreachable
- ENOBUFS : constant := 132; -- No buffer space available
- ENOPROTOOPT : constant := 99; -- Protocol not available
- ENOTCONN : constant := 134; -- Socket not connected
- ENOTSOCK : constant := 95; -- Operation on non socket
- EOPNOTSUPP : constant := 122; -- Operation not supported
- EPFNOSUPPORT : constant := 123; -- Unknown protocol family
- EPROTONOSUPPORT : constant := 120; -- Unknown protocol
- EPROTOTYPE : constant := 98; -- Unknown protocol type
- ESHUTDOWN : constant := 143; -- Cannot send once shutdown
- ESOCKTNOSUPPORT : constant := 121; -- Socket type not supported
- ETIMEDOUT : constant := 145; -- Connection timed out
- ETOOMANYREFS : constant := 144; -- Too many references
- EWOULDBLOCK : constant := 11; -- Operation would block
-
- -----------------
- -- Host errors --
- -----------------
-
- HOST_NOT_FOUND : constant := 1; -- Unknown host
- TRY_AGAIN : constant := 2; -- Host name lookup failure
- NO_DATA : constant := 4; -- No data record for name
- NO_RECOVERY : constant := 3; -- Non recoverable errors
-
- -------------------
- -- Control flags --
- -------------------
-
- FIONBIO : constant := -2147195266; -- Set/clear non-blocking io
- FIONREAD : constant := 1074030207; -- How many bytes to read
-
- --------------------
- -- Shutdown modes --
- --------------------
-
- SHUT_RD : constant := 0; -- No more recv
- SHUT_WR : constant := 1; -- No more send
- SHUT_RDWR : constant := 2; -- No more recv/send
-
- ---------------------
- -- Protocol levels --
- ---------------------
-
- SOL_SOCKET : constant := 65535; -- Options for socket level
- IPPROTO_IP : constant := 0; -- Dummy protocol for IP
- IPPROTO_UDP : constant := 17; -- UDP
- IPPROTO_TCP : constant := 6; -- TCP
-
- -------------------
- -- Request flags --
- -------------------
-
- MSG_OOB : constant := 1; -- Process out-of-band data
- MSG_PEEK : constant := 2; -- Peek at incoming data
- MSG_EOR : constant := 8; -- Send end of record
- MSG_WAITALL : constant := 64; -- Wait for full reception
- MSG_NOSIGNAL : constant := -1; -- No SIGPIPE on send
- MSG_Forced_Flags : constant := 0;
- -- Flags set on all send(2) calls
-
- --------------------
- -- Socket options --
- --------------------
-
- TCP_NODELAY : constant := 1; -- Do not coalesce packets
- SO_REUSEADDR : constant := 4; -- Bind reuse local address
- SO_REUSEPORT : constant := 512; -- Bind reuse port number
- SO_KEEPALIVE : constant := 8; -- Enable keep-alive msgs
- SO_LINGER : constant := 128; -- Defer close to flush data
- SO_BROADCAST : constant := 32; -- Can send broadcast msgs
- SO_SNDBUF : constant := 4097; -- Set/get send buffer size
- SO_RCVBUF : constant := 4098; -- Set/get recv buffer size
- SO_SNDTIMEO : constant := 4101; -- Emission timeout
- SO_RCVTIMEO : constant := 4102; -- Reception timeout
- SO_ERROR : constant := 4103; -- Get/clear error status
- IP_MULTICAST_IF : constant := 20; -- Set/get mcast interface
- IP_MULTICAST_TTL : constant := 21; -- Set/get multicast TTL
- IP_MULTICAST_LOOP : constant := 22; -- Set/get mcast loopback
- IP_ADD_MEMBERSHIP : constant := 23; -- Join a multicast group
- IP_DROP_MEMBERSHIP : constant := 24; -- Leave a multicast group
- IP_PKTINFO : constant := -1; -- Get datagram info
-
- -------------------
- -- System limits --
- -------------------
-
- IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt
-
- ----------------------
- -- Type definitions --
- ----------------------
-
- -- Sizes (in bytes) of the components of struct timeval
-
- SIZEOF_tv_sec : constant := 4; -- tv_sec
- SIZEOF_tv_usec : constant := 4; -- tv_usec
-
- -- Sizes of protocol specific address types (for sockaddr.sa_len)
-
- SIZEOF_sockaddr_in : constant := 16; -- struct sockaddr_in
- SIZEOF_sockaddr_in6 : constant := 32; -- struct sockaddr_in6
-
- -- Size of file descriptor sets
-
- SIZEOF_fd_set : constant := 128; -- fd_set
-
- -- Fields of struct hostent
-
- subtype H_Addrtype_T is Interfaces.C.int;
- subtype H_Length_T is Interfaces.C.int;
-
- ----------------------------------------
- -- Properties of supported interfaces --
- ----------------------------------------
-
- Need_Netdb_Buffer : constant := 1; -- Need buffer for Netdb ops
- Has_Sockaddr_Len : constant := 0; -- Sockaddr has sa_len field
-
- Thread_Blocking_IO : constant Boolean := True;
- -- Set False for contexts where socket i/o are process blocking
-
-end GNAT.Sockets.Constants;
diff --git a/gcc/ada/g-soccon-linux-64.ads b/gcc/ada/g-soccon-linux-64.ads
deleted file mode 100644
index 3d82b326ecf..00000000000
--- a/gcc/ada/g-soccon-linux-64.ads
+++ /dev/null
@@ -1,208 +0,0 @@
-------------------------------------------------------------------------------
--- --
--- GNAT COMPILER COMPONENTS --
--- --
--- G N A T . S O C K E T S . C O N S T A N T S --
--- --
--- S p e c --
--- --
--- Copyright (C) 2000-2008, Free Software Foundation, Inc. --
--- --
--- GNAT is free software; you can redistribute it and/or modify it under --
--- terms of the GNU General Public License as published by the Free Soft- --
--- ware Foundation; either version 2, or (at your option) any later ver- --
--- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
--- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
--- for more details. You should have received a copy of the GNU General --
--- Public License distributed with GNAT; see file COPYING. If not, write --
--- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
--- Boston, MA 02110-1301, USA. --
--- --
--- As a special exception, if other files instantiate generics from this --
--- unit, or you link this unit with other files to produce an executable, --
--- this unit does not by itself cause the resulting executable to be --
--- covered by the GNU General Public License. This exception does not --
--- however invalidate any other reasons why the executable file might be --
--- covered by the GNU Public License. --
--- --
--- GNAT was originally developed by the GNAT team at New York University. --
--- Extensive contributions were provided by Ada Core Technologies Inc. --
--- --
-------------------------------------------------------------------------------
-
--- This package provides target dependent definitions of constant for use
--- by the GNAT.Sockets package (g-socket.ads). This package should not be
--- directly with'ed by an applications program.
-
--- This is the version for x86_64-pc-linux-gnu
--- This file is generated automatically, do not modify it by hand! Instead,
--- make changes to gen-soccon.c and re-run it on each target.
-
-with Interfaces.C;
-package GNAT.Sockets.Constants is
-
- --------------
- -- Families --
- --------------
-
- AF_INET : constant := 2; -- IPv4 address family
- AF_INET6 : constant := 10; -- IPv6 address family
-
- -----------
- -- Modes --
- -----------
-
- SOCK_STREAM : constant := 1; -- Stream socket
- SOCK_DGRAM : constant := 2; -- Datagram socket
-
- -------------------
- -- Socket errors --
- -------------------
-
- EACCES : constant := 13; -- Permission denied
- EADDRINUSE : constant := 98; -- Address already in use
- EADDRNOTAVAIL : constant := 99; -- Cannot assign address
- EAFNOSUPPORT : constant := 97; -- Addr family not supported
- EALREADY : constant := 114; -- Operation in progress
- EBADF : constant := 9; -- Bad file descriptor
- ECONNABORTED : constant := 103; -- Connection aborted
- ECONNREFUSED : constant := 111; -- Connection refused
- ECONNRESET : constant := 104; -- Connection reset by peer
- EDESTADDRREQ : constant := 89; -- Destination addr required
- EFAULT : constant := 14; -- Bad address
- EHOSTDOWN : constant := 112; -- Host is down
- EHOSTUNREACH : constant := 113; -- No route to host
- EINPROGRESS : constant := 115; -- Operation now in progress
- EINTR : constant := 4; -- Interrupted system call
- EINVAL : constant := 22; -- Invalid argument
- EIO : constant := 5; -- Input output error
- EISCONN : constant := 106; -- Socket already connected
- ELOOP : constant := 40; -- Too many symbolic links
- EMFILE : constant := 24; -- Too many open files
- EMSGSIZE : constant := 90; -- Message too long
- ENAMETOOLONG : constant := 36; -- Name too long
- ENETDOWN : constant := 100; -- Network is down
- ENETRESET : constant := 102; -- Disconn. on network reset
- ENETUNREACH : constant := 101; -- Network is unreachable
- ENOBUFS : constant := 105; -- No buffer space available
- ENOPROTOOPT : constant := 92; -- Protocol not available
- ENOTCONN : constant := 107; -- Socket not connected
- ENOTSOCK : constant := 88; -- Operation on non socket
- EOPNOTSUPP : constant := 95; -- Operation not supported
- EPFNOSUPPORT : constant := 96; -- Unknown protocol family
- EPROTONOSUPPORT : constant := 93; -- Unknown protocol
- EPROTOTYPE : constant := 91; -- Unknown protocol type
- ESHUTDOWN : constant := 108; -- Cannot send once shutdown
- ESOCKTNOSUPPORT : constant := 94; -- Socket type not supported
- ETIMEDOUT : constant := 110; -- Connection timed out
- ETOOMANYREFS : constant := 109; -- Too many references
- EWOULDBLOCK : constant := 11; -- Operation would block
-
- -----------------
- -- Host errors --
- -----------------
-
- HOST_NOT_FOUND : constant := 1; -- Unknown host
- TRY_AGAIN : constant := 2; -- Host name lookup failure
- NO_DATA : constant := 4; -- No data record for name
- NO_RECOVERY : constant := 3; -- Non recoverable errors
-
- -------------------
- -- Control flags --
- -------------------
-
- FIONBIO : constant := 21537; -- Set/clear non-blocking io
- FIONREAD : constant := 21531; -- How many bytes to read
-
- --------------------
- -- Shutdown modes --
- --------------------
-
- SHUT_RD : constant := 0; -- No more recv
- SHUT_WR : constant := 1; -- No more send
- SHUT_RDWR : constant := 2; -- No more recv/send
-
- ---------------------
- -- Protocol levels --
- ---------------------
-
- SOL_SOCKET : constant := 1; -- Options for socket level
- IPPROTO_IP : constant := 0; -- Dummy protocol for IP
- IPPROTO_UDP : constant := 17; -- UDP
- IPPROTO_TCP : constant := 6; -- TCP
-
- -------------------
- -- Request flags --
- -------------------
-
- MSG_OOB : constant := 1; -- Process out-of-band data
- MSG_PEEK : constant := 2; -- Peek at incoming data
- MSG_EOR : constant := 128; -- Send end of record
- MSG_WAITALL : constant := 256; -- Wait for full reception
- MSG_NOSIGNAL : constant := 16384; -- No SIGPIPE on send
- MSG_Forced_Flags : constant := MSG_NOSIGNAL;
- -- Flags set on all send(2) calls
-
- --------------------
- -- Socket options --
- --------------------
-
- TCP_NODELAY : constant := 1; -- Do not coalesce packets
- SO_REUSEADDR : constant := 2; -- Bind reuse local address
- SO_REUSEPORT : constant := -1; -- Bind reuse port number
- SO_KEEPALIVE : constant := 9; -- Enable keep-alive msgs
- SO_LINGER : constant := 13; -- Defer close to flush data
- SO_BROADCAST : constant := 6; -- Can send broadcast msgs
- SO_SNDBUF : constant := 7; -- Set/get send buffer size
- SO_RCVBUF : constant := 8; -- Set/get recv buffer size
- SO_SNDTIMEO : constant := 21; -- Emission timeout
- SO_RCVTIMEO : constant := 20; -- Reception timeout
- SO_ERROR : constant := 4; -- Get/clear error status
- IP_MULTICAST_IF : constant := 32; -- Set/get mcast interface
- IP_MULTICAST_TTL : constant := 33; -- Set/get multicast TTL
- IP_MULTICAST_LOOP : constant := 34; -- Set/get mcast loopback
- IP_ADD_MEMBERSHIP : constant := 35; -- Join a multicast group
- IP_DROP_MEMBERSHIP : constant := 36; -- Leave a multicast group
- IP_PKTINFO : constant := 8; -- Get datagram info
-
- -------------------
- -- System limits --
- -------------------
-
- IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt
-
- ----------------------
- -- Type definitions --
- ----------------------
-
- -- Sizes (in bytes) of the components of struct timeval
-
- SIZEOF_tv_sec : constant := 8; -- tv_sec
- SIZEOF_tv_usec : constant := 8; -- tv_usec
-
- -- Sizes of protocol specific address types (for sockaddr.sa_len)
-
- SIZEOF_sockaddr_in : constant := 16; -- struct sockaddr_in
- SIZEOF_sockaddr_in6 : constant := 28; -- struct sockaddr_in6
-
- -- Size of file descriptor sets
-
- SIZEOF_fd_set : constant := 128; -- fd_set
-
- -- Fields of struct hostent
-
- subtype H_Addrtype_T is Interfaces.C.int;
- subtype H_Length_T is Interfaces.C.int;
-
- ----------------------------------------
- -- Properties of supported interfaces --
- ----------------------------------------
-
- Need_Netdb_Buffer : constant := 1; -- Need buffer for Netdb ops
- Has_Sockaddr_Len : constant := 0; -- Sockaddr has sa_len field
-
- Thread_Blocking_IO : constant Boolean := True;
- -- Set False for contexts where socket i/o are process blocking
-
-end GNAT.Sockets.Constants;
diff --git a/gcc/ada/g-soccon-linux-mips.ads b/gcc/ada/g-soccon-linux-mips.ads
deleted file mode 100644
index 0f8822e2a07..00000000000
--- a/gcc/ada/g-soccon-linux-mips.ads
+++ /dev/null
@@ -1,197 +0,0 @@
-------------------------------------------------------------------------------
--- --
--- GNAT COMPILER COMPONENTS --
--- --
--- G N A T . S O C K E T S . C O N S T A N T S --
--- --
--- S p e c --
--- --
--- Copyright (C) 2000-2008, Free Software Foundation, Inc. --
--- --
--- GNAT is free software; you can redistribute it and/or modify it under --
--- terms of the GNU General Public License as published by the Free Soft- --
--- ware Foundation; either version 2, or (at your option) any later ver- --
--- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
--- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
--- for more details. You should have received a copy of the GNU General --
--- Public License distributed with GNAT; see file COPYING. If not, write --
--- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
--- Boston, MA 02110-1301, USA. --
--- --
--- As a special exception, if other files instantiate generics from this --
--- unit, or you link this unit with other files to produce an executable, --
--- this unit does not by itself cause the resulting executable to be --
--- covered by the GNU General Public License. This exception does not --
--- however invalidate any other reasons why the executable file might be --
--- covered by the GNU Public License. --
--- --
--- GNAT was originally developed by the GNAT team at New York University. --
--- Extensive contributions were provided by Ada Core Technologies Inc. --
--- --
-------------------------------------------------------------------------------
-
--- This package provides target dependent definitions of constant for use
--- by the GNAT.Sockets package (g-socket.ads). This package should not be
--- directly with'ed by an applications program.
-
--- This is the version for mips-linux, manually edited for the first shot
--- no mips hardware at hand
--- using http://www.gelato.unsw.edu.au/lxr/source/include/asm-mips/socket.h
--- in order to find different values.
--- This file is generated automatically, do not modify it by hand! Instead,
--- make changes to gen-soccon.c and re-run it on each target.
-
-package GNAT.Sockets.Constants is
-
- --------------
- -- Families --
- --------------
-
- AF_INET : constant := 2; -- IPv4 address family
- AF_INET6 : constant := 10; -- IPv6 address family
-
- -----------
- -- Modes --
- -----------
-
- SOCK_STREAM : constant := 1; -- Stream socket
- SOCK_DGRAM : constant := 2; -- Datagram socket
-
- -------------------
- -- Socket errors --
- -------------------
-
- EACCES : constant := 13; -- Permission denied
- EADDRINUSE : constant := 98; -- Address already in use
- EADDRNOTAVAIL : constant := 99; -- Cannot assign address
- EAFNOSUPPORT : constant := 97; -- Addr family not supported
- EALREADY : constant := 114; -- Operation in progress
- EBADF : constant := 9; -- Bad file descriptor
- ECONNABORTED : constant := 103; -- Connection aborted
- ECONNREFUSED : constant := 111; -- Connection refused
- ECONNRESET : constant := 104; -- Connection reset by peer
- EDESTADDRREQ : constant := 89; -- Destination addr required
- EFAULT : constant := 14; -- Bad address
- EHOSTDOWN : constant := 112; -- Host is down
- EHOSTUNREACH : constant := 113; -- No route to host
- EINPROGRESS : constant := 115; -- Operation now in progress
- EINTR : constant := 4; -- Interrupted system call
- EINVAL : constant := 22; -- Invalid argument
- EIO : constant := 5; -- Input output error
- EISCONN : constant := 106; -- Socket already connected
- ELOOP : constant := 40; -- Too many symbolic links
- EMFILE : constant := 24; -- Too many open files
- EMSGSIZE : constant := 90; -- Message too long
- ENAMETOOLONG : constant := 36; -- Name too long
- ENETDOWN : constant := 100; -- Network is down
- ENETRESET : constant := 102; -- Disconn. on network reset
- ENETUNREACH : constant := 101; -- Network is unreachable
- ENOBUFS : constant := 105; -- No buffer space available
- ENOPROTOOPT : constant := 92; -- Protocol not available
- ENOTCONN : constant := 107; -- Socket not connected
- ENOTSOCK : constant := 88; -- Operation on non socket
- EOPNOTSUPP : constant := 95; -- Operation not supported
- EPFNOSUPPORT : constant := 96; -- Unknown protocol family
- EPROTONOSUPPORT : constant := 93; -- Unknown protocol
- EPROTOTYPE : constant := 91; -- Unknown protocol type
- ESHUTDOWN : constant := 108; -- Cannot send once shutdown
- ESOCKTNOSUPPORT : constant := 94; -- Socket type not supported
- ETIMEDOUT : constant := 110; -- Connection timed out
- ETOOMANYREFS : constant := 109; -- Too many references
- EWOULDBLOCK : constant := 11; -- Operation would block
-
- -----------------
- -- Host errors --
- -----------------
-
- HOST_NOT_FOUND : constant := 1; -- Unknown host
- TRY_AGAIN : constant := 2; -- Host name lookup failure
- NO_DATA : constant := 4; -- No data record for name
- NO_RECOVERY : constant := 3; -- Non recoverable errors
-
- -------------------
- -- Control flags --
- -------------------
-
- FIONBIO : constant := 16#667e#; -- Set/clear non-blocking io
- FIONREAD : constant := 16#467f#; -- How many bytes to read
-
- --------------------
- -- Shutdown modes --
- --------------------
-
- SHUT_RD : constant := 0; -- No more recv
- SHUT_WR : constant := 1; -- No more send
- SHUT_RDWR : constant := 2; -- No more recv/send
-
- ---------------------
- -- Protocol levels --
- ---------------------
-
- SOL_SOCKET : constant := 1; -- Options for socket level
- IPPROTO_IP : constant := 0; -- Dummy protocol for IP
- IPPROTO_UDP : constant := 17; -- UDP
- IPPROTO_TCP : constant := 6; -- TCP
-
- -------------------
- -- Request flags --
- -------------------
-
- MSG_OOB : constant := 1; -- Process out-of-band data
- MSG_PEEK : constant := 2; -- Peek at incoming data
- MSG_EOR : constant := 128; -- Send end of record
- MSG_WAITALL : constant := 256; -- Wait for full reception
- MSG_NOSIGNAL : constant := 16384; -- No SIGPIPE on send
- MSG_Forced_Flags : constant := MSG_NOSIGNAL;
- -- Flags set on all send(2) calls
-
- --------------------
- -- Socket options --
- --------------------
-
- TCP_NODELAY : constant := 1; -- Do not coalesce packets
- SO_REUSEADDR : constant := 4; -- Bind reuse local address
- SO_KEEPALIVE : constant := 8; -- Enable keep-alive msgs
- SO_LINGER : constant := 16#80#; -- Defer close to flush data
- SO_BROADCAST : constant := 16#20#; -- Can send broadcast msgs
- SO_SNDBUF : constant := 16#1001#; -- Set/get send buffer size
- SO_RCVBUF : constant := 16#1002#; -- Set/get recv buffer size
- SO_SNDTIMEO : constant := 16#1005#; -- Emission timeout
- SO_RCVTIMEO : constant := 16#1006#; -- Reception timeout
- SO_ERROR : constant := 16#1007#; -- Get/clear error status
- IP_MULTICAST_IF : constant := 32; -- Set/get mcast interface
- IP_MULTICAST_TTL : constant := 33; -- Set/get multicast TTL
- IP_MULTICAST_LOOP : constant := 34; -- Set/get mcast loopback
- IP_ADD_MEMBERSHIP : constant := 35; -- Join a multicast group
- IP_DROP_MEMBERSHIP : constant := 36; -- Leave a multicast group
-
- -------------------
- -- System limits --
- -------------------
-
- IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt
-
- ----------------------
- -- Type definitions --
- ----------------------
-
- -- Sizes (in bytes) of the components of struct timeval
-
- SIZEOF_tv_sec : constant := 4; -- tv_sec
- SIZEOF_tv_usec : constant := 4; -- tv_usec
-
- ----------------------------------------
- -- Properties of supported interfaces --
- ----------------------------------------
-
- Need_Netdb_Buffer : constant := 1; -- Need buffer for Netdb ops
-
- ----------------------
- -- Additional flags --
- ----------------------
-
- Thread_Blocking_IO : constant Boolean := True;
- -- Set False for contexts where socket i/o are process blocking
-
-end GNAT.Sockets.Constants;
diff --git a/gcc/ada/g-soccon-linux-ppc.ads b/gcc/ada/g-soccon-linux-ppc.ads
deleted file mode 100644
index 7a8c2e260b3..00000000000
--- a/gcc/ada/g-soccon-linux-ppc.ads
+++ /dev/null
@@ -1,208 +0,0 @@
-------------------------------------------------------------------------------
--- --
--- GNAT COMPILER COMPONENTS --
--- --
--- G N A T . S O C K E T S . C O N S T A N T S --
--- --
--- S p e c --
--- --
--- Copyright (C) 2000-2008, Free Software Foundation, Inc. --
--- --
--- GNAT is free software; you can redistribute it and/or modify it under --
--- terms of the GNU General Public License as published by the Free Soft- --
--- ware Foundation; either version 2, or (at your option) any later ver- --
--- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
--- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
--- for more details. You should have received a copy of the GNU General --
--- Public License distributed with GNAT; see file COPYING. If not, write --
--- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
--- Boston, MA 02110-1301, USA. --
--- --
--- As a special exception, if other files instantiate generics from this --
--- unit, or you link this unit with other files to produce an executable, --
--- this unit does not by itself cause the resulting executable to be --
--- covered by the GNU General Public License. This exception does not --
--- however invalidate any other reasons why the executable file might be --
--- covered by the GNU Public License. --
--- --
--- GNAT was originally developed by the GNAT team at New York University. --
--- Extensive contributions were provided by Ada Core Technologies Inc. --
--- --
-------------------------------------------------------------------------------
-
--- This package provides target dependent definitions of constant for use
--- by the GNAT.Sockets package (g-socket.ads). This package should not be
--- directly with'ed by an applications program.
-
--- This is the version for ppc-unknown-linux-gnu
--- This file is generated automatically, do not modify it by hand! Instead,
--- make changes to gen-soccon.c and re-run it on each target.
-
-with Interfaces.C;
-package GNAT.Sockets.Constants is
-
- --------------
- -- Families --
- --------------
-
- AF_INET : constant := 2; -- IPv4 address family
- AF_INET6 : constant := 10; -- IPv6 address family
-
- -----------
- -- Modes --
- -----------
-
- SOCK_STREAM : constant := 1; -- Stream socket
- SOCK_DGRAM : constant := 2; -- Datagram socket
-
- -------------------
- -- Socket errors --
- -------------------
-
- EACCES : constant := 13; -- Permission denied
- EADDRINUSE : constant := 98; -- Address already in use
- EADDRNOTAVAIL : constant := 99; -- Cannot assign address
- EAFNOSUPPORT : constant := 97; -- Addr family not supported
- EALREADY : constant := 114; -- Operation in progress
- EBADF : constant := 9; -- Bad file descriptor
- ECONNABORTED : constant := 103; -- Connection aborted
- ECONNREFUSED : constant := 111; -- Connection refused
- ECONNRESET : constant := 104; -- Connection reset by peer
- EDESTADDRREQ : constant := 89; -- Destination addr required
- EFAULT : constant := 14; -- Bad address
- EHOSTDOWN : constant := 112; -- Host is down
- EHOSTUNREACH : constant := 113; -- No route to host
- EINPROGRESS : constant := 115; -- Operation now in progress
- EINTR : constant := 4; -- Interrupted system call
- EINVAL : constant := 22; -- Invalid argument
- EIO : constant := 5; -- Input output error
- EISCONN : constant := 106; -- Socket already connected
- ELOOP : constant := 40; -- Too many symbolic links
- EMFILE : constant := 24; -- Too many open files
- EMSGSIZE : constant := 90; -- Message too long
- ENAMETOOLONG : constant := 36; -- Name too long
- ENETDOWN : constant := 100; -- Network is down
- ENETRESET : constant := 102; -- Disconn. on network reset
- ENETUNREACH : constant := 101; -- Network is unreachable
- ENOBUFS : constant := 105; -- No buffer space available
- ENOPROTOOPT : constant := 92; -- Protocol not available
- ENOTCONN : constant := 107; -- Socket not connected
- ENOTSOCK : constant := 88; -- Operation on non socket
- EOPNOTSUPP : constant := 95; -- Operation not supported
- EPFNOSUPPORT : constant := 96; -- Unknown protocol family
- EPROTONOSUPPORT : constant := 93; -- Unknown protocol
- EPROTOTYPE : constant := 91; -- Unknown protocol type
- ESHUTDOWN : constant := 108; -- Cannot send once shutdown
- ESOCKTNOSUPPORT : constant := 94; -- Socket type not supported
- ETIMEDOUT : constant := 110; -- Connection timed out
- ETOOMANYREFS : constant := 109; -- Too many references
- EWOULDBLOCK : constant := 11; -- Operation would block
-
- -----------------
- -- Host errors --
- -----------------
-
- HOST_NOT_FOUND : constant := 1; -- Unknown host
- TRY_AGAIN : constant := 2; -- Host name lookup failure
- NO_DATA : constant := 4; -- No data record for name
- NO_RECOVERY : constant := 3; -- Non recoverable errors
-
- -------------------
- -- Control flags --
- -------------------
-
- FIONBIO : constant := -2147195266; -- Set/clear non-blocking io
- FIONREAD : constant := 1074030207; -- How many bytes to read
-
- --------------------
- -- Shutdown modes --
- --------------------
-
- SHUT_RD : constant := 0; -- No more recv
- SHUT_WR : constant := 1; -- No more send
- SHUT_RDWR : constant := 2; -- No more recv/send
-
- ---------------------
- -- Protocol levels --
- ---------------------
-
- SOL_SOCKET : constant := 1; -- Options for socket level
- IPPROTO_IP : constant := 0; -- Dummy protocol for IP
- IPPROTO_UDP : constant := 17; -- UDP
- IPPROTO_TCP : constant := 6; -- TCP
-
- -------------------
- -- Request flags --
- -------------------
-
- MSG_OOB : constant := 1; -- Process out-of-band data
- MSG_PEEK : constant := 2; -- Peek at incoming data
- MSG_EOR : constant := 128; -- Send end of record
- MSG_WAITALL : constant := 256; -- Wait for full reception
- MSG_NOSIGNAL : constant := 16384; -- No SIGPIPE on send
- MSG_Forced_Flags : constant := MSG_NOSIGNAL;
- -- Flags set on all send(2) calls
-
- --------------------
- -- Socket options --
- --------------------
-
- TCP_NODELAY : constant := 1; -- Do not coalesce packets
- SO_REUSEADDR : constant := 2; -- Bind reuse local address
- SO_REUSEPORT : constant := -1; -- Bind reuse port number
- SO_KEEPALIVE : constant := 9; -- Enable keep-alive msgs
- SO_LINGER : constant := 13; -- Defer close to flush data
- SO_BROADCAST : constant := 6; -- Can send broadcast msgs
- SO_SNDBUF : constant := 7; -- Set/get send buffer size
- SO_RCVBUF : constant := 8; -- Set/get recv buffer size
- SO_SNDTIMEO : constant := 19; -- Emission timeout
- SO_RCVTIMEO : constant := 18; -- Reception timeout
- SO_ERROR : constant := 4; -- Get/clear error status
- IP_MULTICAST_IF : constant := 32; -- Set/get mcast interface
- IP_MULTICAST_TTL : constant := 33; -- Set/get multicast TTL
- IP_MULTICAST_LOOP : constant := 34; -- Set/get mcast loopback
- IP_ADD_MEMBERSHIP : constant := 35; -- Join a multicast group
- IP_DROP_MEMBERSHIP : constant := 36; -- Leave a multicast group
- IP_PKTINFO : constant := 8; -- Get datagram info
-
- -------------------
- -- System limits --
- -------------------
-
- IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt
-
- ----------------------
- -- Type definitions --
- ----------------------
-
- -- Sizes (in bytes) of the components of struct timeval
-
- SIZEOF_tv_sec : constant := 4; -- tv_sec
- SIZEOF_tv_usec : constant := 4; -- tv_usec
-
- -- Sizes of protocol specific address types (for sockaddr.sa_len)
-
- SIZEOF_sockaddr_in : constant := 16; -- struct sockaddr_in
- SIZEOF_sockaddr_in6 : constant := 28; -- struct sockaddr_in6
-
- -- Size of file descriptor sets
-
- SIZEOF_fd_set : constant := 128; -- fd_set
-
- -- Fields of struct hostent
-
- subtype H_Addrtype_T is Interfaces.C.int;
- subtype H_Length_T is Interfaces.C.int;
-
- ----------------------------------------
- -- Properties of supported interfaces --
- ----------------------------------------
-
- Need_Netdb_Buffer : constant := 1; -- Need buffer for Netdb ops
- Has_Sockaddr_Len : constant := 0; -- Sockaddr has sa_len field
-
- Thread_Blocking_IO : constant Boolean := True;
- -- Set False for contexts where socket i/o are process blocking
-
-end GNAT.Sockets.Constants;
diff --git a/gcc/ada/g-soccon-linux-x86.ads b/gcc/ada/g-soccon-linux-x86.ads
deleted file mode 100644
index ed2b8d9624d..00000000000
--- a/gcc/ada/g-soccon-linux-x86.ads
+++ /dev/null
@@ -1,208 +0,0 @@
-------------------------------------------------------------------------------
--- --
--- GNAT COMPILER COMPONENTS --
--- --
--- G N A T . S O C K E T S . C O N S T A N T S --
--- --
--- S p e c --
--- --
--- Copyright (C) 2000-2008, Free Software Foundation, Inc. --
--- --
--- GNAT is free software; you can redistribute it and/or modify it under --
--- terms of the GNU General Public License as published by the Free Soft- --
--- ware Foundation; either version 2, or (at your option) any later ver- --
--- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
--- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
--- for more details. You should have received a copy of the GNU General --
--- Public License distributed with GNAT; see file COPYING. If not, write --
--- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
--- Boston, MA 02110-1301, USA. --
--- --
--- As a special exception, if other files instantiate generics from this --
--- unit, or you link this unit with other files to produce an executable, --
--- this unit does not by itself cause the resulting executable to be --
--- covered by the GNU General Public License. This exception does not --
--- however invalidate any other reasons why the executable file might be --
--- covered by the GNU Public License. --
--- --
--- GNAT was originally developed by the GNAT team at New York University. --
--- Extensive contributions were provided by Ada Core Technologies Inc. --
--- --
-------------------------------------------------------------------------------
-
--- This package provides target dependent definitions of constant for use
--- by the GNAT.Sockets package (g-socket.ads). This package should not be
--- directly with'ed by an applications program.
-
--- This is the version for i686-pc-linux-gnu
--- This file is generated automatically, do not modify it by hand! Instead,
--- make changes to gen-soccon.c and re-run it on each target.
-
-with Interfaces.C;
-package GNAT.Sockets.Constants is
-
- --------------
- -- Families --
- --------------
-
- AF_INET : constant := 2; -- IPv4 address family
- AF_INET6 : constant := 10; -- IPv6 address family
-
- -----------
- -- Modes --
- -----------
-
- SOCK_STREAM : constant := 1; -- Stream socket
- SOCK_DGRAM : constant := 2; -- Datagram socket
-
- -------------------
- -- Socket errors --
- -------------------
-
- EACCES : constant := 13; -- Permission denied
- EADDRINUSE : constant := 98; -- Address already in use
- EADDRNOTAVAIL : constant := 99; -- Cannot assign address
- EAFNOSUPPORT : constant := 97; -- Addr family not supported
- EALREADY : constant := 114; -- Operation in progress
- EBADF : constant := 9; -- Bad file descriptor
- ECONNABORTED : constant := 103; -- Connection aborted
- ECONNREFUSED : constant := 111; -- Connection refused
- ECONNRESET : constant := 104; -- Connection reset by peer
- EDESTADDRREQ : constant := 89; -- Destination addr required
- EFAULT : constant := 14; -- Bad address
- EHOSTDOWN : constant := 112; -- Host is down
- EHOSTUNREACH : constant := 113; -- No route to host
- EINPROGRESS : constant := 115; -- Operation now in progress
- EINTR : constant := 4; -- Interrupted system call
- EINVAL : constant := 22; -- Invalid argument
- EIO : constant := 5; -- Input output error
- EISCONN : constant := 106; -- Socket already connected
- ELOOP : constant := 40; -- Too many symbolic links
- EMFILE : constant := 24; -- Too many open files
- EMSGSIZE : constant := 90; -- Message too long
- ENAMETOOLONG : constant := 36; -- Name too long
- ENETDOWN : constant := 100; -- Network is down
- ENETRESET : constant := 102; -- Disconn. on network reset
- ENETUNREACH : constant := 101; -- Network is unreachable
- ENOBUFS : constant := 105; -- No buffer space available
- ENOPROTOOPT : constant := 92; -- Protocol not available
- ENOTCONN : constant := 107; -- Socket not connected
- ENOTSOCK : constant := 88; -- Operation on non socket
- EOPNOTSUPP : constant := 95; -- Operation not supported
- EPFNOSUPPORT : constant := 96; -- Unknown protocol family
- EPROTONOSUPPORT : constant := 93; -- Unknown protocol
- EPROTOTYPE : constant := 91; -- Unknown protocol type
- ESHUTDOWN : constant := 108; -- Cannot send once shutdown
- ESOCKTNOSUPPORT : constant := 94; -- Socket type not supported
- ETIMEDOUT : constant := 110; -- Connection timed out
- ETOOMANYREFS : constant := 109; -- Too many references
- EWOULDBLOCK : constant := 11; -- Operation would block
-
- -----------------
- -- Host errors --
- -----------------
-
- HOST_NOT_FOUND : constant := 1; -- Unknown host
- TRY_AGAIN : constant := 2; -- Host name lookup failure
- NO_DATA : constant := 4; -- No data record for name
- NO_RECOVERY : constant := 3; -- Non recoverable errors
-
- -------------------
- -- Control flags --
- -------------------
-
- FIONBIO : constant := 21537; -- Set/clear non-blocking io
- FIONREAD : constant := 21531; -- How many bytes to read
-
- --------------------
- -- Shutdown modes --
- --------------------
-
- SHUT_RD : constant := 0; -- No more recv
- SHUT_WR : constant := 1; -- No more send
- SHUT_RDWR : constant := 2; -- No more recv/send
-
- ---------------------
- -- Protocol levels --
- ---------------------
-
- SOL_SOCKET : constant := 1; -- Options for socket level
- IPPROTO_IP : constant := 0; -- Dummy protocol for IP
- IPPROTO_UDP : constant := 17; -- UDP
- IPPROTO_TCP : constant := 6; -- TCP
-
- -------------------
- -- Request flags --
- -------------------
-
- MSG_OOB : constant := 1; -- Process out-of-band data
- MSG_PEEK : constant := 2; -- Peek at incoming data
- MSG_EOR : constant := 128; -- Send end of record
- MSG_WAITALL : constant := 256; -- Wait for full reception
- MSG_NOSIGNAL : constant := 16384; -- No SIGPIPE on send
- MSG_Forced_Flags : constant := MSG_NOSIGNAL;
- -- Flags set on all send(2) calls
-
- --------------------
- -- Socket options --
- --------------------
-
- TCP_NODELAY : constant := 1; -- Do not coalesce packets
- SO_REUSEADDR : constant := 2; -- Bind reuse local address
- SO_REUSEPORT : constant := -1; -- Bind reuse port number
- SO_KEEPALIVE : constant := 9; -- Enable keep-alive msgs
- SO_LINGER : constant := 13; -- Defer close to flush data
- SO_BROADCAST : constant := 6; -- Can send broadcast msgs
- SO_SNDBUF : constant := 7; -- Set/get send buffer size
- SO_RCVBUF : constant := 8; -- Set/get recv buffer size
- SO_SNDTIMEO : constant := 21; -- Emission timeout
- SO_RCVTIMEO : constant := 20; -- Reception timeout
- SO_ERROR : constant := 4; -- Get/clear error status
- IP_MULTICAST_IF : constant := 32; -- Set/get mcast interface
- IP_MULTICAST_TTL : constant := 33; -- Set/get multicast TTL
- IP_MULTICAST_LOOP : constant := 34; -- Set/get mcast loopback
- IP_ADD_MEMBERSHIP : constant := 35; -- Join a multicast group
- IP_DROP_MEMBERSHIP : constant := 36; -- Leave a multicast group
- IP_PKTINFO : constant := 8; -- Get datagram info
-
- -------------------
- -- System limits --
- -------------------
-
- IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt
-
- ----------------------
- -- Type definitions --
- ----------------------
-
- -- Sizes (in bytes) of the components of struct timeval
-
- SIZEOF_tv_sec : constant := 4; -- tv_sec
- SIZEOF_tv_usec : constant := 4; -- tv_usec
-
- -- Sizes of protocol specific address types (for sockaddr.sa_len)
-
- SIZEOF_sockaddr_in : constant := 16; -- struct sockaddr_in
- SIZEOF_sockaddr_in6 : constant := 28; -- struct sockaddr_in6
-
- -- Size of file descriptor sets
-
- SIZEOF_fd_set : constant := 128; -- fd_set
-
- -- Fields of struct hostent
-
- subtype H_Addrtype_T is Interfaces.C.int;
- subtype H_Length_T is Interfaces.C.int;
-
- ----------------------------------------
- -- Properties of supported interfaces --
- ----------------------------------------
-
- Need_Netdb_Buffer : constant := 1; -- Need buffer for Netdb ops
- Has_Sockaddr_Len : constant := 0; -- Sockaddr has sa_len field
-
- Thread_Blocking_IO : constant Boolean := True;
- -- Set False for contexts where socket i/o are process blocking
-
-end GNAT.Sockets.Constants;
diff --git a/gcc/ada/g-soccon-lynxos.ads b/gcc/ada/g-soccon-lynxos.ads
deleted file mode 100644
index 04c75bf63e4..00000000000
--- a/gcc/ada/g-soccon-lynxos.ads
+++ /dev/null
@@ -1,208 +0,0 @@
-------------------------------------------------------------------------------
--- --
--- GNAT COMPILER COMPONENTS --
--- --
--- G N A T . S O C K E T S . C O N S T A N T S --
--- --
--- S p e c --
--- --
--- Copyright (C) 2000-2008, Free Software Foundation, Inc. --
--- --
--- GNAT is free software; you can redistribute it and/or modify it under --
--- terms of the GNU General Public License as published by the Free Soft- --
--- ware Foundation; either version 2, or (at your option) any later ver- --
--- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
--- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
--- for more details. You should have received a copy of the GNU General --
--- Public License distributed with GNAT; see file COPYING. If not, write --
--- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
--- Boston, MA 02110-1301, USA. --
--- --
--- As a special exception, if other files instantiate generics from this --
--- unit, or you link this unit with other files to produce an executable, --
--- this unit does not by itself cause the resulting executable to be --
--- covered by the GNU General Public License. This exception does not --
--- however invalidate any other reasons why the executable file might be --
--- covered by the GNU Public License. --
--- --
--- GNAT was originally developed by the GNAT team at New York University. --
--- Extensive contributions were provided by Ada Core Technologies Inc. --
--- --
-------------------------------------------------------------------------------
-
--- This package provides target dependent definitions of constant for use
--- by the GNAT.Sockets package (g-socket.ads). This package should not be
--- directly with'ed by an applications program.
-
--- This is the version for i386-elf-lynxos
--- This file is generated automatically, do not modify it by hand! Instead,
--- make changes to gen-soccon.c and re-run it on each target.
-
-with Interfaces.C;
-package GNAT.Sockets.Constants is
-
- --------------
- -- Families --
- --------------
-
- AF_INET : constant := 2; -- IPv4 address family
- AF_INET6 : constant := 28; -- IPv6 address family
-
- -----------
- -- Modes --
- -----------
-
- SOCK_STREAM : constant := 1; -- Stream socket
- SOCK_DGRAM : constant := 2; -- Datagram socket
-
- -------------------
- -- Socket errors --
- -------------------
-
- EACCES : constant := 13; -- Permission denied
- EADDRINUSE : constant := 98; -- Address already in use
- EADDRNOTAVAIL : constant := 99; -- Cannot assign address
- EAFNOSUPPORT : constant := 97; -- Addr family not supported
- EALREADY : constant := 114; -- Operation in progress
- EBADF : constant := 9; -- Bad file descriptor
- ECONNABORTED : constant := 103; -- Connection aborted
- ECONNREFUSED : constant := 111; -- Connection refused
- ECONNRESET : constant := 104; -- Connection reset by peer
- EDESTADDRREQ : constant := 89; -- Destination addr required
- EFAULT : constant := 14; -- Bad address
- EHOSTDOWN : constant := 112; -- Host is down
- EHOSTUNREACH : constant := 113; -- No route to host
- EINPROGRESS : constant := 115; -- Operation now in progress
- EINTR : constant := 4; -- Interrupted system call
- EINVAL : constant := 22; -- Invalid argument
- EIO : constant := 5; -- Input output error
- EISCONN : constant := 106; -- Socket already connected
- ELOOP : constant := 40; -- Too many symbolic links
- EMFILE : constant := 24; -- Too many open files
- EMSGSIZE : constant := 90; -- Message too long
- ENAMETOOLONG : constant := 36; -- Name too long
- ENETDOWN : constant := 100; -- Network is down
- ENETRESET : constant := 102; -- Disconn. on network reset
- ENETUNREACH : constant := 101; -- Network is unreachable
- ENOBUFS : constant := 105; -- No buffer space available
- ENOPROTOOPT : constant := 92; -- Protocol not available
- ENOTCONN : constant := 107; -- Socket not connected
- ENOTSOCK : constant := 88; -- Operation on non socket
- EOPNOTSUPP : constant := 95; -- Operation not supported
- EPFNOSUPPORT : constant := 96; -- Unknown protocol family
- EPROTONOSUPPORT : constant := 93; -- Unknown protocol
- EPROTOTYPE : constant := 91; -- Unknown protocol type
- ESHUTDOWN : constant := 108; -- Cannot send once shutdown
- ESOCKTNOSUPPORT : constant := 94; -- Socket type not supported
- ETIMEDOUT : constant := 110; -- Connection timed out
- ETOOMANYREFS : constant := 109; -- Too many references
- EWOULDBLOCK : constant := 11; -- Operation would block
-
- -----------------
- -- Host errors --
- -----------------
-
- HOST_NOT_FOUND : constant := 1; -- Unknown host
- TRY_AGAIN : constant := 2; -- Host name lookup failure
- NO_DATA : constant := 4; -- No data record for name
- NO_RECOVERY : constant := 3; -- Non recoverable errors
-
- -------------------
- -- Control flags --
- -------------------
-
- FIONBIO : constant := 21537; -- Set/clear non-blocking io
- FIONREAD : constant := 21531; -- How many bytes to read
-
- --------------------
- -- Shutdown modes --
- --------------------
-
- SHUT_RD : constant := 0; -- No more recv
- SHUT_WR : constant := 1; -- No more send
- SHUT_RDWR : constant := 2; -- No more recv/send
-
- ---------------------
- -- Protocol levels --
- ---------------------
-
- SOL_SOCKET : constant := 65535; -- Options for socket level
- IPPROTO_IP : constant := 0; -- Dummy protocol for IP
- IPPROTO_UDP : constant := 17; -- UDP
- IPPROTO_TCP : constant := 6; -- TCP
-
- -------------------
- -- Request flags --
- -------------------
-
- MSG_OOB : constant := 1; -- Process out-of-band data
- MSG_PEEK : constant := 2; -- Peek at incoming data
- MSG_EOR : constant := 128; -- Send end of record
- MSG_WAITALL : constant := 256; -- Wait for full reception
- MSG_NOSIGNAL : constant := -1; -- No SIGPIPE on send
- MSG_Forced_Flags : constant := 0;
- -- Flags set on all send(2) calls
-
- --------------------
- -- Socket options --
- --------------------
-
- TCP_NODELAY : constant := 1; -- Do not coalesce packets
- SO_REUSEADDR : constant := 4; -- Bind reuse local address
- SO_REUSEPORT : constant := 512; -- Bind reuse port number
- SO_KEEPALIVE : constant := 8; -- Enable keep-alive msgs
- SO_LINGER : constant := 128; -- Defer close to flush data
- SO_BROADCAST : constant := 32; -- Can send broadcast msgs
- SO_SNDBUF : constant := 4097; -- Set/get send buffer size
- SO_RCVBUF : constant := 4098; -- Set/get recv buffer size
- SO_SNDTIMEO : constant := 4101; -- Emission timeout
- SO_RCVTIMEO : constant := 4102; -- Reception timeout
- SO_ERROR : constant := 4103; -- Get/clear error status
- IP_MULTICAST_IF : constant := 9; -- Set/get mcast interface
- IP_MULTICAST_TTL : constant := 10; -- Set/get multicast TTL
- IP_MULTICAST_LOOP : constant := 11; -- Set/get mcast loopback
- IP_ADD_MEMBERSHIP : constant := 12; -- Join a multicast group
- IP_DROP_MEMBERSHIP : constant := 13; -- Leave a multicast group
- IP_PKTINFO : constant := -1; -- Get datagram info
-
- -------------------
- -- System limits --
- -------------------
-
- IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt
-
- ----------------------
- -- Type definitions --
- ----------------------
-
- -- Sizes (in bytes) of the components of struct timeval
-
- SIZEOF_tv_sec : constant := 4; -- tv_sec
- SIZEOF_tv_usec : constant := 4; -- tv_usec
-
- -- Sizes of protocol specific address types (for sockaddr.sa_len)
-
- SIZEOF_sockaddr_in : constant := 16; -- struct sockaddr_in
- SIZEOF_sockaddr_in6 : constant := 28; -- struct sockaddr_in6
-
- -- Size of file descriptor sets
-
- SIZEOF_fd_set : constant := 512; -- fd_set
-
- -- Fields of struct hostent
-
- subtype H_Addrtype_T is Interfaces.C.int;
- subtype H_Length_T is Interfaces.C.int;
-
- ----------------------------------------
- -- Properties of supported interfaces --
- ----------------------------------------
-
- Need_Netdb_Buffer : constant := 1; -- Need buffer for Netdb ops
- Has_Sockaddr_Len : constant := 0; -- Sockaddr has sa_len field
-
- Thread_Blocking_IO : constant Boolean := True;
- -- Set False for contexts where socket i/o are process blocking
-
-end GNAT.Sockets.Constants;
diff --git a/gcc/ada/g-soccon-mingw.ads b/gcc/ada/g-soccon-mingw.ads
deleted file mode 100644
index 3bb83e4bebe..00000000000
--- a/gcc/ada/g-soccon-mingw.ads
+++ /dev/null
@@ -1,220 +0,0 @@
-------------------------------------------------------------------------------
--- --
--- GNAT COMPILER COMPONENTS --
--- --
--- G N A T . S O C K E T S . C O N S T A N T S --
--- --
--- S p e c --
--- --
--- Copyright (C) 2000-2008, Free Software Foundation, Inc. --
--- --
--- GNAT is free software; you can redistribute it and/or modify it under --
--- terms of the GNU General Public License as published by the Free Soft- --
--- ware Foundation; either version 2, or (at your option) any later ver- --
--- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
--- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
--- for more details. You should have received a copy of the GNU General --
--- Public License distributed with GNAT; see file COPYING. If not, write --
--- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
--- Boston, MA 02110-1301, USA. --
--- --
--- As a special exception, if other files instantiate generics from this --
--- unit, or you link this unit with other files to produce an executable, --
--- this unit does not by itself cause the resulting executable to be --
--- covered by the GNU General Public License. This exception does not --
--- however invalidate any other reasons why the executable file might be --
--- covered by the GNU Public License. --
--- --
--- GNAT was originally developed by the GNAT team at New York University. --
--- Extensive contributions were provided by Ada Core Technologies Inc. --
--- --
-------------------------------------------------------------------------------
-
--- This package provides target dependent definitions of constant for use
--- by the GNAT.Sockets package (g-socket.ads). This package should not be
--- directly with'ed by an applications program.
-
--- This is the version for pentium-mingw32msv
--- This file is generated automatically, do not modify it by hand! Instead,
--- make changes to gen-soccon.c and re-run it on each target.
-
-with Interfaces.C;
-package GNAT.Sockets.Constants is
-
- --------------
- -- Families --
- --------------
-
- AF_INET : constant := 2; -- IPv4 address family
- AF_INET6 : constant := 23; -- IPv6 address family
-
- -----------
- -- Modes --
- -----------
-
- SOCK_STREAM : constant := 1; -- Stream socket
- SOCK_DGRAM : constant := 2; -- Datagram socket
-
- -------------------
- -- Socket errors --
- -------------------
-
- EACCES : constant := 10013; -- Permission denied
- EADDRINUSE : constant := 10048; -- Address already in use
- EADDRNOTAVAIL : constant := 10049; -- Cannot assign address
- EAFNOSUPPORT : constant := 10047; -- Addr family not supported
- EALREADY : constant := 10037; -- Operation in progress
- EBADF : constant := 10009; -- Bad file descriptor
- ECONNABORTED : constant := 10053; -- Connection aborted
- ECONNREFUSED : constant := 10061; -- Connection refused
- ECONNRESET : constant := 10054; -- Connection reset by peer
- EDESTADDRREQ : constant := 10039; -- Destination addr required
- EFAULT : constant := 10014; -- Bad address
- EHOSTDOWN : constant := 10064; -- Host is down
- EHOSTUNREACH : constant := 10065; -- No route to host
- EINPROGRESS : constant := 10036; -- Operation now in progress
- EINTR : constant := 10004; -- Interrupted system call
- EINVAL : constant := 10022; -- Invalid argument
- EIO : constant := 10101; -- Input output error
- EISCONN : constant := 10056; -- Socket already connected
- ELOOP : constant := 10062; -- Too many symbolic links
- EMFILE : constant := 10024; -- Too many open files
- EMSGSIZE : constant := 10040; -- Message too long
- ENAMETOOLONG : constant := 10063; -- Name too long
- ENETDOWN : constant := 10050; -- Network is down
- ENETRESET : constant := 10052; -- Disconn. on network reset
- ENETUNREACH : constant := 10051; -- Network is unreachable
- ENOBUFS : constant := 10055; -- No buffer space available
- ENOPROTOOPT : constant := 10042; -- Protocol not available
- ENOTCONN : constant := 10057; -- Socket not connected
- ENOTSOCK : constant := 10038; -- Operation on non socket
- EOPNOTSUPP : constant := 10045; -- Operation not supported
- EPFNOSUPPORT : constant := 10046; -- Unknown protocol family
- EPROTONOSUPPORT : constant := 10043; -- Unknown protocol
- EPROTOTYPE : constant := 10041; -- Unknown protocol type
- ESHUTDOWN : constant := 10058; -- Cannot send once shutdown
- ESOCKTNOSUPPORT : constant := 10044; -- Socket type not supported
- ETIMEDOUT : constant := 10060; -- Connection timed out
- ETOOMANYREFS : constant := 10059; -- Too many references
- EWOULDBLOCK : constant := 10035; -- Operation would block
-
- -----------------
- -- Host errors --
- -----------------
-
- HOST_NOT_FOUND : constant := 11001; -- Unknown host
- TRY_AGAIN : constant := 11002; -- Host name lookup failure
- NO_DATA : constant := 11004; -- No data record for name
- NO_RECOVERY : constant := 11003; -- Non recoverable errors
-
- -------------------
- -- Control flags --
- -------------------
-
- FIONBIO : constant := -2147195266; -- Set/clear non-blocking io
- FIONREAD : constant := 1074030207; -- How many bytes to read
-
- --------------------
- -- Shutdown modes --
- --------------------
-
- SHUT_RD : constant := 0; -- No more recv
- SHUT_WR : constant := 1; -- No more send
- SHUT_RDWR : constant := 2; -- No more recv/send
-
- ---------------------
- -- Protocol levels --
- ---------------------
-
- SOL_SOCKET : constant := 65535; -- Options for socket level
- IPPROTO_IP : constant := 0; -- Dummy protocol for IP
- IPPROTO_UDP : constant := 17; -- UDP
- IPPROTO_TCP : constant := 6; -- TCP
-
- -------------------
- -- Request flags --
- -------------------
-
- MSG_OOB : constant := 1; -- Process out-of-band data
- MSG_PEEK : constant := 2; -- Peek at incoming data
- MSG_EOR : constant := -1; -- Send end of record
- MSG_WAITALL : constant := -1; -- Wait for full reception
- MSG_NOSIGNAL : constant := -1; -- No SIGPIPE on send
- MSG_Forced_Flags : constant := 0;
- -- Flags set on all send(2) calls
-
- --------------------
- -- Socket options --
- --------------------
-
- TCP_NODELAY : constant := 1; -- Do not coalesce packets
- SO_REUSEADDR : constant := 4; -- Bind reuse local address
- SO_REUSEPORT : constant := -1; -- Bind reuse port number
- SO_KEEPALIVE : constant := 8; -- Enable keep-alive msgs
- SO_LINGER : constant := 128; -- Defer close to flush data
- SO_BROADCAST : constant := 32; -- Can send broadcast msgs
- SO_SNDBUF : constant := 4097; -- Set/get send buffer size
- SO_RCVBUF : constant := 4098; -- Set/get recv buffer size
- SO_SNDTIMEO : constant := 4101; -- Emission timeout
- SO_RCVTIMEO : constant := 4102; -- Reception timeout
- SO_ERROR : constant := 4103; -- Get/clear error status
- IP_MULTICAST_IF : constant := 9; -- Set/get mcast interface
- IP_MULTICAST_TTL : constant := 10; -- Set/get multicast TTL
- IP_MULTICAST_LOOP : constant := 11; -- Set/get mcast loopback
- IP_ADD_MEMBERSHIP : constant := 12; -- Join a multicast group
- IP_DROP_MEMBERSHIP : constant := 13; -- Leave a multicast group
- IP_PKTINFO : constant := 19; -- Get datagram info
-
- -------------------
- -- System limits --
- -------------------
-
- IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt
-
- ----------------------
- -- Type definitions --
- ----------------------
-
- -- Sizes (in bytes) of the components of struct timeval
-
- SIZEOF_tv_sec : constant := 4; -- tv_sec
- SIZEOF_tv_usec : constant := 4; -- tv_usec
-
- -- Sizes of protocol specific address types (for sockaddr.sa_len)
-
- SIZEOF_sockaddr_in : constant := 16; -- struct sockaddr_in
- SIZEOF_sockaddr_in6 : constant := 28; -- struct sockaddr_in6
-
- -- Size of file descriptor sets
-
- SIZEOF_fd_set : constant := 4100; -- fd_set
-
- -- Fields of struct hostent
-
- subtype H_Addrtype_T is Interfaces.C.short;
- subtype H_Length_T is Interfaces.C.short;
-
- ----------------------------------------
- -- Properties of supported interfaces --
- ----------------------------------------
-
- Need_Netdb_Buffer : constant := 0; -- Need buffer for Netdb ops
- Has_Sockaddr_Len : constant := 0; -- Sockaddr has sa_len field
-
- Thread_Blocking_IO : constant Boolean := True;
- -- Set False for contexts where socket i/o are process blocking
-
- ------------------------------
- -- MinGW-specific constants --
- ------------------------------
-
- -- These constants may be used only within the MinGW version of
- -- GNAT.Sockets.Thin.
-
- WSASYSNOTREADY : constant := 10091; -- System not ready
- WSAVERNOTSUPPORTED : constant := 10092; -- Version not supported
- WSANOTINITIALISED : constant := 10093; -- Winsock not initialized
- WSAEDISCON : constant := 10101; -- Disconnected
-
-end GNAT.Sockets.Constants;
diff --git a/gcc/ada/g-soccon-rtems.ads b/gcc/ada/g-soccon-rtems.ads
deleted file mode 100644
index a404eec9b33..00000000000
--- a/gcc/ada/g-soccon-rtems.ads
+++ /dev/null
@@ -1,196 +0,0 @@
-------------------------------------------------------------------------------
--- --
--- GNAT COMPILER COMPONENTS --
--- --
--- G N A T . S O C K E T S . C O N S T A N T S --
--- --
--- S p e c --
--- --
--- Copyright (C) 2000-2008, Free Software Foundation, Inc. --
--- --
--- GNAT is free software; you can redistribute it and/or modify it under --
--- terms of the GNU General Public License as published by the Free Soft- --
--- ware Foundation; either version 2, or (at your option) any later ver- --
--- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
--- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
--- for more details. You should have received a copy of the GNU General --
--- Public License distributed with GNAT; see file COPYING. If not, write --
--- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
--- Boston, MA 02110-1301, USA. --
--- --
--- As a special exception, if other files instantiate generics from this --
--- unit, or you link this unit with other files to produce an executable, --
--- this unit does not by itself cause the resulting executable to be --
--- covered by the GNU General Public License. This exception does not --
--- however invalidate any other reasons why the executable file might be --
--- covered by the GNU Public License. --
--- --
--- GNAT was originally developed by the GNAT team at New York University. --
--- Extensive contributions were provided by Ada Core Technologies Inc. --
--- --
-------------------------------------------------------------------------------
-
--- This package provides target dependent definitions of constant for use
--- by the GNAT.Sockets package (g-socket.ads). This package should not be
--- directly with'ed by an applications program.
-
--- This is the version for RTEMS
--- This file is generated automatically, do not modify it by hand! Instead,
--- make changes to gen-soccon.c and re-run it on each target.
-
-package GNAT.Sockets.Constants is
-
- --------------
- -- Families --
- --------------
-
- AF_INET : constant := 2; -- IPv4 address family
- AF_INET6 : constant := 28; -- IPv6 address family
-
- -----------
- -- Modes --
- -----------
-
- SOCK_STREAM : constant := 1; -- Stream socket
- SOCK_DGRAM : constant := 2; -- Datagram socket
-
- -------------------
- -- Socket errors --
- -------------------
-
- EACCES : constant := 13; -- Permission denied
- EADDRINUSE : constant := 112; -- Address already in use
- EADDRNOTAVAIL : constant := 125; -- Cannot assign address
- EAFNOSUPPORT : constant := 106; -- Addr family not supported
- EALREADY : constant := 120; -- Operation in progress
- EBADF : constant := 9; -- Bad file descriptor
- ECONNABORTED : constant := 113; -- Connection aborted
- ECONNREFUSED : constant := 111; -- Connection refused
- ECONNRESET : constant := 104; -- Connection reset by peer
- EDESTADDRREQ : constant := 121; -- Destination addr required
- EFAULT : constant := 14; -- Bad address
- EHOSTDOWN : constant := 117; -- Host is down
- EHOSTUNREACH : constant := 118; -- No route to host
- EINPROGRESS : constant := 119; -- Operation now in progress
- EINTR : constant := 4; -- Interrupted system call
- EINVAL : constant := 22; -- Invalid argument
- EIO : constant := 5; -- Input output error
- EISCONN : constant := 127; -- Socket already connected
- ELOOP : constant := 92; -- Too many symbolic links
- EMFILE : constant := 24; -- Too many open files
- EMSGSIZE : constant := 122; -- Message too long
- ENAMETOOLONG : constant := 91; -- Name too long
- ENETDOWN : constant := 115; -- Network is down
- ENETRESET : constant := 126; -- Disconn. on network reset
- ENETUNREACH : constant := 114; -- Network is unreachable
- ENOBUFS : constant := 105; -- No buffer space available
- ENOPROTOOPT : constant := 109; -- Protocol not available
- ENOTCONN : constant := 128; -- Socket not connected
- ENOTSOCK : constant := 108; -- Operation on non socket
- EOPNOTSUPP : constant := 95; -- Operation not supported
- EPFNOSUPPORT : constant := 96; -- Unknown protocol family
- EPROTONOSUPPORT : constant := 123; -- Unknown protocol
- EPROTOTYPE : constant := 107; -- Unknown protocol type
- ESHUTDOWN : constant := 110; -- Cannot send once shutdown
- ESOCKTNOSUPPORT : constant := 124; -- Socket type not supported
- ETIMEDOUT : constant := 116; -- Connection timed out
- ETOOMANYREFS : constant := 129; -- Too many references
- EWOULDBLOCK : constant := 11; -- Operation would block
-
- -----------------
- -- Host errors --
- -----------------
-
- HOST_NOT_FOUND : constant := 1; -- Unknown host
- TRY_AGAIN : constant := 2; -- Host name lookup failure
- NO_DATA : constant := 4; -- No data record for name
- NO_RECOVERY : constant := 3; -- Non recoverable errors
-
- -------------------
- -- Control flags --
- -------------------
-
- FIONBIO : constant := -2147195266; -- Set/clear non-blocking io
- FIONREAD : constant := 1074030207; -- How many bytes to read
-
- --------------------
- -- Shutdown modes --
- --------------------
-
- SHUT_RD : constant := 0; -- No more recv
- SHUT_WR : constant := 1; -- No more send
- SHUT_RDWR : constant := 2; -- No more recv/send
-
- ---------------------
- -- Protocol levels --
- ---------------------
-
- SOL_SOCKET : constant := 65535; -- Options for socket level
- IPPROTO_IP : constant := 0; -- Dummy protocol for IP
- IPPROTO_UDP : constant := 17; -- UDP
- IPPROTO_TCP : constant := 6; -- TCP
-
- -------------------
- -- Request flags --
- -------------------
-
- MSG_OOB : constant := 1; -- Process out-of-band data
- MSG_PEEK : constant := 2; -- Peek at incoming data
- MSG_EOR : constant := 8; -- Send end of record
- MSG_WAITALL : constant := 64; -- Wait for full reception
- MSG_NOSIGNAL : constant := -1; -- No SIGPIPE on send
- MSG_Forced_Flags : constant := 0;
- -- Flags set on all send(2) calls
-
- --------------------
- -- Socket options --
- --------------------
-
- TCP_NODELAY : constant := 1; -- Do not coalesce packets
- SO_REUSEADDR : constant := 4; -- Bind reuse local address
- SO_REUSEPORT : constant := -1; -- Bind reuse port number
- SO_KEEPALIVE : constant := 8; -- Enable keep-alive msgs
- SO_LINGER : constant := 128; -- Defer close to flush data
- SO_BROADCAST : constant := 32; -- Can send broadcast msgs
- SO_SNDBUF : constant := 4097; -- Set/get send buffer size
- SO_RCVBUF : constant := 4098; -- Set/get recv buffer size
- SO_SNDTIMEO : constant := 4101; -- Emission timeout
- SO_RCVTIMEO : constant := 4102; -- Reception timeout
- SO_ERROR : constant := 4103; -- Get/clear error status
- IP_MULTICAST_IF : constant := 9; -- Set/get mcast interface
- IP_MULTICAST_TTL : constant := 10; -- Set/get multicast TTL
- IP_MULTICAST_LOOP : constant := 11; -- Set/get mcast loopback
- IP_ADD_MEMBERSHIP : constant := 12; -- Join a multicast group
- IP_DROP_MEMBERSHIP : constant := 13; -- Leave a multicast group
- IP_PKTINFO : constant := -1; -- Get datagram info
-
- -------------------
- -- System limits --
- -------------------
-
- IOV_MAX : constant := 1024; -- Maximum writev iovcnt
-
- ----------------------
- -- Type definitions --
- ----------------------
-
- -- Sizes (in bytes) of the components of struct timeval
-
- SIZEOF_tv_sec : constant := 4; -- tv_sec
- SIZEOF_tv_usec : constant := 4; -- tv_usec
-
- ----------------------------------------
- -- Properties of supported interfaces --
- ----------------------------------------
-
- Need_Netdb_Buffer : constant := 1; -- Need buffer for Netdb ops
-
- ----------------------
- -- Additional flags --
- ----------------------
-
- Thread_Blocking_IO : constant Boolean := True;
- -- Set False for contexts where socket i/o are process blocking
-
-end GNAT.Sockets.Constants;
diff --git a/gcc/ada/g-soccon-solaris-64.ads b/gcc/ada/g-soccon-solaris-64.ads
deleted file mode 100644
index 2d5f2d98aff..00000000000
--- a/gcc/ada/g-soccon-solaris-64.ads
+++ /dev/null
@@ -1,208 +0,0 @@
-------------------------------------------------------------------------------
--- --
--- GNAT COMPILER COMPONENTS --
--- --
--- G N A T . S O C K E T S . C O N S T A N T S --
--- --
--- S p e c --
--- --
--- Copyright (C) 2000-2008, Free Software Foundation, Inc. --
--- --
--- GNAT is free software; you can redistribute it and/or modify it under --
--- terms of the GNU General Public License as published by the Free Soft- --
--- ware Foundation; either version 2, or (at your option) any later ver- --
--- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
--- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
--- for more details. You should have received a copy of the GNU General --
--- Public License distributed with GNAT; see file COPYING. If not, write --
--- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
--- Boston, MA 02110-1301, USA. --
--- --
--- As a special exception, if other files instantiate generics from this --
--- unit, or you link this unit with other files to produce an executable, --
--- this unit does not by itself cause the resulting executable to be --
--- covered by the GNU General Public License. This exception does not --
--- however invalidate any other reasons why the executable file might be --
--- covered by the GNU Public License. --
--- --
--- GNAT was originally developed by the GNAT team at New York University. --
--- Extensive contributions were provided by Ada Core Technologies Inc. --
--- --
-------------------------------------------------------------------------------
-
--- This package provides target dependent definitions of constant for use
--- by the GNAT.Sockets package (g-socket.ads). This package should not be
--- directly with'ed by an applications program.
-
--- This is the version for sparc-sun-solaris2.8
--- This file is generated automatically, do not modify it by hand! Instead,
--- make changes to gen-soccon.c and re-run it on each target.
-
-with Interfaces.C;
-package GNAT.Sockets.Constants is
-
- --------------
- -- Families --
- --------------
-
- AF_INET : constant := 2; -- IPv4 address family
- AF_INET6 : constant := 26; -- IPv6 address family
-
- -----------
- -- Modes --
- -----------
-
- SOCK_STREAM : constant := 2; -- Stream socket
- SOCK_DGRAM : constant := 1; -- Datagram socket
-
- -------------------
- -- Socket errors --
- -------------------
-
- EACCES : constant := 13; -- Permission denied
- EADDRINUSE : constant := 125; -- Address already in use
- EADDRNOTAVAIL : constant := 126; -- Cannot assign address
- EAFNOSUPPORT : constant := 124; -- Addr family not supported
- EALREADY : constant := 149; -- Operation in progress
- EBADF : constant := 9; -- Bad file descriptor
- ECONNABORTED : constant := 130; -- Connection aborted
- ECONNREFUSED : constant := 146; -- Connection refused
- ECONNRESET : constant := 131; -- Connection reset by peer
- EDESTADDRREQ : constant := 96; -- Destination addr required
- EFAULT : constant := 14; -- Bad address
- EHOSTDOWN : constant := 147; -- Host is down
- EHOSTUNREACH : constant := 148; -- No route to host
- EINPROGRESS : constant := 150; -- Operation now in progress
- EINTR : constant := 4; -- Interrupted system call
- EINVAL : constant := 22; -- Invalid argument
- EIO : constant := 5; -- Input output error
- EISCONN : constant := 133; -- Socket already connected
- ELOOP : constant := 90; -- Too many symbolic links
- EMFILE : constant := 24; -- Too many open files
- EMSGSIZE : constant := 97; -- Message too long
- ENAMETOOLONG : constant := 78; -- Name too long
- ENETDOWN : constant := 127; -- Network is down
- ENETRESET : constant := 129; -- Disconn. on network reset
- ENETUNREACH : constant := 128; -- Network is unreachable
- ENOBUFS : constant := 132; -- No buffer space available
- ENOPROTOOPT : constant := 99; -- Protocol not available
- ENOTCONN : constant := 134; -- Socket not connected
- ENOTSOCK : constant := 95; -- Operation on non socket
- EOPNOTSUPP : constant := 122; -- Operation not supported
- EPFNOSUPPORT : constant := 123; -- Unknown protocol family
- EPROTONOSUPPORT : constant := 120; -- Unknown protocol
- EPROTOTYPE : constant := 98; -- Unknown protocol type
- ESHUTDOWN : constant := 143; -- Cannot send once shutdown
- ESOCKTNOSUPPORT : constant := 121; -- Socket type not supported
- ETIMEDOUT : constant := 145; -- Connection timed out
- ETOOMANYREFS : constant := 144; -- Too many references
- EWOULDBLOCK : constant := 11; -- Operation would block
-
- -----------------
- -- Host errors --
- -----------------
-
- HOST_NOT_FOUND : constant := 1; -- Unknown host
- TRY_AGAIN : constant := 2; -- Host name lookup failure
- NO_DATA : constant := 4; -- No data record for name
- NO_RECOVERY : constant := 3; -- Non recoverable errors
-
- -------------------
- -- Control flags --
- -------------------
-
- FIONBIO : constant := -2147195266; -- Set/clear non-blocking io
- FIONREAD : constant := 1074030207; -- How many bytes to read
-
- --------------------
- -- Shutdown modes --
- --------------------
-
- SHUT_RD : constant := 0; -- No more recv
- SHUT_WR : constant := 1; -- No more send
- SHUT_RDWR : constant := 2; -- No more recv/send
-
- ---------------------
- -- Protocol levels --
- ---------------------
-
- SOL_SOCKET : constant := 65535; -- Options for socket level
- IPPROTO_IP : constant := 0; -- Dummy protocol for IP
- IPPROTO_UDP : constant := 17; -- UDP
- IPPROTO_TCP : constant := 6; -- TCP
-
- -------------------
- -- Request flags --
- -------------------
-
- MSG_OOB : constant := 1; -- Process out-of-band data
- MSG_PEEK : constant := 2; -- Peek at incoming data
- MSG_EOR : constant := 8; -- Send end of record
- MSG_WAITALL : constant := 64; -- Wait for full reception
- MSG_NOSIGNAL : constant := -1; -- No SIGPIPE on send
- MSG_Forced_Flags : constant := 0;
- -- Flags set on all send(2) calls
-
- --------------------
- -- Socket options --
- --------------------
-
- TCP_NODELAY : constant := 1; -- Do not coalesce packets
- SO_REUSEADDR : constant := 4; -- Bind reuse local address
- SO_REUSEPORT : constant := -1; -- Bind reuse port number
- SO_KEEPALIVE : constant := 8; -- Enable keep-alive msgs
- SO_LINGER : constant := 128; -- Defer close to flush data
- SO_BROADCAST : constant := 32; -- Can send broadcast msgs
- SO_SNDBUF : constant := 4097; -- Set/get send buffer size
- SO_RCVBUF : constant := 4098; -- Set/get recv buffer size
- SO_SNDTIMEO : constant := 4101; -- Emission timeout
- SO_RCVTIMEO : constant := 4102; -- Reception timeout
- SO_ERROR : constant := 4103; -- Get/clear error status
- IP_MULTICAST_IF : constant := 16; -- Set/get mcast interface
- IP_MULTICAST_TTL : constant := 17; -- Set/get multicast TTL
- IP_MULTICAST_LOOP : constant := 18; -- Set/get mcast loopback
- IP_ADD_MEMBERSHIP : constant := 19; -- Join a multicast group
- IP_DROP_MEMBERSHIP : constant := 20; -- Leave a multicast group
- IP_PKTINFO : constant := -1; -- Get datagram info
-
- -------------------
- -- System limits --
- -------------------
-
- IOV_MAX : constant := 16; -- Maximum writev iovcnt
-
- ----------------------
- -- Type definitions --
- ----------------------
-
- -- Sizes (in bytes) of the components of struct timeval
-
- SIZEOF_tv_sec : constant := 4; -- tv_sec
- SIZEOF_tv_usec : constant := 4; -- tv_usec
-
- -- Sizes of protocol specific address types (for sockaddr.sa_len)
-
- SIZEOF_sockaddr_in : constant := 16; -- struct sockaddr_in
- SIZEOF_sockaddr_in6 : constant := 32; -- struct sockaddr_in6
-
- -- Size of file descriptor sets
-
- SIZEOF_fd_set : constant := 128; -- fd_set
-
- -- Fields of struct hostent
-
- subtype H_Addrtype_T is Interfaces.C.int;
- subtype H_Length_T is Interfaces.C.int;
-
- ----------------------------------------
- -- Properties of supported interfaces --
- ----------------------------------------
-
- Need_Netdb_Buffer : constant := 1; -- Need buffer for Netdb ops
- Has_Sockaddr_Len : constant := 0; -- Sockaddr has sa_len field
-
- Thread_Blocking_IO : constant Boolean := True;
- -- Set False for contexts where socket i/o are process blocking
-
-end GNAT.Sockets.Constants;
diff --git a/gcc/ada/g-soccon-solaris.ads b/gcc/ada/g-soccon-solaris.ads
deleted file mode 100644
index 2d5f2d98aff..00000000000
--- a/gcc/ada/g-soccon-solaris.ads
+++ /dev/null
@@ -1,208 +0,0 @@
-------------------------------------------------------------------------------
--- --
--- GNAT COMPILER COMPONENTS --
--- --
--- G N A T . S O C K E T S . C O N S T A N T S --
--- --
--- S p e c --
--- --
--- Copyright (C) 2000-2008, Free Software Foundation, Inc. --
--- --
--- GNAT is free software; you can redistribute it and/or modify it under --
--- terms of the GNU General Public License as published by the Free Soft- --
--- ware Foundation; either version 2, or (at your option) any later ver- --
--- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
--- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
--- for more details. You should have received a copy of the GNU General --
--- Public License distributed with GNAT; see file COPYING. If not, write --
--- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
--- Boston, MA 02110-1301, USA. --
--- --
--- As a special exception, if other files instantiate generics from this --
--- unit, or you link this unit with other files to produce an executable, --
--- this unit does not by itself cause the resulting executable to be --
--- covered by the GNU General Public License. This exception does not --
--- however invalidate any other reasons why the executable file might be --
--- covered by the GNU Public License. --
--- --
--- GNAT was originally developed by the GNAT team at New York University. --
--- Extensive contributions were provided by Ada Core Technologies Inc. --
--- --
-------------------------------------------------------------------------------
-
--- This package provides target dependent definitions of constant for use
--- by the GNAT.Sockets package (g-socket.ads). This package should not be
--- directly with'ed by an applications program.
-
--- This is the version for sparc-sun-solaris2.8
--- This file is generated automatically, do not modify it by hand! Instead,
--- make changes to gen-soccon.c and re-run it on each target.
-
-with Interfaces.C;
-package GNAT.Sockets.Constants is
-
- --------------
- -- Families --
- --------------
-
- AF_INET : constant := 2; -- IPv4 address family
- AF_INET6 : constant := 26; -- IPv6 address family
-
- -----------
- -- Modes --
- -----------
-
- SOCK_STREAM : constant := 2; -- Stream socket
- SOCK_DGRAM : constant := 1; -- Datagram socket
-
- -------------------
- -- Socket errors --
- -------------------
-
- EACCES : constant := 13; -- Permission denied
- EADDRINUSE : constant := 125; -- Address already in use
- EADDRNOTAVAIL : constant := 126; -- Cannot assign address
- EAFNOSUPPORT : constant := 124; -- Addr family not supported
- EALREADY : constant := 149; -- Operation in progress
- EBADF : constant := 9; -- Bad file descriptor
- ECONNABORTED : constant := 130; -- Connection aborted
- ECONNREFUSED : constant := 146; -- Connection refused
- ECONNRESET : constant := 131; -- Connection reset by peer
- EDESTADDRREQ : constant := 96; -- Destination addr required
- EFAULT : constant := 14; -- Bad address
- EHOSTDOWN : constant := 147; -- Host is down
- EHOSTUNREACH : constant := 148; -- No route to host
- EINPROGRESS : constant := 150; -- Operation now in progress
- EINTR : constant := 4; -- Interrupted system call
- EINVAL : constant := 22; -- Invalid argument
- EIO : constant := 5; -- Input output error
- EISCONN : constant := 133; -- Socket already connected
- ELOOP : constant := 90; -- Too many symbolic links
- EMFILE : constant := 24; -- Too many open files
- EMSGSIZE : constant := 97; -- Message too long
- ENAMETOOLONG : constant := 78; -- Name too long
- ENETDOWN : constant := 127; -- Network is down
- ENETRESET : constant := 129; -- Disconn. on network reset
- ENETUNREACH : constant := 128; -- Network is unreachable
- ENOBUFS : constant := 132; -- No buffer space available
- ENOPROTOOPT : constant := 99; -- Protocol not available
- ENOTCONN : constant := 134; -- Socket not connected
- ENOTSOCK : constant := 95; -- Operation on non socket
- EOPNOTSUPP : constant := 122; -- Operation not supported
- EPFNOSUPPORT : constant := 123; -- Unknown protocol family
- EPROTONOSUPPORT : constant := 120; -- Unknown protocol
- EPROTOTYPE : constant := 98; -- Unknown protocol type
- ESHUTDOWN : constant := 143; -- Cannot send once shutdown
- ESOCKTNOSUPPORT : constant := 121; -- Socket type not supported
- ETIMEDOUT : constant := 145; -- Connection timed out
- ETOOMANYREFS : constant := 144; -- Too many references
- EWOULDBLOCK : constant := 11; -- Operation would block
-
- -----------------
- -- Host errors --
- -----------------
-
- HOST_NOT_FOUND : constant := 1; -- Unknown host
- TRY_AGAIN : constant := 2; -- Host name lookup failure
- NO_DATA : constant := 4; -- No data record for name
- NO_RECOVERY : constant := 3; -- Non recoverable errors
-
- -------------------
- -- Control flags --
- -------------------
-
- FIONBIO : constant := -2147195266; -- Set/clear non-blocking io
- FIONREAD : constant := 1074030207; -- How many bytes to read
-
- --------------------
- -- Shutdown modes --
- --------------------
-
- SHUT_RD : constant := 0; -- No more recv
- SHUT_WR : constant := 1; -- No more send
- SHUT_RDWR : constant := 2; -- No more recv/send
-
- ---------------------
- -- Protocol levels --
- ---------------------
-
- SOL_SOCKET : constant := 65535; -- Options for socket level
- IPPROTO_IP : constant := 0; -- Dummy protocol for IP
- IPPROTO_UDP : constant := 17; -- UDP
- IPPROTO_TCP : constant := 6; -- TCP
-
- -------------------
- -- Request flags --
- -------------------
-
- MSG_OOB : constant := 1; -- Process out-of-band data
- MSG_PEEK : constant := 2; -- Peek at incoming data
- MSG_EOR : constant := 8; -- Send end of record
- MSG_WAITALL : constant := 64; -- Wait for full reception
- MSG_NOSIGNAL : constant := -1; -- No SIGPIPE on send
- MSG_Forced_Flags : constant := 0;
- -- Flags set on all send(2) calls
-
- --------------------
- -- Socket options --
- --------------------
-
- TCP_NODELAY : constant := 1; -- Do not coalesce packets
- SO_REUSEADDR : constant := 4; -- Bind reuse local address
- SO_REUSEPORT : constant := -1; -- Bind reuse port number
- SO_KEEPALIVE : constant := 8; -- Enable keep-alive msgs
- SO_LINGER : constant := 128; -- Defer close to flush data
- SO_BROADCAST : constant := 32; -- Can send broadcast msgs
- SO_SNDBUF : constant := 4097; -- Set/get send buffer size
- SO_RCVBUF : constant := 4098; -- Set/get recv buffer size
- SO_SNDTIMEO : constant := 4101; -- Emission timeout
- SO_RCVTIMEO : constant := 4102; -- Reception timeout
- SO_ERROR : constant := 4103; -- Get/clear error status
- IP_MULTICAST_IF : constant := 16; -- Set/get mcast interface
- IP_MULTICAST_TTL : constant := 17; -- Set/get multicast TTL
- IP_MULTICAST_LOOP : constant := 18; -- Set/get mcast loopback
- IP_ADD_MEMBERSHIP : constant := 19; -- Join a multicast group
- IP_DROP_MEMBERSHIP : constant := 20; -- Leave a multicast group
- IP_PKTINFO : constant := -1; -- Get datagram info
-
- -------------------
- -- System limits --
- -------------------
-
- IOV_MAX : constant := 16; -- Maximum writev iovcnt
-
- ----------------------
- -- Type definitions --
- ----------------------
-
- -- Sizes (in bytes) of the components of struct timeval
-
- SIZEOF_tv_sec : constant := 4; -- tv_sec
- SIZEOF_tv_usec : constant := 4; -- tv_usec
-
- -- Sizes of protocol specific address types (for sockaddr.sa_len)
-
- SIZEOF_sockaddr_in : constant := 16; -- struct sockaddr_in
- SIZEOF_sockaddr_in6 : constant := 32; -- struct sockaddr_in6
-
- -- Size of file descriptor sets
-
- SIZEOF_fd_set : constant := 128; -- fd_set
-
- -- Fields of struct hostent
-
- subtype H_Addrtype_T is Interfaces.C.int;
- subtype H_Length_T is Interfaces.C.int;
-
- ----------------------------------------
- -- Properties of supported interfaces --
- ----------------------------------------
-
- Need_Netdb_Buffer : constant := 1; -- Need buffer for Netdb ops
- Has_Sockaddr_Len : constant := 0; -- Sockaddr has sa_len field
-
- Thread_Blocking_IO : constant Boolean := True;
- -- Set False for contexts where socket i/o are process blocking
-
-end GNAT.Sockets.Constants;
diff --git a/gcc/ada/g-soccon-tru64.ads b/gcc/ada/g-soccon-tru64.ads
deleted file mode 100644
index a14e6106d4a..00000000000
--- a/gcc/ada/g-soccon-tru64.ads
+++ /dev/null
@@ -1,208 +0,0 @@
-------------------------------------------------------------------------------
--- --
--- GNAT COMPILER COMPONENTS --
--- --
--- G N A T . S O C K E T S . C O N S T A N T S --
--- --
--- S p e c --
--- --
--- Copyright (C) 2000-2008, Free Software Foundation, Inc. --
--- --
--- GNAT is free software; you can redistribute it and/or modify it under --
--- terms of the GNU General Public License as published by the Free Soft- --
--- ware Foundation; either version 2, or (at your option) any later ver- --
--- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
--- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
--- for more details. You should have received a copy of the GNU General --
--- Public License distributed with GNAT; see file COPYING. If not, write --
--- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
--- Boston, MA 02110-1301, USA. --
--- --
--- As a special exception, if other files instantiate generics from this --
--- unit, or you link this unit with other files to produce an executable, --
--- this unit does not by itself cause the resulting executable to be --
--- covered by the GNU General Public License. This exception does not --
--- however invalidate any other reasons why the executable file might be --
--- covered by the GNU Public License. --
--- --
--- GNAT was originally developed by the GNAT team at New York University. --
--- Extensive contributions were provided by Ada Core Technologies Inc. --
--- --
-------------------------------------------------------------------------------
-
--- This package provides target dependent definitions of constant for use
--- by the GNAT.Sockets package (g-socket.ads). This package should not be
--- directly with'ed by an applications program.
-
--- This is the version for alphaev56-dec-osf5.1
--- This file is generated automatically, do not modify it by hand! Instead,
--- make changes to gen-soccon.c and re-run it on each target.
-
-with Interfaces.C;
-package GNAT.Sockets.Constants is
-
- --------------
- -- Families --
- --------------
-
- AF_INET : constant := 2; -- IPv4 address family
- AF_INET6 : constant := 26; -- IPv6 address family
-
- -----------
- -- Modes --
- -----------
-
- SOCK_STREAM : constant := 1; -- Stream socket
- SOCK_DGRAM : constant := 2; -- Datagram socket
-
- -------------------
- -- Socket errors --
- -------------------
-
- EACCES : constant := 13; -- Permission denied
- EADDRINUSE : constant := 48; -- Address already in use
- EADDRNOTAVAIL : constant := 49; -- Cannot assign address
- EAFNOSUPPORT : constant := 47; -- Addr family not supported
- EALREADY : constant := 37; -- Operation in progress
- EBADF : constant := 9; -- Bad file descriptor
- ECONNABORTED : constant := 53; -- Connection aborted
- ECONNREFUSED : constant := 61; -- Connection refused
- ECONNRESET : constant := 54; -- Connection reset by peer
- EDESTADDRREQ : constant := 39; -- Destination addr required
- EFAULT : constant := 14; -- Bad address
- EHOSTDOWN : constant := 64; -- Host is down
- EHOSTUNREACH : constant := 65; -- No route to host
- EINPROGRESS : constant := 36; -- Operation now in progress
- EINTR : constant := 4; -- Interrupted system call
- EINVAL : constant := 22; -- Invalid argument
- EIO : constant := 5; -- Input output error
- EISCONN : constant := 56; -- Socket already connected
- ELOOP : constant := 62; -- Too many symbolic links
- EMFILE : constant := 24; -- Too many open files
- EMSGSIZE : constant := 40; -- Message too long
- ENAMETOOLONG : constant := 63; -- Name too long
- ENETDOWN : constant := 50; -- Network is down
- ENETRESET : constant := 52; -- Disconn. on network reset
- ENETUNREACH : constant := 51; -- Network is unreachable
- ENOBUFS : constant := 55; -- No buffer space available
- ENOPROTOOPT : constant := 42; -- Protocol not available
- ENOTCONN : constant := 57; -- Socket not connected
- ENOTSOCK : constant := 38; -- Operation on non socket
- EOPNOTSUPP : constant := 45; -- Operation not supported
- EPFNOSUPPORT : constant := 46; -- Unknown protocol family
- EPROTONOSUPPORT : constant := 43; -- Unknown protocol
- EPROTOTYPE : constant := 41; -- Unknown protocol type
- ESHUTDOWN : constant := 58; -- Cannot send once shutdown
- ESOCKTNOSUPPORT : constant := 44; -- Socket type not supported
- ETIMEDOUT : constant := 60; -- Connection timed out
- ETOOMANYREFS : constant := 59; -- Too many references
- EWOULDBLOCK : constant := 35; -- Operation would block
-
- -----------------
- -- Host errors --
- -----------------
-
- HOST_NOT_FOUND : constant := 1; -- Unknown host
- TRY_AGAIN : constant := 2; -- Host name lookup failure
- NO_DATA : constant := 4; -- No data record for name
- NO_RECOVERY : constant := 3; -- Non recoverable errors
-
- -------------------
- -- Control flags --
- -------------------
-
- FIONBIO : constant := -2147195266; -- Set/clear non-blocking io
- FIONREAD : constant := 1074030207; -- How many bytes to read
-
- --------------------
- -- Shutdown modes --
- --------------------
-
- SHUT_RD : constant := 0; -- No more recv
- SHUT_WR : constant := 1; -- No more send
- SHUT_RDWR : constant := 2; -- No more recv/send
-
- ---------------------
- -- Protocol levels --
- ---------------------
-
- SOL_SOCKET : constant := 65535; -- Options for socket level
- IPPROTO_IP : constant := 0; -- Dummy protocol for IP
- IPPROTO_UDP : constant := 17; -- UDP
- IPPROTO_TCP : constant := 6; -- TCP
-
- -------------------
- -- Request flags --
- -------------------
-
- MSG_OOB : constant := 1; -- Process out-of-band data
- MSG_PEEK : constant := 2; -- Peek at incoming data
- MSG_EOR : constant := 8; -- Send end of record
- MSG_WAITALL : constant := 64; -- Wait for full reception
- MSG_NOSIGNAL : constant := -1; -- No SIGPIPE on send
- MSG_Forced_Flags : constant := 0;
- -- Flags set on all send(2) calls
-
- --------------------
- -- Socket options --
- --------------------
-
- TCP_NODELAY : constant := 1; -- Do not coalesce packets
- SO_REUSEADDR : constant := 4; -- Bind reuse local address
- SO_REUSEPORT : constant := 512; -- Bind reuse port number
- SO_KEEPALIVE : constant := 8; -- Enable keep-alive msgs
- SO_LINGER : constant := 128; -- Defer close to flush data
- SO_BROADCAST : constant := 32; -- Can send broadcast msgs
- SO_SNDBUF : constant := 4097; -- Set/get send buffer size
- SO_RCVBUF : constant := 4098; -- Set/get recv buffer size
- SO_SNDTIMEO : constant := 4101; -- Emission timeout
- SO_RCVTIMEO : constant := 4102; -- Reception timeout
- SO_ERROR : constant := 4103; -- Get/clear error status
- IP_MULTICAST_IF : constant := 9; -- Set/get mcast interface
- IP_MULTICAST_TTL : constant := 10; -- Set/get multicast TTL
- IP_MULTICAST_LOOP : constant := 11; -- Set/get mcast loopback
- IP_ADD_MEMBERSHIP : constant := 12; -- Join a multicast group
- IP_DROP_MEMBERSHIP : constant := 13; -- Leave a multicast group
- IP_PKTINFO : constant := -1; -- Get datagram info
-
- -------------------
- -- System limits --
- -------------------
-
- IOV_MAX : constant := 1024; -- Maximum writev iovcnt
-
- ----------------------
- -- Type definitions --
- ----------------------
-
- -- Sizes (in bytes) of the components of struct timeval
-
- SIZEOF_tv_sec : constant := 4; -- tv_sec
- SIZEOF_tv_usec : constant := 4; -- tv_usec
-
- -- Sizes of protocol specific address types (for sockaddr.sa_len)
-
- SIZEOF_sockaddr_in : constant := 16; -- struct sockaddr_in
- SIZEOF_sockaddr_in6 : constant := 32; -- struct sockaddr_in6
-
- -- Size of file descriptor sets
-
- SIZEOF_fd_set : constant := 512; -- fd_set
-
- -- Fields of struct hostent
-
- subtype H_Addrtype_T is Interfaces.C.int;
- subtype H_Length_T is Interfaces.C.int;
-
- ----------------------------------------
- -- Properties of supported interfaces --
- ----------------------------------------
-
- Need_Netdb_Buffer : constant := 0; -- Need buffer for Netdb ops
- Has_Sockaddr_Len : constant := 0; -- Sockaddr has sa_len field
-
- Thread_Blocking_IO : constant Boolean := True;
- -- Set False for contexts where socket i/o are process blocking
-
-end GNAT.Sockets.Constants;
diff --git a/gcc/ada/g-soccon-vms.ads b/gcc/ada/g-soccon-vms.ads
deleted file mode 100644
index 072ee499c3c..00000000000
--- a/gcc/ada/g-soccon-vms.ads
+++ /dev/null
@@ -1,208 +0,0 @@
-------------------------------------------------------------------------------
--- --
--- GNAT COMPILER COMPONENTS --
--- --
--- G N A T . S O C K E T S . C O N S T A N T S --
--- --
--- S p e c --
--- --
--- Copyright (C) 2000-2008, Free Software Foundation, Inc. --
--- --
--- GNAT is free software; you can redistribute it and/or modify it under --
--- terms of the GNU General Public License as published by the Free Soft- --
--- ware Foundation; either version 2, or (at your option) any later ver- --
--- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
--- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
--- for more details. You should have received a copy of the GNU General --
--- Public License distributed with GNAT; see file COPYING. If not, write --
--- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
--- Boston, MA 02110-1301, USA. --
--- --
--- As a special exception, if other files instantiate generics from this --
--- unit, or you link this unit with other files to produce an executable, --
--- this unit does not by itself cause the resulting executable to be --
--- covered by the GNU General Public License. This exception does not --
--- however invalidate any other reasons why the executable file might be --
--- covered by the GNU Public License. --
--- --
--- GNAT was originally developed by the GNAT team at New York University. --
--- Extensive contributions were provided by Ada Core Technologies Inc. --
--- --
-------------------------------------------------------------------------------
-
--- This package provides target dependent definitions of constant for use
--- by the GNAT.Sockets package (g-socket.ads). This package should not be
--- directly with'ed by an applications program.
-
--- This is the version for OpenVMS
--- This file is generated automatically, do not modify it by hand! Instead,
--- make changes to gen-soccon.c and re-run it on each target.
-
-with Interfaces.C;
-package GNAT.Sockets.Constants is
-
- --------------
- -- Families --
- --------------
-
- AF_INET : constant := 2; -- IPv4 address family
- AF_INET6 : constant := 26; -- IPv6 address family
-
- -----------
- -- Modes --
- -----------
-
- SOCK_STREAM : constant := 1; -- Stream socket
- SOCK_DGRAM : constant := 2; -- Datagram socket
-
- -------------------
- -- Socket errors --
- -------------------
-
- EACCES : constant := 13; -- Permission denied
- EADDRINUSE : constant := 48; -- Address already in use
- EADDRNOTAVAIL : constant := 49; -- Cannot assign address
- EAFNOSUPPORT : constant := 47; -- Addr family not supported
- EALREADY : constant := 37; -- Operation in progress
- EBADF : constant := 9; -- Bad file descriptor
- ECONNABORTED : constant := 53; -- Connection aborted
- ECONNREFUSED : constant := 61; -- Connection refused
- ECONNRESET : constant := 54; -- Connection reset by peer
- EDESTADDRREQ : constant := 39; -- Destination addr required
- EFAULT : constant := 14; -- Bad address
- EHOSTDOWN : constant := 64; -- Host is down
- EHOSTUNREACH : constant := 65; -- No route to host
- EINPROGRESS : constant := 36; -- Operation now in progress
- EINTR : constant := 4; -- Interrupted system call
- EINVAL : constant := 22; -- Invalid argument
- EIO : constant := 5; -- Input output error
- EISCONN : constant := 56; -- Socket already connected
- ELOOP : constant := 62; -- Too many symbolic links
- EMFILE : constant := 24; -- Too many open files
- EMSGSIZE : constant := 40; -- Message too long
- ENAMETOOLONG : constant := 63; -- Name too long
- ENETDOWN : constant := 50; -- Network is down
- ENETRESET : constant := 52; -- Disconn. on network reset
- ENETUNREACH : constant := 51; -- Network is unreachable
- ENOBUFS : constant := 55; -- No buffer space available
- ENOPROTOOPT : constant := 42; -- Protocol not available
- ENOTCONN : constant := 57; -- Socket not connected
- ENOTSOCK : constant := 38; -- Operation on non socket
- EOPNOTSUPP : constant := 45; -- Operation not supported
- EPFNOSUPPORT : constant := 46; -- Unknown protocol family
- EPROTONOSUPPORT : constant := 43; -- Unknown protocol
- EPROTOTYPE : constant := 41; -- Unknown protocol type
- ESHUTDOWN : constant := 58; -- Cannot send once shutdown
- ESOCKTNOSUPPORT : constant := 44; -- Socket type not supported
- ETIMEDOUT : constant := 60; -- Connection timed out
- ETOOMANYREFS : constant := 59; -- Too many references
- EWOULDBLOCK : constant := 35; -- Operation would block
-
- -----------------
- -- Host errors --
- -----------------
-
- HOST_NOT_FOUND : constant := 1; -- Unknown host
- TRY_AGAIN : constant := 2; -- Host name lookup failure
- NO_DATA : constant := 4; -- No data record for name
- NO_RECOVERY : constant := 3; -- Non recoverable errors
-
- -------------------
- -- Control flags --
- -------------------
-
- FIONBIO : constant := -2147195266; -- Set/clear non-blocking io
- FIONREAD : constant := 1074030207; -- How many bytes to read
-
- --------------------
- -- Shutdown modes --
- --------------------
-
- SHUT_RD : constant := 0; -- No more recv
- SHUT_WR : constant := 1; -- No more send
- SHUT_RDWR : constant := 2; -- No more recv/send
-
- ---------------------
- -- Protocol levels --
- ---------------------
-
- SOL_SOCKET : constant := 65535; -- Options for socket level
- IPPROTO_IP : constant := 0; -- Dummy protocol for IP
- IPPROTO_UDP : constant := 17; -- UDP
- IPPROTO_TCP : constant := 6; -- TCP
-
- -------------------
- -- Request flags --
- -------------------
-
- MSG_OOB : constant := 1; -- Process out-of-band data
- MSG_PEEK : constant := 2; -- Peek at incoming data
- MSG_EOR : constant := 8; -- Send end of record
- MSG_WAITALL : constant := 128; -- Wait for full reception
- MSG_NOSIGNAL : constant := -1; -- No SIGPIPE on send
- MSG_Forced_Flags : constant := 0;
- -- Flags set on all send(2) calls
-
- --------------------
- -- Socket options --
- --------------------
-
- TCP_NODELAY : constant := 1; -- Do not coalesce packets
- SO_REUSEADDR : constant := 4; -- Bind reuse local address
- SO_REUSEPORT : constant := 512; -- Bind reuse port number
- SO_KEEPALIVE : constant := 8; -- Enable keep-alive msgs
- SO_LINGER : constant := 128; -- Defer close to flush data
- SO_BROADCAST : constant := 32; -- Can send broadcast msgs
- SO_SNDBUF : constant := 4097; -- Set/get send buffer size
- SO_RCVBUF : constant := 4098; -- Set/get recv buffer size
- SO_SNDTIMEO : constant := 4101; -- Emission timeout
- SO_RCVTIMEO : constant := 4102; -- Reception timeout
- SO_ERROR : constant := 4103; -- Get/clear error status
- IP_MULTICAST_IF : constant := 9; -- Set/get mcast interface
- IP_MULTICAST_TTL : constant := 10; -- Set/get multicast TTL
- IP_MULTICAST_LOOP : constant := 11; -- Set/get mcast loopback
- IP_ADD_MEMBERSHIP : constant := 12; -- Join a multicast group
- IP_DROP_MEMBERSHIP : constant := 13; -- Leave a multicast group
- IP_PKTINFO : constant := -1; -- Get datagram info
-
- -------------------
- -- System limits --
- -------------------
-
- IOV_MAX : constant := 1024; -- Maximum writev iovcnt
-
- ----------------------
- -- Type definitions --
- ----------------------
-
- -- Sizes (in bytes) of the components of struct timeval
-
- SIZEOF_tv_sec : constant := 4; -- tv_sec
- SIZEOF_tv_usec : constant := 4; -- tv_usec
-
- -- Sizes of protocol specific address types (for sockaddr.sa_len)
-
- SIZEOF_sockaddr_in : constant := 16; -- struct sockaddr_in
- SIZEOF_sockaddr_in6 : constant := 28; -- struct sockaddr_in6
-
- -- Size of file descriptor sets
-
- SIZEOF_fd_set : constant := 512; -- fd_set
-
- -- Fields of struct hostent
-
- subtype H_Addrtype_T is Interfaces.C.int;
- subtype H_Length_T is Interfaces.C.int;
-
- ----------------------------------------
- -- Properties of supported interfaces --
- ----------------------------------------
-
- Need_Netdb_Buffer : constant := 1; -- Need buffer for Netdb ops
- Has_Sockaddr_Len : constant := 0; -- Sockaddr has sa_len field
-
- Thread_Blocking_IO : constant Boolean := True;
- -- Set False for contexts where socket i/o are process blocking
-
-end GNAT.Sockets.Constants;
diff --git a/gcc/ada/g-soccon-vxworks.ads b/gcc/ada/g-soccon-vxworks.ads
deleted file mode 100644
index 8af174351dc..00000000000
--- a/gcc/ada/g-soccon-vxworks.ads
+++ /dev/null
@@ -1,218 +0,0 @@
-------------------------------------------------------------------------------
--- --
--- GNAT COMPILER COMPONENTS --
--- --
--- G N A T . S O C K E T S . C O N S T A N T S --
--- --
--- S p e c --
--- --
--- Copyright (C) 2000-2008, Free Software Foundation, Inc. --
--- --
--- GNAT is free software; you can redistribute it and/or modify it under --
--- terms of the GNU General Public License as published by the Free Soft- --
--- ware Foundation; either version 2, or (at your option) any later ver- --
--- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
--- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
--- for more details. You should have received a copy of the GNU General --
--- Public License distributed with GNAT; see file COPYING. If not, write --
--- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
--- Boston, MA 02110-1301, USA. --
--- --
--- As a special exception, if other files instantiate generics from this --
--- unit, or you link this unit with other files to produce an executable, --
--- this unit does not by itself cause the resulting executable to be --
--- covered by the GNU General Public License. This exception does not --
--- however invalidate any other reasons why the executable file might be --
--- covered by the GNU Public License. --
--- --
--- GNAT was originally developed by the GNAT team at New York University. --
--- Extensive contributions were provided by Ada Core Technologies Inc. --
--- --
-------------------------------------------------------------------------------
-
--- This package provides target dependent definitions of constant for use
--- by the GNAT.Sockets package (g-socket.ads). This package should not be
--- directly with'ed by an applications program.
-
--- This is the version for VxWorks
--- This file is generated automatically, do not modify it by hand! Instead,
--- make changes to gen-soccon.c and re-run it on each target.
-
-with Interfaces.C;
-package GNAT.Sockets.Constants is
-
- --------------
- -- Families --
- --------------
-
- AF_INET : constant := 2; -- IPv4 address family
- AF_INET6 : constant := 28; -- IPv6 address family
-
- -----------
- -- Modes --
- -----------
-
- SOCK_STREAM : constant := 1; -- Stream socket
- SOCK_DGRAM : constant := 2; -- Datagram socket
-
- -------------------
- -- Socket errors --
- -------------------
-
- EACCES : constant := 13; -- Permission denied
- EADDRINUSE : constant := 48; -- Address already in use
- EADDRNOTAVAIL : constant := 49; -- Cannot assign address
- EAFNOSUPPORT : constant := 47; -- Addr family not supported
- EALREADY : constant := 69; -- Operation in progress
- EBADF : constant := 9; -- Bad file descriptor
- ECONNABORTED : constant := 53; -- Connection aborted
- ECONNREFUSED : constant := 61; -- Connection refused
- ECONNRESET : constant := 54; -- Connection reset by peer
- EDESTADDRREQ : constant := 40; -- Destination addr required
- EFAULT : constant := 14; -- Bad address
- EHOSTDOWN : constant := 67; -- Host is down
- EHOSTUNREACH : constant := 65; -- No route to host
- EINPROGRESS : constant := 68; -- Operation now in progress
- EINTR : constant := 4; -- Interrupted system call
- EINVAL : constant := 22; -- Invalid argument
- EIO : constant := 5; -- Input output error
- EISCONN : constant := 56; -- Socket already connected
- ELOOP : constant := 64; -- Too many symbolic links
- EMFILE : constant := 24; -- Too many open files
- EMSGSIZE : constant := 36; -- Message too long
- ENAMETOOLONG : constant := 26; -- Name too long
- ENETDOWN : constant := 62; -- Network is down
- ENETRESET : constant := 52; -- Disconn. on network reset
- ENETUNREACH : constant := 51; -- Network is unreachable
- ENOBUFS : constant := 55; -- No buffer space available
- ENOPROTOOPT : constant := 42; -- Protocol not available
- ENOTCONN : constant := 57; -- Socket not connected
- ENOTSOCK : constant := 50; -- Operation on non socket
- EOPNOTSUPP : constant := 45; -- Operation not supported
- EPFNOSUPPORT : constant := 46; -- Unknown protocol family
- EPROTONOSUPPORT : constant := 43; -- Unknown protocol
- EPROTOTYPE : constant := 41; -- Unknown protocol type
- ESHUTDOWN : constant := 58; -- Cannot send once shutdown
- ESOCKTNOSUPPORT : constant := 44; -- Socket type not supported
- ETIMEDOUT : constant := 60; -- Connection timed out
- ETOOMANYREFS : constant := 59; -- Too many references
- EWOULDBLOCK : constant := 70; -- Operation would block
-
- -----------------
- -- Host errors --
- -----------------
-
- HOST_NOT_FOUND : constant := 1; -- Unknown host
- TRY_AGAIN : constant := 2; -- Host name lookup failure
- NO_DATA : constant := 4; -- No data record for name
- NO_RECOVERY : constant := 3; -- Non recoverable errors
-
- -------------------
- -- Control flags --
- -------------------
-
- FIONBIO : constant := 16; -- Set/clear non-blocking io
- FIONREAD : constant := 1; -- How many bytes to read
-
- --------------------
- -- Shutdown modes --
- --------------------
-
- SHUT_RD : constant := 0; -- No more recv
- SHUT_WR : constant := 1; -- No more send
- SHUT_RDWR : constant := 2; -- No more recv/send
-
- ---------------------
- -- Protocol levels --
- ---------------------
-
- SOL_SOCKET : constant := 65535; -- Options for socket level
- IPPROTO_IP : constant := 0; -- Dummy protocol for IP
- IPPROTO_UDP : constant := 17; -- UDP
- IPPROTO_TCP : constant := 6; -- TCP
-
- -------------------
- -- Request flags --
- -------------------
-
- MSG_OOB : constant := 1; -- Process out-of-band data
- MSG_PEEK : constant := 2; -- Peek at incoming data
- MSG_EOR : constant := 8; -- Send end of record
- MSG_WAITALL : constant := 64; -- Wait for full reception
- MSG_NOSIGNAL : constant := -1; -- No SIGPIPE on send
- MSG_Forced_Flags : constant := 0;
- -- Flags set on all send(2) calls
-
- --------------------
- -- Socket options --
- --------------------
-
- TCP_NODELAY : constant := 1; -- Do not coalesce packets
- SO_REUSEADDR : constant := 4; -- Bind reuse local address
- SO_REUSEPORT : constant := 512; -- Bind reuse port number
- SO_KEEPALIVE : constant := 8; -- Enable keep-alive msgs
- SO_LINGER : constant := 128; -- Defer close to flush data
- SO_BROADCAST : constant := 32; -- Can send broadcast msgs
- SO_SNDBUF : constant := 4097; -- Set/get send buffer size
- SO_RCVBUF : constant := 4098; -- Set/get recv buffer size
- SO_SNDTIMEO : constant := 4101; -- Emission timeout
- SO_RCVTIMEO : constant := 4102; -- Reception timeout
- SO_ERROR : constant := 4103; -- Get/clear error status
- IP_MULTICAST_IF : constant := 9; -- Set/get mcast interface
- IP_MULTICAST_TTL : constant := 10; -- Set/get multicast TTL
- IP_MULTICAST_LOOP : constant := 11; -- Set/get mcast loopback
- IP_ADD_MEMBERSHIP : constant := 12; -- Join a multicast group
- IP_DROP_MEMBERSHIP : constant := 13; -- Leave a multicast group
- IP_PKTINFO : constant := -1; -- Get datagram info
-
- -------------------
- -- System limits --
- -------------------
-
- IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt
-
- ----------------------
- -- Type definitions --
- ----------------------
-
- -- Sizes (in bytes) of the components of struct timeval
-
- SIZEOF_tv_sec : constant := 4; -- tv_sec
- SIZEOF_tv_usec : constant := 4; -- tv_usec
-
- -- Sizes of protocol specific address types (for sockaddr.sa_len)
-
- SIZEOF_sockaddr_in : constant := 16; -- struct sockaddr_in
- SIZEOF_sockaddr_in6 : constant := 28; -- struct sockaddr_in6
-
- -- Size of file descriptor sets
-
- SIZEOF_fd_set : constant := 256; -- fd_set
-
- -- Fields of struct hostent
-
- subtype H_Addrtype_T is Interfaces.C.int;
- subtype H_Length_T is Interfaces.C.int;
-
- ----------------------------------------
- -- Properties of supported interfaces --
- ----------------------------------------
-
- Need_Netdb_Buffer : constant := 1; -- Need buffer for Netdb ops
- Has_Sockaddr_Len : constant := 1; -- Sockaddr has sa_len field
-
- Thread_Blocking_IO : constant Boolean := True;
- -- Set False for contexts where socket i/o are process blocking
-
- --------------------------------
- -- VxWorks-specific constants --
- --------------------------------
-
- -- These constants may be used only within the VxWorks version of
- -- GNAT.Sockets.Thin.
-
- OK : constant := 0; -- VxWorks generic success
- ERROR : constant := -1; -- VxWorks generic error
-
-end GNAT.Sockets.Constants;
diff --git a/gcc/ada/g-soccon.ads b/gcc/ada/g-soccon.ads
index b7f8fe4be77..ede8fd5eb09 100644
--- a/gcc/ada/g-soccon.ads
+++ b/gcc/ada/g-soccon.ads
@@ -31,185 +31,12 @@
-- --
------------------------------------------------------------------------------
--- This package provides target dependent definitions of constant for use
--- by the GNAT.Sockets package (g-socket.ads). This package should not be
--- directly with'ed by an applications program.
+-- This package provides a temporary compatibility renaming for deprecated
+-- internal package GNAT.Sockets.Constants.
--- WARNING! This file is a default version that must be replaced for
--- each platform by running gen-soccon.c which automatically generates
--- the appropriate target specific values.
+-- This package should not be directly used by an applications program.
+-- It is a compatibility artefact to help building legacy code with newer
+-- compilers, and will be removed at some point in the future.
--- The values below were computed from a i686-pc-linux-gnu environment,
--- but are for illustration purposes only. As noted above, part of a port
--- to a new target is to replace this file appropriately.
-
--- This file is generated automatically, do not modify it by hand! Instead,
--- make changes to gen-soccon.c and re-run it on each target.
-
-with Interfaces.C;
-package GNAT.Sockets.Constants is
-
- --------------
- -- Families --
- --------------
-
- AF_INET : constant := 2; -- IPv4 address family
- AF_INET6 : constant := 10; -- IPv6 address family
-
- -----------
- -- Modes --
- -----------
-
- SOCK_STREAM : constant := 1; -- Stream socket
- SOCK_DGRAM : constant := 2; -- Datagram socket
-
- -------------------
- -- Socket errors --
- -------------------
-
- EACCES : constant := 13; -- Permission denied
- EADDRINUSE : constant := 98; -- Address already in use
- EADDRNOTAVAIL : constant := 99; -- Cannot assign address
- EAFNOSUPPORT : constant := 97; -- Addr family not supported
- EALREADY : constant := 114; -- Operation in progress
- EBADF : constant := 9; -- Bad file descriptor
- ECONNABORTED : constant := 103; -- Connection aborted
- ECONNREFUSED : constant := 111; -- Connection refused
- ECONNRESET : constant := 104; -- Connection reset by peer
- EDESTADDRREQ : constant := 89; -- Destination addr required
- EFAULT : constant := 14; -- Bad address
- EHOSTDOWN : constant := 112; -- Host is down
- EHOSTUNREACH : constant := 113; -- No route to host
- EINPROGRESS : constant := 115; -- Operation now in progress
- EINTR : constant := 4; -- Interrupted system call
- EINVAL : constant := 22; -- Invalid argument
- EIO : constant := 5; -- Input output error
- EISCONN : constant := 106; -- Socket already connected
- ELOOP : constant := 40; -- Too many symbolic links
- EMFILE : constant := 24; -- Too many open files
- EMSGSIZE : constant := 90; -- Message too long
- ENAMETOOLONG : constant := 36; -- Name too long
- ENETDOWN : constant := 100; -- Network is down
- ENETRESET : constant := 102; -- Disconn. on network reset
- ENETUNREACH : constant := 101; -- Network is unreachable
- ENOBUFS : constant := 105; -- No buffer space available
- ENOPROTOOPT : constant := 92; -- Protocol not available
- ENOTCONN : constant := 107; -- Socket not connected
- ENOTSOCK : constant := 88; -- Operation on non socket
- EOPNOTSUPP : constant := 95; -- Operation not supported
- EPFNOSUPPORT : constant := 96; -- Unknown protocol family
- EPROTONOSUPPORT : constant := 93; -- Unknown protocol
- EPROTOTYPE : constant := 91; -- Unknown protocol type
- ESHUTDOWN : constant := 108; -- Cannot send once shutdown
- ESOCKTNOSUPPORT : constant := 94; -- Socket type not supported
- ETIMEDOUT : constant := 110; -- Connection timed out
- ETOOMANYREFS : constant := 109; -- Too many references
- EWOULDBLOCK : constant := 11; -- Operation would block
-
- -----------------
- -- Host errors --
- -----------------
-
- HOST_NOT_FOUND : constant := 1; -- Unknown host
- TRY_AGAIN : constant := 2; -- Host name lookup failure
- NO_DATA : constant := 4; -- No data record for name
- NO_RECOVERY : constant := 3; -- Non recoverable errors
-
- -------------------
- -- Control flags --
- -------------------
-
- FIONBIO : constant := 21537; -- Set/clear non-blocking io
- FIONREAD : constant := 21531; -- How many bytes to read
-
- --------------------
- -- Shutdown modes --
- --------------------
-
- SHUT_RD : constant := 0; -- No more recv
- SHUT_WR : constant := 1; -- No more send
- SHUT_RDWR : constant := 2; -- No more recv/send
-
- ---------------------
- -- Protocol levels --
- ---------------------
-
- SOL_SOCKET : constant := 1; -- Options for socket level
- IPPROTO_IP : constant := 0; -- Dummy protocol for IP
- IPPROTO_UDP : constant := 17; -- UDP
- IPPROTO_TCP : constant := 6; -- TCP
-
- -------------------
- -- Request flags --
- -------------------
-
- MSG_OOB : constant := 1; -- Process out-of-band data
- MSG_PEEK : constant := 2; -- Peek at incoming data
- MSG_EOR : constant := 128; -- Send end of record
- MSG_WAITALL : constant := 256; -- Wait for full reception
- MSG_NOSIGNAL : constant := 16384; -- No SIGPIPE on send
- MSG_Forced_Flags : constant := MSG_NOSIGNAL;
- -- Flags set on all send(2) calls
-
- --------------------
- -- Socket options --
- --------------------
-
- TCP_NODELAY : constant := 1; -- Do not coalesce packets
- SO_REUSEADDR : constant := 2; -- Bind reuse local address
- SO_REUSEPORT : constant := -1; -- Bind reuse port number
- SO_KEEPALIVE : constant := 9; -- Enable keep-alive msgs
- SO_LINGER : constant := 13; -- Defer close to flush data
- SO_BROADCAST : constant := 6; -- Can send broadcast msgs
- SO_SNDBUF : constant := 7; -- Set/get send buffer size
- SO_RCVBUF : constant := 8; -- Set/get recv buffer size
- SO_SNDTIMEO : constant := 21; -- Emission timeout
- SO_RCVTIMEO : constant := 20; -- Reception timeout
- SO_ERROR : constant := 4; -- Get/clear error status
- IP_MULTICAST_IF : constant := 32; -- Set/get mcast interface
- IP_MULTICAST_TTL : constant := 33; -- Set/get multicast TTL
- IP_MULTICAST_LOOP : constant := 34; -- Set/get mcast loopback
- IP_ADD_MEMBERSHIP : constant := 35; -- Join a multicast group
- IP_DROP_MEMBERSHIP : constant := 36; -- Leave a multicast group
- IP_PKTINFO : constant := 8; -- Get datagram info
-
- -------------------
- -- System limits --
- -------------------
-
- IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt
-
- ----------------------
- -- Type definitions --
- ----------------------
-
- -- Sizes (in bytes) of the components of struct timeval
-
- SIZEOF_tv_sec : constant := 4; -- tv_sec
- SIZEOF_tv_usec : constant := 4; -- tv_usec
-
- -- Sizes of protocol specific address types (for sockaddr.sa_len)
-
- SIZEOF_sockaddr_in : constant := 16; -- struct sockaddr_in
- SIZEOF_sockaddr_in6 : constant := 28; -- struct sockaddr_in6
-
- -- Size of file descriptor sets
-
- SIZEOF_fd_set : constant := 128; -- fd_set
-
- -- Fields of struct hostent
-
- subtype H_Addrtype_T is Interfaces.C.int;
- subtype H_Length_T is Interfaces.C.int;
-
- ----------------------------------------
- -- Properties of supported interfaces --
- ----------------------------------------
-
- Need_Netdb_Buffer : constant := 1; -- Need buffer for Netdb ops
- Has_Sockaddr_Len : constant := 0; -- Sockaddr has sa_len field
-
- Thread_Blocking_IO : constant Boolean := True;
- -- Set False for contexts where socket i/o are process blocking
-
-end GNAT.Sockets.Constants;
+with System.OS_Constants;
+package GNAT.Sockets.Constants renames System.OS_Constants;
diff --git a/gcc/ada/g-socket-dummy.adb b/gcc/ada/g-socket-dummy.adb
new file mode 100644
index 00000000000..14f392e71fa
--- /dev/null
+++ b/gcc/ada/g-socket-dummy.adb
@@ -0,0 +1,34 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- G N A T . S O C K E T S --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 2001-2008, AdaCore --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 2, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
+-- for more details. You should have received a copy of the GNU General --
+-- Public License distributed with GNAT; see file COPYING. If not, write --
+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
+-- Boston, MA 02110-1301, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, or you link this unit with other files to produce an executable, --
+-- this unit does not by itself cause the resulting executable to be --
+-- covered by the GNU General Public License. This exception does not --
+-- however invalidate any other reasons why the executable file might be --
+-- covered by the GNU Public License. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+pragma No_Body;
diff --git a/gcc/ada/g-socket-dummy.ads b/gcc/ada/g-socket-dummy.ads
new file mode 100644
index 00000000000..6536472ce00
--- /dev/null
+++ b/gcc/ada/g-socket-dummy.ads
@@ -0,0 +1,39 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- G N A T . S O C K E T S --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 2001-2008, AdaCore --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 2, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
+-- for more details. You should have received a copy of the GNU General --
+-- Public License distributed with GNAT; see file COPYING. If not, write --
+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
+-- Boston, MA 02110-1301, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, or you link this unit with other files to produce an executable, --
+-- this unit does not by itself cause the resulting executable to be --
+-- covered by the GNU General Public License. This exception does not --
+-- however invalidate any other reasons why the executable file might be --
+-- covered by the GNU Public License. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package is a placeholder for the sockets binding for platforms where
+-- it is not implemented.
+
+package GNAT.Sockets is
+ pragma Unimplemented_Unit;
+end GNAT.Sockets;
diff --git a/gcc/ada/g-socket.adb b/gcc/ada/g-socket.adb
index 4b399405a55..2f729bd0314 100644
--- a/gcc/ada/g-socket.adb
+++ b/gcc/ada/g-socket.adb
@@ -37,7 +37,6 @@ with Ada.Unchecked_Conversion;
with Interfaces.C.Strings;
-with GNAT.Sockets.Constants;
with GNAT.Sockets.Thin_Common; use GNAT.Sockets.Thin_Common;
with GNAT.Sockets.Thin; use GNAT.Sockets.Thin;
with GNAT.Sockets.Thin.Task_Safe_NetDB; use GNAT.Sockets.Thin.Task_Safe_NetDB;
@@ -59,7 +58,7 @@ package body GNAT.Sockets is
ENOERROR : constant := 0;
- Netdb_Buffer_Size : constant := Constants.Need_Netdb_Buffer * 1024;
+ Netdb_Buffer_Size : constant := SOSC.Need_Netdb_Buffer * 1024;
-- The network database functions gethostbyname, gethostbyaddr,
-- getservbyname and getservbyport can either be guaranteed task safe by
-- the operating system, or else return data through a user-provided buffer
@@ -68,49 +67,49 @@ package body GNAT.Sockets is
-- Correspondence tables
Levels : constant array (Level_Type) of C.int :=
- (Socket_Level => Constants.SOL_SOCKET,
- IP_Protocol_For_IP_Level => Constants.IPPROTO_IP,
- IP_Protocol_For_UDP_Level => Constants.IPPROTO_UDP,
- IP_Protocol_For_TCP_Level => Constants.IPPROTO_TCP);
+ (Socket_Level => SOSC.SOL_SOCKET,
+ IP_Protocol_For_IP_Level => SOSC.IPPROTO_IP,
+ IP_Protocol_For_UDP_Level => SOSC.IPPROTO_UDP,
+ IP_Protocol_For_TCP_Level => SOSC.IPPROTO_TCP);
Modes : constant array (Mode_Type) of C.int :=
- (Socket_Stream => Constants.SOCK_STREAM,
- Socket_Datagram => Constants.SOCK_DGRAM);
+ (Socket_Stream => SOSC.SOCK_STREAM,
+ Socket_Datagram => SOSC.SOCK_DGRAM);
Shutmodes : constant array (Shutmode_Type) of C.int :=
- (Shut_Read => Constants.SHUT_RD,
- Shut_Write => Constants.SHUT_WR,
- Shut_Read_Write => Constants.SHUT_RDWR);
+ (Shut_Read => SOSC.SHUT_RD,
+ Shut_Write => SOSC.SHUT_WR,
+ Shut_Read_Write => SOSC.SHUT_RDWR);
Requests : constant array (Request_Name) of C.int :=
- (Non_Blocking_IO => Constants.FIONBIO,
- N_Bytes_To_Read => Constants.FIONREAD);
+ (Non_Blocking_IO => SOSC.FIONBIO,
+ N_Bytes_To_Read => SOSC.FIONREAD);
Options : constant array (Option_Name) of C.int :=
- (Keep_Alive => Constants.SO_KEEPALIVE,
- Reuse_Address => Constants.SO_REUSEADDR,
- Broadcast => Constants.SO_BROADCAST,
- Send_Buffer => Constants.SO_SNDBUF,
- Receive_Buffer => Constants.SO_RCVBUF,
- Linger => Constants.SO_LINGER,
- Error => Constants.SO_ERROR,
- No_Delay => Constants.TCP_NODELAY,
- Add_Membership => Constants.IP_ADD_MEMBERSHIP,
- Drop_Membership => Constants.IP_DROP_MEMBERSHIP,
- Multicast_If => Constants.IP_MULTICAST_IF,
- Multicast_TTL => Constants.IP_MULTICAST_TTL,
- Multicast_Loop => Constants.IP_MULTICAST_LOOP,
- Receive_Packet_Info => Constants.IP_PKTINFO,
- Send_Timeout => Constants.SO_SNDTIMEO,
- Receive_Timeout => Constants.SO_RCVTIMEO);
+ (Keep_Alive => SOSC.SO_KEEPALIVE,
+ Reuse_Address => SOSC.SO_REUSEADDR,
+ Broadcast => SOSC.SO_BROADCAST,
+ Send_Buffer => SOSC.SO_SNDBUF,
+ Receive_Buffer => SOSC.SO_RCVBUF,
+ Linger => SOSC.SO_LINGER,
+ Error => SOSC.SO_ERROR,
+ No_Delay => SOSC.TCP_NODELAY,
+ Add_Membership => SOSC.IP_ADD_MEMBERSHIP,
+ Drop_Membership => SOSC.IP_DROP_MEMBERSHIP,
+ Multicast_If => SOSC.IP_MULTICAST_IF,
+ Multicast_TTL => SOSC.IP_MULTICAST_TTL,
+ Multicast_Loop => SOSC.IP_MULTICAST_LOOP,
+ Receive_Packet_Info => SOSC.IP_PKTINFO,
+ Send_Timeout => SOSC.SO_SNDTIMEO,
+ Receive_Timeout => SOSC.SO_RCVTIMEO);
-- ??? Note: for OpenSolaris, Receive_Packet_Info should be IP_RECVPKTINFO,
-- but for Linux compatibility this constant is the same as IP_PKTINFO.
Flags : constant array (0 .. 3) of C.int :=
- (0 => Constants.MSG_OOB, -- Process_Out_Of_Band_Data
- 1 => Constants.MSG_PEEK, -- Peek_At_Incoming_Data
- 2 => Constants.MSG_WAITALL, -- Wait_For_A_Full_Reception
- 3 => Constants.MSG_EOR); -- Send_End_Of_Record
+ (0 => SOSC.MSG_OOB, -- Process_Out_Of_Band_Data
+ 1 => SOSC.MSG_PEEK, -- Peek_At_Incoming_Data
+ 2 => SOSC.MSG_WAITALL, -- Wait_For_A_Full_Reception
+ 3 => SOSC.MSG_EOR); -- Send_End_Of_Record
Socket_Error_Id : constant Exception_Id := Socket_Error'Identity;
Host_Error_Id : constant Exception_Id := Host_Error'Identity;
@@ -139,7 +138,7 @@ package body GNAT.Sockets is
-- Return the int value corresponding to the specified flags combination
function Set_Forced_Flags (F : C.int) return C.int;
- -- Return F with the bits from Constants.MSG_Forced_Flags forced set
+ -- Return F with the bits from SOSC.MSG_Forced_Flags forced set
function Short_To_Network
(S : C.unsigned_short) return C.unsigned_short;
@@ -883,7 +882,7 @@ package body GNAT.Sockets is
Err : aliased C.int;
begin
- if Safe_Gethostbyaddr (HA'Address, HA'Size / 8, Constants.AF_INET,
+ if Safe_Gethostbyaddr (HA'Address, HA'Size / 8, SOSC.AF_INET,
Res'Access, Buf'Address, Buflen, Err'Access) /= 0
then
Raise_Host_Error (Integer (Err));
@@ -1261,7 +1260,7 @@ package body GNAT.Sockets is
-- calling Inet_Addr("") will not return an error.
elsif Image = "" then
- Raise_Socket_Error (Constants.EINVAL);
+ Raise_Socket_Error (SOSC.EINVAL);
end if;
Img := New_String (Image);
@@ -1269,7 +1268,7 @@ package body GNAT.Sockets is
Free (Img);
if Res = Failure then
- Raise_Socket_Error (Constants.EINVAL);
+ Raise_Socket_Error (SOSC.EINVAL);
end if;
To_Inet_Addr (To_In_Addr (Res), Result);
@@ -1281,7 +1280,7 @@ package body GNAT.Sockets is
----------------
procedure Initialize (Process_Blocking_IO : Boolean) is
- Expected : constant Boolean := not Constants.Thread_Blocking_IO;
+ Expected : constant Boolean := not SOSC.Thread_Blocking_IO;
begin
if Process_Blocking_IO /= Expected then
raise Socket_Error with
@@ -1614,16 +1613,16 @@ package body GNAT.Sockets is
(Error_Value : Integer;
From_Errno : Boolean := True) return Error_Type
is
- use GNAT.Sockets.Constants;
+ use GNAT.Sockets.SOSC;
begin
if not From_Errno then
case Error_Value is
- when Constants.HOST_NOT_FOUND => return Unknown_Host;
- when Constants.TRY_AGAIN => return Host_Name_Lookup_Failure;
- when Constants.NO_RECOVERY => return Non_Recoverable_Error;
- when Constants.NO_DATA => return Unknown_Server_Error;
- when others => return Cannot_Resolve_Error;
+ when SOSC.HOST_NOT_FOUND => return Unknown_Host;
+ when SOSC.TRY_AGAIN => return Host_Name_Lookup_Failure;
+ when SOSC.NO_RECOVERY => return Non_Recoverable_Error;
+ when SOSC.NO_DATA => return Unknown_Server_Error;
+ when others => return Cannot_Resolve_Error;
end case;
end if;
@@ -1829,8 +1828,8 @@ package body GNAT.Sockets is
pragma Warnings (Off);
-- Following test may be compile time known on some targets
- if Vector'Length - Iov_Count > Constants.IOV_MAX then
- This_Iov_Count := Constants.IOV_MAX;
+ if Vector'Length - Iov_Count > SOSC.IOV_MAX then
+ This_Iov_Count := SOSC.IOV_MAX;
else
This_Iov_Count := Vector'Length - Iov_Count;
end if;
@@ -1880,7 +1879,7 @@ package body GNAT.Sockets is
function To_int is
new Ada.Unchecked_Conversion (C.unsigned, C.int);
begin
- return To_int (To_unsigned (F) or Constants.MSG_Forced_Flags);
+ return To_int (To_unsigned (F) or SOSC.MSG_Forced_Flags);
end Set_Forced_Flags;
-----------------------
@@ -2161,7 +2160,7 @@ package body GNAT.Sockets is
if Current mod 2 /= 0 then
if Flags (J) = -1 then
- Raise_Socket_Error (Constants.EOPNOTSUPP);
+ Raise_Socket_Error (SOSC.EOPNOTSUPP);
end if;
Result := Result + Flags (J);
diff --git a/gcc/ada/g-socket.ads b/gcc/ada/g-socket.ads
index 58255f0880e..045e3bfb7d0 100644
--- a/gcc/ada/g-socket.ads
+++ b/gcc/ada/g-socket.ads
@@ -52,6 +52,8 @@ with Ada.Exceptions;
with Ada.Streams;
with Ada.Unchecked_Deallocation;
+with System.OS_Constants;
+
package GNAT.Sockets is
-- Sockets are designed to provide a consistent communication facility
@@ -367,6 +369,12 @@ package GNAT.Sockets is
-- Finalize;
-- end PingPong;
+ package SOSC renames System.OS_Constants;
+ -- Renaming used to provide short-hand notations thoughout the sockets
+ -- binding. Note that System.OS_Constants is an internal unit, and the
+ -- entities declared therein are not meant for direct access by users,
+ -- including through this renaming.
+
procedure Initialize;
-- Initialize must be called before using any other socket routines.
-- Note that this operation is a no-op on UNIX platforms, but applications
@@ -404,9 +412,11 @@ package GNAT.Sockets is
-- structure. Moreover, negative values are not allowed to avoid system
-- incompatibilities.
- Immediate : constant := 0.0;
- Forever : constant := Duration (Integer'Last) * 1.0;
- -- Should be Duration 2 ** (Constants.SIZEOF_tv_sec * 8 - 1) - 1 ???
+ Immediate : constant Duration := 0.0;
+
+ Timeval_Forever : constant := 2.0 ** (SOSC.SIZEOF_tv_sec * 8 - 1) - 1.0;
+ Forever : constant Duration :=
+ Duration'Min (Duration'Last, Timeval_Forever);
subtype Timeval_Duration is Duration range Immediate .. Forever;
diff --git a/gcc/ada/g-socthi-dummy.adb b/gcc/ada/g-socthi-dummy.adb
new file mode 100644
index 00000000000..5d366655b70
--- /dev/null
+++ b/gcc/ada/g-socthi-dummy.adb
@@ -0,0 +1,34 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- G N A T . S O C K E T S . T H I N --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 2001-2008, AdaCore --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 2, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
+-- for more details. You should have received a copy of the GNU General --
+-- Public License distributed with GNAT; see file COPYING. If not, write --
+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
+-- Boston, MA 02110-1301, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, or you link this unit with other files to produce an executable, --
+-- this unit does not by itself cause the resulting executable to be --
+-- covered by the GNU General Public License. This exception does not --
+-- however invalidate any other reasons why the executable file might be --
+-- covered by the GNU Public License. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+pragma No_Body;
diff --git a/gcc/ada/g-socthi-dummy.ads b/gcc/ada/g-socthi-dummy.ads
new file mode 100644
index 00000000000..ba87024de18
--- /dev/null
+++ b/gcc/ada/g-socthi-dummy.ads
@@ -0,0 +1,39 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- G N A T . S O C K E T S . T H I N --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 2001-2008, AdaCore --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 2, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
+-- for more details. You should have received a copy of the GNU General --
+-- Public License distributed with GNAT; see file COPYING. If not, write --
+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
+-- Boston, MA 02110-1301, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, or you link this unit with other files to produce an executable, --
+-- this unit does not by itself cause the resulting executable to be --
+-- covered by the GNU General Public License. This exception does not --
+-- however invalidate any other reasons why the executable file might be --
+-- covered by the GNU Public License. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package is a placeholder for the sockets binding for platforms where
+-- it is not implemented.
+
+package GNAT.Sockets.Thin is
+ pragma Unimplemented_Unit;
+end GNAT.Sockets.Thin;
diff --git a/gcc/ada/g-socthi-mingw.adb b/gcc/ada/g-socthi-mingw.adb
index ad99f9be4da..8c048eef132 100644
--- a/gcc/ada/g-socthi-mingw.adb
+++ b/gcc/ada/g-socthi-mingw.adb
@@ -39,7 +39,6 @@
with Interfaces.C.Strings; use Interfaces.C.Strings;
with System; use System;
-with GNAT.Sockets.Constants;
package body GNAT.Sockets.Thin is
@@ -240,8 +239,8 @@ package body GNAT.Sockets.Thin is
Res := Standard_Connect (S, Name, Namelen);
if Res = -1 then
- if Socket_Errno = Constants.EWOULDBLOCK then
- Set_Socket_Errno (Constants.EINPROGRESS);
+ if Socket_Errno = SOSC.EWOULDBLOCK then
+ Set_Socket_Errno (SOSC.EINPROGRESS);
end if;
end if;
@@ -342,7 +341,7 @@ package body GNAT.Sockets.Thin is
if EFS /= No_Fd_Set_Access then
declare
EFSC : constant Fd_Set_Access := New_Socket_Set (EFS);
- Flag : constant C.int := Constants.MSG_PEEK + Constants.MSG_OOB;
+ Flag : constant C.int := SOSC.MSG_PEEK + SOSC.MSG_OOB;
Buffer : Character;
Length : C.int;
Fromlen : aliased C.int;
@@ -488,7 +487,7 @@ package body GNAT.Sockets.Thin is
function Socket_Error_Message
(Errno : Integer) return C.Strings.chars_ptr
is
- use GNAT.Sockets.Constants;
+ use GNAT.Sockets.SOSC;
begin
case Errno is
when EINTR => return Error_Messages (N_EINTR);
diff --git a/gcc/ada/g-socthi-vms.adb b/gcc/ada/g-socthi-vms.adb
index f71bb2387de..0151ef567f4 100644
--- a/gcc/ada/g-socthi-vms.adb
+++ b/gcc/ada/g-socthi-vms.adb
@@ -34,7 +34,6 @@
-- Temporary version for Alpha/VMS
with GNAT.OS_Lib; use GNAT.OS_Lib;
-with GNAT.Sockets.Constants;
with GNAT.Task_Lock;
with Interfaces.C; use Interfaces.C;
@@ -53,7 +52,7 @@ package body GNAT.Sockets.Thin is
-- been set in non-blocking mode by the user.
Quantum : constant Duration := 0.2;
- -- When Constants.Thread_Blocking_IO is False, we set sockets in
+ -- When SOSC.Thread_Blocking_IO is False, we set sockets in
-- non-blocking mode and we spend a period of time Quantum between
-- two attempts on a blocking operation.
@@ -135,14 +134,14 @@ package body GNAT.Sockets.Thin is
begin
loop
R := Syscall_Accept (S, Addr, Addrlen);
- exit when Constants.Thread_Blocking_IO
+ exit when SOSC.Thread_Blocking_IO
or else R /= Failure
or else Non_Blocking_Socket (S)
- or else Errno /= Constants.EWOULDBLOCK;
+ or else Errno /= SOSC.EWOULDBLOCK;
delay Quantum;
end loop;
- if not Constants.Thread_Blocking_IO
+ if not SOSC.Thread_Blocking_IO
and then R /= Failure
then
-- A socket inherits the properties of its server, especially
@@ -150,7 +149,7 @@ package body GNAT.Sockets.Thin is
-- tracks sockets set in non-blocking mode by user.
Set_Non_Blocking_Socket (R, Non_Blocking_Socket (S));
- Discard := Syscall_Ioctl (R, Constants.FIONBIO, Val'Unchecked_Access);
+ Discard := Syscall_Ioctl (R, SOSC.FIONBIO, Val'Unchecked_Access);
end if;
return R;
@@ -170,10 +169,10 @@ package body GNAT.Sockets.Thin is
begin
Res := Syscall_Connect (S, Name, Namelen);
- if Constants.Thread_Blocking_IO
+ if SOSC.Thread_Blocking_IO
or else Res /= Failure
or else Non_Blocking_Socket (S)
- or else Errno /= Constants.EINPROGRESS
+ or else Errno /= SOSC.EINPROGRESS
then
return Res;
end if;
@@ -209,7 +208,7 @@ package body GNAT.Sockets.Thin is
Res := Syscall_Connect (S, Name, Namelen);
- if Res = Failure and then Errno = Constants.EISCONN then
+ if Res = Failure and then Errno = SOSC.EISCONN then
return Thin_Common.Success;
else
@@ -227,8 +226,8 @@ package body GNAT.Sockets.Thin is
Arg : Int_Access) return C.int
is
begin
- if not Constants.Thread_Blocking_IO
- and then Req = Constants.FIONBIO
+ if not SOSC.Thread_Blocking_IO
+ and then Req = SOSC.FIONBIO
then
if Arg.all /= 0 then
Set_Non_Blocking_Socket (S, True);
@@ -253,10 +252,10 @@ package body GNAT.Sockets.Thin is
begin
loop
Res := Syscall_Recv (S, Msg, Len, Flags);
- exit when Constants.Thread_Blocking_IO
+ exit when SOSC.Thread_Blocking_IO
or else Res /= Failure
or else Non_Blocking_Socket (S)
- or else Errno /= Constants.EWOULDBLOCK;
+ or else Errno /= SOSC.EWOULDBLOCK;
delay Quantum;
end loop;
@@ -280,10 +279,10 @@ package body GNAT.Sockets.Thin is
begin
loop
Res := Syscall_Recvfrom (S, Msg, Len, Flags, From, Fromlen);
- exit when Constants.Thread_Blocking_IO
+ exit when SOSC.Thread_Blocking_IO
or else Res /= Failure
or else Non_Blocking_Socket (S)
- or else Errno /= Constants.EWOULDBLOCK;
+ or else Errno /= SOSC.EWOULDBLOCK;
delay Quantum;
end loop;
@@ -305,10 +304,10 @@ package body GNAT.Sockets.Thin is
begin
loop
Res := Syscall_Send (S, Msg, Len, Flags);
- exit when Constants.Thread_Blocking_IO
+ exit when SOSC.Thread_Blocking_IO
or else Res /= Failure
or else Non_Blocking_Socket (S)
- or else Errno /= Constants.EWOULDBLOCK;
+ or else Errno /= SOSC.EWOULDBLOCK;
delay Quantum;
end loop;
@@ -332,10 +331,10 @@ package body GNAT.Sockets.Thin is
begin
loop
Res := Syscall_Sendto (S, Msg, Len, Flags, To, Tolen);
- exit when Constants.Thread_Blocking_IO
+ exit when SOSC.Thread_Blocking_IO
or else Res /= Failure
or else Non_Blocking_Socket (S)
- or else Errno /= Constants.EWOULDBLOCK;
+ or else Errno /= SOSC.EWOULDBLOCK;
delay Quantum;
end loop;
@@ -360,13 +359,13 @@ package body GNAT.Sockets.Thin is
begin
R := Syscall_Socket (Domain, Typ, Protocol);
- if not Constants.Thread_Blocking_IO
+ if not SOSC.Thread_Blocking_IO
and then R /= Failure
then
-- Do not use C_Ioctl as this subprogram tracks sockets set
-- in non-blocking mode by user.
- Discard := Syscall_Ioctl (R, Constants.FIONBIO, Val'Unchecked_Access);
+ Discard := Syscall_Ioctl (R, SOSC.FIONBIO, Val'Unchecked_Access);
Set_Non_Blocking_Socket (R, False);
end if;
@@ -509,7 +508,7 @@ package body GNAT.Sockets.Thin is
(Fd,
Iovec (J).Base.all'Address,
Interfaces.C.int (Iovec (J).Length),
- Constants.MSG_Forced_Flags);
+ SOSC.MSG_Forced_Flags);
if Res < 0 then
return Res;
diff --git a/gcc/ada/g-socthi-vxworks.adb b/gcc/ada/g-socthi-vxworks.adb
index 0077e2777f5..3a1d1fe9a5f 100644
--- a/gcc/ada/g-socthi-vxworks.adb
+++ b/gcc/ada/g-socthi-vxworks.adb
@@ -38,7 +38,6 @@
-- This version is for VxWorks
with GNAT.OS_Lib; use GNAT.OS_Lib;
-with GNAT.Sockets.Constants;
with GNAT.Task_Lock;
with Interfaces.C; use Interfaces.C;
@@ -57,7 +56,7 @@ package body GNAT.Sockets.Thin is
-- been set in non-blocking mode by the user.
Quantum : constant Duration := 0.2;
- -- When Constants.Thread_Blocking_IO is False, we set sockets in
+ -- When SOSC.Thread_Blocking_IO is False, we set sockets in
-- non-blocking mode and we spend a period of time Quantum between
-- two attempts on a blocking operation.
@@ -147,14 +146,14 @@ package body GNAT.Sockets.Thin is
begin
loop
R := Syscall_Accept (S, Addr, Addrlen);
- exit when Constants.Thread_Blocking_IO
+ exit when SOSC.Thread_Blocking_IO
or else R /= Failure
or else Non_Blocking_Socket (S)
- or else Errno /= Constants.EWOULDBLOCK;
+ or else Errno /= SOSC.EWOULDBLOCK;
delay Quantum;
end loop;
- if not Constants.Thread_Blocking_IO
+ if not SOSC.Thread_Blocking_IO
and then R /= Failure
then
-- A socket inherits the properties of its server especially
@@ -162,7 +161,7 @@ package body GNAT.Sockets.Thin is
-- tracks sockets set in non-blocking mode by user.
Set_Non_Blocking_Socket (R, Non_Blocking_Socket (S));
- Res := Syscall_Ioctl (R, Constants.FIONBIO, Val'Unchecked_Access);
+ Res := Syscall_Ioctl (R, SOSC.FIONBIO, Val'Unchecked_Access);
-- Is it OK to ignore result ???
end if;
@@ -183,10 +182,10 @@ package body GNAT.Sockets.Thin is
begin
Res := Syscall_Connect (S, Name, Namelen);
- if Constants.Thread_Blocking_IO
+ if SOSC.Thread_Blocking_IO
or else Res /= Failure
or else Non_Blocking_Socket (S)
- or else Errno /= Constants.EINPROGRESS
+ or else Errno /= SOSC.EINPROGRESS
then
return Res;
end if;
@@ -224,7 +223,7 @@ package body GNAT.Sockets.Thin is
Res := Syscall_Connect (S, Name, Namelen);
if Res = Failure
- and then Errno = Constants.EISCONN
+ and then Errno = SOSC.EISCONN
then
return Thin_Common.Success;
else
@@ -242,8 +241,8 @@ package body GNAT.Sockets.Thin is
Arg : Int_Access) return C.int
is
begin
- if not Constants.Thread_Blocking_IO
- and then Req = Constants.FIONBIO
+ if not SOSC.Thread_Blocking_IO
+ and then Req = SOSC.FIONBIO
then
if Arg.all /= 0 then
Set_Non_Blocking_Socket (S, True);
@@ -268,10 +267,10 @@ package body GNAT.Sockets.Thin is
begin
loop
Res := Syscall_Recv (S, Msg, Len, Flags);
- exit when Constants.Thread_Blocking_IO
+ exit when SOSC.Thread_Blocking_IO
or else Res /= Failure
or else Non_Blocking_Socket (S)
- or else Errno /= Constants.EWOULDBLOCK;
+ or else Errno /= SOSC.EWOULDBLOCK;
delay Quantum;
end loop;
@@ -295,10 +294,10 @@ package body GNAT.Sockets.Thin is
begin
loop
Res := Syscall_Recvfrom (S, Msg, Len, Flags, From, Fromlen);
- exit when Constants.Thread_Blocking_IO
+ exit when SOSC.Thread_Blocking_IO
or else Res /= Failure
or else Non_Blocking_Socket (S)
- or else Errno /= Constants.EWOULDBLOCK;
+ or else Errno /= SOSC.EWOULDBLOCK;
delay Quantum;
end loop;
@@ -320,10 +319,10 @@ package body GNAT.Sockets.Thin is
begin
loop
Res := Syscall_Send (S, Msg, Len, Flags);
- exit when Constants.Thread_Blocking_IO
+ exit when SOSC.Thread_Blocking_IO
or else Res /= Failure
or else Non_Blocking_Socket (S)
- or else Errno /= Constants.EWOULDBLOCK;
+ or else Errno /= SOSC.EWOULDBLOCK;
delay Quantum;
end loop;
@@ -347,10 +346,10 @@ package body GNAT.Sockets.Thin is
begin
loop
Res := Syscall_Sendto (S, Msg, Len, Flags, To, Tolen);
- exit when Constants.Thread_Blocking_IO
+ exit when SOSC.Thread_Blocking_IO
or else Res /= Failure
or else Non_Blocking_Socket (S)
- or else Errno /= Constants.EWOULDBLOCK;
+ or else Errno /= SOSC.EWOULDBLOCK;
delay Quantum;
end loop;
@@ -375,13 +374,13 @@ package body GNAT.Sockets.Thin is
begin
R := Syscall_Socket (Domain, Typ, Protocol);
- if not Constants.Thread_Blocking_IO
+ if not SOSC.Thread_Blocking_IO
and then R /= Failure
then
-- Do not use C_Ioctl as this subprogram tracks sockets set
-- in non-blocking mode by user.
- Res := Syscall_Ioctl (R, Constants.FIONBIO, Val'Unchecked_Access);
+ Res := Syscall_Ioctl (R, SOSC.FIONBIO, Val'Unchecked_Access);
-- Is it OK to ignore result ???
Set_Non_Blocking_Socket (R, False);
end if;
diff --git a/gcc/ada/g-socthi.adb b/gcc/ada/g-socthi.adb
index 19642aa893d..57b76bc2fe0 100644
--- a/gcc/ada/g-socthi.adb
+++ b/gcc/ada/g-socthi.adb
@@ -38,7 +38,6 @@
-- This is the default version
with GNAT.OS_Lib; use GNAT.OS_Lib;
-with GNAT.Sockets.Constants;
with GNAT.Task_Lock;
with Interfaces.C; use Interfaces.C;
@@ -57,7 +56,7 @@ package body GNAT.Sockets.Thin is
-- been set in non-blocking mode by the user.
Quantum : constant Duration := 0.2;
- -- When Constants.Thread_Blocking_IO is False, we set sockets in
+ -- When SOSC.Thread_Blocking_IO is False, we set sockets in
-- non-blocking mode and we spend a period of time Quantum between
-- two attempts on a blocking operation.
@@ -151,14 +150,14 @@ package body GNAT.Sockets.Thin is
begin
loop
R := Syscall_Accept (S, Addr, Addrlen);
- exit when Constants.Thread_Blocking_IO
+ exit when SOSC.Thread_Blocking_IO
or else R /= Failure
or else Non_Blocking_Socket (S)
- or else Errno /= Constants.EWOULDBLOCK;
+ or else Errno /= SOSC.EWOULDBLOCK;
delay Quantum;
end loop;
- if not Constants.Thread_Blocking_IO
+ if not SOSC.Thread_Blocking_IO
and then R /= Failure
then
-- A socket inherits the properties ot its server especially
@@ -166,7 +165,7 @@ package body GNAT.Sockets.Thin is
-- tracks sockets set in non-blocking mode by user.
Set_Non_Blocking_Socket (R, Non_Blocking_Socket (S));
- Discard := Syscall_Ioctl (R, Constants.FIONBIO, Val'Unchecked_Access);
+ Discard := Syscall_Ioctl (R, SOSC.FIONBIO, Val'Unchecked_Access);
end if;
Disable_SIGPIPE (R);
@@ -187,10 +186,10 @@ package body GNAT.Sockets.Thin is
begin
Res := Syscall_Connect (S, Name, Namelen);
- if Constants.Thread_Blocking_IO
+ if SOSC.Thread_Blocking_IO
or else Res /= Failure
or else Non_Blocking_Socket (S)
- or else Errno /= Constants.EINPROGRESS
+ or else Errno /= SOSC.EINPROGRESS
then
return Res;
end if;
@@ -227,7 +226,7 @@ package body GNAT.Sockets.Thin is
Res := Syscall_Connect (S, Name, Namelen);
if Res = Failure
- and then Errno = Constants.EISCONN
+ and then Errno = SOSC.EISCONN
then
return Thin_Common.Success;
else
@@ -245,8 +244,8 @@ package body GNAT.Sockets.Thin is
Arg : Int_Access) return C.int
is
begin
- if not Constants.Thread_Blocking_IO
- and then Req = Constants.FIONBIO
+ if not SOSC.Thread_Blocking_IO
+ and then Req = SOSC.FIONBIO
then
if Arg.all /= 0 then
Set_Non_Blocking_Socket (S, True);
@@ -271,10 +270,10 @@ package body GNAT.Sockets.Thin is
begin
loop
Res := Syscall_Recv (S, Msg, Len, Flags);
- exit when Constants.Thread_Blocking_IO
+ exit when SOSC.Thread_Blocking_IO
or else Res /= Failure
or else Non_Blocking_Socket (S)
- or else Errno /= Constants.EWOULDBLOCK;
+ or else Errno /= SOSC.EWOULDBLOCK;
delay Quantum;
end loop;
@@ -298,10 +297,10 @@ package body GNAT.Sockets.Thin is
begin
loop
Res := Syscall_Recvfrom (S, Msg, Len, Flags, From, Fromlen);
- exit when Constants.Thread_Blocking_IO
+ exit when SOSC.Thread_Blocking_IO
or else Res /= Failure
or else Non_Blocking_Socket (S)
- or else Errno /= Constants.EWOULDBLOCK;
+ or else Errno /= SOSC.EWOULDBLOCK;
delay Quantum;
end loop;
@@ -323,10 +322,10 @@ package body GNAT.Sockets.Thin is
begin
loop
Res := Syscall_Send (S, Msg, Len, Flags);
- exit when Constants.Thread_Blocking_IO
+ exit when SOSC.Thread_Blocking_IO
or else Res /= Failure
or else Non_Blocking_Socket (S)
- or else Errno /= Constants.EWOULDBLOCK;
+ or else Errno /= SOSC.EWOULDBLOCK;
delay Quantum;
end loop;
@@ -350,10 +349,10 @@ package body GNAT.Sockets.Thin is
begin
loop
Res := Syscall_Sendto (S, Msg, Len, Flags, To, Tolen);
- exit when Constants.Thread_Blocking_IO
+ exit when SOSC.Thread_Blocking_IO
or else Res /= Failure
or else Non_Blocking_Socket (S)
- or else Errno /= Constants.EWOULDBLOCK;
+ or else Errno /= SOSC.EWOULDBLOCK;
delay Quantum;
end loop;
@@ -378,13 +377,13 @@ package body GNAT.Sockets.Thin is
begin
R := Syscall_Socket (Domain, Typ, Protocol);
- if not Constants.Thread_Blocking_IO
+ if not SOSC.Thread_Blocking_IO
and then R /= Failure
then
-- Do not use C_Ioctl as this subprogram tracks sockets set
-- in non-blocking mode by user.
- Discard := Syscall_Ioctl (R, Constants.FIONBIO, Val'Unchecked_Access);
+ Discard := Syscall_Ioctl (R, SOSC.FIONBIO, Val'Unchecked_Access);
Set_Non_Blocking_Socket (R, False);
end if;
Disable_SIGPIPE (R);
diff --git a/gcc/ada/g-sothco-dummy.adb b/gcc/ada/g-sothco-dummy.adb
new file mode 100644
index 00000000000..c4b8e0bbd71
--- /dev/null
+++ b/gcc/ada/g-sothco-dummy.adb
@@ -0,0 +1,34 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- G N A T . S O C K E T S . T H I N _ C O M M O N --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 2008, AdaCore --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 2, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
+-- for more details. You should have received a copy of the GNU General --
+-- Public License distributed with GNAT; see file COPYING. If not, write --
+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
+-- Boston, MA 02110-1301, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, or you link this unit with other files to produce an executable, --
+-- this unit does not by itself cause the resulting executable to be --
+-- covered by the GNU General Public License. This exception does not --
+-- however invalidate any other reasons why the executable file might be --
+-- covered by the GNU Public License. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+pragma No_Body;
diff --git a/gcc/ada/g-sothco-dummy.ads b/gcc/ada/g-sothco-dummy.ads
new file mode 100644
index 00000000000..9970e9ee81c
--- /dev/null
+++ b/gcc/ada/g-sothco-dummy.ads
@@ -0,0 +1,39 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- G N A T . S O C K E T S . T H I N _ C O M M O N --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 2008, AdaCore --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 2, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
+-- for more details. You should have received a copy of the GNU General --
+-- Public License distributed with GNAT; see file COPYING. If not, write --
+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
+-- Boston, MA 02110-1301, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, or you link this unit with other files to produce an executable, --
+-- this unit does not by itself cause the resulting executable to be --
+-- covered by the GNU General Public License. This exception does not --
+-- however invalidate any other reasons why the executable file might be --
+-- covered by the GNU Public License. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package is a placeholder for the sockets binding for platforms where
+-- it is not implemented.
+
+package GNAT.Sockets.Thin_Common is
+ pragma Unimplemented_Unit;
+end GNAT.Sockets.Thin_Common;
diff --git a/gcc/ada/g-sothco.adb b/gcc/ada/g-sothco.adb
index 590bffeee80..7a8b5a13e00 100644
--- a/gcc/ada/g-sothco.adb
+++ b/gcc/ada/g-sothco.adb
@@ -54,7 +54,7 @@ package body GNAT.Sockets.Thin_Common is
Family : Family_Type)
is
C_Family : C.int renames Families (Family);
- Has_Sockaddr_Len : constant Boolean := Constants.Has_Sockaddr_Len /= 0;
+ Has_Sockaddr_Len : constant Boolean := SOSC.Has_Sockaddr_Len /= 0;
begin
if Has_Sockaddr_Len then
Length_And_Family.Length := Lengths (Family);
diff --git a/gcc/ada/g-sothco.ads b/gcc/ada/g-sothco.ads
index fee37615fb4..434557d1f08 100644
--- a/gcc/ada/g-sothco.ads
+++ b/gcc/ada/g-sothco.ads
@@ -40,8 +40,6 @@ with Interfaces.C;
with Interfaces.C.Pointers;
with Interfaces.C.Strings;
-with GNAT.Sockets.Constants;
-
package GNAT.Sockets.Thin_Common is
package C renames Interfaces.C;
@@ -53,15 +51,15 @@ package GNAT.Sockets.Thin_Common is
Failure : constant C.int := -1;
type time_t is
- range -2 ** (8 * Constants.SIZEOF_tv_sec - 1)
- .. 2 ** (8 * Constants.SIZEOF_tv_sec - 1) - 1;
- for time_t'Size use 8 * Constants.SIZEOF_tv_sec;
+ range -2 ** (8 * SOSC.SIZEOF_tv_sec - 1)
+ .. 2 ** (8 * SOSC.SIZEOF_tv_sec - 1) - 1;
+ for time_t'Size use 8 * SOSC.SIZEOF_tv_sec;
pragma Convention (C, time_t);
type suseconds_t is
- range -2 ** (8 * Constants.SIZEOF_tv_usec - 1)
- .. 2 ** (8 * Constants.SIZEOF_tv_usec - 1) - 1;
- for suseconds_t'Size use 8 * Constants.SIZEOF_tv_usec;
+ range -2 ** (8 * SOSC.SIZEOF_tv_usec - 1)
+ .. 2 ** (8 * SOSC.SIZEOF_tv_usec - 1) - 1;
+ for suseconds_t'Size use 8 * SOSC.SIZEOF_tv_usec;
pragma Convention (C, suseconds_t);
type Timeval is record
@@ -80,12 +78,12 @@ package GNAT.Sockets.Thin_Common is
-------------------------------------------
Families : constant array (Family_Type) of C.int :=
- (Family_Inet => Constants.AF_INET,
- Family_Inet6 => Constants.AF_INET6);
+ (Family_Inet => SOSC.AF_INET,
+ Family_Inet6 => SOSC.AF_INET6);
Lengths : constant array (Family_Type) of C.unsigned_char :=
- (Family_Inet => Constants.SIZEOF_sockaddr_in,
- Family_Inet6 => Constants.SIZEOF_sockaddr_in6);
+ (Family_Inet => SOSC.SIZEOF_sockaddr_in,
+ Family_Inet6 => SOSC.SIZEOF_sockaddr_in6);
----------------------------
-- Generic socket address --
@@ -97,7 +95,7 @@ package GNAT.Sockets.Thin_Common is
-- and protocol specific address types) start with the same 2-byte header,
-- which is either a length and a family (one byte each) or just a two-byte
-- family. The following unchecked union describes the two possible layouts
- -- and is meant to be constrained with Constants.Have_Sockaddr_Len.
+ -- and is meant to be constrained with SOSC.Have_Sockaddr_Len.
type Sockaddr_Length_And_Family
(Has_Sockaddr_Len : Boolean := False)
@@ -233,8 +231,8 @@ package GNAT.Sockets.Thin_Common is
type Hostent is record
H_Name : C.Strings.chars_ptr;
H_Aliases : Chars_Ptr_Pointers.Pointer;
- H_Addrtype : Constants.H_Addrtype_T;
- H_Length : Constants.H_Length_T;
+ H_Addrtype : SOSC.H_Addrtype_T;
+ H_Length : SOSC.H_Length_T;
H_Addr_List : In_Addr_Access_Pointers.Pointer;
end record;
pragma Convention (C, Hostent);
diff --git a/gcc/ada/g-stheme.adb b/gcc/ada/g-stheme.adb
index 25d6c61921d..5222f448dcf 100644
--- a/gcc/ada/g-stheme.adb
+++ b/gcc/ada/g-stheme.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2007, AdaCore --
+-- Copyright (C) 2007-2008, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -54,16 +54,16 @@ package body Host_Error_Messages is
renames To_Chars_Ptr;
begin
case H_Errno is
- when Constants.HOST_NOT_FOUND =>
+ when SOSC.HOST_NOT_FOUND =>
return TCP (Messages.HOST_NOT_FOUND'Access);
- when Constants.TRY_AGAIN =>
+ when SOSC.TRY_AGAIN =>
return TCP (Messages.TRY_AGAIN'Access);
- when Constants.NO_RECOVERY =>
+ when SOSC.NO_RECOVERY =>
return TCP (Messages.NO_RECOVERY'Access);
- when Constants.NO_DATA =>
+ when SOSC.NO_DATA =>
return TCP (Messages.NO_DATA'Access);
when others =>
diff --git a/gcc/ada/g-stsifd-sockets.adb b/gcc/ada/g-stsifd-sockets.adb
index 44bf2d8056e..5fe43af4654 100644
--- a/gcc/ada/g-stsifd-sockets.adb
+++ b/gcc/ada/g-stsifd-sockets.adb
@@ -82,7 +82,7 @@ package body Signalling_Fds is
-- Create a listening socket
- L_Sock := C_Socket (Constants.AF_INET, Constants.SOCK_STREAM, 0);
+ L_Sock := C_Socket (SOSC.AF_INET, SOSC.SOCK_STREAM, 0);
if L_Sock = Failure then
goto Fail;
@@ -122,7 +122,7 @@ package body Signalling_Fds is
-- Create read end (client) socket
- R_Sock := C_Socket (Constants.AF_INET, Constants.SOCK_STREAM, 0);
+ R_Sock := C_Socket (SOSC.AF_INET, SOSC.SOCK_STREAM, 0);
if R_Sock = Failure then
goto Fail;
@@ -134,7 +134,7 @@ package body Signalling_Fds is
exit when Res /= Failure;
- if Socket_Errno /= Constants.EADDRINUSE then
+ if Socket_Errno /= SOSC.EADDRINUSE then
goto Fail;
end if;
@@ -152,7 +152,7 @@ package body Signalling_Fds is
pragma Assert (Res = Failure
and then
- Socket_Errno = Constants.EADDRINUSE);
+ Socket_Errno = SOSC.EADDRINUSE);
pragma Warnings (Off); -- useless assignment to "Res"
Res := C_Close (W_Sock);
pragma Warnings (On);
@@ -217,7 +217,7 @@ package body Signalling_Fds is
function Read (Rsig : C.int) return C.int is
Buf : aliased Character;
begin
- return C_Recv (Rsig, Buf'Address, 1, Constants.MSG_Forced_Flags);
+ return C_Recv (Rsig, Buf'Address, 1, SOSC.MSG_Forced_Flags);
end Read;
-----------
@@ -227,7 +227,7 @@ package body Signalling_Fds is
function Write (Wsig : C.int) return C.int is
Buf : aliased Character := ASCII.NUL;
begin
- return C_Send (Wsig, Buf'Address, 1, Constants.MSG_Forced_Flags);
+ return C_Send (Wsig, Buf'Address, 1, SOSC.MSG_Forced_Flags);
end Write;
end Signalling_Fds;
diff --git a/gcc/ada/g-sttsne-dummy.ads b/gcc/ada/g-sttsne-dummy.ads
new file mode 100644
index 00000000000..789e61c367f
--- /dev/null
+++ b/gcc/ada/g-sttsne-dummy.ads
@@ -0,0 +1,39 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- G N A T . S O C K E T S . T H I N . T A S K _ S A F E _ N E T D B --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 2007, AdaCore --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 2, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
+-- for more details. You should have received a copy of the GNU General --
+-- Public License distributed with GNAT; see file COPYING. If not, write --
+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
+-- Boston, MA 02110-1301, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, or you link this unit with other files to produce an executable, --
+-- this unit does not by itself cause the resulting executable to be --
+-- covered by the GNU General Public License. This exception does not --
+-- however invalidate any other reasons why the executable file might be --
+-- covered by the GNU Public License. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package is a placeholder for the sockets binding for platforms where
+-- it is not implemented.
+
+package GNAT.Sockets.Thin.Task_Safe_NetDB is
+ pragma Unimplemented_Unit;
+end GNAT.Sockets.Thin.Task_Safe_NetDB;
diff --git a/gcc/ada/g-sttsne-vxworks.adb b/gcc/ada/g-sttsne-vxworks.adb
index 7f14255e47d..be0578d048c 100644
--- a/gcc/ada/g-sttsne-vxworks.adb
+++ b/gcc/ada/g-sttsne-vxworks.adb
@@ -36,7 +36,6 @@
with Ada.Unchecked_Conversion;
with Interfaces.C; use Interfaces.C;
-with GNAT.Sockets.Constants;
package body GNAT.Sockets.Thin.Task_Safe_NetDB is
@@ -82,7 +81,7 @@ package body GNAT.Sockets.Thin.Task_Safe_NetDB is
-- VxWorks does not provide h_errno
begin
- pragma Assert (Addr_Type = Constants.AF_INET);
+ pragma Assert (Addr_Type = SOSC.AF_INET);
pragma Assert (Addr_Len = In_Addr'Size / 8);
-- Check that provided buffer is sufficiently large to hold the
@@ -94,7 +93,7 @@ package body GNAT.Sockets.Thin.Task_Safe_NetDB is
if VxWorks_hostGetByAddr (To_Pointer (Addr).all,
Netdb_Data.Name'Address)
- /= Constants.OK
+ /= SOSC.OK
then
return -1;
end if;
@@ -107,7 +106,7 @@ package body GNAT.Sockets.Thin.Task_Safe_NetDB is
Ret.H_Name := C.Strings.To_Chars_Ptr
(Netdb_Data.Name'Unrestricted_Access);
Ret.H_Aliases := Alias_Access;
- Ret.H_Addrtype := Constants.AF_INET;
+ Ret.H_Addrtype := SOSC.AF_INET;
Ret.H_Length := 4;
Ret.H_Addr_List :=
Netdb_Data.Addr_List (Netdb_Data.Addr_List'First)'Unchecked_Access;
@@ -136,7 +135,7 @@ package body GNAT.Sockets.Thin.Task_Safe_NetDB is
begin
Addr := VxWorks_hostGetByName (Name);
- if Addr = Constants.ERROR then
+ if Addr = SOSC.ERROR then
return -1;
end if;
@@ -162,7 +161,7 @@ package body GNAT.Sockets.Thin.Task_Safe_NetDB is
Ret.H_Name := C.Strings.To_Chars_Ptr
(Netdb_Data.Name'Unrestricted_Access);
Ret.H_Aliases := Alias_Access;
- Ret.H_Addrtype := Constants.AF_INET;
+ Ret.H_Addrtype := SOSC.AF_INET;
Ret.H_Length := 4;
Ret.H_Addr_List :=
Netdb_Data.Addr_List (Netdb_Data.Addr_List'First)'Unchecked_Access;
diff --git a/gcc/ada/Make-lang.in b/gcc/ada/gcc-interface/Make-lang.in
index 4136ebe5dca..40017100128 100644
--- a/gcc/ada/Make-lang.in
+++ b/gcc/ada/gcc-interface/Make-lang.in
@@ -55,12 +55,10 @@ else
ADAFLAGS= $(COMMON_ADAFLAGS)
endif
-ALL_ADAFLAGS = $(CFLAGS) $(ALL_ADA_CFLAGS) $(X_ADAFLAGS) $(T_ADAFLAGS) \
- $(ADAFLAGS)
+ALL_ADAFLAGS = $(CFLAGS) $(ADA_CFLAGS) $(ADAFLAGS)
FORCE_DEBUG_ADAFLAGS = -g
ADA_CFLAGS =
-ALL_ADA_CFLAGS = $(X_ADA_CFLAGS) $(T_ADA_CFLAGS) $(ADA_CFLAGS)
-ADA_INCLUDES = -nostdinc -I- -I. -Iada -I$(srcdir)/ada
+ADA_INCLUDES = -nostdinc -I- -I. -Iada -I$(srcdir)/ada -I$(srcdir)/ada/gcc-interface
ADA_INCLUDE_DIR = $(libsubdir)/adainclude
ADA_RTL_OBJ_DIR = $(libsubdir)/adalib
ADA_FLAGS_TO_PASS = \
@@ -76,9 +74,9 @@ ADA_FLAGS_TO_PASS = \
# Say how to compile Ada programs.
.SUFFIXES: .ada .adb .ads
-# FIXME: need to add $(ALL_ADA_CFLAGS) to .c.o suffix rule
+# FIXME: need to add $(ADA_CFLAGS) to .c.o suffix rule
# Use loose warnings for this front end, but add some special flags
-ada-warn = $(ALL_ADA_CFLAGS) $(WERROR)
+ada-warn = $(ADA_CFLAGS) $(WERROR)
# unresolved warnings in a couple of files
ada/tracebak.o-warn = -Wno-error
ada/b_gnat1.o-warn = -Wno-error
@@ -301,8 +299,8 @@ TARGET_ADA_SRCS =
# Since the RTL should be built with the latest compiler, remove the
# stamp target in the parent directory whenever gnat1 is rebuilt
gnat1$(exeext): $(TARGET_ADA_SRCS) $(GNAT1_OBJS) $(ADA_BACKEND) $(LIBDEPS)
- $(GCC_LINK) -o $@ $(GNAT1_OBJS) $(ADA_BACKEND) $(ALL_CFLAGS) $(LIBS) $(SYSLIBS) $(GMPLIBS)
- $(RM) stamp-gnatlib2 stamp-tools
+ $(GCC_LINK) -o $@ $(GNAT1_OBJS) $(ADA_BACKEND) $(LIBS) $(SYSLIBS) $(GMPLIBS)
+ $(RM) stamp-gnatlib2-rts stamp-tools
gnatbind$(exeext): ada/b_gnatb.o $(CONFIG_H) $(GNATBIND_OBJS)
$(GCC_LINK) -o $@ ada/b_gnatb.o $(GNATBIND_OBJS) $(ALL_CFLAGS) $(LIBS) $(SYSLIBS)
@@ -311,17 +309,6 @@ gnatbind$(exeext): ada/b_gnatb.o $(CONFIG_H) $(GNATBIND_OBJS)
gnat-cross: force
make $(GNAT1_ADA_OBJS) CC="gcc -B../stage1/" CFLAGS="-S -gnatp" \
$(FLAGS_TO_PASS) $(ADA_FLAGS_TO_PASS) HOST_CFLAGS= HOST_CC=cc
-
-gen-soccon: force
- $(MAKE) -C ada $(FLAGS_TO_PASS) \
- GNATLIBFLAGS="$(GNATLIBFLAGS)" \
- GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
- TARGET_LIBGCC2_CFLAGS="$(TARGET_LIBGCC2_CFLAGS)" \
- THREAD_KIND="$(THREAD_KIND)" \
- TRACE="$(TRACE)" \
- LIBGNAT_OBJS=gen-soccon \
- gnatlib
-
# Build hooks:
@@ -924,18 +911,45 @@ ada/sinfo.h : ada/sinfo.ads ada/xsinfo.adb
$(CP) $^ ada/bldtools/sinfo
(cd ada/bldtools/sinfo && $(GNATMAKE) -q xsinfo && ./xsinfo ../../sinfo.h )
-ada/nmake.adb : ada/sinfo.ads ada/nmake.adt ada/xnmake.adb
+ada/nmake.adb : ada/sinfo.ads ada/nmake.adt ada/xnmake.adb ada/xutil.ads ada/xutil.adb
-$(MKDIR) ada/bldtools/nmake_b
$(RM) $(addprefix ada/bldtools/nmake_b/,$(notdir $^))
$(CP) $^ ada/bldtools/nmake_b
(cd ada/bldtools/nmake_b && $(GNATMAKE) -q xnmake && ./xnmake -b ../../nmake.adb )
-ada/nmake.ads : ada/sinfo.ads ada/nmake.adt ada/xnmake.adb ada/nmake.adb
+ada/nmake.ads : ada/sinfo.ads ada/nmake.adt ada/xnmake.adb ada/nmake.adb ada/xutil.ads ada/xutil.adb
-$(MKDIR) ada/bldtools/nmake_s
$(RM) $(addprefix ada/bldtools/nmake_s/,$(notdir $^))
$(CP) $^ ada/bldtools/nmake_s
(cd ada/bldtools/nmake_s && $(GNATMAKE) -q xnmake && ./xnmake -s ../../nmake.ads )
+ifeq ($(strip $(filter-out alpha64 ia64 dec hp vms% openvms% alphavms%,$(subst -, ,$(host)))),)
+OSCONS_CPP=../../../$(DECC) -E /comment=as_is -DNATIVE \
+ -DTARGET='""$(target)""' s-oscons-tmplt.c
+
+OSCONS_EXTRACT=../../../$(DECC) -DNATIVE \
+ -DTARGET='""$(target)""' s-oscons-tmplt.c ; \
+ ld -o s-oscons-tmplt.exe s-oscons-tmplt.obj; \
+ ./s-oscons-tmplt.exe > s-oscons-tmplt.s
+
+else
+OSCONS_CPP=$(GCC_FOR_TARGET) $(CFLAGS_FOR_TARGET) -E -C \
+ -DTARGET=\"$(target)\" s-oscons-tmplt.c > s-oscons-tmplt.i
+OSCONS_EXTRACT=$(GCC_FOR_TARGET) $(CFLAGS_FOR_TARGET) -S s-oscons-tmplt.i
+endif
+
+ada/s-oscons.ads : ada/s-oscons-tmplt.c ada/gsocket.h ada/xoscons.adb ada/xutil.ads ada/xutil.adb
+ -$(MKDIR) ada/bldtools/oscons
+ $(RM) $(addprefix ada/bldtools/oscons/,$(notdir $^))
+ $(CP) $^ ada/bldtools/oscons
+ (cd ada/bldtools/oscons ; gnatmake -q xoscons ; \
+ $(RM) s-oscons-tmplt.i s-oscons-tmplt.s ; \
+ $(OSCONS_CPP) ; \
+ $(OSCONS_EXTRACT) ; \
+ ./xoscons ; \
+ $(RM) ../../s-oscons.ads ; \
+ $(CP) s-oscons.ads ../../s-oscons.ads)
+
update-sources : ada/treeprs.ads ada/einfo.h ada/sinfo.h ada/nmake.adb \
ada/nmake.ads
$(RM) $(addprefix $(srcdir)/ada/,$(notdir $^))
@@ -980,7 +994,7 @@ ada/sdefault.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/s-wchcon.ads ada/system.ads ada/table.adb ada/table.ads ada/tree_io.ads \
ada/types.ads ada/unchdeal.ads ada/unchconv.ads
-ADA_TREE_H = ada/ada-tree.h
+ADA_TREE_H = ada/gcc-interface/ada-tree.h
# force debugging information on s-tasdeb.o so that it is always
# possible to set conditional breakpoints on tasks.
@@ -1058,66 +1072,85 @@ ada/targext.o : ada/targext.c $(SYSTEM_H) coretypes.h $(TM_H)
$< $(OUTPUT_OPTION)
ada/cio.o : ada/cio.c $(CONFIG_H) $(SYSTEM_H) ada/adaint.h
- $(CC) -c $(ALL_CFLAGS) $(ALL_ADA_CFLAGS) \
+ $(CC) -c $(ALL_CFLAGS) $(ADA_CFLAGS) \
$(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
ada/init.o : ada/init.c $(CONFIG_H) $(SYSTEM_H) ada/adaint.h ada/raise.h
- $(CC) -c $(ALL_CFLAGS) $(ALL_ADA_CFLAGS) \
+ $(CC) -c $(ALL_CFLAGS) $(ADA_CFLAGS) \
$(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
ada/initialize.o : ada/initialize.c
- $(CC) -c $(ALL_CFLAGS) $(ALL_ADA_CFLAGS) \
+ $(CC) -c $(ALL_CFLAGS) $(ADA_CFLAGS) \
$(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
ada/raise.o : ada/raise.c $(CONFIG_H) $(SYSTEM_H) ada/adaint.h ada/raise.h
- $(CC) -c $(ALL_CFLAGS) $(ALL_ADA_CFLAGS) \
+ $(CC) -c $(ALL_CFLAGS) $(ADA_CFLAGS) \
$(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
# Need to keep the frame pointer in this file to pop the stack properly on
# some targets.
ada/tracebak.o : ada/tracebak.c $(CONFIG_H) $(SYSTEM_H)
- $(CC) -c $(ALL_CFLAGS) $(ALL_ADA_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
+ $(CC) -c $(ALL_CFLAGS) $(ADA_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
-fno-omit-frame-pointer $< $(OUTPUT_OPTION)
-ada/cuintp.o : ada/cuintp.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(TREE_H) ada/ada.h ada/types.h ada/uintp.h ada/atree.h ada/stringt.h \
- ada/elists.h ada/nlists.h ada/fe.h ada/gigi.h
+ada/cuintp.o : ada/gcc-interface/cuintp.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
+ $(TREE_H) ada/gcc-interface/ada.h ada/types.h ada/uintp.h ada/atree.h ada/stringt.h \
+ ada/elists.h ada/nlists.h ada/fe.h ada/gcc-interface/gigi.h
+ $(CC) -c $(ALL_CFLAGS) -I.. $(ALL_CPPFLAGS) $< -o $@
-ada/decl.o : ada/decl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
- $(FLAGS_H) toplev.h convert.h $(TARGET_H) ada/ada.h ada/types.h ada/atree.h \
+ada/decl.o : ada/gcc-interface/decl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
+ $(TM_H) $(TREE_H) $(FLAGS_H) toplev.h convert.h $(TARGET_H) \
+ ada/gcc-interface/ada.h ada/types.h ada/atree.h \
ada/nlists.h ada/elists.h ada/uintp.h ada/sinfo.h ada/einfo.h ada/snames.h \
- ada/namet.h ada/stringt.h ada/repinfo.h ada/fe.h $(ADA_TREE_H) ada/gigi.h \
+ ada/namet.h ada/stringt.h ada/repinfo.h ada/fe.h $(ADA_TREE_H) \
+ ada/gcc-interface/gigi.h \
$(EXPR_H) gt-ada-decl.h
+ $(CC) -c $(ALL_CFLAGS) -I.. $(ALL_CPPFLAGS) $< -o $@
-ada/misc.o : ada/misc.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
+ada/misc.o : ada/gcc-interface/misc.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
+ $(TM_H) $(TREE_H) \
$(RTL_H) $(EXPR_H) insn-codes.h insn-flags.h insn-config.h recog.h \
$(FLAGS_H) $(DIAGNOSTIC_H) output.h except.h $(TM_P_H) langhooks.h debug.h \
- $(LANGHOOKS_DEF_H) libfuncs.h $(OPTABS_H) ada/ada.h ada/types.h \
+ $(LANGHOOKS_DEF_H) libfuncs.h $(OPTABS_H) ada/gcc-interface/ada.h \
+ ada/types.h \
ada/atree.h ada/nlists.h ada/elists.h ada/sinfo.h ada/einfo.h ada/namet.h \
- ada/stringt.h ada/uintp.h ada/fe.h $(ADA_TREE_H) ada/gigi.h \
+ ada/stringt.h ada/uintp.h ada/fe.h $(ADA_TREE_H) ada/gcc-interface/gigi.h \
ada/adadecode.h opts.h options.h $(TARGET_H) $(REAL_H)
+ $(CC) -c $(ALL_CFLAGS) -I.. $(ALL_CPPFLAGS) $< -o $@
-ada/targtyps.o : ada/targtyps.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(TREE_H) ada/ada.h ada/types.h ada/atree.h ada/nlists.h ada/elists.h \
+ada/targtyps.o : ada/gcc-interface/targtyps.c $(CONFIG_H) $(SYSTEM_H) \
+ coretypes.h $(TM_H) \
+ $(TREE_H) ada/gcc-interface/ada.h ada/types.h ada/atree.h ada/nlists.h \
+ ada/elists.h \
ada/uintp.h ada/sinfo.h ada/einfo.h ada/namet.h ada/snames.h ada/stringt.h \
- ada/urealp.h ada/fe.h $(ADA_TREE_H) ada/gigi.h
+ ada/urealp.h ada/fe.h $(ADA_TREE_H) ada/gcc-interface/gigi.h
+ $(CC) -c $(ALL_CFLAGS) -I.. $(ALL_CPPFLAGS) $< -o $@
-ada/trans.o : ada/trans.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(TREE_H) $(RTL_H) $(EXPR_H) $(FLAGS_H) $(FUNCTION_H) ada/ada.h except.h \
+ada/trans.o : ada/gcc-interface/trans.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
+ $(TM_H) \
+ $(TREE_H) $(RTL_H) $(EXPR_H) $(FLAGS_H) $(FUNCTION_H) \
+ ada/gcc-interface/ada.h except.h \
ada/types.h ada/atree.h ada/nlists.h ada/elists.h ada/uintp.h ada/sinfo.h \
ada/einfo.h ada/namet.h ada/snames.h ada/stringt.h ada/urealp.h ada/fe.h \
- $(ADA_TREE_H) ada/gigi.h gt-ada-trans.h
+ $(ADA_TREE_H) ada/gcc-interface/gigi.h gt-ada-trans.h tree-iterator.h
+ $(CC) -c $(ALL_CFLAGS) -I.. $(ALL_CPPFLAGS) $< -o $@
-ada/utils.o : ada/utils.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
+ada/utils.o : ada/gcc-interface/utils.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
+ $(TM_H) \
$(TREE_H) $(FLAGS_H) $(EXPR_H) convert.h defaults.h langhooks.h \
- ada/ada.h ada/types.h ada/atree.h ada/nlists.h ada/elists.h ada/sinfo.h \
+ ada/gcc-interface/ada.h ada/types.h \
+ ada/atree.h ada/nlists.h ada/elists.h ada/sinfo.h \
ada/einfo.h ada/namet.h ada/stringt.h ada/uintp.h ada/fe.h $(ADA_TREE_H) \
- ada/gigi.h gt-ada-utils.h gtype-ada.h $(TARGET_H)
+ ada/gcc-interface/gigi.h gt-ada-utils.h \
+ gtype-ada.h $(TARGET_H) tree-iterator.h
+ $(CC) -c $(ALL_CFLAGS) -I.. $(ALL_CPPFLAGS) $< -o $@
-ada/utils2.o : ada/utils2.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(TREE_H) $(FLAGS_H) ada/ada.h ada/types.h ada/atree.h ada/nlists.h \
- ada/elists.h ada/sinfo.h ada/einfo.h ada/namet.h ada/snames.h \
- ada/stringt.h ada/uintp.h ada/fe.h $(ADA_TREE_H) ada/gigi.h
+ada/utils2.o : ada/gcc-interface/utils2.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
+ $(TM_H) $(TREE_H) $(FLAGS_H) ada/gcc-interface/ada.h ada/types.h \
+ ada/atree.h ada/nlists.h ada/elists.h ada/sinfo.h ada/einfo.h ada/namet.h \
+ ada/snames.h ada/stringt.h ada/uintp.h ada/fe.h $(ADA_TREE_H) \
+ ada/gcc-interface/gigi.h
+ $(CC) -c $(ALL_CFLAGS) -I.. $(ALL_CPPFLAGS) $< -o $@
#
# DO NOT PUT SPECIAL RULES BELOW, THIS SECTION IS UPDATED AUTOMATICALLY
diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in
new file mode 100644
index 00000000000..28763d7872f
--- /dev/null
+++ b/gcc/ada/gcc-interface/Makefile.in
@@ -0,0 +1,2303 @@
+# Makefile for GNU Ada Compiler (GNAT).
+# Copyright (C) 1994-2008 Free Software Foundation, Inc.
+
+#This file is part of GCC.
+
+#GCC is free software; you can redistribute it and/or modify
+#it under the terms of the GNU General Public License as published by
+#the Free Software Foundation; either version 3, or (at your option)
+#any later version.
+
+#GCC is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+#GNU General Public License for more details.
+
+#You should have received a copy of the GNU General Public License
+#along with GCC; see the file COPYING3. If not see
+#<http://www.gnu.org/licenses/>.
+
+# The makefile built from this file lives in the language subdirectory.
+# Its purpose is to provide support for:
+#
+# 1) recursion where necessary, and only then (building .o's), and
+# 2) building and debugging cc1 from the language subdirectory, and
+# 3) nothing else.
+#
+# The parent makefile handles all other chores, with help from the
+# language makefile fragment, of course.
+#
+# The targets for external use are:
+# all, TAGS, ???mostlyclean, ???clean.
+
+# This makefile will only work with Gnu make.
+# The rules are written assuming a minimum subset of tools are available:
+#
+# Required:
+# MAKE: Only Gnu make will work.
+# MV: Must accept (at least) one, maybe wildcard, source argument,
+# a file or directory destination, and support creation/
+# modification date preservation. Gnu mv -f works.
+# RM: Must accept an arbitrary number of space separated file
+# arguments, or one wildcard argument. Gnu rm works.
+# RMDIR: Must delete a directory and all its contents. Gnu rm -rf works.
+# ECHO: Must support command line redirection. Any Unix-like
+# shell will typically provide this, otherwise a custom version
+# is trivial to write.
+# AR: Gnu ar works.
+# MKDIR: Gnu mkdir works.
+# CHMOD: Gnu chmod works.
+# true: Does nothing and returns a normal successful return code.
+# pwd: Prints the current directory on stdout.
+# cd: Change directory.
+#
+# Optional:
+# BISON: Gnu bison works.
+# FLEX: Gnu flex works.
+# Other miscellaneous tools for obscure targets.
+
+# Suppress smart makes who think they know how to automake Yacc files
+.y.c:
+
+# Variables that exist for you to override.
+# See below for how to change them for certain systems.
+
+# Various ways of specifying flags for compilations:
+# CFLAGS is for the user to override to, e.g., do a bootstrap with -O2.
+# BOOT_CFLAGS is the value of CFLAGS to pass
+# to the stage2 and stage3 compilations
+CFLAGS = -g
+BOOT_CFLAGS = -O $(CFLAGS)
+# These exists to be overridden by the t-* files, respectively.
+T_CFLAGS =
+
+CC = cc
+BISON = bison
+BISONFLAGS =
+ECHO = echo
+LEX = flex
+LEXFLAGS =
+CHMOD = chmod
+LN = ln
+LN_S = ln -s
+CP = cp -p
+MV = mv -f
+RM = rm -f
+RMDIR = rm -rf
+MKDIR = mkdir -p
+AR = ar
+AR_FLAGS = rc
+LS = ls
+RANLIB = @RANLIB@
+RANLIB_FLAGS = @ranlib_flags@
+
+SHELL = @SHELL@
+PWD_COMMAND = $${PWDCMD-pwd}
+# How to copy preserving the date
+INSTALL_DATA_DATE = cp -p
+MAKEINFO = makeinfo
+TEXI2DVI = texi2dvi
+TEXI2PDF = texi2pdf
+GNATBIND_FLAGS = -static -x
+ADA_CFLAGS =
+ADAFLAGS = -W -Wall -gnatpg -gnata
+SOME_ADAFLAGS =-gnata
+FORCE_DEBUG_ADAFLAGS = -g
+GNATLIBFLAGS = -gnatpg -nostdinc
+GNATLIBCFLAGS = -g -O2
+GNATLIBCFLAGS_FOR_C = $(GNATLIBCFLAGS) $(TARGET_LIBGCC2_CFLAGS) -fexceptions \
+ -DIN_RTS
+ALL_ADAFLAGS = $(CFLAGS) $(ADA_CFLAGS) $(ADAFLAGS)
+MOST_ADAFLAGS = $(CFLAGS) $(ADA_CFLAGS) $(SOME_ADAFLAGS)
+THREAD_KIND = native
+THREADSLIB =
+GMEM_LIB =
+MISCLIB =
+SYMDEPS = $(LIBINTL_DEP)
+OUTPUT_OPTION = @OUTPUT_OPTION@
+
+objext = .o
+exeext =
+arext = .a
+soext = .so
+shext =
+hyphen = -
+
+# Define this as & to perform parallel make on a Sequent.
+# Note that this has some bugs, and it seems currently necessary
+# to compile all the gen* files first by hand to avoid erroneous results.
+P =
+
+# This is used instead of ALL_CFLAGS when compiling with GCC_FOR_TARGET.
+# It specifies -B./.
+# It also specifies -B$(tooldir)/ to find as and ld for a cross compiler.
+GCC_CFLAGS = $(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS)
+
+# Tools to use when building a cross-compiler.
+# These are used because `configure' appends `cross-make'
+# to the makefile when making a cross-compiler.
+
+# We don't use cross-make. Instead we use the tools from the build tree,
+# if they are available.
+# program_transform_name and objdir are set by configure.in.
+program_transform_name =
+objdir = .
+
+target_alias=@target_alias@
+target=@target@
+xmake_file = @xmake_file@
+tmake_file = @tmake_file@
+host_canonical=@host@
+#version=`sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/' < $(srcdir)/version.c`
+#mainversion=`sed -e 's/.*\"\([0-9]*\.[0-9]*\).*/\1/' < $(srcdir)/version.c`
+
+# Directory where sources are, from where we are.
+VPATH = $(srcdir)
+
+fsrcdir := $(shell cd $(srcdir);${PWD_COMMAND})
+fsrcpfx := $(shell cd $(srcdir);${PWD_COMMAND})/
+fcurdir := $(shell ${PWD_COMMAND})
+fcurpfx := $(shell ${PWD_COMMAND})/
+
+# Top build directory, relative to here.
+top_builddir = ../..
+
+# Internationalization library.
+LIBINTL = @LIBINTL@
+LIBINTL_DEP = @LIBINTL_DEP@
+
+# Any system libraries needed just for GNAT.
+SYSLIBS = @GNAT_LIBEXC@
+
+# List of extra object files linked in with various programs.
+EXTRA_GNATTOOLS_OBJS = ../../prefix.o ../../version.o
+
+# List of target dependent sources, overridden below as necessary
+TARGET_ADA_SRCS =
+
+# Type of tools build we are doing; default is not compiling tools.
+TOOLSCASE =
+
+# Multilib handling
+MULTISUBDIR =
+RTSDIR = rts$(subst /,_,$(MULTISUBDIR))
+
+# End of variables for you to override.
+
+all: all.indirect
+
+# This tells GNU Make version 3 not to put all variables in the environment.
+.NOEXPORT:
+
+# tmake_file and xmake_file expand to lists with entries of the form
+# $(srcdir)/config/... but here $(srcdir) is the ada subdirectory so we
+# need to adjust the paths. There can't be spaces in the subst arguments
+# or we get spurious spaces in the actual list of files to include.
+
+# target overrides
+ifneq ($(tmake_file),)
+include $(subst /config,/../config,$(tmake_file))
+endif
+
+# host overrides
+ifneq ($(xmake_file),)
+include $(subst /config,/../config,$(xmake_file))
+endif
+
+# Now figure out from those variables how to compile and link.
+
+all.indirect: Makefile ../gnat1$(exeext)
+
+# IN_GCC distinguishes between code compiled into GCC itself and other
+# programs built during a bootstrap.
+# autoconf inserts -DCROSS_DIRECTORY_STRUCTURE if we are building a cross
+# compiler which does not use the native libraries and headers.
+INTERNAL_CFLAGS = @CROSS@ -DIN_GCC
+
+# This is the variable actually used when we compile.
+LOOSE_CFLAGS = `echo $(CFLAGS) $(WARN2_CFLAGS)|sed -e 's/-pedantic//g' -e 's/-Wtraditional//g'`
+ALL_CFLAGS = $(INTERNAL_CFLAGS) $(T_CFLAGS) $(LOOSE_CFLAGS)
+
+# Likewise.
+ALL_CPPFLAGS = $(CPPFLAGS)
+
+# This is where we get libiberty.a from.
+LIBIBERTY = ../../libiberty/libiberty.a
+
+# How to link with both our special library facilities
+# and the system's installed libraries.
+LIBS = $(LIBINTL) $(LIBIBERTY) $(SYSLIBS)
+LIBDEPS = $(LIBINTL_DEP) $(LIBIBERTY)
+# Default is no TGT_LIB; one might be passed down or something
+TGT_LIB =
+TOOLS_LIBS = $(EXTRA_GNATTOOLS_OBJS) targext.o link.o $(LIBGNAT) ../../../libiberty/libiberty.a $(SYSLIBS) $(TGT_LIB)
+
+# Specify the directories to be searched for header files.
+# Both . and srcdir are used, in that order,
+# so that tm.h and config.h will be found in the compilation
+# subdirectory rather than in the source directory.
+INCLUDES = -I- -I. -I.. -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../config \
+ -I$(srcdir)/../../include
+
+ADA_INCLUDES = -I- -I. -I$(srcdir)
+
+INCLUDES_FOR_SUBDIR = -I. -I.. -I../.. -I$(fsrcdir) -I$(fsrcdir)/../config \
+ -I$(fsrcdir)/../../include -I$(fsrcdir)/..
+ADA_INCLUDES_FOR_SUBDIR = -I. -I$(fsrcdir) -I$(fsrcdir)/gcc
+
+# Avoid a lot of time thinking about remaking Makefile.in and *.def.
+.SUFFIXES: .in .def
+
+# Say how to compile Ada programs.
+.SUFFIXES: .ada .adb .ads .asm
+
+# Always use -I$(srcdir)/config when compiling.
+.asm.o:
+ $(CC) -c -x assembler $< $(OUTPUT_OPTION)
+
+.c.o:
+ $(CC) -c $(ALL_CFLAGS) $(ADA_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< \
+ $(OUTPUT_OPTION)
+
+.adb.o:
+ $(CC) -c $(ALL_ADAFLAGS) $(ADA_INCLUDES) $< $(OUTPUT_OPTION)
+
+.ads.o:
+ $(CC) -c $(ALL_ADAFLAGS) $(ADA_INCLUDES) $< $(OUTPUT_OPTION)
+
+# how to regenerate this file
+Makefile: ../config.status $(srcdir)/gcc-interface/Makefile.in $(srcdir)/Makefile.in $(srcdir)/../version.c
+ cd ..; \
+ LANGUAGES="$(CONFIG_LANGUAGES)" \
+ CONFIG_HEADERS= \
+ CONFIG_FILES="ada/gcc-interface/Makefile ada/Makefile" $(SHELL) config.status
+
+# This tells GNU make version 3 not to export all the variables
+# defined in this file into the environment.
+.NOEXPORT:
+
+# Lists of files for various purposes.
+
+GNATLINK_OBJS = gnatlink.o \
+ a-except.o ali.o alloc.o butil.o casing.o csets.o debug.o fmap.o fname.o \
+ gnatvsn.o hostparm.o indepsw.o interfac.o i-c.o i-cstrin.o namet.o opt.o \
+ osint.o output.o rident.o s-exctab.o s-secsta.o s-stalib.o s-stoele.o \
+ sdefault.o snames.o stylesw.o switch.o system.o table.o targparm.o tree_io.o \
+ types.o validsw.o widechar.o
+
+GNATMAKE_OBJS = a-except.o ali.o ali-util.o s-casuti.o \
+ alloc.o atree.o binderr.o butil.o casing.o csets.o debug.o elists.o einfo.o\
+ erroutc.o errutil.o err_vars.o fmap.o fname.o fname-uf.o fname-sf.o \
+ gnatmake.o gnatvsn.o hostparm.o interfac.o i-c.o i-cstrin.o krunch.o lib.o \
+ make.o makeusg.o makeutl.o mlib.o mlib-fil.o mlib-prj.o mlib-tgt.o \
+ mlib-tgt-specific.o mlib-utl.o namet.o nlists.o opt.o osint.o osint-m.o output.o \
+ prj.o prj-attr.o prj-attr-pm.o prj-com.o prj-dect.o prj-env.o prj-err.o prj-ext.o prj-nmsc.o \
+ prj-pars.o prj-part.o prj-proc.o prj-strt.o prj-tree.o prj-util.o \
+ rident.o s-exctab.o s-secsta.o s-stalib.o s-stoele.o \
+ scans.o scng.o sdefault.o sfn_scan.o s-purexc.o s-htable.o \
+ sinfo.o sinput.o sinput-c.o sinput-p.o \
+ snames.o stand.o stringt.o styleg.o stylesw.o system.o validsw.o switch.o switch-m.o \
+ table.o targparm.o tempdir.o tree_io.o types.o \
+ uintp.o uname.o urealp.o usage.o widechar.o \
+ $(EXTRA_GNATMAKE_OBJS)
+
+# Convert the target variable into a space separated list of architecture,
+# manufacturer, and operating system and assign each of those to its own
+# variable.
+
+host:=$(subst -, ,$(host_canonical))
+targ:=$(subst -, ,$(target))
+arch:=$(word 1,$(targ))
+ifeq ($(words $(targ)),2)
+ manu:=
+ osys:=$(word 2,$(targ))
+else
+ manu:=$(word 2,$(targ))
+ osys:=$(word 3,$(targ))
+endif
+
+# LIBGNAT_TARGET_PAIRS is a list of pairs of filenames.
+# The members of each pair must be separated by a '<' and no whitespace.
+# Each pair must be separated by some amount of whitespace from the following
+# pair.
+
+# Non-tasking case:
+
+LIBGNAT_TARGET_PAIRS = \
+a-intnam.ads<a-intnam-dummy.ads \
+s-inmaop.adb<s-inmaop-dummy.adb \
+s-intman.adb<s-intman-dummy.adb \
+s-osinte.ads<s-osinte-dummy.ads \
+s-osprim.adb<s-osprim-posix.adb \
+s-taprop.adb<s-taprop-dummy.adb \
+s-taspri.ads<s-taspri-dummy.ads
+
+# When using the GCC exception handling mechanism, we need to use an
+# alternate body for a-exexpr.adb (a-exexpr-gcc.adb)
+
+EH_MECHANISM=
+
+# Default shared object option. Note that we rely on the fact that the "soname"
+# option will always be present and last in this flag, so that we can have
+# $(SO_OPTS)libgnat-x.xx
+
+SO_OPTS = -Wl,-soname,
+
+# Default gnatlib-shared target.
+# By default, equivalent to gnatlib.
+# Set to gnatlib-shared-default, gnatlib-shared-dual, or a platform specific
+# target when supported.
+GNATLIB_SHARED = gnatlib
+
+# default value for gnatmake's target dependent file
+MLIB_TGT = mlib-tgt
+
+# By default, do not distribute prefix.o (in libgccprefix), since it is only
+# needed by external GNAT tools such as gnatdist and Glide.
+# Override this variable on native platforms when needed.
+PREFIX_OBJS =
+
+# To avoid duplicate code, use this variable to set PREFIX_OBJS when needed:
+PREFIX_REAL_OBJS = ../prefix.o \
+ ../../libiberty/concat.o \
+ ../../libiberty/xmalloc.o \
+ ../../libiberty/xstrdup.o \
+ ../../libiberty/xexit.o
+
+# By default, build socket support units. On platforms that do not support
+# sockets, reset this variable to empty and add DUMMY_SOCKETS_TARGET_PAIRS
+# to LIBGNAT_TARGET_PAIRS.
+
+GNATRTL_SOCKETS_OBJS = g-soccon$(objext) g-socket$(objext) g-socthi$(objext) \
+ g-soliop$(objext) g-sothco$(objext) g-sttsne$(objext)
+
+DUMMY_SOCKETS_TARGET_PAIRS = \
+ g-socket.adb<g-socket-dummy.adb \
+ g-socket.ads<g-socket-dummy.ads \
+ g-socthi.adb<g-socthi-dummy.adb \
+ g-socthi.ads<g-socthi-dummy.ads \
+ g-sothco.adb<g-sothco-dummy.adb \
+ g-sothco.ads<g-sothco-dummy.ads \
+ g-sttsne.ads<g-sttsne-dummy.ads
+
+LIB_VERSION = $(strip $(shell grep ' Library_Version :' $(fsrcpfx)gnatvsn.ads | sed -e 's/.*"\(.*\)".*/\1/'))
+
+# $(filter-out PATTERN...,TEXT) removes all PATTERN words from TEXT.
+# $(strip STRING) removes leading and trailing spaces from STRING.
+# If what's left is null then it's a match.
+
+ifeq ($(strip $(filter-out m68k% wrs vx%,$(targ))),)
+ LIBGNAT_TARGET_PAIRS = \
+ a-intnam.ads<a-intnam-vxworks.ads \
+ a-numaux.ads<a-numaux-vxworks.ads \
+ s-inmaop.adb<s-inmaop-posix.adb \
+ s-interr.adb<s-interr-vxworks.adb \
+ s-intman.ads<s-intman-vxworks.ads \
+ s-intman.adb<s-intman-vxworks.adb \
+ s-osinte.adb<s-osinte-vxworks.adb \
+ s-osinte.ads<s-osinte-vxworks.ads \
+ s-osprim.adb<s-osprim-vxworks.adb \
+ s-parame.ads<s-parame-vxworks.ads \
+ s-parame.adb<s-parame-vxworks.adb \
+ s-stchop.ads<s-stchop-limit.ads \
+ s-stchop.adb<s-stchop-vxworks.adb \
+ s-taprop.adb<s-taprop-vxworks.adb \
+ s-taspri.ads<s-taspri-vxworks.ads \
+ s-tpopsp.adb<s-tpopsp-vxworks.adb \
+ s-vxwork.ads<s-vxwork-m68k.ads \
+ g-socthi.ads<g-socthi-vxworks.ads \
+ g-socthi.adb<g-socthi-vxworks.adb \
+ g-stsifd.adb<g-stsifd-sockets.adb \
+ g-sttsne.adb<g-sttsne-vxworks.adb \
+ g-sttsne.ads<g-sttsne-locking.ads \
+ system.ads<system-vxworks-m68k.ads
+
+ TOOLS_TARGET_PAIRS=mlib-tgt-specific.adb<mlib-tgt-specific-vxworks.adb
+
+ EXTRA_GNATRTL_NONTASKING_OBJS=i-vxwork.o i-vxwoio.o
+ EXTRA_GNATRTL_TASKING_OBJS=s-vxwork.o
+
+ EXTRA_LIBGNAT_SRCS+=vx_stack_info.c
+ EXTRA_LIBGNAT_OBJS+=vx_stack_info.o
+
+ ifeq ($(strip $(filter-out yes,$(TRACE))),)
+ LIBGNAT_TARGET_PAIRS += \
+ s-traces.adb<s-traces-default.adb \
+ s-tratas.adb<s-tratas-default.adb \
+ s-trafor.adb<s-trafor-default.adb \
+ s-trafor.ads<s-trafor-default.ads \
+ s-tfsetr.adb<s-tfsetr-vxworks.adb
+ endif
+endif
+
+ifeq ($(strip $(filter-out powerpc% wrs vxworks,$(targ))),)
+ LIBGNAT_TARGET_PAIRS = \
+ a-intnam.ads<a-intnam-vxworks.ads \
+ a-numaux.ads<a-numaux-vxworks.ads \
+ s-inmaop.adb<s-inmaop-posix.adb \
+ s-intman.ads<s-intman-vxworks.ads \
+ s-intman.adb<s-intman-vxworks.adb \
+ s-osprim.adb<s-osprim-vxworks.adb \
+ s-parame.ads<s-parame-vxworks.ads \
+ s-parame.adb<s-parame-vxworks.adb \
+ s-stchop.ads<s-stchop-limit.ads \
+ s-stchop.adb<s-stchop-vxworks.adb \
+ s-taprop.adb<s-taprop-vxworks.adb \
+ s-taspri.ads<s-taspri-vxworks.ads \
+ s-vxwork.ads<s-vxwork-ppc.ads \
+ g-socthi.ads<g-socthi-vxworks.ads \
+ g-socthi.adb<g-socthi-vxworks.adb \
+ g-stsifd.adb<g-stsifd-sockets.adb \
+ g-sttsne.adb<g-sttsne-vxworks.adb \
+ g-sttsne.ads<g-sttsne-locking.ads
+
+ TOOLS_TARGET_PAIRS=mlib-tgt-specific.adb<mlib-tgt-specific-vxworks.adb
+
+ ifeq ($(strip $(filter-out yes,$(TRACE))),)
+ LIBGNAT_TARGET_PAIRS += \
+ s-traces.adb<s-traces-default.adb \
+ s-trafor.adb<s-trafor-default.adb \
+ s-trafor.ads<s-trafor-default.ads \
+ s-tratas.adb<s-tratas-default.adb \
+ s-tfsetr.adb<s-tfsetr-vxworks.adb
+ endif
+
+ ifeq ($(strip $(filter-out rtp,$(THREAD_KIND))),)
+ LIBGNAT_TARGET_PAIRS += \
+ s-osinte.adb<s-osinte-vxworks-rtp.adb \
+ s-osinte.ads<s-osinte-vxworks6.ads \
+ s-tpopsp.adb<s-tpopsp-vxworks-rtp.adb \
+ system.ads<system-vxworks-ppc-rtp.ads
+
+ EXTRA_GNATRTL_NONTASKING_OBJS=s-vxwexc.o
+ else
+ LIBGNAT_TARGET_PAIRS += \
+ s-interr.adb<s-interr-vxworks.adb \
+ s-tpopsp.adb<s-tpopsp-vxworks.adb \
+ system.ads<system-vxworks-ppc.ads
+
+ ifeq ($(strip $(filter-out kernel,$(THREAD_KIND))),)
+ LIBGNAT_TARGET_PAIRS += \
+ s-osinte.ads<s-osinte-vxworks6.ads \
+ s-osinte.adb<s-osinte-vxworks-kernel.adb
+ else
+ LIBGNAT_TARGET_PAIRS += \
+ s-osinte.ads<s-osinte-vxworks.ads \
+ s-osinte.adb<s-osinte-vxworks.adb
+ endif
+
+ EXTRA_GNATRTL_NONTASKING_OBJS=i-vxwork.o i-vxwoio.o s-vxwexc.o
+ endif
+
+ EXTRA_GNATRTL_TASKING_OBJS=s-vxwork.o
+
+ EXTRA_LIBGNAT_SRCS+=vx_stack_info.c
+ EXTRA_LIBGNAT_OBJS+=vx_stack_info.o
+endif
+
+# vxworksae / vxworks 653
+ifeq ($(strip $(filter-out powerpc% wrs vxworksae,$(targ))),)
+ # target pairs for kernel + vthreads runtime
+ LIBGNAT_TARGET_PAIRS = \
+ a-elchha.adb<a-elchha-vxworks-ppc-full.adb \
+ a-intnam.ads<a-intnam-vxworks.ads \
+ a-numaux.ads<a-numaux-vxworks.ads \
+ g-io.adb<g-io-vxworks-ppc-cert.adb \
+ g-io.ads<g-io-vxworks-ppc-cert.ads \
+ s-inmaop.adb<s-inmaop-posix.adb \
+ s-interr.adb<s-interr-vxworks.adb \
+ s-intman.ads<s-intman-vxworks.ads \
+ s-intman.adb<s-intman-vxworks.adb \
+ s-osinte.adb<s-osinte-vxworks.adb \
+ s-osinte.ads<s-osinte-vxworks.ads \
+ s-osprim.adb<s-osprim-vxworks.adb \
+ s-parame.ads<s-parame-ae653.ads \
+ s-parame.adb<s-parame-vxworks.adb \
+ s-taprop.adb<s-taprop-vxworks.adb \
+ s-taspri.ads<s-taspri-vxworks.ads \
+ s-tpopsp.adb<s-tpopsp-vxworks.adb \
+ s-vxwork.ads<s-vxwork-ppc.ads \
+ g-socthi.ads<g-socthi-vxworks.ads \
+ g-socthi.adb<g-socthi-vxworks.adb \
+ g-stsifd.adb<g-stsifd-sockets.adb \
+ g-sttsne.adb<g-sttsne-vxworks.adb \
+ g-sttsne.ads<g-sttsne-locking.ads \
+ system.ads<system-vxworks-ppc-vthread.ads
+
+ TOOLS_TARGET_PAIRS=mlib-tgt-specific.adb<mlib-tgt-specific-vxworks.adb
+
+ EXTRA_GNATRTL_NONTASKING_OBJS=i-vxwork.o i-vxwoio.o s-vxwexc.o
+ EXTRA_GNATRTL_TASKING_OBJS=s-vxwork.o
+
+ # Extra pairs for the vthreads runtime
+ ifeq ($(strip $(filter-out vthreads,$(THREAD_KIND))),)
+ LIBGNAT_TARGET_PAIRS += \
+ s-thread.adb<s-thread-ae653.adb
+ EXTRA_GNATRTL_NONTASKING_OBJS += s-thread.o
+ endif
+
+ ifeq ($(strip $(filter-out yes,$(TRACE))),)
+ LIBGNAT_TARGET_PAIRS += \
+ s-traces.adb<s-traces-default.adb \
+ s-trafor.adb<s-trafor-default.adb \
+ s-trafor.ads<s-trafor-default.ads \
+ s-tratas.adb<s-tratas-default.adb \
+ s-tfsetr.adb<s-tfsetr-vxworks.adb
+ endif
+endif
+
+ifeq ($(strip $(filter-out sparc% wrs vx%,$(targ))),)
+ LIBGNAT_TARGET_PAIRS = \
+ a-intnam.ads<a-intnam-vxworks.ads \
+ a-numaux.ads<a-numaux-vxworks.ads \
+ s-inmaop.adb<s-inmaop-posix.adb \
+ s-interr.adb<s-interr-vxworks.adb \
+ s-intman.ads<s-intman-vxworks.ads \
+ s-intman.adb<s-intman-vxworks.adb \
+ s-osinte.adb<s-osinte-vxworks.adb \
+ s-osinte.ads<s-osinte-vxworks.ads \
+ s-osprim.adb<s-osprim-vxworks.adb \
+ s-parame.ads<s-parame-vxworks.ads \
+ s-parame.adb<s-parame-vxworks.adb \
+ s-stchop.ads<s-stchop-limit.ads \
+ s-stchop.adb<s-stchop-vxworks.adb \
+ s-taprop.adb<s-taprop-vxworks.adb \
+ s-taspri.ads<s-taspri-vxworks.ads \
+ s-tpopsp.adb<s-tpopsp-vxworks.adb \
+ s-vxwork.ads<s-vxwork-sparcv9.ads \
+ g-socthi.ads<g-socthi-vxworks.ads \
+ g-socthi.adb<g-socthi-vxworks.adb \
+ g-stsifd.adb<g-stsifd-sockets.adb \
+ g-sttsne.adb<g-sttsne-vxworks.adb \
+ g-sttsne.ads<g-sttsne-locking.ads \
+ system.ads<system-vxworks-sparcv9.ads \
+
+ TOOLS_TARGET_PAIRS=mlib-tgt-specific.adb<mlib-tgt-specific-vxworks.adb
+
+ EXTRA_GNATRTL_NONTASKING_OBJS=i-vxwork.o i-vxwoio.o
+ EXTRA_GNATRTL_TASKING_OBJS=s-vxwork.o
+
+ EXTRA_LIBGNAT_SRCS+=vx_stack_info.c
+ EXTRA_LIBGNAT_OBJS+=vx_stack_info.o
+endif
+
+ifeq ($(strip $(filter-out %86 wrs vxworks,$(targ))),)
+ LIBGNAT_TARGET_PAIRS = \
+ a-intnam.ads<a-intnam-vxworks.ads \
+ i-vxwork.ads<i-vxwork-x86.ads \
+ s-inmaop.adb<s-inmaop-posix.adb \
+ s-intman.ads<s-intman-vxworks.ads \
+ s-intman.adb<s-intman-vxworks.adb \
+ a-numaux.adb<a-numaux-x86.adb \
+ a-numaux.ads<a-numaux-x86.ads \
+ s-osprim.adb<s-osprim-vxworks.adb \
+ s-parame.ads<s-parame-vxworks.ads \
+ s-parame.adb<s-parame-vxworks.adb \
+ s-stchop.ads<s-stchop-limit.ads \
+ s-stchop.adb<s-stchop-vxworks.adb \
+ s-taprop.adb<s-taprop-vxworks.adb \
+ s-taspri.ads<s-taspri-vxworks.ads \
+ s-vxwork.ads<s-vxwork-x86.ads \
+ g-bytswa.adb<g-bytswa-x86.adb \
+ g-socthi.ads<g-socthi-vxworks.ads \
+ g-socthi.adb<g-socthi-vxworks.adb \
+ g-stsifd.adb<g-stsifd-sockets.adb \
+ g-sttsne.adb<g-sttsne-vxworks.adb \
+ g-sttsne.ads<g-sttsne-locking.ads
+
+ TOOLS_TARGET_PAIRS=mlib-tgt-specific.adb<mlib-tgt-specific-vxworks.adb
+
+ ifeq ($(strip $(filter-out yes,$(TRACE))),)
+ LIBGNAT_TARGET_PAIRS += \
+ s-traces.adb<s-traces-default.adb \
+ s-trafor.adb<s-trafor-default.adb \
+ s-trafor.ads<s-trafor-default.ads \
+ s-tratas.adb<s-tratas-default.adb \
+ s-tfsetr.adb<s-tfsetr-vxworks.adb
+ endif
+
+ ifeq ($(strip $(filter-out rtp,$(THREAD_KIND))),)
+ LIBGNAT_TARGET_PAIRS += \
+ s-osinte.adb<s-osinte-vxworks-rtp.adb \
+ s-osinte.ads<s-osinte-vxworks6.ads \
+ s-tpopsp.adb<s-tpopsp-vxworks-rtp.adb \
+ system.ads<system-vxworks-x86-rtp.ads
+
+ EXTRA_GNATRTL_NONTASKING_OBJS=s-vxwexc.o
+ else
+ LIBGNAT_TARGET_PAIRS += \
+ s-interr.adb<s-interr-vxworks.adb \
+ s-tpopsp.adb<s-tpopsp-vxworks.adb \
+ system.ads<system-vxworks-x86.ads
+
+ ifeq ($(strip $(filter-out kernel,$(THREAD_KIND))),)
+ LIBGNAT_TARGET_PAIRS += \
+ s-osinte.ads<s-osinte-vxworks6.ads \
+ s-osinte.adb<s-osinte-vxworks-kernel.adb
+ else
+ LIBGNAT_TARGET_PAIRS += \
+ s-osinte.ads<s-osinte-vxworks.ads \
+ s-osinte.adb<s-osinte-vxworks.adb
+ endif
+
+ EXTRA_GNATRTL_NONTASKING_OBJS=i-vxwork.o i-vxwoio.o s-vxwexc.o
+ endif
+
+ EXTRA_GNATRTL_TASKING_OBJS=s-vxwork.o
+
+ EXTRA_LIBGNAT_SRCS+=vx_stack_info.c
+ EXTRA_LIBGNAT_OBJS+=vx_stack_info.o
+endif
+
+ifeq ($(strip $(filter-out arm% coff wrs vx%,$(targ))),)
+ LIBGNAT_TARGET_PAIRS = \
+ a-intnam.ads<a-intnam-vxworks.ads \
+ a-numaux.ads<a-numaux-vxworks.ads \
+ s-inmaop.adb<s-inmaop-posix.adb \
+ s-interr.adb<s-interr-vxworks.adb \
+ s-intman.ads<s-intman-vxworks.ads \
+ s-intman.adb<s-intman-vxworks.adb \
+ s-osinte.adb<s-osinte-vxworks.adb \
+ s-osinte.ads<s-osinte-vxworks.ads \
+ s-osprim.adb<s-osprim-vxworks.adb \
+ s-parame.ads<s-parame-vxworks.ads \
+ s-parame.adb<s-parame-vxworks.adb \
+ s-stchop.ads<s-stchop-limit.ads \
+ s-stchop.adb<s-stchop-vxworks.adb \
+ s-taprop.adb<s-taprop-vxworks.adb \
+ s-taspri.ads<s-taspri-vxworks.ads \
+ s-tpopsp.adb<s-tpopsp-vxworks.adb \
+ s-vxwork.ads<s-vxwork-arm.ads \
+ g-socthi.ads<g-socthi-vxworks.ads \
+ g-socthi.adb<g-socthi-vxworks.adb \
+ g-stsifd.adb<g-stsifd-sockets.adb \
+ g-sttsne.adb<g-sttsne-vxworks.adb \
+ g-sttsne.ads<g-sttsne-locking.ads \
+ system.ads<system-vxworks-arm.ads
+
+ TOOLS_TARGET_PAIRS=mlib-tgt-specific.adb<mlib-tgt-specific-vxworks.adb
+
+ EXTRA_GNATRTL_NONTASKING_OBJS=i-vxwork.o i-vxwoio.o
+ EXTRA_GNATRTL_TASKING_OBJS=s-vxwork.o
+
+ EXTRA_LIBGNAT_SRCS+=vx_stack_info.c
+ EXTRA_LIBGNAT_OBJS+=vx_stack_info.o
+endif
+
+ifeq ($(strip $(filter-out mips% wrs vx%,$(targ))),)
+ LIBGNAT_TARGET_PAIRS = \
+ a-intnam.ads<a-intnam-vxworks.ads \
+ a-numaux.ads<a-numaux-vxworks.ads \
+ s-inmaop.adb<s-inmaop-posix.adb \
+ s-interr.adb<s-interr-vxworks.adb \
+ s-intman.ads<s-intman-vxworks.ads \
+ s-intman.adb<s-intman-vxworks.adb \
+ s-osinte.adb<s-osinte-vxworks.adb \
+ s-osinte.ads<s-osinte-vxworks.ads \
+ s-osprim.adb<s-osprim-vxworks.adb \
+ s-parame.ads<s-parame-vxworks.ads \
+ s-parame.adb<s-parame-vxworks.adb \
+ s-stchop.ads<s-stchop-limit.ads \
+ s-stchop.adb<s-stchop-vxworks.adb \
+ s-taprop.adb<s-taprop-vxworks.adb \
+ s-taspri.ads<s-taspri-vxworks.ads \
+ s-tpopsp.adb<s-tpopsp-vxworks.adb \
+ s-vxwork.ads<s-vxwork-mips.ads \
+ g-socthi.ads<g-socthi-vxworks.ads \
+ g-socthi.adb<g-socthi-vxworks.adb \
+ g-stsifd.adb<g-stsifd-sockets.adb \
+ g-sttsne.adb<g-sttsne-vxworks.adb \
+ g-sttsne.ads<g-sttsne-locking.ads \
+ system.ads<system-vxworks-mips.ads
+
+ TOOLS_TARGET_PAIRS=mlib-tgt-specific.adb<mlib-tgt-specific-vxworks.adb
+
+ EXTRA_GNATRTL_NONTASKING_OBJS=i-vxwork.o i-vxwoio.o
+ EXTRA_GNATRTL_TASKING_OBJS=s-vxwork.o
+
+ EXTRA_LIBGNAT_SRCS+=vx_stack_info.c
+ EXTRA_LIBGNAT_OBJS+=vx_stack_info.o
+endif
+
+ifeq ($(strip $(filter-out sparc% sun solaris%,$(targ))),)
+ LIBGNAT_TARGET_PAIRS_32 = \
+ a-intnam.ads<a-intnam-solaris.ads \
+ s-inmaop.adb<s-inmaop-posix.adb \
+ s-intman.adb<s-intman-solaris.adb \
+ s-osinte.adb<s-osinte-solaris.adb \
+ s-osinte.ads<s-osinte-solaris.ads \
+ s-osprim.adb<s-osprim-solaris.adb \
+ s-taprop.adb<s-taprop-solaris.adb \
+ s-tasinf.adb<s-tasinf-solaris.adb \
+ s-tasinf.ads<s-tasinf-solaris.ads \
+ s-taspri.ads<s-taspri-solaris.ads \
+ s-tpopsp.adb<s-tpopsp-solaris.adb \
+ g-soliop.ads<g-soliop-solaris.ads \
+ system.ads<system-solaris-sparc.ads
+
+ LIBGNAT_TARGET_PAIRS_64 = \
+ a-intnam.ads<a-intnam-solaris.ads \
+ s-inmaop.adb<s-inmaop-posix.adb \
+ s-intman.adb<s-intman-solaris.adb \
+ s-osinte.adb<s-osinte-solaris.adb \
+ s-osinte.ads<s-osinte-solaris.ads \
+ s-osprim.adb<s-osprim-solaris.adb \
+ s-taprop.adb<s-taprop-solaris.adb \
+ s-tasinf.adb<s-tasinf-solaris.adb \
+ s-tasinf.ads<s-tasinf-solaris.ads \
+ s-taspri.ads<s-taspri-solaris.ads \
+ s-tpopsp.adb<s-tpopsp-solaris.adb \
+ g-soliop.ads<g-soliop-solaris.ads \
+ system.ads<system-solaris-sparcv9.ads
+
+ ifeq ($(strip $(filter-out sparc sun solaris%,$(targ))),)
+ LIBGNAT_TARGET_PAIRS = $(LIBGNAT_TARGET_PAIRS_32)
+ else
+ LIBGNAT_TARGET_PAIRS = $(LIBGNAT_TARGET_PAIRS_64)
+ endif
+
+ TOOLS_TARGET_PAIRS=mlib-tgt-specific.adb<mlib-tgt-specific-solaris.adb
+
+ EH_MECHANISM=-gcc
+ THREADSLIB = -lposix4 -lthread
+ MISCLIB = -lposix4 -lnsl -lsocket
+ SO_OPTS = -Wl,-h,
+ GNATLIB_SHARED = gnatlib-shared-dual
+ GMEM_LIB = gmemlib
+ PREFIX_OBJS = $(PREFIX_REAL_OBJS)
+ LIBRARY_VERSION := $(LIB_VERSION)
+
+ ifeq ($(strip $(filter-out pthread PTHREAD,$(THREAD_KIND))),)
+ LIBGNAT_TARGET_PAIRS = \
+ a-intnam.ads<a-intnam-solaris.ads \
+ s-inmaop.adb<s-inmaop-posix.adb \
+ s-intman.adb<s-intman-posix.adb \
+ s-osinte.adb<s-osinte-posix.adb \
+ s-osinte.ads<s-osinte-solaris-posix.ads \
+ s-osprim.adb<s-osprim-solaris.adb \
+ s-taprop.adb<s-taprop-posix.adb \
+ s-taspri.ads<s-taspri-posix.ads \
+ s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
+ g-soliop.ads<g-soliop-solaris.ads \
+ system.ads<system-solaris-sparc.ads
+
+ THREADSLIB = -lposix4 -lpthread
+ endif
+
+ ifeq ($(strip $(filter-out m64,$(THREAD_KIND))),)
+ LIBGNAT_TARGET_PAIRS = $(LIBGNAT_TARGET_PAIRS_64)
+ endif
+endif
+
+ifeq ($(strip $(filter-out %86 solaris2%,$(arch) $(osys))),)
+ LIBGNAT_TARGET_PAIRS = \
+ a-numaux.adb<a-numaux-x86.adb \
+ a-numaux.ads<a-numaux-x86.ads \
+ a-intnam.ads<a-intnam-solaris.ads \
+ s-inmaop.adb<s-inmaop-posix.adb \
+ s-intman.adb<s-intman-solaris.adb \
+ s-osinte.adb<s-osinte-solaris.adb \
+ s-osinte.ads<s-osinte-solaris.ads \
+ s-osprim.adb<s-osprim-solaris.adb \
+ s-taprop.adb<s-taprop-solaris.adb \
+ s-tasinf.adb<s-tasinf-solaris.adb \
+ s-tasinf.ads<s-tasinf-solaris.ads \
+ s-taspri.ads<s-taspri-solaris.ads \
+ s-tpopsp.adb<s-tpopsp-solaris.adb \
+ g-bytswa.adb<g-bytswa-x86.adb \
+ g-soliop.ads<g-soliop-solaris.ads \
+ system.ads<system-solaris-x86.ads
+
+ TOOLS_TARGET_PAIRS=mlib-tgt-specific.adb<mlib-tgt-specific-solaris.adb
+
+ EH_MECHANISM=-gcc
+ THREADSLIB = -lposix4 -lthread
+ MISCLIB = -lposix4 -lnsl -lsocket
+ SO_OPTS = -Wl,-h,
+ GNATLIB_SHARED = gnatlib-shared-dual
+ GMEM_LIB = gmemlib
+ PREFIX_OBJS = $(PREFIX_REAL_OBJS)
+ LIBRARY_VERSION := $(LIB_VERSION)
+endif
+
+ifeq ($(strip $(filter-out %86 linux%,$(arch) $(osys))),)
+ LIBGNAT_TARGET_PAIRS = \
+ a-intnam.ads<a-intnam-linux.ads \
+ a-numaux.adb<a-numaux-x86.adb \
+ a-numaux.ads<a-numaux-x86.ads \
+ g-bytswa.adb<g-bytswa-x86.adb \
+ s-inmaop.adb<s-inmaop-posix.adb \
+ s-intman.adb<s-intman-posix.adb \
+ s-osprim.adb<s-osprim-posix.adb \
+ s-taspri.ads<s-taspri-posix.ads \
+ s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
+ g-sercom.adb<g-sercom-linux.adb \
+ system.ads<system-linux-x86.ads
+
+ ifeq ($(strip $(filter-out marte,$(THREAD_KIND))),)
+ LIBGNAT_TARGET_PAIRS += \
+ a-exetim.adb<a-exetim-linux-marte.adb \
+ a-exetim.ads<a-exetim-linux-marte.ads \
+ a-extiti.adb<a-extiti-linux-marte.adb \
+ a-extiti.ads<a-extiti-linux-marte.ads \
+ a-rttiev.adb<a-rttiev-linux-marte.adb \
+ a-rttiev.ads<a-rttiev-linux-marte.ads \
+ s-osinte.adb<s-osinte-linux-marte.adb \
+ s-osinte.ads<s-osinte-linux-marte.ads \
+ s-taprop.adb<s-taprop-linux-marte.adb
+
+ EXTRA_GNATRTL_TASKING_OBJS=a-exetim.o a-extiti.o
+
+ EH_MECHANISM=
+ THREADSLIB = -lmarte
+ else
+ LIBGNAT_TARGET_PAIRS += \
+ s-linux.ads<s-linux.ads \
+ s-osinte.adb<s-osinte-posix.adb
+
+ ifeq ($(strip $(filter-out xenomai,$(THREAD_KIND))),)
+ LIBGNAT_TARGET_PAIRS += \
+ s-osinte.ads<s-osinte-linux-xenomai.ads \
+ s-taprop.adb<s-taprop-linux-xenomai.adb
+
+ EH_MECHANISM=
+ else
+ LIBGNAT_TARGET_PAIRS += \
+ s-osinte.ads<s-osinte-linux.ads \
+ s-taprop.adb<s-taprop-linux.adb \
+ s-tasinf.ads<s-tasinf-linux.ads \
+ s-tasinf.adb<s-tasinf-linux.adb
+
+ EH_MECHANISM=-gcc
+ endif
+
+ THREADSLIB = -lpthread
+ EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
+ endif
+
+ TOOLS_TARGET_PAIRS = \
+ mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
+ indepsw.adb<indepsw-gnu.adb
+
+ GNATLIB_SHARED = gnatlib-shared-dual
+ GMEM_LIB = gmemlib
+ PREFIX_OBJS = $(PREFIX_REAL_OBJS)
+ LIBRARY_VERSION := $(LIB_VERSION)
+endif
+
+ifeq ($(strip $(filter-out %86 kfreebsd%,$(arch) $(osys))),)
+ LIBGNAT_TARGET_PAIRS = \
+ a-intnam.ads<a-intnam-freebsd.ads \
+ a-numaux.adb<a-numaux-x86.adb \
+ a-numaux.ads<a-numaux-x86.ads \
+ s-inmaop.adb<s-inmaop-posix.adb \
+ s-intman.adb<s-intman-posix.adb \
+ s-osinte.adb<s-osinte-posix.adb \
+ s-osinte.ads<s-osinte-kfreebsd-gnu.ads \
+ s-osprim.adb<s-osprim-posix.adb \
+ s-taprop.adb<s-taprop-linux.adb \
+ s-tasinf.ads<s-tasinf-linux.ads \
+ s-tasinf.adb<s-tasinf-linux.adb \
+ s-taspri.ads<s-taspri-posix.ads \
+ s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
+ system.ads<system-freebsd-x86.ads
+
+ TOOLS_TARGET_PAIRS = \
+ mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
+ indepsw.adb<indepsw-gnu.adb
+
+ EH_MECHANISM=-gcc
+ THREADSLIB = -lpthread
+ GNATLIB_SHARED = gnatlib-shared-dual
+ GMEM_LIB = gmemlib
+ PREFIX_OBJS = $(PREFIX_REAL_OBJS)
+ LIBRARY_VERSION := $(LIB_VERSION)
+endif
+
+ifeq ($(strip $(filter-out %86 freebsd%,$(arch) $(osys))),)
+ LIBGNAT_TARGET_PAIRS = \
+ a-intnam.ads<a-intnam-freebsd.ads \
+ a-numaux.adb<a-numaux-x86.adb \
+ a-numaux.ads<a-numaux-x86.ads \
+ g-bytswa.adb<g-bytswa-x86.adb \
+ s-inmaop.adb<s-inmaop-posix.adb \
+ s-intman.adb<s-intman-posix.adb \
+ s-osinte.adb<s-osinte-freebsd.adb \
+ s-osinte.ads<s-osinte-freebsd.ads \
+ s-osprim.adb<s-osprim-posix.adb \
+ s-taprop.adb<s-taprop-posix.adb \
+ s-taspri.ads<s-taspri-posix.ads \
+ s-tpopsp.adb<s-tpopsp-posix.adb \
+ system.ads<system-freebsd-x86.ads
+
+ TOOLS_TARGET_PAIRS = \
+ mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb
+ GNATLIB_SHARED = gnatlib-shared-dual
+
+ EH_MECHANISM=-gcc
+ THREADSLIB= -lpthread
+ GMEM_LIB = gmemlib
+ PREFIX_OBJS = $(PREFIX_REAL_OBJS)
+ LIBRARY_VERSION := $(LIB_VERSION)
+endif
+
+ifeq ($(strip $(filter-out s390% linux%,$(arch) $(osys))),)
+ ifeq ($(strip $(filter-out s390x,$(arch))),)
+ LIBGNAT_TARGET_PAIRS = \
+ a-intnam.ads<a-intnam-linux.ads \
+ s-inmaop.adb<s-inmaop-posix.adb \
+ s-intman.adb<s-intman-posix.adb \
+ s-linux.ads<s-linux.ads \
+ s-osinte.adb<s-osinte-posix.adb \
+ s-osinte.ads<s-osinte-linux.ads \
+ s-osprim.adb<s-osprim-posix.adb \
+ s-taprop.adb<s-taprop-linux.adb \
+ s-tasinf.ads<s-tasinf-linux.ads \
+ s-tasinf.adb<s-tasinf-linux.adb \
+ s-taspri.ads<s-taspri-posix-noaltstack.ads \
+ s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
+ system.ads<system-linux-s390x.ads
+ else
+ LIBGNAT_TARGET_PAIRS = \
+ a-intnam.ads<a-intnam-linux.ads \
+ s-inmaop.adb<s-inmaop-posix.adb \
+ s-intman.adb<s-intman-posix.adb \
+ s-linux.ads<s-linux.ads \
+ s-osinte.adb<s-osinte-posix.adb \
+ s-osinte.ads<s-osinte-linux.ads \
+ s-osprim.adb<s-osprim-posix.adb \
+ s-taprop.adb<s-taprop-linux.adb \
+ s-tasinf.ads<s-tasinf-linux.ads \
+ s-tasinf.adb<s-tasinf-linux.adb \
+ s-taspri.ads<s-taspri-posix-noaltstack.ads \
+ s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
+ system.ads<system-linux-s390.ads
+ endif
+
+ TOOLS_TARGET_PAIRS = \
+ mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb
+
+ EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
+ EH_MECHANISM=-gcc
+ THREADSLIB = -lpthread
+ GNATLIB_SHARED = gnatlib-shared-dual
+ PREFIX_OBJS = $(PREFIX_REAL_OBJS)
+ LIBRARY_VERSION := $(LIB_VERSION)
+endif
+
+ifeq ($(strip $(filter-out mips sgi irix%,$(targ))),)
+ ifeq ($(strip $(filter-out mips sgi irix6%,$(targ))),)
+ LIBGNAT_TARGET_PAIRS = \
+ a-intnam.ads<a-intnam-irix.ads \
+ s-inmaop.adb<s-inmaop-posix.adb \
+ s-intman.adb<s-intman-irix.adb \
+ s-mastop.adb<s-mastop-irix.adb \
+ s-osinte.adb<s-osinte-irix.adb \
+ s-osinte.ads<s-osinte-irix.ads \
+ s-osprim.adb<s-osprim-posix.adb \
+ s-proinf.adb<s-proinf-irix-athread.adb \
+ s-proinf.ads<s-proinf-irix-athread.ads \
+ s-taprop.adb<s-taprop-irix.adb \
+ s-tasinf.ads<s-tasinf-irix.ads \
+ s-taspri.ads<s-taspri-posix.ads \
+ s-tpopsp.adb<s-tpopsp-posix.adb \
+ s-traceb.adb<s-traceb-mastop.adb \
+ system.ads<system-irix-n32.ads
+
+ THREADSLIB = -lpthread
+ GNATLIB_SHARED = gnatlib-shared-default
+
+ else
+ LIBGNAT_TARGET_PAIRS += \
+ s-mastop.adb<s-mastop-irix.adb \
+ s-osprim.adb<s-osprim-posix.adb \
+ s-traceb.adb<s-traceb-mastop.adb \
+ system.ads<system-irix-o32.ads
+ endif
+
+ EH_MECHANISM=-gcc
+ TOOLS_TARGET_PAIRS = mlib-tgt-specific.adb<mlib-tgt-specific-irix.adb
+ TGT_LIB = -lexc
+ MISCLIB = -lexc
+ PREFIX_OBJS = $(PREFIX_REAL_OBJS)
+ LIBRARY_VERSION := $(LIB_VERSION)
+ GMEM_LIB = gmemlib
+endif
+
+ifeq ($(strip $(filter-out hppa% hp hpux10%,$(targ))),)
+ LIBGNAT_TARGET_PAIRS = \
+ a-excpol.adb<a-excpol-abort.adb \
+ a-intnam.ads<a-intnam-hpux.ads \
+ s-inmaop.adb<s-inmaop-posix.adb \
+ s-interr.adb<s-interr-sigaction.adb \
+ s-intman.adb<s-intman-posix.adb \
+ s-osinte.adb<s-osinte-hpux-dce.adb \
+ s-osinte.ads<s-osinte-hpux-dce.ads \
+ s-parame.ads<s-parame-hpux.ads \
+ s-osprim.adb<s-osprim-posix.adb \
+ s-taprop.adb<s-taprop-hpux-dce.adb \
+ s-taspri.ads<s-taspri-hpux-dce.ads \
+ s-tpopsp.adb<s-tpopsp-posix.adb \
+ system.ads<system-hpux.ads
+
+ EH_MECHANISM=-gcc
+ PREFIX_OBJS = $(PREFIX_REAL_OBJS)
+endif
+
+ifeq ($(strip $(filter-out hppa% hp hpux11%,$(targ))),)
+ LIBGNAT_TARGET_PAIRS = \
+ a-intnam.ads<a-intnam-hpux.ads \
+ s-inmaop.adb<s-inmaop-posix.adb \
+ s-intman.adb<s-intman-posix.adb \
+ s-osinte.adb<s-osinte-posix.adb \
+ s-osinte.ads<s-osinte-hpux.ads \
+ s-parame.ads<s-parame-hpux.ads \
+ s-osprim.adb<s-osprim-posix.adb \
+ s-traceb.adb<s-traceb-hpux.adb \
+ s-taprop.adb<s-taprop-posix.adb \
+ s-taspri.ads<s-taspri-posix.ads \
+ s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
+ system.ads<system-hpux.ads
+
+ TOOLS_TARGET_PAIRS = mlib-tgt-specific.adb<mlib-tgt-specific-hpux.adb
+ EH_MECHANISM=-gcc
+ TGT_LIB = /usr/lib/libcl.a
+ THREADSLIB = -lpthread
+ GMEM_LIB = gmemlib
+ soext = .sl
+ SO_OPTS = -Wl,+h,
+ PREFIX_OBJS = $(PREFIX_REAL_OBJS)
+ GNATLIB_SHARED = gnatlib-shared-dual
+ LIBRARY_VERSION := $(LIB_VERSION)
+endif
+
+ifeq ($(strip $(filter-out ibm aix%,$(manu) $(osys))),)
+ LIBGNAT_TARGET_PAIRS = \
+ a-intnam.ads<a-intnam-aix.ads \
+ s-inmaop.adb<s-inmaop-posix.adb \
+ s-intman.adb<s-intman-posix.adb \
+ s-osinte.adb<s-osinte-aix.adb \
+ s-osinte.ads<s-osinte-aix.ads \
+ s-osprim.adb<s-osprim-posix.adb \
+ s-taprop.adb<s-taprop-posix.adb \
+ s-taspri.ads<s-taspri-posix.ads \
+ s-tpopsp.adb<s-tpopsp-posix.adb \
+ system.ads<system-aix.ads
+
+ THREADSLIB = -lpthreads
+ PREFIX_OBJS=$(PREFIX_REAL_OBJS)
+
+ TOOLS_TARGET_PAIRS = \
+ mlib-tgt-specific.adb<mlib-tgt-specific-aix.adb \
+ indepsw.adb<indepsw-aix.adb
+
+ GMEM_LIB = gmemlib
+endif
+
+ifeq ($(strip $(filter-out lynxos,$(osys))),)
+ TOOLS_TARGET_PAIRS = \
+ mlib-tgt-specific.adb<mlib-tgt-specific-lynxos.adb \
+ indepsw.adb<indepsw-gnu.adb
+
+ ifeq ($(strip $(filter-out %86 lynxos,$(arch) $(osys))),)
+ LIBGNAT_TARGET_PAIRS = \
+ a-numaux.adb<a-numaux-x86.adb \
+ a-numaux.ads<a-numaux-x86.ads \
+ a-intnam.ads<a-intnam-lynxos.ads \
+ g-bytswa.adb<g-bytswa-x86.adb \
+ g-sttsne.adb<g-sttsne-locking.adb \
+ g-sttsne.ads<g-sttsne-locking.ads \
+ s-inmaop.adb<s-inmaop-posix.adb \
+ s-intman.adb<s-intman-posix.adb \
+ s-osinte.adb<s-osinte-lynxos.adb \
+ s-osinte.ads<s-osinte-lynxos.ads \
+ s-osprim.adb<s-osprim-posix.adb \
+ s-taprop.adb<s-taprop-lynxos.adb \
+ s-taspri.ads<s-taspri-lynxos.ads \
+ s-tpopsp.adb<s-tpopsp-lynxos.adb \
+ system.ads<system-lynxos-x86.ads
+
+ PREFIX_OBJS=$(PREFIX_REAL_OBJS)
+
+ else
+ LIBGNAT_TARGET_PAIRS = \
+ a-intnam.ads<a-intnam-lynxos.ads \
+ g-sttsne.adb<g-sttsne-locking.adb \
+ g-sttsne.ads<g-sttsne-locking.ads \
+ s-inmaop.adb<s-inmaop-posix.adb \
+ s-intman.adb<s-intman-posix.adb \
+ s-osinte.adb<s-osinte-lynxos.adb \
+ s-osinte.ads<s-osinte-lynxos.ads \
+ s-osprim.adb<s-osprim-posix.adb \
+ s-taprop.adb<s-taprop-lynxos.adb \
+ s-taspri.ads<s-taspri-lynxos.ads \
+ s-tpopsp.adb<s-tpopsp-lynxos.adb \
+ system.ads<system-lynxos-ppc.ads
+ endif
+endif
+
+ifeq ($(strip $(filter-out rtems%,$(osys))),)
+ LIBGNAT_TARGET_PAIRS = \
+ system.ads<system-rtems.ads \
+ a-intnam.ads<a-intnam-rtems.ads \
+ s-inmaop.adb<s-inmaop-posix.adb \
+ s-intman.adb<s-intman-posix.adb \
+ s-osinte.adb<s-osinte-rtems.adb \
+ s-osinte.ads<s-osinte-rtems.ads \
+ s-osprim.adb<s-osprim-posix.adb \
+ s-parame.adb<s-parame-rtems.adb \
+ s-taprop.adb<s-taprop-posix.adb \
+ s-taspri.ads<s-taspri-posix.ads \
+ s-tpopsp.adb<s-tpopsp-rtems.adb \
+ s-stchop.adb<s-stchop-rtems.adb
+endif
+
+ifeq ($(strip $(filter-out alpha% dec osf%,$(targ))),)
+ LIBGNAT_TARGET_PAIRS = \
+ a-intnam.ads<a-intnam-tru64.ads \
+ s-inmaop.adb<s-inmaop-posix.adb \
+ s-intman.adb<s-intman-posix.adb \
+ s-mastop.adb<s-mastop-tru64.adb \
+ s-osinte.adb<s-osinte-tru64.adb \
+ s-osinte.ads<s-osinte-tru64.ads \
+ s-osprim.adb<s-osprim-unix.adb \
+ s-taprop.adb<s-taprop-tru64.adb \
+ s-tasinf.ads<s-tasinf-tru64.ads \
+ s-taspri.ads<s-taspri-tru64.ads \
+ s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
+ s-traceb.adb<s-traceb-mastop.adb \
+ system.ads<system-tru64.ads
+
+ TOOLS_TARGET_PAIRS=mlib-tgt-specific.adb<mlib-tgt-specific-tru64.adb
+
+ EH_MECHANISM=-gcc
+ GMEM_LIB=gmemlib
+ THREADSLIB = -lpthread -lmach -lexc -lrt
+ PREFIX_OBJS = $(PREFIX_REAL_OBJS)
+ GNATLIB_SHARED = gnatlib-shared-default
+ LIBRARY_VERSION := $(LIB_VERSION)
+endif
+
+ifeq ($(strip $(filter-out alpha64 ia64 dec hp vms% openvms% alphavms%,$(host))),)
+
+soext = .exe
+hyphen = _
+LN = cp -p
+LN_S = cp -p
+
+.SUFFIXES: .sym
+
+.o.sym:
+ @ gnu:[bin]vmssymvec $<
+endif
+
+ifeq ($(strip $(filter-out alpha64 ia64 dec hp vms% openvms% alphavms%,$(targ))),)
+ifeq ($(strip $(filter-out ia64 hp vms% openvms%,$(targ))),)
+ LIBGNAT_TARGET_PAIRS_AUX1 = \
+ g-enblsp.adb<g-enblsp-vms-ia64.adb \
+ g-trasym.adb<g-trasym-vms-ia64.adb \
+ s-asthan.adb<s-asthan-vms-ia64.adb \
+ s-osinte.adb<s-osinte-vms-ia64.adb \
+ s-osinte.ads<s-osinte-vms-ia64.ads \
+ s-vaflop.adb<s-vaflop-vms-ia64.adb \
+ system.ads<system-vms-ia64.ads
+
+ LIBGNAT_TARGET_PAIRS_AUX2 = \
+ s-parame.ads<s-parame-vms-ia64.ads
+else
+ifeq ($(strip $(filter-out alpha64 dec vms% openvms% alphavms%,$(targ))),)
+ LIBGNAT_TARGET_PAIRS_AUX1 = \
+ g-enblsp.adb<g-enblsp-vms-alpha.adb \
+ g-trasym.adb<g-trasym-vms-alpha.adb \
+ s-traent.adb<s-traent-vms.adb \
+ s-traent.ads<s-traent-vms.ads \
+ s-asthan.adb<s-asthan-vms-alpha.adb \
+ s-osinte.adb<s-osinte-vms.adb \
+ s-osinte.ads<s-osinte-vms.ads \
+ s-vaflop.adb<s-vaflop-vms-alpha.adb \
+ system.ads<system-vms_64.ads
+
+ifeq ($(strip $(filter-out express EXPRESS,$(THREAD_KIND))),)
+ LIBGNAT_TARGET_PAIRS_AUX2 = \
+ s-parame.ads<s-parame-vms-restrict.ads
+else
+ LIBGNAT_TARGET_PAIRS_AUX2 = \
+ s-parame.ads<s-parame-vms-alpha.ads
+endif
+endif
+endif
+
+ LIBGNAT_TARGET_PAIRS = \
+ a-caldel.adb<a-caldel-vms.adb \
+ a-calend.adb<a-calend-vms.adb \
+ a-calend.ads<a-calend-vms.ads \
+ a-dirval.adb<a-dirval-vms.adb \
+ a-excpol.adb<a-excpol-abort.adb \
+ a-intnam.ads<a-intnam-vms.ads \
+ a-numaux.ads<a-numaux-vms.ads \
+ g-expect.adb<g-expect-vms.adb \
+ g-socthi.ads<g-socthi-vms.ads \
+ g-socthi.adb<g-socthi-vms.adb \
+ g-stsifd.adb<g-stsifd-sockets.adb \
+ g-sttsne.adb<g-sttsne-locking.adb \
+ g-sttsne.ads<g-sttsne-locking.ads \
+ i-c.ads<i-c-vms_64.ads \
+ i-cstrin.ads<i-cstrin-vms_64.ads \
+ i-cstrin.adb<i-cstrin-vms_64.adb \
+ i-cpoint.ads<i-cpoint-vms_64.ads \
+ i-cpoint.adb<i-cpoint-vms_64.adb \
+ i-cstrea.adb<i-cstrea-vms.adb \
+ memtrack.adb<memtrack-vms_64.adb \
+ s-auxdec.ads<s-auxdec-vms_64.ads \
+ s-crtl.ads<s-crtl-vms_64.ads \
+ s-inmaop.adb<s-inmaop-vms.adb \
+ s-interr.adb<s-interr-vms.adb \
+ s-intman.adb<s-intman-vms.adb \
+ s-intman.ads<s-intman-vms.ads \
+ s-memory.adb<s-memory-vms_64.adb \
+ s-memory.ads<s-memory-vms_64.ads \
+ s-osprim.adb<s-osprim-vms.adb \
+ s-osprim.ads<s-osprim-vms.ads \
+ s-taprop.adb<s-taprop-vms.adb \
+ s-taspri.ads<s-taspri-vms.ads \
+ s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
+ s-tpopde.adb<s-tpopde-vms.adb \
+ s-tpopde.ads<s-tpopde-vms.ads \
+ $(LIBGNAT_TARGET_PAIRS_AUX1) \
+ $(LIBGNAT_TARGET_PAIRS_AUX2)
+
+ifeq ($(strip $(filter-out ia64 hp vms% openvms%,$(targ))),)
+ TOOLS_TARGET_PAIRS= \
+ mlib-tgt-specific.adb<mlib-tgt-specific-vms-ia64.adb \
+ symbols.adb<symbols-vms.adb \
+ symbols-processing.adb<symbols-processing-vms-ia64.adb
+else
+ TOOLS_TARGET_PAIRS= \
+ mlib-tgt-specific.adb<mlib-tgt-specific-vms-alpha.adb \
+ symbols.adb<symbols-vms.adb \
+ symbols-processing.adb<symbols-processing-vms-alpha.adb
+endif
+
+adamsg.o: adamsg.msg
+ -$(DECC) --cc=message adamsg.msg -o adamsg.o
+
+ EXTRA_GNATMAKE_OBJS = mlib-tgt-vms_common.o
+
+ GMEM_LIB = gmemlib
+ EH_MECHANISM=-gcc
+ GNATLIB_SHARED=gnatlib-shared-vms
+ifeq ($(strip $(filter-out alpha64 dec vms% openvms% alphavms%,$(targ))),)
+ EXTRA_LIBGNAT_SRCS=vmshandler.asm
+ EXTRA_LIBGNAT_OBJS=vmshandler.o
+endif
+ EXTRA_LIBGNAT_SRCS+=adamsg.msg
+ EXTRA_LIBGNAT_OBJS+=adamsg.o
+ EXTRA_GNATRTL_TASKING_OBJS=s-tpopde.o
+ EXTRA_GNATTOOLS = \
+ ../../gnatlbr$(exeext) \
+ ../../gnatsym$(exeext) \
+ ../../vms_help$(exeext) \
+ ../../gnat.hlp
+ # This command transforms (YYYYMMDD) into YY,MMDD
+ GSMATCH_VERSION := $(shell grep "^ *Gnat_Static_Version_String" $(fsrcpfx)gnatvsn.ads | sed -e 's/.*(\(.*\)).*/\1/' -e 's/\(..\)\(..\)\(....\).*/\2,\3/')
+ TOOLS_LIBS_LO := --for-linker=sys\\$$\$$library:trace.exe
+ LIBRARY_VERSION := $(subst .,_,$(LIB_VERSION))
+endif
+
+ifeq ($(strip $(filter-out cygwin32% mingw32% pe,$(osys))),)
+ LIBGNAT_TARGET_PAIRS = \
+ a-dirval.adb<a-dirval-mingw.adb \
+ a-excpol.adb<a-excpol-abort.adb \
+ a-numaux.adb<a-numaux-x86.adb \
+ a-numaux.ads<a-numaux-x86.ads \
+ s-gloloc.adb<s-gloloc-mingw.adb \
+ s-inmaop.adb<s-inmaop-dummy.adb \
+ s-memory.adb<s-memory-mingw.adb \
+ s-taspri.ads<s-taspri-mingw.ads \
+ s-tasinf.adb<s-tasinf-mingw.adb \
+ s-tasinf.ads<s-tasinf-mingw.ads \
+ g-bytswa.adb<g-bytswa-x86.adb \
+ g-socthi.ads<g-socthi-mingw.ads \
+ g-socthi.adb<g-socthi-mingw.adb \
+ g-stsifd.adb<g-stsifd-sockets.adb \
+ g-soliop.ads<g-soliop-mingw.ads
+
+ ifeq ($(strip $(filter-out rtx_w32 rtx_rtss,$(THREAD_KIND))),)
+ LIBGNAT_TARGET_PAIRS += \
+ s-intman.adb<s-intman-dummy.adb \
+ s-osinte.ads<s-osinte-rtx.ads \
+ s-osprim.adb<s-osprim-rtx.adb \
+ s-taprop.adb<s-taprop-rtx.adb
+
+ EXTRA_GNATRTL_NONTASKING_OBJS = s-win32.o
+
+ ifeq ($(strip $(filter-out rtx_w32,$(THREAD_KIND))),)
+ LIBGNAT_TARGET_PAIRS += system.ads<system-rtx.ads
+
+ EH_MECHANISM=-gcc
+ else
+ LIBGNAT_TARGET_PAIRS += \
+ system.ads<system-rtx-rtss.ads \
+ s-parame.adb<s-parame-vxworks.adb
+
+ EH_MECHANISM=
+ endif
+
+ else
+ LIBGNAT_TARGET_PAIRS += \
+ a-exetim.adb<a-exetim-mingw.adb \
+ a-exetim.ads<a-exetim-mingw.ads \
+ a-intnam.ads<a-intnam-mingw.ads \
+ g-sercom.adb<g-sercom-mingw.adb \
+ s-interr.adb<s-interr-sigaction.adb \
+ s-intman.adb<s-intman-mingw.adb \
+ s-osinte.ads<s-osinte-mingw.ads \
+ s-osprim.adb<s-osprim-mingw.adb \
+ s-taprop.adb<s-taprop-mingw.adb
+
+ ifeq ($(strip $(filter-out x86_64%,$(arch))),)
+ LIBGNAT_TARGET_PAIRS += \
+ system.ads<system-mingw-x86_64.ads
+ else
+ LIBGNAT_TARGET_PAIRS += \
+ system.ads<system-mingw.ads
+ endif
+
+ EXTRA_GNATRTL_NONTASKING_OBJS = s-win32.o s-winext.o g-regist.o
+ EXTRA_GNATRTL_TASKING_OBJS = a-exetim.o
+
+ MISCLIB = -lwsock32
+
+ # ??? This will be replaced by gnatlib-shared-dual-win32 when GNAT
+ # auto-import support for array/record will be done.
+ GNATLIB_SHARED = gnatlib-shared-win32
+
+ EH_MECHANISM=-gcc
+ endif
+
+ TOOLS_TARGET_PAIRS= \
+ mlib-tgt-specific.adb<mlib-tgt-specific-mingw.adb \
+ indepsw.adb<indepsw-mingw.adb
+
+ GMEM_LIB = gmemlib
+ PREFIX_OBJS = $(PREFIX_REAL_OBJS)
+ EXTRA_GNATTOOLS = ../../gnatdll$(exeext)
+ EXTRA_GNATMAKE_OBJS = mdll.o mdll-utl.o mdll-fil.o
+ soext = .dll
+ LIBRARY_VERSION := $(LIB_VERSION)
+endif
+
+ifeq ($(strip $(filter-out mips linux%,$(arch) $(osys))),)
+ LIBGNAT_TARGET_PAIRS = \
+ a-intnam.ads<a-intnam-linux.ads \
+ s-inmaop.adb<s-inmaop-posix.adb \
+ s-intman.adb<s-intman-posix.adb \
+ s-linux.ads<s-linux.ads \
+ s-osinte.adb<s-osinte-posix.adb \
+ s-osinte.ads<s-osinte-linux.ads \
+ s-osprim.adb<s-osprim-posix.adb \
+ s-taprop.adb<s-taprop-linux.adb \
+ s-tasinf.ads<s-tasinf-linux.ads \
+ s-tasinf.adb<s-tasinf-linux.adb \
+ s-taspri.ads<s-taspri-posix.ads \
+ s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
+ system.ads<system-linux-mips.ads
+
+ EH_MECHANISM=-gcc
+ THREADSLIB = -lpthread
+ GNATLIB_SHARED = gnatlib-shared-dual
+ GMEM_LIB = gmemlib
+ PREFIX_OBJS = $(PREFIX_REAL_OBJS)
+ LIBRARY_VERSION := $(LIB_VERSION)
+endif
+
+ifeq ($(strip $(filter-out mipsel linux%,$(arch) $(osys))),)
+ LIBGNAT_TARGET_PAIRS = \
+ a-intnam.ads<a-intnam-linux.ads \
+ s-inmaop.adb<s-inmaop-posix.adb \
+ s-intman.adb<s-intman-posix.adb \
+ s-linux.ads<s-linux.ads \
+ s-osinte.adb<s-osinte-posix.adb \
+ s-osinte.ads<s-osinte-linux.ads \
+ s-osprim.adb<s-osprim-posix.adb \
+ s-taprop.adb<s-taprop-linux.adb \
+ s-tasinf.ads<s-tasinf-linux.ads \
+ s-tasinf.adb<s-tasinf-linux.adb \
+ s-taspri.ads<s-taspri-posix.ads \
+ s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
+ system.ads<system-linux-mipsel.ads
+
+ EH_MECHANISM=-gcc
+ THREADSLIB = -lpthread
+ GNATLIB_SHARED = gnatlib-shared-dual
+ GMEM_LIB = gmemlib
+ PREFIX_OBJS = $(PREFIX_REAL_OBJS)
+ LIBRARY_VERSION := $(LIB_VERSION)
+endif
+
+ifeq ($(strip $(filter-out powerpc% linux%,$(arch) $(osys))),)
+ LIBGNAT_TARGET_PAIRS = \
+ a-intnam.ads<a-intnam-linux.ads \
+ s-inmaop.adb<s-inmaop-posix.adb \
+ s-intman.adb<s-intman-posix.adb \
+ s-linux.ads<s-linux.ads \
+ s-osinte.adb<s-osinte-posix.adb \
+ s-osinte.ads<s-osinte-linux.ads \
+ s-osprim.adb<s-osprim-posix.adb \
+ s-taprop.adb<s-taprop-linux.adb \
+ s-tasinf.ads<s-tasinf-linux.ads \
+ s-tasinf.adb<s-tasinf-linux.adb \
+ s-taspri.ads<s-taspri-posix-noaltstack.ads \
+ s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
+ g-sercom.adb<g-sercom-linux.adb \
+ system.ads<system-linux-ppc.ads
+
+ TOOLS_TARGET_PAIRS = \
+ mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
+ indepsw.adb<indepsw-gnu.adb
+
+ EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
+ EH_MECHANISM=-gcc
+ THREADSLIB = -lpthread
+ GNATLIB_SHARED = gnatlib-shared-dual
+ GMEM_LIB = gmemlib
+ PREFIX_OBJS = $(PREFIX_REAL_OBJS)
+ LIBRARY_VERSION := $(LIB_VERSION)
+endif
+
+ifeq ($(strip $(filter-out sparc% linux%,$(arch) $(osys))),)
+ LIBGNAT_TARGET_PAIRS = \
+ a-intnam.ads<a-intnam-linux.ads \
+ s-inmaop.adb<s-inmaop-posix.adb \
+ s-intman.adb<s-intman-posix.adb \
+ s-linux.ads<s-linux.ads \
+ s-osinte.adb<s-osinte-posix.adb \
+ s-osinte.ads<s-osinte-linux.ads \
+ s-osprim.adb<s-osprim-posix.adb \
+ s-taprop.adb<s-taprop-linux.adb \
+ s-tasinf.ads<s-tasinf-linux.ads \
+ s-tasinf.adb<s-tasinf-linux.adb \
+ s-taspri.ads<s-taspri-posix-noaltstack.ads \
+ s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
+ system.ads<system-linux-sparc.ads
+
+ TOOLS_TARGET_PAIRS = \
+ mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
+ indepsw.adb<indepsw-gnu.adb
+
+ EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
+ EH_MECHANISM=-gcc
+ THREADSLIB = -lpthread
+ GNATLIB_SHARED = gnatlib-shared-dual
+ GMEM_LIB = gmemlib
+ PREFIX_OBJS = $(PREFIX_REAL_OBJS)
+ LIBRARY_VERSION := $(LIB_VERSION)
+endif
+
+ifeq ($(strip $(filter-out hppa% linux%,$(arch) $(osys))),)
+ LIBGNAT_TARGET_PAIRS = \
+ a-intnam.ads<a-intnam-linux.ads \
+ s-inmaop.adb<s-inmaop-posix.adb \
+ s-intman.adb<s-intman-posix.adb \
+ s-linux.ads<s-linux-hppa.ads \
+ s-osinte.adb<s-osinte-posix.adb \
+ s-osinte.ads<s-osinte-linux.ads \
+ s-osprim.adb<s-osprim-posix.adb \
+ s-taprop.adb<s-taprop-linux.adb \
+ s-tasinf.ads<s-tasinf-linux.ads \
+ s-tasinf.adb<s-tasinf-linux.adb \
+ s-taspri.ads<s-taspri-posix-noaltstack.ads \
+ s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
+ system.ads<system-linux-hppa.ads
+
+ TOOLS_TARGET_PAIRS = \
+ mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
+ indepsw.adb<indepsw-gnu.adb
+
+ EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
+ EH_MECHANISM=-gcc
+ THREADSLIB = -lpthread
+ GNATLIB_SHARED = gnatlib-shared-dual
+ GMEM_LIB = gmemlib
+ PREFIX_OBJS = $(PREFIX_REAL_OBJS)
+ LIBRARY_VERSION := $(LIB_VERSION)
+endif
+
+ifeq ($(strip $(filter-out sh4% linux%,$(arch) $(osys))),)
+ LIBGNAT_TARGET_PAIRS = \
+ a-intnam.ads<a-intnam-linux.ads \
+ s-inmaop.adb<s-inmaop-posix.adb \
+ s-intman.adb<s-intman-posix.adb \
+ s-linux.ads<s-linux.ads \
+ s-osinte.adb<s-osinte-posix.adb \
+ s-osinte.ads<s-osinte-linux.ads \
+ s-osprim.adb<s-osprim-posix.adb \
+ s-taprop.adb<s-taprop-linux.adb \
+ s-tasinf.ads<s-tasinf-linux.ads \
+ s-tasinf.adb<s-tasinf-linux.adb \
+ s-taspri.ads<s-taspri-posix-noaltstack.ads \
+ s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
+ system.ads<system-linux-sh4.ads
+
+ TOOLS_TARGET_PAIRS = \
+ mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
+ indepsw.adb<indepsw-linux.adb
+
+ EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
+ EH_MECHANISM=-gcc
+ MISCLIB=
+ THREADSLIB = -lpthread
+ GNATLIB_SHARED = gnatlib-shared-dual
+ GMEM_LIB = gmemlib
+ PREFIX_OBJS = $(PREFIX_REAL_OBJS)
+ LIBRARY_VERSION := $(LIB_VERSION)
+endif
+
+ifeq ($(strip $(filter-out %ia64 linux%,$(arch) $(osys))),)
+ LIBGNAT_TARGET_PAIRS = \
+ a-intnam.ads<a-intnam-linux.ads \
+ a-numaux.ads<a-numaux-libc-x86.ads \
+ s-inmaop.adb<s-inmaop-posix.adb \
+ s-intman.adb<s-intman-posix.adb \
+ s-linux.ads<s-linux.ads \
+ s-osinte.ads<s-osinte-linux.ads \
+ s-osinte.adb<s-osinte-posix.adb \
+ s-osprim.adb<s-osprim-posix.adb \
+ s-taprop.adb<s-taprop-linux.adb \
+ s-tasinf.ads<s-tasinf-linux.ads \
+ s-tasinf.adb<s-tasinf-linux.adb \
+ s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
+ s-taspri.ads<s-taspri-posix-noaltstack.ads \
+ g-sercom.adb<g-sercom-linux.adb \
+ system.ads<system-linux-ia64.ads
+
+ TOOLS_TARGET_PAIRS = \
+ mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
+ indepsw.adb<indepsw-gnu.adb
+
+ EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
+ EH_MECHANISM=-gcc
+ MISCLIB=
+ THREADSLIB=-lpthread
+ GNATLIB_SHARED=gnatlib-shared-dual
+ GMEM_LIB = gmemlib
+ PREFIX_OBJS=$(PREFIX_REAL_OBJS)
+ LIBRARY_VERSION := $(LIB_VERSION)
+endif
+
+ifeq ($(strip $(filter-out alpha% linux%,$(arch) $(osys))),)
+ LIBGNAT_TARGET_PAIRS = \
+ a-intnam.ads<a-intnam-linux.ads \
+ s-inmaop.adb<s-inmaop-posix.adb \
+ s-intman.adb<s-intman-posix.adb \
+ s-linux.ads<s-linux-alpha.ads \
+ s-osinte.ads<s-osinte-linux.ads \
+ s-osinte.adb<s-osinte-posix.adb \
+ s-osprim.adb<s-osprim-posix.adb \
+ s-taprop.adb<s-taprop-linux.adb \
+ s-tasinf.ads<s-tasinf-linux.ads \
+ s-tasinf.adb<s-tasinf-linux.adb \
+ s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
+ s-taspri.ads<s-taspri-posix-noaltstack.ads \
+ system.ads<system-linux-alpha.ads
+
+ TOOLS_TARGET_PAIRS = \
+ mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
+ indepsw.adb<indepsw-gnu.adb
+
+ EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
+ EH_MECHANISM=-gcc
+ MISCLIB=
+ THREADSLIB=-lpthread
+ GNATLIB_SHARED=gnatlib-shared-dual
+ PREFIX_OBJS=$(PREFIX_REAL_OBJS)
+ LIBRARY_VERSION := $(LIB_VERSION)
+endif
+
+ifeq ($(strip $(filter-out %x86_64 linux%,$(arch) $(osys))),)
+ LIBGNAT_TARGET_PAIRS = \
+ a-intnam.ads<a-intnam-linux.ads \
+ a-numaux.adb<a-numaux-x86.adb \
+ a-numaux.ads<a-numaux-x86.ads \
+ s-inmaop.adb<s-inmaop-posix.adb \
+ s-intman.adb<s-intman-posix.adb \
+ s-linux.ads<s-linux.ads \
+ s-osinte.ads<s-osinte-linux.ads \
+ s-osinte.adb<s-osinte-posix.adb \
+ s-osprim.adb<s-osprim-posix.adb \
+ s-taprop.adb<s-taprop-linux.adb \
+ s-tasinf.ads<s-tasinf-linux.ads \
+ s-tasinf.adb<s-tasinf-linux.adb \
+ s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
+ s-taspri.ads<s-taspri-posix.ads \
+ g-sercom.adb<g-sercom-linux.adb \
+ system.ads<system-linux-x86_64.ads
+
+ TOOLS_TARGET_PAIRS = \
+ mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
+ indepsw.adb<indepsw-gnu.adb
+
+ EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
+ EH_MECHANISM=-gcc
+ THREADSLIB=-lpthread
+ GNATLIB_SHARED=gnatlib-shared-dual
+ GMEM_LIB = gmemlib
+ PREFIX_OBJS=$(PREFIX_REAL_OBJS)
+ LIBRARY_VERSION := $(LIB_VERSION)
+endif
+
+ifeq ($(strip $(filter-out darwin%,$(osys))),)
+ ifeq ($(strip $(filter-out %86,$(arch))),)
+ LIBGNAT_TARGET_PAIRS = \
+ a-intnam.ads<a-intnam-darwin.ads \
+ s-inmaop.adb<s-inmaop-posix.adb \
+ s-intman.adb<s-intman-posix.adb \
+ s-osinte.adb<s-osinte-darwin.adb \
+ s-osinte.ads<s-osinte-darwin.ads \
+ s-osprim.adb<s-osprim-posix.adb \
+ s-taprop.adb<s-taprop-posix.adb \
+ s-taspri.ads<s-taspri-posix.ads \
+ s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
+ a-numaux.ads<a-numaux-x86.ads \
+ a-numaux.adb<a-numaux-x86.adb \
+ system.ads<system-darwin-x86.ads
+ else
+ LIBGNAT_TARGET_PAIRS = \
+ a-intnam.ads<a-intnam-darwin.ads \
+ s-inmaop.adb<s-inmaop-posix.adb \
+ s-intman.adb<s-intman-posix.adb \
+ s-osinte.adb<s-osinte-darwin.adb \
+ s-osinte.ads<s-osinte-darwin.ads \
+ s-osprim.adb<s-osprim-posix.adb \
+ s-taprop.adb<s-taprop-posix.adb \
+ s-taspri.ads<s-taspri-posix.ads \
+ s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
+ a-numaux.ads<a-numaux-darwin.ads \
+ a-numaux.adb<a-numaux-darwin.adb \
+ system.ads<system-darwin-ppc.ads
+ endif
+
+ TOOLS_TARGET_PAIRS = \
+ mlib-tgt-specific.adb<mlib-tgt-specific-darwin.adb
+
+ EH_MECHANISM=-gcc
+ GNATLIB_SHARED = gnatlib-shared-darwin
+ SO_OPTS = -Wl,-flat_namespace -shared-libgcc
+ RANLIB = ranlib -c
+ GMEM_LIB = gmemlib
+ PREFIX_OBJS=$(PREFIX_REAL_OBJS)
+ LIBRARY_VERSION := $(LIB_VERSION)
+ soext = .dylib
+endif
+
+ifneq ($(EH_MECHANISM),)
+ LIBGNAT_TARGET_PAIRS += a-exexpr.adb<a-exexpr$(EH_MECHANISM).adb
+ EXTRA_LIBGNAT_SRCS+=raise$(EH_MECHANISM).c
+ EXTRA_LIBGNAT_OBJS+=raise$(EH_MECHANISM).o
+endif
+
+# Use the Ada 2005 version of Ada.Exceptions by default, unless specified
+# explicitly already. The base files (a-except.ad?) are used only for building
+# the compiler and other basic tools.
+# These base versions lack Ada 2005 additions which would cause bootstrap
+# problems if included in the compiler and other basic tools.
+
+ifeq ($(filter-out a-except%,$(LIBGNAT_TARGET_PAIRS)),$(LIBGNAT_TARGET_PAIRS))
+ LIBGNAT_TARGET_PAIRS += \
+ a-except.ads<a-except-2005.ads \
+ a-except.adb<a-except-2005.adb
+endif
+
+# The runtime library for gnat comprises two directories. One contains the
+# Ada source files that the compiler (gnat1) needs -- these files are listed
+# by ADA_INCLUDE_SRCS -- and the other contains the object files and their
+# corresponding .ali files for the parts written in Ada, libgnat.a for
+# the parts of the runtime written in C, and libgthreads.a for the pthreads
+# emulation library. LIBGNAT_OBJS lists the objects that go into libgnat.a,
+# while GNATRTL_OBJS lists the object files compiled from Ada sources that
+# go into the directory. The pthreads emulation is built in the threads
+# subdirectory and copied.
+LIBGNAT_SRCS = adaint.c adaint.h argv.c cio.c cstreams.c \
+ errno.c exit.c cal.c ctrl_c.c env.c env.h arit64.c \
+ raise.h raise.c sysdep.c aux-io.c init.c initialize.c seh_init.c \
+ final.c tracebak.c tb-alvms.c tb-alvxw.c tb-gcc.c expect.c mkdir.c \
+ socket.c gsocket.h targext.c $(EXTRA_LIBGNAT_SRCS)
+
+LIBGNAT_OBJS = adaint.o argv.o cio.o cstreams.o ctrl_c.o errno.o exit.o env.o \
+ raise.o sysdep.o aux-io.o init.o initialize.o seh_init.o cal.o arit64.o \
+ final.o tracebak.o expect.o mkdir.o socket.o targext.o $(EXTRA_LIBGNAT_OBJS)
+
+# NOTE ??? - when the -I option for compiling Ada code is made to work,
+# the library installation will change and there will be a
+# GNAT_RTL_SRCS. Right now we count on being able to build GNATRTL_OBJS
+# from ADA_INCLUDE_SRCS.
+
+# GNATRTL_NONTASKING_OBJS and GNATRTL_TASKING_OBJS can be found in
+# the following include file:
+
+include $(fsrcdir)/Makefile.rtl
+
+GNATRTL_LINEARALGEBRA_OBJS = a-nlcoar.o a-nllcar.o a-nllrar.o a-nlrear.o \
+ a-nucoar.o a-nurear.o i-forbla.o i-forlap.o s-gearop.o
+
+GNATRTL_OBJS = $(GNATRTL_NONTASKING_OBJS) $(GNATRTL_TASKING_OBJS) \
+ $(GNATRTL_LINEARALGEBRA_OBJS) g-trasym.o memtrack.o
+
+# Default run time files
+
+ADA_INCLUDE_SRCS =\
+ ada.ads calendar.ads directio.ads gnat.ads interfac.ads ioexcept.ads \
+ machcode.ads text_io.ads unchconv.ads unchdeal.ads \
+ sequenio.ads system.ads memtrack.adb \
+ a-[a-o]*.adb a-[p-z]*.adb a-[a-o]*.ads a-[p-z]*.ads g-*.ad? i-*.ad? \
+ s-[a-o]*.adb s-[p-z]*.adb s-[a-o]*.ads s-[p-z]*.ads
+
+LIBGNAT=../$(RTSDIR)/libgnat.a
+
+GCC_LINK=$(CC) -static-libgcc $(ADA_INCLUDES)
+
+# when compiling the tools, the runtime has to be first on the path so that
+# it hides the runtime files lying with the rest of the sources
+ifeq ($(TOOLSCASE),native)
+ vpath %.ads ../$(RTSDIR) ../
+ vpath %.adb ../$(RTSDIR) ../
+ vpath %.c ../$(RTSDIR) ../
+ vpath %.h ../$(RTSDIR) ../
+endif
+
+# in the cross tools case, everything is compiled with the native
+# gnatmake/link. Therefore only -I needs to be modified in ADA_INCLUDES
+ifeq ($(TOOLSCASE),cross)
+ vpath %.ads ../
+ vpath %.adb ../
+ vpath %.c ../
+ vpath %.h ../
+endif
+
+common-tools:
+ $(GNATMAKE) -c -b $(ADA_INCLUDES) \
+ --GNATBIND="$(GNATBIND)" --GCC="$(CC) $(ALL_ADAFLAGS)" \
+ gnatchop gnatcmd gnatkr gnatls gnatprep gnatxref gnatfind gnatname \
+ gnatclean -bargs $(ADA_INCLUDES) $(GNATBIND_FLAGS)
+ $(GNATLINK) -v gnatcmd -o ../../gnat$(exeext) \
+ --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
+ $(GNATLINK) -v gnatchop -o ../../gnatchop$(exeext) \
+ --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
+ $(GNATLINK) -v gnatkr -o ../../gnatkr$(exeext) \
+ --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
+ $(GNATLINK) -v gnatls -o ../../gnatls$(exeext) \
+ --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
+ $(GNATLINK) -v gnatprep -o ../../gnatprep$(exeext) \
+ --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
+ $(GNATLINK) -v gnatxref -o ../../gnatxref$(exeext) \
+ --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
+ $(GNATLINK) -v gnatfind -o ../../gnatfind$(exeext) \
+ --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
+ $(GNATLINK) -v gnatname -o ../../gnatname$(exeext) \
+ --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
+ $(GNATLINK) -v gnatclean -o ../../gnatclean$(exeext) \
+ --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
+
+../../gnatsym$(exeext):
+ $(GNATMAKE) -c $(ADA_INCLUDES) gnatsym --GCC="$(CC) $(ALL_ADAFLAGS)"
+ $(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatsym
+ $(GNATLINK) -v gnatsym -o $@ --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
+
+../../gnatdll$(exeext):
+ $(GNATMAKE) -c $(ADA_INCLUDES) gnatdll --GCC="$(CC) $(ALL_ADAFLAGS)"
+ $(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatdll
+ $(GNATLINK) -v gnatdll -o $@ --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
+
+../../vxaddr2line$(exeext): targext.o
+ $(GNATMAKE) -c $(ADA_INCLUDES) vxaddr2line --GCC="$(CC) $(ALL_ADAFLAGS)"
+ $(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) vxaddr2line
+ $(GNATLINK) -v vxaddr2line -o $@ --GCC="$(GCC_LINK)" targext.o $(CLIB)
+
+gnatmake-re: link.o targext.o
+ $(GNATMAKE) $(ADA_INCLUDES) -u sdefault --GCC="$(CC) $(MOST_ADA_FLAGS)"
+ $(GNATMAKE) -c $(ADA_INCLUDES) gnatmake --GCC="$(CC) $(ALL_ADAFLAGS)"
+ $(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatmake
+ $(GNATLINK) -v gnatmake -o ../../gnatmake$(exeext) \
+ --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
+
+# Note the use of the "mv" command in order to allow gnatlink to be linked with
+# with the former version of gnatlink itself which cannot override itself.
+gnatlink-re: link.o targext.o
+ $(GNATMAKE) -c $(ADA_INCLUDES) gnatlink --GCC="$(CC) $(ALL_ADAFLAGS)"
+ $(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatlink
+ $(GNATLINK) -v gnatlink -o ../../gnatlinknew$(exeext) \
+ --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
+ $(MV) ../../gnatlinknew$(exeext) ../../gnatlink$(exeext)
+
+# Needs to be built with CC=gcc
+# Since the RTL should be built with the latest compiler, remove the
+# stamp target in the parent directory whenever gnat1 is rebuilt
+
+# Likewise for the tools
+../../gnatmake$(exeext): $(P) b_gnatm.o link.o targext.o $(GNATMAKE_OBJS)
+ $(GCC_LINK) $(ALL_CFLAGS) $(LDFLAGS) -o $@ b_gnatm.o $(GNATMAKE_OBJS) \
+ $(TOOLS_LIBS)
+
+../../gnatlink$(exeext): $(P) b_gnatl.o link.o targext.o $(GNATLINK_OBJS)
+ $(GCC_LINK) $(ALL_CFLAGS) $(LDFLAGS) -o $@ b_gnatl.o $(GNATLINK_OBJS) \
+ $(TOOLS_LIBS)
+
+../stamp-gnatlib-$(RTSDIR):
+ @if [ ! -f stamp-gnatlib-$(RTSDIR) ] ; \
+ then \
+ $(ECHO) You must first build the GNAT library: make gnatlib; \
+ false; \
+ else \
+ true; \
+ fi
+
+install-gnatlib: ../stamp-gnatlib-$(RTSDIR)
+# Create the directory before deleting it, in case the directory is
+# a list of directories (as it may be on VMS). This ensures we are
+# deleting the right one.
+ -$(MKDIR) $(DESTDIR)$(ADA_RTL_OBJ_DIR)
+ -$(MKDIR) $(DESTDIR)$(ADA_INCLUDE_DIR)
+ $(RMDIR) $(DESTDIR)$(ADA_RTL_OBJ_DIR)
+ $(RMDIR) $(DESTDIR)$(ADA_INCLUDE_DIR)
+ -$(MKDIR) $(DESTDIR)$(ADA_RTL_OBJ_DIR)
+ -$(MKDIR) $(DESTDIR)$(ADA_INCLUDE_DIR)
+ for file in $(RTSDIR)/*.ali; do \
+ $(INSTALL_DATA_DATE) $$file $(DESTDIR)$(ADA_RTL_OBJ_DIR); \
+ done
+ -$(INSTALL_DATA) $(RTSDIR)/g-trasym$(objext) $(DESTDIR)$(ADA_RTL_OBJ_DIR)
+ -cd $(RTSDIR); for file in *$(arext);do \
+ $(INSTALL_DATA) $$file $(DESTDIR)$(ADA_RTL_OBJ_DIR); \
+ $(RANLIB_FOR_TARGET) $(DESTDIR)$(ADA_RTL_OBJ_DIR)/$$file; \
+ done
+ -$(foreach file, $(EXTRA_ADALIB_FILES), \
+ $(INSTALL_DATA_DATE) $(RTSDIR)/$(file) $(DESTDIR)$(ADA_RTL_OBJ_DIR) && \
+ ) true
+# Install the shared libraries, if any, using $(INSTALL) instead
+# of $(INSTALL_DATA). The latter may force a mode inappropriate
+# for shared libraries on some targets, e.g. on HP-UX where the x
+# permission is required.
+ for file in gnat gnarl; do \
+ if [ -f $(RTSDIR)/lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext) ]; then \
+ $(INSTALL) $(RTSDIR)/lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext) \
+ $(DESTDIR)$(ADA_RTL_OBJ_DIR); \
+ fi; \
+ if [ -f $(RTSDIR)/lib$${file}$(soext) ]; then \
+ $(LN_S) lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext) \
+ $(DESTDIR)$(ADA_RTL_OBJ_DIR)/lib$${file}$(soext); \
+ fi; \
+ done
+# This copy must be done preserving the date on the original file.
+ for file in $(RTSDIR)/*.ad?; do \
+ $(INSTALL_DATA_DATE) $$file $(DESTDIR)$(ADA_INCLUDE_DIR); \
+ done
+ cd $(DESTDIR)$(ADA_INCLUDE_DIR); $(CHMOD) a-wx *.adb
+ cd $(DESTDIR)$(ADA_INCLUDE_DIR); $(CHMOD) a-wx *.ads
+
+../stamp-gnatlib2-$(RTSDIR):
+ $(RM) $(RTSDIR)/s-*.ali
+ $(RM) $(RTSDIR)/s-*$(objext)
+ $(RM) $(RTSDIR)/a-*.ali
+ $(RM) $(RTSDIR)/a-*$(objext)
+ $(RM) $(RTSDIR)/*.ali
+ $(RM) $(RTSDIR)/*$(objext)
+ $(RM) $(RTSDIR)/*$(arext)
+ $(RM) $(RTSDIR)/*$(soext)
+ touch ../stamp-gnatlib2-$(RTSDIR)
+ $(RM) ../stamp-gnatlib-$(RTSDIR)
+
+# NOTE: The $(foreach ...) commands assume ";" is the valid separator between
+# successive target commands. Although the Gnu make documentation
+# implies this is true on all systems, I suspect it may not be, So care
+# has been taken to allow a sed script to look for ";)" and substitue
+# for ";" the appropriate character in the range of lines below
+# beginning with "GNULLI Begin" and ending with "GNULLI End"
+
+# GNULLI Begin ###########################################################
+
+../stamp-gnatlib1-$(RTSDIR): Makefile ../stamp-gnatlib2-$(RTSDIR)
+ $(RMDIR) $(RTSDIR)
+ $(MKDIR) $(RTSDIR)
+ $(CHMOD) u+w $(RTSDIR)
+# Copy target independent sources
+ $(foreach f,$(ADA_INCLUDE_SRCS) $(LIBGNAT_SRCS), \
+ $(LN_S) $(fsrcpfx)$(f) $(RTSDIR) ;) true
+# Remove files to be replaced by target dependent sources
+ $(RM) $(foreach PAIR,$(LIBGNAT_TARGET_PAIRS), \
+ $(RTSDIR)/$(word 1,$(subst <, ,$(PAIR))))
+ $(RM) $(RTSDIR)/*-*-*.ads $(RTSDIR)/*-*-*.adb
+# Copy new target dependent sources
+ $(foreach PAIR,$(LIBGNAT_TARGET_PAIRS), \
+ $(LN_S) $(fsrcpfx)$(word 2,$(subst <, ,$(PAIR))) \
+ $(RTSDIR)/$(word 1,$(subst <, ,$(PAIR)));)
+# Copy generated target dependent sources
+ $(RM) $(RTSDIR)/s-oscons.ads
+ (cd $(RTSDIR); $(LN_S) ../s-oscons.ads s-oscons.ads)
+ $(RM) ../stamp-gnatlib-$(RTSDIR)
+ touch ../stamp-gnatlib1-$(RTSDIR)
+
+# GNULLI End #############################################################
+
+# Don't use semicolon separated shell commands that involve list expansions.
+# The semicolon triggers a call to DCL on VMS and DCL can't handle command
+# line lengths in excess of 256 characters.
+# Example: cd $(RTSDIR); ar rc libfoo.a $(LONG_LIST_OF_OBJS)
+# is guaranteed to overflow the buffer.
+
+gnatlib: ../stamp-gnatlib1-$(RTSDIR) ../stamp-gnatlib2-$(RTSDIR)
+ $(MAKE) -C $(RTSDIR) \
+ CC="`echo \"$(GCC_FOR_TARGET)\" \
+ | sed -e 's,^\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'`" \
+ INCLUDES="$(INCLUDES_FOR_SUBDIR) -I./../.." \
+ CFLAGS="$(GNATLIBCFLAGS_FOR_C)" \
+ FORCE_DEBUG_ADAFLAGS="$(FORCE_DEBUG_ADAFLAGS)" \
+ srcdir=$(fsrcdir) \
+ -f ../Makefile $(LIBGNAT_OBJS)
+ $(MAKE) -C $(RTSDIR) \
+ CC="`echo \"$(GCC_FOR_TARGET)\" \
+ | sed -e 's,^\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'`" \
+ ADA_INCLUDES="" \
+ CFLAGS="$(GNATLIBCFLAGS)" \
+ ADAFLAGS="$(GNATLIBFLAGS)" \
+ FORCE_DEBUG_ADAFLAGS="$(FORCE_DEBUG_ADAFLAGS)" \
+ srcdir=$(fsrcdir) \
+ -f ../Makefile \
+ $(GNATRTL_OBJS)
+ $(RM) $(RTSDIR)/libgnat$(arext) $(RTSDIR)/libgnarl$(arext)
+ $(AR_FOR_TARGET) $(AR_FLAGS) $(RTSDIR)/libgnat$(arext) \
+ $(addprefix $(RTSDIR)/,$(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS))
+ ifneq ($(PREFIX_OBJS),)
+ $(AR_FOR_TARGET) $(AR_FLAGS) $(RTSDIR)/libgccprefix$(arext) \
+ $(PREFIX_OBJS);
+ $(RANLIB_FOR_TARGET) $(RTSDIR)/libgccprefix$(arext)
+ endif
+ $(RANLIB_FOR_TARGET) $(RTSDIR)/libgnat$(arext)
+ $(AR_FOR_TARGET) $(AR_FLAGS) $(RTSDIR)/libgnarl$(arext) \
+ $(addprefix $(RTSDIR)/,$(GNATRTL_TASKING_OBJS))
+ $(RANLIB_FOR_TARGET) $(RTSDIR)/libgnarl$(arext)
+ $(AR_FOR_TARGET) $(AR_FLAGS) $(RTSDIR)/libgnala$(arext) \
+ $(addprefix $(RTSDIR)/,$(GNATRTL_LINEARALGEBRA_OBJS))
+ $(RANLIB_FOR_TARGET) $(RTSDIR)/libgnala$(arext)
+ ifeq ($(GMEM_LIB),gmemlib)
+ $(AR_FOR_TARGET) $(AR_FLAGS) $(RTSDIR)/libgmem$(arext) \
+ $(RTSDIR)/memtrack.o
+ $(RANLIB_FOR_TARGET) $(RTSDIR)/libgmem$(arext)
+ endif
+ $(CHMOD) a-wx $(RTSDIR)/*.ali
+ touch ../stamp-gnatlib-$(RTSDIR)
+
+# Warning: this target assumes that LIBRARY_VERSION has been set correctly.
+gnatlib-shared-default:
+ $(MAKE) $(FLAGS_TO_PASS) \
+ GNATLIBFLAGS="$(GNATLIBFLAGS)" \
+ GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(TARGET_LIBGCC2_CFLAGS)" \
+ MULTISUBDIR="$(MULTISUBDIR)" \
+ THREAD_KIND="$(THREAD_KIND)" \
+ gnatlib
+ $(RM) $(RTSDIR)/libgna*$(soext)
+ cd $(RTSDIR); ../../xgcc -B../../ -shared $(GNATLIBCFLAGS) \
+ $(TARGET_LIBGCC2_CFLAGS) \
+ -o libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
+ $(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) \
+ $(SO_OPTS)libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
+ $(MISCLIB) -lm
+ cd $(RTSDIR); ../../xgcc -B../../ -shared $(GNATLIBCFLAGS) \
+ $(TARGET_LIBGCC2_CFLAGS) \
+ -o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
+ $(GNATRTL_TASKING_OBJS) \
+ $(SO_OPTS)libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
+ $(THREADSLIB)
+ cd $(RTSDIR); $(LN_S) libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
+ libgnat$(soext)
+ cd $(RTSDIR); $(LN_S) libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
+ libgnarl$(soext)
+
+gnatlib-shared-dual:
+ $(MAKE) $(FLAGS_TO_PASS) \
+ GNATLIBFLAGS="$(GNATLIBFLAGS)" \
+ GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
+ MULTISUBDIR="$(MULTISUBDIR)" \
+ THREAD_KIND="$(THREAD_KIND)" \
+ gnatlib-shared-default
+ $(MV) $(RTSDIR)/libgna*$(soext) .
+ $(RM) ../stamp-gnatlib2-$(RTSDIR)
+ $(MAKE) $(FLAGS_TO_PASS) \
+ GNATLIBFLAGS="$(GNATLIBFLAGS)" \
+ GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
+ MULTISUBDIR="$(MULTISUBDIR)" \
+ THREAD_KIND="$(THREAD_KIND)" \
+ gnatlib
+ $(MV) libgna*$(soext) $(RTSDIR)
+
+gnatlib-shared-dual-win32:
+ $(MAKE) $(FLAGS_TO_PASS) \
+ GNATLIBFLAGS="$(GNATLIBFLAGS)" \
+ GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(TARGET_LIBGCC2_CFLAGS)" \
+ MULTISUBDIR="$(MULTISUBDIR)" \
+ THREAD_KIND="$(THREAD_KIND)" \
+ gnatlib-shared-win32
+ $(MV) $(RTSDIR)/libgna*$(soext) .
+ $(RM) ../stamp-gnatlib2-$(RTSDIR)
+ $(MAKE) $(FLAGS_TO_PASS) \
+ GNATLIBFLAGS="$(GNATLIBFLAGS)" \
+ GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
+ MULTISUBDIR="$(MULTISUBDIR)" \
+ THREAD_KIND="$(THREAD_KIND)" \
+ gnatlib
+ $(MV) libgna*$(soext) $(RTSDIR)
+
+# ??? we need to add the option to support auto-import of arrays/records to
+# the GNATLIBFLAGS when this will be supported by GNAT. At this point we will
+# use the gnatlib-shared-dual-win32 target to build the GNAT runtimes on
+# Windows.
+gnatlib-shared-win32:
+ $(MAKE) $(FLAGS_TO_PASS) \
+ GNATLIBFLAGS="$(GNATLIBFLAGS)" \
+ GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(TARGET_LIBGCC2_CFLAGS)" \
+ MULTISUBDIR="$(MULTISUBDIR)" \
+ THREAD_KIND="$(THREAD_KIND)" \
+ gnatlib
+ $(RM) $(RTSDIR)/libgna*$(soext)
+ cd $(RTSDIR); ../../xgcc -B../../ -shared $(TARGET_LIBGCC2_CFLAGS) \
+ -o libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
+ $(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) \
+ $(SO_OPTS)libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) $(MISCLIB)
+ cd $(RTSDIR); ../../xgcc -B../../ -shared $(TARGET_LIBGCC2_CFLAGS) \
+ -o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
+ $(GNATRTL_TASKING_OBJS) \
+ $(SO_OPTS)libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
+ $(THREADSLIB) -Wl,libgnat$(hyphen)$(LIBRARY_VERSION)$(soext)
+
+gnatlib-shared-darwin:
+ $(MAKE) $(FLAGS_TO_PASS) \
+ GNATLIBFLAGS="$(GNATLIBFLAGS)" \
+ GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(TARGET_LIBGCC2_CFLAGS) \
+ -fno-common" \
+ MULTISUBDIR="$(MULTISUBDIR)" \
+ THREAD_KIND="$(THREAD_KIND)" \
+ gnatlib
+ $(RM) $(RTSDIR)/libgnat$(soext) $(RTSDIR)/libgnarl$(soext)
+ cd $(RTSDIR); ../../xgcc -B../../ -dynamiclib $(TARGET_LIBGCC2_CFLAGS) \
+ -o libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
+ $(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) \
+ $(SO_OPTS) \
+ $(MISCLIB) -lm
+ cd $(RTSDIR); ../../xgcc -B../../ -dynamiclib $(TARGET_LIBGCC2_CFLAGS) \
+ -o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
+ $(GNATRTL_TASKING_OBJS) \
+ $(SO_OPTS) \
+ $(THREADSLIB) -Wl,libgnat$(hyphen)$(LIBRARY_VERSION)$(soext)
+ cd $(RTSDIR); $(LN_S) libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
+ libgnat$(soext)
+ cd $(RTSDIR); $(LN_S) libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
+ libgnarl$(soext)
+
+gnatlib-shared-vms:
+ $(MAKE) $(FLAGS_TO_PASS) \
+ GNATLIBFLAGS="$(GNATLIBFLAGS)" \
+ GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
+ MULTISUBDIR="$(MULTISUBDIR)" \
+ THREAD_KIND="$(THREAD_KIND)" \
+ gnatlib
+ $(RM) $(RTSDIR)/libgna*$(soext)
+ cd $(RTSDIR) && \
+ ../../gnatsym -s SYMVEC_$$$$.opt \
+ $(LIBGNAT_OBJS) $(GNATRTL_NONTASKING_OBJS) && \
+ ../../xgcc -g -B../../ -shared -shared-libgcc \
+ -o libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) libgnat.a \
+ sys\$$library:trace.exe \
+ --for-linker=/noinform \
+ --for-linker=SYMVEC_$$$$.opt \
+ --for-linker=gsmatch=equal,$(GSMATCH_VERSION)
+ cd $(RTSDIR) && \
+ ../../gnatsym -s SYMVEC_$$$$.opt \
+ $(GNATRTL_TASKING_OBJS) && \
+ ../../xgcc -g -B../../ -shared -shared-libgcc \
+ -o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
+ libgnarl.a libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
+ sys\$$library:trace.exe \
+ --for-linker=/noinform \
+ --for-linker=SYMVEC_$$$$.opt \
+ --for-linker=gsmatch=equal,$(GSMATCH_VERSION)
+
+gnatlib-shared:
+ $(MAKE) $(FLAGS_TO_PASS) \
+ GNATLIBFLAGS="$(GNATLIBFLAGS)" \
+ GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
+ MULTISUBDIR="$(MULTISUBDIR)" \
+ THREAD_KIND="$(THREAD_KIND)" \
+ TARGET_LIBGCC2_CFLAGS="$(TARGET_LIBGCC2_CFLAGS)" \
+ $(GNATLIB_SHARED)
+
+gnatlib-sjlj:
+ $(MAKE) $(FLAGS_TO_PASS) EH_MECHANISM="" ../stamp-gnatlib1-$(RTSDIR)
+ sed -e 's/ZCX_By_Default.*/ZCX_By_Default : constant Boolean := False;/' $(RTSDIR)/system.ads > $(RTSDIR)/s.ads
+ $(MV) $(RTSDIR)/s.ads $(RTSDIR)/system.ads
+ $(MAKE) $(FLAGS_TO_PASS) \
+ EH_MECHANISM="" \
+ GNATLIBFLAGS="$(GNATLIBFLAGS)" \
+ GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
+ MULTISUBDIR="$(MULTISUBDIR)" \
+ THREAD_KIND="$(THREAD_KIND)" \
+ TARGET_LIBGCC2_CFLAGS="$(TARGET_LIBGCC2_CFLAGS)" gnatlib
+
+gnatlib-zcx:
+ $(MAKE) $(FLAGS_TO_PASS) EH_MECHANISM="-gcc" ../stamp-gnatlib1-$(RTSDIR)
+ sed -e 's/ZCX_By_Default.*/ZCX_By_Default : constant Boolean := True;/' $(RTSDIR)/system.ads > $(RTSDIR)/s.ads
+ $(MV) $(RTSDIR)/s.ads $(RTSDIR)/system.ads
+ $(MAKE) $(FLAGS_TO_PASS) \
+ EH_MECHANISM="-gcc" \
+ GNATLIBFLAGS="$(GNATLIBFLAGS)" \
+ GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
+ MULTISUBDIR="$(MULTISUBDIR)" \
+ THREAD_KIND="$(THREAD_KIND)" \
+ TARGET_LIBGCC2_CFLAGS="$(TARGET_LIBGCC2_CFLAGS)" gnatlib
+
+# .s files for cross-building
+gnat-cross: force
+ make $(GNAT1_ADA_OBJS) CC="gcc -B../stage1/" CFLAGS="-S -gnatp"
+
+# Compiling object files from source files.
+
+# Note that dependencies on obstack.h are not written
+# because that file is not part of GCC.
+# Dependencies on gvarargs.h are not written
+# because all that file does, when not compiling with GCC,
+# is include the system varargs.h.
+
+b_gnatl.c : $(GNATLINK_OBJS)
+ $(GNATBIND) -C $(ADA_INCLUDES) -o b_gnatl.c gnatlink.ali
+b_gnatl.o : b_gnatl.c
+
+b_gnatm.c : $(GNATMAKE_OBJS)
+ $(GNATBIND) -C $(ADA_INCLUDES) -o b_gnatm.c gnatmake.ali
+b_gnatm.o : b_gnatm.c
+
+ADA_INCLUDE_DIR = $(libsubdir)/adainclude
+ADA_RTL_OBJ_DIR = $(libsubdir)/adalib
+
+# force no sibling call optimization on s-traceb.o so the number of stack
+# frames to be skipped when computing a call chain is not modified by
+# optimization. However we can do that only when building the runtime
+# (not the compiler) because the -fno-optimize-sibling-calls option exists
+# only in GCC 3 and above.
+
+ifneq (,$(findstring xgcc,$(CC)))
+NO_SIBLING_ADAFLAGS=-fno-optimize-sibling-calls
+else
+NO_SIBLING_ADAFLAGS=
+endif
+
+s-traceb.o : s-traceb.adb
+ $(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) \
+ $(NO_SIBLING_ADAFLAGS) $(ADA_INCLUDES) \
+ $< $(OUTPUT_OPTION)
+
+# force debugging information on s-tasdeb.o so that it is always
+# possible to set conditional breakpoints on tasks.
+
+s-tasdeb.o : s-tasdeb.adb s-tasdeb.ads
+ $(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) -O0 $(ADA_INCLUDES) \
+ $< $(OUTPUT_OPTION)
+
+# force no function reordering on a-except.o because of the exclusion bounds
+# mechanism (see the source file for more detailed information). However we
+# can do that only when building the runtime (not the compiler) because the
+# -fno-toplevel-reorder option exists only in GCC 4.2 and above.
+
+ifneq (,$(findstring xgcc,$(CC)))
+NO_REORDER_ADAFLAGS=-fno-toplevel-reorder
+else
+NO_REORDER_ADAFLAGS=
+endif
+
+# force debugging information on a-except.o so that it is always
+# possible to set conditional breakpoints on exceptions.
+# use -O1 otherwise gdb isn't able to get a full backtrace on mips targets.
+
+a-except.o : a-except.adb a-except.ads
+ $(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) -O1 -fno-inline \
+ $(NO_REORDER_ADAFLAGS) $(ADA_INCLUDES) $< $(OUTPUT_OPTION)
+
+# compile s-except.o without optimization and with debug info to let the
+# debugger set breakpoints and inspect subprogram parameters on exception
+# related events.
+
+s-except.o : s-except.adb s-except.ads
+ $(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) -O0 $(ADA_INCLUDES) \
+ $< $(OUTPUT_OPTION)
+
+# force debugging information on s-assert.o so that it is always
+# possible to set breakpoint on assert failures.
+
+s-assert.o : s-assert.adb s-assert.ads a-except.ads
+ $(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) -O2 $(ADA_INCLUDES) \
+ $< $(OUTPUT_OPTION)
+
+adadecode.o : adadecode.c adadecode.h
+aux-io.o : aux-io.c
+argv.o : argv.c
+cal.o : cal.c
+deftarg.o : deftarg.c
+errno.o : errno.c
+exit.o : adaint.h exit.c
+expect.o : expect.c
+final.o : final.c
+gmem.o : gmem.c
+link.o : link.c
+mkdir.o : mkdir.c
+socket.o : socket.c gsocket.h
+sysdep.o : sysdep.c
+raise-gcc.o : raise-gcc.c raise.h
+raise.o : raise.c raise.h
+vx_stack_info.o : vx_stack_info.c
+
+cio.o : cio.c
+ $(CC) -c $(ALL_CFLAGS) $(ADA_CFLAGS) \
+ $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
+
+init.o : init.c adaint.h raise.h
+ $(CC) -c $(ALL_CFLAGS) $(ADA_CFLAGS) \
+ $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
+
+initialize.o : initialize.c raise.h
+ $(CC) -c $(ALL_CFLAGS) $(ADA_CFLAGS) \
+ $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
+
+targext.o : targext.c
+ $(CC) -c $(ALL_CFLAGS) $(ADA_CFLAGS) \
+ $(ALL_CPPFLAGS) $(INCLUDES_FOR_SUBDIR) \
+ $< $(OUTPUT_OPTION)
+
+# No optimization to compile this file as optimizations (-O1 or above) breaks
+# the SEH handling on Windows. The reasons are not clear.
+seh_init.o : seh_init.c raise.h
+ $(CC) -c $(ALL_CFLAGS) $(ADA_CFLAGS) -O0 \
+ $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
+
+# Need to keep the frame pointer in this file to pop the stack properly on
+# some targets.
+tracebak.o : tracebak.c tb-alvms.c tb-alvxw.c tb-gcc.c
+ $(CC) -c $(ALL_CFLAGS) $(ADA_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
+ -fno-omit-frame-pointer $< $(OUTPUT_OPTION)
+
+# In GNU Make, ignore whether `stage*' exists.
+.PHONY: stage1 stage2 stage3 stage4 clean realclean TAGS bootstrap
+.PHONY: risky-stage1 risky-stage2 risky-stage3 risky-stage4
+
+force:
+
+# Gnatlbr, Vms_help, and Gnat.hlp are only used on VMS
+
+../../gnatlbr$(exeext): ../../prefix.o
+ $(GNATMAKE) -c $(ADA_INCLUDES) gnatlbr --GCC="$(CC) $(ALL_ADAFLAGS)"
+ $(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatlbr
+ $(GNATLINK) -v gnatlbr -o $@ --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
+
+../../vms_help$(exeext):
+ $(GNATMAKE) -c $(ADA_INCLUDES) vms_help --GCC="$(CC) $(ALL_ADAFLAGS)"
+ $(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) vms_help
+ $(GNATLINK) -v vms_help -o $@ --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
+
+../../gnat.hlp: ../../vms_help$(exeext)
+ ../../vms_help$(exeext) $(fsrcdir)/gnat.help_in \
+ $(fsrcdir)/vms_data.ads ../../gnat.hlp
diff --git a/gcc/ada/ada-tree.def b/gcc/ada/gcc-interface/ada-tree.def
index 0a1949f6710..0a1949f6710 100644
--- a/gcc/ada/ada-tree.def
+++ b/gcc/ada/gcc-interface/ada-tree.def
diff --git a/gcc/ada/ada-tree.h b/gcc/ada/gcc-interface/ada-tree.h
index 044cea811b3..1db5ce28ecf 100644
--- a/gcc/ada/ada-tree.h
+++ b/gcc/ada/gcc-interface/ada-tree.h
@@ -26,7 +26,7 @@
/* Ada uses the lang_decl and lang_type fields to hold a tree. */
union lang_tree_node
GTY((desc ("0"),
- chain_next ("(union lang_tree_node *)GENERIC_NEXT (&%h.t)")))
+ chain_next ("(union lang_tree_node *)TREE_CHAIN (&%h.t)")))
{
union tree_node GTY((tag ("0"))) t;
};
@@ -294,6 +294,12 @@ struct lang_type GTY(()) {tree t; };
#define SET_DECL_FUNCTION_STUB(NODE, X) \
SET_DECL_LANG_SPECIFIC (FUNCTION_DECL_CHECK (NODE), X)
+/* In a PARM_DECL, points to the alternate TREE_TYPE. */
+#define DECL_PARM_ALT_TYPE(NODE) \
+ GET_DECL_LANG_SPECIFIC (PARM_DECL_CHECK (NODE))
+#define SET_DECL_PARM_ALT_TYPE(NODE, X) \
+ SET_DECL_LANG_SPECIFIC (PARM_DECL_CHECK (NODE), X)
+
/* In a FIELD_DECL corresponding to a discriminant, contains the
discriminant number. */
#define DECL_DISCRIMINANT_NUMBER(NODE) DECL_INITIAL (FIELD_DECL_CHECK (NODE))
diff --git a/gcc/ada/ada.h b/gcc/ada/gcc-interface/ada.h
index 5f2191fdec9..5f2191fdec9 100644
--- a/gcc/ada/ada.h
+++ b/gcc/ada/gcc-interface/ada.h
diff --git a/gcc/ada/gcc-interface/config-lang.in b/gcc/ada/gcc-interface/config-lang.in
new file mode 100644
index 00000000000..4eb979034a2
--- /dev/null
+++ b/gcc/ada/gcc-interface/config-lang.in
@@ -0,0 +1,43 @@
+# Top level configure fragment for GNU Ada (GNAT).
+# Copyright (C) 1994-2008 Free Software Foundation, Inc.
+
+#This file is part of GCC.
+
+#GCC is free software; you can redistribute it and/or modify
+#it under the terms of the GNU General Public License as published by
+#the Free Software Foundation; either version 3, or (at your option)
+#any later version.
+
+#GCC is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+#GNU General Public License for more details.
+
+#You should have received a copy of the GNU General Public License
+#along with GCC; see the file COPYING3. If not see
+#<http://www.gnu.org/licenses/>.
+
+# Configure looks for the existence of this file to auto-config each language.
+# We define several parameters used by configure:
+#
+# language - name of language as it would appear in $(LANGUAGES)
+# boot_language - "yes" if we need to build this language in stage1
+# compilers - value to add to $(COMPILERS)
+
+language="ada"
+gcc_subdir="ada/gcc-interface"
+
+boot_language=yes
+boot_language_boot_flags='ADAFLAGS="$(BOOT_ADAFLAGS)"'
+
+compilers="gnat1\$(exeext)"
+
+gtfiles="\$(srcdir)/ada/gcc-interface/ada-tree.h \$(srcdir)/ada/gcc-interface/gigi.h \$(srcdir)/ada/gcc-interface/decl.c \$(srcdir)/ada/gcc-interface/trans.c \$(srcdir)/ada/gcc-interface/utils.c"
+
+outputs="ada/gcc-interface/Makefile ada/Makefile"
+
+target_libs="target-libada"
+lang_dirs="gnattools"
+
+# Ada will not work until the front end starts emitting GIMPLE trees.
+build_by_default=no
diff --git a/gcc/ada/cuintp.c b/gcc/ada/gcc-interface/cuintp.c
index 90ea342f6b5..90ea342f6b5 100644
--- a/gcc/ada/cuintp.c
+++ b/gcc/ada/gcc-interface/cuintp.c
diff --git a/gcc/ada/decl.c b/gcc/ada/gcc-interface/decl.c
index ebc2e5edd14..a136f96bcc8 100644
--- a/gcc/ada/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -367,12 +367,14 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
switch (kind)
{
case E_Constant:
- /* If this is a use of a deferred constant, get its full
- declaration. */
- if (!definition && Present (Full_View (gnat_entity)))
+ /* If this is a use of a deferred constant without address clause,
+ get its full definition. */
+ if (!definition
+ && No (Address_Clause (gnat_entity))
+ && Present (Full_View (gnat_entity)))
{
- gnu_decl = gnat_to_gnu_entity (Full_View (gnat_entity),
- gnu_expr, 0);
+ gnu_decl
+ = gnat_to_gnu_entity (Full_View (gnat_entity), gnu_expr, 0);
saved = true;
break;
}
@@ -391,12 +393,14 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
!= N_Allocator))
gnu_expr = gnat_to_gnu (Expression (Declaration_Node (gnat_entity)));
- /* Ignore deferred constant definitions; they are processed fully in the
- front-end. For deferred constant references get the full definition.
- On the other hand, constants that are renamings are handled like
- variable renamings. If No_Initialization is set, this is not a
- deferred constant but a constant whose value is built manually. */
- if (definition && !gnu_expr
+ /* Ignore deferred constant definitions without address clause since
+ they are processed fully in the front-end. If No_Initialization
+ is set, this is not a deferred constant but a constant whose value
+ is built manually. And constants that are renamings are handled
+ like variables. */
+ if (definition
+ && !gnu_expr
+ && No (Address_Clause (gnat_entity))
&& !No_Initialization (Declaration_Node (gnat_entity))
&& No (Renamed_Object (gnat_entity)))
{
@@ -404,12 +408,15 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
saved = true;
break;
}
- else if (!definition && IN (kind, Incomplete_Or_Private_Kind)
- && Present (Full_View (gnat_entity)))
+
+ /* Ignore constant definitions already marked with the error node. See
+ the N_Object_Declaration case of gnat_to_gnu for the rationale. */
+ if (definition
+ && gnu_expr
+ && present_gnu_tree (gnat_entity)
+ && get_gnu_tree (gnat_entity) == error_mark_node)
{
- gnu_decl = gnat_to_gnu_entity (Full_View (gnat_entity),
- NULL_TREE, 0);
- saved = true;
+ maybe_present = true;
break;
}
@@ -1037,17 +1044,17 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
&& !Is_Imported (gnat_entity) && !gnu_expr)
gnu_expr = integer_zero_node;
- /* If we are defining the object and it has an Address clause we must
- get the address expression from the saved GCC tree for the
- object if the object has a Freeze_Node. Otherwise, we elaborate
- the address expression here since the front-end has guaranteed
- in that case that the elaboration has no effects. Note that
- only the latter mechanism is currently in use. */
+ /* If we are defining the object and it has an Address clause, we must
+ either get the address expression from the saved GCC tree for the
+ object if it has a Freeze node, or elaborate the address expression
+ here since the front-end has guaranteed that the elaboration has no
+ effects in this case. */
if (definition && Present (Address_Clause (gnat_entity)))
{
tree gnu_address
- = (present_gnu_tree (gnat_entity) ? get_gnu_tree (gnat_entity)
- : gnat_to_gnu (Expression (Address_Clause (gnat_entity))));
+ = present_gnu_tree (gnat_entity)
+ ? get_gnu_tree (gnat_entity)
+ : gnat_to_gnu (Expression (Address_Clause (gnat_entity)));
save_gnu_tree (gnat_entity, NULL_TREE, false);
@@ -1064,6 +1071,13 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
|| compile_time_known_address_p (Expression (Address_Clause
(gnat_entity)));
+ /* If this is a deferred constant, the initializer is attached to
+ the full view. */
+ if (kind == E_Constant && Present (Full_View (gnat_entity)))
+ gnu_expr
+ = gnat_to_gnu
+ (Expression (Declaration_Node (Full_View (gnat_entity))));
+
/* If we don't have an initializing expression for the underlying
variable, the initializing expression for the pointer is the
specified address. Otherwise, we have to make a COMPOUND_EXPR
@@ -1536,15 +1550,20 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
gnu_expr, 0);
gnu_type = make_node (INTEGER_TYPE);
+ TREE_TYPE (gnu_type) = get_unpadded_type (Etype (gnat_entity));
+
+ /* Set the precision to the Esize except for bit-packed arrays and
+ subtypes of Standard.Boolean. */
if (Is_Packed_Array_Type (gnat_entity)
&& Is_Bit_Packed_Array (Original_Array_Type (gnat_entity)))
{
esize = UI_To_Int (RM_Size (gnat_entity));
TYPE_PACKED_ARRAY_TYPE_P (gnu_type) = 1;
}
+ else if (TREE_CODE (TREE_TYPE (gnu_type)) == BOOLEAN_TYPE)
+ esize = 1;
TYPE_PRECISION (gnu_type) = esize;
- TREE_TYPE (gnu_type) = get_unpadded_type (Etype (gnat_entity));
TYPE_MIN_VALUE (gnu_type)
= convert (TREE_TYPE (gnu_type),
@@ -1596,7 +1615,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
are uninitialized. Both goals are accomplished by wrapping the
modular value in an enclosing struct. */
if (Is_Packed_Array_Type (gnat_entity)
- && Is_Bit_Packed_Array (Original_Array_Type (gnat_entity)))
+ && Is_Bit_Packed_Array (Original_Array_Type (gnat_entity)))
{
tree gnu_field_type = gnu_type;
tree gnu_field;
@@ -3057,7 +3076,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
/* Discard old fields that are outside the new type.
This avoids confusing code scanning it to decide
- how to pass it to functions on some platforms. */
+ how to pass it to functions on some platforms. */
if (TREE_CODE (gnu_new_pos) == INTEGER_CST
&& TREE_CODE (TYPE_SIZE (gnu_type)) == INTEGER_CST
&& !integer_zerop (gnu_size)
@@ -3867,6 +3886,11 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
;
else if (By_Descriptor_Last <= mech && mech <= By_Descriptor)
mech = By_Descriptor;
+
+ else if (By_Short_Descriptor_Last <= mech &&
+ mech <= By_Short_Descriptor)
+ mech = By_Short_Descriptor;
+
else if (mech > 0)
{
if (TREE_CODE (gnu_param_type) == UNCONSTRAINED_ARRAY_TYPE
@@ -3908,7 +3932,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
= chainon (gnu_param, gnu_stub_param_list);
/* Change By_Descriptor parameter to By_Reference for
the internal version of an exported subprogram. */
- if (mech == By_Descriptor)
+ if (mech == By_Descriptor || mech == By_Short_Descriptor)
{
gnu_param
= gnat_to_gnu_param (gnat_param, By_Reference,
@@ -4015,19 +4039,15 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
if (TREE_CODE (gnu_return_type) == VOID_TYPE)
pure_flag = false;
- /* The semantics of "pure" in Ada essentially matches that of "const"
- in the back-end. In particular, both properties are orthogonal to
- the "nothrow" property. But this is true only if the EH circuitry
- is explicit in the internal representation of the back-end. If we
- are to completely hide the EH circuitry from it, we need to declare
- that calls to pure Ada subprograms that can throw have side effects
- since they can trigger an "abnormal" transfer of control flow; thus
- they can be neither "const" nor "pure" in the back-end sense. */
+ /* The semantics of "pure" in Ada used to essentially match that of
+ "const" in the middle-end. In particular, both properties were
+ orthogonal to the "nothrow" property. This is not true in the
+ middle-end any more and we have no choice but to ignore the hint
+ at this stage. */
+
gnu_type
= build_qualified_type (gnu_type,
TYPE_QUALS (gnu_type)
- | (Exception_Mechanism == Back_End_Exceptions
- ? TYPE_QUAL_CONST * pure_flag : 0)
| (TYPE_QUAL_VOLATILE * volatile_flag));
Sloc_to_locus (Sloc (gnat_entity), &input_location);
@@ -4774,6 +4794,7 @@ gnat_to_gnu_param (Entity_Id gnat_param, Mechanism_Type mech,
{
tree gnu_param_name = get_entity_name (gnat_param);
tree gnu_param_type = gnat_to_gnu_type (Etype (gnat_param));
+ tree gnu_param_type_alt = NULL_TREE;
bool in_param = (Ekind (gnat_param) == E_In_Parameter);
/* The parameter can be indirectly modified if its address is taken. */
bool ro_param = in_param && !Address_Taken (gnat_param);
@@ -4821,11 +4842,25 @@ gnat_to_gnu_param (Entity_Id gnat_param, Mechanism_Type mech,
= TREE_TYPE (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (gnu_param_type))));
/* VMS descriptors are themselves passed by reference. */
- if (mech == By_Descriptor)
+ if (mech == By_Short_Descriptor ||
+ (mech == By_Descriptor && TARGET_ABI_OPEN_VMS && !TARGET_MALLOC64))
gnu_param_type
- = build_pointer_type (build_vms_descriptor (gnu_param_type,
- Mechanism (gnat_param),
- gnat_subprog));
+ = build_pointer_type (build_vms_descriptor32 (gnu_param_type,
+ Mechanism (gnat_param),
+ gnat_subprog));
+ else if (mech == By_Descriptor)
+ {
+ /* Build both a 32-bit and 64-bit descriptor, one of which will be
+ chosen in fill_vms_descriptor. */
+ gnu_param_type_alt
+ = build_pointer_type (build_vms_descriptor32 (gnu_param_type,
+ Mechanism (gnat_param),
+ gnat_subprog));
+ gnu_param_type
+ = build_pointer_type (build_vms_descriptor (gnu_param_type,
+ Mechanism (gnat_param),
+ gnat_subprog));
+ }
/* Arrays are passed as pointers to element type for foreign conventions. */
else if (foreign
@@ -4906,6 +4941,7 @@ gnat_to_gnu_param (Entity_Id gnat_param, Mechanism_Type mech,
&& !by_ref
&& (by_return
|| (mech != By_Descriptor
+ && mech != By_Short_Descriptor
&& !POINTER_TYPE_P (gnu_param_type)
&& !AGGREGATE_TYPE_P (gnu_param_type)))
&& !(Is_Array_Type (Etype (gnat_param))
@@ -4917,10 +4953,15 @@ gnat_to_gnu_param (Entity_Id gnat_param, Mechanism_Type mech,
ro_param || by_ref || by_component_ptr);
DECL_BY_REF_P (gnu_param) = by_ref;
DECL_BY_COMPONENT_PTR_P (gnu_param) = by_component_ptr;
- DECL_BY_DESCRIPTOR_P (gnu_param) = (mech == By_Descriptor);
+ DECL_BY_DESCRIPTOR_P (gnu_param) = (mech == By_Descriptor ||
+ mech == By_Short_Descriptor);
DECL_POINTS_TO_READONLY_P (gnu_param)
= (ro_param && (by_ref || by_component_ptr));
+ /* Save the alternate descriptor type, if any. */
+ if (gnu_param_type_alt)
+ SET_DECL_PARM_ALT_TYPE (gnu_param, gnu_param_type_alt);
+
/* If no Mechanism was specified, indicate what we're using, then
back-annotate it. */
if (mech == Default)
@@ -7094,7 +7135,8 @@ set_rm_size (Uint uint_size, tree gnu_type, Entity_Id gnat_entity)
if (TREE_CODE (gnu_type) == INTEGER_TYPE
&& Is_Discrete_Or_Fixed_Point_Type (gnat_entity))
TYPE_RM_SIZE_NUM (gnu_type) = size;
- else if (TREE_CODE (gnu_type) == ENUMERAL_TYPE)
+ else if (TREE_CODE (gnu_type) == ENUMERAL_TYPE
+ || TREE_CODE (gnu_type) == BOOLEAN_TYPE)
TYPE_RM_SIZE_NUM (gnu_type) = size;
else if ((TREE_CODE (gnu_type) == RECORD_TYPE
|| TREE_CODE (gnu_type) == UNION_TYPE
@@ -7112,7 +7154,7 @@ static tree
make_type_from_size (tree type, tree size_tree, bool for_biased)
{
unsigned HOST_WIDE_INT size;
- bool biased_p;
+ bool biased_p, boolean_p;
tree new_type;
/* If size indicates an error, just return TYPE to avoid propagating
@@ -7126,13 +7168,23 @@ make_type_from_size (tree type, tree size_tree, bool for_biased)
{
case INTEGER_TYPE:
case ENUMERAL_TYPE:
+ case BOOLEAN_TYPE:
biased_p = (TREE_CODE (type) == INTEGER_TYPE
&& TYPE_BIASED_REPRESENTATION_P (type));
+ boolean_p = (TREE_CODE (type) == BOOLEAN_TYPE
+ || (TREE_CODE (type) == INTEGER_TYPE
+ && TREE_TYPE (type)
+ && TREE_CODE (TREE_TYPE (type)) == BOOLEAN_TYPE));
+
+ if (boolean_p)
+ size = round_up_to_align (size, BITS_PER_UNIT);
+
/* Only do something if the type is not a packed array type and
doesn't already have the proper size. */
if (TYPE_PACKED_ARRAY_TYPE_P (type)
- || (TYPE_PRECISION (type) == size && biased_p == for_biased))
+ || (biased_p == for_biased && TYPE_PRECISION (type) == size)
+ || (boolean_p && compare_tree_int (TYPE_SIZE (type), size) == 0))
break;
biased_p |= for_biased;
@@ -7142,22 +7194,33 @@ make_type_from_size (tree type, tree size_tree, bool for_biased)
new_type = make_unsigned_type (size);
else
new_type = make_signed_type (size);
+ if (boolean_p)
+ TYPE_PRECISION (new_type) = 1;
TREE_TYPE (new_type) = TREE_TYPE (type) ? TREE_TYPE (type) : type;
TYPE_MIN_VALUE (new_type)
= convert (TREE_TYPE (new_type), TYPE_MIN_VALUE (type));
TYPE_MAX_VALUE (new_type)
= convert (TREE_TYPE (new_type), TYPE_MAX_VALUE (type));
TYPE_BIASED_REPRESENTATION_P (new_type) = biased_p;
- TYPE_RM_SIZE_NUM (new_type) = bitsize_int (size);
+ if (boolean_p)
+ TYPE_RM_SIZE_NUM (new_type) = bitsize_int (1);
+ else
+ TYPE_RM_SIZE_NUM (new_type) = bitsize_int (size);
return new_type;
case RECORD_TYPE:
/* Do something if this is a fat pointer, in which case we
may need to return the thin pointer. */
if (TYPE_IS_FAT_POINTER_P (type) && size < POINTER_SIZE * 2)
- return
- build_pointer_type
- (TYPE_OBJECT_RECORD_TYPE (TYPE_UNCONSTRAINED_ARRAY (type)));
+ {
+ enum machine_mode p_mode = mode_for_size (size, MODE_INT, 0);
+ if (!targetm.valid_pointer_mode (p_mode))
+ p_mode = ptr_mode;
+ return
+ build_pointer_type_for_mode
+ (TYPE_OBJECT_RECORD_TYPE (TYPE_UNCONSTRAINED_ARRAY (type)),
+ p_mode, 0);
+ }
break;
case POINTER_TYPE:
diff --git a/gcc/ada/deftarg.c b/gcc/ada/gcc-interface/deftarg.c
index 28c7db5f702..28c7db5f702 100644
--- a/gcc/ada/deftarg.c
+++ b/gcc/ada/gcc-interface/deftarg.c
diff --git a/gcc/ada/gigi.h b/gcc/ada/gcc-interface/gigi.h
index 86ff090fdb0..e1c2fe923c9 100644
--- a/gcc/ada/gigi.h
+++ b/gcc/ada/gcc-interface/gigi.h
@@ -218,6 +218,7 @@ extern void gigi (Node_Id gnat_root, int max_gnat_node, int number_name,
struct List_Header *list_headers_ptr,
Nat number_file,
struct File_Info_Type *file_info_ptr,
+ Entity_Id standard_boolean,
Entity_Id standard_integer,
Entity_Id standard_long_long_float,
Entity_Id standard_exception_type,
@@ -233,8 +234,8 @@ extern tree gnat_to_gnu (Node_Id gnat_node);
extern void gnat_expand_stmt (tree gnu_stmt);
/* ??? missing documentation */
-extern int gnat_gimplify_expr (tree *expr_p, tree *pre_p,
- tree *post_p ATTRIBUTE_UNUSED);
+extern int gnat_gimplify_expr (tree *expr_p, gimple_seq *pre_p,
+ gimple_seq *post_p ATTRIBUTE_UNUSED);
/* Do the processing for the declaration of a GNAT_ENTITY, a type. If
a separate Freeze node exists, delay the bulk of the processing. Otherwise
@@ -393,6 +394,9 @@ enum standard_datatypes
/* Likewise for freeing memory. */
ADT_free_decl,
+ /* Function decl node for 64-bit multiplication with overflow checking */
+ ADT_mulv64_decl,
+
/* Types and decls used by our temporary exception mechanism. See
init_gigi_decls for details. */
ADT_jmpbuf_type,
@@ -424,6 +428,7 @@ extern GTY(()) tree gnat_raise_decls[(int) LAST_REASON_CODE + 1];
#define malloc_decl gnat_std_decls[(int) ADT_malloc_decl]
#define malloc32_decl gnat_std_decls[(int) ADT_malloc32_decl]
#define free_decl gnat_std_decls[(int) ADT_free_decl]
+#define mulv64_decl gnat_std_decls[(int) ADT_mulv64_decl]
#define jmpbuf_type gnat_std_decls[(int) ADT_jmpbuf_type]
#define jmpbuf_ptr_type gnat_std_decls[(int) ADT_jmpbuf_ptr_type]
#define get_jmpbuf_decl gnat_std_decls[(int) ADT_get_jmpbuf_decl]
@@ -668,17 +673,17 @@ extern tree create_label_decl (tree label_name);
appearing in the subprogram. */
extern void begin_subprog_body (tree subprog_decl);
-/* Finish the definition of the current subprogram and compile it all the way
- to assembler language output. BODY is the tree corresponding to
- the subprogram. */
-extern void end_subprog_body (tree body);
+/* Finish the definition of the current subprogram BODY and compile it all the
+ way to assembler language output. ELAB_P tells if this is called for an
+ elaboration routine, to be entirely discarded if empty. */
+extern void end_subprog_body (tree body, bool elab_p);
/* Build a template of type TEMPLATE_TYPE from the array bounds of ARRAY_TYPE.
EXPR is an expression that we can use to locate any PLACEHOLDER_EXPRs.
Return a constructor for the template. */
extern tree build_template (tree template_type, tree array_type, tree expr);
-/* Build a VMS descriptor from a Mechanism_Type, which must specify
+/* Build a 64bit VMS descriptor from a Mechanism_Type, which must specify
a descriptor type, and the GCC type of an object. Each FIELD_DECL
in the type contains in its DECL_INITIAL the expression to use when
a constructor is made for the type. GNAT_ENTITY is a gnat node used
@@ -687,6 +692,10 @@ extern tree build_template (tree template_type, tree array_type, tree expr);
extern tree build_vms_descriptor (tree type, Mechanism_Type mech,
Entity_Id gnat_entity);
+/* Build a 32bit VMS descriptor from a Mechanism_Type. See above. */
+extern tree build_vms_descriptor32 (tree type, Mechanism_Type mech,
+ Entity_Id gnat_entity);
+
/* Build a stub for the subprogram specified by the GCC tree GNU_SUBPROG
and the GNAT node GNAT_SUBPROG. */
extern void build_function_stub (tree gnu_subprog, Entity_Id gnat_subprog);
@@ -844,9 +853,10 @@ extern tree build_allocator (tree type, tree init, tree result_type,
Node_Id gnat_node, bool);
/* Fill in a VMS descriptor for EXPR and return a constructor for it.
- GNAT_FORMAL is how we find the descriptor record. */
-
-extern tree fill_vms_descriptor (tree expr, Entity_Id gnat_formal);
+ GNAT_FORMAL is how we find the descriptor record. GNAT_ACTUAL is how
+ we derive the source location on a C_E */
+extern tree fill_vms_descriptor (tree expr, Entity_Id gnat_formal,
+ Node_Id gnat_actual);
/* Indicate that we need to make the address of EXPR_NODE and it therefore
should not be allocated in a register. Return true if successful. */
@@ -903,3 +913,17 @@ extern Nat get_words_be (void);
extern Nat get_bytes_be (void);
extern Nat get_bits_be (void);
extern Nat get_strict_alignment (void);
+
+/* Let code know whether we are targetting VMS without need of
+ intrusive preprocessor directives. */
+#ifndef TARGET_ABI_OPEN_VMS
+#define TARGET_ABI_OPEN_VMS 0
+#endif
+
+/* VMS macro set by default, when clear forces 32bit mallocs and 32bit
+ Descriptors. Always used in combination with TARGET_ABI_OPEN_VMS
+ so no effect on non-VMS systems. */
+#ifndef TARGET_MALLOC64
+#define TARGET_MALLOC64 0
+#endif
+
diff --git a/gcc/ada/lang-specs.h b/gcc/ada/gcc-interface/lang-specs.h
index 65326d4c5b2..65326d4c5b2 100644
--- a/gcc/ada/lang-specs.h
+++ b/gcc/ada/gcc-interface/lang-specs.h
diff --git a/gcc/ada/lang.opt b/gcc/ada/gcc-interface/lang.opt
index d10fc3ac087..d10fc3ac087 100644
--- a/gcc/ada/lang.opt
+++ b/gcc/ada/gcc-interface/lang.opt
diff --git a/gcc/ada/misc.c b/gcc/ada/gcc-interface/misc.c
index 85dd22e8bb3..7c7dc02f36f 100644
--- a/gcc/ada/misc.c
+++ b/gcc/ada/gcc-interface/misc.c
@@ -240,7 +240,7 @@ gnat_handle_option (size_t scode, const char *arg, int value)
break;
case OPT_Wall:
- set_Wunused (value);
+ warn_unused = value;
/* We save the value of warn_uninitialized, since if they put
-Wuninitialized on the command line, we need to generate a
@@ -340,13 +340,6 @@ gnat_post_options (const char **pfilename ATTRIBUTE_UNUSED)
/* ??? The warning machinery is outsmarted by Ada. */
warn_unused_parameter = 0;
- flag_inline_trees = 1;
-
- if (!flag_no_inline)
- flag_no_inline = 1;
- if (flag_inline_functions)
- flag_inline_trees = 2;
-
/* Force eliminate_unused_debug_types to 0 unless an explicit positive
-f has been passed. This forces the default to 0 for Ada, which might
differ from the common default. */
@@ -551,6 +544,7 @@ gnat_print_type (FILE *file, tree node, int indent)
break;
case ENUMERAL_TYPE:
+ case BOOLEAN_TYPE:
print_node (file, "RM size", TYPE_RM_SIZE_NUM (node), indent + 4);
break;
diff --git a/gcc/ada/targtyps.c b/gcc/ada/gcc-interface/targtyps.c
index 79dafcaf2fe..c4e3299667d 100644
--- a/gcc/ada/targtyps.c
+++ b/gcc/ada/gcc-interface/targtyps.c
@@ -164,17 +164,13 @@ get_target_maximum_default_alignment (void)
Stricter alignment requests trigger gigi's aligning_type circuitry for
objects allocated by the default allocator. */
-#ifndef MALLOC_ALIGNMENT
-#define MALLOC_ALIGNMENT BIGGEST_ALIGNMENT
-#endif
-
Pos
get_target_default_allocator_alignment (void)
{
/* ??? Need a way to get info about __gnat_malloc from here (whether
it is handy and what alignment it honors). */
- return MALLOC_ALIGNMENT / BITS_PER_UNIT;
+ return MALLOC_ABI_ALIGNMENT / BITS_PER_UNIT;
}
/* Standard'Maximum_Allowed_Alignment. Maximum alignment that we may
diff --git a/gcc/ada/trans.c b/gcc/ada/gcc-interface/trans.c
index 89b10c695da..97ff3bd2269 100644
--- a/gcc/ada/trans.c
+++ b/gcc/ada/gcc-interface/trans.c
@@ -40,7 +40,8 @@
#include "except.h"
#include "debug.h"
#include "output.h"
-#include "tree-gimple.h"
+#include "tree-iterator.h"
+#include "gimple.h"
#include "ada.h"
#include "types.h"
#include "atree.h"
@@ -204,6 +205,8 @@ static void process_decls (List_Id, List_Id, Node_Id, bool, bool);
static tree emit_range_check (tree, Node_Id);
static tree emit_index_check (tree, tree, tree, tree);
static tree emit_check (tree, tree, int);
+static tree build_unary_op_trapv (enum tree_code, tree, tree);
+static tree build_binary_op_trapv (enum tree_code, tree, tree, tree);
static tree convert_with_check (Entity_Id, tree, bool, bool, bool);
static bool smaller_packable_type_p (tree, tree);
static bool addressable_p (tree, tree);
@@ -230,12 +233,12 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name,
struct Elist_Header *elists_ptr, struct Elmt_Item *elmts_ptr,
struct String_Entry *strings_ptr, Char_Code *string_chars_ptr,
struct List_Header *list_headers_ptr, Nat number_file,
- struct File_Info_Type *file_info_ptr,
+ struct File_Info_Type *file_info_ptr, Entity_Id standard_boolean,
Entity_Id standard_integer, Entity_Id standard_long_long_float,
Entity_Id standard_exception_type, Int gigi_operating_mode)
{
- tree gnu_standard_long_long_float;
- tree gnu_standard_exception_type;
+ Entity_Id gnat_literal;
+ tree gnu_standard_long_long_float, gnu_standard_exception_type, t;
struct elab_info *info;
int i;
@@ -310,6 +313,8 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name,
/* Give names and make TYPE_DECLs for common types. */
create_type_decl (get_identifier (SIZE_TYPE), sizetype,
NULL, false, true, Empty);
+ create_type_decl (get_identifier ("boolean"), boolean_type_node,
+ NULL, false, true, Empty);
create_type_decl (get_identifier ("integer"), integer_type_node,
NULL, false, true, Empty);
create_type_decl (get_identifier ("unsigned char"), char_type_node,
@@ -317,6 +322,26 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name,
create_type_decl (get_identifier ("long integer"), long_integer_type_node,
NULL, false, true, Empty);
+ /* Save the type we made for boolean as the type for Standard.Boolean. */
+ save_gnu_tree (Base_Type (standard_boolean), TYPE_NAME (boolean_type_node),
+ false);
+ gnat_literal = First_Literal (Base_Type (standard_boolean));
+ t = UI_To_gnu (Enumeration_Rep (gnat_literal), boolean_type_node);
+ gcc_assert (t == boolean_false_node);
+ t = create_var_decl (get_entity_name (gnat_literal), NULL_TREE,
+ boolean_type_node, t, true, false, false, false,
+ NULL, gnat_literal);
+ DECL_IGNORED_P (t) = 1;
+ save_gnu_tree (gnat_literal, t, false);
+ gnat_literal = Next_Literal (gnat_literal);
+ t = UI_To_gnu (Enumeration_Rep (gnat_literal), boolean_type_node);
+ gcc_assert (t == boolean_true_node);
+ t = create_var_decl (get_entity_name (gnat_literal), NULL_TREE,
+ boolean_type_node, t, true, false, false, false,
+ NULL, gnat_literal);
+ DECL_IGNORED_P (t) = 1;
+ save_gnu_tree (gnat_literal, t, false);
+
/* Save the type we made for integer as the type for Standard.Integer.
Then make the rest of the standard types. Note that some of these
may be subtypes. */
@@ -356,7 +381,6 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name,
for (info = elab_info_list; info; info = info->next)
{
tree gnu_body = DECL_SAVED_TREE (info->elab_proc);
- tree gnu_stmts;
/* Unshare SAVE_EXPRs between subprograms. These are not unshared by
the gimplifier for obvious reasons, but it turns out that we need to
@@ -368,30 +392,14 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name,
an upstream bug for which we would not change the outcome. */
walk_tree_without_duplicates (&gnu_body, unshare_save_expr, NULL);
- /* Set the current function to be the elaboration procedure and gimplify
- what we have. */
- current_function_decl = info->elab_proc;
- gimplify_body (&gnu_body, info->elab_proc, true);
-
- /* We should have a BIND_EXPR, but it may or may not have any statements
- in it. If it doesn't have any, we have nothing to do. */
- gnu_stmts = gnu_body;
- if (TREE_CODE (gnu_stmts) == BIND_EXPR)
- gnu_stmts = BIND_EXPR_BODY (gnu_stmts);
+ /* Process the function as others, but for indicating this is an
+ elab proc, to be discarded if empty, then propagate the status
+ up to the GNAT tree node. */
+ begin_subprog_body (info->elab_proc);
+ end_subprog_body (gnu_body, true);
- /* If there are no statements, there is no elaboration code. */
- if (!gnu_stmts || !STATEMENT_LIST_HEAD (gnu_stmts))
- {
- Set_Has_No_Elaboration_Code (info->gnat_node, 1);
- cgraph_remove_node (cgraph_node (info->elab_proc));
- }
- else
- {
- /* Otherwise, compile the function. Note that we'll be gimplifying
- it twice, but that's fine for the nodes we use. */
- begin_subprog_body (info->elab_proc);
- end_subprog_body (gnu_body);
- }
+ if (empty_body_p (gimple_body (info->elab_proc)))
+ Set_Has_No_Elaboration_Code (info->gnat_node, 1);
}
/* We cannot track the location of errors past this point. */
@@ -2003,7 +2011,7 @@ Subprogram_Body_to_gnu (Node_Id gnat_node)
: Sloc (gnat_node)),
&DECL_STRUCT_FUNCTION (gnu_subprog_decl)->function_end_locus);
- end_subprog_body (gnu_result);
+ end_subprog_body (gnu_result, false);
/* Disconnect the trees for parameters that we made variables for from the
GNAT entities since these are unusable after we end the function. */
@@ -2384,7 +2392,8 @@ call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target)
else
gnu_actual = build_unary_op (ADDR_EXPR, NULL_TREE,
fill_vms_descriptor (gnu_actual,
- gnat_formal));
+ gnat_formal,
+ gnat_actual));
}
else
{
@@ -3389,6 +3398,15 @@ gnat_to_gnu (Node_Id gnat_node)
if (type_annotate_only && gnu_expr && TREE_CODE (gnu_expr) == ERROR_MARK)
gnu_expr = NULL_TREE;
+ /* If this is a deferred constant with an address clause, we ignore the
+ full view since the clause is on the partial view and we cannot have
+ 2 different GCC trees for the object. The only bits of the full view
+ we will use is the initializer, but it will be directly fetched. */
+ if (Ekind(gnat_temp) == E_Constant
+ && Present (Address_Clause (gnat_temp))
+ && Present (Full_View (gnat_temp)))
+ save_gnu_tree (Full_View (gnat_temp), error_mark_node, true);
+
if (No (Freeze_Node (gnat_temp)))
gnat_to_gnu_entity (gnat_temp, gnu_expr, 1);
break;
@@ -3932,7 +3950,22 @@ gnat_to_gnu (Node_Id gnat_node)
gnu_rhs = convert (gnu_type, gnu_rhs);
}
- gnu_result = build_binary_op (code, gnu_type, gnu_lhs, gnu_rhs);
+ /* Instead of expanding overflow checks for addition, subtraction
+ and multiplication itself, the front end will leave this to
+ the back end when Backend_Overflow_Checks_On_Target is set.
+ As the GCC back end itself does not know yet how to properly
+ do overflow checking, do it here. The goal is to push
+ the expansions further into the back end over time. */
+ if (Do_Overflow_Check (gnat_node) && Backend_Overflow_Checks_On_Target
+ && (Nkind (gnat_node) == N_Op_Add
+ || Nkind (gnat_node) == N_Op_Subtract
+ || Nkind (gnat_node) == N_Op_Multiply)
+ && !TYPE_UNSIGNED (gnu_type)
+ && !FLOAT_TYPE_P (gnu_type))
+ gnu_result
+ = build_binary_op_trapv (code, gnu_type, gnu_lhs, gnu_rhs);
+ else
+ gnu_result = build_binary_op (code, gnu_type, gnu_lhs, gnu_rhs);
/* If this is a logical shift with the shift count not verified,
we must return zero if it is too large. We cannot compensate
@@ -3997,8 +4030,14 @@ gnat_to_gnu (Node_Id gnat_node)
gnu_result_type = get_unpadded_type (Base_Type
(Full_View (Etype (gnat_node))));
- gnu_result = build_unary_op (gnu_codes[Nkind (gnat_node)],
- gnu_result_type, gnu_expr);
+ if (Do_Overflow_Check (gnat_node)
+ && !TYPE_UNSIGNED (gnu_result_type)
+ && !FLOAT_TYPE_P (gnu_result_type))
+ gnu_result = build_unary_op_trapv (gnu_codes[Nkind (gnat_node)],
+ gnu_result_type, gnu_expr);
+ else
+ gnu_result = build_unary_op (gnu_codes[Nkind (gnat_node)],
+ gnu_result_type, gnu_expr);
break;
case N_Allocator:
@@ -4512,21 +4551,22 @@ gnat_to_gnu (Node_Id gnat_node)
/***************************************************/
case N_Attribute_Definition_Clause:
-
gnu_result = alloc_stmt_list ();
- /* The only one we need deal with is for 'Address. For the others, SEM
- puts the information elsewhere. We need only deal with 'Address
- if the object has a Freeze_Node (which it never will currently). */
- if (Get_Attribute_Id (Chars (gnat_node)) != Attr_Address
- || No (Freeze_Node (Entity (Name (gnat_node)))))
+ /* The only one we need to deal with is 'Address since, for the others,
+ the front-end puts the information elsewhere. */
+ if (Get_Attribute_Id (Chars (gnat_node)) != Attr_Address)
+ break;
+
+ /* And we only deal with 'Address if the object has a Freeze node. */
+ gnat_temp = Entity (Name (gnat_node));
+ if (No (Freeze_Node (gnat_temp)))
break;
- /* Get the value to use as the address and save it as the
- equivalent for GNAT_TEMP. When the object is frozen,
- gnat_to_gnu_entity will do the right thing. */
- save_gnu_tree (Entity (Name (gnat_node)),
- gnat_to_gnu (Expression (gnat_node)), true);
+ /* Get the value to use as the address and save it as the equivalent
+ for the object. When it is frozen, gnat_to_gnu_entity will do the
+ right thing. */
+ save_gnu_tree (gnat_temp, gnat_to_gnu (Expression (gnat_node)), true);
break;
case N_Enumeration_Representation_Clause:
@@ -5334,7 +5374,8 @@ pop_stack (tree *gnu_stack_ptr)
/* Generate GIMPLE in place for the expression at *EXPR_P. */
int
-gnat_gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p ATTRIBUTE_UNUSED)
+gnat_gimplify_expr (tree *expr_p, gimple_seq *pre_p,
+ gimple_seq *post_p ATTRIBUTE_UNUSED)
{
tree expr = *expr_p;
tree op;
@@ -5419,14 +5460,14 @@ gnat_gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p ATTRIBUTE_UNUSED)
&& TREE_CODE_CLASS (TREE_CODE (op)) != tcc_constant)
{
tree new_var = create_tmp_var (TREE_TYPE (op), "A");
- tree mod = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (op), new_var, op);
+ gimple stmt;
TREE_ADDRESSABLE (new_var) = 1;
+ stmt = gimplify_assign (new_var, op, pre_p);
if (EXPR_HAS_LOCATION (op))
- SET_EXPR_LOCUS (mod, EXPR_LOCUS (op));
+ gimple_set_location (stmt, *EXPR_LOCUS (op));
- gimplify_and_add (mod, pre_p);
TREE_OPERAND (expr, 0) = new_var;
recompute_tree_invariant_for_addr_expr (expr);
return GS_ALL_DONE;
@@ -5494,7 +5535,7 @@ gnat_gimplify_stmt (tree *stmt_p)
append_to_statement_list (LOOP_STMT_UPDATE (stmt), stmt_p);
t = build1 (GOTO_EXPR, void_type_node, gnu_start_label);
- set_expr_location (t, DECL_SOURCE_LOCATION (gnu_end_label));
+ SET_EXPR_LOCATION (t, DECL_SOURCE_LOCATION (gnu_end_label));
append_to_statement_list (t, stmt_p);
append_to_statement_list (build1 (LABEL_EXPR, void_type_node,
@@ -5716,9 +5757,9 @@ process_inlined_subprograms (Node_Id gnat_node)
Entity_Id gnat_entity;
Node_Id gnat_body;
- /* If we can inline, generate RTL for all the inlined subprograms.
+ /* If we can inline, generate Gimple for all the inlined subprograms.
Define the entity first so we set DECL_EXTERNAL. */
- if (optimize > 0 && !flag_really_no_inline)
+ if (optimize > 0)
for (gnat_entity = First_Inlined_Subprogram (gnat_node);
Present (gnat_entity);
gnat_entity = Next_Inlined_Subprogram (gnat_entity))
@@ -5867,6 +5908,159 @@ process_decls (List_Id gnat_decls, List_Id gnat_decls2,
}
}
+/* Make a unary operation of kind CODE using build_unary_op, but guard
+ the operation by an overflow check. CODE can be one of NEGATE_EXPR
+ or ABS_EXPR. GNU_TYPE is the type desired for the result.
+ Usually the operation is to be performed in that type. */
+
+static tree
+build_unary_op_trapv (enum tree_code code,
+ tree gnu_type,
+ tree operand)
+{
+ gcc_assert ((code == NEGATE_EXPR) || (code == ABS_EXPR));
+
+ operand = protect_multiple_eval (operand);
+
+ return emit_check (build_binary_op (EQ_EXPR, integer_type_node,
+ operand, TYPE_MIN_VALUE (gnu_type)),
+ build_unary_op (code, gnu_type, operand),
+ CE_Overflow_Check_Failed);
+}
+
+/* Make a binary operation of kind CODE using build_binary_op, but
+ guard the operation by an overflow check. CODE can be one of
+ PLUS_EXPR, MINUS_EXPR or MULT_EXPR. GNU_TYPE is the type desired
+ for the result. Usually the operation is to be performed in that type. */
+
+static tree
+build_binary_op_trapv (enum tree_code code,
+ tree gnu_type,
+ tree left,
+ tree right)
+{
+ tree lhs = protect_multiple_eval (left);
+ tree rhs = protect_multiple_eval (right);
+ tree type_max = TYPE_MAX_VALUE (gnu_type);
+ tree type_min = TYPE_MIN_VALUE (gnu_type);
+ tree gnu_expr;
+ tree tmp1, tmp2;
+ tree zero = convert (gnu_type, integer_zero_node);
+ tree rhs_ge_zero;
+ tree check_pos;
+ tree check_neg;
+
+ int precision = TYPE_PRECISION (gnu_type);
+
+ /* Prefer a constant rhs to simplify checks */
+
+ if (TREE_CONSTANT (lhs) && !TREE_CONSTANT (rhs)
+ && commutative_tree_code (code))
+ {
+ tree tmp = lhs;
+ lhs = rhs;
+ rhs = tmp;
+ }
+
+ /* In the case the right-hand size is still not constant, try to
+ use an exact operation in a wider type. */
+
+ if (!TREE_CONSTANT (rhs))
+ {
+ int needed_precision = code == MULT_EXPR ? 2 * precision : precision + 1;
+
+ if (code == MULT_EXPR && precision == 64)
+ {
+ return build_call_2_expr (mulv64_decl, lhs, rhs);
+ }
+ else if (needed_precision <= LONG_LONG_TYPE_SIZE)
+ {
+ tree calc_type = gnat_type_for_size (needed_precision, 0);
+ tree result;
+ tree check;
+
+ result = build_binary_op (code, calc_type,
+ convert (calc_type, lhs),
+ convert (calc_type, rhs));
+
+ check = build_binary_op
+ (TRUTH_ORIF_EXPR, integer_type_node,
+ build_binary_op (LT_EXPR, integer_type_node, result,
+ convert (calc_type, type_min)),
+ build_binary_op (GT_EXPR, integer_type_node, result,
+ convert (calc_type, type_max)));
+
+ result = convert (gnu_type, result);
+
+ return emit_check (check, result, CE_Overflow_Check_Failed);
+ }
+ }
+
+ gnu_expr = build_binary_op (code, gnu_type, lhs, rhs);
+ rhs_ge_zero = build_binary_op (GE_EXPR, integer_type_node, rhs, zero);
+
+ switch (code)
+ {
+ case PLUS_EXPR:
+ /* When rhs >= 0, overflow when lhs > type_max - rhs */
+ check_pos = build_binary_op (GT_EXPR, integer_type_node, lhs,
+ build_binary_op (MINUS_EXPR, gnu_type,
+ type_max, rhs)),
+
+ /* When rhs < 0, overflow when lhs < type_min - rhs */
+ check_neg = build_binary_op (LT_EXPR, integer_type_node, lhs,
+ build_binary_op (MINUS_EXPR, gnu_type,
+ type_min, rhs));
+ break;
+
+ case MINUS_EXPR:
+ /* When rhs >= 0, overflow when lhs < type_min + rhs */
+ check_pos = build_binary_op (LT_EXPR, integer_type_node, lhs,
+ build_binary_op (PLUS_EXPR, gnu_type,
+ type_min, rhs)),
+
+ /* When rhs < 0, overflow when lhs > type_max + rhs */
+ check_neg = build_binary_op (GT_EXPR, integer_type_node, lhs,
+ build_binary_op (PLUS_EXPR, gnu_type,
+ type_max, rhs));
+ break;
+
+ case MULT_EXPR:
+ /* The check here is designed to be efficient if the rhs is constant,
+ Four different check expressions determine wether X * C overflows,
+ depending on C.
+ C == 0 => false
+ C > 0 => X > type_max / C || X < type_min / C
+ C == -1 => X == type_min
+ C < -1 => X > type_min / C || X < type_max / C */
+
+ tmp1 = build_binary_op (TRUNC_DIV_EXPR, gnu_type, type_max, rhs);
+ tmp2 = build_binary_op (TRUNC_DIV_EXPR, gnu_type, type_min, rhs);
+
+ check_pos = build_binary_op (TRUTH_ANDIF_EXPR, integer_type_node,
+ build_binary_op (NE_EXPR, integer_type_node, zero, rhs),
+ build_binary_op (TRUTH_ORIF_EXPR, integer_type_node,
+ build_binary_op (GT_EXPR, integer_type_node, lhs, tmp1),
+ build_binary_op (LT_EXPR, integer_type_node, lhs, tmp2)));
+
+ check_neg = fold_build3 (COND_EXPR, integer_type_node,
+ build_binary_op (EQ_EXPR, integer_type_node, rhs,
+ build_int_cst (gnu_type, -1)),
+ build_binary_op (EQ_EXPR, integer_type_node, lhs, type_min),
+ build_binary_op (TRUTH_ORIF_EXPR, integer_type_node,
+ build_binary_op (GT_EXPR, integer_type_node, lhs, tmp2),
+ build_binary_op (LT_EXPR, integer_type_node, lhs, tmp1)));
+ break;
+
+ default:
+ gcc_unreachable();
+ }
+
+ return emit_check (fold_build3 (COND_EXPR, integer_type_node, rhs_ge_zero,
+ check_pos, check_neg),
+ gnu_expr, CE_Overflow_Check_Failed);
+}
+
/* Emit code for a range check. GNU_EXPR is the expression to be checked,
GNAT_RANGE_TYPE the gnat type or subtype containing the bounds against
which we have to check. */
@@ -6913,7 +7107,7 @@ set_expr_location_from_node (tree node, Node_Id gnat_node)
if (!Sloc_to_locus (Sloc (gnat_node), &locus))
return;
- set_expr_location (node, locus);
+ SET_EXPR_LOCATION (node, locus);
}
/* Return a colon-separated list of encodings contained in encoded Ada
diff --git a/gcc/ada/utils.c b/gcc/ada/gcc-interface/utils.c
index 92e83487b80..dcf0558ec9d 100644
--- a/gcc/ada/utils.c
+++ b/gcc/ada/gcc-interface/utils.c
@@ -43,7 +43,8 @@
#include "function.h"
#include "cgraph.h"
#include "tree-inline.h"
-#include "tree-gimple.h"
+#include "tree-iterator.h"
+#include "gimple.h"
#include "tree-dump.h"
#include "pointer-set.h"
#include "langhooks.h"
@@ -418,9 +419,11 @@ gnat_poplevel ()
void
gnat_pushdecl (tree decl, Node_Id gnat_node)
{
- /* If at top level, there is no context. But PARM_DECLs always go in the
- level of its function. */
- if (global_bindings_p () && TREE_CODE (decl) != PARM_DECL)
+ /* If this decl is public external or at toplevel, there is no context.
+ But PARM_DECLs always go in the level of its function. */
+ if (TREE_CODE (decl) != PARM_DECL
+ && ((DECL_EXTERNAL (decl) && TREE_PUBLIC (decl))
+ || global_bindings_p ()))
DECL_CONTEXT (decl) = 0;
else
{
@@ -520,6 +523,13 @@ gnat_init_decl_processing (void)
this before we can expand the GNAT types. */
size_type_node = gnat_type_for_size (GET_MODE_BITSIZE (Pmode), 0);
set_sizetype (size_type_node);
+
+ /* In Ada, we use an unsigned 8-bit type for the default boolean type. */
+ boolean_type_node = make_node (BOOLEAN_TYPE);
+ TYPE_PRECISION (boolean_type_node) = 1;
+ fixup_unsigned_type (boolean_type_node);
+ TYPE_RM_SIZE_NUM (boolean_type_node) = bitsize_int (1);
+
build_common_tree_nodes_2 (0);
ptr_void_type_node = build_pointer_type (void_type_node);
@@ -532,6 +542,7 @@ void
init_gigi_decls (tree long_long_float_type, tree exception_type)
{
tree endlink, decl;
+ tree int64_type = gnat_type_for_size (64, 0);
unsigned int i;
/* Set the types that GCC and Gigi use from the front end. We would like
@@ -620,6 +631,13 @@ init_gigi_decls (tree long_long_float_type, tree exception_type)
endlink)),
NULL_TREE, false, true, true, NULL, Empty);
+ /* This is used for 64-bit multiplication with overflow checking. */
+ mulv64_decl
+ = create_subprog_decl (get_identifier ("__gnat_mulv64"), NULL_TREE,
+ build_function_type_list (int64_type, int64_type,
+ int64_type, NULL_TREE),
+ NULL_TREE, false, true, true, NULL, Empty);
+
/* Make the types and functions used for exception processing. */
jmpbuf_type
= build_array_type (gnat_type_for_mode (Pmode, 0),
@@ -1471,9 +1489,9 @@ create_type_decl (tree type_name, tree type, struct attrib *attr_list,
CONST_FLAG is true if this variable is constant, in which case we might
return a CONST_DECL node unless CONST_DECL_ALLOWED_P is false.
- PUBLIC_FLAG is true if this definition is to be made visible outside of
- the current compilation unit. This flag should be set when processing the
- variable definitions in a package specification.
+ PUBLIC_FLAG is true if this is for a reference to a public entity or for a
+ definition to be made visible outside of the current compilation unit, for
+ instance variable definitions in a package specification.
EXTERN_FLAG is nonzero when processing an external variable declaration (as
opposed to a definition: no storage is to be allocated for the variable).
@@ -1549,7 +1567,7 @@ create_var_decl_1 (tree var_name, tree asm_name, tree type, tree var_init,
variable if and only if it's not external. If we are not at the top level
we allocate automatic storage unless requested not to. */
TREE_STATIC (var_decl)
- = public_flag || (global_bindings_p () ? !extern_flag : static_flag);
+ = !extern_flag && (public_flag || static_flag || global_bindings_p ());
if (asm_name && VAR_OR_FUNCTION_DECL_P (var_decl))
SET_DECL_ASSEMBLER_NAME (var_decl, asm_name);
@@ -1737,7 +1755,7 @@ create_field_decl (tree field_name, tree field_type, tree record_type,
of a copy. This is the case for true bitfields, but the DECL_BIT_FIELD
value we have at this point is not accurate enough, so we don't account
for this here and let finish_record_type decide. */
- if (!type_for_nonaliased_component_p (field_type))
+ if (!addressable && !type_for_nonaliased_component_p (field_type))
addressable = 1;
DECL_NONADDRESSABLE_P (field_decl) = !addressable;
@@ -1759,7 +1777,8 @@ create_param_decl (tree param_name, tree param_type, bool readonly)
lead to various ABI violations. */
if (targetm.calls.promote_prototypes (param_type)
&& (TREE_CODE (param_type) == INTEGER_TYPE
- || TREE_CODE (param_type) == ENUMERAL_TYPE)
+ || TREE_CODE (param_type) == ENUMERAL_TYPE
+ || TREE_CODE (param_type) == BOOLEAN_TYPE)
&& TYPE_PRECISION (param_type) < TYPE_PRECISION (integer_type_node))
{
/* We have to be careful about biased types here. Make a subtype
@@ -2197,12 +2216,12 @@ gnat_genericize (tree fndecl)
pointer_set_destroy (p_set);
}
-/* Finish the definition of the current subprogram and compile it all the way
- to assembler language output. BODY is the tree corresponding to
- the subprogram. */
+/* Finish the definition of the current subprogram BODY and compile it all the
+ way to assembler language output. ELAB_P tells if this is called for an
+ elaboration routine, to be entirely discarded if empty. */
void
-end_subprog_body (tree body)
+end_subprog_body (tree body, bool elab_p)
{
tree fndecl = current_function_decl;
@@ -2215,8 +2234,7 @@ end_subprog_body (tree body)
/* Deal with inline. If declared inline or we should default to inline,
set the flag in the decl. */
- DECL_INLINE (fndecl)
- = DECL_DECLARED_INLINE_P (fndecl) || flag_inline_trees == 2;
+ DECL_INLINE (fndecl) = 1;
/* We handle pending sizes via the elaboration of types, so we don't
need to save them. */
@@ -2245,7 +2263,13 @@ end_subprog_body (tree body)
if (!DECL_CONTEXT (fndecl))
{
gnat_gimplify_function (fndecl);
- cgraph_finalize_function (fndecl, false);
+
+ /* If this is an empty elaboration proc, just discard the node.
+ Otherwise, compile further. */
+ if (elab_p && empty_body_p (gimple_body (fndecl)))
+ cgraph_remove_node (cgraph_node (fndecl));
+ else
+ cgraph_finalize_function (fndecl, false);
}
else
/* Register this function with cgraph just far enough to get it
@@ -2627,7 +2651,7 @@ build_template (tree template_type, tree array_type, tree expr)
return gnat_build_constructor (template_type, nreverse (template_elts));
}
-/* Build a VMS descriptor from a Mechanism_Type, which must specify
+/* Build a 32bit VMS descriptor from a Mechanism_Type, which must specify
a descriptor type, and the GCC type of an object. Each FIELD_DECL
in the type contains in its DECL_INITIAL the expression to use when
a constructor is made for the type. GNAT_ENTITY is an entity used
@@ -2635,7 +2659,7 @@ build_template (tree template_type, tree array_type, tree expr)
an object of that type and also for the name. */
tree
-build_vms_descriptor (tree type, Mechanism_Type mech, Entity_Id gnat_entity)
+build_vms_descriptor32 (tree type, Mechanism_Type mech, Entity_Id gnat_entity)
{
tree record_type = make_node (RECORD_TYPE);
tree pointer32_type;
@@ -2665,7 +2689,7 @@ build_vms_descriptor (tree type, Mechanism_Type mech, Entity_Id gnat_entity)
idx_arr = (tree *) alloca (ndim * sizeof (tree));
- if (mech != By_Descriptor_NCA
+ if (mech != By_Descriptor_NCA && mech != By_Short_Descriptor_NCA
&& TREE_CODE (type) == ARRAY_TYPE && TYPE_CONVENTION_FORTRAN_P (type))
for (i = ndim - 1, inner_type = type;
i >= 0;
@@ -2682,6 +2706,7 @@ build_vms_descriptor (tree type, Mechanism_Type mech, Entity_Id gnat_entity)
{
case INTEGER_TYPE:
case ENUMERAL_TYPE:
+ case BOOLEAN_TYPE:
if (TYPE_VAX_FLOATING_POINT_P (type))
switch (tree_low_cst (TYPE_DIGITS_VALUE (type), 1))
{
@@ -2750,16 +2775,21 @@ build_vms_descriptor (tree type, Mechanism_Type mech, Entity_Id gnat_entity)
switch (mech)
{
case By_Descriptor_A:
+ case By_Short_Descriptor_A:
class = 4;
break;
case By_Descriptor_NCA:
+ case By_Short_Descriptor_NCA:
class = 10;
break;
case By_Descriptor_SB:
+ case By_Short_Descriptor_SB:
class = 15;
break;
case By_Descriptor:
+ case By_Short_Descriptor:
case By_Descriptor_S:
+ case By_Short_Descriptor_S:
default:
class = 1;
break;
@@ -2772,7 +2802,9 @@ build_vms_descriptor (tree type, Mechanism_Type mech, Entity_Id gnat_entity)
= chainon (field_list,
make_descriptor_field
("LENGTH", gnat_type_for_size (16, 1), record_type,
- size_in_bytes (mech == By_Descriptor_A ? inner_type : type)));
+ size_in_bytes ((mech == By_Descriptor_A ||
+ mech == By_Short_Descriptor_A)
+ ? inner_type : type)));
field_list = chainon (field_list,
make_descriptor_field ("DTYPE",
@@ -2798,10 +2830,13 @@ build_vms_descriptor (tree type, Mechanism_Type mech, Entity_Id gnat_entity)
switch (mech)
{
case By_Descriptor:
+ case By_Short_Descriptor:
case By_Descriptor_S:
+ case By_Short_Descriptor_S:
break;
case By_Descriptor_SB:
+ case By_Short_Descriptor_SB:
field_list
= chainon (field_list,
make_descriptor_field
@@ -2817,7 +2852,9 @@ build_vms_descriptor (tree type, Mechanism_Type mech, Entity_Id gnat_entity)
break;
case By_Descriptor_A:
+ case By_Short_Descriptor_A:
case By_Descriptor_NCA:
+ case By_Short_Descriptor_NCA:
field_list = chainon (field_list,
make_descriptor_field ("SCALE",
gnat_type_for_size (8, 1),
@@ -2834,7 +2871,8 @@ build_vms_descriptor (tree type, Mechanism_Type mech, Entity_Id gnat_entity)
= chainon (field_list,
make_descriptor_field
("AFLAGS", gnat_type_for_size (8, 1), record_type,
- size_int (mech == By_Descriptor_NCA
+ size_int ((mech == By_Descriptor_NCA ||
+ mech == By_Short_Descriptor_NCA)
? 0
/* Set FL_COLUMN, FL_COEFF, and FL_BOUNDS. */
: (TREE_CODE (type) == ARRAY_TYPE
@@ -2885,7 +2923,8 @@ build_vms_descriptor (tree type, Mechanism_Type mech, Entity_Id gnat_entity)
TYPE_MIN_VALUE (idx_arr[i])),
size_int (1)));
- fname[0] = (mech == By_Descriptor_NCA ? 'S' : 'M');
+ fname[0] = ((mech == By_Descriptor_NCA ||
+ mech == By_Short_Descriptor_NCA) ? 'S' : 'M');
fname[1] = '0' + i, fname[2] = 0;
field_list
= chainon (field_list,
@@ -2893,7 +2932,7 @@ build_vms_descriptor (tree type, Mechanism_Type mech, Entity_Id gnat_entity)
gnat_type_for_size (32, 1),
record_type, idx_length));
- if (mech == By_Descriptor_NCA)
+ if (mech == By_Descriptor_NCA || mech == By_Short_Descriptor_NCA)
tem = idx_length;
}
@@ -2929,6 +2968,322 @@ build_vms_descriptor (tree type, Mechanism_Type mech, Entity_Id gnat_entity)
return record_type;
}
+/* Build a 64bit VMS descriptor from a Mechanism_Type, which must specify
+ a descriptor type, and the GCC type of an object. Each FIELD_DECL
+ in the type contains in its DECL_INITIAL the expression to use when
+ a constructor is made for the type. GNAT_ENTITY is an entity used
+ to print out an error message if the mechanism cannot be applied to
+ an object of that type and also for the name. */
+
+tree
+build_vms_descriptor (tree type, Mechanism_Type mech, Entity_Id gnat_entity)
+{
+ tree record64_type = make_node (RECORD_TYPE);
+ tree pointer64_type;
+ tree field_list64 = 0;
+ int class;
+ int dtype = 0;
+ tree inner_type;
+ int ndim;
+ int i;
+ tree *idx_arr;
+ tree tem;
+
+ /* If TYPE is an unconstrained array, use the underlying array type. */
+ if (TREE_CODE (type) == UNCONSTRAINED_ARRAY_TYPE)
+ type = TREE_TYPE (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (type))));
+
+ /* If this is an array, compute the number of dimensions in the array,
+ get the index types, and point to the inner type. */
+ if (TREE_CODE (type) != ARRAY_TYPE)
+ ndim = 0;
+ else
+ for (ndim = 1, inner_type = type;
+ TREE_CODE (TREE_TYPE (inner_type)) == ARRAY_TYPE
+ && TYPE_MULTI_ARRAY_P (TREE_TYPE (inner_type));
+ ndim++, inner_type = TREE_TYPE (inner_type))
+ ;
+
+ idx_arr = (tree *) alloca (ndim * sizeof (tree));
+
+ if (mech != By_Descriptor_NCA
+ && TREE_CODE (type) == ARRAY_TYPE && TYPE_CONVENTION_FORTRAN_P (type))
+ for (i = ndim - 1, inner_type = type;
+ i >= 0;
+ i--, inner_type = TREE_TYPE (inner_type))
+ idx_arr[i] = TYPE_DOMAIN (inner_type);
+ else
+ for (i = 0, inner_type = type;
+ i < ndim;
+ i++, inner_type = TREE_TYPE (inner_type))
+ idx_arr[i] = TYPE_DOMAIN (inner_type);
+
+ /* Now get the DTYPE value. */
+ switch (TREE_CODE (type))
+ {
+ case INTEGER_TYPE:
+ case ENUMERAL_TYPE:
+ case BOOLEAN_TYPE:
+ if (TYPE_VAX_FLOATING_POINT_P (type))
+ switch (tree_low_cst (TYPE_DIGITS_VALUE (type), 1))
+ {
+ case 6:
+ dtype = 10;
+ break;
+ case 9:
+ dtype = 11;
+ break;
+ case 15:
+ dtype = 27;
+ break;
+ }
+ else
+ switch (GET_MODE_BITSIZE (TYPE_MODE (type)))
+ {
+ case 8:
+ dtype = TYPE_UNSIGNED (type) ? 2 : 6;
+ break;
+ case 16:
+ dtype = TYPE_UNSIGNED (type) ? 3 : 7;
+ break;
+ case 32:
+ dtype = TYPE_UNSIGNED (type) ? 4 : 8;
+ break;
+ case 64:
+ dtype = TYPE_UNSIGNED (type) ? 5 : 9;
+ break;
+ case 128:
+ dtype = TYPE_UNSIGNED (type) ? 25 : 26;
+ break;
+ }
+ break;
+
+ case REAL_TYPE:
+ dtype = GET_MODE_BITSIZE (TYPE_MODE (type)) == 32 ? 52 : 53;
+ break;
+
+ case COMPLEX_TYPE:
+ if (TREE_CODE (TREE_TYPE (type)) == INTEGER_TYPE
+ && TYPE_VAX_FLOATING_POINT_P (type))
+ switch (tree_low_cst (TYPE_DIGITS_VALUE (type), 1))
+ {
+ case 6:
+ dtype = 12;
+ break;
+ case 9:
+ dtype = 13;
+ break;
+ case 15:
+ dtype = 29;
+ }
+ else
+ dtype = GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (type))) == 32 ? 54: 55;
+ break;
+
+ case ARRAY_TYPE:
+ dtype = 14;
+ break;
+
+ default:
+ break;
+ }
+
+ /* Get the CLASS value. */
+ switch (mech)
+ {
+ case By_Descriptor_A:
+ class = 4;
+ break;
+ case By_Descriptor_NCA:
+ class = 10;
+ break;
+ case By_Descriptor_SB:
+ class = 15;
+ break;
+ case By_Descriptor:
+ case By_Descriptor_S:
+ default:
+ class = 1;
+ break;
+ }
+
+ /* Make the type for a 64bit descriptor for VMS. The first six fields
+ are the same for all types. */
+
+ field_list64 = chainon (field_list64,
+ make_descriptor_field ("MBO",
+ gnat_type_for_size (16, 1),
+ record64_type, size_int (1)));
+
+ field_list64 = chainon (field_list64,
+ make_descriptor_field ("DTYPE",
+ gnat_type_for_size (8, 1),
+ record64_type, size_int (dtype)));
+ field_list64 = chainon (field_list64,
+ make_descriptor_field ("CLASS",
+ gnat_type_for_size (8, 1),
+ record64_type, size_int (class)));
+
+ field_list64 = chainon (field_list64,
+ make_descriptor_field ("MBMO",
+ gnat_type_for_size (32, 1),
+ record64_type, ssize_int (-1)));
+
+ field_list64
+ = chainon (field_list64,
+ make_descriptor_field
+ ("LENGTH", gnat_type_for_size (64, 1), record64_type,
+ size_in_bytes (mech == By_Descriptor_A ? inner_type : type)));
+
+ pointer64_type = build_pointer_type_for_mode (type, DImode, false);
+
+ field_list64
+ = chainon (field_list64,
+ make_descriptor_field
+ ("POINTER", pointer64_type, record64_type,
+ build_unary_op (ADDR_EXPR,
+ pointer64_type,
+ build0 (PLACEHOLDER_EXPR, type))));
+
+ switch (mech)
+ {
+ case By_Descriptor:
+ case By_Descriptor_S:
+ break;
+
+ case By_Descriptor_SB:
+ field_list64
+ = chainon (field_list64,
+ make_descriptor_field
+ ("SB_L1", gnat_type_for_size (64, 1), record64_type,
+ TREE_CODE (type) == ARRAY_TYPE
+ ? TYPE_MIN_VALUE (TYPE_DOMAIN (type)) : size_zero_node));
+ field_list64
+ = chainon (field_list64,
+ make_descriptor_field
+ ("SB_U1", gnat_type_for_size (64, 1), record64_type,
+ TREE_CODE (type) == ARRAY_TYPE
+ ? TYPE_MAX_VALUE (TYPE_DOMAIN (type)) : size_zero_node));
+ break;
+
+ case By_Descriptor_A:
+ case By_Descriptor_NCA:
+ field_list64 = chainon (field_list64,
+ make_descriptor_field ("SCALE",
+ gnat_type_for_size (8, 1),
+ record64_type,
+ size_zero_node));
+
+ field_list64 = chainon (field_list64,
+ make_descriptor_field ("DIGITS",
+ gnat_type_for_size (8, 1),
+ record64_type,
+ size_zero_node));
+
+ field_list64
+ = chainon (field_list64,
+ make_descriptor_field
+ ("AFLAGS", gnat_type_for_size (8, 1), record64_type,
+ size_int (mech == By_Descriptor_NCA
+ ? 0
+ /* Set FL_COLUMN, FL_COEFF, and FL_BOUNDS. */
+ : (TREE_CODE (type) == ARRAY_TYPE
+ && TYPE_CONVENTION_FORTRAN_P (type)
+ ? 224 : 192))));
+
+ field_list64 = chainon (field_list64,
+ make_descriptor_field ("DIMCT",
+ gnat_type_for_size (8, 1),
+ record64_type,
+ size_int (ndim)));
+
+ field_list64 = chainon (field_list64,
+ make_descriptor_field ("MBZ",
+ gnat_type_for_size (32, 1),
+ record64_type,
+ size_int (0)));
+ field_list64 = chainon (field_list64,
+ make_descriptor_field ("ARSIZE",
+ gnat_type_for_size (64, 1),
+ record64_type,
+ size_in_bytes (type)));
+
+ /* Now build a pointer to the 0,0,0... element. */
+ tem = build0 (PLACEHOLDER_EXPR, type);
+ for (i = 0, inner_type = type; i < ndim;
+ i++, inner_type = TREE_TYPE (inner_type))
+ tem = build4 (ARRAY_REF, TREE_TYPE (inner_type), tem,
+ convert (TYPE_DOMAIN (inner_type), size_zero_node),
+ NULL_TREE, NULL_TREE);
+
+ field_list64
+ = chainon (field_list64,
+ make_descriptor_field
+ ("A0",
+ build_pointer_type_for_mode (inner_type, DImode, false),
+ record64_type,
+ build1 (ADDR_EXPR,
+ build_pointer_type_for_mode (inner_type, DImode,
+ false),
+ tem)));
+
+ /* Next come the addressing coefficients. */
+ tem = size_one_node;
+ for (i = 0; i < ndim; i++)
+ {
+ char fname[3];
+ tree idx_length
+ = size_binop (MULT_EXPR, tem,
+ size_binop (PLUS_EXPR,
+ size_binop (MINUS_EXPR,
+ TYPE_MAX_VALUE (idx_arr[i]),
+ TYPE_MIN_VALUE (idx_arr[i])),
+ size_int (1)));
+
+ fname[0] = (mech == By_Descriptor_NCA ? 'S' : 'M');
+ fname[1] = '0' + i, fname[2] = 0;
+ field_list64
+ = chainon (field_list64,
+ make_descriptor_field (fname,
+ gnat_type_for_size (64, 1),
+ record64_type, idx_length));
+
+ if (mech == By_Descriptor_NCA)
+ tem = idx_length;
+ }
+
+ /* Finally here are the bounds. */
+ for (i = 0; i < ndim; i++)
+ {
+ char fname[3];
+
+ fname[0] = 'L', fname[1] = '0' + i, fname[2] = 0;
+ field_list64
+ = chainon (field_list64,
+ make_descriptor_field
+ (fname, gnat_type_for_size (64, 1), record64_type,
+ TYPE_MIN_VALUE (idx_arr[i])));
+
+ fname[0] = 'U';
+ field_list64
+ = chainon (field_list64,
+ make_descriptor_field
+ (fname, gnat_type_for_size (64, 1), record64_type,
+ TYPE_MAX_VALUE (idx_arr[i])));
+ }
+ break;
+
+ default:
+ post_error ("unsupported descriptor type for &", gnat_entity);
+ }
+
+ finish_record_type (record64_type, field_list64, 0, true);
+ create_type_decl (create_concat_name (gnat_entity, "DESC64"), record64_type,
+ NULL, true, false, gnat_entity);
+
+ return record64_type;
+}
+
/* Utility routine for above code to make a field. */
static tree
@@ -2942,12 +3297,160 @@ make_descriptor_field (const char *name, tree type,
return field;
}
-/* Convert GNU_EXPR, a pointer to a VMS descriptor, to GNU_TYPE, a regular
- pointer or fat pointer type. GNAT_SUBPROG is the subprogram to which
- the VMS descriptor is passed. */
+/* Convert GNU_EXPR, a pointer to a 64bit VMS descriptor, to GNU_TYPE, a
+ regular pointer or fat pointer type. GNAT_SUBPROG is the subprogram to
+ which the VMS descriptor is passed. */
+
+static tree
+convert_vms_descriptor64 (tree gnu_type, tree gnu_expr, Entity_Id gnat_subprog)
+{
+ tree desc_type = TREE_TYPE (TREE_TYPE (gnu_expr));
+ tree desc = build1 (INDIRECT_REF, desc_type, gnu_expr);
+ /* The CLASS field is the 3rd field in the descriptor. */
+ tree class = TREE_CHAIN (TREE_CHAIN (TYPE_FIELDS (desc_type)));
+ /* The POINTER field is the 6th field in the descriptor. */
+ tree pointer64 = TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (class)));
+
+ /* Retrieve the value of the POINTER field. */
+ tree gnu_expr64
+ = build3 (COMPONENT_REF, TREE_TYPE (pointer64), desc, pointer64, NULL_TREE);
+
+ if (POINTER_TYPE_P (gnu_type))
+ return convert (gnu_type, gnu_expr64);
+
+ else if (TYPE_FAT_POINTER_P (gnu_type))
+ {
+ tree p_array_type = TREE_TYPE (TYPE_FIELDS (gnu_type));
+ tree p_bounds_type = TREE_TYPE (TREE_CHAIN (TYPE_FIELDS (gnu_type)));
+ tree template_type = TREE_TYPE (p_bounds_type);
+ tree min_field = TYPE_FIELDS (template_type);
+ tree max_field = TREE_CHAIN (TYPE_FIELDS (template_type));
+ tree template, template_addr, aflags, dimct, t, u;
+ /* See the head comment of build_vms_descriptor. */
+ int iclass = TREE_INT_CST_LOW (DECL_INITIAL (class));
+ tree lfield, ufield;
+
+ /* Convert POINTER to the type of the P_ARRAY field. */
+ gnu_expr64 = convert (p_array_type, gnu_expr64);
+
+ switch (iclass)
+ {
+ case 1: /* Class S */
+ case 15: /* Class SB */
+ /* Build {1, LENGTH} template; LENGTH64 is the 5th field. */
+ t = TREE_CHAIN (TREE_CHAIN (class));
+ t = build3 (COMPONENT_REF, TREE_TYPE (t), desc, t, NULL_TREE);
+ t = tree_cons (min_field,
+ convert (TREE_TYPE (min_field), integer_one_node),
+ tree_cons (max_field,
+ convert (TREE_TYPE (max_field), t),
+ NULL_TREE));
+ template = gnat_build_constructor (template_type, t);
+ template_addr = build_unary_op (ADDR_EXPR, NULL_TREE, template);
+
+ /* For class S, we are done. */
+ if (iclass == 1)
+ break;
+
+ /* Test that we really have a SB descriptor, like DEC Ada. */
+ t = build3 (COMPONENT_REF, TREE_TYPE (class), desc, class, NULL);
+ u = convert (TREE_TYPE (class), DECL_INITIAL (class));
+ u = build_binary_op (EQ_EXPR, integer_type_node, t, u);
+ /* If so, there is already a template in the descriptor and
+ it is located right after the POINTER field. The fields are
+ 64bits so they must be repacked. */
+ t = TREE_CHAIN (pointer64);
+ lfield = build3 (COMPONENT_REF, TREE_TYPE (t), desc, t, NULL_TREE);
+ lfield = convert (TREE_TYPE (TYPE_FIELDS (template_type)), lfield);
+
+ t = TREE_CHAIN (t);
+ ufield = build3 (COMPONENT_REF, TREE_TYPE (t), desc, t, NULL_TREE);
+ ufield = convert
+ (TREE_TYPE (TREE_CHAIN (TYPE_FIELDS (template_type))), ufield);
+
+ /* Build the template in the form of a constructor. */
+ t = tree_cons (TYPE_FIELDS (template_type), lfield,
+ tree_cons (TREE_CHAIN (TYPE_FIELDS (template_type)),
+ ufield, NULL_TREE));
+ template = gnat_build_constructor (template_type, t);
+
+ /* Otherwise use the {1, LENGTH} template we build above. */
+ template_addr = build3 (COND_EXPR, p_bounds_type, u,
+ build_unary_op (ADDR_EXPR, p_bounds_type,
+ template),
+ template_addr);
+ break;
+
+ case 4: /* Class A */
+ /* The AFLAGS field is the 3rd field after the pointer in the
+ descriptor. */
+ t = TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (pointer64)));
+ aflags = build3 (COMPONENT_REF, TREE_TYPE (t), desc, t, NULL_TREE);
+ /* The DIMCT field is the next field in the descriptor after
+ aflags. */
+ t = TREE_CHAIN (t);
+ dimct = build3 (COMPONENT_REF, TREE_TYPE (t), desc, t, NULL_TREE);
+ /* Raise CONSTRAINT_ERROR if either more than 1 dimension
+ or FL_COEFF or FL_BOUNDS not set. */
+ u = build_int_cst (TREE_TYPE (aflags), 192);
+ u = build_binary_op (TRUTH_OR_EXPR, integer_type_node,
+ build_binary_op (NE_EXPR, integer_type_node,
+ dimct,
+ convert (TREE_TYPE (dimct),
+ size_one_node)),
+ build_binary_op (NE_EXPR, integer_type_node,
+ build2 (BIT_AND_EXPR,
+ TREE_TYPE (aflags),
+ aflags, u),
+ u));
+ /* There is already a template in the descriptor and it is located
+ in block 3. The fields are 64bits so they must be repacked. */
+ t = TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (TREE_CHAIN
+ (t)))));
+ lfield = build3 (COMPONENT_REF, TREE_TYPE (t), desc, t, NULL_TREE);
+ lfield = convert (TREE_TYPE (TYPE_FIELDS (template_type)), lfield);
+
+ t = TREE_CHAIN (t);
+ ufield = build3 (COMPONENT_REF, TREE_TYPE (t), desc, t, NULL_TREE);
+ ufield = convert
+ (TREE_TYPE (TREE_CHAIN (TYPE_FIELDS (template_type))), ufield);
+
+ /* Build the template in the form of a constructor. */
+ t = tree_cons (TYPE_FIELDS (template_type), lfield,
+ tree_cons (TREE_CHAIN (TYPE_FIELDS (template_type)),
+ ufield, NULL_TREE));
+ template = gnat_build_constructor (template_type, t);
+ template = build3 (COND_EXPR, p_bounds_type, u,
+ build_call_raise (CE_Length_Check_Failed, Empty,
+ N_Raise_Constraint_Error),
+ template);
+ template_addr = build_unary_op (ADDR_EXPR, p_bounds_type, template);
+ break;
+
+ case 10: /* Class NCA */
+ default:
+ post_error ("unsupported descriptor type for &", gnat_subprog);
+ template_addr = integer_zero_node;
+ break;
+ }
+
+ /* Build the fat pointer in the form of a constructor. */
+ t = tree_cons (TYPE_FIELDS (gnu_type), gnu_expr64,
+ tree_cons (TREE_CHAIN (TYPE_FIELDS (gnu_type)),
+ template_addr, NULL_TREE));
+ return gnat_build_constructor (gnu_type, t);
+ }
+
+ else
+ gcc_unreachable ();
+}
+
+/* Convert GNU_EXPR, a pointer to a 32bit VMS descriptor, to GNU_TYPE, a
+ regular pointer or fat pointer type. GNAT_SUBPROG is the subprogram to
+ which the VMS descriptor is passed. */
static tree
-convert_vms_descriptor (tree gnu_type, tree gnu_expr, Entity_Id gnat_subprog)
+convert_vms_descriptor32 (tree gnu_type, tree gnu_expr, Entity_Id gnat_subprog)
{
tree desc_type = TREE_TYPE (TREE_TYPE (gnu_expr));
tree desc = build1 (INDIRECT_REF, desc_type, gnu_expr);
@@ -2957,11 +3460,11 @@ convert_vms_descriptor (tree gnu_type, tree gnu_expr, Entity_Id gnat_subprog)
tree pointer = TREE_CHAIN (class);
/* Retrieve the value of the POINTER field. */
- gnu_expr
+ tree gnu_expr32
= build3 (COMPONENT_REF, TREE_TYPE (pointer), desc, pointer, NULL_TREE);
if (POINTER_TYPE_P (gnu_type))
- return convert (gnu_type, gnu_expr);
+ return convert (gnu_type, gnu_expr32);
else if (TYPE_FAT_POINTER_P (gnu_type))
{
@@ -2975,7 +3478,7 @@ convert_vms_descriptor (tree gnu_type, tree gnu_expr, Entity_Id gnat_subprog)
int iclass = TREE_INT_CST_LOW (DECL_INITIAL (class));
/* Convert POINTER to the type of the P_ARRAY field. */
- gnu_expr = convert (p_array_type, gnu_expr);
+ gnu_expr32 = convert (p_array_type, gnu_expr32);
switch (iclass)
{
@@ -3031,14 +3534,14 @@ convert_vms_descriptor (tree gnu_type, tree gnu_expr, Entity_Id gnat_subprog)
TREE_TYPE (aflags),
aflags, u),
u));
- add_stmt (build3 (COND_EXPR, void_type_node, u,
- build_call_raise (CE_Length_Check_Failed, Empty,
- N_Raise_Constraint_Error),
- NULL_TREE));
/* There is already a template in the descriptor and it is
located at the start of block 3 (12th field). */
t = TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (t))));
template = build3 (COMPONENT_REF, TREE_TYPE (t), desc, t, NULL_TREE);
+ template = build3 (COND_EXPR, p_bounds_type, u,
+ build_call_raise (CE_Length_Check_Failed, Empty,
+ N_Raise_Constraint_Error),
+ template);
template_addr = build_unary_op (ADDR_EXPR, p_bounds_type, template);
break;
@@ -3050,9 +3553,10 @@ convert_vms_descriptor (tree gnu_type, tree gnu_expr, Entity_Id gnat_subprog)
}
/* Build the fat pointer in the form of a constructor. */
- t = tree_cons (TYPE_FIELDS (gnu_type), gnu_expr,
+ t = tree_cons (TYPE_FIELDS (gnu_type), gnu_expr32,
tree_cons (TREE_CHAIN (TYPE_FIELDS (gnu_type)),
template_addr, NULL_TREE));
+
return gnat_build_constructor (gnu_type, t);
}
@@ -3060,6 +3564,47 @@ convert_vms_descriptor (tree gnu_type, tree gnu_expr, Entity_Id gnat_subprog)
gcc_unreachable ();
}
+/* Convert GNU_EXPR, a pointer to a VMS descriptor, to GNU_TYPE, a regular
+ pointer or fat pointer type. GNU_EXPR_ALT_TYPE is the alternate (32-bit)
+ pointer type of GNU_EXPR. GNAT_SUBPROG is the subprogram to which the
+ VMS descriptor is passed. */
+
+static tree
+convert_vms_descriptor (tree gnu_type, tree gnu_expr, tree gnu_expr_alt_type,
+ Entity_Id gnat_subprog)
+{
+ tree desc_type = TREE_TYPE (TREE_TYPE (gnu_expr));
+ tree desc = build1 (INDIRECT_REF, desc_type, gnu_expr);
+ tree mbo = TYPE_FIELDS (desc_type);
+ const char *mbostr = IDENTIFIER_POINTER (DECL_NAME (mbo));
+ tree mbmo = TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (mbo)));
+ tree is64bit, gnu_expr32, gnu_expr64;
+
+ /* If the field name is not MBO, it must be 32-bit and no alternate.
+ Otherwise primary must be 64-bit and alternate 32-bit. */
+ if (strcmp (mbostr, "MBO") != 0)
+ return convert_vms_descriptor32 (gnu_type, gnu_expr, gnat_subprog);
+
+ /* Build the test for 64-bit descriptor. */
+ mbo = build3 (COMPONENT_REF, TREE_TYPE (mbo), desc, mbo, NULL_TREE);
+ mbmo = build3 (COMPONENT_REF, TREE_TYPE (mbmo), desc, mbmo, NULL_TREE);
+ is64bit
+ = build_binary_op (TRUTH_ANDIF_EXPR, integer_type_node,
+ build_binary_op (EQ_EXPR, integer_type_node,
+ convert (integer_type_node, mbo),
+ integer_one_node),
+ build_binary_op (EQ_EXPR, integer_type_node,
+ convert (integer_type_node, mbmo),
+ integer_minus_one_node));
+
+ /* Build the 2 possible end results. */
+ gnu_expr64 = convert_vms_descriptor64 (gnu_type, gnu_expr, gnat_subprog);
+ gnu_expr = fold_convert (gnu_expr_alt_type, gnu_expr);
+ gnu_expr32 = convert_vms_descriptor32 (gnu_type, gnu_expr, gnat_subprog);
+
+ return build3 (COND_EXPR, gnu_type, is64bit, gnu_expr64, gnu_expr32);
+}
+
/* Build a stub for the subprogram specified by the GCC tree GNU_SUBPROG
and the GNAT node GNAT_SUBPROG. */
@@ -3088,8 +3633,11 @@ build_function_stub (tree gnu_subprog, Entity_Id gnat_subprog)
gnu_arg_types = TREE_CHAIN (gnu_arg_types))
{
if (DECL_BY_DESCRIPTOR_P (gnu_stub_param))
- gnu_param = convert_vms_descriptor (TREE_VALUE (gnu_arg_types),
- gnu_stub_param, gnat_subprog);
+ gnu_param
+ = convert_vms_descriptor (TREE_VALUE (gnu_arg_types),
+ gnu_stub_param,
+ DECL_PARM_ALT_TYPE (gnu_stub_param),
+ gnat_subprog);
else
gnu_param = gnu_stub_param;
@@ -3116,7 +3664,7 @@ build_function_stub (tree gnu_subprog, Entity_Id gnat_subprog)
gnat_poplevel ();
allocate_struct_function (gnu_stub_decl, false);
- end_subprog_body (gnu_body);
+ end_subprog_body (gnu_body, false);
}
/* Build a type to be used to represent an aliased object whose nominal
@@ -3321,31 +3869,31 @@ update_pointer_to (tree old_type, tree new_type)
}
}
-/* Convert a pointer to a constrained array into a pointer to a fat
- pointer. This involves making or finding a template. */
+/* Convert EXPR, a pointer to a constrained array, into a pointer to an
+ unconstrained one. This involves making or finding a template. */
static tree
convert_to_fat_pointer (tree type, tree expr)
{
tree template_type = TREE_TYPE (TREE_TYPE (TREE_CHAIN (TYPE_FIELDS (type))));
- tree template, template_addr;
+ tree p_array_type = TREE_TYPE (TYPE_FIELDS (type));
tree etype = TREE_TYPE (expr);
+ tree template;
- /* If EXPR is a constant of zero, we make a fat pointer that has a null
- pointer to the template and array. */
+ /* If EXPR is null, make a fat pointer that contains null pointers to the
+ template and array. */
if (integer_zerop (expr))
return
gnat_build_constructor
(type,
tree_cons (TYPE_FIELDS (type),
- convert (TREE_TYPE (TYPE_FIELDS (type)), expr),
+ convert (p_array_type, expr),
tree_cons (TREE_CHAIN (TYPE_FIELDS (type)),
convert (build_pointer_type (template_type),
expr),
NULL_TREE)));
- /* If EXPR is a thin pointer, make the template and data from the record. */
-
+ /* If EXPR is a thin pointer, make template and data from the record.. */
else if (TYPE_THIN_POINTER_P (etype))
{
tree fields = TYPE_FIELDS (TREE_TYPE (etype));
@@ -3361,30 +3909,31 @@ convert_to_fat_pointer (tree type, tree expr)
build_component_ref (expr, NULL_TREE,
TREE_CHAIN (fields), false));
}
+
+ /* Otherwise, build the constructor for the template. */
else
- /* Otherwise, build the constructor for the template. */
template = build_template (template_type, TREE_TYPE (etype), expr);
- template_addr = build_unary_op (ADDR_EXPR, NULL_TREE, template);
-
- /* The result is a CONSTRUCTOR for the fat pointer.
+ /* The final result is a constructor for the fat pointer.
- If expr is an argument of a foreign convention subprogram, the type it
- points to is directly the component type. In this case, the expression
+ If EXPR is an argument of a foreign convention subprogram, the type it
+ points to is directly the component type. In this case, the expression
type may not match the corresponding FIELD_DECL type at this point, so we
- call "convert" here to fix that up if necessary. This type consistency is
+ call "convert" here to fix that up if necessary. This type consistency is
required, for instance because it ensures that possible later folding of
- component_refs against this constructor always yields something of the
+ COMPONENT_REFs against this constructor always yields something of the
same type as the initial reference.
- Note that the call to "build_template" above is still fine, because it
- will only refer to the provided template_type in this case. */
- return
- gnat_build_constructor
- (type, tree_cons (TYPE_FIELDS (type),
- convert (TREE_TYPE (TYPE_FIELDS (type)), expr),
- tree_cons (TREE_CHAIN (TYPE_FIELDS (type)),
- template_addr, NULL_TREE)));
+ Note that the call to "build_template" above is still fine because it
+ will only refer to the provided TEMPLATE_TYPE in this case. */
+ return
+ gnat_build_constructor
+ (type,
+ tree_cons (TYPE_FIELDS (type),
+ convert (p_array_type, expr),
+ tree_cons (TREE_CHAIN (TYPE_FIELDS (type)),
+ build_unary_op (ADDR_EXPR, NULL_TREE, template),
+ NULL_TREE)));
}
/* Convert to a thin pointer type, TYPE. The only thing we know how to convert
@@ -3712,9 +4261,6 @@ convert (tree type, tree expr)
case VOID_TYPE:
return fold_build1 (CONVERT_EXPR, type, expr);
- case BOOLEAN_TYPE:
- return fold_convert (type, gnat_truthvalue_conversion (expr));
-
case INTEGER_TYPE:
if (TYPE_HAS_ACTUAL_BOUNDS_P (type)
&& (ecode == ARRAY_TYPE || ecode == UNCONSTRAINED_ARRAY_TYPE
@@ -3729,6 +4275,7 @@ convert (tree type, tree expr)
/* ... fall through ... */
case ENUMERAL_TYPE:
+ case BOOLEAN_TYPE:
/* If we are converting an additive expression to an integer type
with lower precision, be wary of the optimization that can be
applied by convert_to_integer. There are 2 problematic cases:
@@ -4209,7 +4756,7 @@ gnat_write_global_declarations (void)
* ************************************************************************ */
/* The general scheme is fairly simple:
-
+
For each builtin function/type to be declared, gnat_install_builtins calls
internal facilities which eventually get to gnat_push_decl, which in turn
tracks the so declared builtin function decls in the 'builtin_decls' global
@@ -4240,7 +4787,7 @@ builtin_decl_for (tree name)
??? This is a first implementation shot, still in rough shape. It is
heavily inspired from the "C" family implementation, with chunks copied
verbatim from there.
-
+
Two obvious TODO candidates are
o Use a more efficient name/decl mapping scheme
o Devise a middle-end infrastructure to avoid having to copy
@@ -4691,7 +5238,7 @@ handle_sentinel_attribute (tree *node, tree name, tree args,
*no_add_attrs = true;
}
}
-
+
if (args)
{
tree position = TREE_VALUE (args);
@@ -4710,7 +5257,7 @@ handle_sentinel_attribute (tree *node, tree name, tree args,
}
}
}
-
+
return NULL_TREE;
}
@@ -4761,7 +5308,7 @@ handle_malloc_attribute (tree *node, tree name, tree ARG_UNUSED (args),
}
/* Fake handler for attributes we don't properly support. */
-
+
tree
fake_attribute_handler (tree * ARG_UNUSED (node),
tree ARG_UNUSED (name),
@@ -4815,10 +5362,10 @@ def_builtin_1 (enum built_in_function fncode,
const char *libname;
/* Preserve an already installed decl. It most likely was setup in advance
- (e.g. as part of the internal builtins) for specific reasons. */
+ (e.g. as part of the internal builtins) for specific reasons. */
if (built_in_decls[(int) fncode] != NULL_TREE)
return;
-
+
gcc_assert ((!both_p && !fallback_p)
|| !strncmp (name, "__builtin_",
strlen ("__builtin_")));
diff --git a/gcc/ada/utils2.c b/gcc/ada/gcc-interface/utils2.c
index 300fbd37d01..0462426251f 100644
--- a/gcc/ada/utils2.c
+++ b/gcc/ada/gcc-interface/utils2.c
@@ -45,6 +45,7 @@
#include "einfo.h"
#include "ada-tree.h"
#include "gigi.h"
+#include "snames.h"
static tree find_common_type (tree, tree);
static bool contains_save_expr_p (tree);
@@ -986,7 +987,6 @@ build_binary_op (enum tree_code op_code, tree result_type,
outputs. */
if (modulus && integer_pow2p (modulus))
modulus = NULL_TREE;
-
goto common;
case COMPLEX_EXPR:
@@ -1011,6 +1011,15 @@ build_binary_op (enum tree_code op_code, tree result_type,
right_operand = convert (sizetype, right_operand);
break;
+ case PLUS_EXPR:
+ case MINUS_EXPR:
+ /* Avoid doing arithmetics in BOOLEAN_TYPE like the other compilers.
+ Contrary to C, Ada doesn't allow arithmetics in Standard.Boolean
+ but we can generate addition or subtraction for 'Succ and 'Pred. */
+ if (operation_type && TREE_CODE (operation_type) == BOOLEAN_TYPE)
+ operation_type = left_base_type = right_base_type = integer_type_node;
+ goto common;
+
default:
common:
/* The result type should be the same as the base types of the
@@ -1942,7 +1951,11 @@ build_call_alloc_dealloc (tree gnu_obj, tree gnu_size, unsigned align,
/* If the allocator size is 32bits but the pointer size is 64bits then
allocate 32bit memory (sometimes necessary on 64bit VMS). Otherwise
default to standard malloc. */
- if (UI_To_Int (Esize (Etype (gnat_node))) == 32 && POINTER_SIZE == 64)
+ if (TARGET_ABI_OPEN_VMS &&
+ (!TARGET_MALLOC64 ||
+ (POINTER_SIZE == 64
+ && (UI_To_Int (Esize (Etype (gnat_node))) == 32
+ || Convention (Etype (gnat_node)) == Convention_C))))
return build_call_1_expr (malloc32_decl, gnu_size);
else
return build_call_1_expr (malloc_decl, gnu_size);
@@ -2151,25 +2164,52 @@ build_allocator (tree type, tree init, tree result_type, Entity_Id gnat_proc,
}
/* Fill in a VMS descriptor for EXPR and return a constructor for it.
- GNAT_FORMAL is how we find the descriptor record. */
+ GNAT_FORMAL is how we find the descriptor record. GNAT_ACTUAL is
+ how we derive the source location to raise C_E on an out of range
+ pointer. */
tree
-fill_vms_descriptor (tree expr, Entity_Id gnat_formal)
+fill_vms_descriptor (tree expr, Entity_Id gnat_formal, Node_Id gnat_actual)
{
- tree record_type = TREE_TYPE (TREE_TYPE (get_gnu_tree (gnat_formal)));
tree field;
+ tree parm_decl = get_gnu_tree (gnat_formal);
tree const_list = NULL_TREE;
+ tree record_type = TREE_TYPE (TREE_TYPE (parm_decl));
+ int do_range_check =
+ strcmp ("MBO",
+ IDENTIFIER_POINTER (DECL_NAME (TYPE_FIELDS (record_type))));
expr = maybe_unconstrained_array (expr);
gnat_mark_addressable (expr);
for (field = TYPE_FIELDS (record_type); field; field = TREE_CHAIN (field))
- const_list
- = tree_cons (field,
- convert (TREE_TYPE (field),
- SUBSTITUTE_PLACEHOLDER_IN_EXPR
- (DECL_INITIAL (field), expr)),
- const_list);
+ {
+ tree conexpr = convert (TREE_TYPE (field),
+ SUBSTITUTE_PLACEHOLDER_IN_EXPR
+ (DECL_INITIAL (field), expr));
+
+ /* Check to ensure that only 32bit pointers are passed in
+ 32bit descriptors */
+ if (do_range_check &&
+ strcmp (IDENTIFIER_POINTER (DECL_NAME (field)), "POINTER") == 0)
+ {
+ tree pointer64type =
+ build_pointer_type_for_mode (void_type_node, DImode, false);
+ tree addr64expr = build_unary_op (ADDR_EXPR, pointer64type, expr);
+ tree malloc64low =
+ build_int_cstu (long_integer_type_node, 0x80000000);
+
+ add_stmt (build3 (COND_EXPR, void_type_node,
+ build_binary_op (GE_EXPR, long_integer_type_node,
+ convert (long_integer_type_node,
+ addr64expr),
+ malloc64low),
+ build_call_raise (CE_Range_Check_Failed, gnat_actual,
+ N_Raise_Constraint_Error),
+ NULL_TREE));
+ }
+ const_list = tree_cons (field, conexpr, const_list);
+ }
return gnat_build_constructor (record_type, nreverse (const_list));
}
diff --git a/gcc/ada/gen-soccon.c b/gcc/ada/gen-soccon.c
deleted file mode 100644
index 62629651384..00000000000
--- a/gcc/ada/gen-soccon.c
+++ /dev/null
@@ -1,747 +0,0 @@
-/****************************************************************************
- * *
- * GNAT SYSTEM UTILITIES *
- * *
- * G E N - S O C C O N *
- * *
- * Copyright (C) 2004-2008, Free Software Foundation, Inc. *
- * *
- * GNAT is free software; you can redistribute it and/or modify it under *
- * terms of the GNU General Public License as published by the Free Soft- *
- * ware Foundation; either version 2, or (at your option) any later ver- *
- * sion. GNAT is distributed in the hope that it will be useful, but WITH- *
- * OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License *
- * for more details. You should have received a copy of the GNU General *
- * Public License distributed with GNAT; see file COPYING. If not, write *
- * to the Free Software Foundation, 51 Franklin Street, Fifth Floor, *
- * Boston, MA 02110-1301, USA. *
- * *
- * GNAT was originally developed by the GNAT team at New York University. *
- * Extensive contributions were provided by Ada Core Technologies Inc. *
- * *
- ****************************************************************************/
-
-/* This program generates g-soccon.ads */
-
-/*
- * To build using DEC C:
- *
- * CC/DEFINE="TARGET=""OpenVMS""" gen-soccon
- * LINK gen-soccon
- * RUN gen-soccon
- *
- * Note: OpenVMS versions older than 8.3 provide an incorrect value in
- * the DEC C header files for MSG_WAITALL. To generate the VMS version
- * of g-soccon.ads, gen-soccon should be run on an 8.3 or later machine.
- */
-
-#ifndef TARGET
-# error Please define TARGET
-#endif
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <limits.h>
-
-#ifdef __MINGW32__
-#include <fcntl.h>
-#endif
-
-#include "gsocket.h"
-
-typedef enum { NUM, TXT } kind_t;
-
-struct line {
- char *text;
- char *value;
- char *comment;
- kind_t kind;
- struct line *next;
-};
-
-struct line *first = NULL, *last = NULL;
-
-#define TXT(_text) add_line(_text, NULL, NULL, TXT);
-/* Plain text */
-
-#define _NL TXT("")
-/* Empty line */
-
-#define itoad(n) f_itoa ("%d", (n))
-#define itoax(n) f_itoa ("16#%08x#", (n))
-
-#define CND(name,comment) add_line(#name, itoad (name), comment, NUM);
-/* Constant (decimal) */
-
-#define CNX(name,comment) add_line(#name, itoax (name), comment, NUM);
-/* Constant (hexadecimal) */
-
-#define CN_(name,comment) add_line(#name, name, comment, TXT);
-/* Constant (generic) */
-
-#define STR(p) STR1(p)
-#define STR1(p) #p
-
-void output (void);
-/* Generate output spec */
-
-char *f_itoa (char *, int);
-/* int to string */
-
-void add_line (char *, char*, char*, kind_t);
-
-#ifdef __MINGW32__
-unsigned int _CRT_fmode = _O_BINARY;
-#endif
-
-int
-main (void) {
-
-TXT("------------------------------------------------------------------------------")
-TXT("-- --")
-TXT("-- GNAT COMPILER COMPONENTS --")
-TXT("-- --")
-TXT("-- G N A T . S O C K E T S . C O N S T A N T S --")
-TXT("-- --")
-TXT("-- S p e c --")
-TXT("-- --")
-TXT("-- Copyright (C) 2000-2008, Free Software Foundation, Inc. --")
-TXT("-- --")
-TXT("-- GNAT is free software; you can redistribute it and/or modify it under --")
-TXT("-- terms of the GNU General Public License as published by the Free Soft- --")
-TXT("-- ware Foundation; either version 2, or (at your option) any later ver- --")
-TXT("-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --")
-TXT("-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --")
-TXT("-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --")
-TXT("-- for more details. You should have received a copy of the GNU General --")
-TXT("-- Public License distributed with GNAT; see file COPYING. If not, write --")
-TXT("-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --")
-TXT("-- Boston, MA 02110-1301, USA. --")
-TXT("-- --")
-TXT("-- As a special exception, if other files instantiate generics from this --")
-TXT("-- unit, or you link this unit with other files to produce an executable, --")
-TXT("-- this unit does not by itself cause the resulting executable to be --")
-TXT("-- covered by the GNU General Public License. This exception does not --")
-TXT("-- however invalidate any other reasons why the executable file might be --")
-TXT("-- covered by the GNU Public License. --")
-TXT("-- --")
-TXT("-- GNAT was originally developed by the GNAT team at New York University. --")
-TXT("-- Extensive contributions were provided by Ada Core Technologies Inc. --")
-TXT("-- --")
-TXT("------------------------------------------------------------------------------")
-_NL
-TXT("-- This package provides target dependent definitions of constant for use")
-TXT("-- by the GNAT.Sockets package (g-socket.ads). This package should not be")
-TXT("-- directly with'ed by an applications program.")
-_NL
-TXT("-- This is the version for " TARGET)
-TXT("-- This file is generated automatically, do not modify it by hand! Instead,")
-TXT("-- make changes to gen-soccon.c and re-run it on each target.")
-_NL
-TXT("with Interfaces.C;")
-TXT("package GNAT.Sockets.Constants is")
-_NL
-TXT(" --------------")
-TXT(" -- Families --")
-TXT(" --------------")
-_NL
-
-#ifndef AF_INET
-# define AF_INET -1
-#endif
-CND(AF_INET, "IPv4 address family")
-
-#ifndef AF_INET6
-# define AF_INET6 -1
-#else
-# define HAVE_AF_INET6 1
-#endif
-CND(AF_INET6, "IPv6 address family")
-_NL
-TXT(" -----------")
-TXT(" -- Modes --")
-TXT(" -----------")
-_NL
-
-#ifndef SOCK_STREAM
-#define SOCK_STREAM -1
-#endif
-CND(SOCK_STREAM, "Stream socket")
-
-#ifndef SOCK_DGRAM
-#define SOCK_DGRAM -1
-#endif
-CND(SOCK_DGRAM, "Datagram socket")
-_NL
-TXT(" -------------------")
-TXT(" -- Socket errors --")
-TXT(" -------------------")
-_NL
-
-#ifndef EACCES
-#define EACCES -1
-#endif
-CND(EACCES, "Permission denied")
-
-#ifndef EADDRINUSE
-#define EADDRINUSE -1
-#endif
-CND(EADDRINUSE, "Address already in use")
-
-#ifndef EADDRNOTAVAIL
-#define EADDRNOTAVAIL -1
-#endif
-CND(EADDRNOTAVAIL, "Cannot assign address")
-
-#ifndef EAFNOSUPPORT
-#define EAFNOSUPPORT -1
-#endif
-CND(EAFNOSUPPORT, "Addr family not supported")
-
-#ifndef EALREADY
-#define EALREADY -1
-#endif
-CND(EALREADY, "Operation in progress")
-
-#ifndef EBADF
-#define EBADF -1
-#endif
-CND(EBADF, "Bad file descriptor")
-
-#ifndef ECONNABORTED
-#define ECONNABORTED -1
-#endif
-CND(ECONNABORTED, "Connection aborted")
-
-#ifndef ECONNREFUSED
-#define ECONNREFUSED -1
-#endif
-CND(ECONNREFUSED, "Connection refused")
-
-#ifndef ECONNRESET
-#define ECONNRESET -1
-#endif
-CND(ECONNRESET, "Connection reset by peer")
-
-#ifndef EDESTADDRREQ
-#define EDESTADDRREQ -1
-#endif
-CND(EDESTADDRREQ, "Destination addr required")
-
-#ifndef EFAULT
-#define EFAULT -1
-#endif
-CND(EFAULT, "Bad address")
-
-#ifndef EHOSTDOWN
-#define EHOSTDOWN -1
-#endif
-CND(EHOSTDOWN, "Host is down")
-
-#ifndef EHOSTUNREACH
-#define EHOSTUNREACH -1
-#endif
-CND(EHOSTUNREACH, "No route to host")
-
-#ifndef EINPROGRESS
-#define EINPROGRESS -1
-#endif
-CND(EINPROGRESS, "Operation now in progress")
-
-#ifndef EINTR
-#define EINTR -1
-#endif
-CND(EINTR, "Interrupted system call")
-
-#ifndef EINVAL
-#define EINVAL -1
-#endif
-CND(EINVAL, "Invalid argument")
-
-#ifndef EIO
-#define EIO -1
-#endif
-CND(EIO, "Input output error")
-
-#ifndef EISCONN
-#define EISCONN -1
-#endif
-CND(EISCONN, "Socket already connected")
-
-#ifndef ELOOP
-#define ELOOP -1
-#endif
-CND(ELOOP, "Too many symbolic links")
-
-#ifndef EMFILE
-#define EMFILE -1
-#endif
-CND(EMFILE, "Too many open files")
-
-#ifndef EMSGSIZE
-#define EMSGSIZE -1
-#endif
-CND(EMSGSIZE, "Message too long")
-
-#ifndef ENAMETOOLONG
-#define ENAMETOOLONG -1
-#endif
-CND(ENAMETOOLONG, "Name too long")
-
-#ifndef ENETDOWN
-#define ENETDOWN -1
-#endif
-CND(ENETDOWN, "Network is down")
-
-#ifndef ENETRESET
-#define ENETRESET -1
-#endif
-CND(ENETRESET, "Disconn. on network reset")
-
-#ifndef ENETUNREACH
-#define ENETUNREACH -1
-#endif
-CND(ENETUNREACH, "Network is unreachable")
-
-#ifndef ENOBUFS
-#define ENOBUFS -1
-#endif
-CND(ENOBUFS, "No buffer space available")
-
-#ifndef ENOPROTOOPT
-#define ENOPROTOOPT -1
-#endif
-CND(ENOPROTOOPT, "Protocol not available")
-
-#ifndef ENOTCONN
-#define ENOTCONN -1
-#endif
-CND(ENOTCONN, "Socket not connected")
-
-#ifndef ENOTSOCK
-#define ENOTSOCK -1
-#endif
-CND(ENOTSOCK, "Operation on non socket")
-
-#ifndef EOPNOTSUPP
-#define EOPNOTSUPP -1
-#endif
-CND(EOPNOTSUPP, "Operation not supported")
-
-#ifndef EPFNOSUPPORT
-#define EPFNOSUPPORT -1
-#endif
-CND(EPFNOSUPPORT, "Unknown protocol family")
-
-#ifndef EPROTONOSUPPORT
-#define EPROTONOSUPPORT -1
-#endif
-CND(EPROTONOSUPPORT, "Unknown protocol")
-
-#ifndef EPROTOTYPE
-#define EPROTOTYPE -1
-#endif
-CND(EPROTOTYPE, "Unknown protocol type")
-
-#ifndef ESHUTDOWN
-#define ESHUTDOWN -1
-#endif
-CND(ESHUTDOWN, "Cannot send once shutdown")
-
-#ifndef ESOCKTNOSUPPORT
-#define ESOCKTNOSUPPORT -1
-#endif
-CND(ESOCKTNOSUPPORT, "Socket type not supported")
-
-#ifndef ETIMEDOUT
-#define ETIMEDOUT -1
-#endif
-CND(ETIMEDOUT, "Connection timed out")
-
-#ifndef ETOOMANYREFS
-#define ETOOMANYREFS -1
-#endif
-CND(ETOOMANYREFS, "Too many references")
-
-#ifndef EWOULDBLOCK
-#define EWOULDBLOCK -1
-#endif
-CND(EWOULDBLOCK, "Operation would block")
-_NL
-TXT(" -----------------")
-TXT(" -- Host errors --")
-TXT(" -----------------")
-_NL
-
-#ifndef HOST_NOT_FOUND
-#define HOST_NOT_FOUND -1
-#endif
-CND(HOST_NOT_FOUND, "Unknown host")
-
-#ifndef TRY_AGAIN
-#define TRY_AGAIN -1
-#endif
-CND(TRY_AGAIN, "Host name lookup failure")
-
-#ifndef NO_DATA
-#define NO_DATA -1
-#endif
-CND(NO_DATA, "No data record for name")
-
-#ifndef NO_RECOVERY
-#define NO_RECOVERY -1
-#endif
-CND(NO_RECOVERY, "Non recoverable errors")
-_NL
-TXT(" -------------------")
-TXT(" -- Control flags --")
-TXT(" -------------------")
-_NL
-
-#ifndef FIONBIO
-#define FIONBIO -1
-#endif
-CND(FIONBIO, "Set/clear non-blocking io")
-
-#ifndef FIONREAD
-#define FIONREAD -1
-#endif
-CND(FIONREAD, "How many bytes to read")
-_NL
-TXT(" --------------------")
-TXT(" -- Shutdown modes --")
-TXT(" --------------------")
-_NL
-
-#ifndef SHUT_RD
-#define SHUT_RD -1
-#endif
-CND(SHUT_RD, "No more recv")
-
-#ifndef SHUT_WR
-#define SHUT_WR -1
-#endif
-CND(SHUT_WR, "No more send")
-
-#ifndef SHUT_RDWR
-#define SHUT_RDWR -1
-#endif
-CND(SHUT_RDWR, "No more recv/send")
-_NL
-TXT(" ---------------------")
-TXT(" -- Protocol levels --")
-TXT(" ---------------------")
-_NL
-
-#ifndef SOL_SOCKET
-#define SOL_SOCKET -1
-#endif
-CND(SOL_SOCKET, "Options for socket level")
-
-#ifndef IPPROTO_IP
-#define IPPROTO_IP -1
-#endif
-CND(IPPROTO_IP, "Dummy protocol for IP")
-
-#ifndef IPPROTO_UDP
-#define IPPROTO_UDP -1
-#endif
-CND(IPPROTO_UDP, "UDP")
-
-#ifndef IPPROTO_TCP
-#define IPPROTO_TCP -1
-#endif
-CND(IPPROTO_TCP, "TCP")
-_NL
-TXT(" -------------------")
-TXT(" -- Request flags --")
-TXT(" -------------------")
-_NL
-
-#ifndef MSG_OOB
-#define MSG_OOB -1
-#endif
-CND(MSG_OOB, "Process out-of-band data")
-
-#ifndef MSG_PEEK
-#define MSG_PEEK -1
-#endif
-CND(MSG_PEEK, "Peek at incoming data")
-
-#ifndef MSG_EOR
-#define MSG_EOR -1
-#endif
-CND(MSG_EOR, "Send end of record")
-
-#ifndef MSG_WAITALL
-#define MSG_WAITALL -1
-#endif
-CND(MSG_WAITALL, "Wait for full reception")
-
-#ifndef MSG_NOSIGNAL
-#define MSG_NOSIGNAL -1
-#endif
-CND(MSG_NOSIGNAL, "No SIGPIPE on send")
-
-#ifdef __linux__
-# define MSG_Forced_Flags "MSG_NOSIGNAL"
-#else
-# define MSG_Forced_Flags "0"
-#endif
-CN_(MSG_Forced_Flags, "")
-TXT(" -- Flags set on all send(2) calls")
-
-_NL
-TXT(" --------------------")
-TXT(" -- Socket options --")
-TXT(" --------------------")
-_NL
-
-#ifndef TCP_NODELAY
-#define TCP_NODELAY -1
-#endif
-CND(TCP_NODELAY, "Do not coalesce packets")
-
-#ifndef SO_REUSEADDR
-#define SO_REUSEADDR -1
-#endif
-CND(SO_REUSEADDR, "Bind reuse local address")
-
-#ifndef SO_REUSEPORT
-#define SO_REUSEPORT -1
-#endif
-CND(SO_REUSEPORT, "Bind reuse port number")
-
-#ifndef SO_KEEPALIVE
-#define SO_KEEPALIVE -1
-#endif
-CND(SO_KEEPALIVE, "Enable keep-alive msgs")
-
-#ifndef SO_LINGER
-#define SO_LINGER -1
-#endif
-CND(SO_LINGER, "Defer close to flush data")
-
-#ifndef SO_BROADCAST
-#define SO_BROADCAST -1
-#endif
-CND(SO_BROADCAST, "Can send broadcast msgs")
-
-#ifndef SO_SNDBUF
-#define SO_SNDBUF -1
-#endif
-CND(SO_SNDBUF, "Set/get send buffer size")
-
-#ifndef SO_RCVBUF
-#define SO_RCVBUF -1
-#endif
-CND(SO_RCVBUF, "Set/get recv buffer size")
-
-#ifndef SO_SNDTIMEO
-#define SO_SNDTIMEO -1
-#endif
-CND(SO_SNDTIMEO, "Emission timeout")
-
-#ifndef SO_RCVTIMEO
-#define SO_RCVTIMEO -1
-#endif
-CND(SO_RCVTIMEO, "Reception timeout")
-
-#ifndef SO_ERROR
-#define SO_ERROR -1
-#endif
-CND(SO_ERROR, "Get/clear error status")
-
-#ifndef IP_MULTICAST_IF
-#define IP_MULTICAST_IF -1
-#endif
-CND(IP_MULTICAST_IF, "Set/get mcast interface")
-
-#ifndef IP_MULTICAST_TTL
-#define IP_MULTICAST_TTL -1
-#endif
-CND(IP_MULTICAST_TTL, "Set/get multicast TTL")
-
-#ifndef IP_MULTICAST_LOOP
-#define IP_MULTICAST_LOOP -1
-#endif
-CND(IP_MULTICAST_LOOP, "Set/get mcast loopback")
-
-#ifndef IP_ADD_MEMBERSHIP
-#define IP_ADD_MEMBERSHIP -1
-#endif
-CND(IP_ADD_MEMBERSHIP, "Join a multicast group")
-
-#ifndef IP_DROP_MEMBERSHIP
-#define IP_DROP_MEMBERSHIP -1
-#endif
-CND(IP_DROP_MEMBERSHIP, "Leave a multicast group")
-
-#ifndef IP_PKTINFO
-#define IP_PKTINFO -1
-#endif
-CND(IP_PKTINFO, "Get datagram info")
-
-_NL
-TXT(" -------------------")
-TXT(" -- System limits --")
-TXT(" -------------------")
-_NL
-
-#ifndef IOV_MAX
-#define IOV_MAX INT_MAX
-#endif
-CND(IOV_MAX, "Maximum writev iovcnt")
-
-_NL
-TXT(" ----------------------")
-TXT(" -- Type definitions --")
-TXT(" ----------------------")
-_NL
-
-{
- struct timeval tv;
-TXT(" -- Sizes (in bytes) of the components of struct timeval")
-_NL
-#define SIZEOF_tv_sec (sizeof tv.tv_sec)
-CND(SIZEOF_tv_sec, "tv_sec")
-#define SIZEOF_tv_usec (sizeof tv.tv_usec)
-CND(SIZEOF_tv_usec, "tv_usec")
-}
-_NL
-TXT(" -- Sizes of protocol specific address types (for sockaddr.sa_len)")
-_NL
-#define SIZEOF_sockaddr_in (sizeof (struct sockaddr_in))
-CND(SIZEOF_sockaddr_in, "struct sockaddr_in")
-#ifdef HAVE_AF_INET6
-# define SIZEOF_sockaddr_in6 (sizeof (struct sockaddr_in6))
-#else
-# define SIZEOF_sockaddr_in6 0
-#endif
-CND(SIZEOF_sockaddr_in6, "struct sockaddr_in6")
-_NL
-TXT(" -- Size of file descriptor sets")
-_NL
-#define SIZEOF_fd_set (sizeof (fd_set))
-CND(SIZEOF_fd_set, "fd_set");
-_NL
-TXT(" -- Fields of struct hostent")
-_NL
-#ifdef __MINGW32__
-# define h_addrtype_t "short"
-# define h_length_t "short"
-#else
-# define h_addrtype_t "int"
-# define h_length_t "int"
-#endif
-TXT(" subtype H_Addrtype_T is Interfaces.C." h_addrtype_t ";")
-TXT(" subtype H_Length_T is Interfaces.C." h_length_t ";")
-_NL
-TXT(" ----------------------------------------")
-TXT(" -- Properties of supported interfaces --")
-TXT(" ----------------------------------------")
-_NL
-
-CND(Need_Netdb_Buffer, "Need buffer for Netdb ops")
-CND(Has_Sockaddr_Len, "Sockaddr has sa_len field")
-_NL
-TXT(" Thread_Blocking_IO : constant Boolean := True;")
-TXT(" -- Set False for contexts where socket i/o are process blocking")
-
-#ifdef __vxworks
-_NL
-TXT(" --------------------------------")
-TXT(" -- VxWorks-specific constants --")
-TXT(" --------------------------------")
-_NL
-TXT(" -- These constants may be used only within the VxWorks version of")
-TXT(" -- GNAT.Sockets.Thin.")
-_NL
-
-CND(OK, "VxWorks generic success")
-CND(ERROR, "VxWorks generic error")
-#endif
-
-#ifdef __MINGW32__
-_NL
-TXT(" ------------------------------")
-TXT(" -- MinGW-specific constants --")
-TXT(" ------------------------------")
-_NL
-TXT(" -- These constants may be used only within the MinGW version of")
-TXT(" -- GNAT.Sockets.Thin.")
-_NL
-
-CND(WSASYSNOTREADY, "System not ready")
-CND(WSAVERNOTSUPPORTED, "Version not supported")
-CND(WSANOTINITIALISED, "Winsock not initialized")
-CND(WSAEDISCON, "Disconnected")
-#endif
-
-_NL
-TXT("end GNAT.Sockets.Constants;")
-
- output ();
- return 0;
-}
-
-void
-output (void) {
- int text_max = 0, value_max = 0, l;
- struct line *p;
- char fmt[64];
-#define UPD_MAX(x) do { \
- l = strlen (p->x); \
- if (l > x ## _max) x ## _max = l; \
-} while (0)
-
- for (p = first; p != NULL; p = p->next) {
- if (p->value != NULL) {
- UPD_MAX(text);
- if (p->kind == NUM)
- UPD_MAX(value);
- }
- }
- sprintf (fmt, " %%-%ds : constant := %%%ds;%%s%%s\n",
- text_max, value_max);
-
- for (p = first; p != NULL; p = p->next) {
- if (p->value == NULL) {
- printf ("%s\n", p->text);
- } else {
- char *comment_sep = (strlen (p->comment) > 0)
- ? " -- " : "";
- printf (fmt, p->text, p->value, comment_sep, p->comment);
- }
- }
-}
-
-char *
-f_itoa (char *fmt, int n) {
- char buf[32], *ret;
- sprintf (buf, fmt, n);
- ret = malloc (strlen (buf) + 1);
- if (ret != NULL)
- strcpy (ret, buf);
- return ret;
-}
-
-void
-add_line (char *_text, char *_value, char *_comment, kind_t _kind) {
- struct line *l = (struct line *) malloc (sizeof (struct line));
-
- l->text = _text;
- l->value = _value;
- l->comment = _comment;
- l->kind = _kind;
- l->next = NULL;
-
- if (last == NULL)
- first = last = l;
- else {
- last->next = l;
- last = l;
- }
-}
diff --git a/gcc/ada/gnat-style.texi b/gcc/ada/gnat-style.texi
index 4600d1fd849..8af9fc9bb02 100644
--- a/gcc/ada/gnat-style.texi
+++ b/gcc/ada/gnat-style.texi
@@ -7,23 +7,23 @@
@c o
@c G N A T C O D I N G S T Y L E o
@c o
-@c Copyright (C) 1992-2007, AdaCore o
-@c o
-@c GNAT is free software; you can redistribute it and/or modify it under o
-@c terms of the GNU General Public License as published by the Free Soft- o
-@c ware Foundation; either version 2, or (at your option) any later ver- o
-@c sion. GNAT is distributed in the hope that it will be useful, but WITH- o
-@c OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY o
-@c or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License o
-@c for more details. You should have received a copy of the GNU General o
-@c Public License distributed with GNAT; see file COPYING. If not, write o
-@c to the Free Software Foundation, 51 Franklin Street, Fifth Floor, o
-@c Boston, MA 02110-1301, USA. o
+@c GNAT is maintained by Ada Core Technologies Inc (http://www.gnat.com). o
@c o
@c oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
@setfilename gnat-style.info
+@copying
+Copyright @copyright{} 1992-2007, Free Software Foundation, Inc.
+
+Permission is granted to copy, distribute and/or modify this document
+under the terms of the GNU Free Documentation License, Version 1.2 or
+any later version published by the Free Software Foundation; with no
+Invariant Sections, with no Front-Cover Texts and with no Back-Cover
+Texts. A copy of the license is included in the section entitled
+``GNU Free Documentation License''.
+@end copying
+
@settitle GNAT Coding Style
@setchapternewpage odd
@@ -49,17 +49,7 @@
@page
@vskip 0pt plus 1filll
-Copyright @copyright{} 1995-2007, Free Software Foundation
-
-Permission is granted to copy, distribute and/or modify this document
-under the terms of the GNU Free Documentation License, Version 1.1
-or any later version published by the Free Software Foundation;
-with the Invariant Sections being ``GNU Free Documentation License'', with the
-Front-Cover Texts being
-``GNAT Coding Style'' and ``A Guide for GNAT Developers'',
-and with no Back-Cover Texts.
-A copy of the license is included in the section entitled
-``GNU Free Documentation License''.
+@insertcopying
@end titlepage
@raisesections
@@ -76,15 +66,7 @@ A Guide for GNAT Developers
GNAT, The GNU Ada Compiler@*
@noindent
-Permission is granted to copy, distribute and/or modify this document
-under the terms of the GNU Free Documentation License, Version 1.1
-or any later version published by the Free Software Foundation;
-with the Invariant Sections being ``GNU Free Documentation License'', with the
-Front-Cover Texts being
-``GNAT Coding Style'' and ``A Guide for GNAT Developers''
-and with no Back-Cover Texts.
-A copy of the license is included in the section entitled
-``GNU Free Documentation License''.
+@insertcopying
@end ifnottex
diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi
index 47152e4bfbe..a768528d40b 100644
--- a/gcc/ada/gnat_rm.texi
+++ b/gcc/ada/gnat_rm.texi
@@ -8,15 +8,23 @@
@c o
@c G N A T _ RM o
@c o
-@c Copyright (C) 1995-2008, Free Software Foundation o
-@c o
-@c o
@c GNAT is maintained by Ada Core Technologies Inc (http://www.gnat.com). o
@c o
@c oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
@setfilename gnat_rm.info
+@copying
+Copyright @copyright{} 1995-2008, Free Software Foundation, Inc.
+
+Permission is granted to copy, distribute and/or modify this document
+under the terms of the GNU Free Documentation License, Version 1.2 or
+any later version published by the Free Software Foundation; with no
+Invariant Sections, with the Front-Cover Texts being ``GNAT Reference
+Manual'', and with no Back-Cover Texts. A copy of the license is
+included in the section entitled ``GNU Free Documentation License''.
+@end copying
+
@set EDITION GNAT
@set DEFAULTLANGUAGEVERSION Ada 2005
@set NONDEFAULTLANGUAGEVERSION Ada 95
@@ -33,18 +41,6 @@
* GNAT Reference Manual: (gnat_rm). Reference Manual for GNU Ada tools.
@end direntry
-@copying
-Copyright @copyright{} 1995-2008, Free Software Foundation, Inc.
-
-Permission is granted to copy, distribute and/or modify this document
-under the terms of the GNU Free Documentation License, Version 1.2
-or any later version published by the Free Software Foundation;
-with the Invariant Sections being ``GNU Free Documentation License'',
-with the Front-Cover Texts being ``GNAT Reference Manual'', and with
-no Back-Cover Texts. A copy of the license is included in the section
-entitled ``GNU Free Documentation License''.
-@end copying
-
@titlepage
@title GNAT Reference Manual
@subtitle GNAT, The GNU Ada Compiler
@@ -1833,6 +1829,7 @@ MECHANISM_NAME ::=
Value
| Reference
| Descriptor [([Class =>] CLASS_NAME)]
+| Short_Descriptor [([Class =>] CLASS_NAME)]
CLASS_NAME ::= ubs | ubsb | uba | s | sb | a
@end smallexample
@@ -1865,6 +1862,9 @@ anonymous access parameter.
@cindex OpenVMS
@cindex Passing by descriptor
Passing by descriptor is supported only on the OpenVMS ports of GNAT@.
+The default behavior for Export_Function is to accept either 64bit or
+32bit descriptors unless short_descriptor is specified, then only 32bit
+descriptors are accepted.
@cindex Suppressing external name
Special treatment is given if the EXTERNAL is an explicit null
@@ -1934,6 +1934,7 @@ MECHANISM_NAME ::=
Value
| Reference
| Descriptor [([Class =>] CLASS_NAME)]
+| Short_Descriptor [([Class =>] CLASS_NAME)]
CLASS_NAME ::= ubs | ubsb | uba | s | sb | a
@end smallexample
@@ -1951,6 +1952,9 @@ pragma that specifies the desired foreign convention.
@cindex OpenVMS
@cindex Passing by descriptor
Passing by descriptor is supported only on the OpenVMS ports of GNAT@.
+The default behavior for Export_Procedure is to accept either 64bit or
+32bit descriptors unless short_descriptor is specified, then only 32bit
+descriptors are accepted.
@cindex Suppressing external name
Special treatment is given if the EXTERNAL is an explicit null
@@ -2016,6 +2020,7 @@ MECHANISM_NAME ::=
Value
| Reference
| Descriptor [([Class =>] CLASS_NAME)]
+| Short_Descriptor [([Class =>] CLASS_NAME)]
CLASS_NAME ::= ubs | ubsb | uba | s | sb | a
@end smallexample
@@ -2038,6 +2043,9 @@ pragma that specifies the desired foreign convention.
@cindex OpenVMS
@cindex Passing by descriptor
Passing by descriptor is supported only on the OpenVMS ports of GNAT@.
+The default behavior for Export_Valued_Procedure is to accept either 64bit or
+32bit descriptors unless short_descriptor is specified, then only 32bit
+descriptors are accepted.
@cindex Suppressing external name
Special treatment is given if the EXTERNAL is an explicit null
@@ -2464,6 +2472,7 @@ MECHANISM_NAME ::=
Value
| Reference
| Descriptor [([Class =>] CLASS_NAME)]
+| Short_Descriptor [([Class =>] CLASS_NAME)]
CLASS_NAME ::= ubs | ubsb | uba | s | sb | a | nca
@end smallexample
@@ -2497,6 +2506,8 @@ is used.
@cindex OpenVMS
@cindex Passing by descriptor
Passing by descriptor is supported only on the OpenVMS ports of GNAT@.
+The default behavior for Import_Function is to pass a 64bit descriptor
+unless short_descriptor is specified, then a 32bit descriptor is passed.
@code{First_Optional_Parameter} applies only to OpenVMS ports of GNAT@.
It specifies that the designated parameter and all following parameters
@@ -2570,6 +2581,7 @@ MECHANISM_NAME ::=
Value
| Reference
| Descriptor [([Class =>] CLASS_NAME)]
+| Short_Descriptor [([Class =>] CLASS_NAME)]
CLASS_NAME ::= ubs | ubsb | uba | s | sb | a | nca
@end smallexample
@@ -2616,6 +2628,7 @@ MECHANISM_NAME ::=
Value
| Reference
| Descriptor [([Class =>] CLASS_NAME)]
+| Short_Descriptor [([Class =>] CLASS_NAME)]
CLASS_NAME ::= ubs | ubsb | uba | s | sb | a | nca
@end smallexample
@@ -3400,7 +3413,7 @@ Syntax:
@smallexample @c ada
pragma Obsolescent
- (Entity => NAME [, static_string_EXPRESSION [,Ada_05]]);
+ [(Entity => NAME [, static_string_EXPRESSION [,Ada_05]])];
@end smallexample
@noindent
@@ -3796,6 +3809,13 @@ package Sort is
end Sort;
@end smallexample
+@noindent
+Note: postcondition pragmas associated with subprograms that are
+marked as Inline_Always, or those marked as Inline with front-end
+inlining (-gnatN option set) are accepted and legality-checked
+by the compiler, but are ignored at run-time even if postcondition
+checking is enabled.
+
@node Pragma Precondition
@unnumberedsec Pragma Precondition
@cindex Preconditions
@@ -3830,13 +3850,22 @@ package Math_Functions is
end Math_Functions;
@end smallexample
-@code{Postcondition} pragmas may appear either immediate following the
+@noindent
+@code{Precondition} pragmas may appear either immediate following the
(separate) declaration of a subprogram, or at the start of the
declarations of a subprogram body. Only other pragmas may intervene
(that is appear between the subprogram declaration and its
postconditions, or appear before the postcondition in the
declaration sequence in a subprogram body).
+Note: postcondition pragmas associated with subprograms that are
+marked as Inline_Always, or those marked as Inline with front-end
+inlining (-gnatN option set) are accepted and legality-checked
+by the compiler, but are ignored at run-time even if postcondition
+checking is enabled.
+
+
+
@node Pragma Profile (Ravenscar)
@unnumberedsec Pragma Profile (Ravenscar)
@findex Ravenscar
@@ -4418,6 +4447,17 @@ on addresses used in address clauses. Such checks can also be suppressed
by suppressing range checks, but the specific use of @code{Alignment_Check}
allows suppression of alignment checks without suppressing other range checks.
+Note that pragma Suppress gives the compiler permission to omit
+checks, but does not require the compiler to omit checks. The compiler
+will generate checks if they are essentially free, even when they are
+suppressed. In particular, if the compiler can prove that a certain
+check will necessarily fail, it will generate code to do an
+unconditional ``raise'', even if checks are suppressed. The compiler
+warns in this case.
+
+Of course, run-time checks are omitted whenever the compiler can prove
+that they will not fail, whether or not checks are suppressed.
+
@node Pragma Suppress_All
@unnumberedsec Pragma Suppress_All
@findex Suppress_All
diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi
index 99f3c8631d4..5918edda65b 100644
--- a/gcc/ada/gnat_ugn.texi
+++ b/gcc/ada/gnat_ugn.texi
@@ -1,26 +1,30 @@
\input texinfo @c -*-texinfo-*-
@c %**start of header
+
@c oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
@c o
@c GNAT DOCUMENTATION o
@c o
@c G N A T _ U G N o
@c o
-@c Copyright (C) 1992-2008, AdaCore o
-@c o
-@c GNAT is free software; you can redistribute it and/or modify it under o
-@c terms of the GNU General Public License as published by the Free Soft- o
-@c ware Foundation; either version 2, or (at your option) any later ver- o
-@c sion. GNAT is distributed in the hope that it will be useful, but WITH- o
-@c OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY o
-@c or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License o
-@c for more details. You should have received a copy of the GNU General o
-@c Public License distributed with GNAT; see file COPYING. If not, write o
-@c to the Free Software Foundation, 51 Franklin Street, Fifth Floor, o
-@c Boston, MA 02110-1301, USA. o
+@c GNAT is maintained by Ada Core Technologies Inc (http://www.gnat.com). o
@c o
@c oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
+@setfilename gnat_ugn.info
+
+@copying
+Copyright @copyright{} 1995-2005, 2006, 2007, 2008 Free Software Foundation,
+Inc.
+
+Permission is granted to copy, distribute and/or modify this document
+under the terms of the GNU Free Documentation License, Version 1.2 or
+any later version published by the Free Software Foundation; with no
+Invariant Sections, with no Front-Cover Texts and with no Back-Cover
+Texts. A copy of the license is included in the section entitled
+``GNU Free Documentation License''.
+@end copying
+
@c oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
@c
@c GNAT_UGN Style Guide
@@ -76,8 +80,6 @@
@c
@c oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
-@setfilename gnat_ugn.info
-
@set NOW January 2007
@c This flag is used where the text refers to conditions that exist when the
@c text was entered into the document but which may change over time.
@@ -118,21 +120,6 @@
@syncodeindex fn cp
@c %**end of header
-@copying
-Copyright @copyright{} 1995-2005, 2006, 2007, 2008 Free Software Foundation,
-Inc.
-
-Permission is granted to copy, distribute and/or modify this document
-under the terms of the GNU Free Documentation License, Version 1.2
-or any later version published by the Free Software Foundation;
-with the Invariant Sections being ``GNU Free Documentation License'', with the
-Front-Cover Texts being
-``@value{EDITION} User's Guide'',
-and with no Back-Cover Texts.
-A copy of the license is included in the section entitled
-``GNU Free Documentation License''.
-@end copying
-
@titlepage
@title @value{EDITION} User's Guide
@ifset vms
@@ -2381,7 +2368,7 @@ that for inlining to actually occur as a result of the use of this switch,
it is necessary to compile in optimizing mode.
@cindex @option{-gnatN} switch
-The use of @option{-gnatN} activates a more extensive inlining optimization
+The use of @option{-gnatN} activates inlining optimization
that is performed by the front end of the compiler. This inlining does
not require that the code generation be optimized. Like @option{-gnatn},
the use of this switch generates additional dependencies.
@@ -2389,6 +2376,12 @@ Note that
@option{-gnatN} automatically implies @option{-gnatn} so it is not necessary
to specify both options.
+When using a gcc-based back end (in practice this means using any version
+of GNAT other than the JGNAT, .NET or GNAAMP versions), then the use of
+@option{-gnatN} is deprecated, and the use of @option{-gnatn} is preferred.
+Historically front end inlining was more extensive than the gcc back end
+inlining, but that is no longer the case.
+
@item
If an object file @file{O} depends on the proper body of a subunit through
inlining or instantiation, it depends on the parent unit of the subunit.
@@ -3911,6 +3904,10 @@ Defines a symbol, associated with @var{value}, for preprocessing.
@cindex @option{-gnatef} (@command{gcc})
Display full source path name in brief error messages.
+@item -gnateG
+@cindex @option{-gnateG} (@command{gcc})
+Save result of preprocessing in a text file.
+
@item -gnatem=@var{path}
@cindex @option{-gnatem} (@command{gcc})
Specify a mapping file
@@ -4025,12 +4022,12 @@ catches that cannot be dealt with in the front-end.
@item -gnato
@cindex @option{-gnato} (@command{gcc})
Enable numeric overflow checking (which is not normally enabled by
-default). Not that division by zero is a separate check that is not
+default). Note that division by zero is a separate check that is not
controlled by this switch (division by zero checking is on by default).
@item -gnatp
@cindex @option{-gnatp} (@command{gcc})
-Suppress all checks.
+Suppress all checks. See @ref{Run-Time Checks} for details.
@item -gnatP
@cindex @option{-gnatP} (@command{gcc})
@@ -4041,11 +4038,11 @@ details.
@item -gnatq
@cindex @option{-gnatq} (@command{gcc})
-Don't quit; try semantics, even if parse errors.
+Don't quit. Try semantics, even if parse errors.
@item -gnatQ
@cindex @option{-gnatQ} (@command{gcc})
-Don't quit; generate @file{ALI} and tree files even if illegalities.
+Don't quit. Generate @file{ALI} and tree files even if illegalities.
@item -gnatr
@cindex @option{-gnatr} (@command{gcc})
@@ -4839,6 +4836,21 @@ are not generated.
This switch suppresses warnings for static fixed-point expressions whose
value is not an exact multiple of Small.
+@item -gnatw.b
+@emph{Activate warnings on biased representation.}
+@cindex @option{-gnatw.b} (@command{gcc})
+@cindex Biased representation
+This switch activates warnings when a size clause, value size clause, component
+clause, or component size clause forces the use of biased representation for an
+integer type (e.g. representing a range of 10..11 in a single bit by using 0/1
+to represent 10/11). The default is that such warnings are generated.
+
+@item -gnatw.B
+@emph{Suppress warnings on biased representation.}
+@cindex @option{-gnatwB} (@command{gcc})
+This switch suppresses warnings for representation clauses that force the use
+of biased representation.
+
@item -gnatwc
@emph{Activate warnings on conditionals.}
@cindex @option{-gnatwc} (@command{gcc})
@@ -6210,14 +6222,11 @@ clears any previously set style checks.
@cindex Checks, stack overflow checking
@noindent
-If you compile with the default options, GNAT will insert many run-time
-checks into the compiled code, including code that performs range
-checking against constraints, but not arithmetic overflow checking for
-integer operations (including division by zero), checks for access
-before elaboration on subprogram calls, or stack overflow checking. All
-other run-time checks, as required by the Ada Reference Manual, are
-generated by default. The following @command{gcc} switches refine this
-default behavior:
+By default, the following checks are suppressed: integer overflow
+checks, stack overflow checks, and checks for access before
+elaboration on subprogram calls. All other checks, including range
+checks and array bounds checks, are turned on by default. The
+following @command{gcc} switches refine this default behavior.
@table @option
@c !sort!
@@ -6226,13 +6235,33 @@ default behavior:
@cindex Suppressing checks
@cindex Checks, suppressing
@findex Suppress
-Suppress all run-time checks as though @code{pragma Suppress (all_checks})
+Suppress all run-time checks as though @code{pragma Suppress (All_checks)}
had been present in the source. Validity checks are also suppressed (in
other words @option{-gnatp} also implies @option{-gnatVn}.
Use this switch to improve the performance
of the code at the expense of safety in the presence of invalid data or
program bugs.
+Note that when checks are suppressed, the compiler is allowed, but not
+required, to omit the checking code. If the run-time cost of the
+checking code is zero or near-zero, the compiler will generate it even
+if checks are suppressed. In particular, if the compiler can prove
+that a certain check will necessarily fail, it will generate code to
+do an unconditional ``raise'', even if checks are suppressed. The
+compiler warns in this case.
+
+Of course, run-time checks are omitted whenever the compiler can prove
+that they will not fail, whether or not checks are suppressed.
+
+Note that if you suppress a check that would have failed, program
+execution is erroneous, which means the behavior is totally
+unpredictable. The program might crash, or print wrong answers, or
+do anything else. It might even do exactly what you wanted it to do
+(and then it might start failing mysteriously next week or next
+year). The compiler will generate code based on the assumption that
+the condition being checked is true, which can result in disaster if
+that assumption is wrong.
+
@item -gnato
@cindex @option{-gnato} (@command{gcc})
@cindex Overflow checks
@@ -6246,11 +6275,11 @@ the true value of the result of an operation may be outside the base
range of the result type. The following example shows the distinction:
@smallexample @c ada
-X1 : Integer := Integer'Last;
-X2 : Integer range 1 .. 5 := 5;
-X3 : Integer := Integer'Last;
-X4 : Integer range 1 .. 5 := 5;
-F : Float := 2.0E+20;
+X1 : Integer := "Integer'Last";
+X2 : Integer range 1 .. 5 := "5";
+X3 : Integer := "Integer'Last";
+X4 : Integer range 1 .. 5 := "5";
+F : Float := "2.0E+20";
@dots{}
X1 := X1 + 1;
X2 := X2 + 1;
@@ -6259,15 +6288,23 @@ X4 := Integer (F);
@end smallexample
@noindent
+Note that if explicit values are assigned at compile time, the
+compiler may be able to detect overflow at compile time, in which case
+no actual run-time checking code is required, and Constraint_Error
+will be raised unconditionally, with or without
+@option{-gnato}. That's why the assigned values in the above fragment
+are in quotes, the meaning is "assign a value not known to the
+compiler that happens to be equal to ...". The remaining discussion
+assumes that the compiler cannot detect the values at compile time.
+
Here the first addition results in a value that is outside the base range
of Integer, and hence requires an overflow check for detection of the
constraint error. Thus the first assignment to @code{X1} raises a
@code{Constraint_Error} exception only if @option{-gnato} is set.
-The second increment operation results in a violation
-of the explicit range constraint, and such range checks are always
-performed (unless specifically suppressed with a pragma @code{suppress}
-or the use of @option{-gnatp}).
+The second increment operation results in a violation of the explicit
+range constraint; such range checks are performed by default, and are
+unaffected by @option{-gnato}.
The two conversions of @code{F} both result in values that are outside
the base range of type @code{Integer} and thus will raise
@@ -6323,6 +6360,8 @@ explicitly use the -gnato switch either on the @command{gnatmake} or
@cindex Check, elaboration
Enables dynamic checks for access-before-elaboration
on subprogram calls and generic instantiations.
+Note that @option{-gnatE} is not necessary for safety, because in the
+default mode, GNAT ensures statically that the checks would not fail.
For full details of the effect and use of this switch,
@xref{Compiling Using gcc}.
@@ -7194,6 +7233,11 @@ symbol with the same name either in a definition file or specified with a
@noindent
This switch is similar to switch @option{^-D^/ASSOCIATE^} of @code{gnatprep}.
+@item -gnateG
+When integrated preprocessing is performed and the preprocessor modifies
+the source text, write the result of this preprocessing into a file
+<source>^.prep^_prep^.
+
@end table
@node Code Generation Control
@@ -9524,8 +9568,8 @@ some guidelines on debugging optimized code.
@subsection Controlling Run-Time Checks
@noindent
-By default, GNAT generates all run-time checks, except arithmetic overflow
-checking for integer operations and checks for access before elaboration on
+By default, GNAT generates all run-time checks, except integer overflow
+checks, stack overflow checks, and checks for access before elaboration on
subprogram calls. The latter are not required in default mode, because all
necessary checking is done at compile time.
@cindex @option{-gnatp} (@command{gcc})
@@ -20517,7 +20561,7 @@ used as a parameter of the @option{+R} or @option{-R} options.
@ignore
* Improperly_Called_Protected_Entries::
@end ignore
-* Metrics_Violation::
+* Metrics::
* Misnamed_Identifiers::
* Multiple_Entries_In_Protected_Definitions::
* Name_Clashes::
@@ -21018,64 +21062,25 @@ Flag each protected entry that can be called from more than one task.
This rule has no parameters.
@end ignore
-@node Metrics_Violation
-@subsection @code{Metrics_Violation}
+@node Metrics
+@subsection @code{Metrics}
@cindex @code{Metrics} rule (for @command{gnatcheck})
@noindent
-This is an umbrella rule for a set of metrics-based checks. The parameters of
-the rule specify which metrics should be checked, and a bound (upper or lower,
-depending on the metric) for each specified metric. A construct is
-flagged if a specified metric can be computed for it, and the resulting value
-is higher then the upper bound (or less than the lower bound) specified.
-
-This rule has the following parameters:
-
-@itemize @bullet
-@item
-For the @option{+R} option:
-@table @code
-@item @i{Metric_Check_Name} < @i{LowerBound}
-Turns the check for the specified metric ON and specifies the lower bound
-for a given metric check
-
-@item @i{Metric_Check_Name} > @i{UpperBound}
-
-Turns the check for the specified metric ON and specifies the upper bound
-for a given metric check
-@end table
-
-@item
-For the @option{-R} option:
-@table @code
-@item @i{Metric_Check_Name}
-Turns the check for the specified metric OFF
-@end table
-@end itemize
-
-@noindent
-Parameters are not case-sensitive. @i{Metric_Check_Name} must be
-the name of a metric supported by the @code{Metrics_Violation} rule
-(see the table below),
-otherwise the parameter is ignored. Whether the upper or lower bound
-is specified for a given check, depends on the metric. If a
-parameter for the @option{+R} option specifies an invalid limit, a
-warning is issued and the parameter is ignored.
+This is an umbrella rule for a set of metrics-based checks. Each metric-based
+check has its own rule name that starts from the common prefix
+@code{Metrics_}. For @option{+R} option, this name ends with @code{_GT}
+(greater then) or @code{_LT} (less then). The parameter of the rule
+@option{+R} option specifies bound (upper or lower, depending on the metric)
+for the given metric. A construct is flagged if a specified metric can be
+computed for it, and the resulting value is higher then the upper bound (or
+less than the lower bound) specified. Parameters and metric names are not
+case-sensitive @option{-R} option does not have a parameter and it turns OFF
+the check for the metric indicated by the metric rule name.
-The @option{-R} option without parameters turns OFF all the previously enabled
-metric checks. the @option{+R} option without parameters turns ON all the
-metric checks that have been defined by previous @option{+R} options with
-valid parameters. @option{+R} option with a valid
-parameter also turns ON all the other metric checks that have been defined
-by previous @option{+R} options with valid parameters if they have been
-disabled by @option{-R} option without parameters.
-
-By default no metrics checks are ON, so the @option{+R} option without
-parameters actually does not specify any check.
-
-The following table shows the available metrics-based checks,
-including the constraint that must be satisfied by the bound that
-is specified for the check.
+The following table shows the available metrics-based checks, including the
+constraint that must be satisfied by the bound that is specified for the check
+and what bound - upper (U) or lower (L) - should be specified.
@multitable {@code{Cyclomatic_Complexity}}{Cyclomatic complexity}{Positive integer}
@ifnothtml
@@ -21085,9 +21090,9 @@ is specified for the check.
@item @b{Check Name} @tab @b{Description} @tab @b{Bounds Value}
@end ifhtml
@c Above conditional code is workaround to bug in texi2html (Feb 2008)
-@item @code{Essential_Complexity} @tab Essential complexity @tab Positive integer
-@item @code{Cyclomatic_Complexity} @tab Cyclomatic complexity @tab Positive integer
-@item @code{LSLOC} @tab Logical Source Lines of Code @tab Positive integer
+@item @code{Essential_Complexity} @tab Essential complexity @tab Positive integer (U)
+@item @code{Cyclomatic_Complexity} @tab Cyclomatic complexity @tab Positive integer (U)
+@item @code{LSLOC} @tab Logical Source Lines of Code @tab Positive integer (U)
@end multitable
@noindent
@@ -21096,11 +21101,16 @@ the same as for the corresponding metrics in @command{gnatmetric}.
@emph{Example:} the rule
@smallexample
-+RMetrics_Violation: Cyclomatic_Complexity > 7
++RMetrics_Cyclomatic_Complexity_GT : 7
@end smallexample
@noindent
means that all bodies with cyclomatic complexity exceeding 7 will be flagged.
+To turn OFF the check for cyclomatic complexity metric, use the following option:
+@smallexample
+-RMetrics_Cyclomatic_Complexity
+@end smallexample
+
@node Misnamed_Identifiers
@subsection @code{Misnamed_Identifiers}
@cindex @code{Misnamed_Identifiers} rule (for @command{gnatcheck})
@@ -21548,7 +21558,7 @@ The control structures checked are the following:
@end itemize
@noindent
-The rule may have the following parameter for the @option{+R} option:
+The rule has the following parameter for the @option{+R} option:
@table @emph
@item N
@@ -21557,18 +21567,12 @@ level that is not flagged
@end table
@noindent
-If the parameter for the @option{+R} option is not a positive integer,
-the parameter is ignored and the rule is turned ON with the most recently
-specified maximal non-flagged nesting level.
+If the parameter for the @option{+R} option is not specified or
+if it is not a positive integer, @option{+R} option is ignored.
If more then one option is specified for the gnatcheck call, the later option and
new parameter override the previous one(s).
-A @option{+R} option with no parameter turns the rule ON using the maximal
-non-flagged nesting level specified by the most recent @option{+R} option with
-a parameter, or the value 4 if there is no such previous @option{+R} option.
-
-
@node Parameters_Out_Of_Order
@subsection @code{Parameters_Out_Of_Order}
@@ -25521,6 +25525,7 @@ information about several specific platforms.
* Linux-Specific Considerations::
* AIX-Specific Considerations::
* Irix-Specific Considerations::
+* RTX-Specific Considerations::
@end menu
@node Summary of Run-Time Configurations
@@ -25631,6 +25636,15 @@ information about several specific platforms.
@item @code{@ @ @ @ }Tasking @tab native Win32 threads
@item @code{@ @ @ @ }Exceptions @tab SJLJ
@*
+@item @b{x86-windows-rtx}
+@item @code{@ @ }@i{rts-rtx-rtss (default)}
+@item @code{@ @ @ @ }Tasking @tab RTX real-time subsystem RTSS threads (kernel mode)
+@item @code{@ @ @ @ }Exceptions @tab SJLJ
+@*
+@item @code{@ @ }@i{rts-rtx-w32}
+@item @code{@ @ @ @ }Tasking @tab RTX Win32 threads (user mode)
+@item @code{@ @ @ @ }Exceptions @tab ZCX
+@*
@item @b{x86_64-linux}
@item @code{@ @ }@i{rts-native (default)}
@item @code{@ @ @ @ }Tasking @tab pthread library
@@ -25855,6 +25869,26 @@ $ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`dirname \`gcc --print-file-name=libgcc_s.so
@end group
@end smallexample
+@node RTX-Specific Considerations
+@section RTX-Specific Considerations
+@cindex RTX libraries
+
+@noindent
+The Real-time Extension (RTX) to Windows is based on the Windows Win32
+API. Applications can be built to work in two different modes:
+
+@itemize @bullet
+@item
+Windows executables that run in Ring 3 to utilize memory protection
+(@emph{rts-rtx-w32}).
+
+@item
+Real-time subsystem (RTSS) executables that run in Ring 0, where
+performance can be optimized with RTSS applications taking precedent
+over all Windows applications (@emph{rts-rtx-rtss}).
+
+@end itemize
+
@c *******************************
@node Example of Binder Output File
@appendix Example of Binder Output File
diff --git a/gcc/ada/gnatchop.adb b/gcc/ada/gnatchop.adb
index 766a474afbf..7c17beb5802 100644
--- a/gcc/ada/gnatchop.adb
+++ b/gcc/ada/gnatchop.adb
@@ -63,9 +63,9 @@ procedure Gnatchop is
-- Arguments used in Gnat_Cmd call
EOF : constant Character := Character'Val (26);
- -- Special character to signal end of file. Not required in input
- -- files, but properly treated if present. Not generated in output
- -- files except as a result of copying input file.
+ -- Special character to signal end of file. Not required in input files,
+ -- but properly treated if present. Not generated in output files except
+ -- as a result of copying input file.
--------------------
-- File arguments --
@@ -152,8 +152,8 @@ procedure Gnatchop is
-- Index of unit in sorted unit list
Bufferg : String_Access;
- -- Pointer to buffer containing configuration pragmas to be
- -- prepended. Null if no pragmas to be prepended.
+ -- Pointer to buffer containing configuration pragmas to be prepended.
+ -- Null if no pragmas to be prepended.
end record;
-- The following table stores the unit offset information
@@ -1018,9 +1018,9 @@ procedure Gnatchop is
Contents := new String (1 .. Read_Ptr);
Contents.all := Buffer (1 .. Read_Ptr);
- -- Things aren't simple on VMS due to the plethora of file types
- -- and organizations. It seems clear that there shouldn't be more
- -- bytes read than are contained in the file though.
+ -- Things aren't simple on VMS due to the plethora of file types and
+ -- organizations. It seems clear that there shouldn't be more bytes
+ -- read than are contained in the file though.
if Hostparm.OpenVMS then
Success := Read_Ptr <= Length + 1;
@@ -1249,7 +1249,6 @@ procedure Gnatchop is
F : constant String := File.Table (File_Num).Name.all;
begin
-
if Is_Directory (F) then
Error_Msg (F & " is a directory, cannot be chopped");
return False;
@@ -1277,7 +1276,6 @@ procedure Gnatchop is
end if;
return False;
-
end Scan_Arguments;
----------------
@@ -1636,11 +1634,11 @@ procedure Gnatchop is
-- Returns in OS_Name the proper name for the OS when used with the
-- returned Encoding value. For example on Windows this will return the
-- UTF-8 encoded name into OS_Name and set Encoding to encoding=utf8
- -- (form parameter Stream_IO).
+ -- (the form parameter for Stream_IO).
+ --
-- Name is the filename and W_Name the same filename in Unicode 16 bits
- -- (this corresponds to Win32 Unicode ISO/IEC 10646). N_Length and
- -- E_Length are the length returned in OS_Name and Encoding
- -- respectively.
+ -- (this corresponds to Win32 Unicode ISO/IEC 10646). N_Length/E_Length
+ -- are the length returned in OS_Name/Encoding respectively.
Info : Unit_Info renames Unit.Table (Num);
Name : aliased constant String := Info.File_Name.all & ASCII.NUL;
@@ -1676,6 +1674,7 @@ procedure Gnatchop is
C_Name : aliased constant String := E_Name & ASCII.NUL;
OS_Encoding : constant String := Encoding (1 .. E_Length);
File : Stream_IO.File_Type;
+
begin
begin
if not Overwrite_Files and then Exists (E_Name) then
@@ -1685,6 +1684,7 @@ procedure Gnatchop is
(File, Stream_IO.Out_File, E_Name, OS_Encoding);
Success := True;
end if;
+
exception
when Stream_IO.Name_Error | Stream_IO.Use_Error =>
Error_Msg ("cannot create " & Info.File_Name.all);
@@ -1705,7 +1705,6 @@ procedure Gnatchop is
if Success and then Info.Bufferg /= null then
Write_Source_Reference_Pragma (Info, 1, File, EOL, Success);
-
String'Write (Stream_IO.Stream (File), Info.Bufferg.all);
end if;
@@ -1742,10 +1741,9 @@ procedure Gnatchop is
-- Start of processing for gnatchop
begin
- -- Add the directory where gnatchop is invoked in front of the
- -- path, if gnatchop is invoked with directory information.
- -- Only do this if the platform is not VMS, where the notion of path
- -- does not really exist.
+ -- Add the directory where gnatchop is invoked in front of the path, if
+ -- gnatchop is invoked with directory information. Only do this if the
+ -- platform is not VMS, where the notion of path does not really exist.
if not Hostparm.OpenVMS then
declare
@@ -1758,12 +1756,10 @@ begin
Absolute_Dir : constant String :=
Normalize_Pathname
(Command (Command'First .. Index));
-
PATH : constant String :=
- Absolute_Dir &
- Path_Separator &
- Getenv ("PATH").all;
-
+ Absolute_Dir
+ & Path_Separator
+ & Getenv ("PATH").all;
begin
Setenv ("PATH", PATH);
end;
@@ -1813,26 +1809,24 @@ begin
Sort_Units;
- -- Check if any duplicate files would be created. If so, emit
- -- a warning if Overwrite_Files is true, otherwise generate an error.
+ -- Check if any duplicate files would be created. If so, emit a warning if
+ -- Overwrite_Files is true, otherwise generate an error.
if Report_Duplicate_Units and then not Overwrite_Files then
goto No_Files_Written;
end if;
- -- Check if any files exist, if so do not write anything
- -- Because all files have been parsed and checked already,
- -- there won't be any duplicates
+ -- Check if any files exist, if so do not write anything Because all files
+ -- have been parsed and checked already, there won't be any duplicates
if not Overwrite_Files and then Files_Exist then
goto No_Files_Written;
end if;
- -- After this point, all source files are read in succession
- -- and chopped into their destination files.
+ -- After this point, all source files are read in succession and chopped
+ -- into their destination files.
- -- As the Source_File_Name pragmas are handled as logical file 0,
- -- write it first.
+ -- Source_File_Name pragmas are handled as logical file 0 so write it first
for F in 1 .. File.Last loop
if not Write_Chopped_Files (F) then
diff --git a/gcc/ada/gnathtml.pl b/gcc/ada/gnathtml.pl
new file mode 100644
index 00000000000..9d893268055
--- /dev/null
+++ b/gcc/ada/gnathtml.pl
@@ -0,0 +1,1115 @@
+#! /usr/bin/env perl
+
+#-----------------------------------------------------------------------------
+#- --
+#- GNAT COMPILER COMPONENTS --
+#- --
+#- G N A T H T M L --
+#- --
+#- Copyright (C) 1998-2008, Free Software Foundation, Inc. --
+#- --
+#- GNAT is free software; you can redistribute it and/or modify it under --
+#- terms of the GNU General Public License as published by the Free Soft- --
+#- ware Foundation; either version 2, or (at your option) any later ver- --
+#- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+#- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+#- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
+#- for more details. You should have received a copy of the GNU General --
+#- Public License distributed with GNAT; see file COPYING. If not, write --
+#- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
+#- MA 02111-1307, USA. --
+#- --
+#- GNAT was originally developed by the GNAT team at New York University. --
+#- Extensive contributions were provided by Ada Core Technologies Inc. --
+#- --
+#-----------------------------------------------------------------------------
+
+## This script converts an Ada file (and its dependency files) to Html.
+## Keywords, comments and strings are color-hilighted. If the cross-referencing
+## information provided by Gnat (when not using the -gnatx switch) is found,
+## the html files will also have some cross-referencing features, i.e. if you
+## click on a type, its declaration will be displayed.
+##
+## To find more about the switches provided by this script, please use the
+## following command :
+## perl gnathtml.pl -h
+## You may also change the first line of this script to indicates where Perl is
+## installed on your machine, so that you can just type
+## gnathtml.pl -h
+##
+## Unless you supply another directory with the -odir switch, the html files
+## will be saved saved in a html subdirectory
+
+use Cwd 'abs_path';
+use File::Basename;
+
+### Print help if necessary
+sub print_usage
+{
+ print "Usage is:\n";
+ print " $0 [switches] main_file[.adb] main_file2[.adb] ...\n";
+ print " -83 : Use Ada83 keywords only (default is Ada95)\n";
+ print " -cc color : Choose the color for comments\n";
+ print " -d : Convert also the files which main_file depends on\n";
+ print " -D : same as -d, also looks for files in the standard library\n";
+ print " -f : Include cross-references for local entities too\n";
+ print " -absolute : Display absolute filenames in the headers\n";
+ print " -h : Print this help page\n";
+ print " -lnb : Display line numbers every nb lines\n";
+ print " -Idir : Specify library/object files search path\n";
+ print " -odir : Name of the directory where the html files will be\n";
+ print " saved. Default is 'html/'\n";
+ print " -pfile : Use file as a project file (.adp file)\n";
+ print " -sc color : Choose the color for symbol definitions\n";
+ print " -Tfile : Read the name of the files from file rather than the\n";
+ print " command line\n";
+ print " -ext ext : Choose the generated file names extension (default\n";
+ print " is htm)\n";
+ print "This program attemps to generate an html file from an Ada file\n";
+ exit;
+}
+
+### Parse the command line
+local ($ada83_mode) = 0;
+local ($prjfile) = "";
+local (@list_files) = ();
+local ($line_numbers) = 0;
+local ($dependencies) = 0;
+local ($standard_library) = 0;
+local ($output_dir) = "html";
+local ($xref_variable) = 0;
+local (@search_dir) = ('.');
+local ($tab_size) = 8;
+local ($comment_color) = "green";
+local ($symbol_color) = "red";
+local ($absolute) = 0;
+local ($fileext) = "htm";
+
+while ($_ = shift @ARGV)
+{
+ /^-83$/ && do { $ada83_mode = 1; };
+ /^-d$/ && do { $dependencies = 1; };
+ /^-D$/ && do { $dependencies = 1;
+ $standard_library = 1; };
+ /^-f$/ && do { $xref_variable = 1; };
+ /^-absolute$/ && do {$absolute = 1; };
+ /^-h$/ && do { &print_usage; };
+ /^[^-]/ && do { $_ .= ".adb" if (! /\.ad[bs]$/);
+ push (@list_files, $_); };
+
+ if (/^-o\s*(.*)$/)
+ {
+ $output_dir = ($1 eq "") ? shift @ARGV : $1;
+ chop $output_dir if ($output_dir =~ /\/$/);
+ &print_usage if ($output_dir =~ /^-/ || $output_dir eq "");
+ }
+
+ if (/^-T\s*(.*)$/)
+ {
+ my ($source_file) = ($1 eq "") ? shift @ARGV : $1;
+ local (*SOURCE);
+ open (SOURCE, "$source_file") || die "file not found: $source_file";
+ while (<SOURCE>) {
+ @files = split;
+ foreach (@files) {
+ $_ .= ".adb" if (! /\.ad[bs]$/);
+ push (@list_files, $_);
+ }
+ }
+ }
+
+ if (/^-cc\s*(.*)$/)
+ {
+ $comment_color = ($1 eq "") ? shift @ARGV : $1;
+ &print_usage if ($comment_color =~ /^-/ || $comment_color eq "");
+ }
+
+ if (/^-sc\s*(.*)$/)
+ {
+ $symbol_color = ($1 eq "") ? shift @ARGV : $1;
+ &print_usage if ($symbol_color =~ /^-/ || $symbol_color eq "");
+ }
+
+ if (/^-I\s*(.*)$/)
+ {
+ push (@search_dir, ($1 eq "") ? scalar (shift @ARGV) : $1);
+ }
+
+ if (/^-p\s*(.*)$/)
+ {
+ $prjfile = ($1 eq "") ? shift @ARGV : $1;
+ &print_usage if ($prjfile =~ /^-/ || $prjfile eq "");
+ }
+
+ if (/^-l\s*(.*)$/)
+ {
+ $line_numbers = ($1 eq "") ? shift @ARGV : $1;
+ &print_usage if ($line_numbers =~ /^-/ || $line_numbers eq "");
+ }
+
+ if (/^-ext\s*(.*)$/)
+ {
+ $fileext = ($1 eq "") ? shift @ARGV : $1;
+ &print_usage if ($fileext =~ /^-/ || $fileext eq "");
+ }
+}
+
+&print_usage if ($#list_files == -1);
+local (@original_list) = @list_files;
+
+## This regexp should match all the files from the standard library (and only them)
+## Note that at this stage the '.' in the file names has been replaced with __
+$standard_file_regexp="^([agis]-|ada__|gnat__|system__|interface__).*\$";
+
+local (@src_dir) = ();
+local (@obj_dir) = ();
+
+if ($standard_library) {
+ open (PIPE, "gnatls -v | ");
+ local ($mode) = "";
+ while (defined ($_ = <PIPE>)) {
+ chop;
+ s/^\s+//;
+ $_ = './' if (/<Current_Directory>/);
+ next if (/^$/);
+
+ if (/Source Search Path:/) {
+ $mode = 's';
+ }
+ elsif (/Object Search Path:/) {
+ $mode = 'o';
+ }
+ elsif ($mode eq 's') {
+ push (@src_dir, $_);
+ }
+ elsif ($mode eq 'o') {
+ push (@obj_dir, $_);
+ }
+ }
+ close (PIPE);
+}
+else
+{
+ push (@src_dir, "./");
+ push (@obj_dir, "./");
+}
+
+foreach (@list_files) {
+ local ($dir) = $_;
+ $dir =~ s/\/([^\/]+)$//;
+ push (@src_dir, $dir. '/');
+ push (@obj_dir, $dir. '/');
+}
+
+### Defines and compiles the Ada key words :
+local (@Ada_keywords) = ('abort', 'abs', 'accept', 'access', 'all', 'and',
+ 'array', 'at', 'begin', 'body', 'case', 'constant',
+ 'declare', 'delay', 'delta', 'digits', 'do', 'else',
+ 'elsif', 'end', 'entry', 'exception', 'exit', 'for',
+ 'function', 'generic', 'goto', 'if', 'in', 'is',
+ 'limited', 'loop', 'mod', 'new', 'not', 'null', 'of',
+ 'or', 'others', 'out', 'package', 'pragma', 'private',
+ 'procedure', 'raise', 'range', 'record', 'rem',
+ 'renames', 'return', 'reverse', 'select', 'separate',
+ 'subtype', 'task', 'terminate', 'then', 'type',
+ 'until', 'use', 'when', 'while', 'with', 'xor');
+local (@Ada95_keywords) = ('abstract', 'aliased', 'protected', 'requeue',
+ 'tagged');
+
+local (%keywords) = ();
+grep (++ $keywords{$_}, @Ada_keywords);
+grep (++ $keywords{$_}, @Ada95_keywords) unless ($ada83_mode);
+
+### Symbols declarations for the current file
+### format is (line_column => 1, ...)
+local (%symbols);
+
+### Symbols usage for the current file
+### format is ($adafile#$line_$column => $htmlfile#$linedecl_$columndecl, ...)
+local (%symbols_used);
+
+### the global index of all symbols
+### format is ($name => [[file, line, column], [file, line, column], ...])
+local (%global_index);
+
+#########
+## This function create the header of every html file.
+## These header is returned as a string
+## Params: - Name of the Ada file associated with this html file
+#########
+sub create_header
+{
+ local ($adafile) = shift;
+ local ($string) = "<HEAD><TITLE>$adafile</TITLE></HEAD>
+<BODY>\n";
+
+ if ($adafile ne "")
+ {
+ $string .= "<HR><DIV ALIGN=\"center\"><H1> File : $adafile "
+ . "</H1></DIV><HR>\n<PRE>";
+ }
+ return $string;
+}
+
+#########
+## Protect a string (or character) from the Html parser
+## Params: - the string to protect
+## Out: - the protected string
+#########
+sub protect_string
+{
+ local ($string) = shift;
+ $string =~ s/&/&amp;/g;
+ $string =~ s/</&lt;/g;
+ $string =~ s/>/&gt;/g;
+ return $string;
+}
+
+#########
+## This function creates the footer of the html file
+## The footer is returned as a string
+## Params : - Name of the Ada file associated with this html file
+#########
+sub create_footer
+{
+ local ($adafile) = shift;
+ local ($string) = "";
+ $string = "</PRE>" if ($adafile ne "");
+ return $string . "</BODY></HTML>\n";
+}
+
+#########
+## This function creates the string to use for comment output
+## Params : - the comment itself
+#########
+sub output_comment
+{
+ local ($comment) = &protect_string (shift);
+ return "<FONT COLOR=$comment_color><EM>--$comment</EM></FONT>";
+}
+
+########
+## This function creates the string to use for symbols output
+## Params : - the symbol to output
+## - the current line
+## - the current column
+########
+sub output_symbol
+{
+ local ($symbol) = &protect_string (shift);
+ local ($lineno) = shift;
+ local ($column) = shift;
+ return "<FONT COLOR=$symbol_color><A NAME=\"$lineno\_$column\">$symbol</A></FONT>";
+}
+
+########
+## This function creates the string to use for keyword output
+## Params : - the keyword to output
+########
+sub output_keyword
+{
+ local ($keyw) = shift;
+ return "<b>$keyw</b>";
+}
+
+########
+## This function outputs a line number
+## Params : - the line number to generate
+########
+sub output_line_number
+{
+ local ($no) = shift;
+ if ($no != -1)
+ {
+ return "<EM><FONT SIZE=-1>" . sprintf ("%4d ", $no) . "</FONT></EM>";
+ }
+ else
+ {
+ return "<FONT SIZE=-1> </FONT>";
+ }
+}
+
+########
+## Converts a character into the corresponding Ada type
+## This is based on the ali format (see lib-xref.adb) in the GNAT sources
+## Note: 'f' or 'K' should be returned in case a link from the body to the
+## spec needs to be generated.
+## Params : - the character to convert
+########
+sub to_type
+{
+ local ($char) = shift;
+ $char =~ tr/a-z/A-Z/;
+
+ return 'array' if ($char eq 'A');
+ return 'boolean' if ($char eq 'B');
+ return 'class' if ($char eq 'C');
+ return 'decimal' if ($char eq 'D');
+ return 'enumeration' if ($char eq 'E');
+ return 'floating point' if ($char eq 'F');
+ return 'signed integer' if ($char eq 'I');
+ # return 'generic package' if ($char eq 'K');
+ return 'block' if ($char eq 'L');
+ return 'modular integer' if ($char eq 'M');
+ return 'enumeration litteral' if ($char eq 'N');
+ return 'ordinary fixed point' if ($char eq 'O');
+ return 'access' if ($char eq 'P');
+ return 'label' if ($char eq 'Q');
+ return 'record' if ($char eq 'R');
+ return 'string' if ($char eq 'S');
+ return 'task' if ($char eq 'T');
+ return 'f' if ($char eq 'U');
+ return 'f' if ($char eq 'V');
+ return 'exception' if ($char eq 'X');
+ return 'entry' if ($char eq 'Y');
+ return "$char";
+}
+
+########
+## Changes a file name to be http compatible
+########
+sub http_string
+{
+ local ($str) = shift;
+ $str =~ s/\//__/g;
+ $str =~ s/\\/__/g;
+ $str =~ s/:/__/g;
+ $str =~ s/\./__/g;
+ return $str;
+}
+
+########
+## Creates the complete file-name, with directory
+## use the variables read in the .prj file
+## Params : - file name
+## RETURNS : the relative path_name to the file
+########
+sub get_real_file_name
+{
+ local ($filename) = shift;
+ local ($path) = $filename;
+
+ foreach (@src_dir)
+ {
+ if ( -r "$_$filename")
+ {
+ $path = "$_$filename";
+ last;
+ }
+ }
+
+ $path =~ s/^\.\///;
+ return $path if (substr ($path, 0, 1) ne '/');
+
+ ## We want to return relative paths only, so that the name of the HTML files
+ ## can easily be generated
+ local ($pwd) = `pwd`;
+ chop ($pwd);
+ local (@pwd) = split (/\//, $pwd);
+ local (@path) = split (/\//, $path);
+
+ while (@pwd)
+ {
+ if ($pwd [0] ne $path [0])
+ {
+ return '../' x ($#pwd + 1) . join ("/", @path);
+ }
+ shift @pwd;
+ shift @path;
+ }
+ return join ('/', @path);
+}
+
+########
+## Reads and parses .adp files
+## Params : - adp file name
+########
+sub parse_prj_file
+{
+ local ($filename) = shift;
+ local (@src) = ();
+ local (@obj) = ();
+
+ print "Parsing project file : $filename\n";
+
+ open (PRJ, $filename) || do { print " ... sorry, file not found\n";
+ return;
+ };
+ while (<PRJ>)
+ {
+ chop;
+ s/\/$//;
+ push (@src, $1 . "/") if (/^src_dir=(.*)/);
+ push (@obj, $1 . "/") if (/^obj_dir=(.*)/);
+ }
+ unshift (@src_dir, @src);
+ unshift (@obj_dir, @obj);
+ close (PRJ);
+}
+
+########
+## Finds a file in the search path
+## Params : - the name of the file
+## RETURNS : - the directory/file_name
+########
+sub find_file
+{
+ local ($filename) = shift;
+
+ foreach (@search_dir) {
+ if (-f "$_/$filename") {
+ return "$_/$filename";
+ }
+ }
+ return $filename;
+}
+
+########
+## Inserts a new reference in the list of references
+## Params: - Ref as it appears in the .ali file ($line$type$column)
+## - Current file for the reference
+## - Current offset to be added from the line (handling of
+## pragma Source_Reference)
+## - Current entity reference
+## Modifies: - %symbols_used
+########
+sub create_new_reference
+{
+ local ($ref) = shift;
+ local ($lastfile) = shift;
+ local ($offset) = shift;
+ local ($currentref) = shift;
+ local ($refline, $type, $refcol);
+
+ ## Do not generate references to the standard library files if we
+ ## do not generate the corresponding html files
+ return if (! $standard_library && $lastfile =~ /$standard_file_regexp/);
+
+ ($refline, $type, $extern, $refcol) = /(\d+)(.)(<[^>]+>)?(\d+)/;
+ $refline += $offset;
+
+ ## If we have a body, then we only generate the cross-reference from
+ ## the spec to the body if we have a subprogram (or a package)
+
+
+ if ($type eq "b")
+# && ($symbols {$currentref} eq 'f' || $symbols {$currentref} eq 'K'))
+ {
+ local ($cref_file, $cref) = ($currentref =~ /([^\#]+).$fileext\#(.+)/);
+
+ $symbols_used {"$cref_file#$cref"} = "$lastfile.$fileext#$refline\_$refcol";
+ $symbols_used {"$lastfile#$refline\_$refcol"} = $currentref;
+ $symbols {"$lastfile.$fileext#$refline\_$refcol"} = "body";
+ }
+
+ ## Do not generate cross-references for "e" and "t", since these point to the
+ ## semicolon that terminates the block -- irrelevant for gnathtml
+ ## "p" is also removed, since it is used for primitive subprograms
+ ## "d" is also removed, since it is used for discriminants
+ ## "i" is removed since it is used for implicit references
+ ## "z" is used for generic formals
+ ## "k" is for references to parent package
+ ## "=", "<", ">", "^" is for subprogram parameters
+
+ elsif ($type !~ /[eztpid=<>^k]/)
+ {
+ $symbols_used {"$lastfile#$refline\_$refcol"} = $currentref;
+ }
+}
+
+########
+## Parses the ali file associated with the current Ada file
+## Params : - the complete ali file name
+########
+sub parse_ali
+{
+ local ($filename) = shift;
+ local ($currentfile);
+ local ($currentref);
+ local ($lastfile);
+
+ # A file | line type column reference
+ local ($reference) = "(?:(?:\\d+\\|)?\\d+.\\d+|\\w+)";
+
+ # The following variable is used to represent the possible xref information
+ # output by GNAT when -gnatdM is used. It includes renaming references, and
+ # references to the parent type, as well as references to the generic parent
+
+ local ($typeref) = "(?:=$reference|<$reference>|\\{$reference\\}|\\($reference\\)|\\[$reference\\])?";
+
+ # The beginning of an entity declaration line in the ALI file
+ local ($decl_line) = "^(\\d+)(.)(\\d+)[ *]([\\w\\d.-]+|\"..?\")$typeref\\s+(\\S.*)?\$";
+
+ # Contains entries of the form [ filename source_reference_offset]
+ # Offset needs to be added to the lines read in the cross-references, and are
+ # used when the source comes from a gnatchop-ed file. See lib-write.ads, lines
+ # with ^D in the ALI file.
+ local (@reffiles) = ();
+
+ open (ALI, &find_file ($filename)) || do {
+ print "no ", &find_file ($filename), " file...\n";
+ return;
+ };
+ local (@ali) = <ALI>;
+ close (ALI);
+
+ undef %symbols;
+ undef %symbols_used;
+
+ foreach (@ali)
+ {
+ ## The format of D lines is
+ ## D source-name time-stamp checksum [subunit-name] line:file-name
+
+ if (/^D\s+([\w\d.-]+)\s+\S+ \S+(\s+\D[^: ]+)?( (\d+):(.*))?/)
+ {
+ # The offset will be added to each cross-reference line. If it is
+ # greater than 1, this means that we have a pragma Source_Reference,
+ # and this must not be counted in the xref information.
+ my ($file, $offset) = ($1, (defined $4) ? 2 - $4 : 0);
+
+ if ($dependencies)
+ {
+ push (@list_files, $1) unless (grep (/$file/, @list_files));
+ }
+ push (@reffiles, [&http_string (&get_real_file_name ($file)), $offset]);
+ }
+
+ elsif (/^X\s+(\d+)/)
+ {
+ $currentfile = $lastfile = $1 - 1;
+ }
+
+ elsif (defined $currentfile && /$decl_line/)
+ {
+ my ($line) = $1 + $reffiles[$currentfile][1];
+ next if (! $standard_library
+ && $reffiles[$currentfile][0] =~ /$standard_file_regexp/);
+ if ($xref_variable || $2 eq &uppercases ($2))
+ {
+ $currentref = $reffiles[$currentfile][0] . ".$fileext#$line\_$3";
+ $symbols {$currentref} = &to_type ($2);
+ $lastfile = $currentfile;
+
+ local ($endofline) = $5;
+
+ foreach (split (" ", $endofline))
+ {
+ (s/^(\d+)\|//) && do { $lastfile = $1 - 1; };
+ &create_new_reference
+ ($_, $reffiles[$lastfile][0],
+ $reffiles[$lastfile][1], $currentref);
+ }
+ }
+ else
+ {
+ $currentref = "";
+ }
+ }
+ elsif (/^\.\s(.*)/ && $reffiles[$currentfile][0] ne "" && $currentref ne "")
+ {
+ next if (! $standard_library
+ && $reffiles[$currentfile][0] =~ /$standard_file_regexp/);
+ foreach (split (" ", $1))
+ {
+ (s/^(\d+)\|//) && do { $lastfile = $1 - 1; };
+ &create_new_reference
+ ($_, $reffiles[$lastfile][0], $reffiles[$lastfile][1],
+ $currentref);
+ }
+ }
+ }
+}
+
+#########
+## Return the name of the ALI file to use for a given source
+## Params: - Name of the source file
+## return: Name and location of the ALI file
+#########
+
+sub ali_file_name {
+ local ($source) = shift;
+ local ($alifilename, $unitname);
+ local ($in_separate) = 0;
+
+ $source =~ s/\.ad[sb]$//;
+ $alifilename = $source;
+ $unitname = $alifilename;
+ $unitname =~ s/-/./g;
+
+ ## There are two reasons why we might not find the ALI file: either the
+ ## user did not generate them at all, or we are working on a separate unit.
+ ## Thus, we search in the parent's ALI file.
+
+ while ($alifilename ne "") {
+
+ ## Search in the object path
+ foreach (@obj_dir) {
+
+ ## Check if the ALI file does apply to the source file
+ ## We check the ^D lines, which have the following format:
+ ## D source-name time-stamp checksum [subunit-name] line:file-name
+
+ if (-r "$_$alifilename.ali") {
+ if ($in_separate) {
+ open (FILE, "$_$alifilename.ali");
+
+ if (grep (/^D \S+\s+\S+\s+\S+ $unitname/, <FILE>)) {
+ close FILE;
+ return "$_$alifilename.ali";
+
+ } else {
+ ## If the ALI file doesn't apply to the source file, we can
+ ## return now, since there won't be a parent ALI file above
+ ## anyway
+ close FILE;
+ return "$source.ali";
+ }
+ } else {
+ return "$_$alifilename.ali";
+ }
+ }
+ }
+
+ ## Get the parent's ALI file name
+
+ if (! ($alifilename =~ s/-[^-]+$//)) {
+ $alifilename = "";
+ }
+ $in_separate = 1;
+ }
+
+ return "$source.ali";
+}
+
+#########
+## Convert a path to an absolute path
+#########
+
+sub to_absolute
+{
+ local ($path) = shift;
+ local ($name, $suffix, $separator);
+ ($name,$path,$suffix) = fileparse ($path, ());
+ $path = &abs_path ($path);
+ $separator = substr ($path, 0, 1);
+ return $path . $separator . $name;
+}
+
+#########
+## This function outputs the html version of the file FILE
+## The output is send to FILE.htm.
+## Params : - Name of the file to convert (ends with .ads or .adb)
+#########
+sub output_file
+{
+ local ($filename_param) = shift;
+ local ($lineno) = 1;
+ local ($column);
+ local ($found);
+
+ local ($alifilename) = &ali_file_name ($filename_param);
+
+ $filename = &get_real_file_name ($filename_param);
+ $found = &find_file ($filename);
+
+ ## Read the whole file
+ open (FILE, $found) || do {
+ print $found, " not found ... skipping.\n";
+ return 0;
+ };
+ local (@file) = <FILE>;
+ close (FILE);
+
+ ## Parse the .ali file to find the cross-references
+ print "converting ", $filename, "\n";
+ &parse_ali ($alifilename);
+
+ ## Create and initialize the html file
+ open (OUTPUT, ">$output_dir/" . &http_string ($filename) . ".$fileext")
+ || die "Couldn't write $output_dir/" . &http_string ($filename)
+ . ".$fileext\n";
+
+ if ($absolute) {
+ print OUTPUT &create_header (&to_absolute ($found)), "\n";
+ } else {
+ print OUTPUT &create_header ($filename_param), "\n";
+ }
+
+ ## Print the file
+ $filename = &http_string ($filename);
+ foreach (@file)
+ {
+ local ($index);
+ local ($line) = $_;
+ local ($comment);
+
+ $column = 1;
+ chop ($line);
+
+ ## Print either the line number or a space if required
+ if ($line_numbers)
+ {
+ if ($lineno % $line_numbers == 0)
+ {
+ print OUTPUT &output_line_number ($lineno);
+ }
+ else
+ {
+ print OUTPUT &output_line_number (-1);
+ }
+ }
+
+ ## First, isolate any comment on the line
+ undef $comment;
+ $index = index ($line, '--');
+ if ($index != -1) {
+ $comment = substr ($line, $index + 2);
+ if ($index > 1)
+ {
+ $line = substr ($line, 0, $index);
+ }
+ else
+ {
+ undef $line;
+ }
+ }
+
+ ## Then print the line
+ if (defined $line)
+ {
+ $index = 0;
+ while ($index < length ($line))
+ {
+ local ($substring) = substr ($line, $index);
+
+ if ($substring =~ /^\t/)
+ {
+ print OUTPUT ' ' x ($tab_size - (($column - 1) % $tab_size));
+ $column += $tab_size - (($column - 1) % $tab_size);
+ $index ++;
+ }
+ elsif ($substring =~ /^(\w+)/
+ || $substring =~ /^("[^\"]*")/
+ || $substring =~ /^(\W)/)
+ {
+ local ($word) = $1;
+ $index += length ($word);
+
+ local ($lowercase) = $word;
+ $lowercase =~ tr/A-Z/a-z/;
+
+ if ($keywords{$lowercase})
+ {
+ print OUTPUT &output_keyword ($word);
+ }
+ elsif ($symbols {"$filename.$fileext#$lineno\_$column"})
+ {
+ ## A symbol can both have a link and be a reference for
+ ## another link, as is the case for bodies and
+ ## declarations
+
+ if ($symbols_used{"$filename#$lineno\_$column"})
+ {
+ print OUTPUT "<A HREF=\"",
+ $symbols_used{"$filename#$lineno\_$column"},
+ "\">", &protect_string ($word), "</A>";
+ print OUTPUT &output_symbol ('', $lineno, $column);
+ }
+ else
+ {
+ print OUTPUT &output_symbol ($word, $lineno, $column);
+ }
+
+ ## insert only functions into the global index
+
+ if ($symbols {"$filename.$fileext#$lineno\_$column"} eq 'f')
+ {
+ push (@{$global_index {$word}},
+ [$filename_param, $filename, $lineno, $column]);
+ }
+ }
+ elsif ($symbols_used{"$filename#$lineno\_$column"})
+ {
+ print OUTPUT "<A HREF=\"",
+ $symbols_used{"$filename#$lineno\_$column"},
+ "\">", &protect_string ($word), "</A>";
+ }
+ else
+ {
+ print OUTPUT &protect_string ($word);
+ }
+ $column += length ($word);
+ }
+ else
+ {
+ $index ++;
+ $column ++;
+ print OUTPUT &protect_string (substr ($substring, 0, 1));
+ }
+ }
+ }
+
+ ## Then output the comment
+ print OUTPUT &output_comment ($comment) if (defined $comment);
+ print OUTPUT "\n";
+
+ $lineno ++;
+ }
+
+ print OUTPUT &create_footer ($filename);
+ close (OUTPUT);
+ return 1;
+}
+
+#########
+## This function generates the global index
+#########
+sub create_index_file
+{
+ open (INDEX, ">$output_dir/index.$fileext") || die "couldn't write $output_dir/index.$fileext";
+
+ print INDEX <<"EOF";
+<HTML>
+<HEAD><TITLE>Source Browser</TITLE></HEAD>
+<FRAMESET COLS='250,*'>
+<NOFRAME>
+EOF
+ ;
+
+ local (@files) = &create_file_index;
+ print INDEX join ("\n", @files), "\n";
+
+ print INDEX "<HR>\n";
+ local (@functions) = &create_function_index;
+ print INDEX join ("\n", @functions), "\n";
+
+ print INDEX <<"EOF";
+</NOFRAME>
+<FRAMESET ROWS='50%,50%'>
+<FRAME NAME=files SRC=files.$fileext>
+<FRAME NAME=funcs SRC=funcs.$fileext>
+</FRAMESET>
+<FRAME NAME=main SRC=main.$fileext>
+</FRAMESET>
+</HTML>
+EOF
+ ;
+ close (INDEX);
+
+ open (MAIN, ">$output_dir/main.$fileext") || die "couldn't write $output_dir/main.$fileext";
+ print MAIN &create_header (""),
+ "<P ALIGN=right>",
+ "<A HREF=main.$fileext TARGET=_top>[No frame version is here]</A>",
+ "<P>",
+ join ("\n", @files), "\n<HR>",
+ join ("\n", @functions), "\n";
+
+ if ($dependencies) {
+ print MAIN "<HR>\n";
+ print MAIN "You should start your browsing with one of these files:\n";
+ print MAIN "<UL>\n";
+ foreach (@original_list) {
+ print MAIN "<LI><A HREF=", &http_string (&get_real_file_name ($_)),
+ ".$fileext>$_</A>\n";
+ }
+ }
+ print MAIN &create_footer ("");
+ close (MAIN);
+}
+
+#######
+## Convert to upper cases (did not exist in Perl 4)
+#######
+
+sub uppercases {
+ local ($tmp) = shift;
+ $tmp =~ tr/a-z/A-Z/;
+ return $tmp;
+}
+
+#######
+## This function generates the file_index
+## RETURN : - table with the html lines to be printed
+#######
+sub create_file_index
+{
+ local (@output) = ("<H2 ALIGN=CENTER>Files</H2>");
+
+
+ open (FILES, ">$output_dir/files.$fileext") || die "couldn't write $output_dir/files.$fileext";
+ print FILES &create_header (""), join ("\n", @output), "\n";
+
+
+ if ($#list_files > 20)
+ {
+ local ($last_letter) = '';
+ foreach (sort {&uppercases ($a) cmp &uppercases ($b)} @list_files)
+ {
+ next if ($_ eq "");
+ if (&uppercases (substr ($_, 0, 1)) ne $last_letter)
+ {
+ if ($last_letter ne '')
+ {
+ print INDEX_FILE "</UL></BODY></HTML>\n";
+ close (INDEX_FILE);
+ }
+ $last_letter = &uppercases (substr ($_, 0, 1));
+ open (INDEX_FILE, ">$output_dir/files/$last_letter.$fileext")
+ || die "couldn't write $output_dir/files/$last_letter.$fileext";
+ print INDEX_FILE <<"EOF";
+<HTML><HEAD><TITLE>$last_letter</TITLE></HEAD>
+<BODY>
+<H2>Files - $last_letter</H2>
+<A HREF=../files.$fileext TARGET=_self>[index]</A>
+<UL COMPACT TYPE=DISC>
+EOF
+ ;
+ local ($str) = "<A HREF=files/$last_letter.$fileext>[$last_letter]</A>";
+ push (@output, $str);
+ print FILES "$str\n";
+ }
+ print INDEX_FILE "<LI><A HREF=../",
+ &http_string (&get_real_file_name ($_)),
+ ".$fileext TARGET=main>$_</A>\n"; ## Problem with TARGET when in no_frame mode!
+ }
+
+ print INDEX_FILE "</UL></BODY></HTML>\n";
+ close INDEX_FILE;
+ }
+ else
+ {
+ push (@output, "<UL COMPACT TYPE=DISC>");
+ print FILES "<UL COMPACT TYPE=DISC>";
+ foreach (sort {&uppercases ($a) cmp &uppercases ($b)} @list_files)
+ {
+ next if ($_ eq "");
+ local ($ref) = &http_string (&get_real_file_name ($_));
+ push (@output, "<LI><A HREF=$ref.$fileext>$_</A>");
+ print FILES "<LI><A HREF=$ref.$fileext TARGET=main>$_</A>\n";
+ }
+ }
+
+ print FILES &create_footer ("");
+ close (FILES);
+
+ push (@output, "</UL>");
+ return @output;
+}
+
+#######
+## This function generates the function_index
+## RETURN : - table with the html lines to be printed
+#######
+sub create_function_index
+{
+ local (@output) = ("<H2 ALIGN=CENTER>Functions/Procedures</H2>");
+ local ($initial) = "";
+
+ open (FUNCS, ">$output_dir/funcs.$fileext") || die "couldn't write $output_dir/funcs.$fileext";
+ print FUNCS &create_header (""), join ("\n", @output), "\n";
+
+ ## If there are more than 20 entries, we just want to create some
+ ## submenus
+ if (scalar (keys %global_index) > 20)
+ {
+ local ($last_letter) = '';
+ foreach (sort {&uppercases ($a) cmp &uppercases ($b)} keys %global_index)
+ {
+ if (&uppercases (substr ($_, 0, 1)) ne $last_letter)
+ {
+ if ($last_letter ne '')
+ {
+ print INDEX_FILE "</UL></BODY></HTML>\n";
+ close (INDEX_FILE);
+ }
+
+ $last_letter = &uppercases (substr ($_, 0, 1));
+ $initial = $last_letter;
+ if ($initial eq '"')
+ {
+ $initial = "operators";
+ }
+ if ($initial ne '.')
+ {
+ open (INDEX_FILE, ">$output_dir/funcs/$initial.$fileext")
+ || die "couldn't write $output_dir/funcs/$initial.$fileext";
+ print INDEX_FILE <<"EOF";
+<HTML><HEAD><TITLE>$initial</TITLE></HEAD>
+<BODY>
+<H2>Functions - $initial</H2>
+<A HREF=../funcs.$fileext TARGET=_self>[index]</A>
+<UL COMPACT TYPE=DISC>
+EOF
+ ;
+ local ($str) = "<A HREF=funcs/$initial.$fileext>[$initial]</A>";
+ push (@output, $str);
+ print FUNCS "$str\n";
+ }
+ }
+ local ($ref);
+ local ($is_overloaded) = ($#{$global_index {$_}} > 0 ? 1 : 0);
+ foreach $ref (@{$global_index {$_}})
+ {
+ ($file, $full_file, $lineno, $column) = @{$ref};
+ local ($symbol) = ($is_overloaded ? "$_ - $file:$lineno" : $_);
+ print INDEX_FILE "<LI><A HREF=../$full_file.$fileext#$lineno\_$column TARGET=main>$symbol</A>";
+ }
+ }
+
+ print INDEX_FILE "</UL></BODY></HTML>\n";
+ close INDEX_FILE;
+ }
+ else
+ {
+ push (@output, "<UL COMPACT TYPE=DISC>");
+ print FUNCS "<UL COMPACT TYPE=DISC>";
+ foreach (sort {&uppercases ($a) cmp &uppercases ($b)} keys %global_index)
+ {
+ local ($ref);
+ local ($is_overloaded) = ($#{$global_index {$_}} > 0 ? 1 : 0);
+ foreach $ref (@{$global_index {$_}})
+ {
+ ($file, $full_file, $lineno, $column) = @{$ref};
+ local ($symbol) = ($is_overloaded ? "$_ - $file:$lineno" : $_);
+ push (@output, "<LI><A HREF=$full_file.$fileext#$lineno\_$column>$symbol</A>");
+ print FUNCS "<LI><A HREF=$full_file.$fileext#$lineno\_$column TARGET=main>$symbol</A>";
+ }
+ }
+ }
+
+ print FUNCS &create_footer ("");
+ close (FUNCS);
+
+ push (@output, "</UL>");
+ return (@output);
+}
+
+######
+## Main function
+######
+
+local ($index_file) = 0;
+
+mkdir ($output_dir, 0777) if (! -d $output_dir);
+mkdir ($output_dir."/files", 0777) if (! -d $output_dir."/files");
+mkdir ($output_dir."/funcs", 0777) if (! -d $output_dir."/funcs");
+
+&parse_prj_file ($prjfile) if ($prjfile);
+
+while ($index_file <= $#list_files)
+{
+ local ($file) = $list_files [$index_file];
+
+ if (&output_file ($file) == 0)
+ {
+ $list_files [$index_file] = "";
+ }
+ $index_file ++;
+}
+&create_index_file;
+
+$indexfile = "$output_dir/index.$fileext";
+$indexfile =~ s!//!/!g;
+print "You can now download the $indexfile file to see the ",
+ "created pages\n";
diff --git a/gcc/ada/gnatlink.adb b/gcc/ada/gnatlink.adb
index 99898223cf2..4da260d67d1 100644
--- a/gcc/ada/gnatlink.adb
+++ b/gcc/ada/gnatlink.adb
@@ -1484,25 +1484,11 @@ begin
Exit_Program (E_Fatal);
end if;
- -- Get target parameters
+ -- Initialize packages to be used
Namet.Initialize;
Csets.Initialize;
Snames.Initialize;
- Osint.Add_Default_Search_Dirs;
- Targparm.Get_Target_Parameters;
-
- if VM_Target /= No_VM then
- case VM_Target is
- when JVM_Target => Gcc := new String'("jgnat");
- when CLI_Target => Gcc := new String'("dotnet-gnatcompile");
- when No_VM => raise Program_Error;
- end case;
-
- Ada_Bind_File := True;
- Begin_Info := "-- BEGIN Object file/option list";
- End_Info := "-- END Object file/option list ";
- end if;
-- We always compile with -c
@@ -1510,50 +1496,6 @@ begin
Binder_Options_From_ALI.Table (Binder_Options_From_ALI.Last) :=
new String'("-c");
- -- If the main program is in Ada it is compiled with the following
- -- switches:
-
- -- -gnatA stops reading gnat.adc, since we don't know what
- -- pragmas would work, and we do not need it anyway.
-
- -- -gnatWb allows brackets coding for wide characters
-
- -- -gnatiw allows wide characters in identifiers. This is needed
- -- because bindgen uses brackets encoding for all upper
- -- half and wide characters in identifier names.
-
- if Ada_Bind_File then
- Binder_Options_From_ALI.Increment_Last;
- Binder_Options_From_ALI.Table (Binder_Options_From_ALI.Last) :=
- new String'("-gnatA");
- Binder_Options_From_ALI.Increment_Last;
- Binder_Options_From_ALI.Table (Binder_Options_From_ALI.Last) :=
- new String'("-gnatWb");
- Binder_Options_From_ALI.Increment_Last;
- Binder_Options_From_ALI.Table (Binder_Options_From_ALI.Last) :=
- new String'("-gnatiw");
- end if;
-
- -- Locate all the necessary programs and verify required files are present
-
- Gcc_Path := System.OS_Lib.Locate_Exec_On_Path (Gcc.all);
-
- if Gcc_Path = null then
- Exit_With_Error ("Couldn't locate " & Gcc.all);
- end if;
-
- if Linker_Path = null then
- if VM_Target = CLI_Target then
- Linker_Path := System.OS_Lib.Locate_Exec_On_Path ("ilasm");
-
- if Linker_Path = null then
- Exit_With_Error ("Couldn't locate ilasm");
- end if;
- else
- Linker_Path := Gcc_Path;
- end if;
- end if;
-
if Ali_File_Name = null then
Exit_With_Error ("no ali file given for link");
end if;
@@ -1624,6 +1566,18 @@ begin
:= String_Access (Arg);
end if;
+ -- Set the RTS_*_Path_Name variables, so that the
+ -- correct directories will be set when
+ -- Osint.Add_Default_Search_Dirs will be called later.
+
+ Opt.RTS_Src_Path_Name :=
+ Get_RTS_Search_Dir
+ (Arg (Arg'First + 6 .. Arg'Last), Include);
+
+ Opt.RTS_Lib_Path_Name :=
+ Get_RTS_Search_Dir
+ (Arg (Arg'First + 6 .. Arg'Last), Objects);
+
-- GNAT doesn't support the GCC multilib mechanism.
-- This means that, when a multilib switch is used
-- to request a particular compilation mode, the
@@ -1635,8 +1589,7 @@ begin
-- Pass -mrtp to the linker if --RTS=rtp was passed
- if Linker_Path = Gcc_Path
- and then Arg'Length > 8
+ if Arg'Length > 8
and then Arg (Arg'First + 6 .. Arg'First + 8) = "rtp"
then
Linker_Options.Increment_Last;
@@ -1645,8 +1598,7 @@ begin
-- Pass -fsjlj to the linker if --RTS=sjlj was passed
- elsif Linker_Path = Gcc_Path
- and then Arg'Length > 9
+ elsif Arg'Length > 9
and then Arg (Arg'First + 6 .. Arg'First + 9) = "sjlj"
then
Linker_Options.Increment_Last;
@@ -1660,6 +1612,78 @@ begin
end;
end if;
+ -- Get target parameters
+
+ Osint.Add_Default_Search_Dirs;
+ Targparm.Get_Target_Parameters;
+
+ if VM_Target /= No_VM then
+ case VM_Target is
+ when JVM_Target => Gcc := new String'("jgnat");
+ when CLI_Target => Gcc := new String'("dotnet-gnatcompile");
+ when No_VM => raise Program_Error;
+ end case;
+
+ Ada_Bind_File := True;
+ Begin_Info := "-- BEGIN Object file/option list";
+ End_Info := "-- END Object file/option list ";
+ end if;
+
+ -- If the main program is in Ada it is compiled with the following
+ -- switches:
+
+ -- -gnatA stops reading gnat.adc, since we don't know what
+ -- pragmas would work, and we do not need it anyway.
+
+ -- -gnatWb allows brackets coding for wide characters
+
+ -- -gnatiw allows wide characters in identifiers. This is needed
+ -- because bindgen uses brackets encoding for all upper
+ -- half and wide characters in identifier names.
+
+ if Ada_Bind_File then
+ Binder_Options_From_ALI.Increment_Last;
+ Binder_Options_From_ALI.Table (Binder_Options_From_ALI.Last) :=
+ new String'("-gnatA");
+ Binder_Options_From_ALI.Increment_Last;
+ Binder_Options_From_ALI.Table (Binder_Options_From_ALI.Last) :=
+ new String'("-gnatWb");
+ Binder_Options_From_ALI.Increment_Last;
+ Binder_Options_From_ALI.Table (Binder_Options_From_ALI.Last) :=
+ new String'("-gnatiw");
+ end if;
+
+ -- Locate all the necessary programs and verify required files are present
+
+ Gcc_Path := System.OS_Lib.Locate_Exec_On_Path (Gcc.all);
+
+ if Gcc_Path = null then
+ Exit_With_Error ("Couldn't locate " & Gcc.all);
+ end if;
+
+ if Linker_Path = null then
+ if VM_Target = CLI_Target then
+ Linker_Path := System.OS_Lib.Locate_Exec_On_Path ("ilasm");
+
+ if Linker_Path = null then
+ Exit_With_Error ("Couldn't locate ilasm");
+ end if;
+
+ elsif RTX_RTSS_Kernel_Module_On_Target then
+
+ -- Use Microsoft linker for RTSS modules
+
+ Linker_Path := System.OS_Lib.Locate_Exec_On_Path ("link");
+
+ if Linker_Path = null then
+ Exit_With_Error ("Couldn't locate link");
+ end if;
+
+ else
+ Linker_Path := Gcc_Path;
+ end if;
+ end if;
+
Write_Header;
-- If no output name specified, then use the base name of .ali file name
@@ -1680,6 +1704,11 @@ begin
Linker_Options.Table (Linker_Options.Last) :=
new String'("/OUTPUT=" & Output_File_Name.all);
+ elsif RTX_RTSS_Kernel_Module_On_Target then
+ Linker_Options.Increment_Last;
+ Linker_Options.Table (Linker_Options.Last) :=
+ new String'("/OUT:" & Output_File_Name.all);
+
else
Linker_Options.Increment_Last;
Linker_Options.Table (Linker_Options.Last) := new String'("-o");
@@ -1869,6 +1898,120 @@ begin
Num_Args := Num_Args - 1;
end if;
end loop;
+
+ elsif RTX_RTSS_Kernel_Module_On_Target then
+
+ -- Remove flags not relevant for Microsoft linker and adapt some
+ -- others.
+
+ for J in reverse Linker_Options.First .. Linker_Options.Last loop
+
+ -- Remove flags that are not accepted
+ if Linker_Options.Table (J)'Length = 0
+ or else Linker_Options.Table (J) (1 .. 2) = "-l"
+ or else Linker_Options.Table (J) (1 .. 3) = "-Wl"
+ or else Linker_Options.Table (J) (1 .. 3) = "-sh"
+ or else Linker_Options.Table (J) (1 .. 8) = "-Xlinker"
+ or else Linker_Options.Table (J) (1 .. 9) = "-mthreads"
+ then
+ Linker_Options.Table (J .. Linker_Options.Last - 1) :=
+ Linker_Options.Table (J + 1 .. Linker_Options.Last);
+ Linker_Options.Decrement_Last;
+ Num_Args := Num_Args - 1;
+
+ -- Replace "-L" by its counterpart "/LIBPATH:" and UNIX "/" by
+ -- Windows "\".
+ elsif Linker_Options.Table (J) (1 .. 2) = "-L" then
+ declare
+ Libpath_Option : constant String_Access := new String'
+ ("/LIBPATH:" &
+ Linker_Options.Table (J)
+ (3 .. Linker_Options.Table (J).all'Last));
+ begin
+ for Index in 10 .. Libpath_Option'Last loop
+ if Libpath_Option (Index) = '/' then
+ Libpath_Option (Index) := '\';
+ end if;
+ end loop;
+
+ Linker_Options.Table (J) := Libpath_Option;
+ end;
+
+ -- Replace "-g" by "/DEBUG"
+ elsif Linker_Options.Table (J) (1 .. 2) = "-g" then
+ Linker_Options.Table (J) := new String'("/DEBUG");
+
+ -- Replace "-o" by "/OUT:"
+ elsif Linker_Options.Table (J) (1 .. 2) = "-o" then
+ Linker_Options.Table (J + 1) := new String'
+ ("/OUT:" & Linker_Options.Table (J + 1).all);
+
+ Linker_Options.Table (J .. Linker_Options.Last - 1) :=
+ Linker_Options.Table (J + 1 .. Linker_Options.Last);
+ Linker_Options.Decrement_Last;
+ Num_Args := Num_Args - 1;
+
+ -- Replace "--stack=" by "/STACK:"
+ elsif Linker_Options.Table (J) (1 .. 8) = "--stack=" then
+ Linker_Options.Table (J) := new String'
+ ("/STACK:" &
+ Linker_Options.Table (J)
+ (9 .. Linker_Options.Table (J).all'Last));
+
+ -- Replace "-v" by its counterpart "/VERBOSE"
+ elsif Linker_Options.Table (J) (1 .. 2) = "-v" then
+ Linker_Options.Table (J) := new String'("/VERBOSE");
+ end if;
+ end loop;
+
+ -- Add some required flags to create RTSS modules
+
+ declare
+ Flags_For_Linker : constant array (1 .. 17) of String_Access :=
+ (new String'("/NODEFAULTLIB"),
+ new String'("/INCREMENTAL:NO"),
+ new String'("/NOLOGO"),
+ new String'("/DRIVER"),
+ new String'("/ALIGN:0x20"),
+ new String'("/SUBSYSTEM:NATIVE"),
+ new String'("/ENTRY:_RtapiProcessEntryCRT@8"),
+ new String'("/RELEASE"),
+ new String'("startupCRT.obj"),
+ new String'("rtxlibcmt.lib"),
+ new String'("oldnames.lib"),
+ new String'("rtapi_rtss.lib"),
+ new String'("Rtx_Rtss.lib"),
+ new String'("libkernel32.a"),
+ new String'("libws2_32.a"),
+ new String'("libmswsock.a"),
+ new String'("libadvapi32.a"));
+ -- These flags need to be passed to Microsoft linker. They
+ -- come from the RTX documentation.
+
+ Gcc_Lib_Path : constant String_Access := new String'
+ ("/LIBPATH:" & Include_Dir_Default_Prefix & "\..\");
+ -- Place to look for gcc related libraries, such as libgcc
+
+ begin
+ -- Replace UNIX "/" by Windows "\" in the path
+
+ for Index in 10 .. Gcc_Lib_Path.all'Last loop
+ if Gcc_Lib_Path (Index) = '/' then
+ Gcc_Lib_Path (Index) := '\';
+ end if;
+ end loop;
+
+ Linker_Options.Increment_Last;
+ Linker_Options.Table (Linker_Options.Last) := Gcc_Lib_Path;
+ Num_Args := Num_Args + 1;
+
+ for Index in Flags_For_Linker'Range loop
+ Linker_Options.Increment_Last;
+ Linker_Options.Table (Linker_Options.Last) :=
+ Flags_For_Linker (Index);
+ Num_Args := Num_Args + 1;
+ end loop;
+ end;
end if;
-- Remove duplicate stack size setting from the Linker_Options
@@ -1978,6 +2121,15 @@ begin
Linker_Options.Table (Linker_Options.Last) := Static_Libgcc;
Num_Args := Num_Args + 1;
end if;
+
+ elsif RTX_RTSS_Kernel_Module_On_Target then
+
+ -- Force the use of the static libgcc for RTSS modules
+
+ Linker_Options.Increment_Last;
+ Linker_Options.Table (Linker_Options.Last) :=
+ new String'("libgcc.a");
+ Num_Args := Num_Args + 1;
end if;
end Clean_Link_Option_Set;
diff --git a/gcc/ada/gprep.adb b/gcc/ada/gprep.adb
index 040a726f572..44633b9c902 100644
--- a/gcc/ada/gprep.adb
+++ b/gcc/ada/gprep.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2002-2007, Free Software Foundation, Inc. --
+-- Copyright (C) 2002-2008, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -475,6 +475,9 @@ package body GPrep is
procedure Process_One_File is
Infile : Source_File_Index;
+ Modified : Boolean;
+ pragma Warnings (Off, Modified);
+
begin
-- Create the output file (fails if this does not work)
@@ -515,7 +518,7 @@ package body GPrep is
-- Preprocess the input file
- Prep.Preprocess;
+ Prep.Preprocess (Modified);
-- In verbose mode, if there is no error, report it
diff --git a/gcc/ada/gsocket.h b/gcc/ada/gsocket.h
index 8b8c83808b6..0dca1a9f503 100644
--- a/gcc/ada/gsocket.h
+++ b/gcc/ada/gsocket.h
@@ -30,6 +30,15 @@
* *
****************************************************************************/
+#if defined(__nucleus__)
+
+#warning Sockets not supported on this platform
+#undef HAVE_SOCKETS
+
+#else
+
+#define HAVE_SOCKETS
+
#ifndef _XOPEN_SOURCE_EXTENDED
#define _XOPEN_SOURCE_EXTENDED 1
/* For HP-UX */
@@ -51,6 +60,7 @@
#endif
#include <limits.h>
+#include <errno.h>
#if defined(__vxworks)
#include <vxWorks.h>
@@ -69,48 +79,83 @@
#include <winsock2.h>
#include <ws2tcpip.h>
-#define EACCES WSAEACCES
-#define EADDRINUSE WSAEADDRINUSE
-#define EADDRNOTAVAIL WSAEADDRNOTAVAIL
-#define EAFNOSUPPORT WSAEAFNOSUPPORT
-#define EALREADY WSAEALREADY
-#define EBADF WSAEBADF
-#define ECONNABORTED WSAECONNABORTED
-#define ECONNREFUSED WSAECONNREFUSED
-#define ECONNRESET WSAECONNRESET
-#define EDESTADDRREQ WSAEDESTADDRREQ
-#define EFAULT WSAEFAULT
-#define EHOSTDOWN WSAEHOSTDOWN
-#define EHOSTUNREACH WSAEHOSTUNREACH
-#define EINPROGRESS WSAEINPROGRESS
-#define EINTR WSAEINTR
-#define EINVAL WSAEINVAL
-#define EIO WSAEDISCON
-#define EISCONN WSAEISCONN
-#define ELOOP WSAELOOP
-#define EMFILE WSAEMFILE
-#define EMSGSIZE WSAEMSGSIZE
-#define ENAMETOOLONG WSAENAMETOOLONG
-#define ENETDOWN WSAENETDOWN
-#define ENETRESET WSAENETRESET
-#define ENETUNREACH WSAENETUNREACH
-#define ENOBUFS WSAENOBUFS
-#define ENOPROTOOPT WSAENOPROTOOPT
-#define ENOTCONN WSAENOTCONN
-#define ENOTSOCK WSAENOTSOCK
-#define EOPNOTSUPP WSAEOPNOTSUPP
-#define EPFNOSUPPORT WSAEPFNOSUPPORT
-#define EPROTONOSUPPORT WSAEPROTONOSUPPORT
-#define ENOTSOCK WSAENOTSOCK
-#define EOPNOTSUPP WSAEOPNOTSUPP
-#define EPFNOSUPPORT WSAEPFNOSUPPORT
-#define EPROTONOSUPPORT WSAEPROTONOSUPPORT
-#define EPROTOTYPE WSAEPROTOTYPE
-#define ESHUTDOWN WSAESHUTDOWN
-#define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT
-#define ETIMEDOUT WSAETIMEDOUT
-#define ETOOMANYREFS WSAETOOMANYREFS
-#define EWOULDBLOCK WSAEWOULDBLOCK
+#undef EACCES
+#define EACCES WSAEACCES
+#undef EADDRINUSE
+#define EADDRINUSE WSAEADDRINUSE
+#undef EADDRNOTAVAIL
+#define EADDRNOTAVAIL WSAEADDRNOTAVAIL
+#undef EAFNOSUPPORT
+#define EAFNOSUPPORT WSAEAFNOSUPPORT
+#undef EALREADY
+#define EALREADY WSAEALREADY
+#undef EBADF
+#define EBADF WSAEBADF
+#undef ECONNABORTED
+#define ECONNABORTED WSAECONNABORTED
+#undef ECONNREFUSED
+#define ECONNREFUSED WSAECONNREFUSED
+#undef ECONNRESET
+#define ECONNRESET WSAECONNRESET
+#undef EDESTADDRREQ
+#define EDESTADDRREQ WSAEDESTADDRREQ
+#undef EFAULT
+#define EFAULT WSAEFAULT
+#undef EHOSTDOWN
+#define EHOSTDOWN WSAEHOSTDOWN
+#undef EHOSTUNREACH
+#define EHOSTUNREACH WSAEHOSTUNREACH
+#undef EINPROGRESS
+#define EINPROGRESS WSAEINPROGRESS
+#undef EINTR
+#define EINTR WSAEINTR
+#undef EINVAL
+#define EINVAL WSAEINVAL
+#undef EIO
+#define EIO WSAEDISCON
+#undef EISCONN
+#define EISCONN WSAEISCONN
+#undef ELOOP
+#define ELOOP WSAELOOP
+#undef EMFILE
+#define EMFILE WSAEMFILE
+#undef EMSGSIZE
+#define EMSGSIZE WSAEMSGSIZE
+#undef ENAMETOOLONG
+#define ENAMETOOLONG WSAENAMETOOLONG
+#undef ENETDOWN
+#define ENETDOWN WSAENETDOWN
+#undef ENETRESET
+#define ENETRESET WSAENETRESET
+#undef ENETUNREACH
+#define ENETUNREACH WSAENETUNREACH
+#undef ENOBUFS
+#define ENOBUFS WSAENOBUFS
+#undef ENOPROTOOPT
+#define ENOPROTOOPT WSAENOPROTOOPT
+#undef ENOTCONN
+#define ENOTCONN WSAENOTCONN
+#undef ENOTSOCK
+#define ENOTSOCK WSAENOTSOCK
+#undef EOPNOTSUPP
+#define EOPNOTSUPP WSAEOPNOTSUPP
+#undef EPFNOSUPPORT
+#define EPFNOSUPPORT WSAEPFNOSUPPORT
+#undef EPROTONOSUPPORT
+#define EPROTONOSUPPORT WSAEPROTONOSUPPORT
+#undef EPROTOTYPE
+#define EPROTOTYPE WSAEPROTOTYPE
+#undef ESHUTDOWN
+#define ESHUTDOWN WSAESHUTDOWN
+#undef ESOCKTNOSUPPORT
+#define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT
+#undef ETIMEDOUT
+#define ETIMEDOUT WSAETIMEDOUT
+#undef ETOOMANYREFS
+#define ETOOMANYREFS WSAETOOMANYREFS
+#undef EWOULDBLOCK
+#define EWOULDBLOCK WSAEWOULDBLOCK
+
#define SHUT_RD SD_RECEIVE
#define SHUT_WR SD_SEND
#define SHUT_RDWR SD_BOTH
@@ -129,10 +174,6 @@
#endif
-#ifndef __MINGW32__
-#include <errno.h>
-#endif
-
#ifdef __vxworks
#include <sys/times.h>
#else
@@ -175,7 +216,7 @@
#if defined (_AIX) || defined (__FreeBSD__) || defined (__hpux__) || defined (__osf__) || defined (_WIN32) || defined (__APPLE__)
# define HAVE_THREAD_SAFE_GETxxxBYyyy 1
-#elif defined (sgi) || defined (linux) || defined (__GLIBC__) || (defined (sun) && defined (__SVR4) && !defined (__vxworks))
+#elif defined (sgi) || defined (linux) || defined (__GLIBC__) || (defined (sun) && defined (__SVR4) && !defined (__vxworks)) || defined(__rtems__)
# define HAVE_GETxxxBYyyy_R 1
#endif
@@ -185,8 +226,10 @@
# define Need_Netdb_Buffer 0
#endif
-#if defined (__FreeBSD__) || defined (__vxworks)
+#if defined (__FreeBSD__) || defined (__vxworks) || defined(__rtems__)
# define Has_Sockaddr_Len 1
#else
# define Has_Sockaddr_Len 0
#endif
+
+#endif /* defined(__nucleus__) */
diff --git a/gcc/ada/i-cobol.adb b/gcc/ada/i-cobol.adb
index f9f696b9eee..3b46385ada2 100644
--- a/gcc/ada/i-cobol.adb
+++ b/gcc/ada/i-cobol.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -337,7 +337,7 @@ package body Interfaces.COBOL is
-- Here a swap is needed
declare
- Len : constant Natural := B'Length;
+ Len : constant Natural := B'Length;
begin
for J in 1 .. Len / 2 loop
@@ -452,10 +452,15 @@ package body Interfaces.COBOL is
-- Used for the nonseparate formats to embed the appropriate sign
-- at the specified location (i.e. at Result (Loc))
+ -------------
+ -- Convert --
+ -------------
+
procedure Convert (First, Last : Natural) is
- J : Natural := Last;
+ J : Natural;
begin
+ J := Last;
while J >= First loop
Result (J) :=
COBOL_Character'Val
@@ -478,6 +483,10 @@ package body Interfaces.COBOL is
raise Conversion_Error;
end Convert;
+ ----------------
+ -- Embed_Sign --
+ ----------------
+
procedure Embed_Sign (Loc : Natural) is
Digit : Natural range 0 .. 9;
@@ -559,6 +568,10 @@ package body Interfaces.COBOL is
-- storing the result in Result (First .. Last). Raise Conversion_Error
-- if the value is too large to fit.
+ -------------
+ -- Convert --
+ -------------
+
procedure Convert (First, Last : Natural) is
J : Natural := Last;
diff --git a/gcc/ada/init.c b/gcc/ada/init.c
index 24a6437f26b..d2c22ea49d3 100644
--- a/gcc/ada/init.c
+++ b/gcc/ada/init.c
@@ -102,6 +102,7 @@ int __gl_zero_cost_exceptions = 0;
int __gl_detect_blocking = 0;
int __gl_default_stack_size = -1;
int __gl_leap_seconds_support = 0;
+int __gl_canonical_streams = 0;
/* Indication of whether synchronous signal handler has already been
installed by a previous call to adainit. */
@@ -745,11 +746,35 @@ __gnat_error_handler (int sig,
char __gnat_alternate_stack[16 * 1024]; /* 2 * SIGSTKSZ */
#endif
+#ifdef __XENO__
+#include <sys/mman.h>
+#include <native/task.h>
+
+RT_TASK main_task;
+#endif
+
void
__gnat_install_handler (void)
{
struct sigaction act;
+#ifdef __XENO__
+ int prio;
+
+ if (__gl_main_priority == -1)
+ prio = 49;
+ else
+ prio = __gl_main_priority;
+
+ /* Avoid memory swapping for this program */
+
+ mlockall (MCL_CURRENT|MCL_FUTURE);
+
+ /* Turn the current Linux task into a native Xenomai task */
+
+ rt_task_shadow(&main_task, "environment_task", prio, T_FPU);
+#endif
+
/* Set up signal handler to map synchronous signals to appropriate
exceptions. Make sure that the handler isn't interrupted by another
signal that might cause a scheduling event! Also setup an alternate
diff --git a/gcc/ada/ioexcept.ads b/gcc/ada/ioexcept.ads
index 0473ff32bdf..efdadc713c9 100644
--- a/gcc/ada/ioexcept.ads
+++ b/gcc/ada/ioexcept.ads
@@ -15,9 +15,9 @@
pragma Ada_2005;
-- Explicit setting of Ada 2005 mode is required here, since we want to with a
--- child unit (not possible in Ada 83 mode), and Text_IO is not considered to
--- be an internal unit that is automatically compiled in Ada 2005 mode (since
--- a user is allowed to redeclare IO_Exceptions).
+-- child unit (not possible in Ada 83 mode), and IO_Exceptions is not
+-- considered to be an internal unit that is automatically compiled in Ada
+-- 2005 mode (since a user is allowed to redeclare IO_Exceptions).
with Ada.IO_Exceptions;
diff --git a/gcc/ada/layout.adb b/gcc/ada/layout.adb
index c6dec0aa379..d4dcd3cb201 100644
--- a/gcc/ada/layout.adb
+++ b/gcc/ada/layout.adb
@@ -83,16 +83,16 @@ package body Layout is
Left_Opnd : Node_Id;
Right_Opnd : Node_Id) return Node_Id;
-- This is like Make_Op_Multiply except that it optimizes some cases
- -- knowing that associative rearrangement is allowed for constant
- -- folding if one of the operands is a compile time known value
+ -- knowing that associative rearrangement is allowed for constant folding
+ -- if one of the operands is a compile time known value
function Assoc_Subtract
(Loc : Source_Ptr;
Left_Opnd : Node_Id;
Right_Opnd : Node_Id) return Node_Id;
-- This is like Make_Op_Subtract except that it optimizes some cases
- -- knowing that associative rearrangement is allowed for constant
- -- folding if one of the operands is a compile time known value
+ -- knowing that associative rearrangement is allowed for constant folding
+ -- if one of the operands is a compile time known value
function Bits_To_SU (N : Node_Id) return Node_Id;
-- This is used when we cross the boundary from static sizes in bits to
@@ -159,21 +159,20 @@ package body Layout is
-- Front-end layout of record type
procedure Rewrite_Integer (N : Node_Id; V : Uint);
- -- Rewrite node N with an integer literal whose value is V. The Sloc
- -- for the new node is taken from N, and the type of the literal is
- -- set to a copy of the type of N on entry.
+ -- Rewrite node N with an integer literal whose value is V. The Sloc for
+ -- the new node is taken from N, and the type of the literal is set to a
+ -- copy of the type of N on entry.
procedure Set_And_Check_Static_Size
(E : Entity_Id;
Esiz : SO_Ref;
RM_Siz : SO_Ref);
- -- This procedure is called to check explicit given sizes (possibly
- -- stored in the Esize and RM_Size fields of E) against computed
- -- Object_Size (Esiz) and Value_Size (RM_Siz) values. Appropriate
- -- errors and warnings are posted if specified sizes are inconsistent
- -- with specified sizes. On return, the Esize and RM_Size fields of
- -- E are set (either from previously given values, or from the newly
- -- computed values, as appropriate).
+ -- This procedure is called to check explicit given sizes (possibly stored
+ -- in the Esize and RM_Size fields of E) against computed Object_Size
+ -- (Esiz) and Value_Size (RM_Siz) values. Appropriate errors and warnings
+ -- are posted if specified sizes are inconsistent with specified sizes. On
+ -- return, Esize and RM_Size fields of E are set (either from previously
+ -- given values, or from the newly computed values, as appropriate).
procedure Set_Composite_Alignment (E : Entity_Id);
-- This procedure is called for record types and subtypes, and also for
@@ -200,8 +199,8 @@ package body Layout is
-- which must be obeyed. If so, we cannot increase the size in this
-- routine.
- -- For a type, the issue is whether an object size clause has been
- -- set. A normal size clause constrains only the value size (RM_Size)
+ -- For a type, the issue is whether an object size clause has been set.
+ -- A normal size clause constrains only the value size (RM_Size)
if Is_Type (E) then
Esize_Set := Has_Object_Size_Clause (E);
@@ -247,14 +246,14 @@ package body Layout is
return;
end if;
- -- Here we have a situation where the Esize is not a multiple of
- -- the alignment. We must either increase Esize or reduce the
- -- alignment to correct this situation.
+ -- Here we have a situation where the Esize is not a multiple of the
+ -- alignment. We must either increase Esize or reduce the alignment to
+ -- correct this situation.
-- The case in which we can decrease the alignment is where the
-- alignment was not set by an alignment clause, and the type in
- -- question is a discrete type, where it is definitely safe to
- -- reduce the alignment. For example:
+ -- question is a discrete type, where it is definitely safe to reduce
+ -- the alignment. For example:
-- t : integer range 1 .. 2;
-- for t'size use 8;
@@ -275,8 +274,8 @@ package body Layout is
return;
end if;
- -- Now the only possible approach left is to increase the Esize
- -- but we can't do that if the size was set by a specific clause.
+ -- Now the only possible approach left is to increase the Esize but we
+ -- can't do that if the size was set by a specific clause.
if Esize_Set then
Error_Msg_NE
@@ -606,9 +605,10 @@ package body Layout is
Ent := Get_Dynamic_SO_Entity (D);
if Is_Discrim_SO_Function (Ent) then
- -- If a component is passed in whose type matches the type
- -- of the function formal, then select that component from
- -- the "V" parameter rather than passing "V" directly.
+
+ -- If a component is passed in whose type matches the type of
+ -- the function formal, then select that component from the "V"
+ -- parameter rather than passing "V" directly.
if Present (Comp)
and then Base_Type (Etype (Comp))
@@ -661,18 +661,18 @@ package body Layout is
when Dynamic => Nod : Node_Id;
end case;
end record;
- -- Shows the status of the value so far. Const means that the value
- -- is constant, and Val is the current constant value. Dynamic means
- -- that the value is dynamic, and in this case Nod is the Node_Id of
- -- the expression to compute the value.
+ -- Shows the status of the value so far. Const means that the value is
+ -- constant, and Val is the current constant value. Dynamic means that
+ -- the value is dynamic, and in this case Nod is the Node_Id of the
+ -- expression to compute the value.
Size : Val_Type;
-- Calculated value so far if Size.Status = Const,
-- or expression value so far if Size.Status = Dynamic.
SU_Convert_Required : Boolean := False;
- -- This is set to True if the final result must be converted from
- -- bits to storage units (rounding up to a storage unit boundary).
+ -- This is set to True if the final result must be converted from bits
+ -- to storage units (rounding up to a storage unit boundary).
-----------------------
-- Local Subprograms --
@@ -799,9 +799,9 @@ package body Layout is
(Dynamic, Make_Integer_Literal (Loc, Size.Val / SSU));
SU_Convert_Required := False;
- -- Otherwise, we go ahead and convert the value in bits,
- -- and set SU_Convert_Required to True to ensure that the
- -- final value is indeed properly converted.
+ -- Otherwise, we go ahead and convert the value in bits, and
+ -- set SU_Convert_Required to True to ensure that the final
+ -- value is indeed properly converted.
else
Size := (Dynamic, Make_Integer_Literal (Loc, Size.Val));
@@ -827,8 +827,8 @@ package body Layout is
Len := Convert_To (Standard_Unsigned, Len);
- -- If we cannot verify that range cannot be super-flat,
- -- we need a max with zero, since length must be non-neg.
+ -- If we cannot verify that range cannot be super-flat, we need
+ -- a max with zero, since length must be non-negative.
if not OK or else LLo < 0 then
Len :=
@@ -846,8 +846,8 @@ package body Layout is
Next_Index (Indx);
end loop;
- -- Here after processing all bounds to set sizes. If the value is
- -- a constant, then it is bits, so we convert to storage units.
+ -- Here after processing all bounds to set sizes. If the value is a
+ -- constant, then it is bits, so we convert to storage units.
if Size.Status = Const then
return Bits_To_SU (Make_Integer_Literal (Loc, Size.Val));
@@ -900,10 +900,10 @@ package body Layout is
-- How An Array Type is Laid Out --
------------------------------------
- -- Here is what goes on. We need to multiply the component size of
- -- the array (which has already been set) by the length of each of
- -- the indexes. If all these values are known at compile time, then
- -- the resulting size of the array is the appropriate constant value.
+ -- Here is what goes on. We need to multiply the component size of the
+ -- array (which has already been set) by the length of each of the
+ -- indexes. If all these values are known at compile time, then the
+ -- resulting size of the array is the appropriate constant value.
-- If the component size or at least one bound is dynamic (but no
-- discriminants are present), then the size will be computed as an
@@ -941,8 +941,8 @@ package body Layout is
-- Value of size computed so far. See comments above
Vtyp : Entity_Id := Empty;
- -- Variant record type for the formal parameter of the
- -- discriminant function V if Status = Discrim.
+ -- Variant record type for the formal parameter of the discriminant
+ -- function V if Status = Discrim.
SU_Convert_Required : Boolean := False;
-- This is set to True if the final result must be converted from
@@ -1064,7 +1064,7 @@ package body Layout is
while Present (Indx) loop
Ityp := Etype (Indx);
- -- If an index of the array is a generic formal type then there's
+ -- If an index of the array is a generic formal type then there is
-- no point in determining a size for the array type.
if Is_Generic_Type (Ityp) then
@@ -1139,18 +1139,18 @@ package body Layout is
(Dynamic, Make_Integer_Literal (Loc, Size.Val / SSU));
SU_Convert_Required := False;
- -- If the current value is a factor of the storage unit,
- -- then we can use a value of one for the size and reduce
- -- the strength of the later division.
+ -- If the current value is a factor of the storage unit, then
+ -- we can use a value of one for the size and reduce the
+ -- strength of the later division.
elsif SSU mod Size.Val = 0 then
Storage_Divisor := SSU / Size.Val;
Size := (Dynamic, Make_Integer_Literal (Loc, Uint_1));
SU_Convert_Required := True;
- -- Otherwise, we go ahead and convert the value in bits,
- -- and set SU_Convert_Required to True to ensure that the
- -- final value is indeed properly converted.
+ -- Otherwise, we go ahead and convert the value in bits, and
+ -- set SU_Convert_Required to True to ensure that the final
+ -- value is indeed properly converted.
else
Size := (Dynamic, Make_Integer_Literal (Loc, Size.Val));
@@ -1165,8 +1165,8 @@ package body Layout is
Len := Compute_Length (Lo, Hi);
- -- If Len isn't a Length attribute, then its range needs to
- -- be checked a possible Max with zero needs to be computed.
+ -- If Len isn't a Length attribute, then its range needs to be
+ -- checked a possible Max with zero needs to be computed.
if Nkind (Len) /= N_Attribute_Reference
or else Attribute_Name (Len) /= Name_Length
@@ -1193,9 +1193,8 @@ package body Layout is
return;
end if;
- -- If we cannot verify that range cannot be super-flat,
- -- we need a maximum with zero, since length cannot be
- -- negative.
+ -- If we cannot verify that range cannot be super-flat, we
+ -- need a max with zero, since length cannot be negative.
if not OK or else LLo < 0 then
Len :=
@@ -1221,9 +1220,9 @@ package body Layout is
Next_Index (Indx);
end loop;
- -- Here after processing all bounds to set sizes. If the value is
- -- a constant, then it is bits, and the only thing we need to do
- -- is to check against explicit given size and do alignment adjust.
+ -- Here after processing all bounds to set sizes. If the value is a
+ -- constant, then it is bits, and the only thing we need to do is to
+ -- check against explicit given size and do alignment adjust.
if Size.Status = Const then
Set_And_Check_Static_Size (E, Size.Val, Size.Val);
@@ -1303,8 +1302,8 @@ package body Layout is
return;
end if;
- -- Set size if not set for object and known for type. Use the
- -- RM_Size if that is known for the type and Esize is not.
+ -- Set size if not set for object and known for type. Use the RM_Size if
+ -- that is known for the type and Esize is not.
if Unknown_Esize (E) then
if Known_Esize (T) then
@@ -1325,9 +1324,9 @@ package body Layout is
Adjust_Esize_Alignment (E);
- -- Final adjustment, if we don't know the alignment, and the Esize
- -- was not set by an explicit Object_Size attribute clause, then
- -- we reset the Esize to unknown, since we really don't know it.
+ -- Final adjustment, if we don't know the alignment, and the Esize was
+ -- not set by an explicit Object_Size attribute clause, then we reset
+ -- the Esize to unknown, since we really don't know it.
if Unknown_Alignment (E)
and then not Has_Size_Clause (E)
@@ -1505,8 +1504,8 @@ package body Layout is
New_Fbit := (New_Fbit + SSU - 1) / SSU * SSU;
end if;
- -- If old normalized position is static, we can go ahead
- -- and compute the new normalized position directly.
+ -- If old normalized position is static, we can go ahead and
+ -- compute the new normalized position directly.
if Known_Static_Normalized_Position (Prev_Comp) then
New_Npos := Old_Npos;
@@ -1619,11 +1618,11 @@ package body Layout is
return;
end if;
- -- Check case of type of component has a scope of the record we
- -- are laying out. When this happens, the type in question is an
- -- Itype that has not yet been laid out (that's because such
- -- types do not get frozen in the normal manner, because there
- -- is no place for the freeze nodes).
+ -- Check case of type of component has a scope of the record we are
+ -- laying out. When this happens, the type in question is an Itype
+ -- that has not yet been laid out (that's because such types do not
+ -- get frozen in the normal manner, because there is no place for
+ -- the freeze nodes).
if Scope (Ctyp) = E then
Layout_Type (Ctyp);
@@ -1636,9 +1635,8 @@ package body Layout is
end if;
-- Set size of component from type. We use the Esize except in a
- -- packed record, where we use the RM_Size (since that is exactly
- -- what the RM_Size value, as distinct from the Object_Size is
- -- useful for!)
+ -- packed record, where we use the RM_Size (since that is what the
+ -- RM_Size value, as distinct from the Object_Size is useful for!)
if Is_Packed (E) then
Set_Esize (Comp, RM_Size (Ctyp));
@@ -1915,10 +1913,10 @@ package body Layout is
RM_Siz_Expr : Node_Id := Empty;
-- Expression for the evolving RM_Siz value. This is typically a
- -- conditional expression which involves tests of discriminant
- -- values that are formed as references to the entity V. At
- -- the end of scanning all the components, a suitable function
- -- is constructed in which V is the parameter.
+ -- conditional expression which involves tests of discriminant values
+ -- that are formed as references to the entity V. At the end of
+ -- scanning all the components, a suitable function is constructed
+ -- in which V is the parameter.
-----------------------
-- Local Subprograms --
@@ -1928,14 +1926,14 @@ package body Layout is
(Clist : Node_Id;
Esiz : out SO_Ref;
RM_Siz_Expr : out Node_Id);
- -- Recursive procedure, called to lay out one component list
- -- Esiz and RM_Siz_Expr are set to the Object_Size and Value_Size
- -- values respectively representing the record size up to and
- -- including the last component in the component list (including
- -- any variants in this component list). RM_Siz_Expr is returned
- -- as an expression which may in the general case involve some
- -- references to the discriminants of the current record value,
- -- referenced by selecting from the entity V.
+ -- Recursive procedure, called to lay out one component list Esiz
+ -- and RM_Siz_Expr are set to the Object_Size and Value_Size values
+ -- respectively representing the record size up to and including the
+ -- last component in the component list (including any variants in
+ -- this component list). RM_Siz_Expr is returned as an expression
+ -- which may in the general case involve some references to the
+ -- discriminants of the current record value, referenced by selecting
+ -- from the entity V.
---------------------------
-- Layout_Component_List --
@@ -1982,9 +1980,9 @@ package body Layout is
else
RMS_Ent := Get_Dynamic_SO_Entity (RM_Siz);
- -- If the size is represented by a function, then we
- -- create an appropriate function call using V as
- -- the parameter to the call.
+ -- If the size is represented by a function, then we create
+ -- an appropriate function call using V as the parameter to
+ -- the call.
if Is_Discrim_SO_Function (RMS_Ent) then
RM_Siz_Expr :=
@@ -2080,9 +2078,9 @@ package body Layout is
-- individual variants, and xxDx are the discriminant
-- checking functions generated for the variant type.
- -- If this is the first variant, we simply set the
- -- result as the expression. Note that this takes
- -- care of the others case.
+ -- If this is the first variant, we simply set the result
+ -- as the expression. Note that this takes care of the
+ -- others case.
if No (RM_Siz_Expr) then
RM_Siz_Expr := Bits_To_SU (RM_SizV);
@@ -2236,17 +2234,17 @@ package body Layout is
-- All other cases
else
- -- Initialize alignment conservatively to 1. This value will
- -- be increased as necessary during processing of the record.
+ -- Initialize alignment conservatively to 1. This value will be
+ -- increased as necessary during processing of the record.
if Unknown_Alignment (E) then
Set_Alignment (E, Uint_1);
end if;
- -- Initialize previous component. This is Empty unless there
- -- are components which have already been laid out by component
- -- clauses. If there are such components, we start our lay out of
- -- the remaining components following the last such component.
+ -- Initialize previous component. This is Empty unless there are
+ -- components which have already been laid out by component clauses.
+ -- If there are such components, we start our lay out of the
+ -- remaining components following the last such component.
Prev_Comp := Empty;
@@ -2303,8 +2301,8 @@ package body Layout is
Desig_Type : Entity_Id;
begin
- -- For string literal types, for now, kill the size always, this
- -- is because gigi does not like or need the size to be set ???
+ -- For string literal types, for now, kill the size always, this is
+ -- because gigi does not like or need the size to be set ???
if Ekind (E) = E_String_Literal_Subtype then
Set_Esize (E, Uint_0);
@@ -2312,14 +2310,14 @@ package body Layout is
return;
end if;
- -- For access types, set size/alignment. This is system address
- -- size, except for fat pointers (unconstrained array access types),
- -- where the size is two times the address size, to accommodate the
- -- two pointers that are required for a fat pointer (data and
- -- template). Note that E_Access_Protected_Subprogram_Type is not
- -- an access type for this purpose since it is not a pointer but is
- -- equivalent to a record. For access subtypes, copy the size from
- -- the base type since Gigi represents them the same way.
+ -- For access types, set size/alignment. This is system address size,
+ -- except for fat pointers (unconstrained array access types), where the
+ -- size is two times the address size, to accommodate the two pointers
+ -- that are required for a fat pointer (data and template). Note that
+ -- E_Access_Protected_Subprogram_Type is not an access type for this
+ -- purpose since it is not a pointer but is equivalent to a record. For
+ -- access subtypes, copy the size from the base type since Gigi
+ -- represents them the same way.
if Is_Access_Type (E) then
@@ -2335,15 +2333,15 @@ package body Layout is
Desig_Type := Non_Limited_View (Designated_Type (E));
end if;
- -- If Esize already set (e.g. by a size clause), then nothing
- -- further to be done here.
+ -- If Esize already set (e.g. by a size clause), then nothing further
+ -- to be done here.
if Known_Esize (E) then
null;
- -- Access to subprogram is a strange beast, and we let the
- -- backend figure out what is needed (it may be some kind
- -- of fat pointer, including the static link for example.
+ -- Access to subprogram is a strange beast, and we let the backend
+ -- figure out what is needed (it may be some kind of fat pointer,
+ -- including the static link for example.
elsif Is_Access_Protected_Subprogram_Type (E) then
null;
@@ -2354,9 +2352,9 @@ package body Layout is
Set_Size_Info (E, Base_Type (E));
Set_RM_Size (E, RM_Size (Base_Type (E)));
- -- For other access types, we use either address size, or, if
- -- a fat pointer is used (pointer-to-unconstrained array case),
- -- twice the address size to accommodate a fat pointer.
+ -- For other access types, we use either address size, or, if a fat
+ -- pointer is used (pointer-to-unconstrained array case), twice the
+ -- address size to accommodate a fat pointer.
elsif Present (Desig_Type)
and then Is_Array_Type (Desig_Type)
@@ -2378,9 +2376,9 @@ package body Layout is
("?this access type does not correspond to C pointer", E);
end if;
- -- If the designated type is a limited view it is unanalyzed. We
- -- can examine the declaration itself to determine whether it will
- -- need a fat pointer.
+ -- If the designated type is a limited view it is unanalyzed. We can
+ -- examine the declaration itself to determine whether it will need a
+ -- fat pointer.
elsif Present (Desig_Type)
and then Present (Parent (Desig_Type))
@@ -2392,9 +2390,9 @@ package body Layout is
Init_Size (E, 2 * System_Address_Size);
-- When the target is AAMP, access-to-subprogram types are fat
- -- pointers consisting of the subprogram address and a static
- -- link (with the exception of library-level access types,
- -- where a simple subprogram address is used).
+ -- pointers consisting of the subprogram address and a static link
+ -- (with the exception of library-level access types, where a simple
+ -- subprogram address is used).
elsif AAMP_On_Target
and then
@@ -2411,15 +2409,14 @@ package body Layout is
-- On VMS, reset size to 32 for convention C access type if no
-- explicit size clause is given and the default size is 64. Really
-- we do not know the size, since depending on options for the VMS
- -- compiler, the size of a pointer type can be 32 or 64, but
- -- choosing 32 as the default improves compatibility with legacy
- -- VMS code.
+ -- compiler, the size of a pointer type can be 32 or 64, but choosing
+ -- 32 as the default improves compatibility with legacy VMS code.
-- Note: we do not use Has_Size_Clause in the test below, because we
- -- want to catch the case of a derived type inheriting a size
- -- clause. We want to consider this to be an explicit size clause
- -- for this purpose, since it would be weird not to inherit the size
- -- in this case.
+ -- want to catch the case of a derived type inheriting a size clause.
+ -- We want to consider this to be an explicit size clause for this
+ -- purpose, since it would be weird not to inherit the size in this
+ -- case.
-- We do NOT do this if we are in -gnatdm mode on a non-VMS target
-- since in that case we want the normal pointer representation.
@@ -2440,12 +2437,11 @@ package body Layout is
elsif Is_Scalar_Type (E) then
- -- For discrete types, the RM_Size and Esize must be set
- -- already, since this is part of the earlier processing
- -- and the front end is always required to lay out the
- -- sizes of such types (since they are available as static
- -- attributes). All we do is to check that this rule is
- -- indeed obeyed!
+ -- For discrete types, the RM_Size and Esize must be set already,
+ -- since this is part of the earlier processing and the front end is
+ -- always required to lay out the sizes of such types (since they are
+ -- available as static attributes). All we do is to check that this
+ -- rule is indeed obeyed!
if Is_Discrete_Type (E) then
@@ -2472,10 +2468,10 @@ package body Layout is
Init_Esize (E, S);
exit;
- -- If the RM_Size is greater than 64 (happens only
- -- when strange values are specified by the user,
- -- then Esize is simply a copy of RM_Size, it will
- -- be further refined later on)
+ -- If the RM_Size is greater than 64 (happens only when
+ -- strange values are specified by the user, then Esize
+ -- is simply a copy of RM_Size, it will be further
+ -- refined later on)
elsif S = 64 then
Set_Esize (E, RM_Size (E));
@@ -2490,8 +2486,8 @@ package body Layout is
end;
end if;
- -- For non-discrete scalar types, if the RM_Size is not set,
- -- then set it now to a copy of the Esize if the Esize is set.
+ -- For non-discrete scalar types, if the RM_Size is not set, then set
+ -- it now to a copy of the Esize if the Esize is set.
else
if Known_Esize (E) and then Unknown_RM_Size (E) then
@@ -2508,8 +2504,8 @@ package body Layout is
if Known_RM_Size (E) and then Unknown_Esize (E) then
- -- If the alignment is known, we bump the Esize up to the
- -- next alignment boundary if it is not already on one.
+ -- If the alignment is known, we bump the Esize up to the next
+ -- alignment boundary if it is not already on one.
if Known_Alignment (E) then
declare
@@ -2520,18 +2516,17 @@ package body Layout is
end;
end if;
- -- If Esize is set, and RM_Size is not, RM_Size is copied from
- -- Esize at least for now this seems reasonable, and is in any
- -- case needed for compatibility with old versions of gigi.
- -- look to be unknown.
+ -- If Esize is set, and RM_Size is not, RM_Size is copied from Esize.
+ -- At least for now this seems reasonable, and is in any case needed
+ -- for compatibility with old versions of gigi.
elsif Known_Esize (E) and then Unknown_RM_Size (E) then
Set_RM_Size (E, Esize (E));
end if;
- -- For array base types, set component size if object size of
- -- the component type is known and is a small power of 2 (8,
- -- 16, 32, 64), since this is what will always be used.
+ -- For array base types, set component size if object size of the
+ -- component type is known and is a small power of 2 (8, 16, 32, 64),
+ -- since this is what will always be used.
if Ekind (E) = E_Array_Type
and then Unknown_Component_Size (E)
@@ -2540,8 +2535,8 @@ package body Layout is
CT : constant Entity_Id := Component_Type (E);
begin
- -- For some reasons, access types can cause trouble,
- -- So let's just do this for discrete types ???
+ -- For some reasons, access types can cause trouble, So let's
+ -- just do this for discrete types ???
if Present (CT)
and then Is_Discrete_Type (CT)
@@ -2646,9 +2641,9 @@ package body Layout is
begin
Set_Esize (E, RM_Size (E));
- -- For scalar types, increase Object_Size to power of 2,
- -- but not less than a storage unit in any case (i.e.,
- -- normally this means it will be storage-unit addressable).
+ -- For scalar types, increase Object_Size to power of 2, but
+ -- not less than a storage unit in any case (i.e., normally
+ -- this means it will be storage-unit addressable).
if Is_Scalar_Type (E) then
if Size <= System_Storage_Unit then
@@ -2700,16 +2695,15 @@ package body Layout is
SC : Node_Id;
procedure Check_Size_Too_Small (Spec : Uint; Min : Uint);
- -- Spec is the number of bit specified in the size clause, and
- -- Min is the minimum computed size. An error is given that the
- -- specified size is too small if Spec < Min, and in this case
- -- both Esize and RM_Size are set to unknown in E. The error
- -- message is posted on node SC.
+ -- Spec is the number of bit specified in the size clause, and Min is
+ -- the minimum computed size. An error is given that the specified size
+ -- is too small if Spec < Min, and in this case both Esize and RM_Size
+ -- are set to unknown in E. The error message is posted on node SC.
procedure Check_Unused_Bits (Spec : Uint; Max : Uint);
- -- Spec is the number of bits specified in the size clause, and
- -- Max is the maximum computed size. A warning is given about
- -- unused bits if Spec > Max. This warning is posted on node SC.
+ -- Spec is the number of bits specified in the size clause, and Max is
+ -- the maximum computed size. A warning is given about unused bits if
+ -- Spec > Max. This warning is posted on node SC.
--------------------------
-- Check_Size_Too_Small --
@@ -2758,10 +2752,10 @@ package body Layout is
end if;
end if;
- -- Case where Value_Size (RM_Size) is set by specific Value_Size
- -- clause (we do not need to worry about Value_Size being set by
- -- a Size clause, since that will have set Esize as well, and we
- -- already took care of that case).
+ -- Case where Value_Size (RM_Size) is set by specific Value_Size clause
+ -- (we do not need to worry about Value_Size being set by a Size clause,
+ -- since that will have set Esize as well, and we already took care of
+ -- that case).
if Known_Static_RM_Size (E) then
SC := Get_Attribute_Definition_Clause (E, Attribute_Value_Size);
@@ -2949,8 +2943,8 @@ package body Layout is
end if;
end if;
- -- Set chosen alignment, and increase Esize if necessary to match
- -- the chosen alignment.
+ -- Set chosen alignment, and increase Esize if necessary to match the
+ -- chosen alignment.
Set_Alignment (E, UI_From_Int (Align));
@@ -2969,21 +2963,21 @@ package body Layout is
FST : constant Entity_Id := First_Subtype (Def_Id);
begin
- -- All discrete types except for the base types in standard
- -- are constrained, so indicate this by setting Is_Constrained.
+ -- All discrete types except for the base types in standard are
+ -- constrained, so indicate this by setting Is_Constrained.
Set_Is_Constrained (Def_Id);
- -- We set generic types to have an unknown size, since the
- -- representation of a generic type is irrelevant, in view
- -- of the fact that they have nothing to do with code.
+ -- Set generic types to have an unknown size, since the representation
+ -- of a generic type is irrelevant, in view of the fact that they have
+ -- nothing to do with code.
if Is_Generic_Type (Root_Type (FST)) then
Set_RM_Size (Def_Id, Uint_0);
- -- If the subtype statically matches the first subtype, then
- -- it is required to have exactly the same layout. This is
- -- required by aliasing considerations.
+ -- If the subtype statically matches the first subtype, then it is
+ -- required to have exactly the same layout. This is required by
+ -- aliasing considerations.
elsif Def_Id /= FST and then
Subtypes_Statically_Match (Def_Id, FST)
@@ -2991,9 +2985,9 @@ package body Layout is
Set_RM_Size (Def_Id, RM_Size (FST));
Set_Size_Info (Def_Id, FST);
- -- In all other cases the RM_Size is set to the minimum size.
- -- Note that this routine is never called for subtypes for which
- -- the RM_Size is set explicitly by an attribute clause.
+ -- In all other cases the RM_Size is set to the minimum size. Note that
+ -- this routine is never called for subtypes for which the RM_Size is
+ -- set explicitly by an attribute clause.
else
Set_RM_Size (Def_Id, UI_From_Int (Minimum_Size (Def_Id)));
@@ -3033,9 +3027,9 @@ package body Layout is
return;
end if;
- -- Here we calculate the alignment as the largest power of two
- -- multiple of System.Storage_Unit that does not exceed either
- -- the actual size of the type, or the maximum allowed alignment.
+ -- Here we calculate the alignment as the largest power of two multiple
+ -- of System.Storage_Unit that does not exceed either the actual size of
+ -- the type, or the maximum allowed alignment.
declare
S : constant Int :=
@@ -3050,18 +3044,18 @@ package body Layout is
A := 2 * A;
end loop;
- -- Now we think we should set the alignment to A, but we
- -- skip this if an alignment is already set to a value
- -- greater than A (happens for derived types).
+ -- Now we think we should set the alignment to A, but we skip this if
+ -- an alignment is already set to a value greater than A (happens for
+ -- derived types).
- -- However, if the alignment is known and too small it
- -- must be increased, this happens in a case like:
+ -- However, if the alignment is known and too small it must be
+ -- increased, this happens in a case like:
-- type R is new Character;
-- for R'Size use 16;
- -- Here the alignment inherited from Character is 1, but
- -- it must be increased to 2 to reflect the increased size.
+ -- Here the alignment inherited from Character is 1, but it must be
+ -- increased to 2 to reflect the increased size.
if Unknown_Alignment (E) or else Alignment (E) < A then
Init_Alignment (E, A);
@@ -3170,8 +3164,8 @@ package body Layout is
Make_Simple_Return_Statement (Loc,
Expression => Expr))));
- -- The caller requests that the expression be encapsulated in
- -- a parameterless function.
+ -- The caller requests that the expression be encapsulated in a
+ -- parameterless function.
elsif Make_Func then
Decl :=
diff --git a/gcc/ada/lib-xref.adb b/gcc/ada/lib-xref.adb
index 8af553fef59..2ab83c53aa8 100644
--- a/gcc/ada/lib-xref.adb
+++ b/gcc/ada/lib-xref.adb
@@ -1834,7 +1834,11 @@ package body Lib.Xref is
Par : Node_Id;
begin
- if Ekind (Scope (E)) /= E_Generic_Package then
+ -- The Present check here is an error defense
+
+ if Present (Scope (E))
+ and then Ekind (Scope (E)) /= E_Generic_Package
+ then
return False;
end if;
diff --git a/gcc/ada/make.adb b/gcc/ada/make.adb
index 3ae13fc84ae..1b5d7124e2b 100644
--- a/gcc/ada/make.adb
+++ b/gcc/ada/make.adb
@@ -645,8 +645,9 @@ package body Make is
-- project file. If the Source_File ends with a standard GNAT extension
-- (".ads" or ".adb"), try first the full name, then the name without the
-- extension, then, if Allow_ALI is True, the name with the extension
- -- ".ali". If there is no switches for either names, try the default
- -- switches for Ada. If all failed, return No_Variable_Value.
+ -- ".ali". If there is no switches for either names, try first Switches
+ -- (others) then the default switches for Ada. If all failed, return
+ -- No_Variable_Value.
function Is_In_Object_Directory
(Source_File : File_Name_Type;
@@ -659,21 +660,21 @@ package body Make is
-- Compiler, Binder & Linker Data and Subprograms --
----------------------------------------------------
- Gcc : String_Access := Program_Name ("gcc", "gnatmake");
- Gnatbind : String_Access := Program_Name ("gnatbind", "gnatmake");
- Gnatlink : String_Access := Program_Name ("gnatlink", "gnatmake");
+ Gcc : String_Access := Program_Name ("gcc", "gnatmake");
+ Gnatbind : String_Access := Program_Name ("gnatbind", "gnatmake");
+ Gnatlink : String_Access := Program_Name ("gnatlink", "gnatmake");
-- Default compiler, binder, linker programs
- Saved_Gcc : String_Access := null;
- Saved_Gnatbind : String_Access := null;
- Saved_Gnatlink : String_Access := null;
+ Saved_Gcc : String_Access := null;
+ Saved_Gnatbind : String_Access := null;
+ Saved_Gnatlink : String_Access := null;
-- Given by the command line. Will be used, if non null
- Gcc_Path : String_Access :=
+ Gcc_Path : String_Access :=
GNAT.OS_Lib.Locate_Exec_On_Path (Gcc.all);
- Gnatbind_Path : String_Access :=
+ Gnatbind_Path : String_Access :=
GNAT.OS_Lib.Locate_Exec_On_Path (Gnatbind.all);
- Gnatlink_Path : String_Access :=
+ Gnatlink_Path : String_Access :=
GNAT.OS_Lib.Locate_Exec_On_Path (Gnatlink.all);
-- Path for compiler, binder, linker programs, defaulted now for gnatdist.
-- Changed later if overridden on command line.
@@ -1865,7 +1866,7 @@ package body Make is
ALI := No_ALI_Id;
Verbose_Msg
- (Unit_Name, " sources does not include ",
+ (Unit_Name, " sources do not include ",
Name_Id (WR.Sfile));
return;
@@ -3463,6 +3464,7 @@ package body Make is
-- If an ALI file was generated by this compilation, scan
-- the ALI file and record it.
+
-- If the scan fails, a previous ali file is inconsistent with
-- the unit just compiled.
@@ -5108,33 +5110,58 @@ package body Make is
declare
Defaults : constant Variable_Value :=
- Prj.Util.Value_Of
- (Name => Name_Ada,
- Index => 0,
- Attribute_Or_Array_Name => Name_Default_Switches,
- In_Package => Builder_Package,
- In_Tree => Project_Tree);
+ Prj.Util.Value_Of
+ (Name => Name_Ada,
+ Index => 0,
+ Attribute_Or_Array_Name =>
+ Name_Default_Switches,
+ In_Package =>
+ Builder_Package,
+ In_Tree => Project_Tree);
Switches : constant Array_Element_Id :=
- Prj.Util.Value_Of
- (Name => Name_Switches,
- In_Arrays =>
- Project_Tree.Packages.Table
- (Builder_Package).Decl.Arrays,
- In_Tree => Project_Tree);
+ Prj.Util.Value_Of
+ (Name => Name_Switches,
+ In_Arrays =>
+ Project_Tree.Packages.Table
+ (Builder_Package).Decl.Arrays,
+ In_Tree => Project_Tree);
+
+ Other_Switches : constant Variable_Value :=
+ Prj.Util.Value_Of
+ (Name => All_Other_Names,
+ Index => 0,
+ Attribute_Or_Array_Name
+ => Name_Switches,
+ In_Package => Builder_Package,
+ In_Tree => Project_Tree);
begin
- if Defaults /= Nil_Variable_Value then
- if (not Quiet_Output)
+ if Other_Switches /= Nil_Variable_Value then
+ if not Quiet_Output
and then Switches /= No_Array_Element
+ and then Project_Tree.Array_Elements.Table
+ (Switches).Next /= No_Array_Element
then
Write_Line
- ("Warning: using Builder'Default_Switches" &
- "(""Ada""), as there are several mains");
+ ("Warning: using Builder'Switches(others), "
+ & "as there are several mains");
end if;
- -- As there is never a source with name " ", we are
- -- guaranteed to always get the general switches.
+ Add_Switches
+ (File_Name => " ",
+ Index => 0,
+ The_Package => Builder_Package,
+ Program => None);
+
+ elsif Defaults /= Nil_Variable_Value then
+ if not Quiet_Output
+ and then Switches /= No_Array_Element
+ then
+ Write_Line
+ ("Warning: using Builder'Default_Switches"
+ & "(""Ada""), as there are several mains");
+ end if;
Add_Switches
(File_Name => " ",
@@ -5142,12 +5169,12 @@ package body Make is
The_Package => Builder_Package,
Program => None);
- elsif (not Quiet_Output)
+ elsif not Quiet_Output
and then Switches /= No_Array_Element
then
Write_Line
- ("Warning: using no switches from package Builder," &
- " as there are several mains");
+ ("Warning: using no switches from package "
+ & "Builder, as there are several mains");
end if;
end;
end if;
@@ -8165,6 +8192,15 @@ package body Make is
if Switches = Nil_Variable_Value then
Switches :=
Prj.Util.Value_Of
+ (Index => All_Other_Names,
+ Src_Index => 0,
+ In_Array => Switches_Array,
+ In_Tree => Project_Tree);
+ end if;
+
+ if Switches = Nil_Variable_Value then
+ Switches :=
+ Prj.Util.Value_Of
(Index => Name_Ada,
Src_Index => 0,
In_Array => Defaults,
diff --git a/gcc/ada/makeutl.adb b/gcc/ada/makeutl.adb
index 1755ade229c..3d0ee62eaed 100644
--- a/gcc/ada/makeutl.adb
+++ b/gcc/ada/makeutl.adb
@@ -246,7 +246,15 @@ package body Makeutl is
-- If we get here, the user has typed the executable name with no
-- directory prefix.
- return Get_Install_Dir (Locate_Exec_On_Path (Exec_Name).all);
+ declare
+ Path : constant String_Access := Locate_Exec_On_Path (Exec_Name);
+ begin
+ if Path = null then
+ return "";
+ else
+ return Get_Install_Dir (Path.all);
+ end if;
+ end;
end Executable_Prefix_Path;
----------
diff --git a/gcc/ada/mlib-tgt-specific-vms-alpha.adb b/gcc/ada/mlib-tgt-specific-vms-alpha.adb
index 291293607f9..f272307b935 100644
--- a/gcc/ada/mlib-tgt-specific-vms-alpha.adb
+++ b/gcc/ada/mlib-tgt-specific-vms-alpha.adb
@@ -276,12 +276,26 @@ package body MLib.Tgt.Specific is
-- Create and write the auto-init assembly file
declare
- First_Line : constant String :=
- ASCII.HT & ".section LIB$INITIALIZE,GBL,NOWRT" &
- ASCII.LF;
- Second_Line : constant String :=
- ASCII.HT & ".long " & Init_Proc & ASCII.LF;
- -- First and second lines of the auto-init assembly file
+ use ASCII;
+
+ -- Output a dummy transfer address for debugging
+ -- followed by the LIB$INITIALIZE section.
+
+ Lines : constant String :=
+ HT & ".text" & LF &
+ HT & ".align 4" & LF &
+ HT & ".globl __main" & LF &
+ HT & ".ent __main" & LF &
+ "__main..en:" & LF &
+ HT & ".base $27" & LF &
+ HT & ".frame $29,0,$26,8" & LF &
+ HT & "ret $31,($26),1" & LF &
+ HT & ".link" & LF &
+ "__main:" & LF &
+ HT & ".pdesc __main..en,null" & LF &
+ HT & ".end __main" & LF & LF &
+ HT & ".section LIB$INITIALIZE,GBL,NOWRT" & LF &
+ HT & ".long " & Init_Proc & LF;
begin
Macro_File := Create_File (Macro_File_Name, Text);
@@ -289,16 +303,9 @@ package body MLib.Tgt.Specific is
if OK then
Len := Write
- (Macro_File, First_Line (First_Line'First)'Address,
- First_Line'Length);
- OK := Len = First_Line'Length;
- end if;
-
- if OK then
- Len := Write
- (Macro_File, Second_Line (Second_Line'First)'Address,
- Second_Line'Length);
- OK := Len = Second_Line'Length;
+ (Macro_File, Lines (Lines'First)'Address,
+ Lines'Length);
+ OK := Len = Lines'Length;
end if;
if OK then
diff --git a/gcc/ada/mlib-tgt-specific-vms-ia64.adb b/gcc/ada/mlib-tgt-specific-vms-ia64.adb
index baa8ce213f1..ed483876be4 100644
--- a/gcc/ada/mlib-tgt-specific-vms-ia64.adb
+++ b/gcc/ada/mlib-tgt-specific-vms-ia64.adb
@@ -275,26 +275,30 @@ package body MLib.Tgt.Specific is
-- Create and write the auto-init assembly file
declare
- First_Line : constant String :=
- ASCII.HT
- & ".type " & Init_Proc & "#, @function"
- & ASCII.LF;
- Second_Line : constant String :=
- ASCII.HT
- & ".global " & Init_Proc & "#"
- & ASCII.LF;
- Third_Line : constant String :=
- ASCII.HT
- & ".global LIB$INITIALIZE#"
- & ASCII.LF;
- Fourth_Line : constant String :=
- ASCII.HT
- & ".section LIB$INITIALIZE#,""a"",@progbits"
- & ASCII.LF;
- Fifth_Line : constant String :=
- ASCII.HT
- & "data4 @fptr(" & Init_Proc & "#)"
- & ASCII.LF;
+ use ASCII;
+
+ -- Output a dummy transfer address for debugging
+ -- followed by the LIB$INITIALIZE section.
+
+ Lines : constant String :=
+ HT & ".pred.safe_across_calls p1-p5,p16-p63" & LF &
+ HT & ".text" & LF &
+ HT & ".align 16" & LF &
+ HT & ".global __main#" & LF &
+ HT & ".proc __main#" & LF &
+ "__main:" & LF &
+ HT & ".prologue" & LF &
+ HT & ".body" & LF &
+ HT & ".mib" & LF &
+ HT & "nop 0" & LF &
+ HT & "nop 0" & LF &
+ HT & "br.ret.sptk.many b0" & LF &
+ HT & ".endp __main#" & LF & LF &
+ HT & ".type " & Init_Proc & "#, @function" & LF &
+ HT & ".global " & Init_Proc & "#" & LF &
+ HT & ".global LIB$INITIALIZE#" & LF &
+ HT & ".section LIB$INITIALIZE#,""a"",@progbits" & LF &
+ HT & "data4 @fptr(" & Init_Proc & "#)" & LF;
begin
Macro_File := Create_File (Macro_File_Name, Text);
@@ -302,37 +306,9 @@ package body MLib.Tgt.Specific is
if OK then
Len := Write
- (Macro_File, First_Line (First_Line'First)'Address,
- First_Line'Length);
- OK := Len = First_Line'Length;
- end if;
-
- if OK then
- Len := Write
- (Macro_File, Second_Line (Second_Line'First)'Address,
- Second_Line'Length);
- OK := Len = Second_Line'Length;
- end if;
-
- if OK then
- Len := Write
- (Macro_File, Third_Line (Third_Line'First)'Address,
- Third_Line'Length);
- OK := Len = Third_Line'Length;
- end if;
-
- if OK then
- Len := Write
- (Macro_File, Fourth_Line (Fourth_Line'First)'Address,
- Fourth_Line'Length);
- OK := Len = Fourth_Line'Length;
- end if;
-
- if OK then
- Len := Write
- (Macro_File, Fifth_Line (Fifth_Line'First)'Address,
- Fifth_Line'Length);
- OK := Len = Fifth_Line'Length;
+ (Macro_File, Lines (Lines'First)'Address,
+ Lines'Length);
+ OK := Len = Lines'Length;
end if;
if OK then
diff --git a/gcc/ada/mlib-utl.adb b/gcc/ada/mlib-utl.adb
index d743bb138e8..76e7db5332b 100644
--- a/gcc/ada/mlib-utl.adb
+++ b/gcc/ada/mlib-utl.adb
@@ -35,6 +35,10 @@ with System;
package body MLib.Utl is
+ Adalib_Path : String_Access := null;
+ -- Path of the GNAT adalib directory, specified in procedure
+ -- Specify_Adalib_Dir. Used in function Lib_Directory.
+
Gcc_Name : String_Access;
-- Default value of the "gcc" executable used in procedure Gcc
@@ -408,7 +412,7 @@ package body MLib.Utl is
if Driver_Name = No_Name then
if Gcc_Exec = null then
if Gcc_Name = null then
- Gcc_Name := Osint.Program_Name ("gcc", "gnatmake");
+ Gcc_Name := Osint.Program_Name ("gcc", "gnatmake");
end if;
Gcc_Exec := Locate_Exec_On_Path (Gcc_Name.all);
@@ -597,6 +601,13 @@ package body MLib.Utl is
Libgnat : constant String := Tgt.Libgnat;
begin
+ -- If procedure Specify_Adalib_Dir has been called, used the specified
+ -- value.
+
+ if Adalib_Path /= null then
+ return Adalib_Path.all;
+ end if;
+
Name_Len := Libgnat'Length;
Name_Buffer (1 .. Name_Len) := Libgnat;
Get_Name_String (Osint.Find_File (Name_Enter, Osint.Library));
@@ -606,4 +617,17 @@ package body MLib.Utl is
return Name_Buffer (1 .. Name_Len - Libgnat'Length);
end Lib_Directory;
+ ------------------------
+ -- Specify_Adalib_Dir --
+ ------------------------
+
+ procedure Specify_Adalib_Dir (Path : String) is
+ begin
+ if Path'Length = 0 then
+ Adalib_Path := null;
+ else
+ Adalib_Path := new String'(Path);
+ end if;
+ end Specify_Adalib_Dir;
+
end MLib.Utl;
diff --git a/gcc/ada/mlib-utl.ads b/gcc/ada/mlib-utl.ads
index fc5894f70e2..f91eebf7f51 100644
--- a/gcc/ada/mlib-utl.ads
+++ b/gcc/ada/mlib-utl.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2001-2007, AdaCore --
+-- Copyright (C) 2001-2008, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -47,12 +47,21 @@ package MLib.Utl is
procedure Ar
(Output_File : String;
Objects : Argument_List);
- -- Run ar to move all the binaries inside the archive. If ranlib is on the
- -- path, run it also. Output_File is the path name of the archive to
+ -- Run ar to move all the binaries inside the archive. If ranlib is on
+ -- the path, run it also. Output_File is the path name of the archive to
-- create. Objects is the list of the path names of the object files to be
- -- put in the archive.
+ -- put in the archive. This procedure currently assumes that it is always
+ -- called in the context of gnatmake. If other executables start using this
+ -- procedure, an additional parameter would need to be added, and calls to
+ -- Osint.Program_Name updated accordingly in the body.
function Lib_Directory return String;
-- Return the directory containing libgnat
+ procedure Specify_Adalib_Dir (Path : String);
+ -- Specify the path of the GNAT adalib directory, to be returned by
+ -- function Lib_Directory without looking for it. This is used only in
+ -- gprlib, because we cannot rely on the search in Lib_Directory, as the
+ -- GNAT version may be different for gprbuild/gprlib and the compiler.
+
end MLib.Utl;
diff --git a/gcc/ada/mlib.adb b/gcc/ada/mlib.adb
index b0301d2817c..f037bdb144e 100644
--- a/gcc/ada/mlib.adb
+++ b/gcc/ada/mlib.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1999-2007, AdaCore --
+-- Copyright (C) 1999-2008, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -263,11 +263,16 @@ package body MLib is
-- Set Success to True only if the newly
-- created file has been correctly written.
- Success := Status and Actual_Len = Len + 3;
+ Success := Status and then Actual_Len = Len + 3;
if Success then
- Set_Read_Only (
- Name_Buffer (1 .. Name_Len - 1));
+
+ -- Set_Read_Only is used here, rather than
+ -- Set_Non_Writable, so that gprbuild can
+ -- he compiled with older compilers.
+
+ Set_Read_Only
+ (Name_Buffer (1 .. Name_Len - 1));
end if;
end if;
end if;
@@ -310,18 +315,9 @@ package body MLib is
pragma Unreferenced (Success, Result);
begin
- if Is_Absolute_Path (Lib_Version) then
- Version_Path := new String (1 .. Lib_Version'Length + 1);
- Version_Path (1 .. Lib_Version'Length) := Lib_Version;
-
- else
- Version_Path :=
- new String (1 .. Lib_Dir'Length + 1 + Lib_Version'Length + 1);
- Version_Path (1 .. Version_Path'Last - 1) :=
- Lib_Dir & Directory_Separator & Lib_Version;
- end if;
-
- Version_Path (Version_Path'Last) := ASCII.NUL;
+ Version_Path := new String (1 .. Lib_Version'Length + 1);
+ Version_Path (1 .. Lib_Version'Length) := Lib_Version;
+ Version_Path (Version_Path'Last) := ASCII.NUL;
if Maj_Version'Length = 0 then
declare
@@ -339,6 +335,7 @@ package body MLib is
Maj_Path : constant String :=
Lib_Dir & Directory_Separator & Maj_Version;
Newpath2 : String (1 .. Maj_Path'Length + 1);
+ Maj_Ver : String (1 .. Maj_Version'Length + 1);
begin
Newpath1 (1 .. Lib_Path'Length) := Lib_Path;
@@ -347,13 +344,16 @@ package body MLib is
Newpath2 (1 .. Maj_Path'Length) := Maj_Path;
Newpath2 (Newpath2'Last) := ASCII.NUL;
+ Maj_Ver (1 .. Maj_Version'Length) := Maj_Version;
+ Maj_Ver (Maj_Ver'Last) := ASCII.NUL;
+
Delete_File (Maj_Path, Success);
Result := Symlink (Version_Path (1)'Address, Newpath2'Address);
Delete_File (Lib_Path, Success);
- Result := Symlink (Newpath2'Address, Newpath1'Address);
+ Result := Symlink (Maj_Ver'Address, Newpath1'Address);
end;
end if;
end Create_Sym_Links;
diff --git a/gcc/ada/opt.ads b/gcc/ada/opt.ads
index 600231c737a..b0bde56b50d 100644
--- a/gcc/ada/opt.ads
+++ b/gcc/ada/opt.ads
@@ -528,6 +528,11 @@ package Opt is
-- the name is of the form .xxx, then to name.xxx where name is the source
-- file name with extension stripped.
+ Generate_Processed_File : Boolean := False;
+ -- GNAT
+ -- True when switch -gnateG is used. When True, create in a file
+ -- <source>.prep, if the source is preprocessed.
+
Generating_Code : Boolean := False;
-- GNAT
-- True if the frontend finished its work and has called the backend to
@@ -1235,6 +1240,12 @@ package Opt is
-- Set to True to generate warnings for static fixed-point expression
-- values that are not an exact multiple of the small value of the type.
+ Warn_On_Biased_Representation : Boolean := True;
+ -- GNAT
+ -- Set to True to generate warnings for size clauses, component clauses
+ -- and component_size clauses that force biased representation. Set False
+ -- by -gnatw.B.
+
Warn_On_Constant : Boolean := False;
-- GNAT
-- Set to True to generate warnings for variables that could be declared
diff --git a/gcc/ada/osint.ads b/gcc/ada/osint.ads
index 6cf7530f7fe..897779b178e 100644
--- a/gcc/ada/osint.ads
+++ b/gcc/ada/osint.ads
@@ -113,13 +113,13 @@ package Osint is
-- to "<target>-gcc". In the specific case where AAMP_On_Target is set, the
-- name "gcc" is mapped to "gnaamp", and names of the form "gnat*" are
-- mapped to "gnaamp*". This function clobbers Name_Buffer and Name_Len.
- -- Also look at any suffix, e.g. gnatmake-4.1 -> "gcc-4.1".
- -- Prog is the default name of the current program being executed, e.g.
- -- "gnatmake", "gnatlink".
+ -- Also look at any suffix, e.g. gnatmake-4.1 -> "gcc-4.1". Prog is the
+ -- default name of the current program being executed, e.g. "gnatmake",
+ -- "gnatlink".
procedure Write_Program_Name;
- -- Writes name of program as invoked to the current output
- -- (normally standard output).
+ -- Writes name of program as invoked to the current output (normally
+ -- standard output).
procedure Fail (S1 : String; S2 : String := ""; S3 : String := "");
pragma No_Return (Fail);
@@ -243,8 +243,8 @@ package Osint is
-- modified by update_path.
procedure Add_Default_Search_Dirs;
- -- This routine adds the default search dirs indicated by the
- -- environment variables and sdefault package.
+ -- This routine adds the default search dirs indicated by the environment
+ -- variables and sdefault package.
procedure Add_Lib_Search_Dir (Dir : String);
-- Add Dir at the end of the library file search path
@@ -256,11 +256,11 @@ package Osint is
(Search_Path : String_Access);
function Get_Next_Dir_In_Path
(Search_Path : String_Access) return String_Access;
- -- These subprograms are used to parse out the directory names in a
- -- search path specified by a Search_Path argument. The procedure
- -- initializes an internal pointer to point to the initial directory
- -- name, and calls to the function return successive directory names,
- -- with a null pointer marking the end of the list.
+ -- These subprograms are used to parse out the directory names in a search
+ -- path specified by a Search_Path argument. The procedure initializes an
+ -- internal pointer to point to the initial directory name, and calls to
+ -- the function return successive directory names, with a null pointer
+ -- marking the end of the list.
type Search_File_Type is (Include, Objects);
@@ -347,10 +347,9 @@ package Osint is
-- LF/CR
-- LF
- -- The source is terminated by an EOF (16#1A#) character, which is
- -- the last character of the returned source buffer (note that any
- -- EOF characters in positions other than the last source character
- -- are treated as representing blanks).
+ -- The source is terminated by an EOF (16#1A#) character, which is the last
+ -- character of the returned source buffer (note that any EOF characters in
+ -- positions other than the last source character are treated as blanks).
--
-- The logical lower bound of the source buffer is the input value of Lo,
-- and on exit Hi is set to the logical upper bound of the source buffer.
diff --git a/gcc/ada/par-ch10.adb b/gcc/ada/par-ch10.adb
index eb16fb1737b..f433352b06d 100644
--- a/gcc/ada/par-ch10.adb
+++ b/gcc/ada/par-ch10.adb
@@ -115,7 +115,7 @@ package body Ch10 is
P : Node_Id;
SR_Present : Boolean;
- Cunit_Error_Flag : Boolean := False;
+ Cunit_Error_Flag : Boolean := False;
-- This flag is set True if we have to scan for a compilation unit
-- token. It is used to ensure clean termination in such cases by
-- not insisting on being at the end of file, and, in the syntax only
@@ -140,8 +140,8 @@ package body Ch10 is
Config_Pragmas := No_List;
- -- If we have an initial Source_Reference pragma, then remember
- -- the fact to generate an NR parameter in the output line.
+ -- If we have an initial Source_Reference pragma, then remember the fact
+ -- to generate an NR parameter in the output line.
SR_Present := False;
@@ -180,8 +180,7 @@ package body Ch10 is
Item := P_Pragma;
if Item = Error
- or else not
- Is_Configuration_Pragma_Name (Pragma_Name (Item))
+ or else not Is_Configuration_Pragma_Name (Pragma_Name (Item))
then
Restore_Scan_State (Scan_State);
exit;
diff --git a/gcc/ada/par-ch3.adb b/gcc/ada/par-ch3.adb
index c2ec59be9dc..9a5a8d39345 100644
--- a/gcc/ada/par-ch3.adb
+++ b/gcc/ada/par-ch3.adb
@@ -206,6 +206,18 @@ package body Ch3 is
Ident_Node := Token_Node;
Scan; -- past the reserved identifier
+ -- If we already have a defining identifier, clean it out and make
+ -- a new clean identifier. This situation arises in some error cases
+ -- and we need to fix it.
+
+ if Nkind (Ident_Node) = N_Defining_Identifier then
+ Ident_Node :=
+ Make_Identifier (Sloc (Ident_Node),
+ Chars => Chars (Ident_Node));
+ end if;
+
+ -- Change identifier to defining identifier if not in error
+
if Ident_Node /= Error then
Change_Identifier_To_Defining_Identifier (Ident_Node);
end if;
@@ -290,20 +302,12 @@ package body Ch3 is
Scan; -- past TYPE
Ident_Node := P_Defining_Identifier (C_Is);
- -- Otherwise this is an error case, and we may already have converted
- -- the current token to a defining identifier, so don't do it again!
+ -- Otherwise this is an error case
else
T_Type;
-
- if Token = Tok_Identifier
- and then Nkind (Token_Node) = N_Defining_Identifier
- then
- Ident_Node := Token_Node;
- Scan; -- past defining identifier
- else
- Ident_Node := P_Defining_Identifier (C_Is);
- end if;
+ Type_Token_Location := Type_Loc;
+ Ident_Node := P_Defining_Identifier (C_Is);
end if;
Discr_Sloc := Token_Ptr;
@@ -1356,7 +1360,6 @@ package body Ch3 is
-- If we have a comma, then scan out the list of identifiers
elsif Token = Tok_Comma then
-
while Comma_Present loop
Num_Idents := Num_Idents + 1;
Idents (Num_Idents) := P_Defining_Identifier (C_Comma_Colon);
diff --git a/gcc/ada/par-prag.adb b/gcc/ada/par-prag.adb
index c8b84ab189e..ba32f387b6a 100644
--- a/gcc/ada/par-prag.adb
+++ b/gcc/ada/par-prag.adb
@@ -1032,6 +1032,10 @@ begin
raise Constraint_Error;
end if;
+ Upper_Half_Encoding :=
+ Wide_Character_Encoding_Method in
+ WC_Upper_Half_Encoding_Method;
+
exception
when Constraint_Error =>
Error_Msg_N ("invalid argument for pragma%", Arg1);
diff --git a/gcc/ada/prep.adb b/gcc/ada/prep.adb
index eb739a75274..c1f4a5e780b 100644
--- a/gcc/ada/prep.adb
+++ b/gcc/ada/prep.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2002-2007, Free Software Foundation, Inc. --
+-- Copyright (C) 2002-2008, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -1043,10 +1043,12 @@ package body Prep is
-- Preprocess --
----------------
- procedure Preprocess is
+ procedure Preprocess (Source_Modified : out Boolean) is
Start_Of_Processing : Source_Ptr;
Cond : Boolean;
Preprocessor_Line : Boolean := False;
+ No_Error_Found : Boolean := True;
+ Modified : Boolean := False;
procedure Output (From, To : Source_Ptr);
-- Output the characters with indices From .. To in the buffer
@@ -1118,75 +1120,21 @@ package body Prep is
-- Preprocessor line
if Token = Tok_Special and then Special_Character = '#' then
- Preprocessor_Line := True;
- Scan.all;
-
- case Token is
-
- -- #if
-
- when Tok_If =>
- declare
- If_Ptr : constant Source_Ptr := Token_Ptr;
-
- begin
- Scan.all;
- Cond := Expression (not Deleting);
-
- -- Check for an eventual "then"
-
- if Token = Tok_Then then
- Scan.all;
- end if;
-
- -- It is an error to have trailing characters after
- -- the condition or "then".
-
- if Token /= Tok_End_Of_Line
- and then Token /= Tok_EOF
- then
- Error_Msg
- ("extraneous text on preprocessor line",
- Token_Ptr);
- Go_To_End_Of_Line;
- end if;
-
- declare
- -- Set the initial state of this new "#if".
- -- This must be done before incrementing the
- -- Last of the table, otherwise function
- -- Deleting does not report the correct value.
-
- New_State : constant Pp_State :=
- (If_Ptr => If_Ptr,
- Else_Ptr => 0,
- Deleting => Deleting or (not Cond),
- Match_Seen => Deleting or Cond);
-
- begin
- Pp_States.Increment_Last;
- Pp_States.Table (Pp_States.Last) := New_State;
- end;
- end;
-
- -- #elsif
+ Modified := True;
+ Preprocessor_Line := True;
+ Scan.all;
- when Tok_Elsif =>
- Cond := False;
+ case Token is
- if Pp_States.Last = 0
- or else Pp_States.Table (Pp_States.Last).Else_Ptr
- /= 0
- then
- Error_Msg ("no IF for this ELSIF", Token_Ptr);
+ -- #if
- else
- Cond :=
- not Pp_States.Table (Pp_States.Last).Match_Seen;
- end if;
+ when Tok_If =>
+ declare
+ If_Ptr : constant Source_Ptr := Token_Ptr;
+ begin
Scan.all;
- Cond := Expression (Cond);
+ Cond := Expression (not Deleting);
-- Check for an eventual "then"
@@ -1203,136 +1151,201 @@ package body Prep is
Error_Msg
("extraneous text on preprocessor line",
Token_Ptr);
-
+ No_Error_Found := False;
Go_To_End_Of_Line;
end if;
- -- Depending on the value of the condition, set the
- -- new values of Deleting and Match_Seen.
- if Pp_States.Last > 0 then
- if Pp_States.Table (Pp_States.Last).Match_Seen then
- Pp_States.Table (Pp_States.Last).Deleting :=
- True;
- else
- if Cond then
- Pp_States.Table (Pp_States.Last).Match_Seen :=
- True;
- Pp_States.Table (Pp_States.Last).Deleting :=
- False;
- end if;
- end if;
- end if;
+ declare
+ -- Set the initial state of this new "#if". This
+ -- must be done before incrementing the Last of
+ -- the table, otherwise function Deleting does
+ -- not report the correct value.
- -- #else
+ New_State : constant Pp_State :=
+ (If_Ptr => If_Ptr,
+ Else_Ptr => 0,
+ Deleting => Deleting or (not Cond),
+ Match_Seen => Deleting or Cond);
- when Tok_Else =>
- if Pp_States.Last = 0 then
- Error_Msg ("no IF for this ELSE", Token_Ptr);
+ begin
+ Pp_States.Increment_Last;
+ Pp_States.Table (Pp_States.Last) := New_State;
+ end;
+ end;
- elsif
- Pp_States.Table (Pp_States.Last).Else_Ptr /= 0
- then
- Error_Msg ("duplicate ELSE line", Token_Ptr);
- end if;
+ -- #elsif
- -- Set the possibly new values of Deleting and
- -- Match_Seen.
+ when Tok_Elsif =>
+ Cond := False;
- if Pp_States.Last > 0 then
- if Pp_States.Table (Pp_States.Last).Match_Seen then
- Pp_States.Table (Pp_States.Last).Deleting :=
- True;
+ if Pp_States.Last = 0
+ or else Pp_States.Table (Pp_States.Last).Else_Ptr /= 0
+ then
+ Error_Msg ("no IF for this ELSIF", Token_Ptr);
+ No_Error_Found := False;
- else
+ else
+ Cond :=
+ not Pp_States.Table (Pp_States.Last).Match_Seen;
+ end if;
+
+ Scan.all;
+ Cond := Expression (Cond);
+
+ -- Check for an eventual "then"
+
+ if Token = Tok_Then then
+ Scan.all;
+ end if;
+
+ -- It is an error to have trailing characters after
+ -- the condition or "then".
+
+ if Token /= Tok_End_Of_Line
+ and then Token /= Tok_EOF
+ then
+ Error_Msg
+ ("extraneous text on preprocessor line",
+ Token_Ptr);
+ No_Error_Found := False;
+
+ Go_To_End_Of_Line;
+ end if;
+
+ -- Depending on the value of the condition, set the
+ -- new values of Deleting and Match_Seen.
+ if Pp_States.Last > 0 then
+ if Pp_States.Table (Pp_States.Last).Match_Seen then
+ Pp_States.Table (Pp_States.Last).Deleting := True;
+ else
+ if Cond then
Pp_States.Table (Pp_States.Last).Match_Seen :=
True;
Pp_States.Table (Pp_States.Last).Deleting :=
False;
end if;
+ end if;
+ end if;
- -- Set the Else_Ptr to check for illegal #elsif
- -- later.
+ -- #else
- Pp_States.Table (Pp_States.Last).Else_Ptr :=
- Token_Ptr;
- end if;
+ when Tok_Else =>
+ if Pp_States.Last = 0 then
+ Error_Msg ("no IF for this ELSE", Token_Ptr);
+ No_Error_Found := False;
- Scan.all;
+ elsif
+ Pp_States.Table (Pp_States.Last).Else_Ptr /= 0
+ then
+ Error_Msg ("duplicate ELSE line", Token_Ptr);
+ No_Error_Found := False;
+ end if;
- -- It is an error to have characters after "#else"
- if Token /= Tok_End_Of_Line
- and then Token /= Tok_EOF
- then
- Error_Msg
- ("extraneous text on preprocessor line",
- Token_Ptr);
- Go_To_End_Of_Line;
- end if;
+ -- Set the possibly new values of Deleting and
+ -- Match_Seen.
- -- #end if;
+ if Pp_States.Last > 0 then
+ if Pp_States.Table (Pp_States.Last).Match_Seen then
+ Pp_States.Table (Pp_States.Last).Deleting :=
+ True;
- when Tok_End =>
- if Pp_States.Last = 0 then
- Error_Msg ("no IF for this END", Token_Ptr);
+ else
+ Pp_States.Table (Pp_States.Last).Match_Seen :=
+ True;
+ Pp_States.Table (Pp_States.Last).Deleting :=
+ False;
end if;
+ -- Set the Else_Ptr to check for illegal #elsif
+ -- later.
+
+ Pp_States.Table (Pp_States.Last).Else_Ptr :=
+ Token_Ptr;
+ end if;
+
+ Scan.all;
+
+ -- It is an error to have characters after "#else"
+ if Token /= Tok_End_Of_Line
+ and then Token /= Tok_EOF
+ then
+ Error_Msg
+ ("extraneous text on preprocessor line",
+ Token_Ptr);
+ No_Error_Found := False;
+ Go_To_End_Of_Line;
+ end if;
+
+ -- #end if;
+
+ when Tok_End =>
+ if Pp_States.Last = 0 then
+ Error_Msg ("no IF for this END", Token_Ptr);
+ No_Error_Found := False;
+ end if;
+
+ Scan.all;
+
+ if Token /= Tok_If then
+ Error_Msg ("IF expected", Token_Ptr);
+ No_Error_Found := False;
+
+ else
Scan.all;
- if Token /= Tok_If then
- Error_Msg ("IF expected", Token_Ptr);
+ if Token /= Tok_Semicolon then
+ Error_Msg ("`;` Expected", Token_Ptr);
+ No_Error_Found := False;
else
Scan.all;
- if Token /= Tok_Semicolon then
- Error_Msg ("`;` Expected", Token_Ptr);
-
- else
- Scan.all;
-
- -- It is an error to have character after
- -- "#end if;".
- if Token /= Tok_End_Of_Line
- and then Token /= Tok_EOF
- then
- Error_Msg
- ("extraneous text on preprocessor line",
- Token_Ptr);
- end if;
+ -- It is an error to have character after
+ -- "#end if;".
+ if Token /= Tok_End_Of_Line
+ and then Token /= Tok_EOF
+ then
+ Error_Msg
+ ("extraneous text on preprocessor line",
+ Token_Ptr);
+ No_Error_Found := False;
end if;
end if;
+ end if;
- -- In case of one of the errors above, skip the tokens
- -- until the end of line is reached.
+ -- In case of one of the errors above, skip the tokens
+ -- until the end of line is reached.
- Go_To_End_Of_Line;
+ Go_To_End_Of_Line;
- -- Decrement the depth of the #if stack
+ -- Decrement the depth of the #if stack
- if Pp_States.Last > 0 then
- Pp_States.Decrement_Last;
- end if;
+ if Pp_States.Last > 0 then
+ Pp_States.Decrement_Last;
+ end if;
- -- Illegal preprocessor line
+ -- Illegal preprocessor line
- when others =>
- if Pp_States.Last = 0 then
- Error_Msg ("IF expected", Token_Ptr);
+ when others =>
+ No_Error_Found := False;
- elsif
- Pp_States.Table (Pp_States.Last).Else_Ptr = 0
- then
- Error_Msg ("IF, ELSIF, ELSE, or `END IF` expected",
- Token_Ptr);
+ if Pp_States.Last = 0 then
+ Error_Msg ("IF expected", Token_Ptr);
- else
- Error_Msg ("IF or `END IF` expected", Token_Ptr);
- end if;
+ elsif
+ Pp_States.Table (Pp_States.Last).Else_Ptr = 0
+ then
+ Error_Msg ("IF, ELSIF, ELSE, or `END IF` expected",
+ Token_Ptr);
+
+ else
+ Error_Msg ("IF or `END IF` expected", Token_Ptr);
+ end if;
- -- Skip to the end of this illegal line
+ -- Skip to the end of this illegal line
- Go_To_End_Of_Line;
- end case;
+ Go_To_End_Of_Line;
+ end case;
-- Not a preprocessor line
@@ -1352,6 +1365,8 @@ package body Prep is
if Token = Tok_Special
and then Special_Character = '$'
then
+ Modified := True;
+
declare
Dollar_Ptr : constant Source_Ptr := Token_Ptr;
Symbol : Symbol_Id;
@@ -1449,7 +1464,10 @@ package body Prep is
for Level in reverse 1 .. Pp_States.Last loop
Error_Msg ("no `END IF` for this IF", Pp_States.Table (Level).If_Ptr);
+ No_Error_Found := False;
end loop;
+
+ Source_Modified := No_Error_Found and Modified;
end Preprocess;
end Prep;
diff --git a/gcc/ada/prep.ads b/gcc/ada/prep.ads
index 198ddb4159f..0f595e64dfb 100644
--- a/gcc/ada/prep.ads
+++ b/gcc/ada/prep.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2002-2007, Free Software Foundation, Inc. --
+-- Copyright (C) 2002-2008, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -106,9 +106,10 @@ package Prep is
-- Parse the definition file. The definition file must have already been
-- loaded and the scanner initialized.
- procedure Preprocess;
+ procedure Preprocess (Source_Modified : out Boolean);
-- Preprocess the input file. The input file must have already been loaded
- -- and the scanner initialized.
+ -- and the scanner initialized. Source_Modified is set to True iff the
+ -- preprocessor modified the source text.
procedure Check_Command_Line_Symbol_Definition
(Definition : String;
diff --git a/gcc/ada/prj-attr-pm.adb b/gcc/ada/prj-attr-pm.adb
index 2c509eeca66..ef843c05b5b 100644
--- a/gcc/ada/prj-attr-pm.adb
+++ b/gcc/ada/prj-attr-pm.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2004-2007, Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2008, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -45,6 +45,7 @@ package body Prj.Attr.PM is
Optional_Index => False,
Attr_Kind => Unknown,
Read_Only => False,
+ Others_Allowed => False,
Next =>
Package_Attributes.Table (To_Package.Value).First_Attribute);
Package_Attributes.Table (To_Package.Value).First_Attribute :=
diff --git a/gcc/ada/prj-attr.adb b/gcc/ada/prj-attr.adb
index 6f6c888b4e6..63651f94d9b 100644
--- a/gcc/ada/prj-attr.adb
+++ b/gcc/ada/prj-attr.adb
@@ -56,6 +56,8 @@ package body Prj.Attr is
-- The third optional letter is
-- 'R' to indicate that the attribute is read-only
+ -- 'O' to indicate that others is allowed as an index for an associative
+ -- array
-- End is indicated by two consecutive '#'
@@ -159,7 +161,7 @@ package body Prj.Attr is
"Pcompiler#" &
"Ladefault_switches#" &
- "Lcswitches#" &
+ "LcOswitches#" &
"SVlocal_configuration_pragmas#" &
"Salocal_config_file#" &
@@ -168,6 +170,7 @@ package body Prj.Attr is
"Sadriver#" &
"Larequired_switches#" &
"Lapic_option#" &
+ "Sapath_syntax#" &
-- Configuration - Mapping files
@@ -199,7 +202,8 @@ package body Prj.Attr is
"Pbuilder#" &
"Ladefault_switches#" &
- "Lcswitches#" &
+ "LcOswitches#" &
+ "Lcglobal_compilation_switches#" &
"Scexecutable#" &
"SVexecutable_suffix#" &
"SVglobal_configuration_pragmas#" &
@@ -214,7 +218,7 @@ package body Prj.Attr is
"Pbinder#" &
"Ladefault_switches#" &
- "Lcswitches#" &
+ "LcOswitches#" &
-- Configuration - Binding
@@ -229,7 +233,7 @@ package body Prj.Attr is
"Plinker#" &
"LVrequired_switches#" &
"Ladefault_switches#" &
- "Lcswitches#" &
+ "LcOswitches#" &
"LVlinker_options#" &
"SVmap_file_option#" &
@@ -244,49 +248,49 @@ package body Prj.Attr is
"Pcross_reference#" &
"Ladefault_switches#" &
- "Lbswitches#" &
+ "LbOswitches#" &
-- package Finder
"Pfinder#" &
"Ladefault_switches#" &
- "Lbswitches#" &
+ "LbOswitches#" &
-- package Pretty_Printer
"Ppretty_printer#" &
"Ladefault_switches#" &
- "Lbswitches#" &
+ "LbOswitches#" &
-- package gnatstub
"Pgnatstub#" &
"Ladefault_switches#" &
- "Lbswitches#" &
+ "LbOswitches#" &
-- package Check
"Pcheck#" &
"Ladefault_switches#" &
- "Lbswitches#" &
+ "LbOswitches#" &
-- package Synchronize
"Psynchronize#" &
"Ladefault_switches#" &
- "Lbswitches#" &
+ "LbOswitches#" &
-- package Eliminate
"Peliminate#" &
"Ladefault_switches#" &
- "Lbswitches#" &
+ "LbOswitches#" &
-- package Metrics
"Pmetrics#" &
"Ladefault_switches#" &
- "Lbswitches#" &
+ "LbOswitches#" &
-- package Ide
@@ -409,6 +413,7 @@ package body Prj.Attr is
Attribute_Name : Name_Id := No_Name;
First_Attribute : Attr_Node_Id := Attr.First_Attribute;
Read_Only : Boolean;
+ Others_Allowed : Boolean;
function Attribute_Location return String;
-- Returns a string depending if we are in the project level attributes
@@ -536,12 +541,16 @@ package body Prj.Attr is
Start := Start + 1;
+ Read_Only := False;
+ Others_Allowed := False;
+
if Initialization_Data (Start) = 'R' then
Read_Only := True;
Start := Start + 1;
- else
- Read_Only := False;
+ elsif Initialization_Data (Start) = 'O' then
+ Others_Allowed := True;
+ Start := Start + 1;
end if;
Finish := Start;
@@ -584,6 +593,7 @@ package body Prj.Attr is
Optional_Index => Optional_Index,
Attr_Kind => Attr_Kind,
Read_Only => Read_Only,
+ Others_Allowed => Others_Allowed,
Next => Empty_Attr);
Start := Finish + 1;
end if;
@@ -641,6 +651,17 @@ package body Prj.Attr is
end if;
end Optional_Index_Of;
+ function Others_Allowed_For
+ (Attribute : Attribute_Node_Id) return Boolean
+ is
+ begin
+ if Attribute = Empty_Attribute then
+ return False;
+ else
+ return Attrs.Table (Attribute.Value).Others_Allowed;
+ end if;
+ end Others_Allowed_For;
+
-----------------------
-- Package_Name_List --
-----------------------
@@ -748,6 +769,7 @@ package body Prj.Attr is
Optional_Index => Opt_Index,
Attr_Kind => Real_Attr_Kind,
Read_Only => False,
+ Others_Allowed => False,
Next => First_Attr);
Package_Attributes.Table (In_Package.Value).First_Attribute :=
@@ -854,6 +876,7 @@ package body Prj.Attr is
Optional_Index => Attributes (Index).Opt_Index,
Attr_Kind => Attr_Kind,
Read_Only => False,
+ Others_Allowed => False,
Next => First_Attr);
First_Attr := Attrs.Last;
end loop;
diff --git a/gcc/ada/prj-attr.ads b/gcc/ada/prj-attr.ads
index 473ea53dd8c..d1839e527d1 100644
--- a/gcc/ada/prj-attr.ads
+++ b/gcc/ada/prj-attr.ads
@@ -169,6 +169,9 @@ package Prj.Attr is
-- Returns Empty_Attribute if After is either Empty_Attribute or is the
-- last of the list.
+ function Others_Allowed_For (Attribute : Attribute_Node_Id) return Boolean;
+ -- True iff the index for an associative array attributes may be others
+
--------------
-- Packages --
--------------
@@ -282,6 +285,7 @@ private
Optional_Index : Boolean;
Attr_Kind : Attribute_Kind;
Read_Only : Boolean;
+ Others_Allowed : Boolean;
Next : Attr_Node_Id;
end record;
-- Data for an attribute
diff --git a/gcc/ada/prj-dect.adb b/gcc/ada/prj-dect.adb
index 1e15fb207da..37ae74bfb10 100644
--- a/gcc/ada/prj-dect.adb
+++ b/gcc/ada/prj-dect.adb
@@ -223,8 +223,9 @@ package body Prj.Dect is
else
if Is_Read_Only (Current_Attribute) then
+ Error_Msg_Name_1 := Token_Name;
Error_Msg
- ("read-only attribute cannot be given a value",
+ ("read-only attribute %% cannot be given a value",
Token_Ptr);
end if;
@@ -284,20 +285,33 @@ package body Prj.Dect is
end if;
Scan (In_Tree); -- past the left parenthesis
- Expect (Tok_String_Literal, "literal string");
- if Token = Tok_String_Literal then
- Get_Name_String (Token_Name);
+ if Others_Allowed_For (Current_Attribute)
+ and then Token = Tok_Others
+ then
+ Set_Associative_Array_Index_Of
+ (Attribute, In_Tree, All_Other_Names);
+ Scan (In_Tree); -- past others
- if Case_Insensitive (Attribute, In_Tree) then
- To_Lower (Name_Buffer (1 .. Name_Len));
+ else
+ if Others_Allowed_For (Current_Attribute) then
+ Expect (Tok_String_Literal, "literal string or others");
+ else
+ Expect (Tok_String_Literal, "literal string");
end if;
- Set_Associative_Array_Index_Of (Attribute, In_Tree, Name_Find);
- Scan (In_Tree); -- past the literal string index
+ if Token = Tok_String_Literal then
+ Get_Name_String (Token_Name);
- if Token = Tok_At then
- case Attribute_Kind_Of (Current_Attribute) is
+ if Case_Insensitive (Attribute, In_Tree) then
+ To_Lower (Name_Buffer (1 .. Name_Len));
+ end if;
+
+ Set_Associative_Array_Index_Of (Attribute, In_Tree, Name_Find);
+ Scan (In_Tree); -- past the literal string index
+
+ if Token = Tok_At then
+ case Attribute_Kind_Of (Current_Attribute) is
when Optional_Index_Associative_Array |
Optional_Index_Case_Insensitive_Associative_Array =>
Scan (In_Tree);
@@ -329,7 +343,8 @@ package body Prj.Dect is
if Token = Tok_Integer_Literal then
Scan (In_Tree);
end if;
- end case;
+ end case;
+ end if;
end if;
end if;
diff --git a/gcc/ada/prj-env.adb b/gcc/ada/prj-env.adb
index dd52f353287..1744716342d 100644
--- a/gcc/ada/prj-env.adb
+++ b/gcc/ada/prj-env.adb
@@ -2353,18 +2353,38 @@ package body Prj.Env is
(Data.Object_Directory.Name, In_Tree);
end if;
- -- For a non-library project, add the object
- -- directory, if it is not a virtual project, and if
- -- there are Ada sources or if the project is an
- -- extending project. If there are no Ada sources,
- -- adding the object directory could disrupt the order
- -- of the object dirs in the path.
-
- elsif not Data.Virtual
- and then There_Are_Ada_Sources (In_Tree, Project)
- then
- Add_To_Object_Path
- (Data.Object_Directory.Name, In_Tree);
+ -- For a non-library project, add object directory if
+ -- it is not a virtual project, and if there are Ada
+ -- sources in the project or one of the projects it
+ -- extends. If there are no Ada sources, adding the
+ -- object directory could disrupt the order of the
+ -- object dirs in the path.
+
+ elsif not Data.Virtual then
+ declare
+ Add_Object_Dir : Boolean := False;
+ Prj : Project_Id := Project;
+
+ begin
+ while not Add_Object_Dir
+ and then Prj /= No_Project
+ loop
+ if In_Tree.Projects.Table
+ (Prj).Ada_Sources /= Nil_String
+ then
+ Add_Object_Dir := True;
+
+ else
+ Prj :=
+ In_Tree.Projects.Table (Prj).Extends;
+ end if;
+ end loop;
+
+ if Add_Object_Dir then
+ Add_To_Object_Path
+ (Data.Object_Directory.Name, In_Tree);
+ end if;
+ end;
end if;
end if;
end if;
diff --git a/gcc/ada/prj-makr.ads b/gcc/ada/prj-makr.ads
index 50a97e93b51..b3a658fc3e9 100644
--- a/gcc/ada/prj-makr.ads
+++ b/gcc/ada/prj-makr.ads
@@ -73,6 +73,11 @@ package Prj.Makr is
-- check for non Ada sources.
--
-- At least one of Name_Patterns and Foreign_Patterns is not empty
+ --
+ -- Note that this procedure currently assumes that it is only used by
+ -- gnatname. If other processes start using it, then an additional
+ -- parameter would need to be added, and call to Osint.Program_Name
+ -- updated accordingly in the body.
procedure Finalize;
-- Write the configuration pragmas file or the project file indicated in a
diff --git a/gcc/ada/prj-nmsc.adb b/gcc/ada/prj-nmsc.adb
index d84ba7fbbf7..6f18c81034d 100644
--- a/gcc/ada/prj-nmsc.adb
+++ b/gcc/ada/prj-nmsc.adb
@@ -65,9 +65,6 @@ package body Prj.Nmsc is
ALI_Suffix : constant String := ".ali";
-- File suffix for ali files
- Object_Suffix : constant String := Get_Target_Object_Suffix.all;
- -- File suffix for object files
-
type Name_Location is record
Name : File_Name_Type;
Location : Source_Ptr;
@@ -267,20 +264,6 @@ package body Prj.Nmsc is
Data : in out Project_Data);
-- Check the configuration attributes for the project
- procedure Check_For_Source
- (File_Name : File_Name_Type;
- Path_Name : Path_Name_Type;
- Project : Project_Id;
- In_Tree : Project_Tree_Ref;
- Data : in out Project_Data;
- Location : Source_Ptr;
- Language : Language_Index;
- Suffix : String;
- Naming_Exception : Boolean);
- -- Check if a file, with name File_Name and path Path_Name, in a source
- -- directory is a source for language Language in project Project of
- -- project tree In_Tree. ???
-
procedure Check_If_Externally_Built
(Project : Project_Id;
In_Tree : Project_Tree_Ref;
@@ -369,15 +352,6 @@ package body Prj.Nmsc is
-- Current_Dir should represent the current directory, and is passed for
-- efficiency to avoid system calls to recompute it.
- procedure Find_Sources
- (Project : Project_Id;
- In_Tree : Project_Tree_Ref;
- Data : in out Project_Data;
- For_Language : Language_Index;
- Current_Dir : String);
- -- Find all the sources in all of the source directories of a project for
- -- a specified language.
-
procedure Search_Directories
(Project : Project_Id;
In_Tree : Project_Tree_Ref;
@@ -467,8 +441,7 @@ package body Prj.Nmsc is
-- Source_Names.
procedure Find_Explicit_Sources
- (Lang : Language_Index;
- Current_Dir : String;
+ (Current_Dir : String;
Project : Project_Id;
In_Tree : Project_Tree_Ref;
Data : in out Project_Data);
@@ -566,16 +539,6 @@ package body Prj.Nmsc is
-- Current_Dir should represent the current directory, and is passed for
-- efficiency to avoid system calls to recompute it.
- procedure Record_Other_Sources
- (Project : Project_Id;
- In_Tree : Project_Tree_Ref;
- Data : in out Project_Data;
- Language : Language_Index;
- Naming_Exceptions : Boolean);
- -- Record the sources of a language in a project. When Naming_Exceptions is
- -- True, mark the found sources as such, to later remove those that are not
- -- named in a list of sources.
-
procedure Remove_Source
(Id : Source_Id;
Replaced_By : Source_Id;
@@ -597,13 +560,6 @@ package body Prj.Nmsc is
(Data : Project_Data; In_Tree : Project_Tree_Ref);
-- List all the source directories of a project
- function Suffix_For
- (Language : Language_Index;
- Naming : Naming_Data;
- In_Tree : Project_Tree_Ref) return File_Name_Type;
- -- Get the suffix for the source of a language from a package naming. If
- -- not specified, return the default for the language.
-
procedure Warn_If_Not_Sources
(Project : Project_Id;
In_Tree : Project_Tree_Ref;
@@ -1339,12 +1295,14 @@ package body Prj.Nmsc is
while Element_Id /= No_Array_Element loop
Element := In_Tree.Array_Elements.Table (Element_Id);
- -- Get the name of the language
+ if Element.Index /= All_Other_Names then
- Get_Language_Index_Of (Element.Index);
+ -- Get the name of the language
- if Lang_Index /= No_Language_Index then
- case Current_Array.Name is
+ Get_Language_Index_Of (Element.Index);
+
+ if Lang_Index /= No_Language_Index then
+ case Current_Array.Name is
when Name_Driver =>
-- Attribute Driver (<language>)
@@ -1386,7 +1344,8 @@ package body Prj.Nmsc is
when others =>
null;
- end case;
+ end case;
+ end if;
end if;
Element_Id := Element.Next;
@@ -1449,18 +1408,20 @@ package body Prj.Nmsc is
while Element_Id /= No_Array_Element loop
Element := In_Tree.Array_Elements.Table (Element_Id);
- -- Get the name of the language
+ if Element.Index /= All_Other_Names then
- Get_Language_Index_Of (Element.Index);
+ -- Get the name of the language
- if Lang_Index /= No_Language_Index then
- case Current_Array.Name is
+ Get_Language_Index_Of (Element.Index);
+
+ if Lang_Index /= No_Language_Index then
+ case Current_Array.Name is
when Name_Dependency_Switches =>
-- Attribute Dependency_Switches (<language>)
if In_Tree.Languages_Data.Table
- (Lang_Index).Config.Dependency_Kind = None
+ (Lang_Index).Config.Dependency_Kind = None
then
In_Tree.Languages_Data.Table
(Lang_Index).Config.Dependency_Kind :=
@@ -1482,11 +1443,11 @@ package body Prj.Nmsc is
-- Attribute Dependency_Driver (<language>)
if In_Tree.Languages_Data.Table
- (Lang_Index).Config.Dependency_Kind = None
+ (Lang_Index).Config.Dependency_Kind = None
then
In_Tree.Languages_Data.Table
(Lang_Index).Config.Dependency_Kind :=
- Makefile;
+ Makefile;
end if;
List := Element.Value.Values;
@@ -1533,7 +1494,7 @@ package body Prj.Nmsc is
In_Tree.Languages_Data.Table
(Lang_Index).Config.Include_Path_File :=
- Element.Value.Value;
+ Element.Value.Value;
when Name_Driver =>
@@ -1543,16 +1504,32 @@ package body Prj.Nmsc is
In_Tree.Languages_Data.Table
(Lang_Index).Config.Compiler_Driver :=
- File_Name_Type (Element.Value.Value);
+ File_Name_Type (Element.Value.Value);
when Name_Required_Switches =>
Put (Into_List =>
In_Tree.Languages_Data.Table
(Lang_Index).Config.
- Compiler_Required_Switches,
+ Compiler_Required_Switches,
From_List => Element.Value.Values,
In_Tree => In_Tree);
+ when Name_Path_Syntax =>
+ begin
+ In_Tree.Languages_Data.Table
+ (Lang_Index).Config.Path_Syntax :=
+ Path_Syntax_Kind'Value
+ (Get_Name_String (Element.Value.Value));
+
+ exception
+ when Constraint_Error =>
+ Error_Msg
+ (Project,
+ In_Tree,
+ "invalid value for Path_Syntax",
+ Element.Value.Location);
+ end;
+
when Name_Pic_Option =>
-- Attribute Compiler_Pic_Option (<language>)
@@ -1624,8 +1601,8 @@ package body Prj.Nmsc is
end if;
Put (Into_List =>
- In_Tree.Languages_Data.Table
- (Lang_Index).Config.Config_File_Switches,
+ In_Tree.Languages_Data.Table
+ (Lang_Index).Config.Config_File_Switches,
From_List => List,
In_Tree => In_Tree);
@@ -1635,7 +1612,7 @@ package body Prj.Nmsc is
In_Tree.Languages_Data.Table
(Lang_Index).Config.Objects_Path :=
- Element.Value.Value;
+ Element.Value.Value;
when Name_Objects_Path_File =>
@@ -1643,7 +1620,7 @@ package body Prj.Nmsc is
In_Tree.Languages_Data.Table
(Lang_Index).Config.Objects_Path_File :=
- Element.Value.Value;
+ Element.Value.Value;
when Name_Config_Body_File_Name =>
@@ -1651,7 +1628,7 @@ package body Prj.Nmsc is
In_Tree.Languages_Data.Table
(Lang_Index).Config.Config_Body :=
- Element.Value.Value;
+ Element.Value.Value;
when Name_Config_Body_File_Name_Pattern =>
@@ -1668,7 +1645,7 @@ package body Prj.Nmsc is
In_Tree.Languages_Data.Table
(Lang_Index).Config.Config_Spec :=
- Element.Value.Value;
+ Element.Value.Value;
when Name_Config_Spec_File_Name_Pattern =>
@@ -1677,7 +1654,7 @@ package body Prj.Nmsc is
In_Tree.Languages_Data.Table
(Lang_Index).Config.Config_Spec_Pattern :=
- Element.Value.Value;
+ Element.Value.Value;
when Name_Config_File_Unique =>
@@ -1699,7 +1676,8 @@ package body Prj.Nmsc is
when others =>
null;
- end case;
+ end case;
+ end if;
end if;
Element_Id := Element.Next;
@@ -1722,8 +1700,7 @@ package body Prj.Nmsc is
Attribute_Id := Attributes;
while Attribute_Id /= No_Variable loop
- Attribute :=
- In_Tree.Variable_Elements.Table (Attribute_Id);
+ Attribute := In_Tree.Variable_Elements.Table (Attribute_Id);
if not Attribute.Value.Default then
if Attribute.Name = Name_Separate_Suffix then
@@ -2449,287 +2426,6 @@ package body Prj.Nmsc is
end loop;
end Check_Configuration;
- ----------------------
- -- Check_For_Source --
- ----------------------
-
- procedure Check_For_Source
- (File_Name : File_Name_Type;
- Path_Name : Path_Name_Type;
- Project : Project_Id;
- In_Tree : Project_Tree_Ref;
- Data : in out Project_Data;
- Location : Source_Ptr;
- Language : Language_Index;
- Suffix : String;
- Naming_Exception : Boolean)
- is
- Name : String := Get_Name_String (File_Name);
- Real_Location : Source_Ptr := Location;
-
- begin
- Canonical_Case_File_Name (Name);
-
- -- A file is a source of a language if Naming_Exception is True (case
- -- of naming exceptions) or if its file name ends with the suffix.
-
- if Naming_Exception
- or else
- (Name'Length > Suffix'Length
- and then
- Name (Name'Last - Suffix'Length + 1 .. Name'Last) = Suffix)
- then
- if Real_Location = No_Location then
- Real_Location := Data.Location;
- end if;
-
- declare
- Path_Id : Path_Name_Type;
- C_Path_Id : Path_Name_Type;
- -- The path name id (in canonical case)
-
- File_Id : File_Name_Type;
- -- The file name id (in canonical case)
-
- Obj_Id : File_Name_Type;
- -- The object file name
-
- Obj_Path_Id : Path_Name_Type;
- -- The object path name
-
- Dep_Id : File_Name_Type;
- -- The dependency file name
-
- Dep_Path_Id : Path_Name_Type;
- -- The dependency path name
-
- Dot_Pos : Natural := 0;
- -- Position of the last dot in Name
-
- Source : Other_Source;
- Source_Id : Other_Source_Id := Data.First_Other_Source;
-
- begin
- -- Get the file name id
-
- if Osint.File_Names_Case_Sensitive then
- File_Id := File_Name;
- else
- Name_Len := Name'Length;
- Name_Buffer (1 .. Name_Len) := Name;
- File_Id := Name_Find;
- end if;
-
- -- Get the path name id
-
- Path_Id := Path_Name;
-
- if Osint.File_Names_Case_Sensitive then
- C_Path_Id := Path_Name;
- else
- declare
- C_Path : String := Get_Name_String (Path_Name);
- begin
- Canonical_Case_File_Name (C_Path);
- Name_Len := C_Path'Length;
- Name_Buffer (1 .. Name_Len) := C_Path;
- C_Path_Id := Name_Find;
- end;
- end if;
-
- -- Find the position of the last dot
-
- for J in reverse Name'Range loop
- if Name (J) = '.' then
- Dot_Pos := J;
- exit;
- end if;
- end loop;
-
- if Dot_Pos <= Name'First then
- Dot_Pos := Name'Last + 1;
- end if;
-
- -- Compute the object file name
-
- Get_Name_String (File_Id);
- Name_Len := Dot_Pos - Name'First;
-
- for J in Object_Suffix'Range loop
- Name_Len := Name_Len + 1;
- Name_Buffer (Name_Len) := Object_Suffix (J);
- end loop;
-
- Obj_Id := Name_Find;
-
- -- Compute the object path name
-
- Get_Name_String (Data.Object_Directory.Display_Name);
-
- if Name_Buffer (Name_Len) /= Directory_Separator
- and then Name_Buffer (Name_Len) /= '/'
- then
- Name_Len := Name_Len + 1;
- Name_Buffer (Name_Len) := Directory_Separator;
- end if;
-
- Add_Str_To_Name_Buffer (Get_Name_String (Obj_Id));
- Obj_Path_Id := Name_Find;
-
- -- Compute the dependency file name
-
- Get_Name_String (File_Id);
- Name_Len := Dot_Pos - Name'First + 1;
- Name_Buffer (Name_Len) := '.';
- Name_Len := Name_Len + 1;
- Name_Buffer (Name_Len) := 'd';
- Dep_Id := Name_Find;
-
- -- Compute the dependency path name
-
- Get_Name_String (Data.Object_Directory.Display_Name);
-
- if Name_Buffer (Name_Len) /= Directory_Separator
- and then Name_Buffer (Name_Len) /= '/'
- then
- Name_Len := Name_Len + 1;
- Name_Buffer (Name_Len) := Directory_Separator;
- end if;
-
- Add_Str_To_Name_Buffer (Get_Name_String (Dep_Id));
- Dep_Path_Id := Name_Find;
-
- -- Check if source is already in the list of source for this
- -- project: it may have already been specified as a naming
- -- exception for the same language or an other language, or
- -- they may be two identical file names in different source
- -- directories.
-
- while Source_Id /= No_Other_Source loop
- Source := In_Tree.Other_Sources.Table (Source_Id);
-
- if Source.File_Name = File_Id then
- -- Two sources of different languages cannot have the same
- -- file name.
-
- if Source.Language /= Language then
- Error_Msg_File_1 := File_Name;
- Error_Msg
- (Project, In_Tree,
- "{ cannot be a source of several languages",
- Real_Location);
- return;
-
- -- No problem if a file has already been specified as
- -- a naming exception of this language.
-
- elsif Source.Path_Name = C_Path_Id then
-
- -- Reset the naming exception flag, if this is not a
- -- naming exception.
-
- if not Naming_Exception then
- In_Tree.Other_Sources.Table
- (Source_Id).Naming_Exception := False;
- end if;
-
- return;
-
- -- There are several files with the same names, but the
- -- order of the source directories is known (no /**):
- -- only the first one encountered is kept, the other ones
- -- are ignored.
-
- elsif Data.Known_Order_Of_Source_Dirs then
- return;
-
- -- But it is an error if the order of the source directories
- -- is not known.
-
- else
- Error_Msg_File_1 := File_Name;
- Error_Msg
- (Project, In_Tree,
- "{ is found in several source directories",
- Real_Location);
- return;
- end if;
-
- -- Two sources with different file names cannot have the same
- -- object file name.
-
- elsif Source.Object_Name = Obj_Id then
- Error_Msg_File_1 := File_Id;
- Error_Msg_File_2 := Source.File_Name;
- Error_Msg_File_3 := Obj_Id;
- Error_Msg
- (Project, In_Tree,
- "{ and { have the same object file {",
- Real_Location);
- return;
- end if;
-
- Source_Id := Source.Next;
- end loop;
-
- if Current_Verbosity = High then
- Write_Str (" found ");
- Display_Language_Name (Language);
- Write_Str (" source """);
- Write_Str (Get_Name_String (File_Name));
- Write_Line ("""");
- Write_Str (" object path = ");
- Write_Line (Get_Name_String (Obj_Path_Id));
- end if;
-
- -- Create the Other_Source record
-
- Source :=
- (Language => Language,
- File_Name => File_Id,
- Path_Name => Path_Id,
- Source_TS => File_Stamp (Path_Id),
- Object_Name => Obj_Id,
- Object_Path => Obj_Path_Id,
- Object_TS => File_Stamp (Obj_Path_Id),
- Dep_Name => Dep_Id,
- Dep_Path => Dep_Path_Id,
- Dep_TS => File_Stamp (Dep_Path_Id),
- Naming_Exception => Naming_Exception,
- Next => No_Other_Source);
-
- -- And add it to the Other_Sources table
-
- Other_Source_Table.Increment_Last (In_Tree.Other_Sources);
- In_Tree.Other_Sources.Table
- (Other_Source_Table.Last (In_Tree.Other_Sources)) := Source;
-
- -- There are sources of languages other than Ada in this project
-
- Data.Other_Sources_Present := True;
-
- -- And there are sources of this language in this project
-
- Set (Language, True, Data, In_Tree);
-
- -- Add this source to the list of sources of languages other than
- -- Ada of the project.
-
- if Data.First_Other_Source = No_Other_Source then
- Data.First_Other_Source :=
- Other_Source_Table.Last (In_Tree.Other_Sources);
-
- else
- In_Tree.Other_Sources.Table (Data.Last_Other_Source).Next :=
- Other_Source_Table.Last (In_Tree.Other_Sources);
- end if;
-
- Data.Last_Other_Source :=
- Other_Source_Table.Last (In_Tree.Other_Sources);
- end;
- end if;
- end Check_For_Source;
-
-------------------------------
-- Check_If_Externally_Built --
-------------------------------
@@ -4429,6 +4125,47 @@ package body Prj.Nmsc is
end if;
end if;
+ -- Check if Linker'Switches or Linker'Default_Switches are declared.
+ -- Warn if they are declared, as it is a common error to think that
+ -- library are "linked" with Linker switches.
+
+ if Data.Library then
+ declare
+ Linker_Package_Id : constant Package_Id :=
+ Util.Value_Of
+ (Name_Linker, Data.Decl.Packages, In_Tree);
+ Linker_Package : Package_Element;
+ Switches : Array_Element_Id := No_Array_Element;
+
+ begin
+ if Linker_Package_Id /= No_Package then
+ Linker_Package := In_Tree.Packages.Table (Linker_Package_Id);
+
+ Switches :=
+ Value_Of
+ (Name => Name_Switches,
+ In_Arrays => Linker_Package.Decl.Arrays,
+ In_Tree => In_Tree);
+
+ if Switches = No_Array_Element then
+ Switches :=
+ Value_Of
+ (Name => Name_Default_Switches,
+ In_Arrays => Linker_Package.Decl.Arrays,
+ In_Tree => In_Tree);
+ end if;
+
+ if Switches /= No_Array_Element then
+ Error_Msg
+ (Project, In_Tree,
+ "?Linker switches not taken into account in library " &
+ "projects",
+ No_Location);
+ end if;
+ end if;
+ end;
+ end if;
+
if Data.Extends /= No_Project then
In_Tree.Projects.Table (Data.Extends).Library := False;
end if;
@@ -4683,11 +4420,8 @@ package body Prj.Nmsc is
(Name => Name_Ada, Next => No_Name_List);
-- Attribute Languages is not specified. So, it defaults to
- -- a project of language Ada only.
-
- Data.Langs (Ada_Language_Index) := True;
-
- -- No sources of languages other than Ada
+ -- a project of language Ada only. No sources of languages
+ -- other than Ada
Data.Other_Sources_Present := False;
@@ -4757,13 +4491,10 @@ package body Prj.Nmsc is
NL_Id : Name_List_Index := No_Name_List;
begin
- if Get_Mode = Ada_Only then
+ -- Assume there are no language declared
- -- Assume that there is no language specified yet
-
- Data.Other_Sources_Present := False;
- Data.Ada_Sources_Present := False;
- end if;
+ Data.Ada_Sources_Present := False;
+ Data.Other_Sources_Present := False;
-- If there are no languages declared, there are no sources
@@ -4820,21 +4551,9 @@ package body Prj.Nmsc is
(Lang_Name, No_Name_List);
if Get_Mode = Ada_Only then
- Index := Language_Indexes.Get (Lang_Name);
+ -- Check for language Ada
- if Index = No_Language_Index then
- Add_Language_Name (Lang_Name);
- Index := Last_Language_Index;
- end if;
-
- Set (Index, True, Data, In_Tree);
- Set (Language_Processing =>
- Default_Language_Processing_Data,
- For_Language => Index,
- In_Project => Data,
- In_Tree => In_Tree);
-
- if Index = Ada_Language_Index then
+ if Lang_Name = Name_Ada then
Data.Ada_Sources_Present := True;
else
@@ -5936,155 +5655,6 @@ package body Prj.Nmsc is
end Find_Ada_Sources;
- ------------------
- -- Find_Sources --
- ------------------
-
- procedure Find_Sources
- (Project : Project_Id;
- In_Tree : Project_Tree_Ref;
- Data : in out Project_Data;
- For_Language : Language_Index;
- Current_Dir : String)
- is
- Source_Dir : String_List_Id;
- Element : String_Element;
- Dir : Dir_Type;
- Current_Source : String_List_Id := Nil_String;
- Source_Recorded : Boolean := False;
-
- begin
- if Current_Verbosity = High then
- Write_Line ("Looking for sources:");
- end if;
-
- -- Loop through subdirectories
-
- Source_Dir := Data.Source_Dirs;
- while Source_Dir /= Nil_String loop
- begin
- Source_Recorded := False;
- Element := In_Tree.String_Elements.Table (Source_Dir);
-
- if Element.Value /= No_Name then
- Get_Name_String (Element.Display_Value);
-
- declare
- Source_Directory : constant String :=
- Name_Buffer (1 .. Name_Len) &
- Directory_Separator;
-
- Dir_Last : constant Natural :=
- Compute_Directory_Last (Source_Directory);
-
- begin
- if Current_Verbosity = High then
- Write_Str ("Source_Dir = ");
- Write_Line (Source_Directory);
- end if;
-
- -- We look to every entry in the source directory
-
- Open (Dir, Source_Directory
- (Source_Directory'First .. Dir_Last));
-
- loop
- Read (Dir, Name_Buffer, Name_Len);
-
- if Current_Verbosity = High then
- Write_Str (" Checking ");
- Write_Line (Name_Buffer (1 .. Name_Len));
- end if;
-
- exit when Name_Len = 0;
-
- declare
- File_Name : constant File_Name_Type := Name_Find;
- Path : constant String :=
- Normalize_Pathname
- (Name => Name_Buffer (1 .. Name_Len),
- Directory => Source_Directory
- (Source_Directory'First .. Dir_Last),
- Resolve_Links => Opt.Follow_Links_For_Files,
- Case_Sensitive => True);
- Path_Name : Path_Name_Type;
-
- begin
- Name_Len := Path'Length;
- Name_Buffer (1 .. Name_Len) := Path;
- Path_Name := Name_Find;
-
- if For_Language = Ada_Language_Index then
-
- -- We attempt to register it as a source. However,
- -- there is no error if the file does not contain
- -- a valid source. But there is an error if we have
- -- a duplicate unit name.
-
- Record_Ada_Source
- (File_Name => File_Name,
- Path_Name => Path_Name,
- Project => Project,
- In_Tree => In_Tree,
- Data => Data,
- Location => No_Location,
- Current_Source => Current_Source,
- Source_Recorded => Source_Recorded,
- Current_Dir => Current_Dir);
-
- else
- Check_For_Source
- (File_Name => File_Name,
- Path_Name => Path_Name,
- Project => Project,
- In_Tree => In_Tree,
- Data => Data,
- Location => No_Location,
- Language => For_Language,
- Suffix =>
- Body_Suffix_Of (For_Language, Data, In_Tree),
- Naming_Exception => False);
- end if;
- end;
- end loop;
-
- Close (Dir);
- end;
- end if;
-
- exception
- when Directory_Error =>
- null;
- end;
-
- if Source_Recorded then
- In_Tree.String_Elements.Table (Source_Dir).Flag :=
- True;
- end if;
-
- Source_Dir := Element.Next;
- end loop;
-
- if Current_Verbosity = High then
- Write_Line ("end Looking for sources.");
- end if;
-
- if For_Language = Ada_Language_Index then
-
- -- If we have looked for sources and found none, then it is an error,
- -- except if it is an extending project. If a non extending project
- -- is not supposed to contain any source files, then never call
- -- Find_Sources.
-
- if Current_Source /= Nil_String then
- Data.Ada_Sources_Present := True;
-
- elsif Data.Extends = No_Project then
- Report_No_Sources (Project, "Ada", In_Tree, Data.Location);
- end if;
- end if;
- end Find_Sources;
-
--------------------------------
-- Free_Ada_Naming_Exceptions --
--------------------------------
@@ -6556,7 +6126,7 @@ package body Prj.Nmsc is
-- We set the object directory to its default
- Data.Object_Directory := Data.Directory;
+ Data.Object_Directory := Data.Directory;
if Object_Dir.Value /= Empty_String then
Get_Name_String (Object_Dir.Value);
@@ -6621,7 +6191,7 @@ package body Prj.Nmsc is
(Project,
In_Tree,
Name_Find,
- Data.Directory.Name,
+ Data.Directory.Display_Name,
Data.Object_Directory.Name,
Data.Object_Directory.Display_Name,
Create => "object",
@@ -6664,7 +6234,7 @@ package body Prj.Nmsc is
(Project,
In_Tree,
File_Name_Type (Exec_Dir.Value),
- Data.Directory.Name,
+ Data.Directory.Display_Name,
Data.Exec_Directory.Name,
Data.Exec_Directory.Display_Name,
Create => "exec",
@@ -6762,7 +6332,7 @@ package body Prj.Nmsc is
Data.Object_Directory := No_Path_Information;
end if;
- Data.Source_Dirs := Nil_String;
+ Data.Source_Dirs := Nil_String;
else
declare
@@ -6774,8 +6344,7 @@ package body Prj.Nmsc is
Source_Dir := Source_Dirs.Values;
while Source_Dir /= Nil_String loop
- Element :=
- In_Tree.String_Elements.Table (Source_Dir);
+ Element := In_Tree.String_Elements.Table (Source_Dir);
Find_Source_Dirs
(File_Name_Type (Element.Value), Element.Location);
Source_Dir := Element.Next;
@@ -6795,8 +6364,7 @@ package body Prj.Nmsc is
Source_Dir := Excluded_Source_Dirs.Values;
while Source_Dir /= Nil_String loop
- Element :=
- In_Tree.String_Elements.Table (Source_Dir);
+ Element := In_Tree.String_Elements.Table (Source_Dir);
Find_Source_Dirs
(File_Name_Type (Element.Value),
Element.Location,
@@ -6900,6 +6468,7 @@ package body Prj.Nmsc is
if not Prj.Util.Is_Valid (File) then
Error_Msg (Project, In_Tree, "file does not exist", Location);
+
else
-- Read the lines one by one
@@ -7005,9 +6574,9 @@ package body Prj.Nmsc is
Last : Natural := File'Last;
Standard_GNAT : Boolean;
Spec : constant File_Name_Type :=
- Spec_Suffix_Id_Of (In_Tree, Name_Ada, Naming);
+ Spec_Suffix_Id_Of (In_Tree, Name_Ada, Naming);
Body_Suff : constant File_Name_Type :=
- Body_Suffix_Id_Of (In_Tree, Name_Ada, Naming);
+ Body_Suffix_Id_Of (In_Tree, Name_Ada, Naming);
begin
Standard_GNAT := Spec = Default_Ada_Spec_Suffix
@@ -7606,8 +7175,7 @@ package body Prj.Nmsc is
---------------------------
procedure Find_Explicit_Sources
- (Lang : Language_Index;
- Current_Dir : String;
+ (Current_Dir : String;
Project : Project_Id;
In_Tree : Project_Tree_Ref;
Data : in out Project_Data)
@@ -7654,18 +7222,9 @@ package body Prj.Nmsc is
Data.Ada_Sources_Present := Current /= Nil_String;
end if;
- -- If we are processing other languages in the case of gprmake,
- -- we should not reset the list of sources, which was already
- -- initialized for the Ada files.
-
- if Get_Mode /= Ada_Only or else Lang /= Ada_Language_Index then
+ if Get_Mode = Multi_Language then
if Current = Nil_String then
- case Get_Mode is
- when Ada_Only =>
- Data.Source_Dirs := Nil_String;
- when Multi_Language =>
- Data.First_Language_Processing := No_Language_Index;
- end case;
+ Data.First_Language_Processing := No_Language_Index;
-- This project contains no source. For projects that
-- don't extend other projects, this also means that
@@ -7743,17 +7302,8 @@ package body Prj.Nmsc is
end loop;
if Get_Mode = Ada_Only then
- if Lang = Ada_Language_Index then
- Get_Path_Names_And_Record_Ada_Sources
- (Project, In_Tree, Data, Current_Dir);
- else
- Record_Other_Sources
- (Project => Project,
- In_Tree => In_Tree,
- Data => Data,
- Language => Lang,
- Naming_Exceptions => False);
- end if;
+ Get_Path_Names_And_Record_Ada_Sources
+ (Project, In_Tree, Data, Current_Dir);
end if;
end;
@@ -7787,18 +7337,8 @@ package body Prj.Nmsc is
if Get_Mode = Ada_Only then
-- Look in the source directories to find those sources
- if Lang = Ada_Language_Index then
- Get_Path_Names_And_Record_Ada_Sources
- (Project, In_Tree, Data, Current_Dir);
-
- else
- Record_Other_Sources
- (Project => Project,
- In_Tree => In_Tree,
- Data => Data,
- Language => Lang,
- Naming_Exceptions => False);
- end if;
+ Get_Path_Names_And_Record_Ada_Sources
+ (Project, In_Tree, Data, Current_Dir);
end if;
end if;
end;
@@ -7808,22 +7348,9 @@ package body Prj.Nmsc is
-- specified. Find all the files that satisfy the naming
-- scheme in all the source directories.
- case Get_Mode is
- when Ada_Only =>
- if Lang = Ada_Language_Index then
- Find_Ada_Sources (Project, In_Tree, Data, Current_Dir);
- else
- -- Find all the files that satisfy the naming scheme in
- -- all the source directories. All the naming exceptions
- -- that effectively exist are also part of the source
- -- of this language.
-
- Find_Sources (Project, In_Tree, Data, Lang, Current_Dir);
- end if;
-
- when Multi_Language =>
- null;
- end case;
+ if Get_Mode = Ada_Only then
+ Find_Ada_Sources (Project, In_Tree, Data, Current_Dir);
+ end if;
end if;
if Get_Mode = Multi_Language then
@@ -7888,7 +7415,6 @@ package body Prj.Nmsc is
end if;
if Get_Mode = Ada_Only
- and then Lang = Ada_Language_Index
and then Data.Extends = No_Project
then
-- We should have found at least one source, if not report an error
@@ -8829,9 +8355,6 @@ package body Prj.Nmsc is
procedure Remove_Locally_Removed_Files_From_Units;
-- Mark all locally removed sources as such in the Units table
- procedure Process_Other_Sources_In_Ada_Only_Mode;
- -- Find sources for language other than Ada when in Ada_Only mode
-
procedure Process_Sources_In_Multi_Language_Mode;
-- Find all source files when in multi language mode
@@ -8896,116 +8419,6 @@ package body Prj.Nmsc is
end Remove_Locally_Removed_Files_From_Units;
--------------------------------------------
- -- Process_Other_Sources_In_Ada_Only_Mode --
- --------------------------------------------
-
- procedure Process_Other_Sources_In_Ada_Only_Mode is
- begin
- -- Set Source_Present to False. It will be set back to True
- -- whenever a source is found.
-
- Data.Other_Sources_Present := False;
- for Lang in Ada_Language_Index + 1 .. Last_Language_Index loop
-
- -- For each language (other than Ada) in the project file
-
- if Is_Present (Lang, Data, In_Tree) then
-
- -- Reset the indication that there are sources of this
- -- language. It will be set back to True whenever we find
- -- a source of the language.
-
- Set (Lang, False, Data, In_Tree);
-
- -- First, get the source suffix for the language
-
- Set (Suffix => Suffix_For (Lang, Data.Naming, In_Tree),
- For_Language => Lang,
- In_Project => Data,
- In_Tree => In_Tree);
-
- -- Then, deal with the naming exceptions, if any
-
- Source_Names.Reset;
-
- declare
- Naming_Exceptions : constant Variable_Value :=
- Value_Of
- (Index => Language_Names.Table (Lang),
- Src_Index => 0,
- In_Array => Data.Naming.Implementation_Exceptions,
- In_Tree => In_Tree);
- Element_Id : String_List_Id;
- Element : String_Element;
- File_Id : File_Name_Type;
- Source_Found : Boolean := False;
-
- begin
- -- If there are naming exceptions, look through them one
- -- by one.
-
- if Naming_Exceptions /= Nil_Variable_Value then
- Element_Id := Naming_Exceptions.Values;
-
- while Element_Id /= Nil_String loop
- Element := In_Tree.String_Elements.Table (Element_Id);
-
- if Osint.File_Names_Case_Sensitive then
- File_Id := File_Name_Type (Element.Value);
- else
- Get_Name_String (Element.Value);
- Canonical_Case_File_Name
- (Name_Buffer (1 .. Name_Len));
- File_Id := Name_Find;
- end if;
-
- -- Put each naming exception in the Source_Names hash
- -- table, but if there are repetition, don't bother
- -- after the first instance.
-
- if Source_Names.Get (File_Id) = No_Name_Location then
- Source_Found := True;
- Source_Names.Set
- (File_Id,
- (Name => File_Id,
- Location => Element.Location,
- Source => No_Source,
- Except => False,
- Found => False));
- end if;
-
- Element_Id := Element.Next;
- end loop;
-
- -- If there is at least one naming exception, record
- -- those that are found in the source directories.
-
- if Source_Found then
- Record_Other_Sources
- (Project => Project,
- In_Tree => In_Tree,
- Data => Data,
- Language => Lang,
- Naming_Exceptions => True);
- end if;
-
- end if;
- end;
-
- -- Now, check if a list of sources is declared either through
- -- a string list (attribute Source_Files) or a text file
- -- (attribute Source_List_File). If a source list is declared,
- -- we will consider only those naming exceptions that are
- -- on the list.
-
- Source_Names.Reset;
- Find_Explicit_Sources
- (Lang, Current_Dir, Project, In_Tree, Data);
- end if;
- end loop;
- end Process_Other_Sources_In_Ada_Only_Mode;
-
- --------------------------------------------
-- Process_Sources_In_Multi_Language_Mode --
--------------------------------------------
@@ -9077,7 +8490,7 @@ package body Prj.Nmsc is
end loop;
Find_Explicit_Sources
- (Ada_Language_Index, Current_Dir, Project, In_Tree, Data);
+ (Current_Dir, Project, In_Tree, Data);
-- Mark as such the sources that are declared as excluded
@@ -9219,15 +8632,10 @@ package body Prj.Nmsc is
case Get_Mode is
when Ada_Only =>
if Is_A_Language (In_Tree, Data, Name_Ada) then
- Find_Explicit_Sources
- (Ada_Language_Index, Current_Dir, Project, In_Tree, Data);
+ Find_Explicit_Sources (Current_Dir, Project, In_Tree, Data);
Remove_Locally_Removed_Files_From_Units;
end if;
- if Data.Other_Sources_Present then
- Process_Other_Sources_In_Ada_Only_Mode;
- end if;
-
when Multi_Language =>
if Data.First_Language_Processing /= No_Language_Index then
Process_Sources_In_Multi_Language_Mode;
@@ -9456,7 +8864,6 @@ package body Prj.Nmsc is
if Current_Source = Nil_String then
Data.Ada_Sources :=
String_Element_Table.Last (In_Tree.String_Elements);
- Data.Sources := Data.Ada_Sources;
else
In_Tree.String_Elements.Table (Current_Source).Next :=
String_Element_Table.Last (In_Tree.String_Elements);
@@ -9531,7 +8938,6 @@ package body Prj.Nmsc is
then
if Previous_Source = Nil_String then
Data.Ada_Sources := Nil_String;
- Data.Sources := Nil_String;
else
In_Tree.String_Elements.Table (Previous_Source).Next :=
Nil_String;
@@ -9624,179 +9030,6 @@ package body Prj.Nmsc is
end if;
end Record_Ada_Source;
- --------------------------
- -- Record_Other_Sources --
- --------------------------
-
- procedure Record_Other_Sources
- (Project : Project_Id;
- In_Tree : Project_Tree_Ref;
- Data : in out Project_Data;
- Language : Language_Index;
- Naming_Exceptions : Boolean)
- is
- Source_Dir : String_List_Id;
- Element : String_Element;
- Path : Path_Name_Type;
- Dir : Dir_Type;
- Canonical_Name : File_Name_Type;
- Name_Str : String (1 .. 1_024);
- Last : Natural := 0;
- NL : Name_Location;
- First_Error : Boolean := True;
- Suffix : constant String :=
- Body_Suffix_Of (Language, Data, In_Tree);
-
- begin
- Source_Dir := Data.Source_Dirs;
- while Source_Dir /= Nil_String loop
- Element := In_Tree.String_Elements.Table (Source_Dir);
-
- declare
- Dir_Path : constant String :=
- Get_Name_String (Element.Display_Value);
- begin
- if Current_Verbosity = High then
- Write_Str ("checking directory """);
- Write_Str (Dir_Path);
- Write_Str (""" for ");
-
- if Naming_Exceptions then
- Write_Str ("naming exceptions");
- else
- Write_Str ("sources");
- end if;
-
- Write_Str (" of Language ");
- Display_Language_Name (Language);
- end if;
-
- Open (Dir, Dir_Path);
-
- loop
- Read (Dir, Name_Str, Last);
- exit when Last = 0;
-
- if Is_Regular_File
- (Dir_Path & Directory_Separator & Name_Str (1 .. Last))
- then
- Name_Len := Last;
- Name_Buffer (1 .. Name_Len) := Name_Str (1 .. Last);
- Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len));
- Canonical_Name := Name_Find;
- NL := Source_Names.Get (Canonical_Name);
-
- if NL /= No_Name_Location then
- if NL.Found then
- if not Data.Known_Order_Of_Source_Dirs then
- Error_Msg_File_1 := Canonical_Name;
- Error_Msg
- (Project, In_Tree,
- "{ is found in several source directories",
- NL.Location);
- end if;
-
- else
- NL.Found := True;
- Source_Names.Set (Canonical_Name, NL);
- Name_Len := Dir_Path'Length;
- Name_Buffer (1 .. Name_Len) := Dir_Path;
- Add_Char_To_Name_Buffer (Directory_Separator);
- Add_Str_To_Name_Buffer (Name_Str (1 .. Last));
- Path := Name_Find;
-
- Check_For_Source
- (File_Name => Canonical_Name,
- Path_Name => Path,
- Project => Project,
- In_Tree => In_Tree,
- Data => Data,
- Location => NL.Location,
- Language => Language,
- Suffix => Suffix,
- Naming_Exception => Naming_Exceptions);
- end if;
- end if;
- end if;
- end loop;
-
- Close (Dir);
- end;
-
- Source_Dir := Element.Next;
- end loop;
-
- if not Naming_Exceptions then
- NL := Source_Names.Get_First;
-
- -- It is an error if a source file name in a source list or
- -- in a source list file is not found.
-
- while NL /= No_Name_Location loop
- if not NL.Found then
- Err_Vars.Error_Msg_File_1 := NL.Name;
-
- if First_Error then
- Error_Msg
- (Project, In_Tree, "source file { cannot be found",
- NL.Location);
- First_Error := False;
-
- else
- Error_Msg
- (Project, In_Tree, "\source file { cannot be found",
- NL.Location);
- end if;
- end if;
-
- NL := Source_Names.Get_Next;
- end loop;
-
- -- Any naming exception of this language that is not in a list
- -- of sources must be removed.
-
- declare
- Source_Id : Other_Source_Id;
- Prev_Id : Other_Source_Id;
- Source : Other_Source;
-
- begin
- Prev_Id := No_Other_Source;
- Source_Id := Data.First_Other_Source;
- while Source_Id /= No_Other_Source loop
- Source := In_Tree.Other_Sources.Table (Source_Id);
-
- if Source.Language = Language
- and then Source.Naming_Exception
- then
- if Current_Verbosity = High then
- Write_Str ("Naming exception """);
- Write_Str (Get_Name_String (Source.File_Name));
- Write_Str (""" is not in the list of sources,");
- Write_Line (" so it is removed.");
- end if;
-
- if Prev_Id = No_Other_Source then
- Data.First_Other_Source := Source.Next;
- else
- In_Tree.Other_Sources.Table (Prev_Id).Next := Source.Next;
- end if;
-
- Source_Id := Source.Next;
-
- if Source_Id = No_Other_Source then
- Data.Last_Other_Source := Prev_Id;
- end if;
-
- else
- Prev_Id := Source_Id;
- Source_Id := Source.Next;
- end if;
- end loop;
- end;
- end if;
- end Record_Other_Sources;
-
-------------------
-- Remove_Source --
-------------------
@@ -9971,52 +9204,6 @@ package body Prj.Nmsc is
Write_Line ("end Source_Dirs.");
end Show_Source_Dirs;
- ----------------
- -- Suffix_For --
- ----------------
-
- function Suffix_For
- (Language : Language_Index;
- Naming : Naming_Data;
- In_Tree : Project_Tree_Ref) return File_Name_Type
- is
- Suffix : constant Variable_Value :=
- Value_Of
- (Index => Language_Names.Table (Language),
- Src_Index => 0,
- In_Array => Naming.Body_Suffix,
- In_Tree => In_Tree);
-
- begin
- -- If no suffix for this language in package Naming, use the default
-
- if Suffix = Nil_Variable_Value then
- Name_Len := 0;
-
- case Language is
- when Ada_Language_Index =>
- Add_Str_To_Name_Buffer (".adb");
-
- when C_Language_Index =>
- Add_Str_To_Name_Buffer (".c");
-
- when C_Plus_Plus_Language_Index =>
- Add_Str_To_Name_Buffer (".cpp");
-
- when others =>
- return No_File;
- end case;
-
- -- Otherwise use the one specified
-
- else
- Get_Name_String (Suffix.Value);
- end if;
-
- Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len));
- return Name_Find;
- end Suffix_For;
-
-------------------------
-- Warn_If_Not_Sources --
-------------------------
diff --git a/gcc/ada/prj-part.adb b/gcc/ada/prj-part.adb
index 67c913378dd..5e0b14f0151 100644
--- a/gcc/ada/prj-part.adb
+++ b/gcc/ada/prj-part.adb
@@ -149,6 +149,29 @@ package body Prj.Part is
-- does not (because it is already extended), but other projects that it
-- imports may need to be virtually extended.
+ type Extension_Origin is (None, Extending_Simple, Extending_All);
+ -- Type of parameter From_Extended for procedures Parse_Single_Project and
+ -- Post_Parse_Context_Clause. Extending_All means that we are parsing the
+ -- tree rooted at an extending all project.
+
+ procedure Parse_Single_Project
+ (In_Tree : Project_Node_Tree_Ref;
+ Project : out Project_Node_Id;
+ Extends_All : out Boolean;
+ Path_Name : String;
+ Extended : Boolean;
+ From_Extended : Extension_Origin;
+ In_Limited : Boolean;
+ Packages_To_Check : String_List_Access;
+ Depth : Natural;
+ Current_Dir : String);
+ -- Parse a project file. This is a recursive procedure: it calls itself for
+ -- imported and extended projects. When From_Extended is not None, if the
+ -- project has already been parsed and is an extended project A, return the
+ -- ultimate (not extended) project that extends A. When In_Limited is True,
+ -- the importing path includes at least one "limited with". When parsing
+ -- configuration projects, do not allow a depth > 1.
+
procedure Pre_Parse_Context_Clause
(In_Tree : Project_Node_Tree_Ref;
Context_Clause : out With_Id);
diff --git a/gcc/ada/prj-part.ads b/gcc/ada/prj-part.ads
index 8e366bc4fff..e1c69c5ab83 100644
--- a/gcc/ada/prj-part.ads
+++ b/gcc/ada/prj-part.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2007, Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2008, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -49,28 +49,4 @@ package Prj.Part is
-- Current_Directory is used for optimization purposes only, avoiding extra
-- system calls.
- type Extension_Origin is (None, Extending_Simple, Extending_All);
- -- Type of parameter From_Extended for procedures Parse_Single_Project and
- -- Post_Parse_Context_Clause. Extending_All means that we are parsing the
- -- tree rooted at an extending all project.
-
- procedure Parse_Single_Project
- (In_Tree : Project_Node_Tree_Ref;
- Project : out Project_Node_Id;
- Extends_All : out Boolean;
- Path_Name : String;
- Extended : Boolean;
- From_Extended : Extension_Origin;
- In_Limited : Boolean;
- Packages_To_Check : String_List_Access;
- Depth : Natural;
- Current_Dir : String);
- -- Parse a project file.
- -- Recursive procedure: it calls itself for imported and extended
- -- projects. When From_Extended is not None, if the project has already
- -- been parsed and is an extended project A, return the ultimate
- -- (not extended) project that extends A. When In_Limited is True,
- -- the importing path includes at least one "limited with".
- -- When parsing configuration projects, do not allow a depth > 1.
-
end Prj.Part;
diff --git a/gcc/ada/prj-proc.adb b/gcc/ada/prj-proc.adb
index 67ae8ba85f0..24d42e40a27 100644
--- a/gcc/ada/prj-proc.adb
+++ b/gcc/ada/prj-proc.adb
@@ -83,12 +83,15 @@ package body Prj.Proc is
-- Current_Dir is for optimization purposes, avoiding extra system calls.
procedure Copy_Package_Declarations
- (From : Declarations;
- To : in out Declarations;
- New_Loc : Source_Ptr;
- In_Tree : Project_Tree_Ref);
+ (From : Declarations;
+ To : in out Declarations;
+ New_Loc : Source_Ptr;
+ Naming_Restricted : Boolean;
+ In_Tree : Project_Tree_Ref);
-- Copy a package declaration From to To for a renamed package. Change the
- -- locations of all the attributes to New_Loc.
+ -- locations of all the attributes to New_Loc. When Naming_Restricted is
+ -- True, do not copy attributes Body, Spec, Implementation and
+ -- Specification.
function Expression
(Project : Project_Id;
@@ -310,10 +313,11 @@ package body Prj.Proc is
-------------------------------
procedure Copy_Package_Declarations
- (From : Declarations;
- To : in out Declarations;
- New_Loc : Source_Ptr;
- In_Tree : Project_Tree_Ref)
+ (From : Declarations;
+ To : in out Declarations;
+ New_Loc : Source_Ptr;
+ Naming_Restricted : Boolean;
+ In_Tree : Project_Tree_Ref)
is
V1 : Variable_Id := From.Attributes;
V2 : Variable_Id := No_Variable;
@@ -368,67 +372,73 @@ package body Prj.Proc is
while A1 /= No_Array loop
- -- Copy the array
-
Arr := In_Tree.Arrays.Table (A1);
A1 := Arr.Next;
- -- Remove the Next component
+ if not Naming_Restricted or else
+ (Arr.Name /= Snames.Name_Body
+ and then Arr.Name /= Snames.Name_Spec
+ and then Arr.Name /= Snames.Name_Implementation
+ and then Arr.Name /= Snames.Name_Specification)
+ then
+ -- Remove the Next component
- Arr.Next := No_Array;
+ Arr.Next := No_Array;
- Array_Table.Increment_Last (In_Tree.Arrays);
+ Array_Table.Increment_Last (In_Tree.Arrays);
- -- Create new Array declaration
- if To.Arrays = No_Array then
- To.Arrays := Array_Table.Last (In_Tree.Arrays);
+ -- Create new Array declaration
- else
- In_Tree.Arrays.Table (A2).Next :=
- Array_Table.Last (In_Tree.Arrays);
- end if;
+ if To.Arrays = No_Array then
+ To.Arrays := Array_Table.Last (In_Tree.Arrays);
- A2 := Array_Table.Last (In_Tree.Arrays);
+ else
+ In_Tree.Arrays.Table (A2).Next :=
+ Array_Table.Last (In_Tree.Arrays);
+ end if;
- -- Don't store the array, as its first element has not been set yet
+ A2 := Array_Table.Last (In_Tree.Arrays);
- -- Copy the array elements of the array
+ -- Don't store the array as its first element has not been set yet
- E1 := Arr.Value;
- Arr.Value := No_Array_Element;
+ -- Copy the array elements of the array
- while E1 /= No_Array_Element loop
+ E1 := Arr.Value;
+ Arr.Value := No_Array_Element;
+ while E1 /= No_Array_Element loop
- -- Copy the array element
+ -- Copy the array element
- Elm := In_Tree.Array_Elements.Table (E1);
- E1 := Elm.Next;
+ Elm := In_Tree.Array_Elements.Table (E1);
+ E1 := Elm.Next;
- -- Remove the Next component
+ -- Remove the Next component
- Elm.Next := No_Array_Element;
+ Elm.Next := No_Array_Element;
- -- Change the location
+ -- Change the location
- Elm.Value.Location := New_Loc;
- Array_Element_Table.Increment_Last (In_Tree.Array_Elements);
+ Elm.Value.Location := New_Loc;
+ Array_Element_Table.Increment_Last (In_Tree.Array_Elements);
- -- Create new array element
+ -- Create new array element
- if Arr.Value = No_Array_Element then
- Arr.Value := Array_Element_Table.Last (In_Tree.Array_Elements);
- else
- In_Tree.Array_Elements.Table (E2).Next :=
- Array_Element_Table.Last (In_Tree.Array_Elements);
- end if;
+ if Arr.Value = No_Array_Element then
+ Arr.Value :=
+ Array_Element_Table.Last (In_Tree.Array_Elements);
+ else
+ In_Tree.Array_Elements.Table (E2).Next :=
+ Array_Element_Table.Last (In_Tree.Array_Elements);
+ end if;
- E2 := Array_Element_Table.Last (In_Tree.Array_Elements);
- In_Tree.Array_Elements.Table (E2) := Elm;
- end loop;
+ E2 := Array_Element_Table.Last (In_Tree.Array_Elements);
+ In_Tree.Array_Elements.Table (E2) := Elm;
+ end loop;
- -- Finally, store the new array
+ -- Finally, store the new array
- In_Tree.Arrays.Table (A2) := Arr;
+ In_Tree.Arrays.Table (A2) := Arr;
+ end if;
end loop;
end Copy_Package_Declarations;
@@ -1343,14 +1353,15 @@ package body Prj.Proc is
-- renaming declaration.
Copy_Package_Declarations
- (From =>
+ (From =>
In_Tree.Packages.Table (Renamed_Package).Decl,
- To =>
+ To =>
In_Tree.Packages.Table (New_Pkg).Decl,
- New_Loc =>
+ New_Loc =>
Location_Of
(Current_Item, From_Project_Node_Tree),
- In_Tree => In_Tree);
+ Naming_Restricted => False,
+ In_Tree => In_Tree);
end;
-- Standard package declaration, not renaming
@@ -1880,51 +1891,53 @@ package body Prj.Proc is
-- Associative array attribute
else
- -- Get the string index
-
- Get_Name_String
- (Associative_Array_Index_Of
- (Current_Item, From_Project_Node_Tree));
-
- -- Put in lower case, if necessary
-
declare
- Lower : Boolean;
+ Index_Name : Name_Id :=
+ Associative_Array_Index_Of
+ (Current_Item, From_Project_Node_Tree);
+ Lower : Boolean;
+ The_Array : Array_Id;
+
+ The_Array_Element : Array_Element_Id :=
+ No_Array_Element;
begin
- Lower :=
- Case_Insensitive
- (Current_Item, From_Project_Node_Tree);
+ if Index_Name /= All_Other_Names then
+ -- Get the string index
- -- In multi-language mode (gprbuild), the index is
- -- always case insensitive if it does not include
- -- any dot.
+ Get_Name_String
+ (Associative_Array_Index_Of
+ (Current_Item, From_Project_Node_Tree));
- if Get_Mode = Multi_Language and then not Lower then
- for J in 1 .. Name_Len loop
- if Name_Buffer (J) = '.' then
- Lower := False;
- exit;
- end if;
- end loop;
- end if;
+ -- Put in lower case, if necessary
- if Lower then
- GNAT.Case_Util.To_Lower
- (Name_Buffer (1 .. Name_Len));
- end if;
- end;
+ Lower :=
+ Case_Insensitive
+ (Current_Item, From_Project_Node_Tree);
- declare
- The_Array : Array_Id;
+ -- In multi-language mode (gprbuild), the index
+ -- is always case insensitive if it does not
+ -- include any dot.
- The_Array_Element : Array_Element_Id :=
- No_Array_Element;
+ if Get_Mode = Multi_Language
+ and then not Lower
+ then
+ for J in 1 .. Name_Len loop
+ if Name_Buffer (J) = '.' then
+ Lower := False;
+ exit;
+ end if;
+ end loop;
+ end if;
+
+ if Lower then
+ GNAT.Case_Util.To_Lower
+ (Name_Buffer (1 .. Name_Len));
+ end if;
- Index_Name : constant Name_Id := Name_Find;
- -- The name id of the index
+ Index_Name := Name_Find;
+ end if;
- begin
-- Look for the array in the appropriate list
if Pkg /= No_Package then
@@ -2730,10 +2743,13 @@ package body Prj.Proc is
Next => Processed_Data.Decl.Packages);
Processed_Data.Decl.Packages := Current_Pkg;
Copy_Package_Declarations
- (From => Element.Decl,
- To => In_Tree.Packages.Table (Current_Pkg).Decl,
- New_Loc => No_Location,
- In_Tree => In_Tree);
+ (From => Element.Decl,
+ To =>
+ In_Tree.Packages.Table (Current_Pkg).Decl,
+ New_Loc => No_Location,
+ Naming_Restricted =>
+ Element.Name = Snames.Name_Naming,
+ In_Tree => In_Tree);
end if;
Extended_Pkg := Element.Next;
diff --git a/gcc/ada/prj-util.adb b/gcc/ada/prj-util.adb
index 2f953a36018..5894e4daf35 100644
--- a/gcc/ada/prj-util.adb
+++ b/gcc/ada/prj-util.adb
@@ -600,9 +600,11 @@ package body Prj.Util is
Real_Index_1 := Index;
if not Element.Index_Case_Sensitive or Force_Lower_Case_Index then
- Get_Name_String (Index);
- To_Lower (Name_Buffer (1 .. Name_Len));
- Real_Index_1 := Name_Find;
+ if Index /= All_Other_Names then
+ Get_Name_String (Index);
+ To_Lower (Name_Buffer (1 .. Name_Len));
+ Real_Index_1 := Name_Find;
+ end if;
end if;
while Current /= No_Array_Element loop
@@ -610,9 +612,11 @@ package body Prj.Util is
Real_Index_2 := Element.Index;
if not Element.Index_Case_Sensitive or Force_Lower_Case_Index then
- Get_Name_String (Element.Index);
- To_Lower (Name_Buffer (1 .. Name_Len));
- Real_Index_2 := Name_Find;
+ if Element.Index /= All_Other_Names then
+ Get_Name_String (Element.Index);
+ To_Lower (Name_Buffer (1 .. Name_Len));
+ Real_Index_2 := Name_Find;
+ end if;
end if;
if Real_Index_1 = Real_Index_2 and then
diff --git a/gcc/ada/prj-util.ads b/gcc/ada/prj-util.ads
index e2a9558e5eb..0efdfbb5b03 100644
--- a/gcc/ada/prj-util.ads
+++ b/gcc/ada/prj-util.ads
@@ -146,14 +146,14 @@ package Prj.Util is
-- the last character of each line, if possible.
type Text_File is limited private;
- -- Represents a text file. Default is invalid text file
+ -- Represents a text file (default is invalid text file)
function Is_Valid (File : Text_File) return Boolean;
- -- Returns True if File designates an open text file that
- -- has not yet been closed.
+ -- Returns True if File designates an open text file that has not yet been
+ -- closed.
procedure Open (File : out Text_File; Name : String);
- -- Open a text file. If this procedure fails, File is invalid
+ -- Open a text file to read (file is invalid if text file cannot be opened)
function End_Of_File (File : Text_File) return Boolean;
-- Returns True if the end of the text file File has been reached. Fails if
@@ -163,7 +163,7 @@ package Prj.Util is
(File : Text_File;
Line : out String;
Last : out Natural);
- -- Reads a line from an open text file. Fails if File is invalid
+ -- Reads a line from an open text file (fails if file is invalid)
procedure Close (File : in out Text_File);
-- Close an open text file. File becomes invalid. Fails if File is already
diff --git a/gcc/ada/prj.adb b/gcc/ada/prj.adb
index d838b114442..505e2dad3d1 100644
--- a/gcc/ada/prj.adb
+++ b/gcc/ada/prj.adb
@@ -32,9 +32,11 @@ with Prj.Attr;
with Prj.Env;
with Prj.Err; use Prj.Err;
with Snames; use Snames;
+with Table;
with Uintp; use Uintp;
with System.Case_Util; use System.Case_Util;
+with System.HTable;
package body Prj is
@@ -50,8 +52,6 @@ package body Prj is
The_Empty_String : Name_Id;
- Name_C_Plus_Plus : Name_Id;
-
Default_Ada_Spec_Suffix_Id : File_Name_Type;
Default_Ada_Body_Suffix_Id : File_Name_Type;
Slash_Id : Path_Name_Type;
@@ -83,9 +83,7 @@ package body Prj is
Specs => No_Array_Element,
Bodies => No_Array_Element,
Specification_Exceptions => No_Array_Element,
- Implementation_Exceptions => No_Array_Element,
- Impl_Suffixes => No_Impl_Suffixes,
- Supp_Suffixes => No_Supp_Language_Index);
+ Implementation_Exceptions => No_Array_Element);
Project_Empty : constant Project_Data :=
(Qualifier => Unspecified,
@@ -113,8 +111,9 @@ package body Prj is
Lib_Auto_Init => False,
Libgnarl_Needed => Unknown,
Symbol_Data => No_Symbols,
+ Ada_Sources_Present => True,
+ Other_Sources_Present => True,
Ada_Sources => Nil_String,
- Sources => Nil_String,
First_Source => No_Source,
Last_Source => No_Source,
Interfaces_Defined => False,
@@ -144,25 +143,12 @@ package body Prj is
Objects_Path_File_Without_Libs => No_Path,
Config_File_Name => No_Path,
Config_File_Temp => False,
- Linker_Name => No_File,
- Linker_Path => No_Path,
- Minimum_Linker_Options => No_Name_List,
Config_Checked => False,
Checked => False,
Seen => False,
Need_To_Build_Lib => False,
Depth => 0,
- Unkept_Comments => False,
- Langs => No_Languages,
- Supp_Languages => No_Supp_Language_Index,
- Ada_Sources_Present => True,
- Other_Sources_Present => True,
- First_Other_Source => No_Other_Source,
- Last_Other_Source => No_Other_Source,
- First_Lang_Processing =>
- Default_First_Language_Processing_Data,
- Supp_Language_Processing =>
- No_Supp_Language_Index);
+ Unkept_Comments => False);
package Temp_Files is new Table.Table
(Table_Component_Type => Path_Name_Type,
@@ -174,18 +160,6 @@ package body Prj is
-- Table to store the path name of all the created temporary files, so that
-- they can be deleted at the end, or when the program is interrupted.
- -----------------------
- -- Add_Language_Name --
- -----------------------
-
- procedure Add_Language_Name (Name : Name_Id) is
- begin
- Last_Language_Index := Last_Language_Index + 1;
- Language_Indexes.Set (Name, Last_Language_Index);
- Language_Names.Increment_Last;
- Language_Names.Table (Last_Language_Index) := Name;
- end Add_Language_Name;
-
-------------------
-- Add_To_Buffer --
-------------------
@@ -341,21 +315,6 @@ package body Prj is
return "";
end Body_Suffix_Of;
- function Body_Suffix_Of
- (Language : Language_Index;
- In_Project : Project_Data;
- In_Tree : Project_Tree_Ref) return String
- is
- Suffix_Id : constant File_Name_Type :=
- Suffix_Of (Language, In_Project, In_Tree);
- begin
- if Suffix_Id /= No_File then
- return Get_Name_String (Suffix_Id);
- else
- return "." & Get_Name_String (Language_Names.Table (Language));
- end if;
- end Body_Suffix_Of;
-
-----------------------------
-- Default_Ada_Body_Suffix --
-----------------------------
@@ -430,17 +389,6 @@ package body Prj is
Write_Str (Name_Buffer (1 .. Name_Len));
end Display_Language_Name;
- ---------------------------
- -- Display_Language_Name --
- ---------------------------
-
- procedure Display_Language_Name (Language : Language_Index) is
- begin
- Get_Name_String (Language_Names.Table (Language));
- To_Upper (Name_Buffer (1 .. 1));
- Write_Str (Name_Buffer (1 .. Name_Len));
- end Display_Language_Name;
-
----------------
-- Empty_File --
----------------
@@ -638,22 +586,12 @@ package body Prj is
Name_Len := 1;
Name_Buffer (1) := '/';
Slash_Id := Name_Find;
- Name_Len := 3;
- Name_Buffer (1 .. 3) := "c++";
- Name_C_Plus_Plus := Name_Find;
Prj.Env.Initialize;
Prj.Attr.Initialize;
Set_Name_Table_Byte (Name_Project, Token_Type'Pos (Tok_Project));
Set_Name_Table_Byte (Name_Extends, Token_Type'Pos (Tok_Extends));
Set_Name_Table_Byte (Name_External, Token_Type'Pos (Tok_External));
-
- Language_Indexes.Reset;
- Last_Language_Index := No_Language_Index;
- Language_Names.Init;
- Add_Language_Name (Name_Ada);
- Add_Language_Name (Name_C);
- Add_Language_Name (Name_C_Plus_Plus);
end if;
if Tree /= No_Project_Tree then
@@ -729,84 +667,6 @@ package body Prj is
return False;
end Is_Extending;
- ----------------
- -- Is_Present --
- ----------------
-
- function Is_Present
- (Language : Language_Index;
- In_Project : Project_Data;
- In_Tree : Project_Tree_Ref) return Boolean
- is
- begin
- case Language is
- when No_Language_Index =>
- return False;
-
- when First_Language_Indexes =>
- return In_Project.Langs (Language);
-
- when others =>
- declare
- Supp : Supp_Language;
- Supp_Index : Supp_Language_Index;
-
- begin
- Supp_Index := In_Project.Supp_Languages;
- while Supp_Index /= No_Supp_Language_Index loop
- Supp := In_Tree.Present_Languages.Table (Supp_Index);
-
- if Supp.Index = Language then
- return Supp.Present;
- end if;
-
- Supp_Index := Supp.Next;
- end loop;
-
- return False;
- end;
- end case;
- end Is_Present;
-
- ---------------------------------
- -- Language_Processing_Data_Of --
- ---------------------------------
-
- function Language_Processing_Data_Of
- (Language : Language_Index;
- In_Project : Project_Data;
- In_Tree : Project_Tree_Ref) return Language_Processing_Data
- is
- begin
- case Language is
- when No_Language_Index =>
- return Default_Language_Processing_Data;
-
- when First_Language_Indexes =>
- return In_Project.First_Lang_Processing (Language);
-
- when others =>
- declare
- Supp : Supp_Language_Data;
- Supp_Index : Supp_Language_Index;
-
- begin
- Supp_Index := In_Project.Supp_Language_Processing;
- while Supp_Index /= No_Supp_Language_Index loop
- Supp := In_Tree.Supp_Languages.Table (Supp_Index);
-
- if Supp.Index = Language then
- return Supp.Data;
- end if;
-
- Supp_Index := Supp.Next;
- end loop;
-
- return Default_Language_Processing_Data;
- end;
- end case;
- end Language_Processing_Data_Of;
-
-----------------------
-- Objects_Exist_For --
-----------------------
@@ -830,7 +690,7 @@ package body Prj is
if In_Tree.Languages_Data.Table (Lang).Name = Language_Id then
return
In_Tree.Languages_Data.Table
- (Lang).Config.Objects_Generated;
+ (Lang).Config.Object_Generated;
end if;
Lang := In_Tree.Languages_Data.Table (Lang).Next;
@@ -980,13 +840,6 @@ package body Prj is
begin
Prj.Env.Initialize;
- -- gprmake tables
-
- Present_Language_Table.Init (Tree.Present_Languages);
- Supp_Suffix_Table.Init (Tree.Supp_Suffixes);
- Supp_Language_Table.Init (Tree.Supp_Languages);
- Other_Source_Table.Init (Tree.Other_Sources);
-
-- Visible tables
Language_Data_Table.Init (Tree.Languages_Data);
@@ -1040,144 +893,6 @@ package body Prj is
and then Left.Separate_Suffix = Right.Separate_Suffix;
end Same_Naming_Scheme;
- ---------
- -- Set --
- ---------
-
- procedure Set
- (Language : Language_Index;
- Present : Boolean;
- In_Project : in out Project_Data;
- In_Tree : Project_Tree_Ref)
- is
- begin
- case Language is
- when No_Language_Index =>
- null;
-
- when First_Language_Indexes =>
- In_Project.Langs (Language) := Present;
-
- when others =>
- declare
- Supp : Supp_Language;
- Supp_Index : Supp_Language_Index;
-
- begin
- Supp_Index := In_Project.Supp_Languages;
- while Supp_Index /= No_Supp_Language_Index loop
- Supp := In_Tree.Present_Languages.Table (Supp_Index);
-
- if Supp.Index = Language then
- In_Tree.Present_Languages.Table (Supp_Index).Present :=
- Present;
- return;
- end if;
-
- Supp_Index := Supp.Next;
- end loop;
-
- Supp := (Index => Language, Present => Present,
- Next => In_Project.Supp_Languages);
- Present_Language_Table.Increment_Last
- (In_Tree.Present_Languages);
- Supp_Index :=
- Present_Language_Table.Last (In_Tree.Present_Languages);
- In_Tree.Present_Languages.Table (Supp_Index) :=
- Supp;
- In_Project.Supp_Languages := Supp_Index;
- end;
- end case;
- end Set;
-
- procedure Set
- (Language_Processing : Language_Processing_Data;
- For_Language : Language_Index;
- In_Project : in out Project_Data;
- In_Tree : Project_Tree_Ref)
- is
- begin
- case For_Language is
- when No_Language_Index =>
- null;
-
- when First_Language_Indexes =>
- In_Project.First_Lang_Processing (For_Language) :=
- Language_Processing;
-
- when others =>
- declare
- Supp : Supp_Language_Data;
- Supp_Index : Supp_Language_Index;
-
- begin
- Supp_Index := In_Project.Supp_Language_Processing;
- while Supp_Index /= No_Supp_Language_Index loop
- Supp := In_Tree.Supp_Languages.Table (Supp_Index);
-
- if Supp.Index = For_Language then
- In_Tree.Supp_Languages.Table
- (Supp_Index).Data := Language_Processing;
- return;
- end if;
-
- Supp_Index := Supp.Next;
- end loop;
-
- Supp := (Index => For_Language, Data => Language_Processing,
- Next => In_Project.Supp_Language_Processing);
- Supp_Language_Table.Increment_Last
- (In_Tree.Supp_Languages);
- Supp_Index := Supp_Language_Table.Last
- (In_Tree.Supp_Languages);
- In_Tree.Supp_Languages.Table (Supp_Index) := Supp;
- In_Project.Supp_Language_Processing := Supp_Index;
- end;
- end case;
- end Set;
-
- procedure Set
- (Suffix : File_Name_Type;
- For_Language : Language_Index;
- In_Project : in out Project_Data;
- In_Tree : Project_Tree_Ref)
- is
- begin
- case For_Language is
- when No_Language_Index =>
- null;
-
- when First_Language_Indexes =>
- In_Project.Naming.Impl_Suffixes (For_Language) := Suffix;
-
- when others =>
- declare
- Supp : Supp_Suffix;
- Supp_Index : Supp_Language_Index;
-
- begin
- Supp_Index := In_Project.Naming.Supp_Suffixes;
- while Supp_Index /= No_Supp_Language_Index loop
- Supp := In_Tree.Supp_Suffixes.Table (Supp_Index);
-
- if Supp.Index = For_Language then
- In_Tree.Supp_Suffixes.Table (Supp_Index).Suffix := Suffix;
- return;
- end if;
-
- Supp_Index := Supp.Next;
- end loop;
-
- Supp := (Index => For_Language, Suffix => Suffix,
- Next => In_Project.Naming.Supp_Suffixes);
- Supp_Suffix_Table.Increment_Last (In_Tree.Supp_Suffixes);
- Supp_Index := Supp_Suffix_Table.Last (In_Tree.Supp_Suffixes);
- In_Tree.Supp_Suffixes.Table (Supp_Index) := Supp;
- In_Project.Naming.Supp_Suffixes := Supp_Index;
- end;
- end case;
- end Set;
-
---------------------
-- Set_Body_Suffix --
---------------------
@@ -1426,45 +1141,6 @@ package body Prj is
end if;
end Standard_Naming_Data;
- ---------------
- -- Suffix_Of --
- ---------------
-
- function Suffix_Of
- (Language : Language_Index;
- In_Project : Project_Data;
- In_Tree : Project_Tree_Ref) return File_Name_Type
- is
- begin
- case Language is
- when No_Language_Index =>
- return No_File;
-
- when First_Language_Indexes =>
- return In_Project.Naming.Impl_Suffixes (Language);
-
- when others =>
- declare
- Supp : Supp_Suffix;
- Supp_Index : Supp_Language_Index;
-
- begin
- Supp_Index := In_Project.Naming.Supp_Suffixes;
- while Supp_Index /= No_Supp_Language_Index loop
- Supp := In_Tree.Supp_Suffixes.Table (Supp_Index);
-
- if Supp.Index = Language then
- return Supp.Suffix;
- end if;
-
- Supp_Index := Supp.Next;
- end loop;
-
- return No_File;
- end;
- end case;
- end Suffix_Of;
-
-------------------
-- Switches_Name --
-------------------
@@ -1476,29 +1152,6 @@ package body Prj is
return Extend_Name (Source_File_Name, Switches_Dependency_Suffix);
end Switches_Name;
- ---------------------------
- -- There_Are_Ada_Sources --
- ---------------------------
-
- function There_Are_Ada_Sources
- (In_Tree : Project_Tree_Ref;
- Project : Project_Id) return Boolean
- is
- Prj : Project_Id;
-
- begin
- Prj := Project;
- while Prj /= No_Project loop
- if In_Tree.Projects.Table (Prj).Ada_Sources /= Nil_String then
- return True;
- end if;
-
- Prj := In_Tree.Projects.Table (Prj).Extends;
- end loop;
-
- return False;
- end There_Are_Ada_Sources;
-
-----------
-- Value --
-----------
diff --git a/gcc/ada/prj.ads b/gcc/ada/prj.ads
index 5d8caa79cd3..27fba81bf09 100644
--- a/gcc/ada/prj.ads
+++ b/gcc/ada/prj.ads
@@ -32,21 +32,21 @@
with Casing; use Casing;
with Namet; use Namet;
with Scans; use Scans;
-with Table;
with Types; use Types;
with GNAT.Dynamic_HTables; use GNAT.Dynamic_HTables;
with GNAT.Dynamic_Tables;
with GNAT.OS_Lib; use GNAT.OS_Lib;
-with System.HTable;
-
package Prj is
+ All_Other_Names : constant Name_Id := Names_High_Bound;
+ -- Name used to replace others as an index of an associative array
+ -- attribute in situations where this is allowed.
+
Subdirs_Option : constant String := "--subdirs=";
-- Switch used to indicate that the real directories (object, exec,
- -- library, ...) are subdirectories of what is indicated in the project
- -- file.
+ -- library, ...) are subdirectories of those in the project file.
Subdirs : String_Ptr := null;
-- The value after the equal sign in switch --subdirs=...
@@ -402,6 +402,13 @@ package Prj is
No_Source : constant Source_Id := 0;
+ type Path_Syntax_Kind is
+ (Canonical,
+ -- Unix style
+
+ Host);
+ -- Host specific syntax, for example on VMS (the default)
+
type Language_Config is record
Kind : Language_Kind := File_Based;
-- Kind of language. All languages are file based, except Ada which is
@@ -426,6 +433,10 @@ package Prj is
-- The list of switches that are required as a minimum to invoke the
-- compiler driver.
+ Path_Syntax : Path_Syntax_Kind := Host;
+ -- Value may be Canonical (Unix style) or Host (host syntax, for example
+ -- on VMS for DEC C).
+
Compilation_PIC_Option : Name_List_Index := No_Name_List;
-- The option(s) to compile a source in Position Independent Code for
-- shared libraries. Specified in the configuration. When not specified,
@@ -528,12 +539,6 @@ package Prj is
Toolchain_Description : Name_Id := No_Name;
-- Hold the value of attribute Toolchain_Description for the language
- PIC_Option : Name_Id := No_Name;
- -- Hold the value of attribute Compiler'PIC_Option for the language
-
- Objects_Generated : Boolean := True;
- -- Indicates if objects are generated for the language
-
end record;
-- Record describing the configuration of a language
@@ -544,6 +549,7 @@ package Prj is
Compiler_Driver => No_File,
Compiler_Driver_Path => null,
Compiler_Required_Switches => No_Name_List,
+ Path_Syntax => Canonical,
Compilation_PIC_Option => No_Name_List,
Object_Generated => True,
Objects_Linked => True,
@@ -570,9 +576,7 @@ package Prj is
Binder_Required_Switches => No_Name_List,
Binder_Prefix => No_Name,
Toolchain_Version => No_Name,
- Toolchain_Description => No_Name,
- PIC_Option => No_Name,
- Objects_Generated => True);
+ Toolchain_Description => No_Name);
type Language_Data is record
Name : Name_Id := No_Name;
@@ -838,164 +842,6 @@ package Prj is
-- Similar to 'Value (but avoid use of this attribute in compiler)
-- Raises Constraint_Error if not a Casing_Type image.
- -- Declarations for gprmake:
-
- First_Language_Index : constant Language_Index := 1;
- First_Language_Indexes_Last : constant Language_Index := 5;
-
- Ada_Language_Index : constant Language_Index :=
- First_Language_Index;
- C_Language_Index : constant Language_Index :=
- Ada_Language_Index + 1;
- C_Plus_Plus_Language_Index : constant Language_Index :=
- C_Language_Index + 1;
-
- Last_Language_Index : Language_Index := No_Language_Index;
-
- subtype First_Language_Indexes is Language_Index
- range First_Language_Index .. First_Language_Indexes_Last;
-
- package Language_Indexes is new System.HTable.Simple_HTable
- (Header_Num => Header_Num,
- Element => Language_Index,
- No_Element => No_Language_Index,
- Key => Name_Id,
- Hash => Hash,
- Equal => "=");
- -- Mapping of language names to language indexes
-
- package Language_Names is new Table.Table
- (Table_Component_Type => Name_Id,
- Table_Index_Type => Language_Index,
- Table_Low_Bound => 1,
- Table_Initial => 4,
- Table_Increment => 100,
- Table_Name => "Prj.Language_Names");
- -- The table for the name of programming languages
-
- procedure Add_Language_Name (Name : Name_Id);
-
- procedure Display_Language_Name (Language : Language_Index);
-
- type Languages_In_Project is array (First_Language_Indexes) of Boolean;
- -- Set of supported languages used in a project
-
- No_Languages : constant Languages_In_Project := (others => False);
- -- No supported languages are used
-
- type Supp_Language_Index is new Nat;
- No_Supp_Language_Index : constant Supp_Language_Index := 0;
-
- type Supp_Language is record
- Index : Language_Index := No_Language_Index;
- Present : Boolean := False;
- Next : Supp_Language_Index := No_Supp_Language_Index;
- end record;
-
- package Present_Language_Table is new GNAT.Dynamic_Tables
- (Table_Component_Type => Supp_Language,
- Table_Index_Type => Supp_Language_Index,
- Table_Low_Bound => 1,
- Table_Initial => 4,
- Table_Increment => 100);
- -- The table for the presence of languages with an index that is outside
- -- of First_Language_Indexes.
-
- type Impl_Suffix_Array is array (First_Language_Indexes) of File_Name_Type;
- -- Suffixes for the non spec sources of the different supported languages
- -- in a project.
-
- No_Impl_Suffixes : constant Impl_Suffix_Array := (others => No_File);
- -- A default value for the non spec source suffixes
-
- type Supp_Suffix is record
- Index : Language_Index := No_Language_Index;
- Suffix : File_Name_Type := No_File;
- Next : Supp_Language_Index := No_Supp_Language_Index;
- end record;
-
- package Supp_Suffix_Table is new GNAT.Dynamic_Tables
- (Table_Component_Type => Supp_Suffix,
- Table_Index_Type => Supp_Language_Index,
- Table_Low_Bound => 1,
- Table_Initial => 4,
- Table_Increment => 100);
- -- The table for the presence of languages with an index that is outside
- -- of First_Language_Indexes.
-
- type Lang_Kind is (GNU, Other);
-
- type Language_Processing_Data is record
- Compiler_Drivers : Name_List_Index := No_Name_List;
- Compiler_Paths : Name_Id := No_Name;
- Compiler_Kinds : Lang_Kind := GNU;
- Dependency_Options : Name_List_Index := No_Name_List;
- Compute_Dependencies : Name_List_Index := No_Name_List;
- Include_Options : Name_List_Index := No_Name_List;
- Binder_Drivers : Name_Id := No_Name;
- Binder_Driver_Paths : Name_Id := No_Name;
- end record;
-
- Default_Language_Processing_Data :
- constant Language_Processing_Data :=
- (Compiler_Drivers => No_Name_List,
- Compiler_Paths => No_Name,
- Compiler_Kinds => GNU,
- Dependency_Options => No_Name_List,
- Compute_Dependencies => No_Name_List,
- Include_Options => No_Name_List,
- Binder_Drivers => No_Name,
- Binder_Driver_Paths => No_Name);
-
- type First_Language_Processing_Data is
- array (First_Language_Indexes) of Language_Processing_Data;
-
- Default_First_Language_Processing_Data :
- constant First_Language_Processing_Data :=
- (others => Default_Language_Processing_Data);
-
- type Supp_Language_Data is record
- Index : Language_Index := No_Language_Index;
- Data : Language_Processing_Data := Default_Language_Processing_Data;
- Next : Supp_Language_Index := No_Supp_Language_Index;
- end record;
-
- package Supp_Language_Table is new GNAT.Dynamic_Tables
- (Table_Component_Type => Supp_Language_Data,
- Table_Index_Type => Supp_Language_Index,
- Table_Low_Bound => 1,
- Table_Initial => 4,
- Table_Increment => 100);
- -- The table for language data when there are more languages than
- -- in First_Language_Indexes.
-
- type Other_Source_Id is new Nat;
- No_Other_Source : constant Other_Source_Id := 0;
-
- type Other_Source is record
- Language : Language_Index; -- language of the source
- File_Name : File_Name_Type; -- source file simple name
- Path_Name : Path_Name_Type; -- source full path name
- Source_TS : Time_Stamp_Type; -- source file time stamp
- Object_Name : File_Name_Type; -- object file simple name
- Object_Path : Path_Name_Type; -- object full path name
- Object_TS : Time_Stamp_Type; -- object file time stamp
- Dep_Name : File_Name_Type; -- dependency file simple name
- Dep_Path : Path_Name_Type; -- dependency full path name
- Dep_TS : Time_Stamp_Type; -- dependency file time stamp
- Naming_Exception : Boolean := False; -- True if a naming exception
- Next : Other_Source_Id := No_Other_Source;
- end record;
- -- Data for a source in a language other than Ada
-
- package Other_Source_Table is new GNAT.Dynamic_Tables
- (Table_Component_Type => Other_Source,
- Table_Index_Type => Other_Source_Id,
- Table_Low_Bound => 1,
- Table_Initial => 200,
- Table_Increment => 100);
- -- The table for sources of languages other than Ada
-
-- The following record contains data for a naming scheme
type Naming_Data is record
@@ -1044,10 +890,6 @@ package Prj is
-- An associative array listing body file names that do not have the
-- body suffix. Not used by Ada. Indexed by programming language name.
- -- For gprmake:
-
- Impl_Suffixes : Impl_Suffix_Array := No_Impl_Suffixes;
- Supp_Suffixes : Supp_Language_Index := No_Supp_Language_Index;
end record;
function Spec_Suffix_Of
@@ -1407,12 +1249,15 @@ package Prj is
-- Sources --
-------------
+ Ada_Sources_Present : Boolean := True;
+ -- True if there are Ada sources in the project
+
+ Other_Sources_Present : Boolean := True;
+ -- True if there are non-Ada sources in the project
+
Ada_Sources : String_List_Id := Nil_String;
-- The list of all the Ada source file names (gnatmake only)
- Sources : String_List_Id := Nil_String;
- -- Identical to Ada_Sources (for upward compatibility with GPS)
-
First_Source : Source_Id := No_Source;
Last_Source : Source_Id := No_Source;
-- Head and tail of the list of sources
@@ -1451,20 +1296,6 @@ package Prj is
-- use this field directly outside of the project manager, use
-- Prj.Env.Ada_Include_Path instead.
- -------------
- -- Linking --
- -------------
-
- Linker_Name : File_Name_Type := No_File;
- -- Value of attribute Language_Processing'Linker in the project file
-
- Linker_Path : Path_Name_Type := No_Path;
- -- Path of linker when attribute Language_Processing'Linker is specified
-
- Minimum_Linker_Options : Name_List_Index := No_Name_List;
- -- List of options specified in attribute
- -- Language_Processing'Minimum_Linker_Options.
-
-------------------
-- Miscellaneous --
-------------------
@@ -1515,32 +1346,6 @@ package Prj is
-- True if there are comments in the project sources that cannot be kept
-- in the project tree.
- ------------------
- -- For gprmake --
- ------------------
-
- Langs : Languages_In_Project := No_Languages;
- Supp_Languages : Supp_Language_Index := No_Supp_Language_Index;
- -- Indicate the different languages of the source of this project
-
- Ada_Sources_Present : Boolean := True;
- -- True if there are Ada sources in the project
-
- Other_Sources_Present : Boolean := True;
- -- True if there are sources from languages other than Ada in the
- -- project.
-
- First_Other_Source : Other_Source_Id := No_Other_Source;
- -- First source of a language other than Ada
-
- Last_Other_Source : Other_Source_Id := No_Other_Source;
- -- Last source of a language other than Ada
-
- First_Lang_Processing : First_Language_Processing_Data :=
- Default_First_Language_Processing_Data;
- Supp_Language_Processing : Supp_Language_Index :=
- No_Supp_Language_Index;
- -- Language configurations
end record;
function Empty_Project (Tree : Project_Tree_Ref) return Project_Data;
@@ -1560,12 +1365,6 @@ package Prj is
-- Return True when Language_Name (which must be lower case) is one of the
-- languages used for the project.
- function There_Are_Ada_Sources
- (In_Tree : Project_Tree_Ref;
- Project : Project_Id) return Boolean;
- -- ??? needs comment
- -- ??? Name sounds strange, suggested replacement: Ada_Sources_Present
-
Project_Error : exception;
-- Raised by some subprograms in Prj.Attr
@@ -1664,13 +1463,6 @@ package Prj is
Files_HT : Files_Htable.Instance;
Source_Paths_HT : Source_Paths_Htable.Instance;
- -- For gprmake:
-
- Present_Languages : Present_Language_Table.Instance;
- Supp_Suffixes : Supp_Suffix_Table.Instance;
- Supp_Languages : Supp_Language_Table.Instance;
- Other_Sources : Other_Source_Table.Instance;
-
-- Private part
Private_Part : Private_Project_Tree_Data;
@@ -1743,59 +1535,6 @@ package Prj is
(Source_File_Name : File_Name_Type) return File_Name_Type;
-- Returns the switches file name corresponding to a source file name
- -- For gprmake
-
- function Body_Suffix_Of
- (Language : Language_Index;
- In_Project : Project_Data;
- In_Tree : Project_Tree_Ref) return String;
- -- Returns the suffix of sources of language Language in project In_Project
- -- in project tree In_Tree.
-
- function Is_Present
- (Language : Language_Index;
- In_Project : Project_Data;
- In_Tree : Project_Tree_Ref) return Boolean;
- -- Return True when Language is one of the languages used in
- -- project In_Project.
-
- procedure Set
- (Language : Language_Index;
- Present : Boolean;
- In_Project : in out Project_Data;
- In_Tree : Project_Tree_Ref);
- -- Indicate if Language is or not a language used in project In_Project
-
- function Language_Processing_Data_Of
- (Language : Language_Index;
- In_Project : Project_Data;
- In_Tree : Project_Tree_Ref) return Language_Processing_Data;
- -- Return the Language_Processing_Data for language Language in project
- -- In_Project. Return the default when no Language_Processing_Data are
- -- defined for the language.
-
- procedure Set
- (Language_Processing : Language_Processing_Data;
- For_Language : Language_Index;
- In_Project : in out Project_Data;
- In_Tree : Project_Tree_Ref);
- -- Set the Language_Processing_Data for language Language in project
- -- In_Project.
-
- function Suffix_Of
- (Language : Language_Index;
- In_Project : Project_Data;
- In_Tree : Project_Tree_Ref) return File_Name_Type;
- -- Return the suffix for language Language in project In_Project. Return
- -- No_Name when no suffix is defined for the language.
-
- procedure Set
- (Suffix : File_Name_Type;
- For_Language : Language_Index;
- In_Project : in out Project_Data;
- In_Tree : Project_Tree_Ref);
- -- Set the suffix for language Language in project In_Project
-
----------------
-- Temp Files --
----------------
diff --git a/gcc/ada/raise-gcc.c b/gcc/ada/raise-gcc.c
index bb25ea631d1..e2662e14f23 100644
--- a/gcc/ada/raise-gcc.c
+++ b/gcc/ada/raise-gcc.c
@@ -6,7 +6,7 @@
* *
* C Implementation File *
* *
- * Copyright (C) 1992-2007, Free Software Foundation, Inc. *
+ * Copyright (C) 1992-2008, Free Software Foundation, Inc. *
* *
* GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- *
@@ -35,6 +35,7 @@
#ifdef IN_RTS
#include "tconfig.h"
+#include "tsystem.h"
/* In the top-of-tree GCC, tconfig does not include tm.h, but in GCC 3.2
it does. To avoid branching raise.c just for that purpose, we kludge by
looking for a symbol always defined by tm.h and if it's not defined,
@@ -43,7 +44,6 @@
#include "coretypes.h"
#include "tm.h"
#endif
-#include "tsystem.h"
#include <sys/stat.h>
#include <stdarg.h>
typedef char bool;
diff --git a/gcc/ada/restrict.adb b/gcc/ada/restrict.adb
index 2f1bd5dec3d..99a20afcad9 100644
--- a/gcc/ada/restrict.adb
+++ b/gcc/ada/restrict.adb
@@ -52,22 +52,20 @@ package body Restrict is
-- Local Subprograms --
-----------------------
- procedure Restriction_Msg (Msg : String; R : String; N : Node_Id);
- -- Output error message at node N with given text, replacing the
- -- '%' in the message with the name of the restriction given as R,
- -- cased according to the current identifier casing. We do not use
- -- the normal insertion mechanism, since this requires an entry
- -- in the Names table, and this table will be locked if we are
- -- generating a message from gigi.
+ procedure Restriction_Msg (R : Restriction_Id; N : Node_Id);
+ -- Called if a violation of restriction R at node N is found. This routine
+ -- outputs the appropriate message or messages taking care of warning vs
+ -- real violation, serious vs non-serious, implicit vs explicit, the second
+ -- message giving the profile name if needed, and the location information.
function Same_Unit (U1, U2 : Node_Id) return Boolean;
-- Returns True iff U1 and U2 represent the same library unit. Used for
-- handling of No_Dependence => Unit restriction case.
function Suppress_Restriction_Message (N : Node_Id) return Boolean;
- -- N is the node for a possible restriction violation message, but
- -- the message is to be suppressed if this is an internal file and
- -- this file is not the main unit.
+ -- N is the node for a possible restriction violation message, but the
+ -- message is to be suppressed if this is an internal file and this file is
+ -- not the main unit. Returns True if message is to be suppressed.
-------------------
-- Abort_Allowed --
@@ -148,7 +146,7 @@ package body Restrict is
if Name_Len < 5
or else (Name_Buffer (Name_Len - 3 .. Name_Len) /= ".ads"
and then
- Name_Buffer (Name_Len - 4 .. Name_Len) /= ".adb")
+ Name_Buffer (Name_Len - 3 .. Name_Len) /= ".adb")
then
return;
end if;
@@ -194,8 +192,6 @@ package body Restrict is
N : Node_Id;
V : Uint := Uint_Minus_1)
is
- Rimage : constant String := Restriction_Id'Image (R);
-
VV : Integer;
-- V converted to integer form. If V is greater than Integer'Last,
-- it is reset to minus 1 (unknown value).
@@ -311,35 +307,7 @@ package body Restrict is
and then Restrictions.Value (R) = 0)
or else Restrictions.Count (R) > Restrictions.Value (R)
then
- Error_Msg_Sloc := Restrictions_Loc (R);
-
- -- If we have a location for the Restrictions pragma, output it
-
- if Error_Msg_Sloc > No_Location
- or else Error_Msg_Sloc = System_Location
- then
- if Restriction_Warnings (R) then
- Restriction_Msg ("|violation of restriction %#?", Rimage, N);
- else
- -- Normally a restriction violation is a non-serious error,
- -- but we treat violation of No_Finalization as a serious
- -- error, since we want to turn off expansion in this case,
- -- expansion just causes too many cascaded errors.
-
- if R = No_Finalization then
- Restriction_Msg ("violation of restriction %#", Rimage, N);
- else
- Restriction_Msg ("|violation of restriction %#", Rimage, N);
- end if;
- end if;
-
- -- Otherwise we have the case of an implicit restriction
- -- (e.g. a restriction implicitly set by another pragma)
-
- else
- Restriction_Msg
- ("|violation of implicit restriction %", Rimage, N);
- end if;
+ Restriction_Msg (R, N);
end if;
end Check_Restriction;
@@ -543,43 +511,147 @@ package body Restrict is
-- Restriction_Msg --
---------------------
- procedure Restriction_Msg (Msg : String; R : String; N : Node_Id) is
- B : String (1 .. Msg'Length + 2 * R'Length + 1);
- P : Natural := 1;
+ procedure Restriction_Msg (R : Restriction_Id; N : Node_Id) is
+ Msg : String (1 .. 100);
+ Len : Natural := 0;
- begin
- Name_Buffer (1 .. R'Last) := R;
- Name_Len := R'Length;
- Set_Casing (Identifier_Casing (Get_Source_File_Index (Sloc (N))));
-
- P := 0;
- for J in Msg'Range loop
- if Msg (J) = '%' then
- P := P + 1;
- B (P) := '`';
-
- -- Put characters of image in message, quoting upper case letters
-
- for J in 1 .. Name_Len loop
- if Name_Buffer (J) in 'A' .. 'Z' then
- P := P + 1;
- B (P) := ''';
- end if;
+ procedure Add_Char (C : Character);
+ -- Append given character to Msg, bumping Len
- P := P + 1;
- B (P) := Name_Buffer (J);
- end loop;
+ procedure Add_Str (S : String);
+ -- Append given string to Msg, bumping Len appropriately
+
+ procedure Id_Case (S : String; Quotes : Boolean := True);
+ -- Given a string S, case it according to current identifier casing,
+ -- and store in Error_Msg_String. Then append `~` to the message buffer
+ -- to output the string unchanged surrounded in quotes. The quotes are
+ -- suppressed if Quotes = False.
+
+ --------------
+ -- Add_Char --
+ --------------
+
+ procedure Add_Char (C : Character) is
+ begin
+ Len := Len + 1;
+ Msg (Len) := C;
+ end Add_Char;
+
+ -------------
+ -- Add_Str --
+ -------------
- P := P + 1;
- B (P) := '`';
+ procedure Add_Str (S : String) is
+ begin
+ Msg (Len + 1 .. Len + S'Length) := S;
+ Len := Len + S'Length;
+ end Add_Str;
+ -------------
+ -- Id_Case --
+ -------------
+
+ procedure Id_Case (S : String; Quotes : Boolean := True) is
+ begin
+ Name_Buffer (1 .. S'Last) := S;
+ Name_Len := S'Length;
+ Set_Casing (Identifier_Casing (Get_Source_File_Index (Sloc (N))));
+ Error_Msg_Strlen := Name_Len;
+ Error_Msg_String (1 .. Name_Len) := Name_Buffer (1 .. Name_Len);
+
+ if Quotes then
+ Add_Str ("`~`");
else
- P := P + 1;
- B (P) := Msg (J);
+ Add_Char ('~');
+ end if;
+ end Id_Case;
+
+ -- Start of processing for Restriction_Msg
+
+ begin
+ -- Set warning message if warning
+
+ if Restriction_Warnings (R) then
+ Add_Char ('?');
+
+ -- If real violation (not warning), then mark it as non-serious unless
+ -- it is a violation of No_Finalization in which case we leave it as a
+ -- serious message, since otherwise we get crashes during attempts to
+ -- expand stuff that is not properly formed due to assumptions made
+ -- about no finalization being present.
+
+ elsif R /= No_Finalization then
+ Add_Char ('|');
+ end if;
+
+ Error_Msg_Sloc := Restrictions_Loc (R);
+
+ -- Set main message, adding implicit if no source location
+
+ if Error_Msg_Sloc > No_Location
+ or else Error_Msg_Sloc = System_Location
+ then
+ Add_Str ("violation of restriction ");
+ else
+ Add_Str ("violation of implicit restriction ");
+ Error_Msg_Sloc := No_Location;
+ end if;
+
+ -- Case of parametrized restriction
+
+ if R in All_Parameter_Restrictions then
+ Add_Char ('`');
+ Id_Case (Restriction_Id'Image (R), Quotes => False);
+ Add_Str (" = ^`");
+ Error_Msg_Uint_1 := UI_From_Int (Int (Restrictions.Value (R)));
+
+ -- Case of boolean restriction
+
+ else
+ Id_Case (Restriction_Id'Image (R));
+ end if;
+
+ -- Case of no secondary profile continuation message
+
+ if Restriction_Profile_Name (R) = No_Profile then
+ if Error_Msg_Sloc /= No_Location then
+ Add_Char ('#');
+ end if;
+
+ Add_Char ('!');
+ Error_Msg_N (Msg (1 .. Len), N);
+
+ -- Case of secondary profile continuation message present
+
+ else
+ Add_Char ('!');
+ Error_Msg_N (Msg (1 .. Len), N);
+
+ Len := 0;
+ Add_Char ('\');
+
+ -- Set as warning if warning case
+
+ if Restriction_Warnings (R) then
+ Add_Char ('?');
end if;
- end loop;
- Error_Msg_N (B (1 .. P), N);
+ -- Set main message
+
+ Add_Str ("from profile ");
+ Id_Case (Profile_Name'Image (Restriction_Profile_Name (R)));
+
+ -- Add location if we have one
+
+ if Error_Msg_Sloc /= No_Location then
+ Add_Char ('#');
+ end if;
+
+ -- Output unconditional message and we are done
+
+ Add_Char ('!');
+ Error_Msg_N (Msg (1 .. Len), N);
+ end if;
end Restriction_Msg;
---------------
@@ -634,6 +706,10 @@ package body Restrict is
Set_Restriction (J, N, V (J));
end if;
+ -- Record that this came from a Profile[_Warnings] restriction
+
+ Restriction_Profile_Name (J) := P;
+
-- Set warning flag, except that we do not set the warning
-- flag if the restriction was already active and this is
-- the warning case. That avoids a warning overriding a real
@@ -683,13 +759,17 @@ package body Restrict is
Restricted_Profile_Cached := False;
end if;
- -- Set location, but preserve location of system
- -- restriction for nice error msg with run time name
+ -- Set location, but preserve location of system restriction for nice
+ -- error msg with run time name.
if Restrictions_Loc (R) /= System_Location then
Restrictions_Loc (R) := Sloc (N);
end if;
+ -- Note restriction came from restriction pragma, not profile
+
+ Restriction_Profile_Name (R) := No_Profile;
+
-- Record the restriction if we are in the main unit, or in the extended
-- main unit. The reason that we test separately for Main_Unit is that
-- gnat.adc is processed with Current_Sem_Unit = Main_Unit, but nodes in
@@ -731,12 +811,11 @@ package body Restrict is
Restrictions_Loc (R) := Sloc (N);
end if;
- -- Record the restriction if we are in the main unit,
- -- or in the extended main unit. The reason that we
- -- test separately for Main_Unit is that gnat.adc is
- -- processed with Current_Sem_Unit = Main_Unit, but
- -- nodes in gnat.adc do not appear to be the extended
- -- main source unit (they probably should do ???)
+ -- Record the restriction if we are in the main unit, or in the extended
+ -- main unit. The reason that we test separately for Main_Unit is that
+ -- gnat.adc is processed with Current_Sem_Unit = Main_Unit, but nodes in
+ -- gnat.adc do not appear to be the extended main source unit (they
+ -- probably should do ???)
if Current_Sem_Unit = Main_Unit
or else In_Extended_Main_Source_Unit (N)
@@ -751,6 +830,10 @@ package body Restrict is
Main_Restrictions.Value (R) := V;
end if;
end if;
+
+ -- Note restriction came from restriction pragma, not profile
+
+ Restriction_Profile_Name (R) := No_Profile;
end Set_Restriction;
-----------------------------------
@@ -758,8 +841,9 @@ package body Restrict is
-----------------------------------
procedure Set_Restriction_No_Dependence
- (Unit : Node_Id;
- Warn : Boolean)
+ (Unit : Node_Id;
+ Warn : Boolean;
+ Profile : Profile_Name := No_Profile)
is
begin
-- Loop to check for duplicate entry
@@ -782,7 +866,7 @@ package body Restrict is
-- Entry is not currently in table
- No_Dependence.Append ((Unit, Warn));
+ No_Dependence.Append ((Unit, Warn, Profile));
end Set_Restriction_No_Dependence;
----------------------------------
diff --git a/gcc/ada/restrict.ads b/gcc/ada/restrict.ads
index bb81d85ed79..2553e0444aa 100644
--- a/gcc/ada/restrict.ads
+++ b/gcc/ada/restrict.ads
@@ -50,6 +50,12 @@ package Restrict is
-- pragma, and a value of System_Location is used for restrictions
-- set from package Standard by the processing in Targparm.
+ Restriction_Profile_Name : array (All_Restrictions) of Profile_Name;
+ -- Entries in this array are valid only if the corresponding restriction
+ -- in Restrictions set. The value is the corresponding profile name if the
+ -- restriction was set by a Profile or Profile_Warnings pragma. The value
+ -- is No_Profile in all other cases.
+
Main_Restrictions : Restrictions_Info := No_Restrictions;
-- This variable records only restrictions found in any units of the
-- main extended unit. These are the variables used for ali file output,
@@ -154,6 +160,10 @@ package Restrict is
Warn : Boolean;
-- True if from Restriction_Warnings, False if from Restrictions
+
+ Profile : Profile_Name;
+ -- Set to name of profile from which No_Dependence entry came, or to
+ -- No_Profile if a pragma Restriction set the No_Dependence entry.
end record;
package No_Dependence is new Table.Table (
@@ -190,14 +200,13 @@ package Restrict is
V : Uint := Uint_Minus_1);
-- Checks that the given restriction is not set, and if it is set, an
-- appropriate message is posted on the given node. Also records the
- -- violation in the appropriate internal arrays. Note that it is
- -- mandatory to always use this routine to check if a restriction
- -- is violated. Such checks must never be done directly by the caller,
- -- since otherwise violations in the absence of restrictions are not
- -- properly recorded. The value of V is relevant only for parameter
- -- restrictions, and in this case indicates the exact count for the
- -- violation. If the exact count is not known, V is left at its
- -- default value of -1 which indicates an unknown count.
+ -- violation in the appropriate internal arrays. Note that it is mandatory
+ -- to always use this routine to check if a restriction is violated. Such
+ -- checks must never be done directly by the caller, since otherwise
+ -- violations in the absence of restrictions are not properly recorded. The
+ -- value of V is relevant only for parameter restrictions, and in this case
+ -- indicates the exact count for the violation. If the exact count is not
+ -- known, V is left at its default of -1 which indicates an unknown count.
procedure Check_Restriction_No_Dependence (U : Node_Id; Err : Node_Id);
-- Called when a dependence on a unit is created (either implicitly, or by
@@ -302,18 +311,19 @@ package Restrict is
-- parameter restriction, and the corresponding value V is given.
procedure Set_Restriction_No_Dependence
- (Unit : Node_Id;
- Warn : Boolean);
+ (Unit : Node_Id;
+ Warn : Boolean;
+ Profile : Profile_Name := No_Profile);
-- Sets given No_Dependence restriction in table if not there already.
-- Warn is True if from Restriction_Warnings, or for Restrictions if flag
-- Treat_Restrictions_As_Warnings is set. False if from Restrictions and
- -- this flag is not set.
+ -- this flag is not set. Profile is set to a non-default value if the
+ -- No_Dependence restriction comes from a Profile pragma.
function Tasking_Allowed return Boolean;
pragma Inline (Tasking_Allowed);
- -- Tests to see if tasking operations are allowed by the current
- -- restrictions settings. For tasking to be allowed Max_Tasks must
- -- be non-zero.
+ -- Tests if tasking operations are allowed by the current restrictions
+ -- settings. For tasking to be allowed Max_Tasks must be non-zero.
private
type Save_Cunit_Boolean_Restrictions is
diff --git a/gcc/ada/rtsfind.adb b/gcc/ada/rtsfind.adb
index a0efccc3f06..fda3b2ff082 100644
--- a/gcc/ada/rtsfind.adb
+++ b/gcc/ada/rtsfind.adb
@@ -914,25 +914,6 @@ package body Rtsfind is
---------------
procedure Check_RPC is
-
- procedure Check_RPC_Failure (Msg : String);
- pragma No_Return (Check_RPC_Failure);
- -- Display Msg on standard error and raise Unrecoverable_Error
-
- -----------------------
- -- Check_RPC_Failure --
- -----------------------
-
- procedure Check_RPC_Failure (Msg : String) is
- begin
- Set_Standard_Error;
- Write_Str (Msg);
- Write_Eol;
- raise Unrecoverable_Error;
- end Check_RPC_Failure;
-
- -- Start of processing for Check_RPC
-
begin
-- Bypass this check if debug flag -gnatdR set
@@ -940,30 +921,44 @@ package body Rtsfind is
return;
end if;
- -- Otherwise we need the check if we are going after one of
- -- the critical entities in System.RPC in stubs mode.
-
- -- ??? Should we do this for other s-parint entities too?
-
- if (Distribution_Stub_Mode = Generate_Receiver_Stub_Body
- or else
- Distribution_Stub_Mode = Generate_Caller_Stub_Body)
- and then (E = RE_Do_Rpc
- or else
- E = RE_Do_Apc
- or else
- E = RE_Params_Stream_Type
- or else
- E = RE_Request_Access)
+ -- Otherwise we need the check if we are going after one of the
+ -- critical entities in System.RPC / System.Partition_Interface.
+
+ if E = RE_Do_Rpc
+ or else
+ E = RE_Do_Apc
+ or else
+ E = RE_Params_Stream_Type
+ or else
+ E = RE_Request_Access
then
- if Get_PCS_Name = Name_No_DSA then
- Check_RPC_Failure ("distribution feature not supported");
+ -- If generating RCI stubs, check that we have a real PCS
+
+ if (Distribution_Stub_Mode = Generate_Receiver_Stub_Body
+ or else
+ Distribution_Stub_Mode = Generate_Caller_Stub_Body)
+ and then Get_PCS_Name = Name_No_DSA
+ then
+ Set_Standard_Error;
+ Write_Str ("distribution feature not supported");
+ Write_Eol;
+ raise Unrecoverable_Error;
+
+ -- In all cases, check Exp_Dist and System.Partition_Interface
+ -- consistency.
elsif Get_PCS_Version /=
Exp_Dist.PCS_Version_Number (Get_PCS_Name)
then
- Check_RPC_Failure ("PCS version mismatch");
-
+ Set_Standard_Error;
+ Write_Str ("PCS version mismatch: expander ");
+ Write_Int (Exp_Dist.PCS_Version_Number (Get_PCS_Name));
+ Write_Str (", PCS (");
+ Write_Name (Get_PCS_Name);
+ Write_Str (") ");
+ Write_Int (Get_PCS_Version);
+ Write_Eol;
+ raise Unrecoverable_Error;
end if;
end if;
end Check_RPC;
diff --git a/gcc/ada/rtsfind.ads b/gcc/ada/rtsfind.ads
index b3bbf6a3539..34e84065907 100644
--- a/gcc/ada/rtsfind.ads
+++ b/gcc/ada/rtsfind.ads
@@ -209,6 +209,7 @@ package Rtsfind is
System_Compare_Array_Unsigned_64,
System_Compare_Array_Unsigned_8,
System_DSA_Services,
+ System_DSA_Types,
System_Exception_Table,
System_Exceptions,
System_Exn_Int,
@@ -696,6 +697,8 @@ package Rtsfind is
RE_Get_Local_Partition_Id, -- System.DSA_Services
RE_Get_Passive_Partition_Id, -- System.DSA_Services
+ RE_Any_Content_Ptr, -- System.DSA_Types
+
RE_Register_Exception, -- System.Exception_Table
RE_Local_Raise, -- System.Exceptions
@@ -1157,6 +1160,7 @@ package Rtsfind is
RE_BS_To_Any, -- System.Partition_Interface
RE_Any_To_BS, -- System.Partition_Interface
+ RE_FA_A, -- System.Partition_Interface
RE_FA_B, -- System.Partition_Interface
RE_FA_C, -- System.Partition_Interface
RE_FA_F, -- System.Partition_Interface
@@ -1205,7 +1209,7 @@ package Rtsfind is
RE_TC_Build, -- System.Partition_Interface
RE_Get_TC, -- System.Partition_Interface
RE_Set_TC, -- System.Partition_Interface
- RE_TC_Any, -- System.Partition_Interface
+ RE_TC_A, -- System.Partition_Interface
RE_TC_B, -- System.Partition_Interface
RE_TC_C, -- System.Partition_Interface
RE_TC_F, -- System.Partition_Interface
@@ -1331,17 +1335,29 @@ package Rtsfind is
RE_Str_Concat_5, -- System.String_Ops_Concat_5
RE_String_Input, -- System.Strings.Stream_Ops
+ RE_String_Input_Blk_IO, -- System.Strings.Stream_Ops
RE_String_Output, -- System.Strings.Stream_Ops
+ RE_String_Output_Blk_IO, -- System.Strings.Stream_Ops
RE_String_Read, -- System.Strings.Stream_Ops
+ RE_String_Read_Blk_IO, -- System.Strings.Stream_Ops
RE_String_Write, -- System.Strings.Stream_Ops
+ RE_String_Write_Blk_IO, -- System.Strings.Stream_Ops
RE_Wide_String_Input, -- System.Strings.Stream_Ops
+ RE_Wide_String_Input_Blk_IO, -- System.Strings.Stream_Ops
RE_Wide_String_Output, -- System.Strings.Stream_Ops
+ RE_Wide_String_Output_Blk_IO, -- System.Strings.Stream_Ops
RE_Wide_String_Read, -- System.Strings.Stream_Ops
+ RE_Wide_String_Read_Blk_IO, -- System.Strings.Stream_Ops
RE_Wide_String_Write, -- System.Strings.Stream_Ops
+ RE_Wide_String_Write_Blk_IO, -- System.Strings.Stream_Ops
RE_Wide_Wide_String_Input, -- System.Strings.Stream_Ops
+ RE_Wide_Wide_String_Input_Blk_IO, -- System.Strings.Stream_Ops
RE_Wide_Wide_String_Output, -- System.Strings.Stream_Ops
+ RE_Wide_Wide_String_Output_Blk_IO, -- System.Strings.Stream_Ops
RE_Wide_Wide_String_Read, -- System.Strings.Stream_Ops
+ RE_Wide_Wide_String_Read_Blk_IO, -- System.Strings.Stream_Ops
RE_Wide_Wide_String_Write, -- System.Strings.Stream_Ops
+ RE_Wide_Wide_String_Write_Blk_IO, -- System.Strings.Stream_Ops
RE_Task_Info_Type, -- System.Task_Info
RE_Unspecified_Task_Info, -- System.Task_Info
@@ -1838,6 +1854,8 @@ package Rtsfind is
RE_Get_Local_Partition_Id => System_DSA_Services,
RE_Get_Passive_Partition_Id => System_DSA_Services,
+ RE_Any_Content_Ptr => System_DSA_Types,
+
RE_Register_Exception => System_Exception_Table,
RE_Local_Raise => System_Exceptions,
@@ -2290,6 +2308,7 @@ package Rtsfind is
RE_BS_To_Any => System_Partition_Interface,
RE_Any_To_BS => System_Partition_Interface,
+ RE_FA_A => System_Partition_Interface,
RE_FA_B => System_Partition_Interface,
RE_FA_C => System_Partition_Interface,
RE_FA_F => System_Partition_Interface,
@@ -2338,7 +2357,7 @@ package Rtsfind is
RE_TC_Build => System_Partition_Interface,
RE_Get_TC => System_Partition_Interface,
RE_Set_TC => System_Partition_Interface,
- RE_TC_Any => System_Partition_Interface,
+ RE_TC_A => System_Partition_Interface,
RE_TC_B => System_Partition_Interface,
RE_TC_C => System_Partition_Interface,
RE_TC_F => System_Partition_Interface,
@@ -2473,17 +2492,29 @@ package Rtsfind is
RE_Str_Concat_5 => System_String_Ops_Concat_5,
RE_String_Input => System_Strings_Stream_Ops,
+ RE_String_Input_Blk_IO => System_Strings_Stream_Ops,
RE_String_Output => System_Strings_Stream_Ops,
+ RE_String_Output_Blk_IO => System_Strings_Stream_Ops,
RE_String_Read => System_Strings_Stream_Ops,
+ RE_String_Read_Blk_IO => System_Strings_Stream_Ops,
RE_String_Write => System_Strings_Stream_Ops,
+ RE_String_Write_Blk_IO => System_Strings_Stream_Ops,
RE_Wide_String_Input => System_Strings_Stream_Ops,
+ RE_Wide_String_Input_Blk_IO => System_Strings_Stream_Ops,
RE_Wide_String_Output => System_Strings_Stream_Ops,
+ RE_Wide_String_Output_Blk_IO => System_Strings_Stream_Ops,
RE_Wide_String_Read => System_Strings_Stream_Ops,
+ RE_Wide_String_Read_Blk_IO => System_Strings_Stream_Ops,
RE_Wide_String_Write => System_Strings_Stream_Ops,
+ RE_Wide_String_Write_Blk_IO => System_Strings_Stream_Ops,
RE_Wide_Wide_String_Input => System_Strings_Stream_Ops,
+ RE_Wide_Wide_String_Input_Blk_IO => System_Strings_Stream_Ops,
RE_Wide_Wide_String_Output => System_Strings_Stream_Ops,
+ RE_Wide_Wide_String_Output_Blk_IO => System_Strings_Stream_Ops,
RE_Wide_Wide_String_Read => System_Strings_Stream_Ops,
+ RE_Wide_Wide_String_Read_Blk_IO => System_Strings_Stream_Ops,
RE_Wide_Wide_String_Write => System_Strings_Stream_Ops,
+ RE_Wide_Wide_String_Write_Blk_IO => System_Strings_Stream_Ops,
RE_Task_Info_Type => System_Task_Info,
RE_Unspecified_Task_Info => System_Task_Info,
diff --git a/gcc/ada/s-direio.adb b/gcc/ada/s-direio.adb
index c764a1c658e..8a6dd435e7c 100644
--- a/gcc/ada/s-direio.adb
+++ b/gcc/ada/s-direio.adb
@@ -251,9 +251,12 @@ package body System.Direct_IO is
-----------
procedure Reset (File : in out File_Type; Mode : FCB.File_Mode) is
- pragma Unmodified (File);
+ pragma Warnings (Off, File);
-- File is actually modified via Unrestricted_Access below, but
-- GNAT will generate a warning anyway.
+ -- Note that we do not use pragma Unmodified here, since in -gnatc
+ -- mode, GNAT will complain that File is modified for
+ -- "File.Index := 1;"
begin
FIO.Reset (AP (File)'Unrestricted_Access, Mode);
@@ -262,9 +265,8 @@ package body System.Direct_IO is
end Reset;
procedure Reset (File : in out File_Type) is
- pragma Unmodified (File);
- -- File is actually modified via Unrestricted_Access below, but
- -- GNAT will generate a warning anyway.
+ pragma Warnings (Off, File);
+ -- See above (other Reset procedure) for explanations on this pragma
begin
FIO.Reset (AP (File)'Unrestricted_Access);
diff --git a/gcc/ada/s-fileio.adb b/gcc/ada/s-fileio.adb
index bfe7d6b0cc5..7c20fb18f38 100644
--- a/gcc/ada/s-fileio.adb
+++ b/gcc/ada/s-fileio.adb
@@ -33,10 +33,13 @@
with Ada.Finalization; use Ada.Finalization;
with Ada.IO_Exceptions; use Ada.IO_Exceptions;
+with Interfaces.C;
with Interfaces.C_Streams; use Interfaces.C_Streams;
with System.CRTL;
with System.Case_Util; use System.Case_Util;
+with System.OS_Constants;
+with System.OS_Lib;
with System.Soft_Links;
with Ada.Unchecked_Deallocation;
@@ -47,6 +50,7 @@ package body System.File_IO is
package SSL renames System.Soft_Links;
+ use type Interfaces.C.int;
use type System.CRTL.size_t;
----------------------
@@ -830,8 +834,8 @@ package body System.File_IO is
-- Normal case of Open or Create
else
- -- If temporary file case, get temporary file name and add
- -- to the list of temporary files to be deleted on exit.
+ -- If temporary file case, get temporary file name and add to the
+ -- list of temporary files to be deleted on exit.
if Tempfile then
if not Creat then
@@ -965,7 +969,7 @@ package body System.File_IO is
-- mode returned by Fopen_Mode is not "r" or "r+", then we first
-- make sure that the file exists as required by Ada semantics.
- if Creat = False and then Fopstr (1) /= 'r' then
+ if not Creat and then Fopstr (1) /= 'r' then
if file_exists (Namestr'Address) = 0 then
raise Name_Error;
end if;
@@ -984,7 +988,13 @@ package body System.File_IO is
Stream := fopen (Namestr'Address, Fopstr'Address, Encoding);
if Stream = NULL_Stream then
- if not Tempfile and then file_exists (Namestr'Address) = 0 then
+
+ -- Raise Name_Error if trying to open a non-existent file.
+ -- Otherwise raise Use_Error.
+
+ -- Should we raise Device_Error for ENOSPC???
+
+ if System.OS_Lib.Errno = System.OS_Constants.ENOENT then
raise Name_Error;
else
raise Use_Error;
diff --git a/gcc/ada/s-finimp.ads b/gcc/ada/s-finimp.ads
index 5bd1be1f8fd..7895326f85f 100644
--- a/gcc/ada/s-finimp.ads
+++ b/gcc/ada/s-finimp.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -66,7 +66,7 @@ package System.Finalization_Implementation is
-- packages. They will be finalized after the main program completion.
procedure Finalize_Global_List;
- -- The procedure to be called in order to finalize the global list;
+ -- The procedure to be called in order to finalize the global list
procedure Attach_To_Final_List
(L : in out SFR.Finalizable_Ptr;
@@ -102,7 +102,7 @@ package System.Finalization_Implementation is
-- return object to the caller's finalization list.
procedure Finalize_List (L : SFR.Finalizable_Ptr);
- -- Call Finalize on each element of the list L;
+ -- Call Finalize on each element of the list L
procedure Finalize_One (Obj : in out SFR.Finalizable);
-- Call Finalize on Obj and remove its final list
diff --git a/gcc/ada/s-os_lib.adb b/gcc/ada/s-os_lib.adb
index 5655b3c0d7c..0e1c6c756b8 100755
--- a/gcc/ada/s-os_lib.adb
+++ b/gcc/ada/s-os_lib.adb
@@ -589,14 +589,12 @@ package body System.OS_Lib is
Mode : Copy_Mode := Copy;
Preserve : Attribute := Time_Stamps)
is
- Ada_Name : String_Access :=
- To_Path_String_Access
- (Name, C_String_Length (Name));
-
+ Ada_Name : String_Access :=
+ To_Path_String_Access
+ (Name, C_String_Length (Name));
Ada_Pathname : String_Access :=
To_Path_String_Access
(Pathname, C_String_Length (Pathname));
-
begin
Copy_File (Ada_Name.all, Ada_Pathname.all, Success, Mode, Preserve);
Free (Ada_Name);
@@ -621,6 +619,7 @@ package body System.OS_Lib is
declare
C_Source : String (1 .. Source'Length + 1);
C_Dest : String (1 .. Dest'Length + 1);
+
begin
C_Source (1 .. Source'Length) := Source;
C_Source (C_Source'Last) := ASCII.NUL;
@@ -647,10 +646,9 @@ package body System.OS_Lib is
Ada_Source : String_Access :=
To_Path_String_Access
(Source, C_String_Length (Source));
-
- Ada_Dest : String_Access :=
- To_Path_String_Access
- (Dest, C_String_Length (Dest));
+ Ada_Dest : String_Access :=
+ To_Path_String_Access
+ (Dest, C_String_Length (Dest));
begin
Copy_Time_Stamps (Ada_Source.all, Ada_Dest.all, Success);
Free (Ada_Source);
@@ -792,9 +790,9 @@ package body System.OS_Lib is
-- If it is not a digit, then there are no available
-- temp file names. Return Invalid_FD. There is almost
- -- no that this code will be ever be executed, since
- -- it would mean that there are one million temp files
- -- in the same directory!
+ -- no chance that this code will be ever be executed,
+ -- since it would mean that there are one million temp
+ -- files in the same directory!
SSL.Unlock_Task.all;
FD := Invalid_FD;
@@ -872,7 +870,7 @@ package body System.OS_Lib is
---------------------
function File_Time_Stamp (FD : File_Descriptor) return OS_Time is
- function File_Time (FD : File_Descriptor) return OS_Time;
+ function File_Time (FD : File_Descriptor) return OS_Time;
pragma Import (C, File_Time, "__gnat_file_time_fd");
begin
return File_Time (FD);
@@ -1316,6 +1314,25 @@ package body System.OS_Lib is
return Is_Readable_File (F_Name'Address);
end Is_Readable_File;
+ ------------------------
+ -- Is_Executable_File --
+ ------------------------
+
+ function Is_Executable_File (Name : C_File_Name) return Boolean is
+ function Is_Executable_File (Name : Address) return Integer;
+ pragma Import (C, Is_Executable_File, "__gnat_is_executable_file");
+ begin
+ return Is_Executable_File (Name) /= 0;
+ end Is_Executable_File;
+
+ function Is_Executable_File (Name : String) return Boolean is
+ F_Name : String (1 .. Name'Length + 1);
+ begin
+ F_Name (1 .. Name'Length) := Name;
+ F_Name (F_Name'Last) := ASCII.NUL;
+ return Is_Executable_File (F_Name'Address);
+ end Is_Executable_File;
+
---------------------
-- Is_Regular_File --
---------------------
@@ -1446,6 +1463,7 @@ package body System.OS_Lib is
if Path_Len = 0 then
return null;
+
else
Result := To_Path_String_Access (Path_Addr, Path_Len);
Free (Path_Addr);
@@ -1921,6 +1939,26 @@ package body System.OS_Lib is
end;
end if;
+ -- On Windows, remove all double-quotes that are possibly part of the
+ -- path but can cause problems with other methods.
+
+ if On_Windows then
+ declare
+ Index : Natural;
+
+ begin
+ Index := Path_Buffer'First;
+ for Current in Path_Buffer'First .. End_Path loop
+ if Path_Buffer (Current) /= '"' then
+ Path_Buffer (Index) := Path_Buffer (Current);
+ Index := Index + 1;
+ end if;
+ end loop;
+
+ End_Path := Index - 1;
+ end;
+ end if;
+
-- Start the conversions
-- If this is not finished after Max_Iterations, give up and return an
@@ -2261,19 +2299,47 @@ package body System.OS_Lib is
C_Set_Executable (C_Name (C_Name'First)'Address);
end Set_Executable;
- --------------------
- -- Set_Read_Only --
- --------------------
+ ----------------------
+ -- Set_Non_Readable --
+ ----------------------
- procedure Set_Read_Only (Name : String) is
- procedure C_Set_Read_Only (Name : C_File_Name);
- pragma Import (C, C_Set_Read_Only, "__gnat_set_readonly");
+ procedure Set_Non_Readable (Name : String) is
+ procedure C_Set_Non_Readable (Name : C_File_Name);
+ pragma Import (C, C_Set_Non_Readable, "__gnat_set_non_readable");
C_Name : aliased String (Name'First .. Name'Last + 1);
begin
C_Name (Name'Range) := Name;
C_Name (C_Name'Last) := ASCII.NUL;
- C_Set_Read_Only (C_Name (C_Name'First)'Address);
- end Set_Read_Only;
+ C_Set_Non_Readable (C_Name (C_Name'First)'Address);
+ end Set_Non_Readable;
+
+ ----------------------
+ -- Set_Non_Writable --
+ ----------------------
+
+ procedure Set_Non_Writable (Name : String) is
+ procedure C_Set_Non_Writable (Name : C_File_Name);
+ pragma Import (C, C_Set_Non_Writable, "__gnat_set_non_writable");
+ C_Name : aliased String (Name'First .. Name'Last + 1);
+ begin
+ C_Name (Name'Range) := Name;
+ C_Name (C_Name'Last) := ASCII.NUL;
+ C_Set_Non_Writable (C_Name (C_Name'First)'Address);
+ end Set_Non_Writable;
+
+ ------------------
+ -- Set_Readable --
+ ------------------
+
+ procedure Set_Readable (Name : String) is
+ procedure C_Set_Readable (Name : C_File_Name);
+ pragma Import (C, C_Set_Readable, "__gnat_set_readable");
+ C_Name : aliased String (Name'First .. Name'Last + 1);
+ begin
+ C_Name (Name'Range) := Name;
+ C_Name (C_Name'Last) := ASCII.NUL;
+ C_Set_Readable (C_Name (C_Name'First)'Address);
+ end Set_Readable;
--------------------
-- Set_Writable --
@@ -2378,12 +2444,12 @@ package body System.OS_Lib is
end Spawn;
procedure Spawn
- (Program_Name : String;
- Args : Argument_List;
- Output_File : String;
- Success : out Boolean;
- Return_Code : out Integer;
- Err_To_Out : Boolean := True)
+ (Program_Name : String;
+ Args : Argument_List;
+ Output_File : String;
+ Success : out Boolean;
+ Return_Code : out Integer;
+ Err_To_Out : Boolean := True)
is
FD : File_Descriptor;
@@ -2429,16 +2495,16 @@ package body System.OS_Lib is
type Chars is array (Positive range <>) of aliased Character;
type Char_Ptr is access constant Character;
- Command_Len : constant Positive := Program_Name'Length + 1
- + Args_Length (Args);
+ Command_Len : constant Positive := Program_Name'Length + 1
+ + Args_Length (Args);
Command_Last : Natural := 0;
- Command : aliased Chars (1 .. Command_Len);
+ Command : aliased Chars (1 .. Command_Len);
-- Command contains all characters of the Program_Name and Args, all
- -- terminated by ASCII.NUL characters
+ -- terminated by ASCII.NUL characters.
- Arg_List_Len : constant Positive := Args'Length + 2;
+ Arg_List_Len : constant Positive := Args'Length + 2;
Arg_List_Last : Natural := 0;
- Arg_List : aliased array (1 .. Arg_List_Len) of Char_Ptr;
+ Arg_List : aliased array (1 .. Arg_List_Len) of Char_Ptr;
-- List with pointers to NUL-terminated strings of the Program_Name
-- and the Args and terminated with a null pointer. We rely on the
-- default initialization for the last null pointer.
@@ -2532,9 +2598,8 @@ package body System.OS_Lib is
subtype Path_String is String (1 .. Path_Len);
type Path_String_Access is access Path_String;
- function Address_To_Access is new
- Ada.Unchecked_Conversion (Source => Address,
- Target => Path_String_Access);
+ function Address_To_Access is new Ada.Unchecked_Conversion
+ (Source => Address, Target => Path_String_Access);
Path_Access : constant Path_String_Access :=
Address_To_Access (Path_Addr);
diff --git a/gcc/ada/s-os_lib.ads b/gcc/ada/s-os_lib.ads
index 8c319c845e1..8364d16076e 100755
--- a/gcc/ada/s-os_lib.ads
+++ b/gcc/ada/s-os_lib.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1995-2007, Free Software Foundation, Inc. --
+-- Copyright (C) 1995-2008, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -149,9 +149,9 @@ package System.OS_Lib is
Hour : out Hour_Type;
Minute : out Minute_Type;
Second : out Second_Type);
- -- Analogous to the Split routine in Ada.Calendar, takes an OS_Time
- -- and provides a representation of it as a set of component parts,
- -- to be interpreted as a date point in UTC.
+ -- Analogous to the Split routine in Ada.Calendar, takes an OS_Time and
+ -- provides a representation of it as a set of component parts, to be
+ -- interpreted as a date point in UTC.
----------------
-- File Stuff --
@@ -238,11 +238,11 @@ package System.OS_Lib is
-- mode parameter is provided. Since this is a temporary file, there is no
-- point in doing text translation on it.
--
- -- On some OSes, the maximum number of temp files that can be created with
- -- this procedure may be limited. When the maximum is reached, this
- -- procedure returns Invalid_FD. On some OSes, there may be a race
- -- condition between processes trying to create temp files at the same
- -- time in the same directory using this procedure.
+ -- On some operating systems, the maximum number of temp files that can be
+ -- created with this procedure may be limited. When the maximum is reached,
+ -- this procedure returns Invalid_FD. On some operating systems, there may
+ -- be a race condition between processes trying to create temp files at the
+ -- same time in the same directory using this procedure.
procedure Create_Temp_File
(FD : out File_Descriptor;
@@ -472,6 +472,14 @@ package System.OS_Lib is
-- not actually be readable due to some other process having exclusive
-- access.
+ function Is_Executable_File (Name : String) return Boolean;
+ -- Determines if the given string, Name, is the name of an existing file
+ -- that is executable. Returns True if so, False otherwise. Note that this
+ -- function simply interrogates the file attributes (e.g. using the C
+ -- function stat), so it does not indicate a situation in which a file may
+ -- not actually be readable due to some other process having exclusive
+ -- access.
+
function Is_Writable_File (Name : String) return Boolean;
-- Determines if the given string, Name, is the name of an existing file
-- that is writable. Returns True if so, False otherwise. Note that this
@@ -490,27 +498,38 @@ package System.OS_Lib is
-- span file systems and may refer to directories.
procedure Set_Writable (Name : String);
- -- Change the permissions on the named file to make it writable
- -- for its owner.
+ -- Change permissions on the named file to make it writable for its owner
- procedure Set_Read_Only (Name : String);
- -- Change the permissions on the named file to make it non-writable
- -- for its owner.
+ procedure Set_Non_Writable (Name : String);
+ -- Change permissions on the named file to make it non-writable for its
+ -- owner. The readable and executable permissions are not modified.
+
+ procedure Set_Read_Only (Name : String) renames Set_Non_Writable;
+ -- This renaming is provided for backwards compatibility with previous
+ -- versions. The use of Set_Non_Writable is preferred (clearer name).
procedure Set_Executable (Name : String);
- -- Change the permissions on the named file to make it executable
- -- for its owner.
+ -- Change permissions on the named file to make it executable for its owner
+
+ procedure Set_Readable (Name : String);
+ -- Change permissions on the named file to make it readable for its
+ -- owner.
+
+ procedure Set_Non_Readable (Name : String);
+ -- Change permissions on the named file to make it non-readable for
+ -- its owner. The writable and executable permissions are not
+ -- modified.
function Locate_Exec_On_Path
(Exec_Name : String) return String_Access;
-- Try to locate an executable whose name is given by Exec_Name in the
- -- directories listed in the environment Path. If the Exec_Name doesn't
+ -- directories listed in the environment Path. If the Exec_Name does not
-- have the executable suffix, it will be appended before the search.
- -- Otherwise works like Locate_Regular_File below.
- -- If the executable is not found, null is returned.
+ -- Otherwise works like Locate_Regular_File below. If the executable is
+ -- not found, null is returned.
--
- -- Note that this function allocates some memory for the returned value.
- -- This memory needs to be deallocated after use.
+ -- Note that this function allocates memory for the returned value. This
+ -- memory needs to be deallocated after use.
function Locate_Regular_File
(File_Name : String;
@@ -536,10 +555,9 @@ package System.OS_Lib is
-- the heap and should be freed after use to avoid storage leaks.
function Get_Target_Debuggable_Suffix return String_Access;
- -- Return the target debuggable suffix convention. Usually this is the
- -- same as the convention for Get_Executable_Suffix. The result is
- -- allocated on the heap and should be freed after use to avoid storage
- -- leaks.
+ -- Return the target debuggable suffix convention. Usually this is the same
+ -- as the convention for Get_Executable_Suffix. The result is allocated on
+ -- the heap and should be freed after use to avoid storage leaks.
function Get_Executable_Suffix return String_Access;
-- Return the executable suffix convention. The result is allocated on the
@@ -608,6 +626,7 @@ package System.OS_Lib is
function Is_Regular_File (Name : C_File_Name) return Boolean;
function Is_Directory (Name : C_File_Name) return Boolean;
function Is_Readable_File (Name : C_File_Name) return Boolean;
+ function Is_Executable_File (Name : C_File_Name) return Boolean;
function Is_Writable_File (Name : C_File_Name) return Boolean;
function Is_Symbolic_Link (Name : C_File_Name) return Boolean;
diff --git a/gcc/ada/s-oscons-tmplt.c b/gcc/ada/s-oscons-tmplt.c
new file mode 100644
index 00000000000..614a8660d9b
--- /dev/null
+++ b/gcc/ada/s-oscons-tmplt.c
@@ -0,0 +1,1203 @@
+/*
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- S Y S T E M . O S _ C O N S T A N T S --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 2000-2008, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 2, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
+-- for more details. You should have received a copy of the GNU General --
+-- Public License distributed with GNAT; see file COPYING. If not, write --
+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
+-- Boston, MA 02110-1301, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, or you link this unit with other files to produce an executable, --
+-- this unit does not by itself cause the resulting executable to be --
+-- covered by the GNU General Public License. This exception does not --
+-- however invalidate any other reasons why the executable file might be --
+-- covered by the GNU Public License. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+*/
+
+/**
+ ** This template file is used while building the GNAT runtime library to
+ ** generate package System.OS_Constants (s-oscons.ads).
+ **
+ ** The generation process is:
+ ** 1. the platform-independent extraction tool xoscons is built with the
+ ** base native compiler
+ ** 2. this template is processed by the cross C compiler to produce
+ ** a list of constant values
+ ** 3. the comments in this template and the list of values are processed
+ ** by xoscons to generate s-oscons.ads.
+ **
+ ** Any comment occurring in this file whose start and end markers are on
+ ** a line by themselves (see above) is copied verbatim to s-oscons.ads.
+ ** All other comments are ignored. Note that the build process first passes
+ ** this file through the C preprocessor, so comments that occur in a section
+ ** that is conditioned by a #if directive will be copied to the output only
+ ** when it applies.
+ **
+ ** Two methods are supported to generate the list of constant values,
+ ** s-oscons-tmpl.s.
+ **
+ ** The default one assumes that the template can be compiled by the newly-
+ ** build cross compiler. It uses markup produced in the (pseudo-)assembly
+ ** listing:
+ **
+ ** xgcc -DTARGET=\"$target\" -C -E s-oscons-tmplt.c > s-oscons-tmplt.i
+ ** xgcc -S s-oscons-tmplt.i
+ ** xoscons
+ **
+ ** Alternatively, if s-oscons-tmplt.c must be compiled with a proprietary
+ ** compiler (e.g. the native DEC CC on OpenVMS), the NATIVE macro should
+ ** be defined, and the resulting program executed:
+ **
+ ** $ CC/DEFINE=("TARGET=""OpenVMS""",NATIVE)
+ ** /PREPROCESS_ONLY /COMMENTS=AS_IS s-oscons-tmplt
+ ** $ CC/DEFINE=("TARGET=""OpenVMS""",NATIVE) s-oscons-tmplt
+ ** $ LINK s-oscons-tmplt
+ ** $ DEFINE/USER SYS$OUTPUT s-oscons-tmplt.s
+ ** $ RUN s-oscons-tmplt
+ ** $ RUN xoscons
+ **
+ **/
+
+#ifndef TARGET
+# error Please define TARGET
+#endif
+
+#include <stdlib.h>
+#include <string.h>
+#include <limits.h>
+#include <fcntl.h>
+
+#if ! (defined (__vxworks) || defined (__VMS) || defined (__MINGW32__) || \
+ defined (__nucleus__))
+# define HAVE_TERMIOS
+#endif
+
+#include "gsocket.h"
+
+#ifndef HAVE_SOCKETS
+# include <errno.h>
+#endif
+
+#ifdef HAVE_TERMIOS
+# include <termios.h>
+#endif
+
+#ifdef NATIVE
+#include <stdio.h>
+#define CND(name,comment) \
+ printf ("\n->CND:$%d:" #name ":$%d:" comment, __LINE__, ((int) name));
+
+#define CNS(name,comment) \
+ printf ("\n->CNS:$%d:" #name ":" name ":" comment, __LINE__);
+
+#define TXT(text) \
+ printf ("\n->TXT:$%d:" text, __LINE__);
+
+#else
+
+#define CND(name, comment) \
+ asm volatile("\n->CND:%0:" #name ":%1:" comment \
+ : : "i" (__LINE__), "i" ((int) name));
+/* Decimal constant in the range of type "int" */
+
+#define CNS(name, comment) \
+ asm volatile("\n->CNS:%0:" #name ":" name ":" comment \
+ : : "i" (__LINE__));
+/* General expression constant */
+
+#define TXT(text) \
+ asm volatile("\n->TXT:%0:" text \
+ : : "i" (__LINE__));
+/* Freeform text */
+
+#endif
+
+#ifdef __MINGW32__
+unsigned int _CRT_fmode = _O_BINARY;
+#endif
+
+int
+main (void) {
+
+/*
+-- This package provides target dependent definitions of constant for use
+-- by the GNAT runtime library. This package should not be directly with'd
+-- by an application program.
+
+-- This file is generated automatically, do not modify it by hand! Instead,
+-- make changes to s-oscons-tmplt.c and rebuild the GNAT runtime library.
+*/
+
+/**
+ ** Do not change the format of the line below without also updating the
+ ** MaRTE Makefile.
+ **/
+TXT("-- This is the version for " TARGET)
+TXT("")
+
+#ifdef HAVE_SOCKETS
+/**
+ ** The type definitions for struct hostent components uses Interfaces.C
+ **/
+
+TXT("with Interfaces.C;")
+#endif
+
+/*
+package System.OS_Constants is
+
+ pragma Pure;
+*/
+
+/**
+ ** General constants (all platforms)
+ **/
+
+/*
+
+ -------------------
+ -- System limits --
+ -------------------
+
+*/
+
+#ifndef IOV_MAX
+# define IOV_MAX INT_MAX
+#endif
+CND(IOV_MAX, "Maximum writev iovcnt")
+
+/*
+
+ ---------------------
+ -- File open modes --
+ ---------------------
+
+*/
+
+#ifndef O_RDWR
+# define O_RDWR -1
+#endif
+CND(O_RDWR, "Read/write")
+
+#ifndef O_NOCTTY
+# define O_NOCTTY -1
+#endif
+CND(O_NOCTTY, "Don't change ctrl tty")
+
+#ifndef O_NDELAY
+# define O_NDELAY -1
+#endif
+CND(O_NDELAY, "Nonblocking")
+
+/*
+
+ ----------------------
+ -- Fcntl operations --
+ ----------------------
+
+*/
+
+#ifndef F_GETFL
+# define F_GETFL -1
+#endif
+CND(F_GETFL, "Get flags")
+
+#ifndef F_SETFL
+# define F_SETFL -1
+#endif
+CND(F_SETFL, "Set flags")
+
+/*
+
+ -----------------
+ -- Fcntl flags --
+ -----------------
+
+*/
+
+#ifndef FNDELAY
+# define FNDELAY -1
+#endif
+CND(FNDELAY, "Nonblocking")
+
+/*
+
+ ----------------------
+ -- Ioctl operatings --
+ ----------------------
+
+*/
+
+#ifndef FIONBIO
+# define FIONBIO -1
+#endif
+CND(FIONBIO, "Set/clear non-blocking io")
+
+#ifndef FIONREAD
+# define FIONREAD -1
+#endif
+CND(FIONREAD, "How many bytes to read")
+
+/*
+
+ ------------------
+ -- Errno values --
+ ------------------
+
+ -- The following constants are defined from <errno.h>
+
+*/
+#ifndef EAGAIN
+# define EAGAIN -1
+#endif
+CND(EAGAIN, "Try again")
+
+#ifndef ENOENT
+# define ENOENT -1
+#endif
+CND(ENOENT, "File not found")
+
+#ifndef ENOMEM
+# define ENOMEM -1
+#endif
+CND(ENOMEM, "Out of memory")
+
+#ifdef __MINGW32__
+/*
+
+ -- The following constants are defined from <winsock2.h> (WSA*)
+
+*/
+
+/**
+ ** For sockets-related errno values on Windows, gsocket.h redefines
+ ** Exxx as WSAExxx.
+ **/
+
+#endif
+
+#ifndef EACCES
+# define EACCES -1
+#endif
+CND(EACCES, "Permission denied")
+
+#ifndef EADDRINUSE
+# define EADDRINUSE -1
+#endif
+CND(EADDRINUSE, "Address already in use")
+
+#ifndef EADDRNOTAVAIL
+# define EADDRNOTAVAIL -1
+#endif
+CND(EADDRNOTAVAIL, "Cannot assign address")
+
+#ifndef EAFNOSUPPORT
+# define EAFNOSUPPORT -1
+#endif
+CND(EAFNOSUPPORT, "Addr family not supported")
+
+#ifndef EALREADY
+# define EALREADY -1
+#endif
+CND(EALREADY, "Operation in progress")
+
+#ifndef EBADF
+# define EBADF -1
+#endif
+CND(EBADF, "Bad file descriptor")
+
+#ifndef ECONNABORTED
+# define ECONNABORTED -1
+#endif
+CND(ECONNABORTED, "Connection aborted")
+
+#ifndef ECONNREFUSED
+# define ECONNREFUSED -1
+#endif
+CND(ECONNREFUSED, "Connection refused")
+
+#ifndef ECONNRESET
+# define ECONNRESET -1
+#endif
+CND(ECONNRESET, "Connection reset by peer")
+
+#ifndef EDESTADDRREQ
+# define EDESTADDRREQ -1
+#endif
+CND(EDESTADDRREQ, "Destination addr required")
+
+#ifndef EFAULT
+# define EFAULT -1
+#endif
+CND(EFAULT, "Bad address")
+
+#ifndef EHOSTDOWN
+# define EHOSTDOWN -1
+#endif
+CND(EHOSTDOWN, "Host is down")
+
+#ifndef EHOSTUNREACH
+# define EHOSTUNREACH -1
+#endif
+CND(EHOSTUNREACH, "No route to host")
+
+#ifndef EINPROGRESS
+# define EINPROGRESS -1
+#endif
+CND(EINPROGRESS, "Operation now in progress")
+
+#ifndef EINTR
+# define EINTR -1
+#endif
+CND(EINTR, "Interrupted system call")
+
+#ifndef EINVAL
+# define EINVAL -1
+#endif
+CND(EINVAL, "Invalid argument")
+
+#ifndef EIO
+# define EIO -1
+#endif
+CND(EIO, "Input output error")
+
+#ifndef EISCONN
+# define EISCONN -1
+#endif
+CND(EISCONN, "Socket already connected")
+
+#ifndef ELOOP
+# define ELOOP -1
+#endif
+CND(ELOOP, "Too many symbolic links")
+
+#ifndef EMFILE
+# define EMFILE -1
+#endif
+CND(EMFILE, "Too many open files")
+
+#ifndef EMSGSIZE
+# define EMSGSIZE -1
+#endif
+CND(EMSGSIZE, "Message too long")
+
+#ifndef ENAMETOOLONG
+# define ENAMETOOLONG -1
+#endif
+CND(ENAMETOOLONG, "Name too long")
+
+#ifndef ENETDOWN
+# define ENETDOWN -1
+#endif
+CND(ENETDOWN, "Network is down")
+
+#ifndef ENETRESET
+# define ENETRESET -1
+#endif
+CND(ENETRESET, "Disconn. on network reset")
+
+#ifndef ENETUNREACH
+# define ENETUNREACH -1
+#endif
+CND(ENETUNREACH, "Network is unreachable")
+
+#ifndef ENOBUFS
+# define ENOBUFS -1
+#endif
+CND(ENOBUFS, "No buffer space available")
+
+#ifndef ENOPROTOOPT
+# define ENOPROTOOPT -1
+#endif
+CND(ENOPROTOOPT, "Protocol not available")
+
+#ifndef ENOTCONN
+# define ENOTCONN -1
+#endif
+CND(ENOTCONN, "Socket not connected")
+
+#ifndef ENOTSOCK
+# define ENOTSOCK -1
+#endif
+CND(ENOTSOCK, "Operation on non socket")
+
+#ifndef EOPNOTSUPP
+# define EOPNOTSUPP -1
+#endif
+CND(EOPNOTSUPP, "Operation not supported")
+
+#ifndef EPFNOSUPPORT
+# define EPFNOSUPPORT -1
+#endif
+CND(EPFNOSUPPORT, "Unknown protocol family")
+
+#ifndef EPROTONOSUPPORT
+# define EPROTONOSUPPORT -1
+#endif
+CND(EPROTONOSUPPORT, "Unknown protocol")
+
+#ifndef EPROTOTYPE
+# define EPROTOTYPE -1
+#endif
+CND(EPROTOTYPE, "Unknown protocol type")
+
+#ifndef ESHUTDOWN
+# define ESHUTDOWN -1
+#endif
+CND(ESHUTDOWN, "Cannot send once shutdown")
+
+#ifndef ESOCKTNOSUPPORT
+# define ESOCKTNOSUPPORT -1
+#endif
+CND(ESOCKTNOSUPPORT, "Socket type not supported")
+
+#ifndef ETIMEDOUT
+# define ETIMEDOUT -1
+#endif
+CND(ETIMEDOUT, "Connection timed out")
+
+#ifndef ETOOMANYREFS
+# define ETOOMANYREFS -1
+#endif
+CND(ETOOMANYREFS, "Too many references")
+
+#ifndef EWOULDBLOCK
+# define EWOULDBLOCK -1
+#endif
+CND(EWOULDBLOCK, "Operation would block")
+
+/**
+ ** Terminal I/O constants
+ **/
+
+#ifdef HAVE_TERMIOS
+
+/*
+
+ ----------------------
+ -- Terminal control --
+ ----------------------
+
+*/
+
+#ifndef TCSANOW
+# define TCSANOW -1
+#endif
+CND(TCSANOW, "Immediate")
+
+#ifndef TCIFLUSH
+# define TCIFLUSH -1
+#endif
+CND(TCIFLUSH, "Flush input")
+
+#ifndef CLOCAL
+# define CLOCAL -1
+#endif
+CND(CLOCAL, "Local")
+
+#ifndef CRTSCTS
+# define CRTSCTS -1
+#endif
+CND(CRTSCTS, "Hardware flow control")
+
+#ifndef CREAD
+# define CREAD -1
+#endif
+CND(CREAD, "Read")
+
+#ifndef CS5
+# define CS5 -1
+#endif
+CND(CS5, "5 data bits")
+
+#ifndef CS6
+# define CS6 -1
+#endif
+CND(CS6, "6 data bits")
+
+#ifndef CS7
+# define CS7 -1
+#endif
+CND(CS7, "7 data bits")
+
+#ifndef CS8
+# define CS8 -1
+#endif
+CND(CS8, "8 data bits")
+
+#ifndef CSTOPB
+# define CSTOPB -1
+#endif
+CND(CSTOPB, "2 stop bits")
+
+#ifndef PARENB
+# define PARENB -1
+#endif
+CND(PARENB, "Parity enable")
+
+#ifndef PARODD
+# define PARODD -1
+#endif
+CND(PARODD, "Parity odd")
+
+#ifndef B0
+# define B0 -1
+#endif
+CND(B0, "0 bps")
+
+#ifndef B50
+# define B50 -1
+#endif
+CND(B50, "50 bps")
+
+#ifndef B75
+# define B75 -1
+#endif
+CND(B75, "75 bps")
+
+#ifndef B110
+# define B110 -1
+#endif
+CND(B110, "110 bps")
+
+#ifndef B134
+# define B134 -1
+#endif
+CND(B134, "134 bps")
+
+#ifndef B150
+# define B150 -1
+#endif
+CND(B150, "150 bps")
+
+#ifndef B200
+# define B200 -1
+#endif
+CND(B200, "200 bps")
+
+#ifndef B300
+# define B300 -1
+#endif
+CND(B300, "300 bps")
+
+#ifndef B600
+# define B600 -1
+#endif
+CND(B600, "600 bps")
+
+#ifndef B1200
+# define B1200 -1
+#endif
+CND(B1200, "1200 bps")
+
+#ifndef B1800
+# define B1800 -1
+#endif
+CND(B1800, "1800 bps")
+
+#ifndef B2400
+# define B2400 -1
+#endif
+CND(B2400, "2400 bps")
+
+#ifndef B4800
+# define B4800 -1
+#endif
+CND(B4800, "4800 bps")
+
+#ifndef B9600
+# define B9600 -1
+#endif
+CND(B9600, "9600 bps")
+
+#ifndef B19200
+# define B19200 -1
+#endif
+CND(B19200, "19200 bps")
+
+#ifndef B38400
+# define B38400 -1
+#endif
+CND(B38400, "38400 bps")
+
+#ifndef B57600
+# define B57600 -1
+#endif
+CND(B57600, "57600 bps")
+
+#ifndef B115200
+# define B115200 -1
+#endif
+CND(B115200, "115200 bps")
+
+#ifndef B230400
+# define B230400 -1
+#endif
+CND(B230400, "230400 bps")
+
+#ifndef B460800
+# define B460800 -1
+#endif
+CND(B460800, "460800 bps")
+
+#ifndef B500000
+# define B500000 -1
+#endif
+CND(B500000, "500000 bps")
+
+#ifndef B576000
+# define B576000 -1
+#endif
+CND(B576000, "576000 bps")
+
+#ifndef B921600
+# define B921600 -1
+#endif
+CND(B921600, "921600 bps")
+
+#ifndef B1000000
+# define B1000000 -1
+#endif
+CND(B1000000, "1000000 bps")
+
+#ifndef B1152000
+# define B1152000 -1
+#endif
+CND(B1152000, "1152000 bps")
+
+#ifndef B1500000
+# define B1500000 -1
+#endif
+CND(B1500000, "1500000 bps")
+
+#ifndef B2000000
+# define B2000000 -1
+#endif
+CND(B2000000, "2000000 bps")
+
+#ifndef B2500000
+# define B2500000 -1
+#endif
+CND(B2500000, "2500000 bps")
+
+#ifndef B3000000
+# define B3000000 -1
+#endif
+CND(B3000000, "3000000 bps")
+
+#ifndef B3500000
+# define B3500000 -1
+#endif
+CND(B3500000, "3500000 bps")
+
+#ifndef B4000000
+# define B4000000 -1
+#endif
+CND(B4000000, "4000000 bps")
+
+/*
+
+ ---------------------------------
+ -- Terminal control characters --
+ ---------------------------------
+
+*/
+
+#ifndef VINTR
+# define VINTR -1
+#endif
+CND(VINTR, "Interrupt")
+
+#ifndef VQUIT
+# define VQUIT -1
+#endif
+CND(VQUIT, "Quit")
+
+#ifndef VERASE
+# define VERASE -1
+#endif
+CND(VERASE, "Erase")
+
+#ifndef VKILL
+# define VKILL -1
+#endif
+CND(VKILL, "Kill")
+
+#ifndef VEOF
+# define VEOF -1
+#endif
+CND(VEOF, "EOF")
+
+#ifndef VTIME
+# define VTIME -1
+#endif
+CND(VTIME, "Read timeout")
+
+#ifndef VMIN
+# define VMIN -1
+#endif
+CND(VMIN, "Read min chars")
+
+#ifndef VSWTC
+# define VSWTC -1
+#endif
+CND(VSWTC, "Switch")
+
+#ifndef VSTART
+# define VSTART -1
+#endif
+CND(VSTART, "Flow control start")
+
+#ifndef VSTOP
+# define VSTOP -1
+#endif
+CND(VSTOP, "Flow control stop")
+
+#ifndef VSUSP
+# define VSUSP -1
+#endif
+CND(VSUSP, "Suspend")
+
+#ifndef VEOL
+# define VEOL -1
+#endif
+CND(VEOL, "EOL")
+
+#ifndef VREPRINT
+# define VREPRINT -1
+#endif
+CND(VREPRINT, "Reprint unread")
+
+#ifndef VDISCARD
+# define VDISCARD -1
+#endif
+CND(VDISCARD, "Discard pending")
+
+#ifndef VWERASE
+# define VWERASE -1
+#endif
+CND(VWERASE, "Word erase")
+
+#ifndef VLNEXT
+# define VLNEXT -1
+#endif
+CND(VLNEXT, "Literal next")
+
+#ifndef VEOL2
+# define VEOL2 -1
+#endif
+CND(VEOL2, "Alternative EOL")
+
+#endif /* HAVE_TERMIOS */
+
+/**
+ ** Sockets constants
+ **/
+
+#ifdef HAVE_SOCKETS
+
+/*
+
+ --------------
+ -- Families --
+ --------------
+
+*/
+
+#ifndef AF_INET
+# define AF_INET -1
+#endif
+CND(AF_INET, "IPv4 address family")
+
+/**
+ ** RTEMS lies and defines AF_INET6 even though there is no IPV6 support.
+ ** Its TCP/IP stack is in transition. It has newer .h files but no IPV6 yet.
+ **/
+#if defined(__rtems__)
+# undef AF_INET6
+#endif
+
+#ifndef AF_INET6
+# define AF_INET6 -1
+#else
+# define HAVE_AF_INET6 1
+#endif
+CND(AF_INET6, "IPv6 address family")
+
+/*
+
+ ------------------
+ -- Socket modes --
+ ------------------
+
+*/
+
+#ifndef SOCK_STREAM
+# define SOCK_STREAM -1
+#endif
+CND(SOCK_STREAM, "Stream socket")
+
+#ifndef SOCK_DGRAM
+# define SOCK_DGRAM -1
+#endif
+CND(SOCK_DGRAM, "Datagram socket")
+
+/*
+
+ -----------------
+ -- Host errors --
+ -----------------
+
+*/
+
+#ifndef HOST_NOT_FOUND
+# define HOST_NOT_FOUND -1
+#endif
+CND(HOST_NOT_FOUND, "Unknown host")
+
+#ifndef TRY_AGAIN
+# define TRY_AGAIN -1
+#endif
+CND(TRY_AGAIN, "Host name lookup failure")
+
+#ifndef NO_DATA
+# define NO_DATA -1
+#endif
+CND(NO_DATA, "No data record for name")
+
+#ifndef NO_RECOVERY
+# define NO_RECOVERY -1
+#endif
+CND(NO_RECOVERY, "Non recoverable errors")
+
+/*
+
+ --------------------
+ -- Shutdown modes --
+ --------------------
+
+*/
+
+#ifndef SHUT_RD
+# define SHUT_RD -1
+#endif
+CND(SHUT_RD, "No more recv")
+
+#ifndef SHUT_WR
+# define SHUT_WR -1
+#endif
+CND(SHUT_WR, "No more send")
+
+#ifndef SHUT_RDWR
+# define SHUT_RDWR -1
+#endif
+CND(SHUT_RDWR, "No more recv/send")
+
+/*
+
+ ---------------------
+ -- Protocol levels --
+ ---------------------
+
+*/
+
+#ifndef SOL_SOCKET
+# define SOL_SOCKET -1
+#endif
+CND(SOL_SOCKET, "Options for socket level")
+
+#ifndef IPPROTO_IP
+# define IPPROTO_IP -1
+#endif
+CND(IPPROTO_IP, "Dummy protocol for IP")
+
+#ifndef IPPROTO_UDP
+# define IPPROTO_UDP -1
+#endif
+CND(IPPROTO_UDP, "UDP")
+
+#ifndef IPPROTO_TCP
+# define IPPROTO_TCP -1
+#endif
+CND(IPPROTO_TCP, "TCP")
+
+/*
+
+ -------------------
+ -- Request flags --
+ -------------------
+
+*/
+
+#ifndef MSG_OOB
+# define MSG_OOB -1
+#endif
+CND(MSG_OOB, "Process out-of-band data")
+
+#ifndef MSG_PEEK
+# define MSG_PEEK -1
+#endif
+CND(MSG_PEEK, "Peek at incoming data")
+
+#ifndef MSG_EOR
+# define MSG_EOR -1
+#endif
+CND(MSG_EOR, "Send end of record")
+
+#ifndef MSG_WAITALL
+# define MSG_WAITALL -1
+#endif
+CND(MSG_WAITALL, "Wait for full reception")
+
+#ifndef MSG_NOSIGNAL
+# define MSG_NOSIGNAL -1
+#endif
+CND(MSG_NOSIGNAL, "No SIGPIPE on send")
+
+#ifdef __linux__
+# define MSG_Forced_Flags "MSG_NOSIGNAL"
+#else
+# define MSG_Forced_Flags "0"
+#endif
+CNS(MSG_Forced_Flags, "")
+/*
+ -- Flags set on all send(2) calls
+*/
+
+/*
+
+ --------------------
+ -- Socket options --
+ --------------------
+
+*/
+
+#ifndef TCP_NODELAY
+# define TCP_NODELAY -1
+#endif
+CND(TCP_NODELAY, "Do not coalesce packets")
+
+#ifndef SO_REUSEADDR
+# define SO_REUSEADDR -1
+#endif
+CND(SO_REUSEADDR, "Bind reuse local address")
+
+#ifndef SO_REUSEPORT
+# define SO_REUSEPORT -1
+#endif
+CND(SO_REUSEPORT, "Bind reuse port number")
+
+#ifndef SO_KEEPALIVE
+# define SO_KEEPALIVE -1
+#endif
+CND(SO_KEEPALIVE, "Enable keep-alive msgs")
+
+#ifndef SO_LINGER
+# define SO_LINGER -1
+#endif
+CND(SO_LINGER, "Defer close to flush data")
+
+#ifndef SO_BROADCAST
+# define SO_BROADCAST -1
+#endif
+CND(SO_BROADCAST, "Can send broadcast msgs")
+
+#ifndef SO_SNDBUF
+# define SO_SNDBUF -1
+#endif
+CND(SO_SNDBUF, "Set/get send buffer size")
+
+#ifndef SO_RCVBUF
+# define SO_RCVBUF -1
+#endif
+CND(SO_RCVBUF, "Set/get recv buffer size")
+
+#ifndef SO_SNDTIMEO
+# define SO_SNDTIMEO -1
+#endif
+CND(SO_SNDTIMEO, "Emission timeout")
+
+#ifndef SO_RCVTIMEO
+# define SO_RCVTIMEO -1
+#endif
+CND(SO_RCVTIMEO, "Reception timeout")
+
+#ifndef SO_ERROR
+# define SO_ERROR -1
+#endif
+CND(SO_ERROR, "Get/clear error status")
+
+#ifndef IP_MULTICAST_IF
+# define IP_MULTICAST_IF -1
+#endif
+CND(IP_MULTICAST_IF, "Set/get mcast interface")
+
+#ifndef IP_MULTICAST_TTL
+# define IP_MULTICAST_TTL -1
+#endif
+CND(IP_MULTICAST_TTL, "Set/get multicast TTL")
+
+#ifndef IP_MULTICAST_LOOP
+# define IP_MULTICAST_LOOP -1
+#endif
+CND(IP_MULTICAST_LOOP, "Set/get mcast loopback")
+
+#ifndef IP_ADD_MEMBERSHIP
+# define IP_ADD_MEMBERSHIP -1
+#endif
+CND(IP_ADD_MEMBERSHIP, "Join a multicast group")
+
+#ifndef IP_DROP_MEMBERSHIP
+# define IP_DROP_MEMBERSHIP -1
+#endif
+CND(IP_DROP_MEMBERSHIP, "Leave a multicast group")
+
+#ifndef IP_PKTINFO
+# define IP_PKTINFO -1
+#endif
+CND(IP_PKTINFO, "Get datagram info")
+
+/*
+
+ ----------------------
+ -- Type definitions --
+ ----------------------
+
+*/
+
+{
+ struct timeval tv;
+/*
+ -- Sizes (in bytes) of the components of struct timeval
+*/
+#define SIZEOF_tv_sec (sizeof tv.tv_sec)
+CND(SIZEOF_tv_sec, "tv_sec")
+#define SIZEOF_tv_usec (sizeof tv.tv_usec)
+CND(SIZEOF_tv_usec, "tv_usec")
+}
+/*
+
+ -- Sizes of protocol specific address types (for sockaddr.sa_len)
+*/
+
+#define SIZEOF_sockaddr_in (sizeof (struct sockaddr_in))
+CND(SIZEOF_sockaddr_in, "struct sockaddr_in")
+#ifdef HAVE_AF_INET6
+# define SIZEOF_sockaddr_in6 (sizeof (struct sockaddr_in6))
+#else
+# define SIZEOF_sockaddr_in6 0
+#endif
+CND(SIZEOF_sockaddr_in6, "struct sockaddr_in6")
+
+/*
+
+ -- Size of file descriptor sets
+*/
+#define SIZEOF_fd_set (sizeof (fd_set))
+CND(SIZEOF_fd_set, "fd_set");
+/*
+
+ -- Fields of struct hostent
+*/
+
+#ifdef __MINGW32__
+# define h_addrtype_t "short"
+# define h_length_t "short"
+#else
+# define h_addrtype_t "int"
+# define h_length_t "int"
+#endif
+
+TXT(" subtype H_Addrtype_T is Interfaces.C." h_addrtype_t ";")
+TXT(" subtype H_Length_T is Interfaces.C." h_length_t ";")
+
+/*
+
+ ----------------------------------------
+ -- Properties of supported interfaces --
+ ----------------------------------------
+
+*/
+
+CND(Need_Netdb_Buffer, "Need buffer for Netdb ops")
+CND(Has_Sockaddr_Len, "Sockaddr has sa_len field")
+
+/**
+ ** Do not change the format of the line below without also updating the
+ ** MaRTE Makefile.
+ **/
+TXT(" Thread_Blocking_IO : constant Boolean := True;")
+/*
+ -- Set False for contexts where socket i/o are process blocking
+*/
+
+#endif /* HAVE_SOCKETS */
+
+/**
+ ** System-specific constants follow
+ **/
+
+#ifdef __vxworks
+
+/*
+
+ --------------------------------
+ -- VxWorks-specific constants --
+ --------------------------------
+
+ -- These constants may be used only within the VxWorks version of
+ -- GNAT.Sockets.Thin.
+*/
+
+CND(OK, "VxWorks generic success")
+CND(ERROR, "VxWorks generic error")
+
+#endif
+
+#ifdef __MINGW32__
+/*
+
+ ------------------------------
+ -- MinGW-specific constants --
+ ------------------------------
+
+ -- These constants may be used only within the MinGW version of
+ -- GNAT.Sockets.Thin.
+*/
+
+CND(WSASYSNOTREADY, "System not ready")
+CND(WSAVERNOTSUPPORTED, "Version not supported")
+CND(WSANOTINITIALISED, "Winsock not initialized")
+CND(WSAEDISCON, "Disconnected")
+
+#endif
+
+#ifdef NATIVE
+ putchar ('\n');
+#endif
+
+/*
+
+end System.OS_Constants;
+*/
+}
diff --git a/gcc/ada/s-osinte-freebsd.ads b/gcc/ada/s-osinte-freebsd.ads
index 51f498397f9..c1ed40b7720 100644
--- a/gcc/ada/s-osinte-freebsd.ads
+++ b/gcc/ada/s-osinte-freebsd.ads
@@ -67,11 +67,11 @@ package System.OS_Interface is
function Errno return int;
pragma Inline (Errno);
- EAGAIN : constant := 35;
- EINTR : constant := 4;
- EINVAL : constant := 22;
- ENOMEM : constant := 12;
- ETIMEDOUT : constant := 60;
+ EAGAIN : constant := 35;
+ EINTR : constant := 4;
+ EINVAL : constant := 22;
+ ENOMEM : constant := 12;
+ ETIMEDOUT : constant := 60;
-------------
-- Signals --
diff --git a/gcc/ada/s-osinte-hpux.ads b/gcc/ada/s-osinte-hpux.ads
index 0fc5ef1db54..29605b8e1d0 100644
--- a/gcc/ada/s-osinte-hpux.ads
+++ b/gcc/ada/s-osinte-hpux.ads
@@ -86,7 +86,7 @@ package System.OS_Interface is
SIGILL : constant := 4; -- illegal instruction (not reset)
SIGTRAP : constant := 5; -- trace trap (not reset)
SIGIOT : constant := 6; -- IOT instruction
- SIGABRT : constant := 6; -- used by abort, replace SIGIOT in the future
+ SIGABRT : constant := 6; -- used by abort, replace SIGIOT in the future
SIGEMT : constant := 7; -- EMT instruction
SIGFPE : constant := 8; -- floating point exception
SIGKILL : constant := 9; -- kill (cannot be caught or ignored)
@@ -122,6 +122,7 @@ package System.OS_Interface is
SIGADAABORT : constant := SIGABRT;
-- Note: on other targets, we usually use SIGABRT, but on HPUX, it
-- appears that SIGABRT can't be used in sigwait(), so we use SIGTERM.
+ -- Do we use SIGTERM or SIGABRT???
type Signal_Set is array (Natural range <>) of Signal;
diff --git a/gcc/ada/s-osinte-irix.ads b/gcc/ada/s-osinte-irix.ads
index 01b01b54222..5432656208f 100644
--- a/gcc/ada/s-osinte-irix.ads
+++ b/gcc/ada/s-osinte-irix.ads
@@ -87,8 +87,7 @@ package System.OS_Interface is
SIGILL : constant := 4; -- illegal instruction (not reset)
SIGTRAP : constant := 5; -- trace trap (not reset)
SIGIOT : constant := 6; -- IOT instruction
- SIGABRT : constant := 6; -- used by abort, replace SIGIOT in the
- -- future
+ SIGABRT : constant := 6; -- used by abort, replace SIGIOT in the future
SIGEMT : constant := 7; -- EMT instruction
SIGFPE : constant := 8; -- floating point exception
SIGKILL : constant := 9; -- kill (cannot be caught or ignored)
diff --git a/gcc/ada/s-parame-vxworks.adb b/gcc/ada/s-parame-vxworks.adb
index 240a9d8f716..21838ddcc41 100644
--- a/gcc/ada/s-parame-vxworks.adb
+++ b/gcc/ada/s-parame-vxworks.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1995-2007, Free Software Foundation, Inc. --
+-- Copyright (C) 1995-2008, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -31,7 +31,7 @@
-- --
------------------------------------------------------------------------------
--- Version used on all VxWorks and Nucleus targets
+-- Version used on all VxWorks, Nucleus, and RTX RTSS targets
package body System.Parameters is
diff --git a/gcc/ada/s-regexp.ads b/gcc/ada/s-regexp.ads
index d114f0d0ae6..a1f9bf732cf 100755
--- a/gcc/ada/s-regexp.ads
+++ b/gcc/ada/s-regexp.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1998-2007, AdaCore --
+-- Copyright (C) 1998-2008, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -109,7 +109,7 @@ package System.Regexp is
Glob : Boolean := False;
Case_Sensitive : Boolean := True) return Regexp;
-- Compiles a regular expression S. If the syntax of the given
- -- expression is invalid (does not match above grammar, Error_In_Regexp
+ -- expression is invalid (does not match above grammar), Error_In_Regexp
-- is raised. If Glob is True, the pattern is considered as a 'globbing
-- pattern', that is a pattern as given by the second grammar above.
-- As a special case, if Pattern is the empty string it will always
diff --git a/gcc/ada/s-rident.ads b/gcc/ada/s-rident.ads
index bbe422377de..9dbaa73ded4 100644
--- a/gcc/ada/s-rident.ads
+++ b/gcc/ada/s-rident.ads
@@ -50,9 +50,9 @@ package System.Rident is
-- The following enumeration type defines the set of restriction
-- identifiers that are implemented in GNAT.
- -- To add a new restriction identifier, add an entry with the name
- -- to be used in the pragma, and add appropriate calls to the
- -- Restrict.Check_Restriction routine.
+ -- To add a new restriction identifier, add an entry with the name to be
+ -- used in the pragma, and add calls to the Restrict.Check_Restriction
+ -- routine as appropriate.
type Restriction_Id is
@@ -102,6 +102,7 @@ package System.Rident is
No_Select_Statements, -- GNAT (Ravenscar)
No_Specific_Termination_Handlers, -- (RM D.7(10.7/2))
No_Standard_Storage_Pools, -- GNAT
+ No_Stream_Optimizations, -- GNAT
No_Streams, -- GNAT
No_Task_Allocators, -- (RM D.7(7))
No_Task_Attributes_Package, -- GNAT
@@ -198,7 +199,7 @@ package System.Rident is
subtype All_Parameter_Restrictions is
Restriction_Id range
Max_Protected_Entries .. Max_Storage_At_Blocking;
- -- All restrictions that are take a parameter
+ -- All restrictions that take a parameter
subtype Checked_Parameter_Restrictions is
All_Parameter_Restrictions range
@@ -224,8 +225,8 @@ package System.Rident is
subtype Checked_Val_Parameter_Restrictions is
Checked_Parameter_Restrictions range
Max_Protected_Entries .. Max_Tasks;
- -- Restrictions with parameter where the count is known at least in
- -- some cases by the compiler/binder.
+ -- Restrictions with parameter where the count is known at least in some
+ -- cases by the compiler/binder.
subtype Checked_Zero_Parameter_Restrictions is
Checked_Parameter_Restrictions range
@@ -306,24 +307,29 @@ package System.Rident is
-- Profile Definitions and Data --
----------------------------------
- type Profile_Name is (Ravenscar, Restricted);
- -- Names of recognized profiles
+ type Profile_Name is (No_Profile, Ravenscar, Restricted);
+ -- Names of recognized profiles. No_Profile is used to indicate that a
+ -- restriction came from pragma Restrictions[_Warning], as opposed to
+ -- pragma Profile[_Warning].
+
+ subtype Profile_Name_Actual is Profile_Name range Ravenscar .. Restricted;
+ -- Actual used profile names
type Profile_Data is record
Set : Restriction_Flags;
- -- Set to True if given restriction must be set for the profile,
- -- and False if it need not be set (False does not mean that it
- -- must not be set, just that it need not be set). If the flag
- -- is True for a parameter restriction, then the Value array
- -- gives the maximum value permitted by the profile.
+ -- Set to True if given restriction must be set for the profile, and
+ -- False if it need not be set (False does not mean that it must not be
+ -- set, just that it need not be set). If the flag is True for a
+ -- parameter restriction, then the Value array gives the maximum value
+ -- permitted by the profile.
Value : Restriction_Values;
- -- An entry in this array is meaningful only if the corresponding
- -- flag in Set is True. In that case, the value in this array is
- -- the maximum value of the parameter permitted by the profile.
+ -- An entry in this array is meaningful only if the corresponding flag
+ -- in Set is True. In that case, the value in this array is the maximum
+ -- value of the parameter permitted by the profile.
end record;
- Profile_Info : array (Profile_Name) of Profile_Data :=
+ Profile_Info : array (Profile_Name_Actual) of Profile_Data :=
-- Restricted Profile
diff --git a/gcc/ada/s-stausa.adb b/gcc/ada/s-stausa.adb
index 700c685ea27..ff5f86e1668 100644
--- a/gcc/ada/s-stausa.adb
+++ b/gcc/ada/s-stausa.adb
@@ -258,20 +258,29 @@ package body System.Stack_Usage is
-- big, the more an "instrumentation threshold at writing" error is
-- likely to happen.
- Current_Stack_Level : aliased Integer;
+ Stack_Used_When_Filling : Integer;
+ Current_Stack_Level : aliased Integer;
begin
-- Readjust the pattern size. When we arrive in this function, there is
-- already a given amount of stack used, that we won't analyze.
- Analyzer.Stack_Used_When_Filling :=
+ Stack_Used_When_Filling :=
Stack_Size
(Analyzer.Bottom_Of_Stack,
To_Stack_Address (Current_Stack_Level'Address))
+ Natural (Current_Stack_Level'Size);
- Analyzer.Pattern_Size :=
- Analyzer.Pattern_Size - Analyzer.Stack_Used_When_Filling;
+ if Stack_Used_When_Filling > Analyzer.Pattern_Size then
+ -- In this case, the known size of the stack is too small, we've
+ -- already taken more than expected, so there's no possible
+ -- computation
+
+ Analyzer.Pattern_Size := 0;
+ else
+ Analyzer.Pattern_Size :=
+ Analyzer.Pattern_Size - Stack_Used_When_Filling;
+ end if;
declare
Stack : aliased Stack_Slots
@@ -282,17 +291,23 @@ package body System.Stack_Usage is
Analyzer.Stack_Overlay_Address := Stack'Address;
- Analyzer.Bottom_Pattern_Mark :=
- To_Stack_Address (Stack (Bottom_Slot_Index_In (Stack))'Address);
- Analyzer.Top_Pattern_Mark :=
- To_Stack_Address (Stack (Top_Slot_Index_In (Stack))'Address);
+ if Analyzer.Pattern_Size /= 0 then
+ Analyzer.Bottom_Pattern_Mark :=
+ To_Stack_Address (Stack (Bottom_Slot_Index_In (Stack))'Address);
+ Analyzer.Top_Pattern_Mark :=
+ To_Stack_Address (Stack (Top_Slot_Index_In (Stack))'Address);
+ else
+ Analyzer.Bottom_Pattern_Mark := To_Stack_Address (Stack'Address);
+ Analyzer.Top_Pattern_Mark := To_Stack_Address (Stack'Address);
+ end if;
-- If Arr has been packed, the following assertion must be true (we
-- add the size of the element whose address is:
-- Min (Analyzer.Inner_Pattern_Mark, Analyzer.Outer_Pattern_Mark)):
pragma Assert
- (Analyzer.Pattern_Size =
+ (Analyzer.Pattern_Size = 0 or else
+ Analyzer.Pattern_Size =
Stack_Size
(Analyzer.Top_Pattern_Mark, Analyzer.Bottom_Pattern_Mark));
end;
@@ -367,6 +382,10 @@ package body System.Stack_Usage is
begin
Analyzer.Topmost_Touched_Mark := Analyzer.Bottom_Pattern_Mark;
+ if Analyzer.Pattern_Size = 0 then
+ return;
+ end if;
+
-- Look backward from the topmost possible end of the marked stack to
-- the bottom of it. The first index not equals to the patterns marks
-- the beginning of the used stack.
@@ -539,20 +558,31 @@ package body System.Stack_Usage is
-------------------
procedure Report_Result (Analyzer : Stack_Analyzer) is
- Measure : constant Natural :=
- Stack_Size
- (Analyzer.Topmost_Touched_Mark,
- Analyzer.Bottom_Of_Stack)
- + Analyzer.Stack_Used_When_Filling;
-
- Result : constant Task_Result :=
+ Result : Task_Result :=
(Task_Name => Analyzer.Task_Name,
Max_Size => Analyzer.Stack_Size,
- Min_Measure => Measure,
- Max_Measure => Measure + Analyzer.Stack_Size
- - Analyzer.Pattern_Size);
+ Min_Measure => 0,
+ Max_Measure => 0);
+
+ Overflow_Guard : constant Integer :=
+ Analyzer.Stack_Size
+ - Stack_Size (Analyzer.Top_Pattern_Mark, Analyzer.Bottom_Of_Stack);
begin
+ if Analyzer.Pattern_Size = 0 then
+ -- If we have that result, it means that we didn't do any computation
+ -- at all. In other words, we used at least everything (and possibly
+ -- more).
+
+ Result.Min_Measure := Analyzer.Stack_Size - Overflow_Guard;
+ Result.Max_Measure := Analyzer.Stack_Size;
+ else
+ Result.Min_Measure := Stack_Size
+ (Analyzer.Topmost_Touched_Mark,
+ Analyzer.Bottom_Of_Stack);
+ Result.Max_Measure := Result.Min_Measure + Overflow_Guard;
+ end if;
+
if Analyzer.Result_Id in Result_Array'Range then
-- If the result can be stored, then store it in Result_Array
diff --git a/gcc/ada/s-stausa.ads b/gcc/ada/s-stausa.ads
index 8a6e2b67cb5..2aa9dd70d2d 100644
--- a/gcc/ada/s-stausa.ads
+++ b/gcc/ada/s-stausa.ads
@@ -304,10 +304,6 @@ private
Result_Id : Positive;
-- Id of the result. If less than value given to gnatbind -u corresponds
-- to the location in the result array of result for the current task.
-
- Stack_Used_When_Filling : Natural := 0;
- -- Amount of stack that was already used when actually filling the
- -- memory, and therefore not analyzed.
end record;
Environment_Task_Analyzer : Stack_Analyzer;
diff --git a/gcc/ada/s-strxdr.adb b/gcc/ada/s-strxdr.adb
index 7732daadfb1..c123feac1f4 100644
--- a/gcc/ada/s-strxdr.adb
+++ b/gcc/ada/s-strxdr.adb
@@ -47,11 +47,11 @@ package body System.Stream_Attributes is
use UST;
Data_Error : exception renames Ada.IO_Exceptions.End_Error;
- -- Exception raised if insufficient data read (End_Error is
- -- mandated by AI95-00132).
+ -- Exception raised if insufficient data read (End_Error is mandated by
+ -- AI95-00132).
SU : constant := System.Storage_Unit;
- -- XXXXX pragma Assert (SU = 8);
+ -- The code in this body assumes that SU = 8
BB : constant := 2 ** SU; -- Byte base
BL : constant := 2 ** SU - 1; -- Byte last
@@ -127,7 +127,7 @@ package body System.Stream_Attributes is
-- in the range [-2147483648,2147483647]. The integer is represented
-- in two's complement notation. The most and least significant bytes
-- are 0 and 3, respectively. Integers are declared as follows:
- --
+
-- (MSB) (LSB)
-- +-------+-------+-------+-------+
-- |byte 0 |byte 1 |byte 2 |byte 3 |
@@ -175,7 +175,7 @@ package body System.Stream_Attributes is
-- integer in the range [0,4294967295]. It is represented by an unsigned
-- binary number whose most and least significant bytes are 0 and 3,
-- respectively. An unsigned integer is declared as follows:
- --
+
-- (MSB) (LSB)
-- +-------+-------+-------+-------+
-- |byte 0 |byte 1 |byte 2 |byte 3 |
@@ -222,10 +222,10 @@ package body System.Stream_Attributes is
-- or 4 bytes). The encoding used is the IEEE standard for normalized
-- single-precision floating-point numbers.
- -- The standard defines the encoding for the double-precision
- -- floating-point data type "double" (64 bits or 8 bytes). The
- -- encoding used is the IEEE standard for normalized double-precision
- -- floating-point numbers.
+ -- The standard defines the encoding used for the double-precision
+ -- floating-point data type "double" (64 bits or 8 bytes). The encoding
+ -- used is the IEEE standard for normalized double-precision floating-point
+ -- numbers.
SF_L : constant := 4; -- Single precision
F_L : constant := 4; -- Single precision
diff --git a/gcc/ada/s-ststop.adb b/gcc/ada/s-ststop.adb
index 8d181087e97..ca5c880fb31 100644
--- a/gcc/ada/s-ststop.adb
+++ b/gcc/ada/s-ststop.adb
@@ -43,6 +43,11 @@ with System.Stream_Attributes; use System;
package body System.Strings.Stream_Ops is
+ -- The following type describes the low-level IO mechanism used in package
+ -- Stream_Ops_Internal.
+
+ type IO_Kind is (Byte_IO, Block_IO);
+
-- The following package provides an IO framework for strings. Depending
-- on the version of System.Stream_Attributes as well as the size of
-- formal parameter Character_Type, the package will either utilize block
@@ -53,13 +58,24 @@ package body System.Strings.Stream_Ops is
type String_Type is array (Positive range <>) of Character_Type;
package Stream_Ops_Internal is
+ function Input
+ (Strm : access Root_Stream_Type'Class;
+ IO : IO_Kind) return String_Type;
+
+ procedure Output
+ (Strm : access Root_Stream_Type'Class;
+ Item : String_Type;
+ IO : IO_Kind);
+
procedure Read
(Strm : access Root_Stream_Type'Class;
- Item : out String_Type);
+ Item : out String_Type;
+ IO : IO_Kind);
procedure Write
(Strm : access Root_Stream_Type'Class;
- Item : String_Type);
+ Item : String_Type;
+ IO : IO_Kind);
end Stream_Ops_Internal;
-------------------------
@@ -92,18 +108,6 @@ package body System.Strings.Stream_Ops is
subtype String_Block is String_Type (1 .. C_In_Default_Block);
- -- Block IO is used in the following two scenarios:
-
- -- 1) When the size of the character type equals that of the stream
- -- element type, regardless of endianness.
-
- -- 2) When using the standard stream IO routines for elementary
- -- types which guarantees the same endianness over partitions.
-
- Use_Block_IO : constant Boolean :=
- C_Size = SE_Size
- or else Stream_Attributes.Block_IO_OK;
-
-- Conversions to and from Default_Block
function To_Default_Block is
@@ -112,13 +116,74 @@ package body System.Strings.Stream_Ops is
function To_String_Block is
new Ada.Unchecked_Conversion (Default_Block, String_Block);
+ -----------
+ -- Input --
+ -----------
+
+ function Input
+ (Strm : access Root_Stream_Type'Class;
+ IO : IO_Kind) return String_Type
+ is
+ begin
+ if Strm = null then
+ raise Constraint_Error;
+ end if;
+
+ declare
+ Low : Positive;
+ High : Positive;
+
+ begin
+ -- Read the bounds of the string
+
+ Positive'Read (Strm, Low);
+ Positive'Read (Strm, High);
+
+ declare
+ Item : String_Type (Low .. High);
+
+ begin
+ -- Read the character content of the string
+
+ Read (Strm, Item, IO);
+
+ return Item;
+ end;
+ end;
+ end Input;
+
+ ------------
+ -- Output --
+ ------------
+
+ procedure Output
+ (Strm : access Root_Stream_Type'Class;
+ Item : String_Type;
+ IO : IO_Kind)
+ is
+ begin
+ if Strm = null then
+ raise Constraint_Error;
+ end if;
+
+ -- Write the bounds of the string
+
+ Positive'Write (Strm, Item'First);
+ Positive'Write (Strm, Item'Last);
+
+ -- Write the character content of the string
+
+ Write (Strm, Item, IO);
+ end Output;
+
----------
-- Read --
----------
procedure Read
(Strm : access Root_Stream_Type'Class;
- Item : out String_Type)
+ Item : out String_Type;
+ IO : IO_Kind)
is
begin
if Strm = null then
@@ -131,7 +196,11 @@ package body System.Strings.Stream_Ops is
return;
end if;
- if Use_Block_IO then
+ -- Block IO
+
+ if IO = Block_IO
+ and then Stream_Attributes.Block_IO_OK
+ then
declare
-- Determine the size in BITS of the block necessary to contain
-- the whole string.
@@ -215,7 +284,7 @@ package body System.Strings.Stream_Ops is
end if;
end;
- -- Character-by-character IO
+ -- Byte IO
else
declare
@@ -236,7 +305,8 @@ package body System.Strings.Stream_Ops is
procedure Write
(Strm : access Root_Stream_Type'Class;
- Item : String_Type)
+ Item : String_Type;
+ IO : IO_Kind)
is
begin
if Strm = null then
@@ -249,7 +319,11 @@ package body System.Strings.Stream_Ops is
return;
end if;
- if Use_Block_IO then
+ -- Block IO
+
+ if IO = Block_IO
+ and then Stream_Attributes.Block_IO_OK
+ then
declare
-- Determine the size in BITS of the block necessary to contain
-- the whole string.
@@ -303,7 +377,7 @@ package body System.Strings.Stream_Ops is
end if;
end;
- -- Character-by-character IO
+ -- Byte IO
else
for Index in Item'First .. Item'Last loop
@@ -313,7 +387,7 @@ package body System.Strings.Stream_Ops is
end Write;
end Stream_Ops_Internal;
- -- Specific instantiations for different string types
+ -- Specific instantiations for all Ada string types
package String_Ops is
new Stream_Ops_Internal
@@ -338,32 +412,19 @@ package body System.Strings.Stream_Ops is
(Strm : access Ada.Streams.Root_Stream_Type'Class) return String
is
begin
- if Strm = null then
- raise Constraint_Error;
- end if;
-
- declare
- Low : Positive;
- High : Positive;
-
- begin
- -- Read the bounds of the string
-
- Positive'Read (Strm, Low);
- Positive'Read (Strm, High);
-
- declare
- Item : String (Low .. High);
-
- begin
- -- Read the character content of the string
+ return String_Ops.Input (Strm, Byte_IO);
+ end String_Input;
- String_Read (Strm, Item);
+ -------------------------
+ -- String_Input_Blk_IO --
+ -------------------------
- return Item;
- end;
- end;
- end String_Input;
+ function String_Input_Blk_IO
+ (Strm : access Ada.Streams.Root_Stream_Type'Class) return String
+ is
+ begin
+ return String_Ops.Input (Strm, Block_IO);
+ end String_Input_Blk_IO;
-------------------
-- String_Output --
@@ -374,19 +435,20 @@ package body System.Strings.Stream_Ops is
Item : String)
is
begin
- if Strm = null then
- raise Constraint_Error;
- end if;
-
- -- Write the bounds of the string
-
- Positive'Write (Strm, Item'First);
- Positive'Write (Strm, Item'Last);
+ String_Ops.Output (Strm, Item, Byte_IO);
+ end String_Output;
- -- Write the character content of the string
+ --------------------------
+ -- String_Output_Blk_IO --
+ --------------------------
- String_Write (Strm, Item);
- end String_Output;
+ procedure String_Output_Blk_IO
+ (Strm : access Ada.Streams.Root_Stream_Type'Class;
+ Item : String)
+ is
+ begin
+ String_Ops.Output (Strm, Item, Block_IO);
+ end String_Output_Blk_IO;
-----------------
-- String_Read --
@@ -397,9 +459,21 @@ package body System.Strings.Stream_Ops is
Item : out String)
is
begin
- String_Ops.Read (Strm, Item);
+ String_Ops.Read (Strm, Item, Byte_IO);
end String_Read;
+ ------------------------
+ -- String_Read_Blk_IO --
+ ------------------------
+
+ procedure String_Read_Blk_IO
+ (Strm : access Ada.Streams.Root_Stream_Type'Class;
+ Item : out String)
+ is
+ begin
+ String_Ops.Read (Strm, Item, Block_IO);
+ end String_Read_Blk_IO;
+
------------------
-- String_Write --
------------------
@@ -409,44 +483,42 @@ package body System.Strings.Stream_Ops is
Item : String)
is
begin
- String_Ops.Write (Strm, Item);
+ String_Ops.Write (Strm, Item, Byte_IO);
end String_Write;
+ -------------------------
+ -- String_Write_Blk_IO --
+ -------------------------
+
+ procedure String_Write_Blk_IO
+ (Strm : access Ada.Streams.Root_Stream_Type'Class;
+ Item : String)
+ is
+ begin
+ String_Ops.Write (Strm, Item, Block_IO);
+ end String_Write_Blk_IO;
+
-----------------------
-- Wide_String_Input --
-----------------------
function Wide_String_Input
- (Strm : access Ada.Streams.Root_Stream_Type'Class)
- return Wide_String
+ (Strm : access Ada.Streams.Root_Stream_Type'Class) return Wide_String
is
begin
- if Strm = null then
- raise Constraint_Error;
- end if;
-
- declare
- Low : Positive;
- High : Positive;
-
- begin
- -- Read the bounds of the string
-
- Positive'Read (Strm, Low);
- Positive'Read (Strm, High);
-
- declare
- Item : Wide_String (Low .. High);
-
- begin
- -- Read the character content of the string
+ return Wide_String_Ops.Input (Strm, Byte_IO);
+ end Wide_String_Input;
- Wide_String_Read (Strm, Item);
+ ------------------------------
+ -- Wide_String_Input_Blk_IO --
+ ------------------------------
- return Item;
- end;
- end;
- end Wide_String_Input;
+ function Wide_String_Input_Blk_IO
+ (Strm : access Ada.Streams.Root_Stream_Type'Class) return Wide_String
+ is
+ begin
+ return Wide_String_Ops.Input (Strm, Block_IO);
+ end Wide_String_Input_Blk_IO;
------------------------
-- Wide_String_Output --
@@ -457,19 +529,20 @@ package body System.Strings.Stream_Ops is
Item : Wide_String)
is
begin
- if Strm = null then
- raise Constraint_Error;
- end if;
-
- -- Write the bounds of the string
-
- Positive'Write (Strm, Item'First);
- Positive'Write (Strm, Item'Last);
+ Wide_String_Ops.Output (Strm, Item, Byte_IO);
+ end Wide_String_Output;
- -- Write the character content of the string
+ -------------------------------
+ -- Wide_String_Output_Blk_IO --
+ -------------------------------
- Wide_String_Write (Strm, Item);
- end Wide_String_Output;
+ procedure Wide_String_Output_Blk_IO
+ (Strm : access Ada.Streams.Root_Stream_Type'Class;
+ Item : Wide_String)
+ is
+ begin
+ Wide_String_Ops.Output (Strm, Item, Block_IO);
+ end Wide_String_Output_Blk_IO;
----------------------
-- Wide_String_Read --
@@ -480,9 +553,21 @@ package body System.Strings.Stream_Ops is
Item : out Wide_String)
is
begin
- Wide_String_Ops.Read (Strm, Item);
+ Wide_String_Ops.Read (Strm, Item, Byte_IO);
end Wide_String_Read;
+ -----------------------------
+ -- Wide_String_Read_Blk_IO --
+ -----------------------------
+
+ procedure Wide_String_Read_Blk_IO
+ (Strm : access Ada.Streams.Root_Stream_Type'Class;
+ Item : out Wide_String)
+ is
+ begin
+ Wide_String_Ops.Read (Strm, Item, Block_IO);
+ end Wide_String_Read_Blk_IO;
+
-----------------------
-- Wide_String_Write --
-----------------------
@@ -492,44 +577,42 @@ package body System.Strings.Stream_Ops is
Item : Wide_String)
is
begin
- Wide_String_Ops.Write (Strm, Item);
+ Wide_String_Ops.Write (Strm, Item, Byte_IO);
end Wide_String_Write;
+ ------------------------------
+ -- Wide_String_Write_Blk_IO --
+ ------------------------------
+
+ procedure Wide_String_Write_Blk_IO
+ (Strm : access Ada.Streams.Root_Stream_Type'Class;
+ Item : Wide_String)
+ is
+ begin
+ Wide_String_Ops.Write (Strm, Item, Block_IO);
+ end Wide_String_Write_Blk_IO;
+
----------------------------
-- Wide_Wide_String_Input --
----------------------------
function Wide_Wide_String_Input
- (Strm : access Ada.Streams.Root_Stream_Type'Class)
- return Wide_Wide_String
+ (Strm : access Ada.Streams.Root_Stream_Type'Class) return Wide_Wide_String
is
begin
- if Strm = null then
- raise Constraint_Error;
- end if;
-
- declare
- Low : Positive;
- High : Positive;
-
- begin
- -- Read the bounds of the string
-
- Positive'Read (Strm, Low);
- Positive'Read (Strm, High);
-
- declare
- Item : Wide_Wide_String (Low .. High);
-
- begin
- -- Read the character content of the string
+ return Wide_Wide_String_Ops.Input (Strm, Byte_IO);
+ end Wide_Wide_String_Input;
- Wide_Wide_String_Read (Strm, Item);
+ -----------------------------------
+ -- Wide_Wide_String_Input_Blk_IO --
+ -----------------------------------
- return Item;
- end;
- end;
- end Wide_Wide_String_Input;
+ function Wide_Wide_String_Input_Blk_IO
+ (Strm : access Ada.Streams.Root_Stream_Type'Class) return Wide_Wide_String
+ is
+ begin
+ return Wide_Wide_String_Ops.Input (Strm, Block_IO);
+ end Wide_Wide_String_Input_Blk_IO;
-----------------------------
-- Wide_Wide_String_Output --
@@ -540,19 +623,20 @@ package body System.Strings.Stream_Ops is
Item : Wide_Wide_String)
is
begin
- if Strm = null then
- raise Constraint_Error;
- end if;
-
- -- Write the bounds of the string
-
- Positive'Write (Strm, Item'First);
- Positive'Write (Strm, Item'Last);
+ Wide_Wide_String_Ops.Output (Strm, Item, Byte_IO);
+ end Wide_Wide_String_Output;
- -- Write the character content of the string
+ ------------------------------------
+ -- Wide_Wide_String_Output_Blk_IO --
+ ------------------------------------
- Wide_Wide_String_Write (Strm, Item);
- end Wide_Wide_String_Output;
+ procedure Wide_Wide_String_Output_Blk_IO
+ (Strm : access Ada.Streams.Root_Stream_Type'Class;
+ Item : Wide_Wide_String)
+ is
+ begin
+ Wide_Wide_String_Ops.Output (Strm, Item, Block_IO);
+ end Wide_Wide_String_Output_Blk_IO;
---------------------------
-- Wide_Wide_String_Read --
@@ -563,9 +647,21 @@ package body System.Strings.Stream_Ops is
Item : out Wide_Wide_String)
is
begin
- Wide_Wide_String_Ops.Read (Strm, Item);
+ Wide_Wide_String_Ops.Read (Strm, Item, Byte_IO);
end Wide_Wide_String_Read;
+ ----------------------------------
+ -- Wide_Wide_String_Read_Blk_IO --
+ ----------------------------------
+
+ procedure Wide_Wide_String_Read_Blk_IO
+ (Strm : access Ada.Streams.Root_Stream_Type'Class;
+ Item : out Wide_Wide_String)
+ is
+ begin
+ Wide_Wide_String_Ops.Read (Strm, Item, Block_IO);
+ end Wide_Wide_String_Read_Blk_IO;
+
----------------------------
-- Wide_Wide_String_Write --
----------------------------
@@ -575,7 +671,19 @@ package body System.Strings.Stream_Ops is
Item : Wide_Wide_String)
is
begin
- Wide_Wide_String_Ops.Write (Strm, Item);
+ Wide_Wide_String_Ops.Write (Strm, Item, Byte_IO);
end Wide_Wide_String_Write;
+ -----------------------------------
+ -- Wide_Wide_String_Write_Blk_IO --
+ -----------------------------------
+
+ procedure Wide_Wide_String_Write_Blk_IO
+ (Strm : access Ada.Streams.Root_Stream_Type'Class;
+ Item : Wide_Wide_String)
+ is
+ begin
+ Wide_Wide_String_Ops.Write (Strm, Item, Block_IO);
+ end Wide_Wide_String_Write_Blk_IO;
+
end System.Strings.Stream_Ops;
diff --git a/gcc/ada/s-ststop.ads b/gcc/ada/s-ststop.ads
index f954bccfc7b..432b1335d50 100644
--- a/gcc/ada/s-ststop.ads
+++ b/gcc/ada/s-ststop.ads
@@ -45,6 +45,8 @@
-- will be expanded into:
--
-- String_Output (Some_Stream, Some_String);
+-- or
+-- String_Output_Blk_IO (Some_Stream, Some_String);
pragma Warnings (Off);
pragma Compiler_Unit;
@@ -62,18 +64,34 @@ package System.Strings.Stream_Ops is
(Strm : access Ada.Streams.Root_Stream_Type'Class)
return String;
+ function String_Input_Blk_IO
+ (Strm : access Ada.Streams.Root_Stream_Type'Class)
+ return String;
+
procedure String_Output
(Strm : access Ada.Streams.Root_Stream_Type'Class;
Item : String);
+ procedure String_Output_Blk_IO
+ (Strm : access Ada.Streams.Root_Stream_Type'Class;
+ Item : String);
+
procedure String_Read
(Strm : access Ada.Streams.Root_Stream_Type'Class;
Item : out String);
+ procedure String_Read_Blk_IO
+ (Strm : access Ada.Streams.Root_Stream_Type'Class;
+ Item : out String);
+
procedure String_Write
(Strm : access Ada.Streams.Root_Stream_Type'Class;
Item : String);
+ procedure String_Write_Blk_IO
+ (Strm : access Ada.Streams.Root_Stream_Type'Class;
+ Item : String);
+
-----------------------------------
-- Wide_String stream operations --
-----------------------------------
@@ -82,18 +100,34 @@ package System.Strings.Stream_Ops is
(Strm : access Ada.Streams.Root_Stream_Type'Class)
return Wide_String;
+ function Wide_String_Input_Blk_IO
+ (Strm : access Ada.Streams.Root_Stream_Type'Class)
+ return Wide_String;
+
procedure Wide_String_Output
(Strm : access Ada.Streams.Root_Stream_Type'Class;
Item : Wide_String);
+ procedure Wide_String_Output_Blk_IO
+ (Strm : access Ada.Streams.Root_Stream_Type'Class;
+ Item : Wide_String);
+
procedure Wide_String_Read
(Strm : access Ada.Streams.Root_Stream_Type'Class;
Item : out Wide_String);
+ procedure Wide_String_Read_Blk_IO
+ (Strm : access Ada.Streams.Root_Stream_Type'Class;
+ Item : out Wide_String);
+
procedure Wide_String_Write
(Strm : access Ada.Streams.Root_Stream_Type'Class;
Item : Wide_String);
+ procedure Wide_String_Write_Blk_IO
+ (Strm : access Ada.Streams.Root_Stream_Type'Class;
+ Item : Wide_String);
+
----------------------------------------
-- Wide_Wide_String stream operations --
----------------------------------------
@@ -102,16 +136,32 @@ package System.Strings.Stream_Ops is
(Strm : access Ada.Streams.Root_Stream_Type'Class)
return Wide_Wide_String;
+ function Wide_Wide_String_Input_Blk_IO
+ (Strm : access Ada.Streams.Root_Stream_Type'Class)
+ return Wide_Wide_String;
+
procedure Wide_Wide_String_Output
(Strm : access Ada.Streams.Root_Stream_Type'Class;
Item : Wide_Wide_String);
+ procedure Wide_Wide_String_Output_Blk_IO
+ (Strm : access Ada.Streams.Root_Stream_Type'Class;
+ Item : Wide_Wide_String);
+
procedure Wide_Wide_String_Read
(Strm : access Ada.Streams.Root_Stream_Type'Class;
Item : out Wide_Wide_String);
+ procedure Wide_Wide_String_Read_Blk_IO
+ (Strm : access Ada.Streams.Root_Stream_Type'Class;
+ Item : out Wide_Wide_String);
+
procedure Wide_Wide_String_Write
(Strm : access Ada.Streams.Root_Stream_Type'Class;
Item : Wide_Wide_String);
+ procedure Wide_Wide_String_Write_Blk_IO
+ (Strm : access Ada.Streams.Root_Stream_Type'Class;
+ Item : Wide_Wide_String);
+
end System.Strings.Stream_Ops;
diff --git a/gcc/ada/s-wchwts.adb b/gcc/ada/s-wchwts.adb
index ed660fefc0f..1dc2fce4a87 100644
--- a/gcc/ada/s-wchwts.adb
+++ b/gcc/ada/s-wchwts.adb
@@ -88,16 +88,16 @@ package body System.WCh_WtS is
(S : Wide_String;
EM : WC_Encoding_Method) return String
is
- R : String (1 .. 5 * S'Length); -- worst case length!
+ R : String (S'First .. S'First + 5 * S'Length); -- worst case length!
RP : Natural;
begin
- RP := 0;
+ RP := R'First - 1;
for SP in S'Range loop
Store_UTF_32_Character (Wide_Character'Pos (S (SP)), R, RP, EM);
end loop;
- return R (1 .. RP);
+ return R (R'First .. RP);
end Wide_String_To_String;
--------------------------------
@@ -108,17 +108,17 @@ package body System.WCh_WtS is
(S : Wide_Wide_String;
EM : WC_Encoding_Method) return String
is
- R : String (1 .. 7 * S'Length); -- worst case length!
+ R : String (S'First .. S'First + 7 * S'Length); -- worst case length!
RP : Natural;
begin
- RP := 0;
+ RP := R'First - 1;
for SP in S'Range loop
Store_UTF_32_Character (Wide_Wide_Character'Pos (S (SP)), R, RP, EM);
end loop;
- return R (1 .. RP);
+ return R (R'First .. RP);
end Wide_Wide_String_To_String;
end System.WCh_WtS;
diff --git a/gcc/ada/s-wchwts.ads b/gcc/ada/s-wchwts.ads
index 691a322ea6c..4f8bfcf4014 100644
--- a/gcc/ada/s-wchwts.ads
+++ b/gcc/ada/s-wchwts.ads
@@ -54,7 +54,8 @@ package System.WCh_WtS is
-- that normal (non-wide character) mode holds at the start and end of
-- the result string. EM indicates the wide character encoding method.
-- Note: in the WCEM_Brackets case, we only use the brackets encoding
- -- for characters greater than 16#FF#.
+ -- for characters greater than 16#FF#. The lowest index of the returned
+ -- String is equal to S'First.
function Wide_Wide_String_To_String
(S : Wide_Wide_String;
diff --git a/gcc/ada/scans.ads b/gcc/ada/scans.ads
index 83cc368dee4..e344f74433b 100644
--- a/gcc/ada/scans.ads
+++ b/gcc/ada/scans.ads
@@ -338,8 +338,7 @@ package Scans is
-- Flag array used to test for reserved word
procedure Initialize_Ada_Keywords;
- -- Set up Token_Type values in Names table entries for Ada reserved
- -- words.
+ -- Set up Token_Type values in Names table entries for Ada reserved words
--------------------------
-- Scan State Variables --
diff --git a/gcc/ada/scng.adb b/gcc/ada/scng.adb
index 76f63f9353b..914c101afdc 100644
--- a/gcc/ada/scng.adb
+++ b/gcc/ada/scng.adb
@@ -350,6 +350,7 @@ package body Scng is
procedure Error_Illegal_Wide_Character is
begin
+ Scan_Ptr := Scan_Ptr + 1;
Error_Msg ("illegal wide character", Wptr);
end Error_Illegal_Wide_Character;
@@ -1651,7 +1652,7 @@ package body Scng is
if Err then
Error_Illegal_Wide_Character;
- Code := Character'Pos (' ');
+ Code := Character'Pos (' ');
-- In Ada 95 mode we allow any wide character in a character
-- literal, but in Ada 2005, the set of characters allowed
diff --git a/gcc/ada/sem.adb b/gcc/ada/sem.adb
index 6b93ab449f1..20ac16eb8ad 100644
--- a/gcc/ada/sem.adb
+++ b/gcc/ada/sem.adb
@@ -1341,7 +1341,7 @@ package body Sem is
-- Compile predefined units with GNAT_Mode set to True, to properly
-- process the categorization stuff. However, do not set set GNAT_Mode
-- to True for the renamings units (Text_IO, IO_Exceptions, Direct_IO,
- -- Sequential_IO) as this would prevent pragma System_Extend to be
+ -- Sequential_IO) as this would prevent pragma Extend_System from being
-- taken into account, for example when Text_IO is renaming DEC.Text_IO.
-- Cleaner might be to do the kludge at the point of excluding the
diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb
index 4f50dc01789..d16b7d6b8c4 100644
--- a/gcc/ada/sem_aggr.adb
+++ b/gcc/ada/sem_aggr.adb
@@ -2770,7 +2770,17 @@ package body Sem_Aggr is
Error_Msg_N ("record aggregate cannot be null", N);
return;
- elsif No (First_Entity (Typ)) then
+ -- If the type has no components, then the aggregate should either
+ -- have "null record", or in Ada 2005 it could instead have a single
+ -- component association given by "others => <>". For Ada 95 we flag
+ -- an error at this point, but for Ada 2005 we proceed with checking
+ -- the associations below, which will catch the case where it's not
+ -- an aggregate with "others => <>". Note that the legality of a <>
+ -- aggregate for a null record type was established by AI05-016.
+
+ elsif No (First_Entity (Typ))
+ and then Ada_Version < Ada_05
+ then
Error_Msg_N ("record aggregate must be null", N);
return;
end if;
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index 14f9102d369..6a77fd1160c 100644
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -315,6 +315,9 @@ package body Sem_Attr is
-- corresponding possible defined attribute function (e.g. for the
-- Read attribute, Nam will be TSS_Stream_Read).
+ procedure Check_PolyORB_Attribute;
+ -- Validity checking for PolyORB/DSA attribute
+
procedure Check_Task_Prefix;
-- Verify that prefix of attribute N is a task or task type
@@ -710,6 +713,12 @@ package body Sem_Attr is
then
null;
+ -- OK if reference to the current instance of a protected
+ -- object.
+
+ elsif Is_Protected_Self_Reference (P) then
+ null;
+
-- Otherwise we have an error case
else
@@ -1380,6 +1389,23 @@ package body Sem_Attr is
end if;
end Check_Object_Reference;
+ ----------------------------
+ -- Check_PolyORB_Attribute --
+ ----------------------------
+
+ procedure Check_PolyORB_Attribute is
+ begin
+ Validate_Non_Static_Attribute_Function_Call;
+
+ Check_Type;
+ Check_Not_CPP_Type;
+
+ if Get_PCS_Name /= Name_PolyORB_DSA then
+ Error_Attr
+ ("attribute% requires the 'Poly'O'R'B 'P'C'S", N);
+ end if;
+ end Check_PolyORB_Attribute;
+
------------------------
-- Check_Program_Unit --
------------------------
@@ -1623,6 +1649,11 @@ package body Sem_Attr is
then
Error_Attr_P ("prefix of % attribute must be a type");
+ elsif Is_Protected_Self_Reference (P) then
+ Error_Attr_P
+ ("prefix of % attribute denotes current instance " &
+ "(RM 9.4(21/2))");
+
elsif Ekind (Entity (P)) = E_Incomplete_Type
and then Present (Full_View (Entity (P)))
then
@@ -1898,6 +1929,7 @@ package body Sem_Attr is
and then Aname /= Name_Address
and then Aname /= Name_Code_Address
and then Aname /= Name_Count
+ and then Aname /= Name_Result
and then Aname /= Name_Unchecked_Access
then
Error_Attr ("ambiguous prefix for % attribute", P);
@@ -1988,7 +2020,13 @@ package body Sem_Attr is
-- An Address attribute created by expansion is legal even when it
-- applies to other entity-denoting expressions.
- if Is_Entity_Name (P) then
+ if Is_Protected_Self_Reference (P) then
+ -- An Address attribute on a protected object self reference
+ -- is legal.
+
+ null;
+
+ elsif Is_Entity_Name (P) then
declare
Ent : constant Entity_Id := Entity (P);
@@ -2975,6 +3013,15 @@ package body Sem_Attr is
Set_Etype (N, P_Base_Type);
Resolve (E1, P_Base_Type);
+ --------------
+ -- From_Any --
+ --------------
+
+ when Attribute_From_Any =>
+ Check_E1;
+ Check_PolyORB_Attribute;
+ Set_Etype (N, P_Base_Type);
+
-----------------------
-- Has_Access_Values --
-----------------------
@@ -3737,10 +3784,20 @@ package body Sem_Attr is
------------
when Attribute_Result => Result : declare
- CS : constant Entity_Id := Current_Scope;
- PS : constant Entity_Id := Scope (CS);
+ CS : Entity_Id := Current_Scope;
+ PS : Entity_Id := Scope (CS);
begin
+ -- If the enclosing subprogram is always inlined, the enclosing
+ -- postcondition will not be propagated to the expanded call.
+
+ if Has_Pragma_Inline_Always (PS)
+ and then Warn_On_Redundant_Constructs
+ then
+ Error_Msg_N
+ ("postconditions on inlined functions not enforced?", N);
+ end if;
+
-- If we are in the scope of a function and in Spec_Expression mode,
-- this is likely the prescan of the postcondition pragma, and we
-- just set the proper type. If there is an error it will be caught
@@ -3768,30 +3825,60 @@ package body Sem_Attr is
end if;
-- Body case, where we must be inside a generated _Postcondition
- -- procedure, or the attribute use is definitely misplaced.
+ -- procedure, and the prefix must be on the scope stack, or else
+ -- the attribute use is definitely misplaced. The condition itself
+ -- may have generated transient scopes, and is not necessarily the
+ -- current one.
- elsif Chars (CS) = Name_uPostconditions
- and then Ekind (PS) = E_Function
- then
- -- Check OK prefix
+ else
+ while Present (CS)
+ and then CS /= Standard_Standard
+ loop
+ if Chars (CS) = Name_uPostconditions then
+ exit;
+ else
+ CS := Scope (CS);
+ end if;
+ end loop;
+
+ PS := Scope (CS);
- if Nkind (P) /= N_Identifier
- or else Chars (P) /= Chars (PS)
+ if Chars (CS) = Name_uPostconditions
+ and then Ekind (PS) = E_Function
then
- Error_Msg_NE
- ("incorrect prefix for % attribute, expected &", P, PS);
- Error_Attr;
- end if;
+ -- Check OK prefix
- Rewrite (N,
- Make_Identifier (Sloc (N),
- Chars => Name_uResult));
- Analyze_And_Resolve (N, Etype (PS));
+ if Nkind_In (P, N_Identifier, N_Operator_Symbol)
+ and then Chars (P) = Chars (PS)
+ then
+ null;
- else
- Error_Attr
- ("% attribute can only appear in function Postcondition pragma",
- P);
+ -- Within an instance, the prefix designates the local renaming
+ -- of the original generic.
+
+ elsif Is_Entity_Name (P)
+ and then Ekind (Entity (P)) = E_Function
+ and then Present (Alias (Entity (P)))
+ and then Chars (Alias (Entity (P))) = Chars (PS)
+ then
+ null;
+
+ else
+ Error_Msg_NE
+ ("incorrect prefix for % attribute, expected &", P, PS);
+ Error_Attr;
+ end if;
+
+ Rewrite (N,
+ Make_Identifier (Sloc (N),
+ Chars => Name_uResult));
+ Analyze_And_Resolve (N, Etype (PS));
+
+ else
+ Error_Attr
+ ("% attribute can only appear" &
+ " in function Postcondition pragma", P);
+ end if;
end if;
end Result;
@@ -4213,6 +4300,15 @@ package body Sem_Attr is
Analyze_And_Resolve (E1, Any_Integer);
Set_Etype (N, RTE (RE_Address));
+ ------------
+ -- To_Any --
+ ------------
+
+ when Attribute_To_Any =>
+ Check_E1;
+ Check_PolyORB_Attribute;
+ Set_Etype (N, RTE (RE_Any));
+
----------------
-- Truncation --
----------------
@@ -4232,6 +4328,15 @@ package body Sem_Attr is
Check_Not_Incomplete_Type;
Set_Etype (N, RTE (RE_Type_Class));
+ ------------
+ -- To_Any --
+ ------------
+
+ when Attribute_TypeCode =>
+ Check_E0;
+ Check_PolyORB_Attribute;
+ Set_Etype (N, RTE (RE_TypeCode));
+
-----------------
-- UET_Address --
-----------------
@@ -7228,6 +7333,13 @@ package body Sem_Attr is
end if;
end Width;
+ -- The following attributes denote function that cannot be folded
+
+ when Attribute_From_Any |
+ Attribute_To_Any |
+ Attribute_TypeCode =>
+ null;
+
-- The following attributes can never be folded, and furthermore we
-- should not even have entered the case statement for any of these.
-- Note that in some cases, the values have already been folded as
@@ -7463,6 +7575,19 @@ package body Sem_Attr is
Note_Possible_Modification (P, Sure => False);
end if;
+ -- The following comes from a query by Adam Beneschan, concerning
+ -- improper use of universal_access in equality tests involving
+ -- anonymous access types. Another good reason for 'Ref, but
+ -- for now disable the test, which breaks several filed tests.
+
+ if Ekind (Typ) = E_Anonymous_Access_Type
+ and then Nkind_In (Parent (N), N_Op_Eq, N_Op_Ne)
+ and then False
+ then
+ Error_Msg_N ("need unique type to resolve 'Access", N);
+ Error_Msg_N ("\qualify attribute with some access type", N);
+ end if;
+
if Is_Entity_Name (P) then
if Is_Overloaded (P) then
Get_First_Interp (P, Index, It);
diff --git a/gcc/ada/sem_ch10.adb b/gcc/ada/sem_ch10.adb
index 540b2a6d85d..f81cca8ea12 100644
--- a/gcc/ada/sem_ch10.adb
+++ b/gcc/ada/sem_ch10.adb
@@ -2660,13 +2660,18 @@ package body Sem_Ch10 is
P : Node_Id;
function Build_Unit_Name (Nam : Node_Id) return Node_Id;
- -- Comment required here ???
+ -- Build name to be used in implicit with_clause. In most cases this
+ -- is the source name, but if renamings are present we must make the
+ -- original unit visible, not the one it renames. The entity in the
+ -- with clause is the renamed unit, but the identifier is the one from
+ -- the source, which allows us to recover the unit renaming.
---------------------
-- Build_Unit_Name --
---------------------
function Build_Unit_Name (Nam : Node_Id) return Node_Id is
+ Ent : Entity_Id;
Renaming : Entity_Id;
Result : Node_Id;
@@ -2695,12 +2700,33 @@ package body Sem_Ch10 is
end if;
else
+ Ent := Entity (Nam);
+
+ if Present (Entity (Selector_Name (Nam)))
+ and then Chars (Entity (Selector_Name (Nam))) /= Chars (Ent)
+ and then
+ Nkind (Unit_Declaration_Node (Entity (Selector_Name (Nam))))
+ = N_Package_Renaming_Declaration
+ then
+ -- The name in the with_clause is of the form A.B.C, and B
+ -- is given by a renaming declaration. In that case we may
+ -- not have analyzed the unit for B, but replaced it directly
+ -- in lib-load with the unit it renames. We have to make A.B
+ -- visible, so analyze the declaration for B now, in case it
+ -- has not been done yet.
+
+ Ent := Entity (Selector_Name (Nam));
+ Analyze
+ (Parent
+ (Unit_Declaration_Node (Entity (Selector_Name (Nam)))));
+ end if;
+
Result :=
Make_Expanded_Name (Loc,
Chars => Chars (Entity (Nam)),
Prefix => Build_Unit_Name (Prefix (Nam)),
- Selector_Name => New_Occurrence_Of (Entity (Nam), Loc));
- Set_Entity (Result, Entity (Nam));
+ Selector_Name => New_Occurrence_Of (Ent, Loc));
+ Set_Entity (Result, Ent);
return Result;
end if;
end Build_Unit_Name;
diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb
index cae84097d1a..30628b6864a 100644
--- a/gcc/ada/sem_ch12.adb
+++ b/gcc/ada/sem_ch12.adb
@@ -1810,6 +1810,20 @@ package body Sem_Ch12 is
Find_Type (Subtype_Mark (N));
T := Entity (Subtype_Mark (N));
+ -- Verify that there is no redundant null exclusion.
+
+ if Null_Exclusion_Present (N) then
+ if not Is_Access_Type (T) then
+ Error_Msg_N
+ ("null exclusion can only apply to an access type", N);
+
+ elsif Can_Never_Be_Null (T) then
+ Error_Msg_NE
+ ("`NOT NULL` not allowed (& already excludes null)",
+ N, T);
+ end if;
+ end if;
+
-- Ada 2005 (AI-423): Formal object with an access definition
else
@@ -2413,10 +2427,9 @@ package body Sem_Ch12 is
Error_Msg_N ("no visible entity matches specification", Def);
end if;
- else
-
- -- Several interpretations. Disambiguate as for a renaming.
+ -- More than one interpretation, so disambiguate as for a renaming
+ else
declare
I : Interp_Index;
I1 : Interp_Index := 0;
@@ -2427,7 +2440,6 @@ package body Sem_Ch12 is
Subp := Any_Id;
Get_First_Interp (Def, I, It);
while Present (It.Nam) loop
-
if Entity_Matches_Spec (It.Nam, Nam) then
if Subp /= Any_Id then
It1 := Disambiguate (Def, I1, I, Etype (Subp));
@@ -3755,6 +3767,38 @@ package body Sem_Ch12 is
Analyze_Subprogram_Instantiation (N, E_Procedure);
end Analyze_Procedure_Instantiation;
+ -----------------------------------
+ -- Need_Subprogram_Instance_Body --
+ -----------------------------------
+
+ function Need_Subprogram_Instance_Body
+ (N : Node_Id;
+ Subp : Entity_Id) return Boolean
+ is
+ begin
+ if (Is_In_Main_Unit (N)
+ or else Is_Inlined (Subp)
+ or else Is_Inlined (Alias (Subp)))
+ and then (Operating_Mode = Generate_Code
+ or else (Operating_Mode = Check_Semantics
+ and then ASIS_Mode))
+ and then (Expander_Active or else ASIS_Mode)
+ and then not ABE_Is_Certain (N)
+ and then not Is_Eliminated (Subp)
+ then
+ Pending_Instantiations.Append
+ ((Inst_Node => N,
+ Act_Decl => Unit_Declaration_Node (Subp),
+ Expander_Status => Expander_Active,
+ Current_Sem_Unit => Current_Sem_Unit,
+ Scope_Suppress => Scope_Suppress,
+ Local_Suppress_Stack_Top => Local_Suppress_Stack_Top));
+ return True;
+ else
+ return False;
+ end if;
+ end Need_Subprogram_Instance_Body;
+
--------------------------------------
-- Analyze_Subprogram_Instantiation --
--------------------------------------
@@ -4146,22 +4190,7 @@ package body Sem_Ch12 is
-- If the context requires a full instantiation, mark node for
-- subsequent construction of the body.
- if (Is_In_Main_Unit (N)
- or else Is_Inlined (Act_Decl_Id))
- and then (Operating_Mode = Generate_Code
- or else (Operating_Mode = Check_Semantics
- and then ASIS_Mode))
- and then (Expander_Active or else ASIS_Mode)
- and then not ABE_Is_Certain (N)
- and then not Is_Eliminated (Act_Decl_Id)
- then
- Pending_Instantiations.Append
- ((Inst_Node => N,
- Act_Decl => Act_Decl,
- Expander_Status => Expander_Active,
- Current_Sem_Unit => Current_Sem_Unit,
- Scope_Suppress => Scope_Suppress,
- Local_Suppress_Stack_Top => Local_Suppress_Stack_Top));
+ if Need_Subprogram_Instance_Body (N, Act_Decl_Id) then
Check_Forward_Instantiation (Gen_Decl);
@@ -8351,8 +8380,8 @@ package body Sem_Ch12 is
Defining_Identifier => New_Copy (Formal_Id),
Constant_Present => True,
Object_Definition => New_Copy (Def),
- Expression => New_Copy_Tree (Default_Expression
- (Formal)));
+ Expression => New_Copy_Tree
+ (Default_Expression (Formal)));
Append (Decl_Node, List);
Set_Analyzed (Expression (Decl_Node), False);
@@ -8383,9 +8412,9 @@ package body Sem_Ch12 is
Constant_Present => True,
Object_Definition => New_Copy (Def),
Expression =>
- Make_Attribute_Reference (Sloc (Formal_Id),
- Attribute_Name => Name_First,
- Prefix => New_Copy (Def)));
+ Make_Attribute_Reference (Sloc (Formal_Id),
+ Attribute_Name => Name_First,
+ Prefix => New_Copy (Def)));
Append (Decl_Node, List);
@@ -8701,6 +8730,14 @@ package body Sem_Ch12 is
begin
Gen_Body_Id := Corresponding_Body (Gen_Decl);
+ -- Subprogram body may have been created already because of an inline
+ -- pragma, or because of multiple elaborations of the enclosing package
+ -- when several instances of the subprogram appear in the main unit.
+
+ if Present (Corresponding_Body (Act_Decl)) then
+ return;
+ end if;
+
Expander_Mode_Save_And_Set (Body_Info.Expander_Status);
-- Re-establish the state of information on which checks are suppressed.
@@ -9223,10 +9260,20 @@ package body Sem_Ch12 is
Next_Index (I2);
end loop;
- if not Subtypes_Match
- (Find_Actual_Type (Component_Type (A_Gen_T), A_Gen_T),
- Component_Type (Act_T))
+ -- Check matching subtypes. Note that there are complex visibility
+ -- issues when the generic is a child unit and some aspect of the
+ -- generic type is declared in a parent unit of the generic. We do
+ -- the test to handle this special case only after a direct check
+ -- for static matching has failed.
+
+ if Subtypes_Match
+ (Component_Type (A_Gen_T), Component_Type (Act_T))
+ or else Subtypes_Match
+ (Find_Actual_Type (Component_Type (A_Gen_T), A_Gen_T),
+ Component_Type (Act_T))
then
+ null;
+ else
Error_Msg_NE
("component subtype of actual does not match that of formal &",
Actual, Gen_T);
@@ -10855,11 +10902,11 @@ package body Sem_Ch12 is
Set_Is_Immediately_Visible (P, False);
-- If the current scope is itself an instantiation of a generic
- -- nested within P, and we are in the private part of body of
- -- this instantiation, restore the full views of P, that were
- -- removed in End_Package_Scope above. This obscure case can
- -- occur when a subunit of a generic contains an instance of
- -- of a child unit of its generic parent unit.
+ -- nested within P, and we are in the private part of body of this
+ -- instantiation, restore the full views of P, that were removed
+ -- in End_Package_Scope above. This obscure case can occur when a
+ -- subunit of a generic contains an instance of a child unit of
+ -- its generic parent unit.
elsif S = Current_Scope
and then Is_Generic_Instance (S)
diff --git a/gcc/ada/sem_ch12.ads b/gcc/ada/sem_ch12.ads
index 7ebb2e88342..c3b34173e18 100644
--- a/gcc/ada/sem_ch12.ads
+++ b/gcc/ada/sem_ch12.ads
@@ -106,6 +106,16 @@ package Sem_Ch12 is
-- function and procedure instances. The flag Body_Optional has the
-- same purpose as described for Instantiate_Package_Body.
+ function Need_Subprogram_Instance_Body
+ (N : Node_Id;
+ Subp : Entity_Id) return Boolean;
+
+ -- If a subprogram instance is inlined, indicate that the body of it
+ -- must be created, to be used in inlined calls by the back-end. The
+ -- subprogram may be inlined because the generic itself carries the
+ -- pragma, or because a pragma appears for the instance in the scope.
+ -- of the instance.
+
procedure Save_Global_References (N : Node_Id);
-- Traverse the original generic unit, and capture all references to
-- entities that are defined outside of the generic in the analyzed
diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb
index f72ffff6397..fe5305fa40f 100644
--- a/gcc/ada/sem_ch13.adb
+++ b/gcc/ada/sem_ch13.adb
@@ -1131,6 +1131,12 @@ package body Sem_Ch13 is
Set_Associated_Node_For_Itype (New_Ctyp, U_Ent);
Set_Component_Type (Btype, New_Ctyp);
+
+ if Warn_On_Biased_Representation then
+ Error_Msg_N
+ ("?component size clause forces biased "
+ & "representation", N);
+ end if;
end if;
Set_Component_Size (Btype, Csize);
@@ -1330,7 +1336,12 @@ package body Sem_Ch13 is
or else Has_Small_Clause (U_Ent)
then
Check_Size (Expr, Etyp, Size, Biased);
- Set_Has_Biased_Representation (U_Ent, Biased);
+ Set_Has_Biased_Representation (U_Ent, Biased);
+
+ if Biased and Warn_On_Biased_Representation then
+ Error_Msg_N
+ ("?size clause forces biased representation", N);
+ end if;
end if;
-- For types set RM_Size and Esize if possible
@@ -1708,6 +1719,11 @@ package body Sem_Ch13 is
if Is_Elementary_Type (U_Ent) then
Check_Size (Expr, U_Ent, Size, Biased);
Set_Has_Biased_Representation (U_Ent, Biased);
+
+ if Biased and Warn_On_Biased_Representation then
+ Error_Msg_N
+ ("?value size clause forces biased representation", N);
+ end if;
end if;
Set_RM_Size (U_Ent, Size);
@@ -2491,6 +2507,12 @@ package body Sem_Ch13 is
Set_Has_Biased_Representation (Comp, Biased);
+ if Biased and Warn_On_Biased_Representation then
+ Error_Msg_F
+ ("?component clause forces biased "
+ & "representation", CC);
+ end if;
+
if Present (Ocomp) then
Set_Component_Clause (Ocomp, CC);
Set_Component_Bit_Offset (Ocomp, Fbit);
@@ -3570,7 +3592,10 @@ package body Sem_Ch13 is
-- Fall through with Hi and Lo set. Deal with biased case
- if (Biased and then not Is_Fixed_Point_Type (T))
+ if (Biased
+ and then not Is_Fixed_Point_Type (T)
+ and then not (Is_Enumeration_Type (T)
+ and then Has_Non_Standard_Rep (T)))
or else Has_Biased_Representation (T)
then
Hi := Hi - Lo;
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index b6ccb6028fc..18538c878be 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -31,6 +31,7 @@ with Einfo; use Einfo;
with Errout; use Errout;
with Eval_Fat; use Eval_Fat;
with Exp_Ch3; use Exp_Ch3;
+with Exp_Ch9; use Exp_Ch9;
with Exp_Disp; use Exp_Disp;
with Exp_Dist; use Exp_Dist;
with Exp_Tss; use Exp_Tss;
@@ -934,13 +935,25 @@ package body Sem_Ch3 is
Build_Itype_Reference (Anon_Type, Parent (Parent (Related_Nod)));
-- Similarly, if the access definition is the return result of a
- -- protected function, create an itype reference for it because it
- -- will be used within the function body.
+ -- function, create an itype reference for it because it
+ -- will be used within the function body. For a regular function that
+ -- is not a compilation unit, insert reference after the declaration.
+ -- For a protected operation, insert it after the enclosing protected
+ -- type declaration. In either case, do not create a reference for a
+ -- type obtained through a limited_with clause, because this would
+ -- introduce semantic dependencies.
elsif Nkind (Related_Nod) = N_Function_Specification
- and then Ekind (Current_Scope) = E_Protected_Type
+ and then not From_With_Type (Anon_Type)
then
- Build_Itype_Reference (Anon_Type, Parent (Current_Scope));
+ if Ekind (Current_Scope) = E_Protected_Type then
+ Build_Itype_Reference (Anon_Type, Parent (Current_Scope));
+
+ elsif Is_List_Member (Parent (Related_Nod))
+ and then Nkind (Parent (N)) /= N_Parameter_Specification
+ then
+ Build_Itype_Reference (Anon_Type, Parent (Related_Nod));
+ end if;
-- Finally, create an itype reference for an object declaration of
-- an anonymous access type. This is strictly necessary only for
@@ -1041,6 +1054,7 @@ package body Sem_Ch3 is
or else
Nkind_In (D_Ityp, N_Object_Declaration,
N_Object_Renaming_Declaration,
+ N_Formal_Object_Declaration,
N_Formal_Type_Declaration,
N_Task_Type_Declaration,
N_Protected_Type_Declaration))
@@ -1103,13 +1117,32 @@ package body Sem_Ch3 is
if Present (Formals) then
Push_Scope (Desig_Type);
+
+ -- A bit of a kludge here. These kludges will be removed when Itypes
+ -- have proper parent pointers to their declarations???
+
+ -- Kludge 1) Link definining_identifier of formals. Required by
+ -- First_Formal to provide its functionality.
+
+ declare
+ F : Node_Id;
+
+ begin
+ F := First (Formals);
+ while Present (F) loop
+ if No (Parent (Defining_Identifier (F))) then
+ Set_Parent (Defining_Identifier (F), F);
+ end if;
+
+ Next (F);
+ end loop;
+ end;
+
Process_Formals (Formals, Parent (T_Def));
- -- A bit of a kludge here, End_Scope requires that the parent
- -- pointer be set to something reasonable, but Itypes don't have
- -- parent pointers. So we set it and then unset it ??? If and when
- -- Itypes have proper parent pointers to their declarations, this
- -- kludge can be removed.
+ -- Kludge 2) End_Scope requires that the parent pointer be set to
+ -- something reasonable, but Itypes don't have parent pointers. So
+ -- we set it and then unset it ???
Set_Parent (Desig_Type, T_Name);
End_Scope;
@@ -1146,8 +1179,13 @@ package body Sem_Ch3 is
end loop;
end if;
+ -- If the return type is incomplete, this is legal as long as the
+ -- type is declared in the current scope and will be completed in
+ -- it (rather than being part of limited view).
+
if Ekind (Etype (Desig_Type)) = E_Incomplete_Type
and then not Has_Delayed_Freeze (Desig_Type)
+ and then In_Open_Scopes (Scope (Etype (Desig_Type)))
then
Append_Elmt (Desig_Type, Private_Dependents (Etype (Desig_Type)));
Set_Has_Delayed_Freeze (Desig_Type);
@@ -1629,6 +1667,7 @@ package body Sem_Ch3 is
if Ada_Version >= Ada_05
and then Ekind (T) = E_Anonymous_Access_Type
+ and then Etype (E) /= Any_Type
then
-- Check RM 3.9.2(9): "if the expected type for an expression is
-- an anonymous access-to-specific tagged type, then the object
@@ -2517,6 +2556,14 @@ package body Sem_Ch3 is
Set_Etype (Id, T);
Resolve (E, T);
+ -- If E is null and has been replaced by an N_Raise_Constraint_Error
+ -- node (which was marked already-analyzed), we need to set the type
+ -- to something other than Any_Access in order to keep gigi happy.
+
+ if Etype (E) = Any_Access then
+ Set_Etype (E, T);
+ end if;
+
-- If the object is an access to variable, the initialization
-- expression cannot be an access to constant.
@@ -2526,7 +2573,7 @@ package body Sem_Ch3 is
and then Is_Access_Constant (Etype (E))
then
Error_Msg_N
- ("object that is an access to variable cannot be initialized " &
+ ("access to variable cannot be initialized " &
"with an access-to-constant expression", E);
end if;
@@ -4427,6 +4474,10 @@ package body Sem_Ch3 is
Comp := Object_Definition (N);
Acc := Comp;
+ when N_Function_Specification =>
+ Comp := Result_Definition (N);
+ Acc := Comp;
+
when others =>
raise Program_Error;
end case;
@@ -4438,9 +4489,18 @@ package body Sem_Ch3 is
Mark_Rewrite_Insertion (Decl);
- -- Insert the new declaration in the nearest enclosing scope
+ -- Insert the new declaration in the nearest enclosing scope. If the
+ -- node is a body and N is its return type, the declaration belongs in
+ -- the enclosing scope.
P := Parent (N);
+
+ if Nkind (P) = N_Subprogram_Body
+ and then Nkind (N) = N_Function_Specification
+ then
+ P := Parent (P);
+ end if;
+
while Present (P) and then not Has_Declarations (P) loop
P := Parent (P);
end loop;
@@ -4471,6 +4531,10 @@ package body Sem_Ch3 is
elsif Nkind (N) = N_Access_Function_Definition then
Rewrite (Comp, New_Occurrence_Of (Anon, Loc));
+ elsif Nkind (N) = N_Function_Specification then
+ Rewrite (Comp, New_Occurrence_Of (Anon, Loc));
+ Set_Etype (Defining_Unit_Name (N), Anon);
+
else
Rewrite (Comp,
Make_Component_Definition (Loc,
@@ -4479,13 +4543,13 @@ package body Sem_Ch3 is
Mark_Rewrite_Insertion (Comp);
- -- Temporarily remove the current scope from the stack to add the new
- -- declarations to the enclosing scope
-
if Nkind_In (N, N_Object_Declaration, N_Access_Function_Definition) then
Analyze (Decl);
else
+ -- Temporarily remove the current scope (record or subprogram) from
+ -- the stack to add the new declarations to the enclosing scope.
+
Scope_Stack.Decrement_Last;
Analyze (Decl);
Set_Is_Itype (Anon);
@@ -4566,11 +4630,21 @@ package body Sem_Ch3 is
Has_Private_Component (Derived_Type));
Conditional_Delay (Derived_Type, Subt);
- -- Ada 2005 (AI-231). Set the null-exclusion attribute
+ -- Ada 2005 (AI-231): Set the null-exclusion attribute, and verify
+ -- that it is not redundant.
- if Null_Exclusion_Present (Type_Definition (N))
- or else Can_Never_Be_Null (Parent_Type)
- then
+ if Null_Exclusion_Present (Type_Definition (N)) then
+ Set_Can_Never_Be_Null (Derived_Type);
+
+ if Can_Never_Be_Null (Parent_Type)
+ and then False
+ then
+ Error_Msg_NE
+ ("`NOT NULL` not allowed (& already excludes null)",
+ N, Parent_Type);
+ end if;
+
+ elsif Can_Never_Be_Null (Parent_Type) then
Set_Can_Never_Be_Null (Derived_Type);
end if;
@@ -7554,6 +7628,15 @@ package body Sem_Ch3 is
(Designated_Type (Etype (Discr_Expr (J))))
then
Wrong_Type (Discr_Expr (J), Etype (Discr));
+
+ elsif Is_Access_Type (Etype (Discr))
+ and then not Is_Access_Constant (Etype (Discr))
+ and then Is_Access_Type (Etype (Discr_Expr (J)))
+ and then Is_Access_Constant (Etype (Discr_Expr (J)))
+ then
+ Error_Msg_NE
+ ("constraint for discriminant& must be access to variable",
+ Def, Discr);
end if;
end if;
@@ -12839,6 +12922,12 @@ package body Sem_Ch3 is
end;
end if;
+ if Null_Exclusion_Present (Def)
+ and then not Is_Access_Type (Parent_Type)
+ then
+ Error_Msg_N ("null exclusion can only apply to an access type", N);
+ end if;
+
Build_Derived_Type (N, Parent_Type, T, Is_Completion);
-- AI-419: The parent type of an explicitly limited derived type must
@@ -13136,6 +13225,13 @@ package body Sem_Ch3 is
Set_Scope (Id, Current_Scope);
New_Id := Id;
+ -- If this is a repeated incomplete declaration, no further
+ -- checks are possible.
+
+ if Nkind (N) = N_Incomplete_Type_Declaration then
+ return Prev;
+ end if;
+
-- Case of full declaration of incomplete type
elsif Ekind (Prev) = E_Incomplete_Type then
@@ -15294,6 +15390,15 @@ package body Sem_Ch3 is
Create_Null_Excluding_Itype
(T => Discr_Type,
Related_Nod => Discr));
+
+ -- Check for improper null exclusion if the type is otherwise
+ -- legal for a discriminant.
+
+ elsif Null_Exclusion_Present (Discr)
+ and then Is_Discrete_Type (Discr_Type)
+ then
+ Error_Msg_N
+ ("null exclusion can only apply to an access type", Discr);
end if;
-- Ada 2005 (AI-402): access discriminants of nonlimited types
@@ -15811,48 +15916,117 @@ package body Sem_Ch3 is
-- If the private view was tagged, copy the new primitive operations
-- from the private view to the full view.
- -- Note: Subprograms covering interface primitives were previously
- -- propagated to the full view by Derive_Progenitor_Primitives
-
- if Is_Tagged_Type (Full_T)
- and then not Is_Concurrent_Type (Full_T)
- then
+ if Is_Tagged_Type (Full_T) then
declare
- Priv_List : Elist_Id;
- Full_List : constant Elist_Id := Primitive_Operations (Full_T);
- P1, P2 : Elmt_Id;
+ Disp_Typ : Entity_Id;
+ Full_List : Elist_Id;
Prim : Entity_Id;
- D_Type : Entity_Id;
+ Prim_Elmt : Elmt_Id;
+ Priv_List : Elist_Id;
+
+ function Contains
+ (E : Entity_Id;
+ L : Elist_Id) return Boolean;
+ -- Determine whether list L contains element E
+
+ --------------
+ -- Contains --
+ --------------
+
+ function Contains
+ (E : Entity_Id;
+ L : Elist_Id) return Boolean
+ is
+ List_Elmt : Elmt_Id;
+
+ begin
+ List_Elmt := First_Elmt (L);
+ while Present (List_Elmt) loop
+ if Node (List_Elmt) = E then
+ return True;
+ end if;
+
+ Next_Elmt (List_Elmt);
+ end loop;
+
+ return False;
+ end Contains;
+
+ -- Start of processing
begin
if Is_Tagged_Type (Priv_T) then
Priv_List := Primitive_Operations (Priv_T);
+ Prim_Elmt := First_Elmt (Priv_List);
+
+ -- In the case of a concurrent type completing a private tagged
+ -- type, primivies may have been declared in between the two
+ -- views. These subprograms need to be wrapped the same way
+ -- entries and protected procedures are handled because they
+ -- cannot be directly shared by the two views.
- P1 := First_Elmt (Priv_List);
- while Present (P1) loop
- Prim := Node (P1);
+ if Is_Concurrent_Type (Full_T) then
+ declare
+ Conc_Typ : constant Entity_Id :=
+ Corresponding_Record_Type (Full_T);
+ Loc : constant Source_Ptr := Sloc (Conc_Typ);
+ Curr_Nod : Node_Id := Parent (Conc_Typ);
+ Wrap_Spec : Node_Id;
- -- Transfer explicit primitives, not those inherited from
- -- parent of partial view, which will be re-inherited on
- -- the full view.
+ begin
+ while Present (Prim_Elmt) loop
+ Prim := Node (Prim_Elmt);
- if Comes_From_Source (Prim) then
- P2 := First_Elmt (Full_List);
- while Present (P2) and then Node (P2) /= Prim loop
- Next_Elmt (P2);
+ if Comes_From_Source (Prim)
+ and then not Is_Abstract_Subprogram (Prim)
+ then
+ Wrap_Spec :=
+ Make_Subprogram_Declaration (Loc,
+ Specification =>
+ Build_Wrapper_Spec (Loc,
+ Subp_Id => Prim,
+ Obj_Typ => Conc_Typ,
+ Formals =>
+ Parameter_Specifications (
+ Parent (Prim))));
+
+ Insert_After (Curr_Nod, Wrap_Spec);
+ Curr_Nod := Wrap_Spec;
+
+ Analyze (Wrap_Spec);
+ end if;
+
+ Next_Elmt (Prim_Elmt);
end loop;
- -- If not found, that is a new one
+ return;
+ end;
+
+ -- For non-concurrent types, transfer explicit primitives, but
+ -- omit those inherited from the parent of the private view
+ -- since they will be re-inherited later on.
+
+ else
+ Full_List := Primitive_Operations (Full_T);
+
+ while Present (Prim_Elmt) loop
+ Prim := Node (Prim_Elmt);
- if No (P2) then
+ if Comes_From_Source (Prim)
+ and then not Contains (Prim, Full_List)
+ then
Append_Elmt (Prim, Full_List);
end if;
- end if;
- Next_Elmt (P1);
- end loop;
+ Next_Elmt (Prim_Elmt);
+ end loop;
+ end if;
+
+ -- Untagged private view
else
+ Full_List := Primitive_Operations (Full_T);
+
-- In this case the partial view is untagged, so here we locate
-- all of the earlier primitives that need to be treated as
-- dispatching (those that appear between the two views). Note
@@ -15871,10 +16045,9 @@ package body Sem_Ch3 is
or else
Ekind (Prim) = E_Function
then
+ Disp_Typ := Find_Dispatching_Type (Prim);
- D_Type := Find_Dispatching_Type (Prim);
-
- if D_Type = Full_T
+ if Disp_Typ = Full_T
and then (Chars (Prim) /= Name_Op_Ne
or else Comes_From_Source (Prim))
then
@@ -15887,13 +16060,13 @@ package body Sem_Ch3 is
end if;
elsif Is_Dispatching_Operation (Prim)
- and then D_Type /= Full_T
+ and then Disp_Typ /= Full_T
then
-- Verify that it is not otherwise controlled by a
-- formal or a return value of type T.
- Check_Controlling_Formals (D_Type, Prim);
+ Check_Controlling_Formals (Disp_Typ, Prim);
end if;
end if;
@@ -16381,7 +16554,9 @@ package body Sem_Ch3 is
or else
Nkind_In (P, N_Derived_Type_Definition,
N_Discriminant_Specification,
+ N_Formal_Object_Declaration,
N_Object_Declaration,
+ N_Object_Renaming_Declaration,
N_Parameter_Specification,
N_Subtype_Declaration);
@@ -16426,6 +16601,9 @@ package body Sem_Ch3 is
Error_Node :=
Subtype_Indication (Component_Definition (Related_Nod));
+ when N_Allocator =>
+ Error_Node := Expression (Related_Nod);
+
when others =>
pragma Assert (False);
Error_Node := Related_Nod;
diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb
index e14fb436d6b..19afc8d8fa7 100644
--- a/gcc/ada/sem_ch4.adb
+++ b/gcc/ada/sem_ch4.adb
@@ -498,11 +498,24 @@ package body Sem_Ch4 is
Set_Directly_Designated_Type (Acc_Type, Type_Id);
Check_Fully_Declared (Type_Id, N);
- -- Ada 2005 (AI-231)
+ -- Ada 2005 (AI-231): If the designated type is itself an access
+ -- type that excludes null, it's default initializastion will
+ -- be a null object, and we can insert an unconditional raise
+ -- before the allocator.
if Can_Never_Be_Null (Type_Id) then
- Error_Msg_N ("(Ada 2005) qualified expression required",
- Expression (N));
+ declare
+ Not_Null_Check : constant Node_Id :=
+ Make_Raise_Constraint_Error (Sloc (E),
+ Reason => CE_Null_Not_Allowed);
+ begin
+ if Expander_Active then
+ Insert_Action (N, Not_Null_Check);
+ Analyze (Not_Null_Check);
+ else
+ Error_Msg_N ("null value not allowed here?", E);
+ end if;
+ end;
end if;
-- Check restriction against dynamically allocated protected
@@ -684,12 +697,16 @@ package body Sem_Ch4 is
procedure Analyze_Call (N : Node_Id) is
Actuals : constant List_Id := Parameter_Associations (N);
- Nam : Node_Id := Name (N);
+ Nam : Node_Id;
X : Interp_Index;
It : Interp;
Nam_Ent : Entity_Id;
Success : Boolean := False;
+ Deref : Boolean := False;
+ -- Flag indicates whether an interpretation of the prefix is a
+ -- parameterless call that returns an access_to_subprogram.
+
function Name_Denotes_Function return Boolean;
-- If the type of the name is an access to subprogram, this may be the
-- type of a name, or the return type of the function being called. If
@@ -762,6 +779,8 @@ package body Sem_Ch4 is
Set_Etype (N, Any_Type);
+ Nam := Name (N);
+
if not Is_Overloaded (Nam) then
-- Only one interpretation to check
@@ -874,6 +893,7 @@ package body Sem_Ch4 is
while Present (It.Nam) loop
Nam_Ent := It.Nam;
+ Deref := False;
-- Name may be call that returns an access to subprogram, or more
-- generally an overloaded expression one of whose interpretations
@@ -888,11 +908,17 @@ package body Sem_Ch4 is
Nam_Ent := Designated_Type (Nam_Ent);
elsif Is_Access_Type (Etype (Nam_Ent))
- and then not Is_Entity_Name (Nam)
+ and then
+ (not Is_Entity_Name (Nam)
+ or else Nkind (N) = N_Procedure_Call_Statement)
and then Ekind (Designated_Type (Etype (Nam_Ent)))
= E_Subprogram_Type
then
Nam_Ent := Designated_Type (Etype (Nam_Ent));
+
+ if Is_Entity_Name (Nam) then
+ Deref := True;
+ end if;
end if;
Analyze_One_Call (N, Nam_Ent, False, Success);
@@ -904,7 +930,16 @@ package body Sem_Ch4 is
-- guation is done directly in Resolve.
if Success then
- Set_Etype (Nam, It.Typ);
+ if Deref
+ and then Nkind (Parent (N)) /= N_Explicit_Dereference
+ then
+ Set_Entity (Nam, It.Nam);
+ Insert_Explicit_Dereference (Nam);
+ Set_Etype (Nam, Nam_Ent);
+
+ else
+ Set_Etype (Nam, It.Typ);
+ end if;
elsif Nkind_In (Name (N), N_Selected_Component,
N_Function_Call)
@@ -1480,14 +1515,15 @@ package body Sem_Ch4 is
and then Is_Overloaded (N)
then
-- The prefix may include access to subprograms and other access
- -- types. If the context selects the interpretation that is a call,
- -- we cannot rewrite the node yet, but we include the result of
- -- the call interpretation.
+ -- types. If the context selects the interpretation that is a
+ -- function call (not a procedure call) we cannot rewrite the node
+ -- yet, but we include the result of the call interpretation.
Get_First_Interp (N, I, It);
while Present (It.Nam) loop
if Ekind (Base_Type (It.Typ)) = E_Subprogram_Type
and then Etype (Base_Type (It.Typ)) /= Standard_Void_Type
+ and then Nkind (Parent (N)) /= N_Procedure_Call_Statement
then
Add_One_Interp (N, Etype (It.Typ), Etype (It.Typ));
end if;
@@ -2104,11 +2140,12 @@ package body Sem_Ch4 is
-- is already known to be compatible, and because this may be an
-- indexing of a call with default parameters.
- Formal : Entity_Id;
- Actual : Node_Id;
- Is_Indexed : Boolean := False;
- Subp_Type : constant Entity_Id := Etype (Nam);
- Norm_OK : Boolean;
+ Formal : Entity_Id;
+ Actual : Node_Id;
+ Is_Indexed : Boolean := False;
+ Is_Indirect : Boolean := False;
+ Subp_Type : constant Entity_Id := Etype (Nam);
+ Norm_OK : Boolean;
function Operator_Hidden_By (Fun : Entity_Id) return Boolean;
-- There may be a user-defined operator that hides the current
@@ -2217,6 +2254,13 @@ package body Sem_Ch4 is
-- in prefix notation, so that the rebuilt parameter list has more than
-- one actual.
+ if not Is_Overloadable (Nam)
+ and then Ekind (Nam) /= E_Subprogram_Type
+ and then Ekind (Nam) /= E_Entry_Family
+ then
+ return;
+ end if;
+
if Present (Actuals)
and then
(Needs_No_Actuals (Nam)
@@ -2236,11 +2280,13 @@ package body Sem_Ch4 is
-- The prefix can also be a parameterless function that returns an
-- access to subprogram, in which case this is an indirect call.
+ -- If this succeeds, an explicit dereference is added later on,
+ -- in Analyze_Call or Resolve_Call.
elsif Is_Access_Type (Subp_Type)
and then Ekind (Designated_Type (Subp_Type)) = E_Subprogram_Type
then
- Is_Indexed := Try_Indirect_Call (N, Nam, Subp_Type);
+ Is_Indirect := Try_Indirect_Call (N, Nam, Subp_Type);
end if;
end if;
@@ -2255,13 +2301,21 @@ package body Sem_Ch4 is
return;
end if;
- Normalize_Actuals (N, Nam, (Report and not Is_Indexed), Norm_OK);
+ Normalize_Actuals
+ (N, Nam, (Report and not Is_Indexed and not Is_Indirect), Norm_OK);
if not Norm_OK then
+ -- If an indirect call is a possible interpretation, indicate
+ -- success to the caller.
+
+ if Is_Indirect then
+ Success := True;
+ return;
+
-- Mismatch in number or names of parameters
- if Debug_Flag_E then
+ elsif Debug_Flag_E then
Write_Str (" normalization fails in call ");
Write_Int (Int (N));
Write_Str (" with subprogram ");
@@ -2387,7 +2441,7 @@ package body Sem_Ch4 is
Write_Eol;
end if;
- if Report and not Is_Indexed then
+ if Report and not Is_Indexed and not Is_Indirect then
-- Ada 2005 (AI-251): Complete the error notification
-- to help new Ada 2005 users
@@ -6380,9 +6434,15 @@ package body Sem_Ch4 is
-----------------------------
function Valid_First_Argument_Of (Op : Entity_Id) return Boolean is
- Typ : constant Entity_Id := Etype (First_Formal (Op));
+ Typ : Entity_Id := Etype (First_Formal (Op));
begin
+ if Is_Concurrent_Type (Typ)
+ and then Present (Corresponding_Record_Type (Typ))
+ then
+ Typ := Corresponding_Record_Type (Typ);
+ end if;
+
-- Simple case. Object may be a subtype of the tagged type or
-- may be the corresponding record of a synchronized type.
@@ -6414,6 +6474,10 @@ package body Sem_Ch4 is
-- corresponding record (base) type.
if Is_Concurrent_Type (Obj_Type) then
+ if not Present (Corresponding_Record_Type (Obj_Type)) then
+ return False;
+ end if;
+
Corr_Type := Base_Type (Corresponding_Record_Type (Obj_Type));
Elmt := First_Elmt (Primitive_Operations (Corr_Type));
diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb
index 11439419a25..e5954a92110 100644
--- a/gcc/ada/sem_ch5.adb
+++ b/gcc/ada/sem_ch5.adb
@@ -579,21 +579,21 @@ package body Sem_Ch5 is
end if;
end if;
- -- Ada 2005 (AI-230 and AI-385): When the lhs type is an anonymous
- -- access type, apply an implicit conversion of the rhs to that type
- -- to force appropriate static and run-time accessibility checks.
- -- This applies as well to anonymous access-to-subprogram types that
- -- are component subtypes.
+ -- Ada 2005 (AI-385): When the lhs type is an anonymous access type,
+ -- apply an implicit conversion of the rhs to that type to force
+ -- appropriate static and run-time accessibility checks. This applies
+ -- as well to anonymous access-to-subprogram types that are component
+ -- subtypes or formal parameters.
if Ada_Version >= Ada_05
- and then
- Is_Access_Type (T1)
- and then
- (Is_Local_Anonymous_Access (T1)
- or else Can_Never_Be_Null (T1))
+ and then Is_Access_Type (T1)
then
- Rewrite (Rhs, Convert_To (T1, Relocate_Node (Rhs)));
- Analyze_And_Resolve (Rhs, T1);
+ if Is_Local_Anonymous_Access (T1)
+ or else Ekind (T2) = E_Anonymous_Access_Subprogram_Type
+ then
+ Rewrite (Rhs, Convert_To (T1, Relocate_Node (Rhs)));
+ Analyze_And_Resolve (Rhs, T1);
+ end if;
end if;
-- Ada 2005 (AI-231): Assignment to not null variable
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index 0116a83517c..1e84b266745 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -542,16 +542,33 @@ package body Sem_Ch6 is
-- "return access T" case; check that the return statement also has
-- "access T", and that the subtypes statically match:
+ -- if this is an access to subprogram the signatures must match.
if R_Type_Is_Anon_Access then
if R_Stm_Type_Is_Anon_Access then
- if Base_Type (Designated_Type (R_Stm_Type)) /=
- Base_Type (Designated_Type (R_Type))
- or else not Subtypes_Statically_Match (R_Stm_Type, R_Type)
+ if
+ Ekind (Designated_Type (R_Stm_Type)) /= E_Subprogram_Type
then
- Error_Msg_N
- ("subtype must statically match function result subtype",
- Subtype_Mark (Subtype_Ind));
+ if Base_Type (Designated_Type (R_Stm_Type)) /=
+ Base_Type (Designated_Type (R_Type))
+ or else not Subtypes_Statically_Match (R_Stm_Type, R_Type)
+ then
+ Error_Msg_N
+ ("subtype must statically match function result subtype",
+ Subtype_Mark (Subtype_Ind));
+ end if;
+
+ else
+ -- For two anonymous access to subprogram types, the
+ -- types themselves must be type conformant.
+
+ if not Conforming_Types
+ (R_Stm_Type, R_Type, Fully_Conformant)
+ then
+ Error_Msg_N
+ ("subtype must statically match function result subtype",
+ Subtype_Ind);
+ end if;
end if;
else
@@ -589,17 +606,22 @@ package body Sem_Ch6 is
-- definition matches the class-wide type. This prevents rejection
-- in the case where the object declaration is initialized by a call
-- to a build-in-place function with a specific result type and the
- -- object entity had its type changed to that specific type. (Note
- -- that the ARG believes that return objects should be allowed to
- -- have a type covered by a class-wide result type in any case, so
- -- once that relaxation is made (see AI05-32), the above check for
- -- type compatibility should be changed to test Covers rather than
- -- equality, and then the following special test will no longer be
- -- needed. ???)
+ -- object entity had its type changed to that specific type. This is
+ -- also allowed in the case where Obj_Decl does not come from source,
+ -- which can occur for an expansion of a simple return statement of
+ -- a build-in-place class-wide function when the result expression
+ -- has a specific type, because a return object with a specific type
+ -- is created. (Note that the ARG believes that return objects should
+ -- be allowed to have a type covered by a class-wide result type in
+ -- any case, so once that relaxation is made (see AI05-32), the above
+ -- check for type compatibility should be changed to test Covers
+ -- rather than equality, and the following special test will no
+ -- longer be needed. ???)
elsif Is_Class_Wide_Type (R_Type)
and then
- R_Type = Etype (Object_Definition (Original_Node (Obj_Decl)))
+ (R_Type = Etype (Object_Definition (Original_Node (Obj_Decl)))
+ or else not Comes_From_Source (Obj_Decl))
then
null;
@@ -641,9 +663,9 @@ package body Sem_Ch6 is
-- Analyze_Object_Declaration; we treat it as a normal
-- object declaration.
+ Set_Is_Return_Object (Defining_Identifier (Obj_Decl));
Analyze (Obj_Decl);
- Set_Is_Return_Object (Defining_Identifier (Obj_Decl));
Check_Return_Subtype_Indication (Obj_Decl);
if Present (HSS) then
@@ -891,6 +913,37 @@ package body Sem_Ch6 is
end if;
Set_Actual_Subtypes (N, Current_Scope);
+ Process_PPCs (N, Gen_Id, Body_Id);
+
+ -- If the generic unit carries pre- or post-conditions, copy them
+ -- to the original generic tree, so that they are properly added
+ -- to any instantiation.
+
+ declare
+ Orig : constant Node_Id := Original_Node (N);
+ Cond : Node_Id;
+
+ begin
+ Cond := First (Declarations (N));
+ while Present (Cond) loop
+ if Nkind (Cond) = N_Pragma
+ and then Pragma_Name (Cond) = Name_Check
+ then
+ Prepend (New_Copy_Tree (Cond), Declarations (Orig));
+
+ elsif Nkind (Cond) = N_Pragma
+ and then Pragma_Name (Cond) = Name_Postcondition
+ then
+ Set_Ekind (Defining_Entity (Orig), Ekind (Gen_Id));
+ Prepend (New_Copy_Tree (Cond), Declarations (Orig));
+ else
+ exit;
+ end if;
+
+ Next (Cond);
+ end loop;
+ end;
+
Analyze_Declarations (Declarations (N));
Check_Completion;
Analyze (Handled_Statement_Sequence (N));
@@ -1209,7 +1262,20 @@ package body Sem_Ch6 is
if Result_Definition (N) /= Error then
if Nkind (Result_Definition (N)) = N_Access_Definition then
- Typ := Access_Definition (N, Result_Definition (N));
+
+ -- Ada 2005 (AI-254): Handle anonymous access to subprograms
+
+ declare
+ AD : constant Node_Id :=
+ Access_To_Subprogram_Definition (Result_Definition (N));
+ begin
+ if Present (AD) and then Protected_Present (AD) then
+ Typ := Replace_Anonymous_Access_To_Protected_Subprogram (N);
+ else
+ Typ := Access_Definition (N, Result_Definition (N));
+ end if;
+ end;
+
Set_Parent (Typ, Result_Definition (N));
Set_Is_Local_Anonymous_Access (Typ);
Set_Etype (Designator, Typ);
@@ -1306,6 +1372,17 @@ package body Sem_Ch6 is
-- If pragma does not appear after the body, check whether there is
-- an inline pragma before any local declarations.
+ function Disambiguate_Spec return Entity_Id;
+ -- When a primitive is declared between the private view and the full
+ -- view of a concurrent type which implements an interface, a special
+ -- mechanism is used to find the corresponding spec of the primitive
+ -- body.
+
+ function Is_Private_Concurrent_Primitive
+ (Subp_Id : Entity_Id) return Boolean;
+ -- Determine whether subprogram Subp_Id is a primitive of a concurrent
+ -- type that implements an interface and has a private view.
+
procedure Set_Trivial_Subprogram (N : Node_Id);
-- Sets the Is_Trivial_Subprogram flag in both spec and body of the
-- subprogram whose body is being analyzed. N is the statement node
@@ -1457,6 +1534,134 @@ package body Sem_Ch6 is
end if;
end Check_Inline_Pragma;
+ -----------------------
+ -- Disambiguate_Spec --
+ -----------------------
+
+ function Disambiguate_Spec return Entity_Id is
+ Priv_Spec : Entity_Id;
+ Spec_N : Entity_Id;
+
+ procedure Replace_Types (To_Corresponding : Boolean);
+ -- Depending on the flag, replace the type of formal parameters of
+ -- Body_Id if it is a concurrent type implementing interfaces with
+ -- the corresponding record type or the other way around.
+
+ procedure Replace_Types (To_Corresponding : Boolean) is
+ Formal : Entity_Id;
+ Formal_Typ : Entity_Id;
+
+ begin
+ Formal := First_Formal (Body_Id);
+ while Present (Formal) loop
+ Formal_Typ := Etype (Formal);
+
+ -- From concurrent type to corresponding record
+
+ if To_Corresponding then
+ if Is_Concurrent_Type (Formal_Typ)
+ and then Present (Corresponding_Record_Type (Formal_Typ))
+ and then Present (Interfaces (
+ Corresponding_Record_Type (Formal_Typ)))
+ then
+ Set_Etype (Formal,
+ Corresponding_Record_Type (Formal_Typ));
+ end if;
+
+ -- From corresponding record to concurrent type
+
+ else
+ if Is_Concurrent_Record_Type (Formal_Typ)
+ and then Present (Interfaces (Formal_Typ))
+ then
+ Set_Etype (Formal,
+ Corresponding_Concurrent_Type (Formal_Typ));
+ end if;
+ end if;
+
+ Next_Formal (Formal);
+ end loop;
+ end Replace_Types;
+
+ -- Start of processing for Disambiguate_Spec
+
+ begin
+ -- Try to retrieve the specification of the body as is. All error
+ -- messages are suppressed because the body may not have a spec in
+ -- its current state.
+
+ Spec_N := Find_Corresponding_Spec (N, False);
+
+ -- It is possible that this is the body of a primitive declared
+ -- between a private and a full view of a concurrent type. The
+ -- controlling parameter of the spec carries the concurrent type,
+ -- not the corresponding record type as transformed by Analyze_
+ -- Subprogram_Specification. In such cases, we undo the change
+ -- made by the analysis of the specification and try to find the
+ -- spec again.
+
+ -- Note that wrappers already have their corresponding specs and
+ -- bodies set during their creation, so if the candidate spec is
+ -- a wrapper, then we definately need to swap all types to their
+ -- original concurrent status.
+
+ if No (Spec_N)
+ or else Is_Primitive_Wrapper (Spec_N)
+ then
+ -- Restore all references of corresponding record types to the
+ -- original concurrent types.
+
+ Replace_Types (To_Corresponding => False);
+ Priv_Spec := Find_Corresponding_Spec (N, False);
+
+ -- The current body truly belongs to a primitive declared between
+ -- a private and a full view. We leave the modified body as is,
+ -- and return the true spec.
+
+ if Present (Priv_Spec)
+ and then Is_Private_Primitive (Priv_Spec)
+ then
+ return Priv_Spec;
+ end if;
+
+ -- In case that this is some sort of error, restore the original
+ -- state of the body.
+
+ Replace_Types (To_Corresponding => True);
+ end if;
+
+ return Spec_N;
+ end Disambiguate_Spec;
+
+ -------------------------------------
+ -- Is_Private_Concurrent_Primitive --
+ -------------------------------------
+
+ function Is_Private_Concurrent_Primitive
+ (Subp_Id : Entity_Id) return Boolean
+ is
+ Formal_Typ : Entity_Id;
+
+ begin
+ if Present (First_Formal (Subp_Id)) then
+ Formal_Typ := Etype (First_Formal (Subp_Id));
+
+ if Is_Concurrent_Record_Type (Formal_Typ) then
+ Formal_Typ := Corresponding_Concurrent_Type (Formal_Typ);
+ end if;
+
+ -- The type of the first formal is a concurrent tagged type with
+ -- a private view.
+
+ return
+ Is_Concurrent_Type (Formal_Typ)
+ and then Is_Tagged_Type (Formal_Typ)
+ and then Has_Private_Declaration (Formal_Typ);
+ end if;
+
+ return False;
+ end Is_Private_Concurrent_Primitive;
+
----------------------------
-- Set_Trivial_Subprogram --
----------------------------
@@ -1581,7 +1786,11 @@ package body Sem_Ch6 is
if Nkind (N) = N_Subprogram_Body_Stub
or else No (Corresponding_Spec (N))
then
- Spec_Id := Find_Corresponding_Spec (N);
+ if Is_Private_Concurrent_Primitive (Body_Id) then
+ Spec_Id := Disambiguate_Spec;
+ else
+ Spec_Id := Find_Corresponding_Spec (N);
+ end if;
-- If this is a duplicate body, no point in analyzing it
@@ -1595,12 +1804,19 @@ package body Sem_Ch6 is
-- the body that depends on the subprogram having been frozen,
-- such as uses of extra formals), so we force it to be frozen
-- here. Same holds if the body and spec are compilation units.
+ -- Finally, if the return type is an anonymous access to protected
+ -- subprogram, it must be frozen before the body because its
+ -- expansion has generated an equivalent type that is used when
+ -- elaborating the body.
if No (Spec_Id) then
Freeze_Before (N, Body_Id);
elsif Nkind (Parent (N)) = N_Compilation_Unit then
Freeze_Before (N, Spec_Id);
+
+ elsif Is_Access_Subprogram_Type (Etype (Body_Id)) then
+ Freeze_Before (N, Etype (Body_Id));
end if;
else
@@ -1737,6 +1953,10 @@ package body Sem_Ch6 is
end if;
end if;
+ if Chars (Body_Id) = Name_uPostconditions then
+ Set_Has_Postconditions (Current_Scope);
+ end if;
+
-- Place subprogram on scope stack, and make formals visible. If there
-- is a spec, the visible entity remains that of the spec.
@@ -2228,17 +2448,6 @@ package body Sem_Ch6 is
and then No_Return (Ent)
then
Set_Trivial_Subprogram (Stm);
-
- -- If the procedure name is Raise_Exception, then also
- -- assume that it raises an exception. The main target
- -- here is Ada.Exceptions.Raise_Exception, but this name
- -- is pretty evocative in any context! Note that the
- -- procedure in Ada.Exceptions is not marked No_Return
- -- because of the annoying case of the null exception Id
- -- when operating in Ada 95 mode.
-
- elsif Chars (Ent) = Name_Raise_Exception then
- Set_Trivial_Subprogram (Stm);
end if;
end;
end if;
@@ -2322,6 +2531,22 @@ package body Sem_Ch6 is
New_Overloaded_Entity (Designator);
Check_Delayed_Subprogram (Designator);
+ -- If the type of the first formal of the current subprogram is a non
+ -- generic tagged private type , mark the subprogram as being a private
+ -- primitive.
+
+ if Present (First_Formal (Designator)) then
+ declare
+ Formal_Typ : constant Entity_Id :=
+ Etype (First_Formal (Designator));
+ begin
+ Set_Is_Private_Primitive (Designator,
+ Is_Tagged_Type (Formal_Typ)
+ and then Is_Private_Type (Formal_Typ)
+ and then not Is_Generic_Actual_Type (Formal_Typ));
+ end;
+ end if;
+
-- Ada 2005 (AI-251): Abstract interface primitives must be abstract
-- or null.
@@ -2435,8 +2660,6 @@ package body Sem_Ch6 is
function Analyze_Subprogram_Specification (N : Node_Id) return Entity_Id is
Designator : constant Entity_Id := Defining_Entity (N);
Formals : constant List_Id := Parameter_Specifications (N);
- Formal : Entity_Id;
- Formal_Typ : Entity_Id;
-- Start of processing for Analyze_Subprogram_Specification
@@ -2466,21 +2689,29 @@ package body Sem_Ch6 is
-- record, to match the proper signature of an overriding operation.
if Ada_Version >= Ada_05 then
- Formal := First_Formal (Designator);
- while Present (Formal) loop
- Formal_Typ := Etype (Formal);
+ declare
+ Formal : Entity_Id;
+ Formal_Typ : Entity_Id;
+ Rec_Typ : Entity_Id;
- if Is_Concurrent_Type (Formal_Typ)
- and then Present (Corresponding_Record_Type (Formal_Typ))
- and then Present (Interfaces
- (Corresponding_Record_Type (Formal_Typ)))
- then
- Set_Etype (Formal,
- Corresponding_Record_Type (Formal_Typ));
- end if;
+ begin
+ Formal := First_Formal (Designator);
+ while Present (Formal) loop
+ Formal_Typ := Etype (Formal);
- Formal := Next_Formal (Formal);
- end loop;
+ if Is_Concurrent_Type (Formal_Typ)
+ and then Present (Corresponding_Record_Type (Formal_Typ))
+ then
+ Rec_Typ := Corresponding_Record_Type (Formal_Typ);
+
+ if Present (Interfaces (Rec_Typ)) then
+ Set_Etype (Formal, Rec_Typ);
+ end if;
+ end if;
+
+ Next_Formal (Formal);
+ end loop;
+ end;
end if;
End_Scope;
@@ -5161,7 +5392,10 @@ package body Sem_Ch6 is
-- Find_Corresponding_Spec --
-----------------------------
- function Find_Corresponding_Spec (N : Node_Id) return Entity_Id is
+ function Find_Corresponding_Spec
+ (N : Node_Id;
+ Post_Error : Boolean := True) return Entity_Id
+ is
Spec : constant Node_Id := Specification (N);
Designator : constant Entity_Id := Defining_Entity (Spec);
@@ -5205,7 +5439,6 @@ package body Sem_Ch6 is
end if;
if not Has_Completion (E) then
-
if Nkind (N) /= N_Subprogram_Body_Stub then
Set_Corresponding_Spec (N, E);
end if;
@@ -5250,14 +5483,15 @@ package body Sem_Ch6 is
return Empty;
end if;
- -- If body already exists, this is an error unless the
- -- previous declaration is the implicit declaration of
- -- a derived subprogram, or this is a spurious overloading
- -- in an instance.
+ -- If the body already exists, then this is an error unless
+ -- the previous declaration is the implicit declaration of a
+ -- derived subprogram, or this is a spurious overloading in an
+ -- instance.
elsif No (Alias (E))
and then not Is_Intrinsic_Subprogram (E)
and then not In_Instance
+ and then Post_Error
then
Error_Msg_Sloc := Sloc (E);
if Is_Imported (E) then
@@ -5269,16 +5503,17 @@ package body Sem_Ch6 is
end if;
end if;
+ -- Child units cannot be overloaded, so a conformance mismatch
+ -- between body and a previous spec is an error.
+
elsif Is_Child_Unit (E)
and then
Nkind (Unit_Declaration_Node (Designator)) = N_Subprogram_Body
and then
Nkind (Parent (Unit_Declaration_Node (Designator))) =
- N_Compilation_Unit
+ N_Compilation_Unit
+ and then Post_Error
then
- -- Child units cannot be overloaded, so a conformance mismatch
- -- between body and a previous spec is an error.
-
Error_Msg_N
("body of child unit does not match previous declaration", N);
end if;
@@ -6401,12 +6636,6 @@ package body Sem_Ch6 is
In_Scope : Boolean;
Typ : Entity_Id;
- function Has_Correct_Formal_Mode
- (Tag_Typ : Entity_Id;
- Subp : Entity_Id) return Boolean;
- -- For an overridden subprogram Subp, check whether the mode of its
- -- first parameter is correct depending on the kind of Tag_Typ.
-
function Matches_Prefixed_View_Profile
(Prim_Params : List_Id;
Iface_Params : List_Id) return Boolean;
@@ -6415,39 +6644,6 @@ package body Sem_Ch6 is
-- Iface_Params. Also determine if the type of first parameter of
-- Iface_Params is an implemented interface.
- -----------------------------
- -- Has_Correct_Formal_Mode --
- -----------------------------
-
- function Has_Correct_Formal_Mode
- (Tag_Typ : Entity_Id;
- Subp : Entity_Id) return Boolean
- is
- Formal : constant Node_Id := First_Formal (Subp);
-
- begin
- -- In order for an entry or a protected procedure to override, the
- -- first parameter of the overridden routine must be of mode
- -- "out", "in out" or access-to-variable.
-
- if (Ekind (Subp) = E_Entry
- or else Ekind (Subp) = E_Procedure)
- and then Is_Protected_Type (Tag_Typ)
- and then Ekind (Formal) /= E_In_Out_Parameter
- and then Ekind (Formal) /= E_Out_Parameter
- and then Nkind (Parameter_Type (Parent (Formal))) /=
- N_Access_Definition
- then
- return False;
- end if;
-
- -- All other cases are OK since a task entry or routine does not
- -- have a restriction on the mode of the first parameter of the
- -- overridden interface routine.
-
- return True;
- end Has_Correct_Formal_Mode;
-
-----------------------------------
-- Matches_Prefixed_View_Profile --
-----------------------------------
@@ -6525,15 +6721,15 @@ package body Sem_Ch6 is
Iface_Id := Defining_Identifier (Iface_Param);
Iface_Typ := Find_Parameter_Type (Iface_Param);
- if Is_Access_Type (Iface_Typ) then
- Iface_Typ := Directly_Designated_Type (Iface_Typ);
- end if;
-
Prim_Id := Defining_Identifier (Prim_Param);
Prim_Typ := Find_Parameter_Type (Prim_Param);
- if Is_Access_Type (Prim_Typ) then
- Prim_Typ := Directly_Designated_Type (Prim_Typ);
+ if Ekind (Iface_Typ) = E_Anonymous_Access_Type
+ and then Ekind (Prim_Typ) = E_Anonymous_Access_Type
+ and then Is_Concurrent_Type (Designated_Type (Prim_Typ))
+ then
+ Iface_Typ := Designated_Type (Iface_Typ);
+ Prim_Typ := Designated_Type (Prim_Typ);
end if;
-- Case of multiple interface types inside a parameter profile
@@ -6666,60 +6862,63 @@ package body Sem_Ch6 is
while Present (Hom) loop
Subp := Hom;
- -- Entries can override abstract or null interface
- -- procedures
-
- if Ekind (Def_Id) = E_Entry
- and then Ekind (Subp) = E_Procedure
- and then Nkind (Parent (Subp)) = N_Procedure_Specification
- and then (Is_Abstract_Subprogram (Subp)
- or else Null_Present (Parent (Subp)))
+ if Subp = Def_Id
+ or else not Is_Overloadable (Subp)
+ or else not Is_Primitive (Subp)
+ or else not Is_Dispatching_Operation (Subp)
+ or else not Is_Interface (Find_Dispatching_Type (Subp))
then
- while Present (Alias (Subp)) loop
- Subp := Alias (Subp);
- end loop;
-
- if Matches_Prefixed_View_Profile
- (Parameter_Specifications (Parent (Def_Id)),
- Parameter_Specifications (Parent (Subp)))
- then
- Candidate := Subp;
-
- -- Absolute match
-
- if Has_Correct_Formal_Mode (Typ, Candidate) then
- Overridden_Subp := Candidate;
- return;
- end if;
- end if;
+ null;
- -- Procedures can override abstract or null interface
- -- procedures
+ -- Entries and procedures can override abstract or null
+ -- interface procedures
- elsif Ekind (Def_Id) = E_Procedure
+ elsif (Ekind (Def_Id) = E_Procedure
+ or else Ekind (Def_Id) = E_Entry)
and then Ekind (Subp) = E_Procedure
- and then Nkind (Parent (Subp)) = N_Procedure_Specification
- and then (Is_Abstract_Subprogram (Subp)
- or else Null_Present (Parent (Subp)))
and then Matches_Prefixed_View_Profile
(Parameter_Specifications (Parent (Def_Id)),
Parameter_Specifications (Parent (Subp)))
then
Candidate := Subp;
- -- Absolute match
+ -- For an overridden subprogram Subp, check whether the mode
+ -- of its first parameter is correct depending on the kind
+ -- of synchronized type.
- if Has_Correct_Formal_Mode (Typ, Candidate) then
- Overridden_Subp := Candidate;
- return;
- end if;
+ declare
+ Formal : constant Node_Id := First_Formal (Candidate);
+
+ begin
+ -- In order for an entry or a protected procedure to
+ -- override, the first parameter of the overridden
+ -- routine must be of mode "out", "in out" or
+ -- access-to-variable.
+
+ if (Ekind (Candidate) = E_Entry
+ or else Ekind (Candidate) = E_Procedure)
+ and then Is_Protected_Type (Typ)
+ and then Ekind (Formal) /= E_In_Out_Parameter
+ and then Ekind (Formal) /= E_Out_Parameter
+ and then Nkind (Parameter_Type (Parent (Formal)))
+ /= N_Access_Definition
+ then
+ null;
+
+ -- All other cases are OK since a task entry or routine
+ -- does not have a restriction on the mode of the first
+ -- parameter of the overridden interface routine.
+
+ else
+ Overridden_Subp := Candidate;
+ return;
+ end if;
+ end;
-- Functions can override abstract interface functions
elsif Ekind (Def_Id) = E_Function
and then Ekind (Subp) = E_Function
- and then Nkind (Parent (Subp)) = N_Function_Specification
- and then Is_Abstract_Subprogram (Subp)
and then Matches_Prefixed_View_Profile
(Parameter_Specifications (Parent (Def_Id)),
Parameter_Specifications (Parent (Subp)))
@@ -7590,8 +7789,17 @@ package body Sem_Ch6 is
-- do this fiddling, for the spec cases, the already preanalyzed
-- parameters are not affected.
+ -- For a postcondition pragma within a generic, preserve the pragma
+ -- for later expansion.
+
Set_Analyzed (CP, False);
+ if Nam = Name_Postcondition
+ and then not Expander_Active
+ then
+ return CP;
+ end if;
+
-- Change pragma into corresponding pragma Check
Prepend_To (Pragma_Argument_Associations (CP),
@@ -7609,6 +7817,12 @@ package body Sem_Ch6 is
-- Start of processing for Process_PPCs
begin
+ -- Nothing to do if we are not generating code
+
+ if Operating_Mode /= Generate_Code then
+ return;
+ end if;
+
-- Grab preconditions from spec
if Present (Spec_Id) then
@@ -7664,7 +7878,15 @@ package body Sem_Ch6 is
end if;
Analyze (Prag);
- Append (Grab_PPC (Name_Postcondition), Plist);
+
+ -- If expansion is disabled, as in a generic unit,
+ -- save pragma for later expansion.
+
+ if not Expander_Active then
+ Prepend (Grab_PPC (Name_Postcondition), Declarations (N));
+ else
+ Append (Grab_PPC (Name_Postcondition), Plist);
+ end if;
end if;
Next (Prag);
@@ -7697,16 +7919,23 @@ package body Sem_Ch6 is
Plist := Empty_List;
end if;
- Append (Grab_PPC (Name_Postcondition), Plist);
+ if not Expander_Active then
+ Prepend (Grab_PPC (Name_Postcondition), Declarations (N));
+ else
+ Append (Grab_PPC (Name_Postcondition), Plist);
+ end if;
end if;
Prag := Next_Pragma (Prag);
end loop;
end if;
- -- If we had any postconditions, build the procedure
+ -- If we had any postconditions and expansion is enabled, build
+ -- the Postconditions procedure.
- if Present (Plist) then
+ if Present (Plist)
+ and then Expander_Active
+ then
Subp := Defining_Entity (N);
if Etype (Subp) /= Standard_Void_Type then
diff --git a/gcc/ada/sem_ch6.ads b/gcc/ada/sem_ch6.ads
index 689ac8b690a..e54c1e1117c 100644
--- a/gcc/ada/sem_ch6.ads
+++ b/gcc/ada/sem_ch6.ads
@@ -136,8 +136,8 @@ package Sem_Ch6 is
Get_Inst : Boolean := False) return Boolean;
-- Check that the types of two formal parameters are conforming. In most
-- cases this is just a name comparison, but within an instance it involves
- -- generic actual types, and in the presence of anonymous access types
- -- it must examine the designated types.
+ -- generic actual types, and in the presence of anonymous access types it
+ -- must examine the designated types.
procedure Create_Extra_Formals (E : Entity_Id);
-- For each parameter of a subprogram or entry that requires an additional
@@ -147,7 +147,9 @@ package Sem_Ch6 is
-- the end of Subp's parameter list (with each subsequent extra formal
-- being attached to the preceding extra formal).
- function Find_Corresponding_Spec (N : Node_Id) return Entity_Id;
+ function Find_Corresponding_Spec
+ (N : Node_Id;
+ Post_Error : Boolean := True) return Entity_Id;
-- Use the subprogram specification in the body to retrieve the previous
-- subprogram declaration, if any.
diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb
index c5edce6d085..c52f5ad7dcb 100644
--- a/gcc/ada/sem_ch8.adb
+++ b/gcc/ada/sem_ch8.adb
@@ -832,7 +832,10 @@ package body Sem_Ch8 is
if Nkind (Nam) = N_Explicit_Dereference
and then Ekind (Etype (T2)) = E_Incomplete_Type
then
- Error_Msg_N ("invalid use of incomplete type", Id);
+ Error_Msg_NE ("invalid use of incomplete type&", Id, T2);
+ return;
+ elsif Ekind (Etype (T)) = E_Incomplete_Type then
+ Error_Msg_NE ("invalid use of incomplete type&", Id, T);
return;
end if;
@@ -884,7 +887,20 @@ package body Sem_Ch8 is
Error_Msg_N
("renamed object does not exclude `NULL` "
& "(RM 8.5.1(4.6/2))", N);
+
+ elsif Can_Never_Be_Null (Etype (Nam_Ent)) then
+ Error_Msg_NE
+ ("`NOT NULL` not allowed (type of& already excludes null)",
+ N, Nam_Ent);
+
end if;
+
+ elsif Has_Null_Exclusion (N)
+ and then No (Access_Definition (N))
+ and then Can_Never_Be_Null (T)
+ then
+ Error_Msg_NE
+ ("`NOT NULL` not allowed (& already excludes null)", N, T);
end if;
end;
end if;
@@ -1578,25 +1594,45 @@ package body Sem_Ch8 is
-- an abstract formal subprogram must be dispatching
-- operation).
- case Attribute_Name (Nam) is
- when Name_Input =>
- Stream_Prim :=
- Find_Prim_Op (Prefix_Type, TSS_Stream_Input);
- when Name_Output =>
- Stream_Prim :=
- Find_Prim_Op (Prefix_Type, TSS_Stream_Output);
- when Name_Read =>
- Stream_Prim :=
- Find_Prim_Op (Prefix_Type, TSS_Stream_Read);
- when Name_Write =>
- Stream_Prim :=
- Find_Prim_Op (Prefix_Type, TSS_Stream_Write);
- when others =>
- Error_Msg_N
- ("attribute must be a primitive dispatching operation",
- Nam);
- return;
- end case;
+ begin
+ case Attribute_Name (Nam) is
+ when Name_Input =>
+ Stream_Prim :=
+ Find_Prim_Op (Prefix_Type, TSS_Stream_Input);
+ when Name_Output =>
+ Stream_Prim :=
+ Find_Prim_Op (Prefix_Type, TSS_Stream_Output);
+ when Name_Read =>
+ Stream_Prim :=
+ Find_Prim_Op (Prefix_Type, TSS_Stream_Read);
+ when Name_Write =>
+ Stream_Prim :=
+ Find_Prim_Op (Prefix_Type, TSS_Stream_Write);
+ when others =>
+ Error_Msg_N
+ ("attribute must be a primitive"
+ & " dispatching operation", Nam);
+ return;
+ end case;
+
+ exception
+
+ -- If no operation was found, and the type is limited,
+ -- the user should have defined one.
+
+ when Program_Error =>
+ if Is_Limited_Type (Prefix_Type) then
+ Error_Msg_NE
+ ("stream operation not defined for type&",
+ N, Prefix_Type);
+ return;
+
+ -- Otherwise, compiler should have generated default
+
+ else
+ raise;
+ end if;
+ end;
-- Rewrite the attribute into the name of its corresponding
-- primitive dispatching subprogram. We can then proceed with
diff --git a/gcc/ada/sem_mech.adb b/gcc/ada/sem_mech.adb
index 177a39ca671..87a0d054451 100644
--- a/gcc/ada/sem_mech.adb
+++ b/gcc/ada/sem_mech.adb
@@ -69,7 +69,7 @@ package body Sem_Mech is
("mechanism for & has already been set", Mech_Name, Ent);
end if;
- -- MECHANISM_NAME ::= value | reference | descriptor
+ -- MECHANISM_NAME ::= value | reference | descriptor | short_descriptor
if Nkind (Mech_Name) = N_Identifier then
if Chars (Mech_Name) = Name_Value then
@@ -85,6 +85,11 @@ package body Sem_Mech is
Set_Mechanism_With_Checks (Ent, By_Descriptor, Mech_Name);
return;
+ elsif Chars (Mech_Name) = Name_Short_Descriptor then
+ Check_VMS (Mech_Name);
+ Set_Mechanism_With_Checks (Ent, By_Short_Descriptor, Mech_Name);
+ return;
+
elsif Chars (Mech_Name) = Name_Copy then
Error_Msg_N
("bad mechanism name, Value assumed", Mech_Name);
@@ -95,7 +100,8 @@ package body Sem_Mech is
return;
end if;
- -- MECHANISM_NAME ::= descriptor (CLASS_NAME)
+ -- MECHANISM_NAME ::= descriptor (CLASS_NAME) |
+ -- short_descriptor (CLASS_NAME)
-- CLASS_NAME ::= ubs | ubsb | uba | s | sb | a | nca
-- Note: this form is parsed as an indexed component
@@ -104,14 +110,16 @@ package body Sem_Mech is
Class := First (Expressions (Mech_Name));
if Nkind (Prefix (Mech_Name)) /= N_Identifier
- or else Chars (Prefix (Mech_Name)) /= Name_Descriptor
+ or else not (Chars (Prefix (Mech_Name)) = Name_Descriptor or else
+ Chars (Prefix (Mech_Name)) = Name_Short_Descriptor)
or else Present (Next (Class))
then
Bad_Mechanism;
return;
end if;
- -- MECHANISM_NAME ::= descriptor (Class => CLASS_NAME)
+ -- MECHANISM_NAME ::= descriptor (Class => CLASS_NAME) |
+ -- short_descriptor (Class => CLASS_NAME)
-- CLASS_NAME ::= ubs | ubsb | uba | s | sb | a | nca
-- Note: this form is parsed as a function call
@@ -121,7 +129,8 @@ package body Sem_Mech is
Param := First (Parameter_Associations (Mech_Name));
if Nkind (Name (Mech_Name)) /= N_Identifier
- or else Chars (Name (Mech_Name)) /= Name_Descriptor
+ or else not (Chars (Name (Mech_Name)) = Name_Descriptor or else
+ Chars (Name (Mech_Name)) = Name_Short_Descriptor)
or else Present (Next (Param))
or else No (Selector_Name (Param))
or else Chars (Selector_Name (Param)) /= Name_Class
@@ -145,27 +154,76 @@ package body Sem_Mech is
Bad_Class;
return;
- elsif Chars (Class) = Name_UBS then
+ elsif Chars (Name (Mech_Name)) = Name_Descriptor
+ and then Chars (Class) = Name_UBS
+ then
Set_Mechanism_With_Checks (Ent, By_Descriptor_UBS, Mech_Name);
- elsif Chars (Class) = Name_UBSB then
+ elsif Chars (Name (Mech_Name)) = Name_Descriptor
+ and then Chars (Class) = Name_UBSB
+ then
Set_Mechanism_With_Checks (Ent, By_Descriptor_UBSB, Mech_Name);
- elsif Chars (Class) = Name_UBA then
+ elsif Chars (Name (Mech_Name)) = Name_Descriptor
+ and then Chars (Class) = Name_UBA
+ then
Set_Mechanism_With_Checks (Ent, By_Descriptor_UBA, Mech_Name);
- elsif Chars (Class) = Name_S then
+ elsif Chars (Name (Mech_Name)) = Name_Descriptor
+ and then Chars (Class) = Name_S
+ then
Set_Mechanism_With_Checks (Ent, By_Descriptor_S, Mech_Name);
- elsif Chars (Class) = Name_SB then
+ elsif Chars (Name (Mech_Name)) = Name_Descriptor
+ and then Chars (Class) = Name_SB
+ then
Set_Mechanism_With_Checks (Ent, By_Descriptor_SB, Mech_Name);
- elsif Chars (Class) = Name_A then
+ elsif Chars (Name (Mech_Name)) = Name_Descriptor
+ and then Chars (Class) = Name_A
+ then
Set_Mechanism_With_Checks (Ent, By_Descriptor_A, Mech_Name);
- elsif Chars (Class) = Name_NCA then
+ elsif Chars (Name (Mech_Name)) = Name_Descriptor
+ and then Chars (Class) = Name_NCA
+ then
Set_Mechanism_With_Checks (Ent, By_Descriptor_NCA, Mech_Name);
+ elsif Chars (Name (Mech_Name)) = Name_Short_Descriptor
+ and then Chars (Class) = Name_UBS
+ then
+ Set_Mechanism_With_Checks (Ent, By_Short_Descriptor_UBS, Mech_Name);
+
+ elsif Chars (Name (Mech_Name)) = Name_Short_Descriptor
+ and then Chars (Class) = Name_UBSB
+ then
+ Set_Mechanism_With_Checks (Ent, By_Short_Descriptor_UBSB, Mech_Name);
+
+ elsif Chars (Name (Mech_Name)) = Name_Short_Descriptor
+ and then Chars (Class) = Name_UBA
+ then
+ Set_Mechanism_With_Checks (Ent, By_Short_Descriptor_UBA, Mech_Name);
+
+ elsif Chars (Name (Mech_Name)) = Name_Short_Descriptor
+ and then Chars (Class) = Name_S
+ then
+ Set_Mechanism_With_Checks (Ent, By_Short_Descriptor_S, Mech_Name);
+
+ elsif Chars (Name (Mech_Name)) = Name_Short_Descriptor
+ and then Chars (Class) = Name_SB
+ then
+ Set_Mechanism_With_Checks (Ent, By_Short_Descriptor_SB, Mech_Name);
+
+ elsif Chars (Name (Mech_Name)) = Name_Short_Descriptor
+ and then Chars (Class) = Name_A
+ then
+ Set_Mechanism_With_Checks (Ent, By_Short_Descriptor_A, Mech_Name);
+
+ elsif Chars (Name (Mech_Name)) = Name_Short_Descriptor
+ and then Chars (Class) = Name_NCA
+ then
+ Set_Mechanism_With_Checks (Ent, By_Short_Descriptor_NCA, Mech_Name);
+
else
Bad_Class;
return;
diff --git a/gcc/ada/sem_mech.ads b/gcc/ada/sem_mech.ads
index 1673a671b0e..93f6080f1f4 100644
--- a/gcc/ada/sem_mech.ads
+++ b/gcc/ada/sem_mech.ads
@@ -95,6 +95,14 @@ package Sem_Mech is
By_Descriptor_SB : constant Mechanism_Type := -8;
By_Descriptor_A : constant Mechanism_Type := -9;
By_Descriptor_NCA : constant Mechanism_Type := -10;
+ By_Short_Descriptor : constant Mechanism_Type := -11;
+ By_Short_Descriptor_UBS : constant Mechanism_Type := -12;
+ By_Short_Descriptor_UBSB : constant Mechanism_Type := -13;
+ By_Short_Descriptor_UBA : constant Mechanism_Type := -14;
+ By_Short_Descriptor_S : constant Mechanism_Type := -15;
+ By_Short_Descriptor_SB : constant Mechanism_Type := -16;
+ By_Short_Descriptor_A : constant Mechanism_Type := -17;
+ By_Short_Descriptor_NCA : constant Mechanism_Type := -18;
-- These values are used only in OpenVMS ports of GNAT. Pass by descriptor
-- is forced, as described in the OpenVMS ABI. The suffix indicates the
-- descriptor type:
@@ -113,7 +121,7 @@ package Sem_Mech is
-- type based on the Ada type in accordance with the OpenVMS ABI.
subtype Descriptor_Codes is Mechanism_Type
- range By_Descriptor_NCA .. By_Descriptor;
+ range By_Short_Descriptor_NCA .. By_Descriptor;
-- Subtype including all descriptor mechanisms
-- All the above special values are non-positive. Positive values for
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index 3feba8002d9..c1c661b08c0 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -53,6 +53,7 @@ with Sem_Aux; use Sem_Aux;
with Sem_Ch3; use Sem_Ch3;
with Sem_Ch6; use Sem_Ch6;
with Sem_Ch8; use Sem_Ch8;
+with Sem_Ch12; use Sem_Ch12;
with Sem_Ch13; use Sem_Ch13;
with Sem_Dist; use Sem_Dist;
with Sem_Elim; use Sem_Elim;
@@ -583,6 +584,7 @@ package body Sem_Prag is
-- expression, returns True if so, False if non-static or not String.
procedure Pragma_Misplaced;
+ pragma No_Return (Pragma_Misplaced);
-- Issue fatal error message for misplaced pragma
procedure Process_Atomic_Shared_Volatile;
@@ -1279,10 +1281,10 @@ package body Sem_Prag is
-- sequence, so the only way we get here is by being in the
-- declarative part of the body.
- elsif Nkind (P) = N_Subprogram_Body
- or else Nkind (P) = N_Package_Body
- or else Nkind (P) = N_Task_Body
- or else Nkind (P) = N_Entry_Body
+ elsif Nkind_In (P, N_Subprogram_Body,
+ N_Package_Body,
+ N_Task_Body,
+ N_Entry_Body)
then
return;
end if;
@@ -1350,9 +1352,57 @@ package body Sem_Prag is
procedure Check_Precondition_Postcondition (In_Body : out Boolean) is
P : Node_Id;
- S : Entity_Id;
PO : Node_Id;
+ procedure Chain_PPC (PO : Node_Id);
+ -- If PO is a subprogram declaration node (or a generic subprogram
+ -- declaration node), then the precondition/postcondition applies
+ -- to this subprogram and the processing for the pragma is completed.
+ -- Otherwise the pragma is misplaced.
+
+ ---------------
+ -- Chain_PPC --
+ ---------------
+
+ procedure Chain_PPC (PO : Node_Id) is
+ S : Node_Id;
+
+ begin
+ if not Nkind_In (PO, N_Subprogram_Declaration,
+ N_Generic_Subprogram_Declaration)
+ then
+ Pragma_Misplaced;
+ end if;
+
+ -- Here if we have subprogram or generic subprogram declaration
+
+ S := Defining_Unit_Name (Specification (PO));
+
+ -- Analyze the pragma unless it appears within a package spec,
+ -- which is the case where we delay the analysis of the PPC until
+ -- the end of the package declarations (for details, see
+ -- Analyze_Package_Specification.Analyze_PPCs).
+
+ if Ekind (Scope (S)) /= E_Package
+ and then
+ Ekind (Scope (S)) /= E_Generic_Package
+ then
+ Analyze_PPC_In_Decl_Part (N, S);
+ end if;
+
+ -- Chain spec PPC pragma to list for subprogram
+
+ Set_Next_Pragma (N, Spec_PPC_List (S));
+ Set_Spec_PPC_List (S, N);
+
+ -- Return indicating spec case
+
+ In_Body := False;
+ return;
+ end Chain_PPC;
+
+ -- Start of processing for Check_Precondition_Postcondition
+
begin
if not Is_List_Member (N) then
Pragma_Misplaced;
@@ -1362,12 +1412,31 @@ package body Sem_Prag is
Set_PPC_Enabled (N, Check_Enabled (Pname));
+ -- If we are within an inlined body, the legality of the pragma
+ -- has been checked already.
+
+ if In_Inlined_Body then
+ In_Body := True;
+ return;
+ end if;
+
-- Search prior declarations
P := N;
while Present (Prev (P)) loop
P := Prev (P);
- PO := Original_Node (P);
+
+ -- If the previous node is a generic subprogram, do not go to
+ -- to the original node, which is the unanalyzed tree: we need
+ -- to attach the pre/postconditions to the analyzed version
+ -- at this point. They get propagated to the original tree when
+ -- analyzing the corresponding body.
+
+ if Nkind (P) not in N_Generic_Declaration then
+ PO := Original_Node (P);
+ else
+ PO := P;
+ end if;
-- Skip past prior pragma
@@ -1379,37 +1448,11 @@ package body Sem_Prag is
elsif not Comes_From_Source (PO) then
null;
- -- Here if we hit a subprogram declaration
-
- elsif Nkind (PO) = N_Subprogram_Declaration then
- S := Defining_Unit_Name (Specification (PO));
-
- -- Analyze the pragma unless it appears within a package spec,
- -- which is the case where we delay the analysis of the PPC
- -- until the end of the package declarations (for details,
- -- see Analyze_Package_Specification.Analyze_PPCs).
-
- if Ekind (Scope (S)) /= E_Package
- and then
- Ekind (Scope (S)) /= E_Generic_Package
- then
- Analyze_PPC_In_Decl_Part (N, S);
- end if;
-
- -- Chain spec PPC pragma to list for subprogram
-
- Set_Next_Pragma (N, Spec_PPC_List (S));
- Set_Spec_PPC_List (S, N);
-
- -- Return indicating spec case
-
- In_Body := False;
- return;
-
- -- If we encounter any other declaration moving back, misplaced
+ -- Only remaining possibility is subprogram declaration
else
- Pragma_Misplaced;
+ Chain_PPC (PO);
+ return;
end if;
end loop;
@@ -1419,14 +1462,28 @@ package body Sem_Prag is
if Nkind (Parent (N)) = N_Subprogram_Body
and then List_Containing (N) = Declarations (Parent (N))
then
+ if Operating_Mode /= Generate_Code then
+
+ -- Analyze expression in pragma, for correctness
+ -- and for ASIS use.
+
+ Preanalyze_Spec_Expression
+ (Get_Pragma_Arg (Arg1), Standard_Boolean);
+ end if;
+
In_Body := True;
return;
- -- If not, it was misplaced
+ -- See if it is in the pragmas after a library level subprogram
- else
- Pragma_Misplaced;
+ elsif Nkind (Parent (N)) = N_Compilation_Unit_Aux then
+ Chain_PPC (Unit (Parent (Parent (N))));
+ return;
end if;
+
+ -- If we fall through, pragma was misplaced
+
+ Pragma_Misplaced;
end Check_Precondition_Postcondition;
-----------------------------
@@ -2185,7 +2242,6 @@ package body Sem_Prag is
Arg1x : constant Node_Id := Get_Pragma_Arg (Arg1);
begin
- GNAT_Pragma;
Check_Arg_Count (2);
Check_No_Identifiers;
Check_Arg_Is_Static_Expression (Arg2, Standard_String);
@@ -2441,7 +2497,8 @@ package body Sem_Prag is
end if;
E := Alias (E);
- elsif Nkind (Parent (E)) = N_Full_Type_Declaration
+ elsif Nkind_In (Parent (E), N_Full_Type_Declaration,
+ N_Private_Extension_Declaration)
and then Scope (E) = Scope (Alias (E))
then
E := Alias (E);
@@ -2570,7 +2627,7 @@ package body Sem_Prag is
and then Comp_Unit = Get_Source_Unit (E1)
and then not Is_Formal_Subprogram (E1)
and then Nkind (Original_Node (Parent (E1))) /=
- N_Full_Type_Declaration
+ N_Full_Type_Declaration
then
if Present (Alias (E1))
and then Scope (E1) /= Scope (Alias (E1))
@@ -2602,8 +2659,6 @@ package body Sem_Prag is
Code_Val : Uint;
begin
- GNAT_Pragma;
-
if not OpenVMS_On_Target then
Error_Pragma
("?pragma% ignored (applies only to Open'V'M'S)");
@@ -2661,8 +2716,6 @@ package body Sem_Prag is
(Arg_Internal : Node_Id := Empty)
is
begin
- GNAT_Pragma;
-
if No (Arg_Internal) then
Error_Pragma ("Internal parameter required for pragma%");
end if;
@@ -2914,9 +2967,8 @@ package body Sem_Prag is
-- Pragma cannot apply to subprogram body
if Is_Subprogram (Def_Id)
- and then
- Nkind (Parent
- (Declaration_Node (Def_Id))) = N_Subprogram_Body
+ and then Nkind (Parent (Declaration_Node (Def_Id))) =
+ N_Subprogram_Body
then
Error_Pragma
("pragma% requires separate spec"
@@ -3279,7 +3331,6 @@ package body Sem_Prag is
Exp : Node_Id;
begin
- GNAT_Pragma;
Check_No_Identifiers;
Check_At_Least_N_Arguments (1);
@@ -3454,10 +3505,8 @@ package body Sem_Prag is
if Present (Decl)
and then Nkind (Decl) = N_Subprogram_Declaration
and then Present (Corresponding_Body (Decl))
- and then
- Nkind
- (Unit_Declaration_Node
- (Corresponding_Body (Decl))) =
+ and then Nkind (Unit_Declaration_Node
+ (Corresponding_Body (Decl))) =
N_Subprogram_Renaming_Declaration
then
Error_Msg_Sloc := Sloc (Def_Id);
@@ -3716,6 +3765,22 @@ package body Sem_Prag is
and then Present (Corresponding_Body (Decl))
then
Set_Inline_Flags (Corresponding_Body (Decl));
+
+ elsif Is_Generic_Instance (Subp) then
+
+ -- Indicate that the body needs to be created for
+ -- inlining subsequent calls. The instantiation
+ -- node follows the declaration of the wrapper
+ -- package created for it.
+
+ if Scope (Subp) /= Standard_Standard
+ and then
+ Need_Subprogram_Instance_Body
+ (Next (Unit_Declaration_Node (Scope (Alias (Subp)))),
+ Subp)
+ then
+ null;
+ end if;
end if;
end if;
@@ -3834,17 +3899,23 @@ package body Sem_Prag is
Link_Nam : Node_Id;
String_Val : String_Id;
- procedure Check_Form_Of_Interface_Name (SN : Node_Id);
+ procedure Check_Form_Of_Interface_Name
+ (SN : Node_Id;
+ Ext_Name_Case : Boolean);
-- SN is a string literal node for an interface name. This routine
-- performs some minimal checks that the name is reasonable. In
-- particular that no spaces or other obviously incorrect characters
-- appear. This is only a warning, since any characters are allowed.
+ -- Ext_Name_Case is True for an External_Name, False for a Link_Name.
----------------------------------
-- Check_Form_Of_Interface_Name --
----------------------------------
- procedure Check_Form_Of_Interface_Name (SN : Node_Id) is
+ procedure Check_Form_Of_Interface_Name
+ (SN : Node_Id;
+ Ext_Name_Case : Boolean)
+ is
S : constant String_Id := Strval (Expr_Value_S (SN));
SL : constant Nat := String_Length (S);
C : Char_Code;
@@ -3857,15 +3928,28 @@ package body Sem_Prag is
for J in 1 .. SL loop
C := Get_String_Char (S, J);
- if Warn_On_Export_Import
- and then
- (not In_Character_Range (C)
- or else (Get_Character (C) = ' '
- and then VM_Target /= CLI_Target)
- or else Get_Character (C) = ',')
+ -- Look for dubious character and issue unconditional warning.
+ -- Definitely dubious if not in character range.
+
+ if not In_Character_Range (C)
+
+ -- For all cases except external names on CLI target,
+ -- commas, spaces and slashes are dubious (in CLI, we use
+ -- spaces and commas in external names to specify assembly
+ -- version and public key).
+
+ or else ((not Ext_Name_Case or else VM_Target /= CLI_Target)
+ and then (Get_Character (C) = ' '
+ or else
+ Get_Character (C) = ','
+ or else
+ Get_Character (C) = '/'
+ or else
+ Get_Character (C) = '\'))
then
- Error_Msg_N
- ("?interface name contains illegal character", SN);
+ Error_Msg
+ ("?interface name contains illegal character",
+ Sloc (SN) + Source_Ptr (J));
end if;
end loop;
end Check_Form_Of_Interface_Name;
@@ -3910,13 +3994,13 @@ package body Sem_Prag is
if Present (Ext_Nam) then
Check_Arg_Is_Static_Expression (Ext_Nam, Standard_String);
- Check_Form_Of_Interface_Name (Ext_Nam);
+ Check_Form_Of_Interface_Name (Ext_Nam, Ext_Name_Case => True);
- -- Verify that the external name is not the name of a local
- -- entity, which would hide the imported one and lead to
- -- run-time surprises. The problem can only arise for entities
- -- declared in a package body (otherwise the external name is
- -- fully qualified and won't conflict).
+ -- Verify that external name is not the name of a local entity,
+ -- which would hide the imported one and could lead to run-time
+ -- surprises. The problem can only arise for entities declared in
+ -- a package body (otherwise the external name is fully qualified
+ -- and will not conflict).
declare
Nam : Name_Id;
@@ -3939,10 +4023,10 @@ package body Sem_Prag is
Par := Parent (E);
while Present (Par) loop
if Nkind (Par) = N_Package_Body then
- Error_Msg_Sloc := Sloc (E);
+ Error_Msg_Sloc := Sloc (E);
Error_Msg_NE
("imported entity is hidden by & declared#",
- Ext_Arg, E);
+ Ext_Arg, E);
exit;
end if;
@@ -3955,7 +4039,7 @@ package body Sem_Prag is
if Present (Link_Nam) then
Check_Arg_Is_Static_Expression (Link_Nam, Standard_String);
- Check_Form_Of_Interface_Name (Link_Nam);
+ Check_Form_Of_Interface_Name (Link_Nam, Ext_Name_Case => False);
end if;
-- If there is no link name, just set the external name
@@ -4586,6 +4670,7 @@ package body Sem_Prag is
procedure Set_Mechanism_Value (Ent : Entity_Id; Mech_Name : Node_Id) is
Class : Node_Id;
Param : Node_Id;
+ Mech_Name_Id : Name_Id;
procedure Bad_Class;
-- Signal bad descriptor class name
@@ -4619,7 +4704,8 @@ package body Sem_Prag is
("mechanism for & has already been set", Mech_Name, Ent);
end if;
- -- MECHANISM_NAME ::= value | reference | descriptor
+ -- MECHANISM_NAME ::= value | reference | descriptor |
+ -- short_descriptor
if Nkind (Mech_Name) = N_Identifier then
if Chars (Mech_Name) = Name_Value then
@@ -4635,6 +4721,11 @@ package body Sem_Prag is
Set_Mechanism (Ent, By_Descriptor);
return;
+ elsif Chars (Mech_Name) = Name_Short_Descriptor then
+ Check_VMS (Mech_Name);
+ Set_Mechanism (Ent, By_Short_Descriptor);
+ return;
+
elsif Chars (Mech_Name) = Name_Copy then
Error_Pragma_Arg
("bad mechanism name, Value assumed", Mech_Name);
@@ -4643,22 +4734,28 @@ package body Sem_Prag is
Bad_Mechanism;
end if;
- -- MECHANISM_NAME ::= descriptor (CLASS_NAME)
+ -- MECHANISM_NAME ::= descriptor (CLASS_NAME) |
+ -- short_descriptor (CLASS_NAME)
-- CLASS_NAME ::= ubs | ubsb | uba | s | sb | a | nca
-- Note: this form is parsed as an indexed component
elsif Nkind (Mech_Name) = N_Indexed_Component then
+
Class := First (Expressions (Mech_Name));
if Nkind (Prefix (Mech_Name)) /= N_Identifier
- or else Chars (Prefix (Mech_Name)) /= Name_Descriptor
- or else Present (Next (Class))
+ or else not (Chars (Prefix (Mech_Name)) = Name_Descriptor or else
+ Chars (Prefix (Mech_Name)) = Name_Short_Descriptor)
+ or else Present (Next (Class))
then
Bad_Mechanism;
+ else
+ Mech_Name_Id := Chars (Prefix (Mech_Name));
end if;
- -- MECHANISM_NAME ::= descriptor (Class => CLASS_NAME)
+ -- MECHANISM_NAME ::= descriptor (Class => CLASS_NAME) |
+ -- short_descriptor (Class => CLASS_NAME)
-- CLASS_NAME ::= ubs | ubsb | uba | s | sb | a | nca
-- Note: this form is parsed as a function call
@@ -4668,7 +4765,8 @@ package body Sem_Prag is
Param := First (Parameter_Associations (Mech_Name));
if Nkind (Name (Mech_Name)) /= N_Identifier
- or else Chars (Name (Mech_Name)) /= Name_Descriptor
+ or else not (Chars (Name (Mech_Name)) = Name_Descriptor or else
+ Chars (Name (Mech_Name)) = Name_Short_Descriptor)
or else Present (Next (Param))
or else No (Selector_Name (Param))
or else Chars (Selector_Name (Param)) /= Name_Class
@@ -4676,6 +4774,7 @@ package body Sem_Prag is
Bad_Mechanism;
else
Class := Explicit_Actual_Parameter (Param);
+ Mech_Name_Id := Chars (Name (Mech_Name));
end if;
else
@@ -4689,27 +4788,76 @@ package body Sem_Prag is
if Nkind (Class) /= N_Identifier then
Bad_Class;
- elsif Chars (Class) = Name_UBS then
+ elsif Mech_Name_Id = Name_Descriptor
+ and then Chars (Class) = Name_UBS
+ then
Set_Mechanism (Ent, By_Descriptor_UBS);
- elsif Chars (Class) = Name_UBSB then
+ elsif Mech_Name_Id = Name_Descriptor
+ and then Chars (Class) = Name_UBSB
+ then
Set_Mechanism (Ent, By_Descriptor_UBSB);
- elsif Chars (Class) = Name_UBA then
+ elsif Mech_Name_Id = Name_Descriptor
+ and then Chars (Class) = Name_UBA
+ then
Set_Mechanism (Ent, By_Descriptor_UBA);
- elsif Chars (Class) = Name_S then
+ elsif Mech_Name_Id = Name_Descriptor
+ and then Chars (Class) = Name_S
+ then
Set_Mechanism (Ent, By_Descriptor_S);
- elsif Chars (Class) = Name_SB then
+ elsif Mech_Name_Id = Name_Descriptor
+ and then Chars (Class) = Name_SB
+ then
Set_Mechanism (Ent, By_Descriptor_SB);
- elsif Chars (Class) = Name_A then
+ elsif Mech_Name_Id = Name_Descriptor
+ and then Chars (Class) = Name_A
+ then
Set_Mechanism (Ent, By_Descriptor_A);
- elsif Chars (Class) = Name_NCA then
+ elsif Mech_Name_Id = Name_Descriptor
+ and then Chars (Class) = Name_NCA
+ then
Set_Mechanism (Ent, By_Descriptor_NCA);
+ elsif Mech_Name_Id = Name_Short_Descriptor
+ and then Chars (Class) = Name_UBS
+ then
+ Set_Mechanism (Ent, By_Short_Descriptor_UBS);
+
+ elsif Mech_Name_Id = Name_Short_Descriptor
+ and then Chars (Class) = Name_UBSB
+ then
+ Set_Mechanism (Ent, By_Short_Descriptor_UBSB);
+
+ elsif Mech_Name_Id = Name_Short_Descriptor
+ and then Chars (Class) = Name_UBA
+ then
+ Set_Mechanism (Ent, By_Short_Descriptor_UBA);
+
+ elsif Mech_Name_Id = Name_Short_Descriptor
+ and then Chars (Class) = Name_S
+ then
+ Set_Mechanism (Ent, By_Short_Descriptor_S);
+
+ elsif Mech_Name_Id = Name_Short_Descriptor
+ and then Chars (Class) = Name_SB
+ then
+ Set_Mechanism (Ent, By_Short_Descriptor_SB);
+
+ elsif Mech_Name_Id = Name_Short_Descriptor
+ and then Chars (Class) = Name_A
+ then
+ Set_Mechanism (Ent, By_Short_Descriptor_A);
+
+ elsif Mech_Name_Id = Name_Short_Descriptor
+ and then Chars (Class) = Name_NCA
+ then
+ Set_Mechanism (Ent, By_Short_Descriptor_NCA);
+
else
Bad_Class;
end if;
@@ -5667,11 +5815,11 @@ package body Sem_Prag is
-- pragma Comment (static_string_EXPRESSION)
- -- Processing for pragma Comment shares the circuitry for
- -- pragma Ident. The only differences are that Ident enforces
- -- a limit of 31 characters on its argument, and also enforces
- -- limitations on placement for DEC compatibility. Pragma
- -- Comment shares neither of these restrictions.
+ -- Processing for pragma Comment shares the circuitry for pragma
+ -- Ident. The only differences are that Ident enforces a limit of 31
+ -- characters on its argument, and also enforces limitations on
+ -- placement for DEC compatibility. Pragma Comment shares neither of
+ -- these restrictions.
-------------------
-- Common_Object --
@@ -5692,6 +5840,7 @@ package body Sem_Prag is
-- (boolean_EXPRESSION, static_string_EXPRESSION);
when Pragma_Compile_Time_Error =>
+ GNAT_Pragma;
Process_Compile_Time_Warning_Or_Error;
--------------------------
@@ -5702,6 +5851,7 @@ package body Sem_Prag is
-- (boolean_EXPRESSION, static_string_EXPRESSION);
when Pragma_Compile_Time_Warning =>
+ GNAT_Pragma;
Process_Compile_Time_Warning_Or_Error;
-------------------
@@ -6076,6 +6226,8 @@ package body Sem_Prag is
when Pragma_CPP_Virtual => CPP_Virtual : declare
begin
+ GNAT_Pragma;
+
if Warn_On_Obsolescent_Feature then
Error_Msg_N
("'G'N'A'T pragma cpp'_virtual is now obsolete and has " &
@@ -6089,6 +6241,8 @@ package body Sem_Prag is
when Pragma_CPP_Vtable => CPP_Vtable : declare
begin
+ GNAT_Pragma;
+
if Warn_On_Obsolescent_Feature then
Error_Msg_N
("'G'N'A'T pragma cpp'_vtable is now obsolete and has " &
@@ -6608,6 +6762,8 @@ package body Sem_Prag is
Code : Node_Id renames Args (4);
begin
+ GNAT_Pragma;
+
if Inside_A_Generic then
Error_Pragma ("pragma% cannot be used for generic entities");
end if;
@@ -7077,6 +7233,7 @@ package body Sem_Prag is
Typ : Entity_Id;
begin
+ GNAT_Pragma;
Check_No_Identifiers;
Check_Arg_Count (1);
Check_Arg_Is_Local_Name (Arg1);
@@ -7410,6 +7567,7 @@ package body Sem_Prag is
Code : Node_Id renames Args (4);
begin
+ GNAT_Pragma;
Gather_Associations (Names, Args);
if Present (External) and then Present (Code) then
@@ -7695,6 +7853,7 @@ package body Sem_Prag is
-- pragma Inline_Always ( NAME {, NAME} );
when Pragma_Inline_Always =>
+ GNAT_Pragma;
Process_Inline (True);
--------------------
@@ -7704,6 +7863,7 @@ package body Sem_Prag is
-- pragma Inline_Generic (NAME {, NAME});
when Pragma_Inline_Generic =>
+ GNAT_Pragma;
Process_Generic_List;
----------------------
@@ -8734,6 +8894,7 @@ package body Sem_Prag is
-- it was misplaced.
when Pragma_No_Body =>
+ GNAT_Pragma;
Pragma_Misplaced;
---------------
@@ -8800,13 +8961,43 @@ package body Sem_Prag is
end loop;
end No_Return;
+ -----------------
+ -- No_Run_Time --
+ -----------------
+
+ -- pragma No_Run_Time;
+
+ -- Note: this pragma is retained for backwards compatibility.
+ -- See body of Rtsfind for full details on its handling.
+
+ when Pragma_No_Run_Time =>
+ GNAT_Pragma;
+ Check_Valid_Configuration_Pragma;
+ Check_Arg_Count (0);
+
+ No_Run_Time_Mode := True;
+ Configurable_Run_Time_Mode := True;
+
+ -- Set Duration to 32 bits if word size is 32
+
+ if Ttypes.System_Word_Size = 32 then
+ Duration_32_Bits_On_Target := True;
+ end if;
+
+ -- Set appropriate restrictions
+
+ Set_Restriction (No_Finalization, N);
+ Set_Restriction (No_Exception_Handlers, N);
+ Set_Restriction (Max_Tasks, N, 0);
+ Set_Restriction (No_Tasking, N);
+
------------------------
-- No_Strict_Aliasing --
------------------------
-- pragma No_Strict_Aliasing [([Entity =>] type_LOCAL_NAME)];
- when Pragma_No_Strict_Aliasing => No_Strict_Alias : declare
+ when Pragma_No_Strict_Aliasing => No_Strict_Aliasing : declare
E_Id : Entity_Id;
begin
@@ -8830,7 +9021,20 @@ package body Sem_Prag is
Set_No_Strict_Aliasing (Implementation_Base_Type (E_Id));
end if;
- end No_Strict_Alias;
+ end No_Strict_Aliasing;
+
+ -----------------------
+ -- Normalize_Scalars --
+ -----------------------
+
+ -- pragma Normalize_Scalars;
+
+ when Pragma_Normalize_Scalars =>
+ Check_Ada_83_Warning;
+ Check_Arg_Count (0);
+ Check_Valid_Configuration_Pragma;
+ Normalize_Scalars := True;
+ Init_Or_Norm_Scalars := True;
-----------------
-- Obsolescent --
@@ -9038,49 +9242,6 @@ package body Sem_Prag is
end if;
end Obsolescent;
- -----------------
- -- No_Run_Time --
- -----------------
-
- -- pragma No_Run_Time
-
- -- Note: this pragma is retained for backwards compatibility.
- -- See body of Rtsfind for full details on its handling.
-
- when Pragma_No_Run_Time =>
- GNAT_Pragma;
- Check_Valid_Configuration_Pragma;
- Check_Arg_Count (0);
-
- No_Run_Time_Mode := True;
- Configurable_Run_Time_Mode := True;
-
- -- Set Duration to 32 bits if word size is 32
-
- if Ttypes.System_Word_Size = 32 then
- Duration_32_Bits_On_Target := True;
- end if;
-
- -- Set appropriate restrictions
-
- Set_Restriction (No_Finalization, N);
- Set_Restriction (No_Exception_Handlers, N);
- Set_Restriction (Max_Tasks, N, 0);
- Set_Restriction (No_Tasking, N);
-
- -----------------------
- -- Normalize_Scalars --
- -----------------------
-
- -- pragma Normalize_Scalars;
-
- when Pragma_Normalize_Scalars =>
- Check_Ada_83_Warning;
- Check_Arg_Count (0);
- Check_Valid_Configuration_Pragma;
- Normalize_Scalars := True;
- Init_Or_Norm_Scalars := True;
-
--------------
-- Optimize --
--------------
@@ -9317,19 +9478,6 @@ package body Sem_Prag is
end if;
end Preelab_Init;
- -------------
- -- Polling --
- -------------
-
- -- pragma Polling (ON | OFF);
-
- when Pragma_Polling =>
- GNAT_Pragma;
- Check_Arg_Count (1);
- Check_No_Identifiers;
- Check_Arg_Is_One_Of (Arg1, Name_On, Name_Off);
- Polling_Required := (Chars (Expression (Arg1)) = Name_On);
-
--------------------
-- Persistent_BSS --
--------------------
@@ -9388,6 +9536,19 @@ package body Sem_Prag is
end if;
end Persistent_BSS;
+ -------------
+ -- Polling --
+ -------------
+
+ -- pragma Polling (ON | OFF);
+
+ when Pragma_Polling =>
+ GNAT_Pragma;
+ Check_Arg_Count (1);
+ Check_No_Identifiers;
+ Check_Arg_Is_One_Of (Arg1, Name_On, Name_Off);
+ Polling_Required := (Chars (Expression (Arg1)) = Name_On);
+
-------------------
-- Postcondition --
-------------------
@@ -10904,6 +11065,7 @@ package body Sem_Prag is
-- or the identifier GCC, no other identifiers are acceptable.
when Pragma_System_Name =>
+ GNAT_Pragma;
Check_No_Identifiers;
Check_Arg_Count (1);
Check_Arg_Is_One_Of (Arg1, Name_Gcc, Name_Gnat);
@@ -11152,7 +11314,7 @@ package body Sem_Prag is
Variant : Node_Id;
begin
- GNAT_Pragma;
+ Ada_2005_Pragma;
Check_No_Identifiers;
Check_Arg_Count (1);
Check_Arg_Is_Local_Name (Arg1);
@@ -11519,7 +11681,7 @@ package body Sem_Prag is
-- pragma Unsuppress (IDENTIFIER [, [On =>] NAME]);
when Pragma_Unsuppress =>
- GNAT_Pragma;
+ Ada_2005_Pragma;
Process_Suppress_Unsuppress (False);
-------------------
@@ -11843,6 +12005,7 @@ package body Sem_Prag is
-- pragma Wide_Character_Encoding (IDENTIFIER);
when Pragma_Wide_Character_Encoding =>
+ GNAT_Pragma;
-- Nothing to do, handled in parser. Note that we do not enforce
-- configuration pragma placement, this pragma can appear at any
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index a6d42f73637..21369ae725e 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -446,16 +446,18 @@ package body Sem_Res is
return;
end if;
- -- Detect a common beginner error:
+ -- Detect a common error:
-- type R (D : Positive := 100) is record
-- Name : String (1 .. D);
-- end record;
- -- The default value causes an object of type R to be
- -- allocated with room for Positive'Last characters.
+ -- The default value causes an object of type R to be allocated
+ -- with room for Positive'Last characters. The RM does not mandate
+ -- the allocation of the maximum size, but that is what GNAT does
+ -- so we should warn the programmer that there is a problem.
- declare
+ Check_Large : declare
SI : Node_Id;
T : Entity_Id;
TB : Node_Id;
@@ -480,9 +482,11 @@ package body Sem_Res is
and then Compile_Time_Known_Value (Type_High_Bound (T))
and then
Minimum_Size (T, Biased => True) >=
- Esize (Standard_Integer) - 1;
+ RM_Size (Standard_Positive);
end Large_Storage_Type;
+ -- Start of processing for Check_Large
+
begin
-- Check that the Disc has a large range
@@ -553,7 +557,7 @@ package body Sem_Res is
<<No_Danger>>
null;
- end;
+ end Check_Large;
end if;
-- Legal case is in index or discriminant constraint
@@ -754,7 +758,22 @@ package body Sem_Res is
C := N;
loop
P := Parent (C);
+
+ -- If no parent, then we were not inside a subprogram, this can for
+ -- example happen when processing certain pragmas in a spec. Just
+ -- return False in this case.
+
+ if No (P) then
+ return False;
+ end if;
+
+ -- Done if we get to subprogram body, this is definitely an infinite
+ -- recursion case if we did not find anything to stop us.
+
exit when Nkind (P) = N_Subprogram_Body;
+
+ -- If appearing in conditional, result is false
+
if Nkind_In (P, N_Or_Else,
N_And_Then,
N_If_Statement,
@@ -3218,16 +3237,48 @@ package body Sem_Res is
-- or because it is a generic actual, so use base type to
-- locate concurrent type.
- if Is_Concurrent_Type (Etype (A))
- and then Etype (F) =
- Corresponding_Record_Type (Base_Type (Etype (A)))
- then
- Rewrite (A,
- Unchecked_Convert_To
- (Corresponding_Record_Type (Etype (A)), A));
- end if;
+ A_Typ := Base_Type (Etype (A));
+ F_Typ := Base_Type (Etype (F));
+
+ declare
+ Full_A_Typ : Entity_Id;
- Resolve (A, Etype (F));
+ begin
+ if Present (Full_View (A_Typ)) then
+ Full_A_Typ := Base_Type (Full_View (A_Typ));
+ else
+ Full_A_Typ := A_Typ;
+ end if;
+
+ -- Tagged synchronized type (case 1): the actual is a
+ -- concurrent type
+
+ if Is_Concurrent_Type (A_Typ)
+ and then Corresponding_Record_Type (A_Typ) = F_Typ
+ then
+ Rewrite (A,
+ Unchecked_Convert_To
+ (Corresponding_Record_Type (A_Typ), A));
+ Resolve (A, Etype (F));
+
+ -- Tagged synchronized type (case 2): the formal is a
+ -- concurrent type
+
+ elsif Ekind (Full_A_Typ) = E_Record_Type
+ and then Present
+ (Corresponding_Concurrent_Type (Full_A_Typ))
+ and then Is_Concurrent_Type (F_Typ)
+ and then Present (Corresponding_Record_Type (F_Typ))
+ and then Full_A_Typ = Corresponding_Record_Type (F_Typ)
+ then
+ Resolve (A, Corresponding_Record_Type (F_Typ));
+
+ -- Common case
+
+ else
+ Resolve (A, Etype (F));
+ end if;
+ end;
end if;
A_Typ := Etype (A);
@@ -4645,6 +4696,26 @@ package body Sem_Res is
end loop;
end if;
+ if Is_Access_Subprogram_Type (Base_Type (Etype (Nam)))
+ and then not Is_Access_Subprogram_Type (Base_Type (Typ))
+ and then Nkind (Subp) /= N_Explicit_Dereference
+ and then Present (Parameter_Associations (N))
+ then
+ -- The prefix is a parameterless function call that returns an access
+ -- to subprogram. If parameters are present in the current call, add
+ -- add an explicit dereference. We use the base type here because
+ -- within an instance these may be subtypes.
+
+ -- The dereference is added either in Analyze_Call or here. Should
+ -- be consolidated ???
+
+ Set_Is_Overloaded (Subp, False);
+ Set_Etype (Subp, Etype (Nam));
+ Insert_Explicit_Dereference (Subp);
+ Nam := Designated_Type (Etype (Nam));
+ Resolve (Subp, Nam);
+ end if;
+
-- Check that a call to Current_Task does not occur in an entry body
if Is_RTE (Nam, RE_Current_Task) then
@@ -4698,8 +4769,8 @@ package body Sem_Res is
Error_Msg_N ("entry call required in select statement", N);
-- Ada 2005 (AI-345): If a procedure_call_statement is used
- -- for a procedure_or_entry_call, the procedure_name or pro-
- -- cedure_prefix of the procedure_call_statement shall denote
+ -- for a procedure_or_entry_call, the procedure_name or
+ -- procedure_prefix of the procedure_call_statement shall denote
-- an entry renamed by a procedure, or (a view of) a primitive
-- subprogram of a limited interface whose first parameter is
-- a controlling parameter.
@@ -4713,8 +4784,8 @@ package body Sem_Res is
end if;
end if;
- -- Check that this is not a call to a protected procedure or
- -- entry from within a protected function.
+ -- Check that this is not a call to a protected procedure or entry from
+ -- within a protected function.
if Ekind (Current_Scope) = E_Function
and then Ekind (Scope (Current_Scope)) = E_Protected_Type
@@ -5151,12 +5222,16 @@ package body Sem_Res is
end if;
-- Check for violation of restriction No_Specific_Termination_Handlers
+ -- and warn on a potentially blocking call to Abort_Task.
if Is_RTE (Nam, RE_Set_Specific_Handler)
or else
Is_RTE (Nam, RE_Specific_Handler)
then
Check_Restriction (No_Specific_Termination_Handlers, N);
+
+ elsif Is_RTE (Nam, RE_Abort_Task) then
+ Check_Potentially_Blocking_Operation (N);
end if;
-- All done, evaluate call and deal with elaboration issues
@@ -6506,8 +6581,8 @@ package body Sem_Res is
procedure Resolve_Membership_Op (N : Node_Id; Typ : Entity_Id) is
pragma Warnings (Off, Typ);
- L : constant Node_Id := Left_Opnd (N);
- R : constant Node_Id := Right_Opnd (N);
+ L : constant Node_Id := Left_Opnd (N);
+ R : constant Node_Id := Right_Opnd (N);
T : Entity_Id;
begin
@@ -6572,6 +6647,8 @@ package body Sem_Res is
------------------
procedure Resolve_Null (N : Node_Id; Typ : Entity_Id) is
+ Loc : constant Source_Ptr := Sloc (N);
+
begin
-- Handle restriction against anonymous null access values This
-- restriction can be turned off using -gnatdj.
@@ -6600,6 +6677,26 @@ package body Sem_Res is
end if;
end if;
+ -- Ada 2005 (AI-231): Generate the null-excluding check in case of
+ -- assignment to a null-excluding object
+
+ if Ada_Version >= Ada_05
+ and then Can_Never_Be_Null (Typ)
+ and then Nkind (Parent (N)) = N_Assignment_Statement
+ then
+ if not Inside_Init_Proc then
+ Insert_Action
+ (Compile_Time_Constraint_Error (N,
+ "(Ada 2005) null not allowed in null-excluding objects?"),
+ Make_Raise_Constraint_Error (Loc,
+ Reason => CE_Access_Check_Failed));
+ else
+ Insert_Action (N,
+ Make_Raise_Constraint_Error (Loc,
+ Reason => CE_Access_Check_Failed));
+ end if;
+ end if;
+
-- In a distributed context, null for a remote access to subprogram
-- may need to be replaced with a special record aggregate. In this
-- case, return after having done the transformation.
@@ -9427,7 +9524,27 @@ package body Sem_Res is
(not Is_Constrained (Opnd)
or else not Is_Constrained (Target)))
then
- return True;
+ -- Special case, if Value_Size has been used to make the
+ -- sizes different, the conversion is not allowed even
+ -- though the subtypes statically match.
+
+ if Known_Static_RM_Size (Target)
+ and then Known_Static_RM_Size (Opnd)
+ and then RM_Size (Target) /= RM_Size (Opnd)
+ then
+ Error_Msg_NE
+ ("target designated subtype not compatible with }",
+ N, Opnd);
+ Error_Msg_NE
+ ("\because sizes of the two designated subtypes differ",
+ N, Opnd);
+ return False;
+
+ -- Normal case where conversion is allowed
+
+ else
+ return True;
+ end if;
else
Error_Msg_NE
@@ -9440,16 +9557,21 @@ package body Sem_Res is
-- Access to subprogram types. If the operand is an access parameter,
-- the type has a deeper accessibility that any master, and cannot
- -- be assigned.
+ -- be assigned. We must make an exception if the conversion is part
+ -- of an assignment and the target is the return object of an extended
+ -- return statement, because in that case the accessibility check
+ -- takes place after the return.
- elsif (Ekind (Target_Type) = E_Access_Subprogram_Type
- or else
- Ekind (Target_Type) = E_Anonymous_Access_Subprogram_Type)
+ elsif Is_Access_Subprogram_Type (Target_Type)
and then No (Corresponding_Remote_Type (Opnd_Type))
then
if Ekind (Base_Type (Opnd_Type)) = E_Anonymous_Access_Subprogram_Type
and then Is_Entity_Name (Operand)
and then Ekind (Entity (Operand)) = E_In_Parameter
+ and then
+ (Nkind (Parent (N)) /= N_Assignment_Statement
+ or else not Is_Entity_Name (Name (Parent (N)))
+ or else not Is_Return_Object (Entity (Name (Parent (N)))))
then
Error_Msg_N
("illegal attempt to store anonymous access to subprogram",
diff --git a/gcc/ada/sem_type.adb b/gcc/ada/sem_type.adb
index 4a170d82ce3..3ca2e535478 100644
--- a/gcc/ada/sem_type.adb
+++ b/gcc/ada/sem_type.adb
@@ -766,7 +766,7 @@ package body Sem_Type is
if T1 = T2 then
return True;
- elsif BT1 = BT2
+ elsif BT1 = BT2
or else BT1 = T2
or else BT2 = T1
then
@@ -2101,16 +2101,23 @@ package body Sem_Type is
return
Covers (Typ, Etype (N))
- -- Ada 2005 (AI-345) The context may be a synchronized interface.
+ -- Ada 2005 (AI-345): The context may be a synchronized interface.
-- If the type is already frozen use the corresponding_record
-- to check whether it is a proper descendant.
or else
- (Is_Concurrent_Type (Etype (N))
+ (Is_Record_Type (Typ)
+ and then Is_Concurrent_Type (Etype (N))
and then Present (Corresponding_Record_Type (Etype (N)))
and then Covers (Typ, Corresponding_Record_Type (Etype (N))))
or else
+ (Is_Concurrent_Type (Typ)
+ and then Is_Record_Type (Etype (N))
+ and then Present (Corresponding_Record_Type (Typ))
+ and then Covers (Corresponding_Record_Type (Typ), Etype (N)))
+
+ or else
(not Is_Tagged_Type (Typ)
and then Ekind (Typ) /= E_Anonymous_Access_Type
and then Covers (Etype (N), Typ));
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index e8823b6164f..e1d042c92c2 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -1447,7 +1447,7 @@ package body Sem_Util is
-- Start of processing for Collect_Interfaces_Info
begin
- Collect_Interfaces (T, Ifaces_List);
+ Collect_Interfaces (T, Ifaces_List);
Collect_Interface_Components (T, Comps_List);
-- Search for the record component and tag associated with each
@@ -6372,6 +6372,42 @@ package body Sem_Util is
end if;
end Is_Potentially_Persistent_Type;
+ ---------------------------------
+ -- Is_Protected_Self_Reference --
+ ---------------------------------
+
+ function Is_Protected_Self_Reference (N : Node_Id) return Boolean
+ is
+ function In_Access_Definition (N : Node_Id) return Boolean;
+ -- Returns true if N belongs to an access definition
+
+ --------------------------
+ -- In_Access_Definition --
+ --------------------------
+
+ function In_Access_Definition (N : Node_Id) return Boolean
+ is
+ P : Node_Id := Parent (N);
+ begin
+ while Present (P) loop
+ if Nkind (P) = N_Access_Definition then
+ return True;
+ end if;
+ P := Parent (P);
+ end loop;
+ return False;
+ end In_Access_Definition;
+
+ -- Start of processing for Is_Protected_Self_Reference
+
+ begin
+ return Ada_Version >= Ada_05
+ and then Is_Entity_Name (N)
+ and then Is_Protected_Type (Entity (N))
+ and then In_Open_Scopes (Entity (N))
+ and then not In_Access_Definition (N);
+ end Is_Protected_Self_Reference;
+
-----------------------------
-- Is_RCI_Pkg_Spec_Or_Body --
-----------------------------
diff --git a/gcc/ada/sem_util.ads b/gcc/ada/sem_util.ads
index 64d5cfb674b..a8f7fc8dc33 100644
--- a/gcc/ada/sem_util.ads
+++ b/gcc/ada/sem_util.ads
@@ -246,7 +246,7 @@ package Sem_Util is
-- families constrained by discriminants.
function Denotes_Variable (N : Node_Id) return Boolean;
- -- Returns True if node N denotes a single variable without parentheses.
+ -- Returns True if node N denotes a single variable without parentheses
function Depends_On_Discriminant (N : Node_Id) return Boolean;
-- Returns True if N denotes a discriminant or if N is a range, a subtype
@@ -726,6 +726,10 @@ package Sem_Util is
-- persistent. A private type is potentially persistent if the full type
-- is potentially persistent.
+ function Is_Protected_Self_Reference (N : Node_Id) return Boolean;
+ -- Return True if node N denotes a protected type name which represents
+ -- the current instance of a protected object according to RM 9.4(21/2).
+
function Is_RCI_Pkg_Spec_Or_Body (Cunit : Node_Id) return Boolean;
-- Return True if a compilation unit is the specification or the
-- body of a remote call interface package.
diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb
index 5fe97432e05..c22d0ce475a 100644
--- a/gcc/ada/sem_warn.adb
+++ b/gcc/ada/sem_warn.adb
@@ -2817,6 +2817,12 @@ package body Sem_Warn is
when 'A' =>
Warn_On_Assertion_Failure := False;
+ when 'b' =>
+ Warn_On_Biased_Representation := True;
+
+ when 'B' =>
+ Warn_On_Biased_Representation := False;
+
when 'c' =>
Warn_On_Unrepped_Components := True;
@@ -2837,12 +2843,12 @@ package body Sem_Warn is
Warn_On_Assertion_Failure := True;
Warn_On_Assumed_Low_Bound := True;
Warn_On_Bad_Fixed_Value := True;
+ Warn_On_Biased_Representation := True;
Warn_On_Constant := True;
Warn_On_Deleted_Code := True;
Warn_On_Dereference := True;
Warn_On_Export_Import := True;
Warn_On_Hiding := True;
- Ineffective_Inline_Warnings := True;
Warn_On_Modified_Unread := True;
Warn_On_No_Value_Assigned := True;
Warn_On_Non_Local_Exception := True;
@@ -2910,6 +2916,7 @@ package body Sem_Warn is
Warn_On_Assertion_Failure := True;
Warn_On_Assumed_Low_Bound := True;
Warn_On_Bad_Fixed_Value := True;
+ Warn_On_Biased_Representation := True;
Warn_On_Constant := True;
Warn_On_Export_Import := True;
Warn_On_Modified_Unread := True;
@@ -2936,6 +2943,7 @@ package body Sem_Warn is
Warn_On_Assertion_Failure := False;
Warn_On_Assumed_Low_Bound := False;
Warn_On_Bad_Fixed_Value := False;
+ Warn_On_Biased_Representation := False;
Warn_On_Constant := False;
Warn_On_Deleted_Code := False;
Warn_On_Dereference := False;
diff --git a/gcc/ada/sequenio.ads b/gcc/ada/sequenio.ads
index 7fdf72d782f..42522fb9072 100644
--- a/gcc/ada/sequenio.ads
+++ b/gcc/ada/sequenio.ads
@@ -15,9 +15,9 @@
pragma Ada_2005;
-- Explicit setting of Ada 2005 mode is required here, since we want to with a
--- child unit (not possible in Ada 83 mode), and Text_IO is not considered to
--- be an internal unit that is automatically compiled in Ada 2005 mode (since
--- a user is allowed to redeclare Sequential_IO).
+-- child unit (not possible in Ada 83 mode), and Sequential_IO is not
+-- considered to be an internal unit that is automatically compiled in Ada
+-- 2005 mode (since a user is allowed to redeclare Sequential_IO).
with Ada.Sequential_IO;
diff --git a/gcc/ada/sinput-l.adb b/gcc/ada/sinput-l.adb
index eee61f664e0..8bb6778fbd7 100644
--- a/gcc/ada/sinput-l.adb
+++ b/gcc/ada/sinput-l.adb
@@ -28,6 +28,8 @@ with Atree; use Atree;
with Debug; use Debug;
with Einfo; use Einfo;
with Errout; use Errout;
+with Fname; use Fname;
+with Hostparm;
with Opt; use Opt;
with Osint; use Osint;
with Output; use Output;
@@ -39,6 +41,8 @@ with Sinfo; use Sinfo;
with Snames; use Snames;
with System; use System;
+with System.OS_Lib; use System.OS_Lib;
+
with Unchecked_Conversion;
package body Sinput.L is
@@ -319,7 +323,7 @@ package body Sinput.L is
-- source will be the last created, and we will be able to replace it
-- and modify Hi without stepping on another buffer.
- if T = Osint.Source then
+ if T = Osint.Source and then not Is_Internal_File_Name (N) then
Prepare_To_Preprocess
(Source => N, Preprocessing_Needed => Preprocessing_Needed);
end if;
@@ -475,6 +479,8 @@ package body Sinput.L is
-- Saved state of the Style_Check flag (which needs to be
-- temporarily set to False during preprocessing, see below).
+ Modified : Boolean;
+
begin
-- If this is the first time we preprocess a source, allocate
-- the preprocessing buffer.
@@ -512,7 +518,7 @@ package body Sinput.L is
Save_Style_Check := Opt.Style_Check;
Opt.Style_Check := False;
- Preprocess;
+ Preprocess (Modified);
-- Reset the scanner to its standard behavior, and restore the
-- Style_Checks flag.
@@ -531,6 +537,54 @@ package body Sinput.L is
return No_Source_File;
else
+ -- Output the result of the preprocessing, if requested and
+ -- the source has been modified by the preprocessing.
+
+ if Generate_Processed_File and then Modified then
+ declare
+ FD : File_Descriptor;
+ NB : Integer;
+ Status : Boolean;
+
+ begin
+ Get_Name_String (N);
+
+ if Hostparm.OpenVMS then
+ Add_Str_To_Name_Buffer ("_prep");
+ else
+ Add_Str_To_Name_Buffer (".prep");
+ end if;
+
+ Delete_File (Name_Buffer (1 .. Name_Len), Status);
+
+ FD :=
+ Create_New_File (Name_Buffer (1 .. Name_Len), Text);
+
+ Status := FD /= Invalid_FD;
+
+ if Status then
+ NB :=
+ Write
+ (FD,
+ Prep_Buffer (1)'Address,
+ Integer (Prep_Buffer_Last));
+ Status := NB = Integer (Prep_Buffer_Last);
+ end if;
+
+ if Status then
+ Close (FD, Status);
+ end if;
+
+ if not Status then
+ Errout.Error_Msg
+ ("could not write processed file """ &
+ Name_Buffer (1 .. Name_Len) & '"',
+ Lo);
+ return No_Source_File;
+ end if;
+ end;
+ end if;
+
-- Set the new value of Hi
Hi := Lo + Source_Ptr (Prep_Buffer_Last);
diff --git a/gcc/ada/sinput.adb b/gcc/ada/sinput.adb
index 957dfae2625..3936b5b311f 100644
--- a/gcc/ada/sinput.adb
+++ b/gcc/ada/sinput.adb
@@ -649,7 +649,7 @@ package body Sinput is
Chr : constant Character := Source (P);
begin
- if Chr = CR then
+ if Chr = CR then
if Source (P + 1) = LF then
P := P + 2;
else
@@ -657,7 +657,7 @@ package body Sinput is
end if;
elsif Chr = LF then
- if Source (P) = CR then
+ if Source (P + 1) = CR then
P := P + 2;
else
P := P + 1;
diff --git a/gcc/ada/sinput.ads b/gcc/ada/sinput.ads
index 6d3144092cf..82d03e75d23 100644
--- a/gcc/ada/sinput.ads
+++ b/gcc/ada/sinput.ads
@@ -565,12 +565,12 @@ package Sinput is
procedure Skip_Line_Terminators
(P : in out Source_Ptr;
Physical : out Boolean);
- -- On entry, P points to a line terminator that has been encountered,
- -- which is one of FF,LF,VT,CR or a wide character sequence whose value is
- -- in category Separator,Line or Separator,Paragraph. The purpose of this
- -- P points just past the character that was scanned. The purpose of this
- -- routine is to distinguish physical and logical line endings. A physical
- -- line ending is one of:
+ -- On entry, P points to a line terminator that has been encountered, which
+ -- is one of FF,LF,VT,CR or a wide character sequence whose value is in
+ -- category Separator,Line or Separator,Paragraph. P points just past the
+ -- character that was scanned. The purpose of this routine is to
+ -- distinguish physical and logical line endings. A physical line ending is
+ -- one of:
--
-- CR on its own (MAC System 7)
-- LF on its own (Unix and unix-like systems)
diff --git a/gcc/ada/snames.adb b/gcc/ada/snames.adb
index 7d4cdddc479..d038e4372a4 100644
--- a/gcc/ada/snames.adb
+++ b/gcc/ada/snames.adb
@@ -104,9 +104,6 @@ package body Snames is
"finalize#" &
"next#" &
"prev#" &
- "_typecode#" &
- "_from_any#" &
- "_to_any#" &
"allocate#" &
"deallocate#" &
"dereference#" &
@@ -414,6 +411,7 @@ package body Snames is
"secondary_stack_size#" &
"section#" &
"semaphore#" &
+ "short_descriptor#" &
"simple_barriers#" &
"spec_file_name#" &
"state#" &
@@ -556,6 +554,7 @@ package body Snames is
"copy_sign#" &
"floor#" &
"fraction#" &
+ "from_any#" &
"image#" &
"input#" &
"machine#" &
@@ -566,7 +565,9 @@ package body Snames is
"remainder#" &
"rounding#" &
"succ#" &
+ "to_any#" &
"truncation#" &
+ "typecode#" &
"value#" &
"wide_image#" &
"wide_wide_image#" &
@@ -726,6 +727,7 @@ package body Snames is
"extends#" &
"externally_built#" &
"finder#" &
+ "global_compilation_switches#" &
"global_configuration_pragmas#" &
"global_config_file#" &
"gnatls#" &
@@ -778,6 +780,7 @@ package body Snames is
"objects_path#" &
"objects_path_file#" &
"object_dir#" &
+ "path_syntax#" &
"pic_option#" &
"pretty_printer#" &
"prefix#" &
diff --git a/gcc/ada/snames.ads b/gcc/ada/snames.ads
index c2001e68aa4..8037ee18934 100644
--- a/gcc/ada/snames.ads
+++ b/gcc/ada/snames.ads
@@ -40,7 +40,7 @@ package Snames is
-- the definitions of some enumeration types whose definitions are tied to
-- the order of these preset names.
--- WARNING: There is a C file, a-snames.h which duplicates some of the
+-- WARNING: There is a C file, snames.h which duplicates some of the
-- definitions in this file and must be kept properly synchronized.
-- If you change this package, you should run xsnames.
@@ -199,116 +199,110 @@ package Snames is
Name_Next : constant Name_Id := N + 044;
Name_Prev : constant Name_Id := N + 045;
- -- Names of TSS routines for implementation of DSA over PolyORB
-
- Name_uTypeCode : constant Name_Id := N + 046;
- Name_uFrom_Any : constant Name_Id := N + 047;
- Name_uTo_Any : constant Name_Id := N + 048;
-
-- Names of allocation routines, also needed by expander
- Name_Allocate : constant Name_Id := N + 049;
- Name_Deallocate : constant Name_Id := N + 050;
- Name_Dereference : constant Name_Id := N + 051;
+ Name_Allocate : constant Name_Id := N + 046;
+ Name_Deallocate : constant Name_Id := N + 047;
+ Name_Dereference : constant Name_Id := N + 048;
-- Names of Text_IO generic subpackages (see Rtsfind.Text_IO_Kludge)
- First_Text_IO_Package : constant Name_Id := N + 052;
- Name_Decimal_IO : constant Name_Id := N + 052;
- Name_Enumeration_IO : constant Name_Id := N + 053;
- Name_Fixed_IO : constant Name_Id := N + 054;
- Name_Float_IO : constant Name_Id := N + 055;
- Name_Integer_IO : constant Name_Id := N + 056;
- Name_Modular_IO : constant Name_Id := N + 057;
- Last_Text_IO_Package : constant Name_Id := N + 057;
+ First_Text_IO_Package : constant Name_Id := N + 049;
+ Name_Decimal_IO : constant Name_Id := N + 049;
+ Name_Enumeration_IO : constant Name_Id := N + 050;
+ Name_Fixed_IO : constant Name_Id := N + 051;
+ Name_Float_IO : constant Name_Id := N + 052;
+ Name_Integer_IO : constant Name_Id := N + 053;
+ Name_Modular_IO : constant Name_Id := N + 054;
+ Last_Text_IO_Package : constant Name_Id := N + 054;
subtype Text_IO_Package_Name is Name_Id
range First_Text_IO_Package .. Last_Text_IO_Package;
-- Some miscellaneous names used for error detection/recovery
- Name_Const : constant Name_Id := N + 058;
- Name_Error : constant Name_Id := N + 059;
- Name_Go : constant Name_Id := N + 060;
- Name_Put : constant Name_Id := N + 061;
- Name_Put_Line : constant Name_Id := N + 062;
- Name_To : constant Name_Id := N + 063;
+ Name_Const : constant Name_Id := N + 055;
+ Name_Error : constant Name_Id := N + 056;
+ Name_Go : constant Name_Id := N + 057;
+ Name_Put : constant Name_Id := N + 058;
+ Name_Put_Line : constant Name_Id := N + 059;
+ Name_To : constant Name_Id := N + 060;
-- Names for packages that are treated specially by the compiler
- Name_Exception_Traces : constant Name_Id := N + 064;
- Name_Finalization : constant Name_Id := N + 065;
- Name_Finalization_Root : constant Name_Id := N + 066;
- Name_Interfaces : constant Name_Id := N + 067;
- Name_Most_Recent_Exception : constant Name_Id := N + 068;
- Name_Standard : constant Name_Id := N + 069;
- Name_System : constant Name_Id := N + 070;
- Name_Text_IO : constant Name_Id := N + 071;
- Name_Wide_Text_IO : constant Name_Id := N + 072;
- Name_Wide_Wide_Text_IO : constant Name_Id := N + 073;
+ Name_Exception_Traces : constant Name_Id := N + 061;
+ Name_Finalization : constant Name_Id := N + 062;
+ Name_Finalization_Root : constant Name_Id := N + 063;
+ Name_Interfaces : constant Name_Id := N + 064;
+ Name_Most_Recent_Exception : constant Name_Id := N + 065;
+ Name_Standard : constant Name_Id := N + 066;
+ Name_System : constant Name_Id := N + 067;
+ Name_Text_IO : constant Name_Id := N + 068;
+ Name_Wide_Text_IO : constant Name_Id := N + 069;
+ Name_Wide_Wide_Text_IO : constant Name_Id := N + 070;
-- Names of implementations of the distributed systems annex
- First_PCS_Name : constant Name_Id := N + 074;
- Name_No_DSA : constant Name_Id := N + 074;
- Name_GARLIC_DSA : constant Name_Id := N + 075;
- Name_PolyORB_DSA : constant Name_Id := N + 076;
- Last_PCS_Name : constant Name_Id := N + 076;
+ First_PCS_Name : constant Name_Id := N + 071;
+ Name_No_DSA : constant Name_Id := N + 071;
+ Name_GARLIC_DSA : constant Name_Id := N + 072;
+ Name_PolyORB_DSA : constant Name_Id := N + 073;
+ Last_PCS_Name : constant Name_Id := N + 073;
subtype PCS_Names is Name_Id
range First_PCS_Name .. Last_PCS_Name;
-- Names of identifiers used in expanding distribution stubs
- Name_Addr : constant Name_Id := N + 077;
- Name_Async : constant Name_Id := N + 078;
- Name_Get_Active_Partition_ID : constant Name_Id := N + 079;
- Name_Get_RCI_Package_Receiver : constant Name_Id := N + 080;
- Name_Get_RCI_Package_Ref : constant Name_Id := N + 081;
- Name_Origin : constant Name_Id := N + 082;
- Name_Params : constant Name_Id := N + 083;
- Name_Partition : constant Name_Id := N + 084;
- Name_Partition_Interface : constant Name_Id := N + 085;
- Name_Ras : constant Name_Id := N + 086;
- Name_uCall : constant Name_Id := N + 087;
- Name_RCI_Name : constant Name_Id := N + 088;
- Name_Receiver : constant Name_Id := N + 089;
- Name_Rpc : constant Name_Id := N + 090;
- Name_Subp_Id : constant Name_Id := N + 091;
- Name_Operation : constant Name_Id := N + 092;
- Name_Argument : constant Name_Id := N + 093;
- Name_Arg_Modes : constant Name_Id := N + 094;
- Name_Handler : constant Name_Id := N + 095;
- Name_Target : constant Name_Id := N + 096;
- Name_Req : constant Name_Id := N + 097;
- Name_Obj_TypeCode : constant Name_Id := N + 098;
- Name_Stub : constant Name_Id := N + 099;
+ Name_Addr : constant Name_Id := N + 074;
+ Name_Async : constant Name_Id := N + 075;
+ Name_Get_Active_Partition_ID : constant Name_Id := N + 076;
+ Name_Get_RCI_Package_Receiver : constant Name_Id := N + 077;
+ Name_Get_RCI_Package_Ref : constant Name_Id := N + 078;
+ Name_Origin : constant Name_Id := N + 079;
+ Name_Params : constant Name_Id := N + 080;
+ Name_Partition : constant Name_Id := N + 081;
+ Name_Partition_Interface : constant Name_Id := N + 082;
+ Name_Ras : constant Name_Id := N + 083;
+ Name_uCall : constant Name_Id := N + 084;
+ Name_RCI_Name : constant Name_Id := N + 085;
+ Name_Receiver : constant Name_Id := N + 086;
+ Name_Rpc : constant Name_Id := N + 087;
+ Name_Subp_Id : constant Name_Id := N + 088;
+ Name_Operation : constant Name_Id := N + 089;
+ Name_Argument : constant Name_Id := N + 090;
+ Name_Arg_Modes : constant Name_Id := N + 091;
+ Name_Handler : constant Name_Id := N + 092;
+ Name_Target : constant Name_Id := N + 093;
+ Name_Req : constant Name_Id := N + 094;
+ Name_Obj_TypeCode : constant Name_Id := N + 095;
+ Name_Stub : constant Name_Id := N + 096;
-- Operator Symbol entries. The actual names have an upper case O at
-- the start in place of the Op_ prefix (e.g. the actual name that
-- corresponds to Name_Op_Abs is "Oabs".
- First_Operator_Name : constant Name_Id := N + 100;
- Name_Op_Abs : constant Name_Id := N + 100; -- "abs"
- Name_Op_And : constant Name_Id := N + 101; -- "and"
- Name_Op_Mod : constant Name_Id := N + 102; -- "mod"
- Name_Op_Not : constant Name_Id := N + 103; -- "not"
- Name_Op_Or : constant Name_Id := N + 104; -- "or"
- Name_Op_Rem : constant Name_Id := N + 105; -- "rem"
- Name_Op_Xor : constant Name_Id := N + 106; -- "xor"
- Name_Op_Eq : constant Name_Id := N + 107; -- "="
- Name_Op_Ne : constant Name_Id := N + 108; -- "/="
- Name_Op_Lt : constant Name_Id := N + 109; -- "<"
- Name_Op_Le : constant Name_Id := N + 110; -- "<="
- Name_Op_Gt : constant Name_Id := N + 111; -- ">"
- Name_Op_Ge : constant Name_Id := N + 112; -- ">="
- Name_Op_Add : constant Name_Id := N + 113; -- "+"
- Name_Op_Subtract : constant Name_Id := N + 114; -- "-"
- Name_Op_Concat : constant Name_Id := N + 115; -- "&"
- Name_Op_Multiply : constant Name_Id := N + 116; -- "*"
- Name_Op_Divide : constant Name_Id := N + 117; -- "/"
- Name_Op_Expon : constant Name_Id := N + 118; -- "**"
- Last_Operator_Name : constant Name_Id := N + 118;
+ First_Operator_Name : constant Name_Id := N + 097;
+ Name_Op_Abs : constant Name_Id := N + 097; -- "abs"
+ Name_Op_And : constant Name_Id := N + 098; -- "and"
+ Name_Op_Mod : constant Name_Id := N + 099; -- "mod"
+ Name_Op_Not : constant Name_Id := N + 100; -- "not"
+ Name_Op_Or : constant Name_Id := N + 101; -- "or"
+ Name_Op_Rem : constant Name_Id := N + 102; -- "rem"
+ Name_Op_Xor : constant Name_Id := N + 103; -- "xor"
+ Name_Op_Eq : constant Name_Id := N + 104; -- "="
+ Name_Op_Ne : constant Name_Id := N + 105; -- "/="
+ Name_Op_Lt : constant Name_Id := N + 106; -- "<"
+ Name_Op_Le : constant Name_Id := N + 107; -- "<="
+ Name_Op_Gt : constant Name_Id := N + 108; -- ">"
+ Name_Op_Ge : constant Name_Id := N + 109; -- ">="
+ Name_Op_Add : constant Name_Id := N + 110; -- "+"
+ Name_Op_Subtract : constant Name_Id := N + 111; -- "-"
+ Name_Op_Concat : constant Name_Id := N + 112; -- "&"
+ Name_Op_Multiply : constant Name_Id := N + 113; -- "*"
+ Name_Op_Divide : constant Name_Id := N + 114; -- "/"
+ Name_Op_Expon : constant Name_Id := N + 115; -- "**"
+ Last_Operator_Name : constant Name_Id := N + 115;
-- Names for all pragmas recognized by GNAT. The entries with the comment
-- "Ada 83" are pragmas that are defined in Ada 83, but not in Ada 95.
@@ -331,31 +325,31 @@ package Snames is
-- only in GNAT for the AAMP. They are ignored in other versions with
-- appropriate warnings.
- First_Pragma_Name : constant Name_Id := N + 119;
+ First_Pragma_Name : constant Name_Id := N + 116;
-- Configuration pragmas are grouped at start
- Name_Ada_83 : constant Name_Id := N + 119; -- GNAT
- Name_Ada_95 : constant Name_Id := N + 120; -- GNAT
- Name_Ada_05 : constant Name_Id := N + 121; -- GNAT
- Name_Ada_2005 : constant Name_Id := N + 122; -- GNAT
- Name_Assertion_Policy : constant Name_Id := N + 123; -- Ada 05
- Name_C_Pass_By_Copy : constant Name_Id := N + 124; -- GNAT
- Name_Check_Name : constant Name_Id := N + 125; -- GNAT
- Name_Check_Policy : constant Name_Id := N + 126; -- GNAT
- Name_Compile_Time_Error : constant Name_Id := N + 127; -- GNAT
- Name_Compile_Time_Warning : constant Name_Id := N + 128; -- GNAT
- Name_Compiler_Unit : constant Name_Id := N + 129; -- GNAT
- Name_Component_Alignment : constant Name_Id := N + 130; -- GNAT
- Name_Convention_Identifier : constant Name_Id := N + 131; -- GNAT
- Name_Debug_Policy : constant Name_Id := N + 132; -- GNAT
- Name_Detect_Blocking : constant Name_Id := N + 133; -- Ada 05
- Name_Discard_Names : constant Name_Id := N + 134;
- Name_Elaboration_Checks : constant Name_Id := N + 135; -- GNAT
- Name_Eliminate : constant Name_Id := N + 136; -- GNAT
- Name_Extend_System : constant Name_Id := N + 137; -- GNAT
- Name_Extensions_Allowed : constant Name_Id := N + 138; -- GNAT
- Name_External_Name_Casing : constant Name_Id := N + 139; -- GNAT
+ Name_Ada_83 : constant Name_Id := N + 116; -- GNAT
+ Name_Ada_95 : constant Name_Id := N + 117; -- GNAT
+ Name_Ada_05 : constant Name_Id := N + 118; -- GNAT
+ Name_Ada_2005 : constant Name_Id := N + 119; -- GNAT
+ Name_Assertion_Policy : constant Name_Id := N + 120; -- Ada 05
+ Name_C_Pass_By_Copy : constant Name_Id := N + 121; -- GNAT
+ Name_Check_Name : constant Name_Id := N + 122; -- GNAT
+ Name_Check_Policy : constant Name_Id := N + 123; -- GNAT
+ Name_Compile_Time_Error : constant Name_Id := N + 124; -- GNAT
+ Name_Compile_Time_Warning : constant Name_Id := N + 125; -- GNAT
+ Name_Compiler_Unit : constant Name_Id := N + 126; -- GNAT
+ Name_Component_Alignment : constant Name_Id := N + 127; -- GNAT
+ Name_Convention_Identifier : constant Name_Id := N + 128; -- GNAT
+ Name_Debug_Policy : constant Name_Id := N + 129; -- GNAT
+ Name_Detect_Blocking : constant Name_Id := N + 130; -- Ada 05
+ Name_Discard_Names : constant Name_Id := N + 131;
+ Name_Elaboration_Checks : constant Name_Id := N + 132; -- GNAT
+ Name_Eliminate : constant Name_Id := N + 133; -- GNAT
+ Name_Extend_System : constant Name_Id := N + 134; -- GNAT
+ Name_Extensions_Allowed : constant Name_Id := N + 135; -- GNAT
+ Name_External_Name_Casing : constant Name_Id := N + 136; -- GNAT
-- Note: Fast_Math is not in this list because its name matches -- GNAT
-- the name of the corresponding attribute. However, it is
@@ -363,49 +357,49 @@ package Snames is
-- functions Get_Pragma_Id, Is_[Configuration_]Pragma_Id, and
-- correctly recognize and process Fast_Math.
- Name_Favor_Top_Level : constant Name_Id := N + 140; -- GNAT
- Name_Float_Representation : constant Name_Id := N + 141; -- GNAT
- Name_Implicit_Packing : constant Name_Id := N + 142; -- GNAT
- Name_Initialize_Scalars : constant Name_Id := N + 143; -- GNAT
- Name_Interrupt_State : constant Name_Id := N + 144; -- GNAT
- Name_License : constant Name_Id := N + 145; -- GNAT
- Name_Locking_Policy : constant Name_Id := N + 146;
- Name_Long_Float : constant Name_Id := N + 147; -- VMS
- Name_No_Run_Time : constant Name_Id := N + 148; -- GNAT
- Name_No_Strict_Aliasing : constant Name_Id := N + 149; -- GNAT
- Name_Normalize_Scalars : constant Name_Id := N + 150;
- Name_Optimize_Alignment : constant Name_Id := N + 151; -- GNAT
- Name_Persistent_BSS : constant Name_Id := N + 152; -- GNAT
- Name_Polling : constant Name_Id := N + 153; -- GNAT
- Name_Priority_Specific_Dispatching : constant Name_Id := N + 154; -- Ada 05
- Name_Profile : constant Name_Id := N + 155; -- Ada 05
- Name_Profile_Warnings : constant Name_Id := N + 156; -- GNAT
- Name_Propagate_Exceptions : constant Name_Id := N + 157; -- GNAT
- Name_Queuing_Policy : constant Name_Id := N + 158;
- Name_Ravenscar : constant Name_Id := N + 159; -- GNAT
- Name_Restricted_Run_Time : constant Name_Id := N + 160; -- GNAT
- Name_Restrictions : constant Name_Id := N + 161;
- Name_Restriction_Warnings : constant Name_Id := N + 162; -- GNAT
- Name_Reviewable : constant Name_Id := N + 163;
- Name_Source_File_Name : constant Name_Id := N + 164; -- GNAT
- Name_Source_File_Name_Project : constant Name_Id := N + 165; -- GNAT
- Name_Style_Checks : constant Name_Id := N + 166; -- GNAT
- Name_Suppress : constant Name_Id := N + 167;
- Name_Suppress_Exception_Locations : constant Name_Id := N + 168; -- GNAT
- Name_Task_Dispatching_Policy : constant Name_Id := N + 169;
- Name_Universal_Data : constant Name_Id := N + 170; -- AAMP
- Name_Unsuppress : constant Name_Id := N + 171; -- GNAT
- Name_Use_VADS_Size : constant Name_Id := N + 172; -- GNAT
- Name_Validity_Checks : constant Name_Id := N + 173; -- GNAT
- Name_Warnings : constant Name_Id := N + 174; -- GNAT
- Name_Wide_Character_Encoding : constant Name_Id := N + 175; -- GNAT
- Last_Configuration_Pragma_Name : constant Name_Id := N + 175;
+ Name_Favor_Top_Level : constant Name_Id := N + 137; -- GNAT
+ Name_Float_Representation : constant Name_Id := N + 138; -- GNAT
+ Name_Implicit_Packing : constant Name_Id := N + 139; -- GNAT
+ Name_Initialize_Scalars : constant Name_Id := N + 140; -- GNAT
+ Name_Interrupt_State : constant Name_Id := N + 141; -- GNAT
+ Name_License : constant Name_Id := N + 142; -- GNAT
+ Name_Locking_Policy : constant Name_Id := N + 143;
+ Name_Long_Float : constant Name_Id := N + 144; -- VMS
+ Name_No_Run_Time : constant Name_Id := N + 145; -- GNAT
+ Name_No_Strict_Aliasing : constant Name_Id := N + 146; -- GNAT
+ Name_Normalize_Scalars : constant Name_Id := N + 147;
+ Name_Optimize_Alignment : constant Name_Id := N + 148; -- GNAT
+ Name_Persistent_BSS : constant Name_Id := N + 149; -- GNAT
+ Name_Polling : constant Name_Id := N + 150; -- GNAT
+ Name_Priority_Specific_Dispatching : constant Name_Id := N + 151; -- Ada 05
+ Name_Profile : constant Name_Id := N + 152; -- Ada 05
+ Name_Profile_Warnings : constant Name_Id := N + 153; -- GNAT
+ Name_Propagate_Exceptions : constant Name_Id := N + 154; -- GNAT
+ Name_Queuing_Policy : constant Name_Id := N + 155;
+ Name_Ravenscar : constant Name_Id := N + 156; -- GNAT
+ Name_Restricted_Run_Time : constant Name_Id := N + 157; -- GNAT
+ Name_Restrictions : constant Name_Id := N + 158;
+ Name_Restriction_Warnings : constant Name_Id := N + 159; -- GNAT
+ Name_Reviewable : constant Name_Id := N + 160;
+ Name_Source_File_Name : constant Name_Id := N + 161; -- GNAT
+ Name_Source_File_Name_Project : constant Name_Id := N + 162; -- GNAT
+ Name_Style_Checks : constant Name_Id := N + 163; -- GNAT
+ Name_Suppress : constant Name_Id := N + 164;
+ Name_Suppress_Exception_Locations : constant Name_Id := N + 165; -- GNAT
+ Name_Task_Dispatching_Policy : constant Name_Id := N + 166;
+ Name_Universal_Data : constant Name_Id := N + 167; -- AAMP
+ Name_Unsuppress : constant Name_Id := N + 168; -- Ada 05
+ Name_Use_VADS_Size : constant Name_Id := N + 169; -- GNAT
+ Name_Validity_Checks : constant Name_Id := N + 170; -- GNAT
+ Name_Warnings : constant Name_Id := N + 171; -- GNAT
+ Name_Wide_Character_Encoding : constant Name_Id := N + 172; -- GNAT
+ Last_Configuration_Pragma_Name : constant Name_Id := N + 172;
-- Remaining pragma names
- Name_Abort_Defer : constant Name_Id := N + 176; -- GNAT
- Name_All_Calls_Remote : constant Name_Id := N + 177;
- Name_Annotate : constant Name_Id := N + 178; -- GNAT
+ Name_Abort_Defer : constant Name_Id := N + 173; -- GNAT
+ Name_All_Calls_Remote : constant Name_Id := N + 174;
+ Name_Annotate : constant Name_Id := N + 175; -- GNAT
-- Note: AST_Entry is not in this list because its name matches -- VMS
-- the name of the corresponding attribute. However, it is
@@ -413,77 +407,83 @@ package Snames is
-- functions Get_Pragma_Id and Is_Pragma_Id correctly recognize
-- and process Name_AST_Entry.
- Name_Assert : constant Name_Id := N + 179; -- Ada 05
- Name_Asynchronous : constant Name_Id := N + 180;
- Name_Atomic : constant Name_Id := N + 181;
- Name_Atomic_Components : constant Name_Id := N + 182;
- Name_Attach_Handler : constant Name_Id := N + 183;
- Name_Check : constant Name_Id := N + 184; -- GNAT
- Name_CIL_Constructor : constant Name_Id := N + 185; -- GNAT
- Name_Comment : constant Name_Id := N + 186; -- GNAT
- Name_Common_Object : constant Name_Id := N + 187; -- GNAT
- Name_Complete_Representation : constant Name_Id := N + 188; -- GNAT
- Name_Complex_Representation : constant Name_Id := N + 189; -- GNAT
- Name_Controlled : constant Name_Id := N + 190;
- Name_Convention : constant Name_Id := N + 191;
- Name_CPP_Class : constant Name_Id := N + 192; -- GNAT
- Name_CPP_Constructor : constant Name_Id := N + 193; -- GNAT
- Name_CPP_Virtual : constant Name_Id := N + 194; -- GNAT
- Name_CPP_Vtable : constant Name_Id := N + 195; -- GNAT
- Name_Debug : constant Name_Id := N + 196; -- GNAT
- Name_Elaborate : constant Name_Id := N + 197; -- Ada 83
- Name_Elaborate_All : constant Name_Id := N + 198;
- Name_Elaborate_Body : constant Name_Id := N + 199;
- Name_Export : constant Name_Id := N + 200;
- Name_Export_Exception : constant Name_Id := N + 201; -- VMS
- Name_Export_Function : constant Name_Id := N + 202; -- GNAT
- Name_Export_Object : constant Name_Id := N + 203; -- GNAT
- Name_Export_Procedure : constant Name_Id := N + 204; -- GNAT
- Name_Export_Value : constant Name_Id := N + 205; -- GNAT
- Name_Export_Valued_Procedure : constant Name_Id := N + 206; -- GNAT
- Name_External : constant Name_Id := N + 207; -- GNAT
- Name_Finalize_Storage_Only : constant Name_Id := N + 208; -- GNAT
- Name_Ident : constant Name_Id := N + 209; -- VMS
- Name_Implemented_By_Entry : constant Name_Id := N + 210; -- Ada 05
- Name_Import : constant Name_Id := N + 211;
- Name_Import_Exception : constant Name_Id := N + 212; -- VMS
- Name_Import_Function : constant Name_Id := N + 213; -- GNAT
- Name_Import_Object : constant Name_Id := N + 214; -- GNAT
- Name_Import_Procedure : constant Name_Id := N + 215; -- GNAT
- Name_Import_Valued_Procedure : constant Name_Id := N + 216; -- GNAT
- Name_Inline : constant Name_Id := N + 217;
- Name_Inline_Always : constant Name_Id := N + 218; -- GNAT
- Name_Inline_Generic : constant Name_Id := N + 219; -- GNAT
- Name_Inspection_Point : constant Name_Id := N + 220;
- Name_Interface_Name : constant Name_Id := N + 221; -- GNAT
- Name_Interrupt_Handler : constant Name_Id := N + 222;
- Name_Interrupt_Priority : constant Name_Id := N + 223;
- Name_Java_Constructor : constant Name_Id := N + 224; -- GNAT
- Name_Java_Interface : constant Name_Id := N + 225; -- GNAT
- Name_Keep_Names : constant Name_Id := N + 226; -- GNAT
- Name_Link_With : constant Name_Id := N + 227; -- GNAT
- Name_Linker_Alias : constant Name_Id := N + 228; -- GNAT
- Name_Linker_Constructor : constant Name_Id := N + 229; -- GNAT
- Name_Linker_Destructor : constant Name_Id := N + 230; -- GNAT
- Name_Linker_Options : constant Name_Id := N + 231;
- Name_Linker_Section : constant Name_Id := N + 232; -- GNAT
- Name_List : constant Name_Id := N + 233;
- Name_Machine_Attribute : constant Name_Id := N + 234; -- GNAT
- Name_Main : constant Name_Id := N + 235; -- GNAT
- Name_Main_Storage : constant Name_Id := N + 236; -- GNAT
- Name_Memory_Size : constant Name_Id := N + 237; -- Ada 83
- Name_No_Body : constant Name_Id := N + 238; -- GNAT
- Name_No_Return : constant Name_Id := N + 239; -- GNAT
- Name_Obsolescent : constant Name_Id := N + 240; -- GNAT
- Name_Optimize : constant Name_Id := N + 241;
- Name_Pack : constant Name_Id := N + 242;
- Name_Page : constant Name_Id := N + 243;
- Name_Passive : constant Name_Id := N + 244; -- GNAT
- Name_Postcondition : constant Name_Id := N + 245; -- GNAT
- Name_Precondition : constant Name_Id := N + 246; -- GNAT
- Name_Preelaborable_Initialization : constant Name_Id := N + 247; -- Ada 05
- Name_Preelaborate : constant Name_Id := N + 248;
- Name_Preelaborate_05 : constant Name_Id := N + 249; -- GNAT
+ Name_Assert : constant Name_Id := N + 176; -- Ada 05
+ Name_Asynchronous : constant Name_Id := N + 177;
+ Name_Atomic : constant Name_Id := N + 178;
+ Name_Atomic_Components : constant Name_Id := N + 179;
+ Name_Attach_Handler : constant Name_Id := N + 180;
+ Name_Check : constant Name_Id := N + 181; -- GNAT
+ Name_CIL_Constructor : constant Name_Id := N + 182; -- GNAT
+ Name_Comment : constant Name_Id := N + 183; -- GNAT
+ Name_Common_Object : constant Name_Id := N + 184; -- GNAT
+ Name_Complete_Representation : constant Name_Id := N + 185; -- GNAT
+ Name_Complex_Representation : constant Name_Id := N + 186; -- GNAT
+ Name_Controlled : constant Name_Id := N + 187;
+ Name_Convention : constant Name_Id := N + 188;
+ Name_CPP_Class : constant Name_Id := N + 189; -- GNAT
+ Name_CPP_Constructor : constant Name_Id := N + 190; -- GNAT
+ Name_CPP_Virtual : constant Name_Id := N + 191; -- GNAT
+ Name_CPP_Vtable : constant Name_Id := N + 192; -- GNAT
+ Name_Debug : constant Name_Id := N + 193; -- GNAT
+ Name_Elaborate : constant Name_Id := N + 194; -- Ada 83
+ Name_Elaborate_All : constant Name_Id := N + 195;
+ Name_Elaborate_Body : constant Name_Id := N + 196;
+ Name_Export : constant Name_Id := N + 197;
+ Name_Export_Exception : constant Name_Id := N + 198; -- VMS
+ Name_Export_Function : constant Name_Id := N + 199; -- GNAT
+ Name_Export_Object : constant Name_Id := N + 200; -- GNAT
+ Name_Export_Procedure : constant Name_Id := N + 201; -- GNAT
+ Name_Export_Value : constant Name_Id := N + 202; -- GNAT
+ Name_Export_Valued_Procedure : constant Name_Id := N + 203; -- GNAT
+ Name_External : constant Name_Id := N + 204; -- GNAT
+ Name_Finalize_Storage_Only : constant Name_Id := N + 205; -- GNAT
+ Name_Ident : constant Name_Id := N + 206; -- VMS
+ Name_Implemented_By_Entry : constant Name_Id := N + 207; -- Ada 05
+ Name_Import : constant Name_Id := N + 208;
+ Name_Import_Exception : constant Name_Id := N + 209; -- VMS
+ Name_Import_Function : constant Name_Id := N + 210; -- GNAT
+ Name_Import_Object : constant Name_Id := N + 211; -- GNAT
+ Name_Import_Procedure : constant Name_Id := N + 212; -- GNAT
+ Name_Import_Valued_Procedure : constant Name_Id := N + 213; -- GNAT
+ Name_Inline : constant Name_Id := N + 214;
+ Name_Inline_Always : constant Name_Id := N + 215; -- GNAT
+ Name_Inline_Generic : constant Name_Id := N + 216; -- GNAT
+ Name_Inspection_Point : constant Name_Id := N + 217;
+
+ -- Note: Interface is not in this list because its name matches -- GNAT
+ -- an Ada 2005 keyword. However it is included in the definition
+ -- of the type Attribute_Id, and the functions Get_Pragma_Id and
+ -- Is_Pragma_Id correctly recognize and process Name_Storage_Size.
+
+ Name_Interface_Name : constant Name_Id := N + 218; -- GNAT
+ Name_Interrupt_Handler : constant Name_Id := N + 219;
+ Name_Interrupt_Priority : constant Name_Id := N + 220;
+ Name_Java_Constructor : constant Name_Id := N + 221; -- GNAT
+ Name_Java_Interface : constant Name_Id := N + 222; -- GNAT
+ Name_Keep_Names : constant Name_Id := N + 223; -- GNAT
+ Name_Link_With : constant Name_Id := N + 224; -- GNAT
+ Name_Linker_Alias : constant Name_Id := N + 225; -- GNAT
+ Name_Linker_Constructor : constant Name_Id := N + 226; -- GNAT
+ Name_Linker_Destructor : constant Name_Id := N + 227; -- GNAT
+ Name_Linker_Options : constant Name_Id := N + 228;
+ Name_Linker_Section : constant Name_Id := N + 229; -- GNAT
+ Name_List : constant Name_Id := N + 230;
+ Name_Machine_Attribute : constant Name_Id := N + 231; -- GNAT
+ Name_Main : constant Name_Id := N + 232; -- GNAT
+ Name_Main_Storage : constant Name_Id := N + 233; -- GNAT
+ Name_Memory_Size : constant Name_Id := N + 234; -- Ada 83
+ Name_No_Body : constant Name_Id := N + 235; -- GNAT
+ Name_No_Return : constant Name_Id := N + 236; -- GNAT
+ Name_Obsolescent : constant Name_Id := N + 237; -- GNAT
+ Name_Optimize : constant Name_Id := N + 238;
+ Name_Pack : constant Name_Id := N + 239;
+ Name_Page : constant Name_Id := N + 240;
+ Name_Passive : constant Name_Id := N + 241; -- GNAT
+ Name_Postcondition : constant Name_Id := N + 242; -- GNAT
+ Name_Precondition : constant Name_Id := N + 243; -- GNAT
+ Name_Preelaborable_Initialization : constant Name_Id := N + 244; -- Ada 05
+ Name_Preelaborate : constant Name_Id := N + 245;
+ Name_Preelaborate_05 : constant Name_Id := N + 246; -- GNAT
-- Note: Priority is not in this list because its name matches
-- the name of the corresponding attribute. However, it is
@@ -491,16 +491,16 @@ package Snames is
-- functions Get_Pragma_Id and Is_Pragma_Id correctly recognize
-- and process Priority. Priority is a standard Ada 95 pragma.
- Name_Psect_Object : constant Name_Id := N + 250; -- VMS
- Name_Pure : constant Name_Id := N + 251;
- Name_Pure_05 : constant Name_Id := N + 252; -- GNAT
- Name_Pure_Function : constant Name_Id := N + 253; -- GNAT
- Name_Relative_Deadline : constant Name_Id := N + 254; -- Ada 05
- Name_Remote_Call_Interface : constant Name_Id := N + 255;
- Name_Remote_Types : constant Name_Id := N + 256;
- Name_Share_Generic : constant Name_Id := N + 257; -- GNAT
- Name_Shared : constant Name_Id := N + 258; -- Ada 83
- Name_Shared_Passive : constant Name_Id := N + 259;
+ Name_Psect_Object : constant Name_Id := N + 247; -- VMS
+ Name_Pure : constant Name_Id := N + 248;
+ Name_Pure_05 : constant Name_Id := N + 249; -- GNAT
+ Name_Pure_Function : constant Name_Id := N + 250; -- GNAT
+ Name_Relative_Deadline : constant Name_Id := N + 251; -- Ada 05
+ Name_Remote_Call_Interface : constant Name_Id := N + 252;
+ Name_Remote_Types : constant Name_Id := N + 253;
+ Name_Share_Generic : constant Name_Id := N + 254; -- GNAT
+ Name_Shared : constant Name_Id := N + 255; -- Ada 83
+ Name_Shared_Passive : constant Name_Id := N + 256;
-- Note: Storage_Size is not in this list because its name
-- matches the name of the corresponding attribute. However,
@@ -511,30 +511,30 @@ package Snames is
-- Note: Storage_Unit is also omitted from the list because
-- of a clash with an attribute name, and is treated similarly.
- Name_Source_Reference : constant Name_Id := N + 260; -- GNAT
- Name_Static_Elaboration_Desired : constant Name_Id := N + 261; -- GNAT
- Name_Stream_Convert : constant Name_Id := N + 262; -- GNAT
- Name_Subtitle : constant Name_Id := N + 263; -- GNAT
- Name_Suppress_All : constant Name_Id := N + 264; -- GNAT
- Name_Suppress_Debug_Info : constant Name_Id := N + 265; -- GNAT
- Name_Suppress_Initialization : constant Name_Id := N + 266; -- GNAT
- Name_System_Name : constant Name_Id := N + 267; -- Ada 83
- Name_Task_Info : constant Name_Id := N + 268; -- GNAT
- Name_Task_Name : constant Name_Id := N + 269; -- GNAT
- Name_Task_Storage : constant Name_Id := N + 270; -- VMS
- Name_Time_Slice : constant Name_Id := N + 271; -- GNAT
- Name_Title : constant Name_Id := N + 272; -- GNAT
- Name_Unchecked_Union : constant Name_Id := N + 273; -- GNAT
- Name_Unimplemented_Unit : constant Name_Id := N + 274; -- GNAT
- Name_Universal_Aliasing : constant Name_Id := N + 275; -- GNAT
- Name_Unmodified : constant Name_Id := N + 276; -- GNAT
- Name_Unreferenced : constant Name_Id := N + 277; -- GNAT
- Name_Unreferenced_Objects : constant Name_Id := N + 278; -- GNAT
- Name_Unreserve_All_Interrupts : constant Name_Id := N + 279; -- GNAT
- Name_Volatile : constant Name_Id := N + 280;
- Name_Volatile_Components : constant Name_Id := N + 281;
- Name_Weak_External : constant Name_Id := N + 282; -- GNAT
- Last_Pragma_Name : constant Name_Id := N + 282;
+ Name_Source_Reference : constant Name_Id := N + 257; -- GNAT
+ Name_Static_Elaboration_Desired : constant Name_Id := N + 258; -- GNAT
+ Name_Stream_Convert : constant Name_Id := N + 259; -- GNAT
+ Name_Subtitle : constant Name_Id := N + 260; -- GNAT
+ Name_Suppress_All : constant Name_Id := N + 261; -- GNAT
+ Name_Suppress_Debug_Info : constant Name_Id := N + 262; -- GNAT
+ Name_Suppress_Initialization : constant Name_Id := N + 263; -- GNAT
+ Name_System_Name : constant Name_Id := N + 264; -- Ada 83
+ Name_Task_Info : constant Name_Id := N + 265; -- GNAT
+ Name_Task_Name : constant Name_Id := N + 266; -- GNAT
+ Name_Task_Storage : constant Name_Id := N + 267; -- VMS
+ Name_Time_Slice : constant Name_Id := N + 268; -- GNAT
+ Name_Title : constant Name_Id := N + 269; -- GNAT
+ Name_Unchecked_Union : constant Name_Id := N + 270; -- Ada 05
+ Name_Unimplemented_Unit : constant Name_Id := N + 271; -- GNAT
+ Name_Universal_Aliasing : constant Name_Id := N + 272; -- GNAT
+ Name_Unmodified : constant Name_Id := N + 273; -- GNAT
+ Name_Unreferenced : constant Name_Id := N + 274; -- GNAT
+ Name_Unreferenced_Objects : constant Name_Id := N + 275; -- GNAT
+ Name_Unreserve_All_Interrupts : constant Name_Id := N + 276; -- GNAT
+ Name_Volatile : constant Name_Id := N + 277;
+ Name_Volatile_Components : constant Name_Id := N + 278;
+ Name_Weak_External : constant Name_Id := N + 279; -- GNAT
+ Last_Pragma_Name : constant Name_Id := N + 279;
-- Language convention names for pragma Convention/Export/Import/Interface
-- Note that Name_C is not included in this list, since it was already
@@ -545,119 +545,120 @@ package Snames is
-- Entry and Protected, this is because these conventions cannot be
-- specified by a pragma.
- First_Convention_Name : constant Name_Id := N + 283;
- Name_Ada : constant Name_Id := N + 283;
- Name_Assembler : constant Name_Id := N + 284;
- Name_CIL : constant Name_Id := N + 285;
- Name_COBOL : constant Name_Id := N + 286;
- Name_CPP : constant Name_Id := N + 287;
- Name_Fortran : constant Name_Id := N + 288;
- Name_Intrinsic : constant Name_Id := N + 289;
- Name_Java : constant Name_Id := N + 290;
- Name_Stdcall : constant Name_Id := N + 291;
- Name_Stubbed : constant Name_Id := N + 292;
- Last_Convention_Name : constant Name_Id := N + 292;
+ First_Convention_Name : constant Name_Id := N + 280;
+ Name_Ada : constant Name_Id := N + 280;
+ Name_Assembler : constant Name_Id := N + 281;
+ Name_CIL : constant Name_Id := N + 282;
+ Name_COBOL : constant Name_Id := N + 283;
+ Name_CPP : constant Name_Id := N + 284;
+ Name_Fortran : constant Name_Id := N + 285;
+ Name_Intrinsic : constant Name_Id := N + 286;
+ Name_Java : constant Name_Id := N + 287;
+ Name_Stdcall : constant Name_Id := N + 288;
+ Name_Stubbed : constant Name_Id := N + 289;
+ Last_Convention_Name : constant Name_Id := N + 289;
-- The following names are preset as synonyms for Assembler
- Name_Asm : constant Name_Id := N + 293;
- Name_Assembly : constant Name_Id := N + 294;
+ Name_Asm : constant Name_Id := N + 290;
+ Name_Assembly : constant Name_Id := N + 291;
-- The following names are preset as synonyms for C
- Name_Default : constant Name_Id := N + 295;
+ Name_Default : constant Name_Id := N + 292;
-- Name_External (previously defined as pragma)
-- The following names are preset as synonyms for CPP
- Name_C_Plus_Plus : constant Name_Id := N + 296;
+ Name_C_Plus_Plus : constant Name_Id := N + 293;
-- The following names are present as synonyms for Stdcall
- Name_DLL : constant Name_Id := N + 297;
- Name_Win32 : constant Name_Id := N + 298;
+ Name_DLL : constant Name_Id := N + 294;
+ Name_Win32 : constant Name_Id := N + 295;
-- Other special names used in processing pragmas
- Name_As_Is : constant Name_Id := N + 299;
- Name_Assertion : constant Name_Id := N + 300;
- Name_Attribute_Name : constant Name_Id := N + 301;
- Name_Body_File_Name : constant Name_Id := N + 302;
- Name_Boolean_Entry_Barriers : constant Name_Id := N + 303;
- Name_Casing : constant Name_Id := N + 304;
- Name_Code : constant Name_Id := N + 305;
- Name_Component : constant Name_Id := N + 306;
- Name_Component_Size_4 : constant Name_Id := N + 307;
- Name_Copy : constant Name_Id := N + 308;
- Name_D_Float : constant Name_Id := N + 309;
- Name_Descriptor : constant Name_Id := N + 310;
- Name_Dot_Replacement : constant Name_Id := N + 311;
- Name_Dynamic : constant Name_Id := N + 312;
- Name_Entity : constant Name_Id := N + 313;
- Name_Entry_Count : constant Name_Id := N + 314;
- Name_External_Name : constant Name_Id := N + 315;
- Name_First_Optional_Parameter : constant Name_Id := N + 316;
- Name_Form : constant Name_Id := N + 317;
- Name_G_Float : constant Name_Id := N + 318;
- Name_Gcc : constant Name_Id := N + 319;
- Name_Gnat : constant Name_Id := N + 320;
- Name_GPL : constant Name_Id := N + 321;
- Name_IEEE_Float : constant Name_Id := N + 322;
- Name_Ignore : constant Name_Id := N + 323;
- Name_Info : constant Name_Id := N + 324;
- Name_Internal : constant Name_Id := N + 325;
- Name_Link_Name : constant Name_Id := N + 326;
- Name_Lowercase : constant Name_Id := N + 327;
- Name_Max_Entry_Queue_Depth : constant Name_Id := N + 328;
- Name_Max_Entry_Queue_Length : constant Name_Id := N + 329;
- Name_Max_Size : constant Name_Id := N + 330;
- Name_Mechanism : constant Name_Id := N + 331;
- Name_Message : constant Name_Id := N + 332;
- Name_Mixedcase : constant Name_Id := N + 333;
- Name_Modified_GPL : constant Name_Id := N + 334;
- Name_Name : constant Name_Id := N + 335;
- Name_NCA : constant Name_Id := N + 336;
- Name_No : constant Name_Id := N + 337;
- Name_No_Dependence : constant Name_Id := N + 338;
- Name_No_Dynamic_Attachment : constant Name_Id := N + 339;
- Name_No_Dynamic_Interrupts : constant Name_Id := N + 340;
- Name_No_Requeue : constant Name_Id := N + 341;
- Name_No_Requeue_Statements : constant Name_Id := N + 342;
- Name_No_Task_Attributes : constant Name_Id := N + 343;
- Name_No_Task_Attributes_Package : constant Name_Id := N + 344;
- Name_On : constant Name_Id := N + 345;
- Name_Parameter_Types : constant Name_Id := N + 346;
- Name_Reference : constant Name_Id := N + 347;
- Name_Restricted : constant Name_Id := N + 348;
- Name_Result_Mechanism : constant Name_Id := N + 349;
- Name_Result_Type : constant Name_Id := N + 350;
- Name_Runtime : constant Name_Id := N + 351;
- Name_SB : constant Name_Id := N + 352;
- Name_Secondary_Stack_Size : constant Name_Id := N + 353;
- Name_Section : constant Name_Id := N + 354;
- Name_Semaphore : constant Name_Id := N + 355;
- Name_Simple_Barriers : constant Name_Id := N + 356;
- Name_Spec_File_Name : constant Name_Id := N + 357;
- Name_State : constant Name_Id := N + 358;
- Name_Static : constant Name_Id := N + 359;
- Name_Stack_Size : constant Name_Id := N + 360;
- Name_Subunit_File_Name : constant Name_Id := N + 361;
- Name_Task_Stack_Size_Default : constant Name_Id := N + 362;
- Name_Task_Type : constant Name_Id := N + 363;
- Name_Time_Slicing_Enabled : constant Name_Id := N + 364;
- Name_Top_Guard : constant Name_Id := N + 365;
- Name_UBA : constant Name_Id := N + 366;
- Name_UBS : constant Name_Id := N + 367;
- Name_UBSB : constant Name_Id := N + 368;
- Name_Unit_Name : constant Name_Id := N + 369;
- Name_Unknown : constant Name_Id := N + 370;
- Name_Unrestricted : constant Name_Id := N + 371;
- Name_Uppercase : constant Name_Id := N + 372;
- Name_User : constant Name_Id := N + 373;
- Name_VAX_Float : constant Name_Id := N + 374;
- Name_VMS : constant Name_Id := N + 375;
- Name_Vtable_Ptr : constant Name_Id := N + 376;
- Name_Working_Storage : constant Name_Id := N + 377;
+ Name_As_Is : constant Name_Id := N + 296;
+ Name_Assertion : constant Name_Id := N + 297;
+ Name_Attribute_Name : constant Name_Id := N + 298;
+ Name_Body_File_Name : constant Name_Id := N + 299;
+ Name_Boolean_Entry_Barriers : constant Name_Id := N + 300;
+ Name_Casing : constant Name_Id := N + 301;
+ Name_Code : constant Name_Id := N + 302;
+ Name_Component : constant Name_Id := N + 303;
+ Name_Component_Size_4 : constant Name_Id := N + 304;
+ Name_Copy : constant Name_Id := N + 305;
+ Name_D_Float : constant Name_Id := N + 306;
+ Name_Descriptor : constant Name_Id := N + 307;
+ Name_Dot_Replacement : constant Name_Id := N + 308;
+ Name_Dynamic : constant Name_Id := N + 309;
+ Name_Entity : constant Name_Id := N + 310;
+ Name_Entry_Count : constant Name_Id := N + 311;
+ Name_External_Name : constant Name_Id := N + 312;
+ Name_First_Optional_Parameter : constant Name_Id := N + 313;
+ Name_Form : constant Name_Id := N + 314;
+ Name_G_Float : constant Name_Id := N + 315;
+ Name_Gcc : constant Name_Id := N + 316;
+ Name_Gnat : constant Name_Id := N + 317;
+ Name_GPL : constant Name_Id := N + 318;
+ Name_IEEE_Float : constant Name_Id := N + 319;
+ Name_Ignore : constant Name_Id := N + 320;
+ Name_Info : constant Name_Id := N + 321;
+ Name_Internal : constant Name_Id := N + 322;
+ Name_Link_Name : constant Name_Id := N + 323;
+ Name_Lowercase : constant Name_Id := N + 324;
+ Name_Max_Entry_Queue_Depth : constant Name_Id := N + 325;
+ Name_Max_Entry_Queue_Length : constant Name_Id := N + 326;
+ Name_Max_Size : constant Name_Id := N + 327;
+ Name_Mechanism : constant Name_Id := N + 328;
+ Name_Message : constant Name_Id := N + 329;
+ Name_Mixedcase : constant Name_Id := N + 330;
+ Name_Modified_GPL : constant Name_Id := N + 331;
+ Name_Name : constant Name_Id := N + 332;
+ Name_NCA : constant Name_Id := N + 333;
+ Name_No : constant Name_Id := N + 334;
+ Name_No_Dependence : constant Name_Id := N + 335;
+ Name_No_Dynamic_Attachment : constant Name_Id := N + 336;
+ Name_No_Dynamic_Interrupts : constant Name_Id := N + 337;
+ Name_No_Requeue : constant Name_Id := N + 338;
+ Name_No_Requeue_Statements : constant Name_Id := N + 339;
+ Name_No_Task_Attributes : constant Name_Id := N + 340;
+ Name_No_Task_Attributes_Package : constant Name_Id := N + 341;
+ Name_On : constant Name_Id := N + 342;
+ Name_Parameter_Types : constant Name_Id := N + 343;
+ Name_Reference : constant Name_Id := N + 344;
+ Name_Restricted : constant Name_Id := N + 345;
+ Name_Result_Mechanism : constant Name_Id := N + 346;
+ Name_Result_Type : constant Name_Id := N + 347;
+ Name_Runtime : constant Name_Id := N + 348;
+ Name_SB : constant Name_Id := N + 349;
+ Name_Secondary_Stack_Size : constant Name_Id := N + 350;
+ Name_Section : constant Name_Id := N + 351;
+ Name_Semaphore : constant Name_Id := N + 352;
+ Name_Short_Descriptor : constant Name_Id := N + 353;
+ Name_Simple_Barriers : constant Name_Id := N + 354;
+ Name_Spec_File_Name : constant Name_Id := N + 355;
+ Name_State : constant Name_Id := N + 356;
+ Name_Static : constant Name_Id := N + 357;
+ Name_Stack_Size : constant Name_Id := N + 358;
+ Name_Subunit_File_Name : constant Name_Id := N + 359;
+ Name_Task_Stack_Size_Default : constant Name_Id := N + 360;
+ Name_Task_Type : constant Name_Id := N + 361;
+ Name_Time_Slicing_Enabled : constant Name_Id := N + 362;
+ Name_Top_Guard : constant Name_Id := N + 363;
+ Name_UBA : constant Name_Id := N + 364;
+ Name_UBS : constant Name_Id := N + 365;
+ Name_UBSB : constant Name_Id := N + 366;
+ Name_Unit_Name : constant Name_Id := N + 367;
+ Name_Unknown : constant Name_Id := N + 368;
+ Name_Unrestricted : constant Name_Id := N + 369;
+ Name_Uppercase : constant Name_Id := N + 370;
+ Name_User : constant Name_Id := N + 371;
+ Name_VAX_Float : constant Name_Id := N + 372;
+ Name_VMS : constant Name_Id := N + 373;
+ Name_Vtable_Ptr : constant Name_Id := N + 374;
+ Name_Working_Storage : constant Name_Id := N + 375;
-- Names of recognized attributes. The entries with the comment "Ada 83"
-- are attributes that are defined in Ada 83, but not in Ada 95. These
@@ -671,175 +672,178 @@ package Snames is
-- The entries marked VMS are recognized only in OpenVMS implementations
-- of GNAT, and are treated as illegal in all other contexts.
- First_Attribute_Name : constant Name_Id := N + 378;
- Name_Abort_Signal : constant Name_Id := N + 378; -- GNAT
- Name_Access : constant Name_Id := N + 379;
- Name_Address : constant Name_Id := N + 380;
- Name_Address_Size : constant Name_Id := N + 381; -- GNAT
- Name_Aft : constant Name_Id := N + 382;
- Name_Alignment : constant Name_Id := N + 383;
- Name_Asm_Input : constant Name_Id := N + 384; -- GNAT
- Name_Asm_Output : constant Name_Id := N + 385; -- GNAT
- Name_AST_Entry : constant Name_Id := N + 386; -- VMS
- Name_Bit : constant Name_Id := N + 387; -- GNAT
- Name_Bit_Order : constant Name_Id := N + 388;
- Name_Bit_Position : constant Name_Id := N + 389; -- GNAT
- Name_Body_Version : constant Name_Id := N + 390;
- Name_Callable : constant Name_Id := N + 391;
- Name_Caller : constant Name_Id := N + 392;
- Name_Code_Address : constant Name_Id := N + 393; -- GNAT
- Name_Component_Size : constant Name_Id := N + 394;
- Name_Compose : constant Name_Id := N + 395;
- Name_Constrained : constant Name_Id := N + 396;
- Name_Count : constant Name_Id := N + 397;
- Name_Default_Bit_Order : constant Name_Id := N + 398; -- GNAT
- Name_Definite : constant Name_Id := N + 399;
- Name_Delta : constant Name_Id := N + 400;
- Name_Denorm : constant Name_Id := N + 401;
- Name_Digits : constant Name_Id := N + 402;
- Name_Elaborated : constant Name_Id := N + 403; -- GNAT
- Name_Emax : constant Name_Id := N + 404; -- Ada 83
- Name_Enabled : constant Name_Id := N + 405; -- GNAT
- Name_Enum_Rep : constant Name_Id := N + 406; -- GNAT
- Name_Enum_Val : constant Name_Id := N + 407; -- GNAT
- Name_Epsilon : constant Name_Id := N + 408; -- Ada 83
- Name_Exponent : constant Name_Id := N + 409;
- Name_External_Tag : constant Name_Id := N + 410;
- Name_Fast_Math : constant Name_Id := N + 411; -- GNAT
- Name_First : constant Name_Id := N + 412;
- Name_First_Bit : constant Name_Id := N + 413;
- Name_Fixed_Value : constant Name_Id := N + 414; -- GNAT
- Name_Fore : constant Name_Id := N + 415;
- Name_Has_Access_Values : constant Name_Id := N + 416; -- GNAT
- Name_Has_Discriminants : constant Name_Id := N + 417; -- GNAT
- Name_Has_Tagged_Values : constant Name_Id := N + 418; -- GNAT
- Name_Identity : constant Name_Id := N + 419;
- Name_Img : constant Name_Id := N + 420; -- GNAT
- Name_Integer_Value : constant Name_Id := N + 421; -- GNAT
- Name_Invalid_Value : constant Name_Id := N + 422; -- GNAT
- Name_Large : constant Name_Id := N + 423; -- Ada 83
- Name_Last : constant Name_Id := N + 424;
- Name_Last_Bit : constant Name_Id := N + 425;
- Name_Leading_Part : constant Name_Id := N + 426;
- Name_Length : constant Name_Id := N + 427;
- Name_Machine_Emax : constant Name_Id := N + 428;
- Name_Machine_Emin : constant Name_Id := N + 429;
- Name_Machine_Mantissa : constant Name_Id := N + 430;
- Name_Machine_Overflows : constant Name_Id := N + 431;
- Name_Machine_Radix : constant Name_Id := N + 432;
- Name_Machine_Rounding : constant Name_Id := N + 433; -- Ada 05
- Name_Machine_Rounds : constant Name_Id := N + 434;
- Name_Machine_Size : constant Name_Id := N + 435; -- GNAT
- Name_Mantissa : constant Name_Id := N + 436; -- Ada 83
- Name_Max_Size_In_Storage_Elements : constant Name_Id := N + 437;
- Name_Maximum_Alignment : constant Name_Id := N + 438; -- GNAT
- Name_Mechanism_Code : constant Name_Id := N + 439; -- GNAT
- Name_Mod : constant Name_Id := N + 440; -- Ada 05
- Name_Model_Emin : constant Name_Id := N + 441;
- Name_Model_Epsilon : constant Name_Id := N + 442;
- Name_Model_Mantissa : constant Name_Id := N + 443;
- Name_Model_Small : constant Name_Id := N + 444;
- Name_Modulus : constant Name_Id := N + 445;
- Name_Null_Parameter : constant Name_Id := N + 446; -- GNAT
- Name_Object_Size : constant Name_Id := N + 447; -- GNAT
- Name_Old : constant Name_Id := N + 448; -- GNAT
- Name_Partition_ID : constant Name_Id := N + 449;
- Name_Passed_By_Reference : constant Name_Id := N + 450; -- GNAT
- Name_Pool_Address : constant Name_Id := N + 451;
- Name_Pos : constant Name_Id := N + 452;
- Name_Position : constant Name_Id := N + 453;
- Name_Priority : constant Name_Id := N + 454; -- Ada 05
- Name_Range : constant Name_Id := N + 455;
- Name_Range_Length : constant Name_Id := N + 456; -- GNAT
- Name_Result : constant Name_Id := N + 457; -- GNAT
- Name_Round : constant Name_Id := N + 458;
- Name_Safe_Emax : constant Name_Id := N + 459; -- Ada 83
- Name_Safe_First : constant Name_Id := N + 460;
- Name_Safe_Large : constant Name_Id := N + 461; -- Ada 83
- Name_Safe_Last : constant Name_Id := N + 462;
- Name_Safe_Small : constant Name_Id := N + 463; -- Ada 83
- Name_Scale : constant Name_Id := N + 464;
- Name_Scaling : constant Name_Id := N + 465;
- Name_Signed_Zeros : constant Name_Id := N + 466;
- Name_Size : constant Name_Id := N + 467;
- Name_Small : constant Name_Id := N + 468;
- Name_Storage_Size : constant Name_Id := N + 469;
- Name_Storage_Unit : constant Name_Id := N + 470; -- GNAT
- Name_Stream_Size : constant Name_Id := N + 471; -- Ada 05
- Name_Tag : constant Name_Id := N + 472;
- Name_Target_Name : constant Name_Id := N + 473; -- GNAT
- Name_Terminated : constant Name_Id := N + 474;
- Name_To_Address : constant Name_Id := N + 475; -- GNAT
- Name_Type_Class : constant Name_Id := N + 476; -- GNAT
- Name_UET_Address : constant Name_Id := N + 477; -- GNAT
- Name_Unbiased_Rounding : constant Name_Id := N + 478;
- Name_Unchecked_Access : constant Name_Id := N + 479;
- Name_Unconstrained_Array : constant Name_Id := N + 480;
- Name_Universal_Literal_String : constant Name_Id := N + 481; -- GNAT
- Name_Unrestricted_Access : constant Name_Id := N + 482; -- GNAT
- Name_VADS_Size : constant Name_Id := N + 483; -- GNAT
- Name_Val : constant Name_Id := N + 484;
- Name_Valid : constant Name_Id := N + 485;
- Name_Value_Size : constant Name_Id := N + 486; -- GNAT
- Name_Version : constant Name_Id := N + 487;
- Name_Wchar_T_Size : constant Name_Id := N + 488; -- GNAT
- Name_Wide_Wide_Width : constant Name_Id := N + 489; -- Ada 05
- Name_Wide_Width : constant Name_Id := N + 490;
- Name_Width : constant Name_Id := N + 491;
- Name_Word_Size : constant Name_Id := N + 492; -- GNAT
+ First_Attribute_Name : constant Name_Id := N + 376;
+ Name_Abort_Signal : constant Name_Id := N + 376; -- GNAT
+ Name_Access : constant Name_Id := N + 377;
+ Name_Address : constant Name_Id := N + 378;
+ Name_Address_Size : constant Name_Id := N + 379; -- GNAT
+ Name_Aft : constant Name_Id := N + 380;
+ Name_Alignment : constant Name_Id := N + 381;
+ Name_Asm_Input : constant Name_Id := N + 382; -- GNAT
+ Name_Asm_Output : constant Name_Id := N + 383; -- GNAT
+ Name_AST_Entry : constant Name_Id := N + 384; -- VMS
+ Name_Bit : constant Name_Id := N + 385; -- GNAT
+ Name_Bit_Order : constant Name_Id := N + 386;
+ Name_Bit_Position : constant Name_Id := N + 387; -- GNAT
+ Name_Body_Version : constant Name_Id := N + 388;
+ Name_Callable : constant Name_Id := N + 389;
+ Name_Caller : constant Name_Id := N + 390;
+ Name_Code_Address : constant Name_Id := N + 391; -- GNAT
+ Name_Component_Size : constant Name_Id := N + 392;
+ Name_Compose : constant Name_Id := N + 393;
+ Name_Constrained : constant Name_Id := N + 394;
+ Name_Count : constant Name_Id := N + 395;
+ Name_Default_Bit_Order : constant Name_Id := N + 396; -- GNAT
+ Name_Definite : constant Name_Id := N + 397;
+ Name_Delta : constant Name_Id := N + 398;
+ Name_Denorm : constant Name_Id := N + 399;
+ Name_Digits : constant Name_Id := N + 400;
+ Name_Elaborated : constant Name_Id := N + 401; -- GNAT
+ Name_Emax : constant Name_Id := N + 402; -- Ada 83
+ Name_Enabled : constant Name_Id := N + 403; -- GNAT
+ Name_Enum_Rep : constant Name_Id := N + 404; -- GNAT
+ Name_Enum_Val : constant Name_Id := N + 405; -- GNAT
+ Name_Epsilon : constant Name_Id := N + 406; -- Ada 83
+ Name_Exponent : constant Name_Id := N + 407;
+ Name_External_Tag : constant Name_Id := N + 408;
+ Name_Fast_Math : constant Name_Id := N + 409; -- GNAT
+ Name_First : constant Name_Id := N + 410;
+ Name_First_Bit : constant Name_Id := N + 411;
+ Name_Fixed_Value : constant Name_Id := N + 412; -- GNAT
+ Name_Fore : constant Name_Id := N + 413;
+ Name_Has_Access_Values : constant Name_Id := N + 414; -- GNAT
+ Name_Has_Discriminants : constant Name_Id := N + 415; -- GNAT
+ Name_Has_Tagged_Values : constant Name_Id := N + 416; -- GNAT
+ Name_Identity : constant Name_Id := N + 417;
+ Name_Img : constant Name_Id := N + 418; -- GNAT
+ Name_Integer_Value : constant Name_Id := N + 419; -- GNAT
+ Name_Invalid_Value : constant Name_Id := N + 420; -- GNAT
+ Name_Large : constant Name_Id := N + 421; -- Ada 83
+ Name_Last : constant Name_Id := N + 422;
+ Name_Last_Bit : constant Name_Id := N + 423;
+ Name_Leading_Part : constant Name_Id := N + 424;
+ Name_Length : constant Name_Id := N + 425;
+ Name_Machine_Emax : constant Name_Id := N + 426;
+ Name_Machine_Emin : constant Name_Id := N + 427;
+ Name_Machine_Mantissa : constant Name_Id := N + 428;
+ Name_Machine_Overflows : constant Name_Id := N + 429;
+ Name_Machine_Radix : constant Name_Id := N + 430;
+ Name_Machine_Rounding : constant Name_Id := N + 431; -- Ada 05
+ Name_Machine_Rounds : constant Name_Id := N + 432;
+ Name_Machine_Size : constant Name_Id := N + 433; -- GNAT
+ Name_Mantissa : constant Name_Id := N + 434; -- Ada 83
+ Name_Max_Size_In_Storage_Elements : constant Name_Id := N + 435;
+ Name_Maximum_Alignment : constant Name_Id := N + 436; -- GNAT
+ Name_Mechanism_Code : constant Name_Id := N + 437; -- GNAT
+ Name_Mod : constant Name_Id := N + 438; -- Ada 05
+ Name_Model_Emin : constant Name_Id := N + 439;
+ Name_Model_Epsilon : constant Name_Id := N + 440;
+ Name_Model_Mantissa : constant Name_Id := N + 441;
+ Name_Model_Small : constant Name_Id := N + 442;
+ Name_Modulus : constant Name_Id := N + 443;
+ Name_Null_Parameter : constant Name_Id := N + 444; -- GNAT
+ Name_Object_Size : constant Name_Id := N + 445; -- GNAT
+ Name_Old : constant Name_Id := N + 446; -- GNAT
+ Name_Partition_ID : constant Name_Id := N + 447;
+ Name_Passed_By_Reference : constant Name_Id := N + 448; -- GNAT
+ Name_Pool_Address : constant Name_Id := N + 449;
+ Name_Pos : constant Name_Id := N + 450;
+ Name_Position : constant Name_Id := N + 451;
+ Name_Priority : constant Name_Id := N + 452; -- Ada 05
+ Name_Range : constant Name_Id := N + 453;
+ Name_Range_Length : constant Name_Id := N + 454; -- GNAT
+ Name_Result : constant Name_Id := N + 455; -- GNAT
+ Name_Round : constant Name_Id := N + 456;
+ Name_Safe_Emax : constant Name_Id := N + 457; -- Ada 83
+ Name_Safe_First : constant Name_Id := N + 458;
+ Name_Safe_Large : constant Name_Id := N + 459; -- Ada 83
+ Name_Safe_Last : constant Name_Id := N + 460;
+ Name_Safe_Small : constant Name_Id := N + 461; -- Ada 83
+ Name_Scale : constant Name_Id := N + 462;
+ Name_Scaling : constant Name_Id := N + 463;
+ Name_Signed_Zeros : constant Name_Id := N + 464;
+ Name_Size : constant Name_Id := N + 465;
+ Name_Small : constant Name_Id := N + 466;
+ Name_Storage_Size : constant Name_Id := N + 467;
+ Name_Storage_Unit : constant Name_Id := N + 468; -- GNAT
+ Name_Stream_Size : constant Name_Id := N + 469; -- Ada 05
+ Name_Tag : constant Name_Id := N + 470;
+ Name_Target_Name : constant Name_Id := N + 471; -- GNAT
+ Name_Terminated : constant Name_Id := N + 472;
+ Name_To_Address : constant Name_Id := N + 473; -- GNAT
+ Name_Type_Class : constant Name_Id := N + 474; -- GNAT
+ Name_UET_Address : constant Name_Id := N + 475; -- GNAT
+ Name_Unbiased_Rounding : constant Name_Id := N + 476;
+ Name_Unchecked_Access : constant Name_Id := N + 477;
+ Name_Unconstrained_Array : constant Name_Id := N + 478;
+ Name_Universal_Literal_String : constant Name_Id := N + 479; -- GNAT
+ Name_Unrestricted_Access : constant Name_Id := N + 480; -- GNAT
+ Name_VADS_Size : constant Name_Id := N + 481; -- GNAT
+ Name_Val : constant Name_Id := N + 482;
+ Name_Valid : constant Name_Id := N + 483;
+ Name_Value_Size : constant Name_Id := N + 484; -- GNAT
+ Name_Version : constant Name_Id := N + 485;
+ Name_Wchar_T_Size : constant Name_Id := N + 486; -- GNAT
+ Name_Wide_Wide_Width : constant Name_Id := N + 487; -- Ada 05
+ Name_Wide_Width : constant Name_Id := N + 488;
+ Name_Width : constant Name_Id := N + 489;
+ Name_Word_Size : constant Name_Id := N + 490; -- GNAT
-- Attributes that designate attributes returning renamable functions,
-- i.e. functions that return other than a universal value and that
-- have non-universal arguments.
- First_Renamable_Function_Attribute : constant Name_Id := N + 493;
- Name_Adjacent : constant Name_Id := N + 493;
- Name_Ceiling : constant Name_Id := N + 494;
- Name_Copy_Sign : constant Name_Id := N + 495;
- Name_Floor : constant Name_Id := N + 496;
- Name_Fraction : constant Name_Id := N + 497;
- Name_Image : constant Name_Id := N + 498;
- Name_Input : constant Name_Id := N + 499;
- Name_Machine : constant Name_Id := N + 500;
- Name_Max : constant Name_Id := N + 501;
- Name_Min : constant Name_Id := N + 502;
- Name_Model : constant Name_Id := N + 503;
- Name_Pred : constant Name_Id := N + 504;
- Name_Remainder : constant Name_Id := N + 505;
- Name_Rounding : constant Name_Id := N + 506;
- Name_Succ : constant Name_Id := N + 507;
+ First_Renamable_Function_Attribute : constant Name_Id := N + 491;
+ Name_Adjacent : constant Name_Id := N + 491;
+ Name_Ceiling : constant Name_Id := N + 492;
+ Name_Copy_Sign : constant Name_Id := N + 493;
+ Name_Floor : constant Name_Id := N + 494;
+ Name_Fraction : constant Name_Id := N + 495;
+ Name_From_Any : constant Name_Id := N + 496; -- GNAT
+ Name_Image : constant Name_Id := N + 497;
+ Name_Input : constant Name_Id := N + 498;
+ Name_Machine : constant Name_Id := N + 499;
+ Name_Max : constant Name_Id := N + 500;
+ Name_Min : constant Name_Id := N + 501;
+ Name_Model : constant Name_Id := N + 502;
+ Name_Pred : constant Name_Id := N + 503;
+ Name_Remainder : constant Name_Id := N + 504;
+ Name_Rounding : constant Name_Id := N + 505;
+ Name_Succ : constant Name_Id := N + 506;
+ Name_To_Any : constant Name_Id := N + 507; -- GNAT
Name_Truncation : constant Name_Id := N + 508;
- Name_Value : constant Name_Id := N + 509;
- Name_Wide_Image : constant Name_Id := N + 510;
- Name_Wide_Wide_Image : constant Name_Id := N + 511;
- Name_Wide_Value : constant Name_Id := N + 512;
- Name_Wide_Wide_Value : constant Name_Id := N + 513;
- Last_Renamable_Function_Attribute : constant Name_Id := N + 513;
+ Name_TypeCode : constant Name_Id := N + 509; -- GNAT
+ Name_Value : constant Name_Id := N + 510;
+ Name_Wide_Image : constant Name_Id := N + 511;
+ Name_Wide_Wide_Image : constant Name_Id := N + 512;
+ Name_Wide_Value : constant Name_Id := N + 513;
+ Name_Wide_Wide_Value : constant Name_Id := N + 514;
+ Last_Renamable_Function_Attribute : constant Name_Id := N + 514;
-- Attributes that designate procedures
- First_Procedure_Attribute : constant Name_Id := N + 514;
- Name_Output : constant Name_Id := N + 514;
- Name_Read : constant Name_Id := N + 515;
- Name_Write : constant Name_Id := N + 516;
- Last_Procedure_Attribute : constant Name_Id := N + 516;
+ First_Procedure_Attribute : constant Name_Id := N + 515;
+ Name_Output : constant Name_Id := N + 515;
+ Name_Read : constant Name_Id := N + 516;
+ Name_Write : constant Name_Id := N + 517;
+ Last_Procedure_Attribute : constant Name_Id := N + 517;
-- Remaining attributes are ones that return entities
- First_Entity_Attribute_Name : constant Name_Id := N + 517;
- Name_Elab_Body : constant Name_Id := N + 517; -- GNAT
- Name_Elab_Spec : constant Name_Id := N + 518; -- GNAT
- Name_Storage_Pool : constant Name_Id := N + 519;
+ First_Entity_Attribute_Name : constant Name_Id := N + 518;
+ Name_Elab_Body : constant Name_Id := N + 518; -- GNAT
+ Name_Elab_Spec : constant Name_Id := N + 519; -- GNAT
+ Name_Storage_Pool : constant Name_Id := N + 520;
-- These attributes are the ones that return types
- First_Type_Attribute_Name : constant Name_Id := N + 520;
- Name_Base : constant Name_Id := N + 520;
- Name_Class : constant Name_Id := N + 521;
- Name_Stub_Type : constant Name_Id := N + 522;
- Last_Type_Attribute_Name : constant Name_Id := N + 522;
- Last_Entity_Attribute_Name : constant Name_Id := N + 522;
- Last_Attribute_Name : constant Name_Id := N + 522;
+ First_Type_Attribute_Name : constant Name_Id := N + 521;
+ Name_Base : constant Name_Id := N + 521;
+ Name_Class : constant Name_Id := N + 522;
+ Name_Stub_Type : constant Name_Id := N + 523;
+ Last_Type_Attribute_Name : constant Name_Id := N + 523;
+ Last_Entity_Attribute_Name : constant Name_Id := N + 523;
+ Last_Attribute_Name : constant Name_Id := N + 523;
-- Names of recognized locking policy identifiers
@@ -847,10 +851,10 @@ package Snames is
-- name (e.g. C for Ceiling_Locking). If new policy names are added,
-- the first character must be distinct.
- First_Locking_Policy_Name : constant Name_Id := N + 523;
- Name_Ceiling_Locking : constant Name_Id := N + 523;
- Name_Inheritance_Locking : constant Name_Id := N + 524;
- Last_Locking_Policy_Name : constant Name_Id := N + 524;
+ First_Locking_Policy_Name : constant Name_Id := N + 524;
+ Name_Ceiling_Locking : constant Name_Id := N + 524;
+ Name_Inheritance_Locking : constant Name_Id := N + 525;
+ Last_Locking_Policy_Name : constant Name_Id := N + 525;
-- Names of recognized queuing policy identifiers
@@ -858,10 +862,10 @@ package Snames is
-- name (e.g. F for FIFO_Queuing). If new policy names are added,
-- the first character must be distinct.
- First_Queuing_Policy_Name : constant Name_Id := N + 525;
- Name_FIFO_Queuing : constant Name_Id := N + 525;
- Name_Priority_Queuing : constant Name_Id := N + 526;
- Last_Queuing_Policy_Name : constant Name_Id := N + 526;
+ First_Queuing_Policy_Name : constant Name_Id := N + 526;
+ Name_FIFO_Queuing : constant Name_Id := N + 526;
+ Name_Priority_Queuing : constant Name_Id := N + 527;
+ Last_Queuing_Policy_Name : constant Name_Id := N + 527;
-- Names of recognized task dispatching policy identifiers
@@ -869,283 +873,285 @@ package Snames is
-- name (e.g. F for FIFO_Within_Priorities). If new policy names
-- are added, the first character must be distinct.
- First_Task_Dispatching_Policy_Name : constant Name_Id := N + 527;
- Name_EDF_Across_Priorities : constant Name_Id := N + 527;
- Name_FIFO_Within_Priorities : constant Name_Id := N + 528;
- Name_Non_Preemptive_Within_Priorities : constant Name_Id := N + 529;
- Name_Round_Robin_Within_Priorities : constant Name_Id := N + 530;
- Last_Task_Dispatching_Policy_Name : constant Name_Id := N + 530;
+ First_Task_Dispatching_Policy_Name : constant Name_Id := N + 528;
+ Name_EDF_Across_Priorities : constant Name_Id := N + 528;
+ Name_FIFO_Within_Priorities : constant Name_Id := N + 529;
+ Name_Non_Preemptive_Within_Priorities : constant Name_Id := N + 530;
+ Name_Round_Robin_Within_Priorities : constant Name_Id := N + 531;
+ Last_Task_Dispatching_Policy_Name : constant Name_Id := N + 531;
-- Names of recognized checks for pragma Suppress
- First_Check_Name : constant Name_Id := N + 531;
- Name_Access_Check : constant Name_Id := N + 531;
- Name_Accessibility_Check : constant Name_Id := N + 532;
- Name_Alignment_Check : constant Name_Id := N + 533; -- GNAT
- Name_Discriminant_Check : constant Name_Id := N + 534;
- Name_Division_Check : constant Name_Id := N + 535;
- Name_Elaboration_Check : constant Name_Id := N + 536;
- Name_Index_Check : constant Name_Id := N + 537;
- Name_Length_Check : constant Name_Id := N + 538;
- Name_Overflow_Check : constant Name_Id := N + 539;
- Name_Range_Check : constant Name_Id := N + 540;
- Name_Storage_Check : constant Name_Id := N + 541;
- Name_Tag_Check : constant Name_Id := N + 542;
- Name_Validity_Check : constant Name_Id := N + 543; -- GNAT
- Name_All_Checks : constant Name_Id := N + 544;
- Last_Check_Name : constant Name_Id := N + 544;
+ First_Check_Name : constant Name_Id := N + 532;
+ Name_Access_Check : constant Name_Id := N + 532;
+ Name_Accessibility_Check : constant Name_Id := N + 533;
+ Name_Alignment_Check : constant Name_Id := N + 534; -- GNAT
+ Name_Discriminant_Check : constant Name_Id := N + 535;
+ Name_Division_Check : constant Name_Id := N + 536;
+ Name_Elaboration_Check : constant Name_Id := N + 537;
+ Name_Index_Check : constant Name_Id := N + 538;
+ Name_Length_Check : constant Name_Id := N + 539;
+ Name_Overflow_Check : constant Name_Id := N + 540;
+ Name_Range_Check : constant Name_Id := N + 541;
+ Name_Storage_Check : constant Name_Id := N + 542;
+ Name_Tag_Check : constant Name_Id := N + 543;
+ Name_Validity_Check : constant Name_Id := N + 544; -- GNAT
+ Name_All_Checks : constant Name_Id := N + 545;
+ Last_Check_Name : constant Name_Id := N + 545;
-- Names corresponding to reserved keywords, excluding those already
-- declared in the attribute list (Access, Delta, Digits, Mod, Range).
- Name_Abort : constant Name_Id := N + 545;
- Name_Abs : constant Name_Id := N + 546;
- Name_Accept : constant Name_Id := N + 547;
- Name_And : constant Name_Id := N + 548;
- Name_All : constant Name_Id := N + 549;
- Name_Array : constant Name_Id := N + 550;
- Name_At : constant Name_Id := N + 551;
- Name_Begin : constant Name_Id := N + 552;
- Name_Body : constant Name_Id := N + 553;
- Name_Case : constant Name_Id := N + 554;
- Name_Constant : constant Name_Id := N + 555;
- Name_Declare : constant Name_Id := N + 556;
- Name_Delay : constant Name_Id := N + 557;
- Name_Do : constant Name_Id := N + 558;
- Name_Else : constant Name_Id := N + 559;
- Name_Elsif : constant Name_Id := N + 560;
- Name_End : constant Name_Id := N + 561;
- Name_Entry : constant Name_Id := N + 562;
- Name_Exception : constant Name_Id := N + 563;
- Name_Exit : constant Name_Id := N + 564;
- Name_For : constant Name_Id := N + 565;
- Name_Function : constant Name_Id := N + 566;
- Name_Generic : constant Name_Id := N + 567;
- Name_Goto : constant Name_Id := N + 568;
- Name_If : constant Name_Id := N + 569;
- Name_In : constant Name_Id := N + 570;
- Name_Is : constant Name_Id := N + 571;
- Name_Limited : constant Name_Id := N + 572;
- Name_Loop : constant Name_Id := N + 573;
- Name_New : constant Name_Id := N + 574;
- Name_Not : constant Name_Id := N + 575;
- Name_Null : constant Name_Id := N + 576;
- Name_Of : constant Name_Id := N + 577;
- Name_Or : constant Name_Id := N + 578;
- Name_Others : constant Name_Id := N + 579;
- Name_Out : constant Name_Id := N + 580;
- Name_Package : constant Name_Id := N + 581;
- Name_Pragma : constant Name_Id := N + 582;
- Name_Private : constant Name_Id := N + 583;
- Name_Procedure : constant Name_Id := N + 584;
- Name_Raise : constant Name_Id := N + 585;
- Name_Record : constant Name_Id := N + 586;
- Name_Rem : constant Name_Id := N + 587;
- Name_Renames : constant Name_Id := N + 588;
- Name_Return : constant Name_Id := N + 589;
- Name_Reverse : constant Name_Id := N + 590;
- Name_Select : constant Name_Id := N + 591;
- Name_Separate : constant Name_Id := N + 592;
- Name_Subtype : constant Name_Id := N + 593;
- Name_Task : constant Name_Id := N + 594;
- Name_Terminate : constant Name_Id := N + 595;
- Name_Then : constant Name_Id := N + 596;
- Name_Type : constant Name_Id := N + 597;
- Name_Use : constant Name_Id := N + 598;
- Name_When : constant Name_Id := N + 599;
- Name_While : constant Name_Id := N + 600;
- Name_With : constant Name_Id := N + 601;
- Name_Xor : constant Name_Id := N + 602;
+ Name_Abort : constant Name_Id := N + 546;
+ Name_Abs : constant Name_Id := N + 547;
+ Name_Accept : constant Name_Id := N + 548;
+ Name_And : constant Name_Id := N + 549;
+ Name_All : constant Name_Id := N + 550;
+ Name_Array : constant Name_Id := N + 551;
+ Name_At : constant Name_Id := N + 552;
+ Name_Begin : constant Name_Id := N + 553;
+ Name_Body : constant Name_Id := N + 554;
+ Name_Case : constant Name_Id := N + 555;
+ Name_Constant : constant Name_Id := N + 556;
+ Name_Declare : constant Name_Id := N + 557;
+ Name_Delay : constant Name_Id := N + 558;
+ Name_Do : constant Name_Id := N + 559;
+ Name_Else : constant Name_Id := N + 560;
+ Name_Elsif : constant Name_Id := N + 561;
+ Name_End : constant Name_Id := N + 562;
+ Name_Entry : constant Name_Id := N + 563;
+ Name_Exception : constant Name_Id := N + 564;
+ Name_Exit : constant Name_Id := N + 565;
+ Name_For : constant Name_Id := N + 566;
+ Name_Function : constant Name_Id := N + 567;
+ Name_Generic : constant Name_Id := N + 568;
+ Name_Goto : constant Name_Id := N + 569;
+ Name_If : constant Name_Id := N + 570;
+ Name_In : constant Name_Id := N + 571;
+ Name_Is : constant Name_Id := N + 572;
+ Name_Limited : constant Name_Id := N + 573;
+ Name_Loop : constant Name_Id := N + 574;
+ Name_New : constant Name_Id := N + 575;
+ Name_Not : constant Name_Id := N + 576;
+ Name_Null : constant Name_Id := N + 577;
+ Name_Of : constant Name_Id := N + 578;
+ Name_Or : constant Name_Id := N + 579;
+ Name_Others : constant Name_Id := N + 580;
+ Name_Out : constant Name_Id := N + 581;
+ Name_Package : constant Name_Id := N + 582;
+ Name_Pragma : constant Name_Id := N + 583;
+ Name_Private : constant Name_Id := N + 584;
+ Name_Procedure : constant Name_Id := N + 585;
+ Name_Raise : constant Name_Id := N + 586;
+ Name_Record : constant Name_Id := N + 587;
+ Name_Rem : constant Name_Id := N + 588;
+ Name_Renames : constant Name_Id := N + 589;
+ Name_Return : constant Name_Id := N + 590;
+ Name_Reverse : constant Name_Id := N + 591;
+ Name_Select : constant Name_Id := N + 592;
+ Name_Separate : constant Name_Id := N + 593;
+ Name_Subtype : constant Name_Id := N + 594;
+ Name_Task : constant Name_Id := N + 595;
+ Name_Terminate : constant Name_Id := N + 596;
+ Name_Then : constant Name_Id := N + 597;
+ Name_Type : constant Name_Id := N + 598;
+ Name_Use : constant Name_Id := N + 599;
+ Name_When : constant Name_Id := N + 600;
+ Name_While : constant Name_Id := N + 601;
+ Name_With : constant Name_Id := N + 602;
+ Name_Xor : constant Name_Id := N + 603;
-- Names of intrinsic subprograms
-- Note: Asm is missing from this list, since Asm is a legitimate
-- convention name. So is To_Address, which is a GNAT attribute.
- First_Intrinsic_Name : constant Name_Id := N + 603;
- Name_Divide : constant Name_Id := N + 603;
- Name_Enclosing_Entity : constant Name_Id := N + 604;
- Name_Exception_Information : constant Name_Id := N + 605;
- Name_Exception_Message : constant Name_Id := N + 606;
- Name_Exception_Name : constant Name_Id := N + 607;
- Name_File : constant Name_Id := N + 608;
- Name_Generic_Dispatching_Constructor : constant Name_Id := N + 609;
- Name_Import_Address : constant Name_Id := N + 610;
- Name_Import_Largest_Value : constant Name_Id := N + 611;
- Name_Import_Value : constant Name_Id := N + 612;
- Name_Is_Negative : constant Name_Id := N + 613;
- Name_Line : constant Name_Id := N + 614;
- Name_Rotate_Left : constant Name_Id := N + 615;
- Name_Rotate_Right : constant Name_Id := N + 616;
- Name_Shift_Left : constant Name_Id := N + 617;
- Name_Shift_Right : constant Name_Id := N + 618;
- Name_Shift_Right_Arithmetic : constant Name_Id := N + 619;
- Name_Source_Location : constant Name_Id := N + 620;
- Name_Unchecked_Conversion : constant Name_Id := N + 621;
- Name_Unchecked_Deallocation : constant Name_Id := N + 622;
- Name_To_Pointer : constant Name_Id := N + 623;
- Last_Intrinsic_Name : constant Name_Id := N + 623;
+ First_Intrinsic_Name : constant Name_Id := N + 604;
+ Name_Divide : constant Name_Id := N + 604;
+ Name_Enclosing_Entity : constant Name_Id := N + 605;
+ Name_Exception_Information : constant Name_Id := N + 606;
+ Name_Exception_Message : constant Name_Id := N + 607;
+ Name_Exception_Name : constant Name_Id := N + 608;
+ Name_File : constant Name_Id := N + 609;
+ Name_Generic_Dispatching_Constructor : constant Name_Id := N + 610;
+ Name_Import_Address : constant Name_Id := N + 611;
+ Name_Import_Largest_Value : constant Name_Id := N + 612;
+ Name_Import_Value : constant Name_Id := N + 613;
+ Name_Is_Negative : constant Name_Id := N + 614;
+ Name_Line : constant Name_Id := N + 615;
+ Name_Rotate_Left : constant Name_Id := N + 616;
+ Name_Rotate_Right : constant Name_Id := N + 617;
+ Name_Shift_Left : constant Name_Id := N + 618;
+ Name_Shift_Right : constant Name_Id := N + 619;
+ Name_Shift_Right_Arithmetic : constant Name_Id := N + 620;
+ Name_Source_Location : constant Name_Id := N + 621;
+ Name_Unchecked_Conversion : constant Name_Id := N + 622;
+ Name_Unchecked_Deallocation : constant Name_Id := N + 623;
+ Name_To_Pointer : constant Name_Id := N + 624;
+ Last_Intrinsic_Name : constant Name_Id := N + 624;
-- Names used in processing intrinsic calls
- Name_Free : constant Name_Id := N + 624;
+ Name_Free : constant Name_Id := N + 625;
-- Reserved words used only in Ada 95
- First_95_Reserved_Word : constant Name_Id := N + 625;
- Name_Abstract : constant Name_Id := N + 625;
- Name_Aliased : constant Name_Id := N + 626;
- Name_Protected : constant Name_Id := N + 627;
- Name_Until : constant Name_Id := N + 628;
- Name_Requeue : constant Name_Id := N + 629;
- Name_Tagged : constant Name_Id := N + 630;
- Last_95_Reserved_Word : constant Name_Id := N + 630;
+ First_95_Reserved_Word : constant Name_Id := N + 626;
+ Name_Abstract : constant Name_Id := N + 626;
+ Name_Aliased : constant Name_Id := N + 627;
+ Name_Protected : constant Name_Id := N + 628;
+ Name_Until : constant Name_Id := N + 629;
+ Name_Requeue : constant Name_Id := N + 630;
+ Name_Tagged : constant Name_Id := N + 631;
+ Last_95_Reserved_Word : constant Name_Id := N + 631;
subtype Ada_95_Reserved_Words is
Name_Id range First_95_Reserved_Word .. Last_95_Reserved_Word;
-- Miscellaneous names used in semantic checking
- Name_Raise_Exception : constant Name_Id := N + 631;
+ Name_Raise_Exception : constant Name_Id := N + 632;
-- Additional reserved words and identifiers used in GNAT Project Files
-- Note that Name_External is already previously declared
- Name_Ada_Roots : constant Name_Id := N + 632;
- Name_Aggregate : constant Name_Id := N + 633;
- Name_Archive_Builder : constant Name_Id := N + 634;
- Name_Archive_Builder_Append_Option : constant Name_Id := N + 635;
- Name_Archive_Indexer : constant Name_Id := N + 636;
- Name_Archive_Suffix : constant Name_Id := N + 637;
- Name_Binder : constant Name_Id := N + 638;
- Name_Binder_Prefix : constant Name_Id := N + 639;
- Name_Body_Suffix : constant Name_Id := N + 640;
- Name_Builder : constant Name_Id := N + 641;
- Name_Builder_Switches : constant Name_Id := N + 642;
- Name_Compiler : constant Name_Id := N + 643;
- Name_Compiler_Kind : constant Name_Id := N + 644;
- Name_Config_Body_File_Name : constant Name_Id := N + 645;
- Name_Config_Body_File_Name_Pattern : constant Name_Id := N + 646;
- Name_Config_File_Switches : constant Name_Id := N + 647;
- Name_Config_File_Unique : constant Name_Id := N + 648;
- Name_Config_Spec_File_Name : constant Name_Id := N + 649;
- Name_Config_Spec_File_Name_Pattern : constant Name_Id := N + 650;
- Name_Configuration : constant Name_Id := N + 651;
- Name_Cross_Reference : constant Name_Id := N + 652;
- Name_Default_Language : constant Name_Id := N + 653;
- Name_Default_Switches : constant Name_Id := N + 654;
- Name_Dependency_Driver : constant Name_Id := N + 655;
- Name_Dependency_File_Kind : constant Name_Id := N + 656;
- Name_Dependency_Switches : constant Name_Id := N + 657;
- Name_Driver : constant Name_Id := N + 658;
- Name_Excluded_Source_Dirs : constant Name_Id := N + 659;
- Name_Excluded_Source_Files : constant Name_Id := N + 660;
- Name_Excluded_Source_List_File : constant Name_Id := N + 661;
- Name_Exec_Dir : constant Name_Id := N + 662;
- Name_Executable : constant Name_Id := N + 663;
- Name_Executable_Suffix : constant Name_Id := N + 664;
- Name_Extends : constant Name_Id := N + 665;
- Name_Externally_Built : constant Name_Id := N + 666;
- Name_Finder : constant Name_Id := N + 667;
- Name_Global_Configuration_Pragmas : constant Name_Id := N + 668;
- Name_Global_Config_File : constant Name_Id := N + 669;
- Name_Gnatls : constant Name_Id := N + 670;
- Name_Gnatstub : constant Name_Id := N + 671;
- Name_Implementation : constant Name_Id := N + 672;
- Name_Implementation_Exceptions : constant Name_Id := N + 673;
- Name_Implementation_Suffix : constant Name_Id := N + 674;
- Name_Include_Switches : constant Name_Id := N + 675;
- Name_Include_Path : constant Name_Id := N + 676;
- Name_Include_Path_File : constant Name_Id := N + 677;
- Name_Inherit_Source_Path : constant Name_Id := N + 678;
- Name_Language_Kind : constant Name_Id := N + 679;
- Name_Language_Processing : constant Name_Id := N + 680;
- Name_Languages : constant Name_Id := N + 681;
- Name_Library : constant Name_Id := N + 682;
- Name_Library_Ali_Dir : constant Name_Id := N + 683;
- Name_Library_Auto_Init : constant Name_Id := N + 684;
- Name_Library_Auto_Init_Supported : constant Name_Id := N + 685;
- Name_Library_Builder : constant Name_Id := N + 686;
- Name_Library_Dir : constant Name_Id := N + 687;
- Name_Library_GCC : constant Name_Id := N + 688;
- Name_Library_Interface : constant Name_Id := N + 689;
- Name_Library_Kind : constant Name_Id := N + 690;
- Name_Library_Name : constant Name_Id := N + 691;
- Name_Library_Major_Minor_Id_Supported : constant Name_Id := N + 692;
- Name_Library_Options : constant Name_Id := N + 693;
- Name_Library_Partial_Linker : constant Name_Id := N + 694;
- Name_Library_Reference_Symbol_File : constant Name_Id := N + 695;
- Name_Library_Src_Dir : constant Name_Id := N + 696;
- Name_Library_Support : constant Name_Id := N + 697;
- Name_Library_Symbol_File : constant Name_Id := N + 698;
- Name_Library_Symbol_Policy : constant Name_Id := N + 699;
- Name_Library_Version : constant Name_Id := N + 700;
- Name_Library_Version_Switches : constant Name_Id := N + 701;
- Name_Linker : constant Name_Id := N + 702;
- Name_Linker_Executable_Option : constant Name_Id := N + 703;
- Name_Linker_Lib_Dir_Option : constant Name_Id := N + 704;
- Name_Linker_Lib_Name_Option : constant Name_Id := N + 705;
- Name_Local_Config_File : constant Name_Id := N + 706;
- Name_Local_Configuration_Pragmas : constant Name_Id := N + 707;
- Name_Locally_Removed_Files : constant Name_Id := N + 708;
- Name_Map_File_Option : constant Name_Id := N + 709;
- Name_Mapping_File_Switches : constant Name_Id := N + 710;
- Name_Mapping_Spec_Suffix : constant Name_Id := N + 711;
- Name_Mapping_Body_Suffix : constant Name_Id := N + 712;
- Name_Metrics : constant Name_Id := N + 713;
- Name_Naming : constant Name_Id := N + 714;
- Name_Object_Generated : constant Name_Id := N + 715;
- Name_Objects_Linked : constant Name_Id := N + 716;
- Name_Objects_Path : constant Name_Id := N + 717;
- Name_Objects_Path_File : constant Name_Id := N + 718;
- Name_Object_Dir : constant Name_Id := N + 719;
- Name_Pic_Option : constant Name_Id := N + 720;
- Name_Pretty_Printer : constant Name_Id := N + 721;
- Name_Prefix : constant Name_Id := N + 722;
- Name_Project : constant Name_Id := N + 723;
- Name_Roots : constant Name_Id := N + 724;
- Name_Required_Switches : constant Name_Id := N + 725;
- Name_Run_Path_Option : constant Name_Id := N + 726;
- Name_Runtime_Project : constant Name_Id := N + 727;
- Name_Shared_Library_Minimum_Switches : constant Name_Id := N + 728;
- Name_Shared_Library_Prefix : constant Name_Id := N + 729;
- Name_Shared_Library_Suffix : constant Name_Id := N + 730;
- Name_Separate_Suffix : constant Name_Id := N + 731;
- Name_Source_Dirs : constant Name_Id := N + 732;
- Name_Source_Files : constant Name_Id := N + 733;
- Name_Source_List_File : constant Name_Id := N + 734;
- Name_Spec : constant Name_Id := N + 735;
- Name_Spec_Suffix : constant Name_Id := N + 736;
- Name_Specification : constant Name_Id := N + 737;
- Name_Specification_Exceptions : constant Name_Id := N + 738;
- Name_Specification_Suffix : constant Name_Id := N + 739;
- Name_Stack : constant Name_Id := N + 740;
- Name_Switches : constant Name_Id := N + 741;
- Name_Symbolic_Link_Supported : constant Name_Id := N + 742;
- Name_Sync : constant Name_Id := N + 743;
- Name_Synchronize : constant Name_Id := N + 744;
- Name_Toolchain_Description : constant Name_Id := N + 745;
- Name_Toolchain_Version : constant Name_Id := N + 746;
- Name_Runtime_Library_Dir : constant Name_Id := N + 747;
+ Name_Ada_Roots : constant Name_Id := N + 633;
+ Name_Aggregate : constant Name_Id := N + 634;
+ Name_Archive_Builder : constant Name_Id := N + 635;
+ Name_Archive_Builder_Append_Option : constant Name_Id := N + 636;
+ Name_Archive_Indexer : constant Name_Id := N + 637;
+ Name_Archive_Suffix : constant Name_Id := N + 638;
+ Name_Binder : constant Name_Id := N + 639;
+ Name_Binder_Prefix : constant Name_Id := N + 640;
+ Name_Body_Suffix : constant Name_Id := N + 641;
+ Name_Builder : constant Name_Id := N + 642;
+ Name_Builder_Switches : constant Name_Id := N + 643;
+ Name_Compiler : constant Name_Id := N + 644;
+ Name_Compiler_Kind : constant Name_Id := N + 645;
+ Name_Config_Body_File_Name : constant Name_Id := N + 646;
+ Name_Config_Body_File_Name_Pattern : constant Name_Id := N + 647;
+ Name_Config_File_Switches : constant Name_Id := N + 648;
+ Name_Config_File_Unique : constant Name_Id := N + 649;
+ Name_Config_Spec_File_Name : constant Name_Id := N + 650;
+ Name_Config_Spec_File_Name_Pattern : constant Name_Id := N + 651;
+ Name_Configuration : constant Name_Id := N + 652;
+ Name_Cross_Reference : constant Name_Id := N + 653;
+ Name_Default_Language : constant Name_Id := N + 654;
+ Name_Default_Switches : constant Name_Id := N + 655;
+ Name_Dependency_Driver : constant Name_Id := N + 656;
+ Name_Dependency_File_Kind : constant Name_Id := N + 657;
+ Name_Dependency_Switches : constant Name_Id := N + 658;
+ Name_Driver : constant Name_Id := N + 659;
+ Name_Excluded_Source_Dirs : constant Name_Id := N + 660;
+ Name_Excluded_Source_Files : constant Name_Id := N + 661;
+ Name_Excluded_Source_List_File : constant Name_Id := N + 662;
+ Name_Exec_Dir : constant Name_Id := N + 663;
+ Name_Executable : constant Name_Id := N + 664;
+ Name_Executable_Suffix : constant Name_Id := N + 665;
+ Name_Extends : constant Name_Id := N + 666;
+ Name_Externally_Built : constant Name_Id := N + 667;
+ Name_Finder : constant Name_Id := N + 668;
+ Name_Global_Compilation_Switches : constant Name_Id := N + 669;
+ Name_Global_Configuration_Pragmas : constant Name_Id := N + 670;
+ Name_Global_Config_File : constant Name_Id := N + 671;
+ Name_Gnatls : constant Name_Id := N + 672;
+ Name_Gnatstub : constant Name_Id := N + 673;
+ Name_Implementation : constant Name_Id := N + 674;
+ Name_Implementation_Exceptions : constant Name_Id := N + 675;
+ Name_Implementation_Suffix : constant Name_Id := N + 676;
+ Name_Include_Switches : constant Name_Id := N + 677;
+ Name_Include_Path : constant Name_Id := N + 678;
+ Name_Include_Path_File : constant Name_Id := N + 679;
+ Name_Inherit_Source_Path : constant Name_Id := N + 680;
+ Name_Language_Kind : constant Name_Id := N + 681;
+ Name_Language_Processing : constant Name_Id := N + 682;
+ Name_Languages : constant Name_Id := N + 683;
+ Name_Library : constant Name_Id := N + 684;
+ Name_Library_Ali_Dir : constant Name_Id := N + 685;
+ Name_Library_Auto_Init : constant Name_Id := N + 686;
+ Name_Library_Auto_Init_Supported : constant Name_Id := N + 687;
+ Name_Library_Builder : constant Name_Id := N + 688;
+ Name_Library_Dir : constant Name_Id := N + 689;
+ Name_Library_GCC : constant Name_Id := N + 690;
+ Name_Library_Interface : constant Name_Id := N + 691;
+ Name_Library_Kind : constant Name_Id := N + 692;
+ Name_Library_Name : constant Name_Id := N + 693;
+ Name_Library_Major_Minor_Id_Supported : constant Name_Id := N + 694;
+ Name_Library_Options : constant Name_Id := N + 695;
+ Name_Library_Partial_Linker : constant Name_Id := N + 696;
+ Name_Library_Reference_Symbol_File : constant Name_Id := N + 697;
+ Name_Library_Src_Dir : constant Name_Id := N + 698;
+ Name_Library_Support : constant Name_Id := N + 699;
+ Name_Library_Symbol_File : constant Name_Id := N + 700;
+ Name_Library_Symbol_Policy : constant Name_Id := N + 701;
+ Name_Library_Version : constant Name_Id := N + 702;
+ Name_Library_Version_Switches : constant Name_Id := N + 703;
+ Name_Linker : constant Name_Id := N + 704;
+ Name_Linker_Executable_Option : constant Name_Id := N + 705;
+ Name_Linker_Lib_Dir_Option : constant Name_Id := N + 706;
+ Name_Linker_Lib_Name_Option : constant Name_Id := N + 707;
+ Name_Local_Config_File : constant Name_Id := N + 708;
+ Name_Local_Configuration_Pragmas : constant Name_Id := N + 709;
+ Name_Locally_Removed_Files : constant Name_Id := N + 710;
+ Name_Map_File_Option : constant Name_Id := N + 711;
+ Name_Mapping_File_Switches : constant Name_Id := N + 712;
+ Name_Mapping_Spec_Suffix : constant Name_Id := N + 713;
+ Name_Mapping_Body_Suffix : constant Name_Id := N + 714;
+ Name_Metrics : constant Name_Id := N + 715;
+ Name_Naming : constant Name_Id := N + 716;
+ Name_Object_Generated : constant Name_Id := N + 717;
+ Name_Objects_Linked : constant Name_Id := N + 718;
+ Name_Objects_Path : constant Name_Id := N + 719;
+ Name_Objects_Path_File : constant Name_Id := N + 720;
+ Name_Object_Dir : constant Name_Id := N + 721;
+ Name_Path_Syntax : constant Name_Id := N + 722;
+ Name_Pic_Option : constant Name_Id := N + 723;
+ Name_Pretty_Printer : constant Name_Id := N + 724;
+ Name_Prefix : constant Name_Id := N + 725;
+ Name_Project : constant Name_Id := N + 726;
+ Name_Roots : constant Name_Id := N + 727;
+ Name_Required_Switches : constant Name_Id := N + 728;
+ Name_Run_Path_Option : constant Name_Id := N + 729;
+ Name_Runtime_Project : constant Name_Id := N + 730;
+ Name_Shared_Library_Minimum_Switches : constant Name_Id := N + 731;
+ Name_Shared_Library_Prefix : constant Name_Id := N + 732;
+ Name_Shared_Library_Suffix : constant Name_Id := N + 733;
+ Name_Separate_Suffix : constant Name_Id := N + 734;
+ Name_Source_Dirs : constant Name_Id := N + 735;
+ Name_Source_Files : constant Name_Id := N + 736;
+ Name_Source_List_File : constant Name_Id := N + 737;
+ Name_Spec : constant Name_Id := N + 738;
+ Name_Spec_Suffix : constant Name_Id := N + 739;
+ Name_Specification : constant Name_Id := N + 740;
+ Name_Specification_Exceptions : constant Name_Id := N + 741;
+ Name_Specification_Suffix : constant Name_Id := N + 742;
+ Name_Stack : constant Name_Id := N + 743;
+ Name_Switches : constant Name_Id := N + 744;
+ Name_Symbolic_Link_Supported : constant Name_Id := N + 745;
+ Name_Sync : constant Name_Id := N + 746;
+ Name_Synchronize : constant Name_Id := N + 747;
+ Name_Toolchain_Description : constant Name_Id := N + 748;
+ Name_Toolchain_Version : constant Name_Id := N + 749;
+ Name_Runtime_Library_Dir : constant Name_Id := N + 750;
-- Other miscellaneous names used in front end
- Name_Unaligned_Valid : constant Name_Id := N + 748;
+ Name_Unaligned_Valid : constant Name_Id := N + 751;
-- Ada 2005 reserved words
- First_2005_Reserved_Word : constant Name_Id := N + 749;
- Name_Interface : constant Name_Id := N + 749;
- Name_Overriding : constant Name_Id := N + 750;
- Name_Synchronized : constant Name_Id := N + 751;
- Last_2005_Reserved_Word : constant Name_Id := N + 751;
+ First_2005_Reserved_Word : constant Name_Id := N + 752;
+ Name_Interface : constant Name_Id := N + 752;
+ Name_Overriding : constant Name_Id := N + 753;
+ Name_Synchronized : constant Name_Id := N + 754;
+ Last_2005_Reserved_Word : constant Name_Id := N + 754;
subtype Ada_2005_Reserved_Words is
Name_Id range First_2005_Reserved_Word .. Last_2005_Reserved_Word;
-- Mark last defined name for consistency check in Snames body
- Last_Predefined_Name : constant Name_Id := N + 751;
+ Last_Predefined_Name : constant Name_Id := N + 754;
---------------------------------------
-- Subtypes Defining Name Categories --
@@ -1285,6 +1291,7 @@ package Snames is
Attribute_Copy_Sign,
Attribute_Floor,
Attribute_Fraction,
+ Attribute_From_Any,
Attribute_Image,
Attribute_Input,
Attribute_Machine,
@@ -1295,7 +1302,9 @@ package Snames is
Attribute_Remainder,
Attribute_Rounding,
Attribute_Succ,
+ Attribute_To_Any,
Attribute_Truncation,
+ Attribute_TypeCode,
Attribute_Value,
Attribute_Wide_Image,
Attribute_Wide_Wide_Image,
diff --git a/gcc/ada/snames.h b/gcc/ada/snames.h
index 80ed0392a30..8f1367f7184 100644
--- a/gcc/ada/snames.h
+++ b/gcc/ada/snames.h
@@ -164,31 +164,34 @@ extern unsigned char Get_Attribute_Id (int);
#define Attr_Copy_Sign 117
#define Attr_Floor 118
#define Attr_Fraction 119
-#define Attr_Image 120
-#define Attr_Input 121
-#define Attr_Machine 122
-#define Attr_Max 123
-#define Attr_Min 124
-#define Attr_Model 125
-#define Attr_Pred 126
-#define Attr_Remainder 127
-#define Attr_Rounding 128
-#define Attr_Succ 129
-#define Attr_Truncation 130
-#define Attr_Value 131
-#define Attr_Wide_Image 132
-#define Attr_Wide_Wide_Image 133
-#define Attr_Wide_Value 134
-#define Attr_Wide_Wide_Value 135
-#define Attr_Output 136
-#define Attr_Read 137
-#define Attr_Write 138
-#define Attr_Elab_Body 139
-#define Attr_Elab_Spec 140
-#define Attr_Storage_Pool 141
-#define Attr_Base 142
-#define Attr_Class 143
-#define Attr_Stub_Type 144
+#define Attr_From_Any 120
+#define Attr_Image 121
+#define Attr_Input 122
+#define Attr_Machine 123
+#define Attr_Max 124
+#define Attr_Min 125
+#define Attr_Model 126
+#define Attr_Pred 127
+#define Attr_Remainder 128
+#define Attr_Rounding 129
+#define Attr_Succ 130
+#define Attr_To_Any 131
+#define Attr_Truncation 132
+#define Attr_TypeCode 133
+#define Attr_Value 134
+#define Attr_Wide_Image 135
+#define Attr_Wide_Wide_Image 136
+#define Attr_Wide_Value 137
+#define Attr_Wide_Wide_Value 138
+#define Attr_Output 139
+#define Attr_Read 140
+#define Attr_Write 141
+#define Attr_Elab_Body 142
+#define Attr_Elab_Spec 143
+#define Attr_Storage_Pool 144
+#define Attr_Base 145
+#define Attr_Class 146
+#define Attr_Stub_Type 147
/* Define the numeric values for the conventions. */
@@ -254,8 +257,8 @@ extern unsigned char Get_Pragma_Id (int);
#define Pragma_No_Strict_Aliasing 30
#define Pragma_Normalize_Scalars 31
#define Pragma_Optimize_Alignment 32
-#define Pragma_Polling 33
-#define Pragma_Persistent_BSS 34
+#define Pragma_Persistent_BSS 33
+#define Pragma_Polling 34
#define Pragma_Priority_Specific_Dispatching 35
#define Pragma_Profile 36
#define Pragma_Profile_Warnings 37
diff --git a/gcc/ada/socket.c b/gcc/ada/socket.c
index f88ed8cdd07..aadc9b084f7 100644
--- a/gcc/ada/socket.c
+++ b/gcc/ada/socket.c
@@ -31,13 +31,14 @@
****************************************************************************/
/* This file provides a portable binding to the sockets API */
-#if defined (__nucleus__)
-/* ??? Need proper implementation */
-#warning Sockets not yet supported on Nucleus
-#else
+
#include "gsocket.h"
+
+#if defined(HAVE_SOCKETS)
+
/* Include all the necessary system-specific headers and define the
- necessary macros (shared with gen-soccon). */
+ * necessary macros (shared with gen-oscons).
+ */
#if !defined(SO_NOSIGPIPE) && !defined (MSG_NOSIGNAL)
#include <signal.h>
@@ -239,7 +240,7 @@ __gnat_safe_getservbyname (const char *name, const char *proto,
struct servent *rh;
int ri;
-#if defined(__linux__) || defined(__GLIBC__)
+#if defined(__linux__) || defined(__GLIBC__) || defined(__rtems__)
(void) getservbyname_r (name, proto, ret, buf, buflen, &rh);
#else
rh = getservbyname_r (name, proto, ret, buf, buflen);
@@ -255,7 +256,7 @@ __gnat_safe_getservbyport (int port, const char *proto,
struct servent *rh;
int ri;
-#if defined(__linux__) || defined(__GLIBC__)
+#if defined(__linux__) || defined(__GLIBC__) || defined(__rtems__)
(void) getservbyport_r (port, proto, ret, buf, buflen, &rh);
#else
rh = getservbyport_r (port, proto, ret, buf, buflen);
@@ -416,4 +417,7 @@ __gnat_get_h_errno (void) {
return h_errno;
#endif
}
-#endif /* __nucleus__ */
+
+#else
+#warning Sockets are not supported on this platform
+#endif /* defined(HAVE_SOCKETS) */
diff --git a/gcc/ada/sprint.adb b/gcc/ada/sprint.adb
index 4306ce41450..ad20565574f 100644
--- a/gcc/ada/sprint.adb
+++ b/gcc/ada/sprint.adb
@@ -2334,10 +2334,9 @@ package body Sprint is
Write_Str_With_Col_Check ("out ");
end if;
- -- Ada 2005 (AI-231) parameter specification may carry
- -- null exclusion. Do not print it now if this is an
- -- access parameter, it is emitted when the access
- -- definition is displayed.
+ -- Ada 2005 (AI-231): Parameter specification may carry null
+ -- exclusion. Do not print it now if this is an access formal,
+ -- it is emitted when the access definition is displayed.
if Null_Exclusion_Present (Node)
and then Nkind (Parameter_Type (Node))
diff --git a/gcc/ada/switch-c.adb b/gcc/ada/switch-c.adb
index cf59c8198cd..63a1a6d83aa 100644
--- a/gcc/ada/switch-c.adb
+++ b/gcc/ada/switch-c.adb
@@ -371,6 +371,16 @@ package body Switch.C is
Full_Path_Name_For_Brief_Errors := True;
return;
+ -- -gnateG (save preprocessor output)
+
+ when 'G' =>
+ if Ptr < Max then
+ Bad_Switch (Switch_Chars);
+ end if;
+
+ Generate_Processed_File := True;
+ Ptr := Ptr + 1;
+
-- -gnateI (index of unit in multi-unit source)
when 'I' =>
diff --git a/gcc/ada/switch-m.adb b/gcc/ada/switch-m.adb
index 20761f417cd..7be075d9896 100644
--- a/gcc/ada/switch-m.adb
+++ b/gcc/ada/switch-m.adb
@@ -267,14 +267,16 @@ package body Switch.M is
when 'e' =>
- -- Only -gnateD and -gnatep= need storing in ALI file
+ -- Store -gnateD, -gnatep= and -gnateG in the ALI file.
+ -- The other -gnate switches do not need to be stored.
Storing (First_Stored) := 'e';
Ptr := Ptr + 1;
if Ptr > Max
or else (Switch_Chars (Ptr) /= 'D'
- and then Switch_Chars (Ptr) /= 'p')
+ and then Switch_Chars (Ptr) /= 'G'
+ and then Switch_Chars (Ptr) /= 'p')
then
Last := 0;
return;
@@ -292,7 +294,7 @@ package body Switch.M is
-- Processing for -gnatep=
- else
+ elsif Switch_Chars (Ptr) = 'p' then
Ptr := Ptr + 1;
if Ptr = Max then
@@ -316,6 +318,9 @@ package body Switch.M is
Switch_Chars (Ptr .. Max);
Add_Switch_Component (To_Store);
end;
+
+ elsif Switch_Chars (Ptr) = 'G' then
+ Add_Switch_Component ("-gnateG");
end if;
return;
diff --git a/gcc/ada/system-darwin-x86.ads b/gcc/ada/system-darwin-x86.ads
index 04cdbbcf94f..1b846813d4b 100644
--- a/gcc/ada/system-darwin-x86.ads
+++ b/gcc/ada/system-darwin-x86.ads
@@ -51,7 +51,7 @@ package System is
Max_Int : constant := Long_Long_Integer'Last;
Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
- Max_Nonbinary_Modulus : constant := Integer'Last;
+ Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
Max_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/system-mingw-x86_64.ads b/gcc/ada/system-mingw-x86_64.ads
new file mode 100644
index 00000000000..332b283b0a0
--- /dev/null
+++ b/gcc/ada/system-mingw-x86_64.ads
@@ -0,0 +1,199 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M --
+-- --
+-- S p e c --
+-- (Windows Version) --
+-- --
+-- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- --
+-- This specification is derived from the Ada Reference Manual for use with --
+-- GNAT. The copyright notice above, and the license provisions that follow --
+-- apply solely to the contents of the part following the private keyword. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 2, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
+-- for more details. You should have received a copy of the GNU General --
+-- Public License distributed with GNAT; see file COPYING. If not, write --
+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
+-- Boston, MA 02110-1301, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, or you link this unit with other files to produce an executable, --
+-- this unit does not by itself cause the resulting executable to be --
+-- covered by the GNU General Public License. This exception does not --
+-- however invalidate any other reasons why the executable file might be --
+-- covered by the GNU Public License. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+package System is
+ pragma Pure;
+ -- Note that we take advantage of the implementation permission to make
+ -- this unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada
+ -- 2005, this is Pure in any case (AI-362).
+
+ type Name is (SYSTEM_NAME_GNAT);
+ System_Name : constant Name := SYSTEM_NAME_GNAT;
+
+ -- System-Dependent Named Numbers
+
+ Min_Int : constant := Long_Long_Integer'First;
+ Max_Int : constant := Long_Long_Integer'Last;
+
+ Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
+
+ Max_Base_Digits : constant := Long_Long_Float'Digits;
+ Max_Digits : constant := Long_Long_Float'Digits;
+
+ Max_Mantissa : constant := 63;
+ Fine_Delta : constant := 2.0 ** (-Max_Mantissa);
+
+ Tick : constant := 0.01;
+
+ -- Storage-related Declarations
+
+ type Address is private;
+ pragma Preelaborable_Initialization (Address);
+ Null_Address : constant Address;
+
+ Storage_Unit : constant := 8;
+ Word_Size : constant := 64;
+ Memory_Size : constant := 2 ** 64;
+
+ -- Address comparison
+
+ function "<" (Left, Right : Address) return Boolean;
+ function "<=" (Left, Right : Address) return Boolean;
+ function ">" (Left, Right : Address) return Boolean;
+ function ">=" (Left, Right : Address) return Boolean;
+ function "=" (Left, Right : Address) return Boolean;
+
+ pragma Import (Intrinsic, "<");
+ pragma Import (Intrinsic, "<=");
+ pragma Import (Intrinsic, ">");
+ pragma Import (Intrinsic, ">=");
+ pragma Import (Intrinsic, "=");
+
+ -- Other System-Dependent Declarations
+
+ type Bit_Order is (High_Order_First, Low_Order_First);
+ Default_Bit_Order : constant Bit_Order := Low_Order_First;
+ pragma Warnings (Off, Default_Bit_Order); -- kill constant condition warning
+
+ -- Priority-related Declarations (RM D.1)
+
+ Max_Priority : constant Positive := 30;
+ Max_Interrupt_Priority : constant Positive := 31;
+
+ subtype Any_Priority is Integer range 0 .. 31;
+ subtype Priority is Any_Priority range 0 .. 30;
+ subtype Interrupt_Priority is Any_Priority range 31 .. 31;
+
+ Default_Priority : constant Priority := 15;
+
+private
+
+ type Address is mod Memory_Size;
+ Null_Address : constant Address := 0;
+
+ --------------------------------------
+ -- System Implementation Parameters --
+ --------------------------------------
+
+ -- These parameters provide information about the target that is used
+ -- by the compiler. They are in the private part of System, where they
+ -- can be accessed using the special circuitry in the Targparm unit
+ -- whose source should be consulted for more detailed descriptions
+ -- of the individual switch values.
+
+ Backend_Divide_Checks : constant Boolean := False;
+ Backend_Overflow_Checks : constant Boolean := False;
+ Command_Line_Args : constant Boolean := True;
+ Configurable_Run_Time : constant Boolean := False;
+ Denorm : constant Boolean := True;
+ Duration_32_Bits : constant Boolean := False;
+ Exit_Status_Supported : constant Boolean := True;
+ Fractional_Fixed_Ops : constant Boolean := False;
+ Frontend_Layout : constant Boolean := False;
+ Machine_Overflows : constant Boolean := False;
+ Machine_Rounds : constant Boolean := True;
+ Preallocated_Stacks : constant Boolean := False;
+ Signed_Zeros : constant Boolean := True;
+ Stack_Check_Default : constant Boolean := False;
+ Stack_Check_Probes : constant Boolean := True;
+ Stack_Check_Limits : constant Boolean := False;
+ Support_64_Bit_Divides : constant Boolean := True;
+ Support_Aggregates : constant Boolean := True;
+ Support_Composite_Assign : constant Boolean := True;
+ Support_Composite_Compare : constant Boolean := True;
+ Support_Long_Shifts : constant Boolean := True;
+ Always_Compatible_Rep : constant Boolean := False;
+ Suppress_Standard_Library : constant Boolean := False;
+ Use_Ada_Main_Program_Name : constant Boolean := False;
+ ZCX_By_Default : constant Boolean := True;
+ GCC_ZCX_Support : constant Boolean := True;
+
+ ---------------------------
+ -- Underlying Priorities --
+ ---------------------------
+
+ -- Important note: this section of the file must come AFTER the
+ -- definition of the system implementation parameters to ensure
+ -- that the value of these parameters is available for analysis
+ -- of the declarations here (using Rtsfind at compile time).
+
+ -- The underlying priorities table provides a generalized mechanism
+ -- for mapping from Ada priorities to system priorities. In some
+ -- cases a 1-1 mapping is not the convenient or optimal choice.
+
+ type Priorities_Mapping is array (Any_Priority) of Integer;
+ pragma Suppress_Initialization (Priorities_Mapping);
+ -- Suppress initialization in case gnat.adc specifies Normalize_Scalars
+
+ Underlying_Priorities : constant Priorities_Mapping :=
+ (Priority'First ..
+ Default_Priority - 8 => -15,
+ Default_Priority - 7 => -7,
+ Default_Priority - 6 => -6,
+ Default_Priority - 5 => -5,
+ Default_Priority - 4 => -4,
+ Default_Priority - 3 => -3,
+ Default_Priority - 2 => -2,
+ Default_Priority - 1 => -1,
+ Default_Priority => 0,
+ Default_Priority + 1 => 1,
+ Default_Priority + 2 => 2,
+ Default_Priority + 3 => 3,
+ Default_Priority + 4 => 4,
+ Default_Priority + 5 => 5,
+ Default_Priority + 6 ..
+ Priority'Last => 6,
+ Interrupt_Priority => 15);
+ -- The default mapping preserves the standard 31 priorities of the Ada
+ -- model, but maps them using compression onto the 7 priority levels
+ -- available in NT and on the 16 priority levels available in 2000/XP.
+
+ -- To replace the default values of the Underlying_Priorities mapping,
+ -- copy this source file into your build directory, edit the file to
+ -- reflect your desired behavior, and recompile using Makefile.adalib
+ -- which can be found under the adalib directory of your gnat installation
+
+ pragma Linker_Options ("-Wl,--stack=0x2000000");
+ -- This is used to change the default stack (32 MB) size for non tasking
+ -- programs. We change this value for GNAT on Windows here because the
+ -- binutils on this platform have switched to a too low value for Ada
+ -- programs. Note that we also set the stack size for tasking programs in
+ -- System.Task_Primitives.Operations.
+
+end System;
diff --git a/gcc/ada/targparm.adb b/gcc/ada/targparm.adb
index 6039cf7406b..52bbbcb953c 100644
--- a/gcc/ada/targparm.adb
+++ b/gcc/ada/targparm.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1999-2007, Free Software Foundation, Inc. --
+-- Copyright (C) 1999-2008, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -54,6 +54,7 @@ package body Targparm is
MOV, -- Machine_Overflows
MRN, -- Machine_Rounds
PAS, -- Preallocated_Stacks
+ RTX, -- RTX_RTSS_Kernel_Module
S64, -- Support_64_Bit_Divides
SAG, -- Support_Aggregates
SCA, -- Support_Composite_Assign
@@ -90,6 +91,7 @@ package body Targparm is
MOV_Str : aliased constant Source_Buffer := "Machine_Overflows";
MRN_Str : aliased constant Source_Buffer := "Machine_Rounds";
PAS_Str : aliased constant Source_Buffer := "Preallocated_Stacks";
+ RTX_Str : aliased constant Source_Buffer := "RTX_RTSS_Kernel_Module";
S64_Str : aliased constant Source_Buffer := "Support_64_Bit_Divides";
SAG_Str : aliased constant Source_Buffer := "Support_Aggregates";
SCA_Str : aliased constant Source_Buffer := "Support_Composite_Assign";
@@ -126,6 +128,7 @@ package body Targparm is
MOV_Str'Access,
MRN_Str'Access,
PAS_Str'Access,
+ RTX_Str'Access,
S64_Str'Access,
SAG_Str'Access,
SCA_Str'Access,
@@ -573,6 +576,7 @@ package body Targparm is
when MOV => Machine_Overflows_On_Target := Result;
when MRN => Machine_Rounds_On_Target := Result;
when PAS => Preallocated_Stacks_On_Target := Result;
+ when RTX => RTX_RTSS_Kernel_Module_On_Target := Result;
when S64 => Support_64_Bit_Divides_On_Target := Result;
when SAG => Support_Aggregates_On_Target := Result;
when SCA => Support_Composite_Assign_On_Target := Result;
diff --git a/gcc/ada/targparm.ads b/gcc/ada/targparm.ads
index c40d6d81adc..97192a56143 100644
--- a/gcc/ada/targparm.ads
+++ b/gcc/ada/targparm.ads
@@ -216,6 +216,9 @@ package Targparm is
OpenVMS_On_Target : Boolean := False;
-- Set to True if target is OpenVMS
+ RTX_RTSS_Kernel_Module_On_Target : Boolean := False;
+ -- Set to True if target is RTSS module for RTX
+
type Virtual_Machine_Kind is (No_VM, JVM_Target, CLI_Target);
VM_Target : Virtual_Machine_Kind := No_VM;
-- Kind of virtual machine targetted
diff --git a/gcc/ada/tbuild.adb b/gcc/ada/tbuild.adb
index b3ddd631946..4f25eda7462 100644
--- a/gcc/ada/tbuild.adb
+++ b/gcc/ada/tbuild.adb
@@ -498,7 +498,7 @@ package body Tbuild is
Get_Name_String (Related_Id);
if Prefix /= ' ' then
- pragma Assert (Is_OK_Internal_Letter (Prefix));
+ pragma Assert (Is_OK_Internal_Letter (Prefix) or else Prefix = '_');
for J in reverse 1 .. Name_Len loop
Name_Buffer (J + 1) := Name_Buffer (J);
diff --git a/gcc/ada/tbuild.ads b/gcc/ada/tbuild.ads
index 14028630021..ae1ba441b21 100644
--- a/gcc/ada/tbuild.ads
+++ b/gcc/ada/tbuild.ads
@@ -202,11 +202,11 @@ package Tbuild is
--
-- Prefix is prepended only if Prefix is non-blank (in which case it
-- must be an upper case letter other than O,Q,U,W (which are used for
- -- identifier encoding, see Namet), and T is reserved for use by implicit
- -- types, and X is reserved for use by debug type encoding (see package
- -- Exp_Dbug). Note: the reason that Prefix is last is that it is almost
- -- always omitted. The notable case of Prefix being non-null is when
- -- it is 'T' for an implicit type.
+ -- identifier encoding, see Namet), or an underscore, and T is reserved for
+ -- use by implicit types, and X is reserved for use by debug type encoding
+ -- (see package Exp_Dbug). Note: the reason that Prefix is last is that it
+ -- is almost always omitted. The notable case of Prefix being non-null is
+ -- when it is 'T' for an implicit type.
-- Suffix_Index'Image is appended only if the value of Suffix_Index is
-- positive, or if Suffix_Index is negative 1, then a unique serialized
@@ -214,7 +214,7 @@ package Tbuild is
-- Suffix is also a single upper case letter other than O,Q,U,W,X and is a
-- required parameter (T is permitted). The constructed name is stored
- -- using Find_Name so that it can be located using a subsequent Find_Name
+ -- using Name_Find so that it can be located using a subsequent Name_Find
-- operation (i.e. it is properly hashed into the names table). The upper
-- case letter given as the Suffix argument ensures that the name does
-- not clash with any Ada identifier name. These generated names are
@@ -228,7 +228,7 @@ package Tbuild is
-- Suffix & Suffix_Index'Image
-- where Suffix is a single upper case letter other than O,Q,U,W,X and is
-- a required parameter (T is permitted). The constructed name is stored
- -- using Find_Name so that it can be located using a subsequent Find_Name
+ -- using Name_Find so that it can be located using a subsequent Name_Find
-- operation (i.e. it is properly hashed into the names table). The upper
-- case letter given as the Suffix argument ensures that the name does
-- not clash with any Ada identifier name. These generated names are
diff --git a/gcc/ada/treepr.adb b/gcc/ada/treepr.adb
index a25cfae44fa..5fb53ae339e 100644
--- a/gcc/ada/treepr.adb
+++ b/gcc/ada/treepr.adb
@@ -531,17 +531,44 @@ package body Treepr is
begin
case M is
- when Default_Mechanism => Write_Str ("Default");
- when By_Copy => Write_Str ("By_Copy");
- when By_Reference => Write_Str ("By_Reference");
- when By_Descriptor => Write_Str ("By_Descriptor");
- when By_Descriptor_UBS => Write_Str ("By_Descriptor_UBS");
- when By_Descriptor_UBSB => Write_Str ("By_Descriptor_UBSB");
- when By_Descriptor_UBA => Write_Str ("By_Descriptor_UBA");
- when By_Descriptor_S => Write_Str ("By_Descriptor_S");
- when By_Descriptor_SB => Write_Str ("By_Descriptor_SB");
- when By_Descriptor_A => Write_Str ("By_Descriptor_A");
- when By_Descriptor_NCA => Write_Str ("By_Descriptor_NCA");
+ when Default_Mechanism
+ => Write_Str ("Default");
+ when By_Copy
+ => Write_Str ("By_Copy");
+ when By_Reference
+ => Write_Str ("By_Reference");
+ when By_Descriptor
+ => Write_Str ("By_Descriptor");
+ when By_Descriptor_UBS
+ => Write_Str ("By_Descriptor_UBS");
+ when By_Descriptor_UBSB
+ => Write_Str ("By_Descriptor_UBSB");
+ when By_Descriptor_UBA
+ => Write_Str ("By_Descriptor_UBA");
+ when By_Descriptor_S
+ => Write_Str ("By_Descriptor_S");
+ when By_Descriptor_SB
+ => Write_Str ("By_Descriptor_SB");
+ when By_Descriptor_A
+ => Write_Str ("By_Descriptor_A");
+ when By_Descriptor_NCA
+ => Write_Str ("By_Descriptor_NCA");
+ when By_Short_Descriptor
+ => Write_Str ("By_Short_Descriptor");
+ when By_Short_Descriptor_UBS
+ => Write_Str ("By_Short_Descriptor_UBS");
+ when By_Short_Descriptor_UBSB
+ => Write_Str ("By_Short_Descriptor_UBSB");
+ when By_Short_Descriptor_UBA
+ => Write_Str ("By_Short_Descriptor_UBA");
+ when By_Short_Descriptor_S
+ => Write_Str ("By_Short_Descriptor_S");
+ when By_Short_Descriptor_SB
+ => Write_Str ("By_Short_Descriptor_SB");
+ when By_Short_Descriptor_A
+ => Write_Str ("By_Short_Descriptor_A");
+ when By_Short_Descriptor_NCA
+ => Write_Str ("By_Short_Descriptor_NCA");
when 1 .. Mechanism_Type'Last =>
Write_Str ("By_Copy if size <= ");
diff --git a/gcc/ada/types.ads b/gcc/ada/types.ads
index 9b4bfb825e4..de9c54bfe5f 100644
--- a/gcc/ada/types.ads
+++ b/gcc/ada/types.ads
@@ -736,7 +736,7 @@ package Types is
-- passing mechanism. See specification of Sem_Mech for full details.
-- The following subtype is used to represent values of this type:
- subtype Mechanism_Type is Int range -10 .. Int'Last;
+ subtype Mechanism_Type is Int range -18 .. Int'Last;
-- Type used to represent a mechanism value. This is a subtype rather
-- than a type to avoid some annoying processing problems with certain
-- routines in Einfo (processing them to create the corresponding C).
diff --git a/gcc/ada/types.h b/gcc/ada/types.h
index fb218c203a6..1d4fd67065b 100644
--- a/gcc/ada/types.h
+++ b/gcc/ada/types.h
@@ -328,6 +328,15 @@ typedef Int Mechanism_Type;
#define By_Descriptor_A (-9)
#define By_Descriptor_NCA (-10)
#define By_Descriptor_Last (-10)
+#define By_Short_Descriptor (-11)
+#define By_Short_Descriptor_UBS (-12)
+#define By_Short_Descriptor_UBSB (-13)
+#define By_Short_Descriptor_UBA (-14)
+#define By_Short_Descriptor_S (-15)
+#define By_Short_Descriptor_SB (-16)
+#define By_Short_Descriptor_A (-17)
+#define By_Short_Descriptor_NCA (-18)
+#define By_Short_Descriptor_Last (-18)
/* Internal to Gigi. */
#define By_Copy_Return (-128)
diff --git a/gcc/ada/ug_words b/gcc/ada/ug_words
index 7f8e9577e86..532bf0ae513 100644
--- a/gcc/ada/ug_words
+++ b/gcc/ada/ug_words
@@ -61,6 +61,7 @@ gcc -c ^ GNAT COMPILE
-gnatec ^ /CONFIGURATION_PRAGMAS_FILE
-gnateD ^ /SYMBOL_PREPROCESSING
-gnatef ^ /FULL_PATH_IN_BRIEF_MESSAGES
+-gnateG ^ /GENERATE_PROCESSED_SOURCE
-gnatem ^ /MAPPING_FILE
-gnatep ^ /DATA_PREPROCESSING
-gnatE ^ /CHECKS=ELABORATION
@@ -119,6 +120,8 @@ gcc -c ^ GNAT COMPILE
-gnatw.A ^ /WARNINGS=NO_FAILING_ASSERTIONS
-gnatwb ^ /WARNINGS=BAD_FIXED_VALUES
-gnatwB ^ /WARNINGS=NO_BAD_FIXED_VALUES
+-gnatw.b ^ /WARNINGS=BIASED_REPRESENTATION
+-gnatw.B ^ /WARNINGS=NO_BIASED_REPRESENTATION
-gnatwc ^ /WARNINGS=CONDITIONALS
-gnatwC ^ /WARNINGS=NOCONDITIONALS
-gnatw.c ^ /WARNINGS=MISSING_COMPONENT_CLAUSES
diff --git a/gcc/ada/uintp.adb b/gcc/ada/uintp.adb
index 416d5d88681..b1f05993608 100644
--- a/gcc/ada/uintp.adb
+++ b/gcc/ada/uintp.adb
@@ -1832,7 +1832,7 @@ package body Uintp is
Den1 := V_Hat + C;
Den2 := V_Hat + D;
- exit when (Den1 * Den2) = Int_0;
+ exit when Den1 = Int_0 or else Den2 = Int_0;
-- Compute Q, the trial quotient
diff --git a/gcc/ada/usage.adb b/gcc/ada/usage.adb
index 5a1f4827eab..74780107da3 100644
--- a/gcc/ada/usage.adb
+++ b/gcc/ada/usage.adb
@@ -167,6 +167,11 @@ begin
Write_Switch_Char ("ef");
Write_Line ("Full source path in brief error messages");
+ -- Line for -gnateG switch
+
+ Write_Switch_Char ("eG");
+ Write_Line ("Generate preprocessed source");
+
-- Line for -gnateI switch
Write_Switch_Char ("eInn");
@@ -373,12 +378,14 @@ begin
Write_Line (" a turn on all optional warnings " &
"(except dhl.ot.w)");
Write_Line (" A turn off all optional warnings");
- Write_Line (" .a* turn on warnings for failing assertions");
- Write_Line (" .A turn off warnings for failing assertions");
+ Write_Line (" .a* turn on warnings for failing assertion");
+ Write_Line (" .A turn off warnings for failing assertion");
Write_Line (" b turn on warnings for bad fixed value " &
"(not multiple of small)");
Write_Line (" B* turn off warnings for bad fixed value " &
"(not multiple of small)");
+ Write_Line (" .b* turn on warnings for biased representation");
+ Write_Line (" .B turn off warnings for biased representation");
Write_Line (" c turn on warnings for constant conditional");
Write_Line (" C* turn off warnings for constant conditional");
Write_Line (" .c turn on warnings for unrepped components");
@@ -391,7 +398,7 @@ begin
Write_Line (" F* turn off warnings for unreferenced formal");
Write_Line (" g* turn on warnings for unrecognized pragma");
Write_Line (" G turn off warnings for unrecognized pragma");
- Write_Line (" h turn on warnings for hiding variable ");
+ Write_Line (" h turn on warnings for hiding variable");
Write_Line (" H* turn off warnings for hiding variable");
Write_Line (" i* turn on warnings for implementation unit");
Write_Line (" I turn off warnings for implementation unit");
@@ -425,9 +432,9 @@ begin
Write_Line (" .P* turn off warnings for suspicious parameter " &
"order");
Write_Line (" q* turn on warnings for questionable " &
- "missing parentheses");
+ "missing parenthesis");
Write_Line (" Q turn off warnings for questionable " &
- "missing parentheses");
+ "missing parenthesis");
Write_Line (" r turn on warnings for redundant construct");
Write_Line (" R* turn off warnings for redundant construct");
Write_Line (" .r turn on warnings for object renaming function");
@@ -446,14 +453,14 @@ begin
Write_Line (" .w* turn off warnings on pragma Warnings Off");
Write_Line (" x* turn on warnings for export/import");
Write_Line (" X turn off warnings for export/import");
- Write_Line (" .x turn on warnings for non-local exceptions");
- Write_Line (" .X* turn off warnings for non-local exceptions");
+ Write_Line (" .x turn on warnings for non-local exception");
+ Write_Line (" .X* turn off warnings for non-local exception");
Write_Line (" y* turn on warnings for Ada 2005 incompatibility");
Write_Line (" Y turn off warnings for Ada 2005 incompatibility");
- Write_Line (" z* turn on convention/size/align warnings for " &
- "unchecked conversion");
- Write_Line (" Z turn off convention/size/align warnings for " &
- "unchecked conversion");
+ Write_Line (" z* turn on warnings for convention/size/align " &
+ "mismatch on unchecked conversion");
+ Write_Line (" Z turn off warnings for convention/size/align " &
+ "mismatch on unchecked conversion");
Write_Line (" * indicates default in above list");
-- Line for -gnatW switch
diff --git a/gcc/ada/vms_data.ads b/gcc/ada/vms_data.ads
index 3270e8f55b5..46764ddb50e 100644
--- a/gcc/ada/vms_data.ads
+++ b/gcc/ada/vms_data.ads
@@ -1526,6 +1526,14 @@ package VMS_Data is
-- /VERBOSE), then error lines start with the full path name of the
-- project file, rather than its simple file name.
+ S_GCC_Generate : aliased constant S := "/GENERATE_PROCESSED_SOURCE " &
+ "-gnateG";
+ -- /NOGENERATE_PROCESSED_SOURCE (D)
+ -- /GENERATE_PROCESSED_SOURCE
+ --
+ -- Generate a file <source>_prep if the integrated preprocessing
+ -- is modifying the source text.
+
S_GCC_GNAT : aliased constant S := "/GNAT_INTERNAL " &
"-gnatg";
-- /NOGNAT_INTERNAL (D)
@@ -1745,6 +1753,15 @@ package VMS_Data is
-- a body is compiled, the corresponding spec is also listed, along
-- with any subunits.
+ S_GCC_Machine : aliased constant S := "/MACHINE_CODE_LISTING " &
+ "-source-listing";
+ -- /NOMACHINE_CODE_LISTING (D)
+ -- /MACHINE_CODE_LISTING
+ --
+ -- Cause a full machine code listing of the file to be generated to
+ -- <filename>.lis. Interspersed source is included if the /DEBUG
+ -- qualifier is also present.
+
S_GCC_Mapping : aliased constant S := "/MAPPING_FILE=<" &
"-gnatem>";
-- /MAPPING_FILE=file_name
@@ -1932,6 +1949,36 @@ package VMS_Data is
-- file xyz.adb is compiled with -gnatl=.lst, then the output is written
-- to file xyz.adb_lst.
+ S_GCC_Pointer : aliased constant S := "/POINTER_SIZE=" &
+ "64 " &
+ "-mmalloc64 " &
+ "LONG " &
+ "-mmalloc64 " &
+ "32 " &
+ "-mno-malloc64 " &
+ "SHORT " &
+ "-mno-malloc64";
+ -- /POINTER_SIZE=64 (D)
+ -- /POINTER_SIZE[=(keyword[,...])]
+ --
+ -- Change how pointers and descriptors are allocated. The following
+ -- keywords are supported:
+ --
+ -- 64 (D) Allocate heap pointers in 64bit space except as
+ -- constrained by a 32bit size clause or by
+ -- Convention_C and generate 64bit descriptors for
+ -- Descriptor mechanisms for calling imported
+ -- subprograms and accept both 64bit and 32bit
+ -- descriptors for calls to exported subprograms.
+ --
+ -- LONG Equivalent to option 64.
+ --
+ -- 32 Allocate all heap pointers in 32bit space and
+ -- generate 32bit descriptors for Descriptor
+ -- mechanisms for calling imported subprograms.
+ --
+ -- SHORT Equivalent to option 32.
+
S_GCC_Polling : aliased constant S := "/POLLING " &
"-gnatP";
-- /NOPOLLING (D)
@@ -2752,6 +2799,10 @@ package VMS_Data is
"-gnatwb " &
"NO_BAD_FIXED_VALUES " &
"-gnatwB " &
+ "BIASED_REPRESENTATION " &
+ "-gnatw.b " &
+ "NO_BIASED_REPRESENTATION " &
+ "-gnatw.B " &
"CONDITIONALS " &
"-gnatwc " &
"NOCONDITIONALS " &
@@ -3302,6 +3353,7 @@ package VMS_Data is
S_GCC_Follow 'Access,
S_GCC_Force 'Access,
S_GCC_Full 'Access,
+ S_GCC_Generate'Access,
S_GCC_GNAT 'Access,
S_GCC_Help 'Access,
S_GCC_Ident 'Access,
@@ -3316,6 +3368,7 @@ package VMS_Data is
S_GCC_Length 'Access,
S_GCC_List 'Access,
S_GCC_Output 'Access,
+ S_GCC_Machine 'Access,
S_GCC_Mapping 'Access,
S_GCC_Mess 'Access,
S_GCC_Nesting 'Access,
@@ -3325,6 +3378,7 @@ package VMS_Data is
S_GCC_Nostlib 'Access,
S_GCC_Opt 'Access,
S_GCC_OptX 'Access,
+ S_GCC_Pointer 'Access,
S_GCC_Polling 'Access,
S_GCC_Project 'Access,
S_GCC_Psta 'Access,
diff --git a/gcc/ada/xnmake.adb b/gcc/ada/xnmake.adb
index 2596d73b7c3..e218d674773 100644
--- a/gcc/ada/xnmake.adb
+++ b/gcc/ada/xnmake.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -58,6 +58,8 @@ with Ada.Text_IO; use Ada.Text_IO;
with GNAT.Spitbol; use GNAT.Spitbol;
with GNAT.Spitbol.Patterns; use GNAT.Spitbol.Patterns;
+with XUtil;
+
procedure XNmake is
Err : exception;
@@ -137,8 +139,8 @@ procedure XNmake is
V_Elist_Id : constant VString := V ("Elist_Id");
V_Boolean : constant VString := V ("Boolean");
- procedure Put_Line (F : Sfile; S : String);
- procedure Put_Line (F : Sfile; S : VString);
+ procedure Put_Line (F : Sfile; S : String) renames XUtil.Put_Line;
+ procedure Put_Line (F : Sfile; S : VString) renames XUtil.Put_Line;
-- Local version of Put_Line ensures Unix style line endings
procedure WriteS (S : String);
@@ -199,17 +201,6 @@ procedure XNmake is
end if;
end WriteS;
- procedure Put_Line (F : Sfile; S : String) is
- begin
- String'Write (Stream (F), S);
- Character'Write (Stream (F), ASCII.LF);
- end Put_Line;
-
- procedure Put_Line (F : Sfile; S : VString) is
- begin
- Put_Line (F, To_String (S));
- end Put_Line;
-
-- Start of processing for XNmake
begin
diff --git a/gcc/ada/xoscons.adb b/gcc/ada/xoscons.adb
new file mode 100644
index 00000000000..efce54a1f11
--- /dev/null
+++ b/gcc/ada/xoscons.adb
@@ -0,0 +1,419 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT SYSTEM UTILITIES --
+-- --
+-- X O S C O N S --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 2008, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
+-- for more details. You should have received a copy of the GNU General --
+-- Public License distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This program generates the spec of System.OS_Constants (s-oscons.ads).
+
+-- It works in conjunction with a C template file which must be pre-processed
+-- and compiled using the cross compiler. Two input files are used:
+-- - the preprocessed C file: s-oscons-tmplt.i
+-- - the generated assembly file: s-oscons-tmplt.s
+
+-- The contents of s-oscons.ads is written on standard output.
+
+with Ada.Characters.Handling; use Ada.Characters.Handling;
+with Ada.Exceptions; use Ada.Exceptions;
+with Ada.Strings.Fixed; use Ada.Strings.Fixed;
+with Ada.Text_IO; use Ada.Text_IO;
+with Ada.Streams.Stream_IO; use Ada.Streams.Stream_IO;
+
+pragma Warnings (Off);
+-- System.Unsigned_Types is an internal GNAT unit
+with System.Unsigned_Types; use System.Unsigned_Types;
+pragma Warnings (On);
+
+with GNAT.Table;
+
+with XUtil; use XUtil;
+
+procedure XOSCons is
+
+ use ASCII;
+ use Ada.Strings;
+
+ Unit_Name : constant String := "s-oscons";
+ Tmpl_Name : constant String := Unit_Name & "-tmplt";
+
+ -------------------------------------------------
+ -- Information retrieved from assembly listing --
+ -------------------------------------------------
+
+ -- We need to deal with integer values that can be signed or unsigned,
+ -- so we need to cater for the maximum range of both cases.
+
+ type String_Access is access all String;
+ -- Note: we can't use GNAT.Strings for this definition, since that unit
+ -- is not available in older base compilers.
+
+ type Int_Value_Type is record
+ Positive : Boolean;
+ Abs_Value : Long_Unsigned := 0;
+ end record;
+
+ type Asm_Info_Kind is
+ (CND, -- Constant (decimal)
+ CNS, -- Constant (freeform string)
+ TXT); -- Literal text
+ -- Recognized markers found in assembly file. These markers are produced
+ -- by the same-named macros from the C template.
+
+ type Asm_Info (Kind : Asm_Info_Kind := TXT) is record
+ Line_Number : Integer;
+ -- Line number in C source file
+
+ Constant_Name : String_Access;
+ -- Name of constant to be defined
+
+ Value_Len : Natural := 0;
+ -- Length of text representation of constant's value
+
+ Text_Value : String_Access;
+ -- Value for CNS constant
+
+ Int_Value : Int_Value_Type;
+ -- Value for CND constant
+
+ Comment : String_Access;
+ -- Additional descriptive comment for constant, or free-form text (TXT)
+ end record;
+
+ package Asm_Infos is new GNAT.Table (
+ Table_Component_Type => Asm_Info,
+ Table_Index_Type => Integer,
+ Table_Low_Bound => 1,
+ Table_Initial => 100,
+ Table_Increment => 10);
+
+ Max_Constant_Name_Len : Natural := 0;
+ Max_Constant_Value_Len : Natural := 0;
+ -- Longest name and longest value lengths
+
+ procedure Output_Info (OFile : Sfile; Info_Index : Integer);
+ -- Output information from the indicated asm info line
+
+ procedure Parse_Asm_Line (Line : String);
+ -- Parse one information line from the assembly source
+
+ function Contains_Template_Name (S : String) return Boolean;
+ -- True if S contains Tmpl_Name, possibly with different casing
+
+ function Spaces (Count : Integer) return String;
+ -- If Count is positive, return a string of Count spaces, else return an
+ -- empty string.
+
+ ----------------------------
+ -- Contains_Template_Name --
+ ----------------------------
+
+ function Contains_Template_Name (S : String) return Boolean is
+ begin
+ return Index (Source => To_Lower (S), Pattern => Tmpl_Name) > 0;
+ end Contains_Template_Name;
+
+ -----------------
+ -- Output_Info --
+ -----------------
+
+ procedure Output_Info (OFile : Sfile; Info_Index : Integer) is
+ Info : Asm_Info renames Asm_Infos.Table (Info_Index);
+
+ procedure Put (S : String);
+
+ ---------
+ -- Put --
+ ---------
+
+ procedure Put (S : String) is
+ begin
+ Put (OFile, S);
+ end Put;
+
+ begin
+ if Info.Kind /= TXT then
+ -- TXT case is handled by the common code below
+
+ Put (" ");
+ Put (Info.Constant_Name.all);
+ Put (Spaces (Max_Constant_Name_Len - Info.Constant_Name'Length));
+
+ Put (" : constant := ");
+
+ if Info.Kind = CND then
+ if not Info.Int_Value.Positive then
+ Put ("-");
+ end if;
+ Put (Trim (Info.Int_Value.Abs_Value'Img, Side => Left));
+ else
+ Put (Info.Text_Value.all);
+ end if;
+
+ Put (";");
+
+ if Info.Comment'Length > 0 then
+ Put (Spaces (Max_Constant_Value_Len - Info.Value_Len));
+ Put (" -- ");
+ end if;
+ end if;
+
+ Put (Info.Comment.all);
+ New_Line (OFile);
+ end Output_Info;
+
+ --------------------
+ -- Parse_Asm_Line --
+ --------------------
+
+ procedure Parse_Asm_Line (Line : String) is
+ Index1, Index2 : Integer := Line'First;
+
+ function Field_Alloc return String_Access;
+ -- Allocate and return a copy of Line (Index1 .. Index2 - 1)
+
+ procedure Find_Colon (Index : in out Integer);
+ -- Increment Index until the next colon in Line
+
+ function Parse_Int (S : String) return Int_Value_Type;
+ -- Parse a decimal number, preceded by an optional '$' or '#' character,
+ -- and return its value.
+
+ -----------------
+ -- Field_Alloc --
+ -----------------
+
+ function Field_Alloc return String_Access is
+ begin
+ return new String'(Line (Index1 .. Index2 - 1));
+ end Field_Alloc;
+
+ ----------------
+ -- Find_Colon --
+ ----------------
+
+ procedure Find_Colon (Index : in out Integer) is
+ begin
+ loop
+ Index := Index + 1;
+ exit when Index > Line'Last or else Line (Index) = ':';
+ end loop;
+ end Find_Colon;
+
+ ---------------
+ -- Parse_Int --
+ ---------------
+
+ function Parse_Int (S : String) return Int_Value_Type is
+ First : Integer := S'First;
+ Positive : Boolean;
+ begin
+ -- On some platforms, immediate integer values are prefixed with
+ -- a $ or # character in assembly output.
+
+ if S (First) = '$'
+ or else S (First) = '#'
+ then
+ First := First + 1;
+ end if;
+
+ if S (First) = '-' then
+ Positive := False;
+ First := First + 1;
+ else
+ Positive := True;
+ end if;
+
+ return (Positive => Positive,
+ Abs_Value => Long_Unsigned'Value (S (First .. S'Last)));
+
+ exception
+ when E : others =>
+ Put_Line (Standard_Error, "can't parse decimal value: " & S);
+ raise;
+ end Parse_Int;
+
+ -- Start of processing for Parse_Asm_Line
+
+ begin
+ Find_Colon (Index2);
+
+ declare
+ Info : Asm_Info (Kind => Asm_Info_Kind'Value
+ (Line (Line'First .. Index2 - 1)));
+ begin
+ Index1 := Index2 + 1;
+ Find_Colon (Index2);
+
+ Info.Line_Number :=
+ Integer (Parse_Int (Line (Index1 .. Index2 - 1)).Abs_Value);
+
+ case Info.Kind is
+ when CND | CNS =>
+ Index1 := Index2 + 1;
+ Find_Colon (Index2);
+
+ Info.Constant_Name := Field_Alloc;
+ if Info.Constant_Name'Length > Max_Constant_Name_Len then
+ Max_Constant_Name_Len := Info.Constant_Name'Length;
+ end if;
+
+ Index1 := Index2 + 1;
+ Find_Colon (Index2);
+
+ if Info.Kind = CND then
+ Info.Int_Value := Parse_Int (Line (Index1 .. Index2 - 1));
+ Info.Value_Len := Index2 - Index1 - 1;
+ else
+ Info.Text_Value := Field_Alloc;
+ Info.Value_Len := Info.Text_Value'Length;
+ end if;
+
+ when others =>
+ null;
+ end case;
+
+ Index1 := Index2 + 1;
+ Index2 := Line'Last + 1;
+ Info.Comment := Field_Alloc;
+
+ if Info.Kind = TXT then
+ Info.Text_Value := Info.Comment;
+
+ -- Update Max_Constant_Value_Len, but only if this constant has
+ -- a comment (else the value is allowed to be longer).
+
+ elsif Info.Comment'Length > 0 then
+ if Info.Value_Len > Max_Constant_Value_Len then
+ Max_Constant_Value_Len := Info.Value_Len;
+ end if;
+ end if;
+
+ Asm_Infos.Append (Info);
+ end;
+ exception
+ when E : others =>
+ Put_Line (Standard_Error,
+ "can't parse " & Line);
+ Put_Line (Standard_Error,
+ "exception raised: " & Exception_Information (E));
+ end Parse_Asm_Line;
+
+ ------------
+ -- Spaces --
+ ------------
+
+ function Spaces (Count : Integer) return String is
+ begin
+ if Count <= 0 then
+ return "";
+ else
+ return (1 .. Count => ' ');
+ end if;
+ end Spaces;
+
+ -- Local declarations
+
+ Asm_File_Name : constant String := Tmpl_Name & ".s";
+ Tmpl_File_Name : constant String := Tmpl_Name & ".i";
+ Ada_File_Name : constant String := Unit_Name & ".ads";
+
+ Asm_File : Ada.Text_IO.File_Type;
+ Tmpl_File : Ada.Text_IO.File_Type;
+ OFile : Sfile;
+
+ Line : String (1 .. 256);
+ Last : Integer;
+ -- Line being processed
+
+ Current_Line : Integer;
+ Current_Info : Integer;
+ In_Comment : Boolean;
+ In_Template : Boolean;
+
+-- Start of processing for XOSCons
+
+begin
+ -- Load values from assembly file
+
+ Open (Asm_File, In_File, Asm_File_Name);
+
+ while not End_Of_File (Asm_File) loop
+ Get_Line (Asm_File, Line, Last);
+ if Last > 2 and then Line (1 .. 2) = "->" then
+ Parse_Asm_Line (Line (3 .. Last));
+ end if;
+ end loop;
+
+ Close (Asm_File);
+
+ -- Load C template and output definitions
+
+ Open (Tmpl_File, In_File, Tmpl_File_Name);
+ Create (OFile, Out_File, Ada_File_Name);
+
+ Current_Line := 0;
+ Current_Info := Asm_Infos.First;
+ In_Comment := False;
+
+ while not End_Of_File (Tmpl_File) loop
+ <<Get_One_Line>>
+ Get_Line (Tmpl_File, Line, Last);
+
+ if Last >= 2 and then Line (1 .. 2) = "# " then
+ declare
+ Index : Integer := 3;
+ begin
+ while Index <= Last and then Line (Index) in '0' .. '9' loop
+ Index := Index + 1;
+ end loop;
+
+ if Contains_Template_Name (Line (Index + 1 .. Last)) then
+ Current_Line := Integer'Value (Line (3 .. Index - 1));
+ In_Template := True;
+ goto Get_One_Line;
+ else
+ In_Template := False;
+ end if;
+ end;
+
+ elsif In_Template then
+ if In_Comment then
+ if Line (1 .. Last) = "*/" then
+ In_Comment := False;
+ else
+ Put_Line (OFile, Line (1 .. Last));
+ end if;
+
+ elsif Line (1 .. Last) = "/*" then
+ In_Comment := True;
+
+ elsif Asm_Infos.Table (Current_Info).Line_Number = Current_Line then
+ Output_Info (OFile, Current_Info);
+ Current_Info := Current_Info + 1;
+ end if;
+ Current_Line := Current_Line + 1;
+ end if;
+ end loop;
+
+ Close (Tmpl_File);
+
+end XOSCons;
diff --git a/gcc/ada/xref_lib.adb b/gcc/ada/xref_lib.adb
index b09cc70e773..116f364bea1 100644
--- a/gcc/ada/xref_lib.adb
+++ b/gcc/ada/xref_lib.adb
@@ -903,7 +903,6 @@ package body Xref_Lib is
P_Line, P_Column : Natural;
pragma Warnings (Off, P_Line);
pragma Warnings (Off, P_Column);
-
begin
Ptr := Ptr + 1;
Parse_Number (Ali, Ptr, P_Line);
diff --git a/gcc/ada/xutil.adb b/gcc/ada/xutil.adb
new file mode 100644
index 00000000000..fbc755c0981
--- /dev/null
+++ b/gcc/ada/xutil.adb
@@ -0,0 +1,77 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT SYSTEM UTILITIES --
+-- --
+-- X U T I L --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
+-- for more details. You should have received a copy of the GNU General --
+-- Public License distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+package body XUtil is
+
+ use Ada.Strings.Unbounded;
+ use Ada.Streams.Stream_IO;
+
+ --------------
+ -- New_Line --
+ --------------
+
+ procedure New_Line (F : Sfile) is
+ begin
+ Character'Write (Stream (F), ASCII.LF);
+ end New_Line;
+
+ ---------
+ -- Put --
+ ---------
+
+ procedure Put (F : Sfile; S : String) is
+ begin
+ String'Write (Stream (F), S);
+ end Put;
+
+ ---------
+ -- Put --
+ ---------
+
+ procedure Put (F : Sfile; S : VString) is
+ begin
+ Put (F, To_String (S));
+ end Put;
+
+ --------------
+ -- Put_Line --
+ --------------
+
+ procedure Put_Line (F : Sfile; S : String) is
+ begin
+ Put (F, S);
+ New_Line (F);
+ end Put_Line;
+
+ --------------
+ -- Put_Line --
+ --------------
+
+ procedure Put_Line (F : Sfile; S : VString) is
+ begin
+ Put_Line (F, To_String (S));
+ end Put_Line;
+
+end XUtil;
diff --git a/gcc/ada/xutil.ads b/gcc/ada/xutil.ads
new file mode 100644
index 00000000000..b99ca0db002
--- /dev/null
+++ b/gcc/ada/xutil.ads
@@ -0,0 +1,44 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT SYSTEM UTILITIES --
+-- --
+-- X U T I L --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
+-- for more details. You should have received a copy of the GNU General --
+-- Public License distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Shared routines for the build-time code generation utilities
+
+with Ada.Streams.Stream_IO;
+with Ada.Strings.Unbounded;
+
+package XUtil is
+
+ subtype VString is Ada.Strings.Unbounded.Unbounded_String;
+ subtype Sfile is Ada.Streams.Stream_IO.File_Type;
+
+ procedure Put (F : Sfile; S : String);
+ procedure Put (F : Sfile; S : VString);
+ procedure Put_Line (F : Sfile; S : String);
+ procedure Put_Line (F : Sfile; S : VString);
+ procedure New_Line (F : Sfile);
+ -- Similar to the same-named Ada.Text_IO routines, but ensure UNIX line
+ -- ending on all platforms.
+
+end XUtil;
diff --git a/gcc/attribs.c b/gcc/attribs.c
index 3c60e8bd967..ba6a9e294c8 100644
--- a/gcc/attribs.c
+++ b/gcc/attribs.c
@@ -33,6 +33,7 @@ along with GCC; see the file COPYING3. If not see
#include "target.h"
#include "langhooks.h"
#include "hashtab.h"
+#include "c-common.h"
static void init_attributes (void);
@@ -232,6 +233,41 @@ decl_attributes (tree *node, tree attributes, int flags)
if (!attributes_initialized)
init_attributes ();
+ /* If this is a function and the user used #pragma GCC optimize, add the
+ options to the attribute((optimize(...))) list. */
+ if (TREE_CODE (*node) == FUNCTION_DECL && current_optimize_pragma)
+ {
+ tree cur_attr = lookup_attribute ("optimize", attributes);
+ tree opts = copy_list (current_optimize_pragma);
+
+ if (! cur_attr)
+ attributes
+ = tree_cons (get_identifier ("optimize"), opts, attributes);
+ else
+ TREE_VALUE (cur_attr) = chainon (opts, TREE_VALUE (cur_attr));
+ }
+
+ if (TREE_CODE (*node) == FUNCTION_DECL
+ && optimization_current_node != optimization_default_node
+ && !DECL_FUNCTION_SPECIFIC_OPTIMIZATION (*node))
+ DECL_FUNCTION_SPECIFIC_OPTIMIZATION (*node) = optimization_current_node;
+
+ /* If this is a function and the user used #pragma GCC option, add the
+ options to the attribute((option(...))) list. */
+ if (TREE_CODE (*node) == FUNCTION_DECL
+ && current_option_pragma
+ && targetm.target_option.valid_attribute_p (*node, NULL_TREE,
+ current_option_pragma, 0))
+ {
+ tree cur_attr = lookup_attribute ("option", attributes);
+ tree opts = copy_list (current_option_pragma);
+
+ if (! cur_attr)
+ attributes = tree_cons (get_identifier ("option"), opts, attributes);
+ else
+ TREE_VALUE (cur_attr) = chainon (opts, TREE_VALUE (cur_attr));
+ }
+
targetm.insert_attributes (*node, &attributes);
for (a = attributes; a; a = TREE_CHAIN (a))
diff --git a/gcc/basic-block.h b/gcc/basic-block.h
index 4aa864d66cf..caaf22ef742 100644
--- a/gcc/basic-block.h
+++ b/gcc/basic-block.h
@@ -122,7 +122,7 @@ struct edge_def GTY(())
/* Instructions queued on the edge. */
union edge_def_insns {
- tree GTY ((tag ("true"))) t;
+ gimple_seq GTY ((tag ("true"))) g;
rtx GTY ((tag ("false"))) r;
} GTY ((desc ("current_ir_type () == IR_GIMPLE"))) insns;
@@ -231,7 +231,7 @@ struct basic_block_def GTY((chain_next ("%h.next_bb"), chain_prev ("%h.prev_bb")
struct basic_block_def *next_bb;
union basic_block_il_dependent {
- struct tree_bb_info * GTY ((tag ("0"))) tree;
+ struct gimple_bb_info * GTY ((tag ("0"))) gimple;
struct rtl_bb_info * GTY ((tag ("1"))) rtl;
} GTY ((desc ("((%1.flags & BB_RTL) != 0)"))) il;
@@ -266,13 +266,13 @@ struct rtl_bb_info GTY(())
int visited;
};
-struct tree_bb_info GTY(())
+struct gimple_bb_info GTY(())
{
- /* Pointers to the first and last trees of the block. */
- tree stmt_list;
+ /* Sequence of statements in this block. */
+ gimple_seq seq;
- /* Chain of PHI nodes for this block. */
- tree phi_nodes;
+ /* PHI nodes for this block. */
+ gimple_seq phi_nodes;
};
typedef struct basic_block_def *basic_block;
@@ -383,7 +383,7 @@ struct control_flow_graph GTY(())
int x_last_basic_block;
/* Mapping of labels to their associated blocks. At present
- only used for the tree CFG. */
+ only used for the gimple CFG. */
VEC(basic_block,gc) *x_label_to_block_map;
enum profile_status {
@@ -831,9 +831,15 @@ extern bool maybe_hot_bb_p (const_basic_block);
extern bool maybe_hot_edge_p (edge);
extern bool probably_cold_bb_p (const_basic_block);
extern bool probably_never_executed_bb_p (const_basic_block);
-extern bool tree_predicted_by_p (const_basic_block, enum br_predictor);
+extern bool optimize_bb_for_size_p (basic_block);
+extern bool optimize_bb_for_speed_p (basic_block);
+extern bool optimize_edge_for_size_p (edge);
+extern bool optimize_edge_for_speed_p (edge);
+extern bool optimize_insn_for_size_p (void);
+extern bool optimize_insn_for_speed_p (void);
+extern bool gimple_predicted_by_p (const_basic_block, enum br_predictor);
extern bool rtl_predicted_by_p (const_basic_block, enum br_predictor);
-extern void tree_predict_edge (edge, enum br_predictor, int);
+extern void gimple_predict_edge (edge, enum br_predictor, int);
extern void rtl_predict_edge (edge, enum br_predictor, int);
extern void predict_edge_def (edge, enum br_predictor, enum prediction);
extern void guess_outgoing_edge_probabilities (basic_block);
@@ -988,6 +994,11 @@ bb_has_abnormal_pred (basic_block bb)
/* In cfgloopmanip.c. */
extern edge mfb_kj_edge;
-bool mfb_keep_just (edge);
+extern bool mfb_keep_just (edge);
+
+/* In cfgexpand.c. */
+extern void rtl_profile_for_bb (basic_block);
+extern void rtl_profile_for_edge (edge);
+extern void default_rtl_profile (void);
#endif /* GCC_BASIC_BLOCK_H */
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 60caa8126d8..68cadb6a1db 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -27,7 +27,7 @@ along with GCC; see the file COPYING3. If not see
#include "real.h"
#include "rtl.h"
#include "tree.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "flags.h"
#include "regs.h"
#include "hard-reg-set.h"
@@ -98,8 +98,8 @@ static rtx expand_builtin_mathfn_3 (tree, rtx, rtx);
static rtx expand_builtin_interclass_mathfn (tree, rtx, rtx);
static rtx expand_builtin_sincos (tree);
static rtx expand_builtin_cexpi (tree, rtx, rtx);
-static rtx expand_builtin_int_roundingfn (tree, rtx, rtx);
-static rtx expand_builtin_int_roundingfn_2 (tree, rtx, rtx);
+static rtx expand_builtin_int_roundingfn (tree, rtx);
+static rtx expand_builtin_int_roundingfn_2 (tree, rtx);
static rtx expand_builtin_args_info (tree);
static rtx expand_builtin_next_arg (void);
static rtx expand_builtin_va_start (tree);
@@ -207,6 +207,7 @@ static rtx expand_builtin_memory_chk (tree, rtx, enum machine_mode,
enum built_in_function);
static void maybe_emit_chk_warning (tree, enum built_in_function);
static void maybe_emit_sprintf_chk_warning (tree, enum built_in_function);
+static void maybe_emit_free_warning (tree);
static tree fold_builtin_object_size (tree, tree);
static tree fold_builtin_strcat_chk (tree, tree, tree, tree);
static tree fold_builtin_strncat_chk (tree, tree, tree, tree, tree);
@@ -743,7 +744,7 @@ expand_builtin_setjmp_receiver (rtx receiver_label ATTRIBUTE_UNUSED)
{
/* Now restore our arg pointer from the address at which it
was saved in our stack frame. */
- emit_move_insn (virtual_incoming_args_rtx,
+ emit_move_insn (crtl->args.internal_arg_pointer,
copy_to_reg (get_arg_pointer_save_area ()));
}
}
@@ -778,6 +779,11 @@ expand_builtin_longjmp (rtx buf_addr, rtx value)
rtx fp, lab, stack, insn, last;
enum machine_mode sa_mode = STACK_SAVEAREA_MODE (SAVE_NONLOCAL);
+ /* DRAP is needed for stack realign if longjmp is expanded to current
+ function */
+ if (SUPPORTS_STACK_ALIGNMENT)
+ crtl->need_drap = true;
+
if (setjmp_alias_set == -1)
setjmp_alias_set = new_alias_set ();
@@ -1345,7 +1351,7 @@ expand_builtin_apply_args_1 (void)
}
/* Save the arg pointer to the block. */
- tem = copy_to_reg (virtual_incoming_args_rtx);
+ tem = copy_to_reg (crtl->args.internal_arg_pointer);
#ifdef STACK_GROWS_DOWNWARD
/* We need the pointer as the caller actually passed them to us, not
as we might have pretended they were passed. Make sure it's a valid
@@ -1453,6 +1459,14 @@ expand_builtin_apply (rtx function, rtx arguments, rtx argsize)
/* Allocate a block of memory onto the stack and copy the memory
arguments to the outgoing arguments address. */
allocate_dynamic_stack_space (argsize, 0, BITS_PER_UNIT);
+
+ /* Set DRAP flag to true, even though allocate_dynamic_stack_space
+ may have already set current_function_calls_alloca to true.
+ current_function_calls_alloca won't be set if argsize is zero,
+ so we have to guarantee need_drap is true here. */
+ if (SUPPORTS_STACK_ALIGNMENT)
+ crtl->need_drap = true;
+
dest = virtual_outgoing_args_rtx;
#ifndef STACK_GROWS_DOWNWARD
if (GET_CODE (argsize) == CONST_INT)
@@ -2464,11 +2478,10 @@ expand_builtin_cexpi (tree exp, rtx target, rtx subtarget)
do not need to worry about setting errno to EDOM.
If expanding via optab fails, lower expression to (int)(floor(x)).
EXP is the expression that is a call to the builtin function;
- if convenient, the result should be placed in TARGET. SUBTARGET may
- be used as the target for computing one of EXP's operands. */
+ if convenient, the result should be placed in TARGET. */
static rtx
-expand_builtin_int_roundingfn (tree exp, rtx target, rtx subtarget)
+expand_builtin_int_roundingfn (tree exp, rtx target)
{
convert_optab builtin_optab;
rtx op0, insns, tmp;
@@ -2511,7 +2524,7 @@ expand_builtin_int_roundingfn (tree exp, rtx target, rtx subtarget)
side-effects more the once. */
CALL_EXPR_ARG (exp, 0) = arg = builtin_save_expr (arg);
- op0 = expand_expr (arg, subtarget, VOIDmode, EXPAND_NORMAL);
+ op0 = expand_expr (arg, NULL, VOIDmode, EXPAND_NORMAL);
start_sequence ();
@@ -2592,11 +2605,10 @@ expand_builtin_int_roundingfn (tree exp, rtx target, rtx subtarget)
conversion (lrint).
Return 0 if a normal call should be emitted rather than expanding the
function in-line. EXP is the expression that is a call to the builtin
- function; if convenient, the result should be placed in TARGET.
- SUBTARGET may be used as the target for computing one of EXP's operands. */
+ function; if convenient, the result should be placed in TARGET. */
static rtx
-expand_builtin_int_roundingfn_2 (tree exp, rtx target, rtx subtarget)
+expand_builtin_int_roundingfn_2 (tree exp, rtx target)
{
convert_optab builtin_optab;
rtx op0, insns;
@@ -2635,7 +2647,7 @@ expand_builtin_int_roundingfn_2 (tree exp, rtx target, rtx subtarget)
side-effects more the once. */
CALL_EXPR_ARG (exp, 0) = arg = builtin_save_expr (arg);
- op0 = expand_expr (arg, subtarget, VOIDmode, EXPAND_NORMAL);
+ op0 = expand_expr (arg, NULL, VOIDmode, EXPAND_NORMAL);
start_sequence ();
@@ -2899,7 +2911,7 @@ expand_builtin_pow (tree exp, rtx target, rtx subtarget)
if (real_identical (&c, &cint)
&& ((n >= -1 && n <= 2)
|| (flag_unsafe_math_optimizations
- && !optimize_size
+ && optimize_insn_for_speed_p ()
&& powi_cost (n) <= POWI_MAX_MULTS)))
{
op = expand_expr (arg0, subtarget, VOIDmode, EXPAND_NORMAL);
@@ -2923,7 +2935,7 @@ expand_builtin_pow (tree exp, rtx target, rtx subtarget)
real_from_integer (&cint, VOIDmode, n, n < 0 ? -1 : 0, 0);
if (real_identical (&c2, &cint)
&& ((flag_unsafe_math_optimizations
- && !optimize_size
+ && optimize_insn_for_speed_p ()
&& powi_cost (n/2) <= POWI_MAX_MULTS)
|| n == 1))
{
@@ -2968,7 +2980,7 @@ expand_builtin_pow (tree exp, rtx target, rtx subtarget)
real_arithmetic (&c2, RDIV_EXPR, &cint, &dconst3);
real_convert (&c2, mode, &c2);
if (real_identical (&c2, &c)
- && ((!optimize_size
+ && ((optimize_insn_for_speed_p ()
&& powi_cost (n/3) <= POWI_MAX_MULTS)
|| n == 1))
{
@@ -3030,7 +3042,7 @@ expand_builtin_powi (tree exp, rtx target, rtx subtarget)
if ((TREE_INT_CST_HIGH (arg1) == 0
|| TREE_INT_CST_HIGH (arg1) == -1)
&& ((n >= -1 && n <= 2)
- || (! optimize_size
+ || (optimize_insn_for_speed_p ()
&& powi_cost (n) <= POWI_MAX_MULTS)))
{
op0 = expand_expr (arg0, subtarget, VOIDmode, EXPAND_NORMAL);
@@ -3289,6 +3301,7 @@ expand_builtin_memcpy (tree exp, rtx target, enum machine_mode mode)
false, /*endp=*/0);
HOST_WIDE_INT expected_size = -1;
unsigned int expected_align = 0;
+ tree_ann_common_t ann;
if (result)
{
@@ -3310,7 +3323,10 @@ expand_builtin_memcpy (tree exp, rtx target, enum machine_mode mode)
if (src_align == 0)
return NULL_RTX;
- stringop_block_profile (exp, &expected_align, &expected_size);
+ ann = tree_common_ann (exp);
+ if (ann)
+ stringop_block_profile (ann->stmt, &expected_align, &expected_size);
+
if (expected_align < dest_align)
expected_align = dest_align;
dest_mem = get_memory_rtx (dest, len);
@@ -3885,6 +3901,7 @@ expand_builtin_memset_args (tree dest, tree val, tree len,
rtx dest_mem, dest_addr, len_rtx;
HOST_WIDE_INT expected_size = -1;
unsigned int expected_align = 0;
+ tree_ann_common_t ann;
dest_align = get_pointer_alignment (dest, BIGGEST_ALIGNMENT);
@@ -3892,7 +3909,10 @@ expand_builtin_memset_args (tree dest, tree val, tree len,
if (dest_align == 0)
return NULL_RTX;
- stringop_block_profile (orig_exp, &expected_align, &expected_size);
+ ann = tree_common_ann (orig_exp);
+ if (ann)
+ stringop_block_profile (ann->stmt, &expected_align, &expected_size);
+
if (expected_align < dest_align)
expected_align = dest_align;
@@ -4444,7 +4464,7 @@ expand_builtin_strcat (tree fndecl, tree exp, rtx target, enum machine_mode mode
if (p && *p == '\0')
return expand_expr (dst, target, mode, EXPAND_NORMAL);
- if (!optimize_size)
+ if (optimize_insn_for_speed_p ())
{
/* See if we can store by pieces into (dst + strlen(dst)). */
tree newsrc, newdst,
@@ -4757,7 +4777,8 @@ expand_builtin_va_start (tree exp)
current (padded) address and increment by the (padded) size. */
tree
-std_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, tree *post_p)
+std_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p,
+ gimple_seq *post_p)
{
tree addr, t, type_size, rounded_size, valist_tmp;
unsigned HOST_WIDE_INT align, boundary;
@@ -4775,7 +4796,16 @@ std_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, tree *post_p)
type = build_pointer_type (type);
align = PARM_BOUNDARY / BITS_PER_UNIT;
- boundary = FUNCTION_ARG_BOUNDARY (TYPE_MODE (type), type) / BITS_PER_UNIT;
+ boundary = FUNCTION_ARG_BOUNDARY (TYPE_MODE (type), type);
+
+ /* When we align parameter on stack for caller, if the parameter
+ alignment is beyond MAX_SUPPORTED_STACK_ALIGNMENT, it will be
+ aligned at MAX_SUPPORTED_STACK_ALIGNMENT. We will match callee
+ here with caller. */
+ if (boundary > MAX_SUPPORTED_STACK_ALIGNMENT)
+ boundary = MAX_SUPPORTED_STACK_ALIGNMENT;
+
+ boundary /= BITS_PER_UNIT;
/* Hoist the valist value into a temporary for the moment. */
valist_tmp = get_initialized_tmp_var (valist, pre_p, NULL);
@@ -4868,7 +4898,7 @@ dummy_object (tree type)
builtin function, but a very special sort of operator. */
enum gimplify_status
-gimplify_va_arg_expr (tree *expr_p, tree *pre_p, tree *post_p)
+gimplify_va_arg_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
{
tree promoted_type, have_va_type;
tree valist = TREE_OPERAND (*expr_p, 0);
@@ -4893,13 +4923,14 @@ gimplify_va_arg_expr (tree *expr_p, tree *pre_p, tree *post_p)
!= type)
{
static bool gave_help;
+ bool warned;
/* Unfortunately, this is merely undefined, rather than a constraint
violation, so we cannot make this an error. If this call is never
executed, the program is still strictly conforming. */
- warning (0, "%qT is promoted to %qT when passed through %<...%>",
- type, promoted_type);
- if (! gave_help)
+ warned = warning (0, "%qT is promoted to %qT when passed through %<...%>",
+ type, promoted_type);
+ if (!gave_help && warned)
{
gave_help = true;
inform ("(so you should pass %qT not %qT to %<va_arg%>)",
@@ -4908,9 +4939,10 @@ gimplify_va_arg_expr (tree *expr_p, tree *pre_p, tree *post_p)
/* We can, however, treat "undefined" any way we please.
Call abort to encourage the user to fix the program. */
- inform ("if this code is reached, the program will abort");
+ if (warned)
+ inform ("if this code is reached, the program will abort");
t = build_call_expr (implicit_built_in_decls[BUILT_IN_TRAP], 0);
- append_to_statement_list (t, pre_p);
+ gimplify_and_add (t, pre_p);
/* This is dead code, but go ahead and finish so that the
mode of the result comes out right. */
@@ -4932,13 +4964,14 @@ gimplify_va_arg_expr (tree *expr_p, tree *pre_p, tree *post_p)
tree p1 = build_pointer_type (TREE_TYPE (have_va_type));
valist = build_fold_addr_expr_with_type (valist, p1);
}
+
gimplify_expr (&valist, pre_p, post_p, is_gimple_val, fb_rvalue);
}
else
gimplify_expr (&valist, pre_p, post_p, is_gimple_min_lval, fb_lvalue);
if (!targetm.gimplify_va_arg_expr)
- /* FIXME:Once most targets are converted we should merely
+ /* FIXME: Once most targets are converted we should merely
assert this is non-null. */
return GS_ALL_DONE;
@@ -5545,18 +5578,18 @@ expand_builtin_sprintf (tree exp, rtx target, enum machine_mode mode)
static rtx
expand_builtin_profile_func (bool exitp)
{
- rtx this, which;
+ rtx this_rtx, which;
- this = DECL_RTL (current_function_decl);
- gcc_assert (MEM_P (this));
- this = XEXP (this, 0);
+ this_rtx = DECL_RTL (current_function_decl);
+ gcc_assert (MEM_P (this_rtx));
+ this_rtx = XEXP (this_rtx, 0);
if (exitp)
which = profile_function_exit_libfunc;
else
which = profile_function_entry_libfunc;
- emit_library_call (which, LCT_NORMAL, VOIDmode, 2, this, Pmode,
+ emit_library_call (which, LCT_NORMAL, VOIDmode, 2, this_rtx, Pmode,
expand_builtin_return_addr (BUILT_IN_RETURN_ADDRESS,
0),
Pmode);
@@ -6100,7 +6133,8 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
if (!optimize
&& !called_as_built_in (fndecl)
&& DECL_ASSEMBLER_NAME_SET_P (fndecl)
- && fcode != BUILT_IN_ALLOCA)
+ && fcode != BUILT_IN_ALLOCA
+ && fcode != BUILT_IN_FREE)
return expand_call (exp, target, ignore);
/* The built-in function expanders test for target == const0_rtx
@@ -6198,7 +6232,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
CASE_FLT_FN (BUILT_IN_LLCEIL):
CASE_FLT_FN (BUILT_IN_LFLOOR):
CASE_FLT_FN (BUILT_IN_LLFLOOR):
- target = expand_builtin_int_roundingfn (exp, target, subtarget);
+ target = expand_builtin_int_roundingfn (exp, target);
if (target)
return target;
break;
@@ -6207,7 +6241,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
CASE_FLT_FN (BUILT_IN_LLRINT):
CASE_FLT_FN (BUILT_IN_LROUND):
CASE_FLT_FN (BUILT_IN_LLROUND):
- target = expand_builtin_int_roundingfn_2 (exp, target, subtarget);
+ target = expand_builtin_int_roundingfn_2 (exp, target);
if (target)
return target;
break;
@@ -6977,6 +7011,10 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
maybe_emit_sprintf_chk_warning (exp, fcode);
break;
+ case BUILT_IN_FREE:
+ maybe_emit_free_warning (exp);
+ break;
+
default: /* just do library call, if unknown builtin */
break;
}
@@ -7241,7 +7279,7 @@ fold_builtin_inf (tree type, int warn)
Thus we pedwarn to ensure this constraint violation is
diagnosed. */
if (!MODE_HAS_INFINITIES (TYPE_MODE (type)) && warn)
- pedwarn ("target format does not support infinity");
+ pedwarn (0, "target format does not support infinity");
real_inf (&real);
return build_real (type, real);
@@ -7285,7 +7323,7 @@ integer_valued_real_p (tree t)
case COMPOUND_EXPR:
case MODIFY_EXPR:
case BIND_EXPR:
- return integer_valued_real_p (GENERIC_TREE_OPERAND (t, 1));
+ return integer_valued_real_p (TREE_OPERAND (t, 1));
case PLUS_EXPR:
case MINUS_EXPR:
@@ -10565,7 +10603,7 @@ fold_builtin_n (tree fndecl, tree *args, int nargs, bool ignore)
}
if (ret)
{
- ret = build1 (NOP_EXPR, GENERIC_TREE_TYPE (ret), ret);
+ ret = build1 (NOP_EXPR, TREE_TYPE (ret), ret);
TREE_NO_WARNING (ret) = 1;
return ret;
}
@@ -10826,6 +10864,61 @@ validate_arg (const_tree arg, enum tree_code code)
/* This function validates the types of a function call argument list
against a specified list of tree_codes. If the last specifier is a 0,
that represents an ellipses, otherwise the last specifier must be a
+ VOID_TYPE.
+
+ This is the GIMPLE version of validate_arglist. Eventually we want to
+ completely convert builtins.c to work from GIMPLEs and the tree based
+ validate_arglist will then be removed. */
+
+bool
+validate_gimple_arglist (const_gimple call, ...)
+{
+ enum tree_code code;
+ bool res = 0;
+ va_list ap;
+ const_tree arg;
+ size_t i;
+
+ va_start (ap, call);
+ i = 0;
+
+ do
+ {
+ code = va_arg (ap, enum tree_code);
+ switch (code)
+ {
+ case 0:
+ /* This signifies an ellipses, any further arguments are all ok. */
+ res = true;
+ goto end;
+ case VOID_TYPE:
+ /* This signifies an endlink, if no arguments remain, return
+ true, otherwise return false. */
+ res = (i == gimple_call_num_args (call));
+ goto end;
+ default:
+ /* If no parameters remain or the parameter's code does not
+ match the specified code, return false. Otherwise continue
+ checking any remaining arguments. */
+ arg = gimple_call_arg (call, i++);
+ if (!validate_arg (arg, code))
+ goto end;
+ break;
+ }
+ }
+ while (1);
+
+ /* We need gotos here since we can only have one VA_CLOSE in a
+ function. */
+ end: ;
+ va_end (ap);
+
+ return res;
+}
+
+/* This function validates the types of a function call argument list
+ against a specified list of tree_codes. If the last specifier is a 0,
+ that represents an ellipses, otherwise the last specifier must be a
VOID_TYPE. */
bool
@@ -11432,6 +11525,7 @@ fold_builtin_fputs (tree arg0, tree arg1, bool ignore, bool unlocked, tree len)
/* Fold the next_arg or va_start call EXP. Returns true if there was an error
produced. False otherwise. This is done so that we don't output the error
or warning twice or three times. */
+
bool
fold_builtin_next_arg (tree exp, bool va_start_p)
{
@@ -11895,6 +11989,27 @@ maybe_emit_sprintf_chk_warning (tree exp, enum built_in_function fcode)
}
}
+/* Emit warning if a free is called with address of a variable. */
+
+static void
+maybe_emit_free_warning (tree exp)
+{
+ tree arg = CALL_EXPR_ARG (exp, 0);
+
+ STRIP_NOPS (arg);
+ if (TREE_CODE (arg) != ADDR_EXPR)
+ return;
+
+ arg = get_base_address (TREE_OPERAND (arg, 0));
+ if (arg == NULL || INDIRECT_REF_P (arg))
+ return;
+
+ if (SSA_VAR_P (arg))
+ warning (0, "%Kattempt to free a non-heap object %qD", exp, arg);
+ else
+ warning (0, "%Kattempt to free a non-heap object", exp);
+}
+
/* Fold a call to __builtin_object_size with arguments PTR and OST,
if possible. */
@@ -12752,14 +12867,16 @@ do_mpfr_arg1 (tree arg, tree type, int (*func)(mpfr_ptr, mpfr_srcptr, mp_rnd_t),
&& (!min || real_compare (inclusive ? GE_EXPR: GT_EXPR , ra, min))
&& (!max || real_compare (inclusive ? LE_EXPR: LT_EXPR , ra, max)))
{
- const int prec = REAL_MODE_FORMAT (TYPE_MODE (type))->p;
+ const struct real_format *fmt = REAL_MODE_FORMAT (TYPE_MODE (type));
+ const int prec = fmt->p;
+ const mp_rnd_t rnd = fmt->round_towards_zero? GMP_RNDZ : GMP_RNDN;
int inexact;
mpfr_t m;
mpfr_init2 (m, prec);
mpfr_from_real (m, ra, GMP_RNDN);
mpfr_clear_flags ();
- inexact = func (m, m, GMP_RNDN);
+ inexact = func (m, m, rnd);
result = do_mpfr_ckconv (m, type, inexact);
mpfr_clear (m);
}
@@ -12794,7 +12911,9 @@ do_mpfr_arg2 (tree arg1, tree arg2, tree type,
if (real_isfinite (ra1) && real_isfinite (ra2))
{
- const int prec = REAL_MODE_FORMAT (TYPE_MODE (type))->p;
+ const struct real_format *fmt = REAL_MODE_FORMAT (TYPE_MODE (type));
+ const int prec = fmt->p;
+ const mp_rnd_t rnd = fmt->round_towards_zero? GMP_RNDZ : GMP_RNDN;
int inexact;
mpfr_t m1, m2;
@@ -12802,7 +12921,7 @@ do_mpfr_arg2 (tree arg1, tree arg2, tree type,
mpfr_from_real (m1, ra1, GMP_RNDN);
mpfr_from_real (m2, ra2, GMP_RNDN);
mpfr_clear_flags ();
- inexact = func (m1, m1, m2, GMP_RNDN);
+ inexact = func (m1, m1, m2, rnd);
result = do_mpfr_ckconv (m1, type, inexact);
mpfr_clears (m1, m2, NULL);
}
@@ -12840,7 +12959,9 @@ do_mpfr_arg3 (tree arg1, tree arg2, tree arg3, tree type,
if (real_isfinite (ra1) && real_isfinite (ra2) && real_isfinite (ra3))
{
- const int prec = REAL_MODE_FORMAT (TYPE_MODE (type))->p;
+ const struct real_format *fmt = REAL_MODE_FORMAT (TYPE_MODE (type));
+ const int prec = fmt->p;
+ const mp_rnd_t rnd = fmt->round_towards_zero? GMP_RNDZ : GMP_RNDN;
int inexact;
mpfr_t m1, m2, m3;
@@ -12849,7 +12970,7 @@ do_mpfr_arg3 (tree arg1, tree arg2, tree arg3, tree type,
mpfr_from_real (m2, ra2, GMP_RNDN);
mpfr_from_real (m3, ra3, GMP_RNDN);
mpfr_clear_flags ();
- inexact = func (m1, m1, m2, m3, GMP_RNDN);
+ inexact = func (m1, m1, m2, m3, rnd);
result = do_mpfr_ckconv (m1, type, inexact);
mpfr_clears (m1, m2, m3, NULL);
}
@@ -12883,7 +13004,9 @@ do_mpfr_sincos (tree arg, tree arg_sinp, tree arg_cosp)
if (real_isfinite (ra))
{
- const int prec = REAL_MODE_FORMAT (TYPE_MODE (type))->p;
+ const struct real_format *fmt = REAL_MODE_FORMAT (TYPE_MODE (type));
+ const int prec = fmt->p;
+ const mp_rnd_t rnd = fmt->round_towards_zero? GMP_RNDZ : GMP_RNDN;
tree result_s, result_c;
int inexact;
mpfr_t m, ms, mc;
@@ -12891,7 +13014,7 @@ do_mpfr_sincos (tree arg, tree arg_sinp, tree arg_cosp)
mpfr_inits2 (prec, m, ms, mc, NULL);
mpfr_from_real (m, ra, GMP_RNDN);
mpfr_clear_flags ();
- inexact = mpfr_sin_cos (ms, mc, m, GMP_RNDN);
+ inexact = mpfr_sin_cos (ms, mc, m, rnd);
result_s = do_mpfr_ckconv (ms, type, inexact);
result_c = do_mpfr_ckconv (mc, type, inexact);
mpfr_clears (m, ms, mc, NULL);
@@ -12956,14 +13079,16 @@ do_mpfr_bessel_n (tree arg1, tree arg2, tree type,
&& real_isfinite (ra)
&& (!min || real_compare (inclusive ? GE_EXPR: GT_EXPR , ra, min)))
{
- const int prec = REAL_MODE_FORMAT (TYPE_MODE (type))->p;
+ const struct real_format *fmt = REAL_MODE_FORMAT (TYPE_MODE (type));
+ const int prec = fmt->p;
+ const mp_rnd_t rnd = fmt->round_towards_zero? GMP_RNDZ : GMP_RNDN;
int inexact;
mpfr_t m;
mpfr_init2 (m, prec);
mpfr_from_real (m, ra, GMP_RNDN);
mpfr_clear_flags ();
- inexact = func (m, n, m, GMP_RNDN);
+ inexact = func (m, n, m, rnd);
result = do_mpfr_ckconv (m, type, inexact);
mpfr_clear (m);
}
@@ -12997,7 +13122,9 @@ do_mpfr_remquo (tree arg0, tree arg1, tree arg_quo)
if (real_isfinite (ra0) && real_isfinite (ra1))
{
- const int prec = REAL_MODE_FORMAT (TYPE_MODE (type))->p;
+ const struct real_format *fmt = REAL_MODE_FORMAT (TYPE_MODE (type));
+ const int prec = fmt->p;
+ const mp_rnd_t rnd = fmt->round_towards_zero? GMP_RNDZ : GMP_RNDN;
tree result_rem;
long integer_quo;
mpfr_t m0, m1;
@@ -13006,7 +13133,7 @@ do_mpfr_remquo (tree arg0, tree arg1, tree arg_quo)
mpfr_from_real (m0, ra0, GMP_RNDN);
mpfr_from_real (m1, ra1, GMP_RNDN);
mpfr_clear_flags ();
- mpfr_remquo (m0, &integer_quo, m0, m1, GMP_RNDN);
+ mpfr_remquo (m0, &integer_quo, m0, m1, rnd);
/* Remquo is independent of the rounding mode, so pass
inexact=0 to do_mpfr_ckconv(). */
result_rem = do_mpfr_ckconv (m0, type, /*inexact=*/ 0);
@@ -13074,7 +13201,9 @@ do_mpfr_lgamma_r (tree arg, tree arg_sg, tree type)
&& ra->cl != rvc_zero
&& !(real_isneg(ra) && real_isinteger(ra, TYPE_MODE (type))))
{
- const int prec = REAL_MODE_FORMAT (TYPE_MODE (type))->p;
+ const struct real_format *fmt = REAL_MODE_FORMAT (TYPE_MODE (type));
+ const int prec = fmt->p;
+ const mp_rnd_t rnd = fmt->round_towards_zero? GMP_RNDZ : GMP_RNDN;
int inexact, sg;
mpfr_t m;
tree result_lg;
@@ -13082,7 +13211,7 @@ do_mpfr_lgamma_r (tree arg, tree arg_sg, tree type)
mpfr_init2 (m, prec);
mpfr_from_real (m, ra, GMP_RNDN);
mpfr_clear_flags ();
- inexact = mpfr_lgamma (m, &sg, m, GMP_RNDN);
+ inexact = mpfr_lgamma (m, &sg, m, rnd);
result_lg = do_mpfr_ckconv (m, type, inexact);
mpfr_clear (m);
if (result_lg)
@@ -13106,3 +13235,303 @@ do_mpfr_lgamma_r (tree arg, tree arg_sg, tree type)
return result;
}
#endif
+
+/* FIXME tuples.
+ The functions below provide an alternate interface for folding
+ builtin function calls presented as GIMPLE_CALL statements rather
+ than as CALL_EXPRs. The folded result is still expressed as a
+ tree. There is too much code duplication in the handling of
+ varargs functions, and a more intrusive re-factoring would permit
+ better sharing of code between the tree and statement-based
+ versions of these functions. */
+
+/* Construct a new CALL_EXPR using the tail of the argument list of STMT
+ along with N new arguments specified as the "..." parameters. SKIP
+ is the number of arguments in STMT to be omitted. This function is used
+ to do varargs-to-varargs transformations. */
+
+static tree
+gimple_rewrite_call_expr (gimple stmt, int skip, tree fndecl, int n, ...)
+{
+ int oldnargs = gimple_call_num_args (stmt);
+ int nargs = oldnargs - skip + n;
+ tree fntype = TREE_TYPE (fndecl);
+ tree fn = build1 (ADDR_EXPR, build_pointer_type (fntype), fndecl);
+ tree *buffer;
+ int i, j;
+ va_list ap;
+
+ buffer = XALLOCAVEC (tree, nargs);
+ va_start (ap, n);
+ for (i = 0; i < n; i++)
+ buffer[i] = va_arg (ap, tree);
+ va_end (ap);
+ for (j = skip; j < oldnargs; j++, i++)
+ buffer[i] = gimple_call_arg (stmt, j);
+
+ return fold (build_call_array (TREE_TYPE (fntype), fn, nargs, buffer));
+}
+
+/* Fold a call STMT to __{,v}sprintf_chk. Return NULL_TREE if
+ a normal call should be emitted rather than expanding the function
+ inline. FCODE is either BUILT_IN_SPRINTF_CHK or BUILT_IN_VSPRINTF_CHK. */
+
+static tree
+gimple_fold_builtin_sprintf_chk (gimple stmt, enum built_in_function fcode)
+{
+ tree dest, size, len, fn, fmt, flag;
+ const char *fmt_str;
+ int nargs = gimple_call_num_args (stmt);
+
+ /* Verify the required arguments in the original call. */
+ if (nargs < 4)
+ return NULL_TREE;
+ dest = gimple_call_arg (stmt, 0);
+ if (!validate_arg (dest, POINTER_TYPE))
+ return NULL_TREE;
+ flag = gimple_call_arg (stmt, 1);
+ if (!validate_arg (flag, INTEGER_TYPE))
+ return NULL_TREE;
+ size = gimple_call_arg (stmt, 2);
+ if (!validate_arg (size, INTEGER_TYPE))
+ return NULL_TREE;
+ fmt = gimple_call_arg (stmt, 3);
+ if (!validate_arg (fmt, POINTER_TYPE))
+ return NULL_TREE;
+
+ if (! host_integerp (size, 1))
+ return NULL_TREE;
+
+ len = NULL_TREE;
+
+ if (!init_target_chars ())
+ return NULL_TREE;
+
+ /* Check whether the format is a literal string constant. */
+ fmt_str = c_getstr (fmt);
+ if (fmt_str != NULL)
+ {
+ /* If the format doesn't contain % args or %%, we know the size. */
+ if (strchr (fmt_str, target_percent) == 0)
+ {
+ if (fcode != BUILT_IN_SPRINTF_CHK || nargs == 4)
+ len = build_int_cstu (size_type_node, strlen (fmt_str));
+ }
+ /* If the format is "%s" and first ... argument is a string literal,
+ we know the size too. */
+ else if (fcode == BUILT_IN_SPRINTF_CHK
+ && strcmp (fmt_str, target_percent_s) == 0)
+ {
+ tree arg;
+
+ if (nargs == 5)
+ {
+ arg = gimple_call_arg (stmt, 4);
+ if (validate_arg (arg, POINTER_TYPE))
+ {
+ len = c_strlen (arg, 1);
+ if (! len || ! host_integerp (len, 1))
+ len = NULL_TREE;
+ }
+ }
+ }
+ }
+
+ if (! integer_all_onesp (size))
+ {
+ if (! len || ! tree_int_cst_lt (len, size))
+ return NULL_TREE;
+ }
+
+ /* Only convert __{,v}sprintf_chk to {,v}sprintf if flag is 0
+ or if format doesn't contain % chars or is "%s". */
+ if (! integer_zerop (flag))
+ {
+ if (fmt_str == NULL)
+ return NULL_TREE;
+ if (strchr (fmt_str, target_percent) != NULL
+ && strcmp (fmt_str, target_percent_s))
+ return NULL_TREE;
+ }
+
+ /* If __builtin_{,v}sprintf_chk is used, assume {,v}sprintf is available. */
+ fn = built_in_decls[fcode == BUILT_IN_VSPRINTF_CHK
+ ? BUILT_IN_VSPRINTF : BUILT_IN_SPRINTF];
+ if (!fn)
+ return NULL_TREE;
+
+ return gimple_rewrite_call_expr (stmt, 4, fn, 2, dest, fmt);
+}
+
+/* Fold a call STMT to {,v}snprintf. Return NULL_TREE if
+ a normal call should be emitted rather than expanding the function
+ inline. FCODE is either BUILT_IN_SNPRINTF_CHK or
+ BUILT_IN_VSNPRINTF_CHK. If MAXLEN is not NULL, it is maximum length
+ passed as second argument. */
+
+tree
+gimple_fold_builtin_snprintf_chk (gimple stmt, tree maxlen,
+ enum built_in_function fcode)
+{
+ tree dest, size, len, fn, fmt, flag;
+ const char *fmt_str;
+
+ /* Verify the required arguments in the original call. */
+ if (gimple_call_num_args (stmt) < 5)
+ return NULL_TREE;
+ dest = gimple_call_arg (stmt, 0);
+ if (!validate_arg (dest, POINTER_TYPE))
+ return NULL_TREE;
+ len = gimple_call_arg (stmt, 1);
+ if (!validate_arg (len, INTEGER_TYPE))
+ return NULL_TREE;
+ flag = gimple_call_arg (stmt, 2);
+ if (!validate_arg (flag, INTEGER_TYPE))
+ return NULL_TREE;
+ size = gimple_call_arg (stmt, 3);
+ if (!validate_arg (size, INTEGER_TYPE))
+ return NULL_TREE;
+ fmt = gimple_call_arg (stmt, 4);
+ if (!validate_arg (fmt, POINTER_TYPE))
+ return NULL_TREE;
+
+ if (! host_integerp (size, 1))
+ return NULL_TREE;
+
+ if (! integer_all_onesp (size))
+ {
+ if (! host_integerp (len, 1))
+ {
+ /* If LEN is not constant, try MAXLEN too.
+ For MAXLEN only allow optimizing into non-_ocs function
+ if SIZE is >= MAXLEN, never convert to __ocs_fail (). */
+ if (maxlen == NULL_TREE || ! host_integerp (maxlen, 1))
+ return NULL_TREE;
+ }
+ else
+ maxlen = len;
+
+ if (tree_int_cst_lt (size, maxlen))
+ return NULL_TREE;
+ }
+
+ if (!init_target_chars ())
+ return NULL_TREE;
+
+ /* Only convert __{,v}snprintf_chk to {,v}snprintf if flag is 0
+ or if format doesn't contain % chars or is "%s". */
+ if (! integer_zerop (flag))
+ {
+ fmt_str = c_getstr (fmt);
+ if (fmt_str == NULL)
+ return NULL_TREE;
+ if (strchr (fmt_str, target_percent) != NULL
+ && strcmp (fmt_str, target_percent_s))
+ return NULL_TREE;
+ }
+
+ /* If __builtin_{,v}snprintf_chk is used, assume {,v}snprintf is
+ available. */
+ fn = built_in_decls[fcode == BUILT_IN_VSNPRINTF_CHK
+ ? BUILT_IN_VSNPRINTF : BUILT_IN_SNPRINTF];
+ if (!fn)
+ return NULL_TREE;
+
+ return gimple_rewrite_call_expr (stmt, 5, fn, 3, dest, len, fmt);
+}
+
+/* Builtins with folding operations that operate on "..." arguments
+ need special handling; we need to store the arguments in a convenient
+ data structure before attempting any folding. Fortunately there are
+ only a few builtins that fall into this category. FNDECL is the
+ function, EXP is the CALL_EXPR for the call, and IGNORE is true if the
+ result of the function call is ignored. */
+
+static tree
+gimple_fold_builtin_varargs (tree fndecl, gimple stmt, bool ignore ATTRIBUTE_UNUSED)
+{
+ enum built_in_function fcode = DECL_FUNCTION_CODE (fndecl);
+ tree ret = NULL_TREE;
+
+ switch (fcode)
+ {
+ case BUILT_IN_SPRINTF_CHK:
+ case BUILT_IN_VSPRINTF_CHK:
+ ret = gimple_fold_builtin_sprintf_chk (stmt, fcode);
+ break;
+
+ case BUILT_IN_SNPRINTF_CHK:
+ case BUILT_IN_VSNPRINTF_CHK:
+ ret = gimple_fold_builtin_snprintf_chk (stmt, NULL_TREE, fcode);
+
+ default:
+ break;
+ }
+ if (ret)
+ {
+ ret = build1 (NOP_EXPR, TREE_TYPE (ret), ret);
+ TREE_NO_WARNING (ret) = 1;
+ return ret;
+ }
+ return NULL_TREE;
+}
+
+/* A wrapper function for builtin folding that prevents warnings for
+ "statement without effect" and the like, caused by removing the
+ call node earlier than the warning is generated. */
+
+tree
+fold_call_stmt (gimple stmt, bool ignore)
+{
+ tree ret = NULL_TREE;
+ tree fndecl = gimple_call_fndecl (stmt);
+ if (fndecl
+ && TREE_CODE (fndecl) == FUNCTION_DECL
+ && DECL_BUILT_IN (fndecl)
+ && !gimple_call_va_arg_pack_p (stmt))
+ {
+ int nargs = gimple_call_num_args (stmt);
+
+ /* FIXME: Don't use a list in this interface. */
+ if (DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_MD)
+ {
+ tree arglist = NULL_TREE;
+ int i;
+ for (i = nargs - 1; i >= 0; i--)
+ arglist = tree_cons (NULL_TREE, gimple_call_arg (stmt, i), arglist);
+ return targetm.fold_builtin (fndecl, arglist, ignore);
+ }
+ else
+ {
+ if (nargs <= MAX_ARGS_TO_FOLD_BUILTIN)
+ {
+ tree args[MAX_ARGS_TO_FOLD_BUILTIN];
+ int i;
+ for (i = 0; i < nargs; i++)
+ args[i] = gimple_call_arg (stmt, i);
+ ret = fold_builtin_n (fndecl, args, nargs, ignore);
+ }
+ if (!ret)
+ ret = gimple_fold_builtin_varargs (fndecl, stmt, ignore);
+ if (ret)
+ {
+ /* Propagate location information from original call to
+ expansion of builtin. Otherwise things like
+ maybe_emit_chk_warning, that operate on the expansion
+ of a builtin, will use the wrong location information. */
+ if (gimple_has_location (stmt))
+ {
+ tree realret = ret;
+ if (TREE_CODE (ret) == NOP_EXPR)
+ realret = TREE_OPERAND (ret, 0);
+ if (CAN_HAVE_LOCATION_P (realret)
+ && !EXPR_HAS_LOCATION (realret))
+ SET_EXPR_LOCATION (realret, gimple_location (stmt));
+ return realret;
+ }
+ return ret;
+ }
+ }
+ }
+ return NULL_TREE;
+}
diff --git a/gcc/c-common.c b/gcc/c-common.c
index e93d2fba6df..8bac9cb4f03 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -48,6 +48,7 @@ along with GCC; see the file COPYING3. If not see
#include "real.h"
#include "cgraph.h"
#include "target-def.h"
+#include "gimple.h"
#include "fixed-value.h"
cpp_reader *parse_in; /* Declared in c-pragma.h. */
@@ -341,10 +342,6 @@ int flag_isoc99;
int flag_hosted = 1;
-/* Warn if main is suspicious. */
-
-int warn_main;
-
/* ObjC language option variables. */
@@ -574,6 +571,8 @@ static tree handle_warn_unused_result_attribute (tree *, tree, tree, int,
static tree handle_sentinel_attribute (tree *, tree, tree, int, bool *);
static tree handle_type_generic_attribute (tree *, tree, tree, int, bool *);
static tree handle_alloc_size_attribute (tree *, tree, tree, int, bool *);
+static tree handle_option_attribute (tree *, tree, tree, int, bool *);
+static tree handle_optimize_attribute (tree *, tree, tree, int, bool *);
static void check_function_nonnull (tree, int, tree *);
static void check_nonnull_arg (void *, tree, unsigned HOST_WIDE_INT);
@@ -595,7 +594,7 @@ static int resort_field_decl_cmp (const void *, const void *);
If -fno-asm is used, D_ASM is added to the mask. If
-fno-gnu-keywords is used, D_EXT is added. If -fno-asm and C in
C89 mode, D_EXT89 is added for both -fno-asm and -fno-gnu-keywords.
- In C with -Wcxx-compat, we warn if D_CXXWARN is set. */
+ In C with -Wc++-compat, we warn if D_CXXWARN is set. */
const struct c_common_resword c_common_reswords[] =
{
@@ -662,44 +661,44 @@ const struct c_common_resword c_common_reswords[] =
{ "__volatile__", RID_VOLATILE, 0 },
{ "asm", RID_ASM, D_ASM },
{ "auto", RID_AUTO, 0 },
- { "bool", RID_BOOL, D_CXXONLY },
+ { "bool", RID_BOOL, D_CXXONLY | D_CXXWARN },
{ "break", RID_BREAK, 0 },
{ "case", RID_CASE, 0 },
- { "catch", RID_CATCH, D_CXX_OBJC },
+ { "catch", RID_CATCH, D_CXX_OBJC | D_CXXWARN },
{ "char", RID_CHAR, 0 },
- { "char16_t", RID_CHAR16, D_CXXONLY | D_CXX0X },
- { "char32_t", RID_CHAR32, D_CXXONLY | D_CXX0X },
- { "class", RID_CLASS, D_CXX_OBJC },
+ { "char16_t", RID_CHAR16, D_CXXONLY | D_CXX0X | D_CXXWARN },
+ { "char32_t", RID_CHAR32, D_CXXONLY | D_CXX0X | D_CXXWARN },
+ { "class", RID_CLASS, D_CXX_OBJC | D_CXXWARN },
{ "const", RID_CONST, 0 },
{ "const_cast", RID_CONSTCAST, D_CXXONLY | D_CXXWARN },
{ "continue", RID_CONTINUE, 0 },
- { "decltype", RID_DECLTYPE, D_CXXONLY | D_CXX0X },
+ { "decltype", RID_DECLTYPE, D_CXXONLY | D_CXX0X | D_CXXWARN },
{ "default", RID_DEFAULT, 0 },
- { "delete", RID_DELETE, D_CXXONLY },
+ { "delete", RID_DELETE, D_CXXONLY | D_CXXWARN },
{ "do", RID_DO, 0 },
{ "double", RID_DOUBLE, 0 },
{ "dynamic_cast", RID_DYNCAST, D_CXXONLY | D_CXXWARN },
{ "else", RID_ELSE, 0 },
{ "enum", RID_ENUM, 0 },
- { "explicit", RID_EXPLICIT, D_CXXONLY },
- { "export", RID_EXPORT, D_CXXONLY },
+ { "explicit", RID_EXPLICIT, D_CXXONLY | D_CXXWARN },
+ { "export", RID_EXPORT, D_CXXONLY | D_CXXWARN },
{ "extern", RID_EXTERN, 0 },
- { "false", RID_FALSE, D_CXXONLY },
+ { "false", RID_FALSE, D_CXXONLY | D_CXXWARN },
{ "float", RID_FLOAT, 0 },
{ "for", RID_FOR, 0 },
- { "friend", RID_FRIEND, D_CXXONLY },
+ { "friend", RID_FRIEND, D_CXXONLY | D_CXXWARN },
{ "goto", RID_GOTO, 0 },
{ "if", RID_IF, 0 },
{ "inline", RID_INLINE, D_EXT89 },
{ "int", RID_INT, 0 },
{ "long", RID_LONG, 0 },
{ "mutable", RID_MUTABLE, D_CXXONLY | D_CXXWARN },
- { "namespace", RID_NAMESPACE, D_CXXONLY },
- { "new", RID_NEW, D_CXXONLY },
- { "operator", RID_OPERATOR, D_CXXONLY },
- { "private", RID_PRIVATE, D_CXX_OBJC },
- { "protected", RID_PROTECTED, D_CXX_OBJC },
- { "public", RID_PUBLIC, D_CXX_OBJC },
+ { "namespace", RID_NAMESPACE, D_CXXONLY | D_CXXWARN },
+ { "new", RID_NEW, D_CXXONLY | D_CXXWARN },
+ { "operator", RID_OPERATOR, D_CXXONLY | D_CXXWARN },
+ { "private", RID_PRIVATE, D_CXX_OBJC | D_CXXWARN },
+ { "protected", RID_PROTECTED, D_CXX_OBJC | D_CXXWARN },
+ { "public", RID_PUBLIC, D_CXX_OBJC | D_CXXWARN },
{ "register", RID_REGISTER, 0 },
{ "reinterpret_cast", RID_REINTCAST, D_CXXONLY | D_CXXWARN },
{ "restrict", RID_RESTRICT, D_CONLY | D_C99 },
@@ -712,19 +711,19 @@ const struct c_common_resword c_common_reswords[] =
{ "static_cast", RID_STATCAST, D_CXXONLY | D_CXXWARN },
{ "struct", RID_STRUCT, 0 },
{ "switch", RID_SWITCH, 0 },
- { "template", RID_TEMPLATE, D_CXXONLY },
- { "this", RID_THIS, D_CXXONLY },
- { "throw", RID_THROW, D_CXX_OBJC },
- { "true", RID_TRUE, D_CXXONLY },
- { "try", RID_TRY, D_CXX_OBJC },
+ { "template", RID_TEMPLATE, D_CXXONLY | D_CXXWARN },
+ { "this", RID_THIS, D_CXXONLY | D_CXXWARN },
+ { "throw", RID_THROW, D_CXX_OBJC | D_CXXWARN },
+ { "true", RID_TRUE, D_CXXONLY | D_CXXWARN },
+ { "try", RID_TRY, D_CXX_OBJC | D_CXXWARN },
{ "typedef", RID_TYPEDEF, 0 },
- { "typename", RID_TYPENAME, D_CXXONLY },
- { "typeid", RID_TYPEID, D_CXXONLY },
+ { "typename", RID_TYPENAME, D_CXXONLY | D_CXXWARN },
+ { "typeid", RID_TYPEID, D_CXXONLY | D_CXXWARN },
{ "typeof", RID_TYPEOF, D_ASM | D_EXT },
{ "union", RID_UNION, 0 },
{ "unsigned", RID_UNSIGNED, 0 },
- { "using", RID_USING, D_CXXONLY },
- { "virtual", RID_VIRTUAL, D_CXXONLY },
+ { "using", RID_USING, D_CXXONLY | D_CXXWARN },
+ { "virtual", RID_VIRTUAL, D_CXXONLY | D_CXXWARN },
{ "void", RID_VOID, 0 },
{ "volatile", RID_VOLATILE, 0 },
{ "wchar_t", RID_WCHAR, D_CXXONLY },
@@ -857,6 +856,10 @@ const struct attribute_spec c_common_attribute_table[] =
handle_error_attribute },
{ "error", 1, 1, true, false, false,
handle_error_attribute },
+ { "option", 1, -1, true, false, false,
+ handle_option_attribute },
+ { "optimize", 1, -1, true, false, false,
+ handle_optimize_attribute },
{ NULL, 0, 0, false, false, false, NULL }
};
@@ -1041,7 +1044,7 @@ fname_decl (unsigned int rid, tree id)
input_location = saved_location;
}
if (!ix && !current_function_decl)
- pedwarn ("%qD is not defined outside of function scope", decl);
+ pedwarn (0, "%qD is not defined outside of function scope", decl);
return decl;
}
@@ -1090,7 +1093,8 @@ fix_string_type (tree value)
separate the %d from the 'C'. 'ISO' should not be
translated, but it may be moved after 'C%d' in languages
where modifiers follow nouns. */
- pedwarn ("string length %qd is greater than the length %qd "
+ pedwarn (OPT_Woverlength_strings,
+ "string length %qd is greater than the length %qd "
"ISO C%d compilers are required to support",
nchars - 1, nchars_max, relevant_std);
}
@@ -1137,7 +1141,7 @@ constant_expression_warning (tree value)
|| TREE_CODE (value) == VECTOR_CST
|| TREE_CODE (value) == COMPLEX_CST)
&& TREE_OVERFLOW (value))
- pedwarn ("overflow in constant expression");
+ pedwarn (OPT_Woverflow, "overflow in constant expression");
}
/* The same as above but print an unconditional error. */
@@ -1355,7 +1359,8 @@ check_main_parameter_types (tree decl)
{
case 1:
if (TYPE_MAIN_VARIANT (type) != integer_type_node)
- pedwarn ("first argument of %q+D should be %<int%>", decl);
+ pedwarn (OPT_Wmain, "first argument of %q+D should be %<int%>",
+ decl);
break;
case 2:
@@ -1363,8 +1368,8 @@ check_main_parameter_types (tree decl)
|| TREE_CODE (TREE_TYPE (type)) != POINTER_TYPE
|| (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (type)))
!= char_type_node))
- pedwarn ("second argument of %q+D should be %<char **%>",
- decl);
+ pedwarn (OPT_Wmain, "second argument of %q+D should be %<char **%>",
+ decl);
break;
case 3:
@@ -1372,8 +1377,8 @@ check_main_parameter_types (tree decl)
|| TREE_CODE (TREE_TYPE (type)) != POINTER_TYPE
|| (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (type)))
!= char_type_node))
- pedwarn ("third argument of %q+D should probably be "
- "%<char **%>", decl);
+ pedwarn (OPT_Wmain, "third argument of %q+D should probably be "
+ "%<char **%>", decl);
break;
}
}
@@ -1382,7 +1387,7 @@ check_main_parameter_types (tree decl)
argument because it's only mentioned in an appendix of the
standard. */
if (argct > 0 && (argct < 2 || argct > 3))
- pedwarn ("%q+D takes only zero or two arguments", decl);
+ pedwarn (OPT_Wmain, "%q+D takes only zero or two arguments", decl);
}
/* True if pointers to distinct types T1 and T2 can be converted to
@@ -1439,6 +1444,110 @@ vector_types_convertible_p (const_tree t1, const_tree t2, bool emit_lax_note)
return false;
}
+/* This is a helper function of build_binary_op.
+
+ For certain operations if both args were extended from the same
+ smaller type, do the arithmetic in that type and then extend.
+
+ BITWISE indicates a bitwise operation.
+ For them, this optimization is safe only if
+ both args are zero-extended or both are sign-extended.
+ Otherwise, we might change the result.
+ Eg, (short)-1 | (unsigned short)-1 is (int)-1
+ but calculated in (unsigned short) it would be (unsigned short)-1.
+*/
+tree shorten_binary_op (tree result_type, tree op0, tree op1, bool bitwise)
+{
+ int unsigned0, unsigned1;
+ tree arg0, arg1;
+ int uns;
+ tree type;
+
+ /* Cast OP0 and OP1 to RESULT_TYPE. Doing so prevents
+ excessive narrowing when we call get_narrower below. For
+ example, suppose that OP0 is of unsigned int extended
+ from signed char and that RESULT_TYPE is long long int.
+ If we explicitly cast OP0 to RESULT_TYPE, OP0 would look
+ like
+
+ (long long int) (unsigned int) signed_char
+
+ which get_narrower would narrow down to
+
+ (unsigned int) signed char
+
+ If we do not cast OP0 first, get_narrower would return
+ signed_char, which is inconsistent with the case of the
+ explicit cast. */
+ op0 = convert (result_type, op0);
+ op1 = convert (result_type, op1);
+
+ arg0 = get_narrower (op0, &unsigned0);
+ arg1 = get_narrower (op1, &unsigned1);
+
+ /* UNS is 1 if the operation to be done is an unsigned one. */
+ uns = TYPE_UNSIGNED (result_type);
+
+ /* Handle the case that OP0 (or OP1) does not *contain* a conversion
+ but it *requires* conversion to FINAL_TYPE. */
+
+ if ((TYPE_PRECISION (TREE_TYPE (op0))
+ == TYPE_PRECISION (TREE_TYPE (arg0)))
+ && TREE_TYPE (op0) != result_type)
+ unsigned0 = TYPE_UNSIGNED (TREE_TYPE (op0));
+ if ((TYPE_PRECISION (TREE_TYPE (op1))
+ == TYPE_PRECISION (TREE_TYPE (arg1)))
+ && TREE_TYPE (op1) != result_type)
+ unsigned1 = TYPE_UNSIGNED (TREE_TYPE (op1));
+
+ /* Now UNSIGNED0 is 1 if ARG0 zero-extends to FINAL_TYPE. */
+
+ /* For bitwise operations, signedness of nominal type
+ does not matter. Consider only how operands were extended. */
+ if (bitwise)
+ uns = unsigned0;
+
+ /* Note that in all three cases below we refrain from optimizing
+ an unsigned operation on sign-extended args.
+ That would not be valid. */
+
+ /* Both args variable: if both extended in same way
+ from same width, do it in that width.
+ Do it unsigned if args were zero-extended. */
+ if ((TYPE_PRECISION (TREE_TYPE (arg0))
+ < TYPE_PRECISION (result_type))
+ && (TYPE_PRECISION (TREE_TYPE (arg1))
+ == TYPE_PRECISION (TREE_TYPE (arg0)))
+ && unsigned0 == unsigned1
+ && (unsigned0 || !uns))
+ return c_common_signed_or_unsigned_type
+ (unsigned0, common_type (TREE_TYPE (arg0), TREE_TYPE (arg1)));
+
+ else if (TREE_CODE (arg0) == INTEGER_CST
+ && (unsigned1 || !uns)
+ && (TYPE_PRECISION (TREE_TYPE (arg1))
+ < TYPE_PRECISION (result_type))
+ && (type
+ = c_common_signed_or_unsigned_type (unsigned1,
+ TREE_TYPE (arg1)))
+ && !POINTER_TYPE_P (type)
+ && int_fits_type_p (arg0, type))
+ return type;
+
+ else if (TREE_CODE (arg1) == INTEGER_CST
+ && (unsigned0 || !uns)
+ && (TYPE_PRECISION (TREE_TYPE (arg0))
+ < TYPE_PRECISION (result_type))
+ && (type
+ = c_common_signed_or_unsigned_type (unsigned0,
+ TREE_TYPE (arg0)))
+ && !POINTER_TYPE_P (type)
+ && int_fits_type_p (arg1, type))
+ return type;
+
+ return result_type;
+}
+
/* Warns if the conversion of EXPR to TYPE may alter a value.
This is a helper function for warnings_for_convert_and_check. */
@@ -1447,39 +1556,63 @@ conversion_warning (tree type, tree expr)
{
bool give_warning = false;
- unsigned int formal_prec = TYPE_PRECISION (type);
+ tree expr_type = TREE_TYPE (expr);
if (!warn_conversion && !warn_sign_conversion)
return;
- if (TREE_CODE (expr) == REAL_CST || TREE_CODE (expr) == INTEGER_CST)
+ switch (TREE_CODE (expr))
{
+ case EQ_EXPR:
+ case NE_EXPR:
+ case LE_EXPR:
+ case GE_EXPR:
+ case LT_EXPR:
+ case GT_EXPR:
+ case TRUTH_ANDIF_EXPR:
+ case TRUTH_ORIF_EXPR:
+ case TRUTH_AND_EXPR:
+ case TRUTH_OR_EXPR:
+ case TRUTH_XOR_EXPR:
+ case TRUTH_NOT_EXPR:
+ /* Conversion from boolean to a signed:1 bit-field (which only
+ can hold the values 0 and -1) doesn't lose information - but
+ it does change the value. */
+ if (TYPE_PRECISION (type) == 1 && !TYPE_UNSIGNED (type))
+ warning (OPT_Wconversion,
+ "conversion to %qT from boolean expression", type);
+ return;
+
+ case REAL_CST:
+ case INTEGER_CST:
+
/* Warn for real constant that is not an exact integer converted
to integer type. */
- if (TREE_CODE (TREE_TYPE (expr)) == REAL_TYPE
+ if (TREE_CODE (expr_type) == REAL_TYPE
&& TREE_CODE (type) == INTEGER_TYPE)
{
- if (!real_isinteger (TREE_REAL_CST_PTR (expr), TYPE_MODE (TREE_TYPE (expr))))
+ if (!real_isinteger (TREE_REAL_CST_PTR (expr), TYPE_MODE (expr_type)))
give_warning = true;
}
/* Warn for an integer constant that does not fit into integer type. */
- else if (TREE_CODE (TREE_TYPE (expr)) == INTEGER_TYPE
+ else if (TREE_CODE (expr_type) == INTEGER_TYPE
&& TREE_CODE (type) == INTEGER_TYPE
&& !int_fits_type_p (expr, type))
{
- if (TYPE_UNSIGNED (type) && !TYPE_UNSIGNED (TREE_TYPE (expr)))
+ if (TYPE_UNSIGNED (type) && !TYPE_UNSIGNED (expr_type)
+ && tree_int_cst_sgn (expr) < 0)
warning (OPT_Wsign_conversion,
"negative integer implicitly converted to unsigned type");
- else if (!TYPE_UNSIGNED (type) && TYPE_UNSIGNED (TREE_TYPE (expr)))
- warning (OPT_Wsign_conversion,
- "conversion of unsigned constant value to negative integer");
+ else if (!TYPE_UNSIGNED (type) && TYPE_UNSIGNED (expr_type))
+ warning (OPT_Wsign_conversion, "conversion of unsigned constant "
+ "value to negative integer");
else
give_warning = true;
}
else if (TREE_CODE (type) == REAL_TYPE)
{
/* Warn for an integer constant that does not fit into real type. */
- if (TREE_CODE (TREE_TYPE (expr)) == INTEGER_TYPE)
+ if (TREE_CODE (expr_type) == INTEGER_TYPE)
{
REAL_VALUE_TYPE a = real_value_from_int_cst (0, expr);
if (!exact_real_truncate (TYPE_MODE (type), &a))
@@ -1487,8 +1620,8 @@ conversion_warning (tree type, tree expr)
}
/* Warn for a real constant that does not fit into a smaller
real type. */
- else if (TREE_CODE (TREE_TYPE (expr)) == REAL_TYPE
- && formal_prec < TYPE_PRECISION (TREE_TYPE (expr)))
+ else if (TREE_CODE (expr_type) == REAL_TYPE
+ && TYPE_PRECISION (type) < TYPE_PRECISION (expr_type))
{
REAL_VALUE_TYPE a = TREE_REAL_CST (expr);
if (!exact_real_truncate (TYPE_MODE (type), &a))
@@ -1499,48 +1632,102 @@ conversion_warning (tree type, tree expr)
if (give_warning)
warning (OPT_Wconversion,
"conversion to %qT alters %qT constant value",
- type, TREE_TYPE (expr));
- }
- else /* 'expr' is not a constant. */
- {
+ type, expr_type);
+
+ return;
+
+ case COND_EXPR:
+ {
+ /* In case of COND_EXPR, if both operands are constants or
+ COND_EXPR, then we do not care about the type of COND_EXPR,
+ only about the conversion of each operand. */
+ tree op1 = TREE_OPERAND (expr, 1);
+ tree op2 = TREE_OPERAND (expr, 2);
+
+ if ((TREE_CODE (op1) == REAL_CST || TREE_CODE (op1) == INTEGER_CST
+ || TREE_CODE (op1) == COND_EXPR)
+ && (TREE_CODE (op2) == REAL_CST || TREE_CODE (op2) == INTEGER_CST
+ || TREE_CODE (op2) == COND_EXPR))
+ {
+ conversion_warning (type, op1);
+ conversion_warning (type, op2);
+ return;
+ }
+ /* Fall through. */
+ }
+
+ default: /* 'expr' is not a constant. */
+
/* Warn for real types converted to integer types. */
- if (TREE_CODE (TREE_TYPE (expr)) == REAL_TYPE
+ if (TREE_CODE (expr_type) == REAL_TYPE
&& TREE_CODE (type) == INTEGER_TYPE)
give_warning = true;
- else if (TREE_CODE (TREE_TYPE (expr)) == INTEGER_TYPE
+ else if (TREE_CODE (expr_type) == INTEGER_TYPE
&& TREE_CODE (type) == INTEGER_TYPE)
{
/* Don't warn about unsigned char y = 0xff, x = (int) y; */
expr = get_unwidened (expr, 0);
+ expr_type = TREE_TYPE (expr);
+ /* Don't warn for short y; short x = ((int)y & 0xff); */
+ if (TREE_CODE (expr) == BIT_AND_EXPR
+ || TREE_CODE (expr) == BIT_IOR_EXPR
+ || TREE_CODE (expr) == BIT_XOR_EXPR)
+ {
+ /* If both args were extended from a shortest type,
+ use that type if that is safe. */
+ expr_type = shorten_binary_op (expr_type,
+ TREE_OPERAND (expr, 0),
+ TREE_OPERAND (expr, 1),
+ /* bitwise */1);
+
+ /* If one of the operands is a non-negative constant
+ that fits in the target type, then the type of the
+ other operand does not matter. */
+ if (TREE_CODE (expr) == BIT_AND_EXPR)
+ {
+ tree op0 = TREE_OPERAND (expr, 0);
+ tree op1 = TREE_OPERAND (expr, 1);
+ if ((TREE_CODE (op0) == INTEGER_CST
+ && int_fits_type_p (op0, c_common_signed_type (type))
+ && int_fits_type_p (op0, c_common_unsigned_type (type)))
+ || (TREE_CODE (op1) == INTEGER_CST
+ && int_fits_type_p (op1, c_common_signed_type (type))
+ && int_fits_type_p (op1,
+ c_common_unsigned_type (type))))
+ return;
+ }
+ }
/* Warn for integer types converted to smaller integer types. */
- if (formal_prec < TYPE_PRECISION (TREE_TYPE (expr)))
+ if (TYPE_PRECISION (type) < TYPE_PRECISION (expr_type))
give_warning = true;
/* When they are the same width but different signedness,
then the value may change. */
- else if ((formal_prec == TYPE_PRECISION (TREE_TYPE (expr))
- && TYPE_UNSIGNED (TREE_TYPE (expr)) != TYPE_UNSIGNED (type))
+ else if ((TYPE_PRECISION (type) == TYPE_PRECISION (expr_type)
+ && TYPE_UNSIGNED (expr_type) != TYPE_UNSIGNED (type))
/* Even when converted to a bigger type, if the type is
unsigned but expr is signed, then negative values
will be changed. */
- || (TYPE_UNSIGNED (type) && !TYPE_UNSIGNED (TREE_TYPE (expr))))
- warning (OPT_Wsign_conversion,
- "conversion to %qT from %qT may change the sign of the result",
- type, TREE_TYPE (expr));
+ || (TYPE_UNSIGNED (type) && !TYPE_UNSIGNED (expr_type)))
+ warning (OPT_Wsign_conversion, "conversion to %qT from %qT "
+ "may change the sign of the result",
+ type, expr_type);
}
/* Warn for integer types converted to real types if and only if
all the range of values of the integer type cannot be
represented by the real type. */
- else if (TREE_CODE (TREE_TYPE (expr)) == INTEGER_TYPE
+ else if (TREE_CODE (expr_type) == INTEGER_TYPE
&& TREE_CODE (type) == REAL_TYPE)
{
- tree type_low_bound = TYPE_MIN_VALUE (TREE_TYPE (expr));
- tree type_high_bound = TYPE_MAX_VALUE (TREE_TYPE (expr));
- REAL_VALUE_TYPE real_low_bound = real_value_from_int_cst (0, type_low_bound);
- REAL_VALUE_TYPE real_high_bound = real_value_from_int_cst (0, type_high_bound);
+ tree type_low_bound = TYPE_MIN_VALUE (expr_type);
+ tree type_high_bound = TYPE_MAX_VALUE (expr_type);
+ REAL_VALUE_TYPE real_low_bound
+ = real_value_from_int_cst (0, type_low_bound);
+ REAL_VALUE_TYPE real_high_bound
+ = real_value_from_int_cst (0, type_high_bound);
if (!exact_real_truncate (TYPE_MODE (type), &real_low_bound)
|| !exact_real_truncate (TYPE_MODE (type), &real_high_bound))
@@ -1548,16 +1735,16 @@ conversion_warning (tree type, tree expr)
}
/* Warn for real types converted to smaller real types. */
- else if (TREE_CODE (TREE_TYPE (expr)) == REAL_TYPE
+ else if (TREE_CODE (expr_type) == REAL_TYPE
&& TREE_CODE (type) == REAL_TYPE
- && formal_prec < TYPE_PRECISION (TREE_TYPE (expr)))
+ && TYPE_PRECISION (type) < TYPE_PRECISION (expr_type))
give_warning = true;
if (give_warning)
warning (OPT_Wconversion,
"conversion to %qT from %qT may alter its value",
- type, TREE_TYPE (expr));
+ type, expr_type);
}
}
@@ -1759,8 +1946,10 @@ warn_for_collisions_1 (tree written, tree writer, struct tlist *list,
&& DECL_NAME (list->expr))
{
warned_ids = new_tlist (warned_ids, written, NULL_TREE);
- warning (OPT_Wsequence_point, "operation on %qE may be undefined",
- list->expr);
+ warning_at (EXPR_HAS_LOCATION (writer)
+ ? EXPR_LOCATION (writer) : input_location,
+ OPT_Wsequence_point, "operation on %qE may be undefined",
+ list->expr);
}
list = list->next;
}
@@ -3073,20 +3262,20 @@ pointer_int_sum (enum tree_code resultcode, tree ptrop, tree intop)
if (TREE_CODE (TREE_TYPE (result_type)) == VOID_TYPE)
{
- if (pedantic || warn_pointer_arith)
- pedwarn ("pointer of type %<void *%> used in arithmetic");
+ pedwarn (pedantic ? OPT_pedantic : OPT_Wpointer_arith,
+ "pointer of type %<void *%> used in arithmetic");
size_exp = integer_one_node;
}
else if (TREE_CODE (TREE_TYPE (result_type)) == FUNCTION_TYPE)
{
- if (pedantic || warn_pointer_arith)
- pedwarn ("pointer to a function used in arithmetic");
+ pedwarn (pedantic ? OPT_pedantic : OPT_Wpointer_arith,
+ "pointer to a function used in arithmetic");
size_exp = integer_one_node;
}
else if (TREE_CODE (TREE_TYPE (result_type)) == METHOD_TYPE)
{
- if (pedantic || warn_pointer_arith)
- pedwarn ("pointer to member function used in arithmetic");
+ pedwarn (pedantic ? OPT_pedantic : OPT_Wpointer_arith,
+ "pointer to member function used in arithmetic");
size_exp = integer_one_node;
}
else
@@ -3594,7 +3783,8 @@ c_sizeof_or_alignof_type (tree type, bool is_sizeof, int complain)
if (is_sizeof)
{
if (complain && (pedantic || warn_pointer_arith))
- pedwarn ("invalid application of %<sizeof%> to a function type");
+ pedwarn (pedantic ? OPT_pedantic : OPT_Wpointer_arith,
+ "invalid application of %<sizeof%> to a function type");
else if (!complain)
return error_mark_node;
value = size_one_node;
@@ -3606,7 +3796,8 @@ c_sizeof_or_alignof_type (tree type, bool is_sizeof, int complain)
{
if (type_code == VOID_TYPE
&& complain && (pedantic || warn_pointer_arith))
- pedwarn ("invalid application of %qs to a void type", op_name);
+ pedwarn (pedantic ? OPT_pedantic : OPT_Wpointer_arith,
+ "invalid application of %qs to a void type", op_name);
else if (!complain)
return error_mark_node;
value = size_one_node;
@@ -4472,8 +4663,9 @@ c_add_case_label (splay_tree cases, tree cond, tree orig_type,
}
/* Case ranges are a GNU extension. */
- if (high_value && pedantic)
- pedwarn ("range expressions in switch statements are non-standard");
+ if (high_value)
+ pedwarn (OPT_pedantic,
+ "range expressions in switch statements are non-standard");
type = TREE_TYPE (cond);
if (low_value)
@@ -4786,8 +4978,7 @@ finish_label_address_expr (tree label)
{
tree result;
- if (pedantic)
- pedwarn ("taking the address of a label is non-standard");
+ pedwarn (OPT_pedantic, "taking the address of a label is non-standard");
if (label == error_mark_node)
return error_mark_node;
@@ -4895,6 +5086,8 @@ c_stddef_cpp_builtins(void)
builtin_define_with_value ("__WINT_TYPE__", WINT_TYPE, 0);
builtin_define_with_value ("__INTMAX_TYPE__", INTMAX_TYPE, 0);
builtin_define_with_value ("__UINTMAX_TYPE__", UINTMAX_TYPE, 0);
+ builtin_define_with_value ("__CHAR16_TYPE__", CHAR16_TYPE, 0);
+ builtin_define_with_value ("__CHAR32_TYPE__", CHAR32_TYPE, 0);
}
static void
@@ -5025,7 +5218,7 @@ handle_noreturn_attribute (tree *node, tree name, tree ARG_UNUSED (args),
static tree
handle_hot_attribute (tree *node, tree name, tree ARG_UNUSED (args),
- int ARG_UNUSED (flags), bool *no_add_attrs)
+ int ARG_UNUSED (flags), bool *no_add_attrs)
{
if (TREE_CODE (*node) == FUNCTION_DECL)
{
@@ -5035,8 +5228,34 @@ handle_hot_attribute (tree *node, tree name, tree ARG_UNUSED (args),
name, "cold");
*no_add_attrs = true;
}
- /* Do nothing else, just set the attribute. We'll get at
- it later with lookup_attribute. */
+ else
+ {
+ tree old_opts = DECL_FUNCTION_SPECIFIC_OPTIMIZATION (*node);
+
+ /* If we are not at -O3, but are optimizing, turn on -O3
+ optimizations just for this one function. */
+ if (((optimize > 0 && optimize < 3) || optimize_size)
+ && targetm.target_option.hot_attribute_sets_optimization
+ && (!old_opts || old_opts == optimization_default_node))
+ {
+ /* Create the hot optimization node if needed. */
+ if (!optimization_hot_node)
+ {
+ struct cl_optimization current_options;
+ static const char *os_argv[] = { NULL, "-O3", NULL };
+
+ cl_optimization_save (&current_options);
+ decode_options (2, os_argv);
+ optimization_hot_node = build_optimization_node ();
+ cl_optimization_restore (&current_options);
+ }
+
+ DECL_FUNCTION_SPECIFIC_OPTIMIZATION (*node)
+ = optimization_hot_node;
+ }
+ /* Most of the rest of the hot processing is done later with
+ lookup_attribute. */
+ }
}
else
{
@@ -5061,8 +5280,34 @@ handle_cold_attribute (tree *node, tree name, tree ARG_UNUSED (args),
name, "hot");
*no_add_attrs = true;
}
- /* Do nothing else, just set the attribute. We'll get at
- it later with lookup_attribute. */
+ else
+ {
+ tree old_opts = DECL_FUNCTION_SPECIFIC_OPTIMIZATION (*node);
+
+ /* If we are optimizing, but not optimizing for space, turn on -Os
+ optimizations just for this one function. */
+ if (optimize && !optimize_size
+ && targetm.target_option.cold_attribute_sets_optimization
+ && (!old_opts || old_opts == optimization_default_node))
+ {
+ /* Create the cold optimization node if needed. */
+ if (!optimization_cold_node)
+ {
+ struct cl_optimization current_options;
+ static const char *os_argv[] = { NULL, "-Os", NULL };
+
+ cl_optimization_save (&current_options);
+ decode_options (2, os_argv);
+ optimization_cold_node = build_optimization_node ();
+ cl_optimization_restore (&current_options);
+ }
+
+ DECL_FUNCTION_SPECIFIC_OPTIMIZATION (*node)
+ = optimization_cold_node;
+ }
+ /* Most of the rest of the cold processing is done later with
+ lookup_attribute. */
+ }
}
else
{
@@ -6760,6 +7005,186 @@ handle_type_generic_attribute (tree *node, tree ARG_UNUSED (name),
return NULL_TREE;
}
+
+/* For handling "option" attribute. arguments as in
+ struct attribute_spec.handler. */
+
+static tree
+handle_option_attribute (tree *node, tree name, tree args, int flags,
+ bool *no_add_attrs)
+{
+ /* Ensure we have a function type. */
+ if (TREE_CODE (*node) != FUNCTION_DECL)
+ {
+ warning (OPT_Wattributes, "%qE attribute ignored", name);
+ *no_add_attrs = true;
+ }
+ else if (targetm.target_option.valid_attribute_p
+ == default_target_option_valid_attribute_p)
+ {
+ warning (OPT_Wattributes,
+ "%qE attribute is not supported on this machine",
+ name);
+ *no_add_attrs = true;
+ }
+ else if (! targetm.target_option.valid_attribute_p (*node, name, args,
+ flags))
+ *no_add_attrs = true;
+
+ return NULL_TREE;
+}
+
+/* Arguments being collected for optimization. */
+typedef const char *const_char_p; /* For DEF_VEC_P. */
+DEF_VEC_P(const_char_p);
+DEF_VEC_ALLOC_P(const_char_p, gc);
+static GTY(()) VEC(const_char_p, gc) *optimize_args;
+
+
+/* Inner function to convert a TREE_LIST to argv string to parse the optimize
+ options in ARGS. ATTR_P is true if this is for attribute(optimize), and
+ false for #pragma GCC optimize. */
+
+bool
+parse_optimize_options (tree args, bool attr_p)
+{
+ bool ret = true;
+ unsigned opt_argc;
+ unsigned i;
+ const char **opt_argv;
+ tree ap;
+
+ /* Build up argv vector. Just in case the string is stored away, use garbage
+ collected strings. */
+ VEC_truncate (const_char_p, optimize_args, 0);
+ VEC_safe_push (const_char_p, gc, optimize_args, NULL);
+
+ for (ap = args; ap != NULL_TREE; ap = TREE_CHAIN (ap))
+ {
+ tree value = TREE_VALUE (ap);
+
+ if (TREE_CODE (value) == INTEGER_CST)
+ {
+ char buffer[20];
+ sprintf (buffer, "-O%ld", (long) TREE_INT_CST_LOW (value));
+ VEC_safe_push (const_char_p, gc, optimize_args, ggc_strdup (buffer));
+ }
+
+ else if (TREE_CODE (value) == STRING_CST)
+ {
+ /* Split string into multiple substrings. */
+ size_t len = TREE_STRING_LENGTH (value);
+ char *p = ASTRDUP (TREE_STRING_POINTER (value));
+ char *end = p + len;
+ char *comma;
+ char *next_p = p;
+
+ while (next_p != NULL)
+ {
+ size_t len2;
+ char *q, *r;
+
+ p = next_p;
+ comma = strchr (p, ',');
+ if (comma)
+ {
+ len2 = comma - p;
+ *comma = '\0';
+ next_p = comma+1;
+ }
+ else
+ {
+ len2 = end - p;
+ next_p = NULL;
+ }
+
+ r = q = (char *) ggc_alloc (len2 + 3);
+
+ /* If the user supplied -Oxxx or -fxxx, only allow -Oxxx or -fxxx
+ options. */
+ if (*p == '-' && p[1] != 'O' && p[1] != 'f')
+ {
+ ret = false;
+ if (attr_p)
+ warning (OPT_Wattributes,
+ "Bad option %s to optimize attribute.", p);
+ else
+ warning (OPT_Wpragmas,
+ "Bad option %s to pragma attribute", p);
+ continue;
+ }
+
+ if (*p != '-')
+ {
+ *r++ = '-';
+
+ /* Assume that Ox is -Ox, a numeric value is -Ox, a s by
+ itself is -Os, and any other switch begins with a -f. */
+ if ((*p >= '0' && *p <= '9')
+ || (p[0] == 's' && p[1] == '\0'))
+ *r++ = 'O';
+ else if (*p != 'O')
+ *r++ = 'f';
+ }
+
+ memcpy (r, p, len2);
+ r[len2] = '\0';
+ VEC_safe_push (const_char_p, gc, optimize_args, q);
+ }
+
+ }
+ }
+
+ opt_argc = VEC_length (const_char_p, optimize_args);
+ opt_argv = (const char **) alloca (sizeof (char *) * (opt_argc + 1));
+
+ for (i = 1; i < opt_argc; i++)
+ opt_argv[i] = VEC_index (const_char_p, optimize_args, i);
+
+ /* Now parse the options. */
+ decode_options (opt_argc, opt_argv);
+
+ VEC_truncate (const_char_p, optimize_args, 0);
+ return ret;
+}
+
+/* For handling "optimize" attribute. arguments as in
+ struct attribute_spec.handler. */
+
+static tree
+handle_optimize_attribute (tree *node, tree name, tree args,
+ int ARG_UNUSED (flags), bool *no_add_attrs)
+{
+ /* Ensure we have a function type. */
+ if (TREE_CODE (*node) != FUNCTION_DECL)
+ {
+ warning (OPT_Wattributes, "%qE attribute ignored", name);
+ *no_add_attrs = true;
+ }
+ else
+ {
+ struct cl_optimization cur_opts;
+ tree old_opts = DECL_FUNCTION_SPECIFIC_OPTIMIZATION (*node);
+
+ /* Save current options. */
+ cl_optimization_save (&cur_opts);
+
+ /* If we previously had some optimization options, use them as the
+ default. */
+ if (old_opts)
+ cl_optimization_restore (TREE_OPTIMIZATION (old_opts));
+
+ /* Parse options, and update the vector. */
+ parse_optimize_options (args, true);
+ DECL_FUNCTION_SPECIFIC_OPTIMIZATION (*node)
+ = build_optimization_node ();
+
+ /* Restore current options. */
+ cl_optimization_restore (&cur_opts);
+ }
+
+ return NULL_TREE;
+}
/* Check for valid arguments being passed to a function.
ATTRS is a list of attributes. There are NARGS arguments in the array
@@ -7133,71 +7558,60 @@ c_parse_error (const char *gmsgid, enum cpp_ttype token, tree value)
inlining, so we don't have to worry about that. */
void
-c_warn_unused_result (tree *top_p)
+c_warn_unused_result (gimple_seq seq)
{
- tree t = *top_p;
- tree_stmt_iterator i;
tree fdecl, ftype;
+ gimple_stmt_iterator i;
- switch (TREE_CODE (t))
+ for (i = gsi_start (seq); !gsi_end_p (i); gsi_next (&i))
{
- case STATEMENT_LIST:
- for (i = tsi_start (*top_p); !tsi_end_p (i); tsi_next (&i))
- c_warn_unused_result (tsi_stmt_ptr (i));
- break;
+ gimple g = gsi_stmt (i);
- case COND_EXPR:
- c_warn_unused_result (&COND_EXPR_THEN (t));
- c_warn_unused_result (&COND_EXPR_ELSE (t));
- break;
- case BIND_EXPR:
- c_warn_unused_result (&BIND_EXPR_BODY (t));
- break;
- case TRY_FINALLY_EXPR:
- case TRY_CATCH_EXPR:
- c_warn_unused_result (&TREE_OPERAND (t, 0));
- c_warn_unused_result (&TREE_OPERAND (t, 1));
- break;
- case CATCH_EXPR:
- c_warn_unused_result (&CATCH_BODY (t));
- break;
- case EH_FILTER_EXPR:
- c_warn_unused_result (&EH_FILTER_FAILURE (t));
- break;
+ switch (gimple_code (g))
+ {
+ case GIMPLE_BIND:
+ c_warn_unused_result (gimple_bind_body (g));
+ break;
+ case GIMPLE_TRY:
+ c_warn_unused_result (gimple_try_eval (g));
+ c_warn_unused_result (gimple_try_cleanup (g));
+ break;
+ case GIMPLE_CATCH:
+ c_warn_unused_result (gimple_catch_handler (g));
+ break;
+ case GIMPLE_EH_FILTER:
+ c_warn_unused_result (gimple_eh_filter_failure (g));
+ break;
- case CALL_EXPR:
- if (TREE_USED (t))
- break;
+ case GIMPLE_CALL:
+ if (gimple_call_lhs (g))
+ break;
- /* This is a naked call, as opposed to a CALL_EXPR nested inside
- a MODIFY_EXPR. All calls whose value is ignored should be
- represented like this. Look for the attribute. */
- fdecl = get_callee_fndecl (t);
- if (fdecl)
- ftype = TREE_TYPE (fdecl);
- else
- {
- ftype = TREE_TYPE (CALL_EXPR_FN (t));
- /* Look past pointer-to-function to the function type itself. */
- ftype = TREE_TYPE (ftype);
- }
+ /* This is a naked call, as opposed to a GIMPLE_CALL with an
+ LHS. All calls whose value is ignored should be
+ represented like this. Look for the attribute. */
+ fdecl = gimple_call_fndecl (g);
+ ftype = TREE_TYPE (TREE_TYPE (gimple_call_fn (g)));
- if (lookup_attribute ("warn_unused_result", TYPE_ATTRIBUTES (ftype)))
- {
- if (fdecl)
- warning (0, "%Hignoring return value of %qD, "
- "declared with attribute warn_unused_result",
- EXPR_LOCUS (t), fdecl);
- else
- warning (0, "%Hignoring return value of function "
- "declared with attribute warn_unused_result",
- EXPR_LOCUS (t));
- }
- break;
+ if (lookup_attribute ("warn_unused_result", TYPE_ATTRIBUTES (ftype)))
+ {
+ location_t loc = gimple_location (g);
- default:
- /* Not a container, not a call, or a call whose value is used. */
- break;
+ if (fdecl)
+ warning (0, "%Hignoring return value of %qD, "
+ "declared with attribute warn_unused_result",
+ &loc, fdecl);
+ else
+ warning (0, "%Hignoring return value of function "
+ "declared with attribute warn_unused_result",
+ &loc);
+ }
+ break;
+
+ default:
+ /* Not a container, not a call, or a call whose value is used. */
+ break;
+ }
}
}
@@ -7827,4 +8241,145 @@ warn_for_div_by_zero (tree divisor)
warning (OPT_Wdiv_by_zero, "division by zero");
}
+/* Subroutine of build_binary_op. Give warnings for comparisons
+ between signed and unsigned quantities that may fail. Do the
+ checking based on the original operand trees ORIG_OP0 and ORIG_OP1,
+ so that casts will be considered, but default promotions won't
+ be.
+
+ The arguments of this function map directly to local variables
+ of build_binary_op. */
+
+void
+warn_for_sign_compare (tree orig_op0, tree orig_op1,
+ tree op0, tree op1,
+ tree result_type, enum tree_code resultcode)
+{
+ int op0_signed = !TYPE_UNSIGNED (TREE_TYPE (orig_op0));
+ int op1_signed = !TYPE_UNSIGNED (TREE_TYPE (orig_op1));
+ int unsignedp0, unsignedp1;
+
+ /* In C++, check for comparison of different enum types. */
+ if (c_dialect_cxx()
+ && TREE_CODE (TREE_TYPE (orig_op0)) == ENUMERAL_TYPE
+ && TREE_CODE (TREE_TYPE (orig_op1)) == ENUMERAL_TYPE
+ && TYPE_MAIN_VARIANT (TREE_TYPE (orig_op0))
+ != TYPE_MAIN_VARIANT (TREE_TYPE (orig_op1)))
+ {
+ warning (OPT_Wsign_compare, "comparison between types %qT and %qT",
+ TREE_TYPE (orig_op0), TREE_TYPE (orig_op1));
+ }
+
+ /* Do not warn if the comparison is being done in a signed type,
+ since the signed type will only be chosen if it can represent
+ all the values of the unsigned type. */
+ if (!TYPE_UNSIGNED (result_type))
+ /* OK */;
+ /* Do not warn if both operands are unsigned. */
+ else if (op0_signed == op1_signed)
+ /* OK */;
+ else
+ {
+ tree sop, uop;
+ bool ovf;
+
+ if (op0_signed)
+ sop = orig_op0, uop = orig_op1;
+ else
+ sop = orig_op1, uop = orig_op0;
+
+ STRIP_TYPE_NOPS (sop);
+ STRIP_TYPE_NOPS (uop);
+
+ /* Do not warn if the signed quantity is an unsuffixed integer
+ literal (or some static constant expression involving such
+ literals or a conditional expression involving such literals)
+ and it is non-negative. */
+ if (tree_expr_nonnegative_warnv_p (sop, &ovf))
+ /* OK */;
+ /* Do not warn if the comparison is an equality operation, the
+ unsigned quantity is an integral constant, and it would fit
+ in the result if the result were signed. */
+ else if (TREE_CODE (uop) == INTEGER_CST
+ && (resultcode == EQ_EXPR || resultcode == NE_EXPR)
+ && int_fits_type_p (uop, c_common_signed_type (result_type)))
+ /* OK */;
+ /* In C, do not warn if the unsigned quantity is an enumeration
+ constant and its maximum value would fit in the result if the
+ result were signed. */
+ else if (!c_dialect_cxx() && TREE_CODE (uop) == INTEGER_CST
+ && TREE_CODE (TREE_TYPE (uop)) == ENUMERAL_TYPE
+ && int_fits_type_p (TYPE_MAX_VALUE (TREE_TYPE (uop)),
+ c_common_signed_type (result_type)))
+ /* OK */;
+ else
+ warning (OPT_Wsign_compare,
+ "comparison between signed and unsigned integer expressions");
+ }
+
+ /* Warn if two unsigned values are being compared in a size larger
+ than their original size, and one (and only one) is the result of
+ a `~' operator. This comparison will always fail.
+
+ Also warn if one operand is a constant, and the constant does not
+ have all bits set that are set in the ~ operand when it is
+ extended. */
+
+ op0 = get_narrower (op0, &unsignedp0);
+ op1 = get_narrower (op1, &unsignedp1);
+
+ if ((TREE_CODE (op0) == BIT_NOT_EXPR)
+ ^ (TREE_CODE (op1) == BIT_NOT_EXPR))
+ {
+ if (TREE_CODE (op0) == BIT_NOT_EXPR)
+ op0 = get_narrower (TREE_OPERAND (op0, 0), &unsignedp0);
+ if (TREE_CODE (op1) == BIT_NOT_EXPR)
+ op1 = get_narrower (TREE_OPERAND (op1, 0), &unsignedp1);
+
+ if (host_integerp (op0, 0) || host_integerp (op1, 0))
+ {
+ tree primop;
+ HOST_WIDE_INT constant, mask;
+ int unsignedp;
+ unsigned int bits;
+
+ if (host_integerp (op0, 0))
+ {
+ primop = op1;
+ unsignedp = unsignedp1;
+ constant = tree_low_cst (op0, 0);
+ }
+ else
+ {
+ primop = op0;
+ unsignedp = unsignedp0;
+ constant = tree_low_cst (op1, 0);
+ }
+
+ bits = TYPE_PRECISION (TREE_TYPE (primop));
+ if (bits < TYPE_PRECISION (result_type)
+ && bits < HOST_BITS_PER_LONG && unsignedp)
+ {
+ mask = (~ (HOST_WIDE_INT) 0) << bits;
+ if ((mask & constant) != mask)
+ {
+ if (constant == 0)
+ warning (OPT_Wsign_compare,
+ "promoted ~unsigned is always non-zero");
+ else
+ warning (OPT_Wsign_compare,
+ "comparison of promoted ~unsigned with constant");
+ }
+ }
+ }
+ else if (unsignedp0 && unsignedp1
+ && (TYPE_PRECISION (TREE_TYPE (op0))
+ < TYPE_PRECISION (result_type))
+ && (TYPE_PRECISION (TREE_TYPE (op1))
+ < TYPE_PRECISION (result_type)))
+ warning (OPT_Wsign_compare,
+ "comparison of promoted ~unsigned with unsigned");
+ }
+}
+
#include "gt-c-common.h"
diff --git a/gcc/c-common.h b/gcc/c-common.h
index 486fdeb8811..b0abe3e1a51 100644
--- a/gcc/c-common.h
+++ b/gcc/c-common.h
@@ -498,11 +498,6 @@ extern int flag_isoc99;
extern int flag_hosted;
-/* Warn if main is suspicious. */
-
-extern int warn_main;
-
-
/* ObjC language option variables. */
@@ -743,6 +738,9 @@ extern bool same_scalar_type_ignoring_signedness (tree, tree);
#define c_sizeof(T) c_sizeof_or_alignof_type (T, true, 1)
#define c_alignof(T) c_sizeof_or_alignof_type (T, false, 1)
+/* Subroutine of build_binary_op, used for certain operations. */
+extern tree shorten_binary_op (tree result_type, tree op0, tree op1, bool bitwise);
+
/* Subroutine of build_binary_op, used for comparison operations.
See if the operands have both been converted from subword integer types
and, if so, perhaps change them both back to their original type. */
@@ -870,6 +868,7 @@ extern tree c_staticp (tree);
extern void init_c_lex (void);
extern void c_cpp_builtins (cpp_reader *);
+extern void c_cpp_builtins_optimize_pragma (cpp_reader *, tree, tree);
/* Positive if an implicit `extern "C"' scope has just been entered;
negative if such a scope has just been exited. */
@@ -896,7 +895,7 @@ extern void dump_time_statistics (void);
extern bool c_dump_tree (void *, tree);
-extern void c_warn_unused_result (tree *);
+extern void c_warn_unused_result (gimple_seq);
extern void verify_sequence_points (tree);
@@ -924,11 +923,14 @@ extern void warn_about_parentheses (enum tree_code, enum tree_code,
enum tree_code);
extern void warn_for_unused_label (tree label);
extern void warn_for_div_by_zero (tree divisor);
-
+extern void warn_for_sign_compare (tree orig_op0, tree orig_op1,
+ tree op0, tree op1,
+ tree result_type,
+ enum tree_code resultcode);
/* In c-gimplify.c */
extern void c_genericize (tree);
-extern int c_gimplify_expr (tree *, tree *, tree *);
+extern int c_gimplify_expr (tree *, gimple_seq *, gimple_seq *);
extern tree c_build_bind_expr (tree, tree);
/* In c-pch.c */
@@ -944,6 +946,8 @@ extern void c_common_print_pch_checksum (FILE *f);
/* In *-checksum.c */
extern const unsigned char executable_checksum[16];
+/* In c-cppbuiltin.c */
+extern void builtin_define_std (const char *macro);
extern void builtin_define_with_value (const char *, const char *, int);
extern void c_stddef_cpp_builtins (void);
extern void fe_file_change (const struct line_map *);
diff --git a/gcc/c-cppbuiltin.c b/gcc/c-cppbuiltin.c
index 1ce2fef2a21..2079d4de43c 100644
--- a/gcc/c-cppbuiltin.c
+++ b/gcc/c-cppbuiltin.c
@@ -30,6 +30,7 @@ along with GCC; see the file COPYING3. If not see
#include "c-pragma.h"
#include "output.h"
#include "except.h" /* For USING_SJLJ_EXCEPTIONS. */
+#include "debug.h" /* For dwarf2out_do_frame. */
#include "toplev.h"
#include "tm_p.h" /* Target prototypes. */
#include "target.h"
@@ -405,6 +406,58 @@ builtin_define_stdint_macros (void)
builtin_define_type_max ("__INTMAX_MAX__", intmax_type_node, intmax_long);
}
+/* Adjust the optimization macros when a #pragma GCC optimization is done to
+ reflect the current level. */
+void
+c_cpp_builtins_optimize_pragma (cpp_reader *pfile, tree prev_tree,
+ tree cur_tree)
+{
+ struct cl_optimization *prev = TREE_OPTIMIZATION (prev_tree);
+ struct cl_optimization *cur = TREE_OPTIMIZATION (cur_tree);
+ bool prev_fast_math;
+ bool cur_fast_math;
+
+ /* -undef turns off target-specific built-ins. */
+ if (flag_undef)
+ return;
+
+ /* Other target-independent built-ins determined by command-line
+ options. */
+ if (!prev->optimize_size && cur->optimize_size)
+ cpp_define (pfile, "__OPTIMIZE_SIZE__");
+ else if (prev->optimize_size && !cur->optimize_size)
+ cpp_undef (pfile, "__OPTIMIZE_SIZE__");
+
+ if (!prev->optimize && cur->optimize)
+ cpp_define (pfile, "__OPTIMIZE__");
+ else if (prev->optimize && !cur->optimize)
+ cpp_undef (pfile, "__OPTIMIZE__");
+
+ prev_fast_math = fast_math_flags_struct_set_p (prev);
+ cur_fast_math = fast_math_flags_struct_set_p (cur);
+ if (!prev_fast_math && cur_fast_math)
+ cpp_define (pfile, "__FAST_MATH__");
+ else if (prev_fast_math && !cur_fast_math)
+ cpp_undef (pfile, "__FAST_MATH__");
+
+ if (!prev->flag_signaling_nans && cur->flag_signaling_nans)
+ cpp_define (pfile, "__SUPPORT_SNAN__");
+ else if (prev->flag_signaling_nans && !cur->flag_signaling_nans)
+ cpp_undef (pfile, "__SUPPORT_SNAN__");
+
+ if (!prev->flag_finite_math_only && cur->flag_finite_math_only)
+ {
+ cpp_undef (pfile, "__FINITE_MATH_ONLY__");
+ cpp_define (pfile, "__FINITE_MATH_ONLY__=1");
+ }
+ else if (!prev->flag_finite_math_only && cur->flag_finite_math_only)
+ {
+ cpp_undef (pfile, "__FINITE_MATH_ONLY__");
+ cpp_define (pfile, "__FINITE_MATH_ONLY__=0");
+ }
+}
+
+
/* Hook that registers front end and target-specific built-ins. */
void
c_cpp_builtins (cpp_reader *pfile)
@@ -588,7 +641,7 @@ c_cpp_builtins (cpp_reader *pfile)
if (fast_math_flags_set_p ())
cpp_define (pfile, "__FAST_MATH__");
- if (flag_really_no_inline)
+ if (flag_no_inline)
cpp_define (pfile, "__NO_INLINE__");
if (flag_signaling_nans)
cpp_define (pfile, "__SUPPORT_SNAN__");
@@ -643,6 +696,11 @@ c_cpp_builtins (cpp_reader *pfile)
cpp_define (pfile, "__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16");
#endif
+#ifdef DWARF2_UNWIND_INFO
+ if (dwarf2out_do_cfi_asm ())
+ cpp_define (pfile, "__GCC_HAVE_DWARF2_CFI_ASM");
+#endif
+
/* Make the choice of ObjC runtime visible to source code. */
if (c_dialect_objc () && flag_next_runtime)
cpp_define (pfile, "__NEXT_RUNTIME__");
@@ -798,7 +856,7 @@ builtin_define_with_int_value (const char *macro, HOST_WIDE_INT value)
/* Pass an object-like macro a hexadecimal floating-point value. */
static void
builtin_define_with_hex_fp_value (const char *macro,
- tree type ATTRIBUTE_UNUSED, int digits,
+ tree type, int digits,
const char *hex_str,
const char *fp_suffix,
const char *fp_cast)
@@ -817,7 +875,8 @@ builtin_define_with_hex_fp_value (const char *macro,
then print it back out as decimal. */
real_from_string (&real, hex_str);
- real_to_decimal (dec_str, &real, sizeof (dec_str), digits, 0);
+ real_to_decimal_for_mode (dec_str, &real, sizeof (dec_str), digits, 0,
+ TYPE_MODE (type));
/* Assemble the macro in the following fashion
macro = fp_cast [dec_str fp_suffix] */
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 89430cbf3e1..7be2ca4e60a 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -52,7 +52,8 @@ along with GCC; see the file COPYING3. If not see
#include "c-pragma.h"
#include "langhooks.h"
#include "tree-mudflap.h"
-#include "tree-gimple.h"
+#include "gimple.h"
+#include "tree-iterator.h"
#include "diagnostic.h"
#include "tree-dump.h"
#include "cgraph.h"
@@ -61,6 +62,7 @@ along with GCC; see the file COPYING3. If not see
#include "except.h"
#include "langhooks-def.h"
#include "pointer-set.h"
+#include "gimple.h"
/* In grokdeclarator, distinguish syntactic contexts of declarators. */
enum decl_context
@@ -248,7 +250,7 @@ extern char C_SIZEOF_STRUCT_LANG_IDENTIFIER_isnt_accurate
union lang_tree_node
GTY((desc ("TREE_CODE (&%h.generic) == IDENTIFIER_NODE"),
- chain_next ("TREE_CODE (&%h.generic) == INTEGER_TYPE ? (union lang_tree_node *) TYPE_NEXT_VARIANT (&%h.generic) : ((union lang_tree_node *) GENERIC_NEXT (&%h.generic))")))
+ chain_next ("TREE_CODE (&%h.generic) == INTEGER_TYPE ? (union lang_tree_node *) TYPE_NEXT_VARIANT (&%h.generic) : ((union lang_tree_node *) TREE_CHAIN (&%h.generic))")))
{
union tree_node GTY ((tag ("0"),
desc ("tree_node_structure (&%h)")))
@@ -786,7 +788,7 @@ pop_scope (void)
&& TREE_PUBLIC (p)
&& !DECL_INITIAL (p)
&& !flag_gnu89_inline)
- pedwarn ("inline function %q+D declared but never defined", p);
+ pedwarn (0, "inline function %q+D declared but never defined", p);
goto common_symbol;
@@ -1113,16 +1115,16 @@ validate_proto_after_old_defn (tree newdecl, tree newtype, tree oldtype)
first in a pair of mismatched declarations, using the diagnostic
function DIAG. */
static void
-locate_old_decl (tree decl, void (*diag)(const char *, ...) ATTRIBUTE_GCC_CDIAG(1,2))
+locate_old_decl (tree decl)
{
if (TREE_CODE (decl) == FUNCTION_DECL && DECL_BUILT_IN (decl))
;
else if (DECL_INITIAL (decl))
- diag (G_("previous definition of %q+D was here"), decl);
+ inform ("previous definition of %q+D was here", decl);
else if (C_DECL_IMPLICIT (decl))
- diag (G_("previous implicit declaration of %q+D was here"), decl);
+ inform ("previous implicit declaration of %q+D was here", decl);
else
- diag (G_("previous declaration of %q+D was here"), decl);
+ inform ("previous declaration of %q+D was here", decl);
}
/* Subroutine of duplicate_decls. Compare NEWDECL to OLDDECL.
@@ -1163,7 +1165,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
&& !C_DECL_DECLARED_BUILTIN (olddecl)))
{
error ("%q+D redeclared as different kind of symbol", newdecl);
- locate_old_decl (olddecl, error);
+ locate_old_decl (olddecl);
}
else if (TREE_PUBLIC (newdecl))
warning (0, "built-in function %q+D declared as non-function",
@@ -1179,7 +1181,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
if (TREE_CODE (olddecl) == CONST_DECL)
{
error ("redeclaration of enumerator %q+D", newdecl);
- locate_old_decl (olddecl, error);
+ locate_old_decl (olddecl);
return false;
}
@@ -1223,11 +1225,10 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
&& TYPE_MAIN_VARIANT (TREE_TYPE (newtype)) == integer_type_node
&& C_FUNCTION_IMPLICIT_INT (newdecl) && !DECL_INITIAL (olddecl))
{
- pedwarn ("conflicting types for %q+D", newdecl);
+ pedwarned = pedwarn (0, "conflicting types for %q+D", newdecl);
/* Make sure we keep void as the return type. */
TREE_TYPE (newdecl) = *newtypep = newtype = oldtype;
C_FUNCTION_IMPLICIT_INT (newdecl) = 0;
- pedwarned = true;
}
/* Permit void foo (...) to match an earlier call to foo (...) with
no declared type (thus, implicitly int). */
@@ -1236,10 +1237,9 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
&& TYPE_MAIN_VARIANT (TREE_TYPE (oldtype)) == integer_type_node
&& C_DECL_IMPLICIT (olddecl) && !DECL_INITIAL (olddecl))
{
- pedwarn ("conflicting types for %q+D", newdecl);
+ pedwarned = pedwarn (0, "conflicting types for %q+D", newdecl);
/* Make sure we keep void as the return type. */
TREE_TYPE (olddecl) = *oldtypep = oldtype = newtype;
- pedwarned = true;
}
else
{
@@ -1248,7 +1248,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
else
error ("conflicting types for %q+D", newdecl);
diagnose_arglist_conflict (newdecl, olddecl, newtype, oldtype);
- locate_old_decl (olddecl, error);
+ locate_old_decl (olddecl);
return false;
}
}
@@ -1265,7 +1265,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
return true; /* Allow OLDDECL to continue in use. */
error ("redefinition of typedef %q+D", newdecl);
- locate_old_decl (olddecl, error);
+ locate_old_decl (olddecl);
return false;
}
@@ -1316,7 +1316,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
&& same_translation_unit_p (newdecl, olddecl))
{
error ("redefinition of %q+D", newdecl);
- locate_old_decl (olddecl, error);
+ locate_old_decl (olddecl);
return false;
}
}
@@ -1328,7 +1328,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
&& TYPE_ACTUAL_ARG_TYPES (oldtype)
&& !validate_proto_after_old_defn (newdecl, newtype, oldtype))
{
- locate_old_decl (olddecl, error);
+ locate_old_decl (olddecl);
return false;
}
/* A non-static declaration (even an "extern") followed by a
@@ -1352,7 +1352,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
{
error ("static declaration of %q+D follows "
"non-static declaration", newdecl);
- locate_old_decl (olddecl, error);
+ locate_old_decl (olddecl);
}
return false;
}
@@ -1362,14 +1362,14 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
{
error ("non-static declaration of %q+D follows "
"static declaration", newdecl);
- locate_old_decl (olddecl, error);
+ locate_old_decl (olddecl);
return false;
}
else if (warn_traditional)
{
- warning (OPT_Wtraditional, "non-static declaration of %q+D "
- "follows static declaration", newdecl);
- warned = true;
+ warned |= warning (OPT_Wtraditional,
+ "non-static declaration of %q+D "
+ "follows static declaration", newdecl);
}
}
@@ -1410,7 +1410,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
error ("non-thread-local declaration of %q+D follows "
"thread-local declaration", newdecl);
- locate_old_decl (olddecl, error);
+ locate_old_decl (olddecl);
return false;
}
@@ -1418,7 +1418,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
if (DECL_INITIAL (newdecl) && DECL_INITIAL (olddecl))
{
error ("redefinition of %q+D", newdecl);
- locate_old_decl (olddecl, error);
+ locate_old_decl (olddecl);
return false;
}
@@ -1439,14 +1439,14 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
{
error ("extern declaration of %q+D follows "
"declaration with no linkage", newdecl);
- locate_old_decl (olddecl, error);
+ locate_old_decl (olddecl);
return false;
}
else if (warn_traditional)
{
- warning (OPT_Wtraditional, "non-static declaration of %q+D "
- "follows static declaration", newdecl);
- warned = true;
+ warned |= warning (OPT_Wtraditional,
+ "non-static declaration of %q+D "
+ "follows static declaration", newdecl);
}
}
else
@@ -1458,7 +1458,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
error ("static declaration of %q+D follows "
"non-static declaration", newdecl);
- locate_old_decl (olddecl, error);
+ locate_old_decl (olddecl);
return false;
}
}
@@ -1475,12 +1475,12 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
{
error ("declaration of %q+D with no linkage follows "
"extern declaration", newdecl);
- locate_old_decl (olddecl, error);
+ locate_old_decl (olddecl);
}
else
{
error ("redeclaration of %q+D with no linkage", newdecl);
- locate_old_decl (olddecl, error);
+ locate_old_decl (olddecl);
}
return false;
@@ -1493,9 +1493,8 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
&& DECL_VISIBILITY_SPECIFIED (newdecl) && DECL_VISIBILITY_SPECIFIED (olddecl)
&& DECL_VISIBILITY (newdecl) != DECL_VISIBILITY (olddecl))
{
- warning (0, "redeclaration of %q+D with different visibility "
- "(old visibility preserved)", newdecl);
- warned = true;
+ warned |= warning (0, "redeclaration of %q+D with different visibility "
+ "(old visibility preserved)", newdecl);
}
if (TREE_CODE (newdecl) == FUNCTION_DECL)
@@ -1504,40 +1503,16 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
if (DECL_DECLARED_INLINE_P (newdecl)
&& lookup_attribute ("noinline", DECL_ATTRIBUTES (olddecl)))
{
- warning (OPT_Wattributes, "inline declaration of %qD follows "
- "declaration with attribute noinline", newdecl);
- warned = true;
+ warned |= warning (OPT_Wattributes,
+ "inline declaration of %qD follows "
+ "declaration with attribute noinline", newdecl);
}
else if (DECL_DECLARED_INLINE_P (olddecl)
&& lookup_attribute ("noinline", DECL_ATTRIBUTES (newdecl)))
{
- warning (OPT_Wattributes, "declaration of %q+D with attribute "
- "noinline follows inline declaration ", newdecl);
- warned = true;
- }
-
- /* Inline declaration after use or definition.
- ??? Should we still warn about this now we have unit-at-a-time
- mode and can get it right?
- Definitely don't complain if the decls are in different translation
- units.
- C99 permits this, so don't warn in that case. (The function
- may not be inlined everywhere in function-at-a-time mode, but
- we still shouldn't warn.) */
- if (DECL_DECLARED_INLINE_P (newdecl) && !DECL_DECLARED_INLINE_P (olddecl)
- && same_translation_unit_p (olddecl, newdecl)
- && flag_gnu89_inline)
- {
- if (TREE_USED (olddecl))
- {
- warning (0, "%q+D declared inline after being called", olddecl);
- warned = true;
- }
- else if (DECL_INITIAL (olddecl))
- {
- warning (0, "%q+D declared inline after its definition", olddecl);
- warned = true;
- }
+ warned |= warning (OPT_Wattributes,
+ "declaration of %q+D with attribute "
+ "noinline follows inline declaration ", newdecl);
}
}
else /* PARM_DECL, VAR_DECL */
@@ -1555,7 +1530,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
&& (!TREE_ASM_WRITTEN (olddecl) || TREE_ASM_WRITTEN (newdecl)))
{
error ("redefinition of parameter %q+D", newdecl);
- locate_old_decl (olddecl, error);
+ locate_old_decl (olddecl);
return false;
}
}
@@ -1581,14 +1556,13 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
&& !(TREE_CODE (newdecl) == VAR_DECL
&& DECL_INITIAL (newdecl) && !DECL_INITIAL (olddecl)))
{
- warning (OPT_Wredundant_decls, "redundant redeclaration of %q+D",
- newdecl);
- warned = true;
+ warned = warning (OPT_Wredundant_decls, "redundant redeclaration of %q+D",
+ newdecl);
}
- /* Report location of previous decl/defn in a consistent manner. */
+ /* Report location of previous decl/defn. */
if (warned || pedwarned)
- locate_old_decl (olddecl, pedwarned ? pedwarn : warning0);
+ locate_old_decl (olddecl);
#undef DECL_EXTERN_INLINE
@@ -1679,12 +1653,21 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype)
if (TREE_DEPRECATED (newdecl))
TREE_DEPRECATED (olddecl) = 1;
- /* Keep source location of definition rather than declaration and of
- prototype rather than non-prototype unless that prototype is
- built-in. */
- if ((DECL_INITIAL (newdecl) == 0 && DECL_INITIAL (olddecl) != 0)
- || (old_is_prototype && !new_is_prototype
- && !C_DECL_BUILTIN_PROTOTYPE (olddecl)))
+ /* If a decl is in a system header and the other isn't, keep the one on the
+ system header. Otherwise, keep source location of definition rather than
+ declaration and of prototype rather than non-prototype unless that
+ prototype is built-in. */
+ if (CODE_CONTAINS_STRUCT (TREE_CODE (olddecl), TS_DECL_WITH_VIS)
+ && DECL_IN_SYSTEM_HEADER (olddecl)
+ && !DECL_IN_SYSTEM_HEADER (newdecl) )
+ DECL_SOURCE_LOCATION (newdecl) = DECL_SOURCE_LOCATION (olddecl);
+ else if (CODE_CONTAINS_STRUCT (TREE_CODE (olddecl), TS_DECL_WITH_VIS)
+ && DECL_IN_SYSTEM_HEADER (newdecl)
+ && !DECL_IN_SYSTEM_HEADER (olddecl))
+ DECL_SOURCE_LOCATION (olddecl) = DECL_SOURCE_LOCATION (newdecl);
+ else if ((DECL_INITIAL (newdecl) == 0 && DECL_INITIAL (olddecl) != 0)
+ || (old_is_prototype && !new_is_prototype
+ && !C_DECL_BUILTIN_PROTOTYPE (olddecl)))
DECL_SOURCE_LOCATION (newdecl) = DECL_SOURCE_LOCATION (olddecl);
/* Merge the initialization information. */
@@ -1700,12 +1683,6 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype)
if (CODE_CONTAINS_STRUCT (TREE_CODE (olddecl), TS_DECL_WITH_VIS))
{
- /* Merge the unused-warning information. */
- if (DECL_IN_SYSTEM_HEADER (olddecl))
- DECL_IN_SYSTEM_HEADER (newdecl) = 1;
- else if (DECL_IN_SYSTEM_HEADER (newdecl))
- DECL_IN_SYSTEM_HEADER (olddecl) = 1;
-
/* Merge the section attribute.
We want to issue an error if the sections conflict but that
must be done later in decl_attributes since we are called
@@ -1798,14 +1775,13 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype)
if (new_is_definition && DECL_INITIAL (olddecl))
{
if (TREE_USED (olddecl)
- /* In unit-at-a-time mode we never inline re-defined extern
- inline functions. */
- && !flag_unit_at_a_time
+ /* We never inline re-defined extern inline functions.
+ FIXME: This would be better handled by keeping both functions
+ as separate declarations. */
&& cgraph_function_possibly_inlined_p (olddecl))
(*debug_hooks->outlining_inline_function) (olddecl);
/* The new defn must not be inline. */
- DECL_INLINE (newdecl) = 0;
DECL_UNINLINABLE (newdecl) = 1;
}
else
@@ -1839,6 +1815,17 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype)
= C_DECL_BUILTIN_PROTOTYPE (olddecl);
}
+ /* Preserve function specific target and optimization options */
+ if (DECL_FUNCTION_SPECIFIC_TARGET (olddecl)
+ && !DECL_FUNCTION_SPECIFIC_TARGET (newdecl))
+ DECL_FUNCTION_SPECIFIC_TARGET (newdecl)
+ = DECL_FUNCTION_SPECIFIC_TARGET (olddecl);
+
+ if (DECL_FUNCTION_SPECIFIC_OPTIMIZATION (olddecl)
+ && !DECL_FUNCTION_SPECIFIC_OPTIMIZATION (newdecl))
+ DECL_FUNCTION_SPECIFIC_OPTIMIZATION (newdecl)
+ = DECL_FUNCTION_SPECIFIC_OPTIMIZATION (olddecl);
+
/* Also preserve various other info from the definition. */
if (!new_is_definition)
{
@@ -1846,29 +1833,24 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype)
DECL_INITIAL (newdecl) = DECL_INITIAL (olddecl);
DECL_STRUCT_FUNCTION (newdecl) = DECL_STRUCT_FUNCTION (olddecl);
DECL_SAVED_TREE (newdecl) = DECL_SAVED_TREE (olddecl);
+ gimple_set_body (newdecl, gimple_body (olddecl));
DECL_ARGUMENTS (newdecl) = DECL_ARGUMENTS (olddecl);
- /* Set DECL_INLINE on the declaration if we've got a body
- from which to instantiate. */
- if (DECL_INLINE (olddecl) && !DECL_UNINLINABLE (newdecl))
- {
- DECL_INLINE (newdecl) = 1;
- DECL_ABSTRACT_ORIGIN (newdecl)
- = DECL_ABSTRACT_ORIGIN (olddecl);
- }
- }
- else
- {
- /* If a previous declaration said inline, mark the
- definition as inlinable. */
- if (DECL_DECLARED_INLINE_P (newdecl)
- && !DECL_UNINLINABLE (newdecl))
- DECL_INLINE (newdecl) = 1;
+ /* See if we've got a function to instantiate from. */
+ if (DECL_SAVED_TREE (olddecl))
+ DECL_ABSTRACT_ORIGIN (newdecl)
+ = DECL_ABSTRACT_ORIGIN (olddecl);
}
}
extern_changed = DECL_EXTERNAL (olddecl) && !DECL_EXTERNAL (newdecl);
+ /* Merge the USED information. */
+ if (TREE_USED (olddecl))
+ TREE_USED (newdecl) = 1;
+ else if (TREE_USED (newdecl))
+ TREE_USED (olddecl) = 1;
+
/* Copy most of the decl-specific fields of NEWDECL into OLDDECL.
But preserve OLDDECL's DECL_UID and DECL_CONTEXT. */
{
@@ -1880,6 +1862,10 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype)
sizeof (struct tree_decl_common) - sizeof (struct tree_common));
switch (TREE_CODE (olddecl))
{
+ case FUNCTION_DECL:
+ gimple_set_body (olddecl, gimple_body (newdecl));
+ /* fall through */
+
case FIELD_DECL:
case VAR_DECL:
case PARM_DECL:
@@ -1887,7 +1873,6 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype)
case RESULT_DECL:
case CONST_DECL:
case TYPE_DECL:
- case FUNCTION_DECL:
memcpy ((char *) olddecl + sizeof (struct tree_decl_common),
(char *) newdecl + sizeof (struct tree_decl_common),
tree_code_size (TREE_CODE (olddecl)) - sizeof (struct tree_decl_common));
@@ -2341,13 +2326,16 @@ implicit_decl_warning (tree id, tree olddecl)
{
if (warn_implicit_function_declaration)
{
+ bool warned;
+
if (flag_isoc99)
- pedwarn (G_("implicit declaration of function %qE"), id);
+ warned = pedwarn (OPT_Wimplicit_function_declaration,
+ G_("implicit declaration of function %qE"), id);
else
- warning (OPT_Wimplicit_function_declaration,
- G_("implicit declaration of function %qE"), id);
- if (olddecl)
- locate_old_decl (olddecl, inform);
+ warned = warning (OPT_Wimplicit_function_declaration,
+ G_("implicit declaration of function %qE"), id);
+ if (olddecl && warned)
+ locate_old_decl (olddecl);
}
}
@@ -2418,7 +2406,7 @@ implicitly_declare (tree functionid)
{
error ("incompatible implicit declaration of function %qD",
decl);
- locate_old_decl (decl, error);
+ locate_old_decl (decl);
}
}
b->type = TREE_TYPE (decl);
@@ -2560,7 +2548,7 @@ declare_label (tree name)
if (b && B_IN_CURRENT_SCOPE (b))
{
error ("duplicate label declaration %qE", name);
- locate_old_decl (b->decl, error);
+ locate_old_decl (b->decl);
/* Just use the previous declaration. */
return b->decl;
@@ -2596,7 +2584,7 @@ define_label (location_t location, tree name)
&& C_DECLARED_LABEL_FLAG (label))))
{
error ("%Hduplicate label %qD", &location, label);
- locate_old_decl (label, error);
+ locate_old_decl (label);
return 0;
}
else if (label && DECL_CONTEXT (label) == current_function_decl)
@@ -2894,7 +2882,7 @@ shadow_tag_warned (const struct c_declspecs *declspecs, int warned)
if (warned != 1 && code != ENUMERAL_TYPE)
/* Empty unnamed enum OK */
{
- pedwarn ("unnamed struct/union that defines no instances");
+ pedwarn (0, "unnamed struct/union that defines no instances");
warned = 1;
}
}
@@ -2902,8 +2890,8 @@ shadow_tag_warned (const struct c_declspecs *declspecs, int warned)
&& declspecs->storage_class != csc_none)
{
if (warned != 1)
- pedwarn ("empty declaration with storage class specifier "
- "does not redeclare tag");
+ pedwarn (0, "empty declaration with storage class specifier "
+ "does not redeclare tag");
warned = 1;
pending_xref_error ();
}
@@ -2913,8 +2901,8 @@ shadow_tag_warned (const struct c_declspecs *declspecs, int warned)
|| declspecs->restrict_p))
{
if (warned != 1)
- pedwarn ("empty declaration with type qualifier "
- "does not redeclare tag");
+ pedwarn (0, "empty declaration with type qualifier "
+ "does not redeclare tag");
warned = 1;
pending_xref_error ();
}
@@ -2934,14 +2922,14 @@ shadow_tag_warned (const struct c_declspecs *declspecs, int warned)
{
if (warned != 1 && !in_system_header)
{
- pedwarn ("useless type name in empty declaration");
+ pedwarn (0, "useless type name in empty declaration");
warned = 1;
}
}
}
else if (warned != 1 && !in_system_header && declspecs->typedef_p)
{
- pedwarn ("useless type name in empty declaration");
+ pedwarn (0, "useless type name in empty declaration");
warned = 1;
}
@@ -2988,7 +2976,7 @@ shadow_tag_warned (const struct c_declspecs *declspecs, int warned)
if (warned != 1)
{
if (!found_tag)
- pedwarn ("empty declaration");
+ pedwarn (0, "empty declaration");
}
}
@@ -3051,13 +3039,13 @@ build_array_declarator (tree expr, struct c_declspecs *quals, bool static_p,
}
declarator->u.array.static_p = static_p;
declarator->u.array.vla_unspec_p = vla_unspec_p;
- if (pedantic && !flag_isoc99)
+ if (!flag_isoc99)
{
if (static_p || quals != NULL)
- pedwarn ("ISO C90 does not support %<static%> or type "
+ pedwarn (OPT_pedantic, "ISO C90 does not support %<static%> or type "
"qualifiers in parameter array declarators");
if (vla_unspec_p)
- pedwarn ("ISO C90 does not support %<[*]%> array declarators");
+ pedwarn (OPT_pedantic, "ISO C90 does not support %<[*]%> array declarators");
}
if (vla_unspec_p)
{
@@ -3165,8 +3153,7 @@ start_decl (struct c_declarator *declarator, struct c_declspecs *declspecs,
if (!decl)
return 0;
- if (warn_main > 0 && TREE_CODE (decl) != FUNCTION_DECL
- && MAIN_NAME_P (DECL_NAME (decl)))
+ if (TREE_CODE (decl) != FUNCTION_DECL && MAIN_NAME_P (DECL_NAME (decl)))
warning (OPT_Wmain, "%q+D is usually a function", decl);
if (initialized)
@@ -3313,8 +3300,8 @@ start_decl (struct c_declarator *declarator, struct c_declspecs *declspecs,
&& !TREE_READONLY (decl)
&& DECL_DECLARED_INLINE_P (current_function_decl)
&& DECL_EXTERNAL (current_function_decl))
- pedwarn ("%q+D is static but declared in inline function %qD "
- "which is not static", decl, current_function_decl);
+ pedwarn (0, "%q+D is static but declared in inline function %qD "
+ "which is not static", decl, current_function_decl);
/* Add this decl to the current scope.
TEM may equal DECL or it may be a previous decl of the same name. */
@@ -3603,10 +3590,6 @@ finish_decl (tree decl, tree init, tree asmspec_tree)
}
}
- /* If this was marked 'used', be sure it will be output. */
- if (!flag_unit_at_a_time && lookup_attribute ("used", DECL_ATTRIBUTES (decl)))
- mark_decl_referenced (decl);
-
if (TREE_CODE (decl) == TYPE_DECL)
{
if (!DECL_FILE_SCOPE_P (decl)
@@ -3691,7 +3674,7 @@ mark_forward_parm_decls (void)
if (pedantic && !current_scope->warned_forward_parm_decls)
{
- pedwarn ("ISO C forbids forward parameter declarations");
+ pedwarn (OPT_pedantic, "ISO C forbids forward parameter declarations");
current_scope->warned_forward_parm_decls = true;
}
@@ -3838,12 +3821,11 @@ check_bitfield_type_and_width (tree *type, tree *width, const char *orig_name)
}
type_mv = TYPE_MAIN_VARIANT (*type);
- if (pedantic
- && !in_system_header
+ if (!in_system_header
&& type_mv != integer_type_node
&& type_mv != unsigned_type_node
&& type_mv != boolean_type_node)
- pedwarn ("type of bit-field %qs is a GCC extension", name);
+ pedwarn (OPT_pedantic, "type of bit-field %qs is a GCC extension", name);
max_width = TYPE_PRECISION (*type);
@@ -3873,28 +3855,27 @@ check_bitfield_type_and_width (tree *type, tree *width, const char *orig_name)
static void
warn_variable_length_array (const char *name, tree size)
{
- int ped = !flag_isoc99 && pedantic && warn_vla != 0;
int const_size = TREE_CONSTANT (size);
- if (ped)
+ if (!flag_isoc99 && pedantic && warn_vla != 0)
{
if (const_size)
{
if (name)
- pedwarn ("ISO C90 forbids array %qs whose size "
+ pedwarn (OPT_Wvla, "ISO C90 forbids array %qs whose size "
"can%'t be evaluated",
name);
else
- pedwarn ("ISO C90 forbids array whose size "
+ pedwarn (OPT_Wvla, "ISO C90 forbids array whose size "
"can%'t be evaluated");
}
else
{
if (name)
- pedwarn ("ISO C90 forbids variable length array %qs",
+ pedwarn (OPT_Wvla, "ISO C90 forbids variable length array %qs",
name);
else
- pedwarn ("ISO C90 forbids variable length array");
+ pedwarn (OPT_Wvla, "ISO C90 forbids variable length array");
}
}
else if (warn_vla > 0)
@@ -4055,8 +4036,9 @@ grokdeclarator (const struct c_declarator *declarator,
if ((warn_implicit_int || warn_return_type || flag_isoc99)
&& funcdef_flag)
warn_about_return_type = 1;
- else if (warn_implicit_int || flag_isoc99)
- pedwarn_c99 ("type defaults to %<int%> in declaration of %qs", name);
+ else
+ pedwarn_c99 (flag_isoc99 ? 0 : OPT_Wimplicit_int,
+ "type defaults to %<int%> in declaration of %qs", name);
}
/* Adjust the type if a bit-field is being declared,
@@ -4064,7 +4046,7 @@ grokdeclarator (const struct c_declarator *declarator,
"signed". */
if (bitfield && !flag_signed_bitfields && !declspecs->explicit_signed_p
&& TREE_CODE (type) == INTEGER_TYPE)
- type = c_common_unsigned_type (type);
+ type = unsigned_type_for (type);
/* Figure out the type qualifiers for the declaration. There are
two ways a declaration can become qualified. One is something
@@ -4084,11 +4066,11 @@ grokdeclarator (const struct c_declarator *declarator,
if (pedantic && !flag_isoc99)
{
if (constp > 1)
- pedwarn ("duplicate %<const%>");
+ pedwarn (OPT_pedantic, "duplicate %<const%>");
if (restrictp > 1)
- pedwarn ("duplicate %<restrict%>");
+ pedwarn (OPT_pedantic, "duplicate %<restrict%>");
if (volatilep > 1)
- pedwarn ("duplicate %<volatile%>");
+ pedwarn (OPT_pedantic, "duplicate %<volatile%>");
}
if (!flag_gen_aux_info && (TYPE_QUALS (element_type)))
type = TYPE_MAIN_VARIANT (type);
@@ -4105,9 +4087,9 @@ grokdeclarator (const struct c_declarator *declarator,
|| storage_class == csc_register
|| storage_class == csc_typedef))
{
- if (storage_class == csc_auto
- && (pedantic || current_scope == file_scope))
- pedwarn ("function definition declared %<auto%>");
+ if (storage_class == csc_auto)
+ pedwarn ((current_scope == file_scope) ? 0 : OPT_pedantic,
+ "function definition declared %<auto%>");
if (storage_class == csc_register)
error ("function definition declared %<register%>");
if (storage_class == csc_typedef)
@@ -4163,7 +4145,7 @@ grokdeclarator (const struct c_declarator *declarator,
if (storage_class == csc_auto)
error ("file-scope declaration of %qs specifies %<auto%>", name);
if (pedantic && storage_class == csc_register)
- pedwarn ("file-scope declaration of %qs specifies %<register%>", name);
+ pedwarn (OPT_pedantic, "file-scope declaration of %qs specifies %<register%>", name);
}
else
{
@@ -4276,7 +4258,7 @@ grokdeclarator (const struct c_declarator *declarator,
}
if (pedantic && !in_system_header && flexible_array_type_p (type))
- pedwarn ("invalid use of structure with flexible array member");
+ pedwarn (OPT_pedantic, "invalid use of structure with flexible array member");
if (size == error_mark_node)
type = error_mark_node;
@@ -4301,7 +4283,7 @@ grokdeclarator (const struct c_declarator *declarator,
}
if (pedantic && integer_zerop (size))
- pedwarn ("ISO C forbids zero-size array %qs", name);
+ pedwarn (OPT_pedantic, "ISO C forbids zero-size array %qs", name);
if (TREE_CODE (size) == INTEGER_CST)
{
@@ -4373,7 +4355,7 @@ grokdeclarator (const struct c_declarator *declarator,
else if (decl_context == FIELD)
{
if (pedantic && !flag_isoc99 && !in_system_header)
- pedwarn ("ISO C90 does not support flexible array members");
+ pedwarn (OPT_pedantic, "ISO C90 does not support flexible array members");
/* ISO C99 Flexible array members are effectively
identical to GCC's zero-length array extension. */
@@ -4518,7 +4500,7 @@ grokdeclarator (const struct c_declarator *declarator,
function definitions in ISO C; GCC used to used
them for noreturn functions. */
if (VOID_TYPE_P (type) && really_funcdef)
- pedwarn ("function definition has qualified void return type");
+ pedwarn (0, "function definition has qualified void return type");
else
warning (OPT_Wignored_qualifiers,
"type qualifiers ignored on function return type");
@@ -4550,7 +4532,7 @@ grokdeclarator (const struct c_declarator *declarator,
if (pedantic && TREE_CODE (type) == FUNCTION_TYPE
&& type_quals)
- pedwarn ("ISO C forbids qualified function types");
+ pedwarn (OPT_pedantic, "ISO C forbids qualified function types");
if (type_quals)
type = c_build_qualified_type (type, type_quals);
size_varies = 0;
@@ -4631,7 +4613,7 @@ grokdeclarator (const struct c_declarator *declarator,
tree decl;
if (pedantic && TREE_CODE (type) == FUNCTION_TYPE
&& type_quals)
- pedwarn ("ISO C forbids qualified function types");
+ pedwarn (OPT_pedantic, "ISO C forbids qualified function types");
if (type_quals)
type = c_build_qualified_type (type, type_quals);
decl = build_decl (TYPE_DECL, declarator->u.id, type);
@@ -4639,7 +4621,7 @@ grokdeclarator (const struct c_declarator *declarator,
if (declspecs->explicit_signed_p)
C_TYPEDEF_EXPLICITLY_SIGNED (decl) = 1;
if (declspecs->inline_p)
- pedwarn ("typedef %q+D declared %<inline%>", decl);
+ pedwarn (0, "typedef %q+D declared %<inline%>", decl);
return decl;
}
@@ -4654,7 +4636,7 @@ grokdeclarator (const struct c_declarator *declarator,
&& !declspecs->inline_p);
if (pedantic && TREE_CODE (type) == FUNCTION_TYPE
&& type_quals)
- pedwarn ("ISO C forbids const or volatile function types");
+ pedwarn (OPT_pedantic, "ISO C forbids const or volatile function types");
if (type_quals)
type = c_build_qualified_type (type, type_quals);
return type;
@@ -4664,7 +4646,8 @@ grokdeclarator (const struct c_declarator *declarator,
&& variably_modified_type_p (type, NULL_TREE))
{
/* C99 6.7.2.1p8 */
- pedwarn ("a member of a structure or union cannot have a variably modified type");
+ pedwarn (OPT_pedantic,
+ "a member of a structure or union cannot have a variably modified type");
}
/* Aside from typedefs and type names (handle above),
@@ -4717,8 +4700,8 @@ grokdeclarator (const struct c_declarator *declarator,
}
else if (TREE_CODE (type) == FUNCTION_TYPE)
{
- if (pedantic && type_quals)
- pedwarn ("ISO C forbids qualified function types");
+ if (type_quals)
+ pedwarn (OPT_pedantic, "ISO C forbids qualified function types");
if (type_quals)
type = c_build_qualified_type (type, type_quals);
type = build_pointer_type (type);
@@ -4744,7 +4727,7 @@ grokdeclarator (const struct c_declarator *declarator,
DECL_ARG_TYPE (decl) = promoted_type;
if (declspecs->inline_p)
- pedwarn ("parameter %q+D declared %<inline%>", decl);
+ pedwarn (0, "parameter %q+D declared %<inline%>", decl);
}
else if (decl_context == FIELD)
{
@@ -4790,10 +4773,7 @@ grokdeclarator (const struct c_declarator *declarator,
GCC allows 'auto', perhaps with 'inline', to support
nested functions. */
if (storage_class == csc_auto)
- {
- if (pedantic)
- pedwarn ("invalid storage class for function %qs", name);
- }
+ pedwarn (OPT_pedantic, "invalid storage class for function %qs", name);
else if (storage_class == csc_static)
{
error ("invalid storage class for function %qs", name);
@@ -4809,7 +4789,8 @@ grokdeclarator (const struct c_declarator *declarator,
decl = build_decl_attribute_variant (decl, decl_attr);
if (pedantic && type_quals && !DECL_IN_SYSTEM_HEADER (decl))
- pedwarn ("ISO C forbids qualified function types");
+ pedwarn (OPT_pedantic,
+ "ISO C forbids qualified function types");
/* GNU C interprets a volatile-qualified function type to indicate
that the function does not return. */
@@ -4851,25 +4832,11 @@ grokdeclarator (const struct c_declarator *declarator,
if (flag_hosted && MAIN_NAME_P (declarator->u.id))
{
if (declspecs->inline_p)
- pedwarn ("cannot inline function %<main%>");
+ pedwarn (0, "cannot inline function %<main%>");
}
else if (declspecs->inline_p)
- {
- /* Record that the function is declared `inline'. */
- DECL_DECLARED_INLINE_P (decl) = 1;
-
- /* Do not mark bare declarations as DECL_INLINE. Doing so
- in the presence of multiple declarations can result in
- the abstract origin pointing between the declarations,
- which will confuse dwarf2out. */
- if (initialized)
- DECL_INLINE (decl) = 1;
- }
- /* If -finline-functions, assume it can be inlined. This does
- two things: let the function be deferred until it is actually
- needed, and let dwarf2 know that the function is inlinable. */
- else if (flag_inline_trees == 2 && initialized)
- DECL_INLINE (decl) = 1;
+ /* Record that the function is declared `inline'. */
+ DECL_DECLARED_INLINE_P (decl) = 1;
}
else
{
@@ -4904,7 +4871,7 @@ grokdeclarator (const struct c_declarator *declarator,
C_DECL_VARIABLE_SIZE (decl) = 1;
if (declspecs->inline_p)
- pedwarn ("variable %q+D declared %<inline%>", decl);
+ pedwarn (0, "variable %q+D declared %<inline%>", decl);
/* At file scope, an initialized extern declaration may follow
a static declaration. In that case, DECL_EXTERNAL will be
@@ -5012,7 +4979,7 @@ grokparms (struct c_arg_info *arg_info, bool funcdef_flag)
else if (arg_types && TREE_CODE (TREE_VALUE (arg_types)) == IDENTIFIER_NODE)
{
if (!funcdef_flag)
- pedwarn ("parameter names (without types) in function declaration");
+ pedwarn (0, "parameter names (without types) in function declaration");
arg_info->parms = arg_info->types;
arg_info->types = 0;
@@ -5426,11 +5393,10 @@ grokfield (struct c_declarator *declarator, struct c_declspecs *declspecs,
}
if (!ok)
{
- pedwarn ("declaration does not declare anything");
+ pedwarn (0, "declaration does not declare anything");
return NULL_TREE;
}
- if (pedantic)
- pedwarn ("ISO C doesn%'t support unnamed structs/unions");
+ pedwarn (OPT_pedantic, "ISO C doesn%'t support unnamed structs/unions");
}
value = grokdeclarator (declarator, declspecs, FIELD, false,
@@ -5529,16 +5495,16 @@ finish_struct (tree t, tree fieldlist, tree attributes)
if (TREE_CODE (t) == UNION_TYPE)
{
if (fieldlist)
- pedwarn ("union has no named members");
+ pedwarn (OPT_pedantic, "union has no named members");
else
- pedwarn ("union has no members");
+ pedwarn (OPT_pedantic, "union has no members");
}
else
{
if (fieldlist)
- pedwarn ("struct has no named members");
+ pedwarn (OPT_pedantic, "struct has no named members");
else
- pedwarn ("struct has no members");
+ pedwarn (OPT_pedantic, "struct has no members");
}
}
}
@@ -5617,7 +5583,8 @@ finish_struct (tree t, tree fieldlist, tree attributes)
if (pedantic && !in_system_header && TREE_CODE (t) == RECORD_TYPE
&& flexible_array_type_p (TREE_TYPE (x)))
- pedwarn ("%Jinvalid use of structure with flexible array member", x);
+ pedwarn (OPT_pedantic,
+ "%Jinvalid use of structure with flexible array member", x);
if (DECL_NAME (x))
saw_named_field = 1;
@@ -5909,11 +5876,13 @@ finish_enum (tree enumtype, tree values, tree attributes)
/* The ISO C Standard mandates enumerators to have type int,
even though the underlying type of an enum type is
- unspecified. Here we convert any enumerators that fit in
- an int to type int, to avoid promotions to unsigned types
- when comparing integers with enumerators that fit in the
- int range. When -pedantic is given, build_enumerator()
- would have already taken care of those that don't fit. */
+ unspecified. However, GCC allows enumerators of any
+ integer type as an extensions. Here we convert any
+ enumerators that fit in an int to type int, to avoid
+ promotions to unsigned types when comparing integers with
+ enumerators that fit in the int range. When -pedantic is
+ given, build_enumerator() would have already warned about
+ those that don't fit. */
if (int_fits_type_p (ini, integer_type_node))
tem = integer_type_node;
else
@@ -5965,7 +5934,8 @@ finish_enum (tree enumtype, tree values, tree attributes)
Assignment of sequential values by default is handled here. */
tree
-build_enumerator (struct c_enum_contents *the_enum, tree name, tree value)
+build_enumerator (struct c_enum_contents *the_enum, tree name, tree value,
+ location_t value_loc)
{
tree decl, type;
@@ -5999,14 +5969,13 @@ build_enumerator (struct c_enum_contents *the_enum, tree name, tree value)
if (the_enum->enum_overflow)
error ("overflow in enumeration values");
}
-
- if (pedantic && !int_fits_type_p (value, integer_type_node))
- {
- pedwarn ("ISO C restricts enumerator values to range of %<int%>");
- /* XXX This causes -pedantic to change the meaning of the program.
- Remove? -zw 2004-03-15 */
- value = convert (integer_type_node, value);
- }
+ /* Even though the underlying type of an enum is unspecified, the
+ type of enumeration constants is explicitly defined as int
+ (6.4.4.3/2 in the C99 Standard). GCC allows any integer type as
+ an extension. */
+ else if (!int_fits_type_p (value, integer_type_node))
+ pedwarn_at (value_loc, OPT_pedantic,
+ "ISO C restricts enumerator values to range of %<int%>");
/* Set basis for default for next value. */
the_enum->enum_next_value = build_binary_op (PLUS_EXPR, value,
@@ -6118,7 +6087,9 @@ start_function (struct c_declspecs *declspecs, struct c_declarator *declarator,
}
if (warn_about_return_type)
- pedwarn_c99 ("return type defaults to %<int%>");
+ pedwarn_c99 (flag_isoc99 ? 0
+ : (warn_return_type ? OPT_Wreturn_type : OPT_Wimplicit_int),
+ "return type defaults to %<int%>");
/* Make the init_value nonzero so pushdecl knows this is not tentative.
error_mark_node is replaced below (in pop_scope) with the BLOCK. */
@@ -6235,16 +6206,16 @@ start_function (struct c_declspecs *declspecs, struct c_declarator *declarator,
maybe_apply_pragma_weak (decl1);
/* Warn for unlikely, improbable, or stupid declarations of `main'. */
- if (warn_main > 0 && MAIN_NAME_P (DECL_NAME (decl1)))
+ if (warn_main && MAIN_NAME_P (DECL_NAME (decl1)))
{
if (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (decl1)))
!= integer_type_node)
- pedwarn ("return type of %q+D is not %<int%>", decl1);
+ pedwarn (OPT_Wmain, "return type of %q+D is not %<int%>", decl1);
- check_main_parameter_types(decl1);
+ check_main_parameter_types (decl1);
if (!TREE_PUBLIC (decl1))
- pedwarn ("%q+D is normally a non-static function", decl1);
+ pedwarn (OPT_Wmain, "%q+D is normally a non-static function", decl1);
}
/* Record the decl so that the function name is defined.
@@ -6392,7 +6363,7 @@ store_parm_decls_oldstyle (tree fndecl, const struct c_arg_info *arg_info)
warn_if_shadowing (decl);
if (flag_isoc99)
- pedwarn ("type of %q+D defaults to %<int%>", decl);
+ pedwarn (0, "type of %q+D defaults to %<int%>", decl);
else
warning (OPT_Wmissing_parameter_type, "type of %q+D defaults to %<int%>", decl);
}
@@ -6503,22 +6474,19 @@ store_parm_decls_oldstyle (tree fndecl, const struct c_arg_info *arg_info)
< TYPE_PRECISION (integer_type_node))
DECL_ARG_TYPE (parm) = integer_type_node;
- if (pedantic)
+ /* ??? Is it possible to get here with a
+ built-in prototype or will it always have
+ been diagnosed as conflicting with an
+ old-style definition and discarded? */
+ if (current_function_prototype_built_in)
+ warning (OPT_pedantic, "promoted argument %qD "
+ "doesn%'t match built-in prototype", parm);
+ else
{
- /* ??? Is it possible to get here with a
- built-in prototype or will it always have
- been diagnosed as conflicting with an
- old-style definition and discarded? */
- if (current_function_prototype_built_in)
- warning (0, "promoted argument %qD "
- "doesn%'t match built-in prototype", parm);
- else
- {
- pedwarn ("promoted argument %qD "
- "doesn%'t match prototype", parm);
- pedwarn ("%Hprototype declaration",
- &current_function_prototype_locus);
- }
+ pedwarn (OPT_pedantic, "promoted argument %qD "
+ "doesn%'t match prototype", parm);
+ pedwarn (OPT_pedantic, "%Hprototype declaration",
+ &current_function_prototype_locus);
}
}
else
@@ -6653,9 +6621,10 @@ static void
c_gimple_diagnostics_recursively (tree fndecl)
{
struct cgraph_node *cgn;
+ gimple_seq body = gimple_body (fndecl);
/* Handle attribute((warn_unused_result)). Relies on gimple input. */
- c_warn_unused_result (&DECL_SAVED_TREE (fndecl));
+ c_warn_unused_result (body);
/* Notice when OpenMP structured block constraints are violated. */
if (flag_openmp)
@@ -6702,30 +6671,18 @@ finish_function (void)
if (DECL_RESULT (fndecl) && DECL_RESULT (fndecl) != error_mark_node)
DECL_CONTEXT (DECL_RESULT (fndecl)) = fndecl;
- if (MAIN_NAME_P (DECL_NAME (fndecl)) && flag_hosted)
+ if (MAIN_NAME_P (DECL_NAME (fndecl)) && flag_hosted
+ && TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (fndecl)))
+ == integer_type_node && flag_isoc99)
{
- if (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (fndecl)))
- != integer_type_node)
- {
- /* If warn_main is 1 (-Wmain) or 2 (-Wall), we have already warned.
- If warn_main is -1 (-Wno-main) we don't want to be warned. */
- if (!warn_main)
- pedwarn ("return type of %q+D is not %<int%>", fndecl);
- }
- else
- {
- if (flag_isoc99)
- {
- tree stmt = c_finish_return (integer_zero_node);
- /* Hack. We don't want the middle-end to warn that this return
- is unreachable, so we mark its location as special. Using
- UNKNOWN_LOCATION has the problem that it gets clobbered in
- annotate_one_with_locus. A cleaner solution might be to
- ensure ! should_carry_locus_p (stmt), but that needs a flag.
- */
- SET_EXPR_LOCATION (stmt, BUILTINS_LOCATION);
- }
- }
+ tree stmt = c_finish_return (integer_zero_node);
+ /* Hack. We don't want the middle-end to warn that this return
+ is unreachable, so we mark its location as special. Using
+ UNKNOWN_LOCATION has the problem that it gets clobbered in
+ annotate_one_with_locus. A cleaner solution might be to
+ ensure ! should_carry_locus_p (stmt), but that needs a flag.
+ */
+ SET_EXPR_LOCATION (stmt, BUILTINS_LOCATION);
}
/* Tie off the statement tree for this function. */
@@ -6743,9 +6700,9 @@ finish_function (void)
&& !MAIN_NAME_P (DECL_NAME (fndecl))
/* Or if they didn't actually specify a return type. */
&& !C_FUNCTION_IMPLICIT_INT (fndecl)
- /* Normally, with -Wreturn-type, flow will complain. Unless we're an
- inline function, as we might never be compiled separately. */
- && DECL_INLINE (fndecl))
+ /* Normally, with -Wreturn-type, flow will complain, but we might
+ optimize out static functions. */
+ && !TREE_PUBLIC (fndecl))
{
warning (OPT_Wreturn_type,
"no return statement in function returning non-void");
@@ -7161,8 +7118,8 @@ declspecs_add_qual (struct c_declspecs *specs, tree qual)
default:
gcc_unreachable ();
}
- if (dupe && pedantic && !flag_isoc99)
- pedwarn ("duplicate %qE", qual);
+ if (dupe && !flag_isoc99)
+ pedwarn (OPT_pedantic, "duplicate %qE", qual);
return specs;
}
@@ -7210,9 +7167,8 @@ declspecs_add_type (struct c_declspecs *specs, struct c_typespec spec)
"declaration specifiers");
break;
}
- if (pedantic && !flag_isoc99 && !in_system_header
- && warn_long_long)
- pedwarn ("ISO C90 does not support %<long long%>");
+ if (pedantic && !flag_isoc99 && !in_system_header)
+ pedwarn (OPT_Wlong_long, "ISO C90 does not support %<long long%>");
specs->long_long_p = 1;
break;
}
@@ -7335,8 +7291,8 @@ declspecs_add_type (struct c_declspecs *specs, struct c_typespec spec)
break;
case RID_COMPLEX:
dupe = specs->complex_p;
- if (pedantic && !flag_isoc99 && !in_system_header)
- pedwarn ("ISO C90 does not support complex types");
+ if (!flag_isoc99 && !in_system_header)
+ pedwarn (OPT_pedantic, "ISO C90 does not support complex types");
if (specs->typespec_word == cts_void)
error ("both %<complex%> and %<void%> in "
"declaration specifiers");
@@ -7366,8 +7322,7 @@ declspecs_add_type (struct c_declspecs *specs, struct c_typespec spec)
break;
case RID_SAT:
dupe = specs->saturating_p;
- if (pedantic)
- pedwarn ("ISO C does not support saturating types");
+ pedwarn (OPT_pedantic, "ISO C does not support saturating types");
if (specs->typespec_word == cts_void)
error ("both %<_Sat%> and %<void%> in "
"declaration specifiers");
@@ -7564,8 +7519,8 @@ declspecs_add_type (struct c_declspecs *specs, struct c_typespec spec)
}
if (!targetm.decimal_float_supported_p ())
error ("decimal floating point not supported for this target");
- if (pedantic)
- pedwarn ("ISO C does not support decimal floating point");
+ pedwarn (OPT_pedantic,
+ "ISO C does not support decimal floating point");
return specs;
case RID_FRACT:
case RID_ACCUM:
@@ -7585,8 +7540,8 @@ declspecs_add_type (struct c_declspecs *specs, struct c_typespec spec)
}
if (!targetm.fixed_point_supported_p ())
error ("fixed-point types not supported for this target");
- if (pedantic)
- pedwarn ("ISO C does not support fixed-point types");
+ pedwarn (OPT_pedantic,
+ "ISO C does not support fixed-point types");
return specs;
default:
/* ObjC reserved word "id", handled below. */
@@ -7772,9 +7727,9 @@ finish_declspecs (struct c_declspecs *specs)
else if (specs->complex_p)
{
specs->typespec_word = cts_double;
- if (pedantic)
- pedwarn ("ISO C does not support plain %<complex%> meaning "
- "%<double complex%>");
+ pedwarn (OPT_pedantic,
+ "ISO C does not support plain %<complex%> meaning "
+ "%<double complex%>");
}
else
{
@@ -7817,8 +7772,8 @@ finish_declspecs (struct c_declspecs *specs)
specs->type = char_type_node;
if (specs->complex_p)
{
- if (pedantic)
- pedwarn ("ISO C does not support complex integer types");
+ pedwarn (OPT_pedantic,
+ "ISO C does not support complex integer types");
specs->type = build_complex_type (specs->type);
}
break;
@@ -7843,8 +7798,8 @@ finish_declspecs (struct c_declspecs *specs)
: integer_type_node);
if (specs->complex_p)
{
- if (pedantic)
- pedwarn ("ISO C does not support complex integer types");
+ pedwarn (OPT_pedantic,
+ "ISO C does not support complex integer types");
specs->type = build_complex_type (specs->type);
}
break;
@@ -7994,7 +7949,7 @@ c_write_global_declarations_1 (tree globals)
&& !TREE_PUBLIC (decl)
&& C_DECL_USED (decl))
{
- pedwarn ("%q+F used but never defined", decl);
+ pedwarn (0, "%q+F used but never defined", decl);
TREE_NO_WARNING (decl) = 1;
}
diff --git a/gcc/c-errors.c b/gcc/c-errors.c
index dc47b764f39..999743259f1 100644
--- a/gcc/c-errors.c
+++ b/gcc/c-errors.c
@@ -31,14 +31,15 @@ along with GCC; see the file COPYING3. If not see
/* Issue an ISO C99 pedantic warning MSGID. */
void
-pedwarn_c99 (const char *gmsgid, ...)
+pedwarn_c99 (int opt, const char *gmsgid, ...)
{
diagnostic_info diagnostic;
va_list ap;
va_start (ap, gmsgid);
diagnostic_set_info (&diagnostic, gmsgid, &ap, input_location,
- flag_isoc99 ? pedantic_warning_kind () : DK_WARNING);
+ flag_isoc99 ? DK_PEDWARN : DK_WARNING);
+ diagnostic.option_index = opt;
report_diagnostic (&diagnostic);
va_end (ap);
}
@@ -49,14 +50,15 @@ pedwarn_c99 (const char *gmsgid, ...)
(There is no flag_c90.) */
void
-pedwarn_c90 (const char *gmsgid, ...)
+pedwarn_c90 (int opt, const char *gmsgid, ...)
{
diagnostic_info diagnostic;
va_list ap;
va_start (ap, gmsgid);
diagnostic_set_info (&diagnostic, gmsgid, &ap, input_location,
- flag_isoc99 ? DK_WARNING : pedantic_warning_kind ());
+ flag_isoc99 ? DK_WARNING : DK_PEDWARN);
+ diagnostic.option_index = opt;
report_diagnostic (&diagnostic);
va_end (ap);
}
diff --git a/gcc/c-gimplify.c b/gcc/c-gimplify.c
index 12292a7e591..342848acd29 100644
--- a/gcc/c-gimplify.c
+++ b/gcc/c-gimplify.c
@@ -31,7 +31,7 @@ along with GCC; see the file COPYING3. If not see
#include "varray.h"
#include "c-tree.h"
#include "c-common.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "hard-reg-set.h"
#include "basic-block.h"
#include "tree-flow.h"
@@ -104,7 +104,6 @@ c_genericize (tree fndecl)
/* Go ahead and gimplify for now. */
gimplify_function_tree (fndecl);
- /* Dump the genericized tree IR. */
dump_function (TDI_generic, fndecl);
/* Genericize all nested functions now. We do things in this order so
@@ -118,14 +117,16 @@ c_genericize (tree fndecl)
static void
add_block_to_enclosing (tree block)
{
+ unsigned i;
tree enclosing;
+ gimple bind;
+ VEC(gimple, heap) *stack = gimple_bind_expr_stack ();
- for (enclosing = gimple_current_bind_expr ();
- enclosing; enclosing = TREE_CHAIN (enclosing))
- if (BIND_EXPR_BLOCK (enclosing))
+ for (i = 0; VEC_iterate (gimple, stack, i, bind); i++)
+ if (gimple_bind_block (bind))
break;
- enclosing = BIND_EXPR_BLOCK (enclosing);
+ enclosing = gimple_bind_block (bind);
BLOCK_SUBBLOCKS (enclosing) = chainon (BLOCK_SUBBLOCKS (enclosing), block);
}
@@ -178,7 +179,7 @@ c_build_bind_expr (tree block, tree body)
decl instead. */
static enum gimplify_status
-gimplify_compound_literal_expr (tree *expr_p, tree *pre_p)
+gimplify_compound_literal_expr (tree *expr_p, gimple_seq *pre_p)
{
tree decl_s = COMPOUND_LITERAL_EXPR_DECL_STMT (*expr_p);
tree decl = DECL_EXPR_DECL (decl_s);
@@ -249,10 +250,12 @@ optimize_compound_literals_in_ctor (tree orig_ctor)
return ctor;
}
-/* Do C-specific gimplification. Args are as for gimplify_expr. */
+/* Do C-specific gimplification on *EXPR_P. PRE_P and POST_P are as in
+ gimplify_expr. */
int
-c_gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p ATTRIBUTE_UNUSED)
+c_gimplify_expr (tree *expr_p, gimple_seq *pre_p,
+ gimple_seq *post_p ATTRIBUTE_UNUSED)
{
enum tree_code code = TREE_CODE (*expr_p);
diff --git a/gcc/c-lex.c b/gcc/c-lex.c
index 3c2c225c59f..e49e3319c3f 100644
--- a/gcc/c-lex.c
+++ b/gcc/c-lex.c
@@ -239,7 +239,6 @@ fe_file_change (const struct line_map *new_map)
}
update_header_times (new_map->to_file);
- in_system_header = new_map->sysp != 0;
input_location = new_map->start_location;
}
@@ -588,8 +587,8 @@ interpret_integer (const cpp_token *token, unsigned int flags)
if (itk > itk_unsigned_long
&& (flags & CPP_N_WIDTH) != CPP_N_LARGE
&& !in_system_header && !flag_isoc99)
- pedwarn ("integer constant is too large for %qs type",
- (flags & CPP_N_UNSIGNED) ? "unsigned long" : "long");
+ pedwarn (0, "integer constant is too large for %qs type",
+ (flags & CPP_N_UNSIGNED) ? "unsigned long" : "long");
value = build_int_cst_wide (type, integer.low, integer.high);
@@ -642,8 +641,8 @@ interpret_float (const cpp_token *token, unsigned int flags)
return error_mark_node;
}
- else if (pedantic)
- pedwarn ("non-standard suffix on floating constant");
+ else
+ pedwarn (OPT_pedantic, "non-standard suffix on floating constant");
type = c_common_type_for_mode (mode, 0);
gcc_assert (type);
@@ -685,7 +684,7 @@ interpret_float (const cpp_token *token, unsigned int flags)
if (REAL_VALUE_ISINF (real))
{
if (!MODE_HAS_INFINITIES (TYPE_MODE (type)))
- pedwarn ("floating constant exceeds range of %qT", type);
+ pedwarn (0, "floating constant exceeds range of %qT", type);
else
warning (OPT_Woverflow, "floating constant exceeds range of %qT", type);
}
diff --git a/gcc/c-omp.c b/gcc/c-omp.c
index 1da71d27b9c..7da659cc9fb 100644
--- a/gcc/c-omp.c
+++ b/gcc/c-omp.c
@@ -29,7 +29,7 @@ along with GCC; see the file COPYING3. If not see
#include "function.h"
#include "c-common.h"
#include "toplev.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "bitmap.h"
#include "langhooks.h"
diff --git a/gcc/c-opts.c b/gcc/c-opts.c
index 33d0e6bed26..300bf14f503 100644
--- a/gcc/c-opts.c
+++ b/gcc/c-opts.c
@@ -376,7 +376,7 @@ c_common_handle_option (size_t scode, const char *arg, int value)
break;
case OPT_Wall:
- set_Wunused (value);
+ warn_unused = value;
set_Wformat (value);
set_Wimplicit (value);
warn_char_subscripts = value;
@@ -404,9 +404,12 @@ c_common_handle_option (size_t scode, const char *arg, int value)
warn_uninitialized = (value ? 2 : 0);
if (!c_dialect_cxx ())
- /* We set this to 2 here, but 1 in -Wmain, so -ffreestanding
- can turn it off only if it's not explicit. */
- warn_main = value * 2;
+ {
+ /* We set this to 2 here, but 1 in -Wmain, so -ffreestanding
+ can turn it off only if it's not explicit. */
+ if (warn_main == -1)
+ warn_main = (value ? 2 : 0);
+ }
else
{
/* C++-specific warnings. */
@@ -467,13 +470,6 @@ c_common_handle_option (size_t scode, const char *arg, int value)
cpp_opts->warn_invalid_pch = value;
break;
- case OPT_Wmain:
- if (value)
- warn_main = 1;
- else
- warn_main = -1;
- break;
-
case OPT_Wmissing_include_dirs:
cpp_opts->warn_missing_include_dirs = value;
break;
@@ -615,9 +611,6 @@ c_common_handle_option (size_t scode, const char *arg, int value)
case OPT_fhosted:
flag_hosted = value;
flag_no_builtin = !value;
- /* warn_main will be 2 if set by -Wall, 1 if set by -Wmain */
- if (!value && warn_main == 2)
- warn_main = 0;
break;
case OPT_fshort_double:
@@ -907,6 +900,8 @@ c_common_handle_option (size_t scode, const char *arg, int value)
warn_pointer_sign = 1;
if (warn_overlength_strings == -1)
warn_overlength_strings = 1;
+ if (warn_main == -1)
+ warn_main = 2;
break;
case OPT_print_objc_runtime_info:
@@ -1018,14 +1013,6 @@ c_common_post_options (const char **pfilename)
C_COMMON_OVERRIDE_OPTIONS;
#endif
- flag_inline_trees = 1;
-
- /* Use tree inlining. */
- if (!flag_no_inline)
- flag_no_inline = 1;
- if (flag_inline_functions)
- flag_inline_trees = 2;
-
/* By default we use C99 inline semantics in GNU99 or C99 mode. C99
inline semantics are not supported in GNU89 or C89 mode. */
if (flag_gnu89_inline == -1)
@@ -1033,14 +1020,6 @@ c_common_post_options (const char **pfilename)
else if (!flag_gnu89_inline && !flag_isoc99)
error ("-fno-gnu89-inline is only supported in GNU99 or C99 mode");
- /* If we are given more than one input file, we must use
- unit-at-a-time mode. */
- if (num_in_fnames > 1)
- flag_unit_at_a_time = 1;
-
- if (pch_file && !flag_unit_at_a_time)
- sorry ("Precompiled headers require -funit-at-a-time");
-
/* Default to ObjC sjlj exception handling if NeXT runtime. */
if (flag_objc_sjlj_exceptions < 0)
flag_objc_sjlj_exceptions = flag_next_runtime;
@@ -1087,17 +1066,14 @@ c_common_post_options (const char **pfilename)
if (warn_overlength_strings == -1 || c_dialect_cxx ())
warn_overlength_strings = 0;
- /* Adjust various flags for C++ based on command-line settings. */
- if (c_dialect_cxx ())
- {
- if (!flag_no_inline)
- {
- flag_inline_trees = 1;
- flag_no_inline = 1;
- }
- if (flag_inline_functions)
- flag_inline_trees = 2;
- }
+ /* Wmain is enabled by default in C++ but not in C. */
+ /* Wmain is disabled by default for -ffreestanding (!flag_hosted),
+ even if -Wall was given (warn_main will be 2 if set by -Wall, 1
+ if set by -Wmain). */
+ if (warn_main == -1)
+ warn_main = (c_dialect_cxx () && flag_hosted) ? 1 : 0;
+ else if (warn_main == 2)
+ warn_main = flag_hosted ? 1 : 0;
/* In C, -Wconversion enables -Wsign-conversion (unless disabled
through -Wno-sign-conversion). While in C++,
diff --git a/gcc/c-parser.c b/gcc/c-parser.c
index aba007c9bc2..1ea9d07fcdf 100644
--- a/gcc/c-parser.c
+++ b/gcc/c-parser.c
@@ -149,8 +149,6 @@ typedef struct c_token GTY (())
/* If this token is a CPP_PRAGMA, this indicates the pragma that
was seen. Otherwise it is PRAGMA_NONE. */
ENUM_BITFIELD (pragma_kind) pragma_kind : 7;
- /* True if this token is from a system header. */
- BOOL_BITFIELD in_system_header : 1;
/* The value associated with this token, if any. */
tree value;
/* The location at which this token was found. */
@@ -206,7 +204,6 @@ c_lex_one_token (c_parser *parser, c_token *token)
token->id_kind = C_ID_NONE;
token->keyword = RID_MAX;
token->pragma_kind = PRAGMA_NONE;
- token->in_system_header = in_system_header;
switch (token->type)
{
@@ -244,8 +241,6 @@ c_lex_one_token (c_parser *parser, c_token *token)
}
else
{
- /* Return the canonical spelling for this keyword. */
- token->value = ridpointers[(int) rid_code];
token->type = CPP_KEYWORD;
token->keyword = rid_code;
break;
@@ -545,7 +540,6 @@ c_parser_set_source_position_from_token (c_token *token)
if (token->type != CPP_EOF)
{
input_location = token->location;
- in_system_header = token->in_system_header;
}
}
@@ -964,9 +958,8 @@ c_parser_translation_unit (c_parser *parser)
{
if (c_parser_next_token_is (parser, CPP_EOF))
{
- if (pedantic)
- pedwarn ("%HISO C forbids an empty translation unit",
- &c_parser_peek_token (parser)->location);
+ pedwarn (OPT_pedantic, "%HISO C forbids an empty translation unit",
+ &c_parser_peek_token (parser)->location);
}
else
{
@@ -1050,9 +1043,9 @@ c_parser_external_declaration (c_parser *parser)
}
break;
case CPP_SEMICOLON:
- if (pedantic)
- pedwarn ("%HISO C does not allow extra %<;%> outside of a function",
- &c_parser_peek_token (parser)->location);
+ pedwarn (OPT_pedantic,
+ "%HISO C does not allow extra %<;%> outside of a function",
+ &c_parser_peek_token (parser)->location);
c_parser_consume_token (parser);
break;
case CPP_PRAGMA:
@@ -1166,7 +1159,7 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok, bool empty_ok,
else
{
shadow_tag_warned (specs, 1);
- pedwarn ("%Hempty declaration", &here);
+ pedwarn (0, "%Hempty declaration", &here);
}
c_parser_consume_token (parser);
return;
@@ -1202,8 +1195,8 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok, bool empty_ok,
if (!diagnosed_no_specs && !specs->declspecs_seen_p)
{
diagnosed_no_specs = true;
- pedwarn ("%Hdata definition has no type or storage class",
- &here);
+ pedwarn (0, "%Hdata definition has no type or storage class",
+ &here);
}
/* Having seen a data definition, there cannot now be a
function definition. */
@@ -1272,8 +1265,7 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok, bool empty_ok,
/* Function definition (nested or otherwise). */
if (nested)
{
- if (pedantic)
- pedwarn ("%HISO C forbids nested functions", &here);
+ pedwarn (OPT_pedantic, "%HISO C forbids nested functions", &here);
c_push_function_context ();
}
if (!start_function (specs, declarator, all_prefix_attrs))
@@ -1636,6 +1628,7 @@ c_parser_enum_specifier (c_parser *parser)
bool seen_comma;
c_token *token;
location_t comma_loc;
+ location_t value_loc;
if (c_parser_next_token_is_not (parser, CPP_NAME))
{
c_parser_error (parser, "expected identifier");
@@ -1647,15 +1640,19 @@ c_parser_enum_specifier (c_parser *parser)
enum_id = token->value;
/* Set the location in case we create a decl now. */
c_parser_set_source_position_from_token (token);
+ value_loc = token->location;
c_parser_consume_token (parser);
if (c_parser_next_token_is (parser, CPP_EQ))
{
c_parser_consume_token (parser);
+ value_loc = c_parser_peek_token (parser)->location;
+ /* This may call cb_line_change and alter the input_location. */
enum_value = c_parser_expr_no_commas (parser, NULL).value;
}
else
enum_value = NULL_TREE;
- enum_decl = build_enumerator (&the_enum, enum_id, enum_value);
+ enum_decl = build_enumerator (&the_enum, enum_id, enum_value,
+ value_loc);
TREE_CHAIN (enum_decl) = values;
values = enum_decl;
seen_comma = false;
@@ -1667,8 +1664,9 @@ c_parser_enum_specifier (c_parser *parser)
}
if (c_parser_next_token_is (parser, CPP_CLOSE_BRACE))
{
- if (seen_comma && pedantic && !flag_isoc99)
- pedwarn ("%Hcomma at end of enumerator list", &comma_loc);
+ if (seen_comma && !flag_isoc99)
+ pedwarn (OPT_pedantic, "%Hcomma at end of enumerator list",
+ &comma_loc);
c_parser_consume_token (parser);
break;
}
@@ -1699,7 +1697,8 @@ c_parser_enum_specifier (c_parser *parser)
if (pedantic && !COMPLETE_TYPE_P (ret.spec))
{
gcc_assert (ident);
- pedwarn ("%HISO C forbids forward references to %<enum%> types",
+ pedwarn (OPT_pedantic,
+ "%HISO C forbids forward references to %<enum%> types",
&ident_loc);
}
return ret;
@@ -1824,9 +1823,9 @@ c_parser_struct_or_union_specifier (c_parser *parser)
/* Parse any stray semicolon. */
if (c_parser_next_token_is (parser, CPP_SEMICOLON))
{
- if (pedantic)
- pedwarn ("%Hextra semicolon in struct or union specified",
- &c_parser_peek_token (parser)->location);
+ pedwarn (OPT_pedantic,
+ "%Hextra semicolon in struct or union specified",
+ &c_parser_peek_token (parser)->location);
c_parser_consume_token (parser);
continue;
}
@@ -1854,8 +1853,8 @@ c_parser_struct_or_union_specifier (c_parser *parser)
else
{
if (c_parser_next_token_is (parser, CPP_CLOSE_BRACE))
- pedwarn ("%Hno semicolon at end of struct or union",
- &c_parser_peek_token (parser)->location);
+ pedwarn (0, "%Hno semicolon at end of struct or union",
+ &c_parser_peek_token (parser)->location);
else
{
c_parser_error (parser, "expected %<;%>");
@@ -1946,9 +1945,9 @@ c_parser_struct_declaration (c_parser *parser)
tree ret;
if (!specs->type_seen_p)
{
- if (pedantic)
- pedwarn ("%HISO C forbids member declarations with no members",
- &decl_loc);
+ pedwarn (OPT_pedantic,
+ "%HISO C forbids member declarations with no members",
+ &decl_loc);
shadow_tag_warned (specs, pedantic);
ret = NULL_TREE;
}
@@ -3001,8 +3000,8 @@ c_parser_braced_init (c_parser *parser, tree type, bool nested_p)
really_start_incremental_init (type);
if (c_parser_next_token_is (parser, CPP_CLOSE_BRACE))
{
- if (pedantic)
- pedwarn ("%HISO C forbids empty initializer braces", &brace_loc);
+ pedwarn (OPT_pedantic, "%HISO C forbids empty initializer braces",
+ &brace_loc);
}
else
{
@@ -3046,12 +3045,10 @@ c_parser_initelt (c_parser *parser)
{
/* Old-style structure member designator. */
set_init_label (c_parser_peek_token (parser)->value);
- if (pedantic)
- {
- /* Use the colon as the error location. */
- pedwarn ("%Hobsolete use of designated initializer with %<:%>",
- &c_parser_peek_2nd_token (parser)->location);
- }
+ /* Use the colon as the error location. */
+ pedwarn (OPT_pedantic,
+ "%Hobsolete use of designated initializer with %<:%>",
+ &c_parser_peek_2nd_token (parser)->location);
c_parser_consume_token (parser);
c_parser_consume_token (parser);
}
@@ -3179,8 +3176,9 @@ c_parser_initelt (c_parser *parser)
{
c_parser_consume_token (parser);
set_init_index (first, second);
- if (pedantic && second)
- pedwarn ("%HISO C forbids specifying range of "
+ if (second)
+ pedwarn (OPT_pedantic,
+ "%HISO C forbids specifying range of "
"elements to initialize", &ellipsis_loc);
}
else
@@ -3192,8 +3190,9 @@ c_parser_initelt (c_parser *parser)
{
if (c_parser_next_token_is (parser, CPP_EQ))
{
- if (pedantic && !flag_isoc99)
- pedwarn ("%HISO C90 forbids specifying subobject "
+ if (!flag_isoc99)
+ pedwarn (OPT_pedantic,
+ "%HISO C90 forbids specifying subobject "
"to initialize", &des_loc);
c_parser_consume_token (parser);
}
@@ -3201,10 +3200,10 @@ c_parser_initelt (c_parser *parser)
{
if (des_seen == 1)
{
- if (pedantic)
- pedwarn ("%Hobsolete use of designated initializer "
- "without %<=%>",
- &c_parser_peek_token (parser)->location);
+ pedwarn (OPT_pedantic,
+ "%Hobsolete use of designated initializer "
+ "without %<=%>",
+ &c_parser_peek_token (parser)->location);
}
else
{
@@ -3355,8 +3354,7 @@ c_parser_compound_statement_nostart (c_parser *parser)
}
c_parser_skip_until_found (parser, CPP_SEMICOLON, "expected %<;%>");
}
- if (pedantic)
- pedwarn ("%HISO C forbids label declarations", &err_loc);
+ pedwarn (OPT_pedantic, "%HISO C forbids label declarations", &err_loc);
}
/* We must now have at least one statement, label or declaration. */
if (c_parser_next_token_is (parser, CPP_CLOSE_BRACE))
@@ -3386,10 +3384,11 @@ c_parser_compound_statement_nostart (c_parser *parser)
{
last_label = false;
c_parser_declaration_or_fndef (parser, true, true, true, true);
- if (last_stmt
- && ((pedantic && !flag_isoc99)
- || warn_declaration_after_statement))
- pedwarn_c90 ("%HISO C90 forbids mixed declarations and code",
+ if (last_stmt)
+ pedwarn_c90 ((pedantic && !flag_isoc99)
+ ? OPT_pedantic
+ : OPT_Wdeclaration_after_statement,
+ "%HISO C90 forbids mixed declarations and code",
&loc);
last_stmt = false;
}
@@ -3414,10 +3413,11 @@ c_parser_compound_statement_nostart (c_parser *parser)
/* Following the old parser, __extension__ does not
disable this diagnostic. */
restore_extension_diagnostics (ext);
- if (last_stmt
- && ((pedantic && !flag_isoc99)
- || warn_declaration_after_statement))
- pedwarn_c90 ("%HISO C90 forbids mixed declarations and code",
+ if (last_stmt)
+ pedwarn_c90 ((pedantic && !flag_isoc99)
+ ? OPT_pedantic
+ : OPT_Wdeclaration_after_statement,
+ "%HISO C90 forbids mixed declarations and code",
&loc);
last_stmt = false;
}
@@ -3794,6 +3794,23 @@ c_parser_statement_after_labels (c_parser *parser)
parser->in_if_block = in_if_block;
}
+/* Parse the condition from an if, do, while or for statements. */
+
+static tree
+c_parser_condition (c_parser *parser)
+{
+ location_t loc;
+ tree cond;
+ loc = c_parser_peek_token (parser)->location;
+ cond = c_objc_common_truthvalue_conversion
+ (c_parser_expression_conv (parser).value);
+ if (CAN_HAVE_LOCATION_P (cond))
+ SET_EXPR_LOCATION (cond, loc);
+ if (warn_sequence_point)
+ verify_sequence_points (cond);
+ return cond;
+}
+
/* Parse a parenthesized condition from an if, do or while statement.
condition:
@@ -3802,15 +3819,10 @@ c_parser_statement_after_labels (c_parser *parser)
static tree
c_parser_paren_condition (c_parser *parser)
{
- location_t loc;
tree cond;
if (!c_parser_require (parser, CPP_OPEN_PAREN, "expected %<(%>"))
return error_mark_node;
- loc = c_parser_peek_token (parser)->location;
- cond = c_objc_common_truthvalue_conversion
- (c_parser_expression_conv (parser).value);
- if (CAN_HAVE_LOCATION_P (cond))
- SET_EXPR_LOCATION (cond, loc);
+ cond = c_parser_condition (parser);
c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, "expected %<)%>");
return cond;
}
@@ -4076,7 +4088,6 @@ c_parser_for_statement (c_parser *parser)
c_parser_skip_until_found (parser, CPP_SEMICOLON, "expected %<;%>");
}
/* Parse the loop condition. */
- loc = c_parser_peek_token (parser)->location;
if (c_parser_next_token_is (parser, CPP_SEMICOLON))
{
c_parser_consume_token (parser);
@@ -4084,10 +4095,7 @@ c_parser_for_statement (c_parser *parser)
}
else
{
- tree ocond = c_parser_expression_conv (parser).value;
- cond = c_objc_common_truthvalue_conversion (ocond);
- if (CAN_HAVE_LOCATION_P (cond))
- SET_EXPR_LOCATION (cond, loc);
+ cond = c_parser_condition (parser);
c_parser_skip_until_found (parser, CPP_SEMICOLON, "expected %<;%>");
}
/* Parse the increment expression. */
@@ -4424,9 +4432,9 @@ c_parser_conditional_expression (c_parser *parser, struct c_expr *after)
c_parser_consume_token (parser);
if (c_parser_next_token_is (parser, CPP_COLON))
{
- if (pedantic)
- pedwarn ("%HISO C forbids omitting the middle term of a ?: expression",
- &c_parser_peek_token (parser)->location);
+ pedwarn (OPT_pedantic,
+ "%HISO C forbids omitting the middle term of a ?: expression",
+ &c_parser_peek_token (parser)->location);
/* Make sure first operand is calculated only once. */
exp1.value = save_expr (default_conversion (cond.value));
cond.value = c_objc_common_truthvalue_conversion (exp1.value);
@@ -5128,9 +5136,8 @@ c_parser_postfix_expression (c_parser *parser)
c_parser_compound_statement_nostart (parser);
c_parser_skip_until_found (parser, CPP_CLOSE_PAREN,
"expected %<)%>");
- if (pedantic)
- pedwarn ("%HISO C forbids braced-groups within expressions",
- &here);
+ pedwarn (OPT_pedantic,
+ "%HISO C forbids braced-groups within expressions", &here);
expr.value = c_finish_stmt_expr (stmt);
expr.original_code = ERROR_MARK;
}
@@ -5490,8 +5497,9 @@ c_parser_postfix_expression_after_paren_type (c_parser *parser,
finish_init ();
maybe_warn_string_init (type, init);
- if (pedantic && !flag_isoc99)
- pedwarn ("%HISO C90 forbids compound literals", &start_loc);
+ if (!flag_isoc99)
+ pedwarn (OPT_pedantic, "%HISO C90 forbids compound literals",
+ &start_loc);
expr.value = build_compound_literal (type, init.value);
expr.original_code = ERROR_MARK;
return c_parser_postfix_expression_after_primary (parser, expr);
@@ -5792,9 +5800,9 @@ c_parser_objc_class_instance_variables (c_parser *parser)
/* Parse any stray semicolon. */
if (c_parser_next_token_is (parser, CPP_SEMICOLON))
{
- if (pedantic)
- pedwarn ("%Hextra semicolon in struct or union specified",
- &c_parser_peek_token (parser)->location);
+ pedwarn (OPT_pedantic,
+ "%Hextra semicolon in struct or union specified",
+ &c_parser_peek_token (parser)->location);
c_parser_consume_token (parser);
continue;
}
@@ -6010,9 +6018,9 @@ c_parser_objc_method_definition (c_parser *parser)
if (c_parser_next_token_is (parser, CPP_SEMICOLON))
{
c_parser_consume_token (parser);
- if (pedantic)
- pedwarn ("%Hextra semicolon in method definition specified",
- &c_parser_peek_token (parser)->location);
+ pedwarn (OPT_pedantic,
+ "%Hextra semicolon in method definition specified",
+ &c_parser_peek_token (parser)->location);
}
if (!c_parser_next_token_is (parser, CPP_OPEN_BRACE))
{
@@ -6048,10 +6056,9 @@ c_parser_objc_methodprotolist (c_parser *parser)
switch (c_parser_peek_token (parser)->type)
{
case CPP_SEMICOLON:
- if (pedantic)
- pedwarn ("%HISO C does not allow extra %<;%> "
- "outside of a function",
- &c_parser_peek_token (parser)->location);
+ pedwarn (OPT_pedantic, "%HISO C does not allow extra %<;%> "
+ "outside of a function",
+ &c_parser_peek_token (parser)->location);
c_parser_consume_token (parser);
break;
case CPP_PLUS:
diff --git a/gcc/c-pch.c b/gcc/c-pch.c
index 0da17f7f24b..520b866e30d 100644
--- a/gcc/c-pch.c
+++ b/gcc/c-pch.c
@@ -45,7 +45,6 @@ static const struct c_pch_matching
const char *flag_name;
} pch_matching[] = {
{ &flag_exceptions, "-fexceptions" },
- { &flag_unit_at_a_time, "-funit-at-a-time" }
};
enum {
@@ -93,10 +92,10 @@ static const char *
get_ident (void)
{
static char result[IDENT_LENGTH];
- static const char template[IDENT_LENGTH] = "gpch.013";
+ static const char templ[IDENT_LENGTH] = "gpch.013";
static const char c_language_chars[] = "Co+O";
- memcpy (result, template, IDENT_LENGTH);
+ memcpy (result, templ, IDENT_LENGTH);
result[4] = c_language_chars[c_language];
return result;
@@ -368,6 +367,7 @@ c_common_read_pch (cpp_reader *pfile, const char *name,
struct c_pch_header h;
struct save_macro_data *smd;
expanded_location saved_loc;
+ bool saved_trace_includes;
f = fdopen (fd, "rb");
if (f == NULL)
@@ -413,6 +413,7 @@ c_common_read_pch (cpp_reader *pfile, const char *name,
/* Save the location and then restore it after reading the PCH. */
saved_loc = expand_location (line_table->highest_line);
+ saved_trace_includes = line_table->trace_includes;
cpp_prepare_state (pfile, &smd);
@@ -426,6 +427,7 @@ c_common_read_pch (cpp_reader *pfile, const char *name,
fclose (f);
+ line_table->trace_includes = saved_trace_includes;
cpp_set_line_map (pfile, line_table);
linemap_add (line_table, LC_RENAME, 0, saved_loc.file, saved_loc.line);
diff --git a/gcc/c-pragma.c b/gcc/c-pragma.c
index e7bb928c8a9..b2bbfae8276 100644
--- a/gcc/c-pragma.c
+++ b/gcc/c-pragma.c
@@ -866,6 +866,346 @@ handle_pragma_diagnostic(cpp_reader *ARG_UNUSED(dummy))
GCC_BAD ("unknown option after %<#pragma GCC diagnostic%> kind");
}
+/* Stack of the #pragma GCC options created with #pragma GCC option push. */
+static GTY(()) VEC(tree,gc) *option_stack;
+
+/* Parse #pragma GCC option (xxx) to set target specific options. */
+static void
+handle_pragma_option(cpp_reader *ARG_UNUSED(dummy))
+{
+ enum cpp_ttype token;
+ const char *name;
+ tree x;
+ bool close_paren_needed_p = false;
+
+ if (cfun)
+ {
+ error ("#pragma GCC option is not allowed inside functions");
+ return;
+ }
+
+ if (!targetm.target_option.pragma_parse)
+ {
+ error ("#pragma GCC option is not supported for this system");
+ return;
+ }
+
+ token = pragma_lex (&x);
+ if (token == CPP_OPEN_PAREN)
+ {
+ close_paren_needed_p = true;
+ token = pragma_lex (&x);
+ }
+
+ if (token == CPP_NAME)
+ {
+ bool call_pragma_parse_p = false;
+ bool ok_p;
+
+ name = IDENTIFIER_POINTER (x);
+ if (strcmp (name, "reset") == 0)
+ {
+ current_option_pragma = NULL_TREE;
+ call_pragma_parse_p = true;
+ }
+
+ else if (strcmp (name, "push") == 0)
+ VEC_safe_push (tree, gc, option_stack,
+ copy_list (current_option_pragma));
+
+ else if (strcmp (name, "pop") == 0)
+ {
+ int len = VEC_length (tree, option_stack);
+ if (len == 0)
+ {
+ GCC_BAD ("%<#pragma GCC option pop%> without a %<#pragma GCC "
+ "option push%>");
+ return;
+ }
+ else
+ {
+ VEC_truncate (tree, option_stack, len-1);
+ current_option_pragma = ((len > 1)
+ ? VEC_last (tree, option_stack)
+ : NULL_TREE);
+
+ call_pragma_parse_p = true;
+ }
+ }
+
+ else
+ {
+ GCC_BAD ("%<#pragma GCC option%> is not a string or "
+ "push/pop/reset");
+ return;
+ }
+
+ token = pragma_lex (&x);
+ if (close_paren_needed_p)
+ {
+ if (token == CPP_CLOSE_PAREN)
+ token = pragma_lex (&x);
+ else
+ GCC_BAD ("%<#pragma GCC option ([push|pop|reset])%> does not "
+ "have a final %<)%>.");
+ }
+
+ if (token != CPP_EOF)
+ {
+ GCC_BAD ("%<#pragma GCC option [push|pop|reset]%> is badly "
+ "formed");
+ return;
+ }
+
+ /* See if we need to call the pragma_parse hook. This must occur at the
+ end after processing all of the tokens, or we may get spurious errors
+ when we define or undef macros. */
+ ok_p = targetm.target_option.pragma_parse (current_option_pragma);
+ gcc_assert (ok_p);
+ }
+
+ else if (token != CPP_STRING)
+ {
+ GCC_BAD ("%<#pragma GCC option%> is not a string or push/pop/reset");
+ return;
+ }
+
+ /* Strings are user options. */
+ else
+ {
+ tree args = NULL_TREE;
+
+ do
+ {
+ /* Build up the strings now as a tree linked list. Skip empty
+ strings. */
+ if (TREE_STRING_LENGTH (x) > 0)
+ args = tree_cons (NULL_TREE, x, args);
+
+ token = pragma_lex (&x);
+ while (token == CPP_COMMA)
+ token = pragma_lex (&x);
+ }
+ while (token == CPP_STRING);
+
+ if (close_paren_needed_p)
+ {
+ if (token == CPP_CLOSE_PAREN)
+ token = pragma_lex (&x);
+ else
+ GCC_BAD ("%<#pragma GCC option (string [,string]...)%> does "
+ "not have a final %<)%>.");
+ }
+
+ if (token != CPP_EOF)
+ {
+ error ("#pragma GCC option string... is badly formed");
+ return;
+ }
+
+ /* put arguments in the order the user typed them. */
+ args = nreverse (args);
+
+ if (targetm.target_option.pragma_parse (args))
+ current_option_pragma = args;
+ }
+}
+
+/* Stack of the #pragma GCC optimize options created with #pragma GCC optimize
+ push. */
+static GTY(()) VEC(tree,gc) *optimize_stack;
+
+/* Handle #pragma GCC optimize to set optimization options. */
+static void
+handle_pragma_optimize(cpp_reader *ARG_UNUSED(dummy))
+{
+ enum cpp_ttype token;
+ const char *name;
+ tree x;
+ bool close_paren_needed_p = false;
+ tree optimization_previous_node = optimization_current_node;
+
+ if (cfun)
+ {
+ error ("#pragma GCC optimize is not allowed inside functions");
+ return;
+ }
+
+ token = pragma_lex (&x);
+ if (token == CPP_OPEN_PAREN)
+ {
+ close_paren_needed_p = true;
+ token = pragma_lex (&x);
+ }
+
+ if (token == CPP_NAME)
+ {
+ bool call_opt_p = false;
+
+ name = IDENTIFIER_POINTER (x);
+ if (strcmp (name, "reset") == 0)
+ {
+ struct cl_optimization *def
+ = TREE_OPTIMIZATION (optimization_default_node);
+ current_optimize_pragma = NULL_TREE;
+ optimization_current_node = optimization_default_node;
+ cl_optimization_restore (def);
+ call_opt_p = true;
+ }
+
+ else if (strcmp (name, "push") == 0)
+ VEC_safe_push (tree, gc, optimize_stack, current_optimize_pragma);
+
+ else if (strcmp (name, "pop") == 0)
+ {
+ int len = VEC_length (tree, optimize_stack);
+ if (len == 0)
+ {
+ GCC_BAD ("%<#pragma GCC optimize pop%> without a %<#pragma "
+ "GCC optimize push%>");
+ return;
+ }
+ else
+ {
+ VEC_truncate (tree, optimize_stack, len-1);
+ current_optimize_pragma
+ = ((len > 1)
+ ? VEC_last (tree, optimize_stack)
+ : NULL_TREE);
+
+ call_opt_p = true;
+ if (current_optimize_pragma)
+ {
+ bool ok_p
+ = parse_optimize_options (current_optimize_pragma, false);
+ gcc_assert (ok_p); /* should be parsed previously. */
+ optimization_current_node = build_optimization_node ();
+ }
+ else
+ {
+ struct cl_optimization *opt
+ = TREE_OPTIMIZATION (optimization_default_node);
+ optimization_current_node = optimization_default_node;
+ cl_optimization_restore (opt);
+ }
+ }
+ }
+
+ else
+ {
+ GCC_BAD ("%<#pragma GCC optimize%> is not a string or "
+ "push/pop/reset");
+ return;
+ }
+
+ token = pragma_lex (&x);
+ if (close_paren_needed_p)
+ {
+ if (token == CPP_CLOSE_PAREN)
+ token = pragma_lex (&x);
+ else
+ GCC_BAD ("%<#pragma GCC optimize ([push|pop|reset])%> does not "
+ "have a final %<)%>.");
+ }
+
+ if (token != CPP_EOF)
+ {
+ GCC_BAD ("%<#pragma GCC optimize [push|pop|reset]%> is badly "
+ "formed");
+ return;
+ }
+
+ if (call_opt_p &&
+ (optimization_previous_node != optimization_current_node))
+ c_cpp_builtins_optimize_pragma (parse_in,
+ optimization_previous_node,
+ optimization_current_node);
+
+ }
+
+ else if (token != CPP_STRING && token != CPP_NUMBER)
+ {
+ GCC_BAD ("%<#pragma GCC optimize%> is not a string, number, or "
+ "push/pop/reset");
+ return;
+ }
+
+ /* Strings/numbers are user options. */
+ else
+ {
+ tree args = NULL_TREE;
+
+ do
+ {
+ /* Build up the numbers/strings now as a list. */
+ if (token != CPP_STRING || TREE_STRING_LENGTH (x) > 0)
+ args = tree_cons (NULL_TREE, x, args);
+
+ token = pragma_lex (&x);
+ while (token == CPP_COMMA)
+ token = pragma_lex (&x);
+ }
+ while (token == CPP_STRING || token == CPP_NUMBER);
+
+ if (close_paren_needed_p)
+ {
+ if (token == CPP_CLOSE_PAREN)
+ token = pragma_lex (&x);
+ else
+ GCC_BAD ("%<#pragma GCC optimize (string [,string]...)%> does "
+ "not have a final %<)%>.");
+ }
+
+ if (token != CPP_EOF)
+ {
+ error ("#pragma GCC optimize string... is badly formed");
+ return;
+ }
+
+ /* put arguments in the order the user typed them. */
+ args = nreverse (args);
+
+ parse_optimize_options (args, false);
+ optimization_current_node = build_optimization_node ();
+ c_cpp_builtins_optimize_pragma (parse_in,
+ optimization_previous_node,
+ optimization_current_node);
+ }
+}
+
+/* Print a plain user-specified message. */
+
+static void
+handle_pragma_message (cpp_reader *ARG_UNUSED(dummy))
+{
+ enum cpp_ttype token;
+ tree x, message = 0;
+
+ token = pragma_lex (&x);
+ if (token == CPP_OPEN_PAREN)
+ {
+ token = pragma_lex (&x);
+ if (token == CPP_STRING)
+ message = x;
+ else
+ GCC_BAD ("expected a string after %<#pragma message%>");
+ if (pragma_lex (&x) != CPP_CLOSE_PAREN)
+ GCC_BAD ("malformed %<#pragma message%>, ignored");
+ }
+ else if (token == CPP_STRING)
+ message = x;
+ else
+ GCC_BAD ("expected a string after %<#pragma message%>");
+
+ gcc_assert (message);
+
+ if (pragma_lex (&x) != CPP_EOF)
+ warning (OPT_Wpragmas, "junk at end of %<#pragma message%>");
+
+ if (TREE_STRING_LENGTH (message) > 1)
+ inform ("#pragma message: %s", TREE_STRING_POINTER (message));
+}
+
/* A vector of registered pragma callbacks. */
DEF_VEC_O (pragma_handler);
@@ -1028,10 +1368,14 @@ init_pragma (void)
#endif
c_register_pragma ("GCC", "diagnostic", handle_pragma_diagnostic);
+ c_register_pragma ("GCC", "option", handle_pragma_option);
+ c_register_pragma ("GCC", "optimize", handle_pragma_optimize);
c_register_pragma_with_expansion (0, "redefine_extname", handle_pragma_redefine_extname);
c_register_pragma (0, "extern_prefix", handle_pragma_extern_prefix);
+ c_register_pragma_with_expansion (0, "message", handle_pragma_message);
+
#ifdef REGISTER_TARGET_PRAGMAS
REGISTER_TARGET_PRAGMAS ();
#endif
diff --git a/gcc/c-pretty-print.c b/gcc/c-pretty-print.c
index 4386c392c9f..67a466ba749 100644
--- a/gcc/c-pretty-print.c
+++ b/gcc/c-pretty-print.c
@@ -1852,14 +1852,13 @@ static void
pp_c_assignment_expression (c_pretty_printer *pp, tree e)
{
if (TREE_CODE (e) == MODIFY_EXPR
- || TREE_CODE (e) == GIMPLE_MODIFY_STMT
|| TREE_CODE (e) == INIT_EXPR)
{
- pp_c_unary_expression (pp, GENERIC_TREE_OPERAND (e, 0));
+ pp_c_unary_expression (pp, TREE_OPERAND (e, 0));
pp_c_whitespace (pp);
pp_equal (pp);
pp_space (pp);
- pp_c_expression (pp, GENERIC_TREE_OPERAND (e, 1));
+ pp_c_expression (pp, TREE_OPERAND (e, 1));
}
else
pp_c_conditional_expression (pp, e);
@@ -2007,7 +2006,6 @@ pp_c_expression (c_pretty_printer *pp, tree e)
break;
case MODIFY_EXPR:
- case GIMPLE_MODIFY_STMT:
case INIT_EXPR:
pp_assignment_expression (pp, e);
break;
diff --git a/gcc/c-semantics.c b/gcc/c-semantics.c
index c7933beea1b..62faee54ea8 100644
--- a/gcc/c-semantics.c
+++ b/gcc/c-semantics.c
@@ -43,7 +43,8 @@ along with GCC; see the file COPYING3. If not see
#include "timevar.h"
#include "predict.h"
#include "tree-inline.h"
-#include "tree-gimple.h"
+#include "gimple.h"
+#include "tree-iterator.h"
#include "langhooks.h"
/* Create an empty statement tree rooted at T. */
diff --git a/gcc/c-tree.h b/gcc/c-tree.h
index 14df0444377..fc76ee32b35 100644
--- a/gcc/c-tree.h
+++ b/gcc/c-tree.h
@@ -462,7 +462,7 @@ extern void c_print_identifier (FILE *, tree, int);
extern int quals_from_declspecs (const struct c_declspecs *);
extern struct c_declarator *build_array_declarator (tree, struct c_declspecs *,
bool, bool);
-extern tree build_enumerator (struct c_enum_contents *, tree, tree);
+extern tree build_enumerator (struct c_enum_contents *, tree, tree, location_t);
extern tree check_for_loop_decls (void);
extern void mark_forward_parm_decls (void);
extern void declare_parm_level (void);
@@ -563,7 +563,7 @@ extern tree c_cast_expr (struct c_type_name *, tree);
extern tree build_c_cast (tree, tree);
extern void store_init_value (tree, tree);
extern void error_init (const char *);
-extern void pedwarn_init (const char *);
+extern void pedwarn_init (int opt, const char *);
extern void maybe_warn_string_init (tree, struct c_expr);
extern void start_init (tree, tree, int);
extern void finish_init (void);
@@ -640,7 +640,7 @@ extern void c_write_global_declarations (void);
#define ATTRIBUTE_GCC_CDIAG(m, n) ATTRIBUTE_NONNULL(m)
#endif
-extern void pedwarn_c90 (const char *, ...) ATTRIBUTE_GCC_CDIAG(1,2);
-extern void pedwarn_c99 (const char *, ...) ATTRIBUTE_GCC_CDIAG(1,2);
+extern void pedwarn_c90 (int opt, const char *, ...) ATTRIBUTE_GCC_CDIAG(2,3);
+extern void pedwarn_c99 (int opt, const char *, ...) ATTRIBUTE_GCC_CDIAG(2,3);
#endif /* ! GCC_C_TREE_H */
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index 6b7594e6a26..7646272dbd1 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -42,7 +42,7 @@ along with GCC; see the file COPYING3. If not see
#include "ggc.h"
#include "target.h"
#include "tree-iterator.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "tree-flow.h"
/* Possible cases of implicit bad conversions. Used to select
@@ -470,8 +470,8 @@ composite_type (tree t1, tree t2)
{
TREE_VALUE (n) = composite_type (TREE_TYPE (memb),
TREE_VALUE (p2));
- if (pedantic)
- pedwarn ("function types not truly compatible in ISO C");
+ pedwarn (OPT_pedantic,
+ "function types not truly compatible in ISO C");
goto parm_done;
}
}
@@ -495,8 +495,8 @@ composite_type (tree t1, tree t2)
{
TREE_VALUE (n) = composite_type (TREE_TYPE (memb),
TREE_VALUE (p1));
- if (pedantic)
- pedwarn ("function types not truly compatible in ISO C");
+ pedwarn (OPT_pedantic,
+ "function types not truly compatible in ISO C");
goto parm_done;
}
}
@@ -1039,8 +1039,8 @@ comp_target_types (tree ttl, tree ttr)
mvr = TYPE_MAIN_VARIANT (mvr);
val = comptypes (mvl, mvr);
- if (val == 2 && pedantic)
- pedwarn ("types are not quite compatible");
+ if (val == 2)
+ pedwarn (OPT_pedantic, "types are not quite compatible");
return val;
}
@@ -1363,7 +1363,7 @@ function_types_compatible_p (const_tree f1, const_tree f2)
/* 'volatile' qualifiers on a function's return type used to mean
the function is noreturn. */
if (TYPE_VOLATILE (ret1) != TYPE_VOLATILE (ret2))
- pedwarn ("function return types not compatible due to %<volatile%>");
+ pedwarn (0, "function return types not compatible due to %<volatile%>");
if (TYPE_VOLATILE (ret1))
ret1 = build_qualified_type (TYPE_MAIN_VARIANT (ret1),
TYPE_QUALS (ret1) & ~TYPE_QUAL_VOLATILE);
@@ -2115,9 +2115,11 @@ build_array_ref (tree array, tree index)
while (TREE_CODE (foo) == COMPONENT_REF)
foo = TREE_OPERAND (foo, 0);
if (TREE_CODE (foo) == VAR_DECL && C_DECL_REGISTER (foo))
- pedwarn ("ISO C forbids subscripting %<register%> array");
+ pedwarn (OPT_pedantic,
+ "ISO C forbids subscripting %<register%> array");
else if (!flag_isoc99 && !lvalue_p (foo))
- pedwarn ("ISO C90 forbids subscripting non-lvalue array");
+ pedwarn (OPT_pedantic,
+ "ISO C90 forbids subscripting non-lvalue array");
}
type = TREE_TYPE (TREE_TYPE (array));
@@ -2191,8 +2193,6 @@ build_external_ref (tree id, int fun, location_t loc)
/* Recursive call does not count as usage. */
if (ref != current_function_decl)
{
- if (!skip_evaluation)
- assemble_external (ref);
TREE_USED (ref) = 1;
}
@@ -2233,8 +2233,8 @@ build_external_ref (tree id, int fun, location_t loc)
&& (TREE_CODE (ref) != VAR_DECL || TREE_STATIC (ref))
&& ! TREE_PUBLIC (ref)
&& DECL_CONTEXT (ref) != current_function_decl)
- pedwarn ("%H%qD is static but used in inline function %qD "
- "which is not static", &loc, ref, current_function_decl);
+ pedwarn (0, "%H%qD is static but used in inline function %qD "
+ "which is not static", &loc, ref, current_function_decl);
return ref;
}
@@ -2408,11 +2408,10 @@ build_function_call (tree function, tree params)
/* This situation leads to run-time undefined behavior. We can't,
therefore, simply error unless we can prove that all possible
executions of the program must execute the code. */
- warning (0, "function called through a non-compatible type");
-
- /* We can, however, treat "undefined" any way we please.
- Call abort to encourage the user to fix the program. */
- inform ("if this code is reached, the program will abort");
+ if (warning (0, "function called through a non-compatible type"))
+ /* We can, however, treat "undefined" any way we please.
+ Call abort to encourage the user to fix the program. */
+ inform ("if this code is reached, the program will abort");
if (VOID_TYPE_P (return_type))
return trap;
@@ -2458,7 +2457,7 @@ build_function_call (tree function, tree params)
if (TREE_CONSTANT (result)
&& (name == NULL_TREE
|| strncmp (IDENTIFIER_POINTER (name), "__builtin_", 10) != 0))
- pedwarn_init ("initializer element is not constant");
+ pedwarn_init (0, "initializer element is not constant");
}
else
result = fold_build_call_array (TREE_TYPE (fntype),
@@ -2802,13 +2801,12 @@ pointer_diff (tree op0, tree op1)
tree con0, con1, lit0, lit1;
tree orig_op1 = op1;
- if (pedantic || warn_pointer_arith)
- {
- if (TREE_CODE (target_type) == VOID_TYPE)
- pedwarn ("pointer of type %<void *%> used in subtraction");
- if (TREE_CODE (target_type) == FUNCTION_TYPE)
- pedwarn ("pointer to a function used in subtraction");
- }
+ if (TREE_CODE (target_type) == VOID_TYPE)
+ pedwarn (pedantic ? OPT_pedantic : OPT_Wpointer_arith,
+ "pointer of type %<void *%> used in subtraction");
+ if (TREE_CODE (target_type) == FUNCTION_TYPE)
+ pedwarn (pedantic ? OPT_pedantic : OPT_Wpointer_arith,
+ "pointer to a function used in subtraction");
/* If the conversion to ptrdiff_type does anything like widening or
converting a partial to an integral mode, we get a convert_expression
@@ -2950,8 +2948,8 @@ build_unary_op (enum tree_code code, tree xarg, int flag)
else if (typecode == COMPLEX_TYPE)
{
code = CONJ_EXPR;
- if (pedantic)
- pedwarn ("ISO C does not support %<~%> for complex conjugation");
+ pedwarn (OPT_pedantic,
+ "ISO C does not support %<~%> for complex conjugation");
if (!noconvert)
arg = default_conversion (arg);
}
@@ -3022,9 +3020,8 @@ build_unary_op (enum tree_code code, tree xarg, int flag)
{
tree real, imag;
- if (pedantic)
- pedwarn ("ISO C does not support %<++%> and %<--%>"
- " on complex types");
+ pedwarn (OPT_pedantic, "ISO C does not support %<++%> and %<--%>"
+ " on complex types");
arg = stabilize_reference (arg);
real = build_unary_op (REALPART_EXPR, arg, 1);
@@ -3069,14 +3066,15 @@ build_unary_op (enum tree_code code, tree xarg, int flag)
else
error ("decrement of pointer to unknown structure");
}
- else if ((pedantic || warn_pointer_arith)
- && (TREE_CODE (TREE_TYPE (result_type)) == FUNCTION_TYPE
- || TREE_CODE (TREE_TYPE (result_type)) == VOID_TYPE))
+ else if (TREE_CODE (TREE_TYPE (result_type)) == FUNCTION_TYPE
+ || TREE_CODE (TREE_TYPE (result_type)) == VOID_TYPE)
{
if (code == PREINCREMENT_EXPR || code == POSTINCREMENT_EXPR)
- pedwarn ("wrong type argument to increment");
+ pedwarn (pedantic ? OPT_pedantic : OPT_Wpointer_arith,
+ "wrong type argument to increment");
else
- pedwarn ("wrong type argument to decrement");
+ pedwarn (pedantic ? OPT_pedantic : OPT_Wpointer_arith,
+ "wrong type argument to decrement");
}
inc = c_size_in_bytes (TREE_TYPE (result_type));
@@ -3351,7 +3349,7 @@ c_mark_addressable (tree exp)
("global register variable %qD used in nested function", x);
return false;
}
- pedwarn ("register variable %qD used in nested function", x);
+ pedwarn (0, "register variable %qD used in nested function", x);
}
else if (C_DECL_REGISTER (x))
{
@@ -3458,8 +3456,9 @@ build_conditional_expr (tree ifexp, tree op1, tree op2)
}
else if (code1 == VOID_TYPE || code2 == VOID_TYPE)
{
- if (pedantic && (code1 != VOID_TYPE || code2 != VOID_TYPE))
- pedwarn ("ISO C forbids conditional expr with only one void side");
+ if (code1 != VOID_TYPE || code2 != VOID_TYPE)
+ pedwarn (OPT_pedantic,
+ "ISO C forbids conditional expr with only one void side");
result_type = void_type_node;
}
else if (code1 == POINTER_TYPE && code2 == POINTER_TYPE)
@@ -3472,30 +3471,30 @@ build_conditional_expr (tree ifexp, tree op1, tree op2)
result_type = qualify_type (type1, type2);
else if (VOID_TYPE_P (TREE_TYPE (type1)))
{
- if (pedantic && TREE_CODE (TREE_TYPE (type2)) == FUNCTION_TYPE)
- pedwarn ("ISO C forbids conditional expr between "
+ if (TREE_CODE (TREE_TYPE (type2)) == FUNCTION_TYPE)
+ pedwarn (OPT_pedantic, "ISO C forbids conditional expr between "
"%<void *%> and function pointer");
result_type = build_pointer_type (qualify_type (TREE_TYPE (type1),
TREE_TYPE (type2)));
}
else if (VOID_TYPE_P (TREE_TYPE (type2)))
{
- if (pedantic && TREE_CODE (TREE_TYPE (type1)) == FUNCTION_TYPE)
- pedwarn ("ISO C forbids conditional expr between "
+ if (TREE_CODE (TREE_TYPE (type1)) == FUNCTION_TYPE)
+ pedwarn (OPT_pedantic, "ISO C forbids conditional expr between "
"%<void *%> and function pointer");
result_type = build_pointer_type (qualify_type (TREE_TYPE (type2),
TREE_TYPE (type1)));
}
else
{
- pedwarn ("pointer type mismatch in conditional expression");
+ pedwarn (0, "pointer type mismatch in conditional expression");
result_type = build_pointer_type (void_type_node);
}
}
else if (code1 == POINTER_TYPE && code2 == INTEGER_TYPE)
{
if (!null_pointer_constant_p (orig_op2))
- pedwarn ("pointer/integer type mismatch in conditional expression");
+ pedwarn (0, "pointer/integer type mismatch in conditional expression");
else
{
op2 = null_pointer_node;
@@ -3505,7 +3504,7 @@ build_conditional_expr (tree ifexp, tree op1, tree op2)
else if (code2 == POINTER_TYPE && code1 == INTEGER_TYPE)
{
if (!null_pointer_constant_p (orig_op1))
- pedwarn ("pointer/integer type mismatch in conditional expression");
+ pedwarn (0, "pointer/integer type mismatch in conditional expression");
else
{
op1 = null_pointer_node;
@@ -3616,12 +3615,10 @@ build_c_cast (tree type, tree expr)
if (type == TYPE_MAIN_VARIANT (TREE_TYPE (value)))
{
- if (pedantic)
- {
- if (TREE_CODE (type) == RECORD_TYPE
- || TREE_CODE (type) == UNION_TYPE)
- pedwarn ("ISO C forbids casting nonscalar to the same type");
- }
+ if (TREE_CODE (type) == RECORD_TYPE
+ || TREE_CODE (type) == UNION_TYPE)
+ pedwarn (OPT_pedantic,
+ "ISO C forbids casting nonscalar to the same type");
}
else if (TREE_CODE (type) == UNION_TYPE)
{
@@ -3637,8 +3634,7 @@ build_c_cast (tree type, tree expr)
{
tree t;
- if (pedantic)
- pedwarn ("ISO C forbids casts to union type");
+ pedwarn (OPT_pedantic, "ISO C forbids casts to union type");
t = digest_init (type,
build_constructor_single (type, field, value),
true, 0);
@@ -3749,7 +3745,8 @@ build_c_cast (tree type, tree expr)
&& TREE_CODE (otype) == POINTER_TYPE
&& TREE_CODE (TREE_TYPE (otype)) == FUNCTION_TYPE
&& TREE_CODE (TREE_TYPE (type)) != FUNCTION_TYPE)
- pedwarn ("ISO C forbids conversion of function pointer to object pointer type");
+ pedwarn (OPT_pedantic, "ISO C forbids "
+ "conversion of function pointer to object pointer type");
if (pedantic
&& TREE_CODE (type) == POINTER_TYPE
@@ -3757,7 +3754,8 @@ build_c_cast (tree type, tree expr)
&& TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE
&& TREE_CODE (TREE_TYPE (otype)) != FUNCTION_TYPE
&& !null_pointer_constant_p (value))
- pedwarn ("ISO C forbids conversion of object pointer to function pointer type");
+ pedwarn (OPT_pedantic, "ISO C forbids "
+ "conversion of object pointer to function pointer type");
ovalue = value;
value = convert (type, value);
@@ -3953,19 +3951,19 @@ convert_for_assignment (tree type, tree rhs, enum impl_conv errtype,
switch (errtype) \
{ \
case ic_argpass: \
- pedwarn (AR, parmnum, rname); \
+ pedwarn (0, AR, parmnum, rname); \
break; \
case ic_argpass_nonproto: \
- warning (0, AR, parmnum, rname); \
+ warning (0, AR, parmnum, rname); \
break; \
case ic_assign: \
- pedwarn (AS); \
+ pedwarn (0, AS); \
break; \
case ic_init: \
- pedwarn (IN); \
+ pedwarn (0, IN); \
break; \
case ic_return: \
- pedwarn (RE); \
+ pedwarn (0, RE); \
break; \
default: \
gcc_unreachable (); \
@@ -4172,8 +4170,9 @@ convert_for_assignment (tree type, tree rhs, enum impl_conv errtype,
memb = marginal_memb;
}
- if (pedantic && (!fundecl || !DECL_IN_SYSTEM_HEADER (fundecl)))
- pedwarn ("ISO C prohibits argument conversion to union type");
+ if (!fundecl || !DECL_IN_SYSTEM_HEADER (fundecl))
+ pedwarn (OPT_pedantic,
+ "ISO C prohibits argument conversion to union type");
rhs = fold_convert (TREE_TYPE (memb), rhs);
return build_constructor_single (type, memb, rhs);
@@ -4618,19 +4617,20 @@ error_init (const char *msgid)
error ("(near initialization for %qs)", ofwhat);
}
-/* Issue a pedantic warning for a bad initializer component.
- MSGID identifies the message.
- The component name is taken from the spelling stack. */
+/* Issue a pedantic warning for a bad initializer component. OPT is
+ the option OPT_* (from options.h) controlling this warning or 0 if
+ it is unconditionally given. MSGID identifies the message. The
+ component name is taken from the spelling stack. */
void
-pedwarn_init (const char *msgid)
+pedwarn_init (int opt, const char *msgid)
{
char *ofwhat;
- pedwarn ("%s", _(msgid));
+ pedwarn (opt, "%s", _(msgid));
ofwhat = print_spelling ((char *) alloca (spelling_length () + 1));
if (*ofwhat)
- pedwarn ("(near initialization for %qs)", ofwhat);
+ pedwarn (opt, "(near initialization for %qs)", ofwhat);
}
/* Issue a warning for a bad initializer component.
@@ -4661,7 +4661,8 @@ maybe_warn_string_init (tree type, struct c_expr expr)
&& TREE_CODE (type) == ARRAY_TYPE
&& TREE_CODE (expr.value) == STRING_CST
&& expr.original_code != STRING_CST)
- pedwarn_init ("array initialized from parenthesized string constant");
+ pedwarn_init (OPT_pedantic,
+ "array initialized from parenthesized string constant");
}
/* Digest the parser output INIT as an initializer for type TYPE.
@@ -4704,48 +4705,57 @@ digest_init (tree type, tree init, bool strict_string, int require_constant)
|| typ1 == signed_char_type_node
|| typ1 == unsigned_char_type_node);
bool wchar_array = !!comptypes (typ1, wchar_type_node);
- if (char_array || wchar_array)
+ bool char16_array = !!comptypes (typ1, char16_type_node);
+ bool char32_array = !!comptypes (typ1, char32_type_node);
+
+ if (char_array || wchar_array || char16_array || char32_array)
{
struct c_expr expr;
- bool char_string;
+ tree typ2 = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (inside_init)));
expr.value = inside_init;
expr.original_code = (strict_string ? STRING_CST : ERROR_MARK);
maybe_warn_string_init (type, expr);
- char_string
- = (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (inside_init)))
- == char_type_node);
-
if (comptypes (TYPE_MAIN_VARIANT (TREE_TYPE (inside_init)),
TYPE_MAIN_VARIANT (type)))
return inside_init;
- if (!wchar_array && !char_string)
+ if (char_array)
{
- error_init ("char-array initialized from wide string");
- return error_mark_node;
+ if (typ2 != char_type_node)
+ {
+ error_init ("char-array initialized from wide string");
+ return error_mark_node;
+ }
}
- if (char_string && !char_array)
+ else
{
- error_init ("wchar_t-array initialized from non-wide string");
- return error_mark_node;
+ if (typ2 == char_type_node)
+ {
+ error_init ("wide character array initialized from non-wide "
+ "string");
+ return error_mark_node;
+ }
+ else if (!comptypes(typ1, typ2))
+ {
+ error_init ("wide character array initialized from "
+ "incompatible wide string");
+ return error_mark_node;
+ }
}
TREE_TYPE (inside_init) = type;
if (TYPE_DOMAIN (type) != 0
&& TYPE_SIZE (type) != 0
&& TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST
- /* Subtract 1 (or sizeof (wchar_t))
+ /* Subtract the size of a single (possibly wide) character
because it's ok to ignore the terminating null char
that is counted in the length of the constant. */
&& 0 > compare_tree_int (TYPE_SIZE_UNIT (type),
TREE_STRING_LENGTH (inside_init)
- - ((TYPE_PRECISION (typ1)
- != TYPE_PRECISION (char_type_node))
- ? (TYPE_PRECISION (wchar_type_node)
- / BITS_PER_UNIT)
- : 1)))
- pedwarn_init ("initializer-string for array of chars is too long");
+ - (TYPE_PRECISION (typ1)
+ / BITS_PER_UNIT)))
+ pedwarn_init (0, "initializer-string for array of chars is too long");
return inside_init;
}
@@ -4791,6 +4801,9 @@ digest_init (tree type, tree init, bool strict_string, int require_constant)
}
}
+ if (warn_sequence_point)
+ verify_sequence_points (inside_init);
+
/* Any type can be initialized
from an expression of the same type, optionally with braces. */
@@ -4860,7 +4873,7 @@ digest_init (tree type, tree init, bool strict_string, int require_constant)
if (inside_init == error_mark_node)
error_init ("initializer element is not constant");
else
- pedwarn_init ("initializer element is not constant");
+ pedwarn_init (OPT_pedantic, "initializer element is not constant");
if (flag_pedantic_errors)
inside_init = error_mark_node;
}
@@ -5533,8 +5546,8 @@ pop_init_level (int implicit)
if (constructor_depth > 2)
error_init ("initialization of flexible array member in a nested context");
- else if (pedantic)
- pedwarn_init ("initialization of a flexible array member");
+ else
+ pedwarn_init (OPT_pedantic, "initialization of a flexible array member");
/* We have already issued an error message for the existence
of a flexible array member not at the end of the structure.
@@ -6092,15 +6105,7 @@ set_nonincremental_init_from_string (tree str)
gcc_assert (TREE_CODE (constructor_type) == ARRAY_TYPE);
- if (TYPE_PRECISION (TREE_TYPE (TREE_TYPE (str)))
- == TYPE_PRECISION (char_type_node))
- wchar_bytes = 1;
- else
- {
- gcc_assert (TYPE_PRECISION (TREE_TYPE (TREE_TYPE (str)))
- == TYPE_PRECISION (wchar_type_node));
- wchar_bytes = TYPE_PRECISION (wchar_type_node) / BITS_PER_UNIT;
- }
+ wchar_bytes = TYPE_PRECISION (TREE_TYPE (TREE_TYPE (str))) / BITS_PER_UNIT;
charwidth = TYPE_PRECISION (char_type_node);
type = TREE_TYPE (constructor_type);
p = TREE_STRING_POINTER (str);
@@ -6279,7 +6284,7 @@ output_init_element (tree value, bool strict_string, tree type, tree field,
value = error_mark_node;
}
else if (require_constant_elements)
- pedwarn ("initializer element is not computable at load time");
+ pedwarn (0, "initializer element is not computable at load time");
}
/* If this field is empty (and not at the end of structure),
@@ -6606,7 +6611,7 @@ process_init_element (struct c_expr value)
if (constructor_fields == 0)
{
- pedwarn_init ("excess elements in struct initializer");
+ pedwarn_init (0, "excess elements in struct initializer");
break;
}
@@ -6689,7 +6694,7 @@ process_init_element (struct c_expr value)
if (constructor_fields == 0)
{
- pedwarn_init ("excess elements in union initializer");
+ pedwarn_init (0, "excess elements in union initializer");
break;
}
@@ -6776,7 +6781,7 @@ process_init_element (struct c_expr value)
&& (tree_int_cst_lt (constructor_max_index, constructor_index)
|| integer_all_onesp (constructor_max_index)))
{
- pedwarn_init ("excess elements in array initializer");
+ pedwarn_init (0, "excess elements in array initializer");
break;
}
@@ -6806,7 +6811,7 @@ process_init_element (struct c_expr value)
always have a fixed size derived from their type. */
if (tree_int_cst_lt (constructor_max_index, constructor_index))
{
- pedwarn_init ("excess elements in vector initializer");
+ pedwarn_init (0, "excess elements in vector initializer");
break;
}
@@ -6830,7 +6835,7 @@ process_init_element (struct c_expr value)
else if (constructor_type != error_mark_node
&& constructor_fields == 0)
{
- pedwarn_init ("excess elements in scalar initializer");
+ pedwarn_init (0, "excess elements in scalar initializer");
break;
}
else
@@ -7061,8 +7066,7 @@ c_finish_goto_label (tree label)
tree
c_finish_goto_ptr (tree expr)
{
- if (pedantic)
- pedwarn ("ISO C forbids %<goto *expr;%>");
+ pedwarn (OPT_pedantic, "ISO C forbids %<goto *expr;%>");
expr = convert (ptr_type_node, expr);
return add_stmt (build1 (GOTO_EXPR, void_type_node, expr));
}
@@ -7085,7 +7089,8 @@ c_finish_return (tree retval)
if ((warn_return_type || flag_isoc99)
&& valtype != 0 && TREE_CODE (valtype) != VOID_TYPE)
{
- pedwarn_c99 ("%<return%> with no value, in "
+ pedwarn_c99 (flag_isoc99 ? 0 : OPT_Wreturn_type,
+ "%<return%> with no value, in "
"function returning non-void");
no_warning = true;
}
@@ -7094,9 +7099,10 @@ c_finish_return (tree retval)
{
current_function_returns_null = 1;
if (TREE_CODE (TREE_TYPE (retval)) != VOID_TYPE)
- pedwarn ("%<return%> with a value, in function returning void");
- else if (pedantic)
- pedwarn ("ISO C forbids %<return%> with expression, in function returning void");
+ pedwarn (0, "%<return%> with a value, in function returning void");
+ else
+ pedwarn (OPT_pedantic, "ISO C forbids "
+ "%<return%> with expression, in function returning void");
}
else
{
@@ -7163,6 +7169,9 @@ c_finish_return (tree retval)
}
retval = build2 (MODIFY_EXPR, TREE_TYPE (res), res, t);
+
+ if (warn_sequence_point)
+ verify_sequence_points (retval);
}
ret_stmt = build_stmt (RETURN_EXPR, retval);
@@ -7240,6 +7249,9 @@ c_start_case (tree exp)
"converted to %<int%> in ISO C");
exp = default_conversion (exp);
+
+ if (warn_sequence_point)
+ verify_sequence_points (exp);
}
}
@@ -8166,20 +8178,20 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
whose value is 0 but which isn't a valid null ptr const. */
if (pedantic && !null_pointer_constant_p (orig_op0)
&& TREE_CODE (tt1) == FUNCTION_TYPE)
- pedwarn ("ISO C forbids comparison of %<void *%>"
- " with function pointer");
+ pedwarn (OPT_pedantic, "ISO C forbids "
+ "comparison of %<void *%> with function pointer");
}
else if (VOID_TYPE_P (tt1))
{
if (pedantic && !null_pointer_constant_p (orig_op1)
&& TREE_CODE (tt0) == FUNCTION_TYPE)
- pedwarn ("ISO C forbids comparison of %<void *%>"
- " with function pointer");
+ pedwarn (OPT_pedantic, "ISO C forbids "
+ "comparison of %<void *%> with function pointer");
}
else
/* Avoid warning about the volatile ObjC EH puts on decls. */
if (!objc_ok)
- pedwarn ("comparison of distinct pointer types lacks a cast");
+ pedwarn (0, "comparison of distinct pointer types lacks a cast");
if (result_type == NULL_TREE)
result_type = ptr_type_node;
@@ -8203,12 +8215,12 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
else if (code0 == POINTER_TYPE && code1 == INTEGER_TYPE)
{
result_type = type0;
- pedwarn ("comparison between pointer and integer");
+ pedwarn (0, "comparison between pointer and integer");
}
else if (code0 == INTEGER_TYPE && code1 == POINTER_TYPE)
{
result_type = type1;
- pedwarn ("comparison between pointer and integer");
+ pedwarn (0, "comparison between pointer and integer");
}
break;
@@ -8229,38 +8241,42 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
result_type = common_pointer_type (type0, type1);
if (!COMPLETE_TYPE_P (TREE_TYPE (type0))
!= !COMPLETE_TYPE_P (TREE_TYPE (type1)))
- pedwarn ("comparison of complete and incomplete pointers");
- else if (pedantic
- && TREE_CODE (TREE_TYPE (type0)) == FUNCTION_TYPE)
- pedwarn ("ISO C forbids ordered comparisons of pointers to functions");
+ pedwarn (0, "comparison of complete and incomplete pointers");
+ else if (TREE_CODE (TREE_TYPE (type0)) == FUNCTION_TYPE)
+ pedwarn (OPT_pedantic, "ISO C forbids "
+ "ordered comparisons of pointers to functions");
}
else
{
result_type = ptr_type_node;
- pedwarn ("comparison of distinct pointer types lacks a cast");
+ pedwarn (0, "comparison of distinct pointer types lacks a cast");
}
}
else if (code0 == POINTER_TYPE && null_pointer_constant_p (orig_op1))
{
result_type = type0;
- if (pedantic || extra_warnings)
- pedwarn ("ordered comparison of pointer with integer zero");
+ if (pedantic)
+ pedwarn (OPT_pedantic,
+ "ordered comparison of pointer with integer zero");
+ else if (extra_warnings)
+ warning (OPT_Wextra,
+ "ordered comparison of pointer with integer zero");
}
else if (code1 == POINTER_TYPE && null_pointer_constant_p (orig_op0))
{
result_type = type1;
- if (pedantic)
- pedwarn ("ordered comparison of pointer with integer zero");
+ pedwarn (OPT_pedantic,
+ "ordered comparison of pointer with integer zero");
}
else if (code0 == POINTER_TYPE && code1 == INTEGER_TYPE)
{
result_type = type0;
- pedwarn ("comparison between pointer and integer");
+ pedwarn (0, "comparison between pointer and integer");
}
else if (code0 == INTEGER_TYPE && code1 == POINTER_TYPE)
{
result_type = type1;
- pedwarn ("comparison between pointer and integer");
+ pedwarn (0, "comparison between pointer and integer");
}
break;
@@ -8308,93 +8324,9 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
if (shorten && none_complex)
{
- int unsigned0, unsigned1;
- tree arg0, arg1;
- int uns;
- tree type;
-
- /* Cast OP0 and OP1 to RESULT_TYPE. Doing so prevents
- excessive narrowing when we call get_narrower below. For
- example, suppose that OP0 is of unsigned int extended
- from signed char and that RESULT_TYPE is long long int.
- If we explicitly cast OP0 to RESULT_TYPE, OP0 would look
- like
-
- (long long int) (unsigned int) signed_char
-
- which get_narrower would narrow down to
-
- (unsigned int) signed char
-
- If we do not cast OP0 first, get_narrower would return
- signed_char, which is inconsistent with the case of the
- explicit cast. */
- op0 = convert (result_type, op0);
- op1 = convert (result_type, op1);
-
- arg0 = get_narrower (op0, &unsigned0);
- arg1 = get_narrower (op1, &unsigned1);
-
- /* UNS is 1 if the operation to be done is an unsigned one. */
- uns = TYPE_UNSIGNED (result_type);
-
final_type = result_type;
-
- /* Handle the case that OP0 (or OP1) does not *contain* a conversion
- but it *requires* conversion to FINAL_TYPE. */
-
- if ((TYPE_PRECISION (TREE_TYPE (op0))
- == TYPE_PRECISION (TREE_TYPE (arg0)))
- && TREE_TYPE (op0) != final_type)
- unsigned0 = TYPE_UNSIGNED (TREE_TYPE (op0));
- if ((TYPE_PRECISION (TREE_TYPE (op1))
- == TYPE_PRECISION (TREE_TYPE (arg1)))
- && TREE_TYPE (op1) != final_type)
- unsigned1 = TYPE_UNSIGNED (TREE_TYPE (op1));
-
- /* Now UNSIGNED0 is 1 if ARG0 zero-extends to FINAL_TYPE. */
-
- /* For bitwise operations, signedness of nominal type
- does not matter. Consider only how operands were extended. */
- if (shorten == -1)
- uns = unsigned0;
-
- /* Note that in all three cases below we refrain from optimizing
- an unsigned operation on sign-extended args.
- That would not be valid. */
-
- /* Both args variable: if both extended in same way
- from same width, do it in that width.
- Do it unsigned if args were zero-extended. */
- if ((TYPE_PRECISION (TREE_TYPE (arg0))
- < TYPE_PRECISION (result_type))
- && (TYPE_PRECISION (TREE_TYPE (arg1))
- == TYPE_PRECISION (TREE_TYPE (arg0)))
- && unsigned0 == unsigned1
- && (unsigned0 || !uns))
- result_type
- = c_common_signed_or_unsigned_type
- (unsigned0, common_type (TREE_TYPE (arg0), TREE_TYPE (arg1)));
- else if (TREE_CODE (arg0) == INTEGER_CST
- && (unsigned1 || !uns)
- && (TYPE_PRECISION (TREE_TYPE (arg1))
- < TYPE_PRECISION (result_type))
- && (type
- = c_common_signed_or_unsigned_type (unsigned1,
- TREE_TYPE (arg1)))
- && !POINTER_TYPE_P (type)
- && int_fits_type_p (arg0, type))
- result_type = type;
- else if (TREE_CODE (arg1) == INTEGER_CST
- && (unsigned0 || !uns)
- && (TYPE_PRECISION (TREE_TYPE (arg0))
- < TYPE_PRECISION (result_type))
- && (type
- = c_common_signed_or_unsigned_type (unsigned0,
- TREE_TYPE (arg0)))
- && !POINTER_TYPE_P (type)
- && int_fits_type_p (arg1, type))
- result_type = type;
+ result_type = shorten_binary_op (result_type, op0, op1,
+ shorten == -1);
}
/* Shifts can be shortened if shifting right. */
@@ -8448,124 +8380,10 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
converted = 1;
resultcode = xresultcode;
- if (warn_sign_compare && skip_evaluation == 0)
- {
- int op0_signed = !TYPE_UNSIGNED (TREE_TYPE (orig_op0));
- int op1_signed = !TYPE_UNSIGNED (TREE_TYPE (orig_op1));
- int unsignedp0, unsignedp1;
- tree primop0 = get_narrower (op0, &unsignedp0);
- tree primop1 = get_narrower (op1, &unsignedp1);
-
- xop0 = orig_op0;
- xop1 = orig_op1;
- STRIP_TYPE_NOPS (xop0);
- STRIP_TYPE_NOPS (xop1);
-
- /* Give warnings for comparisons between signed and unsigned
- quantities that may fail.
-
- Do the checking based on the original operand trees, so that
- casts will be considered, but default promotions won't be.
-
- Do not warn if the comparison is being done in a signed type,
- since the signed type will only be chosen if it can represent
- all the values of the unsigned type. */
- if (!TYPE_UNSIGNED (result_type))
- /* OK */;
- /* Do not warn if both operands are the same signedness. */
- else if (op0_signed == op1_signed)
- /* OK */;
- else
- {
- tree sop, uop;
- bool ovf;
-
- if (op0_signed)
- sop = xop0, uop = xop1;
- else
- sop = xop1, uop = xop0;
-
- /* Do not warn if the signed quantity is an
- unsuffixed integer literal (or some static
- constant expression involving such literals or a
- conditional expression involving such literals)
- and it is non-negative. */
- if (tree_expr_nonnegative_warnv_p (sop, &ovf))
- /* OK */;
- /* Do not warn if the comparison is an equality operation,
- the unsigned quantity is an integral constant, and it
- would fit in the result if the result were signed. */
- else if (TREE_CODE (uop) == INTEGER_CST
- && (resultcode == EQ_EXPR || resultcode == NE_EXPR)
- && int_fits_type_p
- (uop, c_common_signed_type (result_type)))
- /* OK */;
- /* Do not warn if the unsigned quantity is an enumeration
- constant and its maximum value would fit in the result
- if the result were signed. */
- else if (TREE_CODE (uop) == INTEGER_CST
- && TREE_CODE (TREE_TYPE (uop)) == ENUMERAL_TYPE
- && int_fits_type_p
- (TYPE_MAX_VALUE (TREE_TYPE (uop)),
- c_common_signed_type (result_type)))
- /* OK */;
- else
- warning (OPT_Wsign_compare, "comparison between signed and unsigned");
- }
-
- /* Warn if two unsigned values are being compared in a size
- larger than their original size, and one (and only one) is the
- result of a `~' operator. This comparison will always fail.
-
- Also warn if one operand is a constant, and the constant
- does not have all bits set that are set in the ~ operand
- when it is extended. */
-
- if ((TREE_CODE (primop0) == BIT_NOT_EXPR)
- != (TREE_CODE (primop1) == BIT_NOT_EXPR))
- {
- if (TREE_CODE (primop0) == BIT_NOT_EXPR)
- primop0 = get_narrower (TREE_OPERAND (primop0, 0),
- &unsignedp0);
- else
- primop1 = get_narrower (TREE_OPERAND (primop1, 0),
- &unsignedp1);
-
- if (host_integerp (primop0, 0) || host_integerp (primop1, 0))
- {
- tree primop;
- HOST_WIDE_INT constant, mask;
- int unsignedp, bits;
-
- if (host_integerp (primop0, 0))
- {
- primop = primop1;
- unsignedp = unsignedp1;
- constant = tree_low_cst (primop0, 0);
- }
- else
- {
- primop = primop0;
- unsignedp = unsignedp0;
- constant = tree_low_cst (primop1, 0);
- }
-
- bits = TYPE_PRECISION (TREE_TYPE (primop));
- if (bits < TYPE_PRECISION (result_type)
- && bits < HOST_BITS_PER_WIDE_INT && unsignedp)
- {
- mask = (~(HOST_WIDE_INT) 0) << bits;
- if ((mask & constant) != mask)
- warning (OPT_Wsign_compare, "comparison of promoted ~unsigned with constant");
- }
- }
- else if (unsignedp0 && unsignedp1
- && (TYPE_PRECISION (TREE_TYPE (primop0))
- < TYPE_PRECISION (result_type))
- && (TYPE_PRECISION (TREE_TYPE (primop1))
- < TYPE_PRECISION (result_type)))
- warning (OPT_Wsign_compare, "comparison of promoted ~unsigned with unsigned");
- }
+ if (warn_sign_compare && !skip_evaluation)
+ {
+ warn_for_sign_compare (orig_op0, orig_op1, op0, op1,
+ result_type, resultcode);
}
}
}
diff --git a/gcc/c.opt b/gcc/c.opt
index 30782d4f3a7..d33fa46e8a7 100644
--- a/gcc/c.opt
+++ b/gcc/c.opt
@@ -281,7 +281,7 @@ C ObjC C++ ObjC++ Var(warn_long_long) Init(1) Warning
Do not warn about using \"long long\" when -pedantic
Wmain
-C ObjC C++ ObjC++ Warning
+C ObjC C++ ObjC++ Var(warn_main) Init(-1) Warning
Warn about suspicious declarations of \"main\"
Wmissing-braces
diff --git a/gcc/caller-save.c b/gcc/caller-save.c
index 233caca74f2..e3d76c654be 100644
--- a/gcc/caller-save.c
+++ b/gcc/caller-save.c
@@ -356,10 +356,16 @@ setup_save_areas (void)
if (! do_save)
continue;
- /* We have found an acceptable mode to store in. */
+ /* We have found an acceptable mode to store in. Since hard
+ register is always saved in the widest mode available,
+ the mode may be wider than necessary, it is OK to reduce
+ the alignment of spill space. We will verify that it is
+ equal to or greater than required when we restore and save
+ the hard register in insert_restore and insert_save. */
regno_save_mem[i][j]
- = assign_stack_local (regno_save_mode[i][j],
- GET_MODE_SIZE (regno_save_mode[i][j]), 0);
+ = assign_stack_local_1 (regno_save_mode[i][j],
+ GET_MODE_SIZE (regno_save_mode[i][j]),
+ 0, true);
/* Setup single word save area just in case... */
for (k = 0; k < j; k++)
diff --git a/gcc/calls.c b/gcc/calls.c
index a4470fa1477..27aaaee6eff 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -25,6 +25,7 @@ along with GCC; see the file COPYING3. If not see
#include "tm.h"
#include "rtl.h"
#include "tree.h"
+#include "gimple.h"
#include "flags.h"
#include "expr.h"
#include "optabs.h"
@@ -41,6 +42,7 @@ along with GCC; see the file COPYING3. If not see
#include "cgraph.h"
#include "except.h"
#include "dbgcnt.h"
+#include "tree-flow.h"
/* Like PREFERRED_STACK_BOUNDARY but in units of bytes, not bits. */
#define STACK_BYTES (PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT)
@@ -380,7 +382,7 @@ emit_call_1 (rtx funexp, tree fntree, tree fndecl ATTRIBUTE_UNUSED,
add_reg_note (call_insn, REG_EH_REGION, const0_rtx);
else
{
- int rn = lookup_stmt_eh_region (fntree);
+ int rn = lookup_expr_eh_region (fntree);
/* If rn < 0, then either (1) tree-ssa not used or (2) doesn't
throw, which we already took care of. */
@@ -413,6 +415,10 @@ emit_call_1 (rtx funexp, tree fntree, tree fndecl ATTRIBUTE_UNUSED,
rounded_stack_size -= n_popped;
rounded_stack_size_rtx = GEN_INT (rounded_stack_size);
stack_pointer_delta -= n_popped;
+
+ /* If popup is needed, stack realign must use DRAP */
+ if (SUPPORTS_STACK_ALIGNMENT)
+ crtl->need_drap = true;
}
if (!ACCUMULATE_OUTGOING_ARGS)
@@ -542,7 +548,26 @@ setjmp_call_p (const_tree fndecl)
return special_function_p (fndecl, 0) & ECF_RETURNS_TWICE;
}
+
+/* Return true if STMT is an alloca call. */
+
+bool
+gimple_alloca_call_p (const_gimple stmt)
+{
+ tree fndecl;
+
+ if (!is_gimple_call (stmt))
+ return false;
+
+ fndecl = gimple_call_fndecl (stmt);
+ if (fndecl && (special_function_p (fndecl, 0) & ECF_MAY_BE_ALLOCA))
+ return true;
+
+ return false;
+}
+
/* Return true when exp contains alloca call. */
+
bool
alloca_call_p (const_tree exp)
{
@@ -1852,7 +1877,7 @@ shift_return_value (enum machine_mode mode, bool left_p, rtx value)
static rtx
avoid_likely_spilled_reg (rtx x)
{
- rtx new;
+ rtx new_rtx;
if (REG_P (x)
&& HARD_REGISTER_P (x)
@@ -1863,10 +1888,10 @@ avoid_likely_spilled_reg (rtx x)
and the whole point of this function is to avoid
using the hard register directly in such a situation. */
generating_concat_p = 0;
- new = gen_reg_rtx (GET_MODE (x));
+ new_rtx = gen_reg_rtx (GET_MODE (x));
generating_concat_p = 1;
- emit_move_insn (new, x);
- return new;
+ emit_move_insn (new_rtx, x);
+ return new_rtx;
}
return x;
}
@@ -2251,7 +2276,7 @@ expand_call (tree exp, rtx target, int ignore)
if (currently_expanding_call++ != 0
|| !flag_optimize_sibling_calls
|| args_size.var
- || lookup_stmt_eh_region (exp) >= 0
+ || lookup_expr_eh_region (exp) >= 0
|| dbg_cnt (tail_call) == false)
try_tail_call = 0;
@@ -2294,10 +2319,13 @@ expand_call (tree exp, rtx target, int ignore)
|| !lang_hooks.decls.ok_for_sibcall (fndecl))
try_tail_call = 0;
- /* Ensure current function's preferred stack
- boundary is at least what we need. */
+ /* Ensure current function's preferred stack boundary is at least
+ what we need. Stack alignment may also increase preferred stack
+ boundary. */
if (crtl->preferred_stack_boundary < preferred_stack_boundary)
crtl->preferred_stack_boundary = preferred_stack_boundary;
+ else
+ preferred_stack_boundary = crtl->preferred_stack_boundary;
preferred_unit_stack_boundary = preferred_stack_boundary / BITS_PER_UNIT;
@@ -2384,7 +2412,7 @@ expand_call (tree exp, rtx target, int ignore)
incoming argument block. */
if (pass == 0)
{
- argblock = virtual_incoming_args_rtx;
+ argblock = crtl->args.internal_arg_pointer;
argblock
#ifdef STACK_GROWS_DOWNWARD
= plus_constant (argblock, crtl->args.pretend_args_size);
@@ -3229,7 +3257,7 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value,
#ifdef REG_PARM_STACK_SPACE
/* Define the boundary of the register parm stack space that needs to be
save, if any. */
- int low_to_save, high_to_save;
+ int low_to_save = 0, high_to_save = 0;
rtx save_area = 0; /* Place that it is saved. */
#endif
diff --git a/gcc/cfg.c b/gcc/cfg.c
index e8bf789480b..1f681124105 100644
--- a/gcc/cfg.c
+++ b/gcc/cfg.c
@@ -597,7 +597,7 @@ dump_reg_info (FILE *file)
fprintf (file, "%d registers.\n", max);
for (i = FIRST_PSEUDO_REGISTER; i < max; i++)
{
- enum reg_class class, altclass;
+ enum reg_class rclass, altclass;
if (regstat_n_sets_and_refs)
fprintf (file, "\nRegister %d used %d times across %d insns",
@@ -628,17 +628,17 @@ dump_reg_info (FILE *file)
&& PSEUDO_REGNO_BYTES (i) != UNITS_PER_WORD)
fprintf (file, "; %d bytes", PSEUDO_REGNO_BYTES (i));
- class = reg_preferred_class (i);
+ rclass = reg_preferred_class (i);
altclass = reg_alternate_class (i);
- if (class != GENERAL_REGS || altclass != ALL_REGS)
+ if (rclass != GENERAL_REGS || altclass != ALL_REGS)
{
- if (altclass == ALL_REGS || class == ALL_REGS)
- fprintf (file, "; pref %s", reg_class_names[(int) class]);
+ if (altclass == ALL_REGS || rclass == ALL_REGS)
+ fprintf (file, "; pref %s", reg_class_names[(int) rclass]);
else if (altclass == NO_REGS)
- fprintf (file, "; %s or none", reg_class_names[(int) class]);
+ fprintf (file, "; %s or none", reg_class_names[(int) rclass]);
else
fprintf (file, "; pref %s, else %s",
- reg_class_names[(int) class],
+ reg_class_names[(int) rclass],
reg_class_names[(int) altclass]);
}
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index 6a48e1632d7..ac228f9b79f 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -42,6 +42,342 @@ along with GCC; see the file COPYING3. If not see
#include "value-prof.h"
#include "target.h"
+
+/* Return an expression tree corresponding to the RHS of GIMPLE
+ statement STMT. */
+
+tree
+gimple_assign_rhs_to_tree (gimple stmt)
+{
+ tree t;
+ enum gimple_rhs_class grhs_class;
+
+ grhs_class = get_gimple_rhs_class (gimple_expr_code (stmt));
+
+ if (grhs_class == GIMPLE_BINARY_RHS)
+ t = build2 (gimple_assign_rhs_code (stmt),
+ TREE_TYPE (gimple_assign_lhs (stmt)),
+ gimple_assign_rhs1 (stmt),
+ gimple_assign_rhs2 (stmt));
+ else if (grhs_class == GIMPLE_UNARY_RHS)
+ t = build1 (gimple_assign_rhs_code (stmt),
+ TREE_TYPE (gimple_assign_lhs (stmt)),
+ gimple_assign_rhs1 (stmt));
+ else if (grhs_class == GIMPLE_SINGLE_RHS)
+ t = gimple_assign_rhs1 (stmt);
+ else
+ gcc_unreachable ();
+
+ return t;
+}
+
+/* Return an expression tree corresponding to the PREDICATE of GIMPLE_COND
+ statement STMT. */
+
+static tree
+gimple_cond_pred_to_tree (gimple stmt)
+{
+ return build2 (gimple_cond_code (stmt), boolean_type_node,
+ gimple_cond_lhs (stmt), gimple_cond_rhs (stmt));
+}
+
+/* Helper for gimple_to_tree. Set EXPR_LOCATION for every expression
+ inside *TP. DATA is the location to set. */
+
+static tree
+set_expr_location_r (tree *tp, int *ws ATTRIBUTE_UNUSED, void *data)
+{
+ location_t *loc = (location_t *) data;
+ if (EXPR_P (*tp))
+ SET_EXPR_LOCATION (*tp, *loc);
+
+ return NULL_TREE;
+}
+
+
+/* RTL expansion has traditionally been done on trees, so the
+ transition to doing it on GIMPLE tuples is very invasive to the RTL
+ expander. To facilitate the transition, this function takes a
+ GIMPLE tuple STMT and returns the same statement in the form of a
+ tree. */
+
+static tree
+gimple_to_tree (gimple stmt)
+{
+ tree t;
+ int rn;
+ tree_ann_common_t ann;
+ location_t loc;
+
+ switch (gimple_code (stmt))
+ {
+ case GIMPLE_ASSIGN:
+ {
+ tree lhs = gimple_assign_lhs (stmt);
+
+ t = gimple_assign_rhs_to_tree (stmt);
+ t = build2 (MODIFY_EXPR, TREE_TYPE (lhs), lhs, t);
+ if (gimple_assign_nontemporal_move_p (stmt))
+ MOVE_NONTEMPORAL (t) = true;
+ }
+ break;
+
+ case GIMPLE_COND:
+ t = gimple_cond_pred_to_tree (stmt);
+ t = build3 (COND_EXPR, void_type_node, t, NULL_TREE, NULL_TREE);
+ break;
+
+ case GIMPLE_GOTO:
+ t = build1 (GOTO_EXPR, void_type_node, gimple_goto_dest (stmt));
+ break;
+
+ case GIMPLE_LABEL:
+ t = build1 (LABEL_EXPR, void_type_node, gimple_label_label (stmt));
+ break;
+
+ case GIMPLE_RETURN:
+ {
+ tree retval = gimple_return_retval (stmt);
+
+ if (retval && retval != error_mark_node)
+ {
+ tree result = DECL_RESULT (current_function_decl);
+
+ /* If we are not returning the current function's RESULT_DECL,
+ build an assignment to it. */
+ if (retval != result)
+ {
+ /* I believe that a function's RESULT_DECL is unique. */
+ gcc_assert (TREE_CODE (retval) != RESULT_DECL);
+
+ retval = build2 (MODIFY_EXPR, TREE_TYPE (result),
+ result, retval);
+ }
+ }
+ t = build1 (RETURN_EXPR, void_type_node, retval);
+ }
+ break;
+
+ case GIMPLE_ASM:
+ {
+ size_t i, n;
+ tree out, in, cl;
+ const char *s;
+
+ out = NULL_TREE;
+ n = gimple_asm_noutputs (stmt);
+ if (n > 0)
+ {
+ t = out = gimple_asm_output_op (stmt, 0);
+ for (i = 1; i < n; i++)
+ {
+ TREE_CHAIN (t) = gimple_asm_output_op (stmt, i);
+ t = gimple_asm_output_op (stmt, i);
+ }
+ }
+
+ in = NULL_TREE;
+ n = gimple_asm_ninputs (stmt);
+ if (n > 0)
+ {
+ t = in = gimple_asm_input_op (stmt, 0);
+ for (i = 1; i < n; i++)
+ {
+ TREE_CHAIN (t) = gimple_asm_input_op (stmt, i);
+ t = gimple_asm_input_op (stmt, i);
+ }
+ }
+
+ cl = NULL_TREE;
+ n = gimple_asm_nclobbers (stmt);
+ if (n > 0)
+ {
+ t = cl = gimple_asm_clobber_op (stmt, 0);
+ for (i = 1; i < n; i++)
+ {
+ TREE_CHAIN (t) = gimple_asm_clobber_op (stmt, i);
+ t = gimple_asm_clobber_op (stmt, i);
+ }
+ }
+
+ s = gimple_asm_string (stmt);
+ t = build4 (ASM_EXPR, void_type_node, build_string (strlen (s), s),
+ out, in, cl);
+ ASM_VOLATILE_P (t) = gimple_asm_volatile_p (stmt);
+ ASM_INPUT_P (t) = gimple_asm_input_p (stmt);
+ }
+ break;
+
+ case GIMPLE_CALL:
+ {
+ size_t i;
+ tree fn;
+ tree_ann_common_t ann;
+
+ t = build_vl_exp (CALL_EXPR, gimple_call_num_args (stmt) + 3);
+
+ CALL_EXPR_FN (t) = gimple_call_fn (stmt);
+ TREE_TYPE (t) = gimple_call_return_type (stmt);
+ CALL_EXPR_STATIC_CHAIN (t) = gimple_call_chain (stmt);
+
+ for (i = 0; i < gimple_call_num_args (stmt); i++)
+ CALL_EXPR_ARG (t, i) = gimple_call_arg (stmt, i);
+
+ if (!(gimple_call_flags (stmt) & (ECF_CONST | ECF_PURE)))
+ TREE_SIDE_EFFECTS (t) = 1;
+
+ if (gimple_call_flags (stmt) & ECF_NOTHROW)
+ TREE_NOTHROW (t) = 1;
+
+ CALL_EXPR_TAILCALL (t) = gimple_call_tail_p (stmt);
+ CALL_EXPR_RETURN_SLOT_OPT (t) = gimple_call_return_slot_opt_p (stmt);
+ CALL_FROM_THUNK_P (t) = gimple_call_from_thunk_p (stmt);
+ CALL_CANNOT_INLINE_P (t) = gimple_call_cannot_inline_p (stmt);
+ CALL_EXPR_VA_ARG_PACK (t) = gimple_call_va_arg_pack_p (stmt);
+
+ /* If the call has a LHS then create a MODIFY_EXPR to hold it. */
+ {
+ tree lhs = gimple_call_lhs (stmt);
+
+ if (lhs)
+ t = build2 (MODIFY_EXPR, TREE_TYPE (lhs), lhs, t);
+ }
+
+ /* Record the original call statement, as it may be used
+ to retrieve profile information during expansion. */
+
+ if ((fn = gimple_call_fndecl (stmt)) != NULL_TREE
+ && DECL_BUILT_IN (fn))
+ {
+ ann = get_tree_common_ann (t);
+ ann->stmt = stmt;
+ }
+ }
+ break;
+
+ case GIMPLE_SWITCH:
+ {
+ tree label_vec;
+ size_t i;
+ tree elt = gimple_switch_label (stmt, 0);
+
+ label_vec = make_tree_vec (gimple_switch_num_labels (stmt));
+
+ if (!CASE_LOW (elt) && !CASE_HIGH (elt))
+ {
+ for (i = 1; i < gimple_switch_num_labels (stmt); i++)
+ TREE_VEC_ELT (label_vec, i - 1) = gimple_switch_label (stmt, i);
+
+ /* The default case in a SWITCH_EXPR must be at the end of
+ the label vector. */
+ TREE_VEC_ELT (label_vec, i - 1) = gimple_switch_label (stmt, 0);
+ }
+ else
+ {
+ for (i = 0; i < gimple_switch_num_labels (stmt); i++)
+ TREE_VEC_ELT (label_vec, i) = gimple_switch_label (stmt, i);
+ }
+
+ t = build3 (SWITCH_EXPR, void_type_node, gimple_switch_index (stmt),
+ NULL, label_vec);
+ }
+ break;
+
+ case GIMPLE_NOP:
+ case GIMPLE_PREDICT:
+ t = build1 (NOP_EXPR, void_type_node, size_zero_node);
+ break;
+
+ case GIMPLE_RESX:
+ t = build_resx (gimple_resx_region (stmt));
+ break;
+
+ default:
+ if (errorcount == 0)
+ {
+ error ("Unrecognized GIMPLE statement during RTL expansion");
+ print_gimple_stmt (stderr, stmt, 4, 0);
+ gcc_unreachable ();
+ }
+ else
+ {
+ /* Ignore any bad gimple codes if we're going to die anyhow,
+ so we can at least set TREE_ASM_WRITTEN and have the rest
+ of compilation advance without sudden ICE death. */
+ t = build1 (NOP_EXPR, void_type_node, size_zero_node);
+ break;
+ }
+ }
+
+ /* If STMT is inside an exception region, record it in the generated
+ expression. */
+ rn = lookup_stmt_eh_region (stmt);
+ if (rn >= 0)
+ {
+ tree call = get_call_expr_in (t);
+
+ ann = get_tree_common_ann (t);
+ ann->rn = rn;
+
+ /* For a CALL_EXPR on the RHS of an assignment, calls.c looks up
+ the CALL_EXPR not the assignment statment for EH region number. */
+ if (call && call != t)
+ {
+ ann = get_tree_common_ann (call);
+ ann->rn = rn;
+ }
+ }
+
+ /* Set EXPR_LOCATION in all the embedded expressions. */
+ loc = gimple_location (stmt);
+ walk_tree (&t, set_expr_location_r, (void *) &loc, NULL);
+
+ TREE_BLOCK (t) = gimple_block (stmt);
+
+ return t;
+}
+
+
+/* Release back to GC memory allocated by gimple_to_tree. */
+
+static void
+release_stmt_tree (gimple stmt, tree stmt_tree)
+{
+ tree_ann_common_t ann;
+
+ switch (gimple_code (stmt))
+ {
+ case GIMPLE_ASSIGN:
+ if (get_gimple_rhs_class (gimple_expr_code (stmt)) != GIMPLE_SINGLE_RHS)
+ ggc_free (TREE_OPERAND (stmt_tree, 1));
+ break;
+ case GIMPLE_COND:
+ ggc_free (COND_EXPR_COND (stmt_tree));
+ break;
+ case GIMPLE_RETURN:
+ if (TREE_OPERAND (stmt_tree, 0)
+ && TREE_CODE (TREE_OPERAND (stmt_tree, 0)) == MODIFY_EXPR)
+ ggc_free (TREE_OPERAND (stmt_tree, 0));
+ break;
+ case GIMPLE_CALL:
+ if (gimple_call_lhs (stmt))
+ {
+ ann = tree_common_ann (TREE_OPERAND (stmt_tree, 1));
+ if (ann)
+ ggc_free (ann);
+ ggc_free (TREE_OPERAND (stmt_tree, 1));
+ }
+ break;
+ default:
+ break;
+ }
+ ann = tree_common_ann (stmt_tree);
+ if (ann)
+ ggc_free (ann);
+ ggc_free (stmt_tree);
+}
+
+
/* Verify that there is exactly single jump instruction since last and attach
REG_BR_PROB note specifying probability.
??? We really ought to pass the probability down to RTL expanders and let it
@@ -153,10 +489,25 @@ get_decl_align_unit (tree decl)
align = DECL_ALIGN (decl);
align = LOCAL_ALIGNMENT (TREE_TYPE (decl), align);
- if (align > PREFERRED_STACK_BOUNDARY)
- align = PREFERRED_STACK_BOUNDARY;
+
+ if (align > MAX_SUPPORTED_STACK_ALIGNMENT)
+ align = MAX_SUPPORTED_STACK_ALIGNMENT;
+
+ if (SUPPORTS_STACK_ALIGNMENT)
+ {
+ if (crtl->stack_alignment_estimated < align)
+ {
+ gcc_assert(!crtl->stack_realign_processed);
+ crtl->stack_alignment_estimated = align;
+ }
+ }
+
+ /* stack_alignment_needed > PREFERRED_STACK_BOUNDARY is permitted.
+ So here we only make sure stack_alignment_needed >= align. */
if (crtl->stack_alignment_needed < align)
crtl->stack_alignment_needed = align;
+ if (crtl->max_used_stack_slot_alignment < crtl->stack_alignment_needed)
+ crtl->max_used_stack_slot_alignment = crtl->stack_alignment_needed;
return align / BITS_PER_UNIT;
}
@@ -617,28 +968,6 @@ expand_one_stack_var (tree var)
expand_one_stack_var_at (var, offset);
}
-/* A subroutine of expand_one_var. Called to assign rtl
- to a TREE_STATIC VAR_DECL. */
-
-static void
-expand_one_static_var (tree var)
-{
- /* In unit-at-a-time all the static variables are expanded at the end
- of compilation process. */
- if (flag_unit_at_a_time)
- return;
- /* If this is an inlined copy of a static local variable,
- look up the original. */
- var = DECL_ORIGIN (var);
-
- /* If we've already processed this variable because of that, do nothing. */
- if (TREE_ASM_WRITTEN (var))
- return;
-
- /* Otherwise, just emit the variable. */
- rest_of_decl_compilation (var, 0, 0);
-}
-
/* A subroutine of expand_one_var. Called to assign rtl to a VAR_DECL
that will reside in a hard register. */
@@ -735,6 +1064,31 @@ defer_stack_allocation (tree var, bool toplevel)
static HOST_WIDE_INT
expand_one_var (tree var, bool toplevel, bool really_expand)
{
+ if (SUPPORTS_STACK_ALIGNMENT
+ && TREE_TYPE (var) != error_mark_node
+ && TREE_CODE (var) == VAR_DECL)
+ {
+ unsigned int align;
+
+ /* Because we don't know if VAR will be in register or on stack,
+ we conservatively assume it will be on stack even if VAR is
+ eventually put into register after RA pass. For non-automatic
+ variables, which won't be on stack, we collect alignment of
+ type and ignore user specified alignment. */
+ if (TREE_STATIC (var) || DECL_EXTERNAL (var))
+ align = TYPE_ALIGN (TREE_TYPE (var));
+ else
+ align = DECL_ALIGN (var);
+
+ if (crtl->stack_alignment_estimated < align)
+ {
+ /* stack_alignment_estimated shouldn't change after stack
+ realign decision made */
+ gcc_assert(!crtl->stack_realign_processed);
+ crtl->stack_alignment_estimated = align;
+ }
+ }
+
if (TREE_CODE (var) != VAR_DECL)
;
else if (DECL_EXTERNAL (var))
@@ -742,10 +1096,7 @@ expand_one_var (tree var, bool toplevel, bool really_expand)
else if (DECL_HAS_VALUE_EXPR_P (var))
;
else if (TREE_STATIC (var))
- {
- if (really_expand)
- expand_one_static_var (var);
- }
+ ;
else if (DECL_RTL_SET_P (var))
;
else if (TREE_TYPE (var) == error_mark_node)
@@ -790,12 +1141,7 @@ expand_used_vars_for_block (tree block, bool toplevel)
/* Expand all variables at this level. */
for (t = BLOCK_VARS (block); t ; t = TREE_CHAIN (t))
- if (TREE_USED (t)
- /* Force local static variables to be output when marked by
- used attribute. For unit-at-a-time, cgraph code already takes
- care of this. */
- || (!flag_unit_at_a_time && TREE_STATIC (t)
- && DECL_PRESERVE_P (t)))
+ if (TREE_USED (t))
expand_one_var (t, toplevel, true);
this_sv_num = stack_vars_num;
@@ -1211,12 +1557,12 @@ expand_used_vars (void)
generated for STMT should have been appended. */
static void
-maybe_dump_rtl_for_tree_stmt (tree stmt, rtx since)
+maybe_dump_rtl_for_gimple_stmt (gimple stmt, rtx since)
{
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "\n;; ");
- print_generic_expr (dump_file, stmt, TDF_SLIM);
+ print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM);
fprintf (dump_file, "\n");
print_rtl (dump_file, since ? NEXT_INSN (since) : since);
@@ -1230,10 +1576,11 @@ static struct pointer_map_t *lab_rtx_for_bb;
/* Returns the label_rtx expression for a label starting basic block BB. */
static rtx
-label_rtx_for_bb (basic_block bb)
+label_rtx_for_bb (basic_block bb ATTRIBUTE_UNUSED)
{
- tree_stmt_iterator tsi;
- tree lab, lab_stmt;
+ gimple_stmt_iterator gsi;
+ tree lab;
+ gimple lab_stmt;
void **elt;
if (bb->flags & BB_RTL)
@@ -1245,13 +1592,13 @@ label_rtx_for_bb (basic_block bb)
/* Find the tree label if it is present. */
- for (tsi = tsi_start (bb_stmt_list (bb)); !tsi_end_p (tsi); tsi_next (&tsi))
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- lab_stmt = tsi_stmt (tsi);
- if (TREE_CODE (lab_stmt) != LABEL_EXPR)
+ lab_stmt = gsi_stmt (gsi);
+ if (gimple_code (lab_stmt) != GIMPLE_LABEL)
break;
- lab = LABEL_EXPR_LABEL (lab_stmt);
+ lab = gimple_label_label (lab_stmt);
if (DECL_NONLOCAL (lab))
break;
@@ -1263,29 +1610,28 @@ label_rtx_for_bb (basic_block bb)
return (rtx) *elt;
}
-/* A subroutine of expand_gimple_basic_block. Expand one COND_EXPR.
+
+/* A subroutine of expand_gimple_basic_block. Expand one GIMPLE_COND.
Returns a new basic block if we've terminated the current basic
block and created a new one. */
static basic_block
-expand_gimple_cond_expr (basic_block bb, tree stmt)
+expand_gimple_cond (basic_block bb, gimple stmt)
{
basic_block new_bb, dest;
edge new_edge;
edge true_edge;
edge false_edge;
- tree pred = COND_EXPR_COND (stmt);
+ tree pred = gimple_cond_pred_to_tree (stmt);
rtx last2, last;
- gcc_assert (COND_EXPR_THEN (stmt) == NULL_TREE);
- gcc_assert (COND_EXPR_ELSE (stmt) == NULL_TREE);
last2 = last = get_last_insn ();
extract_true_false_edges_from_block (bb, &true_edge, &false_edge);
- if (EXPR_LOCUS (stmt))
+ if (gimple_has_location (stmt))
{
- set_curr_insn_source_location (*(EXPR_LOCUS (stmt)));
- set_curr_insn_block (TREE_BLOCK (stmt));
+ set_curr_insn_source_location (gimple_location (stmt));
+ set_curr_insn_block (gimple_block (stmt));
}
/* These flags have no purpose in RTL land. */
@@ -1298,20 +1644,22 @@ expand_gimple_cond_expr (basic_block bb, tree stmt)
{
jumpif (pred, label_rtx_for_bb (true_edge->dest));
add_reg_br_prob_note (last, true_edge->probability);
- maybe_dump_rtl_for_tree_stmt (stmt, last);
+ maybe_dump_rtl_for_gimple_stmt (stmt, last);
if (true_edge->goto_locus)
set_curr_insn_source_location (true_edge->goto_locus);
false_edge->flags |= EDGE_FALLTHRU;
+ ggc_free (pred);
return NULL;
}
if (true_edge->dest == bb->next_bb)
{
jumpifnot (pred, label_rtx_for_bb (false_edge->dest));
add_reg_br_prob_note (last, false_edge->probability);
- maybe_dump_rtl_for_tree_stmt (stmt, last);
+ maybe_dump_rtl_for_gimple_stmt (stmt, last);
if (false_edge->goto_locus)
set_curr_insn_source_location (false_edge->goto_locus);
true_edge->flags |= EDGE_FALLTHRU;
+ ggc_free (pred);
return NULL;
}
@@ -1338,15 +1686,16 @@ expand_gimple_cond_expr (basic_block bb, tree stmt)
BB_END (new_bb) = PREV_INSN (BB_END (new_bb));
update_bb_for_insn (new_bb);
- maybe_dump_rtl_for_tree_stmt (stmt, last2);
+ maybe_dump_rtl_for_gimple_stmt (stmt, last2);
if (false_edge->goto_locus)
set_curr_insn_source_location (false_edge->goto_locus);
+ ggc_free (pred);
return new_bb;
}
-/* A subroutine of expand_gimple_basic_block. Expand one CALL_EXPR
+/* A subroutine of expand_gimple_basic_block. Expand one GIMPLE_CALL
that has CALL_EXPR_TAILCALL set. Returns non-null if we actually
generated a tail call (something that might be denied by the ABI
rules governing the call; see calls.c).
@@ -1357,23 +1706,26 @@ expand_gimple_cond_expr (basic_block bb, tree stmt)
tailcall) and the normal result happens via a sqrt instruction. */
static basic_block
-expand_gimple_tailcall (basic_block bb, tree stmt, bool *can_fallthru)
+expand_gimple_tailcall (basic_block bb, gimple stmt, bool *can_fallthru)
{
rtx last2, last;
edge e;
edge_iterator ei;
int probability;
gcov_type count;
+ tree stmt_tree = gimple_to_tree (stmt);
last2 = last = get_last_insn ();
- expand_expr_stmt (stmt);
+ expand_expr_stmt (stmt_tree);
+
+ release_stmt_tree (stmt, stmt_tree);
for (last = NEXT_INSN (last); last; last = NEXT_INSN (last))
if (CALL_P (last) && SIBLING_CALL_P (last))
goto found;
- maybe_dump_rtl_for_tree_stmt (stmt, last2);
+ maybe_dump_rtl_for_gimple_stmt (stmt, last2);
*can_fallthru = true;
return NULL;
@@ -1448,7 +1800,7 @@ expand_gimple_tailcall (basic_block bb, tree stmt, bool *can_fallthru)
BB_END (bb) = PREV_INSN (last);
}
- maybe_dump_rtl_for_tree_stmt (stmt, last2);
+ maybe_dump_rtl_for_gimple_stmt (stmt, last2);
return bb;
}
@@ -1458,50 +1810,53 @@ expand_gimple_tailcall (basic_block bb, tree stmt, bool *can_fallthru)
static basic_block
expand_gimple_basic_block (basic_block bb)
{
- tree_stmt_iterator tsi;
- tree stmts = bb_stmt_list (bb);
- tree stmt = NULL;
+ gimple_stmt_iterator gsi;
+ gimple_seq stmts;
+ gimple stmt = NULL;
rtx note, last;
edge e;
edge_iterator ei;
void **elt;
if (dump_file)
- {
- fprintf (dump_file,
- "\n;; Generating RTL for tree basic block %d\n",
- bb->index);
- }
-
- bb->il.tree = NULL;
+ fprintf (dump_file, "\n;; Generating RTL for gimple basic block %d\n",
+ bb->index);
+
+ /* Note that since we are now transitioning from GIMPLE to RTL, we
+ cannot use the gsi_*_bb() routines because they expect the basic
+ block to be in GIMPLE, instead of RTL. Therefore, we need to
+ access the BB sequence directly. */
+ stmts = bb_seq (bb);
+ bb->il.gimple = NULL;
+ rtl_profile_for_bb (bb);
init_rtl_bb_info (bb);
bb->flags |= BB_RTL;
/* Remove the RETURN_EXPR if we may fall though to the exit
instead. */
- tsi = tsi_last (stmts);
- if (!tsi_end_p (tsi)
- && TREE_CODE (tsi_stmt (tsi)) == RETURN_EXPR)
+ gsi = gsi_last (stmts);
+ if (!gsi_end_p (gsi)
+ && gimple_code (gsi_stmt (gsi)) == GIMPLE_RETURN)
{
- tree ret_stmt = tsi_stmt (tsi);
+ gimple ret_stmt = gsi_stmt (gsi);
gcc_assert (single_succ_p (bb));
gcc_assert (single_succ (bb) == EXIT_BLOCK_PTR);
if (bb->next_bb == EXIT_BLOCK_PTR
- && !TREE_OPERAND (ret_stmt, 0))
+ && !gimple_return_retval (ret_stmt))
{
- tsi_delink (&tsi);
+ gsi_remove (&gsi, false);
single_succ_edge (bb)->flags |= EDGE_FALLTHRU;
}
}
- tsi = tsi_start (stmts);
- if (!tsi_end_p (tsi))
+ gsi = gsi_start (stmts);
+ if (!gsi_end_p (gsi))
{
- stmt = tsi_stmt (tsi);
- if (TREE_CODE (stmt) != LABEL_EXPR)
- stmt = NULL_TREE;
+ stmt = gsi_stmt (gsi);
+ if (gimple_code (stmt) != GIMPLE_LABEL)
+ stmt = NULL;
}
elt = pointer_map_contains (lab_rtx_for_bb, bb);
@@ -1512,8 +1867,10 @@ expand_gimple_basic_block (basic_block bb)
if (stmt)
{
- expand_expr_stmt (stmt);
- tsi_next (&tsi);
+ tree stmt_tree = gimple_to_tree (stmt);
+ expand_expr_stmt (stmt_tree);
+ release_stmt_tree (stmt, stmt_tree);
+ gsi_next (&gsi);
}
if (elt)
@@ -1526,7 +1883,7 @@ expand_gimple_basic_block (basic_block bb)
BB_HEAD (bb) = NEXT_INSN (BB_HEAD (bb));
note = emit_note_after (NOTE_INSN_BASIC_BLOCK, BB_HEAD (bb));
- maybe_dump_rtl_for_tree_stmt (stmt, last);
+ maybe_dump_rtl_for_gimple_stmt (stmt, last);
}
else
note = BB_HEAD (bb) = emit_note (NOTE_INSN_BASIC_BLOCK);
@@ -1547,36 +1904,22 @@ expand_gimple_basic_block (basic_block bb)
ei_next (&ei);
}
- for (; !tsi_end_p (tsi); tsi_next (&tsi))
+ for (; !gsi_end_p (gsi); gsi_next (&gsi))
{
- tree stmt = tsi_stmt (tsi);
+ gimple stmt = gsi_stmt (gsi);
basic_block new_bb;
- if (!stmt)
- continue;
-
/* Expand this statement, then evaluate the resulting RTL and
fixup the CFG accordingly. */
- if (TREE_CODE (stmt) == COND_EXPR)
+ if (gimple_code (stmt) == GIMPLE_COND)
{
- new_bb = expand_gimple_cond_expr (bb, stmt);
+ new_bb = expand_gimple_cond (bb, stmt);
if (new_bb)
return new_bb;
}
else
{
- tree call = get_call_expr_in (stmt);
- int region;
- /* For the benefit of calls.c, converting all this to rtl,
- we need to record the call expression, not just the outer
- modify statement. */
- if (call && call != stmt)
- {
- if ((region = lookup_stmt_eh_region (stmt)) > 0)
- add_stmt_to_eh_region (call, region);
- gimple_duplicate_stmt_histograms (cfun, call, cfun, stmt);
- }
- if (call && CALL_EXPR_TAILCALL (call))
+ if (is_gimple_call (stmt) && gimple_call_tail_p (stmt))
{
bool can_fallthru;
new_bb = expand_gimple_tailcall (bb, stmt, &can_fallthru);
@@ -1590,9 +1933,11 @@ expand_gimple_basic_block (basic_block bb)
}
else
{
+ tree stmt_tree = gimple_to_tree (stmt);
last = get_last_insn ();
- expand_expr_stmt (stmt);
- maybe_dump_rtl_for_tree_stmt (stmt, last);
+ expand_expr_stmt (stmt_tree);
+ maybe_dump_rtl_for_gimple_stmt (stmt, last);
+ release_stmt_tree (stmt, stmt_tree);
}
}
}
@@ -1651,7 +1996,7 @@ construct_init_block (void)
otherwise we have to jump into proper target. */
if (e && e->dest != ENTRY_BLOCK_PTR->next_bb)
{
- tree label = tree_block_label (e->dest);
+ tree label = gimple_block_label (e->dest);
emit_jump (label_rtx (label));
flags = 0;
@@ -1706,6 +2051,8 @@ construct_exit_block (void)
edge_iterator ei;
rtx orig_end = BB_END (EXIT_BLOCK_PTR->prev_bb);
+ rtl_profile_for_bb (EXIT_BLOCK_PTR);
+
/* Make sure the locus is set to the end of the function, so that
epilogue line numbers and warnings are set properly. */
if (cfun->function_end_locus != UNKNOWN_LOCATION)
@@ -1809,13 +2156,84 @@ static void
discover_nonconstant_array_refs (void)
{
basic_block bb;
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
FOR_EACH_BB (bb)
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ {
+ gimple stmt = gsi_stmt (gsi);
+ walk_gimple_op (stmt, discover_nonconstant_array_refs_r, NULL);
+ }
+}
+
+/* This function sets crtl->args.internal_arg_pointer to a virtual
+ register if DRAP is needed. Local register allocator will replace
+ virtual_incoming_args_rtx with the virtual register. */
+
+static void
+expand_stack_alignment (void)
+{
+ rtx drap_rtx;
+ unsigned int preferred_stack_boundary, incoming_stack_boundary;
+
+ if (! SUPPORTS_STACK_ALIGNMENT)
+ return;
+
+ if (cfun->calls_alloca
+ || cfun->has_nonlocal_label
+ || crtl->has_nonlocal_goto)
+ crtl->need_drap = true;
+
+ gcc_assert (crtl->stack_alignment_needed
+ <= crtl->stack_alignment_estimated);
+
+ /* Update stack boundary if needed. */
+ if (targetm.calls.update_stack_boundary)
+ targetm.calls.update_stack_boundary ();
+
+ /* Update crtl->stack_alignment_estimated and use it later to align
+ stack. We check PREFERRED_STACK_BOUNDARY if there may be non-call
+ exceptions since callgraph doesn't collect incoming stack alignment
+ in this case. */
+ if (flag_non_call_exceptions
+ && PREFERRED_STACK_BOUNDARY > crtl->preferred_stack_boundary)
+ preferred_stack_boundary = PREFERRED_STACK_BOUNDARY;
+ else
+ preferred_stack_boundary = crtl->preferred_stack_boundary;
+ if (preferred_stack_boundary > crtl->stack_alignment_estimated)
+ crtl->stack_alignment_estimated = preferred_stack_boundary;
+ if (preferred_stack_boundary > crtl->stack_alignment_needed)
+ crtl->stack_alignment_needed = preferred_stack_boundary;
+
+ /* The incoming stack frame has to be aligned at least at
+ parm_stack_boundary. */
+ if (crtl->parm_stack_boundary > INCOMING_STACK_BOUNDARY)
+ incoming_stack_boundary = crtl->parm_stack_boundary;
+ else
+ incoming_stack_boundary = INCOMING_STACK_BOUNDARY;
+
+ crtl->stack_realign_needed
+ = incoming_stack_boundary < crtl->stack_alignment_estimated;
+ crtl->stack_realign_tried = crtl->stack_realign_needed;
+
+ crtl->stack_realign_processed = true;
+
+ /* Target has to redefine TARGET_GET_DRAP_RTX to support stack
+ alignment. */
+ gcc_assert (targetm.calls.get_drap_rtx != NULL);
+ drap_rtx = targetm.calls.get_drap_rtx ();
+
+ /* stack_realign_drap and drap_rtx must match. */
+ gcc_assert ((stack_realign_drap != 0) == (drap_rtx != NULL));
+
+ /* Do nothing if NULL is returned, which means DRAP is not needed. */
+ if (NULL != drap_rtx)
{
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
- walk_tree (bsi_stmt_ptr (bsi), discover_nonconstant_array_refs_r,
- NULL , NULL);
+ crtl->args.internal_arg_pointer = drap_rtx;
+
+ /* Call fixup_tail_calls to clean up REG_EQUIV note if DRAP is
+ needed. */
+ fixup_tail_calls ();
}
}
@@ -1829,7 +2247,7 @@ discover_nonconstant_array_refs (void)
the expansion. */
static unsigned int
-tree_expand_cfg (void)
+gimple_expand_cfg (void)
{
basic_block bb, init_block;
sbitmap blocks;
@@ -1839,6 +2257,8 @@ tree_expand_cfg (void)
/* Some backends want to know that we are expanding to RTL. */
currently_expanding_to_rtl = 1;
+ rtl_profile_for_bb (ENTRY_BLOCK_PTR);
+
insn_locators_alloc ();
if (!DECL_BUILT_IN (current_function_decl))
set_curr_insn_source_location (DECL_SOURCE_LOCATION (current_function_decl));
@@ -1855,6 +2275,8 @@ tree_expand_cfg (void)
targetm.expand_to_rtl_hook ();
crtl->stack_alignment_needed = STACK_BOUNDARY;
+ crtl->max_used_stack_slot_alignment = STACK_BOUNDARY;
+ crtl->stack_alignment_estimated = STACK_BOUNDARY;
crtl->preferred_stack_boundary = STACK_BOUNDARY;
cfun->cfg->max_jumptable_ents = 0;
@@ -1902,6 +2324,9 @@ tree_expand_cfg (void)
lab_rtx_for_bb = pointer_map_create ();
FOR_BB_BETWEEN (bb, init_block->next_bb, EXIT_BLOCK_PTR, next_bb)
bb = expand_gimple_basic_block (bb);
+
+ /* Expansion is used by optimization passes too, set maybe_hot_insn_p
+ conservatively to true until they are all profile aware. */
pointer_map_destroy (lab_rtx_for_bb);
free_histograms ();
@@ -1926,6 +2351,9 @@ tree_expand_cfg (void)
sbitmap_free (blocks);
compact_blocks ();
+
+ expand_stack_alignment ();
+
#ifdef ENABLE_CHECKING
verify_flow_info ();
#endif
@@ -1970,6 +2398,7 @@ tree_expand_cfg (void)
/* Tag the blocks with a depth number so that change_scope can find
the common parent easily. */
set_block_levels (DECL_INITIAL (cfun->decl), 0);
+ default_rtl_profile ();
return 0;
}
@@ -1979,7 +2408,7 @@ struct rtl_opt_pass pass_expand =
RTL_PASS,
"expand", /* name */
NULL, /* gate */
- tree_expand_cfg, /* execute */
+ gimple_expand_cfg, /* execute */
NULL, /* sub */
NULL, /* next */
0, /* static_pass_number */
diff --git a/gcc/cfghooks.c b/gcc/cfghooks.c
index 5815a7edd37..00d7151f6b8 100644
--- a/gcc/cfghooks.c
+++ b/gcc/cfghooks.c
@@ -51,9 +51,9 @@ cfg_layout_rtl_register_cfg_hooks (void)
/* Initialization of functions specific to the tree IR. */
void
-tree_register_cfg_hooks (void)
+gimple_register_cfg_hooks (void)
{
- cfg_hooks = &tree_cfg_hooks;
+ cfg_hooks = &gimple_cfg_hooks;
}
/* Returns current ir type. */
@@ -61,7 +61,7 @@ tree_register_cfg_hooks (void)
enum ir_type
current_ir_type (void)
{
- if (cfg_hooks == &tree_cfg_hooks)
+ if (cfg_hooks == &gimple_cfg_hooks)
return IR_GIMPLE;
else if (cfg_hooks == &rtl_cfg_hooks)
return IR_RTL_CFGRTL;
@@ -291,7 +291,7 @@ dump_bb (basic_block bb, FILE *outf, int indent)
putc ('\n', outf);
if (cfg_hooks->dump_bb)
- cfg_hooks->dump_bb (bb, outf, indent);
+ cfg_hooks->dump_bb (bb, outf, indent, 0);
}
/* Redirect edge E to the given basic block DEST and update underlying program
diff --git a/gcc/cfghooks.h b/gcc/cfghooks.h
index e581d9cd559..537c05f07ba 100644
--- a/gcc/cfghooks.h
+++ b/gcc/cfghooks.h
@@ -28,7 +28,7 @@ struct cfg_hooks
/* Debugging. */
int (*verify_flow_info) (void);
- void (*dump_bb) (basic_block, FILE *, int);
+ void (*dump_bb) (basic_block, FILE *, int, int);
/* Basic CFG manipulation. */
@@ -181,7 +181,7 @@ extern void lv_add_condition_to_bb (basic_block, basic_block, basic_block,
void *);
/* Hooks containers. */
-extern struct cfg_hooks tree_cfg_hooks;
+extern struct cfg_hooks gimple_cfg_hooks;
extern struct cfg_hooks rtl_cfg_hooks;
extern struct cfg_hooks cfg_layout_rtl_cfg_hooks;
@@ -189,6 +189,6 @@ extern struct cfg_hooks cfg_layout_rtl_cfg_hooks;
extern enum ir_type current_ir_type (void);
extern void rtl_register_cfg_hooks (void);
extern void cfg_layout_rtl_register_cfg_hooks (void);
-extern void tree_register_cfg_hooks (void);
+extern void gimple_register_cfg_hooks (void);
#endif /* GCC_CFGHOOKS_H */
diff --git a/gcc/cfgloop.c b/gcc/cfgloop.c
index f565708ae9e..4c9bbf0ab19 100644
--- a/gcc/cfgloop.c
+++ b/gcc/cfgloop.c
@@ -563,11 +563,13 @@ find_subloop_latch_edge_by_profile (VEC (edge, heap) *latches)
another edge. */
static edge
-find_subloop_latch_edge_by_ivs (struct loop *loop, VEC (edge, heap) *latches)
+find_subloop_latch_edge_by_ivs (struct loop *loop ATTRIBUTE_UNUSED, VEC (edge, heap) *latches)
{
edge e, latch = VEC_index (edge, latches, 0);
unsigned i;
- tree phi, lop;
+ gimple phi;
+ gimple_stmt_iterator psi;
+ tree lop;
basic_block bb;
/* Find the candidate for the latch edge. */
@@ -582,15 +584,16 @@ find_subloop_latch_edge_by_ivs (struct loop *loop, VEC (edge, heap) *latches)
/* Check for a phi node that would deny that this is a latch edge of
a subloop. */
- for (phi = phi_nodes (loop->header); phi; phi = PHI_CHAIN (phi))
+ for (psi = gsi_start_phis (loop->header); !gsi_end_p (psi); gsi_next (&psi))
{
+ phi = gsi_stmt (psi);
lop = PHI_ARG_DEF_FROM_EDGE (phi, latch);
/* Ignore the values that are not changed inside the subloop. */
if (TREE_CODE (lop) != SSA_NAME
|| SSA_NAME_DEF_STMT (lop) == phi)
continue;
- bb = bb_for_stmt (SSA_NAME_DEF_STMT (lop));
+ bb = gimple_bb (SSA_NAME_DEF_STMT (lop));
if (!bb || !flow_bb_inside_loop_p (loop, bb))
continue;
diff --git a/gcc/cfgloop.h b/gcc/cfgloop.h
index 056e8f0b1e5..d21d50bebdd 100644
--- a/gcc/cfgloop.h
+++ b/gcc/cfgloop.h
@@ -49,7 +49,7 @@ struct lpt_decision GTY (())
struct nb_iter_bound GTY ((chain_next ("%h.next")))
{
/* The statement STMT is executed at most ... */
- tree stmt;
+ gimple stmt;
/* ... BOUND + 1 times (BOUND must be an unsigned constant).
The + 1 is added for the following reasons:
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index 240455bca9d..f9e3e17e1a7 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -76,7 +76,7 @@ static void rtl_delete_block (basic_block);
static basic_block rtl_redirect_edge_and_branch_force (edge, basic_block);
static edge rtl_redirect_edge_and_branch (edge, basic_block);
static basic_block rtl_split_block (basic_block, void *);
-static void rtl_dump_bb (basic_block, FILE *, int);
+static void rtl_dump_bb (basic_block, FILE *, int, int);
static int rtl_verify_flow_info_1 (void);
static void rtl_make_forwarder_block (edge);
@@ -1510,7 +1510,7 @@ commit_edge_insertions (void)
at start and end). */
static void
-rtl_dump_bb (basic_block bb, FILE *outf, int indent)
+rtl_dump_bb (basic_block bb, FILE *outf, int indent, int flags ATTRIBUTE_UNUSED)
{
rtx insn;
rtx last;
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index 881bc42dfe1..37ad9f1606f 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -81,7 +81,7 @@ The callgraph:
#include "varray.h"
#include "output.h"
#include "intl.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "tree-dump.h"
#include "tree-flow.h"
@@ -412,17 +412,6 @@ cgraph_node (tree decl)
node->master_clone = node;
}
- /* This code can go away once flag_unit_at_a_mode is removed. */
- if (assembler_name_hash)
- {
- tree name = DECL_ASSEMBLER_NAME (node->decl);
- slot = ((struct cgraph_node **)
- htab_find_slot_with_hash (assembler_name_hash, name,
- decl_assembler_name_hash (name),
- INSERT));
- if (!*slot)
- *slot = node;
- }
return node;
}
@@ -514,9 +503,12 @@ edge_eq (const void *x, const void *y)
return ((const struct cgraph_edge *) x)->call_stmt == y;
}
-/* Return callgraph edge representing CALL_EXPR statement. */
+
+/* Return the callgraph edge representing the GIMPLE_CALL statement
+ CALL_STMT. */
+
struct cgraph_edge *
-cgraph_edge (struct cgraph_node *node, tree call_stmt)
+cgraph_edge (struct cgraph_node *node, gimple call_stmt)
{
struct cgraph_edge *e, *e2;
int n = 0;
@@ -537,6 +529,7 @@ cgraph_edge (struct cgraph_node *node, tree call_stmt)
break;
n++;
}
+
if (n > 100)
{
node->call_site_hash = htab_create_ggc (120, edge_hash, edge_eq, NULL);
@@ -551,13 +544,15 @@ cgraph_edge (struct cgraph_node *node, tree call_stmt)
*slot = e2;
}
}
+
return e;
}
-/* Change call_stmt of edge E to NEW_STMT. */
+
+/* Change field call_smt of edge E to NEW_STMT. */
void
-cgraph_set_call_stmt (struct cgraph_edge *e, tree new_stmt)
+cgraph_set_call_stmt (struct cgraph_edge *e, gimple new_stmt)
{
if (e->caller->call_site_hash)
{
@@ -582,7 +577,7 @@ cgraph_set_call_stmt (struct cgraph_edge *e, tree new_stmt)
struct cgraph_edge *
cgraph_create_edge (struct cgraph_node *caller, struct cgraph_node *callee,
- tree call_stmt, gcov_type count, int freq, int nest)
+ gimple call_stmt, gcov_type count, int freq, int nest)
{
struct cgraph_edge *edge = GGC_NEW (struct cgraph_edge);
#ifdef ENABLE_CHECKING
@@ -592,9 +587,9 @@ cgraph_create_edge (struct cgraph_node *caller, struct cgraph_node *callee,
gcc_assert (e->call_stmt != call_stmt);
#endif
- gcc_assert (get_call_expr_in (call_stmt));
+ gcc_assert (is_gimple_call (call_stmt));
- if (!DECL_SAVED_TREE (callee->decl))
+ if (!gimple_body (callee->decl))
edge->inline_failed = N_("function body not available");
else if (callee->local.redefined_extern_inline)
edge->inline_failed = N_("redefined extern inline functions are not "
@@ -625,6 +620,7 @@ cgraph_create_edge (struct cgraph_node *caller, struct cgraph_node *callee,
gcc_assert (freq >= 0);
gcc_assert (freq <= CGRAPH_FREQ_MAX);
edge->loop_nest = nest;
+ edge->indirect_call = 0;
edge->uid = cgraph_edge_max_uid++;
if (caller->call_site_hash)
{
@@ -701,14 +697,15 @@ cgraph_redirect_edge_callee (struct cgraph_edge *e, struct cgraph_node *n)
e->callee = n;
}
-/* Update or remove corresponding cgraph edge if a call OLD_CALL
- in OLD_STMT changed into NEW_STMT. */
+
+/* Update or remove the corresponding cgraph edge if a GIMPLE_CALL
+ OLD_STMT changed into NEW_STMT. */
void
-cgraph_update_edges_for_call_stmt (tree old_stmt, tree old_call,
- tree new_stmt)
+cgraph_update_edges_for_call_stmt (gimple old_stmt, gimple new_stmt)
{
- tree new_call = get_call_expr_in (new_stmt);
+ tree new_call = (is_gimple_call (new_stmt)) ? gimple_call_fn (new_stmt) : 0;
+ tree old_call = (is_gimple_call (old_stmt)) ? gimple_call_fn (old_stmt) : 0;
struct cgraph_node *node = cgraph_node (cfun->decl);
if (old_call != new_call)
@@ -726,7 +723,7 @@ cgraph_update_edges_for_call_stmt (tree old_stmt, tree old_call,
cgraph_remove_edge (e);
if (new_call)
{
- new_decl = get_callee_fndecl (new_call);
+ new_decl = gimple_call_fndecl (new_stmt);
if (new_decl)
{
ne = cgraph_create_edge (node, cgraph_node (new_decl),
@@ -746,6 +743,7 @@ cgraph_update_edges_for_call_stmt (tree old_stmt, tree old_call,
}
}
+
/* Remove all callees from the node. */
void
@@ -801,6 +799,7 @@ cgraph_release_function_body (struct cgraph_node *node)
delete_tree_ssa ();
delete_tree_cfg_annotations ();
cfun->eh = NULL;
+ gimple_set_body (node->decl, NULL);
current_function_decl = old_decl;
pop_cfun();
}
@@ -893,7 +892,7 @@ cgraph_remove_node (struct cgraph_node *node)
htab_clear_slot (assembler_name_hash, slot);
}
- if (kill_body && flag_unit_at_a_time)
+ if (kill_body)
cgraph_release_function_body (node);
node->decl = NULL;
if (node->call_site_hash)
@@ -1016,8 +1015,8 @@ dump_cgraph_node (FILE *f, struct cgraph_node *node)
fprintf (f, " needed");
else if (node->reachable)
fprintf (f, " reachable");
- if (DECL_SAVED_TREE (node->decl))
- fprintf (f, " tree");
+ if (gimple_body (node->decl))
+ fprintf (f, " body");
if (node->output)
fprintf (f, " output");
if (node->local.local)
@@ -1048,6 +1047,8 @@ dump_cgraph_node (FILE *f, struct cgraph_node *node)
edge->frequency / (double)CGRAPH_FREQ_BASE);
if (!edge->inline_failed)
fprintf(f, "(inlined) ");
+ if (edge->indirect_call)
+ fprintf(f, "(indirect) ");
}
fprintf (f, "\n calls: ");
@@ -1057,6 +1058,8 @@ dump_cgraph_node (FILE *f, struct cgraph_node *node)
edge->callee->uid);
if (!edge->inline_failed)
fprintf(f, "(inlined) ");
+ if (edge->indirect_call)
+ fprintf(f, "(indirect) ");
if (edge->count)
fprintf (f, "("HOST_WIDEST_INT_PRINT_DEC"x) ",
(HOST_WIDEST_INT)edge->count);
@@ -1146,34 +1149,35 @@ bool
cgraph_function_possibly_inlined_p (tree decl)
{
if (!cgraph_global_info_ready)
- return (DECL_INLINE (decl) && !flag_really_no_inline);
+ return !DECL_UNINLINABLE (decl);
return DECL_POSSIBLY_INLINED (decl);
}
/* Create clone of E in the node N represented by CALL_EXPR the callgraph. */
struct cgraph_edge *
cgraph_clone_edge (struct cgraph_edge *e, struct cgraph_node *n,
- tree call_stmt, gcov_type count_scale, int freq_scale,
+ gimple call_stmt, gcov_type count_scale, int freq_scale,
int loop_nest, bool update_original)
{
- struct cgraph_edge *new;
+ struct cgraph_edge *new_edge;
gcov_type count = e->count * count_scale / REG_BR_PROB_BASE;
gcov_type freq = e->frequency * (gcov_type) freq_scale / CGRAPH_FREQ_BASE;
if (freq > CGRAPH_FREQ_MAX)
freq = CGRAPH_FREQ_MAX;
- new = cgraph_create_edge (n, e->callee, call_stmt, count, freq,
+ new_edge = cgraph_create_edge (n, e->callee, call_stmt, count, freq,
e->loop_nest + loop_nest);
- new->inline_failed = e->inline_failed;
+ new_edge->inline_failed = e->inline_failed;
+ new_edge->indirect_call = e->indirect_call;
if (update_original)
{
- e->count -= new->count;
+ e->count -= new_edge->count;
if (e->count < 0)
e->count = 0;
}
- cgraph_call_edge_duplication_hooks (e, new);
- return new;
+ cgraph_call_edge_duplication_hooks (e, new_edge);
+ return new_edge;
}
/* Create node representing clone of N executed COUNT times. Decrease
@@ -1183,28 +1187,28 @@ cgraph_clone_edge (struct cgraph_edge *e, struct cgraph_node *n,
function's profile to reflect the fact that part of execution is handled
by node. */
struct cgraph_node *
-cgraph_clone_node (struct cgraph_node *n, gcov_type count, int freq, int loop_nest,
- bool update_original)
+cgraph_clone_node (struct cgraph_node *n, gcov_type count, int freq,
+ int loop_nest, bool update_original)
{
- struct cgraph_node *new = cgraph_create_node ();
+ struct cgraph_node *new_node = cgraph_create_node ();
struct cgraph_edge *e;
gcov_type count_scale;
- new->decl = n->decl;
- new->origin = n->origin;
- if (new->origin)
+ new_node->decl = n->decl;
+ new_node->origin = n->origin;
+ if (new_node->origin)
{
- new->next_nested = new->origin->nested;
- new->origin->nested = new;
+ new_node->next_nested = new_node->origin->nested;
+ new_node->origin->nested = new_node;
}
- new->analyzed = n->analyzed;
- new->local = n->local;
- new->global = n->global;
- new->rtl = n->rtl;
- new->master_clone = n->master_clone;
- new->count = count;
+ new_node->analyzed = n->analyzed;
+ new_node->local = n->local;
+ new_node->global = n->global;
+ new_node->rtl = n->rtl;
+ new_node->master_clone = n->master_clone;
+ new_node->count = count;
if (n->count)
- count_scale = new->count * REG_BR_PROB_BASE / n->count;
+ count_scale = new_node->count * REG_BR_PROB_BASE / n->count;
else
count_scale = 0;
if (update_original)
@@ -1215,17 +1219,17 @@ cgraph_clone_node (struct cgraph_node *n, gcov_type count, int freq, int loop_ne
}
for (e = n->callees;e; e=e->next_callee)
- cgraph_clone_edge (e, new, e->call_stmt, count_scale, freq, loop_nest,
+ cgraph_clone_edge (e, new_node, e->call_stmt, count_scale, freq, loop_nest,
update_original);
- new->next_clone = n->next_clone;
- new->prev_clone = n;
- n->next_clone = new;
- if (new->next_clone)
- new->next_clone->prev_clone = new;
+ new_node->next_clone = n->next_clone;
+ new_node->prev_clone = n;
+ n->next_clone = new_node;
+ if (new_node->next_clone)
+ new_node->next_clone->prev_clone = new_node;
- cgraph_call_node_duplication_hooks (n, new);
- return new;
+ cgraph_call_node_duplication_hooks (n, new_node);
+ return new_node;
}
/* Return true if N is an master_clone, (see cgraph_master_clone). */
@@ -1340,8 +1344,8 @@ cgraph_add_new_function (tree fndecl, bool lowered)
{
push_cfun (DECL_STRUCT_FUNCTION (fndecl));
current_function_decl = fndecl;
- tree_register_cfg_hooks ();
- tree_lowering_passes (fndecl);
+ gimple_register_cfg_hooks ();
+ tree_lowering_passes (fndecl);
bitmap_obstack_initialize (NULL);
if (!gimple_in_ssa_p (DECL_STRUCT_FUNCTION (fndecl)))
execute_pass_list (pass_early_local_passes.pass.sub);
@@ -1362,11 +1366,11 @@ cgraph_add_new_function (tree fndecl, bool lowered)
to expansion. */
push_cfun (DECL_STRUCT_FUNCTION (fndecl));
current_function_decl = fndecl;
- tree_register_cfg_hooks ();
+ gimple_register_cfg_hooks ();
if (!lowered)
tree_lowering_passes (fndecl);
bitmap_obstack_initialize (NULL);
- if (!gimple_in_ssa_p (DECL_STRUCT_FUNCTION (fndecl)) && optimize)
+ if (!gimple_in_ssa_p (DECL_STRUCT_FUNCTION (fndecl)))
execute_pass_list (pass_early_local_passes.pass.sub);
bitmap_obstack_release (NULL);
tree_rest_of_compilation (fndecl);
diff --git a/gcc/cgraph.h b/gcc/cgraph.h
index 070bd77dcdc..7a19dd6e059 100644
--- a/gcc/cgraph.h
+++ b/gcc/cgraph.h
@@ -91,7 +91,7 @@ struct cgraph_local_info GTY(())
};
/* Information about the function that needs to be computed globally
- once compilation is finished. Available only with -funit-at-time. */
+ once compilation is finished. Available only with -funit-at-a-time. */
struct cgraph_global_info GTY(())
{
@@ -100,7 +100,8 @@ struct cgraph_global_info GTY(())
/* Expected offset of the stack frame of inlined function. */
HOST_WIDE_INT stack_frame_offset;
- /* For inline clones this points to the function they will be inlined into. */
+ /* For inline clones this points to the function they will be
+ inlined into. */
struct cgraph_node *inlined_to;
/* Estimated size of the function after inlining. */
@@ -196,7 +197,7 @@ struct cgraph_edge GTY((chain_next ("%h.next_caller"), chain_prev ("%h.prev_call
struct cgraph_edge *next_caller;
struct cgraph_edge *prev_callee;
struct cgraph_edge *next_callee;
- tree call_stmt;
+ gimple call_stmt;
PTR GTY ((skip (""))) aux;
/* When NULL, inline this call. When non-NULL, points to the explanation
why function was not inlined. */
@@ -208,7 +209,9 @@ struct cgraph_edge GTY((chain_next ("%h.next_caller"), chain_prev ("%h.prev_call
per function call. The range is 0 to CGRAPH_FREQ_MAX. */
int frequency;
/* Depth of loop nest, 1 means no loop nest. */
- int loop_nest;
+ unsigned int loop_nest : 31;
+ /* Whether this edge describes a call that was originally indirect. */
+ unsigned int indirect_call : 1;
/* Unique id of the edge. */
int uid;
};
@@ -304,19 +307,19 @@ void cgraph_release_function_body (struct cgraph_node *);
void cgraph_node_remove_callees (struct cgraph_node *node);
struct cgraph_edge *cgraph_create_edge (struct cgraph_node *,
struct cgraph_node *,
- tree, gcov_type, int, int);
+ gimple, gcov_type, int, int);
struct cgraph_node *cgraph_node (tree);
struct cgraph_node *cgraph_node_for_asm (tree asmname);
-struct cgraph_edge *cgraph_edge (struct cgraph_node *, tree);
-void cgraph_set_call_stmt (struct cgraph_edge *, tree);
-void cgraph_update_edges_for_call_stmt (tree, tree, tree);
+struct cgraph_edge *cgraph_edge (struct cgraph_node *, gimple);
+void cgraph_set_call_stmt (struct cgraph_edge *, gimple);
+void cgraph_update_edges_for_call_stmt (gimple, gimple);
struct cgraph_local_info *cgraph_local_info (tree);
struct cgraph_global_info *cgraph_global_info (tree);
struct cgraph_rtl_info *cgraph_rtl_info (tree);
const char * cgraph_node_name (struct cgraph_node *);
struct cgraph_edge * cgraph_clone_edge (struct cgraph_edge *,
struct cgraph_node *,
- tree, gcov_type, int, int, bool);
+ gimple, gcov_type, int, int, bool);
struct cgraph_node * cgraph_clone_node (struct cgraph_node *, gcov_type, int,
int, bool);
@@ -376,6 +379,7 @@ void cgraph_remove_node_duplication_hook (struct cgraph_2node_hook_list *);
/* In cgraphbuild.c */
unsigned int rebuild_cgraph_edges (void);
+int compute_call_stmt_bb_frequency (basic_block bb);
/* In ipa.c */
bool cgraph_remove_unreachable_nodes (bool, FILE *);
@@ -401,6 +405,7 @@ bool varpool_assemble_decl (struct varpool_node *node);
bool varpool_analyze_pending_decls (void);
void varpool_output_debug_info (void);
void varpool_remove_unreferenced_decls (void);
+void varpool_empty_needed_queue (void);
/* Walk all reachable static variables. */
#define FOR_EACH_STATIC_VARIABLE(node) \
diff --git a/gcc/cgraphbuild.c b/gcc/cgraphbuild.c
index 19e198344b6..958fed7b0cc 100644
--- a/gcc/cgraphbuild.c
+++ b/gcc/cgraphbuild.c
@@ -1,5 +1,6 @@
/* Callgraph construction.
- Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008
+ Free Software Foundation, Inc.
Contributed by Jan Hubicka
This file is part of GCC.
@@ -28,7 +29,7 @@ along with GCC; see the file COPYING3. If not see
#include "pointer-set.h"
#include "cgraph.h"
#include "intl.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "tree-pass.h"
/* Walk tree and record all calls and references to functions/variables.
@@ -38,6 +39,7 @@ static tree
record_reference (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
{
tree t = *tp;
+ tree decl;
switch (TREE_CODE (t))
{
@@ -52,32 +54,11 @@ record_reference (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
case FDESC_EXPR:
case ADDR_EXPR:
- if (flag_unit_at_a_time)
- {
- /* Record dereferences to the functions. This makes the
- functions reachable unconditionally. */
- tree decl = TREE_OPERAND (*tp, 0);
- if (TREE_CODE (decl) == FUNCTION_DECL)
- cgraph_mark_needed_node (cgraph_node (decl));
- }
- break;
-
- case OMP_PARALLEL:
- if (flag_unit_at_a_time)
- {
- if (OMP_PARALLEL_FN (*tp))
- cgraph_mark_needed_node (cgraph_node (OMP_PARALLEL_FN (*tp)));
- }
- break;
-
- case OMP_TASK:
- if (flag_unit_at_a_time)
- {
- if (OMP_TASK_FN (*tp))
- cgraph_mark_needed_node (cgraph_node (OMP_TASK_FN (*tp)));
- if (OMP_TASK_COPYFN (*tp))
- cgraph_mark_needed_node (cgraph_node (OMP_TASK_COPYFN (*tp)));
- }
+ /* Record dereferences to the functions. This makes the
+ functions reachable unconditionally. */
+ decl = TREE_OPERAND (*tp, 0);
+ if (TREE_CODE (decl) == FUNCTION_DECL)
+ cgraph_mark_needed_node (cgraph_node (decl));
break;
default:
@@ -115,13 +96,32 @@ initialize_inline_failed (struct cgraph_node *node)
"considered for inlining");
else if (!node->local.inlinable)
e->inline_failed = N_("function not inlinable");
- else if (CALL_STMT_CANNOT_INLINE_P (e->call_stmt))
+ else if (gimple_call_cannot_inline_p (e->call_stmt))
e->inline_failed = N_("mismatched arguments");
else
e->inline_failed = N_("function not considered for inlining");
}
}
+/* Computes the frequency of the call statement so that it can be stored in
+ cgraph_edge. BB is the basic block of the call statement. */
+int
+compute_call_stmt_bb_frequency (basic_block bb)
+{
+ int entry_freq = ENTRY_BLOCK_PTR->frequency;
+ int freq;
+
+ if (!entry_freq)
+ entry_freq = 1;
+
+ freq = (!bb->frequency && !entry_freq ? CGRAPH_FREQ_BASE
+ : bb->frequency * CGRAPH_FREQ_BASE / entry_freq);
+ if (freq > CGRAPH_FREQ_MAX)
+ freq = CGRAPH_FREQ_MAX;
+
+ return freq;
+}
+
/* Create cgraph edges for function calls.
Also look for functions and variables having addresses taken. */
@@ -131,42 +131,54 @@ build_cgraph_edges (void)
basic_block bb;
struct cgraph_node *node = cgraph_node (current_function_decl);
struct pointer_set_t *visited_nodes = pointer_set_create ();
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
tree step;
- int entry_freq = ENTRY_BLOCK_PTR->frequency;
-
- if (!entry_freq)
- entry_freq = 1;
/* Create the callgraph edges and record the nodes referenced by the function.
body. */
FOR_EACH_BB (bb)
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- tree stmt = bsi_stmt (bsi);
- tree call = get_call_expr_in (stmt);
+ gimple stmt = gsi_stmt (gsi);
tree decl;
- if (call && (decl = get_callee_fndecl (call)))
+ if (is_gimple_call (stmt) && (decl = gimple_call_fndecl (stmt)))
{
- int i;
- int n = call_expr_nargs (call);
- int freq = (!bb->frequency && !entry_freq ? CGRAPH_FREQ_BASE
- : bb->frequency * CGRAPH_FREQ_BASE / entry_freq);
- if (freq > CGRAPH_FREQ_MAX)
- freq = CGRAPH_FREQ_MAX;
+ size_t i;
+ size_t n = gimple_call_num_args (stmt);
cgraph_create_edge (node, cgraph_node (decl), stmt,
- bb->count, freq,
+ bb->count, compute_call_stmt_bb_frequency (bb),
bb->loop_depth);
for (i = 0; i < n; i++)
- walk_tree (&CALL_EXPR_ARG (call, i),
- record_reference, node, visited_nodes);
- if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT)
- walk_tree (&GIMPLE_STMT_OPERAND (stmt, 0),
- record_reference, node, visited_nodes);
+ walk_tree (gimple_call_arg_ptr (stmt, i), record_reference,
+ node, visited_nodes);
+ if (gimple_call_lhs (stmt))
+ walk_tree (gimple_call_lhs_ptr (stmt), record_reference, node,
+ visited_nodes);
}
else
- walk_tree (bsi_stmt_ptr (bsi), record_reference, node, visited_nodes);
+ {
+ struct walk_stmt_info wi;
+ memset (&wi, 0, sizeof (wi));
+ wi.info = node;
+ wi.pset = visited_nodes;
+ walk_gimple_op (stmt, record_reference, &wi);
+ if (gimple_code (stmt) == GIMPLE_OMP_PARALLEL
+ && gimple_omp_parallel_child_fn (stmt))
+ {
+ tree fn = gimple_omp_parallel_child_fn (stmt);
+ cgraph_mark_needed_node (cgraph_node (fn));
+ }
+ if (gimple_code (stmt) == GIMPLE_OMP_TASK)
+ {
+ tree fn = gimple_omp_task_child_fn (stmt);
+ if (fn)
+ cgraph_mark_needed_node (cgraph_node (fn));
+ fn = gimple_omp_task_copy_fn (stmt);
+ if (fn)
+ cgraph_mark_needed_node (cgraph_node (fn));
+ }
+ }
}
/* Look for initializers of constant variables and private statics. */
@@ -176,8 +188,7 @@ build_cgraph_edges (void)
{
tree decl = TREE_VALUE (step);
if (TREE_CODE (decl) == VAR_DECL
- && (TREE_STATIC (decl) && !DECL_EXTERNAL (decl))
- && flag_unit_at_a_time)
+ && (TREE_STATIC (decl) && !DECL_EXTERNAL (decl)))
varpool_finalize_decl (decl);
else if (TREE_CODE (decl) == VAR_DECL && DECL_INITIAL (decl))
walk_tree (&DECL_INITIAL (decl), record_reference, node, visited_nodes);
@@ -226,32 +237,23 @@ rebuild_cgraph_edges (void)
{
basic_block bb;
struct cgraph_node *node = cgraph_node (current_function_decl);
- block_stmt_iterator bsi;
- int entry_freq = ENTRY_BLOCK_PTR->frequency;
-
- if (!entry_freq)
- entry_freq = 1;
+ gimple_stmt_iterator gsi;
cgraph_node_remove_callees (node);
node->count = ENTRY_BLOCK_PTR->count;
FOR_EACH_BB (bb)
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- tree stmt = bsi_stmt (bsi);
- tree call = get_call_expr_in (stmt);
+ gimple stmt = gsi_stmt (gsi);
tree decl;
- if (call && (decl = get_callee_fndecl (call)))
- {
- int freq = (!bb->frequency && !entry_freq ? CGRAPH_FREQ_BASE
- : bb->frequency * CGRAPH_FREQ_BASE / entry_freq);
- if (freq > CGRAPH_FREQ_MAX)
- freq = CGRAPH_FREQ_MAX;
- cgraph_create_edge (node, cgraph_node (decl), stmt,
- bb->count, freq, bb->loop_depth);
- }
+ if (is_gimple_call (stmt) && (decl = gimple_call_fndecl (stmt)))
+ cgraph_create_edge (node, cgraph_node (decl), stmt,
+ bb->count, compute_call_stmt_bb_frequency (bb),
+ bb->loop_depth);
+
}
initialize_inline_failed (node);
gcc_assert (!node->global.inlined_to);
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index 2dcccc1bd93..ae3dee417da 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -45,7 +45,7 @@ along with GCC; see the file COPYING3. If not see
This function is called once (source level) compilation unit is finalized
and it will no longer change.
- In the unit-at-a-time the call-graph construction and local function
+ In the the call-graph construction and local function
analysis takes place here. Bodies of unreachable functions are released
to conserve memory usage.
@@ -77,9 +77,7 @@ along with GCC; see the file COPYING3. If not see
??? On the tree-ssa genericizing should take place here and we will avoid
need for these hooks (replacing them by genericizing hook)
- We implement two compilation modes.
-
- - unit-at-a-time: In this mode analyzing of all functions is deferred
+ Analyzing of all functions is deferred
to cgraph_finalize_compilation_unit and expansion into cgraph_optimize.
In cgraph_finalize_compilation_unit the reachable functions are
@@ -105,23 +103,7 @@ along with GCC; see the file COPYING3. If not see
??? Reorganize code so variables are output very last and only if they
really has been referenced by produced code, so we catch more cases
- where reference has been optimized out.
-
- - non-unit-at-a-time
-
- All functions are variables are output as early as possible to conserve
- memory consumption. This may or may not result in less memory used but
- it is still needed for some legacy code that rely on particular ordering
- of things output from the compiler.
-
- Varpool data structures are not used and variables are output directly.
-
- Functions are output early using call of
- cgraph_assemble_pending_function from cgraph_finalize_function. The
- decision on whether function is needed is made more conservative so
- uninlinable static functions are needed too. During the call-graph
- construction the edge destinations are not marked as reachable and it
- is completely relied upon assemble_variable to mark them. */
+ where reference has been optimized out. */
#include "config.h"
@@ -148,7 +130,8 @@ along with GCC; see the file COPYING3. If not see
#include "intl.h"
#include "function.h"
#include "ipa-prop.h"
-#include "tree-gimple.h"
+#include "gimple.h"
+#include "tree-iterator.h"
#include "tree-pass.h"
#include "output.h"
@@ -190,7 +173,6 @@ record_cdtor_fn (tree fndecl)
VEC_safe_push (tree, gc, static_dtors, fndecl);
DECL_STATIC_DESTRUCTOR (fndecl) = 0;
}
- DECL_INLINE (fndecl) = 1;
node = cgraph_node (fndecl);
node->local.disregard_inline_limits = 1;
cgraph_mark_reachable_node (node);
@@ -326,13 +308,11 @@ cgraph_build_cdtor_fns (void)
/* Determine if function DECL is needed. That is, visible to something
either outside this translation unit, something magic in the system
- configury, or (if not doing unit-at-a-time) to something we haven't
- seen yet. */
+ configury. */
static bool
decide_is_function_needed (struct cgraph_node *node, tree decl)
{
- tree origin;
if (MAIN_NAME_P (DECL_NAME (decl))
&& TREE_PUBLIC (decl))
{
@@ -344,9 +324,6 @@ decide_is_function_needed (struct cgraph_node *node, tree decl)
if (node->local.externally_visible)
return true;
- if (!flag_unit_at_a_time && lookup_attribute ("used", DECL_ATTRIBUTES (decl)))
- return true;
-
/* ??? If the assembler name is set by hand, it is possible to assemble
the name later after finalizing the function and the fact is noticed
in assemble_name then. This is arguably a bug. */
@@ -389,32 +366,6 @@ decide_is_function_needed (struct cgraph_node *node, tree decl)
if (DECL_STATIC_CONSTRUCTOR (decl) || DECL_STATIC_DESTRUCTOR (decl))
return true;
- if (flag_unit_at_a_time)
- return false;
-
- /* If not doing unit at a time, then we'll only defer this function
- if its marked for inlining. Otherwise we want to emit it now. */
-
- /* "extern inline" functions are never output locally. */
- if (DECL_EXTERNAL (decl))
- return false;
- /* Nested functions of extern inline function shall not be emit unless
- we inlined the origin. */
- for (origin = decl_function_context (decl); origin;
- origin = decl_function_context (origin))
- if (DECL_EXTERNAL (origin))
- return false;
- /* We want to emit COMDAT functions only when absolutely necessary. */
- if (DECL_COMDAT (decl))
- return false;
- if (!DECL_INLINE (decl)
- || (!node->local.disregard_inline_limits
- /* When declared inline, defer even the uninlinable functions.
- This allows them to be eliminated when unused. */
- && !DECL_DECLARED_INLINE_P (decl)
- && (!node->local.inlinable || !cgraph_default_inline_p (node, NULL))))
- return true;
-
return false;
}
@@ -454,7 +405,7 @@ cgraph_process_new_functions (void)
transformations that has been already performed on the whole
cgraph but not on this function. */
- tree_register_cfg_hooks ();
+ gimple_register_cfg_hooks ();
if (!node->analyzed)
cgraph_analyze_function (node);
push_cfun (DECL_STRUCT_FUNCTION (fndecl));
@@ -487,39 +438,6 @@ cgraph_process_new_functions (void)
return output;
}
-/* When not doing unit-at-a-time, output all functions enqueued.
- Return true when such a functions were found. */
-
-static bool
-cgraph_assemble_pending_functions (void)
-{
- bool output = false;
-
- if (flag_unit_at_a_time || errorcount || sorrycount)
- return false;
-
- cgraph_output_pending_asms ();
-
- while (cgraph_nodes_queue)
- {
- struct cgraph_node *n = cgraph_nodes_queue;
-
- cgraph_nodes_queue = cgraph_nodes_queue->next_needed;
- n->next_needed = NULL;
- if (!n->global.inlined_to
- && !n->alias
- && !DECL_EXTERNAL (n->decl))
- {
- cgraph_expand_function (n);
- output = true;
- }
- output |= cgraph_process_new_functions ();
- }
-
- return output;
-}
-
-
/* As an GCC extension we allow redefinition of the function. The
semantics when both copies of bodies differ is not well defined.
We replace the old body with new body so in unit at a time mode
@@ -533,12 +451,11 @@ cgraph_assemble_pending_functions (void)
static void
cgraph_reset_node (struct cgraph_node *node)
{
- /* If node->output is set, then this is a unit-at-a-time compilation
- and we have already begun whole-unit analysis. This is *not*
- testing for whether we've already emitted the function. That
- case can be sort-of legitimately seen with real function
- redefinition errors. I would argue that the front end should
- never present us with such a case, but don't enforce that for now. */
+ /* If node->output is set, then we have already begun whole-unit analysis.
+ This is *not* testing for whether we've already emitted the function.
+ That case can be sort-of legitimately seen with real function redefinition
+ errors. I would argue that the front end should never present us with
+ such a case, but don't enforce that for now. */
gcc_assert (!node->output);
/* Reset our data structures so we can analyze the function again. */
@@ -549,18 +466,6 @@ cgraph_reset_node (struct cgraph_node *node)
node->local.redefined_extern_inline = true;
node->local.finalized = false;
- if (!flag_unit_at_a_time)
- {
- struct cgraph_node *n, *next;
-
- for (n = cgraph_nodes; n; n = next)
- {
- next = n->next;
- if (n->global.inlined_to == node)
- cgraph_remove_node (n);
- }
- }
-
cgraph_node_remove_callees (node);
/* We may need to re-queue the node for assembling in case
@@ -609,11 +514,6 @@ cgraph_finalize_function (tree decl, bool nested)
lower_nested_functions (decl);
gcc_assert (!node->nested);
- /* If not unit at a time, then we need to create the call graph
- now, so that called functions can be queued and emitted now. */
- if (!flag_unit_at_a_time)
- cgraph_analyze_function (node);
-
if (decide_is_function_needed (node, decl))
cgraph_mark_needed_node (node);
@@ -623,14 +523,6 @@ cgraph_finalize_function (tree decl, bool nested)
if ((TREE_PUBLIC (decl) && !DECL_COMDAT (decl) && !DECL_EXTERNAL (decl)))
cgraph_mark_reachable_node (node);
- /* If not unit at a time, go ahead and emit everything we've found
- to be reachable at this time. */
- if (!nested)
- {
- if (!cgraph_assemble_pending_functions ())
- ggc_collect ();
- }
-
/* If we've not yet emitted decl, tell the debug info about it. */
if (!TREE_ASM_WRITTEN (decl))
(*debug_hooks->deferred_inline_function) (decl);
@@ -638,6 +530,9 @@ cgraph_finalize_function (tree decl, bool nested)
/* Possibly warn about unused parameters. */
if (warn_unused_parameter)
do_warn_unused_parameter (decl);
+
+ if (!nested)
+ ggc_collect ();
}
/* C99 extern inline keywords allow changing of declaration after function
@@ -661,7 +556,7 @@ verify_cgraph_node (struct cgraph_node *node)
struct function *this_cfun = DECL_STRUCT_FUNCTION (node->decl);
struct function *saved_cfun = cfun;
basic_block this_block;
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
bool error_found = false;
if (errorcount || sorrycount)
@@ -743,7 +638,8 @@ verify_cgraph_node (struct cgraph_node *node)
}
if (node->analyzed
- && DECL_SAVED_TREE (node->decl) && !TREE_ASM_WRITTEN (node->decl)
+ && gimple_body (node->decl)
+ && !TREE_ASM_WRITTEN (node->decl)
&& (!DECL_EXTERNAL (node->decl) || node->global.inlined_to))
{
if (this_cfun->cfg)
@@ -754,12 +650,13 @@ verify_cgraph_node (struct cgraph_node *node)
/* Reach the trees by walking over the CFG, and note the
enclosing basic-blocks in the call edges. */
FOR_EACH_BB_FN (this_block, this_cfun)
- for (bsi = bsi_start (this_block); !bsi_end_p (bsi); bsi_next (&bsi))
+ for (gsi = gsi_start_bb (this_block);
+ !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
- tree stmt = bsi_stmt (bsi);
- tree call = get_call_expr_in (stmt);
+ gimple stmt = gsi_stmt (gsi);
tree decl;
- if (call && (decl = get_callee_fndecl (call)))
+ if (is_gimple_call (stmt) && (decl = gimple_call_fndecl (stmt)))
{
struct cgraph_edge *e = cgraph_edge (node, stmt);
if (e)
@@ -767,7 +664,7 @@ verify_cgraph_node (struct cgraph_node *node)
if (e->aux)
{
error ("shared call_stmt:");
- debug_generic_stmt (stmt);
+ debug_gimple_stmt (stmt);
error_found = true;
}
if (e->callee->decl != cgraph_node (decl)->decl
@@ -783,7 +680,7 @@ verify_cgraph_node (struct cgraph_node *node)
else
{
error ("missing callgraph edge for call stmt:");
- debug_generic_stmt (stmt);
+ debug_gimple_stmt (stmt);
error_found = true;
}
}
@@ -796,12 +693,12 @@ verify_cgraph_node (struct cgraph_node *node)
for (e = node->callees; e; e = e->next_callee)
{
- if (!e->aux)
+ if (!e->aux && !e->indirect_call)
{
error ("edge %s->%s has no corresponding call_stmt",
cgraph_node_name (e->caller),
cgraph_node_name (e->callee));
- debug_generic_stmt (e->call_stmt);
+ debug_gimple_stmt (e->call_stmt);
error_found = true;
}
e->aux = 0;
@@ -855,16 +752,6 @@ cgraph_analyze_function (struct cgraph_node *node)
cgraph_lower_function (node);
node->analyzed = true;
- if (!flag_unit_at_a_time && !sorrycount && !errorcount)
- {
- bitmap_obstack_initialize (NULL);
- tree_register_cfg_hooks ();
- execute_pass_list (pass_early_local_passes.pass.sub);
- free_dominance_info (CDI_POST_DOMINATORS);
- free_dominance_info (CDI_DOMINATORS);
- bitmap_obstack_release (NULL);
- }
-
pop_cfun ();
current_function_decl = NULL;
}
@@ -972,7 +859,7 @@ cgraph_analyze_functions (void)
{
fprintf (cgraph_dump_file, "Initial entry points:");
for (node = cgraph_nodes; node != first_analyzed; node = node->next)
- if (node->needed && DECL_SAVED_TREE (node->decl))
+ if (node->needed && gimple_body (node->decl))
fprintf (cgraph_dump_file, " %s", cgraph_node_name (node));
fprintf (cgraph_dump_file, "\n");
}
@@ -994,14 +881,14 @@ cgraph_analyze_functions (void)
/* ??? It is possible to create extern inline function and later using
weak alias attribute to kill its body. See
gcc.c-torture/compile/20011119-1.c */
- if (!DECL_SAVED_TREE (decl))
+ if (!DECL_STRUCT_FUNCTION (decl))
{
cgraph_reset_node (node);
continue;
}
gcc_assert (!node->analyzed && node->reachable);
- gcc_assert (DECL_SAVED_TREE (decl));
+ gcc_assert (gimple_body (decl));
cgraph_analyze_function (node);
@@ -1024,7 +911,7 @@ cgraph_analyze_functions (void)
{
fprintf (cgraph_dump_file, "Unit entry points:");
for (node = cgraph_nodes; node != first_analyzed; node = node->next)
- if (node->needed && DECL_SAVED_TREE (node->decl))
+ if (node->needed && gimple_body (node->decl))
fprintf (cgraph_dump_file, " %s", cgraph_node_name (node));
fprintf (cgraph_dump_file, "\n\nInitial ");
dump_cgraph (cgraph_dump_file);
@@ -1038,10 +925,10 @@ cgraph_analyze_functions (void)
tree decl = node->decl;
next = node->next;
- if (node->local.finalized && !DECL_SAVED_TREE (decl))
+ if (node->local.finalized && !gimple_body (decl))
cgraph_reset_node (node);
- if (!node->reachable && DECL_SAVED_TREE (decl))
+ if (!node->reachable && gimple_body (decl))
{
if (cgraph_dump_file)
fprintf (cgraph_dump_file, " %s", cgraph_node_name (node));
@@ -1050,7 +937,7 @@ cgraph_analyze_functions (void)
}
else
node->next_needed = NULL;
- gcc_assert (!node->local.finalized || DECL_SAVED_TREE (decl));
+ gcc_assert (!node->local.finalized || gimple_body (decl));
gcc_assert (node->analyzed == node->local.finalized);
}
if (cgraph_dump_file)
@@ -1072,14 +959,6 @@ cgraph_finalize_compilation_unit (void)
finish_aliases_1 ();
- if (!flag_unit_at_a_time)
- {
- cgraph_output_pending_asms ();
- cgraph_assemble_pending_functions ();
- varpool_output_debug_info ();
- return;
- }
-
if (!quiet_flag)
{
fprintf (stderr, "\nAnalyzing compilation unit\n");
@@ -1111,7 +990,7 @@ cgraph_mark_functions_to_output (void)
/* We need to output all local functions that are used and not
always inlined, as well as those that are reachable from
outside the current compilation unit. */
- if (DECL_SAVED_TREE (decl)
+ if (gimple_body (decl)
&& !node->global.inlined_to
&& (node->needed
|| (e && node->reachable))
@@ -1122,14 +1001,16 @@ cgraph_mark_functions_to_output (void)
{
/* We should've reclaimed all functions that are not needed. */
#ifdef ENABLE_CHECKING
- if (!node->global.inlined_to && DECL_SAVED_TREE (decl)
+ if (!node->global.inlined_to
+ && gimple_body (decl)
&& !DECL_EXTERNAL (decl))
{
dump_cgraph_node (stderr, node);
internal_error ("failed to reclaim unneeded function");
}
#endif
- gcc_assert (node->global.inlined_to || !DECL_SAVED_TREE (decl)
+ gcc_assert (node->global.inlined_to
+ || !gimple_body (decl)
|| DECL_EXTERNAL (decl));
}
@@ -1147,8 +1028,7 @@ cgraph_expand_function (struct cgraph_node *node)
/* We ought to not compile any inline clones. */
gcc_assert (!node->global.inlined_to);
- if (flag_unit_at_a_time)
- announce_function (decl);
+ announce_function (decl);
gcc_assert (node->lowered);
@@ -1160,7 +1040,6 @@ cgraph_expand_function (struct cgraph_node *node)
/* Make sure that BE didn't give up on compiling. */
/* ??? Can happen with nested function of extern inline. */
gcc_assert (TREE_ASM_WRITTEN (decl));
-
current_function_decl = NULL;
if (!cgraph_preserve_function_body_p (decl))
{
@@ -1291,6 +1170,16 @@ cgraph_output_in_order (void)
nodes[i].u.a = pa;
}
+ /* In toplevel reorder mode we output all statics; mark them as needed. */
+ for (i = 0; i < max; ++i)
+ {
+ if (nodes[i].kind == ORDER_VAR)
+ {
+ varpool_mark_needed_node (nodes[i].u.v);
+ }
+ }
+ varpool_empty_needed_queue ();
+
for (i = 0; i < max; ++i)
{
switch (nodes[i].kind)
@@ -1325,10 +1214,8 @@ bool
cgraph_preserve_function_body_p (tree decl)
{
struct cgraph_node *node;
- if (!cgraph_global_info_ready)
- return (flag_really_no_inline
- ? DECL_DISREGARD_INLINE_LIMITS (decl)
- : DECL_INLINE (decl));
+
+ gcc_assert (cgraph_global_info_ready);
/* Look if there is any clone around. */
for (node = cgraph_node (decl); node; node = node->next_clone)
if (node->global.inlined_to)
@@ -1341,7 +1228,7 @@ ipa_passes (void)
{
set_cfun (NULL);
current_function_decl = NULL;
- tree_register_cfg_hooks ();
+ gimple_register_cfg_hooks ();
bitmap_obstack_initialize (NULL);
execute_ipa_pass_list (all_ipa_passes);
bitmap_obstack_release (NULL);
@@ -1362,16 +1249,6 @@ cgraph_optimize (void)
/* Call functions declared with the "constructor" or "destructor"
attribute. */
cgraph_build_cdtor_fns ();
- if (!flag_unit_at_a_time)
- {
- cgraph_assemble_pending_functions ();
- cgraph_process_new_functions ();
- cgraph_state = CGRAPH_STATE_FINISHED;
- cgraph_output_pending_asms ();
- varpool_assemble_pending_decls ();
- varpool_output_debug_info ();
- return;
- }
/* Frontend may output common variables after the unit has been finalized.
It is safe to deal with them here as they are always zero initialized. */
@@ -1443,8 +1320,7 @@ cgraph_optimize (void)
verify_cgraph ();
/* Double check that all inline clones are gone and that all
function bodies have been released from memory. */
- if (flag_unit_at_a_time
- && !(sorrycount || errorcount))
+ if (!(sorrycount || errorcount))
{
struct cgraph_node *node;
bool error_found = false;
@@ -1452,7 +1328,7 @@ cgraph_optimize (void)
for (node = cgraph_nodes; node; node = node->next)
if (node->analyzed
&& (node->global.inlined_to
- || DECL_SAVED_TREE (node->decl)))
+ || gimple_body (node->decl)))
{
error_found = true;
dump_cgraph_node (stderr, node);
@@ -1541,10 +1417,10 @@ update_call_expr (struct cgraph_node *new_version)
struct cgraph_edge *e;
gcc_assert (new_version);
+
+ /* Update the call expr on the edges to call the new version. */
for (e = new_version->callers; e; e = e->next_caller)
- /* Update the call expr on the edges
- to call the new version. */
- TREE_OPERAND (CALL_EXPR_FN (get_call_expr_in (e->call_stmt)), 0) = new_version->decl;
+ gimple_call_set_fndecl (e->call_stmt, new_version->decl);
}
@@ -1673,29 +1549,10 @@ save_inline_function_body (struct cgraph_node *node)
cgraph_lower_function (node);
- /* In non-unit-at-a-time we construct full fledged clone we never output to
- assembly file. This clone is pointed out by inline_decl of original function
- and inlining infrastructure knows how to deal with this. */
- if (!flag_unit_at_a_time)
- {
- struct cgraph_edge *e;
-
- first_clone = cgraph_clone_node (node, node->count, 0, CGRAPH_FREQ_BASE,
- false);
- first_clone->needed = 0;
- first_clone->reachable = 1;
- /* Recursively clone all bodies. */
- for (e = first_clone->callees; e; e = e->next_callee)
- if (!e->inline_failed)
- cgraph_clone_inlined_nodes (e, true, false);
- }
- else
- first_clone = node->next_clone;
+ first_clone = node->next_clone;
first_clone->decl = copy_node (node->decl);
node->next_clone = NULL;
- if (!flag_unit_at_a_time)
- node->inline_decl = first_clone->decl;
first_clone->prev_clone = NULL;
cgraph_insert_node_to_hashtable (first_clone);
gcc_assert (first_clone == cgraph_node (first_clone->decl));
diff --git a/gcc/collect2.c b/gcc/collect2.c
index 314d30d7717..cdfe4e6be6d 100644
--- a/gcc/collect2.c
+++ b/gcc/collect2.c
@@ -236,8 +236,21 @@ static struct path_prefix *libpaths[3] = {&cmdline_lib_dirs,
&libpath_lib_dirs, NULL};
#endif
+/* Special kinds of symbols that a name may denote. */
+
+typedef enum {
+ SYM_REGULAR = 0, /* nothing special */
+
+ SYM_CTOR = 1, /* constructor */
+ SYM_DTOR = 2, /* destructor */
+ SYM_INIT = 3, /* shared object routine that calls all the ctors */
+ SYM_FINI = 4, /* shared object routine that calls all the dtors */
+ SYM_DWEH = 5 /* DWARF exception handling table */
+} symkind;
+
+static symkind is_ctor_dtor (const char *);
+
static void handler (int);
-static int is_ctor_dtor (const char *);
static char *find_a_file (struct path_prefix *, const char *);
static void add_prefix (struct path_prefix *, const char *);
static void prefix_from_env (const char *, struct path_prefix *);
@@ -519,12 +532,9 @@ dump_file (const char *name, FILE *to)
fclose (stream);
}
-/* Decide whether the given symbol is: a constructor (1), a destructor
- (2), a routine in a shared object that calls all the constructors
- (3) or destructors (4), a DWARF exception-handling table (5), or
- nothing special (0). */
+/* Return the kind of symbol denoted by name S. */
-static int
+static symkind
is_ctor_dtor (const char *s)
{
struct names { const char *const name; const int len; const int ret;
@@ -536,27 +546,27 @@ is_ctor_dtor (const char *s)
static const struct names special[] = {
#ifndef NO_DOLLAR_IN_LABEL
- { "GLOBAL__I$", sizeof ("GLOBAL__I$")-1, 1, 0 },
- { "GLOBAL__D$", sizeof ("GLOBAL__D$")-1, 2, 0 },
+ { "GLOBAL__I$", sizeof ("GLOBAL__I$")-1, SYM_CTOR, 0 },
+ { "GLOBAL__D$", sizeof ("GLOBAL__D$")-1, SYM_DTOR, 0 },
#else
#ifndef NO_DOT_IN_LABEL
- { "GLOBAL__I.", sizeof ("GLOBAL__I.")-1, 1, 0 },
- { "GLOBAL__D.", sizeof ("GLOBAL__D.")-1, 2, 0 },
+ { "GLOBAL__I.", sizeof ("GLOBAL__I.")-1, SYM_CTOR, 0 },
+ { "GLOBAL__D.", sizeof ("GLOBAL__D.")-1, SYM_DTOR, 0 },
#endif /* NO_DOT_IN_LABEL */
#endif /* NO_DOLLAR_IN_LABEL */
- { "GLOBAL__I_", sizeof ("GLOBAL__I_")-1, 1, 0 },
- { "GLOBAL__D_", sizeof ("GLOBAL__D_")-1, 2, 0 },
- { "GLOBAL__F_", sizeof ("GLOBAL__F_")-1, 5, 0 },
- { "GLOBAL__FI_", sizeof ("GLOBAL__FI_")-1, 3, 0 },
- { "GLOBAL__FD_", sizeof ("GLOBAL__FD_")-1, 4, 0 },
- { NULL, 0, 0, 0 }
+ { "GLOBAL__I_", sizeof ("GLOBAL__I_")-1, SYM_CTOR, 0 },
+ { "GLOBAL__D_", sizeof ("GLOBAL__D_")-1, SYM_DTOR, 0 },
+ { "GLOBAL__F_", sizeof ("GLOBAL__F_")-1, SYM_DWEH, 0 },
+ { "GLOBAL__FI_", sizeof ("GLOBAL__FI_")-1, SYM_INIT, 0 },
+ { "GLOBAL__FD_", sizeof ("GLOBAL__FD_")-1, SYM_FINI, 0 },
+ { NULL, 0, SYM_REGULAR, 0 }
};
while ((ch = *s) == '_')
++s;
if (s == orig_s)
- return 0;
+ return SYM_REGULAR;
for (p = &special[0]; p->len > 0; p++)
{
@@ -567,7 +577,7 @@ is_ctor_dtor (const char *s)
return p->ret;
}
}
- return 0;
+ return SYM_REGULAR;
}
/* We maintain two prefix lists: one from COMPILER_PATH environment variable
@@ -2171,17 +2181,17 @@ scan_prog_file (const char *prog_name, enum pass which_pass)
*end = '\0';
switch (is_ctor_dtor (name))
{
- case 1:
+ case SYM_CTOR:
if (which_pass != PASS_LIB)
add_to_list (&constructors, name);
break;
- case 2:
+ case SYM_DTOR:
if (which_pass != PASS_LIB)
add_to_list (&destructors, name);
break;
- case 3:
+ case SYM_INIT:
if (which_pass != PASS_LIB)
fatal ("init function found in object %s", prog_name);
#ifndef LD_INIT_SWITCH
@@ -2189,7 +2199,7 @@ scan_prog_file (const char *prog_name, enum pass which_pass)
#endif
break;
- case 4:
+ case SYM_FINI:
if (which_pass != PASS_LIB)
fatal ("fini function found in object %s", prog_name);
#ifndef LD_FINI_SWITCH
@@ -2197,7 +2207,7 @@ scan_prog_file (const char *prog_name, enum pass which_pass)
#endif
break;
- case 5:
+ case SYM_DWEH:
if (which_pass != PASS_LIB)
add_to_list (&frame_tables, name);
break;
@@ -2476,8 +2486,8 @@ scan_prog_file (const char *prog_name, enum pass which_pass)
/* Some platforms (e.g. OSF4) declare ldopen as taking a
non-const char * filename parameter, even though it will not
modify that string. So we must cast away const-ness here,
- which will cause -Wcast-qual to burp. */
- if ((ldptr = ldopen ((char *)prog_name, ldptr)) != NULL)
+ using CONST_CAST to prevent complaints from -Wcast-qual. */
+ if ((ldptr = ldopen (CONST_CAST (char *, prog_name), ldptr)) != NULL)
{
if (! MY_ISCOFF (HEADER (ldptr).f_magic))
fatal ("%s: not a COFF file", prog_name);
@@ -2516,7 +2526,7 @@ scan_prog_file (const char *prog_name, enum pass which_pass)
switch (is_ctor_dtor (name))
{
- case 1:
+ case SYM_CTOR:
if (! is_shared)
add_to_list (&constructors, name);
#if defined (COLLECT_EXPORT_LIST) && !defined (LD_INIT_SWITCH)
@@ -2525,7 +2535,7 @@ scan_prog_file (const char *prog_name, enum pass which_pass)
#endif
break;
- case 2:
+ case SYM_DTOR:
if (! is_shared)
add_to_list (&destructors, name);
#if defined (COLLECT_EXPORT_LIST) && !defined (LD_INIT_SWITCH)
@@ -2535,14 +2545,14 @@ scan_prog_file (const char *prog_name, enum pass which_pass)
break;
#ifdef COLLECT_EXPORT_LIST
- case 3:
+ case SYM_INIT:
#ifndef LD_INIT_SWITCH
if (is_shared)
add_to_list (&constructors, name);
#endif
break;
- case 4:
+ case SYM_FINI:
#ifndef LD_INIT_SWITCH
if (is_shared)
add_to_list (&destructors, name);
@@ -2550,7 +2560,7 @@ scan_prog_file (const char *prog_name, enum pass which_pass)
break;
#endif
- case 5:
+ case SYM_DWEH:
if (! is_shared)
add_to_list (&frame_tables, name);
#if defined (COLLECT_EXPORT_LIST) && !defined (LD_INIT_SWITCH)
diff --git a/gcc/combine-stack-adj.c b/gcc/combine-stack-adj.c
index afcb35b33ea..c678a607c66 100644
--- a/gcc/combine-stack-adj.c
+++ b/gcc/combine-stack-adj.c
@@ -143,14 +143,14 @@ single_set_for_csa (rtx insn)
for (i = 1; i < XVECLEN (tmp, 0); ++i)
{
- rtx this = XVECEXP (tmp, 0, i);
+ rtx this_rtx = XVECEXP (tmp, 0, i);
/* The special case is allowing a no-op set. */
- if (GET_CODE (this) == SET
- && SET_SRC (this) == SET_DEST (this))
+ if (GET_CODE (this_rtx) == SET
+ && SET_SRC (this_rtx) == SET_DEST (this_rtx))
;
- else if (GET_CODE (this) != CLOBBER
- && GET_CODE (this) != USE)
+ else if (GET_CODE (this_rtx) != CLOBBER
+ && GET_CODE (this_rtx) != USE)
return NULL_RTX;
}
diff --git a/gcc/combine.c b/gcc/combine.c
index 706ee0689f3..a39649d7c8e 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -1112,6 +1112,7 @@ combine_instructions (rtx f, unsigned int nregs)
last_call_luid = 0;
mem_last_set = -1;
label_tick++;
+ rtl_profile_for_bb (this_basic_block);
for (insn = BB_HEAD (this_basic_block);
insn != NEXT_INSN (BB_END (this_basic_block));
insn = next ? next : NEXT_INSN (insn))
@@ -1268,6 +1269,7 @@ combine_instructions (rtx f, unsigned int nregs)
}
}
+ default_rtl_profile ();
clear_log_links ();
clear_bb_flags ();
new_direct_jump_p |= purge_all_dead_edges ();
@@ -1340,8 +1342,7 @@ setup_incoming_promotions (rtx first)
function lie within the current compilation unit. (This does
take into account the exporting of a function via taking its
address, and so forth.) */
- if (flag_unit_at_a_time)
- strictly_local = cgraph_local_info (current_function_decl)->local;
+ strictly_local = cgraph_local_info (current_function_decl)->local;
/* The mode and signedness of the argument before any promotions happen
(equal to the mode of the pseudo holding it at that stage). */
diff --git a/gcc/common.opt b/gcc/common.opt
index 28ea62fcd7d..56bb0498c9a 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -59,11 +59,11 @@ Common Joined Separate UInteger
-G<number> Put global and static data smaller than <number> bytes into a special section (on some targets)
O
-Common JoinedOrMissing
+Common JoinedOrMissing Optimization
-O<number> Set optimization level to <number>
Os
-Common
+Common Optimization
Optimize for space rather than speed
W
@@ -210,27 +210,27 @@ Common Var(warn_notreached) Warning
Warn about code that will never be executed
Wunused
-Common Warning
+Common Var(warn_unused) Init(0) Warning
Enable all -Wunused- warnings
Wunused-function
-Common Var(warn_unused_function) Warning
+Common Var(warn_unused_function) Init(-1) Warning
Warn when a function is unused
Wunused-label
-Common Var(warn_unused_label) Warning
+Common Var(warn_unused_label) Init(-1) Warning
Warn when a label is unused
Wunused-parameter
-Common Var(warn_unused_parameter) Warning
+Common Var(warn_unused_parameter) Init(-1) Warning
Warn when a function parameter is unused
Wunused-value
-Common Var(warn_unused_value) Warning
+Common Var(warn_unused_value) Init(-1) Warning
Warn when an expression value is unused
Wunused-variable
-Common Var(warn_unused_variable) Warning
+Common Var(warn_unused_variable) Init(-1) Warning
Warn when a variable is unused
Wcoverage-mismatch
@@ -275,28 +275,28 @@ fabi-version=
Common Joined UInteger Var(flag_abi_version) Init(2)
falign-functions
-Common Report Var(align_functions,0)
+Common Report Var(align_functions,0) Optimization UInteger
Align the start of functions
falign-functions=
Common RejectNegative Joined UInteger
falign-jumps
-Common Report Var(align_jumps,0) Optimization
+Common Report Var(align_jumps,0) Optimization UInteger
Align labels which are only reached by jumping
falign-jumps=
Common RejectNegative Joined UInteger
falign-labels
-Common Report Var(align_labels,0) Optimization
+Common Report Var(align_labels,0) Optimization UInteger
Align all labels
falign-labels=
Common RejectNegative Joined UInteger
falign-loops
-Common Report Var(align_loops) Optimization
+Common Report Var(align_loops) Optimization UInteger
Align the start of loops
falign-loops=
@@ -459,6 +459,10 @@ fdump-unnumbered
Common Report Var(flag_dump_unnumbered) VarExists
Suppress output of instruction numbers, line number notes and addresses in debugging dumps
+fdwarf2-cfi-asm
+Common Report Var(flag_dwarf2_cfi_asm) Init(HAVE_GAS_CFI_DIRECTIVE)
+Enable CFI tables via GAS assembler directives.
+
fearly-inlining
Common Report Var(flag_early_inlining) Init(1) Optimization
Perform early inlining
@@ -571,13 +575,17 @@ finhibit-size-directive
Common Report Var(flag_inhibit_size_directive)
Do not generate .size directives
+findirect-inlining
+Common Report Var(flag_indirect_inlining)
+Perform indirect inlining
+
; Nonzero means that functions declared `inline' will be treated
; as `static'. Prevents generation of zillions of copies of unused
; static inline functions; instead, `inlines' are written out
; only when actually used. Used in conjunction with -g. Also
; does the right thing with #pragma interface.
finline
-Common Report Var(flag_no_inline,0) Init(2)
+Common Report Var(flag_no_inline,0) Init(0)
Pay attention to the \"inline\" keyword
finline-small-functions
@@ -666,7 +674,7 @@ Common
Does nothing. Preserved for backward compatibility.
fmath-errno
-Common Report Var(flag_errno_math) Init(1)
+Common Report Var(flag_errno_math) Init(1) Optimization
Set errno after built-in math functions
fmem-report
@@ -949,7 +957,7 @@ Reschedule instructions after register allocation
; sched_stalled_insns means that insns can be moved prematurely from the queue
; of stalled insns into the ready list.
fsched-stalled-insns
-Common Report Var(flag_sched_stalled_insns) Optimization
+Common Report Var(flag_sched_stalled_insns) Optimization UInteger
Allow premature scheduling of queued insns
fsched-stalled-insns=
@@ -961,7 +969,7 @@ Common RejectNegative Joined UInteger
; premature removal from the queue of stalled insns into the ready list (has
; an effect only if the flag 'sched_stalled_insns' is set).
fsched-stalled-insns-dep
-Common Report Var(flag_sched_stalled_insns_dep,1) Init(1) Optimization
+Common Report Var(flag_sched_stalled_insns_dep,1) Init(1) Optimization UInteger
Set dependence distance checking in premature scheduling of queued insns
fsched-stalled-insns-dep=
@@ -1070,7 +1078,7 @@ Common Joined RejectNegative
-ftls-model=[global-dynamic|local-dynamic|initial-exec|local-exec] Set the default thread-local storage code generation model
ftoplevel-reorder
-Common Report Var(flag_toplevel_reorder) Init(1) Optimization
+Common Report Var(flag_toplevel_reorder) Init(2) Optimization
Reorder top level functions, variables, and asms
ftracer
@@ -1181,7 +1189,7 @@ Common Report Var(flag_tree_sra) Optimization
Perform scalar replacement of aggregates
ftree-ter
-Common Report Var(flag_tree_ter) Optimization
+Common Report Var(flag_tree_ter) Init(1) Optimization
Replace temporary expressions in the SSA->normal pass
ftree-lrs
@@ -1193,7 +1201,7 @@ Common Report Var(flag_tree_vrp) Init(0) Optimization
Perform Value Range Propagation on trees
funit-at-a-time
-Common Report Var(flag_unit_at_a_time) Optimization
+Common Report Var(flag_unit_at_a_time) Init(1) Optimization
Compile whole compilation unit at a time
funroll-loops
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 5cd17073380..30339e233d4 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -294,6 +294,8 @@ fido-*-*)
;;
i[34567]86-*-*)
cpu_type=i386
+ c_target_objs="i386-c.o"
+ cxx_target_objs="i386-c.o"
extra_headers="cpuid.h mmintrin.h mm3dnow.h xmmintrin.h emmintrin.h
pmmintrin.h tmmintrin.h ammintrin.h smmintrin.h
nmmintrin.h bmmintrin.h mmintrin-common.h
@@ -301,6 +303,8 @@ i[34567]86-*-*)
;;
x86_64-*-*)
cpu_type=i386
+ c_target_objs="i386-c.o"
+ cxx_target_objs="i386-c.o"
extra_headers="cpuid.h mmintrin.h mm3dnow.h xmmintrin.h emmintrin.h
pmmintrin.h tmmintrin.h ammintrin.h smmintrin.h
nmmintrin.h bmmintrin.h mmintrin-common.h
@@ -330,7 +334,7 @@ powerpc*-*-*)
extra_headers="ppc-asm.h altivec.h spe.h ppu_intrinsics.h paired.h spu2vmx.h vec_types.h si2vmx.h"
need_64bit_hwint=yes
case x$with_cpu in
- xpowerpc64|xdefault64|x6[23]0|x970|xG5|xpower[3456]|xpower6x|xrs64a|xcell)
+ xpowerpc64|xdefault64|x6[23]0|x970|xG5|xpower[34567]|xpower6x|xrs64a|xcell)
cpu_is_64bit=yes
;;
esac
@@ -410,8 +414,8 @@ case ${target} in
tmake_file="t-darwin ${cpu_type}/t-darwin t-slibgcc-darwin"
target_gtfiles="\$(srcdir)/config/darwin.c"
extra_options="${extra_options} darwin.opt"
- c_target_objs="darwin-c.o"
- cxx_target_objs="darwin-c.o"
+ c_target_objs="${c_target_objs} darwin-c.o"
+ cxx_target_objs="${cxx_target_objs} darwin-c.o"
fortran_target_objs="darwin-f.o"
extra_objs="darwin.o"
extra_gcc_objs="darwin-driver.o"
@@ -1028,16 +1032,16 @@ i[34567]86-*-darwin*)
;;
x86_64-*-darwin*)
with_cpu=${with_cpu:-generic}
- tmake_file="t-darwin ${cpu_type}/t-darwin64 t-slibgcc-darwin i386/t-crtpc i386/t-crtfm"
+ tmake_file="${tmake_file} t-darwin ${cpu_type}/t-darwin64 t-slibgcc-darwin i386/t-crtpc i386/t-crtfm"
tm_file="${tm_file} ${cpu_type}/darwin64.h"
;;
i[34567]86-*-elf*)
tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h i386/i386elf.h"
- tmake_file="i386/t-i386elf t-svr4"
+ tmake_file="${tmake_file} i386/t-i386elf t-svr4"
;;
x86_64-*-elf*)
tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h i386/i386elf.h i386/x86-64.h"
- tmake_file="i386/t-i386elf t-svr4"
+ tmake_file="${tmake_file} i386/t-i386elf t-svr4"
;;
i[34567]86-*-aout*)
tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h i386/gstabs.h i386/i386-aout.h"
@@ -1054,7 +1058,7 @@ i[34567]86-*-netbsdelf*)
;;
i[34567]86-*-netbsd*)
tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h i386/gstabs.h netbsd.h netbsd-aout.h i386/netbsd.h"
- tmake_file=t-netbsd
+ tmake_file="${tmake_file} t-netbsd"
extra_parts=""
use_collect2=yes
;;
@@ -1065,7 +1069,7 @@ x86_64-*-netbsd*)
i[34567]86-*-openbsd2.*|i[34567]86-*openbsd3.[0123])
tm_file="i386/i386.h i386/unix.h i386/bsd.h i386/gas.h i386/gstabs.h openbsd-oldgas.h openbsd.h i386/openbsd.h"
# needed to unconfuse gdb
- tmake_file="t-libc-ok t-openbsd i386/t-openbsd"
+ tmake_file="${tmake_file} t-libc-ok t-openbsd i386/t-openbsd"
# we need collect2 until our bug is fixed...
use_collect2=yes
;;
@@ -1126,7 +1130,7 @@ i[34567]86-*-gnu*)
i[34567]86-pc-msdosdjgpp*)
xm_file=i386/xm-djgpp.h
tm_file="dbxcoff.h ${tm_file} i386/unix.h i386/bsd.h i386/gas.h i386/djgpp.h"
- tmake_file=i386/t-djgpp
+ tmake_file="${tmake_file} i386/t-djgpp"
extra_options="${extra_options} i386/djgpp.opt"
gnu_ld=yes
gas=yes
@@ -1134,7 +1138,7 @@ i[34567]86-pc-msdosdjgpp*)
i[34567]86-*-lynxos*)
xm_defines=POSIX
tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h i386/lynx.h lynx.h"
- tmake_file="i386/t-crtstuff t-lynx"
+ tmake_file="${tmake_file} i386/t-crtstuff t-lynx"
extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
extra_options="${extra_options} lynx.opt"
thread_file=lynx
@@ -1143,7 +1147,7 @@ i[34567]86-*-lynxos*)
;;
i[3456x]86-*-netware*)
tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h svr4.h tm-dwarf2.h i386/netware.h"
- tmake_file=i386/t-netware
+ tmake_file="${tmake_file} i386/t-netware"
extra_objs=netware.o
case /${with_ld} in
*/nwld)
@@ -1162,14 +1166,14 @@ i[3456x]86-*-netware*)
;;
i[34567]86-*-nto-qnx*)
tm_file="${tm_file} i386/att.h dbxelf.h tm-dwarf2.h elfos.h svr4.h i386/unix.h i386/nto.h"
- tmake_file=i386/t-nto
+ tmake_file="${tmake_file} i386/t-nto"
gnu_ld=yes
gas=yes
;;
i[34567]86-*-rtems*)
tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h i386/i386elf.h i386/rtemself.h rtems.h"
extra_parts="crtbegin.o crtend.o crti.o crtn.o"
- tmake_file="i386/t-rtems-i386 i386/t-crtstuff t-rtems"
+ tmake_file="${tmake_file} i386/t-rtems-i386 i386/t-crtstuff t-rtems"
;;
i[34567]86-*-solaris2*)
tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h svr4.h i386/sysv4.h sol2.h"
@@ -1179,9 +1183,9 @@ i[34567]86-*-solaris2*)
;;
esac
tm_file="${tm_file} i386/sol2.h"
- tmake_file="t-sol2 i386/t-sol2 t-svr4"
- c_target_objs="sol2-c.o"
- cxx_target_objs="sol2-c.o"
+ tmake_file="${tmake_file} t-sol2 i386/t-sol2 t-svr4"
+ c_target_objs="${c_target_objs} sol2-c.o"
+ cxx_target_objs="${cxx_target_objs} sol2-c.o"
extra_objs="sol2.o"
tm_p_file="${tm_p_file} sol2-protos.h"
if test x$gnu_ld = xyes; then
@@ -1247,12 +1251,12 @@ i[4567]86-wrs-vxworks|i[4567]86-wrs-vxworksae)
i[34567]86-*-pe | i[34567]86-*-cygwin*)
tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h dbxcoff.h i386/cygming.h i386/cygwin.h"
xm_file=i386/xm-cygwin.h
- tmake_file="i386/t-cygwin i386/t-cygming"
+ tmake_file="${tmake_file} i386/t-cygwin i386/t-cygming"
target_gtfiles="\$(srcdir)/config/i386/winnt.c"
extra_options="${extra_options} i386/cygming.opt"
extra_objs="winnt.o winnt-stubs.o"
- c_target_objs="cygwin2.o msformat-c.o"
- cxx_target_objs="cygwin2.o winnt-cxx.o msformat-c.o"
+ c_target_objs="${c_target_objs} cygwin2.o msformat-c.o"
+ cxx_target_objs="${cxx_target_objs} cygwin2.o winnt-cxx.o msformat-c.o"
extra_gcc_objs=cygwin1.o
if test x$enable_threads = xyes; then
thread_file='posix'
@@ -1261,12 +1265,12 @@ i[34567]86-*-pe | i[34567]86-*-cygwin*)
i[34567]86-*-mingw* | x86_64-*-mingw*)
tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h dbxcoff.h i386/cygming.h i386/mingw32.h"
xm_file=i386/xm-mingw32.h
- tmake_file="i386/t-cygming i386/t-mingw32"
+ tmake_file="${tmake_file} i386/t-cygming i386/t-mingw32"
target_gtfiles="\$(srcdir)/config/i386/winnt.c"
extra_options="${extra_options} i386/cygming.opt"
extra_objs="winnt.o winnt-stubs.o"
- c_target_objs="msformat-c.o"
- cxx_target_objs="winnt-cxx.o msformat-c.o"
+ c_target_objs="${c_target_objs} msformat-c.o"
+ cxx_target_objs="${cxx_target_objs} winnt-cxx.o msformat-c.o"
default_use_cxa_atexit=yes
case ${enable_threads} in
"" | yes | win32)
@@ -1291,7 +1295,7 @@ i[34567]86-*-mingw* | x86_64-*-mingw*)
;;
i[34567]86-*-interix3*)
tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h i386/i386-interix.h i386/i386-interix3.h interix.h interix3.h"
- tmake_file="i386/t-interix"
+ tmake_file="${tmake_file} i386/t-interix"
extra_objs=winnt.o
target_gtfiles="\$(srcdir)/config/i386/winnt.c"
if test x$enable_threads = xyes ; then
@@ -1538,15 +1542,18 @@ mips*-*-netbsd*) # NetBSD/mips, either endian.
target_cpu_default="MASK_ABICALLS"
tm_file="elfos.h ${tm_file} mips/elf.h netbsd.h netbsd-elf.h mips/netbsd.h"
;;
-mips64*-*-linux*)
+mips64*-*-linux* | mipsisa64*-*-linux*)
tm_file="dbxelf.h elfos.h svr4.h linux.h ${tm_file} mips/linux.h mips/linux64.h"
- tmake_file="${tmake_file} mips/t-linux64"
+ tmake_file="${tmake_file} mips/t-linux64 mips/t-libgcc-mips16"
tm_defines="${tm_defines} MIPS_ABI_DEFAULT=ABI_N32"
case ${target} in
mips64el-st-linux-gnu)
tm_file="${tm_file} mips/st.h"
tmake_file="${tmake_file} mips/t-st"
;;
+ mipsisa64r2*-*-linux*)
+ tm_defines="${tm_defines} MIPS_ISA_DEFAULT=65"
+ ;;
esac
gnu_ld=yes
gas=yes
@@ -1554,6 +1561,7 @@ mips64*-*-linux*)
;;
mips*-*-linux*) # Linux MIPS, either endian.
tm_file="dbxelf.h elfos.h svr4.h linux.h ${tm_file} mips/linux.h"
+ tmake_file="${tmake_file} mips/t-libgcc-mips16"
case ${target} in
mipsisa32r2*)
tm_defines="${tm_defines} MIPS_ISA_DEFAULT=33"
@@ -2341,11 +2349,11 @@ xstormy16-*-elf)
tmake_file="stormy16/t-stormy16"
extra_parts="crtbegin.o crtend.o"
;;
-xtensa-*-elf*)
+xtensa*-*-elf*)
tm_file="${tm_file} dbxelf.h elfos.h svr4.h xtensa/elf.h"
tmake_file="xtensa/t-xtensa xtensa/t-elf"
;;
-xtensa-*-linux*)
+xtensa*-*-linux*)
tm_file="${tm_file} dbxelf.h elfos.h svr4.h linux.h xtensa/linux.h"
tmake_file="${tmake_file} xtensa/t-xtensa xtensa/t-linux"
;;
@@ -2369,10 +2377,10 @@ esac
case ${target} in
i[34567]86-*-linux* | x86_64-*-linux*)
- tmake_file="${tmake_file} i386/t-pmm_malloc"
+ tmake_file="${tmake_file} i386/t-pmm_malloc i386/t-i386"
;;
i[34567]86-*-* | x86_64-*-*)
- tmake_file="${tmake_file} i386/t-gmm_malloc"
+ tmake_file="${tmake_file} i386/t-gmm_malloc i386/t-i386"
;;
esac
@@ -2835,7 +2843,7 @@ case "${target}" in
eval "with_$which=405"
;;
"" | common \
- | power | power[23456] | power6x | powerpc | powerpc64 \
+ | power | power[234567] | power6x | powerpc | powerpc64 \
| rios | rios1 | rios2 | rsc | rsc1 | rs64a \
| 401 | 403 | 405 | 405fp | 440 | 440fp | 464 | 464fp \
| 505 | 601 | 602 | 603 | 603e | ec603e | 604 \
diff --git a/gcc/config.host b/gcc/config.host
index d6efc6d730b..1d2462911df 100644
--- a/gcc/config.host
+++ b/gcc/config.host
@@ -141,26 +141,14 @@ case ${host} in
prefix=/gnu
local_prefix=/gnu
;;
- hppa1.1-*-pro*)
- host_xmake_file="${host_xmake_file} pa/x-ada"
- ;;
- hppa1.1-*-osf*)
- host_xmake_file="${host_xmake_file} pa/x-ada"
- ;;
- hppa1.1-*-rtems*)
- host_xmake_file="${host_xmake_file} pa/x-ada"
- ;;
- hppa1.1-*-bsd*)
- host_xmake_file="${host_xmake_file} pa/x-ada"
- ;;
hppa1.0-*-hpux10* | hppa1.1-*-hpux10* | hppa2*-*-hpux10*)
out_host_hook_obj=host-hpux.o
- host_xmake_file="${host_xmake_file} pa/x-ada-hpux10 x-hpux"
+ host_xmake_file="${host_xmake_file} x-hpux"
;;
hppa1.0-*-hpux11* | hppa1.1-*-hpux11* | hppa2*-*-hpux11* | \
hppa*64*-*-hpux11*)
out_host_hook_obj=host-hpux.o
- host_xmake_file="${host_xmake_file} pa/x-ada x-hpux"
+ host_xmake_file="${host_xmake_file} x-hpux"
;;
hppa*-*-linux*)
out_host_hook_obj=host-hpux.o
diff --git a/gcc/config.in b/gcc/config.in
index ec20c1cdab0..f4604d25719 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -93,6 +93,14 @@
#endif
+/* Define if you want operations on GIMPLE (the basic data structure of the
+ high-level optimizers) to be checked for dynamic type safety at runtime.
+ This is moderately expensive. */
+#ifndef USED_FOR_TARGET
+#undef ENABLE_GIMPLE_CHECKING
+#endif
+
+
/* Define to 1 if translation of program messages to the user's native
language is requested. */
#ifndef USED_FOR_TARGET
@@ -369,6 +377,10 @@
#undef HAVE_AS_TLS
#endif
+/* Define if your assembler supports VSX instructions. */
+#ifndef USED_FOR_TARGET
+#undef HAVE_AS_VSX
+#endif
/* Define to 1 if you have the `atoll' function. */
#ifndef USED_FOR_TARGET
@@ -813,6 +825,18 @@
#endif
+/* Define 0/1 if your assembler supports CFI directives. */
+#ifndef USED_FOR_TARGET
+#undef HAVE_GAS_CFI_DIRECTIVE
+#endif
+
+
+/* Define 0/1 if your assembler supports .cfi_personality. */
+#ifndef USED_FOR_TARGET
+#undef HAVE_GAS_CFI_PERSONALITY_DIRECTIVE
+#endif
+
+
/* Define if your assembler uses the new HImode fild and fist notation. */
#ifndef USED_FOR_TARGET
#undef HAVE_GAS_FILDS_FISTS
diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c
index 350994234cd..cba9370f629 100644
--- a/gcc/config/alpha/alpha.c
+++ b/gcc/config/alpha/alpha.c
@@ -1,6 +1,6 @@
/* Subroutines used for code generation on the DEC Alpha.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
- 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+ 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
This file is part of GCC.
@@ -51,7 +51,7 @@ along with GCC; see the file COPYING3. If not see
#include "langhooks.h"
#include <splay-tree.h>
#include "cfglayout.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "tree-flow.h"
#include "tree-stdarg.h"
#include "tm-constrs.h"
@@ -1506,43 +1506,43 @@ get_unaligned_offset (rtx addr, HOST_WIDE_INT ofs)
/* On the Alpha, all (non-symbolic) constants except zero go into
a floating-point register via memory. Note that we cannot
- return anything that is not a subset of CLASS, and that some
+ return anything that is not a subset of RCLASS, and that some
symbolic constants cannot be dropped to memory. */
enum reg_class
-alpha_preferred_reload_class(rtx x, enum reg_class class)
+alpha_preferred_reload_class(rtx x, enum reg_class rclass)
{
/* Zero is present in any register class. */
if (x == CONST0_RTX (GET_MODE (x)))
- return class;
+ return rclass;
/* These sorts of constants we can easily drop to memory. */
if (GET_CODE (x) == CONST_INT
|| GET_CODE (x) == CONST_DOUBLE
|| GET_CODE (x) == CONST_VECTOR)
{
- if (class == FLOAT_REGS)
+ if (rclass == FLOAT_REGS)
return NO_REGS;
- if (class == ALL_REGS)
+ if (rclass == ALL_REGS)
return GENERAL_REGS;
- return class;
+ return rclass;
}
/* All other kinds of constants should not (and in the case of HIGH
cannot) be dropped to memory -- instead we use a GENERAL_REGS
secondary reload. */
if (CONSTANT_P (x))
- return (class == ALL_REGS ? GENERAL_REGS : class);
+ return (rclass == ALL_REGS ? GENERAL_REGS : rclass);
- return class;
+ return rclass;
}
/* Inform reload about cases where moving X with a mode MODE to a register in
- CLASS requires an extra scratch or immediate register. Return the class
+ RCLASS requires an extra scratch or immediate register. Return the class
needed for the immediate register. */
static enum reg_class
-alpha_secondary_reload (bool in_p, rtx x, enum reg_class class,
+alpha_secondary_reload (bool in_p, rtx x, enum reg_class rclass,
enum machine_mode mode, secondary_reload_info *sri)
{
/* Loading and storing HImode or QImode values to and from memory
@@ -1564,7 +1564,7 @@ alpha_secondary_reload (bool in_p, rtx x, enum reg_class class,
/* We also cannot do integral arithmetic into FP regs, as might result
from register elimination into a DImode fp register. */
- if (class == FLOAT_REGS)
+ if (rclass == FLOAT_REGS)
{
if (MEM_P (x) && GET_CODE (XEXP (x, 0)) == AND)
return GENERAL_REGS;
@@ -1644,7 +1644,7 @@ static rtx
alpha_emit_set_const_1 (rtx target, enum machine_mode mode,
HOST_WIDE_INT c, int n, bool no_output)
{
- HOST_WIDE_INT new;
+ HOST_WIDE_INT new_const;
int i, bits;
/* Use a pseudo if highly optimizing and still generating RTL. */
rtx subtarget
@@ -1743,15 +1743,15 @@ alpha_emit_set_const_1 (rtx target, enum machine_mode mode,
/* First, see if minus some low bits, we've an easy load of
high bits. */
- new = ((c & 0xffff) ^ 0x8000) - 0x8000;
- if (new != 0)
+ new_const = ((c & 0xffff) ^ 0x8000) - 0x8000;
+ if (new_const != 0)
{
- temp = alpha_emit_set_const (subtarget, mode, c - new, i, no_output);
+ temp = alpha_emit_set_const (subtarget, mode, c - new_const, i, no_output);
if (temp)
{
if (no_output)
return temp;
- return expand_binop (mode, add_optab, temp, GEN_INT (new),
+ return expand_binop (mode, add_optab, temp, GEN_INT (new_const),
target, 0, OPTAB_WIDEN);
}
}
@@ -1778,12 +1778,12 @@ alpha_emit_set_const_1 (rtx target, enum machine_mode mode,
if (bits > 0)
for (; bits > 0; bits--)
{
- new = c >> bits;
- temp = alpha_emit_set_const (subtarget, mode, new, i, no_output);
+ new_const = c >> bits;
+ temp = alpha_emit_set_const (subtarget, mode, new_const, i, no_output);
if (!temp && c < 0)
{
- new = (unsigned HOST_WIDE_INT)c >> bits;
- temp = alpha_emit_set_const (subtarget, mode, new,
+ new_const = (unsigned HOST_WIDE_INT)c >> bits;
+ temp = alpha_emit_set_const (subtarget, mode, new_const,
i, no_output);
}
if (temp)
@@ -1806,12 +1806,12 @@ alpha_emit_set_const_1 (rtx target, enum machine_mode mode,
if (bits > 0)
for (; bits > 0; bits--)
{
- new = c << bits;
- temp = alpha_emit_set_const (subtarget, mode, new, i, no_output);
+ new_const = c << bits;
+ temp = alpha_emit_set_const (subtarget, mode, new_const, i, no_output);
if (!temp)
{
- new = (c << bits) | (((HOST_WIDE_INT) 1 << bits) - 1);
- temp = alpha_emit_set_const (subtarget, mode, new,
+ new_const = (c << bits) | (((HOST_WIDE_INT) 1 << bits) - 1);
+ temp = alpha_emit_set_const (subtarget, mode, new_const,
i, no_output);
}
if (temp)
@@ -1832,12 +1832,12 @@ alpha_emit_set_const_1 (rtx target, enum machine_mode mode,
if (bits > 0)
for (; bits > 0; bits--)
{
- new = c << bits;
- temp = alpha_emit_set_const (subtarget, mode, new, i, no_output);
+ new_const = c << bits;
+ temp = alpha_emit_set_const (subtarget, mode, new_const, i, no_output);
if (!temp)
{
- new = (c << bits) | (((HOST_WIDE_INT) 1 << bits) - 1);
- temp = alpha_emit_set_const (subtarget, mode, new,
+ new_const = (c << bits) | (((HOST_WIDE_INT) 1 << bits) - 1);
+ temp = alpha_emit_set_const (subtarget, mode, new_const,
i, no_output);
}
if (temp)
@@ -1855,25 +1855,25 @@ alpha_emit_set_const_1 (rtx target, enum machine_mode mode,
constant except that all bytes that are 0 are changed to be 0xff. If we
can, then we can do a ZAPNOT to obtain the desired constant. */
- new = c;
+ new_const = c;
for (i = 0; i < 64; i += 8)
- if ((new & ((HOST_WIDE_INT) 0xff << i)) == 0)
- new |= (HOST_WIDE_INT) 0xff << i;
+ if ((new_const & ((HOST_WIDE_INT) 0xff << i)) == 0)
+ new_const |= (HOST_WIDE_INT) 0xff << i;
/* We are only called for SImode and DImode. If this is SImode, ensure that
we are sign extended to a full word. */
if (mode == SImode)
- new = ((new & 0xffffffff) ^ 0x80000000) - 0x80000000;
+ new_const = ((new_const & 0xffffffff) ^ 0x80000000) - 0x80000000;
- if (new != c)
+ if (new_const != c)
{
- temp = alpha_emit_set_const (subtarget, mode, new, n - 1, no_output);
+ temp = alpha_emit_set_const (subtarget, mode, new_const, n - 1, no_output);
if (temp)
{
if (no_output)
return temp;
- return expand_binop (mode, and_optab, temp, GEN_INT (c | ~ new),
+ return expand_binop (mode, and_optab, temp, GEN_INT (c | ~ new_const),
target, 0, OPTAB_WIDEN);
}
}
@@ -5708,15 +5708,15 @@ function_value (const_tree valtype, const_tree func ATTRIBUTE_UNUSED,
enum machine_mode mode)
{
unsigned int regnum, dummy;
- enum mode_class class;
+ enum mode_class mclass;
gcc_assert (!valtype || !alpha_return_in_memory (valtype, func));
if (valtype)
mode = TYPE_MODE (valtype);
- class = GET_MODE_CLASS (mode);
- switch (class)
+ mclass = GET_MODE_CLASS (mode);
+ switch (mclass)
{
case MODE_INT:
PROMOTE_MODE (mode, dummy, valtype);
@@ -5817,11 +5817,11 @@ va_list_skip_additions (tree lhs)
if (TREE_CODE (stmt) == PHI_NODE)
return stmt;
- if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT
- || GIMPLE_STMT_OPERAND (stmt, 0) != lhs)
+ if (TREE_CODE (stmt) != MODIFY_EXPR
+ || TREE_OPERAND (stmt, 0) != lhs)
return lhs;
- rhs = GIMPLE_STMT_OPERAND (stmt, 1);
+ rhs = TREE_OPERAND (stmt, 1);
if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
rhs = TREE_OPERAND (rhs, 0);
@@ -5856,11 +5856,17 @@ va_list_skip_additions (tree lhs)
current statement. */
static bool
-alpha_stdarg_optimize_hook (struct stdarg_info *si, const_tree lhs, const_tree rhs)
+alpha_stdarg_optimize_hook (struct stdarg_info *si, const_gimple stmt)
{
tree base, offset, arg1, arg2;
int offset_arg = 1;
+#if 1
+ /* FIXME tuples. */
+ (void) si;
+ (void) stmt;
+ return false;
+#else
while (handled_component_p (rhs))
rhs = TREE_OPERAND (rhs, 0);
if (TREE_CODE (rhs) != INDIRECT_REF
@@ -5953,6 +5959,7 @@ alpha_stdarg_optimize_hook (struct stdarg_info *si, const_tree lhs, const_tree r
escapes:
si->va_list_escapes = true;
return false;
+#endif
}
#endif
@@ -6087,7 +6094,7 @@ alpha_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED)
{
nextarg = plus_constant (nextarg, offset);
nextarg = plus_constant (nextarg, NUM_ARGS * UNITS_PER_WORD);
- t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (valist), valist,
+ t = build2 (MODIFY_EXPR, TREE_TYPE (valist), valist,
make_tree (ptr_type_node, nextarg));
TREE_SIDE_EFFECTS (t) = 1;
@@ -6106,20 +6113,20 @@ alpha_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED)
t = make_tree (ptr_type_node, virtual_incoming_args_rtx);
t = build2 (POINTER_PLUS_EXPR, ptr_type_node, t,
size_int (offset));
- t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (base_field), base_field, t);
+ t = build2 (MODIFY_EXPR, TREE_TYPE (base_field), base_field, t);
TREE_SIDE_EFFECTS (t) = 1;
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
t = build_int_cst (NULL_TREE, NUM_ARGS * UNITS_PER_WORD);
- t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (offset_field),
- offset_field, t);
+ t = build2 (MODIFY_EXPR, TREE_TYPE (offset_field), offset_field, t);
TREE_SIDE_EFFECTS (t) = 1;
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
}
}
static tree
-alpha_gimplify_va_arg_1 (tree type, tree base, tree offset, tree *pre_p)
+alpha_gimplify_va_arg_1 (tree type, tree base, gimple_seq offset,
+ gimple_seq *pre_p)
{
tree type_size, ptr_type, addend, t, addr, internal_post;
@@ -6128,9 +6135,9 @@ alpha_gimplify_va_arg_1 (tree type, tree base, tree offset, tree *pre_p)
if (targetm.calls.must_pass_in_stack (TYPE_MODE (type), type))
{
t = build_int_cst (TREE_TYPE (offset), 6*8);
- t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (offset), offset,
- build2 (MAX_EXPR, TREE_TYPE (offset), offset, t));
- gimplify_and_add (t, pre_p);
+ gimplify_assign (offset,
+ build2 (MAX_EXPR, TREE_TYPE (offset), offset, t),
+ pre_p);
}
addend = offset;
@@ -6182,15 +6189,15 @@ alpha_gimplify_va_arg_1 (tree type, tree base, tree offset, tree *pre_p)
t = size_binop (MULT_EXPR, t, size_int (8));
}
t = fold_convert (TREE_TYPE (offset), t);
- t = build2 (GIMPLE_MODIFY_STMT, void_type_node, offset,
- build2 (PLUS_EXPR, TREE_TYPE (offset), offset, t));
- gimplify_and_add (t, pre_p);
+ gimplify_assign (offset, build2 (PLUS_EXPR, TREE_TYPE (offset), offset, t),
+ pre_p);
return build_va_arg_indirect_ref (addr);
}
static tree
-alpha_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p)
+alpha_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p,
+ gimple_seq *post_p)
{
tree offset_field, base_field, offset, base, t, r;
bool indirect;
@@ -6222,9 +6229,8 @@ alpha_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p)
r = alpha_gimplify_va_arg_1 (type, base, offset, pre_p);
/* Stuff the offset temporary back into its field. */
- t = build2 (GIMPLE_MODIFY_STMT, void_type_node, offset_field,
- fold_convert (TREE_TYPE (offset_field), offset));
- gimplify_and_add (t, pre_p);
+ gimplify_assign (offset_field,
+ fold_convert (TREE_TYPE (offset_field), offset), pre_p);
if (indirect)
r = build_va_arg_indirect_ref (r);
@@ -8255,7 +8261,7 @@ alpha_output_mi_thunk_osf (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
tree function)
{
HOST_WIDE_INT hi, lo;
- rtx this, insn, funexp;
+ rtx this_rtx, insn, funexp;
/* We always require a valid GP. */
emit_insn (gen_prologue_ldgp ());
@@ -8264,9 +8270,9 @@ alpha_output_mi_thunk_osf (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
/* Find the "this" pointer. If the function returns a structure,
the structure return pointer is in $16. */
if (aggregate_value_p (TREE_TYPE (TREE_TYPE (function)), function))
- this = gen_rtx_REG (Pmode, 17);
+ this_rtx = gen_rtx_REG (Pmode, 17);
else
- this = gen_rtx_REG (Pmode, 16);
+ this_rtx = gen_rtx_REG (Pmode, 16);
/* Add DELTA. When possible we use ldah+lda. Otherwise load the
entire constant for the add. */
@@ -8275,15 +8281,15 @@ alpha_output_mi_thunk_osf (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
if (hi + lo == delta)
{
if (hi)
- emit_insn (gen_adddi3 (this, this, GEN_INT (hi)));
+ emit_insn (gen_adddi3 (this_rtx, this_rtx, GEN_INT (hi)));
if (lo)
- emit_insn (gen_adddi3 (this, this, GEN_INT (lo)));
+ emit_insn (gen_adddi3 (this_rtx, this_rtx, GEN_INT (lo)));
}
else
{
rtx tmp = alpha_emit_set_long_const (gen_rtx_REG (Pmode, 0),
delta, -(delta < 0));
- emit_insn (gen_adddi3 (this, this, tmp));
+ emit_insn (gen_adddi3 (this_rtx, this_rtx, tmp));
}
/* Add a delta stored in the vtable at VCALL_OFFSET. */
@@ -8292,7 +8298,7 @@ alpha_output_mi_thunk_osf (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
rtx tmp, tmp2;
tmp = gen_rtx_REG (Pmode, 0);
- emit_move_insn (tmp, gen_rtx_MEM (Pmode, this));
+ emit_move_insn (tmp, gen_rtx_MEM (Pmode, this_rtx));
lo = ((vcall_offset & 0xffff) ^ 0x8000) - 0x8000;
hi = (((vcall_offset - lo) & 0xffffffff) ^ 0x80000000) - 0x80000000;
@@ -8314,7 +8320,7 @@ alpha_output_mi_thunk_osf (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
tmp2 = tmp;
emit_move_insn (tmp, gen_rtx_MEM (Pmode, tmp2));
- emit_insn (gen_adddi3 (this, this, tmp));
+ emit_insn (gen_adddi3 (this_rtx, this_rtx, tmp));
}
/* Generate a tail call to the target function. */
diff --git a/gcc/config/alpha/alpha.h b/gcc/config/alpha/alpha.h
index 5f2431e2978..b37a19d1e44 100644
--- a/gcc/config/alpha/alpha.h
+++ b/gcc/config/alpha/alpha.h
@@ -245,10 +245,6 @@ extern enum alpha_fp_trap_mode alpha_fptm;
/* Define the size of `long long'. The default is the twice the word size. */
#define LONG_LONG_TYPE_SIZE 64
-/* We're IEEE unless someone says to use VAX. */
-#define TARGET_FLOAT_FORMAT \
- (TARGET_FLOAT_VAX ? VAX_FLOAT_FORMAT : IEEE_FLOAT_FORMAT)
-
/* The two floating-point formats we support are S-floating, which is
4 bytes, and T-floating, which is 8 bytes. `float' is S and `double'
and `long double' are T. */
diff --git a/gcc/config/arm/arm-cores.def b/gcc/config/arm/arm-cores.def
index cce3195a453..c7e425b0c7f 100644
--- a/gcc/config/arm/arm-cores.def
+++ b/gcc/config/arm/arm-cores.def
@@ -117,5 +117,6 @@ ARM_CORE("mpcore", mpcore, 6K, FL_LDSCHED | FL_VFPV2, 9e)
ARM_CORE("arm1156t2-s", arm1156t2s, 6T2, FL_LDSCHED, 9e)
ARM_CORE("cortex-a8", cortexa8, 7A, FL_LDSCHED, 9e)
ARM_CORE("cortex-r4", cortexr4, 7R, FL_LDSCHED, 9e)
+ARM_CORE("cortex-r4f", cortexr4f, 7R, FL_LDSCHED, 9e)
ARM_CORE("cortex-m3", cortexm3, 7M, FL_LDSCHED, 9e)
ARM_CORE("cortex-m1", cortexm1, 6M, FL_LDSCHED, 9e)
diff --git a/gcc/config/arm/arm-protos.h b/gcc/config/arm/arm-protos.h
index a2963494c48..bdf9a04416b 100644
--- a/gcc/config/arm/arm-protos.h
+++ b/gcc/config/arm/arm-protos.h
@@ -208,4 +208,6 @@ extern void arm_lang_object_attributes_init(void);
extern const char *arm_mangle_type (const_tree);
+extern void arm_order_regs_for_local_alloc (void);
+
#endif /* ! GCC_ARM_PROTOS_H */
diff --git a/gcc/config/arm/arm-tune.md b/gcc/config/arm/arm-tune.md
index d73382bc920..ee5606b04cb 100644
--- a/gcc/config/arm/arm-tune.md
+++ b/gcc/config/arm/arm-tune.md
@@ -1,5 +1,5 @@
;; -*- buffer-read-only: t -*-
;; Generated automatically by gentune.sh from arm-cores.def
(define_attr "tune"
- "arm2,arm250,arm3,arm6,arm60,arm600,arm610,arm620,arm7,arm7d,arm7di,arm70,arm700,arm700i,arm710,arm720,arm710c,arm7100,arm7500,arm7500fe,arm7m,arm7dm,arm7dmi,arm8,arm810,strongarm,strongarm110,strongarm1100,strongarm1110,arm7tdmi,arm7tdmis,arm710t,arm720t,arm740t,arm9,arm9tdmi,arm920,arm920t,arm922t,arm940t,ep9312,arm10tdmi,arm1020t,arm9e,arm946es,arm966es,arm968es,arm10e,arm1020e,arm1022e,xscale,iwmmxt,arm926ejs,arm1026ejs,arm1136js,arm1136jfs,arm1176jzs,arm1176jzfs,mpcorenovfp,mpcore,arm1156t2s,cortexa8,cortexr4,cortexm3,cortexm1"
+ "arm2,arm250,arm3,arm6,arm60,arm600,arm610,arm620,arm7,arm7d,arm7di,arm70,arm700,arm700i,arm710,arm720,arm710c,arm7100,arm7500,arm7500fe,arm7m,arm7dm,arm7dmi,arm8,arm810,strongarm,strongarm110,strongarm1100,strongarm1110,arm7tdmi,arm7tdmis,arm710t,arm720t,arm740t,arm9,arm9tdmi,arm920,arm920t,arm922t,arm940t,ep9312,arm10tdmi,arm1020t,arm9e,arm946es,arm966es,arm968es,arm10e,arm1020e,arm1022e,xscale,iwmmxt,arm926ejs,arm1026ejs,arm1136js,arm1136jfs,arm1176jzs,arm1176jzfs,mpcorenovfp,mpcore,arm1156t2s,cortexa8,cortexr4,cortexr4f,cortexm3,cortexm1"
(const (symbol_ref "arm_tune")))
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 0ce531bb802..61b19696bab 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -62,6 +62,7 @@ const struct attribute_spec arm_attribute_table[];
void (*arm_lang_output_object_attributes_hook)(void);
/* Forward function declarations. */
+static int arm_compute_static_chain_stack_bytes (void);
static arm_stack_offsets *arm_get_frame_offsets (void);
static void arm_add_gc_roots (void);
static int arm_gen_constant (enum rtx_code, enum machine_mode, rtx,
@@ -699,6 +700,8 @@ static const struct fpu_desc all_fpus[] =
{"maverick", FPUTYPE_MAVERICK},
{"vfp", FPUTYPE_VFP},
{"vfp3", FPUTYPE_VFP3},
+ {"vfpv3", FPUTYPE_VFP3},
+ {"vfpv3-d16", FPUTYPE_VFP3D16},
{"neon", FPUTYPE_NEON}
};
@@ -715,6 +718,7 @@ static const enum fputype fp_model_for_fpu[] =
ARM_FP_MODEL_FPA, /* FPUTYPE_FPA_EMU3 */
ARM_FP_MODEL_MAVERICK, /* FPUTYPE_MAVERICK */
ARM_FP_MODEL_VFP, /* FPUTYPE_VFP */
+ ARM_FP_MODEL_VFP, /* FPUTYPE_VFP3D16 */
ARM_FP_MODEL_VFP, /* FPUTYPE_VFP3 */
ARM_FP_MODEL_VFP /* FPUTYPE_NEON */
};
@@ -3267,11 +3271,6 @@ arm_function_in_section_p (tree decl, section *section)
/* If DECL_SECTION_NAME is set, assume it is trustworthy. */
if (!DECL_SECTION_NAME (decl))
{
- /* Only cater for unit-at-a-time mode, where we know that the user
- cannot later specify a section for DECL. */
- if (!flag_unit_at_a_time)
- return false;
-
/* Make sure that we will not create a unique section for DECL. */
if (flag_function_sections || DECL_ONE_ONLY (decl))
return false;
@@ -8773,17 +8772,20 @@ add_minipool_backward_ref (Mfix *fix)
its maximum address (which can happen if we have
re-located a forwards fix); force the new fix to come
after it. */
- min_mp = mp;
- min_address = mp->min_address + fix->fix_size;
+ if (ARM_DOUBLEWORD_ALIGN
+ && fix->fix_size >= 8 && mp->fix_size < 8)
+ return NULL;
+ else
+ {
+ min_mp = mp;
+ min_address = mp->min_address + fix->fix_size;
+ }
}
- /* If we are inserting an 8-bytes aligned quantity and
- we have not already found an insertion point, then
- make sure that all such 8-byte aligned quantities are
- placed at the start of the pool. */
+ /* Do not insert a non-8-byte aligned quantity before 8-byte
+ aligned quantities. */
else if (ARM_DOUBLEWORD_ALIGN
- && min_mp == NULL
- && fix->fix_size >= 8
- && mp->fix_size < 8)
+ && fix->fix_size < 8
+ && mp->fix_size >= 8)
{
min_mp = mp;
min_address = mp->min_address + fix->fix_size;
@@ -10284,7 +10286,7 @@ output_move_vfp (rtx *operands)
int load = REG_P (operands[0]);
int dp = GET_MODE_SIZE (GET_MODE (operands[0])) == 8;
int integer_p = GET_MODE_CLASS (GET_MODE (operands[0])) == MODE_INT;
- const char *template;
+ const char *templ;
char buff[50];
enum machine_mode mode;
@@ -10307,25 +10309,25 @@ output_move_vfp (rtx *operands)
switch (GET_CODE (addr))
{
case PRE_DEC:
- template = "f%smdb%c%%?\t%%0!, {%%%s1}%s";
+ templ = "f%smdb%c%%?\t%%0!, {%%%s1}%s";
ops[0] = XEXP (addr, 0);
ops[1] = reg;
break;
case POST_INC:
- template = "f%smia%c%%?\t%%0!, {%%%s1}%s";
+ templ = "f%smia%c%%?\t%%0!, {%%%s1}%s";
ops[0] = XEXP (addr, 0);
ops[1] = reg;
break;
default:
- template = "f%s%c%%?\t%%%s0, %%1%s";
+ templ = "f%s%c%%?\t%%%s0, %%1%s";
ops[0] = reg;
ops[1] = mem;
break;
}
- sprintf (buff, template,
+ sprintf (buff, templ,
load ? "ld" : "st",
dp ? 'd' : 's',
dp ? "P" : "",
@@ -10336,37 +10338,35 @@ output_move_vfp (rtx *operands)
}
/* Output a Neon quad-word load or store, or a load or store for
- larger structure modes. We could also support post-modify forms using
- VLD1/VST1 (for the vectorizer, and perhaps otherwise), but we don't do that
- yet.
- WARNING: The ordering of elements in memory is weird in big-endian mode,
- because we use VSTM instead of VST1, to make it easy to make vector stores
- via ARM registers write values in the same order as stores direct from Neon
- registers. For example, the byte ordering of a quadword vector with 16-byte
- elements like this:
+ larger structure modes.
- [e7:e6:e5:e4:e3:e2:e1:e0] (highest-numbered element first)
+ WARNING: The ordering of elements is weird in big-endian mode,
+ because we use VSTM, as required by the EABI. GCC RTL defines
+ element ordering based on in-memory order. This can be differ
+ from the architectural ordering of elements within a NEON register.
+ The intrinsics defined in arm_neon.h use the NEON register element
+ ordering, not the GCC RTL element ordering.
- will be (with lowest address first, h = most-significant byte,
- l = least-significant byte of element):
+ For example, the in-memory ordering of a big-endian a quadword
+ vector with 16-bit elements when stored from register pair {d0,d1}
+ will be (lowest address first, d0[N] is NEON register element N):
- [e3h, e3l, e2h, e2l, e1h, e1l, e0h, e0l,
- e7h, e7l, e6h, e6l, e5h, e5l, e4h, e4l]
+ [d0[3], d0[2], d0[1], d0[0], d1[7], d1[6], d1[5], d1[4]]
- When necessary, quadword registers (dN, dN+1) are moved to ARM registers from
- rN in the order:
+ When necessary, quadword registers (dN, dN+1) are moved to ARM
+ registers from rN in the order:
dN -> (rN+1, rN), dN+1 -> (rN+3, rN+2)
- So that STM/LDM can be used on vectors in ARM registers, and the same memory
- layout will result as if VSTM/VLDM were used. */
+ So that STM/LDM can be used on vectors in ARM registers, and the
+ same memory layout will result as if VSTM/VLDM were used. */
const char *
output_move_neon (rtx *operands)
{
rtx reg, mem, addr, ops[2];
int regno, load = REG_P (operands[0]);
- const char *template;
+ const char *templ;
char buff[50];
enum machine_mode mode;
@@ -10393,7 +10393,7 @@ output_move_neon (rtx *operands)
switch (GET_CODE (addr))
{
case POST_INC:
- template = "v%smia%%?\t%%0!, %%h1";
+ templ = "v%smia%%?\t%%0!, %%h1";
ops[0] = XEXP (addr, 0);
ops[1] = reg;
break;
@@ -10436,12 +10436,12 @@ output_move_neon (rtx *operands)
}
default:
- template = "v%smia%%?\t%%m0, %%h1";
+ templ = "v%smia%%?\t%%m0, %%h1";
ops[0] = mem;
ops[1] = reg;
}
- sprintf (buff, template, load ? "ld" : "st");
+ sprintf (buff, templ, load ? "ld" : "st");
output_asm_insn (buff, ops);
return "";
@@ -10797,6 +10797,24 @@ arm_compute_save_reg0_reg12_mask (void)
}
+/* Compute the number of bytes used to store the static chain register on the
+ stack, above the stack frame. We need to know this accurately to get the
+ alignment of the rest of the stack frame correct. */
+
+static int arm_compute_static_chain_stack_bytes (void)
+{
+ unsigned long func_type = arm_current_func_type ();
+ int static_chain_stack_bytes = 0;
+
+ if (TARGET_APCS_FRAME && frame_pointer_needed && TARGET_ARM &&
+ IS_NESTED (func_type) &&
+ df_regs_ever_live_p (3) && crtl->args.pretend_args_size == 0)
+ static_chain_stack_bytes = 4;
+
+ return static_chain_stack_bytes;
+}
+
+
/* Compute a bit mask of which registers need to be
saved on the stack for the current function.
This is used by arm_get_frame_offsets, which may add extra registers. */
@@ -10849,7 +10867,9 @@ arm_compute_save_reg_mask (void)
if (TARGET_REALLY_IWMMXT
&& ((bit_count (save_reg_mask)
- + ARM_NUM_INTS (crtl->args.pretend_args_size)) % 2) != 0)
+ + ARM_NUM_INTS (crtl->args.pretend_args_size +
+ arm_compute_static_chain_stack_bytes())
+ ) % 2) != 0)
{
/* The total number of registers that are going to be pushed
onto the stack is odd. We need to ensure that the stack
@@ -10934,6 +10954,26 @@ thumb1_compute_save_reg_mask (void)
mask |= 1 << reg;
}
+ /* The 504 below is 8 bytes less than 512 because there are two possible
+ alignment words. We can't tell here if they will be present or not so we
+ have to play it safe and assume that they are. */
+ if ((CALLER_INTERWORKING_SLOT_SIZE +
+ ROUND_UP_WORD (get_frame_size ()) +
+ crtl->outgoing_args_size) >= 504)
+ {
+ /* This is the same as the code in thumb1_expand_prologue() which
+ determines which register to use for stack decrement. */
+ for (reg = LAST_ARG_REGNUM + 1; reg <= LAST_LO_REGNUM; reg++)
+ if (mask & (1 << reg))
+ break;
+
+ if (reg > LAST_LO_REGNUM)
+ {
+ /* Make sure we have a register available for stack decrement. */
+ mask |= 1 << LAST_LO_REGNUM;
+ }
+ }
+
return mask;
}
@@ -12069,7 +12109,8 @@ arm_get_frame_offsets (void)
offsets->saved_args = crtl->args.pretend_args_size;
/* In Thumb mode this is incorrect, but never used. */
- offsets->frame = offsets->saved_args + (frame_pointer_needed ? 4 : 0);
+ offsets->frame = offsets->saved_args + (frame_pointer_needed ? 4 : 0) +
+ arm_compute_static_chain_stack_bytes();
if (TARGET_32BIT)
{
@@ -12116,7 +12157,8 @@ arm_get_frame_offsets (void)
}
/* Saved registers include the stack frame. */
- offsets->saved_regs = offsets->saved_args + saved;
+ offsets->saved_regs = offsets->saved_args + saved +
+ arm_compute_static_chain_stack_bytes();
offsets->soft_frame = offsets->saved_regs + CALLER_INTERWORKING_SLOT_SIZE;
/* A leaf function does not need any stack alignment if it has nothing
on the stack. */
@@ -12208,14 +12250,9 @@ arm_compute_initial_elimination_offset (unsigned int from, unsigned int to)
return offsets->soft_frame - offsets->saved_args;
case ARM_HARD_FRAME_POINTER_REGNUM:
- /* If there is no stack frame then the hard
- frame pointer and the arg pointer coincide. */
- if (offsets->frame == offsets->saved_regs)
- return 0;
- /* FIXME: Not sure about this. Maybe we should always return 0 ? */
- return (frame_pointer_needed
- && cfun->static_chain_decl != NULL
- && ! cfun->machine->uses_anonymous_args) ? 4 : 0;
+ /* This is only non-zero in the case where the static chain register
+ is stored above the frame. */
+ return offsets->frame - offsets->saved_args - 4;
case STACK_POINTER_REGNUM:
/* If nothing has been pushed on the stack at all
@@ -12443,7 +12480,9 @@ arm_expand_prologue (void)
r0 = gen_rtx_REG (SImode, 0);
r1 = gen_rtx_REG (SImode, 1);
- dwarf = gen_rtx_UNSPEC (SImode, NULL_RTVEC, UNSPEC_STACK_ALIGN);
+ /* Use a real rtvec rather than NULL_RTVEC so the rest of the
+ compiler won't choke. */
+ dwarf = gen_rtx_UNSPEC (SImode, rtvec_alloc (0), UNSPEC_STACK_ALIGN);
dwarf = gen_rtx_SET (VOIDmode, r0, dwarf);
insn = gen_movsi (r0, stack_pointer_rtx);
RTX_FRAME_RELATED_P (insn) = 1;
@@ -12501,6 +12540,9 @@ arm_expand_prologue (void)
insn = emit_set_insn (gen_rtx_REG (SImode, 3), ip_rtx);
else if (args_to_push == 0)
{
+ gcc_assert(arm_compute_static_chain_stack_bytes() == 4);
+ saved_regs += 4;
+
rtx dwarf;
insn = gen_rtx_PRE_DEC (SImode, stack_pointer_rtx);
@@ -13285,28 +13327,16 @@ arm_assemble_integer (rtx x, unsigned int size, int aligned_p)
if (arm_vector_mode_supported_p (mode))
{
int i, units;
- unsigned int invmask = 0, parts_per_word;
gcc_assert (GET_CODE (x) == CONST_VECTOR);
units = CONST_VECTOR_NUNITS (x);
size = GET_MODE_SIZE (GET_MODE_INNER (mode));
- /* For big-endian Neon vectors, we must permute the vector to the form
- which, when loaded by a VLDR or VLDM instruction, will give a vector
- with the elements in the right order. */
- if (TARGET_NEON && WORDS_BIG_ENDIAN)
- {
- parts_per_word = UNITS_PER_WORD / size;
- /* FIXME: This might be wrong for 64-bit vector elements, but we don't
- support those anywhere yet. */
- invmask = (parts_per_word == 0) ? 0 : (1 << (parts_per_word - 1)) - 1;
- }
-
if (GET_MODE_CLASS (mode) == MODE_VECTOR_INT)
for (i = 0; i < units; i++)
{
- rtx elt = CONST_VECTOR_ELT (x, i ^ invmask);
+ rtx elt = CONST_VECTOR_ELT (x, i);
assemble_integer
(elt, size, i == 0 ? BIGGEST_ALIGNMENT : size * BITS_PER_UNIT, 1);
}
@@ -17011,62 +17041,25 @@ thumb1_expand_prologue (void)
been pushed at the start of the prologue and so we can corrupt
it now. */
for (regno = LAST_ARG_REGNUM + 1; regno <= LAST_LO_REGNUM; regno++)
- if (live_regs_mask & (1 << regno)
- && !(frame_pointer_needed
- && (regno == THUMB_HARD_FRAME_POINTER_REGNUM)))
+ if (live_regs_mask & (1 << regno))
break;
- if (regno > LAST_LO_REGNUM) /* Very unlikely. */
- {
- rtx spare = gen_rtx_REG (SImode, IP_REGNUM);
+ gcc_assert(regno <= LAST_LO_REGNUM);
- /* Choose an arbitrary, non-argument low register. */
- reg = gen_rtx_REG (SImode, LAST_LO_REGNUM);
+ reg = gen_rtx_REG (SImode, regno);
- /* Save it by copying it into a high, scratch register. */
- emit_insn (gen_movsi (spare, reg));
- /* Add a USE to stop propagate_one_insn() from barfing. */
- emit_insn (gen_prologue_use (spare));
+ emit_insn (gen_movsi (reg, GEN_INT (- amount)));
- /* Decrement the stack. */
- emit_insn (gen_movsi (reg, GEN_INT (- amount)));
- insn = emit_insn (gen_addsi3 (stack_pointer_rtx,
- stack_pointer_rtx, reg));
- RTX_FRAME_RELATED_P (insn) = 1;
- dwarf = gen_rtx_SET (VOIDmode, stack_pointer_rtx,
- plus_constant (stack_pointer_rtx,
- -amount));
- RTX_FRAME_RELATED_P (dwarf) = 1;
- REG_NOTES (insn)
- = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, dwarf,
- REG_NOTES (insn));
-
- /* Restore the low register's original value. */
- emit_insn (gen_movsi (reg, spare));
-
- /* Emit a USE of the restored scratch register, so that flow
- analysis will not consider the restore redundant. The
- register won't be used again in this function and isn't
- restored by the epilogue. */
- emit_insn (gen_prologue_use (reg));
- }
- else
- {
- reg = gen_rtx_REG (SImode, regno);
-
- emit_insn (gen_movsi (reg, GEN_INT (- amount)));
-
- insn = emit_insn (gen_addsi3 (stack_pointer_rtx,
- stack_pointer_rtx, reg));
- RTX_FRAME_RELATED_P (insn) = 1;
- dwarf = gen_rtx_SET (VOIDmode, stack_pointer_rtx,
- plus_constant (stack_pointer_rtx,
- -amount));
- RTX_FRAME_RELATED_P (dwarf) = 1;
- REG_NOTES (insn)
- = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, dwarf,
- REG_NOTES (insn));
- }
+ insn = emit_insn (gen_addsi3 (stack_pointer_rtx,
+ stack_pointer_rtx, reg));
+ RTX_FRAME_RELATED_P (insn) = 1;
+ dwarf = gen_rtx_SET (VOIDmode, stack_pointer_rtx,
+ plus_constant (stack_pointer_rtx,
+ -amount));
+ RTX_FRAME_RELATED_P (dwarf) = 1;
+ REG_NOTES (insn)
+ = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, dwarf,
+ REG_NOTES (insn));
}
}
@@ -17737,8 +17730,12 @@ arm_file_start (void)
fpu_name = "vfp";
set_float_abi_attributes = 1;
break;
+ case FPUTYPE_VFP3D16:
+ fpu_name = "vfpv3-d16";
+ set_float_abi_attributes = 1;
+ break;
case FPUTYPE_VFP3:
- fpu_name = "vfp3";
+ fpu_name = "vfpv3";
set_float_abi_attributes = 1;
break;
case FPUTYPE_NEON:
@@ -18318,7 +18315,8 @@ arm_cxx_key_method_may_be_inline (void)
static void
arm_cxx_determine_class_data_visibility (tree decl)
{
- if (!TARGET_AAPCS_BASED)
+ if (!TARGET_AAPCS_BASED
+ || !TARGET_DLLIMPORT_DECL_ATTRIBUTES)
return;
/* In general, \S 3.2.5.5 of the ARM EABI requires that class data
@@ -19044,4 +19042,28 @@ arm_mangle_type (const_tree type)
return NULL;
}
+/* Order of allocation of core registers for Thumb: this allocation is
+ written over the corresponding initial entries of the array
+ initialized with REG_ALLOC_ORDER. We allocate all low registers
+ first. Saving and restoring a low register is usually cheaper than
+ using a call-clobbered high register. */
+
+static const int thumb_core_reg_alloc_order[] =
+{
+ 3, 2, 1, 0, 4, 5, 6, 7,
+ 14, 12, 8, 9, 10, 11, 13, 15
+};
+
+/* Adjust register allocation order when compiling for Thumb. */
+
+void
+arm_order_regs_for_local_alloc (void)
+{
+ const int arm_reg_alloc_order[] = REG_ALLOC_ORDER;
+ memcpy(reg_alloc_order, arm_reg_alloc_order, sizeof (reg_alloc_order));
+ if (TARGET_THUMB)
+ memcpy (reg_alloc_order, thumb_core_reg_alloc_order,
+ sizeof (thumb_core_reg_alloc_order));
+}
+
#include "gt-arm.h"
diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h
index 9f662f31297..d99f77d1247 100644
--- a/gcc/config/arm/arm.h
+++ b/gcc/config/arm/arm.h
@@ -212,15 +212,20 @@ extern void (*arm_lang_output_object_attributes_hook)(void);
#define TARGET_THUMB1_ONLY (TARGET_THUMB1 && !arm_arch_notm)
/* The following two macros concern the ability to execute coprocessor
- instructions for VFPv3 or NEON. TARGET_VFP3 is currently only ever
- tested when we know we are generating for VFP hardware; we need to
- be more careful with TARGET_NEON as noted below. */
+ instructions for VFPv3 or NEON. TARGET_VFP3/TARGET_VFPD32 are currently
+ only ever tested when we know we are generating for VFP hardware; we need
+ to be more careful with TARGET_NEON as noted below. */
-/* FPU is VFPv3 (with twice the number of D registers). Setting the FPU to
- Neon automatically enables VFPv3 too. */
+/* FPU is has the full VFPv3/NEON register file of 32 D registers. */
+#define TARGET_VFPD32 (arm_fp_model == ARM_FP_MODEL_VFP \
+ && (arm_fpu_arch == FPUTYPE_VFP3 \
+ || arm_fpu_arch == FPUTYPE_NEON))
+
+/* FPU supports VFPv3 instructions. */
#define TARGET_VFP3 (arm_fp_model == ARM_FP_MODEL_VFP \
- && (arm_fpu_arch == FPUTYPE_VFP3 \
- || arm_fpu_arch == FPUTYPE_NEON))
+ && (arm_fpu_arch == FPUTYPE_VFP3D16 \
+ || TARGET_VFPD32))
+
/* FPU supports Neon instructions. The setting of this macro gets
revealed via __ARM_NEON__ so we add extra guards upon TARGET_32BIT
and TARGET_HARD_FLOAT to ensure that NEON instructions are
@@ -299,6 +304,8 @@ enum fputype
FPUTYPE_MAVERICK,
/* VFP. */
FPUTYPE_VFP,
+ /* VFPv3-D16. */
+ FPUTYPE_VFP3D16,
/* VFPv3. */
FPUTYPE_VFP3,
/* Neon. */
@@ -945,7 +952,7 @@ extern int arm_structure_size_boundary;
#define FIRST_VFP_REGNUM 63
#define D7_VFP_REGNUM 78 /* Registers 77 and 78 == VFP reg D7. */
#define LAST_VFP_REGNUM \
- (TARGET_VFP3 ? LAST_HI_VFP_REGNUM : LAST_LO_VFP_REGNUM)
+ (TARGET_VFPD32 ? LAST_HI_VFP_REGNUM : LAST_LO_VFP_REGNUM)
#define IS_VFP_REGNUM(REGNUM) \
(((REGNUM) >= FIRST_VFP_REGNUM) && ((REGNUM) <= LAST_VFP_REGNUM))
@@ -1080,6 +1087,9 @@ extern int arm_structure_size_boundary;
127 \
}
+/* Use different register alloc ordering for Thumb. */
+#define ORDER_REGS_FOR_LOCAL_ALLOC arm_order_regs_for_local_alloc ()
+
/* Interrupt functions can only use registers that have already been
saved by the prologue, even if they would normally be
call-clobbered. */
diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md
index 9cd6e7262a2..5b514451c5d 100644
--- a/gcc/config/arm/arm.md
+++ b/gcc/config/arm/arm.md
@@ -5286,12 +5286,12 @@
&& GET_CODE (base = XEXP (base, 0)) == REG))
&& REGNO_POINTER_ALIGN (REGNO (base)) >= 32)
{
- rtx new;
+ rtx new_rtx;
- new = widen_memory_access (operands[1], SImode,
- ((INTVAL (offset) & ~3)
- - INTVAL (offset)));
- emit_insn (gen_movsi (reg, new));
+ new_rtx = widen_memory_access (operands[1], SImode,
+ ((INTVAL (offset) & ~3)
+ - INTVAL (offset)));
+ emit_insn (gen_movsi (reg, new_rtx));
if (((INTVAL (offset) & 2) != 0)
^ (BYTES_BIG_ENDIAN ? 1 : 0))
{
diff --git a/gcc/config/arm/constraints.md b/gcc/config/arm/constraints.md
index 0f441ad181c..a671eb05823 100644
--- a/gcc/config/arm/constraints.md
+++ b/gcc/config/arm/constraints.md
@@ -46,7 +46,7 @@
"The Cirrus Maverick co-processor registers.")
(define_register_constraint "w"
- "TARGET_32BIT ? (TARGET_VFP3 ? VFP_REGS : VFP_LO_REGS) : NO_REGS"
+ "TARGET_32BIT ? (TARGET_VFPD32 ? VFP_REGS : VFP_LO_REGS) : NO_REGS"
"The VFP registers @code{d0}-@code{d15}, or @code{d0}-@code{d31} for VFPv3.")
(define_register_constraint "x" "TARGET_32BIT ? VFP_D0_D7_REGS : NO_REGS"
diff --git a/gcc/config/arm/iwmmxt.md b/gcc/config/arm/iwmmxt.md
index 633aaaa875f..668172f8407 100644
--- a/gcc/config/arm/iwmmxt.md
+++ b/gcc/config/arm/iwmmxt.md
@@ -167,9 +167,9 @@
(set_attr "neg_pool_range" "*,*,4084, *,*,*")]
)
-(define_insn "movv8qi_internal"
- [(set (match_operand:V8QI 0 "nonimmediate_operand" "=y,m,y,?r,?y,?r,?r")
- (match_operand:V8QI 1 "general_operand" "y,y,mi,y,r,r,mi"))]
+(define_insn "mov<mode>_internal"
+ [(set (match_operand:VMMX 0 "nonimmediate_operand" "=y,m,y,?r,?y,?r,?r,?m")
+ (match_operand:VMMX 1 "general_operand" "y,y,mi,y,r,r,mi,r"))]
"TARGET_REALLY_IWMMXT"
"*
switch (which_alternative)
@@ -183,68 +183,10 @@
default: return output_move_double (operands);
}"
[(set_attr "predicable" "yes")
- (set_attr "length" "4, 4, 4,4,4,8, 8")
- (set_attr "type" "*,store1,load1,*,*,*,load1")
- (set_attr "pool_range" "*, *, 256,*,*,*, 256")
- (set_attr "neg_pool_range" "*, *, 244,*,*,*, 244")])
-
-(define_insn "movv4hi_internal"
- [(set (match_operand:V4HI 0 "nonimmediate_operand" "=y,m,y,?r,?y,?r,?r")
- (match_operand:V4HI 1 "general_operand" "y,y,mi,y,r,r,mi"))]
- "TARGET_REALLY_IWMMXT"
- "*
- switch (which_alternative)
- {
- case 0: return \"wmov%?\\t%0, %1\";
- case 1: return \"wstrd%?\\t%1, %0\";
- case 2: return \"wldrd%?\\t%0, %1\";
- case 3: return \"tmrrc%?\\t%Q0, %R0, %1\";
- case 4: return \"tmcrr%?\\t%0, %Q1, %R1\";
- case 5: return \"#\";
- default: return output_move_double (operands);
- }"
- [(set_attr "predicable" "yes")
- (set_attr "length" "4, 4, 4,4,4,8, 8")
- (set_attr "type" "*,store1,load1,*,*,*,load1")
- (set_attr "pool_range" "*, *, 256,*,*,*, 256")
- (set_attr "neg_pool_range" "*, *, 244,*,*,*, 244")])
-
-(define_insn "movv2si_internal"
- [(set (match_operand:V2SI 0 "nonimmediate_operand" "=y,m,y,?r,?y,?r,?r")
- (match_operand:V2SI 1 "general_operand" "y,y,mi,y,r,r,mi"))]
- "TARGET_REALLY_IWMMXT"
- "*
- switch (which_alternative)
- {
- case 0: return \"wmov%?\\t%0, %1\";
- case 1: return \"wstrd%?\\t%1, %0\";
- case 2: return \"wldrd%?\\t%0, %1\";
- case 3: return \"tmrrc%?\\t%Q0, %R0, %1\";
- case 4: return \"tmcrr%?\\t%0, %Q1, %R1\";
- case 5: return \"#\";
- default: return output_move_double (operands);
- }"
- [(set_attr "predicable" "yes")
- (set_attr "length" "4, 4, 4,4,4,8, 24")
- (set_attr "type" "*,store1,load1,*,*,*,load1")
- (set_attr "pool_range" "*, *, 256,*,*,*, 256")
- (set_attr "neg_pool_range" "*, *, 244,*,*,*, 244")])
-
-;; This pattern should not be needed. It is to match a
-;; wierd case generated by GCC when no optimizations are
-;; enabled. (Try compiling gcc/testsuite/gcc.c-torture/
-;; compile/simd-5.c at -O0). The mode for operands[1] is
-;; deliberately omitted.
-(define_insn "movv2si_internal_2"
- [(set (match_operand:V2SI 0 "nonimmediate_operand" "=?r")
- (match_operand 1 "immediate_operand" "mi"))]
- "TARGET_REALLY_IWMMXT"
- "* return output_move_double (operands);"
- [(set_attr "predicable" "yes")
- (set_attr "length" "8")
- (set_attr "type" "load1")
- (set_attr "pool_range" "256")
- (set_attr "neg_pool_range" "244")])
+ (set_attr "length" "4, 4, 4,4,4,8, 8,8")
+ (set_attr "type" "*,store1,load1,*,*,*,load1,store1")
+ (set_attr "pool_range" "*, *, 256,*,*,*, 256,*")
+ (set_attr "neg_pool_range" "*, *, 244,*,*,*, 244,*")])
;; Vector add/subtract
diff --git a/gcc/config/arm/neon.md b/gcc/config/arm/neon.md
index 0c312e7c336..8d10c1e5b42 100644
--- a/gcc/config/arm/neon.md
+++ b/gcc/config/arm/neon.md
@@ -735,7 +735,10 @@
(match_operand:SI 2 "immediate_operand" "i")))]
"TARGET_NEON"
{
- operands[2] = GEN_INT (ffs ((int) INTVAL (operands[2]) - 1));
+ int elt = ffs ((int) INTVAL (operands[2]) - 1);
+ if (BYTES_BIG_ENDIAN)
+ elt = GET_MODE_NUNITS (<MODE>mode) - 1 - elt;
+ operands[2] = GEN_INT (elt);
return "vmov%?.<V_uf_sclr>\t%P0[%c2], %1";
}
@@ -757,6 +760,9 @@
int hi = (elem / half_elts) * 2;
int regno = REGNO (operands[0]);
+ if (BYTES_BIG_ENDIAN)
+ elt = half_elts - 1 - elt;
+
operands[0] = gen_rtx_REG (<V_HALF>mode, regno + hi);
operands[2] = GEN_INT (elt);
@@ -804,7 +810,15 @@
(match_operand:VD 1 "s_register_operand" "w")
(parallel [(match_operand:SI 2 "immediate_operand" "i")])))]
"TARGET_NEON"
- "vmov%?.<V_uf_sclr>\t%0, %P1[%c2]"
+{
+ if (BYTES_BIG_ENDIAN)
+ {
+ int elt = INTVAL (operands[2]);
+ elt = GET_MODE_NUNITS (<MODE>mode) - 1 - elt;
+ operands[2] = GEN_INT (elt);
+ }
+ return "vmov%?.<V_uf_sclr>\t%0, %P1[%c2]";
+}
[(set_attr "predicable" "yes")
(set_attr "neon_type" "neon_bp_simple")]
)
@@ -821,6 +835,9 @@
int hi = (INTVAL (operands[2]) / half_elts) * 2;
int regno = REGNO (operands[1]);
+ if (BYTES_BIG_ENDIAN)
+ elt = half_elts - 1 - elt;
+
operands[1] = gen_rtx_REG (<V_HALF>mode, regno + hi);
operands[2] = GEN_INT (elt);
@@ -2413,7 +2430,15 @@
(match_operand:VD 1 "s_register_operand" "w")
(parallel [(match_operand:SI 2 "immediate_operand" "i")]))))]
"TARGET_NEON"
- "vmov%?.s<V_sz_elem>\t%0, %P1[%c2]"
+{
+ if (BYTES_BIG_ENDIAN)
+ {
+ int elt = INTVAL (operands[2]);
+ elt = GET_MODE_NUNITS (<MODE>mode) - 1 - elt;
+ operands[2] = GEN_INT (elt);
+ }
+ return "vmov%?.s<V_sz_elem>\t%0, %P1[%c2]";
+}
[(set_attr "predicable" "yes")
(set_attr "neon_type" "neon_bp_simple")]
)
@@ -2425,7 +2450,15 @@
(match_operand:VD 1 "s_register_operand" "w")
(parallel [(match_operand:SI 2 "immediate_operand" "i")]))))]
"TARGET_NEON"
- "vmov%?.u<V_sz_elem>\t%0, %P1[%c2]"
+{
+ if (BYTES_BIG_ENDIAN)
+ {
+ int elt = INTVAL (operands[2]);
+ elt = GET_MODE_NUNITS (<MODE>mode) - 1 - elt;
+ operands[2] = GEN_INT (elt);
+ }
+ return "vmov%?.u<V_sz_elem>\t%0, %P1[%c2]";
+}
[(set_attr "predicable" "yes")
(set_attr "neon_type" "neon_bp_simple")]
)
@@ -2442,10 +2475,14 @@
int regno = REGNO (operands[1]);
unsigned int halfelts = GET_MODE_NUNITS (<MODE>mode) / 2;
unsigned int elt = INTVAL (operands[2]);
+ unsigned int elt_adj = elt % halfelts;
+
+ if (BYTES_BIG_ENDIAN)
+ elt_adj = halfelts - 1 - elt_adj;
ops[0] = operands[0];
ops[1] = gen_rtx_REG (<V_HALF>mode, regno + 2 * (elt / halfelts));
- ops[2] = GEN_INT (elt % halfelts);
+ ops[2] = GEN_INT (elt_adj);
output_asm_insn ("vmov%?.s<V_sz_elem>\t%0, %P1[%c2]", ops);
return "";
@@ -2466,10 +2503,14 @@
int regno = REGNO (operands[1]);
unsigned int halfelts = GET_MODE_NUNITS (<MODE>mode) / 2;
unsigned int elt = INTVAL (operands[2]);
+ unsigned int elt_adj = elt % halfelts;
+
+ if (BYTES_BIG_ENDIAN)
+ elt_adj = halfelts - 1 - elt_adj;
ops[0] = operands[0];
ops[1] = gen_rtx_REG (<V_HALF>mode, regno + 2 * (elt / halfelts));
- ops[2] = GEN_INT (elt % halfelts);
+ ops[2] = GEN_INT (elt_adj);
output_asm_insn ("vmov%?.u<V_sz_elem>\t%0, %P1[%c2]", ops);
return "";
@@ -2490,6 +2531,20 @@
neon_lane_bounds (operands[2], 0, GET_MODE_NUNITS (<MODE>mode));
+ if (BYTES_BIG_ENDIAN)
+ {
+ /* The intrinsics are defined in terms of a model where the
+ element ordering in memory is vldm order, whereas the generic
+ RTL is defined in terms of a model where the element ordering
+ in memory is array order. Convert the lane number to conform
+ to this model. */
+ unsigned int elt = INTVAL (operands[2]);
+ unsigned int reg_nelts
+ = 64 / GET_MODE_BITSIZE (GET_MODE_INNER (<MODE>mode));
+ elt ^= reg_nelts - 1;
+ operands[2] = GEN_INT (elt);
+ }
+
if ((magic & 3) == 3 || GET_MODE_BITSIZE (GET_MODE_INNER (<MODE>mode)) == 32)
insn = gen_vec_extract<mode> (operands[0], operands[1], operands[2]);
else
diff --git a/gcc/config/avr/avr-protos.h b/gcc/config/avr/avr-protos.h
index 7665555fd84..bcf81d9afc5 100644
--- a/gcc/config/avr/avr-protos.h
+++ b/gcc/config/avr/avr-protos.h
@@ -94,7 +94,7 @@ extern void avr_output_bld (rtx operands[], int bit_nr);
extern void avr_output_addr_vec_elt (FILE *stream, int value);
extern const char *avr_out_sbxx_branch (rtx insn, rtx operands[]);
-extern enum reg_class preferred_reload_class (rtx x, enum reg_class class);
+extern enum reg_class preferred_reload_class (rtx x, enum reg_class rclass);
extern int extra_constraint_Q (rtx x);
extern rtx legitimize_address (rtx x, rtx oldx, enum machine_mode mode);
extern int adjust_insn_length (rtx insn, int len);
@@ -111,21 +111,21 @@ extern int reg_unused_after (rtx insn, rtx reg);
extern int _reg_unused_after (rtx insn, rtx reg);
extern int avr_jump_mode (rtx x, rtx insn);
extern int byte_immediate_operand (rtx op, enum machine_mode mode);
-extern int test_hard_reg_class (enum reg_class class, rtx x);
+extern int test_hard_reg_class (enum reg_class rclass, rtx x);
extern int jump_over_one_insn_p (rtx insn, rtx dest);
extern int avr_hard_regno_mode_ok (int regno, enum machine_mode mode);
extern void final_prescan_insn (rtx insn, rtx *operand, int num_operands);
extern int avr_simplify_comparison_p (enum machine_mode mode,
- RTX_CODE operator, rtx x);
+ RTX_CODE op, rtx x);
extern RTX_CODE avr_normalize_condition (RTX_CODE condition);
extern int compare_eq_p (rtx insn);
-extern void out_shift_with_cnt (const char *template, rtx insn,
+extern void out_shift_with_cnt (const char *templ, rtx insn,
rtx operands[], int *len, int t_len);
#endif /* RTX_CODE */
#ifdef HAVE_MACHINE_MODES
-extern int class_max_nregs (enum reg_class class, enum machine_mode mode);
+extern int class_max_nregs (enum reg_class rclass, enum machine_mode mode);
#endif /* HAVE_MACHINE_MODES */
#ifdef REAL_VALUE_TYPE
diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c
index 84625d81f8a..5fbf57189ec 100644
--- a/gcc/config/avr/avr.c
+++ b/gcc/config/avr/avr.c
@@ -192,12 +192,12 @@ static const struct mcu_type_s avr_mcu_types[] = {
{ "at86rf401", ARCH_AVR25, "__AVR_AT86RF401__" },
/* Classic, > 8K, <= 64K. */
{ "avr3", ARCH_AVR3, NULL },
- { "at43usb320", ARCH_AVR3, "__AVR_AT43USB320__" },
{ "at43usb355", ARCH_AVR3, "__AVR_AT43USB355__" },
{ "at76c711", ARCH_AVR3, "__AVR_AT76C711__" },
/* Classic, == 128K. */
{ "avr31", ARCH_AVR31, NULL },
{ "atmega103", ARCH_AVR31, "__AVR_ATmega103__" },
+ { "at43usb320", ARCH_AVR31, "__AVR_AT43USB320__" },
/* Classic + MOVW + JMP/CALL. */
{ "avr35", ARCH_AVR35, NULL },
{ "at90usb82", ARCH_AVR35, "__AVR_AT90USB82__" },
@@ -1403,7 +1403,7 @@ notice_update_cc (rtx body ATTRIBUTE_UNUSED, rtx insn)
class CLASS needed to hold a value of mode MODE. */
int
-class_max_nregs (enum reg_class class ATTRIBUTE_UNUSED,enum machine_mode mode)
+class_max_nregs (enum reg_class rclass ATTRIBUTE_UNUSED,enum machine_mode mode)
{
return ((GET_MODE_SIZE (mode) + UNITS_PER_WORD - 1) / UNITS_PER_WORD);
}
@@ -1566,14 +1566,14 @@ final_prescan_insn (rtx insn, rtx *operand ATTRIBUTE_UNUSED,
/* Return 0 if undefined, 1 if always true or always false. */
int
-avr_simplify_comparison_p (enum machine_mode mode, RTX_CODE operator, rtx x)
+avr_simplify_comparison_p (enum machine_mode mode, RTX_CODE op, rtx x)
{
unsigned int max = (mode == QImode ? 0xff :
mode == HImode ? 0xffff :
mode == SImode ? 0xffffffff : 0);
- if (max && operator && GET_CODE (x) == CONST_INT)
+ if (max && op && GET_CODE (x) == CONST_INT)
{
- if (unsigned_condition (operator) != operator)
+ if (unsigned_condition (op) != op)
max >>= 1;
if (max != (INTVAL (x) & max)
@@ -1743,15 +1743,15 @@ output_movqi (rtx insn, rtx operands[], int *l)
}
else if (GET_CODE (dest) == MEM)
{
- const char *template;
+ const char *templ;
if (src == const0_rtx)
operands[1] = zero_reg_rtx;
- template = out_movqi_mr_r (insn, operands, real_l);
+ templ = out_movqi_mr_r (insn, operands, real_l);
if (!real_l)
- output_asm_insn (template, operands);
+ output_asm_insn (templ, operands);
operands[1] = src;
}
@@ -1893,15 +1893,15 @@ output_movhi (rtx insn, rtx operands[], int *l)
}
else if (GET_CODE (dest) == MEM)
{
- const char *template;
+ const char *templ;
if (src == const0_rtx)
operands[1] = zero_reg_rtx;
- template = out_movhi_mr_r (insn, operands, real_l);
+ templ = out_movhi_mr_r (insn, operands, real_l);
if (!real_l)
- output_asm_insn (template, operands);
+ output_asm_insn (templ, operands);
operands[1] = src;
return "";
@@ -2581,15 +2581,15 @@ output_movsisf(rtx insn, rtx operands[], int *l)
}
else if (GET_CODE (dest) == MEM)
{
- const char *template;
+ const char *templ;
if (src == const0_rtx)
operands[1] = zero_reg_rtx;
- template = out_movsi_mr_r (insn, operands, real_l);
+ templ = out_movsi_mr_r (insn, operands, real_l);
if (!real_l)
- output_asm_insn (template, operands);
+ output_asm_insn (templ, operands);
operands[1] = src;
return "";
@@ -2930,7 +2930,7 @@ out_tstsi (rtx insn, int *l)
carefully hand-optimized in ?sh??i3_out. */
void
-out_shift_with_cnt (const char *template, rtx insn, rtx operands[],
+out_shift_with_cnt (const char *templ, rtx insn, rtx operands[],
int *len, int t_len)
{
rtx op[10];
@@ -2975,7 +2975,7 @@ out_shift_with_cnt (const char *template, rtx insn, rtx operands[],
else
{
while (count-- > 0)
- output_asm_insn (template, op);
+ output_asm_insn (templ, op);
}
return;
@@ -3056,7 +3056,7 @@ out_shift_with_cnt (const char *template, rtx insn, rtx operands[],
else
{
strcat (str, "\n1:\t");
- strcat (str, template);
+ strcat (str, templ);
strcat (str, second_label ? "\n2:\t" : "\n\t");
strcat (str, use_zero_reg ? AS1 (lsr,%3) : AS1 (dec,%3));
strcat (str, CR_TAB);
@@ -5735,19 +5735,19 @@ avr_function_value (const_tree type,
in class CLASS. */
enum reg_class
-preferred_reload_class (rtx x ATTRIBUTE_UNUSED, enum reg_class class)
+preferred_reload_class (rtx x ATTRIBUTE_UNUSED, enum reg_class rclass)
{
- return class;
+ return rclass;
}
int
-test_hard_reg_class (enum reg_class class, rtx x)
+test_hard_reg_class (enum reg_class rclass, rtx x)
{
int regno = true_regnum (x);
if (regno < 0)
return 0;
- if (TEST_HARD_REG_CLASS (class, regno))
+ if (TEST_HARD_REG_CLASS (rclass, regno))
return 1;
return 0;
diff --git a/gcc/config/avr/avr.h b/gcc/config/avr/avr.h
index 2b72112822c..6a27c3b7edb 100644
--- a/gcc/config/avr/avr.h
+++ b/gcc/config/avr/avr.h
@@ -931,10 +931,10 @@ mmcu=*:-mmcu=%*}"
%{mmcu=attiny48:crttn48.o%s} \
%{mmcu=attiny88:crttn88.o%s} \
%{mmcu=attiny167:crttn167.o%s} \
-%{mmcu=at43usb320|mmcu=avr3:crt43320.o%s} \
-%{mmcu=at43usb355:crt43355.o%s} \
+%{mmcu=at43usb355|mmcu=avr3:crt43355.o%s} \
%{mmcu=at76c711:crt76711.o%s} \
%{mmcu=atmega103|mmcu=avr31:crtm103.o%s} \
+%{mmcu=at43usb320:crt43320.o%s} \
%{mmcu=at90usb162|mmcu=avr35:crtusb162.o%s} \
%{mmcu=at90usb82:crtusb82.o%s} \
%{mmcu=atmega8|mmcu=avr4:crtm8.o%s} \
diff --git a/gcc/config/avr/t-avr b/gcc/config/avr/t-avr
index e64152bda19..082da67756d 100644
--- a/gcc/config/avr/t-avr
+++ b/gcc/config/avr/t-avr
@@ -58,10 +58,10 @@ MULTILIB_MATCHES = \
mmcu?avr25=mmcu?attiny48 \
mmcu?avr25=mmcu?attiny88 \
mmcu?avr25=mmcu?at86rf401 \
- mmcu?avr3=mmcu?at43usb320 \
mmcu?avr3=mmcu?at43usb355 \
mmcu?avr3=mmcu?at76c711 \
mmcu?avr31=mmcu?atmega103 \
+ mmcu?avr31=mmcu?at43usb320 \
mmcu?avr35=mmcu?at90usb82 \
mmcu?avr35=mmcu?at90usb162 \
mmcu?avr35=mmcu?attiny167 \
diff --git a/gcc/config/bfin/bfin.c b/gcc/config/bfin/bfin.c
index 05a5e495cea..8fda5c01d8e 100644
--- a/gcc/config/bfin/bfin.c
+++ b/gcc/config/bfin/bfin.c
@@ -279,7 +279,7 @@ static rtx
legitimize_pic_address (rtx orig, rtx reg, rtx picreg)
{
rtx addr = orig;
- rtx new = orig;
+ rtx new_rtx = orig;
if (GET_CODE (addr) == SYMBOL_REF || GET_CODE (addr) == LABEL_REF)
{
@@ -301,9 +301,9 @@ legitimize_pic_address (rtx orig, rtx reg, rtx picreg)
}
tmp = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, addr), unspec);
- new = gen_const_mem (Pmode, gen_rtx_PLUS (Pmode, picreg, tmp));
+ new_rtx = gen_const_mem (Pmode, gen_rtx_PLUS (Pmode, picreg, tmp));
- emit_move_insn (reg, new);
+ emit_move_insn (reg, new_rtx);
if (picreg == pic_offset_table_rtx)
crtl->uses_pic_offset_table = 1;
return reg;
@@ -348,7 +348,7 @@ legitimize_pic_address (rtx orig, rtx reg, rtx picreg)
return gen_rtx_PLUS (Pmode, base, addr);
}
- return new;
+ return new_rtx;
}
/* Stack frame layout. */
@@ -1129,8 +1129,7 @@ bfin_load_pic_reg (rtx dest)
struct cgraph_local_info *i = NULL;
rtx addr, insn;
- if (flag_unit_at_a_time)
- i = cgraph_local_info (current_function_decl);
+ i = cgraph_local_info (current_function_decl);
/* Functions local to the translation unit don't need to reload the
pic reg, since the caller always passes a usable one. */
@@ -1906,6 +1905,7 @@ static bool
bfin_function_ok_for_sibcall (tree decl ATTRIBUTE_UNUSED,
tree exp ATTRIBUTE_UNUSED)
{
+ struct cgraph_local_info *this_func, *called_func;
e_funkind fkind = funkind (TREE_TYPE (current_function_decl));
if (fkind != SUBROUTINE)
return false;
@@ -1917,17 +1917,10 @@ bfin_function_ok_for_sibcall (tree decl ATTRIBUTE_UNUSED,
not need to reload P5 in the prologue, but the sibcall wil pop P5 in the
sibcall epilogue, and we end up with the wrong value in P5. */
- if (!flag_unit_at_a_time || decl == NULL)
- /* Not enough information. */
- return false;
-
- {
- struct cgraph_local_info *this_func, *called_func;
- this_func = cgraph_local_info (current_function_decl);
- called_func = cgraph_local_info (decl);
- return !called_func->local || this_func->local;
- }
+ this_func = cgraph_local_info (current_function_decl);
+ called_func = cgraph_local_info (decl);
+ return !called_func->local || this_func->local;
}
/* Emit RTL insns to initialize the variable parts of a trampoline at
@@ -2163,14 +2156,14 @@ int
hard_regno_mode_ok (int regno, enum machine_mode mode)
{
/* Allow only dregs to store value of mode HI or QI */
- enum reg_class class = REGNO_REG_CLASS (regno);
+ enum reg_class rclass = REGNO_REG_CLASS (regno);
if (mode == CCmode)
return 0;
if (mode == V2HImode)
return D_REGNO_P (regno);
- if (class == CCREGS)
+ if (rclass == CCREGS)
return mode == BImode;
if (mode == PDImode || mode == V2PDImode)
return regno == REG_A0 || regno == REG_A1;
@@ -2239,24 +2232,24 @@ bfin_register_move_cost (enum machine_mode mode,
int
bfin_memory_move_cost (enum machine_mode mode ATTRIBUTE_UNUSED,
- enum reg_class class,
+ enum reg_class rclass,
int in ATTRIBUTE_UNUSED)
{
/* Make memory accesses slightly more expensive than any register-register
move. Also, penalize non-DP registers, since they need secondary
reloads to load and store. */
- if (! reg_class_subset_p (class, DPREGS))
+ if (! reg_class_subset_p (rclass, DPREGS))
return 10;
return 8;
}
/* Inform reload about cases where moving X with a mode MODE to a register in
- CLASS requires an extra scratch register. Return the class needed for the
+ RCLASS requires an extra scratch register. Return the class needed for the
scratch register. */
static enum reg_class
-bfin_secondary_reload (bool in_p, rtx x, enum reg_class class,
+bfin_secondary_reload (bool in_p, rtx x, enum reg_class rclass,
enum machine_mode mode, secondary_reload_info *sri)
{
/* If we have HImode or QImode, we can only use DREGS as secondary registers;
@@ -2287,11 +2280,11 @@ bfin_secondary_reload (bool in_p, rtx x, enum reg_class class,
rtx op2 = XEXP (x, 1);
int large_constant_p = ! satisfies_constraint_Ks7 (op2);
- if (class == PREGS || class == PREGS_CLOBBERED)
+ if (rclass == PREGS || rclass == PREGS_CLOBBERED)
return NO_REGS;
/* If destination is a DREG, we can do this without a scratch register
if the constant is valid for an add instruction. */
- if ((class == DREGS || class == DPREGS)
+ if ((rclass == DREGS || rclass == DPREGS)
&& ! large_constant_p)
return NO_REGS;
/* Reloading to anything other than a DREG? Use a PREG scratch
@@ -2304,11 +2297,11 @@ bfin_secondary_reload (bool in_p, rtx x, enum reg_class class,
AREGS are an exception; they can only move to or from another register
in AREGS or one in DREGS. They can also be assigned the constant 0. */
if (x_class == AREGS || x_class == EVEN_AREGS || x_class == ODD_AREGS)
- return (class == DREGS || class == AREGS || class == EVEN_AREGS
- || class == ODD_AREGS
+ return (rclass == DREGS || rclass == AREGS || rclass == EVEN_AREGS
+ || rclass == ODD_AREGS
? NO_REGS : DREGS);
- if (class == AREGS || class == EVEN_AREGS || class == ODD_AREGS)
+ if (rclass == AREGS || rclass == EVEN_AREGS || rclass == ODD_AREGS)
{
if (code == MEM)
{
@@ -2325,15 +2318,15 @@ bfin_secondary_reload (bool in_p, rtx x, enum reg_class class,
}
/* CCREGS can only be moved from/to DREGS. */
- if (class == CCREGS && x_class != DREGS)
+ if (rclass == CCREGS && x_class != DREGS)
return DREGS;
- if (x_class == CCREGS && class != DREGS)
+ if (x_class == CCREGS && rclass != DREGS)
return DREGS;
/* All registers other than AREGS can load arbitrary constants. The only
case that remains is MEM. */
if (code == MEM)
- if (! reg_class_subset_p (class, default_class))
+ if (! reg_class_subset_p (rclass, default_class))
return default_class;
return NO_REGS;
@@ -5134,12 +5127,12 @@ bfin_output_mi_thunk (FILE *file ATTRIBUTE_UNUSED,
{
rtx xops[3];
/* The this parameter is passed as the first argument. */
- rtx this = gen_rtx_REG (Pmode, REG_R0);
+ rtx this_rtx = gen_rtx_REG (Pmode, REG_R0);
/* Adjust the this parameter by a fixed constant. */
if (delta)
{
- xops[1] = this;
+ xops[1] = this_rtx;
if (delta >= -64 && delta <= 63)
{
xops[0] = GEN_INT (delta);
@@ -5182,7 +5175,7 @@ bfin_output_mi_thunk (FILE *file ATTRIBUTE_UNUSED,
output_asm_insn ("%h1 = %h0; %d1 = %d0; %2 = %2 + %1", xops);
xops[0] = gen_rtx_MEM (Pmode, p2tmp);
}
- xops[2] = this;
+ xops[2] = this_rtx;
output_asm_insn ("%1 = %0; %2 = %2 + %1;", xops);
}
diff --git a/gcc/config/crx/crx.c b/gcc/config/crx/crx.c
index 9e8c3a97cf1..2f4aa6f176b 100644
--- a/gcc/config/crx/crx.c
+++ b/gcc/config/crx/crx.c
@@ -371,11 +371,11 @@ crx_regno_reg_class (int regno)
/* Transfer between HILO_REGS and memory via secondary reloading. */
enum reg_class
-crx_secondary_reload_class (enum reg_class class,
+crx_secondary_reload_class (enum reg_class rclass,
enum machine_mode mode ATTRIBUTE_UNUSED,
rtx x ATTRIBUTE_UNUSED)
{
- if (reg_classes_intersect_p (class, HILO_REGS)
+ if (reg_classes_intersect_p (rclass, HILO_REGS)
&& true_regnum (x) == -1)
return GENERAL_REGS;
@@ -839,22 +839,22 @@ crx_address_cost (rtx addr)
}
/* Return the cost of moving data of mode MODE between a register of class
- * CLASS and memory; IN is zero if the value is to be written to memory,
+ * RCLASS and memory; IN is zero if the value is to be written to memory,
* nonzero if it is to be read in. This cost is relative to those in
* REGISTER_MOVE_COST. */
int
crx_memory_move_cost (enum machine_mode mode,
- enum reg_class class ATTRIBUTE_UNUSED,
+ enum reg_class rclass ATTRIBUTE_UNUSED,
int in ATTRIBUTE_UNUSED)
{
/* One LD or ST takes twice the time of a simple reg-reg move */
- if (reg_classes_intersect_p (class, GENERAL_REGS))
+ if (reg_classes_intersect_p (rclass, GENERAL_REGS))
{
/* printf ("GENERAL_REGS LD/ST = %d\n", 4 * HARD_REGNO_NREGS (0, mode));*/
return 4 * HARD_REGNO_NREGS (0, mode);
}
- else if (reg_classes_intersect_p (class, HILO_REGS))
+ else if (reg_classes_intersect_p (rclass, HILO_REGS))
{
/* HILO to memory and vice versa */
/* printf ("HILO_REGS %s = %d\n", in ? "LD" : "ST",
diff --git a/gcc/config/frv/frv-protos.h b/gcc/config/frv/frv-protos.h
index dd41fc27767..8d6b29bc7cf 100644
--- a/gcc/config/frv/frv-protos.h
+++ b/gcc/config/frv/frv-protos.h
@@ -104,13 +104,13 @@ extern void frv_ifcvt_modify_cancel (ce_if_block_t *);
extern int frv_trampoline_size (void);
extern void frv_initialize_trampoline (rtx, rtx, rtx);
extern enum reg_class frv_secondary_reload_class
- (enum reg_class class,
+ (enum reg_class rclass,
enum machine_mode mode,
rtx x, int);
-extern int frv_class_likely_spilled_p (enum reg_class class);
+extern int frv_class_likely_spilled_p (enum reg_class rclass);
extern int frv_hard_regno_mode_ok (int, enum machine_mode);
extern int frv_hard_regno_nregs (int, enum machine_mode);
-extern int frv_class_max_nregs (enum reg_class class,
+extern int frv_class_max_nregs (enum reg_class rclass,
enum machine_mode mode);
extern int frv_legitimate_constant_p (rtx);
extern enum machine_mode frv_select_cc_mode (enum rtx_code, rtx, rtx);
diff --git a/gcc/config/frv/frv.c b/gcc/config/frv/frv.c
index 6ba924b1df7..7fa2e22f094 100644
--- a/gcc/config/frv/frv.c
+++ b/gcc/config/frv/frv.c
@@ -651,83 +651,83 @@ frv_override_options (void)
for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
{
- enum reg_class class;
+ enum reg_class rclass;
if (GPR_P (regno))
{
int gpr_reg = regno - GPR_FIRST;
if (gpr_reg == GR8_REG)
- class = GR8_REGS;
+ rclass = GR8_REGS;
else if (gpr_reg == GR9_REG)
- class = GR9_REGS;
+ rclass = GR9_REGS;
else if (gpr_reg == GR14_REG)
- class = FDPIC_FPTR_REGS;
+ rclass = FDPIC_FPTR_REGS;
else if (gpr_reg == FDPIC_REGNO)
- class = FDPIC_REGS;
+ rclass = FDPIC_REGS;
else if ((gpr_reg & 3) == 0)
- class = QUAD_REGS;
+ rclass = QUAD_REGS;
else if ((gpr_reg & 1) == 0)
- class = EVEN_REGS;
+ rclass = EVEN_REGS;
else
- class = GPR_REGS;
+ rclass = GPR_REGS;
}
else if (FPR_P (regno))
{
int fpr_reg = regno - GPR_FIRST;
if ((fpr_reg & 3) == 0)
- class = QUAD_FPR_REGS;
+ rclass = QUAD_FPR_REGS;
else if ((fpr_reg & 1) == 0)
- class = FEVEN_REGS;
+ rclass = FEVEN_REGS;
else
- class = FPR_REGS;
+ rclass = FPR_REGS;
}
else if (regno == LR_REGNO)
- class = LR_REG;
+ rclass = LR_REG;
else if (regno == LCR_REGNO)
- class = LCR_REG;
+ rclass = LCR_REG;
else if (ICC_P (regno))
- class = ICC_REGS;
+ rclass = ICC_REGS;
else if (FCC_P (regno))
- class = FCC_REGS;
+ rclass = FCC_REGS;
else if (ICR_P (regno))
- class = ICR_REGS;
+ rclass = ICR_REGS;
else if (FCR_P (regno))
- class = FCR_REGS;
+ rclass = FCR_REGS;
else if (ACC_P (regno))
{
int r = regno - ACC_FIRST;
if ((r & 3) == 0)
- class = QUAD_ACC_REGS;
+ rclass = QUAD_ACC_REGS;
else if ((r & 1) == 0)
- class = EVEN_ACC_REGS;
+ rclass = EVEN_ACC_REGS;
else
- class = ACC_REGS;
+ rclass = ACC_REGS;
}
else if (ACCG_P (regno))
- class = ACCG_REGS;
+ rclass = ACCG_REGS;
else
- class = NO_REGS;
+ rclass = NO_REGS;
- regno_reg_class[regno] = class;
+ regno_reg_class[regno] = rclass;
}
/* Check for small data option */
@@ -1539,14 +1539,14 @@ frv_function_prologue (FILE *file, HOST_WIDE_INT size ATTRIBUTE_UNUSED)
static rtx
frv_alloc_temp_reg (
frv_tmp_reg_t *info, /* which registers are available */
- enum reg_class class, /* register class desired */
+ enum reg_class rclass, /* register class desired */
enum machine_mode mode, /* mode to allocate register with */
int mark_as_used, /* register not available after allocation */
int no_abort) /* return NULL instead of aborting */
{
- int regno = info->next_reg[ (int)class ];
+ int regno = info->next_reg[ (int)rclass ];
int orig_regno = regno;
- HARD_REG_SET *reg_in_class = &reg_class_contents[ (int)class ];
+ HARD_REG_SET *reg_in_class = &reg_class_contents[ (int)rclass ];
int i, nr;
for (;;)
@@ -1565,7 +1565,7 @@ frv_alloc_temp_reg (
}
nr = HARD_REGNO_NREGS (regno, mode);
- info->next_reg[ (int)class ] = regno + nr;
+ info->next_reg[ (int)rclass ] = regno + nr;
if (mark_as_used)
for (i = 0; i < nr; i++)
@@ -2207,7 +2207,7 @@ frv_expand_builtin_va_start (tree valist, rtx nextarg)
debug_rtx (nextarg);
}
- t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (valist), valist,
+ t = build2 (MODIFY_EXPR, TREE_TYPE (valist), valist,
fold_convert (TREE_TYPE (valist),
make_tree (sizetype, nextarg)));
TREE_SIDE_EFFECTS (t) = 1;
@@ -2777,7 +2777,7 @@ frv_print_operand (FILE * file, rtx x, int code)
HOST_WIDE_INT value;
int offset;
- if (code != 0 && !isalpha (code))
+ if (code != 0 && !ISALPHA (code))
value = 0;
else if (GET_CODE (x) == CONST_INT)
@@ -6300,11 +6300,11 @@ frv_initialize_trampoline (rtx addr, rtx fnaddr, rtx static_chain)
You should define these macros to indicate to the reload phase that it may
need to allocate at least one register for a reload in addition to the
register to contain the data. Specifically, if copying X to a register
- CLASS in MODE requires an intermediate register, you should define
+ RCLASS in MODE requires an intermediate register, you should define
`SECONDARY_INPUT_RELOAD_CLASS' to return the largest register class all of
whose registers can be used as intermediate registers or scratch registers.
- If copying a register CLASS in MODE to X requires an intermediate or scratch
+ If copying a register RCLASS in MODE to X requires an intermediate or scratch
register, `SECONDARY_OUTPUT_RELOAD_CLASS' should be defined to return the
largest register class required. If the requirements for input and output
reloads are the same, the macro `SECONDARY_RELOAD_CLASS' should be used
@@ -6312,7 +6312,7 @@ frv_initialize_trampoline (rtx addr, rtx fnaddr, rtx static_chain)
The values returned by these macros are often `GENERAL_REGS'. Return
`NO_REGS' if no spare register is needed; i.e., if X can be directly copied
- to or from a register of CLASS in MODE without requiring a scratch register.
+ to or from a register of RCLASS in MODE without requiring a scratch register.
Do not define this macro if it would always return `NO_REGS'.
If a scratch register is required (either with or without an intermediate
@@ -6323,7 +6323,7 @@ frv_initialize_trampoline (rtx addr, rtx fnaddr, rtx static_chain)
Define constraints for the reload register and scratch register that contain
a single register class. If the original reload register (whose class is
- CLASS) can meet the constraint given in the pattern, the value returned by
+ RCLASS) can meet the constraint given in the pattern, the value returned by
these macros is used for the class of the scratch register. Otherwise, two
additional reload registers are required. Their classes are obtained from
the constraints in the insn pattern.
@@ -6341,14 +6341,14 @@ frv_initialize_trampoline (rtx addr, rtx fnaddr, rtx static_chain)
This case often occurs between floating-point and general registers. */
enum reg_class
-frv_secondary_reload_class (enum reg_class class,
+frv_secondary_reload_class (enum reg_class rclass,
enum machine_mode mode ATTRIBUTE_UNUSED,
rtx x,
int in_p ATTRIBUTE_UNUSED)
{
enum reg_class ret;
- switch (class)
+ switch (rclass)
{
default:
ret = NO_REGS;
@@ -6405,10 +6405,10 @@ frv_secondary_reload_class (enum reg_class class,
/* A C expression whose value is nonzero if pseudos that have been assigned to
- registers of class CLASS would likely be spilled because registers of CLASS
+ registers of class RCLASS would likely be spilled because registers of RCLASS
are needed for spill registers.
- The default value of this macro returns 1 if CLASS has exactly one register
+ The default value of this macro returns 1 if RCLASS has exactly one register
and zero otherwise. On most machines, this default should be used. Only
define this macro to some other expression if pseudo allocated by
`local-alloc.c' end up in memory because their hard registers were needed
@@ -6420,9 +6420,9 @@ frv_secondary_reload_class (enum reg_class class,
register allocation. */
int
-frv_class_likely_spilled_p (enum reg_class class)
+frv_class_likely_spilled_p (enum reg_class rclass)
{
- switch (class)
+ switch (rclass)
{
default:
break;
@@ -6686,11 +6686,11 @@ frv_hard_regno_nregs (int regno, enum machine_mode mode)
/* A C expression for the maximum number of consecutive registers of
- class CLASS needed to hold a value of mode MODE.
+ class RCLASS needed to hold a value of mode MODE.
This is closely related to the macro `HARD_REGNO_NREGS'. In fact, the value
- of the macro `CLASS_MAX_NREGS (CLASS, MODE)' should be the maximum value of
- `HARD_REGNO_NREGS (REGNO, MODE)' for all REGNO values in the class CLASS.
+ of the macro `CLASS_MAX_NREGS (RCLASS, MODE)' should be the maximum value of
+ `HARD_REGNO_NREGS (REGNO, MODE)' for all REGNO values in the class RCLASS.
This macro helps control the handling of multiple-word values in
the reload pass.
@@ -6698,9 +6698,9 @@ frv_hard_regno_nregs (int regno, enum machine_mode mode)
This declaration is required. */
int
-frv_class_max_nregs (enum reg_class class, enum machine_mode mode)
+frv_class_max_nregs (enum reg_class rclass, enum machine_mode mode)
{
- if (class == ACCG_REGS)
+ if (rclass == ACCG_REGS)
/* An N-byte value requires N accumulator guards. */
return GET_MODE_SIZE (mode);
else
diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c
index f90bd414735..3d9c0fb7efb 100644
--- a/gcc/config/h8300/h8300.c
+++ b/gcc/config/h8300/h8300.c
@@ -111,6 +111,7 @@ static unsigned int h8300_bitfield_length (rtx, rtx);
static unsigned int h8300_binary_length (rtx, const h8300_length_table *);
static bool h8300_short_move_mem_p (rtx, enum rtx_code);
static unsigned int h8300_move_length (rtx *, const h8300_length_table *);
+static bool h8300_hard_regno_scratch_ok (unsigned int);
/* CPU_TYPE, says what cpu we're compiling for. */
int cpu_type;
@@ -2146,21 +2147,21 @@ h8300_displacement_length (rtx addr, int size)
return h8300_constant_length (offset);
}
-/* Store the class of operand OP in *CLASS and return the length of any
- extra operand fields. SIZE is the number of bytes in OP. CLASS
+/* Store the class of operand OP in *OPCLASS and return the length of any
+ extra operand fields. SIZE is the number of bytes in OP. OPCLASS
can be null if only the length is needed. */
static unsigned int
-h8300_classify_operand (rtx op, int size, enum h8300_operand_class *class)
+h8300_classify_operand (rtx op, int size, enum h8300_operand_class *opclass)
{
enum h8300_operand_class dummy;
- if (class == 0)
- class = &dummy;
+ if (opclass == 0)
+ opclass = &dummy;
if (CONSTANT_P (op))
{
- *class = H8OP_IMMEDIATE;
+ *opclass = H8OP_IMMEDIATE;
/* Byte-sized immediates are stored in the opcode fields. */
if (size == 1)
@@ -2181,27 +2182,27 @@ h8300_classify_operand (rtx op, int size, enum h8300_operand_class *class)
op = XEXP (op, 0);
if (CONSTANT_P (op))
{
- *class = H8OP_MEM_ABSOLUTE;
+ *opclass = H8OP_MEM_ABSOLUTE;
return h8300_constant_length (op);
}
else if (GET_CODE (op) == PLUS && CONSTANT_P (XEXP (op, 1)))
{
- *class = H8OP_MEM_COMPLEX;
+ *opclass = H8OP_MEM_COMPLEX;
return h8300_displacement_length (op, size);
}
else if (GET_RTX_CLASS (GET_CODE (op)) == RTX_AUTOINC)
{
- *class = H8OP_MEM_COMPLEX;
+ *opclass = H8OP_MEM_COMPLEX;
return 0;
}
else if (register_operand (op, VOIDmode))
{
- *class = H8OP_MEM_BASE;
+ *opclass = H8OP_MEM_BASE;
return 0;
}
}
gcc_assert (register_operand (op, VOIDmode));
- *class = H8OP_REGISTER;
+ *opclass = H8OP_REGISTER;
return 0;
}
@@ -2227,12 +2228,12 @@ h8300_length_from_table (rtx op1, rtx op2, const h8300_length_table *table)
unsigned int
h8300_unary_length (rtx op)
{
- enum h8300_operand_class class;
+ enum h8300_operand_class opclass;
unsigned int size, operand_length;
size = GET_MODE_SIZE (GET_MODE (op));
- operand_length = h8300_classify_operand (op, size, &class);
- switch (class)
+ operand_length = h8300_classify_operand (op, size, &opclass);
+ switch (opclass)
{
case H8OP_REGISTER:
return 2;
@@ -2256,13 +2257,13 @@ h8300_unary_length (rtx op)
static unsigned int
h8300_short_immediate_length (rtx op)
{
- enum h8300_operand_class class;
+ enum h8300_operand_class opclass;
unsigned int size, operand_length;
size = GET_MODE_SIZE (GET_MODE (op));
- operand_length = h8300_classify_operand (op, size, &class);
+ operand_length = h8300_classify_operand (op, size, &opclass);
- switch (class)
+ switch (opclass)
{
case H8OP_REGISTER:
return 2;
@@ -2282,7 +2283,7 @@ h8300_short_immediate_length (rtx op)
static unsigned int
h8300_bitfield_length (rtx op, rtx op2)
{
- enum h8300_operand_class class;
+ enum h8300_operand_class opclass;
unsigned int size, operand_length;
if (GET_CODE (op) == REG)
@@ -2290,9 +2291,9 @@ h8300_bitfield_length (rtx op, rtx op2)
gcc_assert (GET_CODE (op) != REG);
size = GET_MODE_SIZE (GET_MODE (op));
- operand_length = h8300_classify_operand (op, size, &class);
+ operand_length = h8300_classify_operand (op, size, &opclass);
- switch (class)
+ switch (opclass)
{
case H8OP_MEM_BASE:
case H8OP_MEM_ABSOLUTE:
@@ -4525,15 +4526,15 @@ output_a_shift (rtx *operands)
}
}
-/* Count the number of assembly instructions in a string TEMPLATE. */
+/* Count the number of assembly instructions in a string TEMPL. */
static unsigned int
-h8300_asm_insn_count (const char *template)
+h8300_asm_insn_count (const char *templ)
{
unsigned int count = 1;
- for (; *template; template++)
- if (*template == '\n')
+ for (; *templ; templ++)
+ if (*templ == '\n')
count++;
return count;
@@ -5612,6 +5613,20 @@ h8300_hard_regno_rename_ok (unsigned int old_reg ATTRIBUTE_UNUSED,
return 1;
}
+/* Returns true if register REGNO is safe to be allocated as a scratch
+ register in the current function. */
+
+static bool
+h8300_hard_regno_scratch_ok (unsigned int regno)
+{
+ if (h8300_current_function_interrupt_function_p ()
+ && ! WORD_REG_USED (regno))
+ return false;
+
+ return true;
+}
+
+
/* Return nonzero if X is a legitimate constant. */
int
@@ -5745,6 +5760,9 @@ h8300_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
#undef TARGET_MACHINE_DEPENDENT_REORG
#define TARGET_MACHINE_DEPENDENT_REORG h8300_reorg
+#undef TARGET_HARD_REGNO_SCRATCH_OK
+#define TARGET_HARD_REGNO_SCRATCH_OK h8300_hard_regno_scratch_ok
+
#undef TARGET_DEFAULT_TARGET_FLAGS
#define TARGET_DEFAULT_TARGET_FLAGS TARGET_DEFAULT
diff --git a/gcc/config/host-linux.c b/gcc/config/host-linux.c
index f0666173b62..c94f822f701 100644
--- a/gcc/config/host-linux.c
+++ b/gcc/config/host-linux.c
@@ -84,6 +84,8 @@
# define TRY_EMPTY_VM_SPACE 0x8000000000
#elif defined(__sparc__)
# define TRY_EMPTY_VM_SPACE 0x60000000
+#elif defined(__mc68000__)
+# define TRY_EMPTY_VM_SPACE 0x40000000
#else
# define TRY_EMPTY_VM_SPACE 0
#endif
diff --git a/gcc/config/i386/darwin.h b/gcc/config/i386/darwin.h
index 6001f64b42a..a1defcf9bc6 100644
--- a/gcc/config/i386/darwin.h
+++ b/gcc/config/i386/darwin.h
@@ -75,6 +75,9 @@ along with GCC; see the file COPYING3. If not see
#undef STACK_BOUNDARY
#define STACK_BOUNDARY 128
+#undef MAIN_STACK_BOUNDARY
+#define MAIN_STACK_BOUNDARY 128
+
/* Since we'll never want a stack boundary less aligned than 128 bits
we need the extra work here otherwise bits of gcc get very grumpy
when we ask for lower alignment. We could just reject values less
@@ -263,8 +266,8 @@ extern void darwin_x86_file_end (void);
: (n) >= 11 && (n) <= 18 ? (n) + 1 \
: (n))
-#undef REGISTER_TARGET_PRAGMAS
-#define REGISTER_TARGET_PRAGMAS() DARWIN_REGISTER_TARGET_PRAGMAS()
+#undef REGISTER_SUBTARGET_PRAGMAS
+#define REGISTER_SUBTARGET_PRAGMAS() DARWIN_REGISTER_TARGET_PRAGMAS()
#undef TARGET_SET_DEFAULT_TYPE_ATTRIBUTES
#define TARGET_SET_DEFAULT_TYPE_ATTRIBUTES darwin_set_default_type_attributes
diff --git a/gcc/config/i386/emmintrin.h b/gcc/config/i386/emmintrin.h
index 933dcd61e63..c6590dce4d4 100644
--- a/gcc/config/i386/emmintrin.h
+++ b/gcc/config/i386/emmintrin.h
@@ -726,7 +726,7 @@ _mm_movpi64_epi64 (__m64 __A)
extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_mm_move_epi64 (__m128i __A)
{
- return _mm_set_epi64 ((__m64)0LL, _mm_movepi64_pi64 (__A));
+ return (__m128i)__builtin_ia32_movq128 ((__v2di) __A);
}
/* Create a vector of zeros. */
diff --git a/gcc/config/i386/i386-c.c b/gcc/config/i386/i386-c.c
new file mode 100644
index 00000000000..f0a3a17f9f6
--- /dev/null
+++ b/gcc/config/i386/i386-c.c
@@ -0,0 +1,344 @@
+/* Subroutines used for macro/preprocessor support on the ia-32.
+ Copyright (C) 2008
+ Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "rtl.h"
+#include "tree.h"
+#include "tm_p.h"
+#include "flags.h"
+#include "c-common.h"
+#include "ggc.h"
+#include "target.h"
+#include "target-def.h"
+#include "cpplib.h"
+#include "c-pragma.h"
+
+static bool ix86_pragma_option_parse (tree);
+static void ix86_target_macros_internal
+ (int, enum processor_type, enum processor_type, enum fpmath_unit,
+ void (*def_or_undef) (cpp_reader *, const char *));
+
+
+/* Internal function to either define or undef the appropriate system
+ macros. */
+static void
+ix86_target_macros_internal (int isa_flag,
+ enum processor_type arch,
+ enum processor_type tune,
+ enum fpmath_unit fpmath,
+ void (*def_or_undef) (cpp_reader *,
+ const char *))
+{
+ /* For some of the k6/pentium varients there weren't seperate ISA bits to
+ identify which tune/arch flag was passed, so figure it out here. */
+ size_t arch_len = strlen (ix86_arch_string);
+ size_t tune_len = strlen (ix86_tune_string);
+ int last_arch_char = ix86_arch_string[arch_len - 1];
+ int last_tune_char = ix86_tune_string[tune_len - 1];
+
+ /* Built-ins based on -march=. */
+ switch (arch)
+ {
+ case PROCESSOR_I386:
+ break;
+ case PROCESSOR_I486:
+ def_or_undef (parse_in, "__i486");
+ def_or_undef (parse_in, "__i486__");
+ break;
+ case PROCESSOR_PENTIUM:
+ def_or_undef (parse_in, "__i586");
+ def_or_undef (parse_in, "__i586__");
+ def_or_undef (parse_in, "__pentium");
+ def_or_undef (parse_in, "__pentium__");
+ if (isa_flag & OPTION_MASK_ISA_MMX)
+ def_or_undef (parse_in, "__pentium_mmx__");
+ break;
+ case PROCESSOR_PENTIUMPRO:
+ def_or_undef (parse_in, "__i686");
+ def_or_undef (parse_in, "__i686__");
+ def_or_undef (parse_in, "__pentiumpro");
+ def_or_undef (parse_in, "__pentiumpro__");
+ break;
+ case PROCESSOR_GEODE:
+ def_or_undef (parse_in, "__geode");
+ def_or_undef (parse_in, "__geode__");
+ break;
+ case PROCESSOR_K6:
+ def_or_undef (parse_in, "__k6");
+ def_or_undef (parse_in, "__k6__");
+ if (last_arch_char == '2')
+ def_or_undef (parse_in, "__k6_2__");
+ else if (last_arch_char == '3')
+ def_or_undef (parse_in, "__k6_3__");
+ else if (isa_flag & OPTION_MASK_ISA_3DNOW)
+ def_or_undef (parse_in, "__k6_3__");
+ break;
+ case PROCESSOR_ATHLON:
+ def_or_undef (parse_in, "__athlon");
+ def_or_undef (parse_in, "__athlon__");
+ if (isa_flag & OPTION_MASK_ISA_SSE)
+ def_or_undef (parse_in, "__athlon_sse__");
+ break;
+ case PROCESSOR_K8:
+ def_or_undef (parse_in, "__k8");
+ def_or_undef (parse_in, "__k8__");
+ break;
+ case PROCESSOR_AMDFAM10:
+ def_or_undef (parse_in, "__amdfam10");
+ def_or_undef (parse_in, "__amdfam10__");
+ break;
+ case PROCESSOR_PENTIUM4:
+ def_or_undef (parse_in, "__pentium4");
+ def_or_undef (parse_in, "__pentium4__");
+ break;
+ case PROCESSOR_NOCONA:
+ def_or_undef (parse_in, "__nocona");
+ def_or_undef (parse_in, "__nocona__");
+ break;
+ case PROCESSOR_CORE2:
+ def_or_undef (parse_in, "__core2");
+ def_or_undef (parse_in, "__core2__");
+ break;
+ /* use PROCESSOR_max to not set/unset the arch macro. */
+ case PROCESSOR_max:
+ break;
+ case PROCESSOR_GENERIC32:
+ case PROCESSOR_GENERIC64:
+ gcc_unreachable ();
+ }
+
+ /* Built-ins based on -mtune=. */
+ switch (tune)
+ {
+ case PROCESSOR_I386:
+ def_or_undef (parse_in, "__tune_i386__");
+ break;
+ case PROCESSOR_I486:
+ def_or_undef (parse_in, "__tune_i486__");
+ break;
+ case PROCESSOR_PENTIUM:
+ def_or_undef (parse_in, "__tune_i586__");
+ def_or_undef (parse_in, "__tune_pentium__");
+ if (last_tune_char == 'x')
+ def_or_undef (parse_in, "__tune_pentium_mmx__");
+ break;
+ case PROCESSOR_PENTIUMPRO:
+ def_or_undef (parse_in, "__tune_i686__");
+ def_or_undef (parse_in, "__tune_pentiumpro__");
+ switch (last_tune_char)
+ {
+ case '3':
+ def_or_undef (parse_in, "__tune_pentium3__");
+ /* FALLTHRU */
+ case '2':
+ def_or_undef (parse_in, "__tune_pentium2__");
+ break;
+ }
+ break;
+ case PROCESSOR_GEODE:
+ def_or_undef (parse_in, "__tune_geode__");
+ break;
+ case PROCESSOR_K6:
+ def_or_undef (parse_in, "__tune_k6__");
+ if (last_tune_char == '2')
+ def_or_undef (parse_in, "__tune_k6_2__");
+ else if (last_tune_char == '3')
+ def_or_undef (parse_in, "__tune_k6_3__");
+ else if (isa_flag & OPTION_MASK_ISA_3DNOW)
+ def_or_undef (parse_in, "__tune_k6_3__");
+ break;
+ case PROCESSOR_ATHLON:
+ def_or_undef (parse_in, "__tune_athlon__");
+ if (isa_flag & OPTION_MASK_ISA_SSE)
+ def_or_undef (parse_in, "__tune_athlon_sse__");
+ break;
+ case PROCESSOR_K8:
+ def_or_undef (parse_in, "__tune_k8__");
+ break;
+ case PROCESSOR_AMDFAM10:
+ def_or_undef (parse_in, "__tune_amdfam10__");
+ break;
+ case PROCESSOR_PENTIUM4:
+ def_or_undef (parse_in, "__tune_pentium4__");
+ break;
+ case PROCESSOR_NOCONA:
+ def_or_undef (parse_in, "__tune_nocona__");
+ break;
+ case PROCESSOR_CORE2:
+ def_or_undef (parse_in, "__tune_core2__");
+ break;
+ case PROCESSOR_GENERIC32:
+ case PROCESSOR_GENERIC64:
+ break;
+ /* use PROCESSOR_max to not set/unset the tune macro. */
+ case PROCESSOR_max:
+ break;
+ }
+
+ if (isa_flag & OPTION_MASK_ISA_MMX)
+ def_or_undef (parse_in, "__MMX__");
+ if (isa_flag & OPTION_MASK_ISA_3DNOW)
+ def_or_undef (parse_in, "__3dNOW__");
+ if (isa_flag & OPTION_MASK_ISA_3DNOW_A)
+ def_or_undef (parse_in, "__3dNOW_A__");
+ if (isa_flag & OPTION_MASK_ISA_SSE)
+ def_or_undef (parse_in, "__SSE__");
+ if (isa_flag & OPTION_MASK_ISA_SSE2)
+ def_or_undef (parse_in, "__SSE2__");
+ if (isa_flag & OPTION_MASK_ISA_SSE3)
+ def_or_undef (parse_in, "__SSE3__");
+ if (isa_flag & OPTION_MASK_ISA_SSSE3)
+ def_or_undef (parse_in, "__SSSE3__");
+ if (isa_flag & OPTION_MASK_ISA_SSE4_1)
+ def_or_undef (parse_in, "__SSE4_1__");
+ if (isa_flag & OPTION_MASK_ISA_SSE4_2)
+ def_or_undef (parse_in, "__SSE4_2__");
+ if (isa_flag & OPTION_MASK_ISA_AES)
+ def_or_undef (parse_in, "__AES__");
+ if (isa_flag & OPTION_MASK_ISA_PCLMUL)
+ def_or_undef (parse_in, "__PCLMUL__");
+ if (isa_flag & OPTION_MASK_ISA_SSE4A)
+ def_or_undef (parse_in, "__SSE4A__");
+ if (isa_flag & OPTION_MASK_ISA_SSE5)
+ def_or_undef (parse_in, "__SSE5__");
+ if ((fpmath & FPMATH_SSE) && (isa_flag & OPTION_MASK_ISA_SSE))
+ def_or_undef (parse_in, "__SSE_MATH__");
+ if ((fpmath & FPMATH_SSE) && (isa_flag & OPTION_MASK_ISA_SSE2))
+ def_or_undef (parse_in, "__SSE2_MATH__");
+}
+
+
+/* Hook to validate the current #pragma option and set the state, and update
+ the macros based on what was changed. */
+
+static bool
+ix86_pragma_option_parse (tree args)
+{
+ tree prev_tree = build_target_option_node ();
+ tree cur_tree;
+ struct cl_target_option *prev_opt;
+ struct cl_target_option *cur_opt;
+ int prev_isa;
+ int cur_isa;
+ int diff_isa;
+ enum processor_type prev_arch;
+ enum processor_type prev_tune;
+ enum processor_type cur_arch;
+ enum processor_type cur_tune;
+
+ if (! args)
+ {
+ cur_tree = target_option_default_node;
+ cl_target_option_restore (TREE_TARGET_OPTION (cur_tree));
+ }
+ else
+ {
+ cur_tree = ix86_valid_option_attribute_tree (args);
+ if (!cur_tree)
+ return false;
+ }
+
+ target_option_current_node = cur_tree;
+
+ /* Figure out the previous/current isa, arch, tune and the differences. */
+ prev_opt = TREE_TARGET_OPTION (prev_tree);
+ cur_opt = TREE_TARGET_OPTION (cur_tree);
+ prev_isa = prev_opt->ix86_isa_flags;
+ cur_isa = cur_opt->ix86_isa_flags;
+ diff_isa = (prev_isa ^ cur_isa);
+ prev_arch = prev_opt->arch;
+ prev_tune = prev_opt->tune;
+ cur_arch = cur_opt->arch;
+ cur_tune = cur_opt->tune;
+
+ /* If the same processor is used for both previous and current options, don't
+ change the macros. */
+ if (cur_arch == prev_arch)
+ cur_arch = prev_arch = PROCESSOR_max;
+
+ if (cur_tune == prev_tune)
+ cur_tune = prev_tune = PROCESSOR_max;
+
+ /* Undef all of the macros for that are no longer current. */
+ ix86_target_macros_internal (prev_isa & diff_isa,
+ prev_arch,
+ prev_tune,
+ prev_opt->fpmath,
+ cpp_undef);
+
+ /* Define all of the macros for new options that were just turned on. */
+ ix86_target_macros_internal (cur_isa & diff_isa,
+ cur_arch,
+ cur_tune,
+ cur_opt->fpmath,
+ cpp_define);
+
+ return true;
+}
+
+/* Function to tell the preprocessor about the defines for the current target. */
+
+void
+ix86_target_macros (void)
+{
+ /* 32/64-bit won't change with target specific options, so do the assert and
+ builtin_define_std calls here. */
+ if (TARGET_64BIT)
+ {
+ cpp_assert (parse_in, "cpu=x86_64");
+ cpp_assert (parse_in, "machine=x86_64");
+ cpp_define (parse_in, "__amd64");
+ cpp_define (parse_in, "__amd64__");
+ cpp_define (parse_in, "__x86_64");
+ cpp_define (parse_in, "__x86_64__");
+ }
+ else
+ {
+ cpp_assert (parse_in, "cpu=i386");
+ cpp_assert (parse_in, "machine=i386");
+ builtin_define_std ("i386");
+ }
+
+ ix86_target_macros_internal (ix86_isa_flags,
+ ix86_arch,
+ ix86_tune,
+ ix86_fpmath,
+ cpp_define);
+}
+
+
+/* Register target pragmas. We need to add the hook for parsing #pragma GCC
+ option here rather than in i386.c since it will pull in various preprocessor
+ functions, and those are not present in languages like fortran without a
+ preprocessor. */
+
+void
+ix86_register_pragmas (void)
+{
+ /* Update pragma hook to allow parsing #pragma GCC option. */
+ targetm.target_option.pragma_parse = ix86_pragma_option_parse;
+
+#ifdef REGISTER_SUBTARGET_PRAGMAS
+ REGISTER_SUBTARGET_PRAGMAS ();
+#endif
+}
diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h
index 634a4254f06..3276bd8e202 100644
--- a/gcc/config/i386/i386-protos.h
+++ b/gcc/config/i386/i386-protos.h
@@ -20,7 +20,7 @@ along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
/* Functions in i386.c */
-extern void override_options (void);
+extern void override_options (bool);
extern void optimization_options (int, int);
extern int ix86_can_use_return_insn_p (void);
@@ -28,6 +28,7 @@ extern int ix86_frame_pointer_required (void);
extern void ix86_setup_frame_addresses (void);
extern void ix86_file_end (void);
+extern int ix86_can_eliminate (int, int);
extern HOST_WIDE_INT ix86_initial_elimination_offset (int, int);
extern void ix86_expand_prologue (void);
extern void ix86_expand_epilogue (int);
@@ -202,6 +203,7 @@ extern int ix86_constant_alignment (tree, int);
extern tree ix86_handle_shared_attribute (tree *, tree, tree, int, bool *);
extern tree ix86_handle_selectany_attribute (tree *, tree, tree, int, bool *);
extern int x86_field_alignment (tree, int);
+extern tree ix86_valid_option_attribute_tree (tree);
#endif
extern rtx ix86_tls_get_addr (void);
@@ -215,6 +217,10 @@ extern void ix86_expand_reduc_v4sf (rtx (*)(rtx, rtx, rtx), rtx, rtx);
extern bool ix86_sse5_valid_op_p (rtx [], rtx, int, bool, int, bool);
extern void ix86_expand_sse5_multiple_memory (rtx [], int, enum machine_mode);
+/* In i386-c.c */
+extern void ix86_target_macros (void);
+extern void ix86_register_pragmas (void);
+
/* In winnt.c */
extern void i386_pe_unique_section (tree, int);
extern void i386_pe_declare_function_type (FILE *, const char *, int);
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index b63deb834bf..8da85e16e5c 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -48,7 +48,7 @@ along with GCC; see the file COPYING3. If not see
#include "target-def.h"
#include "langhooks.h"
#include "cgraph.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "dwarf2.h"
#include "df.h"
#include "tm-constrs.h"
@@ -75,8 +75,8 @@ static rtx legitimize_dllimport_symbol (rtx, bool);
#define DUMMY_STRINGOP_ALGS {libcall, {{-1, libcall}}}
-static const
-struct processor_costs size_cost = { /* costs for tuning for size */
+const
+struct processor_costs ix86_size_cost = {/* costs for tuning for size */
COSTS_N_BYTES (2), /* cost of an add instruction */
COSTS_N_BYTES (3), /* cost of a lea instruction */
COSTS_N_BYTES (2), /* variable shift costs */
@@ -1210,7 +1210,11 @@ const struct processor_costs *ix86_cost = &pentium_cost;
#define m_GENERIC (m_GENERIC32 | m_GENERIC64)
/* Feature tests against the various tunings. */
-unsigned int ix86_tune_features[X86_TUNE_LAST] = {
+unsigned char ix86_tune_features[X86_TUNE_LAST];
+
+/* Feature tests against the various tunings used to create ix86_tune_features
+ based on the processor mask. */
+static unsigned int initial_ix86_tune_features[X86_TUNE_LAST] = {
/* X86_TUNE_USE_LEAVE: Leave does not affect Nocona SPEC2000 results
negatively, so enabling for Generic64 seems like good code size
tradeoff. We can't enable it for 32bit generic because it does not
@@ -1443,7 +1447,11 @@ unsigned int ix86_tune_features[X86_TUNE_LAST] = {
};
/* Feature tests against the various architecture variations. */
-unsigned int ix86_arch_features[X86_ARCH_LAST] = {
+unsigned char ix86_arch_features[X86_ARCH_LAST];
+
+/* Feature tests against the various architecture variations, used to create
+ ix86_arch_features based on the processor mask. */
+static unsigned int initial_ix86_arch_features[X86_ARCH_LAST] = {
/* X86_ARCH_CMOVE: Conditional move was added for pentiumpro. */
~(m_386 | m_486 | m_PENT | m_K6),
@@ -1700,7 +1708,8 @@ static int ix86_regparm;
/* -mstackrealign option */
extern int ix86_force_align_arg_pointer;
-static const char ix86_force_align_arg_pointer_string[] = "force_align_arg_pointer";
+static const char ix86_force_align_arg_pointer_string[]
+ = "force_align_arg_pointer";
static rtx (*ix86_gen_leave) (void);
static rtx (*ix86_gen_pop1) (rtx);
@@ -1709,10 +1718,21 @@ static rtx (*ix86_gen_sub3) (rtx, rtx, rtx);
static rtx (*ix86_gen_sub3_carry) (rtx, rtx, rtx, rtx);
static rtx (*ix86_gen_one_cmpl2) (rtx, rtx);
static rtx (*ix86_gen_monitor) (rtx, rtx, rtx);
+static rtx (*ix86_gen_andsp) (rtx, rtx, rtx);
/* Preferred alignment for stack boundary in bits. */
unsigned int ix86_preferred_stack_boundary;
+/* Alignment for incoming stack boundary in bits specified at
+ command line. */
+static unsigned int ix86_user_incoming_stack_boundary;
+
+/* Default alignment for incoming stack boundary in bits. */
+static unsigned int ix86_default_incoming_stack_boundary;
+
+/* Alignment for incoming stack boundary in bits. */
+unsigned int ix86_incoming_stack_boundary;
+
/* Values 1-5: see jump.c */
int ix86_branch_cost;
@@ -1773,6 +1793,26 @@ static void ix86_compute_frame_layout (struct ix86_frame *);
static bool ix86_expand_vector_init_one_nonzero (bool, enum machine_mode,
rtx, rtx, int);
+enum ix86_function_specific_strings
+{
+ IX86_FUNCTION_SPECIFIC_ARCH,
+ IX86_FUNCTION_SPECIFIC_TUNE,
+ IX86_FUNCTION_SPECIFIC_FPMATH,
+ IX86_FUNCTION_SPECIFIC_MAX
+};
+
+static char *ix86_target_string (int, int, const char *, const char *,
+ const char *, bool);
+static void ix86_debug_options (void) ATTRIBUTE_UNUSED;
+static void ix86_function_specific_save (struct cl_target_option *);
+static void ix86_function_specific_restore (struct cl_target_option *);
+static void ix86_function_specific_print (FILE *, int,
+ struct cl_target_option *);
+static bool ix86_valid_option_attribute_p (tree, tree, tree, int);
+static bool ix86_valid_option_attribute_inner_p (tree, char *[]);
+static bool ix86_can_inline_p (tree, tree);
+static void ix86_set_current_function (tree);
+
/* The svr4 ABI for the i386 says that records and unions are returned
in memory. */
@@ -1780,6 +1820,10 @@ static bool ix86_expand_vector_init_one_nonzero (bool, enum machine_mode,
#define DEFAULT_PCC_STRUCT_RETURN 1
#endif
+/* Whether -mtune= or -march= were specified */
+static int ix86_tune_defaulted;
+static int ix86_arch_specified;
+
/* Bit flags that specify the ISA we are compiling for. */
int ix86_isa_flags = TARGET_64BIT_DEFAULT | TARGET_SUBTARGET_ISA_DEFAULT;
@@ -1815,6 +1859,18 @@ static int ix86_isa_flags_explicit;
#define OPTION_MASK_ISA_SSE5_SET \
(OPTION_MASK_ISA_SSE5 | OPTION_MASK_ISA_SSE4A_SET)
+/* AES and PCLMUL need SSE2 because they use xmm registers */
+#define OPTION_MASK_ISA_AES_SET \
+ (OPTION_MASK_ISA_AES | OPTION_MASK_ISA_SSE2_SET)
+#define OPTION_MASK_ISA_PCLMUL_SET \
+ (OPTION_MASK_ISA_PCLMUL | OPTION_MASK_ISA_SSE2_SET)
+
+#define OPTION_MASK_ISA_ABM_SET \
+ (OPTION_MASK_ISA_ABM | OPTION_MASK_ISA_POPCNT)
+#define OPTION_MASK_ISA_POPCNT_SET OPTION_MASK_ISA_POPCNT
+#define OPTION_MASK_ISA_CX16_SET OPTION_MASK_ISA_CX16
+#define OPTION_MASK_ISA_SAHF_SET OPTION_MASK_ISA_SAHF
+
/* Define a set of ISAs which aren't available when a given ISA is
disabled. MMX and SSE ISAs are handled separately. */
@@ -1844,14 +1900,73 @@ static int ix86_isa_flags_explicit;
#define OPTION_MASK_ISA_SSE4A_UNSET \
(OPTION_MASK_ISA_SSE4A | OPTION_MASK_ISA_SSE5_UNSET)
-
#define OPTION_MASK_ISA_SSE5_UNSET OPTION_MASK_ISA_SSE5
+#define OPTION_MASK_ISA_AES_UNSET OPTION_MASK_ISA_AES
+#define OPTION_MASK_ISA_PCLMUL_UNSET OPTION_MASK_ISA_PCLMUL
+#define OPTION_MASK_ISA_ABM_UNSET OPTION_MASK_ISA_ABM
+#define OPTION_MASK_ISA_POPCNT_UNSET OPTION_MASK_ISA_POPCNT
+#define OPTION_MASK_ISA_CX16_UNSET OPTION_MASK_ISA_CX16
+#define OPTION_MASK_ISA_SAHF_UNSET OPTION_MASK_ISA_SAHF
/* Vectorization library interface and handlers. */
tree (*ix86_veclib_handler)(enum built_in_function, tree, tree) = NULL;
static tree ix86_veclibabi_svml (enum built_in_function, tree, tree);
static tree ix86_veclibabi_acml (enum built_in_function, tree, tree);
+/* Processor target table, indexed by processor number */
+struct ptt
+{
+ const struct processor_costs *cost; /* Processor costs */
+ const int align_loop; /* Default alignments. */
+ const int align_loop_max_skip;
+ const int align_jump;
+ const int align_jump_max_skip;
+ const int align_func;
+};
+
+static const struct ptt processor_target_table[PROCESSOR_max] =
+{
+ {&i386_cost, 4, 3, 4, 3, 4},
+ {&i486_cost, 16, 15, 16, 15, 16},
+ {&pentium_cost, 16, 7, 16, 7, 16},
+ {&pentiumpro_cost, 16, 15, 16, 10, 16},
+ {&geode_cost, 0, 0, 0, 0, 0},
+ {&k6_cost, 32, 7, 32, 7, 32},
+ {&athlon_cost, 16, 7, 16, 7, 16},
+ {&pentium4_cost, 0, 0, 0, 0, 0},
+ {&k8_cost, 16, 7, 16, 7, 16},
+ {&nocona_cost, 0, 0, 0, 0, 0},
+ {&core2_cost, 16, 10, 16, 10, 16},
+ {&generic32_cost, 16, 7, 16, 7, 16},
+ {&generic64_cost, 16, 10, 16, 10, 16},
+ {&amdfam10_cost, 32, 24, 32, 7, 32}
+};
+
+static const char *const cpu_names[TARGET_CPU_DEFAULT_max] =
+{
+ "generic",
+ "i386",
+ "i486",
+ "pentium",
+ "pentium-mmx",
+ "pentiumpro",
+ "pentium2",
+ "pentium3",
+ "pentium4",
+ "pentium-m",
+ "prescott",
+ "nocona",
+ "core2",
+ "geode",
+ "k6",
+ "k6-2",
+ "k6-3",
+ "athlon",
+ "athlon-4",
+ "k8",
+ "amdfam10"
+};
+
/* Implement TARGET_HANDLE_OPTION. */
static bool
@@ -2002,11 +2117,295 @@ ix86_handle_option (size_t code, const char *arg ATTRIBUTE_UNUSED, int value)
}
return true;
+ case OPT_mabm:
+ if (value)
+ {
+ ix86_isa_flags |= OPTION_MASK_ISA_ABM_SET;
+ ix86_isa_flags_explicit |= OPTION_MASK_ISA_ABM_SET;
+ }
+ else
+ {
+ ix86_isa_flags &= ~OPTION_MASK_ISA_ABM_UNSET;
+ ix86_isa_flags_explicit |= OPTION_MASK_ISA_ABM_UNSET;
+ }
+ return true;
+
+ case OPT_mpopcnt:
+ if (value)
+ {
+ ix86_isa_flags |= OPTION_MASK_ISA_POPCNT_SET;
+ ix86_isa_flags_explicit |= OPTION_MASK_ISA_POPCNT_SET;
+ }
+ else
+ {
+ ix86_isa_flags &= ~OPTION_MASK_ISA_POPCNT_UNSET;
+ ix86_isa_flags_explicit |= OPTION_MASK_ISA_POPCNT_UNSET;
+ }
+ return true;
+
+ case OPT_msahf:
+ if (value)
+ {
+ ix86_isa_flags |= OPTION_MASK_ISA_SAHF_SET;
+ ix86_isa_flags_explicit |= OPTION_MASK_ISA_SAHF_SET;
+ }
+ else
+ {
+ ix86_isa_flags &= ~OPTION_MASK_ISA_SAHF_UNSET;
+ ix86_isa_flags_explicit |= OPTION_MASK_ISA_SAHF_UNSET;
+ }
+ return true;
+
+ case OPT_mcx16:
+ if (value)
+ {
+ ix86_isa_flags |= OPTION_MASK_ISA_CX16_SET;
+ ix86_isa_flags_explicit |= OPTION_MASK_ISA_CX16_SET;
+ }
+ else
+ {
+ ix86_isa_flags &= ~OPTION_MASK_ISA_CX16_UNSET;
+ ix86_isa_flags_explicit |= OPTION_MASK_ISA_CX16_UNSET;
+ }
+ return true;
+
+ case OPT_maes:
+ if (value)
+ {
+ ix86_isa_flags |= OPTION_MASK_ISA_AES_SET;
+ ix86_isa_flags_explicit |= OPTION_MASK_ISA_AES_SET;
+ }
+ else
+ {
+ ix86_isa_flags &= ~OPTION_MASK_ISA_AES_UNSET;
+ ix86_isa_flags_explicit |= OPTION_MASK_ISA_AES_UNSET;
+ }
+ return true;
+
+ case OPT_mpclmul:
+ if (value)
+ {
+ ix86_isa_flags |= OPTION_MASK_ISA_PCLMUL_SET;
+ ix86_isa_flags_explicit |= OPTION_MASK_ISA_PCLMUL_SET;
+ }
+ else
+ {
+ ix86_isa_flags &= ~OPTION_MASK_ISA_PCLMUL_UNSET;
+ ix86_isa_flags_explicit |= OPTION_MASK_ISA_PCLMUL_UNSET;
+ }
+ return true;
+
default:
return true;
}
}
+
+/* Return a string the documents the current -m options. The caller is
+ responsible for freeing the string. */
+
+static char *
+ix86_target_string (int isa, int flags, const char *arch, const char *tune,
+ const char *fpmath, bool add_nl_p)
+{
+ struct ix86_target_opts
+ {
+ const char *option; /* option string */
+ int mask; /* isa mask options */
+ };
+
+ /* This table is ordered so that options like -msse5 or -msse4.2 that imply
+ preceding options while match those first. */
+ static struct ix86_target_opts isa_opts[] =
+ {
+ { "-m64", OPTION_MASK_ISA_64BIT },
+ { "-msse5", OPTION_MASK_ISA_SSE5 },
+ { "-msse4a", OPTION_MASK_ISA_SSE4A },
+ { "-msse4.2", OPTION_MASK_ISA_SSE4_2 },
+ { "-msse4.1", OPTION_MASK_ISA_SSE4_1 },
+ { "-mssse3", OPTION_MASK_ISA_SSSE3 },
+ { "-msse3", OPTION_MASK_ISA_SSE3 },
+ { "-msse2", OPTION_MASK_ISA_SSE2 },
+ { "-msse", OPTION_MASK_ISA_SSE },
+ { "-m3dnow", OPTION_MASK_ISA_3DNOW },
+ { "-m3dnowa", OPTION_MASK_ISA_3DNOW_A },
+ { "-mmmx", OPTION_MASK_ISA_MMX },
+ { "-mabm", OPTION_MASK_ISA_ABM },
+ { "-mpopcnt", OPTION_MASK_ISA_POPCNT },
+ { "-maes", OPTION_MASK_ISA_AES },
+ { "-mpclmul", OPTION_MASK_ISA_PCLMUL },
+ };
+
+ /* Flag options. */
+ static struct ix86_target_opts flag_opts[] =
+ {
+ { "-m128bit-long-double", MASK_128BIT_LONG_DOUBLE },
+ { "-m80387", MASK_80387 },
+ { "-maccumulate-outgoing-args", MASK_ACCUMULATE_OUTGOING_ARGS },
+ { "-malign-double", MASK_ALIGN_DOUBLE },
+ { "-mcld", MASK_CLD },
+ { "-mfp-ret-in-387", MASK_FLOAT_RETURNS },
+ { "-mieee-fp", MASK_IEEE_FP },
+ { "-minline-all-stringops", MASK_INLINE_ALL_STRINGOPS },
+ { "-minline-stringops-dynamically", MASK_INLINE_STRINGOPS_DYNAMICALLY },
+ { "-mms-bitfields", MASK_MS_BITFIELD_LAYOUT },
+ { "-mno-align-stringops", MASK_NO_ALIGN_STRINGOPS },
+ { "-mno-fancy-math-387", MASK_NO_FANCY_MATH_387 },
+ { "-mno-fused-madd", MASK_NO_FUSED_MADD },
+ { "-mno-push-args", MASK_NO_PUSH_ARGS },
+ { "-mno-red-zone", MASK_NO_RED_ZONE },
+ { "-momit-leaf-frame-pointer", MASK_OMIT_LEAF_FRAME_POINTER },
+ { "-mrecip", MASK_RECIP },
+ { "-mrtd", MASK_RTD },
+ { "-msseregparm", MASK_SSEREGPARM },
+ { "-mstack-arg-probe", MASK_STACK_PROBE },
+ { "-mtls-direct-seg-refs", MASK_TLS_DIRECT_SEG_REFS },
+ };
+
+ const char *opts[ (sizeof (isa_opts) / sizeof (isa_opts[0])
+ + sizeof (flag_opts) / sizeof (flag_opts[0])
+ + 6)][2];
+
+ char isa_other[40];
+ char target_other[40];
+ unsigned num = 0;
+ unsigned i, j;
+ char *ret;
+ char *ptr;
+ size_t len;
+ size_t line_len;
+ size_t sep_len;
+
+ memset (opts, '\0', sizeof (opts));
+
+ /* Add -march= option. */
+ if (arch)
+ {
+ opts[num][0] = "-march=";
+ opts[num++][1] = arch;
+ }
+
+ /* Add -mtune= option. */
+ if (tune)
+ {
+ opts[num][0] = "-mtune=";
+ opts[num++][1] = tune;
+ }
+
+ /* Pick out the options in isa options. */
+ for (i = 0; i < sizeof (isa_opts) / sizeof (isa_opts[0]); i++)
+ {
+ if ((isa & isa_opts[i].mask) != 0)
+ {
+ opts[num++][0] = isa_opts[i].option;
+ isa &= ~ isa_opts[i].mask;
+ }
+ }
+
+ if (isa && add_nl_p)
+ {
+ opts[num++][0] = isa_other;
+ sprintf (isa_other, "(other isa: 0x%x)", isa);
+ }
+
+ /* Add flag options. */
+ for (i = 0; i < sizeof (flag_opts) / sizeof (flag_opts[0]); i++)
+ {
+ if ((flags & flag_opts[i].mask) != 0)
+ {
+ opts[num++][0] = flag_opts[i].option;
+ flags &= ~ flag_opts[i].mask;
+ }
+ }
+
+ if (flags && add_nl_p)
+ {
+ opts[num++][0] = target_other;
+ sprintf (target_other, "(other flags: 0x%x)", isa);
+ }
+
+ /* Add -fpmath= option. */
+ if (fpmath)
+ {
+ opts[num][0] = "-mfpmath=";
+ opts[num++][1] = fpmath;
+ }
+
+ /* Any options? */
+ if (num == 0)
+ return NULL;
+
+ gcc_assert (num < sizeof (opts) / sizeof (opts[0]));
+
+ /* Size the string. */
+ len = 0;
+ sep_len = (add_nl_p) ? 3 : 1;
+ for (i = 0; i < num; i++)
+ {
+ len += sep_len;
+ for (j = 0; j < 2; j++)
+ if (opts[i][j])
+ len += strlen (opts[i][j]);
+ }
+
+ /* Build the string. */
+ ret = ptr = (char *) xmalloc (len);
+ line_len = 0;
+
+ for (i = 0; i < num; i++)
+ {
+ size_t len2[2];
+
+ for (j = 0; j < 2; j++)
+ len2[j] = (opts[i][j]) ? strlen (opts[i][j]) : 0;
+
+ if (i != 0)
+ {
+ *ptr++ = ' ';
+ line_len++;
+
+ if (add_nl_p && line_len + len2[0] + len2[1] > 70)
+ {
+ *ptr++ = '\\';
+ *ptr++ = '\n';
+ line_len = 0;
+ }
+ }
+
+ for (j = 0; j < 2; j++)
+ if (opts[i][j])
+ {
+ memcpy (ptr, opts[i][j], len2[j]);
+ ptr += len2[j];
+ line_len += len2[j];
+ }
+ }
+
+ *ptr = '\0';
+ gcc_assert (ret + len >= ptr);
+
+ return ret;
+}
+
+/* Function that is callable from the debugger to print the current
+ options. */
+void
+ix86_debug_options (void)
+{
+ char *opts = ix86_target_string (ix86_isa_flags, target_flags,
+ ix86_arch_string, ix86_tune_string,
+ ix86_fpmath_string, true);
+ if (opts)
+ {
+ fprintf (stderr, "%s\n\n", opts);
+ free (opts);
+ }
+ else
+ fprintf (stderr, "<no options>\n\n");
+
+ return;
+}
+
/* Sometimes certain combinations of command options do not make
sense on a particular target machine. You can define a macro
`OVERRIDE_OPTIONS' to take account of this. This macro, if
@@ -2017,68 +2416,17 @@ ix86_handle_option (size_t code, const char *arg ATTRIBUTE_UNUSED, int value)
`-O'. That is what `OPTIMIZATION_OPTIONS' is for. */
void
-override_options (void)
+override_options (bool main_args_p)
{
int i;
- int ix86_tune_defaulted = 0;
- int ix86_arch_specified = 0;
unsigned int ix86_arch_mask, ix86_tune_mask;
+ const char *prefix;
+ const char *suffix;
+ const char *sw;
/* Comes from final.c -- no real reason to change it. */
#define MAX_CODE_ALIGN 16
- static struct ptt
- {
- const struct processor_costs *cost; /* Processor costs */
- const int align_loop; /* Default alignments. */
- const int align_loop_max_skip;
- const int align_jump;
- const int align_jump_max_skip;
- const int align_func;
- }
- const processor_target_table[PROCESSOR_max] =
- {
- {&i386_cost, 4, 3, 4, 3, 4},
- {&i486_cost, 16, 15, 16, 15, 16},
- {&pentium_cost, 16, 7, 16, 7, 16},
- {&pentiumpro_cost, 16, 15, 16, 10, 16},
- {&geode_cost, 0, 0, 0, 0, 0},
- {&k6_cost, 32, 7, 32, 7, 32},
- {&athlon_cost, 16, 7, 16, 7, 16},
- {&pentium4_cost, 0, 0, 0, 0, 0},
- {&k8_cost, 16, 7, 16, 7, 16},
- {&nocona_cost, 0, 0, 0, 0, 0},
- {&core2_cost, 16, 10, 16, 10, 16},
- {&generic32_cost, 16, 7, 16, 7, 16},
- {&generic64_cost, 16, 10, 16, 10, 16},
- {&amdfam10_cost, 32, 24, 32, 7, 32}
- };
-
- static const char *const cpu_names[TARGET_CPU_DEFAULT_max] =
- {
- "generic",
- "i386",
- "i486",
- "pentium",
- "pentium-mmx",
- "pentiumpro",
- "pentium2",
- "pentium3",
- "pentium4",
- "pentium-m",
- "prescott",
- "nocona",
- "core2",
- "geode",
- "k6",
- "k6-2",
- "k6-3",
- "athlon",
- "athlon-4",
- "k8",
- "amdfam10"
- };
-
enum pta_flags
{
PTA_SSE = 1 << 0,
@@ -2197,6 +2545,21 @@ override_options (void)
int const pta_size = ARRAY_SIZE (processor_alias_table);
+ /* Set up prefix/suffix so the error messages refer to either the command
+ line argument, or the attribute(option). */
+ if (main_args_p)
+ {
+ prefix = "-m";
+ suffix = "";
+ sw = "switch";
+ }
+ else
+ {
+ prefix = "option(\"";
+ suffix = "\")";
+ sw = "attribute";
+ }
+
#ifdef SUBTARGET_OVERRIDE_OPTIONS
SUBTARGET_OVERRIDE_OPTIONS;
#endif
@@ -2246,8 +2609,15 @@ override_options (void)
else
ix86_tune_string = "generic32";
}
+ /* If this call is for setting the option attribute, allow the
+ generic32/generic64 that was previously set. */
+ else if (!main_args_p
+ && (!strcmp (ix86_tune_string, "generic32")
+ || !strcmp (ix86_tune_string, "generic64")))
+ ;
else if (!strncmp (ix86_tune_string, "generic", 7))
- error ("bad value (%s) for -mtune= switch", ix86_tune_string);
+ error ("bad value (%s) for %stune=%s %s",
+ ix86_tune_string, prefix, suffix, sw);
}
else
{
@@ -2288,11 +2658,13 @@ override_options (void)
else if (!strcmp (ix86_stringop_string, "unrolled_loop"))
stringop_alg = unrolled_loop;
else
- error ("bad value (%s) for -mstringop-strategy= switch", ix86_stringop_string);
+ error ("bad value (%s) for %sstringop-strategy=%s %s",
+ ix86_stringop_string, prefix, suffix, sw);
}
if (!strcmp (ix86_tune_string, "x86-64"))
- warning (OPT_Wdeprecated, "-mtune=x86-64 is deprecated. Use -mtune=k8 or "
- "-mtune=generic instead as appropriate.");
+ warning (OPT_Wdeprecated, "%stune=x86-64%s is deprecated. Use "
+ "%stune=k8%s or %stune=generic%s instead as appropriate.",
+ prefix, suffix, prefix, suffix, prefix, suffix);
if (!ix86_arch_string)
ix86_arch_string = TARGET_64BIT ? "x86-64" : "i386";
@@ -2300,9 +2672,11 @@ override_options (void)
ix86_arch_specified = 1;
if (!strcmp (ix86_arch_string, "generic"))
- error ("generic CPU can be used only for -mtune= switch");
+ error ("generic CPU can be used only for %stune=%s %s",
+ prefix, suffix, sw);
if (!strncmp (ix86_arch_string, "generic", 7))
- error ("bad value (%s) for -march= switch", ix86_arch_string);
+ error ("bad value (%s) for %sarch=%s %s",
+ ix86_arch_string, prefix, suffix, sw);
if (ix86_cmodel_string != 0)
{
@@ -2319,7 +2693,8 @@ override_options (void)
else if (!strcmp (ix86_cmodel_string, "kernel") && !flag_pic)
ix86_cmodel = CM_KERNEL;
else
- error ("bad value (%s) for -mcmodel= switch", ix86_cmodel_string);
+ error ("bad value (%s) for %scmodel=%s %s",
+ ix86_cmodel_string, prefix, suffix, sw);
}
else
{
@@ -2342,7 +2717,8 @@ override_options (void)
else if (!strcmp (ix86_asm_string, "att"))
ix86_asm_dialect = ASM_ATT;
else
- error ("bad value (%s) for -masm= switch", ix86_asm_string);
+ error ("bad value (%s) for %sasm=%s %s",
+ ix86_asm_string, prefix, suffix, sw);
}
if ((TARGET_64BIT == 0) != (ix86_cmodel == CM_32))
error ("code model %qs not supported in the %s bit mode",
@@ -2395,31 +2771,37 @@ override_options (void)
if (processor_alias_table[i].flags & PTA_SSE5
&& !(ix86_isa_flags_explicit & OPTION_MASK_ISA_SSE5))
ix86_isa_flags |= OPTION_MASK_ISA_SSE5;
-
- if (processor_alias_table[i].flags & PTA_ABM)
- x86_abm = true;
- if (processor_alias_table[i].flags & PTA_CX16)
- x86_cmpxchg16b = true;
- if (processor_alias_table[i].flags & (PTA_POPCNT | PTA_ABM))
- x86_popcnt = true;
+ if (processor_alias_table[i].flags & PTA_ABM
+ && !(ix86_isa_flags_explicit & OPTION_MASK_ISA_ABM))
+ ix86_isa_flags |= OPTION_MASK_ISA_ABM;
+ if (processor_alias_table[i].flags & PTA_CX16
+ && !(ix86_isa_flags_explicit & OPTION_MASK_ISA_CX16))
+ ix86_isa_flags |= OPTION_MASK_ISA_CX16;
+ if (processor_alias_table[i].flags & (PTA_POPCNT | PTA_ABM)
+ && !(ix86_isa_flags_explicit & OPTION_MASK_ISA_POPCNT))
+ ix86_isa_flags |= OPTION_MASK_ISA_POPCNT;
+ if (!(TARGET_64BIT && (processor_alias_table[i].flags & PTA_NO_SAHF))
+ && !(ix86_isa_flags_explicit & OPTION_MASK_ISA_SAHF))
+ ix86_isa_flags |= OPTION_MASK_ISA_SAHF;
+ if (processor_alias_table[i].flags & PTA_AES
+ && !(ix86_isa_flags_explicit & OPTION_MASK_ISA_AES))
+ ix86_isa_flags |= OPTION_MASK_ISA_AES;
+ if (processor_alias_table[i].flags & PTA_PCLMUL
+ && !(ix86_isa_flags_explicit & OPTION_MASK_ISA_PCLMUL))
+ ix86_isa_flags |= OPTION_MASK_ISA_PCLMUL;
if (processor_alias_table[i].flags & (PTA_PREFETCH_SSE | PTA_SSE))
x86_prefetch_sse = true;
- if (!(TARGET_64BIT && (processor_alias_table[i].flags & PTA_NO_SAHF)))
- x86_sahf = true;
- if (processor_alias_table[i].flags & PTA_AES)
- x86_aes = true;
- if (processor_alias_table[i].flags & PTA_PCLMUL)
- x86_pclmul = true;
break;
}
if (i == pta_size)
- error ("bad value (%s) for -march= switch", ix86_arch_string);
+ error ("bad value (%s) for %sarch=%s %s",
+ ix86_arch_string, prefix, suffix, sw);
ix86_arch_mask = 1u << ix86_arch;
for (i = 0; i < X86_ARCH_LAST; ++i)
- ix86_arch_features[i] &= ix86_arch_mask;
+ ix86_arch_features[i] = !!(initial_ix86_arch_features[i] & ix86_arch_mask);
for (i = 0; i < pta_size; i++)
if (! strcmp (ix86_tune_string, processor_alias_table[i].name))
@@ -2451,22 +2833,15 @@ override_options (void)
break;
}
if (i == pta_size)
- error ("bad value (%s) for -mtune= switch", ix86_tune_string);
-
- /* Enable SSE2 if AES or PCLMUL is enabled. */
- if ((x86_aes || x86_pclmul)
- && !(ix86_isa_flags_explicit & OPTION_MASK_ISA_SSE2))
- {
- ix86_isa_flags |= OPTION_MASK_ISA_SSE2_SET;
- ix86_isa_flags_explicit |= OPTION_MASK_ISA_SSE2_SET;
- }
+ error ("bad value (%s) for %stune=%s %s",
+ ix86_tune_string, prefix, suffix, sw);
ix86_tune_mask = 1u << ix86_tune;
for (i = 0; i < X86_TUNE_LAST; ++i)
- ix86_tune_features[i] &= ix86_tune_mask;
+ ix86_tune_features[i] = !!(initial_ix86_tune_features[i] & ix86_tune_mask);
if (optimize_size)
- ix86_cost = &size_cost;
+ ix86_cost = &ix86_size_cost;
else
ix86_cost = processor_target_table[ix86_tune].cost;
@@ -2477,10 +2852,11 @@ override_options (void)
if (ix86_regparm_string)
{
if (TARGET_64BIT)
- warning (0, "-mregparm is ignored in 64-bit mode");
+ warning (0, "%sregparm%s is ignored in 64-bit mode", prefix, suffix);
i = atoi (ix86_regparm_string);
if (i < 0 || i > REGPARM_MAX)
- error ("-mregparm=%d is not between 0 and %d", i, REGPARM_MAX);
+ error ("%sregparm=%d%s is not between 0 and %d",
+ prefix, i, suffix, REGPARM_MAX);
else
ix86_regparm = i;
}
@@ -2492,12 +2868,14 @@ override_options (void)
Remove this code in GCC 3.2 or later. */
if (ix86_align_loops_string)
{
- warning (0, "-malign-loops is obsolete, use -falign-loops");
+ warning (0, "%salign-loops%s is obsolete, use %salign-loops%s",
+ prefix, suffix, prefix, suffix);
if (align_loops == 0)
{
i = atoi (ix86_align_loops_string);
if (i < 0 || i > MAX_CODE_ALIGN)
- error ("-malign-loops=%d is not between 0 and %d", i, MAX_CODE_ALIGN);
+ error ("%salign-loops=%d%s is not between 0 and %d",
+ prefix, i, suffix, MAX_CODE_ALIGN);
else
align_loops = 1 << i;
}
@@ -2505,12 +2883,14 @@ override_options (void)
if (ix86_align_jumps_string)
{
- warning (0, "-malign-jumps is obsolete, use -falign-jumps");
+ warning (0, "%salign-jumps%s is obsolete, use %salign-jumps%s",
+ prefix, suffix, prefix, suffix);
if (align_jumps == 0)
{
i = atoi (ix86_align_jumps_string);
if (i < 0 || i > MAX_CODE_ALIGN)
- error ("-malign-loops=%d is not between 0 and %d", i, MAX_CODE_ALIGN);
+ error ("%salign-loops=%d%s is not between 0 and %d",
+ prefix, i, suffix, MAX_CODE_ALIGN);
else
align_jumps = 1 << i;
}
@@ -2518,12 +2898,14 @@ override_options (void)
if (ix86_align_funcs_string)
{
- warning (0, "-malign-functions is obsolete, use -falign-functions");
+ warning (0, "%salign-functions%s is obsolete, use %salign-functions%s",
+ prefix, suffix, prefix, suffix);
if (align_functions == 0)
{
i = atoi (ix86_align_funcs_string);
if (i < 0 || i > MAX_CODE_ALIGN)
- error ("-malign-loops=%d is not between 0 and %d", i, MAX_CODE_ALIGN);
+ error ("%salign-loops=%d%s is not between 0 and %d",
+ prefix, i, suffix, MAX_CODE_ALIGN);
else
align_functions = 1 << i;
}
@@ -2551,7 +2933,7 @@ override_options (void)
{
i = atoi (ix86_branch_cost_string);
if (i < 0 || i > 5)
- error ("-mbranch-cost=%d is not between 0 and 5", i);
+ error ("%sbranch-cost=%d%s is not between 0 and 5", prefix, i, suffix);
else
ix86_branch_cost = i;
}
@@ -2559,7 +2941,7 @@ override_options (void)
{
i = atoi (ix86_section_threshold_string);
if (i < 0)
- error ("-mlarge-data-threshold=%d is negative", i);
+ error ("%slarge-data-threshold=%d%s is negative", prefix, i, suffix);
else
ix86_section_threshold = i;
}
@@ -2573,8 +2955,8 @@ override_options (void)
else if (strcmp (ix86_tls_dialect_string, "sun") == 0)
ix86_tls_dialect = TLS_DIALECT_SUN;
else
- error ("bad value (%s) for -mtls-dialect= switch",
- ix86_tls_dialect_string);
+ error ("bad value (%s) for %stls-dialect=%s %s",
+ ix86_tls_dialect_string, prefix, suffix, sw);
}
if (ix87_precision_string)
@@ -2597,7 +2979,7 @@ override_options (void)
| TARGET_SUBTARGET64_ISA_DEFAULT) & ~ix86_isa_flags_explicit);
if (TARGET_RTD)
- warning (0, "-mrtd is ignored in 64bit mode");
+ warning (0, "%srtd%s is ignored in 64bit mode", prefix, suffix);
}
else
{
@@ -2643,27 +3025,50 @@ override_options (void)
/* Turn on popcnt instruction for -msse4.2 or -mabm. */
if (TARGET_SSE4_2 || TARGET_ABM)
- x86_popcnt = true;
+ ix86_isa_flags |= OPTION_MASK_ISA_POPCNT & ~ix86_isa_flags_explicit;
- /* Validate -mpreferred-stack-boundary= value, or provide default.
- The default of 128 bits is for Pentium III's SSE __m128. We can't
- change it because of optimize_size. Otherwise, we can't mix object
- files compiled with -Os and -On. */
- ix86_preferred_stack_boundary = 128;
+ /* Validate -mpreferred-stack-boundary= value or default it to
+ PREFERRED_STACK_BOUNDARY_DEFAULT. */
+ ix86_preferred_stack_boundary = PREFERRED_STACK_BOUNDARY_DEFAULT;
if (ix86_preferred_stack_boundary_string)
{
i = atoi (ix86_preferred_stack_boundary_string);
if (i < (TARGET_64BIT ? 4 : 2) || i > 12)
- error ("-mpreferred-stack-boundary=%d is not between %d and 12", i,
- TARGET_64BIT ? 4 : 2);
+ error ("%spreferred-stack-boundary=%d%s is not between %d and 12",
+ prefix, i, suffix, TARGET_64BIT ? 4 : 2);
else
ix86_preferred_stack_boundary = (1 << i) * BITS_PER_UNIT;
}
+ /* Set the default value for -mstackrealign. */
+ if (ix86_force_align_arg_pointer == -1)
+ ix86_force_align_arg_pointer = STACK_REALIGN_DEFAULT;
+
+ /* Validate -mincoming-stack-boundary= value or default it to
+ MIN_STACK_BOUNDARY/PREFERRED_STACK_BOUNDARY. */
+ if (ix86_force_align_arg_pointer)
+ ix86_default_incoming_stack_boundary = MIN_STACK_BOUNDARY;
+ else
+ ix86_default_incoming_stack_boundary = PREFERRED_STACK_BOUNDARY;
+ ix86_incoming_stack_boundary = ix86_default_incoming_stack_boundary;
+ if (ix86_incoming_stack_boundary_string)
+ {
+ i = atoi (ix86_incoming_stack_boundary_string);
+ if (i < (TARGET_64BIT ? 4 : 2) || i > 12)
+ error ("-mincoming-stack-boundary=%d is not between %d and 12",
+ i, TARGET_64BIT ? 4 : 2);
+ else
+ {
+ ix86_user_incoming_stack_boundary = (1 << i) * BITS_PER_UNIT;
+ ix86_incoming_stack_boundary
+ = ix86_user_incoming_stack_boundary;
+ }
+ }
+
/* Accept -msseregparm only if at least SSE support is enabled. */
if (TARGET_SSEREGPARM
&& ! TARGET_SSE)
- error ("-msseregparm used without SSE enabled");
+ error ("%ssseregparm%s used without SSE enabled", prefix, suffix);
ix86_fpmath = TARGET_FPMATH_DEFAULT;
if (ix86_fpmath_string != 0)
@@ -2681,7 +3086,10 @@ override_options (void)
ix86_fpmath = FPMATH_SSE;
}
else if (! strcmp (ix86_fpmath_string, "387,sse")
- || ! strcmp (ix86_fpmath_string, "sse,387"))
+ || ! strcmp (ix86_fpmath_string, "387+sse")
+ || ! strcmp (ix86_fpmath_string, "sse,387")
+ || ! strcmp (ix86_fpmath_string, "sse+387")
+ || ! strcmp (ix86_fpmath_string, "both"))
{
if (!TARGET_SSE)
{
@@ -2697,7 +3105,8 @@ override_options (void)
ix86_fpmath = (enum fpmath_unit) (FPMATH_SSE | FPMATH_387);
}
else
- error ("bad value (%s) for -mfpmath= switch", ix86_fpmath_string);
+ error ("bad value (%s) for %sfpmath=%s %s",
+ ix86_fpmath_string, prefix, suffix, sw);
}
/* If the i387 is disabled, then do not return values in it. */
@@ -2713,7 +3122,8 @@ override_options (void)
ix86_veclib_handler = ix86_veclibabi_acml;
else
error ("unknown vectorization library ABI type (%s) for "
- "-mveclibabi= switch", ix86_veclibabi_string);
+ "%sveclibabi=%s %s", ix86_veclibabi_string,
+ prefix, suffix, sw);
}
if ((x86_accumulate_outgoing_args & ix86_tune_mask)
@@ -2732,7 +3142,8 @@ override_options (void)
{
if (target_flags_explicit & MASK_ACCUMULATE_OUTGOING_ARGS)
warning (0, "unwind tables currently require either a frame pointer "
- "or -maccumulate-outgoing-args for correctness");
+ "or %saccumulate-outgoing-args%s for correctness",
+ prefix, suffix);
target_flags |= MASK_ACCUMULATE_OUTGOING_ARGS;
}
@@ -2743,8 +3154,8 @@ override_options (void)
&& !(target_flags & MASK_ACCUMULATE_OUTGOING_ARGS))
{
if (target_flags_explicit & MASK_ACCUMULATE_OUTGOING_ARGS)
- warning (0, "stack probing requires -maccumulate-outgoing-args "
- "for correctness");
+ warning (0, "stack probing requires %saccumulate-outgoing-args%s "
+ "for correctness", prefix, suffix);
target_flags |= MASK_ACCUMULATE_OUTGOING_ARGS;
}
@@ -2791,6 +3202,7 @@ override_options (void)
ix86_gen_sub3_carry = gen_subdi3_carry_rex64;
ix86_gen_one_cmpl2 = gen_one_cmpldi2;
ix86_gen_monitor = gen_sse3_monitor64;
+ ix86_gen_andsp = gen_anddi3;
}
else
{
@@ -2801,6 +3213,7 @@ override_options (void)
ix86_gen_sub3_carry = gen_subsi3_carry;
ix86_gen_one_cmpl2 = gen_one_cmplsi2;
ix86_gen_monitor = gen_sse3_monitor;
+ ix86_gen_andsp = gen_andsi3;
}
#ifdef USE_IX86_CLD
@@ -2808,7 +3221,499 @@ override_options (void)
if (!TARGET_64BIT)
target_flags |= MASK_CLD & ~target_flags_explicit;
#endif
+
+ /* Save the initial options in case the user does function specific options */
+ if (main_args_p)
+ target_option_default_node = target_option_current_node
+ = build_target_option_node ();
+}
+
+/* Save the current options */
+
+static void
+ix86_function_specific_save (struct cl_target_option *ptr)
+{
+ gcc_assert (IN_RANGE (ix86_arch, 0, 255));
+ gcc_assert (IN_RANGE (ix86_tune, 0, 255));
+ gcc_assert (IN_RANGE (ix86_fpmath, 0, 255));
+ gcc_assert (IN_RANGE (ix86_branch_cost, 0, 255));
+
+ ptr->arch = ix86_arch;
+ ptr->tune = ix86_tune;
+ ptr->fpmath = ix86_fpmath;
+ ptr->branch_cost = ix86_branch_cost;
+ ptr->tune_defaulted = ix86_tune_defaulted;
+ ptr->arch_specified = ix86_arch_specified;
+ ptr->ix86_isa_flags_explicit = ix86_isa_flags_explicit;
+ ptr->target_flags_explicit = target_flags_explicit;
+}
+
+/* Restore the current options */
+
+static void
+ix86_function_specific_restore (struct cl_target_option *ptr)
+{
+ enum processor_type old_tune = ix86_tune;
+ enum processor_type old_arch = ix86_arch;
+ unsigned int ix86_arch_mask, ix86_tune_mask;
+ int i;
+
+ ix86_arch = ptr->arch;
+ ix86_tune = ptr->tune;
+ ix86_fpmath = ptr->fpmath;
+ ix86_branch_cost = ptr->branch_cost;
+ ix86_tune_defaulted = ptr->tune_defaulted;
+ ix86_arch_specified = ptr->arch_specified;
+ ix86_isa_flags_explicit = ptr->ix86_isa_flags_explicit;
+ target_flags_explicit = ptr->target_flags_explicit;
+
+ /* Recreate the arch feature tests if the arch changed */
+ if (old_arch != ix86_arch)
+ {
+ ix86_arch_mask = 1u << ix86_arch;
+ for (i = 0; i < X86_ARCH_LAST; ++i)
+ ix86_arch_features[i]
+ = !!(initial_ix86_arch_features[i] & ix86_arch_mask);
+ }
+
+ /* Recreate the tune optimization tests */
+ if (old_tune != ix86_tune)
+ {
+ ix86_tune_mask = 1u << ix86_tune;
+ for (i = 0; i < X86_TUNE_LAST; ++i)
+ ix86_tune_features[i]
+ = !!(initial_ix86_tune_features[i] & ix86_tune_mask);
+ }
+}
+
+/* Print the current options */
+
+static void
+ix86_function_specific_print (FILE *file, int indent,
+ struct cl_target_option *ptr)
+{
+ char *target_string
+ = ix86_target_string (ptr->ix86_isa_flags, ptr->target_flags,
+ NULL, NULL, NULL, false);
+
+ fprintf (file, "%*sarch = %d (%s)\n",
+ indent, "",
+ ptr->arch,
+ ((ptr->arch < TARGET_CPU_DEFAULT_max)
+ ? cpu_names[ptr->arch]
+ : "<unknown>"));
+
+ fprintf (file, "%*stune = %d (%s)\n",
+ indent, "",
+ ptr->tune,
+ ((ptr->tune < TARGET_CPU_DEFAULT_max)
+ ? cpu_names[ptr->tune]
+ : "<unknown>"));
+
+ fprintf (file, "%*sfpmath = %d%s%s\n", indent, "", ptr->fpmath,
+ (ptr->fpmath & FPMATH_387) ? ", 387" : "",
+ (ptr->fpmath & FPMATH_SSE) ? ", sse" : "");
+ fprintf (file, "%*sbranch_cost = %d\n", indent, "", ptr->branch_cost);
+
+ if (target_string)
+ {
+ fprintf (file, "%*s%s\n", indent, "", target_string);
+ free (target_string);
+ }
+}
+
+
+/* Inner function to process the attribute((option(...))), take an argument and
+ set the current options from the argument. If we have a list, recursively go
+ over the list. */
+
+static bool
+ix86_valid_option_attribute_inner_p (tree args, char *p_strings[])
+{
+ char *next_optstr;
+ bool ret = true;
+
+#define IX86_ATTR_ISA(S,O) { S, sizeof (S)-1, ix86_opt_isa, O, 0 }
+#define IX86_ATTR_STR(S,O) { S, sizeof (S)-1, ix86_opt_str, O, 0 }
+#define IX86_ATTR_YES(S,O,M) { S, sizeof (S)-1, ix86_opt_yes, O, M }
+#define IX86_ATTR_NO(S,O,M) { S, sizeof (S)-1, ix86_opt_no, O, M }
+
+ enum ix86_opt_type
+ {
+ ix86_opt_unknown,
+ ix86_opt_yes,
+ ix86_opt_no,
+ ix86_opt_str,
+ ix86_opt_isa
+ };
+
+ static const struct
+ {
+ const char *string;
+ size_t len;
+ enum ix86_opt_type type;
+ int opt;
+ int mask;
+ } attrs[] = {
+ /* isa options */
+ IX86_ATTR_ISA ("3dnow", OPT_m3dnow),
+ IX86_ATTR_ISA ("abm", OPT_mabm),
+ IX86_ATTR_ISA ("aes", OPT_maes),
+ IX86_ATTR_ISA ("mmx", OPT_mmmx),
+ IX86_ATTR_ISA ("pclmul", OPT_mpclmul),
+ IX86_ATTR_ISA ("popcnt", OPT_mpopcnt),
+ IX86_ATTR_ISA ("sse", OPT_msse),
+ IX86_ATTR_ISA ("sse2", OPT_msse2),
+ IX86_ATTR_ISA ("sse3", OPT_msse3),
+ IX86_ATTR_ISA ("sse4", OPT_msse4),
+ IX86_ATTR_ISA ("sse4.1", OPT_msse4_1),
+ IX86_ATTR_ISA ("sse4.2", OPT_msse4_2),
+ IX86_ATTR_ISA ("sse4a", OPT_msse4a),
+ IX86_ATTR_ISA ("sse5", OPT_msse5),
+ IX86_ATTR_ISA ("ssse3", OPT_mssse3),
+
+ /* string options */
+ IX86_ATTR_STR ("arch=", IX86_FUNCTION_SPECIFIC_ARCH),
+ IX86_ATTR_STR ("fpmath=", IX86_FUNCTION_SPECIFIC_FPMATH),
+ IX86_ATTR_STR ("tune=", IX86_FUNCTION_SPECIFIC_TUNE),
+
+ /* flag options */
+ IX86_ATTR_YES ("cld",
+ OPT_mcld,
+ MASK_CLD),
+
+ IX86_ATTR_NO ("fancy-math-387",
+ OPT_mfancy_math_387,
+ MASK_NO_FANCY_MATH_387),
+
+ IX86_ATTR_NO ("fused-madd",
+ OPT_mfused_madd,
+ MASK_NO_FUSED_MADD),
+
+ IX86_ATTR_YES ("ieee-fp",
+ OPT_mieee_fp,
+ MASK_IEEE_FP),
+
+ IX86_ATTR_YES ("inline-all-stringops",
+ OPT_minline_all_stringops,
+ MASK_INLINE_ALL_STRINGOPS),
+
+ IX86_ATTR_YES ("inline-stringops-dynamically",
+ OPT_minline_stringops_dynamically,
+ MASK_INLINE_STRINGOPS_DYNAMICALLY),
+
+ IX86_ATTR_NO ("align-stringops",
+ OPT_mno_align_stringops,
+ MASK_NO_ALIGN_STRINGOPS),
+
+ IX86_ATTR_YES ("recip",
+ OPT_mrecip,
+ MASK_RECIP),
+
+ };
+
+ /* If this is a list, recurse to get the options. */
+ if (TREE_CODE (args) == TREE_LIST)
+ {
+ bool ret = true;
+
+ for (; args; args = TREE_CHAIN (args))
+ if (TREE_VALUE (args)
+ && !ix86_valid_option_attribute_inner_p (TREE_VALUE (args), p_strings))
+ ret = false;
+
+ return ret;
+ }
+
+ else if (TREE_CODE (args) != STRING_CST)
+ gcc_unreachable ();
+
+ /* Handle multiple arguments separated by commas. */
+ next_optstr = ASTRDUP (TREE_STRING_POINTER (args));
+
+ while (next_optstr && *next_optstr != '\0')
+ {
+ char *p = next_optstr;
+ char *orig_p = p;
+ char *comma = strchr (next_optstr, ',');
+ const char *opt_string;
+ size_t len, opt_len;
+ int opt;
+ bool opt_set_p;
+ char ch;
+ unsigned i;
+ enum ix86_opt_type type = ix86_opt_unknown;
+ int mask = 0;
+
+ if (comma)
+ {
+ *comma = '\0';
+ len = comma - next_optstr;
+ next_optstr = comma + 1;
+ }
+ else
+ {
+ len = strlen (p);
+ next_optstr = NULL;
+ }
+
+ /* Recognize no-xxx. */
+ if (len > 3 && p[0] == 'n' && p[1] == 'o' && p[2] == '-')
+ {
+ opt_set_p = false;
+ p += 3;
+ len -= 3;
+ }
+ else
+ opt_set_p = true;
+
+ /* Find the option. */
+ ch = *p;
+ opt = N_OPTS;
+ for (i = 0; i < sizeof (attrs) / sizeof (attrs[0]); i++)
+ {
+ type = attrs[i].type;
+ opt_len = attrs[i].len;
+ if (ch == attrs[i].string[0]
+ && ((type != ix86_opt_str) ? len == opt_len : len > opt_len)
+ && memcmp (p, attrs[i].string, opt_len) == 0)
+ {
+ opt = attrs[i].opt;
+ mask = attrs[i].mask;
+ opt_string = attrs[i].string;
+ break;
+ }
+ }
+
+ /* Process the option. */
+ if (opt == N_OPTS)
+ {
+ error ("attribute(option(\"%s\")) is unknown", orig_p);
+ ret = false;
+ }
+
+ else if (type == ix86_opt_isa)
+ ix86_handle_option (opt, p, opt_set_p);
+
+ else if (type == ix86_opt_yes || type == ix86_opt_no)
+ {
+ if (type == ix86_opt_no)
+ opt_set_p = !opt_set_p;
+
+ if (opt_set_p)
+ target_flags |= mask;
+ else
+ target_flags &= ~mask;
+ }
+
+ else if (type == ix86_opt_str)
+ {
+ if (p_strings[opt])
+ {
+ error ("option(\"%s\") was already specified", opt_string);
+ ret = false;
+ }
+ else
+ p_strings[opt] = xstrdup (p + opt_len);
+ }
+
+ else
+ gcc_unreachable ();
+ }
+
+ return ret;
+}
+
+/* Return a TARGET_OPTION_NODE tree of the target options listed or NULL. */
+
+tree
+ix86_valid_option_attribute_tree (tree args)
+{
+ const char *orig_arch_string = ix86_arch_string;
+ const char *orig_tune_string = ix86_tune_string;
+ const char *orig_fpmath_string = ix86_fpmath_string;
+ int orig_tune_defaulted = ix86_tune_defaulted;
+ int orig_arch_specified = ix86_arch_specified;
+ char *option_strings[IX86_FUNCTION_SPECIFIC_MAX] = { NULL, NULL, NULL };
+ tree t = NULL_TREE;
+ int i;
+ struct cl_target_option *def
+ = TREE_TARGET_OPTION (target_option_default_node);
+
+ /* Process each of the options on the chain. */
+ if (! ix86_valid_option_attribute_inner_p (args, option_strings))
+ return NULL_TREE;
+
+ /* If the changed options are different from the default, rerun override_options,
+ and then save the options away. The string options are are attribute options,
+ and will be undone when we copy the save structure. */
+ if (ix86_isa_flags != def->ix86_isa_flags
+ || target_flags != def->target_flags
+ || option_strings[IX86_FUNCTION_SPECIFIC_ARCH]
+ || option_strings[IX86_FUNCTION_SPECIFIC_TUNE]
+ || option_strings[IX86_FUNCTION_SPECIFIC_FPMATH])
+ {
+ /* If we are using the default tune= or arch=, undo the string assigned,
+ and use the default. */
+ if (option_strings[IX86_FUNCTION_SPECIFIC_ARCH])
+ ix86_arch_string = option_strings[IX86_FUNCTION_SPECIFIC_ARCH];
+ else if (!orig_arch_specified)
+ ix86_arch_string = NULL;
+
+ if (option_strings[IX86_FUNCTION_SPECIFIC_TUNE])
+ ix86_tune_string = option_strings[IX86_FUNCTION_SPECIFIC_TUNE];
+ else if (orig_tune_defaulted)
+ ix86_tune_string = NULL;
+
+ /* If fpmath= is not set, and we now have sse2 on 32-bit, use it. */
+ if (option_strings[IX86_FUNCTION_SPECIFIC_FPMATH])
+ ix86_fpmath_string = option_strings[IX86_FUNCTION_SPECIFIC_FPMATH];
+ else if (!TARGET_64BIT && TARGET_SSE)
+ ix86_fpmath_string = "sse,387";
+
+ /* Do any overrides, such as arch=xxx, or tune=xxx support. */
+ override_options (false);
+
+ /* Save the current options unless we are validating options for
+ #pragma. */
+ t = build_target_option_node ();
+
+ ix86_arch_string = orig_arch_string;
+ ix86_tune_string = orig_tune_string;
+ ix86_fpmath_string = orig_fpmath_string;
+
+ /* Free up memory allocated to hold the strings */
+ for (i = 0; i < IX86_FUNCTION_SPECIFIC_MAX; i++)
+ if (option_strings[i])
+ free (option_strings[i]);
+ }
+
+ return t;
+}
+
+/* Hook to validate attribute((option("string"))). */
+
+static bool
+ix86_valid_option_attribute_p (tree fndecl,
+ tree ARG_UNUSED (name),
+ tree args,
+ int ARG_UNUSED (flags))
+{
+ struct cl_target_option cur_opts;
+ bool ret = true;
+ tree new_opts;
+
+ cl_target_option_save (&cur_opts);
+ new_opts = ix86_valid_option_attribute_tree (args);
+ if (!new_opts)
+ ret = false;
+
+ else if (fndecl)
+ DECL_FUNCTION_SPECIFIC_TARGET (fndecl) = new_opts;
+
+ cl_target_option_restore (&cur_opts);
+ return ret;
+}
+
+
+/* Hook to determine if one function can safely inline another. */
+
+static bool
+ix86_can_inline_p (tree caller, tree callee)
+{
+ bool ret = false;
+ tree caller_tree = DECL_FUNCTION_SPECIFIC_TARGET (caller);
+ tree callee_tree = DECL_FUNCTION_SPECIFIC_TARGET (callee);
+
+ /* If callee has no option attributes, then it is ok to inline. */
+ if (!callee_tree)
+ ret = true;
+
+ /* If caller has no option attributes, but callee does then it is not ok to
+ inline. */
+ else if (!caller_tree)
+ ret = false;
+
+ else
+ {
+ struct cl_target_option *caller_opts = TREE_TARGET_OPTION (caller_tree);
+ struct cl_target_option *callee_opts = TREE_TARGET_OPTION (callee_tree);
+
+ /* Callee's isa options should a subset of the caller's, i.e. a SSE5 function
+ can inline a SSE2 function but a SSE2 function can't inline a SSE5
+ function. */
+ if ((caller_opts->ix86_isa_flags & callee_opts->ix86_isa_flags)
+ != callee_opts->ix86_isa_flags)
+ ret = false;
+
+ /* See if we have the same non-isa options. */
+ else if (caller_opts->target_flags != callee_opts->target_flags)
+ ret = false;
+
+ /* See if arch, tune, etc. are the same. */
+ else if (caller_opts->arch != callee_opts->arch)
+ ret = false;
+
+ else if (caller_opts->tune != callee_opts->tune)
+ ret = false;
+
+ else if (caller_opts->fpmath != callee_opts->fpmath)
+ ret = false;
+
+ else if (caller_opts->branch_cost != callee_opts->branch_cost)
+ ret = false;
+
+ else
+ ret = true;
+ }
+
+ return ret;
}
+
+
+/* Remember the last target of ix86_set_current_function. */
+static GTY(()) tree ix86_previous_fndecl;
+
+/* Establish appropriate back-end context for processing the function
+ FNDECL. The argument might be NULL to indicate processing at top
+ level, outside of any function scope. */
+static void
+ix86_set_current_function (tree fndecl)
+{
+ /* Only change the context if the function changes. This hook is called
+ several times in the course of compiling a function, and we don't want to
+ slow things down too much or call target_reinit when it isn't safe. */
+ if (fndecl && fndecl != ix86_previous_fndecl)
+ {
+ tree old_tree = (ix86_previous_fndecl
+ ? DECL_FUNCTION_SPECIFIC_TARGET (ix86_previous_fndecl)
+ : NULL_TREE);
+
+ tree new_tree = (fndecl
+ ? DECL_FUNCTION_SPECIFIC_TARGET (fndecl)
+ : NULL_TREE);
+
+ ix86_previous_fndecl = fndecl;
+ if (old_tree == new_tree)
+ ;
+
+ else if (new_tree)
+ {
+ cl_target_option_restore (TREE_TARGET_OPTION (new_tree));
+ target_reinit ();
+ }
+
+ else if (old_tree)
+ {
+ struct cl_target_option *def
+ = TREE_TARGET_OPTION (target_option_current_node);
+
+ cl_target_option_restore (def);
+ target_reinit ();
+ }
+ }
+}
+
/* Return true if this goes in large data/bss. */
@@ -3134,11 +4039,6 @@ ix86_function_ok_for_sibcall (tree decl, tree exp)
&& ix86_function_regparm (TREE_TYPE (decl), NULL) >= 3)
return false;
- /* If we forced aligned the stack, then sibcalling would unalign the
- stack, which may break the called function. */
- if (cfun->machine->force_align_arg_pointer)
- return false;
-
/* Otherwise okay. That also includes certain types of indirect calls. */
return true;
}
@@ -3189,15 +4089,6 @@ ix86_handle_cconv_attribute (tree *node, tree name,
*no_add_attrs = true;
}
- if (!TARGET_64BIT
- && lookup_attribute (ix86_force_align_arg_pointer_string,
- TYPE_ATTRIBUTES (*node))
- && compare_tree_int (cst, REGPARM_MAX-1))
- {
- error ("%s functions limited to %d register parameters",
- ix86_force_align_arg_pointer_string, REGPARM_MAX-1);
- }
-
return NULL_TREE;
}
@@ -3341,7 +4232,7 @@ ix86_function_regparm (const_tree type, const_tree decl)
/* Use register calling convention for local functions when possible. */
if (decl && TREE_CODE (decl) == FUNCTION_DECL
- && flag_unit_at_a_time && !profile_flag)
+ && !profile_flag)
{
/* FIXME: remove this CONST_CAST when cgraph.[ch] is constified. */
struct cgraph_local_info *i = cgraph_local_info (CONST_CAST_TREE(decl));
@@ -3359,8 +4250,7 @@ ix86_function_regparm (const_tree type, const_tree decl)
/* We can't use regparm(3) for nested functions as these use
static chain pointer in third argument. */
if (local_regparm == 3
- && (decl_function_context (decl)
- || ix86_force_align_arg_pointer)
+ && decl_function_context (decl)
&& !DECL_NO_STATIC_CHAIN (decl))
local_regparm = 2;
@@ -3369,13 +4259,11 @@ ix86_function_regparm (const_tree type, const_tree decl)
the callee DECL_STRUCT_FUNCTION is gone, so we fall back to
scanning the attributes for the self-realigning property. */
f = DECL_STRUCT_FUNCTION (decl);
- if (local_regparm == 3
- && (f ? !!f->machine->force_align_arg_pointer
- : !!lookup_attribute (ix86_force_align_arg_pointer_string,
- TYPE_ATTRIBUTES (TREE_TYPE (decl)))))
- local_regparm = 2;
+ /* Since current internal arg pointer won't conflict with
+ parameter passing regs, so no need to change stack
+ realignment and adjust regparm number.
- /* Each fixed register usage increases register pressure,
+ Each fixed register usage increases register pressure,
so less registers should be used for argument passing.
This functionality can be overriden by an explicit
regparm value. */
@@ -3428,7 +4316,7 @@ ix86_function_sseregparm (const_tree type, const_tree decl, bool warn)
/* For local functions, pass up to SSE_REGPARM_MAX SFmode
(and DFmode for SSE2) arguments in SSE registers. */
- if (decl && TARGET_SSE_MATH && flag_unit_at_a_time && !profile_flag)
+ if (decl && TARGET_SSE_MATH && !profile_flag)
{
/* FIXME: remove this CONST_CAST when cgraph.[ch] is constified. */
struct cgraph_local_info *i = cgraph_local_info (CONST_CAST_TREE(decl));
@@ -5286,14 +6174,6 @@ setup_incoming_varargs_64 (CUMULATIVE_ARGS *cum)
/* Indicate to allocate space on the stack for varargs save area. */
ix86_save_varrargs_registers = 1;
- /* We need 16-byte stack alignment to save SSE registers. If user
- asked for lower preferred_stack_boundary, lets just hope that he knows
- what he is doing and won't varargs SSE values.
-
- We also may end up assuming that only 64bit values are stored in SSE
- register let some floating point program work. */
- if (ix86_preferred_stack_boundary >= BIGGEST_ALIGNMENT)
- crtl->stack_alignment_needed = BIGGEST_ALIGNMENT;
save_area = frame_pointer_rtx;
set = get_varargs_alias_set ();
@@ -5459,8 +6339,8 @@ ix86_va_start (tree valist, rtx nextarg)
if (cfun->va_list_gpr_size)
{
type = TREE_TYPE (gpr);
- t = build2 (GIMPLE_MODIFY_STMT, type, gpr,
- build_int_cst (type, n_gpr * 8));
+ t = build2 (MODIFY_EXPR, type,
+ gpr, build_int_cst (type, n_gpr * 8));
TREE_SIDE_EFFECTS (t) = 1;
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
}
@@ -5468,7 +6348,7 @@ ix86_va_start (tree valist, rtx nextarg)
if (cfun->va_list_fpr_size)
{
type = TREE_TYPE (fpr);
- t = build2 (GIMPLE_MODIFY_STMT, type, fpr,
+ t = build2 (MODIFY_EXPR, type, fpr,
build_int_cst (type, n_fpr * 16 + 8*X86_64_REGPARM_MAX));
TREE_SIDE_EFFECTS (t) = 1;
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
@@ -5476,11 +6356,11 @@ ix86_va_start (tree valist, rtx nextarg)
/* Find the overflow area. */
type = TREE_TYPE (ovf);
- t = make_tree (type, virtual_incoming_args_rtx);
+ t = make_tree (type, crtl->args.internal_arg_pointer);
if (words != 0)
t = build2 (POINTER_PLUS_EXPR, type, t,
size_int (words * UNITS_PER_WORD));
- t = build2 (GIMPLE_MODIFY_STMT, type, ovf, t);
+ t = build2 (MODIFY_EXPR, type, ovf, t);
TREE_SIDE_EFFECTS (t) = 1;
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
@@ -5490,7 +6370,7 @@ ix86_va_start (tree valist, rtx nextarg)
Prologue of the function save it right above stack frame. */
type = TREE_TYPE (sav);
t = make_tree (type, frame_pointer_rtx);
- t = build2 (GIMPLE_MODIFY_STMT, type, sav, t);
+ t = build2 (MODIFY_EXPR, type, sav, t);
TREE_SIDE_EFFECTS (t) = 1;
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
}
@@ -5499,7 +6379,8 @@ ix86_va_start (tree valist, rtx nextarg)
/* Implement va_arg. */
static tree
-ix86_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p)
+ix86_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p,
+ gimple_seq *post_p)
{
static const int intreg[6] = { 0, 1, 2, 3, 4, 5 };
tree f_gpr, f_fpr, f_ovf, f_sav;
@@ -5511,6 +6392,7 @@ ix86_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p)
int indirect_p = 0;
tree ptrtype;
enum machine_mode nat_mode;
+ int arg_boundary;
/* Only 64bit target needs something special. */
if (!TARGET_64BIT || is_va_list_char_pointer (TREE_TYPE (valist)))
@@ -5628,16 +6510,14 @@ ix86_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p)
/* int_addr = gpr + sav; */
t = fold_convert (sizetype, gpr);
t = build2 (POINTER_PLUS_EXPR, ptr_type_node, sav, t);
- t = build2 (GIMPLE_MODIFY_STMT, void_type_node, int_addr, t);
- gimplify_and_add (t, pre_p);
+ gimplify_assign (int_addr, t, pre_p);
}
if (needed_sseregs)
{
/* sse_addr = fpr + sav; */
t = fold_convert (sizetype, fpr);
t = build2 (POINTER_PLUS_EXPR, ptr_type_node, sav, t);
- t = build2 (GIMPLE_MODIFY_STMT, void_type_node, sse_addr, t);
- gimplify_and_add (t, pre_p);
+ gimplify_assign (sse_addr, t, pre_p);
}
if (need_temp)
{
@@ -5646,8 +6526,7 @@ ix86_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p)
/* addr = &temp; */
t = build1 (ADDR_EXPR, build_pointer_type (type), temp);
- t = build2 (GIMPLE_MODIFY_STMT, void_type_node, addr, t);
- gimplify_and_add (t, pre_p);
+ gimplify_assign (addr, t, pre_p);
for (i = 0; i < XVECLEN (container, 0); i++)
{
@@ -5680,8 +6559,7 @@ ix86_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p)
size_int (INTVAL (XEXP (slot, 1))));
dest = build_va_arg_indirect_ref (dest_addr);
- t = build2 (GIMPLE_MODIFY_STMT, void_type_node, dest, src);
- gimplify_and_add (t, pre_p);
+ gimplify_assign (dest, src, pre_p);
}
}
@@ -5689,33 +6567,38 @@ ix86_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p)
{
t = build2 (PLUS_EXPR, TREE_TYPE (gpr), gpr,
build_int_cst (TREE_TYPE (gpr), needed_intregs * 8));
- t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (gpr), gpr, t);
- gimplify_and_add (t, pre_p);
+ gimplify_assign (gpr, t, pre_p);
}
+
if (needed_sseregs)
{
t = build2 (PLUS_EXPR, TREE_TYPE (fpr), fpr,
build_int_cst (TREE_TYPE (fpr), needed_sseregs * 16));
- t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (fpr), fpr, t);
- gimplify_and_add (t, pre_p);
+ gimplify_assign (fpr, t, pre_p);
}
- t = build1 (GOTO_EXPR, void_type_node, lab_over);
- gimplify_and_add (t, pre_p);
+ gimple_seq_add_stmt (pre_p, gimple_build_goto (lab_over));
- t = build1 (LABEL_EXPR, void_type_node, lab_false);
- append_to_statement_list (t, pre_p);
+ gimple_seq_add_stmt (pre_p, gimple_build_label (lab_false));
}
/* ... otherwise out of the overflow area. */
+ /* When we align parameter on stack for caller, if the parameter
+ alignment is beyond MAX_SUPPORTED_STACK_ALIGNMENT, it will be
+ aligned at MAX_SUPPORTED_STACK_ALIGNMENT. We will match callee
+ here with caller. */
+ arg_boundary = FUNCTION_ARG_BOUNDARY (VOIDmode, type);
+ if ((unsigned int) arg_boundary > MAX_SUPPORTED_STACK_ALIGNMENT)
+ arg_boundary = MAX_SUPPORTED_STACK_ALIGNMENT;
+
/* Care for on-stack alignment if needed. */
- if (FUNCTION_ARG_BOUNDARY (VOIDmode, type) <= 64
+ if (arg_boundary <= 64
|| integer_zerop (TYPE_SIZE (type)))
t = ovf;
else
{
- HOST_WIDE_INT align = FUNCTION_ARG_BOUNDARY (VOIDmode, type) / 8;
+ HOST_WIDE_INT align = arg_boundary / 8;
t = build2 (POINTER_PLUS_EXPR, TREE_TYPE (ovf), ovf,
size_int (align - 1));
t = fold_convert (sizetype, t);
@@ -5724,20 +6607,14 @@ ix86_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p)
t = fold_convert (TREE_TYPE (ovf), t);
}
gimplify_expr (&t, pre_p, NULL, is_gimple_val, fb_rvalue);
-
- t2 = build2 (GIMPLE_MODIFY_STMT, void_type_node, addr, t);
- gimplify_and_add (t2, pre_p);
+ gimplify_assign (addr, t, pre_p);
t = build2 (POINTER_PLUS_EXPR, TREE_TYPE (t), t,
size_int (rsize * UNITS_PER_WORD));
- t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (ovf), ovf, t);
- gimplify_and_add (t, pre_p);
+ gimplify_assign (unshare_expr (ovf), t, pre_p);
if (container)
- {
- t = build1 (LABEL_EXPR, void_type_node, lab_over);
- append_to_statement_list (t, pre_p);
- }
+ gimple_seq_add_stmt (pre_p, gimple_build_label (lab_over));
ptrtype = build_pointer_type (type);
addr = fold_convert (ptrtype, addr);
@@ -5815,7 +6692,7 @@ standard_80387_constant_p (rtx x)
/* For XFmode constants, try to find a special 80387 instruction when
optimizing for size or on those CPUs that benefit from them. */
if (mode == XFmode
- && (optimize_size || TARGET_EXT_80387_CONSTANTS))
+ && (optimize_insn_for_size_p () || TARGET_EXT_80387_CONSTANTS))
{
int i;
@@ -6236,9 +7113,14 @@ ix86_select_alt_pic_regnum (void)
if (current_function_is_leaf && !crtl->profile
&& !ix86_current_function_calls_tls_descriptor)
{
- int i;
+ int i, drap;
+ /* Can't use the same register for both PIC and DRAP. */
+ if (crtl->drap_reg)
+ drap = REGNO (crtl->drap_reg);
+ else
+ drap = -1;
for (i = 2; i >= 0; --i)
- if (!df_regs_ever_live_p (i))
+ if (i != drap && !df_regs_ever_live_p (i))
return i;
}
@@ -6274,8 +7156,8 @@ ix86_save_reg (unsigned int regno, int maybe_eh_return)
}
}
- if (cfun->machine->force_align_arg_pointer
- && regno == REGNO (cfun->machine->force_align_arg_pointer))
+ if (crtl->drap_reg
+ && regno == REGNO (crtl->drap_reg))
return 1;
return (df_regs_ever_live_p (regno)
@@ -6298,6 +7180,24 @@ ix86_nsaved_regs (void)
return nregs;
}
+/* Given FROM and TO register numbers, say whether this elimination is
+ allowed. If stack alignment is needed, we can only replace argument
+ pointer with hard frame pointer, or replace frame pointer with stack
+ pointer. Otherwise, frame pointer elimination is automatically
+ handled and all other eliminations are valid. */
+
+int
+ix86_can_eliminate (int from, int to)
+{
+ if (stack_realign_fp)
+ return ((from == ARG_POINTER_REGNUM
+ && to == HARD_FRAME_POINTER_REGNUM)
+ || (from == FRAME_POINTER_REGNUM
+ && to == STACK_POINTER_REGNUM));
+ else
+ return to == STACK_POINTER_REGNUM ? !frame_pointer_needed : 1;
+}
+
/* Return the offset between two registers, one to be eliminated, and the other
its replacement, at the start of a routine. */
@@ -6341,6 +7241,10 @@ ix86_compute_frame_layout (struct ix86_frame *frame)
stack_alignment_needed = crtl->stack_alignment_needed / BITS_PER_UNIT;
preferred_alignment = crtl->preferred_stack_boundary / BITS_PER_UNIT;
+ gcc_assert (!size || stack_alignment_needed);
+ gcc_assert (preferred_alignment >= STACK_BOUNDARY / BITS_PER_UNIT);
+ gcc_assert (preferred_alignment <= stack_alignment_needed);
+
/* During reload iteration the amount of registers saved can change.
Recompute the value as needed. Do not recompute when amount of registers
didn't change as reload does multiple calls to the function and does not
@@ -6383,18 +7287,10 @@ ix86_compute_frame_layout (struct ix86_frame *frame)
frame->hard_frame_pointer_offset = offset;
- /* Do some sanity checking of stack_alignment_needed and
- preferred_alignment, since i386 port is the only using those features
- that may break easily. */
-
- gcc_assert (!size || stack_alignment_needed);
- gcc_assert (preferred_alignment >= STACK_BOUNDARY / BITS_PER_UNIT);
- gcc_assert (preferred_alignment <= PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT);
- gcc_assert (stack_alignment_needed
- <= PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT);
-
- if (stack_alignment_needed < STACK_BOUNDARY / BITS_PER_UNIT)
- stack_alignment_needed = STACK_BOUNDARY / BITS_PER_UNIT;
+ /* Set offset to aligned because the realigned frame starts from
+ here. */
+ if (stack_realign_fp)
+ offset = (offset + stack_alignment_needed -1) & -stack_alignment_needed;
/* Register save area */
offset += frame->nregs * UNITS_PER_WORD;
@@ -6560,38 +7456,131 @@ pro_epilogue_adjust_stack (rtx dest, rtx src, rtx offset, int style)
RTX_FRAME_RELATED_P (insn) = 1;
}
-/* Handle the TARGET_INTERNAL_ARG_POINTER hook. */
+/* Find an available register to be used as dynamic realign argument
+ pointer regsiter. Such a register will be written in prologue and
+ used in begin of body, so it must not be
+ 1. parameter passing register.
+ 2. GOT pointer.
+ We reuse static-chain register if it is available. Otherwise, we
+ use DI for i386 and R13 for x86-64. We chose R13 since it has
+ shorter encoding.
+
+ Return: the regno of chosen register. */
+
+static unsigned int
+find_drap_reg (void)
+{
+ tree decl = cfun->decl;
+
+ if (TARGET_64BIT)
+ {
+ /* Use R13 for nested function or function need static chain.
+ Since function with tail call may use any caller-saved
+ registers in epilogue, DRAP must not use caller-saved
+ register in such case. */
+ if ((decl_function_context (decl)
+ && !DECL_NO_STATIC_CHAIN (decl))
+ || crtl->tail_call_emit)
+ return R13_REG;
+
+ return R10_REG;
+ }
+ else
+ {
+ /* Use DI for nested function or function need static chain.
+ Since function with tail call may use any caller-saved
+ registers in epilogue, DRAP must not use caller-saved
+ register in such case. */
+ if ((decl_function_context (decl)
+ && !DECL_NO_STATIC_CHAIN (decl))
+ || crtl->tail_call_emit)
+ return DI_REG;
+
+ /* Reuse static chain register if it isn't used for parameter
+ passing. */
+ if (ix86_function_regparm (TREE_TYPE (decl), decl) <= 2
+ && !lookup_attribute ("fastcall",
+ TYPE_ATTRIBUTES (TREE_TYPE (decl))))
+ return CX_REG;
+ else
+ return DI_REG;
+ }
+}
+
+/* Update incoming stack boundary and estimated stack alignment. */
+
+static void
+ix86_update_stack_boundary (void)
+{
+ /* Prefer the one specified at command line. */
+ ix86_incoming_stack_boundary
+ = (ix86_user_incoming_stack_boundary
+ ? ix86_user_incoming_stack_boundary
+ : ix86_default_incoming_stack_boundary);
+
+ /* Incoming stack alignment can be changed on individual functions
+ via force_align_arg_pointer attribute. We use the smallest
+ incoming stack boundary. */
+ if (ix86_incoming_stack_boundary > MIN_STACK_BOUNDARY
+ && lookup_attribute (ix86_force_align_arg_pointer_string,
+ TYPE_ATTRIBUTES (TREE_TYPE (current_function_decl))))
+ ix86_incoming_stack_boundary = MIN_STACK_BOUNDARY;
+
+ /* Stack at entrance of main is aligned by runtime. We use the
+ smallest incoming stack boundary. */
+ if (ix86_incoming_stack_boundary > MAIN_STACK_BOUNDARY
+ && DECL_NAME (current_function_decl)
+ && MAIN_NAME_P (DECL_NAME (current_function_decl))
+ && DECL_FILE_SCOPE_P (current_function_decl))
+ ix86_incoming_stack_boundary = MAIN_STACK_BOUNDARY;
+
+ /* x86_64 vararg needs 16byte stack alignment for register save
+ area. */
+ if (TARGET_64BIT
+ && cfun->stdarg
+ && crtl->stack_alignment_estimated < 128)
+ crtl->stack_alignment_estimated = 128;
+}
+
+/* Handle the TARGET_GET_DRAP_RTX hook. Return NULL if no DRAP is
+ needed or an rtx for DRAP otherwise. */
static rtx
-ix86_internal_arg_pointer (void)
+ix86_get_drap_rtx (void)
{
- bool has_force_align_arg_pointer =
- (0 != lookup_attribute (ix86_force_align_arg_pointer_string,
- TYPE_ATTRIBUTES (TREE_TYPE (current_function_decl))));
- if ((FORCE_PREFERRED_STACK_BOUNDARY_IN_MAIN
- && DECL_NAME (current_function_decl)
- && MAIN_NAME_P (DECL_NAME (current_function_decl))
- && DECL_FILE_SCOPE_P (current_function_decl))
- || ix86_force_align_arg_pointer
- || has_force_align_arg_pointer)
- {
- /* Nested functions can't realign the stack due to a register
- conflict. */
- if (DECL_CONTEXT (current_function_decl)
- && TREE_CODE (DECL_CONTEXT (current_function_decl)) == FUNCTION_DECL)
- {
- if (ix86_force_align_arg_pointer)
- warning (0, "-mstackrealign ignored for nested functions");
- if (has_force_align_arg_pointer)
- error ("%s not supported for nested functions",
- ix86_force_align_arg_pointer_string);
- return virtual_incoming_args_rtx;
- }
- cfun->machine->force_align_arg_pointer = gen_rtx_REG (Pmode, CX_REG);
- return copy_to_reg (cfun->machine->force_align_arg_pointer);
+ if (ix86_force_drap || !ACCUMULATE_OUTGOING_ARGS)
+ crtl->need_drap = true;
+
+ if (stack_realign_drap)
+ {
+ /* Assign DRAP to vDRAP and returns vDRAP */
+ unsigned int regno = find_drap_reg ();
+ rtx drap_vreg;
+ rtx arg_ptr;
+ rtx seq, insn;
+
+ arg_ptr = gen_rtx_REG (Pmode, regno);
+ crtl->drap_reg = arg_ptr;
+
+ start_sequence ();
+ drap_vreg = copy_to_reg (arg_ptr);
+ seq = get_insns ();
+ end_sequence ();
+
+ insn = emit_insn_before (seq, NEXT_INSN (entry_of_function ()));
+ RTX_FRAME_RELATED_P (insn) = 1;
+ return drap_vreg;
}
else
- return virtual_incoming_args_rtx;
+ return NULL;
+}
+
+/* Handle the TARGET_INTERNAL_ARG_POINTER hook. */
+
+static rtx
+ix86_internal_arg_pointer (void)
+{
+ return virtual_incoming_args_rtx;
}
/* Handle the TARGET_DWARF_HANDLE_FRAME_UNSPEC hook.
@@ -6618,6 +7607,34 @@ ix86_dwarf_handle_frame_unspec (const char *label, rtx pattern, int index)
}
}
+/* Finalize stack_realign_needed flag, which will guide prologue/epilogue
+ to be generated in correct form. */
+static void
+ix86_finalize_stack_realign_flags (void)
+{
+ /* Check if stack realign is really needed after reload, and
+ stores result in cfun */
+ unsigned int incoming_stack_boundary
+ = (crtl->parm_stack_boundary > ix86_incoming_stack_boundary
+ ? crtl->parm_stack_boundary : ix86_incoming_stack_boundary);
+ unsigned int stack_realign = (incoming_stack_boundary
+ < (current_function_is_leaf
+ ? crtl->max_used_stack_slot_alignment
+ : crtl->stack_alignment_needed));
+
+ if (crtl->stack_realign_finalized)
+ {
+ /* After stack_realign_needed is finalized, we can't no longer
+ change it. */
+ gcc_assert (crtl->stack_realign_needed == stack_realign);
+ }
+ else
+ {
+ crtl->stack_realign_needed = stack_realign;
+ crtl->stack_realign_finalized = true;
+ }
+}
+
/* Expand the prologue into a bunch of separate insns. */
void
@@ -6628,52 +7645,56 @@ ix86_expand_prologue (void)
struct ix86_frame frame;
HOST_WIDE_INT allocate;
+ ix86_finalize_stack_realign_flags ();
+
+ /* DRAP should not coexist with stack_realign_fp */
+ gcc_assert (!(crtl->drap_reg && stack_realign_fp));
+
ix86_compute_frame_layout (&frame);
- if (cfun->machine->force_align_arg_pointer)
+ /* Emit prologue code to adjust stack alignment and setup DRAP, in case
+ of DRAP is needed and stack realignment is really needed after reload */
+ if (crtl->drap_reg && crtl->stack_realign_needed)
{
rtx x, y;
+ int align_bytes = crtl->stack_alignment_needed / BITS_PER_UNIT;
+ int param_ptr_offset = (call_used_regs[REGNO (crtl->drap_reg)]
+ ? 0 : UNITS_PER_WORD);
+
+ gcc_assert (stack_realign_drap);
/* Grab the argument pointer. */
- x = plus_constant (stack_pointer_rtx, 4);
- y = cfun->machine->force_align_arg_pointer;
- insn = emit_insn (gen_rtx_SET (VOIDmode, y, x));
- RTX_FRAME_RELATED_P (insn) = 1;
+ x = plus_constant (stack_pointer_rtx,
+ (UNITS_PER_WORD + param_ptr_offset));
+ y = crtl->drap_reg;
- /* The unwind info consists of two parts: install the fafp as the cfa,
- and record the fafp as the "save register" of the stack pointer.
- The later is there in order that the unwinder can see where it
- should restore the stack pointer across the and insn. */
- x = gen_rtx_UNSPEC (VOIDmode, gen_rtvec (1, const0_rtx), UNSPEC_DEF_CFA);
- x = gen_rtx_SET (VOIDmode, y, x);
- RTX_FRAME_RELATED_P (x) = 1;
- y = gen_rtx_UNSPEC (VOIDmode, gen_rtvec (1, stack_pointer_rtx),
- UNSPEC_REG_SAVE);
- y = gen_rtx_SET (VOIDmode, cfun->machine->force_align_arg_pointer, y);
- RTX_FRAME_RELATED_P (y) = 1;
- x = gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, x, y));
- x = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, x, NULL);
- REG_NOTES (insn) = x;
+ /* Only need to push parameter pointer reg if it is caller
+ saved reg */
+ if (!call_used_regs[REGNO (crtl->drap_reg)])
+ {
+ /* Push arg pointer reg */
+ insn = emit_insn (gen_push (y));
+ RTX_FRAME_RELATED_P (insn) = 1;
+ }
+
+ insn = emit_insn (gen_rtx_SET (VOIDmode, y, x));
+ RTX_FRAME_RELATED_P (insn) = 1;
/* Align the stack. */
- emit_insn (gen_andsi3 (stack_pointer_rtx, stack_pointer_rtx,
- GEN_INT (-16)));
-
- /* And here we cheat like madmen with the unwind info. We force the
- cfa register back to sp+4, which is exactly what it was at the
- start of the function. Re-pushing the return address results in
- the return at the same spot relative to the cfa, and thus is
- correct wrt the unwind info. */
- x = cfun->machine->force_align_arg_pointer;
- x = gen_frame_mem (Pmode, plus_constant (x, -4));
- insn = emit_insn (gen_push (x));
+ insn = emit_insn ((*ix86_gen_andsp) (stack_pointer_rtx,
+ stack_pointer_rtx,
+ GEN_INT (-align_bytes)));
RTX_FRAME_RELATED_P (insn) = 1;
- x = GEN_INT (4);
- x = gen_rtx_UNSPEC (VOIDmode, gen_rtvec (1, x), UNSPEC_DEF_CFA);
- x = gen_rtx_SET (VOIDmode, stack_pointer_rtx, x);
- x = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, x, NULL);
- REG_NOTES (insn) = x;
+ /* Replicate the return address on the stack so that return
+ address can be reached via (argp - 1) slot. This is needed
+ to implement macro RETURN_ADDR_RTX and intrinsic function
+ expand_builtin_return_addr etc. */
+ x = crtl->drap_reg;
+ x = gen_frame_mem (Pmode,
+ plus_constant (x, -UNITS_PER_WORD));
+ insn = emit_insn (gen_push (x));
+ RTX_FRAME_RELATED_P (insn) = 1;
}
/* Note: AT&T enter does NOT have reversed args. Enter is probably
@@ -6688,6 +7709,18 @@ ix86_expand_prologue (void)
RTX_FRAME_RELATED_P (insn) = 1;
}
+ if (stack_realign_fp)
+ {
+ int align_bytes = crtl->stack_alignment_needed / BITS_PER_UNIT;
+ gcc_assert (align_bytes > MIN_STACK_BOUNDARY / BITS_PER_UNIT);
+
+ /* Align the stack. */
+ insn = emit_insn ((*ix86_gen_andsp) (stack_pointer_rtx,
+ stack_pointer_rtx,
+ GEN_INT (-align_bytes)));
+ RTX_FRAME_RELATED_P (insn) = 1;
+ }
+
allocate = frame.to_allocate;
if (!frame.save_regs_using_mov)
@@ -6702,7 +7735,9 @@ ix86_expand_prologue (void)
a red zone location */
if (!TARGET_64BIT_MS_ABI && TARGET_RED_ZONE && frame.save_regs_using_mov
&& (! TARGET_STACK_PROBE || allocate < CHECK_STACK_LIMIT))
- ix86_emit_save_regs_using_mov (frame_pointer_needed ? hard_frame_pointer_rtx
+ ix86_emit_save_regs_using_mov ((frame_pointer_needed
+ && !crtl->stack_realign_needed)
+ ? hard_frame_pointer_rtx
: stack_pointer_rtx,
-frame.nregs * UNITS_PER_WORD);
@@ -6761,8 +7796,11 @@ ix86_expand_prologue (void)
&& !(!TARGET_64BIT_MS_ABI && TARGET_RED_ZONE
&& (! TARGET_STACK_PROBE || allocate < CHECK_STACK_LIMIT)))
{
- if (!frame_pointer_needed || !frame.to_allocate)
- ix86_emit_save_regs_using_mov (stack_pointer_rtx, frame.to_allocate);
+ if (!frame_pointer_needed
+ || !frame.to_allocate
+ || crtl->stack_realign_needed)
+ ix86_emit_save_regs_using_mov (stack_pointer_rtx,
+ frame.to_allocate);
else
ix86_emit_save_regs_using_mov (hard_frame_pointer_rtx,
-frame.nregs * UNITS_PER_WORD);
@@ -6813,6 +7851,16 @@ ix86_expand_prologue (void)
emit_insn (gen_blockage ());
}
+ if (crtl->drap_reg && !crtl->stack_realign_needed)
+ {
+ /* vDRAP is setup but after reload it turns out stack realign
+ isn't necessary, here we will emit prologue to setup DRAP
+ without stack realign adjustment */
+ int drap_bp_offset = UNITS_PER_WORD * 2;
+ rtx x = plus_constant (hard_frame_pointer_rtx, drap_bp_offset);
+ insn = emit_insn (gen_rtx_SET (VOIDmode, crtl->drap_reg, x));
+ }
+
/* Emit cld instruction if stringops are used in the function. */
if (TARGET_CLD && ix86_current_function_needs_cld)
emit_insn (gen_cld ());
@@ -6854,10 +7902,17 @@ void
ix86_expand_epilogue (int style)
{
int regno;
- int sp_valid = !frame_pointer_needed || current_function_sp_is_unchanging;
+ int sp_valid;
struct ix86_frame frame;
HOST_WIDE_INT offset;
+ ix86_finalize_stack_realign_flags ();
+
+ /* When stack is realigned, SP must be valid. */
+ sp_valid = (!frame_pointer_needed
+ || current_function_sp_is_unchanging
+ || stack_realign_fp);
+
ix86_compute_frame_layout (&frame);
/* Calculate start of saved registers relative to ebp. Special care
@@ -6891,11 +7946,16 @@ ix86_expand_epilogue (int style)
{
/* Restore registers. We can use ebp or esp to address the memory
locations. If both are available, default to ebp, since offsets
- are known to be small. Only exception is esp pointing directly to the
- end of block of saved registers, where we may simplify addressing
- mode. */
+ are known to be small. Only exception is esp pointing directly
+ to the end of block of saved registers, where we may simplify
+ addressing mode.
- if (!frame_pointer_needed || (sp_valid && !frame.to_allocate))
+ If we are realigning stack with bp and sp, regs restore can't
+ be addressed by bp. sp must be used instead. */
+
+ if (!frame_pointer_needed
+ || (sp_valid && !frame.to_allocate)
+ || stack_realign_fp)
ix86_emit_restore_regs_using_mov (stack_pointer_rtx,
frame.to_allocate, style == 2);
else
@@ -6907,6 +7967,9 @@ ix86_expand_epilogue (int style)
{
rtx tmp, sa = EH_RETURN_STACKADJ_RTX;
+ /* Stack align doesn't work with eh_return. */
+ gcc_assert (!crtl->stack_realign_needed);
+
if (frame_pointer_needed)
{
tmp = gen_rtx_PLUS (Pmode, hard_frame_pointer_rtx, sa);
@@ -6948,10 +8011,16 @@ ix86_expand_epilogue (int style)
else
{
/* First step is to deallocate the stack frame so that we can
- pop the registers. */
+ pop the registers.
+
+ If we realign stack with frame pointer, then stack pointer
+ won't be able to recover via lea $offset(%bp), %sp, because
+ there is a padding area between bp and sp for realign.
+ "add $to_allocate, %sp" must be used instead. */
if (!sp_valid)
{
gcc_assert (frame_pointer_needed);
+ gcc_assert (!stack_realign_fp);
pro_epilogue_adjust_stack (stack_pointer_rtx,
hard_frame_pointer_rtx,
GEN_INT (offset), style);
@@ -6970,15 +8039,31 @@ ix86_expand_epilogue (int style)
if (TARGET_USE_LEAVE)
emit_insn ((*ix86_gen_leave) ());
else
- emit_insn ((*ix86_gen_pop1) (hard_frame_pointer_rtx));
+ {
+ /* For stack realigned really happens, recover stack
+ pointer to hard frame pointer is a must, if not using
+ leave. */
+ if (stack_realign_fp)
+ pro_epilogue_adjust_stack (stack_pointer_rtx,
+ hard_frame_pointer_rtx,
+ const0_rtx, style);
+ emit_insn ((*ix86_gen_pop1) (hard_frame_pointer_rtx));
+ }
}
}
- if (cfun->machine->force_align_arg_pointer)
+ if (crtl->drap_reg && crtl->stack_realign_needed)
{
- emit_insn (gen_addsi3 (stack_pointer_rtx,
- cfun->machine->force_align_arg_pointer,
- GEN_INT (-4)));
+ int param_ptr_offset = (call_used_regs[REGNO (crtl->drap_reg)]
+ ? 0 : UNITS_PER_WORD);
+ gcc_assert (stack_realign_drap);
+ emit_insn ((*ix86_gen_add3) (stack_pointer_rtx,
+ crtl->drap_reg,
+ GEN_INT (-(UNITS_PER_WORD
+ + param_ptr_offset))));
+ if (!call_used_regs[REGNO (crtl->drap_reg)])
+ emit_insn ((*ix86_gen_pop1) (crtl->drap_reg));
+
}
/* Sibcall epilogues don't want a return instruction. */
@@ -8245,7 +9330,8 @@ get_dllimport_decl (tree decl)
name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
name = targetm.strip_name_encoding (name);
- prefix = name[0] == FASTCALL_PREFIX ? "*__imp_": "*__imp__";
+ prefix = name[0] == FASTCALL_PREFIX || user_label_prefix[0] == 0
+ ? "*__imp_" : "*__imp__";
namelen = strlen (name);
prefixlen = strlen (prefix);
imp_name = (char *) alloca (namelen + prefixlen + 1);
@@ -10455,7 +11541,7 @@ ix86_expand_clear (rtx dest)
tmp = gen_rtx_SET (VOIDmode, dest, const0_rtx);
/* This predicate should match that for movsi_xor and movdi_xor_rex64. */
- if (reload_completed && (!TARGET_USE_MOV0 || optimize_size))
+ if (reload_completed && (!TARGET_USE_MOV0 || optimize_insn_for_speed_p ()))
{
rtx clob = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (CCmode, FLAGS_REG));
tmp = gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, tmp, clob));
@@ -10722,7 +11808,7 @@ ix86_expand_vector_move_misalign (enum machine_mode mode, rtx operands[])
if (MEM_P (op1))
{
/* If we're optimizing for size, movups is the smallest. */
- if (optimize_size)
+ if (optimize_insn_for_size_p ())
{
op0 = gen_lowpart (V4SFmode, op0);
op1 = gen_lowpart (V4SFmode, op1);
@@ -10804,7 +11890,7 @@ ix86_expand_vector_move_misalign (enum machine_mode mode, rtx operands[])
else if (MEM_P (op0))
{
/* If we're optimizing for size, movups is the smallest. */
- if (optimize_size)
+ if (optimize_insn_for_size_p ())
{
op0 = gen_lowpart (V4SFmode, op0);
op1 = gen_lowpart (V4SFmode, op1);
@@ -12008,7 +13094,7 @@ ix86_fp_comparison_sahf_cost (enum rtx_code code)
enum rtx_code bypass_code, first_code, second_code;
/* Return arbitrarily high cost when instruction is not preferred - this
avoids gcc from using it. */
- if (!(TARGET_SAHF && (TARGET_USE_SAHF || optimize_size)))
+ if (!(TARGET_SAHF && (TARGET_USE_SAHF || optimize_insn_for_size_p ())))
return 1024;
ix86_fp_comparison_codes (code, &bypass_code, &first_code, &second_code);
return (bypass_code != UNKNOWN || second_code != UNKNOWN) + 3;
@@ -12493,7 +13579,7 @@ ix86_expand_branch (enum rtx_code code, rtx label)
optimizing for size. */
if ((code == EQ || code == NE)
- && (!optimize_size
+ && (!optimize_insn_for_size_p ()
|| hi[1] == const0_rtx || lo[1] == const0_rtx))
{
rtx xor0, xor1;
@@ -14545,7 +15631,7 @@ ix86_split_long_move (rtx operands[])
}
/* If optimizing for size, attempt to locally unCSE nonzero constants. */
- if (optimize_size)
+ if (optimize_insn_for_size_p ())
{
for (j = 0; j < nparts - 1; j++)
if (CONST_INT_P (operands[6 + j])
@@ -14576,7 +15662,7 @@ ix86_expand_ashl_const (rtx operand, int count, enum machine_mode mode)
? gen_addsi3
: gen_adddi3) (operand, operand, operand));
}
- else if (!optimize_size
+ else if (!optimize_insn_for_size_p ()
&& count * ix86_cost->add <= ix86_cost->shift_const)
{
int i;
@@ -14659,7 +15745,7 @@ ix86_split_ashl (rtx *operands, rtx scratch, enum machine_mode mode)
{
rtx x;
- if (TARGET_PARTIAL_REG_STALL && !optimize_size)
+ if (TARGET_PARTIAL_REG_STALL && !optimize_insn_for_size_p ())
x = gen_rtx_ZERO_EXTEND (mode == DImode ? SImode : DImode, operands[2]);
else
x = gen_lowpart (mode == DImode ? SImode : DImode, operands[2]);
@@ -14691,7 +15777,7 @@ ix86_split_ashl (rtx *operands, rtx scratch, enum machine_mode mode)
/* For -1 << N, we can avoid the shld instruction, because we
know that we're shifting 0...31/63 ones into a -1. */
emit_move_insn (low[0], constm1_rtx);
- if (optimize_size)
+ if (optimize_insn_for_size_p ())
emit_move_insn (high[0], low[0]);
else
emit_move_insn (high[0], constm1_rtx);
@@ -14714,10 +15800,13 @@ ix86_split_ashl (rtx *operands, rtx scratch, enum machine_mode mode)
ix86_expand_clear (scratch);
emit_insn ((mode == DImode
? gen_x86_shift_adj_1
- : gen_x86_64_shift_adj) (high[0], low[0], operands[2], scratch));
+ : gen_x86_64_shift_adj_1) (high[0], low[0], operands[2],
+ scratch));
}
else
- emit_insn (gen_x86_shift_adj_2 (high[0], low[0], operands[2]));
+ emit_insn ((mode == DImode
+ ? gen_x86_shift_adj_2
+ : gen_x86_64_shift_adj_2) (high[0], low[0], operands[2]));
}
void
@@ -14791,11 +15880,13 @@ ix86_split_ashr (rtx *operands, rtx scratch, enum machine_mode mode)
GEN_INT (single_width - 1)));
emit_insn ((mode == DImode
? gen_x86_shift_adj_1
- : gen_x86_64_shift_adj) (low[0], high[0], operands[2],
- scratch));
+ : gen_x86_64_shift_adj_1) (low[0], high[0], operands[2],
+ scratch));
}
else
- emit_insn (gen_x86_shift_adj_3 (low[0], high[0], operands[2]));
+ emit_insn ((mode == DImode
+ ? gen_x86_shift_adj_3
+ : gen_x86_64_shift_adj_3) (low[0], high[0], operands[2]));
}
}
@@ -14854,11 +15945,13 @@ ix86_split_lshr (rtx *operands, rtx scratch, enum machine_mode mode)
ix86_expand_clear (scratch);
emit_insn ((mode == DImode
? gen_x86_shift_adj_1
- : gen_x86_64_shift_adj) (low[0], high[0], operands[2],
- scratch));
+ : gen_x86_64_shift_adj_1) (low[0], high[0], operands[2],
+ scratch));
}
else
- emit_insn (gen_x86_shift_adj_2 (low[0], high[0], operands[2]));
+ emit_insn ((mode == DImode
+ ? gen_x86_shift_adj_2
+ : gen_x86_64_shift_adj_2) (low[0], high[0], operands[2]));
}
}
@@ -15537,16 +16630,19 @@ decide_alg (HOST_WIDE_INT count, HOST_WIDE_INT expected_size, bool memset,
|| (alg != rep_prefix_1_byte \
&& alg != rep_prefix_4_byte \
&& alg != rep_prefix_8_byte))
+ const struct processor_costs *cost;
+
+ cost = optimize_insn_for_size_p () ? &ix86_size_cost : ix86_cost;
*dynamic_check = -1;
if (memset)
- algs = &ix86_cost->memset[TARGET_64BIT != 0];
+ algs = &cost->memset[TARGET_64BIT != 0];
else
- algs = &ix86_cost->memcpy[TARGET_64BIT != 0];
+ algs = &cost->memcpy[TARGET_64BIT != 0];
if (stringop_alg != no_stringop && ALG_USABLE_P (stringop_alg))
return stringop_alg;
/* rep; movq or rep; movl is the smallest variant. */
- else if (optimize_size)
+ else if (optimize_insn_for_size_p ())
{
if (!count || (count & 3))
return rep_prefix_usable ? rep_prefix_1_byte : loop_1_byte;
@@ -16461,7 +17557,7 @@ ix86_expand_strlen (rtx out, rtx src, rtx eoschar, rtx align)
if (TARGET_UNROLL_STRLEN && eoschar == const0_rtx && optimize > 1
&& !TARGET_INLINE_ALL_STRINGOPS
- && !optimize_size
+ && !optimize_insn_for_size_p ()
&& (!CONST_INT_P (align) || INTVAL (align) < 4))
return 0;
@@ -16469,7 +17565,7 @@ ix86_expand_strlen (rtx out, rtx src, rtx eoschar, rtx align)
scratch1 = gen_reg_rtx (Pmode);
if (TARGET_UNROLL_STRLEN && eoschar == const0_rtx && optimize > 1
- && !optimize_size)
+ && !optimize_insn_for_size_p ())
{
/* Well it seems that some optimizer does not combine a call like
foo(strlen(bar), strlen(bar));
@@ -17633,6 +18729,8 @@ enum ix86_builtins
IX86_BUILTIN_MOVNTPD,
IX86_BUILTIN_MOVNTDQ,
+ IX86_BUILTIN_MOVQ128,
+
/* SSE2 MMX */
IX86_BUILTIN_MASKMOVDQU,
IX86_BUILTIN_MOVMSKPD,
@@ -18113,22 +19211,29 @@ enum ix86_builtins
/* Table for the ix86 builtin decls. */
static GTY(()) tree ix86_builtins[(int) IX86_BUILTIN_MAX];
-/* Add an ix86 target builtin function with CODE, NAME and TYPE. Do so,
- * if the target_flags include one of MASK. Stores the function decl
- * in the ix86_builtins array.
- * Returns the function decl or NULL_TREE, if the builtin was not added. */
+/* Table to record which ISA options the builtin needs. */
+static int ix86_builtins_isa[(int) IX86_BUILTIN_MAX];
+
+/* Add an ix86 target builtin function with CODE, NAME and TYPE. Save the MASK
+ * of which isa_flags to use in the ix86_builtins_isa array. Stores the
+ * function decl in the ix86_builtins array. Returns the function decl or
+ * NULL_TREE, if the builtin was not added.
+ *
+ * Record all builtins, even if it isn't an instruction set in the current ISA
+ * in case the user uses function specific options for a different ISA. When
+ * the builtin is expanded, check at that time whether it is valid. */
static inline tree
def_builtin (int mask, const char *name, tree type, enum ix86_builtins code)
{
tree decl = NULL_TREE;
- if (mask & ix86_isa_flags
- && (!(mask & OPTION_MASK_ISA_64BIT) || TARGET_64BIT))
+ if (!(mask & OPTION_MASK_ISA_64BIT) || TARGET_64BIT)
{
decl = add_builtin_function (name, type, code, BUILT_IN_MD,
NULL, NULL_TREE);
ix86_builtins[(int) code] = decl;
+ ix86_builtins_isa[(int) code] = mask;
}
return decl;
@@ -18755,6 +19860,8 @@ static const struct builtin_description bdesc_args[] =
{ OPTION_MASK_ISA_SSE2, CODE_FOR_abstf2, 0, IX86_BUILTIN_FABSQ, UNKNOWN, (int) FLOAT128_FTYPE_FLOAT128 },
{ OPTION_MASK_ISA_SSE2, CODE_FOR_copysigntf3, 0, IX86_BUILTIN_COPYSIGNQ, UNKNOWN, (int) FLOAT128_FTYPE_FLOAT128_FLOAT128 },
+ { OPTION_MASK_ISA_SSE, CODE_FOR_sse2_movq128, "__builtin_ia32_movq128", IX86_BUILTIN_MOVQ128, UNKNOWN, (int) V2DI_FTYPE_V2DI },
+
/* SSE2 MMX */
{ OPTION_MASK_ISA_SSE2, CODE_FOR_mmx_addv1di3, "__builtin_ia32_paddq", IX86_BUILTIN_PADDQ, UNKNOWN, (int) V1DI_FTYPE_V1DI_V1DI },
{ OPTION_MASK_ISA_SSE2, CODE_FOR_mmx_subv1di3, "__builtin_ia32_psubq", IX86_BUILTIN_PSUBQ, UNKNOWN, (int) V1DI_FTYPE_V1DI_V1DI },
@@ -19171,9 +20278,10 @@ static const struct builtin_description bdesc_multi_arg[] =
{ OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pcom_tfv2di3, "__builtin_ia32_pcomtrueuq", IX86_BUILTIN_PCOMTRUEUQ, PCOM_TRUE, (int)MULTI_ARG_2_DI_TF },
};
-/* Set up all the MMX/SSE builtins. This is not called if TARGET_MMX
- is zero. Otherwise, if TARGET_SSE is not set, only expand the MMX
- builtins. */
+/* Set up all the MMX/SSE builtins, even builtins for instructions that are not
+ in the current target ISA to allow the user to compile particular modules
+ with different target specific options that differ from the command line
+ options. */
static void
ix86_init_mmx_sse_builtins (void)
{
@@ -20112,23 +21220,15 @@ ix86_init_mmx_sse_builtins (void)
def_builtin (OPTION_MASK_ISA_SSE3, "__builtin_ia32_mwait", void_ftype_unsigned_unsigned, IX86_BUILTIN_MWAIT);
/* AES */
- if (TARGET_AES)
- {
- /* Define AES built-in functions only if AES is enabled. */
- def_builtin_const (OPTION_MASK_ISA_SSE2, "__builtin_ia32_aesenc128", v2di_ftype_v2di_v2di, IX86_BUILTIN_AESENC128);
- def_builtin_const (OPTION_MASK_ISA_SSE2, "__builtin_ia32_aesenclast128", v2di_ftype_v2di_v2di, IX86_BUILTIN_AESENCLAST128);
- def_builtin_const (OPTION_MASK_ISA_SSE2, "__builtin_ia32_aesdec128", v2di_ftype_v2di_v2di, IX86_BUILTIN_AESDEC128);
- def_builtin_const (OPTION_MASK_ISA_SSE2, "__builtin_ia32_aesdeclast128", v2di_ftype_v2di_v2di, IX86_BUILTIN_AESDECLAST128);
- def_builtin_const (OPTION_MASK_ISA_SSE2, "__builtin_ia32_aesimc128", v2di_ftype_v2di, IX86_BUILTIN_AESIMC128);
- def_builtin_const (OPTION_MASK_ISA_SSE2, "__builtin_ia32_aeskeygenassist128", v2di_ftype_v2di_int, IX86_BUILTIN_AESKEYGENASSIST128);
- }
+ def_builtin_const (OPTION_MASK_ISA_AES, "__builtin_ia32_aesenc128", v2di_ftype_v2di_v2di, IX86_BUILTIN_AESENC128);
+ def_builtin_const (OPTION_MASK_ISA_AES, "__builtin_ia32_aesenclast128", v2di_ftype_v2di_v2di, IX86_BUILTIN_AESENCLAST128);
+ def_builtin_const (OPTION_MASK_ISA_AES, "__builtin_ia32_aesdec128", v2di_ftype_v2di_v2di, IX86_BUILTIN_AESDEC128);
+ def_builtin_const (OPTION_MASK_ISA_AES, "__builtin_ia32_aesdeclast128", v2di_ftype_v2di_v2di, IX86_BUILTIN_AESDECLAST128);
+ def_builtin_const (OPTION_MASK_ISA_AES, "__builtin_ia32_aesimc128", v2di_ftype_v2di, IX86_BUILTIN_AESIMC128);
+ def_builtin_const (OPTION_MASK_ISA_AES, "__builtin_ia32_aeskeygenassist128", v2di_ftype_v2di_int, IX86_BUILTIN_AESKEYGENASSIST128);
/* PCLMUL */
- if (TARGET_PCLMUL)
- {
- /* Define PCLMUL built-in function only if PCLMUL is enabled. */
- def_builtin_const (OPTION_MASK_ISA_SSE2, "__builtin_ia32_pclmulqdq128", v2di_ftype_v2di_v2di_int, IX86_BUILTIN_PCLMULQDQ128);
- }
+ def_builtin_const (OPTION_MASK_ISA_PCLMUL, "__builtin_ia32_pclmulqdq128", v2di_ftype_v2di_v2di_int, IX86_BUILTIN_PCLMULQDQ128);
/* Access to the vec_init patterns. */
ftype = build_function_type_list (V2SI_type_node, integer_type_node,
@@ -20383,8 +21483,7 @@ ix86_init_builtins (void)
ix86_builtins[(int) IX86_BUILTIN_COPYSIGNQ] = decl;
TREE_READONLY (decl) = 1;
- if (TARGET_MMX)
- ix86_init_mmx_sse_builtins ();
+ ix86_init_mmx_sse_builtins ();
if (TARGET_64BIT)
ix86_init_builtins_va_builtins_abi ();
}
@@ -21339,7 +22438,7 @@ ix86_expand_special_args_builtin (const struct builtin_description *d,
bool last_arg_constant = false;
const struct insn_data *insn_p = &insn_data[icode];
enum machine_mode tmode = insn_p->operand[0].mode;
- enum { load, store } class;
+ enum { load, store } klass;
switch ((enum ix86_special_builtin_type) d->flag)
{
@@ -21351,7 +22450,7 @@ ix86_expand_special_args_builtin (const struct builtin_description *d,
case V4SF_FTYPE_PCFLOAT:
case V2DF_FTYPE_PCDOUBLE:
nargs = 1;
- class = load;
+ klass = load;
memory = 0;
break;
case VOID_FTYPE_PV2SF_V4SF:
@@ -21362,14 +22461,14 @@ ix86_expand_special_args_builtin (const struct builtin_description *d,
case VOID_FTYPE_PDI_DI:
case VOID_FTYPE_PINT_INT:
nargs = 1;
- class = store;
+ klass = store;
/* Reserve memory operand for target. */
memory = ARRAY_SIZE (args);
break;
case V4SF_FTYPE_V4SF_PCV2SF:
case V2DF_FTYPE_V2DF_PCDOUBLE:
nargs = 2;
- class = load;
+ klass = load;
memory = 1;
break;
default:
@@ -21378,7 +22477,7 @@ ix86_expand_special_args_builtin (const struct builtin_description *d,
gcc_assert (nargs <= ARRAY_SIZE (args));
- if (class == store)
+ if (klass == store)
{
arg = CALL_EXPR_ARG (exp, 0);
op = expand_normal (arg);
@@ -21455,7 +22554,7 @@ ix86_expand_special_args_builtin (const struct builtin_description *d,
if (! pat)
return 0;
emit_insn (pat);
- return class == store ? 0 : target;
+ return klass == store ? 0 : target;
}
/* Return the integer constant in ARG. Constrain it to be in the range
@@ -21600,6 +22699,28 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
enum machine_mode mode0, mode1, mode2;
unsigned int fcode = DECL_FUNCTION_CODE (fndecl);
+ /* Determine whether the builtin function is available under the current ISA.
+ Originally the builtin was not created if it wasn't applicable to the
+ current ISA based on the command line switches. With function specific
+ options, we need to check in the context of the function making the call
+ whether it is supported. */
+ if (ix86_builtins_isa[fcode]
+ && !(ix86_builtins_isa[fcode] & ix86_isa_flags))
+ {
+ char *opts = ix86_target_string (ix86_builtins_isa[fcode], 0, NULL,
+ NULL, NULL, false);
+
+ if (!opts)
+ error ("%qE needs unknown isa option", fndecl);
+ else
+ {
+ gcc_assert (opts != NULL);
+ error ("%qE needs isa option %s", fndecl, opts);
+ free (opts);
+ }
+ return const0_rtx;
+ }
+
switch (fcode)
{
case IX86_BUILTIN_MASKMOVQ:
@@ -22027,8 +23148,10 @@ ix86_veclibabi_acml (enum built_in_function fn, tree type_out, tree type_in)
}
-/* Returns a decl of a function that implements conversion of the
- input vector of type TYPE, or NULL_TREE if it is not available. */
+/* Returns a decl of a function that implements conversion of an integer vector
+ into a floating-point vector, or vice-versa. TYPE is the type of the integer
+ side of the conversion.
+ Return NULL_TREE if it is not available. */
static tree
ix86_vectorize_builtin_conversion (unsigned int code, tree type)
@@ -22050,7 +23173,7 @@ ix86_vectorize_builtin_conversion (unsigned int code, tree type)
case FIX_TRUNC_EXPR:
switch (TYPE_MODE (type))
{
- case V4SFmode:
+ case V4SImode:
return ix86_builtins[IX86_BUILTIN_CVTTPS2DQ];
default:
return NULL_TREE;
@@ -22068,7 +23191,7 @@ static tree
ix86_builtin_reciprocal (unsigned int fn, bool md_fn,
bool sqrt ATTRIBUTE_UNUSED)
{
- if (! (TARGET_SSE_MATH && TARGET_RECIP && !optimize_size
+ if (! (TARGET_SSE_MATH && TARGET_RECIP && !optimize_insn_for_size_p ()
&& flag_finite_math_only && !flag_trapping_math
&& flag_unsafe_math_optimizations))
return NULL_TREE;
@@ -22300,16 +23423,16 @@ ix86_preferred_output_reload_class (rtx x, enum reg_class regclass)
}
static enum reg_class
-ix86_secondary_reload (bool in_p, rtx x, enum reg_class class,
+ix86_secondary_reload (bool in_p, rtx x, enum reg_class rclass,
enum machine_mode mode,
secondary_reload_info *sri ATTRIBUTE_UNUSED)
{
/* QImode spills from non-QI registers require
intermediate register on 32bit targets. */
if (!in_p && mode == QImode && !TARGET_64BIT
- && (class == GENERAL_REGS
- || class == LEGACY_REGS
- || class == INDEX_REGS))
+ && (rclass == GENERAL_REGS
+ || rclass == LEGACY_REGS
+ || rclass == INDEX_REGS))
{
int regno;
@@ -23707,7 +24830,7 @@ ix86_pad_returns (void)
bool replace = false;
if (!JUMP_P (ret) || GET_CODE (PATTERN (ret)) != RETURN
- || !maybe_hot_bb_p (bb))
+ || optimize_bb_for_size_p (bb))
continue;
for (prev = PREV_INSN (ret); prev; prev = PREV_INSN (prev))
if (active_insn_p (prev) || LABEL_P (prev))
@@ -24061,7 +25184,7 @@ ix86_expand_vector_init_one_nonzero (bool mmx_ok, enum machine_mode mode,
else
tmp = new_target;
- emit_insn (gen_sse_shufps_1 (tmp, tmp, tmp,
+ emit_insn (gen_sse_shufps_v4sf (tmp, tmp, tmp,
GEN_INT (1),
GEN_INT (one_var == 1 ? 0 : 1),
GEN_INT (one_var == 2 ? 0+4 : 1+4),
@@ -24625,7 +25748,7 @@ ix86_expand_vector_set (bool mmx_ok, rtx target, rtx val, int elt)
/* target = X A B B */
ix86_expand_vector_set (false, target, val, 0);
/* target = A X C D */
- emit_insn (gen_sse_shufps_1 (target, target, tmp,
+ emit_insn (gen_sse_shufps_v4sf (target, target, tmp,
GEN_INT (1), GEN_INT (0),
GEN_INT (2+4), GEN_INT (3+4)));
return;
@@ -24636,7 +25759,7 @@ ix86_expand_vector_set (bool mmx_ok, rtx target, rtx val, int elt)
/* tmp = X B C D */
ix86_expand_vector_set (false, tmp, val, 0);
/* target = A B X D */
- emit_insn (gen_sse_shufps_1 (target, target, tmp,
+ emit_insn (gen_sse_shufps_v4sf (target, target, tmp,
GEN_INT (0), GEN_INT (1),
GEN_INT (0+4), GEN_INT (3+4)));
return;
@@ -24647,7 +25770,7 @@ ix86_expand_vector_set (bool mmx_ok, rtx target, rtx val, int elt)
/* tmp = X B C D */
ix86_expand_vector_set (false, tmp, val, 0);
/* target = A B X D */
- emit_insn (gen_sse_shufps_1 (target, target, tmp,
+ emit_insn (gen_sse_shufps_v4sf (target, target, tmp,
GEN_INT (0), GEN_INT (1),
GEN_INT (2+4), GEN_INT (0+4)));
return;
@@ -24768,7 +25891,7 @@ ix86_expand_vector_extract (bool mmx_ok, rtx target, rtx vec, int elt)
case 1:
case 3:
tmp = gen_reg_rtx (mode);
- emit_insn (gen_sse_shufps_1 (tmp, vec, vec,
+ emit_insn (gen_sse_shufps_v4sf (tmp, vec, vec,
GEN_INT (elt), GEN_INT (elt),
GEN_INT (elt+4), GEN_INT (elt+4)));
break;
@@ -24885,7 +26008,7 @@ ix86_expand_reduc_v4sf (rtx (*fn) (rtx, rtx, rtx), rtx dest, rtx in)
emit_insn (gen_sse_movhlps (tmp1, in, in));
emit_insn (fn (tmp2, tmp1, in));
- emit_insn (gen_sse_shufps_1 (tmp3, tmp2, tmp2,
+ emit_insn (gen_sse_shufps_v4sf (tmp3, tmp2, tmp2,
GEN_INT (1), GEN_INT (1),
GEN_INT (1+4), GEN_INT (1+4)));
emit_insn (fn (dest, tmp2, tmp3));
@@ -25020,7 +26143,7 @@ ix86_emit_fp_unordered_jump (rtx label)
emit_insn (gen_x86_fnstsw_1 (reg));
- if (TARGET_SAHF && (TARGET_USE_SAHF || optimize_size))
+ if (TARGET_SAHF && (TARGET_USE_SAHF || optimize_insn_for_size_p ()))
{
emit_insn (gen_x86_sahf_1 (reg));
@@ -26378,6 +27501,10 @@ ix86_enum_va_list (int idx, const char **pname, tree *ptree)
#define TARGET_PASS_BY_REFERENCE ix86_pass_by_reference
#undef TARGET_INTERNAL_ARG_POINTER
#define TARGET_INTERNAL_ARG_POINTER ix86_internal_arg_pointer
+#undef TARGET_UPDATE_STACK_BOUNDARY
+#define TARGET_UPDATE_STACK_BOUNDARY ix86_update_stack_boundary
+#undef TARGET_GET_DRAP_RTX
+#define TARGET_GET_DRAP_RTX ix86_get_drap_rtx
#undef TARGET_DWARF_HANDLE_FRAME_UNSPEC
#define TARGET_DWARF_HANDLE_FRAME_UNSPEC ix86_dwarf_handle_frame_unspec
#undef TARGET_STRICT_ARGUMENT_NAMING
@@ -26420,6 +27547,30 @@ ix86_enum_va_list (int idx, const char **pname, tree *ptree)
#undef TARGET_VECTORIZE_BUILTIN_VECTORIZATION_COST
#define TARGET_VECTORIZE_BUILTIN_VECTORIZATION_COST x86_builtin_vectorization_cost
+#undef TARGET_SET_CURRENT_FUNCTION
+#define TARGET_SET_CURRENT_FUNCTION ix86_set_current_function
+
+#undef TARGET_OPTION_VALID_ATTRIBUTE_P
+#define TARGET_OPTION_VALID_ATTRIBUTE_P ix86_valid_option_attribute_p
+
+#undef TARGET_OPTION_SAVE
+#define TARGET_OPTION_SAVE ix86_function_specific_save
+
+#undef TARGET_OPTION_RESTORE
+#define TARGET_OPTION_RESTORE ix86_function_specific_restore
+
+#undef TARGET_OPTION_PRINT
+#define TARGET_OPTION_PRINT ix86_function_specific_print
+
+#undef TARGET_OPTION_CAN_INLINE_P
+#define TARGET_OPTION_CAN_INLINE_P ix86_can_inline_p
+
+#undef TARGET_OPTION_COLD_ATTRIBUTE_SETS_OPTIMIZATION
+#define TARGET_OPTION_COLD_ATTRIBUTE_SETS_OPTIMIZATION true
+
+#undef TARGET_OPTION_HOT_ATTRIBUTE_SETS_OPTIMIZATION
+#define TARGET_OPTION_HOT_ATTRIBUTE_SETS_OPTIMIZATION true
+
struct gcc_target targetm = TARGET_INITIALIZER;
#include "gt-i386.h"
diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index d17e414eb5f..23871561544 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -49,6 +49,13 @@ along with GCC; see the file COPYING3. If not see
#define TARGET_SSE4A OPTION_ISA_SSE4A
#define TARGET_SSE5 OPTION_ISA_SSE5
#define TARGET_ROUND OPTION_ISA_ROUND
+#define TARGET_ABM OPTION_ISA_ABM
+#define TARGET_POPCNT OPTION_ISA_POPCNT
+#define TARGET_SAHF OPTION_ISA_SAHF
+#define TARGET_AES OPTION_ISA_AES
+#define TARGET_PCLMUL OPTION_ISA_PCLMUL
+#define TARGET_CMPXCHG16B OPTION_ISA_CX16
+
/* SSE5 and SSE4.1 define the same round instructions */
#define OPTION_MASK_ISA_ROUND (OPTION_MASK_ISA_SSE4_1 | OPTION_MASK_ISA_SSE5)
@@ -163,6 +170,10 @@ struct processor_costs {
};
extern const struct processor_costs *ix86_cost;
+extern const struct processor_costs ix86_size_cost;
+
+#define ix86_cur_cost() \
+ (optimize_insn_for_size_p () ? &ix86_size_cost: ix86_cost)
/* Macros used in the machine description to test the flags. */
@@ -286,7 +297,7 @@ enum ix86_tune_indices {
X86_TUNE_LAST
};
-extern unsigned int ix86_tune_features[X86_TUNE_LAST];
+extern unsigned char ix86_tune_features[X86_TUNE_LAST];
#define TARGET_USE_LEAVE ix86_tune_features[X86_TUNE_USE_LEAVE]
#define TARGET_PUSH_MEMORY ix86_tune_features[X86_TUNE_PUSH_MEMORY]
@@ -380,7 +391,7 @@ enum ix86_arch_indices {
X86_ARCH_LAST
};
-extern unsigned int ix86_arch_features[X86_ARCH_LAST];
+extern unsigned char ix86_arch_features[X86_ARCH_LAST];
#define TARGET_CMOVE ix86_arch_features[X86_ARCH_CMOVE]
#define TARGET_CMPXCHG ix86_arch_features[X86_ARCH_CMPXCHG]
@@ -392,15 +403,7 @@ extern unsigned int ix86_arch_features[X86_ARCH_LAST];
extern int x86_prefetch_sse;
-#define TARGET_ABM x86_abm
-#define TARGET_CMPXCHG16B x86_cmpxchg16b
-#define TARGET_POPCNT x86_popcnt
#define TARGET_PREFETCH_SSE x86_prefetch_sse
-#define TARGET_SAHF x86_sahf
-#define TARGET_RECIP x86_recip
-#define TARGET_FUSED_MADD x86_fused_muladd
-#define TARGET_AES (TARGET_SSE2 && x86_aes)
-#define TARGET_PCLMUL (TARGET_SSE2 && x86_pclmul)
#define ASSEMBLER_DIALECT (ix86_asm_dialect)
@@ -475,7 +478,7 @@ enum calling_abi
Don't use this macro to turn on various extra optimizations for
`-O'. That is what `OPTIMIZATION_OPTIONS' is for. */
-#define OVERRIDE_OPTIONS override_options ()
+#define OVERRIDE_OPTIONS override_options (true)
/* Define this to change the optimizations performed by default. */
#define OPTIMIZATION_OPTIONS(LEVEL, SIZE) \
@@ -537,196 +540,10 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
#endif
/* Target CPU builtins. */
-#define TARGET_CPU_CPP_BUILTINS() \
- do \
- { \
- size_t arch_len = strlen (ix86_arch_string); \
- size_t tune_len = strlen (ix86_tune_string); \
- int last_arch_char = ix86_arch_string[arch_len - 1]; \
- int last_tune_char = ix86_tune_string[tune_len - 1]; \
- \
- if (TARGET_64BIT) \
- { \
- builtin_assert ("cpu=x86_64"); \
- builtin_assert ("machine=x86_64"); \
- builtin_define ("__amd64"); \
- builtin_define ("__amd64__"); \
- builtin_define ("__x86_64"); \
- builtin_define ("__x86_64__"); \
- } \
- else \
- { \
- builtin_assert ("cpu=i386"); \
- builtin_assert ("machine=i386"); \
- builtin_define_std ("i386"); \
- } \
- \
- /* Built-ins based on -march=. */ \
- switch (ix86_arch) \
- { \
- case PROCESSOR_I386: \
- break; \
- case PROCESSOR_I486: \
- builtin_define ("__i486"); \
- builtin_define ("__i486__"); \
- break; \
- case PROCESSOR_PENTIUM: \
- builtin_define ("__i586"); \
- builtin_define ("__i586__"); \
- builtin_define ("__pentium"); \
- builtin_define ("__pentium__"); \
- if (last_arch_char == 'x') \
- builtin_define ("__pentium_mmx__"); \
- break; \
- case PROCESSOR_PENTIUMPRO: \
- builtin_define ("__i686"); \
- builtin_define ("__i686__"); \
- builtin_define ("__pentiumpro"); \
- builtin_define ("__pentiumpro__"); \
- break; \
- case PROCESSOR_GEODE: \
- builtin_define ("__geode"); \
- builtin_define ("__geode__"); \
- break; \
- case PROCESSOR_K6: \
- builtin_define ("__k6"); \
- builtin_define ("__k6__"); \
- if (last_arch_char == '2') \
- builtin_define ("__k6_2__"); \
- else if (last_arch_char == '3') \
- builtin_define ("__k6_3__"); \
- break; \
- case PROCESSOR_ATHLON: \
- builtin_define ("__athlon"); \
- builtin_define ("__athlon__"); \
- /* Only plain "athlon" lacks SSE. */ \
- if (last_arch_char != 'n') \
- builtin_define ("__athlon_sse__"); \
- break; \
- case PROCESSOR_K8: \
- builtin_define ("__k8"); \
- builtin_define ("__k8__"); \
- break; \
- case PROCESSOR_AMDFAM10: \
- builtin_define ("__amdfam10"); \
- builtin_define ("__amdfam10__"); \
- break; \
- case PROCESSOR_PENTIUM4: \
- builtin_define ("__pentium4"); \
- builtin_define ("__pentium4__"); \
- break; \
- case PROCESSOR_NOCONA: \
- builtin_define ("__nocona"); \
- builtin_define ("__nocona__"); \
- break; \
- case PROCESSOR_CORE2: \
- builtin_define ("__core2"); \
- builtin_define ("__core2__"); \
- break; \
- case PROCESSOR_GENERIC32: \
- case PROCESSOR_GENERIC64: \
- case PROCESSOR_max: \
- gcc_unreachable (); \
- } \
- \
- /* Built-ins based on -mtune=. */ \
- switch (ix86_tune) \
- { \
- case PROCESSOR_I386: \
- builtin_define ("__tune_i386__"); \
- break; \
- case PROCESSOR_I486: \
- builtin_define ("__tune_i486__"); \
- break; \
- case PROCESSOR_PENTIUM: \
- builtin_define ("__tune_i586__"); \
- builtin_define ("__tune_pentium__"); \
- if (last_tune_char == 'x') \
- builtin_define ("__tune_pentium_mmx__"); \
- break; \
- case PROCESSOR_PENTIUMPRO: \
- builtin_define ("__tune_i686__"); \
- builtin_define ("__tune_pentiumpro__"); \
- switch (last_tune_char) \
- { \
- case '3': \
- builtin_define ("__tune_pentium3__"); \
- /* FALLTHRU */ \
- case '2': \
- builtin_define ("__tune_pentium2__"); \
- break; \
- } \
- break; \
- case PROCESSOR_GEODE: \
- builtin_define ("__tune_geode__"); \
- break; \
- case PROCESSOR_K6: \
- builtin_define ("__tune_k6__"); \
- if (last_tune_char == '2') \
- builtin_define ("__tune_k6_2__"); \
- else if (last_tune_char == '3') \
- builtin_define ("__tune_k6_3__"); \
- break; \
- case PROCESSOR_ATHLON: \
- builtin_define ("__tune_athlon__"); \
- /* Only plain "athlon" lacks SSE. */ \
- if (last_tune_char != 'n') \
- builtin_define ("__tune_athlon_sse__"); \
- break; \
- case PROCESSOR_K8: \
- builtin_define ("__tune_k8__"); \
- break; \
- case PROCESSOR_AMDFAM10: \
- builtin_define ("__tune_amdfam10__"); \
- break; \
- case PROCESSOR_PENTIUM4: \
- builtin_define ("__tune_pentium4__"); \
- break; \
- case PROCESSOR_NOCONA: \
- builtin_define ("__tune_nocona__"); \
- break; \
- case PROCESSOR_CORE2: \
- builtin_define ("__tune_core2__"); \
- break; \
- case PROCESSOR_GENERIC32: \
- case PROCESSOR_GENERIC64: \
- break; \
- case PROCESSOR_max: \
- gcc_unreachable (); \
- } \
- \
- if (TARGET_MMX) \
- builtin_define ("__MMX__"); \
- if (TARGET_3DNOW) \
- builtin_define ("__3dNOW__"); \
- if (TARGET_3DNOW_A) \
- builtin_define ("__3dNOW_A__"); \
- if (TARGET_SSE) \
- builtin_define ("__SSE__"); \
- if (TARGET_SSE2) \
- builtin_define ("__SSE2__"); \
- if (TARGET_SSE3) \
- builtin_define ("__SSE3__"); \
- if (TARGET_SSSE3) \
- builtin_define ("__SSSE3__"); \
- if (TARGET_SSE4_1) \
- builtin_define ("__SSE4_1__"); \
- if (TARGET_SSE4_2) \
- builtin_define ("__SSE4_2__"); \
- if (TARGET_AES) \
- builtin_define ("__AES__"); \
- if (TARGET_PCLMUL) \
- builtin_define ("__PCLMUL__"); \
- if (TARGET_SSE4A) \
- builtin_define ("__SSE4A__"); \
- if (TARGET_SSE5) \
- builtin_define ("__SSE5__"); \
- if (TARGET_SSE_MATH && TARGET_SSE) \
- builtin_define ("__SSE_MATH__"); \
- if (TARGET_SSE_MATH && TARGET_SSE2) \
- builtin_define ("__SSE2_MATH__"); \
- } \
- while (0)
+#define TARGET_CPU_CPP_BUILTINS() ix86_target_macros ()
+
+/* Target Pragmas. */
+#define REGISTER_TARGET_PRAGMAS() ix86_register_pragmas ()
enum target_cpu_default
{
@@ -835,16 +652,32 @@ enum target_cpu_default
#define STACK_BOUNDARY (TARGET_64BIT && DEFAULT_ABI == MS_ABI ? 128 \
: BITS_PER_WORD)
+/* Stack boundary of the main function guaranteed by OS. */
+#define MAIN_STACK_BOUNDARY (TARGET_64BIT ? 128 : 32)
+
+/* Minimum stack boundary. */
+#define MIN_STACK_BOUNDARY (TARGET_64BIT ? 128 : 32)
+
/* Boundary (in *bits*) on which the stack pointer prefers to be
aligned; the compiler cannot rely on having this alignment. */
#define PREFERRED_STACK_BOUNDARY ix86_preferred_stack_boundary
-/* As of July 2001, many runtimes do not align the stack properly when
- entering main. This causes expand_main_function to forcibly align
- the stack, which results in aligned frames for functions called from
- main, though it does nothing for the alignment of main itself. */
-#define FORCE_PREFERRED_STACK_BOUNDARY_IN_MAIN \
- (ix86_preferred_stack_boundary > STACK_BOUNDARY && !TARGET_64BIT)
+/* It should be MIN_STACK_BOUNDARY. But we set it to 128 bits for
+ both 32bit and 64bit, to support codes that need 128 bit stack
+ alignment for SSE instructions, but can't realign the stack. */
+#define PREFERRED_STACK_BOUNDARY_DEFAULT 128
+
+/* 1 if -mstackrealign should be turned on by default. It will
+ generate an alternate prologue and epilogue that realigns the
+ runtime stack if nessary. This supports mixing codes that keep a
+ 4-byte aligned stack, as specified by i386 psABI, with codes that
+ need a 16-byte aligned stack, as required by SSE instructions. If
+ STACK_REALIGN_DEFAULT is 1 and PREFERRED_STACK_BOUNDARY_DEFAULT is
+ 128, stacks for all functions may be realigned. */
+#define STACK_REALIGN_DEFAULT 0
+
+/* Boundary (in *bits*) on which the incoming stack is aligned. */
+#define INCOMING_STACK_BOUNDARY ix86_incoming_stack_boundary
/* Target OS keeps a vector-aligned (128-bit, 16-byte) stack. This is
mandatory for the 64-bit ABI, and may or may not be true for other
@@ -871,6 +704,9 @@ enum target_cpu_default
#define BIGGEST_ALIGNMENT 128
+/* Maximum stack alignment. */
+#define MAX_STACK_ALIGNMENT MAX_OFILE_ALIGNMENT
+
/* Decide whether a variable of mode MODE should be 128 bit aligned. */
#define ALIGN_MODE_128(MODE) \
((MODE) == XFmode || SSE_REG_MODE_P (MODE))
@@ -1297,7 +1133,7 @@ do { \
the pic register when possible. The change is visible after the
prologue has been emitted. */
-#define REAL_PIC_OFFSET_TABLE_REGNUM 3
+#define REAL_PIC_OFFSET_TABLE_REGNUM BX_REG
#define PIC_OFFSET_TABLE_REGNUM \
((TARGET_64BIT && ix86_cmodel == CM_SMALL_PIC) \
@@ -1816,12 +1652,9 @@ typedef struct ix86_args {
{ FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}} \
/* Given FROM and TO register numbers, say whether this elimination is
- allowed. Frame pointer elimination is automatically handled.
-
- All other eliminations are valid. */
+ allowed. */
-#define CAN_ELIMINATE(FROM, TO) \
- ((TO) == STACK_POINTER_REGNUM ? !frame_pointer_needed : 1)
+#define CAN_ELIMINATE(FROM, TO) ix86_can_eliminate ((FROM), (TO))
/* Define the offset between two registers, one to be eliminated, and the other
its replacement, at the start of a routine. */
@@ -2390,6 +2223,7 @@ enum asm_dialect {
extern enum asm_dialect ix86_asm_dialect;
extern unsigned int ix86_preferred_stack_boundary;
+extern unsigned int ix86_incoming_stack_boundary;
extern int ix86_branch_cost, ix86_section_threshold;
/* Smallest class containing REGNO. */
@@ -2491,7 +2325,6 @@ struct machine_function GTY(())
{
struct stack_local_entry *stack_locals;
const char *some_ld_name;
- rtx force_align_arg_pointer;
int save_varrargs_registers;
int accesses_prev_frame;
int optimize_mode_switching[MAX_386_ENTITIES];
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index 45e5595fab2..f8d4c7db118 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -245,6 +245,7 @@
[(AX_REG 0)
(DX_REG 1)
(CX_REG 2)
+ (BX_REG 3)
(SI_REG 4)
(DI_REG 5)
(BP_REG 6)
@@ -254,6 +255,7 @@
(FPCR_REG 19)
(R10_REG 39)
(R11_REG 40)
+ (R13_REG 42)
])
;; Insns whose names begin with "x86_" are emitted by gen_FOO calls
@@ -1417,7 +1419,7 @@
[(set (match_operand:SI 0 "register_operand" "=r")
(match_operand:SI 1 "const0_operand" ""))
(clobber (reg:CC FLAGS_REG))]
- "reload_completed && (!TARGET_USE_MOV0 || optimize_size)"
+ "reload_completed"
"xor{l}\t%0, %0"
[(set_attr "type" "alu1")
(set_attr "mode" "SI")
@@ -1428,8 +1430,7 @@
(match_operand:SI 1 "immediate_operand" "i"))
(clobber (reg:CC FLAGS_REG))]
"reload_completed
- && operands[1] == constm1_rtx
- && (TARGET_MOVE_M1_VIA_OR || optimize_size)"
+ && operands[1] == constm1_rtx"
{
operands[1] = constm1_rtx;
return "or{l}\t{%1, %0|%0, %1}";
@@ -1708,8 +1709,7 @@
[(set (strict_low_part (match_operand:HI 0 "register_operand" "+r"))
(match_operand:HI 1 "const0_operand" ""))
(clobber (reg:CC FLAGS_REG))]
- "reload_completed
- && ((!TARGET_USE_MOV0 && !TARGET_PARTIAL_REG_STALL) || optimize_size)"
+ "reload_completed"
"xor{w}\t%0, %0"
[(set_attr "type" "alu1")
(set_attr "mode" "HI")
@@ -1865,7 +1865,7 @@
[(set (strict_low_part (match_operand:QI 0 "q_regs_operand" "+q"))
(match_operand:QI 1 "const0_operand" ""))
(clobber (reg:CC FLAGS_REG))]
- "reload_completed && (!TARGET_USE_MOV0 || optimize_size)"
+ "reload_completed"
"xor{b}\t%0, %0"
[(set_attr "type" "alu1")
(set_attr "mode" "QI")
@@ -2191,7 +2191,7 @@
[(set (match_operand:DI 0 "register_operand" "=r")
(match_operand:DI 1 "const0_operand" ""))
(clobber (reg:CC FLAGS_REG))]
- "TARGET_64BIT && (!TARGET_USE_MOV0 || optimize_size)
+ "TARGET_64BIT
&& reload_completed"
"xor{l}\t%k0, %k0";
[(set_attr "type" "alu1")
@@ -2202,7 +2202,7 @@
[(set (match_operand:DI 0 "register_operand" "=r")
(match_operand:DI 1 "const_int_operand" "i"))
(clobber (reg:CC FLAGS_REG))]
- "TARGET_64BIT && (TARGET_MOVE_M1_VIA_OR || optimize_size)
+ "TARGET_64BIT
&& reload_completed
&& operands[1] == constm1_rtx"
{
@@ -4500,13 +4500,16 @@
(use (match_dup 2))
(clobber (match_scratch:<ssevecmode> 3 ""))
(clobber (match_scratch:<ssevecmode> 4 ""))])]
- "!TARGET_64BIT && TARGET_SSE2 && TARGET_SSE_MATH && !optimize_size"
+ "!TARGET_64BIT && TARGET_SSE2 && TARGET_SSE_MATH"
{
enum machine_mode mode = <MODE>mode;
enum machine_mode vecmode = <ssevecmode>mode;
REAL_VALUE_TYPE TWO31r;
rtx two31;
+ if (optimize_insn_for_size_p ())
+ FAIL;
+
real_ldexp (&TWO31r, &dconst1, 31);
two31 = const_double_from_real_value (TWO31r, mode);
two31 = ix86_build_const_vector (mode, true, two31);
@@ -8213,7 +8216,7 @@
(match_operand:SF 2 "nonimmediate_operand" "")))]
"TARGET_80387 || TARGET_SSE_MATH"
{
- if (TARGET_SSE_MATH && TARGET_RECIP && !optimize_size
+ if (TARGET_SSE_MATH && TARGET_RECIP && optimize_insn_for_speed_p ()
&& flag_finite_math_only && !flag_trapping_math
&& flag_unsafe_math_optimizations)
{
@@ -10917,7 +10920,7 @@
(set_attr "athlon_decode" "vector")
(set_attr "amdfam10_decode" "vector")])
-(define_expand "x86_64_shift_adj"
+(define_expand "x86_64_shift_adj_1"
[(set (reg:CCZ FLAGS_REG)
(compare:CCZ (and:QI (match_operand:QI 2 "register_operand" "")
(const_int 64))
@@ -10933,6 +10936,34 @@
"TARGET_64BIT"
"")
+(define_expand "x86_64_shift_adj_2"
+ [(use (match_operand:DI 0 "register_operand" ""))
+ (use (match_operand:DI 1 "register_operand" ""))
+ (use (match_operand:QI 2 "register_operand" ""))]
+ "TARGET_64BIT"
+{
+ rtx label = gen_label_rtx ();
+ rtx tmp;
+
+ emit_insn (gen_testqi_ccz_1 (operands[2], GEN_INT (64)));
+
+ tmp = gen_rtx_REG (CCZmode, FLAGS_REG);
+ tmp = gen_rtx_EQ (VOIDmode, tmp, const0_rtx);
+ tmp = gen_rtx_IF_THEN_ELSE (VOIDmode, tmp,
+ gen_rtx_LABEL_REF (VOIDmode, label),
+ pc_rtx);
+ tmp = emit_jump_insn (gen_rtx_SET (VOIDmode, pc_rtx, tmp));
+ JUMP_LABEL (tmp) = label;
+
+ emit_move_insn (operands[0], operands[1]);
+ ix86_expand_clear (operands[1]);
+
+ emit_label (label);
+ LABEL_NUSES (label) = 1;
+
+ DONE;
+})
+
(define_expand "ashldi3"
[(set (match_operand:DI 0 "shiftdi_operand" "")
(ashift:DI (match_operand:DI 1 "ashldi_input_operand" "")
@@ -11880,7 +11911,35 @@
""
"ix86_expand_binary_operator (ASHIFTRT, DImode, operands); DONE;")
-(define_insn "*ashrdi3_63_rex64"
+(define_expand "x86_64_shift_adj_3"
+ [(use (match_operand:DI 0 "register_operand" ""))
+ (use (match_operand:DI 1 "register_operand" ""))
+ (use (match_operand:QI 2 "register_operand" ""))]
+ ""
+{
+ rtx label = gen_label_rtx ();
+ rtx tmp;
+
+ emit_insn (gen_testqi_ccz_1 (operands[2], GEN_INT (64)));
+
+ tmp = gen_rtx_REG (CCZmode, FLAGS_REG);
+ tmp = gen_rtx_EQ (VOIDmode, tmp, const0_rtx);
+ tmp = gen_rtx_IF_THEN_ELSE (VOIDmode, tmp,
+ gen_rtx_LABEL_REF (VOIDmode, label),
+ pc_rtx);
+ tmp = emit_jump_insn (gen_rtx_SET (VOIDmode, pc_rtx, tmp));
+ JUMP_LABEL (tmp) = label;
+
+ emit_move_insn (operands[0], operands[1]);
+ emit_insn (gen_ashrdi3_63_rex64 (operands[1], operands[1], GEN_INT (63)));
+
+ emit_label (label);
+ LABEL_NUSES (label) = 1;
+
+ DONE;
+})
+
+(define_insn "ashrdi3_63_rex64"
[(set (match_operand:DI 0 "nonimmediate_operand" "=*d,rm")
(ashiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "*a,0")
(match_operand:DI 2 "const_int_operand" "i,i")))
@@ -16853,10 +16912,13 @@
UNSPEC_FPATAN))
(clobber (match_scratch:XF 6 ""))])]
"TARGET_USE_FANCY_MATH_387
- && flag_unsafe_math_optimizations && !optimize_size"
+ && flag_unsafe_math_optimizations"
{
int i;
+ if (optimize_insn_for_size_p ())
+ FAIL;
+
for (i = 2; i < 6; i++)
operands[i] = gen_reg_rtx (XFmode);
@@ -16869,11 +16931,14 @@
"TARGET_USE_FANCY_MATH_387
&& (!(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)
|| TARGET_MIX_SSE_I387)
- && flag_unsafe_math_optimizations && !optimize_size"
+ && flag_unsafe_math_optimizations"
{
rtx op0 = gen_reg_rtx (XFmode);
rtx op1 = gen_reg_rtx (XFmode);
+ if (optimize_insn_for_size_p ())
+ FAIL;
+
emit_insn (gen_extend<mode>xf2 (op1, operands[1]));
emit_insn (gen_asinxf2 (op0, op1));
emit_insn (gen_truncxf<mode>2_i387_noop (operands[0], op0));
@@ -16891,10 +16956,13 @@
UNSPEC_FPATAN))
(clobber (match_scratch:XF 6 ""))])]
"TARGET_USE_FANCY_MATH_387
- && flag_unsafe_math_optimizations && !optimize_size"
+ && flag_unsafe_math_optimizations"
{
int i;
+ if (optimize_insn_for_size_p ())
+ FAIL;
+
for (i = 2; i < 6; i++)
operands[i] = gen_reg_rtx (XFmode);
@@ -16907,11 +16975,14 @@
"TARGET_USE_FANCY_MATH_387
&& (!(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)
|| TARGET_MIX_SSE_I387)
- && flag_unsafe_math_optimizations && !optimize_size"
+ && flag_unsafe_math_optimizations"
{
rtx op0 = gen_reg_rtx (XFmode);
rtx op1 = gen_reg_rtx (XFmode);
+ if (optimize_insn_for_size_p ())
+ FAIL;
+
emit_insn (gen_extend<mode>xf2 (op1, operands[1]));
emit_insn (gen_acosxf2 (op0, op1));
emit_insn (gen_truncxf<mode>2_i387_noop (operands[0], op0));
@@ -17066,8 +17137,11 @@
[(use (match_operand:XF 0 "register_operand" ""))
(use (match_operand:XF 1 "register_operand" ""))]
"TARGET_USE_FANCY_MATH_387
- && flag_unsafe_math_optimizations && !optimize_size"
+ && flag_unsafe_math_optimizations"
{
+ if (optimize_insn_for_size_p ())
+ FAIL;
+
ix86_emit_i387_log1p (operands[0], operands[1]);
DONE;
})
@@ -17078,9 +17152,14 @@
"TARGET_USE_FANCY_MATH_387
&& (!(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)
|| TARGET_MIX_SSE_I387)
- && flag_unsafe_math_optimizations && !optimize_size"
+ && flag_unsafe_math_optimizations"
{
- rtx op0 = gen_reg_rtx (XFmode);
+ rtx op0;
+
+ if (optimize_insn_for_size_p ())
+ FAIL;
+
+ op0 = gen_reg_rtx (XFmode);
operands[1] = gen_rtx_FLOAT_EXTEND (XFmode, operands[1]);
@@ -17148,10 +17227,15 @@
[(use (match_operand:SI 0 "register_operand" ""))
(use (match_operand:XF 1 "register_operand" ""))]
"TARGET_USE_FANCY_MATH_387
- && flag_unsafe_math_optimizations && !optimize_size"
+ && flag_unsafe_math_optimizations"
{
- rtx op0 = gen_reg_rtx (XFmode);
- rtx op1 = gen_reg_rtx (XFmode);
+ rtx op0, op1;
+
+ if (optimize_insn_for_size_p ())
+ FAIL;
+
+ op0 = gen_reg_rtx (XFmode);
+ op1 = gen_reg_rtx (XFmode);
emit_insn (gen_fxtractxf3_i387 (op0, op1, operands[1]));
emit_insn (gen_fix_truncxfsi2 (operands[0], op1));
@@ -17164,10 +17248,15 @@
"TARGET_USE_FANCY_MATH_387
&& (!(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)
|| TARGET_MIX_SSE_I387)
- && flag_unsafe_math_optimizations && !optimize_size"
+ && flag_unsafe_math_optimizations"
{
- rtx op0 = gen_reg_rtx (XFmode);
- rtx op1 = gen_reg_rtx (XFmode);
+ rtx op0, op1;
+
+ if (optimize_insn_for_size_p ())
+ FAIL;
+
+ op0 = gen_reg_rtx (XFmode);
+ op1 = gen_reg_rtx (XFmode);
emit_insn (gen_fxtract_extend<mode>xf3_i387 (op0, op1, operands[1]));
emit_insn (gen_fix_truncxfsi2 (operands[0], op1));
@@ -17212,10 +17301,13 @@
(unspec:XF [(match_dup 8) (match_dup 4)]
UNSPEC_FSCALE_EXP))])]
"TARGET_USE_FANCY_MATH_387
- && flag_unsafe_math_optimizations && !optimize_size"
+ && flag_unsafe_math_optimizations"
{
int i;
+ if (optimize_insn_for_size_p ())
+ FAIL;
+
for (i = 3; i < 10; i++)
operands[i] = gen_reg_rtx (XFmode);
@@ -17226,9 +17318,14 @@
[(use (match_operand:XF 0 "register_operand" ""))
(use (match_operand:XF 1 "register_operand" ""))]
"TARGET_USE_FANCY_MATH_387
- && flag_unsafe_math_optimizations && !optimize_size"
+ && flag_unsafe_math_optimizations"
{
- rtx op2 = gen_reg_rtx (XFmode);
+ rtx op2;
+
+ if (optimize_insn_for_size_p ())
+ FAIL;
+
+ op2 = gen_reg_rtx (XFmode);
emit_move_insn (op2, standard_80387_constant_rtx (5)); /* fldl2e */
emit_insn (gen_expNcorexf3 (operands[0], operands[1], op2));
@@ -17241,10 +17338,15 @@
"TARGET_USE_FANCY_MATH_387
&& (!(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)
|| TARGET_MIX_SSE_I387)
- && flag_unsafe_math_optimizations && !optimize_size"
+ && flag_unsafe_math_optimizations"
{
- rtx op0 = gen_reg_rtx (XFmode);
- rtx op1 = gen_reg_rtx (XFmode);
+ rtx op0, op1;
+
+ if (optimize_insn_for_size_p ())
+ FAIL;
+
+ op0 = gen_reg_rtx (XFmode);
+ op1 = gen_reg_rtx (XFmode);
emit_insn (gen_extend<mode>xf2 (op1, operands[1]));
emit_insn (gen_expxf2 (op0, op1));
@@ -17256,9 +17358,14 @@
[(use (match_operand:XF 0 "register_operand" ""))
(use (match_operand:XF 1 "register_operand" ""))]
"TARGET_USE_FANCY_MATH_387
- && flag_unsafe_math_optimizations && !optimize_size"
+ && flag_unsafe_math_optimizations"
{
- rtx op2 = gen_reg_rtx (XFmode);
+ rtx op2;
+
+ if (optimize_insn_for_size_p ())
+ FAIL;
+
+ op2 = gen_reg_rtx (XFmode);
emit_move_insn (op2, standard_80387_constant_rtx (6)); /* fldl2t */
emit_insn (gen_expNcorexf3 (operands[0], operands[1], op2));
@@ -17271,10 +17378,15 @@
"TARGET_USE_FANCY_MATH_387
&& (!(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)
|| TARGET_MIX_SSE_I387)
- && flag_unsafe_math_optimizations && !optimize_size"
+ && flag_unsafe_math_optimizations"
{
- rtx op0 = gen_reg_rtx (XFmode);
- rtx op1 = gen_reg_rtx (XFmode);
+ rtx op0, op1;
+
+ if (optimize_insn_for_size_p ())
+ FAIL;
+
+ op0 = gen_reg_rtx (XFmode);
+ op1 = gen_reg_rtx (XFmode);
emit_insn (gen_extend<mode>xf2 (op1, operands[1]));
emit_insn (gen_exp10xf2 (op0, op1));
@@ -17286,9 +17398,14 @@
[(use (match_operand:XF 0 "register_operand" ""))
(use (match_operand:XF 1 "register_operand" ""))]
"TARGET_USE_FANCY_MATH_387
- && flag_unsafe_math_optimizations && !optimize_size"
+ && flag_unsafe_math_optimizations"
{
- rtx op2 = gen_reg_rtx (XFmode);
+ rtx op2;
+
+ if (optimize_insn_for_size_p ())
+ FAIL;
+
+ op2 = gen_reg_rtx (XFmode);
emit_move_insn (op2, CONST1_RTX (XFmode)); /* fld1 */
emit_insn (gen_expNcorexf3 (operands[0], operands[1], op2));
@@ -17301,10 +17418,15 @@
"TARGET_USE_FANCY_MATH_387
&& (!(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)
|| TARGET_MIX_SSE_I387)
- && flag_unsafe_math_optimizations && !optimize_size"
+ && flag_unsafe_math_optimizations"
{
- rtx op0 = gen_reg_rtx (XFmode);
- rtx op1 = gen_reg_rtx (XFmode);
+ rtx op0, op1;
+
+ if (optimize_insn_for_size_p ())
+ FAIL;
+
+ op0 = gen_reg_rtx (XFmode);
+ op1 = gen_reg_rtx (XFmode);
emit_insn (gen_extend<mode>xf2 (op1, operands[1]));
emit_insn (gen_exp2xf2 (op0, op1));
@@ -17336,10 +17458,13 @@
(set (match_operand:XF 0 "register_operand" "")
(plus:XF (match_dup 12) (match_dup 7)))]
"TARGET_USE_FANCY_MATH_387
- && flag_unsafe_math_optimizations && !optimize_size"
+ && flag_unsafe_math_optimizations"
{
int i;
+ if (optimize_insn_for_size_p ())
+ FAIL;
+
for (i = 2; i < 13; i++)
operands[i] = gen_reg_rtx (XFmode);
@@ -17355,10 +17480,15 @@
"TARGET_USE_FANCY_MATH_387
&& (!(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)
|| TARGET_MIX_SSE_I387)
- && flag_unsafe_math_optimizations && !optimize_size"
+ && flag_unsafe_math_optimizations"
{
- rtx op0 = gen_reg_rtx (XFmode);
- rtx op1 = gen_reg_rtx (XFmode);
+ rtx op0, op1;
+
+ if (optimize_insn_for_size_p ())
+ FAIL;
+
+ op0 = gen_reg_rtx (XFmode);
+ op1 = gen_reg_rtx (XFmode);
emit_insn (gen_extend<mode>xf2 (op1, operands[1]));
emit_insn (gen_expm1xf2 (op0, op1));
@@ -17377,8 +17507,11 @@
(unspec:XF [(match_dup 1) (match_dup 3)]
UNSPEC_FSCALE_EXP))])]
"TARGET_USE_FANCY_MATH_387
- && flag_unsafe_math_optimizations && !optimize_size"
+ && flag_unsafe_math_optimizations"
{
+ if (optimize_insn_for_size_p ())
+ FAIL;
+
operands[3] = gen_reg_rtx (XFmode);
operands[4] = gen_reg_rtx (XFmode);
})
@@ -17390,10 +17523,15 @@
"TARGET_USE_FANCY_MATH_387
&& (!(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)
|| TARGET_MIX_SSE_I387)
- && flag_unsafe_math_optimizations && !optimize_size"
+ && flag_unsafe_math_optimizations"
{
- rtx op0 = gen_reg_rtx (XFmode);
- rtx op1 = gen_reg_rtx (XFmode);
+ rtx op0, op1;
+
+ if (optimize_insn_for_size_p ())
+ FAIL;
+
+ op0 = gen_reg_rtx (XFmode);
+ op1 = gen_reg_rtx (XFmode);
emit_insn (gen_extend<mode>xf2 (op1, operands[1]));
emit_insn (gen_ldexpxf3 (op0, op1, operands[2]));
@@ -17410,8 +17548,11 @@
(unspec:XF [(match_dup 1) (match_dup 2)]
UNSPEC_FSCALE_EXP))])]
"TARGET_USE_FANCY_MATH_387
- && flag_unsafe_math_optimizations && !optimize_size"
+ && flag_unsafe_math_optimizations"
{
+ if (optimize_insn_for_size_p ())
+ FAIL;
+
operands[3] = gen_reg_rtx (XFmode);
})
@@ -17422,11 +17563,16 @@
"TARGET_USE_FANCY_MATH_387
&& (!(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)
|| TARGET_MIX_SSE_I387)
- && flag_unsafe_math_optimizations && !optimize_size"
+ && flag_unsafe_math_optimizations"
{
- rtx op0 = gen_reg_rtx (XFmode);
- rtx op1 = gen_reg_rtx (XFmode);
- rtx op2 = gen_reg_rtx (XFmode);
+ rtx op0, op1, op2;
+
+ if (optimize_insn_for_size_p ())
+ FAIL;
+
+ op0 = gen_reg_rtx (XFmode);
+ op1 = gen_reg_rtx (XFmode);
+ op2 = gen_reg_rtx (XFmode);
emit_insn (gen_extend<mode>xf2 (op1, operands[1]));
emit_insn (gen_extend<mode>xf2 (op2, operands[2]));
@@ -17465,13 +17611,13 @@
|| TARGET_MIX_SSE_I387)
&& flag_unsafe_math_optimizations)
|| (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH
- && !flag_trapping_math
- && (TARGET_ROUND || !optimize_size))"
+ && !flag_trapping_math)"
{
if (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH
- && !flag_trapping_math
- && (TARGET_ROUND || !optimize_size))
+ && !flag_trapping_math)
{
+ if (!TARGET_ROUND && optimize_insn_for_size_p ())
+ FAIL;
if (TARGET_ROUND)
emit_insn (gen_sse4_1_round<mode>2
(operands[0], operands[1], GEN_INT (0x04)));
@@ -17495,9 +17641,10 @@
[(match_operand:MODEF 0 "register_operand" "")
(match_operand:MODEF 1 "nonimmediate_operand" "")]
"SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH
- && !flag_trapping_math && !flag_rounding_math
- && !optimize_size"
+ && !flag_trapping_math && !flag_rounding_math"
{
+ if (optimize_insn_for_size_p ())
+ FAIL;
if (TARGET_64BIT || (<MODE>mode != DFmode))
ix86_expand_round (operand0, operand1);
else
@@ -17648,9 +17795,10 @@
(match_operand:MODEF 1 "register_operand" "")]
"SSE_FLOAT_MODE_P (<MODEF:MODE>mode) && TARGET_SSE_MATH
&& ((<SSEMODEI24:MODE>mode != DImode) || TARGET_64BIT)
- && !flag_trapping_math && !flag_rounding_math
- && !optimize_size"
+ && !flag_trapping_math && !flag_rounding_math"
{
+ if (optimize_insn_for_size_p ())
+ FAIL;
ix86_expand_lround (operand0, operand1);
DONE;
})
@@ -17698,8 +17846,10 @@
[(use (match_operand:XF 0 "register_operand" ""))
(use (match_operand:XF 1 "register_operand" ""))]
"TARGET_USE_FANCY_MATH_387
- && flag_unsafe_math_optimizations && !optimize_size"
+ && flag_unsafe_math_optimizations"
{
+ if (optimize_insn_for_size_p ())
+ FAIL;
emit_insn (gen_frndintxf2_floor (operands[0], operands[1]));
DONE;
})
@@ -17710,15 +17860,16 @@
"(TARGET_USE_FANCY_MATH_387
&& (!(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)
|| TARGET_MIX_SSE_I387)
- && flag_unsafe_math_optimizations && !optimize_size)
+ && flag_unsafe_math_optimizations)
|| (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH
- && !flag_trapping_math
- && (TARGET_ROUND || !optimize_size))"
+ && !flag_trapping_math)"
{
if (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH
&& !flag_trapping_math
- && (TARGET_ROUND || !optimize_size))
+ && (TARGET_ROUND || optimize_insn_for_speed_p ()))
{
+ if (!TARGET_ROUND && optimize_insn_for_size_p ())
+ FAIL;
if (TARGET_ROUND)
emit_insn (gen_sse4_1_round<mode>2
(operands[0], operands[1], GEN_INT (0x01)));
@@ -17729,9 +17880,13 @@
}
else
{
- rtx op0 = gen_reg_rtx (XFmode);
- rtx op1 = gen_reg_rtx (XFmode);
+ rtx op0, op1;
+ if (optimize_insn_for_size_p ())
+ FAIL;
+
+ op0 = gen_reg_rtx (XFmode);
+ op1 = gen_reg_rtx (XFmode);
emit_insn (gen_extend<mode>xf2 (op1, operands[1]));
emit_insn (gen_frndintxf2_floor (op0, op1));
@@ -17902,9 +18057,10 @@
[(match_operand:DI 0 "nonimmediate_operand" "")
(match_operand:MODEF 1 "register_operand" "")]
"SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH && TARGET_64BIT
- && !flag_trapping_math
- && !optimize_size"
+ && !flag_trapping_math"
{
+ if (optimize_insn_for_size_p ())
+ FAIL;
ix86_expand_lfloorceil (operand0, operand1, true);
DONE;
})
@@ -17913,9 +18069,10 @@
[(match_operand:SI 0 "nonimmediate_operand" "")
(match_operand:MODEF 1 "register_operand" "")]
"SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH
- && !flag_trapping_math
- && (!optimize_size || !TARGET_64BIT)"
+ && !flag_trapping_math"
{
+ if (optimize_insn_for_size_p () && TARGET_64BIT)
+ FAIL;
ix86_expand_lfloorceil (operand0, operand1, true);
DONE;
})
@@ -17963,8 +18120,10 @@
[(use (match_operand:XF 0 "register_operand" ""))
(use (match_operand:XF 1 "register_operand" ""))]
"TARGET_USE_FANCY_MATH_387
- && flag_unsafe_math_optimizations && !optimize_size"
+ && flag_unsafe_math_optimizations"
{
+ if (optimize_insn_for_size_p ())
+ FAIL;
emit_insn (gen_frndintxf2_ceil (operands[0], operands[1]));
DONE;
})
@@ -17975,18 +18134,19 @@
"(TARGET_USE_FANCY_MATH_387
&& (!(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)
|| TARGET_MIX_SSE_I387)
- && flag_unsafe_math_optimizations && !optimize_size)
+ && flag_unsafe_math_optimizations)
|| (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH
- && !flag_trapping_math
- && (TARGET_ROUND || !optimize_size))"
+ && !flag_trapping_math)"
{
if (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH
&& !flag_trapping_math
- && (TARGET_ROUND || !optimize_size))
+ && (TARGET_ROUND || optimize_insn_for_speed_p ()))
{
if (TARGET_ROUND)
emit_insn (gen_sse4_1_round<mode>2
(operands[0], operands[1], GEN_INT (0x02)));
+ else if (optimize_insn_for_size_p ())
+ FAIL;
else if (TARGET_64BIT || (<MODE>mode != DFmode))
ix86_expand_floorceil (operand0, operand1, false);
else
@@ -17994,9 +18154,13 @@
}
else
{
- rtx op0 = gen_reg_rtx (XFmode);
- rtx op1 = gen_reg_rtx (XFmode);
+ rtx op0, op1;
+
+ if (optimize_insn_for_size_p ())
+ FAIL;
+ op0 = gen_reg_rtx (XFmode);
+ op1 = gen_reg_rtx (XFmode);
emit_insn (gen_extend<mode>xf2 (op1, operands[1]));
emit_insn (gen_frndintxf2_ceil (op0, op1));
@@ -18226,8 +18390,10 @@
[(use (match_operand:XF 0 "register_operand" ""))
(use (match_operand:XF 1 "register_operand" ""))]
"TARGET_USE_FANCY_MATH_387
- && flag_unsafe_math_optimizations && !optimize_size"
+ && flag_unsafe_math_optimizations"
{
+ if (optimize_insn_for_size_p ())
+ FAIL;
emit_insn (gen_frndintxf2_trunc (operands[0], operands[1]));
DONE;
})
@@ -18238,18 +18404,19 @@
"(TARGET_USE_FANCY_MATH_387
&& (!(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)
|| TARGET_MIX_SSE_I387)
- && flag_unsafe_math_optimizations && !optimize_size)
+ && flag_unsafe_math_optimizations)
|| (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH
- && !flag_trapping_math
- && (TARGET_ROUND || !optimize_size))"
+ && !flag_trapping_math)"
{
if (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH
&& !flag_trapping_math
- && (TARGET_ROUND || !optimize_size))
+ && (TARGET_ROUND || optimize_insn_for_speed_p ()))
{
if (TARGET_ROUND)
emit_insn (gen_sse4_1_round<mode>2
(operands[0], operands[1], GEN_INT (0x03)));
+ else if (optimize_insn_for_size_p ())
+ FAIL;
else if (TARGET_64BIT || (<MODE>mode != DFmode))
ix86_expand_trunc (operand0, operand1);
else
@@ -18257,9 +18424,13 @@
}
else
{
- rtx op0 = gen_reg_rtx (XFmode);
- rtx op1 = gen_reg_rtx (XFmode);
+ rtx op0, op1;
+ if (optimize_insn_for_size_p ())
+ FAIL;
+
+ op0 = gen_reg_rtx (XFmode);
+ op1 = gen_reg_rtx (XFmode);
emit_insn (gen_extend<mode>xf2 (op1, operands[1]));
emit_insn (gen_frndintxf2_trunc (op0, op1));
@@ -18450,7 +18621,7 @@
operands[6] = gen_rtx_PLUS (Pmode, operands[2], adjust);
/* Can't use this if the user has appropriated esi or edi. */
- if ((TARGET_SINGLE_STRINGOP || optimize_size)
+ if ((TARGET_SINGLE_STRINGOP || optimize_insn_for_size_p ())
&& !(fixed_regs[SI_REG] || fixed_regs[DI_REG]))
{
emit_insn (gen_strmov_singleop (operands[0], operands[1],
@@ -18469,7 +18640,7 @@
(match_operand 4 "" ""))
(set (match_operand 2 "register_operand" "")
(match_operand 5 "" ""))])]
- "TARGET_SINGLE_STRINGOP || optimize_size"
+ ""
"ix86_current_function_needs_cld = 1;")
(define_insn "*strmovdi_rex_1"
@@ -18481,7 +18652,7 @@
(set (match_operand:DI 1 "register_operand" "=S")
(plus:DI (match_dup 3)
(const_int 8)))]
- "TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
+ "TARGET_64BIT"
"movsq"
[(set_attr "type" "str")
(set_attr "mode" "DI")
@@ -18496,7 +18667,7 @@
(set (match_operand:SI 1 "register_operand" "=S")
(plus:SI (match_dup 3)
(const_int 4)))]
- "!TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
+ "!TARGET_64BIT"
"movs{l|d}"
[(set_attr "type" "str")
(set_attr "mode" "SI")
@@ -18511,7 +18682,7 @@
(set (match_operand:DI 1 "register_operand" "=S")
(plus:DI (match_dup 3)
(const_int 4)))]
- "TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
+ "TARGET_64BIT"
"movs{l|d}"
[(set_attr "type" "str")
(set_attr "mode" "SI")
@@ -18526,7 +18697,7 @@
(set (match_operand:SI 1 "register_operand" "=S")
(plus:SI (match_dup 3)
(const_int 2)))]
- "!TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
+ "!TARGET_64BIT"
"movsw"
[(set_attr "type" "str")
(set_attr "memory" "both")
@@ -18541,7 +18712,7 @@
(set (match_operand:DI 1 "register_operand" "=S")
(plus:DI (match_dup 3)
(const_int 2)))]
- "TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
+ "TARGET_64BIT"
"movsw"
[(set_attr "type" "str")
(set_attr "memory" "both")
@@ -18556,7 +18727,7 @@
(set (match_operand:SI 1 "register_operand" "=S")
(plus:SI (match_dup 3)
(const_int 1)))]
- "!TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
+ "!TARGET_64BIT"
"movsb"
[(set_attr "type" "str")
(set_attr "memory" "both")
@@ -18571,7 +18742,7 @@
(set (match_operand:DI 1 "register_operand" "=S")
(plus:DI (match_dup 3)
(const_int 1)))]
- "TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
+ "TARGET_64BIT"
"movsb"
[(set_attr "type" "str")
(set_attr "memory" "both")
@@ -18733,7 +18904,7 @@
operands[3] = gen_rtx_PLUS (Pmode, operands[0],
GEN_INT (GET_MODE_SIZE (GET_MODE
(operands[2]))));
- if (TARGET_SINGLE_STRINGOP || optimize_size)
+ if (TARGET_SINGLE_STRINGOP || optimize_insn_for_size_p ())
{
emit_insn (gen_strset_singleop (operands[0], operands[1], operands[2],
operands[3]));
@@ -18746,7 +18917,7 @@
(match_operand 2 "register_operand" ""))
(set (match_operand 0 "register_operand" "")
(match_operand 3 "" ""))])]
- "TARGET_SINGLE_STRINGOP || optimize_size"
+ ""
"ix86_current_function_needs_cld = 1;")
(define_insn "*strsetdi_rex_1"
@@ -18755,7 +18926,7 @@
(set (match_operand:DI 0 "register_operand" "=D")
(plus:DI (match_dup 1)
(const_int 8)))]
- "TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
+ "TARGET_64BIT"
"stosq"
[(set_attr "type" "str")
(set_attr "memory" "store")
@@ -18767,7 +18938,7 @@
(set (match_operand:SI 0 "register_operand" "=D")
(plus:SI (match_dup 1)
(const_int 4)))]
- "!TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
+ "!TARGET_64BIT"
"stos{l|d}"
[(set_attr "type" "str")
(set_attr "memory" "store")
@@ -18779,7 +18950,7 @@
(set (match_operand:DI 0 "register_operand" "=D")
(plus:DI (match_dup 1)
(const_int 4)))]
- "TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
+ "TARGET_64BIT"
"stos{l|d}"
[(set_attr "type" "str")
(set_attr "memory" "store")
@@ -18791,7 +18962,7 @@
(set (match_operand:SI 0 "register_operand" "=D")
(plus:SI (match_dup 1)
(const_int 2)))]
- "!TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
+ "!TARGET_64BIT"
"stosw"
[(set_attr "type" "str")
(set_attr "memory" "store")
@@ -18803,7 +18974,7 @@
(set (match_operand:DI 0 "register_operand" "=D")
(plus:DI (match_dup 1)
(const_int 2)))]
- "TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
+ "TARGET_64BIT"
"stosw"
[(set_attr "type" "str")
(set_attr "memory" "store")
@@ -18815,7 +18986,7 @@
(set (match_operand:SI 0 "register_operand" "=D")
(plus:SI (match_dup 1)
(const_int 1)))]
- "!TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
+ "!TARGET_64BIT"
"stosb"
[(set_attr "type" "str")
(set_attr "memory" "store")
@@ -18827,7 +18998,7 @@
(set (match_operand:DI 0 "register_operand" "=D")
(plus:DI (match_dup 1)
(const_int 1)))]
- "TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
+ "TARGET_64BIT"
"stosb"
[(set_attr "type" "str")
(set_attr "memory" "store")
@@ -18932,10 +19103,13 @@
(match_operand:BLK 2 "general_operand" "")))
(use (match_operand 3 "general_operand" ""))
(use (match_operand 4 "immediate_operand" ""))]
- "! optimize_size || TARGET_INLINE_ALL_STRINGOPS"
+ ""
{
rtx addr1, addr2, out, outlow, count, countreg, align;
+ if (optimize_insn_for_size_p () && !TARGET_INLINE_ALL_STRINGOPS)
+ FAIL;
+
/* Can't use this if the user has appropriated esi or edi. */
if (fixed_regs[SI_REG] || fixed_regs[DI_REG])
FAIL;
@@ -19856,7 +20030,7 @@
(const_int 0)]))]
"! TARGET_PARTIAL_REG_STALL && reload_completed
&& ! TARGET_FAST_PREFIX
- && ! optimize_size
+ && optimize_insn_for_speed_p ()
/* Ensure that the operand will remain sign-extended immediate. */
&& ix86_match_ccmode (insn, INTVAL (operands[3]) >= 0 ? CCNOmode : CCZmode)"
[(set (match_dup 0)
@@ -19876,7 +20050,8 @@
"! TARGET_PARTIAL_REG_STALL && reload_completed
&& (GET_MODE (operands[0]) == HImode
|| (GET_MODE (operands[0]) == QImode
- && (TARGET_PROMOTE_QImode || optimize_size)))"
+ && (TARGET_PROMOTE_QImode
+ || optimize_insn_for_size_p ())))"
[(parallel [(set (match_dup 0)
(neg:SI (match_dup 1)))
(clobber (reg:CC FLAGS_REG))])]
@@ -19889,7 +20064,8 @@
"! TARGET_PARTIAL_REG_STALL && reload_completed
&& (GET_MODE (operands[0]) == HImode
|| (GET_MODE (operands[0]) == QImode
- && (TARGET_PROMOTE_QImode || optimize_size)))"
+ && (TARGET_PROMOTE_QImode
+ || optimize_insn_for_size_p ())))"
[(set (match_dup 0)
(not:SI (match_dup 1)))]
"operands[0] = gen_lowpart (SImode, operands[0]);
@@ -19904,7 +20080,8 @@
"! TARGET_PARTIAL_REG_STALL && TARGET_CMOVE
&& (GET_MODE (operands[0]) == HImode
|| (GET_MODE (operands[0]) == QImode
- && (TARGET_PROMOTE_QImode || optimize_size)))"
+ && (TARGET_PROMOTE_QImode
+ || optimize_insn_for_size_p ())))"
[(set (match_dup 0)
(if_then_else:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
"operands[0] = gen_lowpart (SImode, operands[0]);
@@ -19920,7 +20097,7 @@
[(set (match_operand:SI 0 "push_operand" "")
(match_operand:SI 1 "memory_operand" ""))
(match_scratch:SI 2 "r")]
- "!optimize_size && !TARGET_PUSH_MEMORY
+ "optimize_insn_for_speed_p () && !TARGET_PUSH_MEMORY
&& !RTX_FRAME_RELATED_P (peep2_next_insn (0))"
[(set (match_dup 2) (match_dup 1))
(set (match_dup 0) (match_dup 2))]
@@ -19930,7 +20107,7 @@
[(set (match_operand:DI 0 "push_operand" "")
(match_operand:DI 1 "memory_operand" ""))
(match_scratch:DI 2 "r")]
- "!optimize_size && !TARGET_PUSH_MEMORY
+ "optimize_insn_for_speed_p () && !TARGET_PUSH_MEMORY
&& !RTX_FRAME_RELATED_P (peep2_next_insn (0))"
[(set (match_dup 2) (match_dup 1))
(set (match_dup 0) (match_dup 2))]
@@ -19942,7 +20119,7 @@
[(set (match_operand:SF 0 "push_operand" "")
(match_operand:SF 1 "memory_operand" ""))
(match_scratch:SF 2 "r")]
- "!optimize_size && !TARGET_PUSH_MEMORY
+ "optimize_insn_for_speed_p () && !TARGET_PUSH_MEMORY
&& !RTX_FRAME_RELATED_P (peep2_next_insn (0))"
[(set (match_dup 2) (match_dup 1))
(set (match_dup 0) (match_dup 2))]
@@ -19952,7 +20129,7 @@
[(set (match_operand:HI 0 "push_operand" "")
(match_operand:HI 1 "memory_operand" ""))
(match_scratch:HI 2 "r")]
- "!optimize_size && !TARGET_PUSH_MEMORY
+ "optimize_insn_for_speed_p () && !TARGET_PUSH_MEMORY
&& !RTX_FRAME_RELATED_P (peep2_next_insn (0))"
[(set (match_dup 2) (match_dup 1))
(set (match_dup 0) (match_dup 2))]
@@ -19962,7 +20139,7 @@
[(set (match_operand:QI 0 "push_operand" "")
(match_operand:QI 1 "memory_operand" ""))
(match_scratch:QI 2 "q")]
- "!optimize_size && !TARGET_PUSH_MEMORY
+ "optimize_insn_for_speed_p () && !TARGET_PUSH_MEMORY
&& !RTX_FRAME_RELATED_P (peep2_next_insn (0))"
[(set (match_dup 2) (match_dup 1))
(set (match_dup 0) (match_dup 2))]
@@ -19974,10 +20151,10 @@
[(match_scratch:SI 1 "r")
(set (match_operand:SI 0 "memory_operand" "")
(const_int 0))]
- "! optimize_size
+ "optimize_insn_for_speed_p ()
&& ! TARGET_USE_MOV0
&& TARGET_SPLIT_LONG_MOVES
- && get_attr_length (insn) >= ix86_cost->large_insn
+ && get_attr_length (insn) >= ix86_cur_cost ()->large_insn
&& peep2_regno_dead_p (0, FLAGS_REG)"
[(parallel [(set (match_dup 1) (const_int 0))
(clobber (reg:CC FLAGS_REG))])
@@ -19988,10 +20165,10 @@
[(match_scratch:HI 1 "r")
(set (match_operand:HI 0 "memory_operand" "")
(const_int 0))]
- "! optimize_size
+ "optimize_insn_for_speed_p ()
&& ! TARGET_USE_MOV0
&& TARGET_SPLIT_LONG_MOVES
- && get_attr_length (insn) >= ix86_cost->large_insn
+ && get_attr_length (insn) >= ix86_cur_cost ()->large_insn
&& peep2_regno_dead_p (0, FLAGS_REG)"
[(parallel [(set (match_dup 2) (const_int 0))
(clobber (reg:CC FLAGS_REG))])
@@ -20002,10 +20179,10 @@
[(match_scratch:QI 1 "q")
(set (match_operand:QI 0 "memory_operand" "")
(const_int 0))]
- "! optimize_size
+ "optimize_insn_for_speed_p ()
&& ! TARGET_USE_MOV0
&& TARGET_SPLIT_LONG_MOVES
- && get_attr_length (insn) >= ix86_cost->large_insn
+ && get_attr_length (insn) >= ix86_cur_cost ()->large_insn
&& peep2_regno_dead_p (0, FLAGS_REG)"
[(parallel [(set (match_dup 2) (const_int 0))
(clobber (reg:CC FLAGS_REG))])
@@ -20016,9 +20193,9 @@
[(match_scratch:SI 2 "r")
(set (match_operand:SI 0 "memory_operand" "")
(match_operand:SI 1 "immediate_operand" ""))]
- "! optimize_size
+ "optimize_insn_for_speed_p ()
&& TARGET_SPLIT_LONG_MOVES
- && get_attr_length (insn) >= ix86_cost->large_insn"
+ && get_attr_length (insn) >= ix86_cur_cost ()->large_insn"
[(set (match_dup 2) (match_dup 1))
(set (match_dup 0) (match_dup 2))]
"")
@@ -20027,9 +20204,9 @@
[(match_scratch:HI 2 "r")
(set (match_operand:HI 0 "memory_operand" "")
(match_operand:HI 1 "immediate_operand" ""))]
- "! optimize_size
+ "optimize_insn_for_speed_p ()
&& TARGET_SPLIT_LONG_MOVES
- && get_attr_length (insn) >= ix86_cost->large_insn"
+ && get_attr_length (insn) >= ix86_cur_cost ()->large_insn"
[(set (match_dup 2) (match_dup 1))
(set (match_dup 0) (match_dup 2))]
"")
@@ -20038,9 +20215,9 @@
[(match_scratch:QI 2 "q")
(set (match_operand:QI 0 "memory_operand" "")
(match_operand:QI 1 "immediate_operand" ""))]
- "! optimize_size
+ "optimize_insn_for_speed_p ()
&& TARGET_SPLIT_LONG_MOVES
- && get_attr_length (insn) >= ix86_cost->large_insn"
+ && get_attr_length (insn) >= ix86_cur_cost ()->large_insn"
[(set (match_dup 2) (match_dup 1))
(set (match_dup 0) (match_dup 2))]
"")
@@ -20052,7 +20229,7 @@
[(match_operand:SI 2 "memory_operand" "")
(const_int 0)]))
(match_scratch:SI 3 "r")]
- " ! optimize_size && ix86_match_ccmode (insn, CCNOmode)"
+ "optimize_insn_for_speed_p () && ix86_match_ccmode (insn, CCNOmode)"
[(set (match_dup 3) (match_dup 2))
(set (match_dup 0) (match_op_dup 1 [(match_dup 3) (const_int 0)]))]
"")
@@ -20071,7 +20248,7 @@
(define_peephole2
[(set (match_operand:SI 0 "nonimmediate_operand" "")
(not:SI (match_operand:SI 1 "nonimmediate_operand" "")))]
- "!optimize_size
+ "optimize_insn_for_speed_p ()
&& ((TARGET_NOT_UNPAIRABLE
&& (!MEM_P (operands[0])
|| !memory_displacement_operand (operands[0], SImode)))
@@ -20085,7 +20262,7 @@
(define_peephole2
[(set (match_operand:HI 0 "nonimmediate_operand" "")
(not:HI (match_operand:HI 1 "nonimmediate_operand" "")))]
- "!optimize_size
+ "optimize_insn_for_speed_p ()
&& ((TARGET_NOT_UNPAIRABLE
&& (!MEM_P (operands[0])
|| !memory_displacement_operand (operands[0], HImode)))
@@ -20099,7 +20276,7 @@
(define_peephole2
[(set (match_operand:QI 0 "nonimmediate_operand" "")
(not:QI (match_operand:QI 1 "nonimmediate_operand" "")))]
- "!optimize_size
+ "optimize_insn_for_speed_p ()
&& ((TARGET_NOT_UNPAIRABLE
&& (!MEM_P (operands[0])
|| !memory_displacement_operand (operands[0], QImode)))
@@ -20198,7 +20375,7 @@
[(match_dup 0)
(match_operand:SI 1 "memory_operand" "")]))
(clobber (reg:CC FLAGS_REG))])]
- "! optimize_size && ! TARGET_READ_MODIFY"
+ "optimize_insn_for_speed_p ()"
[(set (match_dup 2) (match_dup 1))
(parallel [(set (match_dup 0)
(match_op_dup 3 [(match_dup 0) (match_dup 2)]))
@@ -20212,7 +20389,7 @@
[(match_operand:SI 1 "memory_operand" "")
(match_dup 0)]))
(clobber (reg:CC FLAGS_REG))])]
- "! optimize_size && ! TARGET_READ_MODIFY"
+ "optimize_insn_for_speed_p () && ! TARGET_READ_MODIFY"
[(set (match_dup 2) (match_dup 1))
(parallel [(set (match_dup 0)
(match_op_dup 3 [(match_dup 2) (match_dup 0)]))
@@ -20232,7 +20409,7 @@
[(match_dup 0)
(match_operand:SI 1 "nonmemory_operand" "")]))
(clobber (reg:CC FLAGS_REG))])]
- "! optimize_size && ! TARGET_READ_MODIFY_WRITE"
+ "optimize_insn_for_speed_p () && ! TARGET_READ_MODIFY_WRITE"
[(set (match_dup 2) (match_dup 0))
(parallel [(set (match_dup 2)
(match_op_dup 3 [(match_dup 2) (match_dup 1)]))
@@ -20247,7 +20424,7 @@
[(match_operand:SI 1 "nonmemory_operand" "")
(match_dup 0)]))
(clobber (reg:CC FLAGS_REG))])]
- "! optimize_size && ! TARGET_READ_MODIFY_WRITE"
+ "optimize_insn_for_speed_p () && ! TARGET_READ_MODIFY_WRITE"
[(set (match_dup 2) (match_dup 0))
(parallel [(set (match_dup 2)
(match_op_dup 3 [(match_dup 1) (match_dup 2)]))
@@ -20260,7 +20437,7 @@
[(set (match_operand 0 "register_operand" "")
(match_operand 1 "const0_operand" ""))]
"GET_MODE_SIZE (GET_MODE (operands[0])) <= UNITS_PER_WORD
- && (! TARGET_USE_MOV0 || optimize_size)
+ && (! TARGET_USE_MOV0 || optimize_insn_for_size_p ())
&& GENERAL_REG_P (operands[0])
&& peep2_regno_dead_p (0, FLAGS_REG)"
[(parallel [(set (match_dup 0) (const_int 0))
@@ -20274,7 +20451,7 @@
(const_int 0))]
"(GET_MODE (operands[0]) == QImode
|| GET_MODE (operands[0]) == HImode)
- && (! TARGET_USE_MOV0 || optimize_size)
+ && (! TARGET_USE_MOV0 || optimize_insn_for_size_p ())
&& peep2_regno_dead_p (0, FLAGS_REG)"
[(parallel [(set (strict_low_part (match_dup 0)) (const_int 0))
(clobber (reg:CC FLAGS_REG))])])
@@ -20286,7 +20463,7 @@
"(GET_MODE (operands[0]) == HImode
|| GET_MODE (operands[0]) == SImode
|| (GET_MODE (operands[0]) == DImode && TARGET_64BIT))
- && (optimize_size || TARGET_MOVE_M1_VIA_OR)
+ && (optimize_insn_for_size_p () || TARGET_MOVE_M1_VIA_OR)
&& peep2_regno_dead_p (0, FLAGS_REG)"
[(parallel [(set (match_dup 0) (const_int -1))
(clobber (reg:CC FLAGS_REG))])]
@@ -20377,7 +20554,7 @@
(parallel [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int -4)))
(clobber (reg:CC FLAGS_REG))
(clobber (mem:BLK (scratch)))])]
- "optimize_size || !TARGET_SUB_ESP_4"
+ "optimize_insn_for_size_p () || !TARGET_SUB_ESP_4"
[(clobber (match_dup 0))
(parallel [(set (mem:SI (pre_dec:SI (reg:SI SP_REG))) (match_dup 0))
(clobber (mem:BLK (scratch)))])])
@@ -20387,7 +20564,7 @@
(parallel [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int -8)))
(clobber (reg:CC FLAGS_REG))
(clobber (mem:BLK (scratch)))])]
- "optimize_size || !TARGET_SUB_ESP_8"
+ "optimize_insn_for_size_p () || !TARGET_SUB_ESP_8"
[(clobber (match_dup 0))
(set (mem:SI (pre_dec:SI (reg:SI SP_REG))) (match_dup 0))
(parallel [(set (mem:SI (pre_dec:SI (reg:SI SP_REG))) (match_dup 0))
@@ -20398,7 +20575,7 @@
[(match_scratch:SI 0 "r")
(parallel [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int -4)))
(clobber (reg:CC FLAGS_REG))])]
- "optimize_size || !TARGET_SUB_ESP_4"
+ "optimize_insn_for_size_p () || !TARGET_SUB_ESP_4"
[(clobber (match_dup 0))
(set (mem:SI (pre_dec:SI (reg:SI SP_REG))) (match_dup 0))])
@@ -20406,7 +20583,7 @@
[(match_scratch:SI 0 "r")
(parallel [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int -8)))
(clobber (reg:CC FLAGS_REG))])]
- "optimize_size || !TARGET_SUB_ESP_8"
+ "optimize_insn_for_size_p () || !TARGET_SUB_ESP_8"
[(clobber (match_dup 0))
(set (mem:SI (pre_dec:SI (reg:SI SP_REG))) (match_dup 0))
(set (mem:SI (pre_dec:SI (reg:SI SP_REG))) (match_dup 0))])
@@ -20417,7 +20594,7 @@
(parallel [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 4)))
(clobber (reg:CC FLAGS_REG))
(clobber (mem:BLK (scratch)))])]
- "optimize_size || !TARGET_ADD_ESP_4"
+ "optimize_insn_for_size_p () || !TARGET_ADD_ESP_4"
[(parallel [(set (match_dup 0) (mem:SI (reg:SI SP_REG)))
(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 4)))
(clobber (mem:BLK (scratch)))])]
@@ -20431,7 +20608,7 @@
(parallel [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 8)))
(clobber (reg:CC FLAGS_REG))
(clobber (mem:BLK (scratch)))])]
- "optimize_size || !TARGET_ADD_ESP_8"
+ "optimize_insn_for_size_p () || !TARGET_ADD_ESP_8"
[(parallel [(set (match_dup 0) (mem:SI (reg:SI SP_REG)))
(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 4)))
(clobber (mem:BLK (scratch)))])
@@ -20444,7 +20621,7 @@
(parallel [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 8)))
(clobber (reg:CC FLAGS_REG))
(clobber (mem:BLK (scratch)))])]
- "optimize_size"
+ "optimize_insn_for_size_p ()"
[(parallel [(set (match_dup 0) (mem:SI (reg:SI SP_REG)))
(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 4)))
(clobber (mem:BLK (scratch)))])
@@ -20480,7 +20657,7 @@
[(match_scratch:SI 0 "r")
(parallel [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 8)))
(clobber (reg:CC FLAGS_REG))])]
- "optimize_size"
+ "optimize_insn_for_size_p ()"
[(parallel [(set (match_dup 0) (mem:SI (reg:SI SP_REG)))
(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 4)))])
(parallel [(set (match_dup 0) (mem:SI (reg:SI SP_REG)))
@@ -20509,7 +20686,7 @@
(parallel [(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int -8)))
(clobber (reg:CC FLAGS_REG))
(clobber (mem:BLK (scratch)))])]
- "optimize_size || !TARGET_SUB_ESP_4"
+ "optimize_insn_for_size_p () || !TARGET_SUB_ESP_4"
[(clobber (match_dup 0))
(parallel [(set (mem:DI (pre_dec:DI (reg:DI SP_REG))) (match_dup 0))
(clobber (mem:BLK (scratch)))])])
@@ -20519,7 +20696,7 @@
(parallel [(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int -16)))
(clobber (reg:CC FLAGS_REG))
(clobber (mem:BLK (scratch)))])]
- "optimize_size || !TARGET_SUB_ESP_8"
+ "optimize_insn_for_size_p () || !TARGET_SUB_ESP_8"
[(clobber (match_dup 0))
(set (mem:DI (pre_dec:DI (reg:DI SP_REG))) (match_dup 0))
(parallel [(set (mem:DI (pre_dec:DI (reg:DI SP_REG))) (match_dup 0))
@@ -20530,7 +20707,7 @@
[(match_scratch:DI 0 "r")
(parallel [(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int -8)))
(clobber (reg:CC FLAGS_REG))])]
- "optimize_size || !TARGET_SUB_ESP_4"
+ "optimize_insn_for_size_p () || !TARGET_SUB_ESP_4"
[(clobber (match_dup 0))
(set (mem:DI (pre_dec:DI (reg:DI SP_REG))) (match_dup 0))])
@@ -20538,7 +20715,7 @@
[(match_scratch:DI 0 "r")
(parallel [(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int -16)))
(clobber (reg:CC FLAGS_REG))])]
- "optimize_size || !TARGET_SUB_ESP_8"
+ "optimize_insn_for_size_p () || !TARGET_SUB_ESP_8"
[(clobber (match_dup 0))
(set (mem:DI (pre_dec:DI (reg:DI SP_REG))) (match_dup 0))
(set (mem:DI (pre_dec:DI (reg:DI SP_REG))) (match_dup 0))])
@@ -20549,7 +20726,7 @@
(parallel [(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int 8)))
(clobber (reg:CC FLAGS_REG))
(clobber (mem:BLK (scratch)))])]
- "optimize_size || !TARGET_ADD_ESP_4"
+ "optimize_insn_for_size_p () || !TARGET_ADD_ESP_4"
[(parallel [(set (match_dup 0) (mem:DI (reg:DI SP_REG)))
(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int 8)))
(clobber (mem:BLK (scratch)))])]
@@ -20563,7 +20740,7 @@
(parallel [(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int 16)))
(clobber (reg:CC FLAGS_REG))
(clobber (mem:BLK (scratch)))])]
- "optimize_size || !TARGET_ADD_ESP_8"
+ "optimize_insn_for_size_p () || !TARGET_ADD_ESP_8"
[(parallel [(set (match_dup 0) (mem:DI (reg:DI SP_REG)))
(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int 8)))
(clobber (mem:BLK (scratch)))])
@@ -20576,7 +20753,7 @@
(parallel [(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int 16)))
(clobber (reg:CC FLAGS_REG))
(clobber (mem:BLK (scratch)))])]
- "optimize_size"
+ "optimize_insn_for_size_p ()"
[(parallel [(set (match_dup 0) (mem:DI (reg:DI SP_REG)))
(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int 8)))
(clobber (mem:BLK (scratch)))])
@@ -20612,7 +20789,7 @@
[(match_scratch:DI 0 "r")
(parallel [(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int 16)))
(clobber (reg:CC FLAGS_REG))])]
- "optimize_size"
+ "optimize_insn_for_size_p ()"
[(parallel [(set (match_dup 0) (mem:DI (reg:DI SP_REG)))
(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int 8)))])
(parallel [(set (match_dup 0) (mem:DI (reg:DI SP_REG)))
@@ -20640,7 +20817,7 @@
(mult:SI (match_operand:SI 1 "nonimmediate_operand" "")
(match_operand:SI 2 "const_int_operand" "")))
(clobber (reg:CC FLAGS_REG))])]
- "!optimize_size
+ "optimize_insn_for_speed_p ()
&& (INTVAL (operands[2]) == 3
|| INTVAL (operands[2]) == 5
|| INTVAL (operands[2]) == 9)"
@@ -20672,7 +20849,7 @@
(match_operand:DI 2 "const_int_operand" "")))
(clobber (reg:CC FLAGS_REG))])]
"TARGET_64BIT
- && !optimize_size
+ && optimize_insn_for_speed_p ()
&& (INTVAL (operands[2]) == 3
|| INTVAL (operands[2]) == 5
|| INTVAL (operands[2]) == 9)"
@@ -20690,7 +20867,7 @@
(mult:DI (match_operand:DI 1 "memory_operand" "")
(match_operand:DI 2 "immediate_operand" "")))
(clobber (reg:CC FLAGS_REG))])]
- "TARGET_SLOW_IMUL_IMM32_MEM && !optimize_size
+ "TARGET_SLOW_IMUL_IMM32_MEM && optimize_insn_for_speed_p ()
&& !satisfies_constraint_K (operands[2])"
[(set (match_dup 3) (match_dup 1))
(parallel [(set (match_dup 0) (mult:DI (match_dup 3) (match_dup 2)))
@@ -20703,7 +20880,7 @@
(mult:SI (match_operand:SI 1 "memory_operand" "")
(match_operand:SI 2 "immediate_operand" "")))
(clobber (reg:CC FLAGS_REG))])]
- "TARGET_SLOW_IMUL_IMM32_MEM && !optimize_size
+ "TARGET_SLOW_IMUL_IMM32_MEM && optimize_insn_for_speed_p ()
&& !satisfies_constraint_K (operands[2])"
[(set (match_dup 3) (match_dup 1))
(parallel [(set (match_dup 0) (mult:SI (match_dup 3) (match_dup 2)))
@@ -20717,7 +20894,7 @@
(mult:SI (match_operand:SI 1 "memory_operand" "")
(match_operand:SI 2 "immediate_operand" ""))))
(clobber (reg:CC FLAGS_REG))])]
- "TARGET_SLOW_IMUL_IMM32_MEM && !optimize_size
+ "TARGET_SLOW_IMUL_IMM32_MEM && optimize_insn_for_speed_p ()
&& !satisfies_constraint_K (operands[2])"
[(set (match_dup 3) (match_dup 1))
(parallel [(set (match_dup 0) (zero_extend:DI (mult:SI (match_dup 3) (match_dup 2))))
@@ -20734,7 +20911,7 @@
(match_operand:DI 2 "const_int_operand" "")))
(clobber (reg:CC FLAGS_REG))])
(match_scratch:DI 3 "r")]
- "TARGET_SLOW_IMUL_IMM8 && !optimize_size
+ "TARGET_SLOW_IMUL_IMM8 && optimize_insn_for_speed_p ()
&& satisfies_constraint_K (operands[2])"
[(set (match_dup 3) (match_dup 2))
(parallel [(set (match_dup 0) (mult:DI (match_dup 0) (match_dup 3)))
@@ -20750,7 +20927,7 @@
(match_operand:SI 2 "const_int_operand" "")))
(clobber (reg:CC FLAGS_REG))])
(match_scratch:SI 3 "r")]
- "TARGET_SLOW_IMUL_IMM8 && !optimize_size
+ "TARGET_SLOW_IMUL_IMM8 && optimize_insn_for_speed_p ()
&& satisfies_constraint_K (operands[2])"
[(set (match_dup 3) (match_dup 2))
(parallel [(set (match_dup 0) (mult:SI (match_dup 0) (match_dup 3)))
@@ -20766,7 +20943,7 @@
(match_operand:HI 2 "immediate_operand" "")))
(clobber (reg:CC FLAGS_REG))])
(match_scratch:HI 3 "r")]
- "TARGET_SLOW_IMUL_IMM8 && !optimize_size"
+ "TARGET_SLOW_IMUL_IMM8 && optimize_insn_for_speed_p ()"
[(set (match_dup 3) (match_dup 2))
(parallel [(set (match_dup 0) (mult:HI (match_dup 0) (match_dup 3)))
(clobber (reg:CC FLAGS_REG))])]
diff --git a/gcc/config/i386/i386.opt b/gcc/config/i386/i386.opt
index 75c94ba771e..fc59b77ac7b 100644
--- a/gcc/config/i386/i386.opt
+++ b/gcc/config/i386/i386.opt
@@ -18,24 +18,58 @@
; along with GCC; see the file COPYING3. If not see
; <http://www.gnu.org/licenses/>.
+;; Definitions to add to the cl_target_option structure
+;; -march= processor
+TargetSave
+unsigned char arch
+
+;; -mtune= processor
+TargetSave
+unsigned char tune
+
+;; -mfpath=
+TargetSave
+unsigned char fpmath
+
+;; branch cost
+TargetSave
+unsigned char branch_cost
+
+;; which flags were passed by the user
+TargetSave
+int ix86_isa_flags_explicit
+
+;; which flags were passed by the user
+TargetSave
+int target_flags_explicit
+
+;; whether -mtune was not specified
+TargetSave
+unsigned char tune_defaulted
+
+;; whether -march was specified
+TargetSave
+unsigned char arch_specified
+
+;; x86 options
m128bit-long-double
-Target RejectNegative Report Mask(128BIT_LONG_DOUBLE)
+Target RejectNegative Report Mask(128BIT_LONG_DOUBLE) Save
sizeof(long double) is 16
m80387
-Target Report Mask(80387)
+Target Report Mask(80387) Save
Use hardware fp
m96bit-long-double
-Target RejectNegative Report InverseMask(128BIT_LONG_DOUBLE)
+Target RejectNegative Report InverseMask(128BIT_LONG_DOUBLE) Save
sizeof(long double) is 12
maccumulate-outgoing-args
-Target Report Mask(ACCUMULATE_OUTGOING_ARGS)
+Target Report Mask(ACCUMULATE_OUTGOING_ARGS) Save
Reserve space for outgoing arguments in the function prologue
malign-double
-Target Report Mask(ALIGN_DOUBLE)
+Target Report Mask(ALIGN_DOUBLE) Save
Align some doubles on dword boundary
malign-functions=
@@ -51,7 +85,7 @@ Target RejectNegative Joined Var(ix86_align_loops_string)
Loop code aligned to this power of 2
malign-stringops
-Target RejectNegative Report InverseMask(NO_ALIGN_STRINGOPS, ALIGN_STRINGOPS)
+Target RejectNegative Report InverseMask(NO_ALIGN_STRINGOPS, ALIGN_STRINGOPS) Save
Align destination of the string operations
march=
@@ -75,11 +109,15 @@ Target RejectNegative Joined Var(ix86_cmodel_string)
Use given x86-64 code model
mfancy-math-387
-Target RejectNegative Report InverseMask(NO_FANCY_MATH_387, USE_FANCY_MATH_387)
+Target RejectNegative Report InverseMask(NO_FANCY_MATH_387, USE_FANCY_MATH_387) Save
Generate sin, cos, sqrt for FPU
+mforce-drap
+Target Report Var(ix86_force_drap)
+Always use Dynamic Realigned Argument Pointer (DRAP) to realign stack
+
mfp-ret-in-387
-Target Report Mask(FLOAT_RETURNS)
+Target Report Mask(FLOAT_RETURNS) Save
Return values of functions in FPU registers
mfpmath=
@@ -87,19 +125,19 @@ Target RejectNegative Joined Var(ix86_fpmath_string)
Generate floating point mathematics using given instruction set
mhard-float
-Target RejectNegative Mask(80387) MaskExists
+Target RejectNegative Mask(80387) MaskExists Save
Use hardware fp
mieee-fp
-Target Report Mask(IEEE_FP)
+Target Report Mask(IEEE_FP) Save
Use IEEE math for fp comparisons
minline-all-stringops
-Target Report Mask(INLINE_ALL_STRINGOPS)
+Target Report Mask(INLINE_ALL_STRINGOPS) Save
Inline all known string operations
minline-stringops-dynamically
-Target Report Mask(INLINE_STRINGOPS_DYNAMICALLY)
+Target Report Mask(INLINE_STRINGOPS_DYNAMICALLY) Save
Inline memset/memcpy string operations, but perform inline version only for small blocks
mintel-syntax
@@ -107,23 +145,23 @@ Target Undocumented
;; Deprecated
mms-bitfields
-Target Report Mask(MS_BITFIELD_LAYOUT)
+Target Report Mask(MS_BITFIELD_LAYOUT) Save
Use native (MS) bitfield layout
mno-align-stringops
-Target RejectNegative Report Mask(NO_ALIGN_STRINGOPS) Undocumented
+Target RejectNegative Report Mask(NO_ALIGN_STRINGOPS) Undocumented Save
mno-fancy-math-387
-Target RejectNegative Report Mask(NO_FANCY_MATH_387) Undocumented
+Target RejectNegative Report Mask(NO_FANCY_MATH_387) Undocumented Save
mno-push-args
-Target RejectNegative Report Mask(NO_PUSH_ARGS) Undocumented
+Target RejectNegative Report Mask(NO_PUSH_ARGS) Undocumented Save
mno-red-zone
-Target RejectNegative Report Mask(NO_RED_ZONE) Undocumented
+Target RejectNegative Report Mask(NO_RED_ZONE) Undocumented Save
momit-leaf-frame-pointer
-Target Report Mask(OMIT_LEAF_FRAME_POINTER)
+Target Report Mask(OMIT_LEAF_FRAME_POINTER) Save
Omit the frame pointer in leaf functions
mpc
@@ -134,12 +172,16 @@ mpreferred-stack-boundary=
Target RejectNegative Joined Var(ix86_preferred_stack_boundary_string)
Attempt to keep stack aligned to this power of 2
+mincoming-stack-boundary=
+Target RejectNegative Joined Var(ix86_incoming_stack_boundary_string)
+Assume incoming stack aligned to this power of 2
+
mpush-args
-Target Report InverseMask(NO_PUSH_ARGS, PUSH_ARGS)
+Target Report InverseMask(NO_PUSH_ARGS, PUSH_ARGS) Save
Use push instructions to save outgoing arguments
mred-zone
-Target RejectNegative Report InverseMask(NO_RED_ZONE, RED_ZONE)
+Target RejectNegative Report InverseMask(NO_RED_ZONE, RED_ZONE) Save
Use red-zone in the x86-64 code
mregparm=
@@ -147,23 +189,23 @@ Target RejectNegative Joined Var(ix86_regparm_string)
Number of registers used to pass integer arguments
mrtd
-Target Report Mask(RTD)
+Target Report Mask(RTD) Save
Alternate calling convention
msoft-float
-Target InverseMask(80387)
+Target InverseMask(80387) Save
Do not use hardware fp
msseregparm
-Target RejectNegative Mask(SSEREGPARM)
+Target RejectNegative Mask(SSEREGPARM) Save
Use SSE register passing conventions for SF and DF mode
mstackrealign
-Target Report Var(ix86_force_align_arg_pointer)
+Target Report Var(ix86_force_align_arg_pointer) Init(-1)
Realign stack in prologue
mstack-arg-probe
-Target Report Mask(STACK_PROBE)
+Target Report Mask(STACK_PROBE) Save
Enable stack probing
mstringop-strategy=
@@ -186,104 +228,105 @@ mveclibabi=
Target RejectNegative Joined Var(ix86_veclibabi_string)
Vector library ABI to use
+mrecip
+Target Report Mask(RECIP) Save
+Generate reciprocals instead of divss and sqrtss.
+
+mcld
+Target Report Mask(CLD) Save
+Generate cld instruction in the function prologue.
+
+mno-fused-madd
+Target RejectNegative Report Mask(NO_FUSED_MADD) Undocumented Save
+
+mfused-madd
+Target Report InverseMask(NO_FUSED_MADD, FUSED_MADD) Save
+Enable automatic generation of fused floating point multiply-add instructions
+if the ISA supports such instructions. The -mfused-madd option is on by
+default.
+
;; ISA support
m32
-Target RejectNegative Negative(m64) Report InverseMask(ISA_64BIT) Var(ix86_isa_flags) VarExists
+Target RejectNegative Negative(m64) Report InverseMask(ISA_64BIT) Var(ix86_isa_flags) VarExists Save
Generate 32bit i386 code
m64
-Target RejectNegative Negative(m32) Report Mask(ISA_64BIT) Var(ix86_isa_flags) VarExists
+Target RejectNegative Negative(m32) Report Mask(ISA_64BIT) Var(ix86_isa_flags) VarExists Save
Generate 64bit x86-64 code
mmmx
-Target Report Mask(ISA_MMX) Var(ix86_isa_flags) VarExists
+Target Report Mask(ISA_MMX) Var(ix86_isa_flags) VarExists Save
Support MMX built-in functions
m3dnow
-Target Report Mask(ISA_3DNOW) Var(ix86_isa_flags) VarExists
+Target Report Mask(ISA_3DNOW) Var(ix86_isa_flags) VarExists Save
Support 3DNow! built-in functions
m3dnowa
-Target Undocumented Mask(ISA_3DNOW_A) Var(ix86_isa_flags) VarExists
+Target Undocumented Mask(ISA_3DNOW_A) Var(ix86_isa_flags) VarExists Save
Support Athlon 3Dnow! built-in functions
msse
-Target Report Mask(ISA_SSE) Var(ix86_isa_flags) VarExists
+Target Report Mask(ISA_SSE) Var(ix86_isa_flags) VarExists Save
Support MMX and SSE built-in functions and code generation
msse2
-Target Report Mask(ISA_SSE2) Var(ix86_isa_flags) VarExists
+Target Report Mask(ISA_SSE2) Var(ix86_isa_flags) VarExists Save
Support MMX, SSE and SSE2 built-in functions and code generation
msse3
-Target Report Mask(ISA_SSE3) Var(ix86_isa_flags) VarExists
+Target Report Mask(ISA_SSE3) Var(ix86_isa_flags) VarExists Save
Support MMX, SSE, SSE2 and SSE3 built-in functions and code generation
mssse3
-Target Report Mask(ISA_SSSE3) Var(ix86_isa_flags) VarExists
+Target Report Mask(ISA_SSSE3) Var(ix86_isa_flags) VarExists Save
Support MMX, SSE, SSE2, SSE3 and SSSE3 built-in functions and code generation
msse4.1
-Target Report Mask(ISA_SSE4_1) Var(ix86_isa_flags) VarExists
+Target Report Mask(ISA_SSE4_1) Var(ix86_isa_flags) VarExists Save
Support MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1 built-in functions and code generation
msse4.2
-Target Report Mask(ISA_SSE4_2) Var(ix86_isa_flags) VarExists
+Target Report Mask(ISA_SSE4_2) Var(ix86_isa_flags) VarExists Save
Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1 and SSE4.2 built-in functions and code generation
msse4
-Target RejectNegative Report Mask(ISA_SSE4_2) MaskExists Var(ix86_isa_flags) VarExists
+Target RejectNegative Report Mask(ISA_SSE4_2) MaskExists Var(ix86_isa_flags) VarExists Save
Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1 and SSE4.2 built-in functions and code generation
mno-sse4
-Target RejectNegative Report InverseMask(ISA_SSE4_1) MaskExists Var(ix86_isa_flags) VarExists
+Target RejectNegative Report InverseMask(ISA_SSE4_1) MaskExists Var(ix86_isa_flags) VarExists Save
Do not support SSE4.1 and SSE4.2 built-in functions and code generation
msse4a
-Target Report Mask(ISA_SSE4A) Var(ix86_isa_flags) VarExists
+Target Report Mask(ISA_SSE4A) Var(ix86_isa_flags) VarExists Save
Support MMX, SSE, SSE2, SSE3 and SSE4A built-in functions and code generation
msse5
-Target Report Mask(ISA_SSE5) Var(ix86_isa_flags) VarExists
+Target Report Mask(ISA_SSE5) Var(ix86_isa_flags) VarExists Save
Support SSE5 built-in functions and code generation
-;; Instruction support
-
-mcld
-Target Report Mask(CLD)
-Generate cld instruction in the function prologue.
-
mabm
-Target Report RejectNegative Var(x86_abm)
+Target Report Mask(ISA_ABM) Var(ix86_isa_flags) VarExists Save
Support code generation of Advanced Bit Manipulation (ABM) instructions.
-mcx16
-Target Report RejectNegative Var(x86_cmpxchg16b)
-Support code generation of cmpxchg16b instruction.
-
mpopcnt
-Target Report RejectNegative Var(x86_popcnt)
+Target Report Mask(ISA_POPCNT) Var(ix86_isa_flags) VarExists Save
Support code generation of popcnt instruction.
+mcx16
+Target Report Mask(ISA_CX16) Var(ix86_isa_flags) VarExists Save
+Support code generation of cmpxchg16b instruction.
+
msahf
-Target Report RejectNegative Var(x86_sahf)
+Target Report Mask(ISA_SAHF) Var(ix86_isa_flags) VarExists Save
Support code generation of sahf instruction in 64bit x86-64 code.
-mrecip
-Target Report RejectNegative Var(x86_recip)
-Generate reciprocals instead of divss and sqrtss.
-
-mfused-madd
-Target Report Var(x86_fused_muladd) Init(1)
-Enable automatic generation of fused floating point multiply-add instructions
-if the ISA supports such instructions. The -mfused-madd option is on by
-default.
-
maes
-Target Report RejectNegative Var(x86_aes)
+Target Report Mask(ISA_AES) Var(ix86_isa_flags) VarExists Save
Support AES built-in functions and code generation
mpclmul
-Target Report RejectNegative Var(x86_pclmul)
+Target Report Mask(ISA_PCLMUL) Var(ix86_isa_flags) VarExists Save
Support PCLMUL built-in functions and code generation
diff --git a/gcc/config/i386/mmx.md b/gcc/config/i386/mmx.md
index 0a507e07a2f..8e77a30d353 100644
--- a/gcc/config/i386/mmx.md
+++ b/gcc/config/i386/mmx.md
@@ -65,9 +65,9 @@
(define_insn "*mov<mode>_internal_rex64"
[(set (match_operand:MMXMODEI8 0 "nonimmediate_operand"
- "=rm,r,!?y,!?y ,m ,!y,Y2,x,x ,m,r,x")
+ "=rm,r,!?y,!?y ,m ,!y,*Y2,x,x ,m,r,Yi")
(match_operand:MMXMODEI8 1 "vector_move_operand"
- "Cr ,m,C ,!?ym,!?y,Y2,!y,C,xm,x,x,r"))]
+ "Cr ,m,C ,!?ym,!?y,*Y2,!y,C,xm,x,Yi,r"))]
"TARGET_64BIT && TARGET_MMX
&& !(MEM_P (operands[0]) && MEM_P (operands[1]))"
"@
@@ -124,9 +124,9 @@
(define_insn "*movv2sf_internal_rex64"
[(set (match_operand:V2SF 0 "nonimmediate_operand"
- "=rm,r ,!?y,!?y ,m ,!y,Y2,x,x,x,m,r,x")
+ "=rm,r ,!?y,!?y ,m ,!y,*Y2,x,x,x,m,r,Yi")
(match_operand:V2SF 1 "vector_move_operand"
- "Cr ,m ,C ,!?ym,!y,Y2,!y,C,x,m,x,x,r"))]
+ "Cr ,m ,C ,!?ym,!y,*Y2,!y,C,x,m,x,Yi,r"))]
"TARGET_64BIT && TARGET_MMX
&& !(MEM_P (operands[0]) && MEM_P (operands[1]))"
"@
diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
index c1d306054ad..c8bf42d8193 100644
--- a/gcc/config/i386/sse.md
+++ b/gcc/config/i386/sse.md
@@ -36,6 +36,10 @@
(define_mode_iterator SSEMODEF4 [SF DF V4SF V2DF])
(define_mode_iterator SSEMODEF2P [V4SF V2DF])
+;; Int-float size matches
+(define_mode_iterator SSEMODE4S [V4SF V4SI])
+(define_mode_iterator SSEMODE2D [V2DF V2DI])
+
;; Mapping from float mode to required SSE level
(define_mode_attr sse [(SF "sse") (DF "sse2") (V4SF "sse") (V2DF "sse2")])
@@ -57,6 +61,10 @@
(V16QI "QI") (V8HI "HI")
(V4SI "SI") (V2DI "DI")])
+;; Mapping of vector modes to a vector mode of double size
+(define_mode_attr ssedoublesizemode [(V2DF "V4DF") (V2DI "V4DI")
+ (V4SF "V8SF") (V4SI "V8SI")])
+
;; Number of scalar elements in each vector type
(define_mode_attr ssescalarnum [(V4SF "4") (V2DF "2")
(V16QI "16") (V8HI "8")
@@ -202,6 +210,18 @@
DONE;
})
+(define_insn "sse2_movq128"
+ [(set (match_operand:V2DI 0 "register_operand" "=x")
+ (vec_concat:V2DI
+ (vec_select:DI
+ (match_operand:V2DI 1 "nonimmediate_operand" "xm")
+ (parallel [(const_int 0)]))
+ (const_int 0)))]
+ "TARGET_SSE2"
+ "movq\t{%1, %0|%0, %1}"
+ [(set_attr "type" "ssemov")
+ (set_attr "mode" "TI")])
+
(define_insn "<sse>_movup<ssemodesuffixf2c>"
[(set (match_operand:SSEMODEF2P 0 "nonimmediate_operand" "=x,m")
(unspec:SSEMODEF2P
@@ -2129,7 +2149,7 @@
"TARGET_SSE"
{
int mask = INTVAL (operands[3]);
- emit_insn (gen_sse_shufps_1 (operands[0], operands[1], operands[2],
+ emit_insn (gen_sse_shufps_v4sf (operands[0], operands[1], operands[2],
GEN_INT ((mask >> 0) & 3),
GEN_INT ((mask >> 2) & 3),
GEN_INT (((mask >> 4) & 3) + 4),
@@ -2137,12 +2157,12 @@
DONE;
})
-(define_insn "sse_shufps_1"
- [(set (match_operand:V4SF 0 "register_operand" "=x")
- (vec_select:V4SF
- (vec_concat:V8SF
- (match_operand:V4SF 1 "register_operand" "0")
- (match_operand:V4SF 2 "nonimmediate_operand" "xm"))
+(define_insn "sse_shufps_<mode>"
+ [(set (match_operand:SSEMODE4S 0 "register_operand" "=x")
+ (vec_select:SSEMODE4S
+ (vec_concat:<ssedoublesizemode>
+ (match_operand:SSEMODE4S 1 "register_operand" "0")
+ (match_operand:SSEMODE4S 2 "nonimmediate_operand" "xm"))
(parallel [(match_operand 3 "const_0_to_3_operand" "")
(match_operand 4 "const_0_to_3_operand" "")
(match_operand 5 "const_4_to_7_operand" "")
@@ -2540,18 +2560,62 @@
"TARGET_SSE2"
{
int mask = INTVAL (operands[3]);
- emit_insn (gen_sse2_shufpd_1 (operands[0], operands[1], operands[2],
+ emit_insn (gen_sse2_shufpd_v2df (operands[0], operands[1], operands[2],
GEN_INT (mask & 1),
GEN_INT (mask & 2 ? 3 : 2)));
DONE;
})
-(define_insn "sse2_shufpd_1"
- [(set (match_operand:V2DF 0 "register_operand" "=x")
- (vec_select:V2DF
- (vec_concat:V4DF
- (match_operand:V2DF 1 "register_operand" "0")
- (match_operand:V2DF 2 "nonimmediate_operand" "xm"))
+(define_expand "vec_extract_even<mode>"
+ [(set (match_operand:SSEMODE4S 0 "register_operand" "")
+ (vec_select:SSEMODE4S
+ (vec_concat:<ssedoublesizemode>
+ (match_operand:SSEMODE4S 1 "register_operand" "")
+ (match_operand:SSEMODE4S 2 "nonimmediate_operand" ""))
+ (parallel [(const_int 0)
+ (const_int 2)
+ (const_int 4)
+ (const_int 6)])))]
+ "TARGET_SSE")
+
+(define_expand "vec_extract_odd<mode>"
+ [(set (match_operand:SSEMODE4S 0 "register_operand" "")
+ (vec_select:SSEMODE4S
+ (vec_concat:<ssedoublesizemode>
+ (match_operand:SSEMODE4S 1 "register_operand" "")
+ (match_operand:SSEMODE4S 2 "nonimmediate_operand" ""))
+ (parallel [(const_int 1)
+ (const_int 3)
+ (const_int 5)
+ (const_int 7)])))]
+ "TARGET_SSE")
+
+(define_expand "vec_extract_even<mode>"
+ [(set (match_operand:SSEMODE2D 0 "register_operand" "")
+ (vec_select:SSEMODE2D
+ (vec_concat:<ssedoublesizemode>
+ (match_operand:SSEMODE2D 1 "register_operand" "")
+ (match_operand:SSEMODE2D 2 "nonimmediate_operand" ""))
+ (parallel [(const_int 0)
+ (const_int 2)])))]
+ "TARGET_SSE2")
+
+(define_expand "vec_extract_odd<mode>"
+ [(set (match_operand:SSEMODE2D 0 "register_operand" "")
+ (vec_select:SSEMODE2D
+ (vec_concat:<ssedoublesizemode>
+ (match_operand:SSEMODE2D 1 "register_operand" "")
+ (match_operand:SSEMODE2D 2 "nonimmediate_operand" ""))
+ (parallel [(const_int 1)
+ (const_int 3)])))]
+ "TARGET_SSE2")
+
+(define_insn "sse2_shufpd_<mode>"
+ [(set (match_operand:SSEMODE2D 0 "register_operand" "=x")
+ (vec_select:SSEMODE2D
+ (vec_concat:<ssedoublesizemode>
+ (match_operand:SSEMODE2D 1 "register_operand" "0")
+ (match_operand:SSEMODE2D 2 "nonimmediate_operand" "xm"))
(parallel [(match_operand 3 "const_0_to_1_operand" "")
(match_operand 4 "const_2_to_3_operand" "")])))]
"TARGET_SSE2"
@@ -4195,6 +4259,46 @@
DONE;
})
+(define_expand "vec_interleave_highv4sf"
+ [(set (match_operand:V4SF 0 "register_operand" "")
+ (vec_select:V4SF
+ (vec_concat:V8SF
+ (match_operand:V4SF 1 "register_operand" "")
+ (match_operand:V4SF 2 "nonimmediate_operand" ""))
+ (parallel [(const_int 2) (const_int 6)
+ (const_int 3) (const_int 7)])))]
+ "TARGET_SSE")
+
+(define_expand "vec_interleave_lowv4sf"
+ [(set (match_operand:V4SF 0 "register_operand" "")
+ (vec_select:V4SF
+ (vec_concat:V8SF
+ (match_operand:V4SF 1 "register_operand" "")
+ (match_operand:V4SF 2 "nonimmediate_operand" ""))
+ (parallel [(const_int 0) (const_int 4)
+ (const_int 1) (const_int 5)])))]
+ "TARGET_SSE")
+
+(define_expand "vec_interleave_highv2df"
+ [(set (match_operand:V2DF 0 "register_operand" "")
+ (vec_select:V2DF
+ (vec_concat:V4DF
+ (match_operand:V2DF 1 "register_operand" "")
+ (match_operand:V2DF 2 "nonimmediate_operand" ""))
+ (parallel [(const_int 1)
+ (const_int 3)])))]
+ "TARGET_SSE2")
+
+(define_expand "vec_interleave_lowv2df"
+ [(set (match_operand:V2DF 0 "register_operand" "")
+ (vec_select:V2DF
+ (vec_concat:V4DF
+ (match_operand:V2DF 1 "register_operand" "")
+ (match_operand:V2DF 2 "nonimmediate_operand" ""))
+ (parallel [(const_int 0)
+ (const_int 2)])))]
+ "TARGET_SSE2")
+
(define_insn "sse2_packsswb"
[(set (match_operand:V16QI 0 "register_operand" "=x")
(vec_concat:V16QI
@@ -4685,7 +4789,7 @@
"")
(define_insn "*sse2_storeq_rex64"
- [(set (match_operand:DI 0 "nonimmediate_operand" "=mx,r,r")
+ [(set (match_operand:DI 0 "nonimmediate_operand" "=mx,*r,r")
(vec_select:DI
(match_operand:V2DI 1 "nonimmediate_operand" "x,Yi,o")
(parallel [(const_int 0)])))]
@@ -4848,26 +4952,25 @@
(set_attr "mode" "TI,V4SF,V2SF")])
(define_insn "vec_concatv2di"
- [(set (match_operand:V2DI 0 "register_operand" "=Y2,?Y2,Y2,x,x,x")
+ [(set (match_operand:V2DI 0 "register_operand" "=Y2 ,?Y2,Y2,x,x")
(vec_concat:V2DI
- (match_operand:DI 1 "nonimmediate_operand" " m,*y ,0 ,0,0,m")
- (match_operand:DI 2 "vector_move_operand" " C, C,Y2,x,m,0")))]
+ (match_operand:DI 1 "nonimmediate_operand" " mY2,*y ,0 ,0,0")
+ (match_operand:DI 2 "vector_move_operand" " C , C,Y2,x,m")))]
"!TARGET_64BIT && TARGET_SSE"
"@
movq\t{%1, %0|%0, %1}
movq2dq\t{%1, %0|%0, %1}
punpcklqdq\t{%2, %0|%0, %2}
movlhps\t{%2, %0|%0, %2}
- movhps\t{%2, %0|%0, %2}
- movlps\t{%1, %0|%0, %1}"
- [(set_attr "type" "ssemov,ssemov,sselog,ssemov,ssemov,ssemov")
- (set_attr "mode" "TI,TI,TI,V4SF,V2SF,V2SF")])
+ movhps\t{%2, %0|%0, %2}"
+ [(set_attr "type" "ssemov,ssemov,sselog,ssemov,ssemov")
+ (set_attr "mode" "TI,TI,TI,V4SF,V2SF")])
(define_insn "*vec_concatv2di_rex64_sse4_1"
- [(set (match_operand:V2DI 0 "register_operand" "=x,x,Yi,!x,x,x,x,x")
+ [(set (match_operand:V2DI 0 "register_operand" "=x ,x ,Yi,!x,x,x,x")
(vec_concat:V2DI
- (match_operand:DI 1 "nonimmediate_operand" " 0,m,r ,*y,0,0,0,m")
- (match_operand:DI 2 "vector_move_operand" "rm,C,C ,C ,x,x,m,0")))]
+ (match_operand:DI 1 "nonimmediate_operand" " 0 ,mx,r ,*y,0,0,0")
+ (match_operand:DI 2 "vector_move_operand" " rm,C ,C ,C ,x,x,m")))]
"TARGET_64BIT && TARGET_SSE4_1"
"@
pinsrq\t{$0x1, %2, %0|%0, %2, 0x1}
@@ -4876,17 +4979,16 @@
movq2dq\t{%1, %0|%0, %1}
punpcklqdq\t{%2, %0|%0, %2}
movlhps\t{%2, %0|%0, %2}
- movhps\t{%2, %0|%0, %2}
- movlps\t{%1, %0|%0, %1}"
- [(set_attr "type" "sselog,ssemov,ssemov,ssemov,sselog,ssemov,ssemov,ssemov")
- (set_attr "prefix_extra" "1,*,*,*,*,*,*,*")
- (set_attr "mode" "TI,TI,TI,TI,TI,V4SF,V2SF,V2SF")])
+ movhps\t{%2, %0|%0, %2}"
+ [(set_attr "type" "sselog,ssemov,ssemov,ssemov,sselog,ssemov,ssemov")
+ (set_attr "prefix_extra" "1,*,*,*,*,*,*")
+ (set_attr "mode" "TI,TI,TI,TI,TI,V4SF,V2SF")])
(define_insn "*vec_concatv2di_rex64_sse"
- [(set (match_operand:V2DI 0 "register_operand" "=Y2,Yi,!Y2,Y2,x,x,x")
+ [(set (match_operand:V2DI 0 "register_operand" "=Y2 ,Yi,!Y2,Y2,x,x")
(vec_concat:V2DI
- (match_operand:DI 1 "nonimmediate_operand" " m,r ,*y ,0 ,0,0,m")
- (match_operand:DI 2 "vector_move_operand" " C,C ,C ,Y2,x,m,0")))]
+ (match_operand:DI 1 "nonimmediate_operand" " mY2,r ,*y ,0 ,0,0")
+ (match_operand:DI 2 "vector_move_operand" " C ,C ,C ,Y2,x,m")))]
"TARGET_64BIT && TARGET_SSE"
"@
movq\t{%1, %0|%0, %1}
@@ -4894,10 +4996,9 @@
movq2dq\t{%1, %0|%0, %1}
punpcklqdq\t{%2, %0|%0, %2}
movlhps\t{%2, %0|%0, %2}
- movhps\t{%2, %0|%0, %2}
- movlps\t{%1, %0|%0, %1}"
- [(set_attr "type" "ssemov,ssemov,ssemov,sselog,ssemov,ssemov,ssemov")
- (set_attr "mode" "TI,TI,TI,TI,V4SF,V2SF,V2SF")])
+ movhps\t{%2, %0|%0, %2}"
+ [(set_attr "type" "ssemov,ssemov,ssemov,sselog,ssemov,ssemov")
+ (set_attr "mode" "TI,TI,TI,TI,V4SF,V2SF")])
(define_expand "vec_unpacku_hi_v16qi"
[(match_operand:V8HI 0 "register_operand" "")
diff --git a/gcc/config/i386/t-i386 b/gcc/config/i386/t-i386
new file mode 100644
index 00000000000..4c0c046dae6
--- /dev/null
+++ b/gcc/config/i386/t-i386
@@ -0,0 +1,13 @@
+i386.o: $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
+ $(RTL_H) $(TREE_H) $(TM_P_H) $(REGS_H) hard-reg-set.h \
+ $(REAL_H) insn-config.h conditions.h output.h insn-codes.h \
+ $(INSN_ATTR_H) $(FLAGS_H) $(C_COMMON_H) except.h $(FUNCTION_H) \
+ $(RECOG_H) $(EXPR_H) $(OPTABS_H) toplev.h $(BASIC_BLOCK_H) \
+ $(GGC_H) $(TARGET_H) $(TARGET_DEF_H) langhooks.h $(CGRAPH_H) \
+ $(TREE_GIMPLE_H) dwarf2.h $(DF_H) tm-constrs.h $(PARAMS_H)
+
+i386-c.o: $(srcdir)/config/i386/i386-c.c \
+ $(srcdir)/config/i386/i386-protos.h $(CONFIG_H) $(SYSTEM_H) coretypes.h \
+ $(TM_H) $(RTL_H) $(TREE_H) $(TM_P_H) $(FLAGS_H) $(C_COMMON_H) $(GGC_H) \
+ $(TARGET_H) $(TARGET_DEF_H) $(CPPLIB_H) $(C_PRAGMA_H)
+ $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/config/i386/i386-c.c
diff --git a/gcc/config/i386/winnt.c b/gcc/config/i386/winnt.c
index 7fdd89471a8..8ef79058a7d 100644
--- a/gcc/config/i386/winnt.c
+++ b/gcc/config/i386/winnt.c
@@ -531,16 +531,16 @@ i386_pe_asm_output_aligned_decl_common (FILE *stream, tree decl,
/* Mark a function appropriately. This should only be called for
functions for which we are not emitting COFF debugging information.
FILE is the assembler output file, NAME is the name of the
- function, and PUBLIC is nonzero if the function is globally
+ function, and PUB is nonzero if the function is globally
visible. */
void
-i386_pe_declare_function_type (FILE *file, const char *name, int public)
+i386_pe_declare_function_type (FILE *file, const char *name, int pub)
{
fprintf (file, "\t.def\t");
assemble_name (file, name);
fprintf (file, ";\t.scl\t%d;\t.type\t%d;\t.endef\n",
- public ? (int) C_EXT : (int) C_STAT,
+ pub ? (int) C_EXT : (int) C_STAT,
(int) DT_FCN << N_BTSHFT);
}
diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c
index e93ae31b0bd..e8a853bb256 100644
--- a/gcc/config/ia64/ia64.c
+++ b/gcc/config/ia64/ia64.c
@@ -50,7 +50,7 @@ along with GCC; see the file COPYING3. If not see
#include "hashtab.h"
#include "langhooks.h"
#include "cfglayout.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "intl.h"
#include "df.h"
#include "debug.h"
@@ -275,7 +275,7 @@ static tree ia64_handle_model_attribute (tree *, tree, tree, int, bool *);
static tree ia64_handle_version_id_attribute (tree *, tree, tree, int, bool *);
static void ia64_encode_section_info (tree, rtx, int);
static rtx ia64_struct_value_rtx (tree, int);
-static tree ia64_gimplify_va_arg (tree, tree, tree *, tree *);
+static tree ia64_gimplify_va_arg (tree, tree, gimple_seq *, gimple_seq *);
static bool ia64_scalar_mode_supported_p (enum machine_mode mode);
static bool ia64_vector_mode_supported_p (enum machine_mode mode);
static bool ia64_cannot_force_const_mem (rtx);
@@ -493,6 +493,12 @@ static const struct attribute_spec ia64_attribute_table[] =
#undef TARGET_C_MODE_FOR_SUFFIX
#define TARGET_C_MODE_FOR_SUFFIX ia64_c_mode_for_suffix
+#undef TARGET_OPTION_COLD_ATTRIBUTE_SETS_OPTIMIZATION
+#define TARGET_OPTION_COLD_ATTRIBUTE_SETS_OPTIMIZATION true
+
+#undef TARGET_OPTION_HOT_ATTRIBUTE_SETS_OPTIMIZATION
+#define TARGET_OPTION_HOT_ATTRIBUTE_SETS_OPTIMIZATION true
+
struct gcc_target targetm = TARGET_INITIALIZER;
typedef enum
@@ -4336,7 +4342,8 @@ ia64_function_ok_for_sibcall (tree decl, tree exp ATTRIBUTE_UNUSED)
/* Implement va_arg. */
static tree
-ia64_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p)
+ia64_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p,
+ gimple_seq *post_p)
{
/* Variable sized types are passed by reference. */
if (pass_by_reference (NULL, TYPE_MODE (type), type, false))
@@ -4359,8 +4366,7 @@ ia64_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p)
t = build2 (BIT_AND_EXPR, TREE_TYPE (t), t,
size_int (-2 * UNITS_PER_WORD));
t = fold_convert (TREE_TYPE (valist), t);
- t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (valist), valist, t);
- gimplify_and_add (t, pre_p);
+ gimplify_assign (unshare_expr (valist), t, pre_p);
}
return std_gimplify_va_arg_expr (valist, type, pre_p, post_p);
@@ -4952,13 +4958,13 @@ ia64_register_move_cost (enum machine_mode mode, enum reg_class from,
return 2;
}
-/* Implement PREFERRED_RELOAD_CLASS. Place additional restrictions on CLASS
+/* Implement PREFERRED_RELOAD_CLASS. Place additional restrictions on RCLASS
to use when copying X into that class. */
enum reg_class
-ia64_preferred_reload_class (rtx x, enum reg_class class)
+ia64_preferred_reload_class (rtx x, enum reg_class rclass)
{
- switch (class)
+ switch (rclass)
{
case FR_REGS:
case FP_REGS:
@@ -4983,16 +4989,16 @@ ia64_preferred_reload_class (rtx x, enum reg_class class)
break;
}
- return class;
+ return rclass;
}
/* This function returns the register class required for a secondary
- register when copying between one of the registers in CLASS, and X,
+ register when copying between one of the registers in RCLASS, and X,
using MODE. A return value of NO_REGS means that no secondary register
is required. */
enum reg_class
-ia64_secondary_reload_class (enum reg_class class,
+ia64_secondary_reload_class (enum reg_class rclass,
enum machine_mode mode ATTRIBUTE_UNUSED, rtx x)
{
int regno = -1;
@@ -5000,7 +5006,7 @@ ia64_secondary_reload_class (enum reg_class class,
if (GET_CODE (x) == REG || GET_CODE (x) == SUBREG)
regno = true_regnum (x);
- switch (class)
+ switch (rclass)
{
case BR_REGS:
case AR_M_REGS:
@@ -5232,9 +5238,6 @@ ia64_override_options (void)
TARGET_INLINE_SQRT = INL_MAX_THR;
}
- ia64_flag_schedule_insns2 = flag_schedule_insns_after_reload;
- flag_schedule_insns_after_reload = 0;
-
ia64_section_threshold = g_switch_set ? g_switch_value : IA64_DEFAULT_GVALUE;
init_machine_status = ia64_init_machine_status;
@@ -9568,7 +9571,7 @@ ia64_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED,
HOST_WIDE_INT delta, HOST_WIDE_INT vcall_offset,
tree function)
{
- rtx this, insn, funexp;
+ rtx this_rtx, insn, funexp;
unsigned int this_parmno;
unsigned int this_regno;
rtx delta_rtx;
@@ -9597,7 +9600,7 @@ ia64_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED,
if (!TARGET_REG_NAMES)
reg_names[this_regno] = ia64_reg_numbers[this_parmno];
- this = gen_rtx_REG (Pmode, this_regno);
+ this_rtx = gen_rtx_REG (Pmode, this_regno);
/* Apply the constant offset, if required. */
delta_rtx = GEN_INT (delta);
@@ -9607,11 +9610,11 @@ ia64_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED,
REG_POINTER (tmp) = 1;
if (delta && satisfies_constraint_I (delta_rtx))
{
- emit_insn (gen_ptr_extend_plus_imm (this, tmp, delta_rtx));
+ emit_insn (gen_ptr_extend_plus_imm (this_rtx, tmp, delta_rtx));
delta = 0;
}
else
- emit_insn (gen_ptr_extend (this, tmp));
+ emit_insn (gen_ptr_extend (this_rtx, tmp));
}
if (delta)
{
@@ -9621,7 +9624,7 @@ ia64_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED,
emit_move_insn (tmp, delta_rtx);
delta_rtx = tmp;
}
- emit_insn (gen_adddi3 (this, this, delta_rtx));
+ emit_insn (gen_adddi3 (this_rtx, this_rtx, delta_rtx));
}
/* Apply the offset from the vtable, if required. */
@@ -9634,7 +9637,7 @@ ia64_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED,
{
rtx t = gen_rtx_REG (ptr_mode, 2);
REG_POINTER (t) = 1;
- emit_move_insn (t, gen_rtx_MEM (ptr_mode, this));
+ emit_move_insn (t, gen_rtx_MEM (ptr_mode, this_rtx));
if (satisfies_constraint_I (vcall_offset_rtx))
{
emit_insn (gen_ptr_extend_plus_imm (tmp, t, vcall_offset_rtx));
@@ -9644,7 +9647,7 @@ ia64_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED,
emit_insn (gen_ptr_extend (tmp, t));
}
else
- emit_move_insn (tmp, gen_rtx_MEM (Pmode, this));
+ emit_move_insn (tmp, gen_rtx_MEM (Pmode, this_rtx));
if (vcall_offset)
{
@@ -9662,7 +9665,7 @@ ia64_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED,
else
emit_move_insn (tmp, gen_rtx_MEM (Pmode, tmp));
- emit_insn (gen_adddi3 (this, this, tmp));
+ emit_insn (gen_adddi3 (this_rtx, this_rtx, tmp));
}
/* Generate a tail call to the target function. */
@@ -9927,6 +9930,13 @@ void
ia64_optimization_options (int level ATTRIBUTE_UNUSED,
int size ATTRIBUTE_UNUSED)
{
+ /* Disable the second machine independent scheduling pass and use one for the
+ IA-64. This needs to be here instead of in OVERRIDE_OPTIONS because this
+ is done whenever the optimization is changed via #pragma GCC optimize or
+ attribute((optimize(...))). */
+ ia64_flag_schedule_insns2 = flag_schedule_insns_after_reload;
+ flag_schedule_insns_after_reload = 0;
+
/* Let the scheduler form additional regions. */
set_param_value ("max-sched-extend-regions-iters", 2);
diff --git a/gcc/config/iq2000/iq2000.c b/gcc/config/iq2000/iq2000.c
index b66a485dbb1..06c187bc451 100644
--- a/gcc/config/iq2000/iq2000.c
+++ b/gcc/config/iq2000/iq2000.c
@@ -937,15 +937,15 @@ gen_int_relational (enum rtx_code test_code, rtx result, rtx cmp0, rtx cmp1,
{
if (p_info->const_add != 0)
{
- HOST_WIDE_INT new = INTVAL (cmp1) + p_info->const_add;
+ HOST_WIDE_INT new_const = INTVAL (cmp1) + p_info->const_add;
/* If modification of cmp1 caused overflow,
we would get the wrong answer if we follow the usual path;
thus, x > 0xffffffffU would turn into x > 0U. */
if ((p_info->unsignedp
- ? (unsigned HOST_WIDE_INT) new >
+ ? (unsigned HOST_WIDE_INT) new_const >
(unsigned HOST_WIDE_INT) INTVAL (cmp1)
- : new > INTVAL (cmp1))
+ : new_const > INTVAL (cmp1))
!= (p_info->const_add > 0))
{
/* This test is always true, but if INVERT is true then
@@ -955,7 +955,7 @@ gen_int_relational (enum rtx_code test_code, rtx result, rtx cmp0, rtx cmp1,
return result;
}
else
- cmp1 = GEN_INT (new);
+ cmp1 = GEN_INT (new_const);
}
}
diff --git a/gcc/config/iq2000/iq2000.h b/gcc/config/iq2000/iq2000.h
index f5574e4d757..f99a85d9593 100644
--- a/gcc/config/iq2000/iq2000.h
+++ b/gcc/config/iq2000/iq2000.h
@@ -128,8 +128,6 @@
#define PCC_BITFIELD_TYPE_MATTERS 1
-#define TARGET_FLOAT_FORMAT IEEE_FLOAT_FORMAT
-
/* Layout of Source Language Data Types. */
diff --git a/gcc/config/m32c/m32c-protos.h b/gcc/config/m32c/m32c-protos.h
index a63191c21ab..ec98d81f93c 100644
--- a/gcc/config/m32c/m32c-protos.h
+++ b/gcc/config/m32c/m32c-protos.h
@@ -1,5 +1,5 @@
/* Target Prototypes for R8C/M16C/M32C
- Copyright (C) 2005, 2007
+ Copyright (C) 2005, 2007, 2008
Free Software Foundation, Inc.
Contributed by Red Hat.
@@ -108,7 +108,7 @@ int m32c_split_psi_p (rtx *);
#ifdef TREE_CODE
void m32c_function_arg_advance (CUMULATIVE_ARGS *, MM, tree, int);
-tree m32c_gimplify_va_arg_expr (tree, tree, tree *, tree *);
+tree m32c_gimplify_va_arg_expr (tree, tree, gimple_seq *, gimple_seq *);
void m32c_init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx, tree, int);
bool m32c_promote_function_return (const_tree);
int m32c_special_page_vector_p (tree);
diff --git a/gcc/config/m32c/m32c.c b/gcc/config/m32c/m32c.c
index b0733dd8364..dcd5b374f93 100644
--- a/gcc/config/m32c/m32c.c
+++ b/gcc/config/m32c/m32c.c
@@ -47,7 +47,7 @@
#include "target-def.h"
#include "tm_p.h"
#include "langhooks.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "df.h"
/* Prototypes */
@@ -340,36 +340,36 @@ classes_intersect (int class1, int class2)
/* Used by m32c_register_move_cost to determine if a move is
impossibly expensive. */
static int
-class_can_hold_mode (int class, enum machine_mode mode)
+class_can_hold_mode (int rclass, enum machine_mode mode)
{
/* Cache the results: 0=untested 1=no 2=yes */
static char results[LIM_REG_CLASSES][MAX_MACHINE_MODE];
- if (results[class][mode] == 0)
+ if (results[rclass][mode] == 0)
{
int r, n, i;
- results[class][mode] = 1;
+ results[rclass][mode] = 1;
for (r = 0; r < FIRST_PSEUDO_REGISTER; r++)
- if (class_contents[class][0] & (1 << r)
+ if (class_contents[rclass][0] & (1 << r)
&& HARD_REGNO_MODE_OK (r, mode))
{
int ok = 1;
n = HARD_REGNO_NREGS (r, mode);
for (i = 1; i < n; i++)
- if (!(class_contents[class][0] & (1 << (r + i))))
+ if (!(class_contents[rclass][0] & (1 << (r + i))))
ok = 0;
if (ok)
{
- results[class][mode] = 2;
+ results[rclass][mode] = 2;
break;
}
}
}
#if DEBUG0
fprintf (stderr, "class %s can hold %s? %s\n",
- class_names[class], mode_name[mode],
- (results[class][mode] == 2) ? "yes" : "no");
+ class_names[rclass], mode_name[mode],
+ (results[rclass][mode] == 2) ? "yes" : "no");
#endif
- return results[class][mode] == 2;
+ return results[rclass][mode] == 2;
}
/* Run-time Target Specification. */
@@ -4298,22 +4298,22 @@ m32c_compare_redundant (rtx cmp, rtx *operands)
char *
m32c_output_compare (rtx insn, rtx *operands)
{
- static char template[] = ";cmp.b\t%1,%0";
+ static char templ[] = ";cmp.b\t%1,%0";
/* ^ 5 */
- template[5] = " bwll"[GET_MODE_SIZE(GET_MODE(operands[0]))];
+ templ[5] = " bwll"[GET_MODE_SIZE(GET_MODE(operands[0]))];
if (m32c_compare_redundant (insn, operands))
{
#if DEBUG_CMP
fprintf(stderr, "cbranch: cmp not needed\n");
#endif
- return template;
+ return templ;
}
#if DEBUG_CMP
- fprintf(stderr, "cbranch: cmp needed: `%s'\n", template);
+ fprintf(stderr, "cbranch: cmp needed: `%s'\n", templ);
#endif
- return template + 1;
+ return templ + 1;
}
#undef TARGET_ENCODE_SECTION_INFO
diff --git a/gcc/config/m68hc11/m68hc11.c b/gcc/config/m68hc11/m68hc11.c
index 314feb183a6..a52739be67e 100644
--- a/gcc/config/m68hc11/m68hc11.c
+++ b/gcc/config/m68hc11/m68hc11.c
@@ -435,7 +435,7 @@ m68hc11_hard_regno_rename_ok (int reg1, int reg2)
}
enum reg_class
-preferred_reload_class (rtx operand, enum reg_class class)
+preferred_reload_class (rtx operand, enum reg_class rclass)
{
enum machine_mode mode;
@@ -443,97 +443,97 @@ preferred_reload_class (rtx operand, enum reg_class class)
if (debug_m6811)
{
- printf ("Preferred reload: (class=%s): ", reg_class_names[class]);
+ printf ("Preferred reload: (class=%s): ", reg_class_names[rclass]);
}
- if (class == D_OR_A_OR_S_REGS && SP_REG_P (operand))
+ if (rclass == D_OR_A_OR_S_REGS && SP_REG_P (operand))
return m68hc11_base_reg_class;
- if (class >= S_REGS && (GET_CODE (operand) == MEM
+ if (rclass >= S_REGS && (GET_CODE (operand) == MEM
|| GET_CODE (operand) == CONST_INT))
{
/* S_REGS class must not be used. The movhi template does not
work to move a memory to a soft register.
Restrict to a hard reg. */
- switch (class)
+ switch (rclass)
{
default:
case G_REGS:
case D_OR_A_OR_S_REGS:
- class = A_OR_D_REGS;
+ rclass = A_OR_D_REGS;
break;
case A_OR_S_REGS:
- class = A_REGS;
+ rclass = A_REGS;
break;
case D_OR_SP_OR_S_REGS:
- class = D_OR_SP_REGS;
+ rclass = D_OR_SP_REGS;
break;
case D_OR_Y_OR_S_REGS:
- class = D_OR_Y_REGS;
+ rclass = D_OR_Y_REGS;
break;
case D_OR_X_OR_S_REGS:
- class = D_OR_X_REGS;
+ rclass = D_OR_X_REGS;
break;
case SP_OR_S_REGS:
- class = SP_REGS;
+ rclass = SP_REGS;
break;
case Y_OR_S_REGS:
- class = Y_REGS;
+ rclass = Y_REGS;
break;
case X_OR_S_REGS:
- class = X_REGS;
+ rclass = X_REGS;
break;
case D_OR_S_REGS:
- class = D_REGS;
+ rclass = D_REGS;
}
}
- else if (class == Y_REGS && GET_CODE (operand) == MEM)
+ else if (rclass == Y_REGS && GET_CODE (operand) == MEM)
{
- class = Y_REGS;
+ rclass = Y_REGS;
}
- else if (class == A_OR_D_REGS && GET_MODE_SIZE (mode) == 4)
+ else if (rclass == A_OR_D_REGS && GET_MODE_SIZE (mode) == 4)
{
- class = D_OR_X_REGS;
+ rclass = D_OR_X_REGS;
}
- else if (class >= S_REGS && S_REG_P (operand))
+ else if (rclass >= S_REGS && S_REG_P (operand))
{
- switch (class)
+ switch (rclass)
{
default:
case G_REGS:
case D_OR_A_OR_S_REGS:
- class = A_OR_D_REGS;
+ rclass = A_OR_D_REGS;
break;
case A_OR_S_REGS:
- class = A_REGS;
+ rclass = A_REGS;
break;
case D_OR_SP_OR_S_REGS:
- class = D_OR_SP_REGS;
+ rclass = D_OR_SP_REGS;
break;
case D_OR_Y_OR_S_REGS:
- class = D_OR_Y_REGS;
+ rclass = D_OR_Y_REGS;
break;
case D_OR_X_OR_S_REGS:
- class = D_OR_X_REGS;
+ rclass = D_OR_X_REGS;
break;
case SP_OR_S_REGS:
- class = SP_REGS;
+ rclass = SP_REGS;
break;
case Y_OR_S_REGS:
- class = Y_REGS;
+ rclass = Y_REGS;
break;
case X_OR_S_REGS:
- class = X_REGS;
+ rclass = X_REGS;
break;
case D_OR_S_REGS:
- class = D_REGS;
+ rclass = D_REGS;
}
}
- else if (class >= S_REGS)
+ else if (rclass >= S_REGS)
{
if (debug_m6811)
{
- printf ("Class = %s for: ", reg_class_names[class]);
+ printf ("Class = %s for: ", reg_class_names[rclass]);
fflush (stdout);
debug_rtx (operand);
}
@@ -541,12 +541,12 @@ preferred_reload_class (rtx operand, enum reg_class class)
if (debug_m6811)
{
- printf (" => class=%s\n", reg_class_names[class]);
+ printf (" => class=%s\n", reg_class_names[rclass]);
fflush (stdout);
debug_rtx (operand);
}
- return class;
+ return rclass;
}
/* Return 1 if the operand is a valid indexed addressing mode.
@@ -5097,10 +5097,10 @@ m68hc11_init_libfuncs (void)
/* Cost of moving memory. */
int
-m68hc11_memory_move_cost (enum machine_mode mode, enum reg_class class,
+m68hc11_memory_move_cost (enum machine_mode mode, enum reg_class rclass,
int in ATTRIBUTE_UNUSED)
{
- if (class <= H_REGS && class > NO_REGS)
+ if (rclass <= H_REGS && rclass > NO_REGS)
{
if (GET_MODE_SIZE (mode) <= 2)
return COSTS_N_INSNS (1) + (reload_completed | reload_in_progress);
diff --git a/gcc/config/mcore/mcore.c b/gcc/config/mcore/mcore.c
index 227f7dcd8e8..b80f59f476c 100644
--- a/gcc/config/mcore/mcore.c
+++ b/gcc/config/mcore/mcore.c
@@ -2602,30 +2602,30 @@ mcore_r15_operand_p (rtx x)
}
}
-/* Implement SECONDARY_RELOAD_CLASS. If CLASS contains r15, and we can't
+/* Implement SECONDARY_RELOAD_CLASS. If RCLASS contains r15, and we can't
directly move X into it, use r1-r14 as a temporary. */
enum reg_class
-mcore_secondary_reload_class (enum reg_class class,
+mcore_secondary_reload_class (enum reg_class rclass,
enum machine_mode mode ATTRIBUTE_UNUSED, rtx x)
{
- if (TEST_HARD_REG_BIT (reg_class_contents[class], 15)
+ if (TEST_HARD_REG_BIT (reg_class_contents[rclass], 15)
&& !mcore_r15_operand_p (x))
return LRW_REGS;
return NO_REGS;
}
/* Return the reg_class to use when reloading the rtx X into the class
- CLASS. If X is too complex to move directly into r15, prefer to
+ RCLASS. If X is too complex to move directly into r15, prefer to
use LRW_REGS instead. */
enum reg_class
-mcore_reload_class (rtx x, enum reg_class class)
+mcore_reload_class (rtx x, enum reg_class rclass)
{
- if (reg_class_subset_p (LRW_REGS, class) && !mcore_r15_operand_p (x))
+ if (reg_class_subset_p (LRW_REGS, rclass) && !mcore_r15_operand_p (x))
return LRW_REGS;
- return class;
+ return rclass;
}
/* Tell me if a pair of reg/subreg rtx's actually refer to the same
diff --git a/gcc/config/mips/constraints.md b/gcc/config/mips/constraints.md
index 88fcbf65ef6..3a03a3cb633 100644
--- a/gcc/config/mips/constraints.md
+++ b/gcc/config/mips/constraints.md
@@ -43,8 +43,10 @@
(define_register_constraint "b" "ALL_REGS"
"@internal")
-(define_register_constraint "c" "TARGET_USE_PIC_FN_ADDR_REG ? PIC_FN_ADDR_REG
- : TARGET_MIPS16 ? M16_NA_REGS
+;; MIPS16 code always calls through a MIPS16 register; see mips_emit_call_insn
+;; for details.
+(define_register_constraint "c" "TARGET_MIPS16 ? M16_REGS
+ : TARGET_USE_PIC_FN_ADDR_REG ? PIC_FN_ADDR_REG
: GR_REGS"
"A register suitable for use in an indirect jump. This will always be
@code{$25} for @option{-mabicalls}.")
diff --git a/gcc/config/mips/iris6.h b/gcc/config/mips/iris6.h
index 750eaa199fa..ffd918e8aaa 100644
--- a/gcc/config/mips/iris6.h
+++ b/gcc/config/mips/iris6.h
@@ -49,8 +49,32 @@ along with GCC; see the file COPYING3. If not see
#define IRIX_SUBTARGET_LINK_SPEC \
"%{mabi=32: -melf32bsmip}%{mabi=n32: -melf32bmipn32}%{mabi=64: -melf64bmip}"
#else
+ /* Explicitly hide crt symbols that would normally be marked with
+ a "hidden" visibility attribute.
+
+ We have traditionally disabled this attribute when using the
+ native linker because the native linker's visibility support is
+ not fully-compatible with the GNU linker's. In particular, the
+ native linker does not pull in archive objects purely to resolve
+ references to the object's hidden symbols, whereas the GNU
+ linker does.
+
+ The gcc build system currently hides symbols in some static
+ libraries (typically libgcov.a or libgcc.a) whenever visibility
+ attributes are supported. On targets with GNU semantics, this
+ makes sure that uses of libx.so symbols in one dynamic object are
+ not resolved to libx.a symbols in another dynamic object. But
+ on targets with IRIX semantics, hiding the symbols prevents the
+ static archive from working at all.
+
+ It would probably be better to enable visiblity attributes for
+ IRIX ld and disable the static archives versioning. It shouldn't
+ make anything worse, since libx.a symbols are global by default
+ anyway. However, no-one has volunteered to do this yet. */
+
#define IRIX_SUBTARGET_LINK_SPEC \
"%{w} -_SYSTYPE_SVR4 -woff 131 \
+ %{shared:-hidden_symbol __dso_handle} \
%{mabi=32: -32}%{mabi=n32: -n32}%{mabi=64: -64}%{!mabi*: -n32}"
#endif
diff --git a/gcc/config/mips/irix-crti.asm b/gcc/config/mips/irix-crti.asm
index d6888bbf014..992f8b695dc 100644
--- a/gcc/config/mips/irix-crti.asm
+++ b/gcc/config/mips/irix-crti.asm
@@ -49,3 +49,10 @@ __gcc_fini:
sd $31,0($sp)
sd $28,8($sp)
#endif
+
+/* This object will typically be included in the final link for both
+ shared libraries and executable, and we need to hide the symbols to
+ prevent possible symbol preemption warnings from the SGI linker. */
+.hidden __gcc_init
+.hidden __gcc_fini
+
diff --git a/gcc/config/mips/libgcc-mips16.ver b/gcc/config/mips/libgcc-mips16.ver
new file mode 100644
index 00000000000..d74bf49f203
--- /dev/null
+++ b/gcc/config/mips/libgcc-mips16.ver
@@ -0,0 +1,68 @@
+GCC_4.4.0 {
+ __mips16_addsf3
+ __mips16_subsf3
+ __mips16_mulsf3
+ __mips16_divsf3
+ __mips16_eqsf2
+ __mips16_nesf2
+ __mips16_gtsf2
+ __mips16_gesf2
+ __mips16_lesf2
+ __mips16_ltsf2
+ __mips16_floatsisf
+ __mips16_floatunsisf
+ __mips16_fix_truncsfsi
+ __mips16_adddf3
+ __mips16_subdf3
+ __mips16_muldf3
+ __mips16_divdf3
+ __mips16_extendsfdf2
+ __mips16_truncdfsf2
+ __mips16_eqdf2
+ __mips16_nedf2
+ __mips16_gtdf2
+ __mips16_gedf2
+ __mips16_ledf2
+ __mips16_ltdf2
+ __mips16_floatsidf
+ __mips16_floatunsidf
+ __mips16_fix_truncdfsi
+ __mips16_ret_sf
+ __mips16_ret_sc
+ __mips16_ret_df
+ __mips16_ret_dc
+ __mips16_call_stub_1
+ __mips16_call_stub_5
+ __mips16_call_stub_2
+ __mips16_call_stub_6
+ __mips16_call_stub_9
+ __mips16_call_stub_10
+ __mips16_call_stub_sf_0
+ __mips16_call_stub_sf_1
+ __mips16_call_stub_sf_5
+ __mips16_call_stub_sf_2
+ __mips16_call_stub_sf_6
+ __mips16_call_stub_sf_9
+ __mips16_call_stub_sf_10
+ __mips16_call_stub_sc_0
+ __mips16_call_stub_sc_1
+ __mips16_call_stub_sc_5
+ __mips16_call_stub_sc_2
+ __mips16_call_stub_sc_6
+ __mips16_call_stub_sc_9
+ __mips16_call_stub_sc_10
+ __mips16_call_stub_df_0
+ __mips16_call_stub_df_1
+ __mips16_call_stub_df_5
+ __mips16_call_stub_df_2
+ __mips16_call_stub_df_6
+ __mips16_call_stub_df_9
+ __mips16_call_stub_df_10
+ __mips16_call_stub_dc_0
+ __mips16_call_stub_dc_1
+ __mips16_call_stub_dc_5
+ __mips16_call_stub_dc_2
+ __mips16_call_stub_dc_6
+ __mips16_call_stub_dc_9
+ __mips16_call_stub_dc_10
+}
diff --git a/gcc/config/mips/linux-unwind.h b/gcc/config/mips/linux-unwind.h
index 4e71182f5cf..818b436e360 100644
--- a/gcc/config/mips/linux-unwind.h
+++ b/gcc/config/mips/linux-unwind.h
@@ -106,12 +106,17 @@ mips_fallback_frame_state (struct _Unwind_Context *context,
fs->regs.reg[i].loc.offset
= (_Unwind_Ptr)&(sc->sc_regs[i]) + reg_offset - new_cfa;
}
- /* The PC points to the faulting instruction, but the unwind tables
- expect it point to the following instruction. We compensate by
- reporting a return address at the next instruction. */
+ /* "PC & -2" points to the faulting instruction, but the unwind code
+ searches for "(ADDR & -2) - 1". (See MASK_RETURN_ADDR for the source
+ of the -2 mask.) Adding 2 here ensures that "(ADDR & -2) - 1" is the
+ address of the second byte of the faulting instruction.
+
+ Note that setting fs->signal_frame would not work. As the comment
+ above MASK_RETURN_ADDR explains, MIPS unwinders must earch for an
+ odd-valued address. */
fs->regs.reg[DWARF_ALT_FRAME_RETURN_COLUMN].how = REG_SAVED_VAL_OFFSET;
fs->regs.reg[DWARF_ALT_FRAME_RETURN_COLUMN].loc.offset
- = (_Unwind_Ptr)(sc->sc_pc) + 4 - new_cfa;
+ = (_Unwind_Ptr)(sc->sc_pc) + 2 - new_cfa;
fs->retaddr_column = DWARF_ALT_FRAME_RETURN_COLUMN;
return _URC_NO_REASON;
diff --git a/gcc/config/mips/linux.h b/gcc/config/mips/linux.h
index 2e7b1028c6e..90cf63df23c 100644
--- a/gcc/config/mips/linux.h
+++ b/gcc/config/mips/linux.h
@@ -96,36 +96,6 @@ along with GCC; see the file COPYING3. If not see
fputc ( '\n', FILE); \
} while (0)
-#undef ASM_DECLARE_FUNCTION_NAME
-#define ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) \
- do { \
- if (!flag_inhibit_size_directive) \
- { \
- fputs ("\t.ent\t", STREAM); \
- assemble_name (STREAM, NAME); \
- putc ('\n', STREAM); \
- } \
- ASM_OUTPUT_TYPE_DIRECTIVE (STREAM, NAME, "function"); \
- assemble_name (STREAM, NAME); \
- fputs (":\n", STREAM); \
- } while (0)
-
-#undef ASM_DECLARE_FUNCTION_SIZE
-#define ASM_DECLARE_FUNCTION_SIZE(STREAM, NAME, DECL) \
- do { \
- if (!flag_inhibit_size_directive) \
- { \
- fputs ("\t.end\t", STREAM); \
- assemble_name (STREAM, NAME); \
- putc ('\n', STREAM); \
- } \
- } while (0)
-
-/* Tell function_prologue in mips.c that we have already output the .ent/.end
- pseudo-ops. */
-#undef FUNCTION_NAME_ALREADY_DECLARED
-#define FUNCTION_NAME_ALREADY_DECLARED 1
-
/* The glibc _mcount stub will save $v0 for us. Don't mess with saving
it, since ASM_OUTPUT_REG_PUSH/ASM_OUTPUT_REG_POP do not work in the
presence of $gp-relative calls. */
diff --git a/gcc/config/mips/mips-protos.h b/gcc/config/mips/mips-protos.h
index d092cb6f5c1..01645a1ebc2 100644
--- a/gcc/config/mips/mips-protos.h
+++ b/gcc/config/mips/mips-protos.h
@@ -164,6 +164,22 @@ enum mips_loadgp_style {
struct mips16e_save_restore_info;
+/* Classifies a type of call.
+
+ MIPS_CALL_NORMAL
+ A normal call or call_value pattern.
+
+ MIPS_CALL_SIBCALL
+ A sibcall or sibcall_value pattern.
+
+ MIPS_CALL_EPILOGUE
+ A call inserted in the epilogue. */
+enum mips_call_type {
+ MIPS_CALL_NORMAL,
+ MIPS_CALL_SIBCALL,
+ MIPS_CALL_EPILOGUE
+};
+
extern bool mips_symbolic_constant_p (rtx, enum mips_symbol_context,
enum mips_symbol_type *);
extern int mips_regno_mode_ok_for_base_p (int, enum machine_mode, bool);
@@ -175,6 +191,8 @@ extern int mips_split_const_insns (rtx);
extern int mips_load_store_insns (rtx, rtx);
extern int mips_idiv_insns (void);
extern rtx mips_emit_move (rtx, rtx);
+extern rtx mips_pic_base_register (rtx);
+extern rtx mips_got_load (rtx, rtx, enum mips_symbol_type);
extern bool mips_split_symbol (rtx, rtx, enum machine_mode, rtx *);
extern rtx mips_unspec_address (rtx, enum mips_symbol_type);
extern bool mips_legitimize_address (rtx *, enum machine_mode);
@@ -202,7 +220,7 @@ extern rtx mips_subword (rtx, bool);
extern bool mips_split_64bit_move_p (rtx, rtx);
extern void mips_split_doubleword_move (rtx, rtx);
extern const char *mips_output_move (rtx, rtx);
-extern void mips_restore_gp (void);
+extern void mips_restore_gp (rtx);
#ifdef RTX_CODE
extern bool mips_expand_scc (enum rtx_code, rtx);
extern void mips_expand_conditional_branch (rtx *, enum rtx_code);
@@ -210,7 +228,9 @@ extern void mips_expand_vcondv2sf (rtx, rtx, rtx, enum rtx_code, rtx, rtx);
extern void mips_expand_conditional_move (rtx *);
extern void mips_expand_conditional_trap (enum rtx_code);
#endif
-extern rtx mips_expand_call (rtx, rtx, rtx, rtx, bool);
+extern bool mips_use_pic_fn_addr_reg_p (const_rtx);
+extern rtx mips_expand_call (enum mips_call_type, rtx, rtx, rtx, rtx, bool);
+extern void mips_split_call (rtx, rtx);
extern void mips_expand_fcc_reload (rtx, rtx, rtx);
extern void mips_set_return_address (rtx, rtx);
extern bool mips_expand_block_move (rtx, rtx, rtx);
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index d1def425576..48daec4175d 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -56,7 +56,7 @@ along with GCC; see the file COPYING3. If not see
#include "langhooks.h"
#include "cfglayout.h"
#include "sched-int.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "bitmap.h"
#include "diagnostic.h"
@@ -469,6 +469,10 @@ static GTY (()) int mips_output_filename_first_time = 1;
mips_split_symbol. */
bool mips_split_p[NUM_SYMBOL_TYPES];
+/* mips_split_hi_p[X] is true if the high parts of symbols of type X
+ can be split by mips_split_symbol. */
+bool mips_split_hi_p[NUM_SYMBOL_TYPES];
+
/* mips_lo_relocs[X] is the relocation to use when a symbol of type X
appears in a LO_SUM. It can be null if such LO_SUMs aren't valid or
if they are matched by a special .md file pattern. */
@@ -479,11 +483,11 @@ static const char *mips_hi_relocs[NUM_SYMBOL_TYPES];
/* Index R is the smallest register class that contains register R. */
const enum reg_class mips_regno_to_class[FIRST_PSEUDO_REGISTER] = {
- LEA_REGS, LEA_REGS, M16_NA_REGS, V1_REG,
+ LEA_REGS, LEA_REGS, M16_REGS, V1_REG,
M16_REGS, M16_REGS, M16_REGS, M16_REGS,
LEA_REGS, LEA_REGS, LEA_REGS, LEA_REGS,
LEA_REGS, LEA_REGS, LEA_REGS, LEA_REGS,
- M16_NA_REGS, M16_NA_REGS, LEA_REGS, LEA_REGS,
+ M16_REGS, M16_REGS, LEA_REGS, LEA_REGS,
LEA_REGS, LEA_REGS, LEA_REGS, LEA_REGS,
T_REG, PIC_FN_ADDR_REG, LEA_REGS, LEA_REGS,
LEA_REGS, LEA_REGS, LEA_REGS, LEA_REGS,
@@ -565,6 +569,8 @@ static const struct mips_cpu_info mips_cpu_info_table[] = {
{ "mips32", PROCESSOR_4KC, 32, PTF_AVOID_BRANCHLIKELY },
{ "mips32r2", PROCESSOR_M4K, 33, PTF_AVOID_BRANCHLIKELY },
{ "mips64", PROCESSOR_5KC, 64, PTF_AVOID_BRANCHLIKELY },
+ /* ??? For now just tune the generic MIPS64r2 for 5KC as well. */
+ { "mips64r2", PROCESSOR_5KC, 65, PTF_AVOID_BRANCHLIKELY },
/* MIPS I processors. */
{ "r3000", PROCESSOR_R3000, 1, 0 },
@@ -1340,6 +1346,22 @@ mips_build_integer (struct mips_integer_op *codes,
}
}
+/* Return true if symbols of type TYPE require a GOT access. */
+
+static bool
+mips_got_symbol_type_p (enum mips_symbol_type type)
+{
+ switch (type)
+ {
+ case SYMBOL_GOT_PAGE_OFST:
+ case SYMBOL_GOT_DISP:
+ return true;
+
+ default:
+ return false;
+ }
+}
+
/* Return true if X is a thread-local symbol. */
static bool
@@ -1357,7 +1379,7 @@ mips_global_symbol_p (const_rtx x)
const_tree decl = SYMBOL_REF_DECL (x);
if (!decl)
- return !SYMBOL_REF_LOCAL_P (x);
+ return !SYMBOL_REF_LOCAL_P (x) || SYMBOL_REF_EXTERNAL_P (x);
/* Weakref symbols are not TREE_PUBLIC, but their targets are global
or weak symbols. Relocations in the object file will be against
@@ -1365,6 +1387,27 @@ mips_global_symbol_p (const_rtx x)
return DECL_P (decl) && (TREE_PUBLIC (decl) || DECL_WEAK (decl));
}
+/* Return true if function X is a libgcc MIPS16 stub function. */
+
+static bool
+mips16_stub_function_p (const_rtx x)
+{
+ return (GET_CODE (x) == SYMBOL_REF
+ && strncmp (XSTR (x, 0), "__mips16_", 9) == 0);
+}
+
+/* Return true if function X is a locally-defined and locally-binding
+ MIPS16 function. */
+
+static bool
+mips16_local_function_p (const_rtx x)
+{
+ return (GET_CODE (x) == SYMBOL_REF
+ && SYMBOL_REF_LOCAL_P (x)
+ && !SYMBOL_REF_EXTERNAL_P (x)
+ && mips_use_mips16_mode_p (SYMBOL_REF_DECL (x)));
+}
+
/* Return true if SYMBOL_REF X binds locally. */
static bool
@@ -1399,6 +1442,29 @@ mips_dangerous_for_la25_p (rtx x)
&& mips_global_symbol_p (x));
}
+/* Return true if calls to X might need $25 to be valid on entry. */
+
+bool
+mips_use_pic_fn_addr_reg_p (const_rtx x)
+{
+ if (!TARGET_USE_PIC_FN_ADDR_REG)
+ return false;
+
+ /* MIPS16 stub functions are guaranteed not to use $25. */
+ if (mips16_stub_function_p (x))
+ return false;
+
+ /* When TARGET_ABSOLUTE_ABICALLS is true, locally-defined functions
+ use absolute accesses to set up the global pointer. */
+ if (TARGET_ABSOLUTE_ABICALLS
+ && GET_CODE (x) == SYMBOL_REF
+ && mips_symbol_binds_local_p (x)
+ && !SYMBOL_REF_EXTERNAL_P (x))
+ return false;
+
+ return true;
+}
+
/* Return the method that should be used to access SYMBOL_REF or
LABEL_REF X in context CONTEXT. */
@@ -1734,24 +1800,37 @@ mips_tls_symbol_ref_1 (rtx *x, void *data ATTRIBUTE_UNUSED)
static bool
mips_cannot_force_const_mem (rtx x)
{
+ enum mips_symbol_type type;
rtx base, offset;
- if (!TARGET_MIPS16)
- {
- /* As an optimization, reject constants that mips_legitimize_move
- can expand inline.
+ /* There is no assembler syntax for expressing an address-sized
+ high part. */
+ if (GET_CODE (x) == HIGH)
+ return true;
+
+ /* As an optimization, reject constants that mips_legitimize_move
+ can expand inline.
- Suppose we have a multi-instruction sequence that loads constant C
- into register R. If R does not get allocated a hard register, and
- R is used in an operand that allows both registers and memory
- references, reload will consider forcing C into memory and using
- one of the instruction's memory alternatives. Returning false
- here will force it to use an input reload instead. */
- if (GET_CODE (x) == CONST_INT)
+ Suppose we have a multi-instruction sequence that loads constant C
+ into register R. If R does not get allocated a hard register, and
+ R is used in an operand that allows both registers and memory
+ references, reload will consider forcing C into memory and using
+ one of the instruction's memory alternatives. Returning false
+ here will force it to use an input reload instead. */
+ if (GET_CODE (x) == CONST_INT && LEGITIMATE_CONSTANT_P (x))
+ return true;
+
+ split_const (x, &base, &offset);
+ if (mips_symbolic_constant_p (base, SYMBOL_CONTEXT_LEA, &type)
+ && type != SYMBOL_FORCE_TO_MEM)
+ {
+ /* The same optimization as for CONST_INT. */
+ if (SMALL_INT (offset) && mips_symbol_insns (type, MAX_MACHINE_MODE) > 0)
return true;
- split_const (x, &base, &offset);
- if (symbolic_operand (base, VOIDmode) && SMALL_INT (offset))
+ /* If MIPS16 constant pools live in the text section, they should
+ not refer to anything that might need run-time relocation. */
+ if (TARGET_MIPS16_PCREL_LOADS && mips_got_symbol_type_p (type))
return true;
}
@@ -2095,8 +2174,13 @@ mips_const_insns (rtx x)
return mips_symbol_insns (symbol_type, MAX_MACHINE_MODE);
/* Otherwise try splitting the constant into a base and offset.
- 16-bit offsets can be added using an extra ADDIU. Larger offsets
- must be calculated separately and then added to the base. */
+ If the offset is a 16-bit value, we can load the base address
+ into a register and then use (D)ADDIU to add in the offset.
+ If the offset is larger, we can load the base and offset
+ into separate registers and add them together with (D)ADDU.
+ However, the latter is only possible before reload; during
+ and after reload, we must have the option of forcing the
+ constant into the pool instead. */
split_const (x, &x, &offset);
if (offset != 0)
{
@@ -2105,7 +2189,7 @@ mips_const_insns (rtx x)
{
if (SMALL_INT (offset))
return n + 1;
- else
+ else if (!targetm.cannot_force_const_mem (x))
return n + 1 + mips_build_integer (codes, INTVAL (offset));
}
}
@@ -2236,17 +2320,30 @@ mips_force_temporary (rtx dest, rtx value)
/* Emit a call sequence with call pattern PATTERN and return the call
instruction itself (which is not necessarily the last instruction
- emitted). LAZY_P is true if the call address is lazily-bound. */
+ emitted). ORIG_ADDR is the original, unlegitimized address,
+ ADDR is the legitimized form, and LAZY_P is true if the call
+ address is lazily-bound. */
static rtx
-mips_emit_call_insn (rtx pattern, bool lazy_p)
+mips_emit_call_insn (rtx pattern, rtx orig_addr, rtx addr, bool lazy_p)
{
- rtx insn;
+ rtx insn, reg;
insn = emit_call_insn (pattern);
- /* Lazy-binding stubs require $gp to be valid on entry. */
+ if (TARGET_MIPS16 && mips_use_pic_fn_addr_reg_p (orig_addr))
+ {
+ /* MIPS16 JALRs only take MIPS16 registers. If the target
+ function requires $25 to be valid on entry, we must copy it
+ there separately. The move instruction can be put in the
+ call's delay slot. */
+ reg = gen_rtx_REG (Pmode, PIC_FUNCTION_ADDR_REGNUM);
+ emit_insn_before (gen_move_insn (reg, addr), insn);
+ use_reg (&CALL_INSN_FUNCTION_USAGE (insn), reg);
+ }
+
if (lazy_p)
+ /* Lazy-binding stubs require $gp to be valid on entry. */
use_reg (&CALL_INSN_FUNCTION_USAGE (insn), pic_offset_table_rtx);
if (TARGET_USE_GOT)
@@ -2259,6 +2356,51 @@ mips_emit_call_insn (rtx pattern, bool lazy_p)
return insn;
}
+/* Wrap symbol or label BASE in an UNSPEC address of type SYMBOL_TYPE,
+ then add CONST_INT OFFSET to the result. */
+
+static rtx
+mips_unspec_address_offset (rtx base, rtx offset,
+ enum mips_symbol_type symbol_type)
+{
+ base = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, base),
+ UNSPEC_ADDRESS_FIRST + symbol_type);
+ if (offset != const0_rtx)
+ base = gen_rtx_PLUS (Pmode, base, offset);
+ return gen_rtx_CONST (Pmode, base);
+}
+
+/* Return an UNSPEC address with underlying address ADDRESS and symbol
+ type SYMBOL_TYPE. */
+
+rtx
+mips_unspec_address (rtx address, enum mips_symbol_type symbol_type)
+{
+ rtx base, offset;
+
+ split_const (address, &base, &offset);
+ return mips_unspec_address_offset (base, offset, symbol_type);
+}
+
+/* If mips_unspec_address (ADDR, SYMBOL_TYPE) is a 32-bit value, add the
+ high part to BASE and return the result. Just return BASE otherwise.
+ TEMP is as for mips_force_temporary.
+
+ The returned expression can be used as the first operand to a LO_SUM. */
+
+static rtx
+mips_unspec_offset_high (rtx temp, rtx base, rtx addr,
+ enum mips_symbol_type symbol_type)
+{
+ if (mips_split_p[symbol_type])
+ {
+ addr = gen_rtx_HIGH (Pmode, mips_unspec_address (addr, symbol_type));
+ addr = mips_force_temporary (temp, addr);
+ base = mips_force_temporary (temp, gen_rtx_PLUS (Pmode, addr, base));
+ }
+ return base;
+}
+
/* Return an instruction that copies $gp into register REG. We want
GCC to treat the register's value as constant, so that its value
can be rematerialized on demand. */
@@ -2287,21 +2429,17 @@ mips16_gp_pseudo_reg (void)
if (!cfun->machine->initialized_mips16_gp_pseudo_p
&& (current_ir_type () != IR_GIMPLE || currently_expanding_to_rtl))
{
- rtx insn, scan, after;
+ rtx insn, scan;
+
+ push_topmost_sequence ();
+
+ scan = get_insns ();
+ while (NEXT_INSN (scan) && !INSN_P (NEXT_INSN (scan)))
+ scan = NEXT_INSN (scan);
insn = gen_load_const_gp (cfun->machine->mips16_gp_pseudo_rtx);
+ emit_insn_after (insn, scan);
- push_topmost_sequence ();
- /* We need to emit the initialization after the FUNCTION_BEG
- note, so that it will be integrated. */
- after = get_insns ();
- for (scan = after; scan != NULL_RTX; scan = NEXT_INSN (scan))
- if (NOTE_P (scan) && NOTE_KIND (scan) == NOTE_INSN_FUNCTION_BEG)
- {
- after = scan;
- break;
- }
- insn = emit_insn_after (insn, after);
pop_topmost_sequence ();
cfun->machine->initialized_mips16_gp_pseudo_p = true;
@@ -2310,17 +2448,74 @@ mips16_gp_pseudo_reg (void)
return cfun->machine->mips16_gp_pseudo_rtx;
}
+/* Return a base register that holds pic_offset_table_rtx.
+ TEMP, if nonnull, is a scratch Pmode base register. */
+
+rtx
+mips_pic_base_register (rtx temp)
+{
+ if (!TARGET_MIPS16)
+ return pic_offset_table_rtx;
+
+ if (can_create_pseudo_p ())
+ return mips16_gp_pseudo_reg ();
+
+ if (TARGET_USE_GOT)
+ /* The first post-reload split exposes all references to $gp
+ (both uses and definitions). All references must remain
+ explicit after that point.
+
+ It is safe to introduce uses of $gp at any time, so for
+ simplicity, we do that before the split too. */
+ mips_emit_move (temp, pic_offset_table_rtx);
+ else
+ emit_insn (gen_load_const_gp (temp));
+ return temp;
+}
+
+/* Create and return a GOT reference of type TYPE for address ADDR.
+ TEMP, if nonnull, is a scratch Pmode base register. */
+
+rtx
+mips_got_load (rtx temp, rtx addr, enum mips_symbol_type type)
+{
+ rtx base, high, lo_sum_symbol;
+
+ base = mips_pic_base_register (temp);
+
+ /* If we used the temporary register to load $gp, we can't use
+ it for the high part as well. */
+ if (temp != NULL && reg_overlap_mentioned_p (base, temp))
+ temp = NULL;
+
+ high = mips_unspec_offset_high (temp, base, addr, type);
+ lo_sum_symbol = mips_unspec_address (addr, type);
+
+ if (type == SYMBOL_GOTOFF_CALL)
+ return (Pmode == SImode
+ ? gen_unspec_callsi (high, lo_sum_symbol)
+ : gen_unspec_calldi (high, lo_sum_symbol));
+ else
+ return (Pmode == SImode
+ ? gen_unspec_gotsi (high, lo_sum_symbol)
+ : gen_unspec_gotdi (high, lo_sum_symbol));
+}
+
/* If MODE is MAX_MACHINE_MODE, ADDR appears as a move operand, otherwise
it appears in a MEM of that mode. Return true if ADDR is a legitimate
- constant in that context and can be split into a high part and a LO_SUM.
- If so, and if LO_SUM_OUT is nonnull, emit the high part and return
- the LO_SUM in *LO_SUM_OUT. Leave *LO_SUM_OUT unchanged otherwise.
+ constant in that context and can be split into high and low parts.
+ If so, and if LOW_OUT is nonnull, emit the high part and store the
+ low part in *LOW_OUT. Leave *LOW_OUT unchanged otherwise.
TEMP is as for mips_force_temporary and is used to load the high
- part into a register. */
+ part into a register.
+
+ When MODE is MAX_MACHINE_MODE, the low part is guaranteed to be
+ a legitimize SET_SRC for an .md pattern, otherwise the low part
+ is guaranteed to be a legitimate address for mode MODE. */
bool
-mips_split_symbol (rtx temp, rtx addr, enum machine_mode mode, rtx *lo_sum_out)
+mips_split_symbol (rtx temp, rtx addr, enum machine_mode mode, rtx *low_out)
{
enum mips_symbol_context context;
enum mips_symbol_type symbol_type;
@@ -2329,76 +2524,56 @@ mips_split_symbol (rtx temp, rtx addr, enum machine_mode mode, rtx *lo_sum_out)
context = (mode == MAX_MACHINE_MODE
? SYMBOL_CONTEXT_LEA
: SYMBOL_CONTEXT_MEM);
- if (!mips_symbolic_constant_p (addr, context, &symbol_type)
- || mips_symbol_insns (symbol_type, mode) == 0
- || !mips_split_p[symbol_type])
- return false;
-
- if (lo_sum_out)
+ if (GET_CODE (addr) == HIGH && context == SYMBOL_CONTEXT_LEA)
{
- if (symbol_type == SYMBOL_GP_RELATIVE)
- {
- if (!can_create_pseudo_p ())
- {
- emit_insn (gen_load_const_gp (temp));
- high = temp;
- }
- else
- high = mips16_gp_pseudo_reg ();
- }
- else
+ addr = XEXP (addr, 0);
+ if (mips_symbolic_constant_p (addr, context, &symbol_type)
+ && mips_symbol_insns (symbol_type, mode) > 0
+ && mips_split_hi_p[symbol_type])
{
- high = gen_rtx_HIGH (Pmode, copy_rtx (addr));
- high = mips_force_temporary (temp, high);
+ if (low_out)
+ switch (symbol_type)
+ {
+ case SYMBOL_GOT_PAGE_OFST:
+ /* The high part of a page/ofst pair is loaded from the GOT. */
+ *low_out = mips_got_load (temp, addr, SYMBOL_GOTOFF_PAGE);
+ break;
+
+ default:
+ gcc_unreachable ();
+ }
+ return true;
}
- *lo_sum_out = gen_rtx_LO_SUM (Pmode, high, addr);
}
- return true;
-}
-
-/* Wrap symbol or label BASE in an UNSPEC address of type SYMBOL_TYPE,
- then add CONST_INT OFFSET to the result. */
-
-static rtx
-mips_unspec_address_offset (rtx base, rtx offset,
- enum mips_symbol_type symbol_type)
-{
- base = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, base),
- UNSPEC_ADDRESS_FIRST + symbol_type);
- if (offset != const0_rtx)
- base = gen_rtx_PLUS (Pmode, base, offset);
- return gen_rtx_CONST (Pmode, base);
-}
-
-/* Return an UNSPEC address with underlying address ADDRESS and symbol
- type SYMBOL_TYPE. */
-
-rtx
-mips_unspec_address (rtx address, enum mips_symbol_type symbol_type)
-{
- rtx base, offset;
-
- split_const (address, &base, &offset);
- return mips_unspec_address_offset (base, offset, symbol_type);
-}
-
-/* If mips_unspec_address (ADDR, SYMBOL_TYPE) is a 32-bit value, add the
- high part to BASE and return the result. Just return BASE otherwise.
- TEMP is as for mips_force_temporary.
+ else
+ {
+ if (mips_symbolic_constant_p (addr, context, &symbol_type)
+ && mips_symbol_insns (symbol_type, mode) > 0
+ && mips_split_p[symbol_type])
+ {
+ if (low_out)
+ switch (symbol_type)
+ {
+ case SYMBOL_GOT_DISP:
+ /* SYMBOL_GOT_DISP symbols are loaded from the GOT. */
+ *low_out = mips_got_load (temp, addr, SYMBOL_GOTOFF_DISP);
+ break;
- The returned expression can be used as the first operand to a LO_SUM. */
+ case SYMBOL_GP_RELATIVE:
+ high = mips_pic_base_register (temp);
+ *low_out = gen_rtx_LO_SUM (Pmode, high, addr);
+ break;
-static rtx
-mips_unspec_offset_high (rtx temp, rtx base, rtx addr,
- enum mips_symbol_type symbol_type)
-{
- if (mips_split_p[symbol_type])
- {
- addr = gen_rtx_HIGH (Pmode, mips_unspec_address (addr, symbol_type));
- addr = mips_force_temporary (temp, addr);
- base = mips_force_temporary (temp, gen_rtx_PLUS (Pmode, addr, base));
+ default:
+ high = gen_rtx_HIGH (Pmode, copy_rtx (addr));
+ high = mips_force_temporary (temp, high);
+ *low_out = gen_rtx_LO_SUM (Pmode, high, addr);
+ break;
+ }
+ return true;
+ }
}
- return base;
+ return false;
}
/* Return a legitimate address for REG + OFFSET. TEMP is as for
@@ -2455,7 +2630,8 @@ mips_call_tls_get_addr (rtx sym, enum mips_symbol_type type, rtx v0)
emit_insn (gen_rtx_SET (Pmode, a0,
gen_rtx_LO_SUM (Pmode, pic_offset_table_rtx, loc)));
- insn = mips_expand_call (v0, mips_tls_symbol, const0_rtx, const0_rtx, false);
+ insn = mips_expand_call (MIPS_CALL_NORMAL, v0, mips_tls_symbol,
+ const0_rtx, NULL_RTX, false);
RTL_CONST_CALL_P (insn) = 1;
use_reg (&CALL_INSN_FUNCTION_USAGE (insn), a0);
insn = get_insns ();
@@ -2714,7 +2890,8 @@ mips_rewrite_small_data_p (rtx x, enum mips_symbol_context context)
{
enum mips_symbol_type symbol_type;
- return (TARGET_EXPLICIT_RELOCS
+ return (mips_lo_relocs[SYMBOL_GP_RELATIVE]
+ && !mips_split_p[SYMBOL_GP_RELATIVE]
&& mips_symbolic_constant_p (x, context, &symbol_type)
&& symbol_type == SYMBOL_GP_RELATIVE);
}
@@ -4959,12 +5136,12 @@ mips_va_start (tree valist, rtx nextarg)
if (cum->stack_words > 0)
t = build2 (POINTER_PLUS_EXPR, TREE_TYPE (ovfl), t,
size_int (cum->stack_words * UNITS_PER_WORD));
- t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (ovfl), ovfl, t);
+ t = build2 (MODIFY_EXPR, TREE_TYPE (ovfl), ovfl, t);
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
/* Emit code to initialize GTOP, the top of the GPR save area. */
t = make_tree (TREE_TYPE (gtop), virtual_incoming_args_rtx);
- t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (gtop), gtop, t);
+ t = build2 (MODIFY_EXPR, TREE_TYPE (gtop), gtop, t);
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
/* Emit code to initialize FTOP, the top of the FPR save area.
@@ -4976,18 +5153,18 @@ mips_va_start (tree valist, rtx nextarg)
if (fpr_offset)
t = build2 (POINTER_PLUS_EXPR, TREE_TYPE (ftop), t,
size_int (-fpr_offset));
- t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (ftop), ftop, t);
+ t = build2 (MODIFY_EXPR, TREE_TYPE (ftop), ftop, t);
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
/* Emit code to initialize GOFF, the offset from GTOP of the
next GPR argument. */
- t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (goff), goff,
+ t = build2 (MODIFY_EXPR, TREE_TYPE (goff), goff,
build_int_cst (TREE_TYPE (goff), gpr_save_area_size));
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
/* Likewise emit code to initialize FOFF, the offset from FTOP
of the next FPR argument. */
- t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (foff), foff,
+ t = build2 (MODIFY_EXPR, TREE_TYPE (foff), foff,
build_int_cst (TREE_TYPE (foff), fpr_save_area_size));
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
}
@@ -5001,7 +5178,8 @@ mips_va_start (tree valist, rtx nextarg)
/* Implement TARGET_GIMPLIFY_VA_ARG_EXPR. */
static tree
-mips_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, tree *post_p)
+mips_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p,
+ gimple_seq *post_p)
{
tree addr;
bool indirect_p;
@@ -5100,8 +5278,7 @@ mips_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, tree *post_p)
/* [1] Emit code for: off &= -rsize. */
t = build2 (BIT_AND_EXPR, TREE_TYPE (off), off,
build_int_cst (NULL_TREE, -rsize));
- t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (off), off, t);
- gimplify_and_add (t, pre_p);
+ gimplify_assign (off, t, pre_p);
}
osize = rsize;
}
@@ -5137,7 +5314,7 @@ mips_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, tree *post_p)
u = size_int (-osize);
t = build2 (BIT_AND_EXPR, sizetype, t, u);
t = fold_convert (TREE_TYPE (ovfl), t);
- align = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (ovfl), ovfl, t);
+ align = build2 (MODIFY_EXPR, TREE_TYPE (ovfl), ovfl, t);
}
else
align = NULL;
@@ -5168,6 +5345,153 @@ mips_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, tree *post_p)
return addr;
}
+/* Start a definition of function NAME. MIPS16_P indicates whether the
+ function contains MIPS16 code. */
+
+static void
+mips_start_function_definition (const char *name, bool mips16_p)
+{
+ if (mips16_p)
+ fprintf (asm_out_file, "\t.set\tmips16\n");
+ else
+ fprintf (asm_out_file, "\t.set\tnomips16\n");
+
+ if (!flag_inhibit_size_directive)
+ {
+ fputs ("\t.ent\t", asm_out_file);
+ assemble_name (asm_out_file, name);
+ fputs ("\n", asm_out_file);
+ }
+
+ ASM_OUTPUT_TYPE_DIRECTIVE (asm_out_file, name, "function");
+
+ /* Start the definition proper. */
+ assemble_name (asm_out_file, name);
+ fputs (":\n", asm_out_file);
+}
+
+/* End a function definition started by mips_start_function_definition. */
+
+static void
+mips_end_function_definition (const char *name)
+{
+ if (!flag_inhibit_size_directive)
+ {
+ fputs ("\t.end\t", asm_out_file);
+ assemble_name (asm_out_file, name);
+ fputs ("\n", asm_out_file);
+ }
+}
+
+/* Return true if calls to X can use R_MIPS_CALL* relocations. */
+
+static bool
+mips_ok_for_lazy_binding_p (rtx x)
+{
+ return (TARGET_USE_GOT
+ && GET_CODE (x) == SYMBOL_REF
+ && !SYMBOL_REF_BIND_NOW_P (x)
+ && !mips_symbol_binds_local_p (x));
+}
+
+/* Load function address ADDR into register DEST. TYPE is as for
+ mips_expand_call. Return true if we used an explicit lazy-binding
+ sequence. */
+
+static bool
+mips_load_call_address (enum mips_call_type type, rtx dest, rtx addr)
+{
+ /* If we're generating PIC, and this call is to a global function,
+ try to allow its address to be resolved lazily. This isn't
+ possible for sibcalls when $gp is call-saved because the value
+ of $gp on entry to the stub would be our caller's gp, not ours. */
+ if (TARGET_EXPLICIT_RELOCS
+ && !(type == MIPS_CALL_SIBCALL && TARGET_CALL_SAVED_GP)
+ && mips_ok_for_lazy_binding_p (addr))
+ {
+ addr = mips_got_load (dest, addr, SYMBOL_GOTOFF_CALL);
+ emit_insn (gen_rtx_SET (VOIDmode, dest, addr));
+ return true;
+ }
+ else
+ {
+ mips_emit_move (dest, addr);
+ return false;
+ }
+}
+
+/* Each locally-defined hard-float MIPS16 function has a local symbol
+ associated with it. This hash table maps the function symbol (FUNC)
+ to the local symbol (LOCAL). */
+struct mips16_local_alias GTY(()) {
+ rtx func;
+ rtx local;
+};
+static GTY ((param_is (struct mips16_local_alias))) htab_t mips16_local_aliases;
+
+/* Hash table callbacks for mips16_local_aliases. */
+
+static hashval_t
+mips16_local_aliases_hash (const void *entry)
+{
+ const struct mips16_local_alias *alias;
+
+ alias = (const struct mips16_local_alias *) entry;
+ return htab_hash_string (XSTR (alias->func, 0));
+}
+
+static int
+mips16_local_aliases_eq (const void *entry1, const void *entry2)
+{
+ const struct mips16_local_alias *alias1, *alias2;
+
+ alias1 = (const struct mips16_local_alias *) entry1;
+ alias2 = (const struct mips16_local_alias *) entry2;
+ return rtx_equal_p (alias1->func, alias2->func);
+}
+
+/* FUNC is the symbol for a locally-defined hard-float MIPS16 function.
+ Return a local alias for it, creating a new one if necessary. */
+
+static rtx
+mips16_local_alias (rtx func)
+{
+ struct mips16_local_alias *alias, tmp_alias;
+ void **slot;
+
+ /* Create the hash table if this is the first call. */
+ if (mips16_local_aliases == NULL)
+ mips16_local_aliases = htab_create_ggc (37, mips16_local_aliases_hash,
+ mips16_local_aliases_eq, NULL);
+
+ /* Look up the function symbol, creating a new entry if need be. */
+ tmp_alias.func = func;
+ slot = htab_find_slot (mips16_local_aliases, &tmp_alias, INSERT);
+ gcc_assert (slot != NULL);
+
+ alias = (struct mips16_local_alias *) *slot;
+ if (alias == NULL)
+ {
+ const char *func_name, *local_name;
+ rtx local;
+
+ /* Create a new SYMBOL_REF for the local symbol. The choice of
+ __fn_local_* is based on the __fn_stub_* names that we've
+ traditionally used for the non-MIPS16 stub. */
+ func_name = targetm.strip_name_encoding (XSTR (func, 0));
+ local_name = ACONCAT (("__fn_local_", func_name, NULL));
+ local = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (local_name));
+ SYMBOL_REF_FLAGS (local) = SYMBOL_REF_FLAGS (func) | SYMBOL_FLAG_LOCAL;
+
+ /* Create a new structure to represent the mapping. */
+ alias = GGC_NEW (struct mips16_local_alias);
+ alias->func = func;
+ alias->local = local;
+ *slot = alias;
+ }
+ return alias->local;
+}
+
/* A chained list of functions for which mips16_build_call_stub has already
generated a stub. NAME is the name of the function and FP_RET_P is true
if the function returns a value in floating-point registers. */
@@ -5178,6 +5502,18 @@ struct mips16_stub {
};
static struct mips16_stub *mips16_stubs;
+/* Return a SYMBOL_REF for a MIPS16 function called NAME. */
+
+static rtx
+mips16_stub_function (const char *name)
+{
+ rtx x;
+
+ x = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (name));
+ SYMBOL_REF_FLAGS (x) |= (SYMBOL_FLAG_EXTERNAL | SYMBOL_FLAG_FUNCTION);
+ return x;
+}
+
/* Return the two-character string that identifies floating-point
return mode MODE in the name of a MIPS16 function stub. */
@@ -5284,14 +5620,18 @@ mips_output_args_xfer (int fp_code, char direction)
static void
mips16_build_function_stub (void)
{
- const char *fnname, *separator;
+ const char *fnname, *alias_name, *separator;
char *secname, *stubname;
tree stubdecl;
unsigned int f;
+ rtx symbol, alias;
/* Create the name of the stub, and its unique section. */
- fnname = XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0);
- fnname = targetm.strip_name_encoding (fnname);
+ symbol = XEXP (DECL_RTL (current_function_decl), 0);
+ alias = mips16_local_alias (symbol);
+
+ fnname = targetm.strip_name_encoding (XSTR (symbol, 0));
+ alias_name = targetm.strip_name_encoding (XSTR (alias, 0));
secname = ACONCAT ((".mips16.fn.", fnname, NULL));
stubname = ACONCAT (("__fn_stub_", fnname, NULL));
@@ -5313,46 +5653,51 @@ mips16_build_function_stub (void)
}
fprintf (asm_out_file, ")\n");
- /* Write the preamble leading up to the function declaration. */
- fprintf (asm_out_file, "\t.set\tnomips16\n");
- switch_to_section (function_section (stubdecl));
- ASM_OUTPUT_ALIGN (asm_out_file,
- floor_log2 (FUNCTION_BOUNDARY / BITS_PER_UNIT));
+ /* Start the function definition. */
+ assemble_start_function (stubdecl, stubname);
+ mips_start_function_definition (stubname, false);
- /* ??? If FUNCTION_NAME_ALREADY_DECLARED is defined, then we are
- within a .ent, and we cannot emit another .ent. */
- if (!FUNCTION_NAME_ALREADY_DECLARED)
+ /* If generating abicalls code, either set up the global pointer or
+ switch to absolute mode. */
+ if (TARGET_ABSOLUTE_ABICALLS)
+ fprintf (asm_out_file, "\t.option\tpic0\n");
+ else if (TARGET_ABICALLS)
{
- fputs ("\t.ent\t", asm_out_file);
- assemble_name (asm_out_file, stubname);
- fputs ("\n", asm_out_file);
+ output_asm_insn ("%(.cpload\t%^%)", NULL);
+ /* Emit an R_MIPS_NONE relocation to tell the linker what the
+ target function is. Use a local GOT access when loading the
+ symbol, to cut down on the number of unnecessary GOT entries
+ for stubs that aren't needed. */
+ output_asm_insn (".reloc\t0,R_MIPS_NONE,%0", &symbol);
+ symbol = alias;
}
- /* Start the definition proper. */
- assemble_name (asm_out_file, stubname);
- fputs (":\n", asm_out_file);
-
/* Load the address of the MIPS16 function into $at. Do this first so
that targets with coprocessor interlocks can use an MFC1 to fill the
delay slot. */
fprintf (asm_out_file, "\t.set\tnoat\n");
- fprintf (asm_out_file, "\tla\t%s,", reg_names[GP_REG_FIRST + 1]);
- assemble_name (asm_out_file, fnname);
- fprintf (asm_out_file, "\n");
+ output_asm_insn ("la\t%@,%0", &symbol);
/* Move the arguments from floating-point registers to general registers. */
mips_output_args_xfer (crtl->args.info.fp_code, 'f');
/* Jump to the MIPS16 function. */
- fprintf (asm_out_file, "\tjr\t%s\n", reg_names[GP_REG_FIRST + 1]);
+ output_asm_insn ("jr\t%@", NULL);
fprintf (asm_out_file, "\t.set\tat\n");
- if (!FUNCTION_NAME_ALREADY_DECLARED)
- {
- fputs ("\t.end\t", asm_out_file);
- assemble_name (asm_out_file, stubname);
- fputs ("\n", asm_out_file);
- }
+ if (TARGET_ABSOLUTE_ABICALLS)
+ fprintf (asm_out_file, "\t.option\tpic2\n");
+
+ mips_end_function_definition (stubname);
+
+ /* If the linker needs to create a dynamic symbol for the target
+ function, it will associate the symbol with the stub (which,
+ unlike the target function, follows the proper calling conventions).
+ It is therefore useful to have a local alias for the target function,
+ so that it can still be identified as MIPS16 code. As an optimization,
+ this symbol can also be used for indirect MIPS16 references from
+ within this file. */
+ ASM_OUTPUT_DEF (asm_out_file, alias_name, fnname);
switch_to_section (function_section (current_function_decl));
}
@@ -5364,31 +5709,46 @@ mips16_build_function_stub (void)
static void
mips16_copy_fpr_return_value (void)
{
- rtx fn, insn, arg, call;
- tree id, return_type;
+ rtx fn, insn, retval;
+ tree return_type;
enum machine_mode return_mode;
+ const char *name;
return_type = DECL_RESULT (current_function_decl);
return_mode = DECL_MODE (return_type);
- id = get_identifier (ACONCAT (("__mips16_ret_",
- mips16_call_stub_mode_suffix (return_mode),
- NULL)));
- fn = gen_rtx_SYMBOL_REF (Pmode, IDENTIFIER_POINTER (id));
- arg = gen_rtx_REG (return_mode, GP_RETURN);
- call = gen_call_value_internal (arg, fn, const0_rtx);
- insn = mips_emit_call_insn (call, false);
- use_reg (&CALL_INSN_FUNCTION_USAGE (insn), arg);
+ name = ACONCAT (("__mips16_ret_",
+ mips16_call_stub_mode_suffix (return_mode),
+ NULL));
+ fn = mips16_stub_function (name);
+
+ /* The function takes arguments in $2 (and possibly $3), so calls
+ to it cannot be lazily bound. */
+ SYMBOL_REF_FLAGS (fn) |= SYMBOL_FLAG_BIND_NOW;
+
+ /* Model the call as something that takes the GPR return value as
+ argument and returns an "updated" value. */
+ retval = gen_rtx_REG (return_mode, GP_RETURN);
+ insn = mips_expand_call (MIPS_CALL_EPILOGUE, retval, fn,
+ const0_rtx, NULL_RTX, false);
+ use_reg (&CALL_INSN_FUNCTION_USAGE (insn), retval);
}
-/* Consider building a stub for a MIPS16 call to function FN.
+/* Consider building a stub for a MIPS16 call to function *FN_PTR.
RETVAL is the location of the return value, or null if this is
a "call" rather than a "call_value". ARGS_SIZE is the size of the
arguments and FP_CODE is the code built by mips_function_arg;
see the comment above CUMULATIVE_ARGS for details.
- If a stub was needed, emit the call and return the call insn itself.
- Return null otherwise.
+ There are three alternatives:
+
+ - If a stub was needed, emit the call and return the call insn itself.
+
+ - If we can avoid using a stub by redirecting the call, set *FN_PTR
+ to the new target and return null.
+
+ - If *FN_PTR doesn't need a stub, return null and leave *FN_PTR
+ unmodified.
A stub is needed for calls to functions that, in normal mode,
receive arguments in FPRs or return values in FPRs. The stub
@@ -5397,17 +5757,18 @@ mips16_copy_fpr_return_value (void)
return value from its hard-float position to its soft-float
position.
- We emit a JAL to FN even when FN might need a stub. If FN turns out
- to be to a non-MIPS16 function, the linker automatically redirects
- the JAL to the stub, otherwise the JAL continues to call FN directly. */
+ We can emit a JAL to *FN_PTR even when *FN_PTR might need a stub.
+ If *FN_PTR turns out to be to a non-MIPS16 function, the linker
+ automatically redirects the JAL to the stub, otherwise the JAL
+ continues to call FN directly. */
static rtx
-mips16_build_call_stub (rtx retval, rtx fn, rtx args_size, int fp_code)
+mips16_build_call_stub (rtx retval, rtx *fn_ptr, rtx args_size, int fp_code)
{
const char *fnname;
bool fp_ret_p;
struct mips16_stub *l;
- rtx insn;
+ rtx insn, fn;
/* We don't need to do anything if we aren't in MIPS16 mode, or if
we were invoked with the -msoft-float option. */
@@ -5426,8 +5787,8 @@ mips16_build_call_stub (rtx retval, rtx fn, rtx args_size, int fp_code)
/* We don't need to do anything if this is a call to a special
MIPS16 support function. */
- if (GET_CODE (fn) == SYMBOL_REF
- && strncmp (XSTR (fn, 0), "__mips16_", 9) == 0)
+ fn = *fn_ptr;
+ if (mips16_stub_function_p (fn))
return NULL_RTX;
/* This code will only work for o32 and o64 abis. The other ABI's
@@ -5437,11 +5798,20 @@ mips16_build_call_stub (rtx retval, rtx fn, rtx args_size, int fp_code)
/* If we're calling via a function pointer, use one of the magic
libgcc.a stubs provided for each (FP_CODE, FP_RET_P) combination.
Each stub expects the function address to arrive in register $2. */
- if (GET_CODE (fn) != SYMBOL_REF)
+ if (GET_CODE (fn) != SYMBOL_REF
+ || !call_insn_operand (fn, VOIDmode))
{
char buf[30];
- tree id;
- rtx stub_fn, insn;
+ rtx stub_fn, insn, addr;
+ bool lazy_p;
+
+ /* If this is a locally-defined and locally-binding function,
+ avoid the stub by calling the local alias directly. */
+ if (mips16_local_function_p (fn))
+ {
+ *fn_ptr = mips16_local_alias (fn);
+ return NULL_RTX;
+ }
/* Create a SYMBOL_REF for the libgcc.a function. */
if (fp_ret_p)
@@ -5450,24 +5820,22 @@ mips16_build_call_stub (rtx retval, rtx fn, rtx args_size, int fp_code)
fp_code);
else
sprintf (buf, "__mips16_call_stub_%d", fp_code);
- id = get_identifier (buf);
- stub_fn = gen_rtx_SYMBOL_REF (Pmode, IDENTIFIER_POINTER (id));
+ stub_fn = mips16_stub_function (buf);
+
+ /* The function uses $2 as an argument, so calls to it
+ cannot be lazily bound. */
+ SYMBOL_REF_FLAGS (stub_fn) |= SYMBOL_FLAG_BIND_NOW;
/* Load the target function into $2. */
- mips_emit_move (gen_rtx_REG (Pmode, 2), fn);
+ addr = gen_rtx_REG (Pmode, GP_REG_FIRST + 2);
+ lazy_p = mips_load_call_address (MIPS_CALL_NORMAL, addr, fn);
/* Emit the call. */
- if (retval == NULL_RTX)
- insn = gen_call_internal (stub_fn, args_size);
- else
- insn = gen_call_value_internal (retval, stub_fn, args_size);
- insn = mips_emit_call_insn (insn, false);
+ insn = mips_expand_call (MIPS_CALL_NORMAL, retval, stub_fn,
+ args_size, NULL_RTX, lazy_p);
/* Tell GCC that this call does indeed use the value of $2. */
- CALL_INSN_FUNCTION_USAGE (insn) =
- gen_rtx_EXPR_LIST (VOIDmode,
- gen_rtx_USE (VOIDmode, gen_rtx_REG (Pmode, 2)),
- CALL_INSN_FUNCTION_USAGE (insn));
+ use_reg (&CALL_INSN_FUNCTION_USAGE (insn), addr);
/* If we are handling a floating-point return value, we need to
save $18 in the function prologue. Putting a note on the
@@ -5477,8 +5845,8 @@ mips16_build_call_stub (rtx retval, rtx fn, rtx args_size, int fp_code)
if (fp_ret_p)
CALL_INSN_FUNCTION_USAGE (insn) =
gen_rtx_EXPR_LIST (VOIDmode,
- gen_rtx_USE (VOIDmode,
- gen_rtx_REG (word_mode, 18)),
+ gen_rtx_CLOBBER (VOIDmode,
+ gen_rtx_REG (word_mode, 18)),
CALL_INSN_FUNCTION_USAGE (insn));
return insn;
@@ -5532,19 +5900,9 @@ mips16_build_call_stub (rtx retval, rtx fn, rtx args_size, int fp_code)
}
fprintf (asm_out_file, ")\n");
- /* Write the preamble leading up to the function declaration. */
- fprintf (asm_out_file, "\t.set\tnomips16\n");
+ /* Start the function definition. */
assemble_start_function (stubdecl, stubname);
-
- if (!FUNCTION_NAME_ALREADY_DECLARED)
- {
- fputs ("\t.ent\t", asm_out_file);
- assemble_name (asm_out_file, stubname);
- fputs ("\n", asm_out_file);
-
- assemble_name (asm_out_file, stubname);
- fputs (":\n", asm_out_file);
- }
+ mips_start_function_definition (stubname, false);
if (!fp_ret_p)
{
@@ -5552,8 +5910,13 @@ mips16_build_call_stub (rtx retval, rtx fn, rtx args_size, int fp_code)
first so that targets with coprocessor interlocks can use
an MFC1 to fill the delay slot. */
fprintf (asm_out_file, "\t.set\tnoat\n");
- fprintf (asm_out_file, "\tla\t%s,%s\n", reg_names[GP_REG_FIRST + 1],
- fnname);
+ if (TARGET_EXPLICIT_RELOCS)
+ {
+ output_asm_insn ("lui\t%^,%%hi(%0)", &fn);
+ output_asm_insn ("addiu\t%^,%^,%%lo(%0)", &fn);
+ }
+ else
+ output_asm_insn ("la\t%^,%0", &fn);
}
/* Move the arguments from general registers to floating-point
@@ -5563,7 +5926,7 @@ mips16_build_call_stub (rtx retval, rtx fn, rtx args_size, int fp_code)
if (!fp_ret_p)
{
/* Jump to the previously-loaded address. */
- fprintf (asm_out_file, "\tjr\t%s\n", reg_names[GP_REG_FIRST + 1]);
+ output_asm_insn ("jr\t%^", NULL);
fprintf (asm_out_file, "\t.set\tat\n");
}
else
@@ -5573,7 +5936,7 @@ mips16_build_call_stub (rtx retval, rtx fn, rtx args_size, int fp_code)
$18 is usually a call-saved register. */
fprintf (asm_out_file, "\tmove\t%s,%s\n",
reg_names[GP_REG_FIRST + 18], reg_names[GP_REG_FIRST + 31]);
- fprintf (asm_out_file, "\tjal\t%s\n", fnname);
+ output_asm_insn (MIPS_CALL ("jal", &fn, 0), &fn);
/* Move the result from floating-point registers to
general registers. */
@@ -5619,12 +5982,7 @@ mips16_build_call_stub (rtx retval, rtx fn, rtx args_size, int fp_code)
ASM_DECLARE_FUNCTION_SIZE (asm_out_file, stubname, stubdecl);
#endif
- if (!FUNCTION_NAME_ALREADY_DECLARED)
- {
- fputs ("\t.end\t", asm_out_file);
- assemble_name (asm_out_file, stubname);
- fputs ("\n", asm_out_file);
- }
+ mips_end_function_definition (stubname);
/* Record this stub. */
l = XNEW (struct mips16_stub);
@@ -5648,7 +6006,7 @@ mips16_build_call_stub (rtx retval, rtx fn, rtx args_size, int fp_code)
insn = gen_call_internal_direct (fn, args_size);
else
insn = gen_call_value_internal_direct (retval, fn, args_size);
- insn = mips_emit_call_insn (insn, false);
+ insn = mips_emit_call_insn (insn, fn, fn, false);
/* If we are calling a stub which handles a floating-point return
value, we need to arrange to save $18 in the prologue. We do this
@@ -5657,113 +6015,114 @@ mips16_build_call_stub (rtx retval, rtx fn, rtx args_size, int fp_code)
if (fp_ret_p)
CALL_INSN_FUNCTION_USAGE (insn) =
gen_rtx_EXPR_LIST (VOIDmode,
- gen_rtx_USE (VOIDmode, gen_rtx_REG (word_mode, 18)),
+ gen_rtx_CLOBBER (VOIDmode,
+ gen_rtx_REG (word_mode, 18)),
CALL_INSN_FUNCTION_USAGE (insn));
return insn;
}
-/* Return true if calls to X can use R_MIPS_CALL* relocations. */
-
-static bool
-mips_ok_for_lazy_binding_p (rtx x)
-{
- return (TARGET_USE_GOT
- && GET_CODE (x) == SYMBOL_REF
- && !mips_symbol_binds_local_p (x));
-}
-
-/* Load function address ADDR into register DEST. SIBCALL_P is true
- if the address is needed for a sibling call. Return true if we
- used an explicit lazy-binding sequence. */
-
-static bool
-mips_load_call_address (rtx dest, rtx addr, bool sibcall_p)
-{
- /* If we're generating PIC, and this call is to a global function,
- try to allow its address to be resolved lazily. This isn't
- possible for sibcalls when $gp is call-saved because the value
- of $gp on entry to the stub would be our caller's gp, not ours. */
- if (TARGET_EXPLICIT_RELOCS
- && !(sibcall_p && TARGET_CALL_SAVED_GP)
- && mips_ok_for_lazy_binding_p (addr))
- {
- rtx high, lo_sum_symbol;
-
- high = mips_unspec_offset_high (dest, pic_offset_table_rtx,
- addr, SYMBOL_GOTOFF_CALL);
- lo_sum_symbol = mips_unspec_address (addr, SYMBOL_GOTOFF_CALL);
- if (Pmode == SImode)
- emit_insn (gen_load_callsi (dest, high, lo_sum_symbol));
- else
- emit_insn (gen_load_calldi (dest, high, lo_sum_symbol));
- return true;
- }
- else
- {
- mips_emit_move (dest, addr);
- return false;
- }
-}
-
-/* Expand a "call", "sibcall", "call_value" or "sibcall_value" instruction.
- RESULT is where the result will go (null for "call"s and "sibcall"s),
- ADDR is the address of the function, ARGS_SIZE is the size of the
- arguments and AUX is the value passed to us by mips_function_arg.
- SIBCALL_P is true if we are expanding a sibling call, false if we're
- expanding a normal call.
+/* Expand a call of type TYPE. RESULT is where the result will go (null
+ for "call"s and "sibcall"s), ADDR is the address of the function,
+ ARGS_SIZE is the size of the arguments and AUX is the value passed
+ to us by mips_function_arg. LAZY_P is true if this call already
+ involves a lazily-bound function address (such as when calling
+ functions through a MIPS16 hard-float stub).
Return the call itself. */
rtx
-mips_expand_call (rtx result, rtx addr, rtx args_size, rtx aux, bool sibcall_p)
+mips_expand_call (enum mips_call_type type, rtx result, rtx addr,
+ rtx args_size, rtx aux, bool lazy_p)
{
rtx orig_addr, pattern, insn;
- bool lazy_p;
+ int fp_code;
+ fp_code = aux == 0 ? 0 : (int) GET_MODE (aux);
+ insn = mips16_build_call_stub (result, &addr, args_size, fp_code);
+ if (insn)
+ {
+ gcc_assert (!lazy_p && type == MIPS_CALL_NORMAL);
+ return insn;
+ }
+ ;
orig_addr = addr;
- lazy_p = false;
if (!call_insn_operand (addr, VOIDmode))
{
- addr = gen_reg_rtx (Pmode);
- lazy_p = mips_load_call_address (addr, orig_addr, sibcall_p);
+ if (type == MIPS_CALL_EPILOGUE)
+ addr = MIPS_EPILOGUE_TEMP (Pmode);
+ else
+ addr = gen_reg_rtx (Pmode);
+ lazy_p |= mips_load_call_address (type, addr, orig_addr);
}
- insn = mips16_build_call_stub (result, addr, args_size,
- aux == 0 ? 0 : (int) GET_MODE (aux));
- if (insn)
+ if (result == 0)
{
- gcc_assert (!sibcall_p && !lazy_p);
- return insn;
- }
+ rtx (*fn) (rtx, rtx);
- if (result == 0)
- pattern = (sibcall_p
- ? gen_sibcall_internal (addr, args_size)
- : gen_call_internal (addr, args_size));
+ if (type == MIPS_CALL_EPILOGUE && TARGET_SPLIT_CALLS)
+ fn = gen_call_split;
+ else if (type == MIPS_CALL_SIBCALL)
+ fn = gen_sibcall_internal;
+ else
+ fn = gen_call_internal;
+
+ pattern = fn (addr, args_size);
+ }
else if (GET_CODE (result) == PARALLEL && XVECLEN (result, 0) == 2)
{
/* Handle return values created by mips_return_fpr_pair. */
+ rtx (*fn) (rtx, rtx, rtx, rtx);
rtx reg1, reg2;
+ if (type == MIPS_CALL_EPILOGUE && TARGET_SPLIT_CALLS)
+ fn = gen_call_value_multiple_split;
+ else if (type == MIPS_CALL_SIBCALL)
+ fn = gen_sibcall_value_multiple_internal;
+ else
+ fn = gen_call_value_multiple_internal;
+
reg1 = XEXP (XVECEXP (result, 0, 0), 0);
reg2 = XEXP (XVECEXP (result, 0, 1), 0);
- pattern =
- (sibcall_p
- ? gen_sibcall_value_multiple_internal (reg1, addr, args_size, reg2)
- : gen_call_value_multiple_internal (reg1, addr, args_size, reg2));
+ pattern = fn (reg1, addr, args_size, reg2);
}
else
{
+ rtx (*fn) (rtx, rtx, rtx);
+
+ if (type == MIPS_CALL_EPILOGUE && TARGET_SPLIT_CALLS)
+ fn = gen_call_value_split;
+ else if (type == MIPS_CALL_SIBCALL)
+ fn = gen_sibcall_value_internal;
+ else
+ fn = gen_call_value_internal;
+
/* Handle return values created by mips_return_fpr_single. */
if (GET_CODE (result) == PARALLEL && XVECLEN (result, 0) == 1)
result = XEXP (XVECEXP (result, 0, 0), 0);
- pattern = (sibcall_p
- ? gen_sibcall_value_internal (result, addr, args_size)
- : gen_call_value_internal (result, addr, args_size));
+ pattern = fn (result, addr, args_size);
}
- return mips_emit_call_insn (pattern, lazy_p);
+ return mips_emit_call_insn (pattern, orig_addr, addr, lazy_p);
+}
+
+/* Split call instruction INSN into a $gp-clobbering call and
+ (where necessary) an instruction to restore $gp from its save slot.
+ CALL_PATTERN is the pattern of the new call. */
+
+void
+mips_split_call (rtx insn, rtx call_pattern)
+{
+ rtx new_insn;
+
+ new_insn = emit_call_insn (call_pattern);
+ CALL_INSN_FUNCTION_USAGE (new_insn)
+ = copy_rtx (CALL_INSN_FUNCTION_USAGE (insn));
+ if (!find_reg_note (insn, REG_NORETURN, 0))
+ /* Pick a temporary register that is suitable for both MIPS16 and
+ non-MIPS16 code. $4 and $5 are used for returning complex double
+ values in soft-float code, so $6 is the first suitable candidate. */
+ mips_restore_gp (gen_rtx_REG (Pmode, GP_ARG_FIRST + 2));
}
/* Implement TARGET_FUNCTION_OK_FOR_SIBCALL. */
@@ -6310,6 +6669,7 @@ static void
mips_init_relocs (void)
{
memset (mips_split_p, '\0', sizeof (mips_split_p));
+ memset (mips_split_hi_p, '\0', sizeof (mips_split_hi_p));
memset (mips_hi_relocs, '\0', sizeof (mips_hi_relocs));
memset (mips_lo_relocs, '\0', sizeof (mips_lo_relocs));
@@ -6351,13 +6711,13 @@ mips_init_relocs (void)
mips_split_p[SYMBOL_GP_RELATIVE] = true;
mips_lo_relocs[SYMBOL_GP_RELATIVE] = "%gprel(";
}
+ else if (TARGET_EXPLICIT_RELOCS)
+ /* Small data constants are kept whole until after reload,
+ then lowered by mips_rewrite_small_data. */
+ mips_lo_relocs[SYMBOL_GP_RELATIVE] = "%gp_rel(";
if (TARGET_EXPLICIT_RELOCS)
{
- /* Small data constants are kept whole until after reload,
- then lowered by mips_rewrite_small_data. */
- mips_lo_relocs[SYMBOL_GP_RELATIVE] = "%gp_rel(";
-
mips_split_p[SYMBOL_GOT_PAGE_OFST] = true;
if (TARGET_NEWABI)
{
@@ -6369,6 +6729,9 @@ mips_init_relocs (void)
mips_lo_relocs[SYMBOL_GOTOFF_PAGE] = "%got(";
mips_lo_relocs[SYMBOL_GOT_PAGE_OFST] = "%lo(";
}
+ if (TARGET_MIPS16)
+ /* Expose the use of $28 as soon as possible. */
+ mips_split_hi_p[SYMBOL_GOT_PAGE_OFST] = true;
if (TARGET_XGOT)
{
@@ -6390,6 +6753,9 @@ mips_init_relocs (void)
else
mips_lo_relocs[SYMBOL_GOTOFF_DISP] = "%got(";
mips_lo_relocs[SYMBOL_GOTOFF_CALL] = "%call16(";
+ if (TARGET_MIPS16)
+ /* Expose the use of $28 as soon as possible. */
+ mips_split_p[SYMBOL_GOT_DISP] = true;
}
}
@@ -7879,6 +8245,19 @@ mips_function_has_gp_insn (void)
return cfun->machine->has_gp_insn_p;
}
+/* Return true if the current function returns its value in a floating-point
+ register in MIPS16 mode. */
+
+static bool
+mips16_cfun_returns_in_fpr_p (void)
+{
+ tree return_type = DECL_RESULT (current_function_decl);
+ return (TARGET_MIPS16
+ && TARGET_HARD_FLOAT_ABI
+ && !aggregate_value_p (return_type, current_function_decl)
+ && mips_return_mode_in_fpr_p (DECL_MODE (return_type)));
+}
+
/* Return the register that should be used as the global pointer
within this function. Return 0 if the function doesn't need
a global pointer. */
@@ -7921,6 +8300,7 @@ mips_global_pointer (void)
but no instruction will yet refer to it. */
if (!df_regs_ever_live_p (GLOBAL_POINTER_REGNUM)
&& !crtl->uses_const_pool
+ && !mips16_cfun_returns_in_fpr_p ()
&& !mips_function_has_gp_insn ())
return 0;
@@ -7937,19 +8317,6 @@ mips_global_pointer (void)
return GLOBAL_POINTER_REGNUM;
}
-/* Return true if the current function returns its value in a floating-point
- register in MIPS16 mode. */
-
-static bool
-mips16_cfun_returns_in_fpr_p (void)
-{
- tree return_type = DECL_RESULT (current_function_decl);
- return (TARGET_MIPS16
- && TARGET_HARD_FLOAT_ABI
- && !aggregate_value_p (return_type, current_function_decl)
- && mips_return_mode_in_fpr_p (DECL_MODE (return_type)));
-}
-
/* Return true if the current function must save register REGNO. */
static bool
@@ -8256,6 +8623,11 @@ mips_extra_live_on_entry (bitmap regs)
if (!TARGET_ABSOLUTE_ABICALLS)
bitmap_set_bit (regs, PIC_FUNCTION_ADDR_REGNUM);
+ /* The prologue may set MIPS16_PIC_TEMP_REGNUM to the value of
+ the global pointer. */
+ if (TARGET_MIPS16)
+ bitmap_set_bit (regs, MIPS16_PIC_TEMP_REGNUM);
+
/* See the comment above load_call<mode> for details. */
bitmap_set_bit (regs, GOT_VERSION_REGNUM);
}
@@ -8288,20 +8660,45 @@ mips_set_return_address (rtx address, rtx scratch)
mips_emit_move (gen_frame_mem (GET_MODE (address), slot_address), address);
}
-/* Restore $gp from its save slot. Valid only when using o32 or
- o64 abicalls. */
+/* Return a MEM rtx for the cprestore slot, using TEMP as a temporary base
+ register if need be. */
-void
-mips_restore_gp (void)
+static rtx
+mips_cprestore_slot (rtx temp)
{
- rtx base, address;
+ const struct mips_frame_info *frame;
+ rtx base;
+ HOST_WIDE_INT offset;
+
+ frame = &cfun->machine->frame;
+ if (frame_pointer_needed)
+ {
+ base = hard_frame_pointer_rtx;
+ offset = frame->args_size - frame->hard_frame_pointer_offset;
+ }
+ else
+ {
+ base = stack_pointer_rtx;
+ offset = frame->args_size;
+ }
+ return gen_frame_mem (Pmode, mips_add_offset (temp, base, offset));
+}
+/* Restore $gp from its save slot, using TEMP as a temporary base register
+ if need be. This function is for o32 and o64 abicalls only. */
+
+void
+mips_restore_gp (rtx temp)
+{
gcc_assert (TARGET_ABICALLS && TARGET_OLDABI);
- base = frame_pointer_needed ? hard_frame_pointer_rtx : stack_pointer_rtx;
- address = mips_add_offset (pic_offset_table_rtx, base,
- crtl->outgoing_args_size);
- mips_emit_move (pic_offset_table_rtx, gen_frame_mem (Pmode, address));
+ if (TARGET_MIPS16)
+ {
+ mips_emit_move (temp, mips_cprestore_slot (temp));
+ mips_emit_move (pic_offset_table_rtx, temp);
+ }
+ else
+ mips_emit_move (pic_offset_table_rtx, mips_cprestore_slot (temp));
if (!TARGET_EXPLICIT_RELOCS)
emit_insn (gen_blockage ());
}
@@ -8393,29 +8790,11 @@ mips_output_function_prologue (FILE *file, HOST_WIDE_INT size ATTRIBUTE_UNUSED)
&& crtl->args.info.fp_code != 0)
mips16_build_function_stub ();
- /* Select the MIPS16 mode for this function. */
- if (TARGET_MIPS16)
- fprintf (file, "\t.set\tmips16\n");
- else
- fprintf (file, "\t.set\tnomips16\n");
-
- if (!FUNCTION_NAME_ALREADY_DECLARED)
- {
- /* Get the function name the same way that toplev.c does before calling
- assemble_start_function. This is needed so that the name used here
- exactly matches the name used in ASM_DECLARE_FUNCTION_NAME. */
- fnname = XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0);
-
- if (!flag_inhibit_size_directive)
- {
- fputs ("\t.ent\t", file);
- assemble_name (file, fnname);
- fputs ("\n", file);
- }
-
- assemble_name (file, fnname);
- fputs (":\n", file);
- }
+ /* Get the function name the same way that toplev.c does before calling
+ assemble_start_function. This is needed so that the name used here
+ exactly matches the name used in ASM_DECLARE_FUNCTION_NAME. */
+ fnname = XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0);
+ mips_start_function_definition (fnname, TARGET_MIPS16);
/* Stop mips_file_end from treating this function as external. */
if (TARGET_IRIX && mips_abi == ABI_32)
@@ -8461,8 +8840,18 @@ mips_output_function_prologue (FILE *file, HOST_WIDE_INT size ATTRIBUTE_UNUSED)
that need it. */
if (mips_current_loadgp_style () == LOADGP_OLDABI)
{
+ if (TARGET_MIPS16)
+ {
+ /* This is a fixed-form sequence. The position of the
+ first two instructions is important because of the
+ way _gp_disp is defined. */
+ output_asm_insn ("li\t$2,%%hi(_gp_disp)", 0);
+ output_asm_insn ("addiu\t$3,$pc,%%lo(_gp_disp)", 0);
+ output_asm_insn ("sll\t$2,16", 0);
+ output_asm_insn ("addu\t$2,$3", 0);
+ }
/* .cpload must be in a .set noreorder but not a .set nomacro block. */
- if (!cfun->machine->all_noreorder_p)
+ else if (!cfun->machine->all_noreorder_p)
output_asm_insn ("%(.cpload\t%^%)", 0);
else
output_asm_insn ("%(.cpload\t%^\n\t%<", 0);
@@ -8482,6 +8871,8 @@ static void
mips_output_function_epilogue (FILE *file ATTRIBUTE_UNUSED,
HOST_WIDE_INT size ATTRIBUTE_UNUSED)
{
+ const char *fnname;
+
/* Reinstate the normal $gp. */
SET_REGNO (pic_offset_table_rtx, GLOBAL_POINTER_REGNUM);
mips_output_cplocal ();
@@ -8494,18 +8885,11 @@ mips_output_function_epilogue (FILE *file ATTRIBUTE_UNUSED,
set_noreorder = set_nomacro = 0;
}
- if (!FUNCTION_NAME_ALREADY_DECLARED && !flag_inhibit_size_directive)
- {
- const char *fnname;
-
- /* Get the function name the same way that toplev.c does before calling
- assemble_start_function. This is needed so that the name used here
- exactly matches the name used in ASM_DECLARE_FUNCTION_NAME. */
- fnname = XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0);
- fputs ("\t.end\t", file);
- assemble_name (file, fnname);
- fputs ("\n", file);
- }
+ /* Get the function name the same way that toplev.c does before calling
+ assemble_start_function. This is needed so that the name used here
+ exactly matches the name used in ASM_DECLARE_FUNCTION_NAME. */
+ fnname = XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0);
+ mips_end_function_definition (fnname);
}
/* Save register REG to MEM. Make the instruction frame-related. */
@@ -8559,7 +8943,7 @@ mips_emit_loadgp (void)
{
rtx addr, offset, incoming_address, base, index, pic_reg;
- pic_reg = pic_offset_table_rtx;
+ pic_reg = TARGET_MIPS16 ? MIPS16_PIC_TEMP : pic_offset_table_rtx;
switch (mips_current_loadgp_style ())
{
case LOADGP_ABSOLUTE:
@@ -8573,6 +8957,10 @@ mips_emit_loadgp (void)
: gen_loadgp_absolute_di (pic_reg, mips_gnu_local_gp));
break;
+ case LOADGP_OLDABI:
+ /* Added by mips_output_function_prologue. */
+ break;
+
case LOADGP_NEWABI:
addr = XEXP (DECL_RTL (current_function_decl), 0);
offset = mips_unspec_address (addr, SYMBOL_GOTOFF_LOADGP);
@@ -8593,6 +8981,10 @@ mips_emit_loadgp (void)
default:
return;
}
+
+ if (TARGET_MIPS16)
+ emit_insn (gen_copygp_mips16 (pic_offset_table_rtx, pic_reg));
+
/* Emit a blockage if there are implicit uses of the GP register.
This includes profiled functions, because FUNCTION_PROFILE uses
a jal macro. */
@@ -8728,7 +9120,13 @@ mips_expand_prologue (void)
/* Initialize the $gp save slot. */
if (frame->cprestore_size > 0)
- emit_insn (gen_cprestore (GEN_INT (crtl->outgoing_args_size)));
+ {
+ if (TARGET_MIPS16)
+ mips_emit_move (mips_cprestore_slot (MIPS_PROLOGUE_TEMP (Pmode)),
+ MIPS16_PIC_TEMP);
+ else
+ emit_insn (gen_cprestore (GEN_INT (frame->args_size)));
+ }
/* If we are profiling, make sure no instructions are scheduled before
the call to mcount. */
@@ -8950,7 +9348,7 @@ static bool
mips_hard_regno_mode_ok_p (unsigned int regno, enum machine_mode mode)
{
unsigned int size;
- enum mode_class class;
+ enum mode_class mclass;
if (mode == CCV2mode)
return (ISA_HAS_8CC
@@ -8973,7 +9371,7 @@ mips_hard_regno_mode_ok_p (unsigned int regno, enum machine_mode mode)
}
size = GET_MODE_SIZE (mode);
- class = GET_MODE_CLASS (mode);
+ mclass = GET_MODE_CLASS (mode);
if (GP_REG_P (regno))
return ((regno - GP_REG_FIRST) & 1) == 0 || size <= UNITS_PER_WORD;
@@ -8994,16 +9392,16 @@ mips_hard_regno_mode_ok_p (unsigned int regno, enum machine_mode mode)
|| mode == DImode))
return true;
- if (class == MODE_FLOAT
- || class == MODE_COMPLEX_FLOAT
- || class == MODE_VECTOR_FLOAT)
+ if (mclass == MODE_FLOAT
+ || mclass == MODE_COMPLEX_FLOAT
+ || mclass == MODE_VECTOR_FLOAT)
return size <= UNITS_PER_FPVALUE;
/* Allow integer modes that fit into a single register. We need
to put integers into FPRs when using instructions like CVT
and TRUNC. There's no point allowing sizes smaller than a word,
because the FPU has no appropriate load/store instructions. */
- if (class == MODE_INT)
+ if (mclass == MODE_INT)
return size >= MIN_UNITS_PER_WORD && size <= UNITS_PER_FPREG;
}
@@ -9037,7 +9435,7 @@ mips_hard_regno_mode_ok_p (unsigned int regno, enum machine_mode mode)
}
if (ALL_COP_REG_P (regno))
- return class == MODE_INT && size <= UNITS_PER_WORD;
+ return mclass == MODE_INT && size <= UNITS_PER_WORD;
if (regno == GOT_VERSION_REGNUM)
return mode == SImode;
@@ -9066,13 +9464,13 @@ mips_hard_regno_nregs (int regno, enum machine_mode mode)
in mips_hard_regno_nregs. */
int
-mips_class_max_nregs (enum reg_class class, enum machine_mode mode)
+mips_class_max_nregs (enum reg_class rclass, enum machine_mode mode)
{
int size;
HARD_REG_SET left;
size = 0x8000;
- COPY_HARD_REG_SET (left, reg_class_contents[(int) class]);
+ COPY_HARD_REG_SET (left, reg_class_contents[(int) rclass]);
if (hard_reg_set_intersect_p (left, reg_class_contents[(int) ST_REGS]))
{
size = MIN (size, 4);
@@ -9093,7 +9491,7 @@ mips_class_max_nregs (enum reg_class class, enum machine_mode mode)
bool
mips_cannot_change_mode_class (enum machine_mode from ATTRIBUTE_UNUSED,
enum machine_mode to ATTRIBUTE_UNUSED,
- enum reg_class class)
+ enum reg_class rclass)
{
/* There are several problems with changing the modes of values
in floating-point registers:
@@ -9116,7 +9514,7 @@ mips_cannot_change_mode_class (enum machine_mode from ATTRIBUTE_UNUSED,
not ask it to treat the value as having a different format.
We therefore disallow all mode changes involving FPRs. */
- return reg_classes_intersect_p (FP_REGS, class);
+ return reg_classes_intersect_p (FP_REGS, rclass);
}
/* Return true if moves in mode MODE can use the FPU's mov.fmt instruction. */
@@ -9155,22 +9553,22 @@ mips_modes_tieable_p (enum machine_mode mode1, enum machine_mode mode2)
/* Implement PREFERRED_RELOAD_CLASS. */
enum reg_class
-mips_preferred_reload_class (rtx x, enum reg_class class)
+mips_preferred_reload_class (rtx x, enum reg_class rclass)
{
- if (mips_dangerous_for_la25_p (x) && reg_class_subset_p (LEA_REGS, class))
+ if (mips_dangerous_for_la25_p (x) && reg_class_subset_p (LEA_REGS, rclass))
return LEA_REGS;
- if (reg_class_subset_p (FP_REGS, class)
+ if (reg_class_subset_p (FP_REGS, rclass)
&& mips_mode_ok_for_mov_fmt_p (GET_MODE (x)))
return FP_REGS;
- if (reg_class_subset_p (GR_REGS, class))
- class = GR_REGS;
+ if (reg_class_subset_p (GR_REGS, rclass))
+ rclass = GR_REGS;
- if (TARGET_MIPS16 && reg_class_subset_p (M16_REGS, class))
- class = M16_REGS;
+ if (TARGET_MIPS16 && reg_class_subset_p (M16_REGS, rclass))
+ rclass = M16_REGS;
- return class;
+ return rclass;
}
/* Implement REGISTER_MOVE_COST. */
@@ -9232,13 +9630,13 @@ mips_register_move_cost (enum machine_mode mode,
}
/* Return the register class required for a secondary register when
- copying between one of the registers in CLASS and value X, which
+ copying between one of the registers in RCLASS and value X, which
has mode MODE. X is the source of the move if IN_P, otherwise it
is the destination. Return NO_REGS if no secondary register is
needed. */
enum reg_class
-mips_secondary_reload_class (enum reg_class class,
+mips_secondary_reload_class (enum reg_class rclass,
enum machine_mode mode, rtx x, bool in_p)
{
int regno;
@@ -9246,17 +9644,17 @@ mips_secondary_reload_class (enum reg_class class,
/* If X is a constant that cannot be loaded into $25, it must be loaded
into some other GPR. No other register class allows a direct move. */
if (mips_dangerous_for_la25_p (x))
- return reg_class_subset_p (class, LEA_REGS) ? NO_REGS : LEA_REGS;
+ return reg_class_subset_p (rclass, LEA_REGS) ? NO_REGS : LEA_REGS;
regno = true_regnum (x);
if (TARGET_MIPS16)
{
/* In MIPS16 mode, every move must involve a member of M16_REGS. */
- if (!reg_class_subset_p (class, M16_REGS) && !M16_REG_P (regno))
+ if (!reg_class_subset_p (rclass, M16_REGS) && !M16_REG_P (regno))
return M16_REGS;
/* We can't really copy to HI or LO at all in MIPS16 mode. */
- if (in_p ? reg_classes_intersect_p (class, ACC_REGS) : ACC_REG_P (regno))
+ if (in_p ? reg_classes_intersect_p (rclass, ACC_REGS) : ACC_REG_P (regno))
return M16_REGS;
return NO_REGS;
@@ -9264,16 +9662,16 @@ mips_secondary_reload_class (enum reg_class class,
/* Copying from accumulator registers to anywhere other than a general
register requires a temporary general register. */
- if (reg_class_subset_p (class, ACC_REGS))
+ if (reg_class_subset_p (rclass, ACC_REGS))
return GP_REG_P (regno) ? NO_REGS : GR_REGS;
if (ACC_REG_P (regno))
- return reg_class_subset_p (class, GR_REGS) ? NO_REGS : GR_REGS;
+ return reg_class_subset_p (rclass, GR_REGS) ? NO_REGS : GR_REGS;
/* We can only copy a value to a condition code register from a
floating-point register, and even then we require a scratch
floating-point register. We can only copy a value out of a
condition-code register into a general register. */
- if (reg_class_subset_p (class, ST_REGS))
+ if (reg_class_subset_p (rclass, ST_REGS))
{
if (in_p)
return FP_REGS;
@@ -9283,10 +9681,10 @@ mips_secondary_reload_class (enum reg_class class,
{
if (!in_p)
return FP_REGS;
- return reg_class_subset_p (class, GR_REGS) ? NO_REGS : GR_REGS;
+ return reg_class_subset_p (rclass, GR_REGS) ? NO_REGS : GR_REGS;
}
- if (reg_class_subset_p (class, FP_REGS))
+ if (reg_class_subset_p (rclass, FP_REGS))
{
if (MEM_P (x)
&& (GET_MODE_SIZE (mode) == 4 || GET_MODE_SIZE (mode) == 8))
@@ -9312,7 +9710,7 @@ mips_secondary_reload_class (enum reg_class class,
return GR_REGS;
}
if (FP_REG_P (regno))
- return reg_class_subset_p (class, GR_REGS) ? NO_REGS : GR_REGS;
+ return reg_class_subset_p (rclass, GR_REGS) ? NO_REGS : GR_REGS;
return NO_REGS;
}
@@ -11480,6 +11878,7 @@ mips16_lay_out_constants (void)
if (!TARGET_MIPS16_PCREL_LOADS)
return;
+ split_all_insns_noflow ();
barrier = 0;
memset (&pool, 0, sizeof (pool));
for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
@@ -12114,6 +12513,11 @@ mips_reorg_process_insns (void)
cfun->machine->all_noreorder_p = true;
+ /* We don't track MIPS16 PC-relative offsets closely enough to make
+ a good job of "set .noreorder" code in MIPS16 mode. */
+ if (TARGET_MIPS16)
+ cfun->machine->all_noreorder_p = false;
+
/* Code that doesn't use explicit relocs can't be ".set nomacro". */
if (!TARGET_EXPLICIT_RELOCS)
cfun->machine->all_noreorder_p = false;
@@ -12203,7 +12607,10 @@ mips_reorg (void)
if (mips_base_delayed_branch)
dbr_schedule (get_insns ());
mips_reorg_process_insns ();
- if (TARGET_EXPLICIT_RELOCS && TUNE_MIPS4130 && TARGET_VR4130_ALIGN)
+ if (!TARGET_MIPS16
+ && TARGET_EXPLICIT_RELOCS
+ && TUNE_MIPS4130
+ && TARGET_VR4130_ALIGN)
vr4130_align_insns ();
}
@@ -12215,7 +12622,7 @@ mips_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
HOST_WIDE_INT delta, HOST_WIDE_INT vcall_offset,
tree function)
{
- rtx this, temp1, temp2, insn, fnaddr;
+ rtx this_rtx, temp1, temp2, insn, fnaddr;
bool use_sibcall_p;
/* Pretend to be a post-reload pass while generating rtl. */
@@ -12230,24 +12637,19 @@ mips_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
&& const_call_insn_operand (fnaddr, Pmode));
/* Determine if we need to load FNADDR from the GOT. */
- if (!use_sibcall_p)
- switch (mips_classify_symbol (fnaddr, SYMBOL_CONTEXT_LEA))
- {
- case SYMBOL_GOT_PAGE_OFST:
- case SYMBOL_GOT_DISP:
- /* Pick a global pointer. Use a call-clobbered register if
- TARGET_CALL_SAVED_GP. */
- cfun->machine->global_pointer =
- TARGET_CALL_SAVED_GP ? 15 : GLOBAL_POINTER_REGNUM;
- SET_REGNO (pic_offset_table_rtx, cfun->machine->global_pointer);
-
- /* Set up the global pointer for n32 or n64 abicalls. */
- mips_emit_loadgp ();
- break;
+ if (!use_sibcall_p
+ && (mips_got_symbol_type_p
+ (mips_classify_symbol (fnaddr, SYMBOL_CONTEXT_LEA))))
+ {
+ /* Pick a global pointer. Use a call-clobbered register if
+ TARGET_CALL_SAVED_GP. */
+ cfun->machine->global_pointer
+ = TARGET_CALL_SAVED_GP ? 15 : GLOBAL_POINTER_REGNUM;
+ SET_REGNO (pic_offset_table_rtx, cfun->machine->global_pointer);
- default:
- break;
- }
+ /* Set up the global pointer for n32 or n64 abicalls. */
+ mips_emit_loadgp ();
+ }
/* We need two temporary registers in some cases. */
temp1 = gen_rtx_REG (Pmode, 2);
@@ -12255,11 +12657,11 @@ mips_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
/* Find out which register contains the "this" pointer. */
if (aggregate_value_p (TREE_TYPE (TREE_TYPE (function)), function))
- this = gen_rtx_REG (Pmode, GP_ARG_FIRST + 1);
+ this_rtx = gen_rtx_REG (Pmode, GP_ARG_FIRST + 1);
else
- this = gen_rtx_REG (Pmode, GP_ARG_FIRST);
+ this_rtx = gen_rtx_REG (Pmode, GP_ARG_FIRST);
- /* Add DELTA to THIS. */
+ /* Add DELTA to THIS_RTX. */
if (delta != 0)
{
rtx offset = GEN_INT (delta);
@@ -12268,23 +12670,23 @@ mips_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
mips_emit_move (temp1, offset);
offset = temp1;
}
- emit_insn (gen_add3_insn (this, this, offset));
+ emit_insn (gen_add3_insn (this_rtx, this_rtx, offset));
}
- /* If needed, add *(*THIS + VCALL_OFFSET) to THIS. */
+ /* If needed, add *(*THIS_RTX + VCALL_OFFSET) to THIS_RTX. */
if (vcall_offset != 0)
{
rtx addr;
- /* Set TEMP1 to *THIS. */
- mips_emit_move (temp1, gen_rtx_MEM (Pmode, this));
+ /* Set TEMP1 to *THIS_RTX. */
+ mips_emit_move (temp1, gen_rtx_MEM (Pmode, this_rtx));
- /* Set ADDR to a legitimate address for *THIS + VCALL_OFFSET. */
+ /* Set ADDR to a legitimate address for *THIS_RTX + VCALL_OFFSET. */
addr = mips_add_offset (temp2, temp1, vcall_offset);
- /* Load the offset and add it to THIS. */
+ /* Load the offset and add it to THIS_RTX. */
mips_emit_move (temp1, gen_rtx_MEM (Pmode, addr));
- emit_insn (gen_add3_insn (this, this, temp1));
+ emit_insn (gen_add3_insn (this_rtx, this_rtx, temp1));
}
/* Jump to the target function. Use a sibcall if direct jumps are
@@ -12306,12 +12708,17 @@ mips_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
We must therefore load the address via a temporary
register if mips_dangerous_for_la25_p.
- If we jump to the temporary register rather than $25, the assembler
- can use the move insn to fill the jump's delay slot. */
+ If we jump to the temporary register rather than $25,
+ the assembler can use the move insn to fill the jump's
+ delay slot.
+
+ We can use the same technique for MIPS16 code, where $25
+ is not a valid JR register. */
if (TARGET_USE_PIC_FN_ADDR_REG
+ && !TARGET_MIPS16
&& !mips_dangerous_for_la25_p (fnaddr))
temp1 = gen_rtx_REG (Pmode, PIC_FUNCTION_ADDR_REGNUM);
- mips_load_call_address (temp1, fnaddr, true);
+ mips_load_call_address (MIPS_CALL_SIBCALL, temp1, fnaddr);
if (TARGET_USE_PIC_FN_ADDR_REG
&& REGNO (temp1) != PIC_FUNCTION_ADDR_REGNUM)
@@ -12385,11 +12792,7 @@ mips_set_mips16_mode (int mips16_p)
call. */
flag_move_loop_invariants = 0;
- /* Silently disable -mexplicit-relocs since it doesn't apply
- to MIPS16 code. Even so, it would overly pedantic to warn
- about "-mips16 -mexplicit-relocs", especially given that
- we use a %gprel() operator. */
- target_flags &= ~MASK_EXPLICIT_RELOCS;
+ target_flags |= MASK_EXPLICIT_RELOCS;
/* Experiments suggest we get the best overall section-anchor
results from using the range of an unextended LW or SW. Code
@@ -12399,8 +12802,11 @@ mips_set_mips16_mode (int mips16_p)
targetm.min_anchor_offset = 0;
targetm.max_anchor_offset = 127;
- if (flag_pic || TARGET_ABICALLS)
- sorry ("MIPS16 PIC");
+ if (flag_pic && !TARGET_OLDABI)
+ sorry ("MIPS16 PIC for ABIs other than o32 and o64");
+
+ if (TARGET_XGOT)
+ sorry ("MIPS16 -mxgot code");
if (TARGET_HARD_FLOAT_ABI && !TARGET_OLDABI)
sorry ("hard-float MIPS16 code for ABIs other than o32 and o64");
diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h
index 8518a86233b..ffeef0a16d4 100644
--- a/gcc/config/mips/mips.h
+++ b/gcc/config/mips/mips.h
@@ -204,7 +204,7 @@ enum mips_code_readable_setting {
/* Generate mips16 code */
#define TARGET_MIPS16 ((target_flags & MASK_MIPS16) != 0)
-/* Generate mips16e code. Default 16bit ASE for mips32/mips32r2/mips64 */
+/* Generate mips16e code. Default 16bit ASE for mips32* and mips64* */
#define GENERATE_MIPS16E (TARGET_MIPS16 && mips_isa >= 32)
/* Generate mips16e register save/restore sequences. */
#define GENERATE_MIPS16E_SAVE_RESTORE (GENERATE_MIPS16E && mips_abi == ABI_32)
@@ -227,8 +227,12 @@ enum mips_code_readable_setting {
#define ISA_MIPS32 (mips_isa == 32)
#define ISA_MIPS32R2 (mips_isa == 33)
#define ISA_MIPS64 (mips_isa == 64)
+#define ISA_MIPS64R2 (mips_isa == 65)
/* Architecture target defines. */
+#define TARGET_LOONGSON_2E (mips_arch == PROCESSOR_LOONGSON_2E)
+#define TARGET_LOONGSON_2F (mips_arch == PROCESSOR_LOONGSON_2F)
+#define TARGET_LOONGSON_2EF (TARGET_LOONGSON_2E || TARGET_LOONGSON_2F)
#define TARGET_MIPS3900 (mips_arch == PROCESSOR_R3900)
#define TARGET_MIPS4000 (mips_arch == PROCESSOR_R4000)
#define TARGET_MIPS4120 (mips_arch == PROCESSOR_R4120)
@@ -240,11 +244,18 @@ enum mips_code_readable_setting {
#define TARGET_SB1 (mips_arch == PROCESSOR_SB1 \
|| mips_arch == PROCESSOR_SB1A)
#define TARGET_SR71K (mips_arch == PROCESSOR_SR71000)
-#define TARGET_LOONGSON_2E (mips_arch == PROCESSOR_LOONGSON_2E)
-#define TARGET_LOONGSON_2F (mips_arch == PROCESSOR_LOONGSON_2F)
-#define TARGET_LOONGSON_2EF (TARGET_LOONGSON_2E || TARGET_LOONGSON_2F)
/* Scheduling target defines. */
+#define TUNE_20KC (mips_tune == PROCESSOR_20KC)
+#define TUNE_24K (mips_tune == PROCESSOR_24KC \
+ || mips_tune == PROCESSOR_24KF2_1 \
+ || mips_tune == PROCESSOR_24KF1_1)
+#define TUNE_74K (mips_tune == PROCESSOR_74KC \
+ || mips_tune == PROCESSOR_74KF2_1 \
+ || mips_tune == PROCESSOR_74KF1_1 \
+ || mips_tune == PROCESSOR_74KF3_2)
+#define TUNE_LOONGSON_2EF (mips_tune == PROCESSOR_LOONGSON_2E \
+ || mips_tune == PROCESSOR_LOONGSON_2F)
#define TUNE_MIPS3000 (mips_tune == PROCESSOR_R3000)
#define TUNE_MIPS3900 (mips_tune == PROCESSOR_R3900)
#define TUNE_MIPS4000 (mips_tune == PROCESSOR_R4000)
@@ -258,16 +269,6 @@ enum mips_code_readable_setting {
#define TUNE_MIPS9000 (mips_tune == PROCESSOR_R9000)
#define TUNE_SB1 (mips_tune == PROCESSOR_SB1 \
|| mips_tune == PROCESSOR_SB1A)
-#define TUNE_24K (mips_tune == PROCESSOR_24KC \
- || mips_tune == PROCESSOR_24KF2_1 \
- || mips_tune == PROCESSOR_24KF1_1)
-#define TUNE_74K (mips_tune == PROCESSOR_74KC \
- || mips_tune == PROCESSOR_74KF2_1 \
- || mips_tune == PROCESSOR_74KF1_1 \
- || mips_tune == PROCESSOR_74KF3_2)
-#define TUNE_20KC (mips_tune == PROCESSOR_20KC)
-#define TUNE_LOONGSON_2EF (mips_tune == PROCESSOR_LOONGSON_2E \
- || mips_tune == PROCESSOR_LOONGSON_2F)
/* Whether vector modes and intrinsics for ST Microelectronics
Loongson-2E/2F processors should be enabled. In o32 pairs of
@@ -452,6 +453,12 @@ enum mips_code_readable_setting {
builtin_define ("__mips_isa_rev=1"); \
builtin_define ("_MIPS_ISA=_MIPS_ISA_MIPS64"); \
} \
+ else if (ISA_MIPS64R2) \
+ { \
+ builtin_define ("__mips=64"); \
+ builtin_define ("__mips_isa_rev=2"); \
+ builtin_define ("_MIPS_ISA=_MIPS_ISA_MIPS64"); \
+ } \
\
switch (mips_abi) \
{ \
@@ -619,7 +626,11 @@ enum mips_code_readable_setting {
# if MIPS_ISA_DEFAULT == 64
# define MULTILIB_ISA_DEFAULT "mips64"
# else
-# define MULTILIB_ISA_DEFAULT "mips1"
+# if MIPS_ISA_DEFAULT == 65
+# define MULTILIB_ISA_DEFAULT "mips64r2"
+# else
+# define MULTILIB_ISA_DEFAULT "mips1"
+# endif
# endif
# endif
# endif
@@ -670,6 +681,7 @@ enum mips_code_readable_setting {
%{march=mips32r2|march=m4k|march=4ke*|march=4ksd|march=24k* \
|march=34k*|march=74k*: -mips32r2} \
%{march=mips64|march=5k*|march=20k*|march=sb1*|march=sr71000: -mips64} \
+ %{march=mips64r2: -mips64r2} \
%{!march=*: -" MULTILIB_ISA_DEFAULT "}}"
/* A spec that infers a -mhard-float or -msoft-float setting from an
@@ -726,7 +738,8 @@ enum mips_code_readable_setting {
/* ISA has instructions for managing 64-bit fp and gp regs (e.g. mips3). */
#define ISA_HAS_64BIT_REGS (ISA_MIPS3 \
|| ISA_MIPS4 \
- || ISA_MIPS64)
+ || ISA_MIPS64 \
+ || ISA_MIPS64R2)
/* ISA has branch likely instructions (e.g. mips2). */
/* Disable branchlikely for tx39 until compare rewrite. They haven't
@@ -742,7 +755,8 @@ enum mips_code_readable_setting {
|| TARGET_MAD \
|| ISA_MIPS32 \
|| ISA_MIPS32R2 \
- || ISA_MIPS64) \
+ || ISA_MIPS64 \
+ || ISA_MIPS64R2) \
&& !TARGET_MIPS16)
/* ISA has the floating-point conditional move instructions introduced
@@ -750,7 +764,8 @@ enum mips_code_readable_setting {
#define ISA_HAS_FP_CONDMOVE ((ISA_MIPS4 \
|| ISA_MIPS32 \
|| ISA_MIPS32R2 \
- || ISA_MIPS64) \
+ || ISA_MIPS64 \
+ || ISA_MIPS64R2) \
&& !TARGET_MIPS5500 \
&& !TARGET_MIPS16)
@@ -766,18 +781,20 @@ enum mips_code_readable_setting {
#define ISA_HAS_8CC (ISA_MIPS4 \
|| ISA_MIPS32 \
|| ISA_MIPS32R2 \
- || ISA_MIPS64)
+ || ISA_MIPS64 \
+ || ISA_MIPS64R2)
/* This is a catch all for other mips4 instructions: indexed load, the
FP madd and msub instructions, and the FP recip and recip sqrt
instructions. */
#define ISA_HAS_FP4 ((ISA_MIPS4 \
|| (ISA_MIPS32R2 && TARGET_FLOAT64) \
- || ISA_MIPS64) \
+ || ISA_MIPS64 \
+ || ISA_MIPS64R2) \
&& !TARGET_MIPS16)
/* ISA has paired-single instructions. */
-#define ISA_HAS_PAIRED_SINGLE (ISA_MIPS32R2 || ISA_MIPS64)
+#define ISA_HAS_PAIRED_SINGLE (ISA_MIPS32R2 || ISA_MIPS64 || ISA_MIPS64R2)
/* ISA has conditional trap instructions. */
#define ISA_HAS_COND_TRAP (!ISA_MIPS1 \
@@ -786,7 +803,8 @@ enum mips_code_readable_setting {
/* ISA has integer multiply-accumulate instructions, madd and msub. */
#define ISA_HAS_MADD_MSUB ((ISA_MIPS32 \
|| ISA_MIPS32R2 \
- || ISA_MIPS64) \
+ || ISA_MIPS64 \
+ || ISA_MIPS64R2) \
&& !TARGET_MIPS16)
/* Integer multiply-accumulate instructions should be generated. */
@@ -803,7 +821,8 @@ enum mips_code_readable_setting {
#define ISA_HAS_NMADD4_NMSUB4(MODE) \
((ISA_MIPS4 \
|| (ISA_MIPS32R2 && (MODE) == V2SFmode) \
- || ISA_MIPS64) \
+ || ISA_MIPS64 \
+ || ISA_MIPS64R2) \
&& (!TARGET_MIPS5400 || TARGET_MAD) \
&& !TARGET_MIPS16)
@@ -815,7 +834,8 @@ enum mips_code_readable_setting {
/* ISA has count leading zeroes/ones instruction (not implemented). */
#define ISA_HAS_CLZ_CLO ((ISA_MIPS32 \
|| ISA_MIPS32R2 \
- || ISA_MIPS64) \
+ || ISA_MIPS64 \
+ || ISA_MIPS64R2) \
&& !TARGET_MIPS16)
/* ISA has three operand multiply instructions that put
@@ -855,6 +875,7 @@ enum mips_code_readable_setting {
/* ISA has the "ror" (rotate right) instructions. */
#define ISA_HAS_ROR ((ISA_MIPS32R2 \
+ || ISA_MIPS64R2 \
|| TARGET_MIPS5400 \
|| TARGET_MIPS5500 \
|| TARGET_SR71K \
@@ -865,7 +886,8 @@ enum mips_code_readable_setting {
#define ISA_HAS_PREFETCH ((ISA_MIPS4 \
|| ISA_MIPS32 \
|| ISA_MIPS32R2 \
- || ISA_MIPS64) \
+ || ISA_MIPS64 \
+ || ISA_MIPS64R2) \
&& !TARGET_MIPS16)
/* ISA has data indexed prefetch instructions. This controls use of
@@ -874,7 +896,8 @@ enum mips_code_readable_setting {
enabled.) */
#define ISA_HAS_PREFETCHX ((ISA_MIPS4 \
|| ISA_MIPS32R2 \
- || ISA_MIPS64) \
+ || ISA_MIPS64 \
+ || ISA_MIPS64R2) \
&& !TARGET_MIPS16)
/* True if trunc.w.s and trunc.w.d are real (not synthetic)
@@ -883,15 +906,19 @@ enum mips_code_readable_setting {
#define ISA_HAS_TRUNC_W (!ISA_MIPS1)
/* ISA includes the MIPS32r2 seb and seh instructions. */
-#define ISA_HAS_SEB_SEH (ISA_MIPS32R2 \
+#define ISA_HAS_SEB_SEH ((ISA_MIPS32R2 \
+ || ISA_MIPS64R2) \
&& !TARGET_MIPS16)
/* ISA includes the MIPS32/64 rev 2 ext and ins instructions. */
-#define ISA_HAS_EXT_INS (ISA_MIPS32R2 \
+#define ISA_HAS_EXT_INS ((ISA_MIPS32R2 \
+ || ISA_MIPS64R2) \
&& !TARGET_MIPS16)
/* ISA has instructions for accessing top part of 64-bit fp regs. */
-#define ISA_HAS_MXHC1 (TARGET_FLOAT64 && ISA_MIPS32R2)
+#define ISA_HAS_MXHC1 (TARGET_FLOAT64 \
+ && (ISA_MIPS32R2 \
+ || ISA_MIPS64R2))
/* ISA has lwxs instruction (load w/scaled index address. */
#define ISA_HAS_LWXS (TARGET_SMARTMIPS && !TARGET_MIPS16)
@@ -932,11 +959,14 @@ enum mips_code_readable_setting {
#define ISA_HAS_HILO_INTERLOCKS (ISA_MIPS32 \
|| ISA_MIPS32R2 \
|| ISA_MIPS64 \
+ || ISA_MIPS64R2 \
|| TARGET_MIPS5500 \
|| TARGET_LOONGSON_2EF)
/* ISA includes synci, jr.hb and jalr.hb. */
-#define ISA_HAS_SYNCI (ISA_MIPS32R2 && !TARGET_MIPS16)
+#define ISA_HAS_SYNCI ((ISA_MIPS32R2 \
+ || ISA_MIPS64R2) \
+ && !TARGET_MIPS16)
/* ISA includes sync. */
#define ISA_HAS_SYNC ((mips_isa >= 2 || TARGET_MIPS3900) && !TARGET_MIPS16)
@@ -1033,7 +1063,7 @@ enum mips_code_readable_setting {
#undef ASM_SPEC
#define ASM_SPEC "\
%{G*} %(endian_spec) %{mips1} %{mips2} %{mips3} %{mips4} \
-%{mips32} %{mips32r2} %{mips64} \
+%{mips32*} %{mips64*} \
%{mips16} %{mno-mips16:-no-mips16} \
%{mips3d} %{mno-mips3d:-no-mips3d} \
%{mdmx} %{mno-mdmx:-no-mdmx} \
@@ -1059,7 +1089,7 @@ enum mips_code_readable_setting {
#ifndef LINK_SPEC
#define LINK_SPEC "\
%(endian_spec) \
-%{G*} %{mips1} %{mips2} %{mips3} %{mips4} %{mips32} %{mips32r2} %{mips64} \
+%{G*} %{mips1} %{mips2} %{mips3} %{mips4} %{mips32*} %{mips64*} \
%{bestGnum} %{shared} %{non_shared}"
#endif /* LINK_SPEC defined */
@@ -1214,7 +1244,8 @@ enum mips_code_readable_setting {
/* The number of consecutive floating-point registers needed to store the
smallest format supported by the FPU. */
#define MIN_FPRS_PER_FMT \
- (ISA_MIPS32 || ISA_MIPS32R2 || ISA_MIPS64 ? 1 : MAX_FPRS_PER_FMT)
+ (ISA_MIPS32 || ISA_MIPS32R2 || ISA_MIPS64 || ISA_MIPS64R2 \
+ ? 1 : MAX_FPRS_PER_FMT)
/* The largest size of value that can be held in floating-point
registers and moved with a single instruction. */
@@ -1626,18 +1657,31 @@ enum mips_code_readable_setting {
#define FRAME_POINTER_REQUIRED (mips_frame_pointer_required ())
/* Register in which static-chain is passed to a function. */
-#define STATIC_CHAIN_REGNUM (GP_REG_FIRST + 2)
+#define STATIC_CHAIN_REGNUM (GP_REG_FIRST + 15)
-/* Registers used as temporaries in prologue/epilogue code. If we're
- generating mips16 code, these registers must come from the core set
- of 8. The prologue register mustn't conflict with any incoming
- arguments, the static chain pointer, or the frame pointer. The
- epilogue temporary mustn't conflict with the return registers, the
- frame pointer, the EH stack adjustment, or the EH data registers. */
+/* Registers used as temporaries in prologue/epilogue code:
+ - If a MIPS16 PIC function needs access to _gp, it first loads
+ the value into MIPS16_PIC_TEMP and then copies it to $gp.
+
+ - The prologue can use MIPS_PROLOGUE_TEMP as a general temporary
+ register. The register must not conflict with MIPS16_PIC_TEMP.
+
+ - The epilogue can use MIPS_EPILOGUE_TEMP as a general temporary
+ register.
+
+ If we're generating MIPS16 code, these registers must come from the
+ core set of 8. The prologue registers mustn't conflict with any
+ incoming arguments, the static chain pointer, or the frame pointer.
+ The epilogue temporary mustn't conflict with the return registers,
+ the PIC call register ($25), the frame pointer, the EH stack adjustment,
+ or the EH data registers. */
+
+#define MIPS16_PIC_TEMP_REGNUM (GP_REG_FIRST + 2)
#define MIPS_PROLOGUE_TEMP_REGNUM (GP_REG_FIRST + 3)
#define MIPS_EPILOGUE_TEMP_REGNUM (GP_REG_FIRST + (TARGET_MIPS16 ? 6 : 8))
+#define MIPS16_PIC_TEMP gen_rtx_REG (Pmode, MIPS16_PIC_TEMP_REGNUM)
#define MIPS_PROLOGUE_TEMP(MODE) gen_rtx_REG (MODE, MIPS_PROLOGUE_TEMP_REGNUM)
#define MIPS_EPILOGUE_TEMP(MODE) gen_rtx_REG (MODE, MIPS_EPILOGUE_TEMP_REGNUM)
@@ -1685,7 +1729,6 @@ enum mips_code_readable_setting {
enum reg_class
{
NO_REGS, /* no registers in set */
- M16_NA_REGS, /* mips16 regs not used to pass args */
M16_REGS, /* mips16 directly accessible registers */
T_REG, /* mips16 T register ($24) */
M16_T_REGS, /* mips16 registers plus T register */
@@ -1726,7 +1769,6 @@ enum reg_class
#define REG_CLASS_NAMES \
{ \
"NO_REGS", \
- "M16_NA_REGS", \
"M16_REGS", \
"T_REG", \
"M16_T_REGS", \
@@ -1770,7 +1812,6 @@ enum reg_class
#define REG_CLASS_CONTENTS \
{ \
{ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, /* no registers */ \
- { 0x0003000c, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, /* mips16 nonarg regs */\
{ 0x000300fc, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, /* mips16 registers */ \
{ 0x01000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, /* mips16 T register */ \
{ 0x010300fc, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, /* mips16 and T regs */ \
@@ -1927,10 +1968,32 @@ enum reg_class
#define RETURN_ADDR_RTX mips_return_addr
-/* Since the mips16 ISA mode is encoded in the least-significant bit
- of the address, mask it off return addresses for purposes of
- finding exception handling regions. */
+/* Mask off the MIPS16 ISA bit in unwind addresses.
+
+ The reason for this is a little subtle. When unwinding a call,
+ we are given the call's return address, which on most targets
+ is the address of the following instruction. However, what we
+ actually want to find is the EH region for the call itself.
+ The target-independent unwind code therefore searches for "RA - 1".
+
+ In the MIPS16 case, RA is always an odd-valued (ISA-encoded) address.
+ RA - 1 is therefore the real (even-valued) start of the return
+ instruction. EH region labels are usually odd-valued MIPS16 symbols
+ too, so a search for an even address within a MIPS16 region would
+ usually work.
+ However, there is an exception. If the end of an EH region is also
+ the end of a function, the end label is allowed to be even. This is
+ necessary because a following non-MIPS16 function may also need EH
+ information for its first instruction.
+
+ Thus a MIPS16 region may be terminated by an ISA-encoded or a
+ non-ISA-encoded address. This probably isn't ideal, but it is
+ the traditional (legacy) behavior. It is therefore only safe
+ to search MIPS EH regions for an _odd-valued_ address.
+
+ Masking off the ISA bit means that the target-independent code
+ will search for "(RA & -2) - 1", which is guaranteed to be odd. */
#define MASK_RETURN_ADDR GEN_INT (-2)
@@ -2150,6 +2213,10 @@ typedef struct mips_args {
fprintf (FILE, "\t.set\tnoat\n"); \
fprintf (FILE, "\tmove\t%s,%s\t\t# save current return address\n", \
reg_names[GP_REG_FIRST + 1], reg_names[GP_REG_FIRST + 31]); \
+ /* _mcount treats $2 as the static chain register. */ \
+ if (cfun->static_chain_decl != NULL) \
+ fprintf (FILE, "\tmove\t%s,%s\n", reg_names[2], \
+ reg_names[STATIC_CHAIN_REGNUM]); \
if (!TARGET_NEWABI) \
{ \
fprintf (FILE, \
@@ -2161,6 +2228,10 @@ typedef struct mips_args {
} \
fprintf (FILE, "\tjal\t_mcount\n"); \
fprintf (FILE, "\t.set\tat\n"); \
+ /* _mcount treats $2 as the static chain register. */ \
+ if (cfun->static_chain_decl != NULL) \
+ fprintf (FILE, "\tmove\t%s,%s\n", reg_names[STATIC_CHAIN_REGNUM], \
+ reg_names[2]); \
}
/* The profiler preserves all interesting registers, including $31. */
@@ -2200,20 +2271,19 @@ typedef struct mips_args {
fprintf (STREAM, "\t.word\t0x00000000\t\t# nop\n"); \
if (ptr_mode == DImode) \
{ \
- fprintf (STREAM, "\t.word\t0xdfe30014\t\t# ld $3,20($31)\n"); \
- fprintf (STREAM, "\t.word\t0xdfe2001c\t\t# ld $2,28($31)\n"); \
- fprintf (STREAM, "\t.word\t0x0060c82d\t\t# dmove $25,$3\n"); \
+ fprintf (STREAM, "\t.word\t0xdff90014\t\t# ld $25,20($31)\n"); \
+ fprintf (STREAM, "\t.word\t0xdfef001c\t\t# ld $15,28($31)\n"); \
} \
else \
{ \
- fprintf (STREAM, "\t.word\t0x8fe30014\t\t# lw $3,20($31)\n"); \
- fprintf (STREAM, "\t.word\t0x8fe20018\t\t# lw $2,24($31)\n"); \
- fprintf (STREAM, "\t.word\t0x0060c821\t\t# move $25,$3\n"); \
+ fprintf (STREAM, "\t.word\t0x8ff90010\t\t# lw $25,16($31)\n"); \
+ fprintf (STREAM, "\t.word\t0x8fef0014\t\t# lw $15,20($31)\n"); \
} \
- fprintf (STREAM, "\t.word\t0x00600008\t\t# jr $3\n"); \
+ fprintf (STREAM, "\t.word\t0x03200008\t\t# jr $25\n"); \
if (ptr_mode == DImode) \
{ \
fprintf (STREAM, "\t.word\t0x0020f82d\t\t# dmove $31,$1\n"); \
+ fprintf (STREAM, "\t.word\t0x00000000\t\t# <padding>\n"); \
fprintf (STREAM, "\t.dword\t0x00000000\t\t# <function address>\n"); \
fprintf (STREAM, "\t.dword\t0x00000000\t\t# <static chain value>\n"); \
} \
@@ -2228,7 +2298,7 @@ typedef struct mips_args {
/* A C expression for the size in bytes of the trampoline, as an
integer. */
-#define TRAMPOLINE_SIZE (32 + GET_MODE_SIZE (ptr_mode) * 2)
+#define TRAMPOLINE_SIZE (ptr_mode == DImode ? 48 : 36)
/* Alignment required for trampolines, in bits. */
@@ -2258,7 +2328,7 @@ typedef struct mips_args {
{ \
rtx func_addr, chain_addr, end_addr; \
\
- func_addr = plus_constant (ADDR, 32); \
+ func_addr = plus_constant (ADDR, ptr_mode == DImode ? 32 : 28); \
chain_addr = plus_constant (func_addr, GET_MODE_SIZE (ptr_mode)); \
mips_emit_move (gen_rtx_MEM (ptr_mode, func_addr), FUNC); \
mips_emit_move (gen_rtx_MEM (ptr_mode, chain_addr), CHAIN); \
@@ -2359,6 +2429,11 @@ typedef struct mips_args {
#define SYMBOL_REF_LONG_CALL_P(X) \
((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_LONG_CALL) != 0)
+/* This flag marks functions that cannot be lazily bound. */
+#define SYMBOL_FLAG_BIND_NOW (SYMBOL_FLAG_MACH_DEP << 1)
+#define SYMBOL_REF_BIND_NOW_P(RTX) \
+ ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_BIND_NOW) != 0)
+
/* True if we're generating a form of MIPS16 code in which jump tables
are stored in the text section and encoded as 16-bit PC-relative
offsets. This is only possible when general text loads are allowed,
@@ -2672,10 +2747,6 @@ while (0)
#undef ASM_DECLARE_FUNCTION_NAME
#define ASM_DECLARE_FUNCTION_NAME(STREAM,NAME,DECL)
-#ifndef FUNCTION_NAME_ALREADY_DECLARED
-#define FUNCTION_NAME_ALREADY_DECLARED 0
-#endif
-
/* This is how to store into the string LABEL
the symbol_ref name of an internal numbered label where
PREFIX is the class of label and NUM is the number within the class.
@@ -3224,6 +3295,7 @@ extern int set_nomacro; /* # of nested .set nomacro's */
extern int mips_dbx_regno[];
extern int mips_dwarf_regno[];
extern bool mips_split_p[];
+extern bool mips_split_hi_p[];
extern GTY(()) rtx cmp_operands[2];
extern enum processor_type mips_arch; /* which cpu to codegen for */
extern enum processor_type mips_tune; /* which cpu to schedule for */
diff --git a/gcc/config/mips/mips.md b/gcc/config/mips/mips.md
index 43c47e5883c..4d09085757d 100644
--- a/gcc/config/mips/mips.md
+++ b/gcc/config/mips/mips.md
@@ -66,6 +66,7 @@
(UNSPEC_MEMORY_BARRIER 45)
(UNSPEC_SET_GOT_VERSION 46)
(UNSPEC_UPDATE_GOT_VERSION 47)
+ (UNSPEC_COPYGP 48)
(UNSPEC_ADDRESS_FIRST 100)
@@ -478,7 +479,9 @@
(const_int 0)
(eq_attr "got" "load")
- (const_int 4)
+ (if_then_else (ne (symbol_ref "TARGET_MIPS16") (const_int 0))
+ (const_int 8)
+ (const_int 4))
(eq_attr "got" "xgot_high")
(const_int 8)
@@ -3590,15 +3593,11 @@
(define_insn_and_split "*got_disp<mode>"
[(set (match_operand:P 0 "register_operand" "=d")
(match_operand:P 1 "got_disp_operand" ""))]
- "TARGET_EXPLICIT_RELOCS && !TARGET_XGOT"
+ "TARGET_EXPLICIT_RELOCS && !mips_split_p[SYMBOL_GOT_DISP]"
"#"
"&& reload_completed"
- [(set (match_dup 0)
- (unspec:P [(match_dup 2) (match_dup 3)] UNSPEC_LOAD_GOT))]
-{
- operands[2] = pic_offset_table_rtx;
- operands[3] = mips_unspec_address (operands[1], SYMBOL_GOTOFF_DISP);
-}
+ [(set (match_dup 0) (match_dup 2))]
+ { operands[2] = mips_got_load (NULL, operands[1], SYMBOL_GOTOFF_DISP); }
[(set_attr "got" "load")
(set_attr "mode" "<MODE>")])
@@ -3607,18 +3606,19 @@
(define_insn_and_split "*got_page<mode>"
[(set (match_operand:P 0 "register_operand" "=d")
(high:P (match_operand:P 1 "got_page_ofst_operand" "")))]
- "TARGET_EXPLICIT_RELOCS"
+ "TARGET_EXPLICIT_RELOCS && !mips_split_hi_p[SYMBOL_GOT_PAGE_OFST]"
"#"
"&& reload_completed"
- [(set (match_dup 0)
- (unspec:P [(match_dup 2) (match_dup 3)] UNSPEC_LOAD_GOT))]
-{
- operands[2] = pic_offset_table_rtx;
- operands[3] = mips_unspec_address (operands[1], SYMBOL_GOTOFF_PAGE);
-}
+ [(set (match_dup 0) (match_dup 2))]
+ { operands[2] = mips_got_load (NULL, operands[1], SYMBOL_GOTOFF_PAGE); }
[(set_attr "got" "load")
(set_attr "mode" "<MODE>")])
+;; Convenience expander that generates the rhs of a load_got<mode> insn.
+(define_expand "unspec_got<mode>"
+ [(unspec:P [(match_operand:P 0)
+ (match_operand:P 1)] UNSPEC_LOAD_GOT)])
+
;; Lower-level instructions for loading an address from the GOT.
;; We could use MEMs, but an unspec gives more optimization
;; opportunities.
@@ -3630,9 +3630,8 @@
UNSPEC_LOAD_GOT))]
""
"<load>\t%0,%R2(%1)"
- [(set_attr "type" "load")
- (set_attr "mode" "<MODE>")
- (set_attr "length" "4")])
+ [(set_attr "got" "load")
+ (set_attr "mode" "<MODE>")])
;; Instructions for adding the low 16 bits of an address to a register.
;; Operand 2 is the address: mips_print_operand works out which relocation
@@ -3657,6 +3656,15 @@
(set_attr "mode" "<MODE>")
(set_attr "extended_mips16" "yes")])
+;; Expose MIPS16 uses of the global pointer after reload if the function
+;; is responsible for setting up the register itself.
+(define_split
+ [(set (match_operand:GPR 0 "d_operand")
+ (const:GPR (unspec:GPR [(const_int 0)] UNSPEC_GP)))]
+ "TARGET_MIPS16 && TARGET_USE_GOT && reload_completed"
+ [(set (match_dup 0) (match_dup 1))]
+ { operands[1] = pic_offset_table_rtx; })
+
;; Allow combine to split complex const_int load sequences, using operand 2
;; to store the intermediate results. See move_operand for details.
(define_split
@@ -4521,6 +4529,18 @@
}
[(set_attr "length" "12")])
+;; Initialize the global pointer for MIPS16 code. Operand 0 is the
+;; global pointer and operand 1 is the MIPS16 register that holds
+;; the required value.
+(define_insn_and_split "copygp_mips16"
+ [(set (match_operand:SI 0 "register_operand" "=y")
+ (unspec_volatile:SI [(match_operand:SI 1 "register_operand" "d")]
+ UNSPEC_COPYGP))]
+ "TARGET_MIPS16"
+ "#"
+ "&& reload_completed"
+ [(set (match_dup 0) (match_dup 1))])
+
;; Emit a .cprestore directive, which normally expands to a single store
;; instruction. Note that we continue to use .cprestore for explicit reloc
;; code so that jals inside inline asms will work correctly.
@@ -5981,16 +6001,17 @@
;; volatile until all uses of $28 are exposed.
(define_insn_and_split "restore_gp"
[(set (reg:SI 28)
- (unspec_volatile:SI [(const_int 0)] UNSPEC_RESTORE_GP))]
+ (unspec_volatile:SI [(const_int 0)] UNSPEC_RESTORE_GP))
+ (clobber (match_scratch:SI 0 "=&d"))]
"TARGET_CALL_CLOBBERED_GP"
"#"
"&& reload_completed"
[(const_int 0)]
{
- mips_restore_gp ();
+ mips_restore_gp (operands[0]);
DONE;
}
- [(set_attr "type" "load")
+ [(set_attr "type" "load")
(set_attr "length" "12")])
;;
@@ -6043,16 +6064,22 @@
;; - Leave GOT_VERSION_REGNUM out of all register classes.
;; The register is therefore not a valid register_operand
;; and cannot be moved to or from other registers.
+
+;; Convenience expander that generates the rhs of a load_call<mode> insn.
+(define_expand "unspec_call<mode>"
+ [(unspec:P [(match_operand:P 0)
+ (match_operand:P 1)
+ (reg:SI GOT_VERSION_REGNUM)] UNSPEC_LOAD_CALL)])
+
(define_insn "load_call<mode>"
[(set (match_operand:P 0 "register_operand" "=d")
- (unspec:P [(match_operand:P 1 "register_operand" "r")
+ (unspec:P [(match_operand:P 1 "register_operand" "d")
(match_operand:P 2 "immediate_operand" "")
(reg:SI GOT_VERSION_REGNUM)] UNSPEC_LOAD_CALL))]
"TARGET_USE_GOT"
"<load>\t%0,%R2(%1)"
- [(set_attr "type" "load")
- (set_attr "mode" "<MODE>")
- (set_attr "length" "4")])
+ [(set_attr "got" "load")
+ (set_attr "mode" "<MODE>")])
(define_insn "set_got_version"
[(set (reg:SI GOT_VERSION_REGNUM)
@@ -6088,7 +6115,8 @@
(use (match_operand 3 ""))])] ;; struct_value_size_rtx
"TARGET_SIBCALLS"
{
- mips_expand_call (0, XEXP (operands[0], 0), operands[1], operands[2], true);
+ mips_expand_call (MIPS_CALL_SIBCALL, NULL_RTX, XEXP (operands[0], 0),
+ operands[1], operands[2], false);
DONE;
})
@@ -6106,8 +6134,8 @@
(use (match_operand 3 ""))])] ;; next_arg_reg
"TARGET_SIBCALLS"
{
- mips_expand_call (operands[0], XEXP (operands[1], 0),
- operands[2], operands[3], true);
+ mips_expand_call (MIPS_CALL_SIBCALL, operands[0], XEXP (operands[1], 0),
+ operands[2], operands[3], false);
DONE;
})
@@ -6137,7 +6165,8 @@
(use (match_operand 3 ""))])] ;; struct_value_size_rtx
""
{
- mips_expand_call (0, XEXP (operands[0], 0), operands[1], operands[2], false);
+ mips_expand_call (MIPS_CALL_NORMAL, NULL_RTX, XEXP (operands[0], 0),
+ operands[1], operands[2], false);
DONE;
})
@@ -6187,28 +6216,44 @@
"reload_completed && TARGET_SPLIT_CALLS && (operands[2] = insn)"
[(const_int 0)]
{
- emit_call_insn (gen_call_split (operands[0], operands[1]));
- if (!find_reg_note (operands[2], REG_NORETURN, 0))
- mips_restore_gp ();
+ mips_split_call (operands[2], gen_call_split (operands[0], operands[1]));
DONE;
}
[(set_attr "jal" "indirect,direct")])
+(define_insn "call_split"
+ [(call (mem:SI (match_operand 0 "call_insn_operand" "cS"))
+ (match_operand 1 "" ""))
+ (clobber (reg:SI 31))
+ (clobber (reg:SI 28))]
+ "TARGET_SPLIT_CALLS"
+ { return MIPS_CALL ("jal", operands, 0); }
+ [(set_attr "type" "call")])
+
;; A pattern for calls that must be made directly. It is used for
;; MIPS16 calls that the linker may need to redirect to a hard-float
;; stub; the linker relies on the call relocation type to detect when
;; such redirection is needed.
-(define_insn "call_internal_direct"
+(define_insn_and_split "call_internal_direct"
[(call (mem:SI (match_operand 0 "const_call_insn_operand"))
(match_operand 1))
(const_int 1)
(clobber (reg:SI 31))]
""
- { return MIPS_CALL ("jal", operands, 0); })
+ { return TARGET_SPLIT_CALLS ? "#" : MIPS_CALL ("jal", operands, 0); }
+ "reload_completed && TARGET_SPLIT_CALLS && (operands[2] = insn)"
+ [(const_int 0)]
+{
+ mips_split_call (operands[2],
+ gen_call_direct_split (operands[0], operands[1]));
+ DONE;
+}
+ [(set_attr "type" "call")])
-(define_insn "call_split"
- [(call (mem:SI (match_operand 0 "call_insn_operand" "cS"))
- (match_operand 1 "" ""))
+(define_insn "call_direct_split"
+ [(call (mem:SI (match_operand 0 "const_call_insn_operand"))
+ (match_operand 1))
+ (const_int 1)
(clobber (reg:SI 31))
(clobber (reg:SI 28))]
"TARGET_SPLIT_CALLS"
@@ -6222,7 +6267,7 @@
(use (match_operand 3 ""))])] ;; next_arg_reg
""
{
- mips_expand_call (operands[0], XEXP (operands[1], 0),
+ mips_expand_call (MIPS_CALL_NORMAL, operands[0], XEXP (operands[1], 0),
operands[2], operands[3], false);
DONE;
})
@@ -6238,10 +6283,9 @@
"reload_completed && TARGET_SPLIT_CALLS && (operands[3] = insn)"
[(const_int 0)]
{
- emit_call_insn (gen_call_value_split (operands[0], operands[1],
- operands[2]));
- if (!find_reg_note (operands[3], REG_NORETURN, 0))
- mips_restore_gp ();
+ mips_split_call (operands[3],
+ gen_call_value_split (operands[0], operands[1],
+ operands[2]));
DONE;
}
[(set_attr "jal" "indirect,direct")])
@@ -6257,14 +6301,34 @@
[(set_attr "type" "call")])
;; See call_internal_direct.
-(define_insn "call_value_internal_direct"
+(define_insn_and_split "call_value_internal_direct"
[(set (match_operand 0 "register_operand")
(call (mem:SI (match_operand 1 "const_call_insn_operand"))
(match_operand 2)))
(const_int 1)
(clobber (reg:SI 31))]
""
- { return MIPS_CALL ("jal", operands, 1); })
+ { return TARGET_SPLIT_CALLS ? "#" : MIPS_CALL ("jal", operands, 1); }
+ "reload_completed && TARGET_SPLIT_CALLS && (operands[3] = insn)"
+ [(const_int 0)]
+{
+ mips_split_call (operands[3],
+ gen_call_value_direct_split (operands[0], operands[1],
+ operands[2]));
+ DONE;
+}
+ [(set_attr "type" "call")])
+
+(define_insn "call_value_direct_split"
+ [(set (match_operand 0 "register_operand")
+ (call (mem:SI (match_operand 1 "const_call_insn_operand"))
+ (match_operand 2)))
+ (const_int 1)
+ (clobber (reg:SI 31))
+ (clobber (reg:SI 28))]
+ "TARGET_SPLIT_CALLS"
+ { return MIPS_CALL ("jal", operands, 1); }
+ [(set_attr "type" "call")])
;; See comment for call_internal.
(define_insn_and_split "call_value_multiple_internal"
@@ -6280,10 +6344,9 @@
"reload_completed && TARGET_SPLIT_CALLS && (operands[4] = insn)"
[(const_int 0)]
{
- emit_call_insn (gen_call_value_multiple_split (operands[0], operands[1],
- operands[2], operands[3]));
- if (!find_reg_note (operands[4], REG_NORETURN, 0))
- mips_restore_gp ();
+ mips_split_call (operands[4],
+ gen_call_value_multiple_split (operands[0], operands[1],
+ operands[2], operands[3]));
DONE;
}
[(set_attr "jal" "indirect,direct")])
diff --git a/gcc/config/mips/mips16.S b/gcc/config/mips/mips16.S
index 90651b196b3..edc84de8043 100644
--- a/gcc/config/mips/mips16.S
+++ b/gcc/config/mips/mips16.S
@@ -38,6 +38,8 @@ Boston, MA 02110-1301, USA. */
values using the soft-float calling convention, but do the actual
operation using the hard floating point instructions. */
+#if defined _MIPS_SIM && (_MIPS_SIM == _ABIO32 || _MIPS_SIM == _ABIO64)
+
/* This file contains 32-bit assembly code. */
.set nomips16
@@ -303,8 +305,12 @@ STARTFN (__mips16_floatsisf)
#ifdef L_m16fltunsisf
STARTFN (__mips16_floatunsisf)
+ .set noreorder
bltz $4,1f
- j __mips16_floatsisf
+ MOVE_SF_BYTE0 (t)
+ .set reorder
+ cvt.s.w RET,ARG1
+ MOVE_SF_RET (f, $31)
1:
and $2,$4,1
srl $3,$4,1
@@ -522,7 +528,10 @@ RET_FUNCTION (__mips16_ret_dc, DC)
#define CALL_STUB_NO_RET(NAME, CODE) \
STARTFN (NAME); \
STUB_ARGS_##CODE; \
+ .set noreorder; \
jr $2; \
+ move $25,$2; \
+ .set reorder; \
ENDFN (NAME)
#ifdef L_m16stub1
@@ -569,7 +578,10 @@ CALL_STUB_NO_RET (__mips16_call_stub_10, 10)
STARTFN (NAME); \
move $18,$31; \
STUB_ARGS_##CODE; \
+ .set noreorder; \
jalr $2; \
+ move $25,$2; \
+ .set reorder; \
MOVE_##MODE##_RET (f, $18); \
ENDFN (NAME)
@@ -705,3 +717,4 @@ CALL_STUB_RET (__mips16_call_stub_dc_9, 9, DC)
CALL_STUB_RET (__mips16_call_stub_dc_10, 10, DC)
#endif
#endif /* !__mips_single_float */
+#endif
diff --git a/gcc/config/mips/predicates.md b/gcc/config/mips/predicates.md
index 73db0274936..0e8c85b93be 100644
--- a/gcc/config/mips/predicates.md
+++ b/gcc/config/mips/predicates.md
@@ -104,14 +104,9 @@
switch (symbol_type)
{
case SYMBOL_ABSOLUTE:
- /* We can only use direct calls for TARGET_ABSOLUTE_ABICALLS if we
- are sure that the target function does not need $25 to be live
- on entry. This is true for any locally-defined function because
- any such function will use %hi/%lo accesses to set up $gp. */
- if (TARGET_ABSOLUTE_ABICALLS
- && !(GET_CODE (op) == SYMBOL_REF
- && SYMBOL_REF_DECL (op)
- && !DECL_EXTERNAL (SYMBOL_REF_DECL (op))))
+ /* We can only use direct calls if we're sure that the target
+ function does not need $25 to be valid on entry. */
+ if (mips_use_pic_fn_addr_reg_p (op))
return false;
/* If -mlong-calls or if this function has an explicit long_call
@@ -206,6 +201,11 @@
return (mips_symbolic_constant_p (op, SYMBOL_CONTEXT_LEA, &symbol_type)
&& !mips_split_p[symbol_type]);
+ case HIGH:
+ op = XEXP (op, 0);
+ return (mips_symbolic_constant_p (op, SYMBOL_CONTEXT_LEA, &symbol_type)
+ && !mips_split_hi_p[symbol_type]);
+
default:
return true;
}
diff --git a/gcc/config/mips/sdemtk.h b/gcc/config/mips/sdemtk.h
index a73e7d2d7b3..f6b60970727 100644
--- a/gcc/config/mips/sdemtk.h
+++ b/gcc/config/mips/sdemtk.h
@@ -94,12 +94,20 @@ extern void mips_sync_icache (void *beg, unsigned long len);
#define FUNCTION_PROFILER(FILE, LABELNO) \
{ \
fprintf (FILE, "\t.set\tnoat\n"); \
+ /* _mcount treats $2 as the static chain register. */ \
+ if (cfun->static_chain_decl != NULL) \
+ fprintf (FILE, "\tmove\t%s,%s\n", reg_names[2], \
+ reg_names[STATIC_CHAIN_REGNUM]); \
/* MIPS16 code passes saved $ra in $v1 instead of $at. */ \
fprintf (FILE, "\tmove\t%s,%s\n", \
reg_names[GP_REG_FIRST + (TARGET_MIPS16 ? 3 : 1)], \
reg_names[GP_REG_FIRST + 31]); \
fprintf (FILE, "\tjal\t_mcount\n"); \
fprintf (FILE, "\t.set\tat\n"); \
+ /* _mcount treats $2 as the static chain register. */ \
+ if (cfun->static_chain_decl != NULL) \
+ fprintf (FILE, "\tmove\t%s,%s\n", reg_names[STATIC_CHAIN_REGNUM], \
+ reg_names[2]); \
}
/* ...nor does the call sequence preserve $31. */
diff --git a/gcc/config/mips/t-libgcc-mips16 b/gcc/config/mips/t-libgcc-mips16
index d37b6eef539..b1a547d7029 100644
--- a/gcc/config/mips/t-libgcc-mips16
+++ b/gcc/config/mips/t-libgcc-mips16
@@ -22,3 +22,6 @@ LIB1ASMFUNCS = _m16addsf3 _m16subsf3 _m16mulsf3 _m16divsf3 \
LIBGCC_SYNC = yes
LIBGCC_SYNC_CFLAGS = -mno-mips16
+
+# Version these symbols if building libgcc.so.
+SHLIB_MAPFILES += $(srcdir)/config/mips/libgcc-mips16.ver
diff --git a/gcc/config/mmix/mmix.c b/gcc/config/mmix/mmix.c
index fe38bb01eca..e57f52dd796 100644
--- a/gcc/config/mmix/mmix.c
+++ b/gcc/config/mmix/mmix.c
@@ -353,11 +353,11 @@ mmix_local_regno (int regno)
We need to extend the reload class of REMAINDER_REG and HIMULT_REG. */
enum reg_class
-mmix_preferred_reload_class (rtx x ATTRIBUTE_UNUSED, enum reg_class class)
+mmix_preferred_reload_class (rtx x ATTRIBUTE_UNUSED, enum reg_class rclass)
{
/* FIXME: Revisit. */
return GET_CODE (x) == MOD && GET_MODE (x) == DImode
- ? REMAINDER_REG : class;
+ ? REMAINDER_REG : rclass;
}
/* PREFERRED_OUTPUT_RELOAD_CLASS.
@@ -365,25 +365,25 @@ mmix_preferred_reload_class (rtx x ATTRIBUTE_UNUSED, enum reg_class class)
enum reg_class
mmix_preferred_output_reload_class (rtx x ATTRIBUTE_UNUSED,
- enum reg_class class)
+ enum reg_class rclass)
{
/* FIXME: Revisit. */
return GET_CODE (x) == MOD && GET_MODE (x) == DImode
- ? REMAINDER_REG : class;
+ ? REMAINDER_REG : rclass;
}
/* SECONDARY_RELOAD_CLASS.
We need to reload regs of REMAINDER_REG and HIMULT_REG elsewhere. */
enum reg_class
-mmix_secondary_reload_class (enum reg_class class,
+mmix_secondary_reload_class (enum reg_class rclass,
enum machine_mode mode ATTRIBUTE_UNUSED,
rtx x ATTRIBUTE_UNUSED,
int in_p ATTRIBUTE_UNUSED)
{
- if (class == REMAINDER_REG
- || class == HIMULT_REG
- || class == SYSTEM_REGS)
+ if (rclass == REMAINDER_REG
+ || rclass == HIMULT_REG
+ || rclass == SYSTEM_REGS)
return GENERAL_REGS;
return NO_REGS;
diff --git a/gcc/config/mn10300/mn10300.c b/gcc/config/mn10300/mn10300.c
index ea7392bb0f9..6f172fc0b26 100644
--- a/gcc/config/mn10300/mn10300.c
+++ b/gcc/config/mn10300/mn10300.c
@@ -1319,11 +1319,11 @@ store_multiple_operation (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)
}
/* What (if any) secondary registers are needed to move IN with mode
- MODE into a register in register class CLASS.
+ MODE into a register in register class RCLASS.
We might be able to simplify this. */
enum reg_class
-mn10300_secondary_reload_class (enum reg_class class, enum machine_mode mode,
+mn10300_secondary_reload_class (enum reg_class rclass, enum machine_mode mode,
rtx in)
{
/* Memory loads less than a full word wide can't have an
@@ -1336,8 +1336,8 @@ mn10300_secondary_reload_class (enum reg_class class, enum machine_mode mode,
&& GET_CODE (SUBREG_REG (in)) == REG
&& REGNO (SUBREG_REG (in)) >= FIRST_PSEUDO_REGISTER))
&& (mode == QImode || mode == HImode)
- && (class == ADDRESS_REGS || class == SP_REGS
- || class == SP_OR_ADDRESS_REGS))
+ && (rclass == ADDRESS_REGS || rclass == SP_REGS
+ || rclass == SP_OR_ADDRESS_REGS))
{
if (TARGET_AM33)
return DATA_OR_EXTENDED_REGS;
@@ -1346,12 +1346,12 @@ mn10300_secondary_reload_class (enum reg_class class, enum machine_mode mode,
/* We can't directly load sp + const_int into a data register;
we must use an address register as an intermediate. */
- if (class != SP_REGS
- && class != ADDRESS_REGS
- && class != SP_OR_ADDRESS_REGS
- && class != SP_OR_EXTENDED_REGS
- && class != ADDRESS_OR_EXTENDED_REGS
- && class != SP_OR_ADDRESS_OR_EXTENDED_REGS
+ if (rclass != SP_REGS
+ && rclass != ADDRESS_REGS
+ && rclass != SP_OR_ADDRESS_REGS
+ && rclass != SP_OR_EXTENDED_REGS
+ && rclass != ADDRESS_OR_EXTENDED_REGS
+ && rclass != SP_OR_ADDRESS_OR_EXTENDED_REGS
&& (in == stack_pointer_rtx
|| (GET_CODE (in) == PLUS
&& (XEXP (in, 0) == stack_pointer_rtx
@@ -1363,7 +1363,7 @@ mn10300_secondary_reload_class (enum reg_class class, enum machine_mode mode,
|| XEXP (in, 1) == stack_pointer_rtx))
return GENERAL_REGS;
- if (TARGET_AM33_2 && class == FP_REGS
+ if (TARGET_AM33_2 && rclass == FP_REGS
&& GET_CODE (in) == MEM
&& ! (GET_CODE (in) == MEM && !CONSTANT_ADDRESS_P (XEXP (in, 0))))
{
diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c
index 238d35276e4..9ff778b5b47 100644
--- a/gcc/config/pa/pa.c
+++ b/gcc/config/pa/pa.c
@@ -1,6 +1,6 @@
/* Subroutines for insn-output.c for HPPA.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
- 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+ 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
Contributed by Tim Moore (moore@cs.utah.edu), based on sparc.c
This file is part of GCC.
@@ -125,7 +125,7 @@ static void pa_asm_out_destructor (rtx, int);
static void pa_init_builtins (void);
static rtx hppa_builtin_saveregs (void);
static void hppa_va_start (tree, rtx);
-static tree hppa_gimplify_va_arg_expr (tree, tree, tree *, tree *);
+static tree hppa_gimplify_va_arg_expr (tree, tree, gimple_seq *, gimple_seq *);
static bool pa_scalar_mode_supported_p (enum machine_mode);
static bool pa_commutative_p (const_rtx x, int outer_code);
static void copy_fp_args (rtx) ATTRIBUTE_UNUSED;
@@ -5684,19 +5684,19 @@ output_arg_descriptor (rtx call_insn)
}
static enum reg_class
-pa_secondary_reload (bool in_p, rtx x, enum reg_class class,
+pa_secondary_reload (bool in_p, rtx x, enum reg_class rclass,
enum machine_mode mode, secondary_reload_info *sri)
{
int is_symbolic, regno;
/* Handle the easy stuff first. */
- if (class == R1_REGS)
+ if (rclass == R1_REGS)
return NO_REGS;
if (REG_P (x))
{
regno = REGNO (x);
- if (class == BASE_REG_CLASS && regno < FIRST_PSEUDO_REGISTER)
+ if (rclass == BASE_REG_CLASS && regno < FIRST_PSEUDO_REGISTER)
return NO_REGS;
}
else
@@ -5712,7 +5712,7 @@ pa_secondary_reload (bool in_p, rtx x, enum reg_class class,
generation requires %r1 as a scratch register. */
if (flag_pic
&& (mode == SImode || mode == DImode)
- && FP_REG_CLASS_P (class)
+ && FP_REG_CLASS_P (rclass)
&& (GET_CODE (x) == CONST_INT || GET_CODE (x) == CONST_DOUBLE))
{
sri->icode = (mode == SImode ? CODE_FOR_reload_insi_r1
@@ -5735,7 +5735,7 @@ pa_secondary_reload (bool in_p, rtx x, enum reg_class class,
memory loads and stores. */
if ((regno >= FIRST_PSEUDO_REGISTER || regno == -1)
&& GET_MODE_CLASS (mode) == MODE_INT
- && FP_REG_CLASS_P (class))
+ && FP_REG_CLASS_P (rclass))
{
/* Reload passes (mem:SI (reg/f:DI 30 %r30) when it wants to check
the secondary reload needed for a pseudo. It never passes a
@@ -5767,7 +5767,7 @@ pa_secondary_reload (bool in_p, rtx x, enum reg_class class,
/* We need a secondary register (GPR) for copies between the SAR
and anything other than a general register. */
- if (class == SHIFT_REGS && (regno <= 0 || regno >= 32))
+ if (rclass == SHIFT_REGS && (regno <= 0 || regno >= 32))
{
sri->icode = in_p ? reload_in_optab[mode] : reload_out_optab[mode];
return NO_REGS;
@@ -5777,7 +5777,7 @@ pa_secondary_reload (bool in_p, rtx x, enum reg_class class,
well as secondary memory. */
if (regno >= 0 && regno < FIRST_PSEUDO_REGISTER
&& (REGNO_REG_CLASS (regno) == SHIFT_REGS
- && FP_REG_CLASS_P (class)))
+ && FP_REG_CLASS_P (rclass)))
{
sri->icode = in_p ? reload_in_optab[mode] : reload_out_optab[mode];
return NO_REGS;
@@ -5998,7 +5998,8 @@ hppa_va_start (tree valist, rtx nextarg)
}
static tree
-hppa_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, tree *post_p)
+hppa_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p,
+ gimple_seq *post_p)
{
if (TARGET_64BIT)
{
@@ -8830,7 +8831,7 @@ pa_reorg (void)
static void
pa_combine_instructions (void)
{
- rtx anchor, new;
+ rtx anchor, new_rtx;
/* This can get expensive since the basic algorithm is on the
order of O(n^2) (or worse). Only do it for -O2 or higher
@@ -8842,8 +8843,8 @@ pa_combine_instructions (void)
may be combined with "floating" insns. As the name implies,
"anchor" instructions don't move, while "floating" insns may
move around. */
- new = gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, NULL_RTX, NULL_RTX));
- new = make_insn_raw (new);
+ new_rtx = gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, NULL_RTX, NULL_RTX));
+ new_rtx = make_insn_raw (new_rtx);
for (anchor = get_insns (); anchor; anchor = NEXT_INSN (anchor))
{
@@ -8899,7 +8900,7 @@ pa_combine_instructions (void)
{
/* If ANCHOR and FLOATER can be combined, then we're
done with this pass. */
- if (pa_can_combine_p (new, anchor, floater, 0,
+ if (pa_can_combine_p (new_rtx, anchor, floater, 0,
SET_DEST (PATTERN (floater)),
XEXP (SET_SRC (PATTERN (floater)), 0),
XEXP (SET_SRC (PATTERN (floater)), 1)))
@@ -8911,7 +8912,7 @@ pa_combine_instructions (void)
{
if (GET_CODE (SET_SRC (PATTERN (floater))) == PLUS)
{
- if (pa_can_combine_p (new, anchor, floater, 0,
+ if (pa_can_combine_p (new_rtx, anchor, floater, 0,
SET_DEST (PATTERN (floater)),
XEXP (SET_SRC (PATTERN (floater)), 0),
XEXP (SET_SRC (PATTERN (floater)), 1)))
@@ -8919,7 +8920,7 @@ pa_combine_instructions (void)
}
else
{
- if (pa_can_combine_p (new, anchor, floater, 0,
+ if (pa_can_combine_p (new_rtx, anchor, floater, 0,
SET_DEST (PATTERN (floater)),
SET_SRC (PATTERN (floater)),
SET_SRC (PATTERN (floater))))
@@ -8961,7 +8962,7 @@ pa_combine_instructions (void)
{
/* If ANCHOR and FLOATER can be combined, then we're
done with this pass. */
- if (pa_can_combine_p (new, anchor, floater, 1,
+ if (pa_can_combine_p (new_rtx, anchor, floater, 1,
SET_DEST (PATTERN (floater)),
XEXP (SET_SRC (PATTERN (floater)),
0),
@@ -9020,7 +9021,7 @@ pa_combine_instructions (void)
}
static int
-pa_can_combine_p (rtx new, rtx anchor, rtx floater, int reversed, rtx dest,
+pa_can_combine_p (rtx new_rtx, rtx anchor, rtx floater, int reversed, rtx dest,
rtx src1, rtx src2)
{
int insn_code_number;
@@ -9033,12 +9034,12 @@ pa_can_combine_p (rtx new, rtx anchor, rtx floater, int reversed, rtx dest,
If the pattern doesn't match or the constraints
aren't met keep searching for a suitable floater
insn. */
- XVECEXP (PATTERN (new), 0, 0) = PATTERN (anchor);
- XVECEXP (PATTERN (new), 0, 1) = PATTERN (floater);
- INSN_CODE (new) = -1;
- insn_code_number = recog_memoized (new);
+ XVECEXP (PATTERN (new_rtx), 0, 0) = PATTERN (anchor);
+ XVECEXP (PATTERN (new_rtx), 0, 1) = PATTERN (floater);
+ INSN_CODE (new_rtx) = -1;
+ insn_code_number = recog_memoized (new_rtx);
if (insn_code_number < 0
- || (extract_insn (new), ! constrain_operands (1)))
+ || (extract_insn (new_rtx), ! constrain_operands (1)))
return 0;
if (reversed)
@@ -9651,11 +9652,11 @@ pa_hpux_file_end (void)
#endif
/* Return true if a change from mode FROM to mode TO for a register
- in register class CLASS is invalid. */
+ in register class RCLASS is invalid. */
bool
pa_cannot_change_mode_class (enum machine_mode from, enum machine_mode to,
- enum reg_class class)
+ enum reg_class rclass)
{
if (from == to)
return false;
@@ -9673,7 +9674,7 @@ pa_cannot_change_mode_class (enum machine_mode from, enum machine_mode to,
On the 64-bit target, this conflicts with the definition of
LOAD_EXTEND_OP. Thus, we can't allow changing between modes
with different sizes in the floating-point registers. */
- if (MAYBE_FP_REG_CLASS_P (class))
+ if (MAYBE_FP_REG_CLASS_P (rclass))
return true;
/* HARD_REGNO_MODE_OK places modes with sizes larger than a word
diff --git a/gcc/config/pa/pa.h b/gcc/config/pa/pa.h
index 22cd9f33f32..610bcf5da3c 100644
--- a/gcc/config/pa/pa.h
+++ b/gcc/config/pa/pa.h
@@ -1377,7 +1377,7 @@ extern int may_call_alloca;
#define LEGITIMIZE_RELOAD_ADDRESS(AD, MODE, OPNUM, TYPE, IND, WIN) \
do { \
long offset, newoffset, mask; \
- rtx new, temp = NULL_RTX; \
+ rtx new_rtx, temp = NULL_RTX; \
\
mask = (GET_MODE_CLASS (MODE) == MODE_FLOAT \
? (INT14_OK_STRICT ? 0x3fff : 0x1f) : 0x3fff); \
@@ -1386,14 +1386,14 @@ do { \
temp = simplify_binary_operation (PLUS, Pmode, \
XEXP (AD, 0), XEXP (AD, 1)); \
\
- new = temp ? temp : AD; \
+ new_rtx = temp ? temp : AD; \
\
if (optimize \
- && GET_CODE (new) == PLUS \
- && GET_CODE (XEXP (new, 0)) == REG \
- && GET_CODE (XEXP (new, 1)) == CONST_INT) \
+ && GET_CODE (new_rtx) == PLUS \
+ && GET_CODE (XEXP (new_rtx, 0)) == REG \
+ && GET_CODE (XEXP (new_rtx, 1)) == CONST_INT) \
{ \
- offset = INTVAL (XEXP ((new), 1)); \
+ offset = INTVAL (XEXP ((new_rtx), 1)); \
\
/* Choose rounding direction. Round up if we are >= halfway. */ \
if ((offset & mask) >= ((mask + 1) / 2)) \
@@ -1409,7 +1409,7 @@ do { \
\
if (newoffset != 0 && VAL_14_BITS_P (newoffset)) \
{ \
- temp = gen_rtx_PLUS (Pmode, XEXP (new, 0), \
+ temp = gen_rtx_PLUS (Pmode, XEXP (new_rtx, 0), \
GEN_INT (newoffset)); \
AD = gen_rtx_PLUS (Pmode, temp, GEN_INT (offset - newoffset));\
push_reload (XEXP (AD, 0), 0, &XEXP (AD, 0), 0, \
diff --git a/gcc/config/pdp11/pdp11.c b/gcc/config/pdp11/pdp11.c
index ba649eac60f..661980fd13e 100644
--- a/gcc/config/pdp11/pdp11.c
+++ b/gcc/config/pdp11/pdp11.c
@@ -78,6 +78,8 @@ const struct real_format pdp11_f_format =
false,
false,
false,
+ false,
+ false,
false
};
@@ -97,6 +99,8 @@ const struct real_format pdp11_d_format =
false,
false,
false,
+ false,
+ false,
false
};
diff --git a/gcc/config/pdp11/pdp11.h b/gcc/config/pdp11/pdp11.h
index 4b8c231376e..662886cf8db 100644
--- a/gcc/config/pdp11/pdp11.h
+++ b/gcc/config/pdp11/pdp11.h
@@ -100,8 +100,6 @@ along with GCC; see the file COPYING3. If not see
big endian, opposite for what you need for float, the vax float
conversion routines aren't actually used directly. But the underlying
format is indeed the vax/pdp11 float format. */
-#define TARGET_FLOAT_FORMAT VAX_FLOAT_FORMAT
-
extern const struct real_format pdp11_f_format;
extern const struct real_format pdp11_d_format;
diff --git a/gcc/config/rs6000/rs6000-c.c b/gcc/config/rs6000/rs6000-c.c
index ce1ec4b9665..8cbace8a795 100644
--- a/gcc/config/rs6000/rs6000-c.c
+++ b/gcc/config/rs6000/rs6000-c.c
@@ -85,12 +85,12 @@ rs6000_pragma_longcall (cpp_reader *pfile ATTRIBUTE_UNUSED)
#define builtin_assert(TXT) cpp_assert (pfile, TXT)
/* Keep the AltiVec keywords handy for fast comparisons. */
-static tree __vector_keyword;
-static tree vector_keyword;
-static tree __pixel_keyword;
-static tree pixel_keyword;
-static tree __bool_keyword;
-static tree bool_keyword;
+static GTY(()) tree __vector_keyword;
+static GTY(()) tree vector_keyword;
+static GTY(()) tree __pixel_keyword;
+static GTY(()) tree pixel_keyword;
+static GTY(()) tree __bool_keyword;
+static GTY(()) tree bool_keyword;
/* Preserved across calls. */
static tree expand_bool_pixel;
@@ -278,6 +278,8 @@ rs6000_cpu_cpp_builtins (cpp_reader *pfile)
cpp_get_callbacks (pfile)->macro_to_expand = rs6000_macro_to_expand;
}
}
+ if (rs6000_cpu == PROCESSOR_CELL)
+ builtin_define ("__PPU__");
if (TARGET_SPE)
builtin_define ("__SPE__");
if (TARGET_PAIRED_FLOAT)
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 57e8d5a874d..0f2779e54bf 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -52,7 +52,7 @@
#include "reload.h"
#include "cfglayout.h"
#include "sched-int.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "tree-flow.h"
#include "intl.h"
#include "params.h"
@@ -958,7 +958,7 @@ static void rs6000_darwin_file_start (void);
static tree rs6000_build_builtin_va_list (void);
static void rs6000_va_start (tree, rtx);
-static tree rs6000_gimplify_va_arg (tree, tree, tree *, tree *);
+static tree rs6000_gimplify_va_arg (tree, tree, gimple_seq *, gimple_seq *);
static bool rs6000_must_pass_in_stack (enum machine_mode, const_tree);
static bool rs6000_scalar_mode_supported_p (enum machine_mode);
static bool rs6000_vector_mode_supported_p (enum machine_mode);
@@ -1493,19 +1493,23 @@ rs6000_override_options (const char *default_cpu)
{"power3", PROCESSOR_PPC630,
POWERPC_BASE_MASK | MASK_PPC_GFXOPT | MASK_POWERPC64},
{"power4", PROCESSOR_POWER4,
- POWERPC_BASE_MASK | MASK_PPC_GFXOPT | MASK_MFCRF | MASK_POWERPC64},
+ POWERPC_BASE_MASK | MASK_POWERPC64 | MASK_PPC_GPOPT | MASK_PPC_GFXOPT
+ | MASK_MFCRF},
{"power5", PROCESSOR_POWER5,
- POWERPC_BASE_MASK | MASK_POWERPC64 | MASK_PPC_GFXOPT
+ POWERPC_BASE_MASK | MASK_POWERPC64 | MASK_PPC_GPOPT | MASK_PPC_GFXOPT
| MASK_MFCRF | MASK_POPCNTB},
{"power5+", PROCESSOR_POWER5,
- POWERPC_BASE_MASK | MASK_POWERPC64 | MASK_PPC_GFXOPT
+ POWERPC_BASE_MASK | MASK_POWERPC64 | MASK_PPC_GPOPT | MASK_PPC_GFXOPT
| MASK_MFCRF | MASK_POPCNTB | MASK_FPRND},
{"power6", PROCESSOR_POWER6,
- POWERPC_7400_MASK | MASK_POWERPC64 | MASK_MFCRF | MASK_POPCNTB
- | MASK_FPRND | MASK_CMPB | MASK_DFP },
+ POWERPC_7400_MASK | MASK_POWERPC64 | MASK_PPC_GPOPT | MASK_MFCRF
+ | MASK_POPCNTB | MASK_FPRND | MASK_CMPB | MASK_DFP},
{"power6x", PROCESSOR_POWER6,
- POWERPC_7400_MASK | MASK_POWERPC64 | MASK_MFCRF | MASK_POPCNTB
- | MASK_FPRND | MASK_CMPB | MASK_MFPGPR | MASK_DFP },
+ POWERPC_7400_MASK | MASK_POWERPC64 | MASK_PPC_GPOPT | MASK_MFCRF
+ | MASK_POPCNTB | MASK_FPRND | MASK_CMPB | MASK_DFP | MASK_MFPGPR},
+ {"power7", PROCESSOR_POWER5,
+ POWERPC_7400_MASK | MASK_POWERPC64 | MASK_PPC_GPOPT | MASK_MFCRF
+ | MASK_POPCNTB | MASK_FPRND | MASK_CMPB | MASK_DFP},
{"powerpc", PROCESSOR_POWERPC, POWERPC_BASE_MASK},
{"powerpc64", PROCESSOR_POWERPC64,
POWERPC_BASE_MASK | MASK_PPC_GFXOPT | MASK_POWERPC64},
@@ -1959,7 +1963,11 @@ rs6000_builtin_mask_for_load (void)
return 0;
}
-/* Implement targetm.vectorize.builtin_conversion. */
+/* Implement targetm.vectorize.builtin_conversion.
+ Returns a decl of a function that implements conversion of an integer vector
+ into a floating-point vector, or vice-versa. TYPE is the type of the integer
+ side of the conversion.
+ Return NULL_TREE if it is not available. */
static tree
rs6000_builtin_conversion (enum tree_code code, tree type)
{
@@ -1968,16 +1976,28 @@ rs6000_builtin_conversion (enum tree_code code, tree type)
switch (code)
{
+ case FIX_TRUNC_EXPR:
+ switch (TYPE_MODE (type))
+ {
+ case V4SImode:
+ return TYPE_UNSIGNED (type)
+ ? rs6000_builtin_decls[ALTIVEC_BUILTIN_VCTUXS]
+ : rs6000_builtin_decls[ALTIVEC_BUILTIN_VCTSXS];
+ default:
+ return NULL_TREE;
+ }
+
case FLOAT_EXPR:
switch (TYPE_MODE (type))
{
case V4SImode:
- return TYPE_UNSIGNED (type) ?
- rs6000_builtin_decls[ALTIVEC_BUILTIN_VCFUX] :
- rs6000_builtin_decls[ALTIVEC_BUILTIN_VCFSX];
+ return TYPE_UNSIGNED (type)
+ ? rs6000_builtin_decls[ALTIVEC_BUILTIN_VCFUX]
+ : rs6000_builtin_decls[ALTIVEC_BUILTIN_VCFSX];
default:
return NULL_TREE;
}
+
default:
return NULL_TREE;
}
@@ -1993,14 +2013,14 @@ rs6000_builtin_mul_widen_even (tree type)
switch (TYPE_MODE (type))
{
case V8HImode:
- return TYPE_UNSIGNED (type) ?
- rs6000_builtin_decls[ALTIVEC_BUILTIN_VMULEUH] :
- rs6000_builtin_decls[ALTIVEC_BUILTIN_VMULESH];
+ return TYPE_UNSIGNED (type)
+ ? rs6000_builtin_decls[ALTIVEC_BUILTIN_VMULEUH]
+ : rs6000_builtin_decls[ALTIVEC_BUILTIN_VMULESH];
case V16QImode:
- return TYPE_UNSIGNED (type) ?
- rs6000_builtin_decls[ALTIVEC_BUILTIN_VMULEUB] :
- rs6000_builtin_decls[ALTIVEC_BUILTIN_VMULESB];
+ return TYPE_UNSIGNED (type)
+ ? rs6000_builtin_decls[ALTIVEC_BUILTIN_VMULEUB]
+ : rs6000_builtin_decls[ALTIVEC_BUILTIN_VMULESB];
default:
return NULL_TREE;
}
@@ -2016,14 +2036,14 @@ rs6000_builtin_mul_widen_odd (tree type)
switch (TYPE_MODE (type))
{
case V8HImode:
- return TYPE_UNSIGNED (type) ?
- rs6000_builtin_decls[ALTIVEC_BUILTIN_VMULOUH] :
- rs6000_builtin_decls[ALTIVEC_BUILTIN_VMULOSH];
+ return TYPE_UNSIGNED (type)
+ ? rs6000_builtin_decls[ALTIVEC_BUILTIN_VMULOUH]
+ : rs6000_builtin_decls[ALTIVEC_BUILTIN_VMULOSH];
case V16QImode:
- return TYPE_UNSIGNED (type) ?
- rs6000_builtin_decls[ALTIVEC_BUILTIN_VMULOUB] :
- rs6000_builtin_decls[ALTIVEC_BUILTIN_VMULOSB];
+ return TYPE_UNSIGNED (type)
+ ? rs6000_builtin_decls[ALTIVEC_BUILTIN_VMULOUB]
+ : rs6000_builtin_decls[ALTIVEC_BUILTIN_VMULOSB];
default:
return NULL_TREE;
}
@@ -2110,7 +2130,7 @@ optimization_options (int level ATTRIBUTE_UNUSED, int size ATTRIBUTE_UNUSED)
Skip section anchors for Objective C and Objective C++
until front-ends fixed. */
if (!TARGET_MACHO && lang_hooks.name[4] != 'O')
- flag_section_anchors = 1;
+ flag_section_anchors = 2;
}
/* Implement TARGET_HANDLE_OPTION. */
@@ -2848,7 +2868,7 @@ paired_expand_vector_init (rtx target, rtx vals)
enum machine_mode mode = GET_MODE (target);
int n_elts = GET_MODE_NUNITS (mode);
int n_var = 0;
- rtx x, new, tmp, constant_op, op1, op2;
+ rtx x, new_rtx, tmp, constant_op, op1, op2;
int i;
for (i = 0; i < n_elts; ++i)
@@ -2867,10 +2887,10 @@ paired_expand_vector_init (rtx target, rtx vals)
if (n_var == 2)
{
/* The vector is initialized only with non-constants. */
- new = gen_rtx_VEC_CONCAT (V2SFmode, XVECEXP (vals, 0, 0),
+ new_rtx = gen_rtx_VEC_CONCAT (V2SFmode, XVECEXP (vals, 0, 0),
XVECEXP (vals, 0, 1));
- emit_move_insn (target, new);
+ emit_move_insn (target, new_rtx);
return;
}
@@ -2886,11 +2906,11 @@ paired_expand_vector_init (rtx target, rtx vals)
emit_move_insn (tmp, constant_op);
if (CONSTANT_P (op1))
- new = gen_rtx_VEC_CONCAT (V2SFmode, tmp, op2);
+ new_rtx = gen_rtx_VEC_CONCAT (V2SFmode, tmp, op2);
else
- new = gen_rtx_VEC_CONCAT (V2SFmode, op1, tmp);
+ new_rtx = gen_rtx_VEC_CONCAT (V2SFmode, op1, tmp);
- emit_move_insn (target, new);
+ emit_move_insn (target, new_rtx);
}
void
@@ -3947,6 +3967,8 @@ rs6000_legitimize_tls_address (rtx addr, enum tls_model model)
insn = emit_call_insn (insn);
RTL_CONST_CALL_P (insn) = 1;
use_reg (&CALL_INSN_FUNCTION_USAGE (insn), r3);
+ if (DEFAULT_ABI == ABI_V4 && TARGET_SECURE_PLT && flag_pic)
+ use_reg (&CALL_INSN_FUNCTION_USAGE (insn), pic_offset_table_rtx);
insn = get_insns ();
end_sequence ();
emit_libcall_block (insn, dest, r3, addr);
@@ -3969,6 +3991,8 @@ rs6000_legitimize_tls_address (rtx addr, enum tls_model model)
insn = emit_call_insn (insn);
RTL_CONST_CALL_P (insn) = 1;
use_reg (&CALL_INSN_FUNCTION_USAGE (insn), r3);
+ if (DEFAULT_ABI == ABI_V4 && TARGET_SECURE_PLT && flag_pic)
+ use_reg (&CALL_INSN_FUNCTION_USAGE (insn), pic_offset_table_rtx);
insn = get_insns ();
end_sequence ();
tmp1 = gen_reg_rtx (Pmode);
@@ -6712,9 +6736,12 @@ rs6000_va_start (tree valist, rtx nextarg)
valist = build_va_arg_indirect_ref (valist);
gpr = build3 (COMPONENT_REF, TREE_TYPE (f_gpr), valist, f_gpr, NULL_TREE);
- fpr = build3 (COMPONENT_REF, TREE_TYPE (f_fpr), valist, f_fpr, NULL_TREE);
- ovf = build3 (COMPONENT_REF, TREE_TYPE (f_ovf), valist, f_ovf, NULL_TREE);
- sav = build3 (COMPONENT_REF, TREE_TYPE (f_sav), valist, f_sav, NULL_TREE);
+ fpr = build3 (COMPONENT_REF, TREE_TYPE (f_fpr), unshare_expr (valist),
+ f_fpr, NULL_TREE);
+ ovf = build3 (COMPONENT_REF, TREE_TYPE (f_ovf), unshare_expr (valist),
+ f_ovf, NULL_TREE);
+ sav = build3 (COMPONENT_REF, TREE_TYPE (f_sav), unshare_expr (valist),
+ f_sav, NULL_TREE);
/* Count number of gp and fp argument registers used. */
words = crtl->args.info.words;
@@ -6730,7 +6757,7 @@ rs6000_va_start (tree valist, rtx nextarg)
if (cfun->va_list_gpr_size)
{
- t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (gpr), gpr,
+ t = build2 (MODIFY_EXPR, TREE_TYPE (gpr), gpr,
build_int_cst (NULL_TREE, n_gpr));
TREE_SIDE_EFFECTS (t) = 1;
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
@@ -6738,7 +6765,7 @@ rs6000_va_start (tree valist, rtx nextarg)
if (cfun->va_list_fpr_size)
{
- t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (fpr), fpr,
+ t = build2 (MODIFY_EXPR, TREE_TYPE (fpr), fpr,
build_int_cst (NULL_TREE, n_fpr));
TREE_SIDE_EFFECTS (t) = 1;
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
@@ -6749,7 +6776,7 @@ rs6000_va_start (tree valist, rtx nextarg)
if (words != 0)
t = build2 (POINTER_PLUS_EXPR, TREE_TYPE (ovf), t,
size_int (words * UNITS_PER_WORD));
- t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (ovf), ovf, t);
+ t = build2 (MODIFY_EXPR, TREE_TYPE (ovf), ovf, t);
TREE_SIDE_EFFECTS (t) = 1;
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
@@ -6766,7 +6793,7 @@ rs6000_va_start (tree valist, rtx nextarg)
if (cfun->machine->varargs_save_offset)
t = build2 (POINTER_PLUS_EXPR, TREE_TYPE (sav), t,
size_int (cfun->machine->varargs_save_offset));
- t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (sav), sav, t);
+ t = build2 (MODIFY_EXPR, TREE_TYPE (sav), sav, t);
TREE_SIDE_EFFECTS (t) = 1;
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
}
@@ -6774,7 +6801,8 @@ rs6000_va_start (tree valist, rtx nextarg)
/* Implement va_arg. */
tree
-rs6000_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p)
+rs6000_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p,
+ gimple_seq *post_p)
{
tree f_gpr, f_fpr, f_res, f_ovf, f_sav;
tree gpr, fpr, ovf, sav, reg, t, u;
@@ -6783,6 +6811,7 @@ rs6000_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p)
int align;
tree ptrtype = build_pointer_type (type);
int regalign = 0;
+ gimple stmt;
if (pass_by_reference (NULL, TYPE_MODE (type), type, false))
{
@@ -6801,14 +6830,14 @@ rs6000_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p)
if (elem_size < UNITS_PER_WORD)
{
tree real_part, imag_part;
- tree post = NULL_TREE;
+ gimple_seq post = NULL;
real_part = rs6000_gimplify_va_arg (valist, elem_type, pre_p,
&post);
/* Copy the value into a temporary, lest the formal temporary
be reused out from under us. */
real_part = get_initialized_tmp_var (real_part, pre_p, &post);
- append_to_statement_list (post, pre_p);
+ gimple_seq_add_seq (pre_p, post);
imag_part = rs6000_gimplify_va_arg (valist, elem_type, pre_p,
post_p);
@@ -6828,9 +6857,12 @@ rs6000_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p)
valist = build_va_arg_indirect_ref (valist);
gpr = build3 (COMPONENT_REF, TREE_TYPE (f_gpr), valist, f_gpr, NULL_TREE);
- fpr = build3 (COMPONENT_REF, TREE_TYPE (f_fpr), valist, f_fpr, NULL_TREE);
- ovf = build3 (COMPONENT_REF, TREE_TYPE (f_ovf), valist, f_ovf, NULL_TREE);
- sav = build3 (COMPONENT_REF, TREE_TYPE (f_sav), valist, f_sav, NULL_TREE);
+ fpr = build3 (COMPONENT_REF, TREE_TYPE (f_fpr), unshare_expr (valist),
+ f_fpr, NULL_TREE);
+ ovf = build3 (COMPONENT_REF, TREE_TYPE (f_ovf), unshare_expr (valist),
+ f_ovf, NULL_TREE);
+ sav = build3 (COMPONENT_REF, TREE_TYPE (f_sav), unshare_expr (valist),
+ f_sav, NULL_TREE);
size = int_size_in_bytes (type);
rsize = (size + 3) / 4;
@@ -6884,18 +6916,19 @@ rs6000_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p)
if (n_reg == 2 && reg == gpr)
{
regalign = 1;
- u = build2 (BIT_AND_EXPR, TREE_TYPE (reg), reg,
+ u = build2 (BIT_AND_EXPR, TREE_TYPE (reg), unshare_expr (reg),
build_int_cst (TREE_TYPE (reg), n_reg - 1));
- u = build2 (POSTINCREMENT_EXPR, TREE_TYPE (reg), reg, u);
+ u = build2 (POSTINCREMENT_EXPR, TREE_TYPE (reg),
+ unshare_expr (reg), u);
}
/* _Decimal128 is passed in even/odd fpr pairs; the stored
reg number is 0 for f1, so we want to make it odd. */
else if (reg == fpr && TYPE_MODE (type) == TDmode)
{
regalign = 1;
- t = build2 (BIT_IOR_EXPR, TREE_TYPE (reg), reg,
+ t = build2 (BIT_IOR_EXPR, TREE_TYPE (reg), unshare_expr (reg),
build_int_cst (TREE_TYPE (reg), 1));
- u = build2 (MODIFY_EXPR, void_type_node, reg, t);
+ u = build2 (MODIFY_EXPR, void_type_node, unshare_expr (reg), t);
}
t = fold_convert (TREE_TYPE (reg), size_int (8 - n_reg + 1));
@@ -6908,7 +6941,7 @@ rs6000_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p)
if (sav_ofs)
t = build2 (POINTER_PLUS_EXPR, ptr_type_node, sav, size_int (sav_ofs));
- u = build2 (POSTINCREMENT_EXPR, TREE_TYPE (reg), reg,
+ u = build2 (POSTINCREMENT_EXPR, TREE_TYPE (reg), unshare_expr (reg),
build_int_cst (TREE_TYPE (reg), n_reg));
u = fold_convert (sizetype, u);
u = build2 (MULT_EXPR, sizetype, u, size_int (sav_scale));
@@ -6921,22 +6954,18 @@ rs6000_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p)
&& TYPE_MODE (type) == SDmode)
t = build2 (POINTER_PLUS_EXPR, TREE_TYPE (t), t, size_int (size));
- t = build2 (GIMPLE_MODIFY_STMT, void_type_node, addr, t);
- gimplify_and_add (t, pre_p);
+ gimplify_assign (addr, t, pre_p);
- t = build1 (GOTO_EXPR, void_type_node, lab_over);
- gimplify_and_add (t, pre_p);
+ gimple_seq_add_stmt (pre_p, gimple_build_goto (lab_over));
- t = build1 (LABEL_EXPR, void_type_node, lab_false);
- append_to_statement_list (t, pre_p);
+ stmt = gimple_build_label (lab_false);
+ gimple_seq_add_stmt (pre_p, stmt);
if ((n_reg == 2 && !regalign) || n_reg > 2)
{
/* Ensure that we don't find any more args in regs.
Alignment has taken care of for special cases. */
- t = build_gimple_modify_stmt (reg,
- build_int_cst (TREE_TYPE (reg), 8));
- gimplify_and_add (t, pre_p);
+ gimplify_assign (reg, build_int_cst (TREE_TYPE (reg), 8), pre_p);
}
}
@@ -6954,17 +6983,15 @@ rs6000_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p)
}
gimplify_expr (&t, pre_p, NULL, is_gimple_val, fb_rvalue);
- u = build2 (GIMPLE_MODIFY_STMT, void_type_node, addr, t);
- gimplify_and_add (u, pre_p);
+ gimplify_assign (unshare_expr (addr), t, pre_p);
t = build2 (POINTER_PLUS_EXPR, TREE_TYPE (t), t, size_int (size));
- t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (ovf), ovf, t);
- gimplify_and_add (t, pre_p);
+ gimplify_assign (unshare_expr (ovf), t, pre_p);
if (lab_over)
{
- t = build1 (LABEL_EXPR, void_type_node, lab_over);
- append_to_statement_list (t, pre_p);
+ stmt = gimple_build_label (lab_over);
+ gimple_seq_add_stmt (pre_p, stmt);
}
if (STRICT_ALIGNMENT
@@ -9094,7 +9121,9 @@ rs6000_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
/* FIXME: There's got to be a nicer way to handle this case than
constructing a new CALL_EXPR. */
if (fcode == ALTIVEC_BUILTIN_VCFUX
- || fcode == ALTIVEC_BUILTIN_VCFSX)
+ || fcode == ALTIVEC_BUILTIN_VCFSX
+ || fcode == ALTIVEC_BUILTIN_VCTUXS
+ || fcode == ALTIVEC_BUILTIN_VCTSXS)
{
if (call_expr_nargs (exp) == 1)
exp = build_call_nary (TREE_TYPE (exp), CALL_EXPR_FN (exp),
@@ -11320,15 +11349,14 @@ rs6000_alloc_sdmode_stack_slot (void)
{
tree t;
basic_block bb;
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
gcc_assert (cfun->machine->sdmode_stack_slot == NULL_RTX);
FOR_EACH_BB (bb)
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- tree ret = walk_tree_without_duplicates (bsi_stmt_ptr (bsi),
- rs6000_check_sdmode, NULL);
+ tree ret = walk_gimple_op (gsi_stmt (gsi), rs6000_check_sdmode, NULL);
if (ret)
{
rtx stack = assign_stack_local (DDmode, GET_MODE_SIZE (DDmode), 0);
@@ -11363,11 +11391,11 @@ rs6000_instantiate_decls (void)
}
/* Return the register class of a scratch register needed to copy IN into
- or out of a register in CLASS in MODE. If it can be done directly,
+ or out of a register in RCLASS in MODE. If it can be done directly,
NO_REGS is returned. */
enum reg_class
-rs6000_secondary_reload_class (enum reg_class class,
+rs6000_secondary_reload_class (enum reg_class rclass,
enum machine_mode mode ATTRIBUTE_UNUSED,
rtx in)
{
@@ -11386,7 +11414,7 @@ rs6000_secondary_reload_class (enum reg_class class,
On Darwin, pic addresses require a load from memory, which
needs a base register. */
- if (class != BASE_REGS
+ if (rclass != BASE_REGS
&& (GET_CODE (in) == SYMBOL_REF
|| GET_CODE (in) == HIGH
|| GET_CODE (in) == LABEL_REF
@@ -11415,22 +11443,22 @@ rs6000_secondary_reload_class (enum reg_class class,
/* We can place anything into GENERAL_REGS and can put GENERAL_REGS
into anything. */
- if (class == GENERAL_REGS || class == BASE_REGS
+ if (rclass == GENERAL_REGS || rclass == BASE_REGS
|| (regno >= 0 && INT_REGNO_P (regno)))
return NO_REGS;
/* Constants, memory, and FP registers can go into FP registers. */
if ((regno == -1 || FP_REGNO_P (regno))
- && (class == FLOAT_REGS || class == NON_SPECIAL_REGS))
+ && (rclass == FLOAT_REGS || rclass == NON_SPECIAL_REGS))
return (mode != SDmode) ? NO_REGS : GENERAL_REGS;
/* Memory, and AltiVec registers can go into AltiVec registers. */
if ((regno == -1 || ALTIVEC_REGNO_P (regno))
- && class == ALTIVEC_REGS)
+ && rclass == ALTIVEC_REGS)
return NO_REGS;
/* We can copy among the CR registers. */
- if ((class == CR_REGS || class == CR0_REGS)
+ if ((rclass == CR_REGS || rclass == CR0_REGS)
&& regno >= 0 && CR_REGNO_P (regno))
return NO_REGS;
@@ -17571,7 +17599,7 @@ rs6000_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
HOST_WIDE_INT delta, HOST_WIDE_INT vcall_offset,
tree function)
{
- rtx this, insn, funexp;
+ rtx this_rtx, insn, funexp;
reload_completed = 1;
epilogue_completed = 1;
@@ -17582,17 +17610,17 @@ rs6000_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
/* Find the "this" pointer. If the function returns a structure,
the structure return pointer is in r3. */
if (aggregate_value_p (TREE_TYPE (TREE_TYPE (function)), function))
- this = gen_rtx_REG (Pmode, 4);
+ this_rtx = gen_rtx_REG (Pmode, 4);
else
- this = gen_rtx_REG (Pmode, 3);
+ this_rtx = gen_rtx_REG (Pmode, 3);
/* Apply the constant offset, if required. */
if (delta)
{
rtx delta_rtx = GEN_INT (delta);
emit_insn (TARGET_32BIT
- ? gen_addsi3 (this, this, delta_rtx)
- : gen_adddi3 (this, this, delta_rtx));
+ ? gen_addsi3 (this_rtx, this_rtx, delta_rtx)
+ : gen_adddi3 (this_rtx, this_rtx, delta_rtx));
}
/* Apply the offset from the vtable, if required. */
@@ -17601,7 +17629,7 @@ rs6000_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
rtx vcall_offset_rtx = GEN_INT (vcall_offset);
rtx tmp = gen_rtx_REG (Pmode, 12);
- emit_move_insn (tmp, gen_rtx_MEM (Pmode, this));
+ emit_move_insn (tmp, gen_rtx_MEM (Pmode, this_rtx));
if (((unsigned HOST_WIDE_INT) vcall_offset) + 0x8000 >= 0x10000)
{
emit_insn (TARGET_32BIT
@@ -17616,8 +17644,8 @@ rs6000_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
emit_move_insn (tmp, gen_rtx_MEM (Pmode, loc));
}
emit_insn (TARGET_32BIT
- ? gen_addsi3 (this, this, tmp)
- : gen_adddi3 (this, this, tmp));
+ ? gen_addsi3 (this_rtx, this_rtx, tmp)
+ : gen_adddi3 (this_rtx, this_rtx, tmp));
}
/* Generate a tail call to the target function. */
@@ -20513,12 +20541,12 @@ rs6000_elf_encode_section_info (tree decl, rtx rtl, int first)
}
static inline bool
-compare_section_name (const char *section, const char *template)
+compare_section_name (const char *section, const char *templ)
{
int len;
- len = strlen (template);
- return (strncmp (section, template, len) == 0
+ len = strlen (templ);
+ return (strncmp (section, templ, len) == 0
&& (section[len] == 0 || section[len] == '.'));
}
@@ -21806,17 +21834,17 @@ rs6000_register_move_cost (enum machine_mode mode,
or from memory. */
int
-rs6000_memory_move_cost (enum machine_mode mode, enum reg_class class,
+rs6000_memory_move_cost (enum machine_mode mode, enum reg_class rclass,
int in ATTRIBUTE_UNUSED)
{
- if (reg_classes_intersect_p (class, GENERAL_REGS))
+ if (reg_classes_intersect_p (rclass, GENERAL_REGS))
return 4 * hard_regno_nregs[0][mode];
- else if (reg_classes_intersect_p (class, FLOAT_REGS))
+ else if (reg_classes_intersect_p (rclass, FLOAT_REGS))
return 4 * hard_regno_nregs[32][mode];
- else if (reg_classes_intersect_p (class, ALTIVEC_REGS))
+ else if (reg_classes_intersect_p (rclass, ALTIVEC_REGS))
return 4 * hard_regno_nregs[FIRST_ALTIVEC_REGNO][mode];
else
- return 4 + rs6000_register_move_cost (mode, class, GENERAL_REGS);
+ return 4 + rs6000_register_move_cost (mode, rclass, GENERAL_REGS);
}
/* Returns a code for a target-specific builtin that implements
diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h
index 8a926e43c44..1f6d07b8c06 100644
--- a/gcc/config/rs6000/rs6000.h
+++ b/gcc/config/rs6000/rs6000.h
@@ -72,6 +72,12 @@
#define ASM_CPU_POWER6_SPEC "-mpower4 -maltivec"
#endif
+#ifdef HAVE_AS_VSX
+#define ASM_CPU_POWER7_SPEC "-mpower7"
+#else
+#define ASM_CPU_POWER7_SPEC "-mpower4 -maltivec"
+#endif
+
/* Common ASM definitions used by ASM_SPEC among the various targets
for handling -mcpu=xxx switches. */
#define ASM_CPU_SPEC \
@@ -92,6 +98,7 @@
%{mcpu=power5+: %(asm_cpu_power5)} \
%{mcpu=power6: %(asm_cpu_power6) -maltivec} \
%{mcpu=power6x: %(asm_cpu_power6) -maltivec} \
+%{mcpu=power7: %(asm_cpu_power7)} \
%{mcpu=powerpc: -mppc} \
%{mcpu=rios: -mpwr} \
%{mcpu=rios1: -mpwr} \
@@ -160,6 +167,7 @@
{ "cc1_cpu", CC1_CPU_SPEC }, \
{ "asm_cpu_power5", ASM_CPU_POWER5_SPEC }, \
{ "asm_cpu_power6", ASM_CPU_POWER6_SPEC }, \
+ { "asm_cpu_power7", ASM_CPU_POWER7_SPEC }, \
SUBTARGET_EXTRA_SPECS
/* -mcpu=native handling only makes sense with compiler running on
@@ -644,12 +652,15 @@ extern enum rs6000_nop_insertion rs6000_sched_insert_nops;
/* Define this macro to be the value 1 if unaligned accesses have a cost
many times greater than aligned accesses, for example if they are
emulated in a trap handler. */
+/* Altivec vector memory instructions simply ignore the low bits; SPE
+ vector memory instructions trap on unaligned accesses. */
#define SLOW_UNALIGNED_ACCESS(MODE, ALIGN) \
(STRICT_ALIGNMENT \
|| (((MODE) == SFmode || (MODE) == DFmode || (MODE) == TFmode \
|| (MODE) == SDmode || (MODE) == DDmode || (MODE) == TDmode \
|| (MODE) == DImode) \
- && (ALIGN) < 32))
+ && (ALIGN) < 32) \
+ || (VECTOR_MODE_P ((MODE)) && (ALIGN) < GET_MODE_BITSIZE ((MODE))))
/* Standard register usage. */
diff --git a/gcc/config/s390/2084.md b/gcc/config/s390/2084.md
index 0c42f187e9c..d3c92722bd9 100644
--- a/gcc/config/s390/2084.md
+++ b/gcc/config/s390/2084.md
@@ -243,7 +243,7 @@
(define_insn_reservation "x_itof" 7
(and (eq_attr "cpu" "z990,z9_109")
- (eq_attr "type" "itof"))
+ (eq_attr "type" "itoftf,itofdf,itofsf"))
"x_e1_t*3,x-wr-fp")
(define_bypass 1 "x_fsimpdf" "x_fstoredf")
diff --git a/gcc/config/s390/2097.md b/gcc/config/s390/2097.md
new file mode 100644
index 00000000000..f27302e0a2b
--- /dev/null
+++ b/gcc/config/s390/2097.md
@@ -0,0 +1,764 @@
+;; Scheduling description for z10 (cpu 2097).
+;; Copyright (C) 2008 Free Software Foundation, Inc.
+;; Contributed by Wolfgang Gellerich (gellerich@de.ibm.com).
+
+
+; General naming conventions used in this file:
+; - The two pipelines are called S and T, respectively.
+; - A name ending "_S" or "_T" indicates that something happens in
+; (or belongs to) this pipeline.
+; - A name ending "_ANY" indicates that something happens in (or belongs
+; to) either of the two pipelines.
+; - A name ending "_BOTH" indicates that something happens in (or belongs
+; to) both pipelines.
+
+
+;; Automaton and components.
+
+(define_automaton "z10_cpu")
+
+(define_cpu_unit "z10_e1_S, z10_e1_T" "z10_cpu")
+(define_reservation "z10_e1_ANY" "(z10_e1_S | z10_e1_T)")
+(define_reservation "z10_e1_BOTH" "(z10_e1_S + z10_e1_T)")
+
+
+; Both pipelines can execute a branch instruction, and branch
+; instructions can be grouped with all other groupable instructions
+; but not with a second branch instruction.
+
+(define_cpu_unit "z10_branch_ANY" "z10_cpu")
+
+(define_insn_reservation "z10_branch" 4
+ (and (eq_attr "cpu" "z10")
+ (eq_attr "type" "branch"))
+ "z10_branch_ANY + z10_e1_ANY, z10_Gate_ANY")
+
+
+; Z10 operand and result forwarding.
+
+; Instructions marked with the attributes as z10_fwd or z10_fr can
+; forward a value they load from one of their operants into a register
+; if the instruction in the second pipeline reads the same register.
+; The second operation must be superscalar. Instructions marked as
+; z10_rec or z10_fr can receive a value they read from a register is
+; this register gets updated by an instruction in the first pipeline.
+; The first instruction must be superscalar.
+
+
+; Forwarding from z10_fwd and z10_fr to z10_super.
+
+(define_bypass 0 "z10_la_fwd, z10_la_fwd_A1, z10_larl_fwd, z10_larl_fwd_A3, \
+ z10_load_fwd, z10_load_fwd_A3, \
+ z10_other_fwd, z10_other_fwd_A1, z10_other_fwd_A3, \
+ z10_other_fr, z10_other_fr_A3, z10_other_fr_E1, \
+ z10_other_fwd_E1, z10_lr_fr, z10_lr_fr_E1, \
+ z10_int_fwd, z10_int_fwd_A1, z10_int_fwd_A3, \
+ z10_int_fwd_E1, z10_int_fr, z10_int_fr_E1, \
+ z10_int_fr_A3"
+ "z10_other_super, z10_other_super_c_E1, z10_other_super_E1, \
+ z10_int_super, z10_int_super_E1, \
+ z10_lr, z10_store_super")
+
+
+; Forwarding from z10_super to frz10_ and z10_rec.
+
+(define_bypass 0 "z10_other_super, z10_other_super_E1, z10_other_super_c_E1, \
+ z10_int_super, z10_int_super_E1, \
+ z10_larl_super_E1, z10_larl_super, \
+ z10_store_super"
+ "z10_int_fr, z10_int_fr_E1, z10_int_fr_A3, \
+ z10_other_fr, z10_other_fr_A3, z10_lr_fr, z10_lr_fr_E1, \
+ z10_other_fr_E1, z10_store_rec")
+
+
+; Forwarding from z10_fwd and z10_fr to z10_rec and z10_fr.
+
+(define_bypass 0 "z10_la_fwd, z10_la_fwd_A1, z10_larl_fwd, z10_larl_fwd_A3, \
+ z10_load_fwd, z10_load_fwd_A3, \
+ z10_other_fwd, z10_other_fwd_A1, z10_other_fwd_A3, \
+ z10_other_fr, z10_other_fr_A3, z10_other_fr_E1, \
+ z10_other_fwd_E1, \
+ z10_lr_fr, z10_lr_fr_E1, \
+ z10_int_fwd, z10_int_fwd_A1, z10_int_fwd_A3, \
+ z10_int_fwd_E1, z10_int_fr, z10_int_fr_E1, \
+ z10_int_fr_A3"
+ "z10_int_fr, z10_int_fr_E1, z10_int_fr_A3, \
+ z10_other_fr, z10_other_fr_A3, z10_lr_fr, z10_lr_fr_E1, \
+ z10_other_fr_E1, z10_store_rec")
+
+
+;
+; Simple insns
+;
+
+; Here is the cycle diagram for FXU-executed instructions:
+; ... A1 A2 A3 E1 P1 P2 P3 R0 ...
+; ^ ^ ^
+; | | updated GPR is available
+; | write to GPR
+; instruction reads GPR during this cycle
+
+
+; Variants of z10_int follow.
+
+(define_insn_reservation "z10_int" 6
+ (and (and (eq_attr "cpu" "z10")
+ (eq_attr "type" "integer"))
+ (and (eq_attr "atype" "reg")
+ (and (and (eq_attr "z10prop" "!z10_super")
+ (eq_attr "z10prop" "!z10_super_c"))
+ (and (and (and (and (eq_attr "z10prop" "!z10_super_E1")
+ (eq_attr "z10prop" "!z10_super_c_E1"))
+ (eq_attr "z10prop" "!z10_fwd"))
+ (and (eq_attr "z10prop" "!z10_fwd_A1")
+ (eq_attr "z10prop" "!z10_fwd_A3")))
+ (and (and (eq_attr "z10prop" "!z10_fwd_E1")
+ (eq_attr "z10prop" "!z10_fr"))
+ (and (eq_attr "z10prop" "!z10_fr_E1")
+ (eq_attr "z10prop" "!z10_fr_A3")))))))
+ "z10_e1_ANY, z10_Gate_ANY")
+
+(define_insn_reservation "z10_int_super" 6
+ (and (eq_attr "cpu" "z10")
+ (and (eq_attr "type" "integer")
+ (and (eq_attr "atype" "reg")
+ (ior (eq_attr "z10prop" "z10_super")
+ (eq_attr "z10prop" "z10_super_c")))))
+ "z10_e1_ANY, z10_Gate_ANY")
+
+(define_insn_reservation "z10_int_super_E1" 6
+ (and (eq_attr "cpu" "z10")
+ (and (eq_attr "type" "integer")
+ (and (eq_attr "atype" "reg")
+ (ior (eq_attr "z10prop" "z10_super_E1")
+ (eq_attr "z10prop" "z10_super_c_E1")))))
+ "z10_e1_ANY, z10_Gate_ANY")
+
+(define_insn_reservation "z10_int_fwd" 6
+ (and (eq_attr "cpu" "z10")
+ (and (eq_attr "type" "integer")
+ (and (eq_attr "atype" "reg")
+ (eq_attr "z10prop" "z10_fwd"))))
+ "z10_e1_ANY, z10_Gate_ANY")
+
+(define_insn_reservation "z10_int_fwd_A1" 6
+ (and (eq_attr "cpu" "z10")
+ (and (eq_attr "type" "integer")
+ (and (eq_attr "atype" "reg")
+ (eq_attr "z10prop" "z10_fwd_A1"))))
+ "z10_e1_ANY, z10_Gate_ANY")
+
+(define_insn_reservation "z10_int_fwd_A3" 6
+ (and (eq_attr "cpu" "z10")
+ (and (eq_attr "type" "integer")
+ (and (eq_attr "atype" "reg")
+ (eq_attr "z10prop" "z10_fwd_A3"))))
+ "z10_e1_ANY, z10_Gate_ANY")
+
+(define_insn_reservation "z10_int_fwd_E1" 6
+ (and (eq_attr "cpu" "z10")
+ (and (eq_attr "type" "integer")
+ (and (eq_attr "atype" "reg")
+ (eq_attr "z10prop" "z10_fwd_E1"))))
+ "z10_e1_ANY, z10_Gate_ANY")
+
+(define_insn_reservation "z10_int_fr" 6
+ (and (eq_attr "cpu" "z10")
+ (and (eq_attr "type" "integer")
+ (and (eq_attr "atype" "reg")
+ (eq_attr "z10prop" "z10_fr"))))
+ "z10_e1_ANY, z10_Gate_ANY")
+
+(define_insn_reservation "z10_int_fr_E1" 6
+ (and (eq_attr "cpu" "z10")
+ (and (eq_attr "type" "integer")
+ (and (eq_attr "atype" "reg")
+ (eq_attr "z10prop" "z10_fr_E1"))))
+ "z10_e1_ANY, z10_Gate_ANY")
+
+(define_insn_reservation "z10_int_fr_A3" 6
+ (and (eq_attr "cpu" "z10")
+ (and (eq_attr "type" "integer")
+ (and (eq_attr "atype" "reg")
+ (eq_attr "z10prop" "z10_fr_A3"))))
+ "z10_e1_ANY, z10_Gate_ANY")
+
+; END of z10_int variants
+
+
+(define_insn_reservation "z10_agen" 6
+ (and (eq_attr "cpu" "z10")
+ (and (eq_attr "type" "integer")
+ (eq_attr "atype" "agen")))
+ "z10_e1_ANY, z10_Gate_ANY")
+
+
+(define_insn_reservation "z10_lr" 6
+ (and (eq_attr "cpu" "z10")
+ (and (eq_attr "type" "lr")
+ (and (eq_attr "z10prop" "!z10_fr")
+ (eq_attr "z10prop" "!z10_fr_E1"))))
+ "z10_e1_ANY, z10_Gate_ANY")
+
+(define_insn_reservation "z10_lr_fr" 6
+ (and (eq_attr "cpu" "z10")
+ (and (eq_attr "type" "lr")
+ (eq_attr "z10prop" "z10_fr")))
+ "z10_e1_ANY, z10_Gate_ANY")
+; "z10_e1_ANY")
+
+(define_insn_reservation "z10_lr_fr_E1" 6
+ (and (eq_attr "cpu" "z10")
+ (and (eq_attr "type" "lr")
+ (eq_attr "z10prop" "z10_fr_E1")))
+ "z10_e1_ANY, z10_Gate_ANY")
+; "z10_e1_ANY")
+
+
+(define_insn_reservation "z10_la" 6
+ (and (eq_attr "cpu" "z10")
+ (and (eq_attr "type" "la")
+ (and (eq_attr "z10prop" "!z10_fwd")
+ (eq_attr "z10prop" "!z10_fwd_A1"))))
+ "z10_e1_ANY, z10_Gate_ANY")
+
+(define_insn_reservation "z10_la_fwd" 6
+ (and (eq_attr "cpu" "z10")
+ (and (eq_attr "type" "la")
+ (eq_attr "z10prop" "z10_fwd")))
+ "z10_e1_ANY, z10_Gate_ANY")
+; "z10_e1_ANY")
+
+(define_insn_reservation "z10_la_fwd_A1" 6
+ (and (eq_attr "cpu" "z10")
+ (and (eq_attr "type" "la")
+ (eq_attr "z10prop" "z10_fwd_A1")))
+ "z10_e1_ANY, z10_Gate_ANY")
+; "z10_e1_ANY")
+
+
+; larl-type instructions
+
+(define_insn_reservation "z10_larl" 6
+ (and (eq_attr "cpu" "z10")
+ (and (eq_attr "type" "larl")
+ (and (eq_attr "z10prop" "!z10_super_A1")
+ (and (eq_attr "z10prop" "!z10_fwd")
+ (and (eq_attr "z10prop" "!z10_fwd_A3")
+ (and (eq_attr "z10prop" "!z10_super")
+ (eq_attr "z10prop" "!z10_super_c"))
+ (and (eq_attr "z10prop" "!z10_super_E1")
+ (eq_attr "z10prop" "!z10_super_c_E1")))))))
+ "z10_e1_ANY, z10_Gate_ANY")
+
+(define_insn_reservation "z10_larl_super" 6
+ (and (eq_attr "cpu" "z10")
+ (and (eq_attr "type" "larl")
+ (and (eq_attr "z10prop" "z10_super")
+ (eq_attr "z10prop" "z10_super_c"))))
+ "z10_e1_ANY, z10_Gate_ANY")
+
+(define_insn_reservation "z10_larl_fwd" 6
+ (and (eq_attr "cpu" "z10")
+ (and (eq_attr "type" "larl")
+ (eq_attr "z10prop" "z10_fwd")))
+ "z10_e1_ANY, z10_Gate_ANY")
+
+(define_insn_reservation "z10_larl_fwd_A3" 6
+ (and (eq_attr "cpu" "z10")
+ (and (eq_attr "type" "larl")
+ (eq_attr "z10prop" "z10_fwd_A3")))
+ "z10_e1_ANY, z10_Gate_ANY")
+
+
+(define_insn_reservation "z10_larl_A1" 6
+ (and (eq_attr "cpu" "z10")
+ (and (eq_attr "type" "larl")
+ (eq_attr "z10prop" "z10_super_A1")))
+ "z10_e1_ANY, z10_Gate_ANY")
+; "z10_e1_ANY")
+
+(define_insn_reservation "z10_larl_super_E1" 6
+ (and (eq_attr "cpu" "z10")
+ (and (eq_attr "type" "larl")
+ (ior (eq_attr "z10prop" "z10_super_E1")
+ (eq_attr "z10prop" "z10_super_c_E1"))))
+ "z10_e1_ANY, z10_Gate_ANY")
+; "z10_e1_ANY")
+
+
+(define_insn_reservation "z10_load" 6
+ (and (eq_attr "cpu" "z10")
+ (and (eq_attr "type" "load")
+ (and (eq_attr "z10prop" "!z10_fwd")
+ (eq_attr "z10prop" "!z10_fwd_A3"))))
+ "z10_e1_ANY, z10_Gate_ANY")
+
+(define_insn_reservation "z10_load_fwd" 6
+ (and (eq_attr "cpu" "z10")
+ (and (eq_attr "type" "load")
+ (eq_attr "z10prop" "z10_fwd")))
+ "z10_e1_ANY, z10_Gate_ANY")
+; "z10_e1_ANY")
+
+(define_insn_reservation "z10_load_fwd_A3" 6
+ (and (eq_attr "cpu" "z10")
+ (and (eq_attr "type" "load")
+ (eq_attr "z10prop" "z10_fwd_A3")))
+ "z10_e1_ANY, z10_Gate_ANY")
+; "z10_e1_ANY")
+
+(define_insn_reservation "z10_store" 6
+ (and (eq_attr "cpu" "z10")
+ (and (eq_attr "type" "store")
+ (and (eq_attr "z10prop" "!z10_rec")
+ (and (eq_attr "z10prop" "!z10_super")
+ (eq_attr "z10prop" "!z10_super_c")))))
+ "z10_e1_ANY, z10_Gate_ANY")
+
+(define_insn_reservation "z10_store_super" 6
+ (and (eq_attr "cpu" "z10")
+ (and (eq_attr "type" "store")
+ (ior (eq_attr "z10prop" "z10_super")
+ (eq_attr "z10prop" "z10_super_c"))))
+ "z10_e1_ANY, z10_Gate_ANY")
+
+(define_insn_reservation "z10_store_rec" 6
+ (and (eq_attr "cpu" "z10")
+ (and (eq_attr "type" "store")
+ (eq_attr "z10prop" "z10_rec")))
+ "z10_e1_ANY, z10_Gate_ANY")
+
+; The default_latency is chosen to drain off the pipeline.
+(define_insn_reservation "z10_call" 14
+ (and (eq_attr "cpu" "z10")
+ (eq_attr "type" "jsr"))
+ "z10_e1_BOTH*4, z10_Gate_BOTH")
+
+; The default latency is for worst case. CS and CSG take one
+; cycle only (i.e. latency would be 6).
+(define_insn_reservation "z10_sem" 9
+ (and (eq_attr "cpu" "z10")
+ (eq_attr "type" "sem"))
+ "z10_e1_BOTH*5, z10_Gate_ANY")
+
+(define_insn_reservation "z10_cs" 6
+ (and (eq_attr "cpu" "z10")
+ (eq_attr "type" "cs"))
+ "z10_e1_BOTH, z10_Gate_BOTH")
+
+(define_insn_reservation "z10_vs" 6
+ (and (eq_attr "cpu" "z10")
+ (eq_attr "type" "vs"))
+ "z10_e1_BOTH*4, z10_Gate_BOTH")
+
+; Load and store multiple. Actual number of cycles
+; in unknown at compile.time.
+(define_insn_reservation "z10_stm" 10
+ (and (eq_attr "cpu" "z10")
+ (ior (eq_attr "type" "stm")
+ (eq_attr "type" "lm")))
+ "z10_e1_BOTH*4, z10_Gate_BOTH")
+
+
+; Subsets of z10_other follow.
+
+(define_insn_reservation "z10_other" 6
+ (and (and (eq_attr "cpu" "z10")
+ (eq_attr "type" "other"))
+ (and (and (eq_attr "z10prop" "!z10_fwd")
+ (eq_attr "z10prop" "!z10_fwd_A1"))
+ (and (and (and (eq_attr "z10prop" "!z10_fr_A3")
+ (eq_attr "z10prop" "!z10_fwd_A3"))
+ (and (eq_attr "z10prop" "!z10_fr")
+ (eq_attr "z10prop" "!z10_fr_E1")))
+ (and (and (and (eq_attr "z10prop" "!z10_super")
+ (eq_attr "z10prop" "!z10_super_c"))
+ (eq_attr "z10prop" "!z10_super_c_E1"))
+ (and (eq_attr "z10prop" "!z10_super_E1")
+ (eq_attr "z10prop" "!z10_fwd_E1"))))))
+ "z10_e1_BOTH, z10_Gate_BOTH")
+
+(define_insn_reservation "z10_other_fr_E1" 6
+ (and (eq_attr "cpu" "z10")
+ (and (eq_attr "type" "other")
+ (eq_attr "z10prop" "z10_fr_E1")))
+ "z10_e1_BOTH, z10_Gate_BOTH")
+
+(define_insn_reservation "z10_other_super_c_E1" 6
+ (and (eq_attr "cpu" "z10")
+ (and (eq_attr "type" "other")
+ (eq_attr "z10prop" "z10_super_c_E1")))
+ "z10_e1_BOTH, z10_Gate_BOTH")
+
+(define_insn_reservation "z10_other_super_E1" 6
+ (and (eq_attr "cpu" "z10")
+ (and (eq_attr "type" "other")
+ (eq_attr "z10prop" "z10_super_E1")))
+ "z10_e1_BOTH, z10_Gate_BOTH")
+
+(define_insn_reservation "z10_other_fwd_E1" 6
+ (and (eq_attr "cpu" "z10")
+ (and (eq_attr "type" "other")
+ (eq_attr "z10prop" "z10_fwd_E1")))
+ "z10_e1_BOTH, z10_Gate_BOTH")
+
+(define_insn_reservation "z10_other_fwd" 6
+ (and (eq_attr "cpu" "z10")
+ (and (eq_attr "type" "other")
+ (eq_attr "z10prop" "z10_fwd")))
+ "z10_e1_BOTH, z10_Gate_BOTH")
+
+(define_insn_reservation "z10_other_fwd_A3" 6
+ (and (eq_attr "cpu" "z10")
+ (and (eq_attr "type" "other")
+ (eq_attr "z10prop" "z10_fwd_A3")))
+ "z10_e1_BOTH, z10_Gate_BOTH")
+
+(define_insn_reservation "z10_other_fwd_A1" 6
+ (and (eq_attr "cpu" "z10")
+ (and (eq_attr "type" "other")
+ (eq_attr "z10prop" "z10_fwd_A1")))
+ "z10_e1_BOTH, z10_Gate_BOTH")
+
+(define_insn_reservation "z10_other_fr" 6
+ (and (eq_attr "cpu" "z10")
+ (and (eq_attr "type" "other")
+ (eq_attr "z10prop" "z10_fr")))
+ "z10_e1_BOTH, z10_Gate_BOTH")
+
+(define_insn_reservation "z10_other_fr_A3" 6
+ (and (eq_attr "cpu" "z10")
+ (and (eq_attr "type" "other")
+ (eq_attr "z10prop" "z10_fr_A3")))
+ "z10_e1_BOTH, z10_Gate_BOTH")
+
+(define_insn_reservation "z10_other_super" 6
+ (and (eq_attr "cpu" "z10")
+ (and (eq_attr "type" "other")
+ (ior (eq_attr "z10prop" "z10_super")
+ (eq_attr "z10prop" "z10_super_c"))))
+ "z10_e1_BOTH, z10_Gate_BOTH")
+
+; END of z10_other subsets.
+
+
+;
+; Floating point insns
+;
+
+; Z10 executes the following integer operations in the BFU pipeline.
+
+(define_insn_reservation "z10_mul_sidi" 12
+ (and (eq_attr "cpu" "z10")
+ (eq_attr "type" "imulsi,imuldi,imulhi"))
+ "z10_e1_BOTH, z10_Gate_FP")
+
+; Some variants take fewer cycles, but that is not relevant here.
+(define_insn_reservation "z10_div" 162
+ (and (eq_attr "cpu" "z10")
+ (eq_attr "type" "idiv"))
+ "z10_e1_BOTH*4, z10_Gate_FP")
+
+
+; BFP multiplication and general instructions
+
+(define_insn_reservation "z10_fsimpdf" 12
+ (and (eq_attr "cpu" "z10")
+ (eq_attr "type" "fsimpdf,fmuldf"))
+ "z10_e1_BOTH, z10_Gate_FP")
+; Wg "z10_e1_T, z10_Gate_FP")
+
+(define_insn_reservation "z10_fsimpsf" 12
+ (and (eq_attr "cpu" "z10")
+ (eq_attr "type" "fsimpsf,fmulsf"))
+ "z10_e1_BOTH, z10_Gate_FP")
+; Wg "z10_e1_T, z10_Gate_FP")
+
+(define_insn_reservation "z10_fmultf" 52
+ (and (eq_attr "cpu" "z10")
+ (eq_attr "type" "fmultf"))
+ "z10_e1_BOTH*4, z10_Gate_FP")
+; Wg "z10_e1_T*4, z10_Gate_FP")
+
+(define_insn_reservation "z10_fsimptf" 14
+ (and (eq_attr "cpu" "z10")
+ (eq_attr "type" "fsimptf"))
+ "z10_e1_BOTH*2, z10_Gate_FP")
+; Wg "z10_e1_T*2, z10_Gate_FP")
+
+
+; BFP division
+
+(define_insn_reservation "z10_fdivtf" 113
+ (and (eq_attr "cpu" "z10")
+ (eq_attr "type" "fdivtf"))
+ "z10_e1_T*4, z10_Gate_FP")
+
+(define_insn_reservation "z10_fdivdf" 41
+ (and (eq_attr "cpu" "z10")
+ (eq_attr "type" "fdivdf"))
+ "z10_e1_T*4, z10_Gate_FP")
+
+(define_insn_reservation "z10_fdivsf" 34
+ (and (eq_attr "cpu" "z10")
+ (eq_attr "type" "fdivsf"))
+ "z10_e1_T*4, z10_Gate_FP")
+
+
+; BFP sqrt
+
+(define_insn_reservation "z10_fsqrtsf" 41
+ (and (eq_attr "cpu" "z10")
+ (eq_attr "type" "fsqrtsf"))
+ "z10_e1_T*4, z10_Gate_FP")
+
+(define_insn_reservation "z10_fsqrtdf" 54
+ (and (eq_attr "cpu" "z10")
+ (eq_attr "type" "fsqrtdf"))
+ "z10_e1_T*4, z10_Gate_FP")
+
+(define_insn_reservation "z10_fsqrtf" 122
+ (and (eq_attr "cpu" "z10")
+ (eq_attr "type" "fsqrttf"))
+ "z10_e1_T*4, z10_Gate_FP")
+
+
+; BFP load and store
+
+(define_insn_reservation "z10_floadtf" 12
+ (and (eq_attr "cpu" "z10")
+ (eq_attr "type" "floadtf"))
+ "z10_e1_T, z10_Gate_FP")
+
+(define_insn_reservation "z10_floaddf" 12
+ (and (eq_attr "cpu" "z10")
+ (eq_attr "type" "floaddf"))
+ "z10_e1_T, z10_Gate_FP")
+
+(define_insn_reservation "z10_floadsf" 12
+ (and (eq_attr "cpu" "z10")
+ (eq_attr "type" "floadsf"))
+ "z10_e1_T, z10_Gate_FP")
+
+(define_insn_reservation "z10_fstoredf" 12
+ (and (eq_attr "cpu" "z10")
+ (eq_attr "type" "fstoredf,fstoredd"))
+ "z10_e1_T, z10_Gate_FP")
+
+(define_insn_reservation "z10_fstoresf" 12
+ (and (eq_attr "cpu" "z10")
+ (eq_attr "type" "fstoresf,fstoresd"))
+ "z10_e1_T, z10_Gate_FP")
+
+
+; BFP truncate
+(define_insn_reservation "z10_ftrunctf" 12
+ (and (eq_attr "cpu" "z10")
+ (eq_attr "type" "ftrunctf"))
+ "z10_e1_T, z10_Gate_FP")
+
+(define_insn_reservation "z10_ftruncdf" 16
+ (and (eq_attr "cpu" "z10")
+ (eq_attr "type" "ftruncdf"))
+ "z10_e1_T, z10_Gate_FP")
+
+
+; Conversion between BFP and int.
+(define_insn_reservation "z10_ftoi" 13
+ (and (eq_attr "cpu" "z10")
+ (eq_attr "type" "ftoi"))
+ "z10_e1_T, z10_Gate_FP")
+
+(define_insn_reservation "z10_itoftf" 14
+ (and (eq_attr "cpu" "z10")
+ (eq_attr "type" "itoftf"))
+ "z10_e1_T*2, z10_Gate_FP")
+
+(define_insn_reservation "z10_itofsfdf" 12
+ (and (eq_attr "cpu" "z10")
+ (eq_attr "type" "itofdf,itofsf"))
+ "z10_e1_T, z10_Gate_FP")
+
+
+
+; BFP-related bypasses. There is no bypass for extended mode.
+(define_bypass 1 "z10_fsimpdf" "z10_fstoredf")
+(define_bypass 1 "z10_fsimpsf" "z10_fstoresf")
+(define_bypass 1 "z10_floaddf" "z10_fsimpdf, z10_fstoredf, z10_floaddf")
+(define_bypass 1 "z10_floadsf" "z10_fsimpsf, z10_fstoresf, z10_floadsf")
+
+
+;
+; insn_reservations for DFP instructions.
+;
+
+; Exact number of cycles is not known at compile-time.
+(define_insn_reservation "z10_fdivddtd" 40
+ (and (eq_attr "cpu" "z10")
+ (eq_attr "type" "fdivdd,fdivtd"))
+ "z10_e1_BOTH,z10_Gate_DFU")
+
+(define_insn_reservation "z10_ftruncsd" 38
+ (and (eq_attr "cpu" "z10")
+ (eq_attr "type" "ftruncsd"))
+ "z10_e1_BOTH*4,z10_Gate_DFU")
+
+(define_insn_reservation "z10_ftruncdd" 340
+ (and (eq_attr "cpu" "z10")
+ (eq_attr "type" "ftruncsd"))
+ "z10_e1_BOTH*4,z10_Gate_DFU")
+
+(define_insn_reservation "z10_floaddd" 12
+ (and (eq_attr "cpu" "z10")
+ (eq_attr "type" "floaddd"))
+ "z10_e1_BOTH,z10_Gate_DFU")
+
+(define_insn_reservation "z10_floadsd" 12
+ (and (eq_attr "cpu" "z10")
+ (eq_attr "type" "floadsd"))
+ "z10_e1_BOTH,z10_Gate_DFU")
+
+; Exact number of cycles is not known at compile-time.
+(define_insn_reservation "z10_fmulddtd" 35
+ (and (eq_attr "cpu" "z10")
+ (eq_attr "type" "fmuldd,fmultd"))
+ "z10_e1_BOTH,z10_Gate_DFU")
+
+(define_insn_reservation "z10_fsimpdd" 17
+ (and (eq_attr "cpu" "z10")
+ (eq_attr "type" "fsimpdd"))
+ "z10_e1_BOTH,z10_Gate_DFU")
+
+(define_insn_reservation "z10_fsimpsd" 17
+ (and (eq_attr "cpu" "z10")
+ (eq_attr "type" "fsimpsd"))
+ "z10_e1_BOTH,z10_Gate_DFU")
+
+(define_insn_reservation "z10_fsimptd" 18
+ (and (eq_attr "cpu" "z10")
+ (eq_attr "type" "fsimptd"))
+ "z10_e1_BOTH,z10_Gate_DFU")
+
+(define_insn_reservation "z10_itofdd" 36
+ (and (eq_attr "cpu" "z10")
+ (eq_attr "type" "itofdd"))
+ "z10_e1_BOTH*3,z10_Gate_DFU")
+
+(define_insn_reservation "z10_itoftd" 49
+ (and (eq_attr "cpu" "z10")
+ (eq_attr "type" "itoftd"))
+ "z10_e1_BOTH*3,z10_Gate_DFU")
+
+; Exact number of cycles is not known at compile-time.
+(define_insn_reservation "z10_ftoidfp" 30
+ (and (eq_attr "cpu" "z10")
+ (eq_attr "type" "ftoidfp"))
+ "z10_e1_BOTH*3,z10_Gate_DFU")
+
+
+;
+; Address-related bypasses
+;
+
+; Here is the cycle diagram for Address-related bypasses:
+; ... G1 G2 G3 A0 A1 A2 A3 E1 P1 P2 P3 R0 ...
+; ^ ^ ^ ^ ^
+; | | | | E1-type bypasses provide the new addr AFTER this cycle
+; | | | A3-type bypasses provide the new addr AFTER this cycle
+; | | A1-type bypasses provide the new addr AFTER this cycle
+; | AGI resolution, actual USE of address is DURING this cycle
+; AGI detection
+
+(define_bypass 3 "z10_larl_A1, z10_la_fwd_A1, z10_other_fwd_A1, \
+ z10_int_fwd_A1"
+ "z10_agen, z10_la, z10_branch, z10_call, z10_load, \
+ z10_store, \
+ z10_cs, z10_stm, z10_other"
+ "s390_agen_dep_p")
+
+
+(define_bypass 5 "z10_larl_fwd_A3, z10_load_fwd_A3, z10_other_fwd_A3, \
+ z10_other_fr_A3, z10_int_fwd_A3, z10_int_fr_A3"
+ "z10_agen, z10_la, z10_branch, z10_call, z10_load, \
+ z10_store, \
+ z10_cs, z10_stm, z10_other"
+ "s390_agen_dep_p")
+
+(define_bypass 6 "z10_other_fr_E1, z10_other_super_c_E1, z10_other_super_E1, \
+ z10_other_fwd_E1, \
+ z10_lr_fr_E1, z10_larl_super_E1, \
+ z10_int_super_E1, z10_int_fwd_E1, z10_int_fr_E1"
+ "z10_agen, z10_la, z10_branch, z10_call, z10_load, \
+ z10_store, \
+ z10_cs, z10_stm, z10_other"
+ "s390_agen_dep_p")
+
+
+
+;
+; Try to avoid transitions between DFU-, BFU- and FXU-executed instructions as there is a
+; dispatch delay required.
+;
+
+
+; Declaration for some pseudo-pipeline stages that reflect the
+; dispatch gap when issueing an INT/FXU/BFU-executed instruction after
+; an instruction executed by a different unit has been executed. The
+; approach is that we pretend a pipelined execution of BFU operations
+; with as many stages as the gap is long and request that none of
+; these stages is busy when issueing a FXU- or DFU-executed
+; instruction. Similar for FXU- and DFU-executed instructions.
+
+; Declaration for FPU stages.
+(define_cpu_unit "z10_f0, z10_f1, z10_f2, z10_f3, z10_f4, z10_f5, z10_f6, \
+ z10_f7, z10_f8, z10_f9, z10_f10, z10_f11, z10_f12" "z10_cpu")
+(define_reservation "z10_FP_PP" "z10_f0, z10_f1, z10_f2, z10_f3, z10_f4, \
+ z10_f5, z10_f6, z10_f7, z10_f8, z10_f9, z10_f10, z10_f11, \
+ z10_f12")
+
+; Declaration for FXU stages.
+(define_cpu_unit "z10_S1, z10_S2, z10_S3, z10_S4, z10_S5, z10_S6" "z10_cpu")
+(define_cpu_unit "z10_T1, z10_T2, z10_T3, z10_T4, z10_T5, z10_T6" "z10_cpu")
+(define_reservation "z10_INT_PP" "z10_S1 | z10_T1, z10_S2 | z10_T2, z10_S3 \
+ | z10_T3, z10_S4 | z10_T4, z10_S5 | \
+ z10_T5, z10_S6 | z10_T6")
+
+; Declaration for DFU stages.
+(define_cpu_unit "z10_d0, z10_d1, z10_d2, z10_d3, z10_d4, z10_d5, z10_d6"
+ "z10_cpu")
+(define_reservation "z10_DFU_PP" "z10_d0, z10_d1, z10_d2, z10_d3, z10_d4, \
+ z10_d5, z10_d6")
+
+
+; Pseudo-units representing whether the respective unit is available
+; in the sense that using it does not cause a dispatch delay.
+
+(define_cpu_unit "z10_S_avail, z10_T_avail, z10_FP_avail, z10_DFU_avail"
+ "z10_cpu")
+
+(absence_set "z10_FP_avail"
+ "z10_S1, z10_S2, z10_S3, z10_S4, z10_S5, z10_S6, z10_T1, z10_T2, z10_T3, z10_T4, \
+ z10_T5, z10_T6, \
+ z10_d0, z10_d1, z10_d2, z10_d3, z10_d4, z10_d5, z10_d6")
+
+(absence_set "z10_S_avail,z10_T_avail"
+ "z10_f0, z10_f1, z10_f2, z10_f3, z10_f4, z10_f5, z10_f6, z10_f7, \
+ z10_f8, z10_f9, z10_f10, z10_f11, z10_f12, \
+ z10_d0, z10_d1, z10_d2, z10_d3, z10_d4, z10_d5, z10_d6")
+
+(absence_set "z10_DFU_avail"
+ "z10_S1, z10_S2, z10_S3, z10_S4, z10_S5, z10_S6, z10_T1, z10_T2, z10_T3, z10_T4, \
+ z10_T5, z10_T6, \
+ z10_f0, z10_f1, z10_f2, z10_f3, z10_f4, z10_f5, z10_f6, z10_f7, \
+ z10_f8, z10_f9, z10_f10, z10_f11, z10_f12")
+
+
+; Pseudo-units to be used in insn_reservations.
+
+(define_reservation "z10_Gate_ANY" "((z10_S_avail | z10_T_avail), z10_INT_PP)")
+(define_reservation "z10_Gate_BOTH" "((z10_S_avail + z10_T_avail), z10_INT_PP)")
+
+(define_reservation "z10_Gate_FP" "z10_FP_avail, z10_FP_PP")
+
+(define_reservation "z10_Gate_DFU" "z10_DFU_avail, z10_DFU_PP")
diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index 936e0a0ead2..957707b8607 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -50,7 +50,7 @@ along with GCC; see the file COPYING3. If not see
#include "debug.h"
#include "langhooks.h"
#include "optabs.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "df.h"
@@ -192,33 +192,33 @@ struct processor_costs z9_109_cost =
static const
struct processor_costs z10_cost =
{
- COSTS_N_INSNS (4), /* M */
- COSTS_N_INSNS (2), /* MGHI */
- COSTS_N_INSNS (2), /* MH */
- COSTS_N_INSNS (2), /* MHI */
- COSTS_N_INSNS (4), /* ML */
- COSTS_N_INSNS (4), /* MR */
- COSTS_N_INSNS (5), /* MS */
- COSTS_N_INSNS (6), /* MSG */
- COSTS_N_INSNS (4), /* MSGF */
- COSTS_N_INSNS (4), /* MSGFR */
- COSTS_N_INSNS (4), /* MSGR */
- COSTS_N_INSNS (4), /* MSR */
- COSTS_N_INSNS (1), /* multiplication in DFmode */
- COSTS_N_INSNS (28), /* MXBR */
- COSTS_N_INSNS (130), /* SQXBR */
- COSTS_N_INSNS (66), /* SQDBR */
+ COSTS_N_INSNS (10), /* M */
+ COSTS_N_INSNS (10), /* MGHI */
+ COSTS_N_INSNS (10), /* MH */
+ COSTS_N_INSNS (10), /* MHI */
+ COSTS_N_INSNS (10), /* ML */
+ COSTS_N_INSNS (10), /* MR */
+ COSTS_N_INSNS (10), /* MS */
+ COSTS_N_INSNS (10), /* MSG */
+ COSTS_N_INSNS (10), /* MSGF */
+ COSTS_N_INSNS (10), /* MSGFR */
+ COSTS_N_INSNS (10), /* MSGR */
+ COSTS_N_INSNS (10), /* MSR */
+ COSTS_N_INSNS (10), /* multiplication in DFmode */
+ COSTS_N_INSNS (50), /* MXBR */
+ COSTS_N_INSNS (120), /* SQXBR */
+ COSTS_N_INSNS (52), /* SQDBR */
COSTS_N_INSNS (38), /* SQEBR */
- COSTS_N_INSNS (1), /* MADBR */
- COSTS_N_INSNS (1), /* MAEBR */
- COSTS_N_INSNS (60), /* DXBR */
- COSTS_N_INSNS (40), /* DDBR */
- COSTS_N_INSNS (26), /* DEBR */
- COSTS_N_INSNS (30), /* DLGR */
- COSTS_N_INSNS (23), /* DLR */
- COSTS_N_INSNS (23), /* DR */
- COSTS_N_INSNS (24), /* DSGFR */
- COSTS_N_INSNS (24), /* DSGR */
+ COSTS_N_INSNS (10), /* MADBR */
+ COSTS_N_INSNS (10), /* MAEBR */
+ COSTS_N_INSNS (111), /* DXBR */
+ COSTS_N_INSNS (39), /* DDBR */
+ COSTS_N_INSNS (32), /* DEBR */
+ COSTS_N_INSNS (160), /* DLGR */
+ COSTS_N_INSNS (71), /* DLR */
+ COSTS_N_INSNS (71), /* DR */
+ COSTS_N_INSNS (71), /* DSGFR */
+ COSTS_N_INSNS (71), /* DSGR */
};
extern int reload_completed;
@@ -836,17 +836,17 @@ s390_emit_compare (enum rtx_code code, rtx op0, rtx op1)
return ret;
}
-/* Emit a SImode compare and swap instruction setting MEM to NEW if OLD
+/* Emit a SImode compare and swap instruction setting MEM to NEW_RTX if OLD
matches CMP.
Return the correct condition RTL to be placed in the IF_THEN_ELSE of the
conditional branch testing the result. */
static rtx
-s390_emit_compare_and_swap (enum rtx_code code, rtx old, rtx mem, rtx cmp, rtx new)
+s390_emit_compare_and_swap (enum rtx_code code, rtx old, rtx mem, rtx cmp, rtx new_rtx)
{
rtx ret;
- emit_insn (gen_sync_compare_and_swap_ccsi (old, mem, cmp, new));
+ emit_insn (gen_sync_compare_and_swap_ccsi (old, mem, cmp, new_rtx));
ret = gen_rtx_fmt_ee (code, VOIDmode, s390_compare_emitted, const0_rtx);
s390_compare_emitted = NULL_RTX;
@@ -2758,11 +2758,11 @@ legitimate_reload_constant_p (rtx op)
return false;
}
-/* Given an rtx OP being reloaded into a reg required to be in class CLASS,
+/* Given an rtx OP being reloaded into a reg required to be in class RCLASS,
return the class of reg to actually use. */
enum reg_class
-s390_preferred_reload_class (rtx op, enum reg_class class)
+s390_preferred_reload_class (rtx op, enum reg_class rclass)
{
switch (GET_CODE (op))
{
@@ -2772,7 +2772,7 @@ s390_preferred_reload_class (rtx op, enum reg_class class)
case CONST_DOUBLE:
case CONST_INT:
if (legitimate_reload_constant_p (op))
- return class;
+ return rclass;
else
return NO_REGS;
@@ -2784,7 +2784,7 @@ s390_preferred_reload_class (rtx op, enum reg_class class)
case LABEL_REF:
case SYMBOL_REF:
case CONST:
- if (reg_class_subset_p (ADDR_REGS, class))
+ if (reg_class_subset_p (ADDR_REGS, rclass))
return ADDR_REGS;
else
return NO_REGS;
@@ -2793,7 +2793,7 @@ s390_preferred_reload_class (rtx op, enum reg_class class)
break;
}
- return class;
+ return rclass;
}
/* Return true if ADDR is of kind symbol_ref or symbol_ref + const_int
@@ -2923,15 +2923,15 @@ s390_reload_symref_address (rtx reg, rtx mem, rtx scratch, bool tomem)
}
/* Inform reload about cases where moving X with a mode MODE to a register in
- CLASS requires an extra scratch or immediate register. Return the class
+ RCLASS requires an extra scratch or immediate register. Return the class
needed for the immediate register. */
static enum reg_class
-s390_secondary_reload (bool in_p, rtx x, enum reg_class class,
+s390_secondary_reload (bool in_p, rtx x, enum reg_class rclass,
enum machine_mode mode, secondary_reload_info *sri)
{
/* Intermediate register needed. */
- if (reg_classes_intersect_p (CC_REGS, class))
+ if (reg_classes_intersect_p (CC_REGS, rclass))
return GENERAL_REGS;
if (TARGET_Z10)
@@ -3007,12 +3007,12 @@ s390_secondary_reload (bool in_p, rtx x, enum reg_class class,
/* For GENERAL_REGS a displacement overflow is no problem if occurring
in a s_operand address since we may fallback to lm/stm. So we only
have to care about overflows in the b+i+d case. */
- if ((reg_classes_intersect_p (GENERAL_REGS, class)
+ if ((reg_classes_intersect_p (GENERAL_REGS, rclass)
&& s390_class_max_nregs (GENERAL_REGS, mode) > 1
&& GET_CODE (XEXP (XEXP (x, 0), 0)) == PLUS)
/* For FP_REGS no lm/stm is available so this check is triggered
for displacement overflows in b+i+d and b+d like addresses. */
- || (reg_classes_intersect_p (FP_REGS, class)
+ || (reg_classes_intersect_p (FP_REGS, rclass)
&& s390_class_max_nregs (FP_REGS, mode) > 1))
{
if (in_p)
@@ -3029,7 +3029,7 @@ s390_secondary_reload (bool in_p, rtx x, enum reg_class class,
/* A scratch address register is needed when a symbolic constant is
copied to r0 compiling with -fPIC. In other cases the target
register might be used as temporary (see legitimize_pic_address). */
- if (in_p && SYMBOLIC_CONST (x) && flag_pic == 2 && class != ADDR_REGS)
+ if (in_p && SYMBOLIC_CONST (x) && flag_pic == 2 && rclass != ADDR_REGS)
sri->icode = (TARGET_64BIT ?
CODE_FOR_reloaddi_PIC_addr :
CODE_FOR_reloadsi_PIC_addr);
@@ -3218,7 +3218,7 @@ rtx
legitimize_pic_address (rtx orig, rtx reg)
{
rtx addr = orig;
- rtx new = orig;
+ rtx new_rtx = orig;
rtx base;
gcc_assert (!TLS_SYMBOLIC_CONST (addr));
@@ -3247,11 +3247,11 @@ legitimize_pic_address (rtx orig, rtx reg)
addr = force_const_mem (Pmode, addr);
emit_move_insn (temp, addr);
- new = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, temp);
+ new_rtx = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, temp);
if (reg != 0)
{
- s390_load_address (reg, new);
- new = reg;
+ s390_load_address (reg, new_rtx);
+ new_rtx = reg;
}
}
}
@@ -3268,12 +3268,12 @@ legitimize_pic_address (rtx orig, rtx reg)
if (reload_in_progress || reload_completed)
df_set_regs_ever_live (PIC_OFFSET_TABLE_REGNUM, true);
- new = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, addr), UNSPEC_GOT);
- new = gen_rtx_CONST (Pmode, new);
- new = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, new);
- new = gen_const_mem (Pmode, new);
- emit_move_insn (reg, new);
- new = reg;
+ new_rtx = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, addr), UNSPEC_GOT);
+ new_rtx = gen_rtx_CONST (Pmode, new_rtx);
+ new_rtx = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, new_rtx);
+ new_rtx = gen_const_mem (Pmode, new_rtx);
+ emit_move_insn (reg, new_rtx);
+ new_rtx = reg;
}
else if (TARGET_CPU_ZARCH)
{
@@ -3285,13 +3285,13 @@ legitimize_pic_address (rtx orig, rtx reg)
gcc_assert (REGNO (temp) >= FIRST_PSEUDO_REGISTER
|| REGNO_REG_CLASS (REGNO (temp)) == ADDR_REGS);
- new = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, addr), UNSPEC_GOTENT);
- new = gen_rtx_CONST (Pmode, new);
- emit_move_insn (temp, new);
+ new_rtx = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, addr), UNSPEC_GOTENT);
+ new_rtx = gen_rtx_CONST (Pmode, new_rtx);
+ emit_move_insn (temp, new_rtx);
- new = gen_const_mem (Pmode, temp);
- emit_move_insn (reg, new);
- new = reg;
+ new_rtx = gen_const_mem (Pmode, temp);
+ emit_move_insn (reg, new_rtx);
+ new_rtx = reg;
}
else
{
@@ -3311,10 +3311,10 @@ legitimize_pic_address (rtx orig, rtx reg)
addr = force_const_mem (Pmode, addr);
emit_move_insn (temp, addr);
- new = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, temp);
- new = gen_const_mem (Pmode, new);
- emit_move_insn (reg, new);
- new = reg;
+ new_rtx = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, temp);
+ new_rtx = gen_const_mem (Pmode, new_rtx);
+ emit_move_insn (reg, new_rtx);
+ new_rtx = reg;
}
}
else
@@ -3331,13 +3331,13 @@ legitimize_pic_address (rtx orig, rtx reg)
out of the literal pool, force them back in. */
case UNSPEC_GOTOFF:
case UNSPEC_PLTOFF:
- new = force_const_mem (Pmode, orig);
+ new_rtx = force_const_mem (Pmode, orig);
break;
/* @GOT is OK as is if small. */
case UNSPEC_GOT:
if (flag_pic == 2)
- new = force_const_mem (Pmode, orig);
+ new_rtx = force_const_mem (Pmode, orig);
break;
/* @GOTENT is OK as is. */
@@ -3361,11 +3361,11 @@ legitimize_pic_address (rtx orig, rtx reg)
addr = force_const_mem (Pmode, addr);
emit_move_insn (temp, addr);
- new = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, temp);
+ new_rtx = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, temp);
if (reg != 0)
{
- s390_load_address (reg, new);
- new = reg;
+ s390_load_address (reg, new_rtx);
+ new_rtx = reg;
}
}
break;
@@ -3411,12 +3411,12 @@ legitimize_pic_address (rtx orig, rtx reg)
}
emit_move_insn (temp, op0);
- new = gen_rtx_PLUS (Pmode, temp, op1);
+ new_rtx = gen_rtx_PLUS (Pmode, temp, op1);
if (reg != 0)
{
- s390_load_address (reg, new);
- new = reg;
+ s390_load_address (reg, new_rtx);
+ new_rtx = reg;
}
}
else
@@ -3441,11 +3441,11 @@ legitimize_pic_address (rtx orig, rtx reg)
addr = force_const_mem (Pmode, addr);
emit_move_insn (temp, addr);
- new = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, temp);
+ new_rtx = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, temp);
if (reg != 0)
{
- s390_load_address (reg, new);
- new = reg;
+ s390_load_address (reg, new_rtx);
+ new_rtx = reg;
}
}
}
@@ -3459,34 +3459,34 @@ legitimize_pic_address (rtx orig, rtx reg)
{
gcc_assert (XVECLEN (op0, 0) == 1);
- new = force_const_mem (Pmode, orig);
+ new_rtx = force_const_mem (Pmode, orig);
}
/* Otherwise, compute the sum. */
else
{
base = legitimize_pic_address (XEXP (addr, 0), reg);
- new = legitimize_pic_address (XEXP (addr, 1),
+ new_rtx = legitimize_pic_address (XEXP (addr, 1),
base == reg ? NULL_RTX : reg);
- if (GET_CODE (new) == CONST_INT)
- new = plus_constant (base, INTVAL (new));
+ if (GET_CODE (new_rtx) == CONST_INT)
+ new_rtx = plus_constant (base, INTVAL (new_rtx));
else
{
- if (GET_CODE (new) == PLUS && CONSTANT_P (XEXP (new, 1)))
+ if (GET_CODE (new_rtx) == PLUS && CONSTANT_P (XEXP (new_rtx, 1)))
{
- base = gen_rtx_PLUS (Pmode, base, XEXP (new, 0));
- new = XEXP (new, 1);
+ base = gen_rtx_PLUS (Pmode, base, XEXP (new_rtx, 0));
+ new_rtx = XEXP (new_rtx, 1);
}
- new = gen_rtx_PLUS (Pmode, base, new);
+ new_rtx = gen_rtx_PLUS (Pmode, base, new_rtx);
}
- if (GET_CODE (new) == CONST)
- new = XEXP (new, 0);
- new = force_operand (new, 0);
+ if (GET_CODE (new_rtx) == CONST)
+ new_rtx = XEXP (new_rtx, 0);
+ new_rtx = force_operand (new_rtx, 0);
}
}
}
- return new;
+ return new_rtx;
}
/* Load the thread pointer into a register. */
@@ -3532,7 +3532,7 @@ s390_emit_tls_call_insn (rtx result_reg, rtx tls_call)
static rtx
legitimize_tls_address (rtx addr, rtx reg)
{
- rtx new, tls_call, temp, base, r2, insn;
+ rtx new_rtx, tls_call, temp, base, r2, insn;
if (GET_CODE (addr) == SYMBOL_REF)
switch (tls_symbolic_operand (addr))
@@ -3541,22 +3541,22 @@ legitimize_tls_address (rtx addr, rtx reg)
start_sequence ();
r2 = gen_rtx_REG (Pmode, 2);
tls_call = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, addr), UNSPEC_TLSGD);
- new = gen_rtx_CONST (Pmode, tls_call);
- new = force_const_mem (Pmode, new);
- emit_move_insn (r2, new);
+ new_rtx = gen_rtx_CONST (Pmode, tls_call);
+ new_rtx = force_const_mem (Pmode, new_rtx);
+ emit_move_insn (r2, new_rtx);
s390_emit_tls_call_insn (r2, tls_call);
insn = get_insns ();
end_sequence ();
- new = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, addr), UNSPEC_NTPOFF);
+ new_rtx = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, addr), UNSPEC_NTPOFF);
temp = gen_reg_rtx (Pmode);
- emit_libcall_block (insn, temp, r2, new);
+ emit_libcall_block (insn, temp, r2, new_rtx);
- new = gen_rtx_PLUS (Pmode, s390_get_thread_pointer (), temp);
+ new_rtx = gen_rtx_PLUS (Pmode, s390_get_thread_pointer (), temp);
if (reg != 0)
{
- s390_load_address (reg, new);
- new = reg;
+ s390_load_address (reg, new_rtx);
+ new_rtx = reg;
}
break;
@@ -3564,32 +3564,32 @@ legitimize_tls_address (rtx addr, rtx reg)
start_sequence ();
r2 = gen_rtx_REG (Pmode, 2);
tls_call = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, const0_rtx), UNSPEC_TLSLDM);
- new = gen_rtx_CONST (Pmode, tls_call);
- new = force_const_mem (Pmode, new);
- emit_move_insn (r2, new);
+ new_rtx = gen_rtx_CONST (Pmode, tls_call);
+ new_rtx = force_const_mem (Pmode, new_rtx);
+ emit_move_insn (r2, new_rtx);
s390_emit_tls_call_insn (r2, tls_call);
insn = get_insns ();
end_sequence ();
- new = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, const0_rtx), UNSPEC_TLSLDM_NTPOFF);
+ new_rtx = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, const0_rtx), UNSPEC_TLSLDM_NTPOFF);
temp = gen_reg_rtx (Pmode);
- emit_libcall_block (insn, temp, r2, new);
+ emit_libcall_block (insn, temp, r2, new_rtx);
- new = gen_rtx_PLUS (Pmode, s390_get_thread_pointer (), temp);
+ new_rtx = gen_rtx_PLUS (Pmode, s390_get_thread_pointer (), temp);
base = gen_reg_rtx (Pmode);
- s390_load_address (base, new);
+ s390_load_address (base, new_rtx);
- new = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, addr), UNSPEC_DTPOFF);
- new = gen_rtx_CONST (Pmode, new);
- new = force_const_mem (Pmode, new);
+ new_rtx = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, addr), UNSPEC_DTPOFF);
+ new_rtx = gen_rtx_CONST (Pmode, new_rtx);
+ new_rtx = force_const_mem (Pmode, new_rtx);
temp = gen_reg_rtx (Pmode);
- emit_move_insn (temp, new);
+ emit_move_insn (temp, new_rtx);
- new = gen_rtx_PLUS (Pmode, base, temp);
+ new_rtx = gen_rtx_PLUS (Pmode, base, temp);
if (reg != 0)
{
- s390_load_address (reg, new);
- new = reg;
+ s390_load_address (reg, new_rtx);
+ new_rtx = reg;
}
break;
@@ -3602,26 +3602,26 @@ legitimize_tls_address (rtx addr, rtx reg)
if (reload_in_progress || reload_completed)
df_set_regs_ever_live (PIC_OFFSET_TABLE_REGNUM, true);
- new = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, addr), UNSPEC_GOTNTPOFF);
- new = gen_rtx_CONST (Pmode, new);
- new = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, new);
- new = gen_const_mem (Pmode, new);
+ new_rtx = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, addr), UNSPEC_GOTNTPOFF);
+ new_rtx = gen_rtx_CONST (Pmode, new_rtx);
+ new_rtx = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, new_rtx);
+ new_rtx = gen_const_mem (Pmode, new_rtx);
temp = gen_reg_rtx (Pmode);
- emit_move_insn (temp, new);
+ emit_move_insn (temp, new_rtx);
}
else if (TARGET_CPU_ZARCH)
{
/* If the GOT offset might be >= 4k, we determine the position
of the GOT entry via a PC-relative LARL. */
- new = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, addr), UNSPEC_INDNTPOFF);
- new = gen_rtx_CONST (Pmode, new);
+ new_rtx = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, addr), UNSPEC_INDNTPOFF);
+ new_rtx = gen_rtx_CONST (Pmode, new_rtx);
temp = gen_reg_rtx (Pmode);
- emit_move_insn (temp, new);
+ emit_move_insn (temp, new_rtx);
- new = gen_const_mem (Pmode, temp);
+ new_rtx = gen_const_mem (Pmode, temp);
temp = gen_reg_rtx (Pmode);
- emit_move_insn (temp, new);
+ emit_move_insn (temp, new_rtx);
}
else if (flag_pic)
{
@@ -3631,57 +3631,57 @@ legitimize_tls_address (rtx addr, rtx reg)
if (reload_in_progress || reload_completed)
df_set_regs_ever_live (PIC_OFFSET_TABLE_REGNUM, true);
- new = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, addr), UNSPEC_GOTNTPOFF);
- new = gen_rtx_CONST (Pmode, new);
- new = force_const_mem (Pmode, new);
+ new_rtx = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, addr), UNSPEC_GOTNTPOFF);
+ new_rtx = gen_rtx_CONST (Pmode, new_rtx);
+ new_rtx = force_const_mem (Pmode, new_rtx);
temp = gen_reg_rtx (Pmode);
- emit_move_insn (temp, new);
+ emit_move_insn (temp, new_rtx);
- new = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, temp);
- new = gen_const_mem (Pmode, new);
+ new_rtx = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, temp);
+ new_rtx = gen_const_mem (Pmode, new_rtx);
- new = gen_rtx_UNSPEC (Pmode, gen_rtvec (2, new, addr), UNSPEC_TLS_LOAD);
+ new_rtx = gen_rtx_UNSPEC (Pmode, gen_rtvec (2, new_rtx, addr), UNSPEC_TLS_LOAD);
temp = gen_reg_rtx (Pmode);
- emit_insn (gen_rtx_SET (Pmode, temp, new));
+ emit_insn (gen_rtx_SET (Pmode, temp, new_rtx));
}
else
{
/* In position-dependent code, load the absolute address of
the GOT entry from the literal pool. */
- new = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, addr), UNSPEC_INDNTPOFF);
- new = gen_rtx_CONST (Pmode, new);
- new = force_const_mem (Pmode, new);
+ new_rtx = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, addr), UNSPEC_INDNTPOFF);
+ new_rtx = gen_rtx_CONST (Pmode, new_rtx);
+ new_rtx = force_const_mem (Pmode, new_rtx);
temp = gen_reg_rtx (Pmode);
- emit_move_insn (temp, new);
+ emit_move_insn (temp, new_rtx);
- new = temp;
- new = gen_const_mem (Pmode, new);
- new = gen_rtx_UNSPEC (Pmode, gen_rtvec (2, new, addr), UNSPEC_TLS_LOAD);
+ new_rtx = temp;
+ new_rtx = gen_const_mem (Pmode, new_rtx);
+ new_rtx = gen_rtx_UNSPEC (Pmode, gen_rtvec (2, new_rtx, addr), UNSPEC_TLS_LOAD);
temp = gen_reg_rtx (Pmode);
- emit_insn (gen_rtx_SET (Pmode, temp, new));
+ emit_insn (gen_rtx_SET (Pmode, temp, new_rtx));
}
- new = gen_rtx_PLUS (Pmode, s390_get_thread_pointer (), temp);
+ new_rtx = gen_rtx_PLUS (Pmode, s390_get_thread_pointer (), temp);
if (reg != 0)
{
- s390_load_address (reg, new);
- new = reg;
+ s390_load_address (reg, new_rtx);
+ new_rtx = reg;
}
break;
case TLS_MODEL_LOCAL_EXEC:
- new = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, addr), UNSPEC_NTPOFF);
- new = gen_rtx_CONST (Pmode, new);
- new = force_const_mem (Pmode, new);
+ new_rtx = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, addr), UNSPEC_NTPOFF);
+ new_rtx = gen_rtx_CONST (Pmode, new_rtx);
+ new_rtx = force_const_mem (Pmode, new_rtx);
temp = gen_reg_rtx (Pmode);
- emit_move_insn (temp, new);
+ emit_move_insn (temp, new_rtx);
- new = gen_rtx_PLUS (Pmode, s390_get_thread_pointer (), temp);
+ new_rtx = gen_rtx_PLUS (Pmode, s390_get_thread_pointer (), temp);
if (reg != 0)
{
- s390_load_address (reg, new);
- new = reg;
+ s390_load_address (reg, new_rtx);
+ new_rtx = reg;
}
break;
@@ -3695,7 +3695,7 @@ legitimize_tls_address (rtx addr, rtx reg)
{
case UNSPEC_INDNTPOFF:
gcc_assert (TARGET_CPU_ZARCH);
- new = addr;
+ new_rtx = addr;
break;
default:
@@ -3706,19 +3706,19 @@ legitimize_tls_address (rtx addr, rtx reg)
else if (GET_CODE (addr) == CONST && GET_CODE (XEXP (addr, 0)) == PLUS
&& GET_CODE (XEXP (XEXP (addr, 0), 1)) == CONST_INT)
{
- new = XEXP (XEXP (addr, 0), 0);
- if (GET_CODE (new) != SYMBOL_REF)
- new = gen_rtx_CONST (Pmode, new);
+ new_rtx = XEXP (XEXP (addr, 0), 0);
+ if (GET_CODE (new_rtx) != SYMBOL_REF)
+ new_rtx = gen_rtx_CONST (Pmode, new_rtx);
- new = legitimize_tls_address (new, reg);
- new = plus_constant (new, INTVAL (XEXP (XEXP (addr, 0), 1)));
- new = force_operand (new, 0);
+ new_rtx = legitimize_tls_address (new_rtx, reg);
+ new_rtx = plus_constant (new_rtx, INTVAL (XEXP (XEXP (addr, 0), 1)));
+ new_rtx = force_operand (new_rtx, 0);
}
else
gcc_unreachable (); /* for now ... */
- return new;
+ return new_rtx;
}
/* Emit insns making the address in operands[1] valid for a standard
@@ -3865,19 +3865,19 @@ legitimize_reload_address (rtx ad, enum machine_mode mode ATTRIBUTE_UNUSED,
{
HOST_WIDE_INT lower = INTVAL (XEXP (ad, 1)) & 0xfff;
HOST_WIDE_INT upper = INTVAL (XEXP (ad, 1)) ^ lower;
- rtx cst, tem, new;
+ rtx cst, tem, new_rtx;
cst = GEN_INT (upper);
if (!legitimate_reload_constant_p (cst))
cst = force_const_mem (Pmode, cst);
tem = gen_rtx_PLUS (Pmode, XEXP (ad, 0), cst);
- new = gen_rtx_PLUS (Pmode, tem, GEN_INT (lower));
+ new_rtx = gen_rtx_PLUS (Pmode, tem, GEN_INT (lower));
push_reload (XEXP (tem, 1), 0, &XEXP (tem, 1), 0,
BASE_REG_CLASS, Pmode, VOIDmode, 0, 0,
opnum, (enum reload_type) type);
- return new;
+ return new_rtx;
}
return NULL_RTX;
@@ -4547,13 +4547,13 @@ init_alignment_context (struct alignment_context *ac, rtx mem,
}
/* Expand an atomic compare and swap operation for HImode and QImode. MEM is
- the memory location, CMP the old value to compare MEM with and NEW the value
+ the memory location, CMP the old value to compare MEM with and NEW_RTX the value
to set if CMP == MEM.
CMP is never in memory for compare_and_swap_cc because
expand_bool_compare_and_swap puts it into a register for later compare. */
void
-s390_expand_cs_hqi (enum machine_mode mode, rtx target, rtx mem, rtx cmp, rtx new)
+s390_expand_cs_hqi (enum machine_mode mode, rtx target, rtx mem, rtx cmp, rtx new_rtx)
{
struct alignment_context ac;
rtx cmpv, newv, val, resv, cc;
@@ -4569,8 +4569,8 @@ s390_expand_cs_hqi (enum machine_mode mode, rtx target, rtx mem, rtx cmp, rtx ne
/* Shift the values to the correct bit positions. */
if (!(ac.aligned && MEM_P (cmp)))
cmp = s390_expand_mask_and_shift (cmp, mode, ac.shift);
- if (!(ac.aligned && MEM_P (new)))
- new = s390_expand_mask_and_shift (new, mode, ac.shift);
+ if (!(ac.aligned && MEM_P (new_rtx)))
+ new_rtx = s390_expand_mask_and_shift (new_rtx, mode, ac.shift);
/* Load full word. Subsequent loads are performed by CS. */
val = expand_simple_binop (SImode, AND, ac.memsi, ac.modemaski,
@@ -4592,13 +4592,13 @@ s390_expand_cs_hqi (enum machine_mode mode, rtx target, rtx mem, rtx cmp, rtx ne
else
cmpv = force_reg (SImode, expand_simple_binop (SImode, IOR, cmp, val,
NULL_RTX, 1, OPTAB_DIRECT));
- if (ac.aligned && MEM_P (new))
+ if (ac.aligned && MEM_P (new_rtx))
{
newv = force_reg (SImode, val);
- store_bit_field (newv, GET_MODE_BITSIZE (mode), 0, SImode, new);
+ store_bit_field (newv, GET_MODE_BITSIZE (mode), 0, SImode, new_rtx);
}
else
- newv = force_reg (SImode, expand_simple_binop (SImode, IOR, new, val,
+ newv = force_reg (SImode, expand_simple_binop (SImode, IOR, new_rtx, val,
NULL_RTX, 1, OPTAB_DIRECT));
/* Jump to end if we're done (likely?). */
@@ -4632,7 +4632,7 @@ s390_expand_atomic (enum machine_mode mode, enum rtx_code code,
{
struct alignment_context ac;
rtx cmp;
- rtx new = gen_reg_rtx (SImode);
+ rtx new_rtx = gen_reg_rtx (SImode);
rtx orig = gen_reg_rtx (SImode);
rtx csloop = gen_label_rtx ();
@@ -4658,39 +4658,39 @@ s390_expand_atomic (enum machine_mode mode, enum rtx_code code,
/* Start CS loop. */
emit_label (csloop);
- emit_move_insn (new, cmp);
+ emit_move_insn (new_rtx, cmp);
/* Patch new with val at correct position. */
switch (code)
{
case PLUS:
case MINUS:
- val = expand_simple_binop (SImode, code, new, orig,
+ val = expand_simple_binop (SImode, code, new_rtx, orig,
NULL_RTX, 1, OPTAB_DIRECT);
val = expand_simple_binop (SImode, AND, val, ac.modemask,
NULL_RTX, 1, OPTAB_DIRECT);
/* FALLTHRU */
case SET:
if (ac.aligned && MEM_P (val))
- store_bit_field (new, GET_MODE_BITSIZE (mode), 0, SImode, val);
+ store_bit_field (new_rtx, GET_MODE_BITSIZE (mode), 0, SImode, val);
else
{
- new = expand_simple_binop (SImode, AND, new, ac.modemaski,
+ new_rtx = expand_simple_binop (SImode, AND, new_rtx, ac.modemaski,
NULL_RTX, 1, OPTAB_DIRECT);
- new = expand_simple_binop (SImode, IOR, new, val,
+ new_rtx = expand_simple_binop (SImode, IOR, new_rtx, val,
NULL_RTX, 1, OPTAB_DIRECT);
}
break;
case AND:
case IOR:
case XOR:
- new = expand_simple_binop (SImode, code, new, val,
+ new_rtx = expand_simple_binop (SImode, code, new_rtx, val,
NULL_RTX, 1, OPTAB_DIRECT);
break;
case MULT: /* NAND */
- new = expand_simple_binop (SImode, XOR, new, ac.modemask,
+ new_rtx = expand_simple_binop (SImode, XOR, new_rtx, ac.modemask,
NULL_RTX, 1, OPTAB_DIRECT);
- new = expand_simple_binop (SImode, AND, new, val,
+ new_rtx = expand_simple_binop (SImode, AND, new_rtx, val,
NULL_RTX, 1, OPTAB_DIRECT);
break;
default:
@@ -4698,12 +4698,12 @@ s390_expand_atomic (enum machine_mode mode, enum rtx_code code,
}
s390_emit_jump (csloop, s390_emit_compare_and_swap (NE, cmp,
- ac.memsi, cmp, new));
+ ac.memsi, cmp, new_rtx));
/* Return the correct part of the bitfield. */
if (target)
convert_move (target, expand_simple_binop (SImode, LSHIFTRT,
- after ? new : cmp, ac.shift,
+ after ? new_rtx : cmp, ac.shift,
NULL_RTX, 1, OPTAB_DIRECT), 1);
}
@@ -5266,6 +5266,7 @@ s390_agen_dep_p (rtx dep_insn, rtx insn)
return 0;
}
+
/* A C statement (sans semicolon) to update the integer scheduling priority
INSN_PRIORITY (INSN). Increase the priority to execute the INSN earlier,
reduce the priority to execute INSN later. Do not define this macro if
@@ -7288,12 +7289,12 @@ s390_hard_regno_rename_ok (unsigned int old_reg, unsigned int new_reg)
}
/* Maximum number of registers to represent a value of mode MODE
- in a register of class CLASS. */
+ in a register of class RCLASS. */
bool
-s390_class_max_nregs (enum reg_class class, enum machine_mode mode)
+s390_class_max_nregs (enum reg_class rclass, enum machine_mode mode)
{
- switch (class)
+ switch (rclass)
{
case FP_REGS:
if (GET_MODE_CLASS (mode) == MODE_COMPLEX_FLOAT)
@@ -8424,15 +8425,15 @@ s390_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED)
if (cfun->va_list_gpr_size)
{
- t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (gpr), gpr,
- build_int_cst (NULL_TREE, n_gpr));
+ t = build2 (MODIFY_EXPR, TREE_TYPE (gpr), gpr,
+ build_int_cst (NULL_TREE, n_gpr));
TREE_SIDE_EFFECTS (t) = 1;
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
}
if (cfun->va_list_fpr_size)
{
- t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (fpr), fpr,
+ t = build2 (MODIFY_EXPR, TREE_TYPE (fpr), fpr,
build_int_cst (NULL_TREE, n_fpr));
TREE_SIDE_EFFECTS (t) = 1;
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
@@ -8452,7 +8453,7 @@ s390_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED)
t = build2 (POINTER_PLUS_EXPR, TREE_TYPE (ovf), t, size_int (off));
- t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (ovf), ovf, t);
+ t = build2 (MODIFY_EXPR, TREE_TYPE (ovf), ovf, t);
TREE_SIDE_EFFECTS (t) = 1;
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
}
@@ -8465,7 +8466,7 @@ s390_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED)
t = build2 (POINTER_PLUS_EXPR, TREE_TYPE (sav), t,
size_int (-RETURN_REGNUM * UNITS_PER_WORD));
- t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (sav), sav, t);
+ t = build2 (MODIFY_EXPR, TREE_TYPE (sav), sav, t);
TREE_SIDE_EFFECTS (t) = 1;
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
}
@@ -8496,8 +8497,8 @@ s390_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED)
} */
static tree
-s390_gimplify_va_arg (tree valist, tree type, tree *pre_p,
- tree *post_p ATTRIBUTE_UNUSED)
+s390_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p,
+ gimple_seq *post_p ATTRIBUTE_UNUSED)
{
tree f_gpr, f_fpr, f_ovf, f_sav;
tree gpr, fpr, ovf, sav, reg, t, u;
@@ -8512,9 +8513,13 @@ s390_gimplify_va_arg (tree valist, tree type, tree *pre_p,
valist = build_va_arg_indirect_ref (valist);
gpr = build3 (COMPONENT_REF, TREE_TYPE (f_gpr), valist, f_gpr, NULL_TREE);
fpr = build3 (COMPONENT_REF, TREE_TYPE (f_fpr), valist, f_fpr, NULL_TREE);
- ovf = build3 (COMPONENT_REF, TREE_TYPE (f_ovf), valist, f_ovf, NULL_TREE);
sav = build3 (COMPONENT_REF, TREE_TYPE (f_sav), valist, f_sav, NULL_TREE);
+ /* The tree for args* cannot be shared between gpr/fpr and ovf since
+ both appear on a lhs. */
+ valist = unshare_expr (valist);
+ ovf = build3 (COMPONENT_REF, TREE_TYPE (f_ovf), valist, f_ovf, NULL_TREE);
+
size = int_size_in_bytes (type);
if (pass_by_reference (NULL, TYPE_MODE (type), type, false))
@@ -8598,14 +8603,11 @@ s390_gimplify_va_arg (tree valist, tree type, tree *pre_p,
fold_convert (TREE_TYPE (reg), size_int (sav_scale)));
t = build2 (POINTER_PLUS_EXPR, ptr_type_node, t, fold_convert (sizetype, u));
- t = build2 (GIMPLE_MODIFY_STMT, void_type_node, addr, t);
- gimplify_and_add (t, pre_p);
+ gimplify_assign (addr, t, pre_p);
- t = build1 (GOTO_EXPR, void_type_node, lab_over);
- gimplify_and_add (t, pre_p);
+ gimple_seq_add_stmt (pre_p, gimple_build_goto (lab_over));
- t = build1 (LABEL_EXPR, void_type_node, lab_false);
- append_to_statement_list (t, pre_p);
+ gimple_seq_add_stmt (pre_p, gimple_build_label (lab_false));
/* ... Otherwise out of the overflow area. */
@@ -8617,16 +8619,13 @@ s390_gimplify_va_arg (tree valist, tree type, tree *pre_p,
gimplify_expr (&t, pre_p, NULL, is_gimple_val, fb_rvalue);
- u = build2 (GIMPLE_MODIFY_STMT, void_type_node, addr, t);
- gimplify_and_add (u, pre_p);
+ gimplify_assign (addr, t, pre_p);
t = build2 (POINTER_PLUS_EXPR, ptr_type_node, t,
size_int (size));
- t = build2 (GIMPLE_MODIFY_STMT, ptr_type_node, ovf, t);
- gimplify_and_add (t, pre_p);
+ gimplify_assign (ovf, t, pre_p);
- t = build1 (LABEL_EXPR, void_type_node, lab_over);
- append_to_statement_list (t, pre_p);
+ gimple_seq_add_stmt (pre_p, gimple_build_label (lab_over));
/* Increment register save count. */
diff --git a/gcc/config/s390/s390.h b/gcc/config/s390/s390.h
index 79286d5a9bc..a8cb4774969 100644
--- a/gcc/config/s390/s390.h
+++ b/gcc/config/s390/s390.h
@@ -748,10 +748,10 @@ used in insn definitions or inline assemblies. */
macro is used in only one place: `find_reloads_address' in reload.c. */
#define LEGITIMIZE_RELOAD_ADDRESS(AD, MODE, OPNUM, TYPE, IND, WIN) \
do { \
- rtx new = legitimize_reload_address (AD, MODE, OPNUM, (int)(TYPE)); \
- if (new) \
+ rtx new_rtx = legitimize_reload_address (AD, MODE, OPNUM, (int)(TYPE)); \
+ if (new_rtx) \
{ \
- (AD) = new; \
+ (AD) = new_rtx; \
goto WIN; \
} \
} while (0)
diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md
index ec5b7532977..21cde2bc278 100644
--- a/gcc/config/s390/s390.md
+++ b/gcc/config/s390/s390.md
@@ -202,8 +202,12 @@
branch,jsr,fsimptf,fsimpdf,fsimpsf,
floadtf,floaddf,floadsf,fstoredf,fstoresf,
fmultf,fmuldf,fmulsf,fdivtf,fdivdf,fdivsf,
- ftoi,itof,fsqrttf,fsqrtdf,fsqrtsf,
- ftrunctf,ftruncdf,other"
+ ftoi,fsqrttf,fsqrtdf,fsqrtsf,
+ ftrunctf,ftruncdf, ftruncsd, ftruncdd,
+ itoftf, itofdf, itofsf, itofdd, itoftd,
+ fdivdd, fdivtd, floaddd, floadsd, fmuldd, fmultd,
+ fsimpdd, fsimpsd, fsimptd, fstoredd, fstoresd,
+ ftoidfp, other"
(cond [(eq_attr "op_type" "NN") (const_string "other")
(eq_attr "op_type" "SS") (const_string "cs")]
(const_string "integer")))
@@ -217,6 +221,31 @@
(const_string "reg")
(const_string "agen")))
+;; Properties concerning Z10 execution grouping and value forwarding.
+;; z10_super: instruction is superscalar.
+;; z10_super_c: instruction is superscalar and meets the condition of z10_c.
+;; z10_fwd: The instruction reads the value of an operand and stores it into a
+;; target register. It can forward this value to a second instruction that reads
+;; the same register if that second instruction is issued in the same group.
+;; z10_rec: The instruction is in the T pipeline and reads a register. If the
+;; instruction in the S pipe writes to the register, then the T instruction
+;; can immediately read the new value.
+;; z10_fr: union of Z10_fwd and z10_rec.
+;; z10_c: second operand of instruction is a register and read with complemented bits.
+;; z10_cobra: its a compare and branch instruction
+;;
+;; An additional suffix A1, A3, or E1 indicates the respective AGI bypass.
+
+
+(define_attr "z10prop" "none,
+ z10_super, z10_super_E1, z10_super_A1, z10_super_c, z10_super_c_E1,
+ z10_fwd, z10_fwd_A1, z10_fwd_A3, z10_fwd_E1,
+ z10_rec,
+ z10_fr, z10_fr_A3, z10_fr_E1,
+ z10_c, z10_cobra"
+ (const_string "none"))
+
+
;; Length in bytes.
(define_attr "length" ""
@@ -272,6 +301,9 @@
;; Pipeline description for z990, z9-109 and z9-ec.
(include "2084.md")
+;; Pipeline description for z10
+(include "2097.md")
+
;; Predicates
(include "predicates.md")
@@ -388,12 +420,6 @@
;; modes and to an empty string for bfp modes.
(define_mode_attr _d [(TF "") (DF "") (SF "") (TD "d") (DD "d") (SD "d")])
-;; Although it is imprecise for z9-ec we handle all dfp instructions like
-;; bfp regarding the pipeline description.
-(define_mode_attr bfp [(TF "tf") (DF "df") (SF "sf")
- (TD "tf") (DD "df") (SD "sf")])
-
-
;; In GPR and P templates, a constraint like "<d0>" will expand to "d" in DImode
;; and "0" in SImode. This allows to combine instructions of which the 31bit
;; version only operates on one register.
@@ -403,13 +429,13 @@
;; version only operates on one register. The DImode version needs an additional
;; register for the assembler output.
(define_mode_attr 1 [(DI "%1,") (SI "")])
-
-;; In SHIFT templates, a string like "s<lr>dl" will expand to "sldl" in
+
+;; In SHIFT templates, a string like "s<lr>dl" will expand to "sldl" in
;; 'ashift' and "srdl" in 'lshiftrt'.
(define_code_attr lr [(ashift "l") (lshiftrt "r")])
;; In SHIFT templates, this attribute holds the correct standard name for the
-;; pattern itself and the corresponding function calls.
+;; pattern itself and the corresponding function calls.
(define_code_attr shift [(ashift "ashl") (lshiftrt "lshr")])
;; This attribute handles differences in the instruction 'type' and will result
@@ -499,7 +525,8 @@
"@
tm\t%S0,%b1
tmy\t%S0,%b1"
- [(set_attr "op_type" "SI,SIY")])
+ [(set_attr "op_type" "SI,SIY")
+ (set_attr "z10prop" "z10_super,z10_super")])
(define_insn "*tmdi_reg"
[(set (reg CC_REGNUM)
@@ -515,7 +542,8 @@
tmhl\t%0,%i1
tmlh\t%0,%i1
tmll\t%0,%i1"
- [(set_attr "op_type" "RI")])
+ [(set_attr "op_type" "RI")
+ (set_attr "z10prop" "z10_super,z10_super,z10_super,z10_super")])
(define_insn "*tmsi_reg"
[(set (reg CC_REGNUM)
@@ -558,7 +586,8 @@
"ltgfr\t%2,%0
ltgf\t%2,%0"
[(set_attr "op_type" "RRE,RXY")
- (set_attr "cpu_facility" "*,z10")])
+ (set_attr "cpu_facility" "*,z10")
+ (set_attr "z10prop" "z10_super_E1,z10_super_E1") ])
; ltr, lt, ltgr, ltg
(define_insn "*tst<mode>_extimm"
@@ -571,7 +600,8 @@
"@
lt<g>r\t%2,%0
lt<g>\t%2,%0"
- [(set_attr "op_type" "RR<E>,RXY")])
+ [(set_attr "op_type" "RR<E>,RXY")
+ (set_attr "z10prop" "z10_fr_E1,z10_fr_A3") ])
; ltr, lt, ltgr, ltg
(define_insn "*tst<mode>_cconly_extimm"
@@ -583,7 +613,8 @@
"@
lt<g>r\t%0,%0
lt<g>\t%2,%0"
- [(set_attr "op_type" "RR<E>,RXY")])
+ [(set_attr "op_type" "RR<E>,RXY")
+ (set_attr "z10prop" "z10_fr_E1,z10_fr_A3")])
(define_insn "*tstdi"
[(set (reg CC_REGNUM)
@@ -593,7 +624,8 @@
(match_dup 0))]
"s390_match_ccmode(insn, CCSmode) && TARGET_64BIT && !TARGET_EXTIMM"
"ltgr\t%2,%0"
- [(set_attr "op_type" "RRE")])
+ [(set_attr "op_type" "RRE")
+ (set_attr "z10prop" "z10_fr_E1")])
(define_insn "*tstsi"
[(set (reg CC_REGNUM)
@@ -606,7 +638,8 @@
ltr\t%2,%0
icm\t%2,15,%S0
icmy\t%2,15,%S0"
- [(set_attr "op_type" "RR,RS,RSY")])
+ [(set_attr "op_type" "RR,RS,RSY")
+ (set_attr "z10prop" "z10_fr_E1,z10_super_E1,z10_super_E1")])
(define_insn "*tstsi_cconly"
[(set (reg CC_REGNUM)
@@ -618,7 +651,8 @@
ltr\t%0,%0
icm\t%2,15,%S0
icmy\t%2,15,%S0"
- [(set_attr "op_type" "RR,RS,RSY")])
+ [(set_attr "op_type" "RR,RS,RSY")
+ (set_attr "z10prop" "z10_fr_E1,z10_super_E1,z10_super_E1")])
(define_insn "*tstdi_cconly_31"
[(set (reg CC_REGNUM)
@@ -636,7 +670,8 @@
(match_operand:GPR 1 "const0_operand" "")))]
"s390_match_ccmode(insn, CCSmode)"
"lt<g>r\t%0,%0"
- [(set_attr "op_type" "RR<E>")])
+ [(set_attr "op_type" "RR<E>")
+ (set_attr "z10prop" "z10_fr_E1")])
; tst(hi|qi) instruction pattern(s).
@@ -651,7 +686,8 @@
icm\t%2,<icm_lo>,%S0
icmy\t%2,<icm_lo>,%S0
tml\t%0,<max_uint>"
- [(set_attr "op_type" "RS,RSY,RI")])
+ [(set_attr "op_type" "RS,RSY,RI")
+ (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super")])
(define_insn "*tsthiCCT_cconly"
[(set (reg CC_REGNUM)
@@ -663,7 +699,8 @@
icm\t%2,3,%S0
icmy\t%2,3,%S0
tml\t%0,65535"
- [(set_attr "op_type" "RS,RSY,RI")])
+ [(set_attr "op_type" "RS,RSY,RI")
+ (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super")])
(define_insn "*tstqiCCT_cconly"
[(set (reg CC_REGNUM)
@@ -674,7 +711,8 @@
cli\t%S0,0
cliy\t%S0,0
tml\t%0,255"
- [(set_attr "op_type" "SI,SIY,RI")])
+ [(set_attr "op_type" "SI,SIY,RI")
+ (set_attr "z10prop" "z10_super,z10_super,*")])
(define_insn "*tst<mode>"
[(set (reg CC_REGNUM)
@@ -686,7 +724,8 @@
"@
icm\t%2,<icm_lo>,%S0
icmy\t%2,<icm_lo>,%S0"
- [(set_attr "op_type" "RS,RSY")])
+ [(set_attr "op_type" "RS,RSY")
+ (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
(define_insn "*tst<mode>_cconly"
[(set (reg CC_REGNUM)
@@ -697,7 +736,8 @@
"@
icm\t%2,<icm_lo>,%S0
icmy\t%2,<icm_lo>,%S0"
- [(set_attr "op_type" "RS,RSY")])
+ [(set_attr "op_type" "RS,RSY")
+ (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
; Compare (equality) instructions
@@ -713,7 +753,8 @@
cgfi\t%0,%1
cg\t%0,%1
#"
- [(set_attr "op_type" "RRE,RI,RIL,RXY,SS")])
+ [(set_attr "op_type" "RRE,RI,RIL,RXY,SS")
+ (set_attr "z10prop" "z10_super_c,z10_super,z10_super,z10_super,*")])
(define_insn "*cmpsi_cct"
[(set (reg CC_REGNUM)
@@ -727,8 +768,8 @@
c\t%0,%1
cy\t%0,%1
#"
- [(set_attr "op_type" "RR,RI,RIL,RX,RXY,SS")])
-
+ [(set_attr "op_type" "RR,RI,RIL,RX,RXY,SS")
+ (set_attr "z10prop" "z10_super,z10_super,z10_super,z10_super,z10_super,*")])
; Compare (signed) instructions
@@ -743,9 +784,11 @@
cgf\t%0,%1
cgfrl\t%0,%1"
[(set_attr "op_type" "RRE,RXY,RIL")
- (set_attr "cpu_facility" "*,*,z10")
+ (set_attr "z10prop" "z10_c,*,*")
(set_attr "type" "*,*,larl")])
+
+
(define_insn "*cmpsi_ccs_sign"
[(set (reg CC_REGNUM)
(compare (sign_extend:SI (match_operand:HI 1 "memory_operand" "R,T,b"))
@@ -796,7 +839,8 @@
c<g>rl\t%0,%1"
[(set_attr "op_type" "RR<E>,RI,SIL,RIL,RX<Y>,RXY,RIL")
(set_attr "cpu_facility" "*,*,z10,extimm,*,*,z10")
- (set_attr "type" "*,*,*,*,*,*,larl")])
+ (set_attr "type" "*,*,*,*,*,*,larl")
+ (set_attr "z10prop" "z10_super_c,z10_super,z10_super,z10_super,z10_super,z10_super,z10_super")])
; Compare (unsigned) instructions
@@ -820,7 +864,8 @@
"s390_match_ccmode(insn, CCURmode) && TARGET_Z10"
"cl<g>hrl\t%0,%1"
[(set_attr "op_type" "RIL")
- (set_attr "type" "larl")])
+ (set_attr "type" "larl")
+ (set_attr "z10prop" "z10_super")])
(define_insn "*cmpdi_ccu_zero"
[(set (reg CC_REGNUM)
@@ -834,7 +879,8 @@
clgfrl\t%0,%1"
[(set_attr "op_type" "RRE,RXY,RIL")
(set_attr "cpu_facility" "*,*,z10")
- (set_attr "type" "*,*,larl")])
+ (set_attr "type" "*,*,larl")
+ (set_attr "z10prop" "z10_super_c,z10_super_E1,z10_super")])
(define_insn "*cmpdi_ccu"
[(set (reg CC_REGNUM)
@@ -853,7 +899,8 @@
#"
[(set_attr "op_type" "RRE,RIL,RIL,SIL,RXY,SS,SS")
(set_attr "cpu_facility" "*,extimm,z10,z10,*,*,*")
- (set_attr "type" "*,*,larl,*,*,*,*")])
+ (set_attr "type" "*,*,larl,*,*,*,*")
+ (set_attr "z10prop" "z10_super_c,z10_super,z10_super,z10_super,z10_super,*,*")])
(define_insn "*cmpsi_ccu"
[(set (reg CC_REGNUM)
@@ -871,7 +918,8 @@
#"
[(set_attr "op_type" "RR,RIL,RIL,SIL,RX,RXY,SS,SS")
(set_attr "cpu_facility" "*,extimm,z10,z10,*,*,*,*")
- (set_attr "type" "*,*,larl,*,*,*,*,*")])
+ (set_attr "type" "*,*,larl,*,*,*,*,*")
+ (set_attr "z10prop" "z10_super_c,z10_super,z10_super,z10_super,z10_super,z10_super,*,*")])
(define_insn "*cmphi_ccu"
[(set (reg CC_REGNUM)
@@ -886,7 +934,8 @@
#
#"
[(set_attr "op_type" "RS,RSY,SIL,SS,SS")
- (set_attr "cpu_facility" "*,*,z10,*,*")])
+ (set_attr "cpu_facility" "*,*,z10,*,*")
+ (set_attr "z10prop" "*,*,z10_super,*,*")])
(define_insn "*cmpqi_ccu"
[(set (reg CC_REGNUM)
@@ -901,7 +950,8 @@
cliy\t%S0,%b1
#
#"
- [(set_attr "op_type" "RS,RSY,SI,SIY,SS,SS")])
+ [(set_attr "op_type" "RS,RSY,SI,SIY,SS,SS")
+ (set_attr "z10prop" "*,*,z10_super,z10_super,*,*")])
; Block compare (CLC) instruction patterns.
@@ -948,7 +998,7 @@
"s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT"
"lt<xde><bt>r\t%0,%0"
[(set_attr "op_type" "RRE")
- (set_attr "type" "fsimp<bfp>")])
+ (set_attr "type" "fsimp<mode>")])
; cxtr, cxbr, cdbr, cebr, cxb, cdb, ceb, cxbtr, cdbtr
(define_insn "*cmp<mode>_ccs"
@@ -960,12 +1010,14 @@
c<xde><bt>r\t%0,%1
c<xde>b\t%0,%1"
[(set_attr "op_type" "RRE,RXE")
- (set_attr "type" "fsimp<bfp>")])
+ (set_attr "type" "fsimp<mode>")])
; Compare and Branch instructions
; cij, cgij, crj, cgrj, cfi, cgfi, cr, cgr
+; The following instructions do a complementary access of their second
+; operand (z01 only): crj_c, cgrjc, cr, cgr
(define_insn "*cmp_and_br_signed_<mode>"
[(set (pc)
(if_then_else (match_operator 0 "s390_signed_integer_comparison"
@@ -985,12 +1037,15 @@
}
[(set_attr "op_type" "RIE")
(set_attr "type" "branch")
+ (set_attr "z10prop" "z10_cobra,z10_super")
(set (attr "length")
(if_then_else (lt (abs (minus (pc) (match_dup 3))) (const_int 60000))
(const_int 6) (const_int 12)))]) ; 8 byte for cr/jg
; 10 byte for cgr/jg
; clij, clgij, clrj, clgrj, clfi, clgfi, clr, clgr
+; The following instructions do a complementary access of their second
+; operand (z10 only): clrj, clgrj, clr, clgr
(define_insn "*cmp_and_br_unsigned_<mode>"
[(set (pc)
(if_then_else (match_operator 0 "s390_unsigned_integer_comparison"
@@ -1010,6 +1065,7 @@
}
[(set_attr "op_type" "RIE")
(set_attr "type" "branch")
+ (set_attr "z10prop" "z10_cobra,z10_super")
(set (attr "length")
(if_then_else (lt (abs (minus (pc) (match_dup 3))) (const_int 60000))
(const_int 6) (const_int 12)))]) ; 8 byte for clr/jg
@@ -1181,8 +1237,8 @@
(match_operand:P 2 "register_operand" "=a")])]
""
{
- rtx new = legitimize_pic_address (operands[1], operands[2]);
- emit_move_insn (operands[0], new);
+ rtx new_rtx = legitimize_pic_address (operands[1], operands[2]);
+ emit_move_insn (operands[0], new_rtx);
})
;
@@ -1210,7 +1266,8 @@
&& !FP_REG_P (operands[0])"
"larl\t%0,%1"
[(set_attr "op_type" "RIL")
- (set_attr "type" "larl")])
+ (set_attr "type" "larl")
+ (set_attr "z10prop" "z10_super_A1")])
(define_insn "*movdi_64"
[(set (match_operand:DI 0 "nonimmediate_operand"
@@ -1255,7 +1312,35 @@
*,*,*")
(set_attr "cpu_facility" "*,*,*,*,*,extimm,extimm,extimm,dfp,dfp,longdisp,
z10,*,*,*,*,*,longdisp,*,longdisp,
- z10,z10,*,*,*,*,*")])
+ z10,z10,*,*,*,*,*")
+ (set_attr "z10prop" "z10_fwd_A1,
+ z10_fwd_E1,
+ z10_fwd_E1,
+ z10_fwd_E1,
+ z10_fwd_E1,
+ z10_fwd_A1,
+ z10_fwd_E1,
+ z10_fwd_E1,
+ *,
+ *,
+ z10_fwd_A1,
+ z10_fwd_A3,
+ z10_fr_E1,
+ z10_fwd_A3,
+ z10_rec,
+ *,
+ *,
+ *,
+ *,
+ *,
+ z10_rec,
+ z10_super,
+ *,
+ *,
+ *,
+ *,
+ *")
+])
(define_split
[(set (match_operand:DI 0 "register_operand" "")
@@ -1390,7 +1475,8 @@
la\t%0,%a1
lay\t%0,%a1"
[(set_attr "op_type" "RX,RXY")
- (set_attr "type" "la")])
+ (set_attr "type" "la")
+ (set_attr "z10prop" "z10_fwd_A1,z10_fwd_A1")])
(define_peephole2
[(parallel
@@ -1441,7 +1527,8 @@
&& !FP_REG_P (operands[0])"
"larl\t%0,%1"
[(set_attr "op_type" "RIL")
- (set_attr "type" "larl")])
+ (set_attr "type" "larl")
+ (set_attr "z10prop" "z10_super_A1")])
(define_insn "*movsi_zarch"
[(set (match_operand:SI 0 "nonimmediate_operand"
@@ -1475,10 +1562,54 @@
#"
[(set_attr "op_type" "RI,RI,RI,RIL,RXY,RIL,RR,RX,RXY,RX,RXY,
RR,RX,RXY,RX,RXY,RRE,RRE,RS,RIL,SIL,RS,SS")
- (set_attr "type" "*,*,*,*,la,larl,lr,load,load,store,store,
- floadsf,floadsf,floadsf,fstoresf,fstoresf,*,*,*,larl,*,*,*")
+ (set_attr "type" "*,
+ *,
+ *,
+ *,
+ la,
+ larl,
+ lr,
+ load,
+ load,
+ store,
+ store,
+ floadsf,
+ floadsf,
+ floadsf,
+ fstoresf,
+ fstoresf,
+ *,
+ *,
+ *,
+ larl,
+ *,
+ *,
+ *")
(set_attr "cpu_facility" "*,*,*,extimm,longdisp,z10,*,*,longdisp,*,longdisp,
- *,*,longdisp,*,longdisp,*,*,*,z10,z10,*,*")])
+ *,*,longdisp,*,longdisp,*,*,*,z10,z10,*,*")
+ (set_attr "z10prop" "z10_fwd_A1,
+ z10_fwd_E1,
+ z10_fwd_E1,
+ z10_fwd_A1,
+ z10_fwd_A1,
+ z10_fwd_A3,
+ z10_fr_E1,
+ z10_fwd_A3,
+ z10_fwd_A3,
+ z10_super,
+ z10_rec,
+ *,
+ *,
+ *,
+ *,
+ *,
+ z10_super_E1,
+ z10_super,
+ *,
+ z10_rec,
+ z10_super,
+ *,
+ *")])
(define_insn "*movsi_esa"
[(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,R,!*f,!*f,!R,d,t,Q,t,?Q")
@@ -1498,7 +1629,20 @@
lam\t%0,%0,%S1
#"
[(set_attr "op_type" "RI,RR,RX,RX,RR,RX,RX,RRE,RRE,RS,RS,SS")
- (set_attr "type" "*,lr,load,store,floadsf,floadsf,fstoresf,*,*,*,*,*")])
+ (set_attr "type" "*,lr,load,store,floadsf,floadsf,fstoresf,*,*,*,*,*")
+ (set_attr "z10prop" "z10_fwd_A1,
+ z10_fr_E1,
+ z10_fwd_A3,
+ z10_super,
+ *,
+ *,
+ *,
+ z10_super_E1,
+ z10_super,
+ *,
+ *,
+ *")
+])
(define_peephole2
[(set (match_operand:SI 0 "register_operand" "")
@@ -1519,7 +1663,8 @@
la\t%0,%a1
lay\t%0,%a1"
[(set_attr "op_type" "RX,RXY")
- (set_attr "type" "la")])
+ (set_attr "type" "la")
+ (set_attr "z10prop" "z10_fwd_A1,z10_fwd_A1")])
(define_peephole2
[(parallel
@@ -1554,7 +1699,8 @@
la\t%0,%a1
lay\t%0,%a1"
[(set_attr "op_type" "RX,RXY")
- (set_attr "type" "la")])
+ (set_attr "type" "la")
+ (set_attr "z10prop" "z10_fwd_A1,z10_fwd_A1")])
(define_insn_and_split "*la_31_and_cc"
[(set (match_operand:SI 0 "register_operand" "=d")
@@ -1579,7 +1725,8 @@
la\t%0,%a1
lay\t%0,%a1"
[(set_attr "op_type" "RX")
- (set_attr "type" "la")])
+ (set_attr "type" "la")
+ (set_attr "z10prop" "z10_fwd_A1,z10_fwd_A1")])
;
; movhi instruction pattern(s).
@@ -1620,7 +1767,17 @@
#"
[(set_attr "op_type" "RR,RI,RX,RXY,RIL,RX,RXY,RIL,SIL,SS")
(set_attr "type" "lr,*,*,*,larl,store,store,store,*,*")
- (set_attr "cpu_facility" "*,*,*,*,z10,*,*,z10,z10,*")])
+ (set_attr "cpu_facility" "*,*,*,*,z10,*,*,z10,z10,*")
+ (set_attr "z10prop" "z10_fr_E1,
+ z10_fwd_A1,
+ z10_super_E1,
+ z10_super_E1,
+ z10_super_E1,
+ z10_super,
+ z10_rec,
+ z10_rec,
+ z10_super,
+ *")])
(define_peephole2
[(set (match_operand:HI 0 "register_operand" "")
@@ -1669,7 +1826,16 @@
mviy\t%S0,%b1
#"
[(set_attr "op_type" "RR,RI,RX,RXY,RX,RXY,SI,SIY,SS")
- (set_attr "type" "lr,*,*,*,store,store,store,store,*")])
+ (set_attr "type" "lr,*,*,*,store,store,store,store,*")
+ (set_attr "z10prop" "z10_fr_E1,
+ z10_fwd_A1,
+ z10_super_E1,
+ z10_super_E1,
+ z10_super,
+ z10_rec,
+ z10_super,
+ z10_super,
+ *")])
(define_peephole2
[(set (match_operand:QI 0 "nonimmediate_operand" "")
@@ -1692,7 +1858,8 @@
"@
ic\t%0,%1
icy\t%0,%1"
- [(set_attr "op_type" "RX,RXY")])
+ [(set_attr "op_type" "RX,RXY")
+ (set_attr "z10prop" "z10_super_E1,z10_super")])
;
; movstricthi instruction pattern(s).
@@ -1706,7 +1873,8 @@
"@
icm\t%0,3,%S1
icmy\t%0,3,%S1"
- [(set_attr "op_type" "RS,RSY")])
+ [(set_attr "op_type" "RS,RSY")
+ (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
;
; movstrictsi instruction pattern(s).
@@ -1722,7 +1890,8 @@
ly\t%0,%1
ear\t%0,%1"
[(set_attr "op_type" "RR,RX,RXY,RRE")
- (set_attr "type" "lr,load,load,*")])
+ (set_attr "type" "lr,load,load,*")
+ (set_attr "z10prop" "z10_fr_E1,z10_fwd_A3,z10_fwd_A3,z10_super_E1")])
;
; mov(tf|td) instruction pattern(s).
@@ -1812,7 +1981,7 @@
(define_split
[(set (match_operand:TD_TF 0 "register_operand" "")
(match_operand:TD_TF 1 "memory_operand" ""))]
- "reload_completed && offsettable_memref_p (operands[1])
+ "reload_completed && offsettable_memref_p (operands[1])
&& FP_REG_P (operands[0])"
[(set (match_dup 2) (match_dup 4))
(set (match_dup 3) (match_dup 5))]
@@ -1872,7 +2041,20 @@
#"
[(set_attr "op_type" "RRE,RR,RRE,RRE,RX,RXY,RX,RXY,RRE,RXY,RXY,SS")
(set_attr "type" "fsimpdf,floaddf,floaddf,floaddf,floaddf,floaddf,
- fstoredf,fstoredf,lr,load,store,*")])
+ fstoredf,fstoredf,lr,load,store,*")
+ (set_attr "z10prop" "*,
+ *,
+ *,
+ *,
+ *,
+ *,
+ *,
+ *,
+ z10_fr_E1,
+ z10_fwd_A3,
+ z10_rec,
+ *")
+])
(define_insn "*mov<mode>_64"
[(set (match_operand:DD_DF 0 "nonimmediate_operand" "=f,f,f,f,R,T,d, d,RT,?Q")
@@ -1890,8 +2072,18 @@
stg\t%1,%0
#"
[(set_attr "op_type" "RRE,RR,RX,RXY,RX,RXY,RRE,RXY,RXY,SS")
- (set_attr "type" "fsimp<bfp>,fload<bfp>,fload<bfp>,fload<bfp>,
- fstore<bfp>,fstore<bfp>,lr,load,store,*")])
+ (set_attr "type" "fsimp<mode>,fload<mode>,fload<mode>,fload<mode>,
+ fstore<mode>,fstore<mode>,lr,load,store,*")
+ (set_attr "z10prop" "*,
+ *,
+ *,
+ *,
+ *,
+ *,
+ z10_fr_E1,
+ z10_fwd_A3,
+ z10_rec,
+ *")])
(define_insn "*mov<mode>_31"
[(set (match_operand:DD_DF 0 "nonimmediate_operand"
@@ -1914,8 +2106,8 @@
#
#"
[(set_attr "op_type" "RRE,RR,RX,RXY,RX,RXY,RS,RSY,RS,RSY,*,*,SS")
- (set_attr "type" "fsimp<bfp>,fload<bfp>,fload<bfp>,fload<bfp>,
- fstore<bfp>,fstore<bfp>,lm,lm,stm,stm,*,*,*")])
+ (set_attr "type" "fsimp<mode>,fload<mode>,fload<mode>,fload<mode>,
+ fstore<mode>,fstore<mode>,lm,lm,stm,stm,*,*,*")])
(define_split
[(set (match_operand:DD_DF 0 "nonimmediate_operand" "")
@@ -1982,8 +2174,20 @@
sty\t%1,%0
#"
[(set_attr "op_type" "RRE,RR,RX,RXY,RX,RXY,RR,RX,RXY,RX,RXY,SS")
- (set_attr "type" "fsimp<bfp>,fload<bfp>,fload<bfp>,fload<bfp>,
- fstore<bfp>,fstore<bfp>,lr,load,load,store,store,*")])
+ (set_attr "type" "fsimp<mode>,fload<mode>,fload<mode>,fload<mode>,
+ fstore<mode>,fstore<mode>,lr,load,load,store,store,*")
+ (set_attr "z10prop" "*,
+ *,
+ *,
+ *,
+ *,
+ *,
+ z10_fr_E1,
+ z10_fwd_A3,
+ z10_fwd_A3,
+ z10_super,
+ z10_rec,
+ *")])
;
; movcc instruction pattern
@@ -2002,7 +2206,8 @@
l\t%1,%0
ly\t%1,%0"
[(set_attr "op_type" "RR,RI,RRE,RX,RXY,RX,RXY")
- (set_attr "type" "lr,*,*,store,store,load,load")])
+ (set_attr "type" "lr,*,*,store,store,load,load")
+ (set_attr "z10prop" "z10_fr_E1,*,*,z10_super,z10_rec,z10_fwd_A3,z10_fwd_A3")])
;
; Block move (MVC) patterns.
@@ -2042,7 +2247,7 @@
(use (match_operand 5 "const_int_operand" ""))])]
"s390_offset_p (operands[0], operands[3], operands[2])
&& s390_offset_p (operands[1], operands[4], operands[2])
- && !s390_overlap_p (operands[0], operands[1],
+ && !s390_overlap_p (operands[0], operands[1],
INTVAL (operands[2]) + INTVAL (operands[5]))
&& INTVAL (operands[2]) + INTVAL (operands[5]) <= 256"
[(parallel
@@ -2348,19 +2553,19 @@
"clst\t%0,%1\;jo\t.-4"
[(set_attr "length" "8")
(set_attr "type" "vs")])
-
+
;
; movstr instruction pattern.
;
(define_expand "movstr"
[(set (reg:SI 0) (const_int 0))
- (parallel
+ (parallel
[(clobber (match_dup 3))
(set (match_operand:BLK 1 "memory_operand" "")
(match_operand:BLK 2 "memory_operand" ""))
(set (match_operand 0 "register_operand" "")
- (unspec [(match_dup 1)
+ (unspec [(match_dup 1)
(match_dup 2)
(reg:SI 0)] UNSPEC_MVST))
(clobber (reg:CC CC_REGNUM))])]
@@ -2381,7 +2586,7 @@
(set (mem:BLK (match_operand:P 1 "register_operand" "0"))
(mem:BLK (match_operand:P 3 "register_operand" "2")))
(set (match_operand:P 0 "register_operand" "=d")
- (unspec [(mem:BLK (match_dup 1))
+ (unspec [(mem:BLK (match_dup 1))
(mem:BLK (match_dup 3))
(reg:SI 0)] UNSPEC_MVST))
(clobber (reg:CC CC_REGNUM))]
@@ -2389,7 +2594,7 @@
"mvst\t%1,%2\;jo\t.-4"
[(set_attr "length" "8")
(set_attr "type" "vs")])
-
+
;
; movmemM instruction pattern(s).
@@ -2477,7 +2682,7 @@
"reload_completed && TARGET_CPU_ZARCH"
[(set (match_dup 3) (label_ref (match_dup 4)))
(parallel
- [(unspec [(match_dup 2) (mem:BLK (match_dup 3))
+ [(unspec [(match_dup 2) (mem:BLK (match_dup 3))
(label_ref (match_dup 4))] UNSPEC_EXECUTE)
(set (match_dup 0) (match_dup 1))
(use (const_int 1))])]
@@ -2538,8 +2743,8 @@
(define_expand "signbit<mode>2"
[(set (reg:CCZ CC_REGNUM)
- (unspec:CCZ [(match_operand:FP_ALL 1 "register_operand" "f")
- (match_dup 2)]
+ (unspec:CCZ [(match_operand:FP_ALL 1 "register_operand" "f")
+ (match_dup 2)]
UNSPEC_TDC_INSN))
(set (match_operand:SI 0 "register_operand" "=d")
(unspec:SI [(reg:CCZ CC_REGNUM)] UNSPEC_CCZ_TO_INT))]
@@ -2550,8 +2755,8 @@
(define_expand "isinf<mode>2"
[(set (reg:CCZ CC_REGNUM)
- (unspec:CCZ [(match_operand:FP_ALL 1 "register_operand" "f")
- (match_dup 2)]
+ (unspec:CCZ [(match_operand:FP_ALL 1 "register_operand" "f")
+ (match_dup 2)]
UNSPEC_TDC_INSN))
(set (match_operand:SI 0 "register_operand" "=d")
(unspec:SI [(reg:CCZ CC_REGNUM)] UNSPEC_CCZ_TO_INT))]
@@ -2563,16 +2768,16 @@
; This insn is used to generate all variants of the Test Data Class
; instruction, namely tcxb, tcdb, and tceb. The insn's first operand
; is the register to be tested and the second one is the bit mask
-; specifying the required test(s).
+; specifying the required test(s).
;
(define_insn "*TDC_insn_<mode>"
[(set (reg:CCZ CC_REGNUM)
- (unspec:CCZ [(match_operand:FP_ALL 0 "register_operand" "f")
+ (unspec:CCZ [(match_operand:FP_ALL 0 "register_operand" "f")
(match_operand:SI 1 "const_int_operand")] UNSPEC_TDC_INSN))]
"TARGET_HARD_FLOAT"
"t<_d>c<xde><bt>\t%0,%1"
[(set_attr "op_type" "RXE")
- (set_attr "type" "fsimp<bfp>")])
+ (set_attr "type" "fsimp<mode>")])
(define_insn_and_split "*ccz_to_int"
[(set (match_operand:SI 0 "register_operand" "=d")
@@ -2679,14 +2884,14 @@
"reload_completed && TARGET_CPU_ZARCH"
[(set (match_dup 2) (label_ref (match_dup 3)))
(parallel
- [(unspec [(match_dup 1) (mem:BLK (match_dup 2))
+ [(unspec [(match_dup 1) (mem:BLK (match_dup 2))
(label_ref (match_dup 3))] UNSPEC_EXECUTE)
(set (match_dup 0) (const_int 0))
(use (const_int 1))
(clobber (reg:CC CC_REGNUM))])]
"operands[3] = gen_label_rtx ();")
-; Initialize a block of arbitrary length with (operands[2] % 256).
+; Initialize a block of arbitrary length with (operands[2] % 256).
(define_expand "setmem_long"
[(parallel
@@ -2833,7 +3038,7 @@
"reload_completed && TARGET_CPU_ZARCH"
[(set (match_dup 3) (label_ref (match_dup 4)))
(parallel
- [(unspec [(match_dup 2) (mem:BLK (match_dup 3))
+ [(unspec [(match_dup 2) (mem:BLK (match_dup 3))
(label_ref (match_dup 4))] UNSPEC_EXECUTE)
(set (reg:CCU CC_REGNUM) (compare:CCU (match_dup 0) (match_dup 1)))
(use (const_int 1))])]
@@ -2938,7 +3143,7 @@
(define_insn_and_split "*cmpint_sign_cc"
[(set (reg CC_REGNUM)
- (compare (ashiftrt:DI (ashift:DI (subreg:DI
+ (compare (ashiftrt:DI (ashift:DI (subreg:DI
(unspec:SI [(match_operand:CCU 1 "register_operand" "0")]
UNSPEC_CCU_TO_INT) 0)
(const_int 32)) (const_int 32))
@@ -2972,7 +3177,8 @@
"@
icm\t%0,%2,%S1
icmy\t%0,%2,%S1"
- [(set_attr "op_type" "RS,RSY")])
+ [(set_attr "op_type" "RS,RSY")
+ (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
(define_insn "*sethighpartdi_64"
[(set (match_operand:DI 0 "register_operand" "=d")
@@ -2992,7 +3198,9 @@
"@
icm\t%0,%2,%S1
icmy\t%0,%2,%S1"
- [(set_attr "op_type" "RS,RSY")])
+ [(set_attr "op_type" "RS,RSY")
+ (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
+
(define_insn_and_split "*extzv<mode>"
[(set (match_operand:GPR 0 "register_operand" "=d")
@@ -3083,7 +3291,8 @@
return "risbg\t%0,%3,%b2,%b1,%b4";
}
- [(set_attr "op_type" "RIE")])
+ [(set_attr "op_type" "RIE")
+ (set_attr "z10prop" "z10_super_E1")])
; and op1 with a mask being 1 for the selected bits and 0 for the rest
; and op3=op0 with a mask being 0 for the selected bits and 1 for the rest
@@ -3112,7 +3321,8 @@
return "risbg\t%0,%1,%b5,%b6,%b7";
}
- [(set_attr "op_type" "RIE")])
+ [(set_attr "op_type" "RIE")
+ (set_attr "z10prop" "z10_super_E1")])
; and op1 with a mask being 1 for the selected bits and 0 for the rest
(define_insn "*insv<mode>_or_z10_noshift"
@@ -3151,10 +3361,11 @@
int size = INTVAL (operands[1]) / BITS_PER_UNIT;
operands[1] = GEN_INT ((1ul << size) - 1);
- return (which_alternative == 0) ? "stcm\t%2,%1,%S0"
+ return (which_alternative == 0) ? "stcm\t%2,%1,%S0"
: "stcmy\t%2,%1,%S0";
}
- [(set_attr "op_type" "RS,RSY")])
+ [(set_attr "op_type" "RS,RSY")
+ (set_attr "z10prop" "z10_super,z10_super")])
(define_insn "*insvdi_mem_reghigh"
[(set (zero_extract:DI (match_operand:QI 0 "memory_operand" "+QS")
@@ -3172,7 +3383,8 @@
operands[1] = GEN_INT ((1ul << size) - 1);
return "stcmh\t%2,%1,%S0";
}
-[(set_attr "op_type" "RSY")])
+[(set_attr "op_type" "RSY")
+ (set_attr "z10prop" "z10_super")])
(define_insn "*insv<mode>_reg_imm"
[(set (zero_extract:P (match_operand:P 0 "register_operand" "+d")
@@ -3193,7 +3405,9 @@
default: gcc_unreachable();
}
}
- [(set_attr "op_type" "RI")])
+ [(set_attr "op_type" "RI")
+ (set_attr "z10prop" "z10_super_E1")])
+
(define_insn "*insv<mode>_reg_extimm"
[(set (zero_extract:P (match_operand:P 0 "register_operand" "+d")
@@ -3212,7 +3426,9 @@
default: gcc_unreachable();
}
}
- [(set_attr "op_type" "RIL")])
+ [(set_attr "op_type" "RIL")
+ (set_attr "z10prop" "z10_fwd_E1")])
+
;
; extendsidi2 instruction pattern(s).
@@ -3243,7 +3459,8 @@
lgfrl\t%0,%1"
[(set_attr "op_type" "RRE,RXY,RIL")
(set_attr "type" "*,*,larl")
- (set_attr "cpu_facility" "*,*,z10")])
+ (set_attr "cpu_facility" "*,*,z10")
+ (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1")])
;
; extend(hi|qi)(si|di)2 instruction pattern(s).
@@ -3287,14 +3504,16 @@
lghrl\t%0,%1"
[(set_attr "op_type" "RRE,RXY,RIL")
(set_attr "type" "*,*,larl")
- (set_attr "cpu_facility" "extimm,extimm,z10")])
+ (set_attr "cpu_facility" "extimm,extimm,z10")
+ (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1")])
(define_insn "*extendhidi2"
[(set (match_operand:DI 0 "register_operand" "=d")
(sign_extend:DI (match_operand:HI 1 "memory_operand" "RT")))]
"TARGET_64BIT"
"lgh\t%0,%1"
- [(set_attr "op_type" "RXY")])
+ [(set_attr "op_type" "RXY")
+ (set_attr "z10prop" "z10_super_E1")])
;
; extendhisi2 instruction pattern(s).
@@ -3311,7 +3530,8 @@
lhrl\t%0,%1"
[(set_attr "op_type" "RRE,RX,RXY,RIL")
(set_attr "type" "*,*,*,larl")
- (set_attr "cpu_facility" "extimm,extimm,extimm,z10")])
+ (set_attr "cpu_facility" "extimm,extimm,extimm,z10")
+ (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1,z10_super_E1")])
(define_insn "*extendhisi2"
[(set (match_operand:SI 0 "register_operand" "=d,d")
@@ -3320,7 +3540,8 @@
"@
lh\t%0,%1
lhy\t%0,%1"
- [(set_attr "op_type" "RX,RXY")])
+ [(set_attr "op_type" "RX,RXY")
+ (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
;
; extendqi(si|di)2 instruction pattern(s).
@@ -3334,7 +3555,8 @@
"@
l<g>br\t%0,%1
l<g>b\t%0,%1"
- [(set_attr "op_type" "RRE,RXY")])
+ [(set_attr "op_type" "RRE,RXY")
+ (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
; lb, lgb
(define_insn "*extendqi<mode>2"
@@ -3342,7 +3564,8 @@
(sign_extend:GPR (match_operand:QI 1 "memory_operand" "RT")))]
"!TARGET_EXTIMM && TARGET_LONG_DISPLACEMENT"
"l<g>b\t%0,%1"
- [(set_attr "op_type" "RXY")])
+ [(set_attr "op_type" "RXY")
+ (set_attr "z10prop" "z10_super_E1")])
(define_insn_and_split "*extendqi<mode>2_short_displ"
[(set (match_operand:GPR 0 "register_operand" "=d")
@@ -3392,7 +3615,8 @@
llgfrl\t%0,%1"
[(set_attr "op_type" "RRE,RXY,RIL")
(set_attr "type" "*,*,larl")
- (set_attr "cpu_facility" "*,*,z10")])
+ (set_attr "cpu_facility" "*,*,z10")
+ (set_attr "z10prop" "z10_fwd_E1,z10_fwd_A3,z10_fwd_A3")])
;
; LLGT-type instructions (zero-extend from 31 bit to 64 bit).
@@ -3404,7 +3628,8 @@
(const_int 2147483647)))]
"TARGET_64BIT"
"llgt\t%0,%1"
- [(set_attr "op_type" "RXE")])
+ [(set_attr "op_type" "RXE")
+ (set_attr "z10prop" "z10_super_E1")])
(define_insn_and_split "*llgt_sidi_split"
[(set (match_operand:DI 0 "register_operand" "=d")
@@ -3427,7 +3652,8 @@
"@
llgtr\t%0,%1
llgt\t%0,%1"
- [(set_attr "op_type" "RRE,RXE")])
+ [(set_attr "op_type" "RRE,RXE")
+ (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
(define_insn "*llgt_didi"
[(set (match_operand:DI 0 "register_operand" "=d,d")
@@ -3437,7 +3663,8 @@
"@
llgtr\t%0,%1
llgt\t%0,%N1"
- [(set_attr "op_type" "RRE,RXE")])
+ [(set_attr "op_type" "RRE,RXE")
+ (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
(define_split
[(set (match_operand:GPR 0 "register_operand" "")
@@ -3468,7 +3695,7 @@
}
else if (!TARGET_EXTIMM)
{
- rtx bitcount = GEN_INT (GET_MODE_BITSIZE(DImode) -
+ rtx bitcount = GEN_INT (GET_MODE_BITSIZE(DImode) -
GET_MODE_BITSIZE(<MODE>mode));
operands[1] = gen_lowpart (DImode, operands[1]);
emit_insn (gen_ashldi3 (operands[0], operands[1], bitcount));
@@ -3485,7 +3712,7 @@
if (!TARGET_EXTIMM)
{
operands[1] = gen_lowpart (SImode, operands[1]);
- emit_insn (gen_andsi3 (operands[0], operands[1],
+ emit_insn (gen_andsi3 (operands[0], operands[1],
GEN_INT ((1 << GET_MODE_BITSIZE(<MODE>mode)) - 1)));
DONE;
}
@@ -3502,7 +3729,8 @@
ll<g>hrl\t%0,%1"
[(set_attr "op_type" "RXY,RRE,RIL")
(set_attr "type" "*,*,larl")
- (set_attr "cpu_facility" "*,*,z10")])
+ (set_attr "cpu_facility" "*,*,z10")
+ (set_attr "z10prop" "z10_fwd_A3")])
; llhr, llcr, llghr, llgcr, llh, llc, llgh, llgc
(define_insn "*zero_extend<HQI:mode><GPR:mode>2_extimm"
@@ -3512,7 +3740,8 @@
"@
ll<g><hc>r\t%0,%1
ll<g><hc>\t%0,%1"
- [(set_attr "op_type" "RRE,RXY")])
+ [(set_attr "op_type" "RRE,RXY")
+ (set_attr "z10prop" "z10_super_E1,z10_fwd_A3")])
; llgh, llgc
(define_insn "*zero_extend<HQI:mode><GPR:mode>2"
@@ -3520,7 +3749,8 @@
(zero_extend:GPR (match_operand:HQI 1 "memory_operand" "RT")))]
"TARGET_ZARCH && !TARGET_EXTIMM"
"llg<hc>\t%0,%1"
- [(set_attr "op_type" "RXY")])
+ [(set_attr "op_type" "RXY")
+ (set_attr "z10prop" "z10_fwd_A3")])
(define_insn_and_split "*zero_extendhisi2_31"
[(set (match_operand:SI 0 "register_operand" "=&d")
@@ -3564,7 +3794,8 @@
(zero_extend:HI (match_operand:QI 1 "memory_operand" "RT")))]
"TARGET_ZARCH && !TARGET_EXTIMM"
"llgc\t%0,%1"
- [(set_attr "op_type" "RXY")])
+ [(set_attr "op_type" "RXY")
+ (set_attr "z10prop" "z10_fwd_A3")])
(define_insn_and_split "*zero_extendqihi2_31"
[(set (match_operand:HI 0 "register_operand" "=&d")
@@ -3585,7 +3816,7 @@
[(set (match_operand:DI 0 "register_operand" "")
(unsigned_fix:DI (match_operand:DD 1 "register_operand" "")))
(clobber (match_scratch:TD 2 "=f"))])]
-
+
"TARGET_HARD_FLOAT && TARGET_HARD_DFP"
{
rtx label1 = gen_label_rtx ();
@@ -3597,7 +3828,7 @@
decimal_real_from_string (&sub, "18446744073709551616.0"); /* 2^64 */
/* 2^63 can't be represented as 64bit DFP number with full precision. The
- solution is doing the check and the subtraction in TD mode and using a
+ solution is doing the check and the subtraction in TD mode and using a
TD -> DI convert afterwards. */
emit_insn (gen_extendddtd2 (temp, operands[1]));
temp = force_reg (TDmode, temp);
@@ -3624,11 +3855,11 @@
rtx label2 = gen_label_rtx ();
rtx temp = gen_reg_rtx (TDmode);
REAL_VALUE_TYPE cmp, sub;
-
+
operands[1] = force_reg (TDmode, operands[1]);
decimal_real_from_string (&cmp, "9223372036854775808.0"); /* 2^63 */
decimal_real_from_string (&sub, "18446744073709551616.0"); /* 2^64 */
-
+
emit_insn (gen_cmptd (operands[1],
CONST_DOUBLE_FROM_REAL_VALUE (cmp, TDmode)));
emit_jump_insn (gen_blt (label1));
@@ -3644,7 +3875,7 @@
})
;
-; fixuns_trunc(sf|df)(si|di)2 and fix_trunc(sf|df)(si|di)2
+; fixuns_trunc(sf|df)(si|di)2 and fix_trunc(sf|df)(si|di)2
; instruction pattern(s).
;
@@ -3657,11 +3888,11 @@
rtx label2 = gen_label_rtx ();
rtx temp = gen_reg_rtx (<BFP:MODE>mode);
REAL_VALUE_TYPE cmp, sub;
-
+
operands[1] = force_reg (<BFP:MODE>mode, operands[1]);
real_2expN (&cmp, GET_MODE_BITSIZE(<GPR:MODE>mode) - 1, <BFP:MODE>mode);
real_2expN (&sub, GET_MODE_BITSIZE(<GPR:MODE>mode), <BFP:MODE>mode);
-
+
emit_insn (gen_cmp<BFP:mode> (operands[1],
CONST_DOUBLE_FROM_REAL_VALUE (cmp, <BFP:MODE>mode)));
emit_jump_insn (gen_blt (label1));
@@ -3724,7 +3955,7 @@
"TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_HARD_DFP"
"cg<DFP:xde>tr\t%0,%h2,%1"
[(set_attr "op_type" "RRF")
- (set_attr "type" "ftoi")])
+ (set_attr "type" "ftoidfp")])
;
@@ -3751,7 +3982,7 @@
"TARGET_64BIT && TARGET_HARD_FLOAT"
"c<xde>g<bt>r\t%0,%1"
[(set_attr "op_type" "RRE")
- (set_attr "type" "itof" )])
+ (set_attr "type" "itof<mode>" )])
; cxfbr, cdfbr, cefbr
(define_insn "floatsi<mode>2"
@@ -3760,7 +3991,7 @@
"TARGET_HARD_FLOAT"
"c<xde>fbr\t%0,%1"
[(set_attr "op_type" "RRE")
- (set_attr "type" "itof" )])
+ (set_attr "type" "itof<mode>" )])
;
@@ -3787,7 +4018,7 @@
"TARGET_HARD_FLOAT"
"l<xde>xbr\t%2,%1\;l<xde>r\t%0,%2"
[(set_attr "length" "6")
- (set_attr "type" "ftrunctf")])
+ (set_attr "type" "ftrunctf")])
;
; trunctddd2 and truncddsd2 instruction pattern(s).
@@ -3800,7 +4031,7 @@
"TARGET_HARD_FLOAT && TARGET_HARD_DFP"
"ldxtr\t%2,0,%1,0\;ldr\t%0,%2"
[(set_attr "length" "6")
- (set_attr "type" "ftrunctf")])
+ (set_attr "type" "ftruncdd")])
(define_insn "truncddsd2"
[(set (match_operand:SD 0 "register_operand" "=f")
@@ -3808,7 +4039,7 @@
"TARGET_HARD_FLOAT && TARGET_HARD_DFP"
"ledtr\t%0,0,%1,0"
[(set_attr "op_type" "RRF")
- (set_attr "type" "fsimptf")])
+ (set_attr "type" "ftruncsd")])
;
; extend(sf|df)(df|tf)2 instruction pattern(s).
@@ -4045,7 +4276,8 @@
"@
algfr\t%0,%2
algf\t%0,%2"
- [(set_attr "op_type" "RRE,RXY")])
+ [(set_attr "op_type" "RRE,RXY")
+ (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
(define_insn "*adddi3_zero_cconly"
[(set (reg CC_REGNUM)
@@ -4057,7 +4289,8 @@
"@
algfr\t%0,%2
algf\t%0,%2"
- [(set_attr "op_type" "RRE,RXY")])
+ [(set_attr "op_type" "RRE,RXY")
+ (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
(define_insn "*adddi3_zero"
[(set (match_operand:DI 0 "register_operand" "=d,d")
@@ -4068,7 +4301,8 @@
"@
algfr\t%0,%2
algf\t%0,%2"
- [(set_attr "op_type" "RRE,RXY")])
+ [(set_attr "op_type" "RRE,RXY")
+ (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
(define_insn_and_split "*adddi3_31z"
[(set (match_operand:DI 0 "nonimmediate_operand" "=&d")
@@ -4171,7 +4405,14 @@
a<y>\t%0,%2
a<g>si\t%0,%c2"
[(set_attr "op_type" "RR<E>,RI,RIL,RIL,RX<Y>,RXY,SIY")
- (set_attr "cpu_facility" "*,*,extimm,extimm,*,*,z10")])
+ (set_attr "cpu_facility" "*,*,extimm,extimm,*,*,z10")
+ (set_attr "z10prop" "z10_super_E1,
+ z10_super_E1,
+ z10_super_E1,
+ z10_super_E1,
+ z10_super_E1,
+ z10_super_E1,
+ z10_super_E1")])
; alr, alfi, slfi, al, aly, algr, algfi, slgfi, alg, alsi, algsi
(define_insn "*add<mode>3_carry1_cc"
@@ -4190,7 +4431,13 @@
al<y>\t%0,%2
al<g>si\t%0,%c2"
[(set_attr "op_type" "RR<E>,RIL,RIL,RX<Y>,RXY,SIY")
- (set_attr "cpu_facility" "*,extimm,extimm,*,*,z10")])
+ (set_attr "cpu_facility" "*,extimm,extimm,*,*,z10")
+ (set_attr "z10prop" "z10_super_E1,
+ z10_super_E1,
+ z10_super_E1,
+ z10_super_E1,
+ z10_super_E1,
+ z10_super_E1")])
; alr, al, aly, algr, alg
(define_insn "*add<mode>3_carry1_cconly"
@@ -4204,7 +4451,8 @@
al<g>r\t%0,%2
al<g>\t%0,%2
al<y>\t%0,%2"
- [(set_attr "op_type" "RR<E>,RX<Y>,RXY")])
+ [(set_attr "op_type" "RR<E>,RX<Y>,RXY")
+ (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1")])
; alr, alfi, slfi, al, aly, algr, algfi, slgfi, alg, alsi, algsi
(define_insn "*add<mode>3_carry2_cc"
@@ -4223,7 +4471,13 @@
al<y>\t%0,%2
al<g>si\t%0,%c2"
[(set_attr "op_type" "RR<E>,RIL,RIL,RX<Y>,RXY,SIY")
- (set_attr "cpu_facility" "*,extimm,extimm,*,*,z10")])
+ (set_attr "cpu_facility" "*,extimm,extimm,*,*,z10")
+ (set_attr "z10prop" "z10_super_E1,
+ z10_super_E1,
+ z10_super_E1,
+ z10_super_E1,
+ z10_super_E1,
+ z10_super_E1")])
; alr, al, aly, algr, alg
(define_insn "*add<mode>3_carry2_cconly"
@@ -4237,7 +4491,8 @@
al<g>r\t%0,%2
al<g>\t%0,%2
al<y>\t%0,%2"
- [(set_attr "op_type" "RR<E>,RX<Y>,RXY")])
+ [(set_attr "op_type" "RR<E>,RX<Y>,RXY")
+ (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1")])
; alr, alfi, slfi, al, aly, algr, algfi, slgfi, alg, alsi, algsi
(define_insn "*add<mode>3_cc"
@@ -4256,7 +4511,13 @@
al<y>\t%0,%2
al<g>si\t%0,%c2"
[(set_attr "op_type" "RR<E>,RIL,RIL,RX<Y>,RXY,SIY")
- (set_attr "cpu_facility" "*,extimm,extimm,*,*,z10")])
+ (set_attr "cpu_facility" "*,extimm,extimm,*,*,z10")
+ (set_attr "z10prop" "z10_super_E1,
+ z10_super_E1,
+ z10_super_E1,
+ z10_super_E1,
+ z10_super_E1,
+ z10_super_E1")])
; alr, al, aly, algr, alg
(define_insn "*add<mode>3_cconly"
@@ -4270,7 +4531,8 @@
al<g>r\t%0,%2
al<g>\t%0,%2
al<y>\t%0,%2"
- [(set_attr "op_type" "RR<E>,RX<Y>,RXY")])
+ [(set_attr "op_type" "RR<E>,RX<Y>,RXY")
+ (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1")])
; alr, al, aly, algr, alg
(define_insn "*add<mode>3_cconly2"
@@ -4283,7 +4545,8 @@
al<g>r\t%0,%2
al<g>\t%0,%2
al<y>\t%0,%2"
- [(set_attr "op_type" "RR<E>,RX<Y>,RXY")])
+ [(set_attr "op_type" "RR<E>,RX<Y>,RXY")
+ (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1")])
; ahi, afi, aghi, agfi, asi, agsi
(define_insn "*add<mode>3_imm_cc"
@@ -4303,7 +4566,8 @@
a<g>fi\t%0,%2
a<g>si\t%0,%c2"
[(set_attr "op_type" "RI,RIL,SIY")
- (set_attr "cpu_facility" "*,extimm,z10")])
+ (set_attr "cpu_facility" "*,extimm,z10")
+ (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1")])
;
; add(tf|df|sf|td|dd)3 instruction pattern(s).
@@ -4320,7 +4584,7 @@
a<xde><bt>r\t%0,<op1>%2
a<xde>b\t%0,%2"
[(set_attr "op_type" "<RRer>,RXE")
- (set_attr "type" "fsimp<bfp>")])
+ (set_attr "type" "fsimp<mode>")])
; axbr, adbr, aebr, axb, adb, aeb, adtr, axtr
(define_insn "*add<mode>3_cc"
@@ -4335,7 +4599,7 @@
a<xde><bt>r\t%0,<op1>%2
a<xde>b\t%0,%2"
[(set_attr "op_type" "<RRer>,RXE")
- (set_attr "type" "fsimp<bfp>")])
+ (set_attr "type" "fsimp<mode>")])
; axbr, adbr, aebr, axb, adb, aeb, adtr, axtr
(define_insn "*add<mode>3_cconly"
@@ -4349,7 +4613,7 @@
a<xde><bt>r\t%0,<op1>%2
a<xde>b\t%0,%2"
[(set_attr "op_type" "<RRer>,RXE")
- (set_attr "type" "fsimp<bfp>")])
+ (set_attr "type" "fsimp<mode>")])
;;
@@ -4406,7 +4670,8 @@
"@
sgfr\t%0,%2
sgf\t%0,%2"
- [(set_attr "op_type" "RRE,RXY")])
+ [(set_attr "op_type" "RRE,RXY")
+ (set_attr "z10prop" "z10_c,*")])
(define_insn "*subdi3_zero_cc"
[(set (reg CC_REGNUM)
@@ -4419,7 +4684,8 @@
"@
slgfr\t%0,%2
slgf\t%0,%2"
- [(set_attr "op_type" "RRE,RXY")])
+ [(set_attr "op_type" "RRE,RXY")
+ (set_attr "z10prop" "z10_super_c_E1,z10_super_E1")])
(define_insn "*subdi3_zero_cconly"
[(set (reg CC_REGNUM)
@@ -4431,7 +4697,8 @@
"@
slgfr\t%0,%2
slgf\t%0,%2"
- [(set_attr "op_type" "RRE,RXY")])
+ [(set_attr "op_type" "RRE,RXY")
+ (set_attr "z10prop" "z10_super_c_E1,z10_super_E1")])
(define_insn "*subdi3_zero"
[(set (match_operand:DI 0 "register_operand" "=d,d")
@@ -4442,7 +4709,8 @@
"@
slgfr\t%0,%2
slgf\t%0,%2"
- [(set_attr "op_type" "RRE,RXY")])
+ [(set_attr "op_type" "RRE,RXY")
+ (set_attr "z10prop" "z10_super_c_E1,z10_super_E1")])
(define_insn_and_split "*subdi3_31z"
[(set (match_operand:DI 0 "register_operand" "=&d")
@@ -4539,7 +4807,8 @@
s<g>r\t%0,%2
s<g>\t%0,%2
s<y>\t%0,%2"
- [(set_attr "op_type" "RR<E>,RX<Y>,RXY")])
+ [(set_attr "op_type" "RR<E>,RX<Y>,RXY")
+ (set_attr "z10prop" "z10_super_c_E1,z10_super_E1,z10_super_E1")])
; slr, sl, sly, slgr, slg
(define_insn "*sub<mode>3_borrow_cc"
@@ -4554,7 +4823,8 @@
sl<g>r\t%0,%2
sl<g>\t%0,%2
sl<y>\t%0,%2"
- [(set_attr "op_type" "RR<E>,RX<Y>,RXY")])
+ [(set_attr "op_type" "RR<E>,RX<Y>,RXY")
+ (set_attr "z10prop" "z10_super_c_E1,z10_super_E1,z10_super_E1")])
; slr, sl, sly, slgr, slg
(define_insn "*sub<mode>3_borrow_cconly"
@@ -4568,7 +4838,8 @@
sl<g>r\t%0,%2
sl<g>\t%0,%2
sl<y>\t%0,%2"
- [(set_attr "op_type" "RR<E>,RX<Y>,RXY")])
+ [(set_attr "op_type" "RR<E>,RX<Y>,RXY")
+ (set_attr "z10prop" "z10_super_c_E1,z10_super_E1,z10_super_E1")])
; slr, sl, sly, slgr, slg
(define_insn "*sub<mode>3_cc"
@@ -4583,7 +4854,8 @@
sl<g>r\t%0,%2
sl<g>\t%0,%2
sl<y>\t%0,%2"
- [(set_attr "op_type" "RR<E>,RX<Y>,RXY")])
+ [(set_attr "op_type" "RR<E>,RX<Y>,RXY")
+ (set_attr "z10prop" "z10_super_c_E1,z10_super_E1,z10_super_E1")])
; slr, sl, sly, slgr, slg
(define_insn "*sub<mode>3_cc2"
@@ -4597,7 +4869,8 @@
sl<g>r\t%0,%2
sl<g>\t%0,%2
sl<y>\t%0,%2"
- [(set_attr "op_type" "RR<E>,RX<Y>,RXY")])
+ [(set_attr "op_type" "RR<E>,RX<Y>,RXY")
+ (set_attr "z10prop" "z10_super_c_E1,z10_super_E1,z10_super_E1")])
; slr, sl, sly, slgr, slg
(define_insn "*sub<mode>3_cconly"
@@ -4611,7 +4884,9 @@
sl<g>r\t%0,%2
sl<g>\t%0,%2
sl<y>\t%0,%2"
- [(set_attr "op_type" "RR<E>,RX<Y>,RXY")])
+ [(set_attr "op_type" "RR<E>,RX<Y>,RXY")
+ (set_attr "z10prop" "z10_super_c_E1,z10_super_E1,z10_super_E1")])
+
; slr, sl, sly, slgr, slg
(define_insn "*sub<mode>3_cconly2"
@@ -4624,7 +4899,9 @@
sl<g>r\t%0,%2
sl<g>\t%0,%2
sl<y>\t%0,%2"
- [(set_attr "op_type" "RR<E>,RX<Y>,RXY")])
+ [(set_attr "op_type" "RR<E>,RX<Y>,RXY")
+ (set_attr "z10prop" "z10_super_c_E1,z10_super_E1,z10_super_E1")])
+
;
; sub(tf|df|sf|td|dd)3 instruction pattern(s).
@@ -4641,7 +4918,7 @@
s<xde><bt>r\t%0,<op1>%2
s<xde>b\t%0,%2"
[(set_attr "op_type" "<RRer>,RXE")
- (set_attr "type" "fsimp<bfp>")])
+ (set_attr "type" "fsimp<mode>")])
; sxbr, sdbr, sebr, sxb, sdb, seb, sxtr, sdtr
(define_insn "*sub<mode>3_cc"
@@ -4656,7 +4933,7 @@
s<xde><bt>r\t%0,<op1>%2
s<xde>b\t%0,%2"
[(set_attr "op_type" "<RRer>,RXE")
- (set_attr "type" "fsimp<bfp>")])
+ (set_attr "type" "fsimp<mode>")])
; sxbr, sdbr, sebr, sxb, sdb, seb, sxtr, sdtr
(define_insn "*sub<mode>3_cconly"
@@ -4670,7 +4947,7 @@
s<xde><bt>r\t%0,<op1>%2
s<xde>b\t%0,%2"
[(set_attr "op_type" "<RRer>,RXE")
- (set_attr "type" "fsimp<bfp>")])
+ (set_attr "type" "fsimp<mode>")])
;;
@@ -4793,7 +5070,8 @@
"@
slb<g>r\t%0,%2
slb<g>\t%0,%2"
- [(set_attr "op_type" "RRE,RXY")])
+ [(set_attr "op_type" "RRE,RXY")
+ (set_attr "z10prop" "z10_c,*")])
; slbr, slb, slbgr, slbg
(define_insn "*sub<mode>3_slb"
@@ -4806,7 +5084,8 @@
"@
slb<g>r\t%0,%2
slb<g>\t%0,%2"
- [(set_attr "op_type" "RRE,RXY")])
+ [(set_attr "op_type" "RRE,RXY")
+ (set_attr "z10prop" "z10_c,*")])
(define_expand "add<mode>cc"
[(match_operand:GPR 0 "register_operand" "")
@@ -4814,9 +5093,9 @@
(match_operand:GPR 2 "register_operand" "")
(match_operand:GPR 3 "const_int_operand" "")]
"TARGET_CPU_ZARCH"
- "if (!s390_expand_addcc (GET_CODE (operands[1]),
- s390_compare_op0, s390_compare_op1,
- operands[0], operands[2],
+ "if (!s390_expand_addcc (GET_CODE (operands[1]),
+ s390_compare_op0, s390_compare_op1,
+ operands[0], operands[2],
operands[3])) FAIL; DONE;")
;
@@ -4872,7 +5151,7 @@
[(set (match_dup 0) (xor:SI (match_dup 0) (const_int 1)))
(clobber (reg:CC CC_REGNUM))])]
""
-{
+{
if (!s390_compare_emitted || GET_MODE (s390_compare_emitted) != CCZ1mode)
FAIL;
operands[1] = s390_emit_compare (NE, s390_compare_op0, s390_compare_op1);
@@ -4881,7 +5160,7 @@
(define_insn_and_split "*sne"
[(set (match_operand:SI 0 "register_operand" "=d")
- (ne:SI (match_operand:CCZ1 1 "register_operand" "0")
+ (ne:SI (match_operand:CCZ1 1 "register_operand" "0")
(const_int 0)))
(clobber (reg:CC CC_REGNUM))]
""
@@ -4996,7 +5275,7 @@
; mul(tf|df|sf|td|dd)3 instruction pattern(s).
;
-; mxbr mdbr, meebr, mxb, mxb, meeb, mdtr, mxtr
+; mxbr, mdbr, meebr, mxb, mxb, meeb, mdtr, mxtr
(define_insn "mul<mode>3"
[(set (match_operand:FP 0 "register_operand" "=f,f")
(mult:FP (match_operand:FP 1 "nonimmediate_operand" "%<f0>,0")
@@ -5006,9 +5285,9 @@
m<xdee><bt>r\t%0,<op1>%2
m<xdee>b\t%0,%2"
[(set_attr "op_type" "<RRer>,RXE")
- (set_attr "type" "fmul<bfp>")])
+ (set_attr "type" "fmul<mode>")])
-; maxbr, madbr, maebr, maxb, madb, maeb
+; madbr, maebr, maxb, madb, maeb
(define_insn "*fmadd<mode>"
[(set (match_operand:DSF 0 "register_operand" "=f,f")
(plus:DSF (mult:DSF (match_operand:DSF 1 "register_operand" "%f,f")
@@ -5466,7 +5745,7 @@
d<xde><bt>r\t%0,<op1>%2
d<xde>b\t%0,%2"
[(set_attr "op_type" "<RRer>,RXE")
- (set_attr "type" "fdiv<bfp>")])
+ (set_attr "type" "fdiv<mode>")])
;;
@@ -5496,7 +5775,8 @@
"@
ngr\t%0,%2
ng\t%0,%2"
- [(set_attr "op_type" "RRE,RXY")])
+ [(set_attr "op_type" "RRE,RXY")
+ (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
(define_insn "*anddi3_cconly"
[(set (reg CC_REGNUM)
@@ -5510,7 +5790,8 @@
"@
ngr\t%0,%2
ng\t%0,%2"
- [(set_attr "op_type" "RRE,RXY")])
+ [(set_attr "op_type" "RRE,RXY")
+ (set_attr "z10prop" "z10_super_E1, z10_super_E1")])
(define_insn "*anddi3"
[(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,d,d,d,d,d,d,d,d,AQ,Q")
@@ -5534,7 +5815,19 @@
#
#"
[(set_attr "op_type" "RRE,RXE,RI,RI,RI,RI,RIL,RIL,RRE,RXY,SI,SS")
- (set_attr "cpu_facility" "*,*,*,*,*,*,extimm,extimm,*,*,*,*")])
+ (set_attr "cpu_facility" "*,*,*,*,*,*,extimm,extimm,*,*,*,*")
+ (set_attr "z10prop" "*,
+ *,
+ z10_super_E1,
+ z10_super_E1,
+ z10_super_E1,
+ z10_super_E1,
+ z10_super_E1,
+ z10_super_E1,
+ z10_super_E1,
+ z10_super_E1,
+ *,
+ *")])
(define_split
[(set (match_operand:DI 0 "s_operand" "")
@@ -5564,7 +5857,8 @@
nr\t%0,%2
n\t%0,%2
ny\t%0,%2"
- [(set_attr "op_type" "RIL,RR,RX,RXY")])
+ [(set_attr "op_type" "RIL,RR,RX,RXY")
+ (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1,z10_super_E1")])
(define_insn "*andsi3_cconly"
[(set (reg CC_REGNUM)
@@ -5580,7 +5874,8 @@
nr\t%0,%2
n\t%0,%2
ny\t%0,%2"
- [(set_attr "op_type" "RIL,RR,RX,RXY")])
+ [(set_attr "op_type" "RIL,RR,RX,RXY")
+ (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1,z10_super_E1")])
(define_insn "*andsi3_zarch"
[(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,d,d,d,d,d,AQ,Q")
@@ -5601,7 +5896,17 @@
ny\t%0,%2
#
#"
- [(set_attr "op_type" "RRE,RXE,RI,RI,RIL,RR,RX,RXY,SI,SS")])
+ [(set_attr "op_type" "RRE,RXE,RI,RI,RIL,RR,RX,RXY,SI,SS")
+ (set_attr "z10prop" "*,
+ *,
+ z10_super_E1,
+ z10_super_E1,
+ z10_super_E1,
+ z10_super_E1,
+ z10_super_E1,
+ z10_super_E1,
+ *,
+ *")])
(define_insn "*andsi3_esa"
[(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,AQ,Q")
@@ -5614,7 +5919,9 @@
n\t%0,%2
#
#"
- [(set_attr "op_type" "RR,RX,SI,SS")])
+ [(set_attr "op_type" "RR,RX,SI,SS")
+ (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,*")])
+
(define_split
[(set (match_operand:SI 0 "s_operand" "")
@@ -5641,7 +5948,9 @@
nill\t%0,%x2
#
#"
- [(set_attr "op_type" "RR,RI,SI,SS")])
+ [(set_attr "op_type" "RR,RI,SI,SS")
+ (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,*")
+])
(define_insn "*andhi3_esa"
[(set (match_operand:HI 0 "nonimmediate_operand" "=d,AQ,Q")
@@ -5653,7 +5962,9 @@
nr\t%0,%2
#
#"
- [(set_attr "op_type" "RR,SI,SS")])
+ [(set_attr "op_type" "RR,SI,SS")
+ (set_attr "z10prop" "z10_super_E1,*,*")
+])
(define_split
[(set (match_operand:HI 0 "s_operand" "")
@@ -5681,7 +5992,8 @@
ni\t%S0,%b2
niy\t%S0,%b2
#"
- [(set_attr "op_type" "RR,RI,SI,SIY,SS")])
+ [(set_attr "op_type" "RR,RI,SI,SIY,SS")
+ (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super,z10_super,*")])
(define_insn "*andqi3_esa"
[(set (match_operand:QI 0 "nonimmediate_operand" "=d,Q,Q")
@@ -5693,7 +6005,8 @@
nr\t%0,%2
ni\t%S0,%b2
#"
- [(set_attr "op_type" "RR,SI,SS")])
+ [(set_attr "op_type" "RR,SI,SS")
+ (set_attr "z10prop" "z10_super_E1,z10_super,*")])
;
; Block and (NC) patterns.
@@ -5742,7 +6055,7 @@
(clobber (reg:CC CC_REGNUM))])]
"s390_offset_p (operands[0], operands[3], operands[2])
&& s390_offset_p (operands[1], operands[4], operands[2])
- && !s390_overlap_p (operands[0], operands[1],
+ && !s390_overlap_p (operands[0], operands[1],
INTVAL (operands[2]) + INTVAL (operands[5]))
&& INTVAL (operands[2]) + INTVAL (operands[5]) <= 256"
[(parallel
@@ -5781,7 +6094,8 @@
"@
ogr\t%0,%2
og\t%0,%2"
- [(set_attr "op_type" "RRE,RXY")])
+ [(set_attr "op_type" "RRE,RXY")
+ (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
(define_insn "*iordi3_cconly"
[(set (reg CC_REGNUM)
@@ -5793,7 +6107,8 @@
"@
ogr\t%0,%2
og\t%0,%2"
- [(set_attr "op_type" "RRE,RXY")])
+ [(set_attr "op_type" "RRE,RXY")
+ (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
(define_insn "*iordi3"
[(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,d,d,d,d,d,d,AQ,Q")
@@ -5814,7 +6129,17 @@
#
#"
[(set_attr "op_type" "RI,RI,RI,RI,RIL,RIL,RRE,RXY,SI,SS")
- (set_attr "cpu_facility" "*,*,*,*,extimm,extimm,*,*,*,*")])
+ (set_attr "cpu_facility" "*,*,*,*,extimm,extimm,*,*,*,*")
+ (set_attr "z10prop" "z10_super_E1,
+ z10_super_E1,
+ z10_super_E1,
+ z10_super_E1,
+ z10_super_E1,
+ z10_super_E1,
+ z10_super_E1,
+ z10_super_E1,
+ *,
+ *")])
(define_split
[(set (match_operand:DI 0 "s_operand" "")
@@ -5843,7 +6168,8 @@
or\t%0,%2
o\t%0,%2
oy\t%0,%2"
- [(set_attr "op_type" "RIL,RR,RX,RXY")])
+ [(set_attr "op_type" "RIL,RR,RX,RXY")
+ (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1,z10_super_E1")])
(define_insn "*iorsi3_cconly"
[(set (reg CC_REGNUM)
@@ -5857,7 +6183,8 @@
or\t%0,%2
o\t%0,%2
oy\t%0,%2"
- [(set_attr "op_type" "RIL,RR,RX,RXY")])
+ [(set_attr "op_type" "RIL,RR,RX,RXY")
+ (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1,z10_super_E1")])
(define_insn "*iorsi3_zarch"
[(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,d,d,d,AQ,Q")
@@ -5874,7 +6201,15 @@
oy\t%0,%2
#
#"
- [(set_attr "op_type" "RI,RI,RIL,RR,RX,RXY,SI,SS")])
+ [(set_attr "op_type" "RI,RI,RIL,RR,RX,RXY,SI,SS")
+ (set_attr "z10prop" "z10_super_E1,
+ z10_super_E1,
+ z10_super_E1,
+ z10_super_E1,
+ z10_super_E1,
+ z10_super_E1,
+ *,
+ *")])
(define_insn "*iorsi3_esa"
[(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,AQ,Q")
@@ -5887,7 +6222,8 @@
o\t%0,%2
#
#"
- [(set_attr "op_type" "RR,RX,SI,SS")])
+ [(set_attr "op_type" "RR,RX,SI,SS")
+ (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,*")])
(define_split
[(set (match_operand:SI 0 "s_operand" "")
@@ -5914,7 +6250,8 @@
oill\t%0,%x2
#
#"
- [(set_attr "op_type" "RR,RI,SI,SS")])
+ [(set_attr "op_type" "RR,RI,SI,SS")
+ (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,*")])
(define_insn "*iorhi3_esa"
[(set (match_operand:HI 0 "nonimmediate_operand" "=d,AQ,Q")
@@ -5926,7 +6263,8 @@
or\t%0,%2
#
#"
- [(set_attr "op_type" "RR,SI,SS")])
+ [(set_attr "op_type" "RR,SI,SS")
+ (set_attr "z10prop" "z10_super_E1,*,*")])
(define_split
[(set (match_operand:HI 0 "s_operand" "")
@@ -5954,7 +6292,8 @@
oi\t%S0,%b2
oiy\t%S0,%b2
#"
- [(set_attr "op_type" "RR,RI,SI,SIY,SS")])
+ [(set_attr "op_type" "RR,RI,SI,SIY,SS")
+ (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super,z10_super,*")])
(define_insn "*iorqi3_esa"
[(set (match_operand:QI 0 "nonimmediate_operand" "=d,Q,Q")
@@ -5966,7 +6305,8 @@
or\t%0,%2
oi\t%S0,%b2
#"
- [(set_attr "op_type" "RR,SI,SS")])
+ [(set_attr "op_type" "RR,SI,SS")
+ (set_attr "z10prop" "z10_super_E1,z10_super,*")])
;
; Block inclusive or (OC) patterns.
@@ -6015,7 +6355,7 @@
(clobber (reg:CC CC_REGNUM))])]
"s390_offset_p (operands[0], operands[3], operands[2])
&& s390_offset_p (operands[1], operands[4], operands[2])
- && !s390_overlap_p (operands[0], operands[1],
+ && !s390_overlap_p (operands[0], operands[1],
INTVAL (operands[2]) + INTVAL (operands[5]))
&& INTVAL (operands[2]) + INTVAL (operands[5]) <= 256"
[(parallel
@@ -6054,7 +6394,8 @@
"@
xgr\t%0,%2
xg\t%0,%2"
- [(set_attr "op_type" "RRE,RXY")])
+ [(set_attr "op_type" "RRE,RXY")
+ (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
(define_insn "*xordi3_cconly"
[(set (reg CC_REGNUM)
@@ -6066,7 +6407,8 @@
"@
xgr\t%0,%2
xg\t%0,%2"
- [(set_attr "op_type" "RRE,RXY")])
+ [(set_attr "op_type" "RRE,RXY")
+ (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
(define_insn "*xordi3"
[(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,d,d,AQ,Q")
@@ -6082,7 +6424,8 @@
#
#"
[(set_attr "op_type" "RIL,RIL,RRE,RXY,SI,SS")
- (set_attr "cpu_facility" "extimm,extimm,*,*,*,*")])
+ (set_attr "cpu_facility" "extimm,extimm,*,*,*,*")
+ (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1,z10_super_E1,*,*")])
(define_split
[(set (match_operand:DI 0 "s_operand" "")
@@ -6111,7 +6454,8 @@
xr\t%0,%2
x\t%0,%2
xy\t%0,%2"
- [(set_attr "op_type" "RIL,RR,RX,RXY")])
+ [(set_attr "op_type" "RIL,RR,RX,RXY")
+ (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1,z10_super_E1")])
(define_insn "*xorsi3_cconly"
[(set (reg CC_REGNUM)
@@ -6125,7 +6469,8 @@
xr\t%0,%2
x\t%0,%2
xy\t%0,%2"
- [(set_attr "op_type" "RIL,RR,RX,RXY")])
+ [(set_attr "op_type" "RIL,RR,RX,RXY")
+ (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1,z10_super_E1")])
(define_insn "*xorsi3"
[(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,d,AQ,Q")
@@ -6140,7 +6485,8 @@
xy\t%0,%2
#
#"
- [(set_attr "op_type" "RIL,RR,RX,RXY,SI,SS")])
+ [(set_attr "op_type" "RIL,RR,RX,RXY,SI,SS")
+ (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1,z10_super_E1,*,*")])
(define_split
[(set (match_operand:SI 0 "s_operand" "")
@@ -6167,7 +6513,8 @@
xr\t%0,%2
#
#"
- [(set_attr "op_type" "RIL,RR,SI,SS")])
+ [(set_attr "op_type" "RIL,RR,SI,SS")
+ (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,*")])
(define_split
[(set (match_operand:HI 0 "s_operand" "")
@@ -6195,7 +6542,9 @@
xi\t%S0,%b2
xiy\t%S0,%b2
#"
- [(set_attr "op_type" "RIL,RR,SI,SIY,SS")])
+ [(set_attr "op_type" "RIL,RR,SI,SIY,SS")
+ (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super,z10_super,*")])
+
;
; Block exclusive or (XC) patterns.
@@ -6244,7 +6593,7 @@
(clobber (reg:CC CC_REGNUM))])]
"s390_offset_p (operands[0], operands[3], operands[2])
&& s390_offset_p (operands[1], operands[4], operands[2])
- && !s390_overlap_p (operands[0], operands[1],
+ && !s390_overlap_p (operands[0], operands[1],
INTVAL (operands[2]) + INTVAL (operands[5]))
&& INTVAL (operands[2]) + INTVAL (operands[5]) <= 256"
[(parallel
@@ -6316,7 +6665,7 @@
"TARGET_64BIT && s390_match_ccmode (insn, CCAmode)"
"lcgfr\t%0,%1"
[(set_attr "op_type" "RRE")])
-
+
(define_insn "*negdi2_sign"
[(set (match_operand:DI 0 "register_operand" "=d")
(neg:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "d"))))
@@ -6334,7 +6683,8 @@
(neg:GPR (match_dup 1)))]
"s390_match_ccmode (insn, CCAmode)"
"lc<g>r\t%0,%1"
- [(set_attr "op_type" "RR<E>")])
+ [(set_attr "op_type" "RR<E>")
+ (set_attr "z10prop" "z10_super_c_E1")])
; lcr, lcgr
(define_insn "*neg<mode>2_cconly"
@@ -6344,7 +6694,8 @@
(clobber (match_scratch:GPR 0 "=d"))]
"s390_match_ccmode (insn, CCAmode)"
"lc<g>r\t%0,%1"
- [(set_attr "op_type" "RR<E>")])
+ [(set_attr "op_type" "RR<E>")
+ (set_attr "z10prop" "z10_super_c_E1")])
; lcr, lcgr
(define_insn "*neg<mode>2"
@@ -6353,7 +6704,8 @@
(clobber (reg:CC CC_REGNUM))]
""
"lc<g>r\t%0,%1"
- [(set_attr "op_type" "RR<E>")])
+ [(set_attr "op_type" "RR<E>")
+ (set_attr "z10prop" "z10_super_c_E1")])
(define_insn_and_split "*negdi2_31"
[(set (match_operand:DI 0 "register_operand" "=d")
@@ -6425,7 +6777,7 @@
"TARGET_HARD_FLOAT && TARGET_DFP"
"lcdfr\t%0,%1"
[(set_attr "op_type" "RRE")
- (set_attr "type" "fsimp<bfp>")])
+ (set_attr "type" "fsimp<mode>")])
; lcxbr, lcdbr, lcebr
(define_insn "*neg<mode>2"
@@ -6475,9 +6827,10 @@
(abs:GPR (match_dup 1)))]
"s390_match_ccmode (insn, CCAmode)"
"lp<g>r\t%0,%1"
- [(set_attr "op_type" "RR<E>")])
+ [(set_attr "op_type" "RR<E>")
+ (set_attr "z10prop" "z10_c")])
-; lpr, lpgr
+; lpr, lpgr
(define_insn "*abs<mode>2_cconly"
[(set (reg CC_REGNUM)
(compare (abs:GPR (match_operand:GPR 1 "register_operand" "d"))
@@ -6485,7 +6838,8 @@
(clobber (match_scratch:GPR 0 "=d"))]
"s390_match_ccmode (insn, CCAmode)"
"lp<g>r\t%0,%1"
- [(set_attr "op_type" "RR<E>")])
+ [(set_attr "op_type" "RR<E>")
+ (set_attr "z10prop" "z10_c")])
; lpr, lpgr
(define_insn "abs<mode>2"
@@ -6494,7 +6848,8 @@
(clobber (reg:CC CC_REGNUM))]
""
"lp<g>r\t%0,%1"
- [(set_attr "op_type" "RR<E>")])
+ [(set_attr "op_type" "RR<E>")
+ (set_attr "z10prop" "z10_c")])
;
; abs(df|sf)2 instruction pattern(s).
@@ -6538,7 +6893,7 @@
"TARGET_HARD_FLOAT && TARGET_DFP"
"lpdfr\t%0,%1"
[(set_attr "op_type" "RRE")
- (set_attr "type" "fsimp<bfp>")])
+ (set_attr "type" "fsimp<mode>")])
; lpxbr, lpdbr, lpebr
(define_insn "*abs<mode>2"
@@ -6570,7 +6925,7 @@
"TARGET_64BIT && s390_match_ccmode (insn, CCAmode)"
"lngfr\t%0,%1"
[(set_attr "op_type" "RRE")])
-
+
(define_insn "*negabsdi2_sign"
[(set (match_operand:DI 0 "register_operand" "=d")
(neg:DI (abs:DI (sign_extend:DI
@@ -6589,7 +6944,8 @@
(neg:GPR (abs:GPR (match_dup 1))))]
"s390_match_ccmode (insn, CCAmode)"
"ln<g>r\t%0,%1"
- [(set_attr "op_type" "RR<E>")])
+ [(set_attr "op_type" "RR<E>")
+ (set_attr "z10prop" "z10_c")])
; lnr, lngr
(define_insn "*negabs<mode>2_cconly"
@@ -6599,7 +6955,8 @@
(clobber (match_scratch:GPR 0 "=d"))]
"s390_match_ccmode (insn, CCAmode)"
"ln<g>r\t%0,%1"
- [(set_attr "op_type" "RR<E>")])
+ [(set_attr "op_type" "RR<E>")
+ (set_attr "z10prop" "z10_c")])
; lnr, lngr
(define_insn "*negabs<mode>2"
@@ -6608,7 +6965,8 @@
(clobber (reg:CC CC_REGNUM))]
""
"ln<g>r\t%0,%1"
- [(set_attr "op_type" "RR<E>")])
+ [(set_attr "op_type" "RR<E>")
+ (set_attr "z10prop" "z10_c")])
;
; Floating point
@@ -6644,7 +7002,7 @@
"TARGET_HARD_FLOAT && TARGET_DFP"
"lndfr\t%0,%1"
[(set_attr "op_type" "RRE")
- (set_attr "type" "fsimp<bfp>")])
+ (set_attr "type" "fsimp<mode>")])
; lnxbr, lndbr, lnebr
(define_insn "*negabs<mode>2"
@@ -6664,12 +7022,12 @@
(define_insn "copysign<mode>3"
[(set (match_operand:FP 0 "register_operand" "=f")
(unspec:FP [(match_operand:FP 1 "register_operand" "<fT0>")
- (match_operand:FP 2 "register_operand" "f")]
+ (match_operand:FP 2 "register_operand" "f")]
UNSPEC_COPYSIGN))]
"TARGET_HARD_FLOAT && TARGET_DFP"
"cpsdr\t%0,%2,%1"
[(set_attr "op_type" "RRF")
- (set_attr "type" "fsimp<bfp>")])
+ (set_attr "type" "fsimp<mode>")])
;;
;;- Square root instructions.
@@ -6679,7 +7037,7 @@
; sqrt(df|sf)2 instruction pattern(s).
;
-; sqxbr, sqdbr, sqebr, sqxb, sqdb, sqeb
+; sqxbr, sqdbr, sqebr, sqdb, sqeb
(define_insn "sqrt<mode>2"
[(set (match_operand:BFP 0 "register_operand" "=f,f")
(sqrt:BFP (match_operand:BFP 1 "general_operand" "f,<Rf>")))]
@@ -6726,7 +7084,7 @@
emit_insn (gen_clztidi2 (wide_reg, operands[1], msb));
- insn = emit_move_insn (operands[0], gen_highpart (DImode, wide_reg));
+ insn = emit_move_insn (operands[0], gen_highpart (DImode, wide_reg));
set_unique_reg_note (insn, REG_EQUAL, clz_equal);
DONE;
@@ -6735,16 +7093,16 @@
(define_insn "clztidi2"
[(set (match_operand:TI 0 "register_operand" "=d")
(ior:TI
- (ashift:TI
- (zero_extend:TI
+ (ashift:TI
+ (zero_extend:TI
(xor:DI (match_operand:DI 1 "register_operand" "d")
(lshiftrt (match_operand:DI 2 "const_int_operand" "")
(subreg:SI (clz:DI (match_dup 1)) 4))))
-
+
(const_int 64))
(zero_extend:TI (clz:DI (match_dup 1)))))
(clobber (reg:CC CC_REGNUM))]
- "(unsigned HOST_WIDE_INT) INTVAL (operands[2])
+ "(unsigned HOST_WIDE_INT) INTVAL (operands[2])
== (unsigned HOST_WIDE_INT) 1 << 63
&& TARGET_EXTIMM && TARGET_64BIT"
"flogr\t%0,%1"
@@ -6767,7 +7125,8 @@
"TARGET_CPU_ZARCH"
"rll<g>\t%0,%1,%Y2"
[(set_attr "op_type" "RSE")
- (set_attr "atype" "reg")])
+ (set_attr "atype" "reg")
+ (set_attr "z10prop" "z10_super_E1")])
; rll, rllg
(define_insn "*rotl<mode>3_and"
@@ -6778,7 +7137,8 @@
"TARGET_CPU_ZARCH && (INTVAL (operands[3]) & 63) == 63"
"rll<g>\t%0,%1,%Y2"
[(set_attr "op_type" "RSE")
- (set_attr "atype" "reg")])
+ (set_attr "atype" "reg")
+ (set_attr "z10prop" "z10_super_E1")])
;;
@@ -6814,7 +7174,8 @@
""
"s<lr>l<g>\t%0,<1>%Y2"
[(set_attr "op_type" "RS<E>")
- (set_attr "atype" "reg")])
+ (set_attr "atype" "reg")
+ (set_attr "z10prop" "z10_super_E1")])
; sldl, srdl
(define_insn "*<shift>di3_31_and"
@@ -6836,7 +7197,8 @@
"(INTVAL (operands[3]) & 63) == 63"
"s<lr>l<g>\t%0,<1>%Y2"
[(set_attr "op_type" "RS<E>")
- (set_attr "atype" "reg")])
+ (set_attr "atype" "reg")
+ (set_attr "z10prop" "z10_super_E1")])
;
; ashr(di|si)3 instruction pattern(s).
@@ -6895,7 +7257,8 @@
"s390_match_ccmode(insn, CCSmode)"
"sra<g>\t%0,<1>%Y2"
[(set_attr "op_type" "RS<E>")
- (set_attr "atype" "reg")])
+ (set_attr "atype" "reg")
+ (set_attr "z10prop" "z10_super_E1")])
; sra, srag
(define_insn "*ashr<mode>3_cconly"
@@ -6907,7 +7270,8 @@
"s390_match_ccmode(insn, CCSmode)"
"sra<g>\t%0,<1>%Y2"
[(set_attr "op_type" "RS<E>")
- (set_attr "atype" "reg")])
+ (set_attr "atype" "reg")
+ (set_attr "z10prop" "z10_super_E1")])
; sra, srag
(define_insn "*ashr<mode>3"
@@ -6918,7 +7282,8 @@
""
"sra<g>\t%0,<1>%Y2"
[(set_attr "op_type" "RS<E>")
- (set_attr "atype" "reg")])
+ (set_attr "atype" "reg")
+ (set_attr "z10prop" "z10_super_E1")])
; shift pattern with implicit ANDs
@@ -6973,7 +7338,8 @@
"s390_match_ccmode(insn, CCSmode) && (INTVAL (operands[3]) & 63) == 63"
"sra<g>\t%0,<1>%Y2"
[(set_attr "op_type" "RS<E>")
- (set_attr "atype" "reg")])
+ (set_attr "atype" "reg")
+ (set_attr "z10prop" "z10_super_E1")])
; sra, srag
(define_insn "*ashr<mode>3_cconly_and"
@@ -6986,7 +7352,8 @@
"s390_match_ccmode(insn, CCSmode) && (INTVAL (operands[3]) & 63) == 63"
"sra<g>\t%0,<1>%Y2"
[(set_attr "op_type" "RS<E>")
- (set_attr "atype" "reg")])
+ (set_attr "atype" "reg")
+ (set_attr "z10prop" "z10_super_E1")])
; sra, srag
(define_insn "*ashr<mode>3_and"
@@ -6998,7 +7365,8 @@
"(INTVAL (operands[3]) & 63) == 63"
"sra<g>\t%0,<1>%Y2"
[(set_attr "op_type" "RS<E>")
- (set_attr "atype" "reg")])
+ (set_attr "atype" "reg")
+ (set_attr "z10prop" "z10_super_E1")])
;;
@@ -7158,7 +7526,7 @@
""
{
if (operands[1] != const0_rtx) FAIL;
- operands[0] = s390_emit_compare (GET_CODE (operands[0]),
+ operands[0] = s390_emit_compare (GET_CODE (operands[0]),
s390_compare_op0, s390_compare_op1);
})
@@ -7181,7 +7549,8 @@
c<g>rt%C0\t%1,%2
c<g>it%C0\t%1,%h2"
[(set_attr "op_type" "RRF,RIE")
- (set_attr "type" "branch")])
+ (set_attr "type" "branch")
+ (set_attr "z10prop" "z10_c,*")])
; clrt, clgrt, clfit, clgit
(define_insn "*cmp_and_trap_unsigned_int<mode>"
@@ -7194,7 +7563,8 @@
cl<g>rt%C0\t%1,%2
cl<gf>it%C0\t%1,%x2"
[(set_attr "op_type" "RRF,RIE")
- (set_attr "type" "branch")])
+ (set_attr "type" "branch")
+ (set_attr "z10prop" "z10_c,*")])
;;
;;- Loop instructions.
@@ -7256,6 +7626,9 @@
(pc)))]
""
[(set_attr "op_type" "RI")
+ ; Strictly speaking, the z10 properties are valid for brct only, however, it does not
+ ; hurt us in the (rare) case of ahi.
+ (set_attr "z10prop" "z10_super")
(set_attr "type" "branch")
(set (attr "length")
(if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
@@ -7295,6 +7668,9 @@
(pc)))]
""
[(set_attr "op_type" "RI")
+ ; Strictly speaking, the z10 properties are valid for brct only, however, it does not
+ ; hurt us in the (rare) case of ahi.
+ (set_attr "z10prop" "z10_super")
(set_attr "type" "branch")
(set (attr "length")
(if_then_else (eq (symbol_ref "flag_pic") (const_int 0))
@@ -7361,6 +7737,9 @@
(pc)))]
""
[(set_attr "op_type" "RI")
+ ; Strictly speaking, the z10 properties are valid for brct only, however, it does not
+ ; hurt us in the (rare) case of ahi.
+ (set_attr "z10prop" "z10_super")
(set_attr "type" "branch")
(set (attr "length")
(if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
@@ -7427,7 +7806,8 @@
(if_then_else (match_operand 0 "register_operand" "")
(const_string "RR") (const_string "RX")))
(set_attr "type" "branch")
- (set_attr "atype" "agen")])
+ (set_attr "atype" "agen")
+ (set_attr "z10prop" "z10_super")])
;
; casesi instruction pattern(s).
@@ -7770,7 +8150,8 @@
UNSPEC_TLS_LOAD))]
"TARGET_64BIT"
"lg\t%0,%1%J2"
- [(set_attr "op_type" "RXE")])
+ [(set_attr "op_type" "RXE")
+ (set_attr "z10prop" "z10_fwd_A3")])
(define_insn "*tls_load_31"
[(set (match_operand:SI 0 "register_operand" "=d,d")
@@ -7781,7 +8162,8 @@
"@
l\t%0,%1%J2
ly\t%0,%1%J2"
- [(set_attr "op_type" "RX,RXY")])
+ [(set_attr "op_type" "RX,RXY")
+ (set_attr "z10prop" "z10_fwd_A3,z10_fwd_A3")])
(define_insn "*bras_tls"
[(set (match_operand 0 "" "")
@@ -7851,6 +8233,8 @@
""
"bcr\t15,0"
[(set_attr "op_type" "RR")])
+; Although bcr is superscalar on Z10, this variant will never become part of
+; an execution group.
;
; compare and swap patterns.
@@ -7883,7 +8267,7 @@
(set (reg:CCZ1 CC_REGNUM)
(compare:CCZ1 (match_dup 1) (match_dup 2)))])]
""
- "s390_expand_cs_hqi (<MODE>mode, operands[0], operands[1],
+ "s390_expand_cs_hqi (<MODE>mode, operands[0], operands[1],
operands[2], operands[3]); DONE;")
(define_expand "sync_compare_and_swap_cc<mode>"
@@ -7936,7 +8320,7 @@
UNSPECV_CAS))
(set (reg:CCZ1 CC_REGNUM)
(compare:CCZ1 (match_dup 1) (match_dup 2)))]
- ""
+ ""
"cs<g>\t%0,%3,%S1"
[(set_attr "op_type" "RS<E>")
(set_attr "type" "sem")])
@@ -7951,7 +8335,7 @@
(match_operand:HQI 1 "memory_operand")
(match_operand:HQI 2 "general_operand")]
""
- "s390_expand_atomic (<MODE>mode, SET, operands[0], operands[1],
+ "s390_expand_atomic (<MODE>mode, SET, operands[0], operands[1],
operands[2], false); DONE;")
(define_expand "sync_<atomic><mode>"
@@ -7959,7 +8343,7 @@
(ATOMIC:HQI (match_dup 0)
(match_operand:HQI 1 "general_operand")))]
""
- "s390_expand_atomic (<MODE>mode, <CODE>, NULL_RTX, operands[0],
+ "s390_expand_atomic (<MODE>mode, <CODE>, NULL_RTX, operands[0],
operands[1], false); DONE;")
(define_expand "sync_old_<atomic><mode>"
@@ -7969,16 +8353,16 @@
(ATOMIC:HQI (match_dup 1)
(match_operand:HQI 2 "general_operand")))]
""
- "s390_expand_atomic (<MODE>mode, <CODE>, operands[0], operands[1],
+ "s390_expand_atomic (<MODE>mode, <CODE>, operands[0], operands[1],
operands[2], false); DONE;")
(define_expand "sync_new_<atomic><mode>"
[(set (match_operand:HQI 0 "register_operand")
(ATOMIC:HQI (match_operand:HQI 1 "memory_operand")
- (match_operand:HQI 2 "general_operand")))
+ (match_operand:HQI 2 "general_operand")))
(set (match_dup 1) (ATOMIC:HQI (match_dup 1) (match_dup 2)))]
""
- "s390_expand_atomic (<MODE>mode, <CODE>, operands[0], operands[1],
+ "s390_expand_atomic (<MODE>mode, <CODE>, operands[0], operands[1],
operands[2], true); DONE;")
;;
@@ -8090,7 +8474,7 @@
if (TARGET_BACKCHAIN)
temp = force_reg (Pmode, operand_subword (operands[1], 0, 0, mode));
-
+
emit_move_insn (base, operand_subword (operands[1], 2, 0, mode));
emit_move_insn (operands[0], operand_subword (operands[1], 1, 0, mode));
@@ -8178,7 +8562,8 @@
"TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
"larl\t%0,%1"
[(set_attr "op_type" "RIL")
- (set_attr "type" "larl")])
+ (set_attr "type" "larl")
+ (set_attr "z10prop" "z10_super_A1")])
(define_insn "main_pool"
[(set (match_operand 0 "register_operand" "=a")
@@ -8187,7 +8572,7 @@
{
gcc_unreachable ();
}
- [(set (attr "type")
+ [(set (attr "type")
(if_then_else (ne (symbol_ref "TARGET_CPU_ZARCH") (const_int 0))
(const_string "larl") (const_string "la")))])
@@ -8205,7 +8590,8 @@
"TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
"larl\t%0,%1"
[(set_attr "op_type" "RIL")
- (set_attr "type" "larl")])
+ (set_attr "type" "larl")
+ (set_attr "z10prop" "z10_super_A1")])
(define_insn "pool"
[(unspec_volatile [(match_operand 0 "const_int_operand" "n")] UNSPECV_POOL)]
@@ -8366,6 +8752,7 @@
instruction. */
return "";
-
-} [(set_attr "type" "load,larl")
- (set_attr "op_type" "RXY,RIL")])
+}
+ [(set_attr "type" "load,larl")
+ (set_attr "op_type" "RXY,RIL")
+ (set_attr "z10prop" "z10_super")])
diff --git a/gcc/config/score/score-protos.h b/gcc/config/score/score-protos.h
index c240d8272dc..5f444abdf73 100644
--- a/gcc/config/score/score-protos.h
+++ b/gcc/config/score/score-protos.h
@@ -62,13 +62,13 @@ extern void score_declare_object (FILE *stream, const char *name,
const char *directive, const char *fmt, ...);
extern int score_output_external (FILE *file, tree decl, const char *name);
extern void score_override_options (void);
-extern enum reg_class score_secondary_reload_class (enum reg_class class,
+extern enum reg_class score_secondary_reload_class (enum reg_class rclass,
enum machine_mode mode,
rtx x);
extern rtx score_function_value (tree valtype, tree func,
enum machine_mode mode);
extern enum reg_class score_preferred_reload_class (rtx x,
- enum reg_class class);
+ enum reg_class rclass);
extern HOST_WIDE_INT score_initial_elimination_offset (int from, int to);
extern void score_print_operand (FILE *file, rtx op, int letter);
extern void score_print_operand_address (FILE *file, rtx addr);
diff --git a/gcc/config/score/score.c b/gcc/config/score/score.c
index 4f383da88dd..c2e4176e382 100644
--- a/gcc/config/score/score.c
+++ b/gcc/config/score/score.c
@@ -361,12 +361,12 @@ score_reg_class (int regno)
/* Implement PREFERRED_RELOAD_CLASS macro. */
enum reg_class
-score_preferred_reload_class (rtx x ATTRIBUTE_UNUSED, enum reg_class class)
+score_preferred_reload_class (rtx x ATTRIBUTE_UNUSED, enum reg_class rclass)
{
if (TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)
- return score7_preferred_reload_class (x, class);
+ return score7_preferred_reload_class (x, rclass);
else if (TARGET_SCORE3)
- return score3_preferred_reload_class (x, class);
+ return score3_preferred_reload_class (x, rclass);
gcc_unreachable ();
}
@@ -374,14 +374,14 @@ score_preferred_reload_class (rtx x ATTRIBUTE_UNUSED, enum reg_class class)
/* Implement SECONDARY_INPUT_RELOAD_CLASS
and SECONDARY_OUTPUT_RELOAD_CLASS macro. */
enum reg_class
-score_secondary_reload_class (enum reg_class class,
+score_secondary_reload_class (enum reg_class rclass,
enum machine_mode mode ATTRIBUTE_UNUSED,
rtx x)
{
if (TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)
- return score7_secondary_reload_class (class, mode, x);
+ return score7_secondary_reload_class (rclass, mode, x);
else if (TARGET_SCORE3)
- return score3_secondary_reload_class (class, mode, x);
+ return score3_secondary_reload_class (rclass, mode, x);
gcc_unreachable ();
}
diff --git a/gcc/config/score/score.h b/gcc/config/score/score.h
index 78d2c574e1a..d400f6ab0ce 100644
--- a/gcc/config/score/score.h
+++ b/gcc/config/score/score.h
@@ -198,8 +198,6 @@
support long double, we also want a 128-bit integer type. */
#define MAX_FIXED_MODE_SIZE LONG_DOUBLE_TYPE_SIZE
-#define TARGET_FLOAT_FORMAT IEEE_FLOAT_FORMAT
-
/* Layout of Data Type. */
/* Set the sizes of the core types. */
#define INT_TYPE_SIZE 32
diff --git a/gcc/config/score/score3.c b/gcc/config/score/score3.c
index 3114bcd1c55..c976f38c005 100644
--- a/gcc/config/score/score3.c
+++ b/gcc/config/score/score3.c
@@ -323,7 +323,7 @@ score3_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
HOST_WIDE_INT delta, HOST_WIDE_INT vcall_offset,
tree function)
{
- rtx this, temp1, insn, fnaddr;
+ rtx this_rtx, temp1, insn, fnaddr;
/* Pretend to be a post-reload pass while generating rtl. */
reload_completed = 1;
@@ -336,11 +336,11 @@ score3_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
/* Find out which register contains the "this" pointer. */
if (aggregate_value_p (TREE_TYPE (TREE_TYPE (function)), function))
- this = gen_rtx_REG (Pmode, ARG_REG_FIRST + 1);
+ this_rtx = gen_rtx_REG (Pmode, ARG_REG_FIRST + 1);
else
- this = gen_rtx_REG (Pmode, ARG_REG_FIRST);
+ this_rtx = gen_rtx_REG (Pmode, ARG_REG_FIRST);
- /* Add DELTA to THIS. */
+ /* Add DELTA to THIS_RTX. */
if (delta != 0)
{
rtx offset = GEN_INT (delta);
@@ -349,23 +349,23 @@ score3_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
emit_move_insn (temp1, offset);
offset = temp1;
}
- emit_insn (gen_add3_insn (this, this, offset));
+ emit_insn (gen_add3_insn (this_rtx, this_rtx, offset));
}
- /* If needed, add *(*THIS + VCALL_OFFSET) to THIS. */
+ /* If needed, add *(*THIS_RTX + VCALL_OFFSET) to THIS_RTX. */
if (vcall_offset != 0)
{
rtx addr;
- /* Set TEMP1 to *THIS. */
- emit_move_insn (temp1, gen_rtx_MEM (Pmode, this));
+ /* Set TEMP1 to *THIS_RTX. */
+ emit_move_insn (temp1, gen_rtx_MEM (Pmode, this_rtx));
- /* Set ADDR to a legitimate address for *THIS + VCALL_OFFSET. */
+ /* Set ADDR to a legitimate address for *THIS_RTX + VCALL_OFFSET. */
addr = score3_add_offset (temp1, vcall_offset);
- /* Load the offset and add it to THIS. */
+ /* Load the offset and add it to THIS_RTX. */
emit_move_insn (temp1, gen_rtx_MEM (Pmode, addr));
- emit_insn (gen_add3_insn (this, this, temp1));
+ emit_insn (gen_add3_insn (this_rtx, this_rtx, temp1));
}
/* Jump to the target function. */
@@ -691,19 +691,19 @@ score3_reg_class (int regno)
/* Implement PREFERRED_RELOAD_CLASS macro. */
enum reg_class
-score3_preferred_reload_class (rtx x ATTRIBUTE_UNUSED, enum reg_class class)
+score3_preferred_reload_class (rtx x ATTRIBUTE_UNUSED, enum reg_class rclass)
{
- if (reg_class_subset_p (G16_REGS, class))
+ if (reg_class_subset_p (G16_REGS, rclass))
return G16_REGS;
- if (reg_class_subset_p (G32_REGS, class))
+ if (reg_class_subset_p (G32_REGS, rclass))
return G32_REGS;
- return class;
+ return rclass;
}
/* Implement SECONDARY_INPUT_RELOAD_CLASS
and SECONDARY_OUTPUT_RELOAD_CLASS macro. */
enum reg_class
-score3_secondary_reload_class (enum reg_class class,
+score3_secondary_reload_class (enum reg_class rclass,
enum machine_mode mode ATTRIBUTE_UNUSED,
rtx x)
{
@@ -711,7 +711,7 @@ score3_secondary_reload_class (enum reg_class class,
if (GET_CODE (x) == REG || GET_CODE(x) == SUBREG)
regno = true_regnum (x);
- if (!GR_REG_CLASS_P (class))
+ if (!GR_REG_CLASS_P (rclass))
return GP_REG_P (regno) ? NO_REGS : G32_REGS;
return NO_REGS;
}
@@ -768,21 +768,21 @@ int
score3_hard_regno_mode_ok (unsigned int regno, enum machine_mode mode)
{
int size = GET_MODE_SIZE (mode);
- enum mode_class class = GET_MODE_CLASS (mode);
+ enum mode_class mclass = GET_MODE_CLASS (mode);
- if (class == MODE_CC)
+ if (mclass == MODE_CC)
return regno == CC_REGNUM;
else if (regno == FRAME_POINTER_REGNUM
|| regno == ARG_POINTER_REGNUM)
- return class == MODE_INT;
+ return mclass == MODE_INT;
else if (GP_REG_P (regno))
return !(regno & 1) || (size <= UNITS_PER_WORD);
else if (CE_REG_P (regno))
- return (class == MODE_INT
+ return (mclass == MODE_INT
&& ((size <= UNITS_PER_WORD)
|| (regno == CE_REG_FIRST && size == 2 * UNITS_PER_WORD)));
else
- return (class == MODE_INT) && (size <= UNITS_PER_WORD);
+ return (mclass == MODE_INT) && (size <= UNITS_PER_WORD);
}
/* Implement INITIAL_ELIMINATION_OFFSET. FROM is either the frame
diff --git a/gcc/config/score/score3.h b/gcc/config/score/score3.h
index 098da9500d2..79677702d47 100644
--- a/gcc/config/score/score3.h
+++ b/gcc/config/score/score3.h
@@ -93,9 +93,9 @@ extern void score3_asm_file_end (void);
extern void score3_override_options (void);
extern int score3_reg_class (int regno);
extern enum reg_class score3_preferred_reload_class (rtx x ATTRIBUTE_UNUSED,
- enum reg_class class);
+ enum reg_class rclass);
extern enum reg_class
-score3_secondary_reload_class (enum reg_class class,
+score3_secondary_reload_class (enum reg_class rclass,
enum machine_mode mode ATTRIBUTE_UNUSED,
rtx x);
extern int score3_const_ok_for_letter_p (HOST_WIDE_INT value, char c);
diff --git a/gcc/config/score/score7.c b/gcc/config/score/score7.c
index 74031c2c6ae..03c47042ed5 100644
--- a/gcc/config/score/score7.c
+++ b/gcc/config/score/score7.c
@@ -322,7 +322,7 @@ score7_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
HOST_WIDE_INT delta, HOST_WIDE_INT vcall_offset,
tree function)
{
- rtx this, temp1, insn, fnaddr;
+ rtx this_rtx, temp1, insn, fnaddr;
/* Pretend to be a post-reload pass while generating rtl. */
reload_completed = 1;
@@ -335,11 +335,11 @@ score7_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
/* Find out which register contains the "this" pointer. */
if (aggregate_value_p (TREE_TYPE (TREE_TYPE (function)), function))
- this = gen_rtx_REG (Pmode, ARG_REG_FIRST + 1);
+ this_rtx = gen_rtx_REG (Pmode, ARG_REG_FIRST + 1);
else
- this = gen_rtx_REG (Pmode, ARG_REG_FIRST);
+ this_rtx = gen_rtx_REG (Pmode, ARG_REG_FIRST);
- /* Add DELTA to THIS. */
+ /* Add DELTA to THIS_RTX. */
if (delta != 0)
{
rtx offset = GEN_INT (delta);
@@ -348,23 +348,23 @@ score7_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
emit_move_insn (temp1, offset);
offset = temp1;
}
- emit_insn (gen_add3_insn (this, this, offset));
+ emit_insn (gen_add3_insn (this_rtx, this_rtx, offset));
}
- /* If needed, add *(*THIS + VCALL_OFFSET) to THIS. */
+ /* If needed, add *(*THIS_RTX + VCALL_OFFSET) to THIS_RTX. */
if (vcall_offset != 0)
{
rtx addr;
- /* Set TEMP1 to *THIS. */
- emit_move_insn (temp1, gen_rtx_MEM (Pmode, this));
+ /* Set TEMP1 to *THIS_RTX. */
+ emit_move_insn (temp1, gen_rtx_MEM (Pmode, this_rtx));
- /* Set ADDR to a legitimate address for *THIS + VCALL_OFFSET. */
+ /* Set ADDR to a legitimate address for *THIS_RTX + VCALL_OFFSET. */
addr = score7_add_offset (temp1, vcall_offset);
- /* Load the offset and add it to THIS. */
+ /* Load the offset and add it to THIS_RTX. */
emit_move_insn (temp1, gen_rtx_MEM (Pmode, addr));
- emit_insn (gen_add3_insn (this, this, temp1));
+ emit_insn (gen_add3_insn (this_rtx, this_rtx, temp1));
}
/* Jump to the target function. */
@@ -690,19 +690,19 @@ score7_reg_class (int regno)
/* Implement PREFERRED_RELOAD_CLASS macro. */
enum reg_class
-score7_preferred_reload_class (rtx x ATTRIBUTE_UNUSED, enum reg_class class)
+score7_preferred_reload_class (rtx x ATTRIBUTE_UNUSED, enum reg_class rclass)
{
- if (reg_class_subset_p (G16_REGS, class))
+ if (reg_class_subset_p (G16_REGS, rclass))
return G16_REGS;
- if (reg_class_subset_p (G32_REGS, class))
+ if (reg_class_subset_p (G32_REGS, rclass))
return G32_REGS;
- return class;
+ return rclass;
}
/* Implement SECONDARY_INPUT_RELOAD_CLASS
and SECONDARY_OUTPUT_RELOAD_CLASS macro. */
enum reg_class
-score7_secondary_reload_class (enum reg_class class,
+score7_secondary_reload_class (enum reg_class rclass,
enum machine_mode mode ATTRIBUTE_UNUSED,
rtx x)
{
@@ -710,7 +710,7 @@ score7_secondary_reload_class (enum reg_class class,
if (GET_CODE (x) == REG || GET_CODE(x) == SUBREG)
regno = true_regnum (x);
- if (!GR_REG_CLASS_P (class))
+ if (!GR_REG_CLASS_P (rclass))
return GP_REG_P (regno) ? NO_REGS : G32_REGS;
return NO_REGS;
}
@@ -758,22 +758,22 @@ int
score7_hard_regno_mode_ok (unsigned int regno, enum machine_mode mode)
{
int size = GET_MODE_SIZE (mode);
- enum mode_class class = GET_MODE_CLASS (mode);
+ enum mode_class mclass = GET_MODE_CLASS (mode);
- if (class == MODE_CC)
+ if (mclass == MODE_CC)
return regno == CC_REGNUM;
else if (regno == FRAME_POINTER_REGNUM
|| regno == ARG_POINTER_REGNUM)
- return class == MODE_INT;
+ return mclass == MODE_INT;
else if (GP_REG_P (regno))
/* ((regno <= (GP_REG_LAST- HARD_REGNO_NREGS (dummy, mode)) + 1) */
return !(regno & 1) || (size <= UNITS_PER_WORD);
else if (CE_REG_P (regno))
- return (class == MODE_INT
+ return (mclass == MODE_INT
&& ((size <= UNITS_PER_WORD)
|| (regno == CE_REG_FIRST && size == 2 * UNITS_PER_WORD)));
else
- return (class == MODE_INT) && (size <= UNITS_PER_WORD);
+ return (mclass == MODE_INT) && (size <= UNITS_PER_WORD);
}
/* Implement INITIAL_ELIMINATION_OFFSET. FROM is either the frame
diff --git a/gcc/config/score/score7.h b/gcc/config/score/score7.h
index 900aa6f4924..1797e472279 100644
--- a/gcc/config/score/score7.h
+++ b/gcc/config/score/score7.h
@@ -93,9 +93,9 @@ extern void score7_asm_file_end (void);
extern void score7_override_options (void);
extern int score7_reg_class (int regno);
extern enum reg_class score7_preferred_reload_class (rtx x ATTRIBUTE_UNUSED,
- enum reg_class class);
+ enum reg_class rclass);
extern enum
-reg_class score7_secondary_reload_class (enum reg_class class,
+reg_class score7_secondary_reload_class (enum reg_class rclass,
enum machine_mode mode ATTRIBUTE_UNUSED,
rtx x);
extern int score7_const_ok_for_letter_p (HOST_WIDE_INT value, char c);
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index e311362de6c..74060738ee9 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -51,7 +51,7 @@ along with GCC; see the file COPYING3. If not see
#include "intl.h"
#include "sched-int.h"
#include "ggc.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "cfgloop.h"
#include "alloc-pool.h"
#include "tm-constrs.h"
@@ -260,9 +260,8 @@ static void sh_setup_incoming_varargs (CUMULATIVE_ARGS *, enum machine_mode, tre
static bool sh_strict_argument_naming (CUMULATIVE_ARGS *);
static bool sh_pretend_outgoing_varargs_named (CUMULATIVE_ARGS *);
static tree sh_build_builtin_va_list (void);
-static tree sh_canonical_va_list_type (tree);
static void sh_va_start (tree, rtx);
-static tree sh_gimplify_va_arg_expr (tree, tree, tree *, tree *);
+static tree sh_gimplify_va_arg_expr (tree, tree, gimple_seq *, gimple_seq *);
static bool sh_pass_by_reference (CUMULATIVE_ARGS *, enum machine_mode,
const_tree, bool);
static bool sh_callee_copies (CUMULATIVE_ARGS *, enum machine_mode,
@@ -442,8 +441,6 @@ static int sh2a_function_vector_p (tree);
#undef TARGET_BUILD_BUILTIN_VA_LIST
#define TARGET_BUILD_BUILTIN_VA_LIST sh_build_builtin_va_list
-#undef TARGET_CANONICAL_VA_LIST_TYPE
-#define TARGET_CANONICAL_VA_LIST_TYPE sh_canonical_va_list_type
#undef TARGET_EXPAND_BUILTIN_VA_START
#define TARGET_EXPAND_BUILTIN_VA_START sh_va_start
#undef TARGET_GIMPLIFY_VA_ARG_EXPR
@@ -1303,9 +1300,9 @@ prepare_move_operands (rtx operands[], enum machine_mode mode)
{
/* This is like change_address_1 (operands[0], mode, 0, 1) ,
except that we can't use that function because it is static. */
- rtx new = change_address (operands[0], mode, 0);
- MEM_COPY_ATTRIBUTES (new, operands[0]);
- operands[0] = new;
+ rtx new_rtx = change_address (operands[0], mode, 0);
+ MEM_COPY_ATTRIBUTES (new_rtx, operands[0]);
+ operands[0] = new_rtx;
}
/* This case can happen while generating code to move the result
@@ -1918,14 +1915,14 @@ print_slot (rtx insn)
const char *
output_far_jump (rtx insn, rtx op)
{
- struct { rtx lab, reg, op; } this;
+ struct { rtx lab, reg, op; } this_jmp;
rtx braf_base_lab = NULL_RTX;
const char *jump;
int far;
int offset = branch_dest (insn) - INSN_ADDRESSES (INSN_UID (insn));
rtx prev;
- this.lab = gen_label_rtx ();
+ this_jmp.lab = gen_label_rtx ();
if (TARGET_SH2
&& offset >= -32764
@@ -1951,10 +1948,10 @@ output_far_jump (rtx insn, rtx op)
if (GET_CODE ((prev = prev_nonnote_insn (insn))) == INSN
&& INSN_CODE (prev) == CODE_FOR_indirect_jump_scratch)
{
- this.reg = SET_DEST (XVECEXP (PATTERN (prev), 0, 0));
- if (REGNO (this.reg) == R0_REG && flag_pic && ! TARGET_SH2)
+ this_jmp.reg = SET_DEST (XVECEXP (PATTERN (prev), 0, 0));
+ if (REGNO (this_jmp.reg) == R0_REG && flag_pic && ! TARGET_SH2)
jump = "mov.l r1,@-r15; mova %O0,r0; mov.l @r0,r1; add r1,r0; mov.l @r15+,r1; jmp @%1";
- output_asm_insn (jump, &this.lab);
+ output_asm_insn (jump, &this_jmp.lab);
if (dbr_sequence_length ())
print_slot (final_sequence);
else
@@ -1966,7 +1963,7 @@ output_far_jump (rtx insn, rtx op)
if (dbr_sequence_length ())
print_slot (final_sequence);
- this.reg = gen_rtx_REG (SImode, 13);
+ this_jmp.reg = gen_rtx_REG (SImode, 13);
/* We must keep the stack aligned to 8-byte boundaries on SH5.
Fortunately, MACL is fixed and call-clobbered, and we never
need its value across jumps, so save r13 in it instead of in
@@ -1975,7 +1972,7 @@ output_far_jump (rtx insn, rtx op)
output_asm_insn ("lds r13, macl", 0);
else
output_asm_insn ("mov.l r13,@-r15", 0);
- output_asm_insn (jump, &this.lab);
+ output_asm_insn (jump, &this_jmp.lab);
if (TARGET_SH5)
output_asm_insn ("sts macl, r13", 0);
else
@@ -1989,16 +1986,16 @@ output_far_jump (rtx insn, rtx op)
}
if (far)
output_asm_insn (".align 2", 0);
- (*targetm.asm_out.internal_label) (asm_out_file, "L", CODE_LABEL_NUMBER (this.lab));
- this.op = op;
+ (*targetm.asm_out.internal_label) (asm_out_file, "L", CODE_LABEL_NUMBER (this_jmp.lab));
+ this_jmp.op = op;
if (far && flag_pic)
{
if (TARGET_SH2)
- this.lab = braf_base_lab;
- output_asm_insn (".long %O2-%O0", &this.lab);
+ this_jmp.lab = braf_base_lab;
+ output_asm_insn (".long %O2-%O0", &this_jmp.lab);
}
else
- output_asm_insn (far ? ".long %O2" : ".word %O2-%O0", &this.lab);
+ output_asm_insn (far ? ".long %O2" : ".word %O2-%O0", &this_jmp.lab);
return "";
}
@@ -2095,14 +2092,14 @@ output_branch (int logic, rtx insn, rtx *operands)
}
}
-/* Output a code sequence for INSN using TEMPLATE with OPERANDS; but before,
+/* Output a code sequence for INSN using TEMPL with OPERANDS; but before,
fill in operands 9 as a label to the successor insn.
We try to use jump threading where possible.
IF CODE matches the comparison in the IF_THEN_ELSE of a following jump,
we assume the jump is taken. I.e. EQ means follow jmp and bf, NE means
follow jmp and bt, if the address is in range. */
const char *
-output_branchy_insn (enum rtx_code code, const char *template,
+output_branchy_insn (enum rtx_code code, const char *templ,
rtx insn, rtx *operands)
{
rtx next_insn = NEXT_INSN (insn);
@@ -2118,7 +2115,7 @@ output_branchy_insn (enum rtx_code code, const char *template,
INSN_ADDRESSES_NEW (operands[9],
INSN_ADDRESSES (INSN_UID (next_insn))
+ get_attr_length (next_insn));
- return template;
+ return templ;
}
else
{
@@ -2130,7 +2127,7 @@ output_branchy_insn (enum rtx_code code, const char *template,
/* branch_true */
src = XEXP (src, 1);
operands[9] = src;
- return template;
+ return templ;
}
}
}
@@ -2139,7 +2136,7 @@ output_branchy_insn (enum rtx_code code, const char *template,
INSN_ADDRESSES_NEW (operands[9],
INSN_ADDRESSES (INSN_UID (insn))
+ get_attr_length (insn));
- return template;
+ return templ;
}
const char *
@@ -3486,7 +3483,7 @@ static rtx
add_constant (rtx x, enum machine_mode mode, rtx last_value)
{
int i;
- rtx lab, new;
+ rtx lab, new_rtx;
label_ref_list_t ref, newref;
/* First see if we've already got it. */
@@ -3502,14 +3499,14 @@ add_constant (rtx x, enum machine_mode mode, rtx last_value)
}
if (rtx_equal_p (x, pool_vector[i].value))
{
- lab = new = 0;
+ lab = new_rtx = 0;
if (! last_value
|| ! i
|| ! rtx_equal_p (last_value, pool_vector[i-1].value))
{
- new = gen_label_rtx ();
- LABEL_REFS (new) = pool_vector[i].label;
- pool_vector[i].label = lab = new;
+ new_rtx = gen_label_rtx ();
+ LABEL_REFS (new_rtx) = pool_vector[i].label;
+ pool_vector[i].label = lab = new_rtx;
}
if (lab && pool_window_label)
{
@@ -3519,8 +3516,8 @@ add_constant (rtx x, enum machine_mode mode, rtx last_value)
newref->next = ref;
pool_vector[pool_window_last].wend = newref;
}
- if (new)
- pool_window_label = new;
+ if (new_rtx)
+ pool_window_label = new_rtx;
pool_window_last = i;
return lab;
}
@@ -4424,7 +4421,7 @@ gen_block_redirect (rtx jump, int addr, int need_block)
rtx scan;
/* Don't look for the stack pointer as a scratch register,
it would cause trouble if an interrupt occurred. */
- unsigned try = 0x7fff, used;
+ unsigned attempt = 0x7fff, used;
int jump_left = flag_expensive_optimizations + 1;
/* It is likely that the most recent eligible instruction is wanted for
@@ -4445,7 +4442,7 @@ gen_block_redirect (rtx jump, int addr, int need_block)
&& GET_CODE (PATTERN (scan)) != CLOBBER
&& get_attr_in_delay_slot (scan) == IN_DELAY_SLOT_YES)
{
- try &= ~regs_used (PATTERN (scan), 0);
+ attempt &= ~regs_used (PATTERN (scan), 0);
break;
}
}
@@ -4463,9 +4460,9 @@ gen_block_redirect (rtx jump, int addr, int need_block)
if (code == CALL_INSN)
used |= regs_used (CALL_INSN_FUNCTION_USAGE (scan), 0);
dead |= (used >> 16) & ~used;
- if (dead & try)
+ if (dead & attempt)
{
- dead &= try;
+ dead &= attempt;
break;
}
if (code == JUMP_INSN)
@@ -7148,14 +7145,6 @@ sh_build_builtin_va_list (void)
return record;
}
-/* Return always va_list_type_node. */
-
-static tree
-sh_canonical_va_list_type (tree type ATTRIBUTE_UNUSED)
-{
- return va_list_type_node;
-}
-
/* Implement `va_start' for varargs and stdarg. */
static void
@@ -7200,7 +7189,7 @@ sh_va_start (tree valist, rtx nextarg)
/* Call __builtin_saveregs. */
u = make_tree (sizetype, expand_builtin_saveregs ());
u = fold_convert (ptr_type_node, u);
- t = build2 (GIMPLE_MODIFY_STMT, ptr_type_node, next_fp, u);
+ t = build2 (MODIFY_EXPR, ptr_type_node, next_fp, u);
TREE_SIDE_EFFECTS (t) = 1;
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
@@ -7211,11 +7200,11 @@ sh_va_start (tree valist, rtx nextarg)
nfp = 0;
u = fold_build2 (POINTER_PLUS_EXPR, ptr_type_node, u,
size_int (UNITS_PER_WORD * nfp));
- t = build2 (GIMPLE_MODIFY_STMT, ptr_type_node, next_fp_limit, u);
+ t = build2 (MODIFY_EXPR, ptr_type_node, next_fp_limit, u);
TREE_SIDE_EFFECTS (t) = 1;
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
- t = build2 (GIMPLE_MODIFY_STMT, ptr_type_node, next_o, u);
+ t = build2 (MODIFY_EXPR, ptr_type_node, next_o, u);
TREE_SIDE_EFFECTS (t) = 1;
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
@@ -7226,12 +7215,12 @@ sh_va_start (tree valist, rtx nextarg)
nint = 0;
u = fold_build2 (POINTER_PLUS_EXPR, ptr_type_node, u,
size_int (UNITS_PER_WORD * nint));
- t = build2 (GIMPLE_MODIFY_STMT, ptr_type_node, next_o_limit, u);
+ t = build2 (MODIFY_EXPR, ptr_type_node, next_o_limit, u);
TREE_SIDE_EFFECTS (t) = 1;
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
u = make_tree (ptr_type_node, nextarg);
- t = build2 (GIMPLE_MODIFY_STMT, ptr_type_node, next_stack, u);
+ t = build2 (MODIFY_EXPR, ptr_type_node, next_stack, u);
TREE_SIDE_EFFECTS (t) = 1;
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
}
@@ -7260,8 +7249,8 @@ find_sole_member (tree type)
/* Implement `va_arg'. */
static tree
-sh_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p,
- tree *post_p ATTRIBUTE_UNUSED)
+sh_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p,
+ gimple_seq *post_p ATTRIBUTE_UNUSED)
{
HOST_WIDE_INT size, rsize;
tree tmp, pptr_type_node;
@@ -7350,20 +7339,19 @@ sh_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p,
tree cmp;
bool is_double = size == 8 && TREE_CODE (eff_type) == REAL_TYPE;
- tmp = build1 (ADDR_EXPR, pptr_type_node, next_fp);
- tmp = build2 (GIMPLE_MODIFY_STMT, void_type_node, addr, tmp);
- gimplify_and_add (tmp, pre_p);
+ tmp = build1 (ADDR_EXPR, pptr_type_node, unshare_expr (next_fp));
+ gimplify_assign (unshare_expr (addr), tmp, pre_p);
- tmp = build2 (GIMPLE_MODIFY_STMT, ptr_type_node, next_fp_tmp, valist);
- gimplify_and_add (tmp, pre_p);
+ gimplify_assign (unshare_expr (next_fp_tmp), valist, pre_p);
tmp = next_fp_limit;
if (size > 4 && !is_double)
- tmp = build2 (POINTER_PLUS_EXPR, TREE_TYPE (tmp), tmp,
- size_int (4 - size));
- tmp = build2 (GE_EXPR, boolean_type_node, next_fp_tmp, tmp);
+ tmp = build2 (POINTER_PLUS_EXPR, TREE_TYPE (tmp),
+ unshare_expr (tmp), size_int (4 - size));
+ tmp = build2 (GE_EXPR, boolean_type_node,
+ unshare_expr (next_fp_tmp), unshare_expr (tmp));
cmp = build3 (COND_EXPR, void_type_node, tmp,
- build1 (GOTO_EXPR, void_type_node, lab_false),
- NULL_TREE);
+ build1 (GOTO_EXPR, void_type_node,
+ unshare_expr (lab_false)), NULL_TREE);
if (!is_double)
gimplify_and_add (cmp, pre_p);
@@ -7374,10 +7362,8 @@ sh_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p,
tmp = build2 (BIT_AND_EXPR, sizetype, tmp,
size_int (UNITS_PER_WORD));
tmp = build2 (POINTER_PLUS_EXPR, ptr_type_node,
- next_fp_tmp, tmp);
- tmp = build2 (GIMPLE_MODIFY_STMT, ptr_type_node,
- next_fp_tmp, tmp);
- gimplify_and_add (tmp, pre_p);
+ unshare_expr (next_fp_tmp), tmp);
+ gimplify_assign (unshare_expr (next_fp_tmp), tmp, pre_p);
}
if (is_double)
gimplify_and_add (cmp, pre_p);
@@ -7402,57 +7388,53 @@ sh_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p,
}
#endif /* FUNCTION_ARG_SCmode_WART */
- tmp = build1 (GOTO_EXPR, void_type_node, lab_over);
+ tmp = build1 (GOTO_EXPR, void_type_node, unshare_expr (lab_over));
gimplify_and_add (tmp, pre_p);
- tmp = build1 (LABEL_EXPR, void_type_node, lab_false);
+ tmp = build1 (LABEL_EXPR, void_type_node, unshare_expr (lab_false));
gimplify_and_add (tmp, pre_p);
- tmp = build1 (ADDR_EXPR, pptr_type_node, next_stack);
- tmp = build2 (GIMPLE_MODIFY_STMT, void_type_node, addr, tmp);
- gimplify_and_add (tmp, pre_p);
- tmp = build2 (GIMPLE_MODIFY_STMT, ptr_type_node, next_fp_tmp, valist);
- gimplify_and_add (tmp, pre_p);
+ tmp = build1 (ADDR_EXPR, pptr_type_node, unshare_expr (next_stack));
+ gimplify_assign (unshare_expr (addr), tmp, pre_p);
+ gimplify_assign (unshare_expr (next_fp_tmp),
+ unshare_expr (valist), pre_p);
- tmp = build2 (GIMPLE_MODIFY_STMT, ptr_type_node, valist, next_fp_tmp);
- gimplify_and_add (tmp, post_p);
+ gimplify_assign (unshare_expr (valist),
+ unshare_expr (next_fp_tmp), post_p);
valist = next_fp_tmp;
}
else
{
- tmp = build2 (POINTER_PLUS_EXPR, ptr_type_node, next_o,
- size_int (rsize));
- tmp = build2 (GT_EXPR, boolean_type_node, tmp, next_o_limit);
+ tmp = build2 (POINTER_PLUS_EXPR, ptr_type_node,
+ unshare_expr (next_o), size_int (rsize));
+ tmp = build2 (GT_EXPR, boolean_type_node, tmp,
+ unshare_expr (next_o_limit));
tmp = build3 (COND_EXPR, void_type_node, tmp,
- build1 (GOTO_EXPR, void_type_node, lab_false),
- NULL_TREE);
+ build1 (GOTO_EXPR, void_type_node,
+ unshare_expr (lab_false)),
+ NULL_TREE);
gimplify_and_add (tmp, pre_p);
- tmp = build1 (ADDR_EXPR, pptr_type_node, next_o);
- tmp = build2 (GIMPLE_MODIFY_STMT, void_type_node, addr, tmp);
- gimplify_and_add (tmp, pre_p);
+ tmp = build1 (ADDR_EXPR, pptr_type_node, unshare_expr (next_o));
+ gimplify_assign (unshare_expr (addr), tmp, pre_p);
- tmp = build1 (GOTO_EXPR, void_type_node, lab_over);
+ tmp = build1 (GOTO_EXPR, void_type_node, unshare_expr (lab_over));
gimplify_and_add (tmp, pre_p);
- tmp = build1 (LABEL_EXPR, void_type_node, lab_false);
+ tmp = build1 (LABEL_EXPR, void_type_node, unshare_expr (lab_false));
gimplify_and_add (tmp, pre_p);
if (size > 4 && ! (TARGET_SH4 || TARGET_SH2A))
- {
- tmp = build2 (GIMPLE_MODIFY_STMT, ptr_type_node,
- next_o, next_o_limit);
- gimplify_and_add (tmp, pre_p);
- }
+ gimplify_assign (unshare_expr (next_o),
+ unshare_expr (next_o_limit), pre_p);
- tmp = build1 (ADDR_EXPR, pptr_type_node, next_stack);
- tmp = build2 (GIMPLE_MODIFY_STMT, void_type_node, addr, tmp);
- gimplify_and_add (tmp, pre_p);
+ tmp = build1 (ADDR_EXPR, pptr_type_node, unshare_expr (next_stack));
+ gimplify_assign (unshare_expr (addr), tmp, pre_p);
}
if (!result)
{
- tmp = build1 (LABEL_EXPR, void_type_node, lab_over);
+ tmp = build1 (LABEL_EXPR, void_type_node, unshare_expr (lab_over));
gimplify_and_add (tmp, pre_p);
}
}
@@ -7463,10 +7445,9 @@ sh_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p,
tmp = std_gimplify_va_arg_expr (valist, type, pre_p, NULL);
if (result)
{
- tmp = build2 (GIMPLE_MODIFY_STMT, void_type_node, result, tmp);
- gimplify_and_add (tmp, pre_p);
+ gimplify_assign (result, tmp, pre_p);
- tmp = build1 (LABEL_EXPR, void_type_node, lab_over);
+ tmp = build1 (LABEL_EXPR, void_type_node, unshare_expr (lab_over));
gimplify_and_add (tmp, pre_p);
}
else
@@ -8794,14 +8775,14 @@ sh_insn_length_adjustment (rtx insn)
{
int sum = 0;
rtx body = PATTERN (insn);
- const char *template;
+ const char *templ;
char c;
int maybe_label = 1;
if (GET_CODE (body) == ASM_INPUT)
- template = XSTR (body, 0);
+ templ = XSTR (body, 0);
else if (asm_noperands (body) >= 0)
- template
+ templ
= decode_asm_operands (body, NULL, NULL, NULL, NULL, NULL);
else
return 0;
@@ -8810,20 +8791,20 @@ sh_insn_length_adjustment (rtx insn)
int ppi_adjust = 0;
do
- c = *template++;
+ c = *templ++;
while (c == ' ' || c == '\t');
/* all sh-dsp parallel-processing insns start with p.
The only non-ppi sh insn starting with p is pref.
The only ppi starting with pr is prnd. */
- if ((c == 'p' || c == 'P') && strncasecmp ("re", template, 2))
+ if ((c == 'p' || c == 'P') && strncasecmp ("re", templ, 2))
ppi_adjust = 2;
/* The repeat pseudo-insn expands two three insns, a total of
six bytes in size. */
else if ((c == 'r' || c == 'R')
- && ! strncasecmp ("epeat", template, 5))
+ && ! strncasecmp ("epeat", templ, 5))
ppi_adjust = 4;
while (c && c != '\n'
- && ! IS_ASM_LOGICAL_LINE_SEPARATOR (c, template))
+ && ! IS_ASM_LOGICAL_LINE_SEPARATOR (c, templ))
{
/* If this is a label, it is obviously not a ppi insn. */
if (c == ':' && maybe_label)
@@ -8833,7 +8814,7 @@ sh_insn_length_adjustment (rtx insn)
}
else if (c == '\'' || c == '"')
maybe_label = 0;
- c = *template++;
+ c = *templ++;
}
sum += ppi_adjust;
maybe_label = c != ':';
@@ -10253,24 +10234,24 @@ sh_expand_binop_v2sf (enum rtx_code code, rtx op0, rtx op1, rtx op2)
is invalid. */
bool
sh_cannot_change_mode_class (enum machine_mode from, enum machine_mode to,
- enum reg_class class)
+ enum reg_class rclass)
{
/* We want to enable the use of SUBREGs as a means to
VEC_SELECT a single element of a vector. */
if (to == SFmode && VECTOR_MODE_P (from) && GET_MODE_INNER (from) == SFmode)
- return (reg_classes_intersect_p (GENERAL_REGS, class));
+ return (reg_classes_intersect_p (GENERAL_REGS, rclass));
if (GET_MODE_SIZE (from) != GET_MODE_SIZE (to))
{
if (TARGET_LITTLE_ENDIAN)
{
if (GET_MODE_SIZE (to) < 8 || GET_MODE_SIZE (from) < 8)
- return reg_classes_intersect_p (DF_REGS, class);
+ return reg_classes_intersect_p (DF_REGS, rclass);
}
else
{
if (GET_MODE_SIZE (from) < 8)
- return reg_classes_intersect_p (DF_HI_REGS, class);
+ return reg_classes_intersect_p (DF_HI_REGS, rclass);
}
}
return 0;
@@ -10390,7 +10371,7 @@ sh_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
{
CUMULATIVE_ARGS cum;
int structure_value_byref = 0;
- rtx this, this_value, sibcall, insns, funexp;
+ rtx this_rtx, this_value, sibcall, insns, funexp;
tree funtype = TREE_TYPE (function);
int simple_add = CONST_OK_FOR_ADD (delta);
int did_load = 0;
@@ -10418,7 +10399,7 @@ sh_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
FUNCTION_ARG_ADVANCE (cum, Pmode, ptype, 1);
}
- this = FUNCTION_ARG (cum, Pmode, ptr_type_node, 1);
+ this_rtx = FUNCTION_ARG (cum, Pmode, ptr_type_node, 1);
/* For SHcompact, we only have r0 for a scratch register: r1 is the
static chain pointer (even if you can't have nested virtual functions
@@ -10459,7 +10440,7 @@ sh_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
error ("Need a call-clobbered target register");
}
- this_value = plus_constant (this, delta);
+ this_value = plus_constant (this_rtx, delta);
if (vcall_offset
&& (simple_add || scratch0 != scratch1)
&& strict_memory_address_p (ptr_mode, this_value))
@@ -10471,11 +10452,11 @@ sh_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
if (!delta)
; /* Do nothing. */
else if (simple_add)
- emit_move_insn (this, this_value);
+ emit_move_insn (this_rtx, this_value);
else
{
emit_move_insn (scratch1, GEN_INT (delta));
- emit_insn (gen_add2_insn (this, scratch1));
+ emit_insn (gen_add2_insn (this_rtx, scratch1));
}
if (vcall_offset)
@@ -10483,7 +10464,7 @@ sh_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
rtx offset_addr;
if (!did_load)
- emit_load_ptr (scratch0, this);
+ emit_load_ptr (scratch0, this_rtx);
offset_addr = plus_constant (scratch0, vcall_offset);
if (strict_memory_address_p (ptr_mode, offset_addr))
@@ -10493,7 +10474,7 @@ sh_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
/* scratch0 != scratch1, and we have indexed loads. Get better
schedule by loading the offset into r1 and using an indexed
load - then the load of r1 can issue before the load from
- (this + delta) finishes. */
+ (this_rtx + delta) finishes. */
emit_move_insn (scratch1, GEN_INT (vcall_offset));
offset_addr = gen_rtx_PLUS (Pmode, scratch0, scratch1);
}
@@ -10514,7 +10495,7 @@ sh_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
if (Pmode != ptr_mode)
scratch0 = gen_rtx_TRUNCATE (ptr_mode, scratch0);
- emit_insn (gen_add2_insn (this, scratch0));
+ emit_insn (gen_add2_insn (this_rtx, scratch0));
}
/* Generate a tail call to the target function. */
@@ -10549,7 +10530,7 @@ sh_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
}
sibcall = emit_call_insn (sibcall);
SIBLING_CALL_P (sibcall) = 1;
- use_reg (&CALL_INSN_FUNCTION_USAGE (sibcall), this);
+ use_reg (&CALL_INSN_FUNCTION_USAGE (sibcall), this_rtx);
emit_barrier ();
/* Run just enough of rest_of_compilation to do scheduling and get
@@ -10949,19 +10930,19 @@ replace_n_hard_rtx (rtx x, rtx *replacements, int n_replacements, int modify)
if (GET_CODE (x) == SUBREG)
{
- rtx new = replace_n_hard_rtx (SUBREG_REG (x), replacements,
+ rtx new_rtx = replace_n_hard_rtx (SUBREG_REG (x), replacements,
n_replacements, modify);
- if (GET_CODE (new) == CONST_INT)
+ if (GET_CODE (new_rtx) == CONST_INT)
{
- x = simplify_subreg (GET_MODE (x), new,
+ x = simplify_subreg (GET_MODE (x), new_rtx,
GET_MODE (SUBREG_REG (x)),
SUBREG_BYTE (x));
if (! x)
abort ();
}
else if (modify)
- SUBREG_REG (x) = new;
+ SUBREG_REG (x) = new_rtx;
return x;
}
@@ -11009,18 +10990,18 @@ replace_n_hard_rtx (rtx x, rtx *replacements, int n_replacements, int modify)
}
else if (GET_CODE (x) == ZERO_EXTEND)
{
- rtx new = replace_n_hard_rtx (XEXP (x, 0), replacements,
+ rtx new_rtx = replace_n_hard_rtx (XEXP (x, 0), replacements,
n_replacements, modify);
- if (GET_CODE (new) == CONST_INT)
+ if (GET_CODE (new_rtx) == CONST_INT)
{
x = simplify_unary_operation (ZERO_EXTEND, GET_MODE (x),
- new, GET_MODE (XEXP (x, 0)));
+ new_rtx, GET_MODE (XEXP (x, 0)));
if (! x)
abort ();
}
else if (modify)
- XEXP (x, 0) = new;
+ XEXP (x, 0) = new_rtx;
return x;
}
@@ -11028,26 +11009,26 @@ replace_n_hard_rtx (rtx x, rtx *replacements, int n_replacements, int modify)
fmt = GET_RTX_FORMAT (GET_CODE (x));
for (i = GET_RTX_LENGTH (GET_CODE (x)) - 1; i >= 0; i--)
{
- rtx new;
+ rtx new_rtx;
if (fmt[i] == 'e')
{
- new = replace_n_hard_rtx (XEXP (x, i), replacements,
+ new_rtx = replace_n_hard_rtx (XEXP (x, i), replacements,
n_replacements, modify);
- if (!new)
+ if (!new_rtx)
return NULL_RTX;
if (modify)
- XEXP (x, i) = new;
+ XEXP (x, i) = new_rtx;
}
else if (fmt[i] == 'E')
for (j = XVECLEN (x, i) - 1; j >= 0; j--)
{
- new = replace_n_hard_rtx (XVECEXP (x, i, j), replacements,
+ new_rtx = replace_n_hard_rtx (XVECEXP (x, i, j), replacements,
n_replacements, modify);
- if (!new)
+ if (!new_rtx)
return NULL_RTX;
if (modify)
- XVECEXP (x, i, j) = new;
+ XVECEXP (x, i, j) = new_rtx;
}
}
@@ -11181,12 +11162,12 @@ shmedia_prepare_call_address (rtx fnaddr, int is_sibcall)
}
enum reg_class
-sh_secondary_reload (bool in_p, rtx x, enum reg_class class,
+sh_secondary_reload (bool in_p, rtx x, enum reg_class rclass,
enum machine_mode mode, secondary_reload_info *sri)
{
if (in_p)
{
- if (REGCLASS_HAS_FP_REG (class)
+ if (REGCLASS_HAS_FP_REG (rclass)
&& ! TARGET_SHMEDIA
&& immediate_operand ((x), mode)
&& ! ((fp_zero_operand (x) || fp_one_operand (x))
@@ -11206,13 +11187,13 @@ sh_secondary_reload (bool in_p, rtx x, enum reg_class class,
default:
abort ();
}
- if (class == FPUL_REGS
+ if (rclass == FPUL_REGS
&& ((GET_CODE (x) == REG
&& (REGNO (x) == MACL_REG || REGNO (x) == MACH_REG
|| REGNO (x) == T_REG))
|| GET_CODE (x) == PLUS))
return GENERAL_REGS;
- if (class == FPUL_REGS && immediate_operand (x, mode))
+ if (rclass == FPUL_REGS && immediate_operand (x, mode))
{
if (satisfies_constraint_I08 (x) || fp_zero_operand (x))
return GENERAL_REGS;
@@ -11221,11 +11202,11 @@ sh_secondary_reload (bool in_p, rtx x, enum reg_class class,
sri->icode = CODE_FOR_reload_insi__i_fpul;
return NO_REGS;
}
- if (class == FPSCR_REGS
+ if (rclass == FPSCR_REGS
&& ((GET_CODE (x) == REG && REGNO (x) >= FIRST_PSEUDO_REGISTER)
|| (GET_CODE (x) == MEM && GET_CODE (XEXP (x, 0)) == PLUS)))
return GENERAL_REGS;
- if (REGCLASS_HAS_FP_REG (class)
+ if (REGCLASS_HAS_FP_REG (rclass)
&& TARGET_SHMEDIA
&& immediate_operand (x, mode)
&& x != CONST0_RTX (GET_MODE (x))
@@ -11238,24 +11219,24 @@ sh_secondary_reload (bool in_p, rtx x, enum reg_class class,
? CODE_FOR_reload_inqi : CODE_FOR_reload_inhi);
return NO_REGS;
}
- if (TARGET_SHMEDIA && class == GENERAL_REGS
+ if (TARGET_SHMEDIA && rclass == GENERAL_REGS
&& (GET_CODE (x) == LABEL_REF || PIC_DIRECT_ADDR_P (x)))
return TARGET_REGS;
} /* end of input-only processing. */
- if (((REGCLASS_HAS_FP_REG (class)
+ if (((REGCLASS_HAS_FP_REG (rclass)
&& (GET_CODE (x) == REG
&& (GENERAL_OR_AP_REGISTER_P (REGNO (x))
|| (FP_REGISTER_P (REGNO (x)) && mode == SImode
&& TARGET_FMOVD))))
- || (REGCLASS_HAS_GENERAL_REG (class)
+ || (REGCLASS_HAS_GENERAL_REG (rclass)
&& GET_CODE (x) == REG
&& FP_REGISTER_P (REGNO (x))))
&& ! TARGET_SHMEDIA
&& (mode == SFmode || mode == SImode))
return FPUL_REGS;
- if ((class == FPUL_REGS
- || (REGCLASS_HAS_FP_REG (class)
+ if ((rclass == FPUL_REGS
+ || (REGCLASS_HAS_FP_REG (rclass)
&& ! TARGET_SHMEDIA && mode == SImode))
&& (GET_CODE (x) == MEM
|| (GET_CODE (x) == REG
@@ -11263,20 +11244,20 @@ sh_secondary_reload (bool in_p, rtx x, enum reg_class class,
|| REGNO (x) == T_REG
|| system_reg_operand (x, VOIDmode)))))
{
- if (class == FPUL_REGS)
+ if (rclass == FPUL_REGS)
return GENERAL_REGS;
return FPUL_REGS;
}
- if ((class == TARGET_REGS
- || (TARGET_SHMEDIA && class == SIBCALL_REGS))
+ if ((rclass == TARGET_REGS
+ || (TARGET_SHMEDIA && rclass == SIBCALL_REGS))
&& !satisfies_constraint_Csy (x)
&& (GET_CODE (x) != REG || ! GENERAL_REGISTER_P (REGNO (x))))
return GENERAL_REGS;
- if ((class == MAC_REGS || class == PR_REGS)
+ if ((rclass == MAC_REGS || rclass == PR_REGS)
&& GET_CODE (x) == REG && ! GENERAL_REGISTER_P (REGNO (x))
- && class != REGNO_REG_CLASS (REGNO (x)))
+ && rclass != REGNO_REG_CLASS (REGNO (x)))
return GENERAL_REGS;
- if (class != GENERAL_REGS && GET_CODE (x) == REG
+ if (rclass != GENERAL_REGS && GET_CODE (x) == REG
&& TARGET_REGISTER_P (REGNO (x)))
return GENERAL_REGS;
return NO_REGS;
diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h
index f8b798d327c..2305872903d 100644
--- a/gcc/config/sh/sh.h
+++ b/gcc/config/sh/sh.h
@@ -463,7 +463,7 @@ do { \
do { \
if (LEVEL) \
{ \
- flag_omit_frame_pointer = -1; \
+ flag_omit_frame_pointer = 2; \
if (! SIZE) \
sh_div_str = "inv:minlat"; \
} \
@@ -690,7 +690,7 @@ do { \
if (! VALID_REGISTER_P (ADDREGNAMES_REGNO (regno))) \
sh_additional_register_names[regno][0] = '\0'; \
\
- if (flag_omit_frame_pointer < 0) \
+ if (flag_omit_frame_pointer == 2) \
{ \
/* The debugging information is sufficient, \
but gdb doesn't implement this yet */ \
@@ -2501,19 +2501,6 @@ struct sh_args {
goto LABEL; \
} \
} \
- /* FIXME: This is a temporary hack which should be removed. \
- When reload in progress, find_reloads_subreg_address tries to \
- make a new reload for some types of address. Unfortunately it \
- generates wrong code on SH. See PR36780. The following is to \
- avoid this issue. */ \
- if (!TARGET_SHMEDIA && reload_in_progress \
- && GET_CODE (X) == PLUS \
- && (GET_MODE_SIZE (MODE) == 4 || GET_MODE_SIZE (MODE) == 8) \
- && GET_CODE (XEXP ((X), 0)) == PLUS \
- && GET_CODE (XEXP (XEXP ((X), 0), 1)) == CONST_INT \
- && BASE_REGISTER_RTX_P (XEXP (XEXP ((X), 0), 0)) \
- && GET_CODE (XEXP ((X), 1)) == CONST_INT) \
- goto LABEL; \
}
/* Try machine-dependent ways of modifying an illegitimate address
diff --git a/gcc/config/sparc/linux64.h b/gcc/config/sparc/linux64.h
index 4c35dedacfb..4971048a31d 100644
--- a/gcc/config/sparc/linux64.h
+++ b/gcc/config/sparc/linux64.h
@@ -121,7 +121,7 @@ along with GCC; see the file COPYING3. If not see
{ "link_arch_default", LINK_ARCH_DEFAULT_SPEC }, \
{ "link_arch", LINK_ARCH_SPEC },
-#define LINK_ARCH32_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \
+#define LINK_ARCH32_SPEC "-m elf32_sparc -Y P,%R/usr/lib %{shared:-shared} \
%{!shared: \
%{!ibcs: \
%{!static: \
@@ -130,7 +130,7 @@ along with GCC; see the file COPYING3. If not see
%{static:-static}}} \
"
-#define LINK_ARCH64_SPEC "-m elf64_sparc -Y P,/usr/lib64 %{shared:-shared} \
+#define LINK_ARCH64_SPEC "-m elf64_sparc -Y P,%R/usr/lib64 %{shared:-shared} \
%{!shared: \
%{!ibcs: \
%{!static: \
@@ -211,7 +211,7 @@ along with GCC; see the file COPYING3. If not see
#else /* !SPARC_BI_ARCH */
#undef LINK_SPEC
-#define LINK_SPEC "-m elf64_sparc -Y P,/usr/lib64 %{shared:-shared} \
+#define LINK_SPEC "-m elf64_sparc -Y P,%R/usr/lib64 %{shared:-shared} \
%{!shared: \
%{!ibcs: \
%{!static: \
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index 5e6f5748672..58667a2cb19 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -48,7 +48,7 @@ along with GCC; see the file COPYING3. If not see
#include "target.h"
#include "target-def.h"
#include "cfglayout.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "langhooks.h"
#include "params.h"
#include "df.h"
@@ -410,7 +410,7 @@ static rtx sparc_struct_value_rtx (tree, int);
static bool sparc_return_in_memory (const_tree, const_tree);
static bool sparc_strict_argument_naming (CUMULATIVE_ARGS *);
static void sparc_va_start (tree, rtx);
-static tree sparc_gimplify_va_arg (tree, tree, tree *, tree *);
+static tree sparc_gimplify_va_arg (tree, tree, gimple_seq *, gimple_seq *);
static bool sparc_vector_mode_supported_p (enum machine_mode);
static bool sparc_pass_by_reference (CUMULATIVE_ARGS *,
enum machine_mode, const_tree, bool);
@@ -2371,6 +2371,8 @@ emit_soft_tfmode_cvt (enum rtx_code code, rtx *operands)
{
case SImode:
func = "_Qp_itoq";
+ if (TARGET_ARCH64)
+ operands[1] = gen_rtx_SIGN_EXTEND (DImode, operands[1]);
break;
case DImode:
func = "_Qp_xtoq";
@@ -2385,6 +2387,8 @@ emit_soft_tfmode_cvt (enum rtx_code code, rtx *operands)
{
case SImode:
func = "_Qp_uitoq";
+ if (TARGET_ARCH64)
+ operands[1] = gen_rtx_ZERO_EXTEND (DImode, operands[1]);
break;
case DImode:
func = "_Qp_uxtoq";
@@ -5709,7 +5713,8 @@ sparc_va_start (tree valist, rtx nextarg)
/* Implement `va_arg' for stdarg. */
static tree
-sparc_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p)
+sparc_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p,
+ gimple_seq *post_p)
{
HOST_WIDE_INT size, rsize, align;
tree addr, incr;
@@ -5792,8 +5797,7 @@ sparc_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p)
addr = fold_convert (ptrtype, addr);
incr = fold_build2 (POINTER_PLUS_EXPR, ptr_type_node, incr, size_int (rsize));
- incr = build2 (GIMPLE_MODIFY_STMT, ptr_type_node, valist, incr);
- gimplify_and_add (incr, post_p);
+ gimplify_assign (valist, incr, post_p);
return build_va_arg_indirect_ref (addr);
}
@@ -8637,7 +8641,7 @@ sparc_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
HOST_WIDE_INT delta, HOST_WIDE_INT vcall_offset,
tree function)
{
- rtx this, insn, funexp;
+ rtx this_rtx, insn, funexp;
unsigned int int_arg_first;
reload_completed = 1;
@@ -8668,9 +8672,9 @@ sparc_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
/* Find the "this" pointer. Normally in %o0, but in ARCH64 if the function
returns a structure, the structure return pointer is there instead. */
if (TARGET_ARCH64 && aggregate_value_p (TREE_TYPE (TREE_TYPE (function)), function))
- this = gen_rtx_REG (Pmode, int_arg_first + 1);
+ this_rtx = gen_rtx_REG (Pmode, int_arg_first + 1);
else
- this = gen_rtx_REG (Pmode, int_arg_first);
+ this_rtx = gen_rtx_REG (Pmode, int_arg_first);
/* Add DELTA. When possible use a plain add, otherwise load it into
a register first. */
@@ -8685,11 +8689,11 @@ sparc_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
delta_rtx = scratch;
}
- /* THIS += DELTA. */
- emit_insn (gen_add2_insn (this, delta_rtx));
+ /* THIS_RTX += DELTA. */
+ emit_insn (gen_add2_insn (this_rtx, delta_rtx));
}
- /* Add the word at address (*THIS + VCALL_OFFSET). */
+ /* Add the word at address (*THIS_RTX + VCALL_OFFSET). */
if (vcall_offset)
{
rtx vcall_offset_rtx = GEN_INT (vcall_offset);
@@ -8697,8 +8701,8 @@ sparc_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
gcc_assert (vcall_offset < 0);
- /* SCRATCH = *THIS. */
- emit_move_insn (scratch, gen_rtx_MEM (Pmode, this));
+ /* SCRATCH = *THIS_RTX. */
+ emit_move_insn (scratch, gen_rtx_MEM (Pmode, this_rtx));
/* Prepare for adding VCALL_OFFSET. The difficulty is that we
may not have any available scratch register at this point. */
@@ -8731,14 +8735,14 @@ sparc_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
vcall_offset_rtx = GEN_INT (vcall_offset); /* cannot be 0 */
}
- /* SCRATCH = *(*THIS + VCALL_OFFSET). */
+ /* SCRATCH = *(*THIS_RTX + VCALL_OFFSET). */
emit_move_insn (scratch, gen_rtx_MEM (Pmode,
gen_rtx_PLUS (Pmode,
scratch,
vcall_offset_rtx)));
- /* THIS += *(*THIS + VCALL_OFFSET). */
- emit_insn (gen_add2_insn (this, scratch));
+ /* THIS_RTX += *(*THIS_RTX + VCALL_OFFSET). */
+ emit_insn (gen_add2_insn (this_rtx, scratch));
}
/* Generate a tail call to the target function. */
diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h
index ef60292cef3..4d180da8285 100644
--- a/gcc/config/sparc/sparc.h
+++ b/gcc/config/sparc/sparc.h
@@ -981,9 +981,12 @@ extern int sparc_mode_class[];
/* Pick a default value we can notice from override_options:
!v9: Default is on.
- v9: Default is off. */
+ v9: Default is off.
+ Originally it was -1, but later on the container of options changed to
+ unsigned byte, so we decided to pick 127 as default value, which does
+ reflect an undefined default value in case of 0/1. */
-#define DEFAULT_PCC_STRUCT_RETURN -1
+#define DEFAULT_PCC_STRUCT_RETURN 127
/* Functions which return large structures get the address
to place the wanted value at offset 64 from the frame.
diff --git a/gcc/config/spu/float_disf.c b/gcc/config/spu/float_disf.c
new file mode 100644
index 00000000000..d8f3eb47615
--- /dev/null
+++ b/gcc/config/spu/float_disf.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+
+ This file is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at your option)
+ any later version.
+
+ This file is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this file; see the file COPYING. If not, write to the Free
+ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA. */
+
+/* As a special exception, if you link this library with files compiled with
+ GCC to produce an executable, this does not cause the resulting executable
+ to be covered by the GNU General Public License. The exception does not
+ however invalidate any other reasons why the executable file might be covered
+ by the GNU General Public License. */
+
+float __floatdisf (long long x)
+{
+ /* The SPU back-end now generates inline code for this conversion.
+ This file is solely used to provide the __floatdisf functions
+ for objects generated with prior versions of GCC. */
+ return x;
+}
diff --git a/gcc/config/spu/float_unsdisf.c b/gcc/config/spu/float_unsdisf.c
new file mode 100644
index 00000000000..0f16b963e2f
--- /dev/null
+++ b/gcc/config/spu/float_unsdisf.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+
+ This file is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at your option)
+ any later version.
+
+ This file is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this file; see the file COPYING. If not, write to the Free
+ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA. */
+
+/* As a special exception, if you link this library with files compiled with
+ GCC to produce an executable, this does not cause the resulting executable
+ to be covered by the GNU General Public License. The exception does not
+ however invalidate any other reasons why the executable file might be covered
+ by the GNU General Public License. */
+
+float __floatundisf (unsigned long long x)
+{
+ /* The SPU back-end now generates inline code for this conversion.
+ This file is solely used to provide the __floatundisf function
+ for objects generated with prior versions of GCC. */
+ return x;
+}
diff --git a/gcc/config/spu/spu-c.c b/gcc/config/spu/spu-c.c
index 0b0d2e8743a..96fe43e6e94 100644
--- a/gcc/config/spu/spu-c.c
+++ b/gcc/config/spu/spu-c.c
@@ -35,6 +35,64 @@
#include "spu-builtins.h"
+/* Keep the vector keywords handy for fast comparisons. */
+static GTY(()) tree __vector_keyword;
+static GTY(()) tree vector_keyword;
+
+static cpp_hashnode *
+spu_categorize_keyword (const cpp_token *tok)
+{
+ if (tok->type == CPP_NAME)
+ {
+ cpp_hashnode *ident = tok->val.node;
+
+ if (ident == C_CPP_HASHNODE (vector_keyword)
+ || ident == C_CPP_HASHNODE (__vector_keyword))
+ return C_CPP_HASHNODE (__vector_keyword);
+ else
+ return ident;
+ }
+ return 0;
+}
+
+/* Called to decide whether a conditional macro should be expanded.
+ Since we have exactly one such macro (i.e, 'vector'), we do not
+ need to examine the 'tok' parameter. */
+
+static cpp_hashnode *
+spu_macro_to_expand (cpp_reader *pfile, const cpp_token *tok)
+{
+ cpp_hashnode *expand_this = tok->val.node;
+ cpp_hashnode *ident;
+
+ ident = spu_categorize_keyword (tok);
+ if (ident == C_CPP_HASHNODE (__vector_keyword))
+ {
+ tok = cpp_peek_token (pfile, 0);
+ ident = spu_categorize_keyword (tok);
+
+ if (ident)
+ {
+ enum rid rid_code = (enum rid)(ident->rid_code);
+ if (ident->type == NT_MACRO)
+ {
+ (void) cpp_get_token (pfile);
+ tok = cpp_peek_token (pfile, 0);
+ ident = spu_categorize_keyword (tok);
+ if (ident)
+ rid_code = (enum rid)(ident->rid_code);
+ }
+
+ if (rid_code == RID_UNSIGNED || rid_code == RID_LONG
+ || rid_code == RID_SHORT || rid_code == RID_SIGNED
+ || rid_code == RID_INT || rid_code == RID_CHAR
+ || rid_code == RID_FLOAT || rid_code == RID_DOUBLE)
+ expand_this = C_CPP_HASHNODE (__vector_keyword);
+ }
+ }
+ return expand_this;
+}
+
/* target hook for resolve_overloaded_builtin(). Returns a function call
RTX if we can resolve the overloaded builtin */
tree
@@ -140,6 +198,22 @@ spu_cpu_cpp_builtins (struct cpp_reader *pfile)
if (spu_arch == PROCESSOR_CELLEDP)
builtin_define_std ("__SPU_EDP__");
builtin_define_std ("__vector=__attribute__((__spu_vector__))");
+
+ if (!flag_iso)
+ {
+ /* Define this when supporting context-sensitive keywords. */
+ cpp_define (pfile, "__VECTOR_KEYWORD_SUPPORTED__");
+ cpp_define (pfile, "vector=vector");
+
+ /* Initialize vector keywords. */
+ __vector_keyword = get_identifier ("__vector");
+ C_CPP_HASHNODE (__vector_keyword)->flags |= NODE_CONDITIONAL;
+ vector_keyword = get_identifier ("vector");
+ C_CPP_HASHNODE (vector_keyword)->flags |= NODE_CONDITIONAL;
+
+ /* Enable context-sensitive macros. */
+ cpp_get_callbacks (pfile)->macro_to_expand = spu_macro_to_expand;
+ }
}
void
diff --git a/gcc/config/spu/spu.c b/gcc/config/spu/spu.c
index e645adb2281..1021a918275 100644
--- a/gcc/config/spu/spu.c
+++ b/gcc/config/spu/spu.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2006, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc.
This file is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
@@ -50,7 +50,7 @@
#include "assert.h"
#include "c-common.h"
#include "machmode.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "tm-constrs.h"
#include "spu-builtins.h"
#include "ddg.h"
@@ -118,8 +118,8 @@ static unsigned char spu_pass_by_reference (CUMULATIVE_ARGS *cum, enum machine_m
const_tree type, unsigned char named);
static tree spu_build_builtin_va_list (void);
static void spu_va_start (tree, rtx);
-static tree spu_gimplify_va_arg_expr (tree valist, tree type, tree * pre_p,
- tree * post_p);
+static tree spu_gimplify_va_arg_expr (tree valist, tree type,
+ gimple_seq * pre_p, gimple_seq * post_p);
static int regno_aligned_for_load (int regno);
static int store_with_one_insn_p (rtx mem);
static int mem_is_padded_component_ref (rtx x);
@@ -352,6 +352,8 @@ spu_override_options (void)
else
error ("Unknown architecture '%s'", &spu_tune_string[0]);
}
+
+ REAL_MODE_FORMAT (SFmode) = &spu_single_format;
}
/* Handle an attribute requiring a FUNCTION_DECL; arguments as in
@@ -419,7 +421,8 @@ valid_subreg (rtx op)
enum machine_mode im = GET_MODE (SUBREG_REG (op));
return om != VOIDmode && im != VOIDmode
&& (GET_MODE_SIZE (im) == GET_MODE_SIZE (om)
- || (GET_MODE_SIZE (im) <= 4 && GET_MODE_SIZE (om) <= 4));
+ || (GET_MODE_SIZE (im) <= 4 && GET_MODE_SIZE (om) <= 4)
+ || (GET_MODE_SIZE (im) >= 16 && GET_MODE_SIZE (om) >= 16));
}
/* When insv and ext[sz]v ar passed a TI SUBREG, we want to strip it off
@@ -429,8 +432,10 @@ adjust_operand (rtx op, HOST_WIDE_INT * start)
{
enum machine_mode mode;
int op_size;
- /* Strip any SUBREG */
- if (GET_CODE (op) == SUBREG)
+ /* Strip any paradoxical SUBREG. */
+ if (GET_CODE (op) == SUBREG
+ && (GET_MODE_BITSIZE (GET_MODE (op))
+ > GET_MODE_BITSIZE (GET_MODE (SUBREG_REG (op)))))
{
if (start)
*start -=
@@ -1516,10 +1521,18 @@ spu_split_immediate (rtx * ops)
{
unsigned char arrhi[16];
unsigned char arrlo[16];
- rtx to, hi, lo;
+ rtx to, temp, hi, lo;
int i;
+ enum machine_mode imode = mode;
+ /* We need to do reals as ints because the constant used in the
+ IOR might not be a legitimate real constant. */
+ imode = int_mode_for_mode (mode);
constant_to_array (mode, ops[1], arrhi);
- to = !can_create_pseudo_p () ? ops[0] : gen_reg_rtx (mode);
+ if (imode != mode)
+ to = simplify_gen_subreg (imode, ops[0], mode, 0);
+ else
+ to = ops[0];
+ temp = !can_create_pseudo_p () ? to : gen_reg_rtx (imode);
for (i = 0; i < 16; i += 4)
{
arrlo[i + 2] = arrhi[i + 2];
@@ -1527,11 +1540,11 @@ spu_split_immediate (rtx * ops)
arrlo[i + 0] = arrlo[i + 1] = 0;
arrhi[i + 2] = arrhi[i + 3] = 0;
}
- hi = array_to_constant (mode, arrhi);
- lo = array_to_constant (mode, arrlo);
- emit_move_insn (to, hi);
+ hi = array_to_constant (imode, arrhi);
+ lo = array_to_constant (imode, arrlo);
+ emit_move_insn (temp, hi);
emit_insn (gen_rtx_SET
- (VOIDmode, ops[0], gen_rtx_IOR (mode, to, lo)));
+ (VOIDmode, to, gen_rtx_IOR (imode, temp, lo)));
return 1;
}
case IC_FSMBI2:
@@ -3238,7 +3251,7 @@ spu_va_start (tree valist, rtx nextarg)
if (crtl->args.pretend_args_size > 0)
t = build2 (POINTER_PLUS_EXPR, TREE_TYPE (args), t,
size_int (-STACK_POINTER_OFFSET));
- t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (args), args, t);
+ t = build2 (MODIFY_EXPR, TREE_TYPE (args), args, t);
TREE_SIDE_EFFECTS (t) = 1;
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
@@ -3247,7 +3260,7 @@ spu_va_start (tree valist, rtx nextarg)
t = build2 (POINTER_PLUS_EXPR, TREE_TYPE (skip), t,
size_int (crtl->args.pretend_args_size
- STACK_POINTER_OFFSET));
- t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (skip), skip, t);
+ t = build2 (MODIFY_EXPR, TREE_TYPE (skip), skip, t);
TREE_SIDE_EFFECTS (t) = 1;
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
}
@@ -3270,8 +3283,8 @@ spu_va_start (tree valist, rtx nextarg)
ret = *(TYPE *)addr;
*/
static tree
-spu_gimplify_va_arg_expr (tree valist, tree type, tree * pre_p,
- tree * post_p ATTRIBUTE_UNUSED)
+spu_gimplify_va_arg_expr (tree valist, tree type, gimple_seq * pre_p,
+ gimple_seq * post_p ATTRIBUTE_UNUSED)
{
tree f_args, f_skip;
tree args, skip;
@@ -3303,22 +3316,21 @@ spu_gimplify_va_arg_expr (tree valist, tree type, tree * pre_p,
/* build conditional expression to calculate addr. The expression
will be gimplified later. */
paddedsize = size_int (rsize);
- tmp = build2 (POINTER_PLUS_EXPR, ptr_type_node, args, paddedsize);
+ tmp = build2 (POINTER_PLUS_EXPR, ptr_type_node, unshare_expr (args), paddedsize);
tmp = build2 (TRUTH_AND_EXPR, boolean_type_node,
- build2 (GT_EXPR, boolean_type_node, tmp, skip),
- build2 (LE_EXPR, boolean_type_node, args, skip));
+ build2 (GT_EXPR, boolean_type_node, tmp, unshare_expr (skip)),
+ build2 (LE_EXPR, boolean_type_node, unshare_expr (args),
+ unshare_expr (skip)));
tmp = build3 (COND_EXPR, ptr_type_node, tmp,
- build2 (POINTER_PLUS_EXPR, ptr_type_node, skip,
- size_int (32)), args);
+ build2 (POINTER_PLUS_EXPR, ptr_type_node, unshare_expr (skip),
+ size_int (32)), unshare_expr (args));
- tmp = build2 (GIMPLE_MODIFY_STMT, ptr_type_node, addr, tmp);
- gimplify_and_add (tmp, pre_p);
+ gimplify_assign (addr, tmp, pre_p);
/* update VALIST.__args */
tmp = build2 (POINTER_PLUS_EXPR, ptr_type_node, addr, paddedsize);
- tmp = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (args), args, tmp);
- gimplify_and_add (tmp, pre_p);
+ gimplify_assign (unshare_expr (args), tmp, pre_p);
addr = fold_convert (build_pointer_type (type), addr);
@@ -4563,7 +4575,7 @@ spu_restore_stack_block (rtx op0 ATTRIBUTE_UNUSED, rtx op1)
int
spu_safe_dma (HOST_WIDE_INT channel)
{
- return (channel >= 21 && channel <= 27);
+ return TARGET_SAFE_DMA && channel >= 21 && channel <= 27;
}
void
diff --git a/gcc/config/spu/spu.h b/gcc/config/spu/spu.h
index 729e0d707a8..0bd69d365cd 100644
--- a/gcc/config/spu/spu.h
+++ b/gcc/config/spu/spu.h
@@ -124,34 +124,6 @@ extern GTY(()) int spu_tune;
#define STACK_SIZE_MODE SImode
-/* #define TARGET_FLOAT_FORMAT SPU_FLOAT_FORMAT */
-
-#ifndef MODE_HAS_NANS
-#define MODE_HAS_NANS(MODE) \
- (FLOAT_MODE_P (MODE) \
- && MODE != SFmode \
- && !LARGEST_EXPONENT_IS_NORMAL (GET_MODE_BITSIZE (MODE)))
-#endif
-
-#ifndef MODE_HAS_INFINITIES
-#define MODE_HAS_INFINITIES(MODE) \
- (FLOAT_MODE_P (MODE) \
- && MODE != SFmode \
- && !LARGEST_EXPONENT_IS_NORMAL (GET_MODE_BITSIZE (MODE)))
-#endif
-
-#ifndef MODE_HAS_SIGN_DEPENDENT_ROUNDING
-#define MODE_HAS_SIGN_DEPENDENT_ROUNDING(MODE) \
- (FLOAT_MODE_P (MODE) \
- && MODE != SFmode \
- && !ROUND_TOWARDS_ZERO)
-#endif
-
-#define ROUND_TOWARDS_ZERO 1
-
-/* This is certainly true. Should it be defined? (It wasn't before.) */
-/* #define LARGEST_EXPONENT_IS_NORMAL(size) (size != 32) */
-
/* Type Layout */
@@ -263,6 +235,7 @@ enum reg_class {
only true for SPU. */
#define CANNOT_CHANGE_MODE_CLASS(FROM, TO, CLASS) \
((GET_MODE_SIZE (FROM) > 4 || GET_MODE_SIZE (TO) > 4) \
+ && (GET_MODE_SIZE (FROM) < 16 || GET_MODE_SIZE (TO) < 16) \
&& GET_MODE_SIZE (FROM) != GET_MODE_SIZE (TO))
#define REGISTER_TARGET_PRAGMAS() do { \
@@ -289,6 +262,8 @@ targetm.resolve_overloaded_builtin = spu_resolve_overloaded_builtin; \
#define INCOMING_RETURN_ADDR_RTX gen_rtx_REG(Pmode, LINK_REGISTER_REGNUM)
+#define DWARF_FRAME_RETURN_COLUMN DWARF_FRAME_REGNUM (LINK_REGISTER_REGNUM)
+
#define ARG_POINTER_CFA_OFFSET(FNDECL) (-STACK_POINTER_OFFSET)
diff --git a/gcc/config/spu/spu.md b/gcc/config/spu/spu.md
index 6985a683697..ffe46f53179 100644
--- a/gcc/config/spu/spu.md
+++ b/gcc/config/spu/spu.md
@@ -153,6 +153,8 @@
(UNSPEC_SPU_REALIGN_LOAD 49)
(UNSPEC_SPU_MASK_FOR_LOAD 50)
(UNSPEC_DFTSV 51)
+ (UNSPEC_FLOAT_EXTEND 52)
+ (UNSPEC_FLOAT_TRUNCATE 53)
])
(include "predicates.md")
@@ -648,18 +650,79 @@
(define_insn "extendsfdf2"
[(set (match_operand:DF 0 "spu_reg_operand" "=r")
- (float_extend:DF (match_operand:SF 1 "spu_reg_operand" "r")))]
+ (unspec:DF [(match_operand:SF 1 "spu_reg_operand" "r")]
+ UNSPEC_FLOAT_EXTEND))]
""
"fesd\t%0,%1"
[(set_attr "type" "fpd")])
(define_insn "truncdfsf2"
[(set (match_operand:SF 0 "spu_reg_operand" "=r")
- (float_truncate:SF (match_operand:DF 1 "spu_reg_operand" "r")))]
+ (unspec:SF [(match_operand:DF 1 "spu_reg_operand" "r")]
+ UNSPEC_FLOAT_TRUNCATE))]
""
"frds\t%0,%1"
[(set_attr "type" "fpd")])
+(define_expand "floatdisf2"
+ [(set (match_operand:SF 0 "register_operand" "")
+ (float:SF (match_operand:DI 1 "register_operand" "")))]
+ ""
+ {
+ rtx c0 = gen_reg_rtx (SImode);
+ rtx r0 = gen_reg_rtx (DImode);
+ rtx r1 = gen_reg_rtx (SFmode);
+ rtx r2 = gen_reg_rtx (SImode);
+ rtx setneg = gen_reg_rtx (SImode);
+ rtx isneg = gen_reg_rtx (SImode);
+ rtx neg = gen_reg_rtx (DImode);
+ rtx mask = gen_reg_rtx (DImode);
+
+ emit_move_insn (c0, GEN_INT (-0x80000000ll));
+
+ emit_insn (gen_negdi2 (neg, operands[1]));
+ emit_insn (gen_cgt_di_m1 (isneg, operands[1]));
+ emit_insn (gen_extend_compare (mask, isneg));
+ emit_insn (gen_selb (r0, neg, operands[1], mask));
+ emit_insn (gen_andc_si (setneg, c0, isneg));
+
+ emit_insn (gen_floatunsdisf2 (r1, r0));
+
+ emit_insn (gen_iorsi3 (r2, gen_rtx_SUBREG (SImode, r1, 0), setneg));
+ emit_move_insn (operands[0], gen_rtx_SUBREG (SFmode, r2, 0));
+ DONE;
+ })
+
+(define_insn_and_split "floatunsdisf2"
+ [(set (match_operand:SF 0 "register_operand" "=r")
+ (unsigned_float:SF (match_operand:DI 1 "register_operand" "r")))
+ (clobber (match_scratch:SF 2 "=r"))
+ (clobber (match_scratch:SF 3 "=r"))
+ (clobber (match_scratch:SF 4 "=r"))]
+ ""
+ "#"
+ "reload_completed"
+ [(set (match_dup:SF 0)
+ (unsigned_float:SF (match_dup:DI 1)))]
+ {
+ rtx op1_v4si = gen_rtx_REG (V4SImode, REGNO (operands[1]));
+ rtx op2_v4sf = gen_rtx_REG (V4SFmode, REGNO (operands[2]));
+ rtx op2_ti = gen_rtx_REG (TImode, REGNO (operands[2]));
+ rtx op3_ti = gen_rtx_REG (TImode, REGNO (operands[3]));
+
+ REAL_VALUE_TYPE scale;
+ real_2expN (&scale, 32, SFmode);
+
+ emit_insn (gen_floatunsv4siv4sf2 (op2_v4sf, op1_v4si));
+ emit_insn (gen_shlqby_ti (op3_ti, op2_ti, GEN_INT (4)));
+
+ emit_move_insn (operands[4],
+ CONST_DOUBLE_FROM_REAL_VALUE (scale, SFmode));
+ emit_insn (gen_fma_sf (operands[0],
+ operands[2], operands[4], operands[3]));
+ DONE;
+ })
+
;; Do (double)(operands[1]+0x80000000u)-(double)0x80000000
(define_expand "floatsidf2"
[(set (match_operand:DF 0 "register_operand" "")
@@ -1721,20 +1784,33 @@
[(set_attr "type" "multi0")
(set_attr "length" "80")])
-(define_insn_and_split "div<mode>3"
+(define_expand "div<mode>3"
+ [(parallel
+ [(set (match_operand:VSF 0 "spu_reg_operand" "")
+ (div:VSF (match_operand:VSF 1 "spu_reg_operand" "")
+ (match_operand:VSF 2 "spu_reg_operand" "")))
+ (clobber (match_scratch:VSF 3 ""))
+ (clobber (match_scratch:VSF 4 ""))
+ (clobber (match_scratch:VSF 5 ""))])]
+ ""
+ "")
+
+(define_insn_and_split "*div<mode>3_fast"
[(set (match_operand:VSF 0 "spu_reg_operand" "=r")
(div:VSF (match_operand:VSF 1 "spu_reg_operand" "r")
(match_operand:VSF 2 "spu_reg_operand" "r")))
(clobber (match_scratch:VSF 3 "=&r"))
- (clobber (match_scratch:VSF 4 "=&r"))]
- ""
+ (clobber (match_scratch:VSF 4 "=&r"))
+ (clobber (scratch:VSF))]
+ "flag_unsafe_math_optimizations"
"#"
"reload_completed"
[(set (match_dup:VSF 0)
(div:VSF (match_dup:VSF 1)
(match_dup:VSF 2)))
(clobber (match_dup:VSF 3))
- (clobber (match_dup:VSF 4))]
+ (clobber (match_dup:VSF 4))
+ (clobber (scratch:VSF))]
{
emit_insn (gen_frest_<mode>(operands[3], operands[2]));
emit_insn (gen_fi_<mode>(operands[3], operands[2], operands[3]));
@@ -1744,6 +1820,50 @@
DONE;
})
+(define_insn_and_split "*div<mode>3_adjusted"
+ [(set (match_operand:VSF 0 "spu_reg_operand" "=r")
+ (div:VSF (match_operand:VSF 1 "spu_reg_operand" "r")
+ (match_operand:VSF 2 "spu_reg_operand" "r")))
+ (clobber (match_scratch:VSF 3 "=&r"))
+ (clobber (match_scratch:VSF 4 "=&r"))
+ (clobber (match_scratch:VSF 5 "=&r"))]
+ "!flag_unsafe_math_optimizations"
+ "#"
+ "reload_completed"
+ [(set (match_dup:VSF 0)
+ (div:VSF (match_dup:VSF 1)
+ (match_dup:VSF 2)))
+ (clobber (match_dup:VSF 3))
+ (clobber (match_dup:VSF 4))
+ (clobber (match_dup:VSF 5))]
+ {
+ emit_insn (gen_frest_<mode> (operands[3], operands[2]));
+ emit_insn (gen_fi_<mode> (operands[3], operands[2], operands[3]));
+ emit_insn (gen_mul<mode>3 (operands[4], operands[1], operands[3]));
+ emit_insn (gen_fnms_<mode> (operands[5], operands[4], operands[2], operands[1]));
+ emit_insn (gen_fma_<mode> (operands[3], operands[5], operands[3], operands[4]));
+
+ /* Due to truncation error, the quotient result may be low by 1 ulp.
+ Conditionally add one if the estimate is too small in magnitude. */
+
+ emit_move_insn (gen_lowpart (<F2I>mode, operands[4]),
+ spu_const (<F2I>mode, 0x80000000ULL));
+ emit_move_insn (gen_lowpart (<F2I>mode, operands[5]),
+ spu_const (<F2I>mode, 0x3f800000ULL));
+ emit_insn (gen_selb (operands[5], operands[5], operands[1], operands[4]));
+
+ emit_insn (gen_add<f2i>3 (gen_lowpart (<F2I>mode, operands[4]),
+ gen_lowpart (<F2I>mode, operands[3]),
+ spu_const (<F2I>mode, 1)));
+ emit_insn (gen_fnms_<mode> (operands[0], operands[2], operands[4], operands[1]));
+ emit_insn (gen_mul<mode>3 (operands[0], operands[0], operands[5]));
+ emit_insn (gen_cgt_<f2i> (gen_lowpart (<F2I>mode, operands[0]),
+ gen_lowpart (<F2I>mode, operands[0]),
+ spu_const (<F2I>mode, -1)));
+ emit_insn (gen_selb (operands[0], operands[3], operands[4], operands[0]));
+ DONE;
+ })
+
;; Taken from STI's gcc
;; Does not correctly handle INF or NAN.
(define_expand "divdf3"
diff --git a/gcc/config/spu/spu_mfcio.h b/gcc/config/spu/spu_mfcio.h
index 7653c8d5b39..8423b9e8d5d 100644
--- a/gcc/config/spu/spu_mfcio.h
+++ b/gcc/config/spu/spu_mfcio.h
@@ -31,6 +31,10 @@ typedef unsigned long long uint64_t;
#include <stdint.h>
#endif
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/****************************************************************/
/* DMA list element structure*/
@@ -59,21 +63,23 @@ typedef struct mfc_list_element {
#define MFC_MIN_DMA_SIZE_MASK (MFC_MIN_DMA_SIZE - 1)
#define MFC_MAX_DMA_SIZE_MASK (MFC_MAX_DMA_SIZE - 1)
-#define MFC_MIN_DMA_LIST_SIZE 0x0008 /* 8 bytes */
-#define MFC_MAX_DMA_LIST_SIZE 0x4000 /* 16K bytes */
+#define MFC_MIN_DMA_LIST_ELEMENTS 1
+#define MFC_MAX_DMA_LIST_ELEMENTS 2048
+
+#define MFC_MIN_DMA_LIST_SIZE (MFC_MIN_DMA_LIST_ELEMENTS << 3) /* 8 bytes */
+#define MFC_MAX_DMA_LIST_SIZE (MFC_MAX_DMA_LIST_ELEMENTS << 3) /* 16K bytes */
/****************************************************************/
-/* MFC DMA Command flags which identify classes of operations. */
+/* MFC DMA command modifiers to identify classes of operations. */
/****************************************************************/
-/* Note: These flags may be used in conjunction with the base command types
- (i.e. MFC_PUT_CMD, MFC_PUTR_CMD, MFC_GET_CMD, and MFC_SNDSIG_CMD)
- to construct the various command permutations.
- */
+
+/* Note: These commands modifier may be used in conjunction with the base
+ command types (i.e. MFC_PUT_CMD, MFC_GET_CMD, and MFC_SNDSIG_CMD)
+ to construct the various command permutations. */
#define MFC_BARRIER_ENABLE 0x0001
#define MFC_FENCE_ENABLE 0x0002
-#define MFC_LIST_ENABLE 0x0004 /* SPU Only */
-#define MFC_START_ENABLE 0x0008 /* PU Only */
+#define MFC_LIST_ENABLE 0x0004
#define MFC_RESULT_ENABLE 0x0010
/****************************************************************/
@@ -81,42 +87,37 @@ typedef struct mfc_list_element {
/****************************************************************/
#define MFC_PUT_CMD 0x0020
-#define MFC_PUTS_CMD 0x0028 /* PU Only */
-#define MFC_PUTR_CMD 0x0030
-#define MFC_PUTF_CMD 0x0022
-#define MFC_PUTB_CMD 0x0021
-#define MFC_PUTFS_CMD 0x002A /* PU Only */
-#define MFC_PUTBS_CMD 0x0029 /* PU Only */
-#define MFC_PUTRF_CMD 0x0032
-#define MFC_PUTRB_CMD 0x0031
-#define MFC_PUTL_CMD 0x0024 /* SPU Only */
-#define MFC_PUTRL_CMD 0x0034 /* SPU Only */
-#define MFC_PUTLF_CMD 0x0026 /* SPU Only */
-#define MFC_PUTLB_CMD 0x0025 /* SPU Only */
-#define MFC_PUTRLF_CMD 0x0036 /* SPU Only */
-#define MFC_PUTRLB_CMD 0x0035 /* SPU Only */
+#define MFC_PUTB_CMD (MFC_PUT_CMD | MFC_BARRIER_ENABLE)
+#define MFC_PUTF_CMD (MFC_PUT_CMD | MFC_FENCE_ENABLE)
+#define MFC_PUTL_CMD (MFC_PUT_CMD | MFC_LIST_ENABLE)
+#define MFC_PUTLB_CMD (MFC_PUTL_CMD | MFC_BARRIER_ENABLE)
+#define MFC_PUTLF_CMD (MFC_PUTL_CMD | MFC_FENCE_ENABLE)
+
+#define MFC_PUTR_CMD (MFC_PUT_CMD | MFC_RESULT_ENABLE)
+#define MFC_PUTRB_CMD (MFC_PUTR_CMD | MFC_BARRIER_ENABLE)
+#define MFC_PUTRF_CMD (MFC_PUTR_CMD | MFC_FENCE_ENABLE)
+#define MFC_PUTRL_CMD (MFC_PUTR_CMD | MFC_LIST_ENABLE)
+#define MFC_PUTRLB_CMD (MFC_PUTRL_CMD | MFC_BARRIER_ENABLE)
+#define MFC_PUTRLF_CMD (MFC_PUTRL_CMD | MFC_FENCE_ENABLE)
/****************************************************************/
/* MFC DMA Get Commands */
/****************************************************************/
#define MFC_GET_CMD 0x0040
-#define MFC_GETS_CMD 0x0048 /* PU Only */
-#define MFC_GETF_CMD 0x0042
-#define MFC_GETB_CMD 0x0041
-#define MFC_GETFS_CMD 0x004A /* PU Only */
-#define MFC_GETBS_CMD 0x0049 /* PU Only */
-#define MFC_GETL_CMD 0x0044 /* SPU Only */
-#define MFC_GETLF_CMD 0x0046 /* SPU Only */
-#define MFC_GETLB_CMD 0x0045 /* SPU Only */
+#define MFC_GETB_CMD (MFC_GET_CMD | MFC_BARRIER_ENABLE)
+#define MFC_GETF_CMD (MFC_GET_CMD | MFC_FENCE_ENABLE)
+#define MFC_GETL_CMD (MFC_GET_CMD | MFC_LIST_ENABLE)
+#define MFC_GETLB_CMD (MFC_GETL_CMD | MFC_BARRIER_ENABLE)
+#define MFC_GETLF_CMD (MFC_GETL_CMD | MFC_FENCE_ENABLE)
/****************************************************************/
/* MFC Synchronization Commands */
/****************************************************************/
#define MFC_SNDSIG_CMD 0x00A0
-#define MFC_SNDSIGB_CMD 0x00A1
-#define MFC_SNDSIGF_CMD 0x00A2
+#define MFC_SNDSIGB_CMD (MFC_SNDSIG_CMD | MFC_BARRIER_ENABLE)
+#define MFC_SNDSIGF_CMD (MFC_SNDSIG_CMD | MFC_FENCE_ENABLE)
#define MFC_BARRIER_CMD 0x00C0
#define MFC_EIEIO_CMD 0x00C8
#define MFC_SYNC_CMD 0x00CC
@@ -125,10 +126,20 @@ typedef struct mfc_list_element {
/* MFC Atomic Commands */
/****************************************************************/
-#define MFC_GETLLAR_CMD 0x00D0 /* SPU Only */
-#define MFC_PUTLLC_CMD 0x00B4 /* SPU Only */
-#define MFC_PUTLLUC_CMD 0x00B0 /* SPU Only */
-#define MFC_PUTQLLUC_CMD 0x00B8 /* SPU Only */
+#define MFC_GETLLAR_CMD 0x00D0
+#define MFC_PUTLLC_CMD 0x00B4
+#define MFC_PUTLLUC_CMD 0x00B0
+#define MFC_PUTQLLUC_CMD 0x00B8
+
+/****************************************************************/
+/* MFC SL1 Storage Control Commands */
+/****************************************************************/
+
+#define MFC_SDCRT_CMD 0x0080
+#define MFC_SDCRTST_CMD 0x0081
+#define MFC_SDCRZ_CMD 0x0089
+#define MFC_SDCRST_CMD 0x008D
+#define MFC_SDCRF_CMD 0x008F
/****************************************************************/
/* Channel Defines */
@@ -209,6 +220,13 @@ typedef struct mfc_list_element {
#define mfc_eieio(tag,tid,rid) spu_mfcdma32(0,0,0,tag,MFC_CMD_WORD(tid,rid,MFC_EIEIO_CMD))
#define mfc_sync(tag) spu_mfcdma32(0,0,0,tag,MFC_SYNC_CMD)
+/* MFC SL1 Storage Control Commands */
+#define mfc_sdcrt( ea,size,tag,tid,rid) spu_mfcdma64(0,mfc_ea2h(ea),mfc_ea2l(ea),size,tag,MFC_CMD_WORD(tid,rid,MFC_SDCRT_CMD))
+#define mfc_sdcrtst(ea,size,tag,tid,rid) spu_mfcdma64(0,mfc_ea2h(ea),mfc_ea2l(ea),size,tag,MFC_CMD_WORD(tid,rid,MFC_SDCRTST_CMD))
+#define mfc_sdcrz( ea,size,tag,tid,rid) spu_mfcdma64(0,mfc_ea2h(ea),mfc_ea2l(ea),size,tag,MFC_CMD_WORD(tid,rid,MFC_SDCRZ_CMD))
+#define mfc_sdcrst( ea,size,tag,tid,rid) spu_mfcdma64(0,mfc_ea2h(ea),mfc_ea2l(ea),size,tag,MFC_CMD_WORD(tid,rid,MFC_SDCRST_CMD))
+#define mfc_sdcrf( ea,size,tag,tid,rid) spu_mfcdma64(0,mfc_ea2h(ea),mfc_ea2l(ea),size,tag,MFC_CMD_WORD(tid,rid,MFC_SDCRF_CMD))
+
/* DMA Queue */
#define mfc_stat_cmd_queue() spu_readchcnt(MFC_Cmd)
@@ -267,7 +285,7 @@ typedef struct mfc_list_element {
#define spu_read_event_mask() spu_readch(SPU_RdEventMask)
/* SPU State Management */
-#define spu_read_machine_status() spu_readch(SPU_MachStat)
+#define spu_read_machine_status() spu_readch(SPU_RdMachStat)
#define spu_write_srr0(srr0) spu_writech(SPU_WrSRR0,srr0)
#define spu_read_srr0() spu_readch(SPU_RdSRR0)
@@ -291,4 +309,8 @@ extern unsigned int __mfc_tag_release (unsigned int);
extern unsigned int __mfc_multi_tag_reserve (unsigned int);
extern unsigned int __mfc_multi_tag_release (unsigned int, unsigned int);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* __SPU_MFCIO_H__ */
diff --git a/gcc/config/spu/t-spu-elf b/gcc/config/spu/t-spu-elf
index 0a3947d9017..017f09d1fb6 100644
--- a/gcc/config/spu/t-spu-elf
+++ b/gcc/config/spu/t-spu-elf
@@ -21,8 +21,15 @@ CROSS_LIBGCC1 =
TARGET_LIBGCC2_CFLAGS = -fPIC -mwarn-reloc -D__IN_LIBGCC2
+# We exclude those because the libgcc2.c default versions do not support
+# the SPU single-precision format (round towards zero). We provide our
+# own versions below.
+LIB2FUNCS_EXCLUDE = _floatdisf _floatundisf
+
LIB2FUNCS_STATIC_EXTRA = $(srcdir)/config/spu/float_unssidf.c \
$(srcdir)/config/spu/float_unsdidf.c \
+ $(srcdir)/config/spu/float_unsdisf.c \
+ $(srcdir)/config/spu/float_disf.c \
$(srcdir)/config/spu/mfc_tag_table.c \
$(srcdir)/config/spu/mfc_tag_reserve.c \
$(srcdir)/config/spu/mfc_tag_release.c \
diff --git a/gcc/config/stormy16/stormy16.c b/gcc/config/stormy16/stormy16.c
index 6cbe52d5048..77aedd6e01e 100644
--- a/gcc/config/stormy16/stormy16.c
+++ b/gcc/config/stormy16/stormy16.c
@@ -45,7 +45,7 @@ along with GCC; see the file COPYING3. If not see
#include "target-def.h"
#include "tm_p.h"
#include "langhooks.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "df.h"
#include "ggc.h"
@@ -283,7 +283,7 @@ xstormy16_output_cbranch_hi (rtx op, const char *label, int reversed, rtx insn)
: get_attr_length (insn) == 4);
int really_reversed = reversed ^ need_longbranch;
const char *ccode;
- const char *template;
+ const char *templ;
const char *operands;
enum rtx_code code;
@@ -329,10 +329,10 @@ xstormy16_output_cbranch_hi (rtx op, const char *label, int reversed, rtx insn)
}
if (need_longbranch)
- template = "b%s %s,.+8 | jmpf %s";
+ templ = "b%s %s,.+8 | jmpf %s";
else
- template = "b%s %s,%s";
- sprintf (string, template, ccode, operands, label);
+ templ = "b%s %s,%s";
+ sprintf (string, templ, ccode, operands, label);
return string;
}
@@ -354,7 +354,7 @@ xstormy16_output_cbranch_si (rtx op, const char *label, int reversed, rtx insn)
int need_longbranch = get_attr_length (insn) >= 8;
int really_reversed = reversed ^ need_longbranch;
const char *ccode;
- const char *template;
+ const char *templ;
char prevop[16];
enum rtx_code code;
@@ -400,10 +400,10 @@ xstormy16_output_cbranch_si (rtx op, const char *label, int reversed, rtx insn)
}
if (need_longbranch)
- template = "%s | b%s .+6 | jmpf %s";
+ templ = "%s | b%s .+6 | jmpf %s";
else
- template = "%s | b%s %s";
- sprintf (string, template, prevop, ccode, label);
+ templ = "%s | b%s %s";
+ sprintf (string, templ, prevop, ccode, label);
return string;
}
@@ -420,11 +420,11 @@ xstormy16_output_cbranch_si (rtx op, const char *label, int reversed, rtx insn)
You should define these macros to indicate to the reload phase that it may
need to allocate at least one register for a reload in addition to the
register to contain the data. Specifically, if copying X to a register
- CLASS in MODE requires an intermediate register, you should define
+ RCLASS in MODE requires an intermediate register, you should define
`SECONDARY_INPUT_RELOAD_CLASS' to return the largest register class all of
whose registers can be used as intermediate registers or scratch registers.
- If copying a register CLASS in MODE to X requires an intermediate or scratch
+ If copying a register RCLASS in MODE to X requires an intermediate or scratch
register, `SECONDARY_OUTPUT_RELOAD_CLASS' should be defined to return the
largest register class required. If the requirements for input and output
reloads are the same, the macro `SECONDARY_RELOAD_CLASS' should be used
@@ -432,7 +432,7 @@ xstormy16_output_cbranch_si (rtx op, const char *label, int reversed, rtx insn)
The values returned by these macros are often `GENERAL_REGS'. Return
`NO_REGS' if no spare register is needed; i.e., if X can be directly copied
- to or from a register of CLASS in MODE without requiring a scratch register.
+ to or from a register of RCLASS in MODE without requiring a scratch register.
Do not define this macro if it would always return `NO_REGS'.
If a scratch register is required (either with or without an intermediate
@@ -443,7 +443,7 @@ xstormy16_output_cbranch_si (rtx op, const char *label, int reversed, rtx insn)
Define constraints for the reload register and scratch register that contain
a single register class. If the original reload register (whose class is
- CLASS) can meet the constraint given in the pattern, the value returned by
+ RCLASS) can meet the constraint given in the pattern, the value returned by
these macros is used for the class of the scratch register. Otherwise, two
additional reload registers are required. Their classes are obtained from
the constraints in the insn pattern.
@@ -461,7 +461,7 @@ xstormy16_output_cbranch_si (rtx op, const char *label, int reversed, rtx insn)
This case often occurs between floating-point and general registers. */
enum reg_class
-xstormy16_secondary_reload_class (enum reg_class class,
+xstormy16_secondary_reload_class (enum reg_class rclass,
enum machine_mode mode,
rtx x)
{
@@ -471,7 +471,7 @@ xstormy16_secondary_reload_class (enum reg_class class,
|| ((GET_CODE (x) == SUBREG || GET_CODE (x) == REG)
&& (true_regnum (x) == -1
|| true_regnum (x) >= FIRST_PSEUDO_REGISTER)))
- && ! reg_class_subset_p (class, EIGHT_REGS))
+ && ! reg_class_subset_p (rclass, EIGHT_REGS))
return EIGHT_REGS;
/* When reloading a PLUS, the carry register will be required
@@ -483,13 +483,13 @@ xstormy16_secondary_reload_class (enum reg_class class,
}
enum reg_class
-xstormy16_preferred_reload_class (rtx x, enum reg_class class)
+xstormy16_preferred_reload_class (rtx x, enum reg_class rclass)
{
- if (class == GENERAL_REGS
+ if (rclass == GENERAL_REGS
&& GET_CODE (x) == MEM)
return EIGHT_REGS;
- return class;
+ return rclass;
}
/* Predicate for symbols and addresses that reflect special 8-bit
@@ -1350,11 +1350,11 @@ xstormy16_expand_builtin_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED)
u = build_int_cst (NULL_TREE, INCOMING_FRAME_SP_OFFSET);
u = fold_convert (TREE_TYPE (count), u);
t = build2 (POINTER_PLUS_EXPR, TREE_TYPE (base), t, u);
- t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (base), base, t);
+ t = build2 (MODIFY_EXPR, TREE_TYPE (base), base, t);
TREE_SIDE_EFFECTS (t) = 1;
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
- t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (count), count,
+ t = build2 (MODIFY_EXPR, TREE_TYPE (count), count,
build_int_cst (NULL_TREE,
crtl->args.info * UNITS_PER_WORD));
TREE_SIDE_EFFECTS (t) = 1;
@@ -1366,8 +1366,8 @@ xstormy16_expand_builtin_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED)
Note: This algorithm is documented in stormy-abi. */
static tree
-xstormy16_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p,
- tree *post_p ATTRIBUTE_UNUSED)
+xstormy16_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p,
+ gimple_seq *post_p ATTRIBUTE_UNUSED)
{
tree f_base, f_count;
tree base, count;
@@ -1408,8 +1408,7 @@ xstormy16_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p,
gimplify_and_add (t, pre_p);
t = build2 (POINTER_PLUS_EXPR, ptr_type_node, base, count_tmp);
- t = build2 (GIMPLE_MODIFY_STMT, void_type_node, addr, t);
- gimplify_and_add (t, pre_p);
+ gimplify_assign (addr, t, pre_p);
t = build1 (GOTO_EXPR, void_type_node, lab_gotaddr);
gimplify_and_add (t, pre_p);
@@ -1427,7 +1426,7 @@ xstormy16_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p,
tree r, u;
r = size_int (NUM_ARGUMENT_REGISTERS * UNITS_PER_WORD);
- u = build2 (GIMPLE_MODIFY_STMT, void_type_node, count_tmp, r);
+ u = build2 (MODIFY_EXPR, TREE_TYPE (count_tmp), count_tmp, r);
t = fold_convert (TREE_TYPE (count), r);
t = build2 (GE_EXPR, boolean_type_node, count_tmp, t);
@@ -1444,16 +1443,14 @@ xstormy16_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p,
t = fold_convert (TREE_TYPE (t), fold (t));
t = fold_build1 (NEGATE_EXPR, TREE_TYPE (t), t);
t = build2 (POINTER_PLUS_EXPR, TREE_TYPE (base), base, t);
- t = build2 (GIMPLE_MODIFY_STMT, void_type_node, addr, t);
- gimplify_and_add (t, pre_p);
+ gimplify_assign (addr, t, pre_p);
t = build1 (LABEL_EXPR, void_type_node, lab_gotaddr);
gimplify_and_add (t, pre_p);
t = fold_convert (TREE_TYPE (count), size_tree);
t = build2 (PLUS_EXPR, TREE_TYPE (count), count_tmp, t);
- t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (count), count, t);
- gimplify_and_add (t, pre_p);
+ gimplify_assign (count, t, pre_p);
addr = fold_convert (build_pointer_type (type), addr);
return build_va_arg_indirect_ref (addr);
diff --git a/gcc/config/vax/vax.h b/gcc/config/vax/vax.h
index 68726ffcf2b..84a6ba4bd1a 100644
--- a/gcc/config/vax/vax.h
+++ b/gcc/config/vax/vax.h
@@ -642,10 +642,6 @@ enum reg_class { NO_REGS, ALL_REGS, LIM_REG_CLASSES };
so give the MEM rtx a byte's mode. */
#define FUNCTION_MODE QImode
-/* This machine doesn't use IEEE floats. */
-
-#define TARGET_FLOAT_FORMAT VAX_FLOAT_FORMAT
-
/* Specify the cost of a branch insn; roughly the number of extra insns that
should be added to avoid a branch.
diff --git a/gcc/config/xtensa/t-xtensa b/gcc/config/xtensa/t-xtensa
index b0a7e8115e4..da2e8345e16 100644
--- a/gcc/config/xtensa/t-xtensa
+++ b/gcc/config/xtensa/t-xtensa
@@ -22,4 +22,3 @@ $(T)crtn.o: $(srcdir)/config/xtensa/crtn.asm $(GCC_PASSES)
-c -o $(T)crtn.o -x assembler-with-cpp $(srcdir)/config/xtensa/crtn.asm
$(out_object_file): gt-xtensa.h
-gt-xtensa.h : s-gtype ; @true
diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c
index 6e26d76daad..0f6bbb50ed6 100644
--- a/gcc/config/xtensa/xtensa.c
+++ b/gcc/config/xtensa/xtensa.c
@@ -48,7 +48,7 @@ along with GCC; see the file COPYING3. If not see
#include "target.h"
#include "target-def.h"
#include "langhooks.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "df.h"
@@ -142,7 +142,9 @@ static section *xtensa_select_rtx_section (enum machine_mode, rtx,
static bool xtensa_rtx_costs (rtx, int, int, int *);
static tree xtensa_build_builtin_va_list (void);
static bool xtensa_return_in_memory (const_tree, const_tree);
-static tree xtensa_gimplify_va_arg_expr (tree, tree, tree *, tree *);
+static tree xtensa_gimplify_va_arg_expr (tree, tree, gimple_seq *,
+ gimple_seq *);
+static rtx xtensa_function_value (const_tree, const_tree, bool);
static void xtensa_init_builtins (void);
static tree xtensa_fold_builtin (tree, tree, bool);
static rtx xtensa_expand_builtin (tree, rtx, rtx, enum machine_mode, int);
@@ -192,6 +194,8 @@ static const int reg_nonleaf_alloc_order[FIRST_PSEUDO_REGISTER] =
#undef TARGET_RETURN_IN_MEMORY
#define TARGET_RETURN_IN_MEMORY xtensa_return_in_memory
+#undef TARGET_FUNCTION_VALUE
+#define TARGET_FUNCTION_VALUE xtensa_function_value
#undef TARGET_SPLIT_COMPLEX_ARG
#define TARGET_SPLIT_COMPLEX_ARG hook_bool_const_tree_true
#undef TARGET_MUST_PASS_IN_STACK
@@ -1026,8 +1030,10 @@ xtensa_copy_incoming_a7 (rtx opnd)
{
case DFmode:
case DImode:
- emit_insn (gen_movsi_internal (gen_rtx_SUBREG (SImode, tmp, 0),
- gen_rtx_REG (SImode, A7_REG - 1)));
+ /* Copy the value out of A7 here but keep the first word in A6 until
+ after the set_frame_ptr insn. Otherwise, the register allocator
+ may decide to put "subreg (tmp, 0)" in A7 and clobber the incoming
+ value. */
emit_insn (gen_movsi_internal (gen_rtx_SUBREG (SImode, tmp, 4),
gen_raw_REG (SImode, A7_REG)));
break;
@@ -1048,6 +1054,11 @@ xtensa_copy_incoming_a7 (rtx opnd)
}
cfun->machine->set_frame_ptr_insn = emit_insn (gen_set_frame_ptr ());
+
+ /* For DF and DI mode arguments, copy the incoming value in A6 now. */
+ if (mode == DFmode || mode == DImode)
+ emit_insn (gen_movsi_internal (gen_rtx_SUBREG (SImode, tmp, 0),
+ gen_rtx_REG (SImode, A7_REG - 1)));
entry_insns = get_insns ();
end_sequence ();
@@ -1306,10 +1317,10 @@ init_alignment_context (struct alignment_context *ac, rtx mem)
/* Expand an atomic compare and swap operation for HImode and QImode.
MEM is the memory location, CMP the old value to compare MEM with
- and NEW the value to set if CMP == MEM. */
+ and NEW_RTX the value to set if CMP == MEM. */
void
-xtensa_expand_compare_and_swap (rtx target, rtx mem, rtx cmp, rtx new)
+xtensa_expand_compare_and_swap (rtx target, rtx mem, rtx cmp, rtx new_rtx)
{
enum machine_mode mode = GET_MODE (mem);
struct alignment_context ac;
@@ -1324,7 +1335,7 @@ xtensa_expand_compare_and_swap (rtx target, rtx mem, rtx cmp, rtx new)
if (ac.shift != NULL_RTX)
{
cmp = xtensa_expand_mask_and_shift (cmp, mode, ac.shift);
- new = xtensa_expand_mask_and_shift (new, mode, ac.shift);
+ new_rtx = xtensa_expand_mask_and_shift (new_rtx, mode, ac.shift);
}
/* Load the surrounding word into VAL with the MEM value masked out. */
@@ -1333,10 +1344,10 @@ xtensa_expand_compare_and_swap (rtx target, rtx mem, rtx cmp, rtx new)
OPTAB_DIRECT));
emit_label (csloop);
- /* Patch CMP and NEW into VAL at correct position. */
+ /* Patch CMP and NEW_RTX into VAL at correct position. */
cmpv = force_reg (SImode, expand_simple_binop (SImode, IOR, cmp, val,
NULL_RTX, 1, OPTAB_DIRECT));
- newv = force_reg (SImode, expand_simple_binop (SImode, IOR, new, val,
+ newv = force_reg (SImode, expand_simple_binop (SImode, IOR, new_rtx, val,
NULL_RTX, 1, OPTAB_DIRECT));
/* Jump to end if we're done. */
@@ -1380,7 +1391,7 @@ xtensa_expand_atomic (enum rtx_code code, rtx target, rtx mem, rtx val,
rtx csloop = gen_label_rtx ();
rtx cmp, tmp;
rtx old = gen_reg_rtx (SImode);
- rtx new = gen_reg_rtx (SImode);
+ rtx new_rtx = gen_reg_rtx (SImode);
rtx orig = NULL_RTX;
init_alignment_context (&ac, mem);
@@ -1431,35 +1442,35 @@ xtensa_expand_atomic (enum rtx_code code, rtx target, rtx mem, rtx val,
tmp = expand_simple_binop (SImode, AND, old, ac.modemaski,
NULL_RTX, 1, OPTAB_DIRECT);
tmp = expand_simple_binop (SImode, IOR, tmp, val,
- new, 1, OPTAB_DIRECT);
+ new_rtx, 1, OPTAB_DIRECT);
break;
case AND:
case IOR:
case XOR:
tmp = expand_simple_binop (SImode, code, old, val,
- new, 1, OPTAB_DIRECT);
+ new_rtx, 1, OPTAB_DIRECT);
break;
case MULT: /* NAND */
tmp = expand_simple_binop (SImode, XOR, old, ac.modemask,
NULL_RTX, 1, OPTAB_DIRECT);
tmp = expand_simple_binop (SImode, AND, tmp, val,
- new, 1, OPTAB_DIRECT);
+ new_rtx, 1, OPTAB_DIRECT);
break;
default:
gcc_unreachable ();
}
- if (tmp != new)
- emit_move_insn (new, tmp);
- emit_insn (gen_sync_compare_and_swapsi (cmp, ac.memsi, old, new));
+ if (tmp != new_rtx)
+ emit_move_insn (new_rtx, tmp);
+ emit_insn (gen_sync_compare_and_swapsi (cmp, ac.memsi, old, new_rtx));
emit_cmp_and_jump_insns (cmp, old, NE, const0_rtx, SImode, true, csloop);
if (target)
{
- tmp = (after ? new : cmp);
+ tmp = (after ? new_rtx : cmp);
convert_move (target,
(ac.shift == NULL_RTX ? tmp
: expand_simple_binop (SImode, LSHIFTRT, tmp, ac.shift,
@@ -1880,7 +1891,7 @@ override_options (void)
mode = (enum machine_mode) ((int) mode + 1))
{
int size = GET_MODE_SIZE (mode);
- enum mode_class class = GET_MODE_CLASS (mode);
+ enum mode_class mclass = GET_MODE_CLASS (mode);
for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
{
@@ -1888,7 +1899,7 @@ override_options (void)
if (ACC_REG_P (regno))
temp = (TARGET_MAC16
- && (class == MODE_INT) && (size <= UNITS_PER_WORD));
+ && (mclass == MODE_INT) && (size <= UNITS_PER_WORD));
else if (GP_REG_P (regno))
temp = ((regno & 1) == 0 || (size <= UNITS_PER_WORD));
else if (FP_REG_P (regno))
@@ -2529,20 +2540,22 @@ xtensa_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED)
f_ndx = TREE_CHAIN (f_reg);
stk = build3 (COMPONENT_REF, TREE_TYPE (f_stk), valist, f_stk, NULL_TREE);
- reg = build3 (COMPONENT_REF, TREE_TYPE (f_reg), valist, f_reg, NULL_TREE);
- ndx = build3 (COMPONENT_REF, TREE_TYPE (f_ndx), valist, f_ndx, NULL_TREE);
+ reg = build3 (COMPONENT_REF, TREE_TYPE (f_reg), unshare_expr (valist),
+ f_reg, NULL_TREE);
+ ndx = build3 (COMPONENT_REF, TREE_TYPE (f_ndx), unshare_expr (valist),
+ f_ndx, NULL_TREE);
/* Call __builtin_saveregs; save the result in __va_reg */
u = make_tree (sizetype, expand_builtin_saveregs ());
u = fold_convert (ptr_type_node, u);
- t = build2 (GIMPLE_MODIFY_STMT, ptr_type_node, reg, u);
+ t = build2 (MODIFY_EXPR, ptr_type_node, reg, u);
TREE_SIDE_EFFECTS (t) = 1;
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
/* Set the __va_stk member to ($arg_ptr - 32). */
u = make_tree (ptr_type_node, virtual_incoming_args_rtx);
u = fold_build2 (POINTER_PLUS_EXPR, ptr_type_node, u, size_int (-32));
- t = build2 (GIMPLE_MODIFY_STMT, ptr_type_node, stk, u);
+ t = build2 (MODIFY_EXPR, ptr_type_node, stk, u);
TREE_SIDE_EFFECTS (t) = 1;
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
@@ -2551,7 +2564,7 @@ xtensa_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED)
alignment offset for __va_stk. */
if (arg_words >= MAX_ARGS_IN_REGISTERS)
arg_words += 2;
- t = build2 (GIMPLE_MODIFY_STMT, integer_type_node, ndx,
+ t = build2 (MODIFY_EXPR, integer_type_node, ndx,
build_int_cst (integer_type_node, arg_words * UNITS_PER_WORD));
TREE_SIDE_EFFECTS (t) = 1;
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
@@ -2561,8 +2574,8 @@ xtensa_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED)
/* Implement `va_arg'. */
static tree
-xtensa_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p,
- tree *post_p ATTRIBUTE_UNUSED)
+xtensa_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p,
+ gimple_seq *post_p ATTRIBUTE_UNUSED)
{
tree f_stk, stk;
tree f_reg, reg;
@@ -2584,7 +2597,8 @@ xtensa_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p,
pre_p, NULL);
real_part = get_initialized_tmp_var (real_part, pre_p, NULL);
- imag_part = xtensa_gimplify_va_arg_expr (valist, TREE_TYPE (type),
+ imag_part = xtensa_gimplify_va_arg_expr (unshare_expr (valist),
+ TREE_TYPE (type),
pre_p, NULL);
imag_part = get_initialized_tmp_var (imag_part, pre_p, NULL);
@@ -2595,9 +2609,12 @@ xtensa_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p,
f_reg = TREE_CHAIN (f_stk);
f_ndx = TREE_CHAIN (f_reg);
- stk = build3 (COMPONENT_REF, TREE_TYPE (f_stk), valist, f_stk, NULL_TREE);
- reg = build3 (COMPONENT_REF, TREE_TYPE (f_reg), valist, f_reg, NULL_TREE);
- ndx = build3 (COMPONENT_REF, TREE_TYPE (f_ndx), valist, f_ndx, NULL_TREE);
+ stk = build3 (COMPONENT_REF, TREE_TYPE (f_stk), valist,
+ f_stk, NULL_TREE);
+ reg = build3 (COMPONENT_REF, TREE_TYPE (f_reg), unshare_expr (valist),
+ f_reg, NULL_TREE);
+ ndx = build3 (COMPONENT_REF, TREE_TYPE (f_ndx), unshare_expr (valist),
+ f_ndx, NULL_TREE);
type_size = size_in_bytes (type);
va_size = round_up (type_size, UNITS_PER_WORD);
@@ -2617,12 +2634,11 @@ xtensa_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p,
{
int align = MIN (TYPE_ALIGN (type), STACK_BOUNDARY) / BITS_PER_UNIT;
- t = build2 (PLUS_EXPR, integer_type_node, orig_ndx,
+ t = build2 (PLUS_EXPR, integer_type_node, unshare_expr (orig_ndx),
build_int_cst (integer_type_node, align - 1));
t = build2 (BIT_AND_EXPR, integer_type_node, t,
build_int_cst (integer_type_node, -align));
- t = build2 (GIMPLE_MODIFY_STMT, integer_type_node, orig_ndx, t);
- gimplify_and_add (t, pre_p);
+ gimplify_assign (unshare_expr (orig_ndx), t, pre_p);
}
@@ -2632,8 +2648,7 @@ xtensa_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p,
t = fold_convert (integer_type_node, va_size);
t = build2 (PLUS_EXPR, integer_type_node, orig_ndx, t);
- t = build2 (GIMPLE_MODIFY_STMT, integer_type_node, ndx, t);
- gimplify_and_add (t, pre_p);
+ gimplify_assign (unshare_expr (ndx), t, pre_p);
/* Check if the argument is in registers:
@@ -2650,7 +2665,7 @@ xtensa_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p,
lab_false = create_artificial_label ();
lab_over = create_artificial_label ();
- t = build2 (GT_EXPR, boolean_type_node, ndx,
+ t = build2 (GT_EXPR, boolean_type_node, unshare_expr (ndx),
build_int_cst (integer_type_node,
MAX_ARGS_IN_REGISTERS * UNITS_PER_WORD));
t = build3 (COND_EXPR, void_type_node, t,
@@ -2658,8 +2673,7 @@ xtensa_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p,
NULL_TREE);
gimplify_and_add (t, pre_p);
- t = build2 (GIMPLE_MODIFY_STMT, void_type_node, array, reg);
- gimplify_and_add (t, pre_p);
+ gimplify_assign (unshare_expr (array), reg, pre_p);
t = build1 (GOTO_EXPR, void_type_node, lab_over);
gimplify_and_add (t, pre_p);
@@ -2681,7 +2695,7 @@ xtensa_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p,
lab_false2 = create_artificial_label ();
- t = build2 (GT_EXPR, boolean_type_node, orig_ndx,
+ t = build2 (GT_EXPR, boolean_type_node, unshare_expr (orig_ndx),
build_int_cst (integer_type_node,
MAX_ARGS_IN_REGISTERS * UNITS_PER_WORD));
t = build3 (COND_EXPR, void_type_node, t,
@@ -2689,16 +2703,14 @@ xtensa_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p,
NULL_TREE);
gimplify_and_add (t, pre_p);
- t = size_binop (PLUS_EXPR, va_size, size_int (32));
+ t = size_binop (PLUS_EXPR, unshare_expr (va_size), size_int (32));
t = fold_convert (integer_type_node, t);
- t = build2 (GIMPLE_MODIFY_STMT, integer_type_node, ndx, t);
- gimplify_and_add (t, pre_p);
+ gimplify_assign (unshare_expr (ndx), t, pre_p);
t = build1 (LABEL_EXPR, void_type_node, lab_false2);
gimplify_and_add (t, pre_p);
- t = build2 (GIMPLE_MODIFY_STMT, void_type_node, array, stk);
- gimplify_and_add (t, pre_p);
+ gimplify_assign (array, stk, pre_p);
if (lab_over)
{
@@ -2720,17 +2732,18 @@ xtensa_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p,
if (BYTES_BIG_ENDIAN && TREE_CODE (type_size) == INTEGER_CST)
{
- t = fold_build2 (GE_EXPR, boolean_type_node, type_size,
+ t = fold_build2 (GE_EXPR, boolean_type_node, unshare_expr (type_size),
size_int (PARM_BOUNDARY / BITS_PER_UNIT));
- t = fold_build3 (COND_EXPR, sizetype, t, va_size, type_size);
+ t = fold_build3 (COND_EXPR, sizetype, t, unshare_expr (va_size),
+ unshare_expr (type_size));
size = t;
}
else
- size = va_size;
+ size = unshare_expr (va_size);
- t = fold_convert (sizetype, ndx);
+ t = fold_convert (sizetype, unshare_expr (ndx));
t = build2 (MINUS_EXPR, sizetype, t, size);
- addr = build2 (POINTER_PLUS_EXPR, ptr_type_node, array, t);
+ addr = build2 (POINTER_PLUS_EXPR, ptr_type_node, unshare_expr (array), t);
addr = fold_convert (build_pointer_type (type), addr);
if (indirect)
@@ -2808,7 +2821,7 @@ xtensa_expand_builtin (tree exp, rtx target,
enum reg_class
-xtensa_preferred_reload_class (rtx x, enum reg_class class, int isoutput)
+xtensa_preferred_reload_class (rtx x, enum reg_class rclass, int isoutput)
{
if (!isoutput && CONSTANT_P (x) && GET_CODE (x) == CONST_DOUBLE)
return NO_REGS;
@@ -2819,15 +2832,15 @@ xtensa_preferred_reload_class (rtx x, enum reg_class class, int isoutput)
won't know that it is live because the hard frame pointer is
treated specially. */
- if (class == AR_REGS || class == GR_REGS)
+ if (rclass == AR_REGS || rclass == GR_REGS)
return RL_REGS;
- return class;
+ return rclass;
}
enum reg_class
-xtensa_secondary_reload_class (enum reg_class class,
+xtensa_secondary_reload_class (enum reg_class rclass,
enum machine_mode mode ATTRIBUTE_UNUSED,
rtx x, int isoutput)
{
@@ -2839,14 +2852,14 @@ xtensa_secondary_reload_class (enum reg_class class,
if (!isoutput)
{
- if ((class == FP_REGS || GET_MODE_SIZE (mode) < UNITS_PER_WORD)
+ if ((rclass == FP_REGS || GET_MODE_SIZE (mode) < UNITS_PER_WORD)
&& constantpool_mem_p (x))
return RL_REGS;
}
if (ACC_REG_P (regno))
- return ((class == GR_REGS || class == RL_REGS) ? NO_REGS : RL_REGS);
- if (class == ACC_REG)
+ return ((rclass == GR_REGS || rclass == RL_REGS) ? NO_REGS : RL_REGS);
+ if (rclass == ACC_REG)
return (GP_REG_P (regno) ? NO_REGS : RL_REGS);
return NO_REGS;
@@ -3163,6 +3176,17 @@ xtensa_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
> 4 * UNITS_PER_WORD);
}
+/* Worker function for TARGET_FUNCTION_VALUE. */
+
+rtx
+xtensa_function_value (const_tree valtype, const_tree func ATTRIBUTE_UNUSED,
+ bool outgoing)
+{
+ return gen_rtx_REG ((INTEGRAL_TYPE_P (valtype)
+ && TYPE_PRECISION (valtype) < BITS_PER_WORD)
+ ? SImode : TYPE_MODE (valtype),
+ outgoing ? GP_OUTGOING_RETURN : GP_RETURN);
+}
/* TRAMPOLINE_TEMPLATE: For Xtensa, the trampoline must perform an ENTRY
instruction with a minimal stack frame in order to get some free
diff --git a/gcc/config/xtensa/xtensa.h b/gcc/config/xtensa/xtensa.h
index eaef97e2094..920f9d2ef18 100644
--- a/gcc/config/xtensa/xtensa.h
+++ b/gcc/config/xtensa/xtensa.h
@@ -608,22 +608,6 @@ extern const enum reg_class xtensa_regno_to_class[FIRST_PSEUDO_REGISTER];
#define LIBCALL_OUTGOING_VALUE(MODE) \
XTENSA_LIBCALL_VALUE ((MODE), 1)
-/* Define how to find the value returned by a function.
- VALTYPE is the data type of the value (as a tree).
- If the precise function being called is known, FUNC is its FUNCTION_DECL;
- otherwise, FUNC is 0. */
-#define XTENSA_FUNCTION_VALUE(VALTYPE, FUNC, OUTGOINGP) \
- gen_rtx_REG ((INTEGRAL_TYPE_P (VALTYPE) \
- && TYPE_PRECISION (VALTYPE) < BITS_PER_WORD) \
- ? SImode: TYPE_MODE (VALTYPE), \
- OUTGOINGP ? GP_OUTGOING_RETURN : GP_RETURN)
-
-#define FUNCTION_VALUE(VALTYPE, FUNC) \
- XTENSA_FUNCTION_VALUE (VALTYPE, FUNC, 0)
-
-#define FUNCTION_OUTGOING_VALUE(VALTYPE, FUNC) \
- XTENSA_FUNCTION_VALUE (VALTYPE, FUNC, 1)
-
/* A C expression that is nonzero if REGNO is the number of a hard
register in which the values of called function may come back. A
register whose use for returning values is limited to serving as
diff --git a/gcc/configure b/gcc/configure
index 09d2768e669..f136d57431a 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -458,7 +458,7 @@ ac_includes_default="\
# include <unistd.h>
#endif"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os target_noncanonical build_libsubdir build_subdir host_subdir target_subdir GENINSRC CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT GNATBIND ac_ct_GNATBIND GNATMAKE ac_ct_GNATMAKE NO_MINUS_C_MINUS_O OUTPUT_OPTION CPP EGREP loose_warn strict_warn warn_cflags nocommon_flag TREEBROWSER valgrind_path valgrind_path_defines valgrind_command coverage_flags enable_multilib enable_decimal_float enable_fixed_point enable_shared TARGET_SYSTEM_ROOT TARGET_SYSTEM_ROOT_DEFINE CROSS_SYSTEM_HEADER_DIR onestep PKGVERSION REPORT_BUGS_TO REPORT_BUGS_TEXI datarootdir docdir htmldir SET_MAKE AWK LN_S LN RANLIB ac_ct_RANLIB ranlib_flags INSTALL INSTALL_PROGRAM INSTALL_DATA make_compare_target have_mktemp_command MAKEINFO BUILD_INFO GENERATED_MANPAGES FLEX BISON NM AR COLLECT2_LIBS GNAT_LIBEXC LDEXP_LIB TARGET_GETGROUPS_T LIBICONV LTLIBICONV LIBICONV_DEP manext objext gthread_flags extra_modes_file extra_opt_files USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS DATADIRNAME INSTOBJEXT GENCAT CATOBJEXT host_cc_for_libada CROSS ALL SYSTEM_HEADER_DIR inhibit_libc CC_FOR_BUILD BUILD_CFLAGS BUILD_LDFLAGS STMP_FIXINC STMP_FIXPROTO collect2 LIBTOOL SED FGREP GREP LD DUMPBIN ac_ct_DUMPBIN ac_ct_AR STRIP ac_ct_STRIP lt_ECHO objdir enable_fast_install gcc_cv_as ORIGINAL_AS_FOR_TARGET gcc_cv_ld ORIGINAL_LD_FOR_TARGET gcc_cv_nm ORIGINAL_NM_FOR_TARGET gcc_cv_objdump libgcc_visibility GGC zlibdir zlibinc MAINT gcc_tooldir dollar slibdir subdirs srcdir all_compilers all_gtfiles all_lang_makefrags all_lang_makefiles all_languages all_selected_languages build_exeext build_install_headers_dir build_xm_file_list build_xm_include_list build_xm_defines build_file_translate check_languages cpp_install_dir xmake_file tmake_file extra_gcc_objs extra_headers_list extra_objs extra_parts extra_passes extra_programs float_h_file gcc_config_arguments gcc_gxx_include_dir host_exeext host_xm_file_list host_xm_include_list host_xm_defines out_host_hook_obj install lang_opt_files lang_specs_files lang_tree_files local_prefix md_file objc_boehm_gc out_file out_object_file thread_file tm_file_list tm_include_list tm_defines tm_p_file_list tm_p_include_list xm_file_list xm_include_list xm_defines c_target_objs cxx_target_objs fortran_target_objs target_cpu_default GMPLIBS GMPINC LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os target_noncanonical build_libsubdir build_subdir host_subdir target_subdir GENINSRC CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT GNATBIND ac_ct_GNATBIND GNATMAKE ac_ct_GNATMAKE NO_MINUS_C_MINUS_O OUTPUT_OPTION CPP EGREP loose_warn strict_warn warn_cflags nocommon_flag TREEBROWSER valgrind_path valgrind_path_defines valgrind_command coverage_flags enable_multilib enable_decimal_float enable_fixed_point enable_shared TARGET_SYSTEM_ROOT TARGET_SYSTEM_ROOT_DEFINE CROSS_SYSTEM_HEADER_DIR onestep PKGVERSION REPORT_BUGS_TO REPORT_BUGS_TEXI datarootdir docdir htmldir SET_MAKE AWK LN_S LN RANLIB ac_ct_RANLIB ranlib_flags INSTALL INSTALL_PROGRAM INSTALL_DATA make_compare_target have_mktemp_command MAKEINFO BUILD_INFO GENERATED_MANPAGES FLEX BISON NM AR COLLECT2_LIBS GNAT_LIBEXC LDEXP_LIB TARGET_GETGROUPS_T LIBICONV LTLIBICONV LIBICONV_DEP manext objext gthread_flags extra_modes_file extra_opt_files USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS DATADIRNAME INSTOBJEXT GENCAT CATOBJEXT CROSS ALL SYSTEM_HEADER_DIR inhibit_libc CC_FOR_BUILD BUILD_CFLAGS BUILD_LDFLAGS STMP_FIXINC STMP_FIXPROTO collect2 LIBTOOL SED FGREP GREP LD DUMPBIN ac_ct_DUMPBIN ac_ct_AR STRIP ac_ct_STRIP lt_ECHO objdir enable_fast_install gcc_cv_as ORIGINAL_AS_FOR_TARGET gcc_cv_ld ORIGINAL_LD_FOR_TARGET gcc_cv_nm ORIGINAL_NM_FOR_TARGET gcc_cv_objdump libgcc_visibility GGC zlibdir zlibinc MAINT gcc_tooldir dollar slibdir subdirs srcdir all_compilers all_gtfiles all_lang_makefrags all_lang_makefiles all_languages all_selected_languages build_exeext build_install_headers_dir build_xm_file_list build_xm_include_list build_xm_defines build_file_translate check_languages cpp_install_dir xmake_file tmake_file extra_gcc_objs extra_headers_list extra_objs extra_parts extra_passes extra_programs float_h_file gcc_config_arguments gcc_gxx_include_dir host_exeext host_xm_file_list host_xm_include_list host_xm_defines out_host_hook_obj install lang_opt_files lang_specs_files lang_tree_files local_prefix md_file objc_boehm_gc out_file out_object_file thread_file tm_file_list tm_include_list tm_defines tm_p_file_list tm_p_include_list xm_file_list xm_include_list xm_defines c_target_objs cxx_target_objs fortran_target_objs target_cpu_default GMPLIBS GMPINC LIBOBJS LTLIBOBJS'
ac_subst_files='language_hooks'
ac_pwd=`pwd`
@@ -1017,7 +1017,7 @@ Optional Features:
enable expensive run-time checks. With LIST,
enable only specific categories of checks.
Categories are: yes,no,all,none,release.
- Flags are: assert,df,fold,gc,gcac,misc,
+ Flags are: assert,df,fold,gc,gcac,gimple,misc,
rtlflag,rtl,runtime,tree,valgrind,types.
--enable-coverage=LEVEL
enable compiler's code coverage collection.
@@ -7014,8 +7014,7 @@ fi
loose_warn=
save_CFLAGS="$CFLAGS"
-for option in -W -Wall -Wwrite-strings -Wstrict-prototypes \
- -Wmissing-prototypes -Wcast-qual; do
+for option in -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual; do
as_acx_Woption=`echo "acx_cv_prog_cc_warning_$option" | $as_tr_sh`
echo "$as_me:$LINENO: checking whether $CC supports $option" >&5
@@ -7082,8 +7081,7 @@ CFLAGS="$save_CFLAGS"
strict_warn=
save_CFLAGS="$CFLAGS"
-for option in -Wold-style-definition -Wc++-compat \
- -Wmissing-format-attribute; do
+for option in -Wold-style-definition -Wc++-compat -Wmissing-format-attribute; do
as_acx_Woption=`echo "acx_cv_prog_cc_warning_$option" | $as_tr_sh`
echo "$as_me:$LINENO: checking whether $CC supports $option" >&5
@@ -7149,16 +7147,13 @@ fi
CFLAGS="$save_CFLAGS"
if test "$GCC" = yes; then
- echo "$as_me:$LINENO: checking whether $CC supports -pedantic -Wno-long-long -Wno-variadic-macros \
- -Wno-overlength-strings" >&5
-echo $ECHO_N "checking whether $CC supports -pedantic -Wno-long-long -Wno-variadic-macros \
- -Wno-overlength-strings... $ECHO_C" >&6
-if test "${acx_cv_prog_cc_pedantic__Wno_long_long__Wno_variadic_macros_____________Wno_overlength_strings+set}" = set; then
+ echo "$as_me:$LINENO: checking whether $CC supports -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings" >&5
+echo $ECHO_N "checking whether $CC supports -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings... $ECHO_C" >&6
+if test "${acx_cv_prog_cc_pedantic_m4_do__Wno_long_long__Wno_variadic_macros_____________Wno_overlength_strings_+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
save_CFLAGS="$CFLAGS"
-CFLAGS="-pedantic -Wno-long-long -Wno-variadic-macros \
- -Wno-overlength-strings"
+CFLAGS="-pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -7196,21 +7191,20 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- acx_cv_prog_cc_pedantic__Wno_long_long__Wno_variadic_macros_____________Wno_overlength_strings=yes
+ acx_cv_prog_cc_pedantic_m4_do__Wno_long_long__Wno_variadic_macros_____________Wno_overlength_strings_=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-acx_cv_prog_cc_pedantic__Wno_long_long__Wno_variadic_macros_____________Wno_overlength_strings=no
+acx_cv_prog_cc_pedantic_m4_do__Wno_long_long__Wno_variadic_macros_____________Wno_overlength_strings_=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
CFLAGS="$save_CFLAGS"
fi
-echo "$as_me:$LINENO: result: $acx_cv_prog_cc_pedantic__Wno_long_long__Wno_variadic_macros_____________Wno_overlength_strings" >&5
-echo "${ECHO_T}$acx_cv_prog_cc_pedantic__Wno_long_long__Wno_variadic_macros_____________Wno_overlength_strings" >&6
-if test $acx_cv_prog_cc_pedantic__Wno_long_long__Wno_variadic_macros_____________Wno_overlength_strings = yes; then
- strict_warn="$strict_warn${strict_warn:+ }-pedantic -Wno-long-long -Wno-variadic-macros \
- -Wno-overlength-strings"
+echo "$as_me:$LINENO: result: $acx_cv_prog_cc_pedantic_m4_do__Wno_long_long__Wno_variadic_macros_____________Wno_overlength_strings_" >&5
+echo "${ECHO_T}$acx_cv_prog_cc_pedantic_m4_do__Wno_long_long__Wno_variadic_macros_____________Wno_overlength_strings_" >&6
+if test $acx_cv_prog_cc_pedantic_m4_do__Wno_long_long__Wno_variadic_macros_____________Wno_overlength_strings_ = yes; then
+ strict_warn="$strict_warn${strict_warn:+ }-pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings"
fi
@@ -7266,25 +7260,25 @@ do
# these set all the flags to specific states
yes) ac_assert_checking=1 ; ac_checking=1 ; ac_df_checking= ;
ac_fold_checking= ; ac_gc_checking=1 ;
- ac_gc_always_collect= ; ac_rtl_checking= ;
+ ac_gc_always_collect= ; ac_gimple_checking=1 ; ac_rtl_checking= ;
ac_rtlflag_checking=1 ; ac_runtime_checking=1 ;
ac_tree_checking=1 ; ac_valgrind_checking= ;
ac_types_checking=1 ;;
no|none) ac_assert_checking= ; ac_checking= ; ac_df_checking= ;
ac_fold_checking= ; ac_gc_checking= ;
- ac_gc_always_collect= ; ac_rtl_checking= ;
+ ac_gc_always_collect= ; ac_gimple_checking= ; ac_rtl_checking= ;
ac_rtlflag_checking= ; ac_runtime_checking= ;
ac_tree_checking= ; ac_valgrind_checking= ;
ac_types_checking= ;;
all) ac_assert_checking=1 ; ac_checking=1 ; ac_df_checking=1 ;
ac_fold_checking=1 ; ac_gc_checking=1 ;
- ac_gc_always_collect=1 ; ac_rtl_checking=1 ;
+ ac_gc_always_collect=1 ; ac_gimple_checking=1 ; ac_rtl_checking=1 ;
ac_rtlflag_checking=1 ; ac_runtime_checking=1 ;
ac_tree_checking=1 ; ac_valgrind_checking= ;
ac_types_checking=1 ;;
release) ac_assert_checking=1 ; ac_checking= ; ac_df_checking= ;
ac_fold_checking= ; ac_gc_checking= ;
- ac_gc_always_collect= ; ac_rtl_checking= ;
+ ac_gc_always_collect= ; ac_gimple_checking= ; ac_rtl_checking= ;
ac_rtlflag_checking= ; ac_runtime_checking=1 ;
ac_tree_checking= ; ac_valgrind_checking= ;
ac_types_checking= ;;
@@ -7294,6 +7288,7 @@ do
fold) ac_fold_checking=1 ;;
gc) ac_gc_checking=1 ;;
gcac) ac_gc_always_collect=1 ;;
+ gimple) ac_gimple_checking=1 ;;
misc) ac_checking=1 ;;
rtl) ac_rtl_checking=1 ;;
rtlflag) ac_rtlflag_checking=1 ;;
@@ -7332,6 +7327,13 @@ cat >>confdefs.h <<\_ACEOF
_ACEOF
fi
+if test x$ac_gimple_checking != x ; then
+
+cat >>confdefs.h <<\_ACEOF
+#define ENABLE_GIMPLE_CHECKING 1
+_ACEOF
+
+fi
if test x$ac_runtime_checking != x ; then
@@ -8541,7 +8543,7 @@ else
case $ac_prog_version in
'') gcc_cv_prog_makeinfo_modern=no;;
- 4.[4-9]*|4.[1-9][0-9]*|[5-9]*|[1-9][0-9]*) gcc_cv_prog_makeinfo_modern=yes;;
+ 4.[7-9]*|4.[1-9][0-9]*|[5-9]*|[1-9][0-9]*) gcc_cv_prog_makeinfo_modern=yes;;
*) gcc_cv_prog_makeinfo_modern=no;;
esac
@@ -13962,10 +13964,6 @@ do
done
tmake_file="${tmake_file_}"
-# This is a terrible hack which will go away some day.
-host_cc_for_libada=${CC}
-
-
out_object_file=`basename $out_file .c`.o
tm_file_list="options.h"
@@ -14723,13 +14721,13 @@ if test "${lt_cv_nm_interface+set}" = set; then
else
lt_cv_nm_interface="BSD nm"
echo "int some_variable = 0;" > conftest.$ac_ext
- (eval echo "\"\$as_me:14726: $ac_compile\"" >&5)
+ (eval echo "\"\$as_me:14724: $ac_compile\"" >&5)
(eval "$ac_compile" 2>conftest.err)
cat conftest.err >&5
- (eval echo "\"\$as_me:14729: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+ (eval echo "\"\$as_me:14727: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
cat conftest.err >&5
- (eval echo "\"\$as_me:14732: output\"" >&5)
+ (eval echo "\"\$as_me:14730: output\"" >&5)
cat conftest.out >&5
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
lt_cv_nm_interface="MS dumpbin"
@@ -15784,7 +15782,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 15787 "configure"' > conftest.$ac_ext
+ echo '#line 15785 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -16404,11 +16402,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:16407: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:16405: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:16411: \$? = $ac_status" >&5
+ echo "$as_me:16409: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -16726,11 +16724,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:16729: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:16727: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:16733: \$? = $ac_status" >&5
+ echo "$as_me:16731: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -16831,11 +16829,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:16834: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:16832: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:16838: \$? = $ac_status" >&5
+ echo "$as_me:16836: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -16886,11 +16884,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:16889: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:16887: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:16893: \$? = $ac_status" >&5
+ echo "$as_me:16891: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -19683,7 +19681,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 19686 "configure"
+#line 19684 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -19783,7 +19781,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 19786 "configure"
+#line 19784 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -20834,6 +20832,91 @@ _ACEOF
fi
+# Check if we have assembler support for unwind directives.
+echo "$as_me:$LINENO: checking assembler for cfi directives" >&5
+echo $ECHO_N "checking assembler for cfi directives... $ECHO_C" >&6
+if test "${gcc_cv_as_cfi_directive+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ gcc_cv_as_cfi_directive=no
+ if test $in_tree_gas = yes; then
+ if test $in_tree_gas_is_elf = yes \
+ && test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 17 \) \* 1000 + 0`
+ then gcc_cv_as_cfi_directive=yes
+fi
+ elif test x$gcc_cv_as != x; then
+ echo ' .text
+ .cfi_startproc
+ .cfi_offset 0, 0
+ .cfi_same_value 1
+ .cfi_def_cfa 1, 2
+ .cfi_escape 1, 2, 3, 4, 5
+ .cfi_endproc' > conftest.s
+ if { ac_try='$gcc_cv_as -o conftest.o conftest.s >&5'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }
+ then
+ gcc_cv_as_cfi_directive=yes
+ else
+ echo "configure: failed program was" >&5
+ cat conftest.s >&5
+ fi
+ rm -f conftest.o conftest.s
+ fi
+fi
+echo "$as_me:$LINENO: result: $gcc_cv_as_cfi_directive" >&5
+echo "${ECHO_T}$gcc_cv_as_cfi_directive" >&6
+
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_GAS_CFI_DIRECTIVE `if test $gcc_cv_as_cfi_directive = yes; then echo 1; else echo 0; fi`
+_ACEOF
+
+
+echo "$as_me:$LINENO: checking assembler for cfi personality directive" >&5
+echo $ECHO_N "checking assembler for cfi personality directive... $ECHO_C" >&6
+if test "${gcc_cv_as_cfi_personality_directive+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ gcc_cv_as_cfi_personality_directive=no
+ if test $in_tree_gas = yes; then
+ if test $in_tree_gas_is_elf = yes \
+ && test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 17 \) \* 1000 + 0`
+ then gcc_cv_as_cfi_personality_directive=yes
+fi
+ elif test x$gcc_cv_as != x; then
+ echo ' .text
+ .cfi_startproc,
+ .cfi_personality 0, symbol
+ .cfi_endproc' > conftest.s
+ if { ac_try='$gcc_cv_as -o conftest.o conftest.s >&5'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }
+ then
+ gcc_cv_as_cfi_personality_directive=yes
+ else
+ echo "configure: failed program was" >&5
+ cat conftest.s >&5
+ fi
+ rm -f conftest.o conftest.s
+ fi
+fi
+echo "$as_me:$LINENO: result: $gcc_cv_as_cfi_personality_directive" >&5
+echo "${ECHO_T}$gcc_cv_as_cfi_personality_directive" >&6
+
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_GAS_CFI_PERSONALITY_DIRECTIVE `if test $gcc_cv_as_cfi_personality_directive = yes;
+ then echo 1; else echo 0; fi`
+_ACEOF
+
+
# GAS versions up to and including 2.11.0 may mis-optimize
# .eh_frame data.
echo "$as_me:$LINENO: checking assembler for eh_frame optimization" >&5
@@ -22540,6 +22623,52 @@ _ACEOF
fi
+ case $target in
+ *-*-aix*) conftest_s=' .machine "pwr7"
+ .csect .text[PR]
+ lxvd2x 1,2,3';;
+ *) conftest_s=' .machine power7
+ .text
+ lxvd2x 1,2,3';;
+ esac
+
+ echo "$as_me:$LINENO: checking assembler for vector-scalar support" >&5
+echo $ECHO_N "checking assembler for vector-scalar support... $ECHO_C" >&6
+if test "${gcc_cv_as_powerpc_vsx+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ gcc_cv_as_powerpc_vsx=no
+ if test $in_tree_gas = yes; then
+ if test $gcc_cv_gas_vers -ge `expr \( \( 9 \* 1000 \) + 99 \) \* 1000 + 0`
+ then gcc_cv_as_powerpc_vsx=yes
+fi
+ elif test x$gcc_cv_as != x; then
+ echo "$conftest_s" > conftest.s
+ if { ac_try='$gcc_cv_as -a32 -o conftest.o conftest.s >&5'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }
+ then
+ gcc_cv_as_powerpc_vsx=yes
+ else
+ echo "configure: failed program was" >&5
+ cat conftest.s >&5
+ fi
+ rm -f conftest.o conftest.s
+ fi
+fi
+echo "$as_me:$LINENO: result: $gcc_cv_as_powerpc_vsx" >&5
+echo "${ECHO_T}$gcc_cv_as_powerpc_vsx" >&6
+if test $gcc_cv_as_powerpc_vsx = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_AS_VSX 1
+_ACEOF
+
+fi
+
echo "$as_me:$LINENO: checking assembler for .gnu_attribute support" >&5
echo $ECHO_N "checking assembler for .gnu_attribute support... $ECHO_C" >&6
if test "${gcc_cv_as_powerpc_gnu_attribute+set}" = set; then
@@ -22757,7 +22886,7 @@ esac
case "$target" in
i?86*-*-* | mips*-*-* | alpha*-*-* | powerpc*-*-* | sparc*-*-* | m68*-*-* \
| x86_64*-*-* | hppa*-*-* | arm*-*-* \
- | xstormy16*-*-* | cris-*-* | xtensa-*-* | bfin-*-* | score*-*-* \
+ | xstormy16*-*-* | cris-*-* | xtensa*-*-* | bfin-*-* | score*-*-* \
| spu-*-* | fido*-*-*)
insn="nop"
;;
@@ -23585,7 +23714,7 @@ lang_tree_files=
# `language' must be a single word so is spelled singularly.
all_languages=
all_compilers=
-all_outputs='Makefile gccbug libada-mk'
+all_outputs='Makefile gccbug'
# List of language makefile fragments.
all_lang_makefrags=
# List of language subdirectory makefiles. Deprecated.
@@ -24612,7 +24741,6 @@ s,@DATADIRNAME@,$DATADIRNAME,;t t
s,@INSTOBJEXT@,$INSTOBJEXT,;t t
s,@GENCAT@,$GENCAT,;t t
s,@CATOBJEXT@,$CATOBJEXT,;t t
-s,@host_cc_for_libada@,$host_cc_for_libada,;t t
s,@CROSS@,$CROSS,;t t
s,@ALL@,$ALL,;t t
s,@SYSTEM_HEADER_DIR@,$SYSTEM_HEADER_DIR,;t t
diff --git a/gcc/configure.ac b/gcc/configure.ac
index d5244bd3800..a0e3f56767b 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -322,12 +322,15 @@ AC_CHECK_TYPES([__int64], [AC_CHECK_SIZEOF(__int64)])
# * overlong strings
# So, we only use -pedantic if we can disable those warnings.
-ACX_PROG_CC_WARNING_OPTS([-W -Wall -Wwrite-strings -Wstrict-prototypes \
- -Wmissing-prototypes -Wcast-qual], [loose_warn])
-ACX_PROG_CC_WARNING_OPTS([-Wold-style-definition -Wc++-compat \
- -Wmissing-format-attribute], [strict_warn])
-ACX_PROG_CC_WARNING_ALMOST_PEDANTIC([-Wno-long-long -Wno-variadic-macros \
- -Wno-overlength-strings], [strict_warn])
+ACX_PROG_CC_WARNING_OPTS(
+ [m4_do([-W -Wall -Wwrite-strings -Wstrict-prototypes ],
+ [-Wmissing-prototypes -Wcast-qual])], [loose_warn])
+ACX_PROG_CC_WARNING_OPTS(
+ [m4_do([-Wold-style-definition -Wc++-compat ],
+ [-Wmissing-format-attribute])], [strict_warn])
+ACX_PROG_CC_WARNING_ALMOST_PEDANTIC(
+ [m4_do([-Wno-long-long -Wno-variadic-macros ],
+ [-Wno-overlength-strings])], [strict_warn])
ACX_PROG_CC_WARNINGS_ARE_ERRORS([manual], [strict_warn])
# The above macros do nothing if the compiler is not GCC. However, the
@@ -350,7 +353,7 @@ AC_ARG_ENABLE(checking,
enable expensive run-time checks. With LIST,
enable only specific categories of checks.
Categories are: yes,no,all,none,release.
- Flags are: assert,df,fold,gc,gcac,misc,
+ Flags are: assert,df,fold,gc,gcac,gimple,misc,
rtlflag,rtl,runtime,tree,valgrind,types.],
[ac_checking_flags="${enableval}"],[
# Determine the default checks.
@@ -366,25 +369,25 @@ do
# these set all the flags to specific states
yes) ac_assert_checking=1 ; ac_checking=1 ; ac_df_checking= ;
ac_fold_checking= ; ac_gc_checking=1 ;
- ac_gc_always_collect= ; ac_rtl_checking= ;
+ ac_gc_always_collect= ; ac_gimple_checking=1 ; ac_rtl_checking= ;
ac_rtlflag_checking=1 ; ac_runtime_checking=1 ;
ac_tree_checking=1 ; ac_valgrind_checking= ;
ac_types_checking=1 ;;
no|none) ac_assert_checking= ; ac_checking= ; ac_df_checking= ;
ac_fold_checking= ; ac_gc_checking= ;
- ac_gc_always_collect= ; ac_rtl_checking= ;
+ ac_gc_always_collect= ; ac_gimple_checking= ; ac_rtl_checking= ;
ac_rtlflag_checking= ; ac_runtime_checking= ;
ac_tree_checking= ; ac_valgrind_checking= ;
ac_types_checking= ;;
all) ac_assert_checking=1 ; ac_checking=1 ; ac_df_checking=1 ;
ac_fold_checking=1 ; ac_gc_checking=1 ;
- ac_gc_always_collect=1 ; ac_rtl_checking=1 ;
+ ac_gc_always_collect=1 ; ac_gimple_checking=1 ; ac_rtl_checking=1 ;
ac_rtlflag_checking=1 ; ac_runtime_checking=1 ;
ac_tree_checking=1 ; ac_valgrind_checking= ;
ac_types_checking=1 ;;
release) ac_assert_checking=1 ; ac_checking= ; ac_df_checking= ;
ac_fold_checking= ; ac_gc_checking= ;
- ac_gc_always_collect= ; ac_rtl_checking= ;
+ ac_gc_always_collect= ; ac_gimple_checking= ; ac_rtl_checking= ;
ac_rtlflag_checking= ; ac_runtime_checking=1 ;
ac_tree_checking= ; ac_valgrind_checking= ;
ac_types_checking= ;;
@@ -394,6 +397,7 @@ do
fold) ac_fold_checking=1 ;;
gc) ac_gc_checking=1 ;;
gcac) ac_gc_always_collect=1 ;;
+ gimple) ac_gimple_checking=1 ;;
misc) ac_checking=1 ;;
rtl) ac_rtl_checking=1 ;;
rtlflag) ac_rtlflag_checking=1 ;;
@@ -422,6 +426,12 @@ if test x$ac_assert_checking != x ; then
AC_DEFINE(ENABLE_ASSERT_CHECKING, 1,
[Define if you want assertions enabled. This is a cheap check.])
fi
+if test x$ac_gimple_checking != x ; then
+ AC_DEFINE(ENABLE_GIMPLE_CHECKING, 1,
+[Define if you want operations on GIMPLE (the basic data structure of
+the high-level optimizers) to be checked for dynamic type safety at
+runtime. This is moderately expensive.])
+fi
GCC_TARGET_TEMPLATE(ENABLE_RUNTIME_CHECKING)
if test x$ac_runtime_checking != x ; then
AC_DEFINE(ENABLE_RUNTIME_CHECKING, 1,
@@ -842,7 +852,7 @@ AC_CHECK_PROG(have_mktemp_command, mktemp, yes, no)
# that we can use it.
ACX_CHECK_PROG_VER(MAKEINFO, makeinfo, --version,
[GNU texinfo.* \([0-9][0-9.]*\)],
- [4.[4-9]*|4.[1-9][0-9]*|[5-9]*|[1-9][0-9]*])
+ [4.[7-9]*|4.[1-9][0-9]*|[5-9]*|[1-9][0-9]*])
if test $gcc_cv_prog_makeinfo_modern = no; then
AC_MSG_WARN([
*** Makeinfo is missing or too old.
@@ -1597,10 +1607,6 @@ do
done
tmake_file="${tmake_file_}"
-# This is a terrible hack which will go away some day.
-host_cc_for_libada=${CC}
-AC_SUBST(host_cc_for_libada)
-
out_object_file=`basename $out_file .c`.o
tm_file_list="options.h"
@@ -2174,6 +2180,31 @@ changequote([,])dnl
[AC_DEFINE(HAVE_AS_LEB128, 1,
[Define if your assembler supports .sleb128 and .uleb128.])])
+# Check if we have assembler support for unwind directives.
+gcc_GAS_CHECK_FEATURE([cfi directives], gcc_cv_as_cfi_directive,
+ [elf,2,17,0],,
+[ .text
+ .cfi_startproc
+ .cfi_offset 0, 0
+ .cfi_same_value 1
+ .cfi_def_cfa 1, 2
+ .cfi_escape 1, 2, 3, 4, 5
+ .cfi_endproc])
+AC_DEFINE_UNQUOTED(HAVE_GAS_CFI_DIRECTIVE,
+ [`if test $gcc_cv_as_cfi_directive = yes; then echo 1; else echo 0; fi`],
+ [Define 0/1 if your assembler supports CFI directives.])
+
+gcc_GAS_CHECK_FEATURE([cfi personality directive],
+ gcc_cv_as_cfi_personality_directive, [elf,2,17,0],,
+[ .text
+ .cfi_startproc,
+ .cfi_personality 0, symbol
+ .cfi_endproc])
+AC_DEFINE_UNQUOTED(HAVE_GAS_CFI_PERSONALITY_DIRECTIVE,
+ [`if test $gcc_cv_as_cfi_personality_directive = yes;
+ then echo 1; else echo 0; fi`],
+ [Define 0/1 if your assembler supports .cfi_personality.])
+
# GAS versions up to and including 2.11.0 may mis-optimize
# .eh_frame data.
gcc_GAS_CHECK_FEATURE(eh_frame optimization, gcc_cv_as_eh_frame,
@@ -3000,6 +3031,21 @@ LCF0:
[AC_DEFINE(HAVE_AS_DFP, 1,
[Define if your assembler supports DFP instructions.])])
+ case $target in
+ *-*-aix*) conftest_s=' .machine "pwr7"
+ .csect .text[[PR]]
+ lxvd2x 1,2,3';;
+ *) conftest_s=' .machine power7
+ .text
+ lxvd2x 1,2,3';;
+ esac
+
+ gcc_GAS_CHECK_FEATURE([vector-scalar support],
+ gcc_cv_as_powerpc_vsx, [9,99,0], -a32,
+ [$conftest_s],,
+ [AC_DEFINE(HAVE_AS_VSX, 1,
+ [Define if your assembler supports VSX instructions.])])
+
gcc_GAS_CHECK_FEATURE([.gnu_attribute support],
gcc_cv_as_powerpc_gnu_attribute, [2,18,0],,
[.gnu_attribute 4,1],,
@@ -3064,7 +3110,7 @@ esac
case "$target" in
i?86*-*-* | mips*-*-* | alpha*-*-* | powerpc*-*-* | sparc*-*-* | m68*-*-* \
| x86_64*-*-* | hppa*-*-* | arm*-*-* \
- | xstormy16*-*-* | cris-*-* | xtensa-*-* | bfin-*-* | score*-*-* \
+ | xstormy16*-*-* | cris-*-* | xtensa*-*-* | bfin-*-* | score*-*-* \
| spu-*-* | fido*-*-*)
insn="nop"
;;
@@ -3559,7 +3605,7 @@ lang_tree_files=
# `language' must be a single word so is spelled singularly.
all_languages=
all_compilers=
-all_outputs='Makefile gccbug libada-mk'
+all_outputs='Makefile gccbug'
# List of language makefile fragments.
all_lang_makefrags=
# List of language subdirectory makefiles. Deprecated.
diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index f585eb411c6..e1d66a52608 100644
--- a/gcc/coretypes.h
+++ b/gcc/coretypes.h
@@ -47,9 +47,20 @@ typedef struct rtvec_def *rtvec;
typedef const struct rtvec_def *const_rtvec;
union tree_node;
typedef union tree_node *tree;
+union gimple_statement_d;
+typedef union gimple_statement_d *gimple;
typedef const union tree_node *const_tree;
+typedef const union gimple_statement_d *const_gimple;
union section;
typedef union section section;
+struct cl_target_option;
+struct cl_optimization;
+struct gimple_seq_d;
+typedef struct gimple_seq_d *gimple_seq;
+typedef const struct gimple_seq_d *const_gimple_seq;
+struct gimple_seq_node_d;
+typedef struct gimple_seq_node_d *gimple_seq_node;
+typedef const struct gimple_seq_node_d *const_gimple_seq_node;
/* The major intermediate representations of GCC. */
enum ir_type {
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 62d2335dde1..29159480da5 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,515 @@
+2008-08-14 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/34485
+ * pt.c (check_template_shadow): Change to return a bool.
+ * name-lookup.c (push_class_level_binding): Early return if
+ check_template_shadow returns false.
+ * cp-tree.h (check_template_shadow): Adjust declaration.
+
+2008-08-14 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/34600
+ * decl.c (grokdeclarator): In case of extern and initializer, return
+ error_mark_node after the error.
+
+2008-08-13 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR 30551
+ * decl.c (grokfndecl): Call check_main_parameters_type only if
+ -Wmain.
+
+2008-08-12 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/37087
+ * parser.c (cp_parser_class_head): Early return error_mark_node in
+ case of global qualification of class name or qualified name that
+ does not name a class.
+
+2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR c++/12242
+ * cvt.c (ocp_convert): Warn for out-of-range conversions to enum.
+
+2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR 36901
+ * cp-tree.h (struct diagnostic_context, struct diagnostic_info):
+ Delete forward declarations. Check that toplev.h has not been
+ included before this file. Include toplev.h and diagnostic.h.
+ * error.c (cp_cpp_error): Use DK_PEDWARN.
+ (cxx_incomplete_type_diagnostic): Update declaration.
+ (cxx_incomplete_type_error): Use DK_ERROR.
+ * typeck2.c (cxx_incomplete_type_diagnostic): Take a diagnostic_t
+ as argument. Use emit_diagnostic.
+ (cxx_incomplete_type_error): Use DK_ERROR.
+ (add_exception_specifier): Use diagnostic_t instead of custom
+ codes.
+ * typeck.c (complete_type_or_else): Update call to
+ cxx_incomplete_type_diagnostic.
+ * init.c (build_delete): Likewise.
+ * call.c (diagnostic_fn_t): Remove unused typedef.
+ (build_temp): Pass a pointer to diagnostic_t.
+ (convert_like_real): Use emit_diagnostic.
+ (joust): Check return value of warning before giving informative
+ note.
+ * friend.c (do_friend): Check return value of warning
+ before giving informative note.
+ * parser.c (cp_parser_template_id): Likewise.
+
+2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR 7651
+ * class.c (check_bases_and_members): Warn with -Wuninitialized
+ instead of -Wextra.
+
+2008-08-08 Volker Reichelt <v.reichelt@netcologne.de>
+
+ PR c++/35985
+ * decl.c (xref_basetypes): Check base for MAYBE_CLASS_TYPE_P,
+ and make sure it is not a union.
+
+2008-08-07 H.J. Lu <hongjiu.lu@intel.com>
+
+ * semantics.c (finish_decltype_type): Initialize type.
+
+2008-08-07 Douglas Gregor <doug.gregor@gmail.com>
+
+ * semantics.c (finish_decltype_type): Handle calls to function
+ pointers and references to functions properly.
+
+2008-08-06 Douglas Gregor <doug.gregor@gmail.com>
+
+ PR c++/36460
+ * parser.c (cp_parser_template_argument): Don't assume that '>>'
+ following a type-id is an error when in C++0x mode.
+
+2008-08-06 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR 26785
+ * decl.c (grokdeclarator): Use explicit location with permerror_at.
+
+2008-08-06 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR 8715
+ * typeck.c (cp_build_binary_op): Move code to c-common.c.
+
+2008-08-05 Jason Merrill <jason@redhat.com>
+
+ PR c++/37016
+ * decl.c (build_ptrmemfunc_type): Don't require structural
+ comparison of PMF types.
+ * tree.c (cp_build_qualified_type_real): Don't clear
+ a valid TYPE_PTRMEMFUNC_TYPE.
+ * typeck.c (cp_build_unary_op): Still do build_ptrmemfunc in
+ templates.
+
+2008-08-04 Jason Merrill <jason@redhat.com>
+
+ PR c++/36963
+ * typeck2.c (check_narrowing): Allow narrowing conversion
+ from an explicit floating-point constant.
+
+ PR c++/37006
+ * pt.c (tsubst_decl): Leave DECL_INITIAL set on deleted
+ instantiations.
+
+2008-08-04 Simon Baldwin <simonb@google.com>
+
+ PR c++/36999
+ * parser.c (cp_parser_elaborated_type_specifier): Warn only when
+ the declaration's id is followed by a semicolon.
+
+2008-07-31 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/36405
+ * rtti.c (get_tinfo_decl_dynamic, get_typeid): Call
+ complete_type_or_else even for UNKNOWN_TYPE to get diagnostics.
+
+2008-07-31 Jason Merrill <jason@redhat.com>
+
+ PR c++/36633
+ * init.c (build_new_1): Don't convert pointer to the data type
+ until we're actually going to treat it as that type.
+
+ PR c++/11309
+ * tree.c (build_aggr_init_expr): Split out...
+ (build_cplus_new): ...from here.
+ (stabilize_init): Don't mess with AGGR_INIT_EXPR either.
+ * init.c (build_new_1): new T() means value-initialization,
+ not default-initialization.
+ (build_vec_init): Likewise.
+ (build_value_init_1): Use build_aggr_init_expr.
+
+2008-07-30 Dodji Seketeli <dseketel@redhat.com>
+
+ PR c++/36767
+ * decl2.c (fix_temporary_vars_context_r): New function.
+ (one_static_initialization_or_destruction): Make sure temporary
+ variables part of the initialiser have their DECL_CONTEXT()
+ properly set.
+
+2008-07-30 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR 34389
+ * typeck.c (build_binary_op): Encapsulate code into
+ shorten_binary_op.
+
+2008-07-29 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/36852
+ * tree.c (cplus_array_hash, build_cplus_array_type_1): Hash on
+ TYPE_UID instead of pointers.
+
+2008-07-29 Jan Hubicka <jh@suse.cz>
+
+ * optimize.c (maybe_clone_body): Remove DECL_INLINE.
+ * decl.c (duplicate_decls): Likewise.
+ (grokfndecl): Likewise.
+ (start_method): Likewise.
+ * method.c (make_thunk, make_alias_for, implicitly_declare_fn):
+ Likewise.
+ * pt.c (register_specialization, regenerate_decl_from_template):
+ Likewise.
+ * decl2.c (grokfield): Likewise.
+
+2008-07-29 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR 34985
+ * decl.c (duplicate_decls): Merge USED flags.
+
+2008-07-27 Jason Merrill <jason@redhat.com>
+
+ PR c++/36943
+ * decl.c (reshape_init_r): Allow C++0x initializer lists.
+
+2008-07-28 Richard Guenther <rguenther@suse.de>
+
+ Merge from gimple-tuples-branch.
+
+ 2008-07-22 Aldy Hernandez <aldyh@redhat.com>
+
+ * cp-gimplify.c (gimplify_if_stmt): Set location on newly created
+ COND_EXPR.
+
+ 2008-07-18 Jakub Jelinek <jakub@redhat.com>
+
+ * decl.c (finish_function): Call gimple_body after cp_genericize.
+
+ 2008-07-18 Aldy Hernandez <aldyh@redhat.com>
+
+ * optimize.c: Include gimple.h instead of tree-gimple.h.
+ * Make-lang.in (cp-gimplify.o): Depend on tree-iterator.h.
+ * cp-gimplify.c: Rename tree-gimple.h to gimple.h. Include
+ tree-iterator.h.
+
+ 2008-07-16 Jakub Jelinek <jakub@redhat.com>
+
+ * optimize.c (maybe_clone_body): Clear DECL_SAVED_TREE for the clone.
+
+ 2008-07-14 Jakub Jelinek <jakub@redhat.com>
+
+ * cp-gimplify.c (cp_gimplify_expr): Update comment.
+
+ 2008-07-14 Aldy Hernandez <aldyh@redhat.com>
+
+ * cp-tree.h (union lang_tree_node): Rename GENERIC_NEXT to
+ TREE_CHAIN.
+ * cp-gimplify.c (cxx_omp_clause_apply_fn): Rename
+ GIMPLE_MODIFY_STMT to MODIFY_EXPR.
+ (cxx_omp_clause_copy_ctor): Same.
+ (cxx_omp_clause_assign_op): Same.
+
+ 2008-05-28 Jakub Jelinek <jakub@redhat.com>
+
+ * cp-gimplify.c (cp_gimplify_omp_for): Add pre_p argument. Tuplify.
+ (cp_gimplify_expr): Adjust caller.
+
+ 2008-05-11 Doug Kwan <dougkwan@google.com>
+
+ * init.c (build_vec_delete): Add type conversion for argument
+ 0 of POINTER_PLUS_EXPR.
+
+ 2008-04-29 Doug Kwan <dougkwan@google.com>
+
+ * decl2 (File): Include "gimple.h"
+ (cp_write_global_declarations): Use gimple_body instead of
+ DECL_SAVED_TREE.
+ * Make-lang.in (cp/decl2.o): Add $(GIMPLE_H)
+
+ 2008-04-10 Diego Novillo <dnovillo@google.com>
+
+ http://gcc.gnu.org/ml/gcc-patches/2008-04/msg00913.html
+
+ * optimize.c (maybe_clone_body): Re-enable call to
+ clone_body.
+ * cp-gimplify.c (cp_gimplify_omp_for): Mark disabled
+ code with call to gimple_unreachable.
+ (cp_genericize): Fix handling of clone bodies.
+
+ 2008-04-04 Diego Novillo <dnovillo@google.com>
+
+ http://gcc.gnu.org/ml/gcc-patches/2008-04/msg00413.html
+
+ * optimize.c (maybe_clone_body): Re-enable.
+
+ 2008-02-19 Diego Novillo <dnovillo@google.com>
+ Oleg Ryjkov <olegr@google.com>
+
+ http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00804.html
+
+ * cp-gimplify.c (gimplify_for_stmt): Change gimple_seq
+ argument to gimple_seq *. Update all users.
+ (gimplify_must_not_throw_expr): Likewise.
+
+ 2008-02-04 Oleg Ryjkov <olegr@google.com>
+
+ * except.c: Include gimple.h
+ (cp_protect_cleanup_actions): Convert to tuples.
+ * Make-lang.in (cp/except.o): Add dependency on gimple.h
+
+ 2007-11-10 Aldy Hernandez <aldyh@redhat.com>
+
+ * cp-gimplify.c (gimplify_cp_loop): Call tree_annotate_all_with_locus
+ instead of annotating each block manually.
+
+ 2007-10-30 Aldy Hernandez <aldyh@redhat.com>
+
+ * cp-gimplify.c (gimplify_cp_loop): Tuplify.
+ (gimplify_for_stmt): Same.
+ (gimplify_switch_stmt): Same.
+ (cp_gimplify_expr): [FOR_STMT]: Do not call gimplify_for_stmt. Return
+ GS_OK.
+ [WHILE_STMT]: Return GS_OK.
+ [SWITCH_STMT]: Same.
+ [CONTINUE_STMT]: Same.
+ [BREAK_STMT]: Same.
+ (cp_genericize): Set gimple_body() of cloned functions when needed.
+
+ 2007-10-29 Aldy Hernandez <aldy@quesejoda.com>
+
+ * cp-gimplify.c: Move build_gimple_eh_filter_tree here.
+ (cp_gimplify_init_expr): Convert to tuples.
+ (gimplify_must_not_throw_expr): Make function return a
+ gimplify_status and convert to tuples.
+
+ 2007-10-18 Aldy Hernandez <aldy@quesejoda.com>
+
+ * cp-gimplify.c (genericize_try_block): Enable and do not call
+ gimplify_stmt.
+ (genericize_catch_block): Same.
+ (genericize_eh_spec_block): Same.
+ Rename gimple_build_eh_filter_tree to build_gimple_eh_filter_tree.
+ (cp_gimplify_expr): Enable TRY_BLOCK, HANDLER, and EH_SPEC_BLOCK.
+
+ 2007-10-16 Aldy Hernandez <aldy@quesejoda.com>
+
+ * optimize.c (maybe_clone_body): Comment out call to clone_body.
+ * decl.c (finish_function): Use gimple_body instead of
+ DECL_SAVED_TREE.
+ * cp-tree.h (cp_gimplify_expr): Last 2 arguments are sequences.
+ * cp-gimplify.c (genericize_try_block): Comment out.
+ (genericize_catch_block): Same.
+ (genericize_eh_spec_block): Same.
+ (gimplify_cp_loop): Comment out calls to gimplify_stmt.
+ (gimplify_for_stmt): Comment out.
+ (gimplify_switch_stmt): Comment out call to gimplify_stmt.
+ (cp_gimplify_omp_for): Same.
+ (gimplify_must_not_throw_expr): Argument pre_p is a sequence.
+ Comment out call to gimplify_stmt and append_to_statement_list.
+ Rename gimple_build_eh_filter_tree to build_gimple_eh_filter_tree.
+ (cp_gimplify_init_expr): Arguments pre_p and post_p are sequences.
+ (cp_gimplify_expr): Same.
+ Comment out calls to genericize_*_block. Comment out call to
+ gimplify_for_stmt.
+
+2008-07-27 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR c++/36944
+ * class.c (type_has_user_provided_default_constructor): Handle
+ default parameters.
+
+2008-07-27 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * decl.c (push_library_fn): Add a parameter for the exceptions that
+ the function may throw.
+ (push_void_library_fn, push_throw_library_fn, expand_static_init):
+ Adjust.
+ (build_library_fn): Change to static.
+ * cp-tree.h: Adjust declarations.
+ * except.c (declare_nothrow_library_fn): New.
+ (do_get_exception_ptr, do_begin_catch, do_free_exception,
+ do_allocate_exception): Use the latter, adjust the declarations
+ (ie, add empty exception-specification), consistently with the
+ actual implementation in libsupc++.
+
+2008-07-25 Jan Hubicka <jh@suse.cz>
+
+ * typeck.c (inline_conversion): Remove.
+ (cp_build_function_call): Do not use inline_conversion.
+ * decl.c (duplicate_decls): Do not insist on inline being declared
+ early.
+ (start_cleanup_fn): Do not assume that INLINE flags prevent function
+ from being output. We now remove static functions always.
+ (finish_function): Do return warning on all static functions.
+ * call.c (build_over_call): Do not use inline_conversion.
+ * cp-tree.h (possibly_inlined_p): Declare.
+ (inline_conversion): Remove.
+ * pt.c (instantiate_decl): Use possibly_inlined_p predicate.
+ * decl2.c (cp_write_global_declarations): Likewise.
+ (mark_used): Likewise.
+ (possibly_inlined_p): New functions.
+
+2008-07-25 Jason Merrill <jason@redhat.com>
+
+ * class.c (type_has_user_provided_default_constructor): Handle
+ templates.
+
+2008-07-23 Jan Hubicka <jh@suse.cz>
+
+ * decl.c (duplicate_decls): Update comment and unit-at-a-time.
+ (grogfndecl): Drop flag_inline_trees code.
+ * pt.c (instantiate_decl): Drop flag_iline_trees code.
+ * lex.c (cxx_init): Do not set unit-at-a-time.
+
+2008-07-23 Jason Merrill <jason@redhat.com>
+
+ * mangle.c (write_unqualified_name): Avoid infinite recursion when
+ trying to mangle a decl with no name.
+
+ Implement defaulted/deleted functions as per N2346
+ * cp-tree.h (struct lang_decl_flags): Add defaulted_p bitfield.
+ (DECL_DELETED_FN): New macro.
+ (DECL_DEFAULTED_FN): New macro.
+ * class.c (user_provided_p): New fn.
+ (defaultable_fn_p): New fn.
+ (type_has_user_provided_constructor): New fn.
+ (type_has_user_provided_default_constructor): New fn.
+ (check_methods): A defaulted fn is still trivial.
+ (check_bases_and_members): Likewise.
+ * decl.c (grok_special_member_properties): Likewise.
+ (duplicate_decls): Complain about redeclaring a function as deleted.
+ (start_decl): initialized==2 means deleted.
+ (cp_finish_decl): Handle deleted/defaulted semantics.
+ * decl2.c (grokfield): Likewise.
+ (mark_used): Check DECL_DEFAULTED_FN instead of DECL_ARTIFICIAL.
+ Complain about using a deleted fn.
+ * init.c (build_value_init_1): Use type_has_user_provided_constructor.
+ (perform_member_init): Check for a user-provided default constructor
+ even if TYPE_NEEDS_CONSTRUCTING.
+ (build_new_1): Likewise.
+ * call.c (build_over_call): Don't call mark_used twice.
+ * method.c (implicitly_declare_fn): Set DECL_DEFAULTED_FN.
+ * search.c (check_final_overrider): Check for deleted mismatch.
+ * parser.c (cp_parser_init_declarator): Tell start_decl about =delete.
+ (cp_parser_pure_specifier): Handle =default and =delete.
+
+ * error.c (maybe_warn_cpp0x): Suggest -std=gnu++0x as well.
+
+2008-07-23 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR 35058
+ * typeck.c: All calls to pedwarn changed.
+ * decl.c: All calls to pedwarn changed.
+ * call.c: All calls to pedwarn changed.
+ * error.c: All calls to pedwarn changed.
+ * typeck2.c: All calls to pedwarn changed.
+ * pt.c: All calls to pedwarn changed.
+ * name-lookup.c: All calls to pedwarn changed.
+ * parser.c: All calls to pedwarn changed.
+
+2008-07-21 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * call.c: Fix comment typos.
+ * class.c: Likewise.
+ * cp-tree.h: Likewise.
+ * cxx-pretty-print.c: Likewise.
+ * decl.c: Likewise.
+ * init.c: Likewise.
+ * name-lookup.c: Likewise.
+ * operators.def: Likewise.
+ * parser.c: Likewise.
+ * pt.c: Likewise.
+ * tree.c: Likewise.
+ * typeck.c: Likewise.
+
+2008-07-21 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/36871
+ PR c++/36872
+ * semantics.c (classtype_has_nothrow_assign_or_copy_p): Only check
+ copy constructors and copy assignment operators proper.
+
+2008-07-21 Rafael Avila de Espindola <espindola@google.com>
+
+ * parser.c (cp_token): Remove in_system_header.
+ (eof_token): Remove in_system_header.
+ (cp_lexer_get_preprocessor_token): Don't set in_system_header.
+ (cp_lexer_set_source_position_from_token): Don't set in_system_header.
+ (cp_parser_member_declaration): Use in_system_header_at.
+ * pt.c (lookup_template_class): Don't set DECL_IN_SYSTEM_HEADER.
+ (pop_tinst_level): Don't set in_system_header.
+ (instantiate_class_template): Don't set in_system_header.
+ (instantiate_decl): Don't set in_system_header.
+ (instantiate_pending_templates): Don't set in_system_header.
+
+2008-07-21 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/36870
+ * semantics.c (classtype_has_nothrow_assign_or_copy_p): Use
+ TYPE_NOTHROW_P, not TREE_NOTHROW.
+ (trait_expr_value): Likewise.
+
+2008-07-18 Dodji Seketeli <dseketel@redhat.com>
+
+ PR c++/36407
+ * call.c (convert_like_real): Don't take the error code path
+ when a rvalue or base conversion has the bad_p field set.
+
+2008-07-18 Kris Van Hees <kris.van.hees@oracle.com>
+
+ * rtti.c (emit_support_tinfos): Add char16_type_node and
+ char32_type_node.
+ * typeck2.c (digest_init): Support char16_t and char32_t.
+
+2008-07-18 Kavih R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * cvt.c (convert_to_void): Avoid C++ keywords.
+ * decl.c (walk_namespaces_r, wrapup_globals_for_namespace):
+ Likewise.
+ * friend.c (is_friend): Likewise.
+ * init.c (perform_member_init): Likewise.
+ * mangle.c (write_template_prefix, write_template_template_param):
+ Likewise.
+ * name-lookup.c (do_namespace_alias, do_using_directive,
+ parse_using_directive, ambiguous_decl, arg_assoc): Likewise.
+ * parser.c (cp_parser_template_id, cp_parser_namespace_definition,
+ cp_parser_objc_typename, cp_parser_objc_method_keyword_params):
+ Likewise.
+ * pt.c (is_specialization_of_friend, lookup_template_class,
+ push_tinst_level, instantiate_class_template,
+ tsubst_copy_and_build): Likewise.
+ * tree.c (add_stmt_to_compound): Likewise.
+ * typeck.c (finish_class_member_access_expr): Likewise.
+
+2008-07-17 Julian Brown <julian@codesourcery.com>
+ Mark Mitchell <mark@codesourcery.com>
+
+ * decl2.c (determine_visibility): Allow target to override
+ visibility of class data.
+
+2008-07-17 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/36855
+ * semantics.c (trait_expr_value): Update __has_trivial_destructor
+ semantics to the current WP (N2691).
+
+2008-07-16 Dodji Seketeli <dseketel@redhat.com>
+
+ PR c++/13699
+ * name-lookup.c (lookup_extern_c_fun_binding_in_all_ns): New function.
+ (pushdecl_maybe_friend): Check if a redeclaration of extern C function
+ complies with exception specification constraints.
+
2008-07-14 Jason Merrill <jason@redhat.com>
* lex.c (init_reswords): Always set D_OBJC.
@@ -14,15 +526,15 @@
PR c++/13101
* decl.c (grokdeclarator): Warn about initializing variables
- of storage class 'extern' only after the type of the declarator
- has been properly computed.
+ of storage class 'extern' only after the type of the declarator
+ has been properly computed.
2008-07-11 Dodji Seketeli <dseketel@redhat.com>
PR c++/31754
- * cp-tree.h (struct cp_decl_specifier_seq): add a location field. It
+ * cp-tree.h (struct cp_decl_specifier_seq): Add a location field. It
carries the location of the primary type.
- * parser.c (cp_parser_check_type_definition): update documentation.
+ * parser.c (cp_parser_check_type_definition): Update documentation.
(cp_parser_check_for_definition_in_return_type,
cp_parser_check_for_invalid_template_id,
cp_parser_set_decl_spec_type,
@@ -30,18 +542,18 @@
cp_parser_diagnose_invalid_type_name,
cp_parser_new_expression, cp_parser_explicit_instantiation,
cp_parser_type_specifier, cp_parser_simple_type_specifier,
- cp_parser_omp_for_loop, cp_parser_pragma): use location in error messages.
-
+ cp_parser_omp_for_loop, cp_parser_pragma): Use location in error
+ messages.
2008-07-11 Dodji Seketeli <dseketel@redhat.com>
PR c++/31754
* pt.c, semantic.c:
* semantic.c (qualified_name_lookup_error, finish_id_expression):
- add a location_t parameter so that
+ Add a location_t parameter so that
error message can have a more accurate location.
- * cp-tree.h: updated prototype
- * pt.c (tsubst_qualified_id): use location in error messages.
+ * cp-tree.h: Updated prototype
+ * pt.c (tsubst_qualified_id): Use location in error messages.
* parser.c (cp_parser_postfix_expression,
cp_parser_objc_statement, cp_parser_trait_expr,
cp_parser_token_is_class_key,
@@ -64,8 +576,8 @@
cp_parser_function_specifier_opt, cp_parser_decltype,
cp_parser_mem_initializer_list, cp_parser_mem_initializer,
cp_parser_mem_initializer_id, cp_parser_template_parameter,
- cp_parser_type_parameter, cp_parser_template_id, cp_parser_template_name,
- cp_parser_template_argument): likewise.
+ cp_parser_type_parameter, cp_parser_template_id,
+ cp_parser_template_name, cp_parser_template_argument): Likewise.
2008-07-09 Paolo Carlini <paolo.carlini@oracle.com>
@@ -111,7 +623,7 @@
(LOOKUP_NO_COPY_CTOR_CONVERSION): New macro.
* parser.c (cp_parse_braced_list): Split out from...
(cp_parser_initializer_clause): ...here.
- (cp_parser_postfix_expression): Build up CONSTRUCTOR for compound
+ (cp_parser_postfix_expression): Build up CONSTRUCTOR for compound
literal here.
(cp_lexer_next_token_is_not_keyword): New fn.
(cp_parser_parenthesized_expression_list): Handle { }.
@@ -131,7 +643,7 @@
(add_function_candidate): Handle LOOKUP_NO_COPY_CTOR_CONVERSION.
(build_user_type_conversion_1): When converting from an init list,
we allow additional conversions except when calling a copy ctor.
- (convert_like_real): Calling an explicit ctor for an init list is
+ (convert_like_real): Calling an explicit ctor for an init list is
ill-formed. Handle ck_list and ck_addr. Check narrowing.
(build_new_method_call): If CONSTRUCTOR_IS_DIRECT_INIT is set and
class doesn't have a list ctor, break the {} into a TREE_LIST.
@@ -149,7 +661,7 @@
(grokdeclarator): Converting constructors can have more than one parm.
(grok_special_member_properties): Set TYPE_HAS_LIST_CTOR.
* init.c (expand_default_init): Only do digest_init for aggregates.
- * rtti.c (tinfo_base_init): Pass init_list_type_node to
+ * rtti.c (tinfo_base_init): Pass init_list_type_node to
build_constructor_from_list.
(generic_initializer, ptr_initializer): Ditto.
(ptm_initializer, class_initializer): Ditto.
@@ -162,7 +674,7 @@
* typeck2.c (store_init_value): Use init_list_type_node.
(digest_init): Likewise.
(check_narrowing): New fn.
- * semantics.c: (finish_compound_literal): Take CONSTRUCTOR instead
+ * semantics.c: (finish_compound_literal): Take CONSTRUCTOR instead
of vector of constructor elts. Handle non-aggregate types. Make
constant literals static.
* pt.c: (tsubst_copy_and_build): Adjust.
@@ -282,16 +794,16 @@
2008-06-08 Paolo Carlini <paolo.carlini@oracle.com>
- PR c++/35242
- * pt.c (maybe_process_partial_specialization): Check the tree
+ PR c++/35242
+ * pt.c (maybe_process_partial_specialization): Check the tree
returned by push_template_decl for error_mark_node.
* parser.c (cp_parser_class_head): Likewise, check the tree
- returned by the latter.
+ returned by the latter.
2008-06-07 Paolo Carlini <paolo.carlini@oracle.com>
- PR c++/35327
- * decl.c (grokdeclarator): In case of wrong return type return
+ PR c++/35327
+ * decl.c (grokdeclarator): In case of wrong return type return
immediately error_mark_node.
2008-06-06 Jakub Jelinek <jakub@redhat.com>
@@ -363,22 +875,22 @@
2008-06-02 Paolo Carlini <paolo.carlini@oracle.com>
- PR c++/36404
- * pt.c (push_template_decl_real): Consistently return error_mark_node
+ PR c++/36404
+ * pt.c (push_template_decl_real): Consistently return error_mark_node
on error.
2008-06-02 Tomas Bily <tbily@suse.cz>
- * typeck.c (is_bitfield_expr_with_lowered_type): Use CASE_CONVERT.
- (cp_build_unary_op): Likewise.
- (cp_build_indirect_ref): Use CONVERT_EXPR_P.
- (maybe_warn_about_returning_address_of_local): Likewise.
+ * typeck.c (is_bitfield_expr_with_lowered_type): Use CASE_CONVERT.
+ (cp_build_unary_op): Likewise.
+ (cp_build_indirect_ref): Use CONVERT_EXPR_P.
+ (maybe_warn_about_returning_address_of_local): Likewise.
2008-05-29 Paolo Carlini <paolo.carlini@oracle.com>
- PR c++/35243
- * pt.c (tsubst_initializer_list): Consistently check the tree
- returned by tsubst_pack_expansion for error_mark_node.
+ PR c++/35243
+ * pt.c (tsubst_initializer_list): Consistently check the tree
+ returned by tsubst_pack_expansion for error_mark_node.
2008-05-27 Michael Matz <matz@suse.de>
@@ -434,16 +946,16 @@
2008-05-12 Paolo Carlini <paolo.carlini@oracle.com>
- PR c++/35331
- * semantics.c (begin_class_definition): Extend checks on the first
+ PR c++/35331
+ * semantics.c (begin_class_definition): Extend checks on the first
argument.
2008-05-12 Tomas Bily <tbily@suse.cz>
- * typeck2.c (digest_init): Use CONVERT_EXPR_P.
- * call.c (build_over_call): Likewise.
- * error.c (dump_expr): Use CASE_CONVERT.
- * class.c (fixed_type_or_null): Likewise.
+ * typeck2.c (digest_init): Use CONVERT_EXPR_P.
+ * call.c (build_over_call): Likewise.
+ * error.c (dump_expr): Use CASE_CONVERT.
+ * class.c (fixed_type_or_null): Likewise.
2008-05-11 Volker Reichelt <v.reichelt@netcologne.de>
@@ -550,7 +1062,7 @@
* tree.c (cp_tree_equal): Handle FIXED_CST.
PR c++/35678
- * pt.c (template_template_parm_bindings_ok_p): Set
+ * pt.c (template_template_parm_bindings_ok_p): Set
processing_template_decl while in this function.
2008-04-18 Kris Van Hees <kris.van.hees@oracle.com>
@@ -568,14 +1080,14 @@
(cp_parser_string_literal): Idem.
(cp_parser_primary_expression): Support CPP_CHAR{16,32} and
CPP_STRING{16,32}.
- (cp_parser_simple_type_specifier): Support RID_CHAR{16,32}.
+ (cp_parser_simple_type_specifier): Support RID_CHAR{16,32}.
* tree.c (char_type_p): Support char16_t and char32_t as char types.
* typeck.c (string_conv_p): Support char16_t and char32_t.
2008-04-17 Jason Merrill <jason@redhat.com>
PR c++/35773
- * call.c (build_user_type_conversion_1): Represent second step of
+ * call.c (build_user_type_conversion_1): Represent second step of
copy-init with an rvalue conversion.
(convert_like_real) [ck_user]: Don't implicitly add it here.
@@ -587,14 +1099,14 @@
2008-04-16 Danny Smith <dannysmith@users.sourceforge.net>
- PR target/35921
- * optimize.c (maybe_clone_body): Copy DECL_DLLIMPORT_P flag
- to clone.
+ PR target/35921
+ * optimize.c (maybe_clone_body): Copy DECL_DLLIMPORT_P flag
+ to clone.
2008-04-09 Jason Merrill <jason@redhat.com>
PR c++/35708
- * semantics.c (finish_compound_literal): Return a TARGET_EXPR,
+ * semantics.c (finish_compound_literal): Return a TARGET_EXPR,
not a pushed variable.
2008-04-09 Volker Reichelt <v.reichelt@netcologne.de>
@@ -711,7 +1223,7 @@
2008-04-07 Jason Merrill <jason@redhat.com>
PR c++/35734
- * class.c (type_has_user_nondefault_constructor): A template
+ * class.c (type_has_user_nondefault_constructor): A template
counts as a nondefault constructor.
2008-04-04 Paolo Bonzini <bonzini@gnu.org>
@@ -739,14 +1251,14 @@
* Make-lang.in (c++_OBJS): New variable.
2008-04-03 Paolo Bonzini <bonzini@gnu.org>
-
+
* optimize.c (clone_body): New, from tree-inline.c.
2008-04-03 Paolo Bonzini <bonzini@gnu.org>
- * method.c (synthesize_method): Use {push,pop}_function_context.
- * name-lookup.c (push_to_top_level): Likewise.
- * parser.c (cp_parser_late_parsing_for_member): Likewise.
+ * method.c (synthesize_method): Use {push,pop}_function_context.
+ * name-lookup.c (push_to_top_level): Likewise.
+ * parser.c (cp_parser_late_parsing_for_member): Likewise.
2008-03-30 Volker Reichelt <v.reichelt@netcologne.de>
@@ -800,17 +1312,17 @@
2008-03-26 Douglas Gregor <doug.gregor@gmail.com>
- * pt.c (coerce_template_template_parm): Moved the body of the loop
- of coerce_template_template_parms here, to make iteration over a
- template argument pack simpler.
- Also, allow matching of a template parameter pack in the template
- template parameter to a template parameter in the template
- template argument.
- (coerce_template_template_parms): Deal with variadic template
- template parameters. Use coerce_template_template_parm.
- (unify): Make sure we coerce the template template argument's
- template arguments to the template template parameter's template
- parameters, not the other way around.
+ * pt.c (coerce_template_template_parm): Moved the body of the loop
+ of coerce_template_template_parms here, to make iteration over a
+ template argument pack simpler.
+ Also, allow matching of a template parameter pack in the template
+ template parameter to a template parameter in the template
+ template argument.
+ (coerce_template_template_parms): Deal with variadic template
+ template parameters. Use coerce_template_template_parm.
+ (unify): Make sure we coerce the template template argument's
+ template arguments to the template template parameter's template
+ parameters, not the other way around.
2008-03-25 Tom Tromey <tromey@redhat.com>
@@ -822,208 +1334,208 @@
2008-03-25 Douglas Gregor <doug.gregor@gmail.com>
- * typeck.c (composite_pointer_type_r): Add SFINAE support.
- (composite_pointer_type): Ditto.
- (common_type): Fix call to composite_pointer_type.
- (cxx_sizeof_nowarn): New; used to be a macro.
- (cxx_sizeof_expr): Add SFINAE support.
- (cxx_alignof_expr): Ditto.
- (decay_conversion): Fix calls for SFINAE support.
- (rationalize_conditional_expr): Add SFINAE support.
- (build_class_member_access_expr): Ditto.
- (finish_class_member_access_expr): Ditto.
- (build_x_indirect_ref): Ditto.
- (build_indirect_ref): Original version renamed to
- cp_build_indirect_ref; new version provides a bridge from
- c-common.
- (cp_build_indirect_ref): Was build_indirect_ref; added SFINAE
- support.
- (get_member_function_from_ptrfunc): Fix calls for SFINAE support.
- (build_function_call): Original version renamed to
- cp_build_function_call; new version provides a bridge from
- c-common.
- (cp_build_function_call): Was build_function_call; added SFINAE
- support.
- (convert_arguments): Add SFINAE support.
- (build_x_binary_op): Ditto.
- (build_binary_op): Original version renamed to cp_build_binary_op;
- new version provides a bridge from c-common.
- (cp_build_binary_op): Was build_binary_op; added SFINAE support.
- (pointer_diff): Fix calls for SFINAE.
- (build_x_unary_op): Add SFINAE support.
- (condition_conversion): Fix calls for SFINAE.
- (build_unary_op): Original version renamed to cp_build_unary_op;
- new version provides a bridge from c-common.
- (cp_build_unary_op): Was build_unary_op; added SFINAE support.
- (unary_complex_lvalue): Fix calls for SFINAE.
- (build_x_conditional_expr): Add SFINAE support.
- (build_x_compound_expr_from_list): Fix calls for SFINAE.
- (build_x_compound_expr): Add SFINAE support.
- (convert_ptrmem): Fix calls for SFINAE.
- (build_static_cast_1): Add SFINAE support.
- (build_static_cast): Ditto.
- (build_reinterpret_cast_1): Ditto.
- (build_reinterpret_cast): Ditto.
- (build_const_cast_1): Ditto.
- (build_const_cast): Ditto.
- (build_c_cast): Ditto.
- (build_modify_expr): Original version renamed to
- cp_build_modify_expr; new version provides a bridge from c-common.
- (cp_build_modify_expr): Was build_modify_expr; added SFINAE
- support.
- (build_x_modify_expr): Add SFINAE support.
- (build_ptrmemfunc): Fix calls for SFINAE.
- (convert_for_assignment): Add SFINAE support.
- (convert_for_initialization): Ditto.
- (check_return_expr): Fix calls for SFINAE.
- (lvalue_or_else): Add SFINAE support.
- * init.c (perform_member_init): Fix calls for SFINAE.
- (emit_mem_initializers): Ditto.
- (expand_virtual_init): Ditto.
- (expand_cleanup_for_base): Ditto.
- (build_aggr_init): Add SFINAE support.
- (expand_default_init): Ditto.
- (expand_aggr_init_1): Fix calls for SFINAE.
- (build_offset_ref): Ditto.
- (build_new_1): Add SFINAE support.
- (build_new): Ditto.
- (build_vec_delete_1): Fix calls for SFINAE.
- (get_temp_regvar): Ditto.
- (build_vec_init): Add SFINAE support.
- (build_dtor_call): Fix calls for SFINAE.
- (build_delete): Ditto.
- (push_base_cleanups): Ditto.
- (build_vec_delete_1): Ditto.
- * class.c (build_base_path): Fix calls for SFINAE.
- (build_simple_base_path): Ditto.
- (convert_to_base_statically): Ditto.
- (build_vfn_ref): Ditto.
- (resolve_address_of_overloaded_function): Ditto.
- * decl.c (check_initializer): Fix calls for SFINAE.
- (register_dtor_fn): Ditto.
- (compute_array_index_type): Ditto.
- (finish_enum): Ditto.
- (start_preparsed_function): Ditto.
- (cxx_maybe_build_cleanup): Ditto.
- * call.c (convert_like): Add COMPLAIN argument.
- (convert_like_with_context): Ditto.
- (build_this): Fix calls for SFINAE.
- (build_user_type_conversion): Ditto.
- (resolve_args): Ditto.
- (build_new_function_call): Add SFINAE support.
- (build_operator_new_call): Fix calls for SFINAE.
- (build_object_call): Add SFINAE support.
- (build_conditional_expr): Ditto.
- (build_new_op): Ditto.
- (build_op_delete_call): Fix calls for SFINAE.
- (build_temp): Ditto.
- (convert_like_real): Add SFINAE support.
- (build_x_va_arg): Fix calls for SFINAE.
- (convert_default_arg): Ditto.
- (build_over_call): Add SFINAE support.
- (build_java_interface_fn_ref): Fix calls for SFINAE.
- (build_special_member_call): Add SFINAE support.
- (build_new_method_call): Ditto.
- (perform_implicit_conversion): Ditto.
- (perform_direct_initialization_if_possible): Ditto.
- (initialize_reference): Fix calls for SFINAE.
- * method.c (do_build_assign_ref): Fix calls for SFINAE.
- * rtti.c (build_headof): Fix calls for SFINAE.
- (get_tinfo_decl_dynamic): Ditto.
- (get_typeid): Ditto.
- (build_dynamic_cast_1): Add SFINAE support.
- (build_dynamic_cast): Ditto.
- (tinfo_base_init): Fix calls for SFINAE.
- * except.c (do_get_exception_ptr): Fix calls for SFINAE.
- (do_end_catch): Ditto.
- (initialize_handler_parm): Ditto.
- (expand_start_catch_block): Ditto.
- (do_allocate_exception): Ditto.
- (do_free_exception): Ditto.
- (build_throw): Ditto.
- * cvt.c (build_up_reference): Fix calls for SFINAE.
- (convert_to_reference): Ditto.
- (ocp_convert): Ditto.
- (convert_to_void): Add SFINAE support.
- * tree.c (build_dummy_object): Fix calls for SFINAE.
- (stabilize_expr): Ditto.
- * cp-tree.h (build_conditional_expr): Add tsubst_flags_t
- parameter.
- (build_new_method_call): Ditto.
- (build_special_member_call): Ditto.
- (build_new_op): Ditto.
- (perform_implicit_conversion): Ditto.
- (perform_direct_initialization_if_possible): Ditto.
- (convert_to_void): Ditto.
- (build_aggr_init): Ditto.
- (build_new): Ditto.
- (build_vec_init): Ditto.
- (build_dynamic_cast): Ditto.
- (finish_call_expr): Ditto
- (cxx_sizeof_or_alignof_expr): Add COMPLAIN parameter.
- (cxx_sizeof_nowarn): Remove macro; add function declaration.
- (build_class_member_access_expr): Add tsubst_flags_t parameter.
- (finish_class_member_access_expr): Ditto.
- (build_x_indirect_ref): Ditto.
- (cp_build_indirect_ref): New.
- (cp_build_function_call): Add tsubst_flags_t parameter.
- (build_x_unary_op): Ditto.
- (cp_build_unary_op): New.
- (build_x_conditional_expr): Add tsubst_flags_t parameter.
- (build_x_compound_expr): Ditto.
- (build_compound_expr): Ditto.
- (build_static_cast): Ditto.
- (build_reinterpret_cast): Ditto.
- (build_const_cast): Ditto.
- (build_c_cast): Ditto.
- (build_x_modify_expr): Ditto.
- (cp_build_modify_expr): New.
- (convert_for_initialization): Add tsubst_flags_t parameter.
- (cp_build_binary_op): Remove macro; add function declaration.
- (invalid_nonstatic_memfn_p): Add tsubst_flags_t parameter.
- (lvalue_or_else): Ditto.
- (build_functional_cast): Ditto.
- * typeck2.c (digest_init): Fix calls for SFINAE.
- (process_init_constructor_array): Ditto.
- (process_init_constructor_record): Ditto.
- (build_x_arrow): Ditto.
- (build_m_component_ref): Ditto.
- (build_functional_cast): Add SFINAE support.
- * pt.c (tsubst_copy_and_build): Add (more) SFINAE support.
- * semantics.c (simplify_loop_decl_cond): Fix calls for SFINAE.
- (finish_expr_stmt): Ditto.
- (finish_for_expr): Ditto.
- (finish_asm_stmt): Ditto.
- (finish_non_static_data_member): Ditto.
- (finish_qualified_id_expr): Ditto.
- (finish_call_expr): Add SFINAE support.
- (finish_increment_expr): Fix calls for SFINAE.
- (finish_unary_op_expr): Ditto.
- (simplify_aggr_init_expr): Ditto.
- (finish_omp_clauses): Ditto.
- (finish_omp_for): Ditto.
- (finish_omp_barrier): Ditto.
- (finish_omo_flush): Ditto.
- * decl2.c (grok_array_decl): Fix calls or SFINAE.
- (build_anon_union_vars): Ditto.
- (get_guard_cond): Ditto.
- (set_guard): Ditto.
- (one_static_initialization_or_destruction): Ditto.
- (do_static_initialization_or_destruction): Ditto.
- (generate_ctor_or_dtor_function): Ditto.
- (build_offset_ref_call_from_tree): Ditto.
- * parser.c (cp_parser_postfix_expression): Fix calls for SFINAE.
- (cp_parser_postfix_dot_deref_expression): Ditto.
- (cp_parser_unary_expression): Ditto.
- (cp_parser_new_expression): Ditto.
- (cp_parser_cast_expression): Ditto.
- (cp_parser_binary_expression): Ditto.
- (cp_parser_question_colon_clause): Ditto.
- (cp_parser_assignment_expression): Ditto.
- (cp_parser_expression): Ditto.
- (cp_parser_builtin_offsetof): Ditto.
- (cp_parser_template_argument): Ditto.
- (cp_parser_functional_cast): Ditto.
+ * typeck.c (composite_pointer_type_r): Add SFINAE support.
+ (composite_pointer_type): Ditto.
+ (common_type): Fix call to composite_pointer_type.
+ (cxx_sizeof_nowarn): New; used to be a macro.
+ (cxx_sizeof_expr): Add SFINAE support.
+ (cxx_alignof_expr): Ditto.
+ (decay_conversion): Fix calls for SFINAE support.
+ (rationalize_conditional_expr): Add SFINAE support.
+ (build_class_member_access_expr): Ditto.
+ (finish_class_member_access_expr): Ditto.
+ (build_x_indirect_ref): Ditto.
+ (build_indirect_ref): Original version renamed to
+ cp_build_indirect_ref; new version provides a bridge from
+ c-common.
+ (cp_build_indirect_ref): Was build_indirect_ref; added SFINAE
+ support.
+ (get_member_function_from_ptrfunc): Fix calls for SFINAE support.
+ (build_function_call): Original version renamed to
+ cp_build_function_call; new version provides a bridge from
+ c-common.
+ (cp_build_function_call): Was build_function_call; added SFINAE
+ support.
+ (convert_arguments): Add SFINAE support.
+ (build_x_binary_op): Ditto.
+ (build_binary_op): Original version renamed to cp_build_binary_op;
+ new version provides a bridge from c-common.
+ (cp_build_binary_op): Was build_binary_op; added SFINAE support.
+ (pointer_diff): Fix calls for SFINAE.
+ (build_x_unary_op): Add SFINAE support.
+ (condition_conversion): Fix calls for SFINAE.
+ (build_unary_op): Original version renamed to cp_build_unary_op;
+ new version provides a bridge from c-common.
+ (cp_build_unary_op): Was build_unary_op; added SFINAE support.
+ (unary_complex_lvalue): Fix calls for SFINAE.
+ (build_x_conditional_expr): Add SFINAE support.
+ (build_x_compound_expr_from_list): Fix calls for SFINAE.
+ (build_x_compound_expr): Add SFINAE support.
+ (convert_ptrmem): Fix calls for SFINAE.
+ (build_static_cast_1): Add SFINAE support.
+ (build_static_cast): Ditto.
+ (build_reinterpret_cast_1): Ditto.
+ (build_reinterpret_cast): Ditto.
+ (build_const_cast_1): Ditto.
+ (build_const_cast): Ditto.
+ (build_c_cast): Ditto.
+ (build_modify_expr): Original version renamed to
+ cp_build_modify_expr; new version provides a bridge from c-common.
+ (cp_build_modify_expr): Was build_modify_expr; added SFINAE
+ support.
+ (build_x_modify_expr): Add SFINAE support.
+ (build_ptrmemfunc): Fix calls for SFINAE.
+ (convert_for_assignment): Add SFINAE support.
+ (convert_for_initialization): Ditto.
+ (check_return_expr): Fix calls for SFINAE.
+ (lvalue_or_else): Add SFINAE support.
+ * init.c (perform_member_init): Fix calls for SFINAE.
+ (emit_mem_initializers): Ditto.
+ (expand_virtual_init): Ditto.
+ (expand_cleanup_for_base): Ditto.
+ (build_aggr_init): Add SFINAE support.
+ (expand_default_init): Ditto.
+ (expand_aggr_init_1): Fix calls for SFINAE.
+ (build_offset_ref): Ditto.
+ (build_new_1): Add SFINAE support.
+ (build_new): Ditto.
+ (build_vec_delete_1): Fix calls for SFINAE.
+ (get_temp_regvar): Ditto.
+ (build_vec_init): Add SFINAE support.
+ (build_dtor_call): Fix calls for SFINAE.
+ (build_delete): Ditto.
+ (push_base_cleanups): Ditto.
+ (build_vec_delete_1): Ditto.
+ * class.c (build_base_path): Fix calls for SFINAE.
+ (build_simple_base_path): Ditto.
+ (convert_to_base_statically): Ditto.
+ (build_vfn_ref): Ditto.
+ (resolve_address_of_overloaded_function): Ditto.
+ * decl.c (check_initializer): Fix calls for SFINAE.
+ (register_dtor_fn): Ditto.
+ (compute_array_index_type): Ditto.
+ (finish_enum): Ditto.
+ (start_preparsed_function): Ditto.
+ (cxx_maybe_build_cleanup): Ditto.
+ * call.c (convert_like): Add COMPLAIN argument.
+ (convert_like_with_context): Ditto.
+ (build_this): Fix calls for SFINAE.
+ (build_user_type_conversion): Ditto.
+ (resolve_args): Ditto.
+ (build_new_function_call): Add SFINAE support.
+ (build_operator_new_call): Fix calls for SFINAE.
+ (build_object_call): Add SFINAE support.
+ (build_conditional_expr): Ditto.
+ (build_new_op): Ditto.
+ (build_op_delete_call): Fix calls for SFINAE.
+ (build_temp): Ditto.
+ (convert_like_real): Add SFINAE support.
+ (build_x_va_arg): Fix calls for SFINAE.
+ (convert_default_arg): Ditto.
+ (build_over_call): Add SFINAE support.
+ (build_java_interface_fn_ref): Fix calls for SFINAE.
+ (build_special_member_call): Add SFINAE support.
+ (build_new_method_call): Ditto.
+ (perform_implicit_conversion): Ditto.
+ (perform_direct_initialization_if_possible): Ditto.
+ (initialize_reference): Fix calls for SFINAE.
+ * method.c (do_build_assign_ref): Fix calls for SFINAE.
+ * rtti.c (build_headof): Fix calls for SFINAE.
+ (get_tinfo_decl_dynamic): Ditto.
+ (get_typeid): Ditto.
+ (build_dynamic_cast_1): Add SFINAE support.
+ (build_dynamic_cast): Ditto.
+ (tinfo_base_init): Fix calls for SFINAE.
+ * except.c (do_get_exception_ptr): Fix calls for SFINAE.
+ (do_end_catch): Ditto.
+ (initialize_handler_parm): Ditto.
+ (expand_start_catch_block): Ditto.
+ (do_allocate_exception): Ditto.
+ (do_free_exception): Ditto.
+ (build_throw): Ditto.
+ * cvt.c (build_up_reference): Fix calls for SFINAE.
+ (convert_to_reference): Ditto.
+ (ocp_convert): Ditto.
+ (convert_to_void): Add SFINAE support.
+ * tree.c (build_dummy_object): Fix calls for SFINAE.
+ (stabilize_expr): Ditto.
+ * cp-tree.h (build_conditional_expr): Add tsubst_flags_t
+ parameter.
+ (build_new_method_call): Ditto.
+ (build_special_member_call): Ditto.
+ (build_new_op): Ditto.
+ (perform_implicit_conversion): Ditto.
+ (perform_direct_initialization_if_possible): Ditto.
+ (convert_to_void): Ditto.
+ (build_aggr_init): Ditto.
+ (build_new): Ditto.
+ (build_vec_init): Ditto.
+ (build_dynamic_cast): Ditto.
+ (finish_call_expr): Ditto
+ (cxx_sizeof_or_alignof_expr): Add COMPLAIN parameter.
+ (cxx_sizeof_nowarn): Remove macro; add function declaration.
+ (build_class_member_access_expr): Add tsubst_flags_t parameter.
+ (finish_class_member_access_expr): Ditto.
+ (build_x_indirect_ref): Ditto.
+ (cp_build_indirect_ref): New.
+ (cp_build_function_call): Add tsubst_flags_t parameter.
+ (build_x_unary_op): Ditto.
+ (cp_build_unary_op): New.
+ (build_x_conditional_expr): Add tsubst_flags_t parameter.
+ (build_x_compound_expr): Ditto.
+ (build_compound_expr): Ditto.
+ (build_static_cast): Ditto.
+ (build_reinterpret_cast): Ditto.
+ (build_const_cast): Ditto.
+ (build_c_cast): Ditto.
+ (build_x_modify_expr): Ditto.
+ (cp_build_modify_expr): New.
+ (convert_for_initialization): Add tsubst_flags_t parameter.
+ (cp_build_binary_op): Remove macro; add function declaration.
+ (invalid_nonstatic_memfn_p): Add tsubst_flags_t parameter.
+ (lvalue_or_else): Ditto.
+ (build_functional_cast): Ditto.
+ * typeck2.c (digest_init): Fix calls for SFINAE.
+ (process_init_constructor_array): Ditto.
+ (process_init_constructor_record): Ditto.
+ (build_x_arrow): Ditto.
+ (build_m_component_ref): Ditto.
+ (build_functional_cast): Add SFINAE support.
+ * pt.c (tsubst_copy_and_build): Add (more) SFINAE support.
+ * semantics.c (simplify_loop_decl_cond): Fix calls for SFINAE.
+ (finish_expr_stmt): Ditto.
+ (finish_for_expr): Ditto.
+ (finish_asm_stmt): Ditto.
+ (finish_non_static_data_member): Ditto.
+ (finish_qualified_id_expr): Ditto.
+ (finish_call_expr): Add SFINAE support.
+ (finish_increment_expr): Fix calls for SFINAE.
+ (finish_unary_op_expr): Ditto.
+ (simplify_aggr_init_expr): Ditto.
+ (finish_omp_clauses): Ditto.
+ (finish_omp_for): Ditto.
+ (finish_omp_barrier): Ditto.
+ (finish_omo_flush): Ditto.
+ * decl2.c (grok_array_decl): Fix calls or SFINAE.
+ (build_anon_union_vars): Ditto.
+ (get_guard_cond): Ditto.
+ (set_guard): Ditto.
+ (one_static_initialization_or_destruction): Ditto.
+ (do_static_initialization_or_destruction): Ditto.
+ (generate_ctor_or_dtor_function): Ditto.
+ (build_offset_ref_call_from_tree): Ditto.
+ * parser.c (cp_parser_postfix_expression): Fix calls for SFINAE.
+ (cp_parser_postfix_dot_deref_expression): Ditto.
+ (cp_parser_unary_expression): Ditto.
+ (cp_parser_new_expression): Ditto.
+ (cp_parser_cast_expression): Ditto.
+ (cp_parser_binary_expression): Ditto.
+ (cp_parser_question_colon_clause): Ditto.
+ (cp_parser_assignment_expression): Ditto.
+ (cp_parser_expression): Ditto.
+ (cp_parser_builtin_offsetof): Ditto.
+ (cp_parser_template_argument): Ditto.
+ (cp_parser_functional_cast): Ditto.
2008-03-24 Tom Tromey <tromey@redhat.com>
@@ -1086,8 +1598,8 @@
2008-03-18 Paolo Bonzini <bonzini@gnu.org>
- * cp-lang.c (LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS): Delete.
-
+ * cp-lang.c (LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS): Delete.
+
2008-03-17 Jason Merrill <jason@redhat.com>
PR c++/35548
@@ -1100,17 +1612,17 @@
Revert:
2008-02-04 Richard Guenther <rguenther@suse.de>
- PR java/35035
- * decl.c (record_builtin_java_type): Make jboolean a
- integer type again where its mode doesn't match that of bool.
+ PR java/35035
+ * decl.c (record_builtin_java_type): Make jboolean a
+ integer type again where its mode doesn't match that of bool.
2008-01-25 Richard Guenther <rguenther@suse.de>
- PR c++/33887
- * decl.c (record_builtin_java_type): Make __java_boolean
- a variant of bool.
- * typeck.c (structural_comptypes): Move TYPE_FOR_JAVA check
- after TYPE_MAIN_VARIANT check.
+ PR c++/33887
+ * decl.c (record_builtin_java_type): Make __java_boolean
+ a variant of bool.
+ * typeck.c (structural_comptypes): Move TYPE_FOR_JAVA check
+ after TYPE_MAIN_VARIANT check.
2008-03-10 Jakub Jelinek <jakub@redhat.com>
@@ -1166,7 +1678,7 @@
(convert_to_void): Use error instead of pedwarn.
* error.c (cp_cpp_error): Use pedantic_warning_kind.
* decl.c (compute_array_index_type): Use constant_expression_error.
-
+
2008-03-01 Douglas Gregor <doug.gregor@gmail.com>
* parser.c (cp_lexer_next_token_is_decl_specifier_keyword): Note
@@ -1239,7 +1751,7 @@
PR 26264
* call.c (magic_varargs_p): Remove BUILT_IN_STDARG_START.
-
+
2008-02-26 Richard Guenther <rguenther@suse.de>
* decl.c (duplicate_decls): Remove decl from global mapping
@@ -1247,25 +1759,25 @@
2008-02-26 Paolo Carlini <pcarlini@suse.de>
- PR c++/35323
- * name-lookup.c (arg_assoc_type): Handle FIXED_POINT_TYPE.
+ PR c++/35323
+ * name-lookup.c (arg_assoc_type): Handle FIXED_POINT_TYPE.
2008-02-26 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
-
+
* typeck.c (build_class_member_access_expr): Add appropriate
OPT_W* parameter to warning.
(build_reinterpret_cast_1): Likewise.
* name-lookup.c (push_overloaded_decl): Likewise.
-
+
2008-02-25 Paolo Carlini <pcarlini@suse.de>
- PR c++/35333
- * error.c (dump_expr): Handle CONJ_EXPR.
+ PR c++/35333
+ * error.c (dump_expr): Handle CONJ_EXPR.
2008-02-25 Paolo Carlini <pcarlini@suse.de>
- PR c++/35338
- * error.c (dump_type): Handle FIXED_POINT_TYPE.
+ PR c++/35338
+ * error.c (dump_type): Handle FIXED_POINT_TYPE.
(dump_expr): Handle FIXED_CST.
2008-02-24 Jason Merrill <jason@redhat.com>
@@ -1274,7 +1786,7 @@
(cp_parser_namespace_definition): Likewise.
PR c++/33486
- * name-lookup.c (arg_assoc_namespace): Look down into inline
+ * name-lookup.c (arg_assoc_namespace): Look down into inline
namespaces, too.
2008-02-23 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
@@ -1286,7 +1798,7 @@
(build_reinterpret_cast_1): Update call to
check_for_casting_away_constness.
(build_const_cast_1): Likewise.
-
+
2008-02-24 Paolo Carlini <pcarlini@suse.de>
* error.c (dump_expr): Don't deal directly with NEW_EXPR (and
@@ -1310,8 +1822,8 @@
Revert:
2008-02-14 Paolo Carlini <pcarlini@suse.de>
- PR c++/28743
- * pt.c (determine_specialization): In case of function templates,
+ PR c++/28743
+ * pt.c (determine_specialization): In case of function templates,
when the type of DECL does not match FN there is no match.
2008-02-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
@@ -1378,8 +1890,8 @@
2008-02-14 Paolo Carlini <pcarlini@suse.de>
- PR c++/28743
- * pt.c (determine_specialization): In case of function templates,
+ PR c++/28743
+ * pt.c (determine_specialization): In case of function templates,
when the type of DECL does not match FN there is no match.
2008-02-13 Jakub Jelinek <jakub@redhat.com>
@@ -1392,7 +1904,7 @@
2008-02-13 Jason Merrill <jason@redhat.com>
PR c++/34962, c++/34937, c++/34939
- * decl2.c (is_late_template_attribute): Always defer attributes
+ * decl2.c (is_late_template_attribute): Always defer attributes
vector_size and weak.
PR c++/34774
@@ -1426,12 +1938,12 @@
2008-02-11 Douglas Gregor <doug.gregor@gmail.com>
- PR c++/35113
- * tree.c (cp_build_qualified_type_real): When building a
- cv-qualified array type, build it as a unique type with
- build_cplus_array_type_1 and then adopt the unqualified type's
- main variant.
-
+ PR c++/35113
+ * tree.c (cp_build_qualified_type_real): When building a
+ cv-qualified array type, build it as a unique type with
+ build_cplus_array_type_1 and then adopt the unqualified type's
+ main variant.
+
2008-02-11 Paolo Carlini <pcarlini@suse.de>
PR c++/35077
@@ -1440,7 +1952,7 @@
2008-02-10 Jason Merrill <jason@redhat.com>
PR c++/34094
- * decl2.c (cp_write_global_declarations): Don't write out static
+ * decl2.c (cp_write_global_declarations): Don't write out static
data members with DECL_IN_AGGR_P set.
2008-02-08 Jason Merrill <jason@redhat.com>
@@ -1493,7 +2005,7 @@
TYPE_MAIN_VARIANT to add new attributes, be sure to also modify
all of the other variants to add those same attributes. Otherwise,
the main variant will be inconsistent with those other variants.
-
+
2008-02-04 Richard Guenther <rguenther@suse.de>
PR java/35035
@@ -1509,7 +2021,7 @@
* typeck2.c (build_functional_cast): Call it.
* cp-gimplify.c (cp_gimplify_init_expr): Handle its output.
- * cp-tree.h (TYPE_HAS_USER_CONSTRUCTOR): Rename from
+ * cp-tree.h (TYPE_HAS_USER_CONSTRUCTOR): Rename from
TYPE_HAS_CONSTRUCTOR.
* class.c (finish_struct_bits, maybe_warn_about_overly_private_class,
add_implicitly_declared_members): Adjust.
@@ -1526,15 +2038,15 @@
(instantiate_class_template): Adjust.
2008-01-31 Douglas Gregor <doug.gregor@gmail.com>
- Jakub Jelinek <jakub@redhat.com>
+ Jakub Jelinek <jakub@redhat.com>
- PR c++/34935
- PR c++/34936
- * typeck.c (structural_comptypes): Handle comparisons of
- VOID_TYPE, BOOLEAN_TYPE, INTEGER_TYPE, FIXED_POINT_TYPE, and
- REAL_TYPE nodes.
- * mangle.c (write_builtin_type): Map down to the canonical type,
- which will be one of the predefined type nodes.
+ PR c++/34935
+ PR c++/34936
+ * typeck.c (structural_comptypes): Handle comparisons of
+ VOID_TYPE, BOOLEAN_TYPE, INTEGER_TYPE, FIXED_POINT_TYPE, and
+ REAL_TYPE nodes.
+ * mangle.c (write_builtin_type): Map down to the canonical type,
+ which will be one of the predefined type nodes.
2008-01-29 Michael Meissner <michael.meissner@amd.com>
@@ -1567,7 +2079,7 @@
(check_for_bare_parameter_packs): Parameter is now a tree, not a
tree*.
(process_template_parm): Tweak call to
- check_for_bare_parameter_packs.
+ check_for_bare_parameter_packs.
(push_template_decl_real): Tweak calls to
check_for_bare_parameter_packs. If bare parameter packs are found
in the list of exceptions, clear out that list after giving an
@@ -1635,7 +2147,7 @@
to complex.
(compare_ics): Such a conversion is worse than a normal arithmetic
conversion.
-
+
2008-01-25 Richard Guenther <rguenther@suse.de>
PR c++/33887
@@ -1644,14 +2156,14 @@
2008-01-24 Paolo Carlini <pcarlini@suse.de>
- PR c++/34603
- * pt.c (push_template_decl_real): Return error_mark_node in case
+ PR c++/34603
+ * pt.c (push_template_decl_real): Return error_mark_node in case
of template definition of non-template.
2008-01-24 Jason Merrill <jason@redhat.com>
PR c++/34913
- * decl2.c (is_late_template_attribute): Defer any attribute with
+ * decl2.c (is_late_template_attribute): Defer any attribute with
dependent args. Also defer type attributes if the type is dependent.
2008-01-22 Jakub Jelinek <jakub@redhat.com>
@@ -1667,13 +2179,13 @@
2008-01-22 Jason Merrill <jason@redhat.com>
PR c++/28560
- * decl.c (groktypename): Also ignore attributes on dependent
+ * decl.c (groktypename): Also ignore attributes on dependent
possibly-class types.
PR c++/34912
- * friend.c (do_friend): Check for prior declaration of a friend
+ * friend.c (do_friend): Check for prior declaration of a friend
function of a local class.
- * name-lookup.c (lookup_name_innermost_nonclass_level):
+ * name-lookup.c (lookup_name_innermost_nonclass_level):
No longer static.
* name-lookup.h: Declare it.
@@ -1715,14 +2227,14 @@
2008-01-20 Paolo Carlini <pcarlini@suse.de>
- PR c++/34891
- * error.c (dump_expr): Deal with VIEW_CONVERT_EXPR.
+ PR c++/34891
+ * error.c (dump_expr): Deal with VIEW_CONVERT_EXPR.
2008-01-20 Paolo Carlini <pcarlini@suse.de>
- PR c++/34776
+ PR c++/34776
PR c++/34486
- * name-lookup.c (do_class_using_decl): Do not call constructor_name_p
+ * name-lookup.c (do_class_using_decl): Do not call constructor_name_p
on non-IS_AGGR_TYPE scope.
(constructor_name_p): Assert IS_AGGR_TYPE.
@@ -1802,42 +2314,42 @@
2008-01-15 Douglas Gregor <doug.gregor@gmail.com>
- PR c++/34314
- * error.c (dump_simple_decl): Display ellipsis for template
- non-type parameter packs.
- (dump_decl): Display ellipsis for template type parameter packs.
- (dump_template_decl): Display ellipsis for template template
- parameter packs.
- * pt.c (redeclare_class_template): When redeclaring a class
- template, check for collisions between template parameters and
- template parameter packs.
+ PR c++/34314
+ * error.c (dump_simple_decl): Display ellipsis for template
+ non-type parameter packs.
+ (dump_decl): Display ellipsis for template type parameter packs.
+ (dump_template_decl): Display ellipsis for template template
+ parameter packs.
+ * pt.c (redeclare_class_template): When redeclaring a class
+ template, check for collisions between template parameters and
+ template parameter packs.
2008-01-15 Douglas Gregor <doug.gregor@gmail.com>
- PR c++/33964
- * pt.c (process_partial_specialization): Don't mark template
- parameters that occur in non-deduced contexts.
- (struct pair_fn_data): Add include_nondeduced_p.
- (for_each_template_parm_r): Only visit non-deduced contexts if
- include_nondeduced_p is set.
- (for_each_template_parm): Added parameter include_nondeduced_p,
- which states whether template parameters found in non-deduced
- contexts should be visited.
- (uses_template_parms): Visit all template parameters, even those
- in non-deduced contexts.
+ PR c++/33964
+ * pt.c (process_partial_specialization): Don't mark template
+ parameters that occur in non-deduced contexts.
+ (struct pair_fn_data): Add include_nondeduced_p.
+ (for_each_template_parm_r): Only visit non-deduced contexts if
+ include_nondeduced_p is set.
+ (for_each_template_parm): Added parameter include_nondeduced_p,
+ which states whether template parameters found in non-deduced
+ contexts should be visited.
+ (uses_template_parms): Visit all template parameters, even those
+ in non-deduced contexts.
2008-01-15 Douglas Gregor <doug.gregor@gmail.com>
- PR c++/34052
- * pt.c (check_default_tmpl_args): Check for parameter packs that
- aren't at the end of a primary template.
- (push_template_decl_real): Remove check for parameter packs that
- aren't at the end of a primary template; that now happens in
- check_default_tmpl_args.
- * semantics.c (finish_template_template_parm): Use
- check_default_tmpl_args to check for errors in the template
- parameter list.
-
+ PR c++/34052
+ * pt.c (check_default_tmpl_args): Check for parameter packs that
+ aren't at the end of a primary template.
+ (push_template_decl_real): Remove check for parameter packs that
+ aren't at the end of a primary template; that now happens in
+ check_default_tmpl_args.
+ * semantics.c (finish_template_template_parm): Use
+ check_default_tmpl_args to check for errors in the template
+ parameter list.
+
2008-01-12 Doug Kwan <dougkwan@google.com>
* decl.c: (grokdeclarator): Use OPT_Wignored_qualifiers
@@ -1861,9 +2373,9 @@
2008-01-01 Douglas Gregor <doug.gregor@gmail.com>
- * parser.c (cp_parser_check_decl_spec): Don't warn about "long
- long" in C++0x mode; change the warning to note that "long long"
- is only unsupported in C++98 mode.
+ * parser.c (cp_parser_check_decl_spec): Don't warn about "long
+ long" in C++0x mode; change the warning to note that "long long"
+ is only unsupported in C++98 mode.
2007-12-20 Jason Merrill <jason@redhat.com>
@@ -1881,13 +2393,13 @@
2007-12-18 Jason Merrill <jason@redhat.com>
PR c++/34206
- * pt.c (tsubst_aggr_type): Do nothing if the type already doesn't
+ * pt.c (tsubst_aggr_type): Do nothing if the type already doesn't
use template parms.
(dependent_type_p_r): Handle the domain of an array.
2007-12-18 Douglas Gregor <doug.gregor@gmail.com>
- Jakub Jelinek <jakub@redhat.com>
-
+ Jakub Jelinek <jakub@redhat.com>
+
PR c++/32565
PR c++/33943
PR c++/33965
@@ -1896,9 +2408,9 @@
arguments have been deduced.
(coerce_template_parms): Don't complain when COMPLAIN doesn't
include tf_error.
- (fn_type_unification): Use template_template_parm_bindings_ok_p.
- (unify): Deal with variadic, bound template template parameters.
- (get_class_bindings): Use template_template_parm_bindings_ok_p.
+ (fn_type_unification): Use template_template_parm_bindings_ok_p.
+ (unify): Deal with variadic, bound template template parameters.
+ (get_class_bindings): Use template_template_parm_bindings_ok_p.
2007-12-18 Jakub Jelinek <jakub@redhat.com>
@@ -1968,38 +2480,38 @@
2007-12-04 Douglas Gregor <doug.gregor@gmail.com>
- PR c++/34101
- * name-lookup.c (arg_assoc_template_arg): Recurse on argument
- packs.
- (arg_assoc_type): We don't need to handle TYPE_ARGUMENT_PACK here,
- since arg_assoc_template_arg will deal with them (better).
+ PR c++/34101
+ * name-lookup.c (arg_assoc_template_arg): Recurse on argument
+ packs.
+ (arg_assoc_type): We don't need to handle TYPE_ARGUMENT_PACK here,
+ since arg_assoc_template_arg will deal with them (better).
2007-12-04 Douglas Gregor <doug.gregor@gmail.com>
- PR c++/33509
- * pt.c (tsubst_exception_specification): Handle substitutions into
- member templates, where tsubst_pack_expansion returns a
- TYPE_PACK_EXPANSION.
+ PR c++/33509
+ * pt.c (tsubst_exception_specification): Handle substitutions into
+ member templates, where tsubst_pack_expansion returns a
+ TYPE_PACK_EXPANSION.
2007-12-04 Douglas Gregor <doug.gregor@gmail.com>
- PR c++/33091
- * pt.c (unify_pack_expansion): If we didn't deduce any actual
- bindings for the template parameter pack, don't try to keep the
- empty deduced arguments.
- (unify): If a parameter is a template-id whose template argument
- list contains a pack expansion that is not at the end, then we
- cannot unify against that template-id.
+ PR c++/33091
+ * pt.c (unify_pack_expansion): If we didn't deduce any actual
+ bindings for the template parameter pack, don't try to keep the
+ empty deduced arguments.
+ (unify): If a parameter is a template-id whose template argument
+ list contains a pack expansion that is not at the end, then we
+ cannot unify against that template-id.
2007-12-02 Paolo Carlini <pcarlini@suse.de>
- PR c++/34061
- * pt.c (current_template_args): Use error_operand_p.
+ PR c++/34061
+ * pt.c (current_template_args): Use error_operand_p.
2007-12-02 Paolo Carlini <pcarlini@suse.de>
- PR c++/34273
- * error.c (dump_decl): Handle TREE_BINFO.
+ PR c++/34273
+ * error.c (dump_decl): Handle TREE_BINFO.
2007-12-01 Ollie Wild <aaw@google.com>
@@ -2039,7 +2551,7 @@
2007-11-26 Andreas Krebbel <krebbel1@de.ibm.com>
PR c++/34081
- * decl.c (start_preparsed_function): Pass
+ * decl.c (start_preparsed_function): Pass
processing_template_decl for the new allocate_struct_function
parameter.
@@ -2068,11 +2580,11 @@
2007-11-23 Mark Mitchell <mark@codesourcery.com>
Manuel Lopez-Ibanez <manu@gcc.gnu.org>
-
+
PR c++/5310
* call.c (convert_like_real): Build a zero constant when __null is
converted to an integer type.
-
+
2007-11-22 Jakub Jelinek <jakub@redhat.com>
PR c++/34094
@@ -2243,7 +2755,7 @@
check_for_bare_parameter_packs.
(finish_member_declaration): Ditto.
* parser.c (cp_parser_base_clause): Ditto.
-
+
2007-11-06 Jakub Jelinek <jakub@redhat.com>
PR target/33168
@@ -2281,7 +2793,7 @@
PR c++/33939
* pt.c (unify_pack_expansion): bring handling of function call
- arguments into line with type_unification_real.
+ arguments into line with type_unification_real.
2007-11-05 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
@@ -2355,12 +2867,12 @@
Fix typo.
2007-10-31 Christian Bruel <christian.bruel@st.com>
- Mark Mitchell <mark@codesourcery.com>
+ Mark Mitchell <mark@codesourcery.com>
PR c++/19531
* typeck.c (check_return_expr): Don't set named_return_value_okay_p
- if retval is volatile.
-
+ if retval is volatile.
+
2007-10-30 Jakub Jelinek <jakub@redhat.com>
PR c++/33616
@@ -2427,7 +2939,7 @@
PR c++/24791
* pt.c (get_template_info): New fn.
(template_class_depth): Use it.
- (push_template_decl_real): Check that the template args of the
+ (push_template_decl_real): Check that the template args of the
definition match the args of the previous declaration.
2007-10-26 Paolo Carlini <pcarlini@suse.de>
@@ -2471,8 +2983,8 @@
PR c++/25950 (DR 391)
* call.c (struct conversion): Remove check_copy_constructor_p.
- (reference_binding): Always bind a reference directly to a
- compatible class rvalue. Pass down LOOKUP_NO_TEMP_BIND during
+ (reference_binding): Always bind a reference directly to a
+ compatible class rvalue. Pass down LOOKUP_NO_TEMP_BIND during
temporary creation.
(check_constructor_callable): Remove.
(convert_like_real): Don't call it.
@@ -2577,7 +3089,7 @@
(leave_scope): Don't pop_visibility.
* name-lookup.h (struct cp_binding_level): Remove has_visibility.
* parser.c (cp_parser_namespace_definition): Call
- handle_namespace_attrs and pop_visibility as appropriate.
+ handle_namespace_attrs and pop_visibility as appropriate.
PR c++/11756
* mangle.c (write_type) [TYPEOF_TYPE]: Just sorry.
@@ -2597,7 +3109,7 @@
2007-09-29 Jason Merrill <jason@redhat.com>
PR c++/33094
- * decl.c (make_rtl_for_nonlocal_decl): It's ok for a member
+ * decl.c (make_rtl_for_nonlocal_decl): It's ok for a member
constant to not have DECL_EXTERNAL if it's file-local.
2007-09-28 Ollie Wild <aaw@google.com>
@@ -2680,14 +3192,14 @@
2007-09-24 Danny Smith <dannysmith@user.sourceforge.net>
PR c++/14688
- * search.c (check_final_overrider): Fail if
+ * search.c (check_final_overrider): Fail if
targetm.comp_type_attributes returns 0.
2007-09-24 Jason Merrill <jason@redhat.com>
PR c++/33239
* pt.c (resolve_typename_type): Don't look things up in the original
- template if it would mean losing template arguments.
+ template if it would mean losing template arguments.
2007-09-24 Jakub Jelinek <jakub@redhat.com>
@@ -2698,22 +3210,22 @@
2007-09-24 Douglas Gregor <doug.gregor@gmail.com>
- PR c++/33185
+ PR c++/33185
* tree.c (cp_build_qualified_type_real): Build a canonical
ARRAY_TYPE if the original ARRAY_TYPE was not a canonical type.
-
+
2007-09-24 Douglas Gregor <doug.gregor@gmail.com>
PR c++/33112
- PR c++/33185
+ PR c++/33185
* tree.c (cplus_array_compare): Compare pointers, not types.
(build_cplus_array_type_1): Store new array type into the hash
table before building the canonical type; build the canonical type
correctly.
(cp_build_qualified_type_real): Put all of the array types with
- cv-qualified element types into the C++ array hash table, built as
+ cv-qualified element types into the C++ array hash table, built as
variants of the unqualified versions.
-
+
2007-09-23 Jason Merrill <jason@redhat.com>
PR c++/16370
@@ -2759,7 +3271,7 @@
PR c++/7586
* pt.c (tsubst): Handle typedefs by looking for the specialization.
- (retrieve_specialization): Only tagged types use
+ (retrieve_specialization): Only tagged types use
DECL_TEMPLATE_INSTANTIATIONS.
(instantiate_class_template): Push nested classes too.
(tsubst_decl) [TYPE_DECL]: Only check for canonical decl for
@@ -2996,7 +3508,7 @@
2007-08-31 Douglas Gregor <doug.gregor@gmail.com>
* mangle.c (write_type): Change mangling of rvalue reference from
- `RR' to `O'.
+ `RR' to `O'.
2007-08-31 Jakub Jelinek <jakub@redhat.com>
@@ -3054,7 +3566,7 @@
2007-08-27 Jason Merrill <jason@redhat.com>
PR c++/29000
- * pt.c (build_non_dependent_expr, type_dependent_expression_p):
+ * pt.c (build_non_dependent_expr, type_dependent_expression_p):
Look inside STMT_EXPR.
* semantics.c (stmt_expr_value_expr): New fn.
* cp-tree.h: Declare it.
@@ -3067,7 +3579,7 @@
* decl.c (duplicate_decls): Merge DECL_DISREGARD_INLINE_LIMITS.
2007-08-28 Gabriel Dos Reis <gdr@integrable-solutions.net>
-
+
* error.c (dump_expr): Handle COMPLEX_CST.
* cxx-pretty-print.c (pp_cxx_primary_expression): Likewise.
(pp_cxx_expression): Likewise.
@@ -3415,9 +3927,9 @@
PR c++/30851
* parser.c (cp_parser_asm_definition): Detect and discard asm
statements with invalid inputs or outputs.
- (cp_parser_asm_operand_list): Return error mark node if any
- of the operands are invalid. Adjust documentation.
-
+ (cp_parser_asm_operand_list): Return error mark node if any
+ of the operands are invalid. Adjust documentation.
+
2007-08-02 Nick Clifton <nickc@redhat.com>
* typeck.c: Change copyright header to refer to version 3 of the
@@ -3568,7 +4080,7 @@
canonical types; otherwise, fall back to structural type
comparisons. If ENABLE_CHECKING and USE_CANONICAL_TYPES, give an
internal compiler error if the canonical types are wrong.
-
+
2007-07-11 Paolo Carlini <pcarlini@suse.de>
PR c++/32560
@@ -3635,7 +4147,7 @@
tests when comparing pointer-to-member-function types, because the
handling of TYPE_GET_PTRMEMFUNC_TYPE currently defeats canonical
types.
-
+
2007-07-03 Mark Mitchell <mark@codesourcery.com>
* init.c (build_new): Tweak comment.
@@ -3855,9 +4367,9 @@
* semantics.c (finish_trait_expr): Complete the types.
2007-05-30 Russell Yanofsky <russ@yanofsky.org>
- Douglas Gregor <doug.gregor@gmail.com>
- Pedro Lamarao <pedro.lamarao@mndfck.org>
- Howard Hinnant <howard.hinnant@gmail.com>
+ Douglas Gregor <doug.gregor@gmail.com>
+ Pedro Lamarao <pedro.lamarao@mndfck.org>
+ Howard Hinnant <howard.hinnant@gmail.com>
PR c++/7412
PR c++/29939
@@ -3898,7 +4410,7 @@
rvalue references.
(cp_parser_make_indirect_declarator): New.
(cp_parser_new_declarator_opt): Call
- cp_parser_make_indirect_declarator.
+ cp_parser_make_indirect_declarator.
(cp_parser_conversion_declarator_opt): Ditto.
(cp_parser_declarator): Ditto.
(cp_parser_ptr_operator): Parse "&&" tokens into rvalue reference
@@ -3927,7 +4439,7 @@
case POSTDECREMENT_EXPR>): Return the error_mark_node
if either the real or imaginary parts would an
error_mark_node.
-
+
2007-05-25 Simon Martin <simartin@users.sourceforge.net>
Manuel Lopez-Ibanez <manu@gcc.gnu.org>
@@ -4024,14 +4536,14 @@
* typeck.c (build_indirect_ref): Add call to
strict_aliasing_warning.
(build_reinterpret_cast_1): Condition call to
- strict_aliasing_warning.
+ strict_aliasing_warning.
2007-05-11 Jan Hubicka <jh@suse.cz>
* semantics.c (expand_or_defer_fn): Do not call c_record_cdtor_fn.
* decl2.c (start_objects): ctors and dtors are no longer public.
(cp_write_global_declarations): Do not call c_build_cdtor_fns.
-
+
2007-05-07 Andrew Pinski <andrew_pinski@playstation.sony.com>
* typeck.c (build_unary_op): Remove code that used to
@@ -4057,7 +4569,7 @@
2007-05-02 Seongbae Park <seongbae.park@gmail.com>
PR c++/31663
- * decl2.c (constrain_class_visibility):
+ * decl2.c (constrain_class_visibility):
Use strip_pointer_or_array_types instead of strip_array_types.
2007-04-28 Andrew Pinski <andrew_pinski@playstation.sony.com>
@@ -4073,8 +4585,8 @@
2007-04-27 Douglas Gregor <doug.gregor@gmail.com>
* error.c (maybe_warn_variadic_templates): Variadic templates are
- now in C++0x, so only warn about them in C++98 mode.
-
+ now in C++0x, so only warn about them in C++98 mode.
+
2007-04-26 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR C++/30016
@@ -4181,7 +4693,7 @@
* cp-objcp-common.c (cxx_staticp): Remove.
* cp-objcp-common.h (LANG_HOOKS_STATICP): Remove.
- * cp-tree.h (cxx_staticp):
+ * cp-tree.h (cxx_staticp):
2007-04-04 Danny Smith <dannysmith.users.sourceforge.net>
@@ -4218,11 +4730,11 @@
(cp_parser_parameter_declaration): Ditto. Also, handle when TYPE
is NULL.
* pt.c (find_parameter_packs_r): Look into the bounds on integer
- types (they could be used as array bounds).
+ types (they could be used as array bounds).
(check_for_bare_parameter_packs): Deal with TEMPLATE_PARM_INDEX.
(tsubst_pack_expansion): Handle failure to expand parameter
packs.
-
+
2007-03-30 Paolo Carlini <pcarlini@suse.de>
PR c++/26099
@@ -4360,13 +4872,13 @@
(cp_parser_namespace_alias_definition): if we find an open brace
instead of '=', then this is actually a misplaced namespace
definition.
-
+
2007-03-15 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR c++/24924
* decl.c (cxx_init_decl_processing): Move command-line options
processing to c-opts.c.
-
+
2007-03-15 Douglas Gregor <doug.gregor@gmail.com>
* ptree.c (cxx_print_type): Use formatting markup for integers
@@ -4390,7 +4902,7 @@
(make_pack_expansion): Ditto.
(check_for_bare_parameter_packs): Ditto.
* name-lookup.c (push_to_top_level): Make need_pop a bool value.
-
+
2007-03-14 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR c++/31165
@@ -4413,13 +4925,13 @@
2007-03-14 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
* class.c (warn_hidden): Add OPT_Woverloaded_virtual to warning.
-
+
2007-03-14 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR c/21438
* typeck.c (build_binary_op): Call warn_for_div_zero instead of
warning.
-
+
2007-03-13 Alexandre Oliva <aoliva@redhat.com>
* repo.c (init_repo): Initialize random_seed saved options.
@@ -4448,7 +4960,7 @@
PR c++/30328
* semantics.c (finish_typeof): Use unlowered_expr_type.
-
+
2007-03-10 Mark Mitchell <mark@codesourcery.com>
PR c++/30274
@@ -4492,7 +5004,7 @@
* operators.def: Add ellipsis operator for EXPR_PACK_EXPANSION.
* tree.c (cp_walk_subtrees): Walk BASELINK, TYPE_ARGUMENT_PACK,
NONTYPE_ARGUMENT_PACK, TYPE_PACK_EXPANSION, EXPR_PACK_EXPANSION,
- CAST_EXPR.
+ CAST_EXPR.
* mangle.c (write_type): Mangle TYPE_PACK_EXPANSION.
(write_template_arg): Write argument packs as separate arguments.
* cp-tree.h (struct template_parm_index_s): Add flag that
@@ -4519,17 +5031,17 @@
(struct cp_declarator): Add parameter_pack_p flag.
(maybe_warn_variadic_templates): Declare.
(process_template_parm): Add bool parameter IS_PARAMETER_PACK, to
- indicate a template parameter pack.
+ indicate a template parameter pack.
(uses_parameter_packs): Declare.
(template_parameter_pack_p): Declare.
(template_parms_variadic_p): Declare.
(make_pack_expansion): Declare.
(check_for_bare_parameter_packs): Declare.
* cxx-pretty-print.c (pp_cxx_unary_expression): Print
- sizeof... expressions.
+ sizeof... expressions.
(pp_cxx_expression): Print pack expansions and non-type argument
packs.
- (pp_cxx_exception_specification): Print pack expansions.
+ (pp_cxx_exception_specification): Print pack expansions.
(pp_cxx_direct_declarator): Print ellipsis for parameter packs.
(pp_cxx_ctor_initializer): Print pack expansions.
(pp_cxx_type_id): Print pack expansions.
@@ -4571,7 +5083,7 @@
comparing template argument lists.
(mangle_class_name_for_template): Make argument packs as separate
template arguments.
- (for_each_template_parm_r): No need to handle BASELINK.
+ (for_each_template_parm_r): No need to handle BASELINK.
(instantiate_class_template): Handle pack expansions in the base
class list.
(tsubst_pack_expansion): New.
@@ -4583,10 +5095,10 @@
argument types.
(tsubst_exception_specification): Handle pack expansions in
exception specifiers.
- (tsubst): See through ARGUMENT_PACK_SELECT arguments when
+ (tsubst): See through ARGUMENT_PACK_SELECT arguments when
replacing a template parameter with its argument. If we encounter
a substitution for an argument pack, just return the parameter
- itself.
+ itself.
(tsubst_copy): sizeof(X...) returns the number of elements in
parameter pack X. See through ARGUMENT_PACK_SELECT when the
PARM_DECL is a parameter pack.
@@ -4672,13 +5184,13 @@
end a template argument.
* tree.c (cp_walk_subtrees): Walk BASELINK, TYPE_ARGUMENT_PACK,
NONTYPE_ARGUMENT_PACK, TYPE_PACK_EXPANSION, EXPR_PACK_EXPANSION,
- CAST_EXPR.
+ CAST_EXPR.
2007-03-09 Dirk Mueller <dmueller@suse.de>
* call.c (build_new_op): Call warn_logical_operator.
-2007-03-08 Volker Reichelt <reichelt@netcologne.de>
+2007-03-08 Volker Reichelt <v.reichelt@netcologne.de>
PR c++/30852
* semantics.c (finish_offsetof): Handle COMPOUND_EXPR.
@@ -4692,7 +5204,7 @@
* decl.c (grokdeclarator): Disable warnings for anonymous
bitfields.
-2007-03-05 Volker Reichelt <reichelt@netcologne.de>
+2007-03-05 Volker Reichelt <v.reichelt@netcologne.de>
* typeck2.c (readonly_error): Always emit a hard error.
Remove last argument.
@@ -4716,7 +5228,7 @@
(cp_parser_selection_statement): Set IN_IF_STMT bit when parsing
body of 'if'.
(cp_parser_jump_statement): Mask new IN_IF_STMT bit.
-
+
2007-03-02 Simon Martin <simartin@users.sourceforge.net>
PR c++/28253
@@ -4732,7 +5244,7 @@
2007-03-02 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
* typeck.c (common_base_type): Delete unused function.
-
+
2007-03-01 Brooks Moses <brooks.moses@codesourcery.com>
* Make-lang.in: Add dummy lang.install-pdf target.
@@ -4829,7 +5341,7 @@
2007-02-15 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR C++/30158
- * semantics.c (finish_stmt_expr_expr): Set TREE_TYPE of the
+ * semantics.c (finish_stmt_expr_expr): Set TREE_TYPE of the
statement expression if we had an error mark node.
2007-02-15 Sandra Loosemore <sandra@codesourcery.com>
@@ -4839,15 +5351,15 @@
* cp-tree.def (AGGR_INIT_EXPR): Adjust documentation.
Change class to tcc_vl_exp.
- * call.c (build_call): Use build_call_list instead
- of build3.
+ * call.c (build_call): Use build_call_list instead
+ of build3.
(build_over_call): Likewise.
- (build_new_method_call): Use build_min_non_dep_call_list
+ (build_new_method_call): Use build_min_non_dep_call_list
instead of build_min_non_dep.
* error.c (dump_call_expr_args): New function.
(dump_aggr_init_expr_args): New function.
- (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them.
+ (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them.
Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros.
* cvt.c (convert_to_void): Use build_call_array instead
@@ -4859,7 +5371,7 @@
* dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new
AGGR_INIT_EXPR accessor macros.
- * cp-gimplify.c (cp_gimplify_init_expr): Use
+ * cp-gimplify.c (cp_gimplify_init_expr): Use
AGGR_INIT_EXPR_SLOT to set the slot operand.
* cp-tree.h (AGGR_INIT_EXPR_FN): New macro.
@@ -4888,7 +5400,7 @@
(cp_tree_equal) <CALL_EXPR>: Iterate through the arguments
to check for equality instead of recursing. Handle tcc_vl_exp
tree code classes.
- (stabilize_call): Update to only handle CALL_EXPRs, not
+ (stabilize_call): Update to only handle CALL_EXPRs, not
AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros.
(stabilize_aggr_init): New function.
(stabilize_init): Use it.
@@ -4896,23 +5408,23 @@
* cxx-pretty-print.c (pp_cxx_postfix_expression)
<AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and
AGGR_INIT_EXPR accessor macros and argument iterators.
-
+
* pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with
- build_vl_exp. Iterate through the operands, recursively
+ build_vl_exp. Iterate through the operands, recursively
processing each one.
(tsubst_copy_and_build) <CALL_EXPR>: Update to use new
CALL_EXPR accessor macros.
(value_dependent_expression_p) <default>: Handle tcc_vl_exp
- tree code classes. Use TREE_OPERAND_LENGTH instead of
+ tree code classes. Use TREE_OPERAND_LENGTH instead of
TREE_CODE_LENGTH.
* semantics.c (finish_call_expr): Use build_nt_call_list
instead of build_nt.
- (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR
- accessor macros. Use build_call_array to construct the
+ (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR
+ accessor macros. Use build_call_array to construct the
CALL_EXPR node instead of build3
-
- * decl2.c (build_offset_ref_call_from_tree): Use
+
+ * decl2.c (build_offset_ref_call_from_tree): Use
build_nt_call_list and build_min_non_dep_call_list instead
of build_min_nt and build_min_non_dep.
@@ -4923,7 +5435,7 @@
PR c++/28943
* call.c (build_conditional_expr): Improve error message.
-
+
2007-02-13 Dirk Mueller <dmueller@suse.de>
* friend.c (do_friend): Annotate warning about friend
@@ -5000,9 +5512,9 @@ o2007-02-06 Mark Mitchell <mark@codesourcery.com>
2007-02-03 Douglas Gregor <doug.gregor@gmail.com>
- * parser.c (cp_lexer_get_preprocessor_token): Attach the C++0x
- keyword warning to -Wc++0x-compat.
-
+ * parser.c (cp_lexer_get_preprocessor_token): Attach the C++0x
+ keyword warning to -Wc++0x-compat.
+
2007-02-03 Gabriel Dos Reis <gdr@integrable-solutions.net>
* decl.c (grokdeclarator): Update documentation.
@@ -5027,7 +5539,7 @@ o2007-02-06 Mark Mitchell <mark@codesourcery.com>
to -Wpointer-arith.
* call.c (convert_like_real): Don't warn when converting to
boolean type.
-
+
2007-01-29 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
* decl.c (pop_label): Replace warning with call to
@@ -5115,13 +5627,13 @@ o2007-02-06 Mark Mitchell <mark@codesourcery.com>
* typeck.c (build_binary_op): Call overflow_warning if
TREE_OVERFLOW_P is true for the result and not for any of the
operands.
-
+
2007-01-06 Lee Millward <lee.millward@codesourcery.com>
- PR c++/19439
- * class.c (add_method): Don't wait until template
- instantiation time to complain about duplicate methods.
-
+ PR c++/19439
+ * class.c (add_method): Don't wait until template
+ instantiation time to complain about duplicate methods.
+
2007-01-05 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR c/19978
@@ -5152,7 +5664,7 @@ o2007-02-06 Mark Mitchell <mark@codesourcery.com>
2007-01-02 Douglas Gregor <doug.gregor@gmail.com>
* pt.c (canonical_template_parms): Correct typo in comment.
-
+
2007-01-02 Douglas Gregor <doug.gregor@gmail.com>
* typeck.c (structural_comptypes): Renamed from "comptypes".
diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in
index c7877205f25..03963446251 100644
--- a/gcc/cp/Make-lang.in
+++ b/gcc/cp/Make-lang.in
@@ -239,7 +239,7 @@ cp/decl.o: cp/decl.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) cp/decl.h \
debug.h gt-cp-decl.h $(TIMEVAR_H) $(TREE_FLOW_H) $(TARGET_H)
cp/decl2.o: cp/decl2.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) cp/decl.h $(EXPR_H) \
output.h except.h toplev.h $(RTL_H) $(C_COMMON_H) gt-cp-decl2.h $(CGRAPH_H) \
- $(C_PRAGMA_H) $(TREE_DUMP_H) intl.h $(TARGET_H)
+ $(C_PRAGMA_H) $(TREE_DUMP_H) intl.h $(TARGET_H) $(GIMPLE_H)
cp/cp-objcp-common.o : cp/cp-objcp-common.c $(CONFIG_H) $(SYSTEM_H) \
coretypes.h $(TM_H) $(TREE_H) $(CXX_TREE_H) $(C_COMMON_H) toplev.h \
langhooks.h $(LANGHOOKS_DEF_H) $(DIAGNOSTIC_H) debug.h \
@@ -280,17 +280,17 @@ cp/repo.o: cp/repo.c $(CXX_TREE_H) $(TM_H) toplev.h $(DIAGNOSTIC_H) \
gt-cp-repo.h
cp/semantics.o: cp/semantics.c $(CXX_TREE_H) $(TM_H) except.h toplev.h \
$(FLAGS_H) debug.h output.h $(RTL_H) $(TIMEVAR_H) $(EXPR_H) \
- $(TREE_INLINE_H) $(CGRAPH_H) $(TARGET_H) $(C_COMMON_H)
+ $(TREE_INLINE_H) $(CGRAPH_H) $(TARGET_H) $(C_COMMON_H) $(GIMPLE_H)
cp/dump.o: cp/dump.c $(CXX_TREE_H) $(TM_H) $(TREE_DUMP_H)
cp/optimize.o: cp/optimize.c $(CXX_TREE_H) $(TM_H) rtl.h $(INTEGRATE_H) \
- insn-config.h input.h $(PARAMS_H) debug.h $(TREE_INLINE_H) $(TREE_GIMPLE_H) \
+ insn-config.h input.h $(PARAMS_H) debug.h $(TREE_INLINE_H) $(GIMPLE_H) \
$(TARGET_H)
cp/mangle.o: cp/mangle.c $(CXX_TREE_H) $(TM_H) toplev.h $(REAL_H) \
gt-cp-mangle.h $(TARGET_H) $(TM_P_H)
cp/parser.o: cp/parser.c $(CXX_TREE_H) $(TM_H) $(DIAGNOSTIC_H) gt-cp-parser.h \
output.h $(TARGET_H)
cp/cp-gimplify.o: cp/cp-gimplify.c $(CXX_TREE_H) toplev.h $(C_COMMON_H) \
- $(TM_H) coretypes.h pointer-set.h
+ $(TM_H) coretypes.h pointer-set.h tree-iterator.h
cp/name-lookup.o: cp/name-lookup.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(CXX_TREE_H) $(TIMEVAR_H) gt-cp-name-lookup.h toplev.h \
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 368d95a677f..2f6767388da 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -201,8 +201,7 @@ static void add_candidates (tree, tree, tree, bool, tree, tree,
int, struct z_candidate **);
static conversion *merge_conversion_sequences (conversion *, conversion *);
static bool magic_varargs_p (tree);
-typedef void (*diagnostic_fn_t) (const char *, ...) ATTRIBUTE_GCC_CXXDIAG(1,2);
-static tree build_temp (tree, tree, int, diagnostic_fn_t *);
+static tree build_temp (tree, tree, int, diagnostic_t *);
/* Returns nonzero iff the destructor name specified in NAME matches BASETYPE.
NAME can take many forms... */
@@ -3404,8 +3403,9 @@ build_conditional_expr (tree arg1, tree arg2, tree arg3,
calculated only once. */
if (!arg2)
{
- if (pedantic && (complain & tf_error))
- pedwarn ("ISO C++ forbids omitting the middle term of a ?: expression");
+ if (complain & tf_error)
+ pedwarn (OPT_pedantic,
+ "ISO C++ forbids omitting the middle term of a ?: expression");
/* Make sure that lvalues remain lvalues. See g++.oliva/ext1.C. */
if (real_lvalue_p (arg1))
@@ -3416,7 +3416,7 @@ build_conditional_expr (tree arg1, tree arg2, tree arg3,
/* [expr.cond]
- The first expr ession is implicitly converted to bool (clause
+ The first expression is implicitly converted to bool (clause
_conv_). */
arg1 = perform_implicit_conversion (boolean_type_node, arg1, complain);
@@ -4444,7 +4444,7 @@ enforce_access (tree basetype_path, tree decl, tree diag_decl)
static tree
build_temp (tree expr, tree type, int flags,
- diagnostic_fn_t *diagnostic_fn)
+ diagnostic_t *diagnostic_kind)
{
int savew, savee;
@@ -4454,11 +4454,11 @@ build_temp (tree expr, tree type, int flags,
build_tree_list (NULL_TREE, expr),
type, flags, tf_warning_or_error);
if (warningcount > savew)
- *diagnostic_fn = warning0;
+ *diagnostic_kind = DK_WARNING;
else if (errorcount > savee)
- *diagnostic_fn = error;
+ *diagnostic_kind = DK_ERROR;
else
- *diagnostic_fn = NULL;
+ *diagnostic_kind = 0;
return expr;
}
@@ -4504,13 +4504,15 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
bool c_cast_p, tsubst_flags_t complain)
{
tree totype = convs->type;
- diagnostic_fn_t diagnostic_fn;
+ diagnostic_t diag_kind;
int flags;
if (convs->bad_p
&& convs->kind != ck_user
&& convs->kind != ck_ambig
- && convs->kind != ck_ref_bind)
+ && convs->kind != ck_ref_bind
+ && convs->kind != ck_rvalue
+ && convs->kind != ck_base)
{
conversion *t = convs;
for (; t; t = convs->u.next)
@@ -4679,12 +4681,13 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
conversion (i.e. the second step of copy-initialization), so
don't allow any more. */
flags |= LOOKUP_NO_CONVERSION;
- expr = build_temp (expr, totype, flags, &diagnostic_fn);
- if (diagnostic_fn && fn)
+ expr = build_temp (expr, totype, flags, &diag_kind);
+ if (diag_kind && fn)
{
if ((complain & tf_error))
- diagnostic_fn (" initializing argument %P of %qD", argnum, fn);
- else if (diagnostic_fn == error)
+ emit_diagnostic (diag_kind, input_location, 0,
+ " initializing argument %P of %qD", argnum, fn);
+ else if (diag_kind == DK_ERROR)
return error_mark_node;
}
return build_cplus_new (totype, expr);
@@ -5087,6 +5090,7 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
int is_method = 0;
int nargs;
tree *argarray;
+ bool already_used = false;
/* In a template, there is no need to perform all of the work that
is normally done. We are only interested in the type of the call
@@ -5307,7 +5311,10 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
/* [class.copy]: the copy constructor is implicitly defined even if
the implementation elided its use. */
if (TYPE_HAS_COMPLEX_INIT_REF (DECL_CONTEXT (fn)))
- mark_used (fn);
+ {
+ mark_used (fn);
+ already_used = true;
+ }
/* If we're creating a temp and we already have one, don't create a
new one. If we're not creating a temp but we get one, use
@@ -5367,7 +5374,8 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
return val;
}
- mark_used (fn);
+ if (!already_used)
+ mark_used (fn);
if (DECL_VINDEX (fn) && (flags & LOOKUP_NONVIRTUAL) == 0)
{
@@ -5392,8 +5400,6 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
fn = build_vfn_ref (argarray[0], DECL_VINDEX (fn));
TREE_TYPE (fn) = t;
}
- else if (DECL_INLINE (fn))
- fn = inline_conversion (fn);
else
fn = build_addr_func (fn);
@@ -6641,10 +6647,12 @@ joust (struct z_candidate *cand1, struct z_candidate *cand2, bool warn)
tree source = source_type (w->convs[0]);
if (! DECL_CONSTRUCTOR_P (w->fn))
source = TREE_TYPE (source);
- warning (OPT_Wconversion, "choosing %qD over %qD", w->fn, l->fn);
- warning (OPT_Wconversion, " for conversion from %qT to %qT",
- source, w->second_conv->type);
- inform (" because conversion sequence for the argument is better");
+ if (warning (OPT_Wconversion, "choosing %qD over %qD", w->fn, l->fn)
+ && warning (OPT_Wconversion, " for conversion from %qT to %qT",
+ source, w->second_conv->type))
+ {
+ inform (" because conversion sequence for the argument is better");
+ }
}
else
add_warning (w, l);
@@ -6758,7 +6766,7 @@ tweak:
{
if (warn)
{
- warning (0,
+ pedwarn (0,
"ISO C++ says that these are ambiguous, even "
"though the worst conversion for the first is better than "
"the worst conversion for the second:");
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 12b17f3751c..b08f9c80d29 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -3045,7 +3045,7 @@ check_field_decls (tree t, tree *access_decls,
/* Core issue 80: A nonstatic data member is required to have a
different name from the class iff the class has a
- user-defined constructor. */
+ user-declared constructor. */
if (constructor_name_p (DECL_NAME (x), t)
&& TYPE_HAS_USER_CONSTRUCTOR (t))
permerror ("field %q+#D with same name as class", x);
@@ -3767,8 +3767,8 @@ check_methods (tree t)
if (DECL_PURE_VIRTUAL_P (x))
VEC_safe_push (tree, gc, CLASSTYPE_PURE_VIRTUALS (t), x);
}
- /* All user-declared destructors are non-trivial. */
- if (DECL_DESTRUCTOR_P (x))
+ /* All user-provided destructors are non-trivial. */
+ if (DECL_DESTRUCTOR_P (x) && !DECL_DEFAULTED_FN (x))
TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t) = 1;
}
}
@@ -4067,6 +4067,91 @@ type_has_user_nondefault_constructor (tree t)
return false;
}
+/* Returns true iff FN is a user-provided function, i.e. user-declared
+ and not defaulted at its first declaration. */
+
+static bool
+user_provided_p (tree fn)
+{
+ if (TREE_CODE (fn) == TEMPLATE_DECL)
+ return true;
+ else
+ return (!DECL_ARTIFICIAL (fn)
+ && !(DECL_DEFAULTED_FN (fn)
+ && DECL_INITIALIZED_IN_CLASS_P (fn)));
+}
+
+/* Returns true iff class T has a user-provided constructor. */
+
+bool
+type_has_user_provided_constructor (tree t)
+{
+ tree fns;
+
+ if (!TYPE_HAS_USER_CONSTRUCTOR (t))
+ return false;
+
+ /* This can happen in error cases; avoid crashing. */
+ if (!CLASSTYPE_METHOD_VEC (t))
+ return false;
+
+ for (fns = CLASSTYPE_CONSTRUCTORS (t); fns; fns = OVL_NEXT (fns))
+ if (user_provided_p (OVL_CURRENT (fns)))
+ return true;
+
+ return false;
+}
+
+/* Returns true iff class T has a user-provided default constructor. */
+
+bool
+type_has_user_provided_default_constructor (tree t)
+{
+ tree fns, args;
+
+ if (!TYPE_HAS_USER_CONSTRUCTOR (t))
+ return false;
+
+ for (fns = CLASSTYPE_CONSTRUCTORS (t); fns; fns = OVL_NEXT (fns))
+ {
+ tree fn = OVL_CURRENT (fns);
+ if (TREE_CODE (fn) == FUNCTION_DECL
+ && user_provided_p (fn))
+ {
+ args = FUNCTION_FIRST_USER_PARMTYPE (fn);
+ while (args && TREE_PURPOSE (args))
+ args = TREE_CHAIN (args);
+ if (!args || args == void_list_node)
+ return true;
+ }
+ }
+
+ return false;
+}
+
+/* Returns true if FN can be explicitly defaulted. */
+
+bool
+defaultable_fn_p (tree fn)
+{
+ if (DECL_CONSTRUCTOR_P (fn))
+ {
+ if (skip_artificial_parms_for (fn, DECL_ARGUMENTS (fn))
+ == NULL_TREE)
+ return true;
+ else if (copy_fn_p (fn) > 0)
+ return true;
+ else
+ return false;
+ }
+ else if (DECL_DESTRUCTOR_P (fn))
+ return true;
+ else if (DECL_ASSIGNMENT_OPERATOR_P (fn))
+ return copy_fn_p (fn);
+ else
+ return false;
+}
+
/* Remove all zero-width bit-fields from T. */
static void
@@ -4158,6 +4243,8 @@ check_bases_and_members (tree t)
should take a non-const reference argument. */
int no_const_asn_ref;
tree access_decls;
+ bool saved_complex_asn_ref;
+ bool saved_nontrivial_dtor;
/* By default, we use const reference arguments and generate default
constructors. */
@@ -4171,6 +4258,12 @@ check_bases_and_members (tree t)
/* Check all the method declarations. */
check_methods (t);
+ /* Save the initial values of these flags which only indicate whether
+ or not the class has user-provided functions. As we analyze the
+ bases and members we can set these flags for other reasons. */
+ saved_complex_asn_ref = TYPE_HAS_COMPLEX_ASSIGN_REF (t);
+ saved_nontrivial_dtor = TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t);
+
/* Check all the data member declarations. We cannot call
check_field_decls until we have called check_bases check_methods,
as check_field_decls depends on TYPE_HAS_NONTRIVIAL_DESTRUCTOR
@@ -4186,37 +4279,34 @@ check_bases_and_members (tree t)
/* Do some bookkeeping that will guide the generation of implicitly
declared member functions. */
- TYPE_HAS_COMPLEX_INIT_REF (t)
- |= (TYPE_HAS_INIT_REF (t) || TYPE_CONTAINS_VPTR_P (t));
+ TYPE_HAS_COMPLEX_INIT_REF (t) |= TYPE_CONTAINS_VPTR_P (t);
/* We need to call a constructor for this class if it has a
- user-declared constructor, or if the default constructor is going
+ user-provided constructor, or if the default constructor is going
to initialize the vptr. (This is not an if-and-only-if;
TYPE_NEEDS_CONSTRUCTING is set elsewhere if bases or members
themselves need constructing.) */
TYPE_NEEDS_CONSTRUCTING (t)
- |= (TYPE_HAS_USER_CONSTRUCTOR (t) || TYPE_CONTAINS_VPTR_P (t));
+ |= (type_has_user_provided_constructor (t) || TYPE_CONTAINS_VPTR_P (t));
/* [dcl.init.aggr]
- An aggregate is an arry or a class with no user-declared
+ An aggregate is an array or a class with no user-provided
constructors ... and no virtual functions.
Again, other conditions for being an aggregate are checked
elsewhere. */
CLASSTYPE_NON_AGGREGATE (t)
- |= (TYPE_HAS_USER_CONSTRUCTOR (t) || TYPE_POLYMORPHIC_P (t));
+ |= (type_has_user_provided_constructor (t) || TYPE_POLYMORPHIC_P (t));
CLASSTYPE_NON_POD_P (t)
|= (CLASSTYPE_NON_AGGREGATE (t)
- || TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t)
- || TYPE_HAS_ASSIGN_REF (t));
- TYPE_HAS_COMPLEX_ASSIGN_REF (t)
- |= TYPE_HAS_ASSIGN_REF (t) || TYPE_CONTAINS_VPTR_P (t);
+ || saved_nontrivial_dtor || saved_complex_asn_ref);
+ TYPE_HAS_COMPLEX_ASSIGN_REF (t) |= TYPE_CONTAINS_VPTR_P (t);
TYPE_HAS_COMPLEX_DFLT (t)
|= (TYPE_HAS_DEFAULT_CONSTRUCTOR (t) || TYPE_CONTAINS_VPTR_P (t));
/* If the class has no user-declared constructor, but does have
non-static const or reference data members that can never be
initialized, issue a warning. */
- if (extra_warnings
+ if (warn_uninitialized
/* Classes with user-declared constructors are presumed to
initialize these members. */
&& !TYPE_HAS_USER_CONSTRUCTOR (t)
@@ -4235,13 +4325,13 @@ check_bases_and_members (tree t)
type = TREE_TYPE (field);
if (TREE_CODE (type) == REFERENCE_TYPE)
- warning (OPT_Wextra, "non-static reference %q+#D in class "
- "without a constructor", field);
+ warning (OPT_Wuninitialized, "non-static reference %q+#D "
+ "in class without a constructor", field);
else if (CP_TYPE_CONST_P (type)
&& (!CLASS_TYPE_P (type)
|| !TYPE_HAS_DEFAULT_CONSTRUCTOR (type)))
- warning (OPT_Wextra, "non-static const member %q+#D in class "
- "without a constructor", field);
+ warning (OPT_Wuninitialized, "non-static const member %q+#D "
+ "in class without a constructor", field);
}
}
@@ -7386,7 +7476,7 @@ build_vtbl_initializer (tree binfo,
We first check this in update_vtable_entry_for_fn, so we handle
restored primary bases properly; we also need to do it here so we
- zero out unused slots in ctor vtables, rather than filling themff
+ zero out unused slots in ctor vtables, rather than filling them
with erroneous values (though harmless, apart from relocation
costs). */
for (b = binfo; ; b = get_primary_binfo (b))
diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c
index c6d64dfbb75..8dda74d3cbe 100644
--- a/gcc/cp/cp-gimplify.c
+++ b/gcc/cp/cp-gimplify.c
@@ -28,7 +28,8 @@ along with GCC; see the file COPYING3. If not see
#include "cp-tree.h"
#include "c-common.h"
#include "toplev.h"
-#include "tree-gimple.h"
+#include "tree-iterator.h"
+#include "gimple.h"
#include "hashtab.h"
#include "pointer-set.h"
#include "flags.h"
@@ -62,20 +63,14 @@ begin_bc_block (enum bc_t bc)
If we saw a break (or continue) in the scope, append a LABEL_EXPR to
body. Otherwise, just forget the label. */
-static tree
-finish_bc_block (enum bc_t bc, tree label, tree body)
+static gimple_seq
+finish_bc_block (enum bc_t bc, tree label, gimple_seq body)
{
gcc_assert (label == bc_label[bc]);
if (TREE_USED (label))
{
- tree t, sl = NULL;
-
- t = build1 (LABEL_EXPR, void_type_node, label);
-
- append_to_statement_list (body, &sl);
- append_to_statement_list (t, &sl);
- body = sl;
+ gimple_seq_add_stmt (&body, gimple_build_label (label));
}
bc_label[bc] = TREE_CHAIN (label);
@@ -83,11 +78,11 @@ finish_bc_block (enum bc_t bc, tree label, tree body)
return body;
}
-/* Build a GOTO_EXPR to represent a break or continue statement. BC
- indicates which. */
+/* Get the LABEL_EXPR to represent a break or continue statement
+ in the current block scope. BC indicates which. */
static tree
-build_bc_goto (enum bc_t bc)
+get_bc_label (enum bc_t bc)
{
tree label = bc_label[bc];
@@ -103,7 +98,7 @@ build_bc_goto (enum bc_t bc)
/* Mark the label used for finish_bc_block. */
TREE_USED (label) = 1;
- return build1 (GOTO_EXPR, void_type_node, label);
+ return label;
}
/* Genericize a TRY_BLOCK. */
@@ -114,13 +109,6 @@ genericize_try_block (tree *stmt_p)
tree body = TRY_STMTS (*stmt_p);
tree cleanup = TRY_HANDLERS (*stmt_p);
- gimplify_stmt (&body);
-
- if (CLEANUP_P (*stmt_p))
- /* A cleanup is an expression, so it doesn't need to be genericized. */;
- else
- gimplify_stmt (&cleanup);
-
*stmt_p = build2 (TRY_CATCH_EXPR, void_type_node, body, cleanup);
}
@@ -132,12 +120,28 @@ genericize_catch_block (tree *stmt_p)
tree type = HANDLER_TYPE (*stmt_p);
tree body = HANDLER_BODY (*stmt_p);
- gimplify_stmt (&body);
-
/* FIXME should the caught type go in TREE_TYPE? */
*stmt_p = build2 (CATCH_EXPR, void_type_node, type, body);
}
+/* A terser interface for building a representation of an exception
+ specification. */
+
+static tree
+build_gimple_eh_filter_tree (tree body, tree allowed, tree failure)
+{
+ tree t;
+
+ /* FIXME should the allowed types go in TREE_TYPE? */
+ t = build2 (EH_FILTER_EXPR, void_type_node, allowed, NULL_TREE);
+ append_to_statement_list (failure, &EH_FILTER_FAILURE (t));
+
+ t = build2 (TRY_CATCH_EXPR, void_type_node, NULL_TREE, t);
+ append_to_statement_list (body, &TREE_OPERAND (t, 0));
+
+ return t;
+}
+
/* Genericize an EH_SPEC_BLOCK by converting it to a
TRY_CATCH_EXPR/EH_FILTER_EXPR pair. */
@@ -147,9 +151,8 @@ genericize_eh_spec_block (tree *stmt_p)
tree body = EH_SPEC_STMTS (*stmt_p);
tree allowed = EH_SPEC_RAISES (*stmt_p);
tree failure = build_call_n (call_unexpected_node, 1, build_exc_ptr ());
- gimplify_stmt (&body);
- *stmt_p = gimple_build_eh_filter (body, allowed, failure);
+ *stmt_p = build_gimple_eh_filter_tree (body, allowed, failure);
}
/* Genericize an IF_STMT by turning it into a COND_EXPR. */
@@ -158,6 +161,7 @@ static void
gimplify_if_stmt (tree *stmt_p)
{
tree stmt, cond, then_, else_;
+ location_t locus = EXPR_LOCATION (*stmt_p);
stmt = *stmt_p;
cond = IF_COND (stmt);
@@ -175,6 +179,8 @@ gimplify_if_stmt (tree *stmt_p)
stmt = else_;
else
stmt = build3 (COND_EXPR, void_type_node, cond, then_, else_);
+ if (CAN_HAVE_LOCATION_P (stmt) && !EXPR_HAS_LOCATION (stmt))
+ SET_EXPR_LOCATION (stmt, locus);
*stmt_p = stmt;
}
@@ -185,15 +191,20 @@ gimplify_if_stmt (tree *stmt_p)
evaluated before the loop body as in while and for loops, or after the
loop body as in do-while loops. */
-static tree
+static gimple_seq
gimplify_cp_loop (tree cond, tree body, tree incr, bool cond_is_first)
{
- tree top, entry, exit, cont_block, break_block, stmt_list, t;
+ gimple top, entry, stmt;
+ gimple_seq stmt_list, body_seq, incr_seq, exit_seq;
+ tree cont_block, break_block;
location_t stmt_locus;
stmt_locus = input_location;
- stmt_list = NULL_TREE;
- entry = NULL_TREE;
+ stmt_list = NULL;
+ body_seq = NULL;
+ incr_seq = NULL;
+ exit_seq = NULL;
+ entry = NULL;
break_block = begin_bc_block (bc_break);
cont_block = begin_bc_block (bc_continue);
@@ -201,12 +212,12 @@ gimplify_cp_loop (tree cond, tree body, tree incr, bool cond_is_first)
/* If condition is zero don't generate a loop construct. */
if (cond && integer_zerop (cond))
{
- top = NULL_TREE;
- exit = NULL_TREE;
+ top = NULL;
if (cond_is_first)
{
- t = build_bc_goto (bc_break);
- append_to_statement_list (t, &stmt_list);
+ stmt = gimple_build_goto (get_bc_label (bc_break));
+ gimple_set_location (stmt, stmt_locus);
+ gimple_seq_add_stmt (&stmt_list, stmt);
}
}
else
@@ -215,44 +226,55 @@ gimplify_cp_loop (tree cond, tree body, tree incr, bool cond_is_first)
back through the main gimplifier to lower it. Given that we
have to gimplify the loop body NOW so that we can resolve
break/continue stmts, seems easier to just expand to gotos. */
- top = build1 (LABEL_EXPR, void_type_node, NULL_TREE);
+ top = gimple_build_label (create_artificial_label ());
/* If we have an exit condition, then we build an IF with gotos either
out of the loop, or to the top of it. If there's no exit condition,
then we just build a jump back to the top. */
- exit = build_and_jump (&LABEL_EXPR_LABEL (top));
if (cond && !integer_nonzerop (cond))
{
- t = build_bc_goto (bc_break);
- exit = fold_build3 (COND_EXPR, void_type_node, cond, exit, t);
- gimplify_stmt (&exit);
+ if (cond != error_mark_node)
+ {
+ gimplify_expr (&cond, &exit_seq, NULL, is_gimple_val, fb_rvalue);
+ stmt = gimple_build_cond (NE_EXPR, cond,
+ build_int_cst (TREE_TYPE (cond), 0),
+ gimple_label_label (top),
+ get_bc_label (bc_break));
+ gimple_seq_add_stmt (&exit_seq, stmt);
+ }
if (cond_is_first)
{
if (incr)
{
- entry = build1 (LABEL_EXPR, void_type_node, NULL_TREE);
- t = build_and_jump (&LABEL_EXPR_LABEL (entry));
+ entry = gimple_build_label (create_artificial_label ());
+ stmt = gimple_build_goto (gimple_label_label (entry));
}
else
- t = build_bc_goto (bc_continue);
- append_to_statement_list (t, &stmt_list);
+ stmt = gimple_build_goto (get_bc_label (bc_continue));
+ gimple_set_location (stmt, stmt_locus);
+ gimple_seq_add_stmt (&stmt_list, stmt);
}
}
+ else
+ {
+ stmt = gimple_build_goto (gimple_label_label (top));
+ gimple_seq_add_stmt (&exit_seq, stmt);
+ }
}
- gimplify_stmt (&body);
- gimplify_stmt (&incr);
+ gimplify_stmt (&body, &body_seq);
+ gimplify_stmt (&incr, &incr_seq);
- body = finish_bc_block (bc_continue, cont_block, body);
+ body_seq = finish_bc_block (bc_continue, cont_block, body_seq);
- append_to_statement_list (top, &stmt_list);
- append_to_statement_list (body, &stmt_list);
- append_to_statement_list (incr, &stmt_list);
- append_to_statement_list (entry, &stmt_list);
- append_to_statement_list (exit, &stmt_list);
+ gimple_seq_add_stmt (&stmt_list, top);
+ gimple_seq_add_seq (&stmt_list, body_seq);
+ gimple_seq_add_seq (&stmt_list, incr_seq);
+ gimple_seq_add_stmt (&stmt_list, entry);
+ gimple_seq_add_seq (&stmt_list, exit_seq);
- annotate_all_with_locus (&stmt_list, stmt_locus);
+ annotate_all_with_location (stmt_list, stmt_locus);
return finish_bc_block (bc_break, break_block, stmt_list);
}
@@ -261,45 +283,52 @@ gimplify_cp_loop (tree cond, tree body, tree incr, bool cond_is_first)
prequeue and hand off to gimplify_cp_loop. */
static void
-gimplify_for_stmt (tree *stmt_p, tree *pre_p)
+gimplify_for_stmt (tree *stmt_p, gimple_seq *pre_p)
{
tree stmt = *stmt_p;
if (FOR_INIT_STMT (stmt))
gimplify_and_add (FOR_INIT_STMT (stmt), pre_p);
- *stmt_p = gimplify_cp_loop (FOR_COND (stmt), FOR_BODY (stmt),
- FOR_EXPR (stmt), 1);
+ gimple_seq_add_seq (pre_p,
+ gimplify_cp_loop (FOR_COND (stmt), FOR_BODY (stmt),
+ FOR_EXPR (stmt), 1));
+ *stmt_p = NULL_TREE;
}
/* Gimplify a WHILE_STMT node. */
static void
-gimplify_while_stmt (tree *stmt_p)
+gimplify_while_stmt (tree *stmt_p, gimple_seq *pre_p)
{
tree stmt = *stmt_p;
- *stmt_p = gimplify_cp_loop (WHILE_COND (stmt), WHILE_BODY (stmt),
- NULL_TREE, 1);
+ gimple_seq_add_seq (pre_p,
+ gimplify_cp_loop (WHILE_COND (stmt), WHILE_BODY (stmt),
+ NULL_TREE, 1));
+ *stmt_p = NULL_TREE;
}
/* Gimplify a DO_STMT node. */
static void
-gimplify_do_stmt (tree *stmt_p)
+gimplify_do_stmt (tree *stmt_p, gimple_seq *pre_p)
{
tree stmt = *stmt_p;
- *stmt_p = gimplify_cp_loop (DO_COND (stmt), DO_BODY (stmt),
- NULL_TREE, 0);
+ gimple_seq_add_seq (pre_p,
+ gimplify_cp_loop (DO_COND (stmt), DO_BODY (stmt),
+ NULL_TREE, 0));
+ *stmt_p = NULL_TREE;
}
/* Genericize a SWITCH_STMT by turning it into a SWITCH_EXPR. */
static void
-gimplify_switch_stmt (tree *stmt_p)
+gimplify_switch_stmt (tree *stmt_p, gimple_seq *pre_p)
{
tree stmt = *stmt_p;
- tree break_block, body;
+ tree break_block, body, t;
location_t stmt_locus = input_location;
+ gimple_seq seq = NULL;
break_block = begin_bc_block (bc_break);
@@ -307,12 +336,14 @@ gimplify_switch_stmt (tree *stmt_p)
if (!body)
body = build_empty_stmt ();
- *stmt_p = build3 (SWITCH_EXPR, SWITCH_STMT_TYPE (stmt),
- SWITCH_STMT_COND (stmt), body, NULL_TREE);
- SET_EXPR_LOCATION (*stmt_p, stmt_locus);
- gimplify_stmt (stmt_p);
+ t = build3 (SWITCH_EXPR, SWITCH_STMT_TYPE (stmt),
+ SWITCH_STMT_COND (stmt), body, NULL_TREE);
+ SET_EXPR_LOCATION (t, stmt_locus);
+ gimplify_and_add (t, &seq);
- *stmt_p = finish_bc_block (bc_break, break_block, *stmt_p);
+ seq = finish_bc_block (bc_break, break_block, seq);
+ gimple_seq_add_seq (pre_p, seq);
+ *stmt_p = NULL_TREE;
}
/* Hook into the middle of gimplifying an OMP_FOR node. This is required
@@ -321,10 +352,12 @@ gimplify_switch_stmt (tree *stmt_p)
regular gimplifier. */
static enum gimplify_status
-cp_gimplify_omp_for (tree *expr_p)
+cp_gimplify_omp_for (tree *expr_p, gimple_seq *pre_p)
{
tree for_stmt = *expr_p;
tree cont_block;
+ gimple stmt;
+ gimple_seq seq = NULL;
/* Protect ourselves from recursion. */
if (OMP_FOR_GIMPLIFYING_P (for_stmt))
@@ -336,10 +369,15 @@ cp_gimplify_omp_for (tree *expr_p)
statement expressions within the INIT, COND, or INCR expressions. */
cont_block = begin_bc_block (bc_continue);
- gimplify_stmt (expr_p);
+ gimplify_and_add (for_stmt, &seq);
+ stmt = gimple_seq_last_stmt (seq);
+ if (gimple_code (stmt) == GIMPLE_OMP_FOR)
+ gimple_omp_set_body (stmt, finish_bc_block (bc_continue, cont_block,
+ gimple_omp_body (stmt)));
+ else
+ seq = finish_bc_block (bc_continue, cont_block, seq);
+ gimple_seq_add_seq (pre_p, seq);
- OMP_FOR_BODY (for_stmt)
- = finish_bc_block (bc_continue, cont_block, OMP_FOR_BODY (for_stmt));
OMP_FOR_GIMPLIFYING_P (for_stmt) = 0;
return GS_ALL_DONE;
@@ -383,7 +421,7 @@ gimplify_expr_stmt (tree *stmt_p)
/* Gimplify initialization from an AGGR_INIT_EXPR. */
static void
-cp_gimplify_init_expr (tree *expr_p, tree *pre_p, tree *post_p)
+cp_gimplify_init_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
{
tree from = TREE_OPERAND (*expr_p, 1);
tree to = TREE_OPERAND (*expr_p, 0);
@@ -441,31 +479,31 @@ cp_gimplify_init_expr (tree *expr_p, tree *pre_p, tree *post_p)
/* Gimplify a MUST_NOT_THROW_EXPR. */
-static void
-gimplify_must_not_throw_expr (tree *expr_p, tree *pre_p)
+static enum gimplify_status
+gimplify_must_not_throw_expr (tree *expr_p, gimple_seq *pre_p)
{
tree stmt = *expr_p;
tree temp = voidify_wrapper_expr (stmt, NULL);
tree body = TREE_OPERAND (stmt, 0);
- gimplify_stmt (&body);
-
- stmt = gimple_build_eh_filter (body, NULL_TREE,
- build_call_n (terminate_node, 0));
+ stmt = build_gimple_eh_filter_tree (body, NULL_TREE,
+ build_call_n (terminate_node, 0));
+ gimplify_and_add (stmt, pre_p);
if (temp)
{
- append_to_statement_list (stmt, pre_p);
*expr_p = temp;
+ return GS_OK;
}
- else
- *expr_p = stmt;
+
+ *expr_p = NULL;
+ return GS_ALL_DONE;
}
/* Do C++-specific gimplification. Args are as for gimplify_expr. */
int
-cp_gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p)
+cp_gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
{
int saved_stmts_are_full_exprs_p = 0;
enum tree_code code = TREE_CODE (*expr_p);
@@ -498,11 +536,10 @@ cp_gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p)
break;
case MUST_NOT_THROW_EXPR:
- gimplify_must_not_throw_expr (expr_p, pre_p);
- ret = GS_OK;
+ ret = gimplify_must_not_throw_expr (expr_p, pre_p);
break;
- /* We used to do this for GIMPLE_MODIFY_STMT as well, but that's unsafe; the
+ /* We used to do this for MODIFY_EXPR as well, but that's unsafe; the
LHS of an assignment might also be involved in the RHS, as in bug
25979. */
case INIT_EXPR:
@@ -539,7 +576,7 @@ cp_gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p)
case USING_STMT:
/* Just ignore for now. Eventually we will want to pass this on to
the debugger. */
- *expr_p = build_empty_stmt ();
+ *expr_p = NULL;
ret = GS_ALL_DONE;
break;
@@ -550,35 +587,37 @@ cp_gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p)
case FOR_STMT:
gimplify_for_stmt (expr_p, pre_p);
- ret = GS_ALL_DONE;
+ ret = GS_OK;
break;
case WHILE_STMT:
- gimplify_while_stmt (expr_p);
- ret = GS_ALL_DONE;
+ gimplify_while_stmt (expr_p, pre_p);
+ ret = GS_OK;
break;
case DO_STMT:
- gimplify_do_stmt (expr_p);
- ret = GS_ALL_DONE;
+ gimplify_do_stmt (expr_p, pre_p);
+ ret = GS_OK;
break;
case SWITCH_STMT:
- gimplify_switch_stmt (expr_p);
- ret = GS_ALL_DONE;
+ gimplify_switch_stmt (expr_p, pre_p);
+ ret = GS_OK;
break;
case OMP_FOR:
- ret = cp_gimplify_omp_for (expr_p);
+ ret = cp_gimplify_omp_for (expr_p, pre_p);
break;
case CONTINUE_STMT:
- *expr_p = build_bc_goto (bc_continue);
+ gimple_seq_add_stmt (pre_p, gimple_build_goto (get_bc_label (bc_continue)));
+ *expr_p = NULL_TREE;
ret = GS_ALL_DONE;
break;
case BREAK_STMT:
- *expr_p = build_bc_goto (bc_break);
+ gimple_seq_add_stmt (pre_p, gimple_build_goto (get_bc_label (bc_break)));
+ *expr_p = NULL_TREE;
ret = GS_ALL_DONE;
break;
@@ -835,13 +874,13 @@ cxx_omp_clause_apply_fn (tree fn, tree arg1, tree arg2)
end1 = build2 (POINTER_PLUS_EXPR, TREE_TYPE (start1), start1, end1);
p1 = create_tmp_var (TREE_TYPE (start1), NULL);
- t = build2 (GIMPLE_MODIFY_STMT, void_type_node, p1, start1);
+ t = build2 (MODIFY_EXPR, TREE_TYPE (p1), p1, start1);
append_to_statement_list (t, &ret);
if (arg2)
{
p2 = create_tmp_var (TREE_TYPE (start2), NULL);
- t = build2 (GIMPLE_MODIFY_STMT, void_type_node, p2, start2);
+ t = build2 (MODIFY_EXPR, TREE_TYPE (p2), p2, start2);
append_to_statement_list (t, &ret);
}
@@ -864,14 +903,14 @@ cxx_omp_clause_apply_fn (tree fn, tree arg1, tree arg2)
t = TYPE_SIZE_UNIT (inner_type);
t = build2 (POINTER_PLUS_EXPR, TREE_TYPE (p1), p1, t);
- t = build2 (GIMPLE_MODIFY_STMT, void_type_node, p1, t);
+ t = build2 (MODIFY_EXPR, TREE_TYPE (p1), p1, t);
append_to_statement_list (t, &ret);
if (arg2)
{
t = TYPE_SIZE_UNIT (inner_type);
t = build2 (POINTER_PLUS_EXPR, TREE_TYPE (p2), p2, t);
- t = build2 (GIMPLE_MODIFY_STMT, void_type_node, p2, t);
+ t = build2 (MODIFY_EXPR, TREE_TYPE (p2), p2, t);
append_to_statement_list (t, &ret);
}
@@ -925,7 +964,7 @@ cxx_omp_clause_copy_ctor (tree clause, tree dst, tree src)
if (info)
ret = cxx_omp_clause_apply_fn (TREE_VEC_ELT (info, 0), dst, src);
if (ret == NULL)
- ret = build2 (GIMPLE_MODIFY_STMT, void_type_node, dst, src);
+ ret = build2 (MODIFY_EXPR, TREE_TYPE (dst), dst, src);
return ret;
}
@@ -941,7 +980,7 @@ cxx_omp_clause_assign_op (tree clause, tree dst, tree src)
if (info)
ret = cxx_omp_clause_apply_fn (TREE_VEC_ELT (info, 2), dst, src);
if (ret == NULL)
- ret = build2 (GIMPLE_MODIFY_STMT, void_type_node, dst, src);
+ ret = build2 (MODIFY_EXPR, TREE_TYPE (dst), dst, src);
return ret;
}
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index b07effead05..a80027ef27d 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -31,8 +31,28 @@ along with GCC; see the file COPYING3. If not see
#include "varray.h"
#include "c-common.h"
#include "name-lookup.h"
-struct diagnostic_context;
-struct diagnostic_info;
+
+/* In order for the format checking to accept the C++ front end
+ diagnostic framework extensions, you must include this file before
+ toplev.h, not after. We override the definition of GCC_DIAG_STYLE
+ in c-common.h. */
+#undef GCC_DIAG_STYLE
+#define GCC_DIAG_STYLE __gcc_cxxdiag__
+#if GCC_VERSION >= 4001
+#define ATTRIBUTE_GCC_CXXDIAG(m, n) __attribute__ ((__format__ (GCC_DIAG_STYLE, m, n))) ATTRIBUTE_NONNULL(m)
+#else
+#define ATTRIBUTE_GCC_CXXDIAG(m, n) ATTRIBUTE_NONNULL(m)
+#endif
+extern void cp_cpp_error (cpp_reader *, int,
+ const char *, va_list *)
+ ATTRIBUTE_GCC_CXXDIAG(3,0);
+#ifdef GCC_TOPLEV_H
+#error \
+"In order for the format checking to accept the C++ front end diagnostic\n"
+"framework extensions, you must include this file before toplev.h, not after."
+#endif
+#include "toplev.h"
+#include "diagnostic.h"
/* Usage of TREE_LANG_FLAG_?:
0: IDENTIFIER_MARKED (IDENTIFIER_NODEs)
@@ -534,7 +554,7 @@ enum cp_tree_node_structure_enum {
/* The resulting tree type. */
union lang_tree_node GTY((desc ("cp_tree_node_structure (&%h)"),
- chain_next ("(union lang_tree_node *)GENERIC_NEXT (&%h.generic)")))
+ chain_next ("(union lang_tree_node *)TREE_CHAIN (&%h.generic)")))
{
union tree_node GTY ((tag ("TS_CP_GENERIC"),
desc ("tree_node_structure (&%h)"))) generic;
@@ -853,7 +873,7 @@ struct language_function GTY(())
#define cp_function_chain (cfun->language)
/* In a constructor destructor, the point at which all derived class
- destroying/construction has been has been done. Ie. just before a
+ destroying/construction has been done. I.e., just before a
constructor returns, or before any base class destroying will be done
in a destructor. */
@@ -1609,7 +1629,7 @@ struct lang_decl_flags GTY(())
unsigned repo_available_p : 1;
unsigned hidden_friend_p : 1;
unsigned threadprivate_p : 1;
- /* One unused bit. */
+ unsigned defaulted_p : 1;
union lang_decl_u {
/* In a FUNCTION_DECL for which DECL_THUNK_P holds, this is
@@ -1917,7 +1937,7 @@ struct lang_decl GTY(())
/* Nonzero if the DECL was initialized in the class definition itself,
rather than outside the class. This is used for both static member
- VAR_DECLS, and FUNTION_DECLS that are defined in the class. */
+ VAR_DECLS, and FUNCTION_DECLS that are defined in the class. */
#define DECL_INITIALIZED_IN_CLASS_P(DECL) \
(DECL_LANG_SPECIFIC (DECL)->decl_flags.initialized_in_class)
@@ -2626,6 +2646,14 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
#define CP_DECL_THREADPRIVATE_P(DECL) \
(DECL_LANG_SPECIFIC (VAR_DECL_CHECK (DECL))->decl_flags.threadprivate_p)
+/* Nonzero if DECL was declared with '= delete'. */
+#define DECL_DELETED_FN(DECL) \
+ (DECL_LANG_SPECIFIC (FUNCTION_DECL_CHECK (DECL))->decl_flags.threadprivate_p)
+
+/* Nonzero if DECL was declared with '= default'. */
+#define DECL_DEFAULTED_FN(DECL) \
+ (DECL_LANG_SPECIFIC (FUNCTION_DECL_CHECK (DECL))->decl_flags.defaulted_p)
+
/* Record whether a typedef for type `int' was actually `signed int'. */
#define C_TYPEDEF_EXPLICITLY_SIGNED(EXP) DECL_LANG_FLAG_1 (EXP)
@@ -3199,7 +3227,7 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
template <class T> struct S { friend void f(T) {}; };
the declaration of `void f(int)' generated when S<int> is
instantiated will not be a DECL_TEMPLATE_INSTANTIATION, but will be
- a DECL_FRIEND_PSUEDO_TEMPLATE_INSTANTIATION. */
+ a DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION. */
#define DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION(DECL) \
(DECL_TEMPLATE_INFO (DECL) && !DECL_USE_TEMPLATE (DECL))
@@ -4171,6 +4199,9 @@ extern void check_for_override (tree, tree);
extern void push_class_stack (void);
extern void pop_class_stack (void);
extern bool type_has_user_nondefault_constructor (tree);
+extern bool type_has_user_provided_constructor (tree);
+extern bool type_has_user_provided_default_constructor (tree);
+extern bool defaultable_fn_p (tree);
/* in cvt.c */
extern tree convert_to_reference (tree, tree, int, int, tree);
@@ -4214,10 +4245,9 @@ extern bool check_omp_return (void);
extern tree make_typename_type (tree, tree, enum tag_types, tsubst_flags_t);
extern tree make_unbound_class_template (tree, tree, tree, tsubst_flags_t);
extern tree check_for_out_of_scope_variable (tree);
-extern tree build_library_fn (tree, tree);
extern tree build_library_fn_ptr (const char *, tree);
extern tree build_cp_library_fn_ptr (const char *, tree);
-extern tree push_library_fn (tree, tree);
+extern tree push_library_fn (tree, tree, tree);
extern tree push_void_library_fn (tree, tree);
extern tree push_throw_library_fn (tree, tree);
extern tree check_tag_decl (cp_decl_specifier_seq *);
@@ -4323,6 +4353,7 @@ extern void mark_needed (tree);
extern bool decl_needed_p (tree);
extern void note_vague_linkage_fn (tree);
extern tree build_artificial_parm (tree, tree);
+extern bool possibly_inlined_p (tree);
/* in error.c */
extern void init_error (void);
@@ -4419,7 +4450,7 @@ extern tree locate_dtor (tree, void *);
extern bool maybe_clone_body (tree);
/* in pt.c */
-extern void check_template_shadow (tree);
+extern bool check_template_shadow (tree);
extern tree get_innermost_template_args (tree, int);
extern void maybe_begin_member_template_processing (tree);
extern void maybe_end_member_template_processing (void);
@@ -4731,6 +4762,7 @@ extern tree build_min_nt (enum tree_code, ...);
extern tree build_min_non_dep (enum tree_code, tree, ...);
extern tree build_min_non_dep_call_list (tree, tree, tree);
extern tree build_cplus_new (tree, tree);
+extern tree build_aggr_init_expr (tree, tree);
extern tree get_target_expr (tree);
extern tree build_cplus_array_type (tree, tree);
extern tree build_array_of_n_type (tree, int);
@@ -4801,7 +4833,6 @@ extern int comp_cv_qual_signature (tree, tree);
extern tree cxx_sizeof_or_alignof_expr (tree, enum tree_code, bool);
extern tree cxx_sizeof_or_alignof_type (tree, enum tree_code, bool);
extern tree cxx_sizeof_nowarn (tree);
-extern tree inline_conversion (tree);
extern tree is_bitfield_expr_with_lowered_type (const_tree);
extern tree unlowered_expr_type (const_tree);
extern tree decay_conversion (tree);
@@ -4876,11 +4907,11 @@ extern int lvalue_p (const_tree);
/* in typeck2.c */
extern void require_complete_eh_spec_types (tree, tree);
-extern void cxx_incomplete_type_diagnostic (const_tree, const_tree, int);
+extern void cxx_incomplete_type_diagnostic (const_tree, const_tree, diagnostic_t);
#undef cxx_incomplete_type_error
extern void cxx_incomplete_type_error (const_tree, const_tree);
#define cxx_incomplete_type_error(V,T) \
- (cxx_incomplete_type_diagnostic ((V), (T), 0))
+ (cxx_incomplete_type_diagnostic ((V), (T), DK_ERROR))
extern tree error_not_base_type (tree, tree);
extern tree binfo_or_else (tree, tree);
extern void readonly_error (tree, const char *);
@@ -4928,24 +4959,10 @@ extern void init_shadowed_var_for_decl (void);
extern tree cxx_staticp (tree);
/* in cp-gimplify.c */
-extern int cp_gimplify_expr (tree *, tree *, tree *);
+extern int cp_gimplify_expr (tree *, gimple_seq *,
+ gimple_seq *);
extern void cp_genericize (tree);
/* -- end of C++ */
-/* In order for the format checking to accept the C++ front end
- diagnostic framework extensions, you must include this file before
- toplev.h, not after. We override the definition of GCC_DIAG_STYLE
- in c-common.h. */
-#undef GCC_DIAG_STYLE
-#define GCC_DIAG_STYLE __gcc_cxxdiag__
-#if GCC_VERSION >= 4001
-#define ATTRIBUTE_GCC_CXXDIAG(m, n) __attribute__ ((__format__ (GCC_DIAG_STYLE, m, n))) ATTRIBUTE_NONNULL(m)
-#else
-#define ATTRIBUTE_GCC_CXXDIAG(m, n) ATTRIBUTE_NONNULL(m)
-#endif
-extern void cp_cpp_error (cpp_reader *, int,
- const char *, va_list *)
- ATTRIBUTE_GCC_CXXDIAG(3,0);
-
#endif /* ! GCC_CP_TREE_H */
diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c
index 70ef00a4fce..8e26927c373 100644
--- a/gcc/cp/cvt.c
+++ b/gcc/cp/cvt.c
@@ -638,19 +638,35 @@ ocp_convert (tree type, tree expr, int convtype, int flags)
if (INTEGRAL_CODE_P (code))
{
tree intype = TREE_TYPE (e);
- /* enum = enum, enum = int, enum = float, (enum)pointer are all
- errors. */
- if (TREE_CODE (type) == ENUMERAL_TYPE
- && (((INTEGRAL_OR_ENUMERATION_TYPE_P (intype)
+
+ if (TREE_CODE (type) == ENUMERAL_TYPE)
+ {
+ /* enum = enum, enum = int, enum = float, (enum)pointer are all
+ errors. */
+ if (((INTEGRAL_OR_ENUMERATION_TYPE_P (intype)
|| TREE_CODE (intype) == REAL_TYPE)
&& ! (convtype & CONV_STATIC))
- || TREE_CODE (intype) == POINTER_TYPE))
- {
- if (flags & LOOKUP_COMPLAIN)
- permerror ("conversion from %q#T to %q#T", intype, type);
+ || TREE_CODE (intype) == POINTER_TYPE)
+ {
+ if (flags & LOOKUP_COMPLAIN)
+ permerror ("conversion from %q#T to %q#T", intype, type);
- if (!flag_permissive)
- return error_mark_node;
+ if (!flag_permissive)
+ return error_mark_node;
+ }
+
+ /* [expr.static.cast]
+
+ 8. A value of integral or enumeration type can be explicitly
+ converted to an enumeration type. The value is unchanged if
+ the original value is within the range of the enumeration
+ values. Otherwise, the resulting enumeration value is
+ unspecified. */
+ if (TREE_CODE (expr) == INTEGER_CST && !int_fits_type_p (expr, type))
+ warning (OPT_Wconversion,
+ "the result of the conversion is unspecified because "
+ "%qE is outside the range of type %qT",
+ expr, type);
}
if (MAYBE_CLASS_TYPE_P (intype))
{
@@ -938,7 +954,7 @@ convert_to_void (tree expr, const char *implicit, tsubst_flags_t complain)
{
tree e;
enum tree_code code;
- enum tree_code_class class;
+ enum tree_code_class tclass;
e = expr;
/* We might like to warn about (say) "(int) f()", as the
@@ -955,10 +971,10 @@ convert_to_void (tree expr, const char *implicit, tsubst_flags_t complain)
e = TREE_OPERAND (e, 0);
code = TREE_CODE (e);
- class = TREE_CODE_CLASS (code);
- if ((class == tcc_comparison
- || class == tcc_unary
- || (class == tcc_binary
+ tclass = TREE_CODE_CLASS (code);
+ if ((tclass == tcc_comparison
+ || tclass == tcc_unary
+ || (tclass == tcc_binary
&& !(code == MODIFY_EXPR
|| code == INIT_EXPR
|| code == PREDECREMENT_EXPR
diff --git a/gcc/cp/cxx-pretty-print.c b/gcc/cp/cxx-pretty-print.c
index 62ff1fc3fc3..cf9ed482e84 100644
--- a/gcc/cp/cxx-pretty-print.c
+++ b/gcc/cp/cxx-pretty-print.c
@@ -452,7 +452,7 @@ pp_cxx_primary_expression (cxx_pretty_printer *pp, tree t)
reinterpret_cast < type-id > ( expression )
const_cast < type-id > ( expression )
typeid ( expression )
- typeif ( type-id ) */
+ typeid ( type-id ) */
static void
pp_cxx_postfix_expression (cxx_pretty_printer *pp, tree t)
@@ -810,7 +810,7 @@ pp_cxx_pm_expression (cxx_pretty_printer *pp, tree t)
{
switch (TREE_CODE (t))
{
- /* Handle unfortunate OFFESET_REF overloading here. */
+ /* Handle unfortunate OFFSET_REF overloading here. */
case OFFSET_REF:
if (TYPE_P (TREE_OPERAND (t, 0)))
{
@@ -2016,7 +2016,7 @@ pp_cxx_template_parameter (cxx_pretty_printer *pp, tree t)
pp_cxx_identifier (pp, "...");
if (DECL_NAME (parameter))
pp_cxx_tree_identifier (pp, DECL_NAME (parameter));
- /* FIXME: Chech if we should print also default argument. */
+ /* FIXME: Check if we should print also default argument. */
break;
case PARM_DECL:
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 83d2c4ea5a7..b0531604d02 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -315,7 +315,7 @@ current_tmpl_spec_kind (int n_class_scopes)
template <class T> void S<T>::f(int);
- The `class T' maches the `S<T>', leaving no template headers
+ The `class T' matches the `S<T>', leaving no template headers
corresponding to the `f'. */
return tsk_none;
else if (n_template_parm_scopes > n_class_scopes + 1)
@@ -800,12 +800,12 @@ insert_block (tree block)
itself, calling F for each. The DATA is passed to F as well. */
static int
-walk_namespaces_r (tree namespace, walk_namespaces_fn f, void* data)
+walk_namespaces_r (tree name_space, walk_namespaces_fn f, void* data)
{
int result = 0;
- tree current = NAMESPACE_LEVEL (namespace)->namespaces;
+ tree current = NAMESPACE_LEVEL (name_space)->namespaces;
- result |= (*f) (namespace, data);
+ result |= (*f) (name_space, data);
for (; current; current = TREE_CHAIN (current))
result |= walk_namespaces_r (current, f, data);
@@ -827,9 +827,9 @@ walk_namespaces (walk_namespaces_fn f, void* data)
wrapup_global_declarations for this NAMESPACE. */
int
-wrapup_globals_for_namespace (tree namespace, void* data)
+wrapup_globals_for_namespace (tree name_space, void* data)
{
- struct cp_binding_level *level = NAMESPACE_LEVEL (namespace);
+ struct cp_binding_level *level = NAMESPACE_LEVEL (name_space);
VEC(tree,gc) *statics = level->static_decls;
tree *vec = VEC_address (tree, statics);
int len = VEC_length (tree, statics);
@@ -1551,14 +1551,6 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
olddecl);
}
}
-
- if (DECL_DECLARED_INLINE_P (newdecl)
- && ! DECL_DECLARED_INLINE_P (olddecl)
- && TREE_ADDRESSABLE (olddecl) && warn_inline)
- {
- warning (0, "%q#D was used before it was declared inline", newdecl);
- warning (0, "%Jprevious non-inline declaration here", olddecl);
- }
}
}
@@ -1613,6 +1605,12 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
warning (OPT_Wredundant_decls, "redundant redeclaration of %qD in same scope", newdecl);
warning (OPT_Wredundant_decls, "previous declaration of %q+D", olddecl);
}
+
+ if (DECL_DELETED_FN (newdecl))
+ {
+ error ("deleted definition of %qD", newdecl);
+ error ("after previous declaration %q+D", olddecl);
+ }
}
/* Deal with C++: must preserve virtual function table size. */
@@ -1654,15 +1652,9 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
&& DECL_INITIAL (new_result))
{
if (DECL_INITIAL (old_result))
- {
- DECL_INLINE (old_result) = 0;
- DECL_UNINLINABLE (old_result) = 1;
- }
+ DECL_UNINLINABLE (old_result) = 1;
else
- {
- DECL_INLINE (old_result) = DECL_INLINE (new_result);
- DECL_UNINLINABLE (old_result) = DECL_UNINLINABLE (new_result);
- }
+ DECL_UNINLINABLE (old_result) = DECL_UNINLINABLE (new_result);
DECL_EXTERNAL (old_result) = DECL_EXTERNAL (new_result);
DECL_NOT_REALLY_EXTERN (old_result)
= DECL_NOT_REALLY_EXTERN (new_result);
@@ -1676,8 +1668,6 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
}
else
{
- DECL_INLINE (old_result)
- |= DECL_INLINE (new_result);
DECL_DECLARED_INLINE_P (old_result)
|= DECL_DECLARED_INLINE_P (new_result);
DECL_DISREGARD_INLINE_LIMITS (old_result)
@@ -1948,9 +1938,9 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
}
else if (new_defines_function && DECL_INITIAL (olddecl))
{
- /* C++ is always in in unit-at-a-time mode, so we never
- inline re-defined extern inline functions. */
- DECL_INLINE (newdecl) = 0;
+ /* Never inline re-defined extern inline functions.
+ FIXME: this could be better handled by keeping both
+ function as separate declarations. */
DECL_UNINLINABLE (newdecl) = 1;
}
else
@@ -1960,12 +1950,6 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
DECL_DECLARED_INLINE_P (newdecl) |= DECL_DECLARED_INLINE_P (olddecl);
- /* If either decl says `inline', this fn is inline, unless
- its definition was passed already. */
- if (DECL_INLINE (newdecl) && DECL_INITIAL (olddecl) == NULL_TREE)
- DECL_INLINE (olddecl) = 1;
- DECL_INLINE (newdecl) = DECL_INLINE (olddecl);
-
DECL_UNINLINABLE (newdecl) = DECL_UNINLINABLE (olddecl)
= (DECL_UNINLINABLE (newdecl) || DECL_UNINLINABLE (olddecl));
@@ -2057,6 +2041,12 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
ggc_free (DECL_LANG_SPECIFIC (olddecl));
}
+ /* Merge the USED information. */
+ if (TREE_USED (olddecl))
+ TREE_USED (newdecl) = 1;
+ else if (TREE_USED (newdecl))
+ TREE_USED (olddecl) = 1;
+
if (TREE_CODE (newdecl) == FUNCTION_DECL)
{
int function_size;
@@ -3591,7 +3581,7 @@ build_library_fn_1 (tree name, enum tree_code operator_code, tree type)
We assume that such functions never throw; if this is incorrect,
callers should unset TREE_NOTHROW. */
-tree
+static tree
build_library_fn (tree name, tree type)
{
tree fn = build_library_fn_1 (name, ERROR_MARK, type);
@@ -3630,12 +3620,18 @@ build_cp_library_fn_ptr (const char* name, tree type)
}
/* Like build_library_fn, but also pushes the function so that we will
- be able to find it via IDENTIFIER_GLOBAL_VALUE. */
+ be able to find it via IDENTIFIER_GLOBAL_VALUE. Also, the function
+ may throw exceptions listed in RAISES. */
tree
-push_library_fn (tree name, tree type)
+push_library_fn (tree name, tree type, tree raises)
{
- tree fn = build_library_fn (name, type);
+ tree fn;
+
+ if (raises)
+ type = build_exception_variant (type, raises);
+
+ fn = build_library_fn (name, type);
pushdecl_top_level (fn);
return fn;
}
@@ -3660,7 +3656,7 @@ tree
push_void_library_fn (tree name, tree parmtypes)
{
tree type = build_function_type (void_type_node, parmtypes);
- return push_library_fn (name, type);
+ return push_library_fn (name, type, NULL_TREE);
}
/* Like push_library_fn, but also note that this function throws
@@ -3669,7 +3665,7 @@ push_void_library_fn (tree name, tree parmtypes)
tree
push_throw_library_fn (tree name, tree type)
{
- tree fn = push_library_fn (name, type);
+ tree fn = push_library_fn (name, type, NULL_TREE);
TREE_THIS_VOLATILE (fn) = 1;
TREE_NOTHROW (fn) = 0;
return fn;
@@ -3813,9 +3809,8 @@ check_tag_decl (cp_decl_specifier_seq *declspecs)
/* Anonymous unions are objects, so they can have specifiers. */;
SET_ANON_AGGR_TYPE_P (declared_type);
- if (TREE_CODE (declared_type) != UNION_TYPE && pedantic
- && !in_system_header)
- pedwarn ("ISO C++ prohibits anonymous structs");
+ if (TREE_CODE (declared_type) != UNION_TYPE && !in_system_header)
+ pedwarn (OPT_pedantic, "ISO C++ prohibits anonymous structs");
}
else
@@ -3932,13 +3927,14 @@ groktypename (cp_decl_specifier_seq *type_specifiers,
grokfield.) The DECL corresponding to the DECLARATOR is returned.
If an error occurs, the error_mark_node is returned instead.
- DECLSPECS are the decl-specifiers for the declaration. INITIALIZED
- is true if an explicit initializer is present, but false if this is
- a variable implicitly initialized via a default constructor.
- ATTRIBUTES and PREFIX_ATTRIBUTES are GNU attributes associated with
- this declaration. *PUSHED_SCOPE_P is set to the scope entered in
- this function, if any; if set, the caller is responsible for
- calling pop_scope. */
+ DECLSPECS are the decl-specifiers for the declaration. INITIALIZED is 1
+ if an explicit initializer is present, or 2 for an explicitly defaulted
+ function, or 3 for an explicitly deleted function, but 0 if this is a
+ variable implicitly initialized via a default constructor. ATTRIBUTES
+ and PREFIX_ATTRIBUTES are GNU attributes associated with this
+ declaration. *PUSHED_SCOPE_P is set to the scope entered in this
+ function, if any; if set, the caller is responsible for calling
+ pop_scope. */
tree
start_decl (const cp_declarator *declarator,
@@ -3992,12 +3988,15 @@ start_decl (const cp_declarator *declarator,
switch (TREE_CODE (decl))
{
case TYPE_DECL:
- error ("typedef %qD is initialized (use __typeof__ instead)", decl);
+ error ("typedef %qD is initialized (use decltype instead)", decl);
return error_mark_node;
case FUNCTION_DECL:
- error ("function %q#D is initialized like a variable", decl);
- return error_mark_node;
+ if (initialized == 3)
+ /* We'll handle the rest of the semantics later, but we need to
+ set this now so it's visible to duplicate_decls. */
+ DECL_DELETED_FN (decl) = 1;
+ break;
default:
break;
@@ -4345,7 +4344,7 @@ check_array_designated_initializer (const constructor_elt *ce)
if (ce->index)
{
/* The parser only allows identifiers as designated
- intializers. */
+ initializers. */
gcc_assert (TREE_CODE (ce->index) == IDENTIFIER_NODE);
error ("name %qD used in a GNU-style designated "
"initializer for an array", ce->index);
@@ -4778,15 +4777,20 @@ reshape_init_r (tree type, reshape_iter *d, bool first_initializer_p)
if (!CP_AGGREGATE_TYPE_P (type))
{
/* It is invalid to initialize a non-aggregate type with a
- brace-enclosed initializer.
+ brace-enclosed initializer before C++0x.
We need to check for BRACE_ENCLOSED_INITIALIZER_P here because
of g++.old-deja/g++.mike/p7626.C: a pointer-to-member constant is
a CONSTRUCTOR (with a record type). */
if (TREE_CODE (init) == CONSTRUCTOR
&& BRACE_ENCLOSED_INITIALIZER_P (init)) /* p7626.C */
{
- error ("braces around scalar initializer for type %qT", type);
- init = error_mark_node;
+ if (SCALAR_TYPE_P (type))
+ {
+ error ("braces around scalar initializer for type %qT", type);
+ init = error_mark_node;
+ }
+ else
+ maybe_warn_cpp0x ("extended initializer lists");
}
d->cur++;
@@ -5687,10 +5691,38 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p,
else
abstract_virtuals_error (decl, type);
- if (TREE_CODE (decl) == FUNCTION_DECL
- || TREE_TYPE (decl) == error_mark_node)
+ if (TREE_TYPE (decl) == error_mark_node)
/* No initialization required. */
;
+ else if (TREE_CODE (decl) == FUNCTION_DECL)
+ {
+ if (init)
+ {
+ if (init == ridpointers[(int)RID_DELETE])
+ {
+ /* fixme check this is 1st decl */
+ DECL_DELETED_FN (decl) = 1;
+ DECL_DECLARED_INLINE_P (decl) = 1;
+ DECL_INITIAL (decl) = error_mark_node;
+ }
+ else if (init == ridpointers[(int)RID_DEFAULT])
+ {
+ if (!defaultable_fn_p (decl))
+ error ("%qD cannot be defaulted", decl);
+ else
+ {
+ /* An out-of-class default definition is defined at
+ the point where it is explicitly defaulted. */
+ DECL_DEFAULTED_FN (decl) = 1;
+ if (DECL_INITIAL (decl) == error_mark_node)
+ synthesize_method (decl);
+ }
+ }
+ else
+ error ("function %q#D is initialized like a variable", decl);
+ }
+ /* else no initialization required. */
+ }
else if (DECL_EXTERNAL (decl)
&& ! (DECL_LANG_SPECIFIC (decl)
&& DECL_NOT_REALLY_EXTERN (decl)))
@@ -5916,8 +5948,6 @@ start_cleanup_fn (void)
actually needed. It is unlikely that it will be inlined, since
it is only called via a function pointer, but we avoid unnecessary
emissions this way. */
- DECL_INLINE (fndecl) = 1;
- DECL_DECLARED_INLINE_P (fndecl) = 1;
DECL_INTERFACE_KNOWN (fndecl) = 1;
/* Build the parameter. */
if (use_cxa_atexit)
@@ -6141,9 +6171,10 @@ expand_static_init (tree decl, tree init)
void_list_node);
tree vfntype = build_function_type (void_type_node, argtypes);
acquire_fn = push_library_fn
- (acquire_fn, build_function_type (integer_type_node, argtypes));
- release_fn = push_library_fn (release_fn, vfntype);
- abort_fn = push_library_fn (abort_fn, vfntype);
+ (acquire_fn, build_function_type (integer_type_node, argtypes),
+ NULL_TREE);
+ release_fn = push_library_fn (release_fn, vfntype, NULL_TREE);
+ abort_fn = push_library_fn (abort_fn, vfntype, NULL_TREE);
}
else
{
@@ -6603,11 +6634,6 @@ grokfndecl (tree ctype,
/* If the declaration was declared inline, mark it as such. */
if (inlinep)
DECL_DECLARED_INLINE_P (decl) = 1;
- /* We inline functions that are explicitly declared inline, or, when
- the user explicitly asks us to, all functions. */
- if (DECL_DECLARED_INLINE_P (decl)
- || (flag_inline_trees == 2 && !DECL_INLINE (decl) && funcdef_flag))
- DECL_INLINE (decl) = 1;
DECL_EXTERNAL (decl) = 1;
if (quals && TREE_CODE (type) == FUNCTION_TYPE)
@@ -6666,7 +6692,8 @@ grokfndecl (tree ctype,
newtype = build_function_type (integer_type_node, oldtypeargs);
TREE_TYPE (decl) = newtype;
}
- check_main_parameter_types (decl);
+ if (warn_main)
+ check_main_parameter_types (decl);
}
if (ctype != NULL_TREE
@@ -6935,16 +6962,17 @@ build_ptrmemfunc_type (tree type)
TYPE_MAIN_VARIANT (t) = unqualified_variant;
TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (unqualified_variant);
TYPE_NEXT_VARIANT (unqualified_variant) = t;
+ TREE_TYPE (TYPE_BINFO (t)) = t;
}
/* Cache this pointer-to-member type so that we can find it again
later. */
TYPE_SET_PTRMEMFUNC_TYPE (type, t);
- /* Managing canonical types for the RECORD_TYPE behind a
- pointer-to-member function is a nightmare, so use structural
- equality for now. */
- SET_TYPE_STRUCTURAL_EQUALITY (t);
+ if (TYPE_STRUCTURAL_EQUALITY_P (type))
+ SET_TYPE_STRUCTURAL_EQUALITY (t);
+ else if (TYPE_CANONICAL (type) != type)
+ TYPE_CANONICAL (t) = build_ptrmemfunc_type (TYPE_CANONICAL (type));
return t;
}
@@ -7004,8 +7032,8 @@ check_static_variable_definition (tree decl, tree type)
error ("ISO C++ forbids in-class initialization of non-const "
"static member %qD",
decl);
- else if (pedantic && !INTEGRAL_TYPE_P (type))
- pedwarn ("ISO C++ forbids initialization of member constant "
+ else if (!INTEGRAL_TYPE_P (type))
+ pedwarn (OPT_pedantic, "ISO C++ forbids initialization of member constant "
"%qD of non-integral type %qT", decl, type);
return 0;
@@ -7050,7 +7078,7 @@ compute_array_index_type (tree name, tree size)
if (!abi_version_at_least (2) && processing_template_decl)
/* For abi-1, we handled all instances in templates the same way,
- even when they were non-dependent. This effects the manglings
+ even when they were non-dependent. This affects the manglings
produced. So, we do the normal checking for non-dependent
sizes, but at the end we'll return the same type that abi-1
would have, but with TYPE_CANONICAL set to the "right"
@@ -7082,12 +7110,12 @@ compute_array_index_type (tree name, tree size)
}
/* As an extension we allow zero-sized arrays. We always allow
them in system headers because glibc uses them. */
- else if (integer_zerop (size) && pedantic && !in_system_header)
+ else if (integer_zerop (size) && !in_system_header)
{
if (name)
- pedwarn ("ISO C++ forbids zero-size array %qD", name);
+ pedwarn (OPT_pedantic, "ISO C++ forbids zero-size array %qD", name);
else
- pedwarn ("ISO C++ forbids zero-size array");
+ pedwarn (OPT_pedantic, "ISO C++ forbids zero-size array");
}
}
else if (TREE_CONSTANT (size))
@@ -7103,9 +7131,9 @@ compute_array_index_type (tree name, tree size)
else if (pedantic && warn_vla != 0)
{
if (name)
- pedwarn ("ISO C++ forbids variable length array %qD", name);
+ pedwarn (OPT_Wvla, "ISO C++ forbids variable length array %qD", name);
else
- pedwarn ("ISO C++ forbids variable length array");
+ pedwarn (OPT_Wvla, "ISO C++ forbids variable length array");
}
else if (warn_vla > 0)
{
@@ -7362,7 +7390,7 @@ check_var_type (tree identifier, tree type)
Don't make a DECL node; just return the ..._TYPE node.
FIELD for a struct or union field; make a FIELD_DECL.
BITFIELD for a field with specified width.
- INITIALIZED is 1 if the decl has an initializer.
+ INITIALIZED is as for start_decl.
ATTRLIST is a pointer to the list of attributes, which may be NULL
if there are none; *ATTRLIST may be modified if attributes from inside
@@ -7460,6 +7488,9 @@ grokdeclarator (const cp_declarator *declarator,
else if (decl_context == BITFIELD)
bitfield = 1, decl_context = FIELD;
+ if (initialized > 1)
+ funcdef_flag = true;
+
/* Look inside a declarator for the name being declared
and get it as a string, for an error message. */
for (id_declarator = declarator;
@@ -7736,7 +7767,8 @@ grokdeclarator (const cp_declarator *declarator,
else if (! is_main)
permerror ("ISO C++ forbids declaration of %qs with no type", name);
else if (pedantic)
- pedwarn ("ISO C++ forbids declaration of %qs with no type", name);
+ pedwarn (OPT_pedantic,
+ "ISO C++ forbids declaration of %qs with no type", name);
else
warning (OPT_Wreturn_type,
"ISO C++ forbids declaration of %qs with no type", name);
@@ -7791,7 +7823,8 @@ grokdeclarator (const cp_declarator *declarator,
ok = 1;
if (!explicit_int && !defaulted_int && !explicit_char && pedantic)
{
- pedwarn ("long, short, signed or unsigned used invalidly for %qs",
+ pedwarn (OPT_pedantic,
+ "long, short, signed or unsigned used invalidly for %qs",
name);
if (flag_pedantic_errors)
ok = 0;
@@ -7896,7 +7929,8 @@ grokdeclarator (const cp_declarator *declarator,
if (pedantic)
{
tree bad_type = build_qualified_type (type, type_quals);
- pedwarn ("ignoring %qV qualifiers added to function type %qT",
+ pedwarn (OPT_pedantic,
+ "ignoring %qV qualifiers added to function type %qT",
bad_type, type);
}
type_quals = TYPE_UNQUALIFIED;
@@ -8404,8 +8438,9 @@ grokdeclarator (const cp_declarator *declarator,
friendp = 0;
}
else
- permerror ("extra qualification %<%T::%> on member %qs",
- ctype, name);
+ permerror_at (declarator->id_loc,
+ "extra qualification %<%T::%> on member %qs",
+ ctype, name);
}
else if (/* If the qualifying type is already complete, then we
can skip the following checks. */
@@ -9124,10 +9159,12 @@ grokdeclarator (const cp_declarator *declarator,
&& pedantic)
{
if (storage_class == sc_static)
- pedwarn ("%<static%> specified invalid for function %qs "
+ pedwarn (OPT_pedantic,
+ "%<static%> specified invalid for function %qs "
"declared out of global scope", name);
else
- pedwarn ("%<inline%> specifier invalid for function %qs "
+ pedwarn (OPT_pedantic,
+ "%<inline%> specifier invalid for function %qs "
"declared out of global scope", name);
}
@@ -9215,9 +9252,9 @@ grokdeclarator (const cp_declarator *declarator,
}
if (storage_class == sc_extern && pedantic)
{
- pedwarn ("cannot explicitly declare member %q#D to have "
- "extern linkage",
- decl);
+ pedwarn (OPT_pedantic,
+ "cannot explicitly declare member %q#D to have "
+ "extern linkage", decl);
storage_class = sc_none;
}
}
@@ -9233,7 +9270,10 @@ grokdeclarator (const cp_declarator *declarator,
warning (0, "%qs initialized and declared %<extern%>", name);
}
else
- error ("%qs has both %<extern%> and initializer", name);
+ {
+ error ("%qs has both %<extern%> and initializer", name);
+ return error_mark_node;
+ }
}
/* Record `register' declaration for warnings on &
@@ -9666,6 +9706,8 @@ grok_special_member_properties (tree decl)
are no other parameters or else all other parameters have
default arguments. */
TYPE_HAS_INIT_REF (class_type) = 1;
+ if (!DECL_DEFAULTED_FN (decl))
+ TYPE_HAS_COMPLEX_INIT_REF (class_type) = 1;
if (ctor > 1)
TYPE_HAS_CONST_INIT_REF (class_type) = 1;
}
@@ -9687,6 +9729,8 @@ grok_special_member_properties (tree decl)
if (assop)
{
TYPE_HAS_ASSIGN_REF (class_type) = 1;
+ if (!DECL_DEFAULTED_FN (decl))
+ TYPE_HAS_COMPLEX_ASSIGN_REF (class_type) = 1;
if (assop != 1)
TYPE_HAS_CONST_ASSIGN_REF (class_type) = 1;
}
@@ -10104,8 +10148,8 @@ grok_op_properties (tree decl, bool complain)
if (operator_code == POSTINCREMENT_EXPR
|| operator_code == POSTDECREMENT_EXPR)
{
- if (pedantic)
- pedwarn ("%qD cannot have default arguments", decl);
+ pedwarn (OPT_pedantic, "%qD cannot have default arguments",
+ decl);
}
else
{
@@ -10576,10 +10620,7 @@ xref_basetypes (tree ref, tree base_list)
basetype = PACK_EXPANSION_PATTERN (basetype);
if (TREE_CODE (basetype) == TYPE_DECL)
basetype = TREE_TYPE (basetype);
- if (TREE_CODE (basetype) != RECORD_TYPE
- && TREE_CODE (basetype) != TYPENAME_TYPE
- && TREE_CODE (basetype) != TEMPLATE_TYPE_PARM
- && TREE_CODE (basetype) != BOUND_TEMPLATE_TEMPLATE_PARM)
+ if (!MAYBE_CLASS_TYPE_P (basetype) || TREE_CODE (basetype) == UNION_TYPE)
{
error ("base type %qT fails to be a struct or class type",
basetype);
@@ -10839,7 +10880,7 @@ finish_enum (tree enumtype)
underlying_type = integer_types[itk_unsigned_long_long];
}
- /* Compute the minium and maximum values for the type.
+ /* Compute the minimum and maximum values for the type.
[dcl.enum]
@@ -11961,13 +12002,15 @@ finish_function (int flags)
/* Don't complain if we abort or throw. */
&& !current_function_returns_abnormally
&& !DECL_NAME (DECL_RESULT (fndecl))
- /* Normally, with -Wreturn-type, flow will complain. Unless we're an
- inline function, as we might never be compiled separately. */
- && (DECL_INLINE (fndecl) || processing_template_decl)
+ && !TREE_NO_WARNING (fndecl)
/* Structor return values (if any) are set by the compiler. */
&& !DECL_CONSTRUCTOR_P (fndecl)
&& !DECL_DESTRUCTOR_P (fndecl))
- warning (OPT_Wreturn_type, "no return statement in function returning non-void");
+ {
+ warning (OPT_Wreturn_type,
+ "no return statement in function returning non-void");
+ TREE_NO_WARNING (fndecl) = 1;
+ }
/* Store the end of the function, so that we get good line number
info for the epilogue. */
@@ -11989,7 +12032,7 @@ finish_function (int flags)
f->extern_decl_map = NULL;
/* Handle attribute((warn_unused_result)). Relies on gimple input. */
- c_warn_unused_result (&DECL_SAVED_TREE (fndecl));
+ c_warn_unused_result (gimple_body (fndecl));
}
/* Clear out the bits we don't need. */
local_names = NULL;
@@ -12078,8 +12121,6 @@ start_method (cp_decl_specifier_seq *declspecs,
check_template_shadow (fndecl);
DECL_DECLARED_INLINE_P (fndecl) = 1;
- if (flag_default_inline)
- DECL_INLINE (fndecl) = 1;
/* We process method specializations in finish_struct_1. */
if (processing_template_decl && !DECL_TEMPLATE_SPECIALIZATION (fndecl))
@@ -12195,7 +12236,7 @@ maybe_register_incomplete_var (tree var)
}
/* Called when a class type (given by TYPE) is defined. If there are
- any existing VAR_DECLs whose type hsa been completed by this
+ any existing VAR_DECLs whose type has been completed by this
declaration, update them now. */
void
@@ -12260,7 +12301,7 @@ cxx_maybe_build_cleanup (tree decl)
initial checks on the attribute. Note that those checks
include ensuring that the function found is not an overloaded
function, or an object with an overloaded call operator,
- etc.; we can rely on the fact that the functionfound is an
+ etc.; we can rely on the fact that the function found is an
ordinary FUNCTION_DECL. */
fn = lookup_name (id);
arg = build_address (decl);
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index a5ece9a6709..eb92dfd68cf 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -51,6 +51,7 @@ along with GCC; see the file COPYING3. If not see
#include "c-pragma.h"
#include "tree-dump.h"
#include "intl.h"
+#include "gimple.h"
extern cpp_reader *parse_in;
@@ -821,7 +822,24 @@ grokfield (const cp_declarator *declarator,
{
/* Initializers for functions are rejected early in the parser.
If we get here, it must be a pure specifier for a method. */
- if (TREE_CODE (TREE_TYPE (value)) == METHOD_TYPE)
+ if (init == ridpointers[(int)RID_DELETE])
+ {
+ DECL_DELETED_FN (value) = 1;
+ DECL_DECLARED_INLINE_P (value) = 1;
+ DECL_INITIAL (value) = error_mark_node;
+ }
+ else if (init == ridpointers[(int)RID_DEFAULT])
+ {
+ if (!defaultable_fn_p (value))
+ error ("%qD cannot be defaulted", value);
+ else
+ {
+ DECL_DEFAULTED_FN (value) = 1;
+ DECL_INITIALIZED_IN_CLASS_P (value) = 1;
+ DECL_DECLARED_INLINE_P (value) = 1;
+ }
+ }
+ else if (TREE_CODE (TREE_TYPE (value)) == METHOD_TYPE)
{
gcc_assert (error_operand_p (init) || integer_zerop (init));
DECL_PURE_VIRTUAL_P (value) = 1;
@@ -1963,6 +1981,14 @@ determine_visibility (tree decl)
/* tinfo visibility is based on the type it's for. */
constrain_visibility
(decl, type_visibility (TREE_TYPE (DECL_NAME (decl))));
+
+ /* Give the target a chance to override the visibility associated
+ with DECL. */
+ if (TREE_PUBLIC (decl)
+ && !DECL_REALLY_EXTERN (decl)
+ && CLASS_TYPE_P (TREE_TYPE (DECL_NAME (decl)))
+ && !CLASSTYPE_VISIBILITY_SPECIFIED (TREE_TYPE (DECL_NAME (decl))))
+ targetm.cxx.determine_class_data_visibility (decl);
}
else if (use_template)
/* Template instantiations and specializations get visibility based
@@ -2675,7 +2701,6 @@ start_static_storage_duration_function (unsigned count)
type);
TREE_PUBLIC (ssdf_decl) = 0;
DECL_ARTIFICIAL (ssdf_decl) = 1;
- DECL_INLINE (ssdf_decl) = 1;
/* Put this function in the list of functions to be called from the
static constructors and destructors. */
@@ -2786,6 +2811,38 @@ get_priority_info (int priority)
|| DECL_ONE_ONLY (decl) \
|| DECL_WEAK (decl)))
+/* Called from one_static_initialization_or_destruction(),
+ via walk_tree.
+ Walks the initializer list of a global variable and looks for
+ temporary variables (DECL_NAME() == NULL and DECL_ARTIFICIAL != 0)
+ and that have their DECL_CONTEXT() == NULL.
+ For each such temporary variable, set their DECL_CONTEXT() to
+ the current function. This is necessary because otherwise
+ some optimizers (enabled by -O2 -fprofile-arcs) might crash
+ when trying to refer to a temporary variable that does not have
+ it's DECL_CONTECT() properly set. */
+static tree
+fix_temporary_vars_context_r (tree *node,
+ int *unused ATTRIBUTE_UNUSED,
+ void *unused1 ATTRIBUTE_UNUSED)
+{
+ gcc_assert (current_function_decl);
+
+ if (TREE_CODE (*node) == BIND_EXPR)
+ {
+ tree var;
+
+ for (var = BIND_EXPR_VARS (*node); var; var = TREE_CHAIN (var))
+ if (TREE_CODE (var) == VAR_DECL
+ && !DECL_NAME (var)
+ && DECL_ARTIFICIAL (var)
+ && !DECL_CONTEXT (var))
+ DECL_CONTEXT (var) = current_function_decl;
+ }
+
+ return NULL_TREE;
+}
+
/* Set up to handle the initialization or destruction of DECL. If
INITP is nonzero, we are initializing the variable. Otherwise, we
are destroying it. */
@@ -2808,6 +2865,19 @@ one_static_initialization_or_destruction (tree decl, tree init, bool initp)
information. */
input_location = DECL_SOURCE_LOCATION (decl);
+ /* Make sure temporary variables in the initialiser all have
+ their DECL_CONTEXT() set to a value different from NULL_TREE.
+ This can happen when global variables initialisers are built.
+ In that case, the DECL_CONTEXT() of the global variables _AND_ of all
+ the temporary variables that might have been generated in the
+ accompagning initialisers is NULL_TREE, meaning the variables have been
+ declared in the global namespace.
+ What we want to do here is to fix that and make sure the DECL_CONTEXT()
+ of the temporaries are set to the current function decl. */
+ cp_walk_tree_without_duplicates (&init,
+ fix_temporary_vars_context_r,
+ NULL);
+
/* Because of:
[class.access.spec]
@@ -3396,7 +3466,7 @@ cp_write_global_declarations (void)
{
/* Does it need synthesizing? */
if (DECL_ARTIFICIAL (decl) && ! DECL_INITIAL (decl)
- && (! DECL_REALLY_EXTERN (decl) || DECL_INLINE (decl)))
+ && (! DECL_REALLY_EXTERN (decl) || possibly_inlined_p (decl)))
{
/* Even though we're already at the top-level, we push
there again. That way, when we pop back a few lines
@@ -3413,7 +3483,7 @@ cp_write_global_declarations (void)
reconsider = true;
}
- if (!DECL_SAVED_TREE (decl))
+ if (!gimple_body (decl))
continue;
/* We lie to the back end, pretending that some functions
@@ -3657,6 +3727,22 @@ check_default_args (tree x)
}
}
+/* Return true if function DECL can be inlined. This is used to force
+ instantiation of methods that might be interesting for inlining. */
+bool
+possibly_inlined_p (tree decl)
+{
+ gcc_assert (TREE_CODE (decl) == FUNCTION_DECL);
+ if (DECL_UNINLINABLE (decl))
+ return false;
+ if (!optimize)
+ return DECL_DECLARED_INLINE_P (decl);
+ /* When optimizing, we might inline everything when flatten
+ attribute or heuristics inlining for size or autoinlining
+ is used. */
+ return true;
+}
+
/* Mark DECL (either a _DECL or a BASELINK) as "used" in the program.
If DECL is a specialization or implicitly declared class member,
generate the actual definition. */
@@ -3731,7 +3817,7 @@ mark_used (tree decl)
/* Is it a synthesized method that needs to be synthesized? */
if (TREE_CODE (decl) == FUNCTION_DECL
&& DECL_NONSTATIC_MEMBER_FUNCTION_P (decl)
- && DECL_ARTIFICIAL (decl)
+ && DECL_DEFAULTED_FN (decl)
&& !DECL_THUNK_P (decl)
&& ! DECL_INITIAL (decl)
/* Kludge: don't synthesize for default args. Unfortunately this
@@ -3744,12 +3830,19 @@ mark_used (tree decl)
/* If we've already synthesized the method we don't need to
do the instantiation test below. */
}
+ else if (TREE_CODE (decl) == FUNCTION_DECL
+ && DECL_DELETED_FN (decl))
+ {
+ error ("deleted function %q+D", decl);
+ error ("used here");
+ }
else if ((DECL_NON_THUNK_FUNCTION_P (decl) || TREE_CODE (decl) == VAR_DECL)
&& DECL_LANG_SPECIFIC (decl) && DECL_TEMPLATE_INFO (decl)
&& (!DECL_EXPLICIT_INSTANTIATION (decl)
|| (TREE_CODE (decl) == FUNCTION_DECL
- && DECL_INLINE (DECL_TEMPLATE_RESULT
- (template_for_substitution (decl))))
+ && possibly_inlined_p
+ (DECL_TEMPLATE_RESULT (
+ template_for_substitution (decl))))
/* We need to instantiate static data members so that there
initializers are available in integral constant
expressions. */
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index 80aa6e962d2..03ceddffb78 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -2661,7 +2661,7 @@ cp_cpp_error (cpp_reader *pfile ATTRIBUTE_UNUSED, int level,
dlevel = DK_WARNING;
break;
case CPP_DL_PEDWARN:
- dlevel = pedantic_warning_kind ();
+ dlevel = DK_PEDWARN;
break;
case CPP_DL_ERROR:
dlevel = DK_ERROR;
@@ -2685,7 +2685,7 @@ maybe_warn_cpp0x (const char* str)
/* We really want to suppress this warning in system headers,
because libstdc++ uses variadic templates even when we aren't
in C++0x mode. */
- pedwarn ("%s only available with -std=c++0x", str);
+ pedwarn (0, "%s only available with -std=c++0x or -std=gnu++0x", str);
}
/* Warn about the use of variadic templates when appropriate. */
diff --git a/gcc/cp/except.c b/gcc/cp/except.c
index 3070cda4d54..56a551212fe 100644
--- a/gcc/cp/except.c
+++ b/gcc/cp/except.c
@@ -1,6 +1,7 @@
/* Handle exceptional things in C++.
Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
+ 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008
+ Free Software Foundation, Inc.
Contributed by Michael Tiemann <tiemann@cygnus.com>
Rewritten by Mike Stump <mrs@cygnus.com>, based upon an
initial re-implementation courtesy Tad Hunt.
@@ -38,6 +39,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-inline.h"
#include "tree-iterator.h"
#include "target.h"
+#include "gimple.h"
static void push_eh_cleanup (tree);
static tree prepare_eh_type (tree);
@@ -52,7 +54,7 @@ static tree wrap_cleanups_r (tree *, int *, void *);
static int complete_ptr_ref_or_void_ptr_p (tree, tree);
static bool is_admissible_throw_operand (tree);
static int can_convert_eh (tree, tree);
-static tree cp_protect_cleanup_actions (void);
+static gimple cp_protect_cleanup_actions (void);
/* Sets up all the global eh stuff that needs to be initialized at the
start of compilation. */
@@ -91,14 +93,14 @@ init_exception_processing (void)
/* Returns an expression to be executed if an unhandled exception is
propagated out of a cleanup region. */
-static tree
+static gimple
cp_protect_cleanup_actions (void)
{
/* [except.terminate]
When the destruction of an object during stack unwinding exits
using an exception ... void terminate(); is called. */
- return build_call_n (terminate_node, 0);
+ return gimple_build_call (terminate_node, 0);
}
static tree
@@ -160,6 +162,21 @@ build_exc_ptr (void)
return build0 (EXC_PTR_EXPR, ptr_type_node);
}
+/* Declare a function NAME, returning RETURN_TYPE, taking a single
+ parameter PARM_TYPE, with an empty exception specification.
+
+ Note that the C++ ABI document does not have a throw-specifier on
+ the routines declared below via this function. The declarations
+ are consistent with the actual implementations in libsupc++. */
+
+static tree
+declare_nothrow_library_fn (tree name, tree return_type, tree parm_type)
+{
+ tree tmp = tree_cons (NULL_TREE, parm_type, void_list_node);
+ return push_library_fn (name, build_function_type (return_type, tmp),
+ empty_except_spec);
+}
+
/* Build up a call to __cxa_get_exception_ptr so that we can build a
copy constructor for the thrown object. */
@@ -171,9 +188,8 @@ do_get_exception_ptr (void)
fn = get_identifier ("__cxa_get_exception_ptr");
if (!get_global_value_if_present (fn, &fn))
{
- /* Declare void* __cxa_get_exception_ptr (void *). */
- tree tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node);
- fn = push_library_fn (fn, build_function_type (ptr_type_node, tmp));
+ /* Declare void* __cxa_get_exception_ptr (void *) throw(). */
+ fn = declare_nothrow_library_fn (fn, ptr_type_node, ptr_type_node);
}
return cp_build_function_call (fn, tree_cons (NULL_TREE, build_exc_ptr (),
@@ -192,9 +208,8 @@ do_begin_catch (void)
fn = get_identifier ("__cxa_begin_catch");
if (!get_global_value_if_present (fn, &fn))
{
- /* Declare void* __cxa_begin_catch (void *). */
- tree tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node);
- fn = push_library_fn (fn, build_function_type (ptr_type_node, tmp));
+ /* Declare void* __cxa_begin_catch (void *) throw(). */
+ fn = declare_nothrow_library_fn (fn, ptr_type_node, ptr_type_node);
}
return cp_build_function_call (fn, tree_cons (NULL_TREE, build_exc_ptr (),
@@ -543,9 +558,8 @@ do_allocate_exception (tree type)
fn = get_identifier ("__cxa_allocate_exception");
if (!get_global_value_if_present (fn, &fn))
{
- /* Declare void *__cxa_allocate_exception(size_t). */
- tree tmp = tree_cons (NULL_TREE, size_type_node, void_list_node);
- fn = push_library_fn (fn, build_function_type (ptr_type_node, tmp));
+ /* Declare void *__cxa_allocate_exception(size_t) throw(). */
+ fn = declare_nothrow_library_fn (fn, ptr_type_node, size_type_node);
}
return cp_build_function_call (fn,
@@ -565,9 +579,8 @@ do_free_exception (tree ptr)
fn = get_identifier ("__cxa_free_exception");
if (!get_global_value_if_present (fn, &fn))
{
- /* Declare void __cxa_free_exception (void *). */
- fn = push_void_library_fn (fn, tree_cons (NULL_TREE, ptr_type_node,
- void_list_node));
+ /* Declare void __cxa_free_exception (void *) throw(). */
+ fn = declare_nothrow_library_fn (fn, void_type_node, ptr_type_node);
}
return cp_build_function_call (fn, tree_cons (NULL_TREE, ptr, NULL_TREE),
diff --git a/gcc/cp/friend.c b/gcc/cp/friend.c
index 96c6dc653ba..4d9a14ce88e 100644
--- a/gcc/cp/friend.c
+++ b/gcc/cp/friend.c
@@ -59,15 +59,15 @@ is_friend (tree type, tree supplicant)
tree friends = FRIEND_DECLS (list);
for (; friends ; friends = TREE_CHAIN (friends))
{
- tree friend = TREE_VALUE (friends);
+ tree this_friend = TREE_VALUE (friends);
- if (friend == NULL_TREE)
+ if (this_friend == NULL_TREE)
continue;
- if (supplicant == friend)
+ if (supplicant == this_friend)
return 1;
- if (is_specialization_of_friend (supplicant, friend))
+ if (is_specialization_of_friend (supplicant, this_friend))
return 1;
}
break;
@@ -568,9 +568,11 @@ do_friend (tree ctype, tree declarator, tree decl,
if (warn)
{
static int explained;
- warning (OPT_Wnon_template_friend, "friend declaration "
- "%q#D declares a non-template function", decl);
- if (! explained)
+ bool warned;
+
+ warned = warning (OPT_Wnon_template_friend, "friend declaration "
+ "%q#D declares a non-template function", decl);
+ if (! explained && warned)
{
inform ("(if this is not what you intended, make sure "
"the function template has already been declared "
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 3e9e612f2b4..df36c5e829f 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -346,8 +346,8 @@ build_value_init_1 (tree type, bool have_ctor)
if (CLASS_TYPE_P (type))
{
- if (TYPE_HAS_USER_CONSTRUCTOR (type) && !have_ctor)
- return build_cplus_new
+ if (type_has_user_provided_constructor (type) && !have_ctor)
+ return build_aggr_init_expr
(type,
build_special_member_call (NULL_TREE, complete_ctor_identifier,
NULL_TREE, type, LOOKUP_NORMAL,
@@ -469,13 +469,13 @@ perform_member_init (tree member, tree init)
{
tree decl;
tree type = TREE_TYPE (member);
- bool explicit;
+ bool is_explicit;
- explicit = (init != NULL_TREE);
+ is_explicit = (init != NULL_TREE);
/* Effective C++ rule 12 requires that all data members be
initialized. */
- if (warn_ecpp && !explicit && TREE_CODE (type) != ARRAY_TYPE)
+ if (warn_ecpp && !is_explicit && TREE_CODE (type) != ARRAY_TYPE)
warning (OPT_Weffc__, "%J%qD should be initialized in the member initialization "
"list", current_function_decl, member);
@@ -503,7 +503,7 @@ perform_member_init (tree member, tree init)
}
else if (TYPE_NEEDS_CONSTRUCTING (type))
{
- if (explicit
+ if (is_explicit
&& TREE_CODE (type) == ARRAY_TYPE
&& init != NULL_TREE
&& TREE_CHAIN (init) == NULL_TREE
@@ -511,19 +511,28 @@ perform_member_init (tree member, tree init)
{
/* Initialization of one array from another. */
finish_expr_stmt (build_vec_init (decl, NULL_TREE, TREE_VALUE (init),
- /*explicit_default_init_p=*/false,
+ /*explicit_value_init_p=*/false,
/* from_array=*/1,
tf_warning_or_error));
}
else
- finish_expr_stmt (build_aggr_init (decl, init, 0,
- tf_warning_or_error));
+ {
+ if (CP_TYPE_CONST_P (type)
+ && init == NULL_TREE
+ && !type_has_user_provided_default_constructor (type))
+ /* TYPE_NEEDS_CONSTRUCTING can be set just because we have a
+ vtable; still give this diagnostic. */
+ permerror ("%Juninitialized member %qD with %<const%> type %qT",
+ current_function_decl, member, type);
+ finish_expr_stmt (build_aggr_init (decl, init, 0,
+ tf_warning_or_error));
+ }
}
else
{
if (init == NULL_TREE)
{
- if (explicit)
+ if (is_explicit)
{
init = build_default_init (type, /*nelts=*/NULL_TREE);
if (TREE_CODE (type) == REFERENCE_TYPE)
@@ -1277,7 +1286,7 @@ build_aggr_init (tree exp, tree init, int flags, tsubst_flags_t complain)
if (itype && cp_type_quals (itype) != TYPE_UNQUALIFIED)
itype = TREE_TYPE (init) = TYPE_MAIN_VARIANT (itype);
stmt_expr = build_vec_init (exp, NULL_TREE, init,
- /*explicit_default_init_p=*/false,
+ /*explicit_value_init_p=*/false,
itype && same_type_p (itype,
TREE_TYPE (exp)),
complain);
@@ -1578,7 +1587,7 @@ build_offset_ref (tree type, tree member, bool address_p)
a class derived from that class (_class.base.init_). */
if (DECL_NONSTATIC_MEMBER_FUNCTION_P (member))
{
- /* Build a representation of a the qualified name suitable
+ /* Build a representation of the qualified name suitable
for use as the operand to "&" -- even though the "&" is
not actually present. */
member = build2 (OFFSET_REF, TREE_TYPE (member), decl, member);
@@ -1883,7 +1892,9 @@ build_new_1 (tree placement, tree type, tree nelts, tree init,
return error_mark_node;
is_initialized = (TYPE_NEEDS_CONSTRUCTING (elt_type) || init);
- if (CP_TYPE_CONST_P (elt_type) && !is_initialized)
+
+ if (CP_TYPE_CONST_P (elt_type) && !init
+ && !type_has_user_provided_default_constructor (elt_type))
{
if (complain & tf_error)
error ("uninitialized const in %<new%> of %q#T", elt_type);
@@ -2044,11 +2055,9 @@ build_new_1 (tree placement, tree type, tree nelts, tree init,
return rval;
}
- /* While we're working, use a pointer to the type we've actually
- allocated. Store the result of the call in a variable so that we
- can use it more than once. */
- full_pointer_type = build_pointer_type (full_type);
- alloc_expr = get_target_expr (build_nop (full_pointer_type, alloc_call));
+ /* Store the result of the allocation call in a variable so that we can
+ use it more than once. */
+ alloc_expr = get_target_expr (alloc_call);
alloc_node = TARGET_EXPR_SLOT (alloc_expr);
/* Strip any COMPOUND_EXPRs from ALLOC_CALL. */
@@ -2100,16 +2109,17 @@ build_new_1 (tree placement, tree type, tree nelts, tree init,
tree size_ptr_type;
/* Adjust so we're pointing to the start of the object. */
- data_addr = get_target_expr (build2 (POINTER_PLUS_EXPR, full_pointer_type,
- alloc_node, cookie_size));
+ data_addr = build2 (POINTER_PLUS_EXPR, TREE_TYPE (alloc_node),
+ alloc_node, cookie_size);
/* Store the number of bytes allocated so that we can know how
many elements to destroy later. We use the last sizeof
(size_t) bytes to store the number of elements. */
- cookie_ptr = fold_build1 (NEGATE_EXPR, sizetype, size_in_bytes (sizetype));
+ cookie_ptr = size_binop (MINUS_EXPR, cookie_size, size_in_bytes (sizetype));
+ cookie_ptr = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (alloc_node),
+ alloc_node, cookie_ptr);
size_ptr_type = build_pointer_type (sizetype);
- cookie_ptr = build2 (POINTER_PLUS_EXPR, size_ptr_type,
- fold_convert (size_ptr_type, data_addr), cookie_ptr);
+ cookie_ptr = fold_convert (size_ptr_type, cookie_ptr);
cookie = cp_build_indirect_ref (cookie_ptr, NULL, complain);
cookie_expr = build2 (MODIFY_EXPR, sizetype, cookie, nelts);
@@ -2123,11 +2133,10 @@ build_new_1 (tree placement, tree type, tree nelts, tree init,
cookie = cp_build_indirect_ref (cookie_ptr, NULL, complain);
cookie = build2 (MODIFY_EXPR, sizetype, cookie,
- size_in_bytes(elt_type));
+ size_in_bytes (elt_type));
cookie_expr = build2 (COMPOUND_EXPR, TREE_TYPE (cookie_expr),
cookie, cookie_expr);
}
- data_addr = TARGET_EXPR_SLOT (data_addr);
}
else
{
@@ -2135,6 +2144,10 @@ build_new_1 (tree placement, tree type, tree nelts, tree init,
data_addr = alloc_node;
}
+ /* Now use a pointer to the type we've actually allocated. */
+ full_pointer_type = build_pointer_type (full_type);
+ data_addr = fold_convert (full_pointer_type, data_addr);
+
/* Now initialize the allocated object. Note that we preevaluate the
initialization expression, apart from the actual constructor call or
assignment--we do this because we want to delay the allocation as long
@@ -2143,19 +2156,19 @@ build_new_1 (tree placement, tree type, tree nelts, tree init,
if (is_initialized)
{
bool stable;
+ bool explicit_value_init_p = false;
init_expr = cp_build_indirect_ref (data_addr, NULL, complain);
- if (array_p)
+ if (init == void_zero_node)
{
- bool explicit_default_init_p = false;
+ init = NULL_TREE;
+ explicit_value_init_p = true;
+ }
- if (init == void_zero_node)
- {
- init = NULL_TREE;
- explicit_default_init_p = true;
- }
- else if (init)
+ if (array_p)
+ {
+ if (init)
{
if (complain & tf_error)
permerror ("ISO C++ forbids initialization in array new");
@@ -2168,7 +2181,7 @@ build_new_1 (tree placement, tree type, tree nelts, tree init,
integer_one_node,
complain),
init,
- explicit_default_init_p,
+ explicit_value_init_p,
/*from_array=*/0,
complain);
@@ -2179,17 +2192,19 @@ build_new_1 (tree placement, tree type, tree nelts, tree init,
}
else
{
- if (init == void_zero_node)
- init = build_default_init (full_type, nelts);
-
- if (TYPE_NEEDS_CONSTRUCTING (type))
+ if (TYPE_NEEDS_CONSTRUCTING (type) && !explicit_value_init_p)
{
init_expr = build_special_member_call (init_expr,
complete_ctor_identifier,
init, elt_type,
LOOKUP_NORMAL,
complain);
- stable = stabilize_init (init_expr, &init_preeval_expr);
+ }
+ else if (explicit_value_init_p)
+ {
+ /* Something like `new int()'. */
+ init_expr = build2 (INIT_EXPR, full_type,
+ init_expr, build_value_init (full_type));
}
else
{
@@ -2205,8 +2220,8 @@ build_new_1 (tree placement, tree type, tree nelts, tree init,
init_expr = cp_build_modify_expr (init_expr, INIT_EXPR, init,
complain);
- stable = stabilize_init (init_expr, &init_preeval_expr);
}
+ stable = stabilize_init (init_expr, &init_preeval_expr);
}
if (init_expr == error_mark_node)
@@ -2228,11 +2243,13 @@ build_new_1 (tree placement, tree type, tree nelts, tree init,
/* The Standard is unclear here, but the right thing to do
is to use the same method for finding deallocation
functions that we use for finding allocation functions. */
- cleanup = build_op_delete_call (dcode, alloc_node, size,
- globally_qualified_p,
- (placement_allocation_fn_p
- ? alloc_call : NULL_TREE),
- alloc_fn);
+ cleanup = (build_op_delete_call
+ (dcode,
+ fold_convert (full_pointer_type, alloc_node),
+ size,
+ globally_qualified_p,
+ placement_allocation_fn_p ? alloc_call : NULL_TREE,
+ alloc_fn));
if (!cleanup)
/* We're done. */;
@@ -2287,7 +2304,7 @@ build_new_1 (tree placement, tree type, tree nelts, tree init,
if (cookie_expr)
rval = build2 (COMPOUND_EXPR, TREE_TYPE (rval), cookie_expr, rval);
- if (rval == alloc_node)
+ if (rval == data_addr)
/* If we don't have an initializer or a cookie, strip the TARGET_EXPR
and return the call (which doesn't need to be adjusted). */
rval = TARGET_EXPR_INITIAL (alloc_expr);
@@ -2651,8 +2668,8 @@ get_temp_regvar (tree type, tree init)
INIT is the (possibly NULL) initializer.
- If EXPLICIT_DEFAULT_INIT_P is true, then INIT must be NULL. All
- elements in the array are default-initialized.
+ If EXPLICIT_VALUE_INIT_P is true, then INIT must be NULL. All
+ elements in the array are value-initialized.
FROM_ARRAY is 0 if we should init everything with INIT
(i.e., every element initialized from INIT).
@@ -2663,7 +2680,7 @@ get_temp_regvar (tree type, tree init)
tree
build_vec_init (tree base, tree maxindex, tree init,
- bool explicit_default_init_p,
+ bool explicit_value_init_p,
int from_array, tsubst_flags_t complain)
{
tree rval;
@@ -2693,7 +2710,7 @@ build_vec_init (tree base, tree maxindex, tree init,
if (maxindex == NULL_TREE || maxindex == error_mark_node)
return error_mark_node;
- if (explicit_default_init_p)
+ if (explicit_value_init_p)
gcc_assert (!init);
inner_elt_type = strip_array_types (atype);
@@ -2829,7 +2846,7 @@ build_vec_init (tree base, tree maxindex, tree init,
We do need to keep going if we're copying an array. */
if (from_array
- || ((TYPE_NEEDS_CONSTRUCTING (type) || explicit_default_init_p)
+ || ((TYPE_NEEDS_CONSTRUCTING (type) || explicit_value_init_p)
&& ! (host_integerp (maxindex, 0)
&& (num_initialized_elts
== tree_low_cst (maxindex, 0) + 1))))
@@ -2878,17 +2895,17 @@ build_vec_init (tree base, tree maxindex, tree init,
("cannot initialize multi-dimensional array with initializer");
elt_init = build_vec_init (build1 (INDIRECT_REF, type, base),
0, 0,
- /*explicit_default_init_p=*/false,
+ explicit_value_init_p,
0, complain);
}
- else if (!TYPE_NEEDS_CONSTRUCTING (type))
- elt_init = (cp_build_modify_expr
- (to, INIT_EXPR,
- build_zero_init (type, size_one_node,
- /*static_storage_p=*/false),
- complain));
+ else if (explicit_value_init_p)
+ elt_init = build2 (INIT_EXPR, type, to,
+ build_value_init (type));
else
- elt_init = build_aggr_init (to, init, 0, complain);
+ {
+ gcc_assert (TYPE_NEEDS_CONSTRUCTING (type));
+ elt_init = build_aggr_init (to, init, 0, complain);
+ }
current_stmt_tree ()->stmts_are_full_exprs_p = 1;
finish_expr_stmt (elt_init);
@@ -3018,12 +3035,14 @@ build_delete (tree type, tree addr, special_function_kind auto_delete,
complete_type (type);
if (!COMPLETE_TYPE_P (type))
{
- warning (0, "possible problem detected in invocation of "
- "delete operator:");
- cxx_incomplete_type_diagnostic (addr, type, 1);
- inform ("neither the destructor nor the class-specific "
- "operator delete will be called, even if they are "
- "declared when the class is defined.");
+ if (warning (0, "possible problem detected in invocation of "
+ "delete operator:"))
+ {
+ cxx_incomplete_type_diagnostic (addr, type, DK_WARNING);
+ inform ("neither the destructor nor the class-specific "
+ "operator delete will be called, even if they are "
+ "declared when the class is defined.");
+ }
complete_p = false;
}
}
@@ -3264,6 +3283,7 @@ build_vec_delete (tree base, tree maxindex,
{
/* Step back one from start of vector, and read dimension. */
tree cookie_addr;
+ tree size_ptr_type = build_pointer_type (sizetype);
if (TREE_SIDE_EFFECTS (base))
{
@@ -3273,8 +3293,8 @@ build_vec_delete (tree base, tree maxindex,
type = strip_array_types (TREE_TYPE (type));
cookie_addr = fold_build1 (NEGATE_EXPR, sizetype, TYPE_SIZE_UNIT (sizetype));
cookie_addr = build2 (POINTER_PLUS_EXPR,
- build_pointer_type (sizetype),
- base,
+ size_ptr_type,
+ fold_convert (size_ptr_type, base),
cookie_addr);
maxindex = cp_build_indirect_ref (cookie_addr, NULL, tf_warning_or_error);
}
diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c
index ee2f2a80706..2c169d1bd76 100644
--- a/gcc/cp/lex.c
+++ b/gcc/cp/lex.c
@@ -247,17 +247,6 @@ cxx_init (void)
cxx_init_decl_processing ();
- /* The fact that G++ uses COMDAT for many entities (inline
- functions, template instantiations, virtual tables, etc.) mean
- that it is fundamentally unreliable to try to make decisions
- about whether or not to output a particular entity until the end
- of the compilation. However, the inliner requires that functions
- be provided to the back end if they are to be inlined.
- Therefore, we always use unit-at-a-time mode; in that mode, we
- can provide entities to the back end and it will decide what to
- emit based on what is actually needed. */
- flag_unit_at_a_time = 1;
-
if (c_common_init () == false)
{
input_location = saved_loc;
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index b27b2db9b3a..0703d0a96f7 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -974,19 +974,19 @@ write_template_prefix (const tree node)
tree type = DECL_P (node) ? TREE_TYPE (node) : node;
tree context = CP_DECL_CONTEXT (decl);
tree template_info;
- tree template;
+ tree templ;
tree substitution;
MANGLE_TRACE_TREE ("template-prefix", node);
/* Find the template decl. */
if (decl_is_template_id (decl, &template_info))
- template = TI_TEMPLATE (template_info);
+ templ = TI_TEMPLATE (template_info);
else
{
gcc_assert (CLASSTYPE_TEMPLATE_ID_P (type));
- template = TYPE_TI_TEMPLATE (type);
+ templ = TYPE_TI_TEMPLATE (type);
}
/* For a member template, though, the template name for the
@@ -1012,21 +1012,21 @@ write_template_prefix (const tree node)
substitution candidate by a TREE_LIST whose purpose is `Outer<int>'
and whose value is `Outer<T>::Inner<U>'. */
if (TYPE_P (context))
- substitution = build_tree_list (context, template);
+ substitution = build_tree_list (context, templ);
else
- substitution = template;
+ substitution = templ;
if (find_substitution (substitution))
return;
/* In G++ 3.2, the name of the template template parameter was used. */
- if (TREE_CODE (TREE_TYPE (template)) == TEMPLATE_TEMPLATE_PARM
+ if (TREE_CODE (TREE_TYPE (templ)) == TEMPLATE_TEMPLATE_PARM
&& !abi_version_at_least (2))
G.need_abi_warning = true;
- if (TREE_CODE (TREE_TYPE (template)) == TEMPLATE_TEMPLATE_PARM
+ if (TREE_CODE (TREE_TYPE (templ)) == TEMPLATE_TEMPLATE_PARM
&& abi_version_at_least (2))
- write_template_param (TREE_TYPE (template));
+ write_template_param (TREE_TYPE (templ));
else
{
write_prefix (context);
@@ -1056,7 +1056,10 @@ write_unqualified_name (const tree decl)
else if (DECL_LANG_SPECIFIC (decl) != NULL && DECL_DESTRUCTOR_P (decl))
write_special_name_destructor (decl);
else if (DECL_NAME (decl) == NULL_TREE)
- write_source_name (DECL_ASSEMBLER_NAME (decl));
+ {
+ gcc_assert (DECL_ASSEMBLER_NAME_SET_P (decl));
+ write_source_name (DECL_ASSEMBLER_NAME (decl));
+ }
else if (DECL_CONV_FN_P (decl))
{
/* Conversion operator. Handle it right here.
@@ -2480,24 +2483,24 @@ write_template_param (const tree parm)
static void
write_template_template_param (const tree parm)
{
- tree template = NULL_TREE;
+ tree templ = NULL_TREE;
/* PARM, a TEMPLATE_TEMPLATE_PARM, is an instantiation of the
template template parameter. The substitution candidate here is
only the template. */
if (TREE_CODE (parm) == BOUND_TEMPLATE_TEMPLATE_PARM)
{
- template
+ templ
= TI_TEMPLATE (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (parm));
- if (find_substitution (template))
+ if (find_substitution (templ))
return;
}
/* <template-param> encodes only the template parameter position,
not its template arguments, which is fine here. */
write_template_param (parm);
- if (template)
- add_substitution (template);
+ if (templ)
+ add_substitution (templ);
}
/* Non-terminal <substitution>.
diff --git a/gcc/cp/method.c b/gcc/cp/method.c
index bd63d0cba52..b215d2a3936 100644
--- a/gcc/cp/method.c
+++ b/gcc/cp/method.c
@@ -155,7 +155,6 @@ make_thunk (tree function, bool this_adjusting,
DECL_NO_STATIC_CHAIN (thunk) = 1;
/* The THUNK is not a pending inline, even if the FUNCTION is. */
DECL_PENDING_INLINE_P (thunk) = 0;
- DECL_INLINE (thunk) = 0;
DECL_DECLARED_INLINE_P (thunk) = 0;
/* Nor has it been deferred. */
DECL_DEFERRED_FN (thunk) = 0;
@@ -281,7 +280,6 @@ make_alias_for (tree function, tree newid)
DECL_ARTIFICIAL (alias) = 1;
DECL_NO_STATIC_CHAIN (alias) = 1;
DECL_PENDING_INLINE_P (alias) = 0;
- DECL_INLINE (alias) = 0;
DECL_DECLARED_INLINE_P (alias) = 0;
DECL_DEFERRED_FN (alias) = 0;
DECL_USE_TEMPLATE (alias) = 0;
@@ -1108,9 +1106,9 @@ implicitly_declare_fn (special_function_kind kind, tree type, bool const_p)
rest_of_decl_compilation (fn, toplevel_bindings_p (), at_eof);
DECL_IN_AGGR_P (fn) = 1;
DECL_ARTIFICIAL (fn) = 1;
+ DECL_DEFAULTED_FN (fn) = 1;
DECL_NOT_REALLY_EXTERN (fn) = 1;
DECL_DECLARED_INLINE_P (fn) = 1;
- DECL_INLINE (fn) = 1;
gcc_assert (!TREE_USED (fn));
/* Restore PROCESSING_TEMPLATE_DECL. */
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index e42f60afba7..60050b8f339 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -50,6 +50,7 @@ static bool qualified_lookup_using_namespace (tree, tree,
struct scope_binding *, int);
static tree lookup_type_current_level (tree);
static tree push_using_directive (tree);
+static cxx_binding* lookup_extern_c_fun_binding_in_all_ns (tree);
/* The :: namespace. */
@@ -130,7 +131,7 @@ struct binding_table_s GTY(())
binding_entry * GTY((length ("%h.chain_count"))) chain;
/* The number of chains in this table. This is the length of the
- the member "chain" considered as an array. */
+ member "chain" considered as an array. */
size_t chain_count;
/* Number of "binding_entry"s in this table. */
@@ -723,10 +724,10 @@ pushdecl_maybe_friend (tree x, bool is_friend)
/* Don't do anything just yet. */;
else if (t == wchar_decl_node)
{
- if (pedantic && ! DECL_IN_SYSTEM_HEADER (x))
- pedwarn ("redeclaration of %<wchar_t%> as %qT",
+ if (! DECL_IN_SYSTEM_HEADER (x))
+ pedwarn (OPT_pedantic, "redeclaration of %<wchar_t%> as %qT",
TREE_TYPE (x));
-
+
/* Throw away the redeclaration. */
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, t);
}
@@ -763,6 +764,49 @@ pushdecl_maybe_friend (tree x, bool is_friend)
}
}
+ /* If x has C linkage-specification, (extern "C"),
+ lookup its binding, in case it's already bound to an object.
+ The lookup is done in all namespaces.
+ If we find an existing binding, make sure it has the same
+ exception specification as x, otherwise, bail in error [7.5, 7.6]. */
+ if ((TREE_CODE (x) == FUNCTION_DECL)
+ && DECL_EXTERN_C_P (x)
+ /* We should ignore declarations happening in system headers. */
+ && !DECL_IN_SYSTEM_HEADER (x))
+ {
+ cxx_binding *function_binding =
+ lookup_extern_c_fun_binding_in_all_ns (x);
+ if (function_binding
+ && !DECL_IN_SYSTEM_HEADER (function_binding->value))
+ {
+ tree previous = function_binding->value;
+
+ /* In case either x or previous is declared to throw an exception,
+ make sure both exception specifications are equal. */
+ if (decls_match (x, previous))
+ {
+ tree x_exception_spec = NULL_TREE;
+ tree previous_exception_spec = NULL_TREE;
+
+ x_exception_spec =
+ TYPE_RAISES_EXCEPTIONS (TREE_TYPE (x));
+ previous_exception_spec =
+ TYPE_RAISES_EXCEPTIONS (TREE_TYPE (previous));
+ if (!comp_except_specs (previous_exception_spec,
+ x_exception_spec,
+ true))
+ {
+ pedwarn (0, "declaration of %q#D with C language linkage",
+ x);
+ pedwarn (0, "conflicts with previous declaration %q+#D",
+ previous);
+ pedwarn (0, "due to different exception specifications");
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
+ }
+ }
+ }
+ }
+
if (TREE_CODE (x) == FUNCTION_DECL || DECL_FUNCTION_TEMPLATE_P (x))
check_default_args (x);
@@ -1831,6 +1875,39 @@ binding_for_name (cxx_scope *scope, tree name)
return result;
}
+/* Walk through the bindings associated to the name of FUNCTION,
+ and return the first binding that declares a function with a
+ "C" linkage specification, a.k.a 'extern "C"'.
+ This function looks for the binding, regardless of which scope it
+ has been defined in. It basically looks in all the known scopes.
+ Note that this function does not lookup for bindings of builtin functions
+ or for functions declared in system headers. */
+static cxx_binding*
+lookup_extern_c_fun_binding_in_all_ns (tree function)
+{
+ tree name;
+ cxx_binding *iter;
+
+ gcc_assert (function && TREE_CODE (function) == FUNCTION_DECL);
+
+ name = DECL_NAME (function);
+ gcc_assert (name && TREE_CODE (name) == IDENTIFIER_NODE);
+
+ for (iter = IDENTIFIER_NAMESPACE_BINDINGS (name);
+ iter;
+ iter = iter->previous)
+ {
+ if (iter->value
+ && TREE_CODE (iter->value) == FUNCTION_DECL
+ && DECL_EXTERN_C_P (iter->value)
+ && !DECL_ARTIFICIAL (iter->value))
+ {
+ return iter;
+ }
+ }
+ return NULL;
+}
+
/* Insert another USING_DECL into the current binding level, returning
this declaration. If this is a redeclaration, do nothing, and
return NULL_TREE if this not in namespace scope (in namespace
@@ -2676,7 +2753,8 @@ push_class_level_binding (tree name, tree x)
&& TREE_TYPE (decl) == error_mark_node)
decl = TREE_VALUE (decl);
- check_template_shadow (decl);
+ if (!check_template_shadow (decl))
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, false);
/* [class.mem]
@@ -3234,18 +3312,18 @@ namespace_ancestor (tree ns1, tree ns2)
/* Process a namespace-alias declaration. */
void
-do_namespace_alias (tree alias, tree namespace)
+do_namespace_alias (tree alias, tree name_space)
{
- if (namespace == error_mark_node)
+ if (name_space == error_mark_node)
return;
- gcc_assert (TREE_CODE (namespace) == NAMESPACE_DECL);
+ gcc_assert (TREE_CODE (name_space) == NAMESPACE_DECL);
- namespace = ORIGINAL_NAMESPACE (namespace);
+ name_space = ORIGINAL_NAMESPACE (name_space);
/* Build the alias. */
alias = build_lang_decl (NAMESPACE_DECL, alias, void_type_node);
- DECL_NAMESPACE_ALIAS (alias) = namespace;
+ DECL_NAMESPACE_ALIAS (alias) = name_space;
DECL_EXTERNAL (alias) = 1;
DECL_CONTEXT (alias) = FROB_CONTEXT (current_scope ());
pushdecl (alias);
@@ -3383,46 +3461,46 @@ do_toplevel_using_decl (tree decl, tree scope, tree name)
/* Process a using-directive. */
void
-do_using_directive (tree namespace)
+do_using_directive (tree name_space)
{
tree context = NULL_TREE;
- if (namespace == error_mark_node)
+ if (name_space == error_mark_node)
return;
- gcc_assert (TREE_CODE (namespace) == NAMESPACE_DECL);
+ gcc_assert (TREE_CODE (name_space) == NAMESPACE_DECL);
if (building_stmt_tree ())
- add_stmt (build_stmt (USING_STMT, namespace));
- namespace = ORIGINAL_NAMESPACE (namespace);
+ add_stmt (build_stmt (USING_STMT, name_space));
+ name_space = ORIGINAL_NAMESPACE (name_space);
if (!toplevel_bindings_p ())
{
- push_using_directive (namespace);
+ push_using_directive (name_space);
context = current_scope ();
}
else
{
/* direct usage */
- add_using_namespace (current_namespace, namespace, 0);
+ add_using_namespace (current_namespace, name_space, 0);
if (current_namespace != global_namespace)
context = current_namespace;
}
/* Emit debugging info. */
if (!processing_template_decl)
- (*debug_hooks->imported_module_or_decl) (namespace, context);
+ (*debug_hooks->imported_module_or_decl) (name_space, context);
}
/* Deal with a using-directive seen by the parser. Currently we only
handle attributes here, since they cannot appear inside a template. */
void
-parse_using_directive (tree namespace, tree attribs)
+parse_using_directive (tree name_space, tree attribs)
{
tree a;
- do_using_directive (namespace);
+ do_using_directive (name_space);
for (a = attribs; a; a = TREE_CHAIN (a))
{
@@ -3431,14 +3509,14 @@ parse_using_directive (tree namespace, tree attribs)
{
if (!toplevel_bindings_p ())
error ("strong using only meaningful at namespace scope");
- else if (namespace != error_mark_node)
+ else if (name_space != error_mark_node)
{
- if (!is_ancestor (current_namespace, namespace))
+ if (!is_ancestor (current_namespace, name_space))
error ("current namespace %qD does not enclose strongly used namespace %qD",
- current_namespace, namespace);
- DECL_NAMESPACE_ASSOCIATIONS (namespace)
+ current_namespace, name_space);
+ DECL_NAMESPACE_ASSOCIATIONS (name_space)
= tree_cons (current_namespace, 0,
- DECL_NAMESPACE_ASSOCIATIONS (namespace));
+ DECL_NAMESPACE_ASSOCIATIONS (name_space));
}
}
else
@@ -3527,25 +3605,25 @@ merge_functions (tree s1, tree s2)
/* This should return an error not all definitions define functions.
It is not an error if we find two functions with exactly the
same signature, only if these are selected in overload resolution.
- old is the current set of bindings, new the freshly-found binding.
+ old is the current set of bindings, new_binding the freshly-found binding.
XXX Do we want to give *all* candidates in case of ambiguity?
XXX In what way should I treat extern declarations?
XXX I don't want to repeat the entire duplicate_decls here */
static void
-ambiguous_decl (struct scope_binding *old, cxx_binding *new, int flags)
+ambiguous_decl (struct scope_binding *old, cxx_binding *new_binding, int flags)
{
tree val, type;
gcc_assert (old != NULL);
/* Copy the type. */
- type = new->type;
+ type = new_binding->type;
if (LOOKUP_NAMESPACES_ONLY (flags)
|| (type && hidden_name_p (type) && !(flags & LOOKUP_HIDDEN)))
type = NULL_TREE;
/* Copy the value. */
- val = new->value;
+ val = new_binding->value;
if (val)
{
if (hidden_name_p (val) && !(flags & LOOKUP_HIDDEN))
@@ -4696,21 +4774,21 @@ arg_assoc (struct arg_lookup *k, tree n)
If T is a template-id, its associated namespaces and classes
are the namespace in which the template is defined; for
member templates, the member template's class... */
- tree template = TREE_OPERAND (n, 0);
+ tree templ = TREE_OPERAND (n, 0);
tree args = TREE_OPERAND (n, 1);
tree ctx;
int ix;
- if (TREE_CODE (template) == COMPONENT_REF)
- template = TREE_OPERAND (template, 1);
+ if (TREE_CODE (templ) == COMPONENT_REF)
+ templ = TREE_OPERAND (templ, 1);
/* First, the template. There may actually be more than one if
this is an overloaded function template. But, in that case,
we only need the first; all the functions will be in the same
namespace. */
- template = OVL_CURRENT (template);
+ templ = OVL_CURRENT (templ);
- ctx = CP_DECL_CONTEXT (template);
+ ctx = CP_DECL_CONTEXT (templ);
if (TREE_CODE (ctx) == NAMESPACE_DECL)
{
diff --git a/gcc/cp/operators.def b/gcc/cp/operators.def
index 6c24ba19251..9c2dd8b2ca1 100644
--- a/gcc/cp/operators.def
+++ b/gcc/cp/operators.def
@@ -5,7 +5,7 @@
non-overloadable operators (like the `?:' ternary operator).
Written by Mark Mitchell <mark@codesourcery.com>
- Copyright (C) 2000, 2001, 2002, 2003, 2005, 2007
+ Copyright (C) 2000, 2001, 2002, 2003, 2005, 2007, 2008
Free Software Foundation, Inc.
This file is part of GCC.
@@ -56,7 +56,7 @@ along with GCC; see the file COPYING3. If not see
A boolean value. If nonzero, this is an assignment operator.
- Before including this file, you should define DEFOPERATOR
+ Before including this file, you should define DEF_OPERATOR
to take these arguments.
There is code (such as in grok_op_properties) that depends on the
diff --git a/gcc/cp/optimize.c b/gcc/cp/optimize.c
index a91f8d5f564..8c7b9e82ccb 100644
--- a/gcc/cp/optimize.c
+++ b/gcc/cp/optimize.c
@@ -1,5 +1,5 @@
/* Perform optimizations on tree structure.
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2007
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2007, 2008
Free Software Foundation, Inc.
Written by Mark Michell (mark@codesourcery.com).
@@ -40,7 +40,7 @@ along with GCC; see the file COPYING3. If not see
#include "langhooks.h"
#include "diagnostic.h"
#include "tree-dump.h"
-#include "tree-gimple.h"
+#include "gimple.h"
/* Prototypes. */
@@ -72,35 +72,40 @@ update_cloned_parm (tree parm, tree cloned_parm, bool first)
DECL_GIMPLE_REG_P (cloned_parm) = DECL_GIMPLE_REG_P (parm);
}
-/* FN is a function that has a complete body, and CLONE is a function whose
- body is to be set to a copy of FN, mapping argument declarations according
- to the ARG_MAP splay_tree. */
+
+/* FN is a function in High GIMPLE form that has a complete body and no
+ CFG. CLONE is a function whose body is to be set to a copy of FN,
+ mapping argument declarations according to the ARG_MAP splay_tree. */
static void
clone_body (tree clone, tree fn, void *arg_map)
{
copy_body_data id;
+ gimple_seq new_body;
+
+ /* FN must already be in GIMPLE form. */
+ gcc_assert (gimple_body (fn));
- /* Clone the body, as if we were making an inline call. But, remap the
- parameters in the callee to the parameters of caller. */
+ /* Clone the body, as if we were making an inline call. But, remap
+ the parameters in the callee to the parameters of caller. */
memset (&id, 0, sizeof (id));
id.src_fn = fn;
id.dst_fn = clone;
id.src_cfun = DECL_STRUCT_FUNCTION (fn);
- id.decl_map = (struct pointer_map_t *)arg_map;
+ id.decl_map = (struct pointer_map_t *) arg_map;
id.copy_decl = copy_decl_no_change;
id.transform_call_graph_edges = CB_CGE_DUPLICATE;
id.transform_new_cfg = true;
id.transform_return_to_modify = false;
- id.transform_lang_insert_block = insert_block;
+ id.transform_lang_insert_block = NULL;
/* We're not inside any EH region. */
id.eh_region = -1;
/* Actually copy the body. */
- append_to_statement_list_force (copy_generic_body (&id),
- &DECL_SAVED_TREE (clone));
+ new_body = remap_gimple_seq (gimple_body (fn), &id);
+ gimple_set_body (clone, new_body);
}
/* FN is a function that has a complete body. Clone the body as
@@ -133,7 +138,6 @@ maybe_clone_body (tree fn)
/* Update CLONE's source position information to match FN's. */
DECL_SOURCE_LOCATION (clone) = DECL_SOURCE_LOCATION (fn);
- DECL_INLINE (clone) = DECL_INLINE (fn);
DECL_DECLARED_INLINE_P (clone) = DECL_DECLARED_INLINE_P (fn);
DECL_COMDAT (clone) = DECL_COMDAT (fn);
DECL_WEAK (clone) = DECL_WEAK (fn);
@@ -228,6 +232,7 @@ maybe_clone_body (tree fn)
/* Now, expand this function into RTL, if appropriate. */
finish_function (0);
BLOCK_ABSTRACT_ORIGIN (DECL_INITIAL (clone)) = DECL_INITIAL (fn);
+ DECL_SAVED_TREE (clone) = NULL;
expand_or_defer_fn (clone);
first = false;
}
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 567f04eea96..fd4e1bbbe7b 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -71,8 +71,6 @@ typedef struct cp_token GTY (())
unsigned char flags;
/* Identifier for the pragma. */
ENUM_BITFIELD (pragma_kind) pragma_kind : 6;
- /* True if this token is from a system header. */
- BOOL_BITFIELD in_system_header : 1;
/* True if this token is from a context where it is implicitly extern "C" */
BOOL_BITFIELD implicit_extern_c : 1;
/* True for a CPP_NAME token that is not a keyword (i.e., for which
@@ -97,7 +95,7 @@ DEF_VEC_ALLOC_P (cp_token_position,heap);
static cp_token eof_token =
{
- CPP_EOF, RID_MAX, 0, PRAGMA_NONE, 0, false, 0, { NULL },
+ CPP_EOF, RID_MAX, 0, PRAGMA_NONE, false, 0, { NULL },
0
};
@@ -408,7 +406,6 @@ cp_lexer_get_preprocessor_token (cp_lexer *lexer, cp_token *token)
lexer == NULL ? 0 : C_LEX_RAW_STRINGS);
token->keyword = RID_MAX;
token->pragma_kind = PRAGMA_NONE;
- token->in_system_header = in_system_header;
/* On some systems, some header files are surrounded by an
implicit extern "C" block. Set a flag in the token if it
@@ -478,15 +475,13 @@ cp_lexer_get_preprocessor_token (cp_lexer *lexer, cp_token *token)
}
}
-/* Update the globals input_location and in_system_header and the
- input file stack from TOKEN. */
+/* Update the globals input_location and the input file stack from TOKEN. */
static inline void
cp_lexer_set_source_position_from_token (cp_token *token)
{
if (token->type != CPP_EOF)
{
input_location = token->location;
- in_system_header = token->in_system_header;
}
}
@@ -1377,7 +1372,7 @@ cp_parser_context_new (cp_parser_context* next)
/* No errors have occurred yet in this context. */
context->status = CP_PARSER_STATUS_KIND_NO_ERROR;
- /* If this is not the bottomost context, copy information that we
+ /* If this is not the bottommost context, copy information that we
need from the previous context. */
if (next)
{
@@ -2167,7 +2162,8 @@ cp_parser_check_decl_spec (cp_decl_specifier_seq *decl_specs,
error ("%H%<long long long%> is too long for GCC", &location);
else if (pedantic && !in_system_header && warn_long_long
&& cxx_dialect == cxx98)
- pedwarn ("%HISO C++ 1998 does not support %<long long%>",
+ pedwarn (OPT_Wlong_long,
+ "%HISO C++ 1998 does not support %<long long%>",
&location);
}
else if (count > 1)
@@ -3219,9 +3215,9 @@ cp_parser_primary_expression (cp_parser *parser,
&& cp_lexer_next_token_is (parser->lexer, CPP_OPEN_BRACE))
{
/* Statement-expressions are not allowed by the standard. */
- if (pedantic)
- pedwarn ("%HISO C++ forbids braced-groups within expressions",
- &token->location);
+ pedwarn (OPT_pedantic,
+ "%HISO C++ forbids braced-groups within expressions",
+ &token->location);
/* And they're not allowed outside of a function-body; you
cannot, for example, write:
@@ -4550,8 +4546,7 @@ cp_parser_postfix_expression (cp_parser *parser, bool address_p, bool cast_p,
{
/* Warn the user that a compound literal is not
allowed in standard C++. */
- if (pedantic)
- pedwarn ("ISO C++ forbids compound-literals");
+ pedwarn (OPT_pedantic, "ISO C++ forbids compound-literals");
/* For simplicity, we disallow compound literals in
constant-expressions. We could
allow compound literals of integer type, whose
@@ -6324,7 +6319,7 @@ cp_parser_assignment_operator_opt (cp_parser* parser)
enum tree_code op;
cp_token *token;
- /* Peek at the next toen. */
+ /* Peek at the next token. */
token = cp_lexer_peek_token (parser->lexer);
switch (token->type)
@@ -7615,8 +7610,7 @@ cp_parser_jump_statement (cp_parser* parser)
if (cp_lexer_next_token_is (parser->lexer, CPP_MULT))
{
/* Issue a warning about this use of a GNU extension. */
- if (pedantic)
- pedwarn ("%HISO C++ forbids computed gotos", &token->location);
+ pedwarn (OPT_pedantic, "%HISO C++ forbids computed gotos", &token->location);
/* Consume the '*' token. */
cp_lexer_consume_token (parser->lexer);
/* Parse the dependent expression. */
@@ -7755,8 +7749,8 @@ cp_parser_declaration_seq_opt (cp_parser* parser)
/* A declaration consisting of a single semicolon is
invalid. Allow it unless we're being pedantic. */
cp_lexer_consume_token (parser->lexer);
- if (pedantic && !in_system_header)
- pedwarn ("extra %<;%>");
+ if (!in_system_header)
+ pedwarn (OPT_pedantic, "extra %<;%>");
continue;
}
@@ -9890,7 +9884,7 @@ cp_parser_template_id (cp_parser *parser,
bool is_declaration)
{
int i;
- tree template;
+ tree templ;
tree arguments;
tree template_id;
cp_token_position start_of_id = 0;
@@ -9945,14 +9939,14 @@ cp_parser_template_id (cp_parser *parser,
/* Parse the template-name. */
is_identifier = false;
token = cp_lexer_peek_token (parser->lexer);
- template = cp_parser_template_name (parser, template_keyword_p,
- check_dependency_p,
- is_declaration,
- &is_identifier);
- if (template == error_mark_node || is_identifier)
+ templ = cp_parser_template_name (parser, template_keyword_p,
+ check_dependency_p,
+ is_declaration,
+ &is_identifier);
+ if (templ == error_mark_node || is_identifier)
{
pop_deferring_access_checks ();
- return template;
+ return templ;
}
/* If we find the sequence `[:' after a template-name, it's probably
@@ -9986,15 +9980,14 @@ cp_parser_template_id (cp_parser *parser,
}
/* Otherwise, emit an error about the invalid digraph, but continue
parsing because we got our argument list. */
- permerror ("%H%<<::%> cannot begin a template-argument list",
- &next_token->location);
- inform ("%H%<<:%> is an alternate spelling for %<[%>. Insert whitespace "
+ if (permerror ("%H%<<::%> cannot begin a template-argument list",
+ &next_token->location))
+ {
+ static bool hint = false;
+ inform ("%H%<<:%> is an alternate spelling for %<[%>. Insert whitespace "
"between %<<%> and %<::%>",
&next_token->location);
- if (!flag_permissive)
- {
- static bool hint;
- if (!hint)
+ if (!hint && !flag_permissive)
{
inform ("%H(if you use %<-fpermissive%> G++ will accept your code)",
&next_token->location);
@@ -10015,10 +10008,10 @@ cp_parser_template_id (cp_parser *parser,
}
/* Build a representation of the specialization. */
- if (TREE_CODE (template) == IDENTIFIER_NODE)
- template_id = build_min_nt (TEMPLATE_ID_EXPR, template, arguments);
- else if (DECL_CLASS_TEMPLATE_P (template)
- || DECL_TEMPLATE_TEMPLATE_PARM_P (template))
+ if (TREE_CODE (templ) == IDENTIFIER_NODE)
+ template_id = build_min_nt (TEMPLATE_ID_EXPR, templ, arguments);
+ else if (DECL_CLASS_TEMPLATE_P (templ)
+ || DECL_TEMPLATE_TEMPLATE_PARM_P (templ))
{
bool entering_scope;
/* In "template <typename T> ... A<T>::", A<T> is the abstract A
@@ -10030,17 +10023,17 @@ cp_parser_template_id (cp_parser *parser,
&& cp_lexer_next_token_is (parser->lexer,
CPP_SCOPE));
template_id
- = finish_template_type (template, arguments, entering_scope);
+ = finish_template_type (templ, arguments, entering_scope);
}
else
{
/* If it's not a class-template or a template-template, it should be
a function-template. */
- gcc_assert ((DECL_FUNCTION_TEMPLATE_P (template)
- || TREE_CODE (template) == OVERLOAD
- || BASELINK_P (template)));
+ gcc_assert ((DECL_FUNCTION_TEMPLATE_P (templ)
+ || TREE_CODE (templ) == OVERLOAD
+ || BASELINK_P (templ)));
- template_id = lookup_template_function (template, arguments);
+ template_id = lookup_template_function (templ, arguments);
}
/* If parsing tentatively, replace the sequence of tokens that makes
@@ -10392,9 +10385,10 @@ cp_parser_template_argument (cp_parser* parser)
Therefore, we try a type-id first. */
cp_parser_parse_tentatively (parser);
argument = cp_parser_type_id (parser);
- /* If there was no error parsing the type-id but the next token is a '>>',
- we probably found a typo for '> >'. But there are type-id which are
- also valid expressions. For instance:
+ /* If there was no error parsing the type-id but the next token is a
+ '>>', our behavior depends on which dialect of C++ we're
+ parsing. In C++98, we probably found a typo for '> >'. But there
+ are type-id which are also valid expressions. For instance:
struct X { int operator >> (int); };
template <int V> struct Foo {};
@@ -10403,8 +10397,12 @@ cp_parser_template_argument (cp_parser* parser)
Here 'X()' is a valid type-id of a function type, but the user just
wanted to write the expression "X() >> 5". Thus, we remember that we
found a valid type-id, but we still try to parse the argument as an
- expression to see what happens. */
+ expression to see what happens.
+
+ In C++0x, the '>>' will be considered two separate '>'
+ tokens. */
if (!cp_parser_error_occurred (parser)
+ && cxx_dialect == cxx98
&& cp_lexer_next_token_is (parser->lexer, CPP_RSHIFT))
{
maybe_type_id = true;
@@ -10473,7 +10471,7 @@ cp_parser_template_argument (cp_parser* parser)
{
cp_parser_parse_tentatively (parser);
argument = cp_parser_primary_expression (parser,
- /*adress_p=*/false,
+ /*address_p=*/false,
/*cast_p=*/false,
/*template_arg_p=*/true,
&idk);
@@ -11522,7 +11520,7 @@ cp_parser_elaborated_type_specifier (cp_parser* parser,
caught elsewhere in parsing. Those that are pointless arrive
here. */
- if (cp_parser_declares_only_class_p (parser)
+ if (cp_lexer_next_token_is (parser->lexer, CPP_SEMICOLON)
&& !is_friend && !processing_explicit_instantiation)
warning (0, "declaration %qD does not declare anything", decl);
@@ -11739,8 +11737,8 @@ cp_parser_enumerator_list (cp_parser* parser, tree type)
/* If the next token is a `}', there is a trailing comma. */
if (cp_lexer_next_token_is (parser->lexer, CPP_CLOSE_BRACE))
{
- if (pedantic && !in_system_header)
- pedwarn ("comma at end of enumerator list");
+ if (!in_system_header)
+ pedwarn (OPT_pedantic, "comma at end of enumerator list");
break;
}
}
@@ -11901,14 +11899,14 @@ cp_parser_namespace_definition (cp_parser* parser)
followed by a strong using directive. */
if (is_inline)
{
- tree namespace = current_namespace;
+ tree name_space = current_namespace;
/* Set up namespace association. */
- DECL_NAMESPACE_ASSOCIATIONS (namespace)
- = tree_cons (CP_DECL_CONTEXT (namespace), NULL_TREE,
- DECL_NAMESPACE_ASSOCIATIONS (namespace));
+ DECL_NAMESPACE_ASSOCIATIONS (name_space)
+ = tree_cons (CP_DECL_CONTEXT (name_space), NULL_TREE,
+ DECL_NAMESPACE_ASSOCIATIONS (name_space));
/* Import the contents of the inline namespace. */
pop_namespace ();
- do_using_directive (namespace);
+ do_using_directive (name_space);
push_namespace (identifier);
}
@@ -12384,7 +12382,7 @@ cp_parser_init_declarator (cp_parser* parser,
tree initializer;
tree decl = NULL_TREE;
tree scope;
- bool is_initialized;
+ int is_initialized;
/* Only valid if IS_INITIALIZED is true. In that case, CPP_EQ if
initialized with "= ..", CPP_OPEN_PAREN if initialized with
"(...)". */
@@ -12520,8 +12518,18 @@ cp_parser_init_declarator (cp_parser* parser,
|| token->type == CPP_OPEN_PAREN
|| token->type == CPP_OPEN_BRACE)
{
- is_initialized = true;
+ is_initialized = 1;
initialization_kind = token->type;
+
+ if (token->type == CPP_EQ
+ && function_declarator_p (declarator))
+ {
+ cp_token *t2 = cp_lexer_peek_nth_token (parser->lexer, 2);
+ if (t2->keyword == RID_DEFAULT)
+ is_initialized = 2;
+ else if (t2->keyword == RID_DELETE)
+ is_initialized = 3;
+ }
}
else
{
@@ -12533,7 +12541,7 @@ cp_parser_init_declarator (cp_parser* parser,
cp_parser_error (parser, "expected initializer");
return error_mark_node;
}
- is_initialized = false;
+ is_initialized = 0;
initialization_kind = CPP_EOF;
}
@@ -12591,7 +12599,7 @@ cp_parser_init_declarator (cp_parser* parser,
cp_parser_perform_template_parameter_access_checks (checks);
/* Perform the access control checks for the declarator and the
- the decl-specifiers. */
+ decl-specifiers. */
perform_deferred_access_checks ();
/* Restore the saved value. */
@@ -12868,7 +12876,7 @@ cp_parser_direct_declarator (cp_parser* parser,
int i (3);
The first is the declaration of a function while the
- second is a the definition of a variable, including its
+ second is the definition of a variable, including its
initializer.
Having seen only the parenthesis, we cannot know which of
@@ -14374,8 +14382,8 @@ cp_parser_initializer_list (cp_parser* parser, bool* non_constant_p)
&& cp_lexer_peek_nth_token (parser->lexer, 2)->type == CPP_COLON)
{
/* Warn the user that they are using an extension. */
- if (pedantic)
- pedwarn ("ISO C++ does not allow designated initializers");
+ pedwarn (OPT_pedantic,
+ "ISO C++ does not allow designated initializers");
/* Consume the identifier. */
identifier = cp_lexer_consume_token (parser->lexer)->u.value;
/* Consume the `:'. */
@@ -14973,11 +14981,17 @@ cp_parser_class_head (cp_parser* parser,
cp_parser_commit_to_tentative_parse (parser);
/* Issue the error about the overly-qualified name now. */
if (qualified_p)
- cp_parser_error (parser,
- "global qualification of class name is invalid");
+ {
+ cp_parser_error (parser,
+ "global qualification of class name is invalid");
+ return error_mark_node;
+ }
else if (invalid_nested_name_p)
- cp_parser_error (parser,
- "qualified name does not name a class");
+ {
+ cp_parser_error (parser,
+ "qualified name does not name a class");
+ return error_mark_node;
+ }
else if (nested_name_specifier)
{
tree scope;
@@ -15011,9 +15025,9 @@ cp_parser_class_head (cp_parser* parser,
}
/* [dcl.meaning]
- A declarator-id shall not be qualified exception of the
+ A declarator-id shall not be qualified except for the
definition of a ... nested class outside of its class
- ... [or] a the definition or explicit instantiation of a
+ ... [or] the definition or explicit instantiation of a
class member of a namespace outside of its namespace. */
if (scope == nested_name_specifier)
{
@@ -15391,8 +15405,8 @@ cp_parser_member_declaration (cp_parser* parser)
if (!decl_specifiers.any_specifiers_p)
{
cp_token *token = cp_lexer_peek_token (parser->lexer);
- if (pedantic && !token->in_system_header)
- pedwarn ("%Hextra %<;%>", &token->location);
+ if (!in_system_header_at (token->location))
+ pedwarn (OPT_pedantic, "%Hextra %<;%>", &token->location);
}
else
{
@@ -15687,6 +15701,15 @@ cp_parser_pure_specifier (cp_parser* parser)
return error_mark_node;
/* Look for the `0' token. */
token = cp_lexer_consume_token (parser->lexer);
+
+ /* Accept = default or = delete in c++0x mode. */
+ if (token->keyword == RID_DEFAULT
+ || token->keyword == RID_DELETE)
+ {
+ maybe_warn_cpp0x ("defaulted and deleted functions");
+ return token->u.value;
+ }
+
/* c_lex_with_flags marks a single digit '0' with PURE_ZERO. */
if (token->type != CPP_NUMBER || !(token->flags & PURE_ZERO))
{
@@ -19169,7 +19192,7 @@ cp_parser_objc_protocol_qualifiers (cp_parser* parser)
static tree
cp_parser_objc_typename (cp_parser* parser)
{
- tree typename = NULL_TREE;
+ tree type_name = NULL_TREE;
if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_PAREN))
{
@@ -19184,10 +19207,10 @@ cp_parser_objc_typename (cp_parser* parser)
cp_type = cp_parser_type_id (parser);
cp_parser_require (parser, CPP_CLOSE_PAREN, "%<)%>");
- typename = build_tree_list (proto_quals, cp_type);
+ type_name = build_tree_list (proto_quals, cp_type);
}
- return typename;
+ return type_name;
}
/* Check to see if TYPE refers to an Objective-C selector name. */
@@ -19244,7 +19267,7 @@ cp_parser_objc_method_keyword_params (cp_parser* parser)
while (cp_parser_objc_selector_p (token->type) || token->type == CPP_COLON)
{
- tree selector = NULL_TREE, typename, identifier;
+ tree selector = NULL_TREE, type_name, identifier;
if (token->type != CPP_COLON)
selector = cp_parser_objc_selector (parser);
@@ -19256,13 +19279,13 @@ cp_parser_objc_method_keyword_params (cp_parser* parser)
maybe_unary_selector_p = false;
cp_parser_require (parser, CPP_COLON, "%<:%>");
- typename = cp_parser_objc_typename (parser);
+ type_name = cp_parser_objc_typename (parser);
identifier = cp_parser_identifier (parser);
params
= chainon (params,
objc_build_keyword_decl (selector,
- typename,
+ type_name,
identifier));
token = cp_lexer_peek_token (parser->lexer);
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 1378e5618dc..4a9e571a70a 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -1022,10 +1022,10 @@ is_specialization_of (tree decl, tree tmpl)
}
/* Returns nonzero iff DECL is a specialization of friend declaration
- FRIEND according to [temp.friend]. */
+ FRIEND_DECL according to [temp.friend]. */
bool
-is_specialization_of_friend (tree decl, tree friend)
+is_specialization_of_friend (tree decl, tree friend_decl)
{
bool need_template = true;
int template_depth;
@@ -1033,26 +1033,26 @@ is_specialization_of_friend (tree decl, tree friend)
gcc_assert (TREE_CODE (decl) == FUNCTION_DECL
|| TREE_CODE (decl) == TYPE_DECL);
- /* For [temp.friend/6] when FRIEND is an ordinary member function
+ /* For [temp.friend/6] when FRIEND_DECL is an ordinary member function
of a template class, we want to check if DECL is a specialization
if this. */
- if (TREE_CODE (friend) == FUNCTION_DECL
- && DECL_TEMPLATE_INFO (friend)
- && !DECL_USE_TEMPLATE (friend))
+ if (TREE_CODE (friend_decl) == FUNCTION_DECL
+ && DECL_TEMPLATE_INFO (friend_decl)
+ && !DECL_USE_TEMPLATE (friend_decl))
{
/* We want a TEMPLATE_DECL for `is_specialization_of'. */
- friend = DECL_TI_TEMPLATE (friend);
+ friend_decl = DECL_TI_TEMPLATE (friend_decl);
need_template = false;
}
- else if (TREE_CODE (friend) == TEMPLATE_DECL
- && !PRIMARY_TEMPLATE_P (friend))
+ else if (TREE_CODE (friend_decl) == TEMPLATE_DECL
+ && !PRIMARY_TEMPLATE_P (friend_decl))
need_template = false;
/* There is nothing to do if this is not a template friend. */
- if (TREE_CODE (friend) != TEMPLATE_DECL)
+ if (TREE_CODE (friend_decl) != TEMPLATE_DECL)
return false;
- if (is_specialization_of (decl, friend))
+ if (is_specialization_of (decl, friend_decl))
return true;
/* [temp.friend/6]
@@ -1075,14 +1075,14 @@ is_specialization_of_friend (tree decl, tree friend)
nonzero. To determine if DECL is a friend of FRIEND, we first
check if the enclosing class is a specialization of another. */
- template_depth = template_class_depth (DECL_CONTEXT (friend));
+ template_depth = template_class_depth (DECL_CONTEXT (friend_decl));
if (template_depth
&& DECL_CLASS_SCOPE_P (decl)
&& is_specialization_of (TYPE_NAME (DECL_CONTEXT (decl)),
- CLASSTYPE_TI_TEMPLATE (DECL_CONTEXT (friend))))
+ CLASSTYPE_TI_TEMPLATE (DECL_CONTEXT (friend_decl))))
{
/* Next, we check the members themselves. In order to handle
- a few tricky cases, such as when FRIEND's are
+ a few tricky cases, such as when FRIEND_DECL's are
template <class T> friend void A<T>::g(T t);
template <class T> template <T t> friend void A<T>::h();
@@ -1122,7 +1122,7 @@ is_specialization_of_friend (tree decl, tree friend)
tree friend_args_type;
tree decl_args_type;
- /* Make sure that both DECL and FRIEND are templates or
+ /* Make sure that both DECL and FRIEND_DECL are templates or
non-templates. */
is_template = DECL_TEMPLATE_INFO (decl)
&& PRIMARY_TEMPLATE_P (DECL_TI_TEMPLATE (decl));
@@ -1132,7 +1132,7 @@ is_specialization_of_friend (tree decl, tree friend)
{
/* If both are templates, check template parameter list. */
tree friend_parms
- = tsubst_template_parms (DECL_TEMPLATE_PARMS (friend),
+ = tsubst_template_parms (DECL_TEMPLATE_PARMS (friend_decl),
args, tf_none);
if (!comp_template_parms
(DECL_TEMPLATE_PARMS (DECL_TI_TEMPLATE (decl)),
@@ -1144,7 +1144,7 @@ is_specialization_of_friend (tree decl, tree friend)
else
decl_type = TREE_TYPE (decl);
- friend_type = tsubst_function_type (TREE_TYPE (friend), args,
+ friend_type = tsubst_function_type (TREE_TYPE (friend_decl), args,
tf_none, NULL_TREE);
if (friend_type == error_mark_node)
return false;
@@ -1157,7 +1157,7 @@ is_specialization_of_friend (tree decl, tree friend)
`this' parameter. */
friend_args_type = TYPE_ARG_TYPES (friend_type);
decl_args_type = TYPE_ARG_TYPES (decl_type);
- if (DECL_NONSTATIC_MEMBER_FUNCTION_P (friend))
+ if (DECL_NONSTATIC_MEMBER_FUNCTION_P (friend_decl))
friend_args_type = TREE_CHAIN (friend_args_type);
if (DECL_NONSTATIC_MEMBER_FUNCTION_P (decl))
decl_args_type = TREE_CHAIN (decl_args_type);
@@ -1170,7 +1170,7 @@ is_specialization_of_friend (tree decl, tree friend)
bool is_template;
tree decl_type = TREE_TYPE (decl);
- /* Make sure that both DECL and FRIEND are templates or
+ /* Make sure that both DECL and FRIEND_DECL are templates or
non-templates. */
is_template
= CLASSTYPE_TEMPLATE_INFO (decl_type)
@@ -1184,12 +1184,12 @@ is_specialization_of_friend (tree decl, tree friend)
/* If both are templates, check the name of the two
TEMPLATE_DECL's first because is_friend didn't. */
if (DECL_NAME (CLASSTYPE_TI_TEMPLATE (decl_type))
- != DECL_NAME (friend))
+ != DECL_NAME (friend_decl))
return false;
/* Now check template parameter list. */
friend_parms
- = tsubst_template_parms (DECL_TEMPLATE_PARMS (friend),
+ = tsubst_template_parms (DECL_TEMPLATE_PARMS (friend_decl),
args, tf_none);
return comp_template_parms
(DECL_TEMPLATE_PARMS (CLASSTYPE_TI_TEMPLATE (decl_type)),
@@ -1197,7 +1197,7 @@ is_specialization_of_friend (tree decl, tree friend)
}
else
return (DECL_NAME (decl)
- == DECL_NAME (friend));
+ == DECL_NAME (friend_decl));
}
}
return false;
@@ -1289,12 +1289,8 @@ register_specialization (tree spec, tree tmpl, tree args, bool is_friend)
to the primary function; now copy the inline bits to
the various clones. */
FOR_EACH_CLONE (clone, fn)
- {
- DECL_DECLARED_INLINE_P (clone)
- = DECL_DECLARED_INLINE_P (fn);
- DECL_INLINE (clone)
- = DECL_INLINE (fn);
- }
+ DECL_DECLARED_INLINE_P (clone)
+ = DECL_DECLARED_INLINE_P (fn);
check_specialization_namespace (fn);
return fn;
@@ -2813,12 +2809,15 @@ expand_template_argument_pack (tree args)
return result_args;
}
-/* Complain if DECL shadows a template parameter.
+/* Checks if DECL shadows a template parameter.
[temp.local]: A template-parameter shall not be redeclared within its
- scope (including nested scopes). */
+ scope (including nested scopes).
-void
+ Emits an error and returns TRUE if the DECL shadows a parameter,
+ returns FALSE otherwise. */
+
+bool
check_template_shadow (tree decl)
{
tree olddecl;
@@ -2826,7 +2825,7 @@ check_template_shadow (tree decl)
/* If we're not in a template, we can't possibly shadow a template
parameter. */
if (!current_template_parms)
- return;
+ return true;
/* Figure out what we're shadowing. */
if (TREE_CODE (decl) == OVERLOAD)
@@ -2836,24 +2835,25 @@ check_template_shadow (tree decl)
/* If there's no previous binding for this name, we're not shadowing
anything, let alone a template parameter. */
if (!olddecl)
- return;
+ return true;
/* If we're not shadowing a template parameter, we're done. Note
that OLDDECL might be an OVERLOAD (or perhaps even an
ERROR_MARK), so we can't just blithely assume it to be a _DECL
node. */
if (!DECL_P (olddecl) || !DECL_TEMPLATE_PARM_P (olddecl))
- return;
+ return true;
/* We check for decl != olddecl to avoid bogus errors for using a
name inside a class. We check TPFI to avoid duplicate errors for
inline member templates. */
if (decl == olddecl
|| TEMPLATE_PARMS_FOR_INLINE (current_template_parms))
- return;
+ return true;
error ("declaration of %q+#D", decl);
error (" shadows template parm %q+#D", olddecl);
+ return false;
}
/* Return a new TEMPLATE_PARM_INDEX with the indicated INDEX, LEVEL,
@@ -4241,7 +4241,7 @@ fold_non_dependent_expr (tree expr)
/* EXPR is an expression which is used in a constant-expression context.
For instance, it could be a VAR_DECL with a constant initializer.
- Extract the innest constant expression.
+ Extract the innermost constant expression.
This is basically a more powerful version of
integral_constant_value, which can be used also in templates where
@@ -5536,7 +5536,7 @@ lookup_template_class (tree d1,
int entering_scope,
tsubst_flags_t complain)
{
- tree template = NULL_TREE, parmlist;
+ tree templ = NULL_TREE, parmlist;
tree t;
timevar_push (TV_NAME_LOOKUP);
@@ -5545,18 +5545,18 @@ lookup_template_class (tree d1,
{
tree value = innermost_non_namespace_value (d1);
if (value && DECL_TEMPLATE_TEMPLATE_PARM_P (value))
- template = value;
+ templ = value;
else
{
if (context)
push_decl_namespace (context);
- template = lookup_name (d1);
- template = maybe_get_template_decl_from_type_decl (template);
+ templ = lookup_name (d1);
+ templ = maybe_get_template_decl_from_type_decl (templ);
if (context)
pop_decl_namespace ();
}
- if (template)
- context = DECL_CONTEXT (template);
+ if (templ)
+ context = DECL_CONTEXT (templ);
}
else if (TREE_CODE (d1) == TYPE_DECL && MAYBE_CLASS_TYPE_P (TREE_TYPE (d1)))
{
@@ -5569,37 +5569,37 @@ lookup_template_class (tree d1,
if (CLASSTYPE_TEMPLATE_INFO (type))
{
- template = CLASSTYPE_TI_TEMPLATE (type);
- d1 = DECL_NAME (template);
+ templ = CLASSTYPE_TI_TEMPLATE (type);
+ d1 = DECL_NAME (templ);
}
}
else if (TREE_CODE (d1) == ENUMERAL_TYPE
|| (TYPE_P (d1) && MAYBE_CLASS_TYPE_P (d1)))
{
- template = TYPE_TI_TEMPLATE (d1);
- d1 = DECL_NAME (template);
+ templ = TYPE_TI_TEMPLATE (d1);
+ d1 = DECL_NAME (templ);
}
else if (TREE_CODE (d1) == TEMPLATE_DECL
&& TREE_CODE (DECL_TEMPLATE_RESULT (d1)) == TYPE_DECL)
{
- template = d1;
- d1 = DECL_NAME (template);
- context = DECL_CONTEXT (template);
+ templ = d1;
+ d1 = DECL_NAME (templ);
+ context = DECL_CONTEXT (templ);
}
/* Issue an error message if we didn't find a template. */
- if (! template)
+ if (! templ)
{
if (complain & tf_error)
error ("%qT is not a template", d1);
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
}
- if (TREE_CODE (template) != TEMPLATE_DECL
+ if (TREE_CODE (templ) != TEMPLATE_DECL
/* Make sure it's a user visible template, if it was named by
the user. */
- || ((complain & tf_user) && !DECL_TEMPLATE_PARM_P (template)
- && !PRIMARY_TEMPLATE_P (template)))
+ || ((complain & tf_user) && !DECL_TEMPLATE_PARM_P (templ)
+ && !PRIMARY_TEMPLATE_P (templ)))
{
if (complain & tf_error)
{
@@ -5612,7 +5612,7 @@ lookup_template_class (tree d1,
complain &= ~tf_user;
- if (DECL_TEMPLATE_TEMPLATE_PARM_P (template))
+ if (DECL_TEMPLATE_TEMPLATE_PARM_P (templ))
{
/* Create a new TEMPLATE_DECL and TEMPLATE_TEMPLATE_PARM node to store
template arguments */
@@ -5621,7 +5621,7 @@ lookup_template_class (tree d1,
tree arglist2;
tree outer;
- parmlist = DECL_INNERMOST_TEMPLATE_PARMS (template);
+ parmlist = DECL_INNERMOST_TEMPLATE_PARMS (templ);
/* Consider an example where a template template parameter declared as
@@ -5639,7 +5639,7 @@ lookup_template_class (tree d1,
level 1, and T at level 2, while the template arguments at level 1
becomes {std::vector} and the inner level 2 is {int}. */
- outer = DECL_CONTEXT (template);
+ outer = DECL_CONTEXT (templ);
if (outer)
outer = TI_ARGS (get_template_info (DECL_TEMPLATE_RESULT (outer)));
else if (current_template_parms)
@@ -5650,21 +5650,21 @@ lookup_template_class (tree d1,
if (outer)
arglist = add_to_template_args (outer, arglist);
- arglist2 = coerce_template_parms (parmlist, arglist, template,
+ arglist2 = coerce_template_parms (parmlist, arglist, templ,
complain,
/*require_all_args=*/true,
/*use_default_args=*/true);
if (arglist2 == error_mark_node
|| (!uses_template_parms (arglist2)
- && check_instantiated_args (template, arglist2, complain)))
+ && check_instantiated_args (templ, arglist2, complain)))
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
- parm = bind_template_template_parm (TREE_TYPE (template), arglist2);
+ parm = bind_template_template_parm (TREE_TYPE (templ), arglist2);
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, parm);
}
else
{
- tree template_type = TREE_TYPE (template);
+ tree template_type = TREE_TYPE (templ);
tree gen_tmpl;
tree type_decl;
tree found = NULL_TREE;
@@ -5672,7 +5672,7 @@ lookup_template_class (tree d1,
int parm_depth;
int is_partial_instantiation;
- gen_tmpl = most_general_template (template);
+ gen_tmpl = most_general_template (templ);
parmlist = DECL_TEMPLATE_PARMS (gen_tmpl);
parm_depth = TMPL_PARMS_DEPTH (parmlist);
arg_depth = TMPL_ARGS_DEPTH (arglist);
@@ -5692,7 +5692,7 @@ lookup_template_class (tree d1,
<class U> struct S1<T>::S2'. We must fill in the missing
arguments. */
arglist
- = add_outermost_template_args (TYPE_TI_ARGS (TREE_TYPE (template)),
+ = add_outermost_template_args (TYPE_TI_ARGS (TREE_TYPE (templ)),
arglist);
arg_depth = TMPL_ARGS_DEPTH (arglist);
}
@@ -5702,7 +5702,7 @@ lookup_template_class (tree d1,
/* From here on, we're only interested in the most general
template. */
- template = gen_tmpl;
+ templ = gen_tmpl;
/* Calculate the BOUND_ARGS. These will be the args that are
actually tsubst'd into the definition to create the
@@ -5716,12 +5716,12 @@ lookup_template_class (tree d1,
tree bound_args = make_tree_vec (parm_depth);
for (i = saved_depth,
- t = DECL_TEMPLATE_PARMS (template);
+ t = DECL_TEMPLATE_PARMS (templ);
i > 0 && t != NULL_TREE;
--i, t = TREE_CHAIN (t))
{
tree a = coerce_template_parms (TREE_VALUE (t),
- arglist, template,
+ arglist, templ,
complain,
/*require_all_args=*/true,
/*use_default_args=*/true);
@@ -5752,7 +5752,7 @@ lookup_template_class (tree d1,
arglist
= coerce_template_parms (INNERMOST_TEMPLATE_PARMS (parmlist),
INNERMOST_TEMPLATE_ARGS (arglist),
- template,
+ templ,
complain,
/*require_all_args=*/true,
/*use_default_args=*/true);
@@ -5774,7 +5774,7 @@ lookup_template_class (tree d1,
{
found = template_type;
- if (!entering_scope && PRIMARY_TEMPLATE_P (template))
+ if (!entering_scope && PRIMARY_TEMPLATE_P (templ))
{
tree ctx;
@@ -5796,7 +5796,7 @@ lookup_template_class (tree d1,
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, found);
/* If we already have this specialization, return it. */
- found = retrieve_specialization (template, arglist,
+ found = retrieve_specialization (templ, arglist,
/*class_specializations_p=*/false);
if (found)
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, found);
@@ -5810,22 +5810,22 @@ lookup_template_class (tree d1,
/* If the deduced arguments are invalid, then the binding
failed. */
if (!is_partial_instantiation
- && check_instantiated_args (template,
+ && check_instantiated_args (templ,
INNERMOST_TEMPLATE_ARGS (arglist),
complain))
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
if (!is_partial_instantiation
- && !PRIMARY_TEMPLATE_P (template)
- && TREE_CODE (CP_DECL_CONTEXT (template)) == NAMESPACE_DECL)
+ && !PRIMARY_TEMPLATE_P (templ)
+ && TREE_CODE (CP_DECL_CONTEXT (templ)) == NAMESPACE_DECL)
{
- found = xref_tag_from_type (TREE_TYPE (template),
- DECL_NAME (template),
+ found = xref_tag_from_type (TREE_TYPE (templ),
+ DECL_NAME (templ),
/*tag_scope=*/ts_global);
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, found);
}
- context = tsubst (DECL_CONTEXT (template), arglist,
+ context = tsubst (DECL_CONTEXT (templ), arglist,
complain, in_decl);
if (!context)
context = global_namespace;
@@ -5855,7 +5855,7 @@ lookup_template_class (tree d1,
/* A local class. Make sure the decl gets registered properly. */
if (context == current_function_decl)
- pushtag (DECL_NAME (template), t, /*tag_scope=*/ts_current);
+ pushtag (DECL_NAME (templ), t, /*tag_scope=*/ts_current);
if (comp_template_args (CLASSTYPE_TI_ARGS (template_type), arglist))
/* This instantiation is another name for the primary
@@ -5875,7 +5875,7 @@ lookup_template_class (tree d1,
{
TYPE_CONTEXT (t) = FROB_CONTEXT (context);
- type_decl = create_implicit_typedef (DECL_NAME (template), t);
+ type_decl = create_implicit_typedef (DECL_NAME (templ), t);
DECL_CONTEXT (type_decl) = TYPE_CONTEXT (t);
TYPE_STUB_DECL (t) = type_decl;
DECL_SOURCE_LOCATION (type_decl)
@@ -5888,8 +5888,6 @@ lookup_template_class (tree d1,
= TREE_PRIVATE (TYPE_STUB_DECL (template_type));
TREE_PROTECTED (type_decl)
= TREE_PROTECTED (TYPE_STUB_DECL (template_type));
- DECL_IN_SYSTEM_HEADER (type_decl)
- = DECL_IN_SYSTEM_HEADER (template);
if (CLASSTYPE_VISIBILITY_SPECIFIED (template_type))
{
DECL_VISIBILITY_SPECIFIED (type_decl) = 1;
@@ -5900,15 +5898,15 @@ lookup_template_class (tree d1,
template is the immediate parent if this is a full
instantiation. */
if (parm_depth == 1 || is_partial_instantiation
- || !PRIMARY_TEMPLATE_P (template))
+ || !PRIMARY_TEMPLATE_P (templ))
/* This case is easy; there are no member templates involved. */
- found = template;
+ found = templ;
else
{
/* This is a full instantiation of a member template. Look
for a partial instantiation of which this is an instance. */
- for (found = DECL_TEMPLATE_INSTANTIATIONS (template);
+ for (found = DECL_TEMPLATE_INSTANTIATIONS (templ);
found; found = TREE_CHAIN (found))
{
int success;
@@ -5953,15 +5951,15 @@ lookup_template_class (tree d1,
Create the partial instantiation.
*/
TREE_VEC_LENGTH (arglist)--;
- found = tsubst (template, arglist, complain, NULL_TREE);
+ found = tsubst (templ, arglist, complain, NULL_TREE);
TREE_VEC_LENGTH (arglist)++;
}
}
SET_TYPE_TEMPLATE_INFO (t, tree_cons (found, arglist, NULL_TREE));
- DECL_TEMPLATE_INSTANTIATIONS (template)
+ DECL_TEMPLATE_INSTANTIATIONS (templ)
= tree_cons (arglist, t,
- DECL_TEMPLATE_INSTANTIATIONS (template));
+ DECL_TEMPLATE_INSTANTIATIONS (templ));
if (TREE_CODE (t) == ENUMERAL_TYPE
&& !is_partial_instantiation)
@@ -6292,7 +6290,7 @@ static int last_template_error_tick;
static int
push_tinst_level (tree d)
{
- struct tinst_level *new;
+ struct tinst_level *new_level;
if (tinst_depth >= max_tinst_depth)
{
@@ -6312,12 +6310,12 @@ push_tinst_level (tree d)
return 0;
}
- new = GGC_NEW (struct tinst_level);
- new->decl = d;
- new->locus = input_location;
- new->in_system_header_p = in_system_header;
- new->next = current_tinst_level;
- current_tinst_level = new;
+ new_level = GGC_NEW (struct tinst_level);
+ new_level->decl = d;
+ new_level->locus = input_location;
+ new_level->in_system_header_p = in_system_header;
+ new_level->next = current_tinst_level;
+ current_tinst_level = new_level;
++tinst_depth;
#ifdef GATHER_STATISTICS
@@ -6338,7 +6336,6 @@ pop_tinst_level (void)
/* Restore the filename and line number stashed away when we started
this instantiation. */
input_location = current_tinst_level->locus;
- in_system_header = current_tinst_level->in_system_header_p;
current_tinst_level = current_tinst_level->next;
--tinst_depth;
++tinst_level_tick;
@@ -6404,7 +6401,7 @@ tsubst_friend_function (tree decl, tree args)
/* Friend functions are looked up in the containing namespace scope.
We must enter that scope, to avoid finding member functions of the
- current cless with same name. */
+ current class with same name. */
push_nested_namespace (ns);
fns = tsubst_expr (DECL_TI_TEMPLATE (decl), args,
tf_warning_or_error, NULL_TREE,
@@ -6839,7 +6836,7 @@ apply_late_template_attributes (tree *decl_p, tree attributes, int attr_flags,
tree
instantiate_class_template (tree type)
{
- tree template, args, pattern, t, member;
+ tree templ, args, pattern, t, member;
tree typedecl;
tree pbinfo;
tree base_list;
@@ -6853,12 +6850,12 @@ instantiate_class_template (tree type)
return type;
/* Figure out which template is being instantiated. */
- template = most_general_template (CLASSTYPE_TI_TEMPLATE (type));
- gcc_assert (TREE_CODE (template) == TEMPLATE_DECL);
+ templ = most_general_template (CLASSTYPE_TI_TEMPLATE (type));
+ gcc_assert (TREE_CODE (templ) == TEMPLATE_DECL);
/* Determine what specialization of the original template to
instantiate. */
- t = most_specialized_class (type, template);
+ t = most_specialized_class (type, templ);
if (t == error_mark_node)
{
TYPE_BEING_DEFINED (type) = 1;
@@ -6881,7 +6878,7 @@ instantiate_class_template (tree type)
}
else
{
- pattern = TREE_TYPE (template);
+ pattern = TREE_TYPE (templ);
args = CLASSTYPE_TI_ARGS (type);
}
@@ -6910,7 +6907,6 @@ instantiate_class_template (tree type)
if tsubsting causes an error. */
typedecl = TYPE_MAIN_DECL (type);
input_location = DECL_SOURCE_LOCATION (typedecl);
- in_system_header = DECL_IN_SYSTEM_HEADER (typedecl);
TYPE_HAS_USER_CONSTRUCTOR (type) = TYPE_HAS_USER_CONSTRUCTOR (pattern);
TYPE_HAS_NEW_OPERATOR (type) = TYPE_HAS_NEW_OPERATOR (pattern);
@@ -7108,7 +7104,7 @@ instantiate_class_template (tree type)
{
tree r;
- /* The the file and line for this declaration, to
+ /* The file and line for this declaration, to
assist in error message reporting. Since we
called push_tinst_level above, we don't need to
restore these. */
@@ -7267,7 +7263,7 @@ instantiate_class_template (tree type)
/* Build new DECL_FRIENDLIST. */
tree r;
- /* The the file and line for this declaration, to
+ /* The file and line for this declaration, to
assist in error message reporting. Since we
called push_tinst_level above, we don't need to
restore these. */
@@ -7303,7 +7299,7 @@ instantiate_class_template (tree type)
/* Now that the class is complete, instantiate default arguments for
any member functions. We don't do this earlier because the
default arguments may reference members of the class. */
- if (!PRIMARY_TEMPLATE_P (template))
+ if (!PRIMARY_TEMPLATE_P (templ))
for (t = TYPE_METHODS (type); t; t = TREE_CHAIN (t))
if (TREE_CODE (t) == FUNCTION_DECL
/* Implicitly generated member functions will not have template
@@ -8151,7 +8147,9 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain)
/* Clear out the mangled name and RTL for the instantiation. */
SET_DECL_ASSEMBLER_NAME (r, NULL_TREE);
SET_DECL_RTL (r, NULL_RTX);
- DECL_INITIAL (r) = NULL_TREE;
+ /* Leave DECL_INITIAL set on deleted instantiations. */
+ if (!DECL_DELETED_FN (r))
+ DECL_INITIAL (r) = NULL_TREE;
DECL_CONTEXT (r) = ctx;
if (member && DECL_CONV_FN_P (r))
@@ -10943,26 +10941,26 @@ tsubst_copy_and_build (tree t,
case TEMPLATE_ID_EXPR:
{
tree object;
- tree template = RECUR (TREE_OPERAND (t, 0));
+ tree templ = RECUR (TREE_OPERAND (t, 0));
tree targs = TREE_OPERAND (t, 1);
if (targs)
targs = tsubst_template_args (targs, args, complain, in_decl);
- if (TREE_CODE (template) == COMPONENT_REF)
+ if (TREE_CODE (templ) == COMPONENT_REF)
{
- object = TREE_OPERAND (template, 0);
- template = TREE_OPERAND (template, 1);
+ object = TREE_OPERAND (templ, 0);
+ templ = TREE_OPERAND (templ, 1);
}
else
object = NULL_TREE;
- template = lookup_template_function (template, targs);
+ templ = lookup_template_function (templ, targs);
if (object)
- return build3 (COMPONENT_REF, TREE_TYPE (template),
- object, template, NULL_TREE);
+ return build3 (COMPONENT_REF, TREE_TYPE (templ),
+ object, templ, NULL_TREE);
else
- return baselink_for_fns (template);
+ return baselink_for_fns (templ);
}
case INDIRECT_REF:
@@ -11177,7 +11175,7 @@ tsubst_copy_and_build (tree t,
tree init = RECUR (TREE_OPERAND (t, 3));
if (TREE_OPERAND (t, 3) && !init)
- /* If there was an initializer in the the original tree, but
+ /* If there was an initializer in the original tree, but
it instantiated to an empty list, then we should pass on
VOID_ZERO_NODE to tell build_new that it was an empty
initializer () rather than no initializer. This can only
@@ -13567,7 +13565,7 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict)
/* CV qualifications for methods can never be deduced, they must
match exactly. We need to check them explicitly here,
because type_unification_real treats them as any other
- cvqualified parameter. */
+ cv-qualified parameter. */
if (TREE_CODE (parm) == METHOD_TYPE
&& (!check_cv_quals_for_unify
(UNIFY_ALLOW_NONE,
@@ -14614,8 +14612,9 @@ do_decl_instantiation (tree decl, tree storage)
;
else if (storage == ridpointers[(int) RID_EXTERN])
{
- if (pedantic && !in_system_header && (cxx_dialect == cxx98))
- pedwarn ("ISO C++ 1998 forbids the use of %<extern%> on explicit "
+ if (!in_system_header && (cxx_dialect == cxx98))
+ pedwarn (OPT_pedantic,
+ "ISO C++ 1998 forbids the use of %<extern%> on explicit "
"instantiations");
extern_p = 1;
}
@@ -14701,16 +14700,17 @@ do_type_instantiation (tree t, tree storage, tsubst_flags_t complain)
if (storage != NULL_TREE)
{
- if (pedantic && !in_system_header)
+ if (!in_system_header)
{
if (storage == ridpointers[(int) RID_EXTERN])
{
if (cxx_dialect == cxx98)
- pedwarn("ISO C++ 1998 forbids the use of %<extern%> on "
+ pedwarn(OPT_pedantic,
+ "ISO C++ 1998 forbids the use of %<extern%> on "
"explicit instantiations");
}
else
- pedwarn("ISO C++ forbids the use of %qE on explicit "
+ pedwarn(OPT_pedantic, "ISO C++ forbids the use of %qE on explicit "
"instantiations", storage);
}
@@ -14923,8 +14923,6 @@ regenerate_decl_from_template (tree decl, tree tmpl)
if (DECL_DECLARED_INLINE_P (code_pattern)
&& !DECL_DECLARED_INLINE_P (decl))
DECL_DECLARED_INLINE_P (decl) = 1;
- if (DECL_INLINE (code_pattern) && !DECL_INLINE (decl))
- DECL_INLINE (decl) = 1;
}
else if (TREE_CODE (decl) == VAR_DECL)
DECL_INITIAL (decl) =
@@ -15016,7 +15014,6 @@ instantiate_decl (tree d, int defer_ok,
bool pattern_defined;
int need_push;
location_t saved_loc = input_location;
- int saved_in_system_header = in_system_header;
bool external_p;
/* This function should only be used to instantiate templates for
@@ -15099,7 +15096,6 @@ instantiate_decl (tree d, int defer_ok,
mark_definable (d);
input_location = DECL_SOURCE_LOCATION (d);
- in_system_header = DECL_IN_SYSTEM_HEADER (d);
/* If D is a member of an explicitly instantiated class template,
and no definition is available, treat it like an implicit
@@ -15148,7 +15144,8 @@ instantiate_decl (tree d, int defer_ok,
if (external_p
/* ... but we instantiate inline functions so that we can inline
them and ... */
- && ! (TREE_CODE (d) == FUNCTION_DECL && DECL_INLINE (d))
+ && ! (TREE_CODE (d) == FUNCTION_DECL
+ && possibly_inlined_p (d))
/* ... we instantiate static data members whose values are
needed in integral constant expressions. */
&& ! (TREE_CODE (d) == VAR_DECL
@@ -15225,9 +15222,7 @@ instantiate_decl (tree d, int defer_ok,
/* Instantiate inline functions so that the inliner can do its
job, even though we'll not be emitting a copy of this
function. */
- if (!(TREE_CODE (d) == FUNCTION_DECL
- && flag_inline_trees
- && DECL_DECLARED_INLINE_P (d)))
+ if (!(TREE_CODE (d) == FUNCTION_DECL && possibly_inlined_p (d)))
goto out;
}
@@ -15371,7 +15366,6 @@ instantiate_decl (tree d, int defer_ok,
out:
input_location = saved_loc;
- in_system_header = saved_in_system_header;
pop_deferring_access_checks ();
pop_tinst_level ();
@@ -15389,7 +15383,6 @@ instantiate_pending_templates (int retries)
{
int reconsider;
location_t saved_loc = input_location;
- int saved_in_system_header = in_system_header;
/* Instantiating templates may trigger vtable generation. This in turn
may require further template instantiations. We place a limit here
@@ -15473,7 +15466,6 @@ instantiate_pending_templates (int retries)
while (reconsider);
input_location = saved_loc;
- in_system_header = saved_in_system_header;
}
/* Substitute ARGVEC into T, which is a list of initializers for
diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c
index 8a36f0b77b7..e3e5349f5ca 100644
--- a/gcc/cp/rtti.c
+++ b/gcc/cp/rtti.c
@@ -252,7 +252,8 @@ get_tinfo_decl_dynamic (tree exp)
/* Peel off cv qualifiers. */
type = TYPE_MAIN_VARIANT (type);
- if (CLASS_TYPE_P (type))
+ /* For UNKNOWN_TYPEs call complete_type_or_else to get diagnostics. */
+ if (CLASS_TYPE_P (type) || TREE_CODE (type) == UNKNOWN_TYPE)
type = complete_type_or_else (type, exp);
if (!type)
@@ -459,7 +460,8 @@ get_typeid (tree type)
that is the operand of typeid are always ignored. */
type = TYPE_MAIN_VARIANT (type);
- if (CLASS_TYPE_P (type))
+ /* For UNKNOWN_TYPEs call complete_type_or_else to get diagnostics. */
+ if (CLASS_TYPE_P (type) || TREE_CODE (type) == UNKNOWN_TYPE)
type = complete_type_or_else (type, NULL_TREE);
if (!type)
@@ -1408,7 +1410,7 @@ emit_support_tinfos (void)
{
&void_type_node,
&boolean_type_node,
- &wchar_type_node,
+ &wchar_type_node, &char16_type_node, &char32_type_node,
&char_type_node, &signed_char_type_node, &unsigned_char_type_node,
&short_integer_type_node, &short_unsigned_type_node,
&integer_type_node, &unsigned_type_node,
diff --git a/gcc/cp/search.c b/gcc/cp/search.c
index cee29240e9e..7fc040bc8c4 100644
--- a/gcc/cp/search.c
+++ b/gcc/cp/search.c
@@ -1912,6 +1912,20 @@ check_final_overrider (tree overrider, tree basefn)
return 0;
}
+ if (DECL_DELETED_FN (basefn) != DECL_DELETED_FN (overrider))
+ {
+ if (DECL_DELETED_FN (overrider))
+ {
+ error ("deleted function %q+D", overrider);
+ error ("overriding non-deleted function %q+D", basefn);
+ }
+ else
+ {
+ error ("non-deleted function %q+D", overrider);
+ error ("overriding deleted function %q+D", basefn);
+ }
+ return 0;
+ }
return 1;
}
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 17b1e5dee49..3bcab9407d4 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -46,6 +46,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-iterator.h"
#include "vec.h"
#include "target.h"
+#include "gimple.h"
/* There routines provide a modular interface to perform many parsing
operations. They may therefore be used during actual parsing, or
@@ -3201,6 +3202,8 @@ expand_or_defer_fn (tree fn)
return;
}
+ gcc_assert (gimple_body (fn));
+
/* Replace AGGR_INIT_EXPRs with appropriate CALL_EXPRs. */
cp_walk_tree_without_duplicates (&DECL_SAVED_TREE (fn),
simplify_aggr_init_exprs_r,
@@ -4472,7 +4475,7 @@ tree
finish_decltype_type (tree expr, bool id_expression_or_member_access_p)
{
tree orig_expr = expr;
- tree type;
+ tree type = NULL_TREE;
if (!expr || error_operand_p (expr))
return error_mark_node;
@@ -4583,8 +4586,6 @@ finish_decltype_type (tree expr, bool id_expression_or_member_access_p)
}
else
{
- tree fndecl;
-
/* Expressions of reference type are sometimes wrapped in
INDIRECT_REFs. INDIRECT_REFs are just internal compiler
representation, not part of the language, so we have to look
@@ -4594,14 +4595,28 @@ finish_decltype_type (tree expr, bool id_expression_or_member_access_p)
== REFERENCE_TYPE)
expr = TREE_OPERAND (expr, 0);
- if (TREE_CODE (expr) == CALL_EXPR
- && (fndecl = get_callee_fndecl (expr))
- && (fndecl != error_mark_node))
- /* If e is a function call (5.2.2 [expr.call]) or an
+ if (TREE_CODE (expr) == CALL_EXPR)
+ {
+ /* If e is a function call (5.2.2 [expr.call]) or an
invocation of an overloaded operator (parentheses around e
are ignored), decltype(e) is defined as the return type of
that function. */
- type = TREE_TYPE (TREE_TYPE (fndecl));
+ tree fndecl = get_callee_fndecl (expr);
+ if (fndecl && fndecl != error_mark_node)
+ type = TREE_TYPE (TREE_TYPE (fndecl));
+ else
+ {
+ tree target_type = TREE_TYPE (CALL_EXPR_FN (expr));
+ if ((TREE_CODE (target_type) == REFERENCE_TYPE
+ || TREE_CODE (target_type) == POINTER_TYPE)
+ && (TREE_CODE (TREE_TYPE (target_type)) == FUNCTION_TYPE
+ || TREE_CODE (TREE_TYPE (target_type)) == METHOD_TYPE))
+ type = TREE_TYPE (TREE_TYPE (target_type));
+ else
+ sorry ("unable to determine the declared type of expression %<%E%>",
+ expr);
+ }
+ }
else
{
type = is_bitfield_expr_with_lowered_type (expr);
@@ -4677,8 +4692,20 @@ classtype_has_nothrow_assign_or_copy_p (tree type, bool assign_p)
return false;
for (; fns; fns = OVL_NEXT (fns))
- if (!TREE_NOTHROW (OVL_CURRENT (fns)))
- return false;
+ {
+ tree fn = OVL_CURRENT (fns);
+
+ if (assign_p)
+ {
+ if (copy_fn_p (fn) == 0)
+ continue;
+ }
+ else if (copy_fn_p (fn) <= 0)
+ continue;
+
+ if (!TYPE_NOTHROW_P (TREE_TYPE (fn)))
+ return false;
+ }
return true;
}
@@ -4712,7 +4739,8 @@ trait_expr_value (cp_trait_kind kind, tree type1, tree type2)
type1 = strip_array_types (type1);
return (trait_expr_value (CPTK_HAS_TRIVIAL_CONSTRUCTOR, type1, type2)
|| (CLASS_TYPE_P (type1)
- && (t = locate_ctor (type1, NULL)) && TREE_NOTHROW (t)));
+ && (t = locate_ctor (type1, NULL))
+ && TYPE_NOTHROW_P (TREE_TYPE (t))));
case CPTK_HAS_TRIVIAL_CONSTRUCTOR:
type1 = strip_array_types (type1);
@@ -4730,7 +4758,7 @@ trait_expr_value (cp_trait_kind kind, tree type1, tree type2)
case CPTK_HAS_TRIVIAL_DESTRUCTOR:
type1 = strip_array_types (type1);
- return (pod_type_p (type1)
+ return (pod_type_p (type1) || type_code1 == REFERENCE_TYPE
|| (CLASS_TYPE_P (type1)
&& TYPE_HAS_TRIVIAL_DESTRUCTOR (type1)));
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index b7c0a8d33b8..ff19cd69d8b 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -339,15 +339,17 @@ build_aggr_init_array (tree return_type, tree fn, tree slot, int nargs,
}
/* INIT is a CALL_EXPR or AGGR_INIT_EXPR which needs info about its
- target. TYPE is the type that this initialization should appear to
- have.
+ target. TYPE is the type to be initialized.
- Build an encapsulation of the initialization to perform
- and return it so that it can be processed by language-independent
- and language-specific expression expanders. */
+ Build an AGGR_INIT_EXPR to represent the initialization. This function
+ differs from build_cplus_new in that an AGGR_INIT_EXPR can only be used
+ to initialize another object, whereas a TARGET_EXPR can either
+ initialize another object or create its own temporary object, and as a
+ result building up a TARGET_EXPR requires that the type's destructor be
+ callable. */
tree
-build_cplus_new (tree type, tree init)
+build_aggr_init_expr (tree type, tree init)
{
tree fn;
tree slot;
@@ -369,8 +371,6 @@ build_cplus_new (tree type, tree init)
&& TREE_CODE (TREE_OPERAND (fn, 0)) == FUNCTION_DECL
&& DECL_CONSTRUCTOR_P (TREE_OPERAND (fn, 0)));
- slot = build_local_temp (type);
-
/* We split the CALL_EXPR into its function and its arguments here.
Then, in expand_expr, we put them back together. The reason for
this is that this expression might be a default argument
@@ -384,6 +384,8 @@ build_cplus_new (tree type, tree init)
type, don't mess with AGGR_INIT_EXPR. */
if (is_ctor || TREE_ADDRESSABLE (type))
{
+ slot = build_local_temp (type);
+
if (TREE_CODE(init) == CALL_EXPR)
rval = build_aggr_init_array (void_type_node, fn, slot,
call_expr_nargs (init),
@@ -398,6 +400,30 @@ build_cplus_new (tree type, tree init)
else
rval = init;
+ return rval;
+}
+
+/* INIT is a CALL_EXPR or AGGR_INIT_EXPR which needs info about its
+ target. TYPE is the type that this initialization should appear to
+ have.
+
+ Build an encapsulation of the initialization to perform
+ and return it so that it can be processed by language-independent
+ and language-specific expression expanders. */
+
+tree
+build_cplus_new (tree type, tree init)
+{
+ tree rval = build_aggr_init_expr (type, init);
+ tree slot;
+
+ if (TREE_CODE (rval) == AGGR_INIT_EXPR)
+ slot = AGGR_INIT_EXPR_SLOT (rval);
+ else if (TREE_CODE (rval) == CALL_EXPR)
+ slot = build_local_temp (type);
+ else
+ return rval;
+
rval = build_target_expr (slot, rval);
TARGET_EXPR_IMPLICIT_P (rval) = 1;
@@ -504,9 +530,9 @@ cplus_array_hash (const void* k)
hashval_t hash;
const_tree const t = (const_tree) k;
- hash = (htab_hash_pointer (TREE_TYPE (t))
- ^ htab_hash_pointer (TYPE_DOMAIN (t)));
-
+ hash = TYPE_UID (TREE_TYPE (t));
+ if (TYPE_DOMAIN (t))
+ hash ^= TYPE_UID (TYPE_DOMAIN (t));
return hash;
}
@@ -553,8 +579,9 @@ build_cplus_array_type_1 (tree elt_type, tree index_type)
cplus_array_htab = htab_create_ggc (61, &cplus_array_hash,
&cplus_array_compare, NULL);
- hash = (htab_hash_pointer (elt_type)
- ^ htab_hash_pointer (index_type));
+ hash = TYPE_UID (elt_type);
+ if (index_type)
+ hash ^= TYPE_UID (index_type);
cai.type = elt_type;
cai.domain = index_type;
@@ -683,7 +710,7 @@ c_build_qualified_type (tree type, int type_quals)
arrays correctly. In particular, if TYPE is an array of T's, and
TYPE_QUALS is non-empty, returns an array of qualified T's.
- FLAGS determines how to deal with illformed qualifications. If
+ FLAGS determines how to deal with ill-formed qualifications. If
tf_ignore_bad_quals is set, then bad qualifications are dropped
(this is permitted if TYPE was introduced via a typedef or template
type parameter). If bad qualifications are dropped and tf_warning
@@ -795,8 +822,8 @@ cp_build_qualified_type_real (tree type,
return make_pack_expansion (t);
}
- /* A reference or method type shall not be cv qualified.
- [dcl.ref], [dct.fct] */
+ /* A reference or method type shall not be cv-qualified.
+ [dcl.ref], [dcl.fct] */
if (type_quals & (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE)
&& (TREE_CODE (type) == REFERENCE_TYPE
|| TREE_CODE (type) == METHOD_TYPE))
@@ -846,7 +873,8 @@ cp_build_qualified_type_real (tree type,
between the unqualified and qualified types. */
if (result != type
&& TREE_CODE (type) == POINTER_TYPE
- && TREE_CODE (TREE_TYPE (type)) == METHOD_TYPE)
+ && TREE_CODE (TREE_TYPE (type)) == METHOD_TYPE
+ && TYPE_LANG_SPECIFIC (result) == TYPE_LANG_SPECIFIC (type))
TYPE_LANG_SPECIFIC (result) = NULL;
return result;
@@ -2594,17 +2622,17 @@ stabilize_expr (tree exp, tree* initp)
return exp;
}
-/* Add NEW, an expression whose value we don't care about, after the
+/* Add NEW_EXPR, an expression whose value we don't care about, after the
similar expression ORIG. */
tree
-add_stmt_to_compound (tree orig, tree new)
+add_stmt_to_compound (tree orig, tree new_expr)
{
- if (!new || !TREE_SIDE_EFFECTS (new))
+ if (!new_expr || !TREE_SIDE_EFFECTS (new_expr))
return orig;
if (!orig || !TREE_SIDE_EFFECTS (orig))
- return new;
- return build2 (COMPOUND_EXPR, void_type_node, orig, new);
+ return new_expr;
+ return build2 (COMPOUND_EXPR, void_type_node, orig, new_expr);
}
/* Like stabilize_expr, but for a call whose arguments we want to
@@ -2686,7 +2714,8 @@ stabilize_init (tree init, tree *initp)
return true;
if (TREE_CODE (t) == INIT_EXPR
- && TREE_CODE (TREE_OPERAND (t, 1)) != TARGET_EXPR)
+ && TREE_CODE (TREE_OPERAND (t, 1)) != TARGET_EXPR
+ && TREE_CODE (TREE_OPERAND (t, 1)) != AGGR_INIT_EXPR)
{
TREE_OPERAND (t, 1) = stabilize_expr (TREE_OPERAND (t, 1), initp);
return true;
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 409f34068d4..a99526f1318 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -145,7 +145,7 @@ complete_type_or_else (tree type, tree value)
return NULL_TREE;
else if (!COMPLETE_TYPE_P (type))
{
- cxx_incomplete_type_diagnostic (value, type, 0);
+ cxx_incomplete_type_diagnostic (value, type, DK_ERROR);
return NULL_TREE;
}
else
@@ -511,9 +511,10 @@ composite_pointer_type (tree t1, tree t2, tree arg1, tree arg2,
tree attributes;
tree result_type;
- if (pedantic && TYPE_PTRFN_P (t2) && (complain & tf_error))
- pedwarn ("ISO C++ forbids %s between pointer of type %<void *%> "
- "and pointer-to-function", location);
+ if (TYPE_PTRFN_P (t2) && (complain & tf_error))
+ pedwarn (OPT_pedantic, "ISO C++ forbids %s "
+ "between pointer of type %<void *%> and pointer-to-function",
+ location);
result_type
= cp_build_qualified_type (void_type_node,
(cp_type_quals (TREE_TYPE (t1))
@@ -1278,8 +1279,9 @@ cxx_sizeof_or_alignof_type (tree type, enum tree_code op, bool complain)
type = non_reference (type);
if (TREE_CODE (type) == METHOD_TYPE)
{
- if (complain && (pedantic || warn_pointer_arith))
- pedwarn ("invalid application of %qs to a member function",
+ if (complain)
+ pedwarn (pedantic ? OPT_pedantic : OPT_Wpointer_arith,
+ "invalid application of %qs to a member function",
operator_name_info[(int) op].name);
value = size_one_node;
}
@@ -1645,7 +1647,7 @@ decay_conversion (tree exp)
return exp;
}
-/* Perform prepatory conversions, as part of the "usual arithmetic
+/* Perform preparatory conversions, as part of the "usual arithmetic
conversions". In particular, as per [expr]:
Whenever an lvalue expression appears as an operand of an
@@ -1696,18 +1698,6 @@ perform_integral_promotions (tree expr)
return expr;
}
-/* Take the address of an inline function without setting TREE_ADDRESSABLE
- or TREE_USED. */
-
-tree
-inline_conversion (tree exp)
-{
- if (TREE_CODE (exp) == FUNCTION_DECL)
- exp = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (exp)), exp);
-
- return exp;
-}
-
/* Returns nonzero iff exp is a STRING_CST or the result of applying
decay_conversion to one. */
@@ -2315,10 +2305,10 @@ finish_class_member_access_expr (tree object, tree name, bool template_p,
if (is_template_id)
{
- tree template = member;
+ tree templ = member;
- if (BASELINK_P (template))
- template = lookup_template_function (template, template_args);
+ if (BASELINK_P (templ))
+ templ = lookup_template_function (templ, template_args);
else
{
if (complain & tf_error)
@@ -2596,8 +2586,8 @@ build_array_ref (tree array, tree idx)
return error_mark_node;
}
- if (pedantic && !lvalue_p (array))
- pedwarn ("ISO C++ forbids subscripting non-lvalue array");
+ if (!lvalue_p (array))
+ pedwarn (OPT_pedantic, "ISO C++ forbids subscripting non-lvalue array");
/* Note in C++ it is valid to subscript a `register' array, since
it is valid to take the address of something with that
@@ -2822,17 +2812,11 @@ cp_build_function_call (tree function, tree params, tsubst_flags_t complain)
fndecl = function;
/* Convert anything with function type to a pointer-to-function. */
- if (pedantic && DECL_MAIN_P (function) && (complain & tf_error))
- pedwarn ("ISO C++ forbids calling %<::main%> from within program");
+ if (DECL_MAIN_P (function) && (complain & tf_error))
+ pedwarn (OPT_pedantic,
+ "ISO C++ forbids calling %<::main%> from within program");
- /* Differs from default_conversion by not setting TREE_ADDRESSABLE
- (because calling an inline function does not mean the function
- needs to be separately compiled). */
-
- if (DECL_INLINE (function))
- function = inline_conversion (function);
- else
- function = build_addr_func (function);
+ function = build_addr_func (function);
}
else
{
@@ -3299,7 +3283,7 @@ cp_build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
TREE_TYPE (type1)))
return pointer_diff (op0, op1, common_type (type0, type1));
/* In all other cases except pointer - int, the usual arithmetic
- rules aply. */
+ rules apply. */
else if (!(code0 == POINTER_TYPE && code1 == INTEGER_TYPE))
{
common = 1;
@@ -3821,66 +3805,14 @@ cp_build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
For them, this optimization is safe only if
both args are zero-extended or both are sign-extended.
Otherwise, we might change the result.
- Eg, (short)-1 | (unsigned short)-1 is (int)-1
+ E.g., (short)-1 | (unsigned short)-1 is (int)-1
but calculated in (unsigned short) it would be (unsigned short)-1. */
if (shorten && none_complex)
{
- int unsigned0, unsigned1;
- tree arg0 = get_narrower (op0, &unsigned0);
- tree arg1 = get_narrower (op1, &unsigned1);
- /* UNS is 1 if the operation to be done is an unsigned one. */
- int uns = TYPE_UNSIGNED (result_type);
- tree type;
-
final_type = result_type;
-
- /* Handle the case that OP0 does not *contain* a conversion
- but it *requires* conversion to FINAL_TYPE. */
-
- if (op0 == arg0 && TREE_TYPE (op0) != final_type)
- unsigned0 = TYPE_UNSIGNED (TREE_TYPE (op0));
- if (op1 == arg1 && TREE_TYPE (op1) != final_type)
- unsigned1 = TYPE_UNSIGNED (TREE_TYPE (op1));
-
- /* Now UNSIGNED0 is 1 if ARG0 zero-extends to FINAL_TYPE. */
-
- /* For bitwise operations, signedness of nominal type
- does not matter. Consider only how operands were extended. */
- if (shorten == -1)
- uns = unsigned0;
-
- /* Note that in all three cases below we refrain from optimizing
- an unsigned operation on sign-extended args.
- That would not be valid. */
-
- /* Both args variable: if both extended in same way
- from same width, do it in that width.
- Do it unsigned if args were zero-extended. */
- if ((TYPE_PRECISION (TREE_TYPE (arg0))
- < TYPE_PRECISION (result_type))
- && (TYPE_PRECISION (TREE_TYPE (arg1))
- == TYPE_PRECISION (TREE_TYPE (arg0)))
- && unsigned0 == unsigned1
- && (unsigned0 || !uns))
- result_type = c_common_signed_or_unsigned_type
- (unsigned0, common_type (TREE_TYPE (arg0), TREE_TYPE (arg1)));
- else if (TREE_CODE (arg0) == INTEGER_CST
- && (unsigned1 || !uns)
- && (TYPE_PRECISION (TREE_TYPE (arg1))
- < TYPE_PRECISION (result_type))
- && (type = c_common_signed_or_unsigned_type
- (unsigned1, TREE_TYPE (arg1)),
- int_fits_type_p (arg0, type)))
- result_type = type;
- else if (TREE_CODE (arg1) == INTEGER_CST
- && (unsigned0 || !uns)
- && (TYPE_PRECISION (TREE_TYPE (arg0))
- < TYPE_PRECISION (result_type))
- && (type = c_common_signed_or_unsigned_type
- (unsigned0, TREE_TYPE (arg0)),
- int_fits_type_p (arg1, type)))
- result_type = type;
+ result_type = shorten_binary_op (result_type, op0, op1,
+ shorten == -1);
}
/* Comparison operations are shortened too but differently.
@@ -3907,115 +3839,11 @@ cp_build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
&& warn_sign_compare
/* Do not warn until the template is instantiated; we cannot
bound the ranges of the arguments until that point. */
- && !processing_template_decl)
+ && !processing_template_decl
+ && (complain & tf_warning))
{
- int op0_signed = !TYPE_UNSIGNED (TREE_TYPE (orig_op0));
- int op1_signed = !TYPE_UNSIGNED (TREE_TYPE (orig_op1));
-
- int unsignedp0, unsignedp1;
- tree primop0 = get_narrower (op0, &unsignedp0);
- tree primop1 = get_narrower (op1, &unsignedp1);
-
- /* Check for comparison of different enum types. */
- if (TREE_CODE (TREE_TYPE (orig_op0)) == ENUMERAL_TYPE
- && TREE_CODE (TREE_TYPE (orig_op1)) == ENUMERAL_TYPE
- && TYPE_MAIN_VARIANT (TREE_TYPE (orig_op0))
- != TYPE_MAIN_VARIANT (TREE_TYPE (orig_op1))
- && (complain & tf_warning))
- {
- warning (OPT_Wsign_compare, "comparison between types %q#T and %q#T",
- TREE_TYPE (orig_op0), TREE_TYPE (orig_op1));
- }
-
- /* Give warnings for comparisons between signed and unsigned
- quantities that may fail. */
- /* Do the checking based on the original operand trees, so that
- casts will be considered, but default promotions won't be. */
-
- /* Do not warn if the comparison is being done in a signed type,
- since the signed type will only be chosen if it can represent
- all the values of the unsigned type. */
- if (!TYPE_UNSIGNED (result_type))
- /* OK */;
- /* Do not warn if both operands are unsigned. */
- else if (op0_signed == op1_signed)
- /* OK */;
- /* Do not warn if the signed quantity is an unsuffixed
- integer literal (or some static constant expression
- involving such literals or a conditional expression
- involving such literals) and it is non-negative. */
- else if ((op0_signed && tree_expr_nonnegative_p (orig_op0))
- || (op1_signed && tree_expr_nonnegative_p (orig_op1)))
- /* OK */;
- /* Do not warn if the comparison is an equality operation,
- the unsigned quantity is an integral constant and it does
- not use the most significant bit of result_type. */
- else if ((resultcode == EQ_EXPR || resultcode == NE_EXPR)
- && ((op0_signed && TREE_CODE (orig_op1) == INTEGER_CST
- && int_fits_type_p (orig_op1, c_common_signed_type
- (result_type)))
- || (op1_signed && TREE_CODE (orig_op0) == INTEGER_CST
- && int_fits_type_p (orig_op0, c_common_signed_type
- (result_type)))))
- /* OK */;
- else if (complain & tf_warning)
- warning (OPT_Wsign_compare,
- "comparison between signed and unsigned integer expressions");
-
- /* Warn if two unsigned values are being compared in a size
- larger than their original size, and one (and only one) is the
- result of a `~' operator. This comparison will always fail.
-
- Also warn if one operand is a constant, and the constant does not
- have all bits set that are set in the ~ operand when it is
- extended. */
-
- if ((TREE_CODE (primop0) == BIT_NOT_EXPR)
- ^ (TREE_CODE (primop1) == BIT_NOT_EXPR))
- {
- if (TREE_CODE (primop0) == BIT_NOT_EXPR)
- primop0 = get_narrower (TREE_OPERAND (op0, 0), &unsignedp0);
- if (TREE_CODE (primop1) == BIT_NOT_EXPR)
- primop1 = get_narrower (TREE_OPERAND (op1, 0), &unsignedp1);
-
- if (host_integerp (primop0, 0) || host_integerp (primop1, 0))
- {
- tree primop;
- HOST_WIDE_INT constant, mask;
- int unsignedp;
- unsigned int bits;
-
- if (host_integerp (primop0, 0))
- {
- primop = primop1;
- unsignedp = unsignedp1;
- constant = tree_low_cst (primop0, 0);
- }
- else
- {
- primop = primop0;
- unsignedp = unsignedp0;
- constant = tree_low_cst (primop1, 0);
- }
-
- bits = TYPE_PRECISION (TREE_TYPE (primop));
- if (bits < TYPE_PRECISION (result_type)
- && bits < HOST_BITS_PER_LONG && unsignedp)
- {
- mask = (~ (HOST_WIDE_INT) 0) << bits;
- if ((mask & constant) != mask
- && (complain & tf_warning))
- warning (OPT_Wsign_compare, "comparison of promoted ~unsigned with constant");
- }
- }
- else if (unsignedp0 && unsignedp1
- && (TYPE_PRECISION (TREE_TYPE (primop0))
- < TYPE_PRECISION (result_type))
- && (TYPE_PRECISION (TREE_TYPE (primop1))
- < TYPE_PRECISION (result_type))
- && (complain & tf_warning))
- warning (OPT_Wsign_compare, "comparison of promoted ~unsigned with unsigned");
- }
+ warn_for_sign_compare (orig_op0, orig_op1, op0, op1,
+ result_type, resultcode);
}
}
@@ -4101,15 +3929,12 @@ pointer_diff (tree op0, tree op1, tree ptrtype)
if (!complete_type_or_else (target_type, NULL_TREE))
return error_mark_node;
- if (pedantic || warn_pointer_arith)
- {
- if (TREE_CODE (target_type) == VOID_TYPE)
- permerror ("ISO C++ forbids using pointer of type %<void *%> in subtraction");
- if (TREE_CODE (target_type) == FUNCTION_TYPE)
- permerror ("ISO C++ forbids using pointer to a function in subtraction");
- if (TREE_CODE (target_type) == METHOD_TYPE)
- permerror ("ISO C++ forbids using pointer to a method in subtraction");
- }
+ if (TREE_CODE (target_type) == VOID_TYPE)
+ permerror ("ISO C++ forbids using pointer of type %<void *%> in subtraction");
+ if (TREE_CODE (target_type) == FUNCTION_TYPE)
+ permerror ("ISO C++ forbids using pointer to a function in subtraction");
+ if (TREE_CODE (target_type) == METHOD_TYPE)
+ permerror ("ISO C++ forbids using pointer to a method in subtraction");
/* First do the subtraction as integers;
then drop through to build the divide operator. */
@@ -4559,7 +4384,7 @@ cp_build_unary_op (enum tree_code code, tree xarg, int noconvert,
arg = build1 (CONVERT_EXPR, type, arg);
return arg;
}
- else if (pedantic && DECL_MAIN_P (arg))
+ else if (DECL_MAIN_P (arg))
{
/* ARM $3.4 */
if (complain & tf_error)
@@ -4655,7 +4480,7 @@ cp_build_unary_op (enum tree_code code, tree xarg, int noconvert,
/* Even if we're not being pedantic, we cannot allow this
extension when we're instantiating in a SFINAE
context. */
- if (! lvalue_p (arg) && (pedantic || complain == tf_none))
+ if (! lvalue_p (arg) && complain == tf_none)
{
if (complain & tf_error)
permerror ("ISO C++ forbids taking the address of a cast to a non-lvalue expression");
@@ -4713,15 +4538,7 @@ cp_build_unary_op (enum tree_code code, tree xarg, int noconvert,
/* In a template, we are processing a non-dependent expression
so we can just form an ADDR_EXPR with the correct type. */
- if (processing_template_decl)
- {
- val = build_address (arg);
- if (TREE_CODE (arg) == OFFSET_REF)
- PTRMEM_OK_P (val) = PTRMEM_OK_P (arg);
- return val;
- }
-
- if (TREE_CODE (arg) != COMPONENT_REF)
+ if (processing_template_decl || TREE_CODE (arg) != COMPONENT_REF)
{
val = build_address (arg);
if (TREE_CODE (arg) == OFFSET_REF)
@@ -5443,7 +5260,8 @@ convert_member_func_to_ptr (tree type, tree expr)
|| TREE_CODE (intype) == METHOD_TYPE);
if (pedantic || warn_pmf2ptr)
- pedwarn ("converting from %qT to %qT", intype, type);
+ pedwarn (pedantic ? OPT_pedantic : OPT_Wpmf_conversions,
+ "converting from %qT to %qT", intype, type);
if (TREE_CODE (intype) == METHOD_TYPE)
expr = build_addr_func (expr);
@@ -6184,7 +6002,7 @@ cp_build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs,
from_array = TREE_CODE (TREE_TYPE (newrhs)) == ARRAY_TYPE
? 1 + (modifycode != INIT_EXPR): 0;
return build_vec_init (lhs, NULL_TREE, newrhs,
- /*explicit_default_init_p=*/false,
+ /*explicit_value_init_p=*/false,
from_array, complain);
}
@@ -6980,7 +6798,6 @@ check_return_expr (tree retval, bool *no_warning)
else
permerror ("return-statement with a value, in function "
"returning 'void'");
-
current_function_returns_null = 1;
/* There's really no value to return, after all. */
@@ -7347,7 +7164,8 @@ cp_apply_type_quals_to_decl (int type_quals, tree decl)
if (pedantic)
{
tree bad_type = build_qualified_type (type, type_quals);
- pedwarn ("ignoring %qV qualifiers added to function type %qT",
+ pedwarn (OPT_pedantic,
+ "ignoring %qV qualifiers added to function type %qT",
bad_type, type);
}
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index 4cf8021964f..bca95e970f1 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -332,22 +332,18 @@ abstract_virtuals_error (tree decl, tree type)
/* Print an error message for invalid use of an incomplete type.
VALUE is the expression that was used (or 0 if that isn't known)
- and TYPE is the type that was invalid. DIAG_TYPE indicates the
- type of diagnostic: 0 for an error, 1 for a warning, 2 for a
- pedwarn. */
+ and TYPE is the type that was invalid. DIAG_KIND indicates the
+ type of diagnostic (see diagnostic.def). */
void
-cxx_incomplete_type_diagnostic (const_tree value, const_tree type, int diag_type)
+cxx_incomplete_type_diagnostic (const_tree value, const_tree type,
+ diagnostic_t diag_kind)
{
int decl = 0;
- void (*p_msg) (const char *, ...) ATTRIBUTE_GCC_CXXDIAG(1,2);
- if (diag_type == 1)
- p_msg = warning0;
- else if (diag_type == 2)
- p_msg = pedwarn;
- else
- p_msg = error;
+ gcc_assert (diag_kind == DK_WARNING
+ || diag_kind == DK_PEDWARN
+ || diag_kind == DK_ERROR);
/* Avoid duplicate error message. */
if (TREE_CODE (type) == ERROR_MARK)
@@ -357,7 +353,8 @@ cxx_incomplete_type_diagnostic (const_tree value, const_tree type, int diag_type
|| TREE_CODE (value) == PARM_DECL
|| TREE_CODE (value) == FIELD_DECL))
{
- p_msg ("%q+D has incomplete type", value);
+ emit_diagnostic (diag_kind, input_location, 0,
+ "%q+D has incomplete type", value);
decl = 1;
}
retry:
@@ -369,15 +366,19 @@ cxx_incomplete_type_diagnostic (const_tree value, const_tree type, int diag_type
case UNION_TYPE:
case ENUMERAL_TYPE:
if (!decl)
- p_msg ("invalid use of incomplete type %q#T", type);
+ emit_diagnostic (diag_kind, input_location, 0,
+ "invalid use of incomplete type %q#T", type);
if (!TYPE_TEMPLATE_INFO (type))
- p_msg ("forward declaration of %q+#T", type);
+ emit_diagnostic (diag_kind, input_location, 0,
+ "forward declaration of %q+#T", type);
else
- p_msg ("declaration of %q+#T", type);
+ emit_diagnostic (diag_kind, input_location, 0,
+ "declaration of %q+#T", type);
break;
case VOID_TYPE:
- p_msg ("invalid use of %qT", type);
+ emit_diagnostic (diag_kind, input_location, 0,
+ "invalid use of %qT", type);
break;
case ARRAY_TYPE:
@@ -386,37 +387,45 @@ cxx_incomplete_type_diagnostic (const_tree value, const_tree type, int diag_type
type = TREE_TYPE (type);
goto retry;
}
- p_msg ("invalid use of array with unspecified bounds");
+ emit_diagnostic (diag_kind, input_location, 0,
+ "invalid use of array with unspecified bounds");
break;
case OFFSET_TYPE:
bad_member:
- p_msg ("invalid use of member (did you forget the %<&%> ?)");
+ emit_diagnostic (diag_kind, input_location, 0,
+ "invalid use of member (did you forget the %<&%> ?)");
break;
case TEMPLATE_TYPE_PARM:
- p_msg ("invalid use of template type parameter %qT", type);
+ emit_diagnostic (diag_kind, input_location, 0,
+ "invalid use of template type parameter %qT", type);
break;
case BOUND_TEMPLATE_TEMPLATE_PARM:
- p_msg ("invalid use of template template parameter %qT",
- TYPE_NAME (type));
+ emit_diagnostic (diag_kind, input_location, 0,
+ "invalid use of template template parameter %qT",
+ TYPE_NAME (type));
break;
case TYPENAME_TYPE:
- p_msg ("invalid use of dependent type %qT", type);
+ emit_diagnostic (diag_kind, input_location, 0,
+ "invalid use of dependent type %qT", type);
break;
case UNKNOWN_TYPE:
if (value && TREE_CODE (value) == COMPONENT_REF)
goto bad_member;
else if (value && TREE_CODE (value) == ADDR_EXPR)
- p_msg ("address of overloaded function with no contextual "
- "type information");
+ emit_diagnostic (diag_kind, input_location, 0,
+ "address of overloaded function with no contextual "
+ "type information");
else if (value && TREE_CODE (value) == OVERLOAD)
- p_msg ("overloaded function with no contextual type information");
+ emit_diagnostic (diag_kind, input_location, 0,
+ "overloaded function with no contextual type information");
else
- p_msg ("insufficient contextual information to determine type");
+ emit_diagnostic (diag_kind, input_location, 0,
+ "insufficient contextual information to determine type");
break;
default:
@@ -430,7 +439,7 @@ cxx_incomplete_type_diagnostic (const_tree value, const_tree type, int diag_type
void
cxx_incomplete_type_error (const_tree value, const_tree type)
{
- cxx_incomplete_type_diagnostic (value, type, 0);
+ cxx_incomplete_type_diagnostic (value, type, DK_ERROR);
}
@@ -640,9 +649,13 @@ check_narrowing (tree type, tree init)
tree ftype = TREE_TYPE (init);
bool ok = true;
REAL_VALUE_TYPE d;
+ bool was_decl = false;
if (DECL_P (init))
- init = decl_constant_value (init);
+ {
+ was_decl = true;
+ init = decl_constant_value (init);
+ }
if (TREE_CODE (type) == INTEGER_TYPE
&& TREE_CODE (ftype) == REAL_TYPE)
@@ -664,7 +677,12 @@ check_narrowing (tree type, tree init)
if (TREE_CODE (init) == REAL_CST)
{
d = TREE_REAL_CST (init);
- if (exact_real_truncate (TYPE_MODE (type), &d))
+ if (exact_real_truncate (TYPE_MODE (type), &d)
+ /* FIXME: As a temporary workaround for PR 36963, don't
+ complain about narrowing from a floating
+ literal. Hopefully this will be resolved at the
+ September 2008 C++ meeting. */
+ || !was_decl)
ok = true;
}
}
@@ -727,17 +745,26 @@ digest_init_r (tree type, tree init, bool nested)
{
tree char_type = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (init)));
- if (char_type != char_type_node
- && TYPE_PRECISION (typ1) == BITS_PER_UNIT)
+ if (TYPE_PRECISION (typ1) == BITS_PER_UNIT)
{
- error ("char-array initialized from wide string");
- return error_mark_node;
+ if (char_type != char_type_node)
+ {
+ error ("char-array initialized from wide string");
+ return error_mark_node;
+ }
}
- if (char_type == char_type_node
- && TYPE_PRECISION (typ1) != BITS_PER_UNIT)
+ else
{
- error ("int-array initialized from non-wide string");
- return error_mark_node;
+ if (char_type == char_type_node)
+ {
+ error ("int-array initialized from non-wide string");
+ return error_mark_node;
+ }
+ else if (char_type != typ1)
+ {
+ error ("int-array initialized from incompatible wide string");
+ return error_mark_node;
+ }
}
TREE_TYPE (init) = type;
@@ -1465,7 +1492,7 @@ add_exception_specifier (tree list, tree spec, int complain)
bool ok;
tree core = spec;
bool is_ptr;
- int diag_type = -1; /* none */
+ diagnostic_t diag_type = DK_UNSPECIFIED; /* none */
if (spec == error_mark_node)
return list;
@@ -1494,7 +1521,7 @@ add_exception_specifier (tree list, tree spec, int complain)
and calls. So just give a pedwarn at this point; we will give an
error later if we hit one of those two cases. */
if (!COMPLETE_TYPE_P (complete_type (core)))
- diag_type = 2; /* pedwarn */
+ diag_type = DK_PEDWARN; /* pedwarn */
}
if (ok)
@@ -1508,9 +1535,9 @@ add_exception_specifier (tree list, tree spec, int complain)
list = tree_cons (NULL_TREE, spec, list);
}
else
- diag_type = 0; /* error */
+ diag_type = DK_ERROR; /* error */
- if (diag_type >= 0 && complain)
+ if (diag_type != DK_UNSPECIFIED && complain)
cxx_incomplete_type_diagnostic (NULL_TREE, core, diag_type);
return list;
diff --git a/gcc/debug.h b/gcc/debug.h
index cab1e2603e2..6cdf7863a25 100644
--- a/gcc/debug.h
+++ b/gcc/debug.h
@@ -160,6 +160,7 @@ extern void dwarf2out_frame_finish (void);
/* Decide whether we want to emit frame unwind information for the current
translation unit. */
extern int dwarf2out_do_frame (void);
+extern int dwarf2out_do_cfi_asm (void);
extern void dwarf2out_switch_text_section (void);
extern void debug_flush_symbol_queue (void);
diff --git a/gcc/defaults.h b/gcc/defaults.h
index 3eecd8db81a..282a14ac00a 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -551,12 +551,24 @@ along with GCC; see the file COPYING3. If not see
#define PUSH_ARGS_REVERSED 0
#endif
+/* Default value for the alignment (in bits) a C conformant malloc has to
+ provide. This default is intended to be safe and always correct. */
+#ifndef MALLOC_ABI_ALIGNMENT
+#define MALLOC_ABI_ALIGNMENT BITS_PER_WORD
+#endif
+
/* If PREFERRED_STACK_BOUNDARY is not defined, set it to STACK_BOUNDARY.
STACK_BOUNDARY is required. */
#ifndef PREFERRED_STACK_BOUNDARY
#define PREFERRED_STACK_BOUNDARY STACK_BOUNDARY
#endif
+/* Set INCOMING_STACK_BOUNDARY to PREFERRED_STACK_BOUNDARY if it is not
+ defined. */
+#ifndef INCOMING_STACK_BOUNDARY
+#define INCOMING_STACK_BOUNDARY PREFERRED_STACK_BOUNDARY
+#endif
+
#ifndef TARGET_DEFAULT_PACK_STRUCT
#define TARGET_DEFAULT_PACK_STRUCT 0
#endif
@@ -651,16 +663,6 @@ along with GCC; see the file COPYING3. If not see
#define PREFERRED_DEBUGGING_TYPE NO_DEBUG
#endif
-/* Define codes for all the float formats that we know of. */
-#define UNKNOWN_FLOAT_FORMAT 0
-#define IEEE_FLOAT_FORMAT 1
-#define VAX_FLOAT_FORMAT 2
-
-/* Default to IEEE float if not specified. Nearly all machines use it. */
-#ifndef TARGET_FLOAT_FORMAT
-#define TARGET_FLOAT_FORMAT IEEE_FLOAT_FORMAT
-#endif
-
#ifndef LARGEST_EXPONENT_IS_NORMAL
#define LARGEST_EXPONENT_IS_NORMAL(SIZE) 0
#endif
@@ -669,32 +671,6 @@ along with GCC; see the file COPYING3. If not see
#define ROUND_TOWARDS_ZERO 0
#endif
-#ifndef MODE_HAS_NANS
-#define MODE_HAS_NANS(MODE) \
- (FLOAT_MODE_P (MODE) \
- && TARGET_FLOAT_FORMAT == IEEE_FLOAT_FORMAT \
- && !LARGEST_EXPONENT_IS_NORMAL (GET_MODE_BITSIZE (MODE)))
-#endif
-
-#ifndef MODE_HAS_INFINITIES
-#define MODE_HAS_INFINITIES(MODE) \
- (FLOAT_MODE_P (MODE) \
- && TARGET_FLOAT_FORMAT == IEEE_FLOAT_FORMAT \
- && !LARGEST_EXPONENT_IS_NORMAL (GET_MODE_BITSIZE (MODE)))
-#endif
-
-#ifndef MODE_HAS_SIGNED_ZEROS
-#define MODE_HAS_SIGNED_ZEROS(MODE) \
- (FLOAT_MODE_P (MODE) && TARGET_FLOAT_FORMAT == IEEE_FLOAT_FORMAT)
-#endif
-
-#ifndef MODE_HAS_SIGN_DEPENDENT_ROUNDING
-#define MODE_HAS_SIGN_DEPENDENT_ROUNDING(MODE) \
- (FLOAT_MODE_P (MODE) \
- && TARGET_FLOAT_FORMAT == IEEE_FLOAT_FORMAT \
- && !ROUND_TOWARDS_ZERO)
-#endif
-
#ifndef FLOAT_LIB_COMPARE_RETURNS_BOOL
#define FLOAT_LIB_COMPARE_RETURNS_BOOL(MODE, COMPARISON) false
#endif
@@ -944,6 +920,21 @@ along with GCC; see the file COPYING3. If not see
#define OUTGOING_REG_PARM_STACK_SPACE(FNTYPE) 0
#endif
+/* MAX_STACK_ALIGNMENT is the maximum stack alignment guaranteed by
+ the backend. MAX_SUPPORTED_STACK_ALIGNMENT is the maximum best
+ effort stack alignment supported by the backend. If the backend
+ supports stack alignment, MAX_SUPPORTED_STACK_ALIGNMENT and
+ MAX_STACK_ALIGNMENT are the same. Otherwise, the incoming stack
+ boundary will limit the maximum guaranteed stack alignment. */
+#ifdef MAX_STACK_ALIGNMENT
+#define MAX_SUPPORTED_STACK_ALIGNMENT MAX_STACK_ALIGNMENT
+#else
+#define MAX_STACK_ALIGNMENT STACK_BOUNDARY
+#define MAX_SUPPORTED_STACK_ALIGNMENT PREFERRED_STACK_BOUNDARY
+#endif
+
+#define SUPPORTS_STACK_ALIGNMENT (MAX_STACK_ALIGNMENT > STACK_BOUNDARY)
+
#ifndef LOCAL_ALIGNMENT
#define LOCAL_ALIGNMENT(TYPE, ALIGNMENT) ALIGNMENT
#endif
diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c
index 5a6aaee914d..54c2da74374 100644
--- a/gcc/diagnostic.c
+++ b/gcc/diagnostic.c
@@ -41,6 +41,8 @@ along with GCC; see the file COPYING3. If not see
#include "langhooks-def.h"
#include "opts.h"
+#define pedantic_warning_kind() (flag_pedantic_errors ? DK_ERROR : DK_WARNING)
+#define permissive_error_kind() (flag_permissive ? DK_WARNING : DK_ERROR)
/* Prototypes. */
static char *build_message_string (const char *, ...) ATTRIBUTE_PRINTF_1;
@@ -293,20 +295,25 @@ diagnostic_classify_diagnostic (diagnostic_context *context,
DC. This function is *the* subroutine in terms of which front-ends
should implement their specific diagnostic handling modules. The
front-end independent format specifiers are exactly those described
- in the documentation of output_format. */
+ in the documentation of output_format.
+ Return true if a diagnostic was printed, false otherwise. */
-void
+bool
diagnostic_report_diagnostic (diagnostic_context *context,
diagnostic_info *diagnostic)
{
+ location_t location = diagnostic->location;
bool maybe_print_warnings_as_errors_message = false;
const char *saved_format_spec;
/* Give preference to being able to inhibit warnings, before they
get reclassified to something else. */
- if (diagnostic->kind == DK_WARNING
- && !diagnostic_report_warnings_p ())
- return;
+ if ((diagnostic->kind == DK_WARNING || diagnostic->kind == DK_PEDWARN)
+ && !diagnostic_report_warnings_p (location))
+ return false;
+
+ if (diagnostic->kind == DK_PEDWARN)
+ diagnostic->kind = pedantic_warning_kind ();
if (context->lock > 0)
{
@@ -335,7 +342,7 @@ diagnostic_report_diagnostic (diagnostic_context *context,
/* This tests if the user provided the appropriate -Wfoo or
-Wno-foo option. */
if (! option_enabled (diagnostic->option_index))
- return;
+ return false;
/* This tests if the user provided the appropriate -Werror=foo
option. */
if (context->classify_diagnostic[diagnostic->option_index] != DK_UNSPECIFIED)
@@ -346,7 +353,7 @@ diagnostic_report_diagnostic (diagnostic_context *context,
/* This allows for future extensions, like temporarily disabling
warnings for ranges of source code. */
if (diagnostic->kind == DK_IGNORED)
- return;
+ return false;
}
/* If we changed the kind due to -Werror, and didn't override it, we
@@ -402,6 +409,8 @@ diagnostic_report_diagnostic (diagnostic_context *context,
diagnostic->abstract_origin = NULL;
context->lock--;
+
+ return true;
}
/* Given a partial pathname as input, return another pathname that
@@ -456,6 +465,30 @@ verbatim (const char *gmsgid, ...)
va_end (ap);
}
+bool
+emit_diagnostic (diagnostic_t kind, location_t location, int opt,
+ const char *gmsgid, ...)
+{
+ diagnostic_info diagnostic;
+ va_list ap;
+
+ va_start (ap, gmsgid);
+ if (kind == DK_PERMERROR)
+ {
+ diagnostic_set_info (&diagnostic, gmsgid, &ap, location,
+ permissive_error_kind ());
+ diagnostic.option_index = OPT_fpermissive;
+ }
+ else {
+ diagnostic_set_info (&diagnostic, gmsgid, &ap, location, kind);
+ if (kind == DK_WARNING || kind == DK_PEDWARN)
+ diagnostic.option_index = opt;
+ }
+ va_end (ap);
+
+ return report_diagnostic (&diagnostic);
+}
+
/* An informative note. Use this for additional details on an error
message. */
void
@@ -470,9 +503,10 @@ inform (const char *gmsgid, ...)
va_end (ap);
}
-/* A warning. Use this for code which is correct according to the
- relevant language specification but is likely to be buggy anyway. */
-void
+/* A warning at INPUT_LOCATION. Use this for code which is correct according
+ to the relevant language specification but is likely to be buggy anyway.
+ Returns true if the warning was printed, false if it was inhibited. */
+bool
warning (int opt, const char *gmsgid, ...)
{
diagnostic_info diagnostic;
@@ -482,49 +516,92 @@ warning (int opt, const char *gmsgid, ...)
diagnostic_set_info (&diagnostic, gmsgid, &ap, input_location, DK_WARNING);
diagnostic.option_index = opt;
- report_diagnostic (&diagnostic);
va_end (ap);
+ return report_diagnostic (&diagnostic);
}
-void
-warning0 (const char *gmsgid, ...)
+/* A warning at LOCATION. Use this for code which is correct according to the
+ relevant language specification but is likely to be buggy anyway.
+ Returns true if the warning was printed, false if it was inhibited. */
+
+bool
+warning_at (location_t location, int opt, const char *gmsgid, ...)
{
diagnostic_info diagnostic;
va_list ap;
va_start (ap, gmsgid);
- diagnostic_set_info (&diagnostic, gmsgid, &ap, input_location, DK_WARNING);
- report_diagnostic (&diagnostic);
+ diagnostic_set_info (&diagnostic, gmsgid, &ap, location, DK_WARNING);
+ diagnostic.option_index = opt;
va_end (ap);
+ return report_diagnostic (&diagnostic);
}
-/* A "pedantic" warning: issues a warning unless -pedantic-errors was
- given on the command line, in which case it issues an error. Use
- this for diagnostics required by the relevant language standard,
- if you have chosen not to make them errors.
+/* A "pedantic" warning at LOCATION: issues a warning unless
+ -pedantic-errors was given on the command line, in which case it
+ issues an error. Use this for diagnostics required by the relevant
+ language standard, if you have chosen not to make them errors.
Note that these diagnostics are issued independent of the setting
of the -pedantic command-line switch. To get a warning enabled
- only with that switch, write "if (pedantic) pedwarn (...);" */
-void
-pedwarn (const char *gmsgid, ...)
+ only with that switch, use either "if (pedantic) pedwarn
+ (OPT_pedantic,...)" or just "pedwarn (OPT_pedantic,..)". To get a
+ pedwarn independently of the -pedantic switch use "pedwarn (0,...)".
+
+ Returns true if the warning was printed, false if it was inhibited. */
+
+bool
+pedwarn_at (location_t location, int opt, const char *gmsgid, ...)
{
diagnostic_info diagnostic;
va_list ap;
va_start (ap, gmsgid);
- diagnostic_set_info (&diagnostic, gmsgid, &ap, input_location,
- pedantic_warning_kind ());
- report_diagnostic (&diagnostic);
+ diagnostic_set_info (&diagnostic, gmsgid, &ap, location, DK_PEDWARN);
+ diagnostic.option_index = opt;
va_end (ap);
+ return report_diagnostic (&diagnostic);
}
-/* A "permissive" error: issues an error unless -fpermissive was given
- on the command line, in which case it issues a warning. Use this
- for things that really should be errors but we want to support
- legacy code. */
+/* Equivalent to pedwarn_at using INPUT_LOCATION. */
-void
+bool
+pedwarn (int opt, const char *gmsgid, ...)
+{
+ diagnostic_info diagnostic;
+ va_list ap;
+
+ va_start (ap, gmsgid);
+ diagnostic_set_info (&diagnostic, gmsgid, &ap, input_location, DK_PEDWARN);
+ diagnostic.option_index = opt;
+ va_end (ap);
+ return report_diagnostic (&diagnostic);
+}
+
+/* A "permissive" error at LOCATION: issues an error unless
+ -fpermissive was given on the command line, in which case it issues
+ a warning. Use this for things that really should be errors but we
+ want to support legacy code.
+
+ Returns true if the warning was printed, false if it was inhibited. */
+
+bool
+permerror_at (location_t location, const char *gmsgid, ...)
+{
+ diagnostic_info diagnostic;
+ va_list ap;
+
+ va_start (ap, gmsgid);
+ diagnostic_set_info (&diagnostic, gmsgid, &ap, location,
+ permissive_error_kind ());
+ diagnostic.option_index = OPT_fpermissive;
+ va_end (ap);
+ return report_diagnostic (&diagnostic);
+}
+
+/* Equivalent to permerror_at (input_location, ...). */
+
+bool
permerror (const char *gmsgid, ...)
{
diagnostic_info diagnostic;
@@ -534,8 +611,8 @@ permerror (const char *gmsgid, ...)
diagnostic_set_info (&diagnostic, gmsgid, &ap, input_location,
permissive_error_kind ());
diagnostic.option_index = OPT_fpermissive;
- report_diagnostic (&diagnostic);
va_end (ap);
+ return report_diagnostic (&diagnostic);
}
diff --git a/gcc/diagnostic.def b/gcc/diagnostic.def
index bbdba2f1aa2..39064198eae 100644
--- a/gcc/diagnostic.def
+++ b/gcc/diagnostic.def
@@ -20,4 +20,8 @@ DEFINE_DIAGNOSTIC_KIND (DK_WARNING, "warning: ")
DEFINE_DIAGNOSTIC_KIND (DK_ANACHRONISM, "anachronism: ")
DEFINE_DIAGNOSTIC_KIND (DK_NOTE, "note: ")
DEFINE_DIAGNOSTIC_KIND (DK_DEBUG, "debug: ")
+/* These two would be re-classified as DK_WARNING or DK_ERROR, so the
+prefix does not matter. */
+DEFINE_DIAGNOSTIC_KIND (DK_PEDWARN, "pedwarn: ")
+DEFINE_DIAGNOSTIC_KIND (DK_PERMERROR, "permerror: ")
diff --git a/gcc/diagnostic.h b/gcc/diagnostic.h
index a249574d4aa..19bc5e9c8d0 100644
--- a/gcc/diagnostic.h
+++ b/gcc/diagnostic.h
@@ -50,10 +50,6 @@ typedef struct diagnostic_info
int option_index;
} diagnostic_info;
-#define pedantic_warning_kind() (flag_pedantic_errors ? DK_ERROR : DK_WARNING)
-#define permissive_error_kind() (flag_permissive ? DK_WARNING : DK_ERROR)
-
-
/* Forward declarations. */
typedef struct diagnostic_context diagnostic_context;
typedef void (*diagnostic_starter_fn) (diagnostic_context *,
@@ -82,7 +78,7 @@ struct diagnostic_context
the diagnostic should be changed to before reporting, or
DK_UNSPECIFIED to leave it as the reported kind, or DK_IGNORED to
not report it at all. N_OPTS is from <options.h>. */
- char classify_diagnostic[N_OPTS];
+ diagnostic_t classify_diagnostic[N_OPTS];
/* True if we should print the command line option which controls
each diagnostic, if known. */
@@ -183,9 +179,9 @@ extern diagnostic_context *global_dc;
#define sorrycount diagnostic_kind_count (global_dc, DK_SORRY)
/* Returns nonzero if warnings should be emitted. */
-#define diagnostic_report_warnings_p() \
+#define diagnostic_report_warnings_p(LOC) \
(!inhibit_warnings \
- && !(in_system_header && !warn_system_headers))
+ && !(in_system_header_at (LOC) && !warn_system_headers))
#define report_diagnostic(D) diagnostic_report_diagnostic (global_dc, D)
@@ -199,7 +195,7 @@ extern void diagnostic_report_current_function (diagnostic_context *,
extern diagnostic_t diagnostic_classify_diagnostic (diagnostic_context *,
int /* optidx */,
diagnostic_t /* kind */);
-extern void diagnostic_report_diagnostic (diagnostic_context *,
+extern bool diagnostic_report_diagnostic (diagnostic_context *,
diagnostic_info *);
#ifdef ATTRIBUTE_GCC_DIAG
extern void diagnostic_set_info (diagnostic_info *, const char *, va_list *,
@@ -208,6 +204,8 @@ extern void diagnostic_set_info_translated (diagnostic_info *, const char *,
va_list *, location_t,
diagnostic_t)
ATTRIBUTE_GCC_DIAG(2,0);
+extern bool emit_diagnostic (diagnostic_t, location_t, int,
+ const char *, ...) ATTRIBUTE_GCC_DIAG(4,5);
#endif
extern char *diagnostic_build_prefix (diagnostic_info *);
@@ -215,14 +213,24 @@ extern char *diagnostic_build_prefix (diagnostic_info *);
extern char *file_name_as_prefix (const char *);
/* In tree-pretty-print.c */
+extern void print_declaration (pretty_printer *, tree, int, int);
extern int dump_generic_node (pretty_printer *, tree, int, int, bool);
extern void print_generic_stmt (FILE *, tree, int);
extern void print_generic_stmt_indented (FILE *, tree, int, int);
extern void print_generic_expr (FILE *, tree, int);
extern void print_generic_decl (FILE *, tree, int);
+extern void debug_c_tree (tree);
+extern void dump_omp_clauses (pretty_printer *, tree, int, int);
+/* In gimple-pretty-print.c */
extern void debug_generic_expr (tree);
extern void debug_generic_stmt (tree);
extern void debug_tree_chain (tree);
-extern void debug_c_tree (tree);
+extern void debug_gimple_stmt (gimple);
+extern void debug_gimple_seq (gimple_seq);
+extern void print_gimple_seq (FILE *, gimple_seq, int, int);
+extern void print_gimple_stmt (FILE *, gimple, int, int);
+extern void print_gimple_expr (FILE *, gimple, int, int);
+extern void dump_gimple_stmt (pretty_printer *, gimple, int, int);
+
#endif /* ! GCC_DIAGNOSTIC_H */
diff --git a/gcc/doc/c-tree.texi b/gcc/doc/c-tree.texi
index 1f019763d09..6eef7d12ef3 100644
--- a/gcc/doc/c-tree.texi
+++ b/gcc/doc/c-tree.texi
@@ -1330,6 +1330,8 @@ a containing function, and the back end must take appropriate action.
@findex DECL_GLOBAL_CTOR_P
@findex DECL_GLOBAL_DTOR_P
@findex GLOBAL_INIT_PRIORITY
+@findex DECL_FUNCTION_SPECIFIC_TARGET
+@findex DECL_FUNCTION_SPECIFIC_OPTIMIZATION
The following macros and functions can be used on a @code{FUNCTION_DECL}:
@ftable @code
@@ -1514,6 +1516,17 @@ is of the form `@code{()}'.
This predicate holds if the function an overloaded
@code{operator delete[]}.
+@item DECL_FUNCTION_SPECIFIC_TARGET
+This macro returns a tree node that holds the target options that are
+to be used to compile this particular function or @code{NULL_TREE} if
+the function is to be compiled with the target options specified on
+the command line.
+
+@item DECL_FUNCTION_SPECIFIC_OPTIMIZATION
+This macro returns a tree node that holds the optimization options
+that are to be used to compile this particular function or
+@code{NULL_TREE} if the function is to be compiled with the
+optimization options specified on the command line.
@end ftable
@c ---------------------------------------------------------------------
diff --git a/gcc/doc/cpp.texi b/gcc/doc/cpp.texi
index 7b5eb7f2835..0eaece14d45 100644
--- a/gcc/doc/cpp.texi
+++ b/gcc/doc/cpp.texi
@@ -15,7 +15,7 @@ Copyright @copyright{} 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996,
Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
-under the terms of the GNU Free Documentation License, Version 1.1 or
+under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation. A copy of
the license is included in the
@c man end
@@ -2239,6 +2239,10 @@ If GCC cannot determine the current date, it will emit a warning message
These macros are defined when the target processor supports atomic compare
and swap operations on operands 1, 2, 4, 8 or 16 bytes in length, respectively.
+@item __GCC_HAVE_DWARF2_CFI_ASM
+This macro is defined when the compiler is emitting Dwarf2 CFI directives
+to the assembler. When this is defined, it is possible to emit those same
+directives in inline assembly.
@end table
@node System-specific Predefined Macros
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 4a4c9a3a4a1..66fb8401c78 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -1792,6 +1792,8 @@ the enclosing block.
@cindex functions that are passed arguments in registers on the 386
@cindex functions that pop the argument stack on the 386
@cindex functions that do not pop the argument stack on the 386
+@cindex functions that have different compilation options on the 386
+@cindex functions that have different optimization options
In GNU C, you declare certain things about functions called in your program
which help the compiler optimize function calls and check your code more
@@ -1945,8 +1947,7 @@ body.
Generally, inlining into a function is limited. For a function marked with
this attribute, every call inside this function will be inlined, if possible.
Whether the function itself is considered for inlining depends on its size and
-the current inlining parameters. The @code{flatten} attribute only works
-reliably in unit-at-a-time mode.
+the current inlining parameters.
@item error ("@var{message}")
@cindex @code{error} function attribute
@@ -2663,6 +2664,207 @@ with the notable exceptions of @code{qsort} and @code{bsearch} that
take function pointer arguments. The @code{nothrow} attribute is not
implemented in GCC versions earlier than 3.3.
+@item option
+@cindex @code{option} function attribute
+The @code{option} attribute is used to specify that a function is to
+be compiled with different target options than specified on the
+command line. This can be used for instance to have functions
+compiled with a different ISA (instruction set architecture) than the
+default. You can also use the @samp{#pragma GCC option} pragma to set
+more than one function to be compiled with specific target options.
+@xref{Function Specific Option Pragmas}, for details about the
+@samp{#pragma GCC option} pragma.
+
+For instance on a 386, you could compile one function with
+@code{option("sse4.1,arch=core2")} and another with
+@code{option("sse4a,arch=amdfam10")} that would be equivalent to
+compiling the first function with @option{-msse4.1} and
+@option{-march=core2} options, and the second function with
+@option{-msse4a} and @option{-march=amdfam10} options. It is up to the
+user to make sure that a function is only invoked on a machine that
+supports the particular ISA it was compiled for (for example by using
+@code{cpuid} on 386 to determine what feature bits and architecture
+family are used).
+
+@smallexample
+int core2_func (void) __attribute__ ((__option__ ("arch=core2")));
+int sse3_func (void) __attribute__ ((__option__ ("sse3")));
+@end smallexample
+
+On the 386, the following options are allowed:
+
+@table @samp
+@item abm
+@itemx no-abm
+@cindex option("abm")
+Enable/disable the generation of the advanced bit instructions.
+
+@item aes
+@itemx no-aes
+@cindex @code{option("aes")} attribute
+Enable/disable the generation of the AES instructions.
+
+@item mmx
+@itemx no-mmx
+@cindex @code{option("mmx")} attribute
+Enable/disable the generation of the MMX instructions.
+
+@item pclmul
+@itemx no-pclmul
+@cindex @code{option("pclmul")} attribute
+Enable/disable the generation of the PCLMUL instructions.
+
+@item popcnt
+@itemx no-popcnt
+@cindex @code{option("popcnt")} attribute
+Enable/disable the generation of the POPCNT instruction.
+
+@item sse
+@itemx no-sse
+@cindex @code{option("sse")} attribute
+Enable/disable the generation of the SSE instructions.
+
+@item sse2
+@itemx no-sse2
+@cindex @code{option("sse2")} attribute
+Enable/disable the generation of the SSE2 instructions.
+
+@item sse3
+@itemx no-sse3
+@cindex @code{option("sse3")} attribute
+Enable/disable the generation of the SSE3 instructions.
+
+@item sse4
+@itemx no-sse4
+@cindex @code{option("sse4")} attribute
+Enable/disable the generation of the SSE4 instructions (both SSE4.1
+and SSE4.2).
+
+@item sse4.1
+@itemx no-sse4.1
+@cindex @code{option("sse4.1")} attribute
+Enable/disable the generation of the sse4.1 instructions.
+
+@item sse4.2
+@itemx no-sse4.2
+@cindex @code{option("sse4.2")} attribute
+Enable/disable the generation of the sse4.2 instructions.
+
+@item sse4a
+@itemx no-sse4a
+@cindex @code{option("sse4a")} attribute
+Enable/disable the generation of the SSE4A instructions.
+
+@item sse5
+@itemx no-sse5
+@cindex @code{option("sse5")} attribute
+Enable/disable the generation of the SSE5 instructions.
+
+@item ssse3
+@itemx no-ssse3
+@cindex @code{option("ssse3")} attribute
+Enable/disable the generation of the SSSE3 instructions.
+
+@item cld
+@itemx no-cld
+@cindex @code{option("cld")} attribute
+Enable/disable the generation of the CLD before string moves.
+
+@item fancy-math-387
+@itemx no-fancy-math-387
+@cindex @code{option("fancy-math-387")} attribute
+Enable/disable the generation of the @code{sin}, @code{cos}, and
+@code{sqrt} instructions on the 387 floating point unit.
+
+@item fused-madd
+@itemx no-fused-madd
+@cindex @code{option("fused-madd")} attribute
+Enable/disable the generation of the fused multiply/add instructions.
+
+@item ieee-fp
+@itemx no-ieee-fp
+@cindex @code{option("ieee-fp")} attribute
+Enable/disable the generation of floating point that depends on IEEE arithmetic.
+
+@item inline-all-stringops
+@itemx no-inline-all-stringops
+@cindex @code{option("inline-all-stringops")} attribute
+Enable/disable inlining of string operations.
+
+@item inline-stringops-dynamically
+@itemx no-inline-stringops-dynamically
+@cindex @code{option("inline-stringops-dynamically")} attribute
+Enable/disable the generation of the inline code to do small string
+operations and calling the library routines for large operations.
+
+@item align-stringops
+@itemx no-align-stringops
+@cindex @code{option("align-stringops")} attribute
+Do/do not align destination of inlined string operations.
+
+@item recip
+@itemx no-recip
+@cindex @code{option("recip")} attribute
+Enable/disable the generation of RCPSS, RCPPS, RSQRTSS and RSQRTPS
+instructions followed an additional Newton-Rhapson step instead of
+doing a floating point division.
+
+@item arch=@var{ARCH}
+@cindex @code{option("arch=@var{ARCH}")} attribute
+Specify the architecture to generate code for in compiling the function.
+
+@item tune=@var{TUNE}
+@cindex @code{option("tune=@var{TUNE}")} attribute
+Specify the architecture to tune for in compiling the function.
+
+@item fpmath=@var{FPMATH}
+@cindex @code{option("fpmath=@var{FPMATH}")} attribute
+Specify which floating point unit to use. The
+@code{option("fpmath=sse,387")} option must be specified as
+@code{option("fpmath=sse+387")} because the comma would separate
+different options.
+@end table
+
+On the 386, you can use either multiple strings to specify multiple
+options, or you can separate the option with a comma (@code{,}).
+
+On the 386, the inliner will not inline a function that has different
+target options than the caller, unless the callee has a subset of the
+target options of the caller. For example a function declared with
+@code{option("sse5")} can inline a function with
+@code{option("sse2")}, since @code{-msse5} implies @code{-msse2}.
+
+The @code{option} attribute is not implemented in GCC versions earlier
+than 4.4, and at present only the 386 uses it.
+
+@item optimize
+@cindex @code{optimize} function attribute
+The @code{optimize} attribute is used to specify that a function is to
+be compiled with different optimization options than specified on the
+command line. Arguments can either be numbers or strings. Numbers
+are assumed to be an optimization level. Strings that begin with
+@code{O} are assumed to be an optimization option, while other options
+are assumed to be used with a @code{-f} prefix. You can also use the
+@samp{#pragma GCC optimize} pragma to set the optimization options
+that affect more than one function.
+@xref{Function Specific Option Pragmas}, for details about the
+@samp{#pragma GCC option} pragma.
+
+This can be used for instance to have frequently executed functions
+compiled with more aggressive optimization options that produce faster
+and larger code, while other functions can be called with less
+aggressive options. On some targets, the @code{hot} attribute implies
+@code{optimize("O3")}, and @code{cold} attribute implies
+@code{optimize("Os")}.
+
+@smallexample
+int fast_func (void) __attribute__ ((__optimize__ ("O3,unroll-loops")));
+int slow_func (void) __attribute__ ((__optimize__ ("Os")));
+@end smallexample
+
+The inliner will not inline functions with a higher optimization level
+than the caller or different space/time trade offs.
+
@item pure
@cindex @code{pure} function attribute
Many functions have no effects except the return value and their
@@ -2698,7 +2900,12 @@ all hot functions appears close together improving locality.
When profile feedback is available, via @option{-fprofile-use}, hot functions
are automatically detected and this attribute is ignored.
-The @code{hot} attribute is not implemented in GCC versions earlier than 4.3.
+The @code{hot} attribute is not implemented in GCC versions earlier
+than 4.3.
+
+Starting with GCC 4.4, the @code{cold} attribute sets
+@code{optimize("O3")} to turn on more aggressive optimization on the
+the i386, x86_64, and IA-64 targets.
@item cold
@cindex @code{cold} function attribute
@@ -2715,7 +2922,11 @@ occasions.
When profile feedback is available, via @option{-fprofile-use}, hot functions
are automatically detected and this attribute is ignored.
-The @code{hot} attribute is not implemented in GCC versions earlier than 4.3.
+The @code{cold} attribute is not implemented in GCC versions earlier than 4.3.
+
+Starting with GCC 4.4, the @code{cold} attribute sets
+@code{optimize("Os")} to save space on the the i386, x86_64, and IA-64
+targets.
@item regparm (@var{number})
@cindex @code{regparm} attribute
@@ -2748,15 +2959,9 @@ floating point arguments on the stack.
@cindex @code{force_align_arg_pointer} attribute
On the Intel x86, the @code{force_align_arg_pointer} attribute may be
applied to individual function definitions, generating an alternate
-prologue and epilogue that realigns the runtime stack. This supports
-mixing legacy codes that run with a 4-byte aligned stack with modern
-codes that keep a 16-byte stack for SSE compatibility. The alternate
-prologue and epilogue are slower and bigger than the regular ones, and
-the alternate prologue requires a scratch register; this lowers the
-number of registers available if used in conjunction with the
-@code{regparm} attribute. The @code{force_align_arg_pointer}
-attribute is incompatible with nested functions; this is considered a
-hard error.
+prologue and epilogue that realigns the runtime stack if necessary.
+This supports mixing legacy codes that run with a 4-byte aligned stack
+with modern codes that keep a 16-byte stack for SSE compatibility.
@item resbank
@cindex @code{resbank} attribute
@@ -7866,6 +8071,7 @@ v2di __builtin_ia32_psrlqi128 (v2di, int)
v8hi __builtin_ia32_psrawi128 (v8hi, int)
v4si __builtin_ia32_psradi128 (v4si, int)
v4si __builtin_ia32_pmaddwd128 (v8hi, v8hi)
+v2di __builtin_ia32_movq128 (v2di)
@end smallexample
The following built-in functions are available when @option{-msse3} is used.
@@ -11109,6 +11315,7 @@ for further explanation.
* Diagnostic Pragmas::
* Visibility Pragmas::
* Push/Pop Macro Pragmas::
+* Function Specific Option Pragmas::
@end menu
@node ARM Pragmas
@@ -11404,6 +11611,35 @@ strict control over project policies.
@end table
+GCC also offers a simple mechanism for printing messages during
+compilation.
+
+@table @code
+@item #pragma message @var{string}
+@cindex pragma, diagnostic
+
+Prints @var{string} as a compiler message on compilation. The message
+is informational only, and is neither a compilation warning nor an error.
+
+@smallexample
+#pragma message "Compiling " __FILE__ "..."
+@end smallexample
+
+@var{string} may be parenthesized, and is printed with location
+information. For example,
+
+@smallexample
+#define DO_PRAGMA(x) _Pragma (#x)
+#define TODO(x) DO_PRAGMA(message ("TODO - " #x))
+
+TODO(Remember to fix this)
+@end smallexample
+
+prints @samp{/tmp/file.c:4: note: #pragma message:
+TODO - Remember to fix this}.
+
+@end table
+
@node Visibility Pragmas
@subsection Visibility Pragmas
@@ -11459,6 +11695,80 @@ int x [X];
In this example, the definition of X as 1 is saved by @code{#pragma
push_macro} and restored by @code{#pragma pop_macro}.
+@node Function Specific Option Pragmas
+@subsection Function Specific Option Pragmas
+
+@table @code
+@item #pragma GCC option (@var{"string"}...)
+@cindex pragma GCC option
+
+This pragma allows you to set target specific options for functions
+defined later in the source file. One or more strings can be
+specified. Each function that is defined after this point will be as
+if @code{attribute((option("STRING")))} was specified for that
+function. The parenthesis around the options is optional.
+@xref{Function Attributes}, for more information about the
+@code{option} attribute and the attribute syntax.
+
+The @samp{#pragma GCC option} pragma is not implemented in GCC
+versions earlier than 4.4, and is currently only implemented for the
+386 and x86_64 backend.
+@end table
+
+@table @code
+@item #pragma GCC option (push)
+@itemx #pragma GCC option (pop)
+@cindex pragma GCC option
+
+These pragmas maintain a stack of the current options. It is
+intended for include files where you temporarily want to switch to
+using a different @samp{#pragma GCC option} and then to pop back to
+the previous options.
+@end table
+
+@table @code
+@item #pragma GCC option (reset)
+@cindex pragma, target option
+@cindex pragma GCC option
+
+This pragma clears the current @code{#pragma GCC options} to use the
+default switches as specified on the command line.
+@end table
+@table @code
+@item #pragma GCC optimize (@var{"string"}...)
+@cindex pragma GCC optimize
+
+This pragma allows you to set global optimization options for functions
+defined later in the source file. One or more strings can be
+specified. Each function that is defined after this point will be as
+if @code{attribute((optimize("STRING")))} was specified for that
+function. The parenthesis around the options is optional.
+@xref{Function Attributes}, for more information about the
+@code{optimize} attribute and the attribute syntax.
+
+The @samp{#pragma GCC optimize} pragma is not implemented in GCC
+versions earlier than 4.4.
+@end table
+
+@table @code
+@item #pragma GCC optimize (push)
+@itemx #pragma GCC optimize (pop)
+@cindex pragma GCC optimize
+
+These pragmas maintain a stack of the current optimization options.
+It is intended for include files where you temporarily want to switch
+to using a different @code{#pragma GCC optimize} and then to pop back
+to the previous optimizations.
+@end table
+
+@table @code
+@item #pragma GCC optimize reset
+@cindex pragma GCC optimize
+
+This pragma clears the current @code{#pragma GCC optimize} to use the
+default switches as specified on the command line.
+@end table
+
@node Unnamed Fields
@section Unnamed struct/union fields within structs/unions
@cindex struct
diff --git a/gcc/doc/fragments.texi b/gcc/doc/fragments.texi
index 450fd50f469..dcb64f441a8 100644
--- a/gcc/doc/fragments.texi
+++ b/gcc/doc/fragments.texi
@@ -172,6 +172,11 @@ some other filename (say @file{specs.install}), that will then be
created out of the built-in specs, and introduce a @file{Makefile}
rule to generate the @file{specs} file that's going to be used at
build time out of your @file{specs.install}.
+
+@item T_CFLAGS
+These are extra flags to pass to the C compiler. They are used both
+when building GCC, and when compiling things with the just-built GCC@.
+This variable is deprecated and should not be used.
@end table
@node Host Fragment
@@ -179,36 +184,5 @@ build time out of your @file{specs.install}.
@cindex host makefile fragment
@cindex @file{x-@var{host}}
-The use of @file{x-@var{host}} fragments is discouraged. You should do
-so only if there is no other mechanism to get the behavior desired.
-Host fragments should never forcibly override variables set by the
-configure script, as they may have been adjusted by the user.
-
-Variables provided for host fragments to set include:
-
-@table @code
-
-@item X_CFLAGS
-@itemx X_CPPFLAGS
-These are extra flags to pass to the C compiler and preprocessor,
-respectively. They are used both when building GCC, and when compiling
-things with the just-built GCC@.
-
-@item XCFLAGS
-These are extra flags to use when building the compiler. They are not
-used when compiling @file{libgcc.a}. However, they @emph{are} used when
-recompiling the compiler with itself in later stages of a bootstrap.
-
-@item BOOT_LDFLAGS
-Flags to be passed to the linker when recompiling the compiler with
-itself in later stages of a bootstrap. You might need to use this if,
-for instance, one of the front ends needs more text space than the
-linker provides by default.
-
-@item EXTRA_PROGRAMS
-A list of additional programs required to use the compiler on this host,
-which should be compiled with GCC and installed alongside the front
-ends. If you set this variable, you must also provide rules to build
-the extra programs.
-
-@end table
+The use of @file{x-@var{host}} fragments is discouraged. You should only
+use it for makefile dependencies.
diff --git a/gcc/doc/gcc.texi b/gcc/doc/gcc.texi
index b97943916f1..41031752bf2 100644
--- a/gcc/doc/gcc.texi
+++ b/gcc/doc/gcc.texi
@@ -41,16 +41,16 @@
@copying
Copyright @copyright{} 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
2008 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with the
-Invariant Sections being ``GNU General Public License'' and ``Funding
-Free Software'', the Front-Cover texts being (a) (see below), and with
-the Back-Cover Texts being (b) (see below). A copy of the license is
-included in the section entitled ``GNU Free Documentation License''.
+Invariant Sections being ``Funding Free Software'', the Front-Cover
+Texts being (a) (see below), and with the Back-Cover Texts being (b)
+(see below). A copy of the license is included in the section entitled
+``GNU Free Documentation License''.
(a) The FSF's Front-Cover Text is:
diff --git a/gcc/doc/gccint.texi b/gcc/doc/gccint.texi
index b285ec9b3dd..9fe28c075e0 100644
--- a/gcc/doc/gccint.texi
+++ b/gcc/doc/gccint.texi
@@ -27,16 +27,16 @@
@copying
Copyright @copyright{} 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
-2007 Free Software Foundation, Inc.
+1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+2008 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with the
-Invariant Sections being ``GNU General Public License'' and ``Funding
-Free Software'', the Front-Cover texts being (a) (see below), and with
-the Back-Cover Texts being (b) (see below). A copy of the license is
-included in the section entitled ``GNU Free Documentation License''.
+Invariant Sections being ``Funding Free Software'', the Front-Cover
+Texts being (a) (see below), and with the Back-Cover Texts being (b)
+(see below). A copy of the license is included in the section entitled
+``GNU Free Documentation License''.
(a) The FSF's Front-Cover Text is:
diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index 8913ec0c923..a69a0859ce0 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -70,8 +70,9 @@
@c Part 2 Summary Description and Copyright
@copying
-Copyright @copyright{} 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+Copyright @copyright{} 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997,
+1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+2008 Free Software Foundation, Inc.
@sp 1
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2 or
@@ -386,7 +387,7 @@ Necessary to build GCC during development because the generated output
files are not included in the SVN repository. They are included in
releases.
-@item Texinfo version 4.4 (or later)
+@item Texinfo version 4.7 (or later)
Necessary for running @command{makeinfo} when modifying @file{*.texi}
files to test your changes.
@@ -1765,7 +1766,7 @@ build machinery, not of GCC itself) that is used even if you only
build the C front end.
When building from SVN or snapshots, or if you modify Texinfo
-documentation, you need version 4.4 or later of Texinfo installed if you
+documentation, you need version 4.7 or later of Texinfo installed if you
want Info documentation to be regenerated. Releases contain Info
documentation pre-built for the unmodified documentation in the release.
@@ -2362,7 +2363,7 @@ If you find a bug, please report it following the
@uref{../bugs.html,,bug reporting guidelines}.
If you want to print the GCC manuals, do @samp{cd @var{objdir}; make
-dvi}. You will need to have @command{texi2dvi} (version at least 4.4)
+dvi}. You will need to have @command{texi2dvi} (version at least 4.7)
and @TeX{} installed. This creates a number of @file{.dvi} files in
subdirectories of @file{@var{objdir}}; these may be converted for
printing with programs such as @command{dvips}. Alternately, by using
@@ -2415,7 +2416,7 @@ AIX:
@uref{http://www.bullfreeware.com,,Bull's Freeware and Shareware Archive for AIX};
@item
-@uref{http://pware.hvcc.edu,,Hudson Valley Community College Open Source Softeware for IBM System p};
+@uref{http://pware.hvcc.edu,,Hudson Valley Community College Open Source Software for IBM System p};
@item
@uref{http://www.perzl.org/aix,,AIX 5L and 6 Open Source Packages}.
@@ -2624,9 +2625,9 @@ information are.
@item
@uref{#x86-64-x-x,,x86_64-*-*, amd64-*-*}
@item
-@uref{#xtensa-x-elf,,xtensa-*-elf}
+@uref{#xtensa-x-elf,,xtensa*-*-elf}
@item
-@uref{#xtensa-x-linux,,xtensa-*-linux*}
+@uref{#xtensa-x-linux,,xtensa*-*-linux*}
@item
@uref{#windows,,Microsoft Windows}
@item
@@ -3675,9 +3676,7 @@ or newer for a working GCC@.
<hr />
@end html
@heading @anchor{powerpc-x-netbsd}powerpc-*-netbsd*
-PowerPC system in big endian mode running NetBSD@. To build the
-documentation you will need Texinfo version 4.4 (NetBSD 1.5.1 included
-Texinfo version 3.12).
+PowerPC system in big endian mode running NetBSD@.
@html
<hr />
@@ -4037,7 +4036,7 @@ both 64-bit x86-64 and 32-bit x86 code (via the @option{-m32} switch).
@html
<hr />
@end html
-@heading @anchor{xtensa-x-elf}xtensa-*-elf
+@heading @anchor{xtensa-x-elf}xtensa*-*-elf
This target is intended for embedded Xtensa systems using the
@samp{newlib} C library. It uses ELF but does not support shared
@@ -4055,14 +4054,14 @@ which you can use to replace the default header file.
@html
<hr />
@end html
-@heading @anchor{xtensa-x-linux}xtensa-*-linux*
+@heading @anchor{xtensa-x-linux}xtensa*-*-linux*
This target is for Xtensa systems running GNU/Linux. It supports ELF
shared objects and the GNU C library (glibc). It also generates
position-independent code (PIC) regardless of whether the
@option{-fpic} or @option{-fPIC} options are used. In other
respects, this target is the same as the
-@uref{#xtensa-*-elf,,@samp{xtensa-*-elf}} target.
+@uref{#xtensa*-*-elf,,@samp{xtensa*-*-elf}} target.
@html
<hr />
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 6122f791b68..56a0bdadc55 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -328,8 +328,8 @@ Objective-C and Objective-C++ Dialects}.
-fearly-inlining -fexpensive-optimizations -ffast-math @gol
-ffinite-math-only -ffloat-store -fforward-propagate @gol
-ffunction-sections -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm @gol
--fgcse-sm -fif-conversion -fif-conversion2 -finline-functions @gol
--finline-functions-called-once -finline-limit=@var{n} @gol
+-fgcse-sm -fif-conversion -fif-conversion2 -findirect-inlining @gol
+-finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
-finline-small-functions -fipa-cp -fipa-marix-reorg -fipa-pta @gol
-fipa-pure-const -fipa-reference -fipa-struct-reorg @gol
-fipa-type-escape -fivopts -fkeep-inline-functions -fkeep-static-consts @gol
@@ -555,7 +555,9 @@ Objective-C and Objective-C++ Dialects}.
-masm=@var{dialect} -mno-fancy-math-387 @gol
-mno-fp-ret-in-387 -msoft-float @gol
-mno-wide-multiply -mrtd -malign-double @gol
--mpreferred-stack-boundary=@var{num} -mcld -mcx16 -msahf -mrecip @gol
+-mpreferred-stack-boundary=@var{num}
+-mincoming-stack-boundary=@var{num}
+-mcld -mcx16 -msahf -mrecip @gol
-mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 @gol
-maes -mpclmul @gol
-msse4a -m3dnow -mpopcnt -mabm -msse5 @gol
@@ -627,7 +629,8 @@ Objective-C and Objective-C++ Dialects}.
@emph{MIPS Options}
@gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
--mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips64 @gol
+-mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 @gol
+-mips64 -mips64r2 @gol
-mips16 -mno-mips16 -mflip-mips16 @gol
-minterlink-mips16 -mno-interlink-mips16 @gol
-mabi=@var{abi} -mabicalls -mno-abicalls @gol
@@ -2694,7 +2697,7 @@ Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
-Wstrict-overflow=1 @gol
-Wswitch @gol
-Wtrigraphs @gol
--Wuninitialized @r{(only with} @option{-O1} @r{and above)} @gol
+-Wuninitialized @gol
-Wunknown-pragmas @gol
-Wunused-function @gol
-Wunused-label @gol
@@ -2728,7 +2731,7 @@ name is still supported, but the newer name is more descriptive.)
-Woverride-init @gol
-Wsign-compare @gol
-Wtype-limits @gol
--Wuninitialized @r{(only with} @option{-O1} @r{and above)} @gol
+-Wuninitialized @gol
-Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
}
@@ -2746,10 +2749,6 @@ A pointer is compared against integer zero with @samp{<}, @samp{<=},
conditional expression.
@item
-(C++ only) A non-static reference or non-static @samp{const} member
-appears in a class without constructors.
-
-@item
(C++ only) Ambiguous virtual bases.
@item
@@ -2890,8 +2889,7 @@ can be disabled with the @option{-Wno-nonnull} option.
@opindex Winit-self
@opindex Wno-init-self
Warn about uninitialized variables which are initialized with themselves.
-Note this option can only be used with the @option{-Wuninitialized} option,
-which in turn only works with @option{-O1} and above.
+Note this option can only be used with the @option{-Wuninitialized} option.
For example, GCC will warn about @code{i} being uninitialized in the
following snippet only when @option{-Winit-self} has been specified:
@@ -2942,10 +2940,11 @@ This warning is also enabled by @option{-Wextra}.
@item -Wmain
@opindex Wmain
@opindex Wno-main
-Warn if the type of @samp{main} is suspicious. @samp{main} should be a
-function with external linkage, returning int, taking either zero
-arguments, two, or three arguments of appropriate types.
-This warning is enabled by @option{-Wall}.
+Warn if the type of @samp{main} is suspicious. @samp{main} should be
+a function with external linkage, returning int, taking either zero
+arguments, two, or three arguments of appropriate types. This warning
+is enabled by default in C++ and is enabled by either @option{-Wall}
+or @option{-pedantic}.
@item -Wmissing-braces
@opindex Wmissing-braces
@@ -3171,14 +3170,10 @@ either specify @samp{-Wextra -Wunused} (note that @samp{-Wall} implies
@item -Wuninitialized
@opindex Wuninitialized
@opindex Wno-uninitialized
-Warn if an automatic variable is used without first being initialized or
-if a variable may be clobbered by a @code{setjmp} call.
-
-These warnings are possible only in optimizing compilation,
-because they require data flow information that is computed only
-when optimizing. If you do not specify @option{-O}, you will not get
-these warnings. Instead, GCC will issue a warning about @option{-Wuninitialized}
-requiring @option{-O}.
+Warn if an automatic variable is used without first being initialized
+or if a variable may be clobbered by a @code{setjmp} call. In C++,
+warn if a non-static reference or non-static @samp{const} member
+appears in a class without constructors.
If you want to warn about code which uses the uninitialized value of the
variable in its own initializer, use the @option{-Winit-self} option.
@@ -3250,8 +3245,7 @@ Some spurious warnings can be avoided if you declare all the functions
you use that never return as @code{noreturn}. @xref{Function
Attributes}.
-This warning is enabled by @option{-Wall} or @option{-Wextra} in
-optimizing compilations (@option{-O1} and above).
+This warning is enabled by @option{-Wall} or @option{-Wextra}.
@item -Wunknown-pragmas
@opindex Wunknown-pragmas
@@ -5129,14 +5123,10 @@ Turning on optimization flags makes the compiler attempt to improve
the performance and/or code size at the expense of compilation time
and possibly the ability to debug the program.
-The compiler performs optimization based on the knowledge it has of
-the program. Optimization levels @option{-O} and above, in
-particular, enable @emph{unit-at-a-time} mode, which allows the
-compiler to consider information gained from later functions in
-the file when compiling a function. Compiling multiple files at
-once to a single output file in @emph{unit-at-a-time} mode allows
-the compiler to use information gained from all of the files when
-compiling each of them.
+The compiler performs optimization based on the knowledge it has of the
+program. Compiling multiple files at once to a single output file mode allows
+the compiler to use information gained from all of the files when compiling
+each of them.
Not all optimizations are controlled directly by a flag. Only
optimizations that have a flag are listed.
@@ -5203,6 +5193,7 @@ also turns on the following optimization flags:
-fdelete-null-pointer-checks @gol
-fexpensive-optimizations @gol
-fgcse -fgcse-lm @gol
+-findirect-inlining @gol
-foptimize-sibling-calls @gol
-fpeephole2 @gol
-fregmove @gol
@@ -5220,8 +5211,8 @@ invoking @option{-O2} on programs that use computed gotos.
@item -O3
@opindex O3
-Optimize yet more. @option{-O3} turns on all optimizations specified by
-@option{-O2} and also turns on the @option{-finline-functions},
+Optimize yet more. @option{-O3} turns on all optimizations specified
+by @option{-O2} and also turns on the @option{-finline-functions},
@option{-funswitch-loops}, @option{-fpredictive-commoning},
@option{-fgcse-after-reload} and @option{-ftree-vectorize} options.
@@ -5323,6 +5314,15 @@ in this way.
Enabled at level @option{-O2}.
+@item -findirect-inlining
+@opindex findirect-inlining
+Inline also indirect calls that are discovered to be known at compile
+time thanks to previous inlining. This option has any effect only
+when inlining itself is turned on by the @option{-finline-functions}
+or @option{-finline-small-functions} options.
+
+Enabled at level @option{-O2}.
+
@item -finline-functions
@opindex finline-functions
Integrate all simple functions into their callers. The compiler
@@ -5342,7 +5342,7 @@ caller even if they are not marked @code{inline}. If a call to a given
function is integrated, then the function is not output as assembler code
in its own right.
-Enabled if @option{-funit-at-a-time} is enabled.
+Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os}.
@item -fearly-inlining
@opindex fearly-inlining
@@ -5843,7 +5843,8 @@ With this flag, the program debug info reflects a new structure layout.
@item -fipa-pta
@opindex fipa-pta
-Perform interprocedural pointer analysis.
+Perform interprocedural pointer analysis. This option is experimental
+and does not affect generated code.
@item -fipa-cp
@opindex fipa-cp
@@ -6316,39 +6317,11 @@ Enabled at levels @option{-O2}, @option{-O3}.
@item -funit-at-a-time
@opindex funit-at-a-time
-Parse the whole compilation unit before starting to produce code.
-This allows some extra optimizations to take place but consumes
-more memory (in general). There are some compatibility issues
-with @emph{unit-at-a-time} mode:
-@itemize @bullet
-@item
-enabling @emph{unit-at-a-time} mode may change the order
-in which functions, variables, and top-level @code{asm} statements
-are emitted, and will likely break code relying on some particular
-ordering. The majority of such top-level @code{asm} statements,
-though, can be replaced by @code{section} attributes. The
-@option{fno-toplevel-reorder} option may be used to keep the ordering
-used in the input file, at the cost of some optimizations.
+This option is left for compatibility reasons. @option{-funit-at-a-time}
+has no effect, while @option{-fno-unit-at-a-time} implies
+@option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
-@item
-@emph{unit-at-a-time} mode removes unreferenced static variables
-and functions. This may result in undefined references
-when an @code{asm} statement refers directly to variables or functions
-that are otherwise unused. In that case either the variable/function
-shall be listed as an operand of the @code{asm} statement operand or,
-in the case of top-level @code{asm} statements the attribute @code{used}
-shall be used on the declaration.
-
-@item
-Static functions now can use non-standard passing conventions that
-may break @code{asm} statements calling functions directly. Again,
-attribute @code{used} will prevent this behavior.
-@end itemize
-
-As a temporary workaround, @option{-fno-unit-at-a-time} can be used,
-but this scheme may not be supported by future releases of GCC@.
-
-Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
+Enabled by default.
@item -fno-toplevel-reorder
@opindex fno-toplevel-reorder
@@ -6359,6 +6332,10 @@ will not be removed. This option is intended to support existing code
which relies on a particular ordering. For new code, it is better to
use attributes.
+Enabled at level @option{-O0}. When disabled explicitly, it also imply
+@option{-fno-section-anchors} that is otherwise enabled at @option{-O0} on some
+targets.
+
@item -fweb
@opindex fweb
Constructs webs as commonly used for register allocation purposes and assign
@@ -6944,12 +6921,10 @@ limit after inlining inlining is constrained by
@option{--param large-function-growth}. This parameter is useful primarily
to avoid extreme compilation time caused by non-linear algorithms used by the
backend.
-This parameter is ignored when @option{-funit-at-a-time} is not used.
The default value is 2700.
@item large-function-growth
Specifies maximal growth of large function caused by inlining in percents.
-This parameter is ignored when @option{-funit-at-a-time} is not used.
The default value is 100 which limits large function growth to 2.0 times
the original size.
@@ -6966,7 +6941,6 @@ before applying @option{--param inline-unit-growth}. The default is 10000
@item inline-unit-growth
Specifies maximal overall growth of the compilation unit caused by inlining.
-This parameter is ignored when @option{-funit-at-a-time} is not used.
The default value is 30 which limits unit growth to 1.3 times the original
size.
@@ -8628,7 +8602,8 @@ assembly code. Permissible names are: @samp{arm2}, @samp{arm250},
@samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
@samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
@samp{arm1156t2-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
-@samp{cortex-a8}, @samp{cortex-r4}, @samp{cortex-m3}, @samp{cortex-m1},
+@samp{cortex-a8}, @samp{cortex-r4}, @samp{cortex-r4f}, @samp{cortex-m3},
+@samp{cortex-m1},
@samp{xscale}, @samp{iwmmxt}, @samp{ep9312}.
@item -mtune=@var{name}
@@ -8662,7 +8637,8 @@ of the @option{-mcpu=} option. Permissible names are: @samp{armv2},
@opindex mfp
This specifies what floating point hardware (or hardware emulation) is
available on the target. Permissible names are: @samp{fpa}, @samp{fpe2},
-@samp{fpe3}, @samp{maverick}, @samp{vfp}. @option{-mfp} and @option{-mfpe}
+@samp{fpe3}, @samp{maverick}, @samp{vfp}, @samp{vfpv3}, @samp{vfpv3-d16} and
+@samp{neon}. @option{-mfp} and @option{-mfpe}
are synonyms for @option{-mfpu}=@samp{fpe}@var{number}, for compatibility
with older versions of GCC@.
@@ -10574,6 +10550,8 @@ code that expects temporaries to be 80bit.
This is the default choice for the x86-64 compiler.
@item sse,387
+@itemx sse+387
+@itemx both
Attempt to utilize both instruction sets at once. This effectively double the
amount of available registers and on chips with separate execution units for
387 and SSE the execution resources too. Use this option with care, as it is
@@ -10758,17 +10736,11 @@ when this option is used to set the precision to less than extended precision.
@item -mstackrealign
@opindex mstackrealign
-Realign the stack at entry. On the Intel x86, the
-@option{-mstackrealign} option will generate an alternate prologue and
-epilogue that realigns the runtime stack. This supports mixing legacy
-codes that keep a 4-byte aligned stack with modern codes that keep a
-16-byte stack for SSE compatibility. The alternate prologue and
-epilogue are slower and bigger than the regular ones, and the
-alternate prologue requires an extra scratch register; this lowers the
-number of registers available if used in conjunction with the
-@code{regparm} attribute. The @option{-mstackrealign} option is
-incompatible with the nested function prologue; this is considered a
-hard error. See also the attribute @code{force_align_arg_pointer},
+Realign the stack at entry. On the Intel x86, the @option{-mstackrealign}
+option will generate an alternate prologue and epilogue that realigns the
+runtime stack if necessary. This supports mixing legacy codes that keep
+a 4-byte aligned stack with modern codes that keep a 16-byte stack for
+SSE compatibility. See also the attribute @code{force_align_arg_pointer},
applicable to individual functions.
@item -mpreferred-stack-boundary=@var{num}
@@ -10777,6 +10749,12 @@ Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
the default is 4 (16 bytes or 128 bits).
+@item -mincoming-stack-boundary=@var{num}
+@opindex mincoming-stack-boundary
+Assume the incoming stack is aligned to a 2 raised to @var{num} byte
+boundary. If @option{-mincoming-stack-boundary} is not specified,
+the one specified by @option{-mpreferred-stack-boundary} will be used.
+
On Pentium and PentiumPro, @code{double} and @code{long double} values
should be aligned to an 8 byte boundary (see @option{-malign-double}) or
suffer significant run time performance penalties. On Pentium III, the
@@ -11988,7 +11966,7 @@ Generate code that will run on @var{arch}, which can be the name of a
generic MIPS ISA, or the name of a particular processor.
The ISA names are:
@samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
-@samp{mips32}, @samp{mips32r2}, and @samp{mips64}.
+@samp{mips32}, @samp{mips32r2}, @samp{mips64} and @samp{mips64r2}.
The processor names are:
@samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
@samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
@@ -12090,6 +12068,10 @@ Equivalent to @samp{-march=mips32r2}.
@opindex mips64
Equivalent to @samp{-march=mips64}.
+@item -mips64r2
+@opindex mips64r2
+Equivalent to @samp{-march=mips64r2}.
+
@item -mips16
@itemx -mno-mips16
@opindex mips16
@@ -13042,7 +13024,7 @@ Supported values for @var{cpu_type} are @samp{401}, @samp{403},
@samp{860}, @samp{970}, @samp{8540}, @samp{e300c2}, @samp{e300c3},
@samp{e500mc}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
@samp{power}, @samp{power2}, @samp{power3}, @samp{power4},
-@samp{power5}, @samp{power5+}, @samp{power6}, @samp{power6x},
+@samp{power5}, @samp{power5+}, @samp{power6}, @samp{power6x}, @samp{power7}
@samp{common}, @samp{powerpc}, @samp{powerpc64}, @samp{rios},
@samp{rios1}, @samp{rios2}, @samp{rsc}, and @samp{rs64}.
@@ -15616,7 +15598,7 @@ for any cases where this rule is relaxed.
@item Each of the following options must be the same when building and using
the precompiled header:
-@gccoptlist{-fexceptions -funit-at-a-time}
+@gccoptlist{-fexceptions}
@item
Some other command-line options starting with @option{-f},
diff --git a/gcc/doc/options.texi b/gcc/doc/options.texi
index e13279b962b..4581ead6da6 100644
--- a/gcc/doc/options.texi
+++ b/gcc/doc/options.texi
@@ -35,8 +35,11 @@ has been declared in this way, it can be used as an option property.
@xref{Option properties}.
@item
-An option definition record. These records have the following fields:
+A target specific save record to save additional information. These
+records have two fields: the string @samp{TargetSave}, and a
+declaration type to go in the @code{cl_target_option} structure.
+@item
@enumerate
@item
the name of the option, with the leading ``-'' removed
@@ -124,7 +127,10 @@ This property cannot be used alongside @code{Joined} or @code{Separate}.
@item UInteger
The option's argument is a non-negative integer. The option parser
will check and convert the argument before passing it to the relevant
-option handler.
+option handler. @code{UInteger} should also be used on options like
+@code{-falign-loops} where both @code{-falign-loops} and
+@code{-falign-loops}=@var{n} are supported to make sure the saved
+options are given a full integer.
@item Var(@var{var})
The state of this option should be stored in variable @var{var}.
@@ -221,4 +227,9 @@ The option should only be accepted if preprocessor condition
option will be present even if @var{cond} is false; @var{cond} simply
controls whether the option is accepted and whether it is printed in
the @option{--help} output.
+
+@item Save
+Build the @code{cl_target_option} structure to hold a copy of the
+option, add the functions @code{cl_target_option_save} and
+@code{cl_target_option_restore} to save and restore the options.
@end table
diff --git a/gcc/doc/passes.texi b/gcc/doc/passes.texi
index 4b0c0b6fb7c..daeaf9520e1 100644
--- a/gcc/doc/passes.texi
+++ b/gcc/doc/passes.texi
@@ -166,6 +166,10 @@ not attempt to (re-)generate data structures or lower intermediate
language form based on the requirements of the next pass. Nevertheless,
what is present is useful, and a far sight better than nothing at all.
+Each pass may have its own dump file (for GCC debugging purposes).
+Passes without any names, or with a name starting with a star, do not
+dump anything.
+
TODO: describe the global variables set up by the pass manager,
and a brief description of how a new pass should use it.
I need to look at what info rtl passes use first@enddots{}
@@ -275,7 +279,7 @@ located in @file{tree-ssa.c} and is described by @code{pass_build_ssa}.
This pass scans the function for uses of @code{SSA_NAME}s that
are fed by default definition. For non-parameter variables, such
uses are uninitialized. The pass is run twice, before and after
-optimization. In the first pass we only warn for uses that are
+optimization (if turned on). In the first pass we only warn for uses that are
positively uninitialized; in the second pass we warn for uses that
are possibly uninitialized. The pass is located in @file{tree-ssa.c}
and is defined by @code{pass_early_warn_uninitialized} and
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index 58600186940..5decc331bd4 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -833,10 +833,9 @@ specified, 1 if @option{-O} is specified, and 0 if neither is specified.
@var{size} is nonzero if @option{-Os} is specified and zero otherwise.
-You should not use this macro to change options that are not
-machine-specific. These should uniformly selected by the same
-optimization level on all supported machines. Use this macro to enable
-machine-specific optimizations.
+This macro is run once at program startup and when the optimization
+options are changed via @code{#pragma GCC optimize} or by using the
+@code{optimize} attribute.
@strong{Do not examine @code{write_symbols} in
this macro!} The debugging options are not supposed to alter the
@@ -1085,6 +1084,12 @@ macro must evaluate to a value equal to or larger than
@code{STACK_BOUNDARY}.
@end defmac
+@defmac INCOMING_STACK_BOUNDARY
+Define this macro if the incoming stack boundary may be different
+from @code{PREFERRED_STACK_BOUNDARY}. This macro must evaluate
+to a value equal to or larger than @code{STACK_BOUNDARY}.
+@end defmac
+
@defmac FUNCTION_BOUNDARY
Alignment required for a function entry point, in bits.
@end defmac
@@ -1095,6 +1100,11 @@ bits. Note that this is not the biggest alignment that is supported,
just the biggest alignment that, when violated, may cause a fault.
@end defmac
+@defmac MALLOC_ABI_ALIGNMENT
+Alignment, in bits, a C conformant malloc implementation has to
+provide. If not defined, the default value is @code{BITS_PER_WORD}.
+@end defmac
+
@defmac MINIMUM_ATOMIC_ALIGNMENT
If defined, the smallest alignment, in bits, that can be given to an
object that can be referenced in one operation, without disturbing any
@@ -1118,6 +1128,18 @@ field alignment has not been set by the
@code{__attribute__ ((aligned (@var{n})))} construct.
@end defmac
+@defmac MAX_STACK_ALIGNMENT
+Biggest stack alignment guaranteed by the backend. Use this macro
+to specify the maximum alignment of a variable on stack.
+
+If not defined, the default value is @code{STACK_BOUNDARY}.
+
+@c FIXME: The default should be @code{PREFERRED_STACK_BOUNDARY}.
+@c But the fix for PR 32893 indicates that we can only guarantee
+@c maximum stack alignment on stack up to @code{STACK_BOUNDARY}, not
+@c @code{PREFERRED_STACK_BOUNDARY}, if stack alignment isn't supported.
+@end defmac
+
@defmac MAX_OFILE_ALIGNMENT
Biggest alignment supported by the object file format of this machine.
Use this macro to limit the alignment which can be specified using the
@@ -1363,100 +1385,12 @@ of shift instructions expanded to libgcc calls. If not defined
targets.
@end deftypefn
-@defmac TARGET_FLOAT_FORMAT
-A code distinguishing the floating point format of the target machine.
-There are two defined values:
-
-@ftable @code
-@item IEEE_FLOAT_FORMAT
-This code indicates IEEE floating point. It is the default; there is no
-need to define @code{TARGET_FLOAT_FORMAT} when the format is IEEE@.
-
-@item VAX_FLOAT_FORMAT
-This code indicates the ``F float'' (for @code{float}) and ``D float''
-or ``G float'' formats (for @code{double}) used on the VAX and PDP-11@.
-@end ftable
-
-If your target uses a floating point format other than these, you must
-define a new @var{name}_FLOAT_FORMAT code for it, and add support for
-it to @file{real.c}.
-
-The ordering of the component words of floating point values stored in
-memory is controlled by @code{FLOAT_WORDS_BIG_ENDIAN}.
-@end defmac
-
-@defmac MODE_HAS_NANS (@var{mode})
-When defined, this macro should be true if @var{mode} has a NaN
-representation. The compiler assumes that NaNs are not equal to
-anything (including themselves) and that addition, subtraction,
-multiplication and division all return NaNs when one operand is
-NaN@.
-
-By default, this macro is true if @var{mode} is a floating-point
-mode and the target floating-point format is IEEE@.
-@end defmac
-
-@defmac MODE_HAS_INFINITIES (@var{mode})
-This macro should be true if @var{mode} can represent infinity. At
-present, the compiler uses this macro to decide whether @samp{x - x}
-is always defined. By default, the macro is true when @var{mode}
-is a floating-point mode and the target format is IEEE@.
-@end defmac
-
-@defmac MODE_HAS_SIGNED_ZEROS (@var{mode})
-True if @var{mode} distinguishes between positive and negative zero.
-The rules are expected to follow the IEEE standard:
-
-@itemize @bullet
-@item
-@samp{x + x} has the same sign as @samp{x}.
-
-@item
-If the sum of two values with opposite sign is zero, the result is
-positive for all rounding modes expect towards @minus{}infinity, for
-which it is negative.
-
-@item
-The sign of a product or quotient is negative when exactly one
-of the operands is negative.
-@end itemize
-
-The default definition is true if @var{mode} is a floating-point
-mode and the target format is IEEE@.
-@end defmac
-
-@defmac MODE_HAS_SIGN_DEPENDENT_ROUNDING (@var{mode})
-If defined, this macro should be true for @var{mode} if it has at
-least one rounding mode in which @samp{x} and @samp{-x} can be
-rounded to numbers of different magnitude. Two such modes are
-towards @minus{}infinity and towards +infinity.
-
-The default definition of this macro is true if @var{mode} is
-a floating-point mode and the target format is IEEE@.
-@end defmac
-
@defmac ROUND_TOWARDS_ZERO
If defined, this macro should be true if the prevailing rounding
-mode is towards zero. A true value has the following effects:
-
-@itemize @bullet
-@item
-@code{MODE_HAS_SIGN_DEPENDENT_ROUNDING} will be false for all modes.
-
-@item
-@file{libgcc.a}'s floating-point emulator will round towards zero
-rather than towards nearest.
+mode is towards zero.
-@item
-The compiler's floating-point emulator will round towards zero after
-doing arithmetic, and when converting from the internal float format to
-the target format.
-@end itemize
-
-The macro does not affect the parsing of string literals. When the
-primary rounding mode is towards zero, library functions like
-@code{strtod} might still round towards nearest, and the compiler's
-parser should behave like the target's @code{strtod} where possible.
+Defining this macro only affects the way @file{libgcc.a} emulates
+floating-point arithmetic.
Not defining this macro is equivalent to returning zero.
@end defmac
@@ -1466,9 +1400,7 @@ This macro should return true if floats with @var{size}
bits do not have a NaN or infinity representation, but use the largest
exponent for normal numbers instead.
-Defining this macro to true for @var{size} causes @code{MODE_HAS_NANS}
-and @code{MODE_HAS_INFINITIES} to be false for @var{size}-bit modes.
-It also affects the way @file{libgcc.a} and @file{real.c} emulate
+Defining this macro only affects the way @file{libgcc.a} emulates
floating-point arithmetic.
The default definition of this macro returns false for all sizes.
@@ -9266,6 +9198,51 @@ attributes, @code{false} otherwise. By default, if a function has a
target specific attribute attached to it, it will not be inlined.
@end deftypefn
+@deftypefn {Target Hook} bool TARGET_VALID_OPTION_ATTRIBUTE_P (tree @var{fndecl}, tree @var{name}, tree @var{args}, int @var{flags})
+This hook is called to parse the @code{attribute(option("..."))}, and
+it allows the function to set different target machine compile time
+options for the current function that might be different than the
+options specified on the command line. The hook should return
+@code{true} if the options are valid.
+
+The hook should set the @var{DECL_FUNCTION_SPECIFIC_TARGET} field in
+the function declaration to hold a pointer to a target specific
+@var{struct cl_target_option} structure.
+@end deftypefn
+
+@deftypefn {Target Hook} void TARGET_OPTION_SAVE (struct cl_target_option *@var{ptr})
+This hook is called to save any additional target specific information
+in the @var{struct cl_target_option} structure for function specific
+options.
+@xref{Option file format}.
+@end deftypefn
+
+@deftypefn {Target Hook} void TARGET_OPTION_RESTORE (struct cl_target_option *@var{ptr})
+This hook is called to restore any additional target specific
+information in the @var{struct cl_target_option} structure for
+function specific options.
+@end deftypefn
+
+@deftypefn {Target Hook} void TARGET_OPTION_PRINT (struct cl_target_option *@var{ptr})
+This hook is called to print any additional target specific
+information in the @var{struct cl_target_option} structure for
+function specific options.
+@end deftypefn
+
+@deftypefn {Target Hook} bool TARGET_OPTION_PRAGMA_PARSE (target @var{args})
+This target hook parses the options for @code{#pragma GCC option} to
+set the machine specific options for functions that occur later in the
+input stream. The options should be the same as handled by the
+@code{TARGET_VALID_OPTION_ATTRIBUTE_P} hook.
+@end deftypefn
+
+@deftypefn {Target Hook} bool TARGET_CAN_INLINE_P (tree @var{caller}, tree @var{callee})
+This target hook returns @code{false} if the @var{caller} function
+cannot inline @var{callee}, based on target specific information. By
+default, inlining is not allowed if the callee function has function
+specific target options and the caller does not use the same options.
+@end deftypefn
+
@node Emulated TLS
@section Emulating TLS
@cindex Emulated TLS
@@ -10537,6 +10514,17 @@ call stack unwinding. It is used in declarations in @file{unwind-generic.h}
and the associated definitions of those functions.
@end defmac
+@deftypefn {Target Hook} void TARGET_UPDATE_STACK_BOUNDARY (void)
+Define this macro to update the current function stack boundary if
+necessary.
+@end deftypefn
+
+@deftypefn {Target Hook} rtx TARGET_GET_DRAP_RTX (void)
+Define this macro to an rtx for Dynamic Realign Argument Pointer if a
+different argument pointer register is needed to access the function's
+argument list when stack is aligned.
+@end deftypefn
+
@deftypefn {Target Hook} {bool} TARGET_ALLOCATE_STACK_SLOTS_FOR_ARGS (void)
When optimization is disabled, this hook indicates whether or not
arguments should be allocated to stack slots. Normally, GCC allocates
diff --git a/gcc/dojump.c b/gcc/dojump.c
index 43373481955..46aa4f2ebb8 100644
--- a/gcc/dojump.c
+++ b/gcc/dojump.c
@@ -71,8 +71,7 @@ clear_pending_stack_adjust (void)
{
if (optimize > 0
&& (! flag_omit_frame_pointer || cfun->calls_alloca)
- && EXIT_IGNORE_STACK
- && ! (DECL_INLINE (current_function_decl) && ! flag_no_inline))
+ && EXIT_IGNORE_STACK)
discard_pending_stack_adjust ();
}
@@ -305,8 +304,6 @@ do_jump (tree exp, rtx if_false_label, rtx if_true_label)
break;
}
- case TRUTH_ANDIF_EXPR:
- case TRUTH_ORIF_EXPR:
case COMPOUND_EXPR:
/* Lowered by gimplify.c. */
gcc_unreachable ();
@@ -516,6 +513,7 @@ do_jump (tree exp, rtx if_false_label, rtx if_true_label)
if (BRANCH_COST >= 4 || TREE_SIDE_EFFECTS (TREE_OPERAND (exp, 1)))
goto normal;
+ case TRUTH_ANDIF_EXPR:
if (if_false_label == NULL_RTX)
{
drop_through_label = gen_label_rtx ();
@@ -536,6 +534,7 @@ do_jump (tree exp, rtx if_false_label, rtx if_true_label)
if (BRANCH_COST >= 4 || TREE_SIDE_EFFECTS (TREE_OPERAND (exp, 1)))
goto normal;
+ case TRUTH_ORIF_EXPR:
if (if_true_label == NULL_RTX)
{
drop_through_label = gen_label_rtx ();
diff --git a/gcc/domwalk.c b/gcc/domwalk.c
index cec95a5f932..8f779225432 100644
--- a/gcc/domwalk.c
+++ b/gcc/domwalk.c
@@ -144,7 +144,7 @@ walk_dominator_tree (struct dom_walk_data *walk_data, basic_block bb)
{
void *bd = NULL;
basic_block dest;
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
bool is_interesting;
basic_block *worklist = XNEWVEC (basic_block, n_basic_blocks * 2);
int sp = 0;
@@ -168,8 +168,8 @@ walk_dominator_tree (struct dom_walk_data *walk_data, basic_block bb)
{
bool recycled;
- /* First get some local data, reusing any local data pointer we may
- have saved. */
+ /* First get some local data, reusing any local data
+ pointer we may have saved. */
if (VEC_length (void_p, walk_data->free_block_data) > 0)
{
bd = VEC_pop (void_p, walk_data->free_block_data);
@@ -199,13 +199,14 @@ walk_dominator_tree (struct dom_walk_data *walk_data, basic_block bb)
if (is_interesting && walk_data->before_dom_children_walk_stmts)
{
if (walk_data->walk_stmts_backward)
- for (bsi = bsi_last (bb); !bsi_end_p (bsi); bsi_prev (&bsi))
+ for (gsi = gsi_last (bb_seq (bb)); !gsi_end_p (gsi);
+ gsi_prev (&gsi))
(*walk_data->before_dom_children_walk_stmts) (walk_data, bb,
- bsi);
+ gsi);
else
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
(*walk_data->before_dom_children_walk_stmts) (walk_data, bb,
- bsi);
+ gsi);
}
/* Callback for operations to execute before we have walked the
@@ -239,13 +240,14 @@ walk_dominator_tree (struct dom_walk_data *walk_data, basic_block bb)
if (is_interesting && walk_data->after_dom_children_walk_stmts)
{
if (walk_data->walk_stmts_backward)
- for (bsi = bsi_last (bb); !bsi_end_p (bsi); bsi_prev (&bsi))
+ for (gsi = gsi_last (bb_seq (bb)); !gsi_end_p (gsi);
+ gsi_prev (&gsi))
(*walk_data->after_dom_children_walk_stmts) (walk_data, bb,
- bsi);
+ gsi);
else
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
(*walk_data->after_dom_children_walk_stmts) (walk_data, bb,
- bsi);
+ gsi);
}
/* Callback for operations to execute after we have walked the
diff --git a/gcc/domwalk.h b/gcc/domwalk.h
index 3fc6810207e..61117ef7d45 100644
--- a/gcc/domwalk.h
+++ b/gcc/domwalk.h
@@ -66,7 +66,7 @@ struct dom_walk_data
/* Function to call to walk statements before the recursive walk
of the dominator children. */
void (*before_dom_children_walk_stmts) (struct dom_walk_data *,
- basic_block, block_stmt_iterator);
+ basic_block, gimple_stmt_iterator);
/* Function to call after the statement walk occurring before the
recursive walk of the dominator children. */
@@ -81,7 +81,7 @@ struct dom_walk_data
/* Function to call to walk statements after the recursive walk
of the dominator children. */
void (*after_dom_children_walk_stmts) (struct dom_walk_data *,
- basic_block, block_stmt_iterator);
+ basic_block, gimple_stmt_iterator);
/* Function to call after the statement walk occurring after the
recursive walk of the dominator children.
diff --git a/gcc/dse.c b/gcc/dse.c
index 4d5120160fa..99233266377 100644
--- a/gcc/dse.c
+++ b/gcc/dse.c
@@ -783,10 +783,9 @@ replace_inc_dec (rtx *r, void *d)
{
rtx r1 = XEXP (x, 0);
rtx c = gen_int_mode (Pmode, data->size);
- add_insn_before (data->insn,
- gen_rtx_SET (Pmode, r1,
- gen_rtx_PLUS (Pmode, r1, c)),
- NULL);
+ emit_insn_before (gen_rtx_SET (Pmode, r1,
+ gen_rtx_PLUS (Pmode, r1, c)),
+ data->insn);
return -1;
}
@@ -795,10 +794,9 @@ replace_inc_dec (rtx *r, void *d)
{
rtx r1 = XEXP (x, 0);
rtx c = gen_int_mode (Pmode, -data->size);
- add_insn_before (data->insn,
- gen_rtx_SET (Pmode, r1,
- gen_rtx_PLUS (Pmode, r1, c)),
- NULL);
+ emit_insn_before (gen_rtx_SET (Pmode, r1,
+ gen_rtx_PLUS (Pmode, r1, c)),
+ data->insn);
return -1;
}
@@ -809,8 +807,7 @@ replace_inc_dec (rtx *r, void *d)
insn that contained it. */
rtx add = XEXP (x, 0);
rtx r1 = XEXP (add, 0);
- add_insn_before (data->insn,
- gen_rtx_SET (Pmode, r1, add), NULL);
+ emit_insn_before (gen_rtx_SET (Pmode, r1, add), data->insn);
return -1;
}
@@ -827,12 +824,12 @@ static int
replace_inc_dec_mem (rtx *r, void *d)
{
rtx x = *r;
- if (GET_CODE (x) == MEM)
+ if (x != NULL_RTX && MEM_P (x))
{
struct insn_size data;
data.size = GET_MODE_SIZE (GET_MODE (x));
- data.insn = (rtx)d;
+ data.insn = (rtx) d;
for_each_rtx (&XEXP (x, 0), replace_inc_dec, &data);
diff --git a/gcc/dwarf2asm.c b/gcc/dwarf2asm.c
index ea19b793df5..9ae94200f18 100644
--- a/gcc/dwarf2asm.c
+++ b/gcc/dwarf2asm.c
@@ -62,6 +62,34 @@ dw2_assemble_integer (int size, rtx x)
}
+/* Output a value of a given size in target byte order. */
+
+void
+dw2_asm_output_data_raw (int size, unsigned HOST_WIDE_INT value)
+{
+ unsigned char bytes[8];
+ int i;
+
+ for (i = 0; i < 8; ++i)
+ {
+ bytes[i] = value & 0xff;
+ value >>= 8;
+ }
+
+ if (BYTES_BIG_ENDIAN)
+ {
+ for (i = size - 1; i > 0; --i)
+ fprintf (asm_out_file, "0x%x,", bytes[i]);
+ fprintf (asm_out_file, "0x%x", bytes[0]);
+ }
+ else
+ {
+ for (i = 0; i < size - 1; ++i)
+ fprintf (asm_out_file, "0x%x,", bytes[i]);
+ fprintf (asm_out_file, "0x%x", bytes[i]);
+ }
+}
+
/* Output an immediate constant in a given SIZE in bytes. */
void
@@ -505,6 +533,26 @@ eh_data_format_name (int format)
#endif
}
+/* Output an unsigned LEB128 quantity, but only the byte values. */
+
+void
+dw2_asm_output_data_uleb128_raw (unsigned HOST_WIDE_INT value)
+{
+ while (1)
+ {
+ int byte = (value & 0x7f);
+ value >>= 7;
+ if (value != 0)
+ /* More bytes to follow. */
+ byte |= 0x80;
+
+ fprintf (asm_out_file, "0x%x", byte);
+ if (value == 0)
+ break;
+ fputc (',', asm_out_file);
+ }
+}
+
/* Output an unsigned LEB128 quantity. */
void
@@ -566,6 +614,29 @@ dw2_asm_output_data_uleb128 (unsigned HOST_WIDE_INT value,
va_end (ap);
}
+/* Output an signed LEB128 quantity, but only the byte values. */
+
+void
+dw2_asm_output_data_sleb128_raw (HOST_WIDE_INT value)
+{
+ int byte, more;
+
+ while (1)
+ {
+ byte = (value & 0x7f);
+ value >>= 7;
+ more = !((value == 0 && (byte & 0x40) == 0)
+ || (value == -1 && (byte & 0x40) != 0));
+ if (more)
+ byte |= 0x80;
+
+ fprintf (asm_out_file, "0x%x", byte);
+ if (!more)
+ break;
+ fputc (',', asm_out_file);
+ }
+}
+
/* Output a signed LEB128 quantity. */
void
@@ -689,7 +760,6 @@ dw2_asm_output_delta_sleb128 (const char *lab1 ATTRIBUTE_UNUSED,
}
#endif /* 0 */
-static rtx dw2_force_const_mem (rtx, bool);
static int dw2_output_indirect_constant_1 (splay_tree_node, void *);
static GTY((param1_is (char *), param2_is (tree))) splay_tree indirect_pool;
@@ -730,11 +800,11 @@ splay_tree_compare_strings (splay_tree_key k1, splay_tree_key k2)
/* Put X, a SYMBOL_REF, in memory. Return a SYMBOL_REF to the allocated
memory. Differs from force_const_mem in that a single pool is used for
the entire unit of translation, and the memory is not guaranteed to be
- "near" the function in any interesting sense. PUBLIC controls whether
+ "near" the function in any interesting sense. IS_PUBLIC controls whether
the symbol can be shared across the entire application (or DSO). */
-static rtx
-dw2_force_const_mem (rtx x, bool public)
+rtx
+dw2_force_const_mem (rtx x, bool is_public)
{
splay_tree_node node;
const char *str;
@@ -755,7 +825,7 @@ dw2_force_const_mem (rtx x, bool public)
{
tree id;
- if (public && USE_LINKONCE_INDIRECT)
+ if (is_public && USE_LINKONCE_INDIRECT)
{
char *ref_name = XALLOCAVEC (char, strlen (str) + sizeof "DW.ref.");
@@ -829,7 +899,7 @@ dw2_output_indirect_constants (void)
reference is shared across the entire application (or DSO). */
void
-dw2_asm_output_encoded_addr_rtx (int encoding, rtx addr, bool public,
+dw2_asm_output_encoded_addr_rtx (int encoding, rtx addr, bool is_public,
const char *comment, ...)
{
int size;
@@ -870,7 +940,7 @@ dw2_asm_output_encoded_addr_rtx (int encoding, rtx addr, bool public,
the constant pool for this function. Moreover, we'd like to
share these constants across the entire unit of translation and
even, if possible, across the entire application (or DSO). */
- addr = dw2_force_const_mem (addr, public);
+ addr = dw2_force_const_mem (addr, is_public);
encoding &= ~DW_EH_PE_indirect;
goto restart;
}
diff --git a/gcc/dwarf2asm.h b/gcc/dwarf2asm.h
index 03fc0ca0e16..70fbd4c4400 100644
--- a/gcc/dwarf2asm.h
+++ b/gcc/dwarf2asm.h
@@ -20,6 +20,8 @@ along with GCC; see the file COPYING3. If not see
extern void dw2_assemble_integer (int, rtx);
+extern void dw2_asm_output_data_raw (int, unsigned HOST_WIDE_INT);
+
extern void dw2_asm_output_data (int, unsigned HOST_WIDE_INT,
const char *, ...)
ATTRIBUTE_NULL_PRINTF_3;
@@ -46,10 +48,14 @@ extern void dw2_asm_output_nstring (const char *, size_t,
const char *, ...)
ATTRIBUTE_NULL_PRINTF_3;
+extern void dw2_asm_output_data_uleb128_raw (unsigned HOST_WIDE_INT);
+
extern void dw2_asm_output_data_uleb128 (unsigned HOST_WIDE_INT,
const char *, ...)
ATTRIBUTE_NULL_PRINTF_2;
+extern void dw2_asm_output_data_sleb128_raw (HOST_WIDE_INT);
+
extern void dw2_asm_output_data_sleb128 (HOST_WIDE_INT,
const char *, ...)
ATTRIBUTE_NULL_PRINTF_2;
@@ -63,6 +69,7 @@ extern int size_of_sleb128 (HOST_WIDE_INT);
extern int size_of_encoded_value (int);
extern const char *eh_data_format_name (int);
+extern rtx dw2_force_const_mem (rtx, bool);
extern void dw2_output_indirect_constants (void);
/* These are currently unused. */
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 46ab10481d5..fff0859e0be 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -130,6 +130,32 @@ dwarf2out_do_frame (void)
);
}
+/* Decide whether to emit frame unwind via assembler directives. */
+
+int
+dwarf2out_do_cfi_asm (void)
+{
+ int enc;
+
+ if (!flag_dwarf2_cfi_asm || !dwarf2out_do_frame ())
+ return false;
+ if (!eh_personality_libfunc)
+ return true;
+ if (!HAVE_GAS_CFI_PERSONALITY_DIRECTIVE)
+ return false;
+
+ /* Make sure the personality encoding is one the assembler can support.
+ In particular, aligned addresses can't be handled. */
+ enc = ASM_PREFERRED_EH_DATA_FORMAT (/*code=*/2,/*global=*/1);
+ if ((enc & 0x70) != 0 && (enc & 0x70) != DW_EH_PE_pcrel)
+ return false;
+ enc = ASM_PREFERRED_EH_DATA_FORMAT (/*code=*/0,/*global=*/0);
+ if ((enc & 0x70) != 0 && (enc & 0x70) != DW_EH_PE_pcrel)
+ return false;
+
+ return true;
+}
+
/* The size of the target's pointer type. */
#ifndef PTR_SIZE
#define PTR_SIZE (POINTER_SIZE / BITS_PER_UNIT)
@@ -239,9 +265,18 @@ typedef struct dw_fde_struct GTY(())
bool dw_fde_switched_sections;
dw_cfi_ref dw_fde_cfi;
unsigned funcdef_number;
+ HOST_WIDE_INT stack_realignment;
+ /* Dynamic realign argument pointer register. */
+ unsigned int drap_reg;
+ /* Virtual dynamic realign argument pointer register. */
+ unsigned int vdrap_reg;
unsigned all_throwers_are_sibcalls : 1;
unsigned nothrow : 1;
unsigned uses_eh_lsda : 1;
+ /* Whether we did stack realign in this call frame. */
+ unsigned stack_realign : 1;
+ /* Whether dynamic realign argument pointer register has been saved. */
+ unsigned drap_reg_saved: 1;
}
dw_fde_node;
@@ -375,19 +410,24 @@ static void initial_return_save (rtx);
#endif
static HOST_WIDE_INT stack_adjust_offset (const_rtx);
static void output_cfi (dw_cfi_ref, dw_fde_ref, int);
+static void output_cfi_directive (dw_cfi_ref);
static void output_call_frame_info (int);
static void dwarf2out_note_section_used (void);
static void dwarf2out_stack_adjust (rtx, bool);
+static void dwarf2out_args_size_adjust (HOST_WIDE_INT, const char *);
static void flush_queued_reg_saves (void);
static bool clobbers_queued_reg_save (const_rtx);
static void dwarf2out_frame_debug_expr (rtx, const char *);
/* Support for complex CFA locations. */
static void output_cfa_loc (dw_cfi_ref);
+static void output_cfa_loc_raw (dw_cfi_ref);
static void get_cfa_from_loc_descr (dw_cfa_location *,
struct dw_loc_descr_struct *);
static struct dw_loc_descr_struct *build_cfa_loc
(dw_cfa_location *, HOST_WIDE_INT);
+static struct dw_loc_descr_struct *build_cfa_aligned_loc
+ (HOST_WIDE_INT, HOST_WIDE_INT);
static void def_cfa_1 (const char *, dw_cfa_location *);
/* How to start an assembler comment. */
@@ -621,6 +661,23 @@ static inline void
add_cfi (dw_cfi_ref *list_head, dw_cfi_ref cfi)
{
dw_cfi_ref *p;
+ dw_fde_ref fde = current_fde ();
+
+ /* When DRAP is used, CFA is defined with an expression. Redefine
+ CFA may lead to a different CFA value. */
+ if (fde && fde->drap_reg != INVALID_REGNUM)
+ switch (cfi->dw_cfi_opc)
+ {
+ case DW_CFA_def_cfa_register:
+ case DW_CFA_def_cfa_offset:
+ case DW_CFA_def_cfa_offset_sf:
+ case DW_CFA_def_cfa:
+ case DW_CFA_def_cfa_sf:
+ gcc_unreachable ();
+
+ default:
+ break;
+ }
/* Find the end of the chain. */
for (p = list_head; (*p) != NULL; p = &(*p)->dw_cfi_next)
@@ -636,8 +693,19 @@ dwarf2out_cfi_label (void)
{
static char label[20];
- ASM_GENERATE_INTERNAL_LABEL (label, "LCFI", dwarf2out_cfi_label_num++);
- ASM_OUTPUT_LABEL (asm_out_file, label);
+ if (dwarf2out_do_cfi_asm ())
+ {
+ /* In this case, we will be emitting the asm directive instead of
+ the label, so just return a placeholder to keep the rest of the
+ interfaces happy. */
+ strcpy (label, "<do not output>");
+ }
+ else
+ {
+ ASM_GENERATE_INTERNAL_LABEL (label, "LCFI", dwarf2out_cfi_label_num++);
+ ASM_OUTPUT_LABEL (asm_out_file, label);
+ }
+
return label;
}
@@ -647,7 +715,25 @@ dwarf2out_cfi_label (void)
static void
add_fde_cfi (const char *label, dw_cfi_ref cfi)
{
- if (label)
+ dw_cfi_ref *list_head = &cie_cfi_head;
+
+ if (dwarf2out_do_cfi_asm ())
+ {
+ if (label)
+ {
+ output_cfi_directive (cfi);
+
+ /* We still have to add the cfi to the list so that
+ lookup_cfa works later on. */
+ list_head = &current_fde ()->dw_fde_cfi;
+ }
+ /* ??? If this is a CFI for the CIE, we don't emit. This
+ assumes that the standard CIE contents that the assembler
+ uses matches the standard CIE contents that the compiler
+ uses. This is probably a bad assumption. I'm not quite
+ sure how to address this for now. */
+ }
+ else if (label)
{
dw_fde_ref fde = current_fde ();
@@ -676,11 +762,10 @@ add_fde_cfi (const char *label, dw_cfi_ref cfi)
fde->dw_fde_current_label = label;
}
- add_cfi (&fde->dw_fde_cfi, cfi);
+ list_head = &fde->dw_fde_cfi;
}
- else
- add_cfi (&cie_cfi_head, cfi);
+ add_cfi (list_head, cfi);
}
/* Subroutine of lookup_cfa. */
@@ -880,10 +965,22 @@ static void
reg_save (const char *label, unsigned int reg, unsigned int sreg, HOST_WIDE_INT offset)
{
dw_cfi_ref cfi = new_cfi ();
+ dw_fde_ref fde = current_fde ();
cfi->dw_cfi_oprnd1.dw_cfi_reg_num = reg;
- if (sreg == INVALID_REGNUM)
+ /* When stack is aligned, store REG using DW_CFA_expression with
+ FP. */
+ if (fde
+ && fde->stack_realign
+ && sreg == INVALID_REGNUM)
+ {
+ cfi->dw_cfi_opc = DW_CFA_expression;
+ cfi->dw_cfi_oprnd2.dw_cfi_reg_num = reg;
+ cfi->dw_cfi_oprnd1.dw_cfi_loc
+ = build_cfa_aligned_loc (offset, fde->stack_realignment);
+ }
+ else if (sreg == INVALID_REGNUM)
{
if (reg & ~0x3f)
/* The register number won't fit in 6 bits, so we have to use
@@ -1115,6 +1212,168 @@ stack_adjust_offset (const_rtx pattern)
return offset;
}
+/* Precomputed args_size for CODE_LABELs and BARRIERs preceeding them,
+ indexed by INSN_UID. */
+
+static HOST_WIDE_INT *barrier_args_size;
+
+/* Helper function for compute_barrier_args_size. Handle one insn. */
+
+static HOST_WIDE_INT
+compute_barrier_args_size_1 (rtx insn, HOST_WIDE_INT cur_args_size,
+ VEC (rtx, heap) **next)
+{
+ HOST_WIDE_INT offset = 0;
+ int i;
+
+ if (! RTX_FRAME_RELATED_P (insn))
+ {
+ if (prologue_epilogue_contains (insn)
+ || sibcall_epilogue_contains (insn))
+ /* Nothing */;
+ else if (GET_CODE (PATTERN (insn)) == SET)
+ offset = stack_adjust_offset (PATTERN (insn));
+ else if (GET_CODE (PATTERN (insn)) == PARALLEL
+ || GET_CODE (PATTERN (insn)) == SEQUENCE)
+ {
+ /* There may be stack adjustments inside compound insns. Search
+ for them. */
+ for (i = XVECLEN (PATTERN (insn), 0) - 1; i >= 0; i--)
+ if (GET_CODE (XVECEXP (PATTERN (insn), 0, i)) == SET)
+ offset += stack_adjust_offset (XVECEXP (PATTERN (insn), 0, i));
+ }
+ }
+ else
+ {
+ rtx expr = find_reg_note (insn, REG_FRAME_RELATED_EXPR, NULL_RTX);
+
+ if (expr)
+ {
+ expr = XEXP (expr, 0);
+ if (GET_CODE (expr) == PARALLEL
+ || GET_CODE (expr) == SEQUENCE)
+ for (i = 1; i < XVECLEN (expr, 0); i++)
+ {
+ rtx elem = XVECEXP (expr, 0, i);
+
+ if (GET_CODE (elem) == SET && !RTX_FRAME_RELATED_P (elem))
+ offset += stack_adjust_offset (elem);
+ }
+ }
+ }
+
+#ifndef STACK_GROWS_DOWNWARD
+ offset = -offset;
+#endif
+
+ cur_args_size += offset;
+ if (cur_args_size < 0)
+ cur_args_size = 0;
+
+ if (JUMP_P (insn))
+ {
+ rtx dest = JUMP_LABEL (insn);
+
+ if (dest)
+ {
+ if (barrier_args_size [INSN_UID (dest)] < 0)
+ {
+ barrier_args_size [INSN_UID (dest)] = cur_args_size;
+ VEC_safe_push (rtx, heap, *next, dest);
+ }
+ }
+ }
+
+ return cur_args_size;
+}
+
+/* Walk the whole function and compute args_size on BARRIERs. */
+
+static void
+compute_barrier_args_size (void)
+{
+ int max_uid = get_max_uid (), i;
+ rtx insn;
+ VEC (rtx, heap) *worklist, *next, *tmp;
+
+ barrier_args_size = XNEWVEC (HOST_WIDE_INT, max_uid);
+ for (i = 0; i < max_uid; i++)
+ barrier_args_size[i] = -1;
+
+ worklist = VEC_alloc (rtx, heap, 20);
+ next = VEC_alloc (rtx, heap, 20);
+ insn = get_insns ();
+ barrier_args_size[INSN_UID (insn)] = 0;
+ VEC_quick_push (rtx, worklist, insn);
+ for (;;)
+ {
+ while (!VEC_empty (rtx, worklist))
+ {
+ rtx prev, body, first_insn;
+ HOST_WIDE_INT cur_args_size;
+
+ first_insn = insn = VEC_pop (rtx, worklist);
+ cur_args_size = barrier_args_size[INSN_UID (insn)];
+ prev = prev_nonnote_insn (insn);
+ if (prev && BARRIER_P (prev))
+ barrier_args_size[INSN_UID (prev)] = cur_args_size;
+
+ for (; insn; insn = NEXT_INSN (insn))
+ {
+ if (INSN_DELETED_P (insn) || NOTE_P (insn))
+ continue;
+ if (BARRIER_P (insn))
+ break;
+
+ if (LABEL_P (insn))
+ {
+ if (insn == first_insn)
+ continue;
+ else if (barrier_args_size[INSN_UID (insn)] < 0)
+ {
+ barrier_args_size[INSN_UID (insn)] = cur_args_size;
+ continue;
+ }
+ else
+ {
+ /* The insns starting with this label have been
+ already scanned or are in the worklist. */
+ break;
+ }
+ }
+
+ body = PATTERN (insn);
+ if (GET_CODE (body) == SEQUENCE)
+ {
+ for (i = 1; i < XVECLEN (body, 0); i++)
+ cur_args_size
+ = compute_barrier_args_size_1 (XVECEXP (body, 0, i),
+ cur_args_size, &next);
+ cur_args_size
+ = compute_barrier_args_size_1 (XVECEXP (body, 0, 0),
+ cur_args_size, &next);
+ }
+ else
+ cur_args_size
+ = compute_barrier_args_size_1 (insn, cur_args_size, &next);
+ }
+ }
+
+ if (VEC_empty (rtx, next))
+ break;
+
+ /* Swap WORKLIST with NEXT and truncate NEXT for next iteration. */
+ tmp = next;
+ next = worklist;
+ worklist = tmp;
+ VEC_truncate (rtx, next, 0);
+ }
+
+ VEC_free (rtx, heap, worklist);
+ VEC_free (rtx, heap, next);
+}
+
+
/* Check INSN to see if it looks like a push or a stack adjustment, and
make a note of it if it does. EH uses this information to find out how
much extra space it needs to pop off the stack. */
@@ -1159,13 +1418,22 @@ dwarf2out_stack_adjust (rtx insn, bool after_p)
}
else if (BARRIER_P (insn))
{
- /* When we see a BARRIER, we know to reset args_size to 0. Usually
- the compiler will have already emitted a stack adjustment, but
- doesn't bother for calls to noreturn functions. */
-#ifdef STACK_GROWS_DOWNWARD
- offset = -args_size;
-#else
- offset = args_size;
+ /* Don't call compute_barrier_args_size () if the only
+ BARRIER is at the end of function. */
+ if (barrier_args_size == NULL && next_nonnote_insn (insn))
+ compute_barrier_args_size ();
+ if (barrier_args_size == NULL)
+ offset = 0;
+ else
+ {
+ offset = barrier_args_size[INSN_UID (insn)];
+ if (offset < 0)
+ offset = 0;
+ }
+
+ offset -= args_size;
+#ifndef STACK_GROWS_DOWNWARD
+ offset = -offset;
#endif
}
else if (GET_CODE (PATTERN (insn)) == SET)
@@ -1185,9 +1453,21 @@ dwarf2out_stack_adjust (rtx insn, bool after_p)
if (offset == 0)
return;
+ label = dwarf2out_cfi_label ();
+ dwarf2out_args_size_adjust (offset, label);
+}
+
+/* Adjust args_size based on stack adjustment OFFSET. */
+
+static void
+dwarf2out_args_size_adjust (HOST_WIDE_INT offset, const char *label)
+{
if (cfa.reg == STACK_POINTER_REGNUM)
cfa.offset += offset;
+ if (cfa_store.reg == STACK_POINTER_REGNUM)
+ cfa_store.offset += offset;
+
#ifndef STACK_GROWS_DOWNWARD
offset = -offset;
#endif
@@ -1196,7 +1476,6 @@ dwarf2out_stack_adjust (rtx insn, bool after_p)
if (args_size < 0)
args_size = 0;
- label = dwarf2out_cfi_label ();
def_cfa_1 (label, &cfa);
if (flag_asynchronous_unwind_tables)
dwarf2out_args_size (label, args_size);
@@ -1445,6 +1724,11 @@ static dw_cfa_location cfa_temp;
difference of the original location and cfa_store's
location (or cfa_temp's location if cfa_temp is used).
+ Rules 16-20: If AND operation happens on sp in prologue, we assume
+ stack is realigned. We will use a group of DW_OP_XXX
+ expressions to represent the location of the stored
+ register instead of CFA+offset.
+
The Rules
"{a,b}" indicates a choice of a xor b.
@@ -1538,13 +1822,48 @@ static dw_cfa_location cfa_temp;
Rule 15:
(set <reg> {unspec, unspec_volatile})
- effects: target-dependent */
+ effects: target-dependent
+
+ Rule 16:
+ (set sp (and: sp <const_int>))
+ constraints: cfa_store.reg == sp
+ effects: current_fde.stack_realign = 1
+ cfa_store.offset = 0
+ fde->drap_reg = cfa.reg if cfa.reg != sp and cfa.reg != fp
+
+ Rule 17:
+ (set (mem ({pre_inc, pre_dec} sp)) (mem (plus (cfa.reg) (const_int))))
+ effects: cfa_store.offset += -/+ mode_size(mem)
+
+ Rule 18:
+ (set (mem ({pre_inc, pre_dec} sp)) fp)
+ constraints: fde->stack_realign == 1
+ effects: cfa_store.offset = 0
+ cfa.reg != HARD_FRAME_POINTER_REGNUM
+
+ Rule 19:
+ (set (mem ({pre_inc, pre_dec} sp)) cfa.reg)
+ constraints: fde->stack_realign == 1
+ && cfa.offset == 0
+ && cfa.indirect == 0
+ && cfa.reg != HARD_FRAME_POINTER_REGNUM
+ effects: Use DW_CFA_def_cfa_expression to define cfa
+ cfa.reg == fde->drap_reg
+
+ Rule 20:
+ (set reg fde->drap_reg)
+ constraints: fde->vdrap_reg == INVALID_REGNUM
+ effects: fde->vdrap_reg = reg.
+ (set mem fde->drap_reg)
+ constraints: fde->drap_reg_saved == 1
+ effects: none. */
static void
dwarf2out_frame_debug_expr (rtx expr, const char *label)
{
rtx src, dest, span;
HOST_WIDE_INT offset;
+ dw_fde_ref fde;
/* If RTX_FRAME_RELATED_P is set on a PARALLEL, process each member of
the PARALLEL independently. The first element is always processed if
@@ -1588,22 +1907,7 @@ dwarf2out_frame_debug_expr (rtx expr, const char *label)
HOST_WIDE_INT offset = stack_adjust_offset (elem);
if (offset != 0)
- {
- if (cfa.reg == STACK_POINTER_REGNUM)
- cfa.offset += offset;
-
-#ifndef STACK_GROWS_DOWNWARD
- offset = -offset;
-#endif
-
- args_size += offset;
- if (args_size < 0)
- args_size = 0;
-
- def_cfa_1 (label, &cfa);
- if (flag_asynchronous_unwind_tables)
- dwarf2out_args_size (label, args_size);
- }
+ dwarf2out_args_size_adjust (offset, label);
}
}
return;
@@ -1621,6 +1925,26 @@ dwarf2out_frame_debug_expr (rtx expr, const char *label)
src = rsi;
}
+ fde = current_fde ();
+
+ if (GET_CODE (src) == REG
+ && fde
+ && fde->drap_reg == REGNO (src)
+ && (fde->drap_reg_saved
+ || GET_CODE (dest) == REG))
+ {
+ /* Rule 20 */
+ /* If we are saving dynamic realign argument pointer to a
+ register, the destination is virtual dynamic realign
+ argument pointer. It may be used to access argument. */
+ if (GET_CODE (dest) == REG)
+ {
+ gcc_assert (fde->vdrap_reg == INVALID_REGNUM);
+ fde->vdrap_reg = REGNO (dest);
+ }
+ return;
+ }
+
switch (GET_CODE (dest))
{
case REG:
@@ -1649,7 +1973,19 @@ dwarf2out_frame_debug_expr (rtx expr, const char *label)
/* For the SPARC and its register window. */
|| (DWARF_FRAME_REGNUM (REGNO (src))
== DWARF_FRAME_RETURN_COLUMN));
- queue_reg_save (label, src, dest, 0);
+
+ /* After stack is aligned, we can only save SP in FP
+ if drap register is used. In this case, we have
+ to restore stack pointer with the CFA value and we
+ don't generate this DWARF information. */
+ if (fde
+ && fde->stack_realign
+ && REGNO (src) == STACK_POINTER_REGNUM)
+ gcc_assert (REGNO (dest) == HARD_FRAME_POINTER_REGNUM
+ && fde->drap_reg != INVALID_REGNUM
+ && cfa.reg != REGNO (src));
+ else
+ queue_reg_save (label, src, dest, 0);
}
break;
@@ -1782,6 +2118,24 @@ dwarf2out_frame_debug_expr (rtx expr, const char *label)
targetm.dwarf_handle_frame_unspec (label, expr, XINT (src, 1));
return;
+ /* Rule 16 */
+ case AND:
+ /* If this AND operation happens on stack pointer in prologue,
+ we assume the stack is realigned and we extract the
+ alignment. */
+ if (fde && XEXP (src, 0) == stack_pointer_rtx)
+ {
+ gcc_assert (cfa_store.reg == REGNO (XEXP (src, 0)));
+ fde->stack_realign = 1;
+ fde->stack_realignment = INTVAL (XEXP (src, 1));
+ cfa_store.offset = 0;
+
+ if (cfa.reg != STACK_POINTER_REGNUM
+ && cfa.reg != HARD_FRAME_POINTER_REGNUM)
+ fde->drap_reg = cfa.reg;
+ }
+ return;
+
default:
gcc_unreachable ();
}
@@ -1790,7 +2144,6 @@ dwarf2out_frame_debug_expr (rtx expr, const char *label)
break;
case MEM:
- gcc_assert (REG_P (src));
/* Saving a register to the stack. Make sure dest is relative to the
CFA register. */
@@ -1821,10 +2174,23 @@ dwarf2out_frame_debug_expr (rtx expr, const char *label)
if (GET_CODE (XEXP (dest, 0)) == PRE_INC)
offset = -offset;
- gcc_assert (REGNO (XEXP (XEXP (dest, 0), 0)) == STACK_POINTER_REGNUM
+ gcc_assert ((REGNO (XEXP (XEXP (dest, 0), 0))
+ == STACK_POINTER_REGNUM)
&& cfa_store.reg == STACK_POINTER_REGNUM);
cfa_store.offset += offset;
+
+ /* Rule 18: If stack is aligned, we will use FP as a
+ reference to represent the address of the stored
+ regiser. */
+ if (fde
+ && fde->stack_realign
+ && src == hard_frame_pointer_rtx)
+ {
+ gcc_assert (cfa.reg != HARD_FRAME_POINTER_REGNUM);
+ cfa_store.offset = 0;
+ }
+
if (cfa.reg == STACK_POINTER_REGNUM)
cfa.offset = cfa_store.offset;
@@ -1885,6 +2251,13 @@ dwarf2out_frame_debug_expr (rtx expr, const char *label)
gcc_unreachable ();
}
+ /* Rule 17 */
+ /* If the source operand of this MEM operation is not a
+ register, basically the source is return address. Here
+ we only care how much stack grew and we don't save it. */
+ if (!REG_P (src))
+ break;
+
if (REGNO (src) != STACK_POINTER_REGNUM
&& REGNO (src) != HARD_FRAME_POINTER_REGNUM
&& (unsigned) REGNO (src) == cfa.reg)
@@ -1893,6 +2266,32 @@ dwarf2out_frame_debug_expr (rtx expr, const char *label)
if (cfa.offset == 0)
{
+ /* Rule 19 */
+ /* If stack is aligned, putting CFA reg into stack means
+ we can no longer use reg + offset to represent CFA.
+ Here we use DW_CFA_def_cfa_expression instead. The
+ result of this expression equals to the original CFA
+ value. */
+ if (fde
+ && fde->stack_realign
+ && cfa.indirect == 0
+ && cfa.reg != HARD_FRAME_POINTER_REGNUM)
+ {
+ dw_cfa_location cfa_exp;
+
+ gcc_assert (fde->drap_reg == cfa.reg);
+
+ cfa_exp.indirect = 1;
+ cfa_exp.reg = HARD_FRAME_POINTER_REGNUM;
+ cfa_exp.base_offset = offset;
+ cfa_exp.offset = 0;
+
+ fde->drap_reg_saved = 1;
+
+ def_cfa_1 (label, &cfa_exp);
+ break;
+ }
+
/* If the source register is exactly the CFA, assume
we're saving SP like any other register; this happens
on the ARM. */
@@ -1988,6 +2387,12 @@ dwarf2out_frame_debug (rtx insn, bool after_p)
regs_saved_in_regs[i].saved_in_reg = NULL_RTX;
}
num_regs_saved_in_regs = 0;
+
+ if (barrier_args_size)
+ {
+ XDELETEVEC (barrier_args_size);
+ barrier_args_size = NULL;
+ }
return;
}
@@ -2265,6 +2670,100 @@ output_cfi (dw_cfi_ref cfi, dw_fde_ref fde, int for_eh)
}
}
+/* Similar, but do it via assembler directives instead. */
+
+static void
+output_cfi_directive (dw_cfi_ref cfi)
+{
+ unsigned long r, r2;
+
+ switch (cfi->dw_cfi_opc)
+ {
+ case DW_CFA_advance_loc:
+ case DW_CFA_advance_loc1:
+ case DW_CFA_advance_loc2:
+ case DW_CFA_advance_loc4:
+ case DW_CFA_MIPS_advance_loc8:
+ case DW_CFA_set_loc:
+ /* Should only be created by add_fde_cfi in a code path not
+ followed when emitting via directives. The assembler is
+ going to take care of this for us. */
+ gcc_unreachable ();
+
+ case DW_CFA_offset:
+ case DW_CFA_offset_extended:
+ case DW_CFA_offset_extended_sf:
+ r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 0);
+ fprintf (asm_out_file, "\t.cfi_offset %lu, "HOST_WIDE_INT_PRINT_DEC"\n",
+ r, cfi->dw_cfi_oprnd2.dw_cfi_offset * DWARF_CIE_DATA_ALIGNMENT);
+ break;
+
+ case DW_CFA_restore:
+ case DW_CFA_restore_extended:
+ r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 0);
+ fprintf (asm_out_file, "\t.cfi_restore %lu\n", r);
+ break;
+
+ case DW_CFA_undefined:
+ r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 0);
+ fprintf (asm_out_file, "\t.cfi_undefined %lu\n", r);
+ break;
+
+ case DW_CFA_same_value:
+ r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 0);
+ fprintf (asm_out_file, "\t.cfi_same_value %lu\n", r);
+ break;
+
+ case DW_CFA_def_cfa:
+ case DW_CFA_def_cfa_sf:
+ r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 0);
+ fprintf (asm_out_file, "\t.cfi_def_cfa %lu, "HOST_WIDE_INT_PRINT_DEC"\n",
+ r, cfi->dw_cfi_oprnd2.dw_cfi_offset);
+ break;
+
+ case DW_CFA_def_cfa_register:
+ r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 0);
+ fprintf (asm_out_file, "\t.cfi_def_cfa_register %lu\n", r);
+ break;
+
+ case DW_CFA_register:
+ r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 0);
+ r2 = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd2.dw_cfi_reg_num, 0);
+ fprintf (asm_out_file, "\t.cfi_register %lu, %lu\n", r, r2);
+ break;
+
+ case DW_CFA_def_cfa_offset:
+ case DW_CFA_def_cfa_offset_sf:
+ fprintf (asm_out_file, "\t.cfi_def_cfa_offset "
+ HOST_WIDE_INT_PRINT_DEC"\n",
+ cfi->dw_cfi_oprnd1.dw_cfi_offset);
+ break;
+
+ case DW_CFA_GNU_args_size:
+ fprintf (asm_out_file, "\t.cfi_escape 0x%x,", DW_CFA_GNU_args_size);
+ dw2_asm_output_data_uleb128_raw (cfi->dw_cfi_oprnd1.dw_cfi_offset);
+ if (flag_debug_asm)
+ fprintf (asm_out_file, "\t%s args_size "HOST_WIDE_INT_PRINT_DEC,
+ ASM_COMMENT_START, cfi->dw_cfi_oprnd1.dw_cfi_offset);
+ fputc ('\n', asm_out_file);
+ break;
+
+ case DW_CFA_GNU_window_save:
+ fprintf (asm_out_file, "\t.cfi_window_save\n");
+ break;
+
+ case DW_CFA_def_cfa_expression:
+ case DW_CFA_expression:
+ fprintf (asm_out_file, "\t.cfi_escape 0x%x,", cfi->dw_cfi_opc);
+ output_cfa_loc_raw (cfi);
+ fputc ('\n', asm_out_file);
+ break;
+
+ default:
+ gcc_unreachable ();
+ }
+}
+
/* Output the call frame information used to record information
that relates to calculating the frame pointer, and records the
location of saved registers. */
@@ -2288,6 +2787,10 @@ output_call_frame_info (int for_eh)
if (fde_table_in_use == 0)
return;
+ /* Nothing to do if the assembler's doing it all. */
+ if (dwarf2out_do_cfi_asm ())
+ return;
+
/* If we make FDEs linkonce, we may have to emit an empty label for
an FDE that wouldn't otherwise be emitted. We want to avoid
having an FDE kept around when the function it refers to is
@@ -2693,6 +3196,8 @@ dwarf2out_begin_prologue (unsigned int line ATTRIBUTE_UNUSED,
fde->nothrow = TREE_NOTHROW (current_function_decl);
fde->uses_eh_lsda = crtl->uses_eh_lsda;
fde->all_throwers_are_sibcalls = crtl->all_throwers_are_sibcalls;
+ fde->drap_reg = INVALID_REGNUM;
+ fde->vdrap_reg = INVALID_REGNUM;
args_size = old_args_size = 0;
@@ -2702,6 +3207,49 @@ dwarf2out_begin_prologue (unsigned int line ATTRIBUTE_UNUSED,
if (file)
dwarf2out_source_line (line, file);
#endif
+
+ if (dwarf2out_do_cfi_asm ())
+ {
+ int enc;
+ rtx ref;
+
+ fprintf (asm_out_file, "\t.cfi_startproc\n");
+
+ if (eh_personality_libfunc)
+ {
+ enc = ASM_PREFERRED_EH_DATA_FORMAT (/*code=*/2, /*global=*/1);
+ ref = eh_personality_libfunc;
+
+ /* ??? The GAS support isn't entirely consistent. We have to
+ handle indirect support ourselves, but PC-relative is done
+ in the assembler. Further, the assembler can't handle any
+ of the weirder relocation types. */
+ if (enc & DW_EH_PE_indirect)
+ ref = dw2_force_const_mem (ref, true);
+
+ fprintf (asm_out_file, "\t.cfi_personality 0x%x,", enc);
+ output_addr_const (asm_out_file, ref);
+ fputc ('\n', asm_out_file);
+ }
+
+ if (crtl->uses_eh_lsda)
+ {
+ char lab[20];
+
+ enc = ASM_PREFERRED_EH_DATA_FORMAT (/*code=*/0, /*global=*/0);
+ ASM_GENERATE_INTERNAL_LABEL (lab, "LLSDA",
+ current_function_funcdef_no);
+ ref = gen_rtx_SYMBOL_REF (Pmode, lab);
+ SYMBOL_REF_FLAGS (ref) = SYMBOL_FLAG_LOCAL;
+
+ if (enc & DW_EH_PE_indirect)
+ ref = dw2_force_const_mem (ref, true);
+
+ fprintf (asm_out_file, "\t.cfi_lsda 0x%x,", enc);
+ output_addr_const (asm_out_file, ref);
+ fputc ('\n', asm_out_file);
+ }
+ }
}
/* Output a marker (i.e. a label) for the absolute end of the generated code
@@ -2715,6 +3263,9 @@ dwarf2out_end_epilogue (unsigned int line ATTRIBUTE_UNUSED,
dw_fde_ref fde;
char label[MAX_ARTIFICIAL_LABEL_BYTES];
+ if (dwarf2out_do_cfi_asm ())
+ fprintf (asm_out_file, "\t.cfi_endproc\n");
+
/* Output a label to mark the endpoint of the code generated for this
function. */
ASM_GENERATE_INTERNAL_LABEL (label, FUNC_END_LABEL,
@@ -2921,14 +3472,7 @@ typedef struct dw_loc_list_struct GTY(())
#if defined (DWARF2_DEBUGGING_INFO) || defined (DWARF2_UNWIND_INFO)
-static const char *dwarf_stack_op_name (unsigned);
-static dw_loc_descr_ref new_loc_descr (enum dwarf_location_atom,
- unsigned HOST_WIDE_INT, unsigned HOST_WIDE_INT);
-static void add_loc_descr (dw_loc_descr_ref *, dw_loc_descr_ref);
-static unsigned long size_of_loc_descr (dw_loc_descr_ref);
-static unsigned long size_of_locs (dw_loc_descr_ref);
-static void output_loc_operands (dw_loc_descr_ref);
-static void output_loc_sequence (dw_loc_descr_ref);
+static dw_loc_descr_ref int_loc_descriptor (HOST_WIDE_INT);
/* Convert a DWARF stack opcode into its string name. */
@@ -3264,6 +3808,25 @@ new_loc_descr (enum dwarf_location_atom op, unsigned HOST_WIDE_INT oprnd1,
return descr;
}
+/* Return a pointer to a newly allocated location description for
+ REG and OFFSET. */
+
+static inline dw_loc_descr_ref
+new_reg_loc_descr (unsigned int reg, unsigned HOST_WIDE_INT offset)
+{
+ if (offset)
+ {
+ if (reg <= 31)
+ return new_loc_descr (DW_OP_breg0 + reg, offset, 0);
+ else
+ return new_loc_descr (DW_OP_bregx, reg, offset);
+ }
+ else if (reg <= 31)
+ return new_loc_descr (DW_OP_reg0 + reg, 0, 0);
+ else
+ return new_loc_descr (DW_OP_regx, reg, 0);
+}
+
/* Add a location description term to a location description expression. */
static inline void
@@ -3574,6 +4137,141 @@ output_loc_sequence (dw_loc_descr_ref loc)
}
}
+/* Output location description stack opcode's operands (if any).
+ The output is single bytes on a line, suitable for .cfi_escape. */
+
+static void
+output_loc_operands_raw (dw_loc_descr_ref loc)
+{
+ dw_val_ref val1 = &loc->dw_loc_oprnd1;
+ dw_val_ref val2 = &loc->dw_loc_oprnd2;
+
+ switch (loc->dw_loc_opc)
+ {
+ case DW_OP_addr:
+ /* We cannot output addresses in .cfi_escape, only bytes. */
+ gcc_unreachable ();
+
+ case DW_OP_const1u:
+ case DW_OP_const1s:
+ case DW_OP_pick:
+ case DW_OP_deref_size:
+ case DW_OP_xderef_size:
+ fputc (',', asm_out_file);
+ dw2_asm_output_data_raw (1, val1->v.val_int);
+ break;
+
+ case DW_OP_const2u:
+ case DW_OP_const2s:
+ fputc (',', asm_out_file);
+ dw2_asm_output_data_raw (2, val1->v.val_int);
+ break;
+
+ case DW_OP_const4u:
+ case DW_OP_const4s:
+ fputc (',', asm_out_file);
+ dw2_asm_output_data_raw (4, val1->v.val_int);
+ break;
+
+ case DW_OP_const8u:
+ case DW_OP_const8s:
+ gcc_assert (HOST_BITS_PER_LONG >= 64);
+ fputc (',', asm_out_file);
+ dw2_asm_output_data_raw (8, val1->v.val_int);
+ break;
+
+ case DW_OP_skip:
+ case DW_OP_bra:
+ {
+ int offset;
+
+ gcc_assert (val1->val_class == dw_val_class_loc);
+ offset = val1->v.val_loc->dw_loc_addr - (loc->dw_loc_addr + 3);
+
+ fputc (',', asm_out_file);
+ dw2_asm_output_data_raw (2, offset);
+ }
+ break;
+
+ case DW_OP_constu:
+ case DW_OP_plus_uconst:
+ case DW_OP_regx:
+ case DW_OP_piece:
+ fputc (',', asm_out_file);
+ dw2_asm_output_data_uleb128_raw (val1->v.val_unsigned);
+ break;
+
+ case DW_OP_consts:
+ case DW_OP_breg0:
+ case DW_OP_breg1:
+ case DW_OP_breg2:
+ case DW_OP_breg3:
+ case DW_OP_breg4:
+ case DW_OP_breg5:
+ case DW_OP_breg6:
+ case DW_OP_breg7:
+ case DW_OP_breg8:
+ case DW_OP_breg9:
+ case DW_OP_breg10:
+ case DW_OP_breg11:
+ case DW_OP_breg12:
+ case DW_OP_breg13:
+ case DW_OP_breg14:
+ case DW_OP_breg15:
+ case DW_OP_breg16:
+ case DW_OP_breg17:
+ case DW_OP_breg18:
+ case DW_OP_breg19:
+ case DW_OP_breg20:
+ case DW_OP_breg21:
+ case DW_OP_breg22:
+ case DW_OP_breg23:
+ case DW_OP_breg24:
+ case DW_OP_breg25:
+ case DW_OP_breg26:
+ case DW_OP_breg27:
+ case DW_OP_breg28:
+ case DW_OP_breg29:
+ case DW_OP_breg30:
+ case DW_OP_breg31:
+ case DW_OP_fbreg:
+ fputc (',', asm_out_file);
+ dw2_asm_output_data_sleb128_raw (val1->v.val_int);
+ break;
+
+ case DW_OP_bregx:
+ fputc (',', asm_out_file);
+ dw2_asm_output_data_uleb128_raw (val1->v.val_unsigned);
+ fputc (',', asm_out_file);
+ dw2_asm_output_data_sleb128_raw (val2->v.val_int);
+ break;
+
+ case INTERNAL_DW_OP_tls_addr:
+ gcc_unreachable ();
+
+ default:
+ /* Other codes have no operands. */
+ break;
+ }
+}
+
+static void
+output_loc_sequence_raw (dw_loc_descr_ref loc)
+{
+ while (1)
+ {
+ /* Output the opcode. */
+ fprintf (asm_out_file, "0x%x", loc->dw_loc_opc);
+ output_loc_operands_raw (loc);
+
+ if (!loc->dw_loc_next)
+ break;
+ loc = loc->dw_loc_next;
+
+ fputc (',', asm_out_file);
+ }
+}
+
/* This routine will generate the correct assembly data for a location
description based on a cfi entry with a complex address. */
@@ -3583,6 +4281,9 @@ output_cfa_loc (dw_cfi_ref cfi)
dw_loc_descr_ref loc;
unsigned long size;
+ if (cfi->dw_cfi_opc == DW_CFA_expression)
+ dw2_asm_output_data (1, cfi->dw_cfi_oprnd2.dw_cfi_reg_num, NULL);
+
/* Output the size of the block. */
loc = cfi->dw_cfi_oprnd1.dw_cfi_loc;
size = size_of_locs (loc);
@@ -3592,6 +4293,27 @@ output_cfa_loc (dw_cfi_ref cfi)
output_loc_sequence (loc);
}
+/* Similar, but used for .cfi_escape. */
+
+static void
+output_cfa_loc_raw (dw_cfi_ref cfi)
+{
+ dw_loc_descr_ref loc;
+ unsigned long size;
+
+ if (cfi->dw_cfi_opc == DW_CFA_expression)
+ fprintf (asm_out_file, "0x%x,", cfi->dw_cfi_oprnd2.dw_cfi_reg_num);
+
+ /* Output the size of the block. */
+ loc = cfi->dw_cfi_oprnd1.dw_cfi_loc;
+ size = size_of_locs (loc);
+ dw2_asm_output_data_uleb128_raw (size);
+ fputc (',', asm_out_file);
+
+ /* Now output the operations themselves. */
+ output_loc_sequence_raw (loc);
+}
+
/* This function builds a dwarf location descriptor sequence from a
dw_cfa_location, adding the given OFFSET to the result of the
expression. */
@@ -3605,18 +4327,7 @@ build_cfa_loc (dw_cfa_location *cfa, HOST_WIDE_INT offset)
if (cfa->indirect)
{
- if (cfa->base_offset)
- {
- if (cfa->reg <= 31)
- head = new_loc_descr (DW_OP_breg0 + cfa->reg, cfa->base_offset, 0);
- else
- head = new_loc_descr (DW_OP_bregx, cfa->reg, cfa->base_offset);
- }
- else if (cfa->reg <= 31)
- head = new_loc_descr (DW_OP_reg0 + cfa->reg, 0, 0);
- else
- head = new_loc_descr (DW_OP_regx, cfa->reg, 0);
-
+ head = new_reg_loc_descr (cfa->reg, cfa->base_offset);
head->dw_loc_oprnd1.val_class = dw_val_class_const;
tmp = new_loc_descr (DW_OP_deref, 0, 0);
add_loc_descr (&head, tmp);
@@ -3627,18 +4338,34 @@ build_cfa_loc (dw_cfa_location *cfa, HOST_WIDE_INT offset)
}
}
else
+ head = new_reg_loc_descr (cfa->reg, offset);
+
+ return head;
+}
+
+/* This function builds a dwarf location descriptor sequence for
+ the address at OFFSET from the CFA when stack is aligned to
+ ALIGNMENT byte. */
+
+static struct dw_loc_descr_struct *
+build_cfa_aligned_loc (HOST_WIDE_INT offset, HOST_WIDE_INT alignment)
+{
+ struct dw_loc_descr_struct *head;
+ unsigned int dwarf_fp
+ = DWARF_FRAME_REGNUM (HARD_FRAME_POINTER_REGNUM);
+
+ /* When CFA is defined as FP+OFFSET, emulate stack alignment. */
+ if (cfa.reg == HARD_FRAME_POINTER_REGNUM && cfa.indirect == 0)
{
- if (offset == 0)
- if (cfa->reg <= 31)
- head = new_loc_descr (DW_OP_reg0 + cfa->reg, 0, 0);
- else
- head = new_loc_descr (DW_OP_regx, cfa->reg, 0);
- else if (cfa->reg <= 31)
- head = new_loc_descr (DW_OP_breg0 + cfa->reg, offset, 0);
- else
- head = new_loc_descr (DW_OP_bregx, cfa->reg, offset);
- }
+ head = new_reg_loc_descr (dwarf_fp, 0);
+ add_loc_descr (&head, int_loc_descriptor (alignment));
+ add_loc_descr (&head, new_loc_descr (DW_OP_and, 0, 0));
+ add_loc_descr (&head, int_loc_descriptor (offset));
+ add_loc_descr (&head, new_loc_descr (DW_OP_plus, 0, 0));
+ }
+ else
+ head = new_reg_loc_descr (dwarf_fp, offset);
return head;
}
@@ -4310,7 +5037,6 @@ static dw_loc_descr_ref one_reg_loc_descriptor (unsigned int,
enum var_init_status);
static dw_loc_descr_ref multiple_reg_loc_descriptor (rtx, rtx,
enum var_init_status);
-static dw_loc_descr_ref int_loc_descriptor (HOST_WIDE_INT);
static dw_loc_descr_ref based_loc_descr (rtx, HOST_WIDE_INT,
enum var_init_status);
static int is_based_loc (const_rtx);
@@ -4341,7 +5067,7 @@ static void tree_add_const_value_attribute (dw_die_ref, tree);
static void add_name_attribute (dw_die_ref, const char *);
static void add_comp_dir_attribute (dw_die_ref);
static void add_bound_info (dw_die_ref, enum dwarf_attribute, tree);
-static void add_subscript_info (dw_die_ref, tree);
+static void add_subscript_info (dw_die_ref, tree, bool);
static void add_byte_size_attribute (dw_die_ref, tree);
static void add_bit_offset_attribute (dw_die_ref, tree);
static void add_bit_size_attribute (dw_die_ref, tree);
@@ -8635,7 +9361,8 @@ is_subrange_type (const_tree type)
return false;
if (TREE_CODE (subtype) != INTEGER_TYPE
- && TREE_CODE (subtype) != ENUMERAL_TYPE)
+ && TREE_CODE (subtype) != ENUMERAL_TYPE
+ && TREE_CODE (subtype) != BOOLEAN_TYPE)
return false;
if (TREE_CODE (type) == TREE_CODE (subtype)
@@ -8920,11 +9647,7 @@ reg_loc_descriptor (rtx rtl, enum var_init_status initialized)
static dw_loc_descr_ref
one_reg_loc_descriptor (unsigned int regno, enum var_init_status initialized)
{
- dw_loc_descr_ref reg_loc_descr;
- if (regno <= 31)
- reg_loc_descr = new_loc_descr (DW_OP_reg0 + regno, 0, 0);
- else
- reg_loc_descr = new_loc_descr (DW_OP_regx, regno, 0);
+ dw_loc_descr_ref reg_loc_descr = new_reg_loc_descr (regno, 0);
if (initialized == VAR_INIT_STATUS_UNINITIALIZED)
add_loc_descr (&reg_loc_descr, new_loc_descr (DW_OP_GNU_uninit, 0, 0));
@@ -8997,6 +9720,10 @@ multiple_reg_loc_descriptor (rtx rtl, rtx regs,
return loc_result;
}
+#endif /* DWARF2_DEBUGGING_INFO */
+
+#if defined (DWARF2_DEBUGGING_INFO) || defined (DWARF2_UNWIND_INFO)
+
/* Return a location descriptor that designates a constant. */
static dw_loc_descr_ref
@@ -9035,6 +9762,9 @@ int_loc_descriptor (HOST_WIDE_INT i)
return new_loc_descr (op, i, 0);
}
+#endif
+
+#ifdef DWARF2_DEBUGGING_INFO
/* Return a location descriptor that designates a base+offset location. */
@@ -9044,6 +9774,7 @@ based_loc_descr (rtx reg, HOST_WIDE_INT offset,
{
unsigned int regno;
dw_loc_descr_ref result;
+ dw_fde_ref fde = current_fde ();
/* We only use "frame base" when we're sure we're talking about the
post-prologue local stack frame. We do this by *not* running
@@ -9060,13 +9791,41 @@ based_loc_descr (rtx reg, HOST_WIDE_INT offset,
offset += INTVAL (XEXP (elim, 1));
elim = XEXP (elim, 0);
}
- gcc_assert (elim == (frame_pointer_needed ? hard_frame_pointer_rtx
- : stack_pointer_rtx));
- offset += frame_pointer_fb_offset;
+ gcc_assert ((SUPPORTS_STACK_ALIGNMENT
+ && (elim == hard_frame_pointer_rtx
+ || elim == stack_pointer_rtx))
+ || elim == (frame_pointer_needed
+ ? hard_frame_pointer_rtx
+ : stack_pointer_rtx));
+
+ /* If drap register is used to align stack, use frame
+ pointer + offset to access stack variables. If stack
+ is aligned without drap, use stack pointer + offset to
+ access stack variables. */
+ if (crtl->stack_realign_tried
+ && cfa.reg == HARD_FRAME_POINTER_REGNUM
+ && reg == frame_pointer_rtx)
+ {
+ int base_reg
+ = DWARF_FRAME_REGNUM (cfa.indirect
+ ? HARD_FRAME_POINTER_REGNUM
+ : STACK_POINTER_REGNUM);
+ return new_reg_loc_descr (base_reg, offset);
+ }
+ offset += frame_pointer_fb_offset;
return new_loc_descr (DW_OP_fbreg, offset, 0);
}
}
+ else if (fde
+ && fde->drap_reg != INVALID_REGNUM
+ && (fde->drap_reg == REGNO (reg)
+ || fde->vdrap_reg == REGNO (reg)))
+ {
+ /* Use cfa+offset to represent the location of arguments passed
+ on stack when drap is used to align stack. */
+ return new_loc_descr (DW_OP_fbreg, offset, 0);
+ }
regno = dbx_reg_number (reg);
if (regno <= 31)
@@ -9636,9 +10395,8 @@ loc_descriptor_from_tree_1 (tree loc, int want_address)
CASE_CONVERT:
case VIEW_CONVERT_EXPR:
case SAVE_EXPR:
- case GIMPLE_MODIFY_STMT:
- return loc_descriptor_from_tree_1 (GENERIC_TREE_OPERAND (loc, 0),
- want_address);
+ case MODIFY_EXPR:
+ return loc_descriptor_from_tree_1 (TREE_OPERAND (loc, 0), want_address);
case COMPONENT_REF:
case BIT_FIELD_REF:
@@ -10442,14 +11200,12 @@ static tree
reference_to_unused (tree * tp, int * walk_subtrees,
void * data ATTRIBUTE_UNUSED)
{
- if (! EXPR_P (*tp) && ! GIMPLE_STMT_P (*tp) && ! CONSTANT_CLASS_P (*tp))
+ if (! EXPR_P (*tp) && ! CONSTANT_CLASS_P (*tp))
*walk_subtrees = 0;
if (DECL_P (*tp) && ! TREE_PUBLIC (*tp) && ! TREE_USED (*tp)
&& ! TREE_ASM_WRITTEN (*tp))
return *tp;
- else if (!flag_unit_at_a_time)
- return NULL_TREE;
/* ??? The C++ FE emits debug information for using decls, so
putting gcc_unreachable here falls over. See PR31899. For now
be conservative. */
@@ -11114,8 +11870,13 @@ compute_frame_pointer_to_fb_displacement (HOST_WIDE_INT offset)
offset += INTVAL (XEXP (elim, 1));
elim = XEXP (elim, 0);
}
- gcc_assert (elim == (frame_pointer_needed ? hard_frame_pointer_rtx
- : stack_pointer_rtx));
+
+ gcc_assert ((SUPPORTS_STACK_ALIGNMENT
+ && (elim == hard_frame_pointer_rtx
+ || elim == stack_pointer_rtx))
+ || elim == (frame_pointer_needed
+ ? hard_frame_pointer_rtx
+ : stack_pointer_rtx));
frame_pointer_fb_offset = -offset;
}
@@ -11220,36 +11981,21 @@ add_bound_info (dw_die_ref subrange_die, enum dwarf_attribute bound_attr, tree b
}
}
-/* Note that the block of subscript information for an array type also
- includes information about the element type of type given array type. */
+/* Add subscript info to TYPE_DIE, describing an array TYPE, collapsing
+ possibly nested array subscripts in a flat sequence if COLLAPSE_P is true.
+ Note that the block of subscript information for an array type also
+ includes information about the element type of the given array type. */
static void
-add_subscript_info (dw_die_ref type_die, tree type)
+add_subscript_info (dw_die_ref type_die, tree type, bool collapse_p)
{
-#ifndef MIPS_DEBUGGING_INFO
unsigned dimension_number;
-#endif
tree lower, upper;
dw_die_ref subrange_die;
- /* The GNU compilers represent multidimensional array types as sequences of
- one dimensional array types whose element types are themselves array
- types. Here we squish that down, so that each multidimensional array
- type gets only one array_type DIE in the Dwarf debugging info. The draft
- Dwarf specification say that we are allowed to do this kind of
- compression in C (because there is no difference between an array or
- arrays and a multidimensional array in C) but for other source languages
- (e.g. Ada) we probably shouldn't do this. */
-
- /* ??? The SGI dwarf reader fails for multidimensional arrays with a
- const enum type. E.g. const enum machine_mode insn_operand_mode[2][10].
- We work around this by disabling this feature. See also
- gen_array_type_die. */
-#ifndef MIPS_DEBUGGING_INFO
for (dimension_number = 0;
- TREE_CODE (type) == ARRAY_TYPE;
+ TREE_CODE (type) == ARRAY_TYPE && (dimension_number == 0 || collapse_p);
type = TREE_TYPE (type), dimension_number++)
-#endif
{
tree domain = TYPE_DOMAIN (type);
@@ -11773,13 +12519,29 @@ gen_array_type_die (tree type, dw_die_ref context_die)
{
dw_die_ref scope_die = scope_die_for (type, context_die);
dw_die_ref array_die;
+
+ /* GNU compilers represent multidimensional array types as sequences of one
+ dimensional array types whose element types are themselves array types.
+ We sometimes squish that down to a single array_type DIE with multiple
+ subscripts in the Dwarf debugging info. The draft Dwarf specification
+ say that we are allowed to do this kind of compression in C, because
+ there is no difference between an array of arrays and a multidimensional
+ array. We don't do this for Ada to remain as close as possible to the
+ actual representation, which is especially important against the language
+ flexibilty wrt arrays of variable size. */
+
+ bool collapse_nested_arrays = !is_ada ();
tree element_type;
+
+ /* ??? The SGI dwarf reader fails for array of array of enum types
+ (e.g. const enum machine_mode insn_operand_mode[2][10]) unless the inner
+ array type comes before the outer array type. We thus call gen_type_die
+ before we new_die and must prevent nested array types collapsing for this
+ target. */
- /* ??? The SGI dwarf reader fails for array of array of enum types unless
- the inner array type comes before the outer array type. Thus we must
- call gen_type_die before we call new_die. See below also. */
#ifdef MIPS_DEBUGGING_INFO
gen_type_die (TREE_TYPE (type), context_die);
+ collapse_nested_arrays = false;
#endif
array_die = new_die (DW_TAG_array_type, scope_die, type);
@@ -11818,19 +12580,16 @@ gen_array_type_die (tree type, dw_die_ref context_die)
add_AT_flag (array_die, DW_AT_declaration, 1);
else
#endif
- add_subscript_info (array_die, type);
+ add_subscript_info (array_die, type, collapse_nested_arrays);
- /* Add representation of the type of the elements of this array type. */
+ /* Add representation of the type of the elements of this array type and
+ emit the corresponding DIE if we haven't done it already. */
element_type = TREE_TYPE (type);
-
- /* ??? The SGI dwarf reader fails for multidimensional arrays with a
- const enum type. E.g. const enum machine_mode insn_operand_mode[2][10].
- We work around this by disabling this feature. See also
- add_subscript_info. */
+ if (collapse_nested_arrays)
+ while (TREE_CODE (element_type) == ARRAY_TYPE)
+ element_type = TREE_TYPE (element_type);
+
#ifndef MIPS_DEBUGGING_INFO
- while (TREE_CODE (element_type) == ARRAY_TYPE)
- element_type = TREE_TYPE (element_type);
-
gen_type_die (element_type, context_die);
#endif
@@ -13816,6 +14575,22 @@ is_redundant_typedef (const_tree decl)
return 0;
}
+/* Returns the DIE for a context. */
+
+static inline dw_die_ref
+get_context_die (tree context)
+{
+ if (context)
+ {
+ /* Find die that represents this context. */
+ if (TYPE_P (context))
+ return force_type_die (context);
+ else
+ return force_decl_die (context);
+ }
+ return comp_unit_die;
+}
+
/* Returns the DIE for decl. A DIE will always be returned. */
static dw_die_ref
@@ -13827,18 +14602,7 @@ force_decl_die (tree decl)
decl_die = lookup_decl_die (decl);
if (!decl_die)
{
- dw_die_ref context_die;
- tree decl_context = DECL_CONTEXT (decl);
- if (decl_context)
- {
- /* Find die that represents this context. */
- if (TYPE_P (decl_context))
- context_die = force_type_die (decl_context);
- else
- context_die = force_decl_die (decl_context);
- }
- else
- context_die = comp_unit_die;
+ dw_die_ref context_die = get_context_die (DECL_CONTEXT (decl));
decl_die = lookup_decl_die (decl);
if (decl_die)
@@ -13893,16 +14657,7 @@ force_type_die (tree type)
type_die = lookup_type_die (type);
if (!type_die)
{
- dw_die_ref context_die;
- if (TYPE_CONTEXT (type))
- {
- if (TYPE_P (TYPE_CONTEXT (type)))
- context_die = force_type_die (TYPE_CONTEXT (type));
- else
- context_die = force_decl_die (TYPE_CONTEXT (type));
- }
- else
- context_die = comp_unit_die;
+ dw_die_ref context_die = get_context_die (TYPE_CONTEXT (type));
type_die = modified_type_die (type, TYPE_READONLY (type),
TYPE_VOLATILE (type), context_die);
@@ -14224,16 +14979,11 @@ dwarf2out_imported_module_or_decl (tree decl, tree context)
/* Get the scope die for decl context. Use comp_unit_die for global module
or decl. If die is not found for non globals, force new die. */
- if (!context)
- scope_die = comp_unit_die;
- else if (TYPE_P (context))
- {
- if (!should_emit_struct_debug (context, DINFO_USAGE_DIR_USE))
- return;
- scope_die = force_type_die (context);
- }
- else
- scope_die = force_decl_die (context);
+ if (context
+ && TYPE_P (context)
+ && !should_emit_struct_debug (context, DINFO_USAGE_DIR_USE))
+ return;
+ scope_die = get_context_die (context);
/* For TYPE_DECL or CONST_DECL, lookup TREE_TYPE. */
if (TREE_CODE (decl) == TYPE_DECL || TREE_CODE (decl) == CONST_DECL)
@@ -14242,6 +14992,16 @@ dwarf2out_imported_module_or_decl (tree decl, tree context)
at_import_die = base_type_die (TREE_TYPE (decl));
else
at_import_die = force_type_die (TREE_TYPE (decl));
+ /* For namespace N { typedef void T; } using N::T; base_type_die
+ returns NULL, but DW_TAG_imported_declaration requires
+ the DW_AT_import tag. Force creation of DW_TAG_typedef. */
+ if (!at_import_die)
+ {
+ gcc_assert (TREE_CODE (decl) == TYPE_DECL);
+ gen_typedef_die (decl, get_context_die (DECL_CONTEXT (decl)));
+ at_import_die = lookup_type_die (TREE_TYPE (decl));
+ gcc_assert (at_import_die);
+ }
}
else
{
@@ -14253,21 +15013,14 @@ dwarf2out_imported_module_or_decl (tree decl, tree context)
if (TREE_CODE (decl) == FIELD_DECL)
{
tree type = DECL_CONTEXT (decl);
- dw_die_ref type_context_die;
- if (TYPE_CONTEXT (type))
- if (TYPE_P (TYPE_CONTEXT (type)))
- {
- if (!should_emit_struct_debug (TYPE_CONTEXT (type),
- DINFO_USAGE_DIR_USE))
- return;
- type_context_die = force_type_die (TYPE_CONTEXT (type));
- }
- else
- type_context_die = force_decl_die (TYPE_CONTEXT (type));
- else
- type_context_die = comp_unit_die;
- gen_type_die_for_member (type, decl, type_context_die);
+ if (TYPE_CONTEXT (type)
+ && TYPE_P (TYPE_CONTEXT (type))
+ && !should_emit_struct_debug (TYPE_CONTEXT (type),
+ DINFO_USAGE_DIR_USE))
+ return;
+ gen_type_die_for_member (type, decl,
+ get_context_die (TYPE_CONTEXT (type)));
}
at_import_die = force_decl_die (decl);
}
diff --git a/gcc/ebitmap.h b/gcc/ebitmap.h
index 8efb4375ecc..2916e44b223 100644
--- a/gcc/ebitmap.h
+++ b/gcc/ebitmap.h
@@ -121,7 +121,7 @@ ebitmap_iter_init (ebitmap_iterator *i, ebitmap bmp, unsigned int min)
static inline bool
ebitmap_iter_cond (ebitmap_iterator *i, unsigned int *n)
{
- unsigned int ourn;
+ unsigned int ourn = 0;
if (i->size == 0)
return false;
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 65fa8e457ec..a0af7b39436 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -864,9 +864,18 @@ rtx
gen_reg_rtx (enum machine_mode mode)
{
rtx val;
+ unsigned int align = GET_MODE_ALIGNMENT (mode);
gcc_assert (can_create_pseudo_p ());
+ /* If a virtual register with bigger mode alignment is generated,
+ increase stack alignment estimation because it might be spilled
+ to stack later. */
+ if (SUPPORTS_STACK_ALIGNMENT
+ && crtl->stack_alignment_estimated < align
+ && !crtl->stack_realign_processed)
+ crtl->stack_alignment_estimated = align;
+
if (generating_concat_p
&& (GET_MODE_CLASS (mode) == MODE_COMPLEX_FLOAT
|| GET_MODE_CLASS (mode) == MODE_COMPLEX_INT))
diff --git a/gcc/errors.c b/gcc/errors.c
index ec70d55ccb1..a1ccfeff43d 100644
--- a/gcc/errors.c
+++ b/gcc/errors.c
@@ -40,7 +40,7 @@ int have_error = 0;
/* Print a warning message - output produced, but there may be problems. */
-void
+bool
warning (int opt ATTRIBUTE_UNUSED, const char *format, ...)
{
va_list ap;
@@ -50,6 +50,7 @@ warning (int opt ATTRIBUTE_UNUSED, const char *format, ...)
vfprintf (stderr, format, ap);
va_end (ap);
fputc('\n', stderr);
+ return true;
}
diff --git a/gcc/errors.h b/gcc/errors.h
index 29c16f3f333..ec080da03d4 100644
--- a/gcc/errors.h
+++ b/gcc/errors.h
@@ -33,7 +33,7 @@ along with GCC; see the file COPYING3. If not see
version of warning(). For those, you'd pass an OPT_W* value from
options.h, but in generator programs it has no effect, so it's OK
to just pass zero for calls from generator-only files. */
-extern void warning (int, const char *, ...) ATTRIBUTE_PRINTF_2 ATTRIBUTE_COLD;
+extern bool warning (int, const char *, ...) ATTRIBUTE_PRINTF_2 ATTRIBUTE_COLD;
extern void error (const char *, ...) ATTRIBUTE_PRINTF_1 ATTRIBUTE_COLD;
extern void fatal (const char *, ...) ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF_1 ATTRIBUTE_COLD;
extern void internal_error (const char *, ...) ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF_1 ATTRIBUTE_COLD;
diff --git a/gcc/except.c b/gcc/except.c
index 1d9a73639b6..77a3049ba5e 100644
--- a/gcc/except.c
+++ b/gcc/except.c
@@ -86,7 +86,7 @@ along with GCC; see the file COPYING3. If not see
/* Protect cleanup actions with must-not-throw regions, with a call
to the given failure handler. */
-tree (*lang_protect_cleanup_actions) (void);
+gimple (*lang_protect_cleanup_actions) (void);
/* Return true if type A catches type B. */
int (*lang_eh_type_covers) (tree a, tree b);
@@ -148,9 +148,9 @@ struct eh_region GTY(())
/* A list of catch blocks, a surrounding try block,
and the label for continuing after a catch. */
struct eh_region_u_try {
- struct eh_region *catch;
+ struct eh_region *eh_catch;
struct eh_region *last_catch;
- } GTY ((tag ("ERT_TRY"))) try;
+ } GTY ((tag ("ERT_TRY"))) eh_try;
/* The list through the catch handlers, the list of type objects
matched, and the list of associated filters. */
@@ -159,7 +159,7 @@ struct eh_region GTY(())
struct eh_region *prev_catch;
tree type_list;
tree filter_list;
- } GTY ((tag ("ERT_CATCH"))) catch;
+ } GTY ((tag ("ERT_CATCH"))) eh_catch;
/* A tree_list of allowed types. */
struct eh_region_u_allowed {
@@ -171,7 +171,7 @@ struct eh_region GTY(())
for a throw. */
struct eh_region_u_throw {
tree type;
- } GTY ((tag ("ERT_THROW"))) throw;
+ } GTY ((tag ("ERT_THROW"))) eh_throw;
/* Retain the cleanup expression even after expansion so that
we can match up fixup regions. */
@@ -419,30 +419,30 @@ init_eh_for_function (void)
static struct eh_region *
gen_eh_region (enum eh_region_type type, struct eh_region *outer)
{
- struct eh_region *new;
+ struct eh_region *new_eh;
#ifdef ENABLE_CHECKING
gcc_assert (doing_eh (0));
#endif
/* Insert a new blank region as a leaf in the tree. */
- new = GGC_CNEW (struct eh_region);
- new->type = type;
- new->outer = outer;
+ new_eh = GGC_CNEW (struct eh_region);
+ new_eh->type = type;
+ new_eh->outer = outer;
if (outer)
{
- new->next_peer = outer->inner;
- outer->inner = new;
+ new_eh->next_peer = outer->inner;
+ outer->inner = new_eh;
}
else
{
- new->next_peer = cfun->eh->region_tree;
- cfun->eh->region_tree = new;
+ new_eh->next_peer = cfun->eh->region_tree;
+ cfun->eh->region_tree = new_eh;
}
- new->region_number = ++cfun->eh->last_region_number;
+ new_eh->region_number = ++cfun->eh->last_region_number;
- return new;
+ return new_eh;
}
struct eh_region *
@@ -479,14 +479,14 @@ gen_eh_region_catch (struct eh_region *t, tree type_or_list)
}
c = gen_eh_region (ERT_CATCH, t->outer);
- c->u.catch.type_list = type_list;
- l = t->u.try.last_catch;
- c->u.catch.prev_catch = l;
+ c->u.eh_catch.type_list = type_list;
+ l = t->u.eh_try.last_catch;
+ c->u.eh_catch.prev_catch = l;
if (l)
- l->u.catch.next_catch = c;
+ l->u.eh_catch.next_catch = c;
else
- t->u.try.catch = c;
- t->u.try.last_catch = c;
+ t->u.eh_try.eh_catch = c;
+ t->u.eh_try.last_catch = c;
return c;
}
@@ -683,7 +683,7 @@ remove_unreachable_regions (rtx insns)
/* TRY regions are reachable if any of its CATCH regions
are reachable. */
struct eh_region *c;
- for (c = r->u.try.catch; c ; c = c->u.catch.next_catch)
+ for (c = r->u.eh_try.eh_catch; c ; c = c->u.eh_catch.next_catch)
if (reachable[c->region_number])
{
kill_it = false;
@@ -988,17 +988,17 @@ duplicate_eh_regions (struct function *ifun, duplicate_eh_regions_map map,
switch (cur->type)
{
case ERT_TRY:
- if (cur->u.try.catch)
- REMAP (cur->u.try.catch);
- if (cur->u.try.last_catch)
- REMAP (cur->u.try.last_catch);
+ if (cur->u.eh_try.eh_catch)
+ REMAP (cur->u.eh_try.eh_catch);
+ if (cur->u.eh_try.last_catch)
+ REMAP (cur->u.eh_try.last_catch);
break;
case ERT_CATCH:
- if (cur->u.catch.next_catch)
- REMAP (cur->u.catch.next_catch);
- if (cur->u.catch.prev_catch)
- REMAP (cur->u.catch.prev_catch);
+ if (cur->u.eh_catch.next_catch)
+ REMAP (cur->u.eh_catch.next_catch);
+ if (cur->u.eh_catch.prev_catch)
+ REMAP (cur->u.eh_catch.prev_catch);
break;
case ERT_CLEANUP:
@@ -1290,21 +1290,21 @@ assign_filter_values (void)
case ERT_CATCH:
/* Whatever type_list is (NULL or true list), we build a list
of filters for the region. */
- r->u.catch.filter_list = NULL_TREE;
+ r->u.eh_catch.filter_list = NULL_TREE;
- if (r->u.catch.type_list != NULL)
+ if (r->u.eh_catch.type_list != NULL)
{
/* Get a filter value for each of the types caught and store
them in the region's dedicated list. */
- tree tp_node = r->u.catch.type_list;
+ tree tp_node = r->u.eh_catch.type_list;
for (;tp_node; tp_node = TREE_CHAIN (tp_node))
{
int flt = add_ttypes_entry (ttypes, TREE_VALUE (tp_node));
tree flt_node = build_int_cst (NULL_TREE, flt);
- r->u.catch.filter_list
- = tree_cons (NULL_TREE, flt_node, r->u.catch.filter_list);
+ r->u.eh_catch.filter_list
+ = tree_cons (NULL_TREE, flt_node, r->u.eh_catch.filter_list);
}
}
else
@@ -1314,8 +1314,8 @@ assign_filter_values (void)
int flt = add_ttypes_entry (ttypes, NULL);
tree flt_node = build_int_cst (NULL_TREE, flt);
- r->u.catch.filter_list
- = tree_cons (NULL_TREE, flt_node, r->u.catch.filter_list);
+ r->u.eh_catch.filter_list
+ = tree_cons (NULL_TREE, flt_node, r->u.eh_catch.filter_list);
}
break;
@@ -1400,17 +1400,17 @@ build_post_landing_pads (void)
Rapid prototyping sez a sequence of ifs. */
{
struct eh_region *c;
- for (c = region->u.try.catch; c ; c = c->u.catch.next_catch)
+ for (c = region->u.eh_try.eh_catch; c ; c = c->u.eh_catch.next_catch)
{
- if (c->u.catch.type_list == NULL)
+ if (c->u.eh_catch.type_list == NULL)
emit_jump (c->label);
else
{
/* Need for one cmp/jump per type caught. Each type
list entry has a matching entry in the filter list
(see assign_filter_values). */
- tree tp_node = c->u.catch.type_list;
- tree flt_node = c->u.catch.filter_list;
+ tree tp_node = c->u.eh_catch.type_list;
+ tree flt_node = c->u.eh_catch.filter_list;
for (; tp_node; )
{
@@ -1437,7 +1437,7 @@ build_post_landing_pads (void)
seq = get_insns ();
end_sequence ();
- emit_to_new_bb_before (seq, region->u.try.catch->label);
+ emit_to_new_bb_before (seq, region->u.eh_try.eh_catch->label);
break;
@@ -1651,7 +1651,7 @@ sjlj_find_directly_reachable_regions (struct sjlj_lp_info *lp_info)
type_thrown = NULL_TREE;
if (region->type == ERT_THROW)
{
- type_thrown = region->u.throw.type;
+ type_thrown = region->u.eh_throw.type;
region = region->outer;
}
@@ -2204,28 +2204,28 @@ remove_eh_handler (struct eh_region *region)
if (region->type == ERT_CATCH)
{
- struct eh_region *try, *next, *prev;
+ struct eh_region *eh_try, *next, *prev;
- for (try = region->next_peer;
- try->type == ERT_CATCH;
- try = try->next_peer)
+ for (eh_try = region->next_peer;
+ eh_try->type == ERT_CATCH;
+ eh_try = eh_try->next_peer)
continue;
- gcc_assert (try->type == ERT_TRY);
+ gcc_assert (eh_try->type == ERT_TRY);
- next = region->u.catch.next_catch;
- prev = region->u.catch.prev_catch;
+ next = region->u.eh_catch.next_catch;
+ prev = region->u.eh_catch.prev_catch;
if (next)
- next->u.catch.prev_catch = prev;
+ next->u.eh_catch.prev_catch = prev;
else
- try->u.try.last_catch = prev;
+ eh_try->u.eh_try.last_catch = prev;
if (prev)
- prev->u.catch.next_catch = next;
+ prev->u.eh_catch.next_catch = next;
else
{
- try->u.try.catch = next;
+ eh_try->u.eh_try.eh_catch = next;
if (! next)
- remove_eh_handler (try);
+ remove_eh_handler (eh_try);
}
}
}
@@ -2388,10 +2388,10 @@ reachable_next_level (struct eh_region *region, tree type_thrown,
struct eh_region *c;
enum reachable_code ret = RNL_NOT_CAUGHT;
- for (c = region->u.try.catch; c ; c = c->u.catch.next_catch)
+ for (c = region->u.eh_try.eh_catch; c ; c = c->u.eh_catch.next_catch)
{
/* A catch-all handler ends the search. */
- if (c->u.catch.type_list == NULL)
+ if (c->u.eh_catch.type_list == NULL)
{
add_reachable_handler (info, region, c);
return RNL_CAUGHT;
@@ -2400,7 +2400,7 @@ reachable_next_level (struct eh_region *region, tree type_thrown,
if (type_thrown)
{
/* If we have at least one type match, end the search. */
- tree tp_node = c->u.catch.type_list;
+ tree tp_node = c->u.eh_catch.type_list;
for (; tp_node; tp_node = TREE_CHAIN (tp_node))
{
@@ -2438,7 +2438,7 @@ reachable_next_level (struct eh_region *region, tree type_thrown,
ret = RNL_MAYBE_CAUGHT;
else
{
- tree tp_node = c->u.catch.type_list;
+ tree tp_node = c->u.eh_catch.type_list;
bool maybe_reachable = false;
/* Compute the potential reachability of this handler and
@@ -2562,7 +2562,7 @@ foreach_reachable_handler (int region_number, bool is_resx,
}
else if (region->type == ERT_THROW)
{
- type_thrown = region->u.throw.type;
+ type_thrown = region->u.eh_throw.type;
region = region->outer;
}
@@ -2645,7 +2645,7 @@ can_throw_internal_1 (int region_number, bool is_resx)
region = region->outer;
else if (region->type == ERT_THROW)
{
- type_thrown = region->u.throw.type;
+ type_thrown = region->u.eh_throw.type;
region = region->outer;
}
@@ -2705,7 +2705,7 @@ can_throw_external_1 (int region_number, bool is_resx)
region = region->outer;
else if (region->type == ERT_THROW)
{
- type_thrown = region->u.throw.type;
+ type_thrown = region->u.eh_throw.type;
region = region->outer;
}
@@ -3047,19 +3047,19 @@ action_record_hash (const void *pentry)
static int
add_action_record (htab_t ar_hash, int filter, int next)
{
- struct action_record **slot, *new, tmp;
+ struct action_record **slot, *new_ar, tmp;
tmp.filter = filter;
tmp.next = next;
slot = (struct action_record **) htab_find_slot (ar_hash, &tmp, INSERT);
- if ((new = *slot) == NULL)
+ if ((new_ar = *slot) == NULL)
{
- new = XNEW (struct action_record);
- new->offset = VARRAY_ACTIVE_SIZE (crtl->eh.action_record_data) + 1;
- new->filter = filter;
- new->next = next;
- *slot = new;
+ new_ar = XNEW (struct action_record);
+ new_ar->offset = VARRAY_ACTIVE_SIZE (crtl->eh.action_record_data) + 1;
+ new_ar->filter = filter;
+ new_ar->next = next;
+ *slot = new_ar;
/* The filter value goes in untouched. The link to the next
record is a "self-relative" byte offset, or zero to indicate
@@ -3072,7 +3072,7 @@ add_action_record (htab_t ar_hash, int filter, int next)
push_sleb128 (&crtl->eh.action_record_data, next);
}
- return new->offset;
+ return new_ar->offset;
}
static int
@@ -3109,14 +3109,14 @@ collect_one_action_chain (htab_t ar_hash, struct eh_region *region)
search outer regions. Use a magic -3 value to record
that we haven't done the outer search. */
next = -3;
- for (c = region->u.try.last_catch; c ; c = c->u.catch.prev_catch)
+ for (c = region->u.eh_try.last_catch; c ; c = c->u.eh_catch.prev_catch)
{
- if (c->u.catch.type_list == NULL)
+ if (c->u.eh_catch.type_list == NULL)
{
/* Retrieve the filter from the head of the filter list
where we have stored it (see assign_filter_values). */
int filter
- = TREE_INT_CST_LOW (TREE_VALUE (c->u.catch.filter_list));
+ = TREE_INT_CST_LOW (TREE_VALUE (c->u.eh_catch.filter_list));
next = add_action_record (ar_hash, filter, 0);
}
@@ -3141,7 +3141,7 @@ collect_one_action_chain (htab_t ar_hash, struct eh_region *region)
next = add_action_record (ar_hash, 0, 0);
}
- flt_node = c->u.catch.filter_list;
+ flt_node = c->u.eh_catch.filter_list;
for (; flt_node; flt_node = TREE_CHAIN (flt_node))
{
int filter = TREE_INT_CST_LOW (TREE_VALUE (flt_node));
@@ -3550,7 +3550,7 @@ static void
output_ttype (tree type, int tt_format, int tt_format_size)
{
rtx value;
- bool public = true;
+ bool is_public = true;
if (type == NULL_TREE)
value = const0_rtx;
@@ -3573,7 +3573,7 @@ output_ttype (tree type, int tt_format, int tt_format_size)
node = varpool_node (type);
if (node)
varpool_mark_needed_node (node);
- public = TREE_PUBLIC (type);
+ is_public = TREE_PUBLIC (type);
}
}
else
@@ -3588,7 +3588,7 @@ output_ttype (tree type, int tt_format, int tt_format_size)
assemble_integer (value, tt_format_size,
tt_format_size * BITS_PER_UNIT, 1);
else
- dw2_asm_output_encoded_addr_rtx (tt_format, value, public, NULL);
+ dw2_asm_output_encoded_addr_rtx (tt_format, value, is_public, NULL);
}
void
diff --git a/gcc/except.h b/gcc/except.h
index ae3264e6f3e..8f9efb26382 100644
--- a/gcc/except.h
+++ b/gcc/except.h
@@ -108,20 +108,13 @@ extern void dump_eh_tree (FILE *, struct function *);
extern bool eh_region_outer_p (struct function *, int, int);
extern int eh_region_outermost (struct function *, int, int);
-/* tree-eh.c */
-extern void add_stmt_to_eh_region_fn (struct function *, tree, int);
-extern bool remove_stmt_from_eh_region_fn (struct function *, tree);
-extern int lookup_stmt_eh_region_fn (struct function *, const_tree);
-extern int lookup_stmt_eh_region (const_tree);
-extern bool verify_eh_edges (tree);
-
/* If non-NULL, this is a function that returns an expression to be
executed if an unhandled exception is propagated out of a cleanup
region. For example, in C++, an exception thrown by a destructor
during stack unwinding is required to result in a call to
`std::terminate', so the C++ version of this function returns a
CALL_EXPR for `std::terminate'. */
-extern tree (*lang_protect_cleanup_actions) (void);
+extern gimple (*lang_protect_cleanup_actions) (void);
/* Return true if type A catches type B. */
extern int (*lang_eh_type_covers) (tree a, tree b);
@@ -175,7 +168,7 @@ extern tree (*lang_eh_runtime_type) (tree);
struct throw_stmt_node GTY(())
{
- tree stmt;
+ gimple stmt;
int region_nr;
};
diff --git a/gcc/expmed.c b/gcc/expmed.c
index bf045fee360..b102241dbb1 100644
--- a/gcc/expmed.c
+++ b/gcc/expmed.c
@@ -2050,7 +2050,7 @@ expand_shift (enum tree_code code, enum machine_mode mode, rtx shifted,
optab lrotate_optab = rotl_optab;
optab rrotate_optab = rotr_optab;
enum machine_mode op1_mode;
- int try;
+ int attempt;
op1 = expand_normal (amount);
op1_mode = GET_MODE (op1);
@@ -2105,13 +2105,13 @@ expand_shift (enum tree_code code, enum machine_mode mode, rtx shifted,
return shifted;
}
- for (try = 0; temp == 0 && try < 3; try++)
+ for (attempt = 0; temp == 0 && attempt < 3; attempt++)
{
enum optab_methods methods;
- if (try == 0)
+ if (attempt == 0)
methods = OPTAB_DIRECT;
- else if (try == 1)
+ else if (attempt == 1)
methods = OPTAB_WIDEN;
else
methods = OPTAB_LIB_WIDEN;
@@ -3487,7 +3487,7 @@ expand_smod_pow2 (enum machine_mode mode, rtx op0, HOST_WIDE_INT d)
/* Avoid conditional branches when they're expensive. */
if (BRANCH_COST >= 2
- && !optimize_size)
+ && optimize_insn_for_speed_p ())
{
rtx signmask = emit_store_flag (result, LT, op0, const0_rtx,
mode, 0, -1);
diff --git a/gcc/expr.c b/gcc/expr.c
index e7c24e2b838..7cc8783e0bc 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -1,6 +1,6 @@
/* Convert tree expression to rtl instructions, for GNU compiler.
Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
Free Software Foundation, Inc.
This file is part of GCC.
@@ -2074,12 +2074,31 @@ emit_group_store (rtx orig_dst, rtx src, tree type ATTRIBUTE_UNUSED, int ssize)
}
else
{
- gcc_assert (bytepos == 0 && XVECLEN (src, 0));
- dest = assign_stack_temp (GET_MODE (dest),
- GET_MODE_SIZE (GET_MODE (dest)), 0);
- emit_move_insn (adjust_address (dest, GET_MODE (tmps[i]), bytepos),
- tmps[i]);
- dst = dest;
+ enum machine_mode dest_mode = GET_MODE (dest);
+ enum machine_mode tmp_mode = GET_MODE (tmps[i]);
+ int dest_size = GET_MODE_SIZE (dest_mode);
+ int tmp_size = GET_MODE_SIZE (tmp_mode);
+
+ gcc_assert (bytepos == 0
+ && XVECLEN (src, 0)
+ && dest_size == tmp_size);
+
+ if (GET_MODE_ALIGNMENT (dest_mode)
+ >= GET_MODE_ALIGNMENT (tmp_mode))
+ {
+ dest = assign_stack_temp (dest_mode, dest_size, 0);
+ emit_move_insn (adjust_address (dest,
+ tmp_mode,
+ bytepos),
+ tmps[i]);
+ dst = dest;
+ }
+ else
+ {
+ dest = assign_stack_temp (tmp_mode, tmp_size, 0);
+ emit_move_insn (dest, tmps[i]);
+ dst = adjust_address (dest, dest_mode, bytepos);
+ }
break;
}
}
@@ -4280,6 +4299,7 @@ expand_assignment (tree to, tree from, bool nontemporal)
needs to be done. Handling this in the normal way is safe because no
computation is done before the call. */
if (TREE_CODE (from) == CALL_EXPR && ! aggregate_value_p (from, from)
+ && COMPLETE_TYPE_P (TREE_TYPE (from))
&& TREE_CODE (TYPE_SIZE (TREE_TYPE (from))) == INTEGER_CST
&& ! ((TREE_CODE (to) == VAR_DECL || TREE_CODE (to) == PARM_DECL)
&& REG_P (DECL_RTL (to))))
@@ -6539,9 +6559,6 @@ safe_from_p (const_rtx x, tree exp, int top_p)
case tcc_type:
/* Should never get a type here. */
gcc_unreachable ();
-
- case tcc_gimple_stmt:
- gcc_unreachable ();
}
/* If we have an rtl, find any enclosed object. Then see if we conflict
@@ -7048,8 +7065,7 @@ expand_expr_real (tree exp, rtx target, enum machine_mode tmode,
/* Handle ERROR_MARK before anybody tries to access its type. */
if (TREE_CODE (exp) == ERROR_MARK
- || TREE_CODE (exp) == PREDICT_EXPR
- || (!GIMPLE_TUPLE_P (exp) && TREE_CODE (TREE_TYPE (exp)) == ERROR_MARK))
+ || (TREE_CODE (TREE_TYPE (exp)) == ERROR_MARK))
{
ret = CONST0_RTX (tmode);
return ret ? ret : const0_rtx;
@@ -7057,7 +7073,8 @@ expand_expr_real (tree exp, rtx target, enum machine_mode tmode,
if (flag_non_call_exceptions)
{
- rn = lookup_stmt_eh_region (exp);
+ rn = lookup_expr_eh_region (exp);
+
/* If rn < 0, then either (1) tree-ssa not used or (2) doesn't throw. */
if (rn >= 0)
last = get_last_insn ();
@@ -7131,18 +7148,9 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
type) \
: (expr))
- if (GIMPLE_STMT_P (exp))
- {
- type = void_type_node;
- mode = VOIDmode;
- unsignedp = 0;
- }
- else
- {
- type = TREE_TYPE (exp);
- mode = TYPE_MODE (type);
- unsignedp = TYPE_UNSIGNED (type);
- }
+ type = TREE_TYPE (exp);
+ mode = TYPE_MODE (type);
+ unsignedp = TYPE_UNSIGNED (type);
ignore = (target == const0_rtx
|| ((code == NOP_EXPR || code == CONVERT_EXPR
@@ -7955,20 +7963,20 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
if (mode == BLKmode)
{
HOST_WIDE_INT size = GET_MODE_BITSIZE (ext_mode);
- rtx new;
+ rtx new_rtx;
/* If the reference doesn't use the alias set of its type,
we cannot create the temporary using that type. */
if (component_uses_parent_alias_set (exp))
{
- new = assign_stack_local (ext_mode, size, 0);
- set_mem_alias_set (new, get_alias_set (exp));
+ new_rtx = assign_stack_local (ext_mode, size, 0);
+ set_mem_alias_set (new_rtx, get_alias_set (exp));
}
else
- new = assign_stack_temp_for_type (ext_mode, size, 0, type);
+ new_rtx = assign_stack_temp_for_type (ext_mode, size, 0, type);
- emit_move_insn (new, op0);
- op0 = copy_rtx (new);
+ emit_move_insn (new_rtx, op0);
+ op0 = copy_rtx (new_rtx);
PUT_MODE (op0, BLKmode);
set_mem_attributes (op0, exp, 1);
}
@@ -8209,9 +8217,9 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
HOST_WIDE_INT temp_size
= MAX (int_size_in_bytes (inner_type),
(HOST_WIDE_INT) GET_MODE_SIZE (TYPE_MODE (type)));
- rtx new = assign_stack_temp_for_type (TYPE_MODE (type),
- temp_size, 0, type);
- rtx new_with_op0_mode = adjust_address (new, GET_MODE (op0), 0);
+ rtx new_rtx = assign_stack_temp_for_type (TYPE_MODE (type),
+ temp_size, 0, type);
+ rtx new_with_op0_mode = adjust_address (new_rtx, GET_MODE (op0), 0);
gcc_assert (!TREE_ADDRESSABLE (exp));
@@ -8223,7 +8231,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
else
emit_move_insn (new_with_op0_mode, op0);
- op0 = new;
+ op0 = new_rtx;
}
op0 = adjust_address (op0, TYPE_MODE (type), 0);
@@ -8981,7 +8989,10 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
/* If no set-flag instruction, must generate a conditional store
into a temporary variable. Drop through and handle this
like && and ||. */
-
+ /* Although TRUTH_{AND,OR}IF_EXPR aren't present in GIMPLE, they
+ are occassionally created by folding during expansion. */
+ case TRUTH_ANDIF_EXPR:
+ case TRUTH_ORIF_EXPR:
if (! ignore
&& (target == 0
|| modifier == EXPAND_STACK_PARM
@@ -9090,16 +9101,6 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
tree lhs = TREE_OPERAND (exp, 0);
tree rhs = TREE_OPERAND (exp, 1);
gcc_assert (ignore);
- expand_assignment (lhs, rhs, false);
- return const0_rtx;
- }
-
- case GIMPLE_MODIFY_STMT:
- {
- tree lhs = GIMPLE_STMT_OPERAND (exp, 0);
- tree rhs = GIMPLE_STMT_OPERAND (exp, 1);
-
- gcc_assert (ignore);
/* Check for |= or &= of a bitfield of size one into another bitfield
of size 1. In this case, (unless we need the result of the
@@ -9191,8 +9192,6 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
case POSTDECREMENT_EXPR:
case LOOP_EXPR:
case EXIT_EXPR:
- case TRUTH_ANDIF_EXPR:
- case TRUTH_ORIF_EXPR:
/* Lowered by gimplify.c. */
gcc_unreachable ();
@@ -9358,17 +9357,8 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
case VEC_PACK_TRUNC_EXPR:
case VEC_PACK_SAT_EXPR:
case VEC_PACK_FIX_TRUNC_EXPR:
- {
- mode = TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0)));
- goto binop;
- }
-
- case OMP_ATOMIC_LOAD:
- case OMP_ATOMIC_STORE:
- /* OMP expansion is not run when there were errors, so these codes
- can get here. */
- gcc_assert (errorcount != 0);
- return NULL_RTX;
+ mode = TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0)));
+ goto binop;
default:
return lang_hooks.expand_expr (exp, original_target, tmode,
@@ -10027,16 +10017,16 @@ try_tablejump (tree index_type, tree index_expr, tree minval, tree range,
int
vector_mode_valid_p (enum machine_mode mode)
{
- enum mode_class class = GET_MODE_CLASS (mode);
+ enum mode_class mclass = GET_MODE_CLASS (mode);
enum machine_mode innermode;
/* Doh! What's going on? */
- if (class != MODE_VECTOR_INT
- && class != MODE_VECTOR_FLOAT
- && class != MODE_VECTOR_FRACT
- && class != MODE_VECTOR_UFRACT
- && class != MODE_VECTOR_ACCUM
- && class != MODE_VECTOR_UACCUM)
+ if (mclass != MODE_VECTOR_INT
+ && mclass != MODE_VECTOR_FLOAT
+ && mclass != MODE_VECTOR_FRACT
+ && mclass != MODE_VECTOR_UFRACT
+ && mclass != MODE_VECTOR_ACCUM
+ && mclass != MODE_VECTOR_UACCUM)
return 0;
/* Hardware support. Woo hoo! */
diff --git a/gcc/final.c b/gcc/final.c
index 7a87235321e..d24d8fdb177 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -1377,20 +1377,20 @@ shorten_branches (rtx first ATTRIBUTE_UNUSED)
static int
asm_insn_count (rtx body)
{
- const char *template;
+ const char *templ;
int count = 1;
if (GET_CODE (body) == ASM_INPUT)
- template = XSTR (body, 0);
+ templ = XSTR (body, 0);
else
- template = decode_asm_operands (body, NULL, NULL, NULL, NULL, NULL);
+ templ = decode_asm_operands (body, NULL, NULL, NULL, NULL, NULL);
- if (!*template)
+ if (!*templ)
return 0;
- for (; *template; template++)
- if (IS_ASM_LOGICAL_LINE_SEPARATOR (*template, template)
- || *template == '\n')
+ for (; *templ; templ++)
+ if (IS_ASM_LOGICAL_LINE_SEPARATOR (*templ, templ)
+ || *templ == '\n')
count++;
return count;
@@ -1744,6 +1744,34 @@ output_alternate_entry_point (FILE *file, rtx insn)
}
}
+/* Given a CALL_INSN, find and return the nested CALL. */
+static rtx
+call_from_call_insn (rtx insn)
+{
+ rtx x;
+ gcc_assert (CALL_P (insn));
+ x = PATTERN (insn);
+
+ while (GET_CODE (x) != CALL)
+ {
+ switch (GET_CODE (x))
+ {
+ default:
+ gcc_unreachable ();
+ case COND_EXEC:
+ x = COND_EXEC_CODE (x);
+ break;
+ case PARALLEL:
+ x = XVECEXP (x, 0, 0);
+ break;
+ case SET:
+ x = XEXP (x, 1);
+ break;
+ }
+ }
+ return x;
+}
+
/* The final scan for one insn, INSN.
Args are same as in `final', except that INSN
is the insn being scanned.
@@ -1979,11 +2007,7 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED,
if (LABEL_NAME (insn))
(*debug_hooks->label) (insn);
- if (app_on)
- {
- fputs (ASM_APP_OFF, file);
- app_on = 0;
- }
+ app_disable ();
next = next_nonnote_insn (insn);
if (next != 0 && JUMP_P (next))
@@ -2039,7 +2063,7 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED,
{
rtx body = PATTERN (insn);
int insn_code_number;
- const char *template;
+ const char *templ;
#ifdef HAVE_conditional_execution
/* Reset this early so it is correct for ASM statements. */
@@ -2083,11 +2107,7 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED,
else
switch_to_section (current_function_section ());
- if (app_on)
- {
- fputs (ASM_APP_OFF, file);
- app_on = 0;
- }
+ app_disable ();
#if defined(ASM_OUTPUT_ADDR_VEC) || defined(ASM_OUTPUT_ADDR_DIFF_VEC)
if (GET_CODE (body) == ADDR_VEC)
@@ -2161,11 +2181,7 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED,
{
expanded_location loc;
- if (! app_on)
- {
- fputs (ASM_APP_ON, file);
- app_on = 1;
- }
+ app_enable ();
loc = expand_location (ASM_INPUT_SOURCE_LOCATION (body));
if (*loc.file && loc.line)
fprintf (asm_out_file, "%s %i \"%s\" 1\n",
@@ -2205,11 +2221,7 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED,
/* Output the insn using them. */
if (string[0])
{
- if (! app_on)
- {
- fputs (ASM_APP_ON, file);
- app_on = 1;
- }
+ app_enable ();
if (expanded.file && expanded.line)
fprintf (asm_out_file, "%s %i \"%s\" 1\n",
ASM_COMMENT_START, expanded.line, expanded.file);
@@ -2224,11 +2236,7 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED,
break;
}
- if (app_on)
- {
- fputs (ASM_APP_OFF, file);
- app_on = 0;
- }
+ app_disable ();
if (GET_CODE (body) == SEQUENCE)
{
@@ -2556,12 +2564,12 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED,
#endif
/* Find the proper template for this insn. */
- template = get_insn_template (insn_code_number, insn);
+ templ = get_insn_template (insn_code_number, insn);
/* If the C code returns 0, it means that it is a jump insn
which follows a deleted test insn, and that test insn
needs to be reinserted. */
- if (template == 0)
+ if (templ == 0)
{
rtx prev;
@@ -2584,12 +2592,12 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED,
/* If the template is the string "#", it means that this insn must
be split. */
- if (template[0] == '#' && template[1] == '\0')
+ if (templ[0] == '#' && templ[1] == '\0')
{
- rtx new = try_split (body, insn, 0);
+ rtx new_rtx = try_split (body, insn, 0);
/* If we didn't split the insn, go away. */
- if (new == insn && PATTERN (new) == body)
+ if (new_rtx == insn && PATTERN (new_rtx) == body)
fatal_insn ("could not split insn", insn);
#ifdef HAVE_ATTR_length
@@ -2599,7 +2607,7 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED,
gcc_unreachable ();
#endif
- return new;
+ return new_rtx;
}
#ifdef TARGET_UNWIND_INFO
@@ -2609,8 +2617,22 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED,
targetm.asm_out.unwind_emit (asm_out_file, insn);
#endif
+ if (CALL_P (insn))
+ {
+ rtx x = call_from_call_insn (insn);
+ x = XEXP (x, 0);
+ if (x && MEM_P (x) && GET_CODE (XEXP (x, 0)) == SYMBOL_REF)
+ {
+ tree t;
+ x = XEXP (x, 0);
+ t = SYMBOL_REF_DECL (x);
+ if (t)
+ assemble_external (t);
+ }
+ }
+
/* Output assembler code from the template. */
- output_asm_insn (template, recog_data.operand);
+ output_asm_insn (templ, recog_data.operand);
/* If necessary, report the effect that the instruction has on
the unwind info. We've already done this for delay slots
@@ -2739,11 +2761,11 @@ alter_subreg (rtx *xp)
}
else
{
- rtx new = simplify_subreg (GET_MODE (x), y, GET_MODE (y),
+ rtx new_rtx = simplify_subreg (GET_MODE (x), y, GET_MODE (y),
SUBREG_BYTE (x));
- if (new != 0)
- *xp = new;
+ if (new_rtx != 0)
+ *xp = new_rtx;
else if (REG_P (y))
{
/* Simplify_subreg can't handle some REG cases, but we have to. */
@@ -3097,7 +3119,7 @@ output_asm_operand_names (rtx *operands, int *oporder, int nops)
of the operand, with no other punctuation. */
void
-output_asm_insn (const char *template, rtx *operands)
+output_asm_insn (const char *templ, rtx *operands)
{
const char *p;
int c;
@@ -3110,11 +3132,11 @@ output_asm_insn (const char *template, rtx *operands)
/* An insn may return a null string template
in a case where no assembler code is needed. */
- if (*template == 0)
+ if (*templ == 0)
return;
memset (opoutput, 0, sizeof opoutput);
- p = template;
+ p = templ;
putc ('\t', asm_out_file);
#ifdef ASM_OUTPUT_OPCODE
@@ -3344,6 +3366,14 @@ output_operand (rtx x, int code ATTRIBUTE_UNUSED)
gcc_assert (!x || !REG_P (x) || REGNO (x) < FIRST_PSEUDO_REGISTER);
PRINT_OPERAND (asm_out_file, x, code);
+ if (x && MEM_P (x) && GET_CODE (XEXP (x, 0)) == SYMBOL_REF)
+ {
+ tree t;
+ x = XEXP (x, 0);
+ t = SYMBOL_REF_DECL (x);
+ if (t)
+ assemble_external (t);
+ }
}
/* Print a memory reference operand for address X
diff --git a/gcc/fix-header.c b/gcc/fix-header.c
index f691e4eae70..5402e949db4 100644
--- a/gcc/fix-header.c
+++ b/gcc/fix-header.c
@@ -562,7 +562,10 @@ recognized_function (const cpp_token *fname, unsigned int line, int kind,
/* We only have a partial function declaration,
so remember that we have to add a complete prototype. */
partial_count++;
- partial = obstack_alloc (&scan_file_obstack, sizeof (struct partial_proto));
+ partial
+ = (struct partial_proto *)
+ obstack_alloc (&scan_file_obstack,
+ sizeof (struct partial_proto));
partial->line_seen = line;
partial->fn = fn;
fn->partial = partial;
diff --git a/gcc/flags.h b/gcc/flags.h
index edc96e95920..cfd278f747e 100644
--- a/gcc/flags.h
+++ b/gcc/flags.h
@@ -24,6 +24,7 @@ along with GCC; see the file COPYING3. If not see
#include "coretypes.h"
#include "options.h"
+#include "real.h"
enum debug_info_type
{
@@ -115,12 +116,6 @@ extern int optimize_size;
extern bool extra_warnings;
-/* Nonzero to warn about unused variables, functions et.al. Use
- set_Wunused() to update the -Wunused-* flags that correspond to the
- -Wunused option. */
-
-extern void set_Wunused (int setting);
-
/* Used to set the level of -Wstrict-aliasing, when no level is specified.
The external way to set the default level is to use
-Wstrict-aliasing=level.
@@ -143,11 +138,6 @@ extern HOST_WIDE_INT larger_than_size;
extern bool warn_frame_larger_than;
extern HOST_WIDE_INT frame_larger_than_size;
-/* Temporarily suppress certain warnings.
- This is set while reading code from a system header file. */
-
-extern int in_system_header;
-
/* Nonzero for -dp: annotate the assembly with a comment describing the
pattern and alternative used. */
@@ -174,11 +164,6 @@ extern int flag_pcc_struct_return;
extern int flag_complex_method;
-/* Nonzero means that we don't want inlining by virtue of -fno-inline,
- not just because the tree inliner turned us off. */
-
-extern int flag_really_no_inline;
-
/* Nonzero if we are only using compiler to check syntax errors. */
extern int rtl_dump_and_exit;
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index e1e04bb625d..eac31ef1a79 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -65,6 +65,7 @@ along with GCC; see the file COPYING3. If not see
#include "hashtab.h"
#include "langhooks.h"
#include "md5.h"
+#include "gimple.h"
/* Nonzero if we are folding constants inside an initializer; zero
otherwise. */
@@ -949,7 +950,7 @@ fold_defer_overflow_warnings (void)
deferred code. */
void
-fold_undefer_overflow_warnings (bool issue, const_tree stmt, int code)
+fold_undefer_overflow_warnings (bool issue, const_gimple stmt, int code)
{
const char *warnmsg;
location_t locus;
@@ -971,7 +972,7 @@ fold_undefer_overflow_warnings (bool issue, const_tree stmt, int code)
if (!issue || warnmsg == NULL)
return;
- if (stmt != NULL_TREE && TREE_NO_WARNING (stmt))
+ if (gimple_no_warning_p (stmt))
return;
/* Use the smallest code level when deciding to issue the
@@ -982,10 +983,10 @@ fold_undefer_overflow_warnings (bool issue, const_tree stmt, int code)
if (!issue_strict_overflow_warning (code))
return;
- if (stmt == NULL_TREE || !expr_has_location (stmt))
+ if (stmt == NULL)
locus = input_location;
else
- locus = expr_location (stmt);
+ locus = gimple_location (stmt);
warning (OPT_Wstrict_overflow, "%H%s", &locus, warnmsg);
}
@@ -995,7 +996,7 @@ fold_undefer_overflow_warnings (bool issue, const_tree stmt, int code)
void
fold_undefer_and_ignore_overflow_warnings (void)
{
- fold_undefer_overflow_warnings (false, NULL_TREE, 0);
+ fold_undefer_overflow_warnings (false, NULL, 0);
}
/* Whether we are deferring overflow warnings. */
@@ -1884,8 +1885,7 @@ const_binop (enum tree_code code, tree arg1, tree arg2, int notrunc)
flag_rounding_math is set, or if GCC's software emulation
is unable to accurately represent the result. */
if ((flag_rounding_math
- || (REAL_MODE_FORMAT_COMPOSITE_P (mode)
- && !flag_unsafe_math_optimizations))
+ || (MODE_COMPOSITE_P (mode) && !flag_unsafe_math_optimizations))
&& (inexact || !real_identical (&result, &value)))
return NULL_TREE;
@@ -2639,7 +2639,7 @@ fold_convert (tree type, tree arg)
case VOID_TYPE:
tem = fold_ignored_result (arg);
- if (TREE_CODE (tem) == GIMPLE_MODIFY_STMT)
+ if (TREE_CODE (tem) == MODIFY_EXPR)
return tem;
return fold_build1 (NOP_EXPR, type, tem);
@@ -2682,7 +2682,6 @@ maybe_lvalue_p (const_tree x)
case WITH_CLEANUP_EXPR:
case COMPOUND_EXPR:
case MODIFY_EXPR:
- case GIMPLE_MODIFY_STMT:
case TARGET_EXPR:
case COND_EXPR:
case BIND_EXPR:
@@ -3391,17 +3390,17 @@ static int
twoval_comparison_p (tree arg, tree *cval1, tree *cval2, int *save_p)
{
enum tree_code code = TREE_CODE (arg);
- enum tree_code_class class = TREE_CODE_CLASS (code);
+ enum tree_code_class tclass = TREE_CODE_CLASS (code);
/* We can handle some of the tcc_expression cases here. */
- if (class == tcc_expression && code == TRUTH_NOT_EXPR)
- class = tcc_unary;
- else if (class == tcc_expression
+ if (tclass == tcc_expression && code == TRUTH_NOT_EXPR)
+ tclass = tcc_unary;
+ else if (tclass == tcc_expression
&& (code == TRUTH_ANDIF_EXPR || code == TRUTH_ORIF_EXPR
|| code == COMPOUND_EXPR))
- class = tcc_binary;
+ tclass = tcc_binary;
- else if (class == tcc_expression && code == SAVE_EXPR
+ else if (tclass == tcc_expression && code == SAVE_EXPR
&& ! TREE_SIDE_EFFECTS (TREE_OPERAND (arg, 0)))
{
/* If we've already found a CVAL1 or CVAL2, this expression is
@@ -3409,11 +3408,11 @@ twoval_comparison_p (tree arg, tree *cval1, tree *cval2, int *save_p)
if (*cval1 || *cval2)
return 0;
- class = tcc_unary;
+ tclass = tcc_unary;
*save_p = 1;
}
- switch (class)
+ switch (tclass)
{
case tcc_unary:
return twoval_comparison_p (TREE_OPERAND (arg, 0), cval1, cval2, save_p);
@@ -3484,16 +3483,16 @@ eval_subst (tree arg, tree old0, tree new0, tree old1, tree new1)
{
tree type = TREE_TYPE (arg);
enum tree_code code = TREE_CODE (arg);
- enum tree_code_class class = TREE_CODE_CLASS (code);
+ enum tree_code_class tclass = TREE_CODE_CLASS (code);
/* We can handle some of the tcc_expression cases here. */
- if (class == tcc_expression && code == TRUTH_NOT_EXPR)
- class = tcc_unary;
- else if (class == tcc_expression
+ if (tclass == tcc_expression && code == TRUTH_NOT_EXPR)
+ tclass = tcc_unary;
+ else if (tclass == tcc_expression
&& (code == TRUTH_ANDIF_EXPR || code == TRUTH_ORIF_EXPR))
- class = tcc_binary;
+ tclass = tcc_binary;
- switch (class)
+ switch (tclass)
{
case tcc_unary:
return fold_build1 (code, type,
@@ -6734,10 +6733,8 @@ fold_widened_comparison (enum tree_code code, tree type, tree arg0, tree arg1)
if ((code == EQ_EXPR || code == NE_EXPR
|| TYPE_UNSIGNED (TREE_TYPE (arg0)) == TYPE_UNSIGNED (shorter_type))
&& (TREE_TYPE (arg1_unw) == shorter_type
- || (TYPE_PRECISION (shorter_type)
- > TYPE_PRECISION (TREE_TYPE (arg1_unw)))
|| ((TYPE_PRECISION (shorter_type)
- == TYPE_PRECISION (TREE_TYPE (arg1_unw)))
+ >= TYPE_PRECISION (TREE_TYPE (arg1_unw)))
&& (TYPE_UNSIGNED (shorter_type)
== TYPE_UNSIGNED (TREE_TYPE (arg1_unw))))
|| (TREE_CODE (arg1_unw) == INTEGER_CST
@@ -7847,17 +7844,16 @@ fold_unary (enum tree_code code, tree type, tree op0)
return fold_convert (type, fold_addr_expr (base));
}
- if ((TREE_CODE (op0) == MODIFY_EXPR
- || TREE_CODE (op0) == GIMPLE_MODIFY_STMT)
- && TREE_CONSTANT (GENERIC_TREE_OPERAND (op0, 1))
+ if (TREE_CODE (op0) == MODIFY_EXPR
+ && TREE_CONSTANT (TREE_OPERAND (op0, 1))
/* Detect assigning a bitfield. */
- && !(TREE_CODE (GENERIC_TREE_OPERAND (op0, 0)) == COMPONENT_REF
+ && !(TREE_CODE (TREE_OPERAND (op0, 0)) == COMPONENT_REF
&& DECL_BIT_FIELD
- (TREE_OPERAND (GENERIC_TREE_OPERAND (op0, 0), 1))))
+ (TREE_OPERAND (TREE_OPERAND (op0, 0), 1))))
{
/* Don't leave an assignment inside a conversion
unless assigning a bitfield. */
- tem = fold_build1 (code, type, GENERIC_TREE_OPERAND (op0, 1));
+ tem = fold_build1 (code, type, TREE_OPERAND (op0, 1));
/* First do the assignment, then return converted constant. */
tem = build2 (COMPOUND_EXPR, TREE_TYPE (tem), op0, tem);
TREE_NO_WARNING (tem) = 1;
@@ -9249,8 +9245,7 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
tree t1 = NULL_TREE;
bool strict_overflow_p;
- gcc_assert ((IS_EXPR_CODE_CLASS (kind)
- || IS_GIMPLE_STMT_CODE_CLASS (kind))
+ gcc_assert (IS_EXPR_CODE_CLASS (kind)
&& TREE_CODE_LENGTH (code) == 2
&& op0 != NULL_TREE
&& op1 != NULL_TREE);
@@ -13169,8 +13164,7 @@ fold (tree expr)
return expr;
}
- if (IS_EXPR_CODE_CLASS (kind)
- || IS_GIMPLE_STMT_CODE_CLASS (kind))
+ if (IS_EXPR_CODE_CLASS (kind))
{
tree type = TREE_TYPE (t);
tree op0, op1, op2;
@@ -14110,7 +14104,7 @@ tree_single_nonnegative_warnv_p (tree t, bool *strict_overflow_p)
*STRICT_OVERFLOW_P. */
bool
-tree_call_nonnegative_warnv_p (enum tree_code code, tree type, tree fndecl,
+tree_call_nonnegative_warnv_p (tree type, tree fndecl,
tree arg0, tree arg1, bool *strict_overflow_p)
{
if (fndecl && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL)
@@ -14231,7 +14225,7 @@ tree_call_nonnegative_warnv_p (enum tree_code code, tree type, tree fndecl,
default:
break;
}
- return tree_simple_nonnegative_warnv_p (code,
+ return tree_simple_nonnegative_warnv_p (CALL_EXPR,
type);
}
@@ -14273,10 +14267,9 @@ tree_invalid_nonnegative_warnv_p (tree t, bool *strict_overflow_p)
else
break;
}
- if ((TREE_CODE (t) == MODIFY_EXPR
- || TREE_CODE (t) == GIMPLE_MODIFY_STMT)
- && GENERIC_TREE_OPERAND (t, 0) == temp)
- return tree_expr_nonnegative_warnv_p (GENERIC_TREE_OPERAND (t, 1),
+ if (TREE_CODE (t) == MODIFY_EXPR
+ && TREE_OPERAND (t, 0) == temp)
+ return tree_expr_nonnegative_warnv_p (TREE_OPERAND (t, 1),
strict_overflow_p);
return false;
@@ -14287,8 +14280,7 @@ tree_invalid_nonnegative_warnv_p (tree t, bool *strict_overflow_p)
tree arg0 = call_expr_nargs (t) > 0 ? CALL_EXPR_ARG (t, 0) : NULL_TREE;
tree arg1 = call_expr_nargs (t) > 1 ? CALL_EXPR_ARG (t, 1) : NULL_TREE;
- return tree_call_nonnegative_warnv_p (TREE_CODE (t),
- TREE_TYPE (t),
+ return tree_call_nonnegative_warnv_p (TREE_TYPE (t),
get_callee_fndecl (t),
arg0,
arg1,
@@ -14296,8 +14288,7 @@ tree_invalid_nonnegative_warnv_p (tree t, bool *strict_overflow_p)
}
case COMPOUND_EXPR:
case MODIFY_EXPR:
- case GIMPLE_MODIFY_STMT:
- return tree_expr_nonnegative_warnv_p (GENERIC_TREE_OPERAND (t, 1),
+ return tree_expr_nonnegative_warnv_p (TREE_OPERAND (t, 1),
strict_overflow_p);
case BIND_EXPR:
return tree_expr_nonnegative_warnv_p (expr_last (TREE_OPERAND (t, 1)),
@@ -14672,9 +14663,8 @@ tree_expr_nonzero_warnv_p (tree t, bool *strict_overflow_p)
case COMPOUND_EXPR:
case MODIFY_EXPR:
- case GIMPLE_MODIFY_STMT:
case BIND_EXPR:
- return tree_expr_nonzero_warnv_p (GENERIC_TREE_OPERAND (t, 1),
+ return tree_expr_nonzero_warnv_p (TREE_OPERAND (t, 1),
strict_overflow_p);
case SAVE_EXPR:
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index e36e8089c24..3ea6c32005c 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,526 @@
+2008-08-14 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/36705
+ * symbol.c (check_conflict): Move conflict checks for (procedure,save)
+ and (procedure,intent) to resolve_fl_procedure.
+ * resolve.c (resolve_fl_procedure): Ditto.
+
+2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR 36901
+ * f95-lang.c (gfc_mark_addressable): Use "pedwarn (0," instead of
+ 'pedwarn0'.
+
+2008-08-09 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/37011
+ * symbol.c (gfc_add_extension): New function.
+ * decl.c (gfc_get_type_attr_spec): Call it.
+ (gfc_match_derived_decl): Set symbol extension attribute from
+ attr.extension.
+ * gfortran.h : Add prototype for gfc_add_extension.
+
+2008-08-08 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR 28875
+ * options.c (set_Wall): Replace set_Wunused by warn_unused.
+
+2008-08-08 Daniel Kraft <d@domob.eu>
+
+ * gfortran.h (gfc_finalizer): Replaced member `procedure' by two
+ new members `proc_sym' and `proc_tree' to store the symtree after
+ resolution.
+ (gfc_find_sym_in_symtree): Made public.
+ * decl.c (gfc_match_final_decl): Adapted for new member name.
+ * interface.c (gfc_find_sym_in_symtree): Made public.
+ (gfc_extend_expr), (gfc_extend_assign): Changed call accordingly.
+ * module.c (mio_finalizer), (mio_f2k_derived), (mio_full_f2k_derived):
+ New methods for module-file IO of f2k_derived.
+ (mio_symbol): Do IO of f2k_derived namespace.
+ * resolve.c (gfc_resolve_finalizers): Adapted for new member name and
+ finding the symtree for the symbol here.
+ * symbol.c (gfc_free_finalizer): Adapted for new members.
+
+2008-07-30 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * gfc-internals.texi: Update to GFDL 1.2. Do not list GPL as
+ Invariant Section.
+ * gfortran.texi: Likewise.
+ * intrinsic.texi: Do not list GPL as Invariant Section.
+ * invoke.texi: Likewise. Update copyright years.
+
+2008-07-29 Paul Thomas <pault@gcc.gnu.org>
+
+ * trans-expr.c (conv_parent_component_references): New function
+ to build missing parent references.
+ (gfc_conv_variable): Call it
+ * symbol.c (gfc_add_component): Check that component name in a
+ derived type extension does not appear in parent.
+ (gfc_find_component): For a derived type extension, check if
+ the component appears in the parent derived type by calling
+ self. Separate errors for private components and private types.
+ * decl.c (match_data_constant): Add extra arg to call to
+ gfc_match_structure_constructor.
+ (check_extended_derived_type): New function to check that a
+ parent derived type exists and that it is OK for exension.
+ (gfc_get_type_attr_spec): Add extra argument 'name' and return
+ it if extends is specified.
+ (gfc_match_derived_decl): Match derived type extension and
+ build a first component of the parent derived type if OK. Add
+ the f2k namespace if not present.
+ * gfortran.h : Add the extension attribute.
+ * module.c : Handle attribute 'extension'.
+ * match.h : Modify prototypes for gfc_get_type_attr_spec and
+ gfc_match_structure_constructor.
+ * primary.c (build_actual_constructor): New function extracted
+ from gfc_match_structure_constructor and modified to call self
+ iteratively to build derived type extensions, when f2k named
+ components are used.
+ (gfc_match_structure_constructor): Do not throw error for too
+ many components if a parent type is being handled. Use
+ gfc_find_component to generate errors for non-existent or
+ private components. Iteratively call self for derived type
+ extensions so that parent constructor is built. If extension
+ and components left over, throw error.
+ (gfc_match_rvalue): Add extra arg to call to
+ gfc_match_structure_constructor.
+
+ * trans-array.c (gfc_conv_resolve_dependencies): If lhs and rhs
+ are the same symbol, aliassing does not matter.
+
+2008-07-29 Jan Hubicka <jh@suse.cz>
+
+ * options.c (gfc_post_options): Do not set flag_no_inline.
+
+2008-07-29 Daniel Kraft <d@domob.eu>
+
+ PR fortran/36403
+ * trans-intrinsic.c (conv_generic_with_optional_char_arg): New method
+ to append a string-length even if the string argument is missing, e.g.
+ for EOSHIFT.
+ (gfc_conv_intrinsic_function): Call the new method for EOSHIFT, PACK
+ and RESHAPE.
+
+2008-07-28 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * gfortran.h (try): Remove macro. Replace try with gfc_try
+ throughout.
+ * array.c: Likewise.
+ * check.c: Likewise.
+ * cpp.c: Likewise.
+ * cpp.h: Likewise.
+ * data.c: Likewise.
+ * data.h: Likewise.
+ * decl.c: Likewise.
+ * error.c: Likewise.
+ * expr.c: Likewise.
+ * interface.c: Likewise.
+ * intrinsic.c: Likewise.
+ * intrinsic.h: Likewise.
+ * io.c: Likewise.
+ * match.h: Likewise.
+ * parse.c: Likewise.
+ * parse.h: Likewise.
+ * resolve.c: Likewise.
+ * scanner.c: Likewise.
+ * simplify.c: Likewise.
+ * symbol.c: Likewise.
+ * trans-openmp.c: Likewise.
+ * trans-types.c: Likewise.
+
+2008-07-28 Tobias Burnus <burnus@net-b.de>
+
+ * Make-lang.in: Remove -Wno-* from fortran-warn.
+
+2008-07-28 Richard Guenther <rguenther@suse.de>
+
+ Merge from gimple-tuples-branch.
+
+ 2008-07-18 Aldy Hernandez <aldyh@redhat.com>
+
+ * trans-expr.c: Include gimple.h instead of tree-gimple.h.
+ * trans-array.c: Same.
+ * trans-openmp.c: Same.
+ * trans-stmt.c: Same.
+ * f95-lang.c: Same.
+ * trans-io.c: Same.
+ * trans-decl.c: Same.
+ * trans-intrinsic.c: Same.
+ * trans.c: Same. Include tree-iterator.h.
+ * Make-lang.in (trans.o): Depend on tree-iterator.h
+
+ 2008-07-14 Aldy Hernandez <aldyh@redhat.com>
+
+ * trans-array.h (gfc_conv_descriptor_data_set_internal):
+ Rename to gfc_conv_descriptor_data_set.
+ (gfc_conv_descriptor_data_set_tuples): Remove.
+ * trans-array.c (gfc_conv_descriptor_data_get): Rename
+ from gfc_conv_descriptor_data_set_internal.
+ Remove last argument to gfc_add_modify.
+ (gfc_trans_allocate_array_storage): Rename gfc_add_modify_expr to
+ gfc_add_modify.
+ (gfc_trans_create_temp_array): Same.
+ (gfc_conv_array_transpose): Same.
+ (gfc_grow_array): Same.
+ (gfc_put_offset_into_var): Same.
+ (gfc_trans_array_ctor_element): Same.
+ (gfc_trans_array_constructor_subarray): Same.
+ (gfc_trans_array_constructor_value): Same.
+ (gfc_trans_scalarized_loop_end): Same.
+ (gfc_array_init_size): Same.
+ (gfc_array_allocate): Same.
+ (gfc_trans_array_bounds): Same.
+ (gfc_trans_auto_array_allocation): Same.
+ (gfc_trans_g77_array): Same.
+ (gfc_trans_dummy_array_bias): Same.
+ (gfc_conv_expr_descriptor): Same.
+ (structure_alloc_comps): Same.
+ * trans-expr.c: Same.
+ * trans-openmp.c (gfc_omp_clause_default_ctor): Same.
+ Rename gfc_conv_descriptor_data_set_tuples to
+ gfc_conv_descriptor_data_set.
+ (gfc_omp_clause_copy_ctor): Change build_gimple_modify_stmt to
+ build2_v.
+ (gfc_omp_clause_assign_op): Same.
+ (gfc_trans_omp_array_reduction): Rename gfc_add_modify_expr to
+ gfc_add_modify.
+ (gfc_trans_omp_atomic): Same.
+ (gfc_trans_omp_do): Same. Change GIMPLE_MODIFY_STMT to MODIFY_EXPR.
+ Rename gfc_add_modify_stmt to gfc_add_modify.
+ * trans-stmt.c: Rename gfc_add_modify_expr to
+ gfc_add_modify.
+ * trans.c: Rename gfc_add_modify_expr to
+ gfc_add_modify.
+ (gfc_add_modify): Remove last argument.
+ Rename GIMPLE_MODIFY_STMT to MODIFY_EXPR.
+ * trans.h: Remove gfc_add_modify_expr, gfc_add_modify_stmt.
+ Add prototype for gfc_add_modify.
+ * f95-lang.c (union lang_tree_node): Rename GENERIC_NEXT to TREE_CHAIN.
+ * trans-decl.c: Rename gfc_add_modify_stmt to gfc_add_modify.
+ * trans-io.c: Same.
+ * trans-intrinsic.c: Same.
+
+ 2008-02-25 Aldy Hernandez <aldyh@redhat.com>
+
+ * Make-lang.in (fortran-warn): Add -Wno-format.
+
+ 2008-02-19 Diego Novillo <dnovillo@google.com>
+
+ http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00804.html
+
+ * fortran/Make-lang.in (fortran-warn): Remove.
+
+ 2007-11-22 Aldy Hernandez <aldyh@redhat.com>
+
+ * trans-expr.c (gfc_trans_string_copy): Use "void *" when building a
+ memset.
+
+ 2007-11-10 Aldy Hernandez <aldyh@redhat.com>
+
+ * Make-lang.in (fortran-warn): Set to -Wno-format.
+ * trans.c (gfc_trans_code): Update comment to say GENERIC.
+ Call tree_annotate_all_with_locus instead of annotate_all_with_locus.
+
+2008-07-27 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/36132
+ PR fortran/29952
+ PR fortran/36909
+ * trans.c (gfc_trans_runtime_check): Allow run-time warning besides
+ run-time error.
+ * trans.h (gfc_trans_runtime_check): Update declaration.
+ * trans-array.c (gfc_trans_array_ctor_element,gfc_trans_array_bound_check,
+ gfc_conv_array_ref,gfc_conv_ss_startstride,gfc_trans_dummy_array_bias):
+ Updated gfc_trans_runtime_check calls.
+ (gfc_conv_array_parameter): Implement flag_check_array_temporaries,
+ fix packing/unpacking for nonpresent optional actuals to optional
+ formals.
+ * trans-array.h (gfc_conv_array_parameter): Update declaration.
+ * trans-expr.c (gfc_conv_substring,gfc_trans_arrayfunc_assign,
+ gfc_conv_function_call): Updated gfc_trans_runtime_check calls.
+ (gfc_conv_function_call): Update gfc_conv_array_parameter calls.
+ * trans-expr.c (gfc_trans_goto): Updated gfc_trans_runtime_check
+ calls.
+ * trans-io.c (set_string,gfc_conv_intrinsic_repeat): Ditto.
+ (gfc_conv_intrinsic_transfer,gfc_conv_intrinsic_loc): Same for
+ gfc_conv_array_parameter.
+ * trans-intrinsics.c (gfc_conv_intrinsic_bound): Ditto.
+ * trans-decl.c (gfc_build_builtin_function_decls): Add
+ gfor_fndecl_runtime_warning_at.
+ * lang.opt: New option fcheck-array-temporaries.
+ * gfortran.h (gfc_options): New flag_check_array_temporaries.
+ * options.c (gfc_init_options, gfc_handle_option): Handle flag.
+ * invoke.texi: New option fcheck-array-temporaries.
+
+2008-07-24 Jan Hubicka <jh@suse.cz>
+
+ * fortran/options.c (gfc_post_options): Remove flag_unline_trees code.
+
+2008-07-24 Daniel Kraft <d@domob.eu>
+
+ PR fortran/33141
+ * lang.opt (Wnonstd-intrinsics): Removed option.
+ (Wintrinsics-std), (Wintrinsic-shadow): New options.
+ * invoke.texi (Option Summary): Removed -Wnonstd-intrinsics
+ from the list and added -Wintrinsics-std and -Wintrinsic-shadow.
+ (Error and Warning Options): Documented the new options and removed
+ the documentation for -Wnonstd-intrinsics.
+ * gfortran.h (gfc_option_t): New members warn_intrinsic_shadow and
+ warn_intrinsics_std, removed warn_nonstd_intrinsics.
+ (gfc_is_intrinsic): Renamed from gfc_intrinsic_name.
+ (gfc_warn_intrinsic_shadow), (gfc_check_intrinsic_standard): New.
+ * decl.c (match_procedure_decl): Replaced gfc_intrinsic_name by
+ the new name gfc_is_intrinsic.
+ (warn_intrinsic_shadow): New helper method.
+ (gfc_match_function_decl), (gfc_match_subroutine): Call the new method
+ warn_intrinsic_shadow to check the just-parsed procedure.
+ * expr.c (check_init_expr): Call new gfc_is_intrinsic to check whether
+ the function called is really an intrinsic in the selected standard.
+ * intrinsic.c (gfc_is_intrinsic): Renamed from gfc_intrinsic_name and
+ extended to take into account the selected standard settings when trying
+ to find out whether a symbol is an intrinsic or not.
+ (gfc_check_intrinsic_standard): Made public and extended.
+ (gfc_intrinsic_func_interface), (gfc_intrinsic_sub_interface): Removed
+ the calls to check_intrinsic_standard, this check now happens inside
+ gfc_is_intrinsic.
+ (gfc_warn_intrinsic_shadow): New method defined.
+ * options.c (gfc_init_options): Initialize new warning flags to false
+ and removed intialization of Wnonstd-intrinsics flag.
+ (gfc_post_options): Removed logic for Wnonstd-intrinsics flag.
+ (set_Wall): Set new warning flags and removed Wnonstd-intrinsics flag.
+ (gfc_handle_option): Handle the new flags and removed handling of the
+ old Wnonstd-intrinsics flag.
+ * primary.c (gfc_match_rvalue): Replaced call to gfc_intrinsic_name by
+ the new name gfc_is_intrinsic.
+ * resolve.c (resolve_actual_arglist): Ditto.
+ (resolve_generic_f), (resolve_unknown_f): Ditto.
+ (is_external_proc): Ditto.
+ (resolve_generic_s), (resolve_unknown_s): Ditto.
+ (resolve_symbol): Ditto and ensure for symbols declared INTRINSIC that
+ they are really available in the selected standard setting.
+
+2008-07-24 Daniel Kraft <d@domob.eu>
+
+ * match.c (gfc_match): Add assertion to catch wrong calls trying to
+ match upper-case characters.
+
+2008-07-24 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/29952
+ * gfortran.h: Add "warn_array_temp" to gfc_option_t.
+ * lang.opt: Add -Warray-temporaries.
+ * invoke.texi: Document -Warray-temporaries
+ * trans-array.h (gfc_trans_create_temp_array): Add argument of
+ type *locus.
+ (gfc_conv_loop_setup): Likewise.
+ * trans-array.c (gfc_trans_create_temp_array): If
+ -Warray-temporaries is given and locus is present, warn about
+ creation of array temporaries.
+ (gfc_trans_array_constructor_subarray): Add locus to call
+ of gfc_conv_loop_setup.
+ (gfc_trans_array_constructor): Add where argument. Pass where
+ argument to call of gfc_trans_create_temp_array.
+ (gfc_add_loop_ss_code): Add where argument. Pass where argument
+ to recursive call of gfc_add_loop_ss_code and to call of
+ gfc_trans_array_constructor.
+ (gfc_conv_loop_setup): Add where argument. Pass where argument
+ to calls to gfc_add_loop_ss_code and to gfc_trans_create_temp_array.
+ (gfc_conv_expr_descriptor): Pass location to call of
+ gfc_conv_loop_setup.
+ (gfc_conv_array_parameter): If -Warray-temporaries is given,
+ warn about creation of temporary arrays.
+ * trans-expr.c (gfc_conv_subref_array_arg): Add where argument
+ to call to gfc_conv_loop_setup.
+ (gfc_conv_function_call): Add where argument to call to
+ gfc_trans_creat_temp_array.
+ (gfc_trans_subarray_assign): Likewise.
+ (gfc_trans_assignment_1): Add where argument to call to
+ gfc_conv_loop_setup.
+ * trans-stmt.c (gfc_conv_elemental_dependencies): Add where
+ argument to call to gfc_trans_create_temp_array.
+ (gfc_trans_call): Add where argument to call to gfc_conv_loop_setup.
+ (generate_loop_for_temp_to_lhs): Likewise.
+ (generate_loop_for_rhs_to_temp): Likewise.
+ (compute_inner_temp_size): Likewise.
+ (gfc_trans-pointer_assign_need_temp): Likewise.
+ (gfc_evaluate_where_mask): Likewise.
+ (gfc_trans_where_assign): Likewise.
+ (gfc_trans_where_3): Likewise.
+ * trans-io.c (transfer_srray_component): Add where argument
+ to function. Add where argument to call to gfc_conv_loop_setup.
+ (transfer_expr): Add where argument to call to
+ transfer_array_component.
+ (gfc_trans_transfer): Add where expression to call to
+ gfc_conv_loop_setup.
+ * trans-intrinsic.c (gfc_conv_intrinsic_anyall): Add
+ where argument to call to gfc_conv_loop_setup.
+ (gfc_conv_intrinsic_count): Likewise.
+ (gfc_conv_intrinsic_arith): Likewise.
+ (gfc_conv_intrinsic_dot_product): Likewise.
+ (gfc_conv_intrinsic_minmaxloc): Likewise.
+ (gfc_conv_intrinsic_minmaxval): Likewise.
+ (gfc_conv_intrinsic_array_transfer): Warn about
+ creation of temporary array.
+ Add where argument to call to gfc_trans_create_temp_array.
+ * options.c (gfc_init_options): Initialize gfc_option.warn_array_temp.
+ (gfc_handle_option): Set gfc_option.warn_array_temp.
+
+2008-07-23 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR 35058
+ * f95-lang.c (gfc_mark_addressable): All calls to pedwarn changed.
+
+2008-07-22 Daniel Kraft <d@domob.eu>
+
+ PR fortran/29835
+ * io.c (error_element), (format_locus): New static globals.
+ (unexpected_element): Spelled out this message fully.
+ (next_char): Keep track of locus when not MODE_STRING.
+ (next_char_not_space): Remember last parsed element in error_element.
+ (format_lex): Fix two indentation errors.
+ (check_format): Use format_locus and possibly error_element for a
+ slightly better error message on invalid format.
+ (check_format_string): Set format_locus to start of the string
+ expression used as format.
+
+2008-07-21 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * expr.c (gfc_check_pointer_assign): Fix typo in string.
+ * io.c (check_format): Fix typo in string. Fix comment typos.
+ * parse.c (gfc_global_used): Likewise.
+ * resolve.c (resolve_allocate_expr): Likewise.
+ * symbol.c (gfc_set_default_type): Likewise.
+ * arith.c: Fix typos in comments.
+ * array.c: Likewise.
+ * data.c: Likewise.
+ * decl.c: Likewise.
+ * dependency.c: Likewise.
+ * f95-lang.c: Likewise.
+ * gfortran.h: Likewise.
+ * matchexp.c: Likewise.
+ * module.c: Likewise.
+ * primary.c: Likewise.
+ * scanner.c: Likewise.
+ * trans-array.c: Likewise.
+ * trans-common.c: Likewise.
+ * trans-decl.c: Likewise.
+ * trans-expr.c: Likewise.
+ * trans-intrinsic.c: Likewise.
+ * trans-types.c: Likewise.
+ * trans.c: Likewise.
+ * trans.h: Likewise.
+
+2008-07-19 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/36795
+ * matchexp.c (gfc_get_parentheses): Remove obsolete workaround,
+ which caused the generation of wrong code.
+
+2008-07-19 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/36342
+ * scanner.c (load_file): Add argument to destinguish between
+ true filename and displayed filename.
+ (include_line,gfc_new_file): Adapt accordingly.
+
+2008-07-19 Tobias Burnus <burnus@net-b.de>
+
+ * check.c (gfc_check_cshift,gfc_check_eoshift,gfc_check_unpack): Add rank
+ checks for cshift's shift and eoshift's shift and boundary args.
+ (gfc_check_unpack): Add rank and shape tests for unpack.
+
+2008-07-19 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * gfortran.h (new): Remove macro.
+ * array.c (gfc_append_constructor, match_array_list,
+ gfc_match_array_constructor): Likewise.
+ * bbt.c (insert, gfc_insert_bbt): Likewise.
+ * decl.c (var_element, top_var_list, top_val_list, gfc_match_data,
+ get_proc_name): Likewise.
+ * expr.c (gfc_copy_actual_arglist): Likewise.
+ * interface.c (compare_actual_formal, check_new_interface,
+ gfc_add_interface): Likewise.
+ * intrinsic.c gfc_convert_type_warn, gfc_convert_chartype):
+ Likewise.
+ * io.c (match_io_iterator, match_io_list): Likewise.
+ * match.c (match_forall_header): Likewise.
+ * matchexp.c (build_node): Likewise.
+ * module.c (gfc_match_use): Likewise.
+ * scanner.c (load_file): Likewise.
+ * st.c (gfc_append_code): Likewise.
+ * symbol.c (save_symbol_data, gfc_get_sym_tree, gfc_undo_symbols,
+ gfc_commit_symbols): Likewise.
+ * trans-common.c (build_field): Likewise.
+ * trans-decl.c (gfc_finish_var_decl): Likewise.
+ * trans-expr.c (gfc_free_interface_mapping,
+ gfc_get_interface_mapping_charlen, gfc_add_interface_mapping,
+ gfc_finish_interface_mapping,
+ gfc_apply_interface_mapping_to_expr): Likewise.
+ * trans.h (gfc_interface_sym_mapping): Likewise.
+
+2008-07-19 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * gfortran.h (operator): Remove macro.
+ (gfc_namespace, gfc_expr): Avoid C++ keywords.
+ * arith.c (eval_intrinsic, eval_intrinsic_f2, eval_intrinsic_f3):
+ Likewise.
+ * decl.c (access_attr_decl): Likewise.
+ * dependency.c (gfc_dep_compare_expr): Likewise.
+ * dump-parse-tree.c (show_expr, show_uop, show_namespace):
+ Likewise.
+ * expr.c (gfc_copy_expr, gfc_type_convert_binary,
+ simplify_intrinsic_op, check_intrinsic_op): Likewise.
+ * interface.c (fold_unary, gfc_match_generic_spec,
+ gfc_match_interface, gfc_match_end_interface,
+ check_operator_interface, check_uop_interfaces,
+ gfc_check_interfaces, gfc_extend_expr, gfc_extend_assign,
+ gfc_add_interface, gfc_current_interface_head,
+ gfc_set_current_interface_head): Likewise.
+ * iresolve.c (gfc_resolve_dot_product, gfc_resolve_matmul):
+ Likewise.
+ * matchexp.c (gfc_get_parentheses, build_node): Likewise.
+ * module.c (gfc_use_rename, gfc_match_use, find_use_name_n,
+ number_use_names, mio_expr, load_operator_interfaces, read_module,
+ write_operator, write_module): Likewise.
+ * openmp.c (resolve_omp_atomic): Likewise.
+ * resolve.c (resolve_operator, gfc_resolve_character_operator,
+ gfc_resolve_uops): Likewise.
+ * symbol.c (free_uop_tree, gfc_free_namespace): Likewise.
+ * trans-expr.c (gfc_conv_expr_op): Likewise.
+ * trans-openmp.c (gfc_trans_omp_atomic): Likewise.
+
+2008-07-19 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * gfortran.h (protected): Remove macro.
+ * dump-parse-tree.c (show_attr): Avoid C++ keywords.
+ * expr.c (gfc_check_pointer_assign): Likewise.
+ * interface.c (compare_parameter_protected): Likewise.
+ * intrinsic.c (enum class, add_sym, add_sym_0, add_sym_1,
+ add_sym_1s, add_sym_1m, add_sym_2, add_sym_2s, add_sym_3,
+ add_sym_3ml, add_sym_3red, add_sym_3s, add_sym_4, add_sym_4s,
+ add_sym_5s): Likewise.
+ * match.c (gfc_match_assignment, gfc_match_pointer_assignment):
+ Likewise.
+ * module.c (mio_symbol_attribute): Likewise.
+ * primary.c (match_variable): Likewise.
+ * resolve.c (resolve_equivalence): Likewise.
+ * symbol.c (check_conflict, gfc_add_protected, gfc_copy_attr):
+ Likewise.
+ * trans-types.c (gfc_get_array_type_bounds): Likewise.
+
+2008-07-18 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * arith.c (eval_type_intrinsic0): Avoid C++ keywords.
+ * gfortran.h (try, protected, operator, new): Likewise.
+
+2008-07-17 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/36825
+ PR fortran/36824
+ * array.c (gfc_match_array_spec): Fix array-rank check.
+ * resolve.c (resolve_fl_derived): Fix constentness check
+ for the array dimensions.
+
2008-07-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* Make-lang.in (gfortranspec.o): Fix dependencies.
diff --git a/gcc/fortran/Make-lang.in b/gcc/fortran/Make-lang.in
index b0944c94308..20ac249057d 100644
--- a/gcc/fortran/Make-lang.in
+++ b/gcc/fortran/Make-lang.in
@@ -311,9 +311,9 @@ fortran/f95-lang.o: $(GFORTRAN_TRANS_DEPS) fortran/mathbuiltins.def \
$(BUILTINS_DEF) fortran/types.def
fortran/scanner.o: toplev.h fortran/cpp.h
fortran/convert.o: $(GFORTRAN_TRANS_DEPS)
-fortran/trans.o: $(GFORTRAN_TRANS_DEPS)
+fortran/trans.o: $(GFORTRAN_TRANS_DEPS) tree-iterator.h
fortran/trans-decl.o: $(GFORTRAN_TRANS_DEPS) gt-fortran-trans-decl.h \
- $(CGRAPH_H) $(TARGET_H) $(FUNCTION_H) $(FLAGS_H) $(RTL_H) $(TREE_GIMPLE_H) \
+ $(CGRAPH_H) $(TARGET_H) $(FUNCTION_H) $(FLAGS_H) $(RTL_H) $(GIMPLE_H) \
$(TREE_DUMP_H)
fortran/trans-types.o: $(GFORTRAN_TRANS_DEPS) gt-fortran-trans-types.h \
$(REAL_H) toplev.h $(TARGET_H) $(FLAGS_H) dwarf2out.h
diff --git a/gcc/fortran/arith.c b/gcc/fortran/arith.c
index bd3214584dd..2e21b840e2a 100644
--- a/gcc/fortran/arith.c
+++ b/gcc/fortran/arith.c
@@ -1092,7 +1092,7 @@ gfc_arith_concat (gfc_expr *op1, gfc_expr *op2, gfc_expr **resultp)
}
/* Comparison between real values; returns 0 if (op1 .op. op2) is true.
- This function mimics mpr_cmp but takes NaN into account. */
+ This function mimics mpfr_cmp but takes NaN into account. */
static int
compare_real (gfc_expr *op1, gfc_expr *op2, gfc_intrinsic_op op)
@@ -1159,7 +1159,7 @@ gfc_compare_expr (gfc_expr *op1, gfc_expr *op2, gfc_intrinsic_op op)
/* Compare a pair of complex numbers. Naturally, this is only for
- equality and nonequality. */
+ equality and inequality. */
static int
compare_complex (gfc_expr *op1, gfc_expr *op2)
@@ -1552,7 +1552,7 @@ eval_f;
operands are array constructors. */
static gfc_expr *
-eval_intrinsic (gfc_intrinsic_op operator,
+eval_intrinsic (gfc_intrinsic_op op,
eval_f eval, gfc_expr *op1, gfc_expr *op2)
{
gfc_expr temp, *result;
@@ -1561,7 +1561,7 @@ eval_intrinsic (gfc_intrinsic_op operator,
gfc_clear_ts (&temp.ts);
- switch (operator)
+ switch (op)
{
/* Logical unary */
case INTRINSIC_NOT:
@@ -1650,19 +1650,19 @@ eval_intrinsic (gfc_intrinsic_op operator,
temp.expr_type = EXPR_OP;
gfc_clear_ts (&temp.ts);
- temp.value.op.operator = operator;
+ temp.value.op.op = op;
temp.value.op.op1 = op1;
temp.value.op.op2 = op2;
gfc_type_convert_binary (&temp);
- if (operator == INTRINSIC_EQ || operator == INTRINSIC_NE
- || operator == INTRINSIC_GE || operator == INTRINSIC_GT
- || operator == INTRINSIC_LE || operator == INTRINSIC_LT
- || operator == INTRINSIC_EQ_OS || operator == INTRINSIC_NE_OS
- || operator == INTRINSIC_GE_OS || operator == INTRINSIC_GT_OS
- || operator == INTRINSIC_LE_OS || operator == INTRINSIC_LT_OS)
+ if (op == INTRINSIC_EQ || op == INTRINSIC_NE
+ || op == INTRINSIC_GE || op == INTRINSIC_GT
+ || op == INTRINSIC_LE || op == INTRINSIC_LT
+ || op == INTRINSIC_EQ_OS || op == INTRINSIC_NE_OS
+ || op == INTRINSIC_GE_OS || op == INTRINSIC_GT_OS
+ || op == INTRINSIC_LE_OS || op == INTRINSIC_LT_OS)
{
temp.ts.type = BT_LOGICAL;
temp.ts.kind = gfc_default_logical_kind;
@@ -1690,7 +1690,7 @@ eval_intrinsic (gfc_intrinsic_op operator,
}
/* Try to combine the operators. */
- if (operator == INTRINSIC_POWER && op2->ts.type != BT_INTEGER)
+ if (op == INTRINSIC_POWER && op2->ts.type != BT_INTEGER)
goto runtime;
if (op1->expr_type != EXPR_CONSTANT
@@ -1725,7 +1725,7 @@ runtime:
result->ts = temp.ts;
result->expr_type = EXPR_OP;
- result->value.op.operator = operator;
+ result->value.op.op = op;
result->value.op.op1 = op1;
result->value.op.op2 = op2;
@@ -1739,12 +1739,12 @@ runtime:
/* Modify type of expression for zero size array. */
static gfc_expr *
-eval_type_intrinsic0 (gfc_intrinsic_op operator, gfc_expr *op)
+eval_type_intrinsic0 (gfc_intrinsic_op iop, gfc_expr *op)
{
if (op == NULL)
gfc_internal_error ("eval_type_intrinsic0(): op NULL");
- switch (operator)
+ switch (iop)
{
case INTRINSIC_GE:
case INTRINSIC_GE_OS:
@@ -1806,7 +1806,7 @@ reduce_binary0 (gfc_expr *op1, gfc_expr *op2)
static gfc_expr *
-eval_intrinsic_f2 (gfc_intrinsic_op operator,
+eval_intrinsic_f2 (gfc_intrinsic_op op,
arith (*eval) (gfc_expr *, gfc_expr **),
gfc_expr *op1, gfc_expr *op2)
{
@@ -1816,22 +1816,22 @@ eval_intrinsic_f2 (gfc_intrinsic_op operator,
if (op2 == NULL)
{
if (gfc_zero_size_array (op1))
- return eval_type_intrinsic0 (operator, op1);
+ return eval_type_intrinsic0 (op, op1);
}
else
{
result = reduce_binary0 (op1, op2);
if (result != NULL)
- return eval_type_intrinsic0 (operator, result);
+ return eval_type_intrinsic0 (op, result);
}
f.f2 = eval;
- return eval_intrinsic (operator, f, op1, op2);
+ return eval_intrinsic (op, f, op1, op2);
}
static gfc_expr *
-eval_intrinsic_f3 (gfc_intrinsic_op operator,
+eval_intrinsic_f3 (gfc_intrinsic_op op,
arith (*eval) (gfc_expr *, gfc_expr *, gfc_expr **),
gfc_expr *op1, gfc_expr *op2)
{
@@ -1840,10 +1840,10 @@ eval_intrinsic_f3 (gfc_intrinsic_op operator,
result = reduce_binary0 (op1, op2);
if (result != NULL)
- return eval_type_intrinsic0(operator, result);
+ return eval_type_intrinsic0(op, result);
f.f3 = eval;
- return eval_intrinsic (operator, f, op1, op2);
+ return eval_intrinsic (op, f, op1, op2);
}
@@ -2084,7 +2084,7 @@ arith_error (arith rc, gfc_typespec *from, gfc_typespec *to, locus *where)
gfc_internal_error ("gfc_arith_error(): Bad error code");
}
- /* TODO: Do something about the error, ie, throw exception, return
+ /* TODO: Do something about the error, i.e., throw exception, return
NaN, etc. */
}
diff --git a/gcc/fortran/array.c b/gcc/fortran/array.c
index c6bb5e857b9..1cafe2b8dbc 100644
--- a/gcc/fortran/array.c
+++ b/gcc/fortran/array.c
@@ -208,7 +208,7 @@ gfc_free_array_spec (gfc_array_spec *as)
/* Take an array bound, resolves the expression, that make up the
shape and check associated constraints. */
-static try
+static gfc_try
resolve_array_bound (gfc_expr *e, int check_constant)
{
if (e == NULL)
@@ -232,7 +232,7 @@ resolve_array_bound (gfc_expr *e, int check_constant)
/* Takes an array specification, resolves the expressions that make up
the shape and make sure everything is integral. */
-try
+gfc_try
gfc_resolve_array_spec (gfc_array_spec *as, int check_constant)
{
gfc_expr *e;
@@ -437,7 +437,7 @@ gfc_match_array_spec (gfc_array_spec **asp)
goto cleanup;
}
- if (as->rank > 7
+ if (as->rank >= 7
&& gfc_notify_std (GFC_STD_F2008, "Fortran 2008: Array "
"specification at %C with more than 7 dimensions")
== FAILURE)
@@ -469,7 +469,7 @@ cleanup:
have that array specification. The error locus is needed in case
something goes wrong. On failure, the caller must free the spec. */
-try
+gfc_try
gfc_set_array_spec (gfc_symbol *sym, gfc_array_spec *as, locus *error_loc)
{
if (as == NULL)
@@ -592,7 +592,7 @@ gfc_start_constructor (bt type, int kind, locus *where)
node onto the constructor. */
void
-gfc_append_constructor (gfc_expr *base, gfc_expr *new)
+gfc_append_constructor (gfc_expr *base, gfc_expr *new_expr)
{
gfc_constructor *c;
@@ -608,9 +608,9 @@ gfc_append_constructor (gfc_expr *base, gfc_expr *new)
c = c->next;
}
- c->expr = new;
+ c->expr = new_expr;
- if (new->ts.type != base->ts.type || new->ts.kind != base->ts.kind)
+ if (new_expr->ts.type != base->ts.type || new_expr->ts.kind != base->ts.kind)
gfc_internal_error ("gfc_append_constructor(): New node has wrong kind");
}
@@ -755,7 +755,7 @@ static match match_array_cons_element (gfc_constructor **);
static match
match_array_list (gfc_constructor **result)
{
- gfc_constructor *p, *head, *tail, *new;
+ gfc_constructor *p, *head, *tail, *new_cons;
gfc_iterator iter;
locus old_loc;
gfc_expr *e;
@@ -790,7 +790,7 @@ match_array_list (gfc_constructor **result)
if (m == MATCH_ERROR)
goto cleanup;
- m = match_array_cons_element (&new);
+ m = match_array_cons_element (&new_cons);
if (m == MATCH_ERROR)
goto cleanup;
if (m == MATCH_NO)
@@ -801,8 +801,8 @@ match_array_list (gfc_constructor **result)
goto cleanup; /* Could be a complex constant */
}
- tail->next = new;
- tail = new;
+ tail->next = new_cons;
+ tail = new_cons;
if (gfc_match_char (',') != MATCH_YES)
{
@@ -881,7 +881,7 @@ match_array_cons_element (gfc_constructor **result)
match
gfc_match_array_constructor (gfc_expr **result)
{
- gfc_constructor *head, *tail, *new;
+ gfc_constructor *head, *tail, *new_cons;
gfc_expr *expr;
gfc_typespec ts;
locus where;
@@ -937,18 +937,18 @@ gfc_match_array_constructor (gfc_expr **result)
for (;;)
{
- m = match_array_cons_element (&new);
+ m = match_array_cons_element (&new_cons);
if (m == MATCH_ERROR)
goto cleanup;
if (m == MATCH_NO)
goto syntax;
if (head == NULL)
- head = new;
+ head = new_cons;
else
- tail->next = new;
+ tail->next = new_cons;
- tail = new;
+ tail = new_cons;
if (gfc_match_char (',') == MATCH_NO)
break;
@@ -1038,7 +1038,7 @@ check_element_type (gfc_expr *expr, bool convert)
/* Recursive work function for gfc_check_constructor_type(). */
-static try
+static gfc_try
check_constructor_type (gfc_constructor *c, bool convert)
{
gfc_expr *e;
@@ -1066,10 +1066,10 @@ check_constructor_type (gfc_constructor *c, bool convert)
/* Check that all elements of an array constructor are the same type.
On FAILURE, an error has been generated. */
-try
+gfc_try
gfc_check_constructor_type (gfc_expr *e)
{
- try t;
+ gfc_try t;
if (e->ts.type != BT_UNKNOWN)
{
@@ -1102,12 +1102,12 @@ cons_stack;
static cons_stack *base;
-static try check_constructor (gfc_constructor *, try (*) (gfc_expr *));
+static gfc_try check_constructor (gfc_constructor *, gfc_try (*) (gfc_expr *));
/* Check an EXPR_VARIABLE expression in a constructor to make sure
that that variable is an iteration variables. */
-try
+gfc_try
gfc_check_iter_variable (gfc_expr *expr)
{
gfc_symbol *sym;
@@ -1127,12 +1127,12 @@ gfc_check_iter_variable (gfc_expr *expr)
to calling the check function for each expression in the
constructor, giving variables with the names of iterators a pass. */
-static try
-check_constructor (gfc_constructor *c, try (*check_function) (gfc_expr *))
+static gfc_try
+check_constructor (gfc_constructor *c, gfc_try (*check_function) (gfc_expr *))
{
cons_stack element;
gfc_expr *e;
- try t;
+ gfc_try t;
for (; c; c = c->next)
{
@@ -1165,11 +1165,11 @@ check_constructor (gfc_constructor *c, try (*check_function) (gfc_expr *))
expression -- specification, restricted, or initialization as
determined by the check_function. */
-try
-gfc_check_constructor (gfc_expr *expr, try (*check_function) (gfc_expr *))
+gfc_try
+gfc_check_constructor (gfc_expr *expr, gfc_try (*check_function) (gfc_expr *))
{
cons_stack *base_save;
- try t;
+ gfc_try t;
base_save = base;
base = NULL;
@@ -1197,19 +1197,19 @@ typedef struct
gfc_component *component;
mpz_t *repeat;
- try (*expand_work_function) (gfc_expr *);
+ gfc_try (*expand_work_function) (gfc_expr *);
}
expand_info;
static expand_info current_expand;
-static try expand_constructor (gfc_constructor *);
+static gfc_try expand_constructor (gfc_constructor *);
/* Work function that counts the number of elements present in a
constructor. */
-static try
+static gfc_try
count_elements (gfc_expr *e)
{
mpz_t result;
@@ -1236,7 +1236,7 @@ count_elements (gfc_expr *e)
/* Work function that extracts a particular element from an array
constructor, freeing the rest. */
-static try
+static gfc_try
extract_element (gfc_expr *e)
{
@@ -1259,7 +1259,7 @@ extract_element (gfc_expr *e)
/* Work function that constructs a new constructor out of the old one,
stringing new elements together. */
-static try
+static gfc_try
expand (gfc_expr *e)
{
if (current_expand.new_head == NULL)
@@ -1307,7 +1307,7 @@ gfc_simplify_iterator_var (gfc_expr *e)
/* Expand an expression with that is inside of a constructor,
recursing into other constructors if present. */
-static try
+static gfc_try
expand_expr (gfc_expr *e)
{
if (e->expr_type == EXPR_ARRAY)
@@ -1325,13 +1325,13 @@ expand_expr (gfc_expr *e)
}
-static try
+static gfc_try
expand_iterator (gfc_constructor *c)
{
gfc_expr *start, *end, *step;
iterator_stack frame;
mpz_t trip;
- try t;
+ gfc_try t;
end = step = NULL;
@@ -1409,7 +1409,7 @@ cleanup:
expressions. The work function needs to either save or free the
passed expression. */
-static try
+static gfc_try
expand_constructor (gfc_constructor *c)
{
gfc_expr *e;
@@ -1452,12 +1452,12 @@ expand_constructor (gfc_constructor *c)
/* Top level subroutine for expanding constructors. We only expand
constructor if they are small enough. */
-try
+gfc_try
gfc_expand_constructor (gfc_expr *e)
{
expand_info expand_save;
gfc_expr *f;
- try rc;
+ gfc_try rc;
f = gfc_get_array_element (e, GFC_MAX_AC_EXPAND);
if (f != NULL)
@@ -1496,7 +1496,7 @@ done:
constant, after removal of any iteration variables. We return
FAILURE if not so. */
-static try
+static gfc_try
constant_element (gfc_expr *e)
{
int rv;
@@ -1518,7 +1518,7 @@ int
gfc_constant_ac (gfc_expr *e)
{
expand_info expand_save;
- try rc;
+ gfc_try rc;
iter_stack = NULL;
expand_save = current_expand;
@@ -1556,10 +1556,10 @@ gfc_expanded_ac (gfc_expr *e)
/* Recursive array list resolution function. All of the elements must
be of the same type. */
-static try
+static gfc_try
resolve_array_list (gfc_constructor *p)
{
- try t;
+ gfc_try t;
t = SUCCESS;
@@ -1577,11 +1577,11 @@ resolve_array_list (gfc_constructor *p)
}
/* Resolve character array constructor. If it has a specified constant character
- length, pad/trunkate the elements here; if the length is not specified and
+ length, pad/truncate the elements here; if the length is not specified and
all elements are of compile-time known length, emit an error as this is
invalid. */
-try
+gfc_try
gfc_resolve_character_array_constructor (gfc_expr *expr)
{
gfc_constructor *p;
@@ -1675,7 +1675,7 @@ got_charlen:
max_length only if they pass. */
gfc_extract_int (expr->ts.cl->length, &found_length);
- /* Now pad/trunkate the elements accordingly to the specified character
+ /* Now pad/truncate the elements accordingly to the specified character
length. This is ok inside this conditional, as in the case above
(without typespec) all elements are verified to have the same length
anyway. */
@@ -1711,10 +1711,10 @@ got_charlen:
/* Resolve all of the expressions in an array list. */
-try
+gfc_try
gfc_resolve_array_constructor (gfc_expr *expr)
{
- try t;
+ gfc_try t;
t = resolve_array_list (expr->value.constructor);
if (t == SUCCESS)
@@ -1795,7 +1795,7 @@ gfc_get_array_element (gfc_expr *array, int element)
{
expand_info expand_save;
gfc_expr *e;
- try rc;
+ gfc_try rc;
expand_save = current_expand;
current_expand.extract_n = element;
@@ -1826,7 +1826,7 @@ gfc_get_array_element (gfc_expr *array, int element)
/* Get the size of single dimension of an array specification. The
array is guaranteed to be one dimensional. */
-try
+gfc_try
spec_dimen_size (gfc_array_spec *as, int dimen, mpz_t *result)
{
if (as == NULL)
@@ -1853,7 +1853,7 @@ spec_dimen_size (gfc_array_spec *as, int dimen, mpz_t *result)
}
-try
+gfc_try
spec_size (gfc_array_spec *as, mpz_t *result)
{
mpz_t size;
@@ -1879,11 +1879,11 @@ spec_size (gfc_array_spec *as, mpz_t *result)
/* Get the number of elements in an array section. */
-static try
+static gfc_try
ref_dimen_size (gfc_array_ref *ar, int dimen, mpz_t *result)
{
mpz_t upper, lower, stride;
- try t;
+ gfc_try t;
if (dimen < 0 || ar == NULL || dimen > ar->dimen - 1)
gfc_internal_error ("ref_dimen_size(): Bad dimension");
@@ -1967,7 +1967,7 @@ ref_dimen_size (gfc_array_ref *ar, int dimen, mpz_t *result)
}
-static try
+static gfc_try
ref_size (gfc_array_ref *ar, mpz_t *result)
{
mpz_t size;
@@ -1996,7 +1996,7 @@ ref_size (gfc_array_ref *ar, mpz_t *result)
able to return a result in the 'result' variable, FAILURE
otherwise. */
-try
+gfc_try
gfc_array_dimen_size (gfc_expr *array, int dimen, mpz_t *result)
{
gfc_ref *ref;
@@ -2064,13 +2064,13 @@ gfc_array_dimen_size (gfc_expr *array, int dimen, mpz_t *result)
array. Returns SUCCESS if this is possible, and sets the 'result'
variable. Otherwise returns FAILURE. */
-try
+gfc_try
gfc_array_size (gfc_expr *array, mpz_t *result)
{
expand_info expand_save;
gfc_ref *ref;
int i, flag;
- try t;
+ gfc_try t;
switch (array->expr_type)
{
@@ -2129,7 +2129,7 @@ gfc_array_size (gfc_expr *array, mpz_t *result)
/* Given an array reference, return the shape of the reference in an
array of mpz_t integers. */
-try
+gfc_try
gfc_array_ref_shape (gfc_array_ref *ar, mpz_t *shape)
{
int d;
diff --git a/gcc/fortran/bbt.c b/gcc/fortran/bbt.c
index e89eb57fd8d..fa60e4fee22 100644
--- a/gcc/fortran/bbt.c
+++ b/gcc/fortran/bbt.c
@@ -93,24 +93,24 @@ rotate_right (gfc_bbt *t)
aborts if we find a duplicate key. */
static gfc_bbt *
-insert (gfc_bbt *new, gfc_bbt *t, compare_fn compare)
+insert (gfc_bbt *new_bbt, gfc_bbt *t, compare_fn compare)
{
int c;
if (t == NULL)
- return new;
+ return new_bbt;
- c = (*compare) (new, t);
+ c = (*compare) (new_bbt, t);
if (c < 0)
{
- t->left = insert (new, t->left, compare);
+ t->left = insert (new_bbt, t->left, compare);
if (t->priority < t->left->priority)
t = rotate_right (t);
}
else if (c > 0)
{
- t->right = insert (new, t->right, compare);
+ t->right = insert (new_bbt, t->right, compare);
if (t->priority < t->right->priority)
t = rotate_left (t);
}
@@ -126,12 +126,12 @@ insert (gfc_bbt *new, gfc_bbt *t, compare_fn compare)
already exists. */
void
-gfc_insert_bbt (void *root, void *new, compare_fn compare)
+gfc_insert_bbt (void *root, void *new_node, compare_fn compare)
{
gfc_bbt **r, *n;
r = (gfc_bbt **) root;
- n = (gfc_bbt *) new;
+ n = (gfc_bbt *) new_node;
n->priority = pseudo_random ();
*r = insert (n, *r, compare);
}
diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c
index c0f9891bd98..1f9ce2fff6a 100644
--- a/gcc/fortran/check.c
+++ b/gcc/fortran/check.c
@@ -35,7 +35,7 @@ along with GCC; see the file COPYING3. If not see
/* Make sure an expression is a scalar. */
-static try
+static gfc_try
scalar_check (gfc_expr *e, int n)
{
if (e->rank == 0)
@@ -50,7 +50,7 @@ scalar_check (gfc_expr *e, int n)
/* Check the type of an expression. */
-static try
+static gfc_try
type_check (gfc_expr *e, int n, bt type)
{
if (e->ts.type == type)
@@ -66,7 +66,7 @@ type_check (gfc_expr *e, int n, bt type)
/* Check that the expression is a numeric type. */
-static try
+static gfc_try
numeric_check (gfc_expr *e, int n)
{
if (gfc_numeric_ts (&e->ts))
@@ -93,7 +93,7 @@ numeric_check (gfc_expr *e, int n)
/* Check that an expression is integer or real. */
-static try
+static gfc_try
int_or_real_check (gfc_expr *e, int n)
{
if (e->ts.type != BT_INTEGER && e->ts.type != BT_REAL)
@@ -110,7 +110,7 @@ int_or_real_check (gfc_expr *e, int n)
/* Check that an expression is real or complex. */
-static try
+static gfc_try
real_or_complex_check (gfc_expr *e, int n)
{
if (e->ts.type != BT_REAL && e->ts.type != BT_COMPLEX)
@@ -128,7 +128,7 @@ real_or_complex_check (gfc_expr *e, int n)
/* Check that the expression is an optional constant integer
and that it specifies a valid kind for that type. */
-static try
+static gfc_try
kind_check (gfc_expr *k, int n, bt type)
{
int kind;
@@ -164,7 +164,7 @@ kind_check (gfc_expr *k, int n, bt type)
/* Make sure the expression is a double precision real. */
-static try
+static gfc_try
double_check (gfc_expr *d, int n)
{
if (type_check (d, n, BT_REAL) == FAILURE)
@@ -184,7 +184,7 @@ double_check (gfc_expr *d, int n)
/* Make sure the expression is a logical array. */
-static try
+static gfc_try
logical_array_check (gfc_expr *array, int n)
{
if (array->ts.type != BT_LOGICAL || array->rank == 0)
@@ -201,7 +201,7 @@ logical_array_check (gfc_expr *array, int n)
/* Make sure an expression is an array. */
-static try
+static gfc_try
array_check (gfc_expr *e, int n)
{
if (e->rank != 0)
@@ -216,7 +216,7 @@ array_check (gfc_expr *e, int n)
/* Make sure two expressions have the same type. */
-static try
+static gfc_try
same_type_check (gfc_expr *e, int n, gfc_expr *f, int m)
{
if (gfc_compare_types (&e->ts, &f->ts))
@@ -232,7 +232,7 @@ same_type_check (gfc_expr *e, int n, gfc_expr *f, int m)
/* Make sure that an expression has a certain (nonzero) rank. */
-static try
+static gfc_try
rank_check (gfc_expr *e, int n, int rank)
{
if (e->rank == rank)
@@ -248,7 +248,7 @@ rank_check (gfc_expr *e, int n, int rank)
/* Make sure a variable expression is not an optional dummy argument. */
-static try
+static gfc_try
nonoptional_check (gfc_expr *e, int n)
{
if (e->expr_type == EXPR_VARIABLE && e->symtree->n.sym->attr.optional)
@@ -266,7 +266,7 @@ nonoptional_check (gfc_expr *e, int n)
/* Check that an expression has a particular kind. */
-static try
+static gfc_try
kind_value_check (gfc_expr *e, int n, int k)
{
if (e->ts.kind == k)
@@ -282,7 +282,7 @@ kind_value_check (gfc_expr *e, int n, int k)
/* Make sure an expression is a variable. */
-static try
+static gfc_try
variable_check (gfc_expr *e, int n)
{
if ((e->expr_type == EXPR_VARIABLE
@@ -309,7 +309,7 @@ variable_check (gfc_expr *e, int n)
/* Check the common DIM parameter for correctness. */
-static try
+static gfc_try
dim_check (gfc_expr *dim, int n, bool optional)
{
if (dim == NULL)
@@ -333,7 +333,7 @@ dim_check (gfc_expr *dim, int n, bool optional)
allow_assumed is zero then dim must be less than the rank of the array
for assumed size arrays. */
-static try
+static gfc_try
dim_rank_check (gfc_expr *dim, gfc_expr *array, int allow_assumed)
{
gfc_array_ref *ar;
@@ -396,7 +396,7 @@ identical_dimen_shape (gfc_expr *a, int ai, gfc_expr *b, int bi)
/* Check whether two character expressions have the same length;
returns SUCCESS if they have or if the length cannot be determined. */
-static try
+static gfc_try
check_same_strlen (const gfc_expr *a, const gfc_expr *b, const char *name)
{
long len_a, len_b;
@@ -434,7 +434,7 @@ check_same_strlen (const gfc_expr *a, const gfc_expr *b, const char *name)
/* Check subroutine suitable for intrinsics taking a real argument and
a kind argument for the result. */
-static try
+static gfc_try
check_a_kind (gfc_expr *a, gfc_expr *kind, bt type)
{
if (type_check (a, 0, BT_REAL) == FAILURE)
@@ -448,7 +448,7 @@ check_a_kind (gfc_expr *a, gfc_expr *kind, bt type)
/* Check subroutine suitable for ceiling, floor and nint. */
-try
+gfc_try
gfc_check_a_ikind (gfc_expr *a, gfc_expr *kind)
{
return check_a_kind (a, kind, BT_INTEGER);
@@ -457,14 +457,14 @@ gfc_check_a_ikind (gfc_expr *a, gfc_expr *kind)
/* Check subroutine suitable for aint, anint. */
-try
+gfc_try
gfc_check_a_xkind (gfc_expr *a, gfc_expr *kind)
{
return check_a_kind (a, kind, BT_REAL);
}
-try
+gfc_try
gfc_check_abs (gfc_expr *a)
{
if (numeric_check (a, 0) == FAILURE)
@@ -474,7 +474,7 @@ gfc_check_abs (gfc_expr *a)
}
-try
+gfc_try
gfc_check_achar (gfc_expr *a, gfc_expr *kind)
{
if (type_check (a, 0, BT_INTEGER) == FAILURE)
@@ -486,7 +486,7 @@ gfc_check_achar (gfc_expr *a, gfc_expr *kind)
}
-try
+gfc_try
gfc_check_access_func (gfc_expr *name, gfc_expr *mode)
{
if (type_check (name, 0, BT_CHARACTER) == FAILURE
@@ -505,7 +505,7 @@ gfc_check_access_func (gfc_expr *name, gfc_expr *mode)
}
-try
+gfc_try
gfc_check_all_any (gfc_expr *mask, gfc_expr *dim)
{
if (logical_array_check (mask, 0) == FAILURE)
@@ -518,7 +518,7 @@ gfc_check_all_any (gfc_expr *mask, gfc_expr *dim)
}
-try
+gfc_try
gfc_check_allocated (gfc_expr *array)
{
symbol_attribute attr;
@@ -545,7 +545,7 @@ gfc_check_allocated (gfc_expr *array)
/* Common check function where the first argument must be real or
integer and the second argument must be the same as the first. */
-try
+gfc_try
gfc_check_a_p (gfc_expr *a, gfc_expr *p)
{
if (int_or_real_check (a, 0) == FAILURE)
@@ -571,7 +571,7 @@ gfc_check_a_p (gfc_expr *a, gfc_expr *p)
}
-try
+gfc_try
gfc_check_x_yd (gfc_expr *x, gfc_expr *y)
{
if (double_check (x, 0) == FAILURE || double_check (y, 1) == FAILURE)
@@ -581,12 +581,12 @@ gfc_check_x_yd (gfc_expr *x, gfc_expr *y)
}
-try
+gfc_try
gfc_check_associated (gfc_expr *pointer, gfc_expr *target)
{
symbol_attribute attr1, attr2;
int i;
- try t;
+ gfc_try t;
locus *where;
where = &pointer->where;
@@ -664,7 +664,7 @@ null_arg:
}
-try
+gfc_try
gfc_check_atan2 (gfc_expr *y, gfc_expr *x)
{
if (type_check (y, 0, BT_REAL) == FAILURE)
@@ -678,7 +678,7 @@ gfc_check_atan2 (gfc_expr *y, gfc_expr *x)
/* BESJN and BESYN functions. */
-try
+gfc_try
gfc_check_besn (gfc_expr *n, gfc_expr *x)
{
if (type_check (n, 0, BT_INTEGER) == FAILURE)
@@ -691,7 +691,7 @@ gfc_check_besn (gfc_expr *n, gfc_expr *x)
}
-try
+gfc_try
gfc_check_btest (gfc_expr *i, gfc_expr *pos)
{
if (type_check (i, 0, BT_INTEGER) == FAILURE)
@@ -703,7 +703,7 @@ gfc_check_btest (gfc_expr *i, gfc_expr *pos)
}
-try
+gfc_try
gfc_check_char (gfc_expr *i, gfc_expr *kind)
{
if (type_check (i, 0, BT_INTEGER) == FAILURE)
@@ -715,7 +715,7 @@ gfc_check_char (gfc_expr *i, gfc_expr *kind)
}
-try
+gfc_try
gfc_check_chdir (gfc_expr *dir)
{
if (type_check (dir, 0, BT_CHARACTER) == FAILURE)
@@ -727,7 +727,7 @@ gfc_check_chdir (gfc_expr *dir)
}
-try
+gfc_try
gfc_check_chdir_sub (gfc_expr *dir, gfc_expr *status)
{
if (type_check (dir, 0, BT_CHARACTER) == FAILURE)
@@ -747,7 +747,7 @@ gfc_check_chdir_sub (gfc_expr *dir, gfc_expr *status)
}
-try
+gfc_try
gfc_check_chmod (gfc_expr *name, gfc_expr *mode)
{
if (type_check (name, 0, BT_CHARACTER) == FAILURE)
@@ -764,7 +764,7 @@ gfc_check_chmod (gfc_expr *name, gfc_expr *mode)
}
-try
+gfc_try
gfc_check_chmod_sub (gfc_expr *name, gfc_expr *mode, gfc_expr *status)
{
if (type_check (name, 0, BT_CHARACTER) == FAILURE)
@@ -790,7 +790,7 @@ gfc_check_chmod_sub (gfc_expr *name, gfc_expr *mode, gfc_expr *status)
}
-try
+gfc_try
gfc_check_cmplx (gfc_expr *x, gfc_expr *y, gfc_expr *kind)
{
if (numeric_check (x, 0) == FAILURE)
@@ -817,7 +817,7 @@ gfc_check_cmplx (gfc_expr *x, gfc_expr *y, gfc_expr *kind)
}
-try
+gfc_try
gfc_check_complex (gfc_expr *x, gfc_expr *y)
{
if (x->ts.type != BT_INTEGER && x->ts.type != BT_REAL)
@@ -844,7 +844,7 @@ gfc_check_complex (gfc_expr *x, gfc_expr *y)
}
-try
+gfc_try
gfc_check_count (gfc_expr *mask, gfc_expr *dim, gfc_expr *kind)
{
if (logical_array_check (mask, 0) == FAILURE)
@@ -862,7 +862,7 @@ gfc_check_count (gfc_expr *mask, gfc_expr *dim, gfc_expr *kind)
}
-try
+gfc_try
gfc_check_cshift (gfc_expr *array, gfc_expr *shift, gfc_expr *dim)
{
if (array_check (array, 0) == FAILURE)
@@ -876,11 +876,16 @@ gfc_check_cshift (gfc_expr *array, gfc_expr *shift, gfc_expr *dim)
if (scalar_check (shift, 1) == FAILURE)
return FAILURE;
}
- else
+ else if (shift->rank != array->rank - 1 && shift->rank != 0)
{
- /* TODO: more requirements on shift parameter. */
+ gfc_error ("SHIFT argument at %L of CSHIFT must have rank %d or be a "
+ "scalar", &shift->where, array->rank - 1);
+ return FAILURE;
}
+ /* TODO: Add shape conformance check between array (w/o dimension dim)
+ and shift. */
+
if (dim_check (dim, 2, true) == FAILURE)
return FAILURE;
@@ -888,7 +893,7 @@ gfc_check_cshift (gfc_expr *array, gfc_expr *shift, gfc_expr *dim)
}
-try
+gfc_try
gfc_check_ctime (gfc_expr *time)
{
if (scalar_check (time, 0) == FAILURE)
@@ -901,7 +906,7 @@ gfc_check_ctime (gfc_expr *time)
}
-try gfc_check_datan2 (gfc_expr *y, gfc_expr *x)
+gfc_try gfc_check_datan2 (gfc_expr *y, gfc_expr *x)
{
if (double_check (y, 0) == FAILURE || double_check (x, 1) == FAILURE)
return FAILURE;
@@ -909,7 +914,7 @@ try gfc_check_datan2 (gfc_expr *y, gfc_expr *x)
return SUCCESS;
}
-try
+gfc_try
gfc_check_dcmplx (gfc_expr *x, gfc_expr *y)
{
if (numeric_check (x, 0) == FAILURE)
@@ -933,7 +938,7 @@ gfc_check_dcmplx (gfc_expr *x, gfc_expr *y)
}
-try
+gfc_try
gfc_check_dble (gfc_expr *x)
{
if (numeric_check (x, 0) == FAILURE)
@@ -943,7 +948,7 @@ gfc_check_dble (gfc_expr *x)
}
-try
+gfc_try
gfc_check_digits (gfc_expr *x)
{
if (int_or_real_check (x, 0) == FAILURE)
@@ -953,7 +958,7 @@ gfc_check_digits (gfc_expr *x)
}
-try
+gfc_try
gfc_check_dot_product (gfc_expr *vector_a, gfc_expr *vector_b)
{
switch (vector_a->ts.type)
@@ -995,7 +1000,7 @@ gfc_check_dot_product (gfc_expr *vector_a, gfc_expr *vector_b)
}
-try
+gfc_try
gfc_check_dprod (gfc_expr *x, gfc_expr *y)
{
if (type_check (x, 0, BT_REAL) == FAILURE
@@ -1022,7 +1027,7 @@ gfc_check_dprod (gfc_expr *x, gfc_expr *y)
}
-try
+gfc_try
gfc_check_eoshift (gfc_expr *array, gfc_expr *shift, gfc_expr *boundary,
gfc_expr *dim)
{
@@ -1037,17 +1042,45 @@ gfc_check_eoshift (gfc_expr *array, gfc_expr *shift, gfc_expr *boundary,
if (scalar_check (shift, 2) == FAILURE)
return FAILURE;
}
- else
+ else if (shift->rank != array->rank - 1 && shift->rank != 0)
{
- /* TODO: more weird restrictions on shift. */
+ gfc_error ("SHIFT argument at %L of EOSHIFT must have rank %d or be a "
+ "scalar", &shift->where, array->rank - 1);
+ return FAILURE;
}
+ /* TODO: Add shape conformance check between array (w/o dimension dim)
+ and shift. */
+
if (boundary != NULL)
{
if (same_type_check (array, 0, boundary, 2) == FAILURE)
return FAILURE;
- /* TODO: more restrictions on boundary. */
+ if (array->rank == 1)
+ {
+ if (scalar_check (boundary, 2) == FAILURE)
+ return FAILURE;
+ }
+ else if (boundary->rank != array->rank - 1 && boundary->rank != 0)
+ {
+ gfc_error ("BOUNDARY argument at %L of EOSHIFT must have rank %d or be "
+ "a scalar", &boundary->where, array->rank - 1);
+ return FAILURE;
+ }
+
+ if (shift->rank == boundary->rank)
+ {
+ int i;
+ for (i = 0; i < shift->rank; i++)
+ if (! identical_dimen_shape (shift, i, boundary, i))
+ {
+ gfc_error ("Different shape in dimension %d for SHIFT and "
+ "BOUNDARY arguments of EOSHIFT at %L", shift->rank,
+ &boundary->where);
+ return FAILURE;
+ }
+ }
}
if (dim_check (dim, 4, true) == FAILURE)
@@ -1059,7 +1092,7 @@ gfc_check_eoshift (gfc_expr *array, gfc_expr *shift, gfc_expr *boundary,
/* A single complex argument. */
-try
+gfc_try
gfc_check_fn_c (gfc_expr *a)
{
if (type_check (a, 0, BT_COMPLEX) == FAILURE)
@@ -1071,7 +1104,7 @@ gfc_check_fn_c (gfc_expr *a)
/* A single real argument. */
-try
+gfc_try
gfc_check_fn_r (gfc_expr *a)
{
if (type_check (a, 0, BT_REAL) == FAILURE)
@@ -1082,7 +1115,7 @@ gfc_check_fn_r (gfc_expr *a)
/* A single double argument. */
-try
+gfc_try
gfc_check_fn_d (gfc_expr *a)
{
if (double_check (a, 0) == FAILURE)
@@ -1093,7 +1126,7 @@ gfc_check_fn_d (gfc_expr *a)
/* A single real or complex argument. */
-try
+gfc_try
gfc_check_fn_rc (gfc_expr *a)
{
if (real_or_complex_check (a, 0) == FAILURE)
@@ -1103,7 +1136,7 @@ gfc_check_fn_rc (gfc_expr *a)
}
-try
+gfc_try
gfc_check_fnum (gfc_expr *unit)
{
if (type_check (unit, 0, BT_INTEGER) == FAILURE)
@@ -1116,7 +1149,7 @@ gfc_check_fnum (gfc_expr *unit)
}
-try
+gfc_try
gfc_check_huge (gfc_expr *x)
{
if (int_or_real_check (x, 0) == FAILURE)
@@ -1126,7 +1159,7 @@ gfc_check_huge (gfc_expr *x)
}
-try
+gfc_try
gfc_check_hypot (gfc_expr *x, gfc_expr *y)
{
if (type_check (x, 0, BT_REAL) == FAILURE)
@@ -1140,7 +1173,7 @@ gfc_check_hypot (gfc_expr *x, gfc_expr *y)
/* Check that the single argument is an integer. */
-try
+gfc_try
gfc_check_i (gfc_expr *i)
{
if (type_check (i, 0, BT_INTEGER) == FAILURE)
@@ -1150,7 +1183,7 @@ gfc_check_i (gfc_expr *i)
}
-try
+gfc_try
gfc_check_iand (gfc_expr *i, gfc_expr *j)
{
if (type_check (i, 0, BT_INTEGER) == FAILURE)
@@ -1170,7 +1203,7 @@ gfc_check_iand (gfc_expr *i, gfc_expr *j)
}
-try
+gfc_try
gfc_check_ibclr (gfc_expr *i, gfc_expr *pos)
{
if (type_check (i, 0, BT_INTEGER) == FAILURE)
@@ -1183,7 +1216,7 @@ gfc_check_ibclr (gfc_expr *i, gfc_expr *pos)
}
-try
+gfc_try
gfc_check_ibits (gfc_expr *i, gfc_expr *pos, gfc_expr *len)
{
if (type_check (i, 0, BT_INTEGER) == FAILURE)
@@ -1199,7 +1232,7 @@ gfc_check_ibits (gfc_expr *i, gfc_expr *pos, gfc_expr *len)
}
-try
+gfc_try
gfc_check_ibset (gfc_expr *i, gfc_expr *pos)
{
if (type_check (i, 0, BT_INTEGER) == FAILURE)
@@ -1212,7 +1245,7 @@ gfc_check_ibset (gfc_expr *i, gfc_expr *pos)
}
-try
+gfc_try
gfc_check_ichar_iachar (gfc_expr *c, gfc_expr *kind)
{
int i;
@@ -1283,7 +1316,7 @@ gfc_check_ichar_iachar (gfc_expr *c, gfc_expr *kind)
}
-try
+gfc_try
gfc_check_idnint (gfc_expr *a)
{
if (double_check (a, 0) == FAILURE)
@@ -1293,7 +1326,7 @@ gfc_check_idnint (gfc_expr *a)
}
-try
+gfc_try
gfc_check_ieor (gfc_expr *i, gfc_expr *j)
{
if (type_check (i, 0, BT_INTEGER) == FAILURE)
@@ -1313,7 +1346,7 @@ gfc_check_ieor (gfc_expr *i, gfc_expr *j)
}
-try
+gfc_try
gfc_check_index (gfc_expr *string, gfc_expr *substring, gfc_expr *back,
gfc_expr *kind)
{
@@ -1344,7 +1377,7 @@ gfc_check_index (gfc_expr *string, gfc_expr *substring, gfc_expr *back,
}
-try
+gfc_try
gfc_check_int (gfc_expr *x, gfc_expr *kind)
{
if (numeric_check (x, 0) == FAILURE)
@@ -1357,7 +1390,7 @@ gfc_check_int (gfc_expr *x, gfc_expr *kind)
}
-try
+gfc_try
gfc_check_intconv (gfc_expr *x)
{
if (numeric_check (x, 0) == FAILURE)
@@ -1367,7 +1400,7 @@ gfc_check_intconv (gfc_expr *x)
}
-try
+gfc_try
gfc_check_ior (gfc_expr *i, gfc_expr *j)
{
if (type_check (i, 0, BT_INTEGER) == FAILURE)
@@ -1387,7 +1420,7 @@ gfc_check_ior (gfc_expr *i, gfc_expr *j)
}
-try
+gfc_try
gfc_check_ishft (gfc_expr *i, gfc_expr *shift)
{
if (type_check (i, 0, BT_INTEGER) == FAILURE
@@ -1398,7 +1431,7 @@ gfc_check_ishft (gfc_expr *i, gfc_expr *shift)
}
-try
+gfc_try
gfc_check_ishftc (gfc_expr *i, gfc_expr *shift, gfc_expr *size)
{
if (type_check (i, 0, BT_INTEGER) == FAILURE
@@ -1412,7 +1445,7 @@ gfc_check_ishftc (gfc_expr *i, gfc_expr *shift, gfc_expr *size)
}
-try
+gfc_try
gfc_check_kill (gfc_expr *pid, gfc_expr *sig)
{
if (type_check (pid, 0, BT_INTEGER) == FAILURE)
@@ -1425,7 +1458,7 @@ gfc_check_kill (gfc_expr *pid, gfc_expr *sig)
}
-try
+gfc_try
gfc_check_kill_sub (gfc_expr *pid, gfc_expr *sig, gfc_expr *status)
{
if (type_check (pid, 0, BT_INTEGER) == FAILURE)
@@ -1453,7 +1486,7 @@ gfc_check_kill_sub (gfc_expr *pid, gfc_expr *sig, gfc_expr *status)
}
-try
+gfc_try
gfc_check_kind (gfc_expr *x)
{
if (x->ts.type == BT_DERIVED)
@@ -1468,7 +1501,7 @@ gfc_check_kind (gfc_expr *x)
}
-try
+gfc_try
gfc_check_lbound (gfc_expr *array, gfc_expr *dim, gfc_expr *kind)
{
if (array_check (array, 0) == FAILURE)
@@ -1494,7 +1527,7 @@ gfc_check_lbound (gfc_expr *array, gfc_expr *dim, gfc_expr *kind)
}
-try
+gfc_try
gfc_check_len_lentrim (gfc_expr *s, gfc_expr *kind)
{
if (type_check (s, 0, BT_CHARACTER) == FAILURE)
@@ -1511,7 +1544,7 @@ gfc_check_len_lentrim (gfc_expr *s, gfc_expr *kind)
}
-try
+gfc_try
gfc_check_lge_lgt_lle_llt (gfc_expr *a, gfc_expr *b)
{
if (type_check (a, 0, BT_CHARACTER) == FAILURE)
@@ -1528,7 +1561,7 @@ gfc_check_lge_lgt_lle_llt (gfc_expr *a, gfc_expr *b)
}
-try
+gfc_try
gfc_check_link (gfc_expr *path1, gfc_expr *path2)
{
if (type_check (path1, 0, BT_CHARACTER) == FAILURE)
@@ -1545,7 +1578,7 @@ gfc_check_link (gfc_expr *path1, gfc_expr *path2)
}
-try
+gfc_try
gfc_check_link_sub (gfc_expr *path1, gfc_expr *path2, gfc_expr *status)
{
if (type_check (path1, 0, BT_CHARACTER) == FAILURE)
@@ -1571,14 +1604,14 @@ gfc_check_link_sub (gfc_expr *path1, gfc_expr *path2, gfc_expr *status)
}
-try
+gfc_try
gfc_check_loc (gfc_expr *expr)
{
return variable_check (expr, 0);
}
-try
+gfc_try
gfc_check_symlnk (gfc_expr *path1, gfc_expr *path2)
{
if (type_check (path1, 0, BT_CHARACTER) == FAILURE)
@@ -1595,7 +1628,7 @@ gfc_check_symlnk (gfc_expr *path1, gfc_expr *path2)
}
-try
+gfc_try
gfc_check_symlnk_sub (gfc_expr *path1, gfc_expr *path2, gfc_expr *status)
{
if (type_check (path1, 0, BT_CHARACTER) == FAILURE)
@@ -1621,7 +1654,7 @@ gfc_check_symlnk_sub (gfc_expr *path1, gfc_expr *path2, gfc_expr *status)
}
-try
+gfc_try
gfc_check_logical (gfc_expr *a, gfc_expr *kind)
{
if (type_check (a, 0, BT_LOGICAL) == FAILURE)
@@ -1635,7 +1668,7 @@ gfc_check_logical (gfc_expr *a, gfc_expr *kind)
/* Min/max family. */
-static try
+static gfc_try
min_max_args (gfc_actual_arglist *arg)
{
if (arg == NULL || arg->next == NULL)
@@ -1649,7 +1682,7 @@ min_max_args (gfc_actual_arglist *arg)
}
-static try
+static gfc_try
check_rest (bt type, int kind, gfc_actual_arglist *arglist)
{
gfc_actual_arglist *arg, *tmp;
@@ -1694,7 +1727,7 @@ check_rest (bt type, int kind, gfc_actual_arglist *arglist)
}
-try
+gfc_try
gfc_check_min_max (gfc_actual_arglist *arg)
{
gfc_expr *x;
@@ -1722,21 +1755,21 @@ gfc_check_min_max (gfc_actual_arglist *arg)
}
-try
+gfc_try
gfc_check_min_max_integer (gfc_actual_arglist *arg)
{
return check_rest (BT_INTEGER, gfc_default_integer_kind, arg);
}
-try
+gfc_try
gfc_check_min_max_real (gfc_actual_arglist *arg)
{
return check_rest (BT_REAL, gfc_default_real_kind, arg);
}
-try
+gfc_try
gfc_check_min_max_double (gfc_actual_arglist *arg)
{
return check_rest (BT_REAL, gfc_default_double_kind, arg);
@@ -1745,7 +1778,7 @@ gfc_check_min_max_double (gfc_actual_arglist *arg)
/* End of min/max family. */
-try
+gfc_try
gfc_check_malloc (gfc_expr *size)
{
if (type_check (size, 0, BT_INTEGER) == FAILURE)
@@ -1758,7 +1791,7 @@ gfc_check_malloc (gfc_expr *size)
}
-try
+gfc_try
gfc_check_matmul (gfc_expr *matrix_a, gfc_expr *matrix_b)
{
if ((matrix_a->ts.type != BT_LOGICAL) && !gfc_numeric_ts (&matrix_b->ts))
@@ -1837,7 +1870,7 @@ gfc_check_matmul (gfc_expr *matrix_a, gfc_expr *matrix_b)
I.e. in the case of minloc(array,mask), mask will be in the second
position of the argument list and we'll have to fix that up. */
-try
+gfc_try
gfc_check_minloc_maxloc (gfc_actual_arglist *ap)
{
gfc_expr *a, *m, *d;
@@ -1896,7 +1929,7 @@ gfc_check_minloc_maxloc (gfc_actual_arglist *ap)
I.e. in the case of minval(array,mask), mask will be in the second
position of the argument list and we'll have to fix that up. */
-static try
+static gfc_try
check_reduction (gfc_actual_arglist *ap)
{
gfc_expr *a, *m, *d;
@@ -1937,7 +1970,7 @@ check_reduction (gfc_actual_arglist *ap)
}
-try
+gfc_try
gfc_check_minval_maxval (gfc_actual_arglist *ap)
{
if (int_or_real_check (ap->expr, 0) == FAILURE
@@ -1948,7 +1981,7 @@ gfc_check_minval_maxval (gfc_actual_arglist *ap)
}
-try
+gfc_try
gfc_check_product_sum (gfc_actual_arglist *ap)
{
if (numeric_check (ap->expr, 0) == FAILURE
@@ -1959,7 +1992,7 @@ gfc_check_product_sum (gfc_actual_arglist *ap)
}
-try
+gfc_try
gfc_check_merge (gfc_expr *tsource, gfc_expr *fsource, gfc_expr *mask)
{
if (same_type_check (tsource, 0, fsource, 1) == FAILURE)
@@ -1975,7 +2008,7 @@ gfc_check_merge (gfc_expr *tsource, gfc_expr *fsource, gfc_expr *mask)
}
-try
+gfc_try
gfc_check_move_alloc (gfc_expr *from, gfc_expr *to)
{
symbol_attribute attr;
@@ -2035,7 +2068,7 @@ gfc_check_move_alloc (gfc_expr *from, gfc_expr *to)
}
-try
+gfc_try
gfc_check_nearest (gfc_expr *x, gfc_expr *s)
{
if (type_check (x, 0, BT_REAL) == FAILURE)
@@ -2048,7 +2081,7 @@ gfc_check_nearest (gfc_expr *x, gfc_expr *s)
}
-try
+gfc_try
gfc_check_new_line (gfc_expr *a)
{
if (type_check (a, 0, BT_CHARACTER) == FAILURE)
@@ -2058,7 +2091,7 @@ gfc_check_new_line (gfc_expr *a)
}
-try
+gfc_try
gfc_check_null (gfc_expr *mold)
{
symbol_attribute attr;
@@ -2083,7 +2116,7 @@ gfc_check_null (gfc_expr *mold)
}
-try
+gfc_try
gfc_check_pack (gfc_expr *array, gfc_expr *mask, gfc_expr *vector)
{
char buffer[80];
@@ -2115,7 +2148,7 @@ gfc_check_pack (gfc_expr *array, gfc_expr *mask, gfc_expr *vector)
}
-try
+gfc_try
gfc_check_precision (gfc_expr *x)
{
if (x->ts.type != BT_REAL && x->ts.type != BT_COMPLEX)
@@ -2130,7 +2163,7 @@ gfc_check_precision (gfc_expr *x)
}
-try
+gfc_try
gfc_check_present (gfc_expr *a)
{
gfc_symbol *sym;
@@ -2175,7 +2208,7 @@ gfc_check_present (gfc_expr *a)
}
-try
+gfc_try
gfc_check_radix (gfc_expr *x)
{
if (int_or_real_check (x, 0) == FAILURE)
@@ -2185,7 +2218,7 @@ gfc_check_radix (gfc_expr *x)
}
-try
+gfc_try
gfc_check_range (gfc_expr *x)
{
if (numeric_check (x, 0) == FAILURE)
@@ -2196,7 +2229,7 @@ gfc_check_range (gfc_expr *x)
/* real, float, sngl. */
-try
+gfc_try
gfc_check_real (gfc_expr *a, gfc_expr *kind)
{
if (numeric_check (a, 0) == FAILURE)
@@ -2209,7 +2242,7 @@ gfc_check_real (gfc_expr *a, gfc_expr *kind)
}
-try
+gfc_try
gfc_check_rename (gfc_expr *path1, gfc_expr *path2)
{
if (type_check (path1, 0, BT_CHARACTER) == FAILURE)
@@ -2226,7 +2259,7 @@ gfc_check_rename (gfc_expr *path1, gfc_expr *path2)
}
-try
+gfc_try
gfc_check_rename_sub (gfc_expr *path1, gfc_expr *path2, gfc_expr *status)
{
if (type_check (path1, 0, BT_CHARACTER) == FAILURE)
@@ -2252,7 +2285,7 @@ gfc_check_rename_sub (gfc_expr *path1, gfc_expr *path2, gfc_expr *status)
}
-try
+gfc_try
gfc_check_repeat (gfc_expr *x, gfc_expr *y)
{
if (type_check (x, 0, BT_CHARACTER) == FAILURE)
@@ -2271,7 +2304,7 @@ gfc_check_repeat (gfc_expr *x, gfc_expr *y)
}
-try
+gfc_try
gfc_check_reshape (gfc_expr *source, gfc_expr *shape,
gfc_expr *pad, gfc_expr *order)
{
@@ -2350,7 +2383,7 @@ gfc_check_reshape (gfc_expr *source, gfc_expr *shape,
}
-try
+gfc_try
gfc_check_scale (gfc_expr *x, gfc_expr *i)
{
if (type_check (x, 0, BT_REAL) == FAILURE)
@@ -2363,7 +2396,7 @@ gfc_check_scale (gfc_expr *x, gfc_expr *i)
}
-try
+gfc_try
gfc_check_scan (gfc_expr *x, gfc_expr *y, gfc_expr *z, gfc_expr *kind)
{
if (type_check (x, 0, BT_CHARACTER) == FAILURE)
@@ -2389,7 +2422,7 @@ gfc_check_scan (gfc_expr *x, gfc_expr *y, gfc_expr *z, gfc_expr *kind)
}
-try
+gfc_try
gfc_check_secnds (gfc_expr *r)
{
if (type_check (r, 0, BT_REAL) == FAILURE)
@@ -2405,7 +2438,7 @@ gfc_check_secnds (gfc_expr *r)
}
-try
+gfc_try
gfc_check_selected_char_kind (gfc_expr *name)
{
if (type_check (name, 0, BT_CHARACTER) == FAILURE)
@@ -2421,7 +2454,7 @@ gfc_check_selected_char_kind (gfc_expr *name)
}
-try
+gfc_try
gfc_check_selected_int_kind (gfc_expr *r)
{
if (type_check (r, 0, BT_INTEGER) == FAILURE)
@@ -2434,7 +2467,7 @@ gfc_check_selected_int_kind (gfc_expr *r)
}
-try
+gfc_try
gfc_check_selected_real_kind (gfc_expr *p, gfc_expr *r)
{
if (p == NULL && r == NULL)
@@ -2455,7 +2488,7 @@ gfc_check_selected_real_kind (gfc_expr *p, gfc_expr *r)
}
-try
+gfc_try
gfc_check_set_exponent (gfc_expr *x, gfc_expr *i)
{
if (type_check (x, 0, BT_REAL) == FAILURE)
@@ -2468,7 +2501,7 @@ gfc_check_set_exponent (gfc_expr *x, gfc_expr *i)
}
-try
+gfc_try
gfc_check_shape (gfc_expr *source)
{
gfc_array_ref *ar;
@@ -2489,7 +2522,7 @@ gfc_check_shape (gfc_expr *source)
}
-try
+gfc_try
gfc_check_sign (gfc_expr *a, gfc_expr *b)
{
if (int_or_real_check (a, 0) == FAILURE)
@@ -2502,7 +2535,7 @@ gfc_check_sign (gfc_expr *a, gfc_expr *b)
}
-try
+gfc_try
gfc_check_size (gfc_expr *array, gfc_expr *dim, gfc_expr *kind)
{
if (array_check (array, 0) == FAILURE)
@@ -2529,14 +2562,14 @@ gfc_check_size (gfc_expr *array, gfc_expr *dim, gfc_expr *kind)
}
-try
+gfc_try
gfc_check_sizeof (gfc_expr *arg ATTRIBUTE_UNUSED)
{
return SUCCESS;
}
-try
+gfc_try
gfc_check_sleep_sub (gfc_expr *seconds)
{
if (type_check (seconds, 0, BT_INTEGER) == FAILURE)
@@ -2549,7 +2582,7 @@ gfc_check_sleep_sub (gfc_expr *seconds)
}
-try
+gfc_try
gfc_check_spread (gfc_expr *source, gfc_expr *dim, gfc_expr *ncopies)
{
if (source->rank >= GFC_MAX_DIMENSIONS)
@@ -2580,7 +2613,7 @@ gfc_check_spread (gfc_expr *source, gfc_expr *dim, gfc_expr *ncopies)
/* Functions for checking FGETC, FPUTC, FGET and FPUT (subroutines and
functions). */
-try
+gfc_try
gfc_check_fgetputc_sub (gfc_expr *unit, gfc_expr *c, gfc_expr *status)
{
if (type_check (unit, 0, BT_INTEGER) == FAILURE)
@@ -2606,14 +2639,14 @@ gfc_check_fgetputc_sub (gfc_expr *unit, gfc_expr *c, gfc_expr *status)
}
-try
+gfc_try
gfc_check_fgetputc (gfc_expr *unit, gfc_expr *c)
{
return gfc_check_fgetputc_sub (unit, c, NULL);
}
-try
+gfc_try
gfc_check_fgetput_sub (gfc_expr *c, gfc_expr *status)
{
if (type_check (c, 0, BT_CHARACTER) == FAILURE)
@@ -2633,14 +2666,14 @@ gfc_check_fgetput_sub (gfc_expr *c, gfc_expr *status)
}
-try
+gfc_try
gfc_check_fgetput (gfc_expr *c)
{
return gfc_check_fgetput_sub (c, NULL);
}
-try
+gfc_try
gfc_check_fseek_sub (gfc_expr *unit, gfc_expr *offset, gfc_expr *whence, gfc_expr *status)
{
if (type_check (unit, 0, BT_INTEGER) == FAILURE)
@@ -2678,7 +2711,7 @@ gfc_check_fseek_sub (gfc_expr *unit, gfc_expr *offset, gfc_expr *whence, gfc_exp
-try
+gfc_try
gfc_check_fstat (gfc_expr *unit, gfc_expr *array)
{
if (type_check (unit, 0, BT_INTEGER) == FAILURE)
@@ -2698,7 +2731,7 @@ gfc_check_fstat (gfc_expr *unit, gfc_expr *array)
}
-try
+gfc_try
gfc_check_fstat_sub (gfc_expr *unit, gfc_expr *array, gfc_expr *status)
{
if (type_check (unit, 0, BT_INTEGER) == FAILURE)
@@ -2728,7 +2761,7 @@ gfc_check_fstat_sub (gfc_expr *unit, gfc_expr *array, gfc_expr *status)
}
-try
+gfc_try
gfc_check_ftell (gfc_expr *unit)
{
if (type_check (unit, 0, BT_INTEGER) == FAILURE)
@@ -2741,7 +2774,7 @@ gfc_check_ftell (gfc_expr *unit)
}
-try
+gfc_try
gfc_check_ftell_sub (gfc_expr *unit, gfc_expr *offset)
{
if (type_check (unit, 0, BT_INTEGER) == FAILURE)
@@ -2760,7 +2793,7 @@ gfc_check_ftell_sub (gfc_expr *unit, gfc_expr *offset)
}
-try
+gfc_try
gfc_check_stat (gfc_expr *name, gfc_expr *array)
{
if (type_check (name, 0, BT_CHARACTER) == FAILURE)
@@ -2779,7 +2812,7 @@ gfc_check_stat (gfc_expr *name, gfc_expr *array)
}
-try
+gfc_try
gfc_check_stat_sub (gfc_expr *name, gfc_expr *array, gfc_expr *status)
{
if (type_check (name, 0, BT_CHARACTER) == FAILURE)
@@ -2808,7 +2841,7 @@ gfc_check_stat_sub (gfc_expr *name, gfc_expr *array, gfc_expr *status)
}
-try
+gfc_try
gfc_check_transfer (gfc_expr *source ATTRIBUTE_UNUSED,
gfc_expr *mold ATTRIBUTE_UNUSED, gfc_expr *size)
{
@@ -2835,7 +2868,7 @@ gfc_check_transfer (gfc_expr *source ATTRIBUTE_UNUSED,
}
-try
+gfc_try
gfc_check_transpose (gfc_expr *matrix)
{
if (rank_check (matrix, 0, 2) == FAILURE)
@@ -2845,7 +2878,7 @@ gfc_check_transpose (gfc_expr *matrix)
}
-try
+gfc_try
gfc_check_ubound (gfc_expr *array, gfc_expr *dim, gfc_expr *kind)
{
if (array_check (array, 0) == FAILURE)
@@ -2871,7 +2904,7 @@ gfc_check_ubound (gfc_expr *array, gfc_expr *dim, gfc_expr *kind)
}
-try
+gfc_try
gfc_check_unpack (gfc_expr *vector, gfc_expr *mask, gfc_expr *field)
{
if (rank_check (vector, 0, 1) == FAILURE)
@@ -2886,11 +2919,30 @@ gfc_check_unpack (gfc_expr *vector, gfc_expr *mask, gfc_expr *field)
if (same_type_check (vector, 0, field, 2) == FAILURE)
return FAILURE;
+ if (mask->rank != field->rank && field->rank != 0)
+ {
+ gfc_error ("FIELD argument at %L of UNPACK must have the same rank as "
+ "MASK or be a scalar", &field->where);
+ return FAILURE;
+ }
+
+ if (mask->rank == field->rank)
+ {
+ int i;
+ for (i = 0; i < field->rank; i++)
+ if (! identical_dimen_shape (mask, i, field, i))
+ {
+ gfc_error ("Different shape in dimension %d for MASK and FIELD "
+ "arguments of UNPACK at %L", mask->rank, &field->where);
+ return FAILURE;
+ }
+ }
+
return SUCCESS;
}
-try
+gfc_try
gfc_check_verify (gfc_expr *x, gfc_expr *y, gfc_expr *z, gfc_expr *kind)
{
if (type_check (x, 0, BT_CHARACTER) == FAILURE)
@@ -2913,7 +2965,7 @@ gfc_check_verify (gfc_expr *x, gfc_expr *y, gfc_expr *z, gfc_expr *kind)
}
-try
+gfc_try
gfc_check_trim (gfc_expr *x)
{
if (type_check (x, 0, BT_CHARACTER) == FAILURE)
@@ -2926,7 +2978,7 @@ gfc_check_trim (gfc_expr *x)
}
-try
+gfc_try
gfc_check_ttynam (gfc_expr *unit)
{
if (scalar_check (unit, 0) == FAILURE)
@@ -2942,7 +2994,7 @@ gfc_check_ttynam (gfc_expr *unit)
/* Common check function for the half a dozen intrinsics that have a
single real argument. */
-try
+gfc_try
gfc_check_x (gfc_expr *x)
{
if (type_check (x, 0, BT_REAL) == FAILURE)
@@ -2954,7 +3006,7 @@ gfc_check_x (gfc_expr *x)
/************* Check functions for intrinsic subroutines *************/
-try
+gfc_try
gfc_check_cpu_time (gfc_expr *time)
{
if (scalar_check (time, 0) == FAILURE)
@@ -2970,7 +3022,7 @@ gfc_check_cpu_time (gfc_expr *time)
}
-try
+gfc_try
gfc_check_date_and_time (gfc_expr *date, gfc_expr *time,
gfc_expr *zone, gfc_expr *values)
{
@@ -3026,7 +3078,7 @@ gfc_check_date_and_time (gfc_expr *date, gfc_expr *time,
}
-try
+gfc_try
gfc_check_mvbits (gfc_expr *from, gfc_expr *frompos, gfc_expr *len,
gfc_expr *to, gfc_expr *topos)
{
@@ -3052,7 +3104,7 @@ gfc_check_mvbits (gfc_expr *from, gfc_expr *frompos, gfc_expr *len,
}
-try
+gfc_try
gfc_check_random_number (gfc_expr *harvest)
{
if (type_check (harvest, 0, BT_REAL) == FAILURE)
@@ -3065,7 +3117,7 @@ gfc_check_random_number (gfc_expr *harvest)
}
-try
+gfc_try
gfc_check_random_seed (gfc_expr *size, gfc_expr *put, gfc_expr *get)
{
unsigned int nargs = 0;
@@ -3145,7 +3197,7 @@ gfc_check_random_seed (gfc_expr *size, gfc_expr *put, gfc_expr *get)
}
-try
+gfc_try
gfc_check_second_sub (gfc_expr *time)
{
if (scalar_check (time, 0) == FAILURE)
@@ -3164,7 +3216,7 @@ gfc_check_second_sub (gfc_expr *time)
/* The arguments of SYSTEM_CLOCK are scalar, integer variables. Note,
count, count_rate, and count_max are all optional arguments */
-try
+gfc_try
gfc_check_system_clock (gfc_expr *count, gfc_expr *count_rate,
gfc_expr *count_max)
{
@@ -3221,7 +3273,7 @@ gfc_check_system_clock (gfc_expr *count, gfc_expr *count_rate,
}
-try
+gfc_try
gfc_check_irand (gfc_expr *x)
{
if (x == NULL)
@@ -3240,7 +3292,7 @@ gfc_check_irand (gfc_expr *x)
}
-try
+gfc_try
gfc_check_alarm_sub (gfc_expr *seconds, gfc_expr *handler, gfc_expr *status)
{
if (scalar_check (seconds, 0) == FAILURE)
@@ -3276,7 +3328,7 @@ gfc_check_alarm_sub (gfc_expr *seconds, gfc_expr *handler, gfc_expr *status)
}
-try
+gfc_try
gfc_check_rand (gfc_expr *x)
{
if (x == NULL)
@@ -3295,7 +3347,7 @@ gfc_check_rand (gfc_expr *x)
}
-try
+gfc_try
gfc_check_srand (gfc_expr *x)
{
if (scalar_check (x, 0) == FAILURE)
@@ -3311,7 +3363,7 @@ gfc_check_srand (gfc_expr *x)
}
-try
+gfc_try
gfc_check_ctime_sub (gfc_expr *time, gfc_expr *result)
{
if (scalar_check (time, 0) == FAILURE)
@@ -3328,7 +3380,7 @@ gfc_check_ctime_sub (gfc_expr *time, gfc_expr *result)
}
-try
+gfc_try
gfc_check_dtime_etime (gfc_expr *x)
{
if (array_check (x, 0) == FAILURE)
@@ -3350,7 +3402,7 @@ gfc_check_dtime_etime (gfc_expr *x)
}
-try
+gfc_try
gfc_check_dtime_etime_sub (gfc_expr *values, gfc_expr *time)
{
if (array_check (values, 0) == FAILURE)
@@ -3381,7 +3433,7 @@ gfc_check_dtime_etime_sub (gfc_expr *values, gfc_expr *time)
}
-try
+gfc_try
gfc_check_fdate_sub (gfc_expr *date)
{
if (type_check (date, 0, BT_CHARACTER) == FAILURE)
@@ -3393,7 +3445,7 @@ gfc_check_fdate_sub (gfc_expr *date)
}
-try
+gfc_try
gfc_check_gerror (gfc_expr *msg)
{
if (type_check (msg, 0, BT_CHARACTER) == FAILURE)
@@ -3405,7 +3457,7 @@ gfc_check_gerror (gfc_expr *msg)
}
-try
+gfc_try
gfc_check_getcwd_sub (gfc_expr *cwd, gfc_expr *status)
{
if (type_check (cwd, 0, BT_CHARACTER) == FAILURE)
@@ -3426,7 +3478,7 @@ gfc_check_getcwd_sub (gfc_expr *cwd, gfc_expr *status)
}
-try
+gfc_try
gfc_check_getarg (gfc_expr *pos, gfc_expr *value)
{
if (type_check (pos, 0, BT_INTEGER) == FAILURE)
@@ -3450,7 +3502,7 @@ gfc_check_getarg (gfc_expr *pos, gfc_expr *value)
}
-try
+gfc_try
gfc_check_getlog (gfc_expr *msg)
{
if (type_check (msg, 0, BT_CHARACTER) == FAILURE)
@@ -3462,7 +3514,7 @@ gfc_check_getlog (gfc_expr *msg)
}
-try
+gfc_try
gfc_check_exit (gfc_expr *status)
{
if (status == NULL)
@@ -3478,7 +3530,7 @@ gfc_check_exit (gfc_expr *status)
}
-try
+gfc_try
gfc_check_flush (gfc_expr *unit)
{
if (unit == NULL)
@@ -3494,7 +3546,7 @@ gfc_check_flush (gfc_expr *unit)
}
-try
+gfc_try
gfc_check_free (gfc_expr *i)
{
if (type_check (i, 0, BT_INTEGER) == FAILURE)
@@ -3507,7 +3559,7 @@ gfc_check_free (gfc_expr *i)
}
-try
+gfc_try
gfc_check_hostnm (gfc_expr *name)
{
if (type_check (name, 0, BT_CHARACTER) == FAILURE)
@@ -3519,7 +3571,7 @@ gfc_check_hostnm (gfc_expr *name)
}
-try
+gfc_try
gfc_check_hostnm_sub (gfc_expr *name, gfc_expr *status)
{
if (type_check (name, 0, BT_CHARACTER) == FAILURE)
@@ -3540,7 +3592,7 @@ gfc_check_hostnm_sub (gfc_expr *name, gfc_expr *status)
}
-try
+gfc_try
gfc_check_itime_idate (gfc_expr *values)
{
if (array_check (values, 0) == FAILURE)
@@ -3562,7 +3614,7 @@ gfc_check_itime_idate (gfc_expr *values)
}
-try
+gfc_try
gfc_check_ltime_gmtime (gfc_expr *time, gfc_expr *values)
{
if (type_check (time, 0, BT_INTEGER) == FAILURE)
@@ -3593,7 +3645,7 @@ gfc_check_ltime_gmtime (gfc_expr *time, gfc_expr *values)
}
-try
+gfc_try
gfc_check_ttynam_sub (gfc_expr *unit, gfc_expr *name)
{
if (scalar_check (unit, 0) == FAILURE)
@@ -3611,7 +3663,7 @@ gfc_check_ttynam_sub (gfc_expr *unit, gfc_expr *name)
}
-try
+gfc_try
gfc_check_isatty (gfc_expr *unit)
{
if (unit == NULL)
@@ -3627,7 +3679,7 @@ gfc_check_isatty (gfc_expr *unit)
}
-try
+gfc_try
gfc_check_isnan (gfc_expr *x)
{
if (type_check (x, 0, BT_REAL) == FAILURE)
@@ -3637,7 +3689,7 @@ gfc_check_isnan (gfc_expr *x)
}
-try
+gfc_try
gfc_check_perror (gfc_expr *string)
{
if (type_check (string, 0, BT_CHARACTER) == FAILURE)
@@ -3649,7 +3701,7 @@ gfc_check_perror (gfc_expr *string)
}
-try
+gfc_try
gfc_check_umask (gfc_expr *mask)
{
if (type_check (mask, 0, BT_INTEGER) == FAILURE)
@@ -3662,7 +3714,7 @@ gfc_check_umask (gfc_expr *mask)
}
-try
+gfc_try
gfc_check_umask_sub (gfc_expr *mask, gfc_expr *old)
{
if (type_check (mask, 0, BT_INTEGER) == FAILURE)
@@ -3684,7 +3736,7 @@ gfc_check_umask_sub (gfc_expr *mask, gfc_expr *old)
}
-try
+gfc_try
gfc_check_unlink (gfc_expr *name)
{
if (type_check (name, 0, BT_CHARACTER) == FAILURE)
@@ -3696,7 +3748,7 @@ gfc_check_unlink (gfc_expr *name)
}
-try
+gfc_try
gfc_check_unlink_sub (gfc_expr *name, gfc_expr *status)
{
if (type_check (name, 0, BT_CHARACTER) == FAILURE)
@@ -3717,7 +3769,7 @@ gfc_check_unlink_sub (gfc_expr *name, gfc_expr *status)
}
-try
+gfc_try
gfc_check_signal (gfc_expr *number, gfc_expr *handler)
{
if (scalar_check (number, 0) == FAILURE)
@@ -3741,7 +3793,7 @@ gfc_check_signal (gfc_expr *number, gfc_expr *handler)
}
-try
+gfc_try
gfc_check_signal_sub (gfc_expr *number, gfc_expr *handler, gfc_expr *status)
{
if (scalar_check (number, 0) == FAILURE)
@@ -3774,7 +3826,7 @@ gfc_check_signal_sub (gfc_expr *number, gfc_expr *handler, gfc_expr *status)
}
-try
+gfc_try
gfc_check_system_sub (gfc_expr *cmd, gfc_expr *status)
{
if (type_check (cmd, 0, BT_CHARACTER) == FAILURE)
@@ -3796,7 +3848,7 @@ gfc_check_system_sub (gfc_expr *cmd, gfc_expr *status)
/* This is used for the GNU intrinsics AND, OR and XOR. */
-try
+gfc_try
gfc_check_and (gfc_expr *i, gfc_expr *j)
{
if (i->ts.type != BT_INTEGER && i->ts.type != BT_LOGICAL)
diff --git a/gcc/fortran/cpp.c b/gcc/fortran/cpp.c
index 0498130396e..86e0335dc9f 100644
--- a/gcc/fortran/cpp.c
+++ b/gcc/fortran/cpp.c
@@ -574,7 +574,7 @@ gfc_cpp_init (void)
pp_dir_change (cpp_in, get_src_pwd ());
}
-try
+gfc_try
gfc_cpp_preprocess (const char *source_file)
{
if (!gfc_cpp_enabled ())
diff --git a/gcc/fortran/cpp.h b/gcc/fortran/cpp.h
index 6f409cc45ee..db245021110 100644
--- a/gcc/fortran/cpp.h
+++ b/gcc/fortran/cpp.h
@@ -36,7 +36,7 @@ int gfc_cpp_handle_option(size_t scode, const char *arg, int value);
void gfc_cpp_post_options (void);
-try gfc_cpp_preprocess (const char *source_file);
+gfc_try gfc_cpp_preprocess (const char *source_file);
void gfc_cpp_done (void);
diff --git a/gcc/fortran/data.c b/gcc/fortran/data.c
index 6cc7223af2f..09dde150b22 100644
--- a/gcc/fortran/data.c
+++ b/gcc/fortran/data.c
@@ -23,7 +23,7 @@ along with GCC; see the file COPYING3. If not see
/* Notes for DATA statement implementation:
We first assign initial value to each symbol by gfc_assign_data_value
- during resolveing DATA statement. Refer to check_data_variable and
+ during resolving DATA statement. Refer to check_data_variable and
traverse_data_list in resolve.c.
The complexity exists in the handling of array section, implied do
@@ -46,7 +46,7 @@ get_array_index (gfc_array_ref *ar, mpz_t *offset)
{
gfc_expr *e;
int i;
- try re;
+ gfc_try re;
mpz_t delta;
mpz_t tmp;
@@ -144,7 +144,7 @@ find_con_by_component (gfc_component *com, gfc_constructor *con)
/* Create a character type initialization expression from RVALUE.
TS [and REF] describe [the substring of] the variable being initialized.
- INIT is thh existing initializer, not NULL. Initialization is performed
+ INIT is the existing initializer, not NULL. Initialization is performed
according to normal assignment rules. */
static gfc_expr *
@@ -247,7 +247,7 @@ create_character_intializer (gfc_expr *init, gfc_typespec *ts,
LVALUE already has an initialization, we extend this, otherwise we
create a new one. */
-try
+gfc_try
gfc_assign_data_value (gfc_expr *lvalue, gfc_expr *rvalue, mpz_t index)
{
gfc_ref *ref;
@@ -754,7 +754,7 @@ formalize_structure_cons (gfc_expr *expr)
}
-/* Make sure an initialization expression is in normalized form. Ie. all
+/* Make sure an initialization expression is in normalized form, i.e., all
elements of the constructors are in the correct order. */
static void
diff --git a/gcc/fortran/data.h b/gcc/fortran/data.h
index a677a86e0e3..0d31a920e6d 100644
--- a/gcc/fortran/data.h
+++ b/gcc/fortran/data.h
@@ -19,6 +19,6 @@ along with GCC; see the file COPYING3. If not see
void gfc_formalize_init_value (gfc_symbol *);
void gfc_get_section_index (gfc_array_ref *, mpz_t *, mpz_t *);
-try gfc_assign_data_value (gfc_expr *, gfc_expr *, mpz_t);
+gfc_try gfc_assign_data_value (gfc_expr *, gfc_expr *, mpz_t);
void gfc_assign_data_value_range (gfc_expr *, gfc_expr *, mpz_t, mpz_t);
void gfc_advance_section (mpz_t *, gfc_array_ref *, mpz_t *);
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index d23a32946ef..12497808a4e 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -231,21 +231,21 @@ syntax:
variable-iterator list. */
static match
-var_element (gfc_data_variable *new)
+var_element (gfc_data_variable *new_var)
{
match m;
gfc_symbol *sym;
- memset (new, 0, sizeof (gfc_data_variable));
+ memset (new_var, 0, sizeof (gfc_data_variable));
if (gfc_match_char ('(') == MATCH_YES)
- return var_list (new);
+ return var_list (new_var);
- m = gfc_match_variable (&new->expr, 0);
+ m = gfc_match_variable (&new_var->expr, 0);
if (m != MATCH_YES)
return m;
- sym = new->expr->symtree->n.sym;
+ sym = new_var->expr->symtree->n.sym;
if (!sym->attr.function && gfc_current_ns->parent
&& gfc_current_ns->parent == sym->ns)
@@ -262,7 +262,7 @@ var_element (gfc_data_variable *new)
sym->name) == FAILURE)
return MATCH_ERROR;
- if (gfc_add_data (&sym->attr, sym->name, &new->expr->where) == FAILURE)
+ if (gfc_add_data (&sym->attr, sym->name, &new_var->expr->where) == FAILURE)
return MATCH_ERROR;
return MATCH_YES;
@@ -274,7 +274,7 @@ var_element (gfc_data_variable *new)
static match
top_var_list (gfc_data *d)
{
- gfc_data_variable var, *tail, *new;
+ gfc_data_variable var, *tail, *new_var;
match m;
tail = NULL;
@@ -287,15 +287,15 @@ top_var_list (gfc_data *d)
if (m == MATCH_ERROR)
return MATCH_ERROR;
- new = gfc_get_data_variable ();
- *new = var;
+ new_var = gfc_get_data_variable ();
+ *new_var = var;
if (tail == NULL)
- d->var = new;
+ d->var = new_var;
else
- tail->next = new;
+ tail->next = new_var;
- tail = new;
+ tail = new_var;
if (gfc_match_char ('/') == MATCH_YES)
break;
@@ -367,7 +367,7 @@ match_data_constant (gfc_expr **result)
return MATCH_ERROR;
}
else if (sym->attr.flavor == FL_DERIVED)
- return gfc_match_structure_constructor (sym, result);
+ return gfc_match_structure_constructor (sym, result, false);
/* Check to see if the value is an initialization array expression. */
if (sym->value->expr_type == EXPR_ARRAY)
@@ -404,7 +404,7 @@ match_data_constant (gfc_expr **result)
static match
top_val_list (gfc_data *data)
{
- gfc_data_value *new, *tail;
+ gfc_data_value *new_val, *tail;
gfc_expr *expr;
match m;
@@ -418,15 +418,15 @@ top_val_list (gfc_data *data)
if (m == MATCH_ERROR)
return MATCH_ERROR;
- new = gfc_get_data_value ();
- mpz_init (new->repeat);
+ new_val = gfc_get_data_value ();
+ mpz_init (new_val->repeat);
if (tail == NULL)
- data->value = new;
+ data->value = new_val;
else
- tail->next = new;
+ tail->next = new_val;
- tail = new;
+ tail = new_val;
if (expr->ts.type != BT_INTEGER || gfc_match_char ('*') != MATCH_YES)
{
@@ -518,26 +518,26 @@ match_old_style_init (const char *name)
match
gfc_match_data (void)
{
- gfc_data *new;
+ gfc_data *new_data;
match m;
set_in_match_data (true);
for (;;)
{
- new = gfc_get_data ();
- new->where = gfc_current_locus;
+ new_data = gfc_get_data ();
+ new_data->where = gfc_current_locus;
- m = top_var_list (new);
+ m = top_var_list (new_data);
if (m != MATCH_YES)
goto cleanup;
- m = top_val_list (new);
+ m = top_val_list (new_data);
if (m != MATCH_YES)
goto cleanup;
- new->next = gfc_current_ns->data;
- gfc_current_ns->data = new;
+ new_data->next = gfc_current_ns->data;
+ gfc_current_ns->data = new_data;
if (gfc_match_eos () == MATCH_YES)
break;
@@ -557,7 +557,7 @@ gfc_match_data (void)
cleanup:
set_in_match_data (false);
- gfc_free_data (new);
+ gfc_free_data (new_data);
return MATCH_ERROR;
}
@@ -762,7 +762,7 @@ get_proc_name (const char *name, gfc_symbol **result, bool module_fcn_entry)
(*result)->ts = sym->ts;
/* Put the symbol in the procedure namespace so that, should
- the ENTRY preceed its specification, the specification
+ the ENTRY precede its specification, the specification
can be applied. */
(*result)->ns = gfc_current_ns;
@@ -781,7 +781,7 @@ get_proc_name (const char *name, gfc_symbol **result, bool module_fcn_entry)
sym = *result;
gfc_current_ns->refs++;
- if (sym && !sym->new && gfc_current_state () != COMP_INTERFACE)
+ if (sym && !sym->gfc_new && gfc_current_state () != COMP_INTERFACE)
{
/* Trap another encompassed procedure with the same name. All
these conditions are necessary to avoid picking up an entry
@@ -867,11 +867,11 @@ get_proc_name (const char *name, gfc_symbol **result, bool module_fcn_entry)
the compiler could have automatically handled the varying sizes
across platforms. */
-try
+gfc_try
verify_c_interop_param (gfc_symbol *sym)
{
int is_c_interop = 0;
- try retval = SUCCESS;
+ gfc_try retval = SUCCESS;
/* We check implicitly typed variables in symbol.c:gfc_set_default_type().
Don't repeat the checks here. */
@@ -1009,7 +1009,7 @@ verify_c_interop_param (gfc_symbol *sym)
/* Function called by variable_decl() that adds a name to the symbol table. */
-static try
+static gfc_try
build_sym (const char *name, gfc_charlen *cl,
gfc_array_spec **as, locus *var_locus)
{
@@ -1185,7 +1185,7 @@ gfc_free_enum_history (void)
/* Function called by variable_decl() that adds an initialization
expression to a symbol. */
-static try
+static gfc_try
add_init_expr_to_sym (const char *name, gfc_expr **initp, locus *var_locus)
{
symbol_attribute attr;
@@ -1362,7 +1362,7 @@ add_init_expr_to_sym (const char *name, gfc_expr **initp, locus *var_locus)
/* Function called by variable_decl() that adds a name to a structure
being built. */
-static try
+static gfc_try
build_struct (const char *name, gfc_charlen *cl, gfc_expr **init,
gfc_array_spec **as)
{
@@ -1548,7 +1548,7 @@ variable_decl (int elem)
gfc_charlen *cl;
locus var_locus;
match m;
- try t;
+ gfc_try t;
gfc_symbol *sym;
locus old_locus;
@@ -2786,7 +2786,7 @@ match_attr_spec (void)
decl_types d;
const char *attr;
match m;
- try t;
+ gfc_try t;
gfc_clear_attr (&current_attr);
start = gfc_current_locus;
@@ -3248,7 +3248,7 @@ cleanup:
(J3/04-007, section 15.4.1). If a binding label was given and
there is more than one argument (num_idents), it is an error. */
-try
+gfc_try
set_binding_label (char *dest_label, const char *sym_name, int num_idents)
{
if (num_idents > 1 && has_name_equals)
@@ -3288,10 +3288,10 @@ set_com_block_bind_c (gfc_common_head *com_block, int is_bind_c)
/* Verify that the given gfc_typespec is for a C interoperable type. */
-try
+gfc_try
verify_c_interop (gfc_typespec *ts, const char *name, locus *where)
{
- try t;
+ gfc_try t;
/* Make sure the kind used is appropriate for the type.
The f90_type is unknown if an integer constant was
@@ -3326,11 +3326,11 @@ verify_c_interop (gfc_typespec *ts, const char *name, locus *where)
interoperable type. Errors will be reported here, if
encountered. */
-try
+gfc_try
verify_com_block_vars_c_interop (gfc_common_head *com_block)
{
gfc_symbol *curr_sym = NULL;
- try retval = SUCCESS;
+ gfc_try retval = SUCCESS;
curr_sym = com_block->head;
@@ -3354,11 +3354,11 @@ verify_com_block_vars_c_interop (gfc_common_head *com_block)
/* Verify that a given BIND(C) symbol is C interoperable. If it is not,
an appropriate error message is reported. */
-try
+gfc_try
verify_bind_c_sym (gfc_symbol *tmp_sym, gfc_typespec *ts,
int is_in_common, gfc_common_head *com_block)
{
- try retval = SUCCESS;
+ gfc_try retval = SUCCESS;
if (tmp_sym->attr.function && tmp_sym->result != NULL)
{
@@ -3478,10 +3478,10 @@ verify_bind_c_sym (gfc_symbol *tmp_sym, gfc_typespec *ts,
the type is C interoperable. Errors are reported by the functions
used to set/test these fields. */
-try
+gfc_try
set_verify_bind_c_sym (gfc_symbol *tmp_sym, int num_idents)
{
- try retval = SUCCESS;
+ gfc_try retval = SUCCESS;
/* TODO: Do we need to make sure the vars aren't marked private? */
@@ -3499,10 +3499,10 @@ set_verify_bind_c_sym (gfc_symbol *tmp_sym, int num_idents)
/* Set the fields marking the given common block as BIND(C), including
a binding label, and report any errors encountered. */
-try
+gfc_try
set_verify_bind_c_com_block (gfc_common_head *com_block, int num_idents)
{
- try retval = SUCCESS;
+ gfc_try retval = SUCCESS;
/* destLabel, common name, typespec (which may have binding label). */
if (set_binding_label (com_block->binding_label, com_block->name, num_idents)
@@ -3519,7 +3519,7 @@ set_verify_bind_c_com_block (gfc_common_head *com_block, int num_idents)
/* Retrieve the list of one or more identifiers that the given bind(c)
attribute applies to. */
-try
+gfc_try
get_bind_c_idents (void)
{
char name[GFC_MAX_SYMBOL_LEN + 1];
@@ -3792,7 +3792,7 @@ loop:
/* Copy attributes matched by gfc_match_prefix() to attributes on a symbol. */
-static try
+static gfc_try
copy_prefix (symbol_attribute *dest, locus *where)
{
if (current_attr.pure && gfc_add_pure (dest, where) == FAILURE)
@@ -4120,8 +4120,8 @@ match_procedure_decl (void)
/* Handle intrinsic procedures. */
if (!(proc_if->attr.external || proc_if->attr.use_assoc
|| proc_if->attr.if_source == IFSRC_IFBODY)
- && (gfc_intrinsic_name (proc_if->name, 0)
- || gfc_intrinsic_name (proc_if->name, 1)))
+ && (gfc_is_intrinsic (proc_if, 0, gfc_current_locus)
+ || gfc_is_intrinsic (proc_if, 1, gfc_current_locus)))
proc_if->attr.intrinsic = 1;
if (proc_if->attr.intrinsic
&& !gfc_intrinsic_actual_ok (proc_if->name, 0))
@@ -4336,6 +4336,22 @@ gfc_match_procedure (void)
}
+/* Warn if a matched procedure has the same name as an intrinsic; this is
+ simply a wrapper around gfc_warn_intrinsic_shadow that interprets the current
+ parser-state-stack to find out whether we're in a module. */
+
+static void
+warn_intrinsic_shadow (const gfc_symbol* sym, bool func)
+{
+ bool in_module;
+
+ in_module = (gfc_state_stack->previous
+ && gfc_state_stack->previous->state == COMP_MODULE);
+
+ gfc_warn_intrinsic_shadow (sym, in_module, func);
+}
+
+
/* Match a function declaration. */
match
@@ -4460,6 +4476,9 @@ gfc_match_function_decl (void)
sym->result = result;
}
+ /* Warn if this procedure has the same name as an intrinsic. */
+ warn_intrinsic_shadow (sym, true);
+
return MATCH_YES;
}
@@ -4842,6 +4861,9 @@ gfc_match_subroutine (void)
if (copy_prefix (&sym->attr, &sym->declared_at) == FAILURE)
return MATCH_ERROR;
+ /* Warn if it has the same name as an intrinsic. */
+ warn_intrinsic_shadow (sym, false);
+
return MATCH_YES;
}
@@ -5630,7 +5652,7 @@ access_attr_decl (gfc_statement st)
interface_type type;
gfc_user_op *uop;
gfc_symbol *sym;
- gfc_intrinsic_op operator;
+ gfc_intrinsic_op op;
match m;
if (gfc_match (" ::") == MATCH_NO && gfc_match_space () == MATCH_NO)
@@ -5638,7 +5660,7 @@ access_attr_decl (gfc_statement st)
for (;;)
{
- m = gfc_match_generic_spec (&type, name, &operator);
+ m = gfc_match_generic_spec (&type, name, &op);
if (m == MATCH_NO)
goto syntax;
if (m == MATCH_ERROR)
@@ -5662,15 +5684,15 @@ access_attr_decl (gfc_statement st)
break;
case INTERFACE_INTRINSIC_OP:
- if (gfc_current_ns->operator_access[operator] == ACCESS_UNKNOWN)
+ if (gfc_current_ns->operator_access[op] == ACCESS_UNKNOWN)
{
- gfc_current_ns->operator_access[operator] =
+ gfc_current_ns->operator_access[op] =
(st == ST_PUBLIC) ? ACCESS_PUBLIC : ACCESS_PRIVATE;
}
else
{
gfc_error ("Access specification of the %s operator at %C has "
- "already been specified", gfc_op2string (operator));
+ "already been specified", gfc_op2string (op));
goto done;
}
@@ -5770,7 +5792,7 @@ syntax:
/* The PRIVATE statement is a bit weird in that it can be an attribute
- declaration, but also works as a standlone statement inside of a
+ declaration, but also works as a standalone statement inside of a
type declaration or a module. */
match
@@ -6228,6 +6250,49 @@ syntax:
}
+/* Check a derived type that is being extended. */
+static gfc_symbol*
+check_extended_derived_type (char *name)
+{
+ gfc_symbol *extended;
+
+ if (gfc_find_symbol (name, gfc_current_ns, 1, &extended))
+ {
+ gfc_error ("Ambiguous symbol in TYPE definition at %C");
+ return NULL;
+ }
+
+ if (!extended)
+ {
+ gfc_error ("No such symbol in TYPE definition at %C");
+ return NULL;
+ }
+
+ if (extended->attr.flavor != FL_DERIVED)
+ {
+ gfc_error ("'%s' in EXTENDS expression at %C is not a "
+ "derived type", name);
+ return NULL;
+ }
+
+ if (extended->attr.is_bind_c)
+ {
+ gfc_error ("'%s' cannot be extended at %C because it "
+ "is BIND(C)", extended->name);
+ return NULL;
+ }
+
+ if (extended->attr.sequence)
+ {
+ gfc_error ("'%s' cannot be extended at %C because it "
+ "is a SEQUENCE type", extended->name);
+ return NULL;
+ }
+
+ return extended;
+}
+
+
/* Match the optional attribute specifiers for a type declaration.
Return MATCH_ERROR if an error is encountered in one of the handled
attributes (public, private, bind(c)), MATCH_NO if what's found is
@@ -6235,7 +6300,7 @@ syntax:
checking on attribute conflicts needs to be done. */
match
-gfc_get_type_attr_spec (symbol_attribute *attr)
+gfc_get_type_attr_spec (symbol_attribute *attr, char *name)
{
/* See if the derived type is marked as private. */
if (gfc_match (" , private") == MATCH_YES)
@@ -6273,6 +6338,11 @@ gfc_get_type_attr_spec (symbol_attribute *attr)
/* TODO: attr conflicts need to be checked, probably in symbol.c. */
}
+ else if (name && gfc_match(" , extends ( %n )", name) == MATCH_YES)
+ {
+ if (gfc_add_extension (attr, &gfc_current_locus) == FAILURE)
+ return MATCH_ERROR;
+ }
else
return MATCH_NO;
@@ -6289,8 +6359,10 @@ match
gfc_match_derived_decl (void)
{
char name[GFC_MAX_SYMBOL_LEN + 1];
+ char parent[GFC_MAX_SYMBOL_LEN + 1];
symbol_attribute attr;
gfc_symbol *sym;
+ gfc_symbol *extended;
match m;
match is_type_attr_spec = MATCH_NO;
bool seen_attr = false;
@@ -6298,17 +6370,29 @@ gfc_match_derived_decl (void)
if (gfc_current_state () == COMP_DERIVED)
return MATCH_NO;
+ name[0] = '\0';
+ parent[0] = '\0';
gfc_clear_attr (&attr);
+ extended = NULL;
do
{
- is_type_attr_spec = gfc_get_type_attr_spec (&attr);
+ is_type_attr_spec = gfc_get_type_attr_spec (&attr, parent);
if (is_type_attr_spec == MATCH_ERROR)
return MATCH_ERROR;
if (is_type_attr_spec == MATCH_YES)
seen_attr = true;
} while (is_type_attr_spec == MATCH_YES);
+ /* Deal with derived type extensions. The extension attribute has
+ been added to 'attr' but now the parent type must be found and
+ checked. */
+ if (parent[0])
+ extended = check_extended_derived_type (parent);
+
+ if (parent[0] && !extended)
+ return MATCH_ERROR;
+
if (gfc_match (" ::") != MATCH_YES && seen_attr)
{
gfc_error ("Expected :: in TYPE definition at %C");
@@ -6341,7 +6425,7 @@ gfc_match_derived_decl (void)
components. The ways this can happen is via a function
definition, an INTRINSIC statement or a subtype in another
derived type that is a pointer. The first part of the AND clause
- is true if a the symbol is not the return value of a function. */
+ is true if the symbol is not the return value of a function. */
if (sym->attr.flavor != FL_DERIVED
&& gfc_add_flavor (&sym->attr, FL_DERIVED, sym->name, NULL) == FAILURE)
return MATCH_ERROR;
@@ -6361,10 +6445,34 @@ gfc_match_derived_decl (void)
if (attr.is_bind_c != 0)
sym->attr.is_bind_c = attr.is_bind_c;
+
/* Construct the f2k_derived namespace if it is not yet there. */
if (!sym->f2k_derived)
sym->f2k_derived = gfc_get_namespace (NULL, 0);
+
+ if (extended && !sym->components)
+ {
+ gfc_component *p;
+ gfc_symtree *st;
+
+ /* Add the extended derived type as the first component. */
+ gfc_add_component (sym, parent, &p);
+ sym->attr.extension = attr.extension;
+ extended->refs++;
+ gfc_set_sym_referenced (extended);
+
+ p->ts.type = BT_DERIVED;
+ p->ts.derived = extended;
+ p->initializer = gfc_default_initializer (&p->ts);
+
+ /* Provide the links between the extended type and its extension. */
+ if (!extended->f2k_derived)
+ extended->f2k_derived = gfc_get_namespace (NULL, 0);
+ st = gfc_new_symtree (&extended->f2k_derived->sym_root, sym->name);
+ st->n.sym = sym;
+ }
+
gfc_new_block = sym;
return MATCH_YES;
@@ -6378,7 +6486,7 @@ gfc_match_derived_decl (void)
is the case. Since there is no bounds-checking for Cray Pointees,
this will be okay. */
-try
+gfc_try
gfc_mod_pointee_as (gfc_array_spec *as)
{
as->cray_pointee = true; /* This will be useful to know later. */
@@ -6432,7 +6540,7 @@ enumerator_decl (void)
gfc_symbol *sym;
locus var_locus;
match m;
- try t;
+ gfc_try t;
locus old_locus;
initializer = NULL;
@@ -6515,7 +6623,7 @@ match
gfc_match_enumerator_def (void)
{
match m;
- try t;
+ gfc_try t;
gfc_clear_ts (&current_ts);
@@ -6575,6 +6683,7 @@ cleanup:
}
+
/* Match a FINAL declaration inside a derived type. */
match
@@ -6655,7 +6764,7 @@ gfc_match_final_decl (void)
/* Check if we already have this symbol in the list, this is an error. */
for (f = gfc_current_block ()->f2k_derived->finalizers; f; f = f->next)
- if (f->procedure == sym)
+ if (f->proc_sym == sym)
{
gfc_error ("'%s' at %C is already defined as FINAL procedure!",
name);
@@ -6666,7 +6775,8 @@ gfc_match_final_decl (void)
gcc_assert (gfc_current_block ()->f2k_derived);
++sym->refs;
f = XCNEW (gfc_finalizer);
- f->procedure = sym;
+ f->proc_sym = sym;
+ f->proc_tree = NULL;
f->where = gfc_current_locus;
f->next = gfc_current_block ()->f2k_derived->finalizers;
gfc_current_block ()->f2k_derived->finalizers = f;
diff --git a/gcc/fortran/dependency.c b/gcc/fortran/dependency.c
index 8e7e34332ce..558b7675873 100644
--- a/gcc/fortran/dependency.c
+++ b/gcc/fortran/dependency.c
@@ -37,7 +37,7 @@ typedef enum
{
GFC_DEP_ERROR,
GFC_DEP_EQUAL, /* Identical Ranges. */
- GFC_DEP_FORWARD, /* eg. a(1:3), a(2:4). */
+ GFC_DEP_FORWARD, /* e.g., a(1:3), a(2:4). */
GFC_DEP_OVERLAP, /* May overlap in some other way. */
GFC_DEP_NODEP /* Distinct ranges. */
}
@@ -76,15 +76,15 @@ gfc_dep_compare_expr (gfc_expr *e1, gfc_expr *e2)
int i;
if (e1->expr_type == EXPR_OP
- && (e1->value.op.operator == INTRINSIC_UPLUS
- || e1->value.op.operator == INTRINSIC_PARENTHESES))
+ && (e1->value.op.op == INTRINSIC_UPLUS
+ || e1->value.op.op == INTRINSIC_PARENTHESES))
return gfc_dep_compare_expr (e1->value.op.op1, e2);
if (e2->expr_type == EXPR_OP
- && (e2->value.op.operator == INTRINSIC_UPLUS
- || e2->value.op.operator == INTRINSIC_PARENTHESES))
+ && (e2->value.op.op == INTRINSIC_UPLUS
+ || e2->value.op.op == INTRINSIC_PARENTHESES))
return gfc_dep_compare_expr (e1, e2->value.op.op1);
- if (e1->expr_type == EXPR_OP && e1->value.op.operator == INTRINSIC_PLUS)
+ if (e1->expr_type == EXPR_OP && e1->value.op.op == INTRINSIC_PLUS)
{
/* Compare X+C vs. X. */
if (e1->value.op.op2->expr_type == EXPR_CONSTANT
@@ -93,7 +93,7 @@ gfc_dep_compare_expr (gfc_expr *e1, gfc_expr *e2)
return mpz_sgn (e1->value.op.op2->value.integer);
/* Compare P+Q vs. R+S. */
- if (e2->expr_type == EXPR_OP && e2->value.op.operator == INTRINSIC_PLUS)
+ if (e2->expr_type == EXPR_OP && e2->value.op.op == INTRINSIC_PLUS)
{
int l, r;
@@ -126,7 +126,7 @@ gfc_dep_compare_expr (gfc_expr *e1, gfc_expr *e2)
}
/* Compare X vs. X+C. */
- if (e2->expr_type == EXPR_OP && e2->value.op.operator == INTRINSIC_PLUS)
+ if (e2->expr_type == EXPR_OP && e2->value.op.op == INTRINSIC_PLUS)
{
if (e2->value.op.op2->expr_type == EXPR_CONSTANT
&& e2->value.op.op2->ts.type == BT_INTEGER
@@ -135,7 +135,7 @@ gfc_dep_compare_expr (gfc_expr *e1, gfc_expr *e2)
}
/* Compare X-C vs. X. */
- if (e1->expr_type == EXPR_OP && e1->value.op.operator == INTRINSIC_MINUS)
+ if (e1->expr_type == EXPR_OP && e1->value.op.op == INTRINSIC_MINUS)
{
if (e1->value.op.op2->expr_type == EXPR_CONSTANT
&& e1->value.op.op2->ts.type == BT_INTEGER
@@ -143,7 +143,7 @@ gfc_dep_compare_expr (gfc_expr *e1, gfc_expr *e2)
return -mpz_sgn (e1->value.op.op2->value.integer);
/* Compare P-Q vs. R-S. */
- if (e2->expr_type == EXPR_OP && e2->value.op.operator == INTRINSIC_MINUS)
+ if (e2->expr_type == EXPR_OP && e2->value.op.op == INTRINSIC_MINUS)
{
int l, r;
@@ -163,7 +163,7 @@ gfc_dep_compare_expr (gfc_expr *e1, gfc_expr *e2)
}
/* Compare X vs. X-C. */
- if (e2->expr_type == EXPR_OP && e2->value.op.operator == INTRINSIC_MINUS)
+ if (e2->expr_type == EXPR_OP && e2->value.op.op == INTRINSIC_MINUS)
{
if (e2->value.op.op2->expr_type == EXPR_CONSTANT
&& e2->value.op.op2->ts.type == BT_INTEGER
@@ -196,7 +196,7 @@ gfc_dep_compare_expr (gfc_expr *e1, gfc_expr *e2)
case EXPR_OP:
/* Intrinsic operators are the same if their operands are the same. */
- if (e1->value.op.operator != e2->value.op.operator)
+ if (e1->value.op.op != e2->value.op.op)
return -2;
if (e1->value.op.op2 == 0)
{
@@ -523,7 +523,7 @@ gfc_check_fncall_dependency (gfc_expr *other, sym_intent intent,
/* Return 1 if e1 and e2 are equivalenced arrays, either
- directly or indirectly; ie. equivalence (a,b) for a and b
+ directly or indirectly; i.e., equivalence (a,b) for a and b
or equivalence (a,c),(b,c). This function uses the equiv_
lists, generated in trans-common(add_equivalences), that are
guaranteed to pick up indirect equivalences. We explicitly
@@ -1183,7 +1183,7 @@ gfc_dep_resolver (gfc_ref *lref, gfc_ref *rref)
while (lref && rref)
{
/* We're resolving from the same base symbol, so both refs should be
- the same type. We traverse the reference chain intil we find ranges
+ the same type. We traverse the reference chain until we find ranges
that are not equal. */
gcc_assert (lref->type == rref->type);
switch (lref->type)
diff --git a/gcc/fortran/dump-parse-tree.c b/gcc/fortran/dump-parse-tree.c
index 80ff5bcecb7..80ddda20c54 100644
--- a/gcc/fortran/dump-parse-tree.c
+++ b/gcc/fortran/dump-parse-tree.c
@@ -437,7 +437,7 @@ show_expr (gfc_expr *p)
case EXPR_OP:
fputc ('(', dumpfile);
- switch (p->value.op.operator)
+ switch (p->value.op.op)
{
case INTRINSIC_UPLUS:
fputs ("U+ ", dumpfile);
@@ -570,7 +570,7 @@ show_attr (symbol_attribute *attr)
fputs (" OPTIONAL", dumpfile);
if (attr->pointer)
fputs (" POINTER", dumpfile);
- if (attr->protected)
+ if (attr->is_protected)
fputs (" PROTECTED", dumpfile);
if (attr->value)
fputs (" VALUE", dumpfile);
@@ -737,7 +737,7 @@ show_uop (gfc_user_op *uop)
show_indent ();
fprintf (dumpfile, "%s:", uop->name);
- for (intr = uop->operator; intr; intr = intr->next)
+ for (intr = uop->op; intr; intr = intr->next)
fprintf (dumpfile, " %s", intr->sym->name);
}
@@ -1897,7 +1897,7 @@ show_namespace (gfc_namespace *ns)
for (op = GFC_INTRINSIC_BEGIN; op != GFC_INTRINSIC_END; op++)
{
/* User operator interfaces */
- intr = ns->operator[op];
+ intr = ns->op[op];
if (intr == NULL)
continue;
diff --git a/gcc/fortran/error.c b/gcc/fortran/error.c
index 4ef22d0cbc2..7a5fbd34711 100644
--- a/gcc/fortran/error.c
+++ b/gcc/fortran/error.c
@@ -754,7 +754,7 @@ gfc_notification_std (int std)
standard does not contain the requested bits. Return FAILURE if
an error is generated. */
-try
+gfc_try
gfc_notify_std (int std, const char *nocmsgid, ...)
{
va_list argp;
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
index 12987e6b748..1e92e1470d9 100644
--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -65,24 +65,24 @@ gfc_free_actual_arglist (gfc_actual_arglist *a1)
gfc_actual_arglist *
gfc_copy_actual_arglist (gfc_actual_arglist *p)
{
- gfc_actual_arglist *head, *tail, *new;
+ gfc_actual_arglist *head, *tail, *new_arg;
head = tail = NULL;
for (; p; p = p->next)
{
- new = gfc_get_actual_arglist ();
- *new = *p;
+ new_arg = gfc_get_actual_arglist ();
+ *new_arg = *p;
- new->expr = gfc_copy_expr (p->expr);
- new->next = NULL;
+ new_arg->expr = gfc_copy_expr (p->expr);
+ new_arg->next = NULL;
if (head == NULL)
- head = new;
+ head = new_arg;
else
- tail->next = new;
+ tail->next = new_arg;
- tail = new;
+ tail = new_arg;
}
return head;
@@ -480,7 +480,7 @@ gfc_copy_expr (gfc_expr *p)
break;
case EXPR_OP:
- switch (q->value.op.operator)
+ switch (q->value.op.op)
{
case INTRINSIC_NOT:
case INTRINSIC_PARENTHESES:
@@ -659,7 +659,7 @@ gfc_type_convert_binary (gfc_expr *e)
e->ts = op1->ts;
/* Special case for ** operator. */
- if (e->value.op.operator == INTRINSIC_POWER)
+ if (e->value.op.op == INTRINSIC_POWER)
goto done;
gfc_convert_type (e->value.op.op2, &e->ts, 2);
@@ -824,18 +824,18 @@ is_subref_array (gfc_expr * e)
/* Try to collapse intrinsic expressions. */
-static try
+static gfc_try
simplify_intrinsic_op (gfc_expr *p, int type)
{
gfc_intrinsic_op op;
gfc_expr *op1, *op2, *result;
- if (p->value.op.operator == INTRINSIC_USER)
+ if (p->value.op.op == INTRINSIC_USER)
return SUCCESS;
op1 = p->value.op.op1;
op2 = p->value.op.op2;
- op = p->value.op.operator;
+ op = p->value.op.op;
if (gfc_simplify_expr (op1, type) == FAILURE)
return FAILURE;
@@ -960,7 +960,7 @@ simplify_intrinsic_op (gfc_expr *p, int type)
/* Subroutine to simplify constructor expressions. Mutually recursive
with gfc_simplify_expr(). */
-static try
+static gfc_try
simplify_constructor (gfc_constructor *c, int type)
{
gfc_expr *p;
@@ -996,7 +996,7 @@ simplify_constructor (gfc_constructor *c, int type)
/* Pull a single array element out of an array constructor. */
-static try
+static gfc_try
find_array_element (gfc_constructor *cons, gfc_array_ref *ar,
gfc_constructor **rval)
{
@@ -1007,7 +1007,7 @@ find_array_element (gfc_constructor *cons, gfc_array_ref *ar,
mpz_t span;
mpz_t tmp;
gfc_expr *e;
- try t;
+ gfc_try t;
t = SUCCESS;
e = NULL;
@@ -1115,7 +1115,7 @@ remove_subobject_ref (gfc_expr *p, gfc_constructor *cons)
/* Pull an array section out of an array constructor. */
-static try
+static gfc_try
find_array_section (gfc_expr *expr, gfc_ref *ref)
{
int idx;
@@ -1142,7 +1142,7 @@ find_array_section (gfc_expr *expr, gfc_ref *ref)
gfc_expr *upper;
gfc_expr *lower;
gfc_constructor *vecsub[GFC_MAX_DIMENSIONS], *c;
- try t;
+ gfc_try t;
t = SUCCESS;
@@ -1373,7 +1373,7 @@ cleanup:
/* Pull a substring out of an expression. */
-static try
+static gfc_try
find_substring_ref (gfc_expr *p, gfc_expr **newp)
{
int end;
@@ -1405,7 +1405,7 @@ find_substring_ref (gfc_expr *p, gfc_expr **newp)
/* Simplify a subobject reference of a constructor. This occurs when
parameter variable values are substituted. */
-static try
+static gfc_try
simplify_const_ref (gfc_expr *p)
{
gfc_constructor *cons;
@@ -1479,7 +1479,7 @@ simplify_const_ref (gfc_expr *p)
/* Simplify a chain of references. */
-static try
+static gfc_try
simplify_ref_chain (gfc_ref *ref, int type)
{
int n;
@@ -1517,11 +1517,11 @@ simplify_ref_chain (gfc_ref *ref, int type)
/* Try to substitute the value of a parameter variable. */
-static try
+static gfc_try
simplify_parameter_variable (gfc_expr *p, int type)
{
gfc_expr *e;
- try t;
+ gfc_try t;
e = gfc_copy_expr (p->symtree->n.sym->value);
if (e == NULL)
@@ -1562,7 +1562,7 @@ simplify_parameter_variable (gfc_expr *p, int type)
Returns FAILURE on error, SUCCESS otherwise.
NOTE: Will return SUCCESS even if the expression can not be simplified. */
-try
+gfc_try
gfc_simplify_expr (gfc_expr *p, int type)
{
gfc_actual_arglist *ap;
@@ -1693,12 +1693,12 @@ et0 (gfc_expr *e)
/* Check an intrinsic arithmetic operation to see if it is consistent
with some type of expression. */
-static try check_init_expr (gfc_expr *);
+static gfc_try check_init_expr (gfc_expr *);
/* Scalarize an expression for an elemental intrinsic call. */
-static try
+static gfc_try
scalarize_intrinsic_call (gfc_expr *e)
{
gfc_actual_arglist *a, *b;
@@ -1831,8 +1831,8 @@ cleanup:
}
-static try
-check_intrinsic_op (gfc_expr *e, try (*check_function) (gfc_expr *))
+static gfc_try
+check_intrinsic_op (gfc_expr *e, gfc_try (*check_function) (gfc_expr *))
{
gfc_expr *op1 = e->value.op.op1;
gfc_expr *op2 = e->value.op.op2;
@@ -1840,7 +1840,7 @@ check_intrinsic_op (gfc_expr *e, try (*check_function) (gfc_expr *))
if ((*check_function) (op1) == FAILURE)
return FAILURE;
- switch (e->value.op.operator)
+ switch (e->value.op.op)
{
case INTRINSIC_UPLUS:
case INTRINSIC_UMINUS:
@@ -1883,7 +1883,7 @@ check_intrinsic_op (gfc_expr *e, try (*check_function) (gfc_expr *))
if (!numeric_type (et0 (op1)) || !numeric_type (et0 (op2)))
goto not_numeric;
- if (e->value.op.operator == INTRINSIC_POWER
+ if (e->value.op.op == INTRINSIC_POWER
&& check_function == check_init_expr && et0 (op2) != BT_INTEGER)
{
if (gfc_notify_std (GFC_STD_F2003,"Fortran 2003: Noninteger "
@@ -2155,12 +2155,11 @@ check_conversion (gfc_expr *e)
intrinsics in the context of initialization expressions. If
FAILURE is returned an error message has been generated. */
-static try
+static gfc_try
check_init_expr (gfc_expr *e)
{
match m;
- try t;
- gfc_intrinsic_sym *isym;
+ gfc_try t;
if (e == NULL)
return SUCCESS;
@@ -2179,7 +2178,12 @@ check_init_expr (gfc_expr *e)
if ((m = check_specification_function (e)) != MATCH_YES)
{
- if ((m = gfc_intrinsic_func_interface (e, 0)) != MATCH_YES)
+ gfc_intrinsic_sym* isym;
+ gfc_symbol* sym;
+
+ sym = e->symtree->n.sym;
+ if (!gfc_is_intrinsic (sym, 0, e->where)
+ || (m = gfc_intrinsic_func_interface (e, 0)) != MATCH_YES)
{
gfc_error ("Function '%s' in initialization expression at %L "
"must be an intrinsic or a specification function",
@@ -2201,7 +2205,7 @@ check_init_expr (gfc_expr *e)
/* Try to scalarize an elemental intrinsic function that has an
array argument. */
- isym = gfc_find_function (e->symtree->n.sym->name);
+ isym = gfc_find_function (e->symtree->n.sym->name);
if (isym && isym->elemental
&& (t = scalarize_intrinsic_call (e)) == SUCCESS)
break;
@@ -2330,7 +2334,7 @@ gfc_match_init_expr (gfc_expr **result)
{
gfc_expr *expr;
match m;
- try t;
+ gfc_try t;
m = gfc_match_expr (&expr);
if (m != MATCH_YES)
@@ -2371,13 +2375,13 @@ gfc_match_init_expr (gfc_expr **result)
}
-static try check_restricted (gfc_expr *);
+static gfc_try check_restricted (gfc_expr *);
/* Given an actual argument list, test to see that each argument is a
restricted expression and optionally if the expression type is
integer or character. */
-static try
+static gfc_try
restricted_args (gfc_actual_arglist *a)
{
for (; a; a = a->next)
@@ -2395,7 +2399,7 @@ restricted_args (gfc_actual_arglist *a)
/* Make sure a non-intrinsic function is a specification function. */
-static try
+static gfc_try
external_spec_function (gfc_expr *e)
{
gfc_symbol *f;
@@ -2437,7 +2441,7 @@ external_spec_function (gfc_expr *e)
/* Check to see that a function reference to an intrinsic is a
restricted expression. */
-static try
+static gfc_try
restricted_intrinsic (gfc_expr *e)
{
/* TODO: Check constraints on inquiry functions. 7.1.6.2 (7). */
@@ -2452,11 +2456,11 @@ restricted_intrinsic (gfc_expr *e)
cousin check_init_expr(), an error message is generated if we
return FAILURE. */
-static try
+static gfc_try
check_restricted (gfc_expr *e)
{
gfc_symbol *sym;
- try t;
+ gfc_try t;
if (e == NULL)
return SUCCESS;
@@ -2564,7 +2568,7 @@ check_restricted (gfc_expr *e)
/* Check to see that an expression is a specification expression. If
we return FAILURE, an error has been generated. */
-try
+gfc_try
gfc_specification_expr (gfc_expr *e)
{
@@ -2607,12 +2611,12 @@ gfc_specification_expr (gfc_expr *e)
/* Given two expressions, make sure that the arrays are conformable. */
-try
+gfc_try
gfc_check_conformance (const char *optype_msgid, gfc_expr *op1, gfc_expr *op2)
{
int op1_flag, op2_flag, d;
mpz_t op1_size, op2_size;
- try t;
+ gfc_try t;
if (op1->rank == 0 || op2->rank == 0)
return SUCCESS;
@@ -2657,7 +2661,7 @@ gfc_check_conformance (const char *optype_msgid, gfc_expr *op1, gfc_expr *op2)
/* Given an assignable expression and an arbitrary expression, make
sure that the assignment can take place. */
-try
+gfc_try
gfc_check_assign (gfc_expr *lvalue, gfc_expr *rvalue, int conform)
{
gfc_symbol *sym;
@@ -2866,7 +2870,7 @@ gfc_check_assign (gfc_expr *lvalue, gfc_expr *rvalue, int conform)
we only check rvalue if it's not an assignment to NULL() or a
NULLIFY statement. */
-try
+gfc_try
gfc_check_pointer_assign (gfc_expr *lvalue, gfc_expr *rvalue)
{
symbol_attribute attr;
@@ -3000,9 +3004,9 @@ gfc_check_pointer_assign (gfc_expr *lvalue, gfc_expr *rvalue)
return FAILURE;
}
- if (attr.protected && attr.use_assoc)
+ if (attr.is_protected && attr.use_assoc)
{
- gfc_error ("Pointer assigment target has PROTECTED "
+ gfc_error ("Pointer assignment target has PROTECTED "
"attribute at %L", &rvalue->where);
return FAILURE;
}
@@ -3014,11 +3018,11 @@ gfc_check_pointer_assign (gfc_expr *lvalue, gfc_expr *rvalue)
/* Relative of gfc_check_assign() except that the lvalue is a single
symbol. Used for initialization assignments. */
-try
+gfc_try
gfc_check_assign_symbol (gfc_symbol *sym, gfc_expr *rvalue)
{
gfc_expr lvalue;
- try r;
+ gfc_try r;
memset (&lvalue, '\0', sizeof (gfc_expr));
diff --git a/gcc/fortran/f95-lang.c b/gcc/fortran/f95-lang.c
index 9dfb4233210..5f39593efd8 100644
--- a/gcc/fortran/f95-lang.c
+++ b/gcc/fortran/f95-lang.c
@@ -29,7 +29,7 @@ along with GCC; see the file COPYING3. If not see
#include "system.h"
#include "coretypes.h"
#include "tree.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "flags.h"
#include "langhooks.h"
#include "langhooks-def.h"
@@ -62,7 +62,7 @@ GTY(())
union lang_tree_node
GTY((desc ("TREE_CODE (&%h.generic) == IDENTIFIER_NODE"),
- chain_next ("(union lang_tree_node *)GENERIC_NEXT (&%h.generic)")))
+ chain_next ("(union lang_tree_node *)TREE_CHAIN (&%h.generic)")))
{
union tree_node GTY((tag ("0"),
@@ -236,7 +236,7 @@ gfc_be_parse_file (int set_yydebug ATTRIBUTE_UNUSED)
cgraph_finalize_compilation_unit ();
cgraph_optimize ();
- /* Tell the frontent about any errors. */
+ /* Tell the frontend about any errors. */
gfc_get_errors (&warnings, &errors);
errorcount += errors;
warningcount += warnings;
@@ -437,7 +437,7 @@ poplevel (int keep, int reverse, int functionbody)
}
else if (current_binding_level == global_binding_level)
/* When using gfc_start_block/gfc_finish_block from middle-end hooks,
- don't add newly created BLOCKs as sublocks of global_binding_level. */
+ don't add newly created BLOCKs as subblocks of global_binding_level. */
;
else if (block_node)
{
@@ -547,7 +547,7 @@ gfc_init_decl_processing (void)
only use it for actual characters, not for INTEGER(1). Also, we
want double_type_node to actually have double precision. */
build_common_tree_nodes (false, false);
- /* x86_64 minw32 has a sizetype of "unsigned long long", most other hosts
+ /* x86_64 mingw32 has a sizetype of "unsigned long long", most other hosts
have a sizetype of "unsigned long". Therefore choose the correct size
in mostly target independent way. */
if (TYPE_MODE (long_unsigned_type_node) == ptr_mode)
@@ -604,7 +604,7 @@ gfc_mark_addressable (tree exp)
IDENTIFIER_POINTER (DECL_NAME (x)));
return false;
}
- pedwarn ("register variable %qs used in nested function",
+ pedwarn (0, "register variable %qs used in nested function",
IDENTIFIER_POINTER (DECL_NAME (x)));
}
else if (DECL_REGISTER (x) && !TREE_ADDRESSABLE (x))
@@ -629,7 +629,7 @@ gfc_mark_addressable (tree exp)
}
#endif
- pedwarn ("address of register variable %qs requested",
+ pedwarn (0, "address of register variable %qs requested",
IDENTIFIER_POINTER (DECL_NAME (x)));
}
diff --git a/gcc/fortran/gfc-internals.texi b/gcc/fortran/gfc-internals.texi
index 330db81c59c..e73d3b59f9a 100644
--- a/gcc/fortran/gfc-internals.texi
+++ b/gcc/fortran/gfc-internals.texi
@@ -34,11 +34,10 @@
Copyright @copyright{} @value{copyrights-gfortran} Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
-under the terms of the GNU Free Documentation License, Version 1.1 or
+under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with the
-Invariant Sections being ``GNU General Public License'' and ``Funding
-Free Software'', the Front-Cover
-texts being (a) (see below), and with the Back-Cover Texts being (b)
+Invariant Sections being ``Funding Free Software'', the Front-Cover
+Texts being (a) (see below), and with the Back-Cover Texts being (b)
(see below). A copy of the license is included in the section entitled
``GNU Free Documentation License''.
diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index aa2296c72a5..ccd2c0305ca 100644
--- a/gcc/fortran/gfortran.h
+++ b/gcc/fortran/gfortran.h
@@ -78,7 +78,7 @@ char *alloca ();
#define stringize(x) expand_macro(x)
#define expand_macro(x) # x
-/* For a the runtime library, a standard prefix is a requirement to
+/* For the runtime library, a standard prefix is a requirement to
avoid cluttering the namespace with things nobody asked for. It's
ugly to look at and a pain to type when you add the prefix by hand,
so we hide it behind a macro. */
@@ -116,7 +116,7 @@ io_kind;
typedef enum
{ SUCCESS = 1, FAILURE }
-try;
+gfc_try;
/* This is returned by gfc_notification_std to know if, given the flags
that were given (-std=, -pedantic) we should issue an error, a warning
@@ -302,7 +302,7 @@ extern const mstring save_status[];
enum gfc_isym_id
{
/* GFC_ISYM_NONE is used for intrinsics which will never be seen by
- the backend (eg. KIND). */
+ the backend (e.g. KIND). */
GFC_ISYM_NONE = 0,
GFC_ISYM_ABORT,
GFC_ISYM_ABS,
@@ -625,7 +625,7 @@ typedef struct
ENUM_BITFIELD (save_state) save:2;
unsigned data:1, /* Symbol is named in a DATA statement. */
- protected:1, /* Symbol has been marked as protected. */
+ is_protected:1, /* Symbol has been marked as protected. */
use_assoc:1, /* Symbol has been use-associated. */
use_only:1, /* Symbol has been use-associated, with ONLY. */
use_rename:1, /* Symbol has been use-associated and renamed. */
@@ -638,6 +638,7 @@ typedef struct
unsigned untyped:1; /* No implicit type could be found. */
unsigned is_bind_c:1; /* say if is bound to C */
+ unsigned extension:1; /* extends a derived type */
/* These flags are both in the typespec and attribute. The attribute
list is what gets read from/written to a module file. The typespec
@@ -691,7 +692,7 @@ typedef struct
unsigned cray_pointer:1, cray_pointee:1;
/* The symbol is a derived type with allocatable components, pointer
- components or private components, possibly nested. zer_comp
+ components or private components, possibly nested. zero_comp
is true if the derived type has no component at all. */
unsigned alloc_comp:1, pointer_comp:1, private_comp:1, zero_comp:1;
@@ -980,13 +981,12 @@ gfc_interface;
#define gfc_get_interface() XCNEW (gfc_interface)
-
/* User operator nodes. These are like stripped down symbols. */
typedef struct
{
const char *name;
- gfc_interface *operator;
+ gfc_interface *op;
struct gfc_namespace *ns;
gfc_access access;
}
@@ -1017,9 +1017,6 @@ typedef struct gfc_symbol
gfc_formal_arglist *formal;
struct gfc_namespace *formal_ns;
-
- /* The namespace containing type-associated procedure symbols. */
- /* TODO: Make this union with formal? */
struct gfc_namespace *f2k_derived;
struct gfc_expr *value; /* Parameter/Initializer value */
@@ -1052,7 +1049,7 @@ typedef struct gfc_symbol
the old symbol. */
struct gfc_symbol *old_symbol, *tlink;
- unsigned mark:1, new:1;
+ unsigned mark:1, gfc_new:1;
/* Nonzero if all equivalences associated with this symbol have been
processed. */
unsigned equiv_built:1;
@@ -1179,7 +1176,7 @@ typedef struct gfc_namespace
/* Points to the equivalence groups produced by trans_common. */
struct gfc_equiv_list *equiv_lists;
- gfc_interface *operator[GFC_INTRINSIC_OPS];
+ gfc_interface *op[GFC_INTRINSIC_OPS];
/* Points to the parent namespace, i.e. the namespace of a module or
procedure in which the procedure belonging to this namespace is
@@ -1346,16 +1343,16 @@ gfc_intrinsic_arg;
typedef union
{
- try (*f0)(void);
- try (*f1)(struct gfc_expr *);
- try (*f1m)(gfc_actual_arglist *);
- try (*f2)(struct gfc_expr *, struct gfc_expr *);
- try (*f3)(struct gfc_expr *, struct gfc_expr *, struct gfc_expr *);
- try (*f3ml)(gfc_actual_arglist *);
- try (*f3red)(gfc_actual_arglist *);
- try (*f4)(struct gfc_expr *, struct gfc_expr *, struct gfc_expr *,
+ gfc_try (*f0)(void);
+ gfc_try (*f1)(struct gfc_expr *);
+ gfc_try (*f1m)(gfc_actual_arglist *);
+ gfc_try (*f2)(struct gfc_expr *, struct gfc_expr *);
+ gfc_try (*f3)(struct gfc_expr *, struct gfc_expr *, struct gfc_expr *);
+ gfc_try (*f3ml)(gfc_actual_arglist *);
+ gfc_try (*f3red)(gfc_actual_arglist *);
+ gfc_try (*f4)(struct gfc_expr *, struct gfc_expr *, struct gfc_expr *,
struct gfc_expr *);
- try (*f5)(struct gfc_expr *, struct gfc_expr *, struct gfc_expr *,
+ gfc_try (*f5)(struct gfc_expr *, struct gfc_expr *, struct gfc_expr *,
struct gfc_expr *, struct gfc_expr *);
}
gfc_check_f;
@@ -1490,7 +1487,7 @@ typedef struct gfc_expr
struct
{
- gfc_intrinsic_op operator;
+ gfc_intrinsic_op op;
gfc_user_op *uop;
struct gfc_expr *op1, *op2;
}
@@ -1871,7 +1868,10 @@ typedef struct
int warn_surprising;
int warn_tabs;
int warn_underflow;
+ int warn_intrinsic_shadow;
+ int warn_intrinsics_std;
int warn_character_truncation;
+ int warn_array_temp;
int max_errors;
int flag_all_intrinsics;
@@ -1891,6 +1891,7 @@ typedef struct
int flag_automatic;
int flag_backslash;
int flag_backtrace;
+ int flag_check_array_temporaries;
int flag_allow_leading_underscore;
int flag_dump_core;
int flag_external_blas;
@@ -1913,7 +1914,6 @@ typedef struct
int warn_std;
int allow_std;
- int warn_nonstd_intrinsics;
int fshort_enums;
int convert;
int record_marker;
@@ -1958,10 +1958,20 @@ extern iterator_stack *iter_stack;
typedef struct gfc_finalizer
{
struct gfc_finalizer* next;
- gfc_symbol* procedure;
- locus where; /* Where the FINAL declaration occured. */
+ locus where; /* Where the FINAL declaration occurred. */
+
+ /* Up to resolution, we want the gfc_symbol, there we lookup the corresponding
+ symtree and later need only that. This way, we can access and call the
+ finalizers from every context as they should be "always accessible". I
+ don't make this a union because we need the information whether proc_sym is
+ still referenced or not for dereferencing it on deleting a gfc_finalizer
+ structure. */
+ gfc_symbol* proc_sym;
+ gfc_symtree* proc_tree;
}
gfc_finalizer;
+#define gfc_get_finalizer() XCNEW (gfc_finalizer)
+
/************************ Function prototypes *************************/
@@ -2007,7 +2017,7 @@ gfc_char_t gfc_peek_char (void);
char gfc_peek_ascii_char (void);
void gfc_error_recovery (void);
void gfc_gobble_whitespace (void);
-try gfc_new_file (void);
+gfc_try gfc_new_file (void);
const char * gfc_read_orig_filename (const char *, const char **);
extern gfc_source_form gfc_current_form;
@@ -2074,7 +2084,7 @@ int gfc_error_check (void);
int gfc_error_flag_test (void);
notification gfc_notification_std (int);
-try gfc_notify_std (int, const char *, ...) ATTRIBUTE_GCC_GFC(2,3);
+gfc_try gfc_notify_std (int, const char *, ...) ATTRIBUTE_GCC_GFC(2,3);
/* A general purpose syntax error. */
#define gfc_syntax_error(ST) \
@@ -2094,8 +2104,8 @@ arith gfc_check_integer_range (mpz_t p, int kind);
bool gfc_check_character_range (gfc_char_t, int);
/* trans-types.c */
-try gfc_validate_c_kind (gfc_typespec *);
-try gfc_check_any_c_kind (gfc_typespec *);
+gfc_try gfc_validate_c_kind (gfc_typespec *);
+gfc_try gfc_check_any_c_kind (gfc_typespec *);
int gfc_validate_kind (bt, int, bool);
extern int gfc_index_integer_kind;
extern int gfc_default_integer_kind;
@@ -2113,69 +2123,70 @@ extern int gfc_character_storage_size;
/* symbol.c */
void gfc_clear_new_implicit (void);
-try gfc_add_new_implicit_range (int, int);
-try gfc_merge_new_implicit (gfc_typespec *);
+gfc_try gfc_add_new_implicit_range (int, int);
+gfc_try gfc_merge_new_implicit (gfc_typespec *);
void gfc_set_implicit_none (void);
void gfc_check_function_type (gfc_namespace *);
bool gfc_is_intrinsic_typename (const char *);
gfc_typespec *gfc_get_default_type (gfc_symbol *, gfc_namespace *);
-try gfc_set_default_type (gfc_symbol *, int, gfc_namespace *);
+gfc_try gfc_set_default_type (gfc_symbol *, int, gfc_namespace *);
void gfc_set_component_attr (gfc_component *, symbol_attribute *);
void gfc_get_component_attr (symbol_attribute *, gfc_component *);
void gfc_set_sym_referenced (gfc_symbol *);
-try gfc_add_attribute (symbol_attribute *, locus *);
-try gfc_add_allocatable (symbol_attribute *, locus *);
-try gfc_add_dimension (symbol_attribute *, const char *, locus *);
-try gfc_add_external (symbol_attribute *, locus *);
-try gfc_add_intrinsic (symbol_attribute *, locus *);
-try gfc_add_optional (symbol_attribute *, locus *);
-try gfc_add_pointer (symbol_attribute *, locus *);
-try gfc_add_cray_pointer (symbol_attribute *, locus *);
-try gfc_add_cray_pointee (symbol_attribute *, locus *);
-try gfc_mod_pointee_as (gfc_array_spec *);
-try gfc_add_protected (symbol_attribute *, const char *, locus *);
-try gfc_add_result (symbol_attribute *, const char *, locus *);
-try gfc_add_save (symbol_attribute *, const char *, locus *);
-try gfc_add_threadprivate (symbol_attribute *, const char *, locus *);
-try gfc_add_saved_common (symbol_attribute *, locus *);
-try gfc_add_target (symbol_attribute *, locus *);
-try gfc_add_dummy (symbol_attribute *, const char *, locus *);
-try gfc_add_generic (symbol_attribute *, const char *, locus *);
-try gfc_add_common (symbol_attribute *, locus *);
-try gfc_add_in_common (symbol_attribute *, const char *, locus *);
-try gfc_add_in_equivalence (symbol_attribute *, const char *, locus *);
-try gfc_add_data (symbol_attribute *, const char *, locus *);
-try gfc_add_in_namelist (symbol_attribute *, const char *, locus *);
-try gfc_add_sequence (symbol_attribute *, const char *, locus *);
-try gfc_add_elemental (symbol_attribute *, locus *);
-try gfc_add_pure (symbol_attribute *, locus *);
-try gfc_add_recursive (symbol_attribute *, locus *);
-try gfc_add_function (symbol_attribute *, const char *, locus *);
-try gfc_add_subroutine (symbol_attribute *, const char *, locus *);
-try gfc_add_volatile (symbol_attribute *, const char *, locus *);
-try gfc_add_proc (symbol_attribute *attr, const char *name, locus *where);
-
-try gfc_add_access (symbol_attribute *, gfc_access, const char *, locus *);
-try gfc_add_is_bind_c(symbol_attribute *, const char *, locus *, int);
-try gfc_add_value (symbol_attribute *, const char *, locus *);
-try gfc_add_flavor (symbol_attribute *, sym_flavor, const char *, locus *);
-try gfc_add_entry (symbol_attribute *, const char *, locus *);
-try gfc_add_procedure (symbol_attribute *, procedure_type,
+gfc_try gfc_add_attribute (symbol_attribute *, locus *);
+gfc_try gfc_add_allocatable (symbol_attribute *, locus *);
+gfc_try gfc_add_dimension (symbol_attribute *, const char *, locus *);
+gfc_try gfc_add_external (symbol_attribute *, locus *);
+gfc_try gfc_add_intrinsic (symbol_attribute *, locus *);
+gfc_try gfc_add_optional (symbol_attribute *, locus *);
+gfc_try gfc_add_pointer (symbol_attribute *, locus *);
+gfc_try gfc_add_cray_pointer (symbol_attribute *, locus *);
+gfc_try gfc_add_cray_pointee (symbol_attribute *, locus *);
+gfc_try gfc_mod_pointee_as (gfc_array_spec *);
+gfc_try gfc_add_protected (symbol_attribute *, const char *, locus *);
+gfc_try gfc_add_result (symbol_attribute *, const char *, locus *);
+gfc_try gfc_add_save (symbol_attribute *, const char *, locus *);
+gfc_try gfc_add_threadprivate (symbol_attribute *, const char *, locus *);
+gfc_try gfc_add_saved_common (symbol_attribute *, locus *);
+gfc_try gfc_add_target (symbol_attribute *, locus *);
+gfc_try gfc_add_dummy (symbol_attribute *, const char *, locus *);
+gfc_try gfc_add_generic (symbol_attribute *, const char *, locus *);
+gfc_try gfc_add_common (symbol_attribute *, locus *);
+gfc_try gfc_add_in_common (symbol_attribute *, const char *, locus *);
+gfc_try gfc_add_in_equivalence (symbol_attribute *, const char *, locus *);
+gfc_try gfc_add_data (symbol_attribute *, const char *, locus *);
+gfc_try gfc_add_in_namelist (symbol_attribute *, const char *, locus *);
+gfc_try gfc_add_sequence (symbol_attribute *, const char *, locus *);
+gfc_try gfc_add_elemental (symbol_attribute *, locus *);
+gfc_try gfc_add_pure (symbol_attribute *, locus *);
+gfc_try gfc_add_recursive (symbol_attribute *, locus *);
+gfc_try gfc_add_function (symbol_attribute *, const char *, locus *);
+gfc_try gfc_add_subroutine (symbol_attribute *, const char *, locus *);
+gfc_try gfc_add_volatile (symbol_attribute *, const char *, locus *);
+gfc_try gfc_add_proc (symbol_attribute *attr, const char *name, locus *where);
+
+gfc_try gfc_add_access (symbol_attribute *, gfc_access, const char *, locus *);
+gfc_try gfc_add_is_bind_c (symbol_attribute *, const char *, locus *, int);
+gfc_try gfc_add_extension (symbol_attribute *, locus *);
+gfc_try gfc_add_value (symbol_attribute *, const char *, locus *);
+gfc_try gfc_add_flavor (symbol_attribute *, sym_flavor, const char *, locus *);
+gfc_try gfc_add_entry (symbol_attribute *, const char *, locus *);
+gfc_try gfc_add_procedure (symbol_attribute *, procedure_type,
const char *, locus *);
-try gfc_add_intent (symbol_attribute *, sym_intent, locus *);
-try gfc_add_explicit_interface (gfc_symbol *, ifsrc,
+gfc_try gfc_add_intent (symbol_attribute *, sym_intent, locus *);
+gfc_try gfc_add_explicit_interface (gfc_symbol *, ifsrc,
gfc_formal_arglist *, locus *);
-try gfc_add_type (gfc_symbol *, gfc_typespec *, locus *);
+gfc_try gfc_add_type (gfc_symbol *, gfc_typespec *, locus *);
void gfc_clear_attr (symbol_attribute *);
-try gfc_missing_attr (symbol_attribute *, locus *);
-try gfc_copy_attr (symbol_attribute *, symbol_attribute *, locus *);
+gfc_try gfc_missing_attr (symbol_attribute *, locus *);
+gfc_try gfc_copy_attr (symbol_attribute *, symbol_attribute *, locus *);
-try gfc_add_component (gfc_symbol *, const char *, gfc_component **);
+gfc_try gfc_add_component (gfc_symbol *, const char *, gfc_component **);
gfc_symbol *gfc_use_derived (gfc_symbol *);
gfc_symtree *gfc_use_derived_tree (gfc_symtree *);
gfc_component *gfc_find_component (gfc_symbol *, const char *);
@@ -2183,7 +2194,7 @@ gfc_component *gfc_find_component (gfc_symbol *, const char *);
gfc_st_label *gfc_get_st_label (int);
void gfc_free_st_label (gfc_st_label *);
void gfc_define_st_label (gfc_st_label *, gfc_sl_type, locus *);
-try gfc_reference_st_label (gfc_st_label *, gfc_sl_type);
+gfc_try gfc_reference_st_label (gfc_st_label *, gfc_sl_type);
gfc_expr * gfc_lval_expr_from_sym (gfc_symbol *);
@@ -2199,11 +2210,11 @@ gfc_symbol *gfc_new_symbol (const char *, gfc_namespace *);
int gfc_find_symbol (const char *, gfc_namespace *, int, gfc_symbol **);
int gfc_find_sym_tree (const char *, gfc_namespace *, int, gfc_symtree **);
int gfc_get_symbol (const char *, gfc_namespace *, gfc_symbol **);
-try verify_c_interop (gfc_typespec *, const char *name, locus *where);
-try verify_c_interop_param (gfc_symbol *);
-try verify_bind_c_sym (gfc_symbol *, gfc_typespec *, int, gfc_common_head *);
-try verify_bind_c_derived_type (gfc_symbol *);
-try verify_com_block_vars_c_interop (gfc_common_head *);
+gfc_try verify_c_interop (gfc_typespec *, const char *name, locus *where);
+gfc_try verify_c_interop_param (gfc_symbol *);
+gfc_try verify_bind_c_sym (gfc_symbol *, gfc_typespec *, int, gfc_common_head *);
+gfc_try verify_bind_c_derived_type (gfc_symbol *);
+gfc_try verify_com_block_vars_c_interop (gfc_common_head *);
void generate_isocbinding_symbol (const char *, iso_c_binding_symbol, const char *);
gfc_symbol *get_iso_c_sym (gfc_symbol *, char *, char *, int);
int gfc_get_sym_tree (const char *, gfc_namespace *, gfc_symtree **);
@@ -2248,12 +2259,12 @@ void gfc_intrinsic_done_1 (void);
char gfc_type_letter (bt);
gfc_symbol * gfc_get_intrinsic_sub_symbol (const char *);
-try gfc_convert_type (gfc_expr *, gfc_typespec *, int);
-try gfc_convert_type_warn (gfc_expr *, gfc_typespec *, int, int);
-try gfc_convert_chartype (gfc_expr *, gfc_typespec *);
+gfc_try gfc_convert_type (gfc_expr *, gfc_typespec *, int);
+gfc_try gfc_convert_type_warn (gfc_expr *, gfc_typespec *, int, int);
+gfc_try gfc_convert_chartype (gfc_expr *, gfc_typespec *);
int gfc_generic_intrinsic (const char *);
int gfc_specific_intrinsic (const char *);
-int gfc_intrinsic_name (const char *, int);
+bool gfc_is_intrinsic (gfc_symbol*, int, locus);
int gfc_intrinsic_actual_ok (const char *, const bool);
gfc_intrinsic_sym *gfc_find_function (const char *);
gfc_intrinsic_sym *gfc_find_subroutine (const char *);
@@ -2261,6 +2272,10 @@ gfc_intrinsic_sym *gfc_find_subroutine (const char *);
match gfc_intrinsic_func_interface (gfc_expr *, int);
match gfc_intrinsic_sub_interface (gfc_code *, int);
+void gfc_warn_intrinsic_shadow (const gfc_symbol*, bool, bool);
+gfc_try gfc_check_intrinsic_standard (const gfc_intrinsic_sym*, const char**,
+ bool, locus);
+
/* match.c -- FIXME */
void gfc_free_iterator (gfc_iterator *, int);
void gfc_free_forall_iterator (gfc_forall_iterator *);
@@ -2291,7 +2306,7 @@ gfc_expr *gfc_build_conversion (gfc_expr *);
void gfc_free_ref_list (gfc_ref *);
void gfc_type_convert_binary (gfc_expr *);
int gfc_is_constant_expr (gfc_expr *);
-try gfc_simplify_expr (gfc_expr *, int);
+gfc_try gfc_simplify_expr (gfc_expr *, int);
int gfc_has_vector_index (gfc_expr *);
gfc_expr *gfc_get_expr (void);
@@ -2303,15 +2318,15 @@ mpz_t *gfc_copy_shape (mpz_t *, int);
mpz_t *gfc_copy_shape_excluding (mpz_t *, int, gfc_expr *);
gfc_expr *gfc_copy_expr (gfc_expr *);
-try gfc_specification_expr (gfc_expr *);
+gfc_try gfc_specification_expr (gfc_expr *);
int gfc_numeric_ts (gfc_typespec *);
int gfc_kind_max (gfc_expr *, gfc_expr *);
-try gfc_check_conformance (const char *, gfc_expr *, gfc_expr *);
-try gfc_check_assign (gfc_expr *, gfc_expr *, int);
-try gfc_check_pointer_assign (gfc_expr *, gfc_expr *);
-try gfc_check_assign_symbol (gfc_symbol *, gfc_expr *);
+gfc_try gfc_check_conformance (const char *, gfc_expr *, gfc_expr *);
+gfc_try gfc_check_assign (gfc_expr *, gfc_expr *, int);
+gfc_try gfc_check_pointer_assign (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_assign_symbol (gfc_symbol *, gfc_expr *);
gfc_expr *gfc_default_initializer (gfc_typespec *);
gfc_expr *gfc_get_variable_expr (gfc_symtree *);
@@ -2331,16 +2346,16 @@ void gfc_free_statement (gfc_code *);
void gfc_free_statements (gfc_code *);
/* resolve.c */
-try gfc_resolve_expr (gfc_expr *);
+gfc_try gfc_resolve_expr (gfc_expr *);
void gfc_resolve (gfc_namespace *);
void gfc_resolve_blocks (gfc_code *, gfc_namespace *);
int gfc_impure_variable (gfc_symbol *);
int gfc_pure (gfc_symbol *);
int gfc_elemental (gfc_symbol *);
-try gfc_resolve_iterator (gfc_iterator *, bool);
-try find_forall_index (gfc_expr *, gfc_symbol *, int);
-try gfc_resolve_index (gfc_expr *, int);
-try gfc_resolve_dim_arg (gfc_expr *);
+gfc_try gfc_resolve_iterator (gfc_iterator *, bool);
+gfc_try find_forall_index (gfc_expr *, gfc_symbol *, int);
+gfc_try gfc_resolve_index (gfc_expr *, int);
+gfc_try gfc_resolve_dim_arg (gfc_expr *);
int gfc_is_formal_arg (void);
void gfc_resolve_substring_charlen (gfc_expr *);
match gfc_iso_c_sub_interface(gfc_code *, gfc_symbol *);
@@ -2350,9 +2365,9 @@ match gfc_iso_c_sub_interface(gfc_code *, gfc_symbol *);
void gfc_free_array_spec (gfc_array_spec *);
gfc_array_ref *gfc_copy_array_ref (gfc_array_ref *);
-try gfc_set_array_spec (gfc_symbol *, gfc_array_spec *, locus *);
+gfc_try gfc_set_array_spec (gfc_symbol *, gfc_array_spec *, locus *);
gfc_array_spec *gfc_copy_array_spec (gfc_array_spec *);
-try gfc_resolve_array_spec (gfc_array_spec *, int);
+gfc_try gfc_resolve_array_spec (gfc_array_spec *, int);
int gfc_compare_array_spec (gfc_array_spec *, gfc_array_spec *);
@@ -2360,25 +2375,25 @@ gfc_expr *gfc_start_constructor (bt, int, locus *);
void gfc_append_constructor (gfc_expr *, gfc_expr *);
void gfc_free_constructor (gfc_constructor *);
void gfc_simplify_iterator_var (gfc_expr *);
-try gfc_expand_constructor (gfc_expr *);
+gfc_try gfc_expand_constructor (gfc_expr *);
int gfc_constant_ac (gfc_expr *);
int gfc_expanded_ac (gfc_expr *);
-try gfc_resolve_character_array_constructor (gfc_expr *);
-try gfc_resolve_array_constructor (gfc_expr *);
-try gfc_check_constructor_type (gfc_expr *);
-try gfc_check_iter_variable (gfc_expr *);
-try gfc_check_constructor (gfc_expr *, try (*)(gfc_expr *));
+gfc_try gfc_resolve_character_array_constructor (gfc_expr *);
+gfc_try gfc_resolve_array_constructor (gfc_expr *);
+gfc_try gfc_check_constructor_type (gfc_expr *);
+gfc_try gfc_check_iter_variable (gfc_expr *);
+gfc_try gfc_check_constructor (gfc_expr *, gfc_try (*)(gfc_expr *));
gfc_constructor *gfc_copy_constructor (gfc_constructor *);
gfc_expr *gfc_get_array_element (gfc_expr *, int);
-try gfc_array_size (gfc_expr *, mpz_t *);
-try gfc_array_dimen_size (gfc_expr *, int, mpz_t *);
-try gfc_array_ref_shape (gfc_array_ref *, mpz_t *);
+gfc_try gfc_array_size (gfc_expr *, mpz_t *);
+gfc_try gfc_array_dimen_size (gfc_expr *, int, mpz_t *);
+gfc_try gfc_array_ref_shape (gfc_array_ref *, mpz_t *);
gfc_array_ref *gfc_find_array_ref (gfc_expr *);
void gfc_insert_constructor (gfc_expr *, gfc_constructor *);
gfc_constructor *gfc_get_constructor (void);
tree gfc_conv_array_initializer (tree type, gfc_expr *);
-try spec_size (gfc_array_spec *, mpz_t *);
-try spec_dimen_size (gfc_array_spec *, int, mpz_t *);
+gfc_try spec_size (gfc_array_spec *, mpz_t *);
+gfc_try spec_dimen_size (gfc_array_spec *, int, mpz_t *);
int gfc_is_compile_time_shape (gfc_array_spec *);
/* interface.c -- FIXME: some of these should be in symbol.c */
@@ -2389,28 +2404,29 @@ void gfc_check_interfaces (gfc_namespace *);
void gfc_procedure_use (gfc_symbol *, gfc_actual_arglist **, locus *);
gfc_symbol *gfc_search_interface (gfc_interface *, int,
gfc_actual_arglist **);
-try gfc_extend_expr (gfc_expr *);
+gfc_try gfc_extend_expr (gfc_expr *);
void gfc_free_formal_arglist (gfc_formal_arglist *);
-try gfc_extend_assign (gfc_code *, gfc_namespace *);
-try gfc_add_interface (gfc_symbol *);
+gfc_try gfc_extend_assign (gfc_code *, gfc_namespace *);
+gfc_try gfc_add_interface (gfc_symbol *);
gfc_interface *gfc_current_interface_head (void);
void gfc_set_current_interface_head (gfc_interface *);
+gfc_symtree* gfc_find_sym_in_symtree (gfc_symbol*);
/* io.c */
extern gfc_st_label format_asterisk;
void gfc_free_open (gfc_open *);
-try gfc_resolve_open (gfc_open *);
+gfc_try gfc_resolve_open (gfc_open *);
void gfc_free_close (gfc_close *);
-try gfc_resolve_close (gfc_close *);
+gfc_try gfc_resolve_close (gfc_close *);
void gfc_free_filepos (gfc_filepos *);
-try gfc_resolve_filepos (gfc_filepos *);
+gfc_try gfc_resolve_filepos (gfc_filepos *);
void gfc_free_inquire (gfc_inquire *);
-try gfc_resolve_inquire (gfc_inquire *);
+gfc_try gfc_resolve_inquire (gfc_inquire *);
void gfc_free_dt (gfc_dt *);
-try gfc_resolve_dt (gfc_dt *);
+gfc_try gfc_resolve_dt (gfc_dt *);
void gfc_free_wait (gfc_wait *);
-try gfc_resolve_wait (gfc_wait *);
+gfc_try gfc_resolve_wait (gfc_wait *);
/* module.c */
void gfc_module_init_2 (void);
@@ -2437,7 +2453,7 @@ void gfc_delete_bbt (void *, void *, compare_fn);
void gfc_dump_parse_tree (gfc_namespace *, FILE *);
/* parse.c */
-try gfc_parse_file (void);
+gfc_try gfc_parse_file (void);
void gfc_global_used (gfc_gsymbol *, locus *);
/* dependency.c */
diff --git a/gcc/fortran/gfortran.texi b/gcc/fortran/gfortran.texi
index cf90ceda833..c79a70a407a 100644
--- a/gcc/fortran/gfortran.texi
+++ b/gcc/fortran/gfortran.texi
@@ -80,11 +80,10 @@
Copyright @copyright{} @value{copyrights-gfortran} Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
-under the terms of the GNU Free Documentation License, Version 1.1 or
+under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with the
-Invariant Sections being ``GNU General Public License'' and ``Funding
-Free Software'', the Front-Cover
-texts being (a) (see below), and with the Back-Cover Texts being (b)
+Invariant Sections being ``Funding Free Software'', the Front-Cover
+Texts being (a) (see below), and with the Back-Cover Texts being (b)
(see below). A copy of the license is included in the section entitled
``GNU Free Documentation License''.
diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c
index a20319976bb..ba384013032 100644
--- a/gcc/fortran/interface.c
+++ b/gcc/fortran/interface.c
@@ -95,32 +95,32 @@ gfc_free_interface (gfc_interface *intr)
minus respectively, leaving the rest unchanged. */
static gfc_intrinsic_op
-fold_unary (gfc_intrinsic_op operator)
+fold_unary (gfc_intrinsic_op op)
{
- switch (operator)
+ switch (op)
{
case INTRINSIC_UPLUS:
- operator = INTRINSIC_PLUS;
+ op = INTRINSIC_PLUS;
break;
case INTRINSIC_UMINUS:
- operator = INTRINSIC_MINUS;
+ op = INTRINSIC_MINUS;
break;
default:
break;
}
- return operator;
+ return op;
}
/* Match a generic specification. Depending on which type of
- interface is found, the 'name' or 'operator' pointers may be set.
+ interface is found, the 'name' or 'op' pointers may be set.
This subroutine doesn't return MATCH_NO. */
match
gfc_match_generic_spec (interface_type *type,
char *name,
- gfc_intrinsic_op *operator)
+ gfc_intrinsic_op *op)
{
char buffer[GFC_MAX_SYMBOL_LEN + 1];
match m;
@@ -129,14 +129,14 @@ gfc_match_generic_spec (interface_type *type,
if (gfc_match (" assignment ( = )") == MATCH_YES)
{
*type = INTERFACE_INTRINSIC_OP;
- *operator = INTRINSIC_ASSIGN;
+ *op = INTRINSIC_ASSIGN;
return MATCH_YES;
}
if (gfc_match (" operator ( %o )", &i) == MATCH_YES)
{ /* Operator i/f */
*type = INTERFACE_INTRINSIC_OP;
- *operator = fold_unary (i);
+ *op = fold_unary (i);
return MATCH_YES;
}
@@ -184,12 +184,12 @@ gfc_match_interface (void)
char name[GFC_MAX_SYMBOL_LEN + 1];
interface_type type;
gfc_symbol *sym;
- gfc_intrinsic_op operator;
+ gfc_intrinsic_op op;
match m;
m = gfc_match_space ();
- if (gfc_match_generic_spec (&type, name, &operator) == MATCH_ERROR)
+ if (gfc_match_generic_spec (&type, name, &op) == MATCH_ERROR)
return MATCH_ERROR;
/* If we're not looking at the end of the statement now, or if this
@@ -229,7 +229,7 @@ gfc_match_interface (void)
break;
case INTERFACE_INTRINSIC_OP:
- current_interface.op = operator;
+ current_interface.op = op;
break;
case INTERFACE_NAMELESS:
@@ -275,12 +275,12 @@ gfc_match_end_interface (void)
{
char name[GFC_MAX_SYMBOL_LEN + 1];
interface_type type;
- gfc_intrinsic_op operator;
+ gfc_intrinsic_op op;
match m;
m = gfc_match_space ();
- if (gfc_match_generic_spec (&type, name, &operator) == MATCH_ERROR)
+ if (gfc_match_generic_spec (&type, name, &op) == MATCH_ERROR)
return MATCH_ERROR;
/* If we're not looking at the end of the statement now, or if this
@@ -308,7 +308,7 @@ gfc_match_end_interface (void)
break;
case INTERFACE_INTRINSIC_OP:
- if (type != current_interface.type || operator != current_interface.op)
+ if (type != current_interface.type || op != current_interface.op)
{
if (current_interface.op == INTRINSIC_ASSIGN)
@@ -538,7 +538,7 @@ find_keyword_arg (const char *name, gfc_formal_arglist *f)
interfaces for that operator are legal. */
static void
-check_operator_interface (gfc_interface *intr, gfc_intrinsic_op operator)
+check_operator_interface (gfc_interface *intr, gfc_intrinsic_op op)
{
gfc_formal_arglist *formal;
sym_intent i1, i2;
@@ -585,10 +585,10 @@ check_operator_interface (gfc_interface *intr, gfc_intrinsic_op operator)
/* Only +, - and .not. can be unary operators.
.not. cannot be a binary operator. */
- if (args == 0 || args > 2 || (args == 1 && operator != INTRINSIC_PLUS
- && operator != INTRINSIC_MINUS
- && operator != INTRINSIC_NOT)
- || (args == 2 && operator == INTRINSIC_NOT))
+ if (args == 0 || args > 2 || (args == 1 && op != INTRINSIC_PLUS
+ && op != INTRINSIC_MINUS
+ && op != INTRINSIC_NOT)
+ || (args == 2 && op == INTRINSIC_NOT))
{
gfc_error ("Operator interface at %L has the wrong number of arguments",
&intr->sym->declared_at);
@@ -597,7 +597,7 @@ check_operator_interface (gfc_interface *intr, gfc_intrinsic_op operator)
/* Check that intrinsics are mapped to functions, except
INTRINSIC_ASSIGN which should map to a subroutine. */
- if (operator == INTRINSIC_ASSIGN)
+ if (op == INTRINSIC_ASSIGN)
{
if (!sym->attr.subroutine)
{
@@ -638,7 +638,7 @@ check_operator_interface (gfc_interface *intr, gfc_intrinsic_op operator)
}
/* Check intents on operator interfaces. */
- if (operator == INTRINSIC_ASSIGN)
+ if (op == INTRINSIC_ASSIGN)
{
if (i1 != INTENT_OUT && i1 != INTENT_INOUT)
gfc_error ("First argument of defined assignment at %L must be "
@@ -674,7 +674,7 @@ check_operator_interface (gfc_interface *intr, gfc_intrinsic_op operator)
((t) == BT_INTEGER || (t) == BT_REAL || (t) == BT_COMPLEX)
/* Unary ops are easy, do them first. */
- if (operator == INTRINSIC_NOT)
+ if (op == INTRINSIC_NOT)
{
if (t1 == BT_LOGICAL)
goto bad_repl;
@@ -682,7 +682,7 @@ check_operator_interface (gfc_interface *intr, gfc_intrinsic_op operator)
return;
}
- if (args == 1 && (operator == INTRINSIC_PLUS || operator == INTRINSIC_MINUS))
+ if (args == 1 && (op == INTRINSIC_PLUS || op == INTRINSIC_MINUS))
{
if (IS_NUMERIC_TYPE (t1))
goto bad_repl;
@@ -702,7 +702,7 @@ check_operator_interface (gfc_interface *intr, gfc_intrinsic_op operator)
if (r1 != r2 && r1 != 0 && r2 != 0)
return;
- switch (operator)
+ switch (op)
{
case INTRINSIC_EQ:
case INTRINSIC_EQ_OS:
@@ -1243,7 +1243,7 @@ check_uop_interfaces (gfc_user_op *uop)
gfc_namespace *ns;
sprintf (interface_name, "operator interface '%s'", uop->name);
- if (check_interface0 (uop->operator, interface_name))
+ if (check_interface0 (uop->op, interface_name))
return;
for (ns = gfc_current_ns; ns; ns = ns->parent)
@@ -1252,7 +1252,7 @@ check_uop_interfaces (gfc_user_op *uop)
if (uop2 == NULL)
continue;
- check_interface1 (uop->operator, uop2->operator, 0,
+ check_interface1 (uop->op, uop2->op, 0,
interface_name, true);
}
}
@@ -1288,76 +1288,76 @@ gfc_check_interfaces (gfc_namespace *ns)
sprintf (interface_name, "intrinsic '%s' operator",
gfc_op2string (i));
- if (check_interface0 (ns->operator[i], interface_name))
+ if (check_interface0 (ns->op[i], interface_name))
continue;
- check_operator_interface (ns->operator[i], i);
+ check_operator_interface (ns->op[i], i);
for (ns2 = ns; ns2; ns2 = ns2->parent)
{
- if (check_interface1 (ns->operator[i], ns2->operator[i], 0,
+ if (check_interface1 (ns->op[i], ns2->op[i], 0,
interface_name, true))
goto done;
switch (i)
{
case INTRINSIC_EQ:
- if (check_interface1 (ns->operator[i], ns2->operator[INTRINSIC_EQ_OS],
+ if (check_interface1 (ns->op[i], ns2->op[INTRINSIC_EQ_OS],
0, interface_name, true)) goto done;
break;
case INTRINSIC_EQ_OS:
- if (check_interface1 (ns->operator[i], ns2->operator[INTRINSIC_EQ],
+ if (check_interface1 (ns->op[i], ns2->op[INTRINSIC_EQ],
0, interface_name, true)) goto done;
break;
case INTRINSIC_NE:
- if (check_interface1 (ns->operator[i], ns2->operator[INTRINSIC_NE_OS],
+ if (check_interface1 (ns->op[i], ns2->op[INTRINSIC_NE_OS],
0, interface_name, true)) goto done;
break;
case INTRINSIC_NE_OS:
- if (check_interface1 (ns->operator[i], ns2->operator[INTRINSIC_NE],
+ if (check_interface1 (ns->op[i], ns2->op[INTRINSIC_NE],
0, interface_name, true)) goto done;
break;
case INTRINSIC_GT:
- if (check_interface1 (ns->operator[i], ns2->operator[INTRINSIC_GT_OS],
+ if (check_interface1 (ns->op[i], ns2->op[INTRINSIC_GT_OS],
0, interface_name, true)) goto done;
break;
case INTRINSIC_GT_OS:
- if (check_interface1 (ns->operator[i], ns2->operator[INTRINSIC_GT],
+ if (check_interface1 (ns->op[i], ns2->op[INTRINSIC_GT],
0, interface_name, true)) goto done;
break;
case INTRINSIC_GE:
- if (check_interface1 (ns->operator[i], ns2->operator[INTRINSIC_GE_OS],
+ if (check_interface1 (ns->op[i], ns2->op[INTRINSIC_GE_OS],
0, interface_name, true)) goto done;
break;
case INTRINSIC_GE_OS:
- if (check_interface1 (ns->operator[i], ns2->operator[INTRINSIC_GE],
+ if (check_interface1 (ns->op[i], ns2->op[INTRINSIC_GE],
0, interface_name, true)) goto done;
break;
case INTRINSIC_LT:
- if (check_interface1 (ns->operator[i], ns2->operator[INTRINSIC_LT_OS],
+ if (check_interface1 (ns->op[i], ns2->op[INTRINSIC_LT_OS],
0, interface_name, true)) goto done;
break;
case INTRINSIC_LT_OS:
- if (check_interface1 (ns->operator[i], ns2->operator[INTRINSIC_LT],
+ if (check_interface1 (ns->op[i], ns2->op[INTRINSIC_LT],
0, interface_name, true)) goto done;
break;
case INTRINSIC_LE:
- if (check_interface1 (ns->operator[i], ns2->operator[INTRINSIC_LE_OS],
+ if (check_interface1 (ns->op[i], ns2->op[INTRINSIC_LE_OS],
0, interface_name, true)) goto done;
break;
case INTRINSIC_LE_OS:
- if (check_interface1 (ns->operator[i], ns2->operator[INTRINSIC_LE],
+ if (check_interface1 (ns->op[i], ns2->op[INTRINSIC_LE],
0, interface_name, true)) goto done;
break;
@@ -1565,7 +1565,7 @@ compare_parameter_protected (gfc_symbol *formal, gfc_expr *actual)
if (actual->expr_type != EXPR_VARIABLE)
return 1;
- if (!actual->symtree->n.sym->attr.protected)
+ if (!actual->symtree->n.sym->attr.is_protected)
return 1;
if (!actual->symtree->n.sym->attr.use_assoc)
@@ -1823,7 +1823,7 @@ static int
compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal,
int ranks_must_agree, int is_elemental, locus *where)
{
- gfc_actual_arglist **new, *a, *actual, temp;
+ gfc_actual_arglist **new_arg, *a, *actual, temp;
gfc_formal_arglist *f;
int i, n, na;
unsigned long actual_size, formal_size;
@@ -1837,10 +1837,10 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal,
for (f = formal; f; f = f->next)
n++;
- new = (gfc_actual_arglist **) alloca (n * sizeof (gfc_actual_arglist *));
+ new_arg = (gfc_actual_arglist **) alloca (n * sizeof (gfc_actual_arglist *));
for (i = 0; i < n; i++)
- new[i] = NULL;
+ new_arg[i] = NULL;
na = 0;
f = formal;
@@ -1868,7 +1868,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal,
return 0;
}
- if (new[i] != NULL)
+ if (new_arg[i] != NULL)
{
if (where)
gfc_error ("Keyword argument '%s' at %L is already associated "
@@ -2113,14 +2113,14 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal,
if (a == actual)
na = i;
- new[i++] = a;
+ new_arg[i++] = a;
}
/* Make sure missing actual arguments are optional. */
i = 0;
for (f = formal; f; f = f->next, i++)
{
- if (new[i] != NULL)
+ if (new_arg[i] != NULL)
continue;
if (f->sym == NULL)
{
@@ -2142,27 +2142,27 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal,
argument list with null arguments in the right places. The head
of the list remains the head. */
for (i = 0; i < n; i++)
- if (new[i] == NULL)
- new[i] = gfc_get_actual_arglist ();
+ if (new_arg[i] == NULL)
+ new_arg[i] = gfc_get_actual_arglist ();
if (na != 0)
{
- temp = *new[0];
- *new[0] = *actual;
+ temp = *new_arg[0];
+ *new_arg[0] = *actual;
*actual = temp;
- a = new[0];
- new[0] = new[na];
- new[na] = a;
+ a = new_arg[0];
+ new_arg[0] = new_arg[na];
+ new_arg[na] = a;
}
for (i = 0; i < n - 1; i++)
- new[i]->next = new[i + 1];
+ new_arg[i]->next = new_arg[i + 1];
- new[i]->next = NULL;
+ new_arg[i]->next = NULL;
if (*ap == NULL && n > 0)
- *ap = new[0];
+ *ap = new_arg[0];
/* Note the types of omitted optional arguments. */
for (a = *ap, f = formal; a; a = a->next, f = f->next)
@@ -2218,7 +2218,7 @@ pair_cmp (const void *p1, const void *p2)
refer to the same expression. The analysis is conservative.
Returning FAILURE will produce no warning. */
-static try
+static gfc_try
compare_actual_expr (gfc_expr *e1, gfc_expr *e2)
{
const gfc_ref *r1, *r2;
@@ -2267,7 +2267,7 @@ compare_actual_expr (gfc_expr *e1, gfc_expr *e2)
another, check that identical actual arguments aren't not
associated with some incompatible INTENTs. */
-static try
+static gfc_try
check_some_aliasing (gfc_formal_arglist *f, gfc_actual_arglist *a)
{
sym_intent f1_intent, f2_intent;
@@ -2275,7 +2275,7 @@ check_some_aliasing (gfc_formal_arglist *f, gfc_actual_arglist *a)
gfc_actual_arglist *a1;
size_t n, i, j;
argpair *p;
- try t = SUCCESS;
+ gfc_try t = SUCCESS;
n = 0;
for (f1 = f, a1 = a;; f1 = f1->next, a1 = a1->next)
@@ -2355,7 +2355,7 @@ compare_parameter_intent (gfc_symbol *formal, gfc_expr *actual)
another, check that they are compatible in the sense that intents
are not mismatched. */
-static try
+static gfc_try
check_intents (gfc_formal_arglist *f, gfc_actual_arglist *a)
{
sym_intent f_intent;
@@ -2513,8 +2513,8 @@ find_symtree0 (gfc_symtree *root, gfc_symbol *sym)
/* Find a symtree for a symbol. */
-static gfc_symtree *
-find_sym_in_symtree (gfc_symbol *sym)
+gfc_symtree *
+gfc_find_sym_in_symtree (gfc_symbol *sym)
{
gfc_symtree *st;
gfc_namespace *ns;
@@ -2546,7 +2546,7 @@ find_sym_in_symtree (gfc_symbol *sym)
interface. If one is found, the expression node is replaced with
the appropriate function call. */
-try
+gfc_try
gfc_extend_expr (gfc_expr *e)
{
gfc_actual_arglist *actual;
@@ -2566,7 +2566,7 @@ gfc_extend_expr (gfc_expr *e)
actual->next->expr = e->value.op.op2;
}
- i = fold_unary (e->value.op.operator);
+ i = fold_unary (e->value.op.op);
if (i == INTRINSIC_USER)
{
@@ -2576,7 +2576,7 @@ gfc_extend_expr (gfc_expr *e)
if (uop == NULL)
continue;
- sym = gfc_search_interface (uop->operator, 0, &actual);
+ sym = gfc_search_interface (uop->op, 0, &actual);
if (sym != NULL)
break;
}
@@ -2591,48 +2591,48 @@ gfc_extend_expr (gfc_expr *e)
{
case INTRINSIC_EQ:
case INTRINSIC_EQ_OS:
- sym = gfc_search_interface (ns->operator[INTRINSIC_EQ], 0, &actual);
+ sym = gfc_search_interface (ns->op[INTRINSIC_EQ], 0, &actual);
if (sym == NULL)
- sym = gfc_search_interface (ns->operator[INTRINSIC_EQ_OS], 0, &actual);
+ sym = gfc_search_interface (ns->op[INTRINSIC_EQ_OS], 0, &actual);
break;
case INTRINSIC_NE:
case INTRINSIC_NE_OS:
- sym = gfc_search_interface (ns->operator[INTRINSIC_NE], 0, &actual);
+ sym = gfc_search_interface (ns->op[INTRINSIC_NE], 0, &actual);
if (sym == NULL)
- sym = gfc_search_interface (ns->operator[INTRINSIC_NE_OS], 0, &actual);
+ sym = gfc_search_interface (ns->op[INTRINSIC_NE_OS], 0, &actual);
break;
case INTRINSIC_GT:
case INTRINSIC_GT_OS:
- sym = gfc_search_interface (ns->operator[INTRINSIC_GT], 0, &actual);
+ sym = gfc_search_interface (ns->op[INTRINSIC_GT], 0, &actual);
if (sym == NULL)
- sym = gfc_search_interface (ns->operator[INTRINSIC_GT_OS], 0, &actual);
+ sym = gfc_search_interface (ns->op[INTRINSIC_GT_OS], 0, &actual);
break;
case INTRINSIC_GE:
case INTRINSIC_GE_OS:
- sym = gfc_search_interface (ns->operator[INTRINSIC_GE], 0, &actual);
+ sym = gfc_search_interface (ns->op[INTRINSIC_GE], 0, &actual);
if (sym == NULL)
- sym = gfc_search_interface (ns->operator[INTRINSIC_GE_OS], 0, &actual);
+ sym = gfc_search_interface (ns->op[INTRINSIC_GE_OS], 0, &actual);
break;
case INTRINSIC_LT:
case INTRINSIC_LT_OS:
- sym = gfc_search_interface (ns->operator[INTRINSIC_LT], 0, &actual);
+ sym = gfc_search_interface (ns->op[INTRINSIC_LT], 0, &actual);
if (sym == NULL)
- sym = gfc_search_interface (ns->operator[INTRINSIC_LT_OS], 0, &actual);
+ sym = gfc_search_interface (ns->op[INTRINSIC_LT_OS], 0, &actual);
break;
case INTRINSIC_LE:
case INTRINSIC_LE_OS:
- sym = gfc_search_interface (ns->operator[INTRINSIC_LE], 0, &actual);
+ sym = gfc_search_interface (ns->op[INTRINSIC_LE], 0, &actual);
if (sym == NULL)
- sym = gfc_search_interface (ns->operator[INTRINSIC_LE_OS], 0, &actual);
+ sym = gfc_search_interface (ns->op[INTRINSIC_LE_OS], 0, &actual);
break;
default:
- sym = gfc_search_interface (ns->operator[i], 0, &actual);
+ sym = gfc_search_interface (ns->op[i], 0, &actual);
}
if (sym != NULL)
@@ -2652,7 +2652,7 @@ gfc_extend_expr (gfc_expr *e)
/* Change the expression node to a function call. */
e->expr_type = EXPR_FUNCTION;
- e->symtree = find_sym_in_symtree (sym);
+ e->symtree = gfc_find_sym_in_symtree (sym);
e->value.function.actual = actual;
e->value.function.esym = NULL;
e->value.function.isym = NULL;
@@ -2677,7 +2677,7 @@ gfc_extend_expr (gfc_expr *e)
SUCCESS if the node was replaced. On FAILURE, no error is
generated. */
-try
+gfc_try
gfc_extend_assign (gfc_code *c, gfc_namespace *ns)
{
gfc_actual_arglist *actual;
@@ -2704,7 +2704,7 @@ gfc_extend_assign (gfc_code *c, gfc_namespace *ns)
for (; ns; ns = ns->parent)
{
- sym = gfc_search_interface (ns->operator[INTRINSIC_ASSIGN], 1, &actual);
+ sym = gfc_search_interface (ns->op[INTRINSIC_ASSIGN], 1, &actual);
if (sym != NULL)
break;
}
@@ -2718,7 +2718,7 @@ gfc_extend_assign (gfc_code *c, gfc_namespace *ns)
/* Replace the assignment with the call. */
c->op = EXEC_ASSIGN_CALL;
- c->symtree = find_sym_in_symtree (sym);
+ c->symtree = gfc_find_sym_in_symtree (sym);
c->expr = NULL;
c->expr2 = NULL;
c->ext.actual = actual;
@@ -2731,17 +2731,17 @@ gfc_extend_assign (gfc_code *c, gfc_namespace *ns)
the given interface list. Ambiguity isn't checked yet since module
procedures can be present without interfaces. */
-static try
-check_new_interface (gfc_interface *base, gfc_symbol *new)
+static gfc_try
+check_new_interface (gfc_interface *base, gfc_symbol *new_sym)
{
gfc_interface *ip;
for (ip = base; ip; ip = ip->next)
{
- if (ip->sym == new)
+ if (ip->sym == new_sym)
{
gfc_error ("Entity '%s' at %C is already present in the interface",
- new->name);
+ new_sym->name);
return FAILURE;
}
}
@@ -2752,8 +2752,8 @@ check_new_interface (gfc_interface *base, gfc_symbol *new)
/* Add a symbol to the current interface. */
-try
-gfc_add_interface (gfc_symbol *new)
+gfc_try
+gfc_add_interface (gfc_symbol *new_sym)
{
gfc_interface **head, *intr;
gfc_namespace *ns;
@@ -2771,52 +2771,52 @@ gfc_add_interface (gfc_symbol *new)
{
case INTRINSIC_EQ:
case INTRINSIC_EQ_OS:
- if (check_new_interface (ns->operator[INTRINSIC_EQ], new) == FAILURE ||
- check_new_interface (ns->operator[INTRINSIC_EQ_OS], new) == FAILURE)
+ if (check_new_interface (ns->op[INTRINSIC_EQ], new_sym) == FAILURE ||
+ check_new_interface (ns->op[INTRINSIC_EQ_OS], new_sym) == FAILURE)
return FAILURE;
break;
case INTRINSIC_NE:
case INTRINSIC_NE_OS:
- if (check_new_interface (ns->operator[INTRINSIC_NE], new) == FAILURE ||
- check_new_interface (ns->operator[INTRINSIC_NE_OS], new) == FAILURE)
+ if (check_new_interface (ns->op[INTRINSIC_NE], new_sym) == FAILURE ||
+ check_new_interface (ns->op[INTRINSIC_NE_OS], new_sym) == FAILURE)
return FAILURE;
break;
case INTRINSIC_GT:
case INTRINSIC_GT_OS:
- if (check_new_interface (ns->operator[INTRINSIC_GT], new) == FAILURE ||
- check_new_interface (ns->operator[INTRINSIC_GT_OS], new) == FAILURE)
+ if (check_new_interface (ns->op[INTRINSIC_GT], new_sym) == FAILURE ||
+ check_new_interface (ns->op[INTRINSIC_GT_OS], new_sym) == FAILURE)
return FAILURE;
break;
case INTRINSIC_GE:
case INTRINSIC_GE_OS:
- if (check_new_interface (ns->operator[INTRINSIC_GE], new) == FAILURE ||
- check_new_interface (ns->operator[INTRINSIC_GE_OS], new) == FAILURE)
+ if (check_new_interface (ns->op[INTRINSIC_GE], new_sym) == FAILURE ||
+ check_new_interface (ns->op[INTRINSIC_GE_OS], new_sym) == FAILURE)
return FAILURE;
break;
case INTRINSIC_LT:
case INTRINSIC_LT_OS:
- if (check_new_interface (ns->operator[INTRINSIC_LT], new) == FAILURE ||
- check_new_interface (ns->operator[INTRINSIC_LT_OS], new) == FAILURE)
+ if (check_new_interface (ns->op[INTRINSIC_LT], new_sym) == FAILURE ||
+ check_new_interface (ns->op[INTRINSIC_LT_OS], new_sym) == FAILURE)
return FAILURE;
break;
case INTRINSIC_LE:
case INTRINSIC_LE_OS:
- if (check_new_interface (ns->operator[INTRINSIC_LE], new) == FAILURE ||
- check_new_interface (ns->operator[INTRINSIC_LE_OS], new) == FAILURE)
+ if (check_new_interface (ns->op[INTRINSIC_LE], new_sym) == FAILURE ||
+ check_new_interface (ns->op[INTRINSIC_LE_OS], new_sym) == FAILURE)
return FAILURE;
break;
default:
- if (check_new_interface (ns->operator[current_interface.op], new) == FAILURE)
+ if (check_new_interface (ns->op[current_interface.op], new_sym) == FAILURE)
return FAILURE;
}
- head = &current_interface.ns->operator[current_interface.op];
+ head = &current_interface.ns->op[current_interface.op];
break;
case INTERFACE_GENERIC:
@@ -2826,7 +2826,7 @@ gfc_add_interface (gfc_symbol *new)
if (sym == NULL)
continue;
- if (check_new_interface (sym->generic, new) == FAILURE)
+ if (check_new_interface (sym->generic, new_sym) == FAILURE)
return FAILURE;
}
@@ -2834,11 +2834,11 @@ gfc_add_interface (gfc_symbol *new)
break;
case INTERFACE_USER_OP:
- if (check_new_interface (current_interface.uop->operator, new)
+ if (check_new_interface (current_interface.uop->op, new_sym)
== FAILURE)
return FAILURE;
- head = &current_interface.uop->operator;
+ head = &current_interface.uop->op;
break;
default:
@@ -2846,7 +2846,7 @@ gfc_add_interface (gfc_symbol *new)
}
intr = gfc_get_interface ();
- intr->sym = new;
+ intr->sym = new_sym;
intr->where = gfc_current_locus;
intr->next = *head;
@@ -2862,7 +2862,7 @@ gfc_current_interface_head (void)
switch (current_interface.type)
{
case INTERFACE_INTRINSIC_OP:
- return current_interface.ns->operator[current_interface.op];
+ return current_interface.ns->op[current_interface.op];
break;
case INTERFACE_GENERIC:
@@ -2870,7 +2870,7 @@ gfc_current_interface_head (void)
break;
case INTERFACE_USER_OP:
- return current_interface.uop->operator;
+ return current_interface.uop->op;
break;
default:
@@ -2885,7 +2885,7 @@ gfc_set_current_interface_head (gfc_interface *i)
switch (current_interface.type)
{
case INTERFACE_INTRINSIC_OP:
- current_interface.ns->operator[current_interface.op] = i;
+ current_interface.ns->op[current_interface.op] = i;
break;
case INTERFACE_GENERIC:
@@ -2893,7 +2893,7 @@ gfc_set_current_interface_head (gfc_interface *i)
break;
case INTERFACE_USER_OP:
- current_interface.uop->operator = i;
+ current_interface.uop->op = i;
break;
default:
diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c
index df412757823..9b11db4bb64 100644
--- a/gcc/fortran/intrinsic.c
+++ b/gcc/fortran/intrinsic.c
@@ -48,7 +48,7 @@ static enum
{ SZ_NOTHING = 0, SZ_SUBS, SZ_FUNCS, SZ_CONVS }
sizing;
-enum class
+enum klass
{ NO_CLASS = 0, CLASS_ELEMENTAL, CLASS_INQUIRY, CLASS_TRANSFORMATIONAL };
#define ACTUAL_NO 0
@@ -175,7 +175,7 @@ find_char_conv (gfc_typespec *from, gfc_typespec *to)
and call the proper check function rather than forcing each
function to manipulate the argument list. */
-static try
+static gfc_try
do_check (gfc_intrinsic_sym *specific, gfc_actual_arglist *arg)
{
gfc_expr *a1, *a2, *a3, *a4, *a5;
@@ -243,7 +243,7 @@ do_check (gfc_intrinsic_sym *specific, gfc_actual_arglist *arg)
ZABS ZCOS ZEXP ZLOG ZSIN ZSQRT. */
static void
-add_sym (const char *name, gfc_isym_id id, enum class cl, int actual_ok, bt type, int kind,
+add_sym (const char *name, gfc_isym_id id, enum klass cl, int actual_ok, bt type, int kind,
int standard, gfc_check_f check, gfc_simplify_f simplify,
gfc_resolve_f resolve, ...)
{
@@ -332,9 +332,9 @@ add_sym (const char *name, gfc_isym_id id, enum class cl, int actual_ok, bt type
0 arguments. */
static void
-add_sym_0 (const char *name, gfc_isym_id id, enum class cl, int actual_ok, bt type,
+add_sym_0 (const char *name, gfc_isym_id id, enum klass cl, int actual_ok, bt type,
int kind, int standard,
- try (*check) (void),
+ gfc_try (*check) (void),
gfc_expr *(*simplify) (void),
void (*resolve) (gfc_expr *))
{
@@ -374,9 +374,9 @@ add_sym_0s (const char *name, gfc_isym_id id, int standard, void (*resolve) (gfc
1 arguments. */
static void
-add_sym_1 (const char *name, gfc_isym_id id, enum class cl, int actual_ok, bt type,
+add_sym_1 (const char *name, gfc_isym_id id, enum klass cl, int actual_ok, bt type,
int kind, int standard,
- try (*check) (gfc_expr *),
+ gfc_try (*check) (gfc_expr *),
gfc_expr *(*simplify) (gfc_expr *),
void (*resolve) (gfc_expr *, gfc_expr *),
const char *a1, bt type1, int kind1, int optional1)
@@ -399,8 +399,8 @@ add_sym_1 (const char *name, gfc_isym_id id, enum class cl, int actual_ok, bt ty
1 arguments. */
static void
-add_sym_1s (const char *name, gfc_isym_id id, enum class cl, bt type, int kind, int standard,
- try (*check) (gfc_expr *),
+add_sym_1s (const char *name, gfc_isym_id id, enum klass cl, bt type, int kind, int standard,
+ gfc_try (*check) (gfc_expr *),
gfc_expr *(*simplify) (gfc_expr *),
void (*resolve) (gfc_code *),
const char *a1, bt type1, int kind1, int optional1)
@@ -423,9 +423,9 @@ add_sym_1s (const char *name, gfc_isym_id id, enum class cl, bt type, int kind,
function. MAX et al take 2 or more arguments. */
static void
-add_sym_1m (const char *name, gfc_isym_id id, enum class cl, int actual_ok, bt type,
+add_sym_1m (const char *name, gfc_isym_id id, enum klass cl, int actual_ok, bt type,
int kind, int standard,
- try (*check) (gfc_actual_arglist *),
+ gfc_try (*check) (gfc_actual_arglist *),
gfc_expr *(*simplify) (gfc_expr *),
void (*resolve) (gfc_expr *, gfc_actual_arglist *),
const char *a1, bt type1, int kind1, int optional1,
@@ -450,9 +450,9 @@ add_sym_1m (const char *name, gfc_isym_id id, enum class cl, int actual_ok, bt t
2 arguments. */
static void
-add_sym_2 (const char *name, gfc_isym_id id, enum class cl, int actual_ok, bt type,
+add_sym_2 (const char *name, gfc_isym_id id, enum klass cl, int actual_ok, bt type,
int kind, int standard,
- try (*check) (gfc_expr *, gfc_expr *),
+ gfc_try (*check) (gfc_expr *, gfc_expr *),
gfc_expr *(*simplify) (gfc_expr *, gfc_expr *),
void (*resolve) (gfc_expr *, gfc_expr *, gfc_expr *),
const char *a1, bt type1, int kind1, int optional1,
@@ -477,8 +477,8 @@ add_sym_2 (const char *name, gfc_isym_id id, enum class cl, int actual_ok, bt ty
2 arguments. */
static void
-add_sym_2s (const char *name, gfc_isym_id id, enum class cl, bt type, int kind, int standard,
- try (*check) (gfc_expr *, gfc_expr *),
+add_sym_2s (const char *name, gfc_isym_id id, enum klass cl, bt type, int kind, int standard,
+ gfc_try (*check) (gfc_expr *, gfc_expr *),
gfc_expr *(*simplify) (gfc_expr *, gfc_expr *),
void (*resolve) (gfc_code *),
const char *a1, bt type1, int kind1, int optional1,
@@ -503,9 +503,9 @@ add_sym_2s (const char *name, gfc_isym_id id, enum class cl, bt type, int kind,
3 arguments. */
static void
-add_sym_3 (const char *name, gfc_isym_id id, enum class cl, int actual_ok, bt type,
+add_sym_3 (const char *name, gfc_isym_id id, enum klass cl, int actual_ok, bt type,
int kind, int standard,
- try (*check) (gfc_expr *, gfc_expr *, gfc_expr *),
+ gfc_try (*check) (gfc_expr *, gfc_expr *, gfc_expr *),
gfc_expr *(*simplify) (gfc_expr *, gfc_expr *, gfc_expr *),
void (*resolve) (gfc_expr *, gfc_expr *, gfc_expr *, gfc_expr *),
const char *a1, bt type1, int kind1, int optional1,
@@ -532,9 +532,9 @@ add_sym_3 (const char *name, gfc_isym_id id, enum class cl, int actual_ok, bt ty
might have to be reordered. */
static void
-add_sym_3ml (const char *name, gfc_isym_id id, enum class cl, int actual_ok, bt type,
+add_sym_3ml (const char *name, gfc_isym_id id, enum klass cl, int actual_ok, bt type,
int kind, int standard,
- try (*check) (gfc_actual_arglist *),
+ gfc_try (*check) (gfc_actual_arglist *),
gfc_expr *(*simplify) (gfc_expr *, gfc_expr *, gfc_expr *),
void (*resolve) (gfc_expr *, gfc_expr *, gfc_expr *, gfc_expr *),
const char *a1, bt type1, int kind1, int optional1,
@@ -561,9 +561,9 @@ add_sym_3ml (const char *name, gfc_isym_id id, enum class cl, int actual_ok, bt
their argument also might have to be reordered. */
static void
-add_sym_3red (const char *name, gfc_isym_id id, enum class cl, int actual_ok, bt type,
+add_sym_3red (const char *name, gfc_isym_id id, enum klass cl, int actual_ok, bt type,
int kind, int standard,
- try (*check) (gfc_actual_arglist *),
+ gfc_try (*check) (gfc_actual_arglist *),
gfc_expr *(*simplify) (gfc_expr *, gfc_expr *, gfc_expr *),
void (*resolve) (gfc_expr *, gfc_expr *, gfc_expr *, gfc_expr *),
const char *a1, bt type1, int kind1, int optional1,
@@ -590,8 +590,8 @@ add_sym_3red (const char *name, gfc_isym_id id, enum class cl, int actual_ok, bt
3 arguments. */
static void
-add_sym_3s (const char *name, gfc_isym_id id, enum class cl, bt type, int kind, int standard,
- try (*check) (gfc_expr *, gfc_expr *, gfc_expr *),
+add_sym_3s (const char *name, gfc_isym_id id, enum klass cl, bt type, int kind, int standard,
+ gfc_try (*check) (gfc_expr *, gfc_expr *, gfc_expr *),
gfc_expr *(*simplify) (gfc_expr *, gfc_expr *, gfc_expr *),
void (*resolve) (gfc_code *),
const char *a1, bt type1, int kind1, int optional1,
@@ -618,9 +618,9 @@ add_sym_3s (const char *name, gfc_isym_id id, enum class cl, bt type, int kind,
4 arguments. */
static void
-add_sym_4 (const char *name, gfc_isym_id id, enum class cl, int actual_ok, bt type,
+add_sym_4 (const char *name, gfc_isym_id id, enum klass cl, int actual_ok, bt type,
int kind, int standard,
- try (*check) (gfc_expr *, gfc_expr *, gfc_expr *, gfc_expr *),
+ gfc_try (*check) (gfc_expr *, gfc_expr *, gfc_expr *, gfc_expr *),
gfc_expr *(*simplify) (gfc_expr *, gfc_expr *, gfc_expr *,
gfc_expr *),
void (*resolve) (gfc_expr *, gfc_expr *, gfc_expr *, gfc_expr *,
@@ -651,8 +651,8 @@ add_sym_4 (const char *name, gfc_isym_id id, enum class cl, int actual_ok, bt ty
4 arguments. */
static void
-add_sym_4s (const char *name, gfc_isym_id id, enum class cl, bt type, int kind, int standard,
- try (*check) (gfc_expr *, gfc_expr *, gfc_expr *, gfc_expr *),
+add_sym_4s (const char *name, gfc_isym_id id, enum klass cl, bt type, int kind, int standard,
+ gfc_try (*check) (gfc_expr *, gfc_expr *, gfc_expr *, gfc_expr *),
gfc_expr *(*simplify) (gfc_expr *, gfc_expr *, gfc_expr *,
gfc_expr *),
void (*resolve) (gfc_code *),
@@ -682,8 +682,8 @@ add_sym_4s (const char *name, gfc_isym_id id, enum class cl, bt type, int kind,
5 arguments. */
static void
-add_sym_5s (const char *name, gfc_isym_id id, enum class cl, bt type, int kind, int standard,
- try (*check) (gfc_expr *, gfc_expr *, gfc_expr *, gfc_expr *,
+add_sym_5s (const char *name, gfc_isym_id id, enum klass cl, bt type, int kind, int standard,
+ gfc_try (*check) (gfc_expr *, gfc_expr *, gfc_expr *, gfc_expr *,
gfc_expr *),
gfc_expr *(*simplify) (gfc_expr *, gfc_expr *, gfc_expr *,
gfc_expr *, gfc_expr *),
@@ -807,15 +807,47 @@ gfc_intrinsic_actual_ok (const char *name, const bool subroutine_flag)
}
-/* Given a string, figure out if it is the name of an intrinsic
- subroutine or function. There are no generic intrinsic
- subroutines, they are all specific. */
+/* Given a symbol, find out if it is (and is to be treated) an intrinsic. If
+ it's name refers to an intrinsic but this intrinsic is not included in the
+ selected standard, this returns FALSE and sets the symbol's external
+ attribute. */
-int
-gfc_intrinsic_name (const char *name, int subroutine_flag)
+bool
+gfc_is_intrinsic (gfc_symbol* sym, int subroutine_flag, locus loc)
{
- return subroutine_flag ? gfc_find_subroutine (name) != NULL
- : gfc_find_function (name) != NULL;
+ gfc_intrinsic_sym* isym;
+ const char* symstd;
+
+ /* If INTRINSIC/EXTERNAL state is already known, return. */
+ if (sym->attr.intrinsic)
+ return true;
+ if (sym->attr.external)
+ return false;
+
+ if (subroutine_flag)
+ isym = gfc_find_subroutine (sym->name);
+ else
+ isym = gfc_find_function (sym->name);
+
+ /* No such intrinsic available at all? */
+ if (!isym)
+ return false;
+
+ /* See if this intrinsic is allowed in the current standard. */
+ if (gfc_check_intrinsic_standard (isym, &symstd, false, loc) == FAILURE)
+ {
+ if (gfc_option.warn_intrinsics_std)
+ gfc_warning_now ("The intrinsic '%s' at %L is not included in the"
+ " selected standard but %s and '%s' will be treated as"
+ " if declared EXTERNAL. Use an appropriate -std=*"
+ " option or define -fall-intrinsics to allow this"
+ " intrinsic.", sym->name, &loc, symstd, sym->name);
+ sym->attr.external = 1;
+
+ return false;
+ }
+
+ return true;
}
@@ -2992,7 +3024,7 @@ remove_nullargs (gfc_actual_arglist **ap)
wrong (say, a missing required argument) we abort sorting and
return FAILURE. */
-static try
+static gfc_try
sort_actual (const char *name, gfc_actual_arglist **ap,
gfc_intrinsic_arg *formal, locus *where)
{
@@ -3113,7 +3145,7 @@ do_sort:
list. The lists are checked for agreement of type. We don't check
for arrayness here. */
-static try
+static gfc_try
check_arglist (gfc_actual_arglist **ap, gfc_intrinsic_sym *sym,
int error_flag)
{
@@ -3245,7 +3277,7 @@ resolve_intrinsic (gfc_intrinsic_sym *specific, gfc_expr *e)
of the simplification, SUCCESS if the simplification worked, even
if nothing has changed in the expression itself. */
-static try
+static gfc_try
do_simplify (gfc_intrinsic_sym *specific, gfc_expr *e)
{
gfc_expr *result, *a1, *a2, *a3, *a4, *a5;
@@ -3374,11 +3406,11 @@ init_arglist (gfc_intrinsic_sym *isym)
intrinsic's formal argument list. Return SUCCESS if the expression
and intrinsic match, FAILURE otherwise. */
-static try
+static gfc_try
check_specific (gfc_intrinsic_sym *specific, gfc_expr *expr, int error_flag)
{
gfc_actual_arglist *arg, **ap;
- try t;
+ gfc_try t;
ap = &expr->value.function.actual;
@@ -3448,21 +3480,82 @@ check_specific (gfc_intrinsic_sym *specific, gfc_expr *expr, int error_flag)
/* Check whether an intrinsic belongs to whatever standard the user
- has chosen. */
-
-static try
-check_intrinsic_standard (const char *name, int standard, locus *where)
+ has chosen, taking also into account -fall-intrinsics. Here, no
+ warning/error is emitted; but if symstd is not NULL, it is pointed to a
+ textual representation of the symbols standard status (like
+ "new in Fortran 2008", "a GNU extension" or "obsolescent in Fortran 95") that
+ can be used to construct a detailed warning/error message in case of
+ a FAILURE. */
+
+gfc_try
+gfc_check_intrinsic_standard (const gfc_intrinsic_sym* isym,
+ const char** symstd, bool silent, locus where)
{
- /* Do not warn about GNU-extensions if -std=gnu. */
- if (!gfc_option.warn_nonstd_intrinsics
- || (standard == GFC_STD_GNU && gfc_option.warn_std & GFC_STD_GNU))
+ const char* symstd_msg;
+
+ /* For -fall-intrinsics, just succeed. */
+ if (gfc_option.flag_all_intrinsics)
return SUCCESS;
- if (gfc_notify_std (standard, "Intrinsic '%s' at %L is not included "
- "in the selected standard", name, where) == FAILURE)
- return FAILURE;
+ /* Find the symbol's standard message for later usage. */
+ switch (isym->standard)
+ {
+ case GFC_STD_F77:
+ symstd_msg = "available since Fortran 77";
+ break;
- return SUCCESS;
+ case GFC_STD_F95_OBS:
+ symstd_msg = "obsolescent in Fortran 95";
+ break;
+
+ case GFC_STD_F95_DEL:
+ symstd_msg = "deleted in Fortran 95";
+ break;
+
+ case GFC_STD_F95:
+ symstd_msg = "new in Fortran 95";
+ break;
+
+ case GFC_STD_F2003:
+ symstd_msg = "new in Fortran 2003";
+ break;
+
+ case GFC_STD_F2008:
+ symstd_msg = "new in Fortran 2008";
+ break;
+
+ case GFC_STD_GNU:
+ symstd_msg = "a GNU Fortran extension";
+ break;
+
+ case GFC_STD_LEGACY:
+ symstd_msg = "for backward compatibility";
+ break;
+
+ default:
+ gfc_internal_error ("Invalid standard code on intrinsic '%s' (%d)",
+ isym->name, isym->standard);
+ }
+
+ /* If warning about the standard, warn and succeed. */
+ if (gfc_option.warn_std & isym->standard)
+ {
+ /* Do only print a warning if not a GNU extension. */
+ if (!silent && isym->standard != GFC_STD_GNU)
+ gfc_warning ("Intrinsic '%s' (is %s) is used at %L",
+ isym->name, _(symstd_msg), &where);
+
+ return SUCCESS;
+ }
+
+ /* If allowing the symbol's standard, succeed, too. */
+ if (gfc_option.allow_std & isym->standard)
+ return SUCCESS;
+
+ /* Otherwise, fail. */
+ if (symstd)
+ *symstd = _(symstd_msg);
+ return FAILURE;
}
@@ -3508,9 +3601,6 @@ gfc_intrinsic_func_interface (gfc_expr *expr, int error_flag)
return MATCH_NO;
}
- if (check_intrinsic_standard (name, isym->standard, &expr->where) == FAILURE)
- return MATCH_ERROR;
-
if ((isym->id == GFC_ISYM_REAL || isym->id == GFC_ISYM_DBLE
|| isym->id == GFC_ISYM_CMPLX)
&& gfc_init_expr
@@ -3605,9 +3695,6 @@ gfc_intrinsic_sub_interface (gfc_code *c, int error_flag)
if (isym == NULL)
return MATCH_NO;
- if (check_intrinsic_standard (name, isym->standard, &c->loc) == FAILURE)
- return MATCH_ERROR;
-
gfc_suppress_error = !error_flag;
init_arglist (isym);
@@ -3657,7 +3744,7 @@ fail:
/* Call gfc_convert_type() with warning enabled. */
-try
+gfc_try
gfc_convert_type (gfc_expr *expr, gfc_typespec *ts, int eflag)
{
return gfc_convert_type_warn (expr, ts, eflag, 1);
@@ -3674,13 +3761,13 @@ gfc_convert_type (gfc_expr *expr, gfc_typespec *ts, int eflag)
'wflag' controls the warning related to conversion. */
-try
+gfc_try
gfc_convert_type_warn (gfc_expr *expr, gfc_typespec *ts, int eflag, int wflag)
{
gfc_intrinsic_sym *sym;
gfc_typespec from_ts;
locus old_where;
- gfc_expr *new;
+ gfc_expr *new_expr;
int rank;
mpz_t *shape;
@@ -3722,29 +3809,29 @@ gfc_convert_type_warn (gfc_expr *expr, gfc_typespec *ts, int eflag, int wflag)
rank = expr->rank;
shape = expr->shape;
- new = gfc_get_expr ();
- *new = *expr;
-
- new = gfc_build_conversion (new);
- new->value.function.name = sym->lib_name;
- new->value.function.isym = sym;
- new->where = old_where;
- new->rank = rank;
- new->shape = gfc_copy_shape (shape, rank);
-
- gfc_get_ha_sym_tree (sym->name, &new->symtree);
- new->symtree->n.sym->ts = *ts;
- new->symtree->n.sym->attr.flavor = FL_PROCEDURE;
- new->symtree->n.sym->attr.function = 1;
- new->symtree->n.sym->attr.elemental = 1;
- new->symtree->n.sym->attr.pure = 1;
- new->symtree->n.sym->attr.referenced = 1;
- gfc_intrinsic_symbol(new->symtree->n.sym);
- gfc_commit_symbol (new->symtree->n.sym);
-
- *expr = *new;
-
- gfc_free (new);
+ new_expr = gfc_get_expr ();
+ *new_expr = *expr;
+
+ new_expr = gfc_build_conversion (new_expr);
+ new_expr->value.function.name = sym->lib_name;
+ new_expr->value.function.isym = sym;
+ new_expr->where = old_where;
+ new_expr->rank = rank;
+ new_expr->shape = gfc_copy_shape (shape, rank);
+
+ gfc_get_ha_sym_tree (sym->name, &new_expr->symtree);
+ new_expr->symtree->n.sym->ts = *ts;
+ new_expr->symtree->n.sym->attr.flavor = FL_PROCEDURE;
+ new_expr->symtree->n.sym->attr.function = 1;
+ new_expr->symtree->n.sym->attr.elemental = 1;
+ new_expr->symtree->n.sym->attr.pure = 1;
+ new_expr->symtree->n.sym->attr.referenced = 1;
+ gfc_intrinsic_symbol(new_expr->symtree->n.sym);
+ gfc_commit_symbol (new_expr->symtree->n.sym);
+
+ *expr = *new_expr;
+
+ gfc_free (new_expr);
expr->ts = *ts;
if (gfc_is_constant_expr (expr->value.function.actual->expr)
@@ -3773,13 +3860,13 @@ bad:
}
-try
+gfc_try
gfc_convert_chartype (gfc_expr *expr, gfc_typespec *ts)
{
gfc_intrinsic_sym *sym;
gfc_typespec from_ts;
locus old_where;
- gfc_expr *new;
+ gfc_expr *new_expr;
int rank;
mpz_t *shape;
@@ -3794,28 +3881,28 @@ gfc_convert_chartype (gfc_expr *expr, gfc_typespec *ts)
rank = expr->rank;
shape = expr->shape;
- new = gfc_get_expr ();
- *new = *expr;
+ new_expr = gfc_get_expr ();
+ *new_expr = *expr;
- new = gfc_build_conversion (new);
- new->value.function.name = sym->lib_name;
- new->value.function.isym = sym;
- new->where = old_where;
- new->rank = rank;
- new->shape = gfc_copy_shape (shape, rank);
+ new_expr = gfc_build_conversion (new_expr);
+ new_expr->value.function.name = sym->lib_name;
+ new_expr->value.function.isym = sym;
+ new_expr->where = old_where;
+ new_expr->rank = rank;
+ new_expr->shape = gfc_copy_shape (shape, rank);
- gfc_get_ha_sym_tree (sym->name, &new->symtree);
- new->symtree->n.sym->ts = *ts;
- new->symtree->n.sym->attr.flavor = FL_PROCEDURE;
- new->symtree->n.sym->attr.function = 1;
- new->symtree->n.sym->attr.elemental = 1;
- new->symtree->n.sym->attr.referenced = 1;
- gfc_intrinsic_symbol(new->symtree->n.sym);
- gfc_commit_symbol (new->symtree->n.sym);
+ gfc_get_ha_sym_tree (sym->name, &new_expr->symtree);
+ new_expr->symtree->n.sym->ts = *ts;
+ new_expr->symtree->n.sym->attr.flavor = FL_PROCEDURE;
+ new_expr->symtree->n.sym->attr.function = 1;
+ new_expr->symtree->n.sym->attr.elemental = 1;
+ new_expr->symtree->n.sym->attr.referenced = 1;
+ gfc_intrinsic_symbol(new_expr->symtree->n.sym);
+ gfc_commit_symbol (new_expr->symtree->n.sym);
- *expr = *new;
+ *expr = *new_expr;
- gfc_free (new);
+ gfc_free (new_expr);
expr->ts = *ts;
if (gfc_is_constant_expr (expr->value.function.actual->expr)
@@ -3827,3 +3914,42 @@ gfc_convert_chartype (gfc_expr *expr, gfc_typespec *ts)
return SUCCESS;
}
+
+
+/* Check if the passed name is name of an intrinsic (taking into account the
+ current -std=* and -fall-intrinsic settings). If it is, see if we should
+ warn about this as a user-procedure having the same name as an intrinsic
+ (-Wintrinsic-shadow enabled) and do so if we should. */
+
+void
+gfc_warn_intrinsic_shadow (const gfc_symbol* sym, bool in_module, bool func)
+{
+ gfc_intrinsic_sym* isym;
+
+ /* If the warning is disabled, do nothing at all. */
+ if (!gfc_option.warn_intrinsic_shadow)
+ return;
+
+ /* Try to find an intrinsic of the same name. */
+ if (func)
+ isym = gfc_find_function (sym->name);
+ else
+ isym = gfc_find_subroutine (sym->name);
+
+ /* If no intrinsic was found with this name or it's not included in the
+ selected standard, everything's fine. */
+ if (!isym || gfc_check_intrinsic_standard (isym, NULL, true,
+ sym->declared_at) == FAILURE)
+ return;
+
+ /* Emit the warning. */
+ if (in_module)
+ gfc_warning ("'%s' declared at %L may shadow the intrinsic of the same"
+ " name. In order to call the intrinsic, explicit INTRINSIC"
+ " declarations may be required.",
+ sym->name, &sym->declared_at);
+ else
+ gfc_warning ("'%s' declared at %L is also the name of an intrinsic. It can"
+ " only be called via an explicit interface or if declared"
+ " EXTERNAL.", sym->name, &sym->declared_at);
+}
diff --git a/gcc/fortran/intrinsic.h b/gcc/fortran/intrinsic.h
index e280c50d78f..5994cf66a79 100644
--- a/gcc/fortran/intrinsic.h
+++ b/gcc/fortran/intrinsic.h
@@ -26,169 +26,169 @@ extern gfc_expr gfc_bad_expr;
/* Check functions. */
-try gfc_check_a_ikind (gfc_expr *, gfc_expr *);
-try gfc_check_a_xkind (gfc_expr *, gfc_expr *);
-try gfc_check_a_p (gfc_expr *, gfc_expr *);
-try gfc_check_x_yd (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_a_ikind (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_a_xkind (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_a_p (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_x_yd (gfc_expr *, gfc_expr *);
-try gfc_check_abs (gfc_expr *);
-try gfc_check_access_func (gfc_expr *, gfc_expr *);
-try gfc_check_achar (gfc_expr *, gfc_expr *);
-try gfc_check_all_any (gfc_expr *, gfc_expr *);
-try gfc_check_allocated (gfc_expr *);
-try gfc_check_associated (gfc_expr *, gfc_expr *);
-try gfc_check_atan2 (gfc_expr *, gfc_expr *);
-try gfc_check_besn (gfc_expr *, gfc_expr *);
-try gfc_check_btest (gfc_expr *, gfc_expr *);
-try gfc_check_char (gfc_expr *, gfc_expr *);
-try gfc_check_chdir (gfc_expr *);
-try gfc_check_chmod (gfc_expr *, gfc_expr *);
-try gfc_check_cmplx (gfc_expr *, gfc_expr *, gfc_expr *);
-try gfc_check_complex (gfc_expr *, gfc_expr *);
-try gfc_check_count (gfc_expr *, gfc_expr *, gfc_expr *);
-try gfc_check_cshift (gfc_expr *, gfc_expr *, gfc_expr *);
-try gfc_check_ctime (gfc_expr *);
-try gfc_check_datan2 (gfc_expr *, gfc_expr *);
-try gfc_check_dcmplx (gfc_expr *, gfc_expr *);
-try gfc_check_dble (gfc_expr *);
-try gfc_check_digits (gfc_expr *);
-try gfc_check_dot_product (gfc_expr *, gfc_expr *);
-try gfc_check_dprod (gfc_expr *, gfc_expr *);
-try gfc_check_eoshift (gfc_expr *, gfc_expr *, gfc_expr *, gfc_expr *);
-try gfc_check_dtime_etime (gfc_expr *);
-try gfc_check_fgetputc (gfc_expr *, gfc_expr *);
-try gfc_check_fgetput (gfc_expr *);
-try gfc_check_fstat (gfc_expr *, gfc_expr *);
-try gfc_check_ftell (gfc_expr *);
-try gfc_check_fn_c (gfc_expr *);
-try gfc_check_fn_d (gfc_expr *);
-try gfc_check_fn_r (gfc_expr *);
-try gfc_check_fn_rc (gfc_expr *);
-try gfc_check_fnum (gfc_expr *);
-try gfc_check_hostnm (gfc_expr *);
-try gfc_check_huge (gfc_expr *);
-try gfc_check_hypot (gfc_expr *, gfc_expr *);
-try gfc_check_i (gfc_expr *);
-try gfc_check_iand (gfc_expr *, gfc_expr *);
-try gfc_check_and (gfc_expr *, gfc_expr *);
-try gfc_check_ibclr (gfc_expr *, gfc_expr *);
-try gfc_check_ibits (gfc_expr *, gfc_expr *, gfc_expr *);
-try gfc_check_ibset (gfc_expr *, gfc_expr *);
-try gfc_check_ichar_iachar (gfc_expr *, gfc_expr *);
-try gfc_check_idnint (gfc_expr *);
-try gfc_check_ieor (gfc_expr *, gfc_expr *);
-try gfc_check_index (gfc_expr *, gfc_expr *, gfc_expr *, gfc_expr *);
-try gfc_check_int (gfc_expr *, gfc_expr *);
-try gfc_check_intconv (gfc_expr *);
-try gfc_check_ior (gfc_expr *, gfc_expr *);
-try gfc_check_irand (gfc_expr *);
-try gfc_check_isatty (gfc_expr *);
-try gfc_check_isnan (gfc_expr *);
-try gfc_check_ishft (gfc_expr *, gfc_expr *);
-try gfc_check_ishftc (gfc_expr *, gfc_expr *, gfc_expr *);
-try gfc_check_kill (gfc_expr *, gfc_expr *);
-try gfc_check_kind (gfc_expr *);
-try gfc_check_lbound (gfc_expr *, gfc_expr *, gfc_expr *);
-try gfc_check_len_lentrim (gfc_expr *, gfc_expr *);
-try gfc_check_link (gfc_expr *, gfc_expr *);
-try gfc_check_lge_lgt_lle_llt (gfc_expr *, gfc_expr *);
-try gfc_check_loc (gfc_expr *);
-try gfc_check_logical (gfc_expr *, gfc_expr *);
-try gfc_check_min_max (gfc_actual_arglist *);
-try gfc_check_min_max_integer (gfc_actual_arglist *);
-try gfc_check_min_max_real (gfc_actual_arglist *);
-try gfc_check_min_max_double (gfc_actual_arglist *);
-try gfc_check_malloc (gfc_expr *);
-try gfc_check_matmul (gfc_expr *, gfc_expr *);
-try gfc_check_merge (gfc_expr *, gfc_expr *, gfc_expr *);
-try gfc_check_minloc_maxloc (gfc_actual_arglist *);
-try gfc_check_minval_maxval (gfc_actual_arglist *);
-try gfc_check_nearest (gfc_expr *, gfc_expr *);
-try gfc_check_new_line (gfc_expr *);
-try gfc_check_null (gfc_expr *);
-try gfc_check_pack (gfc_expr *, gfc_expr *, gfc_expr *);
-try gfc_check_precision (gfc_expr *);
-try gfc_check_present (gfc_expr *);
-try gfc_check_product_sum (gfc_actual_arglist *);
-try gfc_check_radix (gfc_expr *);
-try gfc_check_rand (gfc_expr *);
-try gfc_check_range (gfc_expr *);
-try gfc_check_real (gfc_expr *, gfc_expr *);
-try gfc_check_rename (gfc_expr *, gfc_expr *);
-try gfc_check_repeat (gfc_expr *, gfc_expr *);
-try gfc_check_reshape (gfc_expr *, gfc_expr *, gfc_expr *, gfc_expr *);
-try gfc_check_scale (gfc_expr *, gfc_expr *);
-try gfc_check_scan (gfc_expr *, gfc_expr *, gfc_expr *, gfc_expr *);
-try gfc_check_second_sub (gfc_expr *);
-try gfc_check_secnds (gfc_expr *);
-try gfc_check_selected_char_kind (gfc_expr *);
-try gfc_check_selected_int_kind (gfc_expr *);
-try gfc_check_selected_real_kind (gfc_expr *, gfc_expr *);
-try gfc_check_set_exponent (gfc_expr *, gfc_expr *);
-try gfc_check_shape (gfc_expr *);
-try gfc_check_size (gfc_expr *, gfc_expr *, gfc_expr *);
-try gfc_check_sign (gfc_expr *, gfc_expr *);
-try gfc_check_signal (gfc_expr *, gfc_expr *);
-try gfc_check_sizeof (gfc_expr *);
-try gfc_check_spread (gfc_expr *, gfc_expr *, gfc_expr *);
-try gfc_check_srand (gfc_expr *);
-try gfc_check_stat (gfc_expr *, gfc_expr *);
-try gfc_check_sum (gfc_expr *, gfc_expr *, gfc_expr *);
-try gfc_check_symlnk (gfc_expr *, gfc_expr *);
-try gfc_check_transfer (gfc_expr *, gfc_expr *, gfc_expr *);
-try gfc_check_transpose (gfc_expr *);
-try gfc_check_trim (gfc_expr *);
-try gfc_check_ttynam (gfc_expr *);
-try gfc_check_ubound (gfc_expr *, gfc_expr *, gfc_expr *);
-try gfc_check_umask (gfc_expr *);
-try gfc_check_unlink (gfc_expr *);
-try gfc_check_unpack (gfc_expr *, gfc_expr *, gfc_expr *);
-try gfc_check_verify (gfc_expr *, gfc_expr *, gfc_expr *, gfc_expr *);
-try gfc_check_x (gfc_expr *);
+gfc_try gfc_check_abs (gfc_expr *);
+gfc_try gfc_check_access_func (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_achar (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_all_any (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_allocated (gfc_expr *);
+gfc_try gfc_check_associated (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_atan2 (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_besn (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_btest (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_char (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_chdir (gfc_expr *);
+gfc_try gfc_check_chmod (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_cmplx (gfc_expr *, gfc_expr *, gfc_expr *);
+gfc_try gfc_check_complex (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_count (gfc_expr *, gfc_expr *, gfc_expr *);
+gfc_try gfc_check_cshift (gfc_expr *, gfc_expr *, gfc_expr *);
+gfc_try gfc_check_ctime (gfc_expr *);
+gfc_try gfc_check_datan2 (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_dcmplx (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_dble (gfc_expr *);
+gfc_try gfc_check_digits (gfc_expr *);
+gfc_try gfc_check_dot_product (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_dprod (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_eoshift (gfc_expr *, gfc_expr *, gfc_expr *, gfc_expr *);
+gfc_try gfc_check_dtime_etime (gfc_expr *);
+gfc_try gfc_check_fgetputc (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_fgetput (gfc_expr *);
+gfc_try gfc_check_fstat (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_ftell (gfc_expr *);
+gfc_try gfc_check_fn_c (gfc_expr *);
+gfc_try gfc_check_fn_d (gfc_expr *);
+gfc_try gfc_check_fn_r (gfc_expr *);
+gfc_try gfc_check_fn_rc (gfc_expr *);
+gfc_try gfc_check_fnum (gfc_expr *);
+gfc_try gfc_check_hostnm (gfc_expr *);
+gfc_try gfc_check_huge (gfc_expr *);
+gfc_try gfc_check_hypot (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_i (gfc_expr *);
+gfc_try gfc_check_iand (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_and (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_ibclr (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_ibits (gfc_expr *, gfc_expr *, gfc_expr *);
+gfc_try gfc_check_ibset (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_ichar_iachar (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_idnint (gfc_expr *);
+gfc_try gfc_check_ieor (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_index (gfc_expr *, gfc_expr *, gfc_expr *, gfc_expr *);
+gfc_try gfc_check_int (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_intconv (gfc_expr *);
+gfc_try gfc_check_ior (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_irand (gfc_expr *);
+gfc_try gfc_check_isatty (gfc_expr *);
+gfc_try gfc_check_isnan (gfc_expr *);
+gfc_try gfc_check_ishft (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_ishftc (gfc_expr *, gfc_expr *, gfc_expr *);
+gfc_try gfc_check_kill (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_kind (gfc_expr *);
+gfc_try gfc_check_lbound (gfc_expr *, gfc_expr *, gfc_expr *);
+gfc_try gfc_check_len_lentrim (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_link (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_lge_lgt_lle_llt (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_loc (gfc_expr *);
+gfc_try gfc_check_logical (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_min_max (gfc_actual_arglist *);
+gfc_try gfc_check_min_max_integer (gfc_actual_arglist *);
+gfc_try gfc_check_min_max_real (gfc_actual_arglist *);
+gfc_try gfc_check_min_max_double (gfc_actual_arglist *);
+gfc_try gfc_check_malloc (gfc_expr *);
+gfc_try gfc_check_matmul (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_merge (gfc_expr *, gfc_expr *, gfc_expr *);
+gfc_try gfc_check_minloc_maxloc (gfc_actual_arglist *);
+gfc_try gfc_check_minval_maxval (gfc_actual_arglist *);
+gfc_try gfc_check_nearest (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_new_line (gfc_expr *);
+gfc_try gfc_check_null (gfc_expr *);
+gfc_try gfc_check_pack (gfc_expr *, gfc_expr *, gfc_expr *);
+gfc_try gfc_check_precision (gfc_expr *);
+gfc_try gfc_check_present (gfc_expr *);
+gfc_try gfc_check_product_sum (gfc_actual_arglist *);
+gfc_try gfc_check_radix (gfc_expr *);
+gfc_try gfc_check_rand (gfc_expr *);
+gfc_try gfc_check_range (gfc_expr *);
+gfc_try gfc_check_real (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_rename (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_repeat (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_reshape (gfc_expr *, gfc_expr *, gfc_expr *, gfc_expr *);
+gfc_try gfc_check_scale (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_scan (gfc_expr *, gfc_expr *, gfc_expr *, gfc_expr *);
+gfc_try gfc_check_second_sub (gfc_expr *);
+gfc_try gfc_check_secnds (gfc_expr *);
+gfc_try gfc_check_selected_char_kind (gfc_expr *);
+gfc_try gfc_check_selected_int_kind (gfc_expr *);
+gfc_try gfc_check_selected_real_kind (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_set_exponent (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_shape (gfc_expr *);
+gfc_try gfc_check_size (gfc_expr *, gfc_expr *, gfc_expr *);
+gfc_try gfc_check_sign (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_signal (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_sizeof (gfc_expr *);
+gfc_try gfc_check_spread (gfc_expr *, gfc_expr *, gfc_expr *);
+gfc_try gfc_check_srand (gfc_expr *);
+gfc_try gfc_check_stat (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_sum (gfc_expr *, gfc_expr *, gfc_expr *);
+gfc_try gfc_check_symlnk (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_transfer (gfc_expr *, gfc_expr *, gfc_expr *);
+gfc_try gfc_check_transpose (gfc_expr *);
+gfc_try gfc_check_trim (gfc_expr *);
+gfc_try gfc_check_ttynam (gfc_expr *);
+gfc_try gfc_check_ubound (gfc_expr *, gfc_expr *, gfc_expr *);
+gfc_try gfc_check_umask (gfc_expr *);
+gfc_try gfc_check_unlink (gfc_expr *);
+gfc_try gfc_check_unpack (gfc_expr *, gfc_expr *, gfc_expr *);
+gfc_try gfc_check_verify (gfc_expr *, gfc_expr *, gfc_expr *, gfc_expr *);
+gfc_try gfc_check_x (gfc_expr *);
/* Intrinsic subroutines. */
-try gfc_check_alarm_sub (gfc_expr *, gfc_expr *, gfc_expr *);
-try gfc_check_chdir_sub (gfc_expr *, gfc_expr *);
-try gfc_check_chmod_sub (gfc_expr *, gfc_expr *, gfc_expr *);
-try gfc_check_cpu_time (gfc_expr *);
-try gfc_check_ctime_sub (gfc_expr *, gfc_expr *);
-try gfc_check_system_clock (gfc_expr *, gfc_expr *, gfc_expr *);
-try gfc_check_date_and_time (gfc_expr *, gfc_expr *, gfc_expr *, gfc_expr *);
-try gfc_check_exit (gfc_expr *);
-try gfc_check_fdate_sub (gfc_expr *);
-try gfc_check_flush (gfc_expr *);
-try gfc_check_free (gfc_expr *);
-try gfc_check_fstat_sub (gfc_expr *, gfc_expr *, gfc_expr *);
-try gfc_check_gerror (gfc_expr *);
-try gfc_check_getarg (gfc_expr *, gfc_expr *);
-try gfc_check_getlog (gfc_expr *);
-try gfc_check_move_alloc (gfc_expr *, gfc_expr *);
-try gfc_check_mvbits (gfc_expr *, gfc_expr *, gfc_expr *, gfc_expr *,
+gfc_try gfc_check_alarm_sub (gfc_expr *, gfc_expr *, gfc_expr *);
+gfc_try gfc_check_chdir_sub (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_chmod_sub (gfc_expr *, gfc_expr *, gfc_expr *);
+gfc_try gfc_check_cpu_time (gfc_expr *);
+gfc_try gfc_check_ctime_sub (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_system_clock (gfc_expr *, gfc_expr *, gfc_expr *);
+gfc_try gfc_check_date_and_time (gfc_expr *, gfc_expr *, gfc_expr *, gfc_expr *);
+gfc_try gfc_check_exit (gfc_expr *);
+gfc_try gfc_check_fdate_sub (gfc_expr *);
+gfc_try gfc_check_flush (gfc_expr *);
+gfc_try gfc_check_free (gfc_expr *);
+gfc_try gfc_check_fstat_sub (gfc_expr *, gfc_expr *, gfc_expr *);
+gfc_try gfc_check_gerror (gfc_expr *);
+gfc_try gfc_check_getarg (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_getlog (gfc_expr *);
+gfc_try gfc_check_move_alloc (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_mvbits (gfc_expr *, gfc_expr *, gfc_expr *, gfc_expr *,
gfc_expr *);
-try gfc_check_random_number (gfc_expr *);
-try gfc_check_random_seed (gfc_expr *, gfc_expr *, gfc_expr *);
-try gfc_check_dtime_etime_sub (gfc_expr *, gfc_expr *);
-try gfc_check_fgetputc_sub (gfc_expr *, gfc_expr *, gfc_expr *);
-try gfc_check_fgetput_sub (gfc_expr *, gfc_expr *);
-try gfc_check_fseek_sub (gfc_expr *, gfc_expr *, gfc_expr *, gfc_expr *);
-try gfc_check_ftell_sub (gfc_expr *, gfc_expr *);
-try gfc_check_getcwd_sub (gfc_expr *, gfc_expr *);
-try gfc_check_hostnm_sub (gfc_expr *, gfc_expr *);
-try gfc_check_itime_idate (gfc_expr *);
-try gfc_check_kill_sub (gfc_expr *, gfc_expr *, gfc_expr *);
-try gfc_check_ltime_gmtime (gfc_expr *, gfc_expr *);
-try gfc_check_perror (gfc_expr *);
-try gfc_check_rename_sub (gfc_expr *, gfc_expr *, gfc_expr *);
-try gfc_check_link_sub (gfc_expr *, gfc_expr *, gfc_expr *);
-try gfc_check_symlnk_sub (gfc_expr *, gfc_expr *, gfc_expr *);
-try gfc_check_signal_sub (gfc_expr *, gfc_expr *, gfc_expr *);
-try gfc_check_sleep_sub (gfc_expr *);
-try gfc_check_stat_sub (gfc_expr *, gfc_expr *, gfc_expr *);
-try gfc_check_system_sub (gfc_expr *, gfc_expr *);
-try gfc_check_ttynam_sub (gfc_expr *, gfc_expr *);
-try gfc_check_umask_sub (gfc_expr *, gfc_expr *);
-try gfc_check_unlink_sub (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_random_number (gfc_expr *);
+gfc_try gfc_check_random_seed (gfc_expr *, gfc_expr *, gfc_expr *);
+gfc_try gfc_check_dtime_etime_sub (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_fgetputc_sub (gfc_expr *, gfc_expr *, gfc_expr *);
+gfc_try gfc_check_fgetput_sub (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_fseek_sub (gfc_expr *, gfc_expr *, gfc_expr *, gfc_expr *);
+gfc_try gfc_check_ftell_sub (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_getcwd_sub (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_hostnm_sub (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_itime_idate (gfc_expr *);
+gfc_try gfc_check_kill_sub (gfc_expr *, gfc_expr *, gfc_expr *);
+gfc_try gfc_check_ltime_gmtime (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_perror (gfc_expr *);
+gfc_try gfc_check_rename_sub (gfc_expr *, gfc_expr *, gfc_expr *);
+gfc_try gfc_check_link_sub (gfc_expr *, gfc_expr *, gfc_expr *);
+gfc_try gfc_check_symlnk_sub (gfc_expr *, gfc_expr *, gfc_expr *);
+gfc_try gfc_check_signal_sub (gfc_expr *, gfc_expr *, gfc_expr *);
+gfc_try gfc_check_sleep_sub (gfc_expr *);
+gfc_try gfc_check_stat_sub (gfc_expr *, gfc_expr *, gfc_expr *);
+gfc_try gfc_check_system_sub (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_ttynam_sub (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_umask_sub (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_unlink_sub (gfc_expr *, gfc_expr *);
/* Simplification functions. */
diff --git a/gcc/fortran/intrinsic.texi b/gcc/fortran/intrinsic.texi
index db336bfcd92..8337f74c522 100644
--- a/gcc/fortran/intrinsic.texi
+++ b/gcc/fortran/intrinsic.texi
@@ -7,10 +7,9 @@ For copying conditions, see the file gfortran.texi.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with the
-Invariant Sections being ``GNU General Public License'' and ``Funding
-Free Software'', the Front-Cover texts being (a) (see below), and with
-the Back-Cover Texts being (b) (see below). A copy of the license is
-included in the gfdl(7) man page.
+Invariant Sections being ``Funding Free Software'', the Front-Cover
+Texts being (a) (see below), and with the Back-Cover Texts being (b)
+(see below). A copy of the license is included in the gfdl(7) man page.
Some basic guidelines for editing this document:
diff --git a/gcc/fortran/invoke.texi b/gcc/fortran/invoke.texi
index 445b4a7d1a9..b2370d4de0e 100644
--- a/gcc/fortran/invoke.texi
+++ b/gcc/fortran/invoke.texi
@@ -5,16 +5,15 @@
@ignore
@c man begin COPYRIGHT
-Copyright @copyright{} 2004, 2005, 2006, 2007
+Copyright @copyright{} 2004, 2005, 2006, 2007, 2008
Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with the
-Invariant Sections being ``GNU General Public License'' and ``Funding
-Free Software'', the Front-Cover texts being (a) (see below), and with
-the Back-Cover Texts being (b) (see below). A copy of the license is
-included in the gfdl(7) man page.
+Invariant Sections being ``Funding Free Software'', the Front-Cover
+Texts being (a) (see below), and with the Back-Cover Texts being (b)
+(see below). A copy of the license is included in the gfdl(7) man page.
(a) The FSF's Front-Cover Text is:
@@ -137,9 +136,9 @@ by type. Explanations are in the following sections.
and warnings}.
@gccoptlist{-fmax-errors=@var{n} @gol
-fsyntax-only -pedantic -pedantic-errors @gol
--Wall -Waliasing -Wampersand -Wcharacter-truncation -Wconversion @gol
--Wimplicit-interface -Wline-truncation -Wnonstd-intrinsics -Wsurprising @gol
--Wno-tabs -Wunderflow -Wunused-parameter}
+-Wall -Waliasing -Wampersand -Warray-bounds -Wcharacter-truncation @gol
+-Wconversion -Wimplicit-interface -Wline-truncation -Wintrinsics-std @gol
+-Wsurprising -Wno-tabs -Wunderflow -Wunused-parameter -Wintrinsics-shadow}
@item Debugging Options
@xref{Debugging Options,,Options for debugging your program or GNU Fortran}.
@@ -164,7 +163,7 @@ and warnings}.
@xref{Code Gen Options,,Options for code generation conventions}.
@gccoptlist{-fno-automatic -ff2c -fno-underscoring
-fsecond-underscore @gol
--fbounds-check -fmax-stack-var-size=@var{n} @gol
+-fbounds-check -fcheck-array-temporaries -fmax-stack-var-size=@var{n} @gol
-fpack-derived -frepack-arrays -fshort-enums -fexternal-blas @gol
-fblas-matmul-limit=@var{n} -frecursive -finit-local-zero @gol
-finit-integer=@var{n} -finit-real=@var{<zero|inf|-inf|nan>} @gol
@@ -211,7 +210,9 @@ form is determined by the file extension.
Accept all of the intrinsic procedures provided in libgfortran
without regard to the setting of @option{-std}. In particular,
this option can be quite useful with @option{-std=f95}. Additionally,
-@command{gfortran} will ignore @option{-Wnonstd-intrinsics}.
+@command{gfortran} will ignore @option{-Wintrinsics-std} and will never try
+to link to an @code{EXTERNAL} version if the intrinsic is not included in the
+selected standard.
@item -fd-lines-as-code
@item -fd-lines-as-comments
@@ -662,8 +663,8 @@ warnings.
Enables commonly used warning options pertaining to usage that
we recommend avoiding and that we believe are easy to avoid.
This currently includes @option{-Waliasing},
-@option{-Wampersand}, @option{-Wsurprising}, @option{-Wnonstd-intrinsics},
-@option{-Wno-tabs}, and @option{-Wline-truncation}.
+@option{-Wampersand}, @option{-Wsurprising}, @option{-Wintrinsics-std},
+@option{-Wno-tabs}, @option{-Wintrinsic-shadow} and @option{-Wline-truncation}.
@item -Waliasing
@opindex @code{Waliasing}
@@ -698,6 +699,13 @@ given in a continued character constant, GNU Fortran assumes continuation
at the first non-comment, non-whitespace character after the ampersand
that initiated the continuation.
+@item -Warray-temporaries
+@opindex @code{Warray-temporaries}
+@cindex warnings, array temporaries
+Warn about array temporaries generated by the compiler. The information
+generated by this warning is sometimes useful in optimization, in order to
+avoid such temporaries.
+
@item -Wcharacter-truncation
@opindex @code{Wcharacter-truncation}
@cindex warnings, character truncation
@@ -721,11 +729,15 @@ Warn if a procedure is called without an explicit interface.
Note this only checks that an explicit interface is present. It does not
check that the declared interfaces are consistent across program units.
-@item -Wnonstd-intrinsics
-@opindex @code{Wnonstd-intrinsics}
+@item -Wintrinsics-std
+@opindex @code{Wintrinsics-std}
@cindex warnings, non-standard intrinsics
-Warn if the user tries to use an intrinsic that does not belong to the
-standard the user has chosen via the @option{-std} option.
+@cindex warnings, intrinsics of other standards
+Warn if @command{gfortran} finds a procedure named like an intrinsic not
+available in the currently selected standard (with @option{-std}) and treats
+it as @code{EXTERNAL} procedure because of this. @option{-fall-intrinsics} can
+be used to never trigger this behaviour and always link to the intrinsic
+regardless of the selected standard.
@item -Wsurprising
@opindex @code{Wsurprising}
@@ -765,6 +777,15 @@ is active for @option{-pedantic}, @option{-std=f95}, @option{-std=f2003},
Produce a warning when numerical constant expressions are
encountered, which yield an UNDERFLOW during compilation.
+@item -Wintrinsic-shadow
+@opindex @code{Wintrinsic-shadow}
+@cindex warnings, intrinsic
+@cindex intrinsic
+Warn if a user-defined procedure or module procedure has the same name as an
+intrinsic; in this case, an explicit interface or @code{EXTERNAL} or
+@code{INTRINSIC} declaration might be needed to get calls later resolved to
+the desired intrinsic/procedure.
+
@item -Wunused-parameter
@opindex @code{Wunused-parameter}
@cindex warnings, unused parameter
@@ -1146,6 +1167,17 @@ the compilation of the main program.
In the future this may also include other forms of checking, e.g., checking
substring references.
+
+@item fcheck-array-temporaries
+@opindex @code{fcheck-array-temporaries}
+@cindex checking array temporaries
+Warns at run time when for passing an actual argument a temporary array
+had to be generated. The information generated by this warning is
+sometimes useful in optimization, in order to avoid such temporaries.
+
+Note: The warning is only printed once per location.
+
+
@item -fmax-stack-var-size=@var{n}
@opindex @code{fmax-stack-var-size}
This option specifies the size in bytes of the largest array that will be put
diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c
index 23bf5f92216..58326b707f5 100644
--- a/gcc/fortran/io.c
+++ b/gcc/fortran/io.c
@@ -119,6 +119,8 @@ format_token;
process. */
static gfc_char_t *format_string;
static int format_length, use_last_char;
+static char error_element;
+static locus format_locus;
static format_token saved_token;
@@ -165,6 +167,9 @@ next_char (int in_string)
if (mode == MODE_COPY)
*format_string++ = c;
+ if (mode != MODE_STRING)
+ format_locus = gfc_current_locus;
+
c = gfc_wide_toupper (c);
return c;
}
@@ -186,7 +191,7 @@ next_char_not_space (bool *error)
char c;
do
{
- c = next_char (0);
+ error_element = c = next_char (0);
if (c == '\t')
{
if (gfc_option.allow_std & GFC_STD_GNU)
@@ -431,14 +436,14 @@ format_lex (void)
{
if (gfc_notify_std (GFC_STD_F2003, "Fortran 2003: DP format "
"specifier not allowed at %C") == FAILURE)
- return FMT_ERROR;
+ return FMT_ERROR;
token = FMT_DP;
}
else if (c == 'C')
{
if (gfc_notify_std (GFC_STD_F2003, "Fortran 2003: DC format "
"specifier not allowed at %C") == FAILURE)
- return FMT_ERROR;
+ return FMT_ERROR;
token = FMT_DC;
}
else
@@ -469,12 +474,13 @@ format_lex (void)
by itself, and we are checking it for validity. The dual origin
means that the warning message is a little less than great. */
-static try
+static gfc_try
check_format (bool is_input)
{
const char *posint_required = _("Positive width required");
const char *nonneg_required = _("Nonnegative width required");
- const char *unexpected_element = _("Unexpected element");
+ const char *unexpected_element = _("Unexpected element '%c' in format string"
+ " at %L");
const char *unexpected_end = _("Unexpected end of format string");
const char *zero_width = _("Zero width in format descriptor");
const char *g0_precision = _("Specifying precision with G0 not allowed");
@@ -483,7 +489,7 @@ check_format (bool is_input)
format_token t, u;
int level;
int repeat;
- try rv;
+ gfc_try rv;
use_last_char = 0;
saved_token = FMT_NONE;
@@ -696,7 +702,7 @@ data_desc:
goto syntax;
}
- if (gfc_notify_std (GFC_STD_F2008, "Fortran F2008: 'G0' in "
+ if (gfc_notify_std (GFC_STD_F2008, "Fortran 2008: 'G0' in "
"format at %C") == FAILURE)
return FAILURE;
@@ -960,10 +966,11 @@ extension_optional_comma:
goto format_item;
syntax:
- gfc_error ("%s in format string at %C", error);
+ if (error == unexpected_element)
+ gfc_error (error, error_element, &format_locus);
+ else
+ gfc_error ("%s in format string at %L", error, &format_locus);
fail:
- /* TODO: More elaborate measures are needed to show where a problem
- is within a format string that has been calculated. */
rv = FAILURE;
finished:
@@ -974,7 +981,7 @@ finished:
/* Given an expression node that is a constant string, see if it looks
like a format string. */
-static try
+static gfc_try
check_format_string (gfc_expr *e, bool is_input)
{
if (!e || e->ts.type != BT_CHARACTER || e->expr_type != EXPR_CONSTANT)
@@ -982,6 +989,12 @@ check_format_string (gfc_expr *e, bool is_input)
mode = MODE_STRING;
format_string = e->value.character.string;
+
+ /* More elaborate measures are needed to show where a problem is within a
+ format string that has been calculated, but that's probably not worth the
+ effort. */
+ format_locus = e->where;
+
return check_format (is_input);
}
@@ -1178,7 +1191,7 @@ match_ltag (const io_tag *tag, gfc_st_label ** label)
/* Resolution of the FORMAT tag, to be called from resolve_tag. */
-static try
+static gfc_try
resolve_tag_format (const gfc_expr *e)
{
if (e->expr_type == EXPR_CONSTANT
@@ -1247,7 +1260,7 @@ resolve_tag_format (const gfc_expr *e)
/* Do expression resolution and type-checking on an expression tag. */
-static try
+static gfc_try
resolve_tag (const io_tag *tag, gfc_expr *e)
{
if (e == NULL)
@@ -1404,7 +1417,7 @@ gfc_free_open (gfc_open *open)
/* Resolve everything in a gfc_open structure. */
-try
+gfc_try
gfc_resolve_open (gfc_open *open)
{
@@ -2004,7 +2017,7 @@ cleanup:
/* Resolve everything in a gfc_close structure. */
-try
+gfc_try
gfc_resolve_close (gfc_close *close)
{
RESOLVE_TAG (&tag_unit, close->unit);
@@ -2128,7 +2141,7 @@ cleanup:
}
-try
+gfc_try
gfc_resolve_filepos (gfc_filepos *fp)
{
RESOLVE_TAG (&tag_unit, fp->unit);
@@ -2454,7 +2467,7 @@ gfc_free_dt (gfc_dt *dt)
/* Resolve everything in a gfc_dt structure. */
-try
+gfc_try
gfc_resolve_dt (gfc_dt *dt)
{
gfc_expr *e;
@@ -2489,9 +2502,9 @@ gfc_resolve_dt (gfc_dt *dt)
else
{
/* At this point, we have an extra comma. If io_unit has arrived as
- type chracter, we assume its really the "format" form of the I/O
+ type character, we assume its really the "format" form of the I/O
statement. We set the io_unit to the default unit and format to
- the chracter expression. See F95 Standard section 9.4. */
+ the character expression. See F95 Standard section 9.4. */
io_kind k;
k = dt->extra_comma->value.iokind;
if (e->ts.type == BT_CHARACTER && (k == M_READ || k == M_PRINT))
@@ -2623,7 +2636,7 @@ static match match_io_element (io_kind, gfc_code **);
static match
match_io_iterator (io_kind k, gfc_code **result)
{
- gfc_code *head, *tail, *new;
+ gfc_code *head, *tail, *new_code;
gfc_iterator *iter;
locus old_loc;
match m;
@@ -2659,7 +2672,7 @@ match_io_iterator (io_kind k, gfc_code **result)
break;
}
- m = match_io_element (k, &new);
+ m = match_io_element (k, &new_code);
if (m == MATCH_ERROR)
goto cleanup;
if (m == MATCH_NO)
@@ -2669,7 +2682,7 @@ match_io_iterator (io_kind k, gfc_code **result)
goto cleanup;
}
- tail = gfc_append_code (tail, new);
+ tail = gfc_append_code (tail, new_code);
if (gfc_match_char (',') != MATCH_YES)
{
@@ -2683,15 +2696,15 @@ match_io_iterator (io_kind k, gfc_code **result)
if (gfc_match_char (')') != MATCH_YES)
goto syntax;
- new = gfc_get_code ();
- new->op = EXEC_DO;
- new->ext.iterator = iter;
+ new_code = gfc_get_code ();
+ new_code->op = EXEC_DO;
+ new_code->ext.iterator = iter;
- new->block = gfc_get_code ();
- new->block->op = EXEC_DO;
- new->block->next = head;
+ new_code->block = gfc_get_code ();
+ new_code->block->op = EXEC_DO;
+ new_code->block->next = head;
- *result = new;
+ *result = new_code;
return MATCH_YES;
syntax:
@@ -2799,7 +2812,7 @@ match_io_element (io_kind k, gfc_code **cpp)
static match
match_io_list (io_kind k, gfc_code **head_p)
{
- gfc_code *head, *tail, *new;
+ gfc_code *head, *tail, *new_code;
match m;
*head_p = head = tail = NULL;
@@ -2808,15 +2821,15 @@ match_io_list (io_kind k, gfc_code **head_p)
for (;;)
{
- m = match_io_element (k, &new);
+ m = match_io_element (k, &new_code);
if (m == MATCH_ERROR)
goto cleanup;
if (m == MATCH_NO)
goto syntax;
- tail = gfc_append_code (tail, new);
+ tail = gfc_append_code (tail, new_code);
if (head == NULL)
- head = new;
+ head = new_code;
if (gfc_match_eos () == MATCH_YES)
break;
@@ -3692,7 +3705,7 @@ cleanup:
/* Resolve everything in a gfc_inquire structure. */
-try
+gfc_try
gfc_resolve_inquire (gfc_inquire *inquire)
{
RESOLVE_TAG (&tag_unit, inquire->unit);
@@ -3751,7 +3764,7 @@ gfc_free_wait (gfc_wait *wait)
}
-try
+gfc_try
gfc_resolve_wait (gfc_wait *wait)
{
RESOLVE_TAG (&tag_unit, wait->unit);
diff --git a/gcc/fortran/iresolve.c b/gcc/fortran/iresolve.c
index 2c804143ba9..f447ba279cf 100644
--- a/gcc/fortran/iresolve.c
+++ b/gcc/fortran/iresolve.c
@@ -705,7 +705,7 @@ gfc_resolve_dot_product (gfc_expr *f, gfc_expr *a, gfc_expr *b)
temp.expr_type = EXPR_OP;
gfc_clear_ts (&temp.ts);
- temp.value.op.operator = INTRINSIC_NONE;
+ temp.value.op.op = INTRINSIC_NONE;
temp.value.op.op1 = a;
temp.value.op.op2 = b;
gfc_type_convert_binary (&temp);
@@ -1332,7 +1332,7 @@ gfc_resolve_matmul (gfc_expr *f, gfc_expr *a, gfc_expr *b)
{
temp.expr_type = EXPR_OP;
gfc_clear_ts (&temp.ts);
- temp.value.op.operator = INTRINSIC_NONE;
+ temp.value.op.op = INTRINSIC_NONE;
temp.value.op.op1 = a;
temp.value.op.op2 = b;
gfc_type_convert_binary (&temp);
diff --git a/gcc/fortran/lang.opt b/gcc/fortran/lang.opt
index f0f6c6a756d..93211952c12 100644
--- a/gcc/fortran/lang.opt
+++ b/gcc/fortran/lang.opt
@@ -76,6 +76,10 @@ Wampersand
Fortran Warning
Warn about missing ampersand in continued character constants
+Warray-temporaries
+Fortran Warning
+Warn about creation of array temporaries
+
Wcharacter-truncation
Fortran Warning
Warn about truncated character expressions
@@ -92,9 +96,9 @@ Wline-truncation
Fortran Warning
Warn about truncated source lines
-Wnonstd-intrinsics
+Wintrinsics-std
Fortran Warning
-Warn about usage of non-standard intrinsics
+Warn on intrinsics not part of the selected standard
Wreturn-type
Fortran Warning
@@ -112,6 +116,10 @@ Wunderflow
Fortran Warning
Warn about underflow of numerical constant expressions
+Wintrinsic-shadow
+Fortran Warning
+Warn if a user-procedure has the same name as an intrinsic
+
cpp
Fortran Joined Separate Negative(nocpp)
Enable preprocessing
@@ -148,6 +156,10 @@ fblas-matmul-limit=
Fortran RejectNegative Joined UInteger
-fblas-matmul-limit=<n> Size of the smallest matrix for which matmul will use BLAS
+fcheck-array-temporaries
+Fortran
+Produce a warning at runtime if a array temporary has been created for a procedure argument
+
fconvert=big-endian
Fortran RejectNegative
Use big-endian format for unformatted files
diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c
index d501d682475..42fe7943aea 100644
--- a/gcc/fortran/match.c
+++ b/gcc/fortran/match.c
@@ -1187,6 +1187,11 @@ loop:
}
default:
+
+ /* gfc_next_ascii_char converts characters to lower-case, so we shouldn't
+ expect an upper case character here! */
+ gcc_assert (TOLOWER (c) == c);
+
if (c == gfc_next_ascii_char ())
goto loop;
break;
@@ -1287,7 +1292,7 @@ gfc_match_assignment (void)
return MATCH_NO;
}
- if (lvalue->symtree->n.sym->attr.protected
+ if (lvalue->symtree->n.sym->attr.is_protected
&& lvalue->symtree->n.sym->attr.use_assoc)
{
gfc_current_locus = old_loc;
@@ -1347,7 +1352,7 @@ gfc_match_pointer_assignment (void)
if (m != MATCH_YES)
goto cleanup;
- if (lvalue->symtree->n.sym->attr.protected
+ if (lvalue->symtree->n.sym->attr.is_protected
&& lvalue->symtree->n.sym->attr.use_assoc)
{
gfc_error ("Assigning to a PROTECTED pointer at %C");
@@ -3836,7 +3841,7 @@ cleanup:
static match
match_forall_header (gfc_forall_iterator **phead, gfc_expr **mask)
{
- gfc_forall_iterator *head, *tail, *new;
+ gfc_forall_iterator *head, *tail, *new_iter;
gfc_expr *msk;
match m;
@@ -3848,27 +3853,27 @@ match_forall_header (gfc_forall_iterator **phead, gfc_expr **mask)
if (gfc_match_char ('(') != MATCH_YES)
return MATCH_NO;
- m = match_forall_iterator (&new);
+ m = match_forall_iterator (&new_iter);
if (m == MATCH_ERROR)
goto cleanup;
if (m == MATCH_NO)
goto syntax;
- head = tail = new;
+ head = tail = new_iter;
for (;;)
{
if (gfc_match_char (',') != MATCH_YES)
break;
- m = match_forall_iterator (&new);
+ m = match_forall_iterator (&new_iter);
if (m == MATCH_ERROR)
goto cleanup;
if (m == MATCH_YES)
{
- tail->next = new;
- tail = new;
+ tail->next = new_iter;
+ tail = new_iter;
continue;
}
diff --git a/gcc/fortran/match.h b/gcc/fortran/match.h
index 21a24795664..9c9d206822c 100644
--- a/gcc/fortran/match.h
+++ b/gcc/fortran/match.h
@@ -175,17 +175,17 @@ match gfc_match_volatile (void);
/* Fortran 2003 c interop.
TODO: some of these should be moved to another file rather than decl.c */
void set_com_block_bind_c (gfc_common_head *, int);
-try set_binding_label (char *, const char *, int);
-try set_verify_bind_c_sym (gfc_symbol *, int);
-try set_verify_bind_c_com_block (gfc_common_head *, int);
-try get_bind_c_idents (void);
+gfc_try set_binding_label (char *, const char *, int);
+gfc_try set_verify_bind_c_sym (gfc_symbol *, int);
+gfc_try set_verify_bind_c_com_block (gfc_common_head *, int);
+gfc_try get_bind_c_idents (void);
match gfc_match_bind_c_stmt (void);
match gfc_match_suffix (gfc_symbol *, gfc_symbol **);
match gfc_match_bind_c (gfc_symbol *, bool);
-match gfc_get_type_attr_spec (symbol_attribute *);
+match gfc_get_type_attr_spec (symbol_attribute *, char*);
/* primary.c. */
-match gfc_match_structure_constructor (gfc_symbol *, gfc_expr **);
+match gfc_match_structure_constructor (gfc_symbol *, gfc_expr **, bool);
match gfc_match_variable (gfc_expr **, int);
match gfc_match_equiv_variable (gfc_expr **);
match gfc_match_actual_arglist (int, gfc_actual_arglist **);
diff --git a/gcc/fortran/matchexp.c b/gcc/fortran/matchexp.c
index a9e90c99454..f7573655316 100644
--- a/gcc/fortran/matchexp.c
+++ b/gcc/fortran/matchexp.c
@@ -130,19 +130,12 @@ gfc_get_parentheses (gfc_expr *e)
{
gfc_expr *e2;
- /* This is a temporary fix, awaiting the patch for various
- other character problems. The resolution and translation
- of substrings and concatenations are so kludged up that
- putting parentheses around them breaks everything. */
- if (e->ts.type == BT_CHARACTER && e->ref)
- return e;
-
e2 = gfc_get_expr();
e2->expr_type = EXPR_OP;
e2->ts = e->ts;
e2->rank = e->rank;
e2->where = e->where;
- e2->value.op.operator = INTRINSIC_PARENTHESES;
+ e2->value.op.op = INTRINSIC_PARENTHESES;
e2->value.op.op1 = e;
e2->value.op.op2 = NULL;
return e2;
@@ -208,20 +201,20 @@ syntax:
/* Build an operator expression node. */
static gfc_expr *
-build_node (gfc_intrinsic_op operator, locus *where,
+build_node (gfc_intrinsic_op op, locus *where,
gfc_expr *op1, gfc_expr *op2)
{
- gfc_expr *new;
+ gfc_expr *new_expr;
- new = gfc_get_expr ();
- new->expr_type = EXPR_OP;
- new->value.op.operator = operator;
- new->where = *where;
+ new_expr = gfc_get_expr ();
+ new_expr->expr_type = EXPR_OP;
+ new_expr->value.op.op = op;
+ new_expr->where = *where;
- new->value.op.op1 = op1;
- new->value.op.op2 = op2;
+ new_expr->value.op.op1 = op1;
+ new_expr->value.op.op2 = op2;
- return new;
+ return new_expr;
}
@@ -261,7 +254,7 @@ match_level_1 (gfc_expr **result)
/* As a GNU extension we support an expanded level-2 expression syntax.
Via this extension we support (arbitrary) nesting of unary plus and
minus operations following unary and binary operators, such as **.
- The grammar of section 7.1.1.3 is effectively rewitten as:
+ The grammar of section 7.1.1.3 is effectively rewritten as:
R704 mult-operand is level-1-expr [ power-op ext-mult-operand ]
R704' ext-mult-operand is add-op ext-mult-operand
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index 67b09c767e9..7da5be16b56 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
-/* The syntax of gfortran modules resembles that of lisp lists, ie a
+/* The syntax of gfortran modules resembles that of lisp lists, i.e. a
sequence of atoms, which can be left or right parenthesis, names,
integers or strings. Parenthesis are always matched which allows
us to skip over sections at high speed without having to know
@@ -169,7 +169,7 @@ typedef struct gfc_use_rename
char local_name[GFC_MAX_SYMBOL_LEN + 1], use_name[GFC_MAX_SYMBOL_LEN + 1];
struct gfc_use_rename *next;
int found;
- gfc_intrinsic_op operator;
+ gfc_intrinsic_op op;
locus where;
}
gfc_use_rename;
@@ -446,7 +446,7 @@ associate_integer_pointer (pointer_info *p, void *gp)
either store the pointer from an already-known value or create a
fixup structure in order to store things later. Returns zero if
the reference has been actually stored, or nonzero if the reference
- must be fixed later (ie associate_integer_pointer must be called
+ must be fixed later (i.e., associate_integer_pointer must be called
sometime later. Returns the pointer_info structure. */
static pointer_info *
@@ -502,9 +502,9 @@ match
gfc_match_use (void)
{
char name[GFC_MAX_SYMBOL_LEN + 1], module_nature[GFC_MAX_SYMBOL_LEN + 1];
- gfc_use_rename *tail = NULL, *new;
+ gfc_use_rename *tail = NULL, *new_use;
interface_type type, type2;
- gfc_intrinsic_op operator;
+ gfc_intrinsic_op op;
match m;
specified_int = false;
@@ -581,20 +581,20 @@ gfc_match_use (void)
for (;;)
{
/* Get a new rename struct and add it to the rename list. */
- new = gfc_get_use_rename ();
- new->where = gfc_current_locus;
- new->found = 0;
+ new_use = gfc_get_use_rename ();
+ new_use->where = gfc_current_locus;
+ new_use->found = 0;
if (gfc_rename_list == NULL)
- gfc_rename_list = new;
+ gfc_rename_list = new_use;
else
- tail->next = new;
- tail = new;
+ tail->next = new_use;
+ tail = new_use;
/* See what kind of interface we're dealing with. Assume it is
not an operator. */
- new->operator = INTRINSIC_NONE;
- if (gfc_match_generic_spec (&type, name, &operator) == MATCH_ERROR)
+ new_use->op = INTRINSIC_NONE;
+ if (gfc_match_generic_spec (&type, name, &op) == MATCH_ERROR)
goto cleanup;
switch (type)
@@ -614,16 +614,16 @@ gfc_match_use (void)
goto cleanup;
if (type == INTERFACE_USER_OP)
- new->operator = INTRINSIC_USER;
+ new_use->op = INTRINSIC_USER;
if (only_flag)
{
if (m != MATCH_YES)
- strcpy (new->use_name, name);
+ strcpy (new_use->use_name, name);
else
{
- strcpy (new->local_name, name);
- m = gfc_match_generic_spec (&type2, new->use_name, &operator);
+ strcpy (new_use->local_name, name);
+ m = gfc_match_generic_spec (&type2, new_use->use_name, &op);
if (type != type2)
goto syntax;
if (m == MATCH_NO)
@@ -636,9 +636,9 @@ gfc_match_use (void)
{
if (m != MATCH_YES)
goto syntax;
- strcpy (new->local_name, name);
+ strcpy (new_use->local_name, name);
- m = gfc_match_generic_spec (&type2, new->use_name, &operator);
+ m = gfc_match_generic_spec (&type2, new_use->use_name, &op);
if (type != type2)
goto syntax;
if (m == MATCH_NO)
@@ -647,8 +647,8 @@ gfc_match_use (void)
goto cleanup;
}
- if (strcmp (new->use_name, module_name) == 0
- || strcmp (new->local_name, module_name) == 0)
+ if (strcmp (new_use->use_name, module_name) == 0
+ || strcmp (new_use->local_name, module_name) == 0)
{
gfc_error ("The name '%s' at %C has already been used as "
"an external module name.", module_name);
@@ -657,7 +657,7 @@ gfc_match_use (void)
break;
case INTERFACE_INTRINSIC_OP:
- new->operator = operator;
+ new_use->op = op;
break;
default:
@@ -698,8 +698,8 @@ find_use_name_n (const char *name, int *inst, bool interface)
for (u = gfc_rename_list; u; u = u->next)
{
if (strcmp (u->use_name, name) != 0
- || (u->operator == INTRINSIC_USER && !interface)
- || (u->operator != INTRINSIC_USER && interface))
+ || (u->op == INTRINSIC_USER && !interface)
+ || (u->op != INTRINSIC_USER && interface))
continue;
if (++i == *inst)
break;
@@ -746,12 +746,12 @@ number_use_names (const char *name, bool interface)
/* Try to find the operator in the current list. */
static gfc_use_rename *
-find_use_operator (gfc_intrinsic_op operator)
+find_use_operator (gfc_intrinsic_op op)
{
gfc_use_rename *u;
for (u = gfc_rename_list; u; u = u->next)
- if (u->operator == operator)
+ if (u->op == op)
return u;
return NULL;
@@ -1648,7 +1648,8 @@ typedef enum
AB_ELEMENTAL, AB_PURE, AB_RECURSIVE, AB_GENERIC, AB_ALWAYS_EXPLICIT,
AB_CRAY_POINTER, AB_CRAY_POINTEE, AB_THREADPRIVATE, AB_ALLOC_COMP,
AB_POINTER_COMP, AB_PRIVATE_COMP, AB_VALUE, AB_VOLATILE, AB_PROTECTED,
- AB_IS_BIND_C, AB_IS_C_INTEROP, AB_IS_ISO_C, AB_ABSTRACT, AB_ZERO_COMP
+ AB_IS_BIND_C, AB_IS_C_INTEROP, AB_IS_ISO_C, AB_ABSTRACT, AB_ZERO_COMP,
+ AB_EXTENSION
}
ab_attribute;
@@ -1688,6 +1689,7 @@ static const mstring attr_bits[] =
minit ("ZERO_COMP", AB_ZERO_COMP),
minit ("PROTECTED", AB_PROTECTED),
minit ("ABSTRACT", AB_ABSTRACT),
+ minit ("EXTENSION", AB_EXTENSION),
minit (NULL, -1)
};
@@ -1741,7 +1743,7 @@ mio_symbol_attribute (symbol_attribute *attr)
MIO_NAME (ab_attribute) (AB_OPTIONAL, attr_bits);
if (attr->pointer)
MIO_NAME (ab_attribute) (AB_POINTER, attr_bits);
- if (attr->protected)
+ if (attr->is_protected)
MIO_NAME (ab_attribute) (AB_PROTECTED, attr_bits);
if (attr->value)
MIO_NAME (ab_attribute) (AB_VALUE, attr_bits);
@@ -1801,6 +1803,8 @@ mio_symbol_attribute (symbol_attribute *attr)
MIO_NAME (ab_attribute) (AB_PRIVATE_COMP, attr_bits);
if (attr->zero_comp)
MIO_NAME (ab_attribute) (AB_ZERO_COMP, attr_bits);
+ if (attr->extension)
+ MIO_NAME (ab_attribute) (AB_EXTENSION, attr_bits);
mio_rparen ();
@@ -1836,7 +1840,7 @@ mio_symbol_attribute (symbol_attribute *attr)
attr->pointer = 1;
break;
case AB_PROTECTED:
- attr->protected = 1;
+ attr->is_protected = 1;
break;
case AB_VALUE:
attr->value = 1;
@@ -1919,6 +1923,9 @@ mio_symbol_attribute (symbol_attribute *attr)
case AB_ZERO_COMP:
attr->zero_comp = 1;
break;
+ case AB_EXTENSION:
+ attr->extension = 1;
+ break;
}
}
}
@@ -2873,10 +2880,10 @@ mio_expr (gfc_expr **ep)
switch (e->expr_type)
{
case EXPR_OP:
- e->value.op.operator
- = MIO_NAME (gfc_intrinsic_op) (e->value.op.operator, intrinsics);
+ e->value.op.op
+ = MIO_NAME (gfc_intrinsic_op) (e->value.op.op, intrinsics);
- switch (e->value.op.operator)
+ switch (e->value.op.op)
{
case INTRINSIC_UPLUS:
case INTRINSIC_UMINUS:
@@ -3062,7 +3069,7 @@ mio_namelist (gfc_symbol *sym)
}
-/* Save/restore lists of gfc_interface stuctures. When loading an
+/* Save/restore lists of gfc_interface structures. When loading an
interface, we are really appending to the existing list of
interfaces. Checking for duplicate and ambiguous interfaces has to
be done later when all symbols have been loaded. */
@@ -3161,6 +3168,78 @@ mio_namespace_ref (gfc_namespace **nsp)
}
+/* Save/restore the f2k_derived namespace of a derived-type symbol. */
+
+static void
+mio_finalizer (gfc_finalizer **f)
+{
+ if (iomode == IO_OUTPUT)
+ {
+ gcc_assert (*f);
+ gcc_assert ((*f)->proc_tree); /* Should already be resolved. */
+ mio_symtree_ref (&(*f)->proc_tree);
+ }
+ else
+ {
+ *f = gfc_get_finalizer ();
+ (*f)->where = gfc_current_locus; /* Value should not matter. */
+ (*f)->next = NULL;
+
+ mio_symtree_ref (&(*f)->proc_tree);
+ (*f)->proc_sym = NULL;
+ }
+}
+
+static void
+mio_f2k_derived (gfc_namespace *f2k)
+{
+ /* Handle the list of finalizer procedures. */
+ mio_lparen ();
+ if (iomode == IO_OUTPUT)
+ {
+ gfc_finalizer *f;
+ for (f = f2k->finalizers; f; f = f->next)
+ mio_finalizer (&f);
+ }
+ else
+ {
+ f2k->finalizers = NULL;
+ while (peek_atom () != ATOM_RPAREN)
+ {
+ gfc_finalizer *cur;
+ mio_finalizer (&cur);
+ cur->next = f2k->finalizers;
+ f2k->finalizers = cur;
+ }
+ }
+ mio_rparen ();
+}
+
+static void
+mio_full_f2k_derived (gfc_symbol *sym)
+{
+ mio_lparen ();
+
+ if (iomode == IO_OUTPUT)
+ {
+ if (sym->f2k_derived)
+ mio_f2k_derived (sym->f2k_derived);
+ }
+ else
+ {
+ if (peek_atom () != ATOM_RPAREN)
+ {
+ sym->f2k_derived = gfc_get_namespace (NULL, 0);
+ mio_f2k_derived (sym->f2k_derived);
+ }
+ else
+ gcc_assert (!sym->f2k_derived);
+ }
+
+ mio_rparen ();
+}
+
+
/* Unlike most other routines, the address of the symbol node is already
fixed on input and the name/module has already been filled in. */
@@ -3223,6 +3302,9 @@ mio_symbol (gfc_symbol *sym)
sym->component_access
= MIO_NAME (gfc_access) (sym->component_access, access_types);
+ /* Load/save the f2k_derived namespace of a derived-type symbol. */
+ mio_full_f2k_derived (sym);
+
mio_namelist (sym);
/* Add the fields that say whether this is from an intrinsic module,
@@ -3272,7 +3354,7 @@ find_symtree_for_symbol (gfc_symtree *st, gfc_symbol *sym)
}
-/* A recursive function to look for a speficic symbol by name and by
+/* A recursive function to look for a specific symbol by name and by
module. Whilst several symtrees might point to one symbol, its
is sufficient for the purposes here than one exist. Note that
generic interfaces are distinguished as are symbols that have been
@@ -3383,16 +3465,16 @@ load_operator_interfaces (void)
if (i == 1)
{
uop = gfc_get_uop (p);
- pi = mio_interface_rest (&uop->operator);
+ pi = mio_interface_rest (&uop->op);
}
else
{
if (gfc_find_uop (p, NULL))
continue;
uop = gfc_get_uop (p);
- uop->operator = gfc_get_interface ();
- uop->operator->where = gfc_current_locus;
- add_fixup (pi->integer, &uop->operator->sym);
+ uop->op = gfc_get_interface ();
+ uop->op->where = gfc_current_locus;
+ add_fixup (pi->integer, &uop->op->sym);
}
}
}
@@ -3954,7 +4036,7 @@ read_module (void)
u->found = 1;
}
- mio_interface (&gfc_current_ns->operator[i]);
+ mio_interface (&gfc_current_ns->op[i]);
}
mio_rparen ();
@@ -3984,14 +4066,14 @@ read_module (void)
if (u->found)
continue;
- if (u->operator == INTRINSIC_NONE)
+ if (u->op == INTRINSIC_NONE)
{
gfc_error ("Symbol '%s' referenced at %L not found in module '%s'",
u->use_name, &u->where, module_name);
continue;
}
- if (u->operator == INTRINSIC_USER)
+ if (u->op == INTRINSIC_USER)
{
gfc_error ("User operator '%s' referenced at %L not found "
"in module '%s'", u->use_name, &u->where, module_name);
@@ -3999,7 +4081,7 @@ read_module (void)
}
gfc_error ("Intrinsic operator '%s' referenced at %L not found "
- "in module '%s'", gfc_op2string (u->operator), &u->where,
+ "in module '%s'", gfc_op2string (u->op), &u->where,
module_name);
}
@@ -4319,11 +4401,11 @@ write_operator (gfc_user_op *uop)
static char nullstring[] = "";
const char *p = nullstring;
- if (uop->operator == NULL
+ if (uop->op == NULL
|| !gfc_check_access (uop->access, uop->ns->default_access))
return;
- mio_symbol_interface (&uop->name, &p, &uop->operator);
+ mio_symbol_interface (&uop->name, &p, &uop->op);
}
@@ -4395,7 +4477,7 @@ write_module (void)
mio_interface (gfc_check_access (gfc_current_ns->operator_access[i],
gfc_current_ns->default_access)
- ? &gfc_current_ns->operator[i] : NULL);
+ ? &gfc_current_ns->op[i] : NULL);
}
mio_rparen ();
diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c
index 28f1cc24dfd..9ac9a4aec91 100644
--- a/gcc/fortran/openmp.c
+++ b/gcc/fortran/openmp.c
@@ -1093,7 +1093,7 @@ resolve_omp_atomic (gfc_code *code)
if (expr2->expr_type == EXPR_OP)
{
gfc_expr *v = NULL, *e, *c;
- gfc_intrinsic_op op = expr2->value.op.operator;
+ gfc_intrinsic_op op = expr2->value.op.op;
gfc_intrinsic_op alt_op = INTRINSIC_NONE;
switch (op)
@@ -1156,8 +1156,8 @@ resolve_omp_atomic (gfc_code *code)
else if ((c = is_conversion (e, true)) != NULL)
q = &e->value.function.actual->expr;
else if (e->expr_type != EXPR_OP
- || (e->value.op.operator != op
- && e->value.op.operator != alt_op)
+ || (e->value.op.op != op
+ && e->value.op.op != alt_op)
|| e->rank != 0)
break;
else
@@ -1176,7 +1176,7 @@ resolve_omp_atomic (gfc_code *code)
if (p != NULL)
{
e = *p;
- switch (e->value.op.operator)
+ switch (e->value.op.op)
{
case INTRINSIC_MINUS:
case INTRINSIC_DIVIDE:
diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c
index 8480364bc52..4ecb8f998e3 100644
--- a/gcc/fortran/options.c
+++ b/gcc/fortran/options.c
@@ -69,12 +69,15 @@ gfc_init_options (unsigned int argc, const char **argv)
gfc_option.warn_aliasing = 0;
gfc_option.warn_ampersand = 0;
gfc_option.warn_character_truncation = 0;
+ gfc_option.warn_array_temp = 0;
gfc_option.warn_conversion = 0;
gfc_option.warn_implicit_interface = 0;
gfc_option.warn_line_truncation = 0;
gfc_option.warn_surprising = 0;
gfc_option.warn_tabs = 1;
gfc_option.warn_underflow = 1;
+ gfc_option.warn_intrinsic_shadow = 0;
+ gfc_option.warn_intrinsics_std = 0;
gfc_option.max_errors = 25;
gfc_option.flag_all_intrinsics = 0;
@@ -98,6 +101,7 @@ gfc_init_options (unsigned int argc, const char **argv)
gfc_option.flag_backslash = 0;
gfc_option.flag_module_private = 0;
gfc_option.flag_backtrace = 0;
+ gfc_option.flag_check_array_temporaries = 0;
gfc_option.flag_allow_leading_underscore = 0;
gfc_option.flag_dump_core = 0;
gfc_option.flag_external_blas = 0;
@@ -123,8 +127,6 @@ gfc_init_options (unsigned int argc, const char **argv)
set_default_std_flags ();
- gfc_option.warn_nonstd_intrinsics = 0;
-
/* -fshort-enums can be default on some targets. */
gfc_option.fshort_enums = targetm.default_short_enums ();
@@ -292,14 +294,6 @@ gfc_post_options (const char **pfilename)
gfc_warning_now ("'-fd-lines-as-code' has no effect in free form");
}
- flag_inline_trees = 1;
-
- /* Use tree inlining. */
- if (!flag_no_inline)
- flag_no_inline = 1;
- if (flag_inline_functions)
- flag_inline_trees = 2;
-
/* If -pedantic, warn about the use of GNU extensions. */
if (pedantic && (gfc_option.allow_std & GFC_STD_GNU) != 0)
gfc_option.warn_std |= GFC_STD_GNU;
@@ -354,9 +348,6 @@ gfc_post_options (const char **pfilename)
gfc_option.warn_tabs = 0;
}
- if (gfc_option.flag_all_intrinsics)
- gfc_option.warn_nonstd_intrinsics = 0;
-
gfc_cpp_post_options ();
/* FIXME: return gfc_cpp_preprocess_only ();
@@ -378,13 +369,14 @@ set_Wall (int setting)
gfc_option.warn_aliasing = setting;
gfc_option.warn_ampersand = setting;
gfc_option.warn_line_truncation = setting;
- gfc_option.warn_nonstd_intrinsics = setting;
gfc_option.warn_surprising = setting;
gfc_option.warn_tabs = !setting;
gfc_option.warn_underflow = setting;
+ gfc_option.warn_intrinsic_shadow = setting;
+ gfc_option.warn_intrinsics_std = setting;
gfc_option.warn_character_truncation = setting;
- set_Wunused (setting);
+ warn_unused = setting;
warn_return_type = setting;
warn_switch = setting;
@@ -485,6 +477,10 @@ gfc_handle_option (size_t scode, const char *arg, int value)
gfc_option.warn_ampersand = value;
break;
+ case OPT_Warray_temporaries:
+ gfc_option.warn_array_temp = value;
+ break;
+
case OPT_Wcharacter_truncation:
gfc_option.warn_character_truncation = value;
break;
@@ -517,6 +513,10 @@ gfc_handle_option (size_t scode, const char *arg, int value)
gfc_option.warn_underflow = value;
break;
+ case OPT_Wintrinsic_shadow:
+ gfc_option.warn_intrinsic_shadow = value;
+ break;
+
case OPT_fall_intrinsics:
gfc_option.flag_all_intrinsics = 1;
break;
@@ -537,6 +537,10 @@ gfc_handle_option (size_t scode, const char *arg, int value)
gfc_option.flag_backtrace = value;
break;
+ case OPT_fcheck_array_temporaries:
+ gfc_option.flag_check_array_temporaries = value;
+ break;
+
case OPT_fdump_core:
gfc_option.flag_dump_core = value;
break;
@@ -778,8 +782,8 @@ gfc_handle_option (size_t scode, const char *arg, int value)
gfc_option.warn_std = 0;
break;
- case OPT_Wnonstd_intrinsics:
- gfc_option.warn_nonstd_intrinsics = value;
+ case OPT_Wintrinsics_std:
+ gfc_option.warn_intrinsics_std = value;
break;
case OPT_fshort_enums:
diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c
index 781efbc205d..965e733ea78 100644
--- a/gcc/fortran/parse.c
+++ b/gcc/fortran/parse.c
@@ -923,7 +923,7 @@ pop_state (void)
/* Try to find the given state in the state stack. */
-try
+gfc_try
gfc_find_state (gfc_compile_state state)
{
gfc_state_data *p;
@@ -1533,7 +1533,7 @@ unexpected_statement (gfc_statement st)
issue an error and return FAILURE. Otherwise we return SUCCESS.
Individual parsers need to verify that the statements seen are
- valid before calling here, ie ENTRY statements are not allowed in
+ valid before calling here, i.e., ENTRY statements are not allowed in
INTERFACE blocks. The following diagram is taken from the standard:
+---------------------------------------+
@@ -1575,7 +1575,7 @@ typedef struct
}
st_state;
-static try
+static gfc_try
verify_st_order (st_state *p, gfc_statement st)
{
@@ -3413,7 +3413,7 @@ gfc_global_used (gfc_gsymbol *sym, locus *where)
name = "MODULE";
break;
default:
- gfc_internal_error ("gfc_gsymbol_type(): Bad type");
+ gfc_internal_error ("gfc_global_used(): Bad type");
name = NULL;
}
@@ -3563,7 +3563,7 @@ add_global_program (void)
/* Top level parser. */
-try
+gfc_try
gfc_parse_file (void)
{
int seen_program, errors_before, errors;
@@ -3688,7 +3688,7 @@ done:
duplicate_main:
/* If we see a duplicate main program, shut down. If the second
- instance is an implied main program, ie data decls or executable
+ instance is an implied main program, i.e. data decls or executable
statements, we're in for lots of errors. */
gfc_error ("Two main PROGRAMs at %L and %C", &prog_locus);
reject_statement ();
diff --git a/gcc/fortran/parse.h b/gcc/fortran/parse.h
index 196b9f736a5..1ac3e948e9a 100644
--- a/gcc/fortran/parse.h
+++ b/gcc/fortran/parse.h
@@ -61,7 +61,7 @@ extern gfc_state_data *gfc_state_stack;
#define gfc_current_state() (gfc_state_stack->state)
int gfc_check_do_variable (gfc_symtree *);
-try gfc_find_state (gfc_compile_state);
+gfc_try gfc_find_state (gfc_compile_state);
gfc_state_data *gfc_enclosing_unit (gfc_compile_state *);
const char *gfc_ascii_statement (gfc_statement);
match gfc_match_enum (void);
diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c
index c67f2bd1873..dfea043d6e3 100644
--- a/gcc/fortran/primary.c
+++ b/gcc/fortran/primary.c
@@ -1984,11 +1984,103 @@ gfc_free_structure_ctor_component (gfc_structure_ctor_component *comp)
gfc_free_expr (comp->val);
}
-match
-gfc_match_structure_constructor (gfc_symbol *sym, gfc_expr **result)
+
+/* Translate the component list into the actual constructor by sorting it in
+ the order required; this also checks along the way that each and every
+ component actually has an initializer and handles default initializers
+ for components without explicit value given. */
+static gfc_try
+build_actual_constructor (gfc_structure_ctor_component **comp_head,
+ gfc_constructor **ctor_head, gfc_symbol *sym)
{
- gfc_structure_ctor_component *comp_head, *comp_tail;
gfc_structure_ctor_component *comp_iter;
+ gfc_constructor *ctor_tail = NULL;
+ gfc_component *comp;
+
+ for (comp = sym->components; comp; comp = comp->next)
+ {
+ gfc_structure_ctor_component **next_ptr;
+ gfc_expr *value = NULL;
+
+ /* Try to find the initializer for the current component by name. */
+ next_ptr = comp_head;
+ for (comp_iter = *comp_head; comp_iter; comp_iter = comp_iter->next)
+ {
+ if (!strcmp (comp_iter->name, comp->name))
+ break;
+ next_ptr = &comp_iter->next;
+ }
+
+ /* If an extension, try building the parent derived type by building
+ a value expression for the parent derived type and calling self. */
+ if (!comp_iter && comp == sym->components && sym->attr.extension)
+ {
+ value = gfc_get_expr ();
+ value->expr_type = EXPR_STRUCTURE;
+ value->value.constructor = NULL;
+ value->ts = comp->ts;
+ value->where = gfc_current_locus;
+
+ if (build_actual_constructor (comp_head, &value->value.constructor,
+ comp->ts.derived) == FAILURE)
+ {
+ gfc_free_expr (value);
+ return FAILURE;
+ }
+ *ctor_head = ctor_tail = gfc_get_constructor ();
+ ctor_tail->expr = value;
+ continue;
+ }
+
+ /* If it was not found, try the default initializer if there's any;
+ otherwise, it's an error. */
+ if (!comp_iter)
+ {
+ if (comp->initializer)
+ {
+ if (gfc_notify_std (GFC_STD_F2003, "Fortran 2003: Structure"
+ " constructor with missing optional arguments"
+ " at %C") == FAILURE)
+ return FAILURE;
+ value = gfc_copy_expr (comp->initializer);
+ }
+ else
+ {
+ gfc_error ("No initializer for component '%s' given in the"
+ " structure constructor at %C!", comp->name);
+ return FAILURE;
+ }
+ }
+ else
+ value = comp_iter->val;
+
+ /* Add the value to the constructor chain built. */
+ if (ctor_tail)
+ {
+ ctor_tail->next = gfc_get_constructor ();
+ ctor_tail = ctor_tail->next;
+ }
+ else
+ *ctor_head = ctor_tail = gfc_get_constructor ();
+ gcc_assert (value);
+ ctor_tail->expr = value;
+
+ /* Remove the entry from the component list. We don't want the expression
+ value to be free'd, so set it to NULL. */
+ if (comp_iter)
+ {
+ *next_ptr = comp_iter->next;
+ comp_iter->val = NULL;
+ gfc_free_structure_ctor_component (comp_iter);
+ }
+ }
+ return SUCCESS;
+}
+
+match
+gfc_match_structure_constructor (gfc_symbol *sym, gfc_expr **result, bool parent)
+{
+ gfc_structure_ctor_component *comp_tail, *comp_head, *comp_iter;
gfc_constructor *ctor_head, *ctor_tail;
gfc_component *comp; /* Is set NULL when named component is first seen */
gfc_expr *e;
@@ -1996,10 +2088,10 @@ gfc_match_structure_constructor (gfc_symbol *sym, gfc_expr **result)
match m;
const char* last_name = NULL;
- comp_head = comp_tail = NULL;
+ comp_tail = comp_head = NULL;
ctor_head = ctor_tail = NULL;
- if (gfc_match_char ('(') != MATCH_YES)
+ if (!parent && gfc_match_char ('(') != MATCH_YES)
goto syntax;
where = gfc_current_locus;
@@ -2047,7 +2139,7 @@ gfc_match_structure_constructor (gfc_symbol *sym, gfc_expr **result)
if (last_name)
gfc_error ("Component initializer without name after"
" component named %s at %C!", last_name);
- else
+ else if (!parent)
gfc_error ("Too many components in structure constructor at"
" %C!");
goto cleanup;
@@ -2057,39 +2149,20 @@ gfc_match_structure_constructor (gfc_symbol *sym, gfc_expr **result)
strncpy (comp_tail->name, comp->name, GFC_MAX_SYMBOL_LEN + 1);
}
- /* Find the current component in the structure definition; this is
- needed to get its access attribute in the private check below. */
+ /* Find the current component in the structure definition and check its
+ access is not private. */
if (comp)
- this_comp = comp;
+ this_comp = gfc_find_component (sym, comp->name);
else
{
- for (comp = sym->components; comp; comp = comp->next)
- if (!strcmp (comp->name, comp_tail->name))
- {
- this_comp = comp;
- break;
- }
+ this_comp = gfc_find_component (sym, (const char *)comp_tail->name);
comp = NULL; /* Reset needed! */
-
- /* Here we can check if a component name is given which does not
- correspond to any component of the defined structure. */
- if (!this_comp)
- {
- gfc_error ("Component '%s' in structure constructor at %C"
- " does not correspond to any component in the"
- " constructed structure!", comp_tail->name);
- goto cleanup;
- }
}
- gcc_assert (this_comp);
- /* Check the current component's access status. */
- if (sym->attr.use_assoc && this_comp->access == ACCESS_PRIVATE)
- {
- gfc_error ("Component '%s' is PRIVATE in structure constructor"
- " at %C!", comp_tail->name);
- goto cleanup;
- }
+ /* Here we can check if a component name is given which does not
+ correspond to any component of the defined structure. */
+ if (!this_comp)
+ goto cleanup;
/* Check if this component is already given a value. */
for (comp_iter = comp_head; comp_iter != comp_tail;
@@ -2111,89 +2184,56 @@ gfc_match_structure_constructor (gfc_symbol *sym, gfc_expr **result)
if (m == MATCH_ERROR)
goto cleanup;
- if (comp)
- comp = comp->next;
- }
- while (gfc_match_char (',') == MATCH_YES);
+ /* If not explicitly a parent constructor, gather up the components
+ and build one. */
+ if (comp && comp == sym->components
+ && sym->attr.extension
+ && (comp_tail->val->ts.type != BT_DERIVED
+ ||
+ comp_tail->val->ts.derived != this_comp->ts.derived))
+ {
+ gfc_current_locus = where;
+ gfc_free_expr (comp_tail->val);
- if (gfc_match_char (')') != MATCH_YES)
- goto syntax;
-
- /* If there were components given and all components are private, error
- out at this place. */
- if (sym->attr.use_assoc && sym->component_access == ACCESS_PRIVATE)
- {
- gfc_error ("All components of '%s' are PRIVATE in structure"
- " constructor at %C", sym->name);
- goto cleanup;
- }
- }
+ m = gfc_match_structure_constructor (comp->ts.derived,
+ &comp_tail->val, true);
+ if (m == MATCH_NO)
+ goto syntax;
+ if (m == MATCH_ERROR)
+ goto cleanup;
+ }
- /* Translate the component list into the actual constructor by sorting it in
- the order required; this also checks along the way that each and every
- component actually has an initializer and handles default initializers
- for components without explicit value given. */
- for (comp = sym->components; comp; comp = comp->next)
- {
- gfc_structure_ctor_component **next_ptr;
- gfc_expr *value = NULL;
+ if (comp)
+ comp = comp->next;
- /* Try to find the initializer for the current component by name. */
- next_ptr = &comp_head;
- for (comp_iter = comp_head; comp_iter; comp_iter = comp_iter->next)
- {
- if (!strcmp (comp_iter->name, comp->name))
+ if (parent && !comp)
break;
- next_ptr = &comp_iter->next;
- }
-
- /* If it was not found, try the default initializer if there's any;
- otherwise, it's an error. */
- if (!comp_iter)
- {
- if (comp->initializer)
- {
- if (gfc_notify_std (GFC_STD_F2003, "Fortran 2003: Structure"
- " constructor with missing optional arguments"
- " at %C") == FAILURE)
- goto cleanup;
- value = gfc_copy_expr (comp->initializer);
- }
- else
- {
- gfc_error ("No initializer for component '%s' given in the"
- " structure constructor at %C!", comp->name);
- goto cleanup;
- }
}
- else
- value = comp_iter->val;
- /* Add the value to the constructor chain built. */
- if (ctor_tail)
- {
- ctor_tail->next = gfc_get_constructor ();
- ctor_tail = ctor_tail->next;
- }
- else
- ctor_head = ctor_tail = gfc_get_constructor ();
- gcc_assert (value);
- ctor_tail->expr = value;
+ while (gfc_match_char (',') == MATCH_YES);
- /* Remove the entry from the component list. We don't want the expression
- value to be free'd, so set it to NULL. */
- if (comp_iter)
- {
- *next_ptr = comp_iter->next;
- comp_iter->val = NULL;
- gfc_free_structure_ctor_component (comp_iter);
- }
+ if (!parent && gfc_match_char (')') != MATCH_YES)
+ goto syntax;
}
+ if (build_actual_constructor (&comp_head, &ctor_head, sym) == FAILURE)
+ goto cleanup;
+
/* No component should be left, as this should have caused an error in the
loop constructing the component-list (name that does not correspond to any
component in the structure definition). */
- gcc_assert (!comp_head);
+ if (comp_head && sym->attr.extension)
+ {
+ for (comp_iter = comp_head; comp_iter; comp_iter = comp_iter->next)
+ {
+ gfc_error ("component '%s' at %L has already been set by a "
+ "parent derived type constructor", comp_iter->name,
+ &comp_iter->where);
+ }
+ goto cleanup;
+ }
+ else
+ gcc_assert (!comp_head);
e = gfc_get_expr ();
@@ -2396,7 +2436,7 @@ gfc_match_rvalue (gfc_expr **result)
if (sym == NULL)
m = MATCH_ERROR;
else
- m = gfc_match_structure_constructor (sym, &e);
+ m = gfc_match_structure_constructor (sym, &e, false);
break;
/* If we're here, then the name is known to be the name of a
@@ -2413,8 +2453,8 @@ gfc_match_rvalue (gfc_expr **result)
goto function0;
if (sym->attr.flavor == FL_UNKNOWN) sym->attr.flavor = FL_PROCEDURE;
- if (gfc_intrinsic_name (sym->name, 0)
- || gfc_intrinsic_name (sym->name, 1))
+ if (gfc_is_intrinsic (sym, 0, gfc_current_locus)
+ || gfc_is_intrinsic (sym, 1, gfc_current_locus))
sym->attr.intrinsic = 1;
e = gfc_get_expr ();
e->expr_type = EXPR_VARIABLE;
@@ -2689,7 +2729,7 @@ gfc_match_rvalue (gfc_expr **result)
}
-/* Match a variable, ie something that can be assigned to. This
+/* Match a variable, i.e. something that can be assigned to. This
starts as a symbol, can be a structure component or an array
reference. It can be a function if the function doesn't have a
separate RESULT variable. If the symbol has not been previously
@@ -2714,7 +2754,7 @@ match_variable (gfc_expr **result, int equiv_flag, int host_flag)
we force the changed_symbols mechanism to work by setting
host_flag to 0. This prevents valid symbols that have the name
of keywords, such as 'end', being turned into variables by
- failed matching to assignments for, eg., END INTERFACE. */
+ failed matching to assignments for, e.g., END INTERFACE. */
if (gfc_current_state () == COMP_MODULE
|| gfc_current_state () == COMP_INTERFACE
|| gfc_current_state () == COMP_CONTAINS)
@@ -2739,7 +2779,7 @@ match_variable (gfc_expr **result, int equiv_flag, int host_flag)
switch (sym->attr.flavor)
{
case FL_VARIABLE:
- if (sym->attr.protected && sym->attr.use_assoc)
+ if (sym->attr.is_protected && sym->attr.use_assoc)
{
gfc_error ("Assigning to PROTECTED variable at %C");
return MATCH_ERROR;
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 273f2ae746b..994cb71151a 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -1,4 +1,4 @@
-/* Perform type resolution on the various stuctures.
+/* Perform type resolution on the various structures.
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
Free Software Foundation, Inc.
Contributed by Andy Vaught
@@ -298,7 +298,7 @@ resolve_formal_arglists (gfc_namespace *ns)
static void
resolve_contained_fntype (gfc_symbol *sym, gfc_namespace *ns)
{
- try t;
+ gfc_try t;
/* If this namespace is not a function or an entry master function,
ignore it. */
@@ -767,12 +767,12 @@ resolve_contained_functions (gfc_namespace *ns)
/* Resolve all of the elements of a structure constructor and make sure that
the types are correct. */
-static try
+static gfc_try
resolve_structure_cons (gfc_expr *expr)
{
gfc_constructor *cons;
gfc_component *comp;
- try t;
+ gfc_try t;
symbol_attribute a;
t = SUCCESS;
@@ -1017,7 +1017,7 @@ resolve_assumed_size_actual (gfc_expr *e)
that look like procedure arguments are really simple variable
references. */
-static try
+static gfc_try
resolve_actual_arglist (gfc_actual_arglist *arg, procedure_type ptype)
{
gfc_symbol *sym;
@@ -1076,7 +1076,7 @@ resolve_actual_arglist (gfc_actual_arglist *arg, procedure_type ptype)
if (!sym->attr.intrinsic
&& !(sym->attr.external || sym->attr.use_assoc
|| sym->attr.if_source == IFSRC_IFBODY)
- && gfc_intrinsic_name (sym->name, sym->attr.subroutine))
+ && gfc_is_intrinsic (sym, sym->attr.subroutine, e->where))
sym->attr.intrinsic = 1;
if (sym->attr.proc == PROC_ST_FUNCTION)
@@ -1261,7 +1261,7 @@ resolve_actual_arglist (gfc_actual_arglist *arg, procedure_type ptype)
procedures. If called with c == NULL, we have a function, otherwise if
expr == NULL, we have a subroutine. */
-static try
+static gfc_try
resolve_elemental_actual (gfc_expr *expr, gfc_code *c)
{
gfc_actual_arglist *arg0;
@@ -1506,7 +1506,7 @@ resolve_generic_f0 (gfc_expr *expr, gfc_symbol *sym)
}
-static try
+static gfc_try
resolve_generic_f (gfc_expr *expr)
{
gfc_symbol *sym;
@@ -1535,7 +1535,7 @@ generic:
/* Last ditch attempt. See if the reference is to an intrinsic
that possesses a matching interface. 14.1.2.4 */
- if (sym && !gfc_intrinsic_name (sym->name, 0))
+ if (sym && !gfc_is_intrinsic (sym, 0, expr->where))
{
gfc_error ("There is no specific function for the generic '%s' at %L",
expr->symtree->n.sym->name, &expr->where);
@@ -1568,7 +1568,7 @@ resolve_specific_f0 (gfc_symbol *sym, gfc_expr *expr)
gfc_intrinsic_sym *isym;
isym = gfc_find_function (sym->ts.interface->name);
- /* Existance of isym should be checked already. */
+ /* Existence of isym should be checked already. */
gcc_assert (isym);
sym->ts.type = isym->ts.type;
@@ -1622,7 +1622,7 @@ found:
}
-static try
+static gfc_try
resolve_specific_f (gfc_expr *expr)
{
gfc_symbol *sym;
@@ -1656,7 +1656,7 @@ resolve_specific_f (gfc_expr *expr)
/* Resolve a procedure call not known to be generic nor specific. */
-static try
+static gfc_try
resolve_unknown_f (gfc_expr *expr)
{
gfc_symbol *sym;
@@ -1673,7 +1673,7 @@ resolve_unknown_f (gfc_expr *expr)
/* See if we have an intrinsic function reference. */
- if (gfc_intrinsic_name (sym->name, 0))
+ if (gfc_is_intrinsic (sym, 0, expr->where))
{
if (gfc_intrinsic_func_interface (expr, 1) == MATCH_YES)
return SUCCESS;
@@ -1721,13 +1721,13 @@ is_external_proc (gfc_symbol *sym)
{
if (!sym->attr.dummy && !sym->attr.contained
&& !(sym->attr.intrinsic
- || gfc_intrinsic_name (sym->name, sym->attr.subroutine))
+ || gfc_is_intrinsic (sym, sym->attr.subroutine, sym->declared_at))
&& sym->attr.proc != PROC_ST_FUNCTION
&& !sym->attr.use_assoc
&& sym->name)
return true;
- else
- return false;
+
+ return false;
}
@@ -1796,10 +1796,10 @@ pure_stmt_function (gfc_expr *e, gfc_symbol *sym)
}
-static try
+static gfc_try
is_scalar_expr_ptr (gfc_expr *expr)
{
- try retval = SUCCESS;
+ gfc_try retval = SUCCESS;
gfc_ref *ref;
int start;
int end;
@@ -1897,14 +1897,14 @@ is_scalar_expr_ptr (gfc_expr *expr)
and, in the case of c_associated, set the binding label based on
the arguments. */
-static try
+static gfc_try
gfc_iso_c_func_interface (gfc_symbol *sym, gfc_actual_arglist *args,
gfc_symbol **new_sym)
{
char name[GFC_MAX_SYMBOL_LEN + 1];
char binding_label[GFC_MAX_BINDING_LABEL_LEN + 1];
int optional_arg = 0;
- try retval = SUCCESS;
+ gfc_try retval = SUCCESS;
gfc_symbol *args_sym;
gfc_typespec *arg_ts;
gfc_ref *parent_ref;
@@ -2161,13 +2161,13 @@ gfc_iso_c_func_interface (gfc_symbol *sym, gfc_actual_arglist *args,
/* TODO: Check procedure arguments so that an INTENT(IN) isn't passed
to INTENT(OUT) or INTENT(INOUT). */
-static try
+static gfc_try
resolve_function (gfc_expr *expr)
{
gfc_actual_arglist *arg;
gfc_symbol *sym;
const char *name;
- try t;
+ gfc_try t;
int temp;
procedure_type p = PROC_INTRINSIC;
@@ -2438,7 +2438,7 @@ resolve_generic_s0 (gfc_code *c, gfc_symbol *sym)
}
-static try
+static gfc_try
resolve_generic_s (gfc_code *c)
{
gfc_symbol *sym;
@@ -2469,7 +2469,7 @@ generic:
that possesses a matching interface. 14.1.2.4 */
sym = c->symtree->n.sym;
- if (!gfc_intrinsic_name (sym->name, 1))
+ if (!gfc_is_intrinsic (sym, 1, c->loc))
{
gfc_error ("There is no specific subroutine for the generic '%s' at %L",
sym->name, &c->loc);
@@ -2644,7 +2644,7 @@ resolve_specific_s0 (gfc_code *c, gfc_symbol *sym)
isym = gfc_find_function (sym->ts.interface->name);
- /* Existance of isym should be checked already. */
+ /* Existence of isym should be checked already. */
gcc_assert (isym);
sym->ts.type = isym->ts.type;
@@ -2698,7 +2698,7 @@ found:
}
-static try
+static gfc_try
resolve_specific_s (gfc_code *c)
{
gfc_symbol *sym;
@@ -2733,7 +2733,7 @@ resolve_specific_s (gfc_code *c)
/* Resolve a subroutine call not known to be generic nor specific. */
-static try
+static gfc_try
resolve_unknown_s (gfc_code *c)
{
gfc_symbol *sym;
@@ -2748,7 +2748,7 @@ resolve_unknown_s (gfc_code *c)
/* See if we have an intrinsic function reference. */
- if (gfc_intrinsic_name (sym->name, 1))
+ if (gfc_is_intrinsic (sym, 1, c->loc))
{
if (gfc_intrinsic_sub_interface (c, 1) == MATCH_YES)
return SUCCESS;
@@ -2772,10 +2772,10 @@ found:
for functions, subroutines and functions are stored differently and this
makes things awkward. */
-static try
+static gfc_try
resolve_call (gfc_code *c)
{
- try t;
+ gfc_try t;
procedure_type ptype = PROC_INTRINSIC;
if (c->symtree && c->symtree->n.sym
@@ -2864,10 +2864,10 @@ resolve_call (gfc_code *c)
if their shapes do not match. If either op1->shape or op2->shape is
NULL, return SUCCESS. */
-static try
+static gfc_try
compare_shapes (gfc_expr *op1, gfc_expr *op2)
{
- try t;
+ gfc_try t;
int i;
t = SUCCESS;
@@ -2893,17 +2893,17 @@ compare_shapes (gfc_expr *op1, gfc_expr *op2)
/* Resolve an operator expression node. This can involve replacing the
operation with a user defined function call. */
-static try
+static gfc_try
resolve_operator (gfc_expr *e)
{
gfc_expr *op1, *op2;
char msg[200];
bool dual_locus_error;
- try t;
+ gfc_try t;
/* Resolve all subnodes-- give them types. */
- switch (e->value.op.operator)
+ switch (e->value.op.op)
{
default:
if (gfc_resolve_expr (e->value.op.op2) == FAILURE)
@@ -2933,7 +2933,7 @@ resolve_operator (gfc_expr *e)
goto bad_op;
}
- switch (e->value.op.operator)
+ switch (e->value.op.op)
{
case INTRINSIC_UPLUS:
case INTRINSIC_UMINUS:
@@ -2946,7 +2946,7 @@ resolve_operator (gfc_expr *e)
}
sprintf (msg, _("Operand of unary numeric operator '%s' at %%L is %s"),
- gfc_op2string (e->value.op.operator), gfc_typename (&e->ts));
+ gfc_op2string (e->value.op.op), gfc_typename (&e->ts));
goto bad_op;
case INTRINSIC_PLUS:
@@ -2962,7 +2962,7 @@ resolve_operator (gfc_expr *e)
sprintf (msg,
_("Operands of binary numeric operator '%s' at %%L are %s/%s"),
- gfc_op2string (e->value.op.operator), gfc_typename (&op1->ts),
+ gfc_op2string (e->value.op.op), gfc_typename (&op1->ts),
gfc_typename (&op2->ts));
goto bad_op;
@@ -2996,7 +2996,7 @@ resolve_operator (gfc_expr *e)
}
sprintf (msg, _("Operands of logical operator '%s' at %%L are %s/%s"),
- gfc_op2string (e->value.op.operator), gfc_typename (&op1->ts),
+ gfc_op2string (e->value.op.op), gfc_typename (&op1->ts),
gfc_typename (&op2->ts));
goto bad_op;
@@ -3053,19 +3053,19 @@ resolve_operator (gfc_expr *e)
if (op1->ts.type == BT_LOGICAL && op2->ts.type == BT_LOGICAL)
sprintf (msg,
_("Logicals at %%L must be compared with %s instead of %s"),
- (e->value.op.operator == INTRINSIC_EQ
- || e->value.op.operator == INTRINSIC_EQ_OS)
- ? ".eqv." : ".neqv.", gfc_op2string (e->value.op.operator));
+ (e->value.op.op == INTRINSIC_EQ
+ || e->value.op.op == INTRINSIC_EQ_OS)
+ ? ".eqv." : ".neqv.", gfc_op2string (e->value.op.op));
else
sprintf (msg,
_("Operands of comparison operator '%s' at %%L are %s/%s"),
- gfc_op2string (e->value.op.operator), gfc_typename (&op1->ts),
+ gfc_op2string (e->value.op.op), gfc_typename (&op1->ts),
gfc_typename (&op2->ts));
goto bad_op;
case INTRINSIC_USER:
- if (e->value.op.uop->operator == NULL)
+ if (e->value.op.uop->op == NULL)
sprintf (msg, _("Unknown operator '%s' at %%L"), e->value.op.uop->name);
else if (op2 == NULL)
sprintf (msg, _("Operand of user operator '%s' at %%L is %s"),
@@ -3091,7 +3091,7 @@ resolve_operator (gfc_expr *e)
t = SUCCESS;
- switch (e->value.op.operator)
+ switch (e->value.op.op)
{
case INTRINSIC_PLUS:
case INTRINSIC_MINUS:
@@ -3185,7 +3185,7 @@ resolve_operator (gfc_expr *e)
{
t = gfc_simplify_expr (e, 0);
/* Some calls do not succeed in simplification and return FAILURE
- even though there is no error; eg. variable references to
+ even though there is no error; e.g. variable references to
PARAMETER arrays. */
if (!gfc_is_constant_expr (e))
t = SUCCESS;
@@ -3338,7 +3338,7 @@ compute_last_value_for_triplet (gfc_expr *start, gfc_expr *end,
/* Compare a single dimension of an array reference to the array
specification. */
-static try
+static gfc_try
check_dimension (int i, gfc_array_ref *ar, gfc_array_spec *as)
{
mpz_t last_value;
@@ -3456,7 +3456,7 @@ check_dimension (int i, gfc_array_ref *ar, gfc_array_spec *as)
/* Compare an array reference with an array specification. */
-static try
+static gfc_try
compare_spec_to_ref (gfc_array_ref *ar)
{
gfc_array_spec *as;
@@ -3495,7 +3495,7 @@ compare_spec_to_ref (gfc_array_ref *ar)
/* Resolve one part of an array index. */
-try
+gfc_try
gfc_resolve_index (gfc_expr *index, int check_scalar)
{
gfc_typespec ts;
@@ -3539,7 +3539,7 @@ gfc_resolve_index (gfc_expr *index, int check_scalar)
/* Resolve a dim argument to an intrinsic function. */
-try
+gfc_try
gfc_resolve_dim_arg (gfc_expr *dim)
{
if (dim == NULL)
@@ -3644,7 +3644,7 @@ find_array_spec (gfc_expr *e)
/* Resolve an array reference. */
-static try
+static gfc_try
resolve_array_ref (gfc_array_ref *ar)
{
int i, check_scalar;
@@ -3705,7 +3705,7 @@ resolve_array_ref (gfc_array_ref *ar)
}
-static try
+static gfc_try
resolve_substring (gfc_ref *ref)
{
if (ref->u.ss.start != NULL)
@@ -3837,7 +3837,7 @@ gfc_resolve_substring_charlen (gfc_expr *e)
/* Resolve subtype references. */
-static try
+static gfc_try
resolve_ref (gfc_expr *expr)
{
int current_part_dimension, n_components, seen_part_dimension;
@@ -4035,11 +4035,11 @@ done:
/* Resolve a variable expression. */
-static try
+static gfc_try
resolve_variable (gfc_expr *e)
{
gfc_symbol *sym;
- try t;
+ gfc_try t;
t = SUCCESS;
@@ -4217,7 +4217,7 @@ gfc_resolve_character_operator (gfc_expr *e)
gfc_expr *e1 = NULL;
gfc_expr *e2 = NULL;
- gcc_assert (e->value.op.operator == INTRINSIC_CONCAT);
+ gcc_assert (e->value.op.op == INTRINSIC_CONCAT);
if (op1->ts.cl && op1->ts.cl->length)
e1 = gfc_copy_expr (op1->ts.cl->length);
@@ -4285,10 +4285,10 @@ fixup_charlen (gfc_expr *e)
with their operators, intrinsic operators are converted to function calls
for overloaded types and unresolved function references are resolved. */
-try
+gfc_try
gfc_resolve_expr (gfc_expr *e)
{
- try t;
+ gfc_try t;
if (e == NULL)
return SUCCESS;
@@ -4373,7 +4373,7 @@ gfc_resolve_expr (gfc_expr *e)
/* Resolve an expression from an iterator. They must be scalar and have
INTEGER or (optionally) REAL type. */
-static try
+static gfc_try
gfc_resolve_iterator_expr (gfc_expr *expr, bool real_ok,
const char *name_msgid)
{
@@ -4414,7 +4414,7 @@ gfc_resolve_iterator_expr (gfc_expr *expr, bool real_ok,
/* Resolve the expressions in an iterator structure. If REAL_OK is
false allow only INTEGER type iterators, otherwise allow REAL types. */
-try
+gfc_try
gfc_resolve_iterator (gfc_iterator *iter, bool real_ok)
{
if (gfc_resolve_iterator_expr (iter->var, real_ok, "Loop variable")
@@ -4497,7 +4497,7 @@ forall_index (gfc_expr *expr, gfc_symbol *sym, int *f)
/* Check whether the FORALL index appears in the expression or not.
Returns SUCCESS if SYM is found in EXPR. */
-try
+gfc_try
find_forall_index (gfc_expr *expr, gfc_symbol *sym, int f)
{
if (gfc_traverse_expr (expr, sym, forall_index, f))
@@ -4597,7 +4597,7 @@ derived_inaccessible (gfc_symbol *sym)
/* Resolve the argument of a deallocate expression. The expression must be
a pointer or a full array. */
-static try
+static gfc_try
resolve_deallocate_expr (gfc_expr *e)
{
symbol_attribute attr;
@@ -4712,7 +4712,7 @@ expr_to_initialize (gfc_expr *e)
checks to see whether the expression is OK or not. The expression must
have a trailing array reference that gives the size of the array. */
-static try
+static gfc_try
resolve_allocate_expr (gfc_expr *e, gfc_code *code)
{
int i, pointer, allocatable, dimension, check_intent_in;
@@ -4873,7 +4873,7 @@ check_symbols:
|| (ar->end[i] != NULL
&& gfc_find_sym_in_expr (sym, ar->end[i])))
{
- gfc_error ("'%s' must not appear an the array specification at "
+ gfc_error ("'%s' must not appear in the array specification at "
"%L in the same ALLOCATE statement where it is "
"itself allocated", sym->name, &ar->where);
return FAILURE;
@@ -5112,7 +5112,7 @@ check_case_overlap (gfc_case *list)
Makes sure that all case expressions are scalar constants of the same
type. Return FAILURE if anything is wrong. */
-static try
+static gfc_try
validate_case_label_expr (gfc_expr *e, gfc_expr *case_expr)
{
if (e == NULL) return SUCCESS;
@@ -5181,7 +5181,7 @@ resolve_select (gfc_code *code)
int seen_logical;
int ncases;
bt type;
- try t;
+ gfc_try t;
if (code->expr == NULL)
{
@@ -5622,12 +5622,12 @@ resolve_branch (gfc_st_label *label, gfc_code *code)
/* Check whether EXPR1 has the same shape as EXPR2. */
-static try
+static gfc_try
resolve_where_shape (gfc_expr *expr1, gfc_expr *expr2)
{
mpz_t shape[GFC_MAX_DIMENSIONS];
mpz_t shape2[GFC_MAX_DIMENSIONS];
- try result = FAILURE;
+ gfc_try result = FAILURE;
int i;
/* Compare the rank. */
@@ -5934,7 +5934,7 @@ static void resolve_code (gfc_code *, gfc_namespace *);
void
gfc_resolve_blocks (gfc_code *b, gfc_namespace *ns)
{
- try t;
+ gfc_try t;
for (; b; b = b->block)
{
@@ -5999,7 +5999,7 @@ gfc_resolve_blocks (gfc_code *b, gfc_namespace *ns)
/* Does everything to resolve an ordinary assignment. Returns true
- if this is an interface asignment. */
+ if this is an interface assignment. */
static bool
resolve_ordinary_assign (gfc_code *code, gfc_namespace *ns)
{
@@ -6148,7 +6148,7 @@ resolve_code (gfc_code *code, gfc_namespace *ns)
int omp_workshare_save;
int forall_save;
code_stack frame;
- try t;
+ gfc_try t;
frame.prev = cs_base;
frame.head = code;
@@ -6666,7 +6666,7 @@ gfc_verify_binding_labels (gfc_symbol *sym)
/* Resolve an index expression. */
-static try
+static gfc_try
resolve_index_expr (gfc_expr *e)
{
if (gfc_resolve_expr (e) == FAILURE)
@@ -6683,7 +6683,7 @@ resolve_index_expr (gfc_expr *e)
/* Resolve a charlen structure. */
-static try
+static gfc_try
resolve_charlen (gfc_charlen *cl)
{
int i;
@@ -6983,7 +6983,7 @@ apply_default_init_local (gfc_symbol *sym)
/* Resolution of common features of flavors variable and procedure. */
-static try
+static gfc_try
resolve_fl_var_and_proc (gfc_symbol *sym, int mp_flag)
{
/* Constraints on deferred shape variable. */
@@ -7025,7 +7025,7 @@ resolve_fl_var_and_proc (gfc_symbol *sym, int mp_flag)
/* Additional checks for symbols with flavor variable and derived
type. To be called from resolve_fl_variable. */
-static try
+static gfc_try
resolve_fl_variable_derived (gfc_symbol *sym, int no_init_flag)
{
gcc_assert (sym->ts.type == BT_DERIVED);
@@ -7084,7 +7084,7 @@ resolve_fl_variable_derived (gfc_symbol *sym, int no_init_flag)
/* Resolve symbols with flavor variable. */
-static try
+static gfc_try
resolve_fl_variable (gfc_symbol *sym, int mp_flag)
{
int no_init_flag, automatic_flag;
@@ -7209,7 +7209,7 @@ no_init_error:
/* Resolve a procedure. */
-static try
+static gfc_try
resolve_fl_procedure (gfc_symbol *sym, int mp_flag)
{
gfc_formal_arglist *arg;
@@ -7251,7 +7251,7 @@ resolve_fl_procedure (gfc_symbol *sym, int mp_flag)
}
/* Ensure that derived type for are not of a private type. Internal
- module procedures are excluded by 2.2.3.3 - ie. they are not
+ module procedures are excluded by 2.2.3.3 - i.e., they are not
externally accessible and can access all the objects accessible in
the host. */
if (!(sym->ns->parent
@@ -7443,6 +7443,20 @@ resolve_fl_procedure (gfc_symbol *sym, int mp_flag)
}
}
+ if (sym->attr.save == SAVE_EXPLICIT && !sym->attr.proc_pointer)
+ {
+ gfc_error ("PROCEDURE attribute conflicts with SAVE attribute "
+ "in '%s' at %L", sym->name, &sym->declared_at);
+ return FAILURE;
+ }
+
+ if (sym->attr.intent && !sym->attr.proc_pointer)
+ {
+ gfc_error ("PROCEDURE attribute conflicts with INTENT attribute "
+ "in '%s' at %L", sym->name, &sym->declared_at);
+ return FAILURE;
+ }
+
return SUCCESS;
}
@@ -7451,12 +7465,12 @@ resolve_fl_procedure (gfc_symbol *sym, int mp_flag)
been defined and we now know their defined arguments, check that they fulfill
the requirements of the standard for procedures used as finalizers. */
-static try
+static gfc_try
gfc_resolve_finalizers (gfc_symbol* derived)
{
gfc_finalizer* list;
gfc_finalizer** prev_link; /* For removing wrong entries from the list. */
- try result = SUCCESS;
+ gfc_try result = SUCCESS;
bool seen_scalar = false;
if (!derived->f2k_derived || !derived->f2k_derived->finalizers)
@@ -7472,22 +7486,29 @@ gfc_resolve_finalizers (gfc_symbol* derived)
gfc_finalizer* i;
int my_rank;
+ /* Skip this finalizer if we already resolved it. */
+ if (list->proc_tree)
+ {
+ prev_link = &(list->next);
+ continue;
+ }
+
/* Check this exists and is a SUBROUTINE. */
- if (!list->procedure->attr.subroutine)
+ if (!list->proc_sym->attr.subroutine)
{
gfc_error ("FINAL procedure '%s' at %L is not a SUBROUTINE",
- list->procedure->name, &list->where);
+ list->proc_sym->name, &list->where);
goto error;
}
/* We should have exactly one argument. */
- if (!list->procedure->formal || list->procedure->formal->next)
+ if (!list->proc_sym->formal || list->proc_sym->formal->next)
{
gfc_error ("FINAL procedure at %L must have exactly one argument",
&list->where);
goto error;
}
- arg = list->procedure->formal->sym;
+ arg = list->proc_sym->formal->sym;
/* This argument must be of our type. */
if (arg->ts.type != BT_DERIVED || arg->ts.derived != derived)
@@ -7541,16 +7562,16 @@ gfc_resolve_finalizers (gfc_symbol* derived)
{
/* Argument list might be empty; that is an error signalled earlier,
but we nevertheless continued resolving. */
- if (i->procedure->formal)
+ if (i->proc_sym->formal)
{
- gfc_symbol* i_arg = i->procedure->formal->sym;
+ gfc_symbol* i_arg = i->proc_sym->formal->sym;
const int i_rank = (i_arg->as ? i_arg->as->rank : 0);
if (i_rank == my_rank)
{
gfc_error ("FINAL procedure '%s' declared at %L has the same"
" rank (%d) as '%s'",
- list->procedure->name, &list->where, my_rank,
- i->procedure->name);
+ list->proc_sym->name, &list->where, my_rank,
+ i->proc_sym->name);
goto error;
}
}
@@ -7560,10 +7581,14 @@ gfc_resolve_finalizers (gfc_symbol* derived)
if (!arg->as || arg->as->rank == 0)
seen_scalar = true;
+ /* Find the symtree for this procedure. */
+ gcc_assert (!list->proc_tree);
+ list->proc_tree = gfc_find_sym_in_symtree (list->proc_sym);
+
prev_link = &list->next;
continue;
- /* Remove wrong nodes immediatelly from the list so we don't risk any
+ /* Remove wrong nodes immediately from the list so we don't risk any
troubles in the future when they might fail later expectations. */
error:
result = FAILURE;
@@ -7581,7 +7606,8 @@ error:
derived->name, &derived->declared_at);
/* TODO: Remove this error when finalization is finished. */
- gfc_error ("Finalization at %L is not yet implemented", &derived->declared_at);
+ gfc_error ("Finalization at %L is not yet implemented",
+ &derived->declared_at);
return result;
}
@@ -7610,7 +7636,7 @@ add_dt_to_dt_list (gfc_symbol *derived)
/* Resolve the components of a derived type. */
-static try
+static gfc_try
resolve_fl_derived (gfc_symbol *sym)
{
gfc_component *c;
@@ -7682,8 +7708,8 @@ resolve_fl_derived (gfc_symbol *sym)
for (i = 0; i < c->as->rank; i++)
{
if (c->as->lower[i] == NULL
- || !gfc_is_constant_expr (c->as->lower[i])
|| (resolve_index_expr (c->as->lower[i]) == FAILURE)
+ || !gfc_is_constant_expr (c->as->lower[i])
|| c->as->upper[i] == NULL
|| (resolve_index_expr (c->as->upper[i]) == FAILURE)
|| !gfc_is_constant_expr (c->as->upper[i]))
@@ -7707,7 +7733,7 @@ resolve_fl_derived (gfc_symbol *sym)
}
-static try
+static gfc_try
resolve_fl_namelist (gfc_symbol *sym)
{
gfc_namelist *nl;
@@ -7826,7 +7852,7 @@ resolve_fl_namelist (gfc_symbol *sym)
}
-static try
+static gfc_try
resolve_fl_parameter (gfc_symbol *sym)
{
/* A parameter array's shape needs to be constant. */
@@ -7961,24 +7987,45 @@ resolve_symbol (gfc_symbol *sym)
type to avoid spurious warnings. */
if (sym->attr.flavor != FL_MODULE && sym->attr.intrinsic)
{
- if (gfc_intrinsic_name (sym->name, 0))
+ gfc_intrinsic_sym* isym;
+ const char* symstd;
+
+ /* We already know this one is an intrinsic, so we don't call
+ gfc_is_intrinsic for full checking but rather use gfc_find_function and
+ gfc_find_subroutine directly to check whether it is a function or
+ subroutine. */
+
+ if ((isym = gfc_find_function (sym->name)))
{
if (sym->ts.type != BT_UNKNOWN && gfc_option.warn_surprising)
- gfc_warning ("Type specified for intrinsic function '%s' at %L is ignored",
- sym->name, &sym->declared_at);
+ gfc_warning ("Type specified for intrinsic function '%s' at %L is"
+ " ignored", sym->name, &sym->declared_at);
}
- else if (gfc_intrinsic_name (sym->name, 1))
+ else if ((isym = gfc_find_subroutine (sym->name)))
{
if (sym->ts.type != BT_UNKNOWN)
{
- gfc_error ("Intrinsic subroutine '%s' at %L shall not have a type specifier",
- sym->name, &sym->declared_at);
+ gfc_error ("Intrinsic subroutine '%s' at %L shall not have a type"
+ " specifier", sym->name, &sym->declared_at);
return;
}
}
else
{
- gfc_error ("Intrinsic '%s' at %L does not exist", sym->name, &sym->declared_at);
+ gfc_error ("'%s' declared INTRINSIC at %L does not exist",
+ sym->name, &sym->declared_at);
+ return;
+ }
+
+ /* Check it is actually available in the standard settings. */
+ if (gfc_check_intrinsic_standard (isym, &symstd, false, sym->declared_at)
+ == FAILURE)
+ {
+ gfc_error ("The intrinsic '%s' declared INTRINSIC at %L is not"
+ " available in the current standard settings but %s. Use"
+ " an appropriate -std=* option or enable -fall-intrinsics"
+ " in order to use it.",
+ sym->name, &sym->declared_at, symstd);
return;
}
}
@@ -8077,7 +8124,7 @@ resolve_symbol (gfc_symbol *sym)
sym->attr.use_assoc == 0 && sym->attr.dummy == 0 &&
sym->attr.flavor != FL_PROCEDURE && sym->attr.flavor != FL_DERIVED)
{
- try t = SUCCESS;
+ gfc_try t = SUCCESS;
/* First, make sure the variable is declared at the
module-level scope (J3/04-007, Section 15.3). */
@@ -8290,7 +8337,7 @@ values;
/* Advance the values structure to point to the next value in the data list. */
-static try
+static gfc_try
next_data_value (void)
{
@@ -8307,13 +8354,13 @@ next_data_value (void)
}
-static try
+static gfc_try
check_data_variable (gfc_data_variable *var, locus *where)
{
gfc_expr *e;
mpz_t size;
mpz_t offset;
- try t;
+ gfc_try t;
ar_type mark = AR_UNKNOWN;
int i;
mpz_t section_index[GFC_MAX_DIMENSIONS];
@@ -8470,17 +8517,17 @@ check_data_variable (gfc_data_variable *var, locus *where)
}
-static try traverse_data_var (gfc_data_variable *, locus *);
+static gfc_try traverse_data_var (gfc_data_variable *, locus *);
/* Iterate over a list of elements in a DATA statement. */
-static try
+static gfc_try
traverse_data_list (gfc_data_variable *var, locus *where)
{
mpz_t trip;
iterator_stack frame;
gfc_expr *e, *start, *end, *step;
- try retval = SUCCESS;
+ gfc_try retval = SUCCESS;
mpz_init (frame.value);
@@ -8560,10 +8607,10 @@ cleanup:
/* Type resolve variables in the variable list of a DATA statement. */
-static try
+static gfc_try
traverse_data_var (gfc_data_variable *var, locus *where)
{
- try t;
+ gfc_try t;
for (; var; var = var->next)
{
@@ -8584,7 +8631,7 @@ traverse_data_var (gfc_data_variable *var, locus *where)
This is separate from the assignment checking because data lists should
only be resolved once. */
-static try
+static gfc_try
resolve_data_variables (gfc_data_variable *d)
{
for (; d; d = d->next)
@@ -8642,7 +8689,7 @@ resolve_data (gfc_data *d)
is storage associated with any such variable, shall not be used in the
following contexts: (clients of this function). */
-/* Determines if a variable is not 'pure', ie not assignable within a pure
+/* Determines if a variable is not 'pure', i.e., not assignable within a pure
procedure. Returns zero if assignment is OK, nonzero if there is a
problem. */
int
@@ -8800,7 +8847,7 @@ sequence_type (gfc_typespec ts)
/* Resolve derived type EQUIVALENCE object. */
-static try
+static gfc_try
resolve_equivalence_derived (gfc_symbol *derived, gfc_symbol *sym, gfc_expr *e)
{
gfc_symbol *d;
@@ -8962,7 +9009,7 @@ resolve_equivalence (gfc_equiv *eq)
sym = e->symtree->n.sym;
- if (sym->attr.protected)
+ if (sym->attr.is_protected)
cnt_protected++;
if (cnt_protected > 0 && cnt_protected != object)
{
@@ -9165,7 +9212,7 @@ gfc_resolve_uops (gfc_symtree *symtree)
gfc_resolve_uops (symtree->left);
gfc_resolve_uops (symtree->right);
- for (itr = symtree->n.uop->operator; itr; itr = itr->next)
+ for (itr = symtree->n.uop->op; itr; itr = itr->next)
{
sym = itr->sym;
if (!sym->attr.function)
diff --git a/gcc/fortran/scanner.c b/gcc/fortran/scanner.c
index 48f148d300a..8c702ca3f33 100644
--- a/gcc/fortran/scanner.c
+++ b/gcc/fortran/scanner.c
@@ -1672,7 +1672,7 @@ preprocessor_line (gfc_char_t *c)
}
-static try load_file (const char *, bool);
+static gfc_try load_file (const char *, const char *, bool);
/* include_line()-- Checks a line buffer to see if it is an include
line. If so, we call load_file() recursively to load the included
@@ -1743,7 +1743,7 @@ include_line (gfc_char_t *line)
read by anything else. */
filename = gfc_widechar_to_char (begin, -1);
- load_file (filename, false);
+ load_file (filename, NULL, false);
gfc_free (filename);
return true;
}
@@ -1751,8 +1751,8 @@ include_line (gfc_char_t *line)
/* Load a file into memory by calling load_line until the file ends. */
-static try
-load_file (const char *filename, bool initial)
+static gfc_try
+load_file (const char *realfilename, const char *displayedname, bool initial)
{
gfc_char_t *line;
gfc_linebuf *b;
@@ -1760,6 +1760,9 @@ load_file (const char *filename, bool initial)
FILE *input;
int len, line_len;
bool first_line;
+ const char *filename;
+
+ filename = displayedname ? displayedname : realfilename;
for (f = current_file; f; f = f->up)
if (strcmp (filename, f->filename) == 0)
@@ -1776,7 +1779,7 @@ load_file (const char *filename, bool initial)
gfc_src_file = NULL;
}
else
- input = gfc_open_file (filename);
+ input = gfc_open_file (realfilename);
if (input == NULL)
{
gfc_error_now ("Can't open file '%s'", filename);
@@ -1785,7 +1788,7 @@ load_file (const char *filename, bool initial)
}
else
{
- input = gfc_open_included_file (filename, false, false);
+ input = gfc_open_included_file (realfilename, false, false);
if (input == NULL)
{
gfc_error_now ("Can't open included file '%s'", filename);
@@ -1840,11 +1843,11 @@ load_file (const char *filename, bool initial)
&& line[2] == (unsigned char) '\xBF')))
{
int n = line[1] == (unsigned char) '\xBB' ? 3 : 2;
- gfc_char_t *new = gfc_get_wide_string (line_len);
+ gfc_char_t *new_char = gfc_get_wide_string (line_len);
- wide_strcpy (new, &line[n]);
+ wide_strcpy (new_char, &line[n]);
gfc_free (line);
- line = new;
+ line = new_char;
len -= n;
}
@@ -1914,23 +1917,23 @@ load_file (const char *filename, bool initial)
/* Open a new file and start scanning from that file. Returns SUCCESS
- if everything went OK, FAILURE otherwise. If form == FORM_UKNOWN
+ if everything went OK, FAILURE otherwise. If form == FORM_UNKNOWN
it tries to determine the source form from the filename, defaulting
to free form. */
-try
+gfc_try
gfc_new_file (void)
{
- try result;
+ gfc_try result;
if (gfc_cpp_enabled ())
{
result = gfc_cpp_preprocess (gfc_source_file);
if (!gfc_cpp_preprocess_only ())
- result = load_file (gfc_cpp_temporary_file (), true);
+ result = load_file (gfc_cpp_temporary_file (), gfc_source_file, true);
}
else
- result = load_file (gfc_source_file, true);
+ result = load_file (gfc_source_file, NULL, true);
gfc_current_locus.lb = line_head;
gfc_current_locus.nextc = (line_head == NULL) ? NULL : line_head->line;
diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c
index c889dae14fa..1690003dbac 100644
--- a/gcc/fortran/simplify.c
+++ b/gcc/fortran/simplify.c
@@ -3942,7 +3942,7 @@ gfc_simplify_shape (gfc_expr *source)
gfc_expr *result, *e, *f;
gfc_array_ref *ar;
int n;
- try t;
+ gfc_try t;
if (source->rank == 0)
return gfc_start_constructor (BT_INTEGER, gfc_default_integer_kind,
diff --git a/gcc/fortran/st.c b/gcc/fortran/st.c
index ba5656b24d5..790dec6cf58 100644
--- a/gcc/fortran/st.c
+++ b/gcc/fortran/st.c
@@ -58,20 +58,20 @@ gfc_get_code (void)
its tail, returning a pointer to the new tail. */
gfc_code *
-gfc_append_code (gfc_code *tail, gfc_code *new)
+gfc_append_code (gfc_code *tail, gfc_code *new_code)
{
if (tail != NULL)
{
while (tail->next != NULL)
tail = tail->next;
- tail->next = new;
+ tail->next = new_code;
}
- while (new->next != NULL)
- new = new->next;
+ while (new_code->next != NULL)
+ new_code = new_code->next;
- return new;
+ return new_code;
}
diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c
index f91ef9157c0..d564dd7782f 100644
--- a/gcc/fortran/symbol.c
+++ b/gcc/fortran/symbol.c
@@ -145,7 +145,7 @@ gfc_clear_new_implicit (void)
/* Prepare for a new implicit range. Sets flags in new_flag[]. */
-try
+gfc_try
gfc_add_new_implicit_range (int c1, int c2)
{
int i;
@@ -172,7 +172,7 @@ gfc_add_new_implicit_range (int c1, int c2)
/* Add a matched implicit range for gfc_set_implicit(). Check if merging
the new implicit types back into the existing types will work. */
-try
+gfc_try
gfc_merge_new_implicit (gfc_typespec *ts)
{
int i;
@@ -230,7 +230,7 @@ gfc_get_default_type (gfc_symbol *sym, gfc_namespace *ns)
letter of its name. Fails if the letter in question has no default
type. */
-try
+gfc_try
gfc_set_default_type (gfc_symbol *sym, int error_flag, gfc_namespace *ns)
{
gfc_typespec *ts;
@@ -272,7 +272,7 @@ gfc_set_default_type (gfc_symbol *sym, int error_flag, gfc_namespace *ns)
{
/* Dummy args to a BIND(C) routine may not be interoperable if
they are implicitly typed. */
- gfc_warning_now ("Implicity declared variable '%s' at %L may not "
+ gfc_warning_now ("Implicitly declared variable '%s' at %L may not "
"be C interoperable but it is a dummy argument to "
"the BIND(C) procedure '%s' at %L", sym->name,
&(sym->declared_at), sym->ns->proc_name->name,
@@ -336,7 +336,7 @@ gfc_check_function_type (gfc_namespace *ns)
goto conflict_std;\
}
-static try
+static gfc_try
check_conflict (symbol_attribute *attr, const char *name, locus *where)
{
static const char *dummy = "DUMMY", *save = "SAVE", *pointer = "POINTER",
@@ -344,14 +344,14 @@ check_conflict (symbol_attribute *attr, const char *name, locus *where)
*intent_in = "INTENT(IN)", *intrinsic = "INTRINSIC",
*intent_out = "INTENT(OUT)", *intent_inout = "INTENT(INOUT)",
*allocatable = "ALLOCATABLE", *elemental = "ELEMENTAL",
- *private = "PRIVATE", *recursive = "RECURSIVE",
+ *privat = "PRIVATE", *recursive = "RECURSIVE",
*in_common = "COMMON", *result = "RESULT", *in_namelist = "NAMELIST",
- *public = "PUBLIC", *optional = "OPTIONAL", *entry = "ENTRY",
+ *publik = "PUBLIC", *optional = "OPTIONAL", *entry = "ENTRY",
*function = "FUNCTION", *subroutine = "SUBROUTINE",
*dimension = "DIMENSION", *in_equivalence = "EQUIVALENCE",
*use_assoc = "USE ASSOCIATED", *cray_pointer = "CRAY POINTER",
*cray_pointee = "CRAY POINTEE", *data = "DATA", *value = "VALUE",
- *volatile_ = "VOLATILE", *protected = "PROTECTED",
+ *volatile_ = "VOLATILE", *is_protected = "PROTECTED",
*is_bind_c = "BIND(C)", *procedure = "PROCEDURE";
static const char *threadprivate = "THREADPRIVATE";
@@ -383,9 +383,9 @@ check_conflict (symbol_attribute *attr, const char *name, locus *where)
if (attr->optional)
a1 = optional;
if (attr->access == ACCESS_PRIVATE)
- a1 = private;
+ a1 = privat;
if (attr->access == ACCESS_PUBLIC)
- a1 = public;
+ a1 = publik;
if (attr->intent != INTENT_UNKNOWN)
a1 = intent;
@@ -417,12 +417,8 @@ check_conflict (symbol_attribute *attr, const char *name, locus *where)
goto conflict;
case FL_PROCEDURE:
- if (attr->proc_pointer)
- break;
- a1 = gfc_code2string (flavors, attr->flavor);
- a2 = save;
- goto conflict;
-
+ /* Conflicts between SAVE and PROCEDURE will be checked at
+ resolution stage, see "resolve_fl_procedure". */
case FL_VARIABLE:
case FL_NAMELIST:
default:
@@ -541,9 +537,9 @@ check_conflict (symbol_attribute *attr, const char *name, locus *where)
goto conflict;
}
- conf (protected, intrinsic)
- conf (protected, external)
- conf (protected, in_common)
+ conf (is_protected, intrinsic)
+ conf (is_protected, external)
+ conf (is_protected, in_common)
conf (volatile_, intrinsic)
conf (volatile_, external)
@@ -558,7 +554,7 @@ check_conflict (symbol_attribute *attr, const char *name, locus *where)
conf (procedure, allocatable)
conf (procedure, dimension)
conf (procedure, intrinsic)
- conf (procedure, protected)
+ conf (procedure, is_protected)
conf (procedure, target)
conf (procedure, value)
conf (procedure, volatile_)
@@ -585,7 +581,7 @@ check_conflict (symbol_attribute *attr, const char *name, locus *where)
conf2 (dummy);
conf2 (volatile_);
conf2 (pointer);
- conf2 (protected);
+ conf2 (is_protected);
conf2 (target);
conf2 (external);
conf2 (intrinsic);
@@ -599,7 +595,7 @@ check_conflict (symbol_attribute *attr, const char *name, locus *where)
if (attr->access == ACCESS_PUBLIC || attr->access == ACCESS_PRIVATE)
{
- a2 = attr->access == ACCESS_PUBLIC ? public : private;
+ a2 = attr->access == ACCESS_PUBLIC ? publik : privat;
gfc_error ("%s attribute applied to %s %s at %L", a2, a1,
name, where);
return FAILURE;
@@ -618,8 +614,8 @@ check_conflict (symbol_attribute *attr, const char *name, locus *where)
break;
case FL_PROCEDURE:
- if (!attr->proc_pointer)
- conf2 (intent);
+ /* Conflicts with INTENT will be checked at resolution stage,
+ see "resolve_fl_procedure". */
if (attr->subroutine)
{
@@ -684,7 +680,7 @@ check_conflict (symbol_attribute *attr, const char *name, locus *where)
conf2 (subroutine);
conf2 (entry);
conf2 (pointer);
- conf2 (protected);
+ conf2 (is_protected);
conf2 (target);
conf2 (dummy);
conf2 (in_common);
@@ -790,7 +786,7 @@ duplicate_attr (const char *attr, locus *where)
/* Called from decl.c (attr_decl1) to check attributes, when declared
separately. */
-try
+gfc_try
gfc_add_attribute (symbol_attribute *attr, locus *where)
{
@@ -800,7 +796,7 @@ gfc_add_attribute (symbol_attribute *attr, locus *where)
return check_conflict (attr, NULL, where);
}
-try
+gfc_try
gfc_add_allocatable (symbol_attribute *attr, locus *where)
{
@@ -826,7 +822,7 @@ gfc_add_allocatable (symbol_attribute *attr, locus *where)
}
-try
+gfc_try
gfc_add_dimension (symbol_attribute *attr, const char *name, locus *where)
{
@@ -852,7 +848,7 @@ gfc_add_dimension (symbol_attribute *attr, const char *name, locus *where)
}
-try
+gfc_try
gfc_add_external (symbol_attribute *attr, locus *where)
{
@@ -877,7 +873,7 @@ gfc_add_external (symbol_attribute *attr, locus *where)
}
-try
+gfc_try
gfc_add_intrinsic (symbol_attribute *attr, locus *where)
{
@@ -896,7 +892,7 @@ gfc_add_intrinsic (symbol_attribute *attr, locus *where)
}
-try
+gfc_try
gfc_add_optional (symbol_attribute *attr, locus *where)
{
@@ -914,7 +910,7 @@ gfc_add_optional (symbol_attribute *attr, locus *where)
}
-try
+gfc_try
gfc_add_pointer (symbol_attribute *attr, locus *where)
{
@@ -939,7 +935,7 @@ gfc_add_pointer (symbol_attribute *attr, locus *where)
}
-try
+gfc_try
gfc_add_cray_pointer (symbol_attribute *attr, locus *where)
{
@@ -951,7 +947,7 @@ gfc_add_cray_pointer (symbol_attribute *attr, locus *where)
}
-try
+gfc_try
gfc_add_cray_pointee (symbol_attribute *attr, locus *where)
{
@@ -970,13 +966,13 @@ gfc_add_cray_pointee (symbol_attribute *attr, locus *where)
}
-try
+gfc_try
gfc_add_protected (symbol_attribute *attr, const char *name, locus *where)
{
if (check_used (attr, name, where))
return FAILURE;
- if (attr->protected)
+ if (attr->is_protected)
{
if (gfc_notify_std (GFC_STD_LEGACY,
"Duplicate PROTECTED attribute specified at %L",
@@ -985,12 +981,12 @@ gfc_add_protected (symbol_attribute *attr, const char *name, locus *where)
return FAILURE;
}
- attr->protected = 1;
+ attr->is_protected = 1;
return check_conflict (attr, name, where);
}
-try
+gfc_try
gfc_add_result (symbol_attribute *attr, const char *name, locus *where)
{
@@ -1002,7 +998,7 @@ gfc_add_result (symbol_attribute *attr, const char *name, locus *where)
}
-try
+gfc_try
gfc_add_save (symbol_attribute *attr, const char *name, locus *where)
{
@@ -1031,7 +1027,7 @@ gfc_add_save (symbol_attribute *attr, const char *name, locus *where)
}
-try
+gfc_try
gfc_add_value (symbol_attribute *attr, const char *name, locus *where)
{
@@ -1052,7 +1048,7 @@ gfc_add_value (symbol_attribute *attr, const char *name, locus *where)
}
-try
+gfc_try
gfc_add_volatile (symbol_attribute *attr, const char *name, locus *where)
{
/* No check_used needed as 11.2.1 of the F2003 standard allows
@@ -1071,7 +1067,7 @@ gfc_add_volatile (symbol_attribute *attr, const char *name, locus *where)
}
-try
+gfc_try
gfc_add_threadprivate (symbol_attribute *attr, const char *name, locus *where)
{
@@ -1089,7 +1085,7 @@ gfc_add_threadprivate (symbol_attribute *attr, const char *name, locus *where)
}
-try
+gfc_try
gfc_add_target (symbol_attribute *attr, locus *where)
{
@@ -1107,7 +1103,7 @@ gfc_add_target (symbol_attribute *attr, locus *where)
}
-try
+gfc_try
gfc_add_dummy (symbol_attribute *attr, const char *name, locus *where)
{
@@ -1120,7 +1116,7 @@ gfc_add_dummy (symbol_attribute *attr, const char *name, locus *where)
}
-try
+gfc_try
gfc_add_in_common (symbol_attribute *attr, const char *name, locus *where)
{
@@ -1139,7 +1135,7 @@ gfc_add_in_common (symbol_attribute *attr, const char *name, locus *where)
}
-try
+gfc_try
gfc_add_in_equivalence (symbol_attribute *attr, const char *name, locus *where)
{
@@ -1155,7 +1151,7 @@ gfc_add_in_equivalence (symbol_attribute *attr, const char *name, locus *where)
}
-try
+gfc_try
gfc_add_data (symbol_attribute *attr, const char *name, locus *where)
{
@@ -1167,7 +1163,7 @@ gfc_add_data (symbol_attribute *attr, const char *name, locus *where)
}
-try
+gfc_try
gfc_add_in_namelist (symbol_attribute *attr, const char *name, locus *where)
{
@@ -1176,7 +1172,7 @@ gfc_add_in_namelist (symbol_attribute *attr, const char *name, locus *where)
}
-try
+gfc_try
gfc_add_sequence (symbol_attribute *attr, const char *name, locus *where)
{
@@ -1188,7 +1184,7 @@ gfc_add_sequence (symbol_attribute *attr, const char *name, locus *where)
}
-try
+gfc_try
gfc_add_elemental (symbol_attribute *attr, locus *where)
{
@@ -1206,7 +1202,7 @@ gfc_add_elemental (symbol_attribute *attr, locus *where)
}
-try
+gfc_try
gfc_add_pure (symbol_attribute *attr, locus *where)
{
@@ -1224,7 +1220,7 @@ gfc_add_pure (symbol_attribute *attr, locus *where)
}
-try
+gfc_try
gfc_add_recursive (symbol_attribute *attr, locus *where)
{
@@ -1242,7 +1238,7 @@ gfc_add_recursive (symbol_attribute *attr, locus *where)
}
-try
+gfc_try
gfc_add_entry (symbol_attribute *attr, const char *name, locus *where)
{
@@ -1260,7 +1256,7 @@ gfc_add_entry (symbol_attribute *attr, const char *name, locus *where)
}
-try
+gfc_try
gfc_add_function (symbol_attribute *attr, const char *name, locus *where)
{
@@ -1273,7 +1269,7 @@ gfc_add_function (symbol_attribute *attr, const char *name, locus *where)
}
-try
+gfc_try
gfc_add_subroutine (symbol_attribute *attr, const char *name, locus *where)
{
@@ -1286,7 +1282,7 @@ gfc_add_subroutine (symbol_attribute *attr, const char *name, locus *where)
}
-try
+gfc_try
gfc_add_generic (symbol_attribute *attr, const char *name, locus *where)
{
@@ -1299,7 +1295,7 @@ gfc_add_generic (symbol_attribute *attr, const char *name, locus *where)
}
-try
+gfc_try
gfc_add_proc (symbol_attribute *attr, const char *name, locus *where)
{
@@ -1325,7 +1321,7 @@ gfc_add_proc (symbol_attribute *attr, const char *name, locus *where)
/* Flavors are special because some flavors are not what Fortran
considers attributes and can be reaffirmed multiple times. */
-try
+gfc_try
gfc_add_flavor (symbol_attribute *attr, sym_flavor f, const char *name,
locus *where)
{
@@ -1361,7 +1357,7 @@ gfc_add_flavor (symbol_attribute *attr, sym_flavor f, const char *name,
}
-try
+gfc_try
gfc_add_procedure (symbol_attribute *attr, procedure_type t,
const char *name, locus *where)
{
@@ -1397,7 +1393,7 @@ gfc_add_procedure (symbol_attribute *attr, procedure_type t,
}
-try
+gfc_try
gfc_add_intent (symbol_attribute *attr, sym_intent intent, locus *where)
{
@@ -1423,7 +1419,7 @@ gfc_add_intent (symbol_attribute *attr, sym_intent intent, locus *where)
/* No checks for use-association in public and private statements. */
-try
+gfc_try
gfc_add_access (symbol_attribute *attr, gfc_access access,
const char *name, locus *where)
{
@@ -1444,7 +1440,7 @@ gfc_add_access (symbol_attribute *attr, gfc_access access,
/* Set the is_bind_c field for the given symbol_attribute. */
-try
+gfc_try
gfc_add_is_bind_c (symbol_attribute *attr, const char *name, locus *where,
int is_proc_lang_bind_spec)
{
@@ -1468,7 +1464,28 @@ gfc_add_is_bind_c (symbol_attribute *attr, const char *name, locus *where,
}
-try
+/* Set the extension field for the given symbol_attribute. */
+
+gfc_try
+gfc_add_extension (symbol_attribute *attr, locus *where)
+{
+ if (where == NULL)
+ where = &gfc_current_locus;
+
+ if (attr->extension)
+ gfc_error_now ("Duplicate EXTENDS attribute specified at %L", where);
+ else
+ attr->extension = 1;
+
+ if (gfc_notify_std (GFC_STD_F2003, "Fortran 2003: EXTENDS at %L", where)
+ == FAILURE)
+ return FAILURE;
+
+ return SUCCESS;
+}
+
+
+gfc_try
gfc_add_explicit_interface (gfc_symbol *sym, ifsrc source,
gfc_formal_arglist * formal, locus *where)
{
@@ -1503,7 +1520,7 @@ gfc_add_explicit_interface (gfc_symbol *sym, ifsrc source,
/* Add a type to a symbol. */
-try
+gfc_try
gfc_add_type (gfc_symbol *sym, gfc_typespec *ts, locus *where)
{
sym_flavor flavor;
@@ -1555,7 +1572,7 @@ gfc_clear_attr (symbol_attribute *attr)
/* Check for missing attributes in the new symbol. Currently does
nothing, but it's not clear that it is unnecessary yet. */
-try
+gfc_try
gfc_missing_attr (symbol_attribute *attr ATTRIBUTE_UNUSED,
locus *where ATTRIBUTE_UNUSED)
{
@@ -1568,7 +1585,7 @@ gfc_missing_attr (symbol_attribute *attr ATTRIBUTE_UNUSED,
attributes have a lot of side-effects but cannot be present given
where we are called from, so we ignore some bits. */
-try
+gfc_try
gfc_copy_attr (symbol_attribute *dest, symbol_attribute *src, locus *where)
{
int is_proc_lang_bind_spec;
@@ -1582,7 +1599,7 @@ gfc_copy_attr (symbol_attribute *dest, symbol_attribute *src, locus *where)
goto fail;
if (src->pointer && gfc_add_pointer (dest, where) == FAILURE)
goto fail;
- if (src->protected && gfc_add_protected (dest, NULL, where) == FAILURE)
+ if (src->is_protected && gfc_add_protected (dest, NULL, where) == FAILURE)
goto fail;
if (src->save && gfc_add_save (dest, NULL, where) == FAILURE)
goto fail;
@@ -1681,7 +1698,7 @@ fail:
already present. On success, the component pointer is modified to
point to the additional component structure. */
-try
+gfc_try
gfc_add_component (gfc_symbol *sym, const char *name,
gfc_component **component)
{
@@ -1701,6 +1718,14 @@ gfc_add_component (gfc_symbol *sym, const char *name,
tail = p;
}
+ if (sym->attr.extension
+ && gfc_find_component (sym->components->ts.derived, name))
+ {
+ gfc_error ("Component '%s' at %C already in the parent type "
+ "at %L", name, &sym->components->ts.derived->declared_at);
+ return FAILURE;
+ }
+
/* Allocate a new component. */
p = gfc_get_component ();
@@ -1830,17 +1855,36 @@ gfc_find_component (gfc_symbol *sym, const char *name)
if (strcmp (p->name, name) == 0)
break;
+ if (p == NULL
+ && sym->attr.extension
+ && sym->components->ts.type == BT_DERIVED)
+ {
+ p = gfc_find_component (sym->components->ts.derived, name);
+ /* Do not overwrite the error. */
+ if (p == NULL)
+ return p;
+ }
+
if (p == NULL)
gfc_error ("'%s' at %C is not a member of the '%s' structure",
name, sym->name);
- else
+
+ else if (sym->attr.use_assoc)
{
- if (sym->attr.use_assoc && (sym->component_access == ACCESS_PRIVATE
- || p->access == ACCESS_PRIVATE))
+ if (p->access == ACCESS_PRIVATE)
{
gfc_error ("Component '%s' at %C is a PRIVATE component of '%s'",
name, sym->name);
- p = NULL;
+ return NULL;
+ }
+
+ /* If there were components given and all components are private, error
+ out at this place. */
+ if (p->access != ACCESS_PUBLIC && sym->component_access == ACCESS_PRIVATE)
+ {
+ gfc_error ("All components of '%s' are PRIVATE in structure"
+ " constructor at %C", sym->name);
+ return NULL;
}
}
@@ -2034,12 +2078,12 @@ gfc_define_st_label (gfc_st_label *lp, gfc_sl_type type, locus *label_locus)
updating the unknown state. Returns FAILURE if something goes
wrong. */
-try
+gfc_try
gfc_reference_st_label (gfc_st_label *lp, gfc_sl_type type)
{
gfc_sl_type label_type;
int labelno;
- try rc;
+ gfc_try rc;
if (lp == NULL)
return SUCCESS;
@@ -2451,7 +2495,7 @@ static void
save_symbol_data (gfc_symbol *sym)
{
- if (sym->new || sym->old_symbol != NULL)
+ if (sym->gfc_new || sym->old_symbol != NULL)
return;
sym->old_symbol = XCNEW (gfc_symbol);
@@ -2495,7 +2539,7 @@ gfc_get_sym_tree (const char *name, gfc_namespace *ns, gfc_symtree **result)
p->old_symbol = NULL;
p->tlink = changed_syms;
p->mark = 1;
- p->new = 1;
+ p->gfc_new = 1;
changed_syms = p;
st = gfc_new_symtree (&ns->sym_root, name);
@@ -2643,7 +2687,7 @@ gfc_undo_symbols (void)
{
q = p->tlink;
- if (p->new)
+ if (p->gfc_new)
{
/* Symbol was new. */
if (p->attr.in_common && p->common_block->head)
@@ -2779,7 +2823,7 @@ gfc_commit_symbols (void)
q = p->tlink;
p->tlink = NULL;
p->mark = 0;
- p->new = 0;
+ p->gfc_new = 0;
free_old_symbol (p);
}
changed_syms = NULL;
@@ -2808,7 +2852,7 @@ gfc_commit_symbol (gfc_symbol *sym)
sym->tlink = NULL;
sym->mark = 0;
- sym->new = 0;
+ sym->gfc_new = 0;
free_old_symbol (sym);
}
@@ -2843,7 +2887,7 @@ free_uop_tree (gfc_symtree *uop_tree)
free_uop_tree (uop_tree->left);
free_uop_tree (uop_tree->right);
- gfc_free_interface (uop_tree->n.uop->operator);
+ gfc_free_interface (uop_tree->n.uop->op);
gfc_free (uop_tree->n.uop);
gfc_free (uop_tree);
@@ -2938,9 +2982,12 @@ gfc_free_finalizer (gfc_finalizer* el)
{
if (el)
{
- --el->procedure->refs;
- if (!el->procedure->refs)
- gfc_free_symbol (el->procedure);
+ if (el->proc_sym)
+ {
+ --el->proc_sym->refs;
+ if (!el->proc_sym->refs)
+ gfc_free_symbol (el->proc_sym);
+ }
gfc_free (el);
}
@@ -2997,7 +3044,7 @@ gfc_free_namespace (gfc_namespace *ns)
gfc_free_equiv_lists (ns->equiv_lists);
for (i = GFC_INTRINSIC_BEGIN; i != GFC_INTRINSIC_END; i++)
- gfc_free_interface (ns->operator[i]);
+ gfc_free_interface (ns->op[i]);
gfc_free_data (ns->data);
p = ns->contained;
@@ -3257,12 +3304,12 @@ get_iso_c_binding_dt (int sym_id)
for such. If an error occurs, the errors are reported here, allowing for
multiple errors to be handled for a single derived type. */
-try
+gfc_try
verify_bind_c_derived_type (gfc_symbol *derived_sym)
{
gfc_component *curr_comp = NULL;
- try is_c_interop = FAILURE;
- try retval = SUCCESS;
+ gfc_try is_c_interop = FAILURE;
+ gfc_try retval = SUCCESS;
if (derived_sym == NULL)
gfc_internal_error ("verify_bind_c_derived_type(): Given symbol is "
@@ -3406,7 +3453,7 @@ verify_bind_c_derived_type (gfc_symbol *derived_sym)
/* Generate symbols for the named constants c_null_ptr and c_null_funptr. */
-static try
+static gfc_try
gen_special_c_interop_ptr (int ptr_id, const char *ptr_name,
const char *module_name)
{
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index 2a966988dec..6c6845daf4e 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -39,7 +39,7 @@ along with GCC; see the file COPYING3. If not see
In fortran all the rhs values of an assignment must be evaluated before
any assignments take place. This can require a temporary array to store the
values. We also require a temporary when we are passing array expressions
- or vector subecripts as procedure parameters.
+ or vector subscripts as procedure parameters.
Array sections are passed without copying to a temporary. These use the
scalarizer to determine the shape of the section. The flag
@@ -80,7 +80,7 @@ along with GCC; see the file COPYING3. If not see
#include "system.h"
#include "coretypes.h"
#include "tree.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "ggc.h"
#include "toplev.h"
#include "real.h"
@@ -161,12 +161,10 @@ gfc_conv_descriptor_data_get (tree desc)
This function gets called through the following macros:
gfc_conv_descriptor_data_set
- gfc_conv_descriptor_data_set_tuples. */
+ gfc_conv_descriptor_data_set. */
void
-gfc_conv_descriptor_data_set_internal (stmtblock_t *block,
- tree desc, tree value,
- bool tuples_p)
+gfc_conv_descriptor_data_set (stmtblock_t *block, tree desc, tree value)
{
tree field, type, t;
@@ -177,7 +175,7 @@ gfc_conv_descriptor_data_set_internal (stmtblock_t *block,
gcc_assert (DATA_FIELD == 0);
t = fold_build3 (COMPONENT_REF, TREE_TYPE (field), desc, field, NULL_TREE);
- gfc_add_modify (block, t, fold_convert (TREE_TYPE (field), value), tuples_p);
+ gfc_add_modify (block, t, fold_convert (TREE_TYPE (field), value));
}
@@ -547,7 +545,7 @@ gfc_trans_allocate_array_storage (stmtblock_t * pre, stmtblock_t * post,
/* The offset is zero because we create temporaries with a zero
lower bound. */
tmp = gfc_conv_descriptor_offset (desc);
- gfc_add_modify_expr (pre, tmp, gfc_index_zero_node);
+ gfc_add_modify (pre, tmp, gfc_index_zero_node);
if (dealloc && !onstack)
{
@@ -576,7 +574,7 @@ tree
gfc_trans_create_temp_array (stmtblock_t * pre, stmtblock_t * post,
gfc_loopinfo * loop, gfc_ss_info * info,
tree eltype, bool dynamic, bool dealloc,
- bool callee_alloc)
+ bool callee_alloc, locus * where)
{
tree type;
tree desc;
@@ -589,6 +587,10 @@ gfc_trans_create_temp_array (stmtblock_t * pre, stmtblock_t * post,
int dim;
gcc_assert (info->dimen > 0);
+
+ if (gfc_option.warn_array_temp && where)
+ gfc_warning ("Creating array temporary at %L", where);
+
/* Set the lower bound to zero. */
for (dim = 0; dim < info->dimen; dim++)
{
@@ -623,7 +625,7 @@ gfc_trans_create_temp_array (stmtblock_t * pre, stmtblock_t * post,
/* Fill in the array dtype. */
tmp = gfc_conv_descriptor_dtype (desc);
- gfc_add_modify_expr (pre, tmp, gfc_get_dtype (TREE_TYPE (desc)));
+ gfc_add_modify (pre, tmp, gfc_get_dtype (TREE_TYPE (desc)));
/*
Fill in the bounds and stride. This is a packed array, so:
@@ -657,13 +659,13 @@ gfc_trans_create_temp_array (stmtblock_t * pre, stmtblock_t * post,
/* Store the stride and bound components in the descriptor. */
tmp = gfc_conv_descriptor_stride (desc, gfc_rank_cst[n]);
- gfc_add_modify_expr (pre, tmp, size);
+ gfc_add_modify (pre, tmp, size);
tmp = gfc_conv_descriptor_lbound (desc, gfc_rank_cst[n]);
- gfc_add_modify_expr (pre, tmp, gfc_index_zero_node);
+ gfc_add_modify (pre, tmp, gfc_index_zero_node);
tmp = gfc_conv_descriptor_ubound (desc, gfc_rank_cst[n]);
- gfc_add_modify_expr (pre, tmp, loop->to[n]);
+ gfc_add_modify (pre, tmp, loop->to[n]);
tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type,
loop->to[n], gfc_index_one_node);
@@ -748,7 +750,7 @@ gfc_conv_array_transpose (gfc_se * se, gfc_expr * expr)
se->expr = dest;
/* Copy across the dtype field. */
- gfc_add_modify_expr (&se->pre,
+ gfc_add_modify (&se->pre,
gfc_conv_descriptor_dtype (dest),
gfc_conv_descriptor_dtype (src));
@@ -765,15 +767,15 @@ gfc_conv_array_transpose (gfc_se * se, gfc_expr * expr)
dest_index = gfc_rank_cst[n];
src_index = gfc_rank_cst[1 - n];
- gfc_add_modify_expr (&se->pre,
+ gfc_add_modify (&se->pre,
gfc_conv_descriptor_stride (dest, dest_index),
gfc_conv_descriptor_stride (src, src_index));
- gfc_add_modify_expr (&se->pre,
+ gfc_add_modify (&se->pre,
gfc_conv_descriptor_lbound (dest, dest_index),
gfc_conv_descriptor_lbound (src, src_index));
- gfc_add_modify_expr (&se->pre,
+ gfc_add_modify (&se->pre,
gfc_conv_descriptor_ubound (dest, dest_index),
gfc_conv_descriptor_ubound (src, src_index));
@@ -799,7 +801,7 @@ gfc_conv_array_transpose (gfc_se * se, gfc_expr * expr)
else
dest_info->offset = gfc_index_zero_node;
- gfc_add_modify_expr (&se->pre,
+ gfc_add_modify (&se->pre,
gfc_conv_descriptor_offset (dest),
dest_info->offset);
@@ -843,7 +845,7 @@ gfc_grow_array (stmtblock_t * pblock, tree desc, tree extra)
/* Add EXTRA to the upper bound. */
tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type, ubound, extra);
- gfc_add_modify_expr (pblock, ubound, tmp);
+ gfc_add_modify (pblock, ubound, tmp);
/* Get the value of the current data pointer. */
arg0 = gfc_conv_descriptor_data_get (desc);
@@ -953,7 +955,7 @@ gfc_put_offset_into_var (stmtblock_t * pblock, tree * poffset,
/* We should have already created the offset variable. We cannot
create it here because we may be in an inner scope. */
gcc_assert (*offsetvar != NULL_TREE);
- gfc_add_modify_expr (pblock, *offsetvar, *poffset);
+ gfc_add_modify (pblock, *offsetvar, *poffset);
*poffset = *offsetvar;
TREE_USED (*offsetvar) = 1;
}
@@ -992,7 +994,7 @@ gfc_trans_array_ctor_element (stmtblock_t * pblock, tree desc,
{
/* The temporary is an array of pointers. */
se->expr = fold_convert (TREE_TYPE (tmp), se->expr);
- gfc_add_modify_expr (&se->pre, tmp, se->expr);
+ gfc_add_modify (&se->pre, tmp, se->expr);
}
else
{
@@ -1007,7 +1009,7 @@ gfc_trans_array_ctor_element (stmtblock_t * pblock, tree desc,
{
if (first_len)
{
- gfc_add_modify_expr (&se->pre, first_len_val,
+ gfc_add_modify (&se->pre, first_len_val,
se->string_length);
first_len = false;
}
@@ -1018,7 +1020,7 @@ gfc_trans_array_ctor_element (stmtblock_t * pblock, tree desc,
tree cond = fold_build2 (NE_EXPR, boolean_type_node,
first_len_val, se->string_length);
gfc_trans_runtime_check
- (cond, &se->pre, &expr->where,
+ (true, false, cond, &se->pre, &expr->where,
"Different CHARACTER lengths (%ld/%ld) in array constructor",
fold_convert (long_integer_type_node, first_len_val),
fold_convert (long_integer_type_node, se->string_length));
@@ -1029,7 +1031,7 @@ gfc_trans_array_ctor_element (stmtblock_t * pblock, tree desc,
{
/* TODO: Should the frontend already have done this conversion? */
se->expr = fold_convert (TREE_TYPE (tmp), se->expr);
- gfc_add_modify_expr (&se->pre, tmp, se->expr);
+ gfc_add_modify (&se->pre, tmp, se->expr);
}
gfc_add_block_to_block (pblock, &se->pre);
@@ -1070,7 +1072,7 @@ gfc_trans_array_constructor_subarray (stmtblock_t * pblock,
/* Initialize the loop. */
gfc_conv_ss_startstride (&loop);
- gfc_conv_loop_setup (&loop);
+ gfc_conv_loop_setup (&loop, &expr->where);
/* Make sure the constructed array has room for the new data. */
if (dynamic)
@@ -1100,7 +1102,7 @@ gfc_trans_array_constructor_subarray (stmtblock_t * pblock,
/* Increment the offset. */
tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type,
*poffset, gfc_index_one_node);
- gfc_add_modify_expr (&body, *poffset, tmp);
+ gfc_add_modify (&body, *poffset, tmp);
/* Finish the loop. */
gfc_trans_scalarizing_loops (&loop, &body);
@@ -1239,7 +1241,7 @@ gfc_trans_array_constructor_value (stmtblock_t * pblock, tree type,
}
if (!INTEGER_CST_P (*poffset))
{
- gfc_add_modify_expr (&body, *offsetvar, *poffset);
+ gfc_add_modify (&body, *offsetvar, *poffset);
*poffset = *offsetvar;
}
}
@@ -1285,13 +1287,13 @@ gfc_trans_array_constructor_value (stmtblock_t * pblock, tree type,
/* Make a temporary, store the current value in that
and return it, once the loop is done. */
tmp_loopvar = gfc_create_var (TREE_TYPE (loopvar), "loopvar");
- gfc_add_modify_expr (pblock, tmp_loopvar, loopvar);
+ gfc_add_modify (pblock, tmp_loopvar, loopvar);
/* Initialize the loop. */
gfc_init_se (&se, NULL);
gfc_conv_expr_val (&se, c->iterator->start);
gfc_add_block_to_block (pblock, &se.pre);
- gfc_add_modify_expr (pblock, loopvar, se.expr);
+ gfc_add_modify (pblock, loopvar, se.expr);
gfc_init_se (&se, NULL);
gfc_conv_expr_val (&se, c->iterator->end);
@@ -1344,7 +1346,7 @@ gfc_trans_array_constructor_value (stmtblock_t * pblock, tree type,
/* Increase loop variable by step. */
tmp = fold_build2 (PLUS_EXPR, TREE_TYPE (loopvar), loopvar, step);
- gfc_add_modify_expr (&body, loopvar, tmp);
+ gfc_add_modify (&body, loopvar, tmp);
/* Finish the loop. */
tmp = gfc_finish_block (&body);
@@ -1356,7 +1358,7 @@ gfc_trans_array_constructor_value (stmtblock_t * pblock, tree type,
gfc_add_expr_to_block (pblock, tmp);
/* Restore the original value of the loop counter. */
- gfc_add_modify_expr (pblock, loopvar, tmp_loopvar);
+ gfc_add_modify (pblock, loopvar, tmp_loopvar);
}
}
mpz_clear (size);
@@ -1645,7 +1647,7 @@ gfc_trans_constant_array_constructor (gfc_loopinfo * loop,
/* Helper routine of gfc_trans_array_constructor to determine if the
bounds of the loop specified by LOOP are constant and simple enough
to use with gfc_trans_constant_array_constructor. Returns the
- the iteration count of the loop if suitable, and NULL_TREE otherwise. */
+ iteration count of the loop if suitable, and NULL_TREE otherwise. */
static tree
constant_array_constructor_loop_size (gfc_loopinfo * loop)
@@ -1683,7 +1685,7 @@ constant_array_constructor_loop_size (gfc_loopinfo * loop)
simplest method. */
static void
-gfc_trans_array_constructor (gfc_loopinfo * loop, gfc_ss * ss)
+gfc_trans_array_constructor (gfc_loopinfo * loop, gfc_ss * ss, locus * where)
{
gfc_constructor *c;
tree offset;
@@ -1809,7 +1811,7 @@ gfc_trans_array_constructor (gfc_loopinfo * loop, gfc_ss * ss)
loopfrom = NULL_TREE;
gfc_trans_create_temp_array (&loop->pre, &loop->post, loop, &ss->data.info,
- type, dynamic, true, false);
+ type, dynamic, true, false, where);
if (loopfrom != NULL_TREE)
{
@@ -1896,13 +1898,14 @@ gfc_set_vector_loop_bounds (gfc_loopinfo * loop, gfc_ss_info * info)
but before the actual scalarizing loops. */
static void
-gfc_add_loop_ss_code (gfc_loopinfo * loop, gfc_ss * ss, bool subscript)
+gfc_add_loop_ss_code (gfc_loopinfo * loop, gfc_ss * ss, bool subscript,
+ locus * where)
{
gfc_se se;
int n;
- /* TODO: This can generate bad code if there are ordering dependencies.
- eg. a callee allocated function and an unknown size constructor. */
+ /* TODO: This can generate bad code if there are ordering dependencies,
+ e.g., a callee allocated function and an unknown size constructor. */
gcc_assert (ss != NULL);
for (; ss != gfc_ss_terminator; ss = ss->loop_chain)
@@ -1950,7 +1953,8 @@ gfc_add_loop_ss_code (gfc_loopinfo * loop, gfc_ss * ss, bool subscript)
/* Add the expressions for scalar and vector subscripts. */
for (n = 0; n < GFC_MAX_DIMENSIONS; n++)
if (ss->data.info.subscript[n])
- gfc_add_loop_ss_code (loop, ss->data.info.subscript[n], true);
+ gfc_add_loop_ss_code (loop, ss->data.info.subscript[n], true,
+ where);
gfc_set_vector_loop_bounds (loop, &ss->data.info);
break;
@@ -1993,7 +1997,7 @@ gfc_add_loop_ss_code (gfc_loopinfo * loop, gfc_ss * ss, bool subscript)
gfc_add_block_to_block (&loop->pre, &se.pre);
gfc_add_block_to_block (&loop->post, &se.post);
}
- gfc_trans_array_constructor (loop, ss);
+ gfc_trans_array_constructor (loop, ss, where);
break;
case GFC_SS_TEMP:
@@ -2229,7 +2233,7 @@ gfc_trans_array_bound_check (gfc_se * se, tree descriptor, tree index, int n,
else
asprintf (&msg, "%s, lower bound of dimension %d exceeded (%%ld < %%ld)",
gfc_msg_fault, n+1);
- gfc_trans_runtime_check (fault, &se->pre, where, msg,
+ gfc_trans_runtime_check (true, false, fault, &se->pre, where, msg,
fold_convert (long_integer_type_node, index),
fold_convert (long_integer_type_node, tmp));
gfc_free (msg);
@@ -2245,7 +2249,7 @@ gfc_trans_array_bound_check (gfc_se * se, tree descriptor, tree index, int n,
else
asprintf (&msg, "%s, upper bound of dimension %d exceeded (%%ld > %%ld)",
gfc_msg_fault, n+1);
- gfc_trans_runtime_check (fault, &se->pre, where, msg,
+ gfc_trans_runtime_check (true, false, fault, &se->pre, where, msg,
fold_convert (long_integer_type_node, index),
fold_convert (long_integer_type_node, tmp));
gfc_free (msg);
@@ -2439,7 +2443,7 @@ gfc_conv_array_ref (gfc_se * se, gfc_array_ref * ar, gfc_symbol * sym,
asprintf (&msg, "%s for array '%s', "
"lower bound of dimension %d exceeded (%%ld < %%ld)",
gfc_msg_fault, sym->name, n+1);
- gfc_trans_runtime_check (cond, &se->pre, where, msg,
+ gfc_trans_runtime_check (true, false, cond, &se->pre, where, msg,
fold_convert (long_integer_type_node,
indexse.expr),
fold_convert (long_integer_type_node, tmp));
@@ -2456,7 +2460,7 @@ gfc_conv_array_ref (gfc_se * se, gfc_array_ref * ar, gfc_symbol * sym,
asprintf (&msg, "%s for array '%s', "
"upper bound of dimension %d exceeded (%%ld > %%ld)",
gfc_msg_fault, sym->name, n+1);
- gfc_trans_runtime_check (cond, &se->pre, where, msg,
+ gfc_trans_runtime_check (true, false, cond, &se->pre, where, msg,
fold_convert (long_integer_type_node,
indexse.expr),
fold_convert (long_integer_type_node, tmp));
@@ -2634,7 +2638,7 @@ gfc_trans_scalarized_loop_end (gfc_loopinfo * loop, int n,
loopbody = gfc_finish_block (pbody);
/* Initialize the loopvar. */
- gfc_add_modify_expr (&loop->code[n], loop->loopvar[n], loop->from[n]);
+ gfc_add_modify (&loop->code[n], loop->loopvar[n], loop->from[n]);
exit_label = gfc_build_label_decl (NULL_TREE);
@@ -2655,7 +2659,7 @@ gfc_trans_scalarized_loop_end (gfc_loopinfo * loop, int n,
/* Increment the loopvar. */
tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type,
loop->loopvar[n], gfc_index_one_node);
- gfc_add_modify_expr (&block, loop->loopvar[n], tmp);
+ gfc_add_modify (&block, loop->loopvar[n], tmp);
/* Build the loop. */
tmp = gfc_finish_block (&block);
@@ -3020,7 +3024,8 @@ gfc_conv_ss_startstride (gfc_loopinfo * loop)
asprintf (&msg, "Zero stride is not allowed, for dimension %d "
"of array '%s'", info->dim[n]+1,
ss->expr->symtree->name);
- gfc_trans_runtime_check (tmp, &inner, &ss->expr->where, msg);
+ gfc_trans_runtime_check (true, false, tmp, &inner,
+ &ss->expr->where, msg);
gfc_free (msg);
desc = ss->data.info.descriptor;
@@ -3062,7 +3067,8 @@ gfc_conv_ss_startstride (gfc_loopinfo * loop)
asprintf (&msg, "%s, lower bound of dimension %d of array '%s'"
" exceeded (%%ld < %%ld)", gfc_msg_fault,
info->dim[n]+1, ss->expr->symtree->name);
- gfc_trans_runtime_check (tmp, &inner, &ss->expr->where, msg,
+ gfc_trans_runtime_check (true, false, tmp, &inner,
+ &ss->expr->where, msg,
fold_convert (long_integer_type_node,
info->start[n]),
fold_convert (long_integer_type_node,
@@ -3078,7 +3084,8 @@ gfc_conv_ss_startstride (gfc_loopinfo * loop)
asprintf (&msg, "%s, upper bound of dimension %d of array "
"'%s' exceeded (%%ld > %%ld)", gfc_msg_fault,
info->dim[n]+1, ss->expr->symtree->name);
- gfc_trans_runtime_check (tmp, &inner, &ss->expr->where, msg,
+ gfc_trans_runtime_check (true, false, tmp, &inner,
+ &ss->expr->where, msg,
fold_convert (long_integer_type_node, info->start[n]),
fold_convert (long_integer_type_node, ubound));
gfc_free (msg);
@@ -3100,7 +3107,8 @@ gfc_conv_ss_startstride (gfc_loopinfo * loop)
asprintf (&msg, "%s, lower bound of dimension %d of array '%s'"
" exceeded (%%ld < %%ld)", gfc_msg_fault,
info->dim[n]+1, ss->expr->symtree->name);
- gfc_trans_runtime_check (tmp, &inner, &ss->expr->where, msg,
+ gfc_trans_runtime_check (true, false, tmp, &inner,
+ &ss->expr->where, msg,
fold_convert (long_integer_type_node,
tmp2),
fold_convert (long_integer_type_node,
@@ -3115,7 +3123,8 @@ gfc_conv_ss_startstride (gfc_loopinfo * loop)
asprintf (&msg, "%s, upper bound of dimension %d of array "
"'%s' exceeded (%%ld > %%ld)", gfc_msg_fault,
info->dim[n]+1, ss->expr->symtree->name);
- gfc_trans_runtime_check (tmp, &inner, &ss->expr->where, msg,
+ gfc_trans_runtime_check (true, false, tmp, &inner,
+ &ss->expr->where, msg,
fold_convert (long_integer_type_node, tmp2),
fold_convert (long_integer_type_node, ubound));
gfc_free (msg);
@@ -3138,7 +3147,8 @@ gfc_conv_ss_startstride (gfc_loopinfo * loop)
asprintf (&msg, "%s, size mismatch for dimension %d "
"of array '%s' (%%ld/%%ld)", gfc_msg_bounds,
info->dim[n]+1, ss->expr->symtree->name);
- gfc_trans_runtime_check (tmp3, &inner, &ss->expr->where, msg,
+ gfc_trans_runtime_check (true, false, tmp3, &inner,
+ &ss->expr->where, msg,
fold_convert (long_integer_type_node, tmp),
fold_convert (long_integer_type_node, size[n]));
gfc_free (msg);
@@ -3247,14 +3257,16 @@ gfc_conv_resolve_dependencies (gfc_loopinfo * loop, gfc_ss * dest,
if (ss->type != GFC_SS_SECTION)
continue;
- if (gfc_could_be_alias (dest, ss)
- || gfc_are_equivalenced_arrays (dest->expr, ss->expr))
+ if (dest->expr->symtree->n.sym != ss->expr->symtree->n.sym)
{
- nDepend = 1;
- break;
+ if (gfc_could_be_alias (dest, ss)
+ || gfc_are_equivalenced_arrays (dest->expr, ss->expr))
+ {
+ nDepend = 1;
+ break;
+ }
}
-
- if (dest->expr->symtree->n.sym == ss->expr->symtree->n.sym)
+ else
{
lref = dest->expr->ref;
rref = ss->expr->ref;
@@ -3327,7 +3339,7 @@ gfc_conv_resolve_dependencies (gfc_loopinfo * loop, gfc_ss * dest,
moved outside the loop. */
void
-gfc_conv_loop_setup (gfc_loopinfo * loop)
+gfc_conv_loop_setup (gfc_loopinfo * loop, locus * where)
{
int n;
int dim;
@@ -3493,7 +3505,7 @@ gfc_conv_loop_setup (gfc_loopinfo * loop)
/* Add all the scalar code that can be taken out of the loops.
This may include calculating the loop bounds, so do it before
allocating the temporary. */
- gfc_add_loop_ss_code (loop, loop->ss, false);
+ gfc_add_loop_ss_code (loop, loop->ss, false, where);
/* If we want a temporary then create it. */
if (loop->temp_ss != NULL)
@@ -3515,7 +3527,7 @@ gfc_conv_loop_setup (gfc_loopinfo * loop)
loop->temp_ss->data.info.dimen = n;
gfc_trans_create_temp_array (&loop->pre, &loop->post, loop,
&loop->temp_ss->data.info, tmp, false, true,
- false);
+ false, where);
}
for (n = 0; n < loop->temp_dim; n++)
@@ -3609,7 +3621,7 @@ gfc_array_init_size (tree descriptor, int rank, tree * poffset,
/* Set the dtype. */
tmp = gfc_conv_descriptor_dtype (descriptor);
- gfc_add_modify_expr (pblock, tmp, gfc_get_dtype (TREE_TYPE (descriptor)));
+ gfc_add_modify (pblock, tmp, gfc_get_dtype (TREE_TYPE (descriptor)));
or_expr = NULL_TREE;
@@ -3640,7 +3652,7 @@ gfc_array_init_size (tree descriptor, int rank, tree * poffset,
}
}
tmp = gfc_conv_descriptor_lbound (descriptor, gfc_rank_cst[n]);
- gfc_add_modify_expr (pblock, tmp, se.expr);
+ gfc_add_modify (pblock, tmp, se.expr);
/* Work out the offset for this component. */
tmp = fold_build2 (MULT_EXPR, gfc_array_index_type, se.expr, stride);
@@ -3657,11 +3669,11 @@ gfc_array_init_size (tree descriptor, int rank, tree * poffset,
gfc_add_block_to_block (pblock, &se.pre);
tmp = gfc_conv_descriptor_ubound (descriptor, gfc_rank_cst[n]);
- gfc_add_modify_expr (pblock, tmp, se.expr);
+ gfc_add_modify (pblock, tmp, se.expr);
/* Store the stride. */
tmp = gfc_conv_descriptor_stride (descriptor, gfc_rank_cst[n]);
- gfc_add_modify_expr (pblock, tmp, stride);
+ gfc_add_modify (pblock, tmp, stride);
/* Calculate the size of this dimension. */
size = fold_build2 (PLUS_EXPR, gfc_array_index_type, se.expr, size);
@@ -3701,11 +3713,11 @@ gfc_array_init_size (tree descriptor, int rank, tree * poffset,
var = gfc_create_var (TREE_TYPE (size), "size");
gfc_start_block (&thenblock);
- gfc_add_modify_expr (&thenblock, var, gfc_index_zero_node);
+ gfc_add_modify (&thenblock, var, gfc_index_zero_node);
thencase = gfc_finish_block (&thenblock);
gfc_start_block (&elseblock);
- gfc_add_modify_expr (&elseblock, var, size);
+ gfc_add_modify (&elseblock, var, size);
elsecase = gfc_finish_block (&elseblock);
tmp = gfc_evaluate_now (or_expr, pblock);
@@ -3791,7 +3803,7 @@ gfc_array_allocate (gfc_se * se, gfc_expr * expr, tree pstat)
gfc_add_expr_to_block (&se->pre, tmp);
tmp = gfc_conv_descriptor_offset (se->expr);
- gfc_add_modify_expr (&se->pre, tmp, offset);
+ gfc_add_modify (&se->pre, tmp, offset);
if (expr->ts.type == BT_DERIVED
&& expr->ts.derived->attr.alloc_comp)
@@ -3989,7 +4001,7 @@ gfc_trans_array_bounds (tree type, gfc_symbol * sym, tree * poffset,
gfc_init_se (&se, NULL);
gfc_conv_expr_type (&se, as->lower[dim], gfc_array_index_type);
gfc_add_block_to_block (pblock, &se.pre);
- gfc_add_modify_expr (pblock, lbound, se.expr);
+ gfc_add_modify (pblock, lbound, se.expr);
}
ubound = GFC_TYPE_ARRAY_UBOUND (type, dim);
if (as->upper[dim] && !INTEGER_CST_P (ubound))
@@ -3997,7 +4009,7 @@ gfc_trans_array_bounds (tree type, gfc_symbol * sym, tree * poffset,
gfc_init_se (&se, NULL);
gfc_conv_expr_type (&se, as->upper[dim], gfc_array_index_type);
gfc_add_block_to_block (pblock, &se.pre);
- gfc_add_modify_expr (pblock, ubound, se.expr);
+ gfc_add_modify (pblock, ubound, se.expr);
}
/* The offset of this dimension. offset = offset - lbound * stride. */
tmp = fold_build2 (MULT_EXPR, gfc_array_index_type, lbound, size);
@@ -4017,7 +4029,7 @@ gfc_trans_array_bounds (tree type, gfc_symbol * sym, tree * poffset,
tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type, ubound, tmp);
tmp = fold_build2 (MULT_EXPR, gfc_array_index_type, size, tmp);
if (stride)
- gfc_add_modify_expr (pblock, stride, tmp);
+ gfc_add_modify (pblock, stride, tmp);
else
stride = gfc_evaluate_now (tmp, pblock);
@@ -4027,7 +4039,7 @@ gfc_trans_array_bounds (tree type, gfc_symbol * sym, tree * poffset,
stride, gfc_index_zero_node);
tmp = fold_build3 (COND_EXPR, gfc_array_index_type, tmp,
stride, gfc_index_zero_node);
- gfc_add_modify_expr (pblock, stride, tmp);
+ gfc_add_modify (pblock, stride, tmp);
}
size = stride;
@@ -4100,7 +4112,7 @@ gfc_trans_auto_array_allocation (tree decl, gfc_symbol * sym, tree fnbody)
if (sym->attr.cray_pointee)
{
if (TREE_CODE (GFC_TYPE_ARRAY_OFFSET (type)) == VAR_DECL)
- gfc_add_modify_expr (&block, GFC_TYPE_ARRAY_OFFSET (type), offset);
+ gfc_add_modify (&block, GFC_TYPE_ARRAY_OFFSET (type), offset);
gfc_add_expr_to_block (&block, fnbody);
return gfc_finish_block (&block);
}
@@ -4113,11 +4125,11 @@ gfc_trans_auto_array_allocation (tree decl, gfc_symbol * sym, tree fnbody)
/* Allocate memory to hold the data. */
tmp = gfc_call_malloc (&block, TREE_TYPE (decl), size);
- gfc_add_modify_expr (&block, decl, tmp);
+ gfc_add_modify (&block, decl, tmp);
/* Set offset of the array. */
if (TREE_CODE (GFC_TYPE_ARRAY_OFFSET (type)) == VAR_DECL)
- gfc_add_modify_expr (&block, GFC_TYPE_ARRAY_OFFSET (type), offset);
+ gfc_add_modify (&block, GFC_TYPE_ARRAY_OFFSET (type), offset);
/* Automatic arrays should not have initializers. */
@@ -4165,13 +4177,13 @@ gfc_trans_g77_array (gfc_symbol * sym, tree body)
/* Set the offset. */
if (TREE_CODE (GFC_TYPE_ARRAY_OFFSET (type)) == VAR_DECL)
- gfc_add_modify_expr (&block, GFC_TYPE_ARRAY_OFFSET (type), offset);
+ gfc_add_modify (&block, GFC_TYPE_ARRAY_OFFSET (type), offset);
/* Set the pointer itself if we aren't using the parameter directly. */
if (TREE_CODE (parm) != PARM_DECL)
{
tmp = convert (TREE_TYPE (parm), GFC_DECL_SAVED_DESCRIPTOR (parm));
- gfc_add_modify_expr (&block, parm, tmp);
+ gfc_add_modify (&block, parm, tmp);
}
stmt = gfc_finish_block (&block);
@@ -4266,7 +4278,7 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, tree body)
TREE_USED (partial) = 1;
tmp = gfc_conv_descriptor_stride (dumdesc, gfc_rank_cst[0]);
tmp = fold_build2 (EQ_EXPR, boolean_type_node, tmp, gfc_index_one_node);
- gfc_add_modify_expr (&block, partial, tmp);
+ gfc_add_modify (&block, partial, tmp);
}
else
{
@@ -4286,7 +4298,7 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, tree body)
tmp = fold_build3 (COND_EXPR, gfc_array_index_type, tmp,
gfc_index_one_node, stride);
stride = GFC_TYPE_ARRAY_STRIDE (type, 0);
- gfc_add_modify_expr (&block, stride, tmp);
+ gfc_add_modify (&block, stride, tmp);
/* Allow the user to disable array repacking. */
stmt_unpacked = NULL_TREE;
@@ -4299,6 +4311,9 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, tree body)
stmt_unpacked = build_call_expr (gfor_fndecl_in_pack, 1, tmp);
stride = gfc_index_one_node;
+
+ if (gfc_option.warn_array_temp)
+ gfc_warning ("Creating array temporary at %L", &loc);
}
/* This is for the case where the array data is used directly without
@@ -4317,7 +4332,7 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, tree body)
}
else
tmp = stmt_packed != NULL_TREE ? stmt_packed : stmt_unpacked;
- gfc_add_modify_expr (&block, tmpdesc, fold_convert (type, tmp));
+ gfc_add_modify (&block, tmpdesc, fold_convert (type, tmp));
offset = gfc_index_zero_node;
size = gfc_index_one_node;
@@ -4344,7 +4359,7 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, tree body)
gfc_conv_expr_type (&se, sym->as->lower[n],
gfc_array_index_type);
gfc_add_block_to_block (&block, &se.pre);
- gfc_add_modify_expr (&block, lbound, se.expr);
+ gfc_add_modify (&block, lbound, se.expr);
}
ubound = GFC_TYPE_ARRAY_UBOUND (type, n);
@@ -4358,7 +4373,7 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, tree body)
gfc_conv_expr_type (&se, sym->as->upper[n],
gfc_array_index_type);
gfc_add_block_to_block (&block, &se.pre);
- gfc_add_modify_expr (&block, ubound, se.expr);
+ gfc_add_modify (&block, ubound, se.expr);
}
/* Check the sizes match. */
@@ -4374,7 +4389,7 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, tree body)
tmp = fold_build2 (NE_EXPR, gfc_array_index_type, tmp, stride2);
asprintf (&msg, "%s for dimension %d of array '%s'",
gfc_msg_bounds, n+1, sym->name);
- gfc_trans_runtime_check (tmp, &block, &loc, msg);
+ gfc_trans_runtime_check (true, false, tmp, &block, &loc, msg);
gfc_free (msg);
}
}
@@ -4385,7 +4400,7 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, tree body)
tmp = fold_build2 (MINUS_EXPR, gfc_array_index_type,
dubound, dlbound);
tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type, tmp, lbound);
- gfc_add_modify_expr (&block, ubound, tmp);
+ gfc_add_modify (&block, ubound, tmp);
}
/* The offset of this dimension. offset = offset - lbound * stride. */
tmp = fold_build2 (MULT_EXPR, gfc_array_index_type, lbound, stride);
@@ -4425,7 +4440,7 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, tree body)
stmt_unpacked, stmt_packed);
else
tmp = (stmt_packed != NULL_TREE) ? stmt_packed : stmt_unpacked;
- gfc_add_modify_expr (&block, stride, tmp);
+ gfc_add_modify (&block, stride, tmp);
}
}
else
@@ -4441,14 +4456,14 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, tree body)
ubound, tmp);
tmp = fold_build2 (MULT_EXPR, gfc_array_index_type,
GFC_TYPE_ARRAY_STRIDE (type, n), tmp);
- gfc_add_modify_expr (&block, stride, tmp);
+ gfc_add_modify (&block, stride, tmp);
}
}
}
/* Set the offset. */
if (TREE_CODE (GFC_TYPE_ARRAY_OFFSET (type)) == VAR_DECL)
- gfc_add_modify_expr (&block, GFC_TYPE_ARRAY_OFFSET (type), offset);
+ gfc_add_modify (&block, GFC_TYPE_ARRAY_OFFSET (type), offset);
gfc_trans_vla_type_sizes (sym, &block);
@@ -4536,7 +4551,7 @@ gfc_get_dataptr_offset (stmtblock_t *block, tree parm, tree desc, tree offset,
tmp = gfc_build_array_ref (tmp, offset, NULL);
/* Offset the data pointer for pointer assignments from arrays with
- subreferences; eg. my_integer => my_type(:)%integer_component. */
+ subreferences; e.g. my_integer => my_type(:)%integer_component. */
if (subref)
{
/* Go past the array reference. */
@@ -4635,7 +4650,7 @@ get_elemental_fcn_charlen (gfc_expr *expr, gfc_se *se)
arg = expr->value.function.actual;
gfc_init_interface_mapping (&mapping);
- /* Set se = NULL in the calls to the interface mapping, to supress any
+ /* Set se = NULL in the calls to the interface mapping, to suppress any
backend stuff. */
for (; arg != NULL; arg = arg->next, formal = formal ? formal->next : NULL)
{
@@ -4743,7 +4758,7 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss)
if (se->direct_byref)
{
/* Copy the descriptor for pointer assignments. */
- gfc_add_modify_expr (&se->pre, se->expr, desc);
+ gfc_add_modify (&se->pre, se->expr, desc);
/* Add any offsets from subreferences. */
gfc_get_dataptr_offset (&se->pre, se->expr, desc, NULL_TREE,
@@ -4871,7 +4886,7 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss)
gfc_add_ss_to_loop (&loop, loop.temp_ss);
}
- gfc_conv_loop_setup (&loop);
+ gfc_conv_loop_setup (&loop, & expr->where);
if (need_tmp)
{
@@ -4976,7 +4991,7 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss)
/* Set the dtype. */
tmp = gfc_conv_descriptor_dtype (parm);
- gfc_add_modify_expr (&loop.pre, tmp, gfc_get_dtype (parmtype));
+ gfc_add_modify (&loop.pre, tmp, gfc_get_dtype (parmtype));
/* Set offset for assignments to pointer only to zero if it is not
the full array. */
@@ -5045,11 +5060,11 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss)
from = gfc_index_one_node;
}
tmp = gfc_conv_descriptor_lbound (parm, gfc_rank_cst[dim]);
- gfc_add_modify_expr (&loop.pre, tmp, from);
+ gfc_add_modify (&loop.pre, tmp, from);
/* Set the new upper bound. */
tmp = gfc_conv_descriptor_ubound (parm, gfc_rank_cst[dim]);
- gfc_add_modify_expr (&loop.pre, tmp, to);
+ gfc_add_modify (&loop.pre, tmp, to);
/* Multiply the stride by the section stride to get the
total stride. */
@@ -5074,7 +5089,7 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss)
/* Store the new stride. */
tmp = gfc_conv_descriptor_stride (parm, gfc_rank_cst[dim]);
- gfc_add_modify_expr (&loop.pre, tmp, stride);
+ gfc_add_modify (&loop.pre, tmp, stride);
dim++;
}
@@ -5091,14 +5106,14 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss)
{
/* Set the offset. */
tmp = gfc_conv_descriptor_offset (parm);
- gfc_add_modify_expr (&loop.pre, tmp, base);
+ gfc_add_modify (&loop.pre, tmp, base);
}
else
{
/* Only the callee knows what the correct offset it, so just set
it to zero here. */
tmp = gfc_conv_descriptor_offset (parm);
- gfc_add_modify_expr (&loop.pre, tmp, gfc_index_zero_node);
+ gfc_add_modify (&loop.pre, tmp, gfc_index_zero_node);
}
desc = parm;
}
@@ -5124,7 +5139,8 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss)
/* TODO: Optimize passing g77 arrays. */
void
-gfc_conv_array_parameter (gfc_se * se, gfc_expr * expr, gfc_ss * ss, int g77)
+gfc_conv_array_parameter (gfc_se * se, gfc_expr * expr, gfc_ss * ss, int g77,
+ const gfc_symbol *fsym, const char *proc_name)
{
tree ptr;
tree desc;
@@ -5219,15 +5235,61 @@ gfc_conv_array_parameter (gfc_se * se, gfc_expr * expr, gfc_ss * ss, int g77)
{
desc = se->expr;
/* Repack the array. */
+
+ if (gfc_option.warn_array_temp)
+ {
+ if (fsym)
+ gfc_warning ("Creating array temporary at %L for argument '%s'",
+ &expr->where, fsym->name);
+ else
+ gfc_warning ("Creating array temporary at %L", &expr->where);
+ }
+
ptr = build_call_expr (gfor_fndecl_in_pack, 1, desc);
+
+ if (fsym && fsym->attr.optional && sym && sym->attr.optional)
+ {
+ tmp = gfc_conv_expr_present (sym);
+ ptr = build3 (COND_EXPR, TREE_TYPE (se->expr), tmp, ptr,
+ null_pointer_node);
+ }
+
ptr = gfc_evaluate_now (ptr, &se->pre);
+
se->expr = ptr;
+ if (gfc_option.flag_check_array_temporaries)
+ {
+ char * msg;
+
+ if (fsym && proc_name)
+ asprintf (&msg, "An array temporary was created for argument "
+ "'%s' of procedure '%s'", fsym->name, proc_name);
+ else
+ asprintf (&msg, "An array temporary was created");
+
+ tmp = build_fold_indirect_ref (desc);
+ tmp = gfc_conv_array_data (tmp);
+ tmp = fold_build2 (NE_EXPR, boolean_type_node,
+ fold_convert (TREE_TYPE (tmp), ptr), tmp);
+
+ if (fsym && fsym->attr.optional && sym && sym->attr.optional)
+ tmp = fold_build2 (TRUTH_AND_EXPR, boolean_type_node,
+ gfc_conv_expr_present (sym), tmp);
+
+ gfc_trans_runtime_check (false, true, tmp, &se->pre,
+ &expr->where, msg);
+ gfc_free (msg);
+ }
+
gfc_start_block (&block);
/* Copy the data back. */
- tmp = build_call_expr (gfor_fndecl_in_unpack, 2, desc, ptr);
- gfc_add_expr_to_block (&block, tmp);
+ if (fsym == NULL || fsym->attr.intent != INTENT_IN)
+ {
+ tmp = build_call_expr (gfor_fndecl_in_unpack, 2, desc, ptr);
+ gfc_add_expr_to_block (&block, tmp);
+ }
/* Free the temporary. */
tmp = gfc_call_free (convert (pvoid_type_node, ptr));
@@ -5242,6 +5304,11 @@ gfc_conv_array_parameter (gfc_se * se, gfc_expr * expr, gfc_ss * ss, int g77)
tmp = gfc_conv_array_data (tmp);
tmp = fold_build2 (NE_EXPR, boolean_type_node,
fold_convert (TREE_TYPE (tmp), ptr), tmp);
+
+ if (fsym && fsym->attr.optional && sym && sym->attr.optional)
+ tmp = fold_build2 (TRUTH_AND_EXPR, boolean_type_node,
+ gfc_conv_expr_present (sym), tmp);
+
tmp = build3_v (COND_EXPR, tmp, stmt, build_empty_stmt ());
gfc_add_expr_to_block (&block, tmp);
@@ -5521,7 +5588,7 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl,
{
rank = c->as ? c->as->rank : 0;
tmp = fold_convert (TREE_TYPE (dcmp), comp);
- gfc_add_modify_expr (&fnblock, dcmp, tmp);
+ gfc_add_modify (&fnblock, dcmp, tmp);
tmp = structure_alloc_comps (c->ts.derived, comp, dcmp,
rank, purpose);
gfc_add_expr_to_block (&fnblock, tmp);
@@ -5865,7 +5932,7 @@ gfc_walk_op_expr (gfc_ss * ss, gfc_expr * expr)
if (head == ss)
{
/* First operand is scalar. We build the chain in reverse order, so
- add the scarar SS after the second operand. */
+ add the scalar SS after the second operand. */
head = head2;
while (head && head->next != ss)
head = head->next;
diff --git a/gcc/fortran/trans-array.h b/gcc/fortran/trans-array.h
index 2b644c7880b..18de51c8437 100644
--- a/gcc/fortran/trans-array.h
+++ b/gcc/fortran/trans-array.h
@@ -32,7 +32,8 @@ void gfc_set_loop_bounds_from_array_spec (gfc_interface_mapping *,
/* Generate code to create a temporary array. */
tree gfc_trans_create_temp_array (stmtblock_t *, stmtblock_t *, gfc_loopinfo *,
- gfc_ss_info *, tree, bool, bool, bool);
+ gfc_ss_info *, tree, bool, bool, bool,
+ locus *);
/* Generate function entry code for allocation of compiler allocated array
variables. */
@@ -88,7 +89,7 @@ void gfc_trans_scalarizing_loops (gfc_loopinfo *, stmtblock_t *);
/* Mark the end of the main loop body and the start of the copying loop. */
void gfc_trans_scalarized_loop_boundary (gfc_loopinfo *, stmtblock_t *);
/* Initialize the scalarization loop parameters. */
-void gfc_conv_loop_setup (gfc_loopinfo *);
+void gfc_conv_loop_setup (gfc_loopinfo *, locus *);
/* Resolve array assignment dependencies. */
void gfc_conv_resolve_dependencies (gfc_loopinfo *, gfc_ss *, gfc_ss *);
/* Build a null array descriptor constructor. */
@@ -104,7 +105,8 @@ void gfc_conv_tmp_ref (gfc_se *);
/* Evaluate an array expression. */
void gfc_conv_expr_descriptor (gfc_se *, gfc_expr *, gfc_ss *);
/* Convert an array for passing as an actual function parameter. */
-void gfc_conv_array_parameter (gfc_se *, gfc_expr *, gfc_ss *, int);
+void gfc_conv_array_parameter (gfc_se *, gfc_expr *, gfc_ss *, int,
+ const gfc_symbol *, const char *);
/* Evaluate and transpose a matrix expression. */
void gfc_conv_array_transpose (gfc_se *, gfc_expr *);
@@ -118,11 +120,7 @@ tree gfc_conv_array_ubound (tree, int);
/* Build expressions for accessing components of an array descriptor. */
tree gfc_conv_descriptor_data_get (tree);
-void gfc_conv_descriptor_data_set_internal (stmtblock_t *, tree, tree, bool);
-#define gfc_conv_descriptor_data_set(BLOCK, T1, T2) \
- gfc_conv_descriptor_data_set_internal ((BLOCK), (T1), (T2), false)
-#define gfc_conv_descriptor_data_set_tuples(BLOCK, T1, T2) \
- gfc_conv_descriptor_data_set_internal ((BLOCK), (T1), (T2), true)
+void gfc_conv_descriptor_data_set (stmtblock_t *, tree, tree);
tree gfc_conv_descriptor_data_addr (tree);
tree gfc_conv_descriptor_offset (tree);
tree gfc_conv_descriptor_dtype (tree);
diff --git a/gcc/fortran/trans-common.c b/gcc/fortran/trans-common.c
index 5c91bf57946..8c30309b81f 100644
--- a/gcc/fortran/trans-common.c
+++ b/gcc/fortran/trans-common.c
@@ -321,10 +321,10 @@ build_field (segment_info *h, tree union_type, record_layout_info rli)
/* If this field is volatile, mark it. */
if (h->sym->attr.volatile_)
{
- tree new;
+ tree new_type;
TREE_THIS_VOLATILE (field) = 1;
- new = build_qualified_type (TREE_TYPE (field), TYPE_QUAL_VOLATILE);
- TREE_TYPE (field) = new;
+ new_type = build_qualified_type (TREE_TYPE (field), TYPE_QUAL_VOLATILE);
+ TREE_TYPE (field) = new_type;
}
h->field = field;
@@ -955,7 +955,7 @@ find_equivalence (segment_info *n)
segment list multiple times to include indirect equivalences. Since
a new segment_info can inserted at the beginning of the segment list,
depending on its offset, we have to force a final pass through the
- loop by demanding that completion sees a pass with no matches; ie.
+ loop by demanding that completion sees a pass with no matches; i.e.,
all symbols with equiv_built set and no new equivalences found. */
static void
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index e960fa026b1..1dfa05cc46f 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -26,7 +26,7 @@ along with GCC; see the file COPYING3. If not see
#include "coretypes.h"
#include "tree.h"
#include "tree-dump.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "ggc.h"
#include "toplev.h"
#include "tm.h"
@@ -79,6 +79,7 @@ tree gfor_fndecl_stop_numeric;
tree gfor_fndecl_stop_string;
tree gfor_fndecl_runtime_error;
tree gfor_fndecl_runtime_error_at;
+tree gfor_fndecl_runtime_warning_at;
tree gfor_fndecl_os_error;
tree gfor_fndecl_generate_error;
tree gfor_fndecl_set_fpe;
@@ -461,7 +462,7 @@ gfc_finish_decl (tree decl)
static void
gfc_finish_var_decl (tree decl, gfc_symbol * sym)
{
- tree new;
+ tree new_type;
/* TREE_ADDRESSABLE means the address of this variable is actually needed.
This is the equivalent of the TARGET variables.
We also need to set this if the variable is passed by reference in a
@@ -525,7 +526,7 @@ gfc_finish_var_decl (tree decl, gfc_symbol * sym)
a default initializer; this must be applied each time the variable
comes into scope it therefore need not be static. These variables
are SAVE_NONE but have an initializer. Otherwise explicitly
- intitialized variables are SAVE_IMPLICIT and explicitly saved are
+ initialized variables are SAVE_IMPLICIT and explicitly saved are
SAVE_EXPLICIT. */
if (!sym->attr.use_assoc
&& (sym->attr.save != SAVE_NONE || sym->attr.data
@@ -535,8 +536,8 @@ gfc_finish_var_decl (tree decl, gfc_symbol * sym)
if (sym->attr.volatile_)
{
TREE_THIS_VOLATILE (decl) = 1;
- new = build_qualified_type (TREE_TYPE (decl), TYPE_QUAL_VOLATILE);
- TREE_TYPE (decl) = new;
+ new_type = build_qualified_type (TREE_TYPE (decl), TYPE_QUAL_VOLATILE);
+ TREE_TYPE (decl) = new_type;
}
/* Keep variables larger than max-stack-var-size off stack. */
@@ -1584,7 +1585,7 @@ create_function_arglist (gfc_symbol * sym)
if (f->sym->attr.proc_pointer)
type = build_pointer_type (type);
- /* Build a the argument declaration. */
+ /* Build the argument declaration. */
parm = build_decl (PARM_DECL, gfc_sym_identifier (f->sym), type);
/* Fill in arg stuff. */
@@ -2455,6 +2456,10 @@ gfc_build_builtin_function_decls (void)
/* The runtime_error_at function does not return. */
TREE_THIS_VOLATILE (gfor_fndecl_runtime_error_at) = 1;
+ gfor_fndecl_runtime_warning_at =
+ gfc_build_library_function_decl (get_identifier (PREFIX("runtime_warning_at")),
+ void_type_node, -2, pchar_type_node,
+ pchar_type_node);
gfor_fndecl_generate_error =
gfc_build_library_function_decl (get_identifier (PREFIX("generate_error")),
void_type_node, 3, pvoid_type_node,
@@ -2571,7 +2576,7 @@ gfc_trans_assign_aux_var (gfc_symbol * sym, tree fnbody)
/* Set the initial value to length. See the comments in
function gfc_add_assign_aux_vars in this file. */
- gfc_add_modify_expr (&body, GFC_DECL_STRING_LEN (sym->backend_decl),
+ gfc_add_modify (&body, GFC_DECL_STRING_LEN (sym->backend_decl),
build_int_cst (NULL_TREE, -2));
gfc_add_expr_to_block (&body, fnbody);
@@ -2602,7 +2607,7 @@ gfc_trans_vla_one_sizepos (tree *tp, stmtblock_t *body)
var = gfc_create_var_np (TREE_TYPE (t), NULL);
gfc_add_decl_to_function (var);
- gfc_add_modify_expr (body, var, val);
+ gfc_add_modify (body, var, val);
if (TREE_CODE (t) == SAVE_EXPR)
TREE_OPERAND (t, 0) = var;
*tp = var;
@@ -3407,7 +3412,7 @@ gfc_generate_function_code (gfc_namespace * ns)
{
tree alternate_return;
alternate_return = gfc_get_fake_result_decl (sym, 0);
- gfc_add_modify_expr (&body, alternate_return, integer_zero_node);
+ gfc_add_modify (&body, alternate_return, integer_zero_node);
}
if (ns->entries)
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index 570e07b5a06..94b912f6d4c 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -1,6 +1,6 @@
/* Expression translation
- Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software
- Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008
+ Free Software Foundation, Inc.
Contributed by Paul Brook <paul@nowt.org>
and Steven Bosscher <s.bosscher@student.tudelft.nl>
@@ -30,7 +30,7 @@ along with GCC; see the file COPYING3. If not see
#include "ggc.h"
#include "toplev.h"
#include "real.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "langhooks.h"
#include "flags.h"
#include "gfortran.h"
@@ -115,7 +115,7 @@ gfc_make_safe_expr (gfc_se * se)
/* We need a temporary for this result. */
var = gfc_create_var (TREE_TYPE (se->expr), NULL);
- gfc_add_modify_expr (&se->pre, var, se->expr);
+ gfc_add_modify (&se->pre, var, se->expr);
se->expr = var;
}
@@ -257,7 +257,7 @@ gfc_conv_string_length (gfc_charlen * cl, stmtblock_t * pblock)
gfc_add_block_to_block (pblock, &se.pre);
if (cl->backend_decl)
- gfc_add_modify_expr (pblock, cl->backend_decl, se.expr);
+ gfc_add_modify (pblock, cl->backend_decl, se.expr);
else
cl->backend_decl = gfc_evaluate_now (se.expr, pblock);
}
@@ -328,7 +328,7 @@ gfc_conv_substring (gfc_se * se, gfc_ref * ref, int kind,
else
asprintf (&msg, "Substring out of bounds: lower bound (%%ld)"
"is less than one");
- gfc_trans_runtime_check (fault, &se->pre, where, msg,
+ gfc_trans_runtime_check (true, false, fault, &se->pre, where, msg,
fold_convert (long_integer_type_node,
start.expr));
gfc_free (msg);
@@ -344,7 +344,7 @@ gfc_conv_substring (gfc_se * se, gfc_ref * ref, int kind,
else
asprintf (&msg, "Substring out of bounds: upper bound (%%ld) "
"exceeds string length (%%ld)");
- gfc_trans_runtime_check (fault, &se->pre, where, msg,
+ gfc_trans_runtime_check (true, false, fault, &se->pre, where, msg,
fold_convert (long_integer_type_node, end.expr),
fold_convert (long_integer_type_node,
se->string_length));
@@ -395,6 +395,40 @@ gfc_conv_component_ref (gfc_se * se, gfc_ref * ref)
}
+/* This function deals with component references to components of the
+ parent type for derived type extensons. */
+static void
+conv_parent_component_references (gfc_se * se, gfc_ref * ref)
+{
+ gfc_component *c;
+ gfc_component *cmp;
+ gfc_symbol *dt;
+ gfc_ref parent;
+
+ dt = ref->u.c.sym;
+ c = ref->u.c.component;
+
+ /* Build a gfc_ref to recursively call gfc_conv_component_ref. */
+ parent.type = REF_COMPONENT;
+ parent.next = NULL;
+ parent.u.c.sym = dt;
+ parent.u.c.component = dt->components;
+
+ if (dt->attr.extension && dt->components)
+ {
+ /* Return if the component is not in the parent type. */
+ for (cmp = dt->components->next; cmp; cmp = cmp->next)
+ if (strcmp (c->name, cmp->name) == 0)
+ return;
+
+ /* Otherwise build the reference and call self. */
+ gfc_conv_component_ref (se, &parent);
+ parent.u.c.sym = dt->components->ts.derived;
+ parent.u.c.component = c;
+ conv_parent_component_references (se, &parent);
+ }
+}
+
/* Return the contents of a variable. Also handles reference/pointer
variables (all Fortran pointer references are implicit). */
@@ -561,6 +595,9 @@ gfc_conv_variable (gfc_se * se, gfc_expr * expr)
break;
case REF_COMPONENT:
+ if (ref->u.c.sym->attr.extension)
+ conv_parent_component_references (se, ref);
+
gfc_conv_component_ref (se, ref);
break;
@@ -993,7 +1030,7 @@ gfc_conv_string_tmp (gfc_se * se, tree type, tree len)
fold_build2 (MULT_EXPR, TREE_TYPE (len), len,
fold_convert (TREE_TYPE (len),
TYPE_SIZE (type))));
- gfc_add_modify_expr (&se->pre, var, tmp);
+ gfc_add_modify (&se->pre, var, tmp);
/* Free the temporary afterwards. */
tmp = gfc_call_free (convert (pvoid_type_node, var));
@@ -1079,7 +1116,7 @@ gfc_conv_expr_op (gfc_se * se, gfc_expr * expr)
checkstring = 0;
lop = 0;
- switch (expr->value.op.operator)
+ switch (expr->value.op.op)
{
case INTRINSIC_PARENTHESES:
if (expr->ts.type == BT_REAL
@@ -1460,9 +1497,9 @@ gfc_free_interface_mapping (gfc_interface_mapping * mapping)
for (sym = mapping->syms; sym; sym = nextsym)
{
nextsym = sym->next;
- gfc_free_symbol (sym->new->n.sym);
+ gfc_free_symbol (sym->new_sym->n.sym);
gfc_free_expr (sym->expr);
- gfc_free (sym->new);
+ gfc_free (sym->new_sym);
gfc_free (sym);
}
for (cl = mapping->charlens; cl; cl = nextcl)
@@ -1481,14 +1518,14 @@ static gfc_charlen *
gfc_get_interface_mapping_charlen (gfc_interface_mapping * mapping,
gfc_charlen * cl)
{
- gfc_charlen *new;
+ gfc_charlen *new_charlen;
- new = gfc_get_charlen ();
- new->next = mapping->charlens;
- new->length = gfc_copy_expr (cl->length);
+ new_charlen = gfc_get_charlen ();
+ new_charlen->next = mapping->charlens;
+ new_charlen->length = gfc_copy_expr (cl->length);
- mapping->charlens = new;
- return new;
+ mapping->charlens = new_charlen;
+ return new_charlen;
}
@@ -1509,7 +1546,7 @@ gfc_get_interface_mapping_array (stmtblock_t * block, gfc_symbol * sym,
type = gfc_get_nodesc_array_type (type, sym->as, packed);
var = gfc_create_var (type, "ifm");
- gfc_add_modify_expr (block, var, fold_convert (type, data));
+ gfc_add_modify (block, var, fold_convert (type, data));
return var;
}
@@ -1597,7 +1634,7 @@ gfc_add_interface_mapping (gfc_interface_mapping * mapping,
sm = XCNEW (gfc_interface_sym_mapping);
sm->next = mapping->syms;
sm->old = sym;
- sm->new = new_symtree;
+ sm->new_sym = new_symtree;
sm->expr = gfc_copy_expr (expr);
mapping->syms = sm;
@@ -1689,10 +1726,10 @@ gfc_finish_interface_mapping (gfc_interface_mapping * mapping,
gfc_se se;
for (sym = mapping->syms; sym; sym = sym->next)
- if (sym->new->n.sym->ts.type == BT_CHARACTER
- && !sym->new->n.sym->ts.cl->backend_decl)
+ if (sym->new_sym->n.sym->ts.type == BT_CHARACTER
+ && !sym->new_sym->n.sym->ts.cl->backend_decl)
{
- expr = sym->new->n.sym->ts.cl->length;
+ expr = sym->new_sym->n.sym->ts.cl->length;
gfc_apply_interface_mapping_to_expr (mapping, expr);
gfc_init_se (&se, NULL);
gfc_conv_expr (&se, expr);
@@ -1701,7 +1738,7 @@ gfc_finish_interface_mapping (gfc_interface_mapping * mapping,
gfc_add_block_to_block (pre, &se.pre);
gfc_add_block_to_block (post, &se.post);
- sym->new->n.sym->ts.cl->backend_decl = se.expr;
+ sym->new_sym->n.sym->ts.cl->backend_decl = se.expr;
}
}
@@ -1927,12 +1964,12 @@ gfc_apply_interface_mapping_to_expr (gfc_interface_mapping * mapping,
/* ...and to the expression's symbol, if it has one. */
/* TODO Find out why the condition on expr->symtree had to be moved into
- the loop rather than being ouside it, as originally. */
+ the loop rather than being outside it, as originally. */
for (sym = mapping->syms; sym; sym = sym->next)
if (expr->symtree && sym->old == expr->symtree->n.sym)
{
- if (sym->new->n.sym->backend_decl)
- expr->symtree = sym->new;
+ if (sym->new_sym->n.sym->backend_decl)
+ expr->symtree = sym->new_sym;
else if (sym->expr)
gfc_replace_expr (expr, gfc_copy_expr (sym->expr));
}
@@ -1964,9 +2001,9 @@ gfc_apply_interface_mapping_to_expr (gfc_interface_mapping * mapping,
for (sym = mapping->syms; sym; sym = sym->next)
if (sym->old == expr->value.function.esym)
{
- expr->value.function.esym = sym->new->n.sym;
+ expr->value.function.esym = sym->new_sym->n.sym;
gfc_map_fcn_formal_to_actual (expr, sym->expr, mapping);
- expr->value.function.esym->result = sym->new->n.sym;
+ expr->value.function.esym->result = sym->new_sym->n.sym;
}
break;
@@ -2059,7 +2096,7 @@ gfc_conv_subref_array_arg (gfc_se * parmse, gfc_expr * expr,
gfc_add_ss_to_loop (&loop, loop.temp_ss);
/* Setup the scalarizing loops. */
- gfc_conv_loop_setup (&loop);
+ gfc_conv_loop_setup (&loop, &expr->where);
/* Pass the temporary descriptor back to the caller. */
info = &loop.temp_ss->data.info;
@@ -2124,7 +2161,7 @@ gfc_conv_subref_array_arg (gfc_se * parmse, gfc_expr * expr,
gfc_conv_ss_startstride (&loop2);
/* Setup the scalarizing loops. */
- gfc_conv_loop_setup (&loop2);
+ gfc_conv_loop_setup (&loop2, &expr->where);
gfc_copy_loopinfo_to_se (&lse, &loop2);
gfc_copy_loopinfo_to_se (&rse, &loop2);
@@ -2165,7 +2202,7 @@ gfc_conv_subref_array_arg (gfc_se * parmse, gfc_expr * expr,
tmp_index = fold_build2 (MINUS_EXPR, gfc_array_index_type,
tmp_index, rse.loop->from[0]);
- gfc_add_modify_expr (&rse.loop->code[0], offset, tmp_index);
+ gfc_add_modify (&rse.loop->code[0], offset, tmp_index);
tmp_index = fold_build2 (PLUS_EXPR, gfc_array_index_type,
rse.loop->loopvar[0], offset);
@@ -2299,7 +2336,7 @@ gfc_conv_function_call (gfc_se * se, gfc_symbol * sym,
f = f || !sym->attr.always_explicit;
argss = gfc_walk_expr (arg->expr);
- gfc_conv_array_parameter (se, arg->expr, argss, f);
+ gfc_conv_array_parameter (se, arg->expr, argss, f, NULL, NULL);
}
/* TODO -- the following two lines shouldn't be necessary, but
@@ -2535,7 +2572,8 @@ gfc_conv_function_call (gfc_se * se, gfc_symbol * sym,
gfc_conv_subref_array_arg (&parmse, e, f,
fsym ? fsym->attr.intent : INTENT_INOUT);
else
- gfc_conv_array_parameter (&parmse, e, argss, f);
+ gfc_conv_array_parameter (&parmse, e, argss, f, fsym,
+ sym->name);
/* If an ALLOCATABLE dummy argument has INTENT(OUT) and is
allocated on entry, it must be deallocated. */
@@ -2691,7 +2729,7 @@ gfc_conv_function_call (gfc_se * se, gfc_symbol * sym,
{
if (se->direct_byref)
{
- /* Sometimes, too much indirection can be applied; eg. for
+ /* Sometimes, too much indirection can be applied; e.g. for
function_result = array_valued_recursive_function. */
if (TREE_TYPE (TREE_TYPE (se->expr))
&& TREE_TYPE (TREE_TYPE (TREE_TYPE (se->expr)))
@@ -2717,7 +2755,8 @@ gfc_conv_function_call (gfc_se * se, gfc_symbol * sym,
mustn't be deallocated. */
callee_alloc = sym->attr.allocatable || sym->attr.pointer;
gfc_trans_create_temp_array (&se->pre, &se->post, se->loop, info, tmp,
- false, !sym->attr.pointer, callee_alloc);
+ false, !sym->attr.pointer, callee_alloc,
+ &se->ss->expr->where);
/* Pass the temporary as the first argument. */
tmp = info->descriptor;
@@ -2835,7 +2874,8 @@ gfc_conv_function_call (gfc_se * se, gfc_symbol * sym,
tmp = gfc_conv_descriptor_data_get (info->descriptor);
tmp = fold_build2 (NE_EXPR, boolean_type_node,
tmp, info->data);
- gfc_trans_runtime_check (tmp, &se->pre, NULL, gfc_msg_fault);
+ gfc_trans_runtime_check (true, false, tmp, &se->pre, NULL,
+ gfc_msg_fault);
}
se->expr = info->descriptor;
/* Bundle in the string length. */
@@ -2892,9 +2932,9 @@ fill_with_spaces (tree start, tree type, tree size)
/* Initialize variables. */
gfc_init_block (&block);
i = gfc_create_var (sizetype, "i");
- gfc_add_modify_expr (&block, i, fold_convert (sizetype, size));
+ gfc_add_modify (&block, i, fold_convert (sizetype, size));
el = gfc_create_var (build_pointer_type (type), "el");
- gfc_add_modify_expr (&block, el, fold_convert (TREE_TYPE (el), start));
+ gfc_add_modify (&block, el, fold_convert (TREE_TYPE (el), start));
exit_label = gfc_build_label_decl (NULL_TREE);
TREE_USED (exit_label) = 1;
@@ -2910,14 +2950,14 @@ fill_with_spaces (tree start, tree type, tree size)
gfc_add_expr_to_block (&loop, tmp);
/* Assignment. */
- gfc_add_modify_expr (&loop, fold_build1 (INDIRECT_REF, type, el),
+ gfc_add_modify (&loop, fold_build1 (INDIRECT_REF, type, el),
build_int_cst (type,
lang_hooks.to_target_charset (' ')));
/* Increment loop variables. */
- gfc_add_modify_expr (&loop, i, fold_build2 (MINUS_EXPR, sizetype, i,
+ gfc_add_modify (&loop, i, fold_build2 (MINUS_EXPR, sizetype, i,
TYPE_SIZE_UNIT (type)));
- gfc_add_modify_expr (&loop, el, fold_build2 (POINTER_PLUS_EXPR,
+ gfc_add_modify (&loop, el, fold_build2 (POINTER_PLUS_EXPR,
TREE_TYPE (el), el,
TYPE_SIZE_UNIT (type)));
@@ -2986,7 +3026,7 @@ gfc_trans_string_copy (stmtblock_t * block, tree dlength, tree dest,
if (dsc != NULL_TREE && ssc != NULL_TREE
&& TREE_TYPE (dsc) == TREE_TYPE (ssc))
{
- gfc_add_modify_expr (block, dsc, ssc);
+ gfc_add_modify (block, dsc, ssc);
return;
}
@@ -3132,7 +3172,7 @@ gfc_conv_statement_function (gfc_se * se, gfc_expr * expr)
gfc_conv_expr (&lse, args->expr);
gfc_add_block_to_block (&se->pre, &lse.pre);
- gfc_add_modify_expr (&se->pre, temp_vars[n], lse.expr);
+ gfc_add_modify (&se->pre, temp_vars[n], lse.expr);
gfc_add_block_to_block (&se->pre, &lse.post);
}
@@ -3335,7 +3375,7 @@ gfc_trans_subarray_assign (tree dest, gfc_component * cm, gfc_expr * expr)
gfc_conv_ss_startstride (&loop);
/* Setup the scalarizing loops. */
- gfc_conv_loop_setup (&loop);
+ gfc_conv_loop_setup (&loop, &expr->where);
/* Setup the gfc_se structures. */
gfc_copy_loopinfo_to_se (&lse, &loop);
@@ -3417,7 +3457,7 @@ gfc_trans_subcomponent_assign (tree dest, gfc_component * cm, gfc_expr * expr)
se.want_pointer = 1;
gfc_conv_expr (&se, expr);
gfc_add_block_to_block (&block, &se.pre);
- gfc_add_modify_expr (&block, dest,
+ gfc_add_modify (&block, dest,
fold_convert (TREE_TYPE (dest), se.expr));
gfc_add_block_to_block (&block, &se.post);
}
@@ -3438,7 +3478,7 @@ gfc_trans_subcomponent_assign (tree dest, gfc_component * cm, gfc_expr * expr)
gfc_add_block_to_block (&block, &se.pre);
tmp = fold_convert (TREE_TYPE (dest), se.expr);
- gfc_add_modify_expr (&block, dest, tmp);
+ gfc_add_modify (&block, dest, tmp);
if (cm->ts.type == BT_DERIVED && cm->ts.derived->attr.alloc_comp)
tmp = gfc_copy_alloc_comp (cm->ts.derived, se.expr, dest,
@@ -3456,7 +3496,7 @@ gfc_trans_subcomponent_assign (tree dest, gfc_component * cm, gfc_expr * expr)
/* Shift the lbound and ubound of temporaries to being unity, rather
than zero, based. Calculate the offset for all cases. */
offset = gfc_conv_descriptor_offset (dest);
- gfc_add_modify_expr (&block, offset, gfc_index_zero_node);
+ gfc_add_modify (&block, offset, gfc_index_zero_node);
tmp2 =gfc_create_var (gfc_array_index_type, NULL);
for (n = 0; n < expr->rank; n++)
{
@@ -3467,21 +3507,21 @@ gfc_trans_subcomponent_assign (tree dest, gfc_component * cm, gfc_expr * expr)
tmp = gfc_conv_descriptor_ubound (dest, gfc_rank_cst[n]);
span = fold_build2 (MINUS_EXPR, gfc_array_index_type, tmp,
gfc_conv_descriptor_lbound (dest, gfc_rank_cst[n]));
- gfc_add_modify_expr (&block, tmp,
+ gfc_add_modify (&block, tmp,
fold_build2 (PLUS_EXPR,
gfc_array_index_type,
span, gfc_index_one_node));
tmp = gfc_conv_descriptor_lbound (dest, gfc_rank_cst[n]);
- gfc_add_modify_expr (&block, tmp, gfc_index_one_node);
+ gfc_add_modify (&block, tmp, gfc_index_one_node);
}
tmp = fold_build2 (MULT_EXPR, gfc_array_index_type,
gfc_conv_descriptor_lbound (dest,
gfc_rank_cst[n]),
gfc_conv_descriptor_stride (dest,
gfc_rank_cst[n]));
- gfc_add_modify_expr (&block, tmp2, tmp);
+ gfc_add_modify (&block, tmp2, tmp);
tmp = fold_build2 (MINUS_EXPR, gfc_array_index_type, offset, tmp2);
- gfc_add_modify_expr (&block, offset, tmp);
+ gfc_add_modify (&block, offset, tmp);
}
}
else
@@ -3496,7 +3536,7 @@ gfc_trans_subcomponent_assign (tree dest, gfc_component * cm, gfc_expr * expr)
{
gfc_init_se (&se, NULL);
gfc_conv_expr (&se, expr);
- gfc_add_modify_expr (&block, dest,
+ gfc_add_modify (&block, dest,
fold_convert (TREE_TYPE (dest), se.expr));
}
else
@@ -3742,7 +3782,7 @@ gfc_conv_expr_val (gfc_se * se, gfc_expr * expr)
if (se->post.head)
{
val = gfc_create_var (TREE_TYPE (se->expr), NULL);
- gfc_add_modify_expr (&se->pre, val, se->expr);
+ gfc_add_modify (&se->pre, val, se->expr);
se->expr = val;
gfc_add_block_to_block (&se->pre, &se->post);
}
@@ -3788,7 +3828,7 @@ gfc_conv_expr_reference (gfc_se * se, gfc_expr * expr)
if (se->post.head)
{
var = gfc_create_var (TREE_TYPE (se->expr), NULL);
- gfc_add_modify_expr (&se->pre, var, se->expr);
+ gfc_add_modify (&se->pre, var, se->expr);
gfc_add_block_to_block (&se->pre, &se->post);
se->expr = var;
}
@@ -3802,7 +3842,7 @@ gfc_conv_expr_reference (gfc_se * se, gfc_expr * expr)
se->want_pointer = 1;
gfc_conv_expr (se, expr);
var = gfc_create_var (TREE_TYPE (se->expr), NULL);
- gfc_add_modify_expr (&se->pre, var, se->expr);
+ gfc_add_modify (&se->pre, var, se->expr);
se->expr = var;
return;
}
@@ -3823,7 +3863,7 @@ gfc_conv_expr_reference (gfc_se * se, gfc_expr * expr)
else
{
var = gfc_create_var (TREE_TYPE (se->expr), NULL);
- gfc_add_modify_expr (&se->pre, var, se->expr);
+ gfc_add_modify (&se->pre, var, se->expr);
}
gfc_add_block_to_block (&se->pre, &se->post);
@@ -3876,7 +3916,7 @@ gfc_trans_pointer_assignment (gfc_expr * expr1, gfc_expr * expr2)
gfc_add_block_to_block (&block, &lse.pre);
gfc_add_block_to_block (&block, &rse.pre);
- gfc_add_modify_expr (&block, lse.expr,
+ gfc_add_modify (&block, lse.expr,
fold_convert (TREE_TYPE (lse.expr), rse.expr));
gfc_add_block_to_block (&block, &rse.post);
gfc_add_block_to_block (&block, &lse.post);
@@ -3909,7 +3949,7 @@ gfc_trans_pointer_assignment (gfc_expr * expr1, gfc_expr * expr2)
tmp = fold_convert (gfc_array_index_type, size_in_bytes (tmp));
if (!INTEGER_CST_P (tmp))
gfc_add_block_to_block (&lse.post, &rse.pre);
- gfc_add_modify_expr (&lse.post, GFC_DECL_SPAN(decl), tmp);
+ gfc_add_modify (&lse.post, GFC_DECL_SPAN(decl), tmp);
}
break;
@@ -3923,7 +3963,7 @@ gfc_trans_pointer_assignment (gfc_expr * expr1, gfc_expr * expr2)
lse.expr = tmp;
lse.direct_byref = 1;
gfc_conv_expr_descriptor (&lse, expr2, rss);
- gfc_add_modify_expr (&lse.pre, desc, tmp);
+ gfc_add_modify (&lse.pre, desc, tmp);
break;
}
gfc_add_block_to_block (&block, &lse.pre);
@@ -3934,7 +3974,7 @@ gfc_trans_pointer_assignment (gfc_expr * expr1, gfc_expr * expr2)
/* Makes sure se is suitable for passing as a function string parameter. */
-/* TODO: Need to check all callers fo this function. It may be abused. */
+/* TODO: Need to check all callers of this function. It may be abused. */
void
gfc_conv_string_parameter (gfc_se * se)
@@ -4035,7 +4075,7 @@ gfc_trans_scalar_assign (gfc_se * lse, gfc_se * rse, gfc_typespec ts,
gfc_add_block_to_block (&block, &rse->pre);
gfc_add_block_to_block (&block, &lse->pre);
- gfc_add_modify_expr (&block, lse->expr,
+ gfc_add_modify (&block, lse->expr,
fold_convert (TREE_TYPE (lse->expr), rse->expr));
/* Do a deep copy if the rhs is a variable, if it is not the
@@ -4052,7 +4092,7 @@ gfc_trans_scalar_assign (gfc_se * lse, gfc_se * rse, gfc_typespec ts,
gfc_add_block_to_block (&block, &lse->pre);
gfc_add_block_to_block (&block, &rse->pre);
- gfc_add_modify_expr (&block, lse->expr,
+ gfc_add_modify (&block, lse->expr,
fold_convert (TREE_TYPE (lse->expr), rse->expr));
}
@@ -4142,7 +4182,7 @@ gfc_trans_arrayfunc_assign (gfc_expr * expr1, gfc_expr * expr2)
gfc_start_block (&se.pre);
se.want_pointer = 1;
- gfc_conv_array_parameter (&se, expr1, ss, 0);
+ gfc_conv_array_parameter (&se, expr1, ss, 0, NULL, NULL);
se.direct_byref = 1;
se.ss = gfc_walk_expr (expr2);
@@ -4415,7 +4455,7 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr * expr2, bool init_flag)
/* Resolve any data dependencies in the statement. */
gfc_conv_resolve_dependencies (&loop, lss, rss);
/* Setup the scalarizing loops. */
- gfc_conv_loop_setup (&loop);
+ gfc_conv_loop_setup (&loop, &expr2->where);
/* Setup the gfc_se structures. */
gfc_copy_loopinfo_to_se (&lse, &loop);
diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c
index 31780240cd2..bbb129dbdcd 100644
--- a/gcc/fortran/trans-intrinsic.c
+++ b/gcc/fortran/trans-intrinsic.c
@@ -30,7 +30,7 @@ along with GCC; see the file COPYING3. If not see
#include "ggc.h"
#include "toplev.h"
#include "real.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "flags.h"
#include "gfortran.h"
#include "arith.h"
@@ -864,7 +864,8 @@ gfc_conv_intrinsic_bound (gfc_se * se, gfc_expr * expr, int upper)
tmp = gfc_rank_cst[GFC_TYPE_ARRAY_RANK (TREE_TYPE (desc))];
tmp = fold_build2 (GE_EXPR, boolean_type_node, bound, tmp);
cond = fold_build2 (TRUTH_ORIF_EXPR, boolean_type_node, cond, tmp);
- gfc_trans_runtime_check (cond, &se->pre, &expr->where, gfc_msg_fault);
+ gfc_trans_runtime_check (true, false, cond, &se->pre, &expr->where,
+ gfc_msg_fault);
}
}
@@ -1315,7 +1316,7 @@ gfc_conv_intrinsic_char (gfc_se * se, gfc_expr * expr)
var = gfc_create_var (type, "char");
arg[0] = fold_build1 (NOP_EXPR, type, arg[0]);
- gfc_add_modify_expr (&se->pre, var, arg[0]);
+ gfc_add_modify (&se->pre, var, arg[0]);
se->expr = gfc_build_addr_expr (build_pointer_type (type), var);
se->string_length = integer_one_node;
}
@@ -1478,7 +1479,7 @@ gfc_conv_intrinsic_minmax (gfc_se * se, gfc_expr * expr, int op)
args[0] = gfc_evaluate_now (args[0], &se->pre);
mvar = gfc_create_var (type, "M");
- gfc_add_modify_expr (&se->pre, mvar, args[0]);
+ gfc_add_modify (&se->pre, mvar, args[0]);
for (i = 1, argexpr = argexpr->next; i < nargs; i++)
{
tree cond, isnan;
@@ -1717,7 +1718,7 @@ gfc_conv_intrinsic_anyall (gfc_se * se, gfc_expr * expr, int op)
tmp = convert (type, boolean_true_node);
else
tmp = convert (type, boolean_false_node);
- gfc_add_modify_expr (&se->pre, resvar, tmp);
+ gfc_add_modify (&se->pre, resvar, tmp);
/* Walk the arguments. */
arrayss = gfc_walk_expr (actual->expr);
@@ -1731,7 +1732,7 @@ gfc_conv_intrinsic_anyall (gfc_se * se, gfc_expr * expr, int op)
/* Initialize the loop. */
gfc_conv_ss_startstride (&loop);
- gfc_conv_loop_setup (&loop);
+ gfc_conv_loop_setup (&loop, &expr->where);
gfc_mark_ss_chain_used (arrayss, 1);
/* Generate the loop body. */
@@ -1743,7 +1744,7 @@ gfc_conv_intrinsic_anyall (gfc_se * se, gfc_expr * expr, int op)
tmp = convert (type, boolean_false_node);
else
tmp = convert (type, boolean_true_node);
- gfc_add_modify_expr (&block, resvar, tmp);
+ gfc_add_modify (&block, resvar, tmp);
/* And break out of the loop. */
tmp = build1_v (GOTO_EXPR, exit_label);
@@ -1801,7 +1802,7 @@ gfc_conv_intrinsic_count (gfc_se * se, gfc_expr * expr)
type = gfc_typenode_for_spec (&expr->ts);
/* Initialize the result. */
resvar = gfc_create_var (type, "count");
- gfc_add_modify_expr (&se->pre, resvar, build_int_cst (type, 0));
+ gfc_add_modify (&se->pre, resvar, build_int_cst (type, 0));
/* Walk the arguments. */
arrayss = gfc_walk_expr (actual->expr);
@@ -1813,7 +1814,7 @@ gfc_conv_intrinsic_count (gfc_se * se, gfc_expr * expr)
/* Initialize the loop. */
gfc_conv_ss_startstride (&loop);
- gfc_conv_loop_setup (&loop);
+ gfc_conv_loop_setup (&loop, &expr->where);
gfc_mark_ss_chain_used (arrayss, 1);
/* Generate the loop body. */
@@ -1874,7 +1875,7 @@ gfc_conv_intrinsic_arith (gfc_se * se, gfc_expr * expr, int op)
else
tmp = gfc_build_const (type, integer_one_node);
- gfc_add_modify_expr (&se->pre, resvar, tmp);
+ gfc_add_modify (&se->pre, resvar, tmp);
/* Walk the arguments. */
actual = expr->value.function.actual;
@@ -1901,7 +1902,7 @@ gfc_conv_intrinsic_arith (gfc_se * se, gfc_expr * expr, int op)
/* Initialize the loop. */
gfc_conv_ss_startstride (&loop);
- gfc_conv_loop_setup (&loop);
+ gfc_conv_loop_setup (&loop, &expr->where);
gfc_mark_ss_chain_used (arrayss, 1);
if (maskss)
@@ -1931,7 +1932,7 @@ gfc_conv_intrinsic_arith (gfc_se * se, gfc_expr * expr, int op)
gfc_add_block_to_block (&block, &arrayse.pre);
tmp = fold_build2 (op, type, resvar, arrayse.expr);
- gfc_add_modify_expr (&block, resvar, tmp);
+ gfc_add_modify (&block, resvar, tmp);
gfc_add_block_to_block (&block, &arrayse.post);
if (maskss)
@@ -1998,7 +1999,7 @@ gfc_conv_intrinsic_dot_product (gfc_se * se, gfc_expr * expr)
else
tmp = gfc_build_const (type, integer_zero_node);
- gfc_add_modify_expr (&se->pre, resvar, tmp);
+ gfc_add_modify (&se->pre, resvar, tmp);
/* Walk argument #1. */
actual = expr->value.function.actual;
@@ -2019,7 +2020,7 @@ gfc_conv_intrinsic_dot_product (gfc_se * se, gfc_expr * expr)
/* Initialize the loop. */
gfc_conv_ss_startstride (&loop);
- gfc_conv_loop_setup (&loop);
+ gfc_conv_loop_setup (&loop, &expr->where);
gfc_mark_ss_chain_used (arrayss1, 1);
gfc_mark_ss_chain_used (arrayss2, 1);
@@ -2055,7 +2056,7 @@ gfc_conv_intrinsic_dot_product (gfc_se * se, gfc_expr * expr)
tmp = fold_build2 (MULT_EXPR, type, arrayse1.expr, arrayse2.expr);
tmp = fold_build2 (PLUS_EXPR, type, resvar, tmp);
}
- gfc_add_modify_expr (&block, resvar, tmp);
+ gfc_add_modify (&block, resvar, tmp);
/* Finish up the loop block and the loop. */
tmp = gfc_finish_block (&block);
@@ -2145,7 +2146,7 @@ gfc_conv_intrinsic_minmaxloc (gfc_se * se, gfc_expr * expr, int op)
possible value is HUGE in both cases. */
if (op == GT_EXPR)
tmp = fold_build1 (NEGATE_EXPR, TREE_TYPE (tmp), tmp);
- gfc_add_modify_expr (&se->pre, limit, tmp);
+ gfc_add_modify (&se->pre, limit, tmp);
if (op == GT_EXPR && expr->ts.type == BT_INTEGER)
tmp = fold_build2 (MINUS_EXPR, TREE_TYPE (tmp), tmp,
@@ -2159,14 +2160,14 @@ gfc_conv_intrinsic_minmaxloc (gfc_se * se, gfc_expr * expr, int op)
/* Initialize the loop. */
gfc_conv_ss_startstride (&loop);
- gfc_conv_loop_setup (&loop);
+ gfc_conv_loop_setup (&loop, &expr->where);
gcc_assert (loop.dimen == 1);
/* Initialize the position to zero, following Fortran 2003. We are free
to do this because Fortran 95 allows the result of an entirely false
mask to be processor dependent. */
- gfc_add_modify_expr (&loop.pre, pos, gfc_index_zero_node);
+ gfc_add_modify (&loop.pre, pos, gfc_index_zero_node);
gfc_mark_ss_chain_used (arrayss, 1);
if (maskss)
@@ -2199,7 +2200,7 @@ gfc_conv_intrinsic_minmaxloc (gfc_se * se, gfc_expr * expr, int op)
gfc_start_block (&ifblock);
/* Assign the value to the limit... */
- gfc_add_modify_expr (&ifblock, limit, arrayse.expr);
+ gfc_add_modify (&ifblock, limit, arrayse.expr);
/* Remember where we are. An offset must be added to the loop
counter to obtain the required position. */
@@ -2209,11 +2210,11 @@ gfc_conv_intrinsic_minmaxloc (gfc_se * se, gfc_expr * expr, int op)
else
tmp = build_int_cst (gfc_array_index_type, 1);
- gfc_add_modify_expr (&block, offset, tmp);
+ gfc_add_modify (&block, offset, tmp);
tmp = fold_build2 (PLUS_EXPR, TREE_TYPE (pos),
loop.loopvar[0], offset);
- gfc_add_modify_expr (&ifblock, pos, tmp);
+ gfc_add_modify (&ifblock, pos, tmp);
ifbody = gfc_finish_block (&ifblock);
@@ -2257,7 +2258,7 @@ gfc_conv_intrinsic_minmaxloc (gfc_se * se, gfc_expr * expr, int op)
the pos variable the same way as above. */
gfc_init_block (&elseblock);
- gfc_add_modify_expr (&elseblock, pos, gfc_index_zero_node);
+ gfc_add_modify (&elseblock, pos, gfc_index_zero_node);
elsetmp = gfc_finish_block (&elseblock);
tmp = build3_v (COND_EXPR, maskse.expr, tmp, elsetmp);
@@ -2328,7 +2329,7 @@ gfc_conv_intrinsic_minmaxval (gfc_se * se, gfc_expr * expr, int op)
tmp = fold_build2 (MINUS_EXPR, TREE_TYPE (tmp),
tmp, build_int_cst (type, 1));
- gfc_add_modify_expr (&se->pre, limit, tmp);
+ gfc_add_modify (&se->pre, limit, tmp);
/* Walk the arguments. */
actual = expr->value.function.actual;
@@ -2355,7 +2356,7 @@ gfc_conv_intrinsic_minmaxval (gfc_se * se, gfc_expr * expr, int op)
/* Initialize the loop. */
gfc_conv_ss_startstride (&loop);
- gfc_conv_loop_setup (&loop);
+ gfc_conv_loop_setup (&loop, &expr->where);
gfc_mark_ss_chain_used (arrayss, 1);
if (maskss)
@@ -2651,6 +2652,64 @@ gfc_conv_intrinsic_ishftc (gfc_se * se, gfc_expr * expr)
se->expr = fold_build3 (COND_EXPR, type, tmp, args[0], rrot);
}
+
+/* Process an intrinsic with unspecified argument-types that has an optional
+ argument (which could be of type character), e.g. EOSHIFT. For those, we
+ need to append the string length of the optional argument if it is not
+ present and the type is really character.
+ primary specifies the position (starting at 1) of the non-optional argument
+ specifying the type and optional gives the position of the optional
+ argument in the arglist. */
+
+static void
+conv_generic_with_optional_char_arg (gfc_se* se, gfc_expr* expr,
+ unsigned primary, unsigned optional)
+{
+ gfc_actual_arglist* prim_arg;
+ gfc_actual_arglist* opt_arg;
+ unsigned cur_pos;
+ gfc_actual_arglist* arg;
+ gfc_symbol* sym;
+ tree append_args;
+
+ /* Find the two arguments given as position. */
+ cur_pos = 0;
+ prim_arg = NULL;
+ opt_arg = NULL;
+ for (arg = expr->value.function.actual; arg; arg = arg->next)
+ {
+ ++cur_pos;
+
+ if (cur_pos == primary)
+ prim_arg = arg;
+ if (cur_pos == optional)
+ opt_arg = arg;
+
+ if (cur_pos >= primary && cur_pos >= optional)
+ break;
+ }
+ gcc_assert (prim_arg);
+ gcc_assert (prim_arg->expr);
+ gcc_assert (opt_arg);
+
+ /* If we do have type CHARACTER and the optional argument is really absent,
+ append a dummy 0 as string length. */
+ append_args = NULL_TREE;
+ if (prim_arg->expr->ts.type == BT_CHARACTER && !opt_arg->expr)
+ {
+ tree dummy;
+
+ dummy = build_int_cst (gfc_charlen_type_node, 0);
+ append_args = gfc_chainon_list (append_args, dummy);
+ }
+
+ /* Build the call itself. */
+ sym = gfc_get_symbol_for_expr (expr);
+ gfc_conv_function_call (se, sym, expr->value.function.actual, append_args);
+ gfc_free (sym);
+}
+
+
/* The length of a character string. */
static void
gfc_conv_intrinsic_len (gfc_se * se, gfc_expr * expr)
@@ -2754,7 +2813,7 @@ gfc_conv_intrinsic_index_scan_verify (gfc_se * se, gfc_expr * expr,
args = (tree *) alloca (sizeof (tree) * 5);
/* Get number of arguments; characters count double due to the
- string length argument. Kind= is not passed to the libary
+ string length argument. Kind= is not passed to the library
and thus ignored. */
if (expr->value.function.actual->next->next->expr == NULL)
num_args = 4;
@@ -3002,12 +3061,12 @@ gfc_conv_intrinsic_spacing (gfc_se * se, gfc_expr * expr)
gfc_add_expr_to_block (&block, tmp);
tmp = fold_build2 (MINUS_EXPR, integer_type_node, e, prec);
- gfc_add_modify_expr (&block, e, fold_build2 (MAX_EXPR, integer_type_node,
+ gfc_add_modify (&block, e, fold_build2 (MAX_EXPR, integer_type_node,
tmp, emin));
tmp = build_call_expr (built_in_decls[scalbn], 2,
build_real_from_int_cst (type, integer_one_node), e);
- gfc_add_modify_expr (&block, res, tmp);
+ gfc_add_modify (&block, res, tmp);
/* Finish by building the IF statement. */
cond = fold_build2 (EQ_EXPR, boolean_type_node, arg,
@@ -3070,7 +3129,7 @@ gfc_conv_intrinsic_rrspacing (gfc_se * se, gfc_expr * expr)
e = gfc_create_var (integer_type_node, NULL);
x = gfc_create_var (type, NULL);
- gfc_add_modify_expr (&se->pre, x,
+ gfc_add_modify (&se->pre, x,
build_call_expr (built_in_decls[fabs], 1, arg));
@@ -3082,7 +3141,7 @@ gfc_conv_intrinsic_rrspacing (gfc_se * se, gfc_expr * expr)
tmp = fold_build2 (MINUS_EXPR, integer_type_node,
build_int_cst (NULL_TREE, prec), e);
tmp = build_call_expr (built_in_decls[scalbn], 2, x, tmp);
- gfc_add_modify_expr (&block, x, tmp);
+ gfc_add_modify (&block, x, tmp);
stmt = gfc_finish_block (&block);
cond = fold_build2 (NE_EXPR, boolean_type_node, x,
@@ -3299,7 +3358,7 @@ gfc_conv_intrinsic_sizeof (gfc_se *se, gfc_expr *expr)
else
tmp = fold_convert (gfc_array_index_type,
size_in_bytes (type));
- gfc_add_modify_expr (&argse.pre, source_bytes, tmp);
+ gfc_add_modify (&argse.pre, source_bytes, tmp);
/* Obtain the size of the array in bytes. */
for (n = 0; n < arg->rank; n++)
@@ -3314,7 +3373,7 @@ gfc_conv_intrinsic_sizeof (gfc_se *se, gfc_expr *expr)
tmp, gfc_index_one_node);
tmp = fold_build2 (MULT_EXPR, gfc_array_index_type,
tmp, source_bytes);
- gfc_add_modify_expr (&argse.pre, source_bytes, tmp);
+ gfc_add_modify (&argse.pre, source_bytes, tmp);
}
se->expr = source_bytes;
}
@@ -3434,6 +3493,10 @@ gfc_conv_intrinsic_array_transfer (gfc_se * se, gfc_expr * expr)
&& arg->expr->ref->u.ar.type == AR_FULL))
{
tmp = build_fold_addr_expr (argse.expr);
+
+ if (gfc_option.warn_array_temp)
+ gfc_warning ("Creating array temporary at %L", &expr->where);
+
source = build_call_expr (gfor_fndecl_in_pack, 1, tmp);
source = gfc_evaluate_now (source, &argse.pre);
@@ -3468,13 +3531,13 @@ gfc_conv_intrinsic_array_transfer (gfc_se * se, gfc_expr * expr)
{
tree idx;
idx = gfc_rank_cst[n];
- gfc_add_modify_expr (&argse.pre, source_bytes, tmp);
+ gfc_add_modify (&argse.pre, source_bytes, tmp);
stride = gfc_conv_descriptor_stride (argse.expr, idx);
lower = gfc_conv_descriptor_lbound (argse.expr, idx);
upper = gfc_conv_descriptor_ubound (argse.expr, idx);
tmp = fold_build2 (MINUS_EXPR, gfc_array_index_type,
upper, lower);
- gfc_add_modify_expr (&argse.pre, extent, tmp);
+ gfc_add_modify (&argse.pre, extent, tmp);
tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type,
extent, gfc_index_one_node);
tmp = fold_build2 (MULT_EXPR, gfc_array_index_type,
@@ -3482,7 +3545,7 @@ gfc_conv_intrinsic_array_transfer (gfc_se * se, gfc_expr * expr)
}
}
- gfc_add_modify_expr (&argse.pre, source_bytes, tmp);
+ gfc_add_modify (&argse.pre, source_bytes, tmp);
gfc_add_block_to_block (&se->pre, &argse.pre);
gfc_add_block_to_block (&se->post, &argse.post);
@@ -3517,7 +3580,7 @@ gfc_conv_intrinsic_array_transfer (gfc_se * se, gfc_expr * expr)
size_in_bytes (mold_type));
dest_word_len = gfc_create_var (gfc_array_index_type, NULL);
- gfc_add_modify_expr (&se->pre, dest_word_len, tmp);
+ gfc_add_modify (&se->pre, dest_word_len, tmp);
/* Finally convert SIZE, if it is present. */
arg = arg->next;
@@ -3546,8 +3609,8 @@ gfc_conv_intrinsic_array_transfer (gfc_se * se, gfc_expr * expr)
else
tmp = source_bytes;
- gfc_add_modify_expr (&se->pre, size_bytes, tmp);
- gfc_add_modify_expr (&se->pre, size_words,
+ gfc_add_modify (&se->pre, size_bytes, tmp);
+ gfc_add_modify (&se->pre, size_words,
fold_build2 (CEIL_DIV_EXPR, gfc_array_index_type,
size_bytes, dest_word_len));
@@ -3564,8 +3627,8 @@ gfc_conv_intrinsic_array_transfer (gfc_se * se, gfc_expr * expr)
tmp, gfc_index_one_node);
tmp = fold_build2 (MIN_EXPR, gfc_array_index_type,
tmp, size_words);
- gfc_add_modify_expr (&se->pre, size_words, tmp);
- gfc_add_modify_expr (&se->pre, size_bytes,
+ gfc_add_modify (&se->pre, size_words, tmp);
+ gfc_add_modify (&se->pre, size_bytes,
fold_build2 (MULT_EXPR, gfc_array_index_type,
size_words, dest_word_len));
upper = fold_build2 (PLUS_EXPR, gfc_array_index_type,
@@ -3587,7 +3650,8 @@ gfc_conv_intrinsic_array_transfer (gfc_se * se, gfc_expr * expr)
FIXME callee_alloc is not set! */
gfc_trans_create_temp_array (&se->pre, &se->post, se->loop,
- info, mold_type, false, true, false);
+ info, mold_type, false, true, false,
+ &expr->where);
/* Cast the pointer to the result. */
tmp = gfc_conv_descriptor_data_get (info->descriptor);
@@ -3627,7 +3691,7 @@ gfc_conv_intrinsic_transfer (gfc_se * se, gfc_expr * expr)
if (ss == gfc_ss_terminator)
gfc_conv_expr_reference (&argse, arg->expr);
else
- gfc_conv_array_parameter (&argse, arg->expr, ss, 1);
+ gfc_conv_array_parameter (&argse, arg->expr, ss, 1, NULL, NULL);
gfc_add_block_to_block (&se->pre, &argse.pre);
gfc_add_block_to_block (&se->post, &argse.post);
ptr = argse.expr;
@@ -3953,7 +4017,7 @@ gfc_conv_intrinsic_repeat (gfc_se * se, gfc_expr * expr)
/* Check that NCOPIES is not negative. */
cond = fold_build2 (LT_EXPR, boolean_type_node, ncopies,
build_int_cst (ncopies_type, 0));
- gfc_trans_runtime_check (cond, &se->pre, &expr->where,
+ gfc_trans_runtime_check (true, false, cond, &se->pre, &expr->where,
"Argument NCOPIES of REPEAT intrinsic is negative "
"(its value is %lld)",
fold_convert (long_integer_type_node, ncopies));
@@ -3965,7 +4029,7 @@ gfc_conv_intrinsic_repeat (gfc_se * se, gfc_expr * expr)
build_int_cst (size_type_node, 0));
tmp = fold_build3 (COND_EXPR, ncopies_type, cond,
build_int_cst (ncopies_type, 0), ncopies);
- gfc_add_modify_expr (&se->pre, n, tmp);
+ gfc_add_modify (&se->pre, n, tmp);
ncopies = n;
/* Check that ncopies is not too large: ncopies should be less than
@@ -3985,7 +4049,7 @@ gfc_conv_intrinsic_repeat (gfc_se * se, gfc_expr * expr)
build_int_cst (size_type_node, 0));
cond = fold_build3 (COND_EXPR, boolean_type_node, tmp, boolean_false_node,
cond);
- gfc_trans_runtime_check (cond, &se->pre, &expr->where,
+ gfc_trans_runtime_check (true, false, cond, &se->pre, &expr->where,
"Argument NCOPIES of REPEAT intrinsic is too large");
/* Compute the destination length. */
@@ -4000,7 +4064,7 @@ gfc_conv_intrinsic_repeat (gfc_se * se, gfc_expr * expr)
memmove (dest + (i * slen * size), src, slen*size); */
gfc_start_block (&block);
count = gfc_create_var (ncopies_type, "count");
- gfc_add_modify_expr (&block, count, build_int_cst (ncopies_type, 0));
+ gfc_add_modify (&block, count, build_int_cst (ncopies_type, 0));
exit_label = gfc_build_label_decl (NULL_TREE);
/* Start the loop body. */
@@ -4031,7 +4095,7 @@ gfc_conv_intrinsic_repeat (gfc_se * se, gfc_expr * expr)
/* Increment count. */
tmp = fold_build2 (PLUS_EXPR, ncopies_type,
count, build_int_cst (TREE_TYPE (count), 1));
- gfc_add_modify_expr (&body, count, tmp);
+ gfc_add_modify (&body, count, tmp);
/* Build the loop. */
tmp = build1_v (LOOP_EXPR, gfc_finish_block (&body));
@@ -4089,13 +4153,13 @@ gfc_conv_intrinsic_loc (gfc_se * se, gfc_expr * expr)
if (ss == gfc_ss_terminator)
gfc_conv_expr_reference (se, arg_expr);
else
- gfc_conv_array_parameter (se, arg_expr, ss, 1);
+ gfc_conv_array_parameter (se, arg_expr, ss, 1, NULL, NULL);
se->expr= convert (gfc_get_int_type (gfc_index_integer_kind), se->expr);
/* Create a temporary variable for loc return value. Without this,
we get an error an ICE in gcc/expr.c(expand_expr_addr_expr_1). */
temp_var = gfc_create_var (gfc_get_int_type (gfc_index_integer_kind), NULL);
- gfc_add_modify_expr (&se->pre, temp_var, se->expr);
+ gfc_add_modify (&se->pre, temp_var, se->expr);
se->expr = temp_var;
}
@@ -4122,7 +4186,22 @@ gfc_conv_intrinsic_function (gfc_se * se, gfc_expr * expr)
{
if (lib == 1)
se->ignore_optional = 1;
- gfc_conv_intrinsic_funcall (se, expr);
+
+ switch (expr->value.function.isym->id)
+ {
+ case GFC_ISYM_EOSHIFT:
+ case GFC_ISYM_PACK:
+ case GFC_ISYM_RESHAPE:
+ /* For all of those the first argument specifies the type and the
+ third is optional. */
+ conv_generic_with_optional_char_arg (se, expr, 1, 3);
+ break;
+
+ default:
+ gfc_conv_intrinsic_funcall (se, expr);
+ break;
+ }
+
return;
}
}
@@ -4600,6 +4679,14 @@ gfc_conv_intrinsic_function (gfc_se * se, gfc_expr * expr)
gfc_conv_intrinsic_funcall (se, expr);
break;
+ case GFC_ISYM_EOSHIFT:
+ case GFC_ISYM_PACK:
+ case GFC_ISYM_RESHAPE:
+ /* For those, expr->rank should always be >0 and thus the if above the
+ switch should have matched. */
+ gcc_unreachable ();
+ break;
+
default:
gfc_conv_intrinsic_lib_function (se, expr);
break;
@@ -4666,7 +4753,7 @@ gfc_walk_intrinsic_libfunc (gfc_ss * ss, gfc_expr * expr)
}
-/* Returns nonzero if the specified intrinsic function call maps directly to a
+/* Returns nonzero if the specified intrinsic function call maps directly to
an external library call. Should only be used for functions that return
arrays. */
diff --git a/gcc/fortran/trans-io.c b/gcc/fortran/trans-io.c
index f210169abe0..6d63ecdf742 100644
--- a/gcc/fortran/trans-io.c
+++ b/gcc/fortran/trans-io.c
@@ -1,6 +1,6 @@
/* IO Code translation/library interface
- Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software
- Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008
+ Free Software Foundation, Inc.
Contributed by Paul Brook
This file is part of GCC.
@@ -24,7 +24,7 @@ along with GCC; see the file COPYING3. If not see
#include "system.h"
#include "coretypes.h"
#include "tree.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "ggc.h"
#include "toplev.h"
#include "real.h"
@@ -450,7 +450,7 @@ set_parameter_const (stmtblock_t *block, tree var, enum iofield type,
var, TYPE_FIELDS (TREE_TYPE (var)), NULL_TREE);
tmp = fold_build3 (COMPONENT_REF, TREE_TYPE (p->field), var, p->field,
NULL_TREE);
- gfc_add_modify_expr (block, tmp, build_int_cst (TREE_TYPE (p->field), val));
+ gfc_add_modify (block, tmp, build_int_cst (TREE_TYPE (p->field), val));
return p->mask;
}
@@ -505,7 +505,7 @@ set_parameter_value (stmtblock_t *block, tree var, enum iofield type,
var, TYPE_FIELDS (TREE_TYPE (var)), NULL_TREE);
tmp = fold_build3 (COMPONENT_REF, dest_type, var, p->field, NULL_TREE);
- gfc_add_modify_expr (block, tmp, se.expr);
+ gfc_add_modify (block, tmp, se.expr);
return p->mask;
}
@@ -535,7 +535,7 @@ set_parameter_ref (stmtblock_t *block, stmtblock_t *postblock,
/* If this is for the iostat variable initialize the
user variable to LIBERROR_OK which is zero. */
if (type == IOPARM_common_iostat)
- gfc_add_modify_expr (block, se.expr,
+ gfc_add_modify (block, se.expr,
build_int_cst (TREE_TYPE (se.expr), LIBERROR_OK));
}
else
@@ -549,13 +549,13 @@ set_parameter_ref (stmtblock_t *block, stmtblock_t *postblock,
/* If this is for the iostat variable, initialize the
user variable to LIBERROR_OK which is zero. */
if (type == IOPARM_common_iostat)
- gfc_add_modify_expr (block, tmpvar,
+ gfc_add_modify (block, tmpvar,
build_int_cst (TREE_TYPE (tmpvar), LIBERROR_OK));
addr = build_fold_addr_expr (tmpvar);
/* After the I/O operation, we set the variable from the temporary. */
tmp = convert (TREE_TYPE (se.expr), tmpvar);
- gfc_add_modify_expr (postblock, se.expr, tmp);
+ gfc_add_modify (postblock, se.expr, tmp);
}
if (p->param_type == IOPARM_ptype_common)
@@ -563,7 +563,7 @@ set_parameter_ref (stmtblock_t *block, stmtblock_t *postblock,
var, TYPE_FIELDS (TREE_TYPE (var)), NULL_TREE);
tmp = fold_build3 (COMPONENT_REF, TREE_TYPE (p->field),
var, p->field, NULL_TREE);
- gfc_add_modify_expr (block, tmp, addr);
+ gfc_add_modify (block, tmp, addr);
return p->mask;
}
@@ -668,13 +668,13 @@ set_string (stmtblock_t * block, stmtblock_t * postblock, tree var,
asprintf(&msg, "Label assigned to variable '%s' (%%ld) is not a format "
"label", e->symtree->name);
- gfc_trans_runtime_check (cond, &se.pre, &e->where, msg,
+ gfc_trans_runtime_check (true, false, cond, &se.pre, &e->where, msg,
fold_convert (long_integer_type_node, tmp));
gfc_free (msg);
- gfc_add_modify_expr (&se.pre, io,
+ gfc_add_modify (&se.pre, io,
fold_convert (TREE_TYPE (io), GFC_DECL_ASSIGN_ADDR (se.expr)));
- gfc_add_modify_expr (&se.pre, len, GFC_DECL_STRING_LEN (se.expr));
+ gfc_add_modify (&se.pre, len, GFC_DECL_STRING_LEN (se.expr));
}
else
{
@@ -688,8 +688,8 @@ set_string (stmtblock_t * block, stmtblock_t * postblock, tree var,
gcc_unreachable ();
gfc_conv_string_parameter (&se);
- gfc_add_modify_expr (&se.pre, io, fold_convert (TREE_TYPE (io), se.expr));
- gfc_add_modify_expr (&se.pre, len, se.string_length);
+ gfc_add_modify (&se.pre, io, fold_convert (TREE_TYPE (io), se.expr));
+ gfc_add_modify (&se.pre, len, se.string_length);
}
gfc_add_block_to_block (block, &se.pre);
@@ -764,10 +764,10 @@ set_internal_unit (stmtblock_t * block, stmtblock_t * post_block,
/* The cast is needed for character substrings and the descriptor
data. */
- gfc_add_modify_expr (&se.pre, io, fold_convert (TREE_TYPE (io), tmp));
- gfc_add_modify_expr (&se.pre, len,
+ gfc_add_modify (&se.pre, io, fold_convert (TREE_TYPE (io), tmp));
+ gfc_add_modify (&se.pre, len,
fold_convert (TREE_TYPE (len), se.string_length));
- gfc_add_modify_expr (&se.pre, desc, se.expr);
+ gfc_add_modify (&se.pre, desc, se.expr);
gfc_add_block_to_block (block, &se.pre);
gfc_add_block_to_block (post_block, &se.post);
@@ -865,7 +865,7 @@ set_error_locus (stmtblock_t * block, tree var, locus * where)
str = gfc_build_cstring_const (f->filename);
str = gfc_build_addr_expr (pchar_type_node, str);
- gfc_add_modify_expr (block, locus_file, str);
+ gfc_add_modify (block, locus_file, str);
line = LOCATION_LINE (where->lb->location);
set_parameter_const (block, var, IOPARM_common_line, line);
@@ -1900,7 +1900,7 @@ transfer_expr (gfc_se * se, gfc_typespec * ts, tree addr_expr, gfc_code * code);
recursive. */
static tree
-transfer_array_component (tree expr, gfc_component * cm)
+transfer_array_component (tree expr, gfc_component * cm, locus * where)
{
tree tmp;
stmtblock_t body;
@@ -1944,7 +1944,7 @@ transfer_array_component (tree expr, gfc_component * cm)
gfc_init_loopinfo (&loop);
gfc_add_ss_to_loop (&loop, ss);
gfc_conv_ss_startstride (&loop);
- gfc_conv_loop_setup (&loop);
+ gfc_conv_loop_setup (&loop, where);
gfc_mark_ss_chain_used (ss, 1);
gfc_start_scalarized_body (&loop, &body);
@@ -2089,7 +2089,7 @@ transfer_expr (gfc_se * se, gfc_typespec * ts, tree addr_expr, gfc_code * code)
if (c->dimension)
{
- tmp = transfer_array_component (tmp, c);
+ tmp = transfer_array_component (tmp, c, & code->loc);
gfc_add_expr_to_block (&se->pre, tmp);
}
else
@@ -2213,7 +2213,7 @@ gfc_trans_transfer (gfc_code * code)
/* Initialize the loop. */
gfc_conv_ss_startstride (&loop);
- gfc_conv_loop_setup (&loop);
+ gfc_conv_loop_setup (&loop, &code->expr->where);
/* The main loop body. */
gfc_mark_ss_chain_used (ss, 1);
diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c
index 6f99800a014..e559a2afcb8 100644
--- a/gcc/fortran/trans-openmp.c
+++ b/gcc/fortran/trans-openmp.c
@@ -23,7 +23,7 @@ along with GCC; see the file COPYING3. If not see
#include "system.h"
#include "coretypes.h"
#include "tree.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "ggc.h"
#include "toplev.h"
#include "real.h"
@@ -147,7 +147,7 @@ gfc_omp_clause_default_ctor (tree clause, tree decl, tree outer)
gfc_init_block (&cond_block);
- gfc_add_modify_expr (&cond_block, decl, outer);
+ gfc_add_modify (&cond_block, decl, outer);
rank = gfc_rank_cst[GFC_TYPE_ARRAY_RANK (type) - 1];
size = gfc_conv_descriptor_ubound (decl, rank);
size = fold_build2 (MINUS_EXPR, gfc_array_index_type, size,
@@ -164,11 +164,11 @@ gfc_omp_clause_default_ctor (tree clause, tree decl, tree outer)
ptr = gfc_allocate_array_with_status (&cond_block,
build_int_cst (pvoid_type_node, 0),
size, NULL);
- gfc_conv_descriptor_data_set_tuples (&cond_block, decl, ptr);
+ gfc_conv_descriptor_data_set (&cond_block, decl, ptr);
then_b = gfc_finish_block (&cond_block);
gfc_init_block (&cond_block);
- gfc_conv_descriptor_data_set_tuples (&cond_block, decl, null_pointer_node);
+ gfc_conv_descriptor_data_set (&cond_block, decl, null_pointer_node);
else_b = gfc_finish_block (&cond_block);
cond = fold_build2 (NE_EXPR, boolean_type_node,
@@ -191,7 +191,7 @@ gfc_omp_clause_copy_ctor (tree clause, tree dest, tree src)
if (! GFC_DESCRIPTOR_TYPE_P (type)
|| GFC_TYPE_ARRAY_AKIND (type) != GFC_ARRAY_ALLOCATABLE)
- return build_gimple_modify_stmt (dest, src);
+ return build2_v (MODIFY_EXPR, dest, src);
gcc_assert (OMP_CLAUSE_CODE (clause) == OMP_CLAUSE_FIRSTPRIVATE);
@@ -199,7 +199,7 @@ gfc_omp_clause_copy_ctor (tree clause, tree dest, tree src)
and copied from SRC. */
gfc_start_block (&block);
- gfc_add_modify_expr (&block, dest, src);
+ gfc_add_modify (&block, dest, src);
rank = gfc_rank_cst[GFC_TYPE_ARRAY_RANK (type) - 1];
size = gfc_conv_descriptor_ubound (dest, rank);
size = fold_build2 (MINUS_EXPR, gfc_array_index_type, size,
@@ -216,7 +216,7 @@ gfc_omp_clause_copy_ctor (tree clause, tree dest, tree src)
ptr = gfc_allocate_array_with_status (&block,
build_int_cst (pvoid_type_node, 0),
size, NULL);
- gfc_conv_descriptor_data_set_tuples (&block, dest, ptr);
+ gfc_conv_descriptor_data_set (&block, dest, ptr);
call = build_call_expr (built_in_decls[BUILT_IN_MEMCPY], 3, ptr,
fold_convert (pvoid_type_node,
gfc_conv_descriptor_data_get (src)),
@@ -236,7 +236,7 @@ gfc_omp_clause_assign_op (tree clause ATTRIBUTE_UNUSED, tree dest, tree src)
if (! GFC_DESCRIPTOR_TYPE_P (type)
|| GFC_TYPE_ARRAY_AKIND (type) != GFC_ARRAY_ALLOCATABLE)
- return build_gimple_modify_stmt (dest, src);
+ return build2_v (MODIFY_EXPR, dest, src);
/* Handle copying allocatable arrays. */
gfc_start_block (&block);
@@ -454,7 +454,7 @@ gfc_trans_omp_array_reduction (tree c, gfc_symbol *sym, locus where)
tree decl, backend_decl, stmt;
locus old_loc = gfc_current_locus;
const char *iname;
- try t;
+ gfc_try t;
decl = OMP_CLAUSE_DECL (c);
gfc_current_locus = where;
@@ -602,7 +602,7 @@ gfc_trans_omp_array_reduction (tree c, gfc_symbol *sym, locus where)
gfc_start_block (&block);
- gfc_add_modify_expr (&block, decl, outer_sym.backend_decl);
+ gfc_add_modify (&block, decl, outer_sym.backend_decl);
rank = gfc_rank_cst[GFC_TYPE_ARRAY_RANK (type) - 1];
size = gfc_conv_descriptor_ubound (decl, rank);
size = fold_build2 (MINUS_EXPR, gfc_array_index_type, size,
@@ -619,7 +619,7 @@ gfc_trans_omp_array_reduction (tree c, gfc_symbol *sym, locus where)
ptr = gfc_allocate_array_with_status (&block,
build_int_cst (pvoid_type_node, 0),
size, NULL);
- gfc_conv_descriptor_data_set_tuples (&block, decl, ptr);
+ gfc_conv_descriptor_data_set (&block, decl, ptr);
gfc_add_expr_to_block (&block, gfc_trans_assignment (e1, e2, false));
stmt = gfc_finish_block (&block);
}
@@ -969,7 +969,7 @@ gfc_trans_omp_atomic (gfc_code *code)
if (expr2->expr_type == EXPR_OP)
{
gfc_expr *e;
- switch (expr2->value.op.operator)
+ switch (expr2->value.op.op)
{
case INTRINSIC_PLUS:
op = PLUS_EXPR;
@@ -1062,7 +1062,7 @@ gfc_trans_omp_atomic (gfc_code *code)
tree accum = gfc_create_var (TREE_TYPE (rse.expr), NULL);
gfc_actual_arglist *arg;
- gfc_add_modify_stmt (&block, accum, rse.expr);
+ gfc_add_modify (&block, accum, rse.expr);
for (arg = expr2->value.function.actual->next->next; arg;
arg = arg->next)
{
@@ -1070,7 +1070,7 @@ gfc_trans_omp_atomic (gfc_code *code)
gfc_conv_expr (&rse, arg->expr);
gfc_add_block_to_block (&block, &rse.pre);
x = fold_build2 (op, TREE_TYPE (accum), accum, rse.expr);
- gfc_add_modify_stmt (&block, accum, x);
+ gfc_add_modify (&block, accum, x);
}
rse.expr = accum;
@@ -1204,11 +1204,11 @@ gfc_trans_omp_do (gfc_code *code, stmtblock_t *pblock,
/* Loop body. */
if (simple)
{
- TREE_VEC_ELT (init, i) = build2_v (GIMPLE_MODIFY_STMT, dovar, from);
+ TREE_VEC_ELT (init, i) = build2_v (MODIFY_EXPR, dovar, from);
TREE_VEC_ELT (cond, i) = fold_build2 (simple > 0 ? LE_EXPR : GE_EXPR,
boolean_type_node, dovar, to);
TREE_VEC_ELT (incr, i) = fold_build2 (PLUS_EXPR, type, dovar, step);
- TREE_VEC_ELT (incr, i) = fold_build2 (GIMPLE_MODIFY_STMT, type, dovar,
+ TREE_VEC_ELT (incr, i) = fold_build2 (MODIFY_EXPR, type, dovar,
TREE_VEC_ELT (incr, i));
}
else
@@ -1225,13 +1225,13 @@ gfc_trans_omp_do (gfc_code *code, stmtblock_t *pblock,
tmp = fold_build2 (TRUNC_DIV_EXPR, type, tmp, step);
tmp = gfc_evaluate_now (tmp, pblock);
count = gfc_create_var (type, "count");
- TREE_VEC_ELT (init, i) = build2_v (GIMPLE_MODIFY_STMT, count,
+ TREE_VEC_ELT (init, i) = build2_v (MODIFY_EXPR, count,
build_int_cst (type, 0));
TREE_VEC_ELT (cond, i) = fold_build2 (LT_EXPR, boolean_type_node,
count, tmp);
TREE_VEC_ELT (incr, i) = fold_build2 (PLUS_EXPR, type, count,
build_int_cst (type, 1));
- TREE_VEC_ELT (incr, i) = fold_build2 (GIMPLE_MODIFY_STMT, type,
+ TREE_VEC_ELT (incr, i) = fold_build2 (MODIFY_EXPR, type,
count, TREE_VEC_ELT (incr, i));
/* Initialize DOVAR. */
@@ -1260,7 +1260,7 @@ gfc_trans_omp_do (gfc_code *code, stmtblock_t *pblock,
than value after iterator increment. */
tmp = gfc_evaluate_now (step, pblock);
tmp = fold_build2 (PLUS_EXPR, type, dovar, tmp);
- tmp = fold_build2 (GIMPLE_MODIFY_STMT, type, dovar, tmp);
+ tmp = fold_build2 (MODIFY_EXPR, type, dovar, tmp);
for (c = omp_clauses; c ; c = OMP_CLAUSE_CHAIN (c))
if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_LASTPRIVATE
&& OMP_CLAUSE_DECL (c) == dovar)
@@ -1308,7 +1308,7 @@ gfc_trans_omp_do (gfc_code *code, stmtblock_t *pblock,
dovar_init = nreverse (dovar_init);
while (dovar_init)
{
- gfc_add_modify_stmt (&body, TREE_PURPOSE (dovar_init),
+ gfc_add_modify (&body, TREE_PURPOSE (dovar_init),
TREE_VALUE (dovar_init));
dovar_init = TREE_CHAIN (dovar_init);
}
@@ -1381,7 +1381,7 @@ gfc_trans_omp_parallel (gfc_code *code)
omp_clauses = gfc_trans_omp_clauses (&block, code->ext.omp_clauses,
code->loc);
stmt = gfc_trans_omp_code (code->block->next, true);
- stmt = build4_v (OMP_PARALLEL, stmt, omp_clauses, NULL, NULL);
+ stmt = build2 (OMP_PARALLEL, void_type_node, stmt, omp_clauses);
gfc_add_expr_to_block (&block, stmt);
return gfc_finish_block (&block);
}
@@ -1421,7 +1421,7 @@ gfc_trans_omp_parallel_do (gfc_code *code)
stmt = build3_v (BIND_EXPR, NULL, stmt, poplevel (1, 0, 0));
else
poplevel (0, 0, 0);
- stmt = build4_v (OMP_PARALLEL, stmt, omp_clauses, NULL, NULL);
+ stmt = build2 (OMP_PARALLEL, void_type_node, stmt, omp_clauses);
OMP_PARALLEL_COMBINED (stmt) = 1;
gfc_add_expr_to_block (&block, stmt);
return gfc_finish_block (&block);
@@ -1446,7 +1446,7 @@ gfc_trans_omp_parallel_sections (gfc_code *code)
stmt = build3_v (BIND_EXPR, NULL, stmt, poplevel (1, 0, 0));
else
poplevel (0, 0, 0);
- stmt = build4_v (OMP_PARALLEL, stmt, omp_clauses, NULL, NULL);
+ stmt = build2 (OMP_PARALLEL, void_type_node, stmt, omp_clauses);
OMP_PARALLEL_COMBINED (stmt) = 1;
gfc_add_expr_to_block (&block, stmt);
return gfc_finish_block (&block);
@@ -1471,7 +1471,7 @@ gfc_trans_omp_parallel_workshare (gfc_code *code)
stmt = build3_v (BIND_EXPR, NULL, stmt, poplevel (1, 0, 0));
else
poplevel (0, 0, 0);
- stmt = build4_v (OMP_PARALLEL, stmt, omp_clauses, NULL, NULL);
+ stmt = build2 (OMP_PARALLEL, void_type_node, stmt, omp_clauses);
OMP_PARALLEL_COMBINED (stmt) = 1;
gfc_add_expr_to_block (&block, stmt);
return gfc_finish_block (&block);
@@ -1503,7 +1503,7 @@ gfc_trans_omp_sections (gfc_code *code, gfc_omp_clauses *clauses)
}
stmt = gfc_finish_block (&body);
- stmt = build3_v (OMP_SECTIONS, stmt, omp_clauses, NULL_TREE);
+ stmt = build2 (OMP_SECTIONS, void_type_node, stmt, omp_clauses);
gfc_add_expr_to_block (&block, stmt);
return gfc_finish_block (&block);
@@ -1522,16 +1522,13 @@ static tree
gfc_trans_omp_task (gfc_code *code)
{
stmtblock_t block;
- tree stmt, body_stmt, omp_clauses;
+ tree stmt, omp_clauses;
gfc_start_block (&block);
omp_clauses = gfc_trans_omp_clauses (&block, code->ext.omp_clauses,
code->loc);
- body_stmt = gfc_trans_omp_code (code->block->next, true);
- stmt = make_node (OMP_TASK);
- TREE_TYPE (stmt) = void_type_node;
- OMP_TASK_CLAUSES (stmt) = omp_clauses;
- OMP_TASK_BODY (stmt) = body_stmt;
+ stmt = gfc_trans_omp_code (code->block->next, true);
+ stmt = build2 (OMP_TASK, void_type_node, stmt, omp_clauses);
gfc_add_expr_to_block (&block, stmt);
return gfc_finish_block (&block);
}
diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c
index 6afac5d3734..bf4305ba9c3 100644
--- a/gcc/fortran/trans-stmt.c
+++ b/gcc/fortran/trans-stmt.c
@@ -25,7 +25,7 @@ along with GCC; see the file COPYING3. If not see
#include "system.h"
#include "coretypes.h"
#include "tree.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "ggc.h"
#include "toplev.h"
#include "real.h"
@@ -127,8 +127,8 @@ gfc_trans_label_assign (gfc_code * code)
label_tree = gfc_build_addr_expr (pvoid_type_node, label_tree);
}
- gfc_add_modify_expr (&se.pre, len, len_tree);
- gfc_add_modify_expr (&se.pre, addr, label_tree);
+ gfc_add_modify (&se.pre, len, len_tree);
+ gfc_add_modify (&se.pre, addr, label_tree);
return gfc_finish_block (&se.pre);
}
@@ -154,7 +154,7 @@ gfc_trans_goto (gfc_code * code)
tmp = GFC_DECL_STRING_LEN (se.expr);
tmp = fold_build2 (NE_EXPR, boolean_type_node, tmp,
build_int_cst (TREE_TYPE (tmp), -1));
- gfc_trans_runtime_check (tmp, &se.pre, &loc,
+ gfc_trans_runtime_check (true, false, tmp, &se.pre, &loc,
"Assigned label is not a target label");
assigned_goto = GFC_DECL_ASSIGN_ADDR (se.expr);
@@ -180,7 +180,7 @@ gfc_trans_goto (gfc_code * code)
code = code->block;
}
while (code != NULL);
- gfc_trans_runtime_check (boolean_true_node, &se.pre, &loc,
+ gfc_trans_runtime_check (true, false, boolean_true_node, &se.pre, &loc,
"Assigned label is not in the list");
return gfc_finish_block (&se.pre);
@@ -269,10 +269,11 @@ gfc_conv_elemental_dependencies (gfc_se * se, gfc_se * loopse,
tmp = gfc_typenode_for_spec (&e->ts);
tmp = gfc_trans_create_temp_array (&se->pre, &se->post,
&tmp_loop, info, tmp,
- false, true, false);
- gfc_add_modify_expr (&se->pre, size, tmp);
+ false, true, false,
+ & arg->expr->where);
+ gfc_add_modify (&se->pre, size, tmp);
tmp = fold_convert (pvoid_type_node, info->data);
- gfc_add_modify_expr (&se->pre, data, tmp);
+ gfc_add_modify (&se->pre, data, tmp);
gfc_merge_block_scope (&block);
/* Obtain the argument descriptor for unpacking. */
@@ -293,7 +294,7 @@ gfc_conv_elemental_dependencies (gfc_se * se, gfc_se * loopse,
offset, tmp);
}
info->offset = gfc_create_var (gfc_array_index_type, NULL);
- gfc_add_modify_expr (&se->pre, info->offset, offset);
+ gfc_add_modify (&se->pre, info->offset, offset);
/* Copy the result back using unpack. */
tmp = build_call_expr (gfor_fndecl_in_unpack, 2, parmse.expr, data);
@@ -348,7 +349,7 @@ gfc_trans_call (gfc_code * code, bool dependency_check)
se.expr = convert (gfc_typenode_for_spec (&sym->ts), se.expr);
if (sym->backend_decl == NULL)
sym->backend_decl = gfc_get_symbol_decl (sym);
- gfc_add_modify_expr (&se.pre, sym->backend_decl, se.expr);
+ gfc_add_modify (&se.pre, sym->backend_decl, se.expr);
}
else
gfc_add_expr_to_block (&se.pre, se.expr);
@@ -375,7 +376,7 @@ gfc_trans_call (gfc_code * code, bool dependency_check)
gfc_add_ss_to_loop (&loop, ss);
gfc_conv_ss_startstride (&loop);
- gfc_conv_loop_setup (&loop);
+ gfc_conv_loop_setup (&loop, &code->expr->where);
gfc_mark_ss_chain_used (ss, 1);
/* Convert the arguments, checking for dependencies. */
@@ -733,7 +734,7 @@ gfc_trans_simple_do (gfc_code * code, stmtblock_t *pblock, tree dovar,
type = TREE_TYPE (dovar);
/* Initialize the DO variable: dovar = from. */
- gfc_add_modify_expr (pblock, dovar, from);
+ gfc_add_modify (pblock, dovar, from);
/* Cycle and exit statements are implemented with gotos. */
cycle_label = gfc_build_label_decl (NULL_TREE);
@@ -762,7 +763,7 @@ gfc_trans_simple_do (gfc_code * code, stmtblock_t *pblock, tree dovar,
/* Increment the loop variable. */
tmp = fold_build2 (PLUS_EXPR, type, dovar, step);
- gfc_add_modify_expr (&body, dovar, tmp);
+ gfc_add_modify (&body, dovar, tmp);
/* The loop exit. */
tmp = build1_v (GOTO_EXPR, exit_label);
@@ -910,7 +911,7 @@ gfc_trans_do (gfc_code * code)
tmp = fold_build1 (FIX_TRUNC_EXPR, utype, tmp);
}
countm1 = gfc_create_var (utype, "countm1");
- gfc_add_modify_expr (&block, countm1, tmp);
+ gfc_add_modify (&block, countm1, tmp);
/* Cycle and exit statements are implemented with gotos. */
cycle_label = gfc_build_label_decl (NULL_TREE);
@@ -918,7 +919,7 @@ gfc_trans_do (gfc_code * code)
TREE_USED (exit_label) = 1;
/* Initialize the DO variable: dovar = from. */
- gfc_add_modify_expr (&block, dovar, from);
+ gfc_add_modify (&block, dovar, from);
/* If the loop is empty, go directly to the exit label. */
tmp = fold_build3 (COND_EXPR, void_type_node, empty,
@@ -948,7 +949,7 @@ gfc_trans_do (gfc_code * code)
/* Increment the loop variable. */
tmp = fold_build2 (PLUS_EXPR, type, dovar, step);
- gfc_add_modify_expr (&body, dovar, tmp);
+ gfc_add_modify (&body, dovar, tmp);
/* End with the loop condition. Loop until countm1 == 0. */
cond = fold_build2 (EQ_EXPR, boolean_type_node, countm1,
@@ -960,7 +961,7 @@ gfc_trans_do (gfc_code * code)
/* Decrement the loop count. */
tmp = fold_build2 (MINUS_EXPR, utype, countm1, build_int_cst (utype, 1));
- gfc_add_modify_expr (&body, countm1, tmp);
+ gfc_add_modify (&body, countm1, tmp);
/* End of loop body. */
tmp = gfc_finish_block (&body);
@@ -1478,7 +1479,7 @@ gfc_trans_character_select (gfc_code *code)
tmp = build_call_expr (fndecl, 4, init, build_int_cst (NULL_TREE, n),
se.expr, se.string_length);
case_num = gfc_create_var (integer_type_node, "case_num");
- gfc_add_modify_expr (&block, case_num, tmp);
+ gfc_add_modify (&block, case_num, tmp);
gfc_add_block_to_block (&block, &se.post);
@@ -1608,7 +1609,7 @@ forall_make_variable_temp (gfc_code *c, stmtblock_t *pre, stmtblock_t *post)
{
/* Use the variable offset for the temporary. */
tmp = gfc_conv_descriptor_offset (tse.expr);
- gfc_add_modify_expr (pre, tmp,
+ gfc_add_modify (pre, tmp,
gfc_conv_array_offset (old_sym->backend_decl));
}
}
@@ -1764,7 +1765,7 @@ gfc_trans_forall_loop (forall_info *forall_tmp, tree body,
/* Initialize the mask index outside the FORALL nest. */
if (mask_flag && forall_tmp->mask)
- gfc_add_modify_expr (outer, forall_tmp->maskindex, gfc_index_zero_node);
+ gfc_add_modify (outer, forall_tmp->maskindex, gfc_index_zero_node);
iter = forall_tmp->this_loop;
nvar = forall_tmp->nvar;
@@ -1797,7 +1798,7 @@ gfc_trans_forall_loop (forall_info *forall_tmp, tree body,
/* Increment the loop variable. */
tmp = fold_build2 (PLUS_EXPR, TREE_TYPE (var), var, step);
- gfc_add_modify_expr (&block, var, tmp);
+ gfc_add_modify (&block, var, tmp);
/* Advance to the next mask element. Only do this for the
innermost loop. */
@@ -1806,26 +1807,26 @@ gfc_trans_forall_loop (forall_info *forall_tmp, tree body,
tree maskindex = forall_tmp->maskindex;
tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type,
maskindex, gfc_index_one_node);
- gfc_add_modify_expr (&block, maskindex, tmp);
+ gfc_add_modify (&block, maskindex, tmp);
}
/* Decrement the loop counter. */
tmp = fold_build2 (MINUS_EXPR, TREE_TYPE (var), count,
build_int_cst (TREE_TYPE (var), 1));
- gfc_add_modify_expr (&block, count, tmp);
+ gfc_add_modify (&block, count, tmp);
body = gfc_finish_block (&block);
/* Loop var initialization. */
gfc_init_block (&block);
- gfc_add_modify_expr (&block, var, start);
+ gfc_add_modify (&block, var, start);
/* Initialize the loop counter. */
tmp = fold_build2 (MINUS_EXPR, TREE_TYPE (var), step, start);
tmp = fold_build2 (PLUS_EXPR, TREE_TYPE (var), end, tmp);
tmp = fold_build2 (TRUNC_DIV_EXPR, TREE_TYPE (var), tmp, step);
- gfc_add_modify_expr (&block, count, tmp);
+ gfc_add_modify (&block, count, tmp);
/* The loop expression. */
tmp = build1_v (LOOP_EXPR, body);
@@ -1917,7 +1918,7 @@ gfc_do_allocate (tree bytesize, tree size, tree * pdata, stmtblock_t * pblock,
*pdata = convert (pvoid_type_node, tmpvar);
tmp = gfc_call_malloc (pblock, TREE_TYPE (tmpvar), bytesize);
- gfc_add_modify_expr (pblock, tmpvar, tmp);
+ gfc_add_modify (pblock, tmpvar, tmp);
}
return tmpvar;
}
@@ -1953,13 +1954,13 @@ generate_loop_for_temp_to_lhs (gfc_expr *expr, tree tmp1, tree count3,
/* Use the scalar assignment as is. */
gfc_add_block_to_block (&block, &lse.pre);
- gfc_add_modify_expr (&block, lse.expr, tmp);
+ gfc_add_modify (&block, lse.expr, tmp);
gfc_add_block_to_block (&block, &lse.post);
/* Increment the count1. */
tmp = fold_build2 (PLUS_EXPR, TREE_TYPE (count1), count1,
gfc_index_one_node);
- gfc_add_modify_expr (&block, count1, tmp);
+ gfc_add_modify (&block, count1, tmp);
tmp = gfc_finish_block (&block);
}
@@ -1977,7 +1978,7 @@ generate_loop_for_temp_to_lhs (gfc_expr *expr, tree tmp1, tree count3,
/* Calculate the bounds of the scalarization. */
gfc_conv_ss_startstride (&loop1);
/* Setup the scalarizing loops. */
- gfc_conv_loop_setup (&loop1);
+ gfc_conv_loop_setup (&loop1, &expr->where);
gfc_mark_ss_chain_used (lss, 1);
@@ -2015,14 +2016,14 @@ generate_loop_for_temp_to_lhs (gfc_expr *expr, tree tmp1, tree count3,
/* Increment count1. */
tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type,
count1, gfc_index_one_node);
- gfc_add_modify_expr (&body, count1, tmp);
+ gfc_add_modify (&body, count1, tmp);
/* Increment count3. */
if (count3)
{
tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type,
count3, gfc_index_one_node);
- gfc_add_modify_expr (&body, count3, tmp);
+ gfc_add_modify (&body, count3, tmp);
}
/* Generate the copying loops. */
@@ -2075,7 +2076,7 @@ generate_loop_for_rhs_to_temp (gfc_expr *expr2, tree tmp1, tree count3,
gfc_add_ss_to_loop (&loop, rss);
gfc_conv_ss_startstride (&loop);
- gfc_conv_loop_setup (&loop);
+ gfc_conv_loop_setup (&loop, &expr2->where);
gfc_mark_ss_chain_used (rss, 1);
/* Start the loop body. */
@@ -2116,21 +2117,21 @@ generate_loop_for_rhs_to_temp (gfc_expr *expr2, tree tmp1, tree count3,
/* Increment count1. */
tmp = fold_build2 (PLUS_EXPR, TREE_TYPE (count1), count1,
gfc_index_one_node);
- gfc_add_modify_expr (&block, count1, tmp);
+ gfc_add_modify (&block, count1, tmp);
}
else
{
/* Increment count1. */
tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type,
count1, gfc_index_one_node);
- gfc_add_modify_expr (&body1, count1, tmp);
+ gfc_add_modify (&body1, count1, tmp);
/* Increment count3. */
if (count3)
{
tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type,
count3, gfc_index_one_node);
- gfc_add_modify_expr (&body1, count3, tmp);
+ gfc_add_modify (&body1, count3, tmp);
}
/* Generate the copying loops. */
@@ -2197,7 +2198,7 @@ compute_inner_temp_size (gfc_expr *expr1, gfc_expr *expr2,
flag_bounds_check = 0;
gfc_conv_ss_startstride (&loop);
flag_bounds_check = save_flag;
- gfc_conv_loop_setup (&loop);
+ gfc_conv_loop_setup (&loop, &expr2->where);
/* Figure out how many elements we need. */
for (i = 0; i < loop.dimen; i++)
@@ -2256,7 +2257,7 @@ compute_overall_iter_number (forall_info *nested_forall_info, tree inner_size,
/* Otherwise, create a temporary variable to compute the result. */
number = gfc_create_var (gfc_array_index_type, "num");
- gfc_add_modify_expr (block, number, gfc_index_zero_node);
+ gfc_add_modify (block, number, gfc_index_zero_node);
gfc_start_block (&body);
if (inner_size_body)
@@ -2266,7 +2267,7 @@ compute_overall_iter_number (forall_info *nested_forall_info, tree inner_size,
number, inner_size);
else
tmp = inner_size;
- gfc_add_modify_expr (&body, number, tmp);
+ gfc_add_modify (&body, number, tmp);
tmp = gfc_finish_block (&body);
/* Generate loops. */
@@ -2377,13 +2378,13 @@ gfc_trans_assign_need_temp (gfc_expr * expr1, gfc_expr * expr2,
if (wheremask)
{
count = gfc_create_var (gfc_array_index_type, "count");
- gfc_add_modify_expr (block, count, gfc_index_zero_node);
+ gfc_add_modify (block, count, gfc_index_zero_node);
}
else
count = NULL;
/* Initialize count1. */
- gfc_add_modify_expr (block, count1, gfc_index_zero_node);
+ gfc_add_modify (block, count1, gfc_index_zero_node);
/* Calculate the size of temporary needed in the assignment. Return loop, lss
and rss which are used in function generate_loop_for_rhs_to_temp(). */
@@ -2422,11 +2423,11 @@ gfc_trans_assign_need_temp (gfc_expr * expr1, gfc_expr * expr2,
gfc_add_expr_to_block (block, tmp);
/* Reset count1. */
- gfc_add_modify_expr (block, count1, gfc_index_zero_node);
+ gfc_add_modify (block, count1, gfc_index_zero_node);
/* Reset count. */
if (wheremask)
- gfc_add_modify_expr (block, count, gfc_index_zero_node);
+ gfc_add_modify (block, count, gfc_index_zero_node);
/* Generate codes to copy the temporary to lhs. */
tmp = generate_loop_for_temp_to_lhs (expr1, tmp1, count, count1,
@@ -2468,7 +2469,7 @@ gfc_trans_pointer_assign_need_temp (gfc_expr * expr1, gfc_expr * expr2,
tree tmp, tmp1, ptemp1;
count = gfc_create_var (gfc_array_index_type, "count");
- gfc_add_modify_expr (block, count, gfc_index_zero_node);
+ gfc_add_modify (block, count, gfc_index_zero_node);
inner_size = integer_one_node;
lss = gfc_walk_expr (expr1);
@@ -2489,14 +2490,14 @@ gfc_trans_pointer_assign_need_temp (gfc_expr * expr1, gfc_expr * expr2,
rse.want_pointer = 1;
gfc_conv_expr (&rse, expr2);
gfc_add_block_to_block (&body, &rse.pre);
- gfc_add_modify_expr (&body, lse.expr,
+ gfc_add_modify (&body, lse.expr,
fold_convert (TREE_TYPE (lse.expr), rse.expr));
gfc_add_block_to_block (&body, &rse.post);
/* Increment count. */
tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type,
count, gfc_index_one_node);
- gfc_add_modify_expr (&body, count, tmp);
+ gfc_add_modify (&body, count, tmp);
tmp = gfc_finish_block (&body);
@@ -2506,7 +2507,7 @@ gfc_trans_pointer_assign_need_temp (gfc_expr * expr1, gfc_expr * expr2,
gfc_add_expr_to_block (block, tmp);
/* Reset count. */
- gfc_add_modify_expr (block, count, gfc_index_zero_node);
+ gfc_add_modify (block, count, gfc_index_zero_node);
gfc_start_block (&body);
gfc_init_se (&lse, NULL);
@@ -2515,12 +2516,12 @@ gfc_trans_pointer_assign_need_temp (gfc_expr * expr1, gfc_expr * expr2,
lse.want_pointer = 1;
gfc_conv_expr (&lse, expr1);
gfc_add_block_to_block (&body, &lse.pre);
- gfc_add_modify_expr (&body, lse.expr, rse.expr);
+ gfc_add_modify (&body, lse.expr, rse.expr);
gfc_add_block_to_block (&body, &lse.post);
/* Increment count. */
tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type,
count, gfc_index_one_node);
- gfc_add_modify_expr (&body, count, tmp);
+ gfc_add_modify (&body, count, tmp);
tmp = gfc_finish_block (&body);
/* Generate body and loops according to the information in
@@ -2538,7 +2539,7 @@ gfc_trans_pointer_assign_need_temp (gfc_expr * expr1, gfc_expr * expr2,
/* Setup the scalarizing loops and bounds. */
gfc_conv_ss_startstride (&loop);
- gfc_conv_loop_setup (&loop);
+ gfc_conv_loop_setup (&loop, &expr2->where);
info = &rss->data.info;
desc = info->descriptor;
@@ -2565,7 +2566,7 @@ gfc_trans_pointer_assign_need_temp (gfc_expr * expr1, gfc_expr * expr2,
/* Increment count. */
tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type,
count, gfc_index_one_node);
- gfc_add_modify_expr (&body, count, tmp);
+ gfc_add_modify (&body, count, tmp);
tmp = gfc_finish_block (&body);
@@ -2575,13 +2576,13 @@ gfc_trans_pointer_assign_need_temp (gfc_expr * expr1, gfc_expr * expr2,
gfc_add_expr_to_block (block, tmp);
/* Reset count. */
- gfc_add_modify_expr (block, count, gfc_index_zero_node);
+ gfc_add_modify (block, count, gfc_index_zero_node);
parm = gfc_build_array_ref (tmp1, count, NULL);
lss = gfc_walk_expr (expr1);
gfc_init_se (&lse, NULL);
gfc_conv_expr_descriptor (&lse, expr1, lss);
- gfc_add_modify_expr (&lse.pre, lse.expr, parm);
+ gfc_add_modify (&lse.pre, lse.expr, parm);
gfc_start_block (&body);
gfc_add_block_to_block (&body, &lse.pre);
gfc_add_block_to_block (&body, &lse.post);
@@ -2589,7 +2590,7 @@ gfc_trans_pointer_assign_need_temp (gfc_expr * expr1, gfc_expr * expr2,
/* Increment count. */
tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type,
count, gfc_index_one_node);
- gfc_add_modify_expr (&body, count, tmp);
+ gfc_add_modify (&body, count, tmp);
tmp = gfc_finish_block (&body);
@@ -2821,7 +2822,7 @@ gfc_trans_forall_1 (gfc_code * code, forall_info * nested_forall_info)
/* As the mask array can be very big, prefer compact boolean types. */
tree mask_type = gfc_get_logical_type (gfc_logical_kinds[0].kind);
- gfc_add_modify_expr (&block, maskindex, gfc_index_zero_node);
+ gfc_add_modify (&block, maskindex, gfc_index_zero_node);
/* Start of mask assignment loop body. */
gfc_start_block (&body);
@@ -2835,12 +2836,12 @@ gfc_trans_forall_1 (gfc_code * code, forall_info * nested_forall_info)
se.expr = convert (mask_type, se.expr);
tmp = gfc_build_array_ref (mask, maskindex, NULL);
- gfc_add_modify_expr (&body, tmp, se.expr);
+ gfc_add_modify (&body, tmp, se.expr);
/* Advance to the next mask element. */
tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type,
maskindex, gfc_index_one_node);
- gfc_add_modify_expr (&body, maskindex, tmp);
+ gfc_add_modify (&body, maskindex, tmp);
/* Generate the loops. */
tmp = gfc_finish_block (&body);
@@ -2998,7 +2999,7 @@ gfc_evaluate_where_mask (gfc_expr * me, forall_info * nested_forall_info,
/* Variable to index the temporary. */
count = gfc_create_var (gfc_array_index_type, "count");
/* Initialize count. */
- gfc_add_modify_expr (block, count, gfc_index_zero_node);
+ gfc_add_modify (block, count, gfc_index_zero_node);
gfc_start_block (&body);
@@ -3019,7 +3020,7 @@ gfc_evaluate_where_mask (gfc_expr * me, forall_info * nested_forall_info,
gfc_add_ss_to_loop (&loop, rss);
gfc_conv_ss_startstride (&loop);
- gfc_conv_loop_setup (&loop);
+ gfc_conv_loop_setup (&loop, &me->where);
gfc_mark_ss_chain_used (rss, 1);
/* Start the loop body. */
@@ -3040,14 +3041,14 @@ gfc_evaluate_where_mask (gfc_expr * me, forall_info * nested_forall_info,
gfc_add_block_to_block (&body1, &lse.pre);
gfc_add_block_to_block (&body1, &rse.pre);
- gfc_add_modify_expr (&body1, cond, fold_convert (mask_type, rse.expr));
+ gfc_add_modify (&body1, cond, fold_convert (mask_type, rse.expr));
if (mask && (cmask || pmask))
{
tmp = gfc_build_array_ref (mask, count, NULL);
if (invert)
tmp = fold_build1 (TRUTH_NOT_EXPR, mask_type, tmp);
- gfc_add_modify_expr (&body1, mtmp, tmp);
+ gfc_add_modify (&body1, mtmp, tmp);
}
if (cmask)
@@ -3056,7 +3057,7 @@ gfc_evaluate_where_mask (gfc_expr * me, forall_info * nested_forall_info,
tmp = cond;
if (mask)
tmp = fold_build2 (TRUTH_AND_EXPR, mask_type, mtmp, tmp);
- gfc_add_modify_expr (&body1, tmp1, tmp);
+ gfc_add_modify (&body1, tmp1, tmp);
}
if (pmask)
@@ -3065,7 +3066,7 @@ gfc_evaluate_where_mask (gfc_expr * me, forall_info * nested_forall_info,
tmp = fold_build1 (TRUTH_NOT_EXPR, mask_type, cond);
if (mask)
tmp = fold_build2 (TRUTH_AND_EXPR, mask_type, mtmp, tmp);
- gfc_add_modify_expr (&body1, tmp1, tmp);
+ gfc_add_modify (&body1, tmp1, tmp);
}
gfc_add_block_to_block (&body1, &lse.post);
@@ -3080,7 +3081,7 @@ gfc_evaluate_where_mask (gfc_expr * me, forall_info * nested_forall_info,
/* Increment count. */
tmp1 = fold_build2 (PLUS_EXPR, gfc_array_index_type, count,
gfc_index_one_node);
- gfc_add_modify_expr (&body1, count, tmp1);
+ gfc_add_modify (&body1, count, tmp1);
/* Generate the copying loops. */
gfc_trans_scalarizing_loops (&loop, &body1);
@@ -3186,7 +3187,7 @@ gfc_trans_where_assign (gfc_expr *expr1, gfc_expr *expr2,
gfc_conv_resolve_dependencies (&loop, lss_section, rss);
/* Setup the scalarizing loops. */
- gfc_conv_loop_setup (&loop);
+ gfc_conv_loop_setup (&loop, &expr2->where);
/* Setup the gfc_se structures. */
gfc_copy_loopinfo_to_se (&lse, &loop);
@@ -3241,7 +3242,7 @@ gfc_trans_where_assign (gfc_expr *expr1, gfc_expr *expr2,
/* Increment count1. */
tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type,
count1, gfc_index_one_node);
- gfc_add_modify_expr (&body, count1, tmp);
+ gfc_add_modify (&body, count1, tmp);
/* Use the scalar assignment as is. */
gfc_add_block_to_block (&block, &body);
@@ -3257,7 +3258,7 @@ gfc_trans_where_assign (gfc_expr *expr1, gfc_expr *expr2,
expression. */
tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type,
count1, gfc_index_one_node);
- gfc_add_modify_expr (&body, count1, tmp);
+ gfc_add_modify (&body, count1, tmp);
gfc_trans_scalarized_loop_boundary (&loop, &body);
/* We need to copy the temporary to the actual lhs. */
@@ -3291,14 +3292,14 @@ gfc_trans_where_assign (gfc_expr *expr1, gfc_expr *expr2,
/* Increment count2. */
tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type,
count2, gfc_index_one_node);
- gfc_add_modify_expr (&body, count2, tmp);
+ gfc_add_modify (&body, count2, tmp);
}
else
{
/* Increment count1. */
tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type,
count1, gfc_index_one_node);
- gfc_add_modify_expr (&body, count1, tmp);
+ gfc_add_modify (&body, count1, tmp);
}
/* Generate the copying loops. */
@@ -3491,8 +3492,8 @@ gfc_trans_where_2 (gfc_code * code, tree mask, bool invert,
/* Variables to control maskexpr. */
count1 = gfc_create_var (gfc_array_index_type, "count1");
count2 = gfc_create_var (gfc_array_index_type, "count2");
- gfc_add_modify_expr (block, count1, gfc_index_zero_node);
- gfc_add_modify_expr (block, count2, gfc_index_zero_node);
+ gfc_add_modify (block, count1, gfc_index_zero_node);
+ gfc_add_modify (block, count2, gfc_index_zero_node);
tmp = gfc_trans_where_assign (expr1, expr2,
cmask, invert,
@@ -3509,8 +3510,8 @@ gfc_trans_where_2 (gfc_code * code, tree mask, bool invert,
/* Variables to control maskexpr. */
count1 = gfc_create_var (gfc_array_index_type, "count1");
count2 = gfc_create_var (gfc_array_index_type, "count2");
- gfc_add_modify_expr (block, count1, gfc_index_zero_node);
- gfc_add_modify_expr (block, count2, gfc_index_zero_node);
+ gfc_add_modify (block, count1, gfc_index_zero_node);
+ gfc_add_modify (block, count2, gfc_index_zero_node);
tmp = gfc_trans_where_assign (expr1, expr2,
cmask, invert,
@@ -3634,7 +3635,7 @@ gfc_trans_where_3 (gfc_code * cblock, gfc_code * eblock)
}
gfc_conv_ss_startstride (&loop);
- gfc_conv_loop_setup (&loop);
+ gfc_conv_loop_setup (&loop, &tdst->where);
gfc_mark_ss_chain_used (css, 1);
gfc_mark_ss_chain_used (tdss, 1);
@@ -3892,7 +3893,7 @@ gfc_trans_allocate (gfc_code * code)
gfc_init_se (&se, NULL);
gfc_conv_expr_lhs (&se, code->expr);
tmp = convert (TREE_TYPE (se.expr), stat);
- gfc_add_modify_expr (&block, se.expr, tmp);
+ gfc_add_modify (&block, se.expr, tmp);
}
return gfc_finish_block (&block);
@@ -3941,7 +3942,7 @@ gfc_trans_deallocate (gfc_code * code)
apstat = build_fold_addr_expr (astat);
/* Initialize astat to 0. */
- gfc_add_modify_expr (&block, astat, build_int_cst (TREE_TYPE (astat), 0));
+ gfc_add_modify (&block, astat, build_int_cst (TREE_TYPE (astat), 0));
}
else
pstat = apstat = stat = astat = NULL_TREE;
@@ -3996,7 +3997,7 @@ gfc_trans_deallocate (gfc_code * code)
if (code->expr)
{
apstat = fold_build2 (PLUS_EXPR, TREE_TYPE (stat), astat, stat);
- gfc_add_modify_expr (&se.pre, astat, apstat);
+ gfc_add_modify (&se.pre, astat, apstat);
}
tmp = gfc_finish_block (&se.pre);
@@ -4010,7 +4011,7 @@ gfc_trans_deallocate (gfc_code * code)
gfc_init_se (&se, NULL);
gfc_conv_expr_lhs (&se, code->expr);
tmp = convert (TREE_TYPE (se.expr), astat);
- gfc_add_modify_expr (&block, se.expr, tmp);
+ gfc_add_modify (&block, se.expr, tmp);
}
return gfc_finish_block (&block);
diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c
index fa1bf248aec..0fa290c8612 100644
--- a/gcc/fortran/trans-types.c
+++ b/gcc/fortran/trans-types.c
@@ -124,14 +124,14 @@ int gfc_character_storage_size;
if a mismatch occurs between ts->f90_type and ts->type; SUCCESS if
they match. */
-try
+gfc_try
gfc_validate_c_kind (gfc_typespec *ts)
{
return ((ts->type == ts->f90_type) ? SUCCESS : FAILURE);
}
-try
+gfc_try
gfc_check_any_c_kind (gfc_typespec *ts)
{
int i;
@@ -361,7 +361,7 @@ gfc_init_kinds (void)
if (kind == 16)
saw_r16 = true;
- /* Careful we don't stumble a wierd internal mode. */
+ /* Careful we don't stumble a weird internal mode. */
gcc_assert (r_index <= 0 || gfc_real_kinds[r_index-1].kind != kind);
/* Or have too many modes for the allocated space. */
gcc_assert (r_index != MAX_REAL_KINDS);
@@ -393,7 +393,7 @@ gfc_init_kinds (void)
gfc_default_integer_kind = 8;
/* Even if the user specified that the default integer kind be 8,
- the numerica storage size isn't 64. In this case, a warning will
+ the numeric storage size isn't 64. In this case, a warning will
be issued when NUMERIC_STORAGE_SIZE is used. */
gfc_numeric_storage_size = 4 * 8;
}
@@ -1065,8 +1065,8 @@ gfc_get_element_type (tree type)
ARRAYS comment.
The data component points to the first element in the array. The
- offset field is the position of the origin of the array (ie element
- (0, 0 ...)). This may be outsite the bounds of the array.
+ offset field is the position of the origin of the array (i.e. element
+ (0, 0 ...)). This may be outside the bounds of the array.
An element is accessed by
data[offset + index0*stride0 + index1*stride1 + index2*stride2]
@@ -1078,7 +1078,7 @@ gfc_get_element_type (tree type)
elements of the origin (2^63 on 64-bit machines). For example
integer, dimension (80000:90000, 80000:90000, 2) :: array
may not work properly on 32-bit machines because 80000*80000 >
- 2^31, so the calculation for stride02 would overflow. This may
+ 2^31, so the calculation for stride2 would overflow. This may
still work, but I haven't checked, and it relies on the overflow
doing the right thing.
@@ -1513,7 +1513,7 @@ gfc_get_array_type_bounds (tree etype, int dimen, tree * lbound,
{
char name[8 + GFC_RANK_DIGITS + GFC_MAX_SYMBOL_LEN];
tree fat_type, base_type, arraytype, lower, upper, stride, tmp, rtype;
- const char *typename;
+ const char *type_name;
int n;
base_type = gfc_get_array_descriptor_base (dimen);
@@ -1523,11 +1523,11 @@ gfc_get_array_type_bounds (tree etype, int dimen, tree * lbound,
if (tmp && TREE_CODE (tmp) == TYPE_DECL)
tmp = DECL_NAME (tmp);
if (tmp)
- typename = IDENTIFIER_POINTER (tmp);
+ type_name = IDENTIFIER_POINTER (tmp);
else
- typename = "unknown";
+ type_name = "unknown";
sprintf (name, "array" GFC_RANK_PRINTF_FORMAT "_%.*s", dimen,
- GFC_MAX_SYMBOL_LEN, typename);
+ GFC_MAX_SYMBOL_LEN, type_name);
TYPE_NAME (fat_type) = get_identifier (name);
GFC_DESCRIPTOR_TYPE_P (fat_type) = 1;
@@ -2163,7 +2163,7 @@ gfc_type_for_size (unsigned bits, int unsignedp)
}
/* Handle TImode as a special case because it is used by some backends
- (eg. ARM) even though it is not available for normal use. */
+ (e.g. ARM) even though it is not available for normal use. */
#if HOST_BITS_PER_WIDE_INT >= 64
if (bits == TYPE_PRECISION (intTI_type_node))
return intTI_type_node;
diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c
index 5bd3005a2b3..911e379001a 100644
--- a/gcc/fortran/trans.c
+++ b/gcc/fortran/trans.c
@@ -23,7 +23,8 @@ along with GCC; see the file COPYING3. If not see
#include "system.h"
#include "coretypes.h"
#include "tree.h"
-#include "tree-gimple.h"
+#include "gimple.h"
+#include "tree-iterator.h"
#include "ggc.h"
#include "toplev.h"
#include "defaults.h"
@@ -129,7 +130,7 @@ gfc_create_var (tree type, const char *prefix)
}
-/* If the an expression is not constant, evaluate it now. We assign the
+/* If the expression is not constant, evaluate it now. We assign the
result of the expression to an artificially created variable VAR, and
return a pointer to the VAR_DECL node for this variable. */
@@ -142,19 +143,18 @@ gfc_evaluate_now (tree expr, stmtblock_t * pblock)
return expr;
var = gfc_create_var (TREE_TYPE (expr), NULL);
- gfc_add_modify_expr (pblock, var, expr);
+ gfc_add_modify (pblock, var, expr);
return var;
}
-/* Build a MODIFY_EXPR (or GIMPLE_MODIFY_STMT) node and add it to a
- given statement block PBLOCK. A MODIFY_EXPR is an assignment:
+/* Build a MODIFY_EXPR node and add it to a given statement block PBLOCK.
+ A MODIFY_EXPR is an assignment:
LHS <- RHS. */
void
-gfc_add_modify (stmtblock_t * pblock, tree lhs, tree rhs,
- bool tuples_p)
+gfc_add_modify (stmtblock_t * pblock, tree lhs, tree rhs)
{
tree tmp;
@@ -167,8 +167,7 @@ gfc_add_modify (stmtblock_t * pblock, tree lhs, tree rhs,
|| AGGREGATE_TYPE_P (TREE_TYPE (lhs)));
#endif
- tmp = fold_build2 (tuples_p ? GIMPLE_MODIFY_STMT : MODIFY_EXPR,
- void_type_node, lhs, rhs);
+ tmp = fold_build2 (MODIFY_EXPR, void_type_node, lhs, rhs);
gfc_add_expr_to_block (pblock, tmp);
}
@@ -351,13 +350,14 @@ gfc_build_array_ref (tree base, tree offset, tree decl)
/* Generate a runtime error if COND is true. */
void
-gfc_trans_runtime_check (tree cond, stmtblock_t * pblock, locus * where,
- const char * msgid, ...)
+gfc_trans_runtime_check (bool error, bool once, tree cond, stmtblock_t * pblock,
+ locus * where, const char * msgid, ...)
{
va_list ap;
stmtblock_t block;
tree body;
tree tmp;
+ tree tmpvar = NULL;
tree arg, arg2;
tree *argarray;
tree fntype;
@@ -377,6 +377,14 @@ gfc_trans_runtime_check (tree cond, stmtblock_t * pblock, locus * where,
nargs++;
}
+ if (once)
+ {
+ tmpvar = gfc_create_var (boolean_type_node, "print_warning");
+ TREE_STATIC (tmpvar) = 1;
+ DECL_INITIAL (tmpvar) = boolean_true_node;
+ gfc_add_expr_to_block (pblock, tmpvar);
+ }
+
/* The code to generate the error. */
gfc_start_block (&block);
@@ -408,16 +416,25 @@ gfc_trans_runtime_check (tree cond, stmtblock_t * pblock, locus * where,
argarray[2+i] = va_arg (ap, tree);
va_end (ap);
- /* Build the function call to runtime_error_at; because of the variable
- number of arguments, we can't use build_call_expr directly. */
- fntype = TREE_TYPE (gfor_fndecl_runtime_error_at);
+ /* Build the function call to runtime_(warning,error)_at; because of the
+ variable number of arguments, we can't use build_call_expr directly. */
+ if (error)
+ fntype = TREE_TYPE (gfor_fndecl_runtime_error_at);
+ else
+ fntype = TREE_TYPE (gfor_fndecl_runtime_warning_at);
+
tmp = fold_builtin_call_array (TREE_TYPE (fntype),
fold_build1 (ADDR_EXPR,
build_pointer_type (fntype),
- gfor_fndecl_runtime_error_at),
+ error
+ ? gfor_fndecl_runtime_error_at
+ : gfor_fndecl_runtime_warning_at),
nargs + 2, argarray);
gfc_add_expr_to_block (&block, tmp);
+ if (once)
+ gfc_add_modify (&block, tmpvar, boolean_false_node);
+
body = gfc_finish_block (&block);
if (integer_onep (cond))
@@ -427,7 +444,12 @@ gfc_trans_runtime_check (tree cond, stmtblock_t * pblock, locus * where,
else
{
/* Tell the compiler that this isn't likely. */
- cond = fold_convert (long_integer_type_node, cond);
+ if (once)
+ cond = fold_build2 (TRUTH_AND_EXPR, long_integer_type_node, tmpvar,
+ cond);
+ else
+ cond = fold_convert (long_integer_type_node, cond);
+
tmp = build_int_cst (long_integer_type_node, 0);
cond = build_call_expr (built_in_decls[BUILT_IN_EXPECT], 2, cond, tmp);
cond = fold_convert (boolean_type_node, cond);
@@ -472,7 +494,7 @@ gfc_call_malloc (stmtblock_t * block, tree type, tree size)
size = fold_build2 (MAX_EXPR, size_type_node, size,
build_int_cst (size_type_node, 1));
- gfc_add_modify_expr (&block2, res,
+ gfc_add_modify (&block2, res,
build_call_expr (built_in_decls[BUILT_IN_MALLOC], 1,
size));
null_result = fold_build2 (EQ_EXPR, boolean_type_node, res,
@@ -570,10 +592,10 @@ gfc_allocate_with_status (stmtblock_t * block, tree size, tree status)
stmtblock_t set_status_block;
gfc_start_block (&set_status_block);
- gfc_add_modify_expr (&set_status_block,
+ gfc_add_modify (&set_status_block,
fold_build1 (INDIRECT_REF, status_type, status),
build_int_cst (status_type, LIBERROR_ALLOCATION));
- gfc_add_modify_expr (&set_status_block, res,
+ gfc_add_modify (&set_status_block, res,
build_int_cst (pvoid_type_node, 0));
tmp = fold_build2 (EQ_EXPR, boolean_type_node, status,
@@ -584,7 +606,7 @@ gfc_allocate_with_status (stmtblock_t * block, tree size, tree status)
/* The allocation itself. */
gfc_start_block (&alloc_block);
- gfc_add_modify_expr (&alloc_block, res,
+ gfc_add_modify (&alloc_block, res,
build_call_expr (built_in_decls[BUILT_IN_MALLOC], 1,
fold_build2 (MAX_EXPR, size_type_node,
size,
@@ -666,7 +688,7 @@ gfc_allocate_array_with_status (stmtblock_t * block, tree mem, tree size,
/* If mem is NULL, we call gfc_allocate_with_status. */
gfc_start_block (&alloc_block);
tmp = gfc_allocate_with_status (&alloc_block, size, status);
- gfc_add_modify_expr (&alloc_block, res, fold_convert (type, tmp));
+ gfc_add_modify (&alloc_block, res, fold_convert (type, tmp));
alloc = gfc_finish_block (&alloc_block);
/* Otherwise, we issue a runtime error or set the status variable. */
@@ -685,9 +707,9 @@ gfc_allocate_array_with_status (stmtblock_t * block, tree mem, tree size,
gfc_add_expr_to_block (&set_status_block, tmp);
tmp = gfc_allocate_with_status (&set_status_block, size, status);
- gfc_add_modify_expr (&set_status_block, res, fold_convert (type, tmp));
+ gfc_add_modify (&set_status_block, res, fold_convert (type, tmp));
- gfc_add_modify_expr (&set_status_block,
+ gfc_add_modify (&set_status_block,
fold_build1 (INDIRECT_REF, status_type, status),
build_int_cst (status_type, LIBERROR_ALLOCATION));
@@ -862,7 +884,7 @@ gfc_call_realloc (stmtblock_t * block, tree mem, tree size)
/* Call realloc and check the result. */
tmp = build_call_expr (built_in_decls[BUILT_IN_REALLOC], 2,
fold_convert (pvoid_type_node, mem), size);
- gfc_add_modify_expr (block, res, fold_convert (type, tmp));
+ gfc_add_modify (block, res, fold_convert (type, tmp));
null_result = fold_build2 (EQ_EXPR, boolean_type_node, res,
build_int_cst (pvoid_type_node, 0));
nonzero = fold_build2 (NE_EXPR, boolean_type_node, size,
@@ -962,7 +984,7 @@ gfc_trans_code (gfc_code * code)
gfc_start_block (&block);
- /* Translate statements one by one to GIMPLE trees until we reach
+ /* Translate statements one by one into GENERIC trees until we reach
the end of this gfc_code branch. */
for (; code; code = code->next)
{
@@ -1150,7 +1172,7 @@ gfc_trans_code (gfc_code * code)
if (res != NULL_TREE && ! IS_EMPTY_STMT (res))
{
if (TREE_CODE (res) == STATEMENT_LIST)
- annotate_all_with_locus (&res, input_location);
+ tree_annotate_all_with_location (&res, input_location);
else
SET_EXPR_LOCATION (res, input_location);
diff --git a/gcc/fortran/trans.h b/gcc/fortran/trans.h
index 81c449e91a5..6e09f24ac95 100644
--- a/gcc/fortran/trans.h
+++ b/gcc/fortran/trans.h
@@ -1,5 +1,5 @@
/* Header for code translation functions
- Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software
+ Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software
Foundation, Inc.
Contributed by Paul Brook
@@ -137,7 +137,7 @@ typedef enum
/* A non-elemental function call returning an array. The call is executed
before entering the scalarization loop, storing the result in a
temporary. This temporary is then used inside the scalarization loop.
- Simple assignments, eg. a(:) = fn() are handles without a temporary
+ Simple assignments, e.g. a(:) = fn(), are handled without a temporary
as a special case. */
GFC_SS_FUNCTION,
@@ -348,12 +348,8 @@ void gfc_trans_vla_type_sizes (gfc_symbol *, stmtblock_t *);
void gfc_add_expr_to_block (stmtblock_t *, tree);
/* Add a block to the end of a block. */
void gfc_add_block_to_block (stmtblock_t *, stmtblock_t *);
-/* Add a MODIFY_EXPR or a GIMPLE_MODIFY_STMT to a block. */
-void gfc_add_modify (stmtblock_t *, tree, tree, bool);
-#define gfc_add_modify_expr(BLOCK, LHS, RHS) \
- gfc_add_modify ((BLOCK), (LHS), (RHS), false)
-#define gfc_add_modify_stmt(BLOCK, LHS, RHS) \
- gfc_add_modify ((BLOCK), (LHS), (RHS), true)
+/* Add a MODIFY_EXPR to a block. */
+void gfc_add_modify (stmtblock_t *, tree, tree);
/* Initialize a statement block. */
void gfc_init_block (stmtblock_t *);
@@ -444,8 +440,9 @@ void gfc_generate_constructors (void);
/* Get the string length of an array constructor. */
bool get_array_ctor_strlen (stmtblock_t *, gfc_constructor *, tree *);
-/* Generate a runtime error check. */
-void gfc_trans_runtime_check (tree, stmtblock_t *, locus *, const char *, ...);
+/* Generate a runtime warning/error check. */
+void gfc_trans_runtime_check (bool, bool, tree, stmtblock_t *, locus *,
+ const char *, ...);
/* Generate a call to free() after checking that its arg is non-NULL. */
tree gfc_call_free (tree);
@@ -510,6 +507,7 @@ extern GTY(()) tree gfor_fndecl_stop_numeric;
extern GTY(()) tree gfor_fndecl_stop_string;
extern GTY(()) tree gfor_fndecl_runtime_error;
extern GTY(()) tree gfor_fndecl_runtime_error_at;
+extern GTY(()) tree gfor_fndecl_runtime_warning_at;
extern GTY(()) tree gfor_fndecl_os_error;
extern GTY(()) tree gfor_fndecl_generate_error;
extern GTY(()) tree gfor_fndecl_set_fpe;
@@ -654,7 +652,7 @@ struct lang_decl GTY(())
#define GFC_TYPE_ARRAY_SIZE(node) (TYPE_LANG_SPECIFIC(node)->size)
#define GFC_TYPE_ARRAY_OFFSET(node) (TYPE_LANG_SPECIFIC(node)->offset)
#define GFC_TYPE_ARRAY_AKIND(node) (TYPE_LANG_SPECIFIC(node)->akind)
-/* Code should use gfc_get_dtype instead of accesing this directly. It may
+/* Code should use gfc_get_dtype instead of accessing this directly. It may
not be known when the type is created. */
#define GFC_TYPE_ARRAY_DTYPE(node) (TYPE_LANG_SPECIFIC(node)->dtype)
#define GFC_TYPE_ARRAY_DATAPTR_TYPE(node) \
@@ -710,7 +708,7 @@ typedef struct gfc_interface_sym_mapping
{
struct gfc_interface_sym_mapping *next;
gfc_symbol *old;
- gfc_symtree *new;
+ gfc_symtree *new_sym;
gfc_expr *expr;
}
gfc_interface_sym_mapping;
diff --git a/gcc/function.c b/gcc/function.c
index 69c2f68a4f9..98b8da07365 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -59,7 +59,7 @@ along with GCC; see the file COPYING3. If not see
#include "langhooks.h"
#include "target.h"
#include "cfglayout.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "tree-pass.h"
#include "predict.h"
#include "df.h"
@@ -350,10 +350,14 @@ get_stack_local_alignment (tree type, enum machine_mode mode)
-2 means use BITS_PER_UNIT,
positive specifies alignment boundary in bits.
+ If REDUCE_ALIGNMENT_OK is true, it is OK to reduce alignment.
+
We do not round to stack_boundary here. */
rtx
-assign_stack_local (enum machine_mode mode, HOST_WIDE_INT size, int align)
+assign_stack_local_1 (enum machine_mode mode, HOST_WIDE_INT size,
+ int align,
+ bool reduce_alignment_ok ATTRIBUTE_UNUSED)
{
rtx x, addr;
int bigend_correction = 0;
@@ -375,17 +379,52 @@ assign_stack_local (enum machine_mode mode, HOST_WIDE_INT size, int align)
else
alignment = align / BITS_PER_UNIT;
+ alignment_in_bits = alignment * BITS_PER_UNIT;
+
if (FRAME_GROWS_DOWNWARD)
frame_offset -= size;
- /* Ignore alignment we can't do with expected alignment of the boundary. */
- if (alignment * BITS_PER_UNIT > PREFERRED_STACK_BOUNDARY)
- alignment = PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT;
+ /* Ignore alignment if it exceeds MAX_SUPPORTED_STACK_ALIGNMENT. */
+ if (alignment_in_bits > MAX_SUPPORTED_STACK_ALIGNMENT)
+ {
+ alignment_in_bits = MAX_SUPPORTED_STACK_ALIGNMENT;
+ alignment = alignment_in_bits / BITS_PER_UNIT;
+ }
- alignment_in_bits = alignment * BITS_PER_UNIT;
+ if (SUPPORTS_STACK_ALIGNMENT)
+ {
+ if (crtl->stack_alignment_estimated < alignment_in_bits)
+ {
+ if (!crtl->stack_realign_processed)
+ crtl->stack_alignment_estimated = alignment_in_bits;
+ else
+ {
+ /* If stack is realigned and stack alignment value
+ hasn't been finalized, it is OK not to increase
+ stack_alignment_estimated. The bigger alignment
+ requirement is recorded in stack_alignment_needed
+ below. */
+ gcc_assert (!crtl->stack_realign_finalized);
+ if (!crtl->stack_realign_needed)
+ {
+ /* It is OK to reduce the alignment as long as the
+ requested size is 0 or the estimated stack
+ alignment >= mode alignment. */
+ gcc_assert (reduce_alignment_ok
+ || size == 0
+ || (crtl->stack_alignment_estimated
+ >= GET_MODE_ALIGNMENT (mode)));
+ alignment_in_bits = crtl->stack_alignment_estimated;
+ alignment = alignment_in_bits / BITS_PER_UNIT;
+ }
+ }
+ }
+ }
if (crtl->stack_alignment_needed < alignment_in_bits)
crtl->stack_alignment_needed = alignment_in_bits;
+ if (crtl->max_used_stack_slot_alignment < crtl->stack_alignment_needed)
+ crtl->max_used_stack_slot_alignment = crtl->stack_alignment_needed;
/* Calculate how many bytes the start of local variables is off from
stack alignment. */
@@ -449,6 +488,14 @@ assign_stack_local (enum machine_mode mode, HOST_WIDE_INT size, int align)
return x;
}
+
+/* Wrap up assign_stack_local_1 with last parameter as false. */
+
+rtx
+assign_stack_local (enum machine_mode mode, HOST_WIDE_INT size, int align)
+{
+ return assign_stack_local_1 (mode, size, align, false);
+}
/* Removes temporary slot TEMP from LIST. */
@@ -885,59 +932,60 @@ find_temp_slot_from_address (rtx x)
return 0;
}
-/* Indicate that NEW is an alternate way of referring to the temp slot
- that previously was known by OLD. */
+/* Indicate that NEW_RTX is an alternate way of referring to the temp
+ slot that previously was known by OLD_RTX. */
void
-update_temp_slot_address (rtx old, rtx new)
+update_temp_slot_address (rtx old_rtx, rtx new_rtx)
{
struct temp_slot *p;
- if (rtx_equal_p (old, new))
+ if (rtx_equal_p (old_rtx, new_rtx))
return;
- p = find_temp_slot_from_address (old);
+ p = find_temp_slot_from_address (old_rtx);
- /* If we didn't find one, see if both OLD is a PLUS. If so, and NEW
- is a register, see if one operand of the PLUS is a temporary
- location. If so, NEW points into it. Otherwise, if both OLD and
- NEW are a PLUS and if there is a register in common between them.
- If so, try a recursive call on those values. */
+ /* If we didn't find one, see if both OLD_RTX is a PLUS. If so, and
+ NEW_RTX is a register, see if one operand of the PLUS is a
+ temporary location. If so, NEW_RTX points into it. Otherwise,
+ if both OLD_RTX and NEW_RTX are a PLUS and if there is a register
+ in common between them. If so, try a recursive call on those
+ values. */
if (p == 0)
{
- if (GET_CODE (old) != PLUS)
+ if (GET_CODE (old_rtx) != PLUS)
return;
- if (REG_P (new))
+ if (REG_P (new_rtx))
{
- update_temp_slot_address (XEXP (old, 0), new);
- update_temp_slot_address (XEXP (old, 1), new);
+ update_temp_slot_address (XEXP (old_rtx, 0), new_rtx);
+ update_temp_slot_address (XEXP (old_rtx, 1), new_rtx);
return;
}
- else if (GET_CODE (new) != PLUS)
+ else if (GET_CODE (new_rtx) != PLUS)
return;
- if (rtx_equal_p (XEXP (old, 0), XEXP (new, 0)))
- update_temp_slot_address (XEXP (old, 1), XEXP (new, 1));
- else if (rtx_equal_p (XEXP (old, 1), XEXP (new, 0)))
- update_temp_slot_address (XEXP (old, 0), XEXP (new, 1));
- else if (rtx_equal_p (XEXP (old, 0), XEXP (new, 1)))
- update_temp_slot_address (XEXP (old, 1), XEXP (new, 0));
- else if (rtx_equal_p (XEXP (old, 1), XEXP (new, 1)))
- update_temp_slot_address (XEXP (old, 0), XEXP (new, 0));
+ if (rtx_equal_p (XEXP (old_rtx, 0), XEXP (new_rtx, 0)))
+ update_temp_slot_address (XEXP (old_rtx, 1), XEXP (new_rtx, 1));
+ else if (rtx_equal_p (XEXP (old_rtx, 1), XEXP (new_rtx, 0)))
+ update_temp_slot_address (XEXP (old_rtx, 0), XEXP (new_rtx, 1));
+ else if (rtx_equal_p (XEXP (old_rtx, 0), XEXP (new_rtx, 1)))
+ update_temp_slot_address (XEXP (old_rtx, 1), XEXP (new_rtx, 0));
+ else if (rtx_equal_p (XEXP (old_rtx, 1), XEXP (new_rtx, 1)))
+ update_temp_slot_address (XEXP (old_rtx, 0), XEXP (new_rtx, 0));
return;
}
/* Otherwise add an alias for the temp's address. */
else if (p->address == 0)
- p->address = new;
+ p->address = new_rtx;
else
{
if (GET_CODE (p->address) != EXPR_LIST)
p->address = gen_rtx_EXPR_LIST (VOIDmode, p->address, NULL_RTX);
- p->address = gen_rtx_EXPR_LIST (VOIDmode, new, p->address);
+ p->address = gen_rtx_EXPR_LIST (VOIDmode, new_rtx, p->address);
}
}
@@ -1163,23 +1211,33 @@ static int cfa_offset;
static rtx
instantiate_new_reg (rtx x, HOST_WIDE_INT *poffset)
{
- rtx new;
+ rtx new_rtx;
HOST_WIDE_INT offset;
if (x == virtual_incoming_args_rtx)
- new = arg_pointer_rtx, offset = in_arg_offset;
+ {
+ if (stack_realign_drap)
+ {
+ /* Replace virtual_incoming_args_rtx with internal arg
+ pointer if DRAP is used to realign stack. */
+ new_rtx = crtl->args.internal_arg_pointer;
+ offset = 0;
+ }
+ else
+ new_rtx = arg_pointer_rtx, offset = in_arg_offset;
+ }
else if (x == virtual_stack_vars_rtx)
- new = frame_pointer_rtx, offset = var_offset;
+ new_rtx = frame_pointer_rtx, offset = var_offset;
else if (x == virtual_stack_dynamic_rtx)
- new = stack_pointer_rtx, offset = dynamic_offset;
+ new_rtx = stack_pointer_rtx, offset = dynamic_offset;
else if (x == virtual_outgoing_args_rtx)
- new = stack_pointer_rtx, offset = out_arg_offset;
+ new_rtx = stack_pointer_rtx, offset = out_arg_offset;
else if (x == virtual_cfa_rtx)
{
#ifdef FRAME_POINTER_CFA_OFFSET
- new = frame_pointer_rtx;
+ new_rtx = frame_pointer_rtx;
#else
- new = arg_pointer_rtx;
+ new_rtx = arg_pointer_rtx;
#endif
offset = cfa_offset;
}
@@ -1187,7 +1245,7 @@ instantiate_new_reg (rtx x, HOST_WIDE_INT *poffset)
return NULL_RTX;
*poffset = offset;
- return new;
+ return new_rtx;
}
/* A subroutine of instantiate_virtual_regs, called via for_each_rtx.
@@ -1201,7 +1259,7 @@ instantiate_virtual_regs_in_rtx (rtx *loc, void *data)
{
HOST_WIDE_INT offset;
bool *changed = (bool *) data;
- rtx x, new;
+ rtx x, new_rtx;
x = *loc;
if (x == 0)
@@ -1210,21 +1268,21 @@ instantiate_virtual_regs_in_rtx (rtx *loc, void *data)
switch (GET_CODE (x))
{
case REG:
- new = instantiate_new_reg (x, &offset);
- if (new)
+ new_rtx = instantiate_new_reg (x, &offset);
+ if (new_rtx)
{
- *loc = plus_constant (new, offset);
+ *loc = plus_constant (new_rtx, offset);
if (changed)
*changed = true;
}
return -1;
case PLUS:
- new = instantiate_new_reg (XEXP (x, 0), &offset);
- if (new)
+ new_rtx = instantiate_new_reg (XEXP (x, 0), &offset);
+ if (new_rtx)
{
- new = plus_constant (new, offset);
- *loc = simplify_gen_binary (PLUS, GET_MODE (x), new, XEXP (x, 1));
+ new_rtx = plus_constant (new_rtx, offset);
+ *loc = simplify_gen_binary (PLUS, GET_MODE (x), new_rtx, XEXP (x, 1));
if (changed)
*changed = true;
return -1;
@@ -1270,7 +1328,7 @@ instantiate_virtual_regs_in_insn (rtx insn)
HOST_WIDE_INT offset;
int insn_code, i;
bool any_change = false;
- rtx set, new, x, seq;
+ rtx set, new_rtx, x, seq;
/* There are some special cases to be handled first. */
set = single_set (insn);
@@ -1280,17 +1338,17 @@ instantiate_virtual_regs_in_insn (rtx insn)
to mean that the underlying register gets assigned the inverse
transformation. This is used, for example, in the handling of
non-local gotos. */
- new = instantiate_new_reg (SET_DEST (set), &offset);
- if (new)
+ new_rtx = instantiate_new_reg (SET_DEST (set), &offset);
+ if (new_rtx)
{
start_sequence ();
for_each_rtx (&SET_SRC (set), instantiate_virtual_regs_in_rtx, NULL);
- x = simplify_gen_binary (PLUS, GET_MODE (new), SET_SRC (set),
+ x = simplify_gen_binary (PLUS, GET_MODE (new_rtx), SET_SRC (set),
GEN_INT (-offset));
- x = force_operand (x, new);
- if (x != new)
- emit_move_insn (new, x);
+ x = force_operand (x, new_rtx);
+ if (x != new_rtx)
+ emit_move_insn (new_rtx, x);
seq = get_insns ();
end_sequence ();
@@ -1304,15 +1362,15 @@ instantiate_virtual_regs_in_insn (rtx insn)
new add insn. The difference between this and falling through
to the generic case is avoiding a new pseudo and eliminating a
move insn in the initial rtl stream. */
- new = instantiate_new_reg (SET_SRC (set), &offset);
- if (new && offset != 0
+ new_rtx = instantiate_new_reg (SET_SRC (set), &offset);
+ if (new_rtx && offset != 0
&& REG_P (SET_DEST (set))
&& REGNO (SET_DEST (set)) > LAST_VIRTUAL_REGISTER)
{
start_sequence ();
x = expand_simple_binop (GET_MODE (SET_DEST (set)), PLUS,
- new, GEN_INT (offset), SET_DEST (set),
+ new_rtx, GEN_INT (offset), SET_DEST (set),
1, OPTAB_LIB_WIDEN);
if (x != SET_DEST (set))
emit_move_insn (SET_DEST (set), x);
@@ -1335,7 +1393,7 @@ instantiate_virtual_regs_in_insn (rtx insn)
&& recog_data.operand_loc[1] == &XEXP (SET_SRC (set), 0)
&& recog_data.operand_loc[2] == &XEXP (SET_SRC (set), 1)
&& GET_CODE (recog_data.operand[2]) == CONST_INT
- && (new = instantiate_new_reg (recog_data.operand[1], &offset)))
+ && (new_rtx = instantiate_new_reg (recog_data.operand[1], &offset)))
{
offset += INTVAL (recog_data.operand[2]);
@@ -1345,7 +1403,7 @@ instantiate_virtual_regs_in_insn (rtx insn)
&& REGNO (SET_DEST (set)) > LAST_VIRTUAL_REGISTER)
{
start_sequence ();
- emit_move_insn (SET_DEST (set), new);
+ emit_move_insn (SET_DEST (set), new_rtx);
seq = get_insns ();
end_sequence ();
@@ -1359,10 +1417,10 @@ instantiate_virtual_regs_in_insn (rtx insn)
/* Using validate_change and apply_change_group here leaves
recog_data in an invalid state. Since we know exactly what
we want to check, do those two by hand. */
- if (safe_insn_predicate (insn_code, 1, new)
+ if (safe_insn_predicate (insn_code, 1, new_rtx)
&& safe_insn_predicate (insn_code, 2, x))
{
- *recog_data.operand_loc[1] = recog_data.operand[1] = new;
+ *recog_data.operand_loc[1] = recog_data.operand[1] = new_rtx;
*recog_data.operand_loc[2] = recog_data.operand[2] = x;
any_change = true;
@@ -1417,11 +1475,11 @@ instantiate_virtual_regs_in_insn (rtx insn)
break;
case REG:
- new = instantiate_new_reg (x, &offset);
- if (new == NULL)
+ new_rtx = instantiate_new_reg (x, &offset);
+ if (new_rtx == NULL)
continue;
if (offset == 0)
- x = new;
+ x = new_rtx;
else
{
start_sequence ();
@@ -1432,7 +1490,7 @@ instantiate_virtual_regs_in_insn (rtx insn)
/* ??? Recognize address_operand and/or "p" constraints
to see if (plus new offset) is a valid before we put
this through expand_simple_binop. */
- x = expand_simple_binop (GET_MODE (x), PLUS, new,
+ x = expand_simple_binop (GET_MODE (x), PLUS, new_rtx,
GEN_INT (offset), NULL_RTX,
1, OPTAB_LIB_WIDEN);
seq = get_insns ();
@@ -1442,21 +1500,21 @@ instantiate_virtual_regs_in_insn (rtx insn)
break;
case SUBREG:
- new = instantiate_new_reg (SUBREG_REG (x), &offset);
- if (new == NULL)
+ new_rtx = instantiate_new_reg (SUBREG_REG (x), &offset);
+ if (new_rtx == NULL)
continue;
if (offset != 0)
{
start_sequence ();
- new = expand_simple_binop (GET_MODE (new), PLUS, new,
+ new_rtx = expand_simple_binop (GET_MODE (new_rtx), PLUS, new_rtx,
GEN_INT (offset), NULL_RTX,
1, OPTAB_LIB_WIDEN);
seq = get_insns ();
end_sequence ();
emit_insn_before (seq, insn);
}
- x = simplify_gen_subreg (recog_data.operand_mode[i], new,
- GET_MODE (new), SUBREG_BYTE (x));
+ x = simplify_gen_subreg (recog_data.operand_mode[i], new_rtx,
+ GET_MODE (new_rtx), SUBREG_BYTE (x));
break;
default:
@@ -1547,7 +1605,7 @@ static tree
instantiate_expr (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
{
tree t = *tp;
- if (! EXPR_P (t) && ! GIMPLE_STMT_P (t))
+ if (! EXPR_P (t))
{
*walk_subtrees = 0;
if (DECL_P (t) && DECL_RTL_SET_P (t))
@@ -2204,6 +2262,11 @@ assign_parm_find_entry_rtl (struct assign_parm_data_all *all,
entry_parm ? data->partial : 0, current_function_decl,
&all->stack_args_size, &data->locate);
+ /* Update parm_stack_boundary if this parameter is passed in the
+ stack. */
+ if (!in_regs && crtl->parm_stack_boundary < data->locate.boundary)
+ crtl->parm_stack_boundary = data->locate.boundary;
+
/* Adjust offsets to include the pretend args. */
pretend_bytes = all->extra_pretend_bytes - pretend_bytes;
data->locate.slot_offset.constant += pretend_bytes;
@@ -2947,6 +3010,20 @@ assign_parms (tree fndecl)
continue;
}
+ /* Estimate stack alignment from parameter alignment. */
+ if (SUPPORTS_STACK_ALIGNMENT)
+ {
+ unsigned int align = FUNCTION_ARG_BOUNDARY (data.promoted_mode,
+ data.passed_type);
+ if (TYPE_ALIGN (data.nominal_type) > align)
+ align = TYPE_ALIGN (data.passed_type);
+ if (crtl->stack_alignment_estimated < align)
+ {
+ gcc_assert (!crtl->stack_realign_processed);
+ crtl->stack_alignment_estimated = align;
+ }
+ }
+
if (cfun->stdarg && !TREE_CHAIN (parm))
assign_parms_setup_varargs (&all, &data, false);
@@ -2984,6 +3061,28 @@ assign_parms (tree fndecl)
now that all parameters have been copied out of hard registers. */
emit_insn (all.first_conversion_insn);
+ /* Estimate reload stack alignment from scalar return mode. */
+ if (SUPPORTS_STACK_ALIGNMENT)
+ {
+ if (DECL_RESULT (fndecl))
+ {
+ tree type = TREE_TYPE (DECL_RESULT (fndecl));
+ enum machine_mode mode = TYPE_MODE (type);
+
+ if (mode != BLKmode
+ && mode != VOIDmode
+ && !AGGREGATE_TYPE_P (type))
+ {
+ unsigned int align = GET_MODE_ALIGNMENT (mode);
+ if (crtl->stack_alignment_estimated < align)
+ {
+ gcc_assert (!crtl->stack_realign_processed);
+ crtl->stack_alignment_estimated = align;
+ }
+ }
+ }
+ }
+
/* If we are receiving a struct value address as the first argument, set up
the RTL for the function result. As this might require code to convert
the transmitted address to Pmode, we do this here to ensure that possible
@@ -3092,7 +3191,7 @@ gimplify_parm_type (tree *tp, int *walk_subtrees, void *data)
else if (TYPE_SIZE (t) && !TREE_CONSTANT (TYPE_SIZE (t))
&& !TYPE_SIZES_GIMPLIFIED (t))
{
- gimplify_type_sizes (t, (tree *) data);
+ gimplify_type_sizes (t, (gimple_seq *) data);
*walk_subtrees = 1;
}
}
@@ -3102,15 +3201,15 @@ gimplify_parm_type (tree *tp, int *walk_subtrees, void *data)
/* Gimplify the parameter list for current_function_decl. This involves
evaluating SAVE_EXPRs of variable sized parameters and generating code
- to implement callee-copies reference parameters. Returns a list of
- statements to add to the beginning of the function, or NULL if nothing
- to do. */
+ to implement callee-copies reference parameters. Returns a sequence of
+ statements to add to the beginning of the function. */
-tree
+gimple_seq
gimplify_parameters (void)
{
struct assign_parm_data_all all;
- tree fnargs, parm, stmts = NULL;
+ tree fnargs, parm;
+ gimple_seq stmts = NULL;
assign_parms_initialize_all (&all);
fnargs = assign_parms_augmented_arg_list (&all);
@@ -3170,12 +3269,11 @@ gimplify_parameters (void)
t = built_in_decls[BUILT_IN_ALLOCA];
t = build_call_expr (t, 1, DECL_SIZE_UNIT (parm));
t = fold_convert (ptr_type, t);
- t = build_gimple_modify_stmt (addr, t);
+ t = build2 (MODIFY_EXPR, TREE_TYPE (addr), addr, t);
gimplify_and_add (t, &stmts);
}
- t = build_gimple_modify_stmt (local, parm);
- gimplify_and_add (t, &stmts);
+ gimplify_assign (local, parm, &stmts);
SET_DECL_VALUE_EXPR (parm, local);
DECL_HAS_VALUE_EXPR_P (parm) = 1;
@@ -3259,14 +3357,42 @@ locate_and_pad_parm (enum machine_mode passed_mode, tree type, int in_regs,
where_pad = FUNCTION_ARG_PADDING (passed_mode, type);
boundary = FUNCTION_ARG_BOUNDARY (passed_mode, type);
locate->where_pad = where_pad;
+
+ /* Alignment can't exceed MAX_SUPPORTED_STACK_ALIGNMENT. */
+ if (boundary > MAX_SUPPORTED_STACK_ALIGNMENT)
+ boundary = MAX_SUPPORTED_STACK_ALIGNMENT;
+
locate->boundary = boundary;
+ if (SUPPORTS_STACK_ALIGNMENT)
+ {
+ /* stack_alignment_estimated can't change after stack has been
+ realigned. */
+ if (crtl->stack_alignment_estimated < boundary)
+ {
+ if (!crtl->stack_realign_processed)
+ crtl->stack_alignment_estimated = boundary;
+ else
+ {
+ /* If stack is realigned and stack alignment value
+ hasn't been finalized, it is OK not to increase
+ stack_alignment_estimated. The bigger alignment
+ requirement is recorded in stack_alignment_needed
+ below. */
+ gcc_assert (!crtl->stack_realign_finalized
+ && crtl->stack_realign_needed);
+ }
+ }
+ }
+
/* Remember if the outgoing parameter requires extra alignment on the
calling function side. */
- if (boundary > PREFERRED_STACK_BOUNDARY)
- boundary = PREFERRED_STACK_BOUNDARY;
if (crtl->stack_alignment_needed < boundary)
crtl->stack_alignment_needed = boundary;
+ if (crtl->max_used_stack_slot_alignment < crtl->stack_alignment_needed)
+ crtl->max_used_stack_slot_alignment = crtl->stack_alignment_needed;
+ if (crtl->preferred_stack_boundary < boundary)
+ crtl->preferred_stack_boundary = boundary;
#ifdef ARGS_GROW_DOWNWARD
locate->slot_offset.constant = -initial_offset_ptr->constant;
@@ -3731,13 +3857,30 @@ debug_find_var_in_block_tree (tree var, tree block)
static bool in_dummy_function;
-/* Invoke the target hook when setting cfun. */
+/* Invoke the target hook when setting cfun. Update the optimization options
+ if the function uses different options than the default. */
static void
invoke_set_current_function_hook (tree fndecl)
{
if (!in_dummy_function)
- targetm.set_current_function (fndecl);
+ {
+ tree opts = ((fndecl)
+ ? DECL_FUNCTION_SPECIFIC_OPTIMIZATION (fndecl)
+ : optimization_default_node);
+
+ if (!opts)
+ opts = optimization_default_node;
+
+ /* Change optimization options if needed. */
+ if (optimization_current_node != opts)
+ {
+ optimization_current_node = opts;
+ cl_optimization_restore (TREE_OPTIMIZATION (opts));
+ }
+
+ targetm.set_current_function (fndecl);
+ }
}
/* cfun should never be set directly; use this function. */
@@ -3763,22 +3906,12 @@ DEF_VEC_ALLOC_P(function_p,heap);
static VEC(function_p,heap) *cfun_stack;
-/* We save the value of in_system_header here when pushing the first
- function on the cfun stack, and we restore it from here when
- popping the last function. */
-
-static bool saved_in_system_header;
-
/* Push the current cfun onto the stack, and set cfun to new_cfun. */
void
push_cfun (struct function *new_cfun)
{
- if (cfun == NULL)
- saved_in_system_header = in_system_header;
VEC_safe_push (function_p, heap, cfun_stack, cfun);
- if (new_cfun)
- in_system_header = DECL_IN_SYSTEM_HEADER (new_cfun->decl);
set_cfun (new_cfun);
}
@@ -3788,8 +3921,6 @@ void
pop_cfun (void)
{
struct function *new_cfun = VEC_pop (function_p, cfun_stack);
- in_system_header = ((new_cfun == NULL) ? saved_in_system_header
- : DECL_IN_SYSTEM_HEADER (new_cfun->decl));
set_cfun (new_cfun);
}
@@ -3867,11 +3998,7 @@ allocate_struct_function (tree fndecl, bool abstract_p)
void
push_struct_function (tree fndecl)
{
- if (cfun == NULL)
- saved_in_system_header = in_system_header;
VEC_safe_push (function_p, heap, cfun_stack, cfun);
- if (fndecl)
- in_system_header = DECL_IN_SYSTEM_HEADER (fndecl);
allocate_struct_function (fndecl, false);
}
@@ -3885,6 +4012,7 @@ prepare_function_start (void)
init_emit ();
init_varasm_status ();
init_expr ();
+ default_rtl_profile ();
cse_not_expected = ! optimize;
@@ -4601,7 +4729,8 @@ get_arg_pointer_save_area (void)
generated stack slot may not be a valid memory address, so we
have to check it and fix it if necessary. */
start_sequence ();
- emit_move_insn (validize_mem (ret), virtual_incoming_args_rtx);
+ emit_move_insn (validize_mem (ret),
+ crtl->args.internal_arg_pointer);
seq = get_insns ();
end_sequence ();
@@ -4711,6 +4840,7 @@ thread_prologue_and_epilogue_insns (void)
#endif
edge_iterator ei;
+ rtl_profile_for_bb (ENTRY_BLOCK_PTR);
#ifdef HAVE_prologue
if (HAVE_prologue)
{
@@ -4757,6 +4887,7 @@ thread_prologue_and_epilogue_insns (void)
if (e == NULL)
goto epilogue_done;
+ rtl_profile_for_bb (EXIT_BLOCK_PTR);
#ifdef HAVE_return
if (optimize && HAVE_return)
{
@@ -4906,6 +5037,7 @@ thread_prologue_and_epilogue_insns (void)
cfg_layout_finalize ();
}
epilogue_done:
+ default_rtl_profile ();
if (inserted)
{
diff --git a/gcc/function.h b/gcc/function.h
index ece44fdc7ac..eb85e3c37af 100644
--- a/gcc/function.h
+++ b/gcc/function.h
@@ -311,6 +311,9 @@ struct rtl_data GTY(())
needed by inner routines. */
rtx x_arg_pointer_save_area;
+ /* Dynamic Realign Argument Pointer used for realigning stack. */
+ rtx drap_reg;
+
/* Offset to end of allocated area of stack frame.
If stack grows down, this is the address of the last stack slot allocated.
If stack grows up, this is the address for the next slot. */
@@ -328,12 +331,29 @@ struct rtl_data GTY(())
/* Current nesting level for temporaries. */
int x_temp_slot_level;
- /* The largest alignment of slot allocated on the stack. */
+ /* The largest alignment needed on the stack, including requirement
+ for outgoing stack alignment. */
unsigned int stack_alignment_needed;
- /* Preferred alignment of the end of stack frame. */
+ /* Preferred alignment of the end of stack frame, which is preferred
+ to call other functions. */
unsigned int preferred_stack_boundary;
+ /* The minimum alignment of parameter stack. */
+ unsigned int parm_stack_boundary;
+
+ /* The largest alignment of slot allocated on the stack. */
+ unsigned int max_used_stack_slot_alignment;
+
+ /* The stack alignment estimated before reload, with consideration of
+ following factors:
+ 1. Alignment of local stack variables (max_used_stack_slot_alignment)
+ 2. Alignment requirement to call other functions
+ (preferred_stack_boundary)
+ 3. Alignment of non-local stack variables but might be spilled in
+ local stack. */
+ unsigned int stack_alignment_estimated;
+
/* For reorg. */
/* If some insns can be deferred to the delay slots of the epilogue, the
@@ -393,10 +413,37 @@ struct rtl_data GTY(())
/* Nonzero if code to initialize arg_pointer_save_area has been emitted. */
bool arg_pointer_save_area_init;
- /* Nonzero means current function must be given a frame pointer.
- Set in stmt.c if anything is allocated on the stack there.
- Set in reload1.c if anything is allocated on the stack there. */
+ /* Nonzero if current function must be given a frame pointer.
+ Set in global.c if anything is allocated on the stack there. */
bool frame_pointer_needed;
+
+ /* When set, expand should optimize for speed. */
+ bool maybe_hot_insn_p;
+
+ /* Nonzero if function stack realignment is needed. This flag may be
+ set twice: before and after reload. It is set before reload wrt
+ stack alignment estimation before reload. It will be changed after
+ reload if by then criteria of stack realignment is different.
+ The value set after reload is the accurate one and is finalized. */
+ bool stack_realign_needed;
+
+ /* Nonzero if function stack realignment is tried. This flag is set
+ only once before reload. It affects register elimination. This
+ is used to generate DWARF debug info for stack variables. */
+ bool stack_realign_tried;
+
+ /* Nonzero if function being compiled needs dynamic realigned
+ argument pointer (drap) if stack needs realigning. */
+ bool need_drap;
+
+ /* Nonzero if function stack realignment estimation is done, namely
+ stack_realign_needed flag has been set before reload wrt estimated
+ stack alignment info. */
+ bool stack_realign_processed;
+
+ /* Nonzero if function stack realignment has been finalized, namely
+ stack_realign_needed flag has been set and finalized after reload. */
+ bool stack_realign_finalized;
};
#define return_label (crtl->x_return_label)
@@ -411,6 +458,8 @@ struct rtl_data GTY(())
#define temp_slot_level (crtl->x_temp_slot_level)
#define nonlocal_goto_handler_labels (crtl->x_nonlocal_goto_handler_labels)
#define frame_pointer_needed (crtl->frame_pointer_needed)
+#define stack_realign_fp (crtl->stack_realign_needed && !crtl->need_drap)
+#define stack_realign_drap (crtl->stack_realign_needed && crtl->need_drap)
extern GTY(()) struct rtl_data x_rtl;
@@ -428,6 +477,10 @@ struct function GTY(())
/* The control flow graph for this function. */
struct control_flow_graph *cfg;
+
+ /* GIMPLE body for this function. */
+ struct gimple_seq_d *gimple_body;
+
/* SSA and dataflow information. */
struct gimple_df *gimple_df;
diff --git a/gcc/fwprop.c b/gcc/fwprop.c
index e6700019644..fbe432974f4 100644
--- a/gcc/fwprop.c
+++ b/gcc/fwprop.c
@@ -527,10 +527,15 @@ use_killed_between (struct df_ref *use, rtx def_insn, rtx target_insn)
return true;
/* Check if the reg in USE has only one definition. We already
- know that this definition reaches use, or we wouldn't be here. */
+ know that this definition reaches use, or we wouldn't be here.
+ However, this is invalid for hard registers because if they are
+ live at the beginning of the function it does not mean that we
+ have an uninitialized access. */
regno = DF_REF_REGNO (use);
def = DF_REG_DEF_CHAIN (regno);
- if (def && (def->next_reg == NULL))
+ if (def
+ && def->next_reg == NULL
+ && regno >= FIRST_PSEUDO_REGISTER)
return false;
/* Check locally if we are in the same basic block. */
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 456199d630e..f5dae14d793 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -819,7 +819,7 @@ static const char *cpp_unique_options =
in turn cause preprocessor symbols to be defined specially. */
static const char *cpp_options =
"%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w}\
- %{f*} %{g*:%{!g0:%{!fno-working-directory:-fworking-directory}}} %{O*}\
+ %{f*} %{g*:%{!g0:%{g*} %{!fno-working-directory:-fworking-directory}}} %{O*}\
%{undef} %{save-temps:-fpch-preprocess}";
/* This contains cpp options which are not passed when the preprocessor
@@ -8061,7 +8061,7 @@ include_spec_function (int argc, const char **argv)
if (argc != 1)
abort ();
- file = find_a_file (&startfile_prefixes, argv[0], R_OK, 0);
+ file = find_a_file (&startfile_prefixes, argv[0], R_OK, true);
read_specs (file ? file : argv[0], FALSE);
return NULL;
diff --git a/gcc/gengtype.c b/gcc/gengtype.c
index f7309b16c88..02923a952d9 100644
--- a/gcc/gengtype.c
+++ b/gcc/gengtype.c
@@ -314,6 +314,10 @@ read_input_line (FILE *list, char **herep, char **linep,
char *line;
int c = getc (list);
+ /* Read over whitespace. */
+ while (c == '\n' || c == ' ')
+ c = getc (list);
+
if (c == EOF)
{
*linep = 0;
@@ -1537,7 +1541,7 @@ open_base_files (void)
"hard-reg-set.h", "basic-block.h", "cselib.h", "insn-addr.h",
"optabs.h", "libfuncs.h", "debug.h", "ggc.h", "cgraph.h",
"tree-flow.h", "reload.h", "cpp-id-data.h", "tree-chrec.h",
- "cfglayout.h", "except.h", "output.h", "cfgloop.h", NULL
+ "cfglayout.h", "except.h", "output.h", "gimple.h", "cfgloop.h", NULL
};
const char *const *ifp;
outf_p gtype_desc_c;
diff --git a/gcc/ggc-page.c b/gcc/ggc-page.c
index 98a6c280ef3..0afe0d815dd 100644
--- a/gcc/ggc-page.c
+++ b/gcc/ggc-page.c
@@ -172,7 +172,6 @@ along with GCC; see the file COPYING3. If not see
thing you need to do to add a new special allocation size. */
static const size_t extra_order_size_table[] = {
- sizeof (struct stmt_ann_d),
sizeof (struct var_ann_d),
sizeof (struct tree_decl_non_common),
sizeof (struct tree_field_decl),
@@ -184,9 +183,6 @@ static const size_t extra_order_size_table[] = {
sizeof (struct basic_block_def),
sizeof (bitmap_element),
sizeof (bitmap_head),
- /* PHI nodes with one to three arguments are already covered by the
- above sizes. */
- sizeof (struct tree_phi_node) + sizeof (struct phi_arg_d) * 3,
TREE_EXP_SIZE (2),
RTL_SIZE (2), /* MEM, PLUS, etc. */
RTL_SIZE (9), /* INSN */
diff --git a/gcc/gimple-iterator.c b/gcc/gimple-iterator.c
new file mode 100644
index 00000000000..a52c83072b4
--- /dev/null
+++ b/gcc/gimple-iterator.c
@@ -0,0 +1,771 @@
+/* Iterator routines for GIMPLE statements.
+ Copyright (C) 2007, 2008 Free Software Foundation, Inc.
+ Contributed by Aldy Hernandez <aldy@quesejoda.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "tree.h"
+#include "gimple.h"
+#include "tree-flow.h"
+#include "value-prof.h"
+
+
+/* Mark the statement STMT as modified, and update it. */
+
+static inline void
+update_modified_stmt (gimple stmt)
+{
+ if (!ssa_operands_active ())
+ return;
+ update_stmt_if_modified (stmt);
+}
+
+
+/* Mark the statements in SEQ as modified, and update them. */
+
+static void
+update_modified_stmts (gimple_seq seq)
+{
+ gimple_stmt_iterator gsi;
+
+ if (!ssa_operands_active ())
+ return;
+ for (gsi = gsi_start (seq); !gsi_end_p (gsi); gsi_next (&gsi))
+ update_stmt_if_modified (gsi_stmt (gsi));
+}
+
+
+/* Set BB to be the basic block for all the statements in the list
+ starting at FIRST and LAST. */
+
+static void
+update_bb_for_stmts (gimple_seq_node first, basic_block bb)
+{
+ gimple_seq_node n;
+
+ for (n = first; n; n = n->next)
+ gimple_set_bb (n->stmt, bb);
+}
+
+
+/* Insert the sequence delimited by nodes FIRST and LAST before
+ iterator I. M specifies how to update iterator I after insertion
+ (see enum gsi_iterator_update).
+
+ This routine assumes that there is a forward and backward path
+ between FIRST and LAST (i.e., they are linked in a doubly-linked
+ list). Additionally, if FIRST == LAST, this routine will properly
+ insert a single node. */
+
+static void
+gsi_insert_seq_nodes_before (gimple_stmt_iterator *i,
+ gimple_seq_node first,
+ gimple_seq_node last,
+ enum gsi_iterator_update mode)
+{
+ basic_block bb;
+ gimple_seq_node cur = i->ptr;
+
+ if ((bb = gsi_bb (*i)) != NULL)
+ update_bb_for_stmts (first, bb);
+
+ /* Link SEQ before CUR in the sequence. */
+ if (cur)
+ {
+ first->prev = cur->prev;
+ if (first->prev)
+ first->prev->next = first;
+ else
+ gimple_seq_set_first (i->seq, first);
+ last->next = cur;
+ cur->prev = last;
+ }
+ else
+ {
+ gimple_seq_node itlast = gimple_seq_last (i->seq);
+
+ /* If CUR is NULL, we link at the end of the sequence (this case happens
+ when gsi_after_labels is called for a basic block that contains only
+ labels, so it returns an iterator after the end of the block, and
+ we need to insert before it; it might be cleaner to add a flag to the
+ iterator saying whether we are at the start or end of the list). */
+ first->prev = itlast;
+ if (itlast)
+ itlast->next = first;
+ else
+ gimple_seq_set_first (i->seq, first);
+ gimple_seq_set_last (i->seq, last);
+ }
+
+ /* Update the iterator, if requested. */
+ switch (mode)
+ {
+ case GSI_NEW_STMT:
+ case GSI_CONTINUE_LINKING:
+ i->ptr = first;
+ break;
+ case GSI_SAME_STMT:
+ break;
+ default:
+ gcc_unreachable ();
+ }
+}
+
+
+/* Inserts the sequence of statements SEQ before the statement pointed
+ by iterator I. MODE indicates what to do with the iterator after
+ insertion (see enum gsi_iterator_update).
+
+ This function does not scan for new operands. It is provided for
+ the use of the gimplifier, which manipulates statements for which
+ def/use information has not yet been constructed. Most callers
+ should use gsi_insert_seq_before. */
+
+void
+gsi_insert_seq_before_without_update (gimple_stmt_iterator *i, gimple_seq seq,
+ enum gsi_iterator_update mode)
+{
+ gimple_seq_node first, last;
+
+ if (seq == NULL)
+ return;
+
+ /* Don't allow inserting a sequence into itself. */
+ gcc_assert (seq != i->seq);
+
+ first = gimple_seq_first (seq);
+ last = gimple_seq_last (seq);
+
+ gimple_seq_set_first (seq, NULL);
+ gimple_seq_set_last (seq, NULL);
+ gimple_seq_free (seq);
+
+ /* Empty sequences need no work. */
+ if (!first || !last)
+ {
+ gcc_assert (first == last);
+ return;
+ }
+
+ gsi_insert_seq_nodes_before (i, first, last, mode);
+}
+
+
+/* Inserts the sequence of statements SEQ before the statement pointed
+ by iterator I. MODE indicates what to do with the iterator after
+ insertion (see enum gsi_iterator_update). Scan the statements in SEQ
+ for new operands. */
+
+void
+gsi_insert_seq_before (gimple_stmt_iterator *i, gimple_seq seq,
+ enum gsi_iterator_update mode)
+{
+ update_modified_stmts (seq);
+ gsi_insert_seq_before_without_update (i, seq, mode);
+}
+
+
+/* Insert the sequence delimited by nodes FIRST and LAST after
+ iterator I. M specifies how to update iterator I after insertion
+ (see enum gsi_iterator_update).
+
+ This routine assumes that there is a forward and backward path
+ between FIRST and LAST (i.e., they are linked in a doubly-linked
+ list). Additionally, if FIRST == LAST, this routine will properly
+ insert a single node. */
+
+static void
+gsi_insert_seq_nodes_after (gimple_stmt_iterator *i,
+ gimple_seq_node first,
+ gimple_seq_node last,
+ enum gsi_iterator_update m)
+{
+ basic_block bb;
+ gimple_seq_node cur = i->ptr;
+
+ /* If the iterator is inside a basic block, we need to update the
+ basic block information for all the nodes between FIRST and LAST. */
+ if ((bb = gsi_bb (*i)) != NULL)
+ update_bb_for_stmts (first, bb);
+
+ /* Link SEQ after CUR. */
+ if (cur)
+ {
+ last->next = cur->next;
+ if (last->next)
+ last->next->prev = last;
+ else
+ gimple_seq_set_last (i->seq, last);
+ first->prev = cur;
+ cur->next = first;
+ }
+ else
+ {
+ gcc_assert (!gimple_seq_last (i->seq));
+ gimple_seq_set_first (i->seq, first);
+ gimple_seq_set_last (i->seq, last);
+ }
+
+ /* Update the iterator, if requested. */
+ switch (m)
+ {
+ case GSI_NEW_STMT:
+ i->ptr = first;
+ break;
+ case GSI_CONTINUE_LINKING:
+ i->ptr = last;
+ break;
+ case GSI_SAME_STMT:
+ gcc_assert (cur);
+ break;
+ default:
+ gcc_unreachable ();
+ }
+}
+
+
+/* Links sequence SEQ after the statement pointed-to by iterator I.
+ MODE is as in gsi_insert_after.
+
+ This function does not scan for new operands. It is provided for
+ the use of the gimplifier, which manipulates statements for which
+ def/use information has not yet been constructed. Most callers
+ should use gsi_insert_seq_after. */
+
+void
+gsi_insert_seq_after_without_update (gimple_stmt_iterator *i, gimple_seq seq,
+ enum gsi_iterator_update mode)
+{
+ gimple_seq_node first, last;
+
+ if (seq == NULL)
+ return;
+
+ /* Don't allow inserting a sequence into itself. */
+ gcc_assert (seq != i->seq);
+
+ first = gimple_seq_first (seq);
+ last = gimple_seq_last (seq);
+
+ gimple_seq_set_first (seq, NULL);
+ gimple_seq_set_last (seq, NULL);
+ gimple_seq_free (seq);
+
+ /* Empty sequences need no work. */
+ if (!first || !last)
+ {
+ gcc_assert (first == last);
+ return;
+ }
+
+ gsi_insert_seq_nodes_after (i, first, last, mode);
+}
+
+
+/* Links sequence SEQ after the statement pointed-to by iterator I.
+ MODE is as in gsi_insert_after. Scan the statements in SEQ
+ for new operands. */
+
+void
+gsi_insert_seq_after (gimple_stmt_iterator *i, gimple_seq seq,
+ enum gsi_iterator_update mode)
+{
+ update_modified_stmts (seq);
+ gsi_insert_seq_after_without_update (i, seq, mode);
+}
+
+
+/* Move all statements in the sequence after I to a new sequence.
+ Return this new sequence. */
+
+gimple_seq
+gsi_split_seq_after (gimple_stmt_iterator i)
+{
+ gimple_seq_node cur, next;
+ gimple_seq old_seq, new_seq;
+
+ cur = i.ptr;
+
+ /* How can we possibly split after the end, or before the beginning? */
+ gcc_assert (cur && cur->next);
+ next = cur->next;
+
+ old_seq = i.seq;
+ new_seq = gimple_seq_alloc ();
+
+ gimple_seq_set_first (new_seq, next);
+ gimple_seq_set_last (new_seq, gimple_seq_last (old_seq));
+ gimple_seq_set_last (old_seq, cur);
+ cur->next = NULL;
+ next->prev = NULL;
+
+ return new_seq;
+}
+
+
+/* Move all statements in the sequence before I to a new sequence.
+ Return this new sequence. I is set to the head of the new list. */
+
+gimple_seq
+gsi_split_seq_before (gimple_stmt_iterator *i)
+{
+ gimple_seq_node cur, prev;
+ gimple_seq old_seq, new_seq;
+
+ cur = i->ptr;
+
+ /* How can we possibly split after the end? */
+ gcc_assert (cur);
+ prev = cur->prev;
+
+ old_seq = i->seq;
+ new_seq = gimple_seq_alloc ();
+ i->seq = new_seq;
+
+ /* Set the limits on NEW_SEQ. */
+ gimple_seq_set_first (new_seq, cur);
+ gimple_seq_set_last (new_seq, gimple_seq_last (old_seq));
+
+ /* Cut OLD_SEQ before I. */
+ gimple_seq_set_last (old_seq, prev);
+ cur->prev = NULL;
+ if (prev)
+ prev->next = NULL;
+ else
+ gimple_seq_set_first (old_seq, NULL);
+
+ return new_seq;
+}
+
+
+/* Replace the statement pointed-to by GSI to STMT. If UPDATE_EH_INFO
+ is true, the exception handling information of the original
+ statement is moved to the new statement. */
+
+void
+gsi_replace (gimple_stmt_iterator *gsi, gimple stmt, bool update_eh_info)
+{
+ int eh_region;
+ gimple orig_stmt = gsi_stmt (*gsi);
+
+ if (stmt == orig_stmt)
+ return;
+
+ gimple_set_location (stmt, gimple_location (orig_stmt));
+ gimple_set_bb (stmt, gsi_bb (*gsi));
+
+ /* Preserve EH region information from the original statement, if
+ requested by the caller. */
+ if (update_eh_info)
+ {
+ eh_region = lookup_stmt_eh_region (orig_stmt);
+ if (eh_region >= 0)
+ {
+ remove_stmt_from_eh_region (orig_stmt);
+ add_stmt_to_eh_region (stmt, eh_region);
+ }
+ }
+
+ gimple_duplicate_stmt_histograms (cfun, stmt, cfun, orig_stmt);
+ gimple_remove_stmt_histograms (cfun, orig_stmt);
+ delink_stmt_imm_use (orig_stmt);
+ *gsi_stmt_ptr (gsi) = stmt;
+ gimple_set_modified (stmt, true);
+ update_modified_stmt (stmt);
+}
+
+
+/* Insert statement STMT before the statement pointed-to by iterator I.
+ M specifies how to update iterator I after insertion (see enum
+ gsi_iterator_update).
+
+ This function does not scan for new operands. It is provided for
+ the use of the gimplifier, which manipulates statements for which
+ def/use information has not yet been constructed. Most callers
+ should use gsi_insert_before. */
+
+void
+gsi_insert_before_without_update (gimple_stmt_iterator *i, gimple stmt,
+ enum gsi_iterator_update m)
+{
+ gimple_seq_node n;
+
+ n = GGC_NEW (struct gimple_seq_node_d);
+ n->prev = n->next = NULL;
+ n->stmt = stmt;
+ gsi_insert_seq_nodes_before (i, n, n, m);
+}
+
+/* Insert statement STMT before the statement pointed-to by iterator I.
+ Update STMT's basic block and scan it for new operands. M
+ specifies how to update iterator I after insertion (see enum
+ gsi_iterator_update). */
+
+void
+gsi_insert_before (gimple_stmt_iterator *i, gimple stmt,
+ enum gsi_iterator_update m)
+{
+ update_modified_stmt (stmt);
+ gsi_insert_before_without_update (i, stmt, m);
+}
+
+
+/* Insert statement STMT after the statement pointed-to by iterator I.
+ M specifies how to update iterator I after insertion (see enum
+ gsi_iterator_update).
+
+ This function does not scan for new operands. It is provided for
+ the use of the gimplifier, which manipulates statements for which
+ def/use information has not yet been constructed. Most callers
+ should use gsi_insert_after. */
+
+void
+gsi_insert_after_without_update (gimple_stmt_iterator *i, gimple stmt,
+ enum gsi_iterator_update m)
+{
+ gimple_seq_node n;
+
+ n = GGC_NEW (struct gimple_seq_node_d);
+ n->prev = n->next = NULL;
+ n->stmt = stmt;
+ gsi_insert_seq_nodes_after (i, n, n, m);
+}
+
+
+/* Insert statement STMT after the statement pointed-to by iterator I.
+ Update STMT's basic block and scan it for new operands. M
+ specifies how to update iterator I after insertion (see enum
+ gsi_iterator_update). */
+
+void
+gsi_insert_after (gimple_stmt_iterator *i, gimple stmt,
+ enum gsi_iterator_update m)
+{
+ update_modified_stmt (stmt);
+ gsi_insert_after_without_update (i, stmt, m);
+}
+
+
+/* Remove the current stmt from the sequence. The iterator is updated
+ to point to the next statement.
+
+ REMOVE_PERMANENTLY is true when the statement is going to be removed
+ from the IL and not reinserted elsewhere. In that case we remove the
+ statement pointed to by iterator I from the EH tables, and free its
+ operand caches. Otherwise we do not modify this information. */
+
+void
+gsi_remove (gimple_stmt_iterator *i, bool remove_permanently)
+{
+ gimple_seq_node cur, next, prev;
+ gimple stmt = gsi_stmt (*i);
+
+ /* Free all the data flow information for STMT. */
+ gimple_set_bb (stmt, NULL);
+ delink_stmt_imm_use (stmt);
+ gimple_set_modified (stmt, true);
+
+ if (remove_permanently)
+ {
+ remove_stmt_from_eh_region (stmt);
+ gimple_remove_stmt_histograms (cfun, stmt);
+ }
+
+ /* Update the iterator and re-wire the links in I->SEQ. */
+ cur = i->ptr;
+ next = cur->next;
+ prev = cur->prev;
+
+ if (prev)
+ prev->next = next;
+ else
+ gimple_seq_set_first (i->seq, next);
+
+ if (next)
+ next->prev = prev;
+ else
+ gimple_seq_set_last (i->seq, prev);
+
+ i->ptr = next;
+}
+
+
+/* Finds iterator for STMT. */
+
+gimple_stmt_iterator
+gsi_for_stmt (gimple stmt)
+{
+ gimple_stmt_iterator i;
+ basic_block bb = gimple_bb (stmt);
+
+ if (gimple_code (stmt) == GIMPLE_PHI)
+ i = gsi_start_phis (bb);
+ else
+ i = gsi_start_bb (bb);
+
+ for (; !gsi_end_p (i); gsi_next (&i))
+ if (gsi_stmt (i) == stmt)
+ return i;
+
+ gcc_unreachable ();
+}
+
+
+/* Move the statement at FROM so it comes right after the statement at TO. */
+
+void
+gsi_move_after (gimple_stmt_iterator *from, gimple_stmt_iterator *to)
+{
+ gimple stmt = gsi_stmt (*from);
+ gsi_remove (from, false);
+
+ /* We must have GSI_NEW_STMT here, as gsi_move_after is sometimes used to
+ move statements to an empty block. */
+ gsi_insert_after (to, stmt, GSI_NEW_STMT);
+}
+
+
+/* Move the statement at FROM so it comes right before the statement
+ at TO. */
+
+void
+gsi_move_before (gimple_stmt_iterator *from, gimple_stmt_iterator *to)
+{
+ gimple stmt = gsi_stmt (*from);
+ gsi_remove (from, false);
+
+ /* For consistency with gsi_move_after, it might be better to have
+ GSI_NEW_STMT here; however, that breaks several places that expect
+ that TO does not change. */
+ gsi_insert_before (to, stmt, GSI_SAME_STMT);
+}
+
+
+/* Move the statement at FROM to the end of basic block BB. */
+
+void
+gsi_move_to_bb_end (gimple_stmt_iterator *from, basic_block bb)
+{
+ gimple_stmt_iterator last = gsi_last_bb (bb);
+#ifdef ENABLE_CHECKING
+ gcc_assert (gsi_bb (last) == bb);
+#endif
+
+ /* Have to check gsi_end_p because it could be an empty block. */
+ if (!gsi_end_p (last) && is_ctrl_stmt (gsi_stmt (last)))
+ gsi_move_before (from, &last);
+ else
+ gsi_move_after (from, &last);
+}
+
+
+/* Add STMT to the pending list of edge E. No actual insertion is
+ made until a call to gsi_commit_edge_inserts () is made. */
+
+void
+gsi_insert_on_edge (edge e, gimple stmt)
+{
+ gimple_seq_add_stmt (&PENDING_STMT (e), stmt);
+}
+
+/* Add the sequence of statements SEQ to the pending list of edge E.
+ No actual insertion is made until a call to gsi_commit_edge_inserts
+ is made. */
+
+void
+gsi_insert_seq_on_edge (edge e, gimple_seq seq)
+{
+ gimple_seq_add_seq (&PENDING_STMT (e), seq);
+}
+
+
+/* Insert the statement pointed-to by GSI into edge E. Every attempt
+ is made to place the statement in an existing basic block, but
+ sometimes that isn't possible. When it isn't possible, the edge is
+ split and the statement is added to the new block.
+
+ In all cases, the returned *GSI points to the correct location. The
+ return value is true if insertion should be done after the location,
+ or false if it should be done before the location. If new basic block
+ has to be created, it is stored in *NEW_BB. */
+
+static bool
+gimple_find_edge_insert_loc (edge e, gimple_stmt_iterator *gsi,
+ basic_block *new_bb)
+{
+ basic_block dest, src;
+ gimple tmp;
+
+ dest = e->dest;
+
+ /* If the destination has one predecessor which has no PHI nodes,
+ insert there. Except for the exit block.
+
+ The requirement for no PHI nodes could be relaxed. Basically we
+ would have to examine the PHIs to prove that none of them used
+ the value set by the statement we want to insert on E. That
+ hardly seems worth the effort. */
+restart:
+ if (single_pred_p (dest)
+ && ! phi_nodes (dest)
+ && dest != EXIT_BLOCK_PTR)
+ {
+ *gsi = gsi_start_bb (dest);
+ if (gsi_end_p (*gsi))
+ return true;
+
+ /* Make sure we insert after any leading labels. */
+ tmp = gsi_stmt (*gsi);
+ while (gimple_code (tmp) == GIMPLE_LABEL)
+ {
+ gsi_next (gsi);
+ if (gsi_end_p (*gsi))
+ break;
+ tmp = gsi_stmt (*gsi);
+ }
+
+ if (gsi_end_p (*gsi))
+ {
+ *gsi = gsi_last_bb (dest);
+ return true;
+ }
+ else
+ return false;
+ }
+
+ /* If the source has one successor, the edge is not abnormal and
+ the last statement does not end a basic block, insert there.
+ Except for the entry block. */
+ src = e->src;
+ if ((e->flags & EDGE_ABNORMAL) == 0
+ && single_succ_p (src)
+ && src != ENTRY_BLOCK_PTR)
+ {
+ *gsi = gsi_last_bb (src);
+ if (gsi_end_p (*gsi))
+ return true;
+
+ tmp = gsi_stmt (*gsi);
+ if (!stmt_ends_bb_p (tmp))
+ return true;
+
+ if (gimple_code (tmp) == GIMPLE_RETURN)
+ {
+ gsi_prev (gsi);
+ return true;
+ }
+ }
+
+ /* Otherwise, create a new basic block, and split this edge. */
+ dest = split_edge (e);
+ if (new_bb)
+ *new_bb = dest;
+ e = single_pred_edge (dest);
+ goto restart;
+}
+
+
+/* Similar to gsi_insert_on_edge+gsi_commit_edge_inserts. If a new
+ block has to be created, it is returned. */
+
+basic_block
+gsi_insert_on_edge_immediate (edge e, gimple stmt)
+{
+ gimple_stmt_iterator gsi;
+ basic_block new_bb = NULL;
+
+ gcc_assert (!PENDING_STMT (e));
+
+ if (gimple_find_edge_insert_loc (e, &gsi, &new_bb))
+ gsi_insert_after (&gsi, stmt, GSI_NEW_STMT);
+ else
+ gsi_insert_before (&gsi, stmt, GSI_NEW_STMT);
+
+ return new_bb;
+}
+
+/* Insert STMTS on edge E. If a new block has to be created, it
+ is returned. */
+
+basic_block
+gsi_insert_seq_on_edge_immediate (edge e, gimple_seq stmts)
+{
+ gimple_stmt_iterator gsi;
+ basic_block new_bb = NULL;
+
+ gcc_assert (!PENDING_STMT (e));
+
+ if (gimple_find_edge_insert_loc (e, &gsi, &new_bb))
+ gsi_insert_seq_after (&gsi, stmts, GSI_NEW_STMT);
+ else
+ gsi_insert_seq_before (&gsi, stmts, GSI_NEW_STMT);
+
+ return new_bb;
+}
+
+/* This routine will commit all pending edge insertions, creating any new
+ basic blocks which are necessary. */
+
+void
+gsi_commit_edge_inserts (void)
+{
+ basic_block bb;
+ edge e;
+ edge_iterator ei;
+
+ gsi_commit_one_edge_insert (single_succ_edge (ENTRY_BLOCK_PTR), NULL);
+
+ FOR_EACH_BB (bb)
+ FOR_EACH_EDGE (e, ei, bb->succs)
+ gsi_commit_one_edge_insert (e, NULL);
+}
+
+
+/* Commit insertions pending at edge E. If a new block is created, set NEW_BB
+ to this block, otherwise set it to NULL. */
+
+void
+gsi_commit_one_edge_insert (edge e, basic_block *new_bb)
+{
+ if (new_bb)
+ *new_bb = NULL;
+
+ if (PENDING_STMT (e))
+ {
+ gimple_stmt_iterator gsi;
+ gimple_seq seq = PENDING_STMT (e);
+
+ PENDING_STMT (e) = NULL;
+
+ if (gimple_find_edge_insert_loc (e, &gsi, new_bb))
+ gsi_insert_seq_after (&gsi, seq, GSI_NEW_STMT);
+ else
+ gsi_insert_seq_before (&gsi, seq, GSI_NEW_STMT);
+ }
+}
+
+/* Returns iterator at the start of the list of phi nodes of BB. */
+
+gimple_stmt_iterator
+gsi_start_phis (basic_block bb)
+{
+ return gsi_start (phi_nodes (bb));
+}
diff --git a/gcc/gimple-low.c b/gcc/gimple-low.c
index 99175d5b2f1..cc77874b849 100644
--- a/gcc/gimple-low.c
+++ b/gcc/gimple-low.c
@@ -1,4 +1,4 @@
-/* Tree lowering pass. Lowers GIMPLE into unstructured form.
+/* GIMPLE lowering pass. Converts High GIMPLE into Low GIMPLE.
Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
@@ -25,7 +25,8 @@ along with GCC; see the file COPYING3. If not see
#include "tree.h"
#include "rtl.h"
#include "varray.h"
-#include "tree-gimple.h"
+#include "gimple.h"
+#include "tree-iterator.h"
#include "tree-inline.h"
#include "diagnostic.h"
#include "langhooks.h"
@@ -40,76 +41,123 @@ along with GCC; see the file COPYING3. If not see
#include "toplev.h"
#include "tree-pass.h"
+/* The differences between High GIMPLE and Low GIMPLE are the
+ following:
+
+ 1- Lexical scopes are removed (i.e., GIMPLE_BIND disappears).
+
+ 2- GIMPLE_TRY and GIMPLE_CATCH are converted to abnormal control
+ flow and exception regions are built as an on-the-side region
+ hierarchy (See tree-eh.c:lower_eh_constructs).
+
+ 3- Multiple identical return statements are grouped into a single
+ return and gotos to the unique return site. */
+
+/* Match a return statement with a label. During lowering, we identify
+ identical return statements and replace duplicates with a jump to
+ the corresponding label. */
+struct return_statements_t
+{
+ tree label;
+ gimple stmt;
+};
+typedef struct return_statements_t return_statements_t;
+
+DEF_VEC_O(return_statements_t);
+DEF_VEC_ALLOC_O(return_statements_t,heap);
+
struct lower_data
{
/* Block the current statement belongs to. */
tree block;
- /* A TREE_LIST of label and return statements to be moved to the end
+ /* A vector of label and return statements to be moved to the end
of the function. */
- tree return_statements;
+ VEC(return_statements_t,heap) *return_statements;
/* True if the function calls __builtin_setjmp. */
bool calls_builtin_setjmp;
};
-static void lower_stmt (tree_stmt_iterator *, struct lower_data *);
-static void lower_bind_expr (tree_stmt_iterator *, struct lower_data *);
-static void lower_cond_expr (tree_stmt_iterator *, struct lower_data *);
-static void lower_return_expr (tree_stmt_iterator *, struct lower_data *);
-static void lower_builtin_setjmp (tree_stmt_iterator *);
+static void lower_stmt (gimple_stmt_iterator *, struct lower_data *);
+static void lower_gimple_bind (gimple_stmt_iterator *, struct lower_data *);
+static void lower_gimple_return (gimple_stmt_iterator *, struct lower_data *);
+static void lower_builtin_setjmp (gimple_stmt_iterator *);
-/* Lower the body of current_function_decl. */
+
+/* Lower the body of current_function_decl from High GIMPLE into Low
+ GIMPLE. */
static unsigned int
lower_function_body (void)
{
struct lower_data data;
- tree *body_p = &DECL_SAVED_TREE (current_function_decl);
- tree bind = *body_p;
- tree_stmt_iterator i;
- tree t, x;
-
- gcc_assert (TREE_CODE (bind) == BIND_EXPR);
+ gimple_seq body = gimple_body (current_function_decl);
+ gimple_seq lowered_body;
+ gimple_stmt_iterator i;
+ gimple bind;
+ tree t;
+ gimple x;
+
+ /* The gimplifier should've left a body of exactly one statement,
+ namely a GIMPLE_BIND. */
+ gcc_assert (gimple_seq_first (body) == gimple_seq_last (body)
+ && gimple_code (gimple_seq_first_stmt (body)) == GIMPLE_BIND);
memset (&data, 0, sizeof (data));
data.block = DECL_INITIAL (current_function_decl);
BLOCK_SUBBLOCKS (data.block) = NULL_TREE;
BLOCK_CHAIN (data.block) = NULL_TREE;
TREE_ASM_WRITTEN (data.block) = 1;
+ data.return_statements = VEC_alloc (return_statements_t, heap, 8);
+
+ bind = gimple_seq_first_stmt (body);
+ lowered_body = NULL;
+ gimple_seq_add_stmt (&lowered_body, bind);
+ i = gsi_start (lowered_body);
+ lower_gimple_bind (&i, &data);
- *body_p = alloc_stmt_list ();
- i = tsi_start (*body_p);
- tsi_link_after (&i, bind, TSI_NEW_STMT);
- lower_bind_expr (&i, &data);
+ /* Once the old body has been lowered, replace it with the new
+ lowered sequence. */
+ gimple_set_body (current_function_decl, lowered_body);
- i = tsi_last (*body_p);
+ i = gsi_last (lowered_body);
/* If the function falls off the end, we need a null return statement.
- If we've already got one in the return_statements list, we don't
+ If we've already got one in the return_statements vector, we don't
need to do anything special. Otherwise build one by hand. */
- if (block_may_fallthru (*body_p)
- && (data.return_statements == NULL
- || TREE_OPERAND (TREE_VALUE (data.return_statements), 0) != NULL))
+ if (gimple_seq_may_fallthru (lowered_body)
+ && (VEC_empty (return_statements_t, data.return_statements)
+ || gimple_return_retval (VEC_last (return_statements_t,
+ data.return_statements)->stmt) != NULL))
{
- x = build1 (RETURN_EXPR, void_type_node, NULL);
- SET_EXPR_LOCATION (x, cfun->function_end_locus);
- tsi_link_after (&i, x, TSI_CONTINUE_LINKING);
+ x = gimple_build_return (NULL);
+ gimple_set_location (x, cfun->function_end_locus);
+ gsi_insert_after (&i, x, GSI_CONTINUE_LINKING);
}
/* If we lowered any return statements, emit the representative
at the end of the function. */
- for (t = data.return_statements ; t ; t = TREE_CHAIN (t))
+ while (!VEC_empty (return_statements_t, data.return_statements))
{
- x = build1 (LABEL_EXPR, void_type_node, TREE_PURPOSE (t));
- tsi_link_after (&i, x, TSI_CONTINUE_LINKING);
+ return_statements_t t;
+
+ /* Unfortunately, we can't use VEC_pop because it returns void for
+ objects. */
+ t = *VEC_last (return_statements_t, data.return_statements);
+ VEC_truncate (return_statements_t,
+ data.return_statements,
+ VEC_length (return_statements_t,
+ data.return_statements) - 1);
+
+ x = gimple_build_label (t.label);
+ gsi_insert_after (&i, x, GSI_CONTINUE_LINKING);
/* Remove the line number from the representative return statement.
It now fills in for many such returns. Failure to remove this
will result in incorrect results for coverage analysis. */
- x = TREE_VALUE (t);
- SET_EXPR_LOCATION (x, UNKNOWN_LOCATION);
- tsi_link_after (&i, x, TSI_CONTINUE_LINKING);
+ gimple_set_location (t.stmt, UNKNOWN_LOCATION);
+ gsi_insert_after (&i, t.stmt, GSI_CONTINUE_LINKING);
}
/* If the function calls __builtin_setjmp, we need to emit the computed
@@ -123,21 +171,21 @@ lower_function_body (void)
/* This mark will create forward edges from every call site. */
DECL_NONLOCAL (disp_label) = 1;
cfun->has_nonlocal_label = 1;
- x = build1 (LABEL_EXPR, void_type_node, disp_label);
- tsi_link_after (&i, x, TSI_CONTINUE_LINKING);
+ x = gimple_build_label (disp_label);
+ gsi_insert_after (&i, x, GSI_CONTINUE_LINKING);
/* Build 'DISP_VAR = __builtin_setjmp_dispatcher (DISP_LABEL);'
and insert. */
disp_var = create_tmp_var (ptr_type_node, "setjmpvar");
arg = build_addr (disp_label, current_function_decl);
t = implicit_built_in_decls[BUILT_IN_SETJMP_DISPATCHER];
- t = build_call_expr (t, 1, arg);
- x = build_gimple_modify_stmt (disp_var, t);
+ x = gimple_build_call (t, 1, arg);
+ gimple_call_set_lhs (x, disp_var);
/* Build 'goto DISP_VAR;' and insert. */
- tsi_link_after (&i, x, TSI_CONTINUE_LINKING);
- x = build1 (GOTO_EXPR, void_type_node, disp_var);
- tsi_link_after (&i, x, TSI_CONTINUE_LINKING);
+ gsi_insert_after (&i, x, GSI_CONTINUE_LINKING);
+ x = gimple_build_goto (disp_var);
+ gsi_insert_after (&i, x, GSI_CONTINUE_LINKING);
}
gcc_assert (data.block == DECL_INITIAL (current_function_decl));
@@ -145,6 +193,7 @@ lower_function_body (void)
= blocks_nreverse (BLOCK_SUBBLOCKS (data.block));
clear_block_marks (data.block);
+ VEC_free(return_statements_t, heap, data.return_statements);
return 0;
}
@@ -168,134 +217,131 @@ struct gimple_opt_pass pass_lower_cf =
};
-/* Lower the EXPR. Unlike gimplification the statements are not relowered
+/* Lower sequence SEQ. Unlike gimplification the statements are not relowered
when they are changed -- if this has to be done, the lowering routine must
do it explicitly. DATA is passed through the recursion. */
static void
-lower_stmt_body (tree expr, struct lower_data *data)
+lower_sequence (gimple_seq seq, struct lower_data *data)
{
- tree_stmt_iterator tsi;
+ gimple_stmt_iterator gsi;
- for (tsi = tsi_start (expr); !tsi_end_p (tsi); )
- lower_stmt (&tsi, data);
+ for (gsi = gsi_start (seq); !gsi_end_p (gsi); )
+ lower_stmt (&gsi, data);
}
-/* Lower the OpenMP directive statement pointed by TSI. DATA is
+/* Lower the OpenMP directive statement pointed by GSI. DATA is
passed through the recursion. */
static void
-lower_omp_directive (tree_stmt_iterator *tsi, struct lower_data *data)
+lower_omp_directive (gimple_stmt_iterator *gsi, struct lower_data *data)
{
- tree stmt;
+ gimple stmt;
- stmt = tsi_stmt (*tsi);
+ stmt = gsi_stmt (*gsi);
- lower_stmt_body (OMP_BODY (stmt), data);
- tsi_link_before (tsi, stmt, TSI_SAME_STMT);
- tsi_link_before (tsi, OMP_BODY (stmt), TSI_SAME_STMT);
- OMP_BODY (stmt) = NULL_TREE;
- tsi_delink (tsi);
+ lower_sequence (gimple_omp_body (stmt), data);
+ gsi_insert_before (gsi, stmt, GSI_SAME_STMT);
+ gsi_insert_seq_before (gsi, gimple_omp_body (stmt), GSI_SAME_STMT);
+ gimple_omp_set_body (stmt, NULL);
+ gsi_remove (gsi, false);
}
-/* Lower statement TSI. DATA is passed through the recursion. */
+/* Lower statement GSI. DATA is passed through the recursion. */
static void
-lower_stmt (tree_stmt_iterator *tsi, struct lower_data *data)
+lower_stmt (gimple_stmt_iterator *gsi, struct lower_data *data)
{
- tree stmt = tsi_stmt (*tsi);
+ gimple stmt = gsi_stmt (*gsi);
- if (EXPR_HAS_LOCATION (stmt) && data)
- TREE_BLOCK (stmt) = data->block;
+ gimple_set_block (stmt, data->block);
- switch (TREE_CODE (stmt))
+ switch (gimple_code (stmt))
{
- case BIND_EXPR:
- lower_bind_expr (tsi, data);
- return;
- case COND_EXPR:
- lower_cond_expr (tsi, data);
- return;
- case RETURN_EXPR:
- lower_return_expr (tsi, data);
+ case GIMPLE_BIND:
+ lower_gimple_bind (gsi, data);
return;
- case TRY_FINALLY_EXPR:
- case TRY_CATCH_EXPR:
- lower_stmt_body (TREE_OPERAND (stmt, 0), data);
- lower_stmt_body (TREE_OPERAND (stmt, 1), data);
+ case GIMPLE_COND:
+ /* The gimplifier has already lowered this into gotos. */
break;
- case CATCH_EXPR:
- lower_stmt_body (CATCH_BODY (stmt), data);
+
+ case GIMPLE_RETURN:
+ lower_gimple_return (gsi, data);
+ return;
+
+ case GIMPLE_TRY:
+ lower_sequence (gimple_try_eval (stmt), data);
+ lower_sequence (gimple_try_cleanup (stmt), data);
break;
- case EH_FILTER_EXPR:
- lower_stmt_body (EH_FILTER_FAILURE (stmt), data);
+
+ case GIMPLE_CATCH:
+ lower_sequence (gimple_catch_handler (stmt), data);
break;
-
- case NOP_EXPR:
- case ASM_EXPR:
- case GOTO_EXPR:
- case PREDICT_EXPR:
- case LABEL_EXPR:
- case SWITCH_EXPR:
- case CHANGE_DYNAMIC_TYPE_EXPR:
- case OMP_FOR:
- case OMP_SECTIONS:
- case OMP_SECTIONS_SWITCH:
- case OMP_SECTION:
- case OMP_SINGLE:
- case OMP_MASTER:
- case OMP_ORDERED:
- case OMP_CRITICAL:
- case OMP_RETURN:
- case OMP_ATOMIC_LOAD:
- case OMP_ATOMIC_STORE:
- case OMP_CONTINUE:
+
+ case GIMPLE_EH_FILTER:
+ lower_sequence (gimple_eh_filter_failure (stmt), data);
break;
- case GIMPLE_MODIFY_STMT:
- if (TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 1)) == CALL_EXPR)
- stmt = GIMPLE_STMT_OPERAND (stmt, 1);
- else
- break;
- /* FALLTHRU */
+ case GIMPLE_NOP:
+ case GIMPLE_ASM:
+ case GIMPLE_ASSIGN:
+ case GIMPLE_GOTO:
+ case GIMPLE_PREDICT:
+ case GIMPLE_LABEL:
+ case GIMPLE_SWITCH:
+ case GIMPLE_CHANGE_DYNAMIC_TYPE:
+ case GIMPLE_OMP_FOR:
+ case GIMPLE_OMP_SECTIONS:
+ case GIMPLE_OMP_SECTIONS_SWITCH:
+ case GIMPLE_OMP_SECTION:
+ case GIMPLE_OMP_SINGLE:
+ case GIMPLE_OMP_MASTER:
+ case GIMPLE_OMP_ORDERED:
+ case GIMPLE_OMP_CRITICAL:
+ case GIMPLE_OMP_RETURN:
+ case GIMPLE_OMP_ATOMIC_LOAD:
+ case GIMPLE_OMP_ATOMIC_STORE:
+ case GIMPLE_OMP_CONTINUE:
+ break;
- case CALL_EXPR:
+ case GIMPLE_CALL:
{
- tree decl = get_callee_fndecl (stmt);
+ tree decl = gimple_call_fndecl (stmt);
+
if (decl
&& DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL
&& DECL_FUNCTION_CODE (decl) == BUILT_IN_SETJMP)
{
data->calls_builtin_setjmp = true;
- lower_builtin_setjmp (tsi);
+ lower_builtin_setjmp (gsi);
return;
}
}
break;
- case OMP_PARALLEL:
- case OMP_TASK:
- lower_omp_directive (tsi, data);
+ case GIMPLE_OMP_PARALLEL:
+ case GIMPLE_OMP_TASK:
+ lower_omp_directive (gsi, data);
return;
default:
gcc_unreachable ();
}
- tsi_next (tsi);
+ gsi_next (gsi);
}
/* Lower a bind_expr TSI. DATA is passed through the recursion. */
static void
-lower_bind_expr (tree_stmt_iterator *tsi, struct lower_data *data)
+lower_gimple_bind (gimple_stmt_iterator *gsi, struct lower_data *data)
{
tree old_block = data->block;
- tree stmt = tsi_stmt (*tsi);
- tree new_block = BIND_EXPR_BLOCK (stmt);
+ gimple stmt = gsi_stmt (*gsi);
+ tree new_block = gimple_bind_block (stmt);
if (new_block)
{
@@ -325,8 +371,8 @@ lower_bind_expr (tree_stmt_iterator *tsi, struct lower_data *data)
}
}
- record_vars (BIND_EXPR_VARS (stmt));
- lower_stmt_body (BIND_EXPR_BODY (stmt), data);
+ record_vars (gimple_bind_vars (stmt));
+ lower_sequence (gimple_bind_body (stmt), data);
if (new_block)
{
@@ -337,9 +383,9 @@ lower_bind_expr (tree_stmt_iterator *tsi, struct lower_data *data)
data->block = old_block;
}
- /* The BIND_EXPR no longer carries any useful information -- kill it. */
- tsi_link_before (tsi, BIND_EXPR_BODY (stmt), TSI_SAME_STMT);
- tsi_delink (tsi);
+ /* The GIMPLE_BIND no longer carries any useful information -- kill it. */
+ gsi_insert_seq_before (gsi, gimple_bind_body (stmt), GSI_SAME_STMT);
+ gsi_remove (gsi, false);
}
/* Try to determine whether a TRY_CATCH expression can fall through.
@@ -390,6 +436,58 @@ try_catch_may_fallthru (const_tree stmt)
}
}
+
+/* Same as above, but for a GIMPLE_TRY_CATCH. */
+
+static bool
+gimple_try_catch_may_fallthru (gimple stmt)
+{
+ gimple_stmt_iterator i;
+
+ /* We don't handle GIMPLE_TRY_FINALLY. */
+ gcc_assert (gimple_try_kind (stmt) == GIMPLE_TRY_CATCH);
+
+ /* If the TRY block can fall through, the whole TRY_CATCH can
+ fall through. */
+ if (gimple_seq_may_fallthru (gimple_try_eval (stmt)))
+ return true;
+
+ i = gsi_start (gimple_try_cleanup (stmt));
+ switch (gimple_code (gsi_stmt (i)))
+ {
+ case GIMPLE_CATCH:
+ /* We expect to see a sequence of GIMPLE_CATCH stmts, each with a
+ catch expression and a body. The whole try/catch may fall
+ through iff any of the catch bodies falls through. */
+ for (; !gsi_end_p (i); gsi_next (&i))
+ {
+ if (gimple_seq_may_fallthru (gimple_catch_handler (gsi_stmt (i))))
+ return true;
+ }
+ return false;
+
+ case GIMPLE_EH_FILTER:
+ /* The exception filter expression only matters if there is an
+ exception. If the exception does not match EH_FILTER_TYPES,
+ we will execute EH_FILTER_FAILURE, and we will fall through
+ if that falls through. If the exception does match
+ EH_FILTER_TYPES, the stack unwinder will continue up the
+ stack, so we will not fall through. We don't know whether we
+ will throw an exception which matches EH_FILTER_TYPES or not,
+ so we just ignore EH_FILTER_TYPES and assume that we might
+ throw an exception which doesn't match. */
+ return gimple_seq_may_fallthru (gimple_eh_filter_failure (gsi_stmt (i)));
+
+ default:
+ /* This case represents statements to be executed when an
+ exception occurs. Those statements are implicitly followed
+ by a GIMPLE_RESX to resume execution after the exception. So
+ in this case the try/catch never falls through. */
+ return false;
+ }
+}
+
+
/* Try to determine if we can fall out of the bottom of BLOCK. This guess
need not be 100% accurate; simply be conservative and return true if we
don't know. This is used only to avoid stupidly generating extra code.
@@ -440,9 +538,9 @@ block_may_fallthru (const_tree block)
return (block_may_fallthru (TREE_OPERAND (stmt, 0))
&& block_may_fallthru (TREE_OPERAND (stmt, 1)));
- case GIMPLE_MODIFY_STMT:
- if (TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 1)) == CALL_EXPR)
- stmt = GIMPLE_STMT_OPERAND (stmt, 1);
+ case MODIFY_EXPR:
+ if (TREE_CODE (TREE_OPERAND (stmt, 1)) == CALL_EXPR)
+ stmt = TREE_OPERAND (stmt, 1);
else
return true;
/* FALLTHRU */
@@ -459,138 +557,110 @@ block_may_fallthru (const_tree block)
}
}
-/* Lower a cond_expr TSI. DATA is passed through the recursion. */
-static void
-lower_cond_expr (tree_stmt_iterator *tsi, struct lower_data *data)
+/* Try to determine if we can continue executing the statement
+ immediately following STMT. This guess need not be 100% accurate;
+ simply be conservative and return true if we don't know. This is
+ used only to avoid stupidly generating extra code. If we're wrong,
+ we'll just delete the extra code later. */
+
+bool
+gimple_stmt_may_fallthru (gimple stmt)
{
- tree stmt = tsi_stmt (*tsi);
- bool then_is_goto, else_is_goto;
- tree then_branch, else_branch;
- tree then_goto, else_goto;
-
- then_branch = COND_EXPR_THEN (stmt);
- else_branch = COND_EXPR_ELSE (stmt);
+ if (!stmt)
+ return true;
- lower_stmt_body (then_branch, data);
- lower_stmt_body (else_branch, data);
+ switch (gimple_code (stmt))
+ {
+ case GIMPLE_GOTO:
+ case GIMPLE_RETURN:
+ case GIMPLE_RESX:
+ /* Easy cases. If the last statement of the seq implies
+ control transfer, then we can't fall through. */
+ return false;
- then_goto = expr_only (then_branch);
- then_is_goto = then_goto && simple_goto_p (then_goto);
+ case GIMPLE_SWITCH:
+ /* Switch has already been lowered and represents a
+ branch to a selected label and hence can not fall through. */
+ return true;
- else_goto = expr_only (else_branch);
- else_is_goto = else_goto && simple_goto_p (else_goto);
+ case GIMPLE_COND:
+ /* GIMPLE_COND's are already lowered into a two-way branch. They
+ can't fall through. */
+ return false;
- if (!then_is_goto || !else_is_goto)
- {
- tree then_label, else_label, end_label, t;
-
- then_label = NULL_TREE;
- else_label = NULL_TREE;
- end_label = NULL_TREE;
-
- /* Replace the cond_expr with explicit gotos. */
- if (!then_is_goto)
- {
- t = build1 (LABEL_EXPR, void_type_node, NULL_TREE);
- if (TREE_SIDE_EFFECTS (then_branch))
- then_label = t;
- else
- end_label = t;
- then_goto = build_and_jump (&LABEL_EXPR_LABEL (t));
- }
+ case GIMPLE_BIND:
+ return gimple_seq_may_fallthru (gimple_bind_body (stmt));
- if (!else_is_goto)
- {
- t = build1 (LABEL_EXPR, void_type_node, NULL_TREE);
- if (TREE_SIDE_EFFECTS (else_branch))
- else_label = t;
- else
- {
- /* Both THEN and ELSE can be no-ops if one or both contained an
- empty BIND_EXPR that was associated with the toplevel block
- of an inlined function. In that case remove_useless_stmts
- can't have cleaned things up for us; kill the whole
- conditional now. */
- if (end_label)
- {
- tsi_delink (tsi);
- return;
- }
- else
- end_label = t;
- }
- else_goto = build_and_jump (&LABEL_EXPR_LABEL (t));
- }
+ case GIMPLE_TRY:
+ if (gimple_try_kind (stmt) == GIMPLE_TRY_CATCH)
+ return gimple_try_catch_may_fallthru (stmt);
- if (then_label)
- {
- bool may_fallthru = block_may_fallthru (then_branch);
+ /* It must be a GIMPLE_TRY_FINALLY. */
- tsi_link_after (tsi, then_label, TSI_CONTINUE_LINKING);
- tsi_link_after (tsi, then_branch, TSI_CONTINUE_LINKING);
-
- if (else_label && may_fallthru)
- {
- end_label = build1 (LABEL_EXPR, void_type_node, NULL_TREE);
- t = build_and_jump (&LABEL_EXPR_LABEL (end_label));
- tsi_link_after (tsi, t, TSI_CONTINUE_LINKING);
- }
- }
-
- if (else_label)
- {
- tsi_link_after (tsi, else_label, TSI_CONTINUE_LINKING);
- tsi_link_after (tsi, else_branch, TSI_CONTINUE_LINKING);
- }
+ /* The finally clause is always executed after the try clause,
+ so if it does not fall through, then the try-finally will not
+ fall through. Otherwise, if the try clause does not fall
+ through, then when the finally clause falls through it will
+ resume execution wherever the try clause was going. So the
+ whole try-finally will only fall through if both the try
+ clause and the finally clause fall through. */
+ return (gimple_seq_may_fallthru (gimple_try_eval (stmt))
+ && gimple_seq_may_fallthru (gimple_try_cleanup (stmt)));
+
+ case GIMPLE_ASSIGN:
+ return true;
- if (end_label)
- tsi_link_after (tsi, end_label, TSI_CONTINUE_LINKING);
+ case GIMPLE_CALL:
+ /* Functions that do not return do not fall through. */
+ return (gimple_call_flags (stmt) & ECF_NORETURN) == 0;
+
+ default:
+ return true;
}
+}
+
- COND_EXPR_THEN (stmt) = then_goto;
- COND_EXPR_ELSE (stmt) = else_goto;
+/* Same as gimple_stmt_may_fallthru, but for the gimple sequence SEQ. */
- tsi_next (tsi);
+bool
+gimple_seq_may_fallthru (gimple_seq seq)
+{
+ return gimple_stmt_may_fallthru (gimple_seq_last_stmt (seq));
}
-/* Lower a return_expr TSI. DATA is passed through the recursion. */
+
+/* Lower a GIMPLE_RETURN GSI. DATA is passed through the recursion. */
static void
-lower_return_expr (tree_stmt_iterator *tsi, struct lower_data *data)
+lower_gimple_return (gimple_stmt_iterator *gsi, struct lower_data *data)
{
- tree stmt = tsi_stmt (*tsi);
- tree value, t, label;
-
- /* Extract the value being returned. */
- value = TREE_OPERAND (stmt, 0);
- if (value && TREE_CODE (value) == GIMPLE_MODIFY_STMT)
- value = GIMPLE_STMT_OPERAND (value, 1);
+ gimple stmt = gsi_stmt (*gsi);
+ gimple t;
+ int i;
+ return_statements_t tmp_rs;
/* Match this up with an existing return statement that's been created. */
- for (t = data->return_statements; t ; t = TREE_CHAIN (t))
+ for (i = VEC_length (return_statements_t, data->return_statements) - 1;
+ i >= 0; i--)
{
- tree tvalue = TREE_OPERAND (TREE_VALUE (t), 0);
- if (tvalue && TREE_CODE (tvalue) == GIMPLE_MODIFY_STMT)
- tvalue = GIMPLE_STMT_OPERAND (tvalue, 1);
+ tmp_rs = *VEC_index (return_statements_t, data->return_statements, i);
- if (value == tvalue)
- {
- label = TREE_PURPOSE (t);
- goto found;
- }
+ if (gimple_return_retval (stmt) == gimple_return_retval (tmp_rs.stmt))
+ goto found;
}
/* Not found. Create a new label and record the return statement. */
- label = create_artificial_label ();
- data->return_statements = tree_cons (label, stmt, data->return_statements);
+ tmp_rs.label = create_artificial_label ();
+ tmp_rs.stmt = stmt;
+ VEC_safe_push (return_statements_t, heap, data->return_statements, &tmp_rs);
/* Generate a goto statement and remove the return statement. */
found:
- t = build1 (GOTO_EXPR, void_type_node, label);
- SET_EXPR_LOCUS (t, EXPR_LOCUS (stmt));
- tsi_link_before (tsi, t, TSI_SAME_STMT);
- tsi_delink (tsi);
+ t = gimple_build_goto (tmp_rs.label);
+ gimple_set_location (t, gimple_location (stmt));
+ gsi_insert_before (gsi, t, GSI_SAME_STMT);
+ gsi_remove (gsi, false);
}
/* Lower a __builtin_setjmp TSI.
@@ -647,71 +717,66 @@ lower_return_expr (tree_stmt_iterator *tsi, struct lower_data *data)
to the receivers, thus keeping the complexity explosion localized. */
static void
-lower_builtin_setjmp (tree_stmt_iterator *tsi)
+lower_builtin_setjmp (gimple_stmt_iterator *gsi)
{
- tree stmt = tsi_stmt (*tsi);
+ gimple stmt = gsi_stmt (*gsi);
tree cont_label = create_artificial_label ();
tree next_label = create_artificial_label ();
tree dest, t, arg;
+ gimple g;
/* NEXT_LABEL is the label __builtin_longjmp will jump to. Its address is
passed to both __builtin_setjmp_setup and __builtin_setjmp_receiver. */
FORCED_LABEL (next_label) = 1;
- if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT)
- {
- dest = GIMPLE_STMT_OPERAND (stmt, 0);
- stmt = GIMPLE_STMT_OPERAND (stmt, 1);
- }
- else
- dest = NULL_TREE;
+ dest = gimple_call_lhs (stmt);
/* Build '__builtin_setjmp_setup (BUF, NEXT_LABEL)' and insert. */
arg = build_addr (next_label, current_function_decl);
t = implicit_built_in_decls[BUILT_IN_SETJMP_SETUP];
- t = build_call_expr (t, 2, CALL_EXPR_ARG (stmt, 0), arg);
- SET_EXPR_LOCUS (t, EXPR_LOCUS (stmt));
- tsi_link_before (tsi, t, TSI_SAME_STMT);
+ g = gimple_build_call (t, 2, gimple_call_arg (stmt, 0), arg);
+ gimple_set_location (g, gimple_location (stmt));
+ gsi_insert_before (gsi, g, GSI_SAME_STMT);
/* Build 'DEST = 0' and insert. */
if (dest)
{
- t = build_gimple_modify_stmt (dest, fold_convert (TREE_TYPE (dest),
- integer_zero_node));
- SET_EXPR_LOCUS (t, EXPR_LOCUS (stmt));
- tsi_link_before (tsi, t, TSI_SAME_STMT);
+ g = gimple_build_assign (dest, fold_convert (TREE_TYPE (dest),
+ integer_zero_node));
+ gimple_set_location (g, gimple_location (stmt));
+ gsi_insert_before (gsi, g, GSI_SAME_STMT);
}
/* Build 'goto CONT_LABEL' and insert. */
- t = build1 (GOTO_EXPR, void_type_node, cont_label);
- tsi_link_before (tsi, t, TSI_SAME_STMT);
+ g = gimple_build_goto (cont_label);
+ gsi_insert_before (gsi, g, TSI_SAME_STMT);
/* Build 'NEXT_LABEL:' and insert. */
- t = build1 (LABEL_EXPR, void_type_node, next_label);
- tsi_link_before (tsi, t, TSI_SAME_STMT);
+ g = gimple_build_label (next_label);
+ gsi_insert_before (gsi, g, GSI_SAME_STMT);
/* Build '__builtin_setjmp_receiver (NEXT_LABEL)' and insert. */
arg = build_addr (next_label, current_function_decl);
t = implicit_built_in_decls[BUILT_IN_SETJMP_RECEIVER];
- t = build_call_expr (t, 1, arg);
- SET_EXPR_LOCUS (t, EXPR_LOCUS (stmt));
- tsi_link_before (tsi, t, TSI_SAME_STMT);
+ g = gimple_build_call (t, 1, arg);
+ gimple_set_location (g, gimple_location (stmt));
+ gsi_insert_before (gsi, g, GSI_SAME_STMT);
/* Build 'DEST = 1' and insert. */
if (dest)
{
- t = build_gimple_modify_stmt (dest, fold_convert (TREE_TYPE (dest),
- integer_one_node));
- SET_EXPR_LOCUS (t, EXPR_LOCUS (stmt));
- tsi_link_before (tsi, t, TSI_SAME_STMT);
+ g = gimple_build_assign (dest, fold_convert (TREE_TYPE (dest),
+ integer_one_node));
+ gimple_set_location (g, gimple_location (stmt));
+ gsi_insert_before (gsi, g, GSI_SAME_STMT);
}
/* Build 'CONT_LABEL:' and insert. */
- t = build1 (LABEL_EXPR, void_type_node, cont_label);
- tsi_link_before (tsi, t, TSI_SAME_STMT);
+ g = gimple_build_label (cont_label);
+ gsi_insert_before (gsi, g, GSI_SAME_STMT);
/* Remove the call to __builtin_setjmp. */
- tsi_delink (tsi);
+ gsi_remove (gsi, false);
}
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
new file mode 100644
index 00000000000..d334d856982
--- /dev/null
+++ b/gcc/gimple-pretty-print.c
@@ -0,0 +1,1857 @@
+/* Pretty formatting of GIMPLE statements and expressions.
+ Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+ Free Software Foundation, Inc.
+ Contributed by Aldy Hernandez <aldyh@redhat.com> and
+ Diego Novillo <dnovillo@google.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "tree.h"
+#include "diagnostic.h"
+#include "real.h"
+#include "hashtab.h"
+#include "tree-flow.h"
+#include "tree-pass.h"
+#include "gimple.h"
+#include "value-prof.h"
+
+#define INDENT(SPACE) \
+ do { int i; for (i = 0; i < SPACE; i++) pp_space (buffer); } while (0)
+
+static pretty_printer buffer;
+static bool initialized = false;
+
+#define GIMPLE_NIY do_niy (buffer,gs)
+
+/* Try to print on BUFFER a default message for the unrecognized
+ gimple statement GS. */
+
+static void
+do_niy (pretty_printer *buffer, gimple gs)
+{
+ pp_printf (buffer, "<<< Unknown GIMPLE statement: %s >>>\n",
+ gimple_code_name[(int) gimple_code (gs)]);
+}
+
+
+/* Initialize the pretty printer on FILE if needed. */
+
+static void
+maybe_init_pretty_print (FILE *file)
+{
+ if (!initialized)
+ {
+ pp_construct (&buffer, NULL, 0);
+ pp_needs_newline (&buffer) = true;
+ initialized = true;
+ }
+
+ buffer.buffer->stream = file;
+}
+
+
+/* Emit a newline and SPC indentantion spaces to BUFFER. */
+
+static void
+newline_and_indent (pretty_printer *buffer, int spc)
+{
+ pp_newline (buffer);
+ INDENT (spc);
+}
+
+
+/* Print the GIMPLE statement GS on stderr. */
+
+void
+debug_gimple_stmt (gimple gs)
+{
+ print_gimple_stmt (stderr, gs, 0, TDF_VOPS|TDF_MEMSYMS);
+ fprintf (stderr, "\n");
+}
+
+
+/* Dump GIMPLE statement G to FILE using SPC indentantion spaces and
+ FLAGS as in dump_gimple_stmt. */
+
+void
+print_gimple_stmt (FILE *file, gimple g, int spc, int flags)
+{
+ maybe_init_pretty_print (file);
+ dump_gimple_stmt (&buffer, g, spc, flags);
+ pp_flush (&buffer);
+}
+
+
+/* Dump GIMPLE statement G to FILE using SPC indentantion spaces and
+ FLAGS as in dump_gimple_stmt. Print only the right-hand side
+ of the statement. */
+
+void
+print_gimple_expr (FILE *file, gimple g, int spc, int flags)
+{
+ flags |= TDF_RHS_ONLY;
+ maybe_init_pretty_print (file);
+ dump_gimple_stmt (&buffer, g, spc, flags);
+}
+
+
+/* Print the GIMPLE sequence SEQ on BUFFER using SPC indentantion
+ spaces and FLAGS as in dump_gimple_stmt. */
+
+static void
+dump_gimple_seq (pretty_printer *buffer, gimple_seq seq, int spc, int flags)
+{
+ gimple_stmt_iterator i;
+
+ for (i = gsi_start (seq); !gsi_end_p (i); gsi_next (&i))
+ {
+ gimple gs = gsi_stmt (i);
+ INDENT (spc);
+ dump_gimple_stmt (buffer, gs, spc, flags);
+ if (!gsi_one_before_end_p (i))
+ pp_newline (buffer);
+ }
+}
+
+
+/* Dump GIMPLE sequence SEQ to FILE using SPC indentantion spaces and
+ FLAGS as in dump_gimple_stmt. */
+
+void
+print_gimple_seq (FILE *file, gimple_seq seq, int spc, int flags)
+{
+ maybe_init_pretty_print (file);
+ dump_gimple_seq (&buffer, seq, spc, flags);
+ pp_flush (&buffer);
+}
+
+
+/* Print the GIMPLE sequence SEQ on stderr. */
+
+void
+debug_gimple_seq (gimple_seq seq)
+{
+ print_gimple_seq (stderr, seq, 0, TDF_VOPS|TDF_MEMSYMS);
+}
+
+
+/* A simple helper to pretty-print some of the gimple tuples in the printf
+ style. The format modifiers are preceeded by '%' and are:
+ 'G' - outputs a string corresponding to the code of the given gimple,
+ 'S' - outputs a gimple_seq with indent of spc + 2,
+ 'T' - outputs the tree t,
+ 'd' - outputs an int as a decimal,
+ 's' - outputs a string,
+ 'n' - outputs a newline,
+ '+' - increases indent by 2 then outputs a newline,
+ '-' - decreases indent by 2 then outputs a newline. */
+
+static void
+dump_gimple_fmt (pretty_printer *buffer, int spc, int flags,
+ const char *fmt, ...)
+{
+ va_list args;
+ const char *c;
+ const char *tmp;
+
+ va_start (args, fmt);
+ for (c = fmt; *c; c++)
+ {
+ if (*c == '%')
+ {
+ gimple_seq seq;
+ tree t;
+ gimple g;
+ switch (*++c)
+ {
+ case 'G':
+ g = va_arg (args, gimple);
+ tmp = gimple_code_name[gimple_code (g)];
+ pp_string (buffer, tmp);
+ break;
+
+ case 'S':
+ seq = va_arg (args, gimple_seq);
+ pp_newline (buffer);
+ dump_gimple_seq (buffer, seq, spc + 2, flags);
+ newline_and_indent (buffer, spc);
+ break;
+
+ case 'T':
+ t = va_arg (args, tree);
+ if (t == NULL_TREE)
+ pp_string (buffer, "NULL");
+ else
+ dump_generic_node (buffer, t, spc, flags, false);
+ break;
+
+ case 'd':
+ pp_decimal_int (buffer, va_arg (args, int));
+ break;
+
+ case 's':
+ pp_string (buffer, va_arg (args, char *));
+ break;
+
+ case 'n':
+ newline_and_indent (buffer, spc);
+ break;
+
+ case '+':
+ spc += 2;
+ newline_and_indent (buffer, spc);
+ break;
+
+ case '-':
+ spc -= 2;
+ newline_and_indent (buffer, spc);
+ break;
+
+ default:
+ gcc_unreachable ();
+ }
+ }
+ else
+ pp_character (buffer, *c);
+ }
+ va_end (args);
+}
+
+
+/* Helper for dump_gimple_assign. Print the unary RHS of the
+ assignment GS. BUFFER, SPC and FLAGS are as in dump_gimple_stmt. */
+
+static void
+dump_unary_rhs (pretty_printer *buffer, gimple gs, int spc, int flags)
+{
+ enum tree_code rhs_code = gimple_assign_rhs_code (gs);
+ tree lhs = gimple_assign_lhs (gs);
+ tree rhs = gimple_assign_rhs1 (gs);
+
+ switch (rhs_code)
+ {
+ case VIEW_CONVERT_EXPR:
+ case ASSERT_EXPR:
+ dump_generic_node (buffer, rhs, spc, flags, false);
+ break;
+
+ case FIXED_CONVERT_EXPR:
+ case FIX_TRUNC_EXPR:
+ case FLOAT_EXPR:
+ CASE_CONVERT:
+ pp_string (buffer, "(");
+ dump_generic_node (buffer, TREE_TYPE (lhs), spc, flags, false);
+ pp_string (buffer, ") ");
+ dump_generic_node (buffer, rhs, spc, flags, false);
+ break;
+
+ case PAREN_EXPR:
+ pp_string (buffer, "((");
+ dump_generic_node (buffer, rhs, spc, flags, false);
+ pp_string (buffer, "))");
+ break;
+
+ case ABS_EXPR:
+ pp_string (buffer, "ABS_EXPR <");
+ dump_generic_node (buffer, rhs, spc, flags, false);
+ pp_string (buffer, ">");
+ break;
+
+ default:
+ if (TREE_CODE_CLASS (rhs_code) == tcc_declaration
+ || TREE_CODE_CLASS (rhs_code) == tcc_constant
+ || TREE_CODE_CLASS (rhs_code) == tcc_reference
+ || rhs_code == SSA_NAME
+ || rhs_code == ADDR_EXPR
+ || rhs_code == CONSTRUCTOR)
+ ; /* do nothing. */
+ else if (rhs_code == BIT_NOT_EXPR)
+ pp_string (buffer, "~");
+ else if (rhs_code == TRUTH_NOT_EXPR)
+ pp_string (buffer, "!");
+ else if (rhs_code == NEGATE_EXPR)
+ pp_string (buffer, "-");
+ else
+ {
+ pp_string (buffer, "[");
+ pp_string (buffer, tree_code_name [rhs_code]);
+ pp_string (buffer, "] ");
+ }
+
+ dump_generic_node (buffer, rhs, spc, flags, false);
+ break;
+ }
+}
+
+
+/* Helper for dump_gimple_assign. Print the binary RHS of the
+ assignment GS. BUFFER, SPC and FLAGS are as in dump_gimple_stmt. */
+
+static void
+dump_binary_rhs (pretty_printer *buffer, gimple gs, int spc, int flags)
+{
+ switch (gimple_assign_rhs_code (gs))
+ {
+ case COMPLEX_EXPR:
+ pp_string (buffer, "COMPLEX_EXPR <");
+ dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
+ pp_string (buffer, ", ");
+ dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
+ pp_string (buffer, ">");
+ break;
+
+ case MIN_EXPR:
+ pp_string (buffer, "MIN_EXPR <");
+ dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
+ pp_string (buffer, ", ");
+ dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
+ pp_string (buffer, ">");
+ break;
+
+ case MAX_EXPR:
+ pp_string (buffer, "MAX_EXPR <");
+ dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
+ pp_string (buffer, ", ");
+ dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
+ pp_string (buffer, ">");
+ break;
+
+ default:
+ dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
+ pp_space (buffer);
+ pp_string (buffer, op_symbol_code (gimple_assign_rhs_code (gs)));
+ pp_space (buffer);
+ dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
+ }
+}
+
+
+/* Dump the gimple assignment GS. BUFFER, SPC and FLAGS are as in
+ dump_gimple_stmt. */
+
+static void
+dump_gimple_assign (pretty_printer *buffer, gimple gs, int spc, int flags)
+{
+ if (flags & TDF_RAW)
+ {
+ tree last;
+ if (gimple_num_ops (gs) == 2)
+ last = NULL_TREE;
+ else if (gimple_num_ops (gs) == 3)
+ last = gimple_assign_rhs2 (gs);
+ else
+ gcc_unreachable ();
+
+ dump_gimple_fmt (buffer, spc, flags, "%G <%s, %T, %T, %T>", gs,
+ tree_code_name[gimple_assign_rhs_code (gs)],
+ gimple_assign_lhs (gs), gimple_assign_rhs1 (gs), last);
+ }
+ else
+ {
+ if (!(flags & TDF_RHS_ONLY))
+ {
+ dump_generic_node (buffer, gimple_assign_lhs (gs), spc, flags, false);
+ pp_space (buffer);
+ pp_character (buffer, '=');
+
+ if (gimple_assign_nontemporal_move_p (gs))
+ pp_string (buffer, "{nt}");
+
+ if (gimple_has_volatile_ops (gs))
+ pp_string (buffer, "{v}");
+
+ pp_space (buffer);
+ }
+
+ if (gimple_num_ops (gs) == 2)
+ dump_unary_rhs (buffer, gs, spc, flags);
+ else if (gimple_num_ops (gs) == 3)
+ dump_binary_rhs (buffer, gs, spc, flags);
+ else
+ gcc_unreachable ();
+ if (!(flags & TDF_RHS_ONLY))
+ pp_semicolon(buffer);
+ }
+}
+
+
+/* Dump the return statement GS. BUFFER, SPC and FLAGS are as in
+ dump_gimple_stmt. */
+
+static void
+dump_gimple_return (pretty_printer *buffer, gimple gs, int spc, int flags)
+{
+ tree t;
+
+ t = gimple_return_retval (gs);
+ if (flags & TDF_RAW)
+ dump_gimple_fmt (buffer, spc, flags, "%G <%T>", gs, t);
+ else
+ {
+ pp_string (buffer, "return");
+ if (t)
+ {
+ pp_space (buffer);
+ dump_generic_node (buffer, t, spc, flags, false);
+ }
+ pp_semicolon (buffer);
+ }
+}
+
+
+/* Dump the call arguments for a gimple call. BUFFER, FLAGS are as in
+ dump_gimple_call. */
+
+static void
+dump_gimple_call_args (pretty_printer *buffer, gimple gs, int flags)
+{
+ size_t i;
+
+ for (i = 0; i < gimple_call_num_args (gs); i++)
+ {
+ dump_generic_node (buffer, gimple_call_arg (gs, i), 0, flags, false);
+ if (i < gimple_call_num_args (gs) - 1)
+ pp_string (buffer, ", ");
+ }
+
+ if (gimple_call_va_arg_pack_p (gs))
+ {
+ if (gimple_call_num_args (gs) > 0)
+ {
+ pp_character (buffer, ',');
+ pp_space (buffer);
+ }
+
+ pp_string (buffer, "__builtin_va_arg_pack ()");
+ }
+}
+
+
+/* Dump the call statement GS. BUFFER, SPC and FLAGS are as in
+ dump_gimple_stmt. */
+
+static void
+dump_gimple_call (pretty_printer *buffer, gimple gs, int spc, int flags)
+{
+ tree lhs = gimple_call_lhs (gs);
+
+ if (flags & TDF_RAW)
+ {
+ dump_gimple_fmt (buffer, spc, flags, "%G <%T, %T",
+ gs, gimple_call_fn (gs), lhs);
+ if (gimple_call_num_args (gs) > 0)
+ {
+ pp_string (buffer, ", ");
+ dump_gimple_call_args (buffer, gs, flags);
+ }
+ pp_string (buffer, ">");
+ }
+ else
+ {
+ if (lhs && !(flags & TDF_RHS_ONLY))
+ {
+ dump_generic_node (buffer, lhs, spc, flags, false);
+ pp_string (buffer, " =");
+
+ if (gimple_has_volatile_ops (gs))
+ pp_string (buffer, "{v}");
+
+ pp_space (buffer);
+ }
+ dump_generic_node (buffer, gimple_call_fn (gs), spc, flags, false);
+ pp_string (buffer, " (");
+ dump_gimple_call_args (buffer, gs, flags);
+ pp_string (buffer, ")");
+ if (!(flags & TDF_RHS_ONLY))
+ pp_semicolon (buffer);
+ }
+
+ if (gimple_call_chain (gs))
+ {
+ pp_string (buffer, " [static-chain: ");
+ dump_generic_node (buffer, gimple_call_chain (gs), spc, flags, false);
+ pp_character (buffer, ']');
+ }
+
+ if (gimple_call_return_slot_opt_p (gs))
+ pp_string (buffer, " [return slot optimization]");
+
+ if (gimple_call_tail_p (gs))
+ pp_string (buffer, " [tail call]");
+}
+
+
+/* Dump the switch statement GS. BUFFER, SPC and FLAGS are as in
+ dump_gimple_stmt. */
+
+static void
+dump_gimple_switch (pretty_printer *buffer, gimple gs, int spc, int flags)
+{
+ unsigned int i;
+
+ GIMPLE_CHECK (gs, GIMPLE_SWITCH);
+ if (flags & TDF_RAW)
+ dump_gimple_fmt (buffer, spc, flags, "%G <%T, ", gs,
+ gimple_switch_index (gs));
+ else
+ {
+ pp_string (buffer, "switch (");
+ dump_generic_node (buffer, gimple_switch_index (gs), spc, flags, true);
+ pp_string (buffer, ") <");
+ }
+
+ for (i = 0; i < gimple_switch_num_labels (gs); i++)
+ {
+ tree case_label = gimple_switch_label (gs, i);
+ if (case_label == NULL_TREE)
+ continue;
+
+ dump_generic_node (buffer, case_label, spc, flags, false);
+ pp_string (buffer, " ");
+ dump_generic_node (buffer, CASE_LABEL (case_label), spc, flags, false);
+ if (i < gimple_switch_num_labels (gs) - 1)
+ pp_string (buffer, ", ");
+ }
+ pp_string (buffer, ">");
+}
+
+
+/* Dump the gimple conditional GS. BUFFER, SPC and FLAGS are as in
+ dump_gimple_stmt. */
+
+static void
+dump_gimple_cond (pretty_printer *buffer, gimple gs, int spc, int flags)
+{
+ if (flags & TDF_RAW)
+ dump_gimple_fmt (buffer, spc, flags, "%G <%s, %T, %T, %T, %T>", gs,
+ tree_code_name [gimple_cond_code (gs)],
+ gimple_cond_lhs (gs), gimple_cond_rhs (gs),
+ gimple_cond_true_label (gs), gimple_cond_false_label (gs));
+ else
+ {
+ if (!(flags & TDF_RHS_ONLY))
+ pp_string (buffer, "if (");
+ dump_generic_node (buffer, gimple_cond_lhs (gs), spc, flags, false);
+ pp_space (buffer);
+ pp_string (buffer, op_symbol_code (gimple_cond_code (gs)));
+ pp_space (buffer);
+ dump_generic_node (buffer, gimple_cond_rhs (gs), spc, flags, false);
+ if (!(flags & TDF_RHS_ONLY))
+ {
+ pp_string (buffer, ")");
+
+ if (gimple_cond_true_label (gs))
+ {
+ pp_string (buffer, " goto ");
+ dump_generic_node (buffer, gimple_cond_true_label (gs),
+ spc, flags, false);
+ pp_semicolon (buffer);
+ }
+ if (gimple_cond_false_label (gs))
+ {
+ pp_string (buffer, " else goto ");
+ dump_generic_node (buffer, gimple_cond_false_label (gs),
+ spc, flags, false);
+ pp_semicolon (buffer);
+ }
+ }
+ }
+}
+
+
+/* Dump a GIMPLE_LABEL tuple on the pretty_printer BUFFER, SPC
+ spaces of indent. FLAGS specifies details to show in the dump (see
+ TDF_* in tree-pass.h). */
+
+static void
+dump_gimple_label (pretty_printer *buffer, gimple gs, int spc, int flags)
+{
+ tree label = gimple_label_label (gs);
+ if (flags & TDF_RAW)
+ dump_gimple_fmt (buffer, spc, flags, "%G <%T>", gs, label);
+ else
+ {
+ dump_generic_node (buffer, label, spc, flags, false);
+ pp_string (buffer, ":");
+ }
+ if (DECL_NONLOCAL (label))
+ pp_string (buffer, " [non-local]");
+}
+
+/* Dump a GIMPLE_GOTO tuple on the pretty_printer BUFFER, SPC
+ spaces of indent. FLAGS specifies details to show in the dump (see
+ TDF_* in tree-pass.h). */
+
+static void
+dump_gimple_goto (pretty_printer *buffer, gimple gs, int spc, int flags)
+{
+ tree label = gimple_goto_dest (gs);
+ if (flags & TDF_RAW)
+ dump_gimple_fmt (buffer, spc, flags, "%G <%T>", gs, label);
+ else
+ dump_gimple_fmt (buffer, spc, flags, "goto %T;", label);
+}
+
+
+/* Dump a GIMPLE_BIND tuple on the pretty_printer BUFFER, SPC
+ spaces of indent. FLAGS specifies details to show in the dump (see
+ TDF_* in tree-pass.h). */
+
+static void
+dump_gimple_bind (pretty_printer *buffer, gimple gs, int spc, int flags)
+{
+ if (flags & TDF_RAW)
+ dump_gimple_fmt (buffer, spc, flags, "%G <", gs);
+ else
+ pp_character (buffer, '{');
+ if (!(flags & TDF_SLIM))
+ {
+ tree var;
+
+ for (var = gimple_bind_vars (gs); var; var = TREE_CHAIN (var))
+ {
+ newline_and_indent (buffer, 2);
+ print_declaration (buffer, var, spc, flags);
+ }
+ if (gimple_bind_vars (gs))
+ pp_newline (buffer);
+ }
+ pp_newline (buffer);
+ dump_gimple_seq (buffer, gimple_bind_body (gs), spc + 2, flags);
+ newline_and_indent (buffer, spc);
+ if (flags & TDF_RAW)
+ pp_character (buffer, '>');
+ else
+ pp_character (buffer, '}');
+}
+
+
+/* Dump a GIMPLE_TRY tuple on the pretty_printer BUFFER, SPC spaces of
+ indent. FLAGS specifies details to show in the dump (see TDF_* in
+ tree-pass.h). */
+
+static void
+dump_gimple_try (pretty_printer *buffer, gimple gs, int spc, int flags)
+{
+ if (flags & TDF_RAW)
+ {
+ const char *type;
+ if (gimple_try_kind (gs) == GIMPLE_TRY_CATCH)
+ type = "GIMPLE_TRY_CATCH";
+ else if (gimple_try_kind (gs) == GIMPLE_TRY_FINALLY)
+ type = "GIMPLE_TRY_FINALLY";
+ else
+ type = "UNKNOWN GIMPLE_TRY";
+ dump_gimple_fmt (buffer, spc, flags,
+ "%G <%s,%+EVAL <%S>%nCLEANUP <%S>%->", gs, type,
+ gimple_try_eval (gs), gimple_try_cleanup (gs));
+ }
+ else
+ {
+ pp_string (buffer, "try");
+ newline_and_indent (buffer, spc + 2);
+ pp_string (buffer, "{");
+ pp_newline (buffer);
+
+ dump_gimple_seq (buffer, gimple_try_eval (gs), spc + 4, flags);
+ newline_and_indent (buffer, spc + 2);
+ pp_string (buffer, "}");
+
+ if (gimple_try_kind (gs) == GIMPLE_TRY_CATCH)
+ {
+ newline_and_indent (buffer, spc);
+ pp_string (buffer, "catch");
+ newline_and_indent (buffer, spc + 2);
+ pp_string (buffer, "{");
+ }
+ else if (gimple_try_kind (gs) == GIMPLE_TRY_FINALLY)
+ {
+ newline_and_indent (buffer, spc);
+ pp_string (buffer, "finally");
+ newline_and_indent (buffer, spc + 2);
+ pp_string (buffer, "{");
+ }
+ else
+ pp_string (buffer, " <UNKNOWN GIMPLE_TRY> {");
+
+ pp_newline (buffer);
+ dump_gimple_seq (buffer, gimple_try_cleanup (gs), spc + 4, flags);
+ newline_and_indent (buffer, spc + 2);
+ pp_character (buffer, '}');
+ }
+}
+
+
+/* Dump a GIMPLE_CATCH tuple on the pretty_printer BUFFER, SPC spaces of
+ indent. FLAGS specifies details to show in the dump (see TDF_* in
+ tree-pass.h). */
+
+static void
+dump_gimple_catch (pretty_printer *buffer, gimple gs, int spc, int flags)
+{
+ if (flags & TDF_RAW)
+ dump_gimple_fmt (buffer, spc, flags, "%G <%T, %+CATCH <%S>%->", gs,
+ gimple_catch_types (gs), gimple_catch_handler (gs));
+ else
+ dump_gimple_fmt (buffer, spc, flags, "catch (%T)%+{%S}",
+ gimple_catch_types (gs), gimple_catch_handler (gs));
+}
+
+
+/* Dump a GIMPLE_EH_FILTER tuple on the pretty_printer BUFFER, SPC spaces of
+ indent. FLAGS specifies details to show in the dump (see TDF_* in
+ tree-pass.h). */
+
+static void
+dump_gimple_eh_filter (pretty_printer *buffer, gimple gs, int spc, int flags)
+{
+ if (flags & TDF_RAW)
+ dump_gimple_fmt (buffer, spc, flags, "%G <%T, %+FAILURE <%S>%->", gs,
+ gimple_eh_filter_types (gs),
+ gimple_eh_filter_failure (gs));
+ else
+ dump_gimple_fmt (buffer, spc, flags, "<<<eh_filter (%T)>>>%+{%+%S%-}",
+ gimple_eh_filter_types (gs),
+ gimple_eh_filter_failure (gs));
+}
+
+
+/* Dump a GIMPLE_RESX tuple on the pretty_printer BUFFER, SPC spaces of
+ indent. FLAGS specifies details to show in the dump (see TDF_* in
+ tree-pass.h). */
+
+static void
+dump_gimple_resx (pretty_printer *buffer, gimple gs, int spc, int flags)
+{
+ if (flags & TDF_RAW)
+ dump_gimple_fmt (buffer, spc, flags, "%G <%d>", gs,
+ gimple_resx_region (gs));
+ else
+ dump_gimple_fmt (buffer, spc, flags, "resx %d", gimple_resx_region (gs));
+}
+
+/* Dump a GIMPLE_OMP_FOR tuple on the pretty_printer BUFFER. */
+static void
+dump_gimple_omp_for (pretty_printer *buffer, gimple gs, int spc, int flags)
+{
+ size_t i;
+
+ if (flags & TDF_RAW)
+ {
+ dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs,
+ gimple_omp_body (gs));
+ dump_omp_clauses (buffer, gimple_omp_for_clauses (gs), spc, flags);
+ dump_gimple_fmt (buffer, spc, flags, " >,");
+ for (i = 0; i < gimple_omp_for_collapse (gs); i++)
+ dump_gimple_fmt (buffer, spc, flags,
+ "%+%T, %T, %T, %s, %T,%n",
+ gimple_omp_for_index (gs, i),
+ gimple_omp_for_initial (gs, i),
+ gimple_omp_for_final (gs, i),
+ tree_code_name[gimple_omp_for_cond (gs, i)],
+ gimple_omp_for_incr (gs, i));
+ dump_gimple_fmt (buffer, spc, flags, "PRE_BODY <%S>%->",
+ gimple_omp_for_pre_body (gs));
+ }
+ else
+ {
+ pp_string (buffer, "#pragma omp for");
+ dump_omp_clauses (buffer, gimple_omp_for_clauses (gs), spc, flags);
+ for (i = 0; i < gimple_omp_for_collapse (gs); i++)
+ {
+ if (i)
+ spc += 2;
+ newline_and_indent (buffer, spc);
+ pp_string (buffer, "for (");
+ dump_generic_node (buffer, gimple_omp_for_index (gs, i), spc,
+ flags, false);
+ pp_string (buffer, " = ");
+ dump_generic_node (buffer, gimple_omp_for_initial (gs, i), spc,
+ flags, false);
+ pp_string (buffer, "; ");
+
+ dump_generic_node (buffer, gimple_omp_for_index (gs, i), spc,
+ flags, false);
+ pp_space (buffer);
+ switch (gimple_omp_for_cond (gs, i))
+ {
+ case LT_EXPR:
+ pp_character (buffer, '<');
+ break;
+ case GT_EXPR:
+ pp_character (buffer, '>');
+ break;
+ case LE_EXPR:
+ pp_string (buffer, "<=");
+ break;
+ case GE_EXPR:
+ pp_string (buffer, ">=");
+ break;
+ default:
+ gcc_unreachable ();
+ }
+ pp_space (buffer);
+ dump_generic_node (buffer, gimple_omp_for_final (gs, i), spc,
+ flags, false);
+ pp_string (buffer, "; ");
+
+ dump_generic_node (buffer, gimple_omp_for_index (gs, i), spc,
+ flags, false);
+ pp_string (buffer, " = ");
+ dump_generic_node (buffer, gimple_omp_for_incr (gs, i), spc,
+ flags, false);
+ pp_character (buffer, ')');
+ }
+
+ if (!gimple_seq_empty_p (gimple_omp_body (gs)))
+ {
+ newline_and_indent (buffer, spc + 2);
+ pp_character (buffer, '{');
+ pp_newline (buffer);
+ dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags);
+ newline_and_indent (buffer, spc + 2);
+ pp_character (buffer, '}');
+ }
+ }
+}
+
+/* Dump a GIMPLE_OMP_CONTINUE tuple on the pretty_printer BUFFER. */
+
+static void
+dump_gimple_omp_continue (pretty_printer *buffer, gimple gs, int spc, int flags)
+{
+ if (flags & TDF_RAW)
+ {
+ dump_gimple_fmt (buffer, spc, flags, "%G <%T, %T>", gs,
+ gimple_omp_continue_control_def (gs),
+ gimple_omp_continue_control_use (gs));
+ }
+ else
+ {
+ pp_string (buffer, "#pragma omp continue (");
+ dump_generic_node (buffer, gimple_omp_continue_control_def (gs),
+ spc, flags, false);
+ pp_character (buffer, ',');
+ pp_space (buffer);
+ dump_generic_node (buffer, gimple_omp_continue_control_use (gs),
+ spc, flags, false);
+ pp_character (buffer, ')');
+ }
+}
+
+/* Dump a GIMPLE_OMP_SINGLE tuple on the pretty_printer BUFFER. */
+
+static void
+dump_gimple_omp_single (pretty_printer *buffer, gimple gs, int spc, int flags)
+{
+ if (flags & TDF_RAW)
+ {
+ dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs,
+ gimple_omp_body (gs));
+ dump_omp_clauses (buffer, gimple_omp_single_clauses (gs), spc, flags);
+ dump_gimple_fmt (buffer, spc, flags, " >");
+ }
+ else
+ {
+ pp_string (buffer, "#pragma omp single");
+ dump_omp_clauses (buffer, gimple_omp_single_clauses (gs), spc, flags);
+ if (!gimple_seq_empty_p (gimple_omp_body (gs)))
+ {
+ newline_and_indent (buffer, spc + 2);
+ pp_character (buffer, '{');
+ pp_newline (buffer);
+ dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags);
+ newline_and_indent (buffer, spc + 2);
+ pp_character (buffer, '}');
+ }
+ }
+}
+
+/* Dump a GIMPLE_OMP_SECTIONS tuple on the pretty_printer BUFFER. */
+
+static void
+dump_gimple_omp_sections (pretty_printer *buffer, gimple gs, int spc,
+ int flags)
+{
+ if (flags & TDF_RAW)
+ {
+ dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs,
+ gimple_omp_body (gs));
+ dump_omp_clauses (buffer, gimple_omp_sections_clauses (gs), spc, flags);
+ dump_gimple_fmt (buffer, spc, flags, " >");
+ }
+ else
+ {
+ pp_string (buffer, "#pragma omp sections");
+ if (gimple_omp_sections_control (gs))
+ {
+ pp_string (buffer, " <");
+ dump_generic_node (buffer, gimple_omp_sections_control (gs), spc,
+ flags, false);
+ pp_character (buffer, '>');
+ }
+ dump_omp_clauses (buffer, gimple_omp_sections_clauses (gs), spc, flags);
+ if (!gimple_seq_empty_p (gimple_omp_body (gs)))
+ {
+ newline_and_indent (buffer, spc + 2);
+ pp_character (buffer, '{');
+ pp_newline (buffer);
+ dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags);
+ newline_and_indent (buffer, spc + 2);
+ pp_character (buffer, '}');
+ }
+ }
+}
+
+/* Dump a GIMPLE_OMP_{MASTER,ORDERED,SECTION} tuple on the pretty_printer
+ BUFFER. */
+
+static void
+dump_gimple_omp_block (pretty_printer *buffer, gimple gs, int spc, int flags)
+{
+ if (flags & TDF_RAW)
+ dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S> >", gs,
+ gimple_omp_body (gs));
+ else
+ {
+ switch (gimple_code (gs))
+ {
+ case GIMPLE_OMP_MASTER:
+ pp_string (buffer, "#pragma omp master");
+ break;
+ case GIMPLE_OMP_ORDERED:
+ pp_string (buffer, "#pragma omp ordered");
+ break;
+ case GIMPLE_OMP_SECTION:
+ pp_string (buffer, "#pragma omp section");
+ break;
+ default:
+ gcc_unreachable ();
+ }
+ if (!gimple_seq_empty_p (gimple_omp_body (gs)))
+ {
+ newline_and_indent (buffer, spc + 2);
+ pp_character (buffer, '{');
+ pp_newline (buffer);
+ dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags);
+ newline_and_indent (buffer, spc + 2);
+ pp_character (buffer, '}');
+ }
+ }
+}
+
+/* Dump a GIMPLE_OMP_CRITICAL tuple on the pretty_printer BUFFER. */
+
+static void
+dump_gimple_omp_critical (pretty_printer *buffer, gimple gs, int spc,
+ int flags)
+{
+ if (flags & TDF_RAW)
+ dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S> >", gs,
+ gimple_omp_body (gs));
+ else
+ {
+ pp_string (buffer, "#pragma omp critical");
+ if (gimple_omp_critical_name (gs))
+ {
+ pp_string (buffer, " (");
+ dump_generic_node (buffer, gimple_omp_critical_name (gs), spc,
+ flags, false);
+ pp_character (buffer, ')');
+ }
+ if (!gimple_seq_empty_p (gimple_omp_body (gs)))
+ {
+ newline_and_indent (buffer, spc + 2);
+ pp_character (buffer, '{');
+ pp_newline (buffer);
+ dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags);
+ newline_and_indent (buffer, spc + 2);
+ pp_character (buffer, '}');
+ }
+ }
+}
+
+/* Dump a GIMPLE_OMP_RETURN tuple on the pretty_printer BUFFER. */
+
+static void
+dump_gimple_omp_return (pretty_printer *buffer, gimple gs, int spc, int flags)
+{
+ if (flags & TDF_RAW)
+ {
+ dump_gimple_fmt (buffer, spc, flags, "%G <nowait=%d>", gs,
+ (int) gimple_omp_return_nowait_p (gs));
+ }
+ else
+ {
+ pp_string (buffer, "#pragma omp return");
+ if (gimple_omp_return_nowait_p (gs))
+ pp_string (buffer, "(nowait)");
+ }
+}
+
+/* Dump a GIMPLE_ASM tuple on the pretty_printer BUFFER, SPC spaces of
+ indent. FLAGS specifies details to show in the dump (see TDF_* in
+ tree-pass.h). */
+
+static void
+dump_gimple_asm (pretty_printer *buffer, gimple gs, int spc, int flags)
+{
+ unsigned int i;
+
+ if (flags & TDF_RAW)
+ dump_gimple_fmt (buffer, spc, flags, "%G <%+STRING <%n%s%n>", gs,
+ gimple_asm_string (gs));
+ else
+ {
+ pp_string (buffer, "__asm__");
+ if (gimple_asm_volatile_p (gs))
+ pp_string (buffer, " __volatile__");
+ pp_string (buffer, "(\"");
+ pp_string (buffer, gimple_asm_string (gs));
+ pp_string (buffer, "\"");
+ }
+
+ if (gimple_asm_ninputs (gs)
+ || gimple_asm_noutputs (gs)
+ || gimple_asm_nclobbers (gs))
+ {
+ if (gimple_asm_noutputs (gs))
+ {
+ if (flags & TDF_RAW)
+ {
+ newline_and_indent (buffer, spc + 2);
+ pp_string (buffer, "OUTPUT: ");
+ }
+ else
+ pp_string (buffer, " : ");
+ }
+
+ for (i = 0; i < gimple_asm_noutputs (gs); i++)
+ {
+ dump_generic_node (buffer, gimple_asm_output_op (gs, i), spc, flags,
+ false);
+ if ( i < gimple_asm_noutputs (gs) -1)
+ pp_string (buffer, ", ");
+ }
+
+ if (gimple_asm_ninputs (gs))
+ {
+ if (flags & TDF_RAW)
+ {
+ newline_and_indent (buffer, spc + 2);
+ pp_string (buffer, "INPUT: ");
+ }
+ else
+ pp_string (buffer, " : ");
+ }
+
+ for (i = 0; i < gimple_asm_ninputs (gs); i++)
+ {
+ dump_generic_node (buffer, gimple_asm_input_op (gs, i), spc, flags,
+ false);
+ if (i < gimple_asm_ninputs (gs) -1)
+ pp_string (buffer, " : ");
+ }
+
+ if (gimple_asm_nclobbers (gs))
+ {
+ if (flags & TDF_RAW)
+ {
+ newline_and_indent (buffer, spc + 2);
+ pp_string (buffer, "CLOBBER: ");
+ }
+ else
+ pp_string (buffer, " : ");
+ }
+
+ for (i = 0; i < gimple_asm_nclobbers (gs); i++)
+ {
+ dump_generic_node (buffer, gimple_asm_clobber_op (gs, i), spc, flags,
+ false);
+ if ( i < gimple_asm_nclobbers (gs) -1)
+ pp_string (buffer, ", ");
+ }
+ }
+ if (flags & TDF_RAW)
+ {
+ newline_and_indent (buffer, spc);
+ pp_character (buffer, '>');
+ }
+ else
+ pp_string (buffer, ");");
+}
+
+
+/* Dump the set of decls SYMS. BUFFER, SPC and FLAGS are as in
+ dump_generic_node. */
+
+static void
+dump_symbols (pretty_printer *buffer, bitmap syms, int flags)
+{
+ unsigned i;
+ bitmap_iterator bi;
+
+ if (syms == NULL)
+ pp_string (buffer, "NIL");
+ else
+ {
+ pp_string (buffer, " { ");
+
+ EXECUTE_IF_SET_IN_BITMAP (syms, 0, i, bi)
+ {
+ tree sym = referenced_var_lookup (i);
+ dump_generic_node (buffer, sym, 0, flags, false);
+ pp_string (buffer, " ");
+ }
+
+ pp_string (buffer, "}");
+ }
+}
+
+
+/* Dump a PHI node PHI. BUFFER, SPC and FLAGS are as in
+ dump_gimple_stmt. */
+
+static void
+dump_gimple_phi (pretty_printer *buffer, gimple phi, int spc, int flags)
+{
+ size_t i;
+
+ if (flags & TDF_RAW)
+ dump_gimple_fmt (buffer, spc, flags, "%G <%T, ", phi,
+ gimple_phi_result (phi));
+ else
+ {
+ dump_generic_node (buffer, gimple_phi_result (phi), spc, flags, false);
+ pp_string (buffer, " = PHI <");
+ }
+ for (i = 0; i < gimple_phi_num_args (phi); i++)
+ {
+ dump_generic_node (buffer, gimple_phi_arg_def (phi, i), spc, flags,
+ false);
+ pp_string (buffer, "(");
+ pp_decimal_int (buffer, gimple_phi_arg_edge (phi, i)->src->index);
+ pp_string (buffer, ")");
+ if (i < gimple_phi_num_args (phi) - 1)
+ pp_string (buffer, ", ");
+ }
+ pp_string (buffer, ">");
+}
+
+
+/* Dump a GIMPLE_OMP_PARALLEL tuple on the pretty_printer BUFFER, SPC spaces
+ of indent. FLAGS specifies details to show in the dump (see TDF_* in
+ tree-pass.h). */
+
+static void
+dump_gimple_omp_parallel (pretty_printer *buffer, gimple gs, int spc,
+ int flags)
+{
+ if (flags & TDF_RAW)
+ {
+ dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs,
+ gimple_omp_body (gs));
+ dump_omp_clauses (buffer, gimple_omp_parallel_clauses (gs), spc, flags);
+ dump_gimple_fmt (buffer, spc, flags, " >, %T, %T%n>",
+ gimple_omp_parallel_child_fn (gs),
+ gimple_omp_parallel_data_arg (gs));
+ }
+ else
+ {
+ gimple_seq body;
+ pp_string (buffer, "#pragma omp parallel");
+ dump_omp_clauses (buffer, gimple_omp_parallel_clauses (gs), spc, flags);
+ if (gimple_omp_parallel_child_fn (gs))
+ {
+ pp_string (buffer, " [child fn: ");
+ dump_generic_node (buffer, gimple_omp_parallel_child_fn (gs),
+ spc, flags, false);
+ pp_string (buffer, " (");
+ if (gimple_omp_parallel_data_arg (gs))
+ dump_generic_node (buffer, gimple_omp_parallel_data_arg (gs),
+ spc, flags, false);
+ else
+ pp_string (buffer, "???");
+ pp_string (buffer, ")]");
+ }
+ body = gimple_omp_body (gs);
+ if (body && gimple_code (gimple_seq_first_stmt (body)) != GIMPLE_BIND)
+ {
+ newline_and_indent (buffer, spc + 2);
+ pp_character (buffer, '{');
+ pp_newline (buffer);
+ dump_gimple_seq (buffer, body, spc + 4, flags);
+ newline_and_indent (buffer, spc + 2);
+ pp_character (buffer, '}');
+ }
+ else if (body)
+ {
+ pp_newline (buffer);
+ dump_gimple_seq (buffer, body, spc + 2, flags);
+ }
+ }
+}
+
+
+/* Dump a GIMPLE_OMP_TASK tuple on the pretty_printer BUFFER, SPC spaces
+ of indent. FLAGS specifies details to show in the dump (see TDF_* in
+ tree-pass.h). */
+
+static void
+dump_gimple_omp_task (pretty_printer *buffer, gimple gs, int spc,
+ int flags)
+{
+ if (flags & TDF_RAW)
+ {
+ dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs,
+ gimple_omp_body (gs));
+ dump_omp_clauses (buffer, gimple_omp_task_clauses (gs), spc, flags);
+ dump_gimple_fmt (buffer, spc, flags, " >, %T, %T, %T, %T, %T%n>",
+ gimple_omp_task_child_fn (gs),
+ gimple_omp_task_data_arg (gs),
+ gimple_omp_task_copy_fn (gs),
+ gimple_omp_task_arg_size (gs),
+ gimple_omp_task_arg_size (gs));
+ }
+ else
+ {
+ gimple_seq body;
+ pp_string (buffer, "#pragma omp task");
+ dump_omp_clauses (buffer, gimple_omp_task_clauses (gs), spc, flags);
+ if (gimple_omp_task_child_fn (gs))
+ {
+ pp_string (buffer, " [child fn: ");
+ dump_generic_node (buffer, gimple_omp_task_child_fn (gs),
+ spc, flags, false);
+ pp_string (buffer, " (");
+ if (gimple_omp_task_data_arg (gs))
+ dump_generic_node (buffer, gimple_omp_task_data_arg (gs),
+ spc, flags, false);
+ else
+ pp_string (buffer, "???");
+ pp_string (buffer, ")]");
+ }
+ body = gimple_omp_body (gs);
+ if (body && gimple_code (gimple_seq_first_stmt (body)) != GIMPLE_BIND)
+ {
+ newline_and_indent (buffer, spc + 2);
+ pp_character (buffer, '{');
+ pp_newline (buffer);
+ dump_gimple_seq (buffer, body, spc + 4, flags);
+ newline_and_indent (buffer, spc + 2);
+ pp_character (buffer, '}');
+ }
+ else if (body)
+ {
+ pp_newline (buffer);
+ dump_gimple_seq (buffer, body, spc + 2, flags);
+ }
+ }
+}
+
+
+/* Dump a GIMPLE_OMP_ATOMIC_LOAD tuple on the pretty_printer BUFFER, SPC
+ spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
+ in tree-pass.h). */
+
+static void
+dump_gimple_omp_atomic_load (pretty_printer *buffer, gimple gs, int spc,
+ int flags)
+{
+ if (flags & TDF_RAW)
+ {
+ dump_gimple_fmt (buffer, spc, flags, "%G <%T, %T>", gs,
+ gimple_omp_atomic_load_lhs (gs),
+ gimple_omp_atomic_load_rhs (gs));
+ }
+ else
+ {
+ pp_string (buffer, "#pragma omp atomic_load");
+ newline_and_indent (buffer, spc + 2);
+ dump_generic_node (buffer, gimple_omp_atomic_load_lhs (gs),
+ spc, flags, false);
+ pp_space (buffer);
+ pp_character (buffer, '=');
+ pp_space (buffer);
+ pp_character (buffer, '*');
+ dump_generic_node (buffer, gimple_omp_atomic_load_rhs (gs),
+ spc, flags, false);
+ }
+}
+
+/* Dump a GIMPLE_OMP_ATOMIC_STORE tuple on the pretty_printer BUFFER, SPC
+ spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
+ in tree-pass.h). */
+
+static void
+dump_gimple_omp_atomic_store (pretty_printer *buffer, gimple gs, int spc,
+ int flags)
+{
+ if (flags & TDF_RAW)
+ {
+ dump_gimple_fmt (buffer, spc, flags, "%G <%T>", gs,
+ gimple_omp_atomic_store_val (gs));
+ }
+ else
+ {
+ pp_string (buffer, "#pragma omp atomic_store (");
+ dump_generic_node (buffer, gimple_omp_atomic_store_val (gs),
+ spc, flags, false);
+ pp_character (buffer, ')');
+ }
+}
+
+/* Dump a GIMPLE_CHANGE_DYNAMIC_TYPE statement GS. BUFFER, SPC and
+ FLAGS are as in dump_gimple_stmt. */
+
+static void
+dump_gimple_cdt (pretty_printer *buffer, gimple gs, int spc, int flags)
+{
+ if (flags & TDF_RAW)
+ dump_gimple_fmt (buffer, spc, flags, "%G <%T, %T>", gs,
+ gimple_cdt_new_type (gs), gimple_cdt_location (gs));
+ else
+ {
+ pp_string (buffer, "<<<change_dynamic_type (");
+ dump_generic_node (buffer, gimple_cdt_new_type (gs), spc + 2, flags,
+ false);
+ pp_string (buffer, ") ");
+ dump_generic_node (buffer, gimple_cdt_location (gs), spc + 2, flags,
+ false);
+ pp_string (buffer, ")>>>");
+ }
+}
+
+
+/* Dump all the memory operands for statement GS. BUFFER, SPC and
+ FLAGS are as in dump_gimple_stmt. */
+
+static void
+dump_gimple_mem_ops (pretty_printer *buffer, gimple gs, int spc, int flags)
+{
+ struct voptype_d *vdefs;
+ struct voptype_d *vuses;
+ int i, n;
+
+ if (!ssa_operands_active () || !gimple_references_memory_p (gs))
+ return;
+
+ /* Even if the statement doesn't have virtual operators yet, it may
+ contain symbol information (this happens before aliases have been
+ computed). */
+ if ((flags & TDF_MEMSYMS)
+ && gimple_vuse_ops (gs) == NULL
+ && gimple_vdef_ops (gs) == NULL)
+ {
+ if (gimple_loaded_syms (gs))
+ {
+ pp_string (buffer, "# LOADS: ");
+ dump_symbols (buffer, gimple_loaded_syms (gs), flags);
+ newline_and_indent (buffer, spc);
+ }
+
+ if (gimple_stored_syms (gs))
+ {
+ pp_string (buffer, "# STORES: ");
+ dump_symbols (buffer, gimple_stored_syms (gs), flags);
+ newline_and_indent (buffer, spc);
+ }
+
+ return;
+ }
+
+ vuses = gimple_vuse_ops (gs);
+ while (vuses)
+ {
+ pp_string (buffer, "# VUSE <");
+
+ n = VUSE_NUM (vuses);
+ for (i = 0; i < n; i++)
+ {
+ dump_generic_node (buffer, VUSE_OP (vuses, i), spc + 2, flags, false);
+ if (i < n - 1)
+ pp_string (buffer, ", ");
+ }
+
+ pp_string (buffer, ">");
+
+ if (flags & TDF_MEMSYMS)
+ dump_symbols (buffer, gimple_loaded_syms (gs), flags);
+
+ newline_and_indent (buffer, spc);
+ vuses = vuses->next;
+ }
+
+ vdefs = gimple_vdef_ops (gs);
+ while (vdefs)
+ {
+ pp_string (buffer, "# ");
+ dump_generic_node (buffer, VDEF_RESULT (vdefs), spc + 2, flags, false);
+ pp_string (buffer, " = VDEF <");
+
+ n = VDEF_NUM (vdefs);
+ for (i = 0; i < n; i++)
+ {
+ dump_generic_node (buffer, VDEF_OP (vdefs, i), spc + 2, flags, 0);
+ if (i < n - 1)
+ pp_string (buffer, ", ");
+ }
+
+ pp_string (buffer, ">");
+
+ if ((flags & TDF_MEMSYMS) && vdefs->next == NULL)
+ dump_symbols (buffer, gimple_stored_syms (gs), flags);
+
+ newline_and_indent (buffer, spc);
+ vdefs = vdefs->next;
+ }
+}
+
+
+/* Dump the gimple statement GS on the pretty printer BUFFER, SPC
+ spaces of indent. FLAGS specifies details to show in the dump (see
+ TDF_* in tree-pass.h). */
+
+void
+dump_gimple_stmt (pretty_printer *buffer, gimple gs, int spc, int flags)
+{
+ if (!gs)
+ return;
+
+ if (flags & TDF_STMTADDR)
+ pp_printf (buffer, "<&%p> ", (void *) gs);
+
+ if ((flags & TDF_LINENO) && gimple_has_location (gs))
+ {
+ expanded_location xloc = expand_location (gimple_location (gs));
+ pp_character (buffer, '[');
+ if (xloc.file)
+ {
+ pp_string (buffer, xloc.file);
+ pp_string (buffer, " : ");
+ }
+ pp_decimal_int (buffer, xloc.line);
+ pp_string (buffer, "] ");
+ }
+
+ if ((flags & (TDF_VOPS|TDF_MEMSYMS))
+ && gimple_has_mem_ops (gs))
+ dump_gimple_mem_ops (buffer, gs, spc, flags);
+
+ switch (gimple_code (gs))
+ {
+ case GIMPLE_ASM:
+ dump_gimple_asm (buffer, gs, spc, flags);
+ break;
+
+ case GIMPLE_ASSIGN:
+ dump_gimple_assign (buffer, gs, spc, flags);
+ break;
+
+ case GIMPLE_BIND:
+ dump_gimple_bind (buffer, gs, spc, flags);
+ break;
+
+ case GIMPLE_CALL:
+ dump_gimple_call (buffer, gs, spc, flags);
+ break;
+
+ case GIMPLE_COND:
+ dump_gimple_cond (buffer, gs, spc, flags);
+ break;
+
+ case GIMPLE_LABEL:
+ dump_gimple_label (buffer, gs, spc, flags);
+ break;
+
+ case GIMPLE_GOTO:
+ dump_gimple_goto (buffer, gs, spc, flags);
+ break;
+
+ case GIMPLE_NOP:
+ pp_string (buffer, "GIMPLE_NOP");
+ break;
+
+ case GIMPLE_RETURN:
+ dump_gimple_return (buffer, gs, spc, flags);
+ break;
+
+ case GIMPLE_SWITCH:
+ dump_gimple_switch (buffer, gs, spc, flags);
+ break;
+
+ case GIMPLE_TRY:
+ dump_gimple_try (buffer, gs, spc, flags);
+ break;
+
+ case GIMPLE_PHI:
+ dump_gimple_phi (buffer, gs, spc, flags);
+ break;
+
+ case GIMPLE_OMP_PARALLEL:
+ dump_gimple_omp_parallel (buffer, gs, spc, flags);
+ break;
+
+ case GIMPLE_OMP_TASK:
+ dump_gimple_omp_task (buffer, gs, spc, flags);
+ break;
+
+ case GIMPLE_OMP_ATOMIC_LOAD:
+ dump_gimple_omp_atomic_load (buffer, gs, spc, flags);
+
+ break;
+
+ case GIMPLE_OMP_ATOMIC_STORE:
+ dump_gimple_omp_atomic_store (buffer, gs, spc, flags);
+ break;
+
+ case GIMPLE_OMP_FOR:
+ dump_gimple_omp_for (buffer, gs, spc, flags);
+ break;
+
+ case GIMPLE_OMP_CONTINUE:
+ dump_gimple_omp_continue (buffer, gs, spc, flags);
+ break;
+
+ case GIMPLE_OMP_SINGLE:
+ dump_gimple_omp_single (buffer, gs, spc, flags);
+ break;
+
+ case GIMPLE_OMP_RETURN:
+ dump_gimple_omp_return (buffer, gs, spc, flags);
+ break;
+
+ case GIMPLE_OMP_SECTIONS:
+ dump_gimple_omp_sections (buffer, gs, spc, flags);
+ break;
+
+ case GIMPLE_OMP_SECTIONS_SWITCH:
+ pp_string (buffer, "GIMPLE_SECTIONS_SWITCH");
+ break;
+
+ case GIMPLE_OMP_MASTER:
+ case GIMPLE_OMP_ORDERED:
+ case GIMPLE_OMP_SECTION:
+ dump_gimple_omp_block (buffer, gs, spc, flags);
+ break;
+
+ case GIMPLE_OMP_CRITICAL:
+ dump_gimple_omp_critical (buffer, gs, spc, flags);
+ break;
+
+ case GIMPLE_CHANGE_DYNAMIC_TYPE:
+ dump_gimple_cdt (buffer, gs, spc, flags);
+ break;
+
+ case GIMPLE_CATCH:
+ dump_gimple_catch (buffer, gs, spc, flags);
+ break;
+
+ case GIMPLE_EH_FILTER:
+ dump_gimple_eh_filter (buffer, gs, spc, flags);
+ break;
+
+ case GIMPLE_RESX:
+ dump_gimple_resx (buffer, gs, spc, flags);
+ break;
+
+ case GIMPLE_PREDICT:
+ pp_string (buffer, "// predicted ");
+ if (gimple_predict_outcome (gs))
+ pp_string (buffer, "likely by ");
+ else
+ pp_string (buffer, "unlikely by ");
+ pp_string (buffer, predictor_name (gimple_predict_predictor (gs)));
+ pp_string (buffer, " predictor.");
+ break;
+
+ default:
+ GIMPLE_NIY;
+ }
+
+ /* If we're building a diagnostic, the formatted text will be
+ written into BUFFER's stream by the caller; otherwise, write it
+ now. */
+ if (!(flags & TDF_DIAGNOSTIC))
+ pp_write_text_to_stream (buffer);
+}
+
+
+/* Dumps header of basic block BB to buffer BUFFER indented by INDENT
+ spaces and details described by flags. */
+
+static void
+dump_bb_header (pretty_printer *buffer, basic_block bb, int indent, int flags)
+{
+ edge e;
+ gimple stmt;
+ edge_iterator ei;
+
+ if (flags & TDF_BLOCKS)
+ {
+ INDENT (indent);
+ pp_string (buffer, "# BLOCK ");
+ pp_decimal_int (buffer, bb->index);
+ if (bb->frequency)
+ {
+ pp_string (buffer, " freq:");
+ pp_decimal_int (buffer, bb->frequency);
+ }
+ if (bb->count)
+ {
+ pp_string (buffer, " count:");
+ pp_widest_integer (buffer, bb->count);
+ }
+
+ if (flags & TDF_LINENO)
+ {
+ gimple_stmt_iterator gsi;
+
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ if (get_lineno (gsi_stmt (gsi)) != -1)
+ {
+ pp_string (buffer, ", starting at line ");
+ pp_decimal_int (buffer, get_lineno (gsi_stmt (gsi)));
+ break;
+ }
+ }
+ newline_and_indent (buffer, indent);
+
+ pp_string (buffer, "# PRED:");
+ pp_write_text_to_stream (buffer);
+ FOR_EACH_EDGE (e, ei, bb->preds)
+ if (flags & TDF_SLIM)
+ {
+ pp_string (buffer, " ");
+ if (e->src == ENTRY_BLOCK_PTR)
+ pp_string (buffer, "ENTRY");
+ else
+ pp_decimal_int (buffer, e->src->index);
+ }
+ else
+ dump_edge_info (buffer->buffer->stream, e, 0);
+ pp_newline (buffer);
+ }
+ else
+ {
+ stmt = first_stmt (bb);
+ if (!stmt || gimple_code (stmt) != GIMPLE_LABEL)
+ {
+ INDENT (indent - 2);
+ pp_string (buffer, "<bb ");
+ pp_decimal_int (buffer, bb->index);
+ pp_string (buffer, ">:");
+ pp_newline (buffer);
+ }
+ }
+ pp_write_text_to_stream (buffer);
+ check_bb_profile (bb, buffer->buffer->stream);
+}
+
+
+/* Dumps end of basic block BB to buffer BUFFER indented by INDENT
+ spaces. */
+
+static void
+dump_bb_end (pretty_printer *buffer, basic_block bb, int indent, int flags)
+{
+ edge e;
+ edge_iterator ei;
+
+ INDENT (indent);
+ pp_string (buffer, "# SUCC:");
+ pp_write_text_to_stream (buffer);
+ FOR_EACH_EDGE (e, ei, bb->succs)
+ if (flags & TDF_SLIM)
+ {
+ pp_string (buffer, " ");
+ if (e->dest == EXIT_BLOCK_PTR)
+ pp_string (buffer, "EXIT");
+ else
+ pp_decimal_int (buffer, e->dest->index);
+ }
+ else
+ dump_edge_info (buffer->buffer->stream, e, 1);
+ pp_newline (buffer);
+}
+
+
+/* Dump PHI nodes of basic block BB to BUFFER with details described
+ by FLAGS and indented by INDENT spaces. */
+
+static void
+dump_phi_nodes (pretty_printer *buffer, basic_block bb, int indent, int flags)
+{
+ gimple_stmt_iterator i;
+
+ for (i = gsi_start_phis (bb); !gsi_end_p (i); gsi_next (&i))
+ {
+ gimple phi = gsi_stmt (i);
+ if (is_gimple_reg (gimple_phi_result (phi)) || (flags & TDF_VOPS))
+ {
+ INDENT (indent);
+ pp_string (buffer, "# ");
+ dump_gimple_phi (buffer, phi, indent, flags);
+ pp_newline (buffer);
+ }
+ }
+}
+
+
+/* Dump jump to basic block BB that is represented implicitly in the cfg
+ to BUFFER. */
+
+static void
+pp_cfg_jump (pretty_printer *buffer, basic_block bb)
+{
+ gimple stmt;
+
+ stmt = first_stmt (bb);
+
+ pp_string (buffer, "goto <bb ");
+ pp_decimal_int (buffer, bb->index);
+ pp_string (buffer, ">");
+ if (stmt && gimple_code (stmt) == GIMPLE_LABEL)
+ {
+ pp_string (buffer, " (");
+ dump_generic_node (buffer, gimple_label_label (stmt), 0, 0, false);
+ pp_string (buffer, ")");
+ pp_semicolon (buffer);
+ }
+ else
+ pp_semicolon (buffer);
+}
+
+
+/* Dump edges represented implicitly in basic block BB to BUFFER, indented
+ by INDENT spaces, with details given by FLAGS. */
+
+static void
+dump_implicit_edges (pretty_printer *buffer, basic_block bb, int indent,
+ int flags)
+{
+ edge e;
+ edge_iterator ei;
+ gimple stmt;
+
+ stmt = last_stmt (bb);
+
+ if (stmt && gimple_code (stmt) == GIMPLE_COND)
+ {
+ edge true_edge, false_edge;
+
+ /* When we are emitting the code or changing CFG, it is possible that
+ the edges are not yet created. When we are using debug_bb in such
+ a situation, we do not want it to crash. */
+ if (EDGE_COUNT (bb->succs) != 2)
+ return;
+ extract_true_false_edges_from_block (bb, &true_edge, &false_edge);
+
+ INDENT (indent + 2);
+ pp_cfg_jump (buffer, true_edge->dest);
+ newline_and_indent (buffer, indent);
+ pp_string (buffer, "else");
+ newline_and_indent (buffer, indent + 2);
+ pp_cfg_jump (buffer, false_edge->dest);
+ pp_newline (buffer);
+ return;
+ }
+
+ /* If there is a fallthru edge, we may need to add an artificial
+ goto to the dump. */
+ FOR_EACH_EDGE (e, ei, bb->succs)
+ if (e->flags & EDGE_FALLTHRU)
+ break;
+
+ if (e && e->dest != bb->next_bb)
+ {
+ INDENT (indent);
+
+ if ((flags & TDF_LINENO)
+ && e->goto_locus != UNKNOWN_LOCATION
+ )
+ {
+ expanded_location goto_xloc;
+ goto_xloc = expand_location (e->goto_locus);
+ pp_character (buffer, '[');
+ if (goto_xloc.file)
+ {
+ pp_string (buffer, goto_xloc.file);
+ pp_string (buffer, " : ");
+ }
+ pp_decimal_int (buffer, goto_xloc.line);
+ pp_string (buffer, "] ");
+ }
+
+ pp_cfg_jump (buffer, e->dest);
+ pp_newline (buffer);
+ }
+}
+
+
+/* Dumps basic block BB to buffer BUFFER with details described by FLAGS and
+ indented by INDENT spaces. */
+
+static void
+gimple_dump_bb_buff (pretty_printer *buffer, basic_block bb, int indent,
+ int flags)
+{
+ gimple_stmt_iterator gsi;
+ gimple stmt;
+ int label_indent = indent - 2;
+
+ if (label_indent < 0)
+ label_indent = 0;
+
+ dump_bb_header (buffer, bb, indent, flags);
+ dump_phi_nodes (buffer, bb, indent, flags);
+
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ {
+ int curr_indent;
+
+ stmt = gsi_stmt (gsi);
+
+ curr_indent = gimple_code (stmt) == GIMPLE_LABEL ? label_indent : indent;
+
+ INDENT (curr_indent);
+ dump_gimple_stmt (buffer, stmt, curr_indent, flags);
+ pp_newline (buffer);
+ dump_histograms_for_stmt (cfun, buffer->buffer->stream, stmt);
+ }
+
+ dump_implicit_edges (buffer, bb, indent, flags);
+
+ if (flags & TDF_BLOCKS)
+ dump_bb_end (buffer, bb, indent, flags);
+}
+
+
+/* Dumps basic block BB to FILE with details described by FLAGS and
+ indented by INDENT spaces. */
+
+void
+gimple_dump_bb (basic_block bb, FILE *file, int indent, int flags)
+{
+ maybe_init_pretty_print (file);
+ gimple_dump_bb_buff (&buffer, bb, indent, flags);
+ pp_flush (&buffer);
+}
diff --git a/gcc/gimple.c b/gcc/gimple.c
new file mode 100644
index 00000000000..6e8971f4ec1
--- /dev/null
+++ b/gcc/gimple.c
@@ -0,0 +1,3146 @@
+/* Gimple IR support functions.
+
+ Copyright 2007, 2008 Free Software Foundation, Inc.
+ Contributed by Aldy Hernandez <aldyh@redhat.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "tree.h"
+#include "ggc.h"
+#include "errors.h"
+#include "hard-reg-set.h"
+#include "basic-block.h"
+#include "gimple.h"
+#include "diagnostic.h"
+#include "tree-flow.h"
+#include "value-prof.h"
+#include "flags.h"
+
+#define DEFGSCODE(SYM, NAME, STRUCT) NAME,
+const char *const gimple_code_name[] = {
+#include "gimple.def"
+};
+#undef DEFGSCODE
+
+/* All the tuples have their operand vector at the very bottom
+ of the structure. Therefore, the offset required to find the
+ operands vector the size of the structure minus the size of the 1
+ element tree array at the end (see gimple_ops). */
+#define DEFGSCODE(SYM, NAME, STRUCT) (sizeof (STRUCT) - sizeof (tree)),
+const size_t gimple_ops_offset_[] = {
+#include "gimple.def"
+};
+#undef DEFGSCODE
+
+#ifdef GATHER_STATISTICS
+/* Gimple stats. */
+
+int gimple_alloc_counts[(int) gimple_alloc_kind_all];
+int gimple_alloc_sizes[(int) gimple_alloc_kind_all];
+
+/* Keep in sync with gimple.h:enum gimple_alloc_kind. */
+static const char * const gimple_alloc_kind_names[] = {
+ "assignments",
+ "phi nodes",
+ "conditionals",
+ "sequences",
+ "everything else"
+};
+
+#endif /* GATHER_STATISTICS */
+
+/* A cache of gimple_seq objects. Sequences are created and destroyed
+ fairly often during gimplification. */
+static GTY ((deletable)) struct gimple_seq_d *gimple_seq_cache;
+
+/* Private API manipulation functions shared only with some
+ other files. */
+extern void gimple_set_stored_syms (gimple, bitmap, bitmap_obstack *);
+extern void gimple_set_loaded_syms (gimple, bitmap, bitmap_obstack *);
+
+/* Gimple tuple constructors.
+ Note: Any constructor taking a ``gimple_seq'' as a parameter, can
+ be passed a NULL to start with an empty sequence. */
+
+/* Set the code for statement G to CODE. */
+
+static inline void
+gimple_set_code (gimple g, enum gimple_code code)
+{
+ g->gsbase.code = code;
+}
+
+
+/* Return the GSS_* identifier for the given GIMPLE statement CODE. */
+
+static enum gimple_statement_structure_enum
+gss_for_code (enum gimple_code code)
+{
+ switch (code)
+ {
+ case GIMPLE_ASSIGN:
+ case GIMPLE_CALL:
+ case GIMPLE_RETURN: return GSS_WITH_MEM_OPS;
+ case GIMPLE_COND:
+ case GIMPLE_GOTO:
+ case GIMPLE_LABEL:
+ case GIMPLE_CHANGE_DYNAMIC_TYPE:
+ case GIMPLE_SWITCH: return GSS_WITH_OPS;
+ case GIMPLE_ASM: return GSS_ASM;
+ case GIMPLE_BIND: return GSS_BIND;
+ case GIMPLE_CATCH: return GSS_CATCH;
+ case GIMPLE_EH_FILTER: return GSS_EH_FILTER;
+ case GIMPLE_NOP: return GSS_BASE;
+ case GIMPLE_PHI: return GSS_PHI;
+ case GIMPLE_RESX: return GSS_RESX;
+ case GIMPLE_TRY: return GSS_TRY;
+ case GIMPLE_WITH_CLEANUP_EXPR: return GSS_WCE;
+ case GIMPLE_OMP_CRITICAL: return GSS_OMP_CRITICAL;
+ case GIMPLE_OMP_FOR: return GSS_OMP_FOR;
+ case GIMPLE_OMP_MASTER:
+ case GIMPLE_OMP_ORDERED:
+ case GIMPLE_OMP_SECTION: return GSS_OMP;
+ case GIMPLE_OMP_RETURN:
+ case GIMPLE_OMP_SECTIONS_SWITCH: return GSS_BASE;
+ case GIMPLE_OMP_CONTINUE: return GSS_OMP_CONTINUE;
+ case GIMPLE_OMP_PARALLEL: return GSS_OMP_PARALLEL;
+ case GIMPLE_OMP_TASK: return GSS_OMP_TASK;
+ case GIMPLE_OMP_SECTIONS: return GSS_OMP_SECTIONS;
+ case GIMPLE_OMP_SINGLE: return GSS_OMP_SINGLE;
+ case GIMPLE_OMP_ATOMIC_LOAD: return GSS_OMP_ATOMIC_LOAD;
+ case GIMPLE_OMP_ATOMIC_STORE: return GSS_OMP_ATOMIC_STORE;
+ case GIMPLE_PREDICT: return GSS_BASE;
+ default: gcc_unreachable ();
+ }
+}
+
+
+/* Return the number of bytes needed to hold a GIMPLE statement with
+ code CODE. */
+
+static size_t
+gimple_size (enum gimple_code code)
+{
+ enum gimple_statement_structure_enum gss = gss_for_code (code);
+
+ if (gss == GSS_WITH_OPS)
+ return sizeof (struct gimple_statement_with_ops);
+ else if (gss == GSS_WITH_MEM_OPS)
+ return sizeof (struct gimple_statement_with_memory_ops);
+
+ switch (code)
+ {
+ case GIMPLE_ASM:
+ return sizeof (struct gimple_statement_asm);
+ case GIMPLE_NOP:
+ return sizeof (struct gimple_statement_base);
+ case GIMPLE_BIND:
+ return sizeof (struct gimple_statement_bind);
+ case GIMPLE_CATCH:
+ return sizeof (struct gimple_statement_catch);
+ case GIMPLE_EH_FILTER:
+ return sizeof (struct gimple_statement_eh_filter);
+ case GIMPLE_TRY:
+ return sizeof (struct gimple_statement_try);
+ case GIMPLE_RESX:
+ return sizeof (struct gimple_statement_resx);
+ case GIMPLE_OMP_CRITICAL:
+ return sizeof (struct gimple_statement_omp_critical);
+ case GIMPLE_OMP_FOR:
+ return sizeof (struct gimple_statement_omp_for);
+ case GIMPLE_OMP_PARALLEL:
+ return sizeof (struct gimple_statement_omp_parallel);
+ case GIMPLE_OMP_TASK:
+ return sizeof (struct gimple_statement_omp_task);
+ case GIMPLE_OMP_SECTION:
+ case GIMPLE_OMP_MASTER:
+ case GIMPLE_OMP_ORDERED:
+ return sizeof (struct gimple_statement_omp);
+ case GIMPLE_OMP_RETURN:
+ return sizeof (struct gimple_statement_base);
+ case GIMPLE_OMP_CONTINUE:
+ return sizeof (struct gimple_statement_omp_continue);
+ case GIMPLE_OMP_SECTIONS:
+ return sizeof (struct gimple_statement_omp_sections);
+ case GIMPLE_OMP_SECTIONS_SWITCH:
+ return sizeof (struct gimple_statement_base);
+ case GIMPLE_OMP_SINGLE:
+ return sizeof (struct gimple_statement_omp_single);
+ case GIMPLE_OMP_ATOMIC_LOAD:
+ return sizeof (struct gimple_statement_omp_atomic_load);
+ case GIMPLE_OMP_ATOMIC_STORE:
+ return sizeof (struct gimple_statement_omp_atomic_store);
+ case GIMPLE_WITH_CLEANUP_EXPR:
+ return sizeof (struct gimple_statement_wce);
+ case GIMPLE_CHANGE_DYNAMIC_TYPE:
+ return sizeof (struct gimple_statement_with_ops);
+ case GIMPLE_PREDICT:
+ return sizeof (struct gimple_statement_base);
+ default:
+ break;
+ }
+
+ gcc_unreachable ();
+}
+
+
+/* Allocate memory for a GIMPLE statement with code CODE and NUM_OPS
+ operands. */
+
+#define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
+static gimple
+gimple_alloc_stat (enum gimple_code code, unsigned num_ops MEM_STAT_DECL)
+{
+ size_t size;
+ gimple stmt;
+
+ size = gimple_size (code);
+ if (num_ops > 0)
+ size += sizeof (tree) * (num_ops - 1);
+
+#ifdef GATHER_STATISTICS
+ {
+ enum gimple_alloc_kind kind = gimple_alloc_kind (code);
+ gimple_alloc_counts[(int) kind]++;
+ gimple_alloc_sizes[(int) kind] += size;
+ }
+#endif
+
+ stmt = (gimple) ggc_alloc_cleared_stat (size PASS_MEM_STAT);
+ gimple_set_code (stmt, code);
+ gimple_set_num_ops (stmt, num_ops);
+
+ /* Do not call gimple_set_modified here as it has other side
+ effects and this tuple is still not completely built. */
+ stmt->gsbase.modified = 1;
+
+ return stmt;
+}
+
+/* Set SUBCODE to be the code of the expression computed by statement G. */
+
+static inline void
+gimple_set_subcode (gimple g, unsigned subcode)
+{
+ /* We only have 16 bits for the RHS code. Assert that we are not
+ overflowing it. */
+ gcc_assert (subcode < (1 << 16));
+ g->gsbase.subcode = subcode;
+}
+
+
+
+/* Build a tuple with operands. CODE is the statement to build (which
+ must be one of the GIMPLE_WITH_OPS tuples). SUBCODE is the sub-code
+ for the new tuple. NUM_OPS is the number of operands to allocate. */
+
+#define gimple_build_with_ops(c, s, n) \
+ gimple_build_with_ops_stat (c, s, n MEM_STAT_INFO)
+
+static gimple
+gimple_build_with_ops_stat (enum gimple_code code, enum tree_code subcode,
+ unsigned num_ops MEM_STAT_DECL)
+{
+ gimple s = gimple_alloc_stat (code, num_ops PASS_MEM_STAT);
+ gimple_set_subcode (s, subcode);
+
+ return s;
+}
+
+
+/* Build a GIMPLE_RETURN statement returning RETVAL. */
+
+gimple
+gimple_build_return (tree retval)
+{
+ gimple s = gimple_build_with_ops (GIMPLE_RETURN, 0, 1);
+ if (retval)
+ gimple_return_set_retval (s, retval);
+ return s;
+}
+
+/* Helper for gimple_build_call, gimple_build_call_vec and
+ gimple_build_call_from_tree. Build the basic components of a
+ GIMPLE_CALL statement to function FN with NARGS arguments. */
+
+static inline gimple
+gimple_build_call_1 (tree fn, unsigned nargs)
+{
+ gimple s = gimple_build_with_ops (GIMPLE_CALL, 0, nargs + 3);
+ if (TREE_CODE (fn) == FUNCTION_DECL)
+ fn = build_fold_addr_expr (fn);
+ gimple_set_op (s, 1, fn);
+ return s;
+}
+
+
+/* Build a GIMPLE_CALL statement to function FN with the arguments
+ specified in vector ARGS. */
+
+gimple
+gimple_build_call_vec (tree fn, VEC(tree, heap) *args)
+{
+ unsigned i;
+ unsigned nargs = VEC_length (tree, args);
+ gimple call = gimple_build_call_1 (fn, nargs);
+
+ for (i = 0; i < nargs; i++)
+ gimple_call_set_arg (call, i, VEC_index (tree, args, i));
+
+ return call;
+}
+
+
+/* Build a GIMPLE_CALL statement to function FN. NARGS is the number of
+ arguments. The ... are the arguments. */
+
+gimple
+gimple_build_call (tree fn, unsigned nargs, ...)
+{
+ va_list ap;
+ gimple call;
+ unsigned i;
+
+ gcc_assert (TREE_CODE (fn) == FUNCTION_DECL || is_gimple_call_addr (fn));
+
+ call = gimple_build_call_1 (fn, nargs);
+
+ va_start (ap, nargs);
+ for (i = 0; i < nargs; i++)
+ gimple_call_set_arg (call, i, va_arg (ap, tree));
+ va_end (ap);
+
+ return call;
+}
+
+
+/* Build a GIMPLE_CALL statement from CALL_EXPR T. Note that T is
+ assumed to be in GIMPLE form already. Minimal checking is done of
+ this fact. */
+
+gimple
+gimple_build_call_from_tree (tree t)
+{
+ unsigned i, nargs;
+ gimple call;
+ tree fndecl = get_callee_fndecl (t);
+
+ gcc_assert (TREE_CODE (t) == CALL_EXPR);
+
+ nargs = call_expr_nargs (t);
+ call = gimple_build_call_1 (fndecl ? fndecl : CALL_EXPR_FN (t), nargs);
+
+ for (i = 0; i < nargs; i++)
+ gimple_call_set_arg (call, i, CALL_EXPR_ARG (t, i));
+
+ gimple_set_block (call, TREE_BLOCK (t));
+
+ /* Carry all the CALL_EXPR flags to the new GIMPLE_CALL. */
+ gimple_call_set_chain (call, CALL_EXPR_STATIC_CHAIN (t));
+ gimple_call_set_tail (call, CALL_EXPR_TAILCALL (t));
+ gimple_call_set_cannot_inline (call, CALL_CANNOT_INLINE_P (t));
+ gimple_call_set_return_slot_opt (call, CALL_EXPR_RETURN_SLOT_OPT (t));
+ gimple_call_set_from_thunk (call, CALL_FROM_THUNK_P (t));
+ gimple_call_set_va_arg_pack (call, CALL_EXPR_VA_ARG_PACK (t));
+
+ return call;
+}
+
+
+/* Extract the operands and code for expression EXPR into *SUBCODE_P,
+ *OP1_P and *OP2_P respectively. */
+
+void
+extract_ops_from_tree (tree expr, enum tree_code *subcode_p, tree *op1_p,
+ tree *op2_p)
+{
+ enum gimple_rhs_class grhs_class;
+
+ *subcode_p = TREE_CODE (expr);
+ grhs_class = get_gimple_rhs_class (*subcode_p);
+
+ if (grhs_class == GIMPLE_BINARY_RHS)
+ {
+ *op1_p = TREE_OPERAND (expr, 0);
+ *op2_p = TREE_OPERAND (expr, 1);
+ }
+ else if (grhs_class == GIMPLE_UNARY_RHS)
+ {
+ *op1_p = TREE_OPERAND (expr, 0);
+ *op2_p = NULL_TREE;
+ }
+ else if (grhs_class == GIMPLE_SINGLE_RHS)
+ {
+ *op1_p = expr;
+ *op2_p = NULL_TREE;
+ }
+ else
+ gcc_unreachable ();
+}
+
+
+/* Build a GIMPLE_ASSIGN statement.
+
+ LHS of the assignment.
+ RHS of the assignment which can be unary or binary. */
+
+gimple
+gimple_build_assign_stat (tree lhs, tree rhs MEM_STAT_DECL)
+{
+ enum tree_code subcode;
+ tree op1, op2;
+
+ extract_ops_from_tree (rhs, &subcode, &op1, &op2);
+ return gimple_build_assign_with_ops_stat (subcode, lhs, op1, op2
+ PASS_MEM_STAT);
+}
+
+
+/* Build a GIMPLE_ASSIGN statement with sub-code SUBCODE and operands
+ OP1 and OP2. If OP2 is NULL then SUBCODE must be of class
+ GIMPLE_UNARY_RHS or GIMPLE_SINGLE_RHS. */
+
+gimple
+gimple_build_assign_with_ops_stat (enum tree_code subcode, tree lhs, tree op1,
+ tree op2 MEM_STAT_DECL)
+{
+ unsigned num_ops;
+ gimple p;
+
+ /* Need 1 operand for LHS and 1 or 2 for the RHS (depending on the
+ code). */
+ num_ops = get_gimple_rhs_num_ops (subcode) + 1;
+
+ p = gimple_build_with_ops_stat (GIMPLE_ASSIGN, subcode, num_ops
+ PASS_MEM_STAT);
+ gimple_assign_set_lhs (p, lhs);
+ gimple_assign_set_rhs1 (p, op1);
+ if (op2)
+ {
+ gcc_assert (num_ops > 2);
+ gimple_assign_set_rhs2 (p, op2);
+ }
+
+ return p;
+}
+
+
+/* Build a new GIMPLE_ASSIGN tuple and append it to the end of *SEQ_P.
+
+ DST/SRC are the destination and source respectively. You can pass
+ ungimplified trees in DST or SRC, in which case they will be
+ converted to a gimple operand if necessary.
+
+ This function returns the newly created GIMPLE_ASSIGN tuple. */
+
+inline gimple
+gimplify_assign (tree dst, tree src, gimple_seq *seq_p)
+{
+ tree t = build2 (MODIFY_EXPR, TREE_TYPE (dst), dst, src);
+ gimplify_and_add (t, seq_p);
+ ggc_free (t);
+ return gimple_seq_last_stmt (*seq_p);
+}
+
+
+/* Build a GIMPLE_COND statement.
+
+ PRED is the condition used to compare LHS and the RHS.
+ T_LABEL is the label to jump to if the condition is true.
+ F_LABEL is the label to jump to otherwise. */
+
+gimple
+gimple_build_cond (enum tree_code pred_code, tree lhs, tree rhs,
+ tree t_label, tree f_label)
+{
+ gimple p;
+
+ gcc_assert (TREE_CODE_CLASS (pred_code) == tcc_comparison);
+ p = gimple_build_with_ops (GIMPLE_COND, pred_code, 4);
+ gimple_cond_set_lhs (p, lhs);
+ gimple_cond_set_rhs (p, rhs);
+ gimple_cond_set_true_label (p, t_label);
+ gimple_cond_set_false_label (p, f_label);
+ return p;
+}
+
+
+/* Extract operands for a GIMPLE_COND statement out of COND_EXPR tree COND. */
+
+void
+gimple_cond_get_ops_from_tree (tree cond, enum tree_code *code_p,
+ tree *lhs_p, tree *rhs_p)
+{
+ gcc_assert (TREE_CODE_CLASS (TREE_CODE (cond)) == tcc_comparison
+ || TREE_CODE (cond) == TRUTH_NOT_EXPR
+ || is_gimple_min_invariant (cond)
+ || SSA_VAR_P (cond));
+
+ extract_ops_from_tree (cond, code_p, lhs_p, rhs_p);
+
+ /* Canonicalize conditionals of the form 'if (!VAL)'. */
+ if (*code_p == TRUTH_NOT_EXPR)
+ {
+ *code_p = EQ_EXPR;
+ gcc_assert (*lhs_p && *rhs_p == NULL_TREE);
+ *rhs_p = fold_convert (TREE_TYPE (*lhs_p), integer_zero_node);
+ }
+ /* Canonicalize conditionals of the form 'if (VAL)' */
+ else if (TREE_CODE_CLASS (*code_p) != tcc_comparison)
+ {
+ *code_p = NE_EXPR;
+ gcc_assert (*lhs_p && *rhs_p == NULL_TREE);
+ *rhs_p = fold_convert (TREE_TYPE (*lhs_p), integer_zero_node);
+ }
+}
+
+
+/* Build a GIMPLE_COND statement from the conditional expression tree
+ COND. T_LABEL and F_LABEL are as in gimple_build_cond. */
+
+gimple
+gimple_build_cond_from_tree (tree cond, tree t_label, tree f_label)
+{
+ enum tree_code code;
+ tree lhs, rhs;
+
+ gimple_cond_get_ops_from_tree (cond, &code, &lhs, &rhs);
+ return gimple_build_cond (code, lhs, rhs, t_label, f_label);
+}
+
+/* Set code, lhs, and rhs of a GIMPLE_COND from a suitable
+ boolean expression tree COND. */
+
+void
+gimple_cond_set_condition_from_tree (gimple stmt, tree cond)
+{
+ enum tree_code code;
+ tree lhs, rhs;
+
+ gimple_cond_get_ops_from_tree (cond, &code, &lhs, &rhs);
+ gimple_cond_set_condition (stmt, code, lhs, rhs);
+}
+
+/* Build a GIMPLE_LABEL statement for LABEL. */
+
+gimple
+gimple_build_label (tree label)
+{
+ gimple p = gimple_build_with_ops (GIMPLE_LABEL, 0, 1);
+ gimple_label_set_label (p, label);
+ return p;
+}
+
+/* Build a GIMPLE_GOTO statement to label DEST. */
+
+gimple
+gimple_build_goto (tree dest)
+{
+ gimple p = gimple_build_with_ops (GIMPLE_GOTO, 0, 1);
+ gimple_goto_set_dest (p, dest);
+ return p;
+}
+
+
+/* Build a GIMPLE_NOP statement. */
+
+gimple
+gimple_build_nop (void)
+{
+ return gimple_alloc (GIMPLE_NOP, 0);
+}
+
+
+/* Build a GIMPLE_BIND statement.
+ VARS are the variables in BODY.
+ BLOCK is the containing block. */
+
+gimple
+gimple_build_bind (tree vars, gimple_seq body, tree block)
+{
+ gimple p = gimple_alloc (GIMPLE_BIND, 0);
+ gimple_bind_set_vars (p, vars);
+ if (body)
+ gimple_bind_set_body (p, body);
+ if (block)
+ gimple_bind_set_block (p, block);
+ return p;
+}
+
+/* Helper function to set the simple fields of a asm stmt.
+
+ STRING is a pointer to a string that is the asm blocks assembly code.
+ NINPUT is the number of register inputs.
+ NOUTPUT is the number of register outputs.
+ NCLOBBERS is the number of clobbered registers.
+ */
+
+static inline gimple
+gimple_build_asm_1 (const char *string, unsigned ninputs, unsigned noutputs,
+ unsigned nclobbers)
+{
+ gimple p;
+ int size = strlen (string);
+
+ p = gimple_build_with_ops (GIMPLE_ASM, 0, ninputs + noutputs + nclobbers);
+
+ p->gimple_asm.ni = ninputs;
+ p->gimple_asm.no = noutputs;
+ p->gimple_asm.nc = nclobbers;
+ p->gimple_asm.string = ggc_alloc_string (string, size);
+
+#ifdef GATHER_STATISTICS
+ gimple_alloc_sizes[(int) gimple_alloc_kind (GIMPLE_ASM)] += size;
+#endif
+
+ return p;
+}
+
+/* Build a GIMPLE_ASM statement.
+
+ STRING is the assembly code.
+ NINPUT is the number of register inputs.
+ NOUTPUT is the number of register outputs.
+ NCLOBBERS is the number of clobbered registers.
+ INPUTS is a vector of the input register parameters.
+ OUTPUTS is a vector of the output register parameters.
+ CLOBBERS is a vector of the clobbered register parameters. */
+
+gimple
+gimple_build_asm_vec (const char *string, VEC(tree,gc)* inputs,
+ VEC(tree,gc)* outputs, VEC(tree,gc)* clobbers)
+{
+ gimple p;
+ unsigned i;
+
+ p = gimple_build_asm_1 (string,
+ VEC_length (tree, inputs),
+ VEC_length (tree, outputs),
+ VEC_length (tree, clobbers));
+
+ for (i = 0; i < VEC_length (tree, inputs); i++)
+ gimple_asm_set_input_op (p, i, VEC_index (tree, inputs, i));
+
+ for (i = 0; i < VEC_length (tree, outputs); i++)
+ gimple_asm_set_output_op (p, i, VEC_index (tree, outputs, i));
+
+ for (i = 0; i < VEC_length (tree, clobbers); i++)
+ gimple_asm_set_clobber_op (p, i, VEC_index (tree, clobbers, i));
+
+ return p;
+}
+
+/* Build a GIMPLE_ASM statement.
+
+ STRING is the assembly code.
+ NINPUT is the number of register inputs.
+ NOUTPUT is the number of register outputs.
+ NCLOBBERS is the number of clobbered registers.
+ ... are trees for each input, output and clobbered register. */
+
+gimple
+gimple_build_asm (const char *string, unsigned ninputs, unsigned noutputs,
+ unsigned nclobbers, ...)
+{
+ gimple p;
+ unsigned i;
+ va_list ap;
+
+ p = gimple_build_asm_1 (string, ninputs, noutputs, nclobbers);
+
+ va_start (ap, nclobbers);
+
+ for (i = 0; i < ninputs; i++)
+ gimple_asm_set_input_op (p, i, va_arg (ap, tree));
+
+ for (i = 0; i < noutputs; i++)
+ gimple_asm_set_output_op (p, i, va_arg (ap, tree));
+
+ for (i = 0; i < nclobbers; i++)
+ gimple_asm_set_clobber_op (p, i, va_arg (ap, tree));
+
+ va_end (ap);
+
+ return p;
+}
+
+/* Build a GIMPLE_CATCH statement.
+
+ TYPES are the catch types.
+ HANDLER is the exception handler. */
+
+gimple
+gimple_build_catch (tree types, gimple_seq handler)
+{
+ gimple p = gimple_alloc (GIMPLE_CATCH, 0);
+ gimple_catch_set_types (p, types);
+ if (handler)
+ gimple_catch_set_handler (p, handler);
+
+ return p;
+}
+
+/* Build a GIMPLE_EH_FILTER statement.
+
+ TYPES are the filter's types.
+ FAILURE is the filter's failure action. */
+
+gimple
+gimple_build_eh_filter (tree types, gimple_seq failure)
+{
+ gimple p = gimple_alloc (GIMPLE_EH_FILTER, 0);
+ gimple_eh_filter_set_types (p, types);
+ if (failure)
+ gimple_eh_filter_set_failure (p, failure);
+
+ return p;
+}
+
+/* Build a GIMPLE_TRY statement.
+
+ EVAL is the expression to evaluate.
+ CLEANUP is the cleanup expression.
+ KIND is either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY depending on
+ whether this is a try/catch or a try/finally respectively. */
+
+gimple
+gimple_build_try (gimple_seq eval, gimple_seq cleanup,
+ enum gimple_try_flags kind)
+{
+ gimple p;
+
+ gcc_assert (kind == GIMPLE_TRY_CATCH || kind == GIMPLE_TRY_FINALLY);
+ p = gimple_alloc (GIMPLE_TRY, 0);
+ gimple_set_subcode (p, kind);
+ if (eval)
+ gimple_try_set_eval (p, eval);
+ if (cleanup)
+ gimple_try_set_cleanup (p, cleanup);
+
+ return p;
+}
+
+/* Construct a GIMPLE_WITH_CLEANUP_EXPR statement.
+
+ CLEANUP is the cleanup expression. */
+
+gimple
+gimple_build_wce (gimple_seq cleanup)
+{
+ gimple p = gimple_alloc (GIMPLE_WITH_CLEANUP_EXPR, 0);
+ if (cleanup)
+ gimple_wce_set_cleanup (p, cleanup);
+
+ return p;
+}
+
+
+/* Build a GIMPLE_RESX statement.
+
+ REGION is the region number from which this resx causes control flow to
+ leave. */
+
+gimple
+gimple_build_resx (int region)
+{
+ gimple p = gimple_alloc (GIMPLE_RESX, 0);
+ gimple_resx_set_region (p, region);
+ return p;
+}
+
+
+/* The helper for constructing a gimple switch statement.
+ INDEX is the switch's index.
+ NLABELS is the number of labels in the switch excluding the default.
+ DEFAULT_LABEL is the default label for the switch statement. */
+
+static inline gimple
+gimple_build_switch_1 (unsigned nlabels, tree index, tree default_label)
+{
+ /* nlabels + 1 default label + 1 index. */
+ gimple p = gimple_build_with_ops (GIMPLE_SWITCH, 0, nlabels + 1 + 1);
+ gimple_switch_set_index (p, index);
+ gimple_switch_set_default_label (p, default_label);
+ return p;
+}
+
+
+/* Build a GIMPLE_SWITCH statement.
+
+ INDEX is the switch's index.
+ NLABELS is the number of labels in the switch excluding the DEFAULT_LABEL.
+ ... are the labels excluding the default. */
+
+gimple
+gimple_build_switch (unsigned nlabels, tree index, tree default_label, ...)
+{
+ va_list al;
+ unsigned i;
+ gimple p;
+
+ p = gimple_build_switch_1 (nlabels, index, default_label);
+
+ /* Store the rest of the labels. */
+ va_start (al, default_label);
+ for (i = 1; i <= nlabels; i++)
+ gimple_switch_set_label (p, i, va_arg (al, tree));
+ va_end (al);
+
+ return p;
+}
+
+
+/* Build a GIMPLE_SWITCH statement.
+
+ INDEX is the switch's index.
+ DEFAULT_LABEL is the default label
+ ARGS is a vector of labels excluding the default. */
+
+gimple
+gimple_build_switch_vec (tree index, tree default_label, VEC(tree, heap) *args)
+{
+ unsigned i;
+ unsigned nlabels = VEC_length (tree, args);
+ gimple p = gimple_build_switch_1 (nlabels, index, default_label);
+
+ /* Put labels in labels[1 - (nlabels + 1)].
+ Default label is in labels[0]. */
+ for (i = 1; i <= nlabels; i++)
+ gimple_switch_set_label (p, i, VEC_index (tree, args, i - 1));
+
+ return p;
+}
+
+
+/* Build a GIMPLE_OMP_CRITICAL statement.
+
+ BODY is the sequence of statements for which only one thread can execute.
+ NAME is optional identifier for this critical block. */
+
+gimple
+gimple_build_omp_critical (gimple_seq body, tree name)
+{
+ gimple p = gimple_alloc (GIMPLE_OMP_CRITICAL, 0);
+ gimple_omp_critical_set_name (p, name);
+ if (body)
+ gimple_omp_set_body (p, body);
+
+ return p;
+}
+
+/* Build a GIMPLE_OMP_FOR statement.
+
+ BODY is sequence of statements inside the for loop.
+ CLAUSES, are any of the OMP loop construct's clauses: private, firstprivate,
+ lastprivate, reductions, ordered, schedule, and nowait.
+ COLLAPSE is the collapse count.
+ PRE_BODY is the sequence of statements that are loop invariant. */
+
+gimple
+gimple_build_omp_for (gimple_seq body, tree clauses, size_t collapse,
+ gimple_seq pre_body)
+{
+ gimple p = gimple_alloc (GIMPLE_OMP_FOR, 0);
+ if (body)
+ gimple_omp_set_body (p, body);
+ gimple_omp_for_set_clauses (p, clauses);
+ p->gimple_omp_for.collapse = collapse;
+ p->gimple_omp_for.iter = GGC_CNEWVEC (struct gimple_omp_for_iter, collapse);
+ if (pre_body)
+ gimple_omp_for_set_pre_body (p, pre_body);
+
+ return p;
+}
+
+
+/* Build a GIMPLE_OMP_PARALLEL statement.
+
+ BODY is sequence of statements which are executed in parallel.
+ CLAUSES, are the OMP parallel construct's clauses.
+ CHILD_FN is the function created for the parallel threads to execute.
+ DATA_ARG are the shared data argument(s). */
+
+gimple
+gimple_build_omp_parallel (gimple_seq body, tree clauses, tree child_fn,
+ tree data_arg)
+{
+ gimple p = gimple_alloc (GIMPLE_OMP_PARALLEL, 0);
+ if (body)
+ gimple_omp_set_body (p, body);
+ gimple_omp_parallel_set_clauses (p, clauses);
+ gimple_omp_parallel_set_child_fn (p, child_fn);
+ gimple_omp_parallel_set_data_arg (p, data_arg);
+
+ return p;
+}
+
+
+/* Build a GIMPLE_OMP_TASK statement.
+
+ BODY is sequence of statements which are executed by the explicit task.
+ CLAUSES, are the OMP parallel construct's clauses.
+ CHILD_FN is the function created for the parallel threads to execute.
+ DATA_ARG are the shared data argument(s).
+ COPY_FN is the optional function for firstprivate initialization.
+ ARG_SIZE and ARG_ALIGN are size and alignment of the data block. */
+
+gimple
+gimple_build_omp_task (gimple_seq body, tree clauses, tree child_fn,
+ tree data_arg, tree copy_fn, tree arg_size,
+ tree arg_align)
+{
+ gimple p = gimple_alloc (GIMPLE_OMP_TASK, 0);
+ if (body)
+ gimple_omp_set_body (p, body);
+ gimple_omp_task_set_clauses (p, clauses);
+ gimple_omp_task_set_child_fn (p, child_fn);
+ gimple_omp_task_set_data_arg (p, data_arg);
+ gimple_omp_task_set_copy_fn (p, copy_fn);
+ gimple_omp_task_set_arg_size (p, arg_size);
+ gimple_omp_task_set_arg_align (p, arg_align);
+
+ return p;
+}
+
+
+/* Build a GIMPLE_OMP_SECTION statement for a sections statement.
+
+ BODY is the sequence of statements in the section. */
+
+gimple
+gimple_build_omp_section (gimple_seq body)
+{
+ gimple p = gimple_alloc (GIMPLE_OMP_SECTION, 0);
+ if (body)
+ gimple_omp_set_body (p, body);
+
+ return p;
+}
+
+
+/* Build a GIMPLE_OMP_MASTER statement.
+
+ BODY is the sequence of statements to be executed by just the master. */
+
+gimple
+gimple_build_omp_master (gimple_seq body)
+{
+ gimple p = gimple_alloc (GIMPLE_OMP_MASTER, 0);
+ if (body)
+ gimple_omp_set_body (p, body);
+
+ return p;
+}
+
+
+/* Build a GIMPLE_OMP_CONTINUE statement.
+
+ CONTROL_DEF is the definition of the control variable.
+ CONTROL_USE is the use of the control variable. */
+
+gimple
+gimple_build_omp_continue (tree control_def, tree control_use)
+{
+ gimple p = gimple_alloc (GIMPLE_OMP_CONTINUE, 0);
+ gimple_omp_continue_set_control_def (p, control_def);
+ gimple_omp_continue_set_control_use (p, control_use);
+ return p;
+}
+
+/* Build a GIMPLE_OMP_ORDERED statement.
+
+ BODY is the sequence of statements inside a loop that will executed in
+ sequence. */
+
+gimple
+gimple_build_omp_ordered (gimple_seq body)
+{
+ gimple p = gimple_alloc (GIMPLE_OMP_ORDERED, 0);
+ if (body)
+ gimple_omp_set_body (p, body);
+
+ return p;
+}
+
+
+/* Build a GIMPLE_OMP_RETURN statement.
+ WAIT_P is true if this is a non-waiting return. */
+
+gimple
+gimple_build_omp_return (bool wait_p)
+{
+ gimple p = gimple_alloc (GIMPLE_OMP_RETURN, 0);
+ if (wait_p)
+ gimple_omp_return_set_nowait (p);
+
+ return p;
+}
+
+
+/* Build a GIMPLE_OMP_SECTIONS statement.
+
+ BODY is a sequence of section statements.
+ CLAUSES are any of the OMP sections contsruct's clauses: private,
+ firstprivate, lastprivate, reduction, and nowait. */
+
+gimple
+gimple_build_omp_sections (gimple_seq body, tree clauses)
+{
+ gimple p = gimple_alloc (GIMPLE_OMP_SECTIONS, 0);
+ if (body)
+ gimple_omp_set_body (p, body);
+ gimple_omp_sections_set_clauses (p, clauses);
+
+ return p;
+}
+
+
+/* Build a GIMPLE_OMP_SECTIONS_SWITCH. */
+
+gimple
+gimple_build_omp_sections_switch (void)
+{
+ return gimple_alloc (GIMPLE_OMP_SECTIONS_SWITCH, 0);
+}
+
+
+/* Build a GIMPLE_OMP_SINGLE statement.
+
+ BODY is the sequence of statements that will be executed once.
+ CLAUSES are any of the OMP single construct's clauses: private, firstprivate,
+ copyprivate, nowait. */
+
+gimple
+gimple_build_omp_single (gimple_seq body, tree clauses)
+{
+ gimple p = gimple_alloc (GIMPLE_OMP_SINGLE, 0);
+ if (body)
+ gimple_omp_set_body (p, body);
+ gimple_omp_single_set_clauses (p, clauses);
+
+ return p;
+}
+
+
+/* Build a GIMPLE_CHANGE_DYNAMIC_TYPE statement. TYPE is the new type
+ for the location PTR. */
+
+gimple
+gimple_build_cdt (tree type, tree ptr)
+{
+ gimple p = gimple_build_with_ops (GIMPLE_CHANGE_DYNAMIC_TYPE, 0, 2);
+ gimple_cdt_set_new_type (p, type);
+ gimple_cdt_set_location (p, ptr);
+
+ return p;
+}
+
+
+/* Build a GIMPLE_OMP_ATOMIC_LOAD statement. */
+
+gimple
+gimple_build_omp_atomic_load (tree lhs, tree rhs)
+{
+ gimple p = gimple_alloc (GIMPLE_OMP_ATOMIC_LOAD, 0);
+ gimple_omp_atomic_load_set_lhs (p, lhs);
+ gimple_omp_atomic_load_set_rhs (p, rhs);
+ return p;
+}
+
+/* Build a GIMPLE_OMP_ATOMIC_STORE statement.
+
+ VAL is the value we are storing. */
+
+gimple
+gimple_build_omp_atomic_store (tree val)
+{
+ gimple p = gimple_alloc (GIMPLE_OMP_ATOMIC_STORE, 0);
+ gimple_omp_atomic_store_set_val (p, val);
+ return p;
+}
+
+/* Build a GIMPLE_PREDICT statement. PREDICT is one of the predictors from
+ predict.def, OUTCOME is NOT_TAKEN or TAKEN. */
+
+gimple
+gimple_build_predict (enum br_predictor predictor, enum prediction outcome)
+{
+ gimple p = gimple_alloc (GIMPLE_PREDICT, 0);
+ /* Ensure all the predictors fit into the lower bits of the subcode. */
+ gcc_assert (END_PREDICTORS <= GF_PREDICT_TAKEN);
+ gimple_predict_set_predictor (p, predictor);
+ gimple_predict_set_outcome (p, outcome);
+ return p;
+}
+
+/* Return which gimple structure is used by T. The enums here are defined
+ in gsstruct.def. */
+
+enum gimple_statement_structure_enum
+gimple_statement_structure (gimple gs)
+{
+ return gss_for_code (gimple_code (gs));
+}
+
+#if defined ENABLE_GIMPLE_CHECKING && (GCC_VERSION >= 2007)
+/* Complain of a gimple type mismatch and die. */
+
+void
+gimple_check_failed (const_gimple gs, const char *file, int line,
+ const char *function, enum gimple_code code,
+ enum tree_code subcode)
+{
+ internal_error ("gimple check: expected %s(%s), have %s(%s) in %s, at %s:%d",
+ gimple_code_name[code],
+ tree_code_name[subcode],
+ gimple_code_name[gimple_code (gs)],
+ gs->gsbase.subcode > 0
+ ? tree_code_name[gs->gsbase.subcode]
+ : "",
+ function, trim_filename (file), line);
+}
+
+
+/* Similar to gimple_check_failed, except that instead of specifying a
+ dozen codes, use the knowledge that they're all sequential. */
+
+void
+gimple_range_check_failed (const_gimple gs, const char *file, int line,
+ const char *function, enum gimple_code c1,
+ enum gimple_code c2)
+{
+ char *buffer;
+ unsigned length = 0;
+ enum gimple_code c;
+
+ for (c = c1; c <= c2; ++c)
+ length += 4 + strlen (gimple_code_name[c]);
+
+ length += strlen ("expected ");
+ buffer = XALLOCAVAR (char, length);
+ length = 0;
+
+ for (c = c1; c <= c2; ++c)
+ {
+ const char *prefix = length ? " or " : "expected ";
+
+ strcpy (buffer + length, prefix);
+ length += strlen (prefix);
+ strcpy (buffer + length, gimple_code_name[c]);
+ length += strlen (gimple_code_name[c]);
+ }
+
+ internal_error ("gimple check: %s, have %s in %s, at %s:%d",
+ buffer, gimple_code_name[gimple_code (gs)],
+ function, trim_filename (file), line);
+}
+#endif /* ENABLE_GIMPLE_CHECKING */
+
+
+/* Allocate a new GIMPLE sequence in GC memory and return it. If
+ there are free sequences in GIMPLE_SEQ_CACHE return one of those
+ instead. */
+
+gimple_seq
+gimple_seq_alloc (void)
+{
+ gimple_seq seq = gimple_seq_cache;
+ if (seq)
+ {
+ gimple_seq_cache = gimple_seq_cache->next_free;
+ gcc_assert (gimple_seq_cache != seq);
+ memset (seq, 0, sizeof (*seq));
+ }
+ else
+ {
+ seq = (gimple_seq) ggc_alloc_cleared (sizeof (*seq));
+#ifdef GATHER_STATISTICS
+ gimple_alloc_counts[(int) gimple_alloc_kind_seq]++;
+ gimple_alloc_sizes[(int) gimple_alloc_kind_seq] += sizeof (*seq);
+#endif
+ }
+
+ return seq;
+}
+
+/* Return SEQ to the free pool of GIMPLE sequences. */
+
+void
+gimple_seq_free (gimple_seq seq)
+{
+ if (seq == NULL)
+ return;
+
+ gcc_assert (gimple_seq_first (seq) == NULL);
+ gcc_assert (gimple_seq_last (seq) == NULL);
+
+ /* If this triggers, it's a sign that the same list is being freed
+ twice. */
+ gcc_assert (seq != gimple_seq_cache || gimple_seq_cache == NULL);
+
+ /* Add SEQ to the pool of free sequences. */
+ seq->next_free = gimple_seq_cache;
+ gimple_seq_cache = seq;
+}
+
+
+/* Link gimple statement GS to the end of the sequence *SEQ_P. If
+ *SEQ_P is NULL, a new sequence is allocated. */
+
+void
+gimple_seq_add_stmt (gimple_seq *seq_p, gimple gs)
+{
+ gimple_stmt_iterator si;
+
+ if (gs == NULL)
+ return;
+
+ if (*seq_p == NULL)
+ *seq_p = gimple_seq_alloc ();
+
+ si = gsi_last (*seq_p);
+ gsi_insert_after (&si, gs, GSI_NEW_STMT);
+}
+
+
+/* Append sequence SRC to the end of sequence *DST_P. If *DST_P is
+ NULL, a new sequence is allocated. */
+
+void
+gimple_seq_add_seq (gimple_seq *dst_p, gimple_seq src)
+{
+ gimple_stmt_iterator si;
+
+ if (src == NULL)
+ return;
+
+ if (*dst_p == NULL)
+ *dst_p = gimple_seq_alloc ();
+
+ si = gsi_last (*dst_p);
+ gsi_insert_seq_after (&si, src, GSI_NEW_STMT);
+}
+
+
+/* Helper function of empty_body_p. Return true if STMT is an empty
+ statement. */
+
+static bool
+empty_stmt_p (gimple stmt)
+{
+ if (gimple_code (stmt) == GIMPLE_NOP)
+ return true;
+ if (gimple_code (stmt) == GIMPLE_BIND)
+ return empty_body_p (gimple_bind_body (stmt));
+ return false;
+}
+
+
+/* Return true if BODY contains nothing but empty statements. */
+
+bool
+empty_body_p (gimple_seq body)
+{
+ gimple_stmt_iterator i;
+
+
+ if (gimple_seq_empty_p (body))
+ return true;
+ for (i = gsi_start (body); !gsi_end_p (i); gsi_next (&i))
+ if (!empty_stmt_p (gsi_stmt (i)))
+ return false;
+
+ return true;
+}
+
+
+/* Perform a deep copy of sequence SRC and return the result. */
+
+gimple_seq
+gimple_seq_copy (gimple_seq src)
+{
+ gimple_stmt_iterator gsi;
+ gimple_seq new_seq = gimple_seq_alloc ();
+ gimple stmt;
+
+ for (gsi = gsi_start (src); !gsi_end_p (gsi); gsi_next (&gsi))
+ {
+ stmt = gimple_copy (gsi_stmt (gsi));
+ gimple_seq_add_stmt (&new_seq, stmt);
+ }
+
+ return new_seq;
+}
+
+
+/* Walk all the statements in the sequence SEQ calling walk_gimple_stmt
+ on each one. WI is as in walk_gimple_stmt.
+
+ If walk_gimple_stmt returns non-NULL, the walk is stopped, the
+ value is stored in WI->CALLBACK_RESULT and the statement that
+ produced the value is returned.
+
+ Otherwise, all the statements are walked and NULL returned. */
+
+gimple
+walk_gimple_seq (gimple_seq seq, walk_stmt_fn callback_stmt,
+ walk_tree_fn callback_op, struct walk_stmt_info *wi)
+{
+ gimple_stmt_iterator gsi;
+
+ for (gsi = gsi_start (seq); !gsi_end_p (gsi); gsi_next (&gsi))
+ {
+ tree ret = walk_gimple_stmt (&gsi, callback_stmt, callback_op, wi);
+ if (ret)
+ {
+ /* If CALLBACK_STMT or CALLBACK_OP return a value, WI must exist
+ to hold it. */
+ gcc_assert (wi);
+ wi->callback_result = ret;
+ return gsi_stmt (gsi);
+ }
+ }
+
+ if (wi)
+ wi->callback_result = NULL_TREE;
+
+ return NULL;
+}
+
+
+/* Helper function for walk_gimple_stmt. Walk operands of a GIMPLE_ASM. */
+
+static tree
+walk_gimple_asm (gimple stmt, walk_tree_fn callback_op,
+ struct walk_stmt_info *wi)
+{
+ tree ret;
+ unsigned noutputs;
+ const char **oconstraints;
+ unsigned i;
+ const char *constraint;
+ bool allows_mem, allows_reg, is_inout;
+
+ noutputs = gimple_asm_noutputs (stmt);
+ oconstraints = (const char **) alloca ((noutputs) * sizeof (const char *));
+
+ if (wi)
+ wi->is_lhs = true;
+
+ for (i = 0; i < noutputs; i++)
+ {
+ tree op = gimple_asm_output_op (stmt, i);
+ constraint = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (op)));
+ oconstraints[i] = constraint;
+ parse_output_constraint (&constraint, i, 0, 0, &allows_mem, &allows_reg,
+ &is_inout);
+ if (wi)
+ wi->val_only = (allows_reg || !allows_mem);
+ ret = walk_tree (&TREE_VALUE (op), callback_op, wi, NULL);
+ if (ret)
+ return ret;
+ }
+
+ for (i = 0; i < gimple_asm_ninputs (stmt); i++)
+ {
+ tree op = gimple_asm_input_op (stmt, i);
+ constraint = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (op)));
+ parse_input_constraint (&constraint, 0, 0, noutputs, 0,
+ oconstraints, &allows_mem, &allows_reg);
+ if (wi)
+ wi->val_only = (allows_reg || !allows_mem);
+
+ /* Although input "m" is not really a LHS, we need a lvalue. */
+ if (wi)
+ wi->is_lhs = !wi->val_only;
+ ret = walk_tree (&TREE_VALUE (op), callback_op, wi, NULL);
+ if (ret)
+ return ret;
+ }
+
+ if (wi)
+ {
+ wi->is_lhs = false;
+ wi->val_only = true;
+ }
+
+ return NULL_TREE;
+}
+
+
+/* Helper function of WALK_GIMPLE_STMT. Walk every tree operand in
+ STMT. CALLBACK_OP and WI are as in WALK_GIMPLE_STMT.
+
+ CALLBACK_OP is called on each operand of STMT via walk_tree.
+ Additional parameters to walk_tree must be stored in WI. For each operand
+ OP, walk_tree is called as:
+
+ walk_tree (&OP, CALLBACK_OP, WI, WI->PSET)
+
+ If CALLBACK_OP returns non-NULL for an operand, the remaining
+ operands are not scanned.
+
+ The return value is that returned by the last call to walk_tree, or
+ NULL_TREE if no CALLBACK_OP is specified. */
+
+inline tree
+walk_gimple_op (gimple stmt, walk_tree_fn callback_op,
+ struct walk_stmt_info *wi)
+{
+ struct pointer_set_t *pset = (wi) ? wi->pset : NULL;
+ unsigned i;
+ tree ret = NULL_TREE;
+
+ switch (gimple_code (stmt))
+ {
+ case GIMPLE_ASSIGN:
+ /* Walk the RHS operands. A formal temporary LHS may use a
+ COMPONENT_REF RHS. */
+ if (wi)
+ wi->val_only = !is_gimple_formal_tmp_var (gimple_assign_lhs (stmt));
+
+ for (i = 1; i < gimple_num_ops (stmt); i++)
+ {
+ ret = walk_tree (gimple_op_ptr (stmt, i), callback_op, wi,
+ pset);
+ if (ret)
+ return ret;
+ }
+
+ /* Walk the LHS. If the RHS is appropriate for a memory, we
+ may use a COMPONENT_REF on the LHS. */
+ if (wi)
+ {
+ /* If the RHS has more than 1 operand, it is not appropriate
+ for the memory. */
+ wi->val_only = !is_gimple_mem_rhs (gimple_assign_rhs1 (stmt))
+ || !gimple_assign_single_p (stmt);
+ wi->is_lhs = true;
+ }
+
+ ret = walk_tree (gimple_op_ptr (stmt, 0), callback_op, wi, pset);
+ if (ret)
+ return ret;
+
+ if (wi)
+ {
+ wi->val_only = true;
+ wi->is_lhs = false;
+ }
+ break;
+
+ case GIMPLE_CALL:
+ if (wi)
+ wi->is_lhs = false;
+
+ ret = walk_tree (gimple_call_chain_ptr (stmt), callback_op, wi, pset);
+ if (ret)
+ return ret;
+
+ ret = walk_tree (gimple_call_fn_ptr (stmt), callback_op, wi, pset);
+ if (ret)
+ return ret;
+
+ for (i = 0; i < gimple_call_num_args (stmt); i++)
+ {
+ ret = walk_tree (gimple_call_arg_ptr (stmt, i), callback_op, wi,
+ pset);
+ if (ret)
+ return ret;
+ }
+
+ if (wi)
+ wi->is_lhs = true;
+
+ ret = walk_tree (gimple_call_lhs_ptr (stmt), callback_op, wi, pset);
+ if (ret)
+ return ret;
+
+ if (wi)
+ wi->is_lhs = false;
+ break;
+
+ case GIMPLE_CATCH:
+ ret = walk_tree (gimple_catch_types_ptr (stmt), callback_op, wi,
+ pset);
+ if (ret)
+ return ret;
+ break;
+
+ case GIMPLE_EH_FILTER:
+ ret = walk_tree (gimple_eh_filter_types_ptr (stmt), callback_op, wi,
+ pset);
+ if (ret)
+ return ret;
+ break;
+
+ case GIMPLE_CHANGE_DYNAMIC_TYPE:
+ ret = walk_tree (gimple_cdt_location_ptr (stmt), callback_op, wi, pset);
+ if (ret)
+ return ret;
+
+ ret = walk_tree (gimple_cdt_new_type_ptr (stmt), callback_op, wi, pset);
+ if (ret)
+ return ret;
+ break;
+
+ case GIMPLE_ASM:
+ ret = walk_gimple_asm (stmt, callback_op, wi);
+ if (ret)
+ return ret;
+ break;
+
+ case GIMPLE_OMP_CONTINUE:
+ ret = walk_tree (gimple_omp_continue_control_def_ptr (stmt),
+ callback_op, wi, pset);
+ if (ret)
+ return ret;
+
+ ret = walk_tree (gimple_omp_continue_control_use_ptr (stmt),
+ callback_op, wi, pset);
+ if (ret)
+ return ret;
+ break;
+
+ case GIMPLE_OMP_CRITICAL:
+ ret = walk_tree (gimple_omp_critical_name_ptr (stmt), callback_op, wi,
+ pset);
+ if (ret)
+ return ret;
+ break;
+
+ case GIMPLE_OMP_FOR:
+ ret = walk_tree (gimple_omp_for_clauses_ptr (stmt), callback_op, wi,
+ pset);
+ if (ret)
+ return ret;
+ for (i = 0; i < gimple_omp_for_collapse (stmt); i++)
+ {
+ ret = walk_tree (gimple_omp_for_index_ptr (stmt, i), callback_op,
+ wi, pset);
+ if (ret)
+ return ret;
+ ret = walk_tree (gimple_omp_for_initial_ptr (stmt, i), callback_op,
+ wi, pset);
+ if (ret)
+ return ret;
+ ret = walk_tree (gimple_omp_for_final_ptr (stmt, i), callback_op,
+ wi, pset);
+ if (ret)
+ return ret;
+ ret = walk_tree (gimple_omp_for_incr_ptr (stmt, i), callback_op,
+ wi, pset);
+ }
+ if (ret)
+ return ret;
+ break;
+
+ case GIMPLE_OMP_PARALLEL:
+ ret = walk_tree (gimple_omp_parallel_clauses_ptr (stmt), callback_op,
+ wi, pset);
+ if (ret)
+ return ret;
+ ret = walk_tree (gimple_omp_parallel_child_fn_ptr (stmt), callback_op,
+ wi, pset);
+ if (ret)
+ return ret;
+ ret = walk_tree (gimple_omp_parallel_data_arg_ptr (stmt), callback_op,
+ wi, pset);
+ if (ret)
+ return ret;
+ break;
+
+ case GIMPLE_OMP_TASK:
+ ret = walk_tree (gimple_omp_task_clauses_ptr (stmt), callback_op,
+ wi, pset);
+ if (ret)
+ return ret;
+ ret = walk_tree (gimple_omp_task_child_fn_ptr (stmt), callback_op,
+ wi, pset);
+ if (ret)
+ return ret;
+ ret = walk_tree (gimple_omp_task_data_arg_ptr (stmt), callback_op,
+ wi, pset);
+ if (ret)
+ return ret;
+ ret = walk_tree (gimple_omp_task_copy_fn_ptr (stmt), callback_op,
+ wi, pset);
+ if (ret)
+ return ret;
+ ret = walk_tree (gimple_omp_task_arg_size_ptr (stmt), callback_op,
+ wi, pset);
+ if (ret)
+ return ret;
+ ret = walk_tree (gimple_omp_task_arg_align_ptr (stmt), callback_op,
+ wi, pset);
+ if (ret)
+ return ret;
+ break;
+
+ case GIMPLE_OMP_SECTIONS:
+ ret = walk_tree (gimple_omp_sections_clauses_ptr (stmt), callback_op,
+ wi, pset);
+ if (ret)
+ return ret;
+
+ ret = walk_tree (gimple_omp_sections_control_ptr (stmt), callback_op,
+ wi, pset);
+ if (ret)
+ return ret;
+
+ break;
+
+ case GIMPLE_OMP_SINGLE:
+ ret = walk_tree (gimple_omp_single_clauses_ptr (stmt), callback_op, wi,
+ pset);
+ if (ret)
+ return ret;
+ break;
+
+ case GIMPLE_OMP_ATOMIC_LOAD:
+ ret = walk_tree (gimple_omp_atomic_load_lhs_ptr (stmt), callback_op, wi,
+ pset);
+ if (ret)
+ return ret;
+
+ ret = walk_tree (gimple_omp_atomic_load_rhs_ptr (stmt), callback_op, wi,
+ pset);
+ if (ret)
+ return ret;
+ break;
+
+ case GIMPLE_OMP_ATOMIC_STORE:
+ ret = walk_tree (gimple_omp_atomic_store_val_ptr (stmt), callback_op,
+ wi, pset);
+ if (ret)
+ return ret;
+ break;
+
+ /* Tuples that do not have operands. */
+ case GIMPLE_NOP:
+ case GIMPLE_RESX:
+ case GIMPLE_OMP_RETURN:
+ case GIMPLE_PREDICT:
+ break;
+
+ default:
+ {
+ enum gimple_statement_structure_enum gss;
+ gss = gimple_statement_structure (stmt);
+ if (gss == GSS_WITH_OPS || gss == GSS_WITH_MEM_OPS)
+ for (i = 0; i < gimple_num_ops (stmt); i++)
+ {
+ ret = walk_tree (gimple_op_ptr (stmt, i), callback_op, wi, pset);
+ if (ret)
+ return ret;
+ }
+ }
+ break;
+ }
+
+ return NULL_TREE;
+}
+
+
+/* Walk the current statement in GSI (optionally using traversal state
+ stored in WI). If WI is NULL, no state is kept during traversal.
+ The callback CALLBACK_STMT is called. If CALLBACK_STMT indicates
+ that it has handled all the operands of the statement, its return
+ value is returned. Otherwise, the return value from CALLBACK_STMT
+ is discarded and its operands are scanned.
+
+ If CALLBACK_STMT is NULL or it didn't handle the operands,
+ CALLBACK_OP is called on each operand of the statement via
+ walk_gimple_op. If walk_gimple_op returns non-NULL for any
+ operand, the remaining operands are not scanned. In this case, the
+ return value from CALLBACK_OP is returned.
+
+ In any other case, NULL_TREE is returned. */
+
+tree
+walk_gimple_stmt (gimple_stmt_iterator *gsi, walk_stmt_fn callback_stmt,
+ walk_tree_fn callback_op, struct walk_stmt_info *wi)
+{
+ gimple ret;
+ tree tree_ret;
+ gimple stmt = gsi_stmt (*gsi);
+
+ if (wi)
+ wi->gsi = *gsi;
+
+ if (wi && wi->want_locations && gimple_has_location (stmt))
+ input_location = gimple_location (stmt);
+
+ ret = NULL;
+
+ /* Invoke the statement callback. Return if the callback handled
+ all of STMT operands by itself. */
+ if (callback_stmt)
+ {
+ bool handled_ops = false;
+ tree_ret = callback_stmt (gsi, &handled_ops, wi);
+ if (handled_ops)
+ return tree_ret;
+
+ /* If CALLBACK_STMT did not handle operands, it should not have
+ a value to return. */
+ gcc_assert (tree_ret == NULL);
+
+ /* Re-read stmt in case the callback changed it. */
+ stmt = gsi_stmt (*gsi);
+ }
+
+ /* If CALLBACK_OP is defined, invoke it on every operand of STMT. */
+ if (callback_op)
+ {
+ tree_ret = walk_gimple_op (stmt, callback_op, wi);
+ if (tree_ret)
+ return tree_ret;
+ }
+
+ /* If STMT can have statements inside (e.g. GIMPLE_BIND), walk them. */
+ switch (gimple_code (stmt))
+ {
+ case GIMPLE_BIND:
+ ret = walk_gimple_seq (gimple_bind_body (stmt), callback_stmt,
+ callback_op, wi);
+ if (ret)
+ return wi->callback_result;
+ break;
+
+ case GIMPLE_CATCH:
+ ret = walk_gimple_seq (gimple_catch_handler (stmt), callback_stmt,
+ callback_op, wi);
+ if (ret)
+ return wi->callback_result;
+ break;
+
+ case GIMPLE_EH_FILTER:
+ ret = walk_gimple_seq (gimple_eh_filter_failure (stmt), callback_stmt,
+ callback_op, wi);
+ if (ret)
+ return wi->callback_result;
+ break;
+
+ case GIMPLE_TRY:
+ ret = walk_gimple_seq (gimple_try_eval (stmt), callback_stmt, callback_op,
+ wi);
+ if (ret)
+ return wi->callback_result;
+
+ ret = walk_gimple_seq (gimple_try_cleanup (stmt), callback_stmt,
+ callback_op, wi);
+ if (ret)
+ return wi->callback_result;
+ break;
+
+ case GIMPLE_OMP_FOR:
+ ret = walk_gimple_seq (gimple_omp_for_pre_body (stmt), callback_stmt,
+ callback_op, wi);
+ if (ret)
+ return wi->callback_result;
+
+ /* FALL THROUGH. */
+ case GIMPLE_OMP_CRITICAL:
+ case GIMPLE_OMP_MASTER:
+ case GIMPLE_OMP_ORDERED:
+ case GIMPLE_OMP_SECTION:
+ case GIMPLE_OMP_PARALLEL:
+ case GIMPLE_OMP_TASK:
+ case GIMPLE_OMP_SECTIONS:
+ case GIMPLE_OMP_SINGLE:
+ ret = walk_gimple_seq (gimple_omp_body (stmt), callback_stmt, callback_op,
+ wi);
+ if (ret)
+ return wi->callback_result;
+ break;
+
+ case GIMPLE_WITH_CLEANUP_EXPR:
+ ret = walk_gimple_seq (gimple_wce_cleanup (stmt), callback_stmt,
+ callback_op, wi);
+ if (ret)
+ return wi->callback_result;
+ break;
+
+ default:
+ gcc_assert (!gimple_has_substatements (stmt));
+ break;
+ }
+
+ return NULL;
+}
+
+
+/* Set sequence SEQ to be the GIMPLE body for function FN. */
+
+void
+gimple_set_body (tree fndecl, gimple_seq seq)
+{
+ struct function *fn = DECL_STRUCT_FUNCTION (fndecl);
+ if (fn == NULL)
+ {
+ /* If FNDECL still does not have a function structure associated
+ with it, then it does not make sense for it to receive a
+ GIMPLE body. */
+ gcc_assert (seq == NULL);
+ }
+ else
+ fn->gimple_body = seq;
+}
+
+
+/* Return the body of GIMPLE statements for function FN. */
+
+gimple_seq
+gimple_body (tree fndecl)
+{
+ struct function *fn = DECL_STRUCT_FUNCTION (fndecl);
+ return fn ? fn->gimple_body : NULL;
+}
+
+
+/* Detect flags from a GIMPLE_CALL. This is just like
+ call_expr_flags, but for gimple tuples. */
+
+int
+gimple_call_flags (const_gimple stmt)
+{
+ int flags;
+ tree decl = gimple_call_fndecl (stmt);
+ tree t;
+
+ if (decl)
+ flags = flags_from_decl_or_type (decl);
+ else
+ {
+ t = TREE_TYPE (gimple_call_fn (stmt));
+ if (t && TREE_CODE (t) == POINTER_TYPE)
+ flags = flags_from_decl_or_type (TREE_TYPE (t));
+ else
+ flags = 0;
+ }
+
+ return flags;
+}
+
+
+/* Return true if GS is a copy assignment. */
+
+bool
+gimple_assign_copy_p (gimple gs)
+{
+ return gimple_code (gs) == GIMPLE_ASSIGN
+ && get_gimple_rhs_class (gimple_assign_rhs_code (gs))
+ == GIMPLE_SINGLE_RHS
+ && is_gimple_val (gimple_op (gs, 1));
+}
+
+
+/* Return true if GS is a SSA_NAME copy assignment. */
+
+bool
+gimple_assign_ssa_name_copy_p (gimple gs)
+{
+ return (gimple_code (gs) == GIMPLE_ASSIGN
+ && (get_gimple_rhs_class (gimple_assign_rhs_code (gs))
+ == GIMPLE_SINGLE_RHS)
+ && TREE_CODE (gimple_assign_lhs (gs)) == SSA_NAME
+ && TREE_CODE (gimple_assign_rhs1 (gs)) == SSA_NAME);
+}
+
+
+/* Return true if GS is an assignment with a singleton RHS, i.e.,
+ there is no operator associated with the assignment itself.
+ Unlike gimple_assign_copy_p, this predicate returns true for
+ any RHS operand, including those that perform an operation
+ and do not have the semantics of a copy, such as COND_EXPR. */
+
+bool
+gimple_assign_single_p (gimple gs)
+{
+ return (gimple_code (gs) == GIMPLE_ASSIGN
+ && get_gimple_rhs_class (gimple_assign_rhs_code (gs))
+ == GIMPLE_SINGLE_RHS);
+}
+
+/* Return true if GS is an assignment with a unary RHS, but the
+ operator has no effect on the assigned value. The logic is adapted
+ from STRIP_NOPS. This predicate is intended to be used in tuplifying
+ instances in which STRIP_NOPS was previously applied to the RHS of
+ an assignment.
+
+ NOTE: In the use cases that led to the creation of this function
+ and of gimple_assign_single_p, it is typical to test for either
+ condition and to proceed in the same manner. In each case, the
+ assigned value is represented by the single RHS operand of the
+ assignment. I suspect there may be cases where gimple_assign_copy_p,
+ gimple_assign_single_p, or equivalent logic is used where a similar
+ treatment of unary NOPs is appropriate. */
+
+bool
+gimple_assign_unary_nop_p (gimple gs)
+{
+ return (gimple_code (gs) == GIMPLE_ASSIGN
+ && (gimple_assign_rhs_code (gs) == NOP_EXPR
+ || gimple_assign_rhs_code (gs) == CONVERT_EXPR
+ || gimple_assign_rhs_code (gs) == NON_LVALUE_EXPR)
+ && gimple_assign_rhs1 (gs) != error_mark_node
+ && (TYPE_MODE (TREE_TYPE (gimple_assign_lhs (gs)))
+ == TYPE_MODE (TREE_TYPE (gimple_assign_rhs1 (gs)))));
+}
+
+/* Set BB to be the basic block holding G. */
+
+void
+gimple_set_bb (gimple stmt, basic_block bb)
+{
+ stmt->gsbase.bb = bb;
+
+ /* If the statement is a label, add the label to block-to-labels map
+ so that we can speed up edge creation for GIMPLE_GOTOs. */
+ if (cfun->cfg && gimple_code (stmt) == GIMPLE_LABEL)
+ {
+ tree t;
+ int uid;
+
+ t = gimple_label_label (stmt);
+ uid = LABEL_DECL_UID (t);
+ if (uid == -1)
+ {
+ unsigned old_len = VEC_length (basic_block, label_to_block_map);
+ LABEL_DECL_UID (t) = uid = cfun->cfg->last_label_uid++;
+ if (old_len <= (unsigned) uid)
+ {
+ unsigned new_len = 3 * uid / 2;
+
+ VEC_safe_grow_cleared (basic_block, gc, label_to_block_map,
+ new_len);
+ }
+ }
+
+ VEC_replace (basic_block, label_to_block_map, uid, bb);
+ }
+}
+
+
+/* Fold the expression computed by STMT. If the expression can be
+ folded, return the folded result, otherwise return NULL. STMT is
+ not modified. */
+
+tree
+gimple_fold (const_gimple stmt)
+{
+ switch (gimple_code (stmt))
+ {
+ case GIMPLE_COND:
+ return fold_binary (gimple_cond_code (stmt),
+ boolean_type_node,
+ gimple_cond_lhs (stmt),
+ gimple_cond_rhs (stmt));
+
+ case GIMPLE_ASSIGN:
+ switch (get_gimple_rhs_class (gimple_assign_rhs_code (stmt)))
+ {
+ case GIMPLE_UNARY_RHS:
+ return fold_unary (gimple_assign_rhs_code (stmt),
+ TREE_TYPE (gimple_assign_lhs (stmt)),
+ gimple_assign_rhs1 (stmt));
+ case GIMPLE_BINARY_RHS:
+ return fold_binary (gimple_assign_rhs_code (stmt),
+ TREE_TYPE (gimple_assign_lhs (stmt)),
+ gimple_assign_rhs1 (stmt),
+ gimple_assign_rhs2 (stmt));
+ case GIMPLE_SINGLE_RHS:
+ return fold (gimple_assign_rhs1 (stmt));
+ default:;
+ }
+ break;
+
+ case GIMPLE_SWITCH:
+ return gimple_switch_index (stmt);
+
+ case GIMPLE_CALL:
+ return NULL_TREE;
+
+ default:
+ break;
+ }
+
+ gcc_unreachable ();
+}
+
+
+/* Modify the RHS of the assignment pointed-to by GSI using the
+ operands in the expression tree EXPR.
+
+ NOTE: The statement pointed-to by GSI may be reallocated if it
+ did not have enough operand slots.
+
+ This function is useful to convert an existing tree expression into
+ the flat representation used for the RHS of a GIMPLE assignment.
+ It will reallocate memory as needed to expand or shrink the number
+ of operand slots needed to represent EXPR.
+
+ NOTE: If you find yourself building a tree and then calling this
+ function, you are most certainly doing it the slow way. It is much
+ better to build a new assignment or to use the function
+ gimple_assign_set_rhs_with_ops, which does not require an
+ expression tree to be built. */
+
+void
+gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *gsi, tree expr)
+{
+ enum tree_code subcode;
+ tree op1, op2;
+
+ extract_ops_from_tree (expr, &subcode, &op1, &op2);
+ gimple_assign_set_rhs_with_ops (gsi, subcode, op1, op2);
+}
+
+
+/* Set the RHS of assignment statement pointed-to by GSI to CODE with
+ operands OP1 and OP2.
+
+ NOTE: The statement pointed-to by GSI may be reallocated if it
+ did not have enough operand slots. */
+
+void
+gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
+ tree op1, tree op2)
+{
+ unsigned new_rhs_ops = get_gimple_rhs_num_ops (code);
+ gimple stmt = gsi_stmt (*gsi);
+
+ /* If the new CODE needs more operands, allocate a new statement. */
+ if (gimple_num_ops (stmt) < new_rhs_ops + 1)
+ {
+ tree lhs = gimple_assign_lhs (stmt);
+ gimple new_stmt = gimple_alloc (gimple_code (stmt), new_rhs_ops + 1);
+ memcpy (new_stmt, stmt, gimple_size (gimple_code (stmt)));
+ gsi_replace (gsi, new_stmt, true);
+ stmt = new_stmt;
+
+ /* The LHS needs to be reset as this also changes the SSA name
+ on the LHS. */
+ gimple_assign_set_lhs (stmt, lhs);
+ }
+
+ gimple_set_num_ops (stmt, new_rhs_ops + 1);
+ gimple_set_subcode (stmt, code);
+ gimple_assign_set_rhs1 (stmt, op1);
+ if (new_rhs_ops > 1)
+ gimple_assign_set_rhs2 (stmt, op2);
+}
+
+
+/* Return the LHS of a statement that performs an assignment,
+ either a GIMPLE_ASSIGN or a GIMPLE_CALL. Returns NULL_TREE
+ for a call to a function that returns no value, or for a
+ statement other than an assignment or a call. */
+
+tree
+gimple_get_lhs (const_gimple stmt)
+{
+ enum tree_code code = gimple_code (stmt);
+
+ if (code == GIMPLE_ASSIGN)
+ return gimple_assign_lhs (stmt);
+ else if (code == GIMPLE_CALL)
+ return gimple_call_lhs (stmt);
+ else
+ return NULL_TREE;
+}
+
+
+/* Set the LHS of a statement that performs an assignment,
+ either a GIMPLE_ASSIGN or a GIMPLE_CALL. */
+
+void
+gimple_set_lhs (gimple stmt, tree lhs)
+{
+ enum tree_code code = gimple_code (stmt);
+
+ if (code == GIMPLE_ASSIGN)
+ gimple_assign_set_lhs (stmt, lhs);
+ else if (code == GIMPLE_CALL)
+ gimple_call_set_lhs (stmt, lhs);
+ else
+ gcc_unreachable();
+}
+
+
+/* Return a deep copy of statement STMT. All the operands from STMT
+ are reallocated and copied using unshare_expr. The DEF, USE, VDEF
+ and VUSE operand arrays are set to empty in the new copy. */
+
+gimple
+gimple_copy (gimple stmt)
+{
+ enum gimple_code code = gimple_code (stmt);
+ unsigned num_ops = gimple_num_ops (stmt);
+ gimple copy = gimple_alloc (code, num_ops);
+ unsigned i;
+
+ /* Shallow copy all the fields from STMT. */
+ memcpy (copy, stmt, gimple_size (code));
+
+ /* If STMT has sub-statements, deep-copy them as well. */
+ if (gimple_has_substatements (stmt))
+ {
+ gimple_seq new_seq;
+ tree t;
+
+ switch (gimple_code (stmt))
+ {
+ case GIMPLE_BIND:
+ new_seq = gimple_seq_copy (gimple_bind_body (stmt));
+ gimple_bind_set_body (copy, new_seq);
+ gimple_bind_set_vars (copy, unshare_expr (gimple_bind_vars (stmt)));
+ gimple_bind_set_block (copy, gimple_bind_block (stmt));
+ break;
+
+ case GIMPLE_CATCH:
+ new_seq = gimple_seq_copy (gimple_catch_handler (stmt));
+ gimple_catch_set_handler (copy, new_seq);
+ t = unshare_expr (gimple_catch_types (stmt));
+ gimple_catch_set_types (copy, t);
+ break;
+
+ case GIMPLE_EH_FILTER:
+ new_seq = gimple_seq_copy (gimple_eh_filter_failure (stmt));
+ gimple_eh_filter_set_failure (copy, new_seq);
+ t = unshare_expr (gimple_eh_filter_types (stmt));
+ gimple_eh_filter_set_types (copy, t);
+ break;
+
+ case GIMPLE_TRY:
+ new_seq = gimple_seq_copy (gimple_try_eval (stmt));
+ gimple_try_set_eval (copy, new_seq);
+ new_seq = gimple_seq_copy (gimple_try_cleanup (stmt));
+ gimple_try_set_cleanup (copy, new_seq);
+ break;
+
+ case GIMPLE_OMP_FOR:
+ new_seq = gimple_seq_copy (gimple_omp_for_pre_body (stmt));
+ gimple_omp_for_set_pre_body (copy, new_seq);
+ t = unshare_expr (gimple_omp_for_clauses (stmt));
+ gimple_omp_for_set_clauses (copy, t);
+ copy->gimple_omp_for.iter
+ = GGC_NEWVEC (struct gimple_omp_for_iter,
+ gimple_omp_for_collapse (stmt));
+ for (i = 0; i < gimple_omp_for_collapse (stmt); i++)
+ {
+ gimple_omp_for_set_cond (copy, i,
+ gimple_omp_for_cond (stmt, i));
+ gimple_omp_for_set_index (copy, i,
+ gimple_omp_for_index (stmt, i));
+ t = unshare_expr (gimple_omp_for_initial (stmt, i));
+ gimple_omp_for_set_initial (copy, i, t);
+ t = unshare_expr (gimple_omp_for_final (stmt, i));
+ gimple_omp_for_set_final (copy, i, t);
+ t = unshare_expr (gimple_omp_for_incr (stmt, i));
+ gimple_omp_for_set_incr (copy, i, t);
+ }
+ goto copy_omp_body;
+
+ case GIMPLE_OMP_PARALLEL:
+ t = unshare_expr (gimple_omp_parallel_clauses (stmt));
+ gimple_omp_parallel_set_clauses (copy, t);
+ t = unshare_expr (gimple_omp_parallel_child_fn (stmt));
+ gimple_omp_parallel_set_child_fn (copy, t);
+ t = unshare_expr (gimple_omp_parallel_data_arg (stmt));
+ gimple_omp_parallel_set_data_arg (copy, t);
+ goto copy_omp_body;
+
+ case GIMPLE_OMP_TASK:
+ t = unshare_expr (gimple_omp_task_clauses (stmt));
+ gimple_omp_task_set_clauses (copy, t);
+ t = unshare_expr (gimple_omp_task_child_fn (stmt));
+ gimple_omp_task_set_child_fn (copy, t);
+ t = unshare_expr (gimple_omp_task_data_arg (stmt));
+ gimple_omp_task_set_data_arg (copy, t);
+ t = unshare_expr (gimple_omp_task_copy_fn (stmt));
+ gimple_omp_task_set_copy_fn (copy, t);
+ t = unshare_expr (gimple_omp_task_arg_size (stmt));
+ gimple_omp_task_set_arg_size (copy, t);
+ t = unshare_expr (gimple_omp_task_arg_align (stmt));
+ gimple_omp_task_set_arg_align (copy, t);
+ goto copy_omp_body;
+
+ case GIMPLE_OMP_CRITICAL:
+ t = unshare_expr (gimple_omp_critical_name (stmt));
+ gimple_omp_critical_set_name (copy, t);
+ goto copy_omp_body;
+
+ case GIMPLE_OMP_SECTIONS:
+ t = unshare_expr (gimple_omp_sections_clauses (stmt));
+ gimple_omp_sections_set_clauses (copy, t);
+ t = unshare_expr (gimple_omp_sections_control (stmt));
+ gimple_omp_sections_set_control (copy, t);
+ /* FALLTHRU */
+
+ case GIMPLE_OMP_SINGLE:
+ case GIMPLE_OMP_SECTION:
+ case GIMPLE_OMP_MASTER:
+ case GIMPLE_OMP_ORDERED:
+ copy_omp_body:
+ new_seq = gimple_seq_copy (gimple_omp_body (stmt));
+ gimple_omp_set_body (copy, new_seq);
+ break;
+
+ case GIMPLE_WITH_CLEANUP_EXPR:
+ new_seq = gimple_seq_copy (gimple_wce_cleanup (stmt));
+ gimple_wce_set_cleanup (copy, new_seq);
+ break;
+
+ default:
+ gcc_unreachable ();
+ }
+ }
+
+ /* Make copy of operands. */
+ if (num_ops > 0)
+ {
+ for (i = 0; i < num_ops; i++)
+ gimple_set_op (copy, i, unshare_expr (gimple_op (stmt, i)));
+
+ /* Clear out SSA operand vectors on COPY. Note that we cannot
+ call the API functions for setting addresses_taken, stores
+ and loads. These functions free the previous values, and we
+ cannot do that on COPY as it will affect the original
+ statement. */
+ if (gimple_has_ops (stmt))
+ {
+ gimple_set_def_ops (copy, NULL);
+ gimple_set_use_ops (copy, NULL);
+ copy->gsops.opbase.addresses_taken = NULL;
+ }
+
+ if (gimple_has_mem_ops (stmt))
+ {
+ gimple_set_vdef_ops (copy, NULL);
+ gimple_set_vuse_ops (copy, NULL);
+ copy->gsmem.membase.stores = NULL;
+ copy->gsmem.membase.loads = NULL;
+ }
+
+ update_stmt (copy);
+ }
+
+ return copy;
+}
+
+
+/* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
+ a MODIFIED field. */
+
+void
+gimple_set_modified (gimple s, bool modifiedp)
+{
+ if (gimple_has_ops (s))
+ {
+ s->gsbase.modified = (unsigned) modifiedp;
+
+ if (modifiedp
+ && cfun->gimple_df
+ && is_gimple_call (s)
+ && gimple_call_noreturn_p (s))
+ VEC_safe_push (gimple, gc, MODIFIED_NORETURN_CALLS (cfun), s);
+ }
+}
+
+
+/* Return true if statement S has side-effects. We consider a
+ statement to have side effects if:
+
+ - It is a GIMPLE_CALL not marked with ECF_PURE or ECF_CONST.
+ - Any of its operands are marked TREE_THIS_VOLATILE or TREE_SIDE_EFFECTS. */
+
+bool
+gimple_has_side_effects (const_gimple s)
+{
+ unsigned i;
+
+ /* We don't have to scan the arguments to check for
+ volatile arguments, though, at present, we still
+ do a scan to check for TREE_SIDE_EFFECTS. */
+ if (gimple_has_volatile_ops (s))
+ return true;
+
+ if (is_gimple_call (s))
+ {
+ unsigned nargs = gimple_call_num_args (s);
+
+ if (!(gimple_call_flags (s) & (ECF_CONST | ECF_PURE)))
+ return true;
+ else if (gimple_call_flags (s) & ECF_LOOPING_CONST_OR_PURE)
+ /* An infinite loop is considered a side effect. */
+ return true;
+
+ if (gimple_call_lhs (s)
+ && TREE_SIDE_EFFECTS (gimple_call_lhs (s)))
+ {
+ gcc_assert (gimple_has_volatile_ops (s));
+ return true;
+ }
+
+ if (TREE_SIDE_EFFECTS (gimple_call_fn (s)))
+ return true;
+
+ for (i = 0; i < nargs; i++)
+ if (TREE_SIDE_EFFECTS (gimple_call_arg (s, i)))
+ {
+ gcc_assert (gimple_has_volatile_ops (s));
+ return true;
+ }
+
+ return false;
+ }
+ else
+ {
+ for (i = 0; i < gimple_num_ops (s); i++)
+ if (TREE_SIDE_EFFECTS (gimple_op (s, i)))
+ {
+ gcc_assert (gimple_has_volatile_ops (s));
+ return true;
+ }
+ }
+
+ return false;
+}
+
+/* Return true if the RHS of statement S has side effects.
+ We may use it to determine if it is admissable to replace
+ an assignment or call with a copy of a previously-computed
+ value. In such cases, side-effects due the the LHS are
+ preserved. */
+
+bool
+gimple_rhs_has_side_effects (const_gimple s)
+{
+ unsigned i;
+
+ if (is_gimple_call (s))
+ {
+ unsigned nargs = gimple_call_num_args (s);
+
+ if (!(gimple_call_flags (s) & (ECF_CONST | ECF_PURE)))
+ return true;
+
+ /* We cannot use gimple_has_volatile_ops here,
+ because we must ignore a volatile LHS. */
+ if (TREE_SIDE_EFFECTS (gimple_call_fn (s))
+ || TREE_THIS_VOLATILE (gimple_call_fn (s)))
+ {
+ gcc_assert (gimple_has_volatile_ops (s));
+ return true;
+ }
+
+ for (i = 0; i < nargs; i++)
+ if (TREE_SIDE_EFFECTS (gimple_call_arg (s, i))
+ || TREE_THIS_VOLATILE (gimple_call_arg (s, i)))
+ return true;
+
+ return false;
+ }
+ else if (is_gimple_assign (s))
+ {
+ /* Skip the first operand, the LHS. */
+ for (i = 1; i < gimple_num_ops (s); i++)
+ if (TREE_SIDE_EFFECTS (gimple_op (s, i))
+ || TREE_THIS_VOLATILE (gimple_op (s, i)))
+ {
+ gcc_assert (gimple_has_volatile_ops (s));
+ return true;
+ }
+ }
+ else
+ {
+ /* For statements without an LHS, examine all arguments. */
+ for (i = 0; i < gimple_num_ops (s); i++)
+ if (TREE_SIDE_EFFECTS (gimple_op (s, i))
+ || TREE_THIS_VOLATILE (gimple_op (s, i)))
+ {
+ gcc_assert (gimple_has_volatile_ops (s));
+ return true;
+ }
+ }
+
+ return false;
+}
+
+
+/* Helper for gimple_could_trap_p and gimple_assign_rhs_could_trap_p.
+ Return true if S can trap. If INCLUDE_LHS is true and S is a
+ GIMPLE_ASSIGN, the LHS of the assignment is also checked.
+ Otherwise, only the RHS of the assignment is checked. */
+
+static bool
+gimple_could_trap_p_1 (gimple s, bool include_lhs)
+{
+ unsigned i, start;
+ tree t, div = NULL_TREE;
+ enum tree_code op;
+
+ start = (is_gimple_assign (s) && !include_lhs) ? 1 : 0;
+
+ for (i = start; i < gimple_num_ops (s); i++)
+ if (tree_could_trap_p (gimple_op (s, i)))
+ return true;
+
+ switch (gimple_code (s))
+ {
+ case GIMPLE_ASM:
+ return gimple_asm_volatile_p (s);
+
+ case GIMPLE_CALL:
+ t = gimple_call_fndecl (s);
+ /* Assume that calls to weak functions may trap. */
+ if (!t || !DECL_P (t) || DECL_WEAK (t))
+ return true;
+ return false;
+
+ case GIMPLE_ASSIGN:
+ t = gimple_expr_type (s);
+ op = gimple_assign_rhs_code (s);
+ if (get_gimple_rhs_class (op) == GIMPLE_BINARY_RHS)
+ div = gimple_assign_rhs2 (s);
+ return (operation_could_trap_p (op, FLOAT_TYPE_P (t),
+ (INTEGRAL_TYPE_P (t)
+ && TYPE_OVERFLOW_TRAPS (t)),
+ div));
+
+ default:
+ break;
+ }
+
+ return false;
+
+}
+
+
+/* Return true if statement S can trap. */
+
+bool
+gimple_could_trap_p (gimple s)
+{
+ return gimple_could_trap_p_1 (s, true);
+}
+
+
+/* Return true if RHS of a GIMPLE_ASSIGN S can trap. */
+
+bool
+gimple_assign_rhs_could_trap_p (gimple s)
+{
+ gcc_assert (is_gimple_assign (s));
+ return gimple_could_trap_p_1 (s, false);
+}
+
+
+/* Print debugging information for gimple stmts generated. */
+
+void
+dump_gimple_statistics (void)
+{
+#ifdef GATHER_STATISTICS
+ int i, total_tuples = 0, total_bytes = 0;
+
+ fprintf (stderr, "\nGIMPLE statements\n");
+ fprintf (stderr, "Kind Stmts Bytes\n");
+ fprintf (stderr, "---------------------------------------\n");
+ for (i = 0; i < (int) gimple_alloc_kind_all; ++i)
+ {
+ fprintf (stderr, "%-20s %7d %10d\n", gimple_alloc_kind_names[i],
+ gimple_alloc_counts[i], gimple_alloc_sizes[i]);
+ total_tuples += gimple_alloc_counts[i];
+ total_bytes += gimple_alloc_sizes[i];
+ }
+ fprintf (stderr, "---------------------------------------\n");
+ fprintf (stderr, "%-20s %7d %10d\n", "Total", total_tuples, total_bytes);
+ fprintf (stderr, "---------------------------------------\n");
+#else
+ fprintf (stderr, "No gimple statistics\n");
+#endif
+}
+
+
+/* Deep copy SYMS into the set of symbols stored by STMT. If SYMS is
+ NULL or empty, the storage used is freed up. */
+
+void
+gimple_set_stored_syms (gimple stmt, bitmap syms, bitmap_obstack *obs)
+{
+ gcc_assert (gimple_has_mem_ops (stmt));
+
+ if (syms == NULL || bitmap_empty_p (syms))
+ BITMAP_FREE (stmt->gsmem.membase.stores);
+ else
+ {
+ if (stmt->gsmem.membase.stores == NULL)
+ stmt->gsmem.membase.stores = BITMAP_ALLOC (obs);
+
+ bitmap_copy (stmt->gsmem.membase.stores, syms);
+ }
+}
+
+
+/* Deep copy SYMS into the set of symbols loaded by STMT. If SYMS is
+ NULL or empty, the storage used is freed up. */
+
+void
+gimple_set_loaded_syms (gimple stmt, bitmap syms, bitmap_obstack *obs)
+{
+ gcc_assert (gimple_has_mem_ops (stmt));
+
+ if (syms == NULL || bitmap_empty_p (syms))
+ BITMAP_FREE (stmt->gsmem.membase.loads);
+ else
+ {
+ if (stmt->gsmem.membase.loads == NULL)
+ stmt->gsmem.membase.loads = BITMAP_ALLOC (obs);
+
+ bitmap_copy (stmt->gsmem.membase.loads, syms);
+ }
+}
+
+
+/* Return the number of operands needed on the RHS of a GIMPLE
+ assignment for an expression with tree code CODE. */
+
+unsigned
+get_gimple_rhs_num_ops (enum tree_code code)
+{
+ enum gimple_rhs_class rhs_class = get_gimple_rhs_class (code);
+
+ if (rhs_class == GIMPLE_UNARY_RHS || rhs_class == GIMPLE_SINGLE_RHS)
+ return 1;
+ else if (rhs_class == GIMPLE_BINARY_RHS)
+ return 2;
+ else
+ gcc_unreachable ();
+}
+
+#define DEFTREECODE(SYM, STRING, TYPE, NARGS) \
+ (unsigned char) \
+ ((TYPE) == tcc_unary ? GIMPLE_UNARY_RHS \
+ : ((TYPE) == tcc_binary \
+ || (TYPE) == tcc_comparison) ? GIMPLE_BINARY_RHS \
+ : ((TYPE) == tcc_constant \
+ || (TYPE) == tcc_declaration \
+ || (TYPE) == tcc_reference) ? GIMPLE_SINGLE_RHS \
+ : ((SYM) == TRUTH_AND_EXPR \
+ || (SYM) == TRUTH_OR_EXPR \
+ || (SYM) == TRUTH_XOR_EXPR) ? GIMPLE_BINARY_RHS \
+ : (SYM) == TRUTH_NOT_EXPR ? GIMPLE_UNARY_RHS \
+ : ((SYM) == COND_EXPR \
+ || (SYM) == CONSTRUCTOR \
+ || (SYM) == OBJ_TYPE_REF \
+ || (SYM) == ASSERT_EXPR \
+ || (SYM) == ADDR_EXPR \
+ || (SYM) == WITH_SIZE_EXPR \
+ || (SYM) == EXC_PTR_EXPR \
+ || (SYM) == SSA_NAME \
+ || (SYM) == FILTER_EXPR \
+ || (SYM) == POLYNOMIAL_CHREC \
+ || (SYM) == DOT_PROD_EXPR \
+ || (SYM) == VEC_COND_EXPR \
+ || (SYM) == REALIGN_LOAD_EXPR) ? GIMPLE_SINGLE_RHS \
+ : GIMPLE_INVALID_RHS),
+#define END_OF_BASE_TREE_CODES (unsigned char) GIMPLE_INVALID_RHS,
+
+const unsigned char gimple_rhs_class_table[] = {
+#include "all-tree.def"
+};
+
+#undef DEFTREECODE
+#undef END_OF_BASE_TREE_CODES
+
+/* For the definitive definition of GIMPLE, see doc/tree-ssa.texi. */
+
+/* Validation of GIMPLE expressions. */
+
+/* Return true if OP is an acceptable tree node to be used as a GIMPLE
+ operand. */
+
+bool
+is_gimple_operand (const_tree op)
+{
+ return op && get_gimple_rhs_class (TREE_CODE (op)) == GIMPLE_SINGLE_RHS;
+}
+
+
+/* Return true if T is a GIMPLE RHS for an assignment to a temporary. */
+
+bool
+is_gimple_formal_tmp_rhs (tree t)
+{
+ if (is_gimple_lvalue (t) || is_gimple_val (t))
+ return true;
+
+ return get_gimple_rhs_class (TREE_CODE (t)) != GIMPLE_INVALID_RHS;
+}
+
+/* Returns true iff T is a valid RHS for an assignment to a renamed
+ user -- or front-end generated artificial -- variable. */
+
+bool
+is_gimple_reg_rhs (tree t)
+{
+ /* If the RHS of the MODIFY_EXPR may throw or make a nonlocal goto
+ and the LHS is a user variable, then we need to introduce a formal
+ temporary. This way the optimizers can determine that the user
+ variable is only modified if evaluation of the RHS does not throw.
+
+ Don't force a temp of a non-renamable type; the copy could be
+ arbitrarily expensive. Instead we will generate a VDEF for
+ the assignment. */
+
+ if (is_gimple_reg_type (TREE_TYPE (t)) && tree_could_throw_p (t))
+ return false;
+
+ return is_gimple_formal_tmp_rhs (t);
+}
+
+/* Returns true iff T is a valid RHS for an assignment to an un-renamed
+ LHS, or for a call argument. */
+
+bool
+is_gimple_mem_rhs (tree t)
+{
+ /* If we're dealing with a renamable type, either source or dest must be
+ a renamed variable. */
+ if (is_gimple_reg_type (TREE_TYPE (t)))
+ return is_gimple_val (t);
+ else
+ return is_gimple_formal_tmp_rhs (t);
+}
+
+/* Return true if T is a valid LHS for a GIMPLE assignment expression. */
+
+bool
+is_gimple_lvalue (tree t)
+{
+ return (is_gimple_addressable (t)
+ || TREE_CODE (t) == WITH_SIZE_EXPR
+ /* These are complex lvalues, but don't have addresses, so they
+ go here. */
+ || TREE_CODE (t) == BIT_FIELD_REF);
+}
+
+/* Return true if T is a GIMPLE condition. */
+
+bool
+is_gimple_condexpr (tree t)
+{
+ return (is_gimple_val (t) || (COMPARISON_CLASS_P (t)
+ && !tree_could_trap_p (t)
+ && is_gimple_val (TREE_OPERAND (t, 0))
+ && is_gimple_val (TREE_OPERAND (t, 1))));
+}
+
+/* Return true if T is something whose address can be taken. */
+
+bool
+is_gimple_addressable (tree t)
+{
+ return (is_gimple_id (t) || handled_component_p (t) || INDIRECT_REF_P (t));
+}
+
+/* Return true if T is a valid gimple constant. */
+
+bool
+is_gimple_constant (const_tree t)
+{
+ switch (TREE_CODE (t))
+ {
+ case INTEGER_CST:
+ case REAL_CST:
+ case FIXED_CST:
+ case STRING_CST:
+ case COMPLEX_CST:
+ case VECTOR_CST:
+ return true;
+
+ /* Vector constant constructors are gimple invariant. */
+ case CONSTRUCTOR:
+ if (TREE_TYPE (t) && TREE_CODE (TREE_TYPE (t)) == VECTOR_TYPE)
+ return TREE_CONSTANT (t);
+ else
+ return false;
+
+ default:
+ return false;
+ }
+}
+
+/* Return true if T is a gimple address. */
+
+bool
+is_gimple_address (const_tree t)
+{
+ tree op;
+
+ if (TREE_CODE (t) != ADDR_EXPR)
+ return false;
+
+ op = TREE_OPERAND (t, 0);
+ while (handled_component_p (op))
+ {
+ if ((TREE_CODE (op) == ARRAY_REF
+ || TREE_CODE (op) == ARRAY_RANGE_REF)
+ && !is_gimple_val (TREE_OPERAND (op, 1)))
+ return false;
+
+ op = TREE_OPERAND (op, 0);
+ }
+
+ if (CONSTANT_CLASS_P (op) || INDIRECT_REF_P (op))
+ return true;
+
+ switch (TREE_CODE (op))
+ {
+ case PARM_DECL:
+ case RESULT_DECL:
+ case LABEL_DECL:
+ case FUNCTION_DECL:
+ case VAR_DECL:
+ case CONST_DECL:
+ return true;
+
+ default:
+ return false;
+ }
+}
+
+/* Return true if T is a gimple invariant address. */
+
+bool
+is_gimple_invariant_address (const_tree t)
+{
+ tree op;
+
+ if (TREE_CODE (t) != ADDR_EXPR)
+ return false;
+
+ op = TREE_OPERAND (t, 0);
+ while (handled_component_p (op))
+ {
+ switch (TREE_CODE (op))
+ {
+ case ARRAY_REF:
+ case ARRAY_RANGE_REF:
+ if (!is_gimple_constant (TREE_OPERAND (op, 1))
+ || TREE_OPERAND (op, 2) != NULL_TREE
+ || TREE_OPERAND (op, 3) != NULL_TREE)
+ return false;
+ break;
+
+ case COMPONENT_REF:
+ if (TREE_OPERAND (op, 2) != NULL_TREE)
+ return false;
+ break;
+
+ default:;
+ }
+ op = TREE_OPERAND (op, 0);
+ }
+
+ return CONSTANT_CLASS_P (op) || decl_address_invariant_p (op);
+}
+
+/* Return true if T is a GIMPLE minimal invariant. It's a restricted
+ form of function invariant. */
+
+bool
+is_gimple_min_invariant (const_tree t)
+{
+ if (TREE_CODE (t) == ADDR_EXPR)
+ return is_gimple_invariant_address (t);
+
+ return is_gimple_constant (t);
+}
+
+/* Return true if T looks like a valid GIMPLE statement. */
+
+bool
+is_gimple_stmt (tree t)
+{
+ const enum tree_code code = TREE_CODE (t);
+
+ switch (code)
+ {
+ case NOP_EXPR:
+ /* The only valid NOP_EXPR is the empty statement. */
+ return IS_EMPTY_STMT (t);
+
+ case BIND_EXPR:
+ case COND_EXPR:
+ /* These are only valid if they're void. */
+ return TREE_TYPE (t) == NULL || VOID_TYPE_P (TREE_TYPE (t));
+
+ case SWITCH_EXPR:
+ case GOTO_EXPR:
+ case RETURN_EXPR:
+ case LABEL_EXPR:
+ case CASE_LABEL_EXPR:
+ case TRY_CATCH_EXPR:
+ case TRY_FINALLY_EXPR:
+ case EH_FILTER_EXPR:
+ case CATCH_EXPR:
+ case CHANGE_DYNAMIC_TYPE_EXPR:
+ case ASM_EXPR:
+ case RESX_EXPR:
+ case STATEMENT_LIST:
+ case OMP_PARALLEL:
+ case OMP_FOR:
+ case OMP_SECTIONS:
+ case OMP_SECTION:
+ case OMP_SINGLE:
+ case OMP_MASTER:
+ case OMP_ORDERED:
+ case OMP_CRITICAL:
+ case OMP_TASK:
+ /* These are always void. */
+ return true;
+
+ case CALL_EXPR:
+ case MODIFY_EXPR:
+ case PREDICT_EXPR:
+ /* These are valid regardless of their type. */
+ return true;
+
+ default:
+ return false;
+ }
+}
+
+/* Return true if T is a variable. */
+
+bool
+is_gimple_variable (tree t)
+{
+ return (TREE_CODE (t) == VAR_DECL
+ || TREE_CODE (t) == PARM_DECL
+ || TREE_CODE (t) == RESULT_DECL
+ || TREE_CODE (t) == SSA_NAME);
+}
+
+/* Return true if T is a GIMPLE identifier (something with an address). */
+
+bool
+is_gimple_id (tree t)
+{
+ return (is_gimple_variable (t)
+ || TREE_CODE (t) == FUNCTION_DECL
+ || TREE_CODE (t) == LABEL_DECL
+ || TREE_CODE (t) == CONST_DECL
+ /* Allow string constants, since they are addressable. */
+ || TREE_CODE (t) == STRING_CST);
+}
+
+/* Return true if TYPE is a suitable type for a scalar register variable. */
+
+bool
+is_gimple_reg_type (tree type)
+{
+ /* In addition to aggregate types, we also exclude complex types if not
+ optimizing because they can be subject to partial stores in GNU C by
+ means of the __real__ and __imag__ operators and we cannot promote
+ them to total stores (see gimplify_modify_expr_complex_part). */
+ return !(AGGREGATE_TYPE_P (type)
+ || (TREE_CODE (type) == COMPLEX_TYPE && !optimize));
+
+}
+
+/* Return true if T is a non-aggregate register variable. */
+
+bool
+is_gimple_reg (tree t)
+{
+ if (TREE_CODE (t) == SSA_NAME)
+ t = SSA_NAME_VAR (t);
+
+ if (MTAG_P (t))
+ return false;
+
+ if (!is_gimple_variable (t))
+ return false;
+
+ if (!is_gimple_reg_type (TREE_TYPE (t)))
+ return false;
+
+ /* A volatile decl is not acceptable because we can't reuse it as
+ needed. We need to copy it into a temp first. */
+ if (TREE_THIS_VOLATILE (t))
+ return false;
+
+ /* We define "registers" as things that can be renamed as needed,
+ which with our infrastructure does not apply to memory. */
+ if (needs_to_live_in_memory (t))
+ return false;
+
+ /* Hard register variables are an interesting case. For those that
+ are call-clobbered, we don't know where all the calls are, since
+ we don't (want to) take into account which operations will turn
+ into libcalls at the rtl level. For those that are call-saved,
+ we don't currently model the fact that calls may in fact change
+ global hard registers, nor do we examine ASM_CLOBBERS at the tree
+ level, and so miss variable changes that might imply. All around,
+ it seems safest to not do too much optimization with these at the
+ tree level at all. We'll have to rely on the rtl optimizers to
+ clean this up, as there we've got all the appropriate bits exposed. */
+ if (TREE_CODE (t) == VAR_DECL && DECL_HARD_REGISTER (t))
+ return false;
+
+ /* Complex and vector values must have been put into SSA-like form.
+ That is, no assignments to the individual components. */
+ if (TREE_CODE (TREE_TYPE (t)) == COMPLEX_TYPE
+ || TREE_CODE (TREE_TYPE (t)) == VECTOR_TYPE)
+ return DECL_GIMPLE_REG_P (t);
+
+ return true;
+}
+
+
+/* Returns true if T is a GIMPLE formal temporary variable. */
+
+bool
+is_gimple_formal_tmp_var (tree t)
+{
+ if (TREE_CODE (t) == SSA_NAME)
+ return true;
+
+ return TREE_CODE (t) == VAR_DECL && DECL_GIMPLE_FORMAL_TEMP_P (t);
+}
+
+/* Returns true if T is a GIMPLE formal temporary register variable. */
+
+bool
+is_gimple_formal_tmp_reg (tree t)
+{
+ /* The intent of this is to get hold of a value that won't change.
+ An SSA_NAME qualifies no matter if its of a user variable or not. */
+ if (TREE_CODE (t) == SSA_NAME)
+ return true;
+
+ /* We don't know the lifetime characteristics of user variables. */
+ if (!is_gimple_formal_tmp_var (t))
+ return false;
+
+ /* Finally, it must be capable of being placed in a register. */
+ return is_gimple_reg (t);
+}
+
+/* Return true if T is a GIMPLE variable whose address is not needed. */
+
+bool
+is_gimple_non_addressable (tree t)
+{
+ if (TREE_CODE (t) == SSA_NAME)
+ t = SSA_NAME_VAR (t);
+
+ return (is_gimple_variable (t) && ! needs_to_live_in_memory (t));
+}
+
+/* Return true if T is a GIMPLE rvalue, i.e. an identifier or a constant. */
+
+bool
+is_gimple_val (tree t)
+{
+ /* Make loads from volatiles and memory vars explicit. */
+ if (is_gimple_variable (t)
+ && is_gimple_reg_type (TREE_TYPE (t))
+ && !is_gimple_reg (t))
+ return false;
+
+ /* FIXME make these decls. That can happen only when we expose the
+ entire landing-pad construct at the tree level. */
+ if (TREE_CODE (t) == EXC_PTR_EXPR || TREE_CODE (t) == FILTER_EXPR)
+ return true;
+
+ return (is_gimple_variable (t) || is_gimple_min_invariant (t));
+}
+
+/* Similarly, but accept hard registers as inputs to asm statements. */
+
+bool
+is_gimple_asm_val (tree t)
+{
+ if (TREE_CODE (t) == VAR_DECL && DECL_HARD_REGISTER (t))
+ return true;
+
+ return is_gimple_val (t);
+}
+
+/* Return true if T is a GIMPLE minimal lvalue. */
+
+bool
+is_gimple_min_lval (tree t)
+{
+ return (is_gimple_id (t) || TREE_CODE (t) == INDIRECT_REF);
+}
+
+/* Return true if T is a typecast operation. */
+
+bool
+is_gimple_cast (tree t)
+{
+ return (CONVERT_EXPR_P (t)
+ || TREE_CODE (t) == FIX_TRUNC_EXPR);
+}
+
+/* Return true if T is a valid function operand of a CALL_EXPR. */
+
+bool
+is_gimple_call_addr (tree t)
+{
+ return (TREE_CODE (t) == OBJ_TYPE_REF || is_gimple_val (t));
+}
+
+/* If T makes a function call, return the corresponding CALL_EXPR operand.
+ Otherwise, return NULL_TREE. */
+
+tree
+get_call_expr_in (tree t)
+{
+ if (TREE_CODE (t) == MODIFY_EXPR)
+ t = TREE_OPERAND (t, 1);
+ if (TREE_CODE (t) == WITH_SIZE_EXPR)
+ t = TREE_OPERAND (t, 0);
+ if (TREE_CODE (t) == CALL_EXPR)
+ return t;
+ return NULL_TREE;
+}
+
+
+/* Given a memory reference expression T, return its base address.
+ The base address of a memory reference expression is the main
+ object being referenced. For instance, the base address for
+ 'array[i].fld[j]' is 'array'. You can think of this as stripping
+ away the offset part from a memory address.
+
+ This function calls handled_component_p to strip away all the inner
+ parts of the memory reference until it reaches the base object. */
+
+tree
+get_base_address (tree t)
+{
+ while (handled_component_p (t))
+ t = TREE_OPERAND (t, 0);
+
+ if (SSA_VAR_P (t)
+ || TREE_CODE (t) == STRING_CST
+ || TREE_CODE (t) == CONSTRUCTOR
+ || INDIRECT_REF_P (t))
+ return t;
+ else
+ return NULL_TREE;
+}
+
+void
+recalculate_side_effects (tree t)
+{
+ enum tree_code code = TREE_CODE (t);
+ int len = TREE_OPERAND_LENGTH (t);
+ int i;
+
+ switch (TREE_CODE_CLASS (code))
+ {
+ case tcc_expression:
+ switch (code)
+ {
+ case INIT_EXPR:
+ case MODIFY_EXPR:
+ case VA_ARG_EXPR:
+ case PREDECREMENT_EXPR:
+ case PREINCREMENT_EXPR:
+ case POSTDECREMENT_EXPR:
+ case POSTINCREMENT_EXPR:
+ /* All of these have side-effects, no matter what their
+ operands are. */
+ return;
+
+ default:
+ break;
+ }
+ /* Fall through. */
+
+ case tcc_comparison: /* a comparison expression */
+ case tcc_unary: /* a unary arithmetic expression */
+ case tcc_binary: /* a binary arithmetic expression */
+ case tcc_reference: /* a reference */
+ case tcc_vl_exp: /* a function call */
+ TREE_SIDE_EFFECTS (t) = TREE_THIS_VOLATILE (t);
+ for (i = 0; i < len; ++i)
+ {
+ tree op = TREE_OPERAND (t, i);
+ if (op && TREE_SIDE_EFFECTS (op))
+ TREE_SIDE_EFFECTS (t) = 1;
+ }
+ break;
+
+ default:
+ /* Can never be used with non-expressions. */
+ gcc_unreachable ();
+ }
+}
+
+/* Canonicalize a tree T for use in a COND_EXPR as conditional. Returns
+ a canonicalized tree that is valid for a COND_EXPR or NULL_TREE, if
+ we failed to create one. */
+
+tree
+canonicalize_cond_expr_cond (tree t)
+{
+ /* For (bool)x use x != 0. */
+ if (TREE_CODE (t) == NOP_EXPR
+ && TREE_TYPE (t) == boolean_type_node)
+ {
+ tree top0 = TREE_OPERAND (t, 0);
+ t = build2 (NE_EXPR, TREE_TYPE (t),
+ top0, build_int_cst (TREE_TYPE (top0), 0));
+ }
+ /* For !x use x == 0. */
+ else if (TREE_CODE (t) == TRUTH_NOT_EXPR)
+ {
+ tree top0 = TREE_OPERAND (t, 0);
+ t = build2 (EQ_EXPR, TREE_TYPE (t),
+ top0, build_int_cst (TREE_TYPE (top0), 0));
+ }
+ /* For cmp ? 1 : 0 use cmp. */
+ else if (TREE_CODE (t) == COND_EXPR
+ && COMPARISON_CLASS_P (TREE_OPERAND (t, 0))
+ && integer_onep (TREE_OPERAND (t, 1))
+ && integer_zerop (TREE_OPERAND (t, 2)))
+ {
+ tree top0 = TREE_OPERAND (t, 0);
+ t = build2 (TREE_CODE (top0), TREE_TYPE (t),
+ TREE_OPERAND (top0, 0), TREE_OPERAND (top0, 1));
+ }
+
+ if (is_gimple_condexpr (t))
+ return t;
+
+ return NULL_TREE;
+}
+
+#include "gt-gimple.h"
diff --git a/gcc/gimple.def b/gcc/gimple.def
new file mode 100644
index 00000000000..23eaae2e86e
--- /dev/null
+++ b/gcc/gimple.def
@@ -0,0 +1,357 @@
+/* This file contains the definitions of the GIMPLE IR tuples used in GCC.
+
+ Copyright (C) 2007, 2008 Free Software Foundation, Inc.
+ Contributed by Aldy Hernandez <aldyh@redhat.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+/* The format of this file is
+ DEFGSCODE(GIMPLE_symbol, printable name, structure).
+
+ Where symbol is the enumeration name without the ``GIMPLE_''.
+ The argument STRUCTURE is used to compute offsets into each of the
+ tuple structures that contain operands. Since vector operands
+ are at different offsets depending on the particular structure
+ used, these offsets are computed at compile time for efficient
+ lookup at runtime. See gimple_ops().
+
+ If a code does not use operand vectors, STRUCTURE should be NULL. */
+
+/* Error marker. This is used in similar ways as ERROR_MARK in tree.def. */
+DEFGSCODE(GIMPLE_ERROR_MARK, "gimple_error_mark", NULL)
+
+/* IMPORTANT. Do not rearrange the codes between GIMPLE_COND and
+ GIMPLE_RETURN. The ordering is exposed by gimple_has_ops calls.
+ These are all the GIMPLE statements with register operands. */
+
+/* GIMPLE_COND <COND_CODE, OP1, OP2, TRUE_LABEL, FALSE_LABEL>
+ represents the conditional jump:
+
+ if (OP1 COND_CODE OP2) goto TRUE_LABEL else goto FALSE_LABEL
+
+ COND_CODE is the tree code used as the comparison predicate. It
+ must be of class tcc_comparison.
+
+ OP1 and OP2 are the operands used in the comparison. They must be
+ accepted by is_gimple_operand.
+
+ TRUE_LABEL and FALSE_LABEL are the LABEL_DECL nodes used as the
+ jump target for the comparison. */
+DEFGSCODE(GIMPLE_COND, "gimple_cond", struct gimple_statement_with_ops)
+
+/* GIMPLE_GOTO <TARGET> represents unconditional jumps.
+ TARGET is a LABEL_DECL or an expression node for computed GOTOs. */
+DEFGSCODE(GIMPLE_GOTO, "gimple_goto", struct gimple_statement_with_ops)
+
+/* GIMPLE_LABEL <LABEL> represents label statements. LABEL is a
+ LABEL_DECL representing a jump target. */
+DEFGSCODE(GIMPLE_LABEL, "gimple_label", struct gimple_statement_with_ops)
+
+/* GIMPLE_SWITCH <INDEX, DEFAULT_LAB, LAB1, ..., LABN> represents the
+ multiway branch:
+
+ switch (INDEX)
+ {
+ case LAB1: ...; break;
+ ...
+ case LABN: ...; break;
+ default: ...
+ }
+
+ INDEX is the variable evaluated to decide which label to jump to.
+
+ DEFAULT_LAB, LAB1 ... LABN are the tree nodes representing case labels.
+ They must be CASE_LABEL_EXPR nodes. */
+DEFGSCODE(GIMPLE_SWITCH, "gimple_switch", struct gimple_statement_with_ops)
+
+/* GIMPLE_CHANGE_DYNAMIC_TYPE indicates a change in the dynamic type
+ of a memory location. This has no value and generates no
+ executable code. It is only used for type based alias analysis.
+ This is generated by C++ placement new and it's a direct
+ translation from CHANGE_DYNAMIC_TYPE_EXPR. The first operand
+ (gimple_cdt_new_type) is the new type. The second operand
+ (gimple_cdt_location) is the location (pointer) whose type is being
+ changed. */
+DEFGSCODE(GIMPLE_CHANGE_DYNAMIC_TYPE, "gimple_change_dynamic_type",
+ struct gimple_statement_with_ops)
+
+/* IMPORTANT.
+
+ Do not rearrange the codes between GIMPLE_ASSIGN and GIMPLE_RETURN.
+ It's exposed by GIMPLE_RANGE_CHECK calls. These are all the GIMPLE
+ statements with memory and register operands. */
+
+/* GIMPLE_ASSIGN <SUBCODE, LHS, RHS1[, RHS2]> represents the assignment
+ statement
+
+ LHS = RHS1 SUBCODE RHS2.
+
+ SUBCODE is the tree code for the expression computed by the RHS of the
+ assignment. It must be one of the tree codes accepted by
+ get_gimple_rhs_class.
+
+ LHS is the operand on the LHS of the assignment. It must be a tree node
+ accepted by is_gimple_operand.
+
+ RHS1 is the first operand on the RHS of the assignment. It must be a tree
+ node accepted by is_gimple_operand.
+
+ RHS2 is the second operand on the RHS of the assignemnt. It must be a tree
+ node accepted by is_gimple_operand. This argument exists only if SUBCODE is
+ of class GIMPLE_BINARY_RHS. */
+DEFGSCODE(GIMPLE_ASSIGN, "gimple_assign",
+ struct gimple_statement_with_memory_ops)
+
+/* GIMPLE_ASM <STRING, I1, ..., IN, O1, ... OM, C1, ..., CP>
+ represents inline assembly statements.
+
+ STRING is the string containing the assembly statements.
+ I1 ... IN are the N input operands.
+ O1 ... OM are the M output operands.
+ C1 ... CP are the P clobber operands. */
+DEFGSCODE(GIMPLE_ASM, "gimple_asm", struct gimple_statement_asm)
+
+/* GIMPLE_CALL <FN, LHS, ARG1, ..., ARGN[, CHAIN]> represents function
+ calls.
+
+ FN is the callee. It must be accepted by is_gimple_call_addr.
+
+ LHS is the operand where the return value from FN is stored. It may
+ be NULL.
+
+ ARG1 ... ARGN are the arguments. They must all be accepted by
+ is_gimple_operand.
+
+ CHAIN is the optional static chain link for nested functions. */
+DEFGSCODE(GIMPLE_CALL, "gimple_call",
+ struct gimple_statement_with_memory_ops)
+
+/* GIMPLE_RETURN <RETVAL> represents return statements.
+
+ RETVAL is the value to return or NULL. If a value is returned it
+ must be accepted by is_gimple_operand. */
+DEFGSCODE(GIMPLE_RETURN, "gimple_return",
+ struct gimple_statement_with_memory_ops)
+
+/* GIMPLE_BIND <VARS, BLOCK, BODY> represents a lexical scope.
+ VARS is the set of variables declared in that scope.
+ BLOCK is the symbol binding block used for debug information.
+ BODY is the sequence of statements in the scope. */
+DEFGSCODE(GIMPLE_BIND, "gimple_bind", NULL)
+
+/* GIMPLE_CATCH <TYPES, HANDLER> represents a typed exception handler.
+ TYPES is the type (or list of types) handled. HANDLER is the
+ sequence of statements that handle these types. */
+DEFGSCODE(GIMPLE_CATCH, "gimple_catch", NULL)
+
+/* GIMPLE_EH_FILTER <TYPES, FAILURE> represents an exception
+ specification. TYPES is a list of allowed types and FAILURE is the
+ sequence of statements to execute on failure. */
+DEFGSCODE(GIMPLE_EH_FILTER, "gimple_eh_filter", NULL)
+
+/* GIMPLE_PHI <RESULT, ARG1, ..., ARGN> represents the PHI node
+
+ RESULT = PHI <ARG1, ..., ARGN>
+
+ RESULT is the SSA name created by this PHI node.
+
+ ARG1 ... ARGN are the arguments to the PHI node. N must be
+ exactly the same as the number of incoming edges to the basic block
+ holding the PHI node. Every argument is either an SSA name or a
+ tree node of class tcc_constant. */
+DEFGSCODE(GIMPLE_PHI, "gimple_phi", NULL)
+
+/* GIMPLE_RESX <REGION> resumes execution after an exception.
+ REGION is the region number being left. */
+DEFGSCODE(GIMPLE_RESX, "gimple_resx", NULL)
+
+/* GIMPLE_TRY <TRY_KIND, EVAL, CLEANUP>
+ represents a try/catch or a try/finally statement.
+
+ TRY_KIND is either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY.
+
+ EVAL is the sequence of statements to execute on entry to GIMPLE_TRY.
+
+ CLEANUP is the sequence of statements to execute according to
+ TRY_KIND. If TRY_KIND is GIMPLE_TRY_CATCH, CLEANUP is only exected
+ if an exception is thrown during execution of EVAL. If TRY_KIND is
+ GIMPLE_TRY_FINALLY, CLEANUP is always executed after executing EVAL
+ (regardless of whether EVAL finished normally, or jumped out or an
+ exception was thrown). */
+DEFGSCODE(GIMPLE_TRY, "gimple_try", NULL)
+
+/* GIMPLE_NOP represents the "do nothing" statement. */
+DEFGSCODE(GIMPLE_NOP, "gimple_nop", NULL)
+
+
+/* IMPORTANT.
+
+ Do not rearrange any of the GIMPLE_OMP_* codes. This ordering is
+ exposed by the range check in gimple_omp_subcode(). */
+
+
+/* Tuples used for lowering of OMP_ATOMIC. Although the form of the OMP_ATOMIC
+ expression is very simple (just in form mem op= expr), various implicit
+ conversions may cause the expression to become more complex, so that it does
+ not fit the gimple grammar very well. To overcome this problem, OMP_ATOMIC
+ is rewritten as a sequence of two codes in gimplification:
+
+ GIMPLE_OMP_LOAD (tmp, mem)
+ val = some computations involving tmp;
+ GIMPLE_OMP_STORE (val). */
+DEFGSCODE(GIMPLE_OMP_ATOMIC_LOAD, "gimple_omp_atomic_load", NULL)
+DEFGSCODE(GIMPLE_OMP_ATOMIC_STORE, "gimple_omp_atomic_store", NULL)
+
+/* GIMPLE_OMP_CONTINUE marks the location of the loop or sections
+ iteration in partially lowered OpenMP code. */
+DEFGSCODE(GIMPLE_OMP_CONTINUE, "gimple_omp_continue", NULL)
+
+/* GIMPLE_OMP_CRITICAL <NAME, BODY> represents
+
+ #pragma omp critical [name]
+
+ NAME is the name given to the critical section.
+ BODY is the sequence of statements that are inside the critical section. */
+DEFGSCODE(GIMPLE_OMP_CRITICAL, "gimple_omp_critical", NULL)
+
+/* GIMPLE_OMP_FOR <BODY, CLAUSES, INDEX, INITIAL, FINAL, COND, INCR, PRE_BODY>
+ represents
+
+ PRE_BODY
+ #pragma omp for [clause1 ... clauseN]
+ for (INDEX = INITIAL; INDEX COND FINAL; INDEX {+=,-=} INCR)
+ BODY
+
+ BODY is the loop body.
+
+ CLAUSES is the list of clauses.
+
+ INDEX must be an integer or pointer variable, which is implicitly thread
+ private. It must be accepted by is_gimple_operand.
+
+ INITIAL is the initial value given to INDEX. It must be
+ accepted by is_gimple_operand.
+
+ FINAL is the final value that INDEX should take. It must
+ be accepted by is_gimple_operand.
+
+ COND is the condition code for the controlling predicate. It must
+ be one of { <, >, <=, >= }
+
+ INCR is the loop index increment. It must be tree node of type
+ tcc_constant.
+
+ PRE_BODY is a landing pad filled by the gimplifier with things from
+ INIT, COND, and INCR that are technically part of the OMP_FOR
+ structured block, but are evaluated before the loop body begins.
+
+ INITIAL, FINAL and INCR are required to be loop invariant integer
+ expressions that are evaluated without any synchronization.
+ The evaluation order, frequency of evaluation and side-effects are
+ unspecified by the standard. */
+DEFGSCODE(GIMPLE_OMP_FOR, "gimple_omp_for", NULL)
+
+/* GIMPLE_OMP_MASTER <BODY> represents #pragma omp master.
+ BODY is the sequence of statements to execute in the master section. */
+DEFGSCODE(GIMPLE_OMP_MASTER, "gimple_omp_master", NULL)
+
+/* GIMPLE_OMP_ORDERED <BODY> represents #pragma omp ordered.
+ BODY is the sequence of statements to execute in the ordered section. */
+DEFGSCODE(GIMPLE_OMP_ORDERED, "gimple_omp_ordered", NULL)
+
+/* GIMPLE_OMP_PARALLEL <BODY, CLAUSES, CHILD_FN, DATA_ARG> represents
+
+ #pragma omp parallel [CLAUSES]
+ BODY
+
+ BODY is a the sequence of statements to be executed by all threads.
+
+ CLAUSES is a TREE_LIST node with all the clauses.
+
+ CHILD_FN is set when outlining the body of the parallel region.
+ All the statements in BODY are moved into this newly created
+ function when converting OMP constructs into low-GIMPLE.
+
+ DATA_ARG is a local variable in the parent function containing data
+ to be shared with CHILD_FN. This is used to implement all the data
+ sharing clauses. */
+DEFGSCODE(GIMPLE_OMP_PARALLEL, "gimple_omp_parallel", NULL)
+
+/* GIMPLE_OMP_TASK <BODY, CLAUSES, CHILD_FN, DATA_ARG, COPY_FN,
+ ARG_SIZE, ARG_ALIGN> represents
+
+ #pragma omp task [CLAUSES]
+ BODY
+
+ BODY is a the sequence of statements to be executed by all threads.
+
+ CLAUSES is a TREE_LIST node with all the clauses.
+
+ CHILD_FN is set when outlining the body of the explicit task region.
+ All the statements in BODY are moved into this newly created
+ function when converting OMP constructs into low-GIMPLE.
+
+ DATA_ARG is a local variable in the parent function containing data
+ to be shared with CHILD_FN. This is used to implement all the data
+ sharing clauses.
+
+ COPY_FN is set when outlining the firstprivate var initialization.
+ All the needed statements are emitted into the newly created
+ function, or when only memcpy is needed, it is NULL.
+
+ ARG_SIZE and ARG_ALIGN are the size and alignment of the incoming
+ data area allocated by GOMP_task and passed to CHILD_FN. */
+DEFGSCODE(GIMPLE_OMP_TASK, "gimple_omp_task", NULL)
+
+/* OMP_RETURN marks the end of an OpenMP directive. */
+DEFGSCODE(GIMPLE_OMP_RETURN, "gimple_omp_return", NULL)
+
+/* OMP_SECTION <BODY> represents #pragma omp section.
+ BODY is the sequence of statements in the section body. */
+DEFGSCODE(GIMPLE_OMP_SECTION, "gimple_omp_section", NULL)
+
+/* OMP_SECTIONS <BODY, CLAUSES, CONTROL> represents #pragma omp sections.
+
+ BODY is the sequence of statements in the sections body.
+ CLAUSES is a TREE_LIST node holding the list of associated clauses.
+ CONTROL is a VAR_DECL used for deciding which of the sections
+ to execute. */
+DEFGSCODE(GIMPLE_OMP_SECTIONS, "gimple_omp_sections", NULL)
+
+/* GIMPLE_OMP_SECTIONS_SWITCH is a marker placed immediately after
+ OMP_SECTIONS. It represents the GIMPLE_SWITCH used to decide which
+ branch is taken. */
+DEFGSCODE(GIMPLE_OMP_SECTIONS_SWITCH, "gimple_omp_sections_switch", NULL)
+
+/* GIMPLE_OMP_SINGLE <BODY, CLAUSES> represents #pragma omp single
+ BODY is the sequence of statements inside the single section.
+ CLAUSES is a TREE_LIST node holding the associated clauses. */
+DEFGSCODE(GIMPLE_OMP_SINGLE, "gimple_omp_single", NULL)
+
+/* GIMPLE_PREDICT <PREDICT, OUTCOME> specifies a hint for branch prediction.
+
+ PREDICT is one of the predictors from predict.def.
+
+ OUTCOME is NOT_TAKEN or TAKEN. */
+DEFGSCODE(GIMPLE_PREDICT, "gimple_predict", NULL)
+
+/* This node represents a cleanup expression. It is ONLY USED INTERNALLY
+ by the gimplifier as a placeholder for cleanups, and its uses will be
+ cleaned up by the time gimplification is done.
+
+ This tuple should not exist outside of the gimplifier proper. */
+DEFGSCODE(GIMPLE_WITH_CLEANUP_EXPR, "gimple_with_cleanup_expr", NULL)
diff --git a/gcc/gimple.h b/gcc/gimple.h
new file mode 100644
index 00000000000..2f6af03117e
--- /dev/null
+++ b/gcc/gimple.h
@@ -0,0 +1,4573 @@
+/* Gimple IR definitions.
+
+ Copyright 2007, 2008 Free Software Foundation, Inc.
+ Contributed by Aldy Hernandez <aldyh@redhat.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef GCC_GIMPLE_H
+#define GCC_GIMPLE_H
+
+#include "pointer-set.h"
+#include "vec.h"
+#include "ggc.h"
+#include "tm.h"
+#include "hard-reg-set.h"
+#include "basic-block.h"
+#include "tree-ssa-operands.h"
+
+DEF_VEC_P(gimple);
+DEF_VEC_ALLOC_P(gimple,heap);
+DEF_VEC_ALLOC_P(gimple,gc);
+
+DEF_VEC_P(gimple_seq);
+DEF_VEC_ALLOC_P(gimple_seq,gc);
+DEF_VEC_ALLOC_P(gimple_seq,heap);
+
+enum gimple_code {
+#define DEFGSCODE(SYM, STRING, STRUCT) SYM,
+#include "gimple.def"
+#undef DEFGSCODE
+ LAST_AND_UNUSED_GIMPLE_CODE
+};
+
+extern const char *const gimple_code_name[];
+extern const unsigned char gimple_rhs_class_table[];
+
+/* Error out if a gimple tuple is addressed incorrectly. */
+#if defined ENABLE_GIMPLE_CHECKING
+extern void gimple_check_failed (const_gimple, const char *, int, \
+ const char *, enum gimple_code, \
+ enum tree_code) ATTRIBUTE_NORETURN;
+extern void gimple_range_check_failed (const_gimple, const char *, int, \
+ const char *, enum gimple_code, \
+ enum gimple_code) ATTRIBUTE_NORETURN;
+
+#define GIMPLE_CHECK(GS, CODE) \
+ do { \
+ const_gimple __gs = (GS); \
+ if (gimple_code (__gs) != (CODE)) \
+ gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
+ (CODE), 0); \
+ } while (0)
+#else /* not ENABLE_GIMPLE_CHECKING */
+#define GIMPLE_CHECK(GS, CODE) (void)0
+#endif
+
+/* Class of GIMPLE expressions suitable for the RHS of assignments. See
+ get_gimple_rhs_class. */
+enum gimple_rhs_class
+{
+ GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */
+ GIMPLE_BINARY_RHS, /* The expression is a binary operation. */
+ GIMPLE_UNARY_RHS, /* The expression is a unary operation. */
+ GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA
+ name, a _DECL, a _REF, etc. */
+};
+
+/* Specific flags for individual GIMPLE statements. These flags are
+ always stored in gimple_statement_base.subcode and they may only be
+ defined for statement codes that do not use sub-codes.
+
+ Values for the masks can overlap as long as the overlapping values
+ are never used in the same statement class.
+
+ The maximum mask value that can be defined is 1 << 15 (i.e., each
+ statement code can hold up to 16 bitflags).
+
+ Keep this list sorted. */
+enum gf_mask {
+ GF_ASM_INPUT = 1 << 0,
+ GF_ASM_VOLATILE = 1 << 1,
+ GF_CALL_CANNOT_INLINE = 1 << 0,
+ GF_CALL_FROM_THUNK = 1 << 1,
+ GF_CALL_RETURN_SLOT_OPT = 1 << 2,
+ GF_CALL_TAILCALL = 1 << 3,
+ GF_CALL_VA_ARG_PACK = 1 << 4,
+ GF_OMP_PARALLEL_COMBINED = 1 << 0,
+
+ /* True on an GIMPLE_OMP_RETURN statement if the return does not require
+ a thread synchronization via some sort of barrier. The exact barrier
+ that would otherwise be emitted is dependent on the OMP statement with
+ which this return is associated. */
+ GF_OMP_RETURN_NOWAIT = 1 << 0,
+
+ GF_OMP_SECTION_LAST = 1 << 0,
+ GF_PREDICT_TAKEN = 1 << 15
+};
+
+/* Masks for selecting a pass local flag (PLF) to work on. These
+ masks are used by gimple_set_plf and gimple_plf. */
+enum plf_mask {
+ GF_PLF_1 = 1 << 0,
+ GF_PLF_2 = 1 << 1
+};
+
+/* A node in a gimple_seq_d. */
+struct gimple_seq_node_d GTY((chain_next ("%h.next"), chain_prev ("%h.prev")))
+{
+ gimple stmt;
+ struct gimple_seq_node_d *prev;
+ struct gimple_seq_node_d *next;
+};
+
+/* A double-linked sequence of gimple statements. */
+struct gimple_seq_d GTY ((chain_next ("%h.next_free")))
+{
+ /* First and last statements in the sequence. */
+ gimple_seq_node first;
+ gimple_seq_node last;
+
+ /* Sequences are created/destroyed frequently. To minimize
+ allocation activity, deallocated sequences are kept in a pool of
+ available sequences. This is the pointer to the next free
+ sequence in the pool. */
+ gimple_seq next_free;
+};
+
+
+/* Return the first node in GIMPLE sequence S. */
+
+static inline gimple_seq_node
+gimple_seq_first (const_gimple_seq s)
+{
+ return s ? s->first : NULL;
+}
+
+
+/* Return the first statement in GIMPLE sequence S. */
+
+static inline gimple
+gimple_seq_first_stmt (const_gimple_seq s)
+{
+ gimple_seq_node n = gimple_seq_first (s);
+ return (n) ? n->stmt : NULL;
+}
+
+
+/* Return the last node in GIMPLE sequence S. */
+
+static inline gimple_seq_node
+gimple_seq_last (const_gimple_seq s)
+{
+ return s ? s->last : NULL;
+}
+
+
+/* Return the last statement in GIMPLE sequence S. */
+
+static inline gimple
+gimple_seq_last_stmt (const_gimple_seq s)
+{
+ gimple_seq_node n = gimple_seq_last (s);
+ return (n) ? n->stmt : NULL;
+}
+
+
+/* Set the last node in GIMPLE sequence S to LAST. */
+
+static inline void
+gimple_seq_set_last (gimple_seq s, gimple_seq_node last)
+{
+ s->last = last;
+}
+
+
+/* Set the first node in GIMPLE sequence S to FIRST. */
+
+static inline void
+gimple_seq_set_first (gimple_seq s, gimple_seq_node first)
+{
+ s->first = first;
+}
+
+
+/* Return true if GIMPLE sequence S is empty. */
+
+static inline bool
+gimple_seq_empty_p (const_gimple_seq s)
+{
+ return s == NULL || s->first == NULL;
+}
+
+
+void gimple_seq_add_stmt (gimple_seq *, gimple);
+
+/* Allocate a new sequence and initialize its first element with STMT. */
+
+static inline gimple_seq
+gimple_seq_alloc_with_stmt (gimple stmt)
+{
+ gimple_seq seq = NULL;
+ gimple_seq_add_stmt (&seq, stmt);
+ return seq;
+}
+
+
+/* Returns the sequence of statements in BB. */
+
+static inline gimple_seq
+bb_seq (const_basic_block bb)
+{
+ return (!(bb->flags & BB_RTL) && bb->il.gimple) ? bb->il.gimple->seq : NULL;
+}
+
+
+/* Sets the sequence of statements in BB to SEQ. */
+
+static inline void
+set_bb_seq (basic_block bb, gimple_seq seq)
+{
+ gcc_assert (!(bb->flags & BB_RTL));
+ bb->il.gimple->seq = seq;
+}
+
+/* Iterator object for GIMPLE statement sequences. */
+
+typedef struct
+{
+ /* Sequence node holding the current statement. */
+ gimple_seq_node ptr;
+
+ /* Sequence and basic block holding the statement. These fields
+ are necessary to handle edge cases such as when statement is
+ added to an empty basic block or when the last statement of a
+ block/sequence is removed. */
+ gimple_seq seq;
+ basic_block bb;
+} gimple_stmt_iterator;
+
+
+/* Data structure definitions for GIMPLE tuples. NOTE: word markers
+ are for 64 bit hosts. */
+
+struct gimple_statement_base GTY(())
+{
+ /* [ WORD 1 ]
+ Main identifying code for a tuple. */
+ ENUM_BITFIELD(gimple_code) code : 8;
+
+ /* Nonzero if a warning should not be emitted on this tuple. */
+ unsigned int no_warning : 1;
+
+ /* Nonzero if this tuple has been visited. Passes are responsible
+ for clearing this bit before using it. */
+ unsigned int visited : 1;
+
+ /* Nonzero if this tuple represents a non-temporal move. */
+ unsigned int nontemporal_move : 1;
+
+ /* Pass local flags. These flags are free for any pass to use as
+ they see fit. Passes should not assume that these flags contain
+ any useful value when the pass starts. Any initial state that
+ the pass requires should be set on entry to the pass. See
+ gimple_set_plf and gimple_plf for usage. */
+ unsigned int plf : 2;
+
+ /* Nonzero if this statement has been modified and needs to have its
+ operands rescanned. */
+ unsigned modified : 1;
+
+ /* Nonzero if this statement contains volatile operands. */
+ unsigned has_volatile_ops : 1;
+
+ /* Nonzero if this statement contains memory refernces. */
+ unsigned references_memory_p : 1;
+
+ /* The SUBCODE field can be used for tuple-specific flags for tuples
+ that do not require subcodes. Note that SUBCODE should be at
+ least as wide as tree codes, as several tuples store tree codes
+ in there. */
+ unsigned int subcode : 16;
+
+ /* UID of this statement. */
+ unsigned uid;
+
+ /* [ WORD 2 ]
+ Locus information for debug info. */
+ location_t location;
+
+ /* Number of operands in this tuple. */
+ unsigned num_ops;
+
+ /* [ WORD 3 ]
+ Basic block holding this statement. */
+ struct basic_block_def *bb;
+
+ /* [ WORD 4 ]
+ Lexical block holding this statement. */
+ tree block;
+};
+
+
+/* Base structure for tuples with operands. */
+
+struct gimple_statement_with_ops_base GTY(())
+{
+ /* [ WORD 1-4 ] */
+ struct gimple_statement_base gsbase;
+
+ /* [ WORD 5 ]
+ Symbols whose addresses are taken by this statement (i.e., they
+ appear inside ADDR_EXPR nodes). */
+ bitmap GTY((skip (""))) addresses_taken;
+
+ /* [ WORD 6-7 ]
+ SSA operand vectors. NOTE: It should be possible to
+ amalgamate these vectors with the operand vector OP. However,
+ the SSA operand vectors are organized differently and contain
+ more information (like immediate use chaining). */
+ struct def_optype_d GTY((skip (""))) *def_ops;
+ struct use_optype_d GTY((skip (""))) *use_ops;
+};
+
+
+/* Statements that take register operands. */
+
+struct gimple_statement_with_ops GTY(())
+{
+ /* [ WORD 1-7 ] */
+ struct gimple_statement_with_ops_base opbase;
+
+ /* [ WORD 8 ]
+ Operand vector. NOTE! This must always be the last field
+ of this structure. In particular, this means that this
+ structure cannot be embedded inside another one. */
+ tree GTY((length ("%h.opbase.gsbase.num_ops"))) op[1];
+};
+
+
+/* Base for statements that take both memory and register operands. */
+
+struct gimple_statement_with_memory_ops_base GTY(())
+{
+ /* [ WORD 1-7 ] */
+ struct gimple_statement_with_ops_base opbase;
+
+ /* [ WORD 8-9 ]
+ Vectors for virtual operands. */
+ struct voptype_d GTY((skip (""))) *vdef_ops;
+ struct voptype_d GTY((skip (""))) *vuse_ops;
+
+ /* [ WORD 9-10 ]
+ Symbols stored/loaded by this statement. */
+ bitmap GTY((skip (""))) stores;
+ bitmap GTY((skip (""))) loads;
+};
+
+
+/* Statements that take both memory and register operands. */
+
+struct gimple_statement_with_memory_ops GTY(())
+{
+ /* [ WORD 1-10 ] */
+ struct gimple_statement_with_memory_ops_base membase;
+
+ /* [ WORD 11 ]
+ Operand vector. NOTE! This must always be the last field
+ of this structure. In particular, this means that this
+ structure cannot be embedded inside another one. */
+ tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
+};
+
+
+/* OpenMP statements (#pragma omp). */
+
+struct gimple_statement_omp GTY(())
+{
+ /* [ WORD 1-4 ] */
+ struct gimple_statement_base gsbase;
+
+ /* [ WORD 5 ] */
+ gimple_seq body;
+};
+
+
+/* GIMPLE_BIND */
+
+struct gimple_statement_bind GTY(())
+{
+ /* [ WORD 1-4 ] */
+ struct gimple_statement_base gsbase;
+
+ /* [ WORD 5 ]
+ Variables declared in this scope. */
+ tree vars;
+
+ /* [ WORD 6 ]
+ This is different than the BLOCK field in gimple_statement_base,
+ which is analogous to TREE_BLOCK (i.e., the lexical block holding
+ this statement). This field is the equivalent of BIND_EXPR_BLOCK
+ in tree land (i.e., the lexical scope defined by this bind). See
+ gimple-low.c. */
+ tree block;
+
+ /* [ WORD 7 ] */
+ gimple_seq body;
+};
+
+
+/* GIMPLE_CATCH */
+
+struct gimple_statement_catch GTY(())
+{
+ /* [ WORD 1-4 ] */
+ struct gimple_statement_base gsbase;
+
+ /* [ WORD 5 ] */
+ tree types;
+
+ /* [ WORD 6 ] */
+ gimple_seq handler;
+};
+
+
+/* GIMPLE_EH_FILTER */
+
+struct gimple_statement_eh_filter GTY(())
+{
+ /* [ WORD 1-4 ] */
+ struct gimple_statement_base gsbase;
+
+ /* Subcode: EH_FILTER_MUST_NOT_THROW. A boolean flag analogous to
+ the tree counterpart. */
+
+ /* [ WORD 5 ]
+ Filter types. */
+ tree types;
+
+ /* [ WORD 6 ]
+ Failure actions. */
+ gimple_seq failure;
+};
+
+
+/* GIMPLE_PHI */
+
+struct gimple_statement_phi GTY(())
+{
+ /* [ WORD 1-4 ] */
+ struct gimple_statement_base gsbase;
+
+ /* [ WORD 5 ] */
+ unsigned capacity;
+ unsigned nargs;
+
+ /* [ WORD 6 ] */
+ tree result;
+
+ /* [ WORD 7 ] */
+ struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
+};
+
+
+/* GIMPLE_RESX */
+
+struct gimple_statement_resx GTY(())
+{
+ /* [ WORD 1-4 ] */
+ struct gimple_statement_base gsbase;
+
+ /* [ WORD 5 ]
+ Exception region number. */
+ int region;
+};
+
+
+/* GIMPLE_TRY */
+
+struct gimple_statement_try GTY(())
+{
+ /* [ WORD 1-4 ] */
+ struct gimple_statement_base gsbase;
+
+ /* [ WORD 5 ]
+ Expression to evaluate. */
+ gimple_seq eval;
+
+ /* [ WORD 6 ]
+ Cleanup expression. */
+ gimple_seq cleanup;
+};
+
+/* Kind of GIMPLE_TRY statements. */
+enum gimple_try_flags
+{
+ /* A try/catch. */
+ GIMPLE_TRY_CATCH = 1 << 0,
+
+ /* A try/finally. */
+ GIMPLE_TRY_FINALLY = 1 << 1,
+ GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
+
+ /* Analogous to TRY_CATCH_IS_CLEANUP. */
+ GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
+};
+
+/* GIMPLE_WITH_CLEANUP_EXPR */
+
+struct gimple_statement_wce GTY(())
+{
+ /* [ WORD 1-4 ] */
+ struct gimple_statement_base gsbase;
+
+ /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
+ executed if an exception is thrown, not on normal exit of its
+ scope. This flag is analogous to the CLEANUP_EH_ONLY flag
+ in TARGET_EXPRs. */
+
+ /* [ WORD 5 ]
+ Cleanup expression. */
+ gimple_seq cleanup;
+};
+
+
+/* GIMPLE_ASM */
+
+struct gimple_statement_asm GTY(())
+{
+ /* [ WORD 1-10 ] */
+ struct gimple_statement_with_memory_ops_base membase;
+
+ /* [ WORD 11 ]
+ __asm__ statement. */
+ const char *string;
+
+ /* [ WORD 12 ]
+ Number of inputs, outputs and clobbers. */
+ unsigned char ni;
+ unsigned char no;
+ unsigned short nc;
+
+ /* [ WORD 13 ]
+ Operand vector. NOTE! This must always be the last field
+ of this structure. In particular, this means that this
+ structure cannot be embedded inside another one. */
+ tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
+};
+
+/* GIMPLE_OMP_CRITICAL */
+
+struct gimple_statement_omp_critical GTY(())
+{
+ /* [ WORD 1-5 ] */
+ struct gimple_statement_omp omp;
+
+ /* [ WORD 6 ]
+ Critical section name. */
+ tree name;
+};
+
+
+struct gimple_omp_for_iter GTY(())
+{
+ /* Condition code. */
+ enum tree_code cond;
+
+ /* Index variable. */
+ tree index;
+
+ /* Initial value. */
+ tree initial;
+
+ /* Final value. */
+ tree final;
+
+ /* Increment. */
+ tree incr;
+};
+
+/* GIMPLE_OMP_FOR */
+
+struct gimple_statement_omp_for GTY(())
+{
+ /* [ WORD 1-5 ] */
+ struct gimple_statement_omp omp;
+
+ /* [ WORD 6 ] */
+ tree clauses;
+
+ /* [ WORD 7 ]
+ Number of elements in iter array. */
+ size_t collapse;
+
+ /* [ WORD 8 ] */
+ struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
+
+ /* [ WORD 9 ]
+ Pre-body evaluated before the loop body begins. */
+ gimple_seq pre_body;
+};
+
+
+/* GIMPLE_OMP_PARALLEL */
+
+struct gimple_statement_omp_parallel GTY(())
+{
+ /* [ WORD 1-5 ] */
+ struct gimple_statement_omp omp;
+
+ /* [ WORD 6 ]
+ Clauses. */
+ tree clauses;
+
+ /* [ WORD 7 ]
+ Child function holding the body of the parallel region. */
+ tree child_fn;
+
+ /* [ WORD 8 ]
+ Shared data argument. */
+ tree data_arg;
+};
+
+
+/* GIMPLE_OMP_TASK */
+
+struct gimple_statement_omp_task GTY(())
+{
+ /* [ WORD 1-8 ] */
+ struct gimple_statement_omp_parallel par;
+
+ /* [ WORD 9 ]
+ Child function holding firstprivate initialization if needed. */
+ tree copy_fn;
+
+ /* [ WORD 10-11 ]
+ Size and alignment in bytes of the argument data block. */
+ tree arg_size;
+ tree arg_align;
+};
+
+
+/* GIMPLE_OMP_SECTION */
+/* Uses struct gimple_statement_omp. */
+
+
+/* GIMPLE_OMP_SECTIONS */
+
+struct gimple_statement_omp_sections GTY(())
+{
+ /* [ WORD 1-5 ] */
+ struct gimple_statement_omp omp;
+
+ /* [ WORD 6 ] */
+ tree clauses;
+
+ /* [ WORD 7 ]
+ The control variable used for deciding which of the sections to
+ execute. */
+ tree control;
+};
+
+/* GIMPLE_OMP_CONTINUE.
+
+ Note: This does not inherit from gimple_statement_omp, because we
+ do not need the body field. */
+
+struct gimple_statement_omp_continue GTY(())
+{
+ /* [ WORD 1-4 ] */
+ struct gimple_statement_base gsbase;
+
+ /* [ WORD 5 ] */
+ tree control_def;
+
+ /* [ WORD 6 ] */
+ tree control_use;
+};
+
+/* GIMPLE_OMP_SINGLE */
+
+struct gimple_statement_omp_single GTY(())
+{
+ /* [ WORD 1-5 ] */
+ struct gimple_statement_omp omp;
+
+ /* [ WORD 6 ] */
+ tree clauses;
+};
+
+
+/* GIMPLE_OMP_ATOMIC_LOAD.
+ Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
+ contains a sequence, which we don't need here. */
+
+struct gimple_statement_omp_atomic_load GTY(())
+{
+ /* [ WORD 1-4 ] */
+ struct gimple_statement_base gsbase;
+
+ /* [ WORD 5-6 ] */
+ tree rhs, lhs;
+};
+
+/* GIMPLE_OMP_ATOMIC_STORE.
+ See note on GIMPLE_OMP_ATOMIC_LOAD. */
+
+struct gimple_statement_omp_atomic_store GTY(())
+{
+ /* [ WORD 1-4 ] */
+ struct gimple_statement_base gsbase;
+
+ /* [ WORD 5 ] */
+ tree val;
+};
+
+enum gimple_statement_structure_enum {
+#define DEFGSSTRUCT(SYM, STRING) SYM,
+#include "gsstruct.def"
+#undef DEFGSSTRUCT
+ LAST_GSS_ENUM
+};
+
+
+/* Define the overall contents of a gimple tuple. It may be any of the
+ structures declared above for various types of tuples. */
+
+union gimple_statement_d GTY ((desc ("gimple_statement_structure (&%h)")))
+{
+ struct gimple_statement_base GTY ((tag ("GSS_BASE"))) gsbase;
+ struct gimple_statement_with_ops GTY ((tag ("GSS_WITH_OPS"))) gsops;
+ struct gimple_statement_with_memory_ops GTY ((tag ("GSS_WITH_MEM_OPS"))) gsmem;
+ struct gimple_statement_omp GTY ((tag ("GSS_OMP"))) omp;
+ struct gimple_statement_bind GTY ((tag ("GSS_BIND"))) gimple_bind;
+ struct gimple_statement_catch GTY ((tag ("GSS_CATCH"))) gimple_catch;
+ struct gimple_statement_eh_filter GTY ((tag ("GSS_EH_FILTER"))) gimple_eh_filter;
+ struct gimple_statement_phi GTY ((tag ("GSS_PHI"))) gimple_phi;
+ struct gimple_statement_resx GTY ((tag ("GSS_RESX"))) gimple_resx;
+ struct gimple_statement_try GTY ((tag ("GSS_TRY"))) gimple_try;
+ struct gimple_statement_wce GTY ((tag ("GSS_WCE"))) gimple_wce;
+ struct gimple_statement_asm GTY ((tag ("GSS_ASM"))) gimple_asm;
+ struct gimple_statement_omp_critical GTY ((tag ("GSS_OMP_CRITICAL"))) gimple_omp_critical;
+ struct gimple_statement_omp_for GTY ((tag ("GSS_OMP_FOR"))) gimple_omp_for;
+ struct gimple_statement_omp_parallel GTY ((tag ("GSS_OMP_PARALLEL"))) gimple_omp_parallel;
+ struct gimple_statement_omp_task GTY ((tag ("GSS_OMP_TASK"))) gimple_omp_task;
+ struct gimple_statement_omp_sections GTY ((tag ("GSS_OMP_SECTIONS"))) gimple_omp_sections;
+ struct gimple_statement_omp_single GTY ((tag ("GSS_OMP_SINGLE"))) gimple_omp_single;
+ struct gimple_statement_omp_continue GTY ((tag ("GSS_OMP_CONTINUE"))) gimple_omp_continue;
+ struct gimple_statement_omp_atomic_load GTY ((tag ("GSS_OMP_ATOMIC_LOAD"))) gimple_omp_atomic_load;
+ struct gimple_statement_omp_atomic_store GTY ((tag ("GSS_OMP_ATOMIC_STORE"))) gimple_omp_atomic_store;
+};
+
+/* In gimple.c. */
+gimple gimple_build_return (tree);
+
+gimple gimple_build_assign_stat (tree, tree MEM_STAT_DECL);
+#define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
+
+void extract_ops_from_tree (tree, enum tree_code *, tree *, tree *);
+
+gimple gimple_build_assign_with_ops_stat (enum tree_code, tree, tree,
+ tree MEM_STAT_DECL);
+#define gimple_build_assign_with_ops(c,o1,o2,o3) \
+ gimple_build_assign_with_ops_stat (c, o1, o2, o3 MEM_STAT_INFO)
+
+gimple gimple_build_call_vec (tree, VEC(tree, heap) *);
+gimple gimple_build_call (tree, unsigned, ...);
+gimple gimple_build_call_from_tree (tree);
+gimple gimplify_assign (tree, tree, gimple_seq *);
+gimple gimple_build_cond (enum tree_code, tree, tree, tree, tree);
+gimple gimple_build_label (tree label);
+gimple gimple_build_goto (tree dest);
+gimple gimple_build_nop (void);
+gimple gimple_build_bind (tree, gimple_seq, tree);
+gimple gimple_build_asm (const char *, unsigned, unsigned, unsigned, ...);
+gimple gimple_build_asm_vec (const char *, VEC(tree,gc) *, VEC(tree,gc) *,
+ VEC(tree,gc) *);
+gimple gimple_build_catch (tree, gimple_seq);
+gimple gimple_build_eh_filter (tree, gimple_seq);
+gimple gimple_build_try (gimple_seq, gimple_seq, unsigned int);
+gimple gimple_build_wce (gimple_seq);
+gimple gimple_build_resx (int);
+gimple gimple_build_switch (unsigned, tree, tree, ...);
+gimple gimple_build_switch_vec (tree, tree, VEC(tree,heap) *);
+gimple gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
+gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree);
+gimple gimple_build_omp_for (gimple_seq, tree, size_t, gimple_seq);
+gimple gimple_build_omp_critical (gimple_seq, tree);
+gimple gimple_build_omp_section (gimple_seq);
+gimple gimple_build_omp_continue (tree, tree);
+gimple gimple_build_omp_master (gimple_seq);
+gimple gimple_build_omp_return (bool);
+gimple gimple_build_omp_ordered (gimple_seq);
+gimple gimple_build_omp_sections (gimple_seq, tree);
+gimple gimple_build_omp_sections_switch (void);
+gimple gimple_build_omp_single (gimple_seq, tree);
+gimple gimple_build_cdt (tree, tree);
+gimple gimple_build_omp_atomic_load (tree, tree);
+gimple gimple_build_omp_atomic_store (tree);
+gimple gimple_build_predict (enum br_predictor, enum prediction);
+enum gimple_statement_structure_enum gimple_statement_structure (gimple);
+enum gimple_statement_structure_enum gss_for_assign (enum tree_code);
+void sort_case_labels (VEC(tree,heap) *);
+void gimple_set_body (tree, gimple_seq);
+gimple_seq gimple_body (tree);
+gimple_seq gimple_seq_alloc (void);
+void gimple_seq_free (gimple_seq);
+void gimple_seq_add_seq (gimple_seq *, gimple_seq);
+gimple_seq gimple_seq_copy (gimple_seq);
+int gimple_call_flags (const_gimple);
+bool gimple_assign_copy_p (gimple);
+bool gimple_assign_ssa_name_copy_p (gimple);
+bool gimple_assign_single_p (gimple);
+bool gimple_assign_unary_nop_p (gimple);
+void gimple_set_bb (gimple, struct basic_block_def *);
+tree gimple_fold (const_gimple);
+void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
+void gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *, enum tree_code,
+ tree, tree);
+tree gimple_get_lhs (const_gimple);
+void gimple_set_lhs (gimple, tree);
+gimple gimple_copy (gimple);
+bool is_gimple_operand (const_tree);
+void gimple_set_modified (gimple, bool);
+void gimple_cond_get_ops_from_tree (tree, enum tree_code *, tree *, tree *);
+gimple gimple_build_cond_from_tree (tree, tree, tree);
+void gimple_cond_set_condition_from_tree (gimple, tree);
+bool gimple_has_side_effects (const_gimple);
+bool gimple_rhs_has_side_effects (const_gimple);
+bool gimple_could_trap_p (gimple);
+bool gimple_assign_rhs_could_trap_p (gimple);
+void gimple_regimplify_operands (gimple, gimple_stmt_iterator *);
+bool empty_body_p (gimple_seq);
+unsigned get_gimple_rhs_num_ops (enum tree_code);
+
+/* Returns true iff T is a valid GIMPLE statement. */
+extern bool is_gimple_stmt (tree);
+
+/* Returns true iff TYPE is a valid type for a scalar register variable. */
+extern bool is_gimple_reg_type (tree);
+/* Returns true iff T is a scalar register variable. */
+extern bool is_gimple_reg (tree);
+/* Returns true if T is a GIMPLE temporary variable, false otherwise. */
+extern bool is_gimple_formal_tmp_var (tree);
+/* Returns true if T is a GIMPLE temporary register variable. */
+extern bool is_gimple_formal_tmp_reg (tree);
+/* Returns true iff T is any sort of variable. */
+extern bool is_gimple_variable (tree);
+/* Returns true iff T is any sort of symbol. */
+extern bool is_gimple_id (tree);
+/* Returns true iff T is a variable or an INDIRECT_REF (of a variable). */
+extern bool is_gimple_min_lval (tree);
+/* Returns true iff T is something whose address can be taken. */
+extern bool is_gimple_addressable (tree);
+/* Returns true iff T is any valid GIMPLE lvalue. */
+extern bool is_gimple_lvalue (tree);
+
+/* Returns true iff T is a GIMPLE address. */
+bool is_gimple_address (const_tree);
+/* Returns true iff T is a GIMPLE invariant address. */
+bool is_gimple_invariant_address (const_tree);
+/* Returns true iff T is a valid GIMPLE constant. */
+bool is_gimple_constant (const_tree);
+/* Returns true iff T is a GIMPLE restricted function invariant. */
+extern bool is_gimple_min_invariant (const_tree);
+/* Returns true iff T is a GIMPLE rvalue. */
+extern bool is_gimple_val (tree);
+/* Returns true iff T is a GIMPLE asm statement input. */
+extern bool is_gimple_asm_val (tree);
+/* Returns true iff T is a valid rhs for a MODIFY_EXPR where the LHS is a
+ GIMPLE temporary, a renamed user variable, or something else,
+ respectively. */
+extern bool is_gimple_formal_tmp_rhs (tree);
+extern bool is_gimple_reg_rhs (tree);
+extern bool is_gimple_mem_rhs (tree);
+
+/* Returns true iff T is a valid if-statement condition. */
+extern bool is_gimple_condexpr (tree);
+
+/* Returns true iff T is a type conversion. */
+extern bool is_gimple_cast (tree);
+/* Returns true iff T is a variable that does not need to live in memory. */
+extern bool is_gimple_non_addressable (tree t);
+
+/* Returns true iff T is a valid call address expression. */
+extern bool is_gimple_call_addr (tree);
+/* If T makes a function call, returns the CALL_EXPR operand. */
+extern tree get_call_expr_in (tree t);
+
+extern void recalculate_side_effects (tree);
+
+/* In gimplify.c */
+extern tree create_tmp_var_raw (tree, const char *);
+extern tree create_tmp_var_name (const char *);
+extern tree create_tmp_var (tree, const char *);
+extern tree get_initialized_tmp_var (tree, gimple_seq *, gimple_seq *);
+extern tree get_formal_tmp_var (tree, gimple_seq *);
+extern void declare_vars (tree, gimple, bool);
+extern void tree_annotate_all_with_location (tree *, location_t);
+extern void annotate_all_with_location (gimple_seq, location_t);
+
+/* Validation of GIMPLE expressions. Note that these predicates only check
+ the basic form of the expression, they don't recurse to make sure that
+ underlying nodes are also of the right form. */
+typedef bool (*gimple_predicate)(tree);
+
+
+/* FIXME we should deduce this from the predicate. */
+typedef enum fallback_t {
+ fb_none = 0, /* Do not generate a temporary. */
+
+ fb_rvalue = 1, /* Generate an rvalue to hold the result of a
+ gimplified expression. */
+
+ fb_lvalue = 2, /* Generate an lvalue to hold the result of a
+ gimplified expression. */
+
+ fb_mayfail = 4, /* Gimplification may fail. Error issued
+ afterwards. */
+ fb_either= fb_rvalue | fb_lvalue
+} fallback_t;
+
+enum gimplify_status {
+ GS_ERROR = -2, /* Something Bad Seen. */
+ GS_UNHANDLED = -1, /* A langhook result for "I dunno". */
+ GS_OK = 0, /* We did something, maybe more to do. */
+ GS_ALL_DONE = 1 /* The expression is fully gimplified. */
+};
+
+struct gimplify_ctx
+{
+ struct gimplify_ctx *prev_context;
+
+ VEC(gimple,heap) *bind_expr_stack;
+ tree temps;
+ gimple_seq conditional_cleanups;
+ tree exit_label;
+ tree return_temp;
+
+ VEC(tree,heap) *case_labels;
+ /* The formal temporary table. Should this be persistent? */
+ htab_t temp_htab;
+
+ int conditions;
+ bool save_stack;
+ bool into_ssa;
+ bool allow_rhs_cond_expr;
+};
+
+extern enum gimplify_status gimplify_expr (tree *, gimple_seq *, gimple_seq *,
+ bool (*) (tree), fallback_t);
+extern void gimplify_type_sizes (tree, gimple_seq *);
+extern void gimplify_one_sizepos (tree *, gimple_seq *);
+extern bool gimplify_stmt (tree *, gimple_seq *);
+extern gimple gimplify_body (tree *, tree, bool);
+extern void push_gimplify_context (struct gimplify_ctx *);
+extern void pop_gimplify_context (gimple);
+extern void gimplify_and_add (tree, gimple_seq *);
+
+/* Miscellaneous helpers. */
+extern void gimple_add_tmp_var (tree);
+extern gimple gimple_current_bind_expr (void);
+extern VEC(gimple, heap) *gimple_bind_expr_stack (void);
+extern tree voidify_wrapper_expr (tree, tree);
+extern tree build_and_jump (tree *);
+extern tree alloc_stmt_list (void);
+extern void free_stmt_list (tree);
+extern tree force_labels_r (tree *, int *, void *);
+extern enum gimplify_status gimplify_va_arg_expr (tree *, gimple_seq *,
+ gimple_seq *);
+struct gimplify_omp_ctx;
+extern void omp_firstprivatize_variable (struct gimplify_omp_ctx *, tree);
+extern tree gimple_boolify (tree);
+extern gimple_predicate rhs_predicate_for (tree);
+extern tree canonicalize_cond_expr_cond (tree);
+
+/* In omp-low.c. */
+extern void diagnose_omp_structured_block_errors (tree);
+extern tree omp_reduction_init (tree, tree);
+
+/* In tree-nested.c. */
+extern void lower_nested_functions (tree);
+extern void insert_field_into_struct (tree, tree);
+
+/* In gimplify.c. */
+extern void gimplify_function_tree (tree);
+
+/* In cfgexpand.c. */
+extern tree gimple_assign_rhs_to_tree (gimple);
+
+/* In builtins.c */
+extern bool validate_gimple_arglist (const_gimple, ...);
+
+/* In tree-ssa-operands.c */
+extern void gimple_add_to_addresses_taken (gimple, tree);
+
+/* In tree-ssa.c */
+extern bool tree_ssa_useless_type_conversion (tree);
+extern bool useless_type_conversion_p (tree, tree);
+extern bool types_compatible_p (tree, tree);
+
+/* Return the code for GIMPLE statement G. */
+
+static inline enum gimple_code
+gimple_code (const_gimple g)
+{
+ return g->gsbase.code;
+}
+
+
+/* Return true if statement G has sub-statements. This is only true for
+ High GIMPLE statements. */
+
+static inline bool
+gimple_has_substatements (gimple g)
+{
+ switch (gimple_code (g))
+ {
+ case GIMPLE_BIND:
+ case GIMPLE_CATCH:
+ case GIMPLE_EH_FILTER:
+ case GIMPLE_TRY:
+ case GIMPLE_OMP_FOR:
+ case GIMPLE_OMP_MASTER:
+ case GIMPLE_OMP_ORDERED:
+ case GIMPLE_OMP_SECTION:
+ case GIMPLE_OMP_PARALLEL:
+ case GIMPLE_OMP_TASK:
+ case GIMPLE_OMP_SECTIONS:
+ case GIMPLE_OMP_SINGLE:
+ case GIMPLE_WITH_CLEANUP_EXPR:
+ return true;
+
+ default:
+ return false;
+ }
+}
+
+
+/* Return the basic block holding statement G. */
+
+static inline struct basic_block_def *
+gimple_bb (const_gimple g)
+{
+ return g->gsbase.bb;
+}
+
+
+/* Return the lexical scope block holding statement G. */
+
+static inline tree
+gimple_block (const_gimple g)
+{
+ return g->gsbase.block;
+}
+
+
+/* Set BLOCK to be the lexical scope block holding statement G. */
+
+static inline void
+gimple_set_block (gimple g, tree block)
+{
+ g->gsbase.block = block;
+}
+
+
+/* Return location information for statement G. */
+
+static inline location_t
+gimple_location (const_gimple g)
+{
+ return g->gsbase.location;
+}
+
+/* Return pointer to location information for statement G. */
+
+static inline const location_t *
+gimple_location_ptr (const_gimple g)
+{
+ return &g->gsbase.location;
+}
+
+
+/* Set location information for statement G. */
+
+static inline void
+gimple_set_location (gimple g, location_t location)
+{
+ g->gsbase.location = location;
+}
+
+
+/* Return true if G contains location information. */
+
+static inline bool
+gimple_has_location (const_gimple g)
+{
+ return gimple_location (g) != UNKNOWN_LOCATION;
+}
+
+
+/* Return the file name of the location of STMT. */
+
+static inline const char *
+gimple_filename (const_gimple stmt)
+{
+ return LOCATION_FILE (gimple_location (stmt));
+}
+
+
+/* Return the line number of the location of STMT. */
+
+static inline int
+gimple_lineno (const_gimple stmt)
+{
+ return LOCATION_LINE (gimple_location (stmt));
+}
+
+
+/* Determine whether SEQ is a singleton. */
+
+static inline bool
+gimple_seq_singleton_p (gimple_seq seq)
+{
+ return ((gimple_seq_first (seq) != NULL)
+ && (gimple_seq_first (seq) == gimple_seq_last (seq)));
+}
+
+/* Return true if no warnings should be emitted for statement STMT. */
+
+static inline bool
+gimple_no_warning_p (const_gimple stmt)
+{
+ return stmt->gsbase.no_warning;
+}
+
+/* Set the no_warning flag of STMT to NO_WARNING. */
+
+static inline void
+gimple_set_no_warning (gimple stmt, bool no_warning)
+{
+ stmt->gsbase.no_warning = (unsigned) no_warning;
+}
+
+/* Set the visited status on statement STMT to VISITED_P. */
+
+static inline void
+gimple_set_visited (gimple stmt, bool visited_p)
+{
+ stmt->gsbase.visited = (unsigned) visited_p;
+}
+
+
+/* Return the visited status for statement STMT. */
+
+static inline bool
+gimple_visited_p (gimple stmt)
+{
+ return stmt->gsbase.visited;
+}
+
+
+/* Set pass local flag PLF on statement STMT to VAL_P. */
+
+static inline void
+gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
+{
+ if (val_p)
+ stmt->gsbase.plf |= (unsigned int) plf;
+ else
+ stmt->gsbase.plf &= ~((unsigned int) plf);
+}
+
+
+/* Return the value of pass local flag PLF on statement STMT. */
+
+static inline unsigned int
+gimple_plf (gimple stmt, enum plf_mask plf)
+{
+ return stmt->gsbase.plf & ((unsigned int) plf);
+}
+
+
+/* Set the uid of statement */
+
+static inline void
+gimple_set_uid (gimple g, unsigned uid)
+{
+ g->gsbase.uid = uid;
+}
+
+
+/* Return the uid of statement */
+
+static inline unsigned
+gimple_uid (const_gimple g)
+{
+ return g->gsbase.uid;
+}
+
+
+/* Return true if GIMPLE statement G has register or memory operands. */
+
+static inline bool
+gimple_has_ops (const_gimple g)
+{
+ return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
+}
+
+
+/* Return true if GIMPLE statement G has memory operands. */
+
+static inline bool
+gimple_has_mem_ops (const_gimple g)
+{
+ return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
+}
+
+/* Return the set of addresses taken by statement G. */
+
+static inline bitmap
+gimple_addresses_taken (const_gimple g)
+{
+ if (gimple_has_ops (g))
+ return g->gsops.opbase.addresses_taken;
+ else
+ return NULL;
+}
+
+
+/* Return a pointer to the set of addresses taken by statement G. */
+
+static inline bitmap *
+gimple_addresses_taken_ptr (gimple g)
+{
+ if (gimple_has_ops (g))
+ return &g->gsops.opbase.addresses_taken;
+ else
+ return NULL;
+}
+
+
+/* Set B to be the set of addresses taken by statement G. The
+ previous set is freed. */
+
+static inline void
+gimple_set_addresses_taken (gimple g, bitmap b)
+{
+ gcc_assert (gimple_has_ops (g));
+ BITMAP_FREE (g->gsops.opbase.addresses_taken);
+ g->gsops.opbase.addresses_taken = b;
+}
+
+
+/* Return the set of DEF operands for statement G. */
+
+static inline struct def_optype_d *
+gimple_def_ops (const_gimple g)
+{
+ if (!gimple_has_ops (g))
+ return NULL;
+ return g->gsops.opbase.def_ops;
+}
+
+
+/* Set DEF to be the set of DEF operands for statement G. */
+
+static inline void
+gimple_set_def_ops (gimple g, struct def_optype_d *def)
+{
+ gcc_assert (gimple_has_ops (g));
+ g->gsops.opbase.def_ops = def;
+}
+
+
+/* Return the set of USE operands for statement G. */
+
+static inline struct use_optype_d *
+gimple_use_ops (const_gimple g)
+{
+ if (!gimple_has_ops (g))
+ return NULL;
+ return g->gsops.opbase.use_ops;
+}
+
+
+/* Set USE to be the set of USE operands for statement G. */
+
+static inline void
+gimple_set_use_ops (gimple g, struct use_optype_d *use)
+{
+ gcc_assert (gimple_has_ops (g));
+ g->gsops.opbase.use_ops = use;
+}
+
+
+/* Return the set of VUSE operands for statement G. */
+
+static inline struct voptype_d *
+gimple_vuse_ops (const_gimple g)
+{
+ if (!gimple_has_mem_ops (g))
+ return NULL;
+ return g->gsmem.membase.vuse_ops;
+}
+
+
+/* Set OPS to be the set of VUSE operands for statement G. */
+
+static inline void
+gimple_set_vuse_ops (gimple g, struct voptype_d *ops)
+{
+ gcc_assert (gimple_has_mem_ops (g));
+ g->gsmem.membase.vuse_ops = ops;
+}
+
+
+/* Return the set of VDEF operands for statement G. */
+
+static inline struct voptype_d *
+gimple_vdef_ops (const_gimple g)
+{
+ if (!gimple_has_mem_ops (g))
+ return NULL;
+ return g->gsmem.membase.vdef_ops;
+}
+
+
+/* Set OPS to be the set of VDEF operands for statement G. */
+
+static inline void
+gimple_set_vdef_ops (gimple g, struct voptype_d *ops)
+{
+ gcc_assert (gimple_has_mem_ops (g));
+ g->gsmem.membase.vdef_ops = ops;
+}
+
+
+/* Return the set of symbols loaded by statement G. Each element of the
+ set is the DECL_UID of the corresponding symbol. */
+
+static inline bitmap
+gimple_loaded_syms (const_gimple g)
+{
+ if (!gimple_has_mem_ops (g))
+ return NULL;
+ return g->gsmem.membase.loads;
+}
+
+
+/* Return the set of symbols stored by statement G. Each element of
+ the set is the DECL_UID of the corresponding symbol. */
+
+static inline bitmap
+gimple_stored_syms (const_gimple g)
+{
+ if (!gimple_has_mem_ops (g))
+ return NULL;
+ return g->gsmem.membase.stores;
+}
+
+
+/* Return true if statement G has operands and the modified field has
+ been set. */
+
+static inline bool
+gimple_modified_p (const_gimple g)
+{
+ return (gimple_has_ops (g)) ? (bool) g->gsbase.modified : false;
+}
+
+/* Return the type of the main expression computed by STMT. Return
+ void_type_node if the statement computes nothing. */
+
+static inline tree
+gimple_expr_type (const_gimple stmt)
+{
+ enum gimple_code code = gimple_code (stmt);
+
+ if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
+ {
+ tree type = TREE_TYPE (gimple_get_lhs (stmt));
+ /* Integral sub-types are never the type of the expression,
+ but they still can be the type of the result as the base
+ type (in which expressions are computed) is trivially
+ convertible to one of its sub-types. So always return
+ the base type here. */
+ if (INTEGRAL_TYPE_P (type)
+ && TREE_TYPE (type)
+ /* But only if they are trivially convertible. */
+ && useless_type_conversion_p (type, TREE_TYPE (type)))
+ type = TREE_TYPE (type);
+ return type;
+ }
+ else if (code == GIMPLE_COND)
+ return boolean_type_node;
+ else
+ return void_type_node;
+}
+
+
+/* Return the tree code for the expression computed by STMT. This is
+ only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
+ GIMPLE_CALL, return CALL_EXPR as the expression code for
+ consistency. This is useful when the caller needs to deal with the
+ three kinds of computation that GIMPLE supports. */
+
+static inline enum tree_code
+gimple_expr_code (const_gimple stmt)
+{
+ enum gimple_code code = gimple_code (stmt);
+ if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
+ return (enum tree_code) stmt->gsbase.subcode;
+ else if (code == GIMPLE_CALL)
+ return CALL_EXPR;
+ else
+ gcc_unreachable ();
+}
+
+
+/* Mark statement S as modified, and update it. */
+
+static inline void
+update_stmt (gimple s)
+{
+ if (gimple_has_ops (s))
+ {
+ gimple_set_modified (s, true);
+ update_stmt_operands (s);
+ }
+}
+
+/* Update statement S if it has been optimized. */
+
+static inline void
+update_stmt_if_modified (gimple s)
+{
+ if (gimple_modified_p (s))
+ update_stmt_operands (s);
+}
+
+/* Return true if statement STMT contains volatile operands. */
+
+static inline bool
+gimple_has_volatile_ops (const_gimple stmt)
+{
+ if (gimple_has_mem_ops (stmt))
+ return stmt->gsbase.has_volatile_ops;
+ else
+ return false;
+}
+
+
+/* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
+
+static inline void
+gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
+{
+ if (gimple_has_mem_ops (stmt))
+ stmt->gsbase.has_volatile_ops = (unsigned) volatilep;
+}
+
+
+/* Return true if statement STMT may access memory. */
+
+static inline bool
+gimple_references_memory_p (gimple stmt)
+{
+ return gimple_has_mem_ops (stmt) && stmt->gsbase.references_memory_p;
+}
+
+
+/* Set the REFERENCES_MEMORY_P flag for STMT to MEM_P. */
+
+static inline void
+gimple_set_references_memory (gimple stmt, bool mem_p)
+{
+ if (gimple_has_mem_ops (stmt))
+ stmt->gsbase.references_memory_p = (unsigned) mem_p;
+}
+
+/* Return the subcode for OMP statement S. */
+
+static inline unsigned
+gimple_omp_subcode (const_gimple s)
+{
+ gcc_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
+ && gimple_code (s) <= GIMPLE_OMP_SINGLE);
+ return s->gsbase.subcode;
+}
+
+/* Set the subcode for OMP statement S to SUBCODE. */
+
+static inline void
+gimple_omp_set_subcode (gimple s, unsigned int subcode)
+{
+ /* We only have 16 bits for the subcode. Assert that we are not
+ overflowing it. */
+ gcc_assert (subcode < (1 << 16));
+ s->gsbase.subcode = subcode;
+}
+
+/* Set the nowait flag on OMP_RETURN statement S. */
+
+static inline void
+gimple_omp_return_set_nowait (gimple s)
+{
+ GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
+ s->gsbase.subcode |= GF_OMP_RETURN_NOWAIT;
+}
+
+
+/* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
+ flag set. */
+
+static inline bool
+gimple_omp_return_nowait_p (const_gimple g)
+{
+ GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
+ return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
+}
+
+
+/* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
+ flag set. */
+
+static inline bool
+gimple_omp_section_last_p (const_gimple g)
+{
+ GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
+ return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
+}
+
+
+/* Set the GF_OMP_SECTION_LAST flag on G. */
+
+static inline void
+gimple_omp_section_set_last (gimple g)
+{
+ GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
+ g->gsbase.subcode |= GF_OMP_SECTION_LAST;
+}
+
+
+/* Return true if OMP parallel statement G has the
+ GF_OMP_PARALLEL_COMBINED flag set. */
+
+static inline bool
+gimple_omp_parallel_combined_p (const_gimple g)
+{
+ GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
+ return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
+}
+
+
+/* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
+ value of COMBINED_P. */
+
+static inline void
+gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
+{
+ GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
+ if (combined_p)
+ g->gsbase.subcode |= GF_OMP_PARALLEL_COMBINED;
+ else
+ g->gsbase.subcode &= ~GF_OMP_PARALLEL_COMBINED;
+}
+
+
+/* Return the number of operands for statement GS. */
+
+static inline unsigned
+gimple_num_ops (const_gimple gs)
+{
+ return gs->gsbase.num_ops;
+}
+
+
+/* Set the number of operands for statement GS. */
+
+static inline void
+gimple_set_num_ops (gimple gs, unsigned num_ops)
+{
+ gs->gsbase.num_ops = num_ops;
+}
+
+
+/* Return the array of operands for statement GS. */
+
+static inline tree *
+gimple_ops (gimple gs)
+{
+ /* Offset in bytes to the location of the operand vector in every
+ tuple structure. Defined in gimple.c */
+ extern size_t const gimple_ops_offset_[];
+
+ if (!gimple_has_ops (gs))
+ return NULL;
+
+ /* All the tuples have their operand vector at the very bottom
+ of the structure. */
+ return ((tree *) ((char *) gs + gimple_ops_offset_[gimple_code (gs)]));
+}
+
+
+/* Return operand I for statement GS. */
+
+static inline tree
+gimple_op (const_gimple gs, unsigned i)
+{
+ if (gimple_has_ops (gs))
+ {
+ gcc_assert (i < gimple_num_ops (gs));
+ return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
+ }
+ else
+ return NULL_TREE;
+}
+
+/* Return a pointer to operand I for statement GS. */
+
+static inline tree *
+gimple_op_ptr (const_gimple gs, unsigned i)
+{
+ if (gimple_has_ops (gs))
+ {
+ gcc_assert (i < gimple_num_ops (gs));
+ return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
+ }
+ else
+ return NULL;
+}
+
+/* Set operand I of statement GS to OP. */
+
+static inline void
+gimple_set_op (gimple gs, unsigned i, tree op)
+{
+ gcc_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
+
+ /* Note. It may be tempting to assert that OP matches
+ is_gimple_operand, but that would be wrong. Different tuples
+ accept slightly different sets of tree operands. Each caller
+ should perform its own validation. */
+ gimple_ops (gs)[i] = op;
+}
+
+/* Return true if GS is a GIMPLE_ASSIGN. */
+
+static inline bool
+is_gimple_assign (const_gimple gs)
+{
+ return gimple_code (gs) == GIMPLE_ASSIGN;
+}
+
+/* Determine if expression CODE is one of the valid expressions that can
+ be used on the RHS of GIMPLE assignments. */
+
+static inline enum gimple_rhs_class
+get_gimple_rhs_class (enum tree_code code)
+{
+ return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
+}
+
+/* Return the LHS of assignment statement GS. */
+
+static inline tree
+gimple_assign_lhs (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
+ return gimple_op (gs, 0);
+}
+
+
+/* Return a pointer to the LHS of assignment statement GS. */
+
+static inline tree *
+gimple_assign_lhs_ptr (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
+ return gimple_op_ptr (gs, 0);
+}
+
+
+/* Set LHS to be the LHS operand of assignment statement GS. */
+
+static inline void
+gimple_assign_set_lhs (gimple gs, tree lhs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
+ gcc_assert (is_gimple_operand (lhs));
+ gimple_set_op (gs, 0, lhs);
+
+ if (lhs && TREE_CODE (lhs) == SSA_NAME)
+ SSA_NAME_DEF_STMT (lhs) = gs;
+}
+
+
+/* Return the first operand on the RHS of assignment statement GS. */
+
+static inline tree
+gimple_assign_rhs1 (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
+ return gimple_op (gs, 1);
+}
+
+
+/* Return a pointer to the first operand on the RHS of assignment
+ statement GS. */
+
+static inline tree *
+gimple_assign_rhs1_ptr (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
+ return gimple_op_ptr (gs, 1);
+}
+
+/* Set RHS to be the first operand on the RHS of assignment statement GS. */
+
+static inline void
+gimple_assign_set_rhs1 (gimple gs, tree rhs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
+
+ /* If there are 3 or more operands, the 2 operands on the RHS must be
+ GIMPLE values. */
+ if (gimple_num_ops (gs) >= 3)
+ gcc_assert (is_gimple_val (rhs));
+ else
+ gcc_assert (is_gimple_operand (rhs));
+
+ gimple_set_op (gs, 1, rhs);
+}
+
+
+/* Return the second operand on the RHS of assignment statement GS.
+ If GS does not have two operands, NULL is returned instead. */
+
+static inline tree
+gimple_assign_rhs2 (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
+
+ if (gimple_num_ops (gs) >= 3)
+ return gimple_op (gs, 2);
+ else
+ return NULL_TREE;
+}
+
+
+/* Return a pointer to the second operand on the RHS of assignment
+ statement GS. */
+
+static inline tree *
+gimple_assign_rhs2_ptr (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
+ return gimple_op_ptr (gs, 2);
+}
+
+
+/* Set RHS to be the second operand on the RHS of assignment statement GS. */
+
+static inline void
+gimple_assign_set_rhs2 (gimple gs, tree rhs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
+
+ /* The 2 operands on the RHS must be GIMPLE values. */
+ gcc_assert (is_gimple_val (rhs));
+
+ gimple_set_op (gs, 2, rhs);
+}
+
+/* Returns true if GS is a nontemporal move. */
+
+static inline bool
+gimple_assign_nontemporal_move_p (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
+ return gs->gsbase.nontemporal_move;
+}
+
+/* Sets nontemporal move flag of GS to NONTEMPORAL. */
+
+static inline void
+gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
+{
+ GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
+ gs->gsbase.nontemporal_move = nontemporal;
+}
+
+
+/* Return the code of the expression computed on the rhs of assignment
+ statement GS. In case that the RHS is a single object, returns the
+ tree code of the object. */
+
+static inline enum tree_code
+gimple_assign_rhs_code (const_gimple gs)
+{
+ enum tree_code code;
+ GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
+
+ code = gimple_expr_code (gs);
+ if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
+ code = TREE_CODE (gimple_assign_rhs1 (gs));
+
+ return code;
+}
+
+
+/* Set CODE to be the code for the expression computed on the RHS of
+ assignment S. */
+
+static inline void
+gimple_assign_set_rhs_code (gimple s, enum tree_code code)
+{
+ GIMPLE_CHECK (s, GIMPLE_ASSIGN);
+ s->gsbase.subcode = code;
+}
+
+
+/* Return the gimple rhs class of the code of the expression computed on
+ the rhs of assignment statement GS.
+ This will never return GIMPLE_INVALID_RHS. */
+
+static inline enum gimple_rhs_class
+gimple_assign_rhs_class (const_gimple gs)
+{
+ return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
+}
+
+
+/* Return true if S is a type-cast assignment. */
+
+static inline bool
+gimple_assign_cast_p (gimple s)
+{
+ if (is_gimple_assign (s))
+ {
+ enum tree_code sc = gimple_assign_rhs_code (s);
+ return sc == NOP_EXPR
+ || sc == CONVERT_EXPR
+ || sc == VIEW_CONVERT_EXPR
+ || sc == FIX_TRUNC_EXPR;
+ }
+
+ return false;
+}
+
+
+/* Return true if GS is a GIMPLE_CALL. */
+
+static inline bool
+is_gimple_call (const_gimple gs)
+{
+ return gimple_code (gs) == GIMPLE_CALL;
+}
+
+/* Return the LHS of call statement GS. */
+
+static inline tree
+gimple_call_lhs (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_CALL);
+ return gimple_op (gs, 0);
+}
+
+
+/* Return a pointer to the LHS of call statement GS. */
+
+static inline tree *
+gimple_call_lhs_ptr (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_CALL);
+ return gimple_op_ptr (gs, 0);
+}
+
+
+/* Set LHS to be the LHS operand of call statement GS. */
+
+static inline void
+gimple_call_set_lhs (gimple gs, tree lhs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_CALL);
+ gcc_assert (!lhs || is_gimple_operand (lhs));
+ gimple_set_op (gs, 0, lhs);
+ if (lhs && TREE_CODE (lhs) == SSA_NAME)
+ SSA_NAME_DEF_STMT (lhs) = gs;
+}
+
+
+/* Return the tree node representing the function called by call
+ statement GS. */
+
+static inline tree
+gimple_call_fn (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_CALL);
+ return gimple_op (gs, 1);
+}
+
+
+/* Return a pointer to the tree node representing the function called by call
+ statement GS. */
+
+static inline tree *
+gimple_call_fn_ptr (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_CALL);
+ return gimple_op_ptr (gs, 1);
+}
+
+
+/* Set FN to be the function called by call statement GS. */
+
+static inline void
+gimple_call_set_fn (gimple gs, tree fn)
+{
+ GIMPLE_CHECK (gs, GIMPLE_CALL);
+ gcc_assert (is_gimple_operand (fn));
+ gimple_set_op (gs, 1, fn);
+}
+
+
+/* Set FNDECL to be the function called by call statement GS. */
+
+static inline void
+gimple_call_set_fndecl (gimple gs, tree decl)
+{
+ GIMPLE_CHECK (gs, GIMPLE_CALL);
+ gcc_assert (TREE_CODE (decl) == FUNCTION_DECL);
+ gimple_set_op (gs, 1, build_fold_addr_expr (decl));
+}
+
+
+/* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
+ Otherwise return NULL. This function is analogous to
+ get_callee_fndecl in tree land. */
+
+static inline tree
+gimple_call_fndecl (const_gimple gs)
+{
+ tree addr = gimple_call_fn (gs);
+ if (TREE_CODE (addr) == ADDR_EXPR)
+ {
+ gcc_assert (TREE_CODE (TREE_OPERAND (addr, 0)) == FUNCTION_DECL);
+ return TREE_OPERAND (addr, 0);
+ }
+ return NULL_TREE;
+}
+
+
+/* Return the type returned by call statement GS. */
+
+static inline tree
+gimple_call_return_type (const_gimple gs)
+{
+ tree fn = gimple_call_fn (gs);
+ tree type = TREE_TYPE (fn);
+
+ /* See through the pointer. */
+ gcc_assert (POINTER_TYPE_P (type));
+ type = TREE_TYPE (type);
+
+ gcc_assert (TREE_CODE (type) == FUNCTION_TYPE
+ || TREE_CODE (type) == METHOD_TYPE);
+
+ /* The type returned by a FUNCTION_DECL is the type of its
+ function type. */
+ return TREE_TYPE (type);
+}
+
+
+/* Return the static chain for call statement GS. */
+
+static inline tree
+gimple_call_chain (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_CALL);
+ return gimple_op (gs, 2);
+}
+
+
+/* Return a pointer to the static chain for call statement GS. */
+
+static inline tree *
+gimple_call_chain_ptr (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_CALL);
+ return gimple_op_ptr (gs, 2);
+}
+
+/* Set CHAIN to be the static chain for call statement GS. */
+
+static inline void
+gimple_call_set_chain (gimple gs, tree chain)
+{
+ GIMPLE_CHECK (gs, GIMPLE_CALL);
+ gcc_assert (chain == NULL
+ || TREE_CODE (chain) == ADDR_EXPR
+ || SSA_VAR_P (chain));
+ gimple_set_op (gs, 2, chain);
+}
+
+
+/* Return the number of arguments used by call statement GS. */
+
+static inline unsigned
+gimple_call_num_args (const_gimple gs)
+{
+ unsigned num_ops;
+ GIMPLE_CHECK (gs, GIMPLE_CALL);
+ num_ops = gimple_num_ops (gs);
+ gcc_assert (num_ops >= 3);
+ return num_ops - 3;
+}
+
+
+/* Return the argument at position INDEX for call statement GS. */
+
+static inline tree
+gimple_call_arg (const_gimple gs, unsigned index)
+{
+ GIMPLE_CHECK (gs, GIMPLE_CALL);
+ return gimple_op (gs, index + 3);
+}
+
+
+/* Return a pointer to the argument at position INDEX for call
+ statement GS. */
+
+static inline tree *
+gimple_call_arg_ptr (const_gimple gs, unsigned index)
+{
+ GIMPLE_CHECK (gs, GIMPLE_CALL);
+ return gimple_op_ptr (gs, index + 3);
+}
+
+
+/* Set ARG to be the argument at position INDEX for call statement GS. */
+
+static inline void
+gimple_call_set_arg (gimple gs, unsigned index, tree arg)
+{
+ GIMPLE_CHECK (gs, GIMPLE_CALL);
+ gcc_assert (is_gimple_operand (arg));
+ gimple_set_op (gs, index + 3, arg);
+}
+
+
+/* If TAIL_P is true, mark call statement S as being a tail call
+ (i.e., a call just before the exit of a function). These calls are
+ candidate for tail call optimization. */
+
+static inline void
+gimple_call_set_tail (gimple s, bool tail_p)
+{
+ GIMPLE_CHECK (s, GIMPLE_CALL);
+ if (tail_p)
+ s->gsbase.subcode |= GF_CALL_TAILCALL;
+ else
+ s->gsbase.subcode &= ~GF_CALL_TAILCALL;
+}
+
+
+/* Return true if GIMPLE_CALL S is marked as a tail call. */
+
+static inline bool
+gimple_call_tail_p (gimple s)
+{
+ GIMPLE_CHECK (s, GIMPLE_CALL);
+ return (s->gsbase.subcode & GF_CALL_TAILCALL) != 0;
+}
+
+
+/* Set the inlinable status of GIMPLE_CALL S to INLINABLE_P. */
+
+static inline void
+gimple_call_set_cannot_inline (gimple s, bool inlinable_p)
+{
+ GIMPLE_CHECK (s, GIMPLE_CALL);
+ if (inlinable_p)
+ s->gsbase.subcode |= GF_CALL_CANNOT_INLINE;
+ else
+ s->gsbase.subcode &= ~GF_CALL_CANNOT_INLINE;
+}
+
+
+/* Return true if GIMPLE_CALL S cannot be inlined. */
+
+static inline bool
+gimple_call_cannot_inline_p (gimple s)
+{
+ GIMPLE_CHECK (s, GIMPLE_CALL);
+ return (s->gsbase.subcode & GF_CALL_CANNOT_INLINE) != 0;
+}
+
+
+/* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
+ slot optimization. This transformation uses the target of the call
+ expansion as the return slot for calls that return in memory. */
+
+static inline void
+gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
+{
+ GIMPLE_CHECK (s, GIMPLE_CALL);
+ if (return_slot_opt_p)
+ s->gsbase.subcode |= GF_CALL_RETURN_SLOT_OPT;
+ else
+ s->gsbase.subcode &= ~GF_CALL_RETURN_SLOT_OPT;
+}
+
+
+/* Return true if S is marked for return slot optimization. */
+
+static inline bool
+gimple_call_return_slot_opt_p (gimple s)
+{
+ GIMPLE_CHECK (s, GIMPLE_CALL);
+ return (s->gsbase.subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
+}
+
+
+/* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
+ thunk to the thunked-to function. */
+
+static inline void
+gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
+{
+ GIMPLE_CHECK (s, GIMPLE_CALL);
+ if (from_thunk_p)
+ s->gsbase.subcode |= GF_CALL_FROM_THUNK;
+ else
+ s->gsbase.subcode &= ~GF_CALL_FROM_THUNK;
+}
+
+
+/* Return true if GIMPLE_CALL S is a jump from a thunk. */
+
+static inline bool
+gimple_call_from_thunk_p (gimple s)
+{
+ GIMPLE_CHECK (s, GIMPLE_CALL);
+ return (s->gsbase.subcode & GF_CALL_FROM_THUNK) != 0;
+}
+
+
+/* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
+ argument pack in its argument list. */
+
+static inline void
+gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
+{
+ GIMPLE_CHECK (s, GIMPLE_CALL);
+ if (pass_arg_pack_p)
+ s->gsbase.subcode |= GF_CALL_VA_ARG_PACK;
+ else
+ s->gsbase.subcode &= ~GF_CALL_VA_ARG_PACK;
+}
+
+
+/* Return true if GIMPLE_CALL S is a stdarg call that needs the
+ argument pack in its argument list. */
+
+static inline bool
+gimple_call_va_arg_pack_p (gimple s)
+{
+ GIMPLE_CHECK (s, GIMPLE_CALL);
+ return (s->gsbase.subcode & GF_CALL_VA_ARG_PACK) != 0;
+}
+
+
+/* Return true if S is a noreturn call. */
+
+static inline bool
+gimple_call_noreturn_p (gimple s)
+{
+ GIMPLE_CHECK (s, GIMPLE_CALL);
+ return (gimple_call_flags (s) & ECF_NORETURN) != 0;
+}
+
+
+/* Return true if S is a nothrow call. */
+
+static inline bool
+gimple_call_nothrow_p (gimple s)
+{
+ GIMPLE_CHECK (s, GIMPLE_CALL);
+ return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
+}
+
+
+/* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
+
+static inline void
+gimple_call_copy_flags (gimple dest_call, gimple orig_call)
+{
+ GIMPLE_CHECK (dest_call, GIMPLE_CALL);
+ GIMPLE_CHECK (orig_call, GIMPLE_CALL);
+ dest_call->gsbase.subcode = orig_call->gsbase.subcode;
+}
+
+
+/* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
+ non-NULL lhs. */
+
+static inline bool
+gimple_has_lhs (gimple stmt)
+{
+ return (is_gimple_assign (stmt)
+ || (is_gimple_call (stmt)
+ && gimple_call_lhs (stmt) != NULL_TREE));
+}
+
+
+/* Return the code of the predicate computed by conditional statement GS. */
+
+static inline enum tree_code
+gimple_cond_code (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_COND);
+ return gs->gsbase.subcode;
+}
+
+
+/* Set CODE to be the predicate code for the conditional statement GS. */
+
+static inline void
+gimple_cond_set_code (gimple gs, enum tree_code code)
+{
+ GIMPLE_CHECK (gs, GIMPLE_COND);
+ gcc_assert (TREE_CODE_CLASS (code) == tcc_comparison);
+ gs->gsbase.subcode = code;
+}
+
+
+/* Return the LHS of the predicate computed by conditional statement GS. */
+
+static inline tree
+gimple_cond_lhs (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_COND);
+ return gimple_op (gs, 0);
+}
+
+/* Return the pointer to the LHS of the predicate computed by conditional
+ statement GS. */
+
+static inline tree *
+gimple_cond_lhs_ptr (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_COND);
+ return gimple_op_ptr (gs, 0);
+}
+
+/* Set LHS to be the LHS operand of the predicate computed by
+ conditional statement GS. */
+
+static inline void
+gimple_cond_set_lhs (gimple gs, tree lhs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_COND);
+ gcc_assert (is_gimple_operand (lhs));
+ gimple_set_op (gs, 0, lhs);
+}
+
+
+/* Return the RHS operand of the predicate computed by conditional GS. */
+
+static inline tree
+gimple_cond_rhs (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_COND);
+ return gimple_op (gs, 1);
+}
+
+/* Return the pointer to the RHS operand of the predicate computed by
+ conditional GS. */
+
+static inline tree *
+gimple_cond_rhs_ptr (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_COND);
+ return gimple_op_ptr (gs, 1);
+}
+
+
+/* Set RHS to be the RHS operand of the predicate computed by
+ conditional statement GS. */
+
+static inline void
+gimple_cond_set_rhs (gimple gs, tree rhs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_COND);
+ gcc_assert (is_gimple_operand (rhs));
+ gimple_set_op (gs, 1, rhs);
+}
+
+
+/* Return the label used by conditional statement GS when its
+ predicate evaluates to true. */
+
+static inline tree
+gimple_cond_true_label (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_COND);
+ return gimple_op (gs, 2);
+}
+
+
+/* Set LABEL to be the label used by conditional statement GS when its
+ predicate evaluates to true. */
+
+static inline void
+gimple_cond_set_true_label (gimple gs, tree label)
+{
+ GIMPLE_CHECK (gs, GIMPLE_COND);
+ gcc_assert (!label || TREE_CODE (label) == LABEL_DECL);
+ gimple_set_op (gs, 2, label);
+}
+
+
+/* Set LABEL to be the label used by conditional statement GS when its
+ predicate evaluates to false. */
+
+static inline void
+gimple_cond_set_false_label (gimple gs, tree label)
+{
+ GIMPLE_CHECK (gs, GIMPLE_COND);
+ gcc_assert (!label || TREE_CODE (label) == LABEL_DECL);
+ gimple_set_op (gs, 3, label);
+}
+
+
+/* Return the label used by conditional statement GS when its
+ predicate evaluates to false. */
+
+static inline tree
+gimple_cond_false_label (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_COND);
+ return gimple_op (gs, 3);
+}
+
+
+/* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
+
+static inline void
+gimple_cond_make_false (gimple gs)
+{
+ gimple_cond_set_lhs (gs, boolean_true_node);
+ gimple_cond_set_rhs (gs, boolean_false_node);
+ gs->gsbase.subcode = EQ_EXPR;
+}
+
+
+/* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
+
+static inline void
+gimple_cond_make_true (gimple gs)
+{
+ gimple_cond_set_lhs (gs, boolean_true_node);
+ gimple_cond_set_rhs (gs, boolean_true_node);
+ gs->gsbase.subcode = EQ_EXPR;
+}
+
+/* Check if conditional statemente GS is of the form 'if (1 == 1)',
+ 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
+
+static inline bool
+gimple_cond_true_p (const_gimple gs)
+{
+ tree lhs = gimple_cond_lhs (gs);
+ tree rhs = gimple_cond_rhs (gs);
+ enum tree_code code = gimple_cond_code (gs);
+
+ if (lhs != boolean_true_node && lhs != boolean_false_node)
+ return false;
+
+ if (rhs != boolean_true_node && rhs != boolean_false_node)
+ return false;
+
+ if (code == NE_EXPR && lhs != rhs)
+ return true;
+
+ if (code == EQ_EXPR && lhs == rhs)
+ return true;
+
+ return false;
+}
+
+/* Check if conditional statement GS is of the form 'if (1 != 1)',
+ 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
+
+static inline bool
+gimple_cond_false_p (const_gimple gs)
+{
+ tree lhs = gimple_cond_lhs (gs);
+ tree rhs = gimple_cond_rhs (gs);
+ enum tree_code code = gimple_cond_code (gs);
+
+ if (lhs != boolean_true_node && lhs != boolean_false_node)
+ return false;
+
+ if (rhs != boolean_true_node && rhs != boolean_false_node)
+ return false;
+
+ if (code == NE_EXPR && lhs == rhs)
+ return true;
+
+ if (code == EQ_EXPR && lhs != rhs)
+ return true;
+
+ return false;
+}
+
+/* Check if conditional statement GS is of the form 'if (var != 0)' or
+ 'if (var == 1)' */
+
+static inline bool
+gimple_cond_single_var_p (gimple gs)
+{
+ if (gimple_cond_code (gs) == NE_EXPR
+ && gimple_cond_rhs (gs) == boolean_false_node)
+ return true;
+
+ if (gimple_cond_code (gs) == EQ_EXPR
+ && gimple_cond_rhs (gs) == boolean_true_node)
+ return true;
+
+ return false;
+}
+
+/* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
+
+static inline void
+gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
+{
+ gimple_cond_set_code (stmt, code);
+ gimple_cond_set_lhs (stmt, lhs);
+ gimple_cond_set_rhs (stmt, rhs);
+}
+
+/* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
+
+static inline tree
+gimple_label_label (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_LABEL);
+ return gimple_op (gs, 0);
+}
+
+
+/* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
+ GS. */
+
+static inline void
+gimple_label_set_label (gimple gs, tree label)
+{
+ GIMPLE_CHECK (gs, GIMPLE_LABEL);
+ gcc_assert (TREE_CODE (label) == LABEL_DECL);
+ gimple_set_op (gs, 0, label);
+}
+
+
+/* Return the destination of the unconditional jump GS. */
+
+static inline tree
+gimple_goto_dest (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_GOTO);
+ return gimple_op (gs, 0);
+}
+
+
+/* Set DEST to be the destination of the unconditonal jump GS. */
+
+static inline void
+gimple_goto_set_dest (gimple gs, tree dest)
+{
+ GIMPLE_CHECK (gs, GIMPLE_GOTO);
+ gcc_assert (is_gimple_operand (dest));
+ gimple_set_op (gs, 0, dest);
+}
+
+
+/* Return the variables declared in the GIMPLE_BIND statement GS. */
+
+static inline tree
+gimple_bind_vars (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_BIND);
+ return gs->gimple_bind.vars;
+}
+
+
+/* Set VARS to be the set of variables declared in the GIMPLE_BIND
+ statement GS. */
+
+static inline void
+gimple_bind_set_vars (gimple gs, tree vars)
+{
+ GIMPLE_CHECK (gs, GIMPLE_BIND);
+ gs->gimple_bind.vars = vars;
+}
+
+
+/* Append VARS to the set of variables declared in the GIMPLE_BIND
+ statement GS. */
+
+static inline void
+gimple_bind_append_vars (gimple gs, tree vars)
+{
+ GIMPLE_CHECK (gs, GIMPLE_BIND);
+ gs->gimple_bind.vars = chainon (gs->gimple_bind.vars, vars);
+}
+
+
+/* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
+
+static inline gimple_seq
+gimple_bind_body (gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_BIND);
+ return gs->gimple_bind.body;
+}
+
+
+/* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
+ statement GS. */
+
+static inline void
+gimple_bind_set_body (gimple gs, gimple_seq seq)
+{
+ GIMPLE_CHECK (gs, GIMPLE_BIND);
+ gs->gimple_bind.body = seq;
+}
+
+
+/* Append a statement to the end of a GIMPLE_BIND's body. */
+
+static inline void
+gimple_bind_add_stmt (gimple gs, gimple stmt)
+{
+ GIMPLE_CHECK (gs, GIMPLE_BIND);
+ gimple_seq_add_stmt (&gs->gimple_bind.body, stmt);
+}
+
+
+/* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
+
+static inline void
+gimple_bind_add_seq (gimple gs, gimple_seq seq)
+{
+ GIMPLE_CHECK (gs, GIMPLE_BIND);
+ gimple_seq_add_seq (&gs->gimple_bind.body, seq);
+}
+
+
+/* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
+ GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
+
+static inline tree
+gimple_bind_block (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_BIND);
+ return gs->gimple_bind.block;
+}
+
+
+/* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
+ statement GS. */
+
+static inline void
+gimple_bind_set_block (gimple gs, tree block)
+{
+ GIMPLE_CHECK (gs, GIMPLE_BIND);
+ gcc_assert (TREE_CODE (block) == BLOCK);
+ gs->gimple_bind.block = block;
+}
+
+
+/* Return the number of input operands for GIMPLE_ASM GS. */
+
+static inline unsigned
+gimple_asm_ninputs (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_ASM);
+ return gs->gimple_asm.ni;
+}
+
+
+/* Return the number of output operands for GIMPLE_ASM GS. */
+
+static inline unsigned
+gimple_asm_noutputs (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_ASM);
+ return gs->gimple_asm.no;
+}
+
+
+/* Return the number of clobber operands for GIMPLE_ASM GS. */
+
+static inline unsigned
+gimple_asm_nclobbers (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_ASM);
+ return gs->gimple_asm.nc;
+}
+
+
+/* Return input operand INDEX of GIMPLE_ASM GS. */
+
+static inline tree
+gimple_asm_input_op (const_gimple gs, unsigned index)
+{
+ GIMPLE_CHECK (gs, GIMPLE_ASM);
+ gcc_assert (index <= gs->gimple_asm.ni);
+ return gimple_op (gs, index);
+}
+
+/* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
+
+static inline tree *
+gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
+{
+ GIMPLE_CHECK (gs, GIMPLE_ASM);
+ gcc_assert (index <= gs->gimple_asm.ni);
+ return gimple_op_ptr (gs, index);
+}
+
+
+/* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
+
+static inline void
+gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
+{
+ GIMPLE_CHECK (gs, GIMPLE_ASM);
+ gcc_assert (index <= gs->gimple_asm.ni);
+ gcc_assert (TREE_CODE (in_op) == TREE_LIST);
+ gimple_set_op (gs, index, in_op);
+}
+
+
+/* Return output operand INDEX of GIMPLE_ASM GS. */
+
+static inline tree
+gimple_asm_output_op (const_gimple gs, unsigned index)
+{
+ GIMPLE_CHECK (gs, GIMPLE_ASM);
+ gcc_assert (index <= gs->gimple_asm.no);
+ return gimple_op (gs, index + gs->gimple_asm.ni);
+}
+
+/* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
+
+static inline tree *
+gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
+{
+ GIMPLE_CHECK (gs, GIMPLE_ASM);
+ gcc_assert (index <= gs->gimple_asm.no);
+ return gimple_op_ptr (gs, index + gs->gimple_asm.ni);
+}
+
+
+/* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
+
+static inline void
+gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
+{
+ GIMPLE_CHECK (gs, GIMPLE_ASM);
+ gcc_assert (index <= gs->gimple_asm.no);
+ gcc_assert (TREE_CODE (out_op) == TREE_LIST);
+ gimple_set_op (gs, index + gs->gimple_asm.ni, out_op);
+}
+
+
+/* Return clobber operand INDEX of GIMPLE_ASM GS. */
+
+static inline tree
+gimple_asm_clobber_op (const_gimple gs, unsigned index)
+{
+ GIMPLE_CHECK (gs, GIMPLE_ASM);
+ gcc_assert (index <= gs->gimple_asm.nc);
+ return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no);
+}
+
+
+/* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
+
+static inline void
+gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
+{
+ GIMPLE_CHECK (gs, GIMPLE_ASM);
+ gcc_assert (index <= gs->gimple_asm.nc);
+ gcc_assert (TREE_CODE (clobber_op) == TREE_LIST);
+ gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no, clobber_op);
+}
+
+
+/* Return the string representing the assembly instruction in
+ GIMPLE_ASM GS. */
+
+static inline const char *
+gimple_asm_string (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_ASM);
+ return gs->gimple_asm.string;
+}
+
+
+/* Return true if GS is an asm statement marked volatile. */
+
+static inline bool
+gimple_asm_volatile_p (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_ASM);
+ return (gs->gsbase.subcode & GF_ASM_VOLATILE) != 0;
+}
+
+
+/* If VOLATLE_P is true, mark asm statement GS as volatile. */
+
+static inline void
+gimple_asm_set_volatile (gimple gs, bool volatile_p)
+{
+ GIMPLE_CHECK (gs, GIMPLE_ASM);
+ if (volatile_p)
+ gs->gsbase.subcode |= GF_ASM_VOLATILE;
+ else
+ gs->gsbase.subcode &= ~GF_ASM_VOLATILE;
+}
+
+
+/* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
+
+static inline void
+gimple_asm_set_input (gimple gs, bool input_p)
+{
+ GIMPLE_CHECK (gs, GIMPLE_ASM);
+ if (input_p)
+ gs->gsbase.subcode |= GF_ASM_INPUT;
+ else
+ gs->gsbase.subcode &= ~GF_ASM_INPUT;
+}
+
+
+/* Return true if asm GS is an ASM_INPUT. */
+
+static inline bool
+gimple_asm_input_p (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_ASM);
+ return (gs->gsbase.subcode & GF_ASM_INPUT) != 0;
+}
+
+
+/* Return the types handled by GIMPLE_CATCH statement GS. */
+
+static inline tree
+gimple_catch_types (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_CATCH);
+ return gs->gimple_catch.types;
+}
+
+
+/* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
+
+static inline tree *
+gimple_catch_types_ptr (gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_CATCH);
+ return &gs->gimple_catch.types;
+}
+
+
+/* Return the GIMPLE sequence representing the body of the handler of
+ GIMPLE_CATCH statement GS. */
+
+static inline gimple_seq
+gimple_catch_handler (gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_CATCH);
+ return gs->gimple_catch.handler;
+}
+
+
+/* Return a pointer to the GIMPLE sequence representing the body of
+ the handler of GIMPLE_CATCH statement GS. */
+
+static inline gimple_seq *
+gimple_catch_handler_ptr (gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_CATCH);
+ return &gs->gimple_catch.handler;
+}
+
+
+/* Set T to be the set of types handled by GIMPLE_CATCH GS. */
+
+static inline void
+gimple_catch_set_types (gimple gs, tree t)
+{
+ GIMPLE_CHECK (gs, GIMPLE_CATCH);
+ gs->gimple_catch.types = t;
+}
+
+
+/* Set HANDLER to be the body of GIMPLE_CATCH GS. */
+
+static inline void
+gimple_catch_set_handler (gimple gs, gimple_seq handler)
+{
+ GIMPLE_CHECK (gs, GIMPLE_CATCH);
+ gs->gimple_catch.handler = handler;
+}
+
+
+/* Return the types handled by GIMPLE_EH_FILTER statement GS. */
+
+static inline tree
+gimple_eh_filter_types (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
+ return gs->gimple_eh_filter.types;
+}
+
+
+/* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
+ GS. */
+
+static inline tree *
+gimple_eh_filter_types_ptr (gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
+ return &gs->gimple_eh_filter.types;
+}
+
+
+/* Return the sequence of statement to execute when GIMPLE_EH_FILTER
+ statement fails. */
+
+static inline gimple_seq
+gimple_eh_filter_failure (gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
+ return gs->gimple_eh_filter.failure;
+}
+
+
+/* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
+
+static inline void
+gimple_eh_filter_set_types (gimple gs, tree types)
+{
+ GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
+ gs->gimple_eh_filter.types = types;
+}
+
+
+/* Set FAILURE to be the sequence of statements to execute on failure
+ for GIMPLE_EH_FILTER GS. */
+
+static inline void
+gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
+{
+ GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
+ gs->gimple_eh_filter.failure = failure;
+}
+
+/* Return the EH_FILTER_MUST_NOT_THROW flag. */
+
+static inline bool
+
+gimple_eh_filter_must_not_throw (gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
+ return gs->gsbase.subcode != 0;
+}
+
+/* Set the EH_FILTER_MUST_NOT_THROW flag to the value MNTP. */
+
+static inline void
+gimple_eh_filter_set_must_not_throw (gimple gs, bool mntp)
+{
+ GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
+ gs->gsbase.subcode = (unsigned int) mntp;
+}
+
+
+/* GIMPLE_TRY accessors. */
+
+/* Return the kind of try block represented by GIMPLE_TRY GS. This is
+ either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
+
+static inline enum gimple_try_flags
+gimple_try_kind (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_TRY);
+ return (enum gimple_try_flags) (gs->gsbase.subcode & GIMPLE_TRY_KIND);
+}
+
+
+/* Set the kind of try block represented by GIMPLE_TRY GS. */
+
+static inline void
+gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
+{
+ GIMPLE_CHECK (gs, GIMPLE_TRY);
+ gcc_assert (kind == GIMPLE_TRY_CATCH || kind == GIMPLE_TRY_FINALLY);
+ if (gimple_try_kind (gs) != kind)
+ gs->gsbase.subcode = (unsigned int) kind;
+}
+
+
+/* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
+
+static inline bool
+gimple_try_catch_is_cleanup (const_gimple gs)
+{
+ gcc_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
+ return (gs->gsbase.subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
+}
+
+
+/* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
+
+static inline gimple_seq
+gimple_try_eval (gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_TRY);
+ return gs->gimple_try.eval;
+}
+
+
+/* Return the sequence of statements used as the cleanup body for
+ GIMPLE_TRY GS. */
+
+static inline gimple_seq
+gimple_try_cleanup (gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_TRY);
+ return gs->gimple_try.cleanup;
+}
+
+
+/* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
+
+static inline void
+gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
+{
+ gcc_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
+ if (catch_is_cleanup)
+ g->gsbase.subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
+ else
+ g->gsbase.subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
+}
+
+
+/* Set EVAL to be the sequence of statements to use as the body for
+ GIMPLE_TRY GS. */
+
+static inline void
+gimple_try_set_eval (gimple gs, gimple_seq eval)
+{
+ GIMPLE_CHECK (gs, GIMPLE_TRY);
+ gs->gimple_try.eval = eval;
+}
+
+
+/* Set CLEANUP to be the sequence of statements to use as the cleanup
+ body for GIMPLE_TRY GS. */
+
+static inline void
+gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
+{
+ GIMPLE_CHECK (gs, GIMPLE_TRY);
+ gs->gimple_try.cleanup = cleanup;
+}
+
+
+/* Return the cleanup sequence for cleanup statement GS. */
+
+static inline gimple_seq
+gimple_wce_cleanup (gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
+ return gs->gimple_wce.cleanup;
+}
+
+
+/* Set CLEANUP to be the cleanup sequence for GS. */
+
+static inline void
+gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
+{
+ GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
+ gs->gimple_wce.cleanup = cleanup;
+}
+
+
+/* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
+
+static inline bool
+gimple_wce_cleanup_eh_only (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
+ return gs->gsbase.subcode != 0;
+}
+
+
+/* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
+
+static inline void
+gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
+{
+ GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
+ gs->gsbase.subcode = (unsigned int) eh_only_p;
+}
+
+
+/* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
+
+static inline unsigned
+gimple_phi_capacity (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_PHI);
+ return gs->gimple_phi.capacity;
+}
+
+
+/* Return the number of arguments in GIMPLE_PHI GS. This must always
+ be exactly the number of incoming edges for the basic block holding
+ GS. */
+
+static inline unsigned
+gimple_phi_num_args (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_PHI);
+ return gs->gimple_phi.nargs;
+}
+
+
+/* Return the SSA name created by GIMPLE_PHI GS. */
+
+static inline tree
+gimple_phi_result (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_PHI);
+ return gs->gimple_phi.result;
+}
+
+/* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
+
+static inline tree *
+gimple_phi_result_ptr (gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_PHI);
+ return &gs->gimple_phi.result;
+}
+
+/* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
+
+static inline void
+gimple_phi_set_result (gimple gs, tree result)
+{
+ GIMPLE_CHECK (gs, GIMPLE_PHI);
+ gs->gimple_phi.result = result;
+}
+
+
+/* Return the PHI argument corresponding to incoming edge INDEX for
+ GIMPLE_PHI GS. */
+
+static inline struct phi_arg_d *
+gimple_phi_arg (gimple gs, unsigned index)
+{
+ GIMPLE_CHECK (gs, GIMPLE_PHI);
+ gcc_assert (index <= gs->gimple_phi.capacity);
+ return &(gs->gimple_phi.args[index]);
+}
+
+/* Set PHIARG to be the argument corresponding to incoming edge INDEX
+ for GIMPLE_PHI GS. */
+
+static inline void
+gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
+{
+ GIMPLE_CHECK (gs, GIMPLE_PHI);
+ gcc_assert (index <= gs->gimple_phi.nargs);
+ memcpy (gs->gimple_phi.args + index, phiarg, sizeof (struct phi_arg_d));
+}
+
+/* Return the region number for GIMPLE_RESX GS. */
+
+static inline int
+gimple_resx_region (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_RESX);
+ return gs->gimple_resx.region;
+}
+
+/* Set REGION to be the region number for GIMPLE_RESX GS. */
+
+static inline void
+gimple_resx_set_region (gimple gs, int region)
+{
+ GIMPLE_CHECK (gs, GIMPLE_RESX);
+ gs->gimple_resx.region = region;
+}
+
+
+/* Return the number of labels associated with the switch statement GS. */
+
+static inline unsigned
+gimple_switch_num_labels (const_gimple gs)
+{
+ unsigned num_ops;
+ GIMPLE_CHECK (gs, GIMPLE_SWITCH);
+ num_ops = gimple_num_ops (gs);
+ gcc_assert (num_ops > 1);
+ return num_ops - 1;
+}
+
+
+/* Set NLABELS to be the number of labels for the switch statement GS. */
+
+static inline void
+gimple_switch_set_num_labels (gimple g, unsigned nlabels)
+{
+ GIMPLE_CHECK (g, GIMPLE_SWITCH);
+ gimple_set_num_ops (g, nlabels + 1);
+}
+
+
+/* Return the index variable used by the switch statement GS. */
+
+static inline tree
+gimple_switch_index (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_SWITCH);
+ return gimple_op (gs, 0);
+}
+
+
+/* Return a pointer to the index variable for the switch statement GS. */
+
+static inline tree *
+gimple_switch_index_ptr (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_SWITCH);
+ return gimple_op_ptr (gs, 0);
+}
+
+
+/* Set INDEX to be the index variable for switch statement GS. */
+
+static inline void
+gimple_switch_set_index (gimple gs, tree index)
+{
+ GIMPLE_CHECK (gs, GIMPLE_SWITCH);
+ gcc_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
+ gimple_set_op (gs, 0, index);
+}
+
+
+/* Return the label numbered INDEX. The default label is 0, followed by any
+ labels in a switch statement. */
+
+static inline tree
+gimple_switch_label (const_gimple gs, unsigned index)
+{
+ GIMPLE_CHECK (gs, GIMPLE_SWITCH);
+ gcc_assert (gimple_num_ops (gs) > index + 1);
+ return gimple_op (gs, index + 1);
+}
+
+/* Set the label number INDEX to LABEL. 0 is always the default label. */
+
+static inline void
+gimple_switch_set_label (gimple gs, unsigned index, tree label)
+{
+ GIMPLE_CHECK (gs, GIMPLE_SWITCH);
+ gcc_assert (gimple_num_ops (gs) > index + 1);
+ gcc_assert (label == NULL_TREE || TREE_CODE (label) == CASE_LABEL_EXPR);
+ gimple_set_op (gs, index + 1, label);
+}
+
+/* Return the default label for a switch statement. */
+
+static inline tree
+gimple_switch_default_label (const_gimple gs)
+{
+ return gimple_switch_label (gs, 0);
+}
+
+/* Set the default label for a switch statement. */
+
+static inline void
+gimple_switch_set_default_label (gimple gs, tree label)
+{
+ gimple_switch_set_label (gs, 0, label);
+}
+
+
+/* Return the body for the OMP statement GS. */
+
+static inline gimple_seq
+gimple_omp_body (gimple gs)
+{
+ return gs->omp.body;
+}
+
+/* Set BODY to be the body for the OMP statement GS. */
+
+static inline void
+gimple_omp_set_body (gimple gs, gimple_seq body)
+{
+ gs->omp.body = body;
+}
+
+
+/* Return the name associated with OMP_CRITICAL statement GS. */
+
+static inline tree
+gimple_omp_critical_name (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
+ return gs->gimple_omp_critical.name;
+}
+
+
+/* Return a pointer to the name associated with OMP critical statement GS. */
+
+static inline tree *
+gimple_omp_critical_name_ptr (gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
+ return &gs->gimple_omp_critical.name;
+}
+
+
+/* Set NAME to be the name associated with OMP critical statement GS. */
+
+static inline void
+gimple_omp_critical_set_name (gimple gs, tree name)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
+ gs->gimple_omp_critical.name = name;
+}
+
+
+/* Return the clauses associated with OMP_FOR GS. */
+
+static inline tree
+gimple_omp_for_clauses (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
+ return gs->gimple_omp_for.clauses;
+}
+
+
+/* Return a pointer to the OMP_FOR GS. */
+
+static inline tree *
+gimple_omp_for_clauses_ptr (gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
+ return &gs->gimple_omp_for.clauses;
+}
+
+
+/* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
+
+static inline void
+gimple_omp_for_set_clauses (gimple gs, tree clauses)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
+ gs->gimple_omp_for.clauses = clauses;
+}
+
+
+/* Get the collapse count of OMP_FOR GS. */
+
+static inline size_t
+gimple_omp_for_collapse (gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
+ return gs->gimple_omp_for.collapse;
+}
+
+
+/* Return the index variable for OMP_FOR GS. */
+
+static inline tree
+gimple_omp_for_index (const_gimple gs, size_t i)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
+ gcc_assert (i < gs->gimple_omp_for.collapse);
+ return gs->gimple_omp_for.iter[i].index;
+}
+
+
+/* Return a pointer to the index variable for OMP_FOR GS. */
+
+static inline tree *
+gimple_omp_for_index_ptr (gimple gs, size_t i)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
+ gcc_assert (i < gs->gimple_omp_for.collapse);
+ return &gs->gimple_omp_for.iter[i].index;
+}
+
+
+/* Set INDEX to be the index variable for OMP_FOR GS. */
+
+static inline void
+gimple_omp_for_set_index (gimple gs, size_t i, tree index)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
+ gcc_assert (i < gs->gimple_omp_for.collapse);
+ gs->gimple_omp_for.iter[i].index = index;
+}
+
+
+/* Return the initial value for OMP_FOR GS. */
+
+static inline tree
+gimple_omp_for_initial (const_gimple gs, size_t i)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
+ gcc_assert (i < gs->gimple_omp_for.collapse);
+ return gs->gimple_omp_for.iter[i].initial;
+}
+
+
+/* Return a pointer to the initial value for OMP_FOR GS. */
+
+static inline tree *
+gimple_omp_for_initial_ptr (gimple gs, size_t i)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
+ gcc_assert (i < gs->gimple_omp_for.collapse);
+ return &gs->gimple_omp_for.iter[i].initial;
+}
+
+
+/* Set INITIAL to be the initial value for OMP_FOR GS. */
+
+static inline void
+gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
+ gcc_assert (i < gs->gimple_omp_for.collapse);
+ gs->gimple_omp_for.iter[i].initial = initial;
+}
+
+
+/* Return the final value for OMP_FOR GS. */
+
+static inline tree
+gimple_omp_for_final (const_gimple gs, size_t i)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
+ gcc_assert (i < gs->gimple_omp_for.collapse);
+ return gs->gimple_omp_for.iter[i].final;
+}
+
+
+/* Return a pointer to the final value for OMP_FOR GS. */
+
+static inline tree *
+gimple_omp_for_final_ptr (gimple gs, size_t i)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
+ gcc_assert (i < gs->gimple_omp_for.collapse);
+ return &gs->gimple_omp_for.iter[i].final;
+}
+
+
+/* Set FINAL to be the final value for OMP_FOR GS. */
+
+static inline void
+gimple_omp_for_set_final (gimple gs, size_t i, tree final)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
+ gcc_assert (i < gs->gimple_omp_for.collapse);
+ gs->gimple_omp_for.iter[i].final = final;
+}
+
+
+/* Return the increment value for OMP_FOR GS. */
+
+static inline tree
+gimple_omp_for_incr (const_gimple gs, size_t i)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
+ gcc_assert (i < gs->gimple_omp_for.collapse);
+ return gs->gimple_omp_for.iter[i].incr;
+}
+
+
+/* Return a pointer to the increment value for OMP_FOR GS. */
+
+static inline tree *
+gimple_omp_for_incr_ptr (gimple gs, size_t i)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
+ gcc_assert (i < gs->gimple_omp_for.collapse);
+ return &gs->gimple_omp_for.iter[i].incr;
+}
+
+
+/* Set INCR to be the increment value for OMP_FOR GS. */
+
+static inline void
+gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
+ gcc_assert (i < gs->gimple_omp_for.collapse);
+ gs->gimple_omp_for.iter[i].incr = incr;
+}
+
+
+/* Return the sequence of statements to execute before the OMP_FOR
+ statement GS starts. */
+
+static inline gimple_seq
+gimple_omp_for_pre_body (gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
+ return gs->gimple_omp_for.pre_body;
+}
+
+
+/* Set PRE_BODY to be the sequence of statements to execute before the
+ OMP_FOR statement GS starts. */
+
+static inline void
+gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
+ gs->gimple_omp_for.pre_body = pre_body;
+}
+
+
+/* Return the clauses associated with OMP_PARALLEL GS. */
+
+static inline tree
+gimple_omp_parallel_clauses (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
+ return gs->gimple_omp_parallel.clauses;
+}
+
+
+/* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
+
+static inline tree *
+gimple_omp_parallel_clauses_ptr (gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
+ return &gs->gimple_omp_parallel.clauses;
+}
+
+
+/* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
+ GS. */
+
+static inline void
+gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
+ gs->gimple_omp_parallel.clauses = clauses;
+}
+
+
+/* Return the child function used to hold the body of OMP_PARALLEL GS. */
+
+static inline tree
+gimple_omp_parallel_child_fn (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
+ return gs->gimple_omp_parallel.child_fn;
+}
+
+/* Return a pointer to the child function used to hold the body of
+ OMP_PARALLEL GS. */
+
+static inline tree *
+gimple_omp_parallel_child_fn_ptr (gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
+ return &gs->gimple_omp_parallel.child_fn;
+}
+
+
+/* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
+
+static inline void
+gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
+ gs->gimple_omp_parallel.child_fn = child_fn;
+}
+
+
+/* Return the artificial argument used to send variables and values
+ from the parent to the children threads in OMP_PARALLEL GS. */
+
+static inline tree
+gimple_omp_parallel_data_arg (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
+ return gs->gimple_omp_parallel.data_arg;
+}
+
+
+/* Return a pointer to the data argument for OMP_PARALLEL GS. */
+
+static inline tree *
+gimple_omp_parallel_data_arg_ptr (gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
+ return &gs->gimple_omp_parallel.data_arg;
+}
+
+
+/* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
+
+static inline void
+gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
+ gs->gimple_omp_parallel.data_arg = data_arg;
+}
+
+
+/* Return the clauses associated with OMP_TASK GS. */
+
+static inline tree
+gimple_omp_task_clauses (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
+ return gs->gimple_omp_parallel.clauses;
+}
+
+
+/* Return a pointer to the clauses associated with OMP_TASK GS. */
+
+static inline tree *
+gimple_omp_task_clauses_ptr (gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
+ return &gs->gimple_omp_parallel.clauses;
+}
+
+
+/* Set CLAUSES to be the list of clauses associated with OMP_TASK
+ GS. */
+
+static inline void
+gimple_omp_task_set_clauses (gimple gs, tree clauses)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
+ gs->gimple_omp_parallel.clauses = clauses;
+}
+
+
+/* Return the child function used to hold the body of OMP_TASK GS. */
+
+static inline tree
+gimple_omp_task_child_fn (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
+ return gs->gimple_omp_parallel.child_fn;
+}
+
+/* Return a pointer to the child function used to hold the body of
+ OMP_TASK GS. */
+
+static inline tree *
+gimple_omp_task_child_fn_ptr (gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
+ return &gs->gimple_omp_parallel.child_fn;
+}
+
+
+/* Set CHILD_FN to be the child function for OMP_TASK GS. */
+
+static inline void
+gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
+ gs->gimple_omp_parallel.child_fn = child_fn;
+}
+
+
+/* Return the artificial argument used to send variables and values
+ from the parent to the children threads in OMP_TASK GS. */
+
+static inline tree
+gimple_omp_task_data_arg (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
+ return gs->gimple_omp_parallel.data_arg;
+}
+
+
+/* Return a pointer to the data argument for OMP_TASK GS. */
+
+static inline tree *
+gimple_omp_task_data_arg_ptr (gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
+ return &gs->gimple_omp_parallel.data_arg;
+}
+
+
+/* Set DATA_ARG to be the data argument for OMP_TASK GS. */
+
+static inline void
+gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
+ gs->gimple_omp_parallel.data_arg = data_arg;
+}
+
+
+/* Return the clauses associated with OMP_TASK GS. */
+
+static inline tree
+gimple_omp_taskreg_clauses (const_gimple gs)
+{
+ if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
+ GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
+ return gs->gimple_omp_parallel.clauses;
+}
+
+
+/* Return a pointer to the clauses associated with OMP_TASK GS. */
+
+static inline tree *
+gimple_omp_taskreg_clauses_ptr (gimple gs)
+{
+ if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
+ GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
+ return &gs->gimple_omp_parallel.clauses;
+}
+
+
+/* Set CLAUSES to be the list of clauses associated with OMP_TASK
+ GS. */
+
+static inline void
+gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
+{
+ if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
+ GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
+ gs->gimple_omp_parallel.clauses = clauses;
+}
+
+
+/* Return the child function used to hold the body of OMP_TASK GS. */
+
+static inline tree
+gimple_omp_taskreg_child_fn (const_gimple gs)
+{
+ if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
+ GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
+ return gs->gimple_omp_parallel.child_fn;
+}
+
+/* Return a pointer to the child function used to hold the body of
+ OMP_TASK GS. */
+
+static inline tree *
+gimple_omp_taskreg_child_fn_ptr (gimple gs)
+{
+ if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
+ GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
+ return &gs->gimple_omp_parallel.child_fn;
+}
+
+
+/* Set CHILD_FN to be the child function for OMP_TASK GS. */
+
+static inline void
+gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
+{
+ if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
+ GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
+ gs->gimple_omp_parallel.child_fn = child_fn;
+}
+
+
+/* Return the artificial argument used to send variables and values
+ from the parent to the children threads in OMP_TASK GS. */
+
+static inline tree
+gimple_omp_taskreg_data_arg (const_gimple gs)
+{
+ if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
+ GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
+ return gs->gimple_omp_parallel.data_arg;
+}
+
+
+/* Return a pointer to the data argument for OMP_TASK GS. */
+
+static inline tree *
+gimple_omp_taskreg_data_arg_ptr (gimple gs)
+{
+ if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
+ GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
+ return &gs->gimple_omp_parallel.data_arg;
+}
+
+
+/* Set DATA_ARG to be the data argument for OMP_TASK GS. */
+
+static inline void
+gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
+{
+ if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
+ GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
+ gs->gimple_omp_parallel.data_arg = data_arg;
+}
+
+
+/* Return the copy function used to hold the body of OMP_TASK GS. */
+
+static inline tree
+gimple_omp_task_copy_fn (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
+ return gs->gimple_omp_task.copy_fn;
+}
+
+/* Return a pointer to the copy function used to hold the body of
+ OMP_TASK GS. */
+
+static inline tree *
+gimple_omp_task_copy_fn_ptr (gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
+ return &gs->gimple_omp_task.copy_fn;
+}
+
+
+/* Set CHILD_FN to be the copy function for OMP_TASK GS. */
+
+static inline void
+gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
+ gs->gimple_omp_task.copy_fn = copy_fn;
+}
+
+
+/* Return size of the data block in bytes in OMP_TASK GS. */
+
+static inline tree
+gimple_omp_task_arg_size (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
+ return gs->gimple_omp_task.arg_size;
+}
+
+
+/* Return a pointer to the data block size for OMP_TASK GS. */
+
+static inline tree *
+gimple_omp_task_arg_size_ptr (gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
+ return &gs->gimple_omp_task.arg_size;
+}
+
+
+/* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
+
+static inline void
+gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
+ gs->gimple_omp_task.arg_size = arg_size;
+}
+
+
+/* Return align of the data block in bytes in OMP_TASK GS. */
+
+static inline tree
+gimple_omp_task_arg_align (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
+ return gs->gimple_omp_task.arg_align;
+}
+
+
+/* Return a pointer to the data block align for OMP_TASK GS. */
+
+static inline tree *
+gimple_omp_task_arg_align_ptr (gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
+ return &gs->gimple_omp_task.arg_align;
+}
+
+
+/* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
+
+static inline void
+gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
+ gs->gimple_omp_task.arg_align = arg_align;
+}
+
+
+/* Return the clauses associated with OMP_SINGLE GS. */
+
+static inline tree
+gimple_omp_single_clauses (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
+ return gs->gimple_omp_single.clauses;
+}
+
+
+/* Return a pointer to the clauses associated with OMP_SINGLE GS. */
+
+static inline tree *
+gimple_omp_single_clauses_ptr (gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
+ return &gs->gimple_omp_single.clauses;
+}
+
+
+/* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
+
+static inline void
+gimple_omp_single_set_clauses (gimple gs, tree clauses)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
+ gs->gimple_omp_single.clauses = clauses;
+}
+
+
+/* Return the clauses associated with OMP_SECTIONS GS. */
+
+static inline tree
+gimple_omp_sections_clauses (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
+ return gs->gimple_omp_sections.clauses;
+}
+
+
+/* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
+
+static inline tree *
+gimple_omp_sections_clauses_ptr (gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
+ return &gs->gimple_omp_sections.clauses;
+}
+
+
+/* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
+ GS. */
+
+static inline void
+gimple_omp_sections_set_clauses (gimple gs, tree clauses)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
+ gs->gimple_omp_sections.clauses = clauses;
+}
+
+
+/* Return the control variable associated with the GIMPLE_OMP_SECTIONS
+ in GS. */
+
+static inline tree
+gimple_omp_sections_control (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
+ return gs->gimple_omp_sections.control;
+}
+
+
+/* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
+ GS. */
+
+static inline tree *
+gimple_omp_sections_control_ptr (gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
+ return &gs->gimple_omp_sections.control;
+}
+
+
+/* Set CONTROL to be the set of clauses associated with the
+ GIMPLE_OMP_SECTIONS in GS. */
+
+static inline void
+gimple_omp_sections_set_control (gimple gs, tree control)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
+ gs->gimple_omp_sections.control = control;
+}
+
+
+/* Set COND to be the condition code for OMP_FOR GS. */
+
+static inline void
+gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
+ gcc_assert (TREE_CODE_CLASS (cond) == tcc_comparison);
+ gcc_assert (i < gs->gimple_omp_for.collapse);
+ gs->gimple_omp_for.iter[i].cond = cond;
+}
+
+
+/* Return the condition code associated with OMP_FOR GS. */
+
+static inline enum tree_code
+gimple_omp_for_cond (const_gimple gs, size_t i)
+{
+ GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
+ gcc_assert (i < gs->gimple_omp_for.collapse);
+ return gs->gimple_omp_for.iter[i].cond;
+}
+
+
+/* Set the value being stored in an atomic store. */
+
+static inline void
+gimple_omp_atomic_store_set_val (gimple g, tree val)
+{
+ GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
+ g->gimple_omp_atomic_store.val = val;
+}
+
+
+/* Return the value being stored in an atomic store. */
+
+static inline tree
+gimple_omp_atomic_store_val (const_gimple g)
+{
+ GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
+ return g->gimple_omp_atomic_store.val;
+}
+
+
+/* Return a pointer to the value being stored in an atomic store. */
+
+static inline tree *
+gimple_omp_atomic_store_val_ptr (gimple g)
+{
+ GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
+ return &g->gimple_omp_atomic_store.val;
+}
+
+
+/* Set the LHS of an atomic load. */
+
+static inline void
+gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
+{
+ GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
+ g->gimple_omp_atomic_load.lhs = lhs;
+}
+
+
+/* Get the LHS of an atomic load. */
+
+static inline tree
+gimple_omp_atomic_load_lhs (const_gimple g)
+{
+ GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
+ return g->gimple_omp_atomic_load.lhs;
+}
+
+
+/* Return a pointer to the LHS of an atomic load. */
+
+static inline tree *
+gimple_omp_atomic_load_lhs_ptr (gimple g)
+{
+ GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
+ return &g->gimple_omp_atomic_load.lhs;
+}
+
+
+/* Set the RHS of an atomic load. */
+
+static inline void
+gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
+{
+ GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
+ g->gimple_omp_atomic_load.rhs = rhs;
+}
+
+
+/* Get the RHS of an atomic load. */
+
+static inline tree
+gimple_omp_atomic_load_rhs (const_gimple g)
+{
+ GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
+ return g->gimple_omp_atomic_load.rhs;
+}
+
+
+/* Return a pointer to the RHS of an atomic load. */
+
+static inline tree *
+gimple_omp_atomic_load_rhs_ptr (gimple g)
+{
+ GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
+ return &g->gimple_omp_atomic_load.rhs;
+}
+
+
+/* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
+
+static inline tree
+gimple_omp_continue_control_def (const_gimple g)
+{
+ GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
+ return g->gimple_omp_continue.control_def;
+}
+
+/* The same as above, but return the address. */
+
+static inline tree *
+gimple_omp_continue_control_def_ptr (gimple g)
+{
+ GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
+ return &g->gimple_omp_continue.control_def;
+}
+
+/* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
+
+static inline void
+gimple_omp_continue_set_control_def (gimple g, tree def)
+{
+ GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
+ g->gimple_omp_continue.control_def = def;
+}
+
+
+/* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
+
+static inline tree
+gimple_omp_continue_control_use (const_gimple g)
+{
+ GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
+ return g->gimple_omp_continue.control_use;
+}
+
+
+/* The same as above, but return the address. */
+
+static inline tree *
+gimple_omp_continue_control_use_ptr (gimple g)
+{
+ GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
+ return &g->gimple_omp_continue.control_use;
+}
+
+
+/* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
+
+static inline void
+gimple_omp_continue_set_control_use (gimple g, tree use)
+{
+ GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
+ g->gimple_omp_continue.control_use = use;
+}
+
+
+/* Return a pointer to the return value for GIMPLE_RETURN GS. */
+
+static inline tree *
+gimple_return_retval_ptr (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_RETURN);
+ gcc_assert (gimple_num_ops (gs) == 1);
+ return gimple_op_ptr (gs, 0);
+}
+
+/* Return the return value for GIMPLE_RETURN GS. */
+
+static inline tree
+gimple_return_retval (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_RETURN);
+ gcc_assert (gimple_num_ops (gs) == 1);
+ return gimple_op (gs, 0);
+}
+
+
+/* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
+
+static inline void
+gimple_return_set_retval (gimple gs, tree retval)
+{
+ GIMPLE_CHECK (gs, GIMPLE_RETURN);
+ gcc_assert (gimple_num_ops (gs) == 1);
+ gcc_assert (retval == NULL_TREE
+ || TREE_CODE (retval) == RESULT_DECL
+ || is_gimple_val (retval));
+ gimple_set_op (gs, 0, retval);
+}
+
+
+/* Returns true when the gimple statment STMT is any of the OpenMP types. */
+
+static inline bool
+is_gimple_omp (const_gimple stmt)
+{
+ return (gimple_code (stmt) == GIMPLE_OMP_PARALLEL
+ || gimple_code (stmt) == GIMPLE_OMP_TASK
+ || gimple_code (stmt) == GIMPLE_OMP_FOR
+ || gimple_code (stmt) == GIMPLE_OMP_SECTIONS
+ || gimple_code (stmt) == GIMPLE_OMP_SECTIONS_SWITCH
+ || gimple_code (stmt) == GIMPLE_OMP_SINGLE
+ || gimple_code (stmt) == GIMPLE_OMP_SECTION
+ || gimple_code (stmt) == GIMPLE_OMP_MASTER
+ || gimple_code (stmt) == GIMPLE_OMP_ORDERED
+ || gimple_code (stmt) == GIMPLE_OMP_CRITICAL
+ || gimple_code (stmt) == GIMPLE_OMP_RETURN
+ || gimple_code (stmt) == GIMPLE_OMP_ATOMIC_LOAD
+ || gimple_code (stmt) == GIMPLE_OMP_ATOMIC_STORE
+ || gimple_code (stmt) == GIMPLE_OMP_CONTINUE);
+}
+
+
+/* Returns TRUE if statement G is a GIMPLE_NOP. */
+
+static inline bool
+gimple_nop_p (const_gimple g)
+{
+ return gimple_code (g) == GIMPLE_NOP;
+}
+
+
+/* Return the new type set by GIMPLE_CHANGE_DYNAMIC_TYPE statement GS. */
+
+static inline tree
+gimple_cdt_new_type (gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_CHANGE_DYNAMIC_TYPE);
+ return gimple_op (gs, 1);
+}
+
+/* Return a pointer to the new type set by GIMPLE_CHANGE_DYNAMIC_TYPE
+ statement GS. */
+
+static inline tree *
+gimple_cdt_new_type_ptr (gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_CHANGE_DYNAMIC_TYPE);
+ return gimple_op_ptr (gs, 1);
+}
+
+/* Set NEW_TYPE to be the type returned by GIMPLE_CHANGE_DYNAMIC_TYPE
+ statement GS. */
+
+static inline void
+gimple_cdt_set_new_type (gimple gs, tree new_type)
+{
+ GIMPLE_CHECK (gs, GIMPLE_CHANGE_DYNAMIC_TYPE);
+ gcc_assert (TREE_CODE_CLASS (TREE_CODE (new_type)) == tcc_type);
+ gimple_set_op (gs, 1, new_type);
+}
+
+
+/* Return the location affected by GIMPLE_CHANGE_DYNAMIC_TYPE statement GS. */
+
+static inline tree
+gimple_cdt_location (gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_CHANGE_DYNAMIC_TYPE);
+ return gimple_op (gs, 0);
+}
+
+
+/* Return a pointer to the location affected by GIMPLE_CHANGE_DYNAMIC_TYPE
+ statement GS. */
+
+static inline tree *
+gimple_cdt_location_ptr (gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_CHANGE_DYNAMIC_TYPE);
+ return gimple_op_ptr (gs, 0);
+}
+
+
+/* Set PTR to be the location affected by GIMPLE_CHANGE_DYNAMIC_TYPE
+ statement GS. */
+
+static inline void
+gimple_cdt_set_location (gimple gs, tree ptr)
+{
+ GIMPLE_CHECK (gs, GIMPLE_CHANGE_DYNAMIC_TYPE);
+ gimple_set_op (gs, 0, ptr);
+}
+
+
+/* Return the predictor of GIMPLE_PREDICT statement GS. */
+
+static inline enum br_predictor
+gimple_predict_predictor (gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_PREDICT);
+ return (enum br_predictor) (gs->gsbase.subcode & ~GF_PREDICT_TAKEN);
+}
+
+
+/* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
+
+static inline void
+gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
+{
+ GIMPLE_CHECK (gs, GIMPLE_PREDICT);
+ gs->gsbase.subcode = (gs->gsbase.subcode & GF_PREDICT_TAKEN)
+ | (unsigned) predictor;
+}
+
+
+/* Return the outcome of GIMPLE_PREDICT statement GS. */
+
+static inline enum prediction
+gimple_predict_outcome (gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_PREDICT);
+ return (gs->gsbase.subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
+}
+
+
+/* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
+
+static inline void
+gimple_predict_set_outcome (gimple gs, enum prediction outcome)
+{
+ GIMPLE_CHECK (gs, GIMPLE_PREDICT);
+ if (outcome == TAKEN)
+ gs->gsbase.subcode |= GF_PREDICT_TAKEN;
+ else
+ gs->gsbase.subcode &= ~GF_PREDICT_TAKEN;
+}
+
+
+/* Return a new iterator pointing to GIMPLE_SEQ's first statement. */
+
+static inline gimple_stmt_iterator
+gsi_start (gimple_seq seq)
+{
+ gimple_stmt_iterator i;
+
+ i.ptr = gimple_seq_first (seq);
+ i.seq = seq;
+ i.bb = (i.ptr && i.ptr->stmt) ? gimple_bb (i.ptr->stmt) : NULL;
+
+ return i;
+}
+
+
+/* Return a new iterator pointing to the first statement in basic block BB. */
+
+static inline gimple_stmt_iterator
+gsi_start_bb (basic_block bb)
+{
+ gimple_stmt_iterator i;
+ gimple_seq seq;
+
+ seq = bb_seq (bb);
+ i.ptr = gimple_seq_first (seq);
+ i.seq = seq;
+ i.bb = bb;
+
+ return i;
+}
+
+
+/* Return a new iterator initially pointing to GIMPLE_SEQ's last statement. */
+
+static inline gimple_stmt_iterator
+gsi_last (gimple_seq seq)
+{
+ gimple_stmt_iterator i;
+
+ i.ptr = gimple_seq_last (seq);
+ i.seq = seq;
+ i.bb = (i.ptr && i.ptr->stmt) ? gimple_bb (i.ptr->stmt) : NULL;
+
+ return i;
+}
+
+
+/* Return a new iterator pointing to the last statement in basic block BB. */
+
+static inline gimple_stmt_iterator
+gsi_last_bb (basic_block bb)
+{
+ gimple_stmt_iterator i;
+ gimple_seq seq;
+
+ seq = bb_seq (bb);
+ i.ptr = gimple_seq_last (seq);
+ i.seq = seq;
+ i.bb = bb;
+
+ return i;
+}
+
+
+/* Return true if I is at the end of its sequence. */
+
+static inline bool
+gsi_end_p (gimple_stmt_iterator i)
+{
+ return i.ptr == NULL;
+}
+
+
+/* Return true if I is one statement before the end of its sequence. */
+
+static inline bool
+gsi_one_before_end_p (gimple_stmt_iterator i)
+{
+ return i.ptr != NULL && i.ptr->next == NULL;
+}
+
+
+/* Advance the iterator to the next gimple statement. */
+
+static inline void
+gsi_next (gimple_stmt_iterator *i)
+{
+ i->ptr = i->ptr->next;
+}
+
+/* Advance the iterator to the previous gimple statement. */
+
+static inline void
+gsi_prev (gimple_stmt_iterator *i)
+{
+ i->ptr = i->ptr->prev;
+}
+
+/* Return the current stmt. */
+
+static inline gimple
+gsi_stmt (gimple_stmt_iterator i)
+{
+ return i.ptr->stmt;
+}
+
+/* Return a block statement iterator that points to the first non-label
+ statement in block BB. */
+
+static inline gimple_stmt_iterator
+gsi_after_labels (basic_block bb)
+{
+ gimple_stmt_iterator gsi = gsi_start_bb (bb);
+
+ while (!gsi_end_p (gsi) && gimple_code (gsi_stmt (gsi)) == GIMPLE_LABEL)
+ gsi_next (&gsi);
+
+ return gsi;
+}
+
+/* Return a pointer to the current stmt.
+
+ NOTE: You may want to use gsi_replace on the iterator itself,
+ as this performs additional bookkeeping that will not be done
+ if you simply assign through a pointer returned by gsi_stmt_ptr. */
+
+static inline gimple *
+gsi_stmt_ptr (gimple_stmt_iterator *i)
+{
+ return &i->ptr->stmt;
+}
+
+
+/* Return the basic block associated with this iterator. */
+
+static inline basic_block
+gsi_bb (gimple_stmt_iterator i)
+{
+ return i.bb;
+}
+
+
+/* Return the sequence associated with this iterator. */
+
+static inline gimple_seq
+gsi_seq (gimple_stmt_iterator i)
+{
+ return i.seq;
+}
+
+
+enum gsi_iterator_update
+{
+ GSI_NEW_STMT, /* Only valid when single statement is added, move
+ iterator to it. */
+ GSI_SAME_STMT, /* Leave the iterator at the same statement. */
+ GSI_CONTINUE_LINKING /* Move iterator to whatever position is suitable
+ for linking other statements in the same
+ direction. */
+};
+
+/* In gimple-iterator.c */
+gimple_stmt_iterator gsi_start_phis (basic_block);
+gimple_seq gsi_split_seq_after (gimple_stmt_iterator);
+gimple_seq gsi_split_seq_before (gimple_stmt_iterator *);
+void gsi_replace (gimple_stmt_iterator *, gimple, bool);
+void gsi_insert_before (gimple_stmt_iterator *, gimple,
+ enum gsi_iterator_update);
+void gsi_insert_before_without_update (gimple_stmt_iterator *, gimple,
+ enum gsi_iterator_update);
+void gsi_insert_seq_before (gimple_stmt_iterator *, gimple_seq,
+ enum gsi_iterator_update);
+void gsi_insert_seq_before_without_update (gimple_stmt_iterator *, gimple_seq,
+ enum gsi_iterator_update);
+void gsi_insert_after (gimple_stmt_iterator *, gimple,
+ enum gsi_iterator_update);
+void gsi_insert_after_without_update (gimple_stmt_iterator *, gimple,
+ enum gsi_iterator_update);
+void gsi_insert_seq_after (gimple_stmt_iterator *, gimple_seq,
+ enum gsi_iterator_update);
+void gsi_insert_seq_after_without_update (gimple_stmt_iterator *, gimple_seq,
+ enum gsi_iterator_update);
+void gsi_remove (gimple_stmt_iterator *, bool);
+gimple_stmt_iterator gsi_for_stmt (gimple);
+void gsi_move_after (gimple_stmt_iterator *, gimple_stmt_iterator *);
+void gsi_move_before (gimple_stmt_iterator *, gimple_stmt_iterator *);
+void gsi_move_to_bb_end (gimple_stmt_iterator *, struct basic_block_def *);
+void gsi_insert_on_edge (edge, gimple);
+void gsi_insert_seq_on_edge (edge, gimple_seq);
+basic_block gsi_insert_on_edge_immediate (edge, gimple);
+basic_block gsi_insert_seq_on_edge_immediate (edge, gimple_seq);
+void gsi_commit_one_edge_insert (edge, basic_block *);
+void gsi_commit_edge_inserts (void);
+
+
+/* Convenience routines to walk all statements of a gimple function.
+ Note that this is useful exclusively before the code is converted
+ into SSA form. Once the program is in SSA form, the standard
+ operand interface should be used to analyze/modify statements. */
+struct walk_stmt_info
+{
+ /* Points to the current statement being walked. */
+ gimple_stmt_iterator gsi;
+
+ /* Additional data that the callback functions may want to carry
+ through the recursion. */
+ void *info;
+
+ /* Pointer map used to mark visited tree nodes when calling
+ walk_tree on each operand. If set to NULL, duplicate tree nodes
+ will be visited more than once. */
+ struct pointer_set_t *pset;
+
+ /* Indicates whether the operand being examined may be replaced
+ with something that matches is_gimple_val (if true) or something
+ slightly more complicated (if false). "Something" technically
+ means the common subset of is_gimple_lvalue and is_gimple_rhs,
+ but we never try to form anything more complicated than that, so
+ we don't bother checking.
+
+ Also note that CALLBACK should update this flag while walking the
+ sub-expressions of a statement. For instance, when walking the
+ statement 'foo (&var)', the flag VAL_ONLY will initially be set
+ to true, however, when walking &var, the operand of that
+ ADDR_EXPR does not need to be a GIMPLE value. */
+ bool val_only;
+
+ /* True if we are currently walking the LHS of an assignment. */
+ bool is_lhs;
+
+ /* Optional. Set to true by the callback functions if they made any
+ changes. */
+ bool changed;
+
+ /* True if we're interested in location information. */
+ bool want_locations;
+
+ /* Operand returned by the callbacks. This is set when calling
+ walk_gimple_seq. If the walk_stmt_fn or walk_tree_fn callback
+ returns non-NULL, this field will contain the tree returned by
+ the last callback. */
+ tree callback_result;
+};
+
+/* Callback for walk_gimple_stmt. Called for every statement found
+ during traversal. The first argument points to the statement to
+ walk. The second argument is a flag that the callback sets to
+ 'true' if it the callback handled all the operands and
+ sub-statements of the statement (the default value of this flag is
+ 'false'). The third argument is an anonymous pointer to data
+ to be used by the callback. */
+typedef tree (*walk_stmt_fn) (gimple_stmt_iterator *, bool *,
+ struct walk_stmt_info *);
+
+gimple walk_gimple_seq (gimple_seq, walk_stmt_fn, walk_tree_fn,
+ struct walk_stmt_info *);
+tree walk_gimple_stmt (gimple_stmt_iterator *, walk_stmt_fn, walk_tree_fn,
+ struct walk_stmt_info *);
+tree walk_gimple_op (gimple, walk_tree_fn, struct walk_stmt_info *);
+
+#ifdef GATHER_STATISTICS
+/* Enum and arrays used for allocation stats. Keep in sync with
+ gimple.c:gimple_alloc_kind_names. */
+enum gimple_alloc_kind
+{
+ gimple_alloc_kind_assign, /* Assignments. */
+ gimple_alloc_kind_phi, /* PHI nodes. */
+ gimple_alloc_kind_cond, /* Conditionals. */
+ gimple_alloc_kind_seq, /* Sequences. */
+ gimple_alloc_kind_rest, /* Everything else. */
+ gimple_alloc_kind_all
+};
+
+extern int gimple_alloc_counts[];
+extern int gimple_alloc_sizes[];
+
+/* Return the allocation kind for a given stmt CODE. */
+static inline enum gimple_alloc_kind
+gimple_alloc_kind (enum gimple_code code)
+{
+ switch (code)
+ {
+ case GIMPLE_ASSIGN:
+ return gimple_alloc_kind_assign;
+ case GIMPLE_PHI:
+ return gimple_alloc_kind_phi;
+ case GIMPLE_COND:
+ return gimple_alloc_kind_cond;
+ default:
+ return gimple_alloc_kind_rest;
+ }
+}
+#endif /* GATHER_STATISTICS */
+
+extern void dump_gimple_statistics (void);
+
+#endif /* GCC_GIMPLE_H */
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index b6bc9ca79a5..43c8df991fc 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -28,7 +28,8 @@ along with GCC; see the file COPYING3. If not see
#include "tree.h"
#include "rtl.h"
#include "varray.h"
-#include "tree-gimple.h"
+#include "gimple.h"
+#include "tree-iterator.h"
#include "tree-inline.h"
#include "diagnostic.h"
#include "langhooks.h"
@@ -49,6 +50,8 @@ along with GCC; see the file COPYING3. If not see
#include "optabs.h"
#include "pointer-set.h"
#include "splay-tree.h"
+#include "vec.h"
+#include "gimple.h"
enum gimplify_omp_var_data
@@ -67,6 +70,7 @@ enum gimplify_omp_var_data
| GOVD_LASTPRIVATE | GOVD_REDUCTION | GOVD_LOCAL)
};
+
enum omp_region_type
{
ORT_WORKSHARE = 0,
@@ -89,7 +93,6 @@ static struct gimplify_ctx *gimplify_ctxp;
static struct gimplify_omp_ctx *gimplify_omp_ctxp;
-
/* Formal (expression) temporary table handling: Multiple occurrences of
the same scalar expression are evaluated into the same temporary. */
@@ -100,7 +103,7 @@ typedef struct gimple_temp_hash_elt
} elt_t;
/* Forward declarations. */
-static enum gimplify_status gimplify_compound_expr (tree *, tree *, bool);
+static enum gimplify_status gimplify_compound_expr (tree *, gimple_seq *, bool);
/* Mark X addressable. Unlike the langhook we expect X to be in gimple
form and we don't do any syntax checking. */
@@ -146,6 +149,49 @@ gimple_tree_eq (const void *p1, const void *p2)
return 1;
}
+/* Link gimple statement GS to the end of the sequence *SEQ_P. If
+ *SEQ_P is NULL, a new sequence is allocated. This function is
+ similar to gimple_seq_add_stmt, but does not scan the operands.
+ During gimplification, we need to manipulate statement sequences
+ before the def/use vectors have been constructed. */
+
+static void
+gimplify_seq_add_stmt (gimple_seq *seq_p, gimple gs)
+{
+ gimple_stmt_iterator si;
+
+ if (gs == NULL)
+ return;
+
+ if (*seq_p == NULL)
+ *seq_p = gimple_seq_alloc ();
+
+ si = gsi_last (*seq_p);
+
+ gsi_insert_after_without_update (&si, gs, GSI_NEW_STMT);
+}
+
+/* Append sequence SRC to the end of sequence *DST_P. If *DST_P is
+ NULL, a new sequence is allocated. This function is
+ similar to gimple_seq_add_seq, but does not scan the operands.
+ During gimplification, we need to manipulate statement sequences
+ before the def/use vectors have been constructed. */
+
+static void
+gimplify_seq_add_seq (gimple_seq *dst_p, gimple_seq src)
+{
+ gimple_stmt_iterator si;
+
+ if (src == NULL)
+ return;
+
+ if (*dst_p == NULL)
+ *dst_p = gimple_seq_alloc ();
+
+ si = gsi_last (*dst_p);
+ gsi_insert_seq_after_without_update (&si, src, GSI_NEW_STMT);
+}
+
/* Set up a context for the gimplifier. */
void
@@ -158,15 +204,18 @@ push_gimplify_context (struct gimplify_ctx *c)
/* Tear down a context for the gimplifier. If BODY is non-null, then
put the temporaries into the outer BIND_EXPR. Otherwise, put them
- in the local_decls. */
+ in the local_decls.
+
+ BODY is not a sequence, but the first tuple in a sequence. */
void
-pop_gimplify_context (tree body)
+pop_gimplify_context (gimple body)
{
struct gimplify_ctx *c = gimplify_ctxp;
tree t;
- gcc_assert (c && !c->current_bind_expr);
+ gcc_assert (c && (c->bind_expr_stack == NULL
+ || VEC_empty (gimple, c->bind_expr_stack)));
gimplify_ctxp = c->prev_context;
for (t = c->temps; t ; t = TREE_CHAIN (t))
@@ -182,23 +231,31 @@ pop_gimplify_context (tree body)
}
static void
-gimple_push_bind_expr (tree bind)
+gimple_push_bind_expr (gimple gimple_bind)
{
- TREE_CHAIN (bind) = gimplify_ctxp->current_bind_expr;
- gimplify_ctxp->current_bind_expr = bind;
+ if (gimplify_ctxp->bind_expr_stack == NULL)
+ gimplify_ctxp->bind_expr_stack = VEC_alloc (gimple, heap, 8);
+ VEC_safe_push (gimple, heap, gimplify_ctxp->bind_expr_stack, gimple_bind);
}
static void
gimple_pop_bind_expr (void)
{
- gimplify_ctxp->current_bind_expr
- = TREE_CHAIN (gimplify_ctxp->current_bind_expr);
+ VEC_pop (gimple, gimplify_ctxp->bind_expr_stack);
}
-tree
+gimple
gimple_current_bind_expr (void)
{
- return gimplify_ctxp->current_bind_expr;
+ return VEC_last (gimple, gimplify_ctxp->bind_expr_stack);
+}
+
+/* Return the stack GIMPLE_BINDs created during gimplification. */
+
+VEC(gimple, heap) *
+gimple_bind_expr_stack (void)
+{
+ return gimplify_ctxp->bind_expr_stack;
}
/* Returns true iff there is a COND_EXPR between us and the innermost
@@ -215,9 +272,9 @@ gimple_conditional_context (void)
static void
gimple_push_condition (void)
{
-#ifdef ENABLE_CHECKING
+#ifdef ENABLE_GIMPLE_CHECKING
if (gimplify_ctxp->conditions == 0)
- gcc_assert (!gimplify_ctxp->conditional_cleanups);
+ gcc_assert (gimple_seq_empty_p (gimplify_ctxp->conditional_cleanups));
#endif
++(gimplify_ctxp->conditions);
}
@@ -226,15 +283,15 @@ gimple_push_condition (void)
now, add any conditional cleanups we've seen to the prequeue. */
static void
-gimple_pop_condition (tree *pre_p)
+gimple_pop_condition (gimple_seq *pre_p)
{
int conds = --(gimplify_ctxp->conditions);
gcc_assert (conds >= 0);
if (conds == 0)
{
- append_to_statement_list (gimplify_ctxp->conditional_cleanups, pre_p);
- gimplify_ctxp->conditional_cleanups = NULL_TREE;
+ gimplify_seq_add_seq (pre_p, gimplify_ctxp->conditional_cleanups);
+ gimplify_ctxp->conditional_cleanups = NULL;
}
}
@@ -324,13 +381,34 @@ append_to_statement_list_force (tree t, tree *list_p)
append_to_statement_list_1 (t, list_p);
}
-/* Both gimplify the statement T and append it to LIST_P. */
+/* Both gimplify the statement T and append it to *SEQ_P. This function
+ behaves exactly as gimplify_stmt, but you don't have to pass T as a
+ reference. */
void
-gimplify_and_add (tree t, tree *list_p)
+gimplify_and_add (tree t, gimple_seq *seq_p)
+{
+ gimplify_stmt (&t, seq_p);
+}
+
+/* Gimplify statement T into sequence *SEQ_P, and return the first
+ tuple in the sequence of generated tuples for this statement.
+ Return NULL if gimplifying T produced no tuples. */
+
+static gimple
+gimplify_and_return_first (tree t, gimple_seq *seq_p)
{
- gimplify_stmt (&t);
- append_to_statement_list (t, list_p);
+ gimple_stmt_iterator last = gsi_last (*seq_p);
+
+ gimplify_and_add (t, seq_p);
+
+ if (!gsi_end_p (last))
+ {
+ gsi_next (&last);
+ return gsi_stmt (last);
+ }
+ else
+ return gimple_seq_first_stmt (*seq_p);
}
/* Strip off a legitimate source ending from the input string NAME of
@@ -353,20 +431,6 @@ remove_suffix (char *name, int len)
}
}
-/* Create a nameless artificial label and put it in the current function
- context. Returns the newly created label. */
-
-tree
-create_artificial_label (void)
-{
- tree lab = build_decl (LABEL_DECL, NULL_TREE, void_type_node);
-
- DECL_ARTIFICIAL (lab) = 1;
- DECL_IGNORED_P (lab) = 1;
- DECL_CONTEXT (lab) = current_function_decl;
- return lab;
-}
-
/* Subroutine for find_single_pointer_decl. */
static tree
@@ -494,31 +558,6 @@ create_tmp_var (tree type, const char *prefix)
return tmp_var;
}
-/* Given a tree, try to return a useful variable name that we can use
- to prefix a temporary that is being assigned the value of the tree.
- I.E. given <temp> = &A, return A. */
-
-const char *
-get_name (const_tree t)
-{
- const_tree stripped_decl;
-
- stripped_decl = t;
- STRIP_NOPS (stripped_decl);
- if (DECL_P (stripped_decl) && DECL_NAME (stripped_decl))
- return IDENTIFIER_POINTER (DECL_NAME (stripped_decl));
- else
- {
- switch (TREE_CODE (stripped_decl))
- {
- case ADDR_EXPR:
- return get_name (TREE_OPERAND (stripped_decl, 0));
- default:
- return NULL;
- }
- }
-}
-
/* Create a temporary with a name derived from VAL. Subroutine of
lookup_tmp_var; nobody else should call this function. */
@@ -573,6 +612,62 @@ lookup_tmp_var (tree val, bool is_formal)
return ret;
}
+
+/* Return true if T is a CALL_EXPR or an expression that can be
+ assignmed to a temporary. Note that this predicate should only be
+ used during gimplification. See the rationale for this in
+ gimplify_modify_expr. */
+
+static bool
+is_gimple_formal_tmp_or_call_rhs (tree t)
+{
+ return TREE_CODE (t) == CALL_EXPR || is_gimple_formal_tmp_rhs (t);
+}
+
+/* Returns true iff T is a valid RHS for an assignment to a renamed
+ user -- or front-end generated artificial -- variable. */
+
+static bool
+is_gimple_reg_or_call_rhs (tree t)
+{
+ /* If the RHS of the MODIFY_EXPR may throw or make a nonlocal goto
+ and the LHS is a user variable, then we need to introduce a formal
+ temporary. This way the optimizers can determine that the user
+ variable is only modified if evaluation of the RHS does not throw.
+
+ Don't force a temp of a non-renamable type; the copy could be
+ arbitrarily expensive. Instead we will generate a VDEF for
+ the assignment. */
+
+ if (is_gimple_reg_type (TREE_TYPE (t))
+ && ((TREE_CODE (t) == CALL_EXPR && TREE_SIDE_EFFECTS (t))
+ || tree_could_throw_p (t)))
+ return false;
+
+ return is_gimple_formal_tmp_or_call_rhs (t);
+}
+
+/* Return true if T is a valid memory RHS or a CALL_EXPR. Note that
+ this predicate should only be used during gimplification. See the
+ rationale for this in gimplify_modify_expr. */
+
+static bool
+is_gimple_mem_or_call_rhs (tree t)
+{
+ /* If we're dealing with a renamable type, either source or dest must be
+ a renamed variable. Also force a temporary if the type doesn't need
+ to be stored in memory, since it's cheap and prevents erroneous
+ tailcalls (PR 17526). */
+ if (is_gimple_reg_type (TREE_TYPE (t))
+ || (TYPE_MODE (TREE_TYPE (t)) != BLKmode
+ && (TREE_CODE (t) != CALL_EXPR
+ || ! aggregate_value_p (t, t))))
+ return is_gimple_val (t);
+ else
+ return is_gimple_formal_tmp_or_call_rhs (t);
+}
+
+
/* Returns a formal temporary variable initialized with VAL. PRE_P is as
in gimplify_expr. Only use this function if:
@@ -586,11 +681,15 @@ lookup_tmp_var (tree val, bool is_formal)
For other cases, use get_initialized_tmp_var instead. */
static tree
-internal_get_tmp_var (tree val, tree *pre_p, tree *post_p, bool is_formal)
+internal_get_tmp_var (tree val, gimple_seq *pre_p, gimple_seq *post_p,
+ bool is_formal)
{
tree t, mod;
- gimplify_expr (&val, pre_p, post_p, is_gimple_formal_tmp_rhs, fb_rvalue);
+ /* Notice that we explicitly allow VAL to be a CALL_EXPR so that we
+ can create an INIT_EXPR and convert it into a GIMPLE_CALL below. */
+ gimplify_expr (&val, pre_p, post_p, is_gimple_formal_tmp_or_call_rhs,
+ fb_rvalue);
t = lookup_tmp_var (val, is_formal);
@@ -625,21 +724,25 @@ internal_get_tmp_var (tree val, tree *pre_p, tree *post_p, bool is_formal)
/* gimplify_modify_expr might want to reduce this further. */
gimplify_and_add (mod, pre_p);
+ ggc_free (mod);
/* If we're gimplifying into ssa, gimplify_modify_expr will have
- given our temporary an ssa name. Find and return it. */
+ given our temporary an SSA name. Find and return it. */
if (gimplify_ctxp->into_ssa)
- t = TREE_OPERAND (mod, 0);
+ {
+ gimple last = gimple_seq_last_stmt (*pre_p);
+ t = gimple_get_lhs (last);
+ }
return t;
}
/* Returns a formal temporary variable initialized with VAL. PRE_P
- points to a statement list where side-effects needed to compute VAL
- should be stored. */
+ points to a sequence where side-effects needed to compute VAL should be
+ stored. */
tree
-get_formal_tmp_var (tree val, tree *pre_p)
+get_formal_tmp_var (tree val, gimple_seq *pre_p)
{
return internal_get_tmp_var (val, pre_p, NULL, true);
}
@@ -648,7 +751,7 @@ get_formal_tmp_var (tree val, tree *pre_p)
are as in gimplify_expr. */
tree
-get_initialized_tmp_var (tree val, tree *pre_p, tree *post_p)
+get_initialized_tmp_var (tree val, gimple_seq *pre_p, gimple_seq *post_p)
{
return internal_get_tmp_var (val, pre_p, post_p, false);
}
@@ -657,27 +760,23 @@ get_initialized_tmp_var (tree val, tree *pre_p, tree *post_p)
true, generate debug info for them; otherwise don't. */
void
-declare_vars (tree vars, tree scope, bool debug_info)
+declare_vars (tree vars, gimple scope, bool debug_info)
{
tree last = vars;
if (last)
{
tree temps, block;
- /* C99 mode puts the default 'return 0;' for main outside the outer
- braces. So drill down until we find an actual scope. */
- while (TREE_CODE (scope) == COMPOUND_EXPR)
- scope = TREE_OPERAND (scope, 0);
-
- gcc_assert (TREE_CODE (scope) == BIND_EXPR);
+ gcc_assert (gimple_code (scope) == GIMPLE_BIND);
temps = nreverse (last);
- block = BIND_EXPR_BLOCK (scope);
+ block = gimple_block (scope);
+ gcc_assert (!block || TREE_CODE (block) == BLOCK);
if (!block || !debug_info)
{
- TREE_CHAIN (last) = BIND_EXPR_VARS (scope);
- BIND_EXPR_VARS (scope) = temps;
+ TREE_CHAIN (last) = gimple_bind_vars (scope);
+ gimple_bind_set_vars (scope, temps);
}
else
{
@@ -689,7 +788,8 @@ declare_vars (tree vars, tree scope, bool debug_info)
BLOCK_VARS (block) = chainon (BLOCK_VARS (block), temps);
else
{
- BIND_EXPR_VARS (scope) = chainon (BIND_EXPR_VARS (scope), temps);
+ gimple_bind_set_vars (scope,
+ chainon (gimple_bind_vars (scope), temps));
BLOCK_VARS (block) = temps;
}
}
@@ -752,13 +852,34 @@ gimple_add_tmp_var (tree tmp)
else if (cfun)
record_vars (tmp);
else
- declare_vars (tmp, DECL_SAVED_TREE (current_function_decl), false);
+ {
+ gimple_seq body_seq;
+
+ /* This case is for nested functions. We need to expose the locals
+ they create. */
+ body_seq = gimple_body (current_function_decl);
+ declare_vars (tmp, gimple_seq_first_stmt (body_seq), false);
+ }
+}
+
+/* Determines whether to assign a location to the statement GS. */
+
+static bool
+should_carry_location_p (gimple gs)
+{
+ /* Don't emit a line note for a label. We particularly don't want to
+ emit one for the break label, since it doesn't actually correspond
+ to the beginning of the loop/switch. */
+ if (gimple_code (gs) == GIMPLE_LABEL)
+ return false;
+
+ return true;
}
-/* Determines whether to assign a locus to the statement STMT. */
+/* Same, but for a tree. */
static bool
-should_carry_locus_p (const_tree stmt)
+tree_should_carry_location_p (const_tree stmt)
{
/* Don't emit a line note for a label. We particularly don't want to
emit one for the break label, since it doesn't actually correspond
@@ -773,16 +894,87 @@ should_carry_locus_p (const_tree stmt)
return true;
}
+/* Return true if a location should not be emitted for this statement
+ by annotate_one_with_location. */
+
+static inline bool
+gimple_do_not_emit_location_p (gimple g)
+{
+ return gimple_plf (g, GF_PLF_1);
+}
+
+/* Mark statement G so a location will not be emitted by
+ annotate_one_with_location. */
+
+static inline void
+gimple_set_do_not_emit_location (gimple g)
+{
+ /* The PLF flags are initialized to 0 when a new tuple is created,
+ so no need to initialize it anywhere. */
+ gimple_set_plf (g, GF_PLF_1, true);
+}
+
+/* Set the location for gimple statement GS to LOCUS. */
+
+static void
+annotate_one_with_location (gimple gs, location_t location)
+{
+ if (!gimple_has_location (gs)
+ && !gimple_do_not_emit_location_p (gs)
+ && should_carry_location_p (gs))
+ gimple_set_location (gs, location);
+}
+
+/* Same, but for tree T. */
+
static void
-annotate_one_with_locus (tree t, location_t locus)
+tree_annotate_one_with_location (tree t, location_t location)
{
if (CAN_HAVE_LOCATION_P (t)
- && ! EXPR_HAS_LOCATION (t) && should_carry_locus_p (t))
- SET_EXPR_LOCATION (t, locus);
+ && ! EXPR_HAS_LOCATION (t) && tree_should_carry_location_p (t))
+ SET_EXPR_LOCATION (t, location);
+}
+
+
+/* Set LOCATION for all the statements after iterator GSI in sequence
+ SEQ. If GSI is pointing to the end of the sequence, start with the
+ first statement in SEQ. */
+
+static void
+annotate_all_with_location_after (gimple_seq seq, gimple_stmt_iterator gsi,
+ location_t location)
+{
+ if (gsi_end_p (gsi))
+ gsi = gsi_start (seq);
+ else
+ gsi_next (&gsi);
+
+ for (; !gsi_end_p (gsi); gsi_next (&gsi))
+ annotate_one_with_location (gsi_stmt (gsi), location);
+}
+
+
+/* Set the location for all the statements in a sequence STMT_P to LOCUS. */
+
+void
+annotate_all_with_location (gimple_seq stmt_p, location_t location)
+{
+ gimple_stmt_iterator i;
+
+ if (gimple_seq_empty_p (stmt_p))
+ return;
+
+ for (i = gsi_start (stmt_p); !gsi_end_p (i); gsi_next (&i))
+ {
+ gimple gs = gsi_stmt (i);
+ annotate_one_with_location (gs, location);
+ }
}
+/* Same, but for statement or statement list in *STMT_P. */
+
void
-annotate_all_with_locus (tree *stmt_p, location_t locus)
+tree_annotate_all_with_location (tree *stmt_p, location_t location)
{
tree_stmt_iterator i;
@@ -798,10 +990,11 @@ annotate_all_with_locus (tree *stmt_p, location_t locus)
gcc_assert (TREE_CODE (t) != STATEMENT_LIST
&& TREE_CODE (t) != COMPOUND_EXPR);
- annotate_one_with_locus (t, locus);
+ tree_annotate_one_with_location (t, location);
}
}
+
/* Similar to copy_tree_r() but do not copy SAVE_EXPR or TARGET_EXPR nodes.
These nodes model computations that should only be done once. If we
were to unshare something like SAVE_EXPR(i++), the gimplification
@@ -915,15 +1108,6 @@ unvisit_body (tree *body_p, tree fndecl)
unvisit_body (&DECL_SAVED_TREE (cgn->decl), cgn->decl);
}
-/* Unshare T and all the trees reached from T via TREE_CHAIN. */
-
-static void
-unshare_all_trees (tree t)
-{
- walk_tree (&t, copy_if_shared_r, NULL, NULL);
- walk_tree (&t, unmark_visited_r, NULL, NULL);
-}
-
/* Unconditionally make an unshared copy of EXPR. This is used when using
stored expressions which span multiple functions, such as BINFO_VTABLE,
as the normal unsharing process can't tell that they're shared. */
@@ -934,25 +1118,6 @@ unshare_expr (tree expr)
walk_tree (&expr, mostly_copy_tree_r, NULL, NULL);
return expr;
}
-
-/* A terser interface for building a representation of an exception
- specification. */
-
-tree
-gimple_build_eh_filter (tree body, tree allowed, tree failure)
-{
- tree t;
-
- /* FIXME should the allowed types go in TREE_TYPE? */
- t = build2 (EH_FILTER_EXPR, void_type_node, allowed, NULL_TREE);
- append_to_statement_list (failure, &EH_FILTER_FAILURE (t));
-
- t = build2 (TRY_CATCH_EXPR, void_type_node, NULL_TREE, t);
- append_to_statement_list (body, &TREE_OPERAND (t, 0));
-
- return t;
-}
-
/* WRAPPER is a code such as BIND_EXPR or CLEANUP_POINT_EXPR which can both
contain statements and have a value. Assign its value to a temporary
@@ -1019,9 +1184,8 @@ voidify_wrapper_expr (tree wrapper, tree temp)
/* The wrapper is on the RHS of an assignment that we're pushing
down. */
gcc_assert (TREE_CODE (temp) == INIT_EXPR
- || TREE_CODE (temp) == GIMPLE_MODIFY_STMT
|| TREE_CODE (temp) == MODIFY_EXPR);
- GENERIC_TREE_OPERAND (temp, 1) = *p;
+ TREE_OPERAND (temp, 1) = *p;
*p = temp;
}
else
@@ -1040,28 +1204,28 @@ voidify_wrapper_expr (tree wrapper, tree temp)
a temporary through which they communicate. */
static void
-build_stack_save_restore (tree *save, tree *restore)
+build_stack_save_restore (gimple *save, gimple *restore)
{
- tree save_call, tmp_var;
+ tree tmp_var;
- save_call =
- build_call_expr (implicit_built_in_decls[BUILT_IN_STACK_SAVE], 0);
+ *save = gimple_build_call (implicit_built_in_decls[BUILT_IN_STACK_SAVE], 0);
tmp_var = create_tmp_var (ptr_type_node, "saved_stack");
+ gimple_call_set_lhs (*save, tmp_var);
- *save = build_gimple_modify_stmt (tmp_var, save_call);
- *restore =
- build_call_expr (implicit_built_in_decls[BUILT_IN_STACK_RESTORE],
- 1, tmp_var);
+ *restore = gimple_build_call (implicit_built_in_decls[BUILT_IN_STACK_RESTORE],
+ 1, tmp_var);
}
/* Gimplify a BIND_EXPR. Just voidify and recurse. */
static enum gimplify_status
-gimplify_bind_expr (tree *expr_p, tree *pre_p)
+gimplify_bind_expr (tree *expr_p, gimple_seq *pre_p)
{
tree bind_expr = *expr_p;
bool old_save_stack = gimplify_ctxp->save_stack;
tree t;
+ gimple gimple_bind;
+ gimple_seq body;
tree temp = voidify_wrapper_expr (bind_expr, NULL);
@@ -1093,70 +1257,90 @@ gimplify_bind_expr (tree *expr_p, tree *pre_p)
DECL_GIMPLE_REG_P (t) = 1;
}
- gimple_push_bind_expr (bind_expr);
+ gimple_bind = gimple_build_bind (BIND_EXPR_VARS (bind_expr), NULL,
+ BIND_EXPR_BLOCK (bind_expr));
+ gimple_push_bind_expr (gimple_bind);
+
gimplify_ctxp->save_stack = false;
- gimplify_to_stmt_list (&BIND_EXPR_BODY (bind_expr));
+ /* Gimplify the body into the GIMPLE_BIND tuple's body. */
+ body = NULL;
+ gimplify_stmt (&BIND_EXPR_BODY (bind_expr), &body);
+ gimple_bind_set_body (gimple_bind, body);
if (gimplify_ctxp->save_stack)
{
- tree stack_save, stack_restore;
+ gimple stack_save, stack_restore, gs;
+ gimple_seq cleanup, new_body;
/* Save stack on entry and restore it on exit. Add a try_finally
block to achieve this. Note that mudflap depends on the
format of the emitted code: see mx_register_decls(). */
build_stack_save_restore (&stack_save, &stack_restore);
- t = build2 (TRY_FINALLY_EXPR, void_type_node,
- BIND_EXPR_BODY (bind_expr), NULL_TREE);
- append_to_statement_list (stack_restore, &TREE_OPERAND (t, 1));
+ cleanup = new_body = NULL;
+ gimplify_seq_add_stmt (&cleanup, stack_restore);
+ gs = gimple_build_try (gimple_bind_body (gimple_bind), cleanup,
+ GIMPLE_TRY_FINALLY);
- BIND_EXPR_BODY (bind_expr) = NULL_TREE;
- append_to_statement_list (stack_save, &BIND_EXPR_BODY (bind_expr));
- append_to_statement_list (t, &BIND_EXPR_BODY (bind_expr));
+ gimplify_seq_add_stmt (&new_body, stack_save);
+ gimplify_seq_add_stmt (&new_body, gs);
+ gimple_bind_set_body (gimple_bind, new_body);
}
gimplify_ctxp->save_stack = old_save_stack;
gimple_pop_bind_expr ();
+ gimplify_seq_add_stmt (pre_p, gimple_bind);
+
if (temp)
{
*expr_p = temp;
- append_to_statement_list (bind_expr, pre_p);
return GS_OK;
}
- else
- return GS_ALL_DONE;
+
+ *expr_p = NULL_TREE;
+ return GS_ALL_DONE;
}
/* Gimplify a RETURN_EXPR. If the expression to be returned is not a
GIMPLE value, it is assigned to a new temporary and the statement is
re-written to return the temporary.
- PRE_P points to the list where side effects that must happen before
+ PRE_P points to the sequence where side effects that must happen before
STMT should be stored. */
static enum gimplify_status
-gimplify_return_expr (tree stmt, tree *pre_p)
+gimplify_return_expr (tree stmt, gimple_seq *pre_p)
{
+ gimple ret;
tree ret_expr = TREE_OPERAND (stmt, 0);
tree result_decl, result;
- if (!ret_expr || TREE_CODE (ret_expr) == RESULT_DECL
+ if (ret_expr == error_mark_node)
+ return GS_ERROR;
+
+ if (!ret_expr
+ || TREE_CODE (ret_expr) == RESULT_DECL
|| ret_expr == error_mark_node)
- return GS_ALL_DONE;
+ {
+ gimple ret = gimple_build_return (ret_expr);
+ gimple_set_no_warning (ret, TREE_NO_WARNING (stmt));
+ gimplify_seq_add_stmt (pre_p, ret);
+ return GS_ALL_DONE;
+ }
if (VOID_TYPE_P (TREE_TYPE (TREE_TYPE (current_function_decl))))
result_decl = NULL_TREE;
else
{
- result_decl = GENERIC_TREE_OPERAND (ret_expr, 0);
+ result_decl = TREE_OPERAND (ret_expr, 0);
+
+ /* See through a return by reference. */
if (TREE_CODE (result_decl) == INDIRECT_REF)
- /* See through a return by reference. */
result_decl = TREE_OPERAND (result_decl, 0);
gcc_assert ((TREE_CODE (ret_expr) == MODIFY_EXPR
- || TREE_CODE (ret_expr) == GIMPLE_MODIFY_STMT
|| TREE_CODE (ret_expr) == INIT_EXPR)
&& TREE_CODE (result_decl) == RESULT_DECL);
}
@@ -1190,34 +1374,30 @@ gimplify_return_expr (tree stmt, tree *pre_p)
gimplify_ctxp->return_temp = result;
}
- /* Smash the lhs of the GIMPLE_MODIFY_STMT to the temporary we plan to use.
+ /* Smash the lhs of the MODIFY_EXPR to the temporary we plan to use.
Then gimplify the whole thing. */
if (result != result_decl)
- GENERIC_TREE_OPERAND (ret_expr, 0) = result;
+ TREE_OPERAND (ret_expr, 0) = result;
gimplify_and_add (TREE_OPERAND (stmt, 0), pre_p);
- /* If we didn't use a temporary, then the result is just the result_decl.
- Otherwise we need a simple copy. This should already be gimple. */
- if (result == result_decl)
- ret_expr = result;
- else
- ret_expr = build_gimple_modify_stmt (result_decl, result);
- TREE_OPERAND (stmt, 0) = ret_expr;
+ ret = gimple_build_return (result);
+ gimple_set_no_warning (ret, TREE_NO_WARNING (stmt));
+ gimplify_seq_add_stmt (pre_p, ret);
return GS_ALL_DONE;
}
static void
-gimplify_vla_decl (tree decl, tree *stmt_p)
+gimplify_vla_decl (tree decl, gimple_seq *seq_p)
{
/* This is a variable-sized decl. Simplify its size and mark it
for deferred expansion. Note that mudflap depends on the format
of the emitted code: see mx_register_decls(). */
tree t, addr, ptr_type;
- gimplify_one_sizepos (&DECL_SIZE (decl), stmt_p);
- gimplify_one_sizepos (&DECL_SIZE_UNIT (decl), stmt_p);
+ gimplify_one_sizepos (&DECL_SIZE (decl), seq_p);
+ gimplify_one_sizepos (&DECL_SIZE_UNIT (decl), seq_p);
/* All occurrences of this decl in final gimplified code will be
replaced by indirection. Setting DECL_VALUE_EXPR does two
@@ -1234,20 +1414,21 @@ gimplify_vla_decl (tree decl, tree *stmt_p)
t = built_in_decls[BUILT_IN_ALLOCA];
t = build_call_expr (t, 1, DECL_SIZE_UNIT (decl));
t = fold_convert (ptr_type, t);
- t = build_gimple_modify_stmt (addr, t);
+ t = build2 (MODIFY_EXPR, TREE_TYPE (addr), addr, t);
- gimplify_and_add (t, stmt_p);
+ gimplify_and_add (t, seq_p);
/* Indicate that we need to restore the stack level when the
enclosing BIND_EXPR is exited. */
gimplify_ctxp->save_stack = true;
}
+
/* Gimplifies a DECL_EXPR node *STMT_P by making any necessary allocation
and initialization explicit. */
static enum gimplify_status
-gimplify_decl_expr (tree *stmt_p)
+gimplify_decl_expr (tree *stmt_p, gimple_seq *seq_p)
{
tree stmt = *stmt_p;
tree decl = DECL_EXPR_DECL (stmt);
@@ -1260,14 +1441,14 @@ gimplify_decl_expr (tree *stmt_p)
if ((TREE_CODE (decl) == TYPE_DECL
|| TREE_CODE (decl) == VAR_DECL)
&& !TYPE_SIZES_GIMPLIFIED (TREE_TYPE (decl)))
- gimplify_type_sizes (TREE_TYPE (decl), stmt_p);
+ gimplify_type_sizes (TREE_TYPE (decl), seq_p);
if (TREE_CODE (decl) == VAR_DECL && !DECL_EXTERNAL (decl))
{
tree init = DECL_INITIAL (decl);
if (TREE_CODE (DECL_SIZE (decl)) != INTEGER_CST)
- gimplify_vla_decl (decl, stmt_p);
+ gimplify_vla_decl (decl, seq_p);
if (init && init != error_mark_node)
{
@@ -1275,7 +1456,8 @@ gimplify_decl_expr (tree *stmt_p)
{
DECL_INITIAL (decl) = NULL_TREE;
init = build2 (INIT_EXPR, void_type_node, decl, init);
- gimplify_and_add (init, stmt_p);
+ gimplify_and_add (init, seq_p);
+ ggc_free (init);
}
else
/* We must still examine initializers for static variables
@@ -1300,27 +1482,49 @@ gimplify_decl_expr (tree *stmt_p)
EXIT_EXPR, we need to append a label for it to jump to. */
static enum gimplify_status
-gimplify_loop_expr (tree *expr_p, tree *pre_p)
+gimplify_loop_expr (tree *expr_p, gimple_seq *pre_p)
{
tree saved_label = gimplify_ctxp->exit_label;
- tree start_label = build1 (LABEL_EXPR, void_type_node, NULL_TREE);
- tree jump_stmt = build_and_jump (&LABEL_EXPR_LABEL (start_label));
+ tree start_label = create_artificial_label ();
- append_to_statement_list (start_label, pre_p);
+ gimplify_seq_add_stmt (pre_p, gimple_build_label (start_label));
gimplify_ctxp->exit_label = NULL_TREE;
gimplify_and_add (LOOP_EXPR_BODY (*expr_p), pre_p);
+ gimplify_seq_add_stmt (pre_p, gimple_build_goto (start_label));
+
if (gimplify_ctxp->exit_label)
+ gimplify_seq_add_stmt (pre_p, gimple_build_label (gimplify_ctxp->exit_label));
+
+ gimplify_ctxp->exit_label = saved_label;
+
+ *expr_p = NULL;
+ return GS_ALL_DONE;
+}
+
+/* Gimplifies a statement list onto a sequence. These may be created either
+ by an enlightened front-end, or by shortcut_cond_expr. */
+
+static enum gimplify_status
+gimplify_statement_list (tree *expr_p, gimple_seq *pre_p)
+{
+ tree temp = voidify_wrapper_expr (*expr_p, NULL);
+
+ tree_stmt_iterator i = tsi_start (*expr_p);
+
+ while (!tsi_end_p (i))
{
- append_to_statement_list (jump_stmt, pre_p);
- *expr_p = build1 (LABEL_EXPR, void_type_node, gimplify_ctxp->exit_label);
+ gimplify_stmt (tsi_stmt_ptr (i), pre_p);
+ tsi_delink (&i);
}
- else
- *expr_p = jump_stmt;
- gimplify_ctxp->exit_label = saved_label;
+ if (temp)
+ {
+ *expr_p = temp;
+ return GS_OK;
+ }
return GS_ALL_DONE;
}
@@ -1335,70 +1539,63 @@ compare_case_labels (const void *p1, const void *p2)
const_tree const case1 = *(const_tree const*)p1;
const_tree const case2 = *(const_tree const*)p2;
- return tree_int_cst_compare (CASE_LOW (case1), CASE_LOW (case2));
+ /* The 'default' case label always goes first. */
+ if (!CASE_LOW (case1))
+ return -1;
+ else if (!CASE_LOW (case2))
+ return 1;
+ else
+ return tree_int_cst_compare (CASE_LOW (case1), CASE_LOW (case2));
}
+
/* Sort the case labels in LABEL_VEC in place in ascending order. */
void
-sort_case_labels (tree label_vec)
+sort_case_labels (VEC(tree,heap)* label_vec)
{
- size_t len = TREE_VEC_LENGTH (label_vec);
- tree default_case = TREE_VEC_ELT (label_vec, len - 1);
-
- if (CASE_LOW (default_case))
- {
- size_t i;
-
- /* The last label in the vector should be the default case
- but it is not. */
- for (i = 0; i < len; ++i)
- {
- tree t = TREE_VEC_ELT (label_vec, i);
- if (!CASE_LOW (t))
- {
- default_case = t;
- TREE_VEC_ELT (label_vec, i) = TREE_VEC_ELT (label_vec, len - 1);
- TREE_VEC_ELT (label_vec, len - 1) = default_case;
- break;
- }
- }
- }
-
- qsort (&TREE_VEC_ELT (label_vec, 0), len - 1, sizeof (tree),
- compare_case_labels);
+ size_t len = VEC_length (tree, label_vec);
+ qsort (VEC_address (tree, label_vec), len, sizeof (tree),
+ compare_case_labels);
}
+
/* Gimplify a SWITCH_EXPR, and collect a TREE_VEC of the labels it can
branch to. */
static enum gimplify_status
-gimplify_switch_expr (tree *expr_p, tree *pre_p)
+gimplify_switch_expr (tree *expr_p, gimple_seq *pre_p)
{
tree switch_expr = *expr_p;
+ gimple_seq switch_body_seq = NULL;
enum gimplify_status ret;
- ret = gimplify_expr (&SWITCH_COND (switch_expr), pre_p, NULL,
- is_gimple_val, fb_rvalue);
+ ret = gimplify_expr (&SWITCH_COND (switch_expr), pre_p, NULL, is_gimple_val,
+ fb_rvalue);
+ if (ret == GS_ERROR || ret == GS_UNHANDLED)
+ return ret;
if (SWITCH_BODY (switch_expr))
{
- VEC(tree,heap) *labels, *saved_labels;
- tree label_vec, default_case = NULL_TREE;
+ VEC (tree,heap) *labels;
+ VEC (tree,heap) *saved_labels;
+ tree default_case = NULL_TREE;
size_t i, len;
-
+ gimple gimple_switch;
+
/* If someone can be bothered to fill in the labels, they can
be bothered to null out the body too. */
gcc_assert (!SWITCH_LABELS (switch_expr));
+ /* save old labels, get new ones from body, then restore the old
+ labels. Save all the things from the switch body to append after. */
saved_labels = gimplify_ctxp->case_labels;
gimplify_ctxp->case_labels = VEC_alloc (tree, heap, 8);
- gimplify_to_stmt_list (&SWITCH_BODY (switch_expr));
-
+ gimplify_stmt (&SWITCH_BODY (switch_expr), &switch_body_seq);
labels = gimplify_ctxp->case_labels;
gimplify_ctxp->case_labels = saved_labels;
-
+
i = 0;
while (i < VEC_length (tree, labels))
{
@@ -1428,44 +1625,39 @@ gimplify_switch_expr (tree *expr_p, tree *pre_p)
}
len = i;
- label_vec = make_tree_vec (len + 1);
- SWITCH_LABELS (*expr_p) = label_vec;
- append_to_statement_list (switch_expr, pre_p);
-
- if (! default_case)
+ if (!default_case)
{
+ gimple new_default;
+
/* If the switch has no default label, add one, so that we jump
around the switch body. */
default_case = build3 (CASE_LABEL_EXPR, void_type_node, NULL_TREE,
- NULL_TREE, create_artificial_label ());
- append_to_statement_list (SWITCH_BODY (switch_expr), pre_p);
- *expr_p = build1 (LABEL_EXPR, void_type_node,
- CASE_LABEL (default_case));
+ NULL_TREE, create_artificial_label ());
+ new_default = gimple_build_label (CASE_LABEL (default_case));
+ gimplify_seq_add_stmt (&switch_body_seq, new_default);
}
- else
- *expr_p = SWITCH_BODY (switch_expr);
-
- for (i = 0; i < len; ++i)
- TREE_VEC_ELT (label_vec, i) = VEC_index (tree, labels, i);
- TREE_VEC_ELT (label_vec, len) = default_case;
-
- VEC_free (tree, heap, labels);
- sort_case_labels (label_vec);
+ if (!VEC_empty (tree, labels))
+ sort_case_labels (labels);
- SWITCH_BODY (switch_expr) = NULL;
+ gimple_switch = gimple_build_switch_vec (SWITCH_COND (switch_expr),
+ default_case, labels);
+ gimplify_seq_add_stmt (pre_p, gimple_switch);
+ gimplify_seq_add_seq (pre_p, switch_body_seq);
+ VEC_free(tree, heap, labels);
}
else
gcc_assert (SWITCH_LABELS (switch_expr));
- return ret;
+ return GS_ALL_DONE;
}
+
static enum gimplify_status
-gimplify_case_label_expr (tree *expr_p)
+gimplify_case_label_expr (tree *expr_p, gimple_seq *pre_p)
{
- tree expr = *expr_p;
struct gimplify_ctx *ctxp;
+ gimple gimple_label;
/* Invalid OpenMP programs can play Duff's Device type games with
#pragma omp parallel. At least in the C front end, we don't
@@ -1474,8 +1666,10 @@ gimplify_case_label_expr (tree *expr_p)
if (ctxp->case_labels)
break;
- VEC_safe_push (tree, heap, ctxp->case_labels, expr);
- *expr_p = build1 (LABEL_EXPR, void_type_node, CASE_LABEL (expr));
+ gimple_label = gimple_build_label (CASE_LABEL (*expr_p));
+ VEC_safe_push (tree, heap, ctxp->case_labels, *expr_p);
+ gimplify_seq_add_stmt (pre_p, gimple_label);
+
return GS_ALL_DONE;
}
@@ -1648,17 +1842,13 @@ gimplify_conversion (tree *expr_p)
/* Attempt to avoid NOP_EXPR by producing reference to a subtype.
For example this fold (subclass *)&A into &A->subclass avoiding
a need for statement. */
- if (TREE_CODE (*expr_p) == NOP_EXPR
+ if (CONVERT_EXPR_P (*expr_p)
&& POINTER_TYPE_P (TREE_TYPE (*expr_p))
&& POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (*expr_p, 0)))
- && (tem = maybe_fold_offset_to_reference
+ && (tem = maybe_fold_offset_to_address
(TREE_OPERAND (*expr_p, 0),
- integer_zero_node, TREE_TYPE (TREE_TYPE (*expr_p)))))
- {
- tree ptr_type = build_pointer_type (TREE_TYPE (tem));
- if (useless_type_conversion_p (TREE_TYPE (*expr_p), ptr_type))
- *expr_p = build_fold_addr_expr_with_type (tem, ptr_type);
- }
+ integer_zero_node, TREE_TYPE (*expr_p))) != NULL_TREE)
+ *expr_p = tem;
/* If we still have a conversion at the toplevel,
then canonicalize some constructs. */
@@ -1720,7 +1910,7 @@ gimplify_var_or_parm_decl (tree *expr_p)
/* Gimplify the COMPONENT_REF, ARRAY_REF, REALPART_EXPR or IMAGPART_EXPR
- node pointed to by EXPR_P.
+ node *EXPR_P.
compound_lval
: min_lval '[' val ']'
@@ -1735,15 +1925,15 @@ gimplify_var_or_parm_decl (tree *expr_p)
union reference must be explicit, which was not always the case when we
were splitting up array and member refs.
- PRE_P points to the list where side effects that must happen before
+ PRE_P points to the sequence where side effects that must happen before
*EXPR_P should be stored.
- POST_P points to the list where side effects that must happen after
+ POST_P points to the sequence where side effects that must happen after
*EXPR_P should be stored. */
static enum gimplify_status
-gimplify_compound_lval (tree *expr_p, tree *pre_p,
- tree *post_p, fallback_t fallback)
+gimplify_compound_lval (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
+ fallback_t fallback)
{
tree *p;
VEC(tree,heap) *stack;
@@ -1798,14 +1988,15 @@ gimplify_compound_lval (tree *expr_p, tree *pre_p,
/* Gimplify the low bound and element type size and put them into
the ARRAY_REF. If these values are set, they have already been
gimplified. */
- if (!TREE_OPERAND (t, 2))
+ if (TREE_OPERAND (t, 2) == NULL_TREE)
{
tree low = unshare_expr (array_ref_low_bound (t));
if (!is_gimple_min_invariant (low))
{
- TREE_OPERAND (t, 2) = low;
- tret = gimplify_expr (&TREE_OPERAND (t, 2), pre_p, post_p,
- is_gimple_formal_tmp_reg, fb_rvalue);
+ TREE_OPERAND (t, 2) = low;
+ tret = gimplify_expr (&TREE_OPERAND (t, 2), pre_p,
+ post_p, is_gimple_formal_tmp_reg,
+ fb_rvalue);
ret = MIN (ret, tret);
}
}
@@ -1822,9 +2013,10 @@ gimplify_compound_lval (tree *expr_p, tree *pre_p,
if (!is_gimple_min_invariant (elmt_size))
{
- TREE_OPERAND (t, 3) = elmt_size;
- tret = gimplify_expr (&TREE_OPERAND (t, 3), pre_p, post_p,
- is_gimple_formal_tmp_reg, fb_rvalue);
+ TREE_OPERAND (t, 3) = elmt_size;
+ tret = gimplify_expr (&TREE_OPERAND (t, 3), pre_p,
+ post_p, is_gimple_formal_tmp_reg,
+ fb_rvalue);
ret = MIN (ret, tret);
}
}
@@ -1844,9 +2036,10 @@ gimplify_compound_lval (tree *expr_p, tree *pre_p,
if (!is_gimple_min_invariant (offset))
{
- TREE_OPERAND (t, 2) = offset;
- tret = gimplify_expr (&TREE_OPERAND (t, 2), pre_p, post_p,
- is_gimple_formal_tmp_reg, fb_rvalue);
+ TREE_OPERAND (t, 2) = offset;
+ tret = gimplify_expr (&TREE_OPERAND (t, 2), pre_p,
+ post_p, is_gimple_formal_tmp_reg,
+ fb_rvalue);
ret = MIN (ret, tret);
}
}
@@ -1896,15 +2089,13 @@ gimplify_compound_lval (tree *expr_p, tree *pre_p,
STRIP_USELESS_TYPE_CONVERSION (TREE_OPERAND (t, 0));
- /* The innermost expression P may have originally had TREE_SIDE_EFFECTS
- set which would have caused all the outer expressions in EXPR_P
- leading to P to also have had TREE_SIDE_EFFECTS set. */
+ /* The innermost expression P may have originally had
+ TREE_SIDE_EFFECTS set which would have caused all the outer
+ expressions in *EXPR_P leading to P to also have had
+ TREE_SIDE_EFFECTS set. */
recalculate_side_effects (t);
}
- tret = gimplify_expr (p, pre_p, post_p, is_gimple_min_lval, fallback);
- ret = MIN (ret, tret);
-
/* If the outermost expression is a COMPONENT_REF, canonicalize its type. */
if ((fallback & fb_rvalue) && TREE_CODE (*expr_p) == COMPONENT_REF)
{
@@ -1930,11 +2121,12 @@ gimplify_compound_lval (tree *expr_p, tree *pre_p,
in another expression. */
static enum gimplify_status
-gimplify_self_mod_expr (tree *expr_p, tree *pre_p, tree *post_p,
+gimplify_self_mod_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
bool want_value)
{
enum tree_code code;
- tree lhs, lvalue, rhs, t1, post = NULL, *orig_post_p = post_p;
+ tree lhs, lvalue, rhs, t1;
+ gimple_seq post = NULL, *orig_post_p = post_p;
bool postfix;
enum tree_code arith_code;
enum gimplify_status ret;
@@ -1991,22 +2183,22 @@ gimplify_self_mod_expr (tree *expr_p, tree *pre_p, tree *post_p,
}
t1 = build2 (arith_code, TREE_TYPE (*expr_p), lhs, rhs);
- t1 = build_gimple_modify_stmt (lvalue, t1);
if (postfix)
{
- gimplify_and_add (t1, orig_post_p);
- append_to_statement_list (post, orig_post_p);
+ gimplify_assign (lvalue, t1, orig_post_p);
+ gimplify_seq_add_seq (orig_post_p, post);
*expr_p = lhs;
return GS_ALL_DONE;
}
else
{
- *expr_p = t1;
+ *expr_p = build2 (MODIFY_EXPR, TREE_TYPE (lvalue), lvalue, t1);
return GS_OK;
}
}
+
/* If *EXPR_P has a variable sized type, wrap it in a WITH_SIZE_EXPR. */
static void
@@ -2033,10 +2225,12 @@ maybe_with_size_expr (tree *expr_p)
*expr_p = build2 (WITH_SIZE_EXPR, type, expr, size);
}
-/* Subroutine of gimplify_call_expr: Gimplify a single argument. */
+
+/* Helper for gimplify_call_expr. Gimplify a single argument *ARG_P
+ Store any side-effects in PRE_P. */
static enum gimplify_status
-gimplify_arg (tree *expr_p, tree *pre_p)
+gimplify_arg (tree *arg_p, gimple_seq *pre_p)
{
bool (*test) (tree);
fallback_t fb;
@@ -2046,31 +2240,33 @@ gimplify_arg (tree *expr_p, tree *pre_p)
aggregates into temporaries only to copy the temporaries to
the argument list. Make optimizers happy by pulling out to
temporaries those types that fit in registers. */
- if (is_gimple_reg_type (TREE_TYPE (*expr_p)))
+ if (is_gimple_reg_type (TREE_TYPE (*arg_p)))
test = is_gimple_val, fb = fb_rvalue;
else
test = is_gimple_lvalue, fb = fb_either;
/* If this is a variable sized type, we must remember the size. */
- maybe_with_size_expr (expr_p);
+ maybe_with_size_expr (arg_p);
/* There is a sequence point before a function call. Side effects in
the argument list must occur before the actual call. So, when
gimplifying arguments, force gimplify_expr to use an internal
post queue which is then appended to the end of PRE_P. */
- return gimplify_expr (expr_p, pre_p, NULL, test, fb);
+ return gimplify_expr (arg_p, pre_p, NULL, test, fb);
}
-/* Gimplify the CALL_EXPR node pointed to by EXPR_P. PRE_P points to the
- list where side effects that must happen before *EXPR_P should be stored.
+
+/* Gimplify the CALL_EXPR node *EXPR_P into the GIMPLE sequence PRE_P.
WANT_VALUE is true if the result of the call is desired. */
static enum gimplify_status
-gimplify_call_expr (tree *expr_p, tree *pre_p, bool want_value)
+gimplify_call_expr (tree *expr_p, gimple_seq *pre_p, bool want_value)
{
- tree decl, parms, p;
+ tree fndecl, parms, p;
enum gimplify_status ret;
int i, nargs;
+ gimple call;
+ bool builtin_va_start_p = FALSE;
gcc_assert (TREE_CODE (*expr_p) == CALL_EXPR);
@@ -2091,23 +2287,24 @@ gimplify_call_expr (tree *expr_p, tree *pre_p, bool want_value)
we gimplify the CALL_EXPR. At this time we do not manage to
transform all calls in the same manner as the expanders do, but
we do transform most of them. */
- decl = get_callee_fndecl (*expr_p);
- if (decl && DECL_BUILT_IN (decl))
+ fndecl = get_callee_fndecl (*expr_p);
+ if (fndecl && DECL_BUILT_IN (fndecl))
{
- tree new = fold_call_expr (*expr_p, !want_value);
+ tree new_tree = fold_call_expr (*expr_p, !want_value);
- if (new && new != *expr_p)
+ if (new_tree && new_tree != *expr_p)
{
/* There was a transformation of this call which computes the
same value, but in a more efficient way. Return and try
again. */
- *expr_p = new;
+ *expr_p = new_tree;
return GS_OK;
}
- if (DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL
- && DECL_FUNCTION_CODE (decl) == BUILT_IN_VA_START)
+ if (DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL
+ && DECL_FUNCTION_CODE (fndecl) == BUILT_IN_VA_START)
{
+ builtin_va_start_p = TRUE;
if (call_expr_nargs (*expr_p) < 2)
{
error ("too few arguments to function %<va_start%>");
@@ -2120,9 +2317,6 @@ gimplify_call_expr (tree *expr_p, tree *pre_p, bool want_value)
*expr_p = build_empty_stmt ();
return GS_OK;
}
- /* Avoid gimplifying the second argument to va_start, which needs
- to be the plain PARM_DECL. */
- return gimplify_arg (&CALL_EXPR_ARG (*expr_p, 0), pre_p);
}
}
@@ -2135,19 +2329,20 @@ gimplify_call_expr (tree *expr_p, tree *pre_p, bool want_value)
nargs = call_expr_nargs (*expr_p);
/* Get argument types for verification. */
- decl = get_callee_fndecl (*expr_p);
+ fndecl = get_callee_fndecl (*expr_p);
parms = NULL_TREE;
- if (decl)
- parms = TYPE_ARG_TYPES (TREE_TYPE (decl));
+ if (fndecl)
+ parms = TYPE_ARG_TYPES (TREE_TYPE (fndecl));
else if (POINTER_TYPE_P (TREE_TYPE (CALL_EXPR_FN (*expr_p))))
parms = TYPE_ARG_TYPES (TREE_TYPE (TREE_TYPE (CALL_EXPR_FN (*expr_p))));
/* Verify if the type of the argument matches that of the function
declaration. If we cannot verify this or there is a mismatch,
mark the call expression so it doesn't get inlined later. */
- if (decl && DECL_ARGUMENTS (decl))
+ if (fndecl && DECL_ARGUMENTS (fndecl))
{
- for (i = 0, p = DECL_ARGUMENTS (decl); i < nargs;
+ for (i = 0, p = DECL_ARGUMENTS (fndecl);
+ i < nargs;
i++, p = TREE_CHAIN (p))
{
/* We cannot distinguish a varargs function from the case
@@ -2212,50 +2407,63 @@ gimplify_call_expr (tree *expr_p, tree *pre_p, bool want_value)
--nargs;
*expr_p = build_call_array (TREE_TYPE (call), CALL_EXPR_FN (call),
nargs, CALL_EXPR_ARGP (call));
- /* Copy all CALL_EXPR flags, locus and block, except
+
+ /* Copy all CALL_EXPR flags, location and block, except
CALL_EXPR_VA_ARG_PACK flag. */
CALL_EXPR_STATIC_CHAIN (*expr_p) = CALL_EXPR_STATIC_CHAIN (call);
CALL_EXPR_TAILCALL (*expr_p) = CALL_EXPR_TAILCALL (call);
CALL_EXPR_RETURN_SLOT_OPT (*expr_p)
= CALL_EXPR_RETURN_SLOT_OPT (call);
CALL_FROM_THUNK_P (*expr_p) = CALL_FROM_THUNK_P (call);
- CALL_CANNOT_INLINE_P (*expr_p)
- = CALL_CANNOT_INLINE_P (call);
- TREE_NOTHROW (*expr_p) = TREE_NOTHROW (call);
+ CALL_CANNOT_INLINE_P (*expr_p) = CALL_CANNOT_INLINE_P (call);
SET_EXPR_LOCUS (*expr_p, EXPR_LOCUS (call));
TREE_BLOCK (*expr_p) = TREE_BLOCK (call);
+
/* Set CALL_EXPR_VA_ARG_PACK. */
CALL_EXPR_VA_ARG_PACK (*expr_p) = 1;
}
}
/* Finally, gimplify the function arguments. */
- for (i = (PUSH_ARGS_REVERSED ? nargs - 1 : 0);
- PUSH_ARGS_REVERSED ? i >= 0 : i < nargs;
- PUSH_ARGS_REVERSED ? i-- : i++)
+ if (nargs > 0)
{
- enum gimplify_status t;
+ for (i = (PUSH_ARGS_REVERSED ? nargs - 1 : 0);
+ PUSH_ARGS_REVERSED ? i >= 0 : i < nargs;
+ PUSH_ARGS_REVERSED ? i-- : i++)
+ {
+ enum gimplify_status t;
- t = gimplify_arg (&CALL_EXPR_ARG (*expr_p, i), pre_p);
+ /* Avoid gimplifying the second argument to va_start, which needs to
+ be the plain PARM_DECL. */
+ if ((i != 1) || !builtin_va_start_p)
+ {
+ t = gimplify_arg (&CALL_EXPR_ARG (*expr_p, i), pre_p);
- if (t == GS_ERROR)
- ret = GS_ERROR;
+ if (t == GS_ERROR)
+ ret = GS_ERROR;
+ }
+ }
}
/* Try this again in case gimplification exposed something. */
if (ret != GS_ERROR)
{
- tree new = fold_call_expr (*expr_p, !want_value);
+ tree new_tree = fold_call_expr (*expr_p, !want_value);
- if (new && new != *expr_p)
+ if (new_tree && new_tree != *expr_p)
{
/* There was a transformation of this call which computes the
same value, but in a more efficient way. Return and try
again. */
- *expr_p = new;
+ *expr_p = new_tree;
return GS_OK;
}
}
+ else
+ {
+ *expr_p = error_mark_node;
+ return GS_ERROR;
+ }
/* If the function is "const" or "pure", then clear TREE_SIDE_EFFECTS on its
decl. This allows us to eliminate redundant or useless
@@ -2268,6 +2476,24 @@ gimplify_call_expr (tree *expr_p, tree *pre_p, bool want_value)
&& !(flags & (ECF_LOOPING_CONST_OR_PURE)))
TREE_SIDE_EFFECTS (*expr_p) = 0;
}
+
+ /* If the value is not needed by the caller, emit a new GIMPLE_CALL
+ and clear *EXPR_P. Otherwise, leave *EXPR_P in its gimplified
+ form and delegate the creation of a GIMPLE_CALL to
+ gimplify_modify_expr. This is always possible because when
+ WANT_VALUE is true, the caller wants the result of this call into
+ a temporary, which means that we will emit an INIT_EXPR in
+ internal_get_tmp_var which will then be handled by
+ gimplify_modify_expr. */
+ if (!want_value)
+ {
+ /* The CALL_EXPR in *EXPR_P is already in GIMPLE form, so all we
+ have to do is replicate it as a GIMPLE_CALL tuple. */
+ call = gimple_build_call_from_tree (*expr_p);
+ gimplify_seq_add_stmt (pre_p, call);
+ *expr_p = NULL_TREE;
+ }
+
return ret;
}
@@ -2356,6 +2582,10 @@ shortcut_cond_r (tree pred, tree *true_label_p, tree *false_label_p)
return expr;
}
+/* Given a conditional expression EXPR with short-circuit boolean
+ predicates using TRUTH_ANDIF_EXPR or TRUTH_ORIF_EXPR, break the
+ predicate appart into the equivalent sequence of conditionals. */
+
static tree
shortcut_cond_expr (tree expr)
{
@@ -2382,6 +2612,7 @@ shortcut_cond_expr (tree expr)
expr = build3 (COND_EXPR, void_type_node, pred, then_, NULL_TREE);
}
}
+
if (!then_se)
{
/* If there is no 'then', turn
@@ -2550,7 +2781,7 @@ gimple_boolify (tree expr)
its operands. New statements are inserted to PRE_P. */
static enum gimplify_status
-gimplify_pure_cond_expr (tree *expr_p, tree *pre_p)
+gimplify_pure_cond_expr (tree *expr_p, gimple_seq *pre_p)
{
tree expr = *expr_p, cond;
enum gimplify_status ret, tret;
@@ -2565,8 +2796,7 @@ gimplify_pure_cond_expr (tree *expr_p, tree *pre_p)
TREE_SET_CODE (cond, TRUTH_AND_EXPR);
else if (code == TRUTH_ORIF_EXPR)
TREE_SET_CODE (cond, TRUTH_OR_EXPR);
- ret = gimplify_expr (&cond, pre_p, NULL,
- is_gimple_condexpr, fb_rvalue);
+ ret = gimplify_expr (&cond, pre_p, NULL, is_gimple_condexpr, fb_rvalue);
COND_EXPR_COND (*expr_p) = cond;
tret = gimplify_expr (&COND_EXPR_THEN (expr), pre_p, NULL,
@@ -2612,17 +2842,20 @@ generic_expr_could_trap_p (tree expr)
The second form is used when *EXPR_P is of type void.
- TARGET is the tree for T1 above.
-
PRE_P points to the list where side effects that must happen before
*EXPR_P should be stored. */
static enum gimplify_status
-gimplify_cond_expr (tree *expr_p, tree *pre_p, fallback_t fallback)
+gimplify_cond_expr (tree *expr_p, gimple_seq *pre_p, fallback_t fallback)
{
tree expr = *expr_p;
- tree tmp, tmp2, type;
+ tree tmp, type, arm1, arm2;
enum gimplify_status ret;
+ tree label_true, label_false, label_cont;
+ bool have_then_clause_p, have_else_clause_p;
+ gimple gimple_cond;
+ enum tree_code pred_code;
+ gimple_seq seq = NULL;
type = TREE_TYPE (expr);
@@ -2647,7 +2880,7 @@ gimplify_cond_expr (tree *expr_p, tree *pre_p, fallback_t fallback)
&& !generic_expr_could_trap_p (TREE_OPERAND (*expr_p, 2)))
return gimplify_pure_cond_expr (expr_p, pre_p);
- result = tmp2 = tmp = create_tmp_var (TREE_TYPE (expr), "iftmp");
+ result = tmp = create_tmp_var (TREE_TYPE (expr), "iftmp");
ret = GS_ALL_DONE;
}
else
@@ -2662,34 +2895,33 @@ gimplify_cond_expr (tree *expr_p, tree *pre_p, fallback_t fallback)
TREE_OPERAND (expr, 2) =
build_fold_addr_expr (TREE_OPERAND (expr, 2));
- tmp2 = tmp = create_tmp_var (type, "iftmp");
+ tmp = create_tmp_var (type, "iftmp");
expr = build3 (COND_EXPR, void_type_node, TREE_OPERAND (expr, 0),
TREE_OPERAND (expr, 1), TREE_OPERAND (expr, 2));
result = build_fold_indirect_ref (tmp);
- ret = GS_ALL_DONE;
}
/* Build the then clause, 't1 = a;'. But don't build an assignment
if this branch is void; in C++ it can be, if it's a throw. */
if (TREE_TYPE (TREE_OPERAND (expr, 1)) != void_type_node)
TREE_OPERAND (expr, 1)
- = build_gimple_modify_stmt (tmp, TREE_OPERAND (expr, 1));
+ = build2 (MODIFY_EXPR, TREE_TYPE (tmp), tmp, TREE_OPERAND (expr, 1));
/* Build the else clause, 't1 = b;'. */
if (TREE_TYPE (TREE_OPERAND (expr, 2)) != void_type_node)
TREE_OPERAND (expr, 2)
- = build_gimple_modify_stmt (tmp2, TREE_OPERAND (expr, 2));
+ = build2 (MODIFY_EXPR, TREE_TYPE (tmp), tmp, TREE_OPERAND (expr, 2));
TREE_TYPE (expr) = void_type_node;
recalculate_side_effects (expr);
/* Move the COND_EXPR to the prequeue. */
- gimplify_and_add (expr, pre_p);
+ gimplify_stmt (&expr, pre_p);
*expr_p = result;
- return ret;
+ return GS_ALL_DONE;
}
/* Make sure the condition has BOOLEAN_TYPE. */
@@ -2710,45 +2942,131 @@ gimplify_cond_expr (tree *expr_p, tree *pre_p, fallback_t fallback)
wrapped in a TRY_FINALLY_EXPR. To prevent that, we need to
set up a conditional context. */
gimple_push_condition ();
- gimplify_stmt (expr_p);
+ gimplify_stmt (expr_p, &seq);
gimple_pop_condition (pre_p);
+ gimple_seq_add_seq (pre_p, seq);
return GS_ALL_DONE;
}
}
/* Now do the normal gimplification. */
- ret = gimplify_expr (&TREE_OPERAND (expr, 0), pre_p, NULL,
- is_gimple_condexpr, fb_rvalue);
+
+ /* Gimplify condition. */
+ ret = gimplify_expr (&TREE_OPERAND (expr, 0), pre_p, NULL, is_gimple_condexpr,
+ fb_rvalue);
+ if (ret == GS_ERROR)
+ return GS_ERROR;
+ gcc_assert (TREE_OPERAND (expr, 0) != NULL_TREE);
gimple_push_condition ();
- gimplify_to_stmt_list (&TREE_OPERAND (expr, 1));
- gimplify_to_stmt_list (&TREE_OPERAND (expr, 2));
- recalculate_side_effects (expr);
+ have_then_clause_p = have_else_clause_p = false;
+ if (TREE_OPERAND (expr, 1) != NULL
+ && TREE_CODE (TREE_OPERAND (expr, 1)) == GOTO_EXPR
+ && TREE_CODE (GOTO_DESTINATION (TREE_OPERAND (expr, 1))) == LABEL_DECL
+ && (DECL_CONTEXT (GOTO_DESTINATION (TREE_OPERAND (expr, 1)))
+ == current_function_decl)
+ /* For -O0 avoid this optimization if the COND_EXPR and GOTO_EXPR
+ have different locations, otherwise we end up with incorrect
+ location information on the branches. */
+ && (optimize
+ || !EXPR_HAS_LOCATION (expr)
+ || !EXPR_HAS_LOCATION (TREE_OPERAND (expr, 1))
+ || EXPR_LOCATION (expr) == EXPR_LOCATION (TREE_OPERAND (expr, 1))))
+ {
+ label_true = GOTO_DESTINATION (TREE_OPERAND (expr, 1));
+ have_then_clause_p = true;
+ }
+ else
+ label_true = create_artificial_label ();
+ if (TREE_OPERAND (expr, 2) != NULL
+ && TREE_CODE (TREE_OPERAND (expr, 2)) == GOTO_EXPR
+ && TREE_CODE (GOTO_DESTINATION (TREE_OPERAND (expr, 2))) == LABEL_DECL
+ && (DECL_CONTEXT (GOTO_DESTINATION (TREE_OPERAND (expr, 2)))
+ == current_function_decl)
+ /* For -O0 avoid this optimization if the COND_EXPR and GOTO_EXPR
+ have different locations, otherwise we end up with incorrect
+ location information on the branches. */
+ && (optimize
+ || !EXPR_HAS_LOCATION (expr)
+ || !EXPR_HAS_LOCATION (TREE_OPERAND (expr, 2))
+ || EXPR_LOCATION (expr) == EXPR_LOCATION (TREE_OPERAND (expr, 2))))
+ {
+ label_false = GOTO_DESTINATION (TREE_OPERAND (expr, 2));
+ have_else_clause_p = true;
+ }
+ else
+ label_false = create_artificial_label ();
+
+ gimple_cond_get_ops_from_tree (COND_EXPR_COND (expr), &pred_code, &arm1,
+ &arm2);
+
+ gimple_cond = gimple_build_cond (pred_code, arm1, arm2, label_true,
+ label_false);
+
+ gimplify_seq_add_stmt (&seq, gimple_cond);
+ label_cont = NULL_TREE;
+ if (!have_then_clause_p)
+ {
+ /* For if (...) {} else { code; } put label_true after
+ the else block. */
+ if (TREE_OPERAND (expr, 1) == NULL_TREE
+ && !have_else_clause_p
+ && TREE_OPERAND (expr, 2) != NULL_TREE)
+ label_cont = label_true;
+ else
+ {
+ gimplify_seq_add_stmt (&seq, gimple_build_label (label_true));
+ have_then_clause_p = gimplify_stmt (&TREE_OPERAND (expr, 1), &seq);
+ /* For if (...) { code; } else {} or
+ if (...) { code; } else goto label; or
+ if (...) { code; return; } else { ... }
+ label_cont isn't needed. */
+ if (!have_else_clause_p
+ && TREE_OPERAND (expr, 2) != NULL_TREE
+ && gimple_seq_may_fallthru (seq))
+ {
+ gimple g;
+ label_cont = create_artificial_label ();
+
+ g = gimple_build_goto (label_cont);
+
+ /* GIMPLE_COND's are very low level; they have embedded
+ gotos. This particular embedded goto should not be marked
+ with the location of the original COND_EXPR, as it would
+ correspond to the COND_EXPR's condition, not the ELSE or the
+ THEN arms. To avoid marking it with the wrong location, flag
+ it as "no location". */
+ gimple_set_do_not_emit_location (g);
+
+ gimplify_seq_add_stmt (&seq, g);
+ }
+ }
+ }
+ if (!have_else_clause_p)
+ {
+ gimplify_seq_add_stmt (&seq, gimple_build_label (label_false));
+ have_else_clause_p = gimplify_stmt (&TREE_OPERAND (expr, 2), &seq);
+ }
+ if (label_cont)
+ gimplify_seq_add_stmt (&seq, gimple_build_label (label_cont));
gimple_pop_condition (pre_p);
+ gimple_seq_add_seq (pre_p, seq);
if (ret == GS_ERROR)
- ;
- else if (TREE_SIDE_EFFECTS (TREE_OPERAND (expr, 1)))
+ ; /* Do nothing. */
+ else if (have_then_clause_p || have_else_clause_p)
ret = GS_ALL_DONE;
- else if (TREE_SIDE_EFFECTS (TREE_OPERAND (expr, 2)))
- /* Rewrite "if (a); else b" to "if (!a) b" */
+ else
{
- TREE_OPERAND (expr, 0) = invert_truthvalue (TREE_OPERAND (expr, 0));
- ret = gimplify_expr (&TREE_OPERAND (expr, 0), pre_p, NULL,
- is_gimple_condexpr, fb_rvalue);
-
- tmp = TREE_OPERAND (expr, 1);
- TREE_OPERAND (expr, 1) = TREE_OPERAND (expr, 2);
- TREE_OPERAND (expr, 2) = tmp;
+ /* Both arms are empty; replace the COND_EXPR with its predicate. */
+ expr = TREE_OPERAND (expr, 0);
+ gimplify_stmt (&expr, pre_p);
}
- else
- /* Both arms are empty; replace the COND_EXPR with its predicate. */
- expr = TREE_OPERAND (expr, 0);
- *expr_p = expr;
+ *expr_p = NULL;
return ret;
}
@@ -2756,27 +3074,39 @@ gimplify_cond_expr (tree *expr_p, tree *pre_p, fallback_t fallback)
a call to __builtin_memcpy. */
static enum gimplify_status
-gimplify_modify_expr_to_memcpy (tree *expr_p, tree size, bool want_value)
+gimplify_modify_expr_to_memcpy (tree *expr_p, tree size, bool want_value,
+ gimple_seq *seq_p)
{
tree t, to, to_ptr, from, from_ptr;
+ gimple gs;
- to = GENERIC_TREE_OPERAND (*expr_p, 0);
- from = GENERIC_TREE_OPERAND (*expr_p, 1);
+ to = TREE_OPERAND (*expr_p, 0);
+ from = TREE_OPERAND (*expr_p, 1);
from_ptr = build_fold_addr_expr (from);
+ gimplify_arg (&from_ptr, seq_p);
to_ptr = build_fold_addr_expr (to);
+ gimplify_arg (&to_ptr, seq_p);
+
t = implicit_built_in_decls[BUILT_IN_MEMCPY];
- t = build_call_expr (t, 3, to_ptr, from_ptr, size);
+
+ gs = gimple_build_call (t, 3, to_ptr, from_ptr, size);
if (want_value)
{
- t = build1 (NOP_EXPR, TREE_TYPE (to_ptr), t);
- t = build1 (INDIRECT_REF, TREE_TYPE (to), t);
+ /* tmp = memcpy() */
+ t = create_tmp_var (TREE_TYPE (to_ptr), NULL);
+ gimple_call_set_lhs (gs, t);
+ gimplify_seq_add_stmt (seq_p, gs);
+
+ *expr_p = build1 (INDIRECT_REF, TREE_TYPE (to), t);
+ return GS_ALL_DONE;
}
- *expr_p = t;
- return GS_OK;
+ gimplify_seq_add_stmt (seq_p, gs);
+ *expr_p = NULL;
+ return GS_ALL_DONE;
}
/* A subroutine of gimplify_modify_expr. Replace a MODIFY_EXPR with
@@ -2784,14 +3114,16 @@ gimplify_modify_expr_to_memcpy (tree *expr_p, tree size, bool want_value)
a CONSTRUCTOR with an empty element list. */
static enum gimplify_status
-gimplify_modify_expr_to_memset (tree *expr_p, tree size, bool want_value)
+gimplify_modify_expr_to_memset (tree *expr_p, tree size, bool want_value,
+ gimple_seq *seq_p)
{
tree t, from, to, to_ptr;
+ gimple gs;
/* Assert our assumptions, to abort instead of producing wrong code
silently if they are not met. Beware that the RHS CONSTRUCTOR might
not be immediately exposed. */
- from = GENERIC_TREE_OPERAND (*expr_p, 1);
+ from = TREE_OPERAND (*expr_p, 1);
if (TREE_CODE (from) == WITH_SIZE_EXPR)
from = TREE_OPERAND (from, 0);
@@ -2799,20 +3131,28 @@ gimplify_modify_expr_to_memset (tree *expr_p, tree size, bool want_value)
&& VEC_empty (constructor_elt, CONSTRUCTOR_ELTS (from)));
/* Now proceed. */
- to = GENERIC_TREE_OPERAND (*expr_p, 0);
+ to = TREE_OPERAND (*expr_p, 0);
to_ptr = build_fold_addr_expr (to);
+ gimplify_arg (&to_ptr, seq_p);
t = implicit_built_in_decls[BUILT_IN_MEMSET];
- t = build_call_expr (t, 3, to_ptr, integer_zero_node, size);
+
+ gs = gimple_build_call (t, 3, to_ptr, integer_zero_node, size);
if (want_value)
{
- t = build1 (NOP_EXPR, TREE_TYPE (to_ptr), t);
- t = build1 (INDIRECT_REF, TREE_TYPE (to), t);
+ /* tmp = memset() */
+ t = create_tmp_var (TREE_TYPE (to_ptr), NULL);
+ gimple_call_set_lhs (gs, t);
+ gimplify_seq_add_stmt (seq_p, gs);
+
+ *expr_p = build1 (INDIRECT_REF, TREE_TYPE (to), t);
+ return GS_ALL_DONE;
}
- *expr_p = t;
- return GS_OK;
+ gimplify_seq_add_stmt (seq_p, gs);
+ *expr_p = NULL;
+ return GS_ALL_DONE;
}
/* A subroutine of gimplify_init_ctor_preeval. Called via walk_tree,
@@ -2868,12 +3208,12 @@ gimplify_init_ctor_preeval_1 (tree *tp, int *walk_subtrees, void *xdata)
return NULL;
}
-/* A subroutine of gimplify_init_constructor. Pre-evaluate *EXPR_P,
+/* A subroutine of gimplify_init_constructor. Pre-evaluate EXPR,
force values that overlap with the lhs (as described by *DATA)
into temporaries. */
static void
-gimplify_init_ctor_preeval (tree *expr_p, tree *pre_p, tree *post_p,
+gimplify_init_ctor_preeval (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
struct gimplify_init_ctor_preeval_data *data)
{
enum gimplify_status one;
@@ -2900,6 +3240,7 @@ gimplify_init_ctor_preeval (tree *expr_p, tree *pre_p, tree *post_p,
for (ix = 0; VEC_iterate (constructor_elt, v, ix, ce); ix++)
gimplify_init_ctor_preeval (&ce->value, pre_p, post_p, data);
+
return;
}
@@ -2907,7 +3248,7 @@ gimplify_init_ctor_preeval (tree *expr_p, tree *pre_p, tree *post_p,
maybe_with_size_expr (expr_p);
/* Gimplify the constructor element to something appropriate for the rhs
- of a MODIFY_EXPR. Given that we know the lhs is an aggregate, we know
+ of a MODIFY_EXPR. Given that we know the LHS is an aggregate, we know
the gimplifier will consider this a store to memory. Doing this
gimplification now means that we won't have to deal with complicated
language-specific trees, nor trees like SAVE_EXPR that can induce
@@ -2958,29 +3299,27 @@ gimplify_init_ctor_preeval (tree *expr_p, tree *pre_p, tree *post_p,
already been taken care of for us, in gimplify_init_ctor_preeval(). */
static void gimplify_init_ctor_eval (tree, VEC(constructor_elt,gc) *,
- tree *, bool);
+ gimple_seq *, bool);
static void
gimplify_init_ctor_eval_range (tree object, tree lower, tree upper,
tree value, tree array_elt_type,
- tree *pre_p, bool cleared)
+ gimple_seq *pre_p, bool cleared)
{
- tree loop_entry_label, loop_exit_label;
+ tree loop_entry_label, loop_exit_label, fall_thru_label;
tree var, var_type, cref, tmp;
loop_entry_label = create_artificial_label ();
loop_exit_label = create_artificial_label ();
+ fall_thru_label = create_artificial_label ();
/* Create and initialize the index variable. */
var_type = TREE_TYPE (upper);
var = create_tmp_var (var_type, NULL);
- append_to_statement_list (build_gimple_modify_stmt (var, lower), pre_p);
+ gimplify_seq_add_stmt (pre_p, gimple_build_assign (var, lower));
/* Add the loop entry label. */
- append_to_statement_list (build1 (LABEL_EXPR,
- void_type_node,
- loop_entry_label),
- pre_p);
+ gimplify_seq_add_stmt (pre_p, gimple_build_label (loop_entry_label));
/* Build the reference. */
cref = build4 (ARRAY_REF, array_elt_type, unshare_expr (object),
@@ -2995,34 +3334,25 @@ gimplify_init_ctor_eval_range (tree object, tree lower, tree upper,
gimplify_init_ctor_eval (cref, CONSTRUCTOR_ELTS (value),
pre_p, cleared);
else
- append_to_statement_list (build_gimple_modify_stmt (cref, value), pre_p);
+ gimplify_seq_add_stmt (pre_p, gimple_build_assign (cref, value));
/* We exit the loop when the index var is equal to the upper bound. */
- gimplify_and_add (build3 (COND_EXPR, void_type_node,
- build2 (EQ_EXPR, boolean_type_node,
- var, upper),
- build1 (GOTO_EXPR,
- void_type_node,
- loop_exit_label),
- NULL_TREE),
- pre_p);
+ gimplify_seq_add_stmt (pre_p,
+ gimple_build_cond (EQ_EXPR, var, upper,
+ loop_exit_label, fall_thru_label));
+
+ gimplify_seq_add_stmt (pre_p, gimple_build_label (fall_thru_label));
/* Otherwise, increment the index var... */
tmp = build2 (PLUS_EXPR, var_type, var,
fold_convert (var_type, integer_one_node));
- append_to_statement_list (build_gimple_modify_stmt (var, tmp), pre_p);
+ gimplify_seq_add_stmt (pre_p, gimple_build_assign (var, tmp));
/* ...and jump back to the loop entry. */
- append_to_statement_list (build1 (GOTO_EXPR,
- void_type_node,
- loop_entry_label),
- pre_p);
+ gimplify_seq_add_stmt (pre_p, gimple_build_goto (loop_entry_label));
/* Add the loop exit label. */
- append_to_statement_list (build1 (LABEL_EXPR,
- void_type_node,
- loop_exit_label),
- pre_p);
+ gimplify_seq_add_stmt (pre_p, gimple_build_label (loop_exit_label));
}
/* Return true if FDECL is accessing a field that is zero sized. */
@@ -3055,7 +3385,7 @@ zero_sized_type (const_tree type)
static void
gimplify_init_ctor_eval (tree object, VEC(constructor_elt,gc) *elts,
- tree *pre_p, bool cleared)
+ gimple_seq *pre_p, bool cleared)
{
tree array_elt_type = NULL;
unsigned HOST_WIDE_INT ix;
@@ -3066,7 +3396,7 @@ gimplify_init_ctor_eval (tree object, VEC(constructor_elt,gc) *elts,
FOR_EACH_CONSTRUCTOR_ELT (elts, ix, purpose, value)
{
- tree cref, init;
+ tree cref;
/* NULL values are created above for gimplification errors. */
if (value == NULL)
@@ -3128,12 +3458,28 @@ gimplify_init_ctor_eval (tree object, VEC(constructor_elt,gc) *elts,
pre_p, cleared);
else
{
- init = build2 (INIT_EXPR, TREE_TYPE (cref), cref, value);
+ tree init = build2 (INIT_EXPR, TREE_TYPE (cref), cref, value);
gimplify_and_add (init, pre_p);
+ ggc_free (init);
}
}
}
+
+/* Returns the appropriate RHS predicate for this LHS. */
+
+gimple_predicate
+rhs_predicate_for (tree lhs)
+{
+ if (is_gimple_formal_tmp_var (lhs))
+ return is_gimple_formal_tmp_or_call_rhs;
+ else if (is_gimple_reg (lhs))
+ return is_gimple_reg_or_call_rhs;
+ else
+ return is_gimple_mem_or_call_rhs;
+}
+
+
/* A subroutine of gimplify_modify_expr. Break out elements of a
CONSTRUCTOR used as an initializer into separate MODIFY_EXPRs.
@@ -3148,12 +3494,11 @@ gimplify_init_ctor_eval (tree object, VEC(constructor_elt,gc) *elts,
If NOTIFY_TEMP_CREATION is false, just do the gimplification. */
static enum gimplify_status
-gimplify_init_constructor (tree *expr_p, tree *pre_p,
- tree *post_p, bool want_value,
- bool notify_temp_creation)
+gimplify_init_constructor (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
+ bool want_value, bool notify_temp_creation)
{
tree object;
- tree ctor = GENERIC_TREE_OPERAND (*expr_p, 1);
+ tree ctor = TREE_OPERAND (*expr_p, 1);
tree type = TREE_TYPE (ctor);
enum gimplify_status ret;
VEC(constructor_elt,gc) *elts;
@@ -3163,16 +3508,16 @@ gimplify_init_constructor (tree *expr_p, tree *pre_p,
if (!notify_temp_creation)
{
- ret = gimplify_expr (&GENERIC_TREE_OPERAND (*expr_p, 0), pre_p, post_p,
+ ret = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p, post_p,
is_gimple_lvalue, fb_lvalue);
if (ret == GS_ERROR)
return ret;
}
- object = GENERIC_TREE_OPERAND (*expr_p, 0);
+ object = TREE_OPERAND (*expr_p, 0);
elts = CONSTRUCTOR_ELTS (ctor);
-
ret = GS_ALL_DONE;
+
switch (TREE_CODE (type))
{
case RECORD_TYPE:
@@ -3194,7 +3539,7 @@ gimplify_init_constructor (tree *expr_p, tree *pre_p,
return GS_OK;
break;
}
-
+
/* Fetch information about the constructor to direct later processing.
We might want to make static versions of it in various cases, and
can only do so if it known to be a valid constant initializer. */
@@ -3287,25 +3632,25 @@ gimplify_init_constructor (tree *expr_p, tree *pre_p,
if (size > 0 && !can_move_by_pieces (size, align))
{
- tree new;
+ tree new_tree;
if (notify_temp_creation)
return GS_ERROR;
- new = create_tmp_var_raw (type, "C");
+ new_tree = create_tmp_var_raw (type, "C");
- gimple_add_tmp_var (new);
- TREE_STATIC (new) = 1;
- TREE_READONLY (new) = 1;
- DECL_INITIAL (new) = ctor;
- if (align > DECL_ALIGN (new))
+ gimple_add_tmp_var (new_tree);
+ TREE_STATIC (new_tree) = 1;
+ TREE_READONLY (new_tree) = 1;
+ DECL_INITIAL (new_tree) = ctor;
+ if (align > DECL_ALIGN (new_tree))
{
- DECL_ALIGN (new) = align;
- DECL_USER_ALIGN (new) = 1;
+ DECL_ALIGN (new_tree) = align;
+ DECL_USER_ALIGN (new_tree) = 1;
}
- walk_tree (&DECL_INITIAL (new), force_labels_r, NULL, NULL);
+ walk_tree (&DECL_INITIAL (new_tree), force_labels_r, NULL, NULL);
- GENERIC_TREE_OPERAND (*expr_p, 1) = new;
+ TREE_OPERAND (*expr_p, 1) = new_tree;
/* This is no longer an assignment of a CONSTRUCTOR, but
we still may have processing to do on the LHS. So
@@ -3327,7 +3672,7 @@ gimplify_init_constructor (tree *expr_p, tree *pre_p,
preeval_data.lhs_base_decl = NULL;
preeval_data.lhs_alias_set = get_alias_set (object);
- gimplify_init_ctor_preeval (&GENERIC_TREE_OPERAND (*expr_p, 1),
+ gimplify_init_ctor_preeval (&TREE_OPERAND (*expr_p, 1),
pre_p, post_p, &preeval_data);
}
@@ -3337,9 +3682,9 @@ gimplify_init_constructor (tree *expr_p, tree *pre_p,
Note that we still have to gimplify, in order to handle the
case of variable sized types. Avoid shared tree structures. */
CONSTRUCTOR_ELTS (ctor) = NULL;
+ TREE_SIDE_EFFECTS (ctor) = 0;
object = unshare_expr (object);
- gimplify_stmt (expr_p);
- append_to_statement_list (*expr_p, pre_p);
+ gimplify_stmt (expr_p, pre_p);
}
/* If we have not block cleared the object, or if there are nonzero
@@ -3383,7 +3728,9 @@ gimplify_init_constructor (tree *expr_p, tree *pre_p,
{
ctor = build2 (COMPLEX_EXPR, type, r, i);
TREE_OPERAND (*expr_p, 1) = ctor;
- ret = gimplify_expr (&TREE_OPERAND (*expr_p, 1), pre_p, post_p,
+ ret = gimplify_expr (&TREE_OPERAND (*expr_p, 1),
+ pre_p,
+ post_p,
rhs_predicate_for (TREE_OPERAND (*expr_p, 0)),
fb_rvalue);
}
@@ -3435,13 +3782,13 @@ gimplify_init_constructor (tree *expr_p, tree *pre_p,
for (ix = 0; VEC_iterate (constructor_elt, elts, ix, ce); ix++)
{
enum gimplify_status tret;
- tret = gimplify_expr (&ce->value, pre_p, post_p,
- is_gimple_val, fb_rvalue);
+ tret = gimplify_expr (&ce->value, pre_p, post_p, is_gimple_val,
+ fb_rvalue);
if (tret == GS_ERROR)
ret = GS_ERROR;
}
- if (!is_gimple_reg (GENERIC_TREE_OPERAND (*expr_p, 0)))
- GENERIC_TREE_OPERAND (*expr_p, 1) = get_formal_tmp_var (ctor, pre_p);
+ if (!is_gimple_reg (TREE_OPERAND (*expr_p, 0)))
+ TREE_OPERAND (*expr_p, 1) = get_formal_tmp_var (ctor, pre_p);
}
break;
@@ -3454,12 +3801,24 @@ gimplify_init_constructor (tree *expr_p, tree *pre_p,
return GS_ERROR;
else if (want_value)
{
- append_to_statement_list (*expr_p, pre_p);
*expr_p = object;
return GS_OK;
}
else
- return GS_ALL_DONE;
+ {
+ /* If we have gimplified both sides of the initializer but have
+ not emitted an assignment, do so now. */
+ if (*expr_p)
+ {
+ tree lhs = TREE_OPERAND (*expr_p, 0);
+ tree rhs = TREE_OPERAND (*expr_p, 1);
+ gimple init = gimple_build_assign (lhs, rhs);
+ gimplify_seq_add_stmt (pre_p, init);
+ *expr_p = NULL;
+ }
+
+ return GS_ALL_DONE;
+ }
}
/* Given a pointer value OP0, return a simplified version of an
@@ -3537,8 +3896,9 @@ gimple_fold_indirect_ref_rhs (tree t)
something changes. */
static enum gimplify_status
-gimplify_modify_expr_rhs (tree *expr_p, tree *from_p, tree *to_p, tree *pre_p,
- tree *post_p, bool want_value)
+gimplify_modify_expr_rhs (tree *expr_p, tree *from_p, tree *to_p,
+ gimple_seq *pre_p, gimple_seq *post_p,
+ bool want_value)
{
enum gimplify_status ret = GS_OK;
@@ -3549,7 +3909,7 @@ gimplify_modify_expr_rhs (tree *expr_p, tree *from_p, tree *to_p, tree *pre_p,
/* If we're assigning from a constant constructor, move the
constructor expression to the RHS of the MODIFY_EXPR. */
if (DECL_INITIAL (*from_p)
- && TYPE_READONLY (TREE_TYPE (*from_p))
+ && TREE_READONLY (*from_p)
&& !TREE_THIS_VOLATILE (*from_p)
&& TREE_CODE (DECL_INITIAL (*from_p)) == CONSTRUCTOR)
{
@@ -3735,8 +4095,8 @@ gimplify_modify_expr_rhs (tree *expr_p, tree *from_p, tree *to_p, tree *pre_p,
tree wrap = *from_p;
tree t;
- ret = gimplify_expr (to_p, pre_p, post_p,
- is_gimple_min_lval, fb_lvalue);
+ ret = gimplify_expr (to_p, pre_p, post_p, is_gimple_min_lval,
+ fb_lvalue);
if (ret != GS_ERROR)
ret = GS_OK;
@@ -3761,51 +4121,6 @@ gimplify_modify_expr_rhs (tree *expr_p, tree *from_p, tree *to_p, tree *pre_p,
return ret;
}
-/* Destructively convert the TREE pointer in TP into a gimple tuple if
- appropriate. */
-
-static void
-tree_to_gimple_tuple (tree *tp)
-{
-
- switch (TREE_CODE (*tp))
- {
- case GIMPLE_MODIFY_STMT:
- return;
- case MODIFY_EXPR:
- {
- struct gimple_stmt *gs;
- tree lhs = TREE_OPERAND (*tp, 0);
- bool def_stmt_self_p = false;
-
- if (TREE_CODE (lhs) == SSA_NAME)
- {
- if (SSA_NAME_DEF_STMT (lhs) == *tp)
- def_stmt_self_p = true;
- }
-
- gs = &make_node (GIMPLE_MODIFY_STMT)->gstmt;
- gs->base = (*tp)->base;
- /* The set to base above overwrites the CODE. */
- TREE_SET_CODE ((tree) gs, GIMPLE_MODIFY_STMT);
-
- SET_EXPR_LOCUS ((tree) gs, EXPR_LOCUS (*tp));
- gs->operands[0] = TREE_OPERAND (*tp, 0);
- gs->operands[1] = TREE_OPERAND (*tp, 1);
- gs->block = TREE_BLOCK (*tp);
- *tp = (tree)gs;
-
- /* If we re-gimplify a set to an SSA_NAME, we must change the
- SSA name's DEF_STMT link. */
- if (def_stmt_self_p)
- SSA_NAME_DEF_STMT (GIMPLE_STMT_OPERAND (*tp, 0)) = *tp;
-
- return;
- }
- default:
- break;
- }
-}
/* Promote partial stores to COMPLEX variables to total stores. *EXPR_P is
a MODIFY_EXPR with a lhs of a REAL/IMAGPART_EXPR of a variable with
@@ -3820,13 +4135,14 @@ tree_to_gimple_tuple (tree *tp)
followed by a DCE pass are necessary in order to fix things up. */
static enum gimplify_status
-gimplify_modify_expr_complex_part (tree *expr_p, tree *pre_p, bool want_value)
+gimplify_modify_expr_complex_part (tree *expr_p, gimple_seq *pre_p,
+ bool want_value)
{
enum tree_code code, ocode;
tree lhs, rhs, new_rhs, other, realpart, imagpart;
- lhs = GENERIC_TREE_OPERAND (*expr_p, 0);
- rhs = GENERIC_TREE_OPERAND (*expr_p, 1);
+ lhs = TREE_OPERAND (*expr_p, 0);
+ rhs = TREE_OPERAND (*expr_p, 1);
code = TREE_CODE (lhs);
lhs = TREE_OPERAND (lhs, 0);
@@ -3842,20 +4158,13 @@ gimplify_modify_expr_complex_part (tree *expr_p, tree *pre_p, bool want_value)
else
new_rhs = build2 (COMPLEX_EXPR, TREE_TYPE (lhs), realpart, imagpart);
- GENERIC_TREE_OPERAND (*expr_p, 0) = lhs;
- GENERIC_TREE_OPERAND (*expr_p, 1) = new_rhs;
-
- if (want_value)
- {
- tree_to_gimple_tuple (expr_p);
-
- append_to_statement_list (*expr_p, pre_p);
- *expr_p = rhs;
- }
+ gimplify_seq_add_stmt (pre_p, gimple_build_assign (lhs, new_rhs));
+ *expr_p = (want_value) ? rhs : NULL_TREE;
return GS_ALL_DONE;
}
+
/* Gimplify the MODIFY_EXPR node pointed to by EXPR_P.
modify_expr
@@ -3872,14 +4181,15 @@ gimplify_modify_expr_complex_part (tree *expr_p, tree *pre_p, bool want_value)
in another expression. */
static enum gimplify_status
-gimplify_modify_expr (tree *expr_p, tree *pre_p, tree *post_p, bool want_value)
+gimplify_modify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
+ bool want_value)
{
- tree *from_p = &GENERIC_TREE_OPERAND (*expr_p, 1);
- tree *to_p = &GENERIC_TREE_OPERAND (*expr_p, 0);
+ tree *from_p = &TREE_OPERAND (*expr_p, 1);
+ tree *to_p = &TREE_OPERAND (*expr_p, 0);
enum gimplify_status ret = GS_UNHANDLED;
+ gimple assign;
gcc_assert (TREE_CODE (*expr_p) == MODIFY_EXPR
- || TREE_CODE (*expr_p) == GIMPLE_MODIFY_STMT
|| TREE_CODE (*expr_p) == INIT_EXPR);
/* Insert pointer conversions required by the middle-end that are not
@@ -3903,12 +4213,10 @@ gimplify_modify_expr (tree *expr_p, tree *pre_p, tree *post_p, bool want_value)
side as statements and throw away the assignment. Do this after
gimplify_modify_expr_rhs so we handle TARGET_EXPRs of addressable
types properly. */
- if (zero_sized_type (TREE_TYPE (*from_p)))
+ if (zero_sized_type (TREE_TYPE (*from_p)) && !want_value)
{
- gimplify_stmt (from_p);
- gimplify_stmt (to_p);
- append_to_statement_list (*from_p, pre_p);
- append_to_statement_list (*to_p, pre_p);
+ gimplify_stmt (from_p, pre_p);
+ gimplify_stmt (to_p, pre_p);
*expr_p = NULL_TREE;
return GS_ALL_DONE;
}
@@ -3918,15 +4226,27 @@ gimplify_modify_expr (tree *expr_p, tree *pre_p, tree *post_p, bool want_value)
before gimplifying any of the operands so that we can resolve any
PLACEHOLDER_EXPRs in the size. Also note that the RTL expander uses
the size of the expression to be copied, not of the destination, so
- that is what we must here. */
+ that is what we must do here. */
maybe_with_size_expr (from_p);
ret = gimplify_expr (to_p, pre_p, post_p, is_gimple_lvalue, fb_lvalue);
if (ret == GS_ERROR)
return ret;
- ret = gimplify_expr (from_p, pre_p, post_p,
- rhs_predicate_for (*to_p), fb_rvalue);
+ /* As a special case, we have to temporarily allow for assignments
+ with a CALL_EXPR on the RHS. Since in GIMPLE a function call is
+ a toplevel statement, when gimplifying the GENERIC expression
+ MODIFY_EXPR <a, CALL_EXPR <foo>>, we cannot create the tuple
+ GIMPLE_ASSIGN <a, GIMPLE_CALL <foo>>.
+
+ Instead, we need to create the tuple GIMPLE_CALL <a, foo>. To
+ prevent gimplify_expr from trying to create a new temporary for
+ foo's LHS, we tell it that it should only gimplify until it
+ reaches the CALL_EXPR. On return from gimplify_expr, the newly
+ created GIMPLE_CALL <foo> will be the last statement in *PRE_P
+ and all we need to do here is set 'a' to be its LHS. */
+ ret = gimplify_expr (from_p, pre_p, post_p, rhs_predicate_for (*to_p),
+ fb_rvalue);
if (ret == GS_ERROR)
return ret;
@@ -3945,11 +4265,13 @@ gimplify_modify_expr (tree *expr_p, tree *pre_p, tree *post_p, bool want_value)
tree size = TREE_OPERAND (*from_p, 1);
if (TREE_CODE (from) == CONSTRUCTOR)
- return gimplify_modify_expr_to_memset (expr_p, size, want_value);
+ return gimplify_modify_expr_to_memset (expr_p, size, want_value, pre_p);
+
if (is_gimple_addressable (from))
{
*from_p = from;
- return gimplify_modify_expr_to_memcpy (expr_p, size, want_value);
+ return gimplify_modify_expr_to_memcpy (expr_p, size, want_value,
+ pre_p);
}
}
@@ -3961,35 +4283,49 @@ gimplify_modify_expr (tree *expr_p, tree *pre_p, tree *post_p, bool want_value)
&& is_gimple_reg (TREE_OPERAND (*to_p, 0)))
return gimplify_modify_expr_complex_part (expr_p, pre_p, want_value);
- if (gimplify_ctxp->into_ssa && is_gimple_reg (*to_p))
- {
- /* If we've somehow already got an SSA_NAME on the LHS, then
- we're probably modified it twice. Not good. */
- gcc_assert (TREE_CODE (*to_p) != SSA_NAME);
- *to_p = make_ssa_name (*to_p, *expr_p);
- }
-
/* Try to alleviate the effects of the gimplification creating artificial
temporaries (see for example is_gimple_reg_rhs) on the debug info. */
if (!gimplify_ctxp->into_ssa
- && DECL_P (*from_p) && DECL_IGNORED_P (*from_p)
- && DECL_P (*to_p) && !DECL_IGNORED_P (*to_p))
+ && DECL_P (*from_p)
+ && DECL_IGNORED_P (*from_p)
+ && DECL_P (*to_p)
+ && !DECL_IGNORED_P (*to_p))
{
if (!DECL_NAME (*from_p) && DECL_NAME (*to_p))
DECL_NAME (*from_p)
= create_tmp_var_name (IDENTIFIER_POINTER (DECL_NAME (*to_p)));
DECL_DEBUG_EXPR_IS_FROM (*from_p) = 1;
SET_DECL_DEBUG_EXPR (*from_p, *to_p);
+ }
+
+ if (TREE_CODE (*from_p) == CALL_EXPR)
+ {
+ /* Since the RHS is a CALL_EXPR, we need to create a GIMPLE_CALL
+ instead of a GIMPLE_ASSIGN. */
+ assign = gimple_build_call_from_tree (*from_p);
+ gimple_call_set_lhs (assign, *to_p);
}
+ else
+ assign = gimple_build_assign (*to_p, *from_p);
- if (want_value)
+ gimplify_seq_add_stmt (pre_p, assign);
+
+ if (gimplify_ctxp->into_ssa && is_gimple_reg (*to_p))
{
- tree_to_gimple_tuple (expr_p);
+ /* If we've somehow already got an SSA_NAME on the LHS, then
+ we've probably modified it twice. Not good. */
+ gcc_assert (TREE_CODE (*to_p) != SSA_NAME);
+ *to_p = make_ssa_name (*to_p, assign);
+ gimple_set_lhs (assign, *to_p);
+ }
- append_to_statement_list (*expr_p, pre_p);
- *expr_p = *to_p;
+ if (want_value)
+ {
+ *expr_p = unshare_expr (*to_p);
return GS_OK;
}
+ else
+ *expr_p = NULL;
return GS_ALL_DONE;
}
@@ -4071,12 +4407,9 @@ gimplify_boolean_expr (tree *expr_p)
expressions in the sequence will be emitted.
WANT_VALUE is true when the result of the last COMPOUND_EXPR is used. */
-/* ??? Should rearrange to share the pre-queue with all the indirect
- invocations of gimplify_expr. Would probably save on creations
- of statement_list nodes. */
static enum gimplify_status
-gimplify_compound_expr (tree *expr_p, tree *pre_p, bool want_value)
+gimplify_compound_expr (tree *expr_p, gimple_seq *pre_p, bool want_value)
{
tree t = *expr_p;
@@ -4087,8 +4420,7 @@ gimplify_compound_expr (tree *expr_p, tree *pre_p, bool want_value)
if (TREE_CODE (*sub_p) == COMPOUND_EXPR)
gimplify_compound_expr (sub_p, pre_p, false);
else
- gimplify_stmt (sub_p);
- append_to_statement_list (*sub_p, pre_p);
+ gimplify_stmt (sub_p, pre_p);
t = TREE_OPERAND (t, 1);
}
@@ -4099,58 +4431,21 @@ gimplify_compound_expr (tree *expr_p, tree *pre_p, bool want_value)
return GS_OK;
else
{
- gimplify_stmt (expr_p);
+ gimplify_stmt (expr_p, pre_p);
return GS_ALL_DONE;
}
}
-/* Gimplifies a statement list. These may be created either by an
- enlightened front-end, or by shortcut_cond_expr. */
-
-static enum gimplify_status
-gimplify_statement_list (tree *expr_p, tree *pre_p)
-{
- tree temp = voidify_wrapper_expr (*expr_p, NULL);
-
- tree_stmt_iterator i = tsi_start (*expr_p);
-
- while (!tsi_end_p (i))
- {
- tree t;
-
- gimplify_stmt (tsi_stmt_ptr (i));
-
- t = tsi_stmt (i);
- if (t == NULL)
- tsi_delink (&i);
- else if (TREE_CODE (t) == STATEMENT_LIST)
- {
- tsi_link_before (&i, t, TSI_SAME_STMT);
- tsi_delink (&i);
- }
- else
- tsi_next (&i);
- }
-
- if (temp)
- {
- append_to_statement_list (*expr_p, pre_p);
- *expr_p = temp;
- return GS_OK;
- }
-
- return GS_ALL_DONE;
-}
-/* Gimplify a SAVE_EXPR node. EXPR_P points to the expression to
- gimplify. After gimplification, EXPR_P will point to a new temporary
- that holds the original value of the SAVE_EXPR node.
+/* Gimplify a SAVE_EXPR node. EXPR_P points to the expression to
+ gimplify. After gimplification, EXPR_P will point to a new temporary
+ that holds the original value of the SAVE_EXPR node.
- PRE_P points to the list where side effects that must happen before
- *EXPR_P should be stored. */
+ PRE_P points to the list where side effects that must happen before
+ *EXPR_P should be stored. */
static enum gimplify_status
-gimplify_save_expr (tree *expr_p, tree *pre_p, tree *post_p)
+gimplify_save_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
{
enum gimplify_status ret = GS_ALL_DONE;
tree val;
@@ -4168,7 +4463,6 @@ gimplify_save_expr (tree *expr_p, tree *pre_p, tree *post_p)
{
ret = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p, post_p,
is_gimple_stmt, fb_none);
- append_to_statement_list (TREE_OPERAND (*expr_p, 0), pre_p);
val = NULL;
}
else
@@ -4197,7 +4491,7 @@ gimplify_save_expr (tree *expr_p, tree *pre_p, tree *post_p)
*EXPR_P should be stored. */
static enum gimplify_status
-gimplify_addr_expr (tree *expr_p, tree *pre_p, tree *post_p)
+gimplify_addr_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
{
tree expr = *expr_p;
tree op0 = TREE_OPERAND (expr, 0);
@@ -4280,24 +4574,39 @@ gimplify_addr_expr (tree *expr_p, tree *pre_p, tree *post_p)
value; output operands should be a gimple lvalue. */
static enum gimplify_status
-gimplify_asm_expr (tree *expr_p, tree *pre_p, tree *post_p)
+gimplify_asm_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
{
- tree expr = *expr_p;
- int noutputs = list_length (ASM_OUTPUTS (expr));
- const char **oconstraints
- = (const char **) alloca ((noutputs) * sizeof (const char *));
+ tree expr;
+ int noutputs;
+ const char **oconstraints;
int i;
tree link;
const char *constraint;
bool allows_mem, allows_reg, is_inout;
enum gimplify_status ret, tret;
+ gimple stmt;
+ VEC(tree, gc) *inputs;
+ VEC(tree, gc) *outputs;
+ VEC(tree, gc) *clobbers;
+ tree link_next;
+
+ expr = *expr_p;
+ noutputs = list_length (ASM_OUTPUTS (expr));
+ oconstraints = (const char **) alloca ((noutputs) * sizeof (const char *));
+
+ inputs = outputs = clobbers = NULL;
ret = GS_ALL_DONE;
- for (i = 0, link = ASM_OUTPUTS (expr); link; ++i, link = TREE_CHAIN (link))
+ link_next = NULL_TREE;
+ for (i = 0, link = ASM_OUTPUTS (expr); link; ++i, link = link_next)
{
- size_t constraint_len;
bool ok;
- oconstraints[i] = constraint
+ size_t constraint_len;
+
+ link_next = TREE_CHAIN (link);
+
+ oconstraints[i]
+ = constraint
= TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (link)));
constraint_len = strlen (constraint);
if (constraint_len == 0)
@@ -4323,6 +4632,9 @@ gimplify_asm_expr (tree *expr_p, tree *pre_p, tree *post_p)
ret = tret;
}
+ VEC_safe_push (tree, gc, outputs, link);
+ TREE_CHAIN (link) = NULL_TREE;
+
if (is_inout)
{
/* An input/output operand. To give the optimizers more
@@ -4416,10 +4728,11 @@ gimplify_asm_expr (tree *expr_p, tree *pre_p, tree *post_p)
}
}
- for (link = ASM_INPUTS (expr); link; ++i, link = TREE_CHAIN (link))
+ link_next = NULL_TREE;
+ for (link = ASM_INPUTS (expr); link; ++i, link = link_next)
{
- constraint
- = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (link)));
+ link_next = TREE_CHAIN (link);
+ constraint = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (link)));
parse_input_constraint (&constraint, 0, 0, noutputs, 0,
oconstraints, &allows_mem, &allows_reg);
@@ -4455,13 +4768,27 @@ gimplify_asm_expr (tree *expr_p, tree *pre_p, tree *post_p)
if (tret == GS_ERROR)
ret = tret;
}
+
+ TREE_CHAIN (link) = NULL_TREE;
+ VEC_safe_push (tree, gc, inputs, link);
}
+
+ for (link = ASM_CLOBBERS (expr); link; ++i, link = TREE_CHAIN (link))
+ VEC_safe_push (tree, gc, clobbers, link);
+
+ stmt = gimple_build_asm_vec (TREE_STRING_POINTER (ASM_STRING (expr)),
+ inputs, outputs, clobbers);
+
+ gimple_asm_set_volatile (stmt, ASM_VOLATILE_P (expr));
+ gimple_asm_set_input (stmt, ASM_INPUT_P (expr));
+
+ gimplify_seq_add_stmt (pre_p, stmt);
return ret;
}
/* Gimplify a CLEANUP_POINT_EXPR. Currently this works by adding
- WITH_CLEANUP_EXPRs to the prequeue as we encounter cleanups while
+ GIMPLE_WITH_CLEANUP_EXPRs to the prequeue as we encounter cleanups while
gimplifying the body, and converting them to TRY_FINALLY_EXPRs when we
return to this function.
@@ -4475,10 +4802,10 @@ gimplify_asm_expr (tree *expr_p, tree *pre_p, tree *post_p)
Thing. */
static enum gimplify_status
-gimplify_cleanup_point_expr (tree *expr_p, tree *pre_p)
+gimplify_cleanup_point_expr (tree *expr_p, gimple_seq *pre_p)
{
- tree_stmt_iterator iter;
- tree body;
+ gimple_stmt_iterator iter;
+ gimple_seq body_sequence = NULL;
tree temp = voidify_wrapper_expr (*expr_p, NULL);
@@ -4486,74 +4813,79 @@ gimplify_cleanup_point_expr (tree *expr_p, tree *pre_p)
CLEANUP_POINT_EXPR and the cleanup. So save and reset the count and
any cleanups collected outside the CLEANUP_POINT_EXPR. */
int old_conds = gimplify_ctxp->conditions;
- tree old_cleanups = gimplify_ctxp->conditional_cleanups;
+ gimple_seq old_cleanups = gimplify_ctxp->conditional_cleanups;
gimplify_ctxp->conditions = 0;
- gimplify_ctxp->conditional_cleanups = NULL_TREE;
+ gimplify_ctxp->conditional_cleanups = NULL;
- body = TREE_OPERAND (*expr_p, 0);
- gimplify_to_stmt_list (&body);
+ gimplify_stmt (&TREE_OPERAND (*expr_p, 0), &body_sequence);
gimplify_ctxp->conditions = old_conds;
gimplify_ctxp->conditional_cleanups = old_cleanups;
- for (iter = tsi_start (body); !tsi_end_p (iter); )
+ for (iter = gsi_start (body_sequence); !gsi_end_p (iter); )
{
- tree *wce_p = tsi_stmt_ptr (iter);
- tree wce = *wce_p;
+ gimple wce = gsi_stmt (iter);
- if (TREE_CODE (wce) == WITH_CLEANUP_EXPR)
+ if (gimple_code (wce) == GIMPLE_WITH_CLEANUP_EXPR)
{
- if (tsi_one_before_end_p (iter))
+ if (gsi_one_before_end_p (iter))
{
- tsi_link_before (&iter, TREE_OPERAND (wce, 0), TSI_SAME_STMT);
- tsi_delink (&iter);
+ /* Note that gsi_insert_seq_before and gsi_remove do not
+ scan operands, unlike some other sequence mutators. */
+ gsi_insert_seq_before_without_update (&iter,
+ gimple_wce_cleanup (wce),
+ GSI_SAME_STMT);
+ gsi_remove (&iter, true);
break;
}
else
{
- tree sl, tfe;
- enum tree_code code;
+ gimple gtry;
+ gimple_seq seq;
+ enum gimple_try_flags kind;
- if (CLEANUP_EH_ONLY (wce))
- code = TRY_CATCH_EXPR;
+ if (gimple_wce_cleanup_eh_only (wce))
+ kind = GIMPLE_TRY_CATCH;
else
- code = TRY_FINALLY_EXPR;
-
- sl = tsi_split_statement_list_after (&iter);
- tfe = build2 (code, void_type_node, sl, NULL_TREE);
- append_to_statement_list (TREE_OPERAND (wce, 0),
- &TREE_OPERAND (tfe, 1));
- *wce_p = tfe;
- iter = tsi_start (sl);
+ kind = GIMPLE_TRY_FINALLY;
+ seq = gsi_split_seq_after (iter);
+
+ gtry = gimple_build_try (seq, gimple_wce_cleanup (wce), kind);
+ /* Do not use gsi_replace here, as it may scan operands.
+ We want to do a simple structural modification only. */
+ *gsi_stmt_ptr (&iter) = gtry;
+ iter = gsi_start (seq);
}
}
else
- tsi_next (&iter);
+ gsi_next (&iter);
}
+ gimplify_seq_add_seq (pre_p, body_sequence);
if (temp)
{
*expr_p = temp;
- append_to_statement_list (body, pre_p);
return GS_OK;
}
else
{
- *expr_p = body;
+ *expr_p = NULL;
return GS_ALL_DONE;
}
}
/* Insert a cleanup marker for gimplify_cleanup_point_expr. CLEANUP
- is the cleanup action required. */
+ is the cleanup action required. EH_ONLY is true if the cleanup should
+ only be executed if an exception is thrown, not on normal exit. */
static void
-gimple_push_cleanup (tree var, tree cleanup, bool eh_only, tree *pre_p)
+gimple_push_cleanup (tree var, tree cleanup, bool eh_only, gimple_seq *pre_p)
{
- tree wce;
+ gimple wce;
+ gimple_seq cleanup_stmts = NULL;
/* Errors can result in improperly nested cleanups. Which results in
- confusion when trying to resolve the WITH_CLEANUP_EXPR. */
+ confusion when trying to resolve the GIMPLE_WITH_CLEANUP_EXPR. */
if (errorcount || sorrycount)
return;
@@ -4579,15 +4911,17 @@ gimple_push_cleanup (tree var, tree cleanup, bool eh_only, tree *pre_p)
}
val
*/
-
tree flag = create_tmp_var (boolean_type_node, "cleanup");
- tree ffalse = build_gimple_modify_stmt (flag, boolean_false_node);
- tree ftrue = build_gimple_modify_stmt (flag, boolean_true_node);
+ gimple ffalse = gimple_build_assign (flag, boolean_false_node);
+ gimple ftrue = gimple_build_assign (flag, boolean_true_node);
+
cleanup = build3 (COND_EXPR, void_type_node, flag, cleanup, NULL);
- wce = build1 (WITH_CLEANUP_EXPR, void_type_node, cleanup);
- append_to_statement_list (ffalse, &gimplify_ctxp->conditional_cleanups);
- append_to_statement_list (wce, &gimplify_ctxp->conditional_cleanups);
- append_to_statement_list (ftrue, pre_p);
+ gimplify_stmt (&cleanup, &cleanup_stmts);
+ wce = gimple_build_wce (cleanup_stmts);
+
+ gimplify_seq_add_stmt (&gimplify_ctxp->conditional_cleanups, ffalse);
+ gimplify_seq_add_stmt (&gimplify_ctxp->conditional_cleanups, wce);
+ gimplify_seq_add_stmt (pre_p, ftrue);
/* Because of this manipulation, and the EH edges that jump
threading cannot redirect, the temporary (VAR) will appear
@@ -4596,18 +4930,17 @@ gimple_push_cleanup (tree var, tree cleanup, bool eh_only, tree *pre_p)
}
else
{
- wce = build1 (WITH_CLEANUP_EXPR, void_type_node, cleanup);
- CLEANUP_EH_ONLY (wce) = eh_only;
- append_to_statement_list (wce, pre_p);
+ gimplify_stmt (&cleanup, &cleanup_stmts);
+ wce = gimple_build_wce (cleanup_stmts);
+ gimple_wce_set_cleanup_eh_only (wce, eh_only);
+ gimplify_seq_add_stmt (pre_p, wce);
}
-
- gimplify_stmt (&TREE_OPERAND (wce, 0));
}
/* Gimplify a TARGET_EXPR which doesn't appear on the rhs of an INIT_EXPR. */
static enum gimplify_status
-gimplify_target_expr (tree *expr_p, tree *pre_p, tree *post_p)
+gimplify_target_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
{
tree targ = *expr_p;
tree temp = TARGET_EXPR_SLOT (targ);
@@ -4633,9 +4966,11 @@ gimplify_target_expr (tree *expr_p, tree *pre_p, tree *post_p)
ret = gimplify_expr (&init, pre_p, post_p, is_gimple_stmt, fb_none);
else
{
- init = build2 (INIT_EXPR, void_type_node, temp, init);
- ret = gimplify_expr (&init, pre_p, post_p, is_gimple_stmt,
- fb_none);
+ tree init_expr = build2 (INIT_EXPR, void_type_node, temp, init);
+ init = init_expr;
+ ret = gimplify_expr (&init, pre_p, post_p, is_gimple_stmt, fb_none);
+ init = NULL;
+ ggc_free (init_expr);
}
if (ret == GS_ERROR)
{
@@ -4643,15 +4978,13 @@ gimplify_target_expr (tree *expr_p, tree *pre_p, tree *post_p)
TARGET_EXPR_INITIAL (targ) = NULL_TREE;
return GS_ERROR;
}
- append_to_statement_list (init, pre_p);
+ if (init)
+ gimplify_and_add (init, pre_p);
/* If needed, push the cleanup for the temp. */
if (TARGET_EXPR_CLEANUP (targ))
- {
- gimplify_stmt (&TARGET_EXPR_CLEANUP (targ));
- gimple_push_cleanup (temp, TARGET_EXPR_CLEANUP (targ),
- CLEANUP_EH_ONLY (targ), pre_p);
- }
+ gimple_push_cleanup (temp, TARGET_EXPR_CLEANUP (targ),
+ CLEANUP_EH_ONLY (targ), pre_p);
/* Only expand this once. */
TREE_OPERAND (targ, 3) = init;
@@ -4667,29 +5000,23 @@ gimplify_target_expr (tree *expr_p, tree *pre_p, tree *post_p)
/* Gimplification of expression trees. */
-/* Gimplify an expression which appears at statement context; usually, this
- means replacing it with a suitably gimple STATEMENT_LIST. */
+/* Gimplify an expression which appears at statement context. The
+ corresponding GIMPLE statements are added to *SEQ_P. If *SEQ_P is
+ NULL, a new sequence is allocated.
-void
-gimplify_stmt (tree *stmt_p)
+ Return true if we actually added a statement to the queue. */
+
+bool
+gimplify_stmt (tree *stmt_p, gimple_seq *seq_p)
{
- gimplify_expr (stmt_p, NULL, NULL, is_gimple_stmt, fb_none);
-}
+ gimple_seq_node last;
-/* Similarly, but force the result to be a STATEMENT_LIST. */
+ if (!*seq_p)
+ *seq_p = gimple_seq_alloc ();
-void
-gimplify_to_stmt_list (tree *stmt_p)
-{
- gimplify_stmt (stmt_p);
- if (!*stmt_p)
- *stmt_p = alloc_stmt_list ();
- else if (TREE_CODE (*stmt_p) != STATEMENT_LIST)
- {
- tree t = *stmt_p;
- *stmt_p = alloc_stmt_list ();
- append_to_statement_list (t, stmt_p);
- }
+ last = gimple_seq_last (*seq_p);
+ gimplify_expr (stmt_p, seq_p, NULL, is_gimple_stmt, fb_none);
+ return last != gimple_seq_last (*seq_p);
}
@@ -5078,7 +5405,7 @@ omp_check_private (struct gimplify_omp_ctx *ctx, tree decl)
and previous omp contexts. */
static void
-gimplify_scan_omp_clauses (tree *list_p, tree *pre_p,
+gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p,
enum omp_region_type region_type)
{
struct gimplify_omp_ctx *ctx, *outer_ctx;
@@ -5090,7 +5417,6 @@ gimplify_scan_omp_clauses (tree *list_p, tree *pre_p,
while ((c = *list_p) != NULL)
{
- enum gimplify_status gs;
bool remove = false;
bool notice_outer = true;
const char *check_non_private = NULL;
@@ -5140,11 +5466,22 @@ gimplify_scan_omp_clauses (tree *list_p, tree *pre_p,
GOVD_LOCAL | GOVD_SEEN);
gimplify_omp_ctxp = ctx;
push_gimplify_context (&gctx);
- gimplify_stmt (&OMP_CLAUSE_REDUCTION_INIT (c));
- pop_gimplify_context (OMP_CLAUSE_REDUCTION_INIT (c));
+
+ OMP_CLAUSE_REDUCTION_GIMPLE_INIT (c) = gimple_seq_alloc ();
+ OMP_CLAUSE_REDUCTION_GIMPLE_MERGE (c) = gimple_seq_alloc ();
+
+ gimplify_and_add (OMP_CLAUSE_REDUCTION_INIT (c),
+ &OMP_CLAUSE_REDUCTION_GIMPLE_INIT (c));
+ pop_gimplify_context
+ (gimple_seq_first_stmt (OMP_CLAUSE_REDUCTION_GIMPLE_INIT (c)));
push_gimplify_context (&gctx);
- gimplify_stmt (&OMP_CLAUSE_REDUCTION_MERGE (c));
- pop_gimplify_context (OMP_CLAUSE_REDUCTION_MERGE (c));
+ gimplify_and_add (OMP_CLAUSE_REDUCTION_MERGE (c),
+ &OMP_CLAUSE_REDUCTION_GIMPLE_MERGE (c));
+ pop_gimplify_context
+ (gimple_seq_first_stmt (OMP_CLAUSE_REDUCTION_GIMPLE_MERGE (c)));
+ OMP_CLAUSE_REDUCTION_INIT (c) = NULL_TREE;
+ OMP_CLAUSE_REDUCTION_MERGE (c) = NULL_TREE;
+
gimplify_omp_ctxp = outer_ctx;
}
else if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_LASTPRIVATE
@@ -5160,8 +5497,12 @@ gimplify_scan_omp_clauses (tree *list_p, tree *pre_p,
BIND_EXPR_BODY (bind) = OMP_CLAUSE_LASTPRIVATE_STMT (c);
OMP_CLAUSE_LASTPRIVATE_STMT (c) = bind;
}
- gimplify_stmt (&OMP_CLAUSE_LASTPRIVATE_STMT (c));
- pop_gimplify_context (OMP_CLAUSE_LASTPRIVATE_STMT (c));
+ gimplify_and_add (OMP_CLAUSE_LASTPRIVATE_STMT (c),
+ &OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (c));
+ pop_gimplify_context
+ (gimple_seq_first_stmt (OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (c)));
+ OMP_CLAUSE_LASTPRIVATE_STMT (c) = NULL_TREE;
+
gimplify_omp_ctxp = outer_ctx;
}
if (notice_outer)
@@ -5196,10 +5537,9 @@ gimplify_scan_omp_clauses (tree *list_p, tree *pre_p,
case OMP_CLAUSE_SCHEDULE:
case OMP_CLAUSE_NUM_THREADS:
- gs = gimplify_expr (&OMP_CLAUSE_OPERAND (c, 0), pre_p, NULL,
- is_gimple_val, fb_rvalue);
- if (gs == GS_ERROR)
- remove = true;
+ if (gimplify_expr (&OMP_CLAUSE_OPERAND (c, 0), pre_p, NULL,
+ is_gimple_val, fb_rvalue) == GS_ERROR)
+ remove = true;
break;
case OMP_CLAUSE_NOWAIT:
@@ -5370,10 +5710,12 @@ gimplify_adjust_omp_clauses (tree *list_p)
variables. We need to do this scan now, because variable-sized
decls will be decomposed during gimplification. */
-static enum gimplify_status
-gimplify_omp_parallel (tree *expr_p, tree *pre_p)
+static void
+gimplify_omp_parallel (tree *expr_p, gimple_seq *pre_p)
{
tree expr = *expr_p;
+ gimple g;
+ gimple_seq body = NULL;
struct gimplify_ctx gctx;
gimplify_scan_omp_clauses (&OMP_PARALLEL_CLAUSES (expr), pre_p,
@@ -5383,16 +5725,21 @@ gimplify_omp_parallel (tree *expr_p, tree *pre_p)
push_gimplify_context (&gctx);
- gimplify_stmt (&OMP_PARALLEL_BODY (expr));
-
- if (TREE_CODE (OMP_PARALLEL_BODY (expr)) == BIND_EXPR)
- pop_gimplify_context (OMP_PARALLEL_BODY (expr));
+ g = gimplify_and_return_first (OMP_PARALLEL_BODY (expr), &body);
+ if (gimple_code (g) == GIMPLE_BIND)
+ pop_gimplify_context (g);
else
- pop_gimplify_context (NULL_TREE);
+ pop_gimplify_context (NULL);
gimplify_adjust_omp_clauses (&OMP_PARALLEL_CLAUSES (expr));
- return GS_ALL_DONE;
+ g = gimple_build_omp_parallel (body,
+ OMP_PARALLEL_CLAUSES (expr),
+ NULL_TREE, NULL_TREE);
+ if (OMP_PARALLEL_COMBINED (expr))
+ gimple_omp_set_subcode (g, GF_OMP_PARALLEL_COMBINED);
+ gimplify_seq_add_stmt (pre_p, g);
+ *expr_p = NULL_TREE;
}
/* Gimplify the contents of an OMP_TASK statement. This involves
@@ -5400,36 +5747,43 @@ gimplify_omp_parallel (tree *expr_p, tree *pre_p)
variables. We need to do this scan now, because variable-sized
decls will be decomposed during gimplification. */
-static enum gimplify_status
-gimplify_omp_task (tree *expr_p, tree *pre_p)
+static void
+gimplify_omp_task (tree *expr_p, gimple_seq *pre_p)
{
tree expr = *expr_p;
+ gimple g;
+ gimple_seq body = NULL;
struct gimplify_ctx gctx;
gimplify_scan_omp_clauses (&OMP_TASK_CLAUSES (expr), pre_p, ORT_TASK);
push_gimplify_context (&gctx);
- gimplify_stmt (&OMP_TASK_BODY (expr));
-
- if (TREE_CODE (OMP_TASK_BODY (expr)) == BIND_EXPR)
- pop_gimplify_context (OMP_TASK_BODY (expr));
+ g = gimplify_and_return_first (OMP_TASK_BODY (expr), &body);
+ if (gimple_code (g) == GIMPLE_BIND)
+ pop_gimplify_context (g);
else
- pop_gimplify_context (NULL_TREE);
+ pop_gimplify_context (NULL);
gimplify_adjust_omp_clauses (&OMP_TASK_CLAUSES (expr));
- return GS_ALL_DONE;
+ g = gimple_build_omp_task (body,
+ OMP_TASK_CLAUSES (expr),
+ NULL_TREE, NULL_TREE,
+ NULL_TREE, NULL_TREE, NULL_TREE);
+ gimplify_seq_add_stmt (pre_p, g);
+ *expr_p = NULL_TREE;
}
/* Gimplify the gross structure of an OMP_FOR statement. */
static enum gimplify_status
-gimplify_omp_for (tree *expr_p, tree *pre_p)
+gimplify_omp_for (tree *expr_p, gimple_seq *pre_p)
{
- tree for_stmt, decl, var, t, bodylist;
+ tree for_stmt, decl, var, t;
enum gimplify_status ret = GS_OK;
- tree body, init_decl = NULL_TREE;
+ gimple gfor;
+ gimple_seq for_body, for_pre_body;
int i;
for_stmt = *expr_p;
@@ -5437,12 +5791,12 @@ gimplify_omp_for (tree *expr_p, tree *pre_p)
gimplify_scan_omp_clauses (&OMP_FOR_CLAUSES (for_stmt), pre_p,
ORT_WORKSHARE);
- /* If OMP_FOR is re-gimplified, ensure all variables in pre-body
- are noticed. */
- gimplify_stmt (&OMP_FOR_PRE_BODY (for_stmt));
-
- bodylist = alloc_stmt_list ();
+ /* Handle OMP_FOR_INIT. */
+ for_pre_body = NULL;
+ gimplify_and_add (OMP_FOR_PRE_BODY (for_stmt), &for_pre_body);
+ OMP_FOR_PRE_BODY (for_stmt) = NULL_TREE;
+ for_body = gimple_seq_alloc ();
gcc_assert (TREE_VEC_LENGTH (OMP_FOR_INIT (for_stmt))
== TREE_VEC_LENGTH (OMP_FOR_COND (for_stmt)));
gcc_assert (TREE_VEC_LENGTH (OMP_FOR_INIT (for_stmt))
@@ -5450,9 +5804,8 @@ gimplify_omp_for (tree *expr_p, tree *pre_p)
for (i = 0; i < TREE_VEC_LENGTH (OMP_FOR_INIT (for_stmt)); i++)
{
t = TREE_VEC_ELT (OMP_FOR_INIT (for_stmt), i);
- gcc_assert (TREE_CODE (t) == MODIFY_EXPR
- || TREE_CODE (t) == GIMPLE_MODIFY_STMT);
- decl = GENERIC_TREE_OPERAND (t, 0);
+ gcc_assert (TREE_CODE (t) == MODIFY_EXPR);
+ decl = TREE_OPERAND (t, 0);
gcc_assert (DECL_P (decl));
gcc_assert (INTEGRAL_TYPE_P (TREE_TYPE (decl))
|| POINTER_TYPE_P (TREE_TYPE (decl)));
@@ -5469,30 +5822,29 @@ gimplify_omp_for (tree *expr_p, tree *pre_p)
if (!is_gimple_reg (decl))
{
var = create_tmp_var (TREE_TYPE (decl), get_name (decl));
- GENERIC_TREE_OPERAND (t, 0) = var;
+ TREE_OPERAND (t, 0) = var;
+
+ gimplify_seq_add_stmt (&for_body, gimple_build_assign (decl, var));
- init_decl = build_gimple_modify_stmt (decl, var);
omp_add_variable (gimplify_omp_ctxp, var, GOVD_PRIVATE | GOVD_SEEN);
}
else
var = decl;
- ret |= gimplify_expr (&GENERIC_TREE_OPERAND (t, 1),
- &OMP_FOR_PRE_BODY (for_stmt),
- NULL, is_gimple_val, fb_rvalue);
-
- tree_to_gimple_tuple (&TREE_VEC_ELT (OMP_FOR_INIT (for_stmt), i));
+ ret |= gimplify_expr (&TREE_OPERAND (t, 1), &for_pre_body, NULL,
+ is_gimple_val, fb_rvalue);
+ if (ret == GS_ERROR)
+ return ret;
+ /* Handle OMP_FOR_COND. */
t = TREE_VEC_ELT (OMP_FOR_COND (for_stmt), i);
gcc_assert (COMPARISON_CLASS_P (t));
- gcc_assert (GENERIC_TREE_OPERAND (t, 0) == decl);
- TREE_OPERAND (t, 0) = var;
+ gcc_assert (TREE_OPERAND (t, 0) == decl);
- ret |= gimplify_expr (&GENERIC_TREE_OPERAND (t, 1),
- &OMP_FOR_PRE_BODY (for_stmt),
- NULL, is_gimple_val, fb_rvalue);
+ ret |= gimplify_expr (&TREE_OPERAND (t, 1), &for_pre_body, NULL,
+ is_gimple_val, fb_rvalue);
- tree_to_gimple_tuple (&TREE_VEC_ELT (OMP_FOR_INCR (for_stmt), i));
+ /* Handle OMP_FOR_INCR. */
t = TREE_VEC_ELT (OMP_FOR_INCR (for_stmt), i);
switch (TREE_CODE (t))
{
@@ -5500,7 +5852,7 @@ gimplify_omp_for (tree *expr_p, tree *pre_p)
case POSTINCREMENT_EXPR:
t = build_int_cst (TREE_TYPE (decl), 1);
t = build2 (PLUS_EXPR, TREE_TYPE (decl), var, t);
- t = build_gimple_modify_stmt (var, t);
+ t = build2 (MODIFY_EXPR, TREE_TYPE (var), var, t);
TREE_VEC_ELT (OMP_FOR_INCR (for_stmt), i) = t;
break;
@@ -5508,15 +5860,15 @@ gimplify_omp_for (tree *expr_p, tree *pre_p)
case POSTDECREMENT_EXPR:
t = build_int_cst (TREE_TYPE (decl), -1);
t = build2 (PLUS_EXPR, TREE_TYPE (decl), var, t);
- t = build_gimple_modify_stmt (var, t);
+ t = build2 (MODIFY_EXPR, TREE_TYPE (var), var, t);
TREE_VEC_ELT (OMP_FOR_INCR (for_stmt), i) = t;
break;
- case GIMPLE_MODIFY_STMT:
- gcc_assert (GIMPLE_STMT_OPERAND (t, 0) == decl);
- GIMPLE_STMT_OPERAND (t, 0) = var;
+ case MODIFY_EXPR:
+ gcc_assert (TREE_OPERAND (t, 0) == decl);
+ TREE_OPERAND (t, 0) = var;
- t = GIMPLE_STMT_OPERAND (t, 1);
+ t = TREE_OPERAND (t, 1);
switch (TREE_CODE (t))
{
case PLUS_EXPR:
@@ -5537,64 +5889,84 @@ gimplify_omp_for (tree *expr_p, tree *pre_p)
gcc_unreachable ();
}
- ret |= gimplify_expr (&TREE_OPERAND (t, 1),
- &OMP_FOR_PRE_BODY (for_stmt),
- NULL, is_gimple_val, fb_rvalue);
+ ret |= gimplify_expr (&TREE_OPERAND (t, 1), &for_pre_body, NULL,
+ is_gimple_val, fb_rvalue);
break;
default:
gcc_unreachable ();
}
- if (init_decl)
- append_to_statement_list (init_decl, &bodylist);
-
if (var != decl || TREE_VEC_LENGTH (OMP_FOR_INIT (for_stmt)) > 1)
{
tree c;
for (c = OMP_FOR_CLAUSES (for_stmt); c ; c = OMP_CLAUSE_CHAIN (c))
- if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_LASTPRIVATE
- && OMP_CLAUSE_DECL (c) == decl
- && OMP_CLAUSE_LASTPRIVATE_STMT (c) == NULL)
- {
- t = TREE_VEC_ELT (OMP_FOR_INCR (for_stmt), i);
- gcc_assert (TREE_CODE (t) == GIMPLE_MODIFY_STMT);
- gcc_assert (GIMPLE_STMT_OPERAND (t, 0) == var);
- t = GIMPLE_STMT_OPERAND (t, 1);
- gcc_assert (TREE_CODE (t) == PLUS_EXPR
- || TREE_CODE (t) == MINUS_EXPR
- || TREE_CODE (t) == POINTER_PLUS_EXPR);
- gcc_assert (TREE_OPERAND (t, 0) == var);
- t = build2 (TREE_CODE (t), TREE_TYPE (decl), decl,
- TREE_OPERAND (t, 1));
- OMP_CLAUSE_LASTPRIVATE_STMT (c)
- = build_gimple_modify_stmt (decl, t);
+ if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_LASTPRIVATE
+ && OMP_CLAUSE_DECL (c) == decl
+ && OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (c) == NULL)
+ {
+ t = TREE_VEC_ELT (OMP_FOR_INCR (for_stmt), i);
+ gcc_assert (TREE_CODE (t) == MODIFY_EXPR);
+ gcc_assert (TREE_OPERAND (t, 0) == var);
+ t = TREE_OPERAND (t, 1);
+ gcc_assert (TREE_CODE (t) == PLUS_EXPR
+ || TREE_CODE (t) == MINUS_EXPR
+ || TREE_CODE (t) == POINTER_PLUS_EXPR);
+ gcc_assert (TREE_OPERAND (t, 0) == var);
+ t = build2 (TREE_CODE (t), TREE_TYPE (decl), decl,
+ TREE_OPERAND (t, 1));
+ gimplify_assign (decl, t,
+ &OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (c));
}
}
}
- body = OMP_FOR_BODY (for_stmt);
- gimplify_to_stmt_list (&body);
- append_to_statement_list (body, &bodylist);
- OMP_FOR_BODY (for_stmt) = bodylist;
+ gimplify_and_add (OMP_FOR_BODY (for_stmt), &for_body);
+
gimplify_adjust_omp_clauses (&OMP_FOR_CLAUSES (for_stmt));
+ gfor = gimple_build_omp_for (for_body, OMP_FOR_CLAUSES (for_stmt),
+ TREE_VEC_LENGTH (OMP_FOR_INIT (for_stmt)),
+ for_pre_body);
+
+ for (i = 0; i < TREE_VEC_LENGTH (OMP_FOR_INIT (for_stmt)); i++)
+ {
+ t = TREE_VEC_ELT (OMP_FOR_INIT (for_stmt), i);
+ gimple_omp_for_set_index (gfor, i, TREE_OPERAND (t, 0));
+ gimple_omp_for_set_initial (gfor, i, TREE_OPERAND (t, 1));
+ t = TREE_VEC_ELT (OMP_FOR_COND (for_stmt), i);
+ gimple_omp_for_set_cond (gfor, i, TREE_CODE (t));
+ gimple_omp_for_set_final (gfor, i, TREE_OPERAND (t, 1));
+ t = TREE_VEC_ELT (OMP_FOR_INCR (for_stmt), i);
+ gimple_omp_for_set_incr (gfor, i, TREE_OPERAND (t, 1));
+ }
+
+ gimplify_seq_add_stmt (pre_p, gfor);
return ret == GS_ALL_DONE ? GS_ALL_DONE : GS_ERROR;
}
/* Gimplify the gross structure of other OpenMP worksharing constructs.
In particular, OMP_SECTIONS and OMP_SINGLE. */
-static enum gimplify_status
-gimplify_omp_workshare (tree *expr_p, tree *pre_p)
+static void
+gimplify_omp_workshare (tree *expr_p, gimple_seq *pre_p)
{
- tree stmt = *expr_p;
+ tree expr = *expr_p;
+ gimple stmt;
+ gimple_seq body = NULL;
- gimplify_scan_omp_clauses (&OMP_CLAUSES (stmt), pre_p, ORT_WORKSHARE);
- gimplify_to_stmt_list (&OMP_BODY (stmt));
- gimplify_adjust_omp_clauses (&OMP_CLAUSES (stmt));
+ gimplify_scan_omp_clauses (&OMP_CLAUSES (expr), pre_p, ORT_WORKSHARE);
+ gimplify_and_add (OMP_BODY (expr), &body);
+ gimplify_adjust_omp_clauses (&OMP_CLAUSES (expr));
- return GS_ALL_DONE;
+ if (TREE_CODE (expr) == OMP_SECTIONS)
+ stmt = gimple_build_omp_sections (body, OMP_CLAUSES (expr));
+ else if (TREE_CODE (expr) == OMP_SINGLE)
+ stmt = gimple_build_omp_single (body, OMP_CLAUSES (expr));
+ else
+ gcc_unreachable ();
+
+ gimplify_seq_add_stmt (pre_p, stmt);
}
/* A subroutine of gimplify_omp_atomic. The front end is supposed to have
@@ -5644,7 +6016,8 @@ goa_lhs_expr_p (tree expr, tree addr)
a subexpression, 0 if it did not, or -1 if an error was encountered. */
static int
-goa_stabilize_expr (tree *expr_p, tree *pre_p, tree lhs_addr, tree lhs_var)
+goa_stabilize_expr (tree *expr_p, gimple_seq *pre_p, tree lhs_addr,
+ tree lhs_var)
{
tree expr = *expr_p;
int saw_lhs;
@@ -5661,11 +6034,11 @@ goa_stabilize_expr (tree *expr_p, tree *pre_p, tree lhs_addr, tree lhs_var)
switch (TREE_CODE_CLASS (TREE_CODE (expr)))
{
case tcc_binary:
- saw_lhs |= goa_stabilize_expr (&TREE_OPERAND (expr, 1), pre_p,
- lhs_addr, lhs_var);
+ saw_lhs |= goa_stabilize_expr (&TREE_OPERAND (expr, 1), pre_p, lhs_addr,
+ lhs_var);
case tcc_unary:
- saw_lhs |= goa_stabilize_expr (&TREE_OPERAND (expr, 0), pre_p,
- lhs_addr, lhs_var);
+ saw_lhs |= goa_stabilize_expr (&TREE_OPERAND (expr, 0), pre_p, lhs_addr,
+ lhs_var);
break;
default:
break;
@@ -5682,15 +6055,16 @@ goa_stabilize_expr (tree *expr_p, tree *pre_p, tree lhs_addr, tree lhs_var)
return saw_lhs;
}
+
/* Gimplify an OMP_ATOMIC statement. */
static enum gimplify_status
-gimplify_omp_atomic (tree *expr_p, tree *pre_p)
+gimplify_omp_atomic (tree *expr_p, gimple_seq *pre_p)
{
tree addr = TREE_OPERAND (*expr_p, 0);
tree rhs = TREE_OPERAND (*expr_p, 1);
tree type = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (addr)));
- tree tmp_load, load, store;
+ tree tmp_load;
tmp_load = create_tmp_var (type, NULL);
if (goa_stabilize_expr (&rhs, pre_p, addr, tmp_load) < 0)
@@ -5700,74 +6074,170 @@ gimplify_omp_atomic (tree *expr_p, tree *pre_p)
!= GS_ALL_DONE)
return GS_ERROR;
- load = build2 (OMP_ATOMIC_LOAD, void_type_node, tmp_load, addr);
- append_to_statement_list (load, pre_p);
+ gimplify_seq_add_stmt (pre_p, gimple_build_omp_atomic_load (tmp_load, addr));
if (gimplify_expr (&rhs, pre_p, NULL, is_gimple_val, fb_rvalue)
!= GS_ALL_DONE)
return GS_ERROR;
- store = build1 (OMP_ATOMIC_STORE, void_type_node, rhs);
- *expr_p = store;
+ gimplify_seq_add_stmt (pre_p, gimple_build_omp_atomic_store (rhs));
+ *expr_p = NULL;
return GS_ALL_DONE;
-
}
-/* Gimplifies the expression tree pointed to by EXPR_P. Return 0 if
- gimplification failed.
-
- PRE_P points to the list where side effects that must happen before
- EXPR should be stored.
-
- POST_P points to the list where side effects that must happen after
- EXPR should be stored, or NULL if there is no suitable list. In
- that case, we copy the result to a temporary, emit the
- post-effects, and then return the temporary.
-
- GIMPLE_TEST_F points to a function that takes a tree T and
- returns nonzero if T is in the GIMPLE form requested by the
- caller. The GIMPLE predicates are in tree-gimple.c.
-
- This test is used twice. Before gimplification, the test is
- invoked to determine whether *EXPR_P is already gimple enough. If
- that fails, *EXPR_P is gimplified according to its code and
- GIMPLE_TEST_F is called again. If the test still fails, then a new
- temporary variable is created and assigned the value of the
- gimplified expression.
- FALLBACK tells the function what sort of a temporary we want. If the 1
- bit is set, an rvalue is OK. If the 2 bit is set, an lvalue is OK.
- If both are set, either is OK, but an lvalue is preferable.
-
- The return value is either GS_ERROR or GS_ALL_DONE, since this function
- iterates until solution. */
+/* Converts the GENERIC expression tree *EXPR_P to GIMPLE. If the
+ expression produces a value to be used as an operand inside a GIMPLE
+ statement, the value will be stored back in *EXPR_P. This value will
+ be a tree of class tcc_declaration, tcc_constant, tcc_reference or
+ an SSA_NAME. The corresponding sequence of GIMPLE statements is
+ emitted in PRE_P and POST_P.
+
+ Additionally, this process may overwrite parts of the input
+ expression during gimplification. Ideally, it should be
+ possible to do non-destructive gimplification.
+
+ EXPR_P points to the GENERIC expression to convert to GIMPLE. If
+ the expression needs to evaluate to a value to be used as
+ an operand in a GIMPLE statement, this value will be stored in
+ *EXPR_P on exit. This happens when the caller specifies one
+ of fb_lvalue or fb_rvalue fallback flags.
+
+ PRE_P will contain the sequence of GIMPLE statements corresponding
+ to the evaluation of EXPR and all the side-effects that must
+ be executed before the main expression. On exit, the last
+ statement of PRE_P is the core statement being gimplified. For
+ instance, when gimplifying 'if (++a)' the last statement in
+ PRE_P will be 'if (t.1)' where t.1 is the result of
+ pre-incrementing 'a'.
+
+ POST_P will contain the sequence of GIMPLE statements corresponding
+ to the evaluation of all the side-effects that must be executed
+ after the main expression. If this is NULL, the post
+ side-effects are stored at the end of PRE_P.
+
+ The reason why the output is split in two is to handle post
+ side-effects explicitly. In some cases, an expression may have
+ inner and outer post side-effects which need to be emitted in
+ an order different from the one given by the recursive
+ traversal. For instance, for the expression (*p--)++ the post
+ side-effects of '--' must actually occur *after* the post
+ side-effects of '++'. However, gimplification will first visit
+ the inner expression, so if a separate POST sequence was not
+ used, the resulting sequence would be:
+
+ 1 t.1 = *p
+ 2 p = p - 1
+ 3 t.2 = t.1 + 1
+ 4 *p = t.2
+
+ However, the post-decrement operation in line #2 must not be
+ evaluated until after the store to *p at line #4, so the
+ correct sequence should be:
+
+ 1 t.1 = *p
+ 2 t.2 = t.1 + 1
+ 3 *p = t.2
+ 4 p = p - 1
+
+ So, by specifying a separate post queue, it is possible
+ to emit the post side-effects in the correct order.
+ If POST_P is NULL, an internal queue will be used. Before
+ returning to the caller, the sequence POST_P is appended to
+ the main output sequence PRE_P.
+
+ GIMPLE_TEST_F points to a function that takes a tree T and
+ returns nonzero if T is in the GIMPLE form requested by the
+ caller. The GIMPLE predicates are in tree-gimple.c.
+
+ FALLBACK tells the function what sort of a temporary we want if
+ gimplification cannot produce an expression that complies with
+ GIMPLE_TEST_F.
+
+ fb_none means that no temporary should be generated
+ fb_rvalue means that an rvalue is OK to generate
+ fb_lvalue means that an lvalue is OK to generate
+ fb_either means that either is OK, but an lvalue is preferable.
+ fb_mayfail means that gimplification may fail (in which case
+ GS_ERROR will be returned)
+
+ The return value is either GS_ERROR or GS_ALL_DONE, since this
+ function iterates until EXPR is completely gimplified or an error
+ occurs. */
enum gimplify_status
-gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p,
- bool (* gimple_test_f) (tree), fallback_t fallback)
+gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
+ bool (*gimple_test_f) (tree), fallback_t fallback)
{
tree tmp;
- tree internal_pre = NULL_TREE;
- tree internal_post = NULL_TREE;
+ gimple_seq internal_pre = NULL;
+ gimple_seq internal_post = NULL;
tree save_expr;
- int is_statement = (pre_p == NULL);
+ bool is_statement;
location_t saved_location;
enum gimplify_status ret;
+ gimple_stmt_iterator pre_last_gsi, post_last_gsi;
save_expr = *expr_p;
if (save_expr == NULL_TREE)
return GS_ALL_DONE;
+ /* If we are gimplifying a top-level statement, PRE_P must be valid. */
+ is_statement = gimple_test_f == is_gimple_stmt;
+ if (is_statement)
+ gcc_assert (pre_p);
+
+ /* Consistency checks. */
+ if (gimple_test_f == is_gimple_reg)
+ gcc_assert (fallback & (fb_rvalue | fb_lvalue));
+ else if (gimple_test_f == is_gimple_val
+ || gimple_test_f == is_gimple_formal_tmp_rhs
+ || gimple_test_f == is_gimple_formal_tmp_or_call_rhs
+ || gimple_test_f == is_gimple_formal_tmp_reg
+ || gimple_test_f == is_gimple_formal_tmp_var
+ || gimple_test_f == is_gimple_call_addr
+ || gimple_test_f == is_gimple_condexpr
+ || gimple_test_f == is_gimple_mem_rhs
+ || gimple_test_f == is_gimple_mem_or_call_rhs
+ || gimple_test_f == is_gimple_reg_rhs
+ || gimple_test_f == is_gimple_reg_or_call_rhs
+ || gimple_test_f == is_gimple_asm_val)
+ gcc_assert (fallback & fb_rvalue);
+ else if (gimple_test_f == is_gimple_min_lval
+ || gimple_test_f == is_gimple_lvalue)
+ gcc_assert (fallback & fb_lvalue);
+ else if (gimple_test_f == is_gimple_addressable)
+ gcc_assert (fallback & fb_either);
+ else if (gimple_test_f == is_gimple_stmt)
+ gcc_assert (fallback == fb_none);
+ else
+ {
+ /* We should have recognized the GIMPLE_TEST_F predicate to
+ know what kind of fallback to use in case a temporary is
+ needed to hold the value or address of *EXPR_P. */
+ gcc_unreachable ();
+ }
+
/* We used to check the predicate here and return immediately if it
succeeds. This is wrong; the design is for gimplification to be
idempotent, and for the predicates to only test for valid forms, not
whether they are fully simplified. */
-
- /* Set up our internal queues if needed. */
if (pre_p == NULL)
pre_p = &internal_pre;
+
if (post_p == NULL)
post_p = &internal_post;
+ /* Remember the last statements added to PRE_P and POST_P. Every
+ new statement added by the gimplification helpers needs to be
+ annotated with location information. To centralize the
+ responsibility, we remember the last statement that had been
+ added to both queues before gimplifying *EXPR_P. If
+ gimplification produces new statements in PRE_P and POST_P, those
+ statements will be annotated with the same location information
+ as *EXPR_P. */
+ pre_last_gsi = gsi_last (*pre_p);
+ post_last_gsi = gsi_last (*post_p);
+
saved_location = input_location;
if (save_expr != error_mark_node
&& EXPR_HAS_LOCATION (*expr_p))
@@ -5786,8 +6256,7 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p,
/* Die, die, die, my darling. */
if (save_expr == error_mark_node
- || (!GIMPLE_STMT_P (save_expr)
- && TREE_TYPE (save_expr)
+ || (TREE_TYPE (save_expr)
&& TREE_TYPE (save_expr) == error_mark_node))
{
ret = GS_ERROR;
@@ -5831,6 +6300,7 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p,
case COND_EXPR:
ret = gimplify_cond_expr (expr_p, pre_p, fallback);
+
/* C99 code may assign to an array in a structure value of a
conditional expression, and this has undefined behavior
only on execution, so create a temporary if an lvalue is
@@ -5844,6 +6314,7 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p,
case CALL_EXPR:
ret = gimplify_call_expr (expr_p, pre_p, fallback != fb_none);
+
/* C99 code may assign to an array in a structure returned
from a function, and this has undefined behavior only on
execution, so create a temporary if an lvalue is
@@ -5863,23 +6334,9 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p,
break;
case MODIFY_EXPR:
- case GIMPLE_MODIFY_STMT:
case INIT_EXPR:
ret = gimplify_modify_expr (expr_p, pre_p, post_p,
fallback != fb_none);
-
- if (*expr_p)
- {
- /* The distinction between MODIFY_EXPR and INIT_EXPR is no longer
- useful. */
- if (TREE_CODE (*expr_p) == INIT_EXPR)
- TREE_SET_CODE (*expr_p, MODIFY_EXPR);
-
- /* Convert MODIFY_EXPR to GIMPLE_MODIFY_STMT. */
- if (TREE_CODE (*expr_p) == MODIFY_EXPR)
- tree_to_gimple_tuple (expr_p);
- }
-
break;
case TRUTH_ANDIF_EXPR:
@@ -5973,7 +6430,7 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p,
break;
case DECL_EXPR:
- ret = gimplify_decl_expr (expr_p);
+ ret = gimplify_decl_expr (expr_p, pre_p);
break;
case EXC_PTR_EXPR:
@@ -6003,20 +6460,27 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p,
if (TREE_CODE (GOTO_DESTINATION (*expr_p)) != LABEL_DECL)
ret = gimplify_expr (&GOTO_DESTINATION (*expr_p), pre_p,
NULL, is_gimple_val, fb_rvalue);
+ gimplify_seq_add_stmt (pre_p,
+ gimple_build_goto (GOTO_DESTINATION (*expr_p)));
break;
- /* Predictions are always gimplified. */
case PREDICT_EXPR:
- goto out;
+ gimplify_seq_add_stmt (pre_p,
+ gimple_build_predict (PREDICT_EXPR_PREDICTOR (*expr_p),
+ PREDICT_EXPR_OUTCOME (*expr_p)));
+ ret = GS_ALL_DONE;
+ break;
case LABEL_EXPR:
ret = GS_ALL_DONE;
gcc_assert (decl_function_context (LABEL_EXPR_LABEL (*expr_p))
== current_function_decl);
+ gimplify_seq_add_stmt (pre_p,
+ gimple_build_label (LABEL_EXPR_LABEL (*expr_p)));
break;
case CASE_LABEL_EXPR:
- ret = gimplify_case_label_expr (expr_p);
+ ret = gimplify_case_label_expr (expr_p, pre_p);
break;
case RETURN_EXPR:
@@ -6068,12 +6532,12 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p,
{
enum gimplify_status r0, r1, r2;
- r0 = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p, post_p,
- is_gimple_lvalue, fb_either);
- r1 = gimplify_expr (&TREE_OPERAND (*expr_p, 1), pre_p, post_p,
- is_gimple_val, fb_rvalue);
- r2 = gimplify_expr (&TREE_OPERAND (*expr_p, 2), pre_p, post_p,
- is_gimple_val, fb_rvalue);
+ r0 = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p,
+ post_p, is_gimple_lvalue, fb_either);
+ r1 = gimplify_expr (&TREE_OPERAND (*expr_p, 1), pre_p,
+ post_p, is_gimple_val, fb_rvalue);
+ r2 = gimplify_expr (&TREE_OPERAND (*expr_p, 2), pre_p,
+ post_p, is_gimple_val, fb_rvalue);
recalculate_side_effects (*expr_p);
ret = MIN (r0, MIN (r1, r2));
@@ -6090,10 +6554,24 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p,
case TRY_FINALLY_EXPR:
case TRY_CATCH_EXPR:
- gimplify_to_stmt_list (&TREE_OPERAND (*expr_p, 0));
- gimplify_to_stmt_list (&TREE_OPERAND (*expr_p, 1));
- ret = GS_ALL_DONE;
- break;
+ {
+ gimple_seq eval, cleanup;
+ gimple try_;
+
+ eval = cleanup = NULL;
+ gimplify_and_add (TREE_OPERAND (*expr_p, 0), &eval);
+ gimplify_and_add (TREE_OPERAND (*expr_p, 1), &cleanup);
+ try_ = gimple_build_try (eval, cleanup,
+ TREE_CODE (*expr_p) == TRY_FINALLY_EXPR
+ ? GIMPLE_TRY_FINALLY
+ : GIMPLE_TRY_CATCH);
+ if (TREE_CODE (*expr_p) == TRY_CATCH_EXPR)
+ gimple_try_set_catch_is_cleanup (try_,
+ TRY_CATCH_IS_CLEANUP (*expr_p));
+ gimplify_seq_add_stmt (pre_p, try_);
+ ret = GS_ALL_DONE;
+ break;
+ }
case CLEANUP_POINT_EXPR:
ret = gimplify_cleanup_point_expr (expr_p, pre_p);
@@ -6104,27 +6582,51 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p,
break;
case CATCH_EXPR:
- gimplify_to_stmt_list (&CATCH_BODY (*expr_p));
- ret = GS_ALL_DONE;
- break;
+ {
+ gimple c;
+ gimple_seq handler = NULL;
+ gimplify_and_add (CATCH_BODY (*expr_p), &handler);
+ c = gimple_build_catch (CATCH_TYPES (*expr_p), handler);
+ gimplify_seq_add_stmt (pre_p, c);
+ ret = GS_ALL_DONE;
+ break;
+ }
case EH_FILTER_EXPR:
- gimplify_to_stmt_list (&EH_FILTER_FAILURE (*expr_p));
- ret = GS_ALL_DONE;
- break;
+ {
+ gimple ehf;
+ gimple_seq failure = NULL;
+
+ gimplify_and_add (EH_FILTER_FAILURE (*expr_p), &failure);
+ ehf = gimple_build_eh_filter (EH_FILTER_TYPES (*expr_p), failure);
+ gimple_eh_filter_set_must_not_throw
+ (ehf, EH_FILTER_MUST_NOT_THROW (*expr_p));
+ gimplify_seq_add_stmt (pre_p, ehf);
+ ret = GS_ALL_DONE;
+ break;
+ }
case CHANGE_DYNAMIC_TYPE_EXPR:
- ret = gimplify_expr (&CHANGE_DYNAMIC_TYPE_LOCATION (*expr_p),
- pre_p, post_p, is_gimple_reg, fb_lvalue);
+ {
+ gimple cdt;
+
+ ret = gimplify_expr (&CHANGE_DYNAMIC_TYPE_LOCATION (*expr_p),
+ pre_p, post_p, is_gimple_reg, fb_lvalue);
+ cdt = gimple_build_cdt (CHANGE_DYNAMIC_TYPE_NEW_TYPE (*expr_p),
+ CHANGE_DYNAMIC_TYPE_LOCATION (*expr_p));
+ gimplify_seq_add_stmt (pre_p, cdt);
+ ret = GS_ALL_DONE;
+ }
break;
case OBJ_TYPE_REF:
{
enum gimplify_status r0, r1;
- r0 = gimplify_expr (&OBJ_TYPE_REF_OBJECT (*expr_p), pre_p, post_p,
- is_gimple_val, fb_rvalue);
- r1 = gimplify_expr (&OBJ_TYPE_REF_EXPR (*expr_p), pre_p, post_p,
- is_gimple_val, fb_rvalue);
+ r0 = gimplify_expr (&OBJ_TYPE_REF_OBJECT (*expr_p), pre_p,
+ post_p, is_gimple_val, fb_rvalue);
+ r1 = gimplify_expr (&OBJ_TYPE_REF_EXPR (*expr_p), pre_p,
+ post_p, is_gimple_val, fb_rvalue);
+ TREE_SIDE_EFFECTS (*expr_p) = 0;
ret = MIN (r0, r1);
}
break;
@@ -6169,11 +6671,13 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p,
break;
case OMP_PARALLEL:
- ret = gimplify_omp_parallel (expr_p, pre_p);
+ gimplify_omp_parallel (expr_p, pre_p);
+ ret = GS_ALL_DONE;
break;
case OMP_TASK:
- ret = gimplify_omp_task (expr_p, pre_p);
+ gimplify_omp_task (expr_p, pre_p);
+ ret = GS_ALL_DONE;
break;
case OMP_FOR:
@@ -6182,68 +6686,74 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p,
case OMP_SECTIONS:
case OMP_SINGLE:
- ret = gimplify_omp_workshare (expr_p, pre_p);
+ gimplify_omp_workshare (expr_p, pre_p);
+ ret = GS_ALL_DONE;
break;
case OMP_SECTION:
case OMP_MASTER:
case OMP_ORDERED:
case OMP_CRITICAL:
- gimplify_to_stmt_list (&OMP_BODY (*expr_p));
- break;
+ {
+ gimple_seq body = NULL;
+ gimple g;
+
+ gimplify_and_add (OMP_BODY (*expr_p), &body);
+ switch (TREE_CODE (*expr_p))
+ {
+ case OMP_SECTION:
+ g = gimple_build_omp_section (body);
+ break;
+ case OMP_MASTER:
+ g = gimple_build_omp_master (body);
+ break;
+ case OMP_ORDERED:
+ g = gimple_build_omp_ordered (body);
+ break;
+ case OMP_CRITICAL:
+ g = gimple_build_omp_critical (body,
+ OMP_CRITICAL_NAME (*expr_p));
+ break;
+ default:
+ gcc_unreachable ();
+ }
+ gimplify_seq_add_stmt (pre_p, g);
+ ret = GS_ALL_DONE;
+ break;
+ }
case OMP_ATOMIC:
ret = gimplify_omp_atomic (expr_p, pre_p);
break;
- case OMP_RETURN:
- case OMP_CONTINUE:
- case OMP_ATOMIC_STORE:
- case OMP_SECTIONS_SWITCH:
- ret = GS_ALL_DONE;
- break;
-
- case OMP_ATOMIC_LOAD:
- if (gimplify_expr (&TREE_OPERAND (*expr_p, 1), pre_p, NULL,
- is_gimple_val, fb_rvalue) != GS_ALL_DONE)
- ret = GS_ERROR;
- else
- ret = GS_ALL_DONE;
- break;
-
case POINTER_PLUS_EXPR:
/* Convert ((type *)A)+offset into &A->field_of_type_and_offset.
The second is gimple immediate saving a need for extra statement.
*/
if (TREE_CODE (TREE_OPERAND (*expr_p, 1)) == INTEGER_CST
- && (tmp = maybe_fold_offset_to_reference
+ && (tmp = maybe_fold_offset_to_address
(TREE_OPERAND (*expr_p, 0), TREE_OPERAND (*expr_p, 1),
- TREE_TYPE (TREE_TYPE (*expr_p)))))
- {
- tree ptr_type = build_pointer_type (TREE_TYPE (tmp));
- if (useless_type_conversion_p (TREE_TYPE (*expr_p), ptr_type))
- {
- *expr_p = build_fold_addr_expr_with_type (tmp, ptr_type);
- break;
- }
- }
+ TREE_TYPE (*expr_p))))
+ {
+ *expr_p = tmp;
+ break;
+ }
/* Convert (void *)&a + 4 into (void *)&a[1]. */
if (TREE_CODE (TREE_OPERAND (*expr_p, 0)) == NOP_EXPR
&& TREE_CODE (TREE_OPERAND (*expr_p, 1)) == INTEGER_CST
&& POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (*expr_p,
0),0)))
- && (tmp = maybe_fold_offset_to_reference
+ && (tmp = maybe_fold_offset_to_address
(TREE_OPERAND (TREE_OPERAND (*expr_p, 0), 0),
TREE_OPERAND (*expr_p, 1),
- TREE_TYPE (TREE_TYPE
- (TREE_OPERAND (TREE_OPERAND (*expr_p, 0),
- 0))))))
+ TREE_TYPE (TREE_OPERAND (TREE_OPERAND (*expr_p, 0),
+ 0)))))
{
- tmp = build_fold_addr_expr (tmp);
*expr_p = fold_convert (TREE_TYPE (*expr_p), tmp);
break;
}
/* FALLTHRU */
+
default:
switch (TREE_CODE_CLASS (TREE_CODE (*expr_p)))
{
@@ -6257,18 +6767,17 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p,
Compare scalar mode aggregates as scalar mode values. Using
memcmp for them would be very inefficient at best, and is
plain wrong if bitfields are involved. */
+ {
+ tree type = TREE_TYPE (TREE_OPERAND (*expr_p, 1));
- {
- tree type = TREE_TYPE (TREE_OPERAND (*expr_p, 1));
-
- if (!AGGREGATE_TYPE_P (type))
- goto expr_2;
- else if (TYPE_MODE (type) != BLKmode)
- ret = gimplify_scalar_mode_aggregate_compare (expr_p);
- else
- ret = gimplify_variable_sized_compare (expr_p);
+ if (!AGGREGATE_TYPE_P (type))
+ goto expr_2;
+ else if (TYPE_MODE (type) != BLKmode)
+ ret = gimplify_scalar_mode_aggregate_compare (expr_p);
+ else
+ ret = gimplify_variable_sized_compare (expr_p);
- break;
+ break;
}
/* If *EXPR_P does not need to be special-cased, handle it
@@ -6284,7 +6793,7 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p,
enum gimplify_status r0, r1;
r0 = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p,
- post_p, is_gimple_val, fb_rvalue);
+ post_p, is_gimple_val, fb_rvalue);
r1 = gimplify_expr (&TREE_OPERAND (*expr_p, 1), pre_p,
post_p, is_gimple_val, fb_rvalue);
@@ -6305,6 +6814,7 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p,
}
recalculate_side_effects (*expr_p);
+
dont_recalculate:
break;
}
@@ -6372,6 +6882,7 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p,
/* Historically, the compiler has treated a bare reference
to a non-BLKmode volatile lvalue as forcing a load. */
tree type = TYPE_MAIN_VARIANT (TREE_TYPE (*expr_p));
+
/* Normally, we do not want to create a temporary for a
TREE_ADDRESSABLE type because such a type should not be
copied by bitwise-assignment. However, we make an
@@ -6381,7 +6892,8 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p,
given a TREE_ADDRESSABLE type. */
tree tmp = create_tmp_var_raw (type, "vol");
gimple_add_tmp_var (tmp);
- *expr_p = build_gimple_modify_stmt (tmp, *expr_p);
+ gimplify_assign (tmp, *expr_p, pre_p);
+ *expr_p = NULL;
}
else
/* We can't do anything useful with a volatile reference to
@@ -6393,33 +6905,68 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p,
}
/* If we are gimplifying at the statement level, we're done. Tack
- everything together and replace the original statement with the
- gimplified form. */
+ everything together and return. */
if (fallback == fb_none || is_statement)
{
- if (internal_pre || internal_post)
+ /* Since *EXPR_P has been converted into a GIMPLE tuple, clear
+ it out for GC to reclaim it. */
+ *expr_p = NULL_TREE;
+
+ if (!gimple_seq_empty_p (internal_pre)
+ || !gimple_seq_empty_p (internal_post))
{
- append_to_statement_list (*expr_p, &internal_pre);
- append_to_statement_list (internal_post, &internal_pre);
- annotate_all_with_locus (&internal_pre, input_location);
- *expr_p = internal_pre;
+ gimplify_seq_add_seq (&internal_pre, internal_post);
+ gimplify_seq_add_seq (pre_p, internal_pre);
}
- else if (!*expr_p)
- ;
- else if (TREE_CODE (*expr_p) == STATEMENT_LIST)
- annotate_all_with_locus (expr_p, input_location);
- else
- annotate_one_with_locus (*expr_p, input_location);
+
+ /* The result of gimplifying *EXPR_P is going to be the last few
+ statements in *PRE_P and *POST_P. Add location information
+ to all the statements that were added by the gimplification
+ helpers. */
+ if (!gimple_seq_empty_p (*pre_p))
+ annotate_all_with_location_after (*pre_p, pre_last_gsi, input_location);
+
+ if (!gimple_seq_empty_p (*post_p))
+ annotate_all_with_location_after (*post_p, post_last_gsi,
+ input_location);
+
goto out;
}
- /* Otherwise we're gimplifying a subexpression, so the resulting value is
- interesting. */
+#ifdef ENABLE_GIMPLE_CHECKING
+ if (*expr_p)
+ {
+ enum tree_code code = TREE_CODE (*expr_p);
+ /* These expressions should already be in gimple IR form. */
+ gcc_assert (code != MODIFY_EXPR
+ && code != ASM_EXPR
+ && code != BIND_EXPR
+ && code != CATCH_EXPR
+ && code != COND_EXPR
+ && code != EH_FILTER_EXPR
+ && code != GOTO_EXPR
+ && code != LABEL_EXPR
+ && code != LOOP_EXPR
+ && code != RESX_EXPR
+ && code != SWITCH_EXPR
+ && code != TRY_FINALLY_EXPR
+ && code != OMP_CRITICAL
+ && code != OMP_FOR
+ && code != OMP_MASTER
+ && code != OMP_ORDERED
+ && code != OMP_PARALLEL
+ && code != OMP_SECTIONS
+ && code != OMP_SECTION
+ && code != OMP_SINGLE);
+ }
+#endif
- /* If it's sufficiently simple already, we're done. Unless we are
- handling some post-effects internally; if that's the case, we need to
- copy into a temp before adding the post-effects to the tree. */
- if (!internal_post && (*gimple_test_f) (*expr_p))
+ /* Otherwise we're gimplifying a subexpression, so the resulting
+ value is interesting. If it's a valid operand that matches
+ GIMPLE_TEST_F, we're done. Unless we are handling some
+ post-effects internally; if that's the case, we need to copy into
+ a temporary before adding the post-effects to POST_P. */
+ if (gimple_seq_empty_p (internal_post) && (*gimple_test_f) (*expr_p))
goto out;
/* Otherwise, we need to create a new temporary for the gimplified
@@ -6429,7 +6976,8 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p,
object the lvalue refers to would (probably) be modified by the
postqueue; we need to copy the value out first, which means an
rvalue. */
- if ((fallback & fb_lvalue) && !internal_post
+ if ((fallback & fb_lvalue)
+ && gimple_seq_empty_p (internal_post)
&& is_gimple_addressable (*expr_p))
{
/* An lvalue will do. Take the address of the expression, store it
@@ -6439,14 +6987,15 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p,
gimplify_expr (&tmp, pre_p, post_p, is_gimple_reg, fb_rvalue);
*expr_p = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (tmp)), tmp);
}
- else if ((fallback & fb_rvalue) && is_gimple_formal_tmp_rhs (*expr_p))
+ else if ((fallback & fb_rvalue) && is_gimple_formal_tmp_or_call_rhs (*expr_p))
{
+ /* An rvalue will do. Assign the gimplified expression into a
+ new temporary TMP and replace the original expression with
+ TMP. First, make sure that the expression has a type so that
+ it can be assigned into a temporary. */
gcc_assert (!VOID_TYPE_P (TREE_TYPE (*expr_p)));
- /* An rvalue will do. Assign the gimplified expression into a new
- temporary TMP and replace the original expression with TMP. */
-
- if (internal_post || (fallback & fb_lvalue))
+ if (!gimple_seq_empty_p (internal_post) || (fallback & fb_lvalue))
/* The postqueue might change the value of the expression between
the initialization and use of the temporary, so we can't use a
formal temp. FIXME do we care? */
@@ -6459,7 +7008,7 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p,
}
else
{
-#ifdef ENABLE_CHECKING
+#ifdef ENABLE_GIMPLE_CHECKING
if (!(fallback & fb_mayfail))
{
fprintf (stderr, "gimplification failed:\n");
@@ -6469,6 +7018,7 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p,
}
#endif
gcc_assert (fallback & fb_mayfail);
+
/* If this is an asm statement, and the user asked for the
impossible, don't die. Fail and let gimplify_asm_expr
issue an error. */
@@ -6479,10 +7029,10 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p,
/* Make sure the temporary matches our predicate. */
gcc_assert ((*gimple_test_f) (*expr_p));
- if (internal_post)
+ if (!gimple_seq_empty_p (internal_post))
{
- annotate_all_with_locus (&internal_post, input_location);
- append_to_statement_list (internal_post, pre_p);
+ annotate_all_with_location (internal_post, input_location);
+ gimplify_seq_add_seq (pre_p, internal_post);
}
out:
@@ -6494,7 +7044,7 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p,
size that we find. Add to LIST_P any statements generated. */
void
-gimplify_type_sizes (tree type, tree *list_p)
+gimplify_type_sizes (tree type, gimple_seq *list_p)
{
tree field, t;
@@ -6577,10 +7127,10 @@ gimplify_type_sizes (tree type, tree *list_p)
/* A subroutine of gimplify_type_sizes to make sure that *EXPR_P,
a size or position, has had all of its SAVE_EXPRs evaluated.
- We add any required statements to STMT_P. */
+ We add any required statements to *STMT_P. */
void
-gimplify_one_sizepos (tree *expr_p, tree *stmt_p)
+gimplify_one_sizepos (tree *expr_p, gimple_seq *stmt_p)
{
tree type, expr = *expr_p;
@@ -6611,28 +7161,30 @@ gimplify_one_sizepos (tree *expr_p, tree *stmt_p)
&& TYPE_IS_SIZETYPE (type))
{
tree tmp;
+ gimple stmt;
*expr_p = create_tmp_var (type, NULL);
tmp = build1 (NOP_EXPR, type, expr);
- tmp = build_gimple_modify_stmt (*expr_p, tmp);
+ stmt = gimplify_assign (*expr_p, tmp, stmt_p);
if (EXPR_HAS_LOCATION (expr))
- SET_EXPR_LOCUS (tmp, EXPR_LOCUS (expr));
+ gimple_set_location (stmt, *EXPR_LOCUS (expr));
else
- SET_EXPR_LOCATION (tmp, input_location);
-
- gimplify_and_add (tmp, stmt_p);
+ gimple_set_location (stmt, input_location);
}
}
-
-/* Gimplify the body of statements pointed to by BODY_P. FNDECL is the
- function decl containing BODY. */
-void
+/* Gimplify the body of statements pointed to by BODY_P and return a
+ GIMPLE_BIND containing the sequence of GIMPLE statements
+ corresponding to BODY_P. FNDECL is the function decl containing
+ *BODY_P. */
+
+gimple
gimplify_body (tree *body_p, tree fndecl, bool do_parms)
{
location_t saved_location = input_location;
- tree body, parm_stmts;
+ gimple_seq parm_stmts, seq;
+ gimple outer_bind;
struct gimplify_ctx gctx;
timevar_push (TV_TREE_GIMPLIFY);
@@ -6652,63 +7204,62 @@ gimplify_body (tree *body_p, tree fndecl, bool do_parms)
/* Resolve callee-copies. This has to be done before processing
the body so that DECL_VALUE_EXPR gets processed correctly. */
- parm_stmts = do_parms ? gimplify_parameters () : NULL;
+ parm_stmts = (do_parms) ? gimplify_parameters () : NULL;
/* Gimplify the function's body. */
- gimplify_stmt (body_p);
- body = *body_p;
-
- if (!body)
- body = alloc_stmt_list ();
- else if (TREE_CODE (body) == STATEMENT_LIST)
+ seq = NULL;
+ gimplify_stmt (body_p, &seq);
+ outer_bind = gimple_seq_first_stmt (seq);
+ if (!outer_bind)
{
- tree t = expr_only (*body_p);
- if (t)
- body = t;
+ outer_bind = gimple_build_nop ();
+ gimplify_seq_add_stmt (&seq, outer_bind);
}
- /* If there isn't an outer BIND_EXPR, add one. */
- if (TREE_CODE (body) != BIND_EXPR)
- {
- tree b = build3 (BIND_EXPR, void_type_node, NULL_TREE,
- NULL_TREE, NULL_TREE);
- TREE_SIDE_EFFECTS (b) = 1;
- append_to_statement_list_force (body, &BIND_EXPR_BODY (b));
- body = b;
- }
+ /* The body must contain exactly one statement, a GIMPLE_BIND. If this is
+ not the case, wrap everything in a GIMPLE_BIND to make it so. */
+ if (gimple_code (outer_bind) == GIMPLE_BIND
+ && gimple_seq_first (seq) == gimple_seq_last (seq))
+ ;
+ else
+ outer_bind = gimple_build_bind (NULL_TREE, seq, NULL);
+
+ *body_p = NULL_TREE;
/* If we had callee-copies statements, insert them at the beginning
of the function. */
- if (parm_stmts)
+ if (!gimple_seq_empty_p (parm_stmts))
{
- append_to_statement_list_force (BIND_EXPR_BODY (body), &parm_stmts);
- BIND_EXPR_BODY (body) = parm_stmts;
+ gimplify_seq_add_seq (&parm_stmts, gimple_bind_body (outer_bind));
+ gimple_bind_set_body (outer_bind, parm_stmts);
}
- /* Unshare again, in case gimplification was sloppy. */
- unshare_all_trees (body);
-
- *body_p = body;
-
- pop_gimplify_context (body);
+ pop_gimplify_context (outer_bind);
gcc_assert (gimplify_ctxp == NULL);
#ifdef ENABLE_TYPES_CHECKING
if (!errorcount && !sorrycount)
- verify_gimple_1 (BIND_EXPR_BODY (*body_p));
+ verify_types_in_gimple_seq (gimple_bind_body (outer_bind));
#endif
timevar_pop (TV_TREE_GIMPLIFY);
input_location = saved_location;
+
+ return outer_bind;
}
/* Entry point to the gimplification pass. FNDECL is the FUNCTION_DECL
- node for the function we want to gimplify. */
+ node for the function we want to gimplify.
+
+ Returns the sequence of GIMPLE statements corresponding to the body
+ of FNDECL. */
void
gimplify_function_tree (tree fndecl)
{
tree oldfn, parm, ret;
+ gimple_seq seq;
+ gimple bind;
oldfn = current_function_decl;
current_function_decl = fndecl;
@@ -6735,7 +7286,13 @@ gimplify_function_tree (tree fndecl)
&& !needs_to_live_in_memory (ret))
DECL_GIMPLE_REG_P (ret) = 1;
- gimplify_body (&DECL_SAVED_TREE (fndecl), fndecl, true);
+ bind = gimplify_body (&DECL_SAVED_TREE (fndecl), fndecl, true);
+
+ /* The tree body of the function is no longer needed, replace it
+ with the new GIMPLE body. */
+ seq = gimple_seq_alloc ();
+ gimple_seq_add_stmt (&seq, bind);
+ gimple_set_body (fndecl, seq);
/* If we're instrumenting function entry/exit, then prepend the call to
the entry hook and wrap the whole function in a TRY_FINALLY_EXPR to
@@ -6745,44 +7302,248 @@ gimplify_function_tree (tree fndecl)
&& !DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (fndecl)
&& !flag_instrument_functions_exclude_p (fndecl))
{
- tree tf, x, bind;
+ tree x;
+ gimple new_bind;
+ gimple tf;
+ gimple_seq cleanup = NULL, body = NULL;
- tf = build2 (TRY_FINALLY_EXPR, void_type_node, NULL, NULL);
- TREE_SIDE_EFFECTS (tf) = 1;
- x = DECL_SAVED_TREE (fndecl);
- append_to_statement_list (x, &TREE_OPERAND (tf, 0));
x = implicit_built_in_decls[BUILT_IN_PROFILE_FUNC_EXIT];
- x = build_call_expr (x, 0);
- append_to_statement_list (x, &TREE_OPERAND (tf, 1));
+ gimplify_seq_add_stmt (&cleanup, gimple_build_call (x, 0));
+ tf = gimple_build_try (seq, cleanup, GIMPLE_TRY_FINALLY);
- bind = build3 (BIND_EXPR, void_type_node, NULL, NULL, NULL);
- TREE_SIDE_EFFECTS (bind) = 1;
x = implicit_built_in_decls[BUILT_IN_PROFILE_FUNC_ENTER];
- x = build_call_expr (x, 0);
- append_to_statement_list (x, &BIND_EXPR_BODY (bind));
- append_to_statement_list (tf, &BIND_EXPR_BODY (bind));
+ gimplify_seq_add_stmt (&body, gimple_build_call (x, 0));
+ gimplify_seq_add_stmt (&body, tf);
+ new_bind = gimple_build_bind (NULL, body, gimple_block (bind));
+ /* Clear the block for BIND, since it is no longer directly inside
+ the function, but within a try block. */
+ gimple_set_block (bind, NULL);
- DECL_SAVED_TREE (fndecl) = bind;
+ /* Replace the current function body with the body
+ wrapped in the try/finally TF. */
+ seq = gimple_seq_alloc ();
+ gimple_seq_add_stmt (&seq, new_bind);
+ gimple_set_body (fndecl, seq);
}
+ DECL_SAVED_TREE (fndecl) = NULL_TREE;
+
current_function_decl = oldfn;
pop_cfun ();
}
-
+
+
+/* Some transformations like inlining may invalidate the GIMPLE form
+ for operands. This function traverses all the operands in STMT and
+ gimplifies anything that is not a valid gimple operand. Any new
+ GIMPLE statements are inserted before *GSI_P. */
+
+void
+gimple_regimplify_operands (gimple stmt, gimple_stmt_iterator *gsi_p)
+{
+ size_t i, num_ops;
+ tree orig_lhs = NULL_TREE, lhs, t;
+ gimple_seq pre = NULL;
+ gimple post_stmt = NULL;
+ struct gimplify_ctx gctx;
+
+ push_gimplify_context (&gctx);
+ gimplify_ctxp->into_ssa = gimple_in_ssa_p (cfun);
+
+ switch (gimple_code (stmt))
+ {
+ case GIMPLE_COND:
+ gimplify_expr (gimple_cond_lhs_ptr (stmt), &pre, NULL,
+ is_gimple_val, fb_rvalue);
+ gimplify_expr (gimple_cond_rhs_ptr (stmt), &pre, NULL,
+ is_gimple_val, fb_rvalue);
+ break;
+ case GIMPLE_OMP_ATOMIC_LOAD:
+ gimplify_expr (gimple_omp_atomic_load_rhs_ptr (stmt), &pre, NULL,
+ is_gimple_val, fb_rvalue);
+ break;
+ case GIMPLE_ASM:
+ {
+ size_t i, noutputs = gimple_asm_noutputs (stmt);
+ const char *constraint, **oconstraints;
+ bool allows_mem, allows_reg, is_inout;
+
+ oconstraints
+ = (const char **) alloca ((noutputs) * sizeof (const char *));
+ for (i = 0; i < noutputs; i++)
+ {
+ tree op = gimple_asm_output_op (stmt, i);
+ constraint = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (op)));
+ oconstraints[i] = constraint;
+ parse_output_constraint (&constraint, i, 0, 0, &allows_mem,
+ &allows_reg, &is_inout);
+ gimplify_expr (&TREE_VALUE (op), &pre, NULL,
+ is_inout ? is_gimple_min_lval : is_gimple_lvalue,
+ fb_lvalue | fb_mayfail);
+ }
+ for (i = 0; i < gimple_asm_ninputs (stmt); i++)
+ {
+ tree op = gimple_asm_input_op (stmt, i);
+ constraint = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (op)));
+ parse_input_constraint (&constraint, 0, 0, noutputs, 0,
+ oconstraints, &allows_mem, &allows_reg);
+ if (TREE_ADDRESSABLE (TREE_TYPE (TREE_VALUE (op))) && allows_mem)
+ allows_reg = 0;
+ if (!allows_reg && allows_mem)
+ gimplify_expr (&TREE_VALUE (op), &pre, NULL,
+ is_gimple_lvalue, fb_lvalue | fb_mayfail);
+ else
+ gimplify_expr (&TREE_VALUE (op), &pre, NULL,
+ is_gimple_asm_val, fb_rvalue);
+ }
+ }
+ break;
+ default:
+ /* NOTE: We start gimplifying operands from last to first to
+ make sure that side-effects on the RHS of calls, assignments
+ and ASMs are executed before the LHS. The ordering is not
+ important for other statements. */
+ num_ops = gimple_num_ops (stmt);
+ orig_lhs = gimple_get_lhs (stmt);
+ for (i = num_ops; i > 0; i--)
+ {
+ tree op = gimple_op (stmt, i - 1);
+ if (op == NULL_TREE)
+ continue;
+ if (i == 1 && (is_gimple_call (stmt) || is_gimple_assign (stmt)))
+ gimplify_expr (&op, &pre, NULL, is_gimple_lvalue, fb_lvalue);
+ else if (i == 2
+ && is_gimple_assign (stmt)
+ && num_ops == 2
+ && get_gimple_rhs_class (gimple_expr_code (stmt))
+ == GIMPLE_SINGLE_RHS)
+ gimplify_expr (&op, &pre, NULL,
+ rhs_predicate_for (gimple_assign_lhs (stmt)),
+ fb_rvalue);
+ else if (i == 2 && is_gimple_call (stmt))
+ {
+ if (TREE_CODE (op) == FUNCTION_DECL)
+ continue;
+ gimplify_expr (&op, &pre, NULL, is_gimple_call_addr, fb_rvalue);
+ }
+ else
+ gimplify_expr (&op, &pre, NULL, is_gimple_val, fb_rvalue);
+ gimple_set_op (stmt, i - 1, op);
+ }
+
+ lhs = gimple_get_lhs (stmt);
+ /* If regimplification of the LHS changed it in a way that requires
+ a simple RHS, create temporary. */
+ if (orig_lhs != lhs && !is_gimple_formal_tmp_var (lhs))
+ {
+ bool need_temp = false;
+
+ if (is_gimple_assign (stmt)
+ && num_ops == 2
+ && get_gimple_rhs_class (gimple_expr_code (stmt))
+ == GIMPLE_SINGLE_RHS)
+ gimplify_expr (gimple_assign_rhs1_ptr (stmt), &pre, NULL,
+ rhs_predicate_for (gimple_assign_lhs (stmt)),
+ fb_rvalue);
+ else if (is_gimple_reg (lhs))
+ {
+ if (is_gimple_reg_type (TREE_TYPE (lhs)))
+ {
+ if (is_gimple_call (stmt))
+ {
+ i = gimple_call_flags (stmt);
+ if ((i & ECF_LOOPING_CONST_OR_PURE)
+ || !(i & (ECF_CONST | ECF_PURE)))
+ need_temp = true;
+ }
+ if (stmt_can_throw_internal (stmt))
+ need_temp = true;
+ }
+ }
+ else
+ {
+ if (is_gimple_reg_type (TREE_TYPE (lhs)))
+ need_temp = true;
+ else if (TYPE_MODE (TREE_TYPE (lhs)) != BLKmode)
+ {
+ if (is_gimple_call (stmt))
+ {
+ tree fndecl = gimple_call_fndecl (stmt);
+
+ if (!aggregate_value_p (TREE_TYPE (lhs), fndecl)
+ && !(fndecl && DECL_RESULT (fndecl)
+ && DECL_BY_REFERENCE (DECL_RESULT (fndecl))))
+ need_temp = true;
+ }
+ else
+ need_temp = true;
+ }
+ }
+ if (need_temp)
+ {
+ tree temp = create_tmp_var (TREE_TYPE (lhs), NULL);
+
+ DECL_GIMPLE_FORMAL_TEMP_P (temp) = 1;
+ if (TREE_CODE (TREE_TYPE (lhs)) == COMPLEX_TYPE
+ || TREE_CODE (TREE_TYPE (lhs)) == VECTOR_TYPE)
+ DECL_GIMPLE_REG_P (temp) = 1;
+ if (TREE_CODE (orig_lhs) == SSA_NAME)
+ orig_lhs = SSA_NAME_VAR (orig_lhs);
+ if (TREE_CODE (orig_lhs) == VAR_DECL
+ && DECL_BASED_ON_RESTRICT_P (orig_lhs))
+ {
+ DECL_BASED_ON_RESTRICT_P (temp) = 1;
+ SET_DECL_RESTRICT_BASE (temp,
+ DECL_GET_RESTRICT_BASE (orig_lhs));
+ }
+
+ if (gimple_in_ssa_p (cfun))
+ temp = make_ssa_name (temp, NULL);
+ gimple_set_lhs (stmt, temp);
+ post_stmt = gimple_build_assign (lhs, temp);
+ if (TREE_CODE (lhs) == SSA_NAME)
+ SSA_NAME_DEF_STMT (lhs) = post_stmt;
+ }
+ }
+ break;
+ }
+
+ if (!gimple_seq_empty_p (pre))
+ {
+ if (gimple_in_ssa_p (cfun))
+ {
+ gimple_stmt_iterator i;
+
+ for (i = gsi_start (pre); !gsi_end_p (i); gsi_next (&i))
+ mark_symbols_for_renaming (gsi_stmt (i));
+ }
+ gsi_insert_seq_before (gsi_p, pre, GSI_SAME_STMT);
+ }
+ if (post_stmt)
+ gsi_insert_after (gsi_p, post_stmt, GSI_NEW_STMT);
+
+ if (gimple_referenced_vars (cfun))
+ for (t = gimplify_ctxp->temps; t ; t = TREE_CHAIN (t))
+ add_referenced_var (t);
+
+ pop_gimplify_context (NULL);
+}
+
+
/* Expands EXPR to list of gimple statements STMTS. If SIMPLE is true,
force the result to be either ssa_name or an invariant, otherwise
just force it to be a rhs expression. If VAR is not NULL, make the
base variable of the final destination be VAR if suitable. */
tree
-force_gimple_operand (tree expr, tree *stmts, bool simple, tree var)
+force_gimple_operand (tree expr, gimple_seq *stmts, bool simple, tree var)
{
tree t;
enum gimplify_status ret;
gimple_predicate gimple_test_f;
struct gimplify_ctx gctx;
- *stmts = NULL_TREE;
+ *stmts = NULL;
if (is_gimple_val (expr))
return expr;
@@ -6794,9 +7555,9 @@ force_gimple_operand (tree expr, tree *stmts, bool simple, tree var)
gimplify_ctxp->allow_rhs_cond_expr = true;
if (var)
- expr = build_gimple_modify_stmt (var, expr);
+ expr = build2 (MODIFY_EXPR, TREE_TYPE (var), var, expr);
- if (TREE_CODE (expr) != GIMPLE_MODIFY_STMT
+ if (TREE_CODE (expr) != MODIFY_EXPR
&& TREE_TYPE (expr) == void_type_node)
{
gimplify_and_add (expr, stmts);
@@ -6804,16 +7565,13 @@ force_gimple_operand (tree expr, tree *stmts, bool simple, tree var)
}
else
{
- ret = gimplify_expr (&expr, stmts, NULL,
- gimple_test_f, fb_rvalue);
+ ret = gimplify_expr (&expr, stmts, NULL, gimple_test_f, fb_rvalue);
gcc_assert (ret != GS_ERROR);
}
if (gimple_referenced_vars (cfun))
- {
- for (t = gimplify_ctxp->temps; t ; t = TREE_CHAIN (t))
- add_referenced_var (t);
- }
+ for (t = gimplify_ctxp->temps; t ; t = TREE_CHAIN (t))
+ add_referenced_var (t);
pop_gimplify_context (NULL);
@@ -6821,33 +7579,34 @@ force_gimple_operand (tree expr, tree *stmts, bool simple, tree var)
}
/* Invokes force_gimple_operand for EXPR with parameters SIMPLE_P and VAR. If
- some statements are produced, emits them at BSI. If BEFORE is true.
- the statements are appended before BSI, otherwise they are appended after
- it. M specifies the way BSI moves after insertion (BSI_SAME_STMT or
- BSI_CONTINUE_LINKING are the usual values). */
+ some statements are produced, emits them at GSI. If BEFORE is true.
+ the statements are appended before GSI, otherwise they are appended after
+ it. M specifies the way GSI moves after insertion (GSI_SAME_STMT or
+ GSI_CONTINUE_LINKING are the usual values). */
tree
-force_gimple_operand_bsi (block_stmt_iterator *bsi, tree expr,
+force_gimple_operand_gsi (gimple_stmt_iterator *gsi, tree expr,
bool simple_p, tree var, bool before,
- enum bsi_iterator_update m)
+ enum gsi_iterator_update m)
{
- tree stmts;
+ gimple_seq stmts;
expr = force_gimple_operand (expr, &stmts, simple_p, var);
- if (stmts)
+
+ if (!gimple_seq_empty_p (stmts))
{
if (gimple_in_ssa_p (cfun))
{
- tree_stmt_iterator tsi;
+ gimple_stmt_iterator i;
- for (tsi = tsi_start (stmts); !tsi_end_p (tsi); tsi_next (&tsi))
- mark_symbols_for_renaming (tsi_stmt (tsi));
+ for (i = gsi_start (stmts); !gsi_end_p (i); gsi_next (&i))
+ mark_symbols_for_renaming (gsi_stmt (i));
}
if (before)
- bsi_insert_before (bsi, stmts, m);
+ gsi_insert_seq_before (gsi, stmts, m);
else
- bsi_insert_after (bsi, stmts, m);
+ gsi_insert_seq_after (gsi, stmts, m);
}
return expr;
diff --git a/gcc/global.c b/gcc/global.c
index 9c22e91f857..690a80c8a85 100644
--- a/gcc/global.c
+++ b/gcc/global.c
@@ -233,6 +233,7 @@ compute_regsets (HARD_REG_SET *elim_set,
= (! flag_omit_frame_pointer
|| (cfun->calls_alloca && EXIT_IGNORE_STACK)
|| crtl->accesses_prior_frames
+ || crtl->stack_realign_needed
|| FRAME_POINTER_REQUIRED);
frame_pointer_needed = need_fp;
@@ -256,7 +257,10 @@ compute_regsets (HARD_REG_SET *elim_set,
{
bool cannot_elim
= (! CAN_ELIMINATE (eliminables[i].from, eliminables[i].to)
- || (eliminables[i].to == STACK_POINTER_REGNUM && need_fp));
+ || (eliminables[i].to == STACK_POINTER_REGNUM
+ && need_fp
+ && (! SUPPORTS_STACK_ALIGNMENT
+ || ! stack_realign_fp)));
if (!regs_asm_clobbered[eliminables[i].from])
{
@@ -978,7 +982,7 @@ find_reg (int num, HARD_REG_SET losers, int alt_regs_p, int accept_call_clobbere
int i, best_reg, pass;
HARD_REG_SET used, used1, used2;
- enum reg_class class = (alt_regs_p
+ enum reg_class rclass = (alt_regs_p
? reg_alternate_class (allocno[num].reg)
: reg_preferred_class (allocno[num].reg));
enum machine_mode mode = PSEUDO_REGNO_MODE (allocno[num].reg);
@@ -995,7 +999,7 @@ find_reg (int num, HARD_REG_SET losers, int alt_regs_p, int accept_call_clobbere
if (losers)
IOR_HARD_REG_SET (used1, losers);
- IOR_COMPL_HARD_REG_SET (used1, reg_class_contents[(int) class]);
+ IOR_COMPL_HARD_REG_SET (used1, reg_class_contents[(int) rclass]);
#ifdef EH_RETURN_DATA_REGNO
if (allocno[num].no_eh_reg)
diff --git a/gcc/graph.c b/gcc/graph.c
index e59adbc3677..643571b6af2 100644
--- a/gcc/graph.c
+++ b/gcc/graph.c
@@ -165,25 +165,25 @@ darkgrey\n shape: ellipse" : "white",
}
static void
-draw_edge (FILE *fp, int from, int to, int bb_edge, int class)
+draw_edge (FILE *fp, int from, int to, int bb_edge, int color_class)
{
const char * color;
switch (graph_dump_format)
{
case vcg:
color = "";
- if (class == 2)
+ if (color_class == 2)
color = "color: red ";
else if (bb_edge)
color = "color: blue ";
- else if (class == 3)
+ else if (color_class == 3)
color = "color: green ";
fprintf (fp,
"edge: { sourcename: \"%s.%d\" targetname: \"%s.%d\" %s",
current_function_name (), from,
current_function_name (), to, color);
- if (class)
- fprintf (fp, "class: %d ", class);
+ if (color_class)
+ fprintf (fp, "class: %d ", color_class);
fputs ("}\n", fp);
break;
case no_graph:
diff --git a/gcc/gsstruct.def b/gcc/gsstruct.def
new file mode 100644
index 00000000000..b524a37bcf4
--- /dev/null
+++ b/gcc/gsstruct.def
@@ -0,0 +1,48 @@
+/* This file contains the definitions for the gimple IR structure
+ enumeration used in GCC.
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Contributed by Aldy Hernandez <aldyh@redhat.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+/* The format of this file is
+ DEFGSSTRUCT(GSS_enumeration value, printable name).
+ Each enum value should correspond with a single member of the union
+ gimple_statement_d. */
+
+DEFGSSTRUCT(GSS_BASE, "base")
+DEFGSSTRUCT(GSS_WITH_OPS, "with_ops")
+DEFGSSTRUCT(GSS_WITH_MEM_OPS, "with_mem_ops")
+DEFGSSTRUCT(GSS_OMP, "omp")
+DEFGSSTRUCT(GSS_BIND, "bind")
+DEFGSSTRUCT(GSS_CATCH, "catch")
+DEFGSSTRUCT(GSS_EH_FILTER, "eh_filter")
+DEFGSSTRUCT(GSS_PHI, "phi")
+DEFGSSTRUCT(GSS_RESX, "resx")
+DEFGSSTRUCT(GSS_TRY, "try")
+DEFGSSTRUCT(GSS_WCE, "with_cleanup_expression")
+DEFGSSTRUCT(GSS_ASM, "asm")
+DEFGSSTRUCT(GSS_OMP_CRITICAL, "omp_critical")
+DEFGSSTRUCT(GSS_OMP_FOR, "omp_for")
+DEFGSSTRUCT(GSS_OMP_PARALLEL, "omp_parallel")
+DEFGSSTRUCT(GSS_OMP_TASK, "omp_task")
+DEFGSSTRUCT(GSS_OMP_SECTIONS, "sections")
+DEFGSSTRUCT(GSS_OMP_SINGLE, "single")
+DEFGSSTRUCT(GSS_OMP_CONTINUE, "omp_continue")
+DEFGSSTRUCT(GSS_OMP_ATOMIC_LOAD, "omp_atomic_load")
+DEFGSSTRUCT(GSS_OMP_ATOMIC_STORE, "omp_atomic_store")
diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index d614986b49c..76282bd0ced 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -544,8 +544,6 @@ static void change_queue_index (rtx, int);
static void extend_h_i_d (void);
static void extend_ready (int);
-static void extend_global (rtx);
-static void extend_all (rtx);
static void init_h_i_d (rtx);
static void generate_recovery_code (rtx);
static void process_insn_forw_deps_be_in_spec (rtx, rtx, ds_t);
@@ -3188,36 +3186,45 @@ extend_ready (int n_new_insns)
choice_stack[i].state = xmalloc (dfa_state_size);
}
-/* Extend global scheduler structures (those, that live across calls to
- schedule_block) to include information about just emitted INSN. */
+/* Extend global-scope scheduler data structures
+ (those, that live within one call to schedule_insns)
+ to include information about just emitted INSN. */
static void
-extend_global (rtx insn)
+extend_global_data (rtx insn)
{
gcc_assert (INSN_P (insn));
- /* These structures have scheduler scope. */
-
/* Init h_i_d. */
extend_h_i_d ();
init_h_i_d (insn);
- /* Init data handled in sched-deps.c. */
- sd_init_insn (insn);
-
/* Extend dependency caches by one element. */
extend_dependency_caches (1, false);
}
-/* Extends global and local scheduler structures to include information
- about just emitted INSN. */
+/* Extend global- and region-scope scheduler data structures
+ (those, that live within one call to schedule_region)
+ to include information about just emitted INSN. */
+static void
+extend_region_data (rtx insn)
+{
+ extend_global_data (insn);
+
+ /* Init dependency data. */
+ sd_init_insn (insn);
+}
+
+/* Extend global-, region- and block-scope scheduler data structures
+ (those, that live within one call to schedule_block)
+ to include information about just emitted INSN. */
static void
-extend_all (rtx insn)
-{
- extend_global (insn);
+extend_block_data (rtx insn)
+{
+ extend_region_data (insn);
/* These structures have block scope. */
extend_ready (1);
-
+
(*current_sched_info->add_remove_insn) (insn, 0);
}
@@ -3391,7 +3398,7 @@ add_to_speculative_block (rtx insn)
rec = BLOCK_FOR_INSN (check);
twin = emit_insn_before (copy_insn (PATTERN (insn)), BB_END (rec));
- extend_global (twin);
+ extend_region_data (twin);
sd_copy_back_deps (twin, insn, true);
@@ -3581,7 +3588,7 @@ init_before_recovery (void)
x = emit_jump_insn_after (gen_jump (label), BB_END (single));
JUMP_LABEL (x) = label;
LABEL_NUSES (label)++;
- extend_global (x);
+ extend_global_data (x);
emit_barrier_after (x);
@@ -3681,7 +3688,7 @@ create_check_block_twin (rtx insn, bool mutate_p)
check = emit_insn_before (check, insn);
/* Extend data structures. */
- extend_all (check);
+ extend_block_data (check);
RECOVERY_BLOCK (check) = rec;
if (sched_verbose && spec_info->dump)
@@ -3708,7 +3715,7 @@ create_check_block_twin (rtx insn, bool mutate_p)
}
twin = emit_insn_after (ORIG_PAT (insn), BB_END (rec));
- extend_global (twin);
+ extend_region_data (twin);
if (sched_verbose && spec_info->dump)
/* INSN_BB (insn) isn't determined for twin insns yet.
@@ -3761,7 +3768,7 @@ create_check_block_twin (rtx insn, bool mutate_p)
jump = emit_jump_insn_after (gen_jump (label), BB_END (rec));
JUMP_LABEL (jump) = label;
LABEL_NUSES (label)++;
- extend_global (jump);
+ extend_region_data (jump);
if (BB_PARTITION (second_bb) != BB_PARTITION (rec))
/* Partition type is the same, if it is "unpartitioned". */
@@ -4012,32 +4019,6 @@ change_pattern (rtx insn, rtx new_pat)
dfa_clear_single_insn_cache (insn);
}
-/* Return true if INSN can potentially be speculated with type DS. */
-bool
-sched_insn_is_legitimate_for_speculation_p (const_rtx insn, ds_t ds)
-{
- if (HAS_INTERNAL_DEP (insn))
- return false;
-
- if (!NONJUMP_INSN_P (insn))
- return false;
-
- if (SCHED_GROUP_P (insn))
- return false;
-
- if (IS_SPECULATION_CHECK_P (insn))
- return false;
-
- if (side_effects_p (PATTERN (insn)))
- return false;
-
- if ((ds & BE_IN_SPEC)
- && may_trap_p (PATTERN (insn)))
- return false;
-
- return true;
-}
-
/* -1 - can't speculate,
0 - for speculation with REQUEST mode it is OK to use
current instruction pattern,
diff --git a/gcc/input.h b/gcc/input.h
index 5d432592315..299f56c3ce6 100644
--- a/gcc/input.h
+++ b/gcc/input.h
@@ -41,6 +41,9 @@ typedef struct GTY (())
int line;
int column;
+
+ /* In a system header?. */
+ bool sysp;
} expanded_location;
extern expanded_location expand_location (source_location);
@@ -59,5 +62,7 @@ extern location_t input_location;
#define input_line LOCATION_LINE (input_location)
#define input_filename LOCATION_FILE (input_location)
+#define in_system_header_at(LOC) ((expand_location (LOC)).sysp != 0)
+#define in_system_header (in_system_header_at (input_location))
#endif
diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index bda0fc261d6..a129a74c7ff 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -183,6 +183,18 @@ ipcp_lat_is_const (struct ipcp_lattice *lat)
return false;
}
+/* Return whether LAT is a constant lattice that ipa-cp can actually insert
+ into the code (i.e. constants excluding member pointers and pointers). */
+static inline bool
+ipcp_lat_is_insertable (struct ipcp_lattice *lat)
+{
+ if ((lat->type == IPA_CONST_VALUE || lat->type == IPA_CONST_VALUE_REF)
+ && !POINTER_TYPE_P (TREE_TYPE (lat->constant)))
+ return true;
+ else
+ return false;
+}
+
/* Return true if LAT1 and LAT2 are equal. */
static inline bool
ipcp_lats_are_equal (struct ipcp_lattice *lat1, struct ipcp_lattice *lat2)
@@ -247,9 +259,7 @@ static void
ipcp_lattice_from_jfunc (struct ipa_node_params *info, struct ipcp_lattice *lat,
struct ipa_jump_func *jfunc)
{
- if (jfunc->type == IPA_UNKNOWN)
- lat->type = IPA_BOTTOM;
- else if (jfunc->type == IPA_CONST)
+ if (jfunc->type == IPA_CONST)
{
lat->type = IPA_CONST_VALUE;
lat->constant = jfunc->value.constant;
@@ -267,17 +277,21 @@ ipcp_lattice_from_jfunc (struct ipa_node_params *info, struct ipcp_lattice *lat,
lat->type = caller_lat->type;
lat->constant = caller_lat->constant;
}
+ else
+ lat->type = IPA_BOTTOM;
}
-/* True when OLD and NEW values are not the same. */
+/* True when OLD_LAT and NEW_LAT values are not the same. */
+
static bool
-ipcp_lattice_changed (struct ipcp_lattice *old, struct ipcp_lattice *new)
+ipcp_lattice_changed (struct ipcp_lattice *old_lat,
+ struct ipcp_lattice *new_lat)
{
- if (old->type == new->type)
+ if (old_lat->type == new_lat->type)
{
- if (!ipcp_lat_is_const (old))
+ if (!ipcp_lat_is_const (old_lat))
return false;
- if (ipcp_lats_are_equal (old, new))
+ if (ipcp_lats_are_equal (old_lat, new_lat))
return false;
}
return true;
@@ -293,23 +307,28 @@ ipcp_print_all_lattices (FILE * f)
fprintf (f, "\nLATTICE PRINT\n");
for (node = cgraph_nodes; node; node = node->next)
{
- struct ipa_node_params *info = IPA_NODE_REF (node);
+ struct ipa_node_params *info;
+
+ if (!node->analyzed)
+ continue;
+ info = IPA_NODE_REF (node);
fprintf (f, "Printing lattices %s:\n", cgraph_node_name (node));
count = ipa_get_param_count (info);
for (i = 0; i < count; i++)
{
struct ipcp_lattice *lat = ipcp_get_ith_lattice (info, i);
+
+ fprintf (f, " param [%d]: ", i);
if (lat->type == IPA_CONST_VALUE || lat->type == IPA_CONST_VALUE_REF)
{
- fprintf (f, " param [%d]: ", i);
fprintf (f, "type is CONST ");
print_generic_expr (f, lat->constant, 0);
fprintf (f, "\n");
}
else if (lat->type == IPA_TOP)
- fprintf (f, "param [%d]: type is TOP \n", i);
+ fprintf (f, "type is TOP\n");
else
- fprintf (f, "param [%d]: type is BOTTOM \n", i);
+ fprintf (f, "type is BOTTOM\n");
}
}
}
@@ -342,18 +361,15 @@ ipcp_initialize_node_lattices (struct cgraph_node *node)
/* Create a new assignment statement and make it the first statement in the
function. PARM1 is the lhs of the assignment and VAL is the rhs. */
static void
-constant_val_insert (tree parm1, tree val)
+constant_val_insert (tree parm1 ATTRIBUTE_UNUSED, tree val ATTRIBUTE_UNUSED)
{
- tree init_stmt = NULL;
+ gimple init_stmt = NULL;
edge e_step;
- init_stmt = build_gimple_modify_stmt (parm1, val);
-
- if (init_stmt)
- {
- e_step = single_succ_edge (ENTRY_BLOCK_PTR_FOR_FUNCTION (cfun));
- bsi_insert_on_edge_immediate (e_step, init_stmt);
- }
+ init_stmt = gimple_build_assign (parm1, val);
+ gcc_assert (init_stmt);
+ e_step = single_succ_edge (ENTRY_BLOCK_PTR_FOR_FUNCTION (cfun));
+ gsi_insert_on_edge_immediate (e_step, init_stmt);
}
/* build INTEGER_CST tree with type TREE_TYPE and value according to LAT.
@@ -413,6 +429,11 @@ ipcp_init_stage (void)
for (node = cgraph_nodes; node; node = node->next)
{
+ if (!node->analyzed)
+ continue;
+ /* Unreachable nodes should have been eliminated before ipcp. */
+ gcc_assert (node->needed || node->reachable);
+
ipa_count_formal_params (node);
ipa_create_param_decls_array (node);
ipcp_initialize_node_lattices (node);
@@ -421,9 +442,13 @@ ipcp_init_stage (void)
}
for (node = cgraph_nodes; node; node = node->next)
{
+ if (!node->analyzed)
+ continue;
/* building jump functions */
for (cs = node->callees; cs; cs = cs->next_callee)
{
+ if (!cs->callee->analyzed)
+ continue;
ipa_count_arguments (cs);
if (ipa_get_cs_argument_count (IPA_EDGE_REF (cs))
!= ipa_get_param_count (IPA_NODE_REF (cs->callee)))
@@ -480,6 +505,8 @@ ipcp_propagate_stage (void)
struct ipa_func_list *wl;
int count;
+ ipa_check_create_node_params ();
+ ipa_check_create_edge_args ();
/* Initialize worklist to contain all functions. */
wl = ipa_init_func_list ();
while (wl)
@@ -536,54 +563,6 @@ ipcp_node_not_modifiable_p (struct cgraph_node *node)
return false;
}
-/* Print ipa_jump_func data structures to F. */
-static void
-ipcp_print_all_jump_functions (FILE * f)
-{
- struct cgraph_node *node;
- int i, count;
- struct cgraph_edge *cs;
- struct ipa_jump_func *jump_func;
- enum jump_func_type type;
- tree info_type;
-
- fprintf (f, "\nCALLSITE PARAM PRINT\n");
- for (node = cgraph_nodes; node; node = node->next)
- {
- for (cs = node->callees; cs; cs = cs->next_callee)
- {
- fprintf (f, "callsite %s ", cgraph_node_name (node));
- fprintf (f, "-> %s :: \n", cgraph_node_name (cs->callee));
-
- if (ipa_is_called_with_var_arguments (IPA_NODE_REF (cs->callee)))
- continue;
-
- count = ipa_get_cs_argument_count (IPA_EDGE_REF (cs));
- for (i = 0; i < count; i++)
- {
- jump_func = ipa_get_ith_jump_func (IPA_EDGE_REF (cs), i);
- type = jump_func->type;
-
- fprintf (f, " param %d: ", i);
- if (type == IPA_UNKNOWN)
- fprintf (f, "UNKNOWN\n");
- else if (type == IPA_CONST || type == IPA_CONST_REF)
- {
- info_type = jump_func->value.constant;
- fprintf (f, "CONST : ");
- print_generic_expr (f, info_type, 0);
- fprintf (f, "\n");
- }
- else if (type == IPA_PASS_THROUGH)
- {
- fprintf (f, "PASS THROUGH : ");
- fprintf (f, "%d\n", jump_func->value.formal_id);
- }
- }
- }
- }
-}
-
/* Print count scale data structures. */
static void
ipcp_function_scale_print (FILE * f)
@@ -592,6 +571,8 @@ ipcp_function_scale_print (FILE * f)
for (node = cgraph_nodes; node; node = node->next)
{
+ if (!node->analyzed)
+ continue;
fprintf (f, "printing scale for %s: ", cgraph_node_name (node));
fprintf (f, "value is " HOST_WIDE_INT_PRINT_DEC
" \n", (HOST_WIDE_INT) ipcp_get_node_scale (node));
@@ -643,7 +624,7 @@ ipcp_print_edge_profiles (FILE * f)
for (node = cgraph_nodes; node; node = node->next)
{
fprintf (f, "function %s: \n", cgraph_node_name (node));
- if (DECL_SAVED_TREE (node->decl))
+ if (node->analyzed)
{
bb =
ENTRY_BLOCK_PTR_FOR_FUNCTION (DECL_STRUCT_FUNCTION (node->decl));
@@ -730,8 +711,8 @@ ipcp_print_all_structures (FILE * f)
ipcp_print_all_lattices (f);
ipcp_function_scale_print (f);
ipa_print_all_tree_maps (f);
- ipa_print_all_params_modified (f);
- ipcp_print_all_jump_functions (f);
+ ipa_print_all_param_flags (f);
+ ipa_print_all_jump_functions (f);
}
/* Print profile info for all functions. */
@@ -760,10 +741,8 @@ ipcp_create_replace_map (struct function *func, tree parm_tree,
tree const_val;
replace_map = XCNEW (struct ipa_replace_map);
- gcc_assert (ipcp_lat_is_const (lat));
- if (lat->type != IPA_CONST_VALUE_REF
- && is_gimple_reg (parm_tree) && gimple_default_def (func, parm_tree)
- && !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (gimple_default_def (func,
+ if (is_gimple_reg (parm_tree) && gimple_default_def (func, parm_tree)
+ && !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (gimple_default_def (func,
parm_tree)))
{
if (dump_file)
@@ -820,7 +799,7 @@ ipcp_update_callgraph (void)
for (node = cgraph_nodes; node; node = node->next)
{
/* want to fix only original nodes */
- if (ipcp_node_is_clone (node))
+ if (!node->analyzed || ipcp_node_is_clone (node))
continue;
for (cs = node->callees; cs; cs = cs->next_callee)
if (ipcp_node_is_clone (cs->callee))
@@ -830,9 +809,7 @@ ipcp_update_callgraph (void)
if (ipcp_need_redirect_p (cs))
{
cgraph_redirect_edge_callee (cs, orig_callee);
- TREE_OPERAND (CALL_EXPR_FN (get_call_expr_in (cs->call_stmt)),
- 0) =
- orig_callee->decl;
+ gimple_call_set_fndecl (cs->call_stmt, orig_callee->decl);
}
}
}
@@ -906,20 +883,24 @@ ipcp_insert_stage (void)
tree parm_tree;
struct ipa_replace_map *replace_param;
+ ipa_check_create_node_params ();
+ ipa_check_create_edge_args ();
+
for (node = cgraph_nodes; node; node = node->next)
{
- struct ipa_node_params *info = IPA_NODE_REF (node);
- /* Propagation of the constant is forbidden in
- certain conditions. */
- if (!node->analyzed || ipcp_node_not_modifiable_p (node)
- || ipa_is_called_with_var_arguments (info))
+ struct ipa_node_params *info;
+ /* Propagation of the constant is forbidden in certain conditions. */
+ if (!node->analyzed || ipcp_node_not_modifiable_p (node))
+ continue;
+ info = IPA_NODE_REF (node);
+ if (ipa_is_called_with_var_arguments (info))
continue;
const_param = 0;
count = ipa_get_param_count (info);
for (i = 0; i < count; i++)
{
struct ipcp_lattice *lat = ipcp_get_ith_lattice (info, i);
- if (ipcp_lat_is_const (lat))
+ if (ipcp_lat_is_insertable (lat))
const_param++;
}
if (const_param == 0)
@@ -928,7 +909,8 @@ ipcp_insert_stage (void)
for (i = 0; i < count; i++)
{
struct ipcp_lattice *lat = ipcp_get_ith_lattice (info, i);
- if (ipcp_lat_is_const (lat))
+ if (lat->type == IPA_CONST_VALUE
+ && !POINTER_TYPE_P (TREE_TYPE (lat->constant)))
{
parm_tree = ipa_get_ith_param (info, i);
replace_param =
@@ -959,13 +941,13 @@ ipcp_insert_stage (void)
if (const_param > 0)
{
push_cfun (DECL_STRUCT_FUNCTION (node1->decl));
- tree_register_cfg_hooks ();
+ gimple_register_cfg_hooks ();
current_function_decl = node1->decl;
for (i = 0; i < count; i++)
{
struct ipcp_lattice *lat = ipcp_get_ith_lattice (info, i);
- if (ipcp_lat_is_const (lat))
+ if (ipcp_lat_is_insertable (lat))
{
parm_tree = ipa_get_ith_param (info, i);
if (lat->type != IPA_CONST_VALUE_REF
diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c
index 6d74c1f71b7..ec3a2719ac2 100644
--- a/gcc/ipa-inline.c
+++ b/gcc/ipa-inline.c
@@ -60,7 +60,7 @@ along with GCC; see the file COPYING3. If not see
cgraph_decide_inlining implements heuristics taking whole callgraph
into account, while cgraph_decide_inlining_incrementally considers
- only one function at a time and is used in non-unit-at-a-time mode.
+ only one function at a time and is used by early inliner.
The inliner itself is split into several passes:
@@ -82,15 +82,13 @@ along with GCC; see the file COPYING3. If not see
to do inlining expanding code size it might result in unbounded growth of
whole unit.
- This is the main inlining pass in non-unit-at-a-time.
-
- With unit-at-a-time the pass is run during conversion into SSA form.
- Only functions already converted into SSA form are inlined, so the
- conversion must happen in topological order on the callgraph (that is
- maintained by pass manager). The functions after inlining are early
- optimized so the early inliner sees unoptimized function itself, but
- all considered callees are already optimized allowing it to unfold
- abstraction penalty on C++ effectively and cheaply.
+ The pass is run during conversion into SSA form. Only functions already
+ converted into SSA form are inlined, so the conversion must happen in
+ topological order on the callgraph (that is maintained by pass manager).
+ The functions after inlining are early optimized so the early inliner sees
+ unoptimized function itself, but all considered callees are already
+ optimized allowing it to unfold abstraction penalty on C++ effectively and
+ cheaply.
pass_ipa_early_inlining
@@ -139,6 +137,7 @@ along with GCC; see the file COPYING3. If not see
#include "ggc.h"
#include "tree-flow.h"
#include "rtl.h"
+#include "ipa-prop.h"
/* Mode incremental inliner operate on:
@@ -149,16 +148,11 @@ along with GCC; see the file COPYING3. If not see
In SIZE mode, only functions that reduce function body size after inlining
are inlined, this is used during early inlining.
- In SPEED mode, all small functions are inlined. This might result in
- unbounded growth of compilation unit and is used only in non-unit-at-a-time
- mode.
-
in ALL mode, everything is inlined. This is used during flattening. */
enum inlining_mode {
INLINE_NONE = 0,
INLINE_ALWAYS_INLINE,
INLINE_SIZE,
- INLINE_SPEED,
INLINE_ALL
};
static bool
@@ -201,20 +195,21 @@ cgraph_estimate_size_after_inlining (int times, struct cgraph_node *to,
clones or re-using node originally representing out-of-line function call.
*/
void
-cgraph_clone_inlined_nodes (struct cgraph_edge *e, bool duplicate, bool update_original)
+cgraph_clone_inlined_nodes (struct cgraph_edge *e, bool duplicate,
+ bool update_original)
{
HOST_WIDE_INT peak;
+
if (duplicate)
{
/* We may eliminate the need for out-of-line copy to be output.
In that case just go ahead and re-use it. */
if (!e->callee->callers->next_caller
&& !e->callee->needed
- && !cgraph_new_nodes
- && flag_unit_at_a_time)
+ && !cgraph_new_nodes)
{
gcc_assert (!e->callee->global.inlined_to);
- if (DECL_SAVED_TREE (e->callee->decl))
+ if (gimple_body (e->callee->decl))
overall_insns -= e->callee->global.insns, nfunctions_inlined++;
duplicate = false;
}
@@ -261,7 +256,7 @@ cgraph_mark_inline_edge (struct cgraph_edge *e, bool update_original)
gcc_assert (e->inline_failed);
e->inline_failed = NULL;
- if (!e->callee->global.inlined && flag_unit_at_a_time)
+ if (!e->callee->global.inlined)
DECL_POSSIBLY_INLINED (e->callee->decl) = true;
e->callee->global.inlined = true;
@@ -296,7 +291,7 @@ cgraph_mark_inline (struct cgraph_edge *edge)
struct cgraph_node *what = edge->callee;
struct cgraph_edge *e, *next;
- gcc_assert (!CALL_STMT_CANNOT_INLINE_P (edge->call_stmt));
+ gcc_assert (!gimple_call_cannot_inline_p (edge->call_stmt));
/* Look for all calls, mark them inline and clone recursively
all inlined functions. */
for (e = what->callers; e; e = next)
@@ -660,10 +655,12 @@ lookup_recursive_calls (struct cgraph_node *node, struct cgraph_node *where,
}
/* Decide on recursive inlining: in the case function has recursive calls,
- inline until body size reaches given argument. */
+ inline until body size reaches given argument. If any new indirect edges
+ are discovered in the process, add them to NEW_EDGES, unless it is NULL. */
static bool
-cgraph_decide_recursive_inlining (struct cgraph_node *node)
+cgraph_decide_recursive_inlining (struct cgraph_node *node,
+ VEC (cgraph_edge_p, heap) *new_edges)
{
int limit = PARAM_VALUE (PARAM_MAX_INLINE_INSNS_RECURSIVE_AUTO);
int max_depth = PARAM_VALUE (PARAM_MAX_INLINE_RECURSIVE_DEPTH_AUTO);
@@ -760,6 +757,8 @@ cgraph_decide_recursive_inlining (struct cgraph_node *node)
}
cgraph_redirect_edge_callee (curr, master_clone);
cgraph_mark_inline_edge (curr, false);
+ if (flag_indirect_inlining)
+ ipa_propagate_indirect_call_infos (curr, new_edges);
lookup_recursive_calls (node, curr->callee, heap);
n++;
}
@@ -817,6 +816,20 @@ compute_max_insns (int insns)
* (100 + PARAM_VALUE (PARAM_INLINE_UNIT_GROWTH)) / 100);
}
+/* Compute badness of all edges in NEW_EDGES and add them to the HEAP. */
+static void
+add_new_edges_to_heap (fibheap_t heap, VEC (cgraph_edge_p, heap) *new_edges)
+{
+ while (VEC_length (cgraph_edge_p, new_edges) > 0)
+ {
+ struct cgraph_edge *edge = VEC_pop (cgraph_edge_p, new_edges);
+
+ gcc_assert (!edge->aux);
+ edge->aux = fibheap_insert (heap, cgraph_edge_badness (edge), edge);
+ }
+}
+
+
/* We use greedy algorithm for inlining of small functions:
All inline candidates are put into prioritized heap based on estimated
growth of the overall number of instructions and then update the estimates.
@@ -833,6 +846,10 @@ cgraph_decide_inlining_of_small_functions (void)
fibheap_t heap = fibheap_new ();
bitmap updated_nodes = BITMAP_ALLOC (NULL);
int min_insns, max_insns;
+ VEC (cgraph_edge_p, heap) *new_indirect_edges = NULL;
+
+ if (flag_indirect_inlining)
+ new_indirect_edges = VEC_alloc (cgraph_edge_p, heap, 8);
if (dump_file)
fprintf (dump_file, "\nDeciding on smaller functions:\n");
@@ -954,20 +971,30 @@ cgraph_decide_inlining_of_small_functions (void)
}
continue;
}
+ if (!tree_can_inline_p (edge->caller->decl, edge->callee->decl))
+ {
+ gimple_call_set_cannot_inline (edge->call_stmt, true);
+ edge->inline_failed = N_("target specific option mismatch");
+ if (dump_file)
+ fprintf (dump_file, " inline_failed:%s.\n", edge->inline_failed);
+ continue;
+ }
if (cgraph_recursive_inlining_p (edge->caller, edge->callee,
&edge->inline_failed))
{
where = edge->caller;
if (where->global.inlined_to)
where = where->global.inlined_to;
- if (!cgraph_decide_recursive_inlining (where))
+ if (!cgraph_decide_recursive_inlining (where, new_indirect_edges))
continue;
+ if (flag_indirect_inlining)
+ add_new_edges_to_heap (heap, new_indirect_edges);
update_callee_keys (heap, where, updated_nodes);
}
else
{
struct cgraph_node *callee;
- if (CALL_STMT_CANNOT_INLINE_P (edge->call_stmt)
+ if (gimple_call_cannot_inline_p (edge->call_stmt)
|| !cgraph_check_inline_limits (edge->caller, edge->callee,
&edge->inline_failed, true))
{
@@ -978,6 +1005,11 @@ cgraph_decide_inlining_of_small_functions (void)
}
callee = edge->callee;
cgraph_mark_inline_edge (edge, true);
+ if (flag_indirect_inlining)
+ {
+ ipa_propagate_indirect_call_infos (edge, new_indirect_edges);
+ add_new_edges_to_heap (heap, new_indirect_edges);
+ }
update_callee_keys (heap, callee, updated_nodes);
}
where = edge->caller;
@@ -1020,6 +1052,9 @@ cgraph_decide_inlining_of_small_functions (void)
&edge->inline_failed))
edge->inline_failed = N_("--param inline-unit-growth limit reached");
}
+
+ if (new_indirect_edges)
+ VEC_free (cgraph_edge_p, heap, new_indirect_edges);
fibheap_delete (heap);
BITMAP_FREE (updated_nodes);
}
@@ -1093,12 +1128,19 @@ cgraph_decide_inlining (void)
for (e = node->callers; e; e = next)
{
next = e->next_caller;
- if (!e->inline_failed || CALL_STMT_CANNOT_INLINE_P (e->call_stmt))
+ if (!e->inline_failed || gimple_call_cannot_inline_p (e->call_stmt))
continue;
if (cgraph_recursive_inlining_p (e->caller, e->callee,
&e->inline_failed))
continue;
+ if (!tree_can_inline_p (e->caller->decl, e->callee->decl))
+ {
+ gimple_call_set_cannot_inline (e->call_stmt, true);
+ continue;
+ }
cgraph_mark_inline_edge (e, true);
+ if (flag_indirect_inlining)
+ ipa_propagate_indirect_call_infos (e, NULL);
if (dump_file)
fprintf (dump_file,
" Inlined into %s which now has %i insns.\n",
@@ -1117,25 +1159,31 @@ cgraph_decide_inlining (void)
overall_insns - old_insns);
}
- if (!flag_really_no_inline)
- cgraph_decide_inlining_of_small_functions ();
+ cgraph_decide_inlining_of_small_functions ();
+
+ /* After this point, any edge discovery performed by indirect inlining is no
+ good so let's give up. */
+ if (flag_indirect_inlining)
+ free_all_ipa_structures_after_iinln ();
- if (!flag_really_no_inline
- && flag_inline_functions_called_once)
+ if (flag_inline_functions_called_once)
{
if (dump_file)
fprintf (dump_file, "\nDeciding on functions called once:\n");
/* And finally decide what functions are called once. */
-
for (i = nnodes - 1; i >= 0; i--)
{
node = order[i];
- if (node->callers && !node->callers->next_caller && !node->needed
- && node->local.inlinable && node->callers->inline_failed
- && !CALL_STMT_CANNOT_INLINE_P (node->callers->call_stmt)
- && !DECL_EXTERNAL (node->decl) && !DECL_COMDAT (node->decl))
+ if (node->callers
+ && !node->callers->next_caller
+ && !node->needed
+ && node->local.inlinable
+ && node->callers->inline_failed
+ && !gimple_call_cannot_inline_p (node->callers->call_stmt)
+ && !DECL_EXTERNAL (node->decl)
+ && !DECL_COMDAT (node->decl))
{
if (dump_file)
{
@@ -1246,13 +1294,13 @@ try_inline (struct cgraph_edge *e, enum inlining_mode mode, int depth)
if (e->inline_failed)
cgraph_mark_inline (e);
- /* In order to fully inline always_inline functions at -O0, we need to
+ /* In order to fully inline always_inline functions, we need to
recurse here, since the inlined functions might not be processed by
incremental inlining at all yet.
Also flattening needs to be done recursively. */
- if (!flag_unit_at_a_time || mode == INLINE_ALL || always_inline)
+ if (mode == INLINE_ALL || always_inline)
cgraph_decide_inlining_incrementally (e->callee, mode, depth + 1);
callee->aux = (void *)(size_t) callee_mode;
return true;
@@ -1297,7 +1345,7 @@ cgraph_decide_inlining_incrementally (struct cgraph_node *node,
if (!e->callee->local.disregard_inline_limits
&& (mode != INLINE_ALL || !e->callee->local.inlinable))
continue;
- if (CALL_STMT_CANNOT_INLINE_P (e->call_stmt))
+ if (gimple_call_cannot_inline_p (e->call_stmt))
continue;
/* When the edge is already inlined, we just need to recurse into
it in order to fully flatten the leaves. */
@@ -1322,6 +1370,17 @@ cgraph_decide_inlining_incrementally (struct cgraph_node *node,
}
continue;
}
+ if (!tree_can_inline_p (node->decl, e->callee->decl))
+ {
+ gimple_call_set_cannot_inline (e->call_stmt, true);
+ if (dump_file)
+ {
+ indent_to (dump_file, depth);
+ fprintf (dump_file,
+ "Not inlining: Target specific option mismatch.\n");
+ }
+ continue;
+ }
if (gimple_in_ssa_p (DECL_STRUCT_FUNCTION (node->decl))
!= gimple_in_ssa_p (DECL_STRUCT_FUNCTION (e->callee->decl)))
{
@@ -1332,7 +1391,7 @@ cgraph_decide_inlining_incrementally (struct cgraph_node *node,
}
continue;
}
- if (!DECL_SAVED_TREE (e->callee->decl) && !e->callee->inline_decl)
+ if (!gimple_body (e->callee->decl) && !e->callee->inline_decl)
{
if (dump_file)
{
@@ -1346,8 +1405,7 @@ cgraph_decide_inlining_incrementally (struct cgraph_node *node,
}
/* Now do the automatic inlining. */
- if (!flag_really_no_inline && mode != INLINE_ALL
- && mode != INLINE_ALWAYS_INLINE)
+ if (mode != INLINE_ALL && mode != INLINE_ALWAYS_INLINE)
for (e = node->callees; e; e = e->next_callee)
{
if (!e->callee->local.inlinable
@@ -1399,7 +1457,7 @@ cgraph_decide_inlining_incrementally (struct cgraph_node *node,
}
if (!cgraph_check_inline_limits (node, e->callee, &e->inline_failed,
false)
- || CALL_STMT_CANNOT_INLINE_P (e->call_stmt))
+ || gimple_call_cannot_inline_p (e->call_stmt))
{
if (dump_file)
{
@@ -1408,7 +1466,7 @@ cgraph_decide_inlining_incrementally (struct cgraph_node *node,
}
continue;
}
- if (!DECL_SAVED_TREE (e->callee->decl) && !e->callee->inline_decl)
+ if (!gimple_body (e->callee->decl) && !e->callee->inline_decl)
{
if (dump_file)
{
@@ -1418,22 +1476,24 @@ cgraph_decide_inlining_incrementally (struct cgraph_node *node,
}
continue;
}
+ if (!tree_can_inline_p (node->decl, e->callee->decl))
+ {
+ gimple_call_set_cannot_inline (e->call_stmt, true);
+ if (dump_file)
+ {
+ indent_to (dump_file, depth);
+ fprintf (dump_file,
+ "Not inlining: Target specific option mismatch.\n");
+ }
+ continue;
+ }
if (cgraph_default_inline_p (e->callee, &failed_reason))
inlined |= try_inline (e, mode, depth);
- else if (!flag_unit_at_a_time)
- e->inline_failed = failed_reason;
}
node->aux = (void *)(size_t) old_mode;
return inlined;
}
-/* When inlining shall be performed. */
-static bool
-cgraph_gate_inlining (void)
-{
- return flag_inline_trees;
-}
-
/* Because inlining might remove no-longer reachable nodes, we need to
keep the array visible to garbage collector to avoid reading collected
out nodes. */
@@ -1451,9 +1511,7 @@ cgraph_early_inlining (void)
if (sorrycount || errorcount)
return 0;
- if (cgraph_decide_inlining_incrementally (node,
- flag_unit_at_a_time || optimize_size
- ? INLINE_SIZE : INLINE_SPEED, 0))
+ if (cgraph_decide_inlining_incrementally (node, INLINE_SIZE, 0))
{
timevar_push (TV_INTEGRATION);
todo = optimize_inline_calls (current_function_decl);
@@ -1466,7 +1524,7 @@ cgraph_early_inlining (void)
static bool
cgraph_gate_early_inlining (void)
{
- return flag_inline_trees && flag_early_inlining;
+ return flag_early_inlining;
}
struct gimple_opt_pass pass_early_inline =
@@ -1492,7 +1550,7 @@ struct gimple_opt_pass pass_early_inline =
static bool
cgraph_gate_ipa_early_inlining (void)
{
- return (flag_inline_trees && flag_early_inlining
+ return (flag_early_inlining
&& (flag_branch_probabilities || flag_test_coverage
|| profile_arc_flag));
}
@@ -1529,13 +1587,11 @@ compute_inline_parameters (struct cgraph_node *node)
= inline_summary (node)->estimated_self_stack_size;
node->global.stack_frame_offset = 0;
node->local.inlinable = tree_inlinable_function_p (current_function_decl);
- inline_summary (node)->self_insns = estimate_num_insns (current_function_decl,
- &eni_inlining_weights);
+ inline_summary (node)->self_insns
+ = estimate_num_insns_fn (current_function_decl, &eni_inlining_weights);
if (node->local.inlinable && !node->local.disregard_inline_limits)
node->local.disregard_inline_limits
= DECL_DISREGARD_INLINE_LIMITS (current_function_decl);
- if (flag_really_no_inline && !node->local.disregard_inline_limits)
- node->local.inlinable = 0;
/* Inlining characteristics are maintained by the cgraph_mark_inline. */
node->global.insns = inline_summary (node)->self_insns;
return 0;
@@ -1551,19 +1607,12 @@ compute_inline_parameters_for_current (void)
return 0;
}
-/* When inlining shall be performed. */
-static bool
-gate_inline_passes (void)
-{
- return flag_inline_trees;
-}
-
struct gimple_opt_pass pass_inline_parameters =
{
{
GIMPLE_PASS,
NULL, /* name */
- gate_inline_passes, /* gate */
+ NULL, /* gate */
compute_inline_parameters_for_current,/* execute */
NULL, /* sub */
NULL, /* next */
@@ -1577,6 +1626,31 @@ struct gimple_opt_pass pass_inline_parameters =
}
};
+/* This function performs intraprocedural analyzis in NODE that is required to
+ inline indirect calls. */
+static void
+inline_indirect_intraprocedural_analysis (struct cgraph_node *node)
+{
+ struct cgraph_edge *cs;
+
+ ipa_count_formal_params (node);
+ ipa_create_param_decls_array (node);
+ ipa_detect_param_modifications (node);
+ ipa_analyze_params_uses (node);
+
+ if (dump_file)
+ ipa_print_node_param_flags (dump_file, node);
+
+ for (cs = node->callees; cs; cs = cs->next_callee)
+ {
+ ipa_count_arguments (cs);
+ ipa_compute_jump_functions (cs);
+ }
+
+ if (dump_file)
+ ipa_print_node_jump_functions (dump_file, node);
+}
+
/* Note function body size. */
static void
inline_generate_summary (void)
@@ -1586,6 +1660,13 @@ inline_generate_summary (void)
int nnodes = cgraph_postorder (order);
int i;
+ if (flag_indirect_inlining)
+ {
+ ipa_register_cgraph_hooks ();
+ ipa_check_create_node_params ();
+ ipa_check_create_edge_args ();
+ }
+
for (i = nnodes - 1; i >= 0; i--)
{
struct cgraph_node *node = order[i];
@@ -1597,6 +1678,10 @@ inline_generate_summary (void)
push_cfun (DECL_STRUCT_FUNCTION (node->decl));
current_function_decl = node->decl;
compute_inline_parameters (node);
+
+ if (flag_indirect_inlining)
+ inline_indirect_intraprocedural_analysis (node);
+
pop_cfun ();
}
}
@@ -1621,6 +1706,7 @@ inline_transform (struct cgraph_node *node)
for (e = node->callees; e; e = e->next_callee)
if (!e->inline_failed || warn_inline)
break;
+
if (e)
{
timevar_push (TV_INTEGRATION);
@@ -1635,7 +1721,7 @@ struct ipa_opt_pass pass_ipa_inline =
{
IPA_PASS,
"inline", /* name */
- cgraph_gate_inlining, /* gate */
+ NULL, /* gate */
cgraph_decide_inlining, /* execute */
NULL, /* sub */
NULL, /* next */
@@ -1658,62 +1744,4 @@ struct ipa_opt_pass pass_ipa_inline =
};
-/* When inlining shall be performed. */
-static bool
-cgraph_gate_O0_always_inline (void)
-{
- return !flag_unit_at_a_time || !flag_inline_trees;
-}
-
-static unsigned int
-cgraph_O0_always_inline (void)
-{
- struct cgraph_node *node = cgraph_node (current_function_decl);
- unsigned int todo = 0;
- bool inlined;
-
- if (sorrycount || errorcount)
- return 0;
- inlined = cgraph_decide_inlining_incrementally (node, INLINE_SPEED, 0);
- /* We might need the body of this function so that we can expand
- it inline somewhere else. */
- if (cgraph_preserve_function_body_p (current_function_decl))
- save_inline_function_body (node);
- if (inlined || warn_inline)
- {
- timevar_push (TV_INTEGRATION);
- todo = optimize_inline_calls (current_function_decl);
- timevar_pop (TV_INTEGRATION);
- }
- /* In non-unit-at-a-time we must mark all referenced functions as needed. */
- if (!flag_unit_at_a_time)
- {
- struct cgraph_edge *e;
- for (e = node->callees; e; e = e->next_callee)
- if (e->callee->analyzed)
- cgraph_mark_needed_node (e->callee);
- }
- return todo | execute_fixup_cfg ();
-}
-
-struct gimple_opt_pass pass_O0_always_inline =
-{
- {
- GIMPLE_PASS,
- "always_inline", /* name */
- cgraph_gate_O0_always_inline, /* gate */
- cgraph_O0_always_inline, /* execute */
- NULL, /* sub */
- NULL, /* next */
- 0, /* static_pass_number */
- TV_INLINE_HEURISTICS, /* tv_id */
- 0, /* properties_required */
- PROP_cfg, /* properties_provided */
- 0, /* properties_destroyed */
- 0, /* todo_flags_start */
- TODO_dump_func | TODO_verify_flow
- | TODO_verify_stmts /* todo_flags_finish */
- }
-};
-
#include "gt-ipa-inline.h"
diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
index f67d6579e10..efa195916cd 100644
--- a/gcc/ipa-prop.c
+++ b/gcc/ipa-prop.c
@@ -32,6 +32,7 @@ along with GCC; see the file COPYING3. If not see
#include "flags.h"
#include "timevar.h"
#include "flags.h"
+#include "diagnostic.h"
/* Vector where the parameter infos are actually stored. */
VEC (ipa_node_params_t, heap) *ipa_node_params_vector;
@@ -53,7 +54,13 @@ ipa_init_func_list (void)
wl = NULL;
for (node = cgraph_nodes; node; node = node->next)
- ipa_push_func_to_list (&wl, node);
+ if (node->analyzed)
+ {
+ /* Unreachable nodes should have been eliminated before ipcp and
+ inlining. */
+ gcc_assert (node->needed || node->reachable);
+ ipa_push_func_to_list (&wl, node);
+ }
return wl;
}
@@ -111,6 +118,9 @@ ipa_create_param_decls_array (struct cgraph_node *mt)
int param_num;
struct ipa_node_params *info = IPA_NODE_REF (mt);
+ if (info->param_decls)
+ return;
+
info->param_decls = XCNEWVEC (tree, ipa_get_param_count (info));
fndecl = mt->decl;
fnargs = DECL_ARGUMENTS (fndecl);
@@ -140,92 +150,81 @@ ipa_count_formal_params (struct cgraph_node *mt)
ipa_set_param_count (IPA_NODE_REF (mt), param_num);
}
-/* Check STMT to detect whether a formal is modified within MT, the appropriate
- entry is updated in the modified_flags array of ipa_node_params (associated
- with MT). */
+/* Check STMT to detect whether a formal parameter is directly modified within
+ STMT, the appropriate entry is updated in the modified flags of INFO.
+ Directly means that this function does not check for modifications through
+ pointers or escaping addresses because all TREE_ADDRESSABLE parameters are
+ considered modified anyway. */
static void
-ipa_check_stmt_modifications (struct cgraph_node *mt, tree stmt)
+ipa_check_stmt_modifications (struct ipa_node_params *info, gimple stmt)
{
- int index, j;
- tree parm_decl;
- struct ipa_node_params *info;
+ int j;
+ int index;
+ tree lhs;
- switch (TREE_CODE (stmt))
+ switch (gimple_code (stmt))
{
- case GIMPLE_MODIFY_STMT:
- if (TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 0)) == PARM_DECL)
- {
- info = IPA_NODE_REF (mt);
- parm_decl = GIMPLE_STMT_OPERAND (stmt, 0);
- index = ipa_get_param_decl_index (info, parm_decl);
- if (index >= 0)
- info->modified_flags[index] = true;
- }
+ case GIMPLE_ASSIGN:
+ lhs = gimple_assign_lhs (stmt);
+
+ while (handled_component_p (lhs))
+ lhs = TREE_OPERAND (lhs, 0);
+ if (TREE_CODE (lhs) == SSA_NAME)
+ lhs = SSA_NAME_VAR (lhs);
+ index = ipa_get_param_decl_index (info, lhs);
+ if (index >= 0)
+ info->param_flags[index].modified = true;
break;
- case ASM_EXPR:
+
+ case GIMPLE_ASM:
/* Asm code could modify any of the parameters. */
- info = IPA_NODE_REF (mt);
- for (j = 0; j < ipa_get_param_count (IPA_NODE_REF (mt)); j++)
- info->modified_flags[j] = true;
+ for (j = 0; j < ipa_get_param_count (info); j++)
+ info->param_flags[j].modified = true;
break;
+
default:
break;
}
}
-/* The modify computation driver for MT. Compute which formal arguments
- of function MT are locally modified. Formals may be modified in MT
- if their address is taken, or if
- they appear on the left hand side of an assignment. */
+/* Compute which formal parameters of function associated with NODE are locally
+ modified. Parameters may be modified in NODE if they are TREE_ADDRESSABLE,
+ if they appear on the left hand side of an assignment or if there is an
+ ASM_EXPR in the function. */
void
-ipa_detect_param_modifications (struct cgraph_node *mt)
+ipa_detect_param_modifications (struct cgraph_node *node)
{
- tree decl;
- tree body;
- int j, count;
+ tree decl = node->decl;
basic_block bb;
struct function *func;
- block_stmt_iterator bsi;
- tree stmt, parm_tree;
- struct ipa_node_params *info = IPA_NODE_REF (mt);
+ gimple_stmt_iterator gsi;
+ gimple stmt;
+ struct ipa_node_params *info = IPA_NODE_REF (node);
+ int i, count;
- if (ipa_get_param_count (info) == 0 || info->modified_flags)
+ if (ipa_get_param_count (info) == 0 || info->modification_analysis_done)
return;
- count = ipa_get_param_count (info);
- info->modified_flags = XCNEWVEC (bool, count);
- decl = mt->decl;
- /* ??? Handle pending sizes case. Set all parameters
- of the function to be modified. */
+ if (!info->param_flags)
+ info->param_flags = XCNEWVEC (struct ipa_param_flags,
+ ipa_get_param_count (info));
- if (DECL_UNINLINABLE (decl))
+ func = DECL_STRUCT_FUNCTION (decl);
+ FOR_EACH_BB_FN (bb, func)
{
- for (j = 0; j < count; j++)
- info->modified_flags[j] = true;
-
- return;
- }
- /* Formals whose address is taken are considered modified. */
- for (j = 0; j < count; j++)
- {
- parm_tree = ipa_get_ith_param (info, j);
- if (!is_gimple_reg (parm_tree)
- && TREE_ADDRESSABLE (parm_tree))
- info->modified_flags[j] = true;
- }
- body = DECL_SAVED_TREE (decl);
- if (body != NULL)
- {
- func = DECL_STRUCT_FUNCTION (decl);
- FOR_EACH_BB_FN (bb, func)
- {
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
- {
- stmt = bsi_stmt (bsi);
- ipa_check_stmt_modifications (mt, stmt);
- }
- }
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ {
+ stmt = gsi_stmt (gsi);
+ ipa_check_stmt_modifications (info, stmt);
+ }
}
+
+ count = ipa_get_param_count (info);
+ for (i = 0; i < count; i++)
+ if (TREE_ADDRESSABLE (ipa_get_ith_param (info, i)))
+ info->param_flags[i].modified = true;
+
+ info->modification_analysis_done = 1;
}
/* Count number of arguments callsite CS has and store it in
@@ -233,100 +232,773 @@ ipa_detect_param_modifications (struct cgraph_node *mt)
void
ipa_count_arguments (struct cgraph_edge *cs)
{
- tree call_tree;
+ gimple stmt;
int arg_num;
- call_tree = get_call_expr_in (cs->call_stmt);
- gcc_assert (TREE_CODE (call_tree) == CALL_EXPR);
- arg_num = call_expr_nargs (call_tree);
+ stmt = cs->call_stmt;
+ gcc_assert (is_gimple_call (stmt));
+ arg_num = gimple_call_num_args (stmt);
ipa_set_cs_argument_count (IPA_EDGE_REF (cs), arg_num);
}
-/* Compute jump function for all arguments of callsite CS
- and insert the information in the jump_functions array
- in the ipa_edge_args corresponding to this callsite. */
+/* The following function prints the jump functions of all arguments on all
+ call graph edges going from NODE to file F. */
void
-ipa_compute_jump_functions (struct cgraph_edge *cs)
+ipa_print_node_jump_functions (FILE *f, struct cgraph_node *node)
{
- tree call_tree;
- tree arg, cst_decl;
- int arg_num;
- struct cgraph_node *mt;
- tree parm_decl;
- struct function *curr_cfun;
- call_expr_arg_iterator iter;
- struct ipa_edge_args *args = IPA_EDGE_REF (cs);
+ int i, count;
+ struct cgraph_edge *cs;
+ struct ipa_jump_func *jump_func;
+ enum jump_func_type type;
- if (ipa_get_cs_argument_count (args) == 0 || args->jump_functions)
- return;
- args->jump_functions = XCNEWVEC (struct ipa_jump_func,
- ipa_get_cs_argument_count (args));
- call_tree = get_call_expr_in (cs->call_stmt);
- gcc_assert (TREE_CODE (call_tree) == CALL_EXPR);
- arg_num = 0;
+ fprintf (f, "JUMP FUNCTIONS OF CALLER %s:\n", cgraph_node_name (node));
+ for (cs = node->callees; cs; cs = cs->next_callee)
+ {
+ if (!ipa_edge_args_info_available_for_edge_p (cs))
+ continue;
+
+ fprintf (f, "callsite %s ", cgraph_node_name (node));
+ fprintf (f, "-> %s :: \n", cgraph_node_name (cs->callee));
+
+ count = ipa_get_cs_argument_count (IPA_EDGE_REF (cs));
+ for (i = 0; i < count; i++)
+ {
+ jump_func = ipa_get_ith_jump_func (IPA_EDGE_REF (cs), i);
+ type = jump_func->type;
+
+ fprintf (f, " param %d: ", i);
+ if (type == IPA_UNKNOWN)
+ fprintf (f, "UNKNOWN\n");
+ else if (type == IPA_CONST || type == IPA_CONST_REF)
+ {
+ tree val = jump_func->value.constant;
+ fprintf (f, "CONST: ");
+ print_generic_expr (f, val, 0);
+ fprintf (f, "\n");
+ }
+ else if (type == IPA_CONST_MEMBER_PTR)
+ {
+ fprintf (f, "CONST MEMBER PTR: ");
+ print_generic_expr (f, jump_func->value.member_cst.pfn, 0);
+ fprintf (f, ", ");
+ print_generic_expr (f, jump_func->value.member_cst.delta, 0);
+ fprintf (f, "\n");
+ }
+ else if (type == IPA_PASS_THROUGH)
+ {
+ fprintf (f, "PASS THROUGH: ");
+ fprintf (f, "%d\n", jump_func->value.formal_id);
+ }
+ }
+ }
+}
+
+/* Print ipa_jump_func data structures of all nodes in the call graph to F. */
+void
+ipa_print_all_jump_functions (FILE *f)
+{
+ struct cgraph_node *node;
- FOR_EACH_CALL_EXPR_ARG (arg, iter, call_tree)
+ fprintf (f, "\nCALLSITE PARAM PRINT\n");
+ for (node = cgraph_nodes; node; node = node->next)
{
- /* If the formal parameter was passed as argument, we store
- IPA_PASS_THROUGH and its index in the caller as the jump function
- of this argument. */
- if ((TREE_CODE (arg) == SSA_NAME
- && TREE_CODE (SSA_NAME_VAR (arg)) == PARM_DECL)
- || TREE_CODE (arg) == PARM_DECL)
+ ipa_print_node_jump_functions (f, node);
+ }
+}
+
+/* The following function determines the jump functions of scalar arguments.
+ Scalar means SSA names and constants of a number of selected types. INFO is
+ the ipa_node_params structure associated with the caller, FUNCTIONS is a
+ pointer to an array of jump function structures associated with CALL which
+ is the call statement being examined.*/
+static void
+compute_scalar_jump_functions (struct ipa_node_params *info,
+ struct ipa_jump_func *functions,
+ gimple call)
+{
+ tree arg;
+ unsigned num = 0;
+
+ for (num = 0; num < gimple_call_num_args (call); num++)
+ {
+ arg = gimple_call_arg (call, num);
+
+ if (TREE_CODE (arg) == INTEGER_CST
+ || TREE_CODE (arg) == REAL_CST
+ || TREE_CODE (arg) == FIXED_CST)
{
- struct ipa_node_params *info;
- int index;
-
- mt = cs->caller;
- info = IPA_NODE_REF (mt);
- parm_decl = TREE_CODE (arg) == PARM_DECL ? arg : SSA_NAME_VAR (arg);
-
- index = ipa_get_param_decl_index (info, parm_decl);
- if (TREE_CODE (arg) == SSA_NAME && IS_VALID_JUMP_FUNC_INDEX (index))
+ functions[num].type = IPA_CONST;
+ functions[num].value.constant = arg;
+ }
+ else if (TREE_CODE (arg) == ADDR_EXPR)
+ {
+ if (TREE_CODE (TREE_OPERAND (arg, 0)) == FUNCTION_DECL)
{
- curr_cfun = DECL_STRUCT_FUNCTION (mt->decl);
- if (!gimple_default_def (curr_cfun, parm_decl)
- || gimple_default_def (curr_cfun, parm_decl) != arg)
- info->modified_flags[index] = true;
+ functions[num].type = IPA_CONST;
+ functions[num].value.constant = TREE_OPERAND (arg, 0);
}
- if (!IS_VALID_JUMP_FUNC_INDEX (index) || info->modified_flags[index])
- args->jump_functions[arg_num].type = IPA_UNKNOWN;
- else
+ else if (TREE_CODE (TREE_OPERAND (arg, 0)) == CONST_DECL)
+ {
+ tree cst_decl = TREE_OPERAND (arg, 0);
+
+ if (TREE_CODE (DECL_INITIAL (cst_decl)) == INTEGER_CST
+ || TREE_CODE (DECL_INITIAL (cst_decl)) == REAL_CST
+ || TREE_CODE (DECL_INITIAL (cst_decl)) == FIXED_CST)
+ {
+ functions[num].type = IPA_CONST_REF;
+ functions[num].value.constant = cst_decl;
+ }
+ }
+ }
+ else if ((TREE_CODE (arg) == SSA_NAME) && SSA_NAME_IS_DEFAULT_DEF (arg))
+ {
+ int index = ipa_get_param_decl_index (info, SSA_NAME_VAR (arg));
+
+ if (index >= 0)
+ {
+ functions[num].type = IPA_PASS_THROUGH;
+ functions[num].value.formal_id = index;
+ }
+ }
+ }
+}
+
+/* This function inspects the given TYPE and returns true iff it has the same
+ structure (the same number of fields of the same types) as a C++ member
+ pointer. If METHOD_PTR and DELTA are non-NULL, the trees representing the
+ corresponding fields are stored there. */
+static bool
+type_like_member_ptr_p (tree type, tree *method_ptr, tree *delta)
+{
+ tree fld;
+
+ if (TREE_CODE (type) != RECORD_TYPE)
+ return false;
+
+ fld = TYPE_FIELDS (type);
+ if (!fld || !POINTER_TYPE_P (TREE_TYPE (fld))
+ || TREE_CODE (TREE_TYPE (TREE_TYPE (fld))) != METHOD_TYPE)
+ return false;
+
+ if (method_ptr)
+ *method_ptr = fld;
+
+ fld = TREE_CHAIN (fld);
+ if (!fld || INTEGRAL_TYPE_P (fld))
+ return false;
+ if (delta)
+ *delta = fld;
+
+ if (TREE_CHAIN (fld))
+ return false;
+
+ return true;
+}
+
+/* This function goes through arguments of the CALL and for every one that
+ looks like a member pointer, it checks whether it can be safely declared
+ pass-through and if so, marks that to the corresponding item of jum
+ FUNCTIONS . It returns true iff there were non-pass-through member pointers
+ within the arguments. INFO describes formal parameters of the caller. */
+static bool
+compute_pass_through_member_ptrs (struct ipa_node_params *info,
+ struct ipa_jump_func *functions,
+ gimple call)
+{
+ bool undecided_members = false;
+ unsigned num;
+ tree arg;
+
+ for (num = 0; num < gimple_call_num_args (call); num++)
+ {
+ arg = gimple_call_arg (call, num);
+
+ if (type_like_member_ptr_p (TREE_TYPE (arg), NULL, NULL))
+ {
+ if (TREE_CODE (arg) == PARM_DECL)
{
- args->jump_functions[arg_num].type = IPA_PASS_THROUGH;
- args->jump_functions[arg_num].value.formal_id = index;
+ int index = ipa_get_param_decl_index (info, arg);
+
+ gcc_assert (index >=0);
+ if (!ipa_is_ith_param_modified (info, index))
+ {
+ functions[num].type = IPA_PASS_THROUGH;
+ functions[num].value.formal_id = index;
+ }
+ else
+ undecided_members = true;
}
+ else
+ undecided_members = true;
}
- /* If a constant value was passed as argument,
- we store IPA_CONST and its value as the jump function
- of this argument. */
- else if (TREE_CODE (arg) == INTEGER_CST
- || TREE_CODE (arg) == REAL_CST
- || TREE_CODE (arg) == FIXED_CST)
+ }
+
+ return undecided_members;
+}
+
+/* Simple function filling in a member pointer constant jump function (with PFN
+ and DELTA as the constant value) into JFUNC. */
+static void
+fill_member_ptr_cst_jump_function (struct ipa_jump_func *jfunc,
+ tree pfn, tree delta)
+{
+ jfunc->type = IPA_CONST_MEMBER_PTR;
+ jfunc->value.member_cst.pfn = pfn;
+ jfunc->value.member_cst.delta = delta;
+}
+
+/* Traverse statements from CALL backwards, scanning whether the argument ARG
+ which is a member pointer is filled in with constant values. If it is, fill
+ the jump function JFUNC in appropriately. METHOD_FIELD and DELTA_FIELD are
+ fields of the record type of the member pointer. To give an example, we
+ look for a pattern looking like the following:
+
+ D.2515.__pfn ={v} printStuff;
+ D.2515.__delta ={v} 0;
+ i_1 = doprinting (D.2515); */
+static void
+determine_cst_member_ptr (gimple call, tree arg, tree method_field,
+ tree delta_field, struct ipa_jump_func *jfunc)
+{
+ gimple_stmt_iterator gsi;
+ tree method = NULL_TREE;
+ tree delta = NULL_TREE;
+
+ gsi = gsi_for_stmt (call);
+
+ gsi_prev (&gsi);
+ for (; !gsi_end_p (gsi); gsi_prev (&gsi))
+ {
+ gimple stmt = gsi_stmt (gsi);
+ tree lhs, rhs, fld;
+
+ if (!is_gimple_assign (stmt) || gimple_num_ops (stmt) != 2)
+ return;
+
+ lhs = gimple_assign_lhs (stmt);
+ rhs = gimple_assign_rhs1 (stmt);
+
+ if (TREE_CODE (lhs) != COMPONENT_REF
+ || TREE_OPERAND (lhs, 0) != arg)
+ continue;
+
+ fld = TREE_OPERAND (lhs, 1);
+ if (!method && fld == method_field)
{
- args->jump_functions[arg_num].type = IPA_CONST;
- args->jump_functions[arg_num].value.constant = arg;
+ if (TREE_CODE (rhs) == ADDR_EXPR
+ && TREE_CODE (TREE_OPERAND (rhs, 0)) == FUNCTION_DECL
+ && TREE_CODE (TREE_TYPE (TREE_OPERAND (rhs, 0))) == METHOD_TYPE)
+ {
+ method = TREE_OPERAND (rhs, 0);
+ if (delta)
+ {
+ fill_member_ptr_cst_jump_function (jfunc, method, delta);
+ return;
+ }
+ }
+ else
+ return;
}
- /* This is for the case of Fortran. If the address of a const_decl
- was passed as argument then we store
- IPA_CONST_REF/IPA_CONST_REF and the constant
- value as the jump function corresponding to this argument. */
- else if (TREE_CODE (arg) == ADDR_EXPR
- && TREE_CODE (TREE_OPERAND (arg, 0)) == CONST_DECL)
+
+ if (!delta && fld == delta_field)
{
- cst_decl = TREE_OPERAND (arg, 0);
- if (TREE_CODE (DECL_INITIAL (cst_decl)) == INTEGER_CST
- || TREE_CODE (DECL_INITIAL (cst_decl)) == REAL_CST
- || TREE_CODE (DECL_INITIAL (cst_decl)) == FIXED_CST)
+ if (TREE_CODE (rhs) == INTEGER_CST)
{
- args->jump_functions[arg_num].type = IPA_CONST_REF;
- args->jump_functions[arg_num].value.constant = cst_decl;
+ delta = rhs;
+ if (method)
+ {
+ fill_member_ptr_cst_jump_function (jfunc, method, delta);
+ return;
+ }
}
+ else
+ return;
}
- else
- args->jump_functions[arg_num].type = IPA_UNKNOWN;
- arg_num++;
}
+
+ return;
+}
+
+/* Go through the arguments of the CALL and for every member pointer within
+ tries determine whether it is a constant. If it is, create a corresponding
+ constant jump function in FUNCTIONS which is an array of jump functions
+ associated with the call. */
+static void
+compute_cst_member_ptr_arguments (struct ipa_jump_func *functions,
+ gimple call)
+{
+ unsigned num;
+ tree arg, method_field, delta_field;
+
+ for (num = 0; num < gimple_call_num_args (call); num++)
+ {
+ arg = gimple_call_arg (call, num);
+
+ if (functions[num].type == IPA_UNKNOWN
+ && type_like_member_ptr_p (TREE_TYPE (arg), &method_field,
+ &delta_field))
+ determine_cst_member_ptr (call, arg, method_field, delta_field,
+ &functions[num]);
+ }
+}
+
+/* Compute jump function for all arguments of callsite CS and insert the
+ information in the jump_functions array in the ipa_edge_args corresponding
+ to this callsite. */
+void
+ipa_compute_jump_functions (struct cgraph_edge *cs)
+{
+ struct ipa_node_params *info = IPA_NODE_REF (cs->caller);
+ struct ipa_edge_args *arguments = IPA_EDGE_REF (cs);
+ gimple call;
+
+ if (ipa_get_cs_argument_count (arguments) == 0 || arguments->jump_functions)
+ return;
+ arguments->jump_functions = XCNEWVEC (struct ipa_jump_func,
+ ipa_get_cs_argument_count (arguments));
+
+ call = cs->call_stmt;
+ gcc_assert (is_gimple_call (call));
+
+ /* We will deal with constants and SSA scalars first: */
+ compute_scalar_jump_functions (info, arguments->jump_functions, call);
+
+ /* Let's check whether there are any potential member pointers and if so,
+ whether we can determine their functions as pass_through. */
+ if (!compute_pass_through_member_ptrs (info, arguments->jump_functions, call))
+ return;
+
+ /* Finally, let's check whether we actually pass a new constant membeer
+ pointer here... */
+ compute_cst_member_ptr_arguments (arguments->jump_functions, call);
+}
+
+/* If RHS looks like a rhs of a statement loading pfn from a member pointer
+ formal parameter, return the parameter, otherwise return NULL. */
+static tree
+ipa_get_member_ptr_load_param (tree rhs)
+{
+ tree rec, fld;
+ tree ptr_field;
+
+ if (TREE_CODE (rhs) != COMPONENT_REF)
+ return NULL_TREE;
+
+ rec = TREE_OPERAND (rhs, 0);
+ if (TREE_CODE (rec) != PARM_DECL
+ || !type_like_member_ptr_p (TREE_TYPE (rec), &ptr_field, NULL))
+ return NULL_TREE;
+
+ fld = TREE_OPERAND (rhs, 1);
+ if (fld == ptr_field)
+ return rec;
+ else
+ return NULL_TREE;
+}
+
+/* If STMT looks like a statement loading a value from a member pointer formal
+ parameter, this function retuns that parameter. */
+static tree
+ipa_get_stmt_member_ptr_load_param (gimple stmt)
+{
+ tree rhs;
+
+ if (!is_gimple_assign (stmt) || gimple_num_ops (stmt) != 2)
+ return NULL_TREE;
+
+ rhs = gimple_assign_rhs1 (stmt);
+ return ipa_get_member_ptr_load_param (rhs);
+}
+
+/* Returns true iff T is an SSA_NAME defined by a statement. */
+static bool
+ipa_is_ssa_with_stmt_def (tree t)
+{
+ if (TREE_CODE (t) == SSA_NAME
+ && !SSA_NAME_IS_DEFAULT_DEF (t))
+ return true;
+ else
+ return false;
+}
+
+/* Creates a new note describing a call to a parameter number FORMAL_ID and
+ attaches it to the linked list of INFO. It also sets the called flag of the
+ parameter. STMT is the corresponding call statement. */
+static void
+ipa_note_param_call (struct ipa_node_params *info, int formal_id,
+ gimple stmt)
+{
+ struct ipa_param_call_note *note;
+ basic_block bb = gimple_bb (stmt);
+
+ info->param_flags[formal_id].called = 1;
+
+ note = XCNEW (struct ipa_param_call_note);
+ note->formal_id = formal_id;
+ note->stmt = stmt;
+ note->count = bb->count;
+ note->frequency = compute_call_stmt_bb_frequency (bb);
+
+ note->next = info->param_calls;
+ info->param_calls = note;
+
+ return;
+}
+
+/* Analyze the CALL and examine uses of formal parameters of the caller
+ (described by INFO). Currently it checks whether the call calls a pointer
+ that is a formal parameter and if so, the parameter is marked with the
+ called flag and a note describing the call is created. This is very simple
+ for ordinary pointers represented in SSA but not-so-nice when it comes to
+ member pointers. The ugly part of this function does nothing more than
+ tries to match the pattern of such a call. An example of such a pattern is
+ the gimple dump below, the call is on the last line:
+
+ <bb 2>:
+ f$__delta_5 = f.__delta;
+ f$__pfn_24 = f.__pfn;
+ D.2496_3 = (int) f$__pfn_24;
+ D.2497_4 = D.2496_3 & 1;
+ if (D.2497_4 != 0)
+ goto <bb 3>;
+ else
+ goto <bb 4>;
+
+ <bb 3>:
+ D.2500_7 = (unsigned int) f$__delta_5;
+ D.2501_8 = &S + D.2500_7;
+ D.2502_9 = (int (*__vtbl_ptr_type) (void) * *) D.2501_8;
+ D.2503_10 = *D.2502_9;
+ D.2504_12 = f$__pfn_24 + -1;
+ D.2505_13 = (unsigned int) D.2504_12;
+ D.2506_14 = D.2503_10 + D.2505_13;
+ D.2507_15 = *D.2506_14;
+ iftmp.11_16 = (String:: *) D.2507_15;
+
+ <bb 4>:
+ # iftmp.11_1 = PHI <iftmp.11_16(3), f$__pfn_24(2)>
+ D.2500_19 = (unsigned int) f$__delta_5;
+ D.2508_20 = &S + D.2500_19;
+ D.2493_21 = iftmp.11_1 (D.2508_20, 4);
+
+ Such patterns are results of simple calls to a member pointer:
+
+ int doprinting (int (MyString::* f)(int) const)
+ {
+ MyString S ("somestring");
+
+ return (S.*f)(4);
+ }
+*/
+
+static void
+ipa_analyze_call_uses (struct ipa_node_params *info, gimple call)
+{
+ tree target = gimple_call_fn (call);
+ gimple def;
+ tree var;
+ tree n1, n2;
+ gimple d1, d2;
+ tree rec, rec2, cond;
+ gimple branch;
+ int index;
+ basic_block bb, virt_bb, join;
+
+ if (TREE_CODE (target) != SSA_NAME)
+ return;
+
+ var = SSA_NAME_VAR (target);
+ if (SSA_NAME_IS_DEFAULT_DEF (target))
+ {
+ /* assuming TREE_CODE (var) == PARM_DECL */
+ index = ipa_get_param_decl_index (info, var);
+ if (index >= 0)
+ ipa_note_param_call (info, index, call);
+ return;
+ }
+
+ /* Now we need to try to match the complex pattern of calling a member
+ pointer. */
+
+ if (!POINTER_TYPE_P (TREE_TYPE (target))
+ || TREE_CODE (TREE_TYPE (TREE_TYPE (target))) != METHOD_TYPE)
+ return;
+
+ def = SSA_NAME_DEF_STMT (target);
+ if (gimple_code (def) != GIMPLE_PHI)
+ return;
+
+ if (gimple_phi_num_args (def) != 2)
+ return;
+
+ /* First, we need to check whether one of these is a load from a member
+ pointer that is a parameter to this function. */
+ n1 = PHI_ARG_DEF (def, 0);
+ n2 = PHI_ARG_DEF (def, 1);
+ if (!ipa_is_ssa_with_stmt_def (n1) || !ipa_is_ssa_with_stmt_def (n2))
+ return;
+ d1 = SSA_NAME_DEF_STMT (n1);
+ d2 = SSA_NAME_DEF_STMT (n2);
+
+ if ((rec = ipa_get_stmt_member_ptr_load_param (d1)))
+ {
+ if (ipa_get_stmt_member_ptr_load_param (d2))
+ return;
+
+ bb = gimple_bb (d1);
+ virt_bb = gimple_bb (d2);
+ }
+ else if ((rec = ipa_get_stmt_member_ptr_load_param (d2)))
+ {
+ bb = gimple_bb (d2);
+ virt_bb = gimple_bb (d1);
+ }
+ else
+ return;
+
+ /* Second, we need to check that the basic blocks are laid out in the way
+ corresponding to the pattern. */
+
+ join = gimple_bb (def);
+ if (!single_pred_p (virt_bb) || !single_succ_p (virt_bb)
+ || single_pred (virt_bb) != bb
+ || single_succ (virt_bb) != join)
+ return;
+
+ /* Third, let's see that the branching is done depending on the least
+ significant bit of the pfn. */
+
+ branch = last_stmt (bb);
+ if (gimple_code (branch) != GIMPLE_COND)
+ return;
+
+ if (gimple_cond_code (branch) != NE_EXPR
+ || !integer_zerop (gimple_cond_rhs (branch)))
+ return;
+
+ cond = gimple_cond_lhs (branch);
+ if (!ipa_is_ssa_with_stmt_def (cond))
+ return;
+
+ def = SSA_NAME_DEF_STMT (cond);
+ if (!is_gimple_assign (def) || gimple_num_ops (def) != 3
+ || gimple_assign_rhs_code (def) != BIT_AND_EXPR
+ || !integer_onep (gimple_assign_rhs2 (def)))
+ return;
+
+ cond = gimple_assign_rhs1 (def);
+ if (!ipa_is_ssa_with_stmt_def (cond))
+ return;
+
+ def = SSA_NAME_DEF_STMT (cond);
+
+ if (is_gimple_assign (def) && gimple_num_ops (def) == 2
+ && gimple_assign_rhs_code (def) == NOP_EXPR)
+ {
+ cond = gimple_assign_rhs1 (def);
+ if (!ipa_is_ssa_with_stmt_def (cond))
+ return;
+ def = SSA_NAME_DEF_STMT (cond);
+ }
+
+ rec2 = ipa_get_stmt_member_ptr_load_param (def);
+ if (rec != rec2)
+ return;
+
+ index = ipa_get_param_decl_index (info, rec);
+ if (index >= 0 && !ipa_is_ith_param_modified (info, index))
+ ipa_note_param_call (info, index, call);
+
+ return;
+}
+
+/* Analyze the statement STMT with respect to formal parameters (described in
+ INFO) and their uses. Currently it only checks whether formal parameters
+ are called. */
+static void
+ipa_analyze_stmt_uses (struct ipa_node_params *info, gimple stmt)
+{
+ if (is_gimple_call (stmt))
+ ipa_analyze_call_uses (info, stmt);
+}
+
+/* Scan the function body of NODE and inspect the uses of formal parameters.
+ Store the findings in various structures of the associated ipa_node_params
+ structure, such as parameter flags, notes etc. */
+void
+ipa_analyze_params_uses (struct cgraph_node *node)
+{
+ tree decl = node->decl;
+ basic_block bb;
+ struct function *func;
+ gimple_stmt_iterator gsi;
+ struct ipa_node_params *info = IPA_NODE_REF (node);
+
+ if (ipa_get_param_count (info) == 0 || info->uses_analysis_done)
+ return;
+ if (!info->param_flags)
+ info->param_flags = XCNEWVEC (struct ipa_param_flags,
+ ipa_get_param_count (info));
+
+ func = DECL_STRUCT_FUNCTION (decl);
+ FOR_EACH_BB_FN (bb, func)
+ {
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ {
+ gimple stmt = gsi_stmt (gsi);
+ ipa_analyze_stmt_uses (info, stmt);
+ }
+ }
+
+ info->uses_analysis_done = 1;
+}
+
+/* Update the jump functions assocated with call graph edge E when the call
+ graph edge CS is being inlined, assuming that E->caller is already (possibly
+ indirectly) inlined into CS->callee and that E has not been inlined. */
+static void
+update_jump_functions_after_inlining (struct cgraph_edge *cs,
+ struct cgraph_edge *e)
+{
+ struct ipa_edge_args *top = IPA_EDGE_REF (cs);
+ struct ipa_edge_args *args = IPA_EDGE_REF (e);
+ int count = ipa_get_cs_argument_count (args);
+ int i;
+
+ for (i = 0; i < count; i++)
+ {
+ struct ipa_jump_func *src, *dst = ipa_get_ith_jump_func (args, i);
+
+ if (dst->type != IPA_PASS_THROUGH)
+ continue;
+
+ /* We must check range due to calls with variable number of arguments: */
+ if (dst->value.formal_id >= (unsigned) ipa_get_cs_argument_count (top))
+ {
+ dst->type = IPA_BOTTOM;
+ continue;
+ }
+
+ src = ipa_get_ith_jump_func (top, dst->value.formal_id);
+ *dst = *src;
+ }
+}
+
+/* Print out a debug message to file F that we have discovered that an indirect
+ call descibed by NT is in fact a call of a known constant function descibed
+ by JFUNC. NODE is the node where the call is. */
+static void
+print_edge_addition_message (FILE *f, struct ipa_param_call_note *nt,
+ struct ipa_jump_func *jfunc,
+ struct cgraph_node *node)
+{
+ fprintf (f, "ipa-prop: Discovered an indirect call to a known target (");
+ if (jfunc->type == IPA_CONST_MEMBER_PTR)
+ {
+ print_node_brief (f, "", jfunc->value.member_cst.pfn, 0);
+ print_node_brief (f, ", ", jfunc->value.member_cst.delta, 0);
+ }
+ else
+ print_node_brief(f, "", jfunc->value.constant, 0);
+
+ fprintf (f, ") in %s: ", cgraph_node_name (node));
+ print_gimple_stmt (f, nt->stmt, 2, TDF_SLIM);
+}
+
+/* Update the param called notes associated with NODE when CS is being inlined,
+ assuming NODE is (potentially indirectly) inlined into CS->callee.
+ Moreover, if the callee is discovered to be constant, create a new cgraph
+ edge for it. Newly discovered indirect edges will be added to NEW_EDGES,
+ unless it is NULL. */
+static void
+update_call_notes_after_inlining (struct cgraph_edge *cs,
+ struct cgraph_node *node,
+ VEC (cgraph_edge_p, heap) *new_edges)
+{
+ struct ipa_node_params *info = IPA_NODE_REF (node);
+ struct ipa_edge_args *top = IPA_EDGE_REF (cs);
+ struct ipa_param_call_note *nt;
+
+ for (nt = info->param_calls; nt; nt = nt->next)
+ {
+ struct ipa_jump_func *jfunc;
+
+ if (nt->processed)
+ continue;
+
+ /* We must check range due to calls with variable number of arguments: */
+ if (nt->formal_id >= (unsigned) ipa_get_cs_argument_count (top))
+ {
+ nt->processed = true;
+ continue;
+ }
+
+ jfunc = ipa_get_ith_jump_func (top, nt->formal_id);
+ if (jfunc->type == IPA_PASS_THROUGH)
+ nt->formal_id = jfunc->value.formal_id;
+ else if (jfunc->type == IPA_CONST || jfunc->type == IPA_CONST_MEMBER_PTR)
+ {
+ struct cgraph_node *callee;
+ struct cgraph_edge *new_indirect_edge;
+ tree decl;
+
+ nt->processed = true;
+ if (jfunc->type == IPA_CONST_MEMBER_PTR)
+ decl = jfunc->value.member_cst.pfn;
+ else
+ decl = jfunc->value.constant;
+
+ if (TREE_CODE (decl) != FUNCTION_DECL)
+ continue;
+ callee = cgraph_node (decl);
+ if (!callee || !callee->local.inlinable)
+ continue;
+
+ if (dump_file)
+ print_edge_addition_message (dump_file, nt, jfunc, node);
+
+ new_indirect_edge = cgraph_create_edge (node, callee, nt->stmt,
+ nt->count, nt->frequency,
+ nt->loop_nest);
+ new_indirect_edge->indirect_call = 1;
+ ipa_check_create_edge_args ();
+ if (new_edges)
+ VEC_safe_push (cgraph_edge_p, heap, new_edges, new_indirect_edge);
+ }
+ }
+}
+
+/* Recursively traverse subtree of NODE (including node) made of inlined
+ cgraph_edges when CS has been inlined and invoke
+ update_call_notes_after_inlining on all nodes and
+ update_jump_functions_after_inlining on all non-inlined edges that lead out
+ of this subtree. Newly discovered indirect edges will be added to
+ NEW_EDGES, unless it is NULL. */
+static void
+propagate_info_to_inlined_callees (struct cgraph_edge *cs,
+ struct cgraph_node *node,
+ VEC (cgraph_edge_p, heap) *new_edges)
+{
+ struct cgraph_edge *e;
+
+ update_call_notes_after_inlining (cs, node, new_edges);
+
+ for (e = node->callees; e; e = e->next_callee)
+ if (!e->inline_failed)
+ propagate_info_to_inlined_callees (cs, e->callee, new_edges);
+ else
+ update_jump_functions_after_inlining (cs, e);
+}
+
+/* Update jump functions and call note functions on inlining the call site CS.
+ CS is expected to lead to a node already cloned by
+ cgraph_clone_inline_nodes. Newly discovered indirect edges will be added to
+ NEW_EDGES, unless it is NULL. */
+void
+ipa_propagate_indirect_call_infos (struct cgraph_edge *cs,
+ VEC (cgraph_edge_p, heap) *new_edges)
+{
+ propagate_info_to_inlined_callees (cs, cs->callee, new_edges);
}
/* Frees all dynamically allocated structures that the argument info points
@@ -365,8 +1037,15 @@ ipa_free_node_params_substructures (struct ipa_node_params *info)
free (info->ipcp_lattices);
if (info->param_decls)
free (info->param_decls);
- if (info->modified_flags)
- free (info->modified_flags);
+ if (info->param_flags)
+ free (info->param_flags);
+
+ while (info->param_calls)
+ {
+ struct ipa_param_call_note *note = info->param_calls;
+ info->param_calls = note->next;
+ free (note);
+ }
memset (info, 0, sizeof (*info));
}
@@ -445,6 +1124,7 @@ ipa_node_duplication_hook (struct cgraph_node *src, struct cgraph_node *dst,
void *data)
{
struct ipa_node_params *old_info, *new_info;
+ struct ipa_param_call_note *note;
int param_count;
ipa_check_create_node_params ();
@@ -458,12 +1138,24 @@ ipa_node_duplication_hook (struct cgraph_node *src, struct cgraph_node *dst,
sizeof (struct ipcp_lattice) * param_count);
new_info->param_decls = (tree *)
duplicate_array (old_info->param_decls, sizeof (tree) * param_count);
- new_info->modified_flags = (bool *)
- duplicate_array (old_info->modified_flags, sizeof (bool) * param_count);
+ new_info->param_flags = (struct ipa_param_flags *)
+ duplicate_array (old_info->param_flags,
+ sizeof (struct ipa_param_flags) * param_count);
new_info->ipcp_orig_node = old_info->ipcp_orig_node;
new_info->count_scale = old_info->count_scale;
+ for (note = old_info->param_calls; note; note = note->next)
+ {
+ struct ipa_param_call_note *nn;
+
+ nn = (struct ipa_param_call_note *)
+ xcalloc (1, sizeof (struct ipa_param_call_note));
+ memcpy (nn, note, sizeof (struct ipa_param_call_note));
+ nn->next = new_info->param_calls;
+ new_info->param_calls = nn;
+ }
+
data = data; /* Suppressing compiler warning. */
}
@@ -504,6 +1196,19 @@ ipa_unregister_cgraph_hooks (void)
void
free_all_ipa_structures_after_ipa_cp (void)
{
+ if (!flag_indirect_inlining)
+ {
+ ipa_free_all_edge_args ();
+ ipa_free_all_node_params ();
+ ipa_unregister_cgraph_hooks ();
+ }
+}
+
+/* Free all ipa_node_params and all ipa_edge_args structures if they are no
+ longer needed after indirect inlining. */
+void
+free_all_ipa_structures_after_iinln (void)
+{
ipa_free_all_edge_args ();
ipa_free_all_node_params ();
ipa_unregister_cgraph_hooks ();
@@ -521,7 +1226,11 @@ ipa_print_all_tree_maps (FILE * f)
fprintf (f, "\nPARAM TREE MAP PRINT\n");
for (node = cgraph_nodes; node; node = node->next)
{
- struct ipa_node_params *info = IPA_NODE_REF (node);
+ struct ipa_node_params *info;
+
+ if (!node->analyzed)
+ continue;
+ info = IPA_NODE_REF (node);
fprintf (f, "function %s Trees :: \n", cgraph_node_name (node));
count = ipa_get_param_count (info);
for (i = 0; i < count; i++)
@@ -535,29 +1244,37 @@ ipa_print_all_tree_maps (FILE * f)
}
}
-/* Print modified_flags data structures of all functions in the
- callgraph to F. */
+/* Print param_flags data structures of the NODE to F. */
void
-ipa_print_all_params_modified (FILE * f)
+ipa_print_node_param_flags (FILE * f, struct cgraph_node *node)
{
int i, count;
- bool temp;
- struct cgraph_node *node;
+ struct ipa_node_params *info;
- fprintf (f, "\nMODIFY PRINT\n");
- for (node = cgraph_nodes; node; node = node->next)
+ if (!node->analyzed)
+ return;
+ info = IPA_NODE_REF (node);
+ fprintf (f, "PARAM FLAGS of function %s: \n", cgraph_node_name (node));
+ count = ipa_get_param_count (info);
+ for (i = 0; i < count; i++)
{
- struct ipa_node_params *info = IPA_NODE_REF (node);
- fprintf (f, "function %s :: \n", cgraph_node_name (node));
- count = ipa_get_param_count (info);
- for (i = 0; i < count; i++)
- {
- temp = info->modified_flags[i];
- if (temp)
- fprintf (f, " param [%d] true \n", i);
- else
- fprintf (f, " param [%d] false \n", i);
- }
+ fprintf (f, " param %d flags:", i);
+ if (ipa_is_ith_param_modified (info, i))
+ fprintf (f, " modified");
+ if (ipa_is_ith_param_called (info, i))
+ fprintf (f, " called");
+ fprintf (f, "\n");
}
}
+/* Print param_flags data structures of all functions in the
+ callgraph to F. */
+void
+ipa_print_all_param_flags (FILE * f)
+{
+ struct cgraph_node *node;
+
+ fprintf (f, "\nIPA PARAM FLAGS DUMP\n");
+ for (node = cgraph_nodes; node; node = node->next)
+ ipa_print_node_param_flags (f, node);
+}
diff --git a/gcc/ipa-prop.h b/gcc/ipa-prop.h
index e442698bd3a..908a97e7797 100644
--- a/gcc/ipa-prop.h
+++ b/gcc/ipa-prop.h
@@ -22,6 +22,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree.h"
#include "vec.h"
+#include "cgraph.h"
/* The following definitions and interfaces are used by
interprocedural analyses. */
@@ -32,21 +33,23 @@ along with GCC; see the file COPYING3. If not see
Constant - a constant is passed as an actual argument.
Unknown - neither of the above.
Integer and real constants are represented as IPA_CONST and Fortran
- constants are represented as IPA_CONST_REF. */
+ constants are represented as IPA_CONST_REF. Finally, IPA_CONST_MEMBER_PTR
+ stands for C++ member pointers constants. */
enum jump_func_type
{
- IPA_UNKNOWN,
+ IPA_UNKNOWN = 0, /* newly allocated and zeroed jump functions default */
IPA_CONST,
IPA_CONST_REF,
+ IPA_CONST_MEMBER_PTR,
IPA_PASS_THROUGH
};
/* All formal parameters in the program have a lattice associated with it
computed by the interprocedural stage of IPCP.
There are three main values of the lattice:
- TOP - unknown.
- BOTTOM - non constant.
- CONSTANT_TYPE - constant value.
+ IPA_TOP - unknown,
+ IPA_BOTTOM - non constant,
+ IPA_CONST_VALUE - simple scalar constant,
Cval of formal f will have a constant value if all callsites to this
function have the same constant value passed to f.
Integer and real constants are represented as IPA_CONST and Fortran
@@ -59,14 +62,24 @@ enum ipa_lattice_type
IPA_TOP
};
-/* Represents a value of a jump function.
- value represents a constant.
- formal_id is used only in jump function context and represents
- pass-through parameter (the formal of caller is passed as argument). */
+/* Structure holding a C++ member pointer constant. Holds a pointer to the
+ method and delta offset. */
+struct ipa_member_ptr_cst
+{
+ tree pfn;
+ tree delta;
+};
+
+/* Represents a value of a jump function. formal_id is used only in jump
+ function context and represents pass-through parameter (the formal parameter
+ of the caller is passed as argument). constant represents the actual
+ constant in constant jump functions and member_cst holds constant c++ member
+ functions. */
union jump_func_value
{
unsigned int formal_id;
tree constant;
+ struct ipa_member_ptr_cst member_cst;
};
/* A jump function for a callsite represents the values passed as actual
@@ -101,10 +114,43 @@ struct ipa_replace_map
bool ref_p;
};
+/* ipa_param_flags contains various flags that describe how the associated
+ parameter is treated within a function. */
+struct ipa_param_flags
+{
+ /* Whether the value parameter has been modified within the function. */
+ unsigned modified : 1;
+ /* Whether the parameter has been used as a call destination. */
+ unsigned called : 1;
+};
+
+/* Each instance of the following structure describes a statement that calls a
+ function parameter. Those referring to statements within the same function
+ are linked in a list. */
+struct ipa_param_call_note
+{
+ /* Linked list's next */
+ struct ipa_param_call_note *next;
+ /* Statement that contains the call to the parameter above. */
+ gimple stmt;
+ /* Index of the parameter that is called. */
+ unsigned int formal_id;
+ /* Expected number of executions: calculated in profile.c. */
+ gcov_type count;
+ /* Expected frequency of executions within the function. see cgraph_edge in
+ cgraph.h for more on this. */
+ int frequency;
+ /* Depth of loop nest, 1 means no loop nest. */
+ int loop_nest;
+ /* Set when we have already found the target to be a compile time constant
+ and turned this into an edge or when the note was found unusable for some
+ reason. */
+ bool processed;
+};
+
/* ipa_node_params stores information related to formal parameters of functions
and some other information for interprocedural passes that operate on
parameters (such as ipa-cp). */
-
struct ipa_node_params
{
/* Number of formal parameters of this function. When set to 0,
@@ -115,8 +161,10 @@ struct ipa_node_params
struct ipcp_lattice *ipcp_lattices;
/* Mapping each parameter to its PARM_DECL tree. */
tree *param_decls;
- /* Indicating which parameter is modified in its function. */
- bool *modified_flags;
+ /* Various flags describing individual parameters. */
+ struct ipa_param_flags *param_flags;
+ /* List of structures enumerating calls to a formal parameter. */
+ struct ipa_param_call_note *param_calls;
/* Only for versioned nodes this field would not be NULL,
it points to the node that IPA cp cloned from. */
struct cgraph_node *ipcp_orig_node;
@@ -130,6 +178,10 @@ struct ipa_node_params
/* Whether this function is called with variable number of actual
arguments. */
unsigned called_with_var_arguments : 1;
+ /* Whether the modification analysis has already been performed. */
+ unsigned modification_analysis_done : 1;
+ /* Whether the param uses analysis has already been performed. */
+ unsigned uses_analysis_done : 1;
};
/* ipa_node_params access functions. Please use these to access fields that
@@ -164,7 +216,16 @@ ipa_get_ith_param (struct ipa_node_params *info, int i)
static inline bool
ipa_is_ith_param_modified (struct ipa_node_params *info, int i)
{
- return info->modified_flags[i];
+ return info->param_flags[i].modified;
+}
+
+/* Returns the called flag corresponding o the ith paramterer. Note there is
+ no setter method as the goal is to set all flags when building the array in
+ ipa_detect_called_params. */
+static inline bool
+ipa_is_ith_param_called (struct ipa_node_params *info, int i)
+{
+ return info->param_flags[i].called;
}
/* Flag this node as having callers with variable number of arguments. */
@@ -255,6 +316,7 @@ void ipa_free_node_params_substructures (struct ipa_node_params *);
void ipa_free_all_node_params (void);
void ipa_free_all_edge_args (void);
void free_all_ipa_structures_after_ipa_cp (void);
+void free_all_ipa_structures_after_iinln (void);
void ipa_register_cgraph_hooks (void);
/* This function ensures the array of node param infos is big enough to
@@ -287,6 +349,16 @@ ipa_check_create_edge_args (void)
cgraph_edge_max_uid + 1);
}
+/* Returns true if the array of edge infos is large enough to accomodate an
+ info for EDGE. The main purpose of this function is that debug dumping
+ function can check info availability without causing reallocations. */
+static inline bool
+ipa_edge_args_info_available_for_edge_p (struct cgraph_edge *edge)
+{
+ return ((unsigned) edge->uid < VEC_length (ipa_edge_args_t,
+ ipa_edge_args_vector));
+}
+
/* A function list element. It is used to create a temporary worklist used in
the propagation stage of IPCP. (can be used for more IPA optimizations) */
struct ipa_func_list
@@ -308,9 +380,15 @@ void ipa_count_arguments (struct cgraph_edge *);
void ipa_count_formal_params (struct cgraph_node *);
void ipa_create_param_decls_array (struct cgraph_node *);
void ipa_detect_param_modifications (struct cgraph_node *);
+void ipa_analyze_params_uses (struct cgraph_node *);
+void ipa_propagate_indirect_call_infos (struct cgraph_edge *cs,
+ VEC (cgraph_edge_p, heap) *new_edges);
/* Debugging interface. */
void ipa_print_all_tree_maps (FILE *);
-void ipa_print_all_params_modified (FILE *);
+void ipa_print_node_param_flags (FILE * f, struct cgraph_node *node);
+void ipa_print_all_param_flags (FILE *);
+void ipa_print_node_jump_functions (FILE *f, struct cgraph_node *node);
+void ipa_print_all_jump_functions (FILE * f);
#endif /* IPA_PROP_H */
diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c
index 3b2cdaee2a1..7720d304a2d 100644
--- a/gcc/ipa-pure-const.c
+++ b/gcc/ipa-pure-const.c
@@ -44,7 +44,7 @@ along with GCC; see the file COPYING3. If not see
#include "ggc.h"
#include "ipa-utils.h"
#include "c-common.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "cgraph.h"
#include "output.h"
#include "flags.h"
@@ -276,42 +276,47 @@ check_lhs_var (funct_state local, tree t)
actual asm statement. */
static void
-get_asm_expr_operands (funct_state local, tree stmt)
+get_asm_expr_operands (funct_state local, gimple stmt)
{
- int noutputs = list_length (ASM_OUTPUTS (stmt));
+ size_t noutputs = gimple_asm_noutputs (stmt);
const char **oconstraints
= (const char **) alloca ((noutputs) * sizeof (const char *));
- int i;
- tree link;
+ size_t i;
+ tree op;
const char *constraint;
bool allows_mem, allows_reg, is_inout;
- for (i=0, link = ASM_OUTPUTS (stmt); link; ++i, link = TREE_CHAIN (link))
+ for (i = 0; i < noutputs; i++)
{
+ op = gimple_asm_output_op (stmt, i);
oconstraints[i] = constraint
- = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (link)));
+ = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (op)));
parse_output_constraint (&constraint, i, 0, 0,
&allows_mem, &allows_reg, &is_inout);
- check_lhs_var (local, TREE_VALUE (link));
+ check_lhs_var (local, TREE_VALUE (op));
}
- for (link = ASM_INPUTS (stmt); link; link = TREE_CHAIN (link))
+ for (i = 0; i < gimple_asm_ninputs (stmt); i++)
{
+ op = gimple_asm_input_op (stmt, i);
constraint
- = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (link)));
+ = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (op)));
parse_input_constraint (&constraint, 0, 0, noutputs, 0,
oconstraints, &allows_mem, &allows_reg);
- check_rhs_var (local, TREE_VALUE (link));
+ check_rhs_var (local, TREE_VALUE (op));
}
- for (link = ASM_CLOBBERS (stmt); link; link = TREE_CHAIN (link))
- if (simple_cst_equal(TREE_VALUE (link), memory_identifier_string) == 1)
- /* Abandon all hope, ye who enter here. */
- local->pure_const_state = IPA_NEITHER;
+ for (i = 0; i < gimple_asm_nclobbers (stmt); i++)
+ {
+ op = gimple_asm_clobber_op (stmt, i);
+ if (simple_cst_equal(TREE_VALUE (op), memory_identifier_string) == 1)
+ /* Abandon all hope, ye who enter here. */
+ local->pure_const_state = IPA_NEITHER;
+ }
- if (ASM_VOLATILE_P (stmt))
+ if (gimple_asm_volatile_p (stmt))
local->pure_const_state = IPA_NEITHER;
}
@@ -323,17 +328,20 @@ get_asm_expr_operands (funct_state local, tree stmt)
the entire call expression. */
static void
-check_call (funct_state local, tree call_expr)
+check_call (funct_state local, gimple call)
{
- int flags = call_expr_flags (call_expr);
- tree operand;
- call_expr_arg_iterator iter;
- tree callee_t = get_callee_fndecl (call_expr);
+ int flags = gimple_call_flags (call);
+ tree lhs, callee_t = gimple_call_fndecl (call);
struct cgraph_node* callee;
enum availability avail = AVAIL_NOT_AVAILABLE;
+ size_t i;
+
+ lhs = gimple_call_lhs (call);
+ if (lhs)
+ check_lhs_var (local, lhs);
- FOR_EACH_CALL_EXPR_ARG (operand, iter, call_expr)
- check_rhs_var (local, operand);
+ for (i = 0; i < gimple_call_num_args (call); i++)
+ check_rhs_var (local, gimple_call_arg (call, i));
/* The const and pure flags are set by a variety of places in the
compiler (including here). If someone has already set the flags
@@ -405,11 +413,10 @@ check_call (funct_state local, tree call_expr)
should be converted to use the operand scanner. */
static tree
-scan_function (tree *tp,
- int *walk_subtrees,
- void *data)
+scan_function_op (tree *tp, int *walk_subtrees, void *data)
{
- struct cgraph_node *fn = (struct cgraph_node *) data;
+ struct walk_stmt_info *wi = (struct walk_stmt_info *) data;
+ struct cgraph_node *fn = (struct cgraph_node *) wi->info;
tree t = *tp;
funct_state local = get_function_state (fn);
@@ -417,58 +424,72 @@ scan_function (tree *tp,
{
case VAR_DECL:
if (DECL_INITIAL (t))
- walk_tree (&DECL_INITIAL (t), scan_function, fn, visited_nodes);
+ walk_tree (&DECL_INITIAL (t), scan_function_op, data, visited_nodes);
*walk_subtrees = 0;
break;
- case GIMPLE_MODIFY_STMT:
+ case ADDR_EXPR:
+ /* This case is here to find addresses on rhs of constructors in
+ decl_initial of static variables. */
+ check_rhs_var (local, t);
+ *walk_subtrees = 0;
+ break;
+
+ default:
+ break;
+ }
+ return NULL;
+}
+
+static tree
+scan_function_stmt (gimple_stmt_iterator *gsi_p,
+ bool *handled_ops_p,
+ struct walk_stmt_info *wi)
+{
+ struct cgraph_node *fn = (struct cgraph_node *) wi->info;
+ gimple stmt = gsi_stmt (*gsi_p);
+ funct_state local = get_function_state (fn);
+
+ switch (gimple_code (stmt))
+ {
+ case GIMPLE_ASSIGN:
{
/* First look on the lhs and see what variable is stored to */
- tree lhs = GIMPLE_STMT_OPERAND (t, 0);
- tree rhs = GIMPLE_STMT_OPERAND (t, 1);
+ tree lhs = gimple_assign_lhs (stmt);
+ tree rhs1 = gimple_assign_rhs1 (stmt);
+ tree rhs2 = gimple_assign_rhs2 (stmt);
+ enum tree_code code = gimple_assign_rhs_code (stmt);
+
check_lhs_var (local, lhs);
/* For the purposes of figuring out what the cast affects */
/* Next check the operands on the rhs to see if they are ok. */
- switch (TREE_CODE_CLASS (TREE_CODE (rhs)))
+ switch (TREE_CODE_CLASS (code))
{
case tcc_binary:
{
- tree op0 = TREE_OPERAND (rhs, 0);
- tree op1 = TREE_OPERAND (rhs, 1);
- check_rhs_var (local, op0);
- check_rhs_var (local, op1);
+ check_rhs_var (local, rhs1);
+ check_rhs_var (local, rhs2);
}
break;
case tcc_unary:
{
- tree op0 = TREE_OPERAND (rhs, 0);
- check_rhs_var (local, op0);
+ check_rhs_var (local, rhs1);
}
break;
case tcc_reference:
- check_rhs_var (local, rhs);
+ check_rhs_var (local, rhs1);
break;
case tcc_declaration:
- check_rhs_var (local, rhs);
+ check_rhs_var (local, rhs1);
break;
case tcc_expression:
- switch (TREE_CODE (rhs))
+ switch (code)
{
case ADDR_EXPR:
- check_rhs_var (local, rhs);
- break;
- default:
- break;
- }
- break;
- case tcc_vl_exp:
- switch (TREE_CODE (rhs))
- {
- case CALL_EXPR:
- check_call (local, rhs);
+ check_rhs_var (local, rhs1);
break;
default:
break;
@@ -477,19 +498,12 @@ scan_function (tree *tp,
default:
break;
}
- *walk_subtrees = 0;
+ *handled_ops_p = true;
}
break;
- case ADDR_EXPR:
- /* This case is here to find addresses on rhs of constructors in
- decl_initial of static variables. */
- check_rhs_var (local, t);
- *walk_subtrees = 0;
- break;
-
- case LABEL_EXPR:
- if (DECL_NONLOCAL (TREE_OPERAND (t, 0)))
+ case GIMPLE_LABEL:
+ if (DECL_NONLOCAL (gimple_label_label (stmt)))
/* Target of long jump. */
{
local->pure_const_state = IPA_NEITHER;
@@ -497,14 +511,14 @@ scan_function (tree *tp,
}
break;
- case CALL_EXPR:
- check_call (local, t);
- *walk_subtrees = 0;
+ case GIMPLE_CALL:
+ check_call (local, stmt);
+ *handled_ops_p = true;
break;
- case ASM_EXPR:
- get_asm_expr_operands (local, t);
- *walk_subtrees = 0;
+ case GIMPLE_ASM:
+ get_asm_expr_operands (local, stmt);
+ *handled_ops_p = true;
break;
default:
@@ -567,11 +581,18 @@ analyze_function (struct cgraph_node *fn)
FOR_EACH_BB_FN (this_block, this_cfun)
{
- block_stmt_iterator bsi;
- for (bsi = bsi_start (this_block); !bsi_end_p (bsi); bsi_next (&bsi))
+ gimple_stmt_iterator gsi;
+ struct walk_stmt_info wi;
+
+ memset (&wi, 0, sizeof(wi));
+ for (gsi = gsi_start_bb (this_block);
+ !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
- walk_tree (bsi_stmt_ptr (bsi), scan_function,
- fn, visited_nodes);
+ wi.info = fn;
+ wi.pset = visited_nodes;
+ walk_gimple_stmt (&gsi, scan_function_stmt, scan_function_op,
+ &wi);
if (l->pure_const_state == IPA_NEITHER)
goto end;
}
@@ -771,7 +792,7 @@ static_execute (void)
static bool
gate_pure_const (void)
{
- return (flag_unit_at_a_time != 0 && flag_ipa_pure_const
+ return (flag_ipa_pure_const
/* Don't bother doing anything if the program has errors. */
&& !(errorcount || sorrycount));
}
diff --git a/gcc/ipa-reference.c b/gcc/ipa-reference.c
index 75aed2f52f6..c28c7327f2c 100644
--- a/gcc/ipa-reference.c
+++ b/gcc/ipa-reference.c
@@ -45,8 +45,7 @@ along with GCC; see the file COPYING3. If not see
Currently must be run after inlining decisions have been made since
otherwise, the local sets will not contain information that is
consistent with post inlined state. The global sets are not prone
- to this problem since they are by definition transitive.
-*/
+ to this problem since they are by definition transitive. */
#include "config.h"
#include "system.h"
@@ -62,7 +61,7 @@ along with GCC; see the file COPYING3. If not see
#include "ipa-utils.h"
#include "ipa-reference.h"
#include "c-common.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "cgraph.h"
#include "output.h"
#include "flags.h"
@@ -388,43 +387,48 @@ check_lhs_var (ipa_reference_local_vars_info_t local, tree t)
function being analyzed and STMT is the actual asm statement. */
static void
-get_asm_expr_operands (ipa_reference_local_vars_info_t local, tree stmt)
+get_asm_stmt_operands (ipa_reference_local_vars_info_t local, gimple stmt)
{
- int noutputs = list_length (ASM_OUTPUTS (stmt));
+ size_t noutputs = gimple_asm_noutputs (stmt);
const char **oconstraints
= (const char **) alloca ((noutputs) * sizeof (const char *));
- int i;
- tree link;
+ size_t i;
+ tree op;
const char *constraint;
bool allows_mem, allows_reg, is_inout;
- for (i=0, link = ASM_OUTPUTS (stmt); link; ++i, link = TREE_CHAIN (link))
+ for (i = 0; i < noutputs; i++)
{
+ op = gimple_asm_output_op (stmt, i);
oconstraints[i] = constraint
- = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (link)));
+ = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (op)));
parse_output_constraint (&constraint, i, 0, 0,
&allows_mem, &allows_reg, &is_inout);
- check_lhs_var (local, TREE_VALUE (link));
+ check_lhs_var (local, TREE_VALUE (op));
}
- for (link = ASM_INPUTS (stmt); link; link = TREE_CHAIN (link))
+ for (i = 0; i < gimple_asm_ninputs (stmt); i++)
{
+ op = gimple_asm_input_op (stmt, i);
constraint
- = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (link)));
+ = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (op)));
parse_input_constraint (&constraint, 0, 0, noutputs, 0,
oconstraints, &allows_mem, &allows_reg);
- check_rhs_var (local, TREE_VALUE (link));
+ check_rhs_var (local, TREE_VALUE (op));
}
- for (link = ASM_CLOBBERS (stmt); link; link = TREE_CHAIN (link))
- if (simple_cst_equal(TREE_VALUE (link), memory_identifier_string) == 1)
- {
- /* Abandon all hope, ye who enter here. */
- local->calls_read_all = true;
- local->calls_write_all = true;
- }
+ for (i = 0; i < gimple_asm_nclobbers (stmt); i++)
+ {
+ op = gimple_asm_clobber_op (stmt, i);
+ if (simple_cst_equal(TREE_VALUE (op), memory_identifier_string) == 1)
+ {
+ /* Abandon all hope, ye who enter here. */
+ local->calls_read_all = true;
+ local->calls_write_all = true;
+ }
+ }
}
/* Check the parameters of a function call from CALLER to CALL_EXPR to
@@ -435,16 +439,19 @@ get_asm_expr_operands (ipa_reference_local_vars_info_t local, tree stmt)
the tree node for the entire call expression. */
static void
-check_call (ipa_reference_local_vars_info_t local, tree call_expr)
+check_call (ipa_reference_local_vars_info_t local, gimple stmt)
{
- int flags = call_expr_flags (call_expr);
+ int flags = gimple_call_flags (stmt);
tree operand;
- tree callee_t = get_callee_fndecl (call_expr);
+ tree callee_t = gimple_call_fndecl (stmt);
enum availability avail = AVAIL_NOT_AVAILABLE;
- call_expr_arg_iterator iter;
+ size_t i;
- FOR_EACH_CALL_EXPR_ARG (operand, iter, call_expr)
- check_rhs_var (local, operand);
+ if ((operand = gimple_call_lhs (stmt)) != NULL)
+ check_lhs_var (local, operand);
+
+ for (i = 0; i < gimple_call_num_args (stmt); i++)
+ check_rhs_var (local, gimple_call_arg (stmt, i));
if (callee_t)
{
@@ -473,73 +480,49 @@ check_call (ipa_reference_local_vars_info_t local, tree call_expr)
should be converted to use the operand scanner. */
static tree
-scan_for_static_refs (tree *tp,
- int *walk_subtrees,
- void *data)
+scan_stmt_for_static_refs (gimple_stmt_iterator *gsip, bool *handled_ops_p,
+ struct walk_stmt_info *data)
{
- struct cgraph_node *fn = (struct cgraph_node *) data;
- tree t = *tp;
+ struct cgraph_node *fn = (struct cgraph_node *) data->info;
+ gimple stmt = gsi_stmt (*gsip);
ipa_reference_local_vars_info_t local = NULL;
if (fn)
local = get_reference_vars_info_from_cgraph (fn)->local;
- switch (TREE_CODE (t))
+ switch (gimple_code (stmt))
{
- case VAR_DECL:
- if (DECL_INITIAL (t))
- walk_tree (&DECL_INITIAL (t), scan_for_static_refs, fn, visited_nodes);
- *walk_subtrees = 0;
- break;
-
- case GIMPLE_MODIFY_STMT:
+ case GIMPLE_ASSIGN:
{
/* First look on the lhs and see what variable is stored to */
- tree lhs = GIMPLE_STMT_OPERAND (t, 0);
- tree rhs = GIMPLE_STMT_OPERAND (t, 1);
+ tree lhs = gimple_assign_lhs (stmt);
+ tree rhs1 = gimple_assign_rhs1 (stmt);
+ tree rhs2 = gimple_assign_rhs2 (stmt);
+ enum tree_code code = gimple_assign_rhs_code (stmt);
+
check_lhs_var (local, lhs);
/* For the purposes of figuring out what the cast affects */
/* Next check the operands on the rhs to see if they are ok. */
- switch (TREE_CODE_CLASS (TREE_CODE (rhs)))
+ switch (TREE_CODE_CLASS (code))
{
case tcc_binary:
case tcc_comparison:
- {
- tree op0 = TREE_OPERAND (rhs, 0);
- tree op1 = TREE_OPERAND (rhs, 1);
- check_rhs_var (local, op0);
- check_rhs_var (local, op1);
- }
+ check_rhs_var (local, rhs1);
+ check_rhs_var (local, rhs2);
break;
- case tcc_unary:
- {
- tree op0 = TREE_OPERAND (rhs, 0);
- check_rhs_var (local, op0);
- }
- break;
+ case tcc_unary:
case tcc_reference:
- check_rhs_var (local, rhs);
- break;
case tcc_declaration:
- check_rhs_var (local, rhs);
+ check_rhs_var (local, rhs1);
break;
+
case tcc_expression:
- switch (TREE_CODE (rhs))
+ switch (code)
{
case ADDR_EXPR:
- check_rhs_var (local, rhs);
- break;
- default:
- break;
- }
- break;
- case tcc_vl_exp:
- switch (TREE_CODE (rhs))
- {
- case CALL_EXPR:
- check_call (local, rhs);
+ check_rhs_var (local, rhs1);
break;
default:
break;
@@ -548,19 +531,12 @@ scan_for_static_refs (tree *tp,
default:
break;
}
- *walk_subtrees = 0;
+ *handled_ops_p = true;
}
break;
- case ADDR_EXPR:
- /* This case is here to find addresses on rhs of constructors in
- decl_initial of static variables. */
- check_rhs_var (local, t);
- *walk_subtrees = 0;
- break;
-
- case LABEL_EXPR:
- if (DECL_NONLOCAL (TREE_OPERAND (t, 0)))
+ case GIMPLE_LABEL:
+ if (DECL_NONLOCAL (gimple_label_label (stmt)))
{
/* Target of long jump. */
local->calls_read_all = true;
@@ -568,14 +544,14 @@ scan_for_static_refs (tree *tp,
}
break;
- case CALL_EXPR:
- check_call (local, t);
- *walk_subtrees = 0;
+ case GIMPLE_CALL:
+ check_call (local, stmt);
+ *handled_ops_p = true;
break;
- case ASM_EXPR:
- get_asm_expr_operands (local, t);
- *walk_subtrees = 0;
+ case GIMPLE_ASM:
+ get_asm_stmt_operands (local, stmt);
+ *handled_ops_p = true;
break;
default:
@@ -584,6 +560,42 @@ scan_for_static_refs (tree *tp,
return NULL;
}
+/* Call-back to scan GIMPLE operands for static references. This is supposed
+ to work with scan_stmt_for_static_refs so the real call-back data is stored
+ inside a walk_stmt_info struct. Callers using the walk_tree interface must
+ also wrap the call-back data in a walk_stmt_info struct. */
+
+static tree
+scan_op_for_static_refs (tree *tp, int *walk_subtrees, void *data)
+{
+ struct walk_stmt_info *wi = (struct walk_stmt_info*) data;
+ struct cgraph_node *fn = (struct cgraph_node *) wi->info;
+ tree t = *tp;
+ ipa_reference_local_vars_info_t local = NULL;
+ if (fn)
+ local = get_reference_vars_info_from_cgraph (fn)->local;
+
+ switch (TREE_CODE (t))
+ {
+ case VAR_DECL:
+ if (DECL_INITIAL (t))
+ walk_tree (&DECL_INITIAL (t), scan_op_for_static_refs, data,
+ wi->pset);
+ *walk_subtrees = 0;
+ break;
+
+ case ADDR_EXPR:
+ /* This case is here to find addresses on rhs of constructors in
+ decl_initial of static variables. */
+ check_rhs_var (local, t);
+ *walk_subtrees = 0;
+ break;
+
+ default:
+ break;
+ }
+ return NULL;
+}
/* Lookup the tree node for the static variable that has UID. */
static tree
@@ -777,9 +789,13 @@ ipa_init (void)
static void
analyze_variable (struct varpool_node *vnode)
{
+ struct walk_stmt_info wi;
tree global = vnode->decl;
- walk_tree (&DECL_INITIAL (global), scan_for_static_refs,
- NULL, visited_nodes);
+
+ memset (&wi, 0, sizeof (wi));
+ wi.pset = visited_nodes;
+ walk_tree (&DECL_INITIAL (global), scan_op_for_static_refs,
+ &wi, wi.pset);
}
/* This is the main routine for finding the reference patterns for
@@ -793,6 +809,7 @@ analyze_function (struct cgraph_node *fn)
ipa_reference_local_vars_info_t l
= XCNEW (struct ipa_reference_local_vars_info_d);
tree decl = fn->decl;
+ struct walk_stmt_info wi;
/* Add the info to the tree's annotation. */
get_function_ann (fn->decl)->reference_vars_info = info;
@@ -810,14 +827,18 @@ analyze_function (struct cgraph_node *fn)
FOR_EACH_BB_FN (this_block, this_cfun)
{
- block_stmt_iterator bsi;
- tree phi, op;
+ gimple_stmt_iterator gsi;
+ gimple phi;
+ tree op;
use_operand_p use;
ssa_op_iter iter;
/* Find the addresses taken in phi node arguments. */
- for (phi = phi_nodes (this_block); phi; phi = PHI_CHAIN (phi))
+ for (gsi = gsi_start_phis (this_block);
+ !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
+ phi = gsi_stmt (gsi);
FOR_EACH_PHI_ARG (use, phi, iter, SSA_OP_USE)
{
op = USE_FROM_PTR (use);
@@ -826,9 +847,12 @@ analyze_function (struct cgraph_node *fn)
}
}
- for (bsi = bsi_start (this_block); !bsi_end_p (bsi); bsi_next (&bsi))
- walk_tree (bsi_stmt_ptr (bsi), scan_for_static_refs,
- fn, visited_nodes);
+ memset (&wi, 0, sizeof (wi));
+ wi.info = fn;
+ wi.pset = visited_nodes;
+ for (gsi = gsi_start_bb (this_block); !gsi_end_p (gsi); gsi_next (&gsi))
+ walk_gimple_stmt (&gsi, scan_stmt_for_static_refs,
+ scan_op_for_static_refs, &wi);
}
}
@@ -844,8 +868,13 @@ analyze_function (struct cgraph_node *fn)
if (TREE_CODE (var) == VAR_DECL
&& DECL_INITIAL (var)
&& !TREE_STATIC (var))
- walk_tree (&DECL_INITIAL (var), scan_for_static_refs,
- fn, visited_nodes);
+ {
+ memset (&wi, 0, sizeof (wi));
+ wi.info = fn;
+ wi.pset = visited_nodes;
+ walk_tree (&DECL_INITIAL (var), scan_op_for_static_refs,
+ &wi, wi.pset);
+ }
}
}
}
@@ -1314,7 +1343,7 @@ static_execute (void)
static bool
gate_reference (void)
{
- return (flag_unit_at_a_time != 0 && flag_ipa_reference
+ return (flag_ipa_reference
/* Don't bother doing anything if the program has errors. */
&& !(errorcount || sorrycount));
}
@@ -1339,4 +1368,3 @@ struct simple_ipa_opt_pass pass_ipa_reference =
};
#include "gt-ipa-reference.h"
-
diff --git a/gcc/ipa-struct-reorg.c b/gcc/ipa-struct-reorg.c
index fffb454d831..d6bca8ab722 100644
--- a/gcc/ipa-struct-reorg.c
+++ b/gcc/ipa-struct-reorg.c
@@ -28,7 +28,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "ggc.h"
#include "tree.h"
#include "rtl.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "tree-inline.h"
#include "tree-flow.h"
#include "tree-flow-inline.h"
@@ -55,6 +55,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "ipa-type-escape.h"
#include "tree-dump.h"
#include "c-common.h"
+#include "gimple.h"
/* This optimization implements structure peeling.
@@ -168,7 +169,7 @@ typedef const struct new_var_data *const_new_var;
/* This structure represents allocation site of the structure. */
typedef struct alloc_site
{
- tree stmt;
+ gimple stmt;
d_str str;
} alloc_site_t;
@@ -235,7 +236,7 @@ get_type_of_var (tree var)
/* Set of actions we do for each newly generated STMT. */
static inline void
-finalize_stmt (tree stmt)
+finalize_stmt (gimple stmt)
{
update_stmt (stmt);
mark_symbols_for_renaming (stmt);
@@ -244,9 +245,9 @@ finalize_stmt (tree stmt)
/* This function finalizes STMT and appends it to the list STMTS. */
static inline void
-finalize_stmt_and_append (tree *stmts, tree stmt)
+finalize_stmt_and_append (gimple_seq *stmts, gimple stmt)
{
- append_to_statement_list (stmt, stmts);
+ gimple_seq_add_stmt (stmts, stmt);
finalize_stmt (stmt);
}
@@ -307,25 +308,24 @@ find_field_in_struct (d_str str, tree field_decl)
static bool
is_result_of_mult (tree arg, tree *num, tree struct_size)
{
- tree size_def_stmt = SSA_NAME_DEF_STMT (arg);
+ gimple size_def_stmt = SSA_NAME_DEF_STMT (arg);
/* If the allocation statement was of the form
D.2229_10 = <alloc_func> (D.2228_9);
then size_def_stmt can be D.2228_9 = num.3_8 * 8; */
- if (size_def_stmt && TREE_CODE (size_def_stmt) == GIMPLE_MODIFY_STMT)
+ if (size_def_stmt && is_gimple_assign (size_def_stmt))
{
- tree lhs = GIMPLE_STMT_OPERAND (size_def_stmt, 0);
- tree rhs = GIMPLE_STMT_OPERAND (size_def_stmt, 1);
+ tree lhs = gimple_assign_lhs (size_def_stmt);
/* We expect temporary here. */
if (!is_gimple_reg (lhs))
return false;
- if (TREE_CODE (rhs) == MULT_EXPR)
+ if (gimple_assign_rhs_code (size_def_stmt) == MULT_EXPR)
{
- tree arg0 = TREE_OPERAND (rhs, 0);
- tree arg1 = TREE_OPERAND (rhs, 1);
+ tree arg0 = gimple_assign_rhs1 (size_def_stmt);
+ tree arg1 = gimple_assign_rhs2 (size_def_stmt);
if (operand_equal_p (arg0, struct_size, OEP_ONLY_CONST))
{
@@ -356,8 +356,9 @@ static bool
decompose_indirect_ref_acc (tree str_decl, struct field_access_site *acc)
{
tree ref_var;
- tree rhs, struct_size, op0, op1;
+ tree struct_size, op0, op1;
tree before_cast;
+ enum tree_code rhs_code;
ref_var = TREE_OPERAND (acc->ref, 0);
@@ -366,20 +367,20 @@ decompose_indirect_ref_acc (tree str_decl, struct field_access_site *acc)
acc->ref_def_stmt = SSA_NAME_DEF_STMT (ref_var);
if (!(acc->ref_def_stmt)
- || (TREE_CODE (acc->ref_def_stmt) != GIMPLE_MODIFY_STMT))
+ || (gimple_code (acc->ref_def_stmt) != GIMPLE_ASSIGN))
return false;
- rhs = GIMPLE_STMT_OPERAND (acc->ref_def_stmt, 1);
+ rhs_code = gimple_assign_rhs_code (acc->ref_def_stmt);
- if (TREE_CODE (rhs) != PLUS_EXPR
- && TREE_CODE (rhs)!= MINUS_EXPR
- && TREE_CODE (rhs) != POINTER_PLUS_EXPR)
+ if (rhs_code != PLUS_EXPR
+ && rhs_code != MINUS_EXPR
+ && rhs_code != POINTER_PLUS_EXPR)
return false;
- op0 = TREE_OPERAND (rhs, 0);
- op1 = TREE_OPERAND (rhs, 1);
+ op0 = gimple_assign_rhs1 (acc->ref_def_stmt);
+ op1 = gimple_assign_rhs2 (acc->ref_def_stmt);
- if (!is_array_access_through_pointer_and_index (TREE_CODE (rhs), op0, op1,
+ if (!is_array_access_through_pointer_and_index (rhs_code, op0, op1,
&acc->base, &acc->offset,
&acc->cast_stmt))
return false;
@@ -438,7 +439,7 @@ make_field_acc_node (void)
if it is already in hashtable of function accesses F_ACCS. */
static struct field_access_site *
-is_in_field_accs (tree stmt, htab_t f_accs)
+is_in_field_accs (gimple stmt, htab_t f_accs)
{
return (struct field_access_site *)
htab_find_with_hash (f_accs, stmt, htab_hash_pointer (stmt));
@@ -466,7 +467,7 @@ add_field_acc_to_acc_sites (struct field_access_site *acc,
accesses ACCS, this function creates it. */
static void
-add_access_to_acc_sites (tree stmt, tree var, htab_t accs)
+add_access_to_acc_sites (gimple stmt, tree var, htab_t accs)
{
struct access_site *acc;
@@ -538,23 +539,6 @@ finalize_new_vars_creation (void **slot, void *data ATTRIBUTE_UNUSED)
return 1;
}
-/* This function updates statements in STMT_LIST with BB info. */
-
-static void
-add_bb_info (basic_block bb, tree stmt_list)
-{
- if (TREE_CODE (stmt_list) == STATEMENT_LIST)
- {
- tree_stmt_iterator tsi;
- for (tsi = tsi_start (stmt_list); !tsi_end_p (tsi); tsi_next (&tsi))
- {
- tree stmt = tsi_stmt (tsi);
-
- set_bb_for_stmt (stmt, bb);
- }
- }
-}
-
/* This function looks for the variable of NEW_TYPE type, stored in VAR.
It returns it, if found, and NULL_TREE otherwise. */
@@ -610,12 +594,12 @@ find_new_var_of_type (tree orig_var, tree new_type)
res = NUM * sizeof(TYPE) and returns it.
res is filled into RES. */
-static tree
+static gimple
gen_size (tree num, tree type, tree *res)
{
tree struct_size = TYPE_SIZE_UNIT (type);
HOST_WIDE_INT struct_size_int = TREE_INT_CST_LOW (struct_size);
- tree new_stmt;
+ gimple new_stmt;
*res = create_tmp_var (TREE_TYPE (num), NULL);
@@ -625,17 +609,13 @@ gen_size (tree num, tree type, tree *res)
if (exact_log2 (struct_size_int) == -1)
{
tree size = build_int_cst (TREE_TYPE (num), struct_size_int);
- new_stmt = build_gimple_modify_stmt (*res, build2 (MULT_EXPR,
- TREE_TYPE (num),
- num, size));
+ new_stmt = gimple_build_assign_with_ops (MULT_EXPR, *res, num, size);
}
else
{
tree C = build_int_cst (TREE_TYPE (num), exact_log2 (struct_size_int));
- new_stmt = build_gimple_modify_stmt (*res, build2 (LSHIFT_EXPR,
- TREE_TYPE (num),
- num, C));
+ new_stmt = gimple_build_assign_with_ops (LSHIFT_EXPR, *res, num, C);
}
finalize_stmt (new_stmt);
@@ -646,21 +626,18 @@ gen_size (tree num, tree type, tree *res)
BEFORE_CAST to NEW_TYPE. The cast result variable is stored
into RES_P. ORIG_CAST_STMT is the original cast statement. */
-static tree
-gen_cast_stmt (tree before_cast, tree new_type, tree orig_cast_stmt,
+static gimple
+gen_cast_stmt (tree before_cast, tree new_type, gimple orig_cast_stmt,
tree *res_p)
{
- tree lhs, new_lhs, new_stmt;
- gcc_assert (TREE_CODE (orig_cast_stmt) == GIMPLE_MODIFY_STMT);
-
- lhs = GIMPLE_STMT_OPERAND (orig_cast_stmt, 0);
+ tree lhs, new_lhs;
+ gimple new_stmt;
+
+ lhs = gimple_assign_lhs (orig_cast_stmt);
new_lhs = find_new_var_of_type (lhs, new_type);
gcc_assert (new_lhs);
- new_stmt = build_gimple_modify_stmt (new_lhs,
- build1 (NOP_EXPR,
- TREE_TYPE (new_lhs),
- before_cast));
+ new_stmt = gimple_build_assign_with_ops (NOP_EXPR, new_lhs, before_cast, 0);
finalize_stmt (new_stmt);
*res_p = new_lhs;
return new_stmt;
@@ -673,12 +650,14 @@ static edge
make_edge_and_fix_phis_of_dest (basic_block bb, edge e)
{
edge new_e;
- tree phi, arg;
+ tree arg;
+ gimple_stmt_iterator si;
new_e = make_edge (bb, e->dest, e->flags);
- for (phi = phi_nodes (new_e->dest); phi; phi = PHI_CHAIN (phi))
+ for (si = gsi_start_phis (new_e->dest); !gsi_end_p (si); gsi_next (&si))
{
+ gimple phi = gsi_stmt (si);
arg = PHI_ARG_DEF_FROM_EDGE (phi, e);
add_phi_arg (phi, arg, new_e);
}
@@ -686,32 +665,46 @@ make_edge_and_fix_phis_of_dest (basic_block bb, edge e)
return new_e;
}
-/* This function inserts NEW_STMTS before STMT. */
+/* This function inserts NEW_STMT before STMT. */
static void
-insert_before_stmt (tree stmt, tree new_stmts)
+insert_before_stmt (gimple stmt, gimple new_stmt)
{
- block_stmt_iterator bsi;
+ gimple_stmt_iterator bsi;
- if (!stmt || !new_stmts)
+ if (!stmt || !new_stmt)
return;
- bsi = bsi_for_stmt (stmt);
- bsi_insert_before (&bsi, new_stmts, BSI_SAME_STMT);
+ bsi = gsi_for_stmt (stmt);
+ gsi_insert_before (&bsi, new_stmt, GSI_SAME_STMT);
}
/* Insert NEW_STMTS after STMT. */
static void
-insert_after_stmt (tree stmt, tree new_stmts)
+insert_seq_after_stmt (gimple stmt, gimple_seq new_stmts)
{
- block_stmt_iterator bsi;
+ gimple_stmt_iterator bsi;
if (!stmt || !new_stmts)
return;
- bsi = bsi_for_stmt (stmt);
- bsi_insert_after (&bsi, new_stmts, BSI_SAME_STMT);
+ bsi = gsi_for_stmt (stmt);
+ gsi_insert_seq_after (&bsi, new_stmts, GSI_SAME_STMT);
+}
+
+/* Insert NEW_STMT after STMT. */
+
+static void
+insert_after_stmt (gimple stmt, gimple new_stmt)
+{
+ gimple_stmt_iterator bsi;
+
+ if (!stmt || !new_stmt)
+ return;
+
+ bsi = gsi_for_stmt (stmt);
+ gsi_insert_after (&bsi, new_stmt, GSI_SAME_STMT);
}
/* This function returns vector of allocation sites
@@ -730,20 +723,20 @@ get_fallocs (tree fn_decl)
p_8 = (struct str_t *) D.2225_7;
which is returned by this function. */
-static tree
-get_final_alloc_stmt (tree alloc_stmt)
+static gimple
+get_final_alloc_stmt (gimple alloc_stmt)
{
- tree final_stmt;
+ gimple final_stmt;
use_operand_p use_p;
tree alloc_res;
if (!alloc_stmt)
return NULL;
- if (TREE_CODE (alloc_stmt) != GIMPLE_MODIFY_STMT)
+ if (!is_gimple_call (alloc_stmt))
return NULL;
- alloc_res = GIMPLE_STMT_OPERAND (alloc_stmt, 0);
+ alloc_res = gimple_get_lhs (alloc_stmt);
if (TREE_CODE (alloc_res) != SSA_NAME)
return NULL;
@@ -758,7 +751,7 @@ get_final_alloc_stmt (tree alloc_stmt)
sites of function FN_DECL. It returns false otherwise. */
static bool
-is_part_of_malloc (tree stmt, tree fn_decl)
+is_part_of_malloc (gimple stmt, tree fn_decl)
{
fallocs_t fallocs = get_fallocs (fn_decl);
@@ -767,8 +760,7 @@ is_part_of_malloc (tree stmt, tree fn_decl)
alloc_site_t *call;
unsigned i;
- for (i = 0;
- VEC_iterate (alloc_site_t, fallocs->allocs, i, call); i++)
+ for (i = 0; VEC_iterate (alloc_site_t, fallocs->allocs, i, call); i++)
if (call->stmt == stmt
|| get_final_alloc_stmt (call->stmt) == stmt)
return true;
@@ -780,7 +772,7 @@ is_part_of_malloc (tree stmt, tree fn_decl)
struct find_stmt_data
{
bool found;
- tree stmt;
+ gimple stmt;
};
/* This function looks for DATA->stmt among
@@ -790,9 +782,8 @@ struct find_stmt_data
static int
find_in_field_accs (void **slot, void *data)
{
- struct field_access_site *f_acc =
- *(struct field_access_site **) slot;
- tree stmt = ((struct find_stmt_data *)data)->stmt;
+ struct field_access_site *f_acc = *(struct field_access_site **) slot;
+ gimple stmt = ((struct find_stmt_data *)data)->stmt;
if (f_acc->stmt == stmt
|| f_acc->ref_def_stmt == stmt
@@ -810,7 +801,7 @@ find_in_field_accs (void **slot, void *data)
and false otherwise. */
static bool
-is_part_of_field_access (tree stmt, d_str str)
+is_part_of_field_access (gimple stmt, d_str str)
{
int i;
@@ -883,7 +874,8 @@ struct ref_pos
static tree
find_pos_in_stmt_1 (tree *tp, int *walk_subtrees, void * data)
{
- struct ref_pos * r_pos = (struct ref_pos *) data;
+ struct walk_stmt_info *wi = (struct walk_stmt_info *) data;
+ struct ref_pos *r_pos = (struct ref_pos *) wi->info;
tree ref = r_pos->ref;
tree t = *tp;
@@ -893,23 +885,8 @@ find_pos_in_stmt_1 (tree *tp, int *walk_subtrees, void * data)
return t;
}
- switch (TREE_CODE (t))
- {
- case GIMPLE_MODIFY_STMT:
- {
- tree lhs = GIMPLE_STMT_OPERAND (t, 0);
- tree rhs = GIMPLE_STMT_OPERAND (t, 1);
- *walk_subtrees = 1;
- walk_tree (&lhs, find_pos_in_stmt_1, data, NULL);
- walk_tree (&rhs, find_pos_in_stmt_1, data, NULL);
- *walk_subtrees = 0;
- }
- break;
-
- default:
- *walk_subtrees = 1;
- }
- return NULL_TREE;
+ *walk_subtrees = 1;
+ return NULL_TREE;
}
@@ -917,13 +894,16 @@ find_pos_in_stmt_1 (tree *tp, int *walk_subtrees, void * data)
It returns it, if found, and NULL otherwise. */
static tree *
-find_pos_in_stmt (tree stmt, tree ref)
+find_pos_in_stmt (gimple stmt, tree ref)
{
struct ref_pos r_pos;
+ struct walk_stmt_info wi;
r_pos.ref = ref;
r_pos.pos = NULL;
- walk_tree (&stmt, find_pos_in_stmt_1, &r_pos, NULL);
+ memset (&wi, 0, sizeof (wi));
+ wi.info = &r_pos;
+ walk_gimple_op (stmt, find_pos_in_stmt_1, &wi);
return r_pos.pos;
}
@@ -1003,16 +983,15 @@ replace_field_acc (struct field_access_site *acc, tree new_type)
new_acc = build_comp_ref (new_ref, field_id, new_type);
VEC_free (type_wrapper_t, heap, wrapper);
- if (TREE_CODE (acc->stmt) == GIMPLE_MODIFY_STMT)
+ if (is_gimple_assign (acc->stmt))
{
- lhs = GIMPLE_STMT_OPERAND (acc->stmt, 0);
- rhs = GIMPLE_STMT_OPERAND (acc->stmt, 1);
-
-
+ lhs = gimple_assign_lhs (acc->stmt);
+ rhs = gimple_assign_rhs1 (acc->stmt);
+
if (lhs == acc->comp_ref)
- GIMPLE_STMT_OPERAND (acc->stmt, 0) = new_acc;
+ gimple_assign_set_lhs (acc->stmt, new_acc);
else if (rhs == acc->comp_ref)
- GIMPLE_STMT_OPERAND (acc->stmt, 1) = new_acc;
+ gimple_assign_set_rhs1 (acc->stmt, new_acc);
else
{
pos = find_pos_in_stmt (acc->stmt, acc->comp_ref);
@@ -1070,18 +1049,15 @@ find_structure (tree type)
like assignments: p.8_7 = p; or statements with rhs of
tree codes PLUS_EXPR and MINUS_EXPR. */
-static tree
-create_base_plus_offset (tree orig_stmt, tree new_type,
- tree offset)
+static gimple
+create_base_plus_offset (gimple orig_stmt, tree new_type, tree offset)
{
- tree lhs, rhs;
- tree new_lhs, new_rhs;
- tree new_stmt;
-
- gcc_assert (TREE_CODE (orig_stmt) == GIMPLE_MODIFY_STMT);
+ tree lhs;
+ tree new_lhs;
+ gimple new_stmt;
+ tree new_op0 = NULL_TREE, new_op1 = NULL_TREE;
- lhs = GIMPLE_STMT_OPERAND (orig_stmt, 0);
- rhs = GIMPLE_STMT_OPERAND (orig_stmt, 1);
+ lhs = gimple_assign_lhs (orig_stmt);
gcc_assert (TREE_CODE (lhs) == VAR_DECL
|| TREE_CODE (lhs) == SSA_NAME);
@@ -1090,15 +1066,14 @@ create_base_plus_offset (tree orig_stmt, tree new_type,
gcc_assert (new_lhs);
finalize_var_creation (new_lhs);
- switch (TREE_CODE (rhs))
+ switch (gimple_assign_rhs_code (orig_stmt))
{
case PLUS_EXPR:
case MINUS_EXPR:
case POINTER_PLUS_EXPR:
{
- tree op0 = TREE_OPERAND (rhs, 0);
- tree op1 = TREE_OPERAND (rhs, 1);
- tree new_op0 = NULL_TREE, new_op1 = NULL_TREE;
+ tree op0 = gimple_assign_rhs1 (orig_stmt);
+ tree op1 = gimple_assign_rhs2 (orig_stmt);
unsigned str0, str1;
unsigned length = VEC_length (structure, structures);
@@ -1116,9 +1091,6 @@ create_base_plus_offset (tree orig_stmt, tree new_type,
new_op0 = offset;
if (!new_op1)
new_op1 = offset;
-
- new_rhs = build2 (TREE_CODE (rhs), TREE_TYPE (new_op0),
- new_op0, new_op1);
}
break;
@@ -1126,8 +1098,9 @@ create_base_plus_offset (tree orig_stmt, tree new_type,
gcc_unreachable();
}
- new_stmt = build_gimple_modify_stmt (new_lhs, new_rhs);
- finalize_stmt (new_stmt);
+ new_stmt = gimple_build_assign_with_ops (gimple_assign_rhs_code (orig_stmt),
+ new_lhs, new_op0, new_op1);
+ finalize_stmt (new_stmt);
return new_stmt;
}
@@ -1140,9 +1113,10 @@ create_new_field_access (struct field_access_site *f_acc,
struct field_entry field)
{
tree new_type = field.field_mapping;
- tree new_stmt;
+ gimple new_stmt;
tree size_res;
- tree mult_stmt, cast_stmt;
+ gimple mult_stmt;
+ gimple cast_stmt;
tree cast_res = NULL;
if (f_acc->num)
@@ -1182,41 +1156,37 @@ create_new_field_access (struct field_access_site *f_acc,
variable located in the condition statement at the position POS. */
static void
-create_new_stmts_for_cond_expr_1 (tree new_var, tree cond_stmt, bool pos)
+create_new_stmts_for_cond_expr_1 (tree new_var, gimple cond_stmt, unsigned pos)
{
- tree new_cond;
- tree new_stmt;
+ gimple new_stmt;
edge true_e = NULL, false_e = NULL;
basic_block new_bb;
- tree stmt_list;
+ gimple_stmt_iterator si;
- extract_true_false_edges_from_block (bb_for_stmt (cond_stmt),
+ extract_true_false_edges_from_block (gimple_bb (cond_stmt),
&true_e, &false_e);
- new_cond = unshare_expr (COND_EXPR_COND (cond_stmt));
-
- TREE_OPERAND (new_cond, pos) = new_var;
-
- new_stmt = build3 (COND_EXPR, TREE_TYPE (cond_stmt),
- new_cond, NULL_TREE, NULL_TREE);
+ new_stmt = gimple_build_cond (gimple_cond_code (cond_stmt),
+ pos == 0 ? new_var : gimple_cond_lhs (cond_stmt),
+ pos == 1 ? new_var : gimple_cond_rhs (cond_stmt),
+ NULL_TREE,
+ NULL_TREE);
finalize_stmt (new_stmt);
/* Create new basic block after bb. */
- new_bb = create_empty_bb (bb_for_stmt (cond_stmt));
+ new_bb = create_empty_bb (gimple_bb (cond_stmt));
/* Add new condition stmt to the new_bb. */
- stmt_list = bb_stmt_list (new_bb);
- append_to_statement_list (new_stmt, &stmt_list);
- add_bb_info (new_bb, stmt_list);
+ si = gsi_start_bb (new_bb);
+ gsi_insert_after (&si, new_stmt, GSI_NEW_STMT);
-
/* Create false and true edges from new_bb. */
make_edge_and_fix_phis_of_dest (new_bb, true_e);
make_edge_and_fix_phis_of_dest (new_bb, false_e);
/* Redirect one of original edges to point to new_bb. */
- if (TREE_CODE (cond_stmt) == NE_EXPR)
+ if (gimple_cond_code (cond_stmt) == NE_EXPR)
redirect_edge_succ (true_e, new_bb);
else
redirect_edge_succ (false_e, new_bb);
@@ -1227,23 +1197,22 @@ create_new_stmts_for_cond_expr_1 (tree new_var, tree cond_stmt, bool pos)
recursively redirect edges to newly generated basic blocks. */
static void
-create_new_stmts_for_cond_expr (tree stmt)
+create_new_stmts_for_cond_expr (gimple stmt)
{
- tree cond = COND_EXPR_COND (stmt);
tree arg0, arg1, arg;
unsigned str0, str1;
bool s0, s1;
d_str str;
tree type;
- bool pos;
+ unsigned pos;
int i;
unsigned length = VEC_length (structure, structures);
- gcc_assert (TREE_CODE (cond) == EQ_EXPR
- || TREE_CODE (cond) == NE_EXPR);
+ gcc_assert (gimple_cond_code (stmt) == EQ_EXPR
+ || gimple_cond_code (stmt) == NE_EXPR);
- arg0 = TREE_OPERAND (cond, 0);
- arg1 = TREE_OPERAND (cond, 1);
+ arg0 = gimple_cond_lhs (stmt);
+ arg1 = gimple_cond_rhs (stmt);
str0 = find_structure (strip_type (get_type_of_var (arg0)));
str1 = find_structure (strip_type (get_type_of_var (arg1)));
@@ -1273,15 +1242,14 @@ create_new_stmts_for_cond_expr (tree stmt)
/* Create a new general access to replace original access ACC
for structure type NEW_TYPE. */
-static tree
+static gimple
create_general_new_stmt (struct access_site *acc, tree new_type)
{
- tree old_stmt = acc->stmt;
+ gimple old_stmt = acc->stmt;
tree var;
- tree new_stmt = unshare_expr (old_stmt);
+ gimple new_stmt = gimple_copy (old_stmt);
unsigned i;
-
for (i = 0; VEC_iterate (tree, acc->vars, i, var); i++)
{
tree *pos;
@@ -1291,32 +1259,30 @@ create_general_new_stmt (struct access_site *acc, tree new_type)
gcc_assert (new_var);
finalize_var_creation (new_var);
- if (TREE_CODE (new_stmt) == GIMPLE_MODIFY_STMT)
+ if (is_gimple_assign (new_stmt))
{
-
- lhs = GIMPLE_STMT_OPERAND (new_stmt, 0);
- rhs = GIMPLE_STMT_OPERAND (new_stmt, 1);
+ lhs = gimple_assign_lhs (new_stmt);
if (TREE_CODE (lhs) == SSA_NAME)
lhs = SSA_NAME_VAR (lhs);
- if (TREE_CODE (rhs) == SSA_NAME)
- rhs = SSA_NAME_VAR (rhs);
+ if (gimple_assign_rhs_code (new_stmt) == SSA_NAME)
+ rhs = SSA_NAME_VAR (gimple_assign_rhs1 (new_stmt));
/* It can happen that rhs is a constructor.
Then we have to replace it to be of new_type. */
- if (TREE_CODE (rhs) == CONSTRUCTOR)
+ if (gimple_assign_rhs_code (new_stmt) == CONSTRUCTOR)
{
/* Dealing only with empty constructors right now. */
gcc_assert (VEC_empty (constructor_elt,
CONSTRUCTOR_ELTS (rhs)));
rhs = build_constructor (new_type, 0);
- GIMPLE_STMT_OPERAND (new_stmt, 1) = rhs;
+ gimple_assign_set_rhs1 (new_stmt, rhs);
}
if (lhs == var)
- GIMPLE_STMT_OPERAND (new_stmt, 0) = new_var;
+ gimple_assign_set_lhs (new_stmt, new_var);
else if (rhs == var)
- GIMPLE_STMT_OPERAND (new_stmt, 1) = new_var;
+ gimple_assign_set_rhs1 (new_stmt, new_var);
else
{
pos = find_pos_in_stmt (new_stmt, var);
@@ -1343,12 +1309,12 @@ static void
create_new_stmts_for_general_acc (struct access_site *acc, d_str str)
{
tree type;
- tree stmt = acc->stmt;
+ gimple stmt = acc->stmt;
unsigned i;
for (i = 0; VEC_iterate (tree, str->new_types, i, type); i++)
{
- tree new_stmt;
+ gimple new_stmt;
new_stmt = create_general_new_stmt (acc, type);
insert_after_stmt (stmt, new_stmt);
@@ -1361,10 +1327,10 @@ create_new_stmts_for_general_acc (struct access_site *acc, d_str str)
static void
create_new_general_access (struct access_site *acc, d_str str)
{
- tree stmt = acc->stmt;
- switch (TREE_CODE (stmt))
+ gimple stmt = acc->stmt;
+ switch (gimple_code (stmt))
{
- case COND_EXPR:
+ case GIMPLE_COND:
create_new_stmts_for_cond_expr (stmt);
break;
@@ -1391,7 +1357,7 @@ create_new_acc (void **slot, void *data)
basic_block bb = ((struct create_acc_data *)data)->bb;
d_str str = ((struct create_acc_data *)data)->str;
- if (bb_for_stmt (acc->stmt) == bb)
+ if (gimple_bb (acc->stmt) == bb)
create_new_general_access (acc, str);
return 1;
}
@@ -1407,7 +1373,7 @@ create_new_field_acc (void **slot, void *data)
d_str str = ((struct create_acc_data *)data)->str;
int i = ((struct create_acc_data *)data)->field_index;
- if (bb_for_stmt (f_acc->stmt) == bb)
+ if (gimple_bb (f_acc->stmt) == bb)
create_new_field_access (f_acc, str->fields[i]);
return 1;
}
@@ -1462,11 +1428,11 @@ dump_field_acc (void **slot, void *data ATTRIBUTE_UNUSED)
fprintf(dump_file, "\n");
if (f_acc->stmt)
- print_generic_stmt (dump_file, f_acc->stmt, 0);
+ print_gimple_stmt (dump_file, f_acc->stmt, 0, 0);
if (f_acc->ref_def_stmt)
- print_generic_stmt (dump_file, f_acc->ref_def_stmt, 0);
+ print_gimple_stmt (dump_file, f_acc->ref_def_stmt, 0, 0);
if (f_acc->cast_stmt)
- print_generic_stmt (dump_file, f_acc->cast_stmt, 0);
+ print_gimple_stmt (dump_file, f_acc->cast_stmt, 0, 0);
return 1;
}
@@ -1697,22 +1663,20 @@ free_field_accesses (htab_t f_accs)
The edge origin is CONTEXT function. */
static void
-update_cgraph_with_malloc_call (tree malloc_stmt, tree context)
+update_cgraph_with_malloc_call (gimple malloc_stmt, tree context)
{
- tree call_expr;
struct cgraph_node *src, *dest;
tree malloc_fn_decl;
if (!malloc_stmt)
return;
- call_expr = get_call_expr_in (malloc_stmt);
- malloc_fn_decl = get_callee_fndecl (call_expr);
+ malloc_fn_decl = gimple_call_fndecl (malloc_stmt);
src = cgraph_node (context);
dest = cgraph_node (malloc_fn_decl);
cgraph_create_edge (src, dest, malloc_stmt,
- 0, 0, bb_for_stmt (malloc_stmt)->loop_depth);
+ 0, 0, gimple_bb (malloc_stmt)->loop_depth);
}
/* This function generates set of statements required
@@ -1720,40 +1684,39 @@ update_cgraph_with_malloc_call (tree malloc_stmt, tree context)
The statements are stored in NEW_STMTS. The statement that contain
call to malloc is returned. MALLOC_STMT is an original call to malloc. */
-static tree
-create_new_malloc (tree malloc_stmt, tree new_type, tree *new_stmts, tree num)
+static gimple
+create_new_malloc (gimple malloc_stmt, tree new_type, gimple_seq *new_stmts,
+ tree num)
{
tree new_malloc_size;
- tree call_expr, malloc_fn_decl;
- tree new_stmt, malloc_res;
- tree call_stmt, final_stmt;
+ tree malloc_fn_decl;
+ gimple new_stmt;
+ tree malloc_res;
+ gimple call_stmt, final_stmt;
tree cast_res;
gcc_assert (num && malloc_stmt && new_type);
- *new_stmts = alloc_stmt_list ();
+ *new_stmts = gimple_seq_alloc ();
/* Generate argument to malloc as multiplication of num
and size of new_type. */
new_stmt = gen_size (num, new_type, &new_malloc_size);
- append_to_statement_list (new_stmt, new_stmts);
+ gimple_seq_add_stmt (new_stmts, new_stmt);
/* Generate new call for malloc. */
malloc_res = create_tmp_var (ptr_type_node, NULL);
+ add_referenced_var (malloc_res);
- if (malloc_res)
- add_referenced_var (malloc_res);
-
- call_expr = get_call_expr_in (malloc_stmt);
- malloc_fn_decl = get_callee_fndecl (call_expr);
- call_expr = build_call_expr (malloc_fn_decl, 1, new_malloc_size);
- call_stmt = build_gimple_modify_stmt (malloc_res, call_expr);
+ malloc_fn_decl = gimple_call_fndecl (malloc_stmt);
+ call_stmt = gimple_build_call (malloc_fn_decl, 1, new_malloc_size);
+ gimple_call_set_lhs (call_stmt, malloc_res);
finalize_stmt_and_append (new_stmts, call_stmt);
/* Create new cast statement. */
final_stmt = get_final_alloc_stmt (malloc_stmt);
gcc_assert (final_stmt);
new_stmt = gen_cast_stmt (malloc_res, new_type, final_stmt, &cast_res);
- append_to_statement_list (new_stmt, new_stmts);
+ gimple_seq_add_stmt (new_stmts, new_stmt);
return call_stmt;
}
@@ -1764,11 +1727,10 @@ create_new_malloc (tree malloc_stmt, tree new_type, tree *new_stmts, tree num)
they are filled into NEW_STMTS_P. */
static tree
-gen_num_of_structs_in_malloc (tree stmt, tree str_decl, tree *new_stmts_p)
+gen_num_of_structs_in_malloc (gimple stmt, tree str_decl,
+ gimple_seq *new_stmts_p)
{
- call_expr_arg_iterator iter;
tree arg;
- tree call_expr;
tree struct_size;
HOST_WIDE_INT struct_size_int;
@@ -1776,11 +1738,10 @@ gen_num_of_structs_in_malloc (tree stmt, tree str_decl, tree *new_stmts_p)
return NULL_TREE;
/* Get malloc argument. */
- call_expr = get_call_expr_in (stmt);
- if (!call_expr)
+ if (!is_gimple_call (stmt))
return NULL_TREE;
- arg = first_call_expr_arg (call_expr, &iter);
+ arg = gimple_call_arg (stmt, 0);
if (TREE_CODE (arg) != SSA_NAME
&& !TREE_CONSTANT (arg))
@@ -1793,7 +1754,8 @@ gen_num_of_structs_in_malloc (tree stmt, tree str_decl, tree *new_stmts_p)
if (TREE_CODE (arg) == SSA_NAME)
{
- tree num, div_stmt;
+ tree num;
+ gimple div_stmt;
if (is_result_of_mult (arg, &num, struct_size))
return num;
@@ -1804,23 +1766,16 @@ gen_num_of_structs_in_malloc (tree stmt, tree str_decl, tree *new_stmts_p)
add_referenced_var (num);
if (exact_log2 (struct_size_int) == -1)
- div_stmt = build_gimple_modify_stmt (num,
- build2 (TRUNC_DIV_EXPR,
- integer_type_node,
- arg, struct_size));
+ div_stmt = gimple_build_assign_with_ops (TRUNC_DIV_EXPR, num, arg,
+ struct_size);
else
{
tree C = build_int_cst (integer_type_node,
exact_log2 (struct_size_int));
- div_stmt =
- build_gimple_modify_stmt (num, build2 (RSHIFT_EXPR,
- integer_type_node,
- arg, C));
+ div_stmt = gimple_build_assign_with_ops (RSHIFT_EXPR, num, arg, C);
}
- *new_stmts_p = alloc_stmt_list ();
- append_to_statement_list (div_stmt,
- new_stmts_p);
+ gimple_seq_add_stmt (new_stmts_p, div_stmt);
finalize_stmt (div_stmt);
return num;
}
@@ -2049,7 +2004,7 @@ field_acc_hash (const void *x)
static int
field_acc_eq (const void *x, const void *y)
{
- return ((const struct field_access_site *)x)->stmt == (const_tree)y;
+ return ((const struct field_access_site *)x)->stmt == (const_gimple)y;
}
/* This function prints an access site, defined by SLOT. */
@@ -2063,7 +2018,7 @@ dump_acc (void **slot, void *data ATTRIBUTE_UNUSED)
fprintf(dump_file, "\n");
if (acc->stmt)
- print_generic_stmt (dump_file, acc->stmt, 0);
+ print_gimple_stmt (dump_file, acc->stmt, 0, 0);
fprintf(dump_file, " : ");
for (i = 0; VEC_iterate (tree, acc->vars, i, var); i++)
@@ -2146,35 +2101,33 @@ create_new_alloc_sites (fallocs_t m_data, tree context)
alloc_site_t *call;
unsigned j;
- for (j = 0;
- VEC_iterate (alloc_site_t, m_data->allocs, j, call); j++)
+ for (j = 0; VEC_iterate (alloc_site_t, m_data->allocs, j, call); j++)
{
- tree stmt = call->stmt;
+ gimple stmt = call->stmt;
d_str str = call->str;
tree num;
- tree new_stmts = NULL_TREE;
- tree last_stmt = get_final_alloc_stmt (stmt);
+ gimple_seq new_stmts = NULL;
+ gimple last_stmt = get_final_alloc_stmt (stmt);
unsigned i;
tree type;
num = gen_num_of_structs_in_malloc (stmt, str->decl, &new_stmts);
if (new_stmts)
{
- last_stmt = tsi_stmt (tsi_last (new_stmts));
- insert_after_stmt (last_stmt, new_stmts);
+ last_stmt = gimple_seq_last_stmt (new_stmts);
+ insert_seq_after_stmt (last_stmt, new_stmts);
}
/* Generate an allocation sites for each new structure type. */
- for (i = 0;
- VEC_iterate (tree, str->new_types, i, type); i++)
+ for (i = 0; VEC_iterate (tree, str->new_types, i, type); i++)
{
- tree new_malloc_stmt = NULL_TREE;
- tree last_stmt_tmp = NULL_TREE;
+ gimple new_malloc_stmt = NULL;
+ gimple last_stmt_tmp = NULL;
- new_stmts = NULL_TREE;
+ new_stmts = NULL;
new_malloc_stmt = create_new_malloc (stmt, type, &new_stmts, num);
- last_stmt_tmp = tsi_stmt (tsi_last (new_stmts));
- insert_after_stmt (last_stmt, new_stmts);
+ last_stmt_tmp = gimple_seq_last_stmt (new_stmts);
+ insert_seq_after_stmt (last_stmt, new_stmts);
update_cgraph_with_malloc_call (new_malloc_stmt, context);
last_stmt = last_stmt_tmp;
}
@@ -2304,7 +2257,7 @@ acc_hash (const void *x)
static int
acc_eq (const void *x, const void *y)
{
- return ((const struct access_site *)x)->stmt == (const_tree)y;
+ return ((const struct access_site *)x)->stmt == (const_gimple)y;
}
/* Given a structure declaration STRUCT_DECL, and number of fields
@@ -2405,25 +2358,19 @@ remove_structure (unsigned i)
COND_STMT is a condition statement to check. */
static bool
-is_safe_cond_expr (tree cond_stmt)
+is_safe_cond_expr (gimple cond_stmt)
{
-
tree arg0, arg1;
unsigned str0, str1;
bool s0, s1;
unsigned length = VEC_length (structure, structures);
- tree cond = COND_EXPR_COND (cond_stmt);
-
- if (TREE_CODE (cond) != EQ_EXPR
- && TREE_CODE (cond) != NE_EXPR)
+ if (gimple_cond_code (cond_stmt) != EQ_EXPR
+ && gimple_cond_code (cond_stmt) != NE_EXPR)
return false;
- if (TREE_CODE_LENGTH (TREE_CODE (cond)) != 2)
- return false;
-
- arg0 = TREE_OPERAND (cond, 0);
- arg1 = TREE_OPERAND (cond, 1);
+ arg0 = gimple_cond_lhs (cond_stmt);
+ arg1 = gimple_cond_rhs (cond_stmt);
str0 = find_structure (strip_type (get_type_of_var (arg0)));
str1 = find_structure (strip_type (get_type_of_var (arg1)));
@@ -2470,7 +2417,8 @@ exclude_from_accs (void **slot, void *data)
static tree
get_stmt_accesses (tree *tp, int *walk_subtrees, void *data)
{
- tree stmt = (tree) data;
+ struct walk_stmt_info *wi = (struct walk_stmt_info *) data;
+ gimple stmt = (gimple) wi->info;
tree t = *tp;
if (!t)
@@ -2478,17 +2426,6 @@ get_stmt_accesses (tree *tp, int *walk_subtrees, void *data)
switch (TREE_CODE (t))
{
- case GIMPLE_MODIFY_STMT:
- {
- tree lhs = GIMPLE_STMT_OPERAND (t, 0);
- tree rhs = GIMPLE_STMT_OPERAND (t, 1);
- *walk_subtrees = 1;
- walk_tree (&lhs, get_stmt_accesses, data, NULL);
- walk_tree (&rhs, get_stmt_accesses, data, NULL);
- *walk_subtrees = 0;
- }
- break;
-
case BIT_FIELD_REF:
{
tree var = TREE_OPERAND(t, 0);
@@ -2549,7 +2486,7 @@ get_stmt_accesses (tree *tp, int *walk_subtrees, void *data)
print_generic_expr (dump_file, type, 0);
fprintf (dump_file,
" has complicate access in statement ");
- print_generic_stmt (dump_file, stmt, 0);
+ print_gimple_stmt (dump_file, stmt, 0, 0);
}
remove_structure (i);
@@ -2558,7 +2495,7 @@ get_stmt_accesses (tree *tp, int *walk_subtrees, void *data)
else
{
/* Increase count of field. */
- basic_block bb = bb_for_stmt (stmt);
+ basic_block bb = gimple_bb (stmt);
field->count += bb->count;
/* Add stmt to the acc_sites of field. */
@@ -2571,18 +2508,6 @@ get_stmt_accesses (tree *tp, int *walk_subtrees, void *data)
}
break;
- case MINUS_EXPR:
- case PLUS_EXPR:
- {
- tree op0 = TREE_OPERAND (t, 0);
- tree op1 = TREE_OPERAND (t, 1);
- *walk_subtrees = 1;
- walk_tree (&op0, get_stmt_accesses, data, NULL);
- walk_tree (&op1, get_stmt_accesses, data, NULL);
- *walk_subtrees = 0;
- }
- break;
-
case COND_EXPR:
{
tree cond = COND_EXPR_COND (t);
@@ -2618,14 +2543,6 @@ get_stmt_accesses (tree *tp, int *walk_subtrees, void *data)
}
break;
- case CALL_EXPR:
- {
- /* It was checked as part of stage1 that structures
- to be transformed cannot be passed as parameters of functions. */
- *walk_subtrees = 0;
- }
- break;
-
default:
return NULL;
}
@@ -3019,7 +2936,7 @@ add_structure (tree type)
allocates the structure represented by STR. */
static void
-add_alloc_site (tree fn_decl, tree stmt, d_str str)
+add_alloc_site (tree fn_decl, gimple stmt, d_str str)
{
fallocs_t fallocs = NULL;
alloc_site_t m_call;
@@ -3049,7 +2966,7 @@ add_alloc_site (tree fn_decl, tree stmt, d_str str)
if (dump_file)
{
fprintf (dump_file, "\nAdding stmt ");
- print_generic_stmt (dump_file, stmt, 0);
+ print_gimple_stmt (dump_file, stmt, 0, 0);
fprintf (dump_file, " to list of mallocs.");
}
}
@@ -3061,11 +2978,11 @@ add_alloc_site (tree fn_decl, tree stmt, d_str str)
Otherwise I_P contains the length of the vector of structures. */
static bool
-is_alloc_of_struct (tree stmt, unsigned *i_p)
+is_alloc_of_struct (gimple stmt, unsigned *i_p)
{
tree lhs;
tree type;
- tree final_stmt;
+ gimple final_stmt;
final_stmt = get_final_alloc_stmt (stmt);
@@ -3075,10 +2992,10 @@ is_alloc_of_struct (tree stmt, unsigned *i_p)
/* final_stmt should be of the form:
T.3 = (struct_type *) T.2; */
- if (TREE_CODE (final_stmt) != GIMPLE_MODIFY_STMT)
+ if (gimple_code (final_stmt) != GIMPLE_ASSIGN)
return false;
- lhs = GIMPLE_STMT_OPERAND (final_stmt, 0);
+ lhs = gimple_assign_lhs (final_stmt);
type = get_type_of_var (lhs);
@@ -3128,13 +3045,13 @@ safe_cond_expr_check (void **slot, void *data)
{
struct access_site *acc = *(struct access_site **) slot;
- if (TREE_CODE (acc->stmt) == COND_EXPR
+ if (gimple_code (acc->stmt) == GIMPLE_COND
&& !is_safe_cond_expr (acc->stmt))
{
if (dump_file)
{
fprintf (dump_file, "\nUnsafe conditional statement ");
- print_generic_stmt (dump_file, acc->stmt, 0);
+ print_gimple_stmt (dump_file, acc->stmt, 0, 0);
}
*(bool *) data = false;
return 0;
@@ -3163,21 +3080,25 @@ exclude_alloc_and_field_accs_1 (d_str str, struct cgraph_node *node)
static void
collect_accesses_in_bb (basic_block bb)
{
- block_stmt_iterator bsi;
+ gimple_stmt_iterator bsi;
+ struct walk_stmt_info wi;
+
+ memset (&wi, 0, sizeof (wi));
- for (bsi = bsi_start (bb); ! bsi_end_p (bsi); bsi_next (&bsi))
+ for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
{
- tree stmt = bsi_stmt (bsi);
+ gimple stmt = gsi_stmt (bsi);
/* In asm stmt we cannot always track the arguments,
so we just give up. */
- if (TREE_CODE (stmt) == ASM_EXPR)
+ if (gimple_code (stmt) == GIMPLE_ASM)
{
free_structures ();
break;
}
- walk_tree (&stmt, get_stmt_accesses, stmt, NULL);
+ wi.info = (void *) stmt;
+ walk_gimple_op (stmt, get_stmt_accesses, &wi);
}
}
@@ -3467,7 +3388,6 @@ program_redefines_malloc_p (void)
struct cgraph_edge *c_edge;
tree fndecl;
tree fndecl2;
- tree call_expr;
for (c_node = cgraph_nodes; c_node; c_node = c_node->next)
{
@@ -3475,17 +3395,16 @@ program_redefines_malloc_p (void)
for (c_edge = c_node->callees; c_edge; c_edge = c_edge->next_callee)
{
- call_expr = get_call_expr_in (c_edge->call_stmt);
c_node2 = c_edge->callee;
fndecl2 = c_node2->decl;
- if (call_expr)
+ if (is_gimple_call (c_edge->call_stmt))
{
const char * fname = get_name (fndecl2);
- if ((call_expr_flags (call_expr) & ECF_MALLOC) &&
- (DECL_FUNCTION_CODE (fndecl2) != BUILT_IN_MALLOC) &&
- (DECL_FUNCTION_CODE (fndecl2) != BUILT_IN_CALLOC) &&
- (DECL_FUNCTION_CODE (fndecl2) != BUILT_IN_ALLOCA))
+ if ((gimple_call_flags (c_edge->call_stmt) & ECF_MALLOC)
+ && (DECL_FUNCTION_CODE (fndecl2) != BUILT_IN_MALLOC)
+ && (DECL_FUNCTION_CODE (fndecl2) != BUILT_IN_CALLOC)
+ && (DECL_FUNCTION_CODE (fndecl2) != BUILT_IN_ALLOCA))
return true;
/* Check that there is no __builtin_object_size,
@@ -3527,15 +3446,15 @@ collect_alloc_sites (void)
{
for (cs = node->callees; cs; cs = cs->next_callee)
{
- tree stmt = cs->call_stmt;
+ gimple stmt = cs->call_stmt;
if (stmt)
{
- tree call = get_call_expr_in (stmt);
tree decl;
- if (call && (decl = get_callee_fndecl (call))
- && TREE_CODE (stmt) == GIMPLE_MODIFY_STMT)
+ if (is_gimple_call (stmt)
+ && (decl = gimple_call_fndecl (stmt))
+ && gimple_call_lhs (stmt))
{
unsigned i;
@@ -3555,7 +3474,7 @@ collect_alloc_sites (void)
{
fprintf (dump_file,
"\nUnsupported allocation function ");
- print_generic_stmt (dump_file, stmt, 0);
+ print_gimple_stmt (dump_file, stmt, 0, 0);
}
remove_structure (i);
}
@@ -4035,8 +3954,9 @@ reorg_structs_drive (void)
static bool
struct_reorg_gate (void)
{
- return flag_ipa_struct_reorg && flag_whole_program
- && (optimize > 0);
+ return flag_ipa_struct_reorg
+ && flag_whole_program
+ && (optimize > 0);
}
struct simple_ipa_opt_pass pass_ipa_struct_reorg =
diff --git a/gcc/ipa-struct-reorg.h b/gcc/ipa-struct-reorg.h
index 54cdbc9982f..a92d345ec92 100644
--- a/gcc/ipa-struct-reorg.h
+++ b/gcc/ipa-struct-reorg.h
@@ -37,15 +37,15 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
struct field_access_site
{
/* Statement in which the access site occurs. */
- tree stmt; /* D.2169_25 = D.2168_24->b; */
+ gimple stmt; /* D.2169_25 = D.2168_24->b; */
tree comp_ref; /* D.2168_24->b */
tree field_decl; /* b */
tree ref; /* D.2168_24 */
tree num; /* i.6_20 */
tree offset; /* D2167_22 */
tree base; /* p.5_23 */
- tree ref_def_stmt; /* D.2168_24 = D.2167_22 + p.5_23; */
- tree cast_stmt; /* D.2167_22 = (struct str_t *) D.2166_21;
+ gimple ref_def_stmt; /* D.2168_24 = D.2167_22 + p.5_23; */
+ gimple cast_stmt; /* D.2167_22 = (struct str_t *) D.2166_21;
This statement is not always present. */
};
@@ -53,7 +53,7 @@ struct field_access_site
struct access_site
{
/* A statement in which the access site occurs. */
- tree stmt;
+ gimple stmt;
/* A list of structure variables in the access site. */
VEC (tree, heap) *vars;
};
diff --git a/gcc/ipa-type-escape.c b/gcc/ipa-type-escape.c
index 229d8b2e9a5..48d95049b4f 100644
--- a/gcc/ipa-type-escape.c
+++ b/gcc/ipa-type-escape.c
@@ -47,7 +47,7 @@ along with GCC; see the file COPYING3. If not see
#include "ipa-utils.h"
#include "ipa-type-escape.h"
#include "c-common.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "cgraph.h"
#include "output.h"
#include "flags.h"
@@ -136,8 +136,8 @@ static bitmap_obstack ipa_obstack;
/* Static functions from this file that are used
before being defined. */
-static unsigned int look_for_casts (tree lhs ATTRIBUTE_UNUSED, tree);
-static bool is_cast_from_non_pointer (tree, tree, void *);
+static unsigned int look_for_casts (tree);
+static bool is_cast_from_non_pointer (tree, gimple, void *);
/* Get the name of TYPE or return the string "<UNNAMED>". */
static const char*
@@ -308,7 +308,7 @@ get_canon_type (tree type, bool see_thru_ptrs, bool see_thru_arrays)
while (POINTER_TYPE_P (type))
type = TYPE_MAIN_VARIANT (TREE_TYPE (type));
- result = splay_tree_lookup(type_to_canon_type, (splay_tree_key) type);
+ result = splay_tree_lookup (type_to_canon_type, (splay_tree_key) type);
if (result == NULL)
return discover_unique_type (type);
@@ -663,9 +663,7 @@ check_cast_type (tree to_type, tree from_type)
static bool
is_malloc_result (tree var)
{
- tree def_stmt;
- tree rhs;
- int flags;
+ gimple def_stmt;
if (!var)
return false;
@@ -675,20 +673,13 @@ is_malloc_result (tree var)
def_stmt = SSA_NAME_DEF_STMT (var);
- if (TREE_CODE (def_stmt) != GIMPLE_MODIFY_STMT)
+ if (!is_gimple_call (def_stmt))
return false;
- if (var != GIMPLE_STMT_OPERAND (def_stmt, 0))
+ if (var != gimple_call_lhs (def_stmt))
return false;
- rhs = get_call_expr_in (def_stmt);
-
- if (!rhs)
- return false;
-
- flags = call_expr_flags (rhs);
-
- return ((flags & ECF_MALLOC) != 0);
+ return ((gimple_call_flags (def_stmt) & ECF_MALLOC) != 0);
}
@@ -769,115 +760,98 @@ check_cast (tree to_type, tree from)
return cast;
}
-typedef struct cast
-{
- int type;
- tree stmt;
-}cast_t;
-
-/* This function is a callback for walk_tree called from
- is_cast_from_non_pointer. The data->type is set to be:
- 0 - if there is no cast
- number - the number of casts from non-pointer type
- -1 - if there is a cast that makes the type to escape
+/* Scan assignment statement S to see if there are any casts within it. */
- If data->type = number, then data->stmt will contain the
- last casting stmt met in traversing. */
-
-static tree
-is_cast_from_non_pointer_1 (tree *tp, int *walk_subtrees, void *data)
+static unsigned int
+look_for_casts_stmt (gimple s)
{
- tree def_stmt = *tp;
+ unsigned int cast = 0;
+ gcc_assert (is_gimple_assign (s));
- if (pointer_set_insert (visited_stmts, def_stmt))
+ if (gimple_assign_cast_p (s))
{
- *walk_subtrees = 0;
- return NULL;
+ tree castfromvar = gimple_assign_rhs1 (s);
+ cast |= check_cast (TREE_TYPE (gimple_assign_lhs (s)), castfromvar);
}
-
- switch (TREE_CODE (def_stmt))
+ else
{
- case GIMPLE_MODIFY_STMT:
- {
- use_operand_p use_p;
- ssa_op_iter iter;
- tree lhs = GIMPLE_STMT_OPERAND (def_stmt, 0);
- tree rhs = GIMPLE_STMT_OPERAND (def_stmt, 1);
-
- unsigned int cast = look_for_casts (lhs, rhs);
- /* Check that only one cast happened, and it's of
- non-pointer type. */
- if ((cast & CT_FROM_NON_P) == (CT_FROM_NON_P)
- && (cast & ~(CT_FROM_NON_P)) == 0)
- {
- ((cast_t *)data)->stmt = def_stmt;
- ((cast_t *)data)->type++;
-
- FOR_EACH_SSA_USE_OPERAND (use_p, def_stmt, iter, SSA_OP_ALL_USES)
- {
- walk_use_def_chains (USE_FROM_PTR (use_p), is_cast_from_non_pointer,
- data, false);
- if (((cast_t*)data)->type == -1)
- return def_stmt;
- }
- }
-
- /* Check that there is no cast, or cast is not harmful. */
- else if ((cast & CT_NO_CAST) == (CT_NO_CAST)
- || (cast & CT_DOWN) == (CT_DOWN)
- || (cast & CT_UP) == (CT_UP)
- || (cast & CT_USELESS) == (CT_USELESS)
- || (cast & CT_FROM_MALLOC) == (CT_FROM_MALLOC))
- {
- FOR_EACH_SSA_USE_OPERAND (use_p, def_stmt, iter, SSA_OP_ALL_USES)
- {
- walk_use_def_chains (USE_FROM_PTR (use_p), is_cast_from_non_pointer,
- data, false);
- if (((cast_t*)data)->type == -1)
- return def_stmt;
- }
- }
+ size_t i;
+ for (i = 0; i < gimple_num_ops (s); i++)
+ cast |= look_for_casts (gimple_op (s, i));
+ }
- /* The cast is harmful. */
- else
- {
- ((cast_t *)data)->type = -1;
- return def_stmt;
- }
+ if (!cast)
+ cast = CT_NO_CAST;
- *walk_subtrees = 0;
- }
- break;
+ return cast;
+}
- default:
- {
- *walk_subtrees = 0;
- break;
- }
- }
- return NULL;
-}
+typedef struct cast
+{
+ int type;
+ gimple stmt;
+} cast_t;
/* This function is a callback for walk_use_def_chains function called
from is_array_access_through_pointer_and_index. */
static bool
-is_cast_from_non_pointer (tree var, tree def_stmt, void *data)
+is_cast_from_non_pointer (tree var, gimple def_stmt, void *data)
{
-
if (!def_stmt || !var)
return false;
- if (TREE_CODE (def_stmt) == PHI_NODE)
+ if (gimple_code (def_stmt) == GIMPLE_PHI)
return false;
if (SSA_NAME_IS_DEFAULT_DEF (var))
return false;
- walk_tree (&def_stmt, is_cast_from_non_pointer_1, data, NULL);
+ if (is_gimple_assign (def_stmt))
+ {
+ use_operand_p use_p;
+ ssa_op_iter iter;
+ unsigned int cast = look_for_casts_stmt (def_stmt);
+
+ /* Check that only one cast happened, and it's of non-pointer
+ type. */
+ if ((cast & CT_FROM_NON_P) == (CT_FROM_NON_P)
+ && (cast & ~(CT_FROM_NON_P)) == 0)
+ {
+ ((cast_t *)data)->stmt = def_stmt;
+ ((cast_t *)data)->type++;
+
+ FOR_EACH_SSA_USE_OPERAND (use_p, def_stmt, iter, SSA_OP_ALL_USES)
+ {
+ walk_use_def_chains (USE_FROM_PTR (use_p),
+ is_cast_from_non_pointer, data, false);
+ if (((cast_t*)data)->type == -1)
+ break;
+ }
+ }
+ /* Check that there is no cast, or cast is not harmful. */
+ else if ((cast & CT_NO_CAST) == (CT_NO_CAST)
+ || (cast & CT_DOWN) == (CT_DOWN)
+ || (cast & CT_UP) == (CT_UP)
+ || (cast & CT_USELESS) == (CT_USELESS)
+ || (cast & CT_FROM_MALLOC) == (CT_FROM_MALLOC))
+ {
+ FOR_EACH_SSA_USE_OPERAND (use_p, def_stmt, iter, SSA_OP_ALL_USES)
+ {
+ walk_use_def_chains (USE_FROM_PTR (use_p),
+ is_cast_from_non_pointer, data, false);
+ if (((cast_t*)data)->type == -1)
+ break;
+ }
+ }
+ /* The cast is harmful. */
+ else
+ ((cast_t *)data)->type = -1;
+ }
+
if (((cast_t*)data)->type == -1)
return true;
@@ -930,9 +904,10 @@ is_cast_from_non_pointer (tree var, tree def_stmt, void *data)
bool
is_array_access_through_pointer_and_index (enum tree_code code, tree op0,
tree op1, tree *base, tree *offset,
- tree *offset_cast_stmt)
+ gimple *offset_cast_stmt)
{
- tree before_cast, before_cast_def_stmt;
+ tree before_cast;
+ gimple before_cast_def_stmt;
cast_t op0_cast, op1_cast;
*base = NULL;
@@ -1014,26 +989,23 @@ is_array_access_through_pointer_and_index (enum tree_code code, tree op0,
/* before_cast_def_stmt should be of the form:
D.1605_6 = i.1_5 * 16; */
- if (TREE_CODE (before_cast_def_stmt) == GIMPLE_MODIFY_STMT)
+ if (is_gimple_assign (before_cast_def_stmt))
{
- tree lhs = GIMPLE_STMT_OPERAND (before_cast_def_stmt,0);
- tree rhs = GIMPLE_STMT_OPERAND (before_cast_def_stmt,1);
-
/* We expect temporary here. */
- if (!is_gimple_reg (lhs))
+ if (!is_gimple_reg (gimple_assign_lhs (before_cast_def_stmt)))
return false;
- if (TREE_CODE (rhs) == MULT_EXPR)
+ if (gimple_assign_rhs_code (before_cast_def_stmt) == MULT_EXPR)
{
- tree arg0 = TREE_OPERAND (rhs, 0);
- tree arg1 = TREE_OPERAND (rhs, 1);
+ tree arg0 = gimple_assign_rhs1 (before_cast_def_stmt);
+ tree arg1 = gimple_assign_rhs2 (before_cast_def_stmt);
tree unit_size =
TYPE_SIZE_UNIT (TREE_TYPE (TYPE_MAIN_VARIANT (TREE_TYPE (op0))));
if (!(CONSTANT_CLASS_P (arg0)
- && simple_cst_equal (arg0,unit_size))
+ && simple_cst_equal (arg0, unit_size))
&& !(CONSTANT_CLASS_P (arg1)
- && simple_cst_equal (arg1,unit_size)))
+ && simple_cst_equal (arg1, unit_size)))
return false;
}
else
@@ -1173,7 +1145,11 @@ check_tree (tree t)
check_tree (TREE_OPERAND (t, 0));
if (SSA_VAR_P (t) || (TREE_CODE (t) == FUNCTION_DECL))
- check_operand (t);
+ {
+ check_operand (t);
+ if (DECL_P (t) && DECL_INITIAL (t))
+ check_tree (DECL_INITIAL (t));
+ }
}
/* Create an address_of edge FROM_TYPE.TO_TYPE. */
@@ -1260,15 +1236,13 @@ look_for_address_of (tree t)
}
-/* Scan tree T to see if there are any casts within it.
- LHS Is the LHS of the expression involving the cast. */
+/* Scan tree T to see if there are any casts within it. */
static unsigned int
-look_for_casts (tree lhs ATTRIBUTE_UNUSED, tree t)
+look_for_casts (tree t)
{
unsigned int cast = 0;
-
if (is_gimple_cast (t) || TREE_CODE (t) == VIEW_CONVERT_EXPR)
{
tree castfromvar = TREE_OPERAND (t, 0);
@@ -1302,7 +1276,7 @@ static void
check_rhs_var (tree t)
{
look_for_address_of (t);
- check_tree(t);
+ check_tree (t);
}
/* Check to see if T is an assignment to a static var we are
@@ -1311,7 +1285,7 @@ check_rhs_var (tree t)
static void
check_lhs_var (tree t)
{
- check_tree(t);
+ check_tree (t);
}
/* This is a scaled down version of get_asm_expr_operands from
@@ -1322,35 +1296,15 @@ check_lhs_var (tree t)
analyzed and STMT is the actual asm statement. */
static void
-get_asm_expr_operands (tree stmt)
+check_asm (gimple stmt)
{
- int noutputs = list_length (ASM_OUTPUTS (stmt));
- const char **oconstraints
- = (const char **) alloca ((noutputs) * sizeof (const char *));
- int i;
- tree link;
- const char *constraint;
- bool allows_mem, allows_reg, is_inout;
-
- for (i=0, link = ASM_OUTPUTS (stmt); link; ++i, link = TREE_CHAIN (link))
- {
- oconstraints[i] = constraint
- = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (link)));
- parse_output_constraint (&constraint, i, 0, 0,
- &allows_mem, &allows_reg, &is_inout);
-
- check_lhs_var (TREE_VALUE (link));
- }
+ size_t i;
- for (link = ASM_INPUTS (stmt); link; link = TREE_CHAIN (link))
- {
- constraint
- = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (link)));
- parse_input_constraint (&constraint, 0, 0, noutputs, 0,
- oconstraints, &allows_mem, &allows_reg);
-
- check_rhs_var (TREE_VALUE (link));
- }
+ for (i = 0; i < gimple_asm_noutputs (stmt); i++)
+ check_lhs_var (gimple_asm_output_op (stmt, i));
+
+ for (i = 0; i < gimple_asm_ninputs (stmt); i++)
+ check_rhs_var (gimple_asm_input_op (stmt, i));
/* There is no code here to check for asm memory clobbers. The
casual maintainer might think that such code would be necessary,
@@ -1360,22 +1314,22 @@ get_asm_expr_operands (tree stmt)
assumed to already escape. So, we are protected here. */
}
-/* Check the parameters of a function call to CALL_EXPR to mark the
+
+/* Check the parameters of function call to CALL to mark the
types that pass across the function boundary. Also check to see if
this is either an indirect call, a call outside the compilation
unit. */
static void
-check_call (tree call_expr)
+check_call (gimple call)
{
- tree operand;
- tree callee_t = get_callee_fndecl (call_expr);
+ tree callee_t = gimple_call_fndecl (call);
struct cgraph_node* callee;
enum availability avail = AVAIL_NOT_AVAILABLE;
- call_expr_arg_iterator iter;
+ size_t i;
- FOR_EACH_CALL_EXPR_ARG (operand, iter, call_expr)
- check_rhs_var (operand);
+ for (i = 0; i < gimple_call_num_args (call); i++)
+ check_rhs_var (gimple_call_arg (call, i));
if (callee_t)
{
@@ -1388,12 +1342,11 @@ check_call (tree call_expr)
parameters. */
if (TYPE_ARG_TYPES (TREE_TYPE (callee_t)))
{
- for (arg_type = TYPE_ARG_TYPES (TREE_TYPE (callee_t)),
- operand = first_call_expr_arg (call_expr, &iter);
+ for (arg_type = TYPE_ARG_TYPES (TREE_TYPE (callee_t)), i = 0;
arg_type && TREE_VALUE (arg_type) != void_type_node;
- arg_type = TREE_CHAIN (arg_type),
- operand = next_call_expr_arg (&iter))
+ arg_type = TREE_CHAIN (arg_type), i++)
{
+ tree operand = gimple_call_arg (call, i);
if (operand)
{
last_arg_type = TREE_VALUE(arg_type);
@@ -1411,15 +1364,14 @@ check_call (tree call_expr)
/* FIXME - According to Geoff Keating, we should never
have to do this; the front ends should always process
the arg list from the TYPE_ARG_LIST. */
- for (arg_type = DECL_ARGUMENTS (callee_t),
- operand = first_call_expr_arg (call_expr, &iter);
+ for (arg_type = DECL_ARGUMENTS (callee_t), i = 0;
arg_type;
- arg_type = TREE_CHAIN (arg_type),
- operand = next_call_expr_arg (&iter))
+ arg_type = TREE_CHAIN (arg_type), i++)
{
+ tree operand = gimple_call_arg (call, i);
if (operand)
{
- last_arg_type = TREE_TYPE(arg_type);
+ last_arg_type = TREE_TYPE (arg_type);
check_cast (last_arg_type, operand);
}
else
@@ -1433,10 +1385,9 @@ check_call (tree call_expr)
/* In the case where we have a var_args function, we need to
check the remaining parameters against the last argument. */
arg_type = last_arg_type;
- for (;
- operand != NULL_TREE;
- operand = next_call_expr_arg (&iter))
+ for ( ; i < gimple_call_num_args (call); i++)
{
+ tree operand = gimple_call_arg (call, i);
if (arg_type)
check_cast (arg_type, operand);
else
@@ -1457,16 +1408,16 @@ check_call (tree call_expr)
are any bits available for the callee (such as by declaration or
because it is builtin) and process solely on the basis of those
bits. */
-
if (avail == AVAIL_NOT_AVAILABLE || avail == AVAIL_OVERWRITABLE)
{
/* If this is a direct call to an external function, mark all of
the parameter and return types. */
- FOR_EACH_CALL_EXPR_ARG (operand, iter, call_expr)
+ for (i = 0; i < gimple_call_num_args (call); i++)
{
+ tree operand = gimple_call_arg (call, i);
tree type = get_canon_type (TREE_TYPE (operand), false, false);
mark_interesting_type (type, EXPOSED_PARAMETER);
- }
+ }
if (callee_t)
{
@@ -1494,7 +1445,8 @@ okay_pointer_operation (enum tree_code code, tree op0, tree op1)
case PLUS_EXPR:
case POINTER_PLUS_EXPR:
{
- tree base, offset, offset_cast_stmt;
+ tree base, offset;
+ gimple offset_cast_stmt;
if (POINTER_TYPE_P (op0type)
&& TREE_CODE (op0) == SSA_NAME
@@ -1528,150 +1480,124 @@ okay_pointer_operation (enum tree_code code, tree op0, tree op1)
return false;
}
-/* TP is the part of the tree currently under the microscope.
- WALK_SUBTREES is part of the walk_tree api but is unused here.
- DATA is cgraph_node of the function being walked. */
-/* FIXME: When this is converted to run over SSA form, this code
- should be converted to use the operand scanner. */
-static tree
-scan_for_refs (tree *tp, int *walk_subtrees, void *data)
+/* Helper for scan_for_refs. Check the operands of an assignment to
+ mark types that may escape. */
+
+static void
+check_assign (gimple t)
{
- struct cgraph_node *fn = (struct cgraph_node *) data;
- tree t = *tp;
+ /* First look on the lhs and see what variable is stored to */
+ check_lhs_var (gimple_assign_lhs (t));
+
+ /* For the purposes of figuring out what the cast affects */
- switch (TREE_CODE (t))
+ /* Next check the operands on the rhs to see if they are ok. */
+ switch (TREE_CODE_CLASS (gimple_assign_rhs_code (t)))
{
- case VAR_DECL:
- if (DECL_INITIAL (t))
- walk_tree (&DECL_INITIAL (t), scan_for_refs, fn, visited_nodes);
- *walk_subtrees = 0;
+ case tcc_binary:
+ {
+ tree op0 = gimple_assign_rhs1 (t);
+ tree type0 = get_canon_type (TREE_TYPE (op0), false, false);
+ tree op1 = gimple_assign_rhs2 (t);
+ tree type1 = get_canon_type (TREE_TYPE (op1), false, false);
+
+ /* If this is pointer arithmetic of any bad sort, then
+ we need to mark the types as bad. For binary
+ operations, no binary operator we currently support
+ is always "safe" in regard to what it would do to
+ pointers for purposes of determining which types
+ escape, except operations of the size of the type.
+ It is possible that min and max under the right set
+ of circumstances and if the moon is in the correct
+ place could be safe, but it is hard to see how this
+ is worth the effort. */
+ if (type0 && POINTER_TYPE_P (type0)
+ && !okay_pointer_operation (gimple_assign_rhs_code (t), op0, op1))
+ mark_interesting_type (type0, FULL_ESCAPE);
+
+ if (type1 && POINTER_TYPE_P (type1)
+ && !okay_pointer_operation (gimple_assign_rhs_code (t), op1, op0))
+ mark_interesting_type (type1, FULL_ESCAPE);
+
+ look_for_casts (op0);
+ look_for_casts (op1);
+ check_rhs_var (op0);
+ check_rhs_var (op1);
+ }
break;
- case GIMPLE_MODIFY_STMT:
+ case tcc_unary:
{
- /* First look on the lhs and see what variable is stored to */
- tree lhs = GIMPLE_STMT_OPERAND (t, 0);
- tree rhs = GIMPLE_STMT_OPERAND (t, 1);
+ tree op0 = gimple_assign_rhs1 (t);
+ tree type0 = get_canon_type (TREE_TYPE (op0), false, false);
+
+ /* For unary operations, if the operation is NEGATE or ABS on
+ a pointer, this is also considered pointer arithmetic and
+ thus, bad for business. */
+ if (type0
+ && POINTER_TYPE_P (type0)
+ && (TREE_CODE (op0) == NEGATE_EXPR
+ || TREE_CODE (op0) == ABS_EXPR))
+ mark_interesting_type (type0, FULL_ESCAPE);
+
+ check_rhs_var (op0);
+ look_for_casts (op0);
+ }
+ break;
- check_lhs_var (lhs);
- check_cast (TREE_TYPE (lhs), rhs);
+ case tcc_reference:
+ look_for_casts (gimple_assign_rhs1 (t));
+ check_rhs_var (gimple_assign_rhs1 (t));
+ break;
- /* For the purposes of figuring out what the cast affects */
+ case tcc_declaration:
+ check_rhs_var (gimple_assign_rhs1 (t));
+ break;
- /* Next check the operands on the rhs to see if they are ok. */
- switch (TREE_CODE_CLASS (TREE_CODE (rhs)))
- {
- case tcc_binary:
- {
- tree op0 = TREE_OPERAND (rhs, 0);
- tree type0 = get_canon_type (TREE_TYPE (op0), false, false);
- tree op1 = TREE_OPERAND (rhs, 1);
- tree type1 = get_canon_type (TREE_TYPE (op1), false, false);
-
- /* If this is pointer arithmetic of any bad sort, then
- we need to mark the types as bad. For binary
- operations, no binary operator we currently support
- is always "safe" in regard to what it would do to
- pointers for purposes of determining which types
- escape, except operations of the size of the type.
- It is possible that min and max under the right set
- of circumstances and if the moon is in the correct
- place could be safe, but it is hard to see how this
- is worth the effort. */
-
- if (type0 && POINTER_TYPE_P (type0)
- && !okay_pointer_operation (TREE_CODE (rhs), op0, op1))
- mark_interesting_type (type0, FULL_ESCAPE);
- if (type1 && POINTER_TYPE_P (type1)
- && !okay_pointer_operation (TREE_CODE (rhs), op1, op0))
- mark_interesting_type (type1, FULL_ESCAPE);
-
- look_for_casts (lhs, op0);
- look_for_casts (lhs, op1);
- check_rhs_var (op0);
- check_rhs_var (op1);
- }
- break;
- case tcc_unary:
- {
- tree op0 = TREE_OPERAND (rhs, 0);
- tree type0 = get_canon_type (TREE_TYPE (op0), false, false);
- /* For unary operations, if the operation is NEGATE or
- ABS on a pointer, this is also considered pointer
- arithmetic and thus, bad for business. */
- if (type0 && (TREE_CODE (op0) == NEGATE_EXPR
- || TREE_CODE (op0) == ABS_EXPR)
- && POINTER_TYPE_P (type0))
- {
- mark_interesting_type (type0, FULL_ESCAPE);
- }
- check_rhs_var (op0);
- look_for_casts (lhs, op0);
- look_for_casts (lhs, rhs);
- }
+ case tcc_expression:
+ if (gimple_assign_rhs_code (t) == ADDR_EXPR)
+ {
+ tree rhs = gimple_assign_rhs1 (t);
+ look_for_casts (TREE_OPERAND (rhs, 0));
+ check_rhs_var (rhs);
+ }
+ break;
- break;
- case tcc_reference:
- look_for_casts (lhs, rhs);
- check_rhs_var (rhs);
- break;
- case tcc_declaration:
- check_rhs_var (rhs);
- break;
- case tcc_expression:
- switch (TREE_CODE (rhs))
- {
- case ADDR_EXPR:
- look_for_casts (lhs, TREE_OPERAND (rhs, 0));
- check_rhs_var (rhs);
- break;
- default:
- break;
- }
- break;
- case tcc_vl_exp:
- switch (TREE_CODE (rhs))
- {
- case CALL_EXPR:
- /* If this is a call to malloc, squirrel away the
- result so we do mark the resulting cast as being
- bad. */
- check_call (rhs);
- break;
- default:
- break;
- }
- break;
- default:
- break;
- }
- *walk_subtrees = 0;
- }
+ default:
break;
+ }
+}
+
- case ADDR_EXPR:
- /* This case is here to find addresses on rhs of constructors in
- decl_initial of static variables. */
- check_rhs_var (t);
- *walk_subtrees = 0;
+/* Scan statement T for references to types and mark anything
+ interesting. */
+
+static void
+scan_for_refs (gimple t)
+{
+ switch (gimple_code (t))
+ {
+ case GIMPLE_ASSIGN:
+ check_assign (t);
break;
- case CALL_EXPR:
+ case GIMPLE_CALL:
+ /* If this is a call to malloc, squirrel away the result so we
+ do mark the resulting cast as being bad. */
check_call (t);
- *walk_subtrees = 0;
break;
- case ASM_EXPR:
- get_asm_expr_operands (t);
- *walk_subtrees = 0;
+ case GIMPLE_ASM:
+ check_asm (t);
break;
default:
break;
}
- return NULL;
+
+ return;
}
@@ -1721,7 +1647,7 @@ analyze_variable (struct varpool_node *vnode)
gcc_assert (TREE_CODE (global) == VAR_DECL);
if (DECL_INITIAL (global))
- walk_tree (&DECL_INITIAL (global), scan_for_refs, NULL, visited_nodes);
+ check_tree (DECL_INITIAL (global));
}
/* This is the main routine for finding the reference patterns for
@@ -1742,10 +1668,9 @@ analyze_function (struct cgraph_node *fn)
FOR_EACH_BB_FN (this_block, this_cfun)
{
- block_stmt_iterator bsi;
- for (bsi = bsi_start (this_block); !bsi_end_p (bsi); bsi_next (&bsi))
- walk_tree (bsi_stmt_ptr (bsi), scan_for_refs,
- fn, visited_nodes);
+ gimple_stmt_iterator gsi;
+ for (gsi = gsi_start_bb (this_block); !gsi_end_p (gsi); gsi_next (&gsi))
+ scan_for_refs (gsi_stmt (gsi));
}
}
@@ -1761,8 +1686,7 @@ analyze_function (struct cgraph_node *fn)
if (TREE_CODE (var) == VAR_DECL
&& DECL_INITIAL (var)
&& !TREE_STATIC (var))
- walk_tree (&DECL_INITIAL (var), scan_for_refs,
- fn, visited_nodes);
+ check_tree (DECL_INITIAL (var));
get_canon_type (TREE_TYPE (var), false, false);
}
}
@@ -2192,7 +2116,7 @@ type_escape_execute (void)
static bool
gate_type_escape_vars (void)
{
- return (flag_unit_at_a_time != 0 && flag_ipa_type_escape
+ return (flag_ipa_type_escape
/* Don't bother doing anything if the program has errors. */
&& !(errorcount || sorrycount));
}
@@ -2215,4 +2139,3 @@ struct simple_ipa_opt_pass pass_ipa_type_escape =
0 /* todo_flags_finish */
}
};
-
diff --git a/gcc/ipa-type-escape.h b/gcc/ipa-type-escape.h
index c851a2707be..13c3b725c89 100644
--- a/gcc/ipa-type-escape.h
+++ b/gcc/ipa-type-escape.h
@@ -23,11 +23,11 @@ along with GCC; see the file COPYING3. If not see
#include "tree.h"
bool ipa_type_escape_type_contained_p (tree type);
-bool ipa_type_escape_field_does_not_clobber_p (tree record_type, tree field_type);
+bool ipa_type_escape_field_does_not_clobber_p (tree, tree);
int ipa_type_escape_star_count_of_interesting_type (tree type);
int ipa_type_escape_star_count_of_interesting_or_array_type (tree type);
bool is_array_access_through_pointer_and_index (enum tree_code, tree, tree,
- tree *, tree *, tree *);
+ tree *, tree *, gimple *);
#endif /* GCC_IPA_TYPE_ESCAPE_H */
diff --git a/gcc/ipa-utils.c b/gcc/ipa-utils.c
index 2a9562935c3..729a84d8710 100644
--- a/gcc/ipa-utils.c
+++ b/gcc/ipa-utils.c
@@ -32,7 +32,7 @@ along with GCC; see the file COPYING3. If not see
#include "ipa-utils.h"
#include "ipa-reference.h"
#include "c-common.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "cgraph.h"
#include "output.h"
#include "flags.h"
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index fd98969a355..f1ee4d6febc 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,82 @@
+2008-08-12 Ulrich Weigand <uweigand@de.ibm.com>
+
+ * typeck.c (convert): Do not check for TARGET_FLOAT_FORMAT.
+
+2008-08-08 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR 28875
+ * lang.c (java_handle_option): Replace set_Wunused with
+ warn_unused.
+
+2008-07-30 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * gcj.texi: Update copyright years. Do not list GPL as
+ Invariant Section.
+
+2008-07-29 Jakub Jelinek <jakub@redhat.com>
+
+ * class.c (build_utf8_ref): Set DECL_SIZE and DECL_SIZE_UNIT
+ from ctype's sizes.
+
+ * class.c (build_utf8_ref): Pad initializer string to utf8const_type's
+ alignment.
+
+2008-07-29 Jan Hubicka <jh@suse.cz>
+
+ * lang.c (java_post_options): Remove handling of flag_no_inline.
+
+2008-07-28 Richard Guenther <rguenther@suse.de>
+
+ Merge from gimple-tuples-branch.
+
+ 2008-07-18 Richard Guenther <rguenther@suse.de>
+
+ * expr.c: Include tree-iterator.h.
+ * Make-lang.in (expr.o): Add tree-iterator.h dependency.
+
+ 2008-07-18 Aldy Hernandez <aldyh@redhat.com>
+
+ * java-gimplify.c: Include gimple.h instead of tree-gimple.h.
+ * expr.c: Same.
+
+ 2008-07-14 Aldy Hernandez <aldyh@redhat.com>
+
+ * java-gimplify.c (java_gimplify_expr): Same.
+ (java_gimplify_modify_expr): Same.
+ * java-tree.h: Rename GENERIC_NEXT to TREE_CHAIN.
+
+ 2008-05-02 Diego Novillo <dnovillo@google.com>
+
+ * expr.c (build_java_throw_out_of_bounds_exception): Fix
+ mixed declarations and code.
+
+ 2008-05-02 Doug Kwan <dougkwan@google.com>
+
+ * expr.c (build_java_throw_out_of_bounds_exception ): Wrap call to
+ _Jv_ThrowBadArrayIndex with a COMPOUND_EXPR to return 0.
+
+ 2008-02-19 Diego Novillo <dnovillo@google.com>
+
+ http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00804.html
+
+ * java-gimplify.c (java_gimplify_self_mod_expr): Change
+ gimple_seq arguments to gimple_seq *. Update all users.
+
+ 2007-11-26 Aldy Hernandez <aldyh@redhat.com>
+
+ * java-gimplify.c (java_gimplify_expr): Make pre_p and post_p
+ sequences.
+ (java_gimplify_self_mod_expr): Same.
+ * java-tree.h (java_gimplify_expr): Make pre_p and post_p
+ sequences.
+
+2008-07-24 Jan Hubicka <jh@suse.cz>
+
+ * java/decl.c: Include cgraph.h
+ (end_java_method): Remove non-unit-at-a-time code.
+ (java_mark_decl_local): Likewise; sanity check that we don't touch
+ finalized nodes.
+
2008-07-15 Jan Hubicka <jh@suse.cz>
* lang.c (java_init_options): Enable unit-at-a-time by default.
diff --git a/gcc/java/Make-lang.in b/gcc/java/Make-lang.in
index c5446db6569..f188c7d788d 100644
--- a/gcc/java/Make-lang.in
+++ b/gcc/java/Make-lang.in
@@ -269,7 +269,8 @@ java/except.o: java/except.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h $(REAL_H) \
java/expr.o: java/expr.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h $(REAL_H) \
$(RTL_H) $(EXPR_H) java/javaop.h java/java-opcodes.h except.h \
java/java-except.h java/java-except.h java/parse.h toplev.h \
- $(SYSTEM_H) coretypes.h $(TM_H) $(GGC_H) gt-java-expr.h $(TARGET_H)
+ $(SYSTEM_H) coretypes.h $(TM_H) $(GGC_H) gt-java-expr.h $(TARGET_H) \
+ tree-iterator.h
java/jcf-depend.o: java/jcf-depend.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) java/jcf.h
java/jcf-parse.o: java/jcf-parse.c $(CONFIG_H) $(JAVA_TREE_H) $(FLAGS_H) \
@@ -298,7 +299,7 @@ java/verify-impl.o: java/verify-impl.c $(CONFIG_H) java/verify.h $(SYSTEM_H) \
java/zextract.o: java/zextract.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
java/zipfile.h
java/java-gimplify.o: java/java-gimplify.c $(CONFIG_H) $(SYSTEM_H) \
- coretypes.h $(TM_H) $(JAVA_TREE_H) $(TREE_GIMPLE_H) toplev.h
+ coretypes.h $(TM_H) $(JAVA_TREE_H) $(GIMPLE_H) toplev.h
# jcf-io.o needs $(ZLIBINC) added to cflags.
java/jcf-io.o: java/jcf-io.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
diff --git a/gcc/java/class.c b/gcc/java/class.c
index ef5cc0f8956..2d8a1c21999 100644
--- a/gcc/java/class.c
+++ b/gcc/java/class.c
@@ -930,8 +930,8 @@ static GTY(()) tree utf8_decl_list = NULL_TREE;
tree
build_utf8_ref (tree name)
{
- const char * name_ptr = IDENTIFIER_POINTER(name);
- int name_len = IDENTIFIER_LENGTH(name);
+ const char * name_ptr = IDENTIFIER_POINTER (name);
+ int name_len = IDENTIFIER_LENGTH (name), name_pad;
char buf[60];
tree ctype, field = NULL_TREE, str_type, cinit, string;
static int utf8_count = 0;
@@ -942,8 +942,11 @@ build_utf8_ref (tree name)
return ref;
ctype = make_node (RECORD_TYPE);
+ /* '\0' byte plus padding to utf8const_type's alignment. */
+ name_pad = TYPE_ALIGN_UNIT (utf8const_type)
+ - (name_len & (TYPE_ALIGN_UNIT (utf8const_type) - 1));
str_type = build_prim_array_type (unsigned_byte_type_node,
- name_len + 1); /* Allow for final '\0'. */
+ name_len + name_pad);
PUSH_FIELD (ctype, field, "hash", unsigned_short_type_node);
PUSH_FIELD (ctype, field, "length", unsigned_short_type_node);
PUSH_FIELD (ctype, field, "data", str_type);
@@ -973,8 +976,7 @@ build_utf8_ref (tree name)
{
int decl_size;
/* Ensure decl_size is a multiple of utf8const_type's alignment. */
- decl_size = (name_len + 5 + TYPE_ALIGN_UNIT (utf8const_type) - 1)
- & ~(TYPE_ALIGN_UNIT (utf8const_type) - 1);
+ decl_size = name_len + 4 + name_pad;
if (flag_merge_constants && decl_size < 256)
{
char buf[32];
@@ -988,6 +990,8 @@ build_utf8_ref (tree name)
TREE_CHAIN (decl) = utf8_decl_list;
layout_decl (decl, 0);
+ DECL_SIZE (decl) = TYPE_SIZE (ctype);
+ DECL_SIZE_UNIT (decl) = TYPE_SIZE_UNIT (ctype);
pushdecl (decl);
rest_of_decl_compilation (decl, global_bindings_p (), 0);
varpool_mark_needed_node (varpool_node (decl));
diff --git a/gcc/java/decl.c b/gcc/java/decl.c
index d249157371d..1768109414d 100644
--- a/gcc/java/decl.c
+++ b/gcc/java/decl.c
@@ -49,6 +49,7 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
#include "version.h"
#include "tree-iterator.h"
#include "langhooks.h"
+#include "cgraph.h"
#if defined (DEBUG_JAVA_BINDING_LEVELS)
extern void indent (void);
@@ -1797,14 +1798,6 @@ end_java_method (void)
finish_method (fndecl);
- if (! flag_unit_at_a_time)
- {
- /* Nulling these fields when we no longer need them saves
- memory. */
- DECL_SAVED_TREE (fndecl) = NULL;
- DECL_STRUCT_FUNCTION (fndecl) = NULL;
- DECL_INITIAL (fndecl) = NULL_TREE;
- }
current_function_decl = NULL_TREE;
}
@@ -1854,15 +1847,12 @@ java_mark_decl_local (tree decl)
{
DECL_EXTERNAL (decl) = 0;
- /* If we've already constructed DECL_RTL, give encode_section_info
- a second chance, now that we've changed the flags. */
- /* ??? Ideally, we'd have flag_unit_at_a_time set, and not have done
- anything that would have referenced DECL_RTL so far. But at the
- moment we force flag_unit_at_a_time off due to excessive memory
- consumption when compiling large jar files. Which probably means
- that we need to re-order how we process jar files... */
- if (DECL_RTL_SET_P (decl))
- make_decl_rtl (decl);
+#ifdef ENABLE_CHECKING
+ /* Double check that we didn't pass the function to the callgraph early. */
+ if (TREE_CODE (decl) == FUNCTION_DECL)
+ gcc_assert (!cgraph_node (decl)->local.finalized);
+#endif
+ gcc_assert (!DECL_RTL_SET_P (decl));
}
/* Given appropriate target support, G++ will emit hidden aliases for native
diff --git a/gcc/java/expr.c b/gcc/java/expr.c
index c64f6d68eba..ff28bbb0b40 100644
--- a/gcc/java/expr.c
+++ b/gcc/java/expr.c
@@ -42,7 +42,8 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
#include "toplev.h"
#include "except.h"
#include "ggc.h"
-#include "tree-gimple.h"
+#include "tree-iterator.h"
+#include "gimple.h"
#include "target.h"
static void flush_quick_stack (void);
@@ -814,10 +815,20 @@ encode_newarray_type (tree type)
static tree
build_java_throw_out_of_bounds_exception (tree index)
{
- tree node = build_call_nary (int_type_node,
+ tree node;
+
+ /* We need to build a COMPOUND_EXPR because _Jv_ThrowBadArrayIndex()
+ has void return type. We cannot just set the type of the CALL_EXPR below
+ to int_type_node because we would lose it during gimplification. */
+ gcc_assert (VOID_TYPE_P (TREE_TYPE (TREE_TYPE (soft_badarrayindex_node))));
+ node = build_call_nary (void_type_node,
build_address_of (soft_badarrayindex_node),
1, index);
+ TREE_SIDE_EFFECTS (node) = 1;
+
+ node = build2 (COMPOUND_EXPR, int_type_node, node, integer_zero_node);
TREE_SIDE_EFFECTS (node) = 1; /* Allows expansion within ANDIF */
+
return (node);
}
diff --git a/gcc/java/gcj.texi b/gcc/java/gcj.texi
index 179e620f8c9..af5b06615b0 100644
--- a/gcc/java/gcj.texi
+++ b/gcc/java/gcj.texi
@@ -17,7 +17,7 @@
@c the word ``Java'.
@c When this manual is copyrighted.
-@set copyrights-gcj 2001, 2002, 2003, 2004, 2005, 2006, 2007
+@set copyrights-gcj 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
@copying
@c man begin COPYRIGHT
@@ -25,13 +25,12 @@ Copyright @copyright{} @value{copyrights-gcj} Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2 or
-any later version published by the Free Software Foundation; with the
-Invariant Sections being ``GNU General Public License'', the Front-Cover
-texts being (a) (see below), and with the Back-Cover Texts being (b)
-(see below). A copy of the license is included in the
+any later version published by the Free Software Foundation; with no
+Invariant Sections, the Front-Cover Texts being (a) (see below), and
+with the Back-Cover Texts being (b) (see below).
+A copy of the license is included in the
@c man end
-section entitled
-``GNU Free Documentation License''.
+section entitled ``GNU Free Documentation License''.
@ignore
@c man begin COPYRIGHT
man page gfdl(7).
diff --git a/gcc/java/java-gimplify.c b/gcc/java/java-gimplify.c
index 53582411353..790cb13c039 100644
--- a/gcc/java/java-gimplify.c
+++ b/gcc/java/java-gimplify.c
@@ -28,12 +28,13 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
#include "tree.h"
#include "java-tree.h"
#include "tree-dump.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "toplev.h"
static tree java_gimplify_block (tree);
static enum gimplify_status java_gimplify_modify_expr (tree *);
-static enum gimplify_status java_gimplify_self_mod_expr (tree*, tree*, tree *);
+static enum gimplify_status java_gimplify_self_mod_expr (tree *, gimple_seq *,
+ gimple_seq *);
static void dump_java_tree (enum tree_dump_index, tree);
@@ -53,8 +54,7 @@ java_genericize (tree fndecl)
/* Gimplify a Java tree. */
int
-java_gimplify_expr (tree *expr_p, tree *pre_p ATTRIBUTE_UNUSED,
- tree *post_p ATTRIBUTE_UNUSED)
+java_gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
{
enum tree_code code = TREE_CODE (*expr_p);
@@ -68,9 +68,6 @@ java_gimplify_expr (tree *expr_p, tree *pre_p ATTRIBUTE_UNUSED,
*expr_p = java_replace_reference (*expr_p, /* want_lvalue */ false);
return GS_UNHANDLED;
- /* We don't handle GIMPLE_MODIFY_STMT, as MODIFY_EXPRs with java
- semantics should only be generated by the front-end, and never
- by anything after gimplification. */
case MODIFY_EXPR:
return java_gimplify_modify_expr (expr_p);
@@ -142,7 +139,7 @@ java_gimplify_modify_expr (tree *modify_expr_p)
{
tree new_lhs = java_replace_reference (lhs, /* want_lvalue */ true);
tree new_rhs = build1 (NOP_EXPR, TREE_TYPE (new_lhs), rhs);
- modify_expr = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (new_lhs),
+ modify_expr = build2 (MODIFY_EXPR, TREE_TYPE (new_lhs),
new_lhs, new_rhs);
modify_expr = build1 (NOP_EXPR, lhs_type, modify_expr);
}
@@ -160,8 +157,8 @@ java_gimplify_modify_expr (tree *modify_expr_p)
between the reading and the writing. */
static enum gimplify_status
-java_gimplify_self_mod_expr (tree *expr_p, tree *pre_p ATTRIBUTE_UNUSED,
- tree *post_p ATTRIBUTE_UNUSED)
+java_gimplify_self_mod_expr (tree *expr_p, gimple_seq *pre_p ATTRIBUTE_UNUSED,
+ gimple_seq *post_p ATTRIBUTE_UNUSED)
{
tree lhs = TREE_OPERAND (*expr_p, 0);
@@ -180,7 +177,7 @@ java_gimplify_block (tree java_block)
{
tree decls = BLOCK_VARS (java_block);
tree body = BLOCK_EXPR_BODY (java_block);
- tree outer = gimple_current_bind_expr ();
+ gimple outer = gimple_current_bind_expr ();
tree block;
/* Don't bother with empty blocks. */
@@ -199,10 +196,10 @@ java_gimplify_block (tree java_block)
routines generate info for the variables in that block. */
TREE_USED (block) = 1;
- if (outer != NULL_TREE)
+ if (outer != NULL)
{
- outer = BIND_EXPR_BLOCK (outer);
- BLOCK_SUBBLOCKS (outer) = chainon (BLOCK_SUBBLOCKS (outer), block);
+ tree b = gimple_bind_block (outer);
+ BLOCK_SUBBLOCKS (b) = chainon (BLOCK_SUBBLOCKS (b), block);
}
BLOCK_EXPR_BODY (java_block) = NULL_TREE;
diff --git a/gcc/java/java-tree.h b/gcc/java/java-tree.h
index a046a0f450a..7ae71d9e41b 100644
--- a/gcc/java/java-tree.h
+++ b/gcc/java/java-tree.h
@@ -649,7 +649,7 @@ struct lang_identifier GTY(())
/* The resulting tree type. */
union lang_tree_node
GTY((desc ("TREE_CODE (&%h.generic) == IDENTIFIER_NODE"),
- chain_next ("(union lang_tree_node *)GENERIC_NEXT (&%h.generic)")))
+ chain_next ("(union lang_tree_node *)TREE_CHAIN (&%h.generic)")))
{
union tree_node GTY ((tag ("0"),
@@ -1555,7 +1555,7 @@ enum
#undef DEBUG_JAVA_BINDING_LEVELS
extern void java_genericize (tree);
-extern int java_gimplify_expr (tree *, tree *, tree *);
+extern int java_gimplify_expr (tree *, gimple_seq *, gimple_seq *);
extern FILE *finput;
diff --git a/gcc/java/lang.c b/gcc/java/lang.c
index 1d11b4f2e00..d049aeb2bc1 100644
--- a/gcc/java/lang.c
+++ b/gcc/java/lang.c
@@ -221,7 +221,7 @@ java_handle_option (size_t scode, const char *arg, int value)
flag_wall = value;
/* When -Wall given, enable -Wunused. We do this because the C
compiler does it, and people expect it. */
- set_Wunused (value);
+ warn_unused = value;
break;
case OPT_fenable_assertions_:
@@ -532,12 +532,6 @@ java_post_options (const char **pfilename)
{
const char *filename = *pfilename;
- /* Use tree inlining. */
- if (!flag_no_inline)
- flag_no_inline = 1;
- if (flag_inline_functions)
- flag_inline_trees = 2;
-
/* An absolute requirement: if we're not using indirect dispatch, we
must always verify everything. */
if (! flag_indirect_dispatch)
diff --git a/gcc/java/typeck.c b/gcc/java/typeck.c
index 1028c73ad14..e812f31b829 100644
--- a/gcc/java/typeck.c
+++ b/gcc/java/typeck.c
@@ -131,8 +131,7 @@ convert (tree type, tree expr)
if (type == char_type_node || type == promoted_char_type_node)
return fold_convert (type, expr);
if ((really_constant_p (expr) || ! flag_unsafe_math_optimizations)
- && TREE_CODE (TREE_TYPE (expr)) == REAL_TYPE
- && TARGET_FLOAT_FORMAT == IEEE_FLOAT_FORMAT)
+ && TREE_CODE (TREE_TYPE (expr)) == REAL_TYPE)
return convert_ieee_real_to_integer (type, expr);
else
{
diff --git a/gcc/jump.c b/gcc/jump.c
index 595363b1adb..c0ab6909a2a 100644
--- a/gcc/jump.c
+++ b/gcc/jump.c
@@ -1552,12 +1552,22 @@ rtx_renumbered_equal_p (const_rtx x, const_rtx y)
if (reg_renumber[reg_x] >= 0)
{
+ if (!subreg_offset_representable_p (reg_renumber[reg_x],
+ GET_MODE (SUBREG_REG (x)),
+ byte_x,
+ GET_MODE (x)))
+ return 0;
reg_x = subreg_regno_offset (reg_renumber[reg_x],
GET_MODE (SUBREG_REG (x)),
byte_x,
GET_MODE (x));
byte_x = 0;
}
+ else if (!subreg_offset_representable_p (reg_x,
+ GET_MODE (SUBREG_REG (x)),
+ byte_x,
+ GET_MODE (x)))
+ return 0;
}
else
{
@@ -1573,12 +1583,22 @@ rtx_renumbered_equal_p (const_rtx x, const_rtx y)
if (reg_renumber[reg_y] >= 0)
{
+ if (!subreg_offset_representable_p (reg_renumber[reg_y],
+ GET_MODE (SUBREG_REG (y)),
+ byte_y,
+ GET_MODE (y)))
+ return 0;
reg_y = subreg_regno_offset (reg_renumber[reg_y],
GET_MODE (SUBREG_REG (y)),
byte_y,
GET_MODE (y));
byte_y = 0;
}
+ else if (!subreg_offset_representable_p (reg_y,
+ GET_MODE (SUBREG_REG (y)),
+ byte_y,
+ GET_MODE (y)))
+ return 0;
}
else
{
diff --git a/gcc/lambda-code.c b/gcc/lambda-code.c
index 5ae74ffa1ce..21bc1846a73 100644
--- a/gcc/lambda-code.c
+++ b/gcc/lambda-code.c
@@ -1231,16 +1231,16 @@ gcc_loop_to_lambda_loop (struct loop *loop, int depth,
VEC(tree,heap) * outerinductionvars,
VEC(tree,heap) ** lboundvars,
VEC(tree,heap) ** uboundvars,
- VEC(int,heap) ** steps,
+ VEC(int,heap) ** steps,
struct obstack * lambda_obstack)
{
- tree phi;
- tree exit_cond;
+ gimple phi;
+ gimple exit_cond;
tree access_fn, inductionvar;
tree step;
lambda_loop lloop = NULL;
lambda_linear_expression lbound, ubound;
- tree test;
+ tree test_lhs, test_rhs;
int stepint;
int extra = 0;
tree lboundvar, uboundvar, uboundresult;
@@ -1257,9 +1257,7 @@ gcc_loop_to_lambda_loop (struct loop *loop, int depth,
return NULL;
}
- test = TREE_OPERAND (exit_cond, 0);
-
- if (SSA_NAME_DEF_STMT (inductionvar) == NULL_TREE)
+ if (SSA_NAME_DEF_STMT (inductionvar) == NULL)
{
if (dump_file && (dump_flags & TDF_DETAILS))
@@ -1270,10 +1268,10 @@ gcc_loop_to_lambda_loop (struct loop *loop, int depth,
}
phi = SSA_NAME_DEF_STMT (inductionvar);
- if (TREE_CODE (phi) != PHI_NODE)
+ if (gimple_code (phi) != GIMPLE_PHI)
{
- phi = SINGLE_SSA_TREE_OPERAND (phi, SSA_OP_USE);
- if (!phi)
+ tree op = SINGLE_SSA_TREE_OPERAND (phi, SSA_OP_USE);
+ if (!op)
{
if (dump_file && (dump_flags & TDF_DETAILS))
@@ -1283,16 +1281,14 @@ gcc_loop_to_lambda_loop (struct loop *loop, int depth,
return NULL;
}
- phi = SSA_NAME_DEF_STMT (phi);
- if (TREE_CODE (phi) != PHI_NODE)
+ phi = SSA_NAME_DEF_STMT (op);
+ if (gimple_code (phi) != GIMPLE_PHI)
{
-
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file,
"Unable to convert loop: Cannot find PHI node for induction variable\n");
return NULL;
}
-
}
/* The induction variable name/version we want to put in the array is the
@@ -1331,7 +1327,7 @@ gcc_loop_to_lambda_loop (struct loop *loop, int depth,
/* Only want phis for induction vars, which will have two
arguments. */
- if (PHI_NUM_ARGS (phi) != 2)
+ if (gimple_phi_num_args (phi) != 2)
{
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file,
@@ -1341,8 +1337,8 @@ gcc_loop_to_lambda_loop (struct loop *loop, int depth,
/* Another induction variable check. One argument's source should be
in the loop, one outside the loop. */
- if (flow_bb_inside_loop_p (loop, PHI_ARG_EDGE (phi, 0)->src)
- && flow_bb_inside_loop_p (loop, PHI_ARG_EDGE (phi, 1)->src))
+ if (flow_bb_inside_loop_p (loop, gimple_phi_arg_edge (phi, 0)->src)
+ && flow_bb_inside_loop_p (loop, gimple_phi_arg_edge (phi, 1)->src))
{
if (dump_file && (dump_flags & TDF_DETAILS))
@@ -1352,7 +1348,7 @@ gcc_loop_to_lambda_loop (struct loop *loop, int depth,
return NULL;
}
- if (flow_bb_inside_loop_p (loop, PHI_ARG_EDGE (phi, 0)->src))
+ if (flow_bb_inside_loop_p (loop, gimple_phi_arg_edge (phi, 0)->src))
{
lboundvar = PHI_ARG_DEF (phi, 1);
lbound = gcc_tree_to_linear_expression (depth, lboundvar,
@@ -1378,21 +1374,23 @@ gcc_loop_to_lambda_loop (struct loop *loop, int depth,
}
/* One part of the test may be a loop invariant tree. */
VEC_reserve (tree, heap, *invariants, 1);
- if (TREE_CODE (TREE_OPERAND (test, 1)) == SSA_NAME
- && invariant_in_loop_and_outer_loops (loop, TREE_OPERAND (test, 1)))
- VEC_quick_push (tree, *invariants, TREE_OPERAND (test, 1));
- else if (TREE_CODE (TREE_OPERAND (test, 0)) == SSA_NAME
- && invariant_in_loop_and_outer_loops (loop, TREE_OPERAND (test, 0)))
- VEC_quick_push (tree, *invariants, TREE_OPERAND (test, 0));
+ test_lhs = gimple_cond_lhs (exit_cond);
+ test_rhs = gimple_cond_rhs (exit_cond);
+
+ if (TREE_CODE (test_rhs) == SSA_NAME
+ && invariant_in_loop_and_outer_loops (loop, test_rhs))
+ VEC_quick_push (tree, *invariants, test_rhs);
+ else if (TREE_CODE (test_lhs) == SSA_NAME
+ && invariant_in_loop_and_outer_loops (loop, test_lhs))
+ VEC_quick_push (tree, *invariants, test_lhs);
/* The non-induction variable part of the test is the upper bound variable.
*/
- if (TREE_OPERAND (test, 0) == inductionvar)
- uboundvar = TREE_OPERAND (test, 1);
+ if (test_lhs == inductionvar)
+ uboundvar = test_rhs;
else
- uboundvar = TREE_OPERAND (test, 0);
+ uboundvar = test_lhs;
-
/* We only size the vectors assuming we have, at max, 2 times as many
invariants as we do loops (one for each bound).
This is just an arbitrary number, but it has to be matched against the
@@ -1401,13 +1399,13 @@ gcc_loop_to_lambda_loop (struct loop *loop, int depth,
/* We might have some leftover. */
- if (TREE_CODE (test) == LT_EXPR)
+ if (gimple_cond_code (exit_cond) == LT_EXPR)
extra = -1 * stepint;
- else if (TREE_CODE (test) == NE_EXPR)
+ else if (gimple_cond_code (exit_cond) == NE_EXPR)
extra = -1 * stepint;
- else if (TREE_CODE (test) == GT_EXPR)
+ else if (gimple_cond_code (exit_cond) == GT_EXPR)
extra = -1 * stepint;
- else if (TREE_CODE (test) == EQ_EXPR)
+ else if (gimple_cond_code (exit_cond) == EQ_EXPR)
extra = 1 * stepint;
ubound = gcc_tree_to_linear_expression (depth, uboundvar,
@@ -1439,24 +1437,23 @@ gcc_loop_to_lambda_loop (struct loop *loop, int depth,
static tree
find_induction_var_from_exit_cond (struct loop *loop)
{
- tree expr = get_loop_exit_condition (loop);
+ gimple expr = get_loop_exit_condition (loop);
tree ivarop;
- tree test;
- if (expr == NULL_TREE)
- return NULL_TREE;
- if (TREE_CODE (expr) != COND_EXPR)
+ tree test_lhs, test_rhs;
+ if (expr == NULL)
return NULL_TREE;
- test = TREE_OPERAND (expr, 0);
- if (!COMPARISON_CLASS_P (test))
+ if (gimple_code (expr) != GIMPLE_COND)
return NULL_TREE;
+ test_lhs = gimple_cond_lhs (expr);
+ test_rhs = gimple_cond_rhs (expr);
/* Find the side that is invariant in this loop. The ivar must be the other
side. */
- if (expr_invariant_in_loop_p (loop, TREE_OPERAND (test, 0)))
- ivarop = TREE_OPERAND (test, 1);
- else if (expr_invariant_in_loop_p (loop, TREE_OPERAND (test, 1)))
- ivarop = TREE_OPERAND (test, 0);
+ if (expr_invariant_in_loop_p (loop, test_lhs))
+ ivarop = test_rhs;
+ else if (expr_invariant_in_loop_p (loop, test_rhs))
+ ivarop = test_lhs;
else
return NULL_TREE;
@@ -1548,7 +1545,7 @@ gcc_loopnest_to_lambda_loopnest (struct loop *loop_nest,
static tree
lbv_to_gcc_expression (lambda_body_vector lbv,
tree type, VEC(tree,heap) *induction_vars,
- tree *stmts_to_insert)
+ gimple_seq *stmts_to_insert)
{
int k;
tree resvar;
@@ -1583,7 +1580,7 @@ lle_to_gcc_expression (lambda_linear_expression lle,
tree type,
VEC(tree,heap) *induction_vars,
VEC(tree,heap) *invariants,
- enum tree_code wrap, tree *stmts_to_insert)
+ enum tree_code wrap, gimple_seq *stmts_to_insert)
{
int k;
tree resvar;
@@ -1641,17 +1638,19 @@ lle_to_gcc_expression (lambda_linear_expression lle,
/* Remove the induction variable defined at IV_STMT. */
void
-remove_iv (tree iv_stmt)
+remove_iv (gimple iv_stmt)
{
- if (TREE_CODE (iv_stmt) == PHI_NODE)
+ gimple_stmt_iterator si = gsi_for_stmt (iv_stmt);
+
+ if (gimple_code (iv_stmt) == GIMPLE_PHI)
{
- int i;
+ unsigned i;
- for (i = 0; i < PHI_NUM_ARGS (iv_stmt); i++)
+ for (i = 0; i < gimple_phi_num_args (iv_stmt); i++)
{
- tree stmt;
+ gimple stmt;
imm_use_iterator imm_iter;
- tree arg = PHI_ARG_DEF (iv_stmt, i);
+ tree arg = gimple_phi_arg_def (iv_stmt, i);
bool used = false;
if (TREE_CODE (arg) != SSA_NAME)
@@ -1665,13 +1664,11 @@ remove_iv (tree iv_stmt)
remove_iv (SSA_NAME_DEF_STMT (arg));
}
- remove_phi_node (iv_stmt, NULL_TREE, true);
+ remove_phi_node (&si, true);
}
else
{
- block_stmt_iterator bsi = bsi_for_stmt (iv_stmt);
-
- bsi_remove (&bsi, true);
+ gsi_remove (&si, true);
release_defs (iv_stmt);
}
}
@@ -1692,18 +1689,18 @@ void
lambda_loopnest_to_gcc_loopnest (struct loop *old_loopnest,
VEC(tree,heap) *old_ivs,
VEC(tree,heap) *invariants,
- VEC(tree,heap) **remove_ivs,
+ VEC(gimple,heap) **remove_ivs,
lambda_loopnest new_loopnest,
lambda_trans_matrix transform,
struct obstack * lambda_obstack)
{
struct loop *temp;
size_t i = 0;
- int j;
+ unsigned j;
size_t depth = 0;
VEC(tree,heap) *new_ivs = NULL;
tree oldiv;
- block_stmt_iterator bsi;
+ gimple_stmt_iterator bsi;
transform = lambda_trans_matrix_inverse (transform);
@@ -1720,13 +1717,15 @@ lambda_loopnest_to_gcc_loopnest (struct loop *old_loopnest,
lambda_loop newloop;
basic_block bb;
edge exit;
- tree ivvar, ivvarinced, exitcond, stmts;
+ tree ivvar, ivvarinced;
+ gimple exitcond;
+ gimple_seq stmts;
enum tree_code testtype;
tree newupperbound, newlowerbound;
lambda_linear_expression offset;
tree type;
bool insert_after;
- tree inc_stmt;
+ gimple inc_stmt;
oldiv = VEC_index (tree, old_ivs, i);
type = TREE_TYPE (oldiv);
@@ -1749,6 +1748,7 @@ lambda_loopnest_to_gcc_loopnest (struct loop *old_loopnest,
/* Now build the new lower bounds, and insert the statements
necessary to generate it on the loop preheader. */
+ stmts = NULL;
newlowerbound = lle_to_gcc_expression (LL_LOWER_BOUND (newloop),
LL_LINEAR_OFFSET (newloop),
type,
@@ -1757,11 +1757,12 @@ lambda_loopnest_to_gcc_loopnest (struct loop *old_loopnest,
if (stmts)
{
- bsi_insert_on_edge (loop_preheader_edge (temp), stmts);
- bsi_commit_edge_inserts ();
+ gsi_insert_seq_on_edge (loop_preheader_edge (temp), stmts);
+ gsi_commit_edge_inserts ();
}
/* Build the new upper bound and insert its statements in the
basic block of the exit condition */
+ stmts = NULL;
newupperbound = lle_to_gcc_expression (LL_UPPER_BOUND (newloop),
LL_LINEAR_OFFSET (newloop),
type,
@@ -1769,10 +1770,10 @@ lambda_loopnest_to_gcc_loopnest (struct loop *old_loopnest,
invariants, MIN_EXPR, &stmts);
exit = single_exit (temp);
exitcond = get_loop_exit_condition (temp);
- bb = bb_for_stmt (exitcond);
- bsi = bsi_after_labels (bb);
+ bb = gimple_bb (exitcond);
+ bsi = gsi_after_labels (bb);
if (stmts)
- bsi_insert_before (&bsi, stmts, BSI_NEW_STMT);
+ gsi_insert_seq_before (&bsi, stmts, GSI_NEW_STMT);
/* Create the new iv. */
@@ -1786,13 +1787,14 @@ lambda_loopnest_to_gcc_loopnest (struct loop *old_loopnest,
dominate the block containing the exit condition.
So we simply create our own incremented iv to use in the new exit
test, and let redundancy elimination sort it out. */
- inc_stmt = build2 (PLUS_EXPR, type,
- ivvar, build_int_cst (type, LL_STEP (newloop)));
- inc_stmt = build_gimple_modify_stmt (SSA_NAME_VAR (ivvar), inc_stmt);
+ inc_stmt = gimple_build_assign_with_ops (PLUS_EXPR, SSA_NAME_VAR (ivvar),
+ ivvar,
+ build_int_cst (type, LL_STEP (newloop)));
+
ivvarinced = make_ssa_name (SSA_NAME_VAR (ivvar), inc_stmt);
- GIMPLE_STMT_OPERAND (inc_stmt, 0) = ivvarinced;
- bsi = bsi_for_stmt (exitcond);
- bsi_insert_before (&bsi, inc_stmt, BSI_SAME_STMT);
+ gimple_assign_set_lhs (inc_stmt, ivvarinced);
+ bsi = gsi_for_stmt (exitcond);
+ gsi_insert_before (&bsi, inc_stmt, GSI_SAME_STMT);
/* Replace the exit condition with the new upper bound
comparison. */
@@ -1806,9 +1808,7 @@ lambda_loopnest_to_gcc_loopnest (struct loop *old_loopnest,
if (exit->flags & EDGE_FALSE_VALUE)
testtype = swap_tree_comparison (testtype);
- COND_EXPR_COND (exitcond) = build2 (testtype,
- boolean_type_node,
- newupperbound, ivvarinced);
+ gimple_cond_set_condition (exitcond, testtype, newupperbound, ivvarinced);
update_stmt (exitcond);
VEC_replace (tree, new_ivs, i, ivvar);
@@ -1824,10 +1824,10 @@ lambda_loopnest_to_gcc_loopnest (struct loop *old_loopnest,
imm_use_iterator imm_iter;
use_operand_p use_p;
tree oldiv_def;
- tree oldiv_stmt = SSA_NAME_DEF_STMT (oldiv);
- tree stmt;
+ gimple oldiv_stmt = SSA_NAME_DEF_STMT (oldiv);
+ gimple stmt;
- if (TREE_CODE (oldiv_stmt) == PHI_NODE)
+ if (gimple_code (oldiv_stmt) == GIMPLE_PHI)
oldiv_def = PHI_RESULT (oldiv_stmt);
else
oldiv_def = SINGLE_SSA_TREE_OPERAND (oldiv_stmt, SSA_OP_DEF);
@@ -1835,7 +1835,8 @@ lambda_loopnest_to_gcc_loopnest (struct loop *old_loopnest,
FOR_EACH_IMM_USE_STMT (stmt, imm_iter, oldiv_def)
{
- tree newiv, stmts;
+ tree newiv;
+ gimple_seq stmts;
lambda_body_vector lbv, newlbv;
/* Compute the new expression for the induction
@@ -1847,28 +1848,29 @@ lambda_loopnest_to_gcc_loopnest (struct loop *old_loopnest,
newlbv = lambda_body_vector_compute_new (transform, lbv,
lambda_obstack);
+ stmts = NULL;
newiv = lbv_to_gcc_expression (newlbv, TREE_TYPE (oldiv),
new_ivs, &stmts);
- if (stmts && TREE_CODE (stmt) != PHI_NODE)
+ if (stmts && gimple_code (stmt) != GIMPLE_PHI)
{
- bsi = bsi_for_stmt (stmt);
- bsi_insert_before (&bsi, stmts, BSI_SAME_STMT);
+ bsi = gsi_for_stmt (stmt);
+ gsi_insert_seq_before (&bsi, stmts, GSI_SAME_STMT);
}
FOR_EACH_IMM_USE_ON_STMT (use_p, imm_iter)
propagate_value (use_p, newiv);
- if (stmts && TREE_CODE (stmt) == PHI_NODE)
- for (j = 0; j < PHI_NUM_ARGS (stmt); j++)
- if (PHI_ARG_DEF (stmt, j) == newiv)
- bsi_insert_on_edge (PHI_ARG_EDGE (stmt, j), stmts);
+ if (stmts && gimple_code (stmt) == GIMPLE_PHI)
+ for (j = 0; j < gimple_phi_num_args (stmt); j++)
+ if (gimple_phi_arg_def (stmt, j) == newiv)
+ gsi_insert_seq_on_edge (gimple_phi_arg_edge (stmt, j), stmts);
update_stmt (stmt);
}
/* Remove the now unused induction variable. */
- VEC_safe_push (tree, heap, *remove_ivs, oldiv_stmt);
+ VEC_safe_push (gimple, heap, *remove_ivs, oldiv_stmt);
}
VEC_free (tree, heap, new_ivs);
}
@@ -1877,13 +1879,13 @@ lambda_loopnest_to_gcc_loopnest (struct loop *old_loopnest,
determining if we have a perfect loop nest. */
static bool
-not_interesting_stmt (tree stmt)
+not_interesting_stmt (gimple stmt)
{
/* Note that COND_EXPR's aren't interesting because if they were exiting the
loop, we would have already failed the number of exits tests. */
- if (TREE_CODE (stmt) == LABEL_EXPR
- || TREE_CODE (stmt) == GOTO_EXPR
- || TREE_CODE (stmt) == COND_EXPR)
+ if (gimple_code (stmt) == GIMPLE_LABEL
+ || gimple_code (stmt) == GIMPLE_GOTO
+ || gimple_code (stmt) == GIMPLE_COND)
return true;
return false;
}
@@ -1891,11 +1893,11 @@ not_interesting_stmt (tree stmt)
/* Return TRUE if PHI uses DEF for it's in-the-loop edge for LOOP. */
static bool
-phi_loop_edge_uses_def (struct loop *loop, tree phi, tree def)
+phi_loop_edge_uses_def (struct loop *loop, gimple phi, tree def)
{
- int i;
- for (i = 0; i < PHI_NUM_ARGS (phi); i++)
- if (flow_bb_inside_loop_p (loop, PHI_ARG_EDGE (phi, i)->src))
+ unsigned i;
+ for (i = 0; i < gimple_phi_num_args (phi); i++)
+ if (flow_bb_inside_loop_p (loop, gimple_phi_arg_edge (phi, i)->src))
if (PHI_ARG_DEF (phi, i) == def)
return true;
return false;
@@ -1904,7 +1906,7 @@ phi_loop_edge_uses_def (struct loop *loop, tree phi, tree def)
/* Return TRUE if STMT is a use of PHI_RESULT. */
static bool
-stmt_uses_phi_result (tree stmt, tree phi_result)
+stmt_uses_phi_result (gimple stmt, tree phi_result)
{
tree use = SINGLE_SSA_TREE_OPERAND (stmt, SSA_OP_USE);
@@ -1920,9 +1922,9 @@ stmt_uses_phi_result (tree stmt, tree phi_result)
i_3 = PHI (0, i_29); */
static bool
-stmt_is_bumper_for_loop (struct loop *loop, tree stmt)
+stmt_is_bumper_for_loop (struct loop *loop, gimple stmt)
{
- tree use;
+ gimple use;
tree def;
imm_use_iterator iter;
use_operand_p use_p;
@@ -1934,7 +1936,7 @@ stmt_is_bumper_for_loop (struct loop *loop, tree stmt)
FOR_EACH_IMM_USE_FAST (use_p, iter, def)
{
use = USE_STMT (use_p);
- if (TREE_CODE (use) == PHI_NODE)
+ if (gimple_code (use) == GIMPLE_PHI)
{
if (phi_loop_edge_uses_def (loop, use, def))
if (stmt_uses_phi_result (stmt, PHI_RESULT (use)))
@@ -1976,7 +1978,7 @@ perfect_nest_p (struct loop *loop)
{
basic_block *bbs;
size_t i;
- tree exit_cond;
+ gimple exit_cond;
/* Loops at depth 0 are perfect nests. */
if (!loop->inner)
@@ -1989,13 +1991,13 @@ perfect_nest_p (struct loop *loop)
{
if (bbs[i]->loop_father == loop)
{
- block_stmt_iterator bsi;
+ gimple_stmt_iterator bsi;
- for (bsi = bsi_start (bbs[i]); !bsi_end_p (bsi); bsi_next (&bsi))
+ for (bsi = gsi_start_bb (bbs[i]); !gsi_end_p (bsi); gsi_next (&bsi))
{
- tree stmt = bsi_stmt (bsi);
+ gimple stmt = gsi_stmt (bsi);
- if (TREE_CODE (stmt) == COND_EXPR
+ if (gimple_code (stmt) == GIMPLE_COND
&& exit_cond != stmt)
goto non_perfectly_nested;
@@ -2023,10 +2025,10 @@ perfect_nest_p (struct loop *loop)
of body basic block. */
static void
-replace_uses_equiv_to_x_with_y (struct loop *loop, tree stmt, tree x,
+replace_uses_equiv_to_x_with_y (struct loop *loop, gimple stmt, tree x,
int xstep, tree y, tree yinit,
htab_t replacements,
- block_stmt_iterator *firstbsi)
+ gimple_stmt_iterator *firstbsi)
{
ssa_op_iter iter;
use_operand_p use_p;
@@ -2035,7 +2037,8 @@ replace_uses_equiv_to_x_with_y (struct loop *loop, tree stmt, tree x,
{
tree use = USE_FROM_PTR (use_p);
tree step = NULL_TREE;
- tree scev, init, val, var, setstmt;
+ tree scev, init, val, var;
+ gimple setstmt;
struct tree_map *h, in;
void **loc;
@@ -2098,12 +2101,12 @@ replace_uses_equiv_to_x_with_y (struct loop *loop, tree stmt, tree x,
which sets Y. */
var = create_tmp_var (TREE_TYPE (use), "perfecttmp");
add_referenced_var (var);
- val = force_gimple_operand_bsi (firstbsi, val, false, NULL,
- true, BSI_SAME_STMT);
- setstmt = build_gimple_modify_stmt (var, val);
+ val = force_gimple_operand_gsi (firstbsi, val, false, NULL,
+ true, GSI_SAME_STMT);
+ setstmt = gimple_build_assign (var, val);
var = make_ssa_name (var, setstmt);
- GIMPLE_STMT_OPERAND (setstmt, 0) = var;
- bsi_insert_before (firstbsi, setstmt, BSI_SAME_STMT);
+ gimple_assign_set_lhs (setstmt, var);
+ gsi_insert_before (firstbsi, setstmt, GSI_SAME_STMT);
update_stmt (setstmt);
SET_USE (use_p, var);
h = GGC_NEW (struct tree_map);
@@ -2119,12 +2122,11 @@ replace_uses_equiv_to_x_with_y (struct loop *loop, tree stmt, tree x,
/* Return true if STMT is an exit PHI for LOOP */
static bool
-exit_phi_for_loop_p (struct loop *loop, tree stmt)
+exit_phi_for_loop_p (struct loop *loop, gimple stmt)
{
-
- if (TREE_CODE (stmt) != PHI_NODE
- || PHI_NUM_ARGS (stmt) != 1
- || bb_for_stmt (stmt) != single_exit (loop)->dest)
+ if (gimple_code (stmt) != GIMPLE_PHI
+ || gimple_phi_num_args (stmt) != 1
+ || gimple_bb (stmt) != single_exit (loop)->dest)
return false;
return true;
@@ -2134,21 +2136,21 @@ exit_phi_for_loop_p (struct loop *loop, tree stmt)
copying it to the beginning of that loop and changing the uses. */
static bool
-can_put_in_inner_loop (struct loop *inner, tree stmt)
+can_put_in_inner_loop (struct loop *inner, gimple stmt)
{
imm_use_iterator imm_iter;
use_operand_p use_p;
- gcc_assert (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT);
+ gcc_assert (is_gimple_assign (stmt));
if (!ZERO_SSA_OPERANDS (stmt, SSA_OP_ALL_VIRTUALS)
- || !expr_invariant_in_loop_p (inner, GIMPLE_STMT_OPERAND (stmt, 1)))
+ || !stmt_invariant_in_loop_p (inner, stmt))
return false;
- FOR_EACH_IMM_USE_FAST (use_p, imm_iter, GIMPLE_STMT_OPERAND (stmt, 0))
+ FOR_EACH_IMM_USE_FAST (use_p, imm_iter, gimple_assign_lhs (stmt))
{
if (!exit_phi_for_loop_p (inner, USE_STMT (use_p)))
{
- basic_block immbb = bb_for_stmt (USE_STMT (use_p));
+ basic_block immbb = gimple_bb (USE_STMT (use_p));
if (!flow_bb_inside_loop_p (inner, immbb))
return false;
@@ -2158,8 +2160,9 @@ can_put_in_inner_loop (struct loop *inner, tree stmt)
}
/* Return true if STMT can be put *after* the inner loop of LOOP. */
+
static bool
-can_put_after_inner_loop (struct loop *loop, tree stmt)
+can_put_after_inner_loop (struct loop *loop, gimple stmt)
{
imm_use_iterator imm_iter;
use_operand_p use_p;
@@ -2167,11 +2170,11 @@ can_put_after_inner_loop (struct loop *loop, tree stmt)
if (!ZERO_SSA_OPERANDS (stmt, SSA_OP_ALL_VIRTUALS))
return false;
- FOR_EACH_IMM_USE_FAST (use_p, imm_iter, GIMPLE_STMT_OPERAND (stmt, 0))
+ FOR_EACH_IMM_USE_FAST (use_p, imm_iter, gimple_assign_lhs (stmt))
{
if (!exit_phi_for_loop_p (loop, USE_STMT (use_p)))
{
- basic_block immbb = bb_for_stmt (USE_STMT (use_p));
+ basic_block immbb = gimple_bb (USE_STMT (use_p));
if (!dominated_by_p (CDI_DOMINATORS,
immbb,
@@ -2211,81 +2214,77 @@ can_duplicate_iv (tree iv, struct loop *loop)
it has better cache behavior. */
static bool
-cannot_convert_modify_to_perfect_nest (tree stmt, struct loop *loop)
+cannot_convert_modify_to_perfect_nest (gimple stmt, struct loop *loop)
{
-
use_operand_p use_a, use_b;
imm_use_iterator imm_iter;
ssa_op_iter op_iter, op_iter1;
- tree op0 = GIMPLE_STMT_OPERAND (stmt, 0);
+ tree op0 = gimple_assign_lhs (stmt);
/* The statement should not define a variable used in the inner
loop. */
if (TREE_CODE (op0) == SSA_NAME
&& !can_duplicate_iv (op0, loop))
FOR_EACH_IMM_USE_FAST (use_a, imm_iter, op0)
- if (bb_for_stmt (USE_STMT (use_a))->loop_father
- == loop->inner)
+ if (gimple_bb (USE_STMT (use_a))->loop_father == loop->inner)
return true;
FOR_EACH_SSA_USE_OPERAND (use_a, stmt, op_iter, SSA_OP_USE)
{
- tree node, op = USE_FROM_PTR (use_a);
+ gimple node;
+ tree op = USE_FROM_PTR (use_a);
/* The variables should not be used in both loops. */
if (!can_duplicate_iv (op, loop))
FOR_EACH_IMM_USE_FAST (use_b, imm_iter, op)
- if (bb_for_stmt (USE_STMT (use_b))->loop_father
- == loop->inner)
+ if (gimple_bb (USE_STMT (use_b))->loop_father == loop->inner)
return true;
/* The statement should not use the value of a scalar that was
modified in the loop. */
node = SSA_NAME_DEF_STMT (op);
- if (TREE_CODE (node) == PHI_NODE)
+ if (gimple_code (node) == GIMPLE_PHI)
FOR_EACH_PHI_ARG (use_b, node, op_iter1, SSA_OP_USE)
- {
- tree arg = USE_FROM_PTR (use_b);
+ {
+ tree arg = USE_FROM_PTR (use_b);
- if (TREE_CODE (arg) == SSA_NAME)
- {
- tree arg_stmt = SSA_NAME_DEF_STMT (arg);
+ if (TREE_CODE (arg) == SSA_NAME)
+ {
+ gimple arg_stmt = SSA_NAME_DEF_STMT (arg);
- if (bb_for_stmt (arg_stmt)
- && (bb_for_stmt (arg_stmt)->loop_father
- == loop->inner))
- return true;
- }
- }
+ if (gimple_bb (arg_stmt)
+ && (gimple_bb (arg_stmt)->loop_father == loop->inner))
+ return true;
+ }
+ }
}
return false;
}
-
/* Return true when BB contains statements that can harm the transform
to a perfect loop nest. */
static bool
cannot_convert_bb_to_perfect_nest (basic_block bb, struct loop *loop)
{
- block_stmt_iterator bsi;
- tree exit_condition = get_loop_exit_condition (loop);
+ gimple_stmt_iterator bsi;
+ gimple exit_condition = get_loop_exit_condition (loop);
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
{
- tree stmt = bsi_stmt (bsi);
+ gimple stmt = gsi_stmt (bsi);
if (stmt == exit_condition
|| not_interesting_stmt (stmt)
|| stmt_is_bumper_for_loop (loop, stmt))
continue;
- if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT)
+ if (is_gimple_assign (stmt))
{
if (cannot_convert_modify_to_perfect_nest (stmt, loop))
return true;
- if (can_duplicate_iv (GIMPLE_STMT_OPERAND (stmt, 0), loop))
+ if (can_duplicate_iv (gimple_assign_lhs (stmt), loop))
continue;
if (can_put_in_inner_loop (loop->inner, stmt)
@@ -2298,7 +2297,7 @@ cannot_convert_bb_to_perfect_nest (basic_block bb, struct loop *loop)
right now. This test ensures that the statement comes
completely *after* the inner loop. */
if (!dominated_by_p (CDI_DOMINATORS,
- bb_for_stmt (stmt),
+ gimple_bb (stmt),
loop->inner->header))
return true;
}
@@ -2306,6 +2305,7 @@ cannot_convert_bb_to_perfect_nest (basic_block bb, struct loop *loop)
return false;
}
+
/* Return TRUE if LOOP is an imperfect nest that we can convert to a
perfect one. At the moment, we only handle imperfect nests of
depth 2, where all of the statements occur after the inner loop. */
@@ -2314,8 +2314,8 @@ static bool
can_convert_to_perfect_nest (struct loop *loop)
{
basic_block *bbs;
- tree phi;
size_t i;
+ gimple_stmt_iterator si;
/* Can't handle triply nested+ loops yet. */
if (!loop->inner || loop->inner->inner)
@@ -2329,8 +2329,10 @@ can_convert_to_perfect_nest (struct loop *loop)
/* We also need to make sure the loop exit only has simple copy phis in it,
otherwise we don't know how to transform it into a perfect nest. */
- for (phi = phi_nodes (single_exit (loop)->dest); phi; phi = PHI_CHAIN (phi))
- if (PHI_NUM_ARGS (phi) != 1)
+ for (si = gsi_start_phis (single_exit (loop)->dest);
+ !gsi_end_p (si);
+ gsi_next (&si))
+ if (gimple_phi_num_args (gsi_stmt (si)) != 1)
goto fail;
free (bbs);
@@ -2385,17 +2387,17 @@ perfect_nestify (struct loop *loop,
VEC(tree,heap) *loopivs)
{
basic_block *bbs;
- tree exit_condition;
- tree cond_stmt;
+ gimple exit_condition;
+ gimple cond_stmt;
basic_block preheaderbb, headerbb, bodybb, latchbb, olddest;
int i;
- block_stmt_iterator bsi, firstbsi;
+ gimple_stmt_iterator bsi, firstbsi;
bool insert_after;
edge e;
struct loop *newloop;
- tree phi;
+ gimple phi;
tree uboundvar;
- tree stmt;
+ gimple stmt;
tree oldivvar, ivvar, ivvarinced;
VEC(tree,heap) *phis = NULL;
htab_t replacements = NULL;
@@ -2406,8 +2408,9 @@ perfect_nestify (struct loop *loop,
headerbb = create_empty_bb (EXIT_BLOCK_PTR->prev_bb);
/* Push the exit phi nodes that we are moving. */
- for (phi = phi_nodes (olddest); phi; phi = PHI_CHAIN (phi))
+ for (bsi = gsi_start_phis (olddest); !gsi_end_p (bsi); gsi_next (&bsi))
{
+ phi = gsi_stmt (bsi);
VEC_reserve (tree, heap, phis, 2);
VEC_quick_push (tree, phis, PHI_RESULT (phi));
VEC_quick_push (tree, phis, PHI_ARG_DEF (phi, 0));
@@ -2415,8 +2418,8 @@ perfect_nestify (struct loop *loop,
e = redirect_edge_and_branch (single_succ_edge (preheaderbb), headerbb);
/* Remove the exit phis from the old basic block. */
- while (phi_nodes (olddest) != NULL)
- remove_phi_node (phi_nodes (olddest), NULL, false);
+ for (bsi = gsi_start_phis (olddest); !gsi_end_p (bsi); )
+ remove_phi_node (&bsi, false);
/* and add them back to the new basic block. */
while (VEC_length (tree, phis) != 0)
@@ -2434,13 +2437,10 @@ perfect_nestify (struct loop *loop,
bodybb = create_empty_bb (EXIT_BLOCK_PTR->prev_bb);
latchbb = create_empty_bb (EXIT_BLOCK_PTR->prev_bb);
make_edge (headerbb, bodybb, EDGE_FALLTHRU);
- cond_stmt = build3 (COND_EXPR, void_type_node,
- build2 (NE_EXPR, boolean_type_node,
- integer_one_node,
- integer_zero_node),
- NULL_TREE, NULL_TREE);
- bsi = bsi_start (bodybb);
- bsi_insert_after (&bsi, cond_stmt, BSI_NEW_STMT);
+ cond_stmt = gimple_build_cond (NE_EXPR, integer_one_node, integer_zero_node,
+ NULL_TREE, NULL_TREE);
+ bsi = gsi_start_bb (bodybb);
+ gsi_insert_after (&bsi, cond_stmt, GSI_NEW_STMT);
e = make_edge (bodybb, olddest, EDGE_FALSE_VALUE);
make_edge (bodybb, latchbb, EDGE_TRUE_VALUE);
make_edge (latchbb, headerbb, EDGE_FALLTHRU);
@@ -2474,19 +2474,16 @@ perfect_nestify (struct loop *loop,
exit_condition = get_loop_exit_condition (newloop);
uboundvar = create_tmp_var (integer_type_node, "uboundvar");
add_referenced_var (uboundvar);
- stmt = build_gimple_modify_stmt (uboundvar, VEC_index (tree, ubounds, 0));
+ stmt = gimple_build_assign (uboundvar, VEC_index (tree, ubounds, 0));
uboundvar = make_ssa_name (uboundvar, stmt);
- GIMPLE_STMT_OPERAND (stmt, 0) = uboundvar;
+ gimple_assign_set_lhs (stmt, uboundvar);
if (insert_after)
- bsi_insert_after (&bsi, stmt, BSI_SAME_STMT);
+ gsi_insert_after (&bsi, stmt, GSI_SAME_STMT);
else
- bsi_insert_before (&bsi, stmt, BSI_SAME_STMT);
+ gsi_insert_before (&bsi, stmt, GSI_SAME_STMT);
update_stmt (stmt);
- COND_EXPR_COND (exit_condition) = build2 (GE_EXPR,
- boolean_type_node,
- uboundvar,
- ivvarinced);
+ gimple_cond_set_condition (exit_condition, GE_EXPR, uboundvar, ivvarinced);
update_stmt (exit_condition);
replacements = htab_create_ggc (20, tree_map_hash,
tree_map_eq, NULL);
@@ -2494,10 +2491,10 @@ perfect_nestify (struct loop *loop,
/* Now move the statements, and replace the induction variable in the moved
statements with the correct loop induction variable. */
oldivvar = VEC_index (tree, loopivs, 0);
- firstbsi = bsi_start (bodybb);
+ firstbsi = gsi_start_bb (bodybb);
for (i = loop->num_nodes - 1; i >= 0 ; i--)
{
- block_stmt_iterator tobsi = bsi_last (bodybb);
+ gimple_stmt_iterator tobsi = gsi_last_bb (bodybb);
if (bbs[i]->loop_father == loop)
{
/* If this is true, we are *before* the inner loop.
@@ -2513,22 +2510,22 @@ perfect_nestify (struct loop *loop,
if (dominated_by_p (CDI_DOMINATORS, loop->inner->header, bbs[i]))
{
- block_stmt_iterator header_bsi
- = bsi_after_labels (loop->inner->header);
+ gimple_stmt_iterator header_bsi
+ = gsi_after_labels (loop->inner->header);
- for (bsi = bsi_start (bbs[i]); !bsi_end_p (bsi);)
+ for (bsi = gsi_start_bb (bbs[i]); !gsi_end_p (bsi);)
{
- tree stmt = bsi_stmt (bsi);
+ gimple stmt = gsi_stmt (bsi);
if (stmt == exit_condition
|| not_interesting_stmt (stmt)
|| stmt_is_bumper_for_loop (loop, stmt))
{
- bsi_next (&bsi);
+ gsi_next (&bsi);
continue;
}
- bsi_move_before (&bsi, &header_bsi);
+ gsi_move_before (&bsi, &header_bsi);
}
}
else
@@ -2536,16 +2533,17 @@ perfect_nestify (struct loop *loop,
/* Note that the bsi only needs to be explicitly incremented
when we don't move something, since it is automatically
incremented when we do. */
- for (bsi = bsi_start (bbs[i]); !bsi_end_p (bsi);)
+ for (bsi = gsi_start_bb (bbs[i]); !gsi_end_p (bsi);)
{
ssa_op_iter i;
- tree n, stmt = bsi_stmt (bsi);
+ tree n;
+ gimple stmt = gsi_stmt (bsi);
if (stmt == exit_condition
|| not_interesting_stmt (stmt)
|| stmt_is_bumper_for_loop (loop, stmt))
{
- bsi_next (&bsi);
+ gsi_next (&bsi);
continue;
}
@@ -2553,7 +2551,7 @@ perfect_nestify (struct loop *loop,
(loop, stmt, oldivvar, VEC_index (int, steps, 0), ivvar,
VEC_index (tree, lbounds, 0), replacements, &firstbsi);
- bsi_move_before (&bsi, &tobsi);
+ gsi_move_before (&bsi, &tobsi);
/* If the statement has any virtual operands, they may
need to be rewired because the original loop may
@@ -2793,7 +2791,7 @@ build_access_matrix (data_reference_p data_reference,
{
struct access_matrix *am = GGC_NEW (struct access_matrix);
unsigned i, ndim = DR_NUM_DIMENSIONS (data_reference);
- struct loop *loop = bb_for_stmt (DR_STMT (data_reference))->loop_father;
+ struct loop *loop = gimple_bb (DR_STMT (data_reference))->loop_father;
struct loop *loop_nest = get_loop (loop_nest_num);
unsigned nivs = loop_depth (loop) - loop_depth (loop_nest) + 1;
unsigned lambda_nb_columns;
diff --git a/gcc/lambda-mat.c b/gcc/lambda-mat.c
index 852f812f16a..36110a72103 100644
--- a/gcc/lambda-mat.c
+++ b/gcc/lambda-mat.c
@@ -24,6 +24,7 @@ along with GCC; see the file COPYING3. If not see
#include "tm.h"
#include "ggc.h"
#include "tree.h"
+#include "tree-flow.h"
#include "lambda.h"
static void lambda_matrix_get_column (lambda_matrix, int, int,
diff --git a/gcc/lambda-trans.c b/gcc/lambda-trans.c
index c5872d5cc37..e81a71cd53e 100644
--- a/gcc/lambda-trans.c
+++ b/gcc/lambda-trans.c
@@ -25,6 +25,7 @@ along with GCC; see the file COPYING3. If not see
#include "ggc.h"
#include "tree.h"
#include "target.h"
+#include "tree-flow.h"
#include "lambda.h"
/* Allocate a new transformation matrix. */
diff --git a/gcc/lambda.h b/gcc/lambda.h
index 40e8502973c..66fbac74bd5 100644
--- a/gcc/lambda.h
+++ b/gcc/lambda.h
@@ -209,10 +209,10 @@ lambda_loopnest gcc_loopnest_to_lambda_loopnest (struct loop *,
struct obstack *);
void lambda_loopnest_to_gcc_loopnest (struct loop *,
VEC(tree,heap) *, VEC(tree,heap) *,
- VEC(tree,heap) **,
+ VEC(gimple,heap) **,
lambda_loopnest, lambda_trans_matrix,
struct obstack *);
-void remove_iv (tree);
+void remove_iv (gimple);
static inline void lambda_vector_negate (lambda_vector, lambda_vector, int);
static inline void lambda_vector_mult_const (lambda_vector, lambda_vector, int, int);
diff --git a/gcc/langhooks-def.h b/gcc/langhooks-def.h
index dd4916caff6..4cab70b6149 100644
--- a/gcc/langhooks-def.h
+++ b/gcc/langhooks-def.h
@@ -73,7 +73,7 @@ extern tree lhd_callgraph_analyze_expr (tree *, int *);
/* Declarations for tree gimplification hooks. */
-extern int lhd_gimplify_expr (tree *, tree *, tree *);
+extern int lhd_gimplify_expr (tree *, gimple_seq *, gimple_seq *);
extern enum omp_clause_default_kind lhd_omp_predetermined_sharing (tree);
extern tree lhd_omp_assignment (tree, tree, tree);
struct gimplify_omp_ctx;
diff --git a/gcc/langhooks.c b/gcc/langhooks.c
index e2460473f54..30e5bfa9f61 100644
--- a/gcc/langhooks.c
+++ b/gcc/langhooks.c
@@ -27,7 +27,7 @@ along with GCC; see the file COPYING3. If not see
#include "toplev.h"
#include "tree.h"
#include "tree-inline.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "rtl.h"
#include "insn-config.h"
#include "integrate.h"
@@ -133,7 +133,7 @@ lhd_warn_unused_global_decl (const_tree decl)
/* This is what used to exist in check_global_declarations. Probably
not many of these actually apply to non-C languages. */
- if (TREE_CODE (decl) == FUNCTION_DECL && DECL_INLINE (decl))
+ if (TREE_CODE (decl) == FUNCTION_DECL && DECL_DECLARED_INLINE_P (decl))
return false;
if (TREE_CODE (decl) == VAR_DECL && TREE_READONLY (decl))
return false;
@@ -303,8 +303,9 @@ lhd_expr_size (const_tree exp)
/* lang_hooks.gimplify_expr re-writes *EXPR_P into GIMPLE form. */
int
-lhd_gimplify_expr (tree *expr_p ATTRIBUTE_UNUSED, tree *pre_p ATTRIBUTE_UNUSED,
- tree *post_p ATTRIBUTE_UNUSED)
+lhd_gimplify_expr (tree *expr_p ATTRIBUTE_UNUSED,
+ gimple_seq *pre_p ATTRIBUTE_UNUSED,
+ gimple_seq *post_p ATTRIBUTE_UNUSED)
{
return GS_UNHANDLED;
}
@@ -527,7 +528,7 @@ lhd_omp_predetermined_sharing (tree decl ATTRIBUTE_UNUSED)
tree
lhd_omp_assignment (tree clause ATTRIBUTE_UNUSED, tree dst, tree src)
{
- return build_gimple_modify_stmt (dst, src);
+ return build2 (MODIFY_EXPR, TREE_TYPE (dst), dst, src);
}
/* Register language specific type size variables as potentially OpenMP
diff --git a/gcc/langhooks.h b/gcc/langhooks.h
index 1f64cf18d52..6a23a313f35 100644
--- a/gcc/langhooks.h
+++ b/gcc/langhooks.h
@@ -401,7 +401,7 @@ struct lang_hooks
/* Perform language-specific gimplification on the argument. Returns an
enum gimplify_status, though we can't see that type here. */
- int (*gimplify_expr) (tree *, tree *, tree *);
+ int (*gimplify_expr) (tree *, gimple_seq *, gimple_seq *);
/* Fold an OBJ_TYPE_REF expression to the address of a function.
KNOWN_TYPE carries the true type of the OBJ_TYPE_REF_OBJECT. */
diff --git a/gcc/libada-mk.in b/gcc/libada-mk.in
deleted file mode 100644
index 2b795d6a693..00000000000
--- a/gcc/libada-mk.in
+++ /dev/null
@@ -1,29 +0,0 @@
-# Copyright 2004, 2007 Free Software Foundation, Inc.
-
-#This file is part of GCC.
-
-#GCC is free software; you can redistribute it and/or modify
-#it under the terms of the GNU General Public License as published by
-#the Free Software Foundation; either version 3, or (at your option)
-#any later version.
-
-#GCC is distributed in the hope that it will be useful,
-#but WITHOUT ANY WARRANTY; without even the implied warranty of
-#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-#GNU General Public License for more details.
-
-#You should have received a copy of the GNU General Public License
-#along with GCC; see the file COPYING3. If not see
-#<http://www.gnu.org/licenses/>.
-
-# GCC's Makefile fragment for libada.
-# libada needs some information from the GCC configure file at the moment,
-# and this exists to transfer that information in as clean a way as possible.
-
-exeext=@host_exeext@
-libdir=@libdir@
-NOCOMMON_FLAG=@nocommon_flag@
-WARN_CFLAGS=@warn_cflags@
-gcc_tmake_file=@tmake_file@
-gcc_xmake_file=@xmake_file@
-host_cc_for_libada=@host_cc_for_libada@
diff --git a/gcc/local-alloc.c b/gcc/local-alloc.c
index e1c8e47cdc8..98b67700808 100644
--- a/gcc/local-alloc.c
+++ b/gcc/local-alloc.c
@@ -1984,11 +1984,11 @@ combine_regs (rtx usedreg, rtx setreg, int may_save_copy, int insn_number,
True if REG's reg class either contains or is contained in CLASS. */
static int
-reg_meets_class_p (int reg, enum reg_class class)
+reg_meets_class_p (int reg, enum reg_class rclass)
{
- enum reg_class rclass = reg_preferred_class (reg);
- return (reg_class_subset_p (rclass, class)
- || reg_class_subset_p (class, rclass));
+ enum reg_class rclass2 = reg_preferred_class (reg);
+ return (reg_class_subset_p (rclass2, rclass)
+ || reg_class_subset_p (rclass, rclass2));
}
/* Update the class of QTYNO assuming that REG is being tied to it. */
@@ -2139,7 +2139,7 @@ wipe_dead_reg (rtx reg, int output_p)
register is available. If not, return -1. */
static int
-find_free_reg (enum reg_class class, enum machine_mode mode, int qtyno,
+find_free_reg (enum reg_class rclass, enum machine_mode mode, int qtyno,
int accept_call_clobbered, int just_try_suggested,
int born_index, int dead_index)
{
@@ -2171,7 +2171,7 @@ find_free_reg (enum reg_class class, enum machine_mode mode, int qtyno,
for (ins = born_index; ins < dead_index; ins++)
IOR_HARD_REG_SET (used, regs_live_at[ins]);
- IOR_COMPL_HARD_REG_SET (used, reg_class_contents[(int) class]);
+ IOR_COMPL_HARD_REG_SET (used, reg_class_contents[(int) rclass]);
/* Don't use the frame pointer reg in local-alloc even if
we may omit the frame pointer, because if we do that and then we
@@ -2256,7 +2256,7 @@ find_free_reg (enum reg_class class, enum machine_mode mode, int qtyno,
{
/* Don't try the copy-suggested regs again. */
qty_phys_num_copy_sugg[qtyno] = 0;
- return find_free_reg (class, mode, qtyno, accept_call_clobbered, 1,
+ return find_free_reg (rclass, mode, qtyno, accept_call_clobbered, 1,
born_index, dead_index);
}
@@ -2274,7 +2274,7 @@ find_free_reg (enum reg_class class, enum machine_mode mode, int qtyno,
optimize_size ? qty[qtyno].n_calls_crossed
: qty[qtyno].freq_calls_crossed))
{
- i = find_free_reg (class, mode, qtyno, 1, 0, born_index, dead_index);
+ i = find_free_reg (rclass, mode, qtyno, 1, 0, born_index, dead_index);
if (i >= 0)
caller_save_needed = 1;
return i;
diff --git a/gcc/machmode.h b/gcc/machmode.h
index 440e7bb1899..8db9f75b573 100644
--- a/gcc/machmode.h
+++ b/gcc/machmode.h
@@ -202,7 +202,7 @@ extern const unsigned HOST_WIDE_INT mode_mask_array[NUM_MACHINE_MODES];
/* Return the mode of the inner elements in a vector. */
extern const unsigned char mode_inner[NUM_MACHINE_MODES];
-#define GET_MODE_INNER(MODE) mode_inner[MODE]
+#define GET_MODE_INNER(MODE) ((enum machine_mode) mode_inner[MODE])
/* Get the size in bytes of the basic parts of an object of mode MODE. */
diff --git a/gcc/matrix-reorg.c b/gcc/matrix-reorg.c
index 33bb0b4e8f4..66145518f53 100644
--- a/gcc/matrix-reorg.c
+++ b/gcc/matrix-reorg.c
@@ -107,9 +107,7 @@ along with GCC; see the file COPYING3. If not see
Both optimizations are described in the paper "Matrix flattening and
transposing in GCC" which was presented in GCC summit 2006.
- http://www.gccsummit.org/2006/2006-GCC-Summit-Proceedings.pdf
-
- */
+ http://www.gccsummit.org/2006/2006-GCC-Summit-Proceedings.pdf. */
#include "config.h"
#include "system.h"
@@ -145,8 +143,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-chrec.h"
#include "tree-scalar-evolution.h"
-/*
- We need to collect a lot of data from the original malloc,
+/* We need to collect a lot of data from the original malloc,
particularly as the gimplifier has converted:
orig_var = (struct_type *) malloc (x * sizeof (struct_type *));
@@ -164,11 +161,14 @@ along with GCC; see the file COPYING3. If not see
struct malloc_call_data
{
- tree call_stmt; /* Tree for "T4 = malloc (T3);" */
+ gimple call_stmt; /* Tree for "T4 = malloc (T3);" */
tree size_var; /* Var decl for T3. */
tree malloc_size; /* Tree for "<constant>", the rhs assigned to T3. */
};
+static tree can_calculate_expr_before_stmt (tree, sbitmap);
+static tree can_calculate_stmt_before_stmt (gimple, sbitmap);
+
/* The front end of the compiler, when parsing statements of the form:
var = (type_cast) malloc (sizeof (type));
@@ -188,24 +188,20 @@ struct malloc_call_data
need to find the rest of the variables/statements on our own. That
is what the following function does. */
static void
-collect_data_for_malloc_call (tree stmt, struct malloc_call_data *m_data)
+collect_data_for_malloc_call (gimple stmt, struct malloc_call_data *m_data)
{
tree size_var = NULL;
tree malloc_fn_decl;
- tree tmp;
tree arg1;
- gcc_assert (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT);
+ gcc_assert (is_gimple_call (stmt));
- tmp = get_call_expr_in (stmt);
- malloc_fn_decl = CALL_EXPR_FN (tmp);
- if (TREE_CODE (malloc_fn_decl) != ADDR_EXPR
- || TREE_CODE (TREE_OPERAND (malloc_fn_decl, 0)) != FUNCTION_DECL
- || DECL_FUNCTION_CODE (TREE_OPERAND (malloc_fn_decl, 0)) !=
- BUILT_IN_MALLOC)
+ malloc_fn_decl = gimple_call_fndecl (stmt);
+ if (malloc_fn_decl == NULL
+ || DECL_FUNCTION_CODE (malloc_fn_decl) != BUILT_IN_MALLOC)
return;
- arg1 = CALL_EXPR_ARG (tmp, 0);
+ arg1 = gimple_call_arg (stmt, 0);
size_var = arg1;
m_data->call_stmt = stmt;
@@ -224,7 +220,7 @@ collect_data_for_malloc_call (tree stmt, struct malloc_call_data *m_data)
struct access_site_info
{
/* The statement (INDIRECT_REF or POINTER_PLUS_EXPR). */
- tree stmt;
+ gimple stmt;
/* In case of POINTER_PLUS_EXPR, what is the offset. */
tree offset;
@@ -263,7 +259,7 @@ struct matrix_info
0 to ACTUAL_DIM - k escapes. */
int min_indirect_level_escape;
- tree min_indirect_level_escape_stmt;
+ gimple min_indirect_level_escape_stmt;
/* Is the matrix transposed. */
bool is_transposed_p;
@@ -272,7 +268,7 @@ struct matrix_info
We can use NUM_DIMS as the upper bound and allocate the array
once with this number of elements and no need to use realloc and
MAX_MALLOCED_LEVEL. */
- tree *malloc_for_level;
+ gimple *malloc_for_level;
int max_malloced_level;
@@ -283,7 +279,7 @@ struct matrix_info
/* The calls to free for each level of indirection. */
struct free_info
{
- tree stmt;
+ gimple stmt;
tree func;
} *free_stmts;
@@ -323,7 +319,7 @@ struct matrix_info
struct matrix_access_phi_node
{
- tree phi;
+ gimple phi;
int indirection_level;
};
@@ -409,28 +405,20 @@ mtt_info_eq (const void *mtt1, const void *mtt2)
return false;
}
-/* Return the inner most tree that is not a cast. */
-static tree
-get_inner_of_cast_expr (tree t)
-{
- while (CONVERT_EXPR_P (t)
- || TREE_CODE (t) == VIEW_CONVERT_EXPR)
- t = TREE_OPERAND (t, 0);
-
- return t;
-}
-
/* Return false if STMT may contain a vector expression.
In this situation, all matrices should not be flattened. */
static bool
-may_flatten_matrices_1 (tree stmt)
+may_flatten_matrices_1 (gimple stmt)
{
tree t;
- switch (TREE_CODE (stmt))
+ switch (gimple_code (stmt))
{
- case GIMPLE_MODIFY_STMT:
- t = GIMPLE_STMT_OPERAND (stmt, 1);
+ case GIMPLE_ASSIGN:
+ if (!gimple_assign_cast_p (stmt))
+ return true;
+
+ t = gimple_assign_rhs1 (stmt);
while (CONVERT_EXPR_P (t))
{
if (TREE_TYPE (t) && POINTER_TYPE_P (TREE_TYPE (t)))
@@ -451,7 +439,7 @@ may_flatten_matrices_1 (tree stmt)
t = TREE_OPERAND (t, 0);
}
break;
- case ASM_EXPR:
+ case GIMPLE_ASM:
/* Asm code could contain vector operations. */
return false;
break;
@@ -469,15 +457,15 @@ may_flatten_matrices (struct cgraph_node *node)
tree decl;
struct function *func;
basic_block bb;
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
decl = node->decl;
if (node->analyzed)
{
func = DECL_STRUCT_FUNCTION (decl);
FOR_EACH_BB_FN (bb, func)
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
- if (!may_flatten_matrices_1 (bsi_stmt (bsi)))
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ if (!may_flatten_matrices_1 (gsi_stmt (gsi)))
return false;
}
return true;
@@ -598,7 +586,7 @@ find_matrices_decl (void)
/* Mark that the matrix MI escapes at level L. */
static void
-mark_min_matrix_escape_level (struct matrix_info *mi, int l, tree s)
+mark_min_matrix_escape_level (struct matrix_info *mi, int l, gimple s)
{
if (mi->min_indirect_level_escape == -1
|| (mi->min_indirect_level_escape > l))
@@ -611,19 +599,13 @@ mark_min_matrix_escape_level (struct matrix_info *mi, int l, tree s)
/* Find if the SSA variable is accessed inside the
tree and record the tree containing it.
The only relevant uses are the case of SSA_NAME, or SSA inside
- INDIRECT_REF, CALL_EXPR, PLUS_EXPR, POINTER_PLUS_EXPR, MULT_EXPR. */
+ INDIRECT_REF, PLUS_EXPR, POINTER_PLUS_EXPR, MULT_EXPR. */
static void
ssa_accessed_in_tree (tree t, struct ssa_acc_in_tree *a)
{
- tree call, decl;
- tree arg;
- call_expr_arg_iterator iter;
-
a->t_code = TREE_CODE (t);
switch (a->t_code)
{
- tree op1, op2;
-
case SSA_NAME:
if (t == a->ssa_var)
a->var_found = true;
@@ -633,24 +615,59 @@ ssa_accessed_in_tree (tree t, struct ssa_acc_in_tree *a)
&& TREE_OPERAND (t, 0) == a->ssa_var)
a->var_found = true;
break;
- case CALL_EXPR:
- FOR_EACH_CALL_EXPR_ARG (arg, iter, t)
- {
- if (arg == a->ssa_var)
- {
- a->var_found = true;
- call = get_call_expr_in (t);
- if (call && (decl = get_callee_fndecl (call)))
- a->t_tree = decl;
- break;
- }
- }
+ default:
+ break;
+ }
+}
+
+/* Find if the SSA variable is accessed on the right hand side of
+ gimple call STMT. */
+
+static void
+ssa_accessed_in_call_rhs (gimple stmt, struct ssa_acc_in_tree *a)
+{
+ tree decl;
+ tree arg;
+ size_t i;
+
+ a->t_code = CALL_EXPR;
+ for (i = 0; i < gimple_call_num_args (stmt); i++)
+ {
+ arg = gimple_call_arg (stmt, i);
+ if (arg == a->ssa_var)
+ {
+ a->var_found = true;
+ decl = gimple_call_fndecl (stmt);
+ a->t_tree = decl;
+ break;
+ }
+ }
+}
+
+/* Find if the SSA variable is accessed on the right hand side of
+ gimple assign STMT. */
+
+static void
+ssa_accessed_in_assign_rhs (gimple stmt, struct ssa_acc_in_tree *a)
+{
+
+ a->t_code = gimple_assign_rhs_code (stmt);
+ switch (a->t_code)
+ {
+ tree op1, op2;
+
+ case SSA_NAME:
+ case INDIRECT_REF:
+ case CONVERT_EXPR:
+ case NOP_EXPR:
+ case VIEW_CONVERT_EXPR:
+ ssa_accessed_in_tree (gimple_assign_rhs1 (stmt), a);
break;
case POINTER_PLUS_EXPR:
case PLUS_EXPR:
case MULT_EXPR:
- op1 = TREE_OPERAND (t, 0);
- op2 = TREE_OPERAND (t, 1);
+ op1 = gimple_assign_rhs1 (stmt);
+ op2 = gimple_assign_rhs2 (stmt);
if (op1 == a->ssa_var)
{
@@ -671,7 +688,7 @@ ssa_accessed_in_tree (tree t, struct ssa_acc_in_tree *a)
/* Record the access/allocation site information for matrix MI so we can
handle it later in transformation. */
static void
-record_access_alloc_site_info (struct matrix_info *mi, tree stmt, tree offset,
+record_access_alloc_site_info (struct matrix_info *mi, gimple stmt, tree offset,
tree index, int level, bool is_alloc)
{
struct access_site_info *acc_info;
@@ -698,7 +715,7 @@ record_access_alloc_site_info (struct matrix_info *mi, tree stmt, tree offset,
all the allocation sites could be pre-calculated before the call to
the malloc of level 0 (the main malloc call). */
static void
-add_allocation_site (struct matrix_info *mi, tree stmt, int level)
+add_allocation_site (struct matrix_info *mi, gimple stmt, int level)
{
struct malloc_call_data mcd;
@@ -741,13 +758,13 @@ add_allocation_site (struct matrix_info *mi, tree stmt, int level)
calls like calloc and realloc. */
if (!mi->malloc_for_level)
{
- mi->malloc_for_level = XCNEWVEC (tree, level + 1);
+ mi->malloc_for_level = XCNEWVEC (gimple, level + 1);
mi->max_malloced_level = level + 1;
}
else if (mi->max_malloced_level <= level)
{
mi->malloc_for_level
- = XRESIZEVEC (tree, mi->malloc_for_level, level + 1);
+ = XRESIZEVEC (gimple, mi->malloc_for_level, level + 1);
/* Zero the newly allocated items. */
memset (&(mi->malloc_for_level[mi->max_malloced_level + 1]),
@@ -770,79 +787,74 @@ add_allocation_site (struct matrix_info *mi, tree stmt, int level)
Return if STMT is related to an allocation site. */
static void
-analyze_matrix_allocation_site (struct matrix_info *mi, tree stmt,
+analyze_matrix_allocation_site (struct matrix_info *mi, gimple stmt,
int level, sbitmap visited)
{
- if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT)
+ if (gimple_assign_copy_p (stmt) || gimple_assign_cast_p (stmt))
{
- tree rhs = GIMPLE_STMT_OPERAND (stmt, 1);
+ tree rhs = gimple_assign_rhs1 (stmt);
- rhs = get_inner_of_cast_expr (rhs);
if (TREE_CODE (rhs) == SSA_NAME)
{
- tree def = SSA_NAME_DEF_STMT (rhs);
+ gimple def = SSA_NAME_DEF_STMT (rhs);
analyze_matrix_allocation_site (mi, def, level, visited);
return;
}
+ /* If we are back to the original matrix variable then we
+ are sure that this is analyzed as an access site. */
+ else if (rhs == mi->decl)
+ return;
+ }
+ /* A result of call to malloc. */
+ else if (is_gimple_call (stmt))
+ {
+ int call_flags = gimple_call_flags (stmt);
- /* A result of call to malloc. */
- else if (TREE_CODE (rhs) == CALL_EXPR)
+ if (!(call_flags & ECF_MALLOC))
{
- int call_flags = call_expr_flags (rhs);
+ mark_min_matrix_escape_level (mi, level, stmt);
+ return;
+ }
+ else
+ {
+ tree malloc_fn_decl;
+ const char *malloc_fname;
- if (!(call_flags & ECF_MALLOC))
+ malloc_fn_decl = gimple_call_fndecl (stmt);
+ if (malloc_fn_decl == NULL_TREE)
{
mark_min_matrix_escape_level (mi, level, stmt);
return;
}
- else
- {
- tree malloc_fn_decl;
- const char *malloc_fname;
-
- malloc_fn_decl = CALL_EXPR_FN (rhs);
- if (TREE_CODE (malloc_fn_decl) != ADDR_EXPR
- || TREE_CODE (TREE_OPERAND (malloc_fn_decl, 0)) !=
- FUNCTION_DECL)
- {
- mark_min_matrix_escape_level (mi, level, stmt);
- return;
- }
- malloc_fn_decl = TREE_OPERAND (malloc_fn_decl, 0);
- malloc_fname = IDENTIFIER_POINTER (DECL_NAME (malloc_fn_decl));
- if (DECL_FUNCTION_CODE (malloc_fn_decl) != BUILT_IN_MALLOC)
- {
- if (dump_file)
- fprintf (dump_file,
- "Matrix %s is an argument to function %s\n",
- get_name (mi->decl), get_name (malloc_fn_decl));
- mark_min_matrix_escape_level (mi, level, stmt);
- return;
- }
- }
- /* This is a call to malloc of level 'level'.
- mi->max_malloced_level-1 == level means that we've
- seen a malloc statement of level 'level' before.
- If the statement is not the same one that we've
- seen before, then there's another malloc statement
- for the same level, which means that we need to mark
- it escaping. */
- if (mi->malloc_for_level
- && mi->max_malloced_level-1 == level
- && mi->malloc_for_level[level] != stmt)
+ malloc_fname = IDENTIFIER_POINTER (DECL_NAME (malloc_fn_decl));
+ if (DECL_FUNCTION_CODE (malloc_fn_decl) != BUILT_IN_MALLOC)
{
+ if (dump_file)
+ fprintf (dump_file,
+ "Matrix %s is an argument to function %s\n",
+ get_name (mi->decl), get_name (malloc_fn_decl));
mark_min_matrix_escape_level (mi, level, stmt);
return;
}
- else
- add_allocation_site (mi, stmt, level);
+ }
+ /* This is a call to malloc of level 'level'.
+ mi->max_malloced_level-1 == level means that we've
+ seen a malloc statement of level 'level' before.
+ If the statement is not the same one that we've
+ seen before, then there's another malloc statement
+ for the same level, which means that we need to mark
+ it escaping. */
+ if (mi->malloc_for_level
+ && mi->max_malloced_level-1 == level
+ && mi->malloc_for_level[level] != stmt)
+ {
+ mark_min_matrix_escape_level (mi, level, stmt);
return;
}
- /* If we are back to the original matrix variable then we
- are sure that this is analyzed as an access site. */
- else if (rhs == mi->decl)
- return;
+ else
+ add_allocation_site (mi, stmt, level);
+ return;
}
/* Looks like we don't know what is happening in this
statement so be in the safe side and mark it as escaping. */
@@ -910,7 +922,7 @@ analyze_transpose (void **slot, void *data ATTRIBUTE_UNUSED)
for (i = 0; VEC_iterate (access_site_info_p, mi->access_l, i, acc_info);
i++)
{
- if (TREE_CODE (GIMPLE_STMT_OPERAND (acc_info->stmt, 1)) == POINTER_PLUS_EXPR
+ if (gimple_assign_rhs_code (acc_info->stmt) == POINTER_PLUS_EXPR
&& acc_info->level < min_escape_l)
{
loop = loop_containing_stmt (acc_info->stmt);
@@ -930,7 +942,7 @@ analyze_transpose (void **slot, void *data ATTRIBUTE_UNUSED)
{
acc_info->iterated_by_inner_most_loop_p = 1;
mi->dim_hot_level[acc_info->level] +=
- bb_for_stmt (acc_info->stmt)->count;
+ gimple_bb (acc_info->stmt)->count;
}
}
@@ -946,19 +958,21 @@ analyze_transpose (void **slot, void *data ATTRIBUTE_UNUSED)
/* Find the index which defines the OFFSET from base.
We walk from use to def until we find how the offset was defined. */
static tree
-get_index_from_offset (tree offset, tree def_stmt)
+get_index_from_offset (tree offset, gimple def_stmt)
{
- tree op1, op2, expr, index;
+ tree op1, op2, index;
- if (TREE_CODE (def_stmt) == PHI_NODE)
+ if (gimple_code (def_stmt) == GIMPLE_PHI)
return NULL;
- expr = get_inner_of_cast_expr (GIMPLE_STMT_OPERAND (def_stmt, 1));
- if (TREE_CODE (expr) == SSA_NAME)
- return get_index_from_offset (offset, SSA_NAME_DEF_STMT (expr));
- else if (TREE_CODE (expr) == MULT_EXPR)
+ if ((gimple_assign_copy_p (def_stmt) || gimple_assign_cast_p (def_stmt))
+ && TREE_CODE (gimple_assign_rhs1 (def_stmt)) == SSA_NAME)
+ return get_index_from_offset (offset,
+ SSA_NAME_DEF_STMT (gimple_assign_rhs1 (def_stmt)));
+ else if (is_gimple_assign (def_stmt)
+ && gimple_assign_rhs_code (def_stmt) == MULT_EXPR)
{
- op1 = TREE_OPERAND (expr, 0);
- op2 = TREE_OPERAND (expr, 1);
+ op1 = gimple_assign_rhs1 (def_stmt);
+ op2 = gimple_assign_rhs2 (def_stmt);
if (TREE_CODE (op1) != INTEGER_CST && TREE_CODE (op2) != INTEGER_CST)
return NULL;
index = (TREE_CODE (op1) == INTEGER_CST) ? op2 : op1;
@@ -972,17 +986,17 @@ get_index_from_offset (tree offset, tree def_stmt)
of the type related to the SSA_VAR, or the type related to the
lhs of STMT, in the case that it is an INDIRECT_REF. */
static void
-update_type_size (struct matrix_info *mi, tree stmt, tree ssa_var,
+update_type_size (struct matrix_info *mi, gimple stmt, tree ssa_var,
int current_indirect_level)
{
tree lhs;
HOST_WIDE_INT type_size;
/* Update type according to the type of the INDIRECT_REF expr. */
- if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
- && TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 0)) == INDIRECT_REF)
+ if (is_gimple_assign (stmt)
+ && TREE_CODE (gimple_assign_lhs (stmt)) == INDIRECT_REF)
{
- lhs = GIMPLE_STMT_OPERAND (stmt, 0);
+ lhs = gimple_assign_lhs (stmt);
gcc_assert (POINTER_TYPE_P
(TREE_TYPE (SSA_NAME_VAR (TREE_OPERAND (lhs, 0)))));
type_size =
@@ -1027,24 +1041,66 @@ update_type_size (struct matrix_info *mi, tree stmt, tree ssa_var,
}
}
-/* USE_STMT represents a call_expr ,where one of the arguments is the
+/* USE_STMT represents a GIMPLE_CALL, where one of the arguments is the
ssa var that we want to check because it came from some use of matrix
MI. CURRENT_INDIRECT_LEVEL is the indirection level we reached so
far. */
-static void
-analyze_accesses_for_call_expr (struct matrix_info *mi, tree use_stmt,
- int current_indirect_level)
+static int
+analyze_accesses_for_call_stmt (struct matrix_info *mi, tree ssa_var,
+ gimple use_stmt, int current_indirect_level)
{
- tree call = get_call_expr_in (use_stmt);
- if (call && get_callee_fndecl (call))
+ tree fndecl = gimple_call_fndecl (use_stmt);
+
+ if (gimple_call_lhs (use_stmt))
+ {
+ tree lhs = gimple_call_lhs (use_stmt);
+ struct ssa_acc_in_tree lhs_acc, rhs_acc;
+
+ memset (&lhs_acc, 0, sizeof (lhs_acc));
+ memset (&rhs_acc, 0, sizeof (rhs_acc));
+
+ lhs_acc.ssa_var = ssa_var;
+ lhs_acc.t_code = ERROR_MARK;
+ ssa_accessed_in_tree (lhs, &lhs_acc);
+ rhs_acc.ssa_var = ssa_var;
+ rhs_acc.t_code = ERROR_MARK;
+ ssa_accessed_in_call_rhs (use_stmt, &rhs_acc);
+
+ /* The SSA must be either in the left side or in the right side,
+ to understand what is happening.
+ In case the SSA_NAME is found in both sides we should be escaping
+ at this level because in this case we cannot calculate the
+ address correctly. */
+ if ((lhs_acc.var_found && rhs_acc.var_found
+ && lhs_acc.t_code == INDIRECT_REF)
+ || (!rhs_acc.var_found && !lhs_acc.var_found))
+ {
+ mark_min_matrix_escape_level (mi, current_indirect_level, use_stmt);
+ return current_indirect_level;
+ }
+ gcc_assert (!rhs_acc.var_found || !lhs_acc.var_found);
+
+ /* If we are storing to the matrix at some level, then mark it as
+ escaping at that level. */
+ if (lhs_acc.var_found)
+ {
+ int l = current_indirect_level + 1;
+
+ gcc_assert (lhs_acc.t_code == INDIRECT_REF);
+ mark_min_matrix_escape_level (mi, l, use_stmt);
+ return current_indirect_level;
+ }
+ }
+
+ if (fndecl)
{
- if (DECL_FUNCTION_CODE (get_callee_fndecl (call)) != BUILT_IN_FREE)
+ if (DECL_FUNCTION_CODE (fndecl) != BUILT_IN_FREE)
{
if (dump_file)
fprintf (dump_file,
"Matrix %s: Function call %s, level %d escapes.\n",
- get_name (mi->decl), get_name (get_callee_fndecl (call)),
+ get_name (mi->decl), get_name (fndecl),
current_indirect_level);
mark_min_matrix_escape_level (mi, current_indirect_level, use_stmt);
}
@@ -1061,6 +1117,7 @@ analyze_accesses_for_call_expr (struct matrix_info *mi, tree use_stmt,
mi->free_stmts[l].func = current_function_decl;
}
}
+ return current_indirect_level;
}
/* USE_STMT represents a phi node of the ssa var that we want to
@@ -1074,7 +1131,7 @@ analyze_accesses_for_call_expr (struct matrix_info *mi, tree use_stmt,
CURRENT_INDIRECT_LEVEL is the indirection level we reached so far. */
static void
-analyze_accesses_for_phi_node (struct matrix_info *mi, tree use_stmt,
+analyze_accesses_for_phi_node (struct matrix_info *mi, gimple use_stmt,
int current_indirect_level, sbitmap visited,
bool record_accesses)
{
@@ -1091,18 +1148,18 @@ analyze_accesses_for_phi_node (struct matrix_info *mi, tree use_stmt,
{
int level = MIN (maphi->indirection_level,
current_indirect_level);
- int j;
- tree t = NULL_TREE;
+ size_t j;
+ gimple stmt = NULL;
maphi->indirection_level = level;
- for (j = 0; j < PHI_NUM_ARGS (use_stmt); j++)
+ for (j = 0; j < gimple_phi_num_args (use_stmt); j++)
{
tree def = PHI_ARG_DEF (use_stmt, j);
- if (TREE_CODE (SSA_NAME_DEF_STMT (def)) != PHI_NODE)
- t = SSA_NAME_DEF_STMT (def);
+ if (gimple_code (SSA_NAME_DEF_STMT (def)) != GIMPLE_PHI)
+ stmt = SSA_NAME_DEF_STMT (def);
}
- mark_min_matrix_escape_level (mi, level, t);
+ mark_min_matrix_escape_level (mi, level, stmt);
}
return;
}
@@ -1127,20 +1184,17 @@ analyze_accesses_for_phi_node (struct matrix_info *mi, tree use_stmt,
}
}
-/* USE_STMT represents a modify statement (the rhs or lhs include
+/* USE_STMT represents an assign statement (the rhs or lhs include
the ssa var that we want to check because it came from some use of matrix
- MI.
- CURRENT_INDIRECT_LEVEL is the indirection level we reached so far. */
+ MI. CURRENT_INDIRECT_LEVEL is the indirection level we reached so far. */
static int
-analyze_accesses_for_modify_stmt (struct matrix_info *mi, tree ssa_var,
- tree use_stmt, int current_indirect_level,
+analyze_accesses_for_assign_stmt (struct matrix_info *mi, tree ssa_var,
+ gimple use_stmt, int current_indirect_level,
bool last_op, sbitmap visited,
bool record_accesses)
{
-
- tree lhs = GIMPLE_STMT_OPERAND (use_stmt, 0);
- tree rhs = GIMPLE_STMT_OPERAND (use_stmt, 1);
+ tree lhs = gimple_get_lhs (use_stmt);
struct ssa_acc_in_tree lhs_acc, rhs_acc;
memset (&lhs_acc, 0, sizeof (lhs_acc));
@@ -1151,7 +1205,7 @@ analyze_accesses_for_modify_stmt (struct matrix_info *mi, tree ssa_var,
ssa_accessed_in_tree (lhs, &lhs_acc);
rhs_acc.ssa_var = ssa_var;
rhs_acc.t_code = ERROR_MARK;
- ssa_accessed_in_tree (get_inner_of_cast_expr (rhs), &rhs_acc);
+ ssa_accessed_in_assign_rhs (use_stmt, &rhs_acc);
/* The SSA must be either in the left side or in the right side,
to understand what is happening.
@@ -1171,17 +1225,18 @@ analyze_accesses_for_modify_stmt (struct matrix_info *mi, tree ssa_var,
escaping at that level. */
if (lhs_acc.var_found)
{
- tree def;
int l = current_indirect_level + 1;
gcc_assert (lhs_acc.t_code == INDIRECT_REF);
- def = get_inner_of_cast_expr (rhs);
- if (TREE_CODE (def) != SSA_NAME)
+
+ if (!(gimple_assign_copy_p (use_stmt)
+ || gimple_assign_cast_p (use_stmt))
+ || (TREE_CODE (gimple_assign_rhs1 (use_stmt)) != SSA_NAME))
mark_min_matrix_escape_level (mi, l, use_stmt);
else
{
- def = SSA_NAME_DEF_STMT (def);
- analyze_matrix_allocation_site (mi, def, l, visited);
+ gimple def_stmt = SSA_NAME_DEF_STMT (gimple_assign_rhs1 (use_stmt));
+ analyze_matrix_allocation_site (mi, def_stmt, l, visited);
if (record_accesses)
record_access_alloc_site_info (mi, use_stmt, NULL_TREE,
NULL_TREE, l, true);
@@ -1193,17 +1248,6 @@ analyze_accesses_for_modify_stmt (struct matrix_info *mi, tree ssa_var,
is used. */
if (rhs_acc.var_found)
{
- /* If we are passing the ssa name to a function call and
- the pointer escapes when passed to the function
- (not the case of free), then we mark the matrix as
- escaping at this level. */
- if (rhs_acc.t_code == CALL_EXPR)
- {
- analyze_accesses_for_call_expr (mi, use_stmt,
- current_indirect_level);
-
- return current_indirect_level;
- }
if (rhs_acc.t_code != INDIRECT_REF
&& rhs_acc.t_code != POINTER_PLUS_EXPR && rhs_acc.t_code != SSA_NAME)
{
@@ -1236,8 +1280,8 @@ analyze_accesses_for_modify_stmt (struct matrix_info *mi, tree ssa_var,
tree index;
tree op1, op2;
- op1 = TREE_OPERAND (rhs, 0);
- op2 = TREE_OPERAND (rhs, 1);
+ op1 = gimple_assign_rhs1 (use_stmt);
+ op2 = gimple_assign_rhs2 (use_stmt);
op2 = (op1 == ssa_var) ? op2 : op1;
if (TREE_CODE (op2) == INTEGER_CST)
@@ -1332,8 +1376,8 @@ analyze_matrix_accesses (struct matrix_info *mi, tree ssa_var,
FOR_EACH_IMM_USE_FAST (use_p, imm_iter, ssa_var)
{
- tree use_stmt = USE_STMT (use_p);
- if (TREE_CODE (use_stmt) == PHI_NODE)
+ gimple use_stmt = USE_STMT (use_p);
+ if (gimple_code (use_stmt) == GIMPLE_PHI)
/* We check all the escaping levels that get to the PHI node
and make sure they are all the same escaping;
if not (which is rare) we let the escaping level be the
@@ -1343,16 +1387,22 @@ analyze_matrix_accesses (struct matrix_info *mi, tree ssa_var,
analyze_accesses_for_phi_node (mi, use_stmt, current_indirect_level,
visited, record_accesses);
- else if (TREE_CODE (use_stmt) == CALL_EXPR)
- analyze_accesses_for_call_expr (mi, use_stmt, current_indirect_level);
- else if (TREE_CODE (use_stmt) == GIMPLE_MODIFY_STMT)
+ else if (is_gimple_call (use_stmt))
+ analyze_accesses_for_call_stmt (mi, ssa_var, use_stmt,
+ current_indirect_level);
+ else if (is_gimple_assign (use_stmt))
current_indirect_level =
- analyze_accesses_for_modify_stmt (mi, ssa_var, use_stmt,
+ analyze_accesses_for_assign_stmt (mi, ssa_var, use_stmt,
current_indirect_level, last_op,
visited, record_accesses);
}
}
+typedef struct
+{
+ tree fn;
+ gimple stmt;
+} check_var_data;
/* A walk_tree function to go over the VAR_DECL, PARM_DECL nodes of
the malloc size expression and check that those aren't changed
@@ -1362,22 +1412,26 @@ check_var_notmodified_p (tree * tp, int *walk_subtrees, void *data)
{
basic_block bb;
tree t = *tp;
- tree fn = (tree) data;
- block_stmt_iterator bsi;
- tree stmt;
+ check_var_data *callback_data = (check_var_data*) data;
+ tree fn = callback_data->fn;
+ gimple_stmt_iterator gsi;
+ gimple stmt;
if (TREE_CODE (t) != VAR_DECL && TREE_CODE (t) != PARM_DECL)
return NULL_TREE;
FOR_EACH_BB_FN (bb, DECL_STRUCT_FUNCTION (fn))
{
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- stmt = bsi_stmt (bsi);
- if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
+ stmt = gsi_stmt (gsi);
+ if (!is_gimple_assign (stmt) && !is_gimple_call (stmt))
continue;
- if (GIMPLE_STMT_OPERAND (stmt, 0) == t)
- return stmt;
+ if (gimple_get_lhs (stmt) == t)
+ {
+ callback_data->stmt = stmt;
+ return t;
+ }
}
}
*walk_subtrees = 1;
@@ -1385,58 +1439,63 @@ check_var_notmodified_p (tree * tp, int *walk_subtrees, void *data)
}
/* Go backwards in the use-def chains and find out the expression
- represented by the possible SSA name in EXPR, until it is composed
+ represented by the possible SSA name in STMT, until it is composed
of only VAR_DECL, PARM_DECL and INT_CST. In case of phi nodes
we make sure that all the arguments represent the same subexpression,
otherwise we fail. */
+
static tree
-can_calculate_expr_before_stmt (tree expr, sbitmap visited)
+can_calculate_stmt_before_stmt (gimple stmt, sbitmap visited)
{
- tree def_stmt, op1, op2, res;
+ tree op1, op2, res;
+ enum tree_code code;
- switch (TREE_CODE (expr))
+ switch (gimple_code (stmt))
{
- case SSA_NAME:
- /* Case of loop, we don't know to represent this expression. */
- if (TEST_BIT (visited, SSA_NAME_VERSION (expr)))
- return NULL_TREE;
+ case GIMPLE_ASSIGN:
+ code = gimple_assign_rhs_code (stmt);
+ op1 = gimple_assign_rhs1 (stmt);
+
+ switch (code)
+ {
+ case POINTER_PLUS_EXPR:
+ case PLUS_EXPR:
+ case MINUS_EXPR:
+ case MULT_EXPR:
+
+ op2 = gimple_assign_rhs2 (stmt);
+ op1 = can_calculate_expr_before_stmt (op1, visited);
+ if (!op1)
+ return NULL_TREE;
+ op2 = can_calculate_expr_before_stmt (op2, visited);
+ if (op2)
+ return fold_build2 (code, gimple_expr_type (stmt), op1, op2);
+ return NULL_TREE;
+
+ CASE_CONVERT:
+ res = can_calculate_expr_before_stmt (op1, visited);
+ if (res != NULL_TREE)
+ return build1 (code, gimple_expr_type (stmt), res);
+ else
+ return NULL_TREE;
- SET_BIT (visited, SSA_NAME_VERSION (expr));
- def_stmt = SSA_NAME_DEF_STMT (expr);
- res = can_calculate_expr_before_stmt (def_stmt, visited);
- RESET_BIT (visited, SSA_NAME_VERSION (expr));
- return res;
- case VAR_DECL:
- case PARM_DECL:
- case INTEGER_CST:
- return expr;
- case POINTER_PLUS_EXPR:
- case PLUS_EXPR:
- case MINUS_EXPR:
- case MULT_EXPR:
- op1 = TREE_OPERAND (expr, 0);
- op2 = TREE_OPERAND (expr, 1);
+ default:
+ if (gimple_assign_single_p (stmt))
+ return can_calculate_expr_before_stmt (op1, visited);
+ else
+ return NULL_TREE;
+ }
- op1 = can_calculate_expr_before_stmt (op1, visited);
- if (!op1)
- return NULL_TREE;
- op2 = can_calculate_expr_before_stmt (op2, visited);
- if (op2)
- return fold_build2 (TREE_CODE (expr), TREE_TYPE (expr), op1, op2);
- return NULL_TREE;
- case GIMPLE_MODIFY_STMT:
- return can_calculate_expr_before_stmt (GIMPLE_STMT_OPERAND (expr, 1),
- visited);
- case PHI_NODE:
+ case GIMPLE_PHI:
{
- int j;
+ size_t j;
res = NULL_TREE;
/* Make sure all the arguments represent the same value. */
- for (j = 0; j < PHI_NUM_ARGS (expr); j++)
+ for (j = 0; j < gimple_phi_num_args (stmt); j++)
{
tree new_res;
- tree def = PHI_ARG_DEF (expr, j);
+ tree def = PHI_ARG_DEF (stmt, j);
new_res = can_calculate_expr_before_stmt (def, visited);
if (res == NULL_TREE)
@@ -1446,13 +1505,40 @@ can_calculate_expr_before_stmt (tree expr, sbitmap visited)
}
return res;
}
- CASE_CONVERT:
- res = can_calculate_expr_before_stmt (TREE_OPERAND (expr, 0), visited);
- if (res != NULL_TREE)
- return build1 (TREE_CODE (expr), TREE_TYPE (expr), res);
- else
+
+ default:
+ return NULL_TREE;
+ }
+}
+
+/* Go backwards in the use-def chains and find out the expression
+ represented by the possible SSA name in EXPR, until it is composed
+ of only VAR_DECL, PARM_DECL and INT_CST. In case of phi nodes
+ we make sure that all the arguments represent the same subexpression,
+ otherwise we fail. */
+static tree
+can_calculate_expr_before_stmt (tree expr, sbitmap visited)
+{
+ gimple def_stmt;
+ tree res;
+
+ switch (TREE_CODE (expr))
+ {
+ case SSA_NAME:
+ /* Case of loop, we don't know to represent this expression. */
+ if (TEST_BIT (visited, SSA_NAME_VERSION (expr)))
return NULL_TREE;
+ SET_BIT (visited, SSA_NAME_VERSION (expr));
+ def_stmt = SSA_NAME_DEF_STMT (expr);
+ res = can_calculate_stmt_before_stmt (def_stmt, visited);
+ RESET_BIT (visited, SSA_NAME_VERSION (expr));
+ return res;
+ case VAR_DECL:
+ case PARM_DECL:
+ case INTEGER_CST:
+ return expr;
+
default:
return NULL_TREE;
}
@@ -1484,7 +1570,7 @@ static int
check_allocation_function (void **slot, void *data ATTRIBUTE_UNUSED)
{
int level;
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
basic_block bb_level_0;
struct matrix_info *mi = (struct matrix_info *) *slot;
sbitmap visited;
@@ -1505,16 +1591,17 @@ check_allocation_function (void **slot, void *data ATTRIBUTE_UNUSED)
if (!mi->malloc_for_level[level])
break;
- mark_min_matrix_escape_level (mi, level, NULL_TREE);
+ mark_min_matrix_escape_level (mi, level, NULL);
- bsi = bsi_for_stmt (mi->malloc_for_level[0]);
- bb_level_0 = bsi.bb;
+ gsi = gsi_for_stmt (mi->malloc_for_level[0]);
+ bb_level_0 = gsi.bb;
/* Check if the expression of the size passed to malloc could be
pre-calculated before the malloc of level 0. */
for (level = 1; level < mi->min_indirect_level_escape; level++)
{
- tree call_stmt, size;
+ gimple call_stmt;
+ tree size;
struct malloc_call_data mcd;
call_stmt = mi->malloc_for_level[level];
@@ -1575,8 +1662,8 @@ find_sites_in_func (bool record)
{
sbitmap visited_stmts_1;
- block_stmt_iterator bsi;
- tree stmt;
+ gimple_stmt_iterator gsi;
+ gimple stmt;
basic_block bb;
struct matrix_info tmpmi, *mi;
@@ -1584,13 +1671,16 @@ find_sites_in_func (bool record)
FOR_EACH_BB (bb)
{
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- stmt = bsi_stmt (bsi);
- if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
- && TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 0)) == VAR_DECL)
+ tree lhs;
+
+ stmt = gsi_stmt (gsi);
+ lhs = gimple_get_lhs (stmt);
+ if (lhs != NULL_TREE
+ && TREE_CODE (lhs) == VAR_DECL)
{
- tmpmi.decl = GIMPLE_STMT_OPERAND (stmt, 0);
+ tmpmi.decl = lhs;
if ((mi = (struct matrix_info *) htab_find (matrices_to_reorg,
&tmpmi)))
{
@@ -1598,17 +1688,17 @@ find_sites_in_func (bool record)
analyze_matrix_allocation_site (mi, stmt, 0, visited_stmts_1);
}
}
- if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
- && TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 0)) == SSA_NAME
- && TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 1)) == VAR_DECL)
+ if (is_gimple_assign (stmt)
+ && gimple_assign_single_p (stmt)
+ && TREE_CODE (lhs) == SSA_NAME
+ && TREE_CODE (gimple_assign_rhs1 (stmt)) == VAR_DECL)
{
- tmpmi.decl = GIMPLE_STMT_OPERAND (stmt, 1);
+ tmpmi.decl = gimple_assign_rhs1 (stmt);
if ((mi = (struct matrix_info *) htab_find (matrices_to_reorg,
&tmpmi)))
{
sbitmap_zero (visited_stmts_1);
- analyze_matrix_accesses (mi,
- GIMPLE_STMT_OPERAND (stmt, 0), 0,
+ analyze_matrix_accesses (mi, lhs, 0,
false, visited_stmts_1, record);
}
}
@@ -1640,10 +1730,11 @@ record_all_accesses_in_func (void)
tree rhs, lhs;
if (!ssa_var
- || TREE_CODE (SSA_NAME_DEF_STMT (ssa_var)) != GIMPLE_MODIFY_STMT)
+ || !is_gimple_assign (SSA_NAME_DEF_STMT (ssa_var))
+ || !gimple_assign_single_p (SSA_NAME_DEF_STMT (ssa_var)))
continue;
- rhs = GIMPLE_STMT_OPERAND (SSA_NAME_DEF_STMT (ssa_var), 1);
- lhs = GIMPLE_STMT_OPERAND (SSA_NAME_DEF_STMT (ssa_var), 0);
+ rhs = gimple_assign_rhs1 (SSA_NAME_DEF_STMT (ssa_var));
+ lhs = gimple_assign_lhs (SSA_NAME_DEF_STMT (ssa_var));
if (TREE_CODE (rhs) != VAR_DECL && TREE_CODE (lhs) != VAR_DECL)
continue;
@@ -1664,16 +1755,20 @@ record_all_accesses_in_func (void)
sbitmap_free (visited_stmts_1);
}
-/* Used when we want to convert the expression: RESULT = something * ORIG to RESULT = something * NEW. If ORIG and NEW are power of 2, shift operations can be done, else division and multiplication. */
+/* Used when we want to convert the expression: RESULT = something *
+ ORIG to RESULT = something * NEW_VAL. If ORIG and NEW_VAL are power
+ of 2, shift operations can be done, else division and
+ multiplication. */
+
static tree
-compute_offset (HOST_WIDE_INT orig, HOST_WIDE_INT new, tree result)
+compute_offset (HOST_WIDE_INT orig, HOST_WIDE_INT new_val, tree result)
{
int x, y;
tree result1, ratio, log, orig_tree, new_tree;
x = exact_log2 (orig);
- y = exact_log2 (new);
+ y = exact_log2 (new_val);
if (x != -1 && y != -1)
{
@@ -1692,7 +1787,7 @@ compute_offset (HOST_WIDE_INT orig, HOST_WIDE_INT new, tree result)
return result1;
}
orig_tree = build_int_cst (TREE_TYPE (result), orig);
- new_tree = build_int_cst (TREE_TYPE (result), new);
+ new_tree = build_int_cst (TREE_TYPE (result), new_val);
ratio = fold_build2 (TRUNC_DIV_EXPR, TREE_TYPE (result), result, orig_tree);
result1 = fold_build2 (MULT_EXPR, TREE_TYPE (result), ratio, new_tree);
@@ -1719,10 +1814,11 @@ compute_offset (HOST_WIDE_INT orig, HOST_WIDE_INT new, tree result)
static int
transform_access_sites (void **slot, void *data ATTRIBUTE_UNUSED)
{
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
struct matrix_info *mi = (struct matrix_info *) *slot;
int min_escape_l = mi->min_indirect_level_escape;
struct access_site_info *acc_info;
+ enum tree_code code;
int i;
if (min_escape_l < 2 || !mi->access_l)
@@ -1730,8 +1826,6 @@ transform_access_sites (void **slot, void *data ATTRIBUTE_UNUSED)
for (i = 0; VEC_iterate (access_site_info_p, mi->access_l, i, acc_info);
i++)
{
- tree orig, type;
-
/* This is possible because we collect the access sites before
we determine the final minimum indirection level. */
if (acc_info->level >= min_escape_l)
@@ -1741,73 +1835,65 @@ transform_access_sites (void **slot, void *data ATTRIBUTE_UNUSED)
}
if (acc_info->is_alloc)
{
- if (acc_info->level >= 0 && bb_for_stmt (acc_info->stmt))
+ if (acc_info->level >= 0 && gimple_bb (acc_info->stmt))
{
ssa_op_iter iter;
tree def;
- tree stmt = acc_info->stmt;
+ gimple stmt = acc_info->stmt;
+ tree lhs;
FOR_EACH_SSA_TREE_OPERAND (def, stmt, iter, SSA_OP_DEF)
mark_sym_for_renaming (SSA_NAME_VAR (def));
- bsi = bsi_for_stmt (stmt);
- gcc_assert (TREE_CODE (acc_info->stmt) == GIMPLE_MODIFY_STMT);
- if (TREE_CODE (GIMPLE_STMT_OPERAND (acc_info->stmt, 0)) ==
- SSA_NAME && acc_info->level < min_escape_l - 1)
+ gsi = gsi_for_stmt (stmt);
+ gcc_assert (is_gimple_assign (acc_info->stmt));
+ lhs = gimple_assign_lhs (acc_info->stmt);
+ if (TREE_CODE (lhs) == SSA_NAME
+ && acc_info->level < min_escape_l - 1)
{
imm_use_iterator imm_iter;
use_operand_p use_p;
- tree use_stmt;
+ gimple use_stmt;
- FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter,
- GIMPLE_STMT_OPERAND (acc_info->stmt,
- 0))
+ FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter, lhs)
FOR_EACH_IMM_USE_ON_STMT (use_p, imm_iter)
{
- tree conv, tmp, stmts;
+ tree rhs, tmp;
+ gimple new_stmt;
+ gcc_assert (gimple_assign_rhs_code (acc_info->stmt)
+ == INDIRECT_REF);
/* Emit convert statement to convert to type of use. */
- conv =
- fold_build1 (CONVERT_EXPR,
- TREE_TYPE (GIMPLE_STMT_OPERAND
- (acc_info->stmt, 0)),
- TREE_OPERAND (GIMPLE_STMT_OPERAND
- (acc_info->stmt, 1), 0));
- tmp =
- create_tmp_var (TREE_TYPE
- (GIMPLE_STMT_OPERAND
- (acc_info->stmt, 0)), "new");
+ tmp = create_tmp_var (TREE_TYPE (lhs), "new");
add_referenced_var (tmp);
- stmts =
- fold_build2 (GIMPLE_MODIFY_STMT,
- TREE_TYPE (GIMPLE_STMT_OPERAND
- (acc_info->stmt, 0)), tmp,
- conv);
- tmp = make_ssa_name (tmp, stmts);
- GIMPLE_STMT_OPERAND (stmts, 0) = tmp;
- bsi = bsi_for_stmt (acc_info->stmt);
- bsi_insert_after (&bsi, stmts, BSI_SAME_STMT);
+ rhs = gimple_assign_rhs1 (acc_info->stmt);
+ new_stmt = gimple_build_assign (tmp,
+ TREE_OPERAND (rhs, 0));
+ tmp = make_ssa_name (tmp, new_stmt);
+ gimple_assign_set_lhs (new_stmt, tmp);
+ gsi = gsi_for_stmt (acc_info->stmt);
+ gsi_insert_after (&gsi, new_stmt, GSI_SAME_STMT);
SET_USE (use_p, tmp);
}
}
if (acc_info->level < min_escape_l - 1)
- bsi_remove (&bsi, true);
+ gsi_remove (&gsi, true);
}
free (acc_info);
continue;
}
- orig = GIMPLE_STMT_OPERAND (acc_info->stmt, 1);
- type = TREE_TYPE (orig);
- if (TREE_CODE (orig) == INDIRECT_REF
+ code = gimple_assign_rhs_code (acc_info->stmt);
+ if (code == INDIRECT_REF
&& acc_info->level < min_escape_l - 1)
{
/* Replace the INDIRECT_REF with NOP (cast) usually we are casting
from "pointer to type" to "type". */
- orig =
- build1 (NOP_EXPR, TREE_TYPE (orig),
- GIMPLE_STMT_OPERAND (orig, 0));
- GIMPLE_STMT_OPERAND (acc_info->stmt, 1) = orig;
+ tree t =
+ build1 (NOP_EXPR, TREE_TYPE (gimple_assign_rhs1 (acc_info->stmt)),
+ TREE_OPERAND (gimple_assign_rhs1 (acc_info->stmt), 0));
+ gimple_assign_set_rhs_code (acc_info->stmt, NOP_EXPR);
+ gimple_assign_set_rhs1 (acc_info->stmt, t);
}
- else if (TREE_CODE (orig) == POINTER_PLUS_EXPR
+ else if (code == POINTER_PLUS_EXPR
&& acc_info->level < (min_escape_l))
{
imm_use_iterator imm_iter;
@@ -1841,10 +1927,10 @@ transform_access_sites (void **slot, void *data ATTRIBUTE_UNUSED)
total_elements = new_offset;
if (new_offset != offset)
{
- bsi = bsi_for_stmt (acc_info->stmt);
- tmp1 = force_gimple_operand_bsi (&bsi, total_elements,
+ gsi = gsi_for_stmt (acc_info->stmt);
+ tmp1 = force_gimple_operand_gsi (&gsi, total_elements,
true, NULL,
- true, BSI_SAME_STMT);
+ true, GSI_SAME_STMT);
}
else
tmp1 = offset;
@@ -1857,16 +1943,16 @@ transform_access_sites (void **slot, void *data ATTRIBUTE_UNUSED)
fold_build2 (MULT_EXPR, sizetype, fold_convert (sizetype, acc_info->index),
fold_convert (sizetype, d_size));
add_referenced_var (d_size);
- bsi = bsi_for_stmt (acc_info->stmt);
- tmp1 = force_gimple_operand_bsi (&bsi, num_elements, true,
- NULL, true, BSI_SAME_STMT);
+ gsi = gsi_for_stmt (acc_info->stmt);
+ tmp1 = force_gimple_operand_gsi (&gsi, num_elements, true,
+ NULL, true, GSI_SAME_STMT);
}
/* Replace the offset if needed. */
if (tmp1 != offset)
{
if (TREE_CODE (offset) == SSA_NAME)
{
- tree use_stmt;
+ gimple use_stmt;
FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter, offset)
FOR_EACH_IMM_USE_ON_STMT (use_p, imm_iter)
@@ -1876,7 +1962,7 @@ transform_access_sites (void **slot, void *data ATTRIBUTE_UNUSED)
else
{
gcc_assert (TREE_CODE (offset) == INTEGER_CST);
- TREE_OPERAND (orig, 1) = tmp1;
+ gimple_assign_set_rhs2 (acc_info->stmt, tmp1);
}
}
}
@@ -1935,10 +2021,11 @@ transform_allocation_sites (void **slot, void *data ATTRIBUTE_UNUSED)
{
int i;
struct matrix_info *mi;
- tree type, call_stmt_0, malloc_stmt, oldfn, prev_dim_size, use_stmt;
+ tree type, oldfn, prev_dim_size;
+ gimple call_stmt_0, use_stmt;
struct cgraph_node *c_node;
struct cgraph_edge *e;
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
struct malloc_call_data mcd;
HOST_WIDE_INT element_size;
@@ -2021,17 +2108,20 @@ transform_allocation_sites (void **slot, void *data ATTRIBUTE_UNUSED)
for (i = 1; i < mi->min_indirect_level_escape; i++)
{
tree t;
+ check_var_data data;
/* mi->dimension_size must contain the expression of the size calculated
in check_allocation_function. */
gcc_assert (mi->dimension_size[i]);
+ data.fn = mi->allocation_function_decl;
+ data.stmt = NULL;
t = walk_tree_without_duplicates (&(mi->dimension_size[i]),
check_var_notmodified_p,
- mi->allocation_function_decl);
+ &data);
if (t != NULL_TREE)
{
- mark_min_matrix_escape_level (mi, i, t);
+ mark_min_matrix_escape_level (mi, i, data.stmt);
break;
}
}
@@ -2041,7 +2131,7 @@ transform_allocation_sites (void **slot, void *data ATTRIBUTE_UNUSED)
/* Since we should make sure that the size expression is available
before the call to malloc of level 0. */
- bsi = bsi_for_stmt (call_stmt_0);
+ gsi = gsi_for_stmt (call_stmt_0);
/* Find out the size of each dimension by looking at the malloc
sites and create a global variable to hold it.
@@ -2060,7 +2150,8 @@ transform_allocation_sites (void **slot, void *data ATTRIBUTE_UNUSED)
for (i = mi->min_indirect_level_escape - 1; i >= 0; i--)
{
- tree dim_size, dim_var, tmp;
+ tree dim_size, dim_var;
+ gimple stmt;
tree d_type_size;
/* Now put the size expression in a global variable and initialize it to
@@ -2091,24 +2182,22 @@ transform_allocation_sites (void **slot, void *data ATTRIBUTE_UNUSED)
dim_size = fold_build2 (MULT_EXPR, type, dim_size, prev_dim_size);
}
- dim_size = force_gimple_operand_bsi (&bsi, dim_size, true, NULL,
- true, BSI_SAME_STMT);
+ dim_size = force_gimple_operand_gsi (&gsi, dim_size, true, NULL,
+ true, GSI_SAME_STMT);
/* GLOBAL_HOLDING_THE_SIZE = DIM_SIZE. */
- tmp = fold_build2 (GIMPLE_MODIFY_STMT, type, dim_var, dim_size);
- GIMPLE_STMT_OPERAND (tmp, 0) = dim_var;
- mark_symbols_for_renaming (tmp);
- bsi_insert_before (&bsi, tmp, BSI_SAME_STMT);
+ stmt = gimple_build_assign (dim_var, dim_size);
+ mark_symbols_for_renaming (stmt);
+ gsi_insert_before (&gsi, stmt, GSI_SAME_STMT);
prev_dim_size = mi->dimension_size[i] = dim_var;
}
update_ssa (TODO_update_ssa);
/* Replace the malloc size argument in the malloc of level 0 to be
the size of all the dimensions. */
- malloc_stmt = GIMPLE_STMT_OPERAND (call_stmt_0, 1);
c_node = cgraph_node (mi->allocation_function_decl);
- old_size_0 = CALL_EXPR_ARG (malloc_stmt, 0);
- tmp = force_gimple_operand_bsi (&bsi, mi->dimension_size[0], true,
- NULL, true, BSI_SAME_STMT);
+ old_size_0 = gimple_call_arg (call_stmt_0, 0);
+ tmp = force_gimple_operand_gsi (&gsi, mi->dimension_size[0], true,
+ NULL, true, GSI_SAME_STMT);
if (TREE_CODE (old_size_0) == SSA_NAME)
{
FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter, old_size_0)
@@ -2123,33 +2212,31 @@ transform_allocation_sites (void **slot, void *data ATTRIBUTE_UNUSED)
check this outside of "cgraph.c". */
for (i = 1; i < mi->min_indirect_level_escape; i++)
{
- block_stmt_iterator bsi;
- tree use_stmt1 = NULL;
- tree call;
+ gimple_stmt_iterator gsi;
+ gimple use_stmt1 = NULL;
- tree call_stmt = mi->malloc_for_level[i];
- call = GIMPLE_STMT_OPERAND (call_stmt, 1);
- gcc_assert (TREE_CODE (call) == CALL_EXPR);
+ gimple call_stmt = mi->malloc_for_level[i];
+ gcc_assert (is_gimple_call (call_stmt));
e = cgraph_edge (c_node, call_stmt);
gcc_assert (e);
cgraph_remove_edge (e);
- bsi = bsi_for_stmt (call_stmt);
+ gsi = gsi_for_stmt (call_stmt);
/* Remove the call stmt. */
- bsi_remove (&bsi, true);
+ gsi_remove (&gsi, true);
/* remove the type cast stmt. */
FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter,
- GIMPLE_STMT_OPERAND (call_stmt, 0))
+ gimple_call_lhs (call_stmt))
{
use_stmt1 = use_stmt;
- bsi = bsi_for_stmt (use_stmt);
- bsi_remove (&bsi, true);
+ gsi = gsi_for_stmt (use_stmt);
+ gsi_remove (&gsi, true);
}
/* Remove the assignment of the allocated area. */
FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter,
- GIMPLE_STMT_OPERAND (use_stmt1, 0))
+ gimple_get_lhs (use_stmt1))
{
- bsi = bsi_for_stmt (use_stmt);
- bsi_remove (&bsi, true);
+ gsi = gsi_for_stmt (use_stmt);
+ gsi_remove (&gsi, true);
}
}
update_ssa (TODO_update_ssa);
@@ -2159,24 +2246,21 @@ transform_allocation_sites (void **slot, void *data ATTRIBUTE_UNUSED)
/* Delete the calls to free. */
for (i = 1; i < mi->min_indirect_level_escape; i++)
{
- block_stmt_iterator bsi;
- tree call;
+ gimple_stmt_iterator gsi;
/* ??? wonder why this case is possible but we failed on it once. */
if (!mi->free_stmts[i].stmt)
continue;
- call = TREE_OPERAND (mi->free_stmts[i].stmt, 1);
c_node = cgraph_node (mi->free_stmts[i].func);
-
- gcc_assert (TREE_CODE (mi->free_stmts[i].stmt) == CALL_EXPR);
+ gcc_assert (is_gimple_call (mi->free_stmts[i].stmt));
e = cgraph_edge (c_node, mi->free_stmts[i].stmt);
gcc_assert (e);
cgraph_remove_edge (e);
current_function_decl = mi->free_stmts[i].func;
set_cfun (DECL_STRUCT_FUNCTION (mi->free_stmts[i].func));
- bsi = bsi_for_stmt (mi->free_stmts[i].stmt);
- bsi_remove (&bsi, true);
+ gsi = gsi_for_stmt (mi->free_stmts[i].stmt);
+ gsi_remove (&gsi, true);
}
/* Return to the previous situation. */
current_function_decl = oldfn;
@@ -2204,7 +2288,6 @@ dump_matrix_reorg_analysis (void **slot, void *data ATTRIBUTE_UNUSED)
return 1;
}
-
/* Perform matrix flattening. */
static unsigned int
@@ -2233,7 +2316,7 @@ matrix_reorg (void)
current_function_decl = node->decl;
push_cfun (DECL_STRUCT_FUNCTION (node->decl));
bitmap_obstack_initialize (NULL);
- tree_register_cfg_hooks ();
+ gimple_register_cfg_hooks ();
if (!gimple_in_ssa_p (cfun))
{
@@ -2301,7 +2384,7 @@ matrix_reorg (void)
current_function_decl = node->decl;
push_cfun (DECL_STRUCT_FUNCTION (node->decl));
bitmap_obstack_initialize (NULL);
- tree_register_cfg_hooks ();
+ gimple_register_cfg_hooks ();
record_all_accesses_in_func ();
htab_traverse (matrices_to_reorg, transform_access_sites, NULL);
free_dominance_info (CDI_DOMINATORS);
@@ -2344,3 +2427,4 @@ struct simple_ipa_opt_pass pass_ipa_matrix_reorg =
TODO_dump_cgraph | TODO_dump_func /* todo_flags_finish */
}
};
+
diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog
index 15ba12c999a..8fa3d3d4df1 100644
--- a/gcc/objc/ChangeLog
+++ b/gcc/objc/ChangeLog
@@ -1,3 +1,33 @@
+2008-07-28 Richard Guenther <rguenther@suse.de>
+
+ Merge from gimple-tuples-branch.
+
+ 2008-07-18 Aldy Hernandez <aldyh@redhat.com>
+
+ * Make-lang.in (objc-lang.o): Depend on GIMPLE_H.
+ (objc-act.o): Rename TREE_GIMPLE_H to GIMPLE_H.
+ * objc-act.h: Include gimple.h instead of tree-gimple.h.
+ * ipa-reference.c: Same.
+
+ 2007-11-10 Aldy Hernandez <aldyh@redhat.com>
+
+ * objc-act.c (objc_gimplify_expr): Change pre and post to sequences.
+ * objc-act.h (objc_gimplify_expr): Change prototype accordingly.
+
+2008-07-21 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * objc-act.c: Fix comment typos.
+
+2008-07-18 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * objc-act.c (objc_start_class_interface,
+ objc_start_category_interface, objc_start_class_implementation,
+ objc_start_category_implementation, objc_build_struct,
+ generate_static_references, build_private_template,
+ lookup_category, objc_add_method, add_category,
+ add_instance_variable, objc_is_public, conforms_to_protocol,
+ start_class, continue_class, finish_class): Avoid C++ keywords.
+
2008-07-14 Jason Merrill <jason@redhat.com>
PR objc++/36723
diff --git a/gcc/objc/Make-lang.in b/gcc/objc/Make-lang.in
index 93a0042a860..c5de9d83c73 100644
--- a/gcc/objc/Make-lang.in
+++ b/gcc/objc/Make-lang.in
@@ -72,14 +72,14 @@ objc/objc-lang.o : objc/objc-lang.c \
$(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
$(C_TREE_H) $(DIAGNOSTIC_H) \
$(GGC_H) langhooks.h $(LANGHOOKS_DEF_H) $(C_COMMON_H) gtype-objc.h \
- c-objc-common.h objc/objc-act.h $(TREE_GIMPLE_H)
+ c-objc-common.h objc/objc-act.h $(GIMPLE_H)
objc/objc-act.o : objc/objc-act.c \
$(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(RTL_H) $(TM_P_H) \
$(EXPR_H) $(TARGET_H) $(C_TREE_H) $(DIAGNOSTIC_H) toplev.h $(FLAGS_H) \
objc/objc-act.h input.h $(FUNCTION_H) output.h debug.h langhooks.h \
$(LANGHOOKS_DEF_H) $(HASHTAB_H) $(C_PRAGMA_H) gt-objc-objc-act.h \
- $(TREE_GIMPLE_H)
+ $(GIMPLE_H)
objc.srcextra:
diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c
index 8cbf81a0313..5941fb69389 100644
--- a/gcc/objc/objc-act.c
+++ b/gcc/objc/objc-act.c
@@ -617,19 +617,19 @@ lookup_protocol_in_reflist (tree rproto_list, tree lproto)
}
void
-objc_start_class_interface (tree class, tree super_class, tree protos)
+objc_start_class_interface (tree klass, tree super_class, tree protos)
{
objc_interface_context
= objc_ivar_context
- = start_class (CLASS_INTERFACE_TYPE, class, super_class, protos);
+ = start_class (CLASS_INTERFACE_TYPE, klass, super_class, protos);
objc_public_flag = 0;
}
void
-objc_start_category_interface (tree class, tree categ, tree protos)
+objc_start_category_interface (tree klass, tree categ, tree protos)
{
objc_interface_context
- = start_class (CATEGORY_INTERFACE_TYPE, class, categ, protos);
+ = start_class (CATEGORY_INTERFACE_TYPE, klass, categ, protos);
objc_ivar_chain
= continue_class (objc_interface_context);
}
@@ -656,19 +656,19 @@ objc_finish_interface (void)
}
void
-objc_start_class_implementation (tree class, tree super_class)
+objc_start_class_implementation (tree klass, tree super_class)
{
objc_implementation_context
= objc_ivar_context
- = start_class (CLASS_IMPLEMENTATION_TYPE, class, super_class, NULL_TREE);
+ = start_class (CLASS_IMPLEMENTATION_TYPE, klass, super_class, NULL_TREE);
objc_public_flag = 0;
}
void
-objc_start_category_implementation (tree class, tree categ)
+objc_start_category_implementation (tree klass, tree categ)
{
objc_implementation_context
- = start_class (CATEGORY_IMPLEMENTATION_TYPE, class, categ, NULL_TREE);
+ = start_class (CATEGORY_IMPLEMENTATION_TYPE, klass, categ, NULL_TREE);
objc_ivar_chain
= continue_class (objc_implementation_context);
}
@@ -779,13 +779,13 @@ objc_is_class_id (tree type)
return OBJC_TYPE_NAME (type) == objc_class_id;
}
-/* Construct a C struct with same name as CLASS, a base struct with tag
+/* Construct a C struct with same name as KLASS, a base struct with tag
SUPER_NAME (if any), and FIELDS indicated. */
static tree
-objc_build_struct (tree class, tree fields, tree super_name)
+objc_build_struct (tree klass, tree fields, tree super_name)
{
- tree name = CLASS_NAME (class);
+ tree name = CLASS_NAME (klass);
tree s = start_struct (RECORD_TYPE, name);
tree super = (super_name ? xref_tag (RECORD_TYPE, super_name) : NULL_TREE);
tree t, objc_info = NULL_TREE;
@@ -801,7 +801,7 @@ objc_build_struct (tree class, tree fields, tree super_name)
&& TREE_CODE (TREE_CHAIN (field)) == FIELD_DECL)
field = TREE_CHAIN (field);
- /* For ObjC ABI purposes, the "packed" size of a base class is the
+ /* For ObjC ABI purposes, the "packed" size of a base class is
the sum of the offset and the size (in bits) of the last field
in the class. */
DECL_SIZE (base)
@@ -845,7 +845,7 @@ objc_build_struct (tree class, tree fields, tree super_name)
/* Point the struct at its related Objective-C class. */
INIT_TYPE_OBJC_INFO (s);
- TYPE_OBJC_INTERFACE (s) = class;
+ TYPE_OBJC_INTERFACE (s) = klass;
s = finish_struct (s, fields, NULL_TREE);
@@ -854,14 +854,14 @@ objc_build_struct (tree class, tree fields, tree super_name)
{
TYPE_OBJC_INFO (t) = TREE_VALUE (objc_info);
/* Replace the IDENTIFIER_NODE with an actual @interface. */
- TYPE_OBJC_INTERFACE (t) = class;
+ TYPE_OBJC_INTERFACE (t) = klass;
}
/* Use TYPE_BINFO structures to point at the super class, if any. */
objc_xref_basetypes (s, super);
/* Mark this struct as a class template. */
- CLASS_STATIC_TEMPLATE (class) = s;
+ CLASS_STATIC_TEMPLATE (klass) = s;
return s;
}
@@ -1525,7 +1525,7 @@ synth_module_prologue (void)
const struct gcc_debug_hooks *const save_hooks = debug_hooks;
/* Suppress outputting debug symbols, because
- dbxout_init hasn'r been called yet. */
+ dbxout_init hasn't been called yet. */
write_symbols = NO_DEBUG;
debug_hooks = &do_nothing_debug_hooks;
@@ -2418,7 +2418,7 @@ static void
generate_static_references (void)
{
tree decls = NULL_TREE, expr = NULL_TREE;
- tree class_name, class, decl, initlist;
+ tree class_name, klass, decl, initlist;
tree cl_chain, in_chain, type
= build_array_type (build_pointer_type (void_type_node), NULL_TREE);
int num_inst, num_class;
@@ -2437,8 +2437,8 @@ generate_static_references (void)
decl = start_var_decl (type, buf);
/* Output {class_name, ...}. */
- class = TREE_VALUE (cl_chain);
- class_name = get_objc_string_decl (OBJC_TYPE_NAME (class), class_names);
+ klass = TREE_VALUE (cl_chain);
+ class_name = get_objc_string_decl (OBJC_TYPE_NAME (klass), class_names);
initlist = build_tree_list (NULL_TREE,
build_unary_op (ADDR_EXPR, class_name, 1));
@@ -4102,13 +4102,13 @@ build_objc_exception_stuff (void)
}; */
static void
-build_private_template (tree class)
+build_private_template (tree klass)
{
- if (!CLASS_STATIC_TEMPLATE (class))
+ if (!CLASS_STATIC_TEMPLATE (klass))
{
- tree record = objc_build_struct (class,
- get_class_ivars (class, false),
- CLASS_SUPER_NAME (class));
+ tree record = objc_build_struct (klass,
+ get_class_ivars (klass, false),
+ CLASS_SUPER_NAME (klass));
/* Set the TREE_USED bit for this struct, so that stab generator
can emit stabs for this struct type. */
@@ -5646,9 +5646,9 @@ build_shared_structure_initializer (tree type, tree isa, tree super,
/* Retrieve category interface CAT_NAME (if any) associated with CLASS. */
static inline tree
-lookup_category (tree class, tree cat_name)
+lookup_category (tree klass, tree cat_name)
{
- tree category = CLASS_CATEGORY_LIST (class);
+ tree category = CLASS_CATEGORY_LIST (klass);
while (category && CLASS_SUPER_NAME (category) != cat_name)
category = CLASS_CATEGORY_LIST (category);
@@ -6911,24 +6911,24 @@ add_method_to_hash_list (hash *hash_list, tree method)
}
static tree
-objc_add_method (tree class, tree method, int is_class)
+objc_add_method (tree klass, tree method, int is_class)
{
tree mth;
if (!(mth = lookup_method (is_class
- ? CLASS_CLS_METHODS (class)
- : CLASS_NST_METHODS (class), method)))
+ ? CLASS_CLS_METHODS (klass)
+ : CLASS_NST_METHODS (klass), method)))
{
/* put method on list in reverse order */
if (is_class)
{
- TREE_CHAIN (method) = CLASS_CLS_METHODS (class);
- CLASS_CLS_METHODS (class) = method;
+ TREE_CHAIN (method) = CLASS_CLS_METHODS (klass);
+ CLASS_CLS_METHODS (klass) = method;
}
else
{
- TREE_CHAIN (method) = CLASS_NST_METHODS (class);
- CLASS_NST_METHODS (class) = method;
+ TREE_CHAIN (method) = CLASS_NST_METHODS (klass);
+ CLASS_NST_METHODS (klass) = method;
}
}
else
@@ -6938,8 +6938,8 @@ objc_add_method (tree class, tree method, int is_class)
and/or return types. We do not do this for @implementations, because
C/C++ will do it for us (i.e., there will be duplicate function
definition errors). */
- if ((TREE_CODE (class) == CLASS_INTERFACE_TYPE
- || TREE_CODE (class) == CATEGORY_INTERFACE_TYPE)
+ if ((TREE_CODE (klass) == CLASS_INTERFACE_TYPE
+ || TREE_CODE (klass) == CATEGORY_INTERFACE_TYPE)
&& !comp_proto_with_proto (method, mth, 1))
error ("duplicate declaration of method %<%c%s%>",
is_class ? '+' : '-',
@@ -6957,12 +6957,12 @@ objc_add_method (tree class, tree method, int is_class)
instance methods listed in @protocol declarations to
the class hash table, on the assumption that @protocols
may be adopted by root classes or categories. */
- if (TREE_CODE (class) == CATEGORY_INTERFACE_TYPE
- || TREE_CODE (class) == CATEGORY_IMPLEMENTATION_TYPE)
- class = lookup_interface (CLASS_NAME (class));
+ if (TREE_CODE (klass) == CATEGORY_INTERFACE_TYPE
+ || TREE_CODE (klass) == CATEGORY_IMPLEMENTATION_TYPE)
+ klass = lookup_interface (CLASS_NAME (klass));
- if (TREE_CODE (class) == PROTOCOL_INTERFACE_TYPE
- || !CLASS_SUPER_NAME (class))
+ if (TREE_CODE (klass) == PROTOCOL_INTERFACE_TYPE
+ || !CLASS_SUPER_NAME (klass))
add_method_to_hash_list (cls_method_hash_list, method);
}
@@ -6995,31 +6995,31 @@ add_class (tree class_name, tree name)
}
static void
-add_category (tree class, tree category)
+add_category (tree klass, tree category)
{
/* Put categories on list in reverse order. */
- tree cat = lookup_category (class, CLASS_SUPER_NAME (category));
+ tree cat = lookup_category (klass, CLASS_SUPER_NAME (category));
if (cat)
{
warning (0, "duplicate interface declaration for category %<%s(%s)%>",
- IDENTIFIER_POINTER (CLASS_NAME (class)),
+ IDENTIFIER_POINTER (CLASS_NAME (klass)),
IDENTIFIER_POINTER (CLASS_SUPER_NAME (category)));
}
else
{
- CLASS_CATEGORY_LIST (category) = CLASS_CATEGORY_LIST (class);
- CLASS_CATEGORY_LIST (class) = category;
+ CLASS_CATEGORY_LIST (category) = CLASS_CATEGORY_LIST (klass);
+ CLASS_CATEGORY_LIST (klass) = category;
}
}
/* Called after parsing each instance variable declaration. Necessary to
preserve typedefs and implement public/private...
- PUBLIC is 1 for public, 0 for protected, and 2 for private. */
+ VISIBILITY is 1 for public, 0 for protected, and 2 for private. */
static tree
-add_instance_variable (tree class, int public, tree field_decl)
+add_instance_variable (tree klass, int visibility, tree field_decl)
{
tree field_type = TREE_TYPE (field_decl);
const char *ivar_name = DECL_NAME (field_decl)
@@ -7032,7 +7032,7 @@ add_instance_variable (tree class, int public, tree field_decl)
error ("illegal reference type specified for instance variable %qs",
ivar_name);
/* Return class as is without adding this ivar. */
- return class;
+ return klass;
}
#endif
@@ -7042,7 +7042,7 @@ add_instance_variable (tree class, int public, tree field_decl)
{
error ("instance variable %qs has unknown size", ivar_name);
/* Return class as is without adding this ivar. */
- return class;
+ return klass;
}
#ifdef OBJCPLUS
@@ -7088,7 +7088,7 @@ add_instance_variable (tree class, int public, tree field_decl)
"for instance variable %qs",
type_name, ivar_name);
/* Return class as is without adding this ivar. */
- return class;
+ return klass;
}
/* User-defined constructors and destructors are not known to Obj-C
@@ -7109,7 +7109,7 @@ add_instance_variable (tree class, int public, tree field_decl)
#endif
/* Overload the public attribute, it is not used for FIELD_DECLs. */
- switch (public)
+ switch (visibility)
{
case 0:
TREE_PUBLIC (field_decl) = 0;
@@ -7131,9 +7131,9 @@ add_instance_variable (tree class, int public, tree field_decl)
}
- CLASS_RAW_IVARS (class) = chainon (CLASS_RAW_IVARS (class), field_decl);
+ CLASS_RAW_IVARS (klass) = chainon (CLASS_RAW_IVARS (klass), field_decl);
- return class;
+ return klass;
}
static tree
@@ -7176,16 +7176,16 @@ objc_is_public (tree expr, tree identifier)
{
if (TYPE_HAS_OBJC_INFO (basetype) && TYPE_OBJC_INTERFACE (basetype))
{
- tree class = lookup_interface (OBJC_TYPE_NAME (basetype));
+ tree klass = lookup_interface (OBJC_TYPE_NAME (basetype));
- if (!class)
+ if (!klass)
{
error ("cannot find interface declaration for %qs",
IDENTIFIER_POINTER (OBJC_TYPE_NAME (basetype)));
return 0;
}
- if ((decl = is_ivar (get_class_ivars (class, true), identifier)))
+ if ((decl = is_ivar (get_class_ivars (klass, true), identifier)))
{
if (TREE_PUBLIC (decl))
return 1;
@@ -7206,13 +7206,13 @@ objc_is_public (tree expr, tree identifier)
if (basetype == curtype
|| DERIVED_FROM_P (basetype, curtype))
{
- int private = is_private (decl);
+ int priv = is_private (decl);
- if (private)
+ if (priv)
error ("instance variable %qs is declared private",
IDENTIFIER_POINTER (DECL_NAME (decl)));
- return !private;
+ return !priv;
}
}
@@ -7272,21 +7272,21 @@ check_methods (tree chain, tree list, int mtype)
return first;
}
-/* Check if CLASS, or its superclasses, explicitly conforms to PROTOCOL. */
+/* Check if KLASS, or its superclasses, explicitly conforms to PROTOCOL. */
static int
-conforms_to_protocol (tree class, tree protocol)
+conforms_to_protocol (tree klass, tree protocol)
{
if (TREE_CODE (protocol) == PROTOCOL_INTERFACE_TYPE)
{
- tree p = CLASS_PROTOCOL_LIST (class);
+ tree p = CLASS_PROTOCOL_LIST (klass);
while (p && TREE_VALUE (p) != protocol)
p = TREE_CHAIN (p);
if (!p)
{
- tree super = (CLASS_SUPER_NAME (class)
- ? lookup_interface (CLASS_SUPER_NAME (class))
+ tree super = (CLASS_SUPER_NAME (klass)
+ ? lookup_interface (CLASS_SUPER_NAME (klass))
: NULL_TREE);
int tmp = super ? conforms_to_protocol (super, protocol) : 0;
if (!tmp)
@@ -7440,7 +7440,7 @@ static tree
start_class (enum tree_code code, tree class_name, tree super_name,
tree protocol_list)
{
- tree class, decl;
+ tree klass, decl;
#ifdef OBJCPLUS
if (current_namespace != global_namespace) {
@@ -7456,8 +7456,8 @@ start_class (enum tree_code code, tree class_name, tree super_name,
objc_implementation_context = NULL_TREE;
}
- class = make_node (code);
- TYPE_LANG_SLOT_1 (class) = make_tree_vec (CLASS_LANG_SLOT_ELTS);
+ klass = make_node (code);
+ TYPE_LANG_SLOT_1 (klass) = make_tree_vec (CLASS_LANG_SLOT_ELTS);
/* Check for existence of the super class, if one was specified. Note
that we must have seen an @interface, not just a @class. If we
@@ -7478,9 +7478,9 @@ start_class (enum tree_code code, tree class_name, tree super_name,
super_name = super;
}
- CLASS_NAME (class) = class_name;
- CLASS_SUPER_NAME (class) = super_name;
- CLASS_CLS_METHODS (class) = NULL_TREE;
+ CLASS_NAME (klass) = class_name;
+ CLASS_SUPER_NAME (klass) = super_name;
+ CLASS_CLS_METHODS (klass) = NULL_TREE;
if (! objc_is_class_name (class_name)
&& (decl = lookup_name (class_name)))
@@ -7510,7 +7510,7 @@ start_class (enum tree_code code, tree class_name, tree super_name,
/* Reset for multiple classes per file. */
method_slot = 0;
- objc_implementation_context = class;
+ objc_implementation_context = klass;
/* Lookup the interface for this implementation. */
@@ -7553,10 +7553,10 @@ start_class (enum tree_code code, tree class_name, tree super_name,
#endif
IDENTIFIER_POINTER (class_name));
else
- add_class (class, class_name);
+ add_class (klass, class_name);
if (protocol_list)
- CLASS_PROTOCOL_LIST (class)
+ CLASS_PROTOCOL_LIST (klass)
= lookup_and_install_protocols (protocol_list);
}
@@ -7575,10 +7575,10 @@ start_class (enum tree_code code, tree class_name, tree super_name,
exit (FATAL_EXIT_CODE);
}
else
- add_category (class_category_is_assoc_with, class);
+ add_category (class_category_is_assoc_with, klass);
if (protocol_list)
- CLASS_PROTOCOL_LIST (class)
+ CLASS_PROTOCOL_LIST (klass)
= lookup_and_install_protocols (protocol_list);
}
@@ -7587,7 +7587,7 @@ start_class (enum tree_code code, tree class_name, tree super_name,
/* Reset for multiple classes per file. */
method_slot = 0;
- objc_implementation_context = class;
+ objc_implementation_context = klass;
/* For a category, class_name is really the name of the class that
the following set of methods will be associated with. We must
@@ -7600,21 +7600,21 @@ start_class (enum tree_code code, tree class_name, tree super_name,
exit (FATAL_EXIT_CODE);
}
}
- return class;
+ return klass;
}
static tree
-continue_class (tree class)
+continue_class (tree klass)
{
- if (TREE_CODE (class) == CLASS_IMPLEMENTATION_TYPE
- || TREE_CODE (class) == CATEGORY_IMPLEMENTATION_TYPE)
+ if (TREE_CODE (klass) == CLASS_IMPLEMENTATION_TYPE
+ || TREE_CODE (klass) == CATEGORY_IMPLEMENTATION_TYPE)
{
struct imp_entry *imp_entry;
/* Check consistency of the instance variables. */
- if (CLASS_RAW_IVARS (class))
- check_ivars (implementation_template, class);
+ if (CLASS_RAW_IVARS (klass))
+ check_ivars (implementation_template, klass);
/* code generation */
@@ -7629,7 +7629,7 @@ continue_class (tree class)
imp_entry = (struct imp_entry *) ggc_alloc (sizeof (struct imp_entry));
imp_entry->next = imp_list;
- imp_entry->imp_context = class;
+ imp_entry->imp_context = klass;
imp_entry->imp_template = implementation_template;
synth_forward_declarations ();
@@ -7639,7 +7639,7 @@ continue_class (tree class)
/* Append to front and increment count. */
imp_list = imp_entry;
- if (TREE_CODE (class) == CLASS_IMPLEMENTATION_TYPE)
+ if (TREE_CODE (klass) == CLASS_IMPLEMENTATION_TYPE)
imp_count++;
else
cat_count++;
@@ -7651,13 +7651,13 @@ continue_class (tree class)
return get_class_ivars (implementation_template, true);
}
- else if (TREE_CODE (class) == CLASS_INTERFACE_TYPE)
+ else if (TREE_CODE (klass) == CLASS_INTERFACE_TYPE)
{
#ifdef OBJCPLUS
push_lang_context (lang_name_c);
#endif /* OBJCPLUS */
- build_private_template (class);
+ build_private_template (klass);
#ifdef OBJCPLUS
pop_lang_context ();
@@ -7673,9 +7673,9 @@ continue_class (tree class)
/* This is called once we see the "@end" in an interface/implementation. */
static void
-finish_class (tree class)
+finish_class (tree klass)
{
- if (TREE_CODE (class) == CLASS_IMPLEMENTATION_TYPE)
+ if (TREE_CODE (klass) == CLASS_IMPLEMENTATION_TYPE)
{
/* All code generation is done in finish_objc. */
@@ -7694,9 +7694,9 @@ finish_class (tree class)
}
}
- else if (TREE_CODE (class) == CATEGORY_IMPLEMENTATION_TYPE)
+ else if (TREE_CODE (klass) == CATEGORY_IMPLEMENTATION_TYPE)
{
- tree category = lookup_category (implementation_template, CLASS_SUPER_NAME (class));
+ tree category = lookup_category (implementation_template, CLASS_SUPER_NAME (klass));
if (category)
{
@@ -9476,7 +9476,7 @@ objc_rewrite_function_call (tree function, tree params)
of its cousins). */
enum gimplify_status
-objc_gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p)
+objc_gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
{
enum gimplify_status r0, r1;
if (TREE_CODE (*expr_p) == OBJ_TYPE_REF
diff --git a/gcc/objc/objc-act.h b/gcc/objc/objc-act.h
index e4b8a93bf39..741401d8356 100644
--- a/gcc/objc/objc-act.h
+++ b/gcc/objc/objc-act.h
@@ -23,7 +23,7 @@ along with GCC; see the file COPYING3. If not see
#define GCC_OBJC_ACT_H
/* For enum gimplify_status */
-#include "tree-gimple.h"
+#include "gimple.h"
/*** Language hooks ***/
@@ -32,7 +32,7 @@ const char *objc_printable_name (tree, int);
tree objc_get_callee_fndecl (const_tree);
void objc_finish_file (void);
tree objc_fold_obj_type_ref (tree, tree);
-enum gimplify_status objc_gimplify_expr (tree *, tree *, tree *);
+enum gimplify_status objc_gimplify_expr (tree *, gimple_seq *, gimple_seq *);
/* NB: The remaining public functions are prototyped in c-common.h, for the
benefit of stub-objc.c and objc-act.c. */
diff --git a/gcc/objcp/Make-lang.in b/gcc/objcp/Make-lang.in
index 695df4d2f61..fb7cffee234 100644
--- a/gcc/objcp/Make-lang.in
+++ b/gcc/objcp/Make-lang.in
@@ -72,12 +72,12 @@ cc1objplus$(exeext): $(OBJCXX_OBJS) cc1objplus-checksum.o $(BACKEND) $(LIBDEPS)
objcp/objcp-lang.o : objcp/objcp-lang.c \
$(CXX_TREE_H) $(TM_H) toplev.h debug.h langhooks.h objc/objc-act.h \
$(LANGHOOKS_DEF_H) $(C_COMMON_H) gtype-objcp.h \
- $(DIAGNOSTIC_H) cp/cp-objcp-common.h $(TREE_GIMPLE_H)
+ $(DIAGNOSTIC_H) cp/cp-objcp-common.h $(GIMPLE_H)
objcp/objcp-decl.o : objcp/objcp-decl.c \
$(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(C_TREE_H) \
toplev.h $(GGC_H) $(C_PRAGMA_H) input.h $(FLAGS_H) output.h \
- objc/objc-act.h objcp/objcp-decl.h $(TREE_GIMPLE_H) $(EXPR_H) $(TARGET_H)
+ objc/objc-act.h objcp/objcp-decl.h $(GIMPLE_H) $(EXPR_H) $(TARGET_H)
# The following must be an explicit rule; please keep in sync with the implicit
# one in Makefile.in.
@@ -86,7 +86,7 @@ objcp/objcp-act.o : objc/objc-act.c \
$(EXPR_H) $(TARGET_H) $(CXX_TREE_H) $(DIAGNOSTIC_H) toplev.h $(FLAGS_H) \
objc/objc-act.h input.h $(FUNCTION_H) output.h debug.h langhooks.h \
objcp/objcp-decl.h $(LANGHOOKS_DEF_H) $(HASHTAB_H) gt-objc-objc-act.h \
- $(TREE_GIMPLE_H)
+ $(GIMPLE_H)
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
po-generated:
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 2f9aedeac39..d6c5500319a 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -27,7 +27,8 @@ along with GCC; see the file COPYING3. If not see
#include "tm.h"
#include "tree.h"
#include "rtl.h"
-#include "tree-gimple.h"
+#include "gimple.h"
+#include "tree-iterator.h"
#include "tree-inline.h"
#include "langhooks.h"
#include "diagnostic.h"
@@ -44,6 +45,7 @@ along with GCC; see the file COPYING3. If not see
#include "optabs.h"
#include "cfgloop.h"
+
/* Lowering of OpenMP parallel and workshare constructs proceeds in two
phases. The first phase scans the function looking for OMP statements
and then for variables that must be replaced to satisfy data sharing
@@ -68,7 +70,7 @@ typedef struct omp_context
/* The tree of contexts corresponding to the encountered constructs. */
struct omp_context *outer;
- tree stmt;
+ gimple stmt;
/* Map variables to fields in a structure that allows communication
between sending and receiving threads. */
@@ -114,7 +116,8 @@ struct omp_for_data_loop
struct omp_for_data
{
struct omp_for_data_loop loop;
- tree chunk_size, for_stmt;
+ tree chunk_size;
+ gimple for_stmt;
tree pre, iter_type;
int collapse;
bool have_nowait, have_ordered;
@@ -128,8 +131,33 @@ static int taskreg_nesting_level;
struct omp_region *root_omp_region;
static bitmap task_shared_vars;
-static void scan_omp (tree *, omp_context *);
-static void lower_omp (tree *, omp_context *);
+static void scan_omp (gimple_seq, omp_context *);
+static tree scan_omp_1_op (tree *, int *, void *);
+
+#define WALK_SUBSTMTS \
+ case GIMPLE_BIND: \
+ case GIMPLE_TRY: \
+ case GIMPLE_CATCH: \
+ case GIMPLE_EH_FILTER: \
+ /* The sub-statements for these should be walked. */ \
+ *handled_ops_p = false; \
+ break;
+
+/* Convenience function for calling scan_omp_1_op on tree operands. */
+
+static inline tree
+scan_omp_op (tree *tp, omp_context *ctx)
+{
+ struct walk_stmt_info wi;
+
+ memset (&wi, 0, sizeof (wi));
+ wi.info = ctx;
+ wi.want_locations = true;
+
+ return walk_tree (tp, scan_omp_1_op, &wi, NULL);
+}
+
+static void lower_omp (gimple_seq, omp_context *);
static tree lookup_decl_in_outer_ctx (tree, omp_context *);
static tree maybe_lookup_decl_in_outer_ctx (tree, omp_context *);
@@ -150,7 +178,7 @@ find_omp_clause (tree clauses, enum tree_code kind)
static inline bool
is_parallel_ctx (omp_context *ctx)
{
- return TREE_CODE (ctx->stmt) == OMP_PARALLEL;
+ return gimple_code (ctx->stmt) == GIMPLE_OMP_PARALLEL;
}
@@ -159,7 +187,7 @@ is_parallel_ctx (omp_context *ctx)
static inline bool
is_task_ctx (omp_context *ctx)
{
- return TREE_CODE (ctx->stmt) == OMP_TASK;
+ return gimple_code (ctx->stmt) == GIMPLE_OMP_TASK;
}
@@ -168,8 +196,8 @@ is_task_ctx (omp_context *ctx)
static inline bool
is_taskreg_ctx (omp_context *ctx)
{
- return TREE_CODE (ctx->stmt) == OMP_PARALLEL
- || TREE_CODE (ctx->stmt) == OMP_TASK;
+ return gimple_code (ctx->stmt) == GIMPLE_OMP_PARALLEL
+ || gimple_code (ctx->stmt) == GIMPLE_OMP_TASK;
}
@@ -186,7 +214,7 @@ is_combined_parallel (struct omp_region *region)
them into *FD. */
static void
-extract_omp_for_data (tree for_stmt, struct omp_for_data *fd,
+extract_omp_for_data (gimple for_stmt, struct omp_for_data *fd,
struct omp_for_data_loop *loops)
{
tree t, var, *collapse_iter, *collapse_count;
@@ -197,7 +225,7 @@ extract_omp_for_data (tree for_stmt, struct omp_for_data *fd,
fd->for_stmt = for_stmt;
fd->pre = NULL;
- fd->collapse = TREE_VEC_LENGTH (OMP_FOR_INIT (for_stmt));
+ fd->collapse = gimple_omp_for_collapse (for_stmt);
if (fd->collapse > 1)
fd->loops = loops;
else
@@ -209,7 +237,7 @@ extract_omp_for_data (tree for_stmt, struct omp_for_data *fd,
collapse_iter = NULL;
collapse_count = NULL;
- for (t = OMP_FOR_CLAUSES (for_stmt); t ; t = OMP_CLAUSE_CHAIN (t))
+ for (t = gimple_omp_for_clauses (for_stmt); t ; t = OMP_CLAUSE_CHAIN (t))
switch (OMP_CLAUSE_CODE (t))
{
case OMP_CLAUSE_NOWAIT:
@@ -264,19 +292,16 @@ extract_omp_for_data (tree for_stmt, struct omp_for_data *fd,
else
loop = &dummy_loop;
- t = TREE_VEC_ELT (OMP_FOR_INIT (for_stmt), i);
- gcc_assert (TREE_CODE (t) == GIMPLE_MODIFY_STMT);
- loop->v = GIMPLE_STMT_OPERAND (t, 0);
+
+ loop->v = gimple_omp_for_index (for_stmt, i);
gcc_assert (SSA_VAR_P (loop->v));
gcc_assert (TREE_CODE (TREE_TYPE (loop->v)) == INTEGER_TYPE
|| TREE_CODE (TREE_TYPE (loop->v)) == POINTER_TYPE);
var = TREE_CODE (loop->v) == SSA_NAME ? SSA_NAME_VAR (loop->v) : loop->v;
- loop->n1 = GIMPLE_STMT_OPERAND (t, 1);
+ loop->n1 = gimple_omp_for_initial (for_stmt, i);
- t = TREE_VEC_ELT (OMP_FOR_COND (for_stmt), i);
- loop->cond_code = TREE_CODE (t);
- gcc_assert (TREE_OPERAND (t, 0) == var);
- loop->n2 = TREE_OPERAND (t, 1);
+ loop->cond_code = gimple_omp_for_cond (for_stmt, i);
+ loop->n2 = gimple_omp_for_final (for_stmt, i);
switch (loop->cond_code)
{
case LT_EXPR:
@@ -304,10 +329,7 @@ extract_omp_for_data (tree for_stmt, struct omp_for_data *fd,
gcc_unreachable ();
}
- t = TREE_VEC_ELT (OMP_FOR_INCR (for_stmt), i);
- gcc_assert (TREE_CODE (t) == GIMPLE_MODIFY_STMT);
- gcc_assert (GIMPLE_STMT_OPERAND (t, 0) == var);
- t = GIMPLE_STMT_OPERAND (t, 1);
+ t = gimple_omp_for_incr (for_stmt, i);
gcc_assert (TREE_OPERAND (t, 0) == var);
switch (TREE_CODE (t))
{
@@ -449,9 +471,9 @@ extract_omp_for_data (tree for_stmt, struct omp_for_data *fd,
When expanding a combined parallel+workshare region, the call to
the child function may need additional arguments in the case of
- OMP_FOR regions. In some cases, these arguments are computed out
- of variables passed in from the parent to the child via 'struct
- .omp_data_s'. For instance:
+ GIMPLE_OMP_FOR regions. In some cases, these arguments are
+ computed out of variables passed in from the parent to the child
+ via 'struct .omp_data_s'. For instance:
#pragma omp parallel for schedule (guided, i * 4)
for (j ...)
@@ -475,7 +497,7 @@ extract_omp_for_data (tree for_stmt, struct omp_for_data *fd,
To see whether the code in WS_ENTRY_BB blocks the combined
parallel+workshare call, we collect all the variables used in the
- OMP_FOR header check whether they appear on the LHS of any
+ GIMPLE_OMP_FOR header check whether they appear on the LHS of any
statement in WS_ENTRY_BB. If so, then we cannot emit the combined
call.
@@ -488,15 +510,15 @@ static bool
workshare_safe_to_combine_p (basic_block par_entry_bb, basic_block ws_entry_bb)
{
struct omp_for_data fd;
- tree par_stmt, ws_stmt;
+ gimple par_stmt, ws_stmt;
par_stmt = last_stmt (par_entry_bb);
ws_stmt = last_stmt (ws_entry_bb);
- if (TREE_CODE (ws_stmt) == OMP_SECTIONS)
+ if (gimple_code (ws_stmt) == GIMPLE_OMP_SECTIONS)
return true;
- gcc_assert (TREE_CODE (ws_stmt) == OMP_FOR);
+ gcc_assert (gimple_code (ws_stmt) == GIMPLE_OMP_FOR);
extract_omp_for_data (ws_stmt, &fd, NULL);
@@ -525,11 +547,11 @@ workshare_safe_to_combine_p (basic_block par_entry_bb, basic_block ws_entry_bb)
expanded. */
static tree
-get_ws_args_for (tree ws_stmt)
+get_ws_args_for (gimple ws_stmt)
{
tree t;
- if (TREE_CODE (ws_stmt) == OMP_FOR)
+ if (gimple_code (ws_stmt) == GIMPLE_OMP_FOR)
{
struct omp_for_data fd;
tree ws_args;
@@ -554,12 +576,12 @@ get_ws_args_for (tree ws_stmt)
return ws_args;
}
- else if (TREE_CODE (ws_stmt) == OMP_SECTIONS)
+ else if (gimple_code (ws_stmt) == GIMPLE_OMP_SECTIONS)
{
/* Number of sections is equal to the number of edges from the
- OMP_SECTIONS_SWITCH statement, except for the one to the exit
- of the sections region. */
- basic_block bb = single_succ (bb_for_stmt (ws_stmt));
+ GIMPLE_OMP_SECTIONS_SWITCH statement, except for the one to
+ the exit of the sections region. */
+ basic_block bb = single_succ (gimple_bb (ws_stmt));
t = build_int_cst (unsigned_type_node, EDGE_COUNT (bb->succs) - 1);
t = tree_cons (NULL, t, NULL);
return t;
@@ -583,9 +605,9 @@ determine_parallel_type (struct omp_region *region)
return;
/* We only support parallel+for and parallel+sections. */
- if (region->type != OMP_PARALLEL
- || (region->inner->type != OMP_FOR
- && region->inner->type != OMP_SECTIONS))
+ if (region->type != GIMPLE_OMP_PARALLEL
+ || (region->inner->type != GIMPLE_OMP_FOR
+ && region->inner->type != GIMPLE_OMP_SECTIONS))
return;
/* Check for perfect nesting PAR_ENTRY_BB -> WS_ENTRY_BB and
@@ -598,13 +620,13 @@ determine_parallel_type (struct omp_region *region)
if (single_succ (par_entry_bb) == ws_entry_bb
&& single_succ (ws_exit_bb) == par_exit_bb
&& workshare_safe_to_combine_p (par_entry_bb, ws_entry_bb)
- && (OMP_PARALLEL_COMBINED (last_stmt (par_entry_bb))
+ && (gimple_omp_parallel_combined_p (last_stmt (par_entry_bb))
|| (last_and_only_stmt (ws_entry_bb)
&& last_and_only_stmt (par_exit_bb))))
{
- tree ws_stmt = last_stmt (ws_entry_bb);
+ gimple ws_stmt = last_stmt (ws_entry_bb);
- if (region->inner->type == OMP_FOR)
+ if (region->inner->type == GIMPLE_OMP_FOR)
{
/* If this is a combined parallel loop, we need to determine
whether or not to use the combined library calls. There
@@ -615,7 +637,7 @@ determine_parallel_type (struct omp_region *region)
parallel loop call would still need extra synchronization
to implement ordered semantics, so there would not be any
gain in using the combined call. */
- tree clauses = OMP_FOR_CLAUSES (ws_stmt);
+ tree clauses = gimple_omp_for_clauses (ws_stmt);
tree c = find_omp_clause (clauses, OMP_CLAUSE_SCHEDULE);
if (c == NULL
|| OMP_CLAUSE_SCHEDULE_KIND (c) == OMP_CLAUSE_SCHEDULE_STATIC
@@ -745,7 +767,7 @@ use_pointer_for_field (tree decl, omp_context *shared_ctx)
{
tree c;
- for (c = OMP_TASKREG_CLAUSES (up->stmt);
+ for (c = gimple_omp_taskreg_clauses (up->stmt);
c; c = OMP_CLAUSE_CHAIN (c))
if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_SHARED
&& OMP_CLAUSE_DECL (c) == decl)
@@ -990,7 +1012,7 @@ fixup_remapped_decl (tree decl, omp_context *ctx, bool private_debug)
&& DECL_HAS_VALUE_EXPR_P (decl))
{
tree ve = DECL_VALUE_EXPR (decl);
- walk_tree (&ve, copy_body_r, &ctx->cb, NULL);
+ walk_tree (&ve, copy_tree_body_r, &ctx->cb, NULL);
SET_DECL_VALUE_EXPR (new_decl, ve);
DECL_HAS_VALUE_EXPR_P (new_decl) = 1;
}
@@ -1058,19 +1080,19 @@ void
dump_omp_region (FILE *file, struct omp_region *region, int indent)
{
fprintf (file, "%*sbb %d: %s\n", indent, "", region->entry->index,
- tree_code_name[region->type]);
+ gimple_code_name[region->type]);
if (region->inner)
dump_omp_region (file, region->inner, indent + 4);
if (region->cont)
{
- fprintf (file, "%*sbb %d: OMP_CONTINUE\n", indent, "",
+ fprintf (file, "%*sbb %d: GIMPLE_OMP_CONTINUE\n", indent, "",
region->cont->index);
}
if (region->exit)
- fprintf (file, "%*sbb %d: OMP_RETURN\n", indent, "",
+ fprintf (file, "%*sbb %d: GIMPLE_OMP_RETURN\n", indent, "",
region->exit->index);
else
fprintf (file, "%*s[no exit marker]\n", indent, "");
@@ -1095,7 +1117,8 @@ debug_all_omp_regions (void)
/* Create a new parallel region starting at STMT inside region PARENT. */
struct omp_region *
-new_omp_region (basic_block bb, enum tree_code type, struct omp_region *parent)
+new_omp_region (basic_block bb, enum gimple_code type,
+ struct omp_region *parent)
{
struct omp_region *region = XCNEW (struct omp_region);
@@ -1155,7 +1178,7 @@ free_omp_regions (void)
/* Create a new context, with OUTER_CTX being the surrounding context. */
static omp_context *
-new_omp_context (tree stmt, omp_context *outer_ctx)
+new_omp_context (gimple stmt, omp_context *outer_ctx)
{
omp_context *ctx = XCNEW (omp_context);
@@ -1188,17 +1211,19 @@ new_omp_context (tree stmt, omp_context *outer_ctx)
return ctx;
}
-static void maybe_catch_exception (tree *stmt_p);
+static gimple_seq maybe_catch_exception (gimple_seq);
/* Finalize task copyfn. */
static void
-finalize_task_copyfn (tree task_stmt)
+finalize_task_copyfn (gimple task_stmt)
{
struct function *child_cfun;
tree child_fn, old_fn;
+ gimple_seq seq, new_seq;
+ gimple bind;
- child_fn = OMP_TASK_COPYFN (task_stmt);
+ child_fn = gimple_omp_task_copy_fn (task_stmt);
if (child_fn == NULL_TREE)
return;
@@ -1211,8 +1236,17 @@ finalize_task_copyfn (tree task_stmt)
old_fn = current_function_decl;
push_cfun (child_cfun);
current_function_decl = child_fn;
- gimplify_body (&DECL_SAVED_TREE (child_fn), child_fn, false);
- maybe_catch_exception (&BIND_EXPR_BODY (DECL_SAVED_TREE (child_fn)));
+ bind = gimplify_body (&DECL_SAVED_TREE (child_fn), child_fn, false);
+ seq = gimple_seq_alloc ();
+ gimple_seq_add_stmt (&seq, bind);
+ new_seq = maybe_catch_exception (seq);
+ if (new_seq != seq)
+ {
+ bind = gimple_build_bind (NULL, new_seq, NULL);
+ seq = gimple_seq_alloc ();
+ gimple_seq_add_stmt (&seq, bind);
+ }
+ gimple_set_body (child_fn, seq);
pop_cfun ();
current_function_decl = old_fn;
@@ -1285,9 +1319,11 @@ fixup_child_record_type (omp_context *ctx)
DECL_CONTEXT (new_f) = type;
TREE_TYPE (new_f) = remap_type (TREE_TYPE (f), &ctx->cb);
TREE_CHAIN (new_f) = new_fields;
- walk_tree (&DECL_SIZE (new_f), copy_body_r, &ctx->cb, NULL);
- walk_tree (&DECL_SIZE_UNIT (new_f), copy_body_r, &ctx->cb, NULL);
- walk_tree (&DECL_FIELD_OFFSET (new_f), copy_body_r, &ctx->cb, NULL);
+ walk_tree (&DECL_SIZE (new_f), copy_tree_body_r, &ctx->cb, NULL);
+ walk_tree (&DECL_SIZE_UNIT (new_f), copy_tree_body_r,
+ &ctx->cb, NULL);
+ walk_tree (&DECL_FIELD_OFFSET (new_f), copy_tree_body_r,
+ &ctx->cb, NULL);
new_fields = new_f;
/* Arrange to be able to look up the receiver field
@@ -1386,7 +1422,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx)
case OMP_CLAUSE_COPYPRIVATE:
if (ctx->outer)
- scan_omp (&OMP_CLAUSE_DECL (c), ctx->outer);
+ scan_omp_op (&OMP_CLAUSE_DECL (c), ctx->outer);
/* FALLTHRU */
case OMP_CLAUSE_COPYIN:
@@ -1403,7 +1439,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx)
case OMP_CLAUSE_NUM_THREADS:
case OMP_CLAUSE_SCHEDULE:
if (ctx->outer)
- scan_omp (&OMP_CLAUSE_OPERAND (c, 0), ctx->outer);
+ scan_omp_op (&OMP_CLAUSE_OPERAND (c, 0), ctx->outer);
break;
case OMP_CLAUSE_NOWAIT:
@@ -1424,7 +1460,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx)
case OMP_CLAUSE_LASTPRIVATE:
/* Let the corresponding firstprivate clause create
the variable. */
- if (OMP_CLAUSE_LASTPRIVATE_STMT (c))
+ if (OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (c))
scan_array_reductions = true;
if (OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE (c))
break;
@@ -1472,12 +1508,12 @@ scan_sharing_clauses (tree clauses, omp_context *ctx)
if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_REDUCTION
&& OMP_CLAUSE_REDUCTION_PLACEHOLDER (c))
{
- scan_omp (&OMP_CLAUSE_REDUCTION_INIT (c), ctx);
- scan_omp (&OMP_CLAUSE_REDUCTION_MERGE (c), ctx);
+ scan_omp (OMP_CLAUSE_REDUCTION_GIMPLE_INIT (c), ctx);
+ scan_omp (OMP_CLAUSE_REDUCTION_GIMPLE_MERGE (c), ctx);
}
else if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_LASTPRIVATE
- && OMP_CLAUSE_LASTPRIVATE_STMT (c))
- scan_omp (&OMP_CLAUSE_LASTPRIVATE_STMT (c), ctx);
+ && OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (c))
+ scan_omp (OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (c), ctx);
}
/* Create a new name for omp child function. Returns an identifier. */
@@ -1526,7 +1562,7 @@ create_omp_child_function (omp_context *ctx, bool task_copy)
if (!task_copy)
ctx->cb.dst_fn = decl;
else
- OMP_TASK_COPYFN (ctx->stmt) = decl;
+ gimple_omp_task_set_copy_fn (ctx->stmt, decl);
TREE_STATIC (decl) = 1;
TREE_USED (decl) = 1;
@@ -1567,8 +1603,8 @@ create_omp_child_function (omp_context *ctx, bool task_copy)
allocate_struct_function clobbers CFUN, so we need to restore
it afterward. */
push_struct_function (decl);
- DECL_SOURCE_LOCATION (decl) = EXPR_LOCATION (ctx->stmt);
- cfun->function_end_locus = EXPR_LOCATION (ctx->stmt);
+ DECL_SOURCE_LOCATION (decl) = gimple_location (ctx->stmt);
+ cfun->function_end_locus = gimple_location (ctx->stmt);
pop_cfun ();
}
@@ -1576,22 +1612,24 @@ create_omp_child_function (omp_context *ctx, bool task_copy)
/* Scan an OpenMP parallel directive. */
static void
-scan_omp_parallel (tree *stmt_p, omp_context *outer_ctx)
+scan_omp_parallel (gimple_stmt_iterator *gsi, omp_context *outer_ctx)
{
omp_context *ctx;
tree name;
+ gimple stmt = gsi_stmt (*gsi);
/* Ignore parallel directives with empty bodies, unless there
are copyin clauses. */
if (optimize > 0
- && empty_body_p (OMP_PARALLEL_BODY (*stmt_p))
- && find_omp_clause (OMP_CLAUSES (*stmt_p), OMP_CLAUSE_COPYIN) == NULL)
+ && empty_body_p (gimple_omp_body (stmt))
+ && find_omp_clause (gimple_omp_parallel_clauses (stmt),
+ OMP_CLAUSE_COPYIN) == NULL)
{
- *stmt_p = build_empty_stmt ();
+ gsi_replace (gsi, gimple_build_nop (), false);
return;
}
- ctx = new_omp_context (*stmt_p, outer_ctx);
+ ctx = new_omp_context (stmt, outer_ctx);
if (taskreg_nesting_level > 1)
ctx->is_nested = true;
ctx->field_map = splay_tree_new (splay_tree_compare_pointers, 0, 0);
@@ -1601,10 +1639,10 @@ scan_omp_parallel (tree *stmt_p, omp_context *outer_ctx)
name = build_decl (TYPE_DECL, name, ctx->record_type);
TYPE_NAME (ctx->record_type) = name;
create_omp_child_function (ctx, false);
- OMP_PARALLEL_FN (*stmt_p) = ctx->cb.dst_fn;
+ gimple_omp_parallel_set_child_fn (stmt, ctx->cb.dst_fn);
- scan_sharing_clauses (OMP_PARALLEL_CLAUSES (*stmt_p), ctx);
- scan_omp (&OMP_PARALLEL_BODY (*stmt_p), ctx);
+ scan_sharing_clauses (gimple_omp_parallel_clauses (stmt), ctx);
+ scan_omp (gimple_omp_body (stmt), ctx);
if (TYPE_FIELDS (ctx->record_type) == NULL)
ctx->record_type = ctx->receiver_decl = NULL;
@@ -1618,20 +1656,21 @@ scan_omp_parallel (tree *stmt_p, omp_context *outer_ctx)
/* Scan an OpenMP task directive. */
static void
-scan_omp_task (tree *stmt_p, omp_context *outer_ctx)
+scan_omp_task (gimple_stmt_iterator *gsi, omp_context *outer_ctx)
{
omp_context *ctx;
- tree name;
+ tree name, t;
+ gimple stmt = gsi_stmt (*gsi);
/* Ignore task directives with empty bodies. */
if (optimize > 0
- && empty_body_p (OMP_TASK_BODY (*stmt_p)))
+ && empty_body_p (gimple_omp_body (stmt)))
{
- *stmt_p = build_empty_stmt ();
+ gsi_replace (gsi, gimple_build_nop (), false);
return;
}
- ctx = new_omp_context (*stmt_p, outer_ctx);
+ ctx = new_omp_context (stmt, outer_ctx);
if (taskreg_nesting_level > 1)
ctx->is_nested = true;
ctx->field_map = splay_tree_new (splay_tree_compare_pointers, 0, 0);
@@ -1641,9 +1680,9 @@ scan_omp_task (tree *stmt_p, omp_context *outer_ctx)
name = build_decl (TYPE_DECL, name, ctx->record_type);
TYPE_NAME (ctx->record_type) = name;
create_omp_child_function (ctx, false);
- OMP_TASK_FN (*stmt_p) = ctx->cb.dst_fn;
+ gimple_omp_task_set_child_fn (stmt, ctx->cb.dst_fn);
- scan_sharing_clauses (OMP_TASK_CLAUSES (*stmt_p), ctx);
+ scan_sharing_clauses (gimple_omp_task_clauses (stmt), ctx);
if (ctx->srecord_type)
{
@@ -1653,15 +1692,15 @@ scan_omp_task (tree *stmt_p, omp_context *outer_ctx)
create_omp_child_function (ctx, true);
}
- scan_omp (&OMP_TASK_BODY (*stmt_p), ctx);
+ scan_omp (gimple_omp_body (stmt), ctx);
if (TYPE_FIELDS (ctx->record_type) == NULL)
{
ctx->record_type = ctx->receiver_decl = NULL;
- OMP_TASK_ARG_SIZE (*stmt_p)
- = build_int_cst (long_integer_type_node, 0);
- OMP_TASK_ARG_ALIGN (*stmt_p)
- = build_int_cst (long_integer_type_node, 1);
+ t = build_int_cst (long_integer_type_node, 0);
+ gimple_omp_task_set_arg_size (stmt, t);
+ t = build_int_cst (long_integer_type_node, 1);
+ gimple_omp_task_set_arg_align (stmt, t);
}
else
{
@@ -1684,12 +1723,12 @@ scan_omp_task (tree *stmt_p, omp_context *outer_ctx)
fixup_child_record_type (ctx);
if (ctx->srecord_type)
layout_type (ctx->srecord_type);
- OMP_TASK_ARG_SIZE (*stmt_p)
- = fold_convert (long_integer_type_node,
+ t = fold_convert (long_integer_type_node,
TYPE_SIZE_UNIT (ctx->record_type));
- OMP_TASK_ARG_ALIGN (*stmt_p)
- = build_int_cst (long_integer_type_node,
+ gimple_omp_task_set_arg_size (stmt, t);
+ t = build_int_cst (long_integer_type_node,
TYPE_ALIGN_UNIT (ctx->record_type));
+ gimple_omp_task_set_arg_align (stmt, t);
}
}
@@ -1697,47 +1736,43 @@ scan_omp_task (tree *stmt_p, omp_context *outer_ctx)
/* Scan an OpenMP loop directive. */
static void
-scan_omp_for (tree *stmt_p, omp_context *outer_ctx)
+scan_omp_for (gimple stmt, omp_context *outer_ctx)
{
omp_context *ctx;
- tree stmt;
- int i;
+ size_t i;
- stmt = *stmt_p;
ctx = new_omp_context (stmt, outer_ctx);
- scan_sharing_clauses (OMP_FOR_CLAUSES (stmt), ctx);
+ scan_sharing_clauses (gimple_omp_for_clauses (stmt), ctx);
- scan_omp (&OMP_FOR_PRE_BODY (stmt), ctx);
- for (i = 0; i < TREE_VEC_LENGTH (OMP_FOR_INIT (stmt)); i++)
+ scan_omp (gimple_omp_for_pre_body (stmt), ctx);
+ for (i = 0; i < gimple_omp_for_collapse (stmt); i++)
{
- scan_omp (&TREE_VEC_ELT (OMP_FOR_INIT (stmt), i), ctx);
- scan_omp (&TREE_VEC_ELT (OMP_FOR_COND (stmt), i), ctx);
- scan_omp (&TREE_VEC_ELT (OMP_FOR_INCR (stmt), i), ctx);
+ scan_omp_op (gimple_omp_for_index_ptr (stmt, i), ctx);
+ scan_omp_op (gimple_omp_for_initial_ptr (stmt, i), ctx);
+ scan_omp_op (gimple_omp_for_final_ptr (stmt, i), ctx);
+ scan_omp_op (gimple_omp_for_incr_ptr (stmt, i), ctx);
}
- scan_omp (&OMP_FOR_BODY (stmt), ctx);
+ scan_omp (gimple_omp_body (stmt), ctx);
}
/* Scan an OpenMP sections directive. */
static void
-scan_omp_sections (tree *stmt_p, omp_context *outer_ctx)
+scan_omp_sections (gimple stmt, omp_context *outer_ctx)
{
- tree stmt;
omp_context *ctx;
- stmt = *stmt_p;
ctx = new_omp_context (stmt, outer_ctx);
- scan_sharing_clauses (OMP_SECTIONS_CLAUSES (stmt), ctx);
- scan_omp (&OMP_SECTIONS_BODY (stmt), ctx);
+ scan_sharing_clauses (gimple_omp_sections_clauses (stmt), ctx);
+ scan_omp (gimple_omp_body (stmt), ctx);
}
/* Scan an OpenMP single directive. */
static void
-scan_omp_single (tree *stmt_p, omp_context *outer_ctx)
+scan_omp_single (gimple stmt, omp_context *outer_ctx)
{
- tree stmt = *stmt_p;
omp_context *ctx;
tree name;
@@ -1748,8 +1783,8 @@ scan_omp_single (tree *stmt_p, omp_context *outer_ctx)
name = build_decl (TYPE_DECL, name, ctx->record_type);
TYPE_NAME (ctx->record_type) = name;
- scan_sharing_clauses (OMP_SINGLE_CLAUSES (stmt), ctx);
- scan_omp (&OMP_SINGLE_BODY (stmt), ctx);
+ scan_sharing_clauses (gimple_omp_single_clauses (stmt), ctx);
+ scan_omp (gimple_omp_body (stmt), ctx);
if (TYPE_FIELDS (ctx->record_type) == NULL)
ctx->record_type = NULL;
@@ -1760,24 +1795,24 @@ scan_omp_single (tree *stmt_p, omp_context *outer_ctx)
/* Check OpenMP nesting restrictions. */
static void
-check_omp_nesting_restrictions (tree t, omp_context *ctx)
+check_omp_nesting_restrictions (gimple stmt, omp_context *ctx)
{
- switch (TREE_CODE (t))
+ switch (gimple_code (stmt))
{
- case OMP_FOR:
- case OMP_SECTIONS:
- case OMP_SINGLE:
- case CALL_EXPR:
+ case GIMPLE_OMP_FOR:
+ case GIMPLE_OMP_SECTIONS:
+ case GIMPLE_OMP_SINGLE:
+ case GIMPLE_CALL:
for (; ctx != NULL; ctx = ctx->outer)
- switch (TREE_CODE (ctx->stmt))
+ switch (gimple_code (ctx->stmt))
{
- case OMP_FOR:
- case OMP_SECTIONS:
- case OMP_SINGLE:
- case OMP_ORDERED:
- case OMP_MASTER:
- case OMP_TASK:
- if (TREE_CODE (t) == CALL_EXPR)
+ case GIMPLE_OMP_FOR:
+ case GIMPLE_OMP_SECTIONS:
+ case GIMPLE_OMP_SINGLE:
+ case GIMPLE_OMP_ORDERED:
+ case GIMPLE_OMP_MASTER:
+ case GIMPLE_OMP_TASK:
+ if (is_gimple_call (stmt))
{
warning (0, "barrier region may not be closely nested inside "
"of work-sharing, critical, ordered, master or "
@@ -1788,54 +1823,55 @@ check_omp_nesting_restrictions (tree t, omp_context *ctx)
"of work-sharing, critical, ordered, master or explicit "
"task region");
return;
- case OMP_PARALLEL:
+ case GIMPLE_OMP_PARALLEL:
return;
default:
break;
}
break;
- case OMP_MASTER:
+ case GIMPLE_OMP_MASTER:
for (; ctx != NULL; ctx = ctx->outer)
- switch (TREE_CODE (ctx->stmt))
+ switch (gimple_code (ctx->stmt))
{
- case OMP_FOR:
- case OMP_SECTIONS:
- case OMP_SINGLE:
- case OMP_TASK:
+ case GIMPLE_OMP_FOR:
+ case GIMPLE_OMP_SECTIONS:
+ case GIMPLE_OMP_SINGLE:
+ case GIMPLE_OMP_TASK:
warning (0, "master region may not be closely nested inside "
"of work-sharing or explicit task region");
return;
- case OMP_PARALLEL:
+ case GIMPLE_OMP_PARALLEL:
return;
default:
break;
}
break;
- case OMP_ORDERED:
+ case GIMPLE_OMP_ORDERED:
for (; ctx != NULL; ctx = ctx->outer)
- switch (TREE_CODE (ctx->stmt))
+ switch (gimple_code (ctx->stmt))
{
- case OMP_CRITICAL:
- case OMP_TASK:
+ case GIMPLE_OMP_CRITICAL:
+ case GIMPLE_OMP_TASK:
warning (0, "ordered region may not be closely nested inside "
"of critical or explicit task region");
return;
- case OMP_FOR:
- if (find_omp_clause (OMP_CLAUSES (ctx->stmt),
+ case GIMPLE_OMP_FOR:
+ if (find_omp_clause (gimple_omp_for_clauses (ctx->stmt),
OMP_CLAUSE_ORDERED) == NULL)
warning (0, "ordered region must be closely nested inside "
"a loop region with an ordered clause");
return;
- case OMP_PARALLEL:
+ case GIMPLE_OMP_PARALLEL:
return;
default:
break;
}
break;
- case OMP_CRITICAL:
+ case GIMPLE_OMP_CRITICAL:
for (; ctx != NULL; ctx = ctx->outer)
- if (TREE_CODE (ctx->stmt) == OMP_CRITICAL
- && OMP_CRITICAL_NAME (t) == OMP_CRITICAL_NAME (ctx->stmt))
+ if (gimple_code (ctx->stmt) == GIMPLE_OMP_CRITICAL
+ && (gimple_omp_critical_name (stmt)
+ == gimple_omp_critical_name (ctx->stmt)))
{
warning (0, "critical region may not be nested inside a critical "
"region with the same name");
@@ -1848,90 +1884,117 @@ check_omp_nesting_restrictions (tree t, omp_context *ctx)
}
-/* Callback for walk_stmts used to scan for OpenMP directives at TP. */
+/* Helper function scan_omp.
+
+ Callback for walk_tree or operators in walk_gimple_stmt used to
+ scan for OpenMP directives in TP. */
static tree
-scan_omp_1 (tree *tp, int *walk_subtrees, void *data)
+scan_omp_1_op (tree *tp, int *walk_subtrees, void *data)
{
struct walk_stmt_info *wi = (struct walk_stmt_info *) data;
omp_context *ctx = (omp_context *) wi->info;
tree t = *tp;
- if (EXPR_HAS_LOCATION (t))
- input_location = EXPR_LOCATION (t);
+ switch (TREE_CODE (t))
+ {
+ case VAR_DECL:
+ case PARM_DECL:
+ case LABEL_DECL:
+ case RESULT_DECL:
+ if (ctx)
+ *tp = remap_decl (t, &ctx->cb);
+ break;
+
+ default:
+ if (ctx && TYPE_P (t))
+ *tp = remap_type (t, &ctx->cb);
+ else if (!DECL_P (t))
+ *walk_subtrees = 1;
+ break;
+ }
+
+ return NULL_TREE;
+}
+
+
+/* Helper function for scan_omp.
+
+ Callback for walk_gimple_stmt used to scan for OpenMP directives in
+ the current statement in GSI. */
+
+static tree
+scan_omp_1_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p,
+ struct walk_stmt_info *wi)
+{
+ gimple stmt = gsi_stmt (*gsi);
+ omp_context *ctx = (omp_context *) wi->info;
+
+ if (gimple_has_location (stmt))
+ input_location = gimple_location (stmt);
/* Check the OpenMP nesting restrictions. */
if (ctx != NULL)
{
- if (OMP_DIRECTIVE_P (t))
- check_omp_nesting_restrictions (t, ctx);
- else if (TREE_CODE (t) == CALL_EXPR)
+ if (is_gimple_omp (stmt))
+ check_omp_nesting_restrictions (stmt, ctx);
+ else if (is_gimple_call (stmt))
{
- tree fndecl = get_callee_fndecl (t);
+ tree fndecl = gimple_call_fndecl (stmt);
if (fndecl && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL
&& DECL_FUNCTION_CODE (fndecl) == BUILT_IN_GOMP_BARRIER)
- check_omp_nesting_restrictions (t, ctx);
+ check_omp_nesting_restrictions (stmt, ctx);
}
}
- *walk_subtrees = 0;
- switch (TREE_CODE (t))
+ *handled_ops_p = true;
+
+ switch (gimple_code (stmt))
{
- case OMP_PARALLEL:
+ case GIMPLE_OMP_PARALLEL:
taskreg_nesting_level++;
- scan_omp_parallel (tp, ctx);
+ scan_omp_parallel (gsi, ctx);
taskreg_nesting_level--;
break;
- case OMP_TASK:
+ case GIMPLE_OMP_TASK:
taskreg_nesting_level++;
- scan_omp_task (tp, ctx);
+ scan_omp_task (gsi, ctx);
taskreg_nesting_level--;
break;
- case OMP_FOR:
- scan_omp_for (tp, ctx);
+ case GIMPLE_OMP_FOR:
+ scan_omp_for (stmt, ctx);
break;
- case OMP_SECTIONS:
- scan_omp_sections (tp, ctx);
+ case GIMPLE_OMP_SECTIONS:
+ scan_omp_sections (stmt, ctx);
break;
- case OMP_SINGLE:
- scan_omp_single (tp, ctx);
+ case GIMPLE_OMP_SINGLE:
+ scan_omp_single (stmt, ctx);
break;
- case OMP_SECTION:
- case OMP_MASTER:
- case OMP_ORDERED:
- case OMP_CRITICAL:
- ctx = new_omp_context (*tp, ctx);
- scan_omp (&OMP_BODY (*tp), ctx);
+ case GIMPLE_OMP_SECTION:
+ case GIMPLE_OMP_MASTER:
+ case GIMPLE_OMP_ORDERED:
+ case GIMPLE_OMP_CRITICAL:
+ ctx = new_omp_context (stmt, ctx);
+ scan_omp (gimple_omp_body (stmt), ctx);
break;
- case BIND_EXPR:
+ case GIMPLE_BIND:
{
tree var;
- *walk_subtrees = 1;
- for (var = BIND_EXPR_VARS (t); var ; var = TREE_CHAIN (var))
- insert_decl_map (&ctx->cb, var, var);
+ *handled_ops_p = false;
+ if (ctx)
+ for (var = gimple_bind_vars (stmt); var ; var = TREE_CHAIN (var))
+ insert_decl_map (&ctx->cb, var, var);
}
break;
-
- case VAR_DECL:
- case PARM_DECL:
- case LABEL_DECL:
- case RESULT_DECL:
- if (ctx)
- *tp = remap_decl (t, &ctx->cb);
- break;
-
default:
- if (ctx && TYPE_P (t))
- *tp = remap_type (t, &ctx->cb);
- else if (!DECL_P (t))
- *walk_subtrees = 1;
+ *handled_ops_p = false;
break;
}
@@ -1939,24 +2002,22 @@ scan_omp_1 (tree *tp, int *walk_subtrees, void *data)
}
-/* Scan all the statements starting at STMT_P. CTX contains context
- information about the OpenMP directives and clauses found during
- the scan. */
+/* Scan all the statements starting at the current statement. CTX
+ contains context information about the OpenMP directives and
+ clauses found during the scan. */
static void
-scan_omp (tree *stmt_p, omp_context *ctx)
+scan_omp (gimple_seq body, omp_context *ctx)
{
location_t saved_location;
struct walk_stmt_info wi;
memset (&wi, 0, sizeof (wi));
- wi.callback = scan_omp_1;
wi.info = ctx;
- wi.want_bind_expr = (ctx != NULL);
wi.want_locations = true;
saved_location = input_location;
- walk_stmts (&wi, stmt_p);
+ walk_gimple_seq (body, scan_omp_1_stmt, scan_omp_1_op, &wi);
input_location = saved_location;
}
@@ -1973,7 +2034,7 @@ build_omp_barrier (void)
/* If a context was created for STMT when it was scanned, return it. */
static omp_context *
-maybe_lookup_ctx (tree stmt)
+maybe_lookup_ctx (gimple stmt)
{
splay_tree_node n;
n = splay_tree_lookup (all_contexts, (splay_tree_key) stmt);
@@ -2133,17 +2194,17 @@ omp_reduction_init (tree clause, tree type)
to destructors go in DLIST. */
static void
-lower_rec_input_clauses (tree clauses, tree *ilist, tree *dlist,
+lower_rec_input_clauses (tree clauses, gimple_seq *ilist, gimple_seq *dlist,
omp_context *ctx)
{
- tree_stmt_iterator diter;
+ gimple_stmt_iterator diter;
tree c, dtor, copyin_seq, x, ptr;
bool copyin_by_ref = false;
bool lastprivate_firstprivate = false;
int pass;
- *dlist = alloc_stmt_list ();
- diter = tsi_start (*dlist);
+ *dlist = gimple_seq_alloc ();
+ diter = gsi_start (*dlist);
copyin_seq = NULL;
/* Do all the fixed sized types in the first pass, and the variable sized
@@ -2205,15 +2266,26 @@ lower_rec_input_clauses (tree clauses, tree *ilist, tree *dlist,
if (c_kind != OMP_CLAUSE_FIRSTPRIVATE || !is_task_ctx (ctx))
{
+ gimple stmt;
+ tree tmp;
+
ptr = DECL_VALUE_EXPR (new_var);
gcc_assert (TREE_CODE (ptr) == INDIRECT_REF);
ptr = TREE_OPERAND (ptr, 0);
gcc_assert (DECL_P (ptr));
x = TYPE_SIZE_UNIT (TREE_TYPE (new_var));
- x = build_call_expr (built_in_decls[BUILT_IN_ALLOCA], 1, x);
- x = fold_convert (TREE_TYPE (ptr), x);
- x = build_gimple_modify_stmt (ptr, x);
- gimplify_and_add (x, ilist);
+
+ /* void *tmp = __builtin_alloca */
+ stmt
+ = gimple_build_call (built_in_decls[BUILT_IN_ALLOCA], 1, x);
+ tmp = create_tmp_var_raw (ptr_type_node, NULL);
+ gimple_add_tmp_var (tmp);
+ gimple_call_set_lhs (stmt, tmp);
+
+ gimple_seq_add_stmt (ilist, stmt);
+
+ x = fold_convert (TREE_TYPE (ptr), tmp);
+ gimplify_assign (ptr, x, ilist);
}
}
else if (is_reference (var))
@@ -2252,8 +2324,7 @@ lower_rec_input_clauses (tree clauses, tree *ilist, tree *dlist,
x = fold_convert (TREE_TYPE (new_var), x);
}
- x = build_gimple_modify_stmt (new_var, x);
- gimplify_and_add (x, ilist);
+ gimplify_assign (new_var, x, ilist);
new_var = build_fold_indirect_ref (new_var);
}
@@ -2315,9 +2386,11 @@ lower_rec_input_clauses (tree clauses, tree *ilist, tree *dlist,
x = lang_hooks.decls.omp_clause_dtor (c, new_var);
if (x)
{
+ gimple_seq tseq = NULL;
+
dtor = x;
- gimplify_stmt (&dtor);
- tsi_link_before (&diter, dtor, TSI_SAME_STMT);
+ gimplify_stmt (&dtor, &tseq);
+ gsi_insert_seq_before (&diter, tseq, GSI_SAME_STMT);
}
break;
@@ -2360,16 +2433,17 @@ lower_rec_input_clauses (tree clauses, tree *ilist, tree *dlist,
x = build_fold_addr_expr (x);
SET_DECL_VALUE_EXPR (placeholder, x);
DECL_HAS_VALUE_EXPR_P (placeholder) = 1;
- gimplify_and_add (OMP_CLAUSE_REDUCTION_INIT (c), ilist);
- OMP_CLAUSE_REDUCTION_INIT (c) = NULL;
+ lower_omp (OMP_CLAUSE_REDUCTION_GIMPLE_INIT (c), ctx);
+ gimple_seq_add_seq (ilist,
+ OMP_CLAUSE_REDUCTION_GIMPLE_INIT (c));
+ OMP_CLAUSE_REDUCTION_GIMPLE_INIT (c) = NULL;
DECL_HAS_VALUE_EXPR_P (placeholder) = 0;
}
else
{
x = omp_reduction_init (c, TREE_TYPE (new_var));
gcc_assert (TREE_CODE (TREE_TYPE (new_var)) != ARRAY_TYPE);
- x = build_gimple_modify_stmt (new_var, x);
- gimplify_and_add (x, ilist);
+ gimplify_assign (new_var, x, ilist);
}
break;
@@ -2406,10 +2480,10 @@ lower_rec_input_clauses (tree clauses, tree *ilist, tree *dlist,
always true. */
static void
-lower_lastprivate_clauses (tree clauses, tree predicate, tree *stmt_list,
- omp_context *ctx)
+lower_lastprivate_clauses (tree clauses, tree predicate, gimple_seq *stmt_list,
+ omp_context *ctx)
{
- tree sub_list, x, c;
+ tree x, c, label = NULL;
bool par_clauses = false;
/* Early exit if there are no lastprivate clauses. */
@@ -2426,14 +2500,29 @@ lower_lastprivate_clauses (tree clauses, tree predicate, tree *stmt_list,
if (ctx == NULL || !is_parallel_ctx (ctx))
return;
- clauses = find_omp_clause (OMP_PARALLEL_CLAUSES (ctx->stmt),
+ clauses = find_omp_clause (gimple_omp_parallel_clauses (ctx->stmt),
OMP_CLAUSE_LASTPRIVATE);
if (clauses == NULL)
return;
par_clauses = true;
}
- sub_list = alloc_stmt_list ();
+ if (predicate)
+ {
+ gimple stmt;
+ tree label_true, arm1, arm2;
+
+ label = create_artificial_label ();
+ label_true = create_artificial_label ();
+ arm1 = TREE_OPERAND (predicate, 0);
+ arm2 = TREE_OPERAND (predicate, 1);
+ gimplify_expr (&arm1, stmt_list, NULL, is_gimple_val, fb_rvalue);
+ gimplify_expr (&arm2, stmt_list, NULL, is_gimple_val, fb_rvalue);
+ stmt = gimple_build_cond (TREE_CODE (predicate), arm1, arm2,
+ label_true, label);
+ gimple_seq_add_stmt (stmt_list, stmt);
+ gimple_seq_add_stmt (stmt_list, gimple_build_label (label_true));
+ }
for (c = clauses; c ;)
{
@@ -2444,15 +2533,19 @@ lower_lastprivate_clauses (tree clauses, tree predicate, tree *stmt_list,
var = OMP_CLAUSE_DECL (c);
new_var = lookup_decl (var, ctx);
- if (OMP_CLAUSE_LASTPRIVATE_STMT (c))
- gimplify_and_add (OMP_CLAUSE_LASTPRIVATE_STMT (c), &sub_list);
- OMP_CLAUSE_LASTPRIVATE_STMT (c) = NULL;
+ if (OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (c))
+ {
+ lower_omp (OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (c), ctx);
+ gimple_seq_add_seq (stmt_list,
+ OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (c));
+ }
+ OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (c) = NULL;
x = build_outer_var_ref (var, ctx);
if (is_reference (var))
new_var = build_fold_indirect_ref (new_var);
x = lang_hooks.decls.omp_clause_assign_op (c, x, new_var);
- append_to_statement_list (x, &sub_list);
+ gimplify_and_add (x, stmt_list);
}
c = OMP_CLAUSE_CHAIN (c);
if (c == NULL && !par_clauses)
@@ -2467,27 +2560,25 @@ lower_lastprivate_clauses (tree clauses, tree predicate, tree *stmt_list,
if (ctx == NULL || !is_parallel_ctx (ctx))
break;
- c = find_omp_clause (OMP_PARALLEL_CLAUSES (ctx->stmt),
+ c = find_omp_clause (gimple_omp_parallel_clauses (ctx->stmt),
OMP_CLAUSE_LASTPRIVATE);
par_clauses = true;
}
}
- if (predicate)
- x = build3 (COND_EXPR, void_type_node, predicate, sub_list, NULL);
- else
- x = sub_list;
-
- gimplify_and_add (x, stmt_list);
+ if (label)
+ gimple_seq_add_stmt (stmt_list, gimple_build_label (label));
}
/* Generate code to implement the REDUCTION clauses. */
static void
-lower_reduction_clauses (tree clauses, tree *stmt_list, omp_context *ctx)
+lower_reduction_clauses (tree clauses, gimple_seq *stmt_seqp, omp_context *ctx)
{
- tree sub_list = NULL, x, c;
+ gimple_seq sub_seq = NULL;
+ gimple stmt;
+ tree x, c;
int count = 0;
/* First see if there is exactly one reduction clause. Use OMP_ATOMIC
@@ -2535,7 +2626,7 @@ lower_reduction_clauses (tree clauses, tree *stmt_list, omp_context *ctx)
ref = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (addr)), addr);
x = fold_build2 (code, TREE_TYPE (ref), ref, new_var);
x = build2 (OMP_ATOMIC, void_type_node, addr, x);
- gimplify_and_add (x, stmt_list);
+ gimplify_and_add (x, stmt_seqp);
return;
}
@@ -2547,33 +2638,33 @@ lower_reduction_clauses (tree clauses, tree *stmt_list, omp_context *ctx)
ref = build_fold_addr_expr (ref);
SET_DECL_VALUE_EXPR (placeholder, ref);
DECL_HAS_VALUE_EXPR_P (placeholder) = 1;
- gimplify_and_add (OMP_CLAUSE_REDUCTION_MERGE (c), &sub_list);
- OMP_CLAUSE_REDUCTION_MERGE (c) = NULL;
+ lower_omp (OMP_CLAUSE_REDUCTION_GIMPLE_MERGE (c), ctx);
+ gimple_seq_add_seq (&sub_seq, OMP_CLAUSE_REDUCTION_GIMPLE_MERGE (c));
+ OMP_CLAUSE_REDUCTION_GIMPLE_MERGE (c) = NULL;
OMP_CLAUSE_REDUCTION_PLACEHOLDER (c) = NULL;
}
else
{
x = build2 (code, TREE_TYPE (ref), ref, new_var);
ref = build_outer_var_ref (var, ctx);
- x = build_gimple_modify_stmt (ref, x);
- append_to_statement_list (x, &sub_list);
+ gimplify_assign (ref, x, &sub_seq);
}
}
- x = build_call_expr (built_in_decls[BUILT_IN_GOMP_ATOMIC_START], 0);
- gimplify_and_add (x, stmt_list);
+ stmt = gimple_build_call (built_in_decls[BUILT_IN_GOMP_ATOMIC_START], 0);
+ gimple_seq_add_stmt (stmt_seqp, stmt);
- gimplify_and_add (sub_list, stmt_list);
+ gimple_seq_add_seq (stmt_seqp, sub_seq);
- x = build_call_expr (built_in_decls[BUILT_IN_GOMP_ATOMIC_END], 0);
- gimplify_and_add (x, stmt_list);
+ stmt = gimple_build_call (built_in_decls[BUILT_IN_GOMP_ATOMIC_END], 0);
+ gimple_seq_add_stmt (stmt_seqp, stmt);
}
/* Generate code to implement the COPYPRIVATE clauses. */
static void
-lower_copyprivate_clauses (tree clauses, tree *slist, tree *rlist,
+lower_copyprivate_clauses (tree clauses, gimple_seq *slist, gimple_seq *rlist,
omp_context *ctx)
{
tree c;
@@ -2592,8 +2683,7 @@ lower_copyprivate_clauses (tree clauses, tree *slist, tree *rlist,
ref = build_sender_ref (var, ctx);
x = lookup_decl_in_outer_ctx (var, ctx);
x = by_ref ? build_fold_addr_expr (x) : x;
- x = build_gimple_modify_stmt (ref, x);
- gimplify_and_add (x, slist);
+ gimplify_assign (ref, x, slist);
ref = build_receiver_ref (var, by_ref, ctx);
if (is_reference (var))
@@ -2611,7 +2701,8 @@ lower_copyprivate_clauses (tree clauses, tree *slist, tree *rlist,
and REDUCTION from the sender (aka parent) side. */
static void
-lower_send_clauses (tree clauses, tree *ilist, tree *olist, omp_context *ctx)
+lower_send_clauses (tree clauses, gimple_seq *ilist, gimple_seq *olist,
+ omp_context *ctx)
{
tree c;
@@ -2681,8 +2772,7 @@ lower_send_clauses (tree clauses, tree *ilist, tree *olist, omp_context *ctx)
{
ref = build_sender_ref (val, ctx);
x = by_ref ? build_fold_addr_expr (var) : var;
- x = build_gimple_modify_stmt (ref, x);
- gimplify_and_add (x, ilist);
+ gimplify_assign (ref, x, ilist);
if (is_task_ctx (ctx))
DECL_ABSTRACT_ORIGIN (TREE_OPERAND (ref, 1)) = NULL;
}
@@ -2690,18 +2780,17 @@ lower_send_clauses (tree clauses, tree *ilist, tree *olist, omp_context *ctx)
if (do_out)
{
ref = build_sender_ref (val, ctx);
- x = build_gimple_modify_stmt (var, ref);
- gimplify_and_add (x, olist);
+ gimplify_assign (var, ref, olist);
}
}
}
-/* Generate code to implement SHARED from the sender (aka parent) side.
- This is trickier, since OMP_PARALLEL_CLAUSES doesn't list things that
- got automatically shared. */
+/* Generate code to implement SHARED from the sender (aka parent)
+ side. This is trickier, since GIMPLE_OMP_PARALLEL_CLAUSES doesn't
+ list things that got automatically shared. */
static void
-lower_send_shared_vars (tree *ilist, tree *olist, omp_context *ctx)
+lower_send_shared_vars (gimple_seq *ilist, gimple_seq *olist, omp_context *ctx)
{
tree var, ovar, nvar, f, x, record_type;
@@ -2725,25 +2814,37 @@ lower_send_shared_vars (tree *ilist, tree *olist, omp_context *ctx)
{
x = build_sender_ref (ovar, ctx);
var = build_fold_addr_expr (var);
- x = build_gimple_modify_stmt (x, var);
- gimplify_and_add (x, ilist);
+ gimplify_assign (x, var, ilist);
}
else
{
x = build_sender_ref (ovar, ctx);
- x = build_gimple_modify_stmt (x, var);
- gimplify_and_add (x, ilist);
+ gimplify_assign (x, var, ilist);
if (!TREE_READONLY (var))
{
x = build_sender_ref (ovar, ctx);
- x = build_gimple_modify_stmt (var, x);
- gimplify_and_add (x, olist);
+ gimplify_assign (var, x, olist);
}
}
}
}
+
+/* A convenience function to build an empty GIMPLE_COND with just the
+ condition. */
+
+static gimple
+gimple_build_cond_empty (tree cond)
+{
+ enum tree_code pred_code;
+ tree lhs, rhs;
+
+ gimple_cond_get_ops_from_tree (cond, &pred_code, &lhs, &rhs);
+ return gimple_build_cond (pred_code, lhs, rhs, NULL_TREE, NULL_TREE);
+}
+
+
/* Build the function calls to GOMP_parallel_start etc to actually
generate the parallel operation. REGION is the parallel region
being expanded. BB is the block where to insert the code. WS_ARGS
@@ -2753,13 +2854,14 @@ lower_send_shared_vars (tree *ilist, tree *olist, omp_context *ctx)
static void
expand_parallel_call (struct omp_region *region, basic_block bb,
- tree entry_stmt, tree ws_args)
+ gimple entry_stmt, tree ws_args)
{
tree t, t1, t2, val, cond, c, clauses;
- block_stmt_iterator si;
+ gimple_stmt_iterator gsi;
+ gimple stmt;
int start_ix;
- clauses = OMP_PARALLEL_CLAUSES (entry_stmt);
+ clauses = gimple_omp_parallel_clauses (entry_stmt);
/* Determine what flavor of GOMP_parallel_start we will be
emitting. */
@@ -2768,14 +2870,14 @@ expand_parallel_call (struct omp_region *region, basic_block bb,
{
switch (region->inner->type)
{
- case OMP_FOR:
+ case GIMPLE_OMP_FOR:
gcc_assert (region->inner->sched_kind != OMP_CLAUSE_SCHEDULE_AUTO);
start_ix = BUILT_IN_GOMP_PARALLEL_LOOP_STATIC_START
+ (region->inner->sched_kind
== OMP_CLAUSE_SCHEDULE_RUNTIME
? 3 : region->inner->sched_kind);
break;
- case OMP_SECTIONS:
+ case GIMPLE_OMP_SECTIONS:
start_ix = BUILT_IN_GOMP_PARALLEL_SECTIONS_START;
break;
default:
@@ -2803,7 +2905,7 @@ expand_parallel_call (struct omp_region *region, basic_block bb,
(cond != 0) or (cond ? val : 1u). */
if (cond)
{
- block_stmt_iterator si;
+ gimple_stmt_iterator gsi;
cond = gimple_boolify (cond);
@@ -2814,14 +2916,14 @@ expand_parallel_call (struct omp_region *region, basic_block bb,
{
basic_block cond_bb, then_bb, else_bb;
edge e, e_then, e_else;
- tree t, tmp_then, tmp_else, tmp_join, tmp_var;
+ tree tmp_then, tmp_else, tmp_join, tmp_var;
tmp_var = create_tmp_var (TREE_TYPE (val), NULL);
if (gimple_in_ssa_p (cfun))
{
- tmp_then = make_ssa_name (tmp_var, NULL_TREE);
- tmp_else = make_ssa_name (tmp_var, NULL_TREE);
- tmp_join = make_ssa_name (tmp_var, NULL_TREE);
+ tmp_then = make_ssa_name (tmp_var, NULL);
+ tmp_else = make_ssa_name (tmp_var, NULL);
+ tmp_join = make_ssa_name (tmp_var, NULL);
}
else
{
@@ -2840,24 +2942,18 @@ expand_parallel_call (struct omp_region *region, basic_block bb,
set_immediate_dominator (CDI_DOMINATORS, then_bb, cond_bb);
set_immediate_dominator (CDI_DOMINATORS, else_bb, cond_bb);
- t = build3 (COND_EXPR, void_type_node,
- cond, NULL_TREE, NULL_TREE);
+ stmt = gimple_build_cond_empty (cond);
+ gsi = gsi_start_bb (cond_bb);
+ gsi_insert_after (&gsi, stmt, GSI_CONTINUE_LINKING);
- si = bsi_start (cond_bb);
- bsi_insert_after (&si, t, BSI_CONTINUE_LINKING);
+ gsi = gsi_start_bb (then_bb);
+ stmt = gimple_build_assign (tmp_then, val);
+ gsi_insert_after (&gsi, stmt, GSI_CONTINUE_LINKING);
- si = bsi_start (then_bb);
- t = build_gimple_modify_stmt (tmp_then, val);
- if (gimple_in_ssa_p (cfun))
- SSA_NAME_DEF_STMT (tmp_then) = t;
- bsi_insert_after (&si, t, BSI_CONTINUE_LINKING);
-
- si = bsi_start (else_bb);
- t = build_gimple_modify_stmt (tmp_else,
- build_int_cst (unsigned_type_node, 1));
- if (gimple_in_ssa_p (cfun))
- SSA_NAME_DEF_STMT (tmp_else) = t;
- bsi_insert_after (&si, t, BSI_CONTINUE_LINKING);
+ gsi = gsi_start_bb (else_bb);
+ stmt = gimple_build_assign
+ (tmp_else, build_int_cst (unsigned_type_node, 1));
+ gsi_insert_after (&gsi, stmt, GSI_CONTINUE_LINKING);
make_edge (cond_bb, then_bb, EDGE_TRUE_VALUE);
make_edge (cond_bb, else_bb, EDGE_FALSE_VALUE);
@@ -2866,7 +2962,7 @@ expand_parallel_call (struct omp_region *region, basic_block bb,
if (gimple_in_ssa_p (cfun))
{
- tree phi = create_phi_node (tmp_join, bb);
+ gimple phi = create_phi_node (tmp_join, bb);
SSA_NAME_DEF_STMT (tmp_join) = phi;
add_phi_arg (phi, tmp_then, e_then);
add_phi_arg (phi, tmp_else, e_else);
@@ -2875,18 +2971,18 @@ expand_parallel_call (struct omp_region *region, basic_block bb,
val = tmp_join;
}
- si = bsi_start (bb);
- val = force_gimple_operand_bsi (&si, val, true, NULL_TREE,
- false, BSI_CONTINUE_LINKING);
+ gsi = gsi_start_bb (bb);
+ val = force_gimple_operand_gsi (&gsi, val, true, NULL_TREE,
+ false, GSI_CONTINUE_LINKING);
}
- si = bsi_last (bb);
- t = OMP_PARALLEL_DATA_ARG (entry_stmt);
+ gsi = gsi_last_bb (bb);
+ t = gimple_omp_parallel_data_arg (entry_stmt);
if (t == NULL)
t1 = null_pointer_node;
else
t1 = build_fold_addr_expr (t);
- t2 = build_fold_addr_expr (OMP_PARALLEL_FN (entry_stmt));
+ t2 = build_fold_addr_expr (gimple_omp_parallel_child_fn (entry_stmt));
if (ws_args)
{
@@ -2898,21 +2994,21 @@ expand_parallel_call (struct omp_region *region, basic_block bb,
else
t = build_call_expr (built_in_decls[start_ix], 3, t2, t1, val);
- force_gimple_operand_bsi (&si, t, true, NULL_TREE,
- false, BSI_CONTINUE_LINKING);
+ force_gimple_operand_gsi (&gsi, t, true, NULL_TREE,
+ false, GSI_CONTINUE_LINKING);
- t = OMP_PARALLEL_DATA_ARG (entry_stmt);
+ t = gimple_omp_parallel_data_arg (entry_stmt);
if (t == NULL)
t = null_pointer_node;
else
t = build_fold_addr_expr (t);
- t = build_call_expr (OMP_PARALLEL_FN (entry_stmt), 1, t);
- force_gimple_operand_bsi (&si, t, true, NULL_TREE,
- false, BSI_CONTINUE_LINKING);
+ t = build_call_expr (gimple_omp_parallel_child_fn (entry_stmt), 1, t);
+ force_gimple_operand_gsi (&gsi, t, true, NULL_TREE,
+ false, GSI_CONTINUE_LINKING);
t = build_call_expr (built_in_decls[BUILT_IN_GOMP_PARALLEL_END], 0);
- force_gimple_operand_bsi (&si, t, true, NULL_TREE,
- false, BSI_CONTINUE_LINKING);
+ force_gimple_operand_gsi (&gsi, t, true, NULL_TREE,
+ false, GSI_CONTINUE_LINKING);
}
@@ -2920,12 +3016,12 @@ expand_parallel_call (struct omp_region *region, basic_block bb,
generate the task operation. BB is the block where to insert the code. */
static void
-expand_task_call (basic_block bb, tree entry_stmt)
+expand_task_call (basic_block bb, gimple entry_stmt)
{
tree t, t1, t2, t3, flags, cond, c, clauses;
- block_stmt_iterator si;
+ gimple_stmt_iterator gsi;
- clauses = OMP_TASK_CLAUSES (entry_stmt);
+ clauses = gimple_omp_task_clauses (entry_stmt);
c = find_omp_clause (clauses, OMP_CLAUSE_IF);
if (c)
@@ -2936,53 +3032,52 @@ expand_task_call (basic_block bb, tree entry_stmt)
c = find_omp_clause (clauses, OMP_CLAUSE_UNTIED);
flags = build_int_cst (unsigned_type_node, (c ? 1 : 0));
- si = bsi_last (bb);
- t = OMP_TASK_DATA_ARG (entry_stmt);
+ gsi = gsi_last_bb (bb);
+ t = gimple_omp_task_data_arg (entry_stmt);
if (t == NULL)
t2 = null_pointer_node;
else
t2 = build_fold_addr_expr (t);
- t1 = build_fold_addr_expr (OMP_TASK_FN (entry_stmt));
- t = OMP_TASK_COPYFN (entry_stmt);
+ t1 = build_fold_addr_expr (gimple_omp_task_child_fn (entry_stmt));
+ t = gimple_omp_task_copy_fn (entry_stmt);
if (t == NULL)
t3 = null_pointer_node;
else
t3 = build_fold_addr_expr (t);
t = build_call_expr (built_in_decls[BUILT_IN_GOMP_TASK], 7, t1, t2, t3,
- OMP_TASK_ARG_SIZE (entry_stmt),
- OMP_TASK_ARG_ALIGN (entry_stmt), cond, flags);
+ gimple_omp_task_arg_size (entry_stmt),
+ gimple_omp_task_arg_align (entry_stmt), cond, flags);
- force_gimple_operand_bsi (&si, t, true, NULL_TREE,
- false, BSI_CONTINUE_LINKING);
+ force_gimple_operand_gsi (&gsi, t, true, NULL_TREE,
+ false, GSI_CONTINUE_LINKING);
}
-/* If exceptions are enabled, wrap *STMT_P in a MUST_NOT_THROW catch
- handler. This prevents programs from violating the structured
- block semantics with throws. */
+/* If exceptions are enabled, wrap the statements in BODY in a MUST_NOT_THROW
+ catch handler and return it. This prevents programs from violating the
+ structured block semantics with throws. */
-static void
-maybe_catch_exception (tree *stmt_p)
+static gimple_seq
+maybe_catch_exception (gimple_seq body)
{
- tree f, t;
+ gimple f, t;
if (!flag_exceptions)
- return;
+ return body;
if (lang_protect_cleanup_actions)
t = lang_protect_cleanup_actions ();
else
- t = build_call_expr (built_in_decls[BUILT_IN_TRAP], 0);
- f = build2 (EH_FILTER_EXPR, void_type_node, NULL, NULL);
- EH_FILTER_MUST_NOT_THROW (f) = 1;
- gimplify_and_add (t, &EH_FILTER_FAILURE (f));
-
- t = build2 (TRY_CATCH_EXPR, void_type_node, *stmt_p, NULL);
- append_to_statement_list (f, &TREE_OPERAND (t, 1));
+ t = gimple_build_call (built_in_decls[BUILT_IN_TRAP], 0);
+
+ f = gimple_build_eh_filter (NULL, gimple_seq_alloc_with_stmt (t));
+ gimple_eh_filter_set_must_not_throw (f, true);
+
+ t = gimple_build_try (body, gimple_seq_alloc_with_stmt (f),
+ GIMPLE_TRY_CATCH);
- *stmt_p = NULL;
- append_to_statement_list (t, stmt_p);
+ return gimple_seq_alloc_with_stmt (t);
}
/* Chain all the DECLs in LIST by their TREE_CHAIN fields. */
@@ -3006,19 +3101,19 @@ list2chain (tree list)
/* Remove barriers in REGION->EXIT's block. Note that this is only
- valid for OMP_PARALLEL regions. Since the end of a parallel region
- is an implicit barrier, any workshare inside the OMP_PARALLEL that
- left a barrier at the end of the OMP_PARALLEL region can now be
+ valid for GIMPLE_OMP_PARALLEL regions. Since the end of a parallel region
+ is an implicit barrier, any workshare inside the GIMPLE_OMP_PARALLEL that
+ left a barrier at the end of the GIMPLE_OMP_PARALLEL region can now be
removed. */
static void
remove_exit_barrier (struct omp_region *region)
{
- block_stmt_iterator si;
+ gimple_stmt_iterator gsi;
basic_block exit_bb;
edge_iterator ei;
edge e;
- tree t;
+ gimple stmt;
exit_bb = region->exit;
@@ -3027,32 +3122,32 @@ remove_exit_barrier (struct omp_region *region)
if (! exit_bb)
return;
- /* The last insn in the block will be the parallel's OMP_RETURN. The
- workshare's OMP_RETURN will be in a preceding block. The kinds of
+ /* The last insn in the block will be the parallel's GIMPLE_OMP_RETURN. The
+ workshare's GIMPLE_OMP_RETURN will be in a preceding block. The kinds of
statements that can appear in between are extremely limited -- no
memory operations at all. Here, we allow nothing at all, so the
- only thing we allow to precede this OMP_RETURN is a label. */
- si = bsi_last (exit_bb);
- gcc_assert (TREE_CODE (bsi_stmt (si)) == OMP_RETURN);
- bsi_prev (&si);
- if (!bsi_end_p (si) && TREE_CODE (bsi_stmt (si)) != LABEL_EXPR)
+ only thing we allow to precede this GIMPLE_OMP_RETURN is a label. */
+ gsi = gsi_last_bb (exit_bb);
+ gcc_assert (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_RETURN);
+ gsi_prev (&gsi);
+ if (!gsi_end_p (gsi) && gimple_code (gsi_stmt (gsi)) != GIMPLE_LABEL)
return;
FOR_EACH_EDGE (e, ei, exit_bb->preds)
{
- si = bsi_last (e->src);
- if (bsi_end_p (si))
+ gsi = gsi_last_bb (e->src);
+ if (gsi_end_p (gsi))
continue;
- t = bsi_stmt (si);
- if (TREE_CODE (t) == OMP_RETURN)
- OMP_RETURN_NOWAIT (t) = 1;
+ stmt = gsi_stmt (gsi);
+ if (gimple_code (stmt) == GIMPLE_OMP_RETURN)
+ gimple_omp_return_set_nowait (stmt);
}
}
static void
remove_exit_barriers (struct omp_region *region)
{
- if (region->type == OMP_PARALLEL)
+ if (region->type == GIMPLE_OMP_PARALLEL)
remove_exit_barrier (region);
if (region->inner)
@@ -3076,27 +3171,26 @@ remove_exit_barriers (struct omp_region *region)
scheduling point. */
static void
-optimize_omp_library_calls (tree entry_stmt)
+optimize_omp_library_calls (gimple entry_stmt)
{
basic_block bb;
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
tree thr_num_id
= DECL_ASSEMBLER_NAME (built_in_decls [BUILT_IN_OMP_GET_THREAD_NUM]);
tree num_thr_id
= DECL_ASSEMBLER_NAME (built_in_decls [BUILT_IN_OMP_GET_NUM_THREADS]);
- bool untied_task = (TREE_CODE (entry_stmt) == OMP_TASK
- && find_omp_clause (OMP_TASK_CLAUSES (entry_stmt),
+ bool untied_task = (gimple_code (entry_stmt) == GIMPLE_OMP_TASK
+ && find_omp_clause (gimple_omp_task_clauses (entry_stmt),
OMP_CLAUSE_UNTIED) != NULL);
FOR_EACH_BB (bb)
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- tree stmt = bsi_stmt (bsi);
- tree call = get_call_expr_in (stmt);
+ gimple call = gsi_stmt (gsi);
tree decl;
- if (call
- && (decl = get_callee_fndecl (call))
+ if (is_gimple_call (call)
+ && (decl = gimple_call_fndecl (call))
&& DECL_EXTERNAL (decl)
&& TREE_PUBLIC (decl)
&& DECL_INITIAL (decl) == NULL)
@@ -3117,7 +3211,7 @@ optimize_omp_library_calls (tree entry_stmt)
continue;
if (DECL_ASSEMBLER_NAME (decl) != DECL_ASSEMBLER_NAME (built_in)
- || call_expr_nargs (call) != 0)
+ || gimple_call_num_args (call) != 0)
continue;
if (flag_exceptions && !TREE_NOTHROW (decl))
@@ -3128,7 +3222,7 @@ optimize_omp_library_calls (tree entry_stmt)
!= TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (built_in))))
continue;
- CALL_EXPR_FN (call) = build_fold_addr_expr (built_in);
+ gimple_call_set_fndecl (call, built_in);
}
}
}
@@ -3141,12 +3235,12 @@ expand_omp_taskreg (struct omp_region *region)
basic_block entry_bb, exit_bb, new_bb;
struct function *child_cfun;
tree child_fn, block, t, ws_args, *tp;
- block_stmt_iterator si;
- tree entry_stmt;
+ gimple_stmt_iterator gsi;
+ gimple entry_stmt, stmt;
edge e;
entry_stmt = last_stmt (region->entry);
- child_fn = OMP_TASKREG_FN (entry_stmt);
+ child_fn = gimple_omp_taskreg_child_fn (entry_stmt);
child_cfun = DECL_STRUCT_FUNCTION (child_fn);
/* If this function has been already instrumented, make sure
the child function isn't instrumented again. */
@@ -3166,14 +3260,14 @@ expand_omp_taskreg (struct omp_region *region)
the region, in which case all we need to do is make the
sub-graph unreachable and emit the parallel call. */
edge entry_succ_e, exit_succ_e;
- block_stmt_iterator si;
+ gimple_stmt_iterator gsi;
entry_succ_e = single_succ_edge (entry_bb);
- si = bsi_last (entry_bb);
- gcc_assert (TREE_CODE (bsi_stmt (si)) == OMP_PARALLEL
- || TREE_CODE (bsi_stmt (si)) == OMP_TASK);
- bsi_remove (&si, true);
+ gsi = gsi_last_bb (entry_bb);
+ gcc_assert (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_PARALLEL
+ || gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_TASK);
+ gsi_remove (&gsi, true);
new_bb = entry_bb;
if (exit_bb)
@@ -3198,41 +3292,52 @@ expand_omp_taskreg (struct omp_region *region)
a function call that has been inlined, the original PARM_DECL
.OMP_DATA_I may have been converted into a different local
variable. In which case, we need to keep the assignment. */
- if (OMP_TASKREG_DATA_ARG (entry_stmt))
+ if (gimple_omp_taskreg_data_arg (entry_stmt))
{
basic_block entry_succ_bb = single_succ (entry_bb);
- block_stmt_iterator si;
- tree parcopy_stmt = NULL_TREE, arg, narg;
+ gimple_stmt_iterator gsi;
+ tree arg, narg;
+ gimple parcopy_stmt = NULL;
- for (si = bsi_start (entry_succ_bb); ; bsi_next (&si))
+ for (gsi = gsi_start_bb (entry_succ_bb); ; gsi_next (&gsi))
{
- tree stmt, arg;
+ gimple stmt;
- gcc_assert (!bsi_end_p (si));
- stmt = bsi_stmt (si);
- if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
+ gcc_assert (!gsi_end_p (gsi));
+ stmt = gsi_stmt (gsi);
+ if (gimple_code (stmt) != GIMPLE_ASSIGN)
continue;
- arg = GIMPLE_STMT_OPERAND (stmt, 1);
- STRIP_NOPS (arg);
- if (TREE_CODE (arg) == ADDR_EXPR
- && TREE_OPERAND (arg, 0)
- == OMP_TASKREG_DATA_ARG (entry_stmt))
+ if (gimple_num_ops (stmt) == 2)
{
- parcopy_stmt = stmt;
- break;
+ tree arg = gimple_assign_rhs1 (stmt);
+
+ /* We're ignore the subcode because we're
+ effectively doing a STRIP_NOPS. */
+
+ if (TREE_CODE (arg) == ADDR_EXPR
+ && TREE_OPERAND (arg, 0)
+ == gimple_omp_taskreg_data_arg (entry_stmt))
+ {
+ parcopy_stmt = stmt;
+ break;
+ }
}
}
- gcc_assert (parcopy_stmt != NULL_TREE);
+ gcc_assert (parcopy_stmt != NULL);
arg = DECL_ARGUMENTS (child_fn);
if (!gimple_in_ssa_p (cfun))
{
- if (GIMPLE_STMT_OPERAND (parcopy_stmt, 0) == arg)
- bsi_remove (&si, true);
+ if (gimple_assign_lhs (parcopy_stmt) == arg)
+ gsi_remove (&gsi, true);
else
- GIMPLE_STMT_OPERAND (parcopy_stmt, 1) = arg;
+ {
+ /* ?? Is setting the subcode really necessary ?? */
+ gimple_omp_set_subcode (parcopy_stmt, TREE_CODE (arg));
+ gimple_assign_set_rhs1 (parcopy_stmt, arg);
+ }
}
else
{
@@ -3240,9 +3345,11 @@ expand_omp_taskreg (struct omp_region *region)
definition of the argument. That should not be defined now,
since the argument is not used uninitialized. */
gcc_assert (gimple_default_def (cfun, arg) == NULL);
- narg = make_ssa_name (arg, build_empty_stmt ());
+ narg = make_ssa_name (arg, gimple_build_nop ());
set_default_def (arg, narg);
- GIMPLE_STMT_OPERAND (parcopy_stmt, 1) = narg;
+ /* ?? Is setting the subcode really necessary ?? */
+ gimple_omp_set_subcode (parcopy_stmt, TREE_CODE (narg));
+ gimple_assign_set_rhs1 (parcopy_stmt, narg);
update_stmt (parcopy_stmt);
}
}
@@ -3250,33 +3357,34 @@ expand_omp_taskreg (struct omp_region *region)
/* Declare local variables needed in CHILD_CFUN. */
block = DECL_INITIAL (child_fn);
BLOCK_VARS (block) = list2chain (child_cfun->local_decls);
- DECL_SAVED_TREE (child_fn) = bb_stmt_list (single_succ (entry_bb));
+ DECL_SAVED_TREE (child_fn) = NULL;
+ gimple_set_body (child_fn, bb_seq (single_succ (entry_bb)));
TREE_USED (block) = 1;
/* Reset DECL_CONTEXT on function arguments. */
for (t = DECL_ARGUMENTS (child_fn); t; t = TREE_CHAIN (t))
DECL_CONTEXT (t) = child_fn;
- /* Split ENTRY_BB at OMP_PARALLEL or OMP_TASK, so that it can be
- moved to the child function. */
- si = bsi_last (entry_bb);
- t = bsi_stmt (si);
- gcc_assert (t && (TREE_CODE (t) == OMP_PARALLEL
- || TREE_CODE (t) == OMP_TASK));
- bsi_remove (&si, true);
- e = split_block (entry_bb, t);
+ /* Split ENTRY_BB at GIMPLE_OMP_PARALLEL or GIMPLE_OMP_TASK,
+ so that it can be moved to the child function. */
+ gsi = gsi_last_bb (entry_bb);
+ stmt = gsi_stmt (gsi);
+ gcc_assert (stmt && (gimple_code (stmt) == GIMPLE_OMP_PARALLEL
+ || gimple_code (stmt) == GIMPLE_OMP_TASK));
+ gsi_remove (&gsi, true);
+ e = split_block (entry_bb, stmt);
entry_bb = e->dest;
single_succ_edge (entry_bb)->flags = EDGE_FALLTHRU;
- /* Convert OMP_RETURN into a RETURN_EXPR. */
+ /* Convert GIMPLE_OMP_RETURN into a RETURN_EXPR. */
if (exit_bb)
{
- si = bsi_last (exit_bb);
- gcc_assert (!bsi_end_p (si)
- && TREE_CODE (bsi_stmt (si)) == OMP_RETURN);
- t = build1 (RETURN_EXPR, void_type_node, NULL);
- bsi_insert_after (&si, t, BSI_SAME_STMT);
- bsi_remove (&si, true);
+ gsi = gsi_last_bb (exit_bb);
+ gcc_assert (!gsi_end_p (gsi)
+ && gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_RETURN);
+ stmt = gimple_build_return (NULL);
+ gsi_insert_after (&gsi, stmt, GSI_SAME_STMT);
+ gsi_remove (&gsi, true);
}
/* Move the parallel region into CHILD_CFUN. */
@@ -3291,7 +3399,7 @@ expand_omp_taskreg (struct omp_region *region)
block = NULL_TREE;
}
else
- block = TREE_BLOCK (entry_stmt);
+ block = gimple_block (entry_stmt);
new_bb = move_sese_region_to_fn (child_cfun, entry_bb, exit_bb, block);
if (exit_bb)
@@ -3328,7 +3436,7 @@ expand_omp_taskreg (struct omp_region *region)
current_function_decl = child_fn;
FOR_EACH_BB (bb)
- changed |= tree_purge_dead_eh_edges (bb);
+ changed |= gimple_purge_dead_eh_edges (bb);
if (changed)
cleanup_tree_cfg ();
current_function_decl = save_current;
@@ -3337,7 +3445,7 @@ expand_omp_taskreg (struct omp_region *region)
}
/* Emit a library call to launch the children threads. */
- if (TREE_CODE (entry_stmt) == OMP_PARALLEL)
+ if (gimple_code (entry_stmt) == GIMPLE_OMP_PARALLEL)
expand_parallel_call (region, new_bb, entry_stmt, ws_args);
else
expand_task_call (new_bb, entry_stmt);
@@ -3431,11 +3539,12 @@ expand_omp_for_generic (struct omp_region *region,
enum built_in_function start_fn,
enum built_in_function next_fn)
{
- tree type, istart0, iend0, iend, phi;
+ tree type, istart0, iend0, iend;
tree t, vmain, vback, bias = NULL_TREE;
basic_block entry_bb, cont_bb, exit_bb, l0_bb, l1_bb, collapse_bb;
basic_block l2_bb = NULL, l3_bb = NULL;
- block_stmt_iterator si;
+ gimple_stmt_iterator gsi;
+ gimple stmt;
bool in_combined_parallel = is_combined_parallel (region);
bool broken_loop = region->cont == NULL;
edge e, ne;
@@ -3499,9 +3608,9 @@ expand_omp_for_generic (struct omp_region *region,
l3_bb = BRANCH_EDGE (entry_bb)->dest;
exit_bb = region->exit;
- si = bsi_last (entry_bb);
+ gsi = gsi_last_bb (entry_bb);
- gcc_assert (TREE_CODE (bsi_stmt (si)) == OMP_FOR);
+ gcc_assert (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_FOR);
if (fd->collapse > 1)
{
/* collapsed loops need work for expansion in SSA form. */
@@ -3536,21 +3645,23 @@ expand_omp_for_generic (struct omp_region *region,
else
{
counts[i] = create_tmp_var (type, ".count");
- t = build_gimple_modify_stmt (counts[i], t);
- force_gimple_operand_bsi (&si, t, true, NULL_TREE,
- true, BSI_SAME_STMT);
+ t = force_gimple_operand_gsi (&gsi, t, false, NULL_TREE,
+ true, GSI_SAME_STMT);
+ stmt = gimple_build_assign (counts[i], t);
+ gsi_insert_before (&gsi, stmt, GSI_SAME_STMT);
}
if (SSA_VAR_P (fd->loop.n2))
{
if (i == 0)
- t = build_gimple_modify_stmt (fd->loop.n2, counts[0]);
+ t = counts[0];
else
{
t = fold_build2 (MULT_EXPR, type, fd->loop.n2, counts[i]);
- t = build_gimple_modify_stmt (fd->loop.n2, t);
+ t = force_gimple_operand_gsi (&gsi, t, false, NULL_TREE,
+ true, GSI_SAME_STMT);
}
- force_gimple_operand_bsi (&si, t, true, NULL_TREE,
- true, BSI_SAME_STMT);
+ stmt = gimple_build_assign (fd->loop.n2, t);
+ gsi_insert_before (&gsi, stmt, GSI_SAME_STMT);
}
}
}
@@ -3615,41 +3726,38 @@ expand_omp_for_generic (struct omp_region *region,
if (TREE_TYPE (t) != boolean_type_node)
t = fold_build2 (NE_EXPR, boolean_type_node,
t, build_int_cst (TREE_TYPE (t), 0));
- t = force_gimple_operand_bsi (&si, t, true, NULL_TREE,
- true, BSI_SAME_STMT);
- t = build3 (COND_EXPR, void_type_node, t, NULL_TREE, NULL_TREE);
- bsi_insert_after (&si, t, BSI_SAME_STMT);
+ t = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE,
+ true, GSI_SAME_STMT);
+ gsi_insert_after (&gsi, gimple_build_cond_empty (t), GSI_SAME_STMT);
- /* Remove the OMP_FOR statement. */
- bsi_remove (&si, true);
+ /* Remove the GIMPLE_OMP_FOR statement. */
+ gsi_remove (&gsi, true);
/* Iteration setup for sequential loop goes in L0_BB. */
- si = bsi_start (l0_bb);
+ gsi = gsi_start_bb (l0_bb);
if (bias)
t = fold_convert (type, fold_build2 (MINUS_EXPR, fd->iter_type,
istart0, bias));
else
t = fold_convert (type, istart0);
- t = force_gimple_operand_bsi (&si, t, false, NULL_TREE,
- false, BSI_CONTINUE_LINKING);
- t = build_gimple_modify_stmt (fd->loop.v, t);
- bsi_insert_after (&si, t, BSI_CONTINUE_LINKING);
- if (gimple_in_ssa_p (cfun))
- SSA_NAME_DEF_STMT (fd->loop.v) = t;
+ t = force_gimple_operand_gsi (&gsi, t, false, NULL_TREE,
+ false, GSI_CONTINUE_LINKING);
+ stmt = gimple_build_assign (fd->loop.v, t);
+ gsi_insert_after (&gsi, stmt, GSI_CONTINUE_LINKING);
if (bias)
t = fold_convert (type, fold_build2 (MINUS_EXPR, fd->iter_type,
iend0, bias));
else
t = fold_convert (type, iend0);
- iend = force_gimple_operand_bsi (&si, t, true, NULL_TREE,
- false, BSI_CONTINUE_LINKING);
+ iend = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE,
+ false, GSI_CONTINUE_LINKING);
if (fd->collapse > 1)
{
tree tem = create_tmp_var (type, ".tem");
- t = build_gimple_modify_stmt (tem, fd->loop.v);
- bsi_insert_after (&si, t, BSI_CONTINUE_LINKING);
+ stmt = gimple_build_assign (tem, fd->loop.v);
+ gsi_insert_after (&gsi, stmt, GSI_CONTINUE_LINKING);
for (i = fd->collapse - 1; i >= 0; i--)
{
tree vtype = TREE_TYPE (fd->loops[i].v), itype;
@@ -3664,15 +3772,17 @@ expand_omp_for_generic (struct omp_region *region,
fd->loops[i].n1, fold_convert (sizetype, t));
else
t = fold_build2 (PLUS_EXPR, itype, fd->loops[i].n1, t);
- t = build_gimple_modify_stmt (fd->loops[i].v, t);
- force_gimple_operand_bsi (&si, t, true, NULL_TREE,
- false, BSI_CONTINUE_LINKING);
+ t = force_gimple_operand_gsi (&gsi, t, false, NULL_TREE,
+ false, GSI_CONTINUE_LINKING);
+ stmt = gimple_build_assign (fd->loops[i].v, t);
+ gsi_insert_after (&gsi, stmt, GSI_CONTINUE_LINKING);
if (i != 0)
{
t = fold_build2 (TRUNC_DIV_EXPR, type, tem, counts[i]);
- t = build_gimple_modify_stmt (tem, t);
- force_gimple_operand_bsi (&si, t, true, NULL_TREE,
- false, BSI_CONTINUE_LINKING);
+ t = force_gimple_operand_gsi (&gsi, t, false, NULL_TREE,
+ false, GSI_CONTINUE_LINKING);
+ stmt = gimple_build_assign (tem, t);
+ gsi_insert_after (&gsi, stmt, GSI_CONTINUE_LINKING);
}
}
}
@@ -3681,30 +3791,28 @@ expand_omp_for_generic (struct omp_region *region,
{
/* Code to control the increment and predicate for the sequential
loop goes in the CONT_BB. */
- si = bsi_last (cont_bb);
- t = bsi_stmt (si);
- gcc_assert (TREE_CODE (t) == OMP_CONTINUE);
- vmain = TREE_OPERAND (t, 1);
- vback = TREE_OPERAND (t, 0);
+ gsi = gsi_last_bb (cont_bb);
+ stmt = gsi_stmt (gsi);
+ gcc_assert (gimple_code (stmt) == GIMPLE_OMP_CONTINUE);
+ vmain = gimple_omp_continue_control_use (stmt);
+ vback = gimple_omp_continue_control_def (stmt);
if (POINTER_TYPE_P (type))
t = fold_build2 (POINTER_PLUS_EXPR, type, vmain,
fold_convert (sizetype, fd->loop.step));
else
t = fold_build2 (PLUS_EXPR, type, vmain, fd->loop.step);
- t = force_gimple_operand_bsi (&si, t, false, NULL_TREE,
- true, BSI_SAME_STMT);
- t = build_gimple_modify_stmt (vback, t);
- bsi_insert_before (&si, t, BSI_SAME_STMT);
- if (gimple_in_ssa_p (cfun))
- SSA_NAME_DEF_STMT (vback) = t;
-
+ t = force_gimple_operand_gsi (&gsi, t, false, NULL_TREE,
+ true, GSI_SAME_STMT);
+ stmt = gimple_build_assign (vback, t);
+ gsi_insert_before (&gsi, stmt, GSI_SAME_STMT);
+
t = build2 (fd->loop.cond_code, boolean_type_node, vback, iend);
- t = build3 (COND_EXPR, void_type_node, t, NULL_TREE, NULL_TREE);
- bsi_insert_before (&si, t, BSI_SAME_STMT);
+ stmt = gimple_build_cond_empty (t);
+ gsi_insert_before (&gsi, stmt, GSI_SAME_STMT);
- /* Remove OMP_CONTINUE. */
- bsi_remove (&si, true);
+ /* Remove GIMPLE_OMP_CONTINUE. */
+ gsi_remove (&gsi, true);
if (fd->collapse > 1)
{
@@ -3716,17 +3824,18 @@ expand_omp_for_generic (struct omp_region *region,
tree vtype = TREE_TYPE (fd->loops[i].v);
bb = create_empty_bb (last_bb);
- si = bsi_start (bb);
+ gsi = gsi_start_bb (bb);
if (i < fd->collapse - 1)
{
e = make_edge (last_bb, bb, EDGE_FALSE_VALUE);
e->probability = REG_BR_PROB_BASE / 8;
- t = build_gimple_modify_stmt (fd->loops[i + 1].v,
- fd->loops[i + 1].n1);
- force_gimple_operand_bsi (&si, t, true, NULL_TREE,
- false, BSI_CONTINUE_LINKING);
+ t = fd->loops[i + 1].n1;
+ t = force_gimple_operand_gsi (&gsi, t, false, NULL_TREE,
+ false, GSI_CONTINUE_LINKING);
+ stmt = gimple_build_assign (fd->loops[i + 1].v, t);
+ gsi_insert_after (&gsi, stmt, GSI_CONTINUE_LINKING);
}
else
collapse_bb = bb;
@@ -3740,19 +3849,20 @@ expand_omp_for_generic (struct omp_region *region,
else
t = fold_build2 (PLUS_EXPR, vtype, fd->loops[i].v,
fd->loops[i].step);
- t = build_gimple_modify_stmt (fd->loops[i].v, t);
- force_gimple_operand_bsi (&si, t, true, NULL_TREE,
- false, BSI_CONTINUE_LINKING);
+ t = force_gimple_operand_gsi (&gsi, t, false, NULL_TREE,
+ false, GSI_CONTINUE_LINKING);
+ stmt = gimple_build_assign (fd->loops[i].v, t);
+ gsi_insert_after (&gsi, stmt, GSI_CONTINUE_LINKING);
if (i > 0)
{
+ t = fd->loops[i].n2;
+ t = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE,
+ false, GSI_CONTINUE_LINKING);
t = fold_build2 (fd->loops[i].cond_code, boolean_type_node,
- fd->loops[i].v, fd->loops[i].n2);
- t = force_gimple_operand_bsi (&si, t, false, NULL_TREE,
- false, BSI_CONTINUE_LINKING);
- t = build3 (COND_EXPR, void_type_node, t,
- NULL_TREE, NULL_TREE);
- bsi_insert_after (&si, t, BSI_CONTINUE_LINKING);
+ fd->loops[i].v, t);
+ stmt = gimple_build_cond_empty (t);
+ gsi_insert_after (&gsi, stmt, GSI_CONTINUE_LINKING);
e = make_edge (bb, l1_bb, EDGE_TRUE_VALUE);
e->probability = REG_BR_PROB_BASE * 7 / 8;
}
@@ -3763,29 +3873,29 @@ expand_omp_for_generic (struct omp_region *region,
}
/* Emit code to get the next parallel iteration in L2_BB. */
- si = bsi_start (l2_bb);
+ gsi = gsi_start_bb (l2_bb);
t = build_call_expr (built_in_decls[next_fn], 2,
build_fold_addr_expr (istart0),
build_fold_addr_expr (iend0));
+ t = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE,
+ false, GSI_CONTINUE_LINKING);
if (TREE_TYPE (t) != boolean_type_node)
t = fold_build2 (NE_EXPR, boolean_type_node,
t, build_int_cst (TREE_TYPE (t), 0));
- t = force_gimple_operand_bsi (&si, t, true, NULL_TREE,
- false, BSI_CONTINUE_LINKING);
- t = build3 (COND_EXPR, void_type_node, t, NULL_TREE, NULL_TREE);
- bsi_insert_after (&si, t, BSI_CONTINUE_LINKING);
+ stmt = gimple_build_cond_empty (t);
+ gsi_insert_after (&gsi, stmt, GSI_CONTINUE_LINKING);
}
/* Add the loop cleanup function. */
- si = bsi_last (exit_bb);
- if (OMP_RETURN_NOWAIT (bsi_stmt (si)))
+ gsi = gsi_last_bb (exit_bb);
+ if (gimple_omp_return_nowait_p (gsi_stmt (gsi)))
t = built_in_decls[BUILT_IN_GOMP_LOOP_END_NOWAIT];
else
t = built_in_decls[BUILT_IN_GOMP_LOOP_END];
- t = build_call_expr (t, 0);
- bsi_insert_after (&si, t, BSI_SAME_STMT);
- bsi_remove (&si, true);
+ stmt = gimple_build_call (t, 0);
+ gsi_insert_after (&gsi, stmt, GSI_SAME_STMT);
+ gsi_remove (&gsi, true);
/* Connect the new blocks. */
find_edge (entry_bb, l0_bb)->flags = EDGE_TRUE_VALUE;
@@ -3793,12 +3903,18 @@ expand_omp_for_generic (struct omp_region *region,
if (!broken_loop)
{
+ gimple_seq phis;
+
e = find_edge (cont_bb, l3_bb);
ne = make_edge (l2_bb, l3_bb, EDGE_FALSE_VALUE);
- for (phi = phi_nodes (l3_bb); phi; phi = PHI_CHAIN (phi))
- SET_USE (PHI_ARG_DEF_PTR_FROM_EDGE (phi, ne),
- PHI_ARG_DEF_FROM_EDGE (phi, e));
+ phis = phi_nodes (l3_bb);
+ for (gsi = gsi_start (phis); !gsi_end_p (gsi); gsi_next (&gsi))
+ {
+ gimple phi = gsi_stmt (gsi);
+ SET_USE (PHI_ARG_DEF_PTR_FROM_EDGE (phi, ne),
+ PHI_ARG_DEF_FROM_EDGE (phi, e));
+ }
remove_edge (e);
make_edge (cont_bb, l2_bb, EDGE_FALSE_VALUE);
@@ -3868,7 +3984,8 @@ expand_omp_for_static_nochunk (struct omp_region *region,
tree type, itype, vmain, vback;
basic_block entry_bb, exit_bb, seq_start_bb, body_bb, cont_bb;
basic_block fin_bb;
- block_stmt_iterator si;
+ gimple_stmt_iterator gsi;
+ gimple stmt;
itype = type = TREE_TYPE (fd->loop.v);
if (POINTER_TYPE_P (type))
@@ -3886,28 +4003,28 @@ expand_omp_for_static_nochunk (struct omp_region *region,
exit_bb = region->exit;
/* Iteration space partitioning goes in ENTRY_BB. */
- si = bsi_last (entry_bb);
- gcc_assert (TREE_CODE (bsi_stmt (si)) == OMP_FOR);
+ gsi = gsi_last_bb (entry_bb);
+ gcc_assert (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_FOR);
t = build_call_expr (built_in_decls[BUILT_IN_OMP_GET_NUM_THREADS], 0);
t = fold_convert (itype, t);
- nthreads = force_gimple_operand_bsi (&si, t, true, NULL_TREE,
- true, BSI_SAME_STMT);
+ nthreads = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE,
+ true, GSI_SAME_STMT);
t = build_call_expr (built_in_decls[BUILT_IN_OMP_GET_THREAD_NUM], 0);
t = fold_convert (itype, t);
- threadid = force_gimple_operand_bsi (&si, t, true, NULL_TREE,
- true, BSI_SAME_STMT);
+ threadid = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE,
+ true, GSI_SAME_STMT);
fd->loop.n1
- = force_gimple_operand_bsi (&si, fold_convert (type, fd->loop.n1),
- true, NULL_TREE, true, BSI_SAME_STMT);
+ = force_gimple_operand_gsi (&gsi, fold_convert (type, fd->loop.n1),
+ true, NULL_TREE, true, GSI_SAME_STMT);
fd->loop.n2
- = force_gimple_operand_bsi (&si, fold_convert (itype, fd->loop.n2),
- true, NULL_TREE, true, BSI_SAME_STMT);
+ = force_gimple_operand_gsi (&gsi, fold_convert (itype, fd->loop.n2),
+ true, NULL_TREE, true, GSI_SAME_STMT);
fd->loop.step
- = force_gimple_operand_bsi (&si, fold_convert (itype, fd->loop.step),
- true, NULL_TREE, true, BSI_SAME_STMT);
+ = force_gimple_operand_gsi (&gsi, fold_convert (itype, fd->loop.step),
+ true, NULL_TREE, true, GSI_SAME_STMT);
t = build_int_cst (itype, (fd->loop.cond_code == LT_EXPR ? -1 : 1));
t = fold_build2 (PLUS_EXPR, itype, fd->loop.step, t);
@@ -3920,32 +4037,31 @@ expand_omp_for_static_nochunk (struct omp_region *region,
else
t = fold_build2 (TRUNC_DIV_EXPR, itype, t, fd->loop.step);
t = fold_convert (itype, t);
- n = force_gimple_operand_bsi (&si, t, true, NULL_TREE, true, BSI_SAME_STMT);
+ n = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE, true, GSI_SAME_STMT);
t = fold_build2 (TRUNC_DIV_EXPR, itype, n, nthreads);
- q = force_gimple_operand_bsi (&si, t, true, NULL_TREE, true, BSI_SAME_STMT);
+ q = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE, true, GSI_SAME_STMT);
t = fold_build2 (MULT_EXPR, itype, q, nthreads);
t = fold_build2 (NE_EXPR, itype, t, n);
t = fold_build2 (PLUS_EXPR, itype, q, t);
- q = force_gimple_operand_bsi (&si, t, true, NULL_TREE, true, BSI_SAME_STMT);
+ q = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE, true, GSI_SAME_STMT);
t = build2 (MULT_EXPR, itype, q, threadid);
- s0 = force_gimple_operand_bsi (&si, t, true, NULL_TREE, true, BSI_SAME_STMT);
+ s0 = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE, true, GSI_SAME_STMT);
t = fold_build2 (PLUS_EXPR, itype, s0, q);
t = fold_build2 (MIN_EXPR, itype, t, n);
- e0 = force_gimple_operand_bsi (&si, t, true, NULL_TREE, true, BSI_SAME_STMT);
+ e0 = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE, true, GSI_SAME_STMT);
t = build2 (GE_EXPR, boolean_type_node, s0, e0);
- t = build3 (COND_EXPR, void_type_node, t, NULL_TREE, NULL_TREE);
- bsi_insert_before (&si, t, BSI_SAME_STMT);
+ gsi_insert_before (&gsi, gimple_build_cond_empty (t), GSI_SAME_STMT);
- /* Remove the OMP_FOR statement. */
- bsi_remove (&si, true);
+ /* Remove the GIMPLE_OMP_FOR statement. */
+ gsi_remove (&gsi, true);
/* Setup code for sequential iteration goes in SEQ_START_BB. */
- si = bsi_start (seq_start_bb);
+ gsi = gsi_start_bb (seq_start_bb);
t = fold_convert (itype, s0);
t = fold_build2 (MULT_EXPR, itype, t, fd->loop.step);
@@ -3954,13 +4070,11 @@ expand_omp_for_static_nochunk (struct omp_region *region,
fold_convert (sizetype, t));
else
t = fold_build2 (PLUS_EXPR, type, t, fd->loop.n1);
- t = force_gimple_operand_bsi (&si, t, false, NULL_TREE,
- false, BSI_CONTINUE_LINKING);
- t = build_gimple_modify_stmt (fd->loop.v, t);
- bsi_insert_after (&si, t, BSI_CONTINUE_LINKING);
- if (gimple_in_ssa_p (cfun))
- SSA_NAME_DEF_STMT (fd->loop.v) = t;
-
+ t = force_gimple_operand_gsi (&gsi, t, false, NULL_TREE,
+ false, GSI_CONTINUE_LINKING);
+ stmt = gimple_build_assign (fd->loop.v, t);
+ gsi_insert_after (&gsi, stmt, GSI_CONTINUE_LINKING);
+
t = fold_convert (itype, e0);
t = fold_build2 (MULT_EXPR, itype, t, fd->loop.step);
if (POINTER_TYPE_P (type))
@@ -3968,41 +4082,39 @@ expand_omp_for_static_nochunk (struct omp_region *region,
fold_convert (sizetype, t));
else
t = fold_build2 (PLUS_EXPR, type, t, fd->loop.n1);
- e = force_gimple_operand_bsi (&si, t, true, NULL_TREE,
- false, BSI_CONTINUE_LINKING);
+ e = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE,
+ false, GSI_CONTINUE_LINKING);
- /* The code controlling the sequential loop replaces the OMP_CONTINUE. */
- si = bsi_last (cont_bb);
- t = bsi_stmt (si);
- gcc_assert (TREE_CODE (t) == OMP_CONTINUE);
- vmain = TREE_OPERAND (t, 1);
- vback = TREE_OPERAND (t, 0);
+ /* The code controlling the sequential loop replaces the
+ GIMPLE_OMP_CONTINUE. */
+ gsi = gsi_last_bb (cont_bb);
+ stmt = gsi_stmt (gsi);
+ gcc_assert (gimple_code (stmt) == GIMPLE_OMP_CONTINUE);
+ vmain = gimple_omp_continue_control_use (stmt);
+ vback = gimple_omp_continue_control_def (stmt);
if (POINTER_TYPE_P (type))
t = fold_build2 (POINTER_PLUS_EXPR, type, vmain,
fold_convert (sizetype, fd->loop.step));
else
t = fold_build2 (PLUS_EXPR, type, vmain, fd->loop.step);
- t = force_gimple_operand_bsi (&si, t, false, NULL_TREE,
- true, BSI_SAME_STMT);
- t = build_gimple_modify_stmt (vback, t);
- bsi_insert_before (&si, t, BSI_SAME_STMT);
- if (gimple_in_ssa_p (cfun))
- SSA_NAME_DEF_STMT (vback) = t;
+ t = force_gimple_operand_gsi (&gsi, t, false, NULL_TREE,
+ true, GSI_SAME_STMT);
+ stmt = gimple_build_assign (vback, t);
+ gsi_insert_before (&gsi, stmt, GSI_SAME_STMT);
t = build2 (fd->loop.cond_code, boolean_type_node, vback, e);
- t = build3 (COND_EXPR, void_type_node, t, NULL_TREE, NULL_TREE);
- bsi_insert_before (&si, t, BSI_SAME_STMT);
+ gsi_insert_before (&gsi, gimple_build_cond_empty (t), GSI_SAME_STMT);
- /* Remove the OMP_CONTINUE statement. */
- bsi_remove (&si, true);
+ /* Remove the GIMPLE_OMP_CONTINUE statement. */
+ gsi_remove (&gsi, true);
- /* Replace the OMP_RETURN with a barrier, or nothing. */
- si = bsi_last (exit_bb);
- if (!OMP_RETURN_NOWAIT (bsi_stmt (si)))
- force_gimple_operand_bsi (&si, build_omp_barrier (), false, NULL_TREE,
- false, BSI_SAME_STMT);
- bsi_remove (&si, true);
+ /* Replace the GIMPLE_OMP_RETURN with a barrier, or nothing. */
+ gsi = gsi_last_bb (exit_bb);
+ if (!gimple_omp_return_nowait_p (gsi_stmt (gsi)))
+ force_gimple_operand_gsi (&gsi, build_omp_barrier (), false, NULL_TREE,
+ false, GSI_SAME_STMT);
+ gsi_remove (&gsi, true);
/* Connect all the blocks. */
find_edge (entry_bb, seq_start_bb)->flags = EDGE_FALSE_VALUE;
@@ -4057,16 +4169,16 @@ expand_omp_for_static_nochunk (struct omp_region *region,
*/
static void
-expand_omp_for_static_chunk (struct omp_region *region,
- struct omp_for_data *fd)
+expand_omp_for_static_chunk (struct omp_region *region, struct omp_for_data *fd)
{
- tree n, s0, e0, e, t, phi, nphi, args;
+ tree n, s0, e0, e, t;
tree trip_var, trip_init, trip_main, trip_back, nthreads, threadid;
- tree type, itype, cont, v_main, v_back, v_extra;
+ tree type, itype, v_main, v_back, v_extra;
basic_block entry_bb, exit_bb, body_bb, seq_start_bb, iter_part_bb;
basic_block trip_update_bb, cont_bb, fin_bb;
- block_stmt_iterator si;
- edge se, re, ene;
+ gimple_stmt_iterator si;
+ gimple stmt;
+ edge se;
itype = type = TREE_TYPE (fd->loop.v);
if (POINTER_TYPE_P (type))
@@ -4089,31 +4201,31 @@ expand_omp_for_static_chunk (struct omp_region *region,
exit_bb = region->exit;
/* Trip and adjustment setup goes in ENTRY_BB. */
- si = bsi_last (entry_bb);
- gcc_assert (TREE_CODE (bsi_stmt (si)) == OMP_FOR);
+ si = gsi_last_bb (entry_bb);
+ gcc_assert (gimple_code (gsi_stmt (si)) == GIMPLE_OMP_FOR);
t = build_call_expr (built_in_decls[BUILT_IN_OMP_GET_NUM_THREADS], 0);
t = fold_convert (itype, t);
- nthreads = force_gimple_operand_bsi (&si, t, true, NULL_TREE,
- true, BSI_SAME_STMT);
+ nthreads = force_gimple_operand_gsi (&si, t, true, NULL_TREE,
+ true, GSI_SAME_STMT);
t = build_call_expr (built_in_decls[BUILT_IN_OMP_GET_THREAD_NUM], 0);
t = fold_convert (itype, t);
- threadid = force_gimple_operand_bsi (&si, t, true, NULL_TREE,
- true, BSI_SAME_STMT);
+ threadid = force_gimple_operand_gsi (&si, t, true, NULL_TREE,
+ true, GSI_SAME_STMT);
fd->loop.n1
- = force_gimple_operand_bsi (&si, fold_convert (type, fd->loop.n1),
- true, NULL_TREE, true, BSI_SAME_STMT);
+ = force_gimple_operand_gsi (&si, fold_convert (type, fd->loop.n1),
+ true, NULL_TREE, true, GSI_SAME_STMT);
fd->loop.n2
- = force_gimple_operand_bsi (&si, fold_convert (itype, fd->loop.n2),
- true, NULL_TREE, true, BSI_SAME_STMT);
+ = force_gimple_operand_gsi (&si, fold_convert (itype, fd->loop.n2),
+ true, NULL_TREE, true, GSI_SAME_STMT);
fd->loop.step
- = force_gimple_operand_bsi (&si, fold_convert (itype, fd->loop.step),
- true, NULL_TREE, true, BSI_SAME_STMT);
+ = force_gimple_operand_gsi (&si, fold_convert (itype, fd->loop.step),
+ true, NULL_TREE, true, GSI_SAME_STMT);
fd->chunk_size
- = force_gimple_operand_bsi (&si, fold_convert (itype, fd->chunk_size),
- true, NULL_TREE, true, BSI_SAME_STMT);
+ = force_gimple_operand_gsi (&si, fold_convert (itype, fd->chunk_size),
+ true, NULL_TREE, true, GSI_SAME_STMT);
t = build_int_cst (itype, (fd->loop.cond_code == LT_EXPR ? -1 : 1));
t = fold_build2 (PLUS_EXPR, itype, fd->loop.step, t);
@@ -4126,16 +4238,16 @@ expand_omp_for_static_chunk (struct omp_region *region,
else
t = fold_build2 (TRUNC_DIV_EXPR, itype, t, fd->loop.step);
t = fold_convert (itype, t);
- n = force_gimple_operand_bsi (&si, t, true, NULL_TREE,
- true, BSI_SAME_STMT);
+ n = force_gimple_operand_gsi (&si, t, true, NULL_TREE,
+ true, GSI_SAME_STMT);
trip_var = create_tmp_var (itype, ".trip");
if (gimple_in_ssa_p (cfun))
{
add_referenced_var (trip_var);
- trip_init = make_ssa_name (trip_var, NULL_TREE);
- trip_main = make_ssa_name (trip_var, NULL_TREE);
- trip_back = make_ssa_name (trip_var, NULL_TREE);
+ trip_init = make_ssa_name (trip_var, NULL);
+ trip_main = make_ssa_name (trip_var, NULL);
+ trip_back = make_ssa_name (trip_var, NULL);
}
else
{
@@ -4144,10 +4256,8 @@ expand_omp_for_static_chunk (struct omp_region *region,
trip_back = trip_var;
}
- t = build_gimple_modify_stmt (trip_init, build_int_cst (itype, 0));
- bsi_insert_before (&si, t, BSI_SAME_STMT);
- if (gimple_in_ssa_p (cfun))
- SSA_NAME_DEF_STMT (trip_init) = t;
+ stmt = gimple_build_assign (trip_init, build_int_cst (itype, 0));
+ gsi_insert_before (&si, stmt, GSI_SAME_STMT);
t = fold_build2 (MULT_EXPR, itype, threadid, fd->chunk_size);
t = fold_build2 (MULT_EXPR, itype, t, fd->loop.step);
@@ -4156,32 +4266,31 @@ expand_omp_for_static_chunk (struct omp_region *region,
fold_convert (sizetype, t));
else
t = fold_build2 (PLUS_EXPR, type, t, fd->loop.n1);
- v_extra = force_gimple_operand_bsi (&si, t, true, NULL_TREE,
- true, BSI_SAME_STMT);
+ v_extra = force_gimple_operand_gsi (&si, t, true, NULL_TREE,
+ true, GSI_SAME_STMT);
- /* Remove the OMP_FOR. */
- bsi_remove (&si, true);
+ /* Remove the GIMPLE_OMP_FOR. */
+ gsi_remove (&si, true);
/* Iteration space partitioning goes in ITER_PART_BB. */
- si = bsi_last (iter_part_bb);
+ si = gsi_last_bb (iter_part_bb);
t = fold_build2 (MULT_EXPR, itype, trip_main, nthreads);
t = fold_build2 (PLUS_EXPR, itype, t, threadid);
t = fold_build2 (MULT_EXPR, itype, t, fd->chunk_size);
- s0 = force_gimple_operand_bsi (&si, t, true, NULL_TREE,
- false, BSI_CONTINUE_LINKING);
+ s0 = force_gimple_operand_gsi (&si, t, true, NULL_TREE,
+ false, GSI_CONTINUE_LINKING);
t = fold_build2 (PLUS_EXPR, itype, s0, fd->chunk_size);
t = fold_build2 (MIN_EXPR, itype, t, n);
- e0 = force_gimple_operand_bsi (&si, t, true, NULL_TREE,
- false, BSI_CONTINUE_LINKING);
+ e0 = force_gimple_operand_gsi (&si, t, true, NULL_TREE,
+ false, GSI_CONTINUE_LINKING);
t = build2 (LT_EXPR, boolean_type_node, s0, n);
- t = build3 (COND_EXPR, void_type_node, t, NULL_TREE, NULL_TREE);
- bsi_insert_after (&si, t, BSI_CONTINUE_LINKING);
+ gsi_insert_after (&si, gimple_build_cond_empty (t), GSI_CONTINUE_LINKING);
/* Setup code for sequential iteration goes in SEQ_START_BB. */
- si = bsi_start (seq_start_bb);
+ si = gsi_start_bb (seq_start_bb);
t = fold_convert (itype, s0);
t = fold_build2 (MULT_EXPR, itype, t, fd->loop.step);
@@ -4190,12 +4299,10 @@ expand_omp_for_static_chunk (struct omp_region *region,
fold_convert (sizetype, t));
else
t = fold_build2 (PLUS_EXPR, type, t, fd->loop.n1);
- t = force_gimple_operand_bsi (&si, t, false, NULL_TREE,
- false, BSI_CONTINUE_LINKING);
- t = build_gimple_modify_stmt (fd->loop.v, t);
- bsi_insert_after (&si, t, BSI_CONTINUE_LINKING);
- if (gimple_in_ssa_p (cfun))
- SSA_NAME_DEF_STMT (fd->loop.v) = t;
+ t = force_gimple_operand_gsi (&si, t, false, NULL_TREE,
+ false, GSI_CONTINUE_LINKING);
+ stmt = gimple_build_assign (fd->loop.v, t);
+ gsi_insert_after (&si, stmt, GSI_CONTINUE_LINKING);
t = fold_convert (itype, e0);
t = fold_build2 (MULT_EXPR, itype, t, fd->loop.step);
@@ -4204,50 +4311,45 @@ expand_omp_for_static_chunk (struct omp_region *region,
fold_convert (sizetype, t));
else
t = fold_build2 (PLUS_EXPR, type, t, fd->loop.n1);
- e = force_gimple_operand_bsi (&si, t, true, NULL_TREE,
- false, BSI_CONTINUE_LINKING);
+ e = force_gimple_operand_gsi (&si, t, true, NULL_TREE,
+ false, GSI_CONTINUE_LINKING);
/* The code controlling the sequential loop goes in CONT_BB,
- replacing the OMP_CONTINUE. */
- si = bsi_last (cont_bb);
- cont = bsi_stmt (si);
- gcc_assert (TREE_CODE (cont) == OMP_CONTINUE);
- v_main = TREE_OPERAND (cont, 1);
- v_back = TREE_OPERAND (cont, 0);
+ replacing the GIMPLE_OMP_CONTINUE. */
+ si = gsi_last_bb (cont_bb);
+ stmt = gsi_stmt (si);
+ gcc_assert (gimple_code (stmt) == GIMPLE_OMP_CONTINUE);
+ v_main = gimple_omp_continue_control_use (stmt);
+ v_back = gimple_omp_continue_control_def (stmt);
if (POINTER_TYPE_P (type))
t = fold_build2 (POINTER_PLUS_EXPR, type, v_main,
fold_convert (sizetype, fd->loop.step));
else
- t = build2 (PLUS_EXPR, type, v_main, fd->loop.step);
- t = build_gimple_modify_stmt (v_back, t);
- bsi_insert_before (&si, t, BSI_SAME_STMT);
- if (gimple_in_ssa_p (cfun))
- SSA_NAME_DEF_STMT (v_back) = t;
+ t = fold_build2 (PLUS_EXPR, type, v_main, fd->loop.step);
+ stmt = gimple_build_assign (v_back, t);
+ gsi_insert_before (&si, stmt, GSI_SAME_STMT);
t = build2 (fd->loop.cond_code, boolean_type_node, v_back, e);
- t = build3 (COND_EXPR, void_type_node, t, NULL_TREE, NULL_TREE);
- bsi_insert_before (&si, t, BSI_SAME_STMT);
+ gsi_insert_before (&si, gimple_build_cond_empty (t), GSI_SAME_STMT);
- /* Remove OMP_CONTINUE. */
- bsi_remove (&si, true);
+ /* Remove GIMPLE_OMP_CONTINUE. */
+ gsi_remove (&si, true);
/* Trip update code goes into TRIP_UPDATE_BB. */
- si = bsi_start (trip_update_bb);
+ si = gsi_start_bb (trip_update_bb);
t = build_int_cst (itype, 1);
t = build2 (PLUS_EXPR, itype, trip_main, t);
- t = build_gimple_modify_stmt (trip_back, t);
- bsi_insert_after (&si, t, BSI_CONTINUE_LINKING);
- if (gimple_in_ssa_p (cfun))
- SSA_NAME_DEF_STMT (trip_back) = t;
+ stmt = gimple_build_assign (trip_back, t);
+ gsi_insert_after (&si, stmt, GSI_CONTINUE_LINKING);
- /* Replace the OMP_RETURN with a barrier, or nothing. */
- si = bsi_last (exit_bb);
- if (!OMP_RETURN_NOWAIT (bsi_stmt (si)))
- force_gimple_operand_bsi (&si, build_omp_barrier (), false, NULL_TREE,
- false, BSI_SAME_STMT);
- bsi_remove (&si, true);
+ /* Replace the GIMPLE_OMP_RETURN with a barrier, or nothing. */
+ si = gsi_last_bb (exit_bb);
+ if (!gimple_omp_return_nowait_p (gsi_stmt (si)))
+ force_gimple_operand_gsi (&si, build_omp_barrier (), false, NULL_TREE,
+ false, GSI_SAME_STMT);
+ gsi_remove (&si, true);
/* Connect the new blocks. */
find_edge (iter_part_bb, seq_start_bb)->flags = EDGE_TRUE_VALUE;
@@ -4260,21 +4362,30 @@ expand_omp_for_static_chunk (struct omp_region *region,
if (gimple_in_ssa_p (cfun))
{
+ gimple_stmt_iterator psi;
+ gimple phi;
+ edge re, ene;
+ edge_var_map_vector head;
+ edge_var_map *vm;
+ size_t i;
+
/* When we redirect the edge from trip_update_bb to iter_part_bb, we
remove arguments of the phi nodes in fin_bb. We need to create
appropriate phi nodes in iter_part_bb instead. */
se = single_pred_edge (fin_bb);
re = single_succ_edge (trip_update_bb);
+ head = redirect_edge_var_map_vector (re);
ene = single_succ_edge (entry_bb);
- args = PENDING_STMT (re);
- PENDING_STMT (re) = NULL_TREE;
- for (phi = phi_nodes (fin_bb);
- phi && args;
- phi = PHI_CHAIN (phi), args = TREE_CHAIN (args))
+ psi = gsi_start_phis (fin_bb);
+ for (i = 0; !gsi_end_p (psi) && VEC_iterate (edge_var_map, head, i, vm);
+ gsi_next (&psi), ++i)
{
- t = PHI_RESULT (phi);
- gcc_assert (t == TREE_PURPOSE (args));
+ gimple nphi;
+
+ phi = gsi_stmt (psi);
+ t = gimple_phi_result (phi);
+ gcc_assert (t == redirect_edge_var_map_result (vm));
nphi = create_phi_node (t, iter_part_bb);
SSA_NAME_DEF_STMT (t) = nphi;
@@ -4284,11 +4395,17 @@ expand_omp_for_static_chunk (struct omp_region *region,
if (t == fd->loop.v)
t = v_extra;
add_phi_arg (nphi, t, ene);
- add_phi_arg (nphi, TREE_VALUE (args), re);
+ add_phi_arg (nphi, redirect_edge_var_map_def (vm), re);
+ }
+ gcc_assert (!gsi_end_p (psi) && i == VEC_length (edge_var_map, head));
+ redirect_edge_var_map_clear (re);
+ while (1)
+ {
+ psi = gsi_start_phis (fin_bb);
+ if (gsi_end_p (psi))
+ break;
+ remove_phi_node (&psi, false);
}
- gcc_assert (!phi && !args);
- while ((phi = phi_nodes (fin_bb)) != NULL_TREE)
- remove_phi_node (phi, NULL_TREE, false);
/* Make phi node for trip. */
phi = create_phi_node (trip_main, iter_part_bb);
@@ -4319,9 +4436,8 @@ expand_omp_for (struct omp_region *region)
loops
= (struct omp_for_data_loop *)
- alloca (TREE_VEC_LENGTH (OMP_FOR_INIT (last_stmt (region->entry)))
+ alloca (gimple_omp_for_collapse (last_stmt (region->entry))
* sizeof (struct omp_for_data_loop));
-
extract_omp_for_data (last_stmt (region->entry), &fd, loops);
region->sched_kind = fd.sched_kind;
@@ -4351,7 +4467,7 @@ expand_omp_for (struct omp_region *region)
gcc_assert (fd.sched_kind != OMP_CLAUSE_SCHEDULE_AUTO);
fn_index = (fd.sched_kind == OMP_CLAUSE_SCHEDULE_RUNTIME)
- ? 3 : fd.sched_kind;
+ ? 3 : fd.sched_kind;
fn_index += fd.have_ordered * 4;
start_ix = BUILT_IN_GOMP_LOOP_STATIC_START + fn_index;
next_ix = BUILT_IN_GOMP_LOOP_STATIC_NEXT + fn_index;
@@ -4399,13 +4515,16 @@ expand_omp_for (struct omp_region *region)
static void
expand_omp_sections (struct omp_region *region)
{
- tree label_vec, l1, l2, t, u, sections_stmt, vin, vmain, vnext, cont;
- unsigned i, casei, len;
+ tree t, u, vin = NULL, vmain, vnext, l1, l2;
+ VEC (tree,heap) *label_vec;
+ unsigned len;
basic_block entry_bb, l0_bb, l1_bb, l2_bb, default_bb;
- block_stmt_iterator si;
+ gimple_stmt_iterator si, switch_si;
+ gimple sections_stmt, stmt, cont;
edge_iterator ei;
edge e;
struct omp_region *inner;
+ unsigned i, casei;
bool exit_reachable = region->cont != NULL;
gcc_assert (exit_reachable == (region->exit != NULL));
@@ -4416,50 +4535,55 @@ expand_omp_sections (struct omp_region *region)
if (exit_reachable)
{
if (single_pred (l2_bb) == l0_bb)
- l2 = tree_block_label (l2_bb);
+ l2 = gimple_block_label (l2_bb);
else
{
/* This can happen if there are reductions. */
len = EDGE_COUNT (l0_bb->succs);
gcc_assert (len > 0);
e = EDGE_SUCC (l0_bb, len - 1);
- si = bsi_last (e->dest);
+ si = gsi_last_bb (e->dest);
l2 = NULL_TREE;
- if (bsi_end_p (si) || TREE_CODE (bsi_stmt (si)) != OMP_SECTION)
- l2 = tree_block_label (e->dest);
+ if (gsi_end_p (si)
+ || gimple_code (gsi_stmt (si)) != GIMPLE_OMP_SECTION)
+ l2 = gimple_block_label (e->dest);
else
FOR_EACH_EDGE (e, ei, l0_bb->succs)
{
- si = bsi_last (e->dest);
- if (bsi_end_p (si) || TREE_CODE (bsi_stmt (si)) != OMP_SECTION)
+ si = gsi_last_bb (e->dest);
+ if (gsi_end_p (si)
+ || gimple_code (gsi_stmt (si)) != GIMPLE_OMP_SECTION)
{
- l2 = tree_block_label (e->dest);
+ l2 = gimple_block_label (e->dest);
break;
}
}
}
default_bb = create_empty_bb (l1_bb->prev_bb);
- l1 = tree_block_label (l1_bb);
+ l1 = gimple_block_label (l1_bb);
}
else
{
default_bb = create_empty_bb (l0_bb);
l1 = NULL_TREE;
- l2 = tree_block_label (default_bb);
+ l2 = gimple_block_label (default_bb);
}
/* We will build a switch() with enough cases for all the
- OMP_SECTION regions, a '0' case to handle the end of more work
+ GIMPLE_OMP_SECTION regions, a '0' case to handle the end of more work
and a default case to abort if something goes wrong. */
len = EDGE_COUNT (l0_bb->succs);
- label_vec = make_tree_vec (len + 1);
+
+ /* Use VEC_quick_push on label_vec throughout, since we know the size
+ in advance. */
+ label_vec = VEC_alloc (tree, heap, len);
/* The call to GOMP_sections_start goes in ENTRY_BB, replacing the
- OMP_SECTIONS statement. */
- si = bsi_last (entry_bb);
- sections_stmt = bsi_stmt (si);
- gcc_assert (TREE_CODE (sections_stmt) == OMP_SECTIONS);
- vin = OMP_SECTIONS_CONTROL (sections_stmt);
+ GIMPLE_OMP_SECTIONS statement. */
+ si = gsi_last_bb (entry_bb);
+ sections_stmt = gsi_stmt (si);
+ gcc_assert (gimple_code (sections_stmt) == GIMPLE_OMP_SECTIONS);
+ vin = gimple_omp_sections_control (sections_stmt);
if (!is_combined_parallel (region))
{
/* If we are not inside a combined parallel+sections region,
@@ -4467,29 +4591,28 @@ expand_omp_sections (struct omp_region *region)
t = build_int_cst (unsigned_type_node,
exit_reachable ? len - 1 : len);
u = built_in_decls[BUILT_IN_GOMP_SECTIONS_START];
- t = build_call_expr (u, 1, t);
+ stmt = gimple_build_call (u, 1, t);
}
else
{
/* Otherwise, call GOMP_sections_next. */
u = built_in_decls[BUILT_IN_GOMP_SECTIONS_NEXT];
- t = build_call_expr (u, 0);
+ stmt = gimple_build_call (u, 0);
}
- t = build_gimple_modify_stmt (vin, t);
- bsi_insert_after (&si, t, BSI_SAME_STMT);
- if (gimple_in_ssa_p (cfun))
- SSA_NAME_DEF_STMT (vin) = t;
- bsi_remove (&si, true);
-
- /* The switch() statement replacing OMP_SECTIONS_SWITCH goes in L0_BB. */
- si = bsi_last (l0_bb);
- gcc_assert (TREE_CODE (bsi_stmt (si)) == OMP_SECTIONS_SWITCH);
+ gimple_call_set_lhs (stmt, vin);
+ gsi_insert_after (&si, stmt, GSI_SAME_STMT);
+ gsi_remove (&si, true);
+
+ /* The switch() statement replacing GIMPLE_OMP_SECTIONS_SWITCH goes in
+ L0_BB. */
+ switch_si = gsi_last_bb (l0_bb);
+ gcc_assert (gimple_code (gsi_stmt (switch_si)) == GIMPLE_OMP_SECTIONS_SWITCH);
if (exit_reachable)
{
cont = last_stmt (l1_bb);
- gcc_assert (TREE_CODE (cont) == OMP_CONTINUE);
- vmain = TREE_OPERAND (cont, 1);
- vnext = TREE_OPERAND (cont, 0);
+ gcc_assert (gimple_code (cont) == GIMPLE_OMP_CONTINUE);
+ vmain = gimple_omp_continue_control_use (cont);
+ vnext = gimple_omp_continue_control_def (cont);
}
else
{
@@ -4497,20 +4620,16 @@ expand_omp_sections (struct omp_region *region)
vnext = NULL_TREE;
}
- t = build3 (SWITCH_EXPR, void_type_node, vmain, NULL, label_vec);
- bsi_insert_after (&si, t, BSI_SAME_STMT);
- bsi_remove (&si, true);
-
i = 0;
if (exit_reachable)
{
t = build3 (CASE_LABEL_EXPR, void_type_node,
build_int_cst (unsigned_type_node, 0), NULL, l2);
- TREE_VEC_ELT (label_vec, 0) = t;
+ VEC_quick_push (tree, label_vec, t);
i++;
}
- /* Convert each OMP_SECTION into a CASE_LABEL_EXPR. */
+ /* Convert each GIMPLE_OMP_SECTION into a CASE_LABEL_EXPR. */
for (inner = region->inner, casei = 1;
inner;
inner = inner->next, i++, casei++)
@@ -4518,7 +4637,7 @@ expand_omp_sections (struct omp_region *region)
basic_block s_entry_bb, s_exit_bb;
/* Skip optional reduction region. */
- if (inner->type == OMP_ATOMIC_LOAD)
+ if (inner->type == GIMPLE_OMP_ATOMIC_LOAD)
{
--i;
--casei;
@@ -4528,61 +4647,63 @@ expand_omp_sections (struct omp_region *region)
s_entry_bb = inner->entry;
s_exit_bb = inner->exit;
- t = tree_block_label (s_entry_bb);
+ t = gimple_block_label (s_entry_bb);
u = build_int_cst (unsigned_type_node, casei);
u = build3 (CASE_LABEL_EXPR, void_type_node, u, NULL, t);
- TREE_VEC_ELT (label_vec, i) = u;
+ VEC_quick_push (tree, label_vec, u);
- si = bsi_last (s_entry_bb);
- gcc_assert (TREE_CODE (bsi_stmt (si)) == OMP_SECTION);
- gcc_assert (i < len || OMP_SECTION_LAST (bsi_stmt (si)));
- bsi_remove (&si, true);
+ si = gsi_last_bb (s_entry_bb);
+ gcc_assert (gimple_code (gsi_stmt (si)) == GIMPLE_OMP_SECTION);
+ gcc_assert (i < len || gimple_omp_section_last_p (gsi_stmt (si)));
+ gsi_remove (&si, true);
single_succ_edge (s_entry_bb)->flags = EDGE_FALLTHRU;
if (s_exit_bb == NULL)
continue;
- si = bsi_last (s_exit_bb);
- gcc_assert (TREE_CODE (bsi_stmt (si)) == OMP_RETURN);
- bsi_remove (&si, true);
+ si = gsi_last_bb (s_exit_bb);
+ gcc_assert (gimple_code (gsi_stmt (si)) == GIMPLE_OMP_RETURN);
+ gsi_remove (&si, true);
single_succ_edge (s_exit_bb)->flags = EDGE_FALLTHRU;
}
/* Error handling code goes in DEFAULT_BB. */
- t = tree_block_label (default_bb);
+ t = gimple_block_label (default_bb);
u = build3 (CASE_LABEL_EXPR, void_type_node, NULL, NULL, t);
- TREE_VEC_ELT (label_vec, len) = u;
make_edge (l0_bb, default_bb, 0);
- si = bsi_start (default_bb);
- t = build_call_expr (built_in_decls[BUILT_IN_TRAP], 0);
- bsi_insert_after (&si, t, BSI_CONTINUE_LINKING);
+ stmt = gimple_build_switch_vec (vmain, u, label_vec);
+ gsi_insert_after (&switch_si, stmt, GSI_SAME_STMT);
+ gsi_remove (&switch_si, true);
+ VEC_free (tree, heap, label_vec);
+
+ si = gsi_start_bb (default_bb);
+ stmt = gimple_build_call (built_in_decls[BUILT_IN_TRAP], 0);
+ gsi_insert_after (&si, stmt, GSI_CONTINUE_LINKING);
if (exit_reachable)
{
/* Code to get the next section goes in L1_BB. */
- si = bsi_last (l1_bb);
- gcc_assert (TREE_CODE (bsi_stmt (si)) == OMP_CONTINUE);
+ si = gsi_last_bb (l1_bb);
+ gcc_assert (gimple_code (gsi_stmt (si)) == GIMPLE_OMP_CONTINUE);
- t = build_call_expr (built_in_decls[BUILT_IN_GOMP_SECTIONS_NEXT], 0);
- t = build_gimple_modify_stmt (vnext, t);
- bsi_insert_after (&si, t, BSI_SAME_STMT);
- if (gimple_in_ssa_p (cfun))
- SSA_NAME_DEF_STMT (vnext) = t;
- bsi_remove (&si, true);
+ stmt = gimple_build_call (built_in_decls[BUILT_IN_GOMP_SECTIONS_NEXT], 0);
+ gimple_call_set_lhs (stmt, vnext);
+ gsi_insert_after (&si, stmt, GSI_SAME_STMT);
+ gsi_remove (&si, true);
single_succ_edge (l1_bb)->flags = EDGE_FALLTHRU;
- /* Cleanup function replaces OMP_RETURN in EXIT_BB. */
- si = bsi_last (l2_bb);
- if (OMP_RETURN_NOWAIT (bsi_stmt (si)))
+ /* Cleanup function replaces GIMPLE_OMP_RETURN in EXIT_BB. */
+ si = gsi_last_bb (l2_bb);
+ if (gimple_omp_return_nowait_p (gsi_stmt (si)))
t = built_in_decls[BUILT_IN_GOMP_SECTIONS_END_NOWAIT];
else
t = built_in_decls[BUILT_IN_GOMP_SECTIONS_END];
- t = build_call_expr (t, 0);
- bsi_insert_after (&si, t, BSI_SAME_STMT);
- bsi_remove (&si, true);
+ stmt = gimple_build_call (t, 0);
+ gsi_insert_after (&si, stmt, GSI_SAME_STMT);
+ gsi_remove (&si, true);
}
set_immediate_dominator (CDI_DOMINATORS, default_bb, l0_bb);
@@ -4596,28 +4717,28 @@ static void
expand_omp_single (struct omp_region *region)
{
basic_block entry_bb, exit_bb;
- block_stmt_iterator si;
+ gimple_stmt_iterator si;
bool need_barrier = false;
entry_bb = region->entry;
exit_bb = region->exit;
- si = bsi_last (entry_bb);
+ si = gsi_last_bb (entry_bb);
/* The terminal barrier at the end of a GOMP_single_copy sequence cannot
be removed. We need to ensure that the thread that entered the single
does not exit before the data is copied out by the other threads. */
- if (find_omp_clause (OMP_SINGLE_CLAUSES (bsi_stmt (si)),
+ if (find_omp_clause (gimple_omp_single_clauses (gsi_stmt (si)),
OMP_CLAUSE_COPYPRIVATE))
need_barrier = true;
- gcc_assert (TREE_CODE (bsi_stmt (si)) == OMP_SINGLE);
- bsi_remove (&si, true);
+ gcc_assert (gimple_code (gsi_stmt (si)) == GIMPLE_OMP_SINGLE);
+ gsi_remove (&si, true);
single_succ_edge (entry_bb)->flags = EDGE_FALLTHRU;
- si = bsi_last (exit_bb);
- if (!OMP_RETURN_NOWAIT (bsi_stmt (si)) || need_barrier)
- force_gimple_operand_bsi (&si, build_omp_barrier (), false, NULL_TREE,
- false, BSI_SAME_STMT);
- bsi_remove (&si, true);
+ si = gsi_last_bb (exit_bb);
+ if (!gimple_omp_return_nowait_p (gsi_stmt (si)) || need_barrier)
+ force_gimple_operand_gsi (&si, build_omp_barrier (), false, NULL_TREE,
+ false, GSI_SAME_STMT);
+ gsi_remove (&si, true);
single_succ_edge (exit_bb)->flags = EDGE_FALLTHRU;
}
@@ -4630,24 +4751,24 @@ static void
expand_omp_synch (struct omp_region *region)
{
basic_block entry_bb, exit_bb;
- block_stmt_iterator si;
+ gimple_stmt_iterator si;
entry_bb = region->entry;
exit_bb = region->exit;
- si = bsi_last (entry_bb);
- gcc_assert (TREE_CODE (bsi_stmt (si)) == OMP_SINGLE
- || TREE_CODE (bsi_stmt (si)) == OMP_MASTER
- || TREE_CODE (bsi_stmt (si)) == OMP_ORDERED
- || TREE_CODE (bsi_stmt (si)) == OMP_CRITICAL);
- bsi_remove (&si, true);
+ si = gsi_last_bb (entry_bb);
+ gcc_assert (gimple_code (gsi_stmt (si)) == GIMPLE_OMP_SINGLE
+ || gimple_code (gsi_stmt (si)) == GIMPLE_OMP_MASTER
+ || gimple_code (gsi_stmt (si)) == GIMPLE_OMP_ORDERED
+ || gimple_code (gsi_stmt (si)) == GIMPLE_OMP_CRITICAL);
+ gsi_remove (&si, true);
single_succ_edge (entry_bb)->flags = EDGE_FALLTHRU;
if (exit_bb)
{
- si = bsi_last (exit_bb);
- gcc_assert (TREE_CODE (bsi_stmt (si)) == OMP_RETURN);
- bsi_remove (&si, true);
+ si = gsi_last_bb (exit_bb);
+ gcc_assert (gimple_code (gsi_stmt (si)) == GIMPLE_OMP_RETURN);
+ gsi_remove (&si, true);
single_succ_edge (exit_bb)->flags = EDGE_FALLTHRU;
}
}
@@ -4667,38 +4788,36 @@ expand_omp_atomic_fetch_op (basic_block load_bb,
enum insn_code *optab;
tree rhs;
basic_block store_bb = single_succ (load_bb);
- block_stmt_iterator bsi;
- tree stmt;
+ gimple_stmt_iterator gsi;
+ gimple stmt;
/* We expect to find the following sequences:
load_bb:
- OMP_ATOMIC_LOAD (tmp, mem)
+ GIMPLE_OMP_ATOMIC_LOAD (tmp, mem)
store_bb:
val = tmp OP something; (or: something OP tmp)
- OMP_STORE (val)
+ GIMPLE_OMP_STORE (val)
???FIXME: Allow a more flexible sequence.
Perhaps use data flow to pick the statements.
*/
- bsi = bsi_after_labels (store_bb);
- stmt = bsi_stmt (bsi);
- if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
+ gsi = gsi_after_labels (store_bb);
+ stmt = gsi_stmt (gsi);
+ if (!is_gimple_assign (stmt))
return false;
- bsi_next (&bsi);
- if (TREE_CODE (bsi_stmt (bsi)) != OMP_ATOMIC_STORE)
+ gsi_next (&gsi);
+ if (gimple_code (gsi_stmt (gsi)) != GIMPLE_OMP_ATOMIC_STORE)
return false;
- if (!operand_equal_p (GIMPLE_STMT_OPERAND (stmt, 0), stored_val, 0))
+ if (!operand_equal_p (gimple_assign_lhs (stmt), stored_val, 0))
return false;
- rhs = GIMPLE_STMT_OPERAND (stmt, 1);
-
/* Check for one of the supported fetch-op operations. */
- switch (TREE_CODE (rhs))
+ switch (gimple_assign_rhs_code (stmt))
{
case PLUS_EXPR:
case POINTER_PLUS_EXPR:
@@ -4725,11 +4844,11 @@ expand_omp_atomic_fetch_op (basic_block load_bb,
return false;
}
/* Make sure the expression is of the proper form. */
- if (operand_equal_p (TREE_OPERAND (rhs, 0), loaded_val, 0))
- rhs = TREE_OPERAND (rhs, 1);
- else if (commutative_tree_code (TREE_CODE (rhs))
- && operand_equal_p (TREE_OPERAND (rhs, 1), loaded_val, 0))
- rhs = TREE_OPERAND (rhs, 0);
+ if (operand_equal_p (gimple_assign_rhs1 (stmt), loaded_val, 0))
+ rhs = gimple_assign_rhs2 (stmt);
+ else if (commutative_tree_code (gimple_assign_rhs_code (stmt))
+ && operand_equal_p (gimple_assign_rhs2 (stmt), loaded_val, 0))
+ rhs = gimple_assign_rhs1 (stmt);
else
return false;
@@ -4739,17 +4858,18 @@ expand_omp_atomic_fetch_op (basic_block load_bb,
if (optab[TYPE_MODE (itype)] == CODE_FOR_nothing)
return false;
- bsi = bsi_last (load_bb);
- gcc_assert (TREE_CODE (bsi_stmt (bsi)) == OMP_ATOMIC_LOAD);
+ gsi = gsi_last_bb (load_bb);
+ gcc_assert (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_ATOMIC_LOAD);
call = build_call_expr (decl, 2, addr, fold_convert (itype, rhs));
- force_gimple_operand_bsi (&bsi, call, true, NULL_TREE, true, BSI_SAME_STMT);
- bsi_remove (&bsi, true);
+ call = fold_convert (void_type_node, call);
+ force_gimple_operand_gsi (&gsi, call, true, NULL_TREE, true, GSI_SAME_STMT);
+ gsi_remove (&gsi, true);
- bsi = bsi_last (store_bb);
- gcc_assert (TREE_CODE (bsi_stmt (bsi)) == OMP_ATOMIC_STORE);
- bsi_remove (&bsi, true);
- bsi = bsi_last (store_bb);
- bsi_remove (&bsi, true);
+ gsi = gsi_last_bb (store_bb);
+ gcc_assert (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_ATOMIC_STORE);
+ gsi_remove (&gsi, true);
+ gsi = gsi_last_bb (store_bb);
+ gsi_remove (&gsi, true);
if (gimple_in_ssa_p (cfun))
update_ssa (TODO_update_ssa_no_phi);
@@ -4776,9 +4896,9 @@ expand_omp_atomic_pipeline (basic_block load_bb, basic_block store_bb,
{
tree loadedi, storedi, initial, new_storedi, old_vali;
tree type, itype, cmpxchg, iaddr;
- block_stmt_iterator bsi;
+ gimple_stmt_iterator si;
basic_block loop_header = single_succ (load_bb);
- tree phi, x;
+ gimple phi, stmt;
edge e;
cmpxchg = built_in_decls[BUILT_IN_VAL_COMPARE_AND_SWAP_N + index + 1];
@@ -4788,19 +4908,24 @@ expand_omp_atomic_pipeline (basic_block load_bb, basic_block store_bb,
if (sync_compare_and_swap[TYPE_MODE (itype)] == CODE_FOR_nothing)
return false;
- /* Load the initial value, replacing the OMP_ATOMIC_LOAD. */
- bsi = bsi_last (load_bb);
- gcc_assert (TREE_CODE (bsi_stmt (bsi)) == OMP_ATOMIC_LOAD);
+ /* Load the initial value, replacing the GIMPLE_OMP_ATOMIC_LOAD. */
+ si = gsi_last_bb (load_bb);
+ gcc_assert (gimple_code (gsi_stmt (si)) == GIMPLE_OMP_ATOMIC_LOAD);
+
/* For floating-point values, we'll need to view-convert them to integers
so that we can perform the atomic compare and swap. Simplify the
following code by always setting up the "i"ntegral variables. */
if (!INTEGRAL_TYPE_P (type) && !POINTER_TYPE_P (type))
{
+ tree iaddr_val;
+
iaddr = create_tmp_var (build_pointer_type (itype), NULL);
- x = build_gimple_modify_stmt (iaddr,
- fold_convert (TREE_TYPE (iaddr), addr));
- force_gimple_operand_bsi (&bsi, x, true, NULL_TREE,
- true, BSI_SAME_STMT);
+ iaddr_val
+ = force_gimple_operand_gsi (&si,
+ fold_convert (TREE_TYPE (iaddr), addr),
+ false, NULL_TREE, true, GSI_SAME_STMT);
+ stmt = gimple_build_assign (iaddr, iaddr_val);
+ gsi_insert_before (&si, stmt, GSI_SAME_STMT);
DECL_NO_TBAA_P (iaddr) = 1;
DECL_POINTER_ALIAS_SET (iaddr) = 0;
loadedi = create_tmp_var (itype, NULL);
@@ -4816,63 +4941,65 @@ expand_omp_atomic_pipeline (basic_block load_bb, basic_block store_bb,
iaddr = addr;
loadedi = loaded_val;
}
- initial = force_gimple_operand_bsi (&bsi, build_fold_indirect_ref (iaddr),
- true, NULL_TREE, true, BSI_SAME_STMT);
+
+ initial = force_gimple_operand_gsi (&si, build_fold_indirect_ref (iaddr),
+ true, NULL_TREE, true, GSI_SAME_STMT);
/* Move the value to the LOADEDI temporary. */
if (gimple_in_ssa_p (cfun))
{
- gcc_assert (phi_nodes (loop_header) == NULL_TREE);
+ gcc_assert (gimple_seq_empty_p (phi_nodes (loop_header)));
phi = create_phi_node (loadedi, loop_header);
SSA_NAME_DEF_STMT (loadedi) = phi;
SET_USE (PHI_ARG_DEF_PTR_FROM_EDGE (phi, single_succ_edge (load_bb)),
initial);
}
else
- bsi_insert_before (&bsi,
- build_gimple_modify_stmt (loadedi, initial),
- BSI_SAME_STMT);
+ gsi_insert_before (&si,
+ gimple_build_assign (loadedi, initial),
+ GSI_SAME_STMT);
if (loadedi != loaded_val)
{
- block_stmt_iterator bsi2;
+ gimple_stmt_iterator gsi2;
+ tree x;
x = build1 (VIEW_CONVERT_EXPR, type, loadedi);
- bsi2 = bsi_start (loop_header);
+ gsi2 = gsi_start_bb (loop_header);
if (gimple_in_ssa_p (cfun))
{
- x = force_gimple_operand_bsi (&bsi2, x, true, NULL_TREE,
- true, BSI_SAME_STMT);
- x = build_gimple_modify_stmt (loaded_val, x);
- bsi_insert_before (&bsi2, x, BSI_SAME_STMT);
- SSA_NAME_DEF_STMT (loaded_val) = x;
+ gimple stmt;
+ x = force_gimple_operand_gsi (&gsi2, x, true, NULL_TREE,
+ true, GSI_SAME_STMT);
+ stmt = gimple_build_assign (loaded_val, x);
+ gsi_insert_before (&gsi2, stmt, GSI_SAME_STMT);
}
else
{
- x = build_gimple_modify_stmt (loaded_val, x);
- force_gimple_operand_bsi (&bsi2, x, true, NULL_TREE,
- true, BSI_SAME_STMT);
+ x = build2 (MODIFY_EXPR, TREE_TYPE (loaded_val), loaded_val, x);
+ force_gimple_operand_gsi (&gsi2, x, true, NULL_TREE,
+ true, GSI_SAME_STMT);
}
}
- bsi_remove (&bsi, true);
+ gsi_remove (&si, true);
- bsi = bsi_last (store_bb);
- gcc_assert (TREE_CODE (bsi_stmt (bsi)) == OMP_ATOMIC_STORE);
+ si = gsi_last_bb (store_bb);
+ gcc_assert (gimple_code (gsi_stmt (si)) == GIMPLE_OMP_ATOMIC_STORE);
if (iaddr == addr)
storedi = stored_val;
else
storedi =
- force_gimple_operand_bsi (&bsi,
+ force_gimple_operand_gsi (&si,
build1 (VIEW_CONVERT_EXPR, itype,
stored_val), true, NULL_TREE, true,
- BSI_SAME_STMT);
+ GSI_SAME_STMT);
/* Build the compare&swap statement. */
new_storedi = build_call_expr (cmpxchg, 3, iaddr, loadedi, storedi);
- new_storedi = force_gimple_operand_bsi (&bsi,
+ new_storedi = force_gimple_operand_gsi (&si,
fold_convert (itype, new_storedi),
true, NULL_TREE,
- true, BSI_SAME_STMT);
+ true, GSI_SAME_STMT);
if (gimple_in_ssa_p (cfun))
old_vali = loadedi;
@@ -4881,21 +5008,20 @@ expand_omp_atomic_pipeline (basic_block load_bb, basic_block store_bb,
old_vali = create_tmp_var (itype, NULL);
if (gimple_in_ssa_p (cfun))
add_referenced_var (old_vali);
- x = build_gimple_modify_stmt (old_vali, loadedi);
- force_gimple_operand_bsi (&bsi, x, true, NULL_TREE,
- true, BSI_SAME_STMT);
+ stmt = gimple_build_assign (old_vali, loadedi);
+ gsi_insert_before (&si, stmt, GSI_SAME_STMT);
- x = build_gimple_modify_stmt (loadedi, new_storedi);
- force_gimple_operand_bsi (&bsi, x, true, NULL_TREE,
- true, BSI_SAME_STMT);
+ stmt = gimple_build_assign (loadedi, new_storedi);
+ gsi_insert_before (&si, stmt, GSI_SAME_STMT);
}
/* Note that we always perform the comparison as an integer, even for
floating point. This allows the atomic operation to properly
succeed even with NaNs and -0.0. */
- x = build2 (NE_EXPR, boolean_type_node, new_storedi, old_vali);
- x = build3 (COND_EXPR, void_type_node, x, NULL_TREE, NULL_TREE);
- bsi_insert_before (&bsi, x, BSI_SAME_STMT);
+ stmt = gimple_build_cond_empty
+ (build2 (NE_EXPR, boolean_type_node,
+ new_storedi, old_vali));
+ gsi_insert_before (&si, stmt, GSI_SAME_STMT);
/* Update cfg. */
e = single_succ_edge (store_bb);
@@ -4908,12 +5034,12 @@ expand_omp_atomic_pipeline (basic_block load_bb, basic_block store_bb,
if we are not in SSA). */
if (gimple_in_ssa_p (cfun))
{
- phi = phi_nodes (loop_header);
+ phi = gimple_seq_first_stmt (phi_nodes (loop_header));
SET_USE (PHI_ARG_DEF_PTR_FROM_EDGE (phi, e), new_storedi);
}
- /* Remove OMP_ATOMIC_STORE. */
- bsi_remove (&bsi, true);
+ /* Remove GIMPLE_OMP_ATOMIC_STORE. */
+ gsi_remove (&si, true);
if (gimple_in_ssa_p (cfun))
update_ssa (TODO_update_ssa_no_phi);
@@ -4932,15 +5058,16 @@ expand_omp_atomic_pipeline (basic_block load_bb, basic_block store_bb,
responses received from omp@openmp.org, appears to be within spec.
Which makes sense, since that's how several other compilers handle
this situation as well.
- LOADED_VAL and ADDR are the operands of OMP_ATOMIC_LOAD we're expanding.
- STORED_VAL is the operand of the matching OMP_ATOMIC_STORE.
+ LOADED_VAL and ADDR are the operands of GIMPLE_OMP_ATOMIC_LOAD we're
+ expanding. STORED_VAL is the operand of the matching
+ GIMPLE_OMP_ATOMIC_STORE.
We replace
- OMP_ATOMIC_LOAD (loaded_val, addr) with
+ GIMPLE_OMP_ATOMIC_LOAD (loaded_val, addr) with
loaded_val = *addr;
and replace
- OMP_ATOMIC_ATORE (stored_val) with
+ GIMPLE_OMP_ATOMIC_ATORE (stored_val) with
*addr = stored_val;
*/
@@ -4948,40 +5075,39 @@ static bool
expand_omp_atomic_mutex (basic_block load_bb, basic_block store_bb,
tree addr, tree loaded_val, tree stored_val)
{
- block_stmt_iterator bsi;
+ gimple_stmt_iterator si;
+ gimple stmt;
tree t;
- bsi = bsi_last (load_bb);
- gcc_assert (TREE_CODE (bsi_stmt (bsi)) == OMP_ATOMIC_LOAD);
+ si = gsi_last_bb (load_bb);
+ gcc_assert (gimple_code (gsi_stmt (si)) == GIMPLE_OMP_ATOMIC_LOAD);
t = built_in_decls[BUILT_IN_GOMP_ATOMIC_START];
t = build_function_call_expr (t, 0);
- force_gimple_operand_bsi (&bsi, t, true, NULL_TREE, true, BSI_SAME_STMT);
+ force_gimple_operand_gsi (&si, t, true, NULL_TREE, true, GSI_SAME_STMT);
- t = build_gimple_modify_stmt (loaded_val, build_fold_indirect_ref (addr));
- if (gimple_in_ssa_p (cfun))
- SSA_NAME_DEF_STMT (loaded_val) = t;
- bsi_insert_before (&bsi, t, BSI_SAME_STMT);
- bsi_remove (&bsi, true);
+ stmt = gimple_build_assign (loaded_val, build_fold_indirect_ref (addr));
+ gsi_insert_before (&si, stmt, GSI_SAME_STMT);
+ gsi_remove (&si, true);
- bsi = bsi_last (store_bb);
- gcc_assert (TREE_CODE (bsi_stmt (bsi)) == OMP_ATOMIC_STORE);
+ si = gsi_last_bb (store_bb);
+ gcc_assert (gimple_code (gsi_stmt (si)) == GIMPLE_OMP_ATOMIC_STORE);
- t = build_gimple_modify_stmt (build_fold_indirect_ref (unshare_expr (addr)),
+ stmt = gimple_build_assign (build_fold_indirect_ref (unshare_expr (addr)),
stored_val);
- bsi_insert_before (&bsi, t, BSI_SAME_STMT);
+ gsi_insert_before (&si, stmt, GSI_SAME_STMT);
t = built_in_decls[BUILT_IN_GOMP_ATOMIC_END];
t = build_function_call_expr (t, 0);
- force_gimple_operand_bsi (&bsi, t, true, NULL_TREE, true, BSI_SAME_STMT);
- bsi_remove (&bsi, true);
+ force_gimple_operand_gsi (&si, t, true, NULL_TREE, true, GSI_SAME_STMT);
+ gsi_remove (&si, true);
if (gimple_in_ssa_p (cfun))
update_ssa (TODO_update_ssa_no_phi);
return true;
}
-/* Expand an OMP_ATOMIC statement. We try to expand
+/* Expand an GIMPLE_OMP_ATOMIC statement. We try to expand
using expand_omp_atomic_fetch_op. If it failed, we try to
call expand_omp_atomic_pipeline, and if it fails too, the
ultimate fallback is wrapping the operation in a mutex
@@ -4992,10 +5118,10 @@ static void
expand_omp_atomic (struct omp_region *region)
{
basic_block load_bb = region->entry, store_bb = region->exit;
- tree load = last_stmt (load_bb), store = last_stmt (store_bb);
- tree loaded_val = TREE_OPERAND (load, 0);
- tree addr = TREE_OPERAND (load, 1);
- tree stored_val = TREE_OPERAND (store, 0);
+ gimple load = last_stmt (load_bb), store = last_stmt (store_bb);
+ tree loaded_val = gimple_omp_atomic_load_lhs (load);
+ tree addr = gimple_omp_atomic_load_rhs (load);
+ tree stored_val = gimple_omp_atomic_store_val (store);
tree type = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (addr)));
HOST_WIDE_INT index;
@@ -5034,7 +5160,7 @@ expand_omp_atomic (struct omp_region *region)
/* Expand the parallel region tree rooted at REGION. Expansion
proceeds in depth-first order. Innermost regions are expanded
first. This way, parallel regions that require a new function to
- be created (e.g., OMP_PARALLEL) can be expanded without having any
+ be created (e.g., GIMPLE_OMP_PARALLEL) can be expanded without having any
internal dependencies in their body. */
static void
@@ -5046,50 +5172,47 @@ expand_omp (struct omp_region *region)
/* First, determine whether this is a combined parallel+workshare
region. */
- if (region->type == OMP_PARALLEL)
+ if (region->type == GIMPLE_OMP_PARALLEL)
determine_parallel_type (region);
if (region->inner)
expand_omp (region->inner);
saved_location = input_location;
- if (EXPR_HAS_LOCATION (last_stmt (region->entry)))
- input_location = EXPR_LOCATION (last_stmt (region->entry));
+ if (gimple_has_location (last_stmt (region->entry)))
+ input_location = gimple_location (last_stmt (region->entry));
switch (region->type)
{
- case OMP_PARALLEL:
+ case GIMPLE_OMP_PARALLEL:
+ case GIMPLE_OMP_TASK:
expand_omp_taskreg (region);
break;
- case OMP_TASK:
- expand_omp_taskreg (region);
- break;
-
- case OMP_FOR:
+ case GIMPLE_OMP_FOR:
expand_omp_for (region);
break;
- case OMP_SECTIONS:
+ case GIMPLE_OMP_SECTIONS:
expand_omp_sections (region);
break;
- case OMP_SECTION:
+ case GIMPLE_OMP_SECTION:
/* Individual omp sections are handled together with their
- parent OMP_SECTIONS region. */
+ parent GIMPLE_OMP_SECTIONS region. */
break;
- case OMP_SINGLE:
+ case GIMPLE_OMP_SINGLE:
expand_omp_single (region);
break;
- case OMP_MASTER:
- case OMP_ORDERED:
- case OMP_CRITICAL:
+ case GIMPLE_OMP_MASTER:
+ case GIMPLE_OMP_ORDERED:
+ case GIMPLE_OMP_CRITICAL:
expand_omp_synch (region);
break;
- case OMP_ATOMIC_LOAD:
+ case GIMPLE_OMP_ATOMIC_LOAD:
expand_omp_atomic (region);
break;
@@ -5112,19 +5235,19 @@ static void
build_omp_regions_1 (basic_block bb, struct omp_region *parent,
bool single_tree)
{
- block_stmt_iterator si;
- tree stmt;
+ gimple_stmt_iterator gsi;
+ gimple stmt;
basic_block son;
- si = bsi_last (bb);
- if (!bsi_end_p (si) && OMP_DIRECTIVE_P (bsi_stmt (si)))
+ gsi = gsi_last_bb (bb);
+ if (!gsi_end_p (gsi) && is_gimple_omp (gsi_stmt (gsi)))
{
struct omp_region *region;
- enum tree_code code;
+ enum gimple_code code;
- stmt = bsi_stmt (si);
- code = TREE_CODE (stmt);
- if (code == OMP_RETURN)
+ stmt = gsi_stmt (gsi);
+ code = gimple_code (stmt);
+ if (code == GIMPLE_OMP_RETURN)
{
/* STMT is the return point out of region PARENT. Mark it
as the exit point and make PARENT the immediately
@@ -5134,26 +5257,28 @@ build_omp_regions_1 (basic_block bb, struct omp_region *parent,
region->exit = bb;
parent = parent->outer;
}
- else if (code == OMP_ATOMIC_STORE)
+ else if (code == GIMPLE_OMP_ATOMIC_STORE)
{
- /* OMP_ATOMIC_STORE is analogous to OMP_RETURN, but matches with
- OMP_ATOMIC_LOAD. */
+ /* GIMPLE_OMP_ATOMIC_STORE is analoguous to
+ GIMPLE_OMP_RETURN, but matches with
+ GIMPLE_OMP_ATOMIC_LOAD. */
gcc_assert (parent);
- gcc_assert (parent->type == OMP_ATOMIC_LOAD);
+ gcc_assert (parent->type == GIMPLE_OMP_ATOMIC_LOAD);
region = parent;
region->exit = bb;
parent = parent->outer;
}
- else if (code == OMP_CONTINUE)
+ else if (code == GIMPLE_OMP_CONTINUE)
{
gcc_assert (parent);
parent->cont = bb;
}
- else if (code == OMP_SECTIONS_SWITCH)
+ else if (code == GIMPLE_OMP_SECTIONS_SWITCH)
{
- /* OMP_SECTIONS_SWITCH is part of OMP_SECTIONS, and we do nothing for
- it. */ ;
+ /* GIMPLE_OMP_SECTIONS_SWITCH is part of
+ GIMPLE_OMP_SECTIONS, and we do nothing for it. */
+ ;
}
else
{
@@ -5214,7 +5339,6 @@ build_omp_regions (void)
build_omp_regions_1 (ENTRY_BLOCK_PTR, NULL, false);
}
-
/* Main entry point for expanding OMP-GIMPLE into runtime calls. */
static unsigned int
@@ -5272,107 +5396,106 @@ struct gimple_opt_pass pass_expand_omp =
/* Routines to lower OpenMP directives into OMP-GIMPLE. */
-/* Lower the OpenMP sections directive in *STMT_P. */
+/* Lower the OpenMP sections directive in the current statement in GSI_P.
+ CTX is the enclosing OMP context for the current statement. */
static void
-lower_omp_sections (tree *stmt_p, omp_context *ctx)
+lower_omp_sections (gimple_stmt_iterator *gsi_p, omp_context *ctx)
{
- tree new_stmt, stmt, body, bind, block, ilist, olist, new_body, control;
- tree t, dlist;
- tree_stmt_iterator tsi;
+ tree block, control;
+ gimple_stmt_iterator tgsi;
unsigned i, len;
+ gimple stmt, new_stmt, bind, t;
+ gimple_seq ilist, dlist, olist, new_body, body;
struct gimplify_ctx gctx;
- stmt = *stmt_p;
+ stmt = gsi_stmt (*gsi_p);
push_gimplify_context (&gctx);
dlist = NULL;
ilist = NULL;
- lower_rec_input_clauses (OMP_SECTIONS_CLAUSES (stmt), &ilist, &dlist, ctx);
+ lower_rec_input_clauses (gimple_omp_sections_clauses (stmt),
+ &ilist, &dlist, ctx);
- tsi = tsi_start (OMP_SECTIONS_BODY (stmt));
- for (len = 0; !tsi_end_p (tsi); len++, tsi_next (&tsi))
+ tgsi = gsi_start (gimple_omp_body (stmt));
+ for (len = 0; !gsi_end_p (tgsi); len++, gsi_next (&tgsi))
continue;
- tsi = tsi_start (OMP_SECTIONS_BODY (stmt));
- body = alloc_stmt_list ();
- for (i = 0; i < len; i++, tsi_next (&tsi))
+ tgsi = gsi_start (gimple_omp_body (stmt));
+ body = NULL;
+ for (i = 0; i < len; i++, gsi_next (&tgsi))
{
omp_context *sctx;
- tree sec_start, sec_end;
+ gimple sec_start;
- sec_start = tsi_stmt (tsi);
+ sec_start = gsi_stmt (tgsi);
sctx = maybe_lookup_ctx (sec_start);
gcc_assert (sctx);
- append_to_statement_list (sec_start, &body);
+ gimple_seq_add_stmt (&body, sec_start);
- lower_omp (&OMP_SECTION_BODY (sec_start), sctx);
- append_to_statement_list (OMP_SECTION_BODY (sec_start), &body);
- OMP_SECTION_BODY (sec_start) = NULL;
+ lower_omp (gimple_omp_body (sec_start), sctx);
+ gimple_seq_add_seq (&body, gimple_omp_body (sec_start));
+ gimple_omp_set_body (sec_start, NULL);
if (i == len - 1)
{
- tree l = alloc_stmt_list ();
- lower_lastprivate_clauses (OMP_SECTIONS_CLAUSES (stmt), NULL,
+ gimple_seq l = NULL;
+ lower_lastprivate_clauses (gimple_omp_sections_clauses (stmt), NULL,
&l, ctx);
- append_to_statement_list (l, &body);
- OMP_SECTION_LAST (sec_start) = 1;
+ gimple_seq_add_seq (&body, l);
+ gimple_omp_section_set_last (sec_start);
}
- sec_end = make_node (OMP_RETURN);
- append_to_statement_list (sec_end, &body);
+ gimple_seq_add_stmt (&body, gimple_build_omp_return (false));
}
block = make_node (BLOCK);
- bind = build3 (BIND_EXPR, void_type_node, NULL, body, block);
+ bind = gimple_build_bind (NULL, body, block);
- olist = NULL_TREE;
- lower_reduction_clauses (OMP_SECTIONS_CLAUSES (stmt), &olist, ctx);
+ olist = NULL;
+ lower_reduction_clauses (gimple_omp_sections_clauses (stmt), &olist, ctx);
block = make_node (BLOCK);
- new_stmt = build3 (BIND_EXPR, void_type_node, NULL, NULL, block);
- TREE_SIDE_EFFECTS (new_stmt) = 1;
+ new_stmt = gimple_build_bind (NULL, NULL, block);
pop_gimplify_context (new_stmt);
-
- BIND_EXPR_VARS (new_stmt)
- = chainon (BIND_EXPR_VARS (new_stmt), ctx->block_vars);
- BLOCK_VARS (block) = BIND_EXPR_VARS (new_stmt);
+ gimple_bind_append_vars (new_stmt, ctx->block_vars);
+ BLOCK_VARS (block) = gimple_bind_vars (bind);
if (BLOCK_VARS (block))
TREE_USED (block) = 1;
- new_body = alloc_stmt_list ();
- append_to_statement_list (ilist, &new_body);
- append_to_statement_list (stmt, &new_body);
- append_to_statement_list (make_node (OMP_SECTIONS_SWITCH), &new_body);
- append_to_statement_list (bind, &new_body);
+ new_body = NULL;
+ gimple_seq_add_seq (&new_body, ilist);
+ gimple_seq_add_stmt (&new_body, stmt);
+ gimple_seq_add_stmt (&new_body, gimple_build_omp_sections_switch ());
+ gimple_seq_add_stmt (&new_body, bind);
control = create_tmp_var (unsigned_type_node, ".section");
- t = build2 (OMP_CONTINUE, void_type_node, control, control);
- OMP_SECTIONS_CONTROL (stmt) = control;
- append_to_statement_list (t, &new_body);
+ t = gimple_build_omp_continue (control, control);
+ gimple_omp_sections_set_control (stmt, control);
+ gimple_seq_add_stmt (&new_body, t);
- append_to_statement_list (olist, &new_body);
- append_to_statement_list (dlist, &new_body);
+ gimple_seq_add_seq (&new_body, olist);
+ gimple_seq_add_seq (&new_body, dlist);
- maybe_catch_exception (&new_body);
+ new_body = maybe_catch_exception (new_body);
- t = make_node (OMP_RETURN);
- OMP_RETURN_NOWAIT (t) = !!find_omp_clause (OMP_SECTIONS_CLAUSES (stmt),
- OMP_CLAUSE_NOWAIT);
- append_to_statement_list (t, &new_body);
+ t = gimple_build_omp_return
+ (!!find_omp_clause (gimple_omp_sections_clauses (stmt),
+ OMP_CLAUSE_NOWAIT));
+ gimple_seq_add_stmt (&new_body, t);
- BIND_EXPR_BODY (new_stmt) = new_body;
- OMP_SECTIONS_BODY (stmt) = NULL;
+ gimple_bind_set_body (new_stmt, new_body);
+ gimple_omp_set_body (stmt, NULL);
- *stmt_p = new_stmt;
+ gsi_replace (gsi_p, new_stmt, true);
}
/* A subroutine of lower_omp_single. Expand the simple form of
- an OMP_SINGLE, without a copyprivate clause:
+ a GIMPLE_OMP_SINGLE, without a copyprivate clause:
if (GOMP_single_start ())
BODY;
@@ -5383,22 +5506,31 @@ lower_omp_sections (tree *stmt_p, omp_context *ctx)
to a synchronization analysis pass. */
static void
-lower_omp_single_simple (tree single_stmt, tree *pre_p)
+lower_omp_single_simple (gimple single_stmt, gimple_seq *pre_p)
{
- tree t;
-
- t = build_call_expr (built_in_decls[BUILT_IN_GOMP_SINGLE_START], 0);
- if (TREE_TYPE (t) != boolean_type_node)
- t = fold_build2 (NE_EXPR, boolean_type_node,
- t, build_int_cst (TREE_TYPE (t), 0));
- t = build3 (COND_EXPR, void_type_node, t,
- OMP_SINGLE_BODY (single_stmt), NULL);
- gimplify_and_add (t, pre_p);
+ tree tlabel = create_artificial_label ();
+ tree flabel = create_artificial_label ();
+ gimple call, cond;
+ tree lhs, decl;
+
+ decl = built_in_decls[BUILT_IN_GOMP_SINGLE_START];
+ lhs = create_tmp_var (TREE_TYPE (TREE_TYPE (decl)), NULL);
+ call = gimple_build_call (decl, 0);
+ gimple_call_set_lhs (call, lhs);
+ gimple_seq_add_stmt (pre_p, call);
+
+ cond = gimple_build_cond (EQ_EXPR, lhs,
+ fold_convert (TREE_TYPE (lhs), boolean_true_node),
+ tlabel, flabel);
+ gimple_seq_add_stmt (pre_p, cond);
+ gimple_seq_add_stmt (pre_p, gimple_build_label (tlabel));
+ gimple_seq_add_seq (pre_p, gimple_omp_body (single_stmt));
+ gimple_seq_add_stmt (pre_p, gimple_build_label (flabel));
}
/* A subroutine of lower_omp_single. Expand the simple form of
- an OMP_SINGLE, with a copyprivate clause:
+ a GIMPLE_OMP_SINGLE, with a copyprivate clause:
#pragma omp single copyprivate (a, b, c)
@@ -5427,9 +5559,10 @@ lower_omp_single_simple (tree single_stmt, tree *pre_p)
to a synchronization analysis pass. */
static void
-lower_omp_single_copy (tree single_stmt, tree *pre_p, omp_context *ctx)
+lower_omp_single_copy (gimple single_stmt, gimple_seq *pre_p, omp_context *ctx)
{
- tree ptr_type, t, l0, l1, l2, copyin_seq;
+ tree ptr_type, t, l0, l1, l2;
+ gimple_seq copyin_seq;
ctx->sender_decl = create_tmp_var (ctx->record_type, ".omp_copy_o");
@@ -5442,8 +5575,7 @@ lower_omp_single_copy (tree single_stmt, tree *pre_p, omp_context *ctx)
t = build_call_expr (built_in_decls[BUILT_IN_GOMP_SINGLE_COPY_START], 0);
t = fold_convert (ptr_type, t);
- t = build_gimple_modify_stmt (ctx->receiver_decl, t);
- gimplify_and_add (t, pre_p);
+ gimplify_assign (ctx->receiver_decl, t, pre_p);
t = build2 (EQ_EXPR, boolean_type_node, ctx->receiver_decl,
build_int_cst (ptr_type, 0));
@@ -5451,13 +5583,12 @@ lower_omp_single_copy (tree single_stmt, tree *pre_p, omp_context *ctx)
build_and_jump (&l0), build_and_jump (&l1));
gimplify_and_add (t, pre_p);
- t = build1 (LABEL_EXPR, void_type_node, l0);
- gimplify_and_add (t, pre_p);
+ gimple_seq_add_stmt (pre_p, gimple_build_label (l0));
- append_to_statement_list (OMP_SINGLE_BODY (single_stmt), pre_p);
+ gimple_seq_add_seq (pre_p, gimple_omp_body (single_stmt));
copyin_seq = NULL;
- lower_copyprivate_clauses (OMP_SINGLE_CLAUSES (single_stmt), pre_p,
+ lower_copyprivate_clauses (gimple_omp_single_clauses (single_stmt), pre_p,
&copyin_seq, ctx);
t = build_fold_addr_expr (ctx->sender_decl);
@@ -5467,56 +5598,57 @@ lower_omp_single_copy (tree single_stmt, tree *pre_p, omp_context *ctx)
t = build_and_jump (&l2);
gimplify_and_add (t, pre_p);
- t = build1 (LABEL_EXPR, void_type_node, l1);
- gimplify_and_add (t, pre_p);
+ gimple_seq_add_stmt (pre_p, gimple_build_label (l1));
- append_to_statement_list (copyin_seq, pre_p);
+ gimple_seq_add_seq (pre_p, copyin_seq);
- t = build1 (LABEL_EXPR, void_type_node, l2);
- gimplify_and_add (t, pre_p);
+ gimple_seq_add_stmt (pre_p, gimple_build_label (l2));
}
/* Expand code for an OpenMP single directive. */
static void
-lower_omp_single (tree *stmt_p, omp_context *ctx)
+lower_omp_single (gimple_stmt_iterator *gsi_p, omp_context *ctx)
{
- tree t, bind, block, single_stmt = *stmt_p, dlist;
+ tree block;
+ gimple t, bind, single_stmt = gsi_stmt (*gsi_p);
+ gimple_seq bind_body, dlist;
struct gimplify_ctx gctx;
push_gimplify_context (&gctx);
- block = make_node (BLOCK);
- *stmt_p = bind = build3 (BIND_EXPR, void_type_node, NULL, NULL, block);
- TREE_SIDE_EFFECTS (bind) = 1;
+ bind_body = NULL;
+ lower_rec_input_clauses (gimple_omp_single_clauses (single_stmt),
+ &bind_body, &dlist, ctx);
+ lower_omp (gimple_omp_body (single_stmt), ctx);
- lower_rec_input_clauses (OMP_SINGLE_CLAUSES (single_stmt),
- &BIND_EXPR_BODY (bind), &dlist, ctx);
- lower_omp (&OMP_SINGLE_BODY (single_stmt), ctx);
-
- append_to_statement_list (single_stmt, &BIND_EXPR_BODY (bind));
+ gimple_seq_add_stmt (&bind_body, single_stmt);
if (ctx->record_type)
- lower_omp_single_copy (single_stmt, &BIND_EXPR_BODY (bind), ctx);
+ lower_omp_single_copy (single_stmt, &bind_body, ctx);
else
- lower_omp_single_simple (single_stmt, &BIND_EXPR_BODY (bind));
+ lower_omp_single_simple (single_stmt, &bind_body);
+
+ gimple_omp_set_body (single_stmt, NULL);
- OMP_SINGLE_BODY (single_stmt) = NULL;
+ gimple_seq_add_seq (&bind_body, dlist);
- append_to_statement_list (dlist, &BIND_EXPR_BODY (bind));
+ bind_body = maybe_catch_exception (bind_body);
- maybe_catch_exception (&BIND_EXPR_BODY (bind));
+ t = gimple_build_omp_return
+ (!!find_omp_clause (gimple_omp_single_clauses (single_stmt),
+ OMP_CLAUSE_NOWAIT));
+ gimple_seq_add_stmt (&bind_body, t);
- t = make_node (OMP_RETURN);
- OMP_RETURN_NOWAIT (t) = !!find_omp_clause (OMP_SINGLE_CLAUSES (single_stmt),
- OMP_CLAUSE_NOWAIT);
- append_to_statement_list (t, &BIND_EXPR_BODY (bind));
+ block = make_node (BLOCK);
+ bind = gimple_build_bind (NULL, bind_body, block);
pop_gimplify_context (bind);
- BIND_EXPR_VARS (bind) = chainon (BIND_EXPR_VARS (bind), ctx->block_vars);
- BLOCK_VARS (block) = BIND_EXPR_VARS (bind);
+ gimple_bind_append_vars (bind, ctx->block_vars);
+ BLOCK_VARS (block) = ctx->block_vars;
+ gsi_replace (gsi_p, bind, true);
if (BLOCK_VARS (block))
TREE_USED (block) = 1;
}
@@ -5525,82 +5657,80 @@ lower_omp_single (tree *stmt_p, omp_context *ctx)
/* Expand code for an OpenMP master directive. */
static void
-lower_omp_master (tree *stmt_p, omp_context *ctx)
+lower_omp_master (gimple_stmt_iterator *gsi_p, omp_context *ctx)
{
- tree bind, block, stmt = *stmt_p, lab = NULL, x;
+ tree block, lab = NULL, x;
+ gimple stmt = gsi_stmt (*gsi_p), bind;
+ gimple_seq tseq;
struct gimplify_ctx gctx;
push_gimplify_context (&gctx);
block = make_node (BLOCK);
- *stmt_p = bind = build3 (BIND_EXPR, void_type_node, NULL, NULL, block);
- TREE_SIDE_EFFECTS (bind) = 1;
-
- append_to_statement_list (stmt, &BIND_EXPR_BODY (bind));
+ bind = gimple_build_bind (NULL, gimple_seq_alloc_with_stmt (stmt),
+ block);
x = build_call_expr (built_in_decls[BUILT_IN_OMP_GET_THREAD_NUM], 0);
x = build2 (EQ_EXPR, boolean_type_node, x, integer_zero_node);
x = build3 (COND_EXPR, void_type_node, x, NULL, build_and_jump (&lab));
- gimplify_and_add (x, &BIND_EXPR_BODY (bind));
+ tseq = NULL;
+ gimplify_and_add (x, &tseq);
+ gimple_bind_add_seq (bind, tseq);
- lower_omp (&OMP_MASTER_BODY (stmt), ctx);
- maybe_catch_exception (&OMP_MASTER_BODY (stmt));
- append_to_statement_list (OMP_MASTER_BODY (stmt), &BIND_EXPR_BODY (bind));
- OMP_MASTER_BODY (stmt) = NULL;
+ lower_omp (gimple_omp_body (stmt), ctx);
+ gimple_omp_set_body (stmt, maybe_catch_exception (gimple_omp_body (stmt)));
+ gimple_bind_add_seq (bind, gimple_omp_body (stmt));
+ gimple_omp_set_body (stmt, NULL);
- x = build1 (LABEL_EXPR, void_type_node, lab);
- gimplify_and_add (x, &BIND_EXPR_BODY (bind));
+ gimple_bind_add_stmt (bind, gimple_build_label (lab));
- x = make_node (OMP_RETURN);
- OMP_RETURN_NOWAIT (x) = 1;
- append_to_statement_list (x, &BIND_EXPR_BODY (bind));
+ gimple_bind_add_stmt (bind, gimple_build_omp_return (true));
pop_gimplify_context (bind);
- BIND_EXPR_VARS (bind) = chainon (BIND_EXPR_VARS (bind), ctx->block_vars);
- BLOCK_VARS (block) = BIND_EXPR_VARS (bind);
+ gimple_bind_append_vars (bind, ctx->block_vars);
+ BLOCK_VARS (block) = ctx->block_vars;
+ gsi_replace (gsi_p, bind, true);
}
/* Expand code for an OpenMP ordered directive. */
static void
-lower_omp_ordered (tree *stmt_p, omp_context *ctx)
+lower_omp_ordered (gimple_stmt_iterator *gsi_p, omp_context *ctx)
{
- tree bind, block, stmt = *stmt_p, x;
+ tree block;
+ gimple stmt = gsi_stmt (*gsi_p), bind, x;
struct gimplify_ctx gctx;
push_gimplify_context (&gctx);
block = make_node (BLOCK);
- *stmt_p = bind = build3 (BIND_EXPR, void_type_node, NULL, NULL, block);
- TREE_SIDE_EFFECTS (bind) = 1;
-
- append_to_statement_list (stmt, &BIND_EXPR_BODY (bind));
+ bind = gimple_build_bind (NULL, gimple_seq_alloc_with_stmt (stmt),
+ block);
- x = build_call_expr (built_in_decls[BUILT_IN_GOMP_ORDERED_START], 0);
- gimplify_and_add (x, &BIND_EXPR_BODY (bind));
+ x = gimple_build_call (built_in_decls[BUILT_IN_GOMP_ORDERED_START], 0);
+ gimple_bind_add_stmt (bind, x);
- lower_omp (&OMP_ORDERED_BODY (stmt), ctx);
- maybe_catch_exception (&OMP_ORDERED_BODY (stmt));
- append_to_statement_list (OMP_ORDERED_BODY (stmt), &BIND_EXPR_BODY (bind));
- OMP_ORDERED_BODY (stmt) = NULL;
+ lower_omp (gimple_omp_body (stmt), ctx);
+ gimple_omp_set_body (stmt, maybe_catch_exception (gimple_omp_body (stmt)));
+ gimple_bind_add_seq (bind, gimple_omp_body (stmt));
+ gimple_omp_set_body (stmt, NULL);
- x = build_call_expr (built_in_decls[BUILT_IN_GOMP_ORDERED_END], 0);
- gimplify_and_add (x, &BIND_EXPR_BODY (bind));
+ x = gimple_build_call (built_in_decls[BUILT_IN_GOMP_ORDERED_END], 0);
+ gimple_bind_add_stmt (bind, x);
- x = make_node (OMP_RETURN);
- OMP_RETURN_NOWAIT (x) = 1;
- append_to_statement_list (x, &BIND_EXPR_BODY (bind));
+ gimple_bind_add_stmt (bind, gimple_build_omp_return (true));
pop_gimplify_context (bind);
- BIND_EXPR_VARS (bind) = chainon (BIND_EXPR_VARS (bind), ctx->block_vars);
- BLOCK_VARS (block) = BIND_EXPR_VARS (bind);
+ gimple_bind_append_vars (bind, ctx->block_vars);
+ BLOCK_VARS (block) = gimple_bind_vars (bind);
+ gsi_replace (gsi_p, bind, true);
}
-/* Gimplify an OMP_CRITICAL statement. This is a relatively simple
+/* Gimplify a GIMPLE_OMP_CRITICAL statement. This is a relatively simple
substitution of a couple of function calls. But in the NAMED case,
requires that languages coordinate a symbol name. It is therefore
best put here in common code. */
@@ -5609,13 +5739,15 @@ static GTY((param1_is (tree), param2_is (tree)))
splay_tree critical_name_mutexes;
static void
-lower_omp_critical (tree *stmt_p, omp_context *ctx)
+lower_omp_critical (gimple_stmt_iterator *gsi_p, omp_context *ctx)
{
- tree bind, block, stmt = *stmt_p;
- tree t, lock, unlock, name;
+ tree block;
+ tree name, lock, unlock;
+ gimple stmt = gsi_stmt (*gsi_p), bind;
+ gimple_seq tbody;
struct gimplify_ctx gctx;
- name = OMP_CRITICAL_NAME (stmt);
+ name = gimple_omp_critical_name (stmt);
if (name)
{
tree decl;
@@ -5666,27 +5798,27 @@ lower_omp_critical (tree *stmt_p, omp_context *ctx)
push_gimplify_context (&gctx);
block = make_node (BLOCK);
- *stmt_p = bind = build3 (BIND_EXPR, void_type_node, NULL, NULL, block);
- TREE_SIDE_EFFECTS (bind) = 1;
-
- append_to_statement_list (stmt, &BIND_EXPR_BODY (bind));
+ bind = gimple_build_bind (NULL, gimple_seq_alloc_with_stmt (stmt), block);
- gimplify_and_add (lock, &BIND_EXPR_BODY (bind));
+ tbody = gimple_bind_body (bind);
+ gimplify_and_add (lock, &tbody);
+ gimple_bind_set_body (bind, tbody);
- lower_omp (&OMP_CRITICAL_BODY (stmt), ctx);
- maybe_catch_exception (&OMP_CRITICAL_BODY (stmt));
- append_to_statement_list (OMP_CRITICAL_BODY (stmt), &BIND_EXPR_BODY (bind));
- OMP_CRITICAL_BODY (stmt) = NULL;
+ lower_omp (gimple_omp_body (stmt), ctx);
+ gimple_omp_set_body (stmt, maybe_catch_exception (gimple_omp_body (stmt)));
+ gimple_bind_add_seq (bind, gimple_omp_body (stmt));
+ gimple_omp_set_body (stmt, NULL);
- gimplify_and_add (unlock, &BIND_EXPR_BODY (bind));
+ tbody = gimple_bind_body (bind);
+ gimplify_and_add (unlock, &tbody);
+ gimple_bind_set_body (bind, tbody);
- t = make_node (OMP_RETURN);
- OMP_RETURN_NOWAIT (t) = 1;
- append_to_statement_list (t, &BIND_EXPR_BODY (bind));
+ gimple_bind_add_stmt (bind, gimple_build_omp_return (true));
pop_gimplify_context (bind);
- BIND_EXPR_VARS (bind) = chainon (BIND_EXPR_VARS (bind), ctx->block_vars);
- BLOCK_VARS (block) = BIND_EXPR_VARS (bind);
+ gimple_bind_append_vars (bind, ctx->block_vars);
+ BLOCK_VARS (block) = gimple_bind_vars (bind);
+ gsi_replace (gsi_p, bind, true);
}
@@ -5697,11 +5829,12 @@ lower_omp_critical (tree *stmt_p, omp_context *ctx)
*BODY_P. */
static void
-lower_omp_for_lastprivate (struct omp_for_data *fd, tree *body_p,
- tree *dlist, struct omp_context *ctx)
+lower_omp_for_lastprivate (struct omp_for_data *fd, gimple_seq *body_p,
+ gimple_seq *dlist, struct omp_context *ctx)
{
- tree clauses, cond, stmts, vinit, t;
+ tree clauses, cond, vinit;
enum tree_code cond_code;
+ gimple_seq stmts;
cond_code = fd->loop.cond_code;
cond_code = cond_code == LT_EXPR ? GE_EXPR : LE_EXPR;
@@ -5717,12 +5850,12 @@ lower_omp_for_lastprivate (struct omp_for_data *fd, tree *body_p,
cond = build2 (cond_code, boolean_type_node, fd->loop.v, fd->loop.n2);
- clauses = OMP_FOR_CLAUSES (fd->for_stmt);
+ clauses = gimple_omp_for_clauses (fd->for_stmt);
stmts = NULL;
lower_lastprivate_clauses (clauses, cond, &stmts, ctx);
- if (stmts != NULL)
+ if (!gimple_seq_empty_p (stmts))
{
- append_to_statement_list (*dlist, &stmts);
+ gimple_seq_add_seq (&stmts, *dlist);
*dlist = stmts;
/* Optimize: v = 0; is usually cheaper than v = some_other_constant. */
@@ -5734,8 +5867,7 @@ lower_omp_for_lastprivate (struct omp_for_data *fd, tree *body_p,
/* Initialize the iterator variable, so that threads that don't execute
any iterations don't execute the lastprivate clauses by accident. */
- t = build_gimple_modify_stmt (fd->loop.v, vinit);
- gimplify_and_add (t, body_p);
+ gimplify_assign (fd->loop.v, vinit, body_p);
}
}
@@ -5743,37 +5875,39 @@ lower_omp_for_lastprivate (struct omp_for_data *fd, tree *body_p,
/* Lower code for an OpenMP loop directive. */
static void
-lower_omp_for (tree *stmt_p, omp_context *ctx)
+lower_omp_for (gimple_stmt_iterator *gsi_p, omp_context *ctx)
{
- tree t, stmt, ilist, dlist, new_stmt, block, *body_p, *rhs_p;
+ tree *rhs_p, block;
struct omp_for_data fd;
- int i;
+ gimple stmt = gsi_stmt (*gsi_p), new_stmt;
+ gimple_seq omp_for_body, body, dlist, ilist;
+ size_t i;
struct gimplify_ctx gctx;
- stmt = *stmt_p;
-
push_gimplify_context (&gctx);
- lower_omp (&OMP_FOR_PRE_BODY (stmt), ctx);
- lower_omp (&OMP_FOR_BODY (stmt), ctx);
+ lower_omp (gimple_omp_for_pre_body (stmt), ctx);
+ lower_omp (gimple_omp_body (stmt), ctx);
block = make_node (BLOCK);
- new_stmt = build3 (BIND_EXPR, void_type_node, NULL, NULL, block);
- TREE_SIDE_EFFECTS (new_stmt) = 1;
- body_p = &BIND_EXPR_BODY (new_stmt);
+ new_stmt = gimple_build_bind (NULL, NULL, block);
/* Move declaration of temporaries in the loop body before we make
it go away. */
- if (TREE_CODE (OMP_FOR_BODY (stmt)) == BIND_EXPR)
- BIND_EXPR_VARS (new_stmt)
- = chainon (BIND_EXPR_VARS (new_stmt),
- BIND_EXPR_VARS (OMP_FOR_BODY (stmt)));
+ omp_for_body = gimple_omp_body (stmt);
+ if (!gimple_seq_empty_p (omp_for_body)
+ && gimple_code (gimple_seq_first_stmt (omp_for_body)) == GIMPLE_BIND)
+ {
+ tree vars = gimple_bind_vars (gimple_seq_first_stmt (omp_for_body));
+ gimple_bind_append_vars (new_stmt, vars);
+ }
- /* The pre-body and input clauses go before the lowered OMP_FOR. */
+ /* The pre-body and input clauses go before the lowered GIMPLE_OMP_FOR. */
ilist = NULL;
dlist = NULL;
- lower_rec_input_clauses (OMP_FOR_CLAUSES (stmt), body_p, &dlist, ctx);
- append_to_statement_list (OMP_FOR_PRE_BODY (stmt), body_p);
+ body = NULL;
+ lower_rec_input_clauses (gimple_omp_for_clauses (stmt), &body, &dlist, ctx);
+ gimple_seq_add_seq (&body, gimple_omp_for_pre_body (stmt));
/* Lower the header expressions. At this point, we can assume that
the header is of the form:
@@ -5782,71 +5916,72 @@ lower_omp_for (tree *stmt_p, omp_context *ctx)
We just need to make sure that VAL1, VAL2 and VAL3 are lowered
using the .omp_data_s mapping, if needed. */
- for (i = 0; i < TREE_VEC_LENGTH (OMP_FOR_INIT (stmt)); i++)
+ for (i = 0; i < gimple_omp_for_collapse (stmt); i++)
{
- rhs_p = &GIMPLE_STMT_OPERAND (TREE_VEC_ELT (OMP_FOR_INIT (stmt), i), 1);
+ rhs_p = gimple_omp_for_initial_ptr (stmt, i);
if (!is_gimple_min_invariant (*rhs_p))
- *rhs_p = get_formal_tmp_var (*rhs_p, body_p);
+ *rhs_p = get_formal_tmp_var (*rhs_p, &body);
- rhs_p = &TREE_OPERAND (TREE_VEC_ELT (OMP_FOR_COND (stmt), i), 1);
+ rhs_p = gimple_omp_for_final_ptr (stmt, i);
if (!is_gimple_min_invariant (*rhs_p))
- *rhs_p = get_formal_tmp_var (*rhs_p, body_p);
+ *rhs_p = get_formal_tmp_var (*rhs_p, &body);
- rhs_p = &TREE_OPERAND (GIMPLE_STMT_OPERAND
- (TREE_VEC_ELT (OMP_FOR_INCR (stmt), i), 1), 1);
+ rhs_p = &TREE_OPERAND (gimple_omp_for_incr (stmt, i), 1);
if (!is_gimple_min_invariant (*rhs_p))
- *rhs_p = get_formal_tmp_var (*rhs_p, body_p);
+ *rhs_p = get_formal_tmp_var (*rhs_p, &body);
}
/* Once lowered, extract the bounds and clauses. */
extract_omp_for_data (stmt, &fd, NULL);
- lower_omp_for_lastprivate (&fd, body_p, &dlist, ctx);
-
- append_to_statement_list (stmt, body_p);
+ lower_omp_for_lastprivate (&fd, &body, &dlist, ctx);
- append_to_statement_list (OMP_FOR_BODY (stmt), body_p);
+ gimple_seq_add_stmt (&body, stmt);
+ gimple_seq_add_seq (&body, gimple_omp_body (stmt));
- t = build2 (OMP_CONTINUE, void_type_node, fd.loop.v, fd.loop.v);
- append_to_statement_list (t, body_p);
+ gimple_seq_add_stmt (&body, gimple_build_omp_continue (fd.loop.v,
+ fd.loop.v));
/* After the loop, add exit clauses. */
- lower_reduction_clauses (OMP_FOR_CLAUSES (stmt), body_p, ctx);
- append_to_statement_list (dlist, body_p);
+ lower_reduction_clauses (gimple_omp_for_clauses (stmt), &body, ctx);
+ gimple_seq_add_seq (&body, dlist);
- maybe_catch_exception (body_p);
+ body = maybe_catch_exception (body);
/* Region exit marker goes at the end of the loop body. */
- t = make_node (OMP_RETURN);
- OMP_RETURN_NOWAIT (t) = fd.have_nowait;
- append_to_statement_list (t, body_p);
+ gimple_seq_add_stmt (&body, gimple_build_omp_return (fd.have_nowait));
pop_gimplify_context (new_stmt);
- BIND_EXPR_VARS (new_stmt)
- = chainon (BIND_EXPR_VARS (new_stmt), ctx->block_vars);
- BLOCK_VARS (block) = BIND_EXPR_VARS (new_stmt);
+
+ gimple_bind_append_vars (new_stmt, ctx->block_vars);
+ BLOCK_VARS (block) = gimple_bind_vars (new_stmt);
if (BLOCK_VARS (block))
TREE_USED (block) = 1;
- OMP_FOR_BODY (stmt) = NULL_TREE;
- OMP_FOR_PRE_BODY (stmt) = NULL_TREE;
- *stmt_p = new_stmt;
+ gimple_bind_set_body (new_stmt, body);
+ gimple_omp_set_body (stmt, NULL);
+ gimple_omp_for_set_pre_body (stmt, NULL);
+ gsi_replace (gsi_p, new_stmt, true);
}
-/* Callback for walk_stmts. Check if *TP only contains OMP_FOR
- or OMP_PARALLEL. */
+/* Callback for walk_stmts. Check if the current statement only contains
+ GIMPLE_OMP_FOR or GIMPLE_OMP_PARALLEL. */
static tree
-check_combined_parallel (tree *tp, int *walk_subtrees, void *data)
+check_combined_parallel (gimple_stmt_iterator *gsi_p,
+ bool *handled_ops_p,
+ struct walk_stmt_info *wi)
{
- struct walk_stmt_info *wi = (struct walk_stmt_info *) data;
int *info = (int *) wi->info;
+ gimple stmt = gsi_stmt (*gsi_p);
- *walk_subtrees = 0;
- switch (TREE_CODE (*tp))
+ *handled_ops_p = true;
+ switch (gimple_code (stmt))
{
- case OMP_FOR:
- case OMP_SECTIONS:
+ WALK_SUBSTMTS;
+
+ case GIMPLE_OMP_FOR:
+ case GIMPLE_OMP_SECTIONS:
*info = *info == 0 ? 1 : -1;
break;
default:
@@ -5893,9 +6028,10 @@ task_copyfn_remap_type (struct omp_taskcopy_context *tcctx, tree orig_type)
DECL_CONTEXT (new_f) = type;
TREE_TYPE (new_f) = remap_type (TREE_TYPE (f), &tcctx->cb);
TREE_CHAIN (new_f) = new_fields;
- walk_tree (&DECL_SIZE (new_f), copy_body_r, &tcctx->cb, NULL);
- walk_tree (&DECL_SIZE_UNIT (new_f), copy_body_r, &tcctx->cb, NULL);
- walk_tree (&DECL_FIELD_OFFSET (new_f), copy_body_r, &tcctx->cb, NULL);
+ walk_tree (&DECL_SIZE (new_f), copy_tree_body_r, &tcctx->cb, NULL);
+ walk_tree (&DECL_SIZE_UNIT (new_f), copy_tree_body_r, &tcctx->cb, NULL);
+ walk_tree (&DECL_FIELD_OFFSET (new_f), copy_tree_body_r,
+ &tcctx->cb, NULL);
new_fields = new_f;
*pointer_map_insert (tcctx->cb.decl_map, f) = new_f;
}
@@ -5907,7 +6043,7 @@ task_copyfn_remap_type (struct omp_taskcopy_context *tcctx, tree orig_type)
/* Create task copyfn. */
static void
-create_task_copyfn (tree task_stmt, omp_context *ctx)
+create_task_copyfn (gimple task_stmt, omp_context *ctx)
{
struct function *child_cfun;
tree child_fn, t, c, src, dst, f, sf, arg, sarg, decl;
@@ -5917,7 +6053,7 @@ create_task_copyfn (tree task_stmt, omp_context *ctx)
struct omp_taskcopy_context tcctx;
struct gimplify_ctx gctx;
- child_fn = OMP_TASK_COPYFN (task_stmt);
+ child_fn = gimple_omp_task_copy_fn (task_stmt);
child_cfun = DECL_STRUCT_FUNCTION (child_fn);
gcc_assert (child_cfun->cfg == NULL);
child_cfun->dont_save_pending_sizes_p = 1;
@@ -5935,7 +6071,7 @@ create_task_copyfn (tree task_stmt, omp_context *ctx)
TREE_SIDE_EFFECTS (bind) = 1;
list = NULL;
DECL_SAVED_TREE (child_fn) = bind;
- DECL_SOURCE_LOCATION (child_fn) = EXPR_LOCATION (task_stmt);
+ DECL_SOURCE_LOCATION (child_fn) = gimple_location (task_stmt);
/* Remap src and dst argument types if needed. */
record_type = ctx->record_type;
@@ -5985,7 +6121,7 @@ create_task_copyfn (tree task_stmt, omp_context *ctx)
/* First pass: initialize temporaries used in record_type and srecord_type
sizes and field offsets. */
if (tcctx.cb.decl_map)
- for (c = OMP_TASK_CLAUSES (task_stmt); c; c = OMP_CLAUSE_CHAIN (c))
+ for (c = gimple_omp_task_clauses (task_stmt); c; c = OMP_CLAUSE_CHAIN (c))
if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_FIRSTPRIVATE)
{
tree *p;
@@ -5999,13 +6135,13 @@ create_task_copyfn (tree task_stmt, omp_context *ctx)
sf = *(tree *) pointer_map_contains (tcctx.cb.decl_map, sf);
src = build_fold_indirect_ref (sarg);
src = build3 (COMPONENT_REF, TREE_TYPE (sf), src, sf, NULL);
- t = build_gimple_modify_stmt (*p, src);
+ t = build2 (MODIFY_EXPR, TREE_TYPE (*p), *p, src);
append_to_statement_list (t, &list);
}
/* Second pass: copy shared var pointers and copy construct non-VLA
firstprivate vars. */
- for (c = OMP_TASK_CLAUSES (task_stmt); c; c = OMP_CLAUSE_CHAIN (c))
+ for (c = gimple_omp_task_clauses (task_stmt); c; c = OMP_CLAUSE_CHAIN (c))
switch (OMP_CLAUSE_CODE (c))
{
case OMP_CLAUSE_SHARED:
@@ -6024,7 +6160,7 @@ create_task_copyfn (tree task_stmt, omp_context *ctx)
src = build3 (COMPONENT_REF, TREE_TYPE (sf), src, sf, NULL);
dst = build_fold_indirect_ref (arg);
dst = build3 (COMPONENT_REF, TREE_TYPE (f), dst, f, NULL);
- t = build_gimple_modify_stmt (dst, src);
+ t = build2 (MODIFY_EXPR, TREE_TYPE (dst), dst, src);
append_to_statement_list (t, &list);
break;
case OMP_CLAUSE_FIRSTPRIVATE:
@@ -6078,7 +6214,7 @@ create_task_copyfn (tree task_stmt, omp_context *ctx)
src = decl;
dst = build_fold_indirect_ref (arg);
dst = build3 (COMPONENT_REF, TREE_TYPE (f), dst, f, NULL);
- t = build_gimple_modify_stmt (dst, src);
+ t = build2 (MODIFY_EXPR, TREE_TYPE (dst), dst, src);
append_to_statement_list (t, &list);
break;
default:
@@ -6087,7 +6223,7 @@ create_task_copyfn (tree task_stmt, omp_context *ctx)
/* Last pass: handle VLA firstprivates. */
if (tcctx.cb.decl_map)
- for (c = OMP_TASK_CLAUSES (task_stmt); c; c = OMP_CLAUSE_CHAIN (c))
+ for (c = gimple_omp_task_clauses (task_stmt); c; c = OMP_CLAUSE_CHAIN (c))
if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_FIRSTPRIVATE)
{
tree ind, ptr, df;
@@ -6121,7 +6257,8 @@ create_task_copyfn (tree task_stmt, omp_context *ctx)
df = *(tree *) pointer_map_contains (tcctx.cb.decl_map, df);
ptr = build_fold_indirect_ref (arg);
ptr = build3 (COMPONENT_REF, TREE_TYPE (df), ptr, df, NULL);
- t = build_gimple_modify_stmt (ptr, build_fold_addr_expr (dst));
+ t = build2 (MODIFY_EXPR, TREE_TYPE (ptr), ptr,
+ build_fold_addr_expr (dst));
append_to_statement_list (t, &list);
}
@@ -6136,117 +6273,113 @@ create_task_copyfn (tree task_stmt, omp_context *ctx)
current_function_decl = ctx->cb.src_fn;
}
-/* Lower the OpenMP parallel or task directive in *STMT_P. CTX holds context
- information for the directive. */
+/* Lower the OpenMP parallel or task directive in the current statement
+ in GSI_P. CTX holds context information for the directive. */
static void
-lower_omp_taskreg (tree *stmt_p, omp_context *ctx)
+lower_omp_taskreg (gimple_stmt_iterator *gsi_p, omp_context *ctx)
{
- tree clauses, par_bind, par_body, new_body, bind;
- tree olist, ilist, par_olist, par_ilist;
- tree stmt, child_fn, t;
+ tree clauses;
+ tree child_fn, t;
+ gimple stmt = gsi_stmt (*gsi_p);
+ gimple par_bind, bind;
+ gimple_seq par_body, olist, ilist, par_olist, par_ilist, new_body;
struct gimplify_ctx gctx;
- stmt = *stmt_p;
-
- clauses = OMP_TASKREG_CLAUSES (stmt);
- par_bind = OMP_TASKREG_BODY (stmt);
- par_body = BIND_EXPR_BODY (par_bind);
+ clauses = gimple_omp_taskreg_clauses (stmt);
+ par_bind = gimple_seq_first_stmt (gimple_omp_body (stmt));
+ par_body = gimple_bind_body (par_bind);
child_fn = ctx->cb.dst_fn;
- if (TREE_CODE (stmt) == OMP_PARALLEL && !OMP_PARALLEL_COMBINED (stmt))
+ if (gimple_code (stmt) == GIMPLE_OMP_PARALLEL
+ && !gimple_omp_parallel_combined_p (stmt))
{
struct walk_stmt_info wi;
int ws_num = 0;
memset (&wi, 0, sizeof (wi));
- wi.callback = check_combined_parallel;
wi.info = &ws_num;
wi.val_only = true;
- walk_stmts (&wi, &par_bind);
+ walk_gimple_seq (par_body, check_combined_parallel, NULL, &wi);
if (ws_num == 1)
- OMP_PARALLEL_COMBINED (stmt) = 1;
+ gimple_omp_parallel_set_combined_p (stmt, true);
}
if (ctx->srecord_type)
create_task_copyfn (stmt, ctx);
push_gimplify_context (&gctx);
- par_olist = NULL_TREE;
- par_ilist = NULL_TREE;
+ par_olist = NULL;
+ par_ilist = NULL;
lower_rec_input_clauses (clauses, &par_ilist, &par_olist, ctx);
- lower_omp (&par_body, ctx);
- if (TREE_CODE (stmt) == OMP_PARALLEL)
+ lower_omp (par_body, ctx);
+ if (gimple_code (stmt) == GIMPLE_OMP_PARALLEL)
lower_reduction_clauses (clauses, &par_olist, ctx);
/* Declare all the variables created by mapping and the variables
declared in the scope of the parallel body. */
record_vars_into (ctx->block_vars, child_fn);
- record_vars_into (BIND_EXPR_VARS (par_bind), child_fn);
+ record_vars_into (gimple_bind_vars (par_bind), child_fn);
if (ctx->record_type)
{
ctx->sender_decl
= create_tmp_var (ctx->srecord_type ? ctx->srecord_type
: ctx->record_type, ".omp_data_o");
- OMP_TASKREG_DATA_ARG (stmt) = ctx->sender_decl;
+ gimple_omp_taskreg_set_data_arg (stmt, ctx->sender_decl);
}
- olist = NULL_TREE;
- ilist = NULL_TREE;
+ olist = NULL;
+ ilist = NULL;
lower_send_clauses (clauses, &ilist, &olist, ctx);
lower_send_shared_vars (&ilist, &olist, ctx);
/* Once all the expansions are done, sequence all the different
- fragments inside OMP_TASKREG_BODY. */
- bind = build3 (BIND_EXPR, void_type_node, NULL, NULL,
- BIND_EXPR_BLOCK (par_bind));
- TREE_SIDE_EFFECTS (bind) = 1;
+ fragments inside gimple_omp_body. */
- new_body = alloc_stmt_list ();
+ new_body = NULL;
if (ctx->record_type)
{
t = build_fold_addr_expr (ctx->sender_decl);
/* fixup_child_record_type might have changed receiver_decl's type. */
t = fold_convert (TREE_TYPE (ctx->receiver_decl), t);
- t = build_gimple_modify_stmt (ctx->receiver_decl, t);
- append_to_statement_list (t, &new_body);
+ gimple_seq_add_stmt (&new_body,
+ gimple_build_assign (ctx->receiver_decl, t));
}
- append_to_statement_list (par_ilist, &new_body);
- append_to_statement_list (par_body, &new_body);
- append_to_statement_list (par_olist, &new_body);
- maybe_catch_exception (&new_body);
- t = make_node (OMP_RETURN);
- append_to_statement_list (t, &new_body);
- OMP_TASKREG_BODY (stmt) = new_body;
+ gimple_seq_add_seq (&new_body, par_ilist);
+ gimple_seq_add_seq (&new_body, par_body);
+ gimple_seq_add_seq (&new_body, par_olist);
+ new_body = maybe_catch_exception (new_body);
+ gimple_seq_add_stmt (&new_body, gimple_build_omp_return (false));
+ gimple_omp_set_body (stmt, new_body);
- append_to_statement_list (stmt, &BIND_EXPR_BODY (bind));
+ bind = gimple_build_bind (NULL, NULL, gimple_bind_block (par_bind));
+ gimple_bind_add_stmt (bind, stmt);
if (ilist || olist)
{
- append_to_statement_list (bind, &ilist);
- append_to_statement_list (olist, &ilist);
- bind = build3 (BIND_EXPR, void_type_node, NULL, NULL, NULL);
- TREE_SIDE_EFFECTS (bind) = 1;
- append_to_statement_list (ilist, &BIND_EXPR_BODY (bind));
+ gimple_seq_add_stmt (&ilist, bind);
+ gimple_seq_add_seq (&ilist, olist);
+ bind = gimple_build_bind (NULL, ilist, NULL);
}
- *stmt_p = bind;
+ gsi_replace (gsi_p, bind, true);
- pop_gimplify_context (NULL_TREE);
+ pop_gimplify_context (NULL);
}
/* Callback for lower_omp_1. Return non-NULL if *tp needs to be
- regimplified. */
+ regimplified. If DATA is non-NULL, lower_omp_1 is outside
+ of OpenMP context, but with task_shared_vars set. */
static tree
-lower_omp_2 (tree *tp, int *walk_subtrees, void *data)
+lower_omp_regimplify_p (tree *tp, int *walk_subtrees,
+ void *data)
{
tree t = *tp;
- omp_context *ctx = (omp_context *) data;
/* Any variable with DECL_VALUE_EXPR needs to be regimplified. */
- if (TREE_CODE (t) == VAR_DECL && ctx && DECL_HAS_VALUE_EXPR_P (t))
+ if (TREE_CODE (t) == VAR_DECL && data == NULL && DECL_HAS_VALUE_EXPR_P (t))
return t;
if (task_shared_vars
@@ -6256,7 +6389,7 @@ lower_omp_2 (tree *tp, int *walk_subtrees, void *data)
/* If a global variable has been privatized, TREE_CONSTANT on
ADDR_EXPR might be wrong. */
- if (ctx && TREE_CODE (t) == ADDR_EXPR)
+ if (data == NULL && TREE_CODE (t) == ADDR_EXPR)
recompute_tree_invariant_for_addr_expr (t);
*walk_subtrees = !TYPE_P (t) && !DECL_P (t);
@@ -6264,158 +6397,106 @@ lower_omp_2 (tree *tp, int *walk_subtrees, void *data)
}
static void
-lower_omp_1 (tree *tp, omp_context *ctx, tree_stmt_iterator *tsi)
+lower_omp_1 (gimple_stmt_iterator *gsi_p, omp_context *ctx)
{
- tree t = *tp;
+ gimple stmt = gsi_stmt (*gsi_p);
+ struct walk_stmt_info wi;
- if (!t)
- return;
+ if (gimple_has_location (stmt))
+ input_location = gimple_location (stmt);
- if (EXPR_HAS_LOCATION (t))
- input_location = EXPR_LOCATION (t);
+ if (task_shared_vars)
+ memset (&wi, '\0', sizeof (wi));
/* If we have issued syntax errors, avoid doing any heavy lifting.
Just replace the OpenMP directives with a NOP to avoid
confusing RTL expansion. */
- if (errorcount && OMP_DIRECTIVE_P (t))
+ if (errorcount && is_gimple_omp (stmt))
{
- *tp = build_empty_stmt ();
+ gsi_replace (gsi_p, gimple_build_nop (), true);
return;
}
- switch (TREE_CODE (t))
+ switch (gimple_code (stmt))
{
- case STATEMENT_LIST:
- {
- tree_stmt_iterator i;
- for (i = tsi_start (t); !tsi_end_p (i); tsi_next (&i))
- lower_omp_1 (tsi_stmt_ptr (i), ctx, &i);
- }
- break;
-
- case COND_EXPR:
- lower_omp_1 (&COND_EXPR_THEN (t), ctx, NULL);
- lower_omp_1 (&COND_EXPR_ELSE (t), ctx, NULL);
+ case GIMPLE_COND:
if ((ctx || task_shared_vars)
- && walk_tree (&COND_EXPR_COND (t), lower_omp_2, ctx, NULL))
- {
- tree pre = NULL;
- gimplify_expr (&COND_EXPR_COND (t), &pre, NULL,
- is_gimple_condexpr, fb_rvalue);
- if (pre)
- {
- if (tsi)
- tsi_link_before (tsi, pre, TSI_SAME_STMT);
- else
- {
- append_to_statement_list (t, &pre);
- *tp = pre;
- }
- }
- }
+ && (walk_tree (gimple_cond_lhs_ptr (stmt), lower_omp_regimplify_p,
+ ctx ? NULL : &wi, NULL)
+ || walk_tree (gimple_cond_rhs_ptr (stmt), lower_omp_regimplify_p,
+ ctx ? NULL : &wi, NULL)))
+ gimple_regimplify_operands (stmt, gsi_p);
break;
- case CATCH_EXPR:
- lower_omp_1 (&CATCH_BODY (t), ctx, NULL);
+ case GIMPLE_CATCH:
+ lower_omp (gimple_catch_handler (stmt), ctx);
break;
- case EH_FILTER_EXPR:
- lower_omp_1 (&EH_FILTER_FAILURE (t), ctx, NULL);
+ case GIMPLE_EH_FILTER:
+ lower_omp (gimple_eh_filter_failure (stmt), ctx);
break;
- case TRY_CATCH_EXPR:
- case TRY_FINALLY_EXPR:
- lower_omp_1 (&TREE_OPERAND (t, 0), ctx, NULL);
- lower_omp_1 (&TREE_OPERAND (t, 1), ctx, NULL);
+ case GIMPLE_TRY:
+ lower_omp (gimple_try_eval (stmt), ctx);
+ lower_omp (gimple_try_cleanup (stmt), ctx);
break;
- case BIND_EXPR:
- lower_omp_1 (&BIND_EXPR_BODY (t), ctx, NULL);
+ case GIMPLE_BIND:
+ lower_omp (gimple_bind_body (stmt), ctx);
break;
- case RETURN_EXPR:
- lower_omp_1 (&TREE_OPERAND (t, 0), ctx, NULL);
+ case GIMPLE_OMP_PARALLEL:
+ case GIMPLE_OMP_TASK:
+ ctx = maybe_lookup_ctx (stmt);
+ lower_omp_taskreg (gsi_p, ctx);
break;
-
- case OMP_PARALLEL:
- case OMP_TASK:
- ctx = maybe_lookup_ctx (t);
- lower_omp_taskreg (tp, ctx);
- break;
- case OMP_FOR:
- ctx = maybe_lookup_ctx (t);
+ case GIMPLE_OMP_FOR:
+ ctx = maybe_lookup_ctx (stmt);
gcc_assert (ctx);
- lower_omp_for (tp, ctx);
+ lower_omp_for (gsi_p, ctx);
break;
- case OMP_SECTIONS:
- ctx = maybe_lookup_ctx (t);
+ case GIMPLE_OMP_SECTIONS:
+ ctx = maybe_lookup_ctx (stmt);
gcc_assert (ctx);
- lower_omp_sections (tp, ctx);
+ lower_omp_sections (gsi_p, ctx);
break;
- case OMP_SINGLE:
- ctx = maybe_lookup_ctx (t);
+ case GIMPLE_OMP_SINGLE:
+ ctx = maybe_lookup_ctx (stmt);
gcc_assert (ctx);
- lower_omp_single (tp, ctx);
+ lower_omp_single (gsi_p, ctx);
break;
- case OMP_MASTER:
- ctx = maybe_lookup_ctx (t);
+ case GIMPLE_OMP_MASTER:
+ ctx = maybe_lookup_ctx (stmt);
gcc_assert (ctx);
- lower_omp_master (tp, ctx);
+ lower_omp_master (gsi_p, ctx);
break;
- case OMP_ORDERED:
- ctx = maybe_lookup_ctx (t);
+ case GIMPLE_OMP_ORDERED:
+ ctx = maybe_lookup_ctx (stmt);
gcc_assert (ctx);
- lower_omp_ordered (tp, ctx);
+ lower_omp_ordered (gsi_p, ctx);
break;
- case OMP_CRITICAL:
- ctx = maybe_lookup_ctx (t);
+ case GIMPLE_OMP_CRITICAL:
+ ctx = maybe_lookup_ctx (stmt);
gcc_assert (ctx);
- lower_omp_critical (tp, ctx);
+ lower_omp_critical (gsi_p, ctx);
+ break;
+ case GIMPLE_OMP_ATOMIC_LOAD:
+ if ((ctx || task_shared_vars)
+ && walk_tree (gimple_omp_atomic_load_rhs_ptr (stmt),
+ lower_omp_regimplify_p, ctx ? NULL : &wi, NULL))
+ gimple_regimplify_operands (stmt, gsi_p);
break;
-
default:
if ((ctx || task_shared_vars)
- && walk_tree (tp, lower_omp_2, ctx, NULL))
- {
- /* The gimplifier doesn't gimplify CALL_EXPR_STATIC_CHAIN.
- Handle that here. */
- tree call = get_call_expr_in (t);
- if (call
- && CALL_EXPR_STATIC_CHAIN (call)
- && walk_tree (&CALL_EXPR_STATIC_CHAIN (call), lower_omp_2,
- ctx, NULL))
- {
- tree pre = NULL;
- gimplify_expr (&CALL_EXPR_STATIC_CHAIN (call), &pre, NULL,
- is_gimple_val, fb_rvalue);
- if (pre)
- {
- if (tsi)
- tsi_link_before (tsi, pre, TSI_SAME_STMT);
- else
- {
- append_to_statement_list (t, &pre);
- lower_omp_1 (&pre, ctx, NULL);
- *tp = pre;
- return;
- }
- }
- }
-
- if (tsi == NULL)
- gimplify_stmt (tp);
- else
- {
- tree pre = NULL;
- gimplify_expr (tp, &pre, NULL, is_gimple_stmt, fb_none);
- if (pre)
- tsi_link_before (tsi, pre, TSI_SAME_STMT);
- }
- }
+ && walk_gimple_op (stmt, lower_omp_regimplify_p,
+ ctx ? NULL : &wi))
+ gimple_regimplify_operands (stmt, gsi_p);
break;
}
}
static void
-lower_omp (tree *stmt_p, omp_context *ctx)
+lower_omp (gimple_seq body, omp_context *ctx)
{
location_t saved_location = input_location;
- lower_omp_1 (stmt_p, ctx, NULL);
+ gimple_stmt_iterator gsi = gsi_start (body);
+ for (gsi = gsi_start (body); !gsi_end_p (gsi); gsi_next (&gsi))
+ lower_omp_1 (&gsi, ctx);
input_location = saved_location;
}
@@ -6424,10 +6505,13 @@ lower_omp (tree *stmt_p, omp_context *ctx)
static unsigned int
execute_lower_omp (void)
{
+ gimple_seq body;
+
all_contexts = splay_tree_new (splay_tree_compare_pointers, 0,
delete_omp_context);
- scan_omp (&DECL_SAVED_TREE (current_function_decl), NULL);
+ body = gimple_body (current_function_decl);
+ scan_omp (body, NULL);
gcc_assert (taskreg_nesting_level == 0);
if (all_contexts->root)
@@ -6436,7 +6520,7 @@ execute_lower_omp (void)
if (task_shared_vars)
push_gimplify_context (&gctx);
- lower_omp (&DECL_SAVED_TREE (current_function_decl), NULL);
+ lower_omp (body, NULL);
if (task_shared_vars)
pop_gimplify_context (NULL);
}
@@ -6485,13 +6569,25 @@ static splay_tree all_labels;
true if an error is detected. */
static bool
-diagnose_sb_0 (tree *stmt_p, tree branch_ctx, tree label_ctx)
+diagnose_sb_0 (gimple_stmt_iterator *gsi_p,
+ gimple branch_ctx, gimple label_ctx)
{
- bool exit_p = true;
-
- if ((label_ctx ? TREE_VALUE (label_ctx) : NULL) == branch_ctx)
+ if (label_ctx == branch_ctx)
return false;
+
+ /*
+ Previously we kept track of the label's entire context in diagnose_sb_[12]
+ so we could traverse it and issue a correct "exit" or "enter" error
+ message upon a structured block violation.
+
+ We built the context by building a list with tree_cons'ing, but there is
+ no easy counterpart in gimple tuples. It seems like far too much work
+ for issuing exit/enter error messages. If someone really misses the
+ distinct error message... patches welcome.
+ */
+
+#if 0
/* Try to avoid confusing the user by producing and error message
with correct "exit" or "enter" verbiage. We prefer "exit"
unless we can show that LABEL_CTX is nested within BRANCH_CTX. */
@@ -6514,63 +6610,64 @@ diagnose_sb_0 (tree *stmt_p, tree branch_ctx, tree label_ctx)
error ("invalid exit from OpenMP structured block");
else
error ("invalid entry to OpenMP structured block");
+#endif
- *stmt_p = build_empty_stmt ();
+ /* If it's obvious we have an invalid entry, be specific about the error. */
+ if (branch_ctx == NULL)
+ error ("invalid entry to OpenMP structured block");
+ else
+ /* Otherwise, be vague and lazy, but efficient. */
+ error ("invalid branch to/from an OpenMP structured block");
+
+ gsi_replace (gsi_p, gimple_build_nop (), false);
return true;
}
/* Pass 1: Create a minimal tree of OpenMP structured blocks, and record
- where in the tree each label is found. */
+ where each label is found. */
static tree
-diagnose_sb_1 (tree *tp, int *walk_subtrees, void *data)
+diagnose_sb_1 (gimple_stmt_iterator *gsi_p, bool *handled_ops_p,
+ struct walk_stmt_info *wi)
{
- struct walk_stmt_info *wi = (struct walk_stmt_info *) data;
- tree context = (tree) wi->info;
- tree inner_context;
- tree t = *tp;
- int i;
+ gimple context = (gimple) wi->info;
+ gimple inner_context;
+ gimple stmt = gsi_stmt (*gsi_p);
- *walk_subtrees = 0;
- switch (TREE_CODE (t))
+ *handled_ops_p = true;
+
+ switch (gimple_code (stmt))
{
- case OMP_PARALLEL:
- case OMP_TASK:
- case OMP_SECTIONS:
- case OMP_SINGLE:
- walk_tree (&OMP_CLAUSES (t), diagnose_sb_1, wi, NULL);
- /* FALLTHRU */
- case OMP_SECTION:
- case OMP_MASTER:
- case OMP_ORDERED:
- case OMP_CRITICAL:
- /* The minimal context here is just a tree of statements. */
- inner_context = tree_cons (NULL, t, context);
+ WALK_SUBSTMTS;
+
+ case GIMPLE_OMP_PARALLEL:
+ case GIMPLE_OMP_TASK:
+ case GIMPLE_OMP_SECTIONS:
+ case GIMPLE_OMP_SINGLE:
+ case GIMPLE_OMP_SECTION:
+ case GIMPLE_OMP_MASTER:
+ case GIMPLE_OMP_ORDERED:
+ case GIMPLE_OMP_CRITICAL:
+ /* The minimal context here is just the current OMP construct. */
+ inner_context = stmt;
wi->info = inner_context;
- walk_stmts (wi, &OMP_BODY (t));
+ walk_gimple_seq (gimple_omp_body (stmt), diagnose_sb_1, NULL, wi);
wi->info = context;
break;
- case OMP_FOR:
- walk_tree (&OMP_FOR_CLAUSES (t), diagnose_sb_1, wi, NULL);
- inner_context = tree_cons (NULL, t, context);
+ case GIMPLE_OMP_FOR:
+ inner_context = stmt;
wi->info = inner_context;
- for (i = 0; i < TREE_VEC_LENGTH (OMP_FOR_INIT (t)); i++)
- {
- walk_tree (&TREE_VEC_ELT (OMP_FOR_INIT (t), i), diagnose_sb_1,
- wi, NULL);
- walk_tree (&TREE_VEC_ELT (OMP_FOR_COND (t), i), diagnose_sb_1,
- wi, NULL);
- walk_tree (&TREE_VEC_ELT (OMP_FOR_INCR (t), i), diagnose_sb_1,
- wi, NULL);
- }
- walk_stmts (wi, &OMP_FOR_PRE_BODY (t));
- walk_stmts (wi, &OMP_FOR_BODY (t));
+ /* gimple_omp_for_{index,initial,final} are all DECLs; no need to
+ walk them. */
+ walk_gimple_seq (gimple_omp_for_pre_body (stmt),
+ diagnose_sb_1, NULL, wi);
+ walk_gimple_seq (gimple_omp_body (stmt), diagnose_sb_1, NULL, wi);
wi->info = context;
break;
- case LABEL_EXPR:
- splay_tree_insert (all_labels, (splay_tree_key) LABEL_EXPR_LABEL (t),
+ case GIMPLE_LABEL:
+ splay_tree_insert (all_labels, (splay_tree_key) gimple_label_label (stmt),
(splay_tree_value) context);
break;
@@ -6585,76 +6682,68 @@ diagnose_sb_1 (tree *tp, int *walk_subtrees, void *data)
the destination label's context. */
static tree
-diagnose_sb_2 (tree *tp, int *walk_subtrees, void *data)
+diagnose_sb_2 (gimple_stmt_iterator *gsi_p, bool *handled_ops_p,
+ struct walk_stmt_info *wi)
{
- struct walk_stmt_info *wi = (struct walk_stmt_info *) data;
- tree context = (tree) wi->info;
+ gimple context = (gimple) wi->info;
splay_tree_node n;
- tree t = *tp;
- int i;
+ gimple stmt = gsi_stmt (*gsi_p);
- *walk_subtrees = 0;
- switch (TREE_CODE (t))
+ *handled_ops_p = true;
+
+ switch (gimple_code (stmt))
{
- case OMP_PARALLEL:
- case OMP_TASK:
- case OMP_SECTIONS:
- case OMP_SINGLE:
- walk_tree (&OMP_CLAUSES (t), diagnose_sb_2, wi, NULL);
- /* FALLTHRU */
- case OMP_SECTION:
- case OMP_MASTER:
- case OMP_ORDERED:
- case OMP_CRITICAL:
- wi->info = t;
- walk_stmts (wi, &OMP_BODY (t));
+ WALK_SUBSTMTS;
+
+ case GIMPLE_OMP_PARALLEL:
+ case GIMPLE_OMP_TASK:
+ case GIMPLE_OMP_SECTIONS:
+ case GIMPLE_OMP_SINGLE:
+ case GIMPLE_OMP_SECTION:
+ case GIMPLE_OMP_MASTER:
+ case GIMPLE_OMP_ORDERED:
+ case GIMPLE_OMP_CRITICAL:
+ wi->info = stmt;
+ walk_gimple_seq (gimple_omp_body (stmt), diagnose_sb_2, NULL, wi);
wi->info = context;
break;
- case OMP_FOR:
- walk_tree (&OMP_FOR_CLAUSES (t), diagnose_sb_2, wi, NULL);
- wi->info = t;
- for (i = 0; i < TREE_VEC_LENGTH (OMP_FOR_INIT (t)); i++)
- {
- walk_tree (&TREE_VEC_ELT (OMP_FOR_INIT (t), i), diagnose_sb_2,
- wi, NULL);
- walk_tree (&TREE_VEC_ELT (OMP_FOR_COND (t), i), diagnose_sb_2,
- wi, NULL);
- walk_tree (&TREE_VEC_ELT (OMP_FOR_INCR (t), i), diagnose_sb_2,
- wi, NULL);
- }
- walk_stmts (wi, &OMP_FOR_PRE_BODY (t));
- walk_stmts (wi, &OMP_FOR_BODY (t));
+ case GIMPLE_OMP_FOR:
+ wi->info = stmt;
+ /* gimple_omp_for_{index,initial,final} are all DECLs; no need to
+ walk them. */
+ walk_gimple_seq (gimple_omp_for_pre_body (stmt),
+ diagnose_sb_2, NULL, wi);
+ walk_gimple_seq (gimple_omp_body (stmt), diagnose_sb_2, NULL, wi);
wi->info = context;
break;
- case GOTO_EXPR:
+ case GIMPLE_GOTO:
{
- tree lab = GOTO_DESTINATION (t);
+ tree lab = gimple_goto_dest (stmt);
if (TREE_CODE (lab) != LABEL_DECL)
break;
n = splay_tree_lookup (all_labels, (splay_tree_key) lab);
- diagnose_sb_0 (tp, context, n ? (tree) n->value : NULL_TREE);
+ diagnose_sb_0 (gsi_p, context, n ? (gimple) n->value : NULL);
}
break;
- case SWITCH_EXPR:
+ case GIMPLE_SWITCH:
{
- tree vec = SWITCH_LABELS (t);
- int i, len = TREE_VEC_LENGTH (vec);
- for (i = 0; i < len; ++i)
+ unsigned int i;
+ for (i = 0; i < gimple_switch_num_labels (stmt); ++i)
{
- tree lab = CASE_LABEL (TREE_VEC_ELT (vec, i));
+ tree lab = CASE_LABEL (gimple_switch_label (stmt, i));
n = splay_tree_lookup (all_labels, (splay_tree_key) lab);
- if (diagnose_sb_0 (tp, context, (tree) n->value))
+ if (n && diagnose_sb_0 (gsi_p, context, (gimple) n->value))
break;
}
}
break;
- case RETURN_EXPR:
- diagnose_sb_0 (tp, context, NULL_TREE);
+ case GIMPLE_RETURN:
+ diagnose_sb_0 (gsi_p, context, NULL);
break;
default:
@@ -6669,24 +6758,25 @@ diagnose_omp_structured_block_errors (tree fndecl)
{
tree save_current = current_function_decl;
struct walk_stmt_info wi;
+ struct function *old_cfun = cfun;
+ gimple_seq body = gimple_body (fndecl);
current_function_decl = fndecl;
+ set_cfun (DECL_STRUCT_FUNCTION (fndecl));
all_labels = splay_tree_new (splay_tree_compare_pointers, 0, 0);
memset (&wi, 0, sizeof (wi));
- wi.callback = diagnose_sb_1;
- walk_stmts (&wi, &DECL_SAVED_TREE (fndecl));
+ walk_gimple_seq (body, diagnose_sb_1, NULL, &wi);
memset (&wi, 0, sizeof (wi));
- wi.callback = diagnose_sb_2;
wi.want_locations = true;
- wi.want_return_expr = true;
- walk_stmts (&wi, &DECL_SAVED_TREE (fndecl));
+ walk_gimple_seq (body, diagnose_sb_2, NULL, &wi);
splay_tree_delete (all_labels);
all_labels = NULL;
+ set_cfun (old_cfun);
current_function_decl = save_current;
}
diff --git a/gcc/opt-functions.awk b/gcc/opt-functions.awk
index 213e9497dcf..a14b8c203d5 100644
--- a/gcc/opt-functions.awk
+++ b/gcc/opt-functions.awk
@@ -128,6 +128,23 @@ function var_type(flags)
return "const char *"
}
+# Return the type of variable that should be associated with the given flags
+# for use within a structure. Simple variables are changed to unsigned char
+# type instead of int to save space.
+function var_type_struct(flags)
+{
+ if (flag_set_p("UInteger", flags))
+ return "int "
+ else if (!flag_set_p("Joined.*", flags)) {
+ if (flag_set_p(".*Mask.*", flags))
+ return "int "
+ else
+ return "unsigned char "
+ }
+ else
+ return "const char *"
+}
+
# Given that an option has flags FLAGS, return an initializer for the
# "var_cond" and "var_value" fields of its cl_options[] entry.
function var_set(flags)
diff --git a/gcc/optabs.c b/gcc/optabs.c
index 6e8c6cf3d21..5d2545dd3b9 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -1571,14 +1571,14 @@ expand_binop (enum machine_mode mode, optab binoptab, rtx op0, rtx op1,
enum optab_methods next_methods
= (methods == OPTAB_LIB || methods == OPTAB_LIB_WIDEN
? OPTAB_WIDEN : methods);
- enum mode_class class;
+ enum mode_class mclass;
enum machine_mode wider_mode;
rtx libfunc;
rtx temp;
rtx entry_last = get_last_insn ();
rtx last;
- class = GET_MODE_CLASS (mode);
+ mclass = GET_MODE_CLASS (mode);
/* If subtracting an integer constant, convert this into an addition of
the negated constant. */
@@ -1609,7 +1609,7 @@ expand_binop (enum machine_mode mode, optab binoptab, rtx op0, rtx op1,
&& optab_handler (rotr_optab, mode)->insn_code != CODE_FOR_nothing)
|| (binoptab == rotr_optab
&& optab_handler (rotl_optab, mode)->insn_code != CODE_FOR_nothing))
- && class == MODE_INT)
+ && mclass == MODE_INT)
{
optab otheroptab = (binoptab == rotl_optab ? rotr_optab : rotl_optab);
rtx newop1;
@@ -1658,7 +1658,7 @@ expand_binop (enum machine_mode mode, optab binoptab, rtx op0, rtx op1,
can open-code the operation. Check for a widening multiply at the
wider mode as well. */
- if (CLASS_HAS_WIDER_MODES_P (class)
+ if (CLASS_HAS_WIDER_MODES_P (mclass)
&& methods != OPTAB_DIRECT && methods != OPTAB_LIB)
for (wider_mode = GET_MODE_WIDER_MODE (mode);
wider_mode != VOIDmode;
@@ -1683,7 +1683,7 @@ expand_binop (enum machine_mode mode, optab binoptab, rtx op0, rtx op1,
|| binoptab == xor_optab
|| binoptab == add_optab || binoptab == sub_optab
|| binoptab == smul_optab || binoptab == ashl_optab)
- && class == MODE_INT)
+ && mclass == MODE_INT)
{
no_extend = 1;
xop0 = avoid_expensive_constant (mode, binoptab,
@@ -1703,7 +1703,7 @@ expand_binop (enum machine_mode mode, optab binoptab, rtx op0, rtx op1,
unsignedp, OPTAB_DIRECT);
if (temp)
{
- if (class != MODE_INT
+ if (mclass != MODE_INT
|| !TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (mode),
GET_MODE_BITSIZE (wider_mode)))
{
@@ -1734,7 +1734,7 @@ expand_binop (enum machine_mode mode, optab binoptab, rtx op0, rtx op1,
/* These can be done a word at a time. */
if ((binoptab == and_optab || binoptab == ior_optab || binoptab == xor_optab)
- && class == MODE_INT
+ && mclass == MODE_INT
&& GET_MODE_SIZE (mode) > UNITS_PER_WORD
&& optab_handler (binoptab, word_mode)->insn_code != CODE_FOR_nothing)
{
@@ -1785,8 +1785,8 @@ expand_binop (enum machine_mode mode, optab binoptab, rtx op0, rtx op1,
/* Synthesize double word shifts from single word shifts. */
if ((binoptab == lshr_optab || binoptab == ashl_optab
|| binoptab == ashr_optab)
- && class == MODE_INT
- && (GET_CODE (op1) == CONST_INT || !optimize_size)
+ && mclass == MODE_INT
+ && (GET_CODE (op1) == CONST_INT || optimize_insn_for_speed_p ())
&& GET_MODE_SIZE (mode) == 2 * UNITS_PER_WORD
&& optab_handler (binoptab, word_mode)->insn_code != CODE_FOR_nothing
&& optab_handler (ashl_optab, word_mode)->insn_code != CODE_FOR_nothing
@@ -1855,7 +1855,7 @@ expand_binop (enum machine_mode mode, optab binoptab, rtx op0, rtx op1,
/* Synthesize double word rotates from single word shifts. */
if ((binoptab == rotl_optab || binoptab == rotr_optab)
- && class == MODE_INT
+ && mclass == MODE_INT
&& GET_CODE (op1) == CONST_INT
&& GET_MODE_SIZE (mode) == 2 * UNITS_PER_WORD
&& optab_handler (ashl_optab, word_mode)->insn_code != CODE_FOR_nothing
@@ -1968,7 +1968,7 @@ expand_binop (enum machine_mode mode, optab binoptab, rtx op0, rtx op1,
/* These can be done a word at a time by propagating carries. */
if ((binoptab == add_optab || binoptab == sub_optab)
- && class == MODE_INT
+ && mclass == MODE_INT
&& GET_MODE_SIZE (mode) >= 2 * UNITS_PER_WORD
&& optab_handler (binoptab, word_mode)->insn_code != CODE_FOR_nothing)
{
@@ -2094,7 +2094,7 @@ expand_binop (enum machine_mode mode, optab binoptab, rtx op0, rtx op1,
try using a signed widening multiply. */
if (binoptab == smul_optab
- && class == MODE_INT
+ && mclass == MODE_INT
&& GET_MODE_SIZE (mode) == 2 * UNITS_PER_WORD
&& optab_handler (smul_optab, word_mode)->insn_code != CODE_FOR_nothing
&& optab_handler (add_optab, word_mode)->insn_code != CODE_FOR_nothing)
@@ -2197,7 +2197,7 @@ expand_binop (enum machine_mode mode, optab binoptab, rtx op0, rtx op1,
/* Look for a wider mode of the same class for which it appears we can do
the operation. */
- if (CLASS_HAS_WIDER_MODES_P (class))
+ if (CLASS_HAS_WIDER_MODES_P (mclass))
{
for (wider_mode = GET_MODE_WIDER_MODE (mode);
wider_mode != VOIDmode;
@@ -2219,7 +2219,7 @@ expand_binop (enum machine_mode mode, optab binoptab, rtx op0, rtx op1,
|| binoptab == xor_optab
|| binoptab == add_optab || binoptab == sub_optab
|| binoptab == smul_optab || binoptab == ashl_optab)
- && class == MODE_INT)
+ && mclass == MODE_INT)
no_extend = 1;
xop0 = widen_operand (xop0, wider_mode, mode,
@@ -2233,7 +2233,7 @@ expand_binop (enum machine_mode mode, optab binoptab, rtx op0, rtx op1,
unsignedp, methods);
if (temp)
{
- if (class != MODE_INT
+ if (mclass != MODE_INT
|| !TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (mode),
GET_MODE_BITSIZE (wider_mode)))
{
@@ -2327,12 +2327,12 @@ expand_twoval_unop (optab unoptab, rtx op0, rtx targ0, rtx targ1,
int unsignedp)
{
enum machine_mode mode = GET_MODE (targ0 ? targ0 : targ1);
- enum mode_class class;
+ enum mode_class mclass;
enum machine_mode wider_mode;
rtx entry_last = get_last_insn ();
rtx last;
- class = GET_MODE_CLASS (mode);
+ mclass = GET_MODE_CLASS (mode);
if (!targ0)
targ0 = gen_reg_rtx (mode);
@@ -2374,7 +2374,7 @@ expand_twoval_unop (optab unoptab, rtx op0, rtx targ0, rtx targ1,
/* It can't be done in this mode. Can we do it in a wider mode? */
- if (CLASS_HAS_WIDER_MODES_P (class))
+ if (CLASS_HAS_WIDER_MODES_P (mclass))
{
for (wider_mode = GET_MODE_WIDER_MODE (mode);
wider_mode != VOIDmode;
@@ -2420,12 +2420,12 @@ expand_twoval_binop (optab binoptab, rtx op0, rtx op1, rtx targ0, rtx targ1,
int unsignedp)
{
enum machine_mode mode = GET_MODE (targ0 ? targ0 : targ1);
- enum mode_class class;
+ enum mode_class mclass;
enum machine_mode wider_mode;
rtx entry_last = get_last_insn ();
rtx last;
- class = GET_MODE_CLASS (mode);
+ mclass = GET_MODE_CLASS (mode);
if (!targ0)
targ0 = gen_reg_rtx (mode);
@@ -2491,7 +2491,7 @@ expand_twoval_binop (optab binoptab, rtx op0, rtx op1, rtx targ0, rtx targ1,
/* It can't be done in this mode. Can we do it in a wider mode? */
- if (CLASS_HAS_WIDER_MODES_P (class))
+ if (CLASS_HAS_WIDER_MODES_P (mclass))
{
for (wider_mode = GET_MODE_WIDER_MODE (mode);
wider_mode != VOIDmode;
@@ -2591,8 +2591,8 @@ expand_simple_unop (enum machine_mode mode, enum rtx_code code, rtx op0,
static rtx
widen_clz (enum machine_mode mode, rtx op0, rtx target)
{
- enum mode_class class = GET_MODE_CLASS (mode);
- if (CLASS_HAS_WIDER_MODES_P (class))
+ enum mode_class mclass = GET_MODE_CLASS (mode);
+ if (CLASS_HAS_WIDER_MODES_P (mclass))
{
enum machine_mode wider_mode;
for (wider_mode = GET_MODE_WIDER_MODE (mode);
@@ -2702,11 +2702,11 @@ expand_doubleword_clz (enum machine_mode mode, rtx op0, rtx target)
static rtx
widen_bswap (enum machine_mode mode, rtx op0, rtx target)
{
- enum mode_class class = GET_MODE_CLASS (mode);
+ enum mode_class mclass = GET_MODE_CLASS (mode);
enum machine_mode wider_mode;
rtx x, last;
- if (!CLASS_HAS_WIDER_MODES_P (class))
+ if (!CLASS_HAS_WIDER_MODES_P (mclass))
return NULL_RTX;
for (wider_mode = GET_MODE_WIDER_MODE (mode);
@@ -2767,8 +2767,8 @@ expand_doubleword_bswap (enum machine_mode mode, rtx op, rtx target)
static rtx
expand_parity (enum machine_mode mode, rtx op0, rtx target)
{
- enum mode_class class = GET_MODE_CLASS (mode);
- if (CLASS_HAS_WIDER_MODES_P (class))
+ enum mode_class mclass = GET_MODE_CLASS (mode);
+ if (CLASS_HAS_WIDER_MODES_P (mclass))
{
enum machine_mode wider_mode;
for (wider_mode = mode; wider_mode != VOIDmode;
@@ -3116,7 +3116,7 @@ rtx
expand_unop (enum machine_mode mode, optab unoptab, rtx op0, rtx target,
int unsignedp)
{
- enum mode_class class = GET_MODE_CLASS (mode);
+ enum mode_class mclass = GET_MODE_CLASS (mode);
enum machine_mode wider_mode;
rtx temp;
rtx libfunc;
@@ -3163,7 +3163,7 @@ expand_unop (enum machine_mode mode, optab unoptab, rtx op0, rtx target,
goto try_libcall;
}
- if (CLASS_HAS_WIDER_MODES_P (class))
+ if (CLASS_HAS_WIDER_MODES_P (mclass))
for (wider_mode = GET_MODE_WIDER_MODE (mode);
wider_mode != VOIDmode;
wider_mode = GET_MODE_WIDER_MODE (wider_mode))
@@ -3180,14 +3180,14 @@ expand_unop (enum machine_mode mode, optab unoptab, rtx op0, rtx target,
xop0 = widen_operand (xop0, wider_mode, mode, unsignedp,
(unoptab == neg_optab
|| unoptab == one_cmpl_optab)
- && class == MODE_INT);
+ && mclass == MODE_INT);
temp = expand_unop (wider_mode, unoptab, xop0, NULL_RTX,
unsignedp);
if (temp)
{
- if (class != MODE_INT
+ if (mclass != MODE_INT
|| !TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (mode),
GET_MODE_BITSIZE (wider_mode)))
{
@@ -3206,7 +3206,7 @@ expand_unop (enum machine_mode mode, optab unoptab, rtx op0, rtx target,
/* These can be done a word at a time. */
if (unoptab == one_cmpl_optab
- && class == MODE_INT
+ && mclass == MODE_INT
&& GET_MODE_SIZE (mode) > UNITS_PER_WORD
&& optab_handler (unoptab, word_mode)->insn_code != CODE_FOR_nothing)
{
@@ -3323,7 +3323,7 @@ expand_unop (enum machine_mode mode, optab unoptab, rtx op0, rtx target,
/* It can't be done in this mode. Can we do it in a wider mode? */
- if (CLASS_HAS_WIDER_MODES_P (class))
+ if (CLASS_HAS_WIDER_MODES_P (mclass))
{
for (wider_mode = GET_MODE_WIDER_MODE (mode);
wider_mode != VOIDmode;
@@ -3343,7 +3343,7 @@ expand_unop (enum machine_mode mode, optab unoptab, rtx op0, rtx target,
xop0 = widen_operand (xop0, wider_mode, mode, unsignedp,
(unoptab == neg_optab
|| unoptab == one_cmpl_optab)
- && class == MODE_INT);
+ && mclass == MODE_INT);
temp = expand_unop (wider_mode, unoptab, xop0, NULL_RTX,
unsignedp);
@@ -3358,7 +3358,7 @@ expand_unop (enum machine_mode mode, optab unoptab, rtx op0, rtx target,
if (temp)
{
- if (class != MODE_INT)
+ if (mclass != MODE_INT)
{
if (target == 0)
target = gen_reg_rtx (mode);
@@ -3759,14 +3759,17 @@ expand_copysign (rtx op0, rtx op1, rtx target)
with two operands: an output TARGET and an input OP0.
TARGET *must* be nonzero, and the output is always stored there.
CODE is an rtx code such that (CODE OP0) is an rtx that describes
- the value that is stored into TARGET. */
+ the value that is stored into TARGET.
-void
-emit_unop_insn (int icode, rtx target, rtx op0, enum rtx_code code)
+ Return false if expansion failed. */
+
+bool
+maybe_emit_unop_insn (int icode, rtx target, rtx op0, enum rtx_code code)
{
rtx temp;
enum machine_mode mode0 = insn_data[icode].operand[1].mode;
rtx pat;
+ rtx last = get_last_insn ();
temp = target;
@@ -3779,6 +3782,11 @@ emit_unop_insn (int icode, rtx target, rtx op0, enum rtx_code code)
temp = gen_reg_rtx (GET_MODE (temp));
pat = GEN_FCN (icode) (temp, op0);
+ if (!pat)
+ {
+ delete_insns_since (last);
+ return false;
+ }
if (INSN_P (pat) && NEXT_INSN (pat) != NULL_RTX && code != UNKNOWN)
add_equal_note (pat, temp, code, op0, NULL_RTX);
@@ -3787,6 +3795,19 @@ emit_unop_insn (int icode, rtx target, rtx op0, enum rtx_code code)
if (temp != target)
emit_move_insn (target, temp);
+ return true;
+}
+/* Generate an instruction whose insn-code is INSN_CODE,
+ with two operands: an output TARGET and an input OP0.
+ TARGET *must* be nonzero, and the output is always stored there.
+ CODE is an rtx code such that (CODE OP0) is an rtx that describes
+ the value that is stored into TARGET. */
+
+void
+emit_unop_insn (int icode, rtx target, rtx op0, enum rtx_code code)
+{
+ bool ok = maybe_emit_unop_insn (icode, target, op0, code);
+ gcc_assert (ok);
}
struct no_conflict_data
@@ -4191,7 +4212,7 @@ emit_cmp_and_jump_insn_1 (rtx x, rtx y, enum machine_mode mode,
enum rtx_code comparison, int unsignedp, rtx label)
{
rtx test = gen_rtx_fmt_ee (comparison, mode, x, y);
- enum mode_class class = GET_MODE_CLASS (mode);
+ enum mode_class mclass = GET_MODE_CLASS (mode);
enum machine_mode wider_mode = mode;
/* Try combined insns first. */
@@ -4238,7 +4259,7 @@ emit_cmp_and_jump_insn_1 (rtx x, rtx y, enum machine_mode mode,
return;
}
- if (!CLASS_HAS_WIDER_MODES_P (class))
+ if (!CLASS_HAS_WIDER_MODES_P (mclass))
break;
wider_mode = GET_MODE_WIDER_MODE (wider_mode);
@@ -5140,6 +5161,7 @@ expand_fix (rtx to, rtx from, int unsignedp)
if (icode != CODE_FOR_nothing)
{
+ rtx last = get_last_insn ();
if (fmode != GET_MODE (from))
from = convert_to_mode (fmode, from, 0);
@@ -5153,11 +5175,14 @@ expand_fix (rtx to, rtx from, int unsignedp)
if (imode != GET_MODE (to))
target = gen_reg_rtx (imode);
- emit_unop_insn (icode, target, from,
- doing_unsigned ? UNSIGNED_FIX : FIX);
- if (target != to)
- convert_move (to, target, unsignedp);
- return;
+ if (maybe_emit_unop_insn (icode, target, from,
+ doing_unsigned ? UNSIGNED_FIX : FIX))
+ {
+ if (target != to)
+ convert_move (to, target, unsignedp);
+ return;
+ }
+ delete_insns_since (last);
}
}
@@ -5365,13 +5390,18 @@ expand_sfix_optab (rtx to, rtx from, convert_optab tab)
icode = convert_optab_handler (tab, imode, fmode)->insn_code;
if (icode != CODE_FOR_nothing)
{
+ rtx last = get_last_insn ();
if (fmode != GET_MODE (from))
from = convert_to_mode (fmode, from, 0);
if (imode != GET_MODE (to))
target = gen_reg_rtx (imode);
- emit_unop_insn (icode, target, from, UNKNOWN);
+ if (!maybe_emit_unop_insn (icode, target, from, UNKNOWN))
+ {
+ delete_insns_since (last);
+ continue;
+ }
if (target != to)
convert_move (to, target, 0);
return true;
diff --git a/gcc/optabs.h b/gcc/optabs.h
index 30a28d4816d..4d0ce5245ea 100644
--- a/gcc/optabs.h
+++ b/gcc/optabs.h
@@ -722,6 +722,7 @@ extern rtx expand_copysign (rtx, rtx, rtx);
/* Generate an instruction with a given INSN_CODE with an output and
an input. */
extern void emit_unop_insn (int, rtx, rtx, enum rtx_code);
+extern bool maybe_emit_unop_insn (int, rtx, rtx, enum rtx_code);
/* Emit one rtl insn to compare two rtx's. */
extern void emit_cmp_insn (rtx, rtx, enum rtx_code, rtx, enum machine_mode,
diff --git a/gcc/optc-gen.awk b/gcc/optc-gen.awk
index 79fe800018b..d53ba69aa76 100644
--- a/gcc/optc-gen.awk
+++ b/gcc/optc-gen.awk
@@ -28,6 +28,7 @@
BEGIN {
n_opts = 0
n_langs = 0
+ n_target_save = 0
quote = "\042"
comma = ","
FS=SUBSEP
@@ -41,6 +42,11 @@ BEGIN {
langs[n_langs] = $2
n_langs++;
}
+ else if ($1 == "TargetSave") {
+ # Make sure the declarations are put in source order
+ target_save_decl[n_target_save] = $2
+ n_target_save++
+ }
else {
name = opt_args("Mask", $1)
if (name == "") {
@@ -64,10 +70,17 @@ print "#include " quote "intl.h" quote
print ""
print "#ifdef GCC_DRIVER"
print "int target_flags;"
+print "#else"
+print "#include " quote "flags.h" quote
+print "#include " quote "target.h" quote
print "#endif /* GCC_DRIVER */"
print ""
+have_save = 0;
for (i = 0; i < n_opts; i++) {
+ if (flag_set_p("Save", flags[i]))
+ have_save = 1;
+
name = var_name(flags[i]);
if (name == "")
continue;
@@ -210,4 +223,310 @@ for (i = 0; i < n_opts; i++) {
}
print "};"
+
+print "";
+print "#if !defined(GCC_DRIVER) && !defined(IN_LIBGCC2) && !defined(IN_TARGET_LIBS)"
+print "";
+print "/* Save optimization variables into a structure. */"
+print "void";
+print "cl_optimization_save (struct cl_optimization *ptr)";
+print "{";
+
+n_opt_char = 2;
+n_opt_short = 0;
+n_opt_int = 0;
+n_opt_other = 0;
+var_opt_char[0] = "optimize";
+var_opt_char[1] = "optimize_size";
+var_opt_range["optimize"] = "0, 255";
+var_opt_range["optimize_size"] = "0, 255";
+
+# Sort by size to mimic how the structure is laid out to be friendlier to the
+# cache.
+
+for (i = 0; i < n_opts; i++) {
+ if (flag_set_p("Optimization", flags[i])) {
+ name = var_name(flags[i])
+ if(name == "")
+ continue;
+
+ if(name in var_opt_seen)
+ continue;
+
+ var_opt_seen[name]++;
+ otype = var_type_struct(flags[i]);
+ if (otype ~ "^((un)?signed +)?int *$")
+ var_opt_int[n_opt_int++] = name;
+
+ else if (otype ~ "^((un)?signed +)?short *$")
+ var_opt_short[n_opt_short++] = name;
+
+ else if (otype ~ "^((un)?signed +)?char *$") {
+ var_opt_char[n_opt_char++] = name;
+ if (otype ~ "^unsigned +char *$")
+ var_opt_range[name] = "0, 255"
+ else if (otype ~ "^signed +char *$")
+ var_opt_range[name] = "-128, 127"
+ }
+ else
+ var_opt_other[n_opt_other++] = name;
+ }
+}
+
+for (i = 0; i < n_opt_char; i++) {
+ name = var_opt_char[i];
+ if (var_opt_range[name] != "")
+ print " gcc_assert (IN_RANGE (" name ", " var_opt_range[name] "));";
+}
+
+print "";
+for (i = 0; i < n_opt_other; i++) {
+ print " ptr->" var_opt_other[i] " = " var_opt_other[i] ";";
+}
+
+for (i = 0; i < n_opt_int; i++) {
+ print " ptr->" var_opt_int[i] " = " var_opt_int[i] ";";
+}
+
+for (i = 0; i < n_opt_short; i++) {
+ print " ptr->" var_opt_short[i] " = " var_opt_short[i] ";";
+}
+
+for (i = 0; i < n_opt_char; i++) {
+ print " ptr->" var_opt_char[i] " = " var_opt_char[i] ";";
+}
+
+print "}";
+
+print "";
+print "/* Restore optimization options from a structure. */";
+print "void";
+print "cl_optimization_restore (struct cl_optimization *ptr)";
+print "{";
+
+for (i = 0; i < n_opt_other; i++) {
+ print " " var_opt_other[i] " = ptr->" var_opt_other[i] ";";
+}
+
+for (i = 0; i < n_opt_int; i++) {
+ print " " var_opt_int[i] " = ptr->" var_opt_int[i] ";";
+}
+
+for (i = 0; i < n_opt_short; i++) {
+ print " " var_opt_short[i] " = ptr->" var_opt_short[i] ";";
+}
+
+for (i = 0; i < n_opt_char; i++) {
+ print " " var_opt_char[i] " = ptr->" var_opt_char[i] ";";
+}
+
+print "}";
+
+print "";
+print "/* Print optimization options from a structure. */";
+print "void";
+print "cl_optimization_print (FILE *file,";
+print " int indent_to,";
+print " struct cl_optimization *ptr)";
+print "{";
+
+print " fputs (\"\\n\", file);";
+for (i = 0; i < n_opt_other; i++) {
+ print " if (ptr->" var_opt_other[i] ")";
+ print " fprintf (file, \"%*s%s (0x%lx)\\n\",";
+ print " indent_to, \"\",";
+ print " \"" var_opt_other[i] "\",";
+ print " (unsigned long)ptr->" var_opt_other[i] ");";
+ print "";
+}
+
+for (i = 0; i < n_opt_int; i++) {
+ print " if (ptr->" var_opt_int[i] ")";
+ print " fprintf (file, \"%*s%s (0x%x)\\n\",";
+ print " indent_to, \"\",";
+ print " \"" var_opt_int[i] "\",";
+ print " ptr->" var_opt_int[i] ");";
+ print "";
+}
+
+for (i = 0; i < n_opt_short; i++) {
+ print " if (ptr->" var_opt_short[i] ")";
+ print " fprintf (file, \"%*s%s (0x%x)\\n\",";
+ print " indent_to, \"\",";
+ print " \"" var_opt_short[i] "\",";
+ print " ptr->" var_opt_short[i] ");";
+ print "";
+}
+
+for (i = 0; i < n_opt_char; i++) {
+ print " if (ptr->" var_opt_char[i] ")";
+ print " fprintf (file, \"%*s%s (0x%x)\\n\",";
+ print " indent_to, \"\",";
+ print " \"" var_opt_char[i] "\",";
+ print " ptr->" var_opt_char[i] ");";
+ print "";
+}
+
+print "}";
+
+print "";
+print "/* Save selected option variables into a structure. */"
+print "void";
+print "cl_target_option_save (struct cl_target_option *ptr)";
+print "{";
+
+n_target_char = 0;
+n_target_short = 0;
+n_target_int = 0;
+n_target_other = 0;
+
+if (have_save) {
+ for (i = 0; i < n_opts; i++) {
+ if (flag_set_p("Save", flags[i])) {
+ name = var_name(flags[i])
+ if(name == "")
+ name = "target_flags";
+
+ if(name in var_save_seen)
+ continue;
+
+ var_save_seen[name]++;
+ otype = var_type_struct(flags[i])
+ if (otype ~ "^((un)?signed +)?int *$")
+ var_target_int[n_target_int++] = name;
+
+ else if (otype ~ "^((un)?signed +)?short *$")
+ var_target_short[n_target_short++] = name;
+
+ else if (otype ~ "^((un)?signed +)?char *$") {
+ var_target_char[n_target_char++] = name;
+ if (otype ~ "^unsigned +char *$")
+ var_target_range[name] = "0, 255"
+ else if (otype ~ "^signed +char *$")
+ var_target_range[name] = "-128, 127"
+ }
+ else
+ var_target_other[n_target_other++] = name;
+ }
+ }
+} else {
+ var_target_int[n_target_int++] = "target_flags";
+}
+
+have_assert = 0;
+for (i = 0; i < n_target_char; i++) {
+ name = var_target_char[i];
+ if (var_target_range[name] != "") {
+ have_assert = 1;
+ print " gcc_assert (IN_RANGE (" name ", " var_target_range[name] "));";
+ }
+}
+
+if (have_assert)
+ print "";
+
+print " if (targetm.target_option.save)";
+print " targetm.target_option.save (ptr);";
+print "";
+
+for (i = 0; i < n_target_other; i++) {
+ print " ptr->" var_target_other[i] " = " var_target_other[i] ";";
+}
+
+for (i = 0; i < n_target_int; i++) {
+ print " ptr->" var_target_int[i] " = " var_target_int[i] ";";
+}
+
+for (i = 0; i < n_target_short; i++) {
+ print " ptr->" var_target_short[i] " = " var_target_short[i] ";";
+}
+
+for (i = 0; i < n_target_char; i++) {
+ print " ptr->" var_target_char[i] " = " var_target_char[i] ";";
+}
+
+print "}";
+
+print "";
+print "/* Restore selected current options from a structure. */";
+print "void";
+print "cl_target_option_restore (struct cl_target_option *ptr)";
+print "{";
+
+for (i = 0; i < n_target_other; i++) {
+ print " " var_target_other[i] " = ptr->" var_target_other[i] ";";
+}
+
+for (i = 0; i < n_target_int; i++) {
+ print " " var_target_int[i] " = ptr->" var_target_int[i] ";";
+}
+
+for (i = 0; i < n_target_short; i++) {
+ print " " var_target_short[i] " = ptr->" var_target_short[i] ";";
+}
+
+for (i = 0; i < n_target_char; i++) {
+ print " " var_target_char[i] " = ptr->" var_target_char[i] ";";
+}
+
+# This must occur after the normal variables in case the code depends on those
+# variables.
+print "";
+print " if (targetm.target_option.restore)";
+print " targetm.target_option.restore (ptr);";
+
+print "}";
+
+print "";
+print "/* Print optimization options from a structure. */";
+print "void";
+print "cl_target_option_print (FILE *file,";
+print " int indent,";
+print " struct cl_target_option *ptr)";
+print "{";
+
+print " fputs (\"\\n\", file);";
+for (i = 0; i < n_target_other; i++) {
+ print " if (ptr->" var_target_other[i] ")";
+ print " fprintf (file, \"%*s%s (0x%lx)\\n\",";
+ print " indent, \"\",";
+ print " \"" var_target_other[i] "\",";
+ print " (unsigned long)ptr->" var_target_other[i] ");";
+ print "";
+}
+
+for (i = 0; i < n_target_int; i++) {
+ print " if (ptr->" var_target_int[i] ")";
+ print " fprintf (file, \"%*s%s (0x%x)\\n\",";
+ print " indent, \"\",";
+ print " \"" var_target_int[i] "\",";
+ print " ptr->" var_target_int[i] ");";
+ print "";
+}
+
+for (i = 0; i < n_target_short; i++) {
+ print " if (ptr->" var_target_short[i] ")";
+ print " fprintf (file, \"%*s%s (0x%x)\\n\",";
+ print " indent, \"\",";
+ print " \"" var_target_short[i] "\",";
+ print " ptr->" var_target_short[i] ");";
+ print "";
+}
+
+for (i = 0; i < n_target_char; i++) {
+ print " if (ptr->" var_target_char[i] ")";
+ print " fprintf (file, \"%*s%s (0x%x)\\n\",";
+ print " indent, \"\",";
+ print " \"" var_target_char[i] "\",";
+ print " ptr->" var_target_char[i] ");";
+ print "";
+}
+
+print "";
+print " if (targetm.target_option.print)";
+print " targetm.target_option.print (file, indent, ptr);";
+
+print "}";
+print "#endif";
+
}
diff --git a/gcc/opth-gen.awk b/gcc/opth-gen.awk
index 9aa18a12ad9..a67e5b77a8b 100644
--- a/gcc/opth-gen.awk
+++ b/gcc/opth-gen.awk
@@ -26,6 +26,7 @@
BEGIN {
n_opts = 0
n_langs = 0
+ n_target_save = 0
n_extra_masks = 0
quote = "\042"
comma = ","
@@ -38,6 +39,11 @@ BEGIN {
langs[n_langs] = $2
n_langs++;
}
+ else if ($1 == "TargetSave") {
+ # Make sure the declarations are put in source order
+ target_save_decl[n_target_save] = $2
+ n_target_save++
+ }
else {
name = opt_args("Mask", $1)
if (name == "") {
@@ -64,15 +70,180 @@ print "extern int target_flags;"
print "extern int target_flags_explicit;"
print ""
+have_save = 0;
+
for (i = 0; i < n_opts; i++) {
+ if (flag_set_p("Save", flags[i]))
+ have_save = 1;
+
name = var_name(flags[i]);
if (name == "")
continue;
+ if (name in var_seen)
+ continue;
+
+ var_seen[name] = 1;
print "extern " var_type(flags[i]) name ";"
}
print ""
+# All of the optimization switches gathered together so they can be saved and restored.
+# This will allow attribute((cold)) to turn on space optimization.
+
+# Change the type of normal switches from int to unsigned char to save space.
+# Also, order the structure so that pointer fields occur first, then int
+# fields, and then char fields to provide the best packing.
+
+print "#if !defined(GCC_DRIVER) && !defined(IN_LIBGCC2) && !defined(IN_TARGET_LIBS)"
+print ""
+print "/* Structure to save/restore optimization and target specific options. */";
+print "struct cl_optimization GTY(())";
+print "{";
+
+n_opt_char = 2;
+n_opt_short = 0;
+n_opt_int = 0;
+n_opt_other = 0;
+var_opt_char[0] = "unsigned char optimize";
+var_opt_char[1] = "unsigned char optimize_size";
+
+for (i = 0; i < n_opts; i++) {
+ if (flag_set_p("Optimization", flags[i])) {
+ name = var_name(flags[i])
+ if(name == "")
+ continue;
+
+ if(name in var_opt_seen)
+ continue;
+
+ var_opt_seen[name]++;
+ otype = var_type_struct(flags[i]);
+ if (otype ~ "^((un)?signed +)?int *$")
+ var_opt_int[n_opt_int++] = otype name;
+
+ else if (otype ~ "^((un)?signed +)?short *$")
+ var_opt_short[n_opt_short++] = otype name;
+
+ else if (otype ~ "^((un)?signed +)?char *$")
+ var_opt_char[n_opt_char++] = otype name;
+
+ else
+ var_opt_other[n_opt_other++] = otype name;
+ }
+}
+
+for (i = 0; i < n_opt_other; i++) {
+ print " " var_opt_other[i] ";";
+}
+
+for (i = 0; i < n_opt_int; i++) {
+ print " " var_opt_int[i] ";";
+}
+
+for (i = 0; i < n_opt_short; i++) {
+ print " " var_opt_short[i] ";";
+}
+
+for (i = 0; i < n_opt_char; i++) {
+ print " " var_opt_char[i] ";";
+}
+
+print "};";
+print "";
+
+# Target and optimization save/restore/print functions.
+print "/* Structure to save/restore selected target specific options. */";
+print "struct cl_target_option GTY(())";
+print "{";
+
+n_target_char = 0;
+n_target_short = 0;
+n_target_int = 0;
+n_target_other = 0;
+
+for (i = 0; i < n_target_save; i++) {
+ if (target_save_decl[i] ~ "^((un)?signed +)?int +[_a-zA-Z0-9]+$")
+ var_target_int[n_target_int++] = target_save_decl[i];
+
+ else if (target_save_decl[i] ~ "^((un)?signed +)?short +[_a-zA-Z0-9]+$")
+ var_target_short[n_target_short++] = target_save_decl[i];
+
+ else if (target_save_decl[i] ~ "^((un)?signed +)?char +[_a-zA-Z0-9]+$")
+ var_target_char[n_target_char++] = target_save_decl[i];
+
+ else
+ var_target_other[n_target_other++] = target_save_decl[i];
+}
+
+if (have_save) {
+ for (i = 0; i < n_opts; i++) {
+ if (flag_set_p("Save", flags[i])) {
+ name = var_name(flags[i])
+ if(name == "")
+ name = "target_flags";
+
+ if(name in var_save_seen)
+ continue;
+
+ var_save_seen[name]++;
+ otype = var_type_struct(flags[i])
+ if (otype ~ "^((un)?signed +)?int *$")
+ var_target_int[n_target_int++] = otype name;
+
+ else if (otype ~ "^((un)?signed +)?short *$")
+ var_target_short[n_target_short++] = otype name;
+
+ else if (otype ~ "^((un)?signed +)?char *$")
+ var_target_char[n_target_char++] = otype name;
+
+ else
+ var_target_other[n_target_other++] = otype name;
+ }
+ }
+} else {
+ var_target_int[n_target_int++] = "int target_flags";
+}
+
+for (i = 0; i < n_target_other; i++) {
+ print " " var_target_other[i] ";";
+}
+
+for (i = 0; i < n_target_int; i++) {
+ print " " var_target_int[i] ";";
+}
+
+for (i = 0; i < n_target_short; i++) {
+ print " " var_target_short[i] ";";
+}
+
+for (i = 0; i < n_target_char; i++) {
+ print " " var_target_char[i] ";";
+}
+
+print "};";
+print "";
+print "";
+print "/* Save optimization variables into a structure. */"
+print "extern void cl_optimization_save (struct cl_optimization *);";
+print "";
+print "/* Restore optimization variables from a structure. */";
+print "extern void cl_optimization_restore (struct cl_optimization *);";
+print "";
+print "/* Print optimization variables from a structure. */";
+print "extern void cl_optimization_print (FILE *, int, struct cl_optimization *);";
+print "";
+print "/* Save selected option variables into a structure. */"
+print "extern void cl_target_option_save (struct cl_target_option *);";
+print "";
+print "/* Restore selected option variables from a structure. */"
+print "extern void cl_target_option_restore (struct cl_target_option *);";
+print "";
+print "/* Print target option variables from a structure. */";
+print "extern void cl_target_option_print (FILE *, int, struct cl_target_option *);";
+print "#endif";
+print "";
+
for (i = 0; i < n_opts; i++) {
name = opt_args("Mask", flags[i])
vname = var_name(flags[i])
diff --git a/gcc/opts.c b/gcc/opts.c
index ecc720dc15e..1da98747e1c 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -63,9 +63,6 @@ HOST_WIDE_INT larger_than_size;
bool warn_frame_larger_than;
HOST_WIDE_INT frame_larger_than_size;
-/* Hack for cooperation between set_Wunused and set_Wextra. */
-static bool maybe_warn_unused_parameter;
-
/* Type(s) of debugging information we are producing (if any). See
flags.h for the definitions of the different possible types of
debugging information. */
@@ -333,11 +330,6 @@ bool use_gnu_debug_info_extensions;
/* The default visibility for all symbols (unless overridden) */
enum symbol_visibility default_visibility = VISIBILITY_DEFAULT;
-/* Disable unit-at-a-time for frontends that might be still broken in this
- respect. */
-
-bool no_unit_at_a_time_default;
-
/* Global visibility options. */
struct visibility_flags visibility_options;
@@ -810,12 +802,36 @@ handle_options (unsigned int argc, const char **argv, unsigned int lang_mask)
void
decode_options (unsigned int argc, const char **argv)
{
- unsigned int i, lang_mask;
+ static bool first_time_p = true;
+ static int initial_max_aliased_vops;
+ static int initial_avg_aliased_vops;
+ static int initial_min_crossjump_insns;
+ static int initial_max_fields_for_field_sensitive;
+ static unsigned int initial_lang_mask;
- /* Perform language-specific options initialization. */
- lang_mask = lang_hooks.init_options (argc, argv);
+ unsigned int i, lang_mask;
+ int opt1;
+ int opt2;
+ int opt3;
+ int opt1_max;
- lang_hooks.initialize_diagnostics (global_dc);
+ if (first_time_p)
+ {
+ /* Perform language-specific options initialization. */
+ initial_lang_mask = lang_mask = lang_hooks.init_options (argc, argv);
+
+ lang_hooks.initialize_diagnostics (global_dc);
+
+ /* Save initial values of parameters we reset. */
+ initial_max_aliased_vops = MAX_ALIASED_VOPS;
+ initial_avg_aliased_vops = AVG_ALIASED_VOPS;
+ initial_min_crossjump_insns
+ = compiler_params[PARAM_MIN_CROSSJUMP_INSNS].value;
+ initial_max_fields_for_field_sensitive
+ = compiler_params[PARAM_MAX_FIELDS_FOR_FIELD_SENSITIVE].value;
+ }
+ else
+ lang_mask = initial_lang_mask;
/* Scan to see what optimization level has been specified. That will
determine the default value of many flags. */
@@ -849,151 +865,197 @@ decode_options (unsigned int argc, const char **argv)
}
}
}
+
+ if (!flag_unit_at_a_time)
+ {
+ flag_section_anchors = 0;
+ flag_toplevel_reorder = 0;
+ }
+ if (!flag_toplevel_reorder)
+ {
+ if (flag_section_anchors == 1)
+ error ("Section anchors must be disabled when toplevel reorder is disabled.");
+ flag_section_anchors = 0;
+ }
+ /* Originally we just set the variables if a particular optimization level,
+ but with the advent of being able to change the optimization level for a
+ function, we need to reset optimizations. */
if (!optimize)
{
flag_merge_constants = 0;
- }
- if (!no_unit_at_a_time_default)
- {
- flag_unit_at_a_time = 1;
- if (!optimize)
+ /* We disable toplevel reordering at -O0 to disable transformations that
+ might be surprising to end users and to get -fno-toplevel-reorder
+ tested, but we keep section anchors. */
+ if (flag_toplevel_reorder == 2)
flag_toplevel_reorder = 0;
}
+ else
+ flag_merge_constants = 1;
- if (optimize >= 1)
- {
- flag_defer_pop = 1;
+ /* -O1 optimizations. */
+ opt1 = (optimize >= 1);
+ flag_defer_pop = opt1;
#ifdef DELAY_SLOTS
- flag_delayed_branch = 1;
+ flag_delayed_branch = opt1;
#endif
#ifdef CAN_DEBUG_WITHOUT_FP
- flag_omit_frame_pointer = 1;
+ flag_omit_frame_pointer = opt1;
#endif
- flag_guess_branch_prob = 1;
- flag_cprop_registers = 1;
- flag_if_conversion = 1;
- flag_if_conversion2 = 1;
- flag_ipa_pure_const = 1;
- flag_ipa_reference = 1;
- flag_split_wide_types = 1;
- flag_tree_ccp = 1;
- flag_tree_dce = 1;
- flag_tree_dom = 1;
- flag_tree_dse = 1;
- flag_tree_ter = 1;
- flag_tree_sra = 1;
- flag_tree_copyrename = 1;
- flag_tree_fre = 1;
- flag_tree_copy_prop = 1;
- flag_tree_sink = 1;
-
- if (!optimize_size)
- {
- /* Loop header copying usually increases size of the code. This used
- not to be true, since quite often it is possible to verify that
- the condition is satisfied in the first iteration and therefore
- to eliminate it. Jump threading handles these cases now. */
- flag_tree_ch = 1;
- }
- }
-
- if (optimize >= 2)
- {
- flag_inline_small_functions = 1;
- flag_thread_jumps = 1;
- flag_crossjumping = 1;
- flag_optimize_sibling_calls = 1;
- flag_forward_propagate = 1;
- flag_cse_follow_jumps = 1;
- flag_gcse = 1;
- flag_expensive_optimizations = 1;
- flag_rerun_cse_after_loop = 1;
- flag_caller_saves = 1;
- flag_peephole2 = 1;
+ flag_guess_branch_prob = opt1;
+ flag_cprop_registers = opt1;
+ flag_if_conversion = opt1;
+ flag_if_conversion2 = opt1;
+ flag_ipa_pure_const = opt1;
+ flag_ipa_reference = opt1;
+ flag_split_wide_types = opt1;
+ flag_tree_ccp = opt1;
+ flag_tree_dce = opt1;
+ flag_tree_dom = opt1;
+ flag_tree_dse = opt1;
+ flag_tree_ter = opt1;
+ flag_tree_sra = opt1;
+ flag_tree_copyrename = opt1;
+ flag_tree_fre = opt1;
+ flag_tree_copy_prop = opt1;
+ flag_tree_sink = opt1;
+ flag_tree_ch = opt1;
+
+ /* -O2 optimizations. */
+ opt2 = (optimize >= 2);
+ flag_inline_small_functions = opt2;
+ flag_indirect_inlining = opt2;
+ flag_thread_jumps = opt2;
+ flag_crossjumping = opt2;
+ flag_optimize_sibling_calls = opt2;
+ flag_forward_propagate = opt2;
+ flag_cse_follow_jumps = opt2;
+ flag_gcse = opt2;
+ flag_expensive_optimizations = opt2;
+ flag_rerun_cse_after_loop = opt2;
+ flag_caller_saves = opt2;
+ flag_peephole2 = opt2;
#ifdef INSN_SCHEDULING
- flag_schedule_insns = 1;
- flag_schedule_insns_after_reload = 1;
+ flag_schedule_insns = opt2;
+ flag_schedule_insns_after_reload = opt2;
#endif
- flag_regmove = 1;
- flag_strict_aliasing = 1;
- flag_strict_overflow = 1;
- flag_delete_null_pointer_checks = 1;
- flag_reorder_blocks = 1;
- flag_reorder_functions = 1;
- flag_tree_store_ccp = 1;
- flag_tree_vrp = 1;
+ flag_regmove = opt2;
+ flag_strict_aliasing = opt2;
+ flag_strict_overflow = opt2;
+ flag_delete_null_pointer_checks = opt2;
+ flag_reorder_blocks = opt2;
+ flag_reorder_functions = opt2;
+ flag_tree_store_ccp = opt2;
+ flag_tree_vrp = opt2;
+ flag_tree_builtin_call_dce = opt2;
+ flag_tree_pre = opt2;
flag_tree_switch_conversion = 1;
- if (!optimize_size)
- {
- /* Conditional DCE generates bigger code. */
- flag_tree_builtin_call_dce = 1;
- /* PRE tends to generate bigger code. */
- flag_tree_pre = 1;
- }
-
/* Allow more virtual operators to increase alias precision. */
- set_param_value ("max-aliased-vops", 500);
- /* Track fields in field-sensitive alias analysis. */
- set_param_value ("max-fields-for-field-sensitive", 100);
- }
+ set_param_value ("max-aliased-vops",
+ (opt2) ? 500 : initial_max_aliased_vops);
- if (optimize >= 3)
- {
- flag_predictive_commoning = 1;
- flag_inline_functions = 1;
- flag_unswitch_loops = 1;
- flag_gcse_after_reload = 1;
- flag_tree_vectorize = 1;
+ /* Track fields in field-sensitive alias analysis. */
+ set_param_value ("max-fields-for-field-sensitive",
+ (opt2) ? 100 : initial_max_fields_for_field_sensitive);
- /* Allow even more virtual operators. */
- set_param_value ("max-aliased-vops", 1000);
- set_param_value ("avg-aliased-vops", 3);
- }
+ /* -O3 optimizations. */
+ opt3 = (optimize >= 3);
+ flag_predictive_commoning = opt3;
+ flag_inline_functions = opt3;
+ flag_unswitch_loops = opt3;
+ flag_gcse_after_reload = opt3;
+ flag_tree_vectorize = opt3;
+
+ /* Allow even more virtual operators. Max-aliased-vops was set above for
+ -O2, so don't reset it unless we are at -O3. */
+ if (opt3)
+ set_param_value ("max-aliased-vops", 1000);
+
+ set_param_value ("avg-aliased-vops", (opt3) ? 3 : initial_avg_aliased_vops);
+
+ /* Just -O1/-O0 optimizations. */
+ opt1_max = (optimize <= 1);
+ align_loops = opt1_max;
+ align_jumps = opt1_max;
+ align_labels = opt1_max;
+ align_functions = opt1_max;
- if (optimize < 2 || optimize_size)
+ if (optimize_size)
{
+ /* Loop header copying usually increases size of the code. This used not to
+ be true, since quite often it is possible to verify that the condition is
+ satisfied in the first iteration and therefore to eliminate it. Jump
+ threading handles these cases now. */
+ flag_tree_ch = 0;
+
+ /* Conditional DCE generates bigger code. */
+ flag_tree_builtin_call_dce = 0;
+
+ /* PRE tends to generate bigger code. */
+ flag_tree_pre = 0;
+
+ /* These options are set with -O3, so reset for -Os */
+ flag_predictive_commoning = 0;
+ flag_inline_functions = 0;
+ flag_unswitch_loops = 0;
+ flag_gcse_after_reload = 0;
+ flag_tree_vectorize = 0;
+
+ /* Don't reorder blocks when optimizing for size because extra jump insns may
+ be created; also barrier may create extra padding.
+
+ More correctly we should have a block reordering mode that tried to
+ minimize the combined size of all the jumps. This would more or less
+ automatically remove extra jumps, but would also try to use more short
+ jumps instead of long jumps. */
+ flag_reorder_blocks = 0;
+ flag_reorder_blocks_and_partition = 0;
+
+ /* Inlining of functions reducing size is a good idea regardless of them
+ being declared inline. */
+ flag_inline_functions = 1;
+
+ /* Don't align code. */
align_loops = 1;
align_jumps = 1;
align_labels = 1;
align_functions = 1;
- /* Don't reorder blocks when optimizing for size because extra
- jump insns may be created; also barrier may create extra padding.
+ /* Unroll/prefetch switches that may be set on the command line, and tend to
+ generate bigger code. */
+ flag_unroll_loops = 0;
+ flag_unroll_all_loops = 0;
+ flag_prefetch_loop_arrays = 0;
- More correctly we should have a block reordering mode that tried
- to minimize the combined size of all the jumps. This would more
- or less automatically remove extra jumps, but would also try to
- use more short jumps instead of long jumps. */
- flag_reorder_blocks = 0;
- flag_reorder_blocks_and_partition = 0;
- }
-
- if (optimize_size)
- {
- /* Inlining of functions reducing size is a good idea regardless
- of them being declared inline. */
- flag_inline_functions = 1;
+ /* Basic optimization options. */
+ optimize_size = 1;
+ if (optimize > 2)
+ optimize = 2;
/* We want to crossjump as much as possible. */
set_param_value ("min-crossjump-insns", 1);
}
+ else
+ set_param_value ("min-crossjump-insns", initial_min_crossjump_insns);
- /* Initialize whether `char' is signed. */
- flag_signed_char = DEFAULT_SIGNED_CHAR;
- /* Set this to a special "uninitialized" value. The actual default is set
- after target options have been processed. */
- flag_short_enums = 2;
-
- /* Initialize target_flags before OPTIMIZATION_OPTIONS so the latter can
- modify it. */
- target_flags = targetm.default_target_flags;
-
- /* Some targets have ABI-specified unwind tables. */
- flag_unwind_tables = targetm.unwind_tables_default;
+ if (first_time_p)
+ {
+ /* Initialize whether `char' is signed. */
+ flag_signed_char = DEFAULT_SIGNED_CHAR;
+ /* Set this to a special "uninitialized" value. The actual default is
+ set after target options have been processed. */
+ flag_short_enums = 2;
+
+ /* Initialize target_flags before OPTIMIZATION_OPTIONS so the latter can
+ modify it. */
+ target_flags = targetm.default_target_flags;
+
+ /* Some targets have ABI-specified unwind tables. */
+ flag_unwind_tables = targetm.unwind_tables_default;
+ }
#ifdef OPTIMIZATION_OPTIONS
/* Allow default optimizations to be specified on a per-machine basis. */
@@ -1002,47 +1064,20 @@ decode_options (unsigned int argc, const char **argv)
handle_options (argc, argv, lang_mask);
- if (flag_pie)
- flag_pic = flag_pie;
- if (flag_pic && !flag_pie)
- flag_shlib = 1;
-
- if (flag_no_inline == 2)
- flag_no_inline = 0;
- else
- flag_really_no_inline = flag_no_inline;
+ if (first_time_p)
+ {
+ if (flag_pie)
+ flag_pic = flag_pie;
+ if (flag_pic && !flag_pie)
+ flag_shlib = 1;
+ }
- /* Set flag_no_inline before the post_options () hook. The C front
- ends use it to determine tree inlining defaults. FIXME: such
- code should be lang-independent when all front ends use tree
- inlining, in which case it, and this condition, should be moved
- to the top of process_options() instead. */
if (optimize == 0)
{
/* Inlining does not work if not optimizing,
so force it not to be done. */
- flag_no_inline = 1;
warn_inline = 0;
-
- /* The c_decode_option function and decode_option hook set
- this to `2' if -Wall is used, so we can avoid giving out
- lots of errors for people who don't realize what -Wall does. */
- if (warn_uninitialized == 1)
- warning (OPT_Wuninitialized,
- "-Wuninitialized is not supported without -O");
- }
-
- if (flag_really_no_inline == 2)
- flag_really_no_inline = flag_no_inline;
-
- /* Inlining of functions called just once will only work if we can look
- at the complete translation unit. */
- if (flag_inline_functions_called_once && !flag_unit_at_a_time)
- {
- flag_inline_functions_called_once = 0;
- warning (OPT_Wdisabled_optimization,
- "-funit-at-a-time is required for inlining of functions "
- "that are only called once");
+ flag_no_inline = 1;
}
/* The optimization to partition hot and cold basic blocks into separate
@@ -1083,6 +1118,14 @@ decode_options (unsigned int argc, const char **argv)
flag_reorder_blocks_and_partition = 0;
flag_reorder_blocks = 1;
}
+
+ /* Save the current optimization options if this is the first call. */
+ if (first_time_p)
+ {
+ optimization_default_node = build_optimization_node ();
+ optimization_current_node = optimization_default_node;
+ first_time_p = false;
+ }
}
#define LEFT_COLUMN 27
@@ -1622,7 +1665,7 @@ common_handle_option (size_t scode, const char *arg, int value,
break;
case OPT_Wunused:
- set_Wunused (value);
+ warn_unused = value;
break;
case OPT_aux_info:
@@ -2013,7 +2056,6 @@ static void
set_Wextra (int setting)
{
extra_warnings = setting;
- warn_unused_parameter = (setting && maybe_warn_unused_parameter);
/* We save the value of warn_uninitialized, since if they put
-Wuninitialized on the command line, we need to generate a
@@ -2024,23 +2066,6 @@ set_Wextra (int setting)
warn_uninitialized = 2;
}
-/* Initialize unused warning flags. */
-void
-set_Wunused (int setting)
-{
- warn_unused_function = setting;
- warn_unused_label = setting;
- /* Unused function parameter warnings are reported when either
- ``-Wextra -Wunused'' or ``-Wunused-parameter'' is specified.
- Thus, if -Wextra has already been seen, set warn_unused_parameter;
- otherwise set maybe_warn_extra_parameter, which will be picked up
- by set_Wextra. */
- maybe_warn_unused_parameter = setting;
- warn_unused_parameter = (setting && extra_warnings);
- warn_unused_variable = setting;
- warn_unused_value = setting;
-}
-
/* Used to set the level of strict aliasing warnings,
when no level is specified (i.e., when -Wstrict-aliasing, and not
-Wstrict-aliasing=level was given).
@@ -2096,6 +2121,18 @@ fast_math_flags_set_p (void)
&& !flag_errno_math);
}
+/* Return true iff flags are set as if -ffast-math but using the flags stored
+ in the struct cl_optimization structure. */
+bool
+fast_math_flags_struct_set_p (struct cl_optimization *opt)
+{
+ return (!opt->flag_trapping_math
+ && opt->flag_unsafe_math_optimizations
+ && opt->flag_finite_math_only
+ && !opt->flag_signed_zeros
+ && !opt->flag_errno_math);
+}
+
/* Handle a debug output -g switch. EXTENDED is true or false to support
extended output (2 is special and means "-ggdb" was given). */
static void
diff --git a/gcc/opts.h b/gcc/opts.h
index 2f543407de0..62ad89aa5a5 100644
--- a/gcc/opts.h
+++ b/gcc/opts.h
@@ -64,7 +64,6 @@ extern const struct cl_option cl_options[];
extern const unsigned int cl_options_count;
extern const char *const lang_names[];
extern const unsigned int cl_lang_count;
-extern bool no_unit_at_a_time_default;
#define CL_PARAMS (1 << 18) /* Fake entry. Used to display --param info with --help. */
#define CL_WARNING (1 << 19) /* Enables an (optional) warning message. */
diff --git a/gcc/passes.c b/gcc/passes.c
index e1d019fa9fd..ee3826b39db 100644
--- a/gcc/passes.c
+++ b/gcc/passes.c
@@ -180,7 +180,7 @@ rest_of_decl_compilation (tree decl,
/* Don't output anything when a tentative file-scope definition
is seen. But at end of compilation, do output code for them.
- We do output all variables when unit-at-a-time is active and rely on
+ We do output all variables and rely on
callgraph code to defer them except for forward declarations
(see gcc.c-torture/compile/920624-1.c) */
if ((at_end
@@ -406,7 +406,7 @@ register_dump_files_1 (struct opt_pass *pass, int properties)
int new_properties = (properties | pass->properties_provided)
& ~pass->properties_destroyed;
- if (pass->name)
+ if (pass->name && pass->name[0] != '*')
register_one_dump_file (pass);
if (pass->sub)
@@ -447,13 +447,13 @@ next_pass_1 (struct opt_pass **list, struct opt_pass *pass)
pass is already in the list. */
if (pass->static_pass_number)
{
- struct opt_pass *new;
+ struct opt_pass *new_pass;
- new = XNEW (struct opt_pass);
- memcpy (new, pass, sizeof (*new));
- new->next = NULL;
+ new_pass = XNEW (struct opt_pass);
+ memcpy (new_pass, pass, sizeof (*new_pass));
+ new_pass->next = NULL;
- new->todo_flags_start &= ~TODO_mark_first_instance;
+ new_pass->todo_flags_start &= ~TODO_mark_first_instance;
/* Indicate to register_dump_files that this pass has duplicates,
and so it should rename the dump file. The first instance will
@@ -462,10 +462,10 @@ next_pass_1 (struct opt_pass **list, struct opt_pass *pass)
if (pass->name)
{
pass->static_pass_number -= 1;
- new->static_pass_number = -pass->static_pass_number;
+ new_pass->static_pass_number = -pass->static_pass_number;
}
- *list = new;
+ *list = new_pass;
}
else
{
@@ -523,9 +523,7 @@ init_optimization_passes (void)
NEXT_PASS (pass_inline_parameters);
*p = NULL;
- /* Interprocedural optimization passes.
- All these passes are ignored in -fno-unit-at-a-time
- except for subpasses of early_local_passes. */
+ /* Interprocedural optimization passes. */
p = &all_ipa_passes;
NEXT_PASS (pass_ipa_function_and_variable_visibility);
NEXT_PASS (pass_ipa_early_inline);
@@ -542,13 +540,14 @@ init_optimization_passes (void)
NEXT_PASS (pass_cleanup_cfg);
NEXT_PASS (pass_init_datastructures);
NEXT_PASS (pass_expand_omp);
+
+ NEXT_PASS (pass_referenced_vars);
+ NEXT_PASS (pass_reset_cc_flags);
+ NEXT_PASS (pass_build_ssa);
+ NEXT_PASS (pass_early_warn_uninitialized);
NEXT_PASS (pass_all_early_optimizations);
{
struct opt_pass **p = &pass_all_early_optimizations.pass.sub;
- NEXT_PASS (pass_referenced_vars);
- NEXT_PASS (pass_reset_cc_flags);
- NEXT_PASS (pass_build_ssa);
- NEXT_PASS (pass_early_warn_uninitialized);
NEXT_PASS (pass_rebuild_cgraph_edges);
NEXT_PASS (pass_early_inline);
NEXT_PASS (pass_cleanup_cfg);
@@ -574,8 +573,8 @@ init_optimization_passes (void)
NEXT_PASS (pass_tail_recursion);
NEXT_PASS (pass_convert_switch);
NEXT_PASS (pass_profile);
- NEXT_PASS (pass_release_ssa_names);
}
+ NEXT_PASS (pass_release_ssa_names);
NEXT_PASS (pass_rebuild_cgraph_edges);
}
NEXT_PASS (pass_ipa_increase_alignment);
@@ -592,7 +591,6 @@ init_optimization_passes (void)
/* These passes are run after IPA passes on every function that is being
output to the assembler file. */
p = &all_passes;
- NEXT_PASS (pass_O0_always_inline);
NEXT_PASS (pass_all_optimizations);
{
struct opt_pass **p = &pass_all_optimizations.pass.sub;
@@ -601,7 +599,6 @@ init_optimization_passes (void)
NEXT_PASS (pass_build_alias);
NEXT_PASS (pass_return_slot);
NEXT_PASS (pass_rename_ssa_copies);
-
/* Initial scalar cleanups. */
NEXT_PASS (pass_complete_unrolli);
NEXT_PASS (pass_ccp);
@@ -630,17 +627,15 @@ init_optimization_passes (void)
NEXT_PASS (pass_sra);
NEXT_PASS (pass_rename_ssa_copies);
NEXT_PASS (pass_dominator);
-
/* The only const/copy propagation opportunities left after
DOM should be due to degenerate PHI nodes. So rather than
run the full propagators, run a specialized pass which
only examines PHIs to discover const/copy propagation
opportunities. */
NEXT_PASS (pass_phi_only_cprop);
-
+ NEXT_PASS (pass_dse);
NEXT_PASS (pass_reassoc);
NEXT_PASS (pass_dce);
- NEXT_PASS (pass_dse);
NEXT_PASS (pass_forwprop);
NEXT_PASS (pass_phiopt);
NEXT_PASS (pass_object_sizes);
@@ -685,14 +680,12 @@ init_optimization_passes (void)
NEXT_PASS (pass_reassoc);
NEXT_PASS (pass_vrp);
NEXT_PASS (pass_dominator);
-
/* The only const/copy propagation opportunities left after
DOM should be due to degenerate PHI nodes. So rather than
run the full propagators, run a specialized pass which
only examines PHIs to discover const/copy propagation
opportunities. */
NEXT_PASS (pass_phi_only_cprop);
-
NEXT_PASS (pass_cd_dce);
NEXT_PASS (pass_tracer);
@@ -712,14 +705,16 @@ init_optimization_passes (void)
NEXT_PASS (pass_tail_calls);
NEXT_PASS (pass_rename_ssa_copies);
NEXT_PASS (pass_uncprop);
- NEXT_PASS (pass_del_ssa);
- NEXT_PASS (pass_nrv);
- NEXT_PASS (pass_mark_used_blocks);
- NEXT_PASS (pass_cleanup_cfg_post_optimizing);
}
+ NEXT_PASS (pass_del_ssa);
+ NEXT_PASS (pass_nrv);
+ NEXT_PASS (pass_mark_used_blocks);
+ NEXT_PASS (pass_cleanup_cfg_post_optimizing);
+
NEXT_PASS (pass_warn_function_noreturn);
NEXT_PASS (pass_free_datastructures);
NEXT_PASS (pass_mudflap_2);
+
NEXT_PASS (pass_free_cfg_annotations);
NEXT_PASS (pass_expand);
NEXT_PASS (pass_rest_of_compilation);
@@ -959,12 +954,10 @@ execute_function_todo (void *data)
if (flags & TODO_remove_unused_locals)
remove_unused_locals ();
- if ((flags & TODO_dump_func)
- && dump_file && current_function_decl)
+ if ((flags & TODO_dump_func) && dump_file && current_function_decl)
{
if (cfun->curr_properties & PROP_trees)
- dump_function_to_file (current_function_decl,
- dump_file, dump_flags);
+ dump_function_to_file (current_function_decl, dump_file, dump_flags);
else
{
if (dump_flags & TDF_SLIM)
@@ -975,7 +968,7 @@ execute_function_todo (void *data)
else
print_rtl (dump_file, get_insns ());
- if (cfun->curr_properties & PROP_cfg
+ if ((cfun->curr_properties & PROP_cfg)
&& graph_dump_format != no_graph
&& (dump_flags & TDF_GRAPH))
print_rtl_graph_with_bb (dump_file_name, get_insns ());
@@ -1044,8 +1037,7 @@ execute_todo (unsigned int flags)
cgraph_remove_unreachable_nodes (true, dump_file);
}
- if ((flags & TODO_dump_cgraph)
- && dump_file && !current_function_decl)
+ if ((flags & TODO_dump_cgraph) && dump_file && !current_function_decl)
{
gcc_assert (!cfun);
dump_cgraph (dump_file);
@@ -1055,9 +1047,7 @@ execute_todo (unsigned int flags)
}
if (flags & TODO_ggc_collect)
- {
- ggc_collect ();
- }
+ ggc_collect ();
/* Now that the dumping has been done, we can get rid of the optional
df problems. */
@@ -1226,8 +1216,6 @@ execute_one_ipa_transform_pass (struct cgraph_node *node,
pass_fini_dump_file (pass);
current_pass = NULL;
- /* Reset in_gimple_form to not break non-unit-at-a-time mode. */
- in_gimple_form = false;
}
static bool
@@ -1259,6 +1247,7 @@ execute_one_pass (struct opt_pass *pass)
}
current_pass = pass;
+
/* See if we're supposed to run this pass. */
if (pass->gate && !pass->gate ())
return false;
@@ -1327,8 +1316,6 @@ execute_one_pass (struct opt_pass *pass)
|| pass->type != RTL_PASS);
current_pass = NULL;
- /* Reset in_gimple_form to not break non-unit-at-a-time mode. */
- in_gimple_form = false;
return true;
}
diff --git a/gcc/po/ChangeLog b/gcc/po/ChangeLog
index 92ce6b27606..212ae98a6ca 100644
--- a/gcc/po/ChangeLog
+++ b/gcc/po/ChangeLog
@@ -1,3 +1,7 @@
+2008-08-09 Joseph S. Myers <joseph@codesourcery.com>
+
+ * sv.po: Update.
+
2008-05-11 Joseph S. Myers <joseph@codesourcery.com>
* zh_CN.po: Update.
diff --git a/gcc/po/sv.po b/gcc/po/sv.po
index dc7abc802ad..c341898a080 100644
--- a/gcc/po/sv.po
+++ b/gcc/po/sv.po
@@ -11,7 +11,7 @@ msgstr ""
"Project-Id-Version: gcc 4.3.0\n"
"Report-Msgid-Bugs-To: http://gcc.gnu.org/bugs.html\n"
"POT-Creation-Date: 2008-03-05 17:23+0100\n"
-"PO-Revision-Date: 2008-05-06 21:51+0200\n"
+"PO-Revision-Date: 2008-08-07 20:38+0200\n"
"Last-Translator: Göran Uddeborg <goeran@uddeborg.se>\n"
"Language-Team: Swedish <tp-sv@listor.tp-sv.se>\n"
"MIME-Version: 1.0\n"
@@ -27175,7 +27175,7 @@ msgstr "omdefinition av %q#T"
#: cp/class.c:5246
#, gcc-internal-format
msgid "%q#T has virtual functions and accessible non-virtual destructor"
-msgstr "%q#T har virtuella funktioner och åtkomlig icketrivial destruerare"
+msgstr "%q#T har virtuella funktioner och åtkomlig ickevirtuell destruerare"
#: cp/class.c:5348
#, gcc-internal-format
diff --git a/gcc/postreload.c b/gcc/postreload.c
index dcac71ba4d9..5f6fec1e953 100644
--- a/gcc/postreload.c
+++ b/gcc/postreload.c
@@ -518,7 +518,7 @@ reload_cse_simplify_operands (rtx insn, rtx testreg)
for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
{
- int class = (int) NO_REGS;
+ int rclass = (int) NO_REGS;
if (! TEST_HARD_REG_BIT (equiv_regs[i], regno))
continue;
@@ -552,13 +552,13 @@ reload_cse_simplify_operands (rtx insn, rtx testreg)
break;
case 'g': case 'r':
- class = reg_class_subunion[(int) class][(int) GENERAL_REGS];
+ rclass = reg_class_subunion[(int) rclass][(int) GENERAL_REGS];
break;
default:
- class
+ rclass
= (reg_class_subunion
- [(int) class]
+ [(int) rclass]
[(int) REG_CLASS_FROM_CONSTRAINT ((unsigned char) c, p)]);
break;
@@ -568,7 +568,7 @@ reload_cse_simplify_operands (rtx insn, rtx testreg)
alternative yet and the operand being replaced is not
a cheap CONST_INT. */
if (op_alt_regno[i][j] == -1
- && reg_fits_class_p (testreg, class, 0, mode)
+ && reg_fits_class_p (testreg, rclass, 0, mode)
&& (GET_CODE (recog_data.operand[i]) != CONST_INT
|| (rtx_cost (recog_data.operand[i], SET)
> rtx_cost (testreg, SET))))
@@ -577,7 +577,7 @@ reload_cse_simplify_operands (rtx insn, rtx testreg)
op_alt_regno[i][j] = regno;
}
j++;
- class = (int) NO_REGS;
+ rclass = (int) NO_REGS;
break;
}
p += CONSTRAINT_LEN (c, p);
diff --git a/gcc/predict.c b/gcc/predict.c
index f85786e1a1d..e90b95c0683 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -118,6 +118,8 @@ maybe_hot_frequency_p (int freq)
if (cfun->function_frequency == FUNCTION_FREQUENCY_HOT)
return true;
}
+ if (profile_status == PROFILE_ABSENT)
+ return true;
if (freq < BB_FREQ_MAX / PARAM_VALUE (HOT_BB_FREQUENCY_FRACTION))
return false;
return true;
@@ -178,6 +180,86 @@ probably_never_executed_bb_p (const_basic_block bb)
return false;
}
+/* Return true when current function should always be optimized for size. */
+
+static bool
+always_optimize_for_size_p (void)
+{
+ return (optimize_size
+ || cfun->function_frequency == FUNCTION_FREQUENCY_UNLIKELY_EXECUTED);
+}
+
+/* Return TRUE when BB should be optimized for size. */
+
+bool
+optimize_bb_for_size_p (basic_block bb)
+{
+ return always_optimize_for_size_p () || !maybe_hot_bb_p (bb);
+}
+
+/* Return TRUE when BB should be optimized for speed. */
+
+bool
+optimize_bb_for_speed_p (basic_block bb)
+{
+ return !optimize_bb_for_size_p (bb);
+}
+
+/* Return TRUE when BB should be optimized for size. */
+
+bool
+optimize_edge_for_size_p (edge e)
+{
+ return always_optimize_for_size_p () || !maybe_hot_edge_p (e);
+}
+
+/* Return TRUE when BB should be optimized for speed. */
+
+bool
+optimize_edge_for_speed_p (edge e)
+{
+ return !optimize_edge_for_size_p (e);
+}
+
+/* Return TRUE when BB should be optimized for size. */
+
+bool
+optimize_insn_for_size_p (void)
+{
+ return always_optimize_for_size_p () || !crtl->maybe_hot_insn_p;
+}
+
+/* Return TRUE when BB should be optimized for speed. */
+
+bool
+optimize_insn_for_speed_p (void)
+{
+ return !optimize_insn_for_size_p ();
+}
+
+/* Set RTL expansion for BB profile. */
+
+void
+rtl_profile_for_bb (basic_block bb)
+{
+ crtl->maybe_hot_insn_p = maybe_hot_bb_p (bb);
+}
+
+/* Set RTL expansion for edge profile. */
+
+void
+rtl_profile_for_edge (edge e)
+{
+ crtl->maybe_hot_insn_p = maybe_hot_edge_p (e);
+}
+
+/* Set RTL expansion to default mode (i.e. when profile info is not known). */
+void
+default_rtl_profile (void)
+{
+ crtl->maybe_hot_insn_p = true;
+}
+
/* Return true if the one of outgoing edges is already predicted by
PREDICTOR. */
@@ -203,7 +285,7 @@ static struct pointer_map_t *bb_predictions;
PREDICTOR. */
bool
-tree_predicted_by_p (const_basic_block bb, enum br_predictor predictor)
+gimple_predicted_by_p (const_basic_block bb, enum br_predictor predictor)
{
struct edge_prediction *i;
void **preds = pointer_map_contains (bb_predictions, bb);
@@ -305,7 +387,7 @@ rtl_predict_edge (edge e, enum br_predictor predictor, int probability)
/* Predict edge E with the given PROBABILITY. */
void
-tree_predict_edge (edge e, enum br_predictor predictor, int probability)
+gimple_predict_edge (edge e, enum br_predictor predictor, int probability)
{
gcc_assert (profile_status != PROFILE_GUESSED);
if ((e->src != ENTRY_BLOCK_PTR && EDGE_COUNT (e->src->succs) > 1)
@@ -947,36 +1029,38 @@ guess_outgoing_edge_probabilities (basic_block bb)
combine_predictions_for_insn (BB_END (bb), bb);
}
-/* Return constant EXPR will likely have at execution time, NULL if unknown.
- The function is used by builtin_expect branch predictor so the evidence
- must come from this construct and additional possible constant folding.
-
- We may want to implement more involved value guess (such as value range
- propagation based prediction), but such tricks shall go to new
- implementation. */
+static tree expr_expected_value (tree, bitmap);
+
+/* Helper function for expr_expected_value. */
static tree
-expr_expected_value (tree expr, bitmap visited)
+expr_expected_value_1 (tree type, tree op0, enum tree_code code, tree op1, bitmap visited)
{
- if (TREE_CONSTANT (expr))
- return expr;
- else if (TREE_CODE (expr) == SSA_NAME)
+ gimple def;
+
+ if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
{
- tree def = SSA_NAME_DEF_STMT (expr);
+ if (TREE_CONSTANT (op0))
+ return op0;
+
+ if (code != SSA_NAME)
+ return NULL_TREE;
+
+ def = SSA_NAME_DEF_STMT (op0);
/* If we were already here, break the infinite cycle. */
- if (bitmap_bit_p (visited, SSA_NAME_VERSION (expr)))
+ if (bitmap_bit_p (visited, SSA_NAME_VERSION (op0)))
return NULL;
- bitmap_set_bit (visited, SSA_NAME_VERSION (expr));
+ bitmap_set_bit (visited, SSA_NAME_VERSION (op0));
- if (TREE_CODE (def) == PHI_NODE)
+ if (gimple_code (def) == GIMPLE_PHI)
{
/* All the arguments of the PHI node must have the same constant
length. */
- int i;
+ int i, n = gimple_phi_num_args (def);
tree val = NULL, new_val;
- for (i = 0; i < PHI_NUM_ARGS (def); i++)
+ for (i = 0; i < n; i++)
{
tree arg = PHI_ARG_DEF (def, i);
@@ -999,81 +1083,121 @@ expr_expected_value (tree expr, bitmap visited)
}
return val;
}
- if (TREE_CODE (def) != GIMPLE_MODIFY_STMT
- || GIMPLE_STMT_OPERAND (def, 0) != expr)
- return NULL;
- return expr_expected_value (GIMPLE_STMT_OPERAND (def, 1), visited);
- }
- else if (TREE_CODE (expr) == CALL_EXPR)
- {
- tree decl = get_callee_fndecl (expr);
- if (!decl)
- return NULL;
- if (DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL
- && DECL_FUNCTION_CODE (decl) == BUILT_IN_EXPECT)
+ if (is_gimple_assign (def))
{
- tree val;
+ if (gimple_assign_lhs (def) != op0)
+ return NULL;
- if (call_expr_nargs (expr) != 2)
+ return expr_expected_value_1 (TREE_TYPE (gimple_assign_lhs (def)),
+ gimple_assign_rhs1 (def),
+ gimple_assign_rhs_code (def),
+ gimple_assign_rhs2 (def),
+ visited);
+ }
+
+ if (is_gimple_call (def))
+ {
+ tree decl = gimple_call_fndecl (def);
+ if (!decl)
return NULL;
- val = CALL_EXPR_ARG (expr, 0);
- if (TREE_CONSTANT (val))
- return val;
- return CALL_EXPR_ARG (expr, 1);
+ if (DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL
+ && DECL_FUNCTION_CODE (decl) == BUILT_IN_EXPECT)
+ {
+ tree val;
+
+ if (gimple_call_num_args (def) != 2)
+ return NULL;
+ val = gimple_call_arg (def, 0);
+ if (TREE_CONSTANT (val))
+ return val;
+ return gimple_call_arg (def, 1);
+ }
}
+
+ return NULL;
}
- if (BINARY_CLASS_P (expr) || COMPARISON_CLASS_P (expr))
+
+ if (get_gimple_rhs_class (code) == GIMPLE_BINARY_RHS)
{
- tree op0, op1, res;
- op0 = expr_expected_value (TREE_OPERAND (expr, 0), visited);
+ tree res;
+ op0 = expr_expected_value (op0, visited);
if (!op0)
return NULL;
- op1 = expr_expected_value (TREE_OPERAND (expr, 1), visited);
+ op1 = expr_expected_value (op1, visited);
if (!op1)
return NULL;
- res = fold_build2 (TREE_CODE (expr), TREE_TYPE (expr), op0, op1);
+ res = fold_build2 (code, type, op0, op1);
if (TREE_CONSTANT (res))
return res;
return NULL;
}
- if (UNARY_CLASS_P (expr))
+ if (get_gimple_rhs_class (code) == GIMPLE_UNARY_RHS)
{
- tree op0, res;
- op0 = expr_expected_value (TREE_OPERAND (expr, 0), visited);
+ tree res;
+ op0 = expr_expected_value (op0, visited);
if (!op0)
return NULL;
- res = fold_build1 (TREE_CODE (expr), TREE_TYPE (expr), op0);
+ res = fold_build1 (code, type, op0);
if (TREE_CONSTANT (res))
return res;
return NULL;
}
return NULL;
}
+
+/* Return constant EXPR will likely have at execution time, NULL if unknown.
+ The function is used by builtin_expect branch predictor so the evidence
+ must come from this construct and additional possible constant folding.
+
+ We may want to implement more involved value guess (such as value range
+ propagation based prediction), but such tricks shall go to new
+ implementation. */
+
+static tree
+expr_expected_value (tree expr, bitmap visited)
+{
+ enum tree_code code;
+ tree op0, op1;
+
+ if (TREE_CONSTANT (expr))
+ return expr;
+
+ extract_ops_from_tree (expr, &code, &op0, &op1);
+ return expr_expected_value_1 (TREE_TYPE (expr),
+ op0, code, op1, visited);
+}
+
/* Get rid of all builtin_expect calls we no longer need. */
static void
strip_builtin_expect (void)
{
basic_block bb;
+ gimple ass_stmt;
+ tree var;
+
FOR_EACH_BB (bb)
{
- block_stmt_iterator bi;
- for (bi = bsi_start (bb); !bsi_end_p (bi); bsi_next (&bi))
+ gimple_stmt_iterator bi;
+ for (bi = gsi_start_bb (bb); !gsi_end_p (bi); gsi_next (&bi))
{
- tree stmt = bsi_stmt (bi);
+ gimple stmt = gsi_stmt (bi);
tree fndecl;
- tree call;
- if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
- && (call = GIMPLE_STMT_OPERAND (stmt, 1))
- && TREE_CODE (call) == CALL_EXPR
- && (fndecl = get_callee_fndecl (call))
+ if (gimple_code (stmt) != GIMPLE_CALL)
+ continue;
+
+ fndecl = gimple_call_fndecl (stmt);
+
+ if (fndecl
&& DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL
&& DECL_FUNCTION_CODE (fndecl) == BUILT_IN_EXPECT
- && call_expr_nargs (call) == 2)
+ && gimple_call_num_args (stmt) == 2)
{
- GIMPLE_STMT_OPERAND (stmt, 1) = CALL_EXPR_ARG (call, 0);
- update_stmt (stmt);
+ var = gimple_call_lhs (stmt);
+ ass_stmt = gimple_build_assign (var, gimple_call_arg (stmt, 0));
+
+ gsi_replace (&bi, ass_stmt, true);
}
}
}
@@ -1083,27 +1207,26 @@ strip_builtin_expect (void)
static void
tree_predict_by_opcode (basic_block bb)
{
- tree stmt = last_stmt (bb);
+ gimple stmt = last_stmt (bb);
edge then_edge;
- tree cond;
- tree op0;
+ tree op0, op1;
tree type;
tree val;
+ enum tree_code cmp;
bitmap visited;
edge_iterator ei;
- if (!stmt || TREE_CODE (stmt) != COND_EXPR)
+ if (!stmt || gimple_code (stmt) != GIMPLE_COND)
return;
FOR_EACH_EDGE (then_edge, ei, bb->succs)
if (then_edge->flags & EDGE_TRUE_VALUE)
break;
- cond = TREE_OPERAND (stmt, 0);
- if (!COMPARISON_CLASS_P (cond))
- return;
- op0 = TREE_OPERAND (cond, 0);
+ op0 = gimple_cond_lhs (stmt);
+ op1 = gimple_cond_rhs (stmt);
+ cmp = gimple_cond_code (stmt);
type = TREE_TYPE (op0);
visited = BITMAP_ALLOC (NULL);
- val = expr_expected_value (cond, visited);
+ val = expr_expected_value_1 (boolean_type_node, op0, cmp, op1, visited);
BITMAP_FREE (visited);
if (val)
{
@@ -1118,9 +1241,9 @@ tree_predict_by_opcode (basic_block bb)
Similarly, a comparison ptr1 == ptr2 is predicted as false. */
if (POINTER_TYPE_P (type))
{
- if (TREE_CODE (cond) == EQ_EXPR)
+ if (cmp == EQ_EXPR)
predict_edge_def (then_edge, PRED_TREE_POINTER, NOT_TAKEN);
- else if (TREE_CODE (cond) == NE_EXPR)
+ else if (cmp == NE_EXPR)
predict_edge_def (then_edge, PRED_TREE_POINTER, TAKEN);
}
else
@@ -1129,7 +1252,7 @@ tree_predict_by_opcode (basic_block bb)
EQ tests are usually false and NE tests are usually true. Also,
most quantities are positive, so we can make the appropriate guesses
about signed comparisons against zero. */
- switch (TREE_CODE (cond))
+ switch (cmp)
{
case EQ_EXPR:
case UNEQ_EXPR:
@@ -1140,8 +1263,7 @@ tree_predict_by_opcode (basic_block bb)
;
/* Comparisons with 0 are often used for booleans and there is
nothing useful to predict about them. */
- else if (integer_zerop (op0)
- || integer_zerop (TREE_OPERAND (cond, 1)))
+ else if (integer_zerop (op0) || integer_zerop (op1))
;
else
predict_edge_def (then_edge, PRED_TREE_OPCODE_NONEQUAL, NOT_TAKEN);
@@ -1157,7 +1279,7 @@ tree_predict_by_opcode (basic_block bb)
/* Comparisons with 0 are often used for booleans and there is
nothing useful to predict about them. */
else if (integer_zerop (op0)
- || integer_zerop (TREE_OPERAND (cond, 1)))
+ || integer_zerop (op1))
;
else
predict_edge_def (then_edge, PRED_TREE_OPCODE_NONEQUAL, TAKEN);
@@ -1173,23 +1295,23 @@ tree_predict_by_opcode (basic_block bb)
case LE_EXPR:
case LT_EXPR:
- if (integer_zerop (TREE_OPERAND (cond, 1))
- || integer_onep (TREE_OPERAND (cond, 1))
- || integer_all_onesp (TREE_OPERAND (cond, 1))
- || real_zerop (TREE_OPERAND (cond, 1))
- || real_onep (TREE_OPERAND (cond, 1))
- || real_minus_onep (TREE_OPERAND (cond, 1)))
+ if (integer_zerop (op1)
+ || integer_onep (op1)
+ || integer_all_onesp (op1)
+ || real_zerop (op1)
+ || real_onep (op1)
+ || real_minus_onep (op1))
predict_edge_def (then_edge, PRED_TREE_OPCODE_POSITIVE, NOT_TAKEN);
break;
case GE_EXPR:
case GT_EXPR:
- if (integer_zerop (TREE_OPERAND (cond, 1))
- || integer_onep (TREE_OPERAND (cond, 1))
- || integer_all_onesp (TREE_OPERAND (cond, 1))
- || real_zerop (TREE_OPERAND (cond, 1))
- || real_onep (TREE_OPERAND (cond, 1))
- || real_minus_onep (TREE_OPERAND (cond, 1)))
+ if (integer_zerop (op1)
+ || integer_onep (op1)
+ || integer_all_onesp (op1)
+ || real_zerop (op1)
+ || real_onep (op1)
+ || real_minus_onep (op1))
predict_edge_def (then_edge, PRED_TREE_OPCODE_POSITIVE, TAKEN);
break;
@@ -1199,6 +1321,7 @@ tree_predict_by_opcode (basic_block bb)
}
/* Try to guess whether the value of return means error code. */
+
static enum br_predictor
return_prediction (tree val, enum prediction *prediction)
{
@@ -1243,10 +1366,10 @@ return_prediction (tree val, enum prediction *prediction)
static void
apply_return_prediction (void)
{
- tree return_stmt = NULL;
+ gimple return_stmt = NULL;
tree return_val;
edge e;
- tree phi;
+ gimple phi;
int phi_num_args, i;
enum br_predictor pred;
enum prediction direction;
@@ -1256,26 +1379,20 @@ apply_return_prediction (void)
{
return_stmt = last_stmt (e->src);
if (return_stmt
- && TREE_CODE (return_stmt) == RETURN_EXPR)
+ && gimple_code (return_stmt) == GIMPLE_RETURN)
break;
}
if (!e)
return;
- return_val = TREE_OPERAND (return_stmt, 0);
+ return_val = gimple_return_retval (return_stmt);
if (!return_val)
return;
- if (TREE_CODE (return_val) == GIMPLE_MODIFY_STMT)
- return_val = GIMPLE_STMT_OPERAND (return_val, 1);
if (TREE_CODE (return_val) != SSA_NAME
|| !SSA_NAME_DEF_STMT (return_val)
- || TREE_CODE (SSA_NAME_DEF_STMT (return_val)) != PHI_NODE)
- return;
- for (phi = SSA_NAME_DEF_STMT (return_val); phi; phi = PHI_CHAIN (phi))
- if (PHI_RESULT (phi) == return_val)
- break;
- if (!phi)
+ || gimple_code (SSA_NAME_DEF_STMT (return_val)) != GIMPLE_PHI)
return;
- phi_num_args = PHI_NUM_ARGS (phi);
+ phi = SSA_NAME_DEF_STMT (return_val);
+ phi_num_args = gimple_phi_num_args (phi);
pred = return_prediction (PHI_ARG_DEF (phi, 0), &direction);
/* Avoid the degenerate case where all return values form the function
@@ -1289,7 +1406,7 @@ apply_return_prediction (void)
{
pred = return_prediction (PHI_ARG_DEF (phi, i), &direction);
if (pred != PRED_NO_PREDICTION)
- predict_paths_leading_to (PHI_ARG_EDGE (phi, i)->src, pred,
+ predict_paths_leading_to (gimple_phi_arg_edge (phi, i)->src, pred,
direction);
}
}
@@ -1307,46 +1424,34 @@ tree_bb_level_predictions (void)
FOR_EACH_BB (bb)
{
- block_stmt_iterator bsi = bsi_last (bb);
+ gimple_stmt_iterator gsi;
- for (bsi = bsi_start (bb); !bsi_end_p (bsi);)
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi);)
{
- tree stmt = bsi_stmt (bsi);
+ gimple stmt = gsi_stmt (gsi);
tree decl;
- bool next = false;
- switch (TREE_CODE (stmt))
+ if (is_gimple_call (stmt))
{
- case GIMPLE_MODIFY_STMT:
- if (TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 1)) == CALL_EXPR)
- {
- stmt = GIMPLE_STMT_OPERAND (stmt, 1);
- goto call_expr;
- }
- break;
- case CALL_EXPR:
-call_expr:;
- if (call_expr_flags (stmt) & ECF_NORETURN)
- predict_paths_leading_to (bb, PRED_NORETURN,
- NOT_TAKEN);
- decl = get_callee_fndecl (stmt);
- if (decl
- && lookup_attribute ("cold",
- DECL_ATTRIBUTES (decl)))
- predict_paths_leading_to (bb, PRED_COLD_FUNCTION,
- NOT_TAKEN);
- break;
- case PREDICT_EXPR:
- predict_paths_leading_to (bb, PREDICT_EXPR_PREDICTOR (stmt),
- PREDICT_EXPR_OUTCOME (stmt));
- bsi_remove (&bsi, true);
- next = true;
- break;
- default:
- break;
+ if (gimple_call_flags (stmt) & ECF_NORETURN)
+ predict_paths_leading_to (bb, PRED_NORETURN,
+ NOT_TAKEN);
+ decl = gimple_call_fndecl (stmt);
+ if (decl
+ && lookup_attribute ("cold",
+ DECL_ATTRIBUTES (decl)))
+ predict_paths_leading_to (bb, PRED_COLD_FUNCTION,
+ NOT_TAKEN);
}
- if (!next)
- bsi_next (&bsi);
+ else if (gimple_code (stmt) == GIMPLE_PREDICT)
+ {
+ predict_paths_leading_to (bb, gimple_predict_predictor (stmt),
+ gimple_predict_outcome (stmt));
+ gsi_remove (&gsi, true);
+ continue;
+ }
+
+ gsi_next (&gsi);
}
}
}
@@ -1416,7 +1521,7 @@ tree_estimate_probability (void)
&& e->dest != EXIT_BLOCK_PTR
&& single_succ_p (e->dest)
&& single_succ_edge (e->dest)->dest == EXIT_BLOCK_PTR
- && TREE_CODE (last_stmt (e->dest)) == RETURN_EXPR)
+ && gimple_code (last_stmt (e->dest)) == GIMPLE_RETURN)
{
edge e1;
edge_iterator ei1;
@@ -1442,23 +1547,20 @@ tree_estimate_probability (void)
&& dominated_by_p (CDI_DOMINATORS, e->dest, e->src)
&& !dominated_by_p (CDI_POST_DOMINATORS, e->src, e->dest))
{
- block_stmt_iterator bi;
+ gimple_stmt_iterator bi;
/* The call heuristic claims that a guarded function call
is improbable. This is because such calls are often used
to signal exceptional situations such as printing error
messages. */
- for (bi = bsi_start (e->dest); !bsi_end_p (bi);
- bsi_next (&bi))
+ for (bi = gsi_start_bb (e->dest); !gsi_end_p (bi);
+ gsi_next (&bi))
{
- tree stmt = bsi_stmt (bi);
- if ((TREE_CODE (stmt) == CALL_EXPR
- || (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
- && TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 1))
- == CALL_EXPR))
+ gimple stmt = gsi_stmt (bi);
+ if (is_gimple_call (stmt)
/* Constant and pure calls are hardly used to signalize
something exceptional. */
- && TREE_SIDE_EFFECTS (stmt))
+ && gimple_has_side_effects (stmt))
{
predict_edge_def (e, PRED_CALL, NOT_TAKEN);
break;
@@ -1483,7 +1585,7 @@ tree_estimate_probability (void)
remove_fake_exit_edges ();
loop_optimizer_finalize ();
if (dump_file && (dump_flags & TDF_DETAILS))
- dump_tree_cfg (dump_file, dump_flags);
+ gimple_dump_cfg (dump_file, dump_flags);
if (profile_status == PROFILE_ABSENT)
profile_status = PROFILE_GUESSED;
return 0;
diff --git a/gcc/print-tree.c b/gcc/print-tree.c
index 3b34f89d41c..16ba3929fab 100644
--- a/gcc/print-tree.c
+++ b/gcc/print-tree.c
@@ -29,6 +29,7 @@ along with GCC; see the file COPYING3. If not see
#include "ggc.h"
#include "langhooks.h"
#include "tree-iterator.h"
+#include "diagnostic.h"
#include "tree-flow.h"
/* Define the hash table of nodes already seen.
@@ -73,12 +74,12 @@ dump_addr (FILE *file, const char *prefix, const void *addr)
void
print_node_brief (FILE *file, const char *prefix, const_tree node, int indent)
{
- enum tree_code_class class;
+ enum tree_code_class tclass;
if (node == 0)
return;
- class = TREE_CODE_CLASS (TREE_CODE (node));
+ tclass = TREE_CODE_CLASS (TREE_CODE (node));
/* Always print the slot this node is in, and its code, address and
name if any. */
@@ -87,7 +88,7 @@ print_node_brief (FILE *file, const char *prefix, const_tree node, int indent)
fprintf (file, "%s <%s", prefix, tree_code_name[(int) TREE_CODE (node)]);
dump_addr (file, " ", node);
- if (class == tcc_declaration)
+ if (tclass == tcc_declaration)
{
if (DECL_NAME (node))
fprintf (file, " %s", IDENTIFIER_POINTER (DECL_NAME (node)));
@@ -98,7 +99,7 @@ print_node_brief (FILE *file, const char *prefix, const_tree node, int indent)
fprintf (file, " %c.%u", TREE_CODE (node) == CONST_DECL ? 'C' : 'D',
DECL_UID (node));
}
- else if (class == tcc_type)
+ else if (tclass == tcc_type)
{
if (TYPE_NAME (node))
{
@@ -187,7 +188,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
int hash;
struct bucket *b;
enum machine_mode mode;
- enum tree_code_class class;
+ enum tree_code_class tclass;
int len;
int i;
expanded_location xloc;
@@ -197,7 +198,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
return;
code = TREE_CODE (node);
- class = TREE_CODE_CLASS (code);
+ tclass = TREE_CODE_CLASS (code);
/* Don't get too deep in nesting. If the user wants to see deeper,
it is easy to use the address of a lowest-level node
@@ -209,7 +210,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
return;
}
- if (indent > 8 && (class == tcc_type || class == tcc_declaration))
+ if (indent > 8 && (tclass == tcc_type || tclass == tcc_declaration))
{
print_node_brief (file, prefix, node, indent);
return;
@@ -250,7 +251,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
dump_addr (file, " ", node);
/* Print the name, if any. */
- if (class == tcc_declaration)
+ if (tclass == tcc_declaration)
{
if (DECL_NAME (node))
fprintf (file, " %s", IDENTIFIER_POINTER (DECL_NAME (node)));
@@ -261,7 +262,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
fprintf (file, " %c.%u", TREE_CODE (node) == CONST_DECL ? 'C' : 'D',
DECL_UID (node));
}
- else if (class == tcc_type)
+ else if (tclass == tcc_type)
{
if (TYPE_NAME (node))
{
@@ -281,7 +282,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
if (indent <= 4)
print_node_brief (file, "type", TREE_TYPE (node), indent + 4);
}
- else if (!GIMPLE_TUPLE_P (node))
+ else
{
print_node (file, "type", TREE_TYPE (node), indent + 4);
if (TREE_TYPE (node))
@@ -369,8 +370,14 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
if (TREE_CODE (node) == TYPE_DECL && TYPE_DECL_SUPPRESS_DEBUG (node))
fputs (" suppress-debug", file);
- if (TREE_CODE (node) == FUNCTION_DECL && DECL_INLINE (node))
- fputs (DECL_DECLARED_INLINE_P (node) ? " inline" : " autoinline", file);
+ if (TREE_CODE (node) == FUNCTION_DECL
+ && DECL_FUNCTION_SPECIFIC_TARGET (node))
+ fputs (" function-specific-target", file);
+ if (TREE_CODE (node) == FUNCTION_DECL
+ && DECL_FUNCTION_SPECIFIC_OPTIMIZATION (node))
+ fputs (" function-specific-opt", file);
+ if (TREE_CODE (node) == FUNCTION_DECL && DECL_DECLARED_INLINE_P (node))
+ fputs (" autoinline", file);
if (TREE_CODE (node) == FUNCTION_DECL && DECL_BUILT_IN (node))
fputs (" built-in", file);
if (TREE_CODE (node) == FUNCTION_DECL && DECL_NO_STATIC_CHAIN (node))
@@ -454,8 +461,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
print_node (file, "size", DECL_SIZE (node), indent + 4);
print_node (file, "unit size", DECL_SIZE_UNIT (node), indent + 4);
- if (TREE_CODE (node) != FUNCTION_DECL
- || DECL_INLINE (node) || DECL_BUILT_IN (node))
+ if (TREE_CODE (node) != FUNCTION_DECL || DECL_BUILT_IN (node))
indent_to (file, indent + 3);
if (DECL_USER_ALIGN (node))
@@ -706,18 +712,6 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
print_node (file, "chain", TREE_CHAIN (node), indent + 4);
break;
- case tcc_gimple_stmt:
- len = TREE_CODE_LENGTH (TREE_CODE (node));
-
- for (i = 0; i < len; i++)
- {
- char temp[10];
-
- sprintf (temp, "arg %d", i);
- print_node (file, temp, GIMPLE_STMT_OPERAND (node, i), indent + 4);
- }
- break;
-
case tcc_constant:
case tcc_exceptional:
switch (TREE_CODE (node))
@@ -890,8 +884,8 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
case SSA_NAME:
print_node_brief (file, "var", SSA_NAME_VAR (node), indent + 4);
- print_node_brief (file, "def_stmt",
- SSA_NAME_DEF_STMT (node), indent + 4);
+ fprintf (file, "def_stmt ");
+ print_gimple_stmt (file, SSA_NAME_DEF_STMT (node), indent + 4, 0);
indent_to (file, indent + 4);
fprintf (file, "version %u", SSA_NAME_VERSION (node));
@@ -911,12 +905,6 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
}
break;
- case PHI_NODE:
- print_node (file, "result", PHI_RESULT (node), indent + 4);
- for (i = 0; i < PHI_NUM_ARGS (node); i++)
- print_node (file, "arg", PHI_ARG_DEF (node, i), indent + 4);
- break;
-
case OMP_CLAUSE:
{
int i;
@@ -931,6 +919,14 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
}
break;
+ case OPTIMIZATION_NODE:
+ cl_optimization_print (file, indent + 4, TREE_OPTIMIZATION (node));
+ break;
+
+ case TARGET_OPTION_NODE:
+ cl_target_option_print (file, indent + 4, TREE_TARGET_OPTION (node));
+ break;
+
default:
if (EXCEPTIONAL_CLASS_P (node))
lang_hooks.print_xnode (file, node, indent);
diff --git a/gcc/profile.c b/gcc/profile.c
index 78568228e1f..7489579ca27 100644
--- a/gcc/profile.c
+++ b/gcc/profile.c
@@ -95,6 +95,7 @@ struct bb_info {
#define EDGE_INFO(e) ((struct edge_info *) (e)->aux)
#define BB_INFO(b) ((struct bb_info *) (b)->aux)
+
/* Counter summary from the last set of coverage counts read. */
const struct gcov_ctr_summary *profile_info;
@@ -671,7 +672,7 @@ compute_value_histograms (histogram_values values)
for (i = 0; i < VEC_length (histogram_value, values); i++)
{
histogram_value hist = VEC_index (histogram_value, values, i);
- tree stmt = hist->hvalue.stmt;
+ gimple stmt = hist->hvalue.stmt;
t = (int) hist->type;
@@ -793,16 +794,16 @@ branch_prob (void)
FOR_EACH_EDGE (e, ei, bb->succs)
{
- block_stmt_iterator bsi;
- tree last = NULL;
+ gimple_stmt_iterator gsi;
+ gimple last = NULL;
/* It may happen that there are compiler generated statements
without a locus at all. Go through the basic block from the
last to the first statement looking for a locus. */
- for (bsi = bsi_last (bb); !bsi_end_p (bsi); bsi_prev (&bsi))
+ for (gsi = gsi_last_bb (bb); !gsi_end_p (gsi); gsi_prev (&gsi))
{
- last = bsi_stmt (bsi);
- if (EXPR_LOCUS (last))
+ last = gsi_stmt (gsi);
+ if (gimple_has_location (last))
break;
}
@@ -811,16 +812,17 @@ branch_prob (void)
Don't do that when the locuses match, so
if (blah) goto something;
is not computed twice. */
- if (last && EXPR_LOCUS (last)
- && e->goto_locus
+ if (last
+ && gimple_has_location (last)
+ && e->goto_locus != UNKNOWN_LOCATION
&& !single_succ_p (bb)
&& (LOCATION_FILE (e->goto_locus)
- != LOCATION_FILE (EXPR_LOCATION (last))
+ != LOCATION_FILE (gimple_location (last))
|| (LOCATION_LINE (e->goto_locus)
- != LOCATION_LINE (EXPR_LOCATION (last)))))
+ != LOCATION_LINE (gimple_location (last)))))
{
- basic_block new = split_edge (e);
- single_succ_edge (new)->goto_locus = e->goto_locus;
+ basic_block new_bb = split_edge (e);
+ single_succ_edge (new_bb)->goto_locus = e->goto_locus;
}
if ((e->flags & (EDGE_ABNORMAL | EDGE_ABNORMAL_CALL))
&& e->dest != EXIT_BLOCK_PTR)
@@ -982,7 +984,7 @@ branch_prob (void)
FOR_EACH_BB (bb)
{
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
offset = 0;
@@ -994,26 +996,18 @@ branch_prob (void)
&offset, bb);
}
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- tree stmt = bsi_stmt (bsi);
- if (EXPR_HAS_LOCATION (stmt))
- output_location (EXPR_FILENAME (stmt), EXPR_LINENO (stmt),
- &offset, bb);
- /* Take into account modify statements nested in return
- produced by C++ NRV transformation. */
- if (TREE_CODE (stmt) == RETURN_EXPR
- && TREE_OPERAND (stmt, 0)
- && TREE_CODE (TREE_OPERAND (stmt, 0)) == MODIFY_EXPR
- && EXPR_HAS_LOCATION (TREE_OPERAND (stmt, 0)))
- output_location (EXPR_FILENAME (TREE_OPERAND (stmt, 0)),
- EXPR_LINENO (TREE_OPERAND (stmt, 0)),
+ gimple stmt = gsi_stmt (gsi);
+ if (gimple_has_location (stmt))
+ output_location (gimple_filename (stmt), gimple_lineno (stmt),
&offset, bb);
}
/* Notice GOTO expressions we eliminated while constructing the
CFG. */
- if (single_succ_p (bb) && single_succ_edge (bb)->goto_locus)
+ if (single_succ_p (bb)
+ && single_succ_edge (bb)->goto_locus != UNKNOWN_LOCATION)
{
location_t curr_location = single_succ_edge (bb)->goto_locus;
/* ??? The FILE/LINE API is inconsistent for these cases. */
@@ -1063,7 +1057,7 @@ branch_prob (void)
instrument_values (values);
/* Commit changes done by instrumentation. */
- bsi_commit_edge_inserts ();
+ gsi_commit_edge_inserts ();
}
free_aux_for_edges ();
@@ -1251,4 +1245,3 @@ tree_register_profile_hooks (void)
gcc_assert (current_ir_type () == IR_GIMPLE);
profile_hooks = &tree_profile_hooks;
}
-
diff --git a/gcc/ra.h b/gcc/ra.h
index bd419522394..4fe80c8555b 100644
--- a/gcc/ra.h
+++ b/gcc/ra.h
@@ -144,10 +144,10 @@ add_neighbor (int alloc_no, int neighbor)
if (adjlist == NULL || adjlist->index == ADJACENCY_VEC_LENGTH)
{
- adjacency_t *new = (adjacency_t *) pool_alloc (adjacency_pool);
- new->index = 0;
- new->next = adjlist;
- adjlist = new;
+ adjacency_t *new_adj = (adjacency_t *) pool_alloc (adjacency_pool);
+ new_adj->index = 0;
+ new_adj->next = adjlist;
+ adjlist = new_adj;
adjacency[alloc_no] = adjlist;
}
diff --git a/gcc/real.c b/gcc/real.c
index b0717569683..da311c8f67f 100644
--- a/gcc/real.c
+++ b/gcc/real.c
@@ -1443,20 +1443,30 @@ rtd_divmod (REAL_VALUE_TYPE *num, REAL_VALUE_TYPE *den)
/* Render R as a decimal floating point constant. Emit DIGITS significant
digits in the result, bounded by BUF_SIZE. If DIGITS is 0, choose the
maximum for the representation. If CROP_TRAILING_ZEROS, strip trailing
- zeros. */
+ zeros. If MODE is VOIDmode, round to nearest value. Otherwise, round
+ to a string that, when parsed back in mode MODE, yields the same value. */
#define M_LOG10_2 0.30102999566398119521
void
-real_to_decimal (char *str, const REAL_VALUE_TYPE *r_orig, size_t buf_size,
- size_t digits, int crop_trailing_zeros)
+real_to_decimal_for_mode (char *str, const REAL_VALUE_TYPE *r_orig,
+ size_t buf_size, size_t digits,
+ int crop_trailing_zeros, enum machine_mode mode)
{
+ const struct real_format *fmt = NULL;
const REAL_VALUE_TYPE *one, *ten;
REAL_VALUE_TYPE r, pten, u, v;
int dec_exp, cmp_one, digit;
size_t max_digits;
char *p, *first, *last;
bool sign;
+ bool round_up;
+
+ if (mode != VOIDmode)
+ {
+ fmt = REAL_MODE_FORMAT (mode);
+ gcc_assert (fmt);
+ }
r = *r_orig;
switch (r.cl)
@@ -1672,17 +1682,31 @@ real_to_decimal (char *str, const REAL_VALUE_TYPE *r_orig, size_t buf_size,
digit = rtd_divmod (&r, &pten);
/* Round the result. */
- if (digit == 5)
+ if (fmt && fmt->round_towards_zero)
{
- /* Round to nearest. If R is nonzero there are additional
- nonzero digits to be extracted. */
+ /* If the format uses round towards zero when parsing the string
+ back in, we need to always round away from zero here. */
if (cmp_significand_0 (&r))
digit++;
- /* Round to even. */
- else if ((p[-1] - '0') & 1)
- digit++;
+ round_up = digit > 0;
}
- if (digit > 5)
+ else
+ {
+ if (digit == 5)
+ {
+ /* Round to nearest. If R is nonzero there are additional
+ nonzero digits to be extracted. */
+ if (cmp_significand_0 (&r))
+ digit++;
+ /* Round to even. */
+ else if ((p[-1] - '0') & 1)
+ digit++;
+ }
+
+ round_up = digit > 5;
+ }
+
+ if (round_up)
{
while (p > first)
{
@@ -1716,6 +1740,26 @@ real_to_decimal (char *str, const REAL_VALUE_TYPE *r_orig, size_t buf_size,
/* Append the exponent. */
sprintf (last, "e%+d", dec_exp);
+
+#ifdef ENABLE_CHECKING
+ /* Verify that we can read the original value back in. */
+ if (mode != VOIDmode)
+ {
+ real_from_string (&r, str);
+ real_convert (&r, mode, &r);
+ gcc_assert (real_identical (&r, r_orig));
+ }
+#endif
+}
+
+/* Likewise, except always uses round-to-nearest. */
+
+void
+real_to_decimal (char *str, const REAL_VALUE_TYPE *r_orig, size_t buf_size,
+ size_t digits, int crop_trailing_zeros)
+{
+ real_to_decimal_for_mode (str, r_orig, buf_size,
+ digits, crop_trailing_zeros, VOIDmode);
}
/* Render R as a hexadecimal floating point constant. Emit DIGITS
@@ -2389,9 +2433,8 @@ static void
round_for_format (const struct real_format *fmt, REAL_VALUE_TYPE *r)
{
int p2, np2, i, w;
- unsigned long sticky;
- bool guard, lsb;
int emin2m1, emax2;
+ bool round_up = false;
if (r->decimal)
{
@@ -2463,21 +2506,28 @@ round_for_format (const struct real_format *fmt, REAL_VALUE_TYPE *r)
}
}
- /* There are P2 true significand bits, followed by one guard bit,
- followed by one sticky bit, followed by stuff. Fold nonzero
- stuff into the sticky bit. */
+ if (!fmt->round_towards_zero)
+ {
+ /* There are P2 true significand bits, followed by one guard bit,
+ followed by one sticky bit, followed by stuff. Fold nonzero
+ stuff into the sticky bit. */
+ unsigned long sticky;
+ bool guard, lsb;
+
+ sticky = 0;
+ for (i = 0, w = (np2 - 1) / HOST_BITS_PER_LONG; i < w; ++i)
+ sticky |= r->sig[i];
+ sticky |= r->sig[w]
+ & (((unsigned long)1 << ((np2 - 1) % HOST_BITS_PER_LONG)) - 1);
- sticky = 0;
- for (i = 0, w = (np2 - 1) / HOST_BITS_PER_LONG; i < w; ++i)
- sticky |= r->sig[i];
- sticky |=
- r->sig[w] & (((unsigned long)1 << ((np2 - 1) % HOST_BITS_PER_LONG)) - 1);
+ guard = test_significand_bit (r, np2 - 1);
+ lsb = test_significand_bit (r, np2);
- guard = test_significand_bit (r, np2 - 1);
- lsb = test_significand_bit (r, np2);
+ /* Round to even. */
+ round_up = guard && (sticky || lsb);
+ }
- /* Round to even. */
- if (guard && (sticky || lsb))
+ if (round_up)
{
REAL_VALUE_TYPE u;
get_zero (&u, 0);
@@ -2817,6 +2867,8 @@ const struct real_format ieee_single_format =
128,
31,
31,
+ false,
+ true,
true,
true,
true,
@@ -2836,6 +2888,8 @@ const struct real_format mips_single_format =
128,
31,
31,
+ false,
+ true,
true,
true,
true,
@@ -2855,6 +2909,8 @@ const struct real_format motorola_single_format =
128,
31,
31,
+ false,
+ true,
true,
true,
true,
@@ -2862,6 +2918,38 @@ const struct real_format motorola_single_format =
true,
true
};
+
+/* SPU Single Precision (Extended-Range Mode) format is the same as IEEE
+ single precision with the following differences:
+ - Infinities are not supported. Instead MAX_FLOAT or MIN_FLOAT
+ are generated.
+ - NaNs are not supported.
+ - The range of non-zero numbers in binary is
+ (001)[1.]000...000 to (255)[1.]111...111.
+ - Denormals can be represented, but are treated as +0.0 when
+ used as an operand and are never generated as a result.
+ - -0.0 can be represented, but a zero result is always +0.0.
+ - the only supported rounding mode is trunction (towards zero). */
+const struct real_format spu_single_format =
+ {
+ encode_ieee_single,
+ decode_ieee_single,
+ 2,
+ 24,
+ 24,
+ -125,
+ 129,
+ 31,
+ 31,
+ true,
+ false,
+ false,
+ false,
+ true,
+ true,
+ false,
+ false
+ };
/* IEEE double-precision format. */
@@ -3062,6 +3150,8 @@ const struct real_format ieee_double_format =
1024,
63,
63,
+ false,
+ true,
true,
true,
true,
@@ -3081,6 +3171,8 @@ const struct real_format mips_double_format =
1024,
63,
63,
+ false,
+ true,
true,
true,
true,
@@ -3100,6 +3192,8 @@ const struct real_format motorola_double_format =
1024,
63,
63,
+ false,
+ true,
true,
true,
true,
@@ -3437,6 +3531,8 @@ const struct real_format ieee_extended_motorola_format =
16384,
95,
95,
+ false,
+ true,
true,
true,
true,
@@ -3456,6 +3552,8 @@ const struct real_format ieee_extended_intel_96_format =
16384,
79,
79,
+ false,
+ true,
true,
true,
true,
@@ -3475,6 +3573,8 @@ const struct real_format ieee_extended_intel_128_format =
16384,
79,
79,
+ false,
+ true,
true,
true,
true,
@@ -3496,6 +3596,8 @@ const struct real_format ieee_extended_intel_96_round_53_format =
16384,
79,
79,
+ false,
+ true,
true,
true,
true,
@@ -3582,6 +3684,8 @@ const struct real_format ibm_extended_format =
1024,
127,
-1,
+ false,
+ true,
true,
true,
true,
@@ -3601,6 +3705,8 @@ const struct real_format mips_extended_format =
1024,
127,
-1,
+ false,
+ true,
true,
true,
true,
@@ -3862,6 +3968,8 @@ const struct real_format ieee_quad_format =
16384,
127,
127,
+ false,
+ true,
true,
true,
true,
@@ -3881,6 +3989,8 @@ const struct real_format mips_quad_format =
16384,
127,
127,
+ false,
+ true,
true,
true,
true,
@@ -4184,6 +4294,8 @@ const struct real_format vax_f_format =
false,
false,
false,
+ false,
+ false,
false
};
@@ -4203,6 +4315,8 @@ const struct real_format vax_d_format =
false,
false,
false,
+ false,
+ false,
false
};
@@ -4222,6 +4336,8 @@ const struct real_format vax_g_format =
false,
false,
false,
+ false,
+ false,
false
};
@@ -4291,6 +4407,8 @@ const struct real_format decimal_single_format =
96,
31,
31,
+ false,
+ true,
true,
true,
true,
@@ -4311,6 +4429,8 @@ const struct real_format decimal_double_format =
384,
63,
63,
+ false,
+ true,
true,
true,
true,
@@ -4331,6 +4451,8 @@ const struct real_format decimal_quad_format =
6144,
127,
127,
+ false,
+ true,
true,
true,
true,
@@ -4374,6 +4496,8 @@ const struct real_format real_internal_format =
MAX_EXP,
-1,
-1,
+ false,
+ false,
true,
true,
false,
diff --git a/gcc/real.h b/gcc/real.h
index 633229969a7..8cdf471e742 100644
--- a/gcc/real.h
+++ b/gcc/real.h
@@ -147,6 +147,10 @@ struct real_format
or -1 for a complex encoding. */
int signbit_rw;
+ /* Default rounding mode for operations on this format. */
+ bool round_towards_zero;
+ bool has_sign_dependent_rounding;
+
/* Properties of the format. */
bool has_nans;
bool has_inf;
@@ -168,15 +172,32 @@ extern const struct real_format *
#define REAL_MODE_FORMAT(MODE) \
(real_format_for_mode[DECIMAL_FLOAT_MODE_P (MODE) \
- ? ((MODE - MIN_MODE_DECIMAL_FLOAT) \
+ ? (((MODE) - MIN_MODE_DECIMAL_FLOAT) \
+ (MAX_MODE_FLOAT - MIN_MODE_FLOAT + 1)) \
- : (MODE - MIN_MODE_FLOAT)])
+ : ((MODE) - MIN_MODE_FLOAT)])
+
+#define FLOAT_MODE_FORMAT(MODE) \
+ (REAL_MODE_FORMAT (SCALAR_FLOAT_MODE_P (MODE)? (MODE) \
+ : GET_MODE_INNER (MODE)))
/* The following macro determines whether the floating point format is
composite, i.e. may contain non-consecutive mantissa bits, in which
case compile-time FP overflow may not model run-time overflow. */
-#define REAL_MODE_FORMAT_COMPOSITE_P(MODE) \
- ((REAL_MODE_FORMAT(MODE))->pnan < (REAL_MODE_FORMAT (MODE))->p)
+#define MODE_COMPOSITE_P(MODE) \
+ (FLOAT_MODE_P (MODE) \
+ && FLOAT_MODE_FORMAT (MODE)->pnan < FLOAT_MODE_FORMAT (MODE)->p)
+
+/* Accessor macros for format properties. */
+#define MODE_HAS_NANS(MODE) \
+ (FLOAT_MODE_P (MODE) && FLOAT_MODE_FORMAT (MODE)->has_nans)
+#define MODE_HAS_INFINITIES(MODE) \
+ (FLOAT_MODE_P (MODE) && FLOAT_MODE_FORMAT (MODE)->has_inf)
+#define MODE_HAS_SIGNED_ZEROS(MODE) \
+ (FLOAT_MODE_P (MODE) && FLOAT_MODE_FORMAT (MODE)->has_signed_zero)
+#define MODE_HAS_SIGN_DEPENDENT_ROUNDING(MODE) \
+ (FLOAT_MODE_P (MODE) \
+ && FLOAT_MODE_FORMAT (MODE)->has_sign_dependent_rounding)
+
/* Declare functions in real.c. */
@@ -216,6 +237,11 @@ extern bool exact_real_truncate (enum machine_mode, const REAL_VALUE_TYPE *);
extern void real_to_decimal (char *, const REAL_VALUE_TYPE *, size_t,
size_t, int);
+/* Render R as a decimal floating point constant, rounded so as to be
+ parsed back to the same value when interpreted in mode MODE. */
+extern void real_to_decimal_for_mode (char *, const REAL_VALUE_TYPE *, size_t,
+ size_t, int, enum machine_mode);
+
/* Render R as a hexadecimal floating point constant. */
extern void real_to_hexadecimal (char *, const REAL_VALUE_TYPE *,
size_t, size_t, int);
@@ -259,6 +285,7 @@ extern unsigned int real_hash (const REAL_VALUE_TYPE *);
extern const struct real_format ieee_single_format;
extern const struct real_format mips_single_format;
extern const struct real_format motorola_single_format;
+extern const struct real_format spu_single_format;
extern const struct real_format ieee_double_format;
extern const struct real_format mips_double_format;
extern const struct real_format motorola_double_format;
diff --git a/gcc/recog.c b/gcc/recog.c
index 73d57647877..44d3b40b643 100644
--- a/gcc/recog.c
+++ b/gcc/recog.c
@@ -183,7 +183,7 @@ static int changes_allocated;
static int num_changes = 0;
/* Validate a proposed change to OBJECT. LOC is the location in the rtl
- at which NEW will be placed. If OBJECT is zero, no validation is done,
+ at which NEW_RTX will be placed. If OBJECT is zero, no validation is done,
the change is simply made.
Two types of objects are supported: If OBJECT is a MEM, memory_address_p
@@ -201,16 +201,16 @@ static int num_changes = 0;
Otherwise, perform the change and return 1. */
static bool
-validate_change_1 (rtx object, rtx *loc, rtx new, bool in_group, bool unshare)
+validate_change_1 (rtx object, rtx *loc, rtx new_rtx, bool in_group, bool unshare)
{
rtx old = *loc;
- if (old == new || rtx_equal_p (old, new))
+ if (old == new_rtx || rtx_equal_p (old, new_rtx))
return 1;
gcc_assert (in_group != 0 || num_changes == 0);
- *loc = new;
+ *loc = new_rtx;
/* Save the information describing this change. */
if (num_changes >= changes_allocated)
@@ -253,18 +253,18 @@ validate_change_1 (rtx object, rtx *loc, rtx new, bool in_group, bool unshare)
UNSHARE to false. */
bool
-validate_change (rtx object, rtx *loc, rtx new, bool in_group)
+validate_change (rtx object, rtx *loc, rtx new_rtx, bool in_group)
{
- return validate_change_1 (object, loc, new, in_group, false);
+ return validate_change_1 (object, loc, new_rtx, in_group, false);
}
/* Wrapper for validate_change_1 without the UNSHARE argument defaulting
UNSHARE to true. */
bool
-validate_unshare_change (rtx object, rtx *loc, rtx new, bool in_group)
+validate_unshare_change (rtx object, rtx *loc, rtx new_rtx, bool in_group)
{
- return validate_change_1 (object, loc, new, in_group, true);
+ return validate_change_1 (object, loc, new_rtx, in_group, true);
}
@@ -525,7 +525,7 @@ validate_replace_rtx_1 (rtx *loc, rtx from, rtx to, rtx object)
enum rtx_code code;
enum machine_mode op0_mode = VOIDmode;
int prev_changes = num_changes;
- rtx new;
+ rtx new_rtx;
if (!x)
return;
@@ -633,25 +633,25 @@ validate_replace_rtx_1 (rtx *loc, rtx from, rtx to, rtx object)
case SIGN_EXTEND:
if (GET_MODE (XEXP (x, 0)) == VOIDmode)
{
- new = simplify_gen_unary (code, GET_MODE (x), XEXP (x, 0),
+ new_rtx = simplify_gen_unary (code, GET_MODE (x), XEXP (x, 0),
op0_mode);
/* If any of the above failed, substitute in something that
we know won't be recognized. */
- if (!new)
- new = gen_rtx_CLOBBER (GET_MODE (x), const0_rtx);
- validate_change (object, loc, new, 1);
+ if (!new_rtx)
+ new_rtx = gen_rtx_CLOBBER (GET_MODE (x), const0_rtx);
+ validate_change (object, loc, new_rtx, 1);
}
break;
case SUBREG:
/* All subregs possible to simplify should be simplified. */
- new = simplify_subreg (GET_MODE (x), SUBREG_REG (x), op0_mode,
+ new_rtx = simplify_subreg (GET_MODE (x), SUBREG_REG (x), op0_mode,
SUBREG_BYTE (x));
/* Subregs of VOIDmode operands are incorrect. */
- if (!new && GET_MODE (SUBREG_REG (x)) == VOIDmode)
- new = gen_rtx_CLOBBER (GET_MODE (x), const0_rtx);
- if (new)
- validate_change (object, loc, new, 1);
+ if (!new_rtx && GET_MODE (SUBREG_REG (x)) == VOIDmode)
+ new_rtx = gen_rtx_CLOBBER (GET_MODE (x), const0_rtx);
+ if (new_rtx)
+ validate_change (object, loc, new_rtx, 1);
break;
case ZERO_EXTRACT:
case SIGN_EXTRACT:
@@ -1686,16 +1686,14 @@ asm_operand_ok (rtx op, const char *constraint)
result = 1;
}
#ifdef EXTRA_CONSTRAINT_STR
+ else if (EXTRA_MEMORY_CONSTRAINT (c, constraint))
+ /* Every memory operand can be reloaded to fit. */
+ result = result || memory_operand (op, VOIDmode);
+ else if (EXTRA_ADDRESS_CONSTRAINT (c, constraint))
+ /* Every address operand can be reloaded to fit. */
+ result = result || address_operand (op, VOIDmode);
else if (EXTRA_CONSTRAINT_STR (op, c, constraint))
result = 1;
- else if (EXTRA_MEMORY_CONSTRAINT (c, constraint)
- /* Every memory operand can be reloaded to fit. */
- && memory_operand (op, VOIDmode))
- result = 1;
- else if (EXTRA_ADDRESS_CONSTRAINT (c, constraint)
- /* Every address operand can be reloaded to fit. */
- && address_operand (op, VOIDmode))
- result = 1;
#endif
break;
}
@@ -2200,7 +2198,7 @@ preprocess_constraints (void)
struct funny_match
{
- int this, other;
+ int this_op, other;
};
int
@@ -2350,7 +2348,7 @@ constrain_operands (int strict)
output op is the one that will be printed. */
if (val == 2 && strict > 0)
{
- funny_match[funny_match_index].this = opno;
+ funny_match[funny_match_index].this_op = opno;
funny_match[funny_match_index++].other = match;
}
}
@@ -2583,7 +2581,7 @@ constrain_operands (int strict)
while (--funny_match_index >= 0)
{
recog_data.operand[funny_match[funny_match_index].other]
- = recog_data.operand[funny_match[funny_match_index].this];
+ = recog_data.operand[funny_match[funny_match_index].this_op];
}
return 1;
@@ -2674,6 +2672,7 @@ split_all_insns (void)
rtx insn, next;
bool finish = false;
+ rtl_profile_for_bb (bb);
for (insn = BB_HEAD (bb); !finish ; insn = next)
{
/* Can't use `next_real_insn' because that might go across
@@ -2716,6 +2715,7 @@ split_all_insns (void)
}
}
+ default_rtl_profile ();
if (changed)
find_many_sub_basic_blocks (blocks);
@@ -2968,6 +2968,7 @@ peephole2_optimize (void)
FOR_EACH_BB_REVERSE (bb)
{
+ rtl_profile_for_bb (bb);
/* Indicate that all slots except the last holds invalid data. */
for (i = 0; i < MAX_INSNS_PER_PEEP2; ++i)
peep2_insn_data[i].insn = NULL_RTX;
@@ -2987,7 +2988,7 @@ peephole2_optimize (void)
prev = PREV_INSN (insn);
if (INSN_P (insn))
{
- rtx try, before_try, x;
+ rtx attempt, before_try, x;
int match_len;
rtx note;
bool was_call = false;
@@ -3008,13 +3009,13 @@ peephole2_optimize (void)
substitution would lose the
REG_FRAME_RELATED_EXPR that is attached. */
peep2_current_count = 0;
- try = NULL;
+ attempt = NULL;
}
else
/* Match the peephole. */
- try = peephole2_insns (PATTERN (insn), insn, &match_len);
+ attempt = peephole2_insns (PATTERN (insn), insn, &match_len);
- if (try != NULL)
+ if (attempt != NULL)
{
/* If we are splitting a CALL_INSN, look for the CALL_INSN
in SEQ and copy our CALL_INSN_FUNCTION_USAGE and other
@@ -3032,7 +3033,7 @@ peephole2_optimize (void)
continue;
was_call = true;
- new_insn = try;
+ new_insn = attempt;
while (new_insn != NULL_RTX)
{
if (CALL_P (new_insn))
@@ -3080,8 +3081,9 @@ peephole2_optimize (void)
REG_EH_REGION, NULL_RTX);
/* Replace the old sequence with the new. */
- try = emit_insn_after_setloc (try, peep2_insn_data[i].insn,
- INSN_LOCATOR (peep2_insn_data[i].insn));
+ attempt = emit_insn_after_setloc (attempt,
+ peep2_insn_data[i].insn,
+ INSN_LOCATOR (peep2_insn_data[i].insn));
before_try = PREV_INSN (insn);
delete_insn_chain (insn, peep2_insn_data[i].insn, false);
@@ -3095,7 +3097,7 @@ peephole2_optimize (void)
if (eh_edge->flags & (EDGE_EH | EDGE_ABNORMAL_CALL))
break;
- for (x = try ; x != before_try ; x = PREV_INSN (x))
+ for (x = attempt ; x != before_try ; x = PREV_INSN (x))
if (CALL_P (x)
|| (flag_non_call_exceptions
&& may_trap_p (PATTERN (x))
@@ -3145,7 +3147,7 @@ peephole2_optimize (void)
bitmap_copy (live, peep2_insn_data[i].live_before);
/* Update life information for the new sequence. */
- x = try;
+ x = attempt;
do
{
if (INSN_P (x))
@@ -3169,7 +3171,7 @@ peephole2_optimize (void)
/* If we generated a jump instruction, it won't have
JUMP_LABEL set. Recompute after we're done. */
- for (x = try; x != before_try; x = PREV_INSN (x))
+ for (x = attempt; x != before_try; x = PREV_INSN (x))
if (JUMP_P (x))
{
do_rebuild_jump_labels = true;
@@ -3183,6 +3185,7 @@ peephole2_optimize (void)
}
}
+ default_rtl_profile ();
for (i = 0; i < MAX_INSNS_PER_PEEP2 + 1; ++i)
BITMAP_FREE (peep2_insn_data[i].live_before);
BITMAP_FREE (live);
diff --git a/gcc/reg-stack.c b/gcc/reg-stack.c
index 4b5e422e207..eb31bc835cf 100644
--- a/gcc/reg-stack.c
+++ b/gcc/reg-stack.c
@@ -713,18 +713,18 @@ replace_reg (rtx *reg, int regno)
static void
remove_regno_note (rtx insn, enum reg_note note, unsigned int regno)
{
- rtx *note_link, this;
+ rtx *note_link, this_rtx;
note_link = &REG_NOTES (insn);
- for (this = *note_link; this; this = XEXP (this, 1))
- if (REG_NOTE_KIND (this) == note
- && REG_P (XEXP (this, 0)) && REGNO (XEXP (this, 0)) == regno)
+ for (this_rtx = *note_link; this_rtx; this_rtx = XEXP (this_rtx, 1))
+ if (REG_NOTE_KIND (this_rtx) == note
+ && REG_P (XEXP (this_rtx, 0)) && REGNO (XEXP (this_rtx, 0)) == regno)
{
- *note_link = XEXP (this, 1);
+ *note_link = XEXP (this_rtx, 1);
return;
}
else
- note_link = &XEXP (this, 1);
+ note_link = &XEXP (this_rtx, 1);
gcc_unreachable ();
}
@@ -2355,7 +2355,7 @@ subst_stack_regs (rtx insn, stack regstack)
is no longer needed once this has executed. */
static void
-change_stack (rtx insn, stack old, stack new, enum emit_where where)
+change_stack (rtx insn, stack old, stack new_stack, enum emit_where where)
{
int reg;
int update_end = 0;
@@ -2368,9 +2368,9 @@ change_stack (rtx insn, stack old, stack new, enum emit_where where)
&& starting_stack_p
&& where == EMIT_BEFORE)
{
- BLOCK_INFO (current_block)->stack_in = *new;
+ BLOCK_INFO (current_block)->stack_in = *new_stack;
starting_stack_p = false;
- *old = *new;
+ *old = *new_stack;
return;
}
@@ -2386,7 +2386,7 @@ change_stack (rtx insn, stack old, stack new, enum emit_where where)
/* Initialize partially dead variables. */
for (i = FIRST_STACK_REG; i < LAST_STACK_REG + 1; i++)
- if (TEST_HARD_REG_BIT (new->reg_set, i)
+ if (TEST_HARD_REG_BIT (new_stack->reg_set, i)
&& !TEST_HARD_REG_BIT (old->reg_set, i))
{
old->reg[++old->top] = i;
@@ -2400,28 +2400,28 @@ change_stack (rtx insn, stack old, stack new, enum emit_where where)
/* If the destination block's stack already has a specified layout
and contains two or more registers, use a more intelligent algorithm
to pop registers that minimizes the number number of fxchs below. */
- if (new->top > 0)
+ if (new_stack->top > 0)
{
bool slots[REG_STACK_SIZE];
int pops[REG_STACK_SIZE];
int next, dest, topsrc;
/* First pass to determine the free slots. */
- for (reg = 0; reg <= new->top; reg++)
- slots[reg] = TEST_HARD_REG_BIT (new->reg_set, old->reg[reg]);
+ for (reg = 0; reg <= new_stack->top; reg++)
+ slots[reg] = TEST_HARD_REG_BIT (new_stack->reg_set, old->reg[reg]);
/* Second pass to allocate preferred slots. */
topsrc = -1;
- for (reg = old->top; reg > new->top; reg--)
- if (TEST_HARD_REG_BIT (new->reg_set, old->reg[reg]))
+ for (reg = old->top; reg > new_stack->top; reg--)
+ if (TEST_HARD_REG_BIT (new_stack->reg_set, old->reg[reg]))
{
dest = -1;
- for (next = 0; next <= new->top; next++)
- if (!slots[next] && new->reg[next] == old->reg[reg])
+ for (next = 0; next <= new_stack->top; next++)
+ if (!slots[next] && new_stack->reg[next] == old->reg[reg])
{
/* If this is a preference for the new top of stack, record
the fact by remembering it's old->reg in topsrc. */
- if (next == new->top)
+ if (next == new_stack->top)
topsrc = reg;
slots[next] = true;
dest = next;
@@ -2438,18 +2438,18 @@ change_stack (rtx insn, stack old, stack new, enum emit_where where)
slot is still unallocated, in which case we should place the
top of stack there. */
if (topsrc != -1)
- for (reg = 0; reg < new->top; reg++)
+ for (reg = 0; reg < new_stack->top; reg++)
if (!slots[reg])
{
pops[topsrc] = reg;
- slots[new->top] = false;
+ slots[new_stack->top] = false;
slots[reg] = true;
break;
}
/* Third pass allocates remaining slots and emits pop insns. */
- next = new->top;
- for (reg = old->top; reg > new->top; reg--)
+ next = new_stack->top;
+ for (reg = old->top; reg > new_stack->top; reg--)
{
dest = pops[reg];
if (dest == -1)
@@ -2472,14 +2472,14 @@ change_stack (rtx insn, stack old, stack new, enum emit_where where)
live = 0;
for (reg = 0; reg <= old->top; reg++)
- if (TEST_HARD_REG_BIT (new->reg_set, old->reg[reg]))
+ if (TEST_HARD_REG_BIT (new_stack->reg_set, old->reg[reg]))
live++;
next = live;
while (old->top >= live)
- if (TEST_HARD_REG_BIT (new->reg_set, old->reg[old->top]))
+ if (TEST_HARD_REG_BIT (new_stack->reg_set, old->reg[old->top]))
{
- while (TEST_HARD_REG_BIT (new->reg_set, old->reg[next]))
+ while (TEST_HARD_REG_BIT (new_stack->reg_set, old->reg[next]))
next--;
emit_pop_insn (insn, old, FP_MODE_REG (old->reg[next], DFmode),
EMIT_BEFORE);
@@ -2489,13 +2489,13 @@ change_stack (rtx insn, stack old, stack new, enum emit_where where)
EMIT_BEFORE);
}
- if (new->top == -2)
+ if (new_stack->top == -2)
{
/* If the new block has never been processed, then it can inherit
the old stack order. */
- new->top = old->top;
- memcpy (new->reg, old->reg, sizeof (new->reg));
+ new_stack->top = old->top;
+ memcpy (new_stack->reg, old->reg, sizeof (new_stack->reg));
}
else
{
@@ -2505,10 +2505,10 @@ change_stack (rtx insn, stack old, stack new, enum emit_where where)
/* By now, the only difference should be the order of the stack,
not their depth or liveliness. */
- gcc_assert (hard_reg_set_equal_p (old->reg_set, new->reg_set));
- gcc_assert (old->top == new->top);
+ gcc_assert (hard_reg_set_equal_p (old->reg_set, new_stack->reg_set));
+ gcc_assert (old->top == new_stack->top);
- /* If the stack is not empty (new->top != -1), loop here emitting
+ /* If the stack is not empty (new_stack->top != -1), loop here emitting
swaps until the stack is correct.
The worst case number of swaps emitted is N + 2, where N is the
@@ -2517,16 +2517,16 @@ change_stack (rtx insn, stack old, stack new, enum emit_where where)
other regs. But since we never swap any other reg away from
its correct slot, this algorithm will converge. */
- if (new->top != -1)
+ if (new_stack->top != -1)
do
{
/* Swap the reg at top of stack into the position it is
supposed to be in, until the correct top of stack appears. */
- while (old->reg[old->top] != new->reg[new->top])
+ while (old->reg[old->top] != new_stack->reg[new_stack->top])
{
- for (reg = new->top; reg >= 0; reg--)
- if (new->reg[reg] == old->reg[old->top])
+ for (reg = new_stack->top; reg >= 0; reg--)
+ if (new_stack->reg[reg] == old->reg[old->top])
break;
gcc_assert (reg != -1);
@@ -2539,8 +2539,8 @@ change_stack (rtx insn, stack old, stack new, enum emit_where where)
incorrect reg to the top of stack, and let the while loop
above fix it. */
- for (reg = new->top; reg >= 0; reg--)
- if (new->reg[reg] != old->reg[reg])
+ for (reg = new_stack->top; reg >= 0; reg--)
+ if (new_stack->reg[reg] != old->reg[reg])
{
emit_swap_insn (insn, old,
FP_MODE_REG (old->reg[reg], DFmode));
@@ -2551,7 +2551,7 @@ change_stack (rtx insn, stack old, stack new, enum emit_where where)
/* At this point there must be no differences. */
for (reg = old->top; reg >= 0; reg--)
- gcc_assert (old->reg[reg] == new->reg[reg]);
+ gcc_assert (old->reg[reg] == new_stack->reg[reg]);
}
if (update_end)
diff --git a/gcc/regclass.c b/gcc/regclass.c
index dab3377976c..386214dbe0d 100644
--- a/gcc/regclass.c
+++ b/gcc/regclass.c
@@ -738,7 +738,7 @@ init_fake_stack_mems (void)
Only needed if secondary reloads are required for memory moves. */
int
-memory_move_secondary_cost (enum machine_mode mode, enum reg_class class, int in)
+memory_move_secondary_cost (enum machine_mode mode, enum reg_class rclass, int in)
{
enum reg_class altclass;
int partial_cost = 0;
@@ -747,17 +747,17 @@ memory_move_secondary_cost (enum machine_mode mode, enum reg_class class, int in
rtx mem ATTRIBUTE_UNUSED = top_of_stack[(int) mode];
- altclass = secondary_reload_class (in ? 1 : 0, class, mode, mem);
+ altclass = secondary_reload_class (in ? 1 : 0, rclass, mode, mem);
if (altclass == NO_REGS)
return 0;
if (in)
- partial_cost = REGISTER_MOVE_COST (mode, altclass, class);
+ partial_cost = REGISTER_MOVE_COST (mode, altclass, rclass);
else
- partial_cost = REGISTER_MOVE_COST (mode, class, altclass);
+ partial_cost = REGISTER_MOVE_COST (mode, rclass, altclass);
- if (class == altclass)
+ if (rclass == altclass)
/* This isn't simply a copy-to-temporary situation. Can't guess
what it is, so MEMORY_MOVE_COST really ought not to be calling
here in that case.
@@ -1087,23 +1087,23 @@ dump_regclass (FILE *dump)
int i;
for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++)
{
- int /* enum reg_class */ class;
+ int /* enum reg_class */ rclass;
if (REG_N_REFS (i))
{
fprintf (dump, " Register %i costs:", i);
- for (class = 0; class < (int) N_REG_CLASSES; class++)
- if (contains_reg_of_mode [(enum reg_class) class][PSEUDO_REGNO_MODE (i)]
+ for (rclass = 0; rclass < (int) N_REG_CLASSES; rclass++)
+ if (contains_reg_of_mode [(enum reg_class) rclass][PSEUDO_REGNO_MODE (i)]
#ifdef FORBIDDEN_INC_DEC_CLASSES
&& (!in_inc_dec[i]
- || !forbidden_inc_dec_class[(enum reg_class) class])
+ || !forbidden_inc_dec_class[(enum reg_class) rclass])
#endif
#ifdef CANNOT_CHANGE_MODE_CLASS
- && ! invalid_mode_change_p (i, (enum reg_class) class,
+ && ! invalid_mode_change_p (i, (enum reg_class) rclass,
PSEUDO_REGNO_MODE (i))
#endif
)
- fprintf (dump, " %s:%i", reg_class_names[class],
- costs[i].cost[(enum reg_class) class]);
+ fprintf (dump, " %s:%i", reg_class_names[rclass],
+ costs[i].cost[(enum reg_class) rclass]);
fprintf (dump, " MEM:%i\n", costs[i].mem_cost);
}
}
@@ -1382,7 +1382,7 @@ regclass (rtx f, int nregs)
enum reg_class best = ALL_REGS, alt = NO_REGS;
/* This is an enum reg_class, but we call it an int
to save lots of casts. */
- int class;
+ int rclass;
struct costs *p = &costs[i];
if (regno_reg_rtx[i] == NULL)
@@ -1393,27 +1393,27 @@ regclass (rtx f, int nregs)
if (optimize && !REG_N_REFS (i) && !REG_N_SETS (i))
continue;
- for (class = (int) ALL_REGS - 1; class > 0; class--)
+ for (rclass = (int) ALL_REGS - 1; rclass > 0; rclass--)
{
/* Ignore classes that are too small for this operand or
invalid for an operand that was auto-incremented. */
- if (!contains_reg_of_mode [class][PSEUDO_REGNO_MODE (i)]
+ if (!contains_reg_of_mode [rclass][PSEUDO_REGNO_MODE (i)]
#ifdef FORBIDDEN_INC_DEC_CLASSES
- || (in_inc_dec[i] && forbidden_inc_dec_class[class])
+ || (in_inc_dec[i] && forbidden_inc_dec_class[rclass])
#endif
#ifdef CANNOT_CHANGE_MODE_CLASS
- || invalid_mode_change_p (i, (enum reg_class) class,
+ || invalid_mode_change_p (i, (enum reg_class) rclass,
PSEUDO_REGNO_MODE (i))
#endif
)
;
- else if (p->cost[class] < best_cost)
+ else if (p->cost[rclass] < best_cost)
{
- best_cost = p->cost[class];
- best = (enum reg_class) class;
+ best_cost = p->cost[rclass];
+ best = (enum reg_class) rclass;
}
- else if (p->cost[class] == best_cost)
- best = reg_class_subunion[(int) best][class];
+ else if (p->cost[rclass] == best_cost)
+ best = reg_class_subunion[(int) best][rclass];
}
/* If no register class is better than memory, use memory. */
@@ -1428,19 +1428,19 @@ regclass (rtx f, int nregs)
will be doing it again later. */
if ((pass == 1 || dump_file) || ! flag_expensive_optimizations)
- for (class = 0; class < N_REG_CLASSES; class++)
- if (p->cost[class] < p->mem_cost
- && (reg_class_size[(int) reg_class_subunion[(int) alt][class]]
+ for (rclass = 0; rclass < N_REG_CLASSES; rclass++)
+ if (p->cost[rclass] < p->mem_cost
+ && (reg_class_size[(int) reg_class_subunion[(int) alt][rclass]]
> reg_class_size[(int) alt])
#ifdef FORBIDDEN_INC_DEC_CLASSES
- && ! (in_inc_dec[i] && forbidden_inc_dec_class[class])
+ && ! (in_inc_dec[i] && forbidden_inc_dec_class[rclass])
#endif
#ifdef CANNOT_CHANGE_MODE_CLASS
- && ! invalid_mode_change_p (i, (enum reg_class) class,
+ && ! invalid_mode_change_p (i, (enum reg_class) rclass,
PSEUDO_REGNO_MODE (i))
#endif
)
- alt = reg_class_subunion[(int) alt][class];
+ alt = reg_class_subunion[(int) alt][rclass];
/* If we don't add any classes, nothing to try. */
if (alt == best)
@@ -1517,7 +1517,7 @@ record_reg_classes (int n_alts, int n_ops, rtx *ops,
int alt_cost = 0;
enum reg_class classes[MAX_RECOG_OPERANDS];
int allows_mem[MAX_RECOG_OPERANDS];
- int class;
+ int rclass;
for (i = 0; i < n_ops; i++)
{
@@ -1617,17 +1617,17 @@ record_reg_classes (int n_alts, int n_ops, rtx *ops,
switch (recog_data.operand_type[i])
{
case OP_INOUT:
- for (class = 0; class < N_REG_CLASSES; class++)
- pp->cost[class] = (intable[class][op_class]
- + outtable[op_class][class]);
+ for (rclass = 0; rclass < N_REG_CLASSES; rclass++)
+ pp->cost[rclass] = (intable[rclass][op_class]
+ + outtable[op_class][rclass]);
break;
case OP_IN:
- for (class = 0; class < N_REG_CLASSES; class++)
- pp->cost[class] = intable[class][op_class];
+ for (rclass = 0; rclass < N_REG_CLASSES; rclass++)
+ pp->cost[rclass] = intable[rclass][op_class];
break;
case OP_OUT:
- for (class = 0; class < N_REG_CLASSES; class++)
- pp->cost[class] = outtable[op_class][class];
+ for (rclass = 0; rclass < N_REG_CLASSES; rclass++)
+ pp->cost[rclass] = outtable[op_class][rclass];
break;
}
@@ -1861,17 +1861,17 @@ record_reg_classes (int n_alts, int n_ops, rtx *ops,
switch (recog_data.operand_type[i])
{
case OP_INOUT:
- for (class = 0; class < N_REG_CLASSES; class++)
- pp->cost[class] = (intable[class][op_class]
- + outtable[op_class][class]);
+ for (rclass = 0; rclass < N_REG_CLASSES; rclass++)
+ pp->cost[rclass] = (intable[rclass][op_class]
+ + outtable[op_class][rclass]);
break;
case OP_IN:
- for (class = 0; class < N_REG_CLASSES; class++)
- pp->cost[class] = intable[class][op_class];
+ for (rclass = 0; rclass < N_REG_CLASSES; rclass++)
+ pp->cost[rclass] = intable[rclass][op_class];
break;
case OP_OUT:
- for (class = 0; class < N_REG_CLASSES; class++)
- pp->cost[class] = outtable[op_class][class];
+ for (rclass = 0; rclass < N_REG_CLASSES; rclass++)
+ pp->cost[rclass] = outtable[op_class][rclass];
break;
}
@@ -1949,9 +1949,9 @@ record_reg_classes (int n_alts, int n_ops, rtx *ops,
pp->mem_cost = MIN (pp->mem_cost,
(qq->mem_cost + alt_cost) * scale);
- for (class = 0; class < N_REG_CLASSES; class++)
- pp->cost[class] = MIN (pp->cost[class],
- (qq->cost[class] + alt_cost) * scale);
+ for (rclass = 0; rclass < N_REG_CLASSES; rclass++)
+ pp->cost[rclass] = MIN (pp->cost[rclass],
+ (qq->cost[rclass] + alt_cost) * scale);
}
}
@@ -1978,7 +1978,7 @@ record_reg_classes (int n_alts, int n_ops, rtx *ops,
{
unsigned int regno = REGNO (ops[!i]);
enum machine_mode mode = GET_MODE (ops[!i]);
- int class;
+ int rclass;
if (regno >= FIRST_PSEUDO_REGISTER && reg_pref != 0
&& reg_pref[regno].prefclass != NO_REGS)
@@ -1991,15 +1991,15 @@ record_reg_classes (int n_alts, int n_ops, rtx *ops,
op_costs[i].cost[(unsigned char) pref] = -1;
}
else if (regno < FIRST_PSEUDO_REGISTER)
- for (class = 0; class < N_REG_CLASSES; class++)
- if (TEST_HARD_REG_BIT (reg_class_contents[class], regno)
- && reg_class_size[class] == (unsigned) CLASS_MAX_NREGS (class, mode))
+ for (rclass = 0; rclass < N_REG_CLASSES; rclass++)
+ if (TEST_HARD_REG_BIT (reg_class_contents[rclass], regno)
+ && reg_class_size[rclass] == (unsigned) CLASS_MAX_NREGS (rclass, mode))
{
- if (reg_class_size[class] == 1)
- op_costs[i].cost[class] = -1;
- else if (in_hard_reg_set_p (reg_class_contents[class],
+ if (reg_class_size[rclass] == 1)
+ op_costs[i].cost[rclass] = -1;
+ else if (in_hard_reg_set_p (reg_class_contents[rclass],
mode, regno))
- op_costs[i].cost[class] = -1;
+ op_costs[i].cost[rclass] = -1;
}
}
}
@@ -2010,7 +2010,7 @@ record_reg_classes (int n_alts, int n_ops, rtx *ops,
X must not be a pseudo. */
static int
-copy_cost (rtx x, enum machine_mode mode, enum reg_class class, int to_p,
+copy_cost (rtx x, enum machine_mode mode, enum reg_class rclass, int to_p,
secondary_reload_info *prev_sri)
{
enum reg_class secondary_class = NO_REGS;
@@ -2023,7 +2023,7 @@ copy_cost (rtx x, enum machine_mode mode, enum reg_class class, int to_p,
return 0;
/* Get the class we will actually use for a reload. */
- class = PREFERRED_RELOAD_CLASS (x, class);
+ rclass = PREFERRED_RELOAD_CLASS (x, rclass);
/* If we need a secondary reload for an intermediate, the
cost is that to load the input into the intermediate register, then
@@ -2031,13 +2031,13 @@ copy_cost (rtx x, enum machine_mode mode, enum reg_class class, int to_p,
sri.prev_sri = prev_sri;
sri.extra_cost = 0;
- secondary_class = targetm.secondary_reload (to_p, x, class, mode, &sri);
+ secondary_class = targetm.secondary_reload (to_p, x, rclass, mode, &sri);
if (!move_cost[mode])
init_move_cost (mode);
if (secondary_class != NO_REGS)
- return (move_cost[mode][(int) secondary_class][(int) class]
+ return (move_cost[mode][(int) secondary_class][(int) rclass]
+ sri.extra_cost
+ copy_cost (x, mode, secondary_class, to_p, &sri));
@@ -2045,12 +2045,12 @@ copy_cost (rtx x, enum machine_mode mode, enum reg_class class, int to_p,
cost to move between the register classes, and use 2 for everything
else (constants). */
- if (MEM_P (x) || class == NO_REGS)
- return sri.extra_cost + MEMORY_MOVE_COST (mode, class, to_p);
+ if (MEM_P (x) || rclass == NO_REGS)
+ return sri.extra_cost + MEMORY_MOVE_COST (mode, rclass, to_p);
else if (REG_P (x))
return (sri.extra_cost
- + move_cost[mode][(int) REGNO_REG_CLASS (REGNO (x))][(int) class]);
+ + move_cost[mode][(int) REGNO_REG_CLASS (REGNO (x))][(int) rclass]);
else
/* If this is a constant, we may eventually want to call rtx_cost here. */
@@ -2076,12 +2076,12 @@ record_address_regs (enum machine_mode mode, rtx x, int context,
int scale)
{
enum rtx_code code = GET_CODE (x);
- enum reg_class class;
+ enum reg_class rclass;
if (context == 1)
- class = INDEX_REG_CLASS;
+ rclass = INDEX_REG_CLASS;
else
- class = base_reg_class (mode, outer_code, index_code);
+ rclass = base_reg_class (mode, outer_code, index_code);
switch (code)
{
@@ -2234,12 +2234,12 @@ record_address_regs (enum machine_mode mode, rtx x, int context,
struct costs *pp = &costs[REGNO (x)];
int i;
- pp->mem_cost += (MEMORY_MOVE_COST (Pmode, class, 1) * scale) / 2;
+ pp->mem_cost += (MEMORY_MOVE_COST (Pmode, rclass, 1) * scale) / 2;
if (!move_cost[Pmode])
init_move_cost (Pmode);
for (i = 0; i < N_REG_CLASSES; i++)
- pp->cost[i] += (may_move_in_cost[Pmode][i][(int) class] * scale) / 2;
+ pp->cost[i] += (may_move_in_cost[Pmode][i][(int) rclass] * scale) / 2;
}
break;
@@ -2627,7 +2627,7 @@ cannot_change_mode_set_regs (HARD_REG_SET *used, enum machine_mode from,
bool
invalid_mode_change_p (unsigned int regno,
- enum reg_class class ATTRIBUTE_UNUSED,
+ enum reg_class rclass ATTRIBUTE_UNUSED,
enum machine_mode from)
{
struct subregs_of_mode_node dummy, *node;
@@ -2644,7 +2644,7 @@ invalid_mode_change_p (unsigned int regno,
mask = 1 << (regno & 7);
for (to = VOIDmode; to < NUM_MACHINE_MODES; to++)
if (node->modes[to] & mask)
- if (CANNOT_CHANGE_MODE_CLASS (from, to, class))
+ if (CANNOT_CHANGE_MODE_CLASS (from, to, rclass))
return true;
return false;
diff --git a/gcc/regrename.c b/gcc/regrename.c
index 8e48ad58a94..0ed810e6393 100644
--- a/gcc/regrename.c
+++ b/gcc/regrename.c
@@ -222,13 +222,13 @@ regrename_optimize (void)
{
int new_reg, best_new_reg;
int n_uses;
- struct du_chain *this = all_chains;
+ struct du_chain *this_du = all_chains;
struct du_chain *tmp, *last;
HARD_REG_SET this_unavailable;
- int reg = REGNO (*this->loc);
+ int reg = REGNO (*this_du->loc);
int i;
- all_chains = this->next_chain;
+ all_chains = this_du->next_chain;
best_new_reg = reg;
@@ -256,7 +256,7 @@ regrename_optimize (void)
count number of uses, and narrow the set of registers we can
use for renaming. */
n_uses = 0;
- for (last = this; last->next_use; last = last->next_use)
+ for (last = this_du; last->next_use; last = last->next_use)
{
n_uses++;
IOR_COMPL_HARD_REG_SET (this_unavailable,
@@ -268,16 +268,16 @@ regrename_optimize (void)
IOR_COMPL_HARD_REG_SET (this_unavailable,
reg_class_contents[last->cl]);
- if (this->need_caller_save_reg)
+ if (this_du->need_caller_save_reg)
IOR_HARD_REG_SET (this_unavailable, call_used_reg_set);
- merge_overlapping_regs (bb, &this_unavailable, this);
+ merge_overlapping_regs (bb, &this_unavailable, this_du);
/* Now potential_regs is a reasonable approximation, let's
have a closer look at each register still in there. */
for (new_reg = 0; new_reg < FIRST_PSEUDO_REGISTER; new_reg++)
{
- int nregs = hard_regno_nregs[new_reg][GET_MODE (*this->loc)];
+ int nregs = hard_regno_nregs[new_reg][GET_MODE (*this_du->loc)];
for (i = nregs - 1; i >= 0; --i)
if (TEST_HARD_REG_BIT (this_unavailable, new_reg + i)
@@ -302,7 +302,7 @@ regrename_optimize (void)
/* See whether it accepts all modes that occur in
definition and uses. */
- for (tmp = this; tmp; tmp = tmp->next_use)
+ for (tmp = this_du; tmp; tmp = tmp->next_use)
if (! HARD_REGNO_MODE_OK (new_reg, GET_MODE (*tmp->loc))
|| (tmp->need_caller_save_reg
&& ! (HARD_REGNO_CALL_PART_CLOBBERED
@@ -333,7 +333,7 @@ regrename_optimize (void)
continue;
}
- do_replace (this, best_new_reg);
+ do_replace (this_du, best_new_reg);
tick[best_new_reg] = ++this_tick;
df_set_regs_ever_live (best_new_reg, true);
@@ -385,15 +385,15 @@ scan_rtx_reg (rtx insn, rtx *loc, enum reg_class cl,
{
if (type == OP_OUT)
{
- struct du_chain *this = XOBNEW (&rename_obstack, struct du_chain);
- this->next_use = 0;
- this->next_chain = open_chains;
- this->loc = loc;
- this->insn = insn;
- this->cl = cl;
- this->need_caller_save_reg = 0;
- this->earlyclobber = earlyclobber;
- open_chains = this;
+ struct du_chain *this_du = XOBNEW (&rename_obstack, struct du_chain);
+ this_du->next_use = 0;
+ this_du->next_chain = open_chains;
+ this_du->loc = loc;
+ this_du->insn = insn;
+ this_du->cl = cl;
+ this_du->need_caller_save_reg = 0;
+ this_du->earlyclobber = earlyclobber;
+ open_chains = this_du;
}
return;
}
@@ -403,7 +403,7 @@ scan_rtx_reg (rtx insn, rtx *loc, enum reg_class cl,
for (p = &open_chains; *p;)
{
- struct du_chain *this = *p;
+ struct du_chain *this_du = *p;
/* Check if the chain has been terminated if it has then skip to
the next chain.
@@ -412,18 +412,18 @@ scan_rtx_reg (rtx insn, rtx *loc, enum reg_class cl,
the chain in Step 3, but are trying to hide in-out operands
from terminate_write in Step 5. */
- if (*this->loc == cc0_rtx)
- p = &this->next_chain;
+ if (*this_du->loc == cc0_rtx)
+ p = &this_du->next_chain;
else
{
- int regno = REGNO (*this->loc);
- int nregs = hard_regno_nregs[regno][GET_MODE (*this->loc)];
+ int regno = REGNO (*this_du->loc);
+ int nregs = hard_regno_nregs[regno][GET_MODE (*this_du->loc)];
int exact_match = (regno == this_regno && nregs == this_nregs);
if (regno + nregs <= this_regno
|| this_regno + this_nregs <= regno)
{
- p = &this->next_chain;
+ p = &this_du->next_chain;
continue;
}
@@ -437,23 +437,23 @@ scan_rtx_reg (rtx insn, rtx *loc, enum reg_class cl,
be replaced with, terminate the chain. */
if (cl != NO_REGS)
{
- this = XOBNEW (&rename_obstack, struct du_chain);
- this->next_use = 0;
- this->next_chain = (*p)->next_chain;
- this->loc = loc;
- this->insn = insn;
- this->cl = cl;
- this->need_caller_save_reg = 0;
+ this_du = XOBNEW (&rename_obstack, struct du_chain);
+ this_du->next_use = 0;
+ this_du->next_chain = (*p)->next_chain;
+ this_du->loc = loc;
+ this_du->insn = insn;
+ this_du->cl = cl;
+ this_du->need_caller_save_reg = 0;
while (*p)
p = &(*p)->next_use;
- *p = this;
+ *p = this_du;
return;
}
}
if (action != terminate_overlapping_read || ! exact_match)
{
- struct du_chain *next = this->next_chain;
+ struct du_chain *next = this_du->next_chain;
/* Whether the terminated chain can be used for renaming
depends on the action and this being an exact match.
@@ -462,12 +462,12 @@ scan_rtx_reg (rtx insn, rtx *loc, enum reg_class cl,
if ((action == terminate_dead || action == terminate_write)
&& exact_match)
{
- this->next_chain = closed_chains;
- closed_chains = this;
+ this_du->next_chain = closed_chains;
+ closed_chains = this_du;
if (dump_file)
fprintf (dump_file,
"Closing chain %s at insn %d (%s)\n",
- reg_names[REGNO (*this->loc)], INSN_UID (insn),
+ reg_names[REGNO (*this_du->loc)], INSN_UID (insn),
scan_actions_name[(int) action]);
}
else
@@ -475,13 +475,13 @@ scan_rtx_reg (rtx insn, rtx *loc, enum reg_class cl,
if (dump_file)
fprintf (dump_file,
"Discarding chain %s at insn %d (%s)\n",
- reg_names[REGNO (*this->loc)], INSN_UID (insn),
+ reg_names[REGNO (*this_du->loc)], INSN_UID (insn),
scan_actions_name[(int) action]);
}
*p = next;
}
else
- p = &this->next_chain;
+ p = &this_du->next_chain;
}
}
}
@@ -976,15 +976,15 @@ dump_def_use_chain (struct du_chain *chains)
{
while (chains)
{
- struct du_chain *this = chains;
- int r = REGNO (*this->loc);
- int nregs = hard_regno_nregs[r][GET_MODE (*this->loc)];
+ struct du_chain *this_du = chains;
+ int r = REGNO (*this_du->loc);
+ int nregs = hard_regno_nregs[r][GET_MODE (*this_du->loc)];
fprintf (dump_file, "Register %s (%d):", reg_names[r], nregs);
- while (this)
+ while (this_du)
{
- fprintf (dump_file, " %d [%s]", INSN_UID (this->insn),
- reg_class_names[this->cl]);
- this = this->next_use;
+ fprintf (dump_file, " %d [%s]", INSN_UID (this_du->insn),
+ reg_class_names[this_du->cl]);
+ this_du = this_du->next_use;
}
fprintf (dump_file, "\n");
chains = chains->next_chain;
@@ -1365,17 +1365,17 @@ find_oldest_value_reg (enum reg_class cl, rtx reg, struct value_data *vd)
for (i = vd->e[regno].oldest_regno; i != regno; i = vd->e[i].next_regno)
{
enum machine_mode oldmode = vd->e[i].mode;
- rtx new;
+ rtx new_rtx;
if (!in_hard_reg_set_p (reg_class_contents[cl], mode, i))
return NULL_RTX;
- new = maybe_mode_change (oldmode, vd->e[regno].mode, mode, i, regno);
- if (new)
+ new_rtx = maybe_mode_change (oldmode, vd->e[regno].mode, mode, i, regno);
+ if (new_rtx)
{
- ORIGINAL_REGNO (new) = ORIGINAL_REGNO (reg);
- REG_ATTRS (new) = REG_ATTRS (reg);
- return new;
+ ORIGINAL_REGNO (new_rtx) = ORIGINAL_REGNO (reg);
+ REG_ATTRS (new_rtx) = REG_ATTRS (reg);
+ return new_rtx;
}
}
@@ -1389,14 +1389,14 @@ static bool
replace_oldest_value_reg (rtx *loc, enum reg_class cl, rtx insn,
struct value_data *vd)
{
- rtx new = find_oldest_value_reg (cl, *loc, vd);
- if (new)
+ rtx new_rtx = find_oldest_value_reg (cl, *loc, vd);
+ if (new_rtx)
{
if (dump_file)
fprintf (dump_file, "insn %u: replaced reg %u with %u\n",
- INSN_UID (insn), REGNO (*loc), REGNO (new));
+ INSN_UID (insn), REGNO (*loc), REGNO (new_rtx));
- validate_change (insn, loc, new, 1);
+ validate_change (insn, loc, new_rtx, 1);
return true;
}
return false;
@@ -1634,7 +1634,7 @@ copyprop_hardreg_forward_1 (basic_block bb, struct value_data *vd)
unsigned int regno = REGNO (src);
enum machine_mode mode = GET_MODE (src);
unsigned int i;
- rtx new;
+ rtx new_rtx;
/* If we are accessing SRC in some mode other that what we
set it in, make sure that the replacement is valid. */
@@ -1649,13 +1649,13 @@ copyprop_hardreg_forward_1 (basic_block bb, struct value_data *vd)
register in the same class. */
if (REG_P (SET_DEST (set)))
{
- new = find_oldest_value_reg (REGNO_REG_CLASS (regno), src, vd);
- if (new && validate_change (insn, &SET_SRC (set), new, 0))
+ new_rtx = find_oldest_value_reg (REGNO_REG_CLASS (regno), src, vd);
+ if (new_rtx && validate_change (insn, &SET_SRC (set), new_rtx, 0))
{
if (dump_file)
fprintf (dump_file,
"insn %u: replaced reg %u with %u\n",
- INSN_UID (insn), regno, REGNO (new));
+ INSN_UID (insn), regno, REGNO (new_rtx));
changed = true;
goto did_replacement;
}
@@ -1665,18 +1665,18 @@ copyprop_hardreg_forward_1 (basic_block bb, struct value_data *vd)
for (i = vd->e[regno].oldest_regno; i != regno;
i = vd->e[i].next_regno)
{
- new = maybe_mode_change (vd->e[i].mode, vd->e[regno].mode,
+ new_rtx = maybe_mode_change (vd->e[i].mode, vd->e[regno].mode,
mode, i, regno);
- if (new != NULL_RTX)
+ if (new_rtx != NULL_RTX)
{
- if (validate_change (insn, &SET_SRC (set), new, 0))
+ if (validate_change (insn, &SET_SRC (set), new_rtx, 0))
{
- ORIGINAL_REGNO (new) = ORIGINAL_REGNO (src);
- REG_ATTRS (new) = REG_ATTRS (src);
+ ORIGINAL_REGNO (new_rtx) = ORIGINAL_REGNO (src);
+ REG_ATTRS (new_rtx) = REG_ATTRS (src);
if (dump_file)
fprintf (dump_file,
"insn %u: replaced reg %u with %u\n",
- INSN_UID (insn), regno, REGNO (new));
+ INSN_UID (insn), regno, REGNO (new_rtx));
changed = true;
goto did_replacement;
}
@@ -1729,13 +1729,13 @@ copyprop_hardreg_forward_1 (basic_block bb, struct value_data *vd)
if (replaced[i])
{
int j;
- rtx new;
+ rtx new_rtx;
- new = *recog_data.operand_loc[i];
- recog_data.operand[i] = new;
+ new_rtx = *recog_data.operand_loc[i];
+ recog_data.operand[i] = new_rtx;
for (j = 0; j < recog_data.n_dups; j++)
if (recog_data.dup_num[j] == i)
- validate_unshare_change (insn, recog_data.dup_loc[j], new, 1);
+ validate_unshare_change (insn, recog_data.dup_loc[j], new_rtx, 1);
any_replacements = true;
}
diff --git a/gcc/reload.c b/gcc/reload.c
index 5a128f9fb81..5a79c44e874 100644
--- a/gcc/reload.c
+++ b/gcc/reload.c
@@ -319,7 +319,7 @@ push_secondary_reload (int in_p, rtx x, int opnum, int optional,
enum machine_mode reload_mode, enum reload_type type,
enum insn_code *picode, secondary_reload_info *prev_sri)
{
- enum reg_class class = NO_REGS;
+ enum reg_class rclass = NO_REGS;
enum reg_class scratch_class;
enum machine_mode mode = reload_mode;
enum insn_code icode = CODE_FOR_nothing;
@@ -362,15 +362,15 @@ push_secondary_reload (int in_p, rtx x, int opnum, int optional,
sri.icode = CODE_FOR_nothing;
sri.prev_sri = prev_sri;
- class = targetm.secondary_reload (in_p, x, reload_class, reload_mode, &sri);
+ rclass = targetm.secondary_reload (in_p, x, reload_class, reload_mode, &sri);
icode = sri.icode;
/* If we don't need any secondary registers, done. */
- if (class == NO_REGS && icode == CODE_FOR_nothing)
+ if (rclass == NO_REGS && icode == CODE_FOR_nothing)
return -1;
- if (class != NO_REGS)
- t_reload = push_secondary_reload (in_p, x, opnum, optional, class,
+ if (rclass != NO_REGS)
+ t_reload = push_secondary_reload (in_p, x, opnum, optional, rclass,
reload_mode, type, &t_icode, &sri);
/* If we will be using an insn, the secondary reload is for a
@@ -392,7 +392,7 @@ push_secondary_reload (int in_p, rtx x, int opnum, int optional,
an icode to reload from an intermediate tertiary reload register.
We should probably have a new field in struct reload to tag a
chain of scratch operand reloads onto. */
- gcc_assert (class == NO_REGS);
+ gcc_assert (rclass == NO_REGS);
scratch_constraint = insn_data[(int) icode].operand[2].constraint;
gcc_assert (*scratch_constraint == '=');
@@ -404,7 +404,7 @@ push_secondary_reload (int in_p, rtx x, int opnum, int optional,
: REG_CLASS_FROM_CONSTRAINT ((unsigned char) letter,
scratch_constraint));
- class = scratch_class;
+ rclass = scratch_class;
mode = insn_data[(int) icode].operand[2].mode;
}
@@ -422,21 +422,21 @@ push_secondary_reload (int in_p, rtx x, int opnum, int optional,
Allow this when a reload_in/out pattern is being used. I.e. assume
that the generated code handles this case. */
- gcc_assert (!in_p || class != reload_class || icode != CODE_FOR_nothing
+ gcc_assert (!in_p || rclass != reload_class || icode != CODE_FOR_nothing
|| t_icode != CODE_FOR_nothing);
/* See if we can reuse an existing secondary reload. */
for (s_reload = 0; s_reload < n_reloads; s_reload++)
if (rld[s_reload].secondary_p
- && (reg_class_subset_p (class, rld[s_reload].class)
- || reg_class_subset_p (rld[s_reload].class, class))
+ && (reg_class_subset_p (rclass, rld[s_reload].rclass)
+ || reg_class_subset_p (rld[s_reload].rclass, rclass))
&& ((in_p && rld[s_reload].inmode == mode)
|| (! in_p && rld[s_reload].outmode == mode))
&& ((in_p && rld[s_reload].secondary_in_reload == t_reload)
|| (! in_p && rld[s_reload].secondary_out_reload == t_reload))
&& ((in_p && rld[s_reload].secondary_in_icode == t_icode)
|| (! in_p && rld[s_reload].secondary_out_icode == t_icode))
- && (SMALL_REGISTER_CLASS_P (class) || SMALL_REGISTER_CLASSES)
+ && (SMALL_REGISTER_CLASS_P (rclass) || SMALL_REGISTER_CLASSES)
&& MERGABLE_RELOADS (secondary_type, rld[s_reload].when_needed,
opnum, rld[s_reload].opnum))
{
@@ -445,8 +445,8 @@ push_secondary_reload (int in_p, rtx x, int opnum, int optional,
if (! in_p)
rld[s_reload].outmode = mode;
- if (reg_class_subset_p (class, rld[s_reload].class))
- rld[s_reload].class = class;
+ if (reg_class_subset_p (rclass, rld[s_reload].rclass))
+ rld[s_reload].rclass = rclass;
rld[s_reload].opnum = MIN (rld[s_reload].opnum, opnum);
rld[s_reload].optional &= optional;
@@ -467,7 +467,7 @@ push_secondary_reload (int in_p, rtx x, int opnum, int optional,
way reloads are output. */
if (in_p && icode == CODE_FOR_nothing
- && SECONDARY_MEMORY_NEEDED (class, reload_class, mode))
+ && SECONDARY_MEMORY_NEEDED (rclass, reload_class, mode))
{
get_secondary_mem (x, reload_mode, opnum, type);
@@ -479,7 +479,7 @@ push_secondary_reload (int in_p, rtx x, int opnum, int optional,
/* We need to make a new secondary reload for this register class. */
rld[s_reload].in = rld[s_reload].out = 0;
- rld[s_reload].class = class;
+ rld[s_reload].rclass = rclass;
rld[s_reload].inmode = in_p ? mode : VOIDmode;
rld[s_reload].outmode = ! in_p ? mode : VOIDmode;
@@ -503,7 +503,7 @@ push_secondary_reload (int in_p, rtx x, int opnum, int optional,
#ifdef SECONDARY_MEMORY_NEEDED
if (! in_p && icode == CODE_FOR_nothing
- && SECONDARY_MEMORY_NEEDED (reload_class, class, mode))
+ && SECONDARY_MEMORY_NEEDED (reload_class, rclass, mode))
get_secondary_mem (x, mode, opnum, type);
#endif
}
@@ -516,7 +516,7 @@ push_secondary_reload (int in_p, rtx x, int opnum, int optional,
register and a scratch register is needed, we return the class of the
intermediate register. */
enum reg_class
-secondary_reload_class (bool in_p, enum reg_class class,
+secondary_reload_class (bool in_p, enum reg_class rclass,
enum machine_mode mode, rtx x)
{
enum insn_code icode;
@@ -524,13 +524,13 @@ secondary_reload_class (bool in_p, enum reg_class class,
sri.icode = CODE_FOR_nothing;
sri.prev_sri = NULL;
- class = targetm.secondary_reload (in_p, x, class, mode, &sri);
+ rclass = targetm.secondary_reload (in_p, x, rclass, mode, &sri);
icode = sri.icode;
/* If there are no secondary reloads at all, we return NO_REGS.
If an intermediate register is needed, we return its class. */
- if (icode == CODE_FOR_nothing || class != NO_REGS)
- return class;
+ if (icode == CODE_FOR_nothing || rclass != NO_REGS)
+ return rclass;
/* No intermediate register is needed, but we have a special reload
pattern, which we assume for now needs a scratch register. */
@@ -547,7 +547,7 @@ scratch_reload_class (enum insn_code icode)
{
const char *scratch_constraint;
char scratch_letter;
- enum reg_class class;
+ enum reg_class rclass;
gcc_assert (insn_data[(int) icode].n_operands == 3);
scratch_constraint = insn_data[(int) icode].operand[2].constraint;
@@ -558,10 +558,10 @@ scratch_reload_class (enum insn_code icode)
scratch_letter = *scratch_constraint;
if (scratch_letter == 'r')
return GENERAL_REGS;
- class = REG_CLASS_FROM_CONSTRAINT ((unsigned char) scratch_letter,
+ rclass = REG_CLASS_FROM_CONSTRAINT ((unsigned char) scratch_letter,
scratch_constraint);
- gcc_assert (class != NO_REGS);
- return class;
+ gcc_assert (rclass != NO_REGS);
+ return rclass;
}
#ifdef SECONDARY_MEMORY_NEEDED
@@ -660,24 +660,24 @@ find_valid_class (enum machine_mode outer ATTRIBUTE_UNUSED,
unsigned int dest_regno ATTRIBUTE_UNUSED)
{
int best_cost = -1;
- int class;
+ int rclass;
int regno;
enum reg_class best_class = NO_REGS;
enum reg_class dest_class ATTRIBUTE_UNUSED = REGNO_REG_CLASS (dest_regno);
unsigned int best_size = 0;
int cost;
- for (class = 1; class < N_REG_CLASSES; class++)
+ for (rclass = 1; rclass < N_REG_CLASSES; rclass++)
{
int bad = 0;
int good = 0;
for (regno = 0; regno < FIRST_PSEUDO_REGISTER - n && ! bad; regno++)
- if (TEST_HARD_REG_BIT (reg_class_contents[class], regno))
+ if (TEST_HARD_REG_BIT (reg_class_contents[rclass], regno))
{
if (HARD_REGNO_MODE_OK (regno, inner))
{
good = 1;
- if (! TEST_HARD_REG_BIT (reg_class_contents[class], regno + n)
+ if (! TEST_HARD_REG_BIT (reg_class_contents[rclass], regno + n)
|| ! HARD_REGNO_MODE_OK (regno + n, outer))
bad = 1;
}
@@ -685,15 +685,15 @@ find_valid_class (enum machine_mode outer ATTRIBUTE_UNUSED,
if (bad || !good)
continue;
- cost = REGISTER_MOVE_COST (outer, class, dest_class);
+ cost = REGISTER_MOVE_COST (outer, rclass, dest_class);
- if ((reg_class_size[class] > best_size
+ if ((reg_class_size[rclass] > best_size
&& (best_cost < 0 || best_cost >= cost))
|| best_cost > cost)
{
- best_class = class;
- best_size = reg_class_size[class];
- best_cost = REGISTER_MOVE_COST (outer, class, dest_class);
+ best_class = rclass;
+ best_size = reg_class_size[rclass];
+ best_cost = REGISTER_MOVE_COST (outer, rclass, dest_class);
}
}
@@ -704,14 +704,14 @@ find_valid_class (enum machine_mode outer ATTRIBUTE_UNUSED,
/* Return the number of a previously made reload that can be combined with
a new one, or n_reloads if none of the existing reloads can be used.
- OUT, CLASS, TYPE and OPNUM are the same arguments as passed to
+ OUT, RCLASS, TYPE and OPNUM are the same arguments as passed to
push_reload, they determine the kind of the new reload that we try to
combine. P_IN points to the corresponding value of IN, which can be
modified by this function.
DONT_SHARE is nonzero if we can't share any input-only reload for IN. */
static int
-find_reusable_reload (rtx *p_in, rtx out, enum reg_class class,
+find_reusable_reload (rtx *p_in, rtx out, enum reg_class rclass,
enum reload_type type, int opnum, int dont_share)
{
rtx in = *p_in;
@@ -732,18 +732,18 @@ find_reusable_reload (rtx *p_in, rtx out, enum reg_class class,
than we otherwise would. */
for (i = 0; i < n_reloads; i++)
- if ((reg_class_subset_p (class, rld[i].class)
- || reg_class_subset_p (rld[i].class, class))
+ if ((reg_class_subset_p (rclass, rld[i].rclass)
+ || reg_class_subset_p (rld[i].rclass, rclass))
/* If the existing reload has a register, it must fit our class. */
&& (rld[i].reg_rtx == 0
- || TEST_HARD_REG_BIT (reg_class_contents[(int) class],
+ || TEST_HARD_REG_BIT (reg_class_contents[(int) rclass],
true_regnum (rld[i].reg_rtx)))
&& ((in != 0 && MATCHES (rld[i].in, in) && ! dont_share
&& (out == 0 || rld[i].out == 0 || MATCHES (rld[i].out, out)))
|| (out != 0 && MATCHES (rld[i].out, out)
&& (in == 0 || rld[i].in == 0 || MATCHES (rld[i].in, in))))
&& (rld[i].out == 0 || ! earlyclobber_operand_p (rld[i].out))
- && (SMALL_REGISTER_CLASS_P (class) || SMALL_REGISTER_CLASSES)
+ && (SMALL_REGISTER_CLASS_P (rclass) || SMALL_REGISTER_CLASSES)
&& MERGABLE_RELOADS (type, rld[i].when_needed, opnum, rld[i].opnum))
return i;
@@ -753,12 +753,12 @@ find_reusable_reload (rtx *p_in, rtx out, enum reg_class class,
the preincrementation as happening before any ref in this insn
to that register. */
for (i = 0; i < n_reloads; i++)
- if ((reg_class_subset_p (class, rld[i].class)
- || reg_class_subset_p (rld[i].class, class))
+ if ((reg_class_subset_p (rclass, rld[i].rclass)
+ || reg_class_subset_p (rld[i].rclass, rclass))
/* If the existing reload has a register, it must fit our
class. */
&& (rld[i].reg_rtx == 0
- || TEST_HARD_REG_BIT (reg_class_contents[(int) class],
+ || TEST_HARD_REG_BIT (reg_class_contents[(int) rclass],
true_regnum (rld[i].reg_rtx)))
&& out == 0 && rld[i].out == 0 && rld[i].in != 0
&& ((REG_P (in)
@@ -768,7 +768,7 @@ find_reusable_reload (rtx *p_in, rtx out, enum reg_class class,
&& GET_RTX_CLASS (GET_CODE (in)) == RTX_AUTOINC
&& MATCHES (XEXP (in, 0), rld[i].in)))
&& (rld[i].out == 0 || ! earlyclobber_operand_p (rld[i].out))
- && (SMALL_REGISTER_CLASS_P (class) || SMALL_REGISTER_CLASSES)
+ && (SMALL_REGISTER_CLASS_P (rclass) || SMALL_REGISTER_CLASSES)
&& MERGABLE_RELOADS (type, rld[i].when_needed,
opnum, rld[i].opnum))
{
@@ -878,7 +878,7 @@ can_reload_into (rtx in, int regno, enum machine_mode mode)
If IN and OUT are both nonzero, it means the same register must be used
to reload both IN and OUT.
- CLASS is a register class required for the reloaded data.
+ RCLASS is a register class required for the reloaded data.
INMODE is the machine mode that the instruction requires
for the reg that replaces IN and OUTMODE is likewise for OUT.
@@ -904,7 +904,7 @@ can_reload_into (rtx in, int regno, enum machine_mode mode)
int
push_reload (rtx in, rtx out, rtx *inloc, rtx *outloc,
- enum reg_class class, enum machine_mode inmode,
+ enum reg_class rclass, enum machine_mode inmode,
enum machine_mode outmode, int strict_low, int optional,
int opnum, enum reload_type type)
{
@@ -1003,7 +1003,7 @@ push_reload (rtx in, rtx out, rtx *inloc, rtx *outloc,
if (in != 0 && GET_CODE (in) == SUBREG
&& (subreg_lowpart_p (in) || strict_low)
#ifdef CANNOT_CHANGE_MODE_CLASS
- && !CANNOT_CHANGE_MODE_CLASS (GET_MODE (SUBREG_REG (in)), inmode, class)
+ && !CANNOT_CHANGE_MODE_CLASS (GET_MODE (SUBREG_REG (in)), inmode, rclass)
#endif
&& (CONSTANT_P (SUBREG_REG (in))
|| GET_CODE (SUBREG_REG (in)) == PLUS
@@ -1043,8 +1043,8 @@ push_reload (rtx in, rtx out, rtx *inloc, rtx *outloc,
!= (int) hard_regno_nregs[REGNO (SUBREG_REG (in))]
[GET_MODE (SUBREG_REG (in))]))
|| ! HARD_REGNO_MODE_OK (subreg_regno (in), inmode)))
- || (secondary_reload_class (1, class, inmode, in) != NO_REGS
- && (secondary_reload_class (1, class, GET_MODE (SUBREG_REG (in)),
+ || (secondary_reload_class (1, rclass, inmode, in) != NO_REGS
+ && (secondary_reload_class (1, rclass, GET_MODE (SUBREG_REG (in)),
SUBREG_REG (in))
== NO_REGS))
#ifdef CANNOT_CHANGE_MODE_CLASS
@@ -1079,7 +1079,7 @@ push_reload (rtx in, rtx out, rtx *inloc, rtx *outloc,
if (in != 0 && reload_inner_reg_of_subreg (in, inmode, 0))
{
- enum reg_class in_class = class;
+ enum reg_class in_class = rclass;
if (REG_P (SUBREG_REG (in)))
in_class
@@ -1109,7 +1109,7 @@ push_reload (rtx in, rtx out, rtx *inloc, rtx *outloc,
if (out != 0 && GET_CODE (out) == SUBREG
&& (subreg_lowpart_p (out) || strict_low)
#ifdef CANNOT_CHANGE_MODE_CLASS
- && !CANNOT_CHANGE_MODE_CLASS (GET_MODE (SUBREG_REG (out)), outmode, class)
+ && !CANNOT_CHANGE_MODE_CLASS (GET_MODE (SUBREG_REG (out)), outmode, rclass)
#endif
&& (CONSTANT_P (SUBREG_REG (out))
|| strict_low
@@ -1136,8 +1136,8 @@ push_reload (rtx in, rtx out, rtx *inloc, rtx *outloc,
!= (int) hard_regno_nregs[REGNO (SUBREG_REG (out))]
[GET_MODE (SUBREG_REG (out))]))
|| ! HARD_REGNO_MODE_OK (subreg_regno (out), outmode)))
- || (secondary_reload_class (0, class, outmode, out) != NO_REGS
- && (secondary_reload_class (0, class, GET_MODE (SUBREG_REG (out)),
+ || (secondary_reload_class (0, rclass, outmode, out) != NO_REGS
+ && (secondary_reload_class (0, rclass, GET_MODE (SUBREG_REG (out)),
SUBREG_REG (out))
== NO_REGS))
#ifdef CANNOT_CHANGE_MODE_CLASS
@@ -1211,10 +1211,10 @@ push_reload (rtx in, rtx out, rtx *inloc, rtx *outloc,
/* Narrow down the class of register wanted if that is
desirable on this machine for efficiency. */
{
- enum reg_class preferred_class = class;
+ enum reg_class preferred_class = rclass;
if (in != 0)
- preferred_class = PREFERRED_RELOAD_CLASS (in, class);
+ preferred_class = PREFERRED_RELOAD_CLASS (in, rclass);
/* Output reloads may need analogous treatment, different in detail. */
#ifdef PREFERRED_OUTPUT_RELOAD_CLASS
@@ -1225,7 +1225,7 @@ push_reload (rtx in, rtx out, rtx *inloc, rtx *outloc,
/* Discard what the target said if we cannot do it. */
if (preferred_class != NO_REGS
|| (optional && type == RELOAD_FOR_OUTPUT))
- class = preferred_class;
+ rclass = preferred_class;
}
/* Make sure we use a class that can handle the actual pseudo
@@ -1234,14 +1234,14 @@ push_reload (rtx in, rtx out, rtx *inloc, rtx *outloc,
can handle SImode, QImode needs a smaller class. */
#ifdef LIMIT_RELOAD_CLASS
if (in_subreg_loc)
- class = LIMIT_RELOAD_CLASS (inmode, class);
+ rclass = LIMIT_RELOAD_CLASS (inmode, rclass);
else if (in != 0 && GET_CODE (in) == SUBREG)
- class = LIMIT_RELOAD_CLASS (GET_MODE (SUBREG_REG (in)), class);
+ rclass = LIMIT_RELOAD_CLASS (GET_MODE (SUBREG_REG (in)), rclass);
if (out_subreg_loc)
- class = LIMIT_RELOAD_CLASS (outmode, class);
+ rclass = LIMIT_RELOAD_CLASS (outmode, rclass);
if (out != 0 && GET_CODE (out) == SUBREG)
- class = LIMIT_RELOAD_CLASS (GET_MODE (SUBREG_REG (out)), class);
+ rclass = LIMIT_RELOAD_CLASS (GET_MODE (SUBREG_REG (out)), rclass);
#endif
/* Verify that this class is at least possible for the mode that
@@ -1265,7 +1265,7 @@ push_reload (rtx in, rtx out, rtx *inloc, rtx *outloc,
}
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
if (HARD_REGNO_MODE_OK (i, mode)
- && in_hard_reg_set_p (reg_class_contents[(int) class], mode, i))
+ && in_hard_reg_set_p (reg_class_contents[(int) rclass], mode, i))
break;
if (i == FIRST_PSEUDO_REGISTER)
{
@@ -1290,10 +1290,10 @@ push_reload (rtx in, rtx out, rtx *inloc, rtx *outloc,
/* Optional output reloads are always OK even if we have no register class,
since the function of these reloads is only to have spill_reg_store etc.
set, so that the storing insn can be deleted later. */
- gcc_assert (class != NO_REGS
+ gcc_assert (rclass != NO_REGS
|| (optional != 0 && type == RELOAD_FOR_OUTPUT));
- i = find_reusable_reload (&in, out, class, type, opnum, dont_share);
+ i = find_reusable_reload (&in, out, rclass, type, opnum, dont_share);
if (i == n_reloads)
{
@@ -1303,11 +1303,11 @@ push_reload (rtx in, rtx out, rtx *inloc, rtx *outloc,
if (in != 0)
secondary_in_reload
- = push_secondary_reload (1, in, opnum, optional, class, inmode, type,
+ = push_secondary_reload (1, in, opnum, optional, rclass, inmode, type,
&secondary_in_icode, NULL);
if (out != 0 && GET_CODE (out) != SCRATCH)
secondary_out_reload
- = push_secondary_reload (0, out, opnum, optional, class, outmode,
+ = push_secondary_reload (0, out, opnum, optional, rclass, outmode,
type, &secondary_out_icode, NULL);
/* We found no existing reload suitable for re-use.
@@ -1320,14 +1320,14 @@ push_reload (rtx in, rtx out, rtx *inloc, rtx *outloc,
|| (GET_CODE (in) == SUBREG && REG_P (SUBREG_REG (in))))
&& reg_or_subregno (in) < FIRST_PSEUDO_REGISTER
&& SECONDARY_MEMORY_NEEDED (REGNO_REG_CLASS (reg_or_subregno (in)),
- class, inmode))
+ rclass, inmode))
get_secondary_mem (in, inmode, opnum, type);
#endif
i = n_reloads;
rld[i].in = in;
rld[i].out = out;
- rld[i].class = class;
+ rld[i].rclass = rclass;
rld[i].inmode = inmode;
rld[i].outmode = outmode;
rld[i].reg_rtx = 0;
@@ -1351,7 +1351,7 @@ push_reload (rtx in, rtx out, rtx *inloc, rtx *outloc,
&& (REG_P (out)
|| (GET_CODE (out) == SUBREG && REG_P (SUBREG_REG (out))))
&& reg_or_subregno (out) < FIRST_PSEUDO_REGISTER
- && SECONDARY_MEMORY_NEEDED (class,
+ && SECONDARY_MEMORY_NEEDED (rclass,
REGNO_REG_CLASS (reg_or_subregno (out)),
outmode))
get_secondary_mem (out, outmode, opnum, type);
@@ -1403,16 +1403,39 @@ push_reload (rtx in, rtx out, rtx *inloc, rtx *outloc,
else
remove_address_replacements (rld[i].in);
}
- rld[i].in = in;
- rld[i].in_reg = in_reg;
+ /* When emitting reloads we don't necessarily look at the in-
+ and outmode, but also directly at the operands (in and out).
+ So we can't simply overwrite them with whatever we have found
+ for this (to-be-merged) reload, we have to "merge" that too.
+ Reusing another reload already verified that we deal with the
+ same operands, just possibly in different modes. So we
+ overwrite the operands only when the new mode is larger.
+ See also PR33613. */
+ if (!rld[i].in
+ || GET_MODE_SIZE (GET_MODE (in))
+ > GET_MODE_SIZE (GET_MODE (rld[i].in)))
+ rld[i].in = in;
+ if (!rld[i].in_reg
+ || (in_reg
+ && GET_MODE_SIZE (GET_MODE (in_reg))
+ > GET_MODE_SIZE (GET_MODE (rld[i].in_reg))))
+ rld[i].in_reg = in_reg;
}
if (out != 0)
{
- rld[i].out = out;
- rld[i].out_reg = outloc ? *outloc : 0;
+ if (!rld[i].out
+ || (out
+ && GET_MODE_SIZE (GET_MODE (out))
+ > GET_MODE_SIZE (GET_MODE (rld[i].out))))
+ rld[i].out = out;
+ if (outloc
+ && (!rld[i].out_reg
+ || GET_MODE_SIZE (GET_MODE (*outloc))
+ > GET_MODE_SIZE (GET_MODE (rld[i].out_reg))))
+ rld[i].out_reg = *outloc;
}
- if (reg_class_subset_p (class, rld[i].class))
- rld[i].class = class;
+ if (reg_class_subset_p (rclass, rld[i].rclass))
+ rld[i].rclass = rclass;
rld[i].optional &= optional;
if (MERGE_TO_OTHER (type, rld[i].when_needed,
opnum, rld[i].opnum))
@@ -1484,7 +1507,7 @@ push_reload (rtx in, rtx out, rtx *inloc, rtx *outloc,
{
rld[i].reg_rtx = find_dummy_reload (in, out, inloc, outloc,
inmode, outmode,
- rld[i].class, i,
+ rld[i].rclass, i,
earlyclobber_operand_p (out));
/* If the outgoing register already contains the same value
@@ -1561,7 +1584,7 @@ push_reload (rtx in, rtx out, rtx *inloc, rtx *outloc,
for (offs = 0; offs < nregs; offs++)
if (fixed_regs[regno + offs]
- || ! TEST_HARD_REG_BIT (reg_class_contents[(int) class],
+ || ! TEST_HARD_REG_BIT (reg_class_contents[(int) rclass],
regno + offs))
break;
@@ -1730,8 +1753,8 @@ combine_reloads (void)
&& rld[i].when_needed != RELOAD_FOR_OUTPUT_ADDRESS
&& rld[i].when_needed != RELOAD_FOR_OUTADDR_ADDRESS
&& rld[i].when_needed != RELOAD_OTHER
- && (CLASS_MAX_NREGS (rld[i].class, rld[i].inmode)
- == CLASS_MAX_NREGS (rld[output_reload].class,
+ && (CLASS_MAX_NREGS (rld[i].rclass, rld[i].inmode)
+ == CLASS_MAX_NREGS (rld[output_reload].rclass,
rld[output_reload].outmode))
&& rld[i].inc == 0
&& rld[i].reg_rtx == 0
@@ -1744,11 +1767,11 @@ combine_reloads (void)
secondary_memlocs_elim[(int) rld[output_reload].outmode][rld[output_reload].opnum]))
#endif
&& (SMALL_REGISTER_CLASSES
- ? (rld[i].class == rld[output_reload].class)
- : (reg_class_subset_p (rld[i].class,
- rld[output_reload].class)
- || reg_class_subset_p (rld[output_reload].class,
- rld[i].class)))
+ ? (rld[i].rclass == rld[output_reload].rclass)
+ : (reg_class_subset_p (rld[i].rclass,
+ rld[output_reload].rclass)
+ || reg_class_subset_p (rld[output_reload].rclass,
+ rld[i].rclass)))
&& (MATCHES (rld[i].in, rld[output_reload].out)
/* Args reversed because the first arg seems to be
the one that we imagine being modified
@@ -1766,7 +1789,7 @@ combine_reloads (void)
rld[output_reload].out))))
&& ! reload_inner_reg_of_subreg (rld[i].in, rld[i].inmode,
rld[i].when_needed != RELOAD_FOR_INPUT)
- && (reg_class_size[(int) rld[i].class]
+ && (reg_class_size[(int) rld[i].rclass]
|| SMALL_REGISTER_CLASSES)
/* We will allow making things slightly worse by combining an
input and an output, but no worse than that. */
@@ -1799,9 +1822,9 @@ combine_reloads (void)
= secondary_memlocs_elim[(int) rld[output_reload].outmode][rld[output_reload].opnum];
#endif
/* If required, minimize the register class. */
- if (reg_class_subset_p (rld[output_reload].class,
- rld[i].class))
- rld[i].class = rld[output_reload].class;
+ if (reg_class_subset_p (rld[output_reload].rclass,
+ rld[i].rclass))
+ rld[i].rclass = rld[output_reload].rclass;
/* Transfer all replacements from the old reload to the combined. */
for (j = 0; j < n_replacements; j++)
@@ -1835,7 +1858,7 @@ combine_reloads (void)
rld[output_reload].out)
&& (regno = REGNO (XEXP (note, 0))) < FIRST_PSEUDO_REGISTER
&& HARD_REGNO_MODE_OK (regno, rld[output_reload].outmode)
- && TEST_HARD_REG_BIT (reg_class_contents[(int) rld[output_reload].class],
+ && TEST_HARD_REG_BIT (reg_class_contents[(int) rld[output_reload].rclass],
regno)
&& (hard_regno_nregs[regno][rld[output_reload].outmode]
<= hard_regno_nregs[regno][GET_MODE (XEXP (note, 0))])
@@ -1843,10 +1866,10 @@ combine_reloads (void)
won't want this register. */
&& ((secondary_out = rld[output_reload].secondary_out_reload) == -1
|| (!(TEST_HARD_REG_BIT
- (reg_class_contents[(int) rld[secondary_out].class], regno))
+ (reg_class_contents[(int) rld[secondary_out].rclass], regno))
&& ((secondary_out = rld[secondary_out].secondary_out_reload) == -1
|| !(TEST_HARD_REG_BIT
- (reg_class_contents[(int) rld[secondary_out].class],
+ (reg_class_contents[(int) rld[secondary_out].rclass],
regno)))))
&& !fixed_regs[regno]
/* Check that a former pseudo is valid; see find_dummy_reload. */
@@ -1867,7 +1890,7 @@ combine_reloads (void)
If so, return the register rtx that proves acceptable.
INLOC and OUTLOC are locations where IN and OUT appear in the insn.
- CLASS is the register class required for the reload.
+ RCLASS is the register class required for the reload.
If FOR_REAL is >= 0, it is the number of the reload,
and in some cases when it can be discovered that OUT doesn't need
@@ -1884,7 +1907,7 @@ combine_reloads (void)
static rtx
find_dummy_reload (rtx real_in, rtx real_out, rtx *inloc, rtx *outloc,
enum machine_mode inmode, enum machine_mode outmode,
- enum reg_class class, int for_real, int earlyclobber)
+ enum reg_class rclass, int for_real, int earlyclobber)
{
rtx in = real_in;
rtx out = real_out;
@@ -1927,9 +1950,9 @@ find_dummy_reload (rtx real_in, rtx real_out, rtx *inloc, rtx *outloc,
/* Narrow down the reg class, the same way push_reload will;
otherwise we might find a dummy now, but push_reload won't. */
{
- enum reg_class preferred_class = PREFERRED_RELOAD_CLASS (in, class);
+ enum reg_class preferred_class = PREFERRED_RELOAD_CLASS (in, rclass);
if (preferred_class != NO_REGS)
- class = preferred_class;
+ rclass = preferred_class;
}
/* See if OUT will do. */
@@ -1960,7 +1983,7 @@ find_dummy_reload (rtx real_in, rtx real_out, rtx *inloc, rtx *outloc,
unsigned int i;
for (i = 0; i < nwords; i++)
- if (! TEST_HARD_REG_BIT (reg_class_contents[(int) class],
+ if (! TEST_HARD_REG_BIT (reg_class_contents[(int) rclass],
regno + i))
break;
@@ -2028,7 +2051,7 @@ find_dummy_reload (rtx real_in, rtx real_out, rtx *inloc, rtx *outloc,
unsigned int i;
for (i = 0; i < nwords; i++)
- if (! TEST_HARD_REG_BIT (reg_class_contents[(int) class],
+ if (! TEST_HARD_REG_BIT (reg_class_contents[(int) rclass],
regno + i))
break;
@@ -3843,49 +3866,61 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known,
/* Any constants that aren't allowed and can't be reloaded
into registers are here changed into memory references. */
for (i = 0; i < noperands; i++)
- if (! goal_alternative_win[i]
- && CONST_POOL_OK_P (recog_data.operand[i])
- && ((PREFERRED_RELOAD_CLASS (recog_data.operand[i],
- (enum reg_class) goal_alternative[i])
- == NO_REGS)
- || no_input_reloads)
- && operand_mode[i] != VOIDmode)
+ if (! goal_alternative_win[i])
{
- int this_address_reloaded;
+ rtx op = recog_data.operand[i];
+ rtx subreg = NULL_RTX;
+ rtx plus = NULL_RTX;
+ enum machine_mode mode = operand_mode[i];
+
+ /* Reloads of SUBREGs of CONSTANT RTXs are handled later in
+ push_reload so we have to let them pass here. */
+ if (GET_CODE (op) == SUBREG)
+ {
+ subreg = op;
+ op = SUBREG_REG (op);
+ mode = GET_MODE (op);
+ }
- this_address_reloaded = 0;
- substed_operand[i] = recog_data.operand[i]
- = find_reloads_toplev (force_const_mem (operand_mode[i],
- recog_data.operand[i]),
- i, address_type[i], ind_levels, 0, insn,
- &this_address_reloaded);
- if (alternative_allows_const_pool_ref (this_address_reloaded == 0
- ? substed_operand[i]
- : NULL,
- recog_data.constraints[i],
- goal_alternative_number))
- goal_alternative_win[i] = 1;
- }
+ if (GET_CODE (op) == PLUS)
+ {
+ plus = op;
+ op = XEXP (op, 1);
+ }
- /* Likewise any invalid constants appearing as operand of a PLUS
- that is to be reloaded. */
- for (i = 0; i < noperands; i++)
- if (! goal_alternative_win[i]
- && GET_CODE (recog_data.operand[i]) == PLUS
- && CONST_POOL_OK_P (XEXP (recog_data.operand[i], 1))
- && (PREFERRED_RELOAD_CLASS (XEXP (recog_data.operand[i], 1),
- (enum reg_class) goal_alternative[i])
- == NO_REGS)
- && operand_mode[i] != VOIDmode)
- {
- rtx tem = force_const_mem (operand_mode[i],
- XEXP (recog_data.operand[i], 1));
- tem = gen_rtx_PLUS (operand_mode[i],
- XEXP (recog_data.operand[i], 0), tem);
+ if (CONST_POOL_OK_P (op)
+ && ((PREFERRED_RELOAD_CLASS (op,
+ (enum reg_class) goal_alternative[i])
+ == NO_REGS)
+ || no_input_reloads)
+ && mode != VOIDmode)
+ {
+ int this_address_reloaded;
+ rtx tem = force_const_mem (mode, op);
- substed_operand[i] = recog_data.operand[i]
- = find_reloads_toplev (tem, i, address_type[i],
- ind_levels, 0, insn, NULL);
+ /* If we stripped a SUBREG or a PLUS above add it back. */
+ if (plus != NULL_RTX)
+ tem = gen_rtx_PLUS (mode, XEXP (plus, 0), tem);
+
+ if (subreg != NULL_RTX)
+ tem = gen_rtx_SUBREG (operand_mode[i], tem, SUBREG_BYTE (subreg));
+
+ this_address_reloaded = 0;
+ substed_operand[i] = recog_data.operand[i]
+ = find_reloads_toplev (tem, i, address_type[i], ind_levels,
+ 0, insn, &this_address_reloaded);
+
+ /* If the alternative accepts constant pool refs directly
+ there will be no reload needed at all. */
+ if (plus == NULL_RTX
+ && subreg == NULL_RTX
+ && alternative_allows_const_pool_ref (this_address_reloaded == 0
+ ? substed_operand[i]
+ : NULL,
+ recog_data.constraints[i],
+ goal_alternative_number))
+ goal_alternative_win[i] = 1;
+ }
}
/* Record the values of the earlyclobber operands for the caller. */
@@ -4184,7 +4219,7 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known,
&& rld[i].out == 0)
{
rld[i].reg_rtx
- = find_equiv_reg (rld[i].in, insn, rld[i].class, -1,
+ = find_equiv_reg (rld[i].in, insn, rld[i].rclass, -1,
static_reload_reg_p, 0, rld[i].inmode);
/* Prevent generation of insn to load the value
because the one we found already has the value. */
@@ -4453,7 +4488,7 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known,
if (i != j && rld[j].in != 0 && rld[j].out == 0
&& rld[j].when_needed == rld[i].when_needed
&& MATCHES (rld[i].in, rld[j].in)
- && rld[i].class == rld[j].class
+ && rld[i].rclass == rld[j].rclass
&& !rld[i].nocombine && !rld[j].nocombine
&& rld[i].reg_rtx == rld[j].reg_rtx)
{
@@ -4482,7 +4517,7 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known,
> GET_MODE_SIZE (rld[i].inmode)))
? rld[i].outmode : rld[i].inmode;
- rld[i].nregs = CLASS_MAX_NREGS (rld[i].class, rld[i].mode);
+ rld[i].nregs = CLASS_MAX_NREGS (rld[i].rclass, rld[i].mode);
}
/* Special case a simple move with an input reload and a
@@ -4499,14 +4534,14 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known,
unsigned int regno = REGNO (dest);
if (regno < FIRST_PSEUDO_REGISTER
- && TEST_HARD_REG_BIT (reg_class_contents[rld[i].class], regno)
+ && TEST_HARD_REG_BIT (reg_class_contents[rld[i].rclass], regno)
&& HARD_REGNO_MODE_OK (regno, rld[i].mode))
{
int nr = hard_regno_nregs[regno][rld[i].mode];
int ok = 1, nri;
for (nri = 1; nri < nr; nri ++)
- if (! TEST_HARD_REG_BIT (reg_class_contents[rld[i].class], regno + nri))
+ if (! TEST_HARD_REG_BIT (reg_class_contents[rld[i].rclass], regno + nri))
ok = 0;
if (ok)
@@ -5916,14 +5951,14 @@ find_reloads_address_1 (enum machine_mode mode, rtx x, int context,
is larger than the class size, then reload the whole SUBREG. */
else
{
- enum reg_class class = context_reg_class;
- if ((unsigned) CLASS_MAX_NREGS (class, GET_MODE (SUBREG_REG (x)))
- > reg_class_size[class])
+ enum reg_class rclass = context_reg_class;
+ if ((unsigned) CLASS_MAX_NREGS (rclass, GET_MODE (SUBREG_REG (x)))
+ > reg_class_size[rclass])
{
x = find_reloads_subreg_address (x, 0, opnum,
ADDR_TYPE (type),
ind_levels, insn);
- push_reload (x, NULL_RTX, loc, (rtx*) 0, class,
+ push_reload (x, NULL_RTX, loc, (rtx*) 0, rclass,
GET_MODE (x), VOIDmode, 0, 0, opnum, type);
return 1;
}
@@ -5954,7 +5989,7 @@ find_reloads_address_1 (enum machine_mode mode, rtx x, int context,
}
/* X, which is found at *LOC, is a part of an address that needs to be
- reloaded into a register of class CLASS. If X is a constant, or if
+ reloaded into a register of class RCLASS. If X is a constant, or if
X is a PLUS that contains a constant, check that the constant is a
legitimate operand and that we are supposed to be able to load
it into the register.
@@ -5969,13 +6004,13 @@ find_reloads_address_1 (enum machine_mode mode, rtx x, int context,
supports. */
static void
-find_reloads_address_part (rtx x, rtx *loc, enum reg_class class,
+find_reloads_address_part (rtx x, rtx *loc, enum reg_class rclass,
enum machine_mode mode, int opnum,
enum reload_type type, int ind_levels)
{
if (CONSTANT_P (x)
&& (! LEGITIMATE_CONSTANT_P (x)
- || PREFERRED_RELOAD_CLASS (x, class) == NO_REGS))
+ || PREFERRED_RELOAD_CLASS (x, rclass) == NO_REGS))
{
x = force_const_mem (mode, x);
find_reloads_address (mode, &x, XEXP (x, 0), &XEXP (x, 0),
@@ -5985,7 +6020,7 @@ find_reloads_address_part (rtx x, rtx *loc, enum reg_class class,
else if (GET_CODE (x) == PLUS
&& CONSTANT_P (XEXP (x, 1))
&& (! LEGITIMATE_CONSTANT_P (XEXP (x, 1))
- || PREFERRED_RELOAD_CLASS (XEXP (x, 1), class) == NO_REGS))
+ || PREFERRED_RELOAD_CLASS (XEXP (x, 1), rclass) == NO_REGS))
{
rtx tem;
@@ -5995,7 +6030,7 @@ find_reloads_address_part (rtx x, rtx *loc, enum reg_class class,
opnum, type, ind_levels, 0);
}
- push_reload (x, NULL_RTX, loc, (rtx*) 0, class,
+ push_reload (x, NULL_RTX, loc, (rtx*) 0, rclass,
mode, VOIDmode, 0, 0, opnum, type);
}
@@ -6103,7 +6138,7 @@ find_reloads_subreg_address (rtx x, int force_replace, int opnum,
doesn't find any, then we may have just converted a
valid address into an invalid one. Check for that
here. */
- if (reloaded != 1
+ if (reloaded == 0
&& !strict_memory_address_p (GET_MODE (tem),
XEXP (tem, 0)))
push_reload (XEXP (tem, 0), NULL_RTX, &XEXP (tem, 0), (rtx*) 0,
@@ -6600,7 +6635,7 @@ refers_to_mem_for_reload_p (rtx x)
/* Check the insns before INSN to see if there is a suitable register
containing the same value as GOAL.
- If OTHER is -1, look for a register in class CLASS.
+ If OTHER is -1, look for a register in class RCLASS.
Otherwise, just see if register number OTHER shares GOAL's value.
Return an rtx for the register found, or zero if none is found.
@@ -6626,7 +6661,7 @@ refers_to_mem_for_reload_p (rtx x)
as if it were a constant except that sp is required to be unchanging. */
rtx
-find_equiv_reg (rtx goal, rtx insn, enum reg_class class, int other,
+find_equiv_reg (rtx goal, rtx insn, enum reg_class rclass, int other,
short *reload_reg_p, int goalreg, enum machine_mode mode)
{
rtx p = insn;
@@ -6772,7 +6807,7 @@ find_equiv_reg (rtx goal, rtx insn, enum reg_class class, int other,
}
else if ((unsigned) valueno >= FIRST_PSEUDO_REGISTER)
continue;
- else if (!in_hard_reg_set_p (reg_class_contents[(int) class],
+ else if (!in_hard_reg_set_p (reg_class_contents[(int) rclass],
mode, valueno))
continue;
value = valtry;
@@ -7262,7 +7297,7 @@ debug_reload_to_stream (FILE *f)
fprintf (f, "\n\t");
}
- fprintf (f, "%s, ", reg_class_names[(int) rld[r].class]);
+ fprintf (f, "%s, ", reg_class_names[(int) rld[r].rclass]);
fprintf (f, "%s (opnum = %d)",
reload_when_needed_name[(int) rld[r].when_needed],
diff --git a/gcc/reload.h b/gcc/reload.h
index bfa7e6a8996..3873f5c9746 100644
--- a/gcc/reload.h
+++ b/gcc/reload.h
@@ -83,7 +83,7 @@ struct reload
rtx out;
/* The class of registers to reload into. */
- enum reg_class class;
+ enum reg_class rclass;
/* The mode this operand should have when reloaded, on input. */
enum machine_mode inmode;
diff --git a/gcc/reload1.c b/gcc/reload1.c
index f449ffa9c32..3abd6b24e33 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -1637,8 +1637,8 @@ reload_reg_class_lower (const void *r1p, const void *r2p)
return t;
/* Count all solitary classes before non-solitary ones. */
- t = ((reg_class_size[(int) rld[r2].class] == 1)
- - (reg_class_size[(int) rld[r1].class] == 1));
+ t = ((reg_class_size[(int) rld[r2].rclass] == 1)
+ - (reg_class_size[(int) rld[r1].rclass] == 1));
if (t != 0)
return t;
@@ -1648,7 +1648,7 @@ reload_reg_class_lower (const void *r1p, const void *r2p)
return t;
/* Consider reloads in order of increasing reg-class number. */
- t = (int) rld[r1].class - (int) rld[r2].class;
+ t = (int) rld[r1].rclass - (int) rld[r2].rclass;
if (t != 0)
return t;
@@ -1777,7 +1777,7 @@ find_reg (struct insn_chain *chain, int order)
COPY_HARD_REG_SET (not_usable, bad_spill_regs);
IOR_HARD_REG_SET (not_usable, bad_spill_regs_global);
- IOR_COMPL_HARD_REG_SET (not_usable, reg_class_contents[rl->class]);
+ IOR_COMPL_HARD_REG_SET (not_usable, reg_class_contents[rl->rclass]);
CLEAR_HARD_REG_SET (used_by_other_reload);
for (k = 0; k < order; k++)
@@ -1918,7 +1918,7 @@ find_reload_regs (struct insn_chain *chain)
{
if (dump_file)
fprintf (dump_file, "reload failure for reload %d\n", r);
- spill_failure (chain->insn, rld[r].class);
+ spill_failure (chain->insn, rld[r].rclass);
failure = 1;
return;
}
@@ -1976,16 +1976,16 @@ delete_caller_save_insns (void)
INSN should be one of the insns which needed this particular spill reg. */
static void
-spill_failure (rtx insn, enum reg_class class)
+spill_failure (rtx insn, enum reg_class rclass)
{
if (asm_noperands (PATTERN (insn)) >= 0)
error_for_asm (insn, "can't find a register in class %qs while "
"reloading %<asm%>",
- reg_class_names[class]);
+ reg_class_names[rclass]);
else
{
error ("unable to find a register to spill in class %qs",
- reg_class_names[class]);
+ reg_class_names[rclass]);
if (dump_file)
{
@@ -2394,7 +2394,7 @@ eliminate_regs_1 (rtx x, enum machine_mode mem_mode, rtx insn,
enum rtx_code code = GET_CODE (x);
struct elim_table *ep;
int regno;
- rtx new;
+ rtx new_rtx;
int i, j;
const char *fmt;
int copied = 0;
@@ -2523,15 +2523,15 @@ eliminate_regs_1 (rtx x, enum machine_mode mem_mode, rtx insn,
&& reg_equiv_constant[REGNO (new0)] != 0)
new0 = reg_equiv_constant[REGNO (new0)];
- new = form_sum (new0, new1);
+ new_rtx = form_sum (new0, new1);
/* As above, if we are not inside a MEM we do not want to
turn a PLUS into something else. We might try to do so here
for an addition of 0 if we aren't optimizing. */
- if (! mem_mode && GET_CODE (new) != PLUS)
- return gen_rtx_PLUS (GET_MODE (x), new, const0_rtx);
+ if (! mem_mode && GET_CODE (new_rtx) != PLUS)
+ return gen_rtx_PLUS (GET_MODE (x), new_rtx, const0_rtx);
else
- return new;
+ return new_rtx;
}
}
return x;
@@ -2588,8 +2588,8 @@ eliminate_regs_1 (rtx x, enum machine_mode mem_mode, rtx insn,
/* If we have something in XEXP (x, 0), the usual case, eliminate it. */
if (XEXP (x, 0))
{
- new = eliminate_regs_1 (XEXP (x, 0), mem_mode, insn, true);
- if (new != XEXP (x, 0))
+ new_rtx = eliminate_regs_1 (XEXP (x, 0), mem_mode, insn, true);
+ if (new_rtx != XEXP (x, 0))
{
/* If this is a REG_DEAD note, it is not valid anymore.
Using the eliminated version could result in creating a
@@ -2599,7 +2599,7 @@ eliminate_regs_1 (rtx x, enum machine_mode mem_mode, rtx insn,
? eliminate_regs_1 (XEXP (x, 1), mem_mode, insn, true)
: NULL_RTX);
- x = gen_rtx_EXPR_LIST (REG_NOTE_KIND (x), new, XEXP (x, 1));
+ x = gen_rtx_EXPR_LIST (REG_NOTE_KIND (x), new_rtx, XEXP (x, 1));
}
}
@@ -2611,10 +2611,10 @@ eliminate_regs_1 (rtx x, enum machine_mode mem_mode, rtx insn,
strictly needed, but it simplifies the code. */
if (XEXP (x, 1))
{
- new = eliminate_regs_1 (XEXP (x, 1), mem_mode, insn, true);
- if (new != XEXP (x, 1))
+ new_rtx = eliminate_regs_1 (XEXP (x, 1), mem_mode, insn, true);
+ if (new_rtx != XEXP (x, 1))
return
- gen_rtx_fmt_ee (GET_CODE (x), GET_MODE (x), XEXP (x, 0), new);
+ gen_rtx_fmt_ee (GET_CODE (x), GET_MODE (x), XEXP (x, 0), new_rtx);
}
return x;
@@ -2636,13 +2636,13 @@ eliminate_regs_1 (rtx x, enum machine_mode mem_mode, rtx insn,
if (GET_CODE (XEXP (x, 1)) == PLUS
&& XEXP (XEXP (x, 1), 0) == XEXP (x, 0))
{
- rtx new = eliminate_regs_1 (XEXP (XEXP (x, 1), 1), mem_mode,
+ rtx new_rtx = eliminate_regs_1 (XEXP (XEXP (x, 1), 1), mem_mode,
insn, true);
- if (new != XEXP (XEXP (x, 1), 1))
+ if (new_rtx != XEXP (XEXP (x, 1), 1))
return gen_rtx_fmt_ee (code, GET_MODE (x), XEXP (x, 0),
gen_rtx_PLUS (GET_MODE (x),
- XEXP (x, 0), new));
+ XEXP (x, 0), new_rtx));
}
return x;
@@ -2660,9 +2660,9 @@ eliminate_regs_1 (rtx x, enum machine_mode mem_mode, rtx insn,
case POPCOUNT:
case PARITY:
case BSWAP:
- new = eliminate_regs_1 (XEXP (x, 0), mem_mode, insn, false);
- if (new != XEXP (x, 0))
- return gen_rtx_fmt_e (code, GET_MODE (x), new);
+ new_rtx = eliminate_regs_1 (XEXP (x, 0), mem_mode, insn, false);
+ if (new_rtx != XEXP (x, 0))
+ return gen_rtx_fmt_e (code, GET_MODE (x), new_rtx);
return x;
case SUBREG:
@@ -2678,17 +2678,17 @@ eliminate_regs_1 (rtx x, enum machine_mode mem_mode, rtx insn,
&& reg_equiv_memory_loc != 0
&& reg_equiv_memory_loc[REGNO (SUBREG_REG (x))] != 0)
{
- new = SUBREG_REG (x);
+ new_rtx = SUBREG_REG (x);
}
else
- new = eliminate_regs_1 (SUBREG_REG (x), mem_mode, insn, false);
+ new_rtx = eliminate_regs_1 (SUBREG_REG (x), mem_mode, insn, false);
- if (new != SUBREG_REG (x))
+ if (new_rtx != SUBREG_REG (x))
{
int x_size = GET_MODE_SIZE (GET_MODE (x));
- int new_size = GET_MODE_SIZE (GET_MODE (new));
+ int new_size = GET_MODE_SIZE (GET_MODE (new_rtx));
- if (MEM_P (new)
+ if (MEM_P (new_rtx)
&& ((x_size < new_size
#ifdef WORD_REGISTER_OPERATIONS
/* On these machines, combine can create rtl of the form
@@ -2704,9 +2704,9 @@ eliminate_regs_1 (rtx x, enum machine_mode mem_mode, rtx insn,
)
|| x_size == new_size)
)
- return adjust_address_nv (new, GET_MODE (x), SUBREG_BYTE (x));
+ return adjust_address_nv (new_rtx, GET_MODE (x), SUBREG_BYTE (x));
else
- return gen_rtx_SUBREG (GET_MODE (x), new, SUBREG_BYTE (x));
+ return gen_rtx_SUBREG (GET_MODE (x), new_rtx, SUBREG_BYTE (x));
}
return x;
@@ -2722,9 +2722,9 @@ eliminate_regs_1 (rtx x, enum machine_mode mem_mode, rtx insn,
case USE:
/* Handle insn_list USE that a call to a pure function may generate. */
- new = eliminate_regs_1 (XEXP (x, 0), 0, insn, false);
- if (new != XEXP (x, 0))
- return gen_rtx_USE (GET_MODE (x), new);
+ new_rtx = eliminate_regs_1 (XEXP (x, 0), 0, insn, false);
+ if (new_rtx != XEXP (x, 0))
+ return gen_rtx_USE (GET_MODE (x), new_rtx);
return x;
case CLOBBER:
@@ -2743,21 +2743,21 @@ eliminate_regs_1 (rtx x, enum machine_mode mem_mode, rtx insn,
{
if (*fmt == 'e')
{
- new = eliminate_regs_1 (XEXP (x, i), mem_mode, insn, false);
- if (new != XEXP (x, i) && ! copied)
+ new_rtx = eliminate_regs_1 (XEXP (x, i), mem_mode, insn, false);
+ if (new_rtx != XEXP (x, i) && ! copied)
{
x = shallow_copy_rtx (x);
copied = 1;
}
- XEXP (x, i) = new;
+ XEXP (x, i) = new_rtx;
}
else if (*fmt == 'E')
{
int copied_vec = 0;
for (j = 0; j < XVECLEN (x, i); j++)
{
- new = eliminate_regs_1 (XVECEXP (x, i, j), mem_mode, insn, false);
- if (new != XVECEXP (x, i, j) && ! copied_vec)
+ new_rtx = eliminate_regs_1 (XVECEXP (x, i, j), mem_mode, insn, false);
+ if (new_rtx != XVECEXP (x, i, j) && ! copied_vec)
{
rtvec new_v = gen_rtvec_v (XVECLEN (x, i),
XVEC (x, i)->elem);
@@ -2769,7 +2769,7 @@ eliminate_regs_1 (rtx x, enum machine_mode mem_mode, rtx insn,
XVEC (x, i) = new_v;
copied_vec = 1;
}
- XVECEXP (x, i, j) = new;
+ XVECEXP (x, i, j) = new_rtx;
}
}
}
@@ -3663,8 +3663,11 @@ update_eliminables (HARD_REG_SET *pset)
frame_pointer_needed = 1;
for (ep = reg_eliminate; ep < &reg_eliminate[NUM_ELIMINABLE_REGS]; ep++)
{
- if (ep->can_eliminate && ep->from == FRAME_POINTER_REGNUM
- && ep->to != HARD_FRAME_POINTER_REGNUM)
+ if (ep->can_eliminate
+ && ep->from == FRAME_POINTER_REGNUM
+ && ep->to != HARD_FRAME_POINTER_REGNUM
+ && (! SUPPORTS_STACK_ALIGNMENT
+ || ! crtl->stack_realign_needed))
frame_pointer_needed = 0;
if (! ep->can_eliminate && ep->can_eliminate_previous)
@@ -3720,7 +3723,10 @@ init_elim_table (void)
ep->to = ep1->to;
ep->can_eliminate = ep->can_eliminate_previous
= (CAN_ELIMINATE (ep->from, ep->to)
- && ! (ep->to == STACK_POINTER_REGNUM && frame_pointer_needed));
+ && ! (ep->to == STACK_POINTER_REGNUM
+ && frame_pointer_needed
+ && (! SUPPORTS_STACK_ALIGNMENT
+ || ! stack_realign_fp)));
}
#else
reg_eliminate[0].from = reg_eliminate_1[0].from;
@@ -5474,7 +5480,7 @@ allocate_reload_reg (struct insn_chain *chain ATTRIBUTE_UNUSED, int r,
for (count = 0; count < n_spills; count++)
{
- int class = (int) rld[r].class;
+ int rclass = (int) rld[r].rclass;
int regnum;
i++;
@@ -5491,7 +5497,7 @@ allocate_reload_reg (struct insn_chain *chain ATTRIBUTE_UNUSED, int r,
&& free_for_value_p (regnum, rld[r].mode, rld[r].opnum,
rld[r].when_needed, rld[r].in,
rld[r].out, r, 1)))
- && TEST_HARD_REG_BIT (reg_class_contents[class], regnum)
+ && TEST_HARD_REG_BIT (reg_class_contents[rclass], regnum)
&& HARD_REGNO_MODE_OK (regnum, rld[r].mode)
/* Look first for regs to share, then for unshared. But
don't share regs used for inherited reloads; they are
@@ -5521,7 +5527,7 @@ allocate_reload_reg (struct insn_chain *chain ATTRIBUTE_UNUSED, int r,
while (nr > 1)
{
int regno = regnum + nr - 1;
- if (!(TEST_HARD_REG_BIT (reg_class_contents[class], regno)
+ if (!(TEST_HARD_REG_BIT (reg_class_contents[rclass], regno)
&& spill_reg_order[regno] >= 0
&& reload_reg_free_p (regno, rld[r].opnum,
rld[r].when_needed)))
@@ -5647,7 +5653,7 @@ choose_reload_regs (struct insn_chain *chain)
{
max_group_size = MAX (rld[j].nregs, max_group_size);
group_class
- = reg_class_superunion[(int) rld[j].class][(int) group_class];
+ = reg_class_superunion[(int) rld[j].rclass][(int) group_class];
}
save_reload_reg_rtx[j] = rld[j].reg_rtx;
@@ -5793,7 +5799,7 @@ choose_reload_regs (struct insn_chain *chain)
#endif
)
{
- enum reg_class class = rld[r].class, last_class;
+ enum reg_class rclass = rld[r].rclass, last_class;
rtx last_reg = reg_last_reload_reg[regno];
enum machine_mode need_mode;
@@ -5814,18 +5820,18 @@ choose_reload_regs (struct insn_chain *chain)
&& reg_reloaded_contents[i] == regno
&& TEST_HARD_REG_BIT (reg_reloaded_valid, i)
&& HARD_REGNO_MODE_OK (i, rld[r].mode)
- && (TEST_HARD_REG_BIT (reg_class_contents[(int) class], i)
+ && (TEST_HARD_REG_BIT (reg_class_contents[(int) rclass], i)
/* Even if we can't use this register as a reload
register, we might use it for reload_override_in,
if copying it to the desired class is cheap
enough. */
- || ((REGISTER_MOVE_COST (mode, last_class, class)
- < MEMORY_MOVE_COST (mode, class, 1))
- && (secondary_reload_class (1, class, mode,
+ || ((REGISTER_MOVE_COST (mode, last_class, rclass)
+ < MEMORY_MOVE_COST (mode, rclass, 1))
+ && (secondary_reload_class (1, rclass, mode,
last_reg)
== NO_REGS)
#ifdef SECONDARY_MEMORY_NEEDED
- && ! SECONDARY_MEMORY_NEEDED (last_class, class,
+ && ! SECONDARY_MEMORY_NEEDED (last_class, rclass,
mode)
#endif
))
@@ -5857,7 +5863,7 @@ choose_reload_regs (struct insn_chain *chain)
bad_for_class = 0;
for (k = 0; k < nr; k++)
- bad_for_class |= ! TEST_HARD_REG_BIT (reg_class_contents[(int) rld[r].class],
+ bad_for_class |= ! TEST_HARD_REG_BIT (reg_class_contents[(int) rld[r].rclass],
i+k);
/* We found a register that contains the
@@ -5939,7 +5945,7 @@ choose_reload_regs (struct insn_chain *chain)
|| REG_P (rld[r].in)
|| MEM_P (rld[r].in))
&& (rld[r].nregs == max_group_size
- || ! reg_classes_intersect_p (rld[r].class, group_class)))
+ || ! reg_classes_intersect_p (rld[r].rclass, group_class)))
search_equiv = rld[r].in;
/* If this is an output reload from a simple move insn, look
if an equivalence for the input is available. */
@@ -5956,7 +5962,7 @@ choose_reload_regs (struct insn_chain *chain)
if (search_equiv)
{
rtx equiv
- = find_equiv_reg (search_equiv, insn, rld[r].class,
+ = find_equiv_reg (search_equiv, insn, rld[r].rclass,
-1, NULL, 0, rld[r].mode);
int regno = 0;
@@ -5997,7 +6003,7 @@ choose_reload_regs (struct insn_chain *chain)
{
regs_used |= TEST_HARD_REG_BIT (reload_reg_used_at_all,
i);
- bad_for_class |= ! TEST_HARD_REG_BIT (reg_class_contents[(int) rld[r].class],
+ bad_for_class |= ! TEST_HARD_REG_BIT (reg_class_contents[(int) rld[r].rclass],
i);
}
@@ -6135,9 +6141,9 @@ choose_reload_regs (struct insn_chain *chain)
|| rld[s].optional)
continue;
- if ((rld[s].class != rld[r].class
- && reg_classes_intersect_p (rld[r].class,
- rld[s].class))
+ if ((rld[s].rclass != rld[r].rclass
+ && reg_classes_intersect_p (rld[r].rclass,
+ rld[s].rclass))
|| rld[s].nregs < rld[r].nregs)
break;
}
@@ -6818,7 +6824,7 @@ emit_input_reload_insns (struct insn_chain *chain, struct reload *rl,
sri.icode = CODE_FOR_nothing;
sri.prev_sri = NULL;
- new_class = targetm.secondary_reload (1, real_oldequiv, rl->class,
+ new_class = targetm.secondary_reload (1, real_oldequiv, rl->rclass,
mode, &sri);
if (new_class == NO_REGS && sri.icode == CODE_FOR_nothing)
@@ -7008,7 +7014,7 @@ emit_output_reload_insns (struct insn_chain *chain, struct reload *rl,
&& reg_equiv_mem[REGNO (old)] != 0)
real_old = reg_equiv_mem[REGNO (old)];
- if (secondary_reload_class (0, rl->class, mode, real_old) != NO_REGS)
+ if (secondary_reload_class (0, rl->rclass, mode, real_old) != NO_REGS)
{
rtx second_reloadreg = reloadreg;
reloadreg = rld[secondary_reload].reg_rtx;
@@ -8003,9 +8009,11 @@ gen_reload (rtx out, rtx in, int opnum, enum reload_type type)
#ifdef SECONDARY_MEMORY_NEEDED
/* If we need a memory location to do the move, do it that way. */
- else if ((REG_P (in) || GET_CODE (in) == SUBREG)
+ else if ((REG_P (in)
+ || (GET_CODE (in) == SUBREG && REG_P (SUBREG_REG (in))))
&& reg_or_subregno (in) < FIRST_PSEUDO_REGISTER
- && (REG_P (out) || GET_CODE (out) == SUBREG)
+ && (REG_P (out)
+ || (GET_CODE (out) == SUBREG && REG_P (SUBREG_REG (out))))
&& reg_or_subregno (out) < FIRST_PSEUDO_REGISTER
&& SECONDARY_MEMORY_NEEDED (REGNO_REG_CLASS (reg_or_subregno (in)),
REGNO_REG_CLASS (reg_or_subregno (out)),
diff --git a/gcc/reorg.c b/gcc/reorg.c
index 25f410aad2d..59c6eecf2c2 100644
--- a/gcc/reorg.c
+++ b/gcc/reorg.c
@@ -1529,12 +1529,12 @@ try_merge_delay_insns (rtx insn, rtx thread)
{
if (! annul_p)
{
- rtx new;
+ rtx new_rtx;
update_block (dtrial, thread);
- new = delete_from_delay_slot (dtrial);
+ new_rtx = delete_from_delay_slot (dtrial);
if (INSN_DELETED_P (thread))
- thread = new;
+ thread = new_rtx;
INSN_FROM_TARGET_P (next_to_match) = 0;
}
else
@@ -1567,12 +1567,12 @@ try_merge_delay_insns (rtx insn, rtx thread)
{
if (GET_MODE (merged_insns) == SImode)
{
- rtx new;
+ rtx new_rtx;
update_block (XEXP (merged_insns, 0), thread);
- new = delete_from_delay_slot (XEXP (merged_insns, 0));
+ new_rtx = delete_from_delay_slot (XEXP (merged_insns, 0));
if (INSN_DELETED_P (thread))
- thread = new;
+ thread = new_rtx;
}
else
{
diff --git a/gcc/rtl.h b/gcc/rtl.h
index b2b561c3421..5281b1484db 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -1572,6 +1572,7 @@ extern rtx simplify_subtraction (rtx);
/* In function.c */
extern rtx assign_stack_local (enum machine_mode, HOST_WIDE_INT, int);
+extern rtx assign_stack_local_1 (enum machine_mode, HOST_WIDE_INT, int, bool);
extern rtx assign_stack_temp (enum machine_mode, HOST_WIDE_INT, int);
extern rtx assign_stack_temp_for_type (enum machine_mode,
HOST_WIDE_INT, int, tree);
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index d569ff04b2b..fb4a5df7dc8 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -2470,32 +2470,32 @@ replace_rtx (rtx x, rtx from, rtx to)
if (GET_CODE (x) == SUBREG)
{
- rtx new = replace_rtx (SUBREG_REG (x), from, to);
+ rtx new_rtx = replace_rtx (SUBREG_REG (x), from, to);
- if (GET_CODE (new) == CONST_INT)
+ if (GET_CODE (new_rtx) == CONST_INT)
{
- x = simplify_subreg (GET_MODE (x), new,
+ x = simplify_subreg (GET_MODE (x), new_rtx,
GET_MODE (SUBREG_REG (x)),
SUBREG_BYTE (x));
gcc_assert (x);
}
else
- SUBREG_REG (x) = new;
+ SUBREG_REG (x) = new_rtx;
return x;
}
else if (GET_CODE (x) == ZERO_EXTEND)
{
- rtx new = replace_rtx (XEXP (x, 0), from, to);
+ rtx new_rtx = replace_rtx (XEXP (x, 0), from, to);
- if (GET_CODE (new) == CONST_INT)
+ if (GET_CODE (new_rtx) == CONST_INT)
{
x = simplify_unary_operation (ZERO_EXTEND, GET_MODE (x),
- new, GET_MODE (XEXP (x, 0)));
+ new_rtx, GET_MODE (XEXP (x, 0)));
gcc_assert (x);
}
else
- XEXP (x, 0) = new;
+ XEXP (x, 0) = new_rtx;
return x;
}
@@ -3692,12 +3692,12 @@ nonzero_bits1 (const_rtx x, enum machine_mode mode, const_rtx known_x,
{
unsigned HOST_WIDE_INT nonzero_for_hook = nonzero;
- rtx new = rtl_hooks.reg_nonzero_bits (x, mode, known_x,
+ rtx new_rtx = rtl_hooks.reg_nonzero_bits (x, mode, known_x,
known_mode, known_ret,
&nonzero_for_hook);
- if (new)
- nonzero_for_hook &= cached_nonzero_bits (new, mode, known_x,
+ if (new_rtx)
+ nonzero_for_hook &= cached_nonzero_bits (new_rtx, mode, known_x,
known_mode, known_ret);
return nonzero_for_hook;
@@ -4177,12 +4177,12 @@ num_sign_bit_copies1 (const_rtx x, enum machine_mode mode, const_rtx known_x,
{
unsigned int copies_for_hook = 1, copies = 1;
- rtx new = rtl_hooks.reg_num_sign_bit_copies (x, mode, known_x,
+ rtx new_rtx = rtl_hooks.reg_num_sign_bit_copies (x, mode, known_x,
known_mode, known_ret,
&copies_for_hook);
- if (new)
- copies = cached_num_sign_bit_copies (new, mode, known_x,
+ if (new_rtx)
+ copies = cached_num_sign_bit_copies (new_rtx, mode, known_x,
known_mode, known_ret);
if (copies > 1 || copies_for_hook > 1)
diff --git a/gcc/rtlhooks.c b/gcc/rtlhooks.c
index 432b286c1d8..25fbc094830 100644
--- a/gcc/rtlhooks.c
+++ b/gcc/rtlhooks.c
@@ -141,7 +141,7 @@ gen_lowpart_if_possible (enum machine_mode mode, rtx x)
{
/* This is the only other case we handle. */
int offset = 0;
- rtx new;
+ rtx new_rtx;
if (WORDS_BIG_ENDIAN)
offset = (MAX (GET_MODE_SIZE (GET_MODE (x)), UNITS_PER_WORD)
@@ -152,11 +152,11 @@ gen_lowpart_if_possible (enum machine_mode mode, rtx x)
offset -= (MIN (UNITS_PER_WORD, GET_MODE_SIZE (mode))
- MIN (UNITS_PER_WORD, GET_MODE_SIZE (GET_MODE (x))));
- new = adjust_address_nv (x, mode, offset);
- if (! memory_address_p (mode, XEXP (new, 0)))
+ new_rtx = adjust_address_nv (x, mode, offset);
+ if (! memory_address_p (mode, XEXP (new_rtx, 0)))
return 0;
- return new;
+ return new_rtx;
}
else if (mode != GET_MODE (x) && GET_MODE (x) != VOIDmode
&& validate_subreg (mode, GET_MODE (x), x,
diff --git a/gcc/scan.c b/gcc/scan.c
index f697d26ec02..c6d04716271 100644
--- a/gcc/scan.c
+++ b/gcc/scan.c
@@ -35,7 +35,7 @@ make_sstring_space (sstring *str, int count)
if (new_size <= cur_size)
return;
- str->base = xrealloc (str->base, new_size);
+ str->base = (char *) xrealloc (str->base, new_size);
str->ptr = str->base + cur_size;
str->limit = str->base + new_size;
}
diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c
index b8b3a4418df..bbd7a36a441 100644
--- a/gcc/sched-deps.c
+++ b/gcc/sched-deps.c
@@ -536,6 +536,46 @@ sched_insns_conditions_mutex_p (const_rtx insn1, const_rtx insn2)
}
+/* Return true if INSN can potentially be speculated with type DS. */
+bool
+sched_insn_is_legitimate_for_speculation_p (const_rtx insn, ds_t ds)
+{
+ if (HAS_INTERNAL_DEP (insn))
+ return false;
+
+ if (!NONJUMP_INSN_P (insn))
+ return false;
+
+ if (SCHED_GROUP_P (insn))
+ return false;
+
+ if (IS_SPECULATION_CHECK_P (insn))
+ return false;
+
+ if (side_effects_p (PATTERN (insn)))
+ return false;
+
+ if (ds & BE_IN_SPEC)
+ /* The following instructions, which depend on a speculatively scheduled
+ instruction, cannot be speculatively scheduled along. */
+ {
+ if (may_trap_p (PATTERN (insn)))
+ /* If instruction might trap, it cannot be speculatively scheduled.
+ For control speculation it's obvious why and for data speculation
+ it's because the insn might get wrong input if speculation
+ wasn't successful. */
+ return false;
+
+ if ((ds & BE_IN_DATA)
+ && sched_get_condition (insn) != NULL_RTX)
+ /* If this is a predicated instruction, then it cannot be
+ speculatively scheduled. See PR35659. */
+ return false;
+ }
+
+ return true;
+}
+
/* Initialize LIST_PTR to point to one of the lists present in TYPES_PTR,
initialize RESOLVED_P_PTR with true if that list consists of resolved deps,
and remove the type of returned [through LIST_PTR] list from TYPES_PTR.
diff --git a/gcc/sched-ebb.c b/gcc/sched-ebb.c
index 58a89346cf0..25b97c395d1 100644
--- a/gcc/sched-ebb.c
+++ b/gcc/sched-ebb.c
@@ -357,7 +357,7 @@ static void
add_deps_for_risky_insns (rtx head, rtx tail)
{
rtx insn, prev;
- int class;
+ int classification;
rtx last_jump = NULL_RTX;
rtx next_tail = NEXT_INSN (tail);
basic_block last_block = NULL, bb;
@@ -372,9 +372,9 @@ add_deps_for_risky_insns (rtx head, rtx tail)
}
else if (INSN_P (insn) && last_jump != NULL_RTX)
{
- class = haifa_classify_insn (insn);
+ classification = haifa_classify_insn (insn);
prev = last_jump;
- switch (class)
+ switch (classification)
{
case PFREE_CANDIDATE:
if (flag_schedule_speculative_load)
diff --git a/gcc/sched-int.h b/gcc/sched-int.h
index f2e39bf4fc3..bfbb8612456 100644
--- a/gcc/sched-int.h
+++ b/gcc/sched-int.h
@@ -805,6 +805,7 @@ enum INSN_TRAP_CLASS
/* Functions in sched-deps.c. */
extern bool sched_insns_conditions_mutex_p (const_rtx, const_rtx);
+extern bool sched_insn_is_legitimate_for_speculation_p (const_rtx, ds_t);
extern void add_dependence (rtx, rtx, enum reg_note);
extern void sched_analyze (struct deps *, rtx, rtx);
extern bool deps_pools_are_empty_p (void);
@@ -838,7 +839,6 @@ extern void sched_finish (void);
extern int try_ready (rtx);
extern void * xrecalloc (void *, size_t, size_t, size_t);
-extern bool sched_insn_is_legitimate_for_speculation_p (const_rtx, ds_t);
extern void unlink_bb_notes (basic_block, basic_block);
extern void add_block (basic_block, basic_block);
extern rtx bb_note (basic_block);
diff --git a/gcc/sched-rgn.c b/gcc/sched-rgn.c
index abb2c8d6f6c..9304536b580 100644
--- a/gcc/sched-rgn.c
+++ b/gcc/sched-rgn.c
@@ -2108,9 +2108,22 @@ new_ready (rtx next, ds_t ts)
But we possibly can handle that with control speculation. */
&& (current_sched_info->flags & DO_SPECULATION)
&& (spec_info->mask & BEGIN_CONTROL))
- /* Here we got new control-speculative instruction. */
- ts = set_dep_weak (ts, BEGIN_CONTROL, MAX_DEP_WEAK);
+ {
+ ds_t new_ds;
+
+ /* Add control speculation to NEXT's dependency type. */
+ new_ds = set_dep_weak (ts, BEGIN_CONTROL, MAX_DEP_WEAK);
+
+ /* Check if NEXT can be speculated with new dependency type. */
+ if (sched_insn_is_legitimate_for_speculation_p (next, new_ds))
+ /* Here we got new control-speculative instruction. */
+ ts = new_ds;
+ else
+ /* NEXT isn't ready yet. */
+ ts = (ts & ~SPECULATIVE) | HARD_DEP;
+ }
else
+ /* NEXT isn't ready yet. */
ts = (ts & ~SPECULATIVE) | HARD_DEP;
}
}
@@ -2388,10 +2401,10 @@ static struct deps *bb_deps;
static rtx
concat_INSN_LIST (rtx copy, rtx old)
{
- rtx new = old;
+ rtx new_rtx = old;
for (; copy ; copy = XEXP (copy, 1))
- new = alloc_INSN_LIST (XEXP (copy, 0), new);
- return new;
+ new_rtx = alloc_INSN_LIST (XEXP (copy, 0), new_rtx);
+ return new_rtx;
}
static void
@@ -2584,7 +2597,6 @@ debug_rgn_dependencies (int from_bb)
{
rtx head, tail;
- gcc_assert (EBB_FIRST_BB (bb) == EBB_LAST_BB (bb));
get_ebb_head_tail (EBB_FIRST_BB (bb), EBB_LAST_BB (bb), &head, &tail);
fprintf (sched_dump, "\n;; --- Region Dependences --- b %d bb %d \n",
BB_TO_BLOCK (bb), bb);
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 262c9194937..6fd77ff1543 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -1740,9 +1740,8 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode,
so we can distinguish it from a register-register-copy.
In IEEE floating point, x-0 is not the same as x. */
-
- if ((TARGET_FLOAT_FORMAT != IEEE_FLOAT_FORMAT
- || ! FLOAT_MODE_P (mode) || flag_unsafe_math_optimizations)
+ if (!(HONOR_SIGNED_ZEROS (mode)
+ && HONOR_SIGN_DEPENDENT_ROUNDING (mode))
&& trueop1 == CONST0_RTX (mode))
return op0;
#endif
@@ -3080,8 +3079,7 @@ simplify_const_binary_operation (enum rtx_code code, enum machine_mode mode,
is unable to accurately represent the result. */
if ((flag_rounding_math
- || (REAL_MODE_FORMAT_COMPOSITE_P (mode)
- && !flag_unsafe_math_optimizations))
+ || (MODE_COMPOSITE_P (mode) && !flag_unsafe_math_optimizations))
&& (inexact || !real_identical (&result, &value)))
return NULL_RTX;
diff --git a/gcc/stmt.c b/gcc/stmt.c
index af02f3402ce..38d7b439aec 100644
--- a/gcc/stmt.c
+++ b/gcc/stmt.c
@@ -1356,9 +1356,6 @@ expand_expr_stmt (tree exp)
tree type;
value = expand_expr (exp, const0_rtx, VOIDmode, EXPAND_NORMAL);
- if (GIMPLE_TUPLE_P (exp))
- type = void_type_node;
- else
type = TREE_TYPE (exp);
/* If all we do is reference a volatile value in memory,
@@ -1412,7 +1409,6 @@ warn_if_unused_value (const_tree exp, location_t locus)
case PREDECREMENT_EXPR:
case POSTDECREMENT_EXPR:
case MODIFY_EXPR:
- case GIMPLE_MODIFY_STMT:
case INIT_EXPR:
case TARGET_EXPR:
case CALL_EXPR:
@@ -1581,10 +1577,10 @@ expand_return (tree retval)
expand_null_return ();
return;
}
- else if ((TREE_CODE (retval) == GIMPLE_MODIFY_STMT
+ else if ((TREE_CODE (retval) == MODIFY_EXPR
|| TREE_CODE (retval) == INIT_EXPR)
- && TREE_CODE (GENERIC_TREE_OPERAND (retval, 0)) == RESULT_DECL)
- retval_rhs = GENERIC_TREE_OPERAND (retval, 1);
+ && TREE_CODE (TREE_OPERAND (retval, 0)) == RESULT_DECL)
+ retval_rhs = TREE_OPERAND (retval, 1);
else
retval_rhs = retval;
@@ -1603,7 +1599,7 @@ expand_return (tree retval)
(and in expand_call). */
else if (retval_rhs != 0
- && TYPE_MODE (GENERIC_TREE_TYPE (retval_rhs)) == BLKmode
+ && TYPE_MODE (TREE_TYPE (retval_rhs)) == BLKmode
&& REG_P (result_rtl))
{
int i;
@@ -1817,7 +1813,7 @@ expand_nl_goto_receiver (void)
{
/* Now restore our arg pointer from the address at which it
was saved in our stack frame. */
- emit_move_insn (virtual_incoming_args_rtx,
+ emit_move_insn (crtl->args.internal_arg_pointer,
copy_to_reg (get_arg_pointer_save_area ()));
}
}
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index 2b48ea60370..17654611e1a 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -163,12 +163,12 @@ variable_size (tree size)
#endif
/* Return the machine mode to use for a nonscalar of SIZE bits. The
- mode must be in class CLASS, and have exactly that many value bits;
+ mode must be in class MCLASS, and have exactly that many value bits;
it may have padding as well. If LIMIT is nonzero, modes of wider
than MAX_FIXED_MODE_SIZE will not be used. */
enum machine_mode
-mode_for_size (unsigned int size, enum mode_class class, int limit)
+mode_for_size (unsigned int size, enum mode_class mclass, int limit)
{
enum machine_mode mode;
@@ -176,7 +176,7 @@ mode_for_size (unsigned int size, enum mode_class class, int limit)
return BLKmode;
/* Get the first mode which has this size, in the specified class. */
- for (mode = GET_CLASS_NARROWEST_MODE (class); mode != VOIDmode;
+ for (mode = GET_CLASS_NARROWEST_MODE (mclass); mode != VOIDmode;
mode = GET_MODE_WIDER_MODE (mode))
if (GET_MODE_PRECISION (mode) == size)
return mode;
@@ -187,7 +187,7 @@ mode_for_size (unsigned int size, enum mode_class class, int limit)
/* Similar, except passed a tree node. */
enum machine_mode
-mode_for_size_tree (const_tree size, enum mode_class class, int limit)
+mode_for_size_tree (const_tree size, enum mode_class mclass, int limit)
{
unsigned HOST_WIDE_INT uhwi;
unsigned int ui;
@@ -198,20 +198,20 @@ mode_for_size_tree (const_tree size, enum mode_class class, int limit)
ui = uhwi;
if (uhwi != ui)
return BLKmode;
- return mode_for_size (ui, class, limit);
+ return mode_for_size (ui, mclass, limit);
}
/* Similar, but never return BLKmode; return the narrowest mode that
contains at least the requested number of value bits. */
enum machine_mode
-smallest_mode_for_size (unsigned int size, enum mode_class class)
+smallest_mode_for_size (unsigned int size, enum mode_class mclass)
{
enum machine_mode mode;
/* Get the first mode which has at least this size, in the
specified class. */
- for (mode = GET_CLASS_NARROWEST_MODE (class); mode != VOIDmode;
+ for (mode = GET_CLASS_NARROWEST_MODE (mclass); mode != VOIDmode;
mode = GET_MODE_WIDER_MODE (mode))
if (GET_MODE_PRECISION (mode) >= size)
return mode;
diff --git a/gcc/system.h b/gcc/system.h
index be70b026ff4..80bfe619c3d 100644
--- a/gcc/system.h
+++ b/gcc/system.h
@@ -786,8 +786,9 @@ extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN;
change after the fact). Beyond these uses, most other cases of
using this macro should be viewed with extreme caution. */
-#if defined(__GNUC__) && GCC_VERSION != 4000
-/* GCC 4.0.x has a bug where it may ICE on this expression. */
+#if defined(__GNUC__) && GCC_VERSION > 4000
+/* GCC 4.0.x has a bug where it may ICE on this expression,
+ so does GCC 3.4.x (PR17436). */
#define CONST_CAST2(TOTYPE,FROMTYPE,X) ((__extension__(union {FROMTYPE _q; TOTYPE _nq;})(X))._nq)
#else
#define CONST_CAST2(TOTYPE,FROMTYPE,X) ((TOTYPE)(FROMTYPE)(X))
@@ -796,6 +797,7 @@ extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN;
#define CONST_CAST_TREE(X) CONST_CAST(union tree_node *, (X))
#define CONST_CAST_RTX(X) CONST_CAST(struct rtx_def *, (X))
#define CONST_CAST_BB(X) CONST_CAST(struct basic_block_def *, (X))
+#define CONST_CAST_GIMPLE(X) CONST_CAST(union gimple_statement_d *, (X))
/* Activate certain diagnostics as warnings (not errors via the
-Werror flag). */
diff --git a/gcc/target-def.h b/gcc/target-def.h
index 29ed88873b2..cd64b386e9e 100644
--- a/gcc/target-def.h
+++ b/gcc/target-def.h
@@ -571,6 +571,8 @@
#define TARGET_FUNCTION_VALUE default_function_value
#define TARGET_INTERNAL_ARG_POINTER default_internal_arg_pointer
+#define TARGET_UPDATE_STACK_BOUNDARY NULL
+#define TARGET_GET_DRAP_RTX NULL
#define TARGET_ALLOCATE_STACK_SLOTS_FOR_ARGS hook_bool_void_true
#define TARGET_CALLS { \
@@ -592,6 +594,8 @@
TARGET_INVALID_ARG_FOR_UNPROTOTYPED_FN, \
TARGET_FUNCTION_VALUE, \
TARGET_INTERNAL_ARG_POINTER, \
+ TARGET_UPDATE_STACK_BOUNDARY, \
+ TARGET_GET_DRAP_RTX, \
TARGET_ALLOCATE_STACK_SLOTS_FOR_ARGS \
}
@@ -758,6 +762,51 @@
TARGET_EMUTLS_DEBUG_FORM_TLS_ADDRESS \
}
+/* Function specific option attribute support. */
+#ifndef TARGET_OPTION_VALID_ATTRIBUTE_P
+#define TARGET_OPTION_VALID_ATTRIBUTE_P NULL
+#endif
+
+#ifndef TARGET_OPTION_SAVE
+#define TARGET_OPTION_SAVE NULL
+#endif
+
+#ifndef TARGET_OPTION_RESTORE
+#define TARGET_OPTION_RESTORE NULL
+#endif
+
+#ifndef TARGET_OPTION_PRINT
+#define TARGET_OPTION_PRINT NULL
+#endif
+
+#ifndef TARGET_OPTION_PRAGMA_PARSE
+#define TARGET_OPTION_PRAGMA_PARSE NULL
+#endif
+
+#ifndef TARGET_OPTION_CAN_INLINE_P
+#define TARGET_OPTION_CAN_INLINE_P default_target_option_can_inline_p
+#endif
+
+#ifndef TARGET_OPTION_COLD_ATTRIBUTE_SETS_OPTIMIZATION
+#define TARGET_OPTION_COLD_ATTRIBUTE_SETS_OPTIMIZATION false
+#endif
+
+#ifndef TARGET_OPTION_HOT_ATTRIBUTE_SETS_OPTIMIZATION
+#define TARGET_OPTION_HOT_ATTRIBUTE_SETS_OPTIMIZATION false
+#endif
+
+#define TARGET_OPTION_HOOKS \
+ { \
+ TARGET_OPTION_VALID_ATTRIBUTE_P, \
+ TARGET_OPTION_SAVE, \
+ TARGET_OPTION_RESTORE, \
+ TARGET_OPTION_PRINT, \
+ TARGET_OPTION_PRAGMA_PARSE, \
+ TARGET_OPTION_CAN_INLINE_P, \
+ TARGET_OPTION_COLD_ATTRIBUTE_SETS_OPTIMIZATION, \
+ TARGET_OPTION_HOT_ATTRIBUTE_SETS_OPTIMIZATION, \
+ }
+
/* The whole shebang. */
#define TARGET_INITIALIZER \
{ \
@@ -854,6 +903,7 @@
TARGET_C, \
TARGET_CXX, \
TARGET_EMUTLS, \
+ TARGET_OPTION_HOOKS, \
TARGET_EXTRA_LIVE_ON_ENTRY, \
TARGET_UNWIND_TABLES_DEFAULT, \
TARGET_HAVE_NAMED_SECTIONS, \
diff --git a/gcc/target.h b/gcc/target.h
index d1642ef9497..3a104c5632b 100644
--- a/gcc/target.h
+++ b/gcc/target.h
@@ -707,8 +707,8 @@ struct gcc_target
void (* expand_builtin_va_start) (tree valist, rtx nextarg);
/* Gimplifies a VA_ARG_EXPR. */
- tree (* gimplify_va_arg_expr) (tree valist, tree type, tree *pre_p,
- tree *post_p);
+ tree (* gimplify_va_arg_expr) (tree valist, tree type, gimple_seq *pre_p,
+ gimple_seq *post_p);
/* Validity-checking routines for PCH files, target-specific.
get_pch_validity returns a pointer to the data to be stored,
@@ -754,10 +754,9 @@ struct gcc_target
void (* dwarf_handle_frame_unspec) (const char *, rtx, int);
/* Perform architecture specific checking of statements gimplified
- from VA_ARG_EXPR. LHS is left hand side of MODIFY_EXPR, RHS
- is right hand side. Returns true if the statements doesn't need
- to be checked for va_list references. */
- bool (* stdarg_optimize_hook) (struct stdarg_info *ai, const_tree lhs, const_tree rhs);
+ from VA_ARG_EXPR. STMT is the statement. Returns true if the statement
+ doesn't need to be checked for va_list references. */
+ bool (* stdarg_optimize_hook) (struct stdarg_info *ai, const_gimple stmt);
/* This target hook allows the operating system to override the DECL
that represents the external variable that contains the stack
@@ -840,6 +839,13 @@ struct gcc_target
current function. */
rtx (*internal_arg_pointer) (void);
+ /* Update the current function stack boundary if needed. */
+ void (*update_stack_boundary) (void);
+
+ /* Handle stack alignment and return an rtx for Dynamic Realign
+ Argument Pointer if necessary. */
+ rtx (*get_drap_rtx) (void);
+
/* Return true if all function parameters should be spilled to the
stack. */
bool (*allocate_stack_slots_for_args) (void);
@@ -963,6 +969,40 @@ struct gcc_target
bool debug_form_tls_address;
} emutls;
+ struct target_option_hooks {
+ /* Function to validate the attribute((option(...))) strings or NULL. If
+ the option is validated, it is assumed that DECL_FUNCTION_SPECIFIC will
+ be filled in in the function decl node. */
+ bool (*valid_attribute_p) (tree, tree, tree, int);
+
+ /* Function to save any extra target state in the target options
+ structure. */
+ void (*save) (struct cl_target_option *);
+
+ /* Function to restore any extra target state from the target options
+ structure. */
+ void (*restore) (struct cl_target_option *);
+
+ /* Function to print any extra target state from the target options
+ structure. */
+ void (*print) (FILE *, int, struct cl_target_option *);
+
+ /* Function to parse arguments to be validated for #pragma option, and to
+ change the state if the options are valid. If the arguments are NULL,
+ use the default target options. Return true if the options are valid,
+ and set the current state. */
+ bool (*pragma_parse) (tree);
+
+ /* Function to determine if one function can inline another function. */
+ bool (*can_inline_p) (tree, tree);
+
+ /* Whether the cold attribute changes the optimization level. */
+ bool cold_attribute_sets_optimization;
+
+ /* Whether the hot attribute changes the optimization level. */
+ bool hot_attribute_sets_optimization;
+ } target_option;
+
/* For targets that need to mark extra registers as live on entry to
the function, they should define this target hook and set their
bits in the bitmap passed in. */
diff --git a/gcc/targhooks.c b/gcc/targhooks.c
index 1cb561480b8..4e9b9ad0675 100644
--- a/gcc/targhooks.c
+++ b/gcc/targhooks.c
@@ -581,7 +581,7 @@ default_secondary_reload (bool in_p ATTRIBUTE_UNUSED, rtx x ATTRIBUTE_UNUSED,
enum machine_mode reload_mode ATTRIBUTE_UNUSED,
secondary_reload_info *sri)
{
- enum reg_class class = NO_REGS;
+ enum reg_class rclass = NO_REGS;
if (sri->prev_sri && sri->prev_sri->t_icode != CODE_FOR_nothing)
{
@@ -590,13 +590,13 @@ default_secondary_reload (bool in_p ATTRIBUTE_UNUSED, rtx x ATTRIBUTE_UNUSED,
}
#ifdef SECONDARY_INPUT_RELOAD_CLASS
if (in_p)
- class = SECONDARY_INPUT_RELOAD_CLASS (reload_class, reload_mode, x);
+ rclass = SECONDARY_INPUT_RELOAD_CLASS (reload_class, reload_mode, x);
#endif
#ifdef SECONDARY_OUTPUT_RELOAD_CLASS
if (! in_p)
- class = SECONDARY_OUTPUT_RELOAD_CLASS (reload_class, reload_mode, x);
+ rclass = SECONDARY_OUTPUT_RELOAD_CLASS (reload_class, reload_mode, x);
#endif
- if (class != NO_REGS)
+ if (rclass != NO_REGS)
{
enum insn_code icode = (in_p ? reload_in_optab[(int) reload_mode]
: reload_out_optab[(int) reload_mode]);
@@ -648,19 +648,19 @@ default_secondary_reload (bool in_p ATTRIBUTE_UNUSED, rtx x ATTRIBUTE_UNUSED,
if (reg_class_subset_p (reload_class, insn_class))
{
- gcc_assert (scratch_class == class);
- class = NO_REGS;
+ gcc_assert (scratch_class == rclass);
+ rclass = NO_REGS;
}
else
- class = insn_class;
+ rclass = insn_class;
}
- if (class == NO_REGS)
+ if (rclass == NO_REGS)
sri->icode = icode;
else
sri->t_icode = icode;
}
- return class;
+ return rclass;
}
bool
@@ -709,4 +709,38 @@ default_hard_regno_scratch_ok (unsigned int regno ATTRIBUTE_UNUSED)
return true;
}
+bool
+default_target_option_valid_attribute_p (tree ARG_UNUSED (fndecl),
+ tree ARG_UNUSED (name),
+ tree ARG_UNUSED (args),
+ int ARG_UNUSED (flags))
+{
+ return false;
+}
+
+bool
+default_target_option_can_inline_p (tree caller, tree callee)
+{
+ bool ret = false;
+ tree callee_opts = DECL_FUNCTION_SPECIFIC_TARGET (callee);
+ tree caller_opts = DECL_FUNCTION_SPECIFIC_TARGET (caller);
+
+ /* If callee has no option attributes, then it is ok to inline */
+ if (!callee_opts)
+ ret = true;
+
+ /* If caller has no option attributes, but callee does then it is not ok to
+ inline */
+ else if (!caller_opts)
+ ret = false;
+
+ /* If both caller and callee have attributes, assume that if the pointer is
+ different, the the two functions have different target options since
+ build_target_option_node uses a hash table for the options. */
+ else
+ ret = (callee_opts == caller_opts);
+
+ return ret;
+}
+
#include "gt-targhooks.h"
diff --git a/gcc/targhooks.h b/gcc/targhooks.h
index 4ad0fc86805..efb487c0d8b 100644
--- a/gcc/targhooks.h
+++ b/gcc/targhooks.h
@@ -97,5 +97,6 @@ extern int default_reloc_rw_mask (void);
extern tree default_mangle_decl_assembler_name (tree, tree);
extern tree default_emutls_var_fields (tree, tree *);
extern tree default_emutls_var_init (tree, tree, tree);
-
extern bool default_hard_regno_scratch_ok (unsigned int);
+extern bool default_target_option_valid_attribute_p (tree, tree, tree, int);
+extern bool default_target_option_can_inline_p (tree, tree);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 33d94fceaec..2282f0f3708 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,1147 @@
+2008-08-15 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ * gcc.dg/pr30551-6.c: Skip for SPU.
+ * gcc.dg/pr30551-3.c: Likewise.
+ * gcc.dg/pr30551.c: Likewise.
+ * g++.dg/warn/pr30551-2.C: Likewise.
+ * g++.dg/warn/pr30551.C: Likewise.
+
+2008-08-14 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/36705
+ * gfortran.dg/argument_checking_7.f90: Modified.
+ * gfortran.dg/conflicts.f90: Modified.
+ * gfortran.dg/proc_decl_1.f90: Modified.
+ * gfortran.dg/proc_ptr_9.f90: New.
+
+2008-08-14 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/34485
+ * g++.dg/template/crash81.C: New.
+ * g++.old-deja/g++.benjamin/tem03.C: Adjust.
+ * g++.old-deja/g++.benjamin/tem04.C: Likewise.
+ * g++.old-deja/g++.brendan/crash7.C: Likewise.
+
+2008-08-14 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR libfortran/36886
+ * gfortran.dg/cshift_char_3.f90: New test case.
+ * gfortran.dg/cshift_nan_1.f90: New test case.
+
+2008-08-14 Rafael Avila de Espindola <espindola@google.com>
+
+ * gcc.dg/visibility-14.c: New test.
+ * gcc.dg/visibility-15.c: New test.
+ * gcc.dg/visibility-16.c: New test.
+ * gcc.dg/visibility-17.c: New test.
+ * gcc.dg/visibility-18.c: New test.
+ * gcc.dg/visibility-19.c: New test.
+
+2008-08-14 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/34600
+ * g++.dg/parse/crash43.C: New.
+
+2008-08-14 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR c/28152
+ * gcc.dg/parser-pr28152.c: New.
+ * gcc.dg/parser-pr28152-2.c: New.
+
+2008-08-14 Dorit Nuzman <dorit@il.ibm.com>
+
+ * gcc.dg/vect/vect-outer-4g.c: Change loop bound.
+ * gcc.dg/vect/vect-outer-4k.c: Likewise.
+ * gcc.dg/vect/vect-outer-4l.c: Likewise.
+ * gcc.dg/vect/vect-outer-4f.c: Likewise.
+ * gcc.dg/vect/vect-outer-4a.c: Vectorizable. Remove obsolete comment.
+ * gcc.dg/vect/vect-outer-4i.c: Likewise.
+ * gcc.dg/vect/vect-outer-4b.c: Likewise.
+ * gcc.dg/vect/vect-outer-4j.c: Likewise.
+
+2008-08-14 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/37101
+ * gcc.target/i386/pr37101.c: New test.
+
+2008-08-14 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/37103
+ * gcc.c-torture/execute/20080813-1.c: New test.
+
+2008-08-13 H.J. Lu <hongjiu.lu@intel.com>
+
+ * gcc.target/i386/incoming-1.c: Skip *-*-darwin*.
+ * gcc.target/i386/incoming-2.c: Likewise.
+ * gcc.target/i386/incoming-3.c: Likewise.
+ * gcc.target/i386/incoming-4.c: Likewise.
+ * gcc.target/i386/incoming-5.c: Likewise.
+
+2008-08-13 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR 30551
+ * gcc.dg/pr30551.c: New.
+ * gcc.dg/pr30551-2.c: New.
+ * gcc.dg/pr30551-3.c: New.
+ * gcc.dg/pr30551-4.c: New.
+ * gcc.dg/pr30551-5.c: New.
+ * gcc.dg/pr30551-6.c: New.
+ * gcc.dg/tree-ssa/reassoc-3.c: Don't compile with -pedantic-errors.
+ * g++.dg/warn/pr30551.C: New.
+ * g++.dg/warn/pr30551-2.C: New.
+
+2008-08-13 Richard Guenther <rguenther@suse.de>
+
+ * gcc.dg/tree-ssa/ssa-ccp-21.c: New testcase.
+ * gcc.dg/tree-ssa/ssa-ccp-22.c: Likewise.
+ * gcc.dg/tree-ssa/ssa-ccp-23.c: Likewise.
+
+2008-08-13 Samuel Tardieu <sam@rfc1149.net>
+
+ PR ada/36777
+ * gnat.dg/protected_self_ref1.adb, gnat.dg/protected_self_ref2.adb:
+ New.
+
+2008-08-13 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR c/15236
+ * gcc.dg/pr15236.c: New.
+ * gcc.dg/torture/pr25183.c: Update.
+
+2008-08-13 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR 35635
+ * gcc.dg/pr35635.c: New.
+ * gcc.dg/Wconversion-integer.c: Update.
+ * gcc.dg/Wconversion-integer-no-sign.c: Update.
+ * gcc.dg/Wsign-conversion.c: Update.
+ * g++.dg/warn/pr35635.C: New.
+ * g++.dg/warn/Wconversion-integer.C: Update.
+ * g++.dg/warn/Wsign-conversion.C: Update.
+
+2008-08-13 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/15255
+ * gcc.dg/tree-ssa/reassoc-14.c: New testcase.
+ * gcc.dg/tree-ssa/reassoc-15.c: Likewise.
+ * gcc.dg/tree-ssa/reassoc-16.c: Likewise.
+ * gcc.dg/torture/reassoc-1.c: Likewise.
+ * gcc.dg/tree-ssa/recip-2.c: Adjust.
+ * gcc.dg/tree-ssa/recip-6.c: Likewise.
+ * gcc.dg/tree-ssa/recip-7.c: Likewise.
+ * gfortran.dg/reassoc_4.f: Likewise.
+
+2008-08-12 Janis Johnson <janis187@us.ibm.com>
+
+ * gcc.target/i386/pr32000-2.c: Use dg-skip-if for target expression.
+ * gcc.target/i386/stackalign/return-3.c: Ditto.
+ * gcc.target/sparc/ultrasp3.c: Ditto.
+ * lib/target-supports-dg.exp (dg-require-effective-target): Error
+ if argument is not a single effective-target keyword.
+
+ PR testsuite/36087
+ * gcc.dg/var-expand3.c: Fix name of dump file.
+
+2008-08-12 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * g++.old-deja/g++.other/decl5.C: Expand new expected errors.
+
+2008-08-12 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/37087
+ * g++.dg/template/crash80.C: New.
+ * g++.old-deja/g++.other/decl5.C: Adjust.
+
+2008-08-12 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/37014
+ * gcc.c-torture/compile/20080812-1.c: New test.
+
+ PR tree-optimization/37084
+ * g++.dg/tree-ssa/pr37084.C: New test.
+
+2008-08-12 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
+
+ * gcc.c-torture/execute/20031003-1.c (main): Update test to
+ accommodate SPU single-precision rounding mode.
+ * gcc.c-torture/execute/conversion.c (test_float_to_integer,
+ test_float_to_longlong_integer): Likewise.
+ * gcc.c-torture/execute/ieee/rbug.c (main): Likewise.
+ * gcc.dg/hex-round-1.c: Skip test on SPU.
+ * gcc.dg/hex-round-2.c: Likewise.
+
+2008-08-12 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
+
+ * gcc.c-torture/execute/ieee/inf-2.c (testf): Skip on the SPU.
+
+2008-08-12 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/36688
+ * g++.dg/init/const6.C: New test.
+
+2008-08-12 Ira Rosen <irar@il.ibm.com>
+
+ * gcc.dg/vect/vect-multitypes-12.c: New.
+ * gcc.dg/vect/vect-multitypes-13.c, gcc.dg/vect/vect-multitypes-14.c,
+ gcc.dg/vect/vect-multitypes-15.c : Likewise.
+ * gcc.dg/vect/vect-reduc-dot-u8a.c: Avoid vectorization of the
+ init loop.
+ * gcc.dg/vect/vect-72.c, gcc.dg/vect/vect-strided-store-a-u8-i2.c:
+ Likewise.
+ * gcc.dg/vect/vect-reduc-dot-u8b.c: Avoid vectorization of the init
+ loop.
+ Should be vectorizable on targets that support vector unpack.
+ * gcc.dg/vect/vect-widen-mult-u8.c,
+ gcc.dg/vect/wrapv-vect-reduc-dot-s8b.c,
+ gcc.dg/vect/wrapv-vect-reduc-dot-s8b.c: Likewise.
+ * gcc.dg/vect/vect-35.c: Should be vectorizable on targets that
+ support vector pack. Avoid vectorization of the init loop.
+ * gcc.dg/vect/vect-reduc-pattern-1b.c: Should be vectorizable on
+ targets that support vector unpack.
+ * gcc.dg/vect/vect-reduc-pattern-2b.c,
+ gcc.dg/vect/vect-reduc-dot-s8c.c, gcc.dg/vect/vect-112.c: Likewise.
+
+2008-08-11 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/36998
+ * gcc.dg/pr36998.c: New test.
+
+2008-08-11 Andreas Krebbel <krebbel1@de.ibm.com>
+
+ * gcc.target/s390/20080806-1.c: Move testcase ...
+ * gcc.c-torture/compile/20080806-1.c: ... to here and make it
+ stack size sensitive.
+
+2008-08-10 Samuel Tardieu <sam@rfc1149.net>
+
+ * gnat.dg/exp0_eval.adb: New.
+
+2008-08-10 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR middle-end/20644
+ * gcc.dg/uninit-pr20644-O0.c: New.
+ * gcc.dg/uninit-pr20644.c: New.
+
+2008-08-10 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR 36901
+ * gcc.dg/pr36901.h: Do not depend on limits.h.
+ * gcc.dg/pr36901-3.c: Update.
+ * gcc.dg/pr36901-4.c: Update.
+
+2008-08-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
+
+ PR middle-end/36238
+ * gcc.c-torture/compile/pr36238.c: New testcase.
+
+2008-08-09 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * lib/target-supports.exp (check_profiling_available): Return false
+ for -p and -pg on MIPS16 targets.
+
+2008-08-09 Richard Guenther <rguenther@suse.de>
+
+ * gcc.dg/tree-ssa/inline-2.c: New testcase.
+
+2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR c/17880
+ * gcc.dg/sequence-pt-pr17880.c: New.
+
+2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR c++/12242
+ * g++.dg/warn/pr12242.C: New.
+
+2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR 36901
+ * gcc.dg/pr36901-1.c: New.
+ * gcc.dg/pr36901-3.c: New.
+ * gcc.dg/pr36901-2.c: New.
+ * gcc.dg/pr36901-4.c: New.
+ * gcc.dg/pr36901-system.h: New.
+ * gcc.dg/pr36901.h: New.
+ * gcc.target/powerpc/altivec-macros.c: Update.
+ * gcc.target/i386/regparm.c: Update.
+ * gcc.dg/funcdef-var-1.c: Update.
+ * gcc.dg/parm-mismatch-1.c: Update.
+ * gcc.dg/attr-noinline.c: Update.
+ * gcc.dg/wtr-static-1.c: Update.
+ * gcc.dg/redecl-11.c: Update.
+ * gcc.dg/pr27953.c: Update.
+ * gcc.dg/proto-1.c: Update.
+ * gcc.dg/decl-3.c: Update.
+ * gcc.dg/redecl-13.c: Update.
+ * gcc.dg/pr15360-1.c: Update.
+ * gcc.dg/redecl-15.c: Update.
+ * gcc.dg/enum-compat-1.c: Update.
+ * gcc.dg/dll-3.c: Update.
+ * gcc.dg/array-5.c: Update.
+ * gcc.dg/Wredundant-decls-2.c: Update.
+ * gcc.dg/inline4.c: Update.
+ * gcc.dg/redecl-2.c: Update.
+ * gcc.dg/inline-14.c: Update.
+ * gcc.dg/tls/diag-3.c: Update.
+ * gcc.dg/funcdef-var-2.c: Update.
+ * gcc.dg/20041213-1.c: Update.
+ * gcc.dg/old-style-then-proto-1.c: Update.
+ * gcc.dg/decl-2.c: Update.
+ * gcc.dg/redecl-12.c: Update.
+ * gcc.dg/decl-4.c: Update.
+ * gcc.dg/Wshadow-1.c: Update.
+ * gcc.dg/transparent-union-2.c: Update.
+ * gcc.dg/visibility-7.c: Update.
+ * gcc.dg/dll-2.c: Update.
+ * gcc.dg/redecl-16.c: Update.
+ * gcc.dg/inline1.c: Update.
+ * gcc.dg/decl-8.c: Update.
+ * gcc.dg/nested-redef-1.c: Update.
+ * gcc.dg/inline3.c: Update.
+ * gcc.dg/redecl-1.c: Update.
+ * gcc.dg/inline5.c: Update.
+ * gcc.dg/pr35899.c: Update.
+ * gcc.dg/noncompile/label-lineno-1.c: Update.
+ * gcc.dg/noncompile/label-1.c: Update.
+ * gcc.dg/noncompile/20020220-1.c: Update.
+ * gcc.dg/noncompile/redecl-1.c: Update.
+ * gcc.dg/redecl-5.c: Update.
+ * gcc.dg/qual-return-3.c: Update.
+ * gcc.dg/label-decl-4.c: Update.
+
+2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR 7651
+ * g++.dg/warn/Wuninitializable-member.C: New.
+ * g++.dg/warn/Wuninitializable-member-no.C: New.
+
+2008-08-08 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR 28875
+ * gcc.dg/unused-6-no.c: New.
+ * gcc.dg/unused-6-WallWextra.c: New.
+
+2008-08-08 Volker Reichelt <v.reichelt@netcologne.de>
+
+ PR c++/35985
+ * g++.dg/inherit/base3.C: New.
+
+2008-08-08 Dorit Nuzman <dorit@il.ibm.com>
+
+ * lib/target-supports.exp (check_effective_target_vect_floatint_cvt):
+ Add powerpc.
+
+2008-08-08 Daniel Kraft <d@domob.eu>
+
+ * gfortran.dg/finalize_9.f03: New test.
+ * gfortran.dg/module_md5_1.f90: Adapted MD5-sum for changed module
+ file format.
+
+2008-08-08 Richard Guenther <rguenther@suse.de>
+
+ * gcc.dg/tree-ssa/ssa-ccp-20.c: New testcase.
+
+2008-08-08 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/37056
+ * gcc.c-torture/compile/pr37056.c: New testcase.
+
+2008-08-07 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * gcc.dg/Wcxx-compat-2.c: Check for bool/_Bool.
+
+2008-08-07 Douglas Gregor <doug.gregor@gmail.com>
+
+ * g++.dg/cpp0x/decltype12.C: New.
+
+2008-08-07 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/36992
+ * gcc.target/i386/pr36992-1.c: Scan movq.
+ * gcc.target/i386/pr36992-2.c: Use "-O2 -msse4" instead of
+ "-O0 -msse2". Scan movq.
+
+2008-08-07 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/37042
+ * gcc.dg/Wstrict-aliasing-bogus-ref-all-2.c: New testcase.
+
+2008-08-07 Andreas Krebbel <krebbel1@de.ibm.com>
+
+ * gcc.c-torture/compile/20080806-1.c: Move testcase ...
+ * gcc.target/s390/20080806-1.c: ... to here.
+
+2008-08-06 Douglas Gregor <doug.gregor@gmail.com>
+
+ PR c++/36460
+ * g++.dg/cpp0x/bracket3.C: Add another test case for the >>
+ warning under -Wc++0x-compat.
+ * g++.dg/cpp0x/bracket4.C: Add testcase for PR c++/36460.
+
+2008-08-06 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * gcc.dg/Wcxx-compat-2.c: Adjust test for more warnings.
+
+2008-08-06 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR 26785
+ * g++.dg/warn/pr26785.C: New.
+
+2008-08-06 Victor Kaplansky <victork@il.ibm.com>
+
+ * gcc.dg/vect/costmodel/ppc/costmodel-slp-34.c: New test.
+
+2008-08-06 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR 8715
+ * gcc.dg/pr8715.c: New.
+ * g++.dg/warn/pr8715.C: New.
+
+2008-08-06 Marc Gauthier <marc@tensilica.com>
+
+ * lib/target-supports.exp (check_profiling_available): Match more
+ processor names for Xtensa.
+ * g++.old-deja/g++.jason/thunk3.C: Likewise.
+ * gcc.dg/intmax_t-1.c: Likewise.
+ * gcc.dg/sibcall-3.c: Likewise.
+ * gcc.dg/sibcall-4.c: Likewise.
+ * gcc.c-torture/compile/20001226-1.c: Likewise.
+
+2008-08-06 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR middle-end/37010
+ * gcc.dg/torture/stackalign/push-1.c: New.
+
+2008-08-06 Michael Matz <matz@suse.de>
+
+ PR target/36613
+ * gcc.target/i386/pr36613.c: New testcase.
+
+2008-08-06 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR middle-end/37009
+ * gcc.dg/torture/stackalign/alloca-2.c: New.
+ * gcc.dg/torture/stackalign/alloca-3.c: Likewise.
+ * gcc.dg/torture/stackalign/alloca-4.c: Likewise.
+ * gcc.dg/torture/stackalign/vararg-3.c: Likewise.
+ * gcc.target/i386/incoming-1.c: Likewise.
+ * gcc.target/i386/incoming-2.c: Likewise.
+ * gcc.target/i386/incoming-3.c: Likewise.
+ * gcc.target/i386/incoming-4.c: Likewise.
+ * gcc.target/i386/incoming-5.c: Likewise.
+
+2008-08-06 Aldy Hernandez <aldyh@redhat.com>
+
+ PR middle-end/35432
+ * gcc.c-torture/compile/pr35432.c: New file.
+
+2008-08-06 Arnaud Charlet <charlet@adacore.com>
+
+ * gnat.dg/iface_test.ad[s,b]: New test.
+ * gnat.dg/test_call.adb: New test.
+
+2008-08-06 Andreas Krebbel <krebbel1@de.ibm.com>
+
+ * gcc.c-torture/compile/20080806-1.c: New testcase.
+
+2008-08-06 Maxim Kuvyrkov <maxim@codesourcery.com>
+
+ * gcc.target/ia64/20080802-1.c: New test.
+
+2008-08-05 Andrew Pinski <andrew_pinski@playstation.sony.com>
+
+ PR tree-opt/37024
+ * gcc.dg/tree-ssa/tailcall-4.c: New testcase.
+
+2008-08-05 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/37026
+ * gcc.c-torture/compile/pr37026.c: New testcase.
+
+2008-08-04 Arnaud Charlet <charlet@adacore.com>
+
+ * gnat.dg/access_discr2.adb: New test.
+ * gnat.dg/not_null.adb: New test.
+
+2008-08-04 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/36691
+ * gcc.c-torture/execute/pr36691.c: New testcase.
+
+2008-08-04 Victor Kaplansky <victork@il.ibm.com>
+
+ * gcc.dg/vect/vect-complex-5.c: New test.
+
+2008-08-04 Simon Baldwin <simonb@google.com>
+
+ PR c++/36999
+ * g++.dg/warn/pr36999.C: New.
+
+2008-08-04 Arnaud Charlet <charlet@adacore.com>
+
+ * gnat.dg/bip_aggregate_bug.adb: New test.
+ * gnat.dg/test_ai254.adb: New test.
+
+2008-08-03 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ * gfortran.dg/fmt_t_7.f: Replace CR-LF with LF.
+
+2008-08-03 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/36992
+ * gcc.target/i386/pr36992-1.c: New test.
+ * gcc.target/i386/pr36992-2.c: Ditto.
+
+2008-08-02 Richard Guenther <rguenther@suse.de>
+
+ PR target/35252
+ * lib/target-supports.exp (vect_extract_even_odd_wide) Add.
+ (vect_strided_wide): Likewise.
+ * gcc.dg/vect/fast-math-pr35982.c: Enable for
+ vect_extract_even_odd_wide.
+ * gcc.dg/vect/fast-math-vect-complex-3.c: Likewise.
+ * gcc.dg/vect/vect-1.c: Likewise.
+ * gcc.dg/vect/vect-107.c: Likewise.
+ * gcc.dg/vect/vect-98.c: Likewise.
+ * gcc.dg/vect/vect-strided-float.c: Likewise.
+ * gcc.dg/vect/slp-11.c: Enable for vect_strided_wide.
+ * gcc.dg/vect/slp-12a.c: Likewise.
+ * gcc.dg/vect/slp-12b.c: Likewise.
+ * gcc.dg/vect/slp-19.c: Likewise.
+ * gcc.dg/vect/slp-23.c: Likewise.
+ * gcc.dg/vect/slp-5.c: Likewise.
+
+2008-08-02 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/boolean_expr2.adb: New test.
+
+2008-08-01 Arnaud Charlet <charlet@adacore.com>
+
+ * gnat.dg/conv4.adb: New test.
+ * gnat.dg/overloading.adb: New test.
+
+2008-08-01 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/36991
+ * gcc.dg/pr36991.c: New test.
+
+2008-08-01 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/boolean_expr.ad[sb]: Rename to boolean_expr1.ad[sb].
+
+2008-08-01 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/36997
+ * gcc.dg/pr36997.c: New testcase.
+
+2008-08-01 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/deferred_const1.adb: New test.
+ * gnat.dg/deferred_const2.adb: Likewise.
+ * gnat.dg/deferred_const2_pkg.ad[sb]: New helper.
+ * gnat.dg/deferred_const3.adb: New test.
+ * gnat.dg/deferred_const3_pkg.ad[sb]: New helper.
+
+2008-08-01 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/36988
+ * gcc.c-torture/compile/pr36988.c: New testcase.
+
+2008-08-01 Olivier Hainque <hainque@adacore.com>
+
+ * gnat.dg/raise_from_pure.ad[bs],
+ * gnat.dg/wrap_raise_from_pure.ad[bs]: Support for ...
+ * gnat.dg/test_raise_from_pure.adb: New test.
+
+2008-07-31 Adam Nemet <anemet@caviumnetworks.com>
+
+ * gcc.target/mips/ext-1.c: New test.
+
+2008-07-31 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/discr10.ad[sb]: New test.
+
+2008-07-31 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/35100
+ * gcc.target/powerpc/longcall-1.c: New test.
+
+ PR preprocessor/36649
+ * gcc.dg/pch/cpp-3.hs: Add include guards.
+ * gcc.dg/pch/cpp-3a.h: Likewise.
+ * gcc.dg/pch/cpp-3b.h: Likewise.
+ * gcc.dg/cpp/mi8.c: New test.
+ * gcc.dg/cpp/mi8a.h: New file.
+ * gcc.dg/cpp/mi8b.h: New file.
+ * gcc.dg/cpp/mi8c.h: New file.
+ * gcc.dg/cpp/mi8d.h: New file.
+
+ PR rtl-optimization/36419
+ * g++.dg/eh/async-unwind2.C: New test.
+
+ PR c++/36405
+ * g++.dg/rtti/typeid8.C: New test.
+
+2008-07-31 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/36978
+ * gcc.dg/torture/pr36978.c: New testcase.
+
+2008-07-31 Arnaud Charlet <charlet@adacore.com>
+
+ * gnat.dg/sync_iface_test.ad[s,b]: New test.
+
+ * gnat.dg/specs/sync_iface_test.ads: New test.
+ * gnat.dg/specs/null_aggr_bug.ads: New test.
+
+2008-07-31 H.J. Lu <hongjiu.lu@intel.com>
+
+ * gcc.dg/torture/stackalign/pr16660-1.c: Include "check.h".
+ (f): Align to 64 byte. Use check instead of asm statement.
+
+2008-07-31 Arnaud Charlet <charlet@adacore.com>
+
+ * gnat.dg/missing_acc_check.adb: New test.
+
+2008-07-31 Richard Guenther <rguenther@suse.de>
+
+ * gcc.dg/uninit-1-O0.c: New testcase.
+ * gcc.dg/uninit-2-O0.c: Likewise.
+ * gcc.dg/uninit-3-O0.c: Likewise.
+ * gcc.dg/uninit-4-O0.c: Likewise.
+ * gcc.dg/uninit-5-O0.c: Likewise.
+ * gcc.dg/uninit-6-O0.c: Likewise.
+ * gcc.dg/uninit-8-O0.c: Likewise.
+ * gcc.dg/uninit-9-O0.c: Likewise.
+ * gcc.dg/uninit-A-O0.c: Likewise.
+ * gcc.dg/uninit-B-O0.c: Likewise.
+ * gcc.dg/uninit-C-O0.c: Likewise.
+ * gcc.dg/uninit-D-O0.c: Likewise.
+ * gcc.dg/uninit-E-O0.c: Likewise.
+ * gcc.dg/uninit-F-O0.c: Likewise.
+ * gcc.dg/uninit-G-O0.c: Likewise.
+ * gcc.dg/uninit-H-O0.c: Likewise.
+ * gcc.dg/uninit-I-O0.c: Likewise.
+ * gcc.dg/uninit-10-O0.c: Likewise.
+ * gcc.dg/uninit-11-O0.c: Likewise.
+ * gcc.dg/uninit-12-O0.c: Likewise.
+ * gcc.dg/uninit-13-O0.c: Likewise.
+ * gcc.dg/uninit-14-O0.c: Likewise.
+ * gcc.dg/uninit-15-O0.c: Likewise.
+ * gcc.dg/Wall.c: Avoid uninitialized warning.
+ * gcc.dg/Wno-all.c: Likewise.
+ * gcc.dg/pr3074-1.c: Likewise.
+
+2008-07-31 Arnaud Charlet <charlet@adacore.com>
+
+ * gnat.dg/specs/genericppc.ads: New test.
+
+2008-07-31 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/36970
+ * gcc.dg/free-1.c: New test.
+ * gcc.dg/free-2.c: New test.
+
+ PR debug/36278
+ * g++.dg/debug/namespace2.C: New test.
+
+ PR preprocessor/36649
+ * gcc.dg/pch/cpp-3.c: New test.
+ * gcc.dg/pch/cpp-3.hs: New file.
+ * gcc.dg/pch/cpp-3a.h: New file.
+ * gcc.dg/pch/cpp-3b.h: New file.
+
+2008-07-30 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/boolean_expr.ad[sb]: New test.
+
+2008-07-30 H.J. Lu <hongjiu.lu@intel.com>
+ Joey Ye <joey.ye@intel.com>
+
+ * gcc.dg/dfp/func-vararg-alternate-d128-2.c: New.
+ * gcc.dg/dfp/func-vararg-mixed-2.c: Likewise.
+ * gcc.dg/torture/stackalign/alloca-1.c: Likewise.
+ * gcc.dg/torture/stackalign/builtin-apply-1.c: Likewise.
+ * gcc.dg/torture/stackalign/builtin-apply-2.c: Likewise.
+ * gcc.dg/torture/stackalign/builtin-apply-3.c: Likewise.
+ * gcc.dg/torture/stackalign/builtin-apply-4.c: Likewise.
+ * gcc.dg/torture/stackalign/builtin-return-1.c: Likewise.
+ * gcc.dg/torture/stackalign/check.h: Likewise.
+ * gcc.dg/torture/stackalign/comp-goto-1.c: Likewise.
+ * gcc.dg/torture/stackalign/fastcall-1.c: Likewise.
+ * gcc.dg/torture/stackalign/global-1.c: Likewise.
+ * gcc.dg/torture/stackalign/inline-1.c: Likewise.
+ * gcc.dg/torture/stackalign/inline-2.c: Likewise.
+ * gcc.dg/torture/stackalign/nested-1.c: Likewise.
+ * gcc.dg/torture/stackalign/nested-2.c: Likewise.
+ * gcc.dg/torture/stackalign/nested-3.c: Likewise.
+ * gcc.dg/torture/stackalign/nested-4.c: Likewise.
+ * gcc.dg/torture/stackalign/nested-5.c: Likewise.
+ * gcc.dg/torture/stackalign/nested-6.c: Likewise.
+ * gcc.dg/torture/stackalign/non-local-goto-1.c: Likewise.
+ * gcc.dg/torture/stackalign/non-local-goto-2.c: Likewise.
+ * gcc.dg/torture/stackalign/non-local-goto-3.c: Likewise.
+ * gcc.dg/torture/stackalign/non-local-goto-4.c: Likewise.
+ * gcc.dg/torture/stackalign/non-local-goto-5.c: Likewise.
+ * gcc.dg/torture/stackalign/pr16660-1.c: Likewise.
+ * gcc.dg/torture/stackalign/pr16660-2.c: Likewise.
+ * gcc.dg/torture/stackalign/pr16660-3.c: Likewise.
+ * gcc.dg/torture/stackalign/regparm-1.c: Likewise.
+ * gcc.dg/torture/stackalign/ret-struct-1.c: Likewise.
+ * gcc.dg/torture/stackalign/setjmp-1.c: Likewise.
+ * gcc.dg/torture/stackalign/setjmp-2.c: Likewise.
+ * gcc.dg/torture/stackalign/setjmp-3.c: Likewise.
+ * gcc.dg/torture/stackalign/setjmp-4.c: Likewise.
+ * gcc.dg/torture/stackalign/sibcall-1.c: Likewise.
+ * gcc.dg/torture/stackalign/stackalign.exp: Likewise.
+ * gcc.dg/torture/stackalign/struct-1.c: Likewise.
+ * gcc.dg/torture/stackalign/vararg-1.c: Likewise.
+ * gcc.dg/torture/stackalign/vararg-2.c: Likewise.
+ * gcc.target/i386/align-main-1.c: Likewise.
+ * gcc.target/i386/align-main-2.c: Likewise.
+ * gcc.target/i386/pr32000-2.c: Likewise.
+ * gcc.target/i386/stackalign/asm-1.c: Likewise.
+ * gcc.target/i386/stackalign/return-1.c: Likewise.
+ * gcc.target/i386/stackalign/return-2.c: Likewise.
+ * gcc.target/i386/stackalign/return-3.c: Likewise.
+ * gcc.target/i386/stackalign/return-4.c: Likewise.
+ * gcc.target/i386/stackalign/return-5.c: Likewise.
+ * gcc.target/i386/stackalign/return-6.c: Likewise.
+ * gcc.target/i386/stackalign/stackalign.exp: Likewise.
+ * g++.dg/torture/stackalign/check.h: Likewise.
+ * g++.dg/torture/stackalign/eh-alloca-1.C: Likewise.
+ * g++.dg/torture/stackalign/eh-fastcall-1.C: Likewise.
+ * g++.dg/torture/stackalign/eh-global-1.C: Likewise.
+ * g++.dg/torture/stackalign/eh-inline-1.C: Likewise.
+ * g++.dg/torture/stackalign/eh-inline-2.C: Likewise.
+ * g++.dg/torture/stackalign/eh-vararg-1.C: Likewise.
+ * g++.dg/torture/stackalign/eh-vararg-2.C: Likewise.
+ * g++.dg/torture/stackalign/stackalign.exp: Likewise.
+ * g++.dg/torture/stackalign/stdcall-1.C: Likewise.
+ * g++.dg/torture/stackalign/test-unwind.h: Likewise.
+ * g++.dg/torture/stackalign/throw-1.C: Likewise.
+ * g++.dg/torture/stackalign/throw-2.C: Likewise.
+ * g++.dg/torture/stackalign/throw-3.C: Likewise.
+ * g++.dg/torture/stackalign/throw-4.C: Likewise.
+ * g++.dg/torture/stackalign/unwind-0.C: Likewise.
+ * g++.dg/torture/stackalign/unwind-1.C: Likewise.
+ * g++.dg/torture/stackalign/unwind-2.C: Likewise.
+ * g++.dg/torture/stackalign/unwind-3.C: Likewise.
+ * g++.dg/torture/stackalign/unwind-4.C: Likewise.
+ * g++.dg/torture/stackalign/unwind-5.C: Likewise.
+ * g++.dg/torture/stackalign/unwind-6.C: Likewise.
+
+ * gcc.target/i386/20060512-1.c: Add -mpreferred-stack-boundary=4.
+ (main): Move "popl" after check.
+ * gcc.target/i386/20060512-3.c: Likewise.
+
+ * gcc.target/i386/20060512-2.c: Add -mpreferred-stack-boundary=4.
+ Remove dg-error.
+
+ * gcc.target/i386/20060512-4.c: Add -mpreferred-stack-boundary=4.
+ Remove dg-warning.
+
+ * lib/target-supports.exp (check_effective_target_unaligned_stack):
+ Always return 0.
+ (check_effective_target_automatic_stack_alignment): New.
+
+2008-07-30 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/36967
+ * gfortran.dg/pr36967.f: New testcase.
+
+2008-07-30 Rafael Avila de Espindola <espindola@google.com>
+
+ * gcc.dg/visibility-14.c: New test.
+ * gcc.dg/visibility-15.c: New test.
+ * gcc.dg/visibility-16.c: New test.
+ * gcc.dg/visibility-17.c: New test.
+ * gcc.dg/visibility-18.c: New test.
+ * gcc.dg/visibility-19.c: New test.
+
+2008-07-30 Dodji Seketeli <dseketel@redhat.com>
+
+ PR c++/36767
+ * g++.dg/parse/crash42.C: New test.
+
+2008-07-30 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR 34389
+ * gcc.dg/Wconversion-pr34389.c: New.
+ * g++.dg/warn/Wconversion-pr34389.C: New.
+
+2008-07-29 Steve Ellcey <sje@cup.hp.com>
+
+ * gcc.dg/pr32370.c: Force 64 bits on IA64.
+
+2008-07-29 Paul Thomas <pault@gcc.gnu.org>
+
+ * gfortran.dg/extends_1.f03: New test.
+ * gfortran.dg/extends_2.f03: New test.
+ * gfortran.dg/extends_3.f03: New test.
+ * gfortran.dg/extends_4.f03: New test.
+ * gfortran.dg/extends_5.f03: New test.
+ * gfortran.dg/extends_6.f03: New test.
+ * gfortran.dg/private_type_6.f90: Modify error message.
+ * gfortran.dg/structure_constructor_7.f03: Modify error message.
+ * gfortran.dg/structure_constructor_8.f03: Modify error message.
+
+2008-07-29 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/36945
+ * gcc.dg/tree-ssa/ssa-pre-18.c: New testcase.
+
+2008-07-29 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/36852
+ * g++.dg/pch/array-1.C: New test.
+ * g++.dg/pch/array-1.Hs: New file.
+
+2008-07-29 Jan Hubicka <jh@suse.cz>
+
+ * gcc.dg/20040206-1.c: Expect frontend warning now.
+
+2008-07-29 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR 34985
+ * gcc.dg/pr34985.c: New.
+ * g++.dg/warn/pr34985.C: New.
+
+2008-07-29 Daniel Kraft <d@domob.eu>
+
+ PR fortran/36403
+ * gfortran.dg/char_eoshift_5.f90: New test.
+ * gfortran.dg/intrinsic_optional_char_arg_1.f90: New test.
+
+2008-07-28 Richard Guenther <rguenther@suse.de>
+
+ Merge from gimple-tuples-branch.
+
+ * gcc.c-torture/compile/20080721-1.c: New testcase.
+ * gcc.dg/torture/20080716-1.c: Likewise.
+ * gcc.dg/tree-ssa/tailcall-3.c: Likewise.
+ * gcc.dg/tree-ssa/20080530.c: Likewise.
+ * gcc.dg/20080615-1.c: Likewise.
+ * g++.dg/torture/pr36826.C: Likewise.
+ * gcc.dg/fold-alloca-1.c: Look into cleanup_cfg1 dump instead of
+ useless dump.
+ * gcc.dg/tree-ssa/pr21658.c: Update search pattern.
+ * gfortran.dg/gomp/block-1.f90: Adjust dg-error.
+ * gcc.dg/tree-ssa/20030728-1.c: Test final_cleanup instead of
+ optimized dump.
+
+2008-07-28 Simon Baldwin <simonb@google.com>
+
+ * gcc.dg/pragma-message.c: New.
+
+2008-07-27 Victor Kaplansky <victork@il.ibm.com>
+
+ PR tree-optimization/35252
+ * gcc.dg/vect/vect-complex-1.c, gcc.dg/vect/vect-complex-2.c,
+ gcc.dg/vect/fast-math-vect-complex-3.c,
+ gcc.dg/vect/vect-complex-4.c: New tests.
+
+2008-07-27 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR c++/36944
+ * g++.dg/other/pr36944.C: New.
+
+2008-07-27 Daniel Franke <franke.daniel@gmail.com>
+
+ PR fortran/36724
+ * gfortran.dg/pointer_to_substring.f90: New test.
+
+2008-07-27 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/36132
+ PR fortran/29952
+ PR fortran/36909
+ * gfortran.dg/internal_pack_4.f90: New.
+ * gfortran.dg/internal_pack_5.f90: New.
+ * gfortran.dg/array_temporaries_2.f90: New.
+
+2008-07-26 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/36934
+ * gfortran.dg/allocatable_module_1.f90: New test case.
+
+2008-07-25 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/36936
+ * gcc.target/i386/cmov8.c: New.
+ * gcc.target/i386/funcspec-10.c: Likewise.
+ * gcc.target/i386/funcspec-11.c: Likewise.
+
+2008-07-25 Joseph Myers <joseph@codesourcery.com>
+
+ * lib/target-supports.exp (check_effective_target_arm_thumb1_ok):
+ New.
+ * g++.dg/inherit/thunk8.C: Use it.
+
+2008-07-24 Jan Hubicka <jh@suse.cz>
+
+ * gcc.dg/winline-4.c: Remove.
+ * gcc.dg/pch/valid-3.hs: Remove.
+ * gcc.dg/pch/valid-3.c: Remove.
+ * g++.old-deja/g++.brendan/crash52.C: Accept returning void warning
+ * g++.old-deja/g++.jason/report.C: Likewise.
+ * testsuite/g++.dg/warn/pr23075.C: We get returning void warning
+ instead of control flow warning.
+
+2008-07-24 Daniel Kraft <d@domob.eu>
+
+ PR fortran/33141
+ * gfortran.dg/intrinsic_shadow_1.f03: New test for -Wintrinsic-shadow.
+ * gfortran.dg/intrinsic_shadow_2.f03: Ditto.
+ * gfortran.dg/intrinsic_shadow_3.f03: Ditto.
+ * gfortran.dg/intrinsic_std_1.f90: New test for -Wintrinsics-std.
+ * gfortran.dg/intrinsic_std_2.f90: Ditto.
+ * gfortran.dg/intrinsic_std_3.f90: Ditto.
+ * gfortran.dg/intrinsic_std_4.f90: Ditto.
+ * gfortran.dg/warn_std_1.f90: Removed option -Wnonstd-intrinsics.
+ * gfortran.dg/warn_std_2.f90: Replaced -Wnonstd-intrinsics by
+ -Wintrinsics-std and adapted expected errors/warnings.
+ * gfortran.dg/warn_std_3.f90: Ditto.
+ * gfortran.dg/c_sizeof_2.f90: Adapted expected error/warning message.
+ * gfortran.dg/gamma_2.f90: Ditto.
+ * gfortran.dg/selected_char_kind_3.f90: Ditto.
+ * gfortran.dg/fmt_g0_2.f08: Call with -fall-intrinsics to allow abort.
+
+2008-07-24 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/29952
+ * gfortran.dg/array_temporaries_1.f90: New test case.
+
+2008-07-23 Ian Lance Taylor <iant@google.com>
+
+ * gcc.target/i386/20080723-1.c: New test.
+
+2008-07-24 Ben Elliston <bje@au.ibm.com>
+
+ * gcc.target/spu/vector.c: New test.
+ * gcc.target/spu/vector-ansi.c: Likewise.
+
+2008-07-23 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR 35058
+ * gcc.dg/Wdeclaration-after-statement-3.c: New.
+ * gcc/testsuite/gcc.dg/Wpointer-arith.c: New.
+
+2008-07-22 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR libfortran/36852
+ * gfortran.dg/namelist_52.f90: New test.
+
+2008-07-22 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
+
+ * lib/target-supports.exp (check_effective_target_spu_auto_overlay):
+ New procedure.
+ * lib/compat.exp (compat-execute): Use it to test whether toolchain
+ supports automatic overlay generation for the SPU.
+
+2008-07-22 Daniel Kraft <d@domob.eu>
+
+ PR fortran/29835
+ * gfortran.dg/fmt_error_3.f90: New test.
+ * gfortran.dg/fmt_error_4.f90: New test.
+ * gfortran.dg/fmt_error_5.f90: New test.
+
+2008-07-22 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR 28079
+ * gcc.dg/cpp/line6.c: New.
+
+2008-07-21 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * gfortran.dg/fmt_g0_3.f08: Fix typo in expected error message.
+
+2008-07-21 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/36871
+ PR c++/36872
+ * g++.dg/ext/has_nothrow_copy.C: Rename to...
+ * g++.dg/ext/has_nothrow_copy-1.C: ... this.
+ * g++.dg/ext/has_nothrow_copy-2.C: New.
+ * g++.dg/ext/has_nothrow_copy-3.C: Likewise.
+ * g++.dg/ext/has_nothrow_copy-4.C: Likewise.
+ * g++.dg/ext/has_nothrow_copy-5.C: Likewise.
+ * g++.dg/ext/has_nothrow_copy-6.C: Likewise.
+ * g++.dg/ext/has_nothrow_copy-7.C: Likewise.
+
+2008-07-21 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR libfortran/36773
+ * gfortran.dg/zero_sized_5.f90: New test case.
+
+2008-07-21 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/36870
+ * g++.dg/ext/has_nothrow_assign_odr.C: New.
+ * g++.dg/ext/has_nothrow_copy_odr.C: Likewise.
+ * g++.dg/ext/has_nothrow_constructor_odr.C: Likewise.
+ * g++.dg/ext/has_nothrow_assign.C: Adjust.
+ * g++.dg/ext/has_nothrow_copy.C: Likewise.
+ * g++.dg/ext/has_nothrow_constructor.C: Likewise.
+
+2008-07-17 Andreas Krebbel <krebbel1@de.ibm.com>
+
+ PR target/36822
+ * gcc.target/s390/pr36822.c: New testcase.
+
+2008-07-21 Hans-Peter Nilsson <hp@axis.com>
+
+ PR middle-end/36143
+ * g++.dg/tree-ssa/pr19637.C: XFAIL.
+
+ PR rtl-optimization/33642
+ * gcc.c-torture/compile/pr11832.c: Skip for CRIS.
+ * gcc.c-torture/compile/pr33009.c: Likewise.
+
+ PR middle-end/36509
+ * gcc.dg/Wstrict-aliasing-float-ptr-int-obj.c: XFAIL.
+
+2008-07-20 Andrew Pinski <andrew_pinski@playstation.sony.com>
+
+ PR tree-opt/36879
+ * gcc.c-torture/execute/20080719-1.c: New testcase.
+
+2008-07-20 Hans-Peter Nilsson <hp@axis.com>
+
+ * gcc.dg/tree-ssa/data-dep-1.c: XFAIL.
+
+2008-07-20 Daniel Berlin <dberlin@dberlin.org>
+
+ * gcc.dg/tree-ssa/ssa-fre-7.c: XFAIL.
+ * gcc.dg/tree-ssa/ssa-fre-8.c: Ditto.
+ * gcc.dg/tree-ssa/ssa-fre-9.c: Ditto.
+ * gcc.dg/tree-ssa/ssa-fre-13.c: Ditto.
+ * gcc.dg/tree-ssa/ssa-fre-14.c: Ditto.
+ * gcc.dg/tree-ssa/ssa-fre-17.c: Ditto.
+ * gcc.dg/tree-ssa/ssa-pre-15.c: Ditto.
+ * gcc.dg/tree-ssa/loadpre1.c: PASS.
+
+2008-07-19 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/36877
+ * gcc.dg/gomp/atomic-11.c: New test.
+
+2008-07-19 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/36795
+ * char_expr_1.f90: New.
+ * char_expr_2.f90: New.
+
+2008-07-19 Olivier Hainque <hainque@adacore.com>
+
+ * gcc.dg/mallign.c: New test.
+ * gnat.dg/allocator_maxalign1.adb: New test.
+ * gnat.dg/test_allocator_maxalign2.adb: Main caller for ...
+ * gnat.dg/allocator_maxalign2.ad[bs]: New test.
+
+2008-07-19 Tobias Burnus <burnus@net-b.de>
+
+ * gfortran.dg/intrinsic_argument_conformance_2.f90: New.
+ * gfortran.dg/zero_sized_1.f90: Fix conformance bugs.
+
+2008-07-18 Kris Van Hees <kris.van.hees@oracle.com>
+
+ * g++.dg/ext/utf-array.C: Fix broken merge/checkin.
+ * g++.dg/ext/utf-array-short-wchar.C: Idem
+ * gcc.dg/utf-array.c: Idem
+ * gcc.dg/utf-array-short-wchar.c: Idem
+
+2008-07-18 Joseph Myers <joseph@codesourcery.com>
+
+ * gcc.dg/fshort-wchar.c: Use -Wl,--no-wchar-size-warning on
+ arm*-*-*eabi.
+
+2008-07-18 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/36786
+ * gcc.target/i386/pr36786.c: New test.
+
+2008-07-18 Dodji Seketeli <dseketel@redhat.com>
+
+ PR c++/36407
+ * g++.dg/conversion/op5.C: New testcase.
+
+2008-07-18 Kris Van Hees <kris.van.hees@oracle.com>
+
+ * g++.dg/ext/utf-array.C: Fix broken merge/checkin.
+ * g++.dg/ext/utf-array-short-wchar.C: Idem
+ * gcc.dg/utf-array.c: Idem
+ * gcc.dg/utf-array-short-wchar.c: Idem
+
+2008-07-18 Kris Van Hees <kris.van.hees@oracle.com>
+
+ Tests for char16_t and char32_t support.
+ * g++.dg/ext/utf-array.C: New
+ * g++.dg/ext/utf-array-short-wchar.C: New
+ * g++.dg/ext/utf-rtti.C: New
+ * g++.dg/ext/utf-type.c: New
+ * gcc.dg/utf-array.c: New
+ * gcc.dg/utf-array-short-wchar.c: New
+ * gcc.dg/utf-inc-init.c: New
+ * gcc.dg/utf-type.c: New
+
+2008-07-18 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR middle-end/36859
+ * gcc.target/i386/vararg-2.c: New.
+
+2008-07-18 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR middle-end/36858
+ * gcc.target/i386/vararg-1.c: New.
+
+2008-07-18 Tobias Burnus <burnus@net-b.de>
+
+ * gfortran.dg/parameter_array_init_4.f90: Silence pedantic warning.
+
+2008-07-17 Olivier Hainque <hainque@adacore.com>
+
+ * gnat.dg/tree_static_def.ad[bs]: Support for ...
+ * gnat.dg/tree_static_use.adb: New test.
+ * gnat.dg/decl_ctx_def.ads: Support for ...
+ * gnat.dg/decl_ctx_use.ad[bs]: New test.
+
+2008-07-17 Julian Brown <julian@codesourcery.com>
+ Mark Mitchell <mark@codesourcery.com>
+
+ * g++.dg/ext/visibility/arm3.C: Add explanatory text. Skip on
+ non-DLL targets.
+ * g++.dg/ext/visibility/arm1.C: Skip on non-DLL targets.
+
+2008-07-17 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/36855
+ * g++.dg/ext/has_trivial_destructor.C: Rename to...
+ * g++.dg/ext/has_trivial_destructor-1.C: ... this.
+ * g++.dg/ext/has_trivial_destructor-2.C: New.
+
+2008-07-17 Paolo Bonzini <bonzini@gnu.org>
+
+ PR rtl-optimization/36753
+ * gcc.target/i386/pr36753.c: New.
+
+2008-07-17 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/36825
+ PR fortran/36824
+ * gfortran.dg/rank_2.f90: Add additional array-rank test.
+ * gfortran.dg/array_4.f90: New.
+
+2008-07-17 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR testsuite/36443
+ * objc.dg/gnu-encoding/gnu-encoding.exp: Temporarily unset
+ GCC_EXEC_PREFIX from environment when running $HOSTCC.
+
+2008-07-16 Dodji Seketeli <dseketel@redhat.com>
+
+ PR c++/13699
+ * g++.dg/lookup/extern-c-redecl.C: New test.
+
2008-07-15 Richard Guenther <rguenther@suse.de>
PR middle-end/36369
@@ -3179,7 +4323,7 @@
PR fortran/35780
* gfortran.dg/simplify_argN_1.f90: New test.
-2008-04-06 Tobias Schlüter <tobi@gcc.gnu.org>
+2008-04-06 Tobias Schl�ter <tobi@gcc.gnu.org>
PR fortran/35832
* gfortran.dg/io_constraints_2.f90: Adapt to new error message.
diff --git a/gcc/testsuite/ChangeLog-1993-2007 b/gcc/testsuite/ChangeLog-1993-2007
index c7a8e3e2ffe..2447b7f8593 100644
--- a/gcc/testsuite/ChangeLog-1993-2007
+++ b/gcc/testsuite/ChangeLog-1993-2007
@@ -7537,7 +7537,7 @@
vectorizable.
2007-07-01 Uros Bizjak <ubizjak@gmail.com>
- Volker Reichelt <reichelt@netcologne.de>
+ Volker Reichelt <v.reichelt@netcologne.de>
PR middle-end/32559
* gcc.dg/pr32559.c: New test.
@@ -11152,7 +11152,7 @@
PR fortran/31011
* gfortran.dg/parameter_array_section_2.f90: New test.
-2007-03-08 Volker Reichelt <reichelt@netcologne.de>
+2007-03-08 Volker Reichelt <v.reichelt@netcologne.de>
PR c++/30852
* g++.dg/ext/offsetof1.C: Add cases with volatile.
diff --git a/gcc/testsuite/g++.dg/conversion/op5.C b/gcc/testsuite/g++.dg/conversion/op5.C
new file mode 100644
index 00000000000..69ef996d5c2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/conversion/op5.C
@@ -0,0 +1,20 @@
+// Contributed by Dodji Seketeli <dseketel@redhat.com>
+// Origin: PR c++/36407
+// { dg-do compile }
+
+struct A
+{
+ A (const A&);
+};
+
+struct B
+{
+ operator A&();
+};
+
+void
+foo (const B& b)
+{
+ const A a = b; // { dg-error "conversion from 'const B' to non-scalar type 'const A' requested" }
+}
+
diff --git a/gcc/testsuite/g++.dg/cpp0x/bracket3.C b/gcc/testsuite/g++.dg/cpp0x/bracket3.C
index eb1ef02297d..4ef7a0e9d30 100644
--- a/gcc/testsuite/g++.dg/cpp0x/bracket3.C
+++ b/gcc/testsuite/g++.dg/cpp0x/bracket3.C
@@ -3,3 +3,8 @@
template<int N> struct X {};
X<1 >> 2> x; // { dg-warning "will be treated as|suggest parentheses" }
+
+// From cp/parser.c
+typedef int Y;
+template <int V> struct Foo {};
+Foo<Y () >> 5> r; // { dg-warning "will be treated as|suggest parentheses" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/bracket4.C b/gcc/testsuite/g++.dg/cpp0x/bracket4.C
index 2ac5ff3d734..c0743fb7ff5 100644
--- a/gcc/testsuite/g++.dg/cpp0x/bracket4.C
+++ b/gcc/testsuite/g++.dg/cpp0x/bracket4.C
@@ -1,6 +1,5 @@
// { dg-do "compile" }
// { dg-options "-std=c++0x" }
-
template<typename T>
struct vector {
};
@@ -25,3 +24,12 @@ void f()
{
vector<vector<int>>() + 2;
}
+
+// PR c++/36460
+template <class a>
+class A {};
+template <class b>
+class B {};
+
+A<B<void()>> x;
+
diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype12.C b/gcc/testsuite/g++.dg/cpp0x/decltype12.C
new file mode 100644
index 00000000000..77c794bcf09
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/decltype12.C
@@ -0,0 +1,38 @@
+// { dg-do compile }
+// { dg-options "-std=c++0x" }
+template<typename T, typename U>
+struct is_same
+{
+ static const bool value = false;
+};
+
+template<typename T>
+struct is_same<T, T>
+{
+ static const bool value = true;
+};
+
+int&& f(const int&) {}
+int&& (*fp)(const int&) = f;
+int&& (&fr)(const int&) = f;
+
+struct X { int&& f(const int&); };
+
+int&& (X::*mfp)(const int&) = &X::f;
+
+void g(X& xr, X* xp)
+{
+ int i;
+ static_assert(is_same<decltype(f(i)), int&&>::value, "direct call");
+ static_assert(is_same<decltype(fp(i)), int&&>::value, "pointer");
+ static_assert(is_same<decltype((*fp)(i)), int&&>::value,
+ "dereferenced pointer");
+ static_assert(is_same<decltype(fr(i)), int&&>::value,
+ "reference");
+ static_assert(is_same<decltype(xr.f(i)), int&&>::value,
+ "member function call");
+ static_assert(is_same<decltype((xr.*mfp)(i)), int&&>::value,
+ "member function pointer with .*");
+ static_assert(is_same<decltype((xp->*mfp)(i)), int&&>::value,
+ "member function pointer with ->*");
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted1.C b/gcc/testsuite/g++.dg/cpp0x/defaulted1.C
new file mode 100644
index 00000000000..e8fe37eb39a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/defaulted1.C
@@ -0,0 +1,43 @@
+// Positive test for defaulted/deleted fns
+// { dg-do run }
+// { dg-options "-std=c++0x" }
+
+struct A
+{
+ int i;
+ A() = default;
+ A(const A&) = delete;
+ A& operator=(const A&) = default;
+ ~A();
+};
+
+A::~A() = default;
+
+void f() = delete;
+
+struct B
+{
+ int i;
+ B() = default;
+};
+
+int main()
+{
+ A a1, a2;
+ B b = {1};
+ a1 = a2;
+}
+
+// fns defaulted in class defn are trivial
+struct C
+{
+ C() = default;
+ C(const C&) = default;
+ C& operator=(const C&) = default;
+ ~C() = default;
+};
+
+union U
+{
+ C c;
+};
diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted2.C b/gcc/testsuite/g++.dg/cpp0x/defaulted2.C
new file mode 100644
index 00000000000..ea06d92530f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/defaulted2.C
@@ -0,0 +1,66 @@
+// Negative test for defaulted/deleted fns.
+// { dg-options "-std=c++0x" }
+
+void f(); // { dg-error "previous" }
+void f() = delete; // { dg-error "deleted" }
+
+struct A
+{
+ A() { } // { dg-error "previous" }
+ void f() = default; // { dg-error "default" }
+};
+
+A::A() = default; // { dg-error "redefinition" }
+
+void g() {} // { dg-error "previous" }
+void g() = delete; // { dg-error "redefinition" }
+
+struct B
+{
+ B() = default;
+};
+
+const B b; // { dg-error "uninitialized const" }
+
+struct C
+{
+ virtual void f() = delete; // { dg-error "overriding deleted" }
+};
+
+struct D: public C
+{
+ virtual void f(); // { dg-error "non-deleted function" }
+};
+
+struct E
+{
+ const B b;
+ E() { } // { dg-error "uninitialized" }
+};
+
+struct F
+{
+ F() = default;
+ F(const F&) = delete; // { dg-error "deleted" }
+};
+
+struct G
+{
+ G();
+};
+
+// ctor defaulted after class defn is not trivial
+G::G() = default;
+
+union U
+{
+ G g; // { dg-error "constructor" }
+};
+
+int main()
+{
+ F f;
+ F f2(f); // { dg-error "used" }
+ B* b = new const B; // { dg-error "uninitialized const" }
+}
+
diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted3.C b/gcc/testsuite/g++.dg/cpp0x/defaulted3.C
new file mode 100644
index 00000000000..efde415936d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/defaulted3.C
@@ -0,0 +1,16 @@
+// PR c++/37006
+// { dg-options "-std=c++0x" }
+
+template<class T>
+struct A {
+ template<class U>
+ bool operator==(const A<U>&) = delete; // { dg-error "deleted function" }
+ operator bool () { return true; }
+};
+
+int main()
+{
+ A<int> a1;
+ A<void> a2;
+ if(a1 == a2) {} // { dg-error "used here" }
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist1.C b/gcc/testsuite/g++.dg/cpp0x/initlist1.C
index b7583da7829..ff45f7176f6 100644
--- a/gcc/testsuite/g++.dg/cpp0x/initlist1.C
+++ b/gcc/testsuite/g++.dg/cpp0x/initlist1.C
@@ -56,6 +56,9 @@ void i(initializer_list<int> l)
if (p != l.end()) abort();
}
+struct U { U(int, int) {} };
+U ua[] = { { 3, 2 } };
+
int main()
{
g({1,2,3});
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist5.C b/gcc/testsuite/g++.dg/cpp0x/initlist5.C
index 0d02fd42d7f..fbdc673948f 100644
--- a/gcc/testsuite/g++.dg/cpp0x/initlist5.C
+++ b/gcc/testsuite/g++.dg/cpp0x/initlist5.C
@@ -19,3 +19,7 @@ C c2 = { 1.1, 2 }; // { dg-error "narrowing" }
int j { 1 }; // initialize to 1
int k {}; // initialize to 0
+
+// PR c++/39693
+double d = 1.1;
+float fa[] = { d, 1.1 }; // { dg-error "narrowing conversion of 'd'" }
diff --git a/gcc/testsuite/g++.dg/debug/namespace2.C b/gcc/testsuite/g++.dg/debug/namespace2.C
new file mode 100644
index 00000000000..f70bc8fada8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/debug/namespace2.C
@@ -0,0 +1,8 @@
+// PR debug/36278
+// { dg-do compile }
+
+namespace N
+{
+ typedef void T;
+}
+using N::T;
diff --git a/gcc/testsuite/g++.dg/eh/async-unwind2.C b/gcc/testsuite/g++.dg/eh/async-unwind2.C
new file mode 100644
index 00000000000..694fad6aca1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/eh/async-unwind2.C
@@ -0,0 +1,254 @@
+// PR rtl-optimization/36419
+// { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } }
+// { dg-options "-Os -fasynchronous-unwind-tables -fpic -fno-inline" }
+
+#include <stdarg.h>
+
+extern "C" void abort ();
+
+extern "C"
+{
+ struct R { int r1; unsigned short r2[1]; };
+ int bar1 (unsigned short *, int, short) throw ();
+ void bar2 (R *) throw ();
+ void bar3 (R **, const unsigned short *, int) throw ();
+ void bar4 (R **, const char *) throw ();
+ void bar5 (void *, const char *, ...);
+}
+
+struct S
+{
+ R *s;
+ struct T { };
+ S (R *x, T *) { s = x; }
+ ~S () { bar2 (s); }
+ S &operator= (const S &x);
+ S &operator+= (const S &x);
+ S sfn1 (const S &x) const;
+ friend S operator+ (const S &x1, const S &x2);
+ static S sfn2 (int i)
+ {
+ unsigned short q[33];
+ R *p = 0;
+ bar3 (&p, q, bar1 (q, i, 10));
+ return S (p, (T *) 0);
+ }
+ static S sfn3 (const char *x)
+ {
+ R *p = 0;
+ bar4 (&p, x);
+ return S (p, (T *) 0);
+ }
+};
+
+struct U { };
+template <class C> unsigned char operator >>= (const U &, C &);
+
+struct V;
+struct W
+{
+ V *w;
+ unsigned char is () const;
+};
+
+template <class T> struct X : public W
+{
+ inline ~X ();
+ X ();
+ X (const W &);
+ T *operator -> () const;
+};
+
+struct E
+{
+ E ();
+ E (const S &, const X <V> &);
+ E (E const &);
+ ~E ();
+ E &operator = (E const &);
+};
+
+struct V
+{
+ virtual void release () throw ();
+};
+
+template <class T> X <T>::~X ()
+{
+ if (w)
+ w->release ();
+}
+
+struct Y
+{
+ virtual U yfn1 (const S &);
+};
+
+struct Z;
+
+X <V> baz1 (const S &) throw (E);
+X <Z> baz2 (const X <Z> &) throw (E);
+
+template <typename T> X<T>::X ()
+{
+ w = __null;
+}
+
+template <typename T> X<T>::X (W const &)
+{
+ w = __null;
+}
+
+U Y::yfn1 (const S &)
+{
+ throw 12;
+}
+
+Y y;
+
+template <typename T> T *X<T>::operator -> () const
+{
+ return &y;
+}
+
+X <V> baz1 (const S &) throw (E)
+{
+ return X<V> ();
+}
+
+E::E ()
+{
+}
+
+E::~E ()
+{
+}
+
+X <Z> baz2 (const X <Z> &) throw (E)
+{
+ throw E ();
+}
+
+int bar1 (unsigned short *, int, short) throw ()
+{
+ asm volatile ("" : : : "memory");
+ return 0;
+}
+
+void bar2 (R *) throw ()
+{
+ asm volatile ("" : : : "memory");
+}
+
+void bar3 (R **, const unsigned short *, int) throw ()
+{
+ asm volatile ("" : : : "memory");
+}
+
+void bar4 (R **, const char *) throw ()
+{
+ asm volatile ("" : : : "memory");
+}
+
+int events[2];
+void *sp;
+
+void bar5 (void *p, const char *s, ...)
+{
+ va_list ap;
+ va_start (ap, s);
+ if (p)
+ throw 19;
+ switch (*s)
+ {
+ case 't':
+ if (events[0] != va_arg (ap, int))
+ abort ();
+ events[0]++;
+ break;
+ case 'f':
+ abort ();
+ case 'c':
+ if (events[1] != va_arg (ap, int))
+ abort ();
+ events[1]++;
+ if (events[1] == 1)
+ sp = va_arg (ap, void *);
+ else if (sp != va_arg (ap, void *))
+ abort ();
+ break;
+ }
+}
+
+unsigned char W::is () const
+{
+ return 1;
+}
+
+S &S::operator += (const S &)
+{
+ return *this;
+}
+
+template <class C> unsigned char operator >>= (const U &, C &)
+{
+ throw 1;
+}
+
+template X<Y>::X ();
+template X<Z>::X ();
+template unsigned char operator >>= (const U &, X<Z> &);
+template X<Y>::X (W const &);
+
+template Y *X<Y>::operator-> () const;
+
+X <Z> foo () throw ()
+{
+ X <Z> a;
+ X <Y> b;
+ try
+ {
+ b = X <Y> (baz1 (S::sfn3 ("defg")));
+ }
+ catch (E &)
+ {
+ }
+ if (b.is ())
+ {
+ for (int n = 0; n < 10; n++)
+ {
+ S c = S::sfn3 ("abcd");
+ c += S::sfn2 (n);
+ X <Z> d;
+ try
+ {
+ bar5 ((void *) 0, "trying %d\n", n);
+ if ((b->yfn1 (c) >>= d))
+ if (d.is ())
+ {
+ bar5 ((void *) 0, "failure1 on %d\n", n);
+ a = baz2 (d);
+ if (a.is ())
+ break;
+ }
+ bar5 ((void *) 0, "failure2 on %d\n", n);
+ }
+ catch (...)
+ {
+ void *p;
+ asm volatile ("movl %%esp, %0" : "=r" (p));
+ bar5 ((void *) 0, "caught %d %p\n", n, p);
+ }
+ }
+ }
+ return a;
+}
+
+int
+main ()
+{
+ foo ();
+ if (events[0] != 10 || events[1] != 10)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/expr/anew4.C b/gcc/testsuite/g++.dg/expr/anew4.C
index d86d5251412..4ce1d8899f9 100644
--- a/gcc/testsuite/g++.dg/expr/anew4.C
+++ b/gcc/testsuite/g++.dg/expr/anew4.C
@@ -1,5 +1,4 @@
-// { dg-do run { xfail *-*-* } }
-// XFAILed until PR2123 is fixed
+// { dg-do run }
// PR 11228: array operator new, with zero-initialization and a variable sized array.
// Regression test for PR
// Author: Matt Austern <austern@apple.com>
diff --git a/gcc/testsuite/g++.dg/ext/has_nothrow_assign.C b/gcc/testsuite/g++.dg/ext/has_nothrow_assign.C
index 525cac7aa48..73a904eac25 100644
--- a/gcc/testsuite/g++.dg/ext/has_nothrow_assign.C
+++ b/gcc/testsuite/g++.dg/ext/has_nothrow_assign.C
@@ -136,19 +136,13 @@ int main()
assert (PTEST (C));
assert (NTEST (C[]));
assert (PTEST (D));
-#ifndef __PIC__
- assert (PTEST (E));
-#endif
+ assert (NTEST (E));
assert (NTEST (E1));
assert (PTEST (F));
assert (PTEST (G));
-#ifndef __PIC__
- assert (PTEST (H));
-#endif
+ assert (NTEST (H));
assert (NTEST (H1));
-#ifndef __PIC__
- assert (PTEST (I));
-#endif
+ assert (NTEST (I));
assert (NTEST (I1));
assert (PTEST (J));
assert (NTEST (const K));
diff --git a/gcc/testsuite/g++.dg/ext/has_nothrow_assign_odr.C b/gcc/testsuite/g++.dg/ext/has_nothrow_assign_odr.C
new file mode 100644
index 00000000000..c38d76d44a6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/has_nothrow_assign_odr.C
@@ -0,0 +1,16 @@
+// PR c++/36870
+// { dg-do "run" }
+#include <cassert>
+
+struct S { const S& operator= (const S&); };
+
+bool f ();
+
+int main ()
+{
+ assert (__has_nothrow_assign (S) == f ());
+}
+
+const S& S::operator= (const S&) { }
+
+bool f () { return __has_nothrow_assign (S); }
diff --git a/gcc/testsuite/g++.dg/ext/has_nothrow_constructor.C b/gcc/testsuite/g++.dg/ext/has_nothrow_constructor.C
index 7e747bcd11e..60e9be8d0be 100644
--- a/gcc/testsuite/g++.dg/ext/has_nothrow_constructor.C
+++ b/gcc/testsuite/g++.dg/ext/has_nothrow_constructor.C
@@ -97,9 +97,7 @@ int main()
assert (PTEST (C));
assert (PTEST (C[]));
assert (PTEST (D));
-#ifndef __PIC__
- assert (PTEST (E));
-#endif
+ assert (NTEST (E));
assert (NTEST (E1));
assert (NTEST (F));
assert (NTEST (G));
diff --git a/gcc/testsuite/g++.dg/ext/has_nothrow_constructor_odr.C b/gcc/testsuite/g++.dg/ext/has_nothrow_constructor_odr.C
new file mode 100644
index 00000000000..775e74a2631
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/has_nothrow_constructor_odr.C
@@ -0,0 +1,16 @@
+// PR c++/36870
+// { dg-do "run" }
+#include <cassert>
+
+struct S { S (); };
+
+bool f ();
+
+int main ()
+{
+ assert (__has_nothrow_constructor (S) == f ());
+}
+
+S::S () { }
+
+bool f () { return __has_nothrow_constructor (S); }
diff --git a/gcc/testsuite/g++.dg/ext/has_nothrow_copy.C b/gcc/testsuite/g++.dg/ext/has_nothrow_copy-1.C
index 6843d51b4c4..e8507cf582c 100644
--- a/gcc/testsuite/g++.dg/ext/has_nothrow_copy.C
+++ b/gcc/testsuite/g++.dg/ext/has_nothrow_copy-1.C
@@ -126,19 +126,13 @@ int main()
assert (PTEST (C));
assert (NTEST (C[]));
assert (PTEST (D));
-#ifndef __PIC__
- assert (PTEST (E));
-#endif
+ assert (NTEST (E));
assert (NTEST (E1));
assert (PTEST (F));
assert (PTEST (G));
-#ifndef __PIC__
- assert (PTEST (H));
-#endif
+ assert (NTEST (H));
assert (NTEST (H1));
-#ifndef __PIC__
- assert (PTEST (I));
-#endif
+ assert (NTEST (I));
assert (NTEST (I1));
assert (PTEST (J));
diff --git a/gcc/testsuite/g++.dg/ext/has_nothrow_copy-2.C b/gcc/testsuite/g++.dg/ext/has_nothrow_copy-2.C
new file mode 100644
index 00000000000..276b11d574c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/has_nothrow_copy-2.C
@@ -0,0 +1,12 @@
+// PR c++/36871
+// { dg-do "run" }
+#include <cassert>
+
+struct A { template <class T> A (T) throw (int); };
+struct B { B (B&) throw (); template <class T> B (T) throw (int); };
+
+int main ()
+{
+ assert (__has_nothrow_copy (A));
+ assert (__has_nothrow_copy (B));
+}
diff --git a/gcc/testsuite/g++.dg/ext/has_nothrow_copy-3.C b/gcc/testsuite/g++.dg/ext/has_nothrow_copy-3.C
new file mode 100644
index 00000000000..2fbcf8c8096
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/has_nothrow_copy-3.C
@@ -0,0 +1,13 @@
+// PR c++/36871
+// { dg-do "run" }
+#include <cassert>
+
+struct F {
+ F (const F&) throw () { }
+ template <class T> F (T) throw () { }
+};
+
+int main ()
+{
+ assert (__has_nothrow_copy (F));
+}
diff --git a/gcc/testsuite/g++.dg/ext/has_nothrow_copy-4.C b/gcc/testsuite/g++.dg/ext/has_nothrow_copy-4.C
new file mode 100644
index 00000000000..4bd7475ea7c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/has_nothrow_copy-4.C
@@ -0,0 +1,13 @@
+// PR c++/36872
+// { dg-do "run" }
+#include <cassert>
+
+struct S {
+ S (const S&) throw ();
+ S (...) throw (int);
+};
+
+int main ()
+{
+ assert (__has_nothrow_copy (S));
+}
diff --git a/gcc/testsuite/g++.dg/ext/has_nothrow_copy-5.C b/gcc/testsuite/g++.dg/ext/has_nothrow_copy-5.C
new file mode 100644
index 00000000000..051675c4d00
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/has_nothrow_copy-5.C
@@ -0,0 +1,13 @@
+// PR c++/36872
+// { dg-do "run" }
+#include <cassert>
+
+struct S {
+ S (const S&) throw ();
+ S (int) throw (int);
+};
+
+int main ()
+{
+ assert (__has_nothrow_copy (S));
+}
diff --git a/gcc/testsuite/g++.dg/ext/has_nothrow_copy-6.C b/gcc/testsuite/g++.dg/ext/has_nothrow_copy-6.C
new file mode 100644
index 00000000000..4330edd2941
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/has_nothrow_copy-6.C
@@ -0,0 +1,12 @@
+// { dg-do "run" }
+#include <cassert>
+
+struct S {
+ S (S&) throw ();
+ S (const S&, int) throw (int);
+};
+
+int main ()
+{
+ assert (__has_nothrow_copy (S));
+}
diff --git a/gcc/testsuite/g++.dg/ext/has_nothrow_copy-7.C b/gcc/testsuite/g++.dg/ext/has_nothrow_copy-7.C
new file mode 100644
index 00000000000..a85224c3abc
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/has_nothrow_copy-7.C
@@ -0,0 +1,13 @@
+// { dg-do "run" }
+// { dg-options "-std=c++0x" }
+#include <cassert>
+
+struct S {
+ S (const S&) throw ();
+ S (S&&) throw (int);
+};
+
+int main ()
+{
+ assert (__has_nothrow_copy (S));
+}
diff --git a/gcc/testsuite/g++.dg/ext/has_nothrow_copy_odr.C b/gcc/testsuite/g++.dg/ext/has_nothrow_copy_odr.C
new file mode 100644
index 00000000000..499a11e25be
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/has_nothrow_copy_odr.C
@@ -0,0 +1,16 @@
+// PR c++/36870
+// { dg-do "run" }
+#include <cassert>
+
+struct S { S (const S&); };
+
+bool f ();
+
+int main ()
+{
+ assert (__has_nothrow_copy (S) == f ());
+}
+
+S::S (const S&) { }
+
+bool f () { return __has_nothrow_copy (S); }
diff --git a/gcc/testsuite/g++.dg/ext/has_trivial_destructor.C b/gcc/testsuite/g++.dg/ext/has_trivial_destructor-1.C
index 719f05fd7a5..719f05fd7a5 100644
--- a/gcc/testsuite/g++.dg/ext/has_trivial_destructor.C
+++ b/gcc/testsuite/g++.dg/ext/has_trivial_destructor-1.C
diff --git a/gcc/testsuite/g++.dg/ext/has_trivial_destructor-2.C b/gcc/testsuite/g++.dg/ext/has_trivial_destructor-2.C
new file mode 100644
index 00000000000..f9dacf179e1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/has_trivial_destructor-2.C
@@ -0,0 +1,3 @@
+// PR c++/36855
+
+typedef char assert_0 [__has_trivial_destructor (int&) ? 1 : -1];
diff --git a/gcc/testsuite/g++.dg/ext/utf-array-short-wchar.C b/gcc/testsuite/g++.dg/ext/utf-array-short-wchar.C
new file mode 100644
index 00000000000..43ae508d64d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/utf-array-short-wchar.C
@@ -0,0 +1,36 @@
+/* Contributed by Kris Van Hees <kris.van.hees@oracle.com> */
+/* Expected errors for char16_t/char32_t string literals. */
+/* { dg-do compile } */
+/* { dg-options "-std=c++0x -fshort-wchar" } */
+
+const char s_0[] = "ab";
+const char s_1[] = u"ab"; /* { dg-error "from wide string" } */
+const char s_2[] = U"ab"; /* { dg-error "from wide string" } */
+const char s_3[] = L"ab"; /* { dg-error "from wide string" } */
+
+const char16_t s16_0[] = "ab"; /* { dg-error "from non-wide" } */
+const char16_t s16_1[] = u"ab";
+const char16_t s16_2[] = U"ab"; /* { dg-error "from incompatible" } */
+const char16_t s16_3[] = L"ab"; /* { dg-error "from incompatible" } */
+
+const char16_t s16_4[0] = u"ab"; /* { dg-warning "chars is too long" } */
+const char16_t s16_5[1] = u"ab"; /* { dg-warning "chars is too long" } */
+const char16_t s16_6[2] = u"ab"; /* { dg-warning "chars is too long" } */
+const char16_t s16_7[3] = u"ab";
+const char16_t s16_8[4] = u"ab";
+
+const char32_t s32_0[] = "ab"; /* { dg-error "from non-wide" } */
+const char32_t s32_1[] = u"ab"; /* { dg-error "from incompatible" } */
+const char32_t s32_2[] = U"ab";
+const char32_t s32_3[] = L"ab"; /* { dg-error "from incompatible" } */
+
+const char32_t s32_4[0] = U"ab"; /* { dg-warning "chars is too long" } */
+const char32_t s32_5[1] = U"ab"; /* { dg-warning "chars is too long" } */
+const char32_t s32_6[2] = U"ab"; /* { dg-warning "chars is too long" } */
+const char32_t s32_7[3] = U"ab";
+const char32_t s32_8[4] = U"ab";
+
+const wchar_t sw_0[] = "ab"; /* { dg-error "from non-wide" } */
+const wchar_t sw_1[] = u"ab"; /* { dg-error "from incompatible" } */
+const wchar_t sw_2[] = U"ab"; /* { dg-error "from incompatible" } */
+const wchar_t sw_3[] = L"ab";
diff --git a/gcc/testsuite/g++.dg/ext/utf-array.C b/gcc/testsuite/g++.dg/ext/utf-array.C
new file mode 100644
index 00000000000..65d8453d99d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/utf-array.C
@@ -0,0 +1,36 @@
+/* Contributed by Kris Van Hees <kris.van.hees@oracle.com> */
+/* Expected errors for char16_t/char32_t string literals. */
+/* { dg-do compile } */
+/* { dg-options "-std=c++0x" } */
+
+const char s_0[] = "ab";
+const char s_1[] = u"ab"; /* { dg-error "from wide string" } */
+const char s_2[] = U"ab"; /* { dg-error "from wide string" } */
+const char s_3[] = L"ab"; /* { dg-error "from wide string" } */
+
+const char16_t s16_0[] = "ab"; /* { dg-error "from non-wide" } */
+const char16_t s16_1[] = u"ab";
+const char16_t s16_2[] = U"ab"; /* { dg-error "from incompatible" } */
+const char16_t s16_3[] = L"ab"; /* { dg-error "from incompatible" } */
+
+const char16_t s16_4[0] = u"ab"; /* { dg-warning "chars is too long" } */
+const char16_t s16_5[1] = u"ab"; /* { dg-warning "chars is too long" } */
+const char16_t s16_6[2] = u"ab"; /* { dg-warning "chars is too long" } */
+const char16_t s16_7[3] = u"ab";
+const char16_t s16_8[4] = u"ab";
+
+const char32_t s32_0[] = "ab"; /* { dg-error "from non-wide" } */
+const char32_t s32_1[] = u"ab"; /* { dg-error "from incompatible" } */
+const char32_t s32_2[] = U"ab";
+const char32_t s32_3[] = L"ab"; /* { dg-error "from incompatible" } */
+
+const char32_t s32_4[0] = U"ab"; /* { dg-warning "chars is too long" } */
+const char32_t s32_5[1] = U"ab"; /* { dg-warning "chars is too long" } */
+const char32_t s32_6[2] = U"ab"; /* { dg-warning "chars is too long" } */
+const char32_t s32_7[3] = U"ab";
+const char32_t s32_8[4] = U"ab";
+
+const wchar_t sw_0[] = "ab"; /* { dg-error "from non-wide" } */
+const wchar_t sw_1[] = u"ab"; /* { dg-error "from incompatible" } */
+const wchar_t sw_2[] = U"ab"; /* { dg-error "from incompatible" } */
+const wchar_t sw_3[] = L"ab";
diff --git a/gcc/testsuite/g++.dg/ext/utf-rtti.C b/gcc/testsuite/g++.dg/ext/utf-rtti.C
new file mode 100644
index 00000000000..b5d201b4d7a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/utf-rtti.C
@@ -0,0 +1,12 @@
+/* Contributed by Kris Van Hees <kris.van.hees@oracle.com> */
+/* Ensure that typeinfo data is generated for char16_t/char32_t. */
+/* { dg-do link } */
+/* { dg-options "-std=c++0x" } */
+
+#include <typeinfo>
+
+int main(void)
+{
+ typeid(char16_t).name();
+ typeid(char32_t).name();
+}
diff --git a/gcc/testsuite/g++.dg/ext/utf-type.C b/gcc/testsuite/g++.dg/ext/utf-type.C
new file mode 100644
index 00000000000..41a83ff2ef0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/utf-type.C
@@ -0,0 +1,15 @@
+/* Contributed by Kris Van Hees <kris.van.hees@oracle.com> */
+/* Ensure that __CHAR16_TYPE__ and __CHAR32_TYPE__ exist, match the types they
+ are the underlying data type for. */
+/* { dg-do run } */
+/* { dg-options "-std=c++0x -Wall -Werror" } */
+
+extern "C" void abort (void);
+
+int main ()
+{
+ if (sizeof (__CHAR16_TYPE__) != sizeof (char16_t))
+ abort();
+ if (sizeof (__CHAR32_TYPE__) != sizeof (char32_t))
+ abort();
+}
diff --git a/gcc/testsuite/g++.dg/ext/visibility/arm1.C b/gcc/testsuite/g++.dg/ext/visibility/arm1.C
index 8b4949492a1..2c2e3d0664a 100644
--- a/gcc/testsuite/g++.dg/ext/visibility/arm1.C
+++ b/gcc/testsuite/g++.dg/ext/visibility/arm1.C
@@ -1,4 +1,5 @@
// { dg-do compile { target arm*-*-eabi* arm*-*-symbianelf* } }
+// { dg-require-dll "" }
// { dg-options "-fvisibility=hidden" }
// Most class data should be exported.
// { dg-final { scan-not-hidden "_ZTV1S" } }
diff --git a/gcc/testsuite/g++.dg/ext/visibility/arm3.C b/gcc/testsuite/g++.dg/ext/visibility/arm3.C
index f97813d7f21..9be7082ce1d 100644
--- a/gcc/testsuite/g++.dg/ext/visibility/arm3.C
+++ b/gcc/testsuite/g++.dg/ext/visibility/arm3.C
@@ -1,6 +1,30 @@
// { dg-do compile { target arm*-*-*eabi* } }
+// { dg-require-dll "" }
// { dg-options "-fvisibility=hidden" }
-// Class data should be exported.
+
+/* From ARM C++ ABI \S 3.2.5.5:
+
+ A class should be exported unless explicitly tagged otherwise.
+
+ This admonition applies even on DLL-based systems where hidden
+ visibility is the default. We want -fvisibility=hidden to behave
+ identically to the situation where hidden visibility is the
+ hard-wired default. So, both A and B are exported classes.
+
+ Furthermore:
+
+ If CAG symbol Y names one of the impedimenta associated with an
+ exported class X:
+
+ ...
+
+ * Otherwise, if X has no key function:
+
+ - Y is exported from ... each DLL that refers to X and uses Y.
+
+ So, the type-info and virtual-table symbols associated with A and B
+ must be exported. */
+
// { dg-final { scan-not-hidden "_ZTI1A" } }
// { dg-final { scan-not-hidden "_ZTS1A" } }
// { dg-final { scan-not-hidden "_ZTV1B" } }
diff --git a/gcc/testsuite/g++.dg/inherit/base3.C b/gcc/testsuite/g++.dg/inherit/base3.C
new file mode 100644
index 00000000000..c586e39d19e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/inherit/base3.C
@@ -0,0 +1,8 @@
+// PR c++/35985
+// { dg-do compile }
+
+template<typename T> struct A : T {}; // { dg-error "struct or class type" }
+
+struct B;
+
+A<void (B::*)()> a; // { dg-error "instantiated" }
diff --git a/gcc/testsuite/g++.dg/inherit/thunk8.C b/gcc/testsuite/g++.dg/inherit/thunk8.C
index f7761349f8e..ef645356898 100644
--- a/gcc/testsuite/g++.dg/inherit/thunk8.C
+++ b/gcc/testsuite/g++.dg/inherit/thunk8.C
@@ -3,7 +3,7 @@
Make sure that won't happen anymore. */
/* { dg-do compile } */
-/* { dg-require-effective-target arm32 } */
+/* { dg-require-effective-target arm_thumb1_ok } */
/* { dg-options "-mthumb -fPIC" } */
struct A {
diff --git a/gcc/testsuite/g++.dg/init/const6.C b/gcc/testsuite/g++.dg/init/const6.C
new file mode 100644
index 00000000000..e626bfeaceb
--- /dev/null
+++ b/gcc/testsuite/g++.dg/init/const6.C
@@ -0,0 +1,27 @@
+// PR c++/36688
+// { dg-do run }
+// { dg-options "-O2" }
+
+struct S
+{
+ long long a;
+ long long b;
+ long long c;
+};
+
+struct T
+{
+ S g;
+ long long h[12];
+};
+
+static const S s = { 1, 2, 3 };
+static const T t = { s, 0 };
+
+int
+main ()
+{
+ T x = t;
+ if (__builtin_memcmp (&x, &t, sizeof (T)))
+ __builtin_abort ();
+}
diff --git a/gcc/testsuite/g++.dg/init/value3.C b/gcc/testsuite/g++.dg/init/value3.C
new file mode 100644
index 00000000000..487baabeceb
--- /dev/null
+++ b/gcc/testsuite/g++.dg/init/value3.C
@@ -0,0 +1,31 @@
+// Testcase for value-initialization in new-expressions.
+// { dg-do run }
+
+#include <stdlib.h>
+#include <string.h>
+
+// Make sure that we return memory that isn't already set to 0.
+void *operator new(size_t s)
+{
+ void *p = malloc (s);
+ memset (p, 42, s);
+ return p;
+}
+
+struct A { A() {} ~A() {} };
+struct B { A a; int i; };
+
+int main()
+{
+ B *p = new B();
+ if (p->i != 0)
+ abort();
+
+ p = new B[2]();
+ if (p[0].i != 0 || p[1].i != 0)
+ abort();
+
+ B(*p2)[2] = new B[2][2]();
+ if (p2[0][0].i != 0 || p2[0][1].i != 0)
+ abort();
+}
diff --git a/gcc/testsuite/g++.dg/ipa/iinline-1.C b/gcc/testsuite/g++.dg/ipa/iinline-1.C
new file mode 100644
index 00000000000..be3be71f96a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ipa/iinline-1.C
@@ -0,0 +1,47 @@
+/* Verify that simple indirect calls are inlined even without early
+ inlining.. */
+/* { dg-do compile } */
+/* { dg-options "-O3 -c -fdump-ipa-inline -fno-early-inlining" } */
+
+extern void non_existent (const char *, int);
+
+class String
+{
+private:
+ const char *data;
+
+public:
+ String (const char *d) : data(d)
+ {}
+
+ int funcOne (int delim) const;
+ int printStuffTwice (int delim) const;
+};
+
+
+int String::funcOne (int delim) const
+{
+ int i;
+ for (i = 0; i < delim; i++)
+ non_existent(data, i);
+
+ return 1;
+}
+
+int docalling (int (String::* f)(int delim) const)
+{
+ String S ("muhehehe");
+
+ return (S.*f)(4);
+}
+
+int main (int argc, char *argv[])
+{
+ int i;
+ i = docalling (&String::funcOne);
+ non_existent ("done", i);
+ return 0;
+}
+
+/* { dg-final { scan-ipa-dump "String::funcOne\[^\\n\]*inline copy in int main" "inline" } } */
+/* { dg-final { cleanup-tree-dump "inline" } } */
diff --git a/gcc/testsuite/g++.dg/lookup/extern-c-redecl.C b/gcc/testsuite/g++.dg/lookup/extern-c-redecl.C
new file mode 100644
index 00000000000..31d100a74f9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lookup/extern-c-redecl.C
@@ -0,0 +1,11 @@
+// Contributed by Dodji Seketeli <dseketel@redhat.com>
+// Origin: PR c++/13699
+// { dg-do compile }
+
+namespace A {
+ extern "C" void foo_func () throw(); // { dg-error "conflicts" }
+}
+// next line should trigger an error because
+// it conflicts with previous declaration of foo_func (), due to
+// different exception specifications.
+extern "C" void foo_func (); // { dg-error "C language|exception specifications" }
diff --git a/gcc/testsuite/g++.dg/lookup/new1.C b/gcc/testsuite/g++.dg/lookup/new1.C
index b9d0bef88f6..ae1121339cf 100644
--- a/gcc/testsuite/g++.dg/lookup/new1.C
+++ b/gcc/testsuite/g++.dg/lookup/new1.C
@@ -4,10 +4,10 @@
int main() {
int i;
- void* operator new(unsigned s, int* p);
+ void* operator new(__SIZE_TYPE__ s, int* p);
int* e = new(&i) int; // { dg-error "no matching function" }
int* f = new int;
return 0;
}
-// { dg-excess-errors "operator new" }
+// { dg-error "candidate" "" { target *-*-* } 0 }
diff --git a/gcc/testsuite/g++.dg/opt/pmf1.C b/gcc/testsuite/g++.dg/opt/pmf1.C
new file mode 100644
index 00000000000..428e7530b2c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/pmf1.C
@@ -0,0 +1,76 @@
+// PR c++/37016
+// { dg-do run }
+// { dg-options "-O2 -Wall" }
+
+/*
+ Basic design concept is that WorldObject implements remote method call
+ functionality using the "curiously recurring template pattern" to enable
+ forwarding calls from the generic base class that implements the transport
+ layer to the derived class.
+
+ The specific failure was in forwarding calls to items in a container.
+ This is emulated here by wrapping a single item.
+
+ In the main program there are two forms of the call. In the last
+ (uncommented) form the member function pointer is for clarity
+ assigned to a variable (itemfunptr) before making the call.
+ With 4.3.0 and 4.3.1 this code compiles incorrectly with -O1 or greater
+ to produce this warning
+
+ reproduce.cc: In function ‘int main()’:
+ reproduce.cc:26: warning: ‘itemfunptr.void (Container::*)(void
+(Item::*)(int), int)::__pfn’ is used uninitialized in this function
+ reproduce.cc:47: note: ‘itemfunptr.void (Container::*)(void (Item::*)(int),
+int)::__pfn’ was declared here
+
+ and the resulting executable segvs. It works correctly with -O0.
+
+ With 4.2.3 and earlier it works correctly with optimization.
+
+ In the first (commented out) form of the call in the main program
+ we directly refer to desired member function. This compiles
+ and executes correctly with all tested versions.
+*/
+
+extern "C" int printf (const char *, ...);
+
+template <class Derived>
+struct WorldObject {
+ template <typename memfunT, typename arg1T, typename arg2T>
+ void forward(memfunT memfun, arg1T arg1, arg2T arg2) {
+ Derived* obj = static_cast<Derived*>(this);
+ (obj->*memfun)(arg1, arg2);
+ }
+};
+
+struct Item {
+ void fred(int a) {
+ printf ("a=%d\n", a);
+ }
+};
+
+struct Container : public WorldObject<Container> {
+ Item item;
+ template <typename itemfunT, typename arg1T>
+ void itemfun(itemfunT itemfun, int a) {
+ (item.*itemfun)(a);
+ }
+};
+
+int main() {
+ typedef void (Item::*itemfun)(int);
+
+ Container t;
+
+ // This call compiles and executes correctly with all versions tested
+ //t.forward(&Container::itemfun<itemfun,int>, &Item::fred, 1);
+
+ // This call compiles with a warning and segvs on execution if using
+ // -O1 or greater with 4.3.*. 4.2.* is correct.
+ void (Container::*itemfunptr)(itemfun, int) =
+&Container::itemfun<itemfun,int>;
+ t.forward(itemfunptr, &Item::fred, 1);
+
+ return 0;
+}
+
diff --git a/gcc/testsuite/g++.dg/other/pr36944.C b/gcc/testsuite/g++.dg/other/pr36944.C
new file mode 100644
index 00000000000..b4a1dfa46fd
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/pr36944.C
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+
+class XObject
+{
+public:
+ int foo;
+};
+
+class XObjectPtr
+{
+public:
+ explicit
+ XObjectPtr(XObject* theXObject = 0) : m_xobjectPtr(theXObject)
+ {
+ }
+
+private:
+ XObject * m_xobjectPtr;
+};
+
+class SelectionEvent
+{
+public:
+ SelectionEvent(bool selection) : m_selection() {}
+ const XObjectPtr m_selection;
+};
diff --git a/gcc/testsuite/g++.dg/parse/crash27.C b/gcc/testsuite/g++.dg/parse/crash27.C
index 069436666d3..217928781d3 100644
--- a/gcc/testsuite/g++.dg/parse/crash27.C
+++ b/gcc/testsuite/g++.dg/parse/crash27.C
@@ -1,5 +1,4 @@
// Bug: 23225
void Dispatcher()
- (__builtin_offsetof (ArgsType, largeMsgLen))
- /* { dg-error "function " "function" { target *-*-* } 4 } */
+ (__builtin_offsetof (ArgsType, largeMsgLen)) // { dg-error "initialize|end of input" }
diff --git a/gcc/testsuite/g++.dg/parse/crash42.C b/gcc/testsuite/g++.dg/parse/crash42.C
new file mode 100644
index 00000000000..9cb07d5148d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/crash42.C
@@ -0,0 +1,9 @@
+// Created by: Dodji Seketeli <dseketel@redhat.com>
+// { dg-do compile }
+// { dg-options "-O2 -fprofile-arcs" }
+// Origin: PR C++/36767
+
+struct A { A (); ~A (); };
+A a[2];
+
+
diff --git a/gcc/testsuite/g++.dg/parse/crash43.C b/gcc/testsuite/g++.dg/parse/crash43.C
new file mode 100644
index 00000000000..84fe8c5186c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/crash43.C
@@ -0,0 +1,9 @@
+// PR c++/34600
+
+namespace N
+{
+ void foo()
+ {
+ extern int i = 0; // { dg-error "error: 'i' has both 'extern' and initializer" }
+ }
+}
diff --git a/gcc/testsuite/g++.dg/parse/error15.C b/gcc/testsuite/g++.dg/parse/error15.C
index 5903a585e97..5d30b554369 100644
--- a/gcc/testsuite/g++.dg/parse/error15.C
+++ b/gcc/testsuite/g++.dg/parse/error15.C
@@ -35,4 +35,4 @@ struct C
typename N::A f7; // { dg-error "15: error: invalid use of template-name 'N::A' without an argument list" }
};
-// { dg-bogus "bogus excess errors in declaration" "bogus excess errors in declaration" { xfail *-*-* } 17 }
+// { dg-bogus "bogus excess errors in declaration" "bogus excess errors in declaration" { target *-*-* } 17 }
diff --git a/gcc/testsuite/g++.dg/pch/array-1.C b/gcc/testsuite/g++.dg/pch/array-1.C
new file mode 100644
index 00000000000..a8935ed2606
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pch/array-1.C
@@ -0,0 +1,15 @@
+// PR c++/36852
+
+#include "array-1.H"
+
+template <class T>
+T
+A::foo (T t[3][3])
+{
+ return t[0][1];
+}
+
+int
+main ()
+{
+}
diff --git a/gcc/testsuite/g++.dg/pch/array-1.Hs b/gcc/testsuite/g++.dg/pch/array-1.Hs
new file mode 100644
index 00000000000..fb44b675e3a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pch/array-1.Hs
@@ -0,0 +1,4 @@
+struct A
+{
+ template <class T> static T foo (T[3][3]);
+};
diff --git a/gcc/testsuite/g++.dg/rtti/typeid8.C b/gcc/testsuite/g++.dg/rtti/typeid8.C
new file mode 100644
index 00000000000..2b13be5ef52
--- /dev/null
+++ b/gcc/testsuite/g++.dg/rtti/typeid8.C
@@ -0,0 +1,26 @@
+// PR c++/36405
+// { dg-do compile }
+
+#include <typeinfo>
+
+struct A
+{
+ void foo ()
+ {
+ typeid (foo).name (); // { dg-error "invalid use of member" }
+ typeid (A::foo).name (); // { dg-error "invalid use of member" }
+ }
+ void bar ()
+ {
+ typeid (foo).name (); // { dg-error "invalid use of member" }
+ typeid (A::foo).name (); // { dg-error "invalid use of member" }
+ }
+ static void baz ()
+ {
+ typeid (baz).name ();
+ typeid (A::baz).name ();
+ }
+};
+
+const char *p1 = typeid (A::foo).name (); // { dg-error "invalid use of non-static member" }
+const char *p2 = typeid (A::baz).name ();
diff --git a/gcc/testsuite/g++.dg/template/crash60.C b/gcc/testsuite/g++.dg/template/crash60.C
index 9e1d88b2432..c579775917e 100644
--- a/gcc/testsuite/g++.dg/template/crash60.C
+++ b/gcc/testsuite/g++.dg/template/crash60.C
@@ -5,5 +5,5 @@ struct A
template<int> void foo(X); // { dg-error "declared" }
};
-template<int> void f()(0); // { dg-error "initialized" }
+template<int> void f()(0); // { dg-error "initialize" }
diff --git a/gcc/testsuite/g++.dg/template/crash7.C b/gcc/testsuite/g++.dg/template/crash7.C
index 5b17928f5bb..ae07d91e739 100644
--- a/gcc/testsuite/g++.dg/template/crash7.C
+++ b/gcc/testsuite/g++.dg/template/crash7.C
@@ -6,8 +6,10 @@
// nested type.
template <typename> struct A
-{ // { dg-error "candidates" }
+{ // { not-dg-error "candidates" }
template <typename> A(typename A::X) {} // { dg-error "no type" }
};
-A<void> a; // { dg-error "instantiated|no match" }
+A<void> a; // { not-dg-error "instantiated|no match" }
+// We currently don't give the "no match" error because we don't add the
+// invalid constructor template to TYPE_METHODS.
diff --git a/gcc/testsuite/g++.dg/template/crash80.C b/gcc/testsuite/g++.dg/template/crash80.C
new file mode 100644
index 00000000000..ed462ac9d19
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/crash80.C
@@ -0,0 +1,9 @@
+// PR c++/37087
+
+namespace a {
+ template <typename T> class Foo;
+}
+
+namespace b {
+ template <> class ::a::Foo<double> {}; // { dg-error "error: global qualification of class name is invalid" }
+}
diff --git a/gcc/testsuite/g++.dg/template/crash81.C b/gcc/testsuite/g++.dg/template/crash81.C
new file mode 100644
index 00000000000..f2b76744f33
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/crash81.C
@@ -0,0 +1,6 @@
+// PR c++/34485
+
+struct A
+{
+ template<T::X> struct X; // { dg-error "error: 'T' has not been declared|error: declaration of 'template<int X> struct A::X'|error: shadows template parm 'int X'" }
+};
diff --git a/gcc/testsuite/g++.dg/torture/pr36826.C b/gcc/testsuite/g++.dg/torture/pr36826.C
new file mode 100644
index 00000000000..436220ba8a7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr36826.C
@@ -0,0 +1,166 @@
+template <class T> T CoinMax(register const T x1, register const T x2);
+template <class T> T CoinMin(register const T x1, register const T x2);
+class CoinIndexedVector;
+class ClpModel {
+protected:
+ double objectiveScale_;
+ double rhsScale_;
+ int numberRows_;
+ int numberColumns_;
+ double * rowActivity_;
+ double * columnActivity_;
+ double * dual_;
+ double * reducedCost_;
+ double* rowLower_;
+ double* rowUpper_;
+ double * rowObjective_;
+ double * columnLower_;
+ double * columnUpper_;
+ double * rowScale_;
+ double * columnScale_;
+ double * inverseRowScale_;
+ double * inverseColumnScale_;
+ int problemStatus_;
+ int secondaryStatus_;
+};
+class ClpSimplex : public ClpModel {
+ void deleteRim(int getRidOfFactorizationData=2);
+ double upperOut_;
+ double dualTolerance_;
+ double primalTolerance_;
+ double * rowLowerWork_;
+ double * columnLowerWork_;
+ double * rowUpperWork_;
+ double * columnUpperWork_;
+ double * rowObjectiveWork_;
+ CoinIndexedVector * columnArray_[6];
+ double * reducedCostWork_;
+ double * rowActivityWork_;
+ double * columnActivityWork_;
+ ClpSimplex * auxiliaryModel_;
+};
+class CoinIndexedVector {
+public:
+ void clear();
+};
+void ClpSimplex::deleteRim(int getRidOfFactorizationData)
+{
+ int numberRows=numberRows_;
+ int numberColumns=numberColumns_;
+ int i;
+ int numberPrimalScaled=0;
+ int numberPrimalUnscaled=0;
+ int numberDualScaled=0;
+ int numberDualUnscaled=0;
+ double scaleC = 1.0/objectiveScale_;
+ double scaleR = 1.0/rhsScale_;
+ if (!inverseColumnScale_) {
+ for (i=0; i<numberColumns; i++)
+ {
+ double scaleFactor = columnScale_[i];
+ double valueScaled = columnActivityWork_[i];
+ double lowerScaled = columnLowerWork_[i];
+ double upperScaled = columnUpperWork_[i];
+ if (lowerScaled>-1.0e20||upperScaled<1.0e20) {
+ if (valueScaled<lowerScaled-primalTolerance_|| valueScaled>upperScaled+primalTolerance_)
+ numberPrimalScaled++;
+ else
+ upperOut_ = CoinMax(upperOut_,CoinMin(valueScaled-lowerScaled,upperScaled-valueScaled));
+ }
+ columnActivity_[i] = valueScaled*scaleFactor*scaleR;
+ double value = columnActivity_[i];
+ if (value<columnLower_[i]-primalTolerance_)
+ numberPrimalUnscaled++;
+ else if (value>columnUpper_[i]+primalTolerance_)
+ numberPrimalUnscaled++;
+ double valueScaledDual = reducedCostWork_[i];
+ if (valueScaled>columnLowerWork_[i]+primalTolerance_&&valueScaledDual>dualTolerance_)
+ numberDualScaled++;
+ if (valueScaled<columnUpperWork_[i]-primalTolerance_&&valueScaledDual<-dualTolerance_)
+ numberDualScaled++;
+ reducedCost_[i] = (valueScaledDual*scaleC)/scaleFactor;
+ double valueDual = reducedCost_[i];
+ if (value>columnLower_[i]+primalTolerance_&&valueDual>dualTolerance_)
+ numberDualUnscaled++;
+ if (value<columnUpper_[i]-primalTolerance_&&valueDual<-dualTolerance_)
+ numberDualUnscaled++;
+ }
+ for (i=0; i<numberRows; i++)
+ {
+ double scaleFactor = rowScale_[i];
+ double valueScaled = rowActivityWork_[i];
+ double lowerScaled = rowLowerWork_[i];
+ double upperScaled = rowUpperWork_[i];
+ if (lowerScaled>-1.0e20||upperScaled<1.0e20) { if (valueScaled<lowerScaled-primalTolerance_|| valueScaled>upperScaled+primalTolerance_) numberPrimalScaled++; else upperOut_ = CoinMax(upperOut_,CoinMin(valueScaled-lowerScaled,upperScaled-valueScaled)); }
+ rowActivity_[i] = (valueScaled*scaleR)/scaleFactor;
+ double value = rowActivity_[i];
+ if (value<rowLower_[i]-primalTolerance_) numberPrimalUnscaled++;
+ else if (value>rowUpper_[i]+primalTolerance_) numberPrimalUnscaled++;
+ double valueScaledDual = dual_[i]+rowObjectiveWork_[i];
+ ;
+ if (valueScaled>rowLowerWork_[i]+primalTolerance_&&valueScaledDual>dualTolerance_) numberDualScaled++;
+ if (valueScaled<rowUpperWork_[i]-primalTolerance_&&valueScaledDual<-dualTolerance_) numberDualScaled++;
+ dual_[i] *= scaleFactor*scaleC;
+ double valueDual = dual_[i];
+ if (rowObjective_) valueDual += rowObjective_[i];
+ if (value>rowLower_[i]+primalTolerance_&&valueDual>dualTolerance_) numberDualUnscaled++;
+ if (value<rowUpper_[i]-primalTolerance_&&valueDual<-dualTolerance_) numberDualUnscaled++;
+ }
+ }
+ const double * inverseScale = inverseColumnScale_;
+ for (i=0; i<numberColumns; i++)
+ {
+ double scaleFactor = columnScale_[i];
+ double valueScaled = columnActivityWork_[i];
+ double lowerScaled = columnLowerWork_[i];
+ double upperScaled = columnUpperWork_[i];
+ if (lowerScaled>-1.0e20||upperScaled<1.0e20) { if (valueScaled<lowerScaled-primalTolerance_|| valueScaled>upperScaled+primalTolerance_) numberPrimalScaled++; else upperOut_ = CoinMax(upperOut_,CoinMin(valueScaled-lowerScaled,upperScaled-valueScaled)); }
+ columnActivity_[i] = valueScaled*scaleFactor*scaleR;
+ double value = columnActivity_[i];
+ if (value<columnLower_[i]-primalTolerance_) numberPrimalUnscaled++;
+ else if (value>columnUpper_[i]+primalTolerance_) numberPrimalUnscaled++;
+ double valueScaledDual = reducedCostWork_[i];
+ if (valueScaled>columnLowerWork_[i]+primalTolerance_&&valueScaledDual>dualTolerance_) numberDualScaled++;
+ if (valueScaled<columnUpperWork_[i]-primalTolerance_&&valueScaledDual<-dualTolerance_) numberDualScaled++;
+ reducedCost_[i] = (valueScaledDual*scaleC)*inverseScale[i];
+ double valueDual = reducedCost_[i];
+ if (value>columnLower_[i]+primalTolerance_&&valueDual>dualTolerance_) numberDualUnscaled++;
+ if (value<columnUpper_[i]-primalTolerance_&&valueDual<-dualTolerance_) numberDualUnscaled++;
+ }
+ inverseScale = inverseRowScale_;
+ for (i=0; i<numberRows; i++)
+ {
+ double scaleFactor = rowScale_[i];
+ double valueScaled = rowActivityWork_[i];
+ double lowerScaled = rowLowerWork_[i];
+ double upperScaled = rowUpperWork_[i];
+ if (lowerScaled>-1.0e20||upperScaled<1.0e20) { if (valueScaled<lowerScaled-primalTolerance_|| valueScaled>upperScaled+primalTolerance_) numberPrimalScaled++; else upperOut_ = CoinMax(upperOut_,CoinMin(valueScaled-lowerScaled,upperScaled-valueScaled)); }
+ rowActivity_[i] = (valueScaled*scaleR)*inverseScale[i];
+ double value = rowActivity_[i];
+ if (value<rowLower_[i]-primalTolerance_) numberPrimalUnscaled++;
+ else if (value>rowUpper_[i]+primalTolerance_) numberPrimalUnscaled++;
+ double valueScaledDual = dual_[i]+rowObjectiveWork_[i];
+ ;
+ if (valueScaled>rowLowerWork_[i]+primalTolerance_&&valueScaledDual>dualTolerance_) numberDualScaled++;
+ if (valueScaled<rowUpperWork_[i]-primalTolerance_&&valueScaledDual<-dualTolerance_) numberDualScaled++;
+ dual_[i] *= scaleFactor*scaleC;
+ double valueDual = dual_[i];
+ if (rowObjective_) valueDual += rowObjective_[i];
+ if (value>rowLower_[i]+primalTolerance_&&valueDual>dualTolerance_) numberDualUnscaled++;
+ if (value<rowUpper_[i]-primalTolerance_&&valueDual<-dualTolerance_) numberDualUnscaled++;
+ }
+ if (numberPrimalUnscaled) {
+ if (numberDualUnscaled)
+ secondaryStatus_=4;
+ else
+ secondaryStatus_=2;
+ }
+ if (numberDualUnscaled)
+ secondaryStatus_=3;
+ int iRow,iColumn;
+ for (iRow=0; iRow<4; iRow++)
+ ;
+ for (iColumn=0; iColumn<2; iColumn++)
+ if (columnArray_[iColumn])
+ columnArray_[iColumn]->clear();
+}
diff --git a/gcc/testsuite/g++.dg/torture/stackalign/check.h b/gcc/testsuite/g++.dg/torture/stackalign/check.h
new file mode 100644
index 00000000000..af198851274
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/stackalign/check.h
@@ -0,0 +1,36 @@
+#include <stddef.h>
+#ifdef DEBUG
+#include <stdio.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" void abort (void);
+#else
+extern void abort (void);
+#endif
+
+int
+check_int (int *i, int align)
+{
+ *i = 20;
+ if ((((ptrdiff_t) i) & (align - 1)) != 0)
+ {
+#ifdef DEBUG
+ printf ("\nUnalign address (%d): %p!\n", align, i);
+#endif
+ abort ();
+ }
+ return *i;
+}
+
+void
+check (void *p, int align)
+{
+ if ((((ptrdiff_t) p) & (align - 1)) != 0)
+ {
+#ifdef DEBUG
+ printf ("\nUnalign address (%d): %p!\n", align, p);
+#endif
+ abort ();
+ }
+}
diff --git a/gcc/testsuite/g++.dg/torture/stackalign/eh-alloca-1.C b/gcc/testsuite/g++.dg/torture/stackalign/eh-alloca-1.C
new file mode 100644
index 00000000000..a20f074bcd2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/stackalign/eh-alloca-1.C
@@ -0,0 +1,56 @@
+/* { dg-do run } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT 64
+#endif
+
+typedef int aligned __attribute__((aligned(ALIGNMENT)));
+
+int global;
+
+void
+bar (char *p, int size)
+{
+ __builtin_strncpy (p, "good", size);
+}
+
+class Base {};
+
+struct A : virtual public Base
+{
+ A() {}
+};
+
+struct B {};
+
+void
+foo (int size) throw (B,A)
+{
+ char *p = (char*) __builtin_alloca (size + 1);
+ aligned i;
+
+ bar (p, size);
+ if (__builtin_strncmp (p, "good", size) != 0)
+ {
+#ifdef DEBUG
+ p[size] = '\0';
+ printf ("Failed: %s != good\n", p);
+#endif
+ abort ();
+ }
+
+ if (check_int (&i, __alignof__(i)) != i)
+ abort ();
+
+ throw A();
+}
+
+int
+main()
+{
+ try { foo (5); }
+ catch (A& a) { }
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/stackalign/eh-fastcall-1.C b/gcc/testsuite/g++.dg/torture/stackalign/eh-fastcall-1.C
new file mode 100644
index 00000000000..4b849a2e42e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/stackalign/eh-fastcall-1.C
@@ -0,0 +1,43 @@
+/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT 64
+#endif
+
+typedef int aligned __attribute__((aligned(ALIGNMENT)));
+
+int global;
+
+class Base {};
+
+struct A : virtual public Base
+{
+ A() {}
+};
+
+struct B {};
+
+__attribute__ ((fastcall))
+void
+foo (int j, int k, int m, int n, int o) throw (B,A)
+{
+ aligned i;
+
+ if (check_int (&i, __alignof__(i)) != i)
+ abort ();
+
+ if (i != 20 || j != 1 || k != 2 || m != 3 || n != 4 || o != 5)
+ abort ();
+
+ throw A();
+}
+
+int
+main()
+{
+ try { foo (1, 2, 3, 4, 5); }
+ catch (A& a) { }
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/stackalign/eh-global-1.C b/gcc/testsuite/g++.dg/torture/stackalign/eh-global-1.C
new file mode 100644
index 00000000000..2692f947c7b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/stackalign/eh-global-1.C
@@ -0,0 +1,39 @@
+/* { dg-do run } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT 64
+#endif
+
+typedef int aligned __attribute__((aligned(ALIGNMENT)));
+
+int global;
+
+class Base {};
+
+struct A : virtual public Base
+{
+ A() {}
+};
+
+struct B {};
+
+void
+foo (void) throw (B,A)
+{
+ aligned i;
+
+ if (check_int (&i, __alignof__(i)) != i)
+ abort ();
+
+ throw A();
+}
+
+int
+main()
+{
+ try { foo (); }
+ catch (A& a) { }
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/stackalign/eh-inline-1.C b/gcc/testsuite/g++.dg/torture/stackalign/eh-inline-1.C
new file mode 100644
index 00000000000..72ac7fd2443
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/stackalign/eh-inline-1.C
@@ -0,0 +1,39 @@
+/* { dg-do run } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT 64
+#endif
+
+typedef int aligned __attribute__((aligned(ALIGNMENT)));
+
+int global;
+
+class Base {};
+
+struct A : virtual public Base
+{
+ A() {}
+};
+
+struct B {};
+
+static void
+inline __attribute__((always_inline))
+foo (void) throw (B,A)
+{
+ aligned i;
+
+ if (check_int (&i, __alignof__(i)) != i)
+ abort ();
+ throw A();
+}
+
+int
+main()
+{
+ try { foo (); }
+ catch (A& a) { }
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/stackalign/eh-inline-2.C b/gcc/testsuite/g++.dg/torture/stackalign/eh-inline-2.C
new file mode 100644
index 00000000000..4feb3f09fc7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/stackalign/eh-inline-2.C
@@ -0,0 +1,57 @@
+/* { dg-do run } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT 64
+#endif
+
+typedef int aligned __attribute__((aligned(ALIGNMENT)));
+
+int global;
+
+void
+bar (char *p, int size)
+{
+ __builtin_strncpy (p, "good", size);
+}
+
+class Base {};
+
+struct A : virtual public Base
+{
+ A() {}
+};
+
+struct B {};
+
+static void
+inline __attribute__((always_inline))
+foo (int size) throw (B,A)
+{
+ char *p = (char *) __builtin_alloca (size + 1);
+ aligned i;
+
+ bar (p, size);
+ if (__builtin_strncmp (p, "good", size) != 0)
+ {
+#ifdef DEBUG
+ p[size] = '\0';
+ printf ("Failed: %s != good\n", p);
+#endif
+ abort ();
+ }
+
+ if (check_int (&i, __alignof__(i)) != i)
+ abort ();
+
+ throw A();
+}
+
+int
+main()
+{
+ try { foo (5); }
+ catch (A& a) { }
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/stackalign/eh-vararg-1.C b/gcc/testsuite/g++.dg/torture/stackalign/eh-vararg-1.C
new file mode 100644
index 00000000000..74b48faa599
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/stackalign/eh-vararg-1.C
@@ -0,0 +1,72 @@
+/* { dg-do run } */
+
+#include <stdarg.h>
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT 64
+#endif
+
+typedef int aligned __attribute__((aligned(ALIGNMENT)));
+
+int global;
+
+void
+bar (char *p, int size)
+{
+ __builtin_strncpy (p, "good", size);
+}
+
+class Base {};
+
+struct A : virtual public Base
+{
+ A() {}
+};
+
+struct B {};
+
+void
+foo (const char *fmt, ...) throw (B,A)
+{
+ va_list arg;
+ char *p;
+ aligned i;
+ int size;
+ double x;
+
+ va_start (arg, fmt);
+ size = va_arg (arg, int);
+ if (size != 5)
+ abort ();
+ p = (char *) __builtin_alloca (size + 1);
+
+ x = va_arg (arg, double);
+ if (x != 5.0)
+ abort ();
+
+ bar (p, size);
+ if (__builtin_strncmp (p, "good", size) != 0)
+ {
+#ifdef DEBUG
+ p[size] = '\0';
+ printf ("Failed: %s != good\n", p);
+#endif
+ abort ();
+ }
+
+ if (check_int (&i, __alignof__(i)) != i)
+ abort ();
+
+ throw A();
+
+ va_end (arg);
+}
+
+int
+main()
+{
+ try { foo ("foo", 5, 5.0); }
+ catch (A& a) { }
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/stackalign/eh-vararg-2.C b/gcc/testsuite/g++.dg/torture/stackalign/eh-vararg-2.C
new file mode 100644
index 00000000000..719c839a748
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/stackalign/eh-vararg-2.C
@@ -0,0 +1,77 @@
+/* { dg-do run } */
+
+#include <stdarg.h>
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT 64
+#endif
+
+typedef int aligned __attribute__((aligned(ALIGNMENT)));
+
+int global;
+
+void
+bar (char *p, int size)
+{
+ __builtin_strncpy (p, "good", size);
+}
+
+class Base {};
+
+struct A : virtual public Base
+{
+ A() {}
+};
+
+struct B {};
+
+void
+test (va_list arg) throw (B,A)
+{
+ char *p;
+ aligned i;
+ int size;
+ double x;
+
+ size = va_arg (arg, int);
+ if (size != 5)
+ abort ();
+
+ p = (char *) __builtin_alloca (size + 1);
+
+ x = va_arg (arg, double);
+ if (x != 5.0)
+ abort ();
+
+ bar (p, size);
+ if (__builtin_strncmp (p, "good", size) != 0)
+ {
+#ifdef DEBUG
+ p[size] = '\0';
+ printf ("Failed: %s != good\n", p);
+#endif
+ abort ();
+ }
+
+ if (check_int (&i, __alignof__(i)) != i)
+ abort ();
+
+ throw A();
+}
+
+void
+foo (const char *fmt, ...)
+{
+ va_list arg;
+ va_start (arg, fmt);
+ test (arg);
+ va_end (arg);
+}
+int
+main()
+{
+ try { foo ("foo", 5, 5.0); }
+ catch (A& a) { }
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/stackalign/stackalign.exp b/gcc/testsuite/g++.dg/torture/stackalign/stackalign.exp
new file mode 100644
index 00000000000..bfa413eab48
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/stackalign/stackalign.exp
@@ -0,0 +1,39 @@
+# Copyright (C) 2008
+# Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# This harness is for tests that should be run at all optimisation levels.
+
+load_lib g++-dg.exp
+
+# Only run on targets which support automatic stack alignment.
+if { ![check_effective_target_automatic_stack_alignment] } then {
+ return
+}
+
+set additional_flags ""
+if { [istarget i?86*-*-*] || [istarget x86_64-*-*] } then {
+ lappend additional_flags "-mstackrealign"
+ lappend additional_flags "-mpreferred-stack-boundary=5"
+}
+
+dg-init
+gcc-dg-runtest [lsort [glob $srcdir/$subdir/*.C]] $additional_flags
+if { [check_effective_target_fpic] } then {
+ lappend additional_flags "-fpic"
+ gcc-dg-runtest [lsort [glob $srcdir/$subdir/*.C]] $additional_flags
+}
+dg-finish
diff --git a/gcc/testsuite/g++.dg/torture/stackalign/stdcall-1.C b/gcc/testsuite/g++.dg/torture/stackalign/stdcall-1.C
new file mode 100644
index 00000000000..393b37e7b6b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/stackalign/stdcall-1.C
@@ -0,0 +1,17 @@
+// { dg-do compile { target { { i?86-*-* x86_64-*-* } && ilp32 } } }
+
+// This case is to detect an assertion failure in stack branch development.
+
+bool f();
+struct S {
+ __attribute__ ((stdcall)) ~S();
+};
+void g() {
+ for (;;) {
+ S s1, s2, s3;
+ if (f())
+ continue;
+ if (f())
+ return;
+ }
+}
diff --git a/gcc/testsuite/g++.dg/torture/stackalign/test-unwind.h b/gcc/testsuite/g++.dg/torture/stackalign/test-unwind.h
new file mode 100644
index 00000000000..e6493ffedb2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/stackalign/test-unwind.h
@@ -0,0 +1,132 @@
+#include "check.h"
+
+#ifdef __cplusplus
+extern "C" void abort (void);
+#else
+extern void abort (void);
+#endif
+
+extern void foo(void);
+
+#define INIT_EDI 1
+#define INIT_ESI 2
+#define INIT_EBX 3
+
+/* Set DI/SI/BX to wrong value
+ Use following template so that RA will save/restore callee
+ save registers in prologue/epilogue */
+#define ALTER_REGS() \
+ { \
+ int dummy; \
+ __asm__ __volatile__ (\
+ "movl %1, %0" : "=D" (dummy) : "i" (-INIT_EDI)\
+ );\
+ __asm__ __volatile__ (\
+ "movl %1, %0" : "=S" (dummy) : "i" (-INIT_ESI)\
+ );\
+ __asm__ __volatile__ (\
+ "movl %1, %0" : "=b" (dummy) : "i" (-INIT_EBX)\
+ );\
+ }
+
+#ifdef __PIC__
+int
+main ()
+{
+ return 0;
+}
+#else
+void __attribute__ ((noinline))
+copy (char *p, int size)
+{
+ __builtin_strncpy (p, "good", size);
+}
+
+int g_edi=INIT_EDI, g_esi=INIT_ESI, g_ebx=INIT_EBX;
+int g_ebp, g_ebp_save, g_esp, g_esp_save;
+int n_error;
+
+int
+main()
+{
+ int dummy;
+ // Init registers to correct value.
+ // Use following template so that RA will save/restore callee
+ // save registers in prologue/epilogue
+ __asm__ __volatile__ (
+ "movl %1, %0"
+ : "=D" (dummy)
+ : "i" (INIT_EDI)
+ );
+ __asm__ __volatile__ (
+ "movl %1, %0"
+ : "=S" (dummy)
+ : "i" (INIT_ESI)
+ );
+ __asm__ __volatile__ (
+ "movl %1, %0"
+ : "=b" (dummy)
+ : "i" (INIT_EBX)
+ );
+ __asm__ __volatile__ (
+ "movl %ebp, g_ebp_save\n\t"
+ "movl %esp, g_esp_save\n\t"
+ );
+ try {
+ foo();
+ }
+ catch (...)
+ {
+ }
+
+ // Get DI/SI/BX register value after exception caught
+ __asm__ __volatile__ (
+ "movl %edi, g_edi\n\t"
+ "movl %esi, g_esi\n\t"
+ "movl %ebx, g_ebx\n\t"
+ "movl %ebp, g_ebp\n\t"
+ "movl %esp, g_esp\n\t"
+ );
+
+ // Check if DI/SI/BX register value are the same as before calling
+ // foo.
+ if (g_edi != INIT_EDI)
+ {
+ n_error++;
+#ifdef DEBUG
+ printf("edi=%d, correct value:%d\n", g_edi, INIT_EDI);
+#endif
+ }
+ if (g_esi != INIT_ESI)
+ {
+ n_error++;
+#ifdef DEBUG
+ printf("esi=%d, correct value:%d\n", g_esi, INIT_ESI);
+#endif
+ }
+ if (g_ebx != INIT_EBX)
+ {
+ n_error++;
+#ifdef DEBUG
+ printf("ebx=%d, correct value:%d\n", g_ebx, INIT_EBX);
+#endif
+ }
+ if (g_ebp != g_ebp_save)
+ {
+ n_error++;
+#ifdef DEBUG
+ printf("ebp=0x%x, correct value:0x%x\n", g_ebp, g_ebp_save);
+#endif
+ }
+ if (g_esp != g_esp_save)
+ {
+ n_error++;
+#ifdef DEBUG
+ printf("esp=0x%x, correct value:0x%x\n", g_esp, g_esp_save);
+#endif
+ }
+ if (n_error !=0)
+ abort();
+ return 0;
+}
+#endif
diff --git a/gcc/testsuite/g++.dg/torture/stackalign/throw-1.C b/gcc/testsuite/g++.dg/torture/stackalign/throw-1.C
new file mode 100644
index 00000000000..b1d2e278953
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/stackalign/throw-1.C
@@ -0,0 +1,61 @@
+/* { dg-do run } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT 64
+#endif
+
+typedef int t_align __attribute__((aligned(ALIGNMENT)));
+
+
+int global, global2;
+void bar()
+{
+ volatile t_align a = 1;
+ int i,j,k,l,m,n;
+ i=j=k=0;
+ for (i=0; i < global; i++)
+ for (j=0; j < i; j++)
+ for (k=0; k < j; k++)
+ for (l=0; l < k; l++)
+ for (m=0; m < l; m++)
+ for (n=0; n < m; n++)
+ global2 = k;
+ if (check_int ((int *) &a, __alignof__(a)) != a)
+ abort ();
+ throw 0;
+}
+
+void foo()
+{
+ bar();
+}
+
+int main()
+{
+ int ll = 1;
+ int i = 0,j = 1,k = 2,l = 3,m = 4,n = 5;
+ try {
+ for (; i < global; i++)
+ for (; j < i; j++)
+ for (; k < j; k++)
+ for (; l < k; l++)
+ for (; m < l; m++)
+ for (; n < m; n++)
+ global2 = k;
+ foo();
+ }
+ catch (...)
+ {
+ }
+ ll = i+j+k+l+m+n;
+ if (ll != 15)
+ {
+#ifdef DEBUG
+ printf("FAIL: sum %d != 15\n", ll);
+#endif
+ abort();
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/stackalign/throw-2.C b/gcc/testsuite/g++.dg/torture/stackalign/throw-2.C
new file mode 100644
index 00000000000..5f3f1dc0737
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/stackalign/throw-2.C
@@ -0,0 +1,52 @@
+/* { dg-do run } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT 64
+#endif
+
+typedef int t_align __attribute__((aligned(ALIGNMENT)));
+
+
+int global, global2;
+void bar()
+{
+ volatile t_align a = 1;
+ int i,j,k;
+ i=j=k=0;
+ for (i=0; i < global; i++)
+ for (j=0; j < i; j++)
+ global2 = k;
+ if (check_int ((int *) &a, __alignof__(a)) != a)
+ abort ();
+ throw 0;
+}
+
+int main()
+{
+ int ll = 1;
+ int i = 0,j = 1,k = 2,l = 3,m = 4,n = 5;
+ try {
+ for (; i < global; i++)
+ for (; j < i; j++)
+ for (; k < j; k++)
+ for (; l < k; l++)
+ for (; m < l; m++)
+ for (; n < m; n++)
+ global2 = k;
+ bar ();
+ }
+ catch (...)
+ {
+ }
+ ll = i+j+k+l+m+n;
+ if (ll != 15)
+ {
+#ifdef DEBUG
+ printf("FAIL: sum %d != 15\n", ll);
+#endif
+ abort();
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/stackalign/throw-3.C b/gcc/testsuite/g++.dg/torture/stackalign/throw-3.C
new file mode 100644
index 00000000000..d3e53b8292d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/stackalign/throw-3.C
@@ -0,0 +1,52 @@
+/* { dg-do run } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT 64
+#endif
+
+typedef int t_align __attribute__((aligned(ALIGNMENT)));
+
+
+int global, global2;
+void bar()
+{
+ volatile t_align a = 1;
+ int i,j,k;
+ i=j=k=0;
+ for (i=0; i < global; i++)
+ for (j=0; j < i; j++)
+ global2 = k;
+ throw 0;
+ if (check_int ((int *) &a, __alignof__(a)) != a)
+ abort ();
+}
+
+int main()
+{
+ int ll = 1;
+ int i = 0,j = 1,k = 2,l = 3,m = 4,n = 5;
+ try {
+ for (; i < global; i++)
+ for (; j < i; j++)
+ for (; k < j; k++)
+ for (; l < k; l++)
+ for (; m < l; m++)
+ for (; n < m; n++)
+ global2 = k;
+ bar ();
+ }
+ catch (...)
+ {
+ }
+ ll = i+j+k+l+m+n;
+ if (ll != 15)
+ {
+#ifdef DEBUG
+ printf("FAIL: sum %d != 15\n", ll);
+#endif
+ abort();
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/stackalign/throw-4.C b/gcc/testsuite/g++.dg/torture/stackalign/throw-4.C
new file mode 100644
index 00000000000..a9c15bd43c9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/stackalign/throw-4.C
@@ -0,0 +1,54 @@
+/* { dg-do run } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT 64
+#endif
+
+typedef int t_align __attribute__((aligned(ALIGNMENT)));
+
+
+int global, global2;
+void bar()
+{
+ volatile t_align a = 1;
+ int i,j,k;
+ i=j=k=0;
+ for (i=0; i < global; i++)
+ for (j=0; j < i; j++)
+ {
+ global2 = k;
+ throw 0;
+ }
+ if (check_int ((int *) &a, __alignof__(a)) != a)
+ abort ();
+}
+
+int main()
+{
+ int ll = 1;
+ int i = 0,j = 1,k = 2,l = 3,m = 4,n = 5;
+ try {
+ for (; i < global; i++)
+ for (; j < i; j++)
+ for (; k < j; k++)
+ for (; l < k; l++)
+ for (; m < l; m++)
+ for (; n < m; n++)
+ global2 = k;
+ bar ();
+ }
+ catch (...)
+ {
+ }
+ ll = i+j+k+l+m+n;
+ if (ll != 15)
+ {
+#ifdef DEBUG
+ printf("FAIL: sum %d != 15\n", ll);
+#endif
+ abort();
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/stackalign/unwind-0.C b/gcc/testsuite/g++.dg/torture/stackalign/unwind-0.C
new file mode 100644
index 00000000000..546123bdd0e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/stackalign/unwind-0.C
@@ -0,0 +1,12 @@
+/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
+
+#include "test-unwind.h"
+
+#ifndef __PIC__
+void __attribute__ ((noinline)) foo()
+{
+ ALTER_REGS();
+ // Throw the except and expect returning to main
+ throw 1;
+}
+#endif
diff --git a/gcc/testsuite/g++.dg/torture/stackalign/unwind-1.C b/gcc/testsuite/g++.dg/torture/stackalign/unwind-1.C
new file mode 100644
index 00000000000..3b809642ab7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/stackalign/unwind-1.C
@@ -0,0 +1,16 @@
+/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
+
+#include "test-unwind.h"
+
+#ifndef __PIC__
+/* Test situation 1: Stack really realign without DRAP */
+void __attribute__ ((noinline))
+foo ()
+{
+ int __attribute__ ((aligned(64))) a=1;
+ if (check_int (&a, __alignof__(a)) != a)
+ abort ();
+ ALTER_REGS();
+ throw a;
+}
+#endif
diff --git a/gcc/testsuite/g++.dg/torture/stackalign/unwind-2.C b/gcc/testsuite/g++.dg/torture/stackalign/unwind-2.C
new file mode 100644
index 00000000000..1569ed84b7d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/stackalign/unwind-2.C
@@ -0,0 +1,29 @@
+/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
+
+#include "test-unwind.h"
+
+#ifndef __PIC__
+/* Test situation 2: stack really realign with DRAP reg CX */
+void __attribute__ ((noinline))
+foo ()
+{
+ int __attribute__ ((aligned(64))) a=4;
+ char * s = (char *) __builtin_alloca (a + 1);
+
+ copy (s, a);
+ if (__builtin_strncmp (s, "good", a) != 0)
+ {
+#ifdef DEBUG
+ s[a] = '\0';
+ printf ("Failed: %s != good\n", s);
+#endif
+ abort ();
+ }
+
+ if (check_int (&a, __alignof__(a)) != a)
+ abort ();
+
+ ALTER_REGS();
+ throw a;
+}
+#endif
diff --git a/gcc/testsuite/g++.dg/torture/stackalign/unwind-3.C b/gcc/testsuite/g++.dg/torture/stackalign/unwind-3.C
new file mode 100644
index 00000000000..48eddaf5565
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/stackalign/unwind-3.C
@@ -0,0 +1,35 @@
+/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
+
+#include "test-unwind.h"
+
+#ifndef __PIC__
+/* Test situation 3: Stack realign really happen with DRAP reg DI */
+void __attribute__ ((noinline)) __attribute__ ((regparm(3)))
+bar (int arg1, int arg2, int arg3)
+{
+ int __attribute__ ((aligned(64))) a=1;
+ char * s = (char *) __builtin_alloca (arg3 + 1);
+
+ copy (s, arg3);
+ if (__builtin_strncmp (s, "good", arg3) != 0)
+ {
+#ifdef DEBUG
+ s[arg3] = '\0';
+ printf ("Failed: %s != good\n", s);
+#endif
+ abort ();
+ }
+
+ if (check_int (&a, __alignof__(a)) != a)
+ abort ();
+
+ ALTER_REGS();
+ throw arg1+arg2+arg3+a;
+}
+
+void
+foo()
+{
+ bar (1,2,3);
+}
+#endif
diff --git a/gcc/testsuite/g++.dg/torture/stackalign/unwind-4.C b/gcc/testsuite/g++.dg/torture/stackalign/unwind-4.C
new file mode 100644
index 00000000000..dacbd3dede9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/stackalign/unwind-4.C
@@ -0,0 +1,17 @@
+/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
+
+#include "test-unwind.h"
+
+#ifndef __PIC__
+volatile int __attribute__ ((aligned(32))) g_a=1;
+/* Test situation 4: no Drap and stack realign doesn't really happen */
+void __attribute__ ((noinline))
+foo()
+{
+ int i;
+ ALTER_REGS();
+ for (i=0; i < 10; i++)
+ g_a++;
+ throw g_a;
+}
+#endif
diff --git a/gcc/testsuite/g++.dg/torture/stackalign/unwind-5.C b/gcc/testsuite/g++.dg/torture/stackalign/unwind-5.C
new file mode 100644
index 00000000000..fde430bfb72
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/stackalign/unwind-5.C
@@ -0,0 +1,31 @@
+/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
+
+#include "test-unwind.h"
+
+#ifndef __PIC__
+double g_f=1.0;
+/* Test situation 5: Stack realign dosn't really happen with DRAP reg CX */
+void __attribute__ ((noinline)) __attribute__ ((regparm(2)))
+bar(int arg1, int arg2, int arg3, int arg4)
+{
+ char * s = (char *) __builtin_alloca (arg4 + 1);
+
+ copy (s, arg4);
+ if (__builtin_strncmp (s, "good", arg4) != 0)
+ {
+#ifdef DEBUG
+ s[arg4] = '\0';
+ printf ("Failed: %s != good\n", s);
+#endif
+ abort ();
+ }
+ ALTER_REGS();
+ if (g_f) throw arg1+arg2+arg3+ g_f;
+}
+
+void __attribute__((noinline))
+foo()
+{
+ bar(1,2,3,4);
+}
+#endif
diff --git a/gcc/testsuite/g++.dg/torture/stackalign/unwind-6.C b/gcc/testsuite/g++.dg/torture/stackalign/unwind-6.C
new file mode 100644
index 00000000000..7c9dee13338
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/stackalign/unwind-6.C
@@ -0,0 +1,31 @@
+/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
+
+#include "test-unwind.h"
+
+#ifndef __PIC__
+double g_f=1.0;
+/* Test situation 6: Stack realign dosn't really happen with DRAP reg DI */
+void __attribute__ ((noinline)) __attribute__ ((regparm(3)))
+bar(int arg1, int arg2, int arg3, int arg4)
+{
+ char * s = (char *) __builtin_alloca (arg4 + 1);
+
+ copy (s, arg4);
+ if (__builtin_strncmp (s, "good", arg4) != 0)
+ {
+#ifdef DEBUG
+ s[arg4] = '\0';
+ printf ("Failed: %s != good\n", s);
+#endif
+ abort ();
+ }
+ ALTER_REGS();
+ if (g_f) throw arg1+arg2+arg3+ g_f;
+}
+
+void __attribute__((noinline))
+foo()
+{
+ bar(1,2,3,4);
+}
+#endif
diff --git a/gcc/testsuite/g++.dg/tree-ssa/new1.C b/gcc/testsuite/g++.dg/tree-ssa/new1.C
new file mode 100644
index 00000000000..a859f0ac377
--- /dev/null
+++ b/gcc/testsuite/g++.dg/tree-ssa/new1.C
@@ -0,0 +1,42 @@
+// PR c++/36633
+
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wall -fdump-tree-forwprop1" } */
+// No particular reason for choosing forwprop1 dump to look at.
+
+struct B { ~B() {} };
+struct D : public B {};
+//struct D {};
+
+struct my_deleter
+{
+ void operator()(D * d)
+ {
+ // delete [] d;
+ }
+};
+
+struct smart_ptr
+{
+ smart_ptr(D * ptr) : p(ptr) { }
+ ~smart_ptr() { d(p); }
+ D * p;
+ my_deleter d;
+};
+
+int
+test01()
+{
+ smart_ptr p(new D[7]);
+
+ return 0;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-not "= .* \\+ -" "forwprop1" } } */
+/* { dg-final { cleanup-tree-dump "forwprop1" } } */
diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr19637.C b/gcc/testsuite/g++.dg/tree-ssa/pr19637.C
index 2d1dcceba42..cf70e404123 100644
--- a/gcc/testsuite/g++.dg/tree-ssa/pr19637.C
+++ b/gcc/testsuite/g++.dg/tree-ssa/pr19637.C
@@ -29,5 +29,6 @@ int foo_void_offset(void)
return reinterpret_cast<Foo *>(&i[0])->i[0];
}
-/* { dg-final { scan-tree-dump-times "return 1;" 3 "dom1" } } */
+/* Regarding the xfail, see PR36143. */
+/* { dg-final { scan-tree-dump-times "return 1;" 3 "dom1" { xfail *-*-* } } } */
/* { dg-final { cleanup-tree-dump "dom1" } } */
diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr31146-2.C b/gcc/testsuite/g++.dg/tree-ssa/pr31146-2.C
index 0fd60275b53..d2edb1953a3 100644
--- a/gcc/testsuite/g++.dg/tree-ssa/pr31146-2.C
+++ b/gcc/testsuite/g++.dg/tree-ssa/pr31146-2.C
@@ -20,5 +20,5 @@ double foo (void)
return v.a[2];
}
-/* { dg-final { scan-tree-dump "Replaced .*iftmp.* != 0B. with .1" "forwprop1" } } */
+/* { dg-final { scan-tree-dump "Replaced .* != 0B. with .1" "forwprop1" } } */
/* { dg-final { cleanup-tree-dump "forwprop1" } } */
diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr37084.C b/gcc/testsuite/g++.dg/tree-ssa/pr37084.C
new file mode 100644
index 00000000000..8fceb0cbbf3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/tree-ssa/pr37084.C
@@ -0,0 +1,16 @@
+// PR tree-optimization/37084
+// { dg-do compile }
+// { dg-options "-O" }
+
+struct A
+{
+ A ();
+};
+
+inline A
+foo ()
+{
+ return A ();
+}
+
+const A a (foo ());
diff --git a/gcc/testsuite/g++.dg/warn/Wconversion-integer.C b/gcc/testsuite/g++.dg/warn/Wconversion-integer.C
index 46900825a8b..42d9cb00044 100644
--- a/gcc/testsuite/g++.dg/warn/Wconversion-integer.C
+++ b/gcc/testsuite/g++.dg/warn/Wconversion-integer.C
@@ -42,8 +42,8 @@ void h (int x)
uc = x ? 1U : -1; /* { dg-warning "conversion" } */
uc = x ? SCHAR_MIN : 1U; /* { dg-warning "conversion" } */
- uc = x ? 1 : -1; /* { dg-warning "conversion" } */
- uc = x ? SCHAR_MIN : 1; /* { dg-warning "conversion" } */
+ uc = x ? 1 : -1; /* Warned by -Wsign-conversion. */
+ uc = x ? SCHAR_MIN : 1; /* Warned by -Wsign-conversion. */
ui = x ? 1U : -1; /* Warned by -Wsign-conversion. */
ui = x ? INT_MIN : 1U; /* Warned by -Wsign-conversion. */
ui = ui ? SCHAR_MIN : 1U; /* Warned by -Wsign-conversion. */
diff --git a/gcc/testsuite/g++.dg/warn/Wconversion-pr34389.C b/gcc/testsuite/g++.dg/warn/Wconversion-pr34389.C
new file mode 100644
index 00000000000..f3cd3105386
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wconversion-pr34389.C
@@ -0,0 +1,53 @@
+/* PR 34389 */
+/* { dg-do compile } */
+/* { dg-options "-Wconversion -Wsign-conversion" } */
+
+short mask1(short x)
+{
+ short y = 0x7fff;
+ return x & y; /* { dg-bogus "conversion" "conversion" { xfail *-*-* } 8 } */
+}
+
+short mask2(short ssx)
+{
+ short ssy;
+ short ssz;
+
+ ssz = ((int)ssx) & 0x7fff;
+ ssy = ((int)ssx) | 0x7fff;
+ ssz = ((int)ssx) ^ 0x7fff;
+ return ssx & 0x7fff;
+}
+
+short mask3(int si, unsigned int ui)
+{
+ short ss;
+ unsigned short us;
+
+ ss = si & 0x7fff;
+ ss = si & 0xAAAA; /* { dg-warning "conversion" } */
+ ss = ui & 0x7fff;
+ ss = ui & 0xAAAA; /* { dg-warning "conversion" } */
+
+ us = si & 0x7fff;
+ us = si & 0xAAAA; /* { dg-warning "conversion" } */
+ us = ui & 0x7fff;
+ us = ui & 0xAAAA; /* { dg-warning "conversion" } */
+
+ return ss;
+}
+
+short mask4(int x, int y)
+{
+ return x & y; /* { dg-warning "conversion" } */
+}
+
+short mask5(int x)
+{
+ return x & -1; /* { dg-warning "conversion" } */
+}
+
+short mask6(short x)
+{
+ return x & -1;
+}
diff --git a/gcc/testsuite/g++.dg/warn/Wsign-conversion.C b/gcc/testsuite/g++.dg/warn/Wsign-conversion.C
index b097446c3f8..83fe2ed660b 100644
--- a/gcc/testsuite/g++.dg/warn/Wsign-conversion.C
+++ b/gcc/testsuite/g++.dg/warn/Wsign-conversion.C
@@ -42,15 +42,15 @@ void h (int x)
uc = x ? 1U : -1; /* { dg-warning "negative integer implicitly converted to unsigned type" } */
uc = x ? SCHAR_MIN : 1U; /* { dg-warning "negative integer implicitly converted to unsigned type" } */
- uc = x ? 1 : -1;
- uc = x ? SCHAR_MIN : 1;
+ uc = x ? 1 : -1; /* { dg-warning "negative integer implicitly converted to unsigned type" } */
+ uc = x ? SCHAR_MIN : 1; /* { dg-warning "negative integer implicitly converted to unsigned type" } */
ui = x ? 1U : -1; /* { dg-warning "negative integer implicitly converted to unsigned type" } */
ui = x ? INT_MIN : 1U; /* { dg-warning "negative integer implicitly converted to unsigned type" } */
ui = ui ? SCHAR_MIN : 1U; /* { dg-warning "negative integer implicitly converted to unsigned type" } */
ui = 1U * -1; /* { dg-warning "negative integer implicitly converted to unsigned type" } */
ui = ui + INT_MIN; /* { dg-warning "negative integer implicitly converted to unsigned type" } */
- ui = x ? 1 : -1; /* { dg-warning "conversion" } */
- ui = ui ? SCHAR_MIN : 1; /* { dg-warning "conversion" } */
+ ui = x ? 1 : -1; /* { dg-warning "negative integer implicitly converted to unsigned type" } */
+ ui = ui ? SCHAR_MIN : 1; /* { dg-warning "negative integer implicitly converted to unsigned type" } */
fuc (-1); /* { dg-warning "negative integer implicitly converted to unsigned type" } */
uc = -1; /* { dg-warning "negative integer implicitly converted to unsigned type" } */
diff --git a/gcc/testsuite/g++.dg/warn/Wuninitializable-member-no.C b/gcc/testsuite/g++.dg/warn/Wuninitializable-member-no.C
new file mode 100644
index 00000000000..0f6ccfd9d62
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wuninitializable-member-no.C
@@ -0,0 +1,15 @@
+// Test disabling
+// { dg-do compile }
+// { dg-options "-Wall -Wextra -Wno-uninitialized" }
+
+class X {
+ int & flag;// { dg-bogus "non-static reference 'int& X::flag' in class without a constructor" }
+public:
+ void f(){ flag++ ; }
+};
+
+class Y {
+ const int var;// { dg-bogus "non-static const member 'const int Y::var' in class without a constructor" }
+public:
+ int g(){ return 2*var; }
+};
diff --git a/gcc/testsuite/g++.dg/warn/Wuninitializable-member.C b/gcc/testsuite/g++.dg/warn/Wuninitializable-member.C
new file mode 100644
index 00000000000..1c37e3ea023
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wuninitializable-member.C
@@ -0,0 +1,14 @@
+// { dg-do compile }
+// { dg-options "-Wuninitialized" }
+
+class X {
+ int & flag;// { dg-warning "non-static reference 'int& X::flag' in class without a constructor" }
+public:
+ void f(){ flag++ ; }
+};
+
+class Y {
+ const int var;// { dg-warning "non-static const member 'const int Y::var' in class without a constructor" }
+public:
+ int g(){ return 2*var; }
+};
diff --git a/gcc/testsuite/g++.dg/warn/pr12242.C b/gcc/testsuite/g++.dg/warn/pr12242.C
new file mode 100644
index 00000000000..db4cc103c3a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/pr12242.C
@@ -0,0 +1,57 @@
+// PR 12242: should warn about out-of-range int->enum conversions
+// { dg-do compile }
+// { dg-options "-Wconversion -fpermissive" }
+enum X { A };
+enum Y { B, C, D };
+
+void example ()
+{
+ int i = 5;
+ X x;
+ Y y;
+
+ x = 10; // { dg-warning "warning: invalid conversion from .int. to .X." }
+ // { dg-warning "warning:\[^\n\]*unspecified" "" { target *-*-* } 13 }
+ x = 1; // { dg-warning "warning: invalid conversion from .int. to .X." }
+ x = C; // { dg-error "error: cannot convert .Y. to .X. in assignment" }
+ x = D; // { dg-error "error: cannot convert .Y. to .X. in assignment" }
+ y = A; // { dg-error "error: cannot convert .X. to .Y. in assignment" }
+ x = y; // { dg-error "error: cannot convert .Y. to .X. in assignment" }
+ x = i; // { dg-warning "warning: invalid conversion from .int. to .X." }
+}
+
+void foo ()
+{
+ X a = static_cast<X> (10); // { dg-warning "warning:\[^\n\]*unspecified" }
+ X b = static_cast<X> (0);
+ X c = static_cast<X> (1);
+ X d = static_cast<X> (2); // { dg-warning "warning:\[^\n\]*unspecified" }
+ X f = static_cast<X> ((int)A);
+ X g = static_cast<X> (B);
+ X h = static_cast<X> (C);
+ X e = static_cast<X> (D); // { dg-warning "warning\[^\n\]*unspecified" }
+}
+
+enum QEvent { x = 42 };
+
+int bar()
+{
+ QEvent x = ( QEvent ) 42000; // { dg-warning "warning\[^\n\]*unspecified" }
+ return ( int ) x;
+}
+
+enum W {a,b,c};
+enum Z {d,e,f,g};
+void bazz (int, int, int, int);
+
+void baz() {
+ int three = 3;
+ int four = 4;
+ bazz (
+ W(three),
+ W(3),
+ Z(four),
+ Z(4) // { dg-warning "warning\[^\n\]*unspecified" }
+ );
+}
+
diff --git a/gcc/testsuite/g++.dg/warn/pr23075.C b/gcc/testsuite/g++.dg/warn/pr23075.C
index 1521b658139..e5b1b483d76 100644
--- a/gcc/testsuite/g++.dg/warn/pr23075.C
+++ b/gcc/testsuite/g++.dg/warn/pr23075.C
@@ -6,4 +6,4 @@ int
foo (void)
{
return; // { dg-error "with no value" }
-} // { dg-bogus "control reaches end" }
+} // { dg-warning "no return statement" }
diff --git a/gcc/testsuite/g++.dg/warn/pr26785.C b/gcc/testsuite/g++.dg/warn/pr26785.C
new file mode 100644
index 00000000000..b3c0313eaf6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/pr26785.C
@@ -0,0 +1,10 @@
+// PR 26785
+// { dg-do compile }
+// { dg-options "-fshow-column" }
+
+class foo {
+ foo::foo // { dg-error "3: error: extra qualification" }
+ (int a,
+ int b,
+ int c);
+};
diff --git a/gcc/testsuite/g++.dg/warn/pr30551-2.C b/gcc/testsuite/g++.dg/warn/pr30551-2.C
new file mode 100644
index 00000000000..911449d7a0f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/pr30551-2.C
@@ -0,0 +1,6 @@
+// PR 30551 -Wmain is enabled by -pedantic/-pedantic-errors.
+// { dg-do compile }
+// { dg-options "-pedantic-errors" }
+// { dg-skip-if "-Wmain not enabled with -pedantic on SPU" { spu-*-* } }
+int main(char a) {} /* { dg-error "error: first argument of .*main.* should be .int." } */
+/* { dg-error "error: .*main.* takes only zero or two arguments" "" { target *-*-* } 5 } */
diff --git a/gcc/testsuite/g++.dg/warn/pr30551.C b/gcc/testsuite/g++.dg/warn/pr30551.C
new file mode 100644
index 00000000000..e9144d5984f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/pr30551.C
@@ -0,0 +1,6 @@
+// PR 30551 -Wmain is enabled by default.
+// { dg-do compile }
+// { dg-options "" }
+// { dg-skip-if "-Wmain not enabled on SPU" { spu-*-* } }
+int main(char a) {} /* { dg-warning "warning: first argument of .*main.* should be .int." } */
+/* { dg-warning "warning: .*main.* takes only zero or two arguments" "" { target *-*-* } 5 } */
diff --git a/gcc/testsuite/g++.dg/warn/pr34985.C b/gcc/testsuite/g++.dg/warn/pr34985.C
new file mode 100644
index 00000000000..56437509d9f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/pr34985.C
@@ -0,0 +1,9 @@
+/* PR34985: Warning "defined but not used" despite __attribute__((__used__)) */
+/* { dg-do compile } */
+/* { dg-options "-Wall -Wextra -O2" } */
+static void xxyyzz (void);
+static void __attribute__((__used__)) xxyyzz(void)
+{
+}
+
+/* { dg-final { scan-assembler "xxyyzz" } } */
diff --git a/gcc/testsuite/g++.dg/warn/pr35635.C b/gcc/testsuite/g++.dg/warn/pr35635.C
new file mode 100644
index 00000000000..d3b39a2b0c8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/pr35635.C
@@ -0,0 +1,89 @@
+/* PR 35635 */
+/* { dg-do compile } */
+/* { dg-options "-Wconversion -Wsign-conversion" } */
+
+struct unsigned_bit {
+ unsigned int x:1;
+} unsigned_bit;
+struct signed_bit {
+ int x:1;
+} signed_bit;
+int bar;
+int bar2;
+
+void func1()
+{
+ /* The result of boolean operators fits in unsiged int:1, thus do
+ not warn. */
+ unsigned_bit.x = (bar != 0); /* { dg-bogus "conversion" } */
+ unsigned_bit.x = (bar == 0); /* { dg-bogus "conversion" } */
+ unsigned_bit.x = (bar <= 0); /* { dg-bogus "conversion" } */
+ unsigned_bit.x = (bar >= 0); /* { dg-bogus "conversion" } */
+ unsigned_bit.x = (bar < 0); /* { dg-bogus "conversion" } */
+ unsigned_bit.x = (bar > 0); /* { dg-bogus "conversion" } */
+ unsigned_bit.x = !bar; /* { dg-bogus "conversion" } */
+ unsigned_bit.x = (bar || bar2); /* { dg-bogus "conversion" } */
+ unsigned_bit.x = (bar && bar2); /* { dg-bogus "conversion" } */
+
+ /* Both branches of ? fit in the destination, thus do not warn. */
+ unsigned_bit.x = bar != 0 ? 1 : 0; /* { dg-bogus "conversion" } */
+ unsigned_bit.x = bar != 0 ? 1.0 : 0.0; /* { dg-bogus "conversion" } */
+
+ /* At least one branch of ? does not fit in the destination, thus
+ warn. */
+ unsigned_bit.x = bar != 0 ? 2 : 0; /* { dg-warning "conversion" } */
+ unsigned_bit.x = bar != 0 ? 0 : -1; /* { dg-warning "negative integer implicitly converted to unsigned type" } */
+}
+
+void func2()
+{
+ signed char schar_x;
+
+ /* Both branches of ? fit in the destination, thus do not warn. */
+ schar_x = bar != 0 ? 1 : 0; /* { dg-bogus "conversion" } */
+ schar_x = bar != 0 ? 2.0 : 10; /* { dg-bogus "conversion" } */
+
+ /* At least one branch of ? does not fit in the destination, thus
+ warn. */
+ schar_x = bar != 0 ? 2.1 : 10; /* { dg-warning "conversion" } */
+ schar_x = bar != 0 ? (signed char) 1024: -1024; /* { dg-warning "conversion" } */
+}
+
+
+
+void func3()
+{
+ unsigned char uchar_x;
+
+ /* Both branches of ? fit in the destination, thus do not warn. */
+ uchar_x = bar != 0 ? 1 : 0;
+ uchar_x = bar != 0 ? 2.0 : 10;
+
+ /* At least one branch of ? does not fit in the destination, thus
+ warn. */
+ uchar_x = bar != 0 ? 2.1 : 10; /* { dg-warning "conversion" } */
+ uchar_x = bar != 0
+ ? (unsigned char) 1024
+ : -1; /* { dg-warning "negative integer implicitly converted to unsigned type" } */
+}
+
+void func4()
+{
+ signed_bit.x = -1; /* { dg-bogus "conversion" } */
+ signed_bit.x = bar != 0 ? -1.0 : 0.0; /* { dg-bogus "conversion" } */
+ signed_bit.x = bar != 0 ? -1 : 0; /* { dg-bogus "conversion" } */
+
+ signed_bit.x = 1; /* { dg-warning "conversion" } */
+ signed_bit.x = (bar != 0); /* { dg-warning "conversion" } */
+ signed_bit.x = (bar == 0); /* { dg-warning "conversion" } */
+ signed_bit.x = (bar <= 0); /* { dg-warning "conversion" } */
+ signed_bit.x = (bar >= 0); /* { dg-warning "conversion" } */
+ signed_bit.x = (bar < 0); /* { dg-warning "conversion" } */
+ signed_bit.x = (bar > 0); /* { dg-warning "conversion" } */
+ signed_bit.x = !bar; /* { dg-warning "conversion" } */
+ signed_bit.x = (bar || bar2); /* { dg-warning "conversion" } */
+ signed_bit.x = (bar && bar2); /* { dg-warning "conversion" } */
+ signed_bit.x = bar != 0 ? 1 : 0; /* { dg-warning "conversion" } */
+ signed_bit.x = bar != 0 ? 2 : 0; /* { dg-warning "conversion" } */
+}
+
diff --git a/gcc/testsuite/g++.dg/warn/pr36999.C b/gcc/testsuite/g++.dg/warn/pr36999.C
new file mode 100644
index 00000000000..ce2286efcf4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/pr36999.C
@@ -0,0 +1,40 @@
+/* PR36999: Erroneous "does not declare anything" warnings. */
+/* { dg-do compile } */
+
+class C1 {
+ public: class C2 { };
+};
+
+void cf1 (class C1::C2, void*); // { dg-bogus "does not declare anything" }
+void cf2 (void*, class C1::C2);
+void cf3 (C1::C2, void*);
+
+namespace N {
+
+enum E1 { foo };
+enum E2 { bar };
+
+template <class X>
+class TC1 { };
+
+template <class T, class U>
+class TC2 : public TC1<T> { };
+
+}
+
+void
+tcf1 (N::TC2<enum N::E1, void*> *arg1, // { dg-bogus "does not declare anything" }
+ N::TC2<void*, enum N::E1> *arg2,
+ N::TC2<N::E1, void*> *arg3)
+{
+}
+
+void *
+tcf2 (void *x)
+{
+ return (void *)
+ (N::TC2<enum N::E1, void*> *) // { dg-bogus "does not declare anything" }
+ (N::TC2<void*, enum N::E1> *)
+ (N::TC2<N::E1, void*> *)
+ x;
+}
diff --git a/gcc/testsuite/g++.dg/warn/pr8715.C b/gcc/testsuite/g++.dg/warn/pr8715.C
new file mode 100644
index 00000000000..330c148bb59
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/pr8715.C
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-Wsign-compare" } */
+
+int foo()
+{
+ unsigned char b = '1';
+
+ bool x = ~b; /* { dg-warning "promoted ~unsigned is always non-zero" } */
+
+ return 0;
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/tem03.C b/gcc/testsuite/g++.old-deja/g++.benjamin/tem03.C
index 73b99659e12..8f7459f17fb 100644
--- a/gcc/testsuite/g++.old-deja/g++.benjamin/tem03.C
+++ b/gcc/testsuite/g++.old-deja/g++.benjamin/tem03.C
@@ -83,7 +83,7 @@ public:
template <class T10, int i> struct Xfour {// { dg-error "" } .*
int T10; // { dg-error "" } .*
void f(){
- char T10;
+ char T10; // { dg-error "error: declaration of 'char T10'" }
}
};
@@ -123,11 +123,11 @@ public:
template <class U>
friend bool fooy(U u);
- template <class T161>
+ template <class T161> // { dg-error "error: declaration of 'class T161'" }
friend bool foo(T161 u)
{
- Xseven<T161, 5, int> obj; // { dg-error "" } .*
- return (obj.inst == u.inst); // { dg-error "" } .*
+ Xseven<T161, 5, int> obj;
+ return (obj.inst == u.inst);
}
};
diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/tem04.C b/gcc/testsuite/g++.old-deja/g++.benjamin/tem04.C
index d486efbbaef..7dd7462c334 100644
--- a/gcc/testsuite/g++.old-deja/g++.benjamin/tem04.C
+++ b/gcc/testsuite/g++.old-deja/g++.benjamin/tem04.C
@@ -91,7 +91,7 @@ public:
template <typename T14, template <typename T15> class C12>// { dg-error "" } .*
class Xeighteen {
protected:
- C12<T14> value; // { dg-error "" }
+ C12<T14> value;
int C12; // { dg-error "" } .*
};
diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/crash52.C b/gcc/testsuite/g++.old-deja/g++.brendan/crash52.C
index 9e72fb5cbb0..74df601554e 100644
--- a/gcc/testsuite/g++.old-deja/g++.brendan/crash52.C
+++ b/gcc/testsuite/g++.old-deja/g++.brendan/crash52.C
@@ -10,4 +10,4 @@ public:
A &f(A &a) {// { dg-error "" } new decl.*
std::cout << "Blah\n";
-}
+} // { dg-error "no return statement" }
diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/crash7.C b/gcc/testsuite/g++.old-deja/g++.brendan/crash7.C
index 99fee519f52..d53dee77dd3 100644
--- a/gcc/testsuite/g++.old-deja/g++.brendan/crash7.C
+++ b/gcc/testsuite/g++.old-deja/g++.brendan/crash7.C
@@ -44,5 +44,5 @@ void Sort<Comp>::sort (Vector<Comp::T> &v)// { dg-error "" } use of bad T
void
f (Vector<int> &vi)
{
- Sort<Comparator<int> >::sort (vi);
+ Sort<Comparator<int> >::sort (vi); // { dg-error "error: 'sort' is not a member of 'Sort<Comparator<int> >'" }
}
diff --git a/gcc/testsuite/g++.old-deja/g++.jason/report.C b/gcc/testsuite/g++.old-deja/g++.jason/report.C
index e2d805e082c..f4e02a4dc35 100644
--- a/gcc/testsuite/g++.old-deja/g++.jason/report.C
+++ b/gcc/testsuite/g++.old-deja/g++.jason/report.C
@@ -56,7 +56,7 @@ bar2 baz (X::Y y) // { dg-error "" } in this context
bar2 wa [5];
wa[0] = baz(f);
undef2 (1); // { dg-error "" } implicit declaration
-}
+} // { dg-error "no return statement" }
int ninny ()
{
@@ -71,4 +71,4 @@ int ninny ()
int darg (char X::*p)
{
undef3 (1); // { dg-error "" } implicit declaration
-}
+} // { dg-error "no return statement" }
diff --git a/gcc/testsuite/g++.old-deja/g++.jason/thunk3.C b/gcc/testsuite/g++.old-deja/g++.jason/thunk3.C
index 1b235ef58e9..d91982f7ed0 100644
--- a/gcc/testsuite/g++.old-deja/g++.jason/thunk3.C
+++ b/gcc/testsuite/g++.old-deja/g++.jason/thunk3.C
@@ -1,4 +1,4 @@
-// { dg-do run { xfail rs6000-*-* powerpc-*-eabi m68k-*-coff mn10300-*-* v850-*-* sh-*-* sh64-*-* h8*-*-* xtensa-*-* m32r*-*-* } }
+// { dg-do run { xfail rs6000-*-* powerpc-*-eabi m68k-*-coff mn10300-*-* v850-*-* sh-*-* sh64-*-* h8*-*-* xtensa*-*-* m32r*-*-* } }
// Test that variadic function calls using thunks work right.
// Note that this will break on any target that uses the generic thunk
// support, because it doesn't support variadic functions.
diff --git a/gcc/testsuite/g++.old-deja/g++.other/decl5.C b/gcc/testsuite/g++.old-deja/g++.other/decl5.C
index f8c447c01d3..fccc18c8933 100644
--- a/gcc/testsuite/g++.old-deja/g++.other/decl5.C
+++ b/gcc/testsuite/g++.old-deja/g++.other/decl5.C
@@ -16,7 +16,7 @@ struct A {
int m;
};
struct Z;
- expand me;
+ expand me; // { dg-error "error: 'expand' does not name a type" }
void foo(struct A::e);
void foo(struct A::z); // { dg-warning "" } extra qualification
};
@@ -71,7 +71,7 @@ namespace NMS
};
}
-NMS::D thing;
+NMS::D thing; // { dg-error "error: 'D' in namespace 'NMS' does not name a type" }
void NMS::fn()
{
i = 3;
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/error2.C b/gcc/testsuite/g++.old-deja/g++.pt/error2.C
index 2f777afdc70..40f7a7cb67f 100644
--- a/gcc/testsuite/g++.old-deja/g++.pt/error2.C
+++ b/gcc/testsuite/g++.old-deja/g++.pt/error2.C
@@ -2,7 +2,7 @@
// Origin: Carl Nygard <cnygard@bellatlantic.net>
template <class RT>
-class Test { // { dg-error "" } in instantiation
+class Test {
public:
Test(const RT& c = RT()) {} // { dg-error "" } reference to void
};
diff --git a/gcc/testsuite/gcc.c-torture/compile/20001226-1.c b/gcc/testsuite/gcc.c-torture/compile/20001226-1.c
index 19701ab3877..64cf37cb840 100644
--- a/gcc/testsuite/gcc.c-torture/compile/20001226-1.c
+++ b/gcc/testsuite/gcc.c-torture/compile/20001226-1.c
@@ -3,7 +3,7 @@
/* { dg-do assemble } */
/* { dg-xfail-if "function larger than 64K" { m6811-*-* } { "*" } { "" } } */
/* { dg-skip-if "too much code for avr" { "avr-*-*" } { "*" } { "" } } */
-/* { dg-xfail-if "jump beyond 128K not supported" { xtensa-*-* } { "-O0" } { "" } } */
+/* { dg-xfail-if "jump beyond 128K not supported" { xtensa*-*-* } { "-O0" } { "" } } */
/* { dg-xfail-if "PR36698" { spu-*-* } { "-O0" } { "" } } */
/* { dg-skip-if "" { m32c-*-* } { "*" } { "" } } */
diff --git a/gcc/testsuite/gcc.c-torture/compile/20080704-1.c b/gcc/testsuite/gcc.c-torture/compile/20080704-1.c
index 9ca457cb952..b5e38b4ba60 100644
--- a/gcc/testsuite/gcc.c-torture/compile/20080704-1.c
+++ b/gcc/testsuite/gcc.c-torture/compile/20080704-1.c
@@ -1,5 +1,5 @@
/* This code used to crash fold_convert due to PRE
- wanting to fold_convert from a REA_TYPE to an INTEGER_TYPE. */
+ wanting to fold_convert from a REAL_TYPE to an INTEGER_TYPE. */
typedef unsigned int uint32_t;
union double_union
{
diff --git a/gcc/testsuite/gcc.c-torture/compile/20080721-1.c b/gcc/testsuite/gcc.c-torture/compile/20080721-1.c
new file mode 100644
index 00000000000..35ef352bc6d
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20080721-1.c
@@ -0,0 +1,15 @@
+void foo(void);
+void bar(void);
+
+int test(int b)
+{
+ void *p, **q;
+ if (b)
+ p = (void *)foo;
+ else
+ p = (void *)bar;
+ q = (void **)p;
+ if (*q == (void *)0)
+ return 1;
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/20080806-1.c b/gcc/testsuite/gcc.c-torture/compile/20080806-1.c
new file mode 100644
index 00000000000..c54e7397f5d
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20080806-1.c
@@ -0,0 +1,41 @@
+/* This used to ICE on s390x due to a reload bug. */
+
+#if defined(STACK_SIZE) && (STACK_SIZE < 65536)
+ #define BYTES 64
+#else
+ #define BYTES 65400
+#endif
+
+int gl2;
+typedef __SIZE_TYPE__ size_t;
+
+extern void *memcpy (void *dest, const void *src, size_t n);
+
+void
+f1 ()
+{
+ int i2;
+ unsigned char bf[BYTES];
+
+ for (i2 = 0; i2 < 3; i2++)
+ {
+ unsigned char *p2 = bf;
+ unsigned char *p3 = ((void *) 0);
+ unsigned short ctf2;
+
+ p2 += sizeof (short);
+
+ for (ctf2 = 0; ctf2 < 3; ctf2++)
+ {
+ if (ctf2 == 1)
+ {
+ unsigned short of = p2 - bf - 6;
+ unsigned short *ofp = (unsigned short *) &of;
+ memcpy (p3, ofp, sizeof (short));
+ }
+
+ if (gl2 == 1)
+ p2 += 3;
+ }
+ }
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/20080812-1.c b/gcc/testsuite/gcc.c-torture/compile/20080812-1.c
new file mode 100644
index 00000000000..2e4c13a70c8
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20080812-1.c
@@ -0,0 +1,21 @@
+/* PR middle-end/37014 */
+
+void bar (signed char *);
+
+void
+foo (int x, int y)
+{
+ int i;
+ signed char a[123], b[123], c;
+ for (i = 0; i < 123; i++)
+ {
+ int e = y - x;
+ int d = e < 0 ? -e : e;
+ c = d < 75;
+ a[y] = c;
+ b[y] = c;
+ y--;
+ }
+ bar (b);
+ bar (a);
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr11832.c b/gcc/testsuite/gcc.c-torture/compile/pr11832.c
index 88469ff6940..60017d3fb88 100644
--- a/gcc/testsuite/gcc.c-torture/compile/pr11832.c
+++ b/gcc/testsuite/gcc.c-torture/compile/pr11832.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
-/* Currently ICEs for MIPS and PowerPC; see PR33642. */
-/* { dg-xfail-if "PR33642" { mips*-*-* powerpc*-*-linux* } { "*" } { "" } } */
+/* Currently ICEs for MIPS, CRIS and PowerPC; see PR33642. */
+/* { dg-xfail-if "PR33642" { mips*-*-* powerpc*-*-linux* cris-*-* crisv32-*-* } { "*" } { "" } } */
/* Currently ICEs for (x86 && ilp32 && pic). */
/* { dg-xfail-if "PR33642/36240" { { i?86-*-* x86_64-*-* } && { ilp32 && { ! nonpic } } } { "*" } { "" } } */
/* { dg-prune-output ".*internal compiler error.*" }
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr33009.c b/gcc/testsuite/gcc.c-torture/compile/pr33009.c
index 79a4b62a3a6..026162c2e70 100644
--- a/gcc/testsuite/gcc.c-torture/compile/pr33009.c
+++ b/gcc/testsuite/gcc.c-torture/compile/pr33009.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
-/* Currently ICEs for MIPS and PowerPC; see PR33642. */
-/* { dg-xfail-if "PR33642" { mips*-*-* powerpc*-*-linux* } { "*" } { "" } } */
+/* Currently ICEs for MIPS, CRIS and PowerPC; see PR33642. */
+/* { dg-xfail-if "PR33642" { mips*-*-* powerpc*-*-linux* cris-*-* crisv32-*-* } { "*" } { "" } } */
/* Currently ICEs for (x86 && ilp32 && pic). */
/* { dg-xfail-if "PR33642/36240" { { i?86-*-* x86_64-*-* } && { ilp32 && { ! nonpic } } } { "*" } { "" } } */
/* { dg-prune-output ".*internal compiler error.*" }
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr35432.c b/gcc/testsuite/gcc.c-torture/compile/pr35432.c
new file mode 100644
index 00000000000..6a0c9217746
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr35432.c
@@ -0,0 +1,11 @@
+/* PR middle-end/35432 */
+
+struct A
+{
+ char c[0];
+};
+
+void foo(struct A a)
+{
+ (a = a).c;
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr36238.c b/gcc/testsuite/gcc.c-torture/compile/pr36238.c
new file mode 100644
index 00000000000..358e1ff5e28
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr36238.c
@@ -0,0 +1,27 @@
+typedef signed char int8_t;
+typedef int int32_t;
+typedef unsigned short int uint16_t;
+typedef unsigned int uint32_t;
+int32_t g_19 = 0x67F5AEE0L;
+uint16_t g_169 = 0x89E3L;
+const volatile uint32_t g_258 = 0x63AFEBCAL;
+int32_t func_11;
+int32_t func_29;
+int32_t
+func_5 (int32_t p_6, int32_t p_8, uint16_t p_10)
+{
+ if (lshift_s_s (func_11, p_8))
+ {
+ int8_t l_18 = 0x6FL;
+ if (l_18)
+ for (p_6 = -14;; g_19 += 6)
+ {
+ int32_t l_283 = -1L;
+ if (((0x45L / 1L) > 0x07414511L * 1L / 1L > func_29) / 1L)
+ for (p_8 = 6;; p_8 -= 5)
+ l_283 = 0xC90541F7L;
+ }
+ }
+ else
+ g_169 = g_258;
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr36988.c b/gcc/testsuite/gcc.c-torture/compile/pr36988.c
new file mode 100644
index 00000000000..44118d5dda3
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr36988.c
@@ -0,0 +1,11 @@
+typedef struct {
+ unsigned char mbxCommand;
+} MAILBOX_t;
+void lpfc_sli_brdrestart(void)
+{
+ volatile unsigned int word0;
+ MAILBOX_t *mb;
+ mb = (MAILBOX_t *) &word0;
+ mb->mbxCommand = 0x1A;
+ __writel((*(unsigned int *) mb));
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37026.c b/gcc/testsuite/gcc.c-torture/compile/pr37026.c
new file mode 100644
index 00000000000..694e2ca2a5f
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr37026.c
@@ -0,0 +1,12 @@
+struct a {
+ long a1;
+ long a2;
+};
+struct b {
+ struct a b1;
+ struct a b2;
+};
+void bar (struct b *c)
+{
+ c->b1 = c->b2 = ((struct a) { foo(), 0 });
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37056.c b/gcc/testsuite/gcc.c-torture/compile/pr37056.c
new file mode 100644
index 00000000000..f9285e2c784
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr37056.c
@@ -0,0 +1,28 @@
+extern void abort (void);
+
+static union {
+ char buf[12 * sizeof (long long)];
+} u;
+
+int main ()
+{
+ int off, len, i;
+ char *p, *q;
+
+ for (off = 0; off < (sizeof (long long)); off++)
+ for (len = 1; len < (10 * sizeof (long long)); len++)
+ {
+ for (i = 0; i < (12 * sizeof (long long)); i++)
+ u.buf[i] = 'a';
+ p = (__extension__ (__builtin_constant_p ('\0') && ('\0') == '\0'
+ ? ({void *__s = (u.buf + off); __s;})
+ : __builtin_memset (u.buf + off, '\0', len)));
+ if (p != u.buf + off)
+ abort ();
+ for (i = 0; i < off; i++, q++)
+ if (*q != 'a')
+ abort ();
+ }
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.c-torture/execute/20031003-1.c b/gcc/testsuite/gcc.c-torture/execute/20031003-1.c
index 5d39d799e50..5d172e7e604 100644
--- a/gcc/testsuite/gcc.c-torture/execute/20031003-1.c
+++ b/gcc/testsuite/gcc.c-torture/execute/20031003-1.c
@@ -19,9 +19,15 @@ int main()
#if INT_MAX == 2147483647
if (f1() != 2147483647)
abort ();
+#ifdef __SPU__
+ /* SPU float rounds towards zero. */
+ if (f2() != 0x7fffff80)
+ abort ();
+#else
if (f2() != 2147483647)
abort ();
#endif
+#endif
return 0;
}
diff --git a/gcc/testsuite/gcc.c-torture/execute/20080719-1.c b/gcc/testsuite/gcc.c-torture/execute/20080719-1.c
new file mode 100644
index 00000000000..694abcbf985
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20080719-1.c
@@ -0,0 +1,65 @@
+typedef unsigned int u32;
+
+static const u32 deadfish = 0xdeadf155;
+
+static const u32 cfb_tab8_be[] = {
+ 0x00000000,0x000000ff,0x0000ff00,0x0000ffff,
+ 0x00ff0000,0x00ff00ff,0x00ffff00,0x00ffffff,
+ 0xff000000,0xff0000ff,0xff00ff00,0xff00ffff,
+ 0xffff0000,0xffff00ff,0xffffff00,0xffffffff
+};
+
+static const u32 cfb_tab8_le[] = {
+ 0x00000000,0xff000000,0x00ff0000,0xffff0000,
+ 0x0000ff00,0xff00ff00,0x00ffff00,0xffffff00,
+ 0x000000ff,0xff0000ff,0x00ff00ff,0xffff00ff,
+ 0x0000ffff,0xff00ffff,0x00ffffff,0xffffffff
+};
+
+static const u32 cfb_tab16_be[] = {
+ 0x00000000, 0x0000ffff, 0xffff0000, 0xffffffff
+};
+
+static const u32 cfb_tab16_le[] = {
+ 0x00000000, 0xffff0000, 0x0000ffff, 0xffffffff
+};
+
+static const u32 cfb_tab32[] = {
+ 0x00000000, 0xffffffff
+};
+
+
+
+
+
+
+const u32 *xxx(int bpp)
+{
+ const u32 *tab;
+
+if (0) return &deadfish;
+
+ switch (bpp) {
+ case 8:
+ tab = cfb_tab8_be;
+ break;
+ case 16:
+ tab = cfb_tab16_be;
+ break;
+ case 32:
+ default:
+ tab = cfb_tab32;
+ break;
+ }
+
+ return tab;
+}
+
+int main(void)
+{
+ const u32 *a = xxx(8);
+ int b = a[0];
+ if (b != cfb_tab8_be[0])
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/20080813-1.c b/gcc/testsuite/gcc.c-torture/execute/20080813-1.c
new file mode 100644
index 00000000000..9ef6bc2e2c5
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20080813-1.c
@@ -0,0 +1,30 @@
+/* PR middle-end/37103 */
+
+extern void abort (void);
+
+void
+foo (unsigned short x)
+{
+ signed char y = -1;
+ if (x == y)
+ abort ();
+}
+
+void
+bar (unsigned short x)
+{
+ unsigned char y = -1;
+ if (x == y)
+ abort ();
+}
+
+int
+main (void)
+{
+ if (sizeof (int) == sizeof (short))
+ return 0;
+ foo (-1);
+ if (sizeof (short) > 1)
+ bar (-1);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/conversion.c b/gcc/testsuite/gcc.c-torture/execute/conversion.c
index 9e62acfd2ad..82d681acfe6 100644
--- a/gcc/testsuite/gcc.c-torture/execute/conversion.c
+++ b/gcc/testsuite/gcc.c-torture/execute/conversion.c
@@ -284,9 +284,15 @@ test_float_to_integer()
abort();
if (f2u(1.99) != 1)
abort();
+#ifdef __SPU__
+ /* SPU float rounds towards zero. */
+ if (f2u((float) ((~0U) >> 1)) != 0x7fffff80)
+ abort();
+#else
if (f2u((float) ((~0U) >> 1)) != (~0U) >> 1 && /* 0x7fffffff */
f2u((float) ((~0U) >> 1)) != ((~0U) >> 1) + 1)
abort();
+#endif
if (f2u((float) ~((~0U) >> 1)) != ~((~0U) >> 1)) /* 0x80000000 */
abort();
@@ -439,9 +445,15 @@ test_float_to_longlong_integer()
abort();
if (f2ull(1.99) != 1LL)
abort();
+#ifdef __SPU__
+ /* SPU float rounds towards zero. */
+ if (f2ull((float) ((~0ULL) >> 1)) != 0x7fffff8000000000ULL)
+ abort();
+#else
if (f2ull((float) ((~0ULL) >> 1)) != (~0ULL) >> 1 && /* 0x7fffffff */
f2ull((float) ((~0ULL) >> 1)) != ((~0ULL) >> 1) + 1)
abort();
+#endif
if (f2ull((float) ~((~0ULL) >> 1)) != ~((~0ULL) >> 1)) /* 0x80000000 */
abort();
diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/inf-2.c b/gcc/testsuite/gcc.c-torture/execute/ieee/inf-2.c
index 40270c0f6ab..1823b35ff0f 100644
--- a/gcc/testsuite/gcc.c-torture/execute/ieee/inf-2.c
+++ b/gcc/testsuite/gcc.c-torture/execute/ieee/inf-2.c
@@ -25,6 +25,9 @@ void test(double f, double i)
void testf(float f, float i)
{
+#ifndef __SPU__
+ /* The SPU single-precision floating point format does not support Inf. */
+
if (f == __builtin_inff())
abort ();
if (f == -__builtin_inff())
@@ -44,6 +47,7 @@ void testf(float f, float i)
abort ();
if (f < -__builtin_inff())
abort ();
+#endif
}
void testl(long double f, long double i)
diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/rbug.c b/gcc/testsuite/gcc.c-torture/execute/ieee/rbug.c
index ce13d7e9eed..1586bd7d43b 100644
--- a/gcc/testsuite/gcc.c-torture/execute/ieee/rbug.c
+++ b/gcc/testsuite/gcc.c-torture/execute/ieee/rbug.c
@@ -41,8 +41,14 @@ main ()
k = 0x8234508000000001ULL;
x = s (k);
k = (unsigned long long) x;
+#ifdef __SPU__
+ /* SPU float rounds towards zero. */
+ if (k != 0x8234500000000000ULL)
+ abort ();
+#else
if (k != 0x8234510000000000ULL)
abort ();
+#endif
exit (0);
}
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr36691.c b/gcc/testsuite/gcc.c-torture/execute/pr36691.c
new file mode 100644
index 00000000000..81fe6fd55d9
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr36691.c
@@ -0,0 +1,17 @@
+unsigned char g_5;
+
+void func_1 (void)
+{
+ for (g_5 = 9; g_5 >= 4; g_5 -= 5)
+ ;
+}
+
+extern void abort (void);
+int main (void)
+{
+ func_1 ();
+ if (g_5 != 0)
+ abort ();
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.dg/20040206-1.c b/gcc/testsuite/gcc.dg/20040206-1.c
index b4b509bfc7e..c9c776f0bd0 100644
--- a/gcc/testsuite/gcc.dg/20040206-1.c
+++ b/gcc/testsuite/gcc.dg/20040206-1.c
@@ -7,5 +7,5 @@
The warning about "no return statement in function
returning non-void" is PR 13000. */
-static int foo (int a __attribute__((unused)) ) { } /* { dg-warning "control reaches end of non-void" } */
+static int foo (int a __attribute__((unused)) ) { } /* { dg-warning "no return statement" } */
int main (void) { return foo (0); }
diff --git a/gcc/testsuite/gcc.dg/20041213-1.c b/gcc/testsuite/gcc.dg/20041213-1.c
index f7ef30a62f9..be1ab00241c 100644
--- a/gcc/testsuite/gcc.dg/20041213-1.c
+++ b/gcc/testsuite/gcc.dg/20041213-1.c
@@ -1,33 +1,33 @@
/* { dg-do compile } */
/* { dg-options "" } */
/* test redeclarations with void and implicit int */
-extern foo1(); /* { dg-error "previous declaration" } */
+extern foo1(); /* { dg-message "note: previous declaration" } */
extern void foo1(); /* { dg-error "conflicting types" } */
-extern void foo2(); /* { dg-error "previous declaration" } */
+extern void foo2(); /* { dg-message "note: previous declaration" } */
extern foo2(); /* { dg-error "conflicting types" } */
-void foo3() {} /* { dg-error "previous definition" } */
+void foo3() {} /* { dg-message "note: previous definition" } */
extern foo3(); /* { dg-error "conflicting types" } */
-extern foo4(); /* { dg-error "previous declaration" } */
+extern foo4(); /* { dg-message "note: previous declaration" } */
void foo4() {} /* { dg-error "conflicting types" } */
-extern void foo5(); /* { dg-warning "previous declaration" } */
+extern void foo5(); /* { dg-message "note: previous declaration" } */
foo5() {} /* { dg-warning "conflicting types" } */
-foo6() {} /* { dg-error "previous definition" } */
+foo6() {} /* { dg-message "note: previous definition" } */
extern void foo6(); /* { dg-error "conflicting types" } */
-foo7() {} /* { dg-error "previous definition" } */
+foo7() {} /* { dg-message "note: previous definition" } */
void foo7() {} /* { dg-error "conflicting types" } */
-void foo8() {} /* { dg-error "previous definition" } */
+void foo8() {} /* { dg-message "note: previous definition" } */
foo8() {} /* { dg-error "conflicting types" } */
-int use9() { foo9(); } /* { dg-warning "previous implicit declaration" } */
+int use9() { foo9(); } /* { dg-message "note: previous implicit declaration" } */
extern void foo9(); /* { dg-warning "conflicting types" } */
-int use10() { foo10(); } /* { dg-warning "previous implicit declaration" } */
+int use10() { foo10(); } /* { dg-message "note: previous implicit declaration" } */
void foo10() {} /* { dg-warning "conflicting types" } */
diff --git a/gcc/testsuite/gcc.dg/20080615-1.c b/gcc/testsuite/gcc.dg/20080615-1.c
new file mode 100644
index 00000000000..bce9476cddb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/20080615-1.c
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-options "-w -O2" } */
+
+static int *see_bb_splay_ar = ((void *) 0);
+static void
+see_merge_and_eliminate_extensions (void)
+{
+ int i = 0;
+ printf ("* Phase 2: Merge and eliminate locally redundant extensions. *\n");
+ splay_tree_foreach (see_bb_splay_ar[i], ((void *) 0), ((void *) 0));
+}
+static void
+see_main (void)
+{
+ int i = 0;
+ see_merge_and_eliminate_extensions ();
+ printf ("Searching register properties in bb %d\n", i);
+}
+gate_handle_see (void)
+{
+}
+rest_of_handle_see (void)
+{
+ see_main ();
+}
diff --git a/gcc/testsuite/gcc.dg/Wall.c b/gcc/testsuite/gcc.dg/Wall.c
index 86a359b49cd..89848471780 100644
--- a/gcc/testsuite/gcc.dg/Wall.c
+++ b/gcc/testsuite/gcc.dg/Wall.c
@@ -3,8 +3,7 @@
/* { dg-do compile } */
/* { dg-options "-Wall" } */
-void foo()
+void foo(int a)
{
- int a;
5 * (a == 1) | (a == 2); /* { dg-warning "no effect" "no effect" } */
}
diff --git a/gcc/testsuite/gcc.dg/Wconversion-integer-no-sign.c b/gcc/testsuite/gcc.dg/Wconversion-integer-no-sign.c
index 0847db28da9..c17d502d8f3 100644
--- a/gcc/testsuite/gcc.dg/Wconversion-integer-no-sign.c
+++ b/gcc/testsuite/gcc.dg/Wconversion-integer-no-sign.c
@@ -42,8 +42,8 @@ void h (int x)
uc = x ? 1U : -1; /* { dg-warning "conversion" } */
uc = x ? SCHAR_MIN : 1U; /* { dg-warning "conversion" } */
- uc = x ? 1 : -1; /* { dg-warning "conversion" } */
- uc = x ? SCHAR_MIN : 1; /* { dg-warning "conversion" } */
+ uc = x ? 1 : -1; /* Warned by -Wsign-conversion. */
+ uc = x ? SCHAR_MIN : 1; /* Warned by -Wsign-conversion. */
ui = x ? 1U : -1; /* Warned by -Wsign-conversion. */
ui = x ? INT_MIN : 1U; /* Warned by -Wsign-conversion. */
ui = ui ? SCHAR_MIN : 1U; /* Warned by -Wsign-conversion. */
diff --git a/gcc/testsuite/gcc.dg/Wconversion-integer.c b/gcc/testsuite/gcc.dg/Wconversion-integer.c
index 9e3b948251c..b2101076f93 100644
--- a/gcc/testsuite/gcc.dg/Wconversion-integer.c
+++ b/gcc/testsuite/gcc.dg/Wconversion-integer.c
@@ -44,15 +44,15 @@ void h (int x)
/* { dg-warning "negative integer implicitly converted to unsigned type" "" { target *-*-* } 43 } */
uc = x ? SCHAR_MIN : 1U; /* { dg-warning "conversion" } */
/* { dg-warning "negative integer implicitly converted to unsigned type" "" { target *-*-* } 45 } */
- uc = x ? 1 : -1; /* { dg-warning "conversion" } */
- uc = x ? SCHAR_MIN : 1; /* { dg-warning "conversion" } */
+ uc = x ? 1 : -1; /* { dg-warning "negative integer implicitly converted to unsigned type" } */
+ uc = x ? SCHAR_MIN : 1; /* { dg-warning "negative integer implicitly converted to unsigned type" } */
ui = x ? 1U : -1; /* { dg-warning "negative integer implicitly converted to unsigned type" } */
ui = x ? INT_MIN : 1U; /* { dg-warning "negative integer implicitly converted to unsigned type" } */
ui = ui ? SCHAR_MIN : 1U; /* { dg-warning "negative integer implicitly converted to unsigned type" } */
ui = 1U * -1; /* { dg-warning "negative integer implicitly converted to unsigned type" } */
ui = ui + INT_MIN; /* { dg-warning "negative integer implicitly converted to unsigned type" } */
- ui = x ? 1 : -1; /* { dg-warning "conversion" } */
- ui = ui ? SCHAR_MIN : 1; /* { dg-warning "conversion" } */
+ ui = x ? 1 : -1; /* { dg-warning "negative integer implicitly converted to unsigned type" } */
+ ui = ui ? SCHAR_MIN : 1; /* { dg-warning "negative integer implicitly converted to unsigned type" } */
fuc (-1); /* { dg-warning "negative integer implicitly converted to unsigned type" } */
uc = -1; /* { dg-warning "negative integer implicitly converted to unsigned type" } */
diff --git a/gcc/testsuite/gcc.dg/Wconversion-pr34389.c b/gcc/testsuite/gcc.dg/Wconversion-pr34389.c
new file mode 100644
index 00000000000..45cdf19ef71
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wconversion-pr34389.c
@@ -0,0 +1,53 @@
+/* PR 34389 */
+/* { dg-do compile } */
+/* { dg-options "-Wconversion -Wsign-conversion" } */
+
+short mask1(short x)
+{
+ short y = 0x7fff;
+ return x & y;
+}
+
+short mask2(short ssx)
+{
+ short ssy;
+ short ssz;
+
+ ssz = ((int)ssx) & 0x7fff;
+ ssy = ((int)ssx) | 0x7fff;
+ ssz = ((int)ssx) ^ 0x7fff;
+ return ssx & 0x7fff;
+}
+
+short mask3(int si, unsigned int ui)
+{
+ short ss;
+ unsigned short us;
+
+ ss = si & 0x7fff;
+ ss = si & 0xAAAA; /* { dg-warning "conversion" } */
+ ss = ui & 0x7fff;
+ ss = ui & 0xAAAA; /* { dg-warning "conversion" } */
+
+ us = si & 0x7fff;
+ us = si & 0xAAAA; /* { dg-warning "conversion" } */
+ us = ui & 0x7fff;
+ us = ui & 0xAAAA; /* { dg-warning "conversion" } */
+
+ return ss;
+}
+
+short mask4(int x, int y)
+{
+ return x & y; /* { dg-warning "conversion" } */
+}
+
+short mask5(int x)
+{
+ return x & -1; /* { dg-warning "conversion" } */
+}
+
+short mask6(short x)
+{
+ return x & -1;
+}
diff --git a/gcc/testsuite/gcc.dg/Wcxx-compat-2.c b/gcc/testsuite/gcc.dg/Wcxx-compat-2.c
index 5a46fbe4bd5..a091c6dd8b5 100644
--- a/gcc/testsuite/gcc.dg/Wcxx-compat-2.c
+++ b/gcc/testsuite/gcc.dg/Wcxx-compat-2.c
@@ -1,35 +1,36 @@
/* { dg-options "-Wc++-compat" } */
-int bool;
-int catch;
-int char16_t;
-int char32_t;
-int class;
+_Bool foo; /* This is okay. */
+int bool; /* { dg-warning "keyword" } */
+int catch; /* { dg-warning "keyword" } */
+int char16_t; /* { dg-warning "keyword" } */
+int char32_t; /* { dg-warning "keyword" } */
+int class; /* { dg-warning "keyword" } */
int const_cast; /* { dg-warning "keyword" } */
-int decltype;
-int delete;
+int decltype; /* { dg-warning "keyword" } */
+int delete; /* { dg-warning "keyword" } */
int dynamic_cast; /* { dg-warning "keyword" } */
-int explicit;
-int export;
-int false;
-int friend;
+int explicit; /* { dg-warning "keyword" } */
+int export; /* { dg-warning "keyword" } */
+int false; /* { dg-warning "keyword" } */
+int friend; /* { dg-warning "keyword" } */
int mutable; /* { dg-warning "keyword" } */
-int namespace;
-int new;
-int operator;
-int private;
-int protected;
-int public;
+int namespace; /* { dg-warning "keyword" } */
+int new; /* { dg-warning "keyword" } */
+int operator; /* { dg-warning "keyword" } */
+int private; /* { dg-warning "keyword" } */
+int protected; /* { dg-warning "keyword" } */
+int public; /* { dg-warning "keyword" } */
int reinterpret_cast; /* { dg-warning "keyword" } */
int static_assert; /* { dg-warning "keyword" } */
int static_cast; /* { dg-warning "keyword" } */
-int template;
-int this;
-int throw;
-int true;
-int try;
-int typename;
-int typeid;
-int using;
-int virtual;
+int template; /* { dg-warning "keyword" } */
+int this; /* { dg-warning "keyword" } */
+int throw; /* { dg-warning "keyword" } */
+int true; /* { dg-warning "keyword" } */
+int try; /* { dg-warning "keyword" } */
+int typename; /* { dg-warning "keyword" } */
+int typeid; /* { dg-warning "keyword" } */
+int using; /* { dg-warning "keyword" } */
+int virtual; /* { dg-warning "keyword" } */
int wchar_t;
diff --git a/gcc/testsuite/gcc.dg/Wdeclaration-after-statement-3.c b/gcc/testsuite/gcc.dg/Wdeclaration-after-statement-3.c
new file mode 100644
index 00000000000..63b2bac5de8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wdeclaration-after-statement-3.c
@@ -0,0 +1,24 @@
+/* PR 35058: -Werror= works only with some warnings. */
+/* { dg-do compile } */
+/* { dg-options "-std=c99 -pedantic -Werror=declaration-after-statement" } */
+
+extern void abort (void);
+extern void exit (int);
+
+int
+main (void)
+{
+ int i = 0;
+ if (i != 0)
+ abort ();
+ i++;
+ if (i != 1)
+ abort ();
+ int j = i; /* { dg-error "" "declaration-after-statement" } */
+ if (j != 1)
+ abort ();
+ struct foo { int i0; } k = { 4 }; /* { dg-error "" "declaration-after-statement" } */
+ if (k.i0 != 4)
+ abort ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/Wno-all.c b/gcc/testsuite/gcc.dg/Wno-all.c
index 3275eb6cd50..de55bbcdacb 100644
--- a/gcc/testsuite/gcc.dg/Wno-all.c
+++ b/gcc/testsuite/gcc.dg/Wno-all.c
@@ -3,9 +3,8 @@
/* { dg-do compile } */
/* { dg-options "-Wall -Wno-all" } */
-void foo()
+void foo(int a)
{
- int a;
5 * (a == 1) | (a == 2); /* { dg-bogus "no effect" "no effect" } */
}
diff --git a/gcc/testsuite/gcc.dg/Wpointer-arith.c b/gcc/testsuite/gcc.dg/Wpointer-arith.c
new file mode 100644
index 00000000000..d7a19079cc4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wpointer-arith.c
@@ -0,0 +1,10 @@
+/* PR 35058: -Werror= works only with some warnings. */
+/* { dg-do compile } */
+/* { dg-options "-Werror=pointer-arith" } */
+void *a;
+
+void *test(){
+ int x=5;
+ if(a) a++; /* { dg-error "wrong type argument to increment" } */
+ return a+x; /* { dg-error "pointer of type" } */
+}
diff --git a/gcc/testsuite/gcc.dg/Wredundant-decls-2.c b/gcc/testsuite/gcc.dg/Wredundant-decls-2.c
index b10840fcf95..89f57b427c6 100644
--- a/gcc/testsuite/gcc.dg/Wredundant-decls-2.c
+++ b/gcc/testsuite/gcc.dg/Wredundant-decls-2.c
@@ -2,21 +2,21 @@
/* { dg-do compile } */
/* { dg-options "-Wredundant-decls" } */
-int j = 5; /* { dg-warning "previous" } */
+int j = 5; /* { dg-message "note: previous" } */
int j; /* { dg-warning "redundant" } */
static int k;
-static int k = 5; /* { dg-warning "previous" } */
+static int k = 5; /* { dg-message "note: previous" } */
static int k; /* { dg-warning "redundant" } */
-static int l = 5; /* { dg-warning "previous" } */
+static int l = 5; /* { dg-message "note: previous" } */
static int l; /* { dg-warning "redundant" } */
-static int m; /* { dg-warning "previous" } */
+static int m; /* { dg-message "note: previous" } */
static int m; /* { dg-warning "redundant" } */
static int m = 5;
-int n; /* { dg-warning "previous" } */
+int n; /* { dg-message "note: previous" } */
int n; /* { dg-warning "redundant" } */
int n = 5;
diff --git a/gcc/testsuite/gcc.dg/Wshadow-1.c b/gcc/testsuite/gcc.dg/Wshadow-1.c
index 6dd2eb6791a..40073f337b4 100644
--- a/gcc/testsuite/gcc.dg/Wshadow-1.c
+++ b/gcc/testsuite/gcc.dg/Wshadow-1.c
@@ -10,7 +10,7 @@ void foo (double decl1) /* { dg-warning "shadows a global decl" } */
{
}
-void foo1 (int d) /* { dg-error "previous definition" } */
+void foo1 (int d) /* { dg-message "note: previous definition" } */
{
double d; /* { dg-bogus "warning" "warning in place of error" } */
/* { dg-error "redeclared as different" "" { target *-*-* } 15 } */
diff --git a/gcc/testsuite/gcc.dg/Wsign-conversion.c b/gcc/testsuite/gcc.dg/Wsign-conversion.c
index 45edd3b4361..0300850f904 100644
--- a/gcc/testsuite/gcc.dg/Wsign-conversion.c
+++ b/gcc/testsuite/gcc.dg/Wsign-conversion.c
@@ -42,15 +42,15 @@ void h (int x)
uc = x ? 1U : -1; /* { dg-warning "negative integer implicitly converted to unsigned type" } */
uc = x ? SCHAR_MIN : 1U; /* { dg-warning "negative integer implicitly converted to unsigned type" } */
- uc = x ? 1 : -1;
- uc = x ? SCHAR_MIN : 1;
+ uc = x ? 1 : -1; /* { dg-warning "negative integer implicitly converted to unsigned type" } */
+ uc = x ? SCHAR_MIN : 1; /* { dg-warning "negative integer implicitly converted to unsigned type" } */
ui = x ? 1U : -1; /* { dg-warning "negative integer implicitly converted to unsigned type" } */
ui = x ? INT_MIN : 1U; /* { dg-warning "negative integer implicitly converted to unsigned type" } */
ui = ui ? SCHAR_MIN : 1U; /* { dg-warning "negative integer implicitly converted to unsigned type" } */
ui = 1U * -1; /* { dg-warning "negative integer implicitly converted to unsigned type" } */
ui = ui + INT_MIN; /* { dg-warning "negative integer implicitly converted to unsigned type" } */
- ui = x ? 1 : -1; /* { dg-warning "conversion" } */
- ui = ui ? SCHAR_MIN : 1; /* { dg-warning "conversion" } */
+ ui = x ? 1 : -1; /* { dg-warning "negative integer implicitly converted to unsigned type" } */
+ ui = ui ? SCHAR_MIN : 1; /* { dg-warning "negative integer implicitly converted to unsigned type" } */
fuc (-1); /* { dg-warning "negative integer implicitly converted to unsigned type" } */
uc = -1; /* { dg-warning "negative integer implicitly converted to unsigned type" } */
diff --git a/gcc/testsuite/gcc.dg/Wstrict-aliasing-bogus-ref-all-2.c b/gcc/testsuite/gcc.dg/Wstrict-aliasing-bogus-ref-all-2.c
new file mode 100644
index 00000000000..ba7f85c18e2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wstrict-aliasing-bogus-ref-all-2.c
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wall" } */
+
+typedef long long __m128i __attribute__ ((__vector_size__ (16), __may_alias__));
+
+extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_mm_load_si128 (__m128i const *__P)
+{
+ return *__P;
+}
+
+static const short __attribute__((__aligned__(16))) tbl[8] =
+{ 1, 2, 3, 4, 5, 6, 7, 8};
+
+
+__m128i get_vec(void)
+{
+ __m128i ret;
+
+ ret = _mm_load_si128((__m128i *)tbl); /* { dg-bogus "type-punning" } */
+
+ return ret;
+}
+
diff --git a/gcc/testsuite/gcc.dg/Wstrict-aliasing-float-ptr-int-obj.c b/gcc/testsuite/gcc.dg/Wstrict-aliasing-float-ptr-int-obj.c
index 7780fa6fcd6..73719157411 100644
--- a/gcc/testsuite/gcc.dg/Wstrict-aliasing-float-ptr-int-obj.c
+++ b/gcc/testsuite/gcc.dg/Wstrict-aliasing-float-ptr-int-obj.c
@@ -11,9 +11,9 @@ int foo() {
float* r;
if (flag) {
- q = (float*) &x; /* { dg-warning "type-punn" } */
+ q = (float*) &x; /* { dg-warning "type-punn" "" { xfail *-*-* } } */
} else {
- q = (float*) &y; /* { dg-warning "type-punn" } */
+ q = (float*) &y; /* { dg-warning "type-punn" "" { xfail *-*-* } } */
}
*q = 1.0;
diff --git a/gcc/testsuite/gcc.dg/arm-g2.c b/gcc/testsuite/gcc.dg/arm-g2.c
index a15b280cc10..031b93657da 100644
--- a/gcc/testsuite/gcc.dg/arm-g2.c
+++ b/gcc/testsuite/gcc.dg/arm-g2.c
@@ -1,6 +1,7 @@
/* Verify that hardware multiply is preferred on XScale. */
/* { dg-do compile } */
/* { dg-options "-mcpu=xscale -O2" } */
+/* { dg-skip-if "Test is specific to the Xscale" { arm*-*-* } { "-march=*" } { "-march=xscale" } } */
/* { dg-require-effective-target arm32 } */
/* Brett Gaines' test case. */
diff --git a/gcc/testsuite/gcc.dg/arm-mmx-1.c b/gcc/testsuite/gcc.dg/arm-mmx-1.c
index e4535eebefd..21cc47912c0 100644
--- a/gcc/testsuite/gcc.dg/arm-mmx-1.c
+++ b/gcc/testsuite/gcc.dg/arm-mmx-1.c
@@ -1,8 +1,11 @@
/* Verify that if IP is saved to ensure stack alignment, we don't load
it into sp. */
/* { dg-do compile } */
+/* { dg-skip-if "Test is specific to the iWMMXt" { arm*-*-* } { "-mcpu=*" } { "-mcpu=iwmmxt" } } */
+/* { dg-skip-if "Test is specific to the iWMMXt" { arm*-*-* } { "-mabi=*" } { "-mabi=iwmmxt" } } */
+/* { dg-skip-if "Test is specific to the iWMMXt" { arm*-*-* } { "-mfloat-abi=softfp" } { "" } } */
+/* { dg-skip-if "Test is specific to the iWMMXt" { arm*-*-* } { "-march=*" } { "-march=iwmmxt" } } */
/* { dg-options "-O -mno-apcs-frame -mcpu=iwmmxt -mabi=iwmmxt" } */
-/* { dg-skip-if "" { *-*-* } { "-mfloat-abi=softfp" } { "" } } */
/* { dg-require-effective-target arm32 } */
/* { dg-final { scan-assembler "ldmfd\[ ]sp!.*ip,\[ ]*pc" } } */
diff --git a/gcc/testsuite/gcc.dg/arm-scd42-2.c b/gcc/testsuite/gcc.dg/arm-scd42-2.c
index 1c257c173b6..0c372983a54 100644
--- a/gcc/testsuite/gcc.dg/arm-scd42-2.c
+++ b/gcc/testsuite/gcc.dg/arm-scd42-2.c
@@ -1,6 +1,7 @@
/* Verify that mov is preferred on XScale for loading a 2 byte constant. */
/* { dg-do compile } */
/* { dg-options "-mcpu=xscale -O" } */
+/* { dg-skip-if "Test is specific to the Xscale" { arm*-*-* } { "-march=*" } { "-march=xscale" } } */
/* { dg-require-effective-target arm32 } */
unsigned load2(void) __attribute__ ((naked));
diff --git a/gcc/testsuite/gcc.dg/array-5.c b/gcc/testsuite/gcc.dg/array-5.c
index a4053da72a2..4083c92ffc9 100644
--- a/gcc/testsuite/gcc.dg/array-5.c
+++ b/gcc/testsuite/gcc.dg/array-5.c
@@ -13,7 +13,7 @@ extern char arr1[1];
char arr1[1];
extern char arr2[0];
char arr2[0];
-extern char arr3[0]; /* { dg-error "previous declaration" } */
+extern char arr3[0]; /* { dg-message "note: previous declaration" } */
char arr3[1]; /* { dg-error "conflicting types" } */
/* Variable size matches. */
diff --git a/gcc/testsuite/gcc.dg/attr-noinline.c b/gcc/testsuite/gcc.dg/attr-noinline.c
index 9124e4f7688..9f7abcd07e8 100644
--- a/gcc/testsuite/gcc.dg/attr-noinline.c
+++ b/gcc/testsuite/gcc.dg/attr-noinline.c
@@ -13,19 +13,19 @@ static inline void __attribute__((__noinline__)) function_declaration_both_after
static void function_declaration_both_after(void) {}
-static void function_declaration_noinline_before(void) __attribute__((__noinline__)); /* { dg-warning "previous declaration" "" } */
+static void function_declaration_noinline_before(void) __attribute__((__noinline__)); /* { dg-message "note: previous declaration" "" } */
static inline void function_declaration_noinline_before(void) {} /* { dg-warning "follows declaration with attribute noinline" "" } */
-static inline void function_declaration_noinline_after(void) {} /* { dg-warning "previous definition" "" } */
+static inline void function_declaration_noinline_after(void) {} /* { dg-message "note: previous definition" "" } */
static void function_declaration_noinline_after(void) __attribute__((__noinline__)); /* { dg-warning "follows inline declaration" "" } */
-static inline void function_declaration_inline_before(void); /* { dg-warning "previous declaration" "" } */
+static inline void function_declaration_inline_before(void); /* { dg-message "note: previous declaration" "" } */
static void __attribute__((__noinline__)) function_declaration_inline_before(void) {} /* { dg-warning "follows inline declaration" "" } */
-static inline void function_declaration_inline_noinline_before(void); /* { dg-warning "previous declaration" "" } */
+static inline void function_declaration_inline_noinline_before(void); /* { dg-message "note: previous declaration" "" } */
static void function_declaration_inline_noinline_before(void) __attribute__((__noinline__)); /* { dg-warning "follows inline declaration" "" } */
@@ -33,11 +33,11 @@ static void function_declaration_inline_noinline_before(void) {}
static inline void function_declaration_inline_noinline_after(void);
-static void function_declaration_inline_noinline_after(void) {} /* { dg-warning "previous definition" "" } */
+static void function_declaration_inline_noinline_after(void) {} /* { dg-message "note: previous definition" "" } */
static void function_declaration_inline_noinline_after(void) __attribute__((__noinline__)); /* { dg-warning "follows inline declaration" "" } */
-static void function_declaration_noinline_inline_before(void) __attribute__((__noinline__)); /* { dg-warning "previous declaration" "" } */
+static void function_declaration_noinline_inline_before(void) __attribute__((__noinline__)); /* { dg-message "note: previous declaration" "" } */
static inline void function_declaration_noinline_inline_before(void); /* { dg-warning "follows declaration with attribute noinline" "" } */
diff --git a/gcc/testsuite/gcc.dg/cpp/line6.c b/gcc/testsuite/gcc.dg/cpp/line6.c
new file mode 100644
index 00000000000..c59ea3af7f1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/line6.c
@@ -0,0 +1,7 @@
+/* PR 28079 */
+/* { dg-do preprocess } */
+/* { dg-options "" } */
+
+#line 18446744073709551616 /* { dg-warning "line number out of range" } */
+
+#line 12312312312435 /* { dg-warning "line number out of range" "" { target *-*-* } 0 } */
diff --git a/gcc/testsuite/gcc.dg/cpp/mi8.c b/gcc/testsuite/gcc.dg/cpp/mi8.c
new file mode 100644
index 00000000000..1999918dea4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/mi8.c
@@ -0,0 +1,8 @@
+/* Test multiple include guards suggestions. */
+
+/* { dg-do preprocess }
+ { dg-options "-H" }
+ { dg-message "mi8a\.h\n\[^\n\]*mi8c\.h\n\[^\n\]*mi8b\.h\n\[^\n\]*mi8d\.h\nMultiple include guards may be useful for:\n\[^\n\]*mi8a\.h\n\[^\n\]*mi8d\.h\n" "" { target *-*-* } 0 } */
+
+#include "mi8a.h"
+#include "mi8b.h"
diff --git a/gcc/testsuite/gcc.dg/cpp/mi8a.h b/gcc/testsuite/gcc.dg/cpp/mi8a.h
new file mode 100644
index 00000000000..893d9ff13b4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/mi8a.h
@@ -0,0 +1 @@
+#include "mi8c.h"
diff --git a/gcc/testsuite/gcc.dg/cpp/mi8b.h b/gcc/testsuite/gcc.dg/cpp/mi8b.h
new file mode 100644
index 00000000000..8e3482ce74b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/mi8b.h
@@ -0,0 +1,4 @@
+#ifndef GUARDB
+#define GUARDB
+#include "mi8d.h"
+#endif
diff --git a/gcc/testsuite/gcc.dg/cpp/mi8c.h b/gcc/testsuite/gcc.dg/cpp/mi8c.h
new file mode 100644
index 00000000000..08c5cab94ed
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/mi8c.h
@@ -0,0 +1,4 @@
+#ifndef GUARDC
+#define GUARDC
+/* Empty */
+#endif
diff --git a/gcc/testsuite/gcc.dg/cpp/mi8d.h b/gcc/testsuite/gcc.dg/cpp/mi8d.h
new file mode 100644
index 00000000000..710cecca972
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/mi8d.h
@@ -0,0 +1 @@
+/* Empty */
diff --git a/gcc/testsuite/gcc.dg/decl-2.c b/gcc/testsuite/gcc.dg/decl-2.c
index ab1532e82b9..40d744c926b 100644
--- a/gcc/testsuite/gcc.dg/decl-2.c
+++ b/gcc/testsuite/gcc.dg/decl-2.c
@@ -7,7 +7,7 @@
void foo(void)
{
char
- c /* { dg-error "previous declaration" } */
+ c /* { dg-message "note: previous declaration" } */
;
int i;
int
diff --git a/gcc/testsuite/gcc.dg/decl-3.c b/gcc/testsuite/gcc.dg/decl-3.c
index 5bbe19cd224..cba0b906db3 100644
--- a/gcc/testsuite/gcc.dg/decl-3.c
+++ b/gcc/testsuite/gcc.dg/decl-3.c
@@ -1,5 +1,5 @@
/* PR c/9928 */
/* { dg-do compile } */
-enum { CODES }; /* { dg-error "previous definition" } */
+enum { CODES }; /* { dg-message "note: previous definition" } */
enum { CODES }; /* { dg-error "conflicting types|redeclaration of enumerator" } */
diff --git a/gcc/testsuite/gcc.dg/decl-4.c b/gcc/testsuite/gcc.dg/decl-4.c
index acc7e77e2ea..ce640c99c16 100644
--- a/gcc/testsuite/gcc.dg/decl-4.c
+++ b/gcc/testsuite/gcc.dg/decl-4.c
@@ -1,10 +1,10 @@
/* Redeclaration of parameters is an error. PR 13728. */
/* { dg-do compile } */
-void f (int fred, /* { dg-error "previous definition" "" } */
+void f (int fred, /* { dg-message "note: previous definition" "" } */
int fred); /* { dg-error "redefinition of parameter" "" } */
-void f2 (int fred, /* { dg-error "previous definition" "" } */
+void f2 (int fred, /* { dg-message "note: previous definition" "" } */
int fred) /* { dg-error "redefinition of parameter" "" } */
{
}
diff --git a/gcc/testsuite/gcc.dg/decl-8.c b/gcc/testsuite/gcc.dg/decl-8.c
index ba757197f53..d0da48f7b59 100644
--- a/gcc/testsuite/gcc.dg/decl-8.c
+++ b/gcc/testsuite/gcc.dg/decl-8.c
@@ -3,8 +3,8 @@
/* { dg-do compile } */
/* { dg-options "" } */
-typedef int I; /* { dg-error "previous declaration of 'I' was here" } */
+typedef int I; /* { dg-message "note: previous declaration of 'I' was here" } */
typedef int I; /* { dg-error "redefinition of typedef 'I'" } */
-typedef int I1; /* { dg-error "previous declaration of 'I1' was here" } */
+typedef int I1; /* { dg-message "note: previous declaration of 'I1' was here" } */
typedef long I1; /* { dg-error "conflicting types for 'I1'" } */
diff --git a/gcc/testsuite/gcc.dg/dfp/func-vararg-alternate-d128-2.c b/gcc/testsuite/gcc.dg/dfp/func-vararg-alternate-d128-2.c
new file mode 100644
index 00000000000..167da24b889
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/dfp/func-vararg-alternate-d128-2.c
@@ -0,0 +1,21 @@
+/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
+/* { dg-options "-std=gnu99 -mpreferred-stack-boundary=2" } */
+
+/* Simple test of vararg passing for problematic types with and without
+ double values passed between them. */
+
+#define DTYPE _Decimal128
+#define ONE 1.0dl
+#define THREE 3.0dl
+#define SEVEN 7.0dl
+#define ELEVEN 11.0dl
+#define INTS 4
+
+#include "func-vararg-alternate.h"
+
+int
+main ()
+{
+ doit ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/dfp/func-vararg-mixed-2.c b/gcc/testsuite/gcc.dg/dfp/func-vararg-mixed-2.c
new file mode 100644
index 00000000000..c1b349c6728
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/dfp/func-vararg-mixed-2.c
@@ -0,0 +1,118 @@
+/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
+/* { dg-options "-std=gnu99 -mpreferred-stack-boundary=2" } */
+
+/* C99 6.5.2.2 Function calls.
+ Test passing varargs of the combination of decimal float types and
+ other types. */
+
+#include <stdarg.h>
+
+extern void abort (void);
+static int failcnt = 0;
+
+/* Support compiling the test to report individual failures; default is
+ to abort as soon as a check fails. */
+#ifdef DBG
+#include <stdio.h>
+#define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
+#else
+#define FAILURE abort ();
+#endif
+
+/* Supposing the list of varying number of arguments is:
+ unsigned int, _Decimal128, double, _Decimal32, _Decimal64. */
+
+static _Decimal32
+vararg_d32 (unsigned arg, ...)
+{
+ va_list ap;
+ _Decimal32 result;
+
+ va_start (ap, arg);
+
+ va_arg (ap, unsigned int);
+ va_arg (ap, _Decimal128);
+ va_arg (ap, double);
+ result = va_arg (ap, _Decimal32);
+
+ va_end (ap);
+ return result;
+}
+
+static _Decimal32
+vararg_d64 (unsigned arg, ...)
+{
+ va_list ap;
+ _Decimal64 result;
+
+ va_start (ap, arg);
+
+ va_arg (ap, unsigned int);
+ va_arg (ap, _Decimal128);
+ va_arg (ap, double);
+ va_arg (ap, _Decimal32);
+ result = va_arg (ap, _Decimal64);
+
+ va_end (ap);
+ return result;
+}
+
+static _Decimal128
+vararg_d128 (unsigned arg, ...)
+{
+ va_list ap;
+ _Decimal128 result;
+
+ va_start (ap, arg);
+
+ va_arg (ap, unsigned int);
+ result = va_arg (ap, _Decimal128);
+
+ va_end (ap);
+ return result;
+}
+
+static unsigned int
+vararg_int (unsigned arg, ...)
+{
+ va_list ap;
+ unsigned int result;
+
+ va_start (ap, arg);
+
+ result = va_arg (ap, unsigned int);
+
+ va_end (ap);
+ return result;
+}
+
+static double
+vararg_double (unsigned arg, ...)
+{
+ va_list ap;
+ float result;
+
+ va_start (ap, arg);
+
+ va_arg (ap, unsigned int);
+ va_arg (ap, _Decimal128);
+ result = va_arg (ap, double);
+
+ va_end (ap);
+ return result;
+}
+
+
+int
+main ()
+{
+ if (vararg_d32 (3, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 3.0df) FAILURE
+ if (vararg_d64 (4, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 4.0dd) FAILURE
+ if (vararg_d128 (1, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 1.0dl) FAILURE
+ if (vararg_int (0, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 0) FAILURE
+ if (vararg_double (2, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 2.0) FAILURE
+
+ if (failcnt != 0)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/dll-2.c b/gcc/testsuite/gcc.dg/dll-2.c
index 3b8b60eee41..334299f3a27 100644
--- a/gcc/testsuite/gcc.dg/dll-2.c
+++ b/gcc/testsuite/gcc.dg/dll-2.c
@@ -11,12 +11,12 @@
/* { dg-require-dll "" } */
__declspec (dllimport) int foo1 ();
-__declspec (dllexport) int foo1 (); /* { dg-warning "previous dllimport ignored" } */
+__declspec (dllexport) int foo1 (); /* { dg-message "note: previous dllimport ignored" } */
__declspec (dllexport) int foo2 ();
__declspec (dllimport) int foo2 (); /* { dg-warning "dllimport ignored" } */
__declspec (dllimport) int bar1;
-__declspec (dllexport) int bar1; /* { dg-warning "previous dllimport ignored" } */
+__declspec (dllexport) int bar1; /* { dg-message "note: previous dllimport ignored" } */
__declspec (dllexport) int bar2;
__declspec (dllimport) int bar2; /* { dg-warning "dllimport ignored" } */
diff --git a/gcc/testsuite/gcc.dg/dll-3.c b/gcc/testsuite/gcc.dg/dll-3.c
index 0a3f7df0988..4272891a848 100644
--- a/gcc/testsuite/gcc.dg/dll-3.c
+++ b/gcc/testsuite/gcc.dg/dll-3.c
@@ -5,7 +5,7 @@
/* { dg-do compile { target i?86-pc-mingw* } } */
__declspec (dllimport) int foo1 ();
-__declspec (dllexport) int foo1 (); /* { dg-warning "previous dllimport ignored" } */
+__declspec (dllexport) int foo1 (); /* { dg-message "note: previous dllimport ignored" } */
__declspec (dllexport) int foo2 ();
__declspec (dllimport) int foo2 (); /* { dg-warning "dllimport ignored" } */
diff --git a/gcc/testsuite/gcc.dg/enum-compat-1.c b/gcc/testsuite/gcc.dg/enum-compat-1.c
index 04a6e758eff..18d1f7fe715 100644
--- a/gcc/testsuite/gcc.dg/enum-compat-1.c
+++ b/gcc/testsuite/gcc.dg/enum-compat-1.c
@@ -25,7 +25,7 @@ enum e3 v3;
enum e4 *p = &v3; /* { dg-warning "incompatible" "incompatible pointer" } */
enum e3 *q = &v3;
-void g(enum e3); /* { dg-error "declaration" "error at first decl" } */
+void g(enum e3); /* { dg-message "note: previous declaration" "error at first decl" } */
void g(enum e4); /* { dg-error "conflicting types" "error at second decl" } */
void h(enum e3);
diff --git a/gcc/testsuite/gcc.dg/fold-alloca-1.c b/gcc/testsuite/gcc.dg/fold-alloca-1.c
index 735a22f3a7e..c4645364701 100644
--- a/gcc/testsuite/gcc.dg/fold-alloca-1.c
+++ b/gcc/testsuite/gcc.dg/fold-alloca-1.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-fdump-tree-useless" } */
+/* { dg-options "-fdump-tree-cleanup_cfg1" } */
void *alloca (__SIZE_TYPE__);
void link_error ();
@@ -10,5 +10,5 @@ int main (int argc, char *argv[]) {
link_error ();
return 0;
}
-/* { dg-final { scan-tree-dump-times "link_error" 0 "useless" } } */
-/* { dg-final { cleanup-tree-dump "useless" } } */
+/* { dg-final { scan-tree-dump-times "link_error" 0 "cleanup_cfg1" } } */
+/* { dg-final { cleanup-tree-dump "cleanup_cfg1" } } */
diff --git a/gcc/testsuite/gcc.dg/free-1.c b/gcc/testsuite/gcc.dg/free-1.c
new file mode 100644
index 00000000000..5496c84fdb8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/free-1.c
@@ -0,0 +1,26 @@
+/* PR c/36970 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+extern void free (void *);
+
+char *p, buf3[10], d;
+struct S { char a; int b; } *r;
+
+void foo (void)
+{
+ char buf[10], buf2[10], c;
+ static char buf4[10], e;
+ char *q = buf;
+ free (p);
+ free (q); /* { dg-warning "attempt to free a non-heap object" } */
+ free (buf2); /* { dg-warning "attempt to free a non-heap object" } */
+ free (&c); /* { dg-warning "attempt to free a non-heap object" } */
+ free (buf3); /* { dg-warning "attempt to free a non-heap object" } */
+ free (&d); /* { dg-warning "attempt to free a non-heap object" } */
+ free (buf4); /* { dg-warning "attempt to free a non-heap object" } */
+ free (&e); /* { dg-warning "attempt to free a non-heap object" } */
+ free (&r->a);
+ free ("abcd"); /* { dg-warning "attempt to free a non-heap object" } */
+ free (L"abcd"); /* { dg-warning "attempt to free a non-heap object" } */
+}
diff --git a/gcc/testsuite/gcc.dg/free-2.c b/gcc/testsuite/gcc.dg/free-2.c
new file mode 100644
index 00000000000..eb94651311b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/free-2.c
@@ -0,0 +1,26 @@
+/* PR c/36970 */
+/* { dg-do compile } */
+/* { dg-options "-O0" } */
+
+extern void free (void *);
+
+char *p, buf3[10], d;
+struct S { char a; int b; } *r;
+
+void foo (void)
+{
+ char buf[10], buf2[10], c;
+ static char buf4[10], e;
+ char *q = buf;
+ free (p);
+ free (q); /* At -O0 no warning is reported here. */
+ free (buf2); /* { dg-warning "attempt to free a non-heap object" } */
+ free (&c); /* { dg-warning "attempt to free a non-heap object" } */
+ free (buf3); /* { dg-warning "attempt to free a non-heap object" } */
+ free (&d); /* { dg-warning "attempt to free a non-heap object" } */
+ free (buf4); /* { dg-warning "attempt to free a non-heap object" } */
+ free (&e); /* { dg-warning "attempt to free a non-heap object" } */
+ free (&r->a);
+ free ("abcd"); /* { dg-warning "attempt to free a non-heap object" } */
+ free (L"abcd"); /* { dg-warning "attempt to free a non-heap object" } */
+}
diff --git a/gcc/testsuite/gcc.dg/fshort-wchar.c b/gcc/testsuite/gcc.dg/fshort-wchar.c
index 9f4946307f0..c9c751504df 100644
--- a/gcc/testsuite/gcc.dg/fshort-wchar.c
+++ b/gcc/testsuite/gcc.dg/fshort-wchar.c
@@ -2,6 +2,7 @@
/* { dg-do run } */
/* { dg-options "-fshort-wchar" } */
+/* { dg-options "-fshort-wchar -Wl,--no-wchar-size-warning" { target arm*-*-*eabi } } */
/* Source: Neil Booth, 10 Dec 2002.
diff --git a/gcc/testsuite/gcc.dg/funcdef-var-1.c b/gcc/testsuite/gcc.dg/funcdef-var-1.c
index a685af7ac1c..63a56838afe 100644
--- a/gcc/testsuite/gcc.dg/funcdef-var-1.c
+++ b/gcc/testsuite/gcc.dg/funcdef-var-1.c
@@ -5,6 +5,6 @@
/* { dg-options "-Wmissing-prototypes" } */
extern __typeof(foo) foo __asm__(""); /* { dg-error "undeclared" } */
-/* { dg-error "previous declaration" "previous declaration" { target *-*-* } 7 } */
+/* { dg-message "note: previous declaration" "previous declaration" { target *-*-* } 7 } */
void *foo (void) {} /* { dg-error "redeclared as different kind of symbol" } */
/* { dg-warning "no previous prototype" "no previous prototype" { target *-*-* } 9 } */
diff --git a/gcc/testsuite/gcc.dg/funcdef-var-2.c b/gcc/testsuite/gcc.dg/funcdef-var-2.c
index 744987ebf3b..b3eb2ce6a01 100644
--- a/gcc/testsuite/gcc.dg/funcdef-var-2.c
+++ b/gcc/testsuite/gcc.dg/funcdef-var-2.c
@@ -6,6 +6,6 @@
/* { dg-options "-Wmissing-prototypes" } */
int foo;
-/* { dg-error "previous declaration" "previous declaration" { target *-*-* } 8 } */
+/* { dg-message "note: previous declaration" "previous declaration" { target *-*-* } 8 } */
void foo () {} /* { dg-error "redeclared as different kind of symbol" } */
/* { dg-warning "no previous prototype" "no previous prototype" { target *-*-* } 10 } */
diff --git a/gcc/testsuite/gcc.dg/gomp/atomic-11.c b/gcc/testsuite/gcc.dg/gomp/atomic-11.c
new file mode 100644
index 00000000000..397972b3cf2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/atomic-11.c
@@ -0,0 +1,17 @@
+/* PR middle-end/36877 */
+/* { dg-do compile } */
+/* { dg-options "-fopenmp" } */
+/* { dg-options "-fopenmp -march=i386" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
+
+int i;
+float f;
+
+void foo (void)
+{
+#pragma omp atomic
+ i++;
+#pragma omp atomic
+ f += 1.0;
+}
+
+/* { dg-final { scan-assembler-not "__sync_(fetch|add|bool|val)" { target i?86-*-* x86_64-*-* powerpc*-*-* ia64-*-* s390*-*-* sparc*-*-* } } } */
diff --git a/gcc/testsuite/gcc.dg/gomp/block-1.c b/gcc/testsuite/gcc.dg/gomp/block-1.c
index abc66e580fd..dd7fe7783a9 100644
--- a/gcc/testsuite/gcc.dg/gomp/block-1.c
+++ b/gcc/testsuite/gcc.dg/gomp/block-1.c
@@ -4,7 +4,7 @@ void foo()
{
bad1:
#pragma omp parallel
- goto bad1; // { dg-error "invalid exit" }
+ goto bad1; // { dg-error "invalid branch" }
goto bad2; // { dg-error "invalid entry" }
#pragma omp parallel
diff --git a/gcc/testsuite/gcc.dg/gomp/block-2.c b/gcc/testsuite/gcc.dg/gomp/block-2.c
index 810b2da07b4..4c56add570c 100644
--- a/gcc/testsuite/gcc.dg/gomp/block-2.c
+++ b/gcc/testsuite/gcc.dg/gomp/block-2.c
@@ -11,7 +11,7 @@ void foo()
bad1:
#pragma omp for
for (i = 0; i < 10; ++i)
- goto bad1; // { dg-error "invalid exit" }
+ goto bad1; // { dg-error "invalid branch" }
goto bad2; // { dg-error "invalid entry" }
#pragma omp for
diff --git a/gcc/testsuite/gcc.dg/gomp/block-3.c b/gcc/testsuite/gcc.dg/gomp/block-3.c
index 160047c394c..c72b04c35d0 100644
--- a/gcc/testsuite/gcc.dg/gomp/block-3.c
+++ b/gcc/testsuite/gcc.dg/gomp/block-3.c
@@ -9,7 +9,7 @@ void foo()
{
#pragma omp sections
{
- continue; // { dg-error "invalid exit" }
+ continue; // { dg-error "invalid branch" }
}
}
@@ -18,12 +18,12 @@ void foo()
#pragma omp section
{ bad1: ; }
#pragma omp section
- goto bad1; // { dg-error "invalid exit" }
+ goto bad1; // { dg-error "invalid branch" }
}
#pragma omp sections
{
- goto bad2; // { dg-error "invalid exit" }
+ goto bad2; // { dg-error "invalid branch" }
}
bad2:;
diff --git a/gcc/testsuite/gcc.dg/gomp/block-4.c b/gcc/testsuite/gcc.dg/gomp/block-4.c
index 815d36b2e39..61f490c0033 100644
--- a/gcc/testsuite/gcc.dg/gomp/block-4.c
+++ b/gcc/testsuite/gcc.dg/gomp/block-4.c
@@ -4,6 +4,6 @@ void foo()
{
#pragma omp critical
{
- return; // { dg-error "invalid exit" }
+ return; // { dg-error "invalid branch" }
}
}
diff --git a/gcc/testsuite/gcc.dg/gomp/block-5.c b/gcc/testsuite/gcc.dg/gomp/block-5.c
index 450106feeb1..741049fddea 100644
--- a/gcc/testsuite/gcc.dg/gomp/block-5.c
+++ b/gcc/testsuite/gcc.dg/gomp/block-5.c
@@ -4,12 +4,12 @@ void foo()
{
#pragma omp master
{
- goto bad1; // { dg-error "invalid exit" }
+ goto bad1; // { dg-error "invalid branch" }
}
#pragma omp master
{
bad1:
- return; // { dg-error "invalid exit" }
+ return; // { dg-error "invalid branch" }
}
}
diff --git a/gcc/testsuite/gcc.dg/gomp/block-6.c b/gcc/testsuite/gcc.dg/gomp/block-6.c
index fa4c5eab5f4..87e6392e5b3 100644
--- a/gcc/testsuite/gcc.dg/gomp/block-6.c
+++ b/gcc/testsuite/gcc.dg/gomp/block-6.c
@@ -4,6 +4,6 @@ void foo()
{
#pragma omp ordered
{
- return; // { dg-error "invalid exit" }
+ return; // { dg-error "invalid branch" }
}
}
diff --git a/gcc/testsuite/gcc.dg/gomp/block-7.c b/gcc/testsuite/gcc.dg/gomp/block-7.c
index 802b3b3a383..2bc1cdb5723 100644
--- a/gcc/testsuite/gcc.dg/gomp/block-7.c
+++ b/gcc/testsuite/gcc.dg/gomp/block-7.c
@@ -6,15 +6,15 @@ void foo()
for (i = 0; i < 10; ++i)
{
#pragma omp for
- for (j = ({ continue; 0; }); // { dg-error "invalid exit" }
- j < ({ continue; 10; }); // { dg-error "invalid exit" }
- j += ({ continue; 1; })) // { dg-error "invalid exit" }
+ for (j = ({ continue; 0; }); // { dg-error "invalid branch" }
+ j < ({ continue; 10; }); // { dg-error "invalid branch" }
+ j += ({ continue; 1; })) // { dg-error "invalid branch" }
continue;
#pragma omp for
- for (j = ({ break; 0; }); // { dg-error "invalid exit" }
- j < ({ break; 10; }); // { dg-error "invalid exit" }
- j += ({ break; 1; })) // { dg-error "invalid exit" }
+ for (j = ({ break; 0; }); // { dg-error "invalid branch" }
+ j < ({ break; 10; }); // { dg-error "invalid branch" }
+ j += ({ break; 1; })) // { dg-error "invalid branch" }
break; // { dg-error "break" }
}
}
diff --git a/gcc/testsuite/gcc.dg/gomp/block-8.c b/gcc/testsuite/gcc.dg/gomp/block-8.c
index 177acaa28c0..3c717d927be 100644
--- a/gcc/testsuite/gcc.dg/gomp/block-8.c
+++ b/gcc/testsuite/gcc.dg/gomp/block-8.c
@@ -7,5 +7,5 @@ int foo()
#pragma omp parallel for
for (i = 0; i < 10; ++i)
- return 0; // { dg-error "invalid exit" }
+ return 0; // { dg-error "invalid branch" }
}
diff --git a/gcc/testsuite/gcc.dg/hex-round-1.c b/gcc/testsuite/gcc.dg/hex-round-1.c
index 3276ad46378..e1283cae37b 100644
--- a/gcc/testsuite/gcc.dg/hex-round-1.c
+++ b/gcc/testsuite/gcc.dg/hex-round-1.c
@@ -1,6 +1,7 @@
/* Test for hexadecimal float rounding: bug 21720. */
/* { dg-do link } */
/* { dg-options "-O -std=gnu99" } */
+/* { dg-skip-if "SPU float rounds towards zero" { spu-*-* } } */
#include <float.h>
diff --git a/gcc/testsuite/gcc.dg/hex-round-2.c b/gcc/testsuite/gcc.dg/hex-round-2.c
index ba9b8bf3d02..af49536abac 100644
--- a/gcc/testsuite/gcc.dg/hex-round-2.c
+++ b/gcc/testsuite/gcc.dg/hex-round-2.c
@@ -2,6 +2,7 @@
in number. */
/* { dg-do link } */
/* { dg-options "-O -std=gnu99" } */
+/* { dg-skip-if "SPU float rounds towards zero" { spu-*-* } } */
#include <float.h>
diff --git a/gcc/testsuite/gcc.dg/inline-14.c b/gcc/testsuite/gcc.dg/inline-14.c
index cef62776fbb..15b2d404c11 100644
--- a/gcc/testsuite/gcc.dg/inline-14.c
+++ b/gcc/testsuite/gcc.dg/inline-14.c
@@ -3,7 +3,7 @@
/* { dg-options "-std=c99" } */
extern inline int func1 (void)
-{ /* { dg-error "previous definition" } */
+{ /* { dg-message "note: previous definition" } */
return 1;
}
@@ -13,7 +13,7 @@ inline int func1 (void) /* { dg-error "redefinition" } */
}
inline int func2 (void)
-{ /* { dg-error "previous definition" } */
+{ /* { dg-message "note: previous definition" } */
return 2;
}
diff --git a/gcc/testsuite/gcc.dg/inline1.c b/gcc/testsuite/gcc.dg/inline1.c
index f7a7eb4b956..c660fe3146b 100644
--- a/gcc/testsuite/gcc.dg/inline1.c
+++ b/gcc/testsuite/gcc.dg/inline1.c
@@ -3,6 +3,6 @@
/* This test is expected to fail with an error for the redefinition of foo.
This violates the constraint of 6.9#3 (no more than one external definition
of an identifier with internal linkage in the same translation unit). */
-static inline int foo(void) { return 1; } /* { dg-error "previous definition of" } */
+static inline int foo(void) { return 1; } /* { dg-message "note: previous definition of" } */
static inline int foo(void) { return 0; } /* { dg-error "redefinition of" } */
diff --git a/gcc/testsuite/gcc.dg/inline3.c b/gcc/testsuite/gcc.dg/inline3.c
index 64f6d8bbee5..d7fd8dba60c 100644
--- a/gcc/testsuite/gcc.dg/inline3.c
+++ b/gcc/testsuite/gcc.dg/inline3.c
@@ -3,5 +3,5 @@
/* This testcase should fail since we're redefining foo in the same
translation unit. */
extern inline int foo(void) { return 0; }
-inline int foo (void) { return 1; } /* { dg-error "previous definition of" } */
+inline int foo (void) { return 1; } /* { dg-message "note: previous definition of" } */
int foo (void) { return 2; } /* { dg-error "redefinition of" } */
diff --git a/gcc/testsuite/gcc.dg/inline4.c b/gcc/testsuite/gcc.dg/inline4.c
index a5c7dda0a02..64cea7515ab 100644
--- a/gcc/testsuite/gcc.dg/inline4.c
+++ b/gcc/testsuite/gcc.dg/inline4.c
@@ -2,5 +2,5 @@
/* { dg-options "-Wall -std=gnu89" } */
/* This testcase should fail since we're redefining foo in the same
translation unit. */
-int foo (void) { return 2; } /* { dg-error "previous definition of" } */
+int foo (void) { return 2; } /* { dg-message "note: previous definition of" } */
extern inline int foo (void) { return 1; } /* { dg-error "redefinition of" } */
diff --git a/gcc/testsuite/gcc.dg/inline5.c b/gcc/testsuite/gcc.dg/inline5.c
index 86a2776251b..40fb7cd910b 100644
--- a/gcc/testsuite/gcc.dg/inline5.c
+++ b/gcc/testsuite/gcc.dg/inline5.c
@@ -2,5 +2,5 @@
/* { dg-options "-Wall -std=gnu89" } */
/* This testcase should fail since we're redefining foo in the same
translation unit. */
-extern inline int foo (void) { return 2; } /* { dg-error "previous definition of" } */
+extern inline int foo (void) { return 2; } /* { dg-message "note: previous definition of" } */
extern inline int foo (void) { return 1; } /* { dg-error "redefinition of" } */
diff --git a/gcc/testsuite/gcc.dg/intmax_t-1.c b/gcc/testsuite/gcc.dg/intmax_t-1.c
index 9ac0cb9f037..00b503c2509 100644
--- a/gcc/testsuite/gcc.dg/intmax_t-1.c
+++ b/gcc/testsuite/gcc.dg/intmax_t-1.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-Wall" } */
-/* { dg-error "" "" { target { { *arm*-*-*elf* xtensa-*-elf* } || vxworks_kernel } } 0 } */
+/* { dg-error "" "" { target { { *arm*-*-*elf* xtensa*-*-elf* } || vxworks_kernel } } 0 } */
/* Compile with -Wall to get a warning if built-in and system intmax_t don't
match. */
diff --git a/gcc/testsuite/gcc.dg/ipa/iinline-1.c b/gcc/testsuite/gcc.dg/ipa/iinline-1.c
new file mode 100644
index 00000000000..da548f46648
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/iinline-1.c
@@ -0,0 +1,26 @@
+/* Verify that simple indirect calls are inlined even without early
+ inlining.. */
+/* { dg-do compile } */
+/* { dg-options "-O3 -c -fdump-ipa-inline -fno-early-inlining" } */
+
+extern void non_existent(int);
+
+static void hooray ()
+{
+ non_existent (1);
+}
+
+static void hiphip (void (*f)())
+{
+ non_existent (2);
+ f ();
+}
+
+int main (int argc, int *argv[])
+{
+ hiphip (hooray);
+ return 0;
+}
+
+/* { dg-final { scan-ipa-dump "hooray\[^\\n\]*inline copy in main" "inline" } } */
+/* { dg-final { cleanup-tree-dump "inline" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/modif-1.c b/gcc/testsuite/gcc.dg/ipa/modif-1.c
new file mode 100644
index 00000000000..7d160cb7e74
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/modif-1.c
@@ -0,0 +1,44 @@
+/* Verify that modification analysis detects modfications. */
+/* { dg-do compile } */
+/* { dg-options "-O3 -c -fdump-ipa-inline -fno-early-inlining" } */
+
+struct whatever
+{
+ int first;
+ unsigned second;
+};
+
+void func1 (struct whatever w);
+void func2 (struct whatever *pw);
+void func3 (int i);
+void func4 (int *pi);
+
+void the_test (struct whatever u, struct whatever v,
+ struct whatever w, struct whatever x,
+ int i, int j, int k, int l)
+{
+ struct whatever *pw = &w;
+ int *pk = &k;
+
+ j = l+3;
+ v.first = 9;
+
+ func1 (u);
+ func1 (v);
+ func2 (pw);
+ func2 (&x);
+ func3 (i);
+ func3 (j);
+ func4 (pk);
+ func4 (&l);
+}
+
+/* { dg-final { scan-ipa-dump-not "param 0 flags:\[^\\n\]*modified" "inline" } } */
+/* { dg-final { scan-ipa-dump "param 1 flags:\[^\\n\]*modified" "inline" } } */
+/* { dg-final { scan-ipa-dump "param 2 flags:\[^\\n\]*modified" "inline" } } */
+/* { dg-final { scan-ipa-dump "param 3 flags:\[^\\n\]*modified" "inline" } } */
+/* { dg-final { scan-ipa-dump-not "param 4 flags:\[^\\n\]*modified" "inline" } } */
+/* { dg-final { scan-ipa-dump "param 5 flags:\[^\\n\]*modified" "inline" } } */
+/* { dg-final { scan-ipa-dump "param 6 flags:\[^\\n\]*modified" "inline" } } */
+/* { dg-final { scan-ipa-dump "param 7 flags:\[^\\n\]*modified" "inline" } } */
+/* { dg-final { cleanup-ipa-dump "inline" } } */
diff --git a/gcc/testsuite/gcc.dg/label-decl-4.c b/gcc/testsuite/gcc.dg/label-decl-4.c
index 7b2a195c1b2..3cfe965fd5d 100644
--- a/gcc/testsuite/gcc.dg/label-decl-4.c
+++ b/gcc/testsuite/gcc.dg/label-decl-4.c
@@ -7,8 +7,8 @@ void
f (void)
{
__label__ a, b, a; /* { dg-error "duplicate label declaration 'a'" } */
- /* { dg-error "previous declaration of 'a' was here" "previous" { target *-*-* } 9 } */
- __label__ c; /* { dg-error "previous declaration of 'c' was here" } */
+ /* { dg-message "note: previous declaration of 'a' was here" "previous" { target *-*-* } 9 } */
+ __label__ c; /* { dg-message "note: previous declaration of 'c' was here" } */
__label__ c; /* { dg-error "duplicate label declaration 'c'" } */
return;
}
diff --git a/gcc/testsuite/gcc.dg/mallign.c b/gcc/testsuite/gcc.dg/mallign.c
new file mode 100644
index 00000000000..4a64dbbcc3b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/mallign.c
@@ -0,0 +1,15 @@
+/* Check that malloc's alignment honors what we trust it
+ minimally should. */
+
+/* { dg-do run } */
+/* { dg-options "-fno-builtin-malloc" } */
+
+#include <stdlib.h>
+typedef int word __attribute__((mode(word)));
+
+int main()
+{
+ if ((long)malloc (1) & (sizeof(word)-1))
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/nested-redef-1.c b/gcc/testsuite/gcc.dg/nested-redef-1.c
index acc961dac23..a3786b0c302 100644
--- a/gcc/testsuite/gcc.dg/nested-redef-1.c
+++ b/gcc/testsuite/gcc.dg/nested-redef-1.c
@@ -36,7 +36,7 @@ enum e0 {
enum e1 {
E2 = sizeof(enum e2 { E2 }), /* { dg-error "redeclaration of enumerator 'E2'" } */
- /* { dg-error "previous definition" "previous E2" { target *-*-* } 38 } */
+ /* { dg-message "note: previous definition" "previous E2" { target *-*-* } 38 } */
E3
};
diff --git a/gcc/testsuite/gcc.dg/noncompile/20020220-1.c b/gcc/testsuite/gcc.dg/noncompile/20020220-1.c
index aa57dc3d493..3063f422c9b 100644
--- a/gcc/testsuite/gcc.dg/noncompile/20020220-1.c
+++ b/gcc/testsuite/gcc.dg/noncompile/20020220-1.c
@@ -6,7 +6,7 @@ int foo (const char*, const char*);
void bar (void)
{
const char *s = "bar";
- int i; /* { dg-error "previous declaration" } */
+ int i; /* { dg-message "note: previous declaration" } */
int size = 2;
int i = foo (s, s + size); /* { dg-error "redeclaration of" } */
}
diff --git a/gcc/testsuite/gcc.dg/noncompile/label-1.c b/gcc/testsuite/gcc.dg/noncompile/label-1.c
index e9bde7b3b7b..58d212f9675 100644
--- a/gcc/testsuite/gcc.dg/noncompile/label-1.c
+++ b/gcc/testsuite/gcc.dg/noncompile/label-1.c
@@ -28,7 +28,7 @@ void c(void)
/* can't have two labels with the same name in the same function */
void d(void)
{
- l: dummy(); /* { dg-error "previous definition" "prev def same scope" } */
+ l: dummy(); /* { dg-message "note: previous definition" "prev def same scope" } */
l: dummy(); /* { dg-error "duplicate label" "dup label same scope" } */
goto l;
}
@@ -36,7 +36,7 @@ void d(void)
/* even at different scopes */
void e(void)
{
- l: dummy(); /* { dg-error "previous definition" "prev def diff scope" } */
+ l: dummy(); /* { dg-message "note: previous definition" "prev def diff scope" } */
{
l: dummy(); /* { dg-error "duplicate label" "dup label diff scope" } */
}
@@ -150,7 +150,7 @@ void m(void)
void n(void)
{
- __label__ l; /* { dg-error "previous declaration" "outer label decl" } */
+ __label__ l; /* { dg-message "note: previous declaration" "outer label decl" } */
void nest(void)
{
l: goto l; /* { dg-error "duplicate label" "inner label defn" } */
diff --git a/gcc/testsuite/gcc.dg/noncompile/label-lineno-1.c b/gcc/testsuite/gcc.dg/noncompile/label-lineno-1.c
index 76d4d96edaf..6d4def7ea19 100644
--- a/gcc/testsuite/gcc.dg/noncompile/label-lineno-1.c
+++ b/gcc/testsuite/gcc.dg/noncompile/label-lineno-1.c
@@ -4,7 +4,7 @@
void
foo(int i)
{
- my_label: /* { dg-error "previous definition" "prev label" } */
+ my_label: /* { dg-message "note: previous definition" "prev label" } */
i++;
diff --git a/gcc/testsuite/gcc.dg/noncompile/redecl-1.c b/gcc/testsuite/gcc.dg/noncompile/redecl-1.c
index 416c258c0d4..732db0098db 100644
--- a/gcc/testsuite/gcc.dg/noncompile/redecl-1.c
+++ b/gcc/testsuite/gcc.dg/noncompile/redecl-1.c
@@ -4,6 +4,6 @@
int
foo ()
{
- int bar; /* { dg-error "previous.*decl" "previous.*decl" } */
+ int bar; /* { dg-message "note: previous.*decl" "previous.*decl" } */
volatile int bar; /* { dg-error "conflicting type qualifiers" "conflicting type qualifiers" } */
}
diff --git a/gcc/testsuite/gcc.dg/old-style-then-proto-1.c b/gcc/testsuite/gcc.dg/old-style-then-proto-1.c
index 4d9c215a5dc..7d76287b0d1 100644
--- a/gcc/testsuite/gcc.dg/old-style-then-proto-1.c
+++ b/gcc/testsuite/gcc.dg/old-style-then-proto-1.c
@@ -7,38 +7,38 @@
void f1() {}
void f1(void); /* { dg-warning "prototype for 'f1' follows non-prototype definition" } */
-void f2() {} /* { dg-error "previous definition of 'f2' was here" } */
+void f2() {} /* { dg-message "note: previous definition of 'f2' was here" } */
void f2(int); /* { dg-error "prototype for 'f2' declares more arguments than previous old-style definition" } */
-void f3(a) int a; {} /* { dg-error "previous definition of 'f3' was here" } */
+void f3(a) int a; {} /* { dg-message "note: previous definition of 'f3' was here" } */
void f3(void); /* { dg-error "prototype for 'f3' declares fewer arguments than previous old-style definition" } */
void f4(a) int a; {}
void f4(int); /* { dg-warning "prototype for 'f4' follows non-prototype definition" } */
-void f5(a) int a; {} /* { dg-error "previous definition of 'f5' was here" } */
+void f5(a) int a; {} /* { dg-message "note: previous definition of 'f5' was here" } */
void f5(int, int); /* { dg-error "prototype for 'f5' declares more arguments than previous old-style definition" } */
-void f6(a) int a; {} /* { dg-error "previous definition of 'f6' was here" } */
+void f6(a) int a; {} /* { dg-message "note: previous definition of 'f6' was here" } */
void f6(int, ...); /* { dg-error "conflicting types for 'f6'" } */
-void f7(a, b) int a, b; {} /* { dg-error "previous definition of 'f7' was here" } */
+void f7(a, b) int a, b; {} /* { dg-message "note: previous definition of 'f7' was here" } */
void f7(int); /* { dg-error "prototype for 'f7' declares fewer arguments than previous old-style definition" } */
-void f8(a, b) int a, b; {} /* { dg-error "previous definition of 'f8' was here" } */
+void f8(a, b) int a, b; {} /* { dg-message "note: previous definition of 'f8' was here" } */
void f8(int, ...); /* { dg-error "conflicting types for 'f8'" } */
void f9(a, b) int a, b; {}
void f9(int, int); /* { dg-warning "prototype for 'f9' follows non-prototype definition" } */
-void f10(a, b) int a, b; {} /* { dg-error "previous definition of 'f10' was here" } */
+void f10(a, b) int a, b; {} /* { dg-message "note: previous definition of 'f10' was here" } */
void f10(int, long); /* { dg-error "prototype for 'f10' declares argument 2 with incompatible type" } */
-void f11(a, b) int a, b; {} /* { dg-error "previous definition of 'f11' was here" } */
+void f11(a, b) int a, b; {} /* { dg-message "note: previous definition of 'f11' was here" } */
void f11(long, int); /* { dg-error "prototype for 'f11' declares argument 1 with incompatible type" } */
void f12(a, b) const int a; volatile int b; {}
void f12(volatile int, const int); /* { dg-warning "prototype for 'f12' follows non-prototype definition" } */
-void f13(a) const int a[2][2]; {} /* { dg-error "previous definition of 'f13' was here" } */
+void f13(a) const int a[2][2]; {} /* { dg-message "note: previous definition of 'f13' was here" } */
void f13(volatile int [2][2]); /* { dg-error "prototype for 'f13' declares argument 1 with incompatible type" } */
diff --git a/gcc/testsuite/gcc.dg/parm-mismatch-1.c b/gcc/testsuite/gcc.dg/parm-mismatch-1.c
index ba8a538fb51..8f62e122b8a 100644
--- a/gcc/testsuite/gcc.dg/parm-mismatch-1.c
+++ b/gcc/testsuite/gcc.dg/parm-mismatch-1.c
@@ -4,15 +4,15 @@
/* { dg-do compile } */
/* { dg-options "" } */
-void f0(); /* { dg-error "previous declaration of 'f0' was here" } */
+void f0(); /* { dg-message "note: previous declaration of 'f0' was here" } */
void f0(int, ...); /* { dg-error "conflicting types for 'f0'" } */
/* { dg-message "note: a parameter list with an ellipsis can't match an empty parameter name list declaration" "note" { target *-*-* } 8 } */
-void f1(int, ...); /* { dg-error "previous declaration of 'f1' was here" } */
+void f1(int, ...); /* { dg-message "note: previous declaration of 'f1' was here" } */
void f1(); /* { dg-error "conflicting types for 'f1'" } */
/* { dg-message "note: a parameter list with an ellipsis can't match an empty parameter name list declaration" "note" { target *-*-* } 11 } */
-void f2(); /* { dg-error "previous declaration of 'f2' was here" } */
+void f2(); /* { dg-message "note: previous declaration of 'f2' was here" } */
void f2(char); /* { dg-error "conflicting types for 'f2'" } */
/* { dg-message "note: an argument type that has a default promotion can't match an empty parameter name list declaration" "note" { target *-*-* } 14 } */
-void f3(char); /* { dg-error "previous declaration of 'f3' was here" } */
+void f3(char); /* { dg-message "note: previous declaration of 'f3' was here" } */
void f3(); /* { dg-error "conflicting types for 'f3'" } */
/* { dg-message "note: an argument type that has a default promotion can't match an empty parameter name list declaration" "note" { target *-*-* } 17 } */
diff --git a/gcc/testsuite/gcc.dg/parser-pr28152-2.c b/gcc/testsuite/gcc.dg/parser-pr28152-2.c
new file mode 100644
index 00000000000..18dc1e63dec
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/parser-pr28152-2.c
@@ -0,0 +1,11 @@
+/* PR 28152: error messages should mention __complex__ */
+/* { dg-do compile } */
+/* { dg-options "" } */
+int
+main (void)
+{
+ __complex__ float z;
+
+ z = __complex__ (1.90000007326203904e+19, 0.0); /* { dg-error "__complex__" } */
+ z = __complex__ (1.0e+0, 0.0) / z; /* { dg-error "__complex__" } */
+ /* { dg-error "at end of input" "" { target *-*-* } 10 } */
diff --git a/gcc/testsuite/gcc.dg/parser-pr28152.c b/gcc/testsuite/gcc.dg/parser-pr28152.c
new file mode 100644
index 00000000000..99534c10bfe
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/parser-pr28152.c
@@ -0,0 +1,11 @@
+/* PR 28152: error messages should mention _Complex */
+/* { dg-do compile } */
+/* { dg-options "" } */
+int
+main (void)
+{
+ _Complex float z;
+
+ z = _Complex (1.90000007326203904e+19, 0.0); /* { dg-error "_Complex" } */
+ z = _Complex (1.0e+0, 0.0) / z; /* { dg-error "_Complex" } */
+ /* { dg-error "at end of input" "" { target *-*-* } 10 } */
diff --git a/gcc/testsuite/gcc.dg/pch/cpp-3.c b/gcc/testsuite/gcc.dg/pch/cpp-3.c
new file mode 100644
index 00000000000..25b5ca4077f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pch/cpp-3.c
@@ -0,0 +1,13 @@
+/* PR preprocessor/36649 */
+/* { dg-do compile } */
+/* { dg-options "-H -I." } */
+/* { dg-message "cpp-3.h\[^\n\]*(\n\[^\n\]*cpp-3.c)?\n\[^\n\]*cpp-3a.h\n\[^\n\]*cpp-3b.h" "" { target *-*-* } 0 } */
+
+#include "cpp-3.h"
+#include "cpp-3a.h"
+
+int
+main (void)
+{
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pch/cpp-3.hs b/gcc/testsuite/gcc.dg/pch/cpp-3.hs
new file mode 100644
index 00000000000..728b1afc7fb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pch/cpp-3.hs
@@ -0,0 +1,4 @@
+#ifndef CPP_3_H
+#define CPP_3_H
+/* empty */
+#endif
diff --git a/gcc/testsuite/gcc.dg/pch/cpp-3a.h b/gcc/testsuite/gcc.dg/pch/cpp-3a.h
new file mode 100644
index 00000000000..3788d11791c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pch/cpp-3a.h
@@ -0,0 +1,4 @@
+#ifndef CPP_3A_H
+#define CPP_3A_H
+#include "cpp-3b.h"
+#endif
diff --git a/gcc/testsuite/gcc.dg/pch/cpp-3b.h b/gcc/testsuite/gcc.dg/pch/cpp-3b.h
new file mode 100644
index 00000000000..5cb0e810488
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pch/cpp-3b.h
@@ -0,0 +1,4 @@
+#ifndef CPP_3B_H
+#define CPP_3B_H
+/* empty */
+#endif
diff --git a/gcc/testsuite/gcc.dg/pch/valid-3.c b/gcc/testsuite/gcc.dg/pch/valid-3.c
deleted file mode 100644
index c7884f993a0..00000000000
--- a/gcc/testsuite/gcc.dg/pch/valid-3.c
+++ /dev/null
@@ -1,6 +0,0 @@
-/* { dg-options "-I. -Winvalid-pch -fno-unit-at-a-time" } */
-
-#include "valid-3.h"/* { dg-warning "settings for -funit-at-a-time do not match" } */
-/* { dg-error "No such file" "no such file" { target *-*-* } 3 } */
-/* { dg-error "they were invalid" "invalid files" { target *-*-* } 3 } */
-int x;
diff --git a/gcc/testsuite/gcc.dg/pch/valid-3.hs b/gcc/testsuite/gcc.dg/pch/valid-3.hs
deleted file mode 100644
index 2a0af94c9f7..00000000000
--- a/gcc/testsuite/gcc.dg/pch/valid-3.hs
+++ /dev/null
@@ -1,3 +0,0 @@
-/* { dg-options "-I. -Winvalid-pch -funit-at-a-time" } */
-
-extern int x;
diff --git a/gcc/testsuite/gcc.dg/pr15236.c b/gcc/testsuite/gcc.dg/pr15236.c
new file mode 100644
index 00000000000..b01a4e85873
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr15236.c
@@ -0,0 +1,9 @@
+/* PR 15236: pedantic switch modifies treatment of non-ISO compliant
+ enumerations. */
+/* { dg-do compile } */
+/* { dg-options "-Wall -Wextra -pedantic-errors -Wconversion" } */
+typedef enum OMX_ERRORTYPE
+{
+ OMX_ErrorNone = 0,
+ OMX_ErrorInsufficientResources = 0x80001000 /* { dg-error "ISO C restricts enumerator values to range of .int." } */
+} OMX_ERRORTYPE;
diff --git a/gcc/testsuite/gcc.dg/pr15360-1.c b/gcc/testsuite/gcc.dg/pr15360-1.c
index 6abb2500671..4f900d7ea19 100644
--- a/gcc/testsuite/gcc.dg/pr15360-1.c
+++ b/gcc/testsuite/gcc.dg/pr15360-1.c
@@ -15,10 +15,10 @@ extern int b = 1; /* { dg-warning "initialized and declared" "extern init warnin
static int b;
static int b;
-static int c; /* { dg-error "previous declaration" "" } */
+static int c; /* { dg-message "note: previous declaration" "" } */
int c; /* { dg-error "non-static" "correct error" } */
-static int d; /* { dg-error "previous declaration" "" } */
+static int d; /* { dg-message "note: previous declaration" "" } */
int d = 1; /* { dg-error "non-static" "correct error" } */
void foo (void) { extern int e = 1; } /* { dg-error "has both" "extern init in function" } */
diff --git a/gcc/testsuite/gcc.dg/pr27953.c b/gcc/testsuite/gcc.dg/pr27953.c
index 7df46b1d8e1..245b59e0ba8 100644
--- a/gcc/testsuite/gcc.dg/pr27953.c
+++ b/gcc/testsuite/gcc.dg/pr27953.c
@@ -5,4 +5,4 @@ void foo(struct A a) {} /* { dg-warning "declared inside parameter list" } */
/* { dg-error "incomplete type" "" { target *-*-* } 3 } */
void foo() {} /* { dg-error "redefinition" } */
-/* { dg-error "previous definition" "" { target *-*-* } 3 } */
+/* { dg-message "note: previous definition" "" { target *-*-* } 3 } */
diff --git a/gcc/testsuite/gcc.dg/pr30551-2.c b/gcc/testsuite/gcc.dg/pr30551-2.c
new file mode 100644
index 00000000000..fdd5df66868
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr30551-2.c
@@ -0,0 +1,8 @@
+/* PR 30551 -Wmain is not enabled by default. */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+void main(char a) {} /* { dg-bogus "first argument of .main. should be .int." } */
+/* { dg-bogus ".main. takes only zero or two arguments" "" { target *-*-* } 5 } */
+/* { dg-bogus "return type of .main. is not .int." "" { target *-*-* } 5 } */
+
diff --git a/gcc/testsuite/gcc.dg/pr30551-3.c b/gcc/testsuite/gcc.dg/pr30551-3.c
new file mode 100644
index 00000000000..bc33187e50b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr30551-3.c
@@ -0,0 +1,7 @@
+/* PR 30551 -Wmain is enabled by -pedantic-errors. */
+/* { dg-do compile } */
+/* { dg-options "-pedantic-errors" } */
+/* { dg-skip-if "-Wmain not enabled with -pedantic on SPU" { spu-*-* } } */
+void main(char a) {} /* { dg-error "first argument of .main. should be .int." } */
+/* { dg-error ".main. takes only zero or two arguments" "" { target *-*-* } 5 } */
+/* { dg-error "return type of .main. is not .int." "" { target *-*-* } 5 } */
diff --git a/gcc/testsuite/gcc.dg/pr30551-4.c b/gcc/testsuite/gcc.dg/pr30551-4.c
new file mode 100644
index 00000000000..4803dbac01d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr30551-4.c
@@ -0,0 +1,8 @@
+/* PR 30551 -Wmain is enabled by -pedantic-errors and can be disabled. */
+/* { dg-do compile } */
+/* { dg-options "-pedantic-errors -Wno-main" } */
+
+void main(char a) {} /* { dg-bogus "first argument of .main. should be .int." } */
+/* { dg-bogus ".main. takes only zero or two arguments" "" { target *-*-* } 5 } */
+/* { dg-bogus "return type of .main. is not .int." "" { target *-*-* } 5 } */
+
diff --git a/gcc/testsuite/gcc.dg/pr30551-5.c b/gcc/testsuite/gcc.dg/pr30551-5.c
new file mode 100644
index 00000000000..060ed016b3c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr30551-5.c
@@ -0,0 +1,7 @@
+/* PR 30551 -Wmain is enabled by -pedantic and can be disabled. */
+/* { dg-do compile } */
+/* { dg-options "-pedantic -Wno-main" } */
+
+void main(char a) {} /* { dg-bogus "first argument of .main. should be .int." } */
+/* { dg-bogus ".main. takes only zero or two arguments" "" { target *-*-* } 5 } */
+/* { dg-bogus "return type of .main. is not .int." "" { target *-*-* } 5 } */
diff --git a/gcc/testsuite/gcc.dg/pr30551-6.c b/gcc/testsuite/gcc.dg/pr30551-6.c
new file mode 100644
index 00000000000..48824e3a9d0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr30551-6.c
@@ -0,0 +1,7 @@
+/* PR 30551 -Wmain is enabled by -pedantic. */
+/* { dg-do compile } */
+/* { dg-options "-pedantic" } */
+/* { dg-skip-if "-Wmain not enabled with -pedantic on SPU" { spu-*-* } } */
+void main(char a) {} /* { dg-warning "first argument of .main. should be .int." } */
+/* { dg-warning ".main. takes only zero or two arguments" "" { target *-*-* } 5 } */
+/* { dg-warning "return type of .main. is not .int." "" { target *-*-* } 5 } */
diff --git a/gcc/testsuite/gcc.dg/pr30551.c b/gcc/testsuite/gcc.dg/pr30551.c
new file mode 100644
index 00000000000..218a50ad9c6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr30551.c
@@ -0,0 +1,7 @@
+/* PR 30551 -Wmain is enabled by -Wall. */
+/* { dg-do compile } */
+/* { dg-options "-Wall" } */
+/* { dg-skip-if "-Wmain not enabled with -Wall on SPU" { spu-*-* } } */
+void main(char a) {} /* { dg-warning "first argument of .main. should be .int." } */
+/* { dg-warning ".main. takes only zero or two arguments" "" { target *-*-* } 5 } */
+/* { dg-warning "return type of .main. is not .int." "" { target *-*-* } 5 } */
diff --git a/gcc/testsuite/gcc.dg/pr3074-1.c b/gcc/testsuite/gcc.dg/pr3074-1.c
index c2258d57bb1..4716b79da96 100644
--- a/gcc/testsuite/gcc.dg/pr3074-1.c
+++ b/gcc/testsuite/gcc.dg/pr3074-1.c
@@ -2,9 +2,8 @@
/* { dg-do compile } */
/* { dg-options "-Wall" } */
-void foo()
+void foo(int a)
{
- int a;
5 * (a == 1) | (a == 2); /* { dg-warning "no effect" "no effect" } */
}
diff --git a/gcc/testsuite/gcc.dg/pr32370.c b/gcc/testsuite/gcc.dg/pr32370.c
index 18afde21f0f..80a7c545d47 100644
--- a/gcc/testsuite/gcc.dg/pr32370.c
+++ b/gcc/testsuite/gcc.dg/pr32370.c
@@ -5,12 +5,14 @@
#if defined __i386__ || defined __x86_64__
# define C "=S"
+# define TYPE unsigned long
#elif defined __ia64__
# define C "=a"
+# define TYPE unsigned long long
#endif
unsigned int
-foo (unsigned long port)
+foo (TYPE port)
{
unsigned int v;
__asm__ __volatile__ ("" : C (v) : "Nd" (port)); /* { dg-error "while reloading\|has impossible" } */
diff --git a/gcc/testsuite/gcc.dg/pr34985.c b/gcc/testsuite/gcc.dg/pr34985.c
new file mode 100644
index 00000000000..56437509d9f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr34985.c
@@ -0,0 +1,9 @@
+/* PR34985: Warning "defined but not used" despite __attribute__((__used__)) */
+/* { dg-do compile } */
+/* { dg-options "-Wall -Wextra -O2" } */
+static void xxyyzz (void);
+static void __attribute__((__used__)) xxyyzz(void)
+{
+}
+
+/* { dg-final { scan-assembler "xxyyzz" } } */
diff --git a/gcc/testsuite/gcc.dg/pr35635.c b/gcc/testsuite/gcc.dg/pr35635.c
new file mode 100644
index 00000000000..45d10a67bd3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr35635.c
@@ -0,0 +1,90 @@
+/* PR 35635 */
+/* { dg-do compile } */
+/* { dg-options "-Wconversion -Wsign-conversion" } */
+
+struct unsigned_bit {
+ unsigned int x:1;
+} unsigned_bit;
+struct signed_bit {
+ int x:1;
+} signed_bit;
+int bar;
+int bar2;
+
+void func1()
+{
+ /* The result of boolean operators fits in unsiged int:1, thus do
+ not warn. */
+ unsigned_bit.x = (bar != 0); /* { dg-bogus "conversion" } */
+ unsigned_bit.x = (bar == 0); /* { dg-bogus "conversion" } */
+ unsigned_bit.x = (bar <= 0); /* { dg-bogus "conversion" } */
+ unsigned_bit.x = (bar >= 0); /* { dg-bogus "conversion" } */
+ unsigned_bit.x = (bar < 0); /* { dg-bogus "conversion" } */
+ unsigned_bit.x = (bar > 0); /* { dg-bogus "conversion" } */
+ unsigned_bit.x = !bar; /* { dg-bogus "conversion" } */
+ unsigned_bit.x = (bar || bar2); /* { dg-bogus "conversion" } */
+ unsigned_bit.x = (bar && bar2); /* { dg-bogus "conversion" } */
+
+ /* Both branches of ? fit in the destination, thus do not warn. */
+ unsigned_bit.x = bar != 0 ? 1 : 0; /* { dg-bogus "conversion" } */
+ unsigned_bit.x = bar != 0 ? 1.0 : 0.0; /* { dg-bogus "conversion" } */
+
+ /* At least one branch of ? does not fit in the destination, thus
+ warn. */
+ unsigned_bit.x = bar != 0 ? 2 : 0; /* { dg-warning "conversion" } */
+ unsigned_bit.x = bar != 0 ? 0 : -1; /* { dg-warning "negative integer implicitly converted to unsigned type" } */
+}
+
+void func2()
+{
+ signed char schar_x;
+
+ /* Both branches of ? fit in the destination, thus do not warn. */
+ schar_x = bar != 0 ? 1 : 0; /* { dg-bogus "conversion" } */
+ schar_x = bar != 0 ? 2.0 : 10; /* { dg-bogus "conversion" } */
+
+ /* At least one branch of ? does not fit in the destination, thus
+ warn. */
+ schar_x = bar != 0 ? 2.1 : 10; /* { dg-warning "conversion" } */
+ schar_x = bar != 0 ? (signed char) 1024: -1024; /* { dg-warning "conversion" } */
+}
+
+
+
+void func3()
+{
+ unsigned char uchar_x;
+
+ /* Both branches of ? fit in the destination, thus do not warn. */
+ uchar_x = bar != 0 ? 1 : 0;
+ uchar_x = bar != 0 ? 2.0 : 10;
+
+ /* At least one branch of ? does not fit in the destination, thus
+ warn. */
+ uchar_x = bar != 0 ? 2.1 : 10; /* { dg-warning "conversion" } */
+ uchar_x = bar != 0
+ ? (unsigned char) 1024
+ : -1; /* { dg-warning "negative integer implicitly converted to unsigned type" } */
+}
+
+void func4()
+{
+ signed_bit.x = -1; /* { dg-bogus "conversion" } */
+ signed_bit.x = bar != 0 ? -1.0 : 0.0; /* { dg-bogus "conversion" } */
+ signed_bit.x = bar != 0 ? -1 : 0; /* { dg-bogus "conversion" } */
+
+
+ signed_bit.x = 1; /* { dg-warning "conversion" } */
+ signed_bit.x = (bar != 0); /* { dg-warning "conversion" } */
+ signed_bit.x = (bar == 0); /* { dg-warning "conversion" } */
+ signed_bit.x = (bar <= 0); /* { dg-warning "conversion" } */
+ signed_bit.x = (bar >= 0); /* { dg-warning "conversion" } */
+ signed_bit.x = (bar < 0); /* { dg-warning "conversion" } */
+ signed_bit.x = (bar > 0); /* { dg-warning "conversion" } */
+ signed_bit.x = !bar; /* { dg-warning "conversion" } */
+ signed_bit.x = (bar || bar2); /* { dg-warning "conversion" } */
+ signed_bit.x = (bar && bar2); /* { dg-warning "conversion" } */
+ signed_bit.x = bar != 0 ? 1 : 0; /* { dg-warning "conversion" } */
+ signed_bit.x = bar != 0 ? 2 : 0; /* { dg-warning "conversion" } */
+}
+
diff --git a/gcc/testsuite/gcc.dg/pr35746.c b/gcc/testsuite/gcc.dg/pr35746.c
new file mode 100644
index 00000000000..e8bebf922d2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr35746.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99" } */
+
+int foo(int i);
+
+void bar()
+{
+ __complex__ int i;
+ X j; /* { dg-error "undeclared.*appears.*expected" } */
+
+ if (i = foo(j)) /* { dg-error "undeclared" } */
+ ;
+}
diff --git a/gcc/testsuite/gcc.dg/pr35899.c b/gcc/testsuite/gcc.dg/pr35899.c
index 113cbc87a7d..4ce4ac589f1 100644
--- a/gcc/testsuite/gcc.dg/pr35899.c
+++ b/gcc/testsuite/gcc.dg/pr35899.c
@@ -5,7 +5,7 @@
int
foo (void)
{
- int a = bar (); /* { dg-warning "previous implicit declaration" } */
+ int a = bar (); /* { dg-message "note: previous implicit declaration" } */
return a;
}
diff --git a/gcc/testsuite/gcc.dg/pr36901-1.c b/gcc/testsuite/gcc.dg/pr36901-1.c
new file mode 100644
index 00000000000..63438307ed3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr36901-1.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-options "-pedantic-errors" } */
+#include "pr36901-system.h"
+void foo(void)
+{
+ int s = sc;
+}
diff --git a/gcc/testsuite/gcc.dg/pr36901-2.c b/gcc/testsuite/gcc.dg/pr36901-2.c
new file mode 100644
index 00000000000..cee367d778d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr36901-2.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-options "-pedantic-errors -w" } */
+#include "pr36901.h"
+void foo(void)
+{
+ int s = sc;
+}
diff --git a/gcc/testsuite/gcc.dg/pr36901-3.c b/gcc/testsuite/gcc.dg/pr36901-3.c
new file mode 100644
index 00000000000..1f357421476
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr36901-3.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-pedantic-errors" } */
+#include "pr36901.h"
+void foo(void)
+{
+ int s = sc;
+}
+/* { dg-message "file included" "In file included" { target *-*-* } 0 } */
+/* { dg-error "ordered comparison of pointer with integer zero" "pedantic error" { target *-*-* } 0 } */
diff --git a/gcc/testsuite/gcc.dg/pr36901-4.c b/gcc/testsuite/gcc.dg/pr36901-4.c
new file mode 100644
index 00000000000..f1d261657af
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr36901-4.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-pedantic-errors -Wsystem-headers" } */
+#include "pr36901-system.h"
+void foo(void)
+{
+ int s = sc;
+}
+/* { dg-message "from " "In file included" { target *-*-* } 0 } */
+/* { dg-error "ordered comparison of pointer with integer zero" "pedantic error" { target *-*-* } 0 } */
diff --git a/gcc/testsuite/gcc.dg/pr36901-system.h b/gcc/testsuite/gcc.dg/pr36901-system.h
new file mode 100644
index 00000000000..6cc1e803d0a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr36901-system.h
@@ -0,0 +1,3 @@
+#pragma GCC system_header
+#include "pr36901.h"
+
diff --git a/gcc/testsuite/gcc.dg/pr36901.h b/gcc/testsuite/gcc.dg/pr36901.h
new file mode 100644
index 00000000000..e08d156412a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr36901.h
@@ -0,0 +1,2 @@
+int sc = (&sc > 0);
+
diff --git a/gcc/testsuite/gcc.dg/pr36991.c b/gcc/testsuite/gcc.dg/pr36991.c
new file mode 100644
index 00000000000..d090ba105c7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr36991.c
@@ -0,0 +1,12 @@
+/* PR tree-optimization/36991 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+typedef float V __attribute__ ((vector_size (16)));
+typedef union { V v[4][4]; } U;
+
+void
+foo (float x, float y, U *z)
+{
+ z->v[1][0] = z->v[0][1] = (V) { x, y, 0, 0 };
+}
diff --git a/gcc/testsuite/gcc.dg/pr36997.c b/gcc/testsuite/gcc.dg/pr36997.c
new file mode 100644
index 00000000000..34ee54a6827
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr36997.c
@@ -0,0 +1,8 @@
+/* { dg-do compile { target x86_64-*-* i?86-*-* } } */
+/* { dg-options "-std=c99" } */
+
+typedef int __m64 __attribute__ ((__vector_size__ (8), __may_alias__));
+__m64 _mm_add_si64 (__m64 __m1, __m64 __m2)
+{
+ return (__m64) __builtin_ia32_paddq ((long long)__m1, (long long)__m2); /* { dg-error "incompatible type" } */
+}
diff --git a/gcc/testsuite/gcc.dg/pr36998.c b/gcc/testsuite/gcc.dg/pr36998.c
new file mode 100644
index 00000000000..f0669b4fd50
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr36998.c
@@ -0,0 +1,23 @@
+/* PR rtl-optimization/36998 */
+/* { dg-do compile } */
+/* { dg-options "-Os -fasynchronous-unwind-tables" } */
+/* { dg-options "-Os -mpreferred-stack-boundary=2 -fasynchronous-unwind-tables" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
+
+void foo (const char *, ...) __attribute__ ((noreturn));
+int bar (const char *, ...);
+extern __SIZE_TYPE__ strlen (const char *);
+int baz (char *, char *, int, void *);
+
+void
+test (char *w, int x, char *y, char *z)
+{
+ char *p, b[32];
+ for (p = y; *p; p += strlen (p) + 1)
+ {
+ baz (w, p, x, z);
+ foo ("msg1 %s", b);
+ }
+ for (p = y; *p; p += strlen (p) + 1)
+ bar (" %s", p);
+ foo ("msg2 %s", b);
+}
diff --git a/gcc/testsuite/gcc.dg/pr8715.c b/gcc/testsuite/gcc.dg/pr8715.c
new file mode 100644
index 00000000000..e45e77c09f4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr8715.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-Wsign-compare -std=c99" } */
+
+#include <stdbool.h>
+
+int foo()
+{
+ unsigned char b = '1';
+
+ bool x = ~b; /* { dg-warning "promoted ~unsigned is always non-zero" } */
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pragma-message.c b/gcc/testsuite/gcc.dg/pragma-message.c
new file mode 100644
index 00000000000..0f9c6bf447b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pragma-message.c
@@ -0,0 +1,53 @@
+/* Test that #pragma message "..." writes compiler messages. */
+
+#pragma message /* { dg-warning "expected a string" } */
+#pragma message 0 /* { dg-warning "expected a string" } */
+#pragma message id /* { dg-warning "expected a string" } */
+#pragma message ( /* { dg-warning "expected a string" } */
+#pragma message (0 /* { dg-warning "expected a string" } */
+#pragma message (id /* { dg-warning "expected a string" } */
+#pragma message () /* { dg-warning "expected a string" } */
+#pragma message (0) /* { dg-warning "expected a string" } */
+#pragma message (id) /* { dg-warning "expected a string" } */
+
+/* gcc prefixes '#pragma message ...' output with filename and line number,
+ then 'note: #pragma message: ', allowing dg-message to check output.
+ If unexpected pragma messages are printed (anything not caught by a
+ matching dg-message), dejagnu will report these as excess errors. */
+
+#pragma message "
+/* { dg-error "missing terminating" "" { target *-*-* } 18 } */
+/* { dg-warning "expected a string" "" { target *-*-* } 18 } */
+#pragma message "Bad 1
+/* { dg-error "missing terminating" "" { target *-*-* } 21 } */
+/* { dg-warning "expected a string" "" { target *-*-* } 21 } */
+#pragma message ("Bad 2
+/* { dg-error "missing terminating" "" { target *-*-* } 24 } */
+/* { dg-warning "expected a string" "" { target *-*-* } 24 } */
+#pragma message ("Bad 3"
+/* { dg-warning "malformed '#pragma message" "" { target *-*-* } 27 } */
+
+#pragma message "" junk
+/* { dg-warning "junk at end of '#pragma message'" "" { target *-*-* } 30 } */
+
+#pragma message ("") junk
+/* { dg-warning "junk at end of '#pragma message'" "" { target *-*-* } 33 } */
+
+#pragma message "" /* No output expected for empty messages. */
+#pragma message ("")
+
+#pragma message "Okay 1" /* { dg-message "Okay 1" } */
+#pragma message ("Okay 2") /* { dg-message "Okay 2" } */
+#define THREE "3"
+#pragma message ("Okay " THREE) /* { dg-message "Okay 3" } */
+
+/* Create a TODO() that prints a message on compilation. */
+#define DO_PRAGMA(x) _Pragma (#x)
+#define TODO(x) DO_PRAGMA(message ("TODO - " #x))
+TODO(Okay 4) /* { dg-message "TODO - Okay 4" } */
+
+#if 0
+#pragma message ("Not printed")
+#endif
+
+int unused; /* Silence `ISO C forbids an empty translation unit' warning. */
diff --git a/gcc/testsuite/gcc.dg/proto-1.c b/gcc/testsuite/gcc.dg/proto-1.c
index 13c59a8a54b..62d0209b08f 100644
--- a/gcc/testsuite/gcc.dg/proto-1.c
+++ b/gcc/testsuite/gcc.dg/proto-1.c
@@ -1,5 +1,5 @@
/* PR c/28502 */
/* { dg-do compile } */
-void foo() {} /* { dg-error "previous" } */
+void foo() {} /* { dg-message "note: previous" } */
void foo(void[]); /* { dg-error "array of voids" } */
diff --git a/gcc/testsuite/gcc.dg/qual-return-3.c b/gcc/testsuite/gcc.dg/qual-return-3.c
index 7a92046da81..e65f86d547d 100644
--- a/gcc/testsuite/gcc.dg/qual-return-3.c
+++ b/gcc/testsuite/gcc.dg/qual-return-3.c
@@ -6,7 +6,7 @@
/* { dg-do compile } */
/* { dg-options "" } */
-int foo (); /* { dg-error "previous declaration" "different qualifiers" } */
+int foo (); /* { dg-message "note: previous declaration" "different qualifiers" } */
const int foo () { return 0; } /* { dg-error "conflicting types" "different qualifiers" } */
void bar (void);
diff --git a/gcc/testsuite/gcc.dg/redecl-1.c b/gcc/testsuite/gcc.dg/redecl-1.c
index 61d6e5b307a..6a7d8faecaf 100644
--- a/gcc/testsuite/gcc.dg/redecl-1.c
+++ b/gcc/testsuite/gcc.dg/redecl-1.c
@@ -9,8 +9,8 @@
/* Extern at function scope, clashing with extern at file scope */
-extern int foo1; /* { dg-error "previous" } */
-extern int bar1(int); /* { dg-error "previous" } */
+extern int foo1; /* { dg-message "note: previous" } */
+extern int bar1(int); /* { dg-message "note: previous" } */
void test1(void)
{
@@ -22,8 +22,8 @@ void test1(void)
void test2(void)
{
- extern double foo2; /* { dg-error "previous" } */
- extern double bar2(double); /* { dg-error "previous" } */
+ extern double foo2; /* { dg-message "note: previous" } */
+ extern double bar2(double); /* { dg-message "note: previous" } */
}
extern int foo2; /* { dg-error "conflict" } */
@@ -36,9 +36,9 @@ typedef float baz3; /* { dg-bogus } */
void prime3(void)
{
- extern int foo3; /* { dg-error "previous" } */
- extern int bar3(int); /* { dg-error "previous" } */
- extern int baz3; /* { dg-error "previous" } */
+ extern int foo3; /* { dg-message "note: previous" } */
+ extern int bar3(int); /* { dg-message "note: previous" } */
+ extern int baz3; /* { dg-message "note: previous" } */
}
void test3(void)
@@ -58,7 +58,7 @@ void prime4(void)
void test4(void)
{
extern double bar4(double); /* { dg-error "conflict" } */
-/* { dg-error "previous implicit declaration" "" { target *-*-* } 55 } */
+/* { dg-message "note: previous implicit declaration" "" { target *-*-* } 55 } */
}
/* Implicit decl, clashing with extern at previous function scope. */
@@ -66,7 +66,7 @@ void test4(void)
void prime5(void)
{
extern double bar5(double); /* { dg-message "note: previous declaration" "" } */
-} /* { dg-error "previous implicit declaration" "" { target *-*-* } 68 } */
+} /* { dg-message "note: previous implicit declaration" "" { target *-*-* } 68 } */
void test5(void)
{
@@ -75,7 +75,7 @@ void test5(void)
/* Extern then static, both at file scope. */
-extern int test6(int); /* { dg-error "previous" "" } */
+extern int test6(int); /* { dg-message "note: previous" "" } */
static int test6(int x) /* { dg-error "follows non-static" } */
{ return x; }
@@ -84,7 +84,7 @@ static int test6(int x) /* { dg-error "follows non-static" } */
void prime7(void)
{
- extern int test7(int); /* { dg-error "previous" "" } */
+ extern int test7(int); /* { dg-message "note: previous" "" } */
}
static int test7(int x) /* { dg-error "follows non-static" } */
@@ -94,7 +94,7 @@ static int test7(int x) /* { dg-error "follows non-static" } */
void prime8(void)
{
- test8(); /* { dg-error "previous" "" } */
+ test8(); /* { dg-message "note: previous" "" } */
/* { dg-warning "implicit" "implicit" { target *-*-* } 97 } */
}
diff --git a/gcc/testsuite/gcc.dg/redecl-11.c b/gcc/testsuite/gcc.dg/redecl-11.c
index e4ce0b830ea..5540e40503c 100644
--- a/gcc/testsuite/gcc.dg/redecl-11.c
+++ b/gcc/testsuite/gcc.dg/redecl-11.c
@@ -5,5 +5,5 @@
/* { dg-options "" } */
int f(int (*)[]);
-void g() { int f(int (*)[2]); } /* { dg-error "previous declaration of 'f' was here" } */
+void g() { int f(int (*)[2]); } /* { dg-message "note: previous declaration of 'f' was here" } */
int f(int (*)[3]); /* { dg-error "conflicting types for 'f'" } */
diff --git a/gcc/testsuite/gcc.dg/redecl-12.c b/gcc/testsuite/gcc.dg/redecl-12.c
index 58041ef8e35..711b8a3fcae 100644
--- a/gcc/testsuite/gcc.dg/redecl-12.c
+++ b/gcc/testsuite/gcc.dg/redecl-12.c
@@ -5,5 +5,5 @@
/* { dg-options "" } */
extern int a[];
-void f(void) { extern int a[]; extern int a[10]; } /* { dg-error "previous declaration of 'a' was here" } */
+void f(void) { extern int a[]; extern int a[10]; } /* { dg-message "note: previous declaration of 'a' was here" } */
extern int a[5]; /* { dg-error "conflicting types for 'a'" } */
diff --git a/gcc/testsuite/gcc.dg/redecl-13.c b/gcc/testsuite/gcc.dg/redecl-13.c
index 84eeb4eaeb5..3f05d0fb168 100644
--- a/gcc/testsuite/gcc.dg/redecl-13.c
+++ b/gcc/testsuite/gcc.dg/redecl-13.c
@@ -5,5 +5,5 @@
/* { dg-options "" } */
extern int a[];
-void f(void) { extern int a[10]; } /* { dg-error "previous declaration of 'a' was here" } */
+void f(void) { extern int a[10]; } /* { dg-message "note: previous declaration of 'a' was here" } */
extern int a[5]; /* { dg-error "conflicting types for 'a'" } */
diff --git a/gcc/testsuite/gcc.dg/redecl-15.c b/gcc/testsuite/gcc.dg/redecl-15.c
index 5ed0eac3fde..d2f48bd79b2 100644
--- a/gcc/testsuite/gcc.dg/redecl-15.c
+++ b/gcc/testsuite/gcc.dg/redecl-15.c
@@ -7,7 +7,7 @@
void
f (void)
{
- g(); /* { dg-warning "previous implicit declaration of 'g' was here" } */
+ g(); /* { dg-message "note: previous implicit declaration of 'g' was here" } */
{
void g(); /* { dg-warning "conflicting types for 'g'" } */
}
diff --git a/gcc/testsuite/gcc.dg/redecl-16.c b/gcc/testsuite/gcc.dg/redecl-16.c
index 52941cb084b..560b373fb3f 100644
--- a/gcc/testsuite/gcc.dg/redecl-16.c
+++ b/gcc/testsuite/gcc.dg/redecl-16.c
@@ -14,5 +14,5 @@ f (void)
{
extern IA5P a[];
}
-IAP a[] = { 0 }; /* { dg-error "previous definition" } */
+IAP a[] = { 0 }; /* { dg-message "note: previous definition" } */
extern IA10P a[]; /* { dg-error "conflicting types" } */
diff --git a/gcc/testsuite/gcc.dg/redecl-2.c b/gcc/testsuite/gcc.dg/redecl-2.c
index b1b7dc929de..fa0d5e44785 100644
--- a/gcc/testsuite/gcc.dg/redecl-2.c
+++ b/gcc/testsuite/gcc.dg/redecl-2.c
@@ -7,56 +7,56 @@
void
fa0 (void)
{
- int a0; /* { dg-error "previous declaration" } */
+ int a0; /* { dg-message "note: previous declaration" } */
int a0; /* { dg-error "redeclaration" } */
}
void
fa1 (void)
{
- int a1; /* { dg-error "previous declaration" } */
+ int a1; /* { dg-message "note: previous declaration" } */
static int a1; /* { dg-error "redeclaration" } */
}
void
fa2 (void)
{
- int a2; /* { dg-error "previous declaration" } */
+ int a2; /* { dg-message "note: previous declaration" } */
extern int a2; /* { dg-error "follows declaration with no linkage" } */
}
void
fa3 (void)
{
- static int a3; /* { dg-error "previous declaration" } */
+ static int a3; /* { dg-message "note: previous declaration" } */
int a3; /* { dg-error "redeclaration" } */
}
void
fa4 (void)
{
- static int a4; /* { dg-error "previous declaration" } */
+ static int a4; /* { dg-message "note: previous declaration" } */
static int a4; /* { dg-error "redeclaration" } */
}
void
fa5 (void)
{
- static int a5; /* { dg-error "previous declaration" } */
+ static int a5; /* { dg-message "note: previous declaration" } */
extern int a5; /* { dg-error "follows declaration with no linkage" } */
}
void
fa6 (void)
{
- extern int a6; /* { dg-error "previous declaration" } */
+ extern int a6; /* { dg-message "note: previous declaration" } */
int a6; /* { dg-error "follows extern declaration" } */
}
void
fa7 (void)
{
- extern int a7; /* { dg-error "previous declaration" } */
+ extern int a7; /* { dg-message "note: previous declaration" } */
static int a7; /* { dg-error "follows extern declaration" } */
}
diff --git a/gcc/testsuite/gcc.dg/redecl-5.c b/gcc/testsuite/gcc.dg/redecl-5.c
index a689295bb85..15b1f8c8ec4 100644
--- a/gcc/testsuite/gcc.dg/redecl-5.c
+++ b/gcc/testsuite/gcc.dg/redecl-5.c
@@ -7,7 +7,7 @@
void
f (void)
{
- long z(); /* { dg-error "previous implicit declaration" } */
+ long z(); /* { dg-message "note: previous implicit declaration" } */
}
void
diff --git a/gcc/testsuite/gcc.dg/sequence-pt-pr17880.c b/gcc/testsuite/gcc.dg/sequence-pt-pr17880.c
new file mode 100644
index 00000000000..df706e577fb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/sequence-pt-pr17880.c
@@ -0,0 +1,54 @@
+/* PR 17880 */
+/* { dg-do compile } */
+/* { dg-options "-Wsequence-point" } */
+
+int
+foo (int x)
+{
+ unsigned int a;
+ int b;
+
+ b = (a += 5) > a; /* { dg-warning "undefined" "sequence point warning" } */
+ b = (a += 5) + a == 10; /* { dg-warning "undefined" "sequence point warning" } */
+ b = (a -= 5) > a; /* { dg-warning "undefined" "sequence point warning" } */
+ b = (a -= 5) + a == 10; /* { dg-warning "undefined" "sequence point warning" } */
+ b = a-- > a; /* { dg-warning "undefined" "sequence point warning" } */
+ b = a-- + a == 10; /* { dg-warning "undefined" "sequence point warning" } */
+ b = ++a > a; /* { dg-warning "undefined" "sequence point warning" } */
+ b = ++a + a == 10; /* { dg-warning "undefined" "sequence point warning" } */
+
+ if ((a += 5) > a) return -1; /* { dg-warning "undefined" "sequence point warning" } */
+ if ((a += 5) + a == 10) return -1; /* { dg-warning "undefined" "sequence point warning" } */
+ if ((a -= 5) > a) return -1; /* { dg-warning "undefined" "sequence point warning" } */
+ if ((a -= 5) + a == 10) return -1; /* { dg-warning "undefined" "sequence point warning" } */
+ if (a-- > a) return -1; /* { dg-warning "undefined" "sequence point warning" } */
+ if (a-- + a == 10) return -1; /* { dg-warning "undefined" "sequence point warning" } */
+ if (++a > a) return -1; /* { dg-warning "undefined" "sequence point warning" } */
+ if (++a + a == 10) return -1; /* { dg-warning "undefined" "sequence point warning" } */
+ do {} while ((a += 5) > a); /* { dg-warning "undefined" "sequence point warning" } */
+ while ((a += 5) > a); /* { dg-warning "undefined" "sequence point warning" } */
+ for ((a += 5) > a;;); /* { dg-warning "undefined" "sequence point warning" } */
+ for (b = (a += 5) > a;;); /* { dg-warning "undefined" "sequence point warning" } */
+ for (; (a += 5) > a;); /* { dg-warning "undefined" "sequence point warning" } */
+ for (;; b = (a += 5) > a); /* { dg-warning "undefined" "sequence point warning" } */
+ for (;; a++ + a++); /* { dg-warning "undefined" "sequence point warning" } */
+ if (a) a++ - a--; /* { dg-warning "undefined" "sequence point warning" } */
+ ((a +=5) > a) ? a : b; /* { dg-warning "undefined" "sequence point warning" } */
+ return (a++ - a--); /* { dg-warning "undefined" "sequence point warning" } */
+}
+
+void bar (int i)
+{
+ int a = i++ - i++; /* { dg-warning "undefined" "sequence point warning" } */
+}
+
+void baz (int i)
+{
+ switch (i++ + i++) /* { dg-warning "undefined" "sequence point warning" } */
+ {
+ case 1:
+ i++ - i++; /* { dg-warning "undefined" "sequence point warning" } */
+ case 2:
+ break;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/sibcall-3.c b/gcc/testsuite/gcc.dg/sibcall-3.c
index 38f3e37622d..a33d4d34502 100644
--- a/gcc/testsuite/gcc.dg/sibcall-3.c
+++ b/gcc/testsuite/gcc.dg/sibcall-3.c
@@ -5,7 +5,7 @@
Copyright (C) 2002 Free Software Foundation Inc.
Contributed by Hans-Peter Nilsson <hp@bitrange.com> */
-/* { dg-do run { xfail arc-*-* avr-*-* cris-*-* crisv32-*-* h8300-*-* hppa*64*-*-* m32r-*-* m68hc1?-*-* mcore-*-* mn10300-*-* xstormy16-*-* v850*-*-* vax-*-* xtensa-*-* } } */
+/* { dg-do run { xfail arc-*-* avr-*-* cris-*-* crisv32-*-* h8300-*-* hppa*64*-*-* m32r-*-* m68hc1?-*-* mcore-*-* mn10300-*-* xstormy16-*-* v850*-*-* vax-*-* xtensa*-*-* } } */
/* -mlongcall disables sibcall patterns. */
/* { dg-skip-if "" { powerpc*-*-* } { "-mlongcall" } { "" } } */
/* { dg-options "-O2 -foptimize-sibling-calls" } */
diff --git a/gcc/testsuite/gcc.dg/sibcall-4.c b/gcc/testsuite/gcc.dg/sibcall-4.c
index 535efb64504..e13db6bb74f 100644
--- a/gcc/testsuite/gcc.dg/sibcall-4.c
+++ b/gcc/testsuite/gcc.dg/sibcall-4.c
@@ -5,7 +5,7 @@
Copyright (C) 2002 Free Software Foundation Inc.
Contributed by Hans-Peter Nilsson <hp@bitrange.com> */
-/* { dg-do run { xfail arc-*-* avr-*-* cris-*-* crisv32-*-* h8300-*-* hppa*64*-*-* m32r-*-* m68hc1?-*-* mcore-*-* mn10300-*-* xstormy16-*-* v850*-*-* vax-*-* xtensa-*-* } } */
+/* { dg-do run { xfail arc-*-* avr-*-* cris-*-* crisv32-*-* h8300-*-* hppa*64*-*-* m32r-*-* m68hc1?-*-* mcore-*-* mn10300-*-* xstormy16-*-* v850*-*-* vax-*-* xtensa*-*-* } } */
/* -mlongcall disables sibcall patterns. */
/* { dg-skip-if "" { powerpc*-*-* } { "-mlongcall" } { "" } } */
/* { dg-options "-O2 -foptimize-sibling-calls" } */
diff --git a/gcc/testsuite/gcc.dg/tls/diag-3.c b/gcc/testsuite/gcc.dg/tls/diag-3.c
index 45d89b43722..1a7994c69e7 100644
--- a/gcc/testsuite/gcc.dg/tls/diag-3.c
+++ b/gcc/testsuite/gcc.dg/tls/diag-3.c
@@ -1,10 +1,10 @@
/* Report invalid extern and __thread combinations. */
/* { dg-require-effective-target tls } */
-extern int j; /* { dg-error "previous declaration" } */
+extern int j; /* { dg-message "note: previous declaration" } */
__thread int j; /* { dg-error "follows non-thread-local" } */
-extern __thread int i; /* { dg-error "previous declaration" } */
+extern __thread int i; /* { dg-message "note: previous declaration" } */
int i; /* { dg-error "follows thread-local" } */
extern __thread int k; /* This is fine. */
diff --git a/gcc/testsuite/gcc.dg/torture/20080716-1.c b/gcc/testsuite/gcc.dg/torture/20080716-1.c
new file mode 100644
index 00000000000..91fcd2b00d3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/20080716-1.c
@@ -0,0 +1,58 @@
+/* { dg-do run } */
+/* { dg-require-effective-target lp64 } */
+
+typedef unsigned long size_t;
+struct tree_base
+{
+ int code;
+};
+struct tree_decl_minimal
+{
+ struct tree_base base;
+ const char *name;
+};
+typedef union tree_node {
+ struct tree_base base;
+ struct tree_decl_minimal decl_minimal;
+} *tree;
+struct tree_overload
+{
+ struct tree_base common;
+ tree function;
+};
+typedef struct VEC_tree_base { unsigned num; unsigned alloc; tree vec[1]; } VEC_tree_base;
+typedef struct VEC_tree_gc { VEC_tree_base base; } VEC_tree_gc;
+static __inline__ unsigned VEC_tree_base_length (const VEC_tree_base *vec_)
+{ return vec_ ? vec_->num : 0; }
+static __inline__ int VEC_tree_base_iterate (const VEC_tree_base *vec_, unsigned ix_, tree *ptr)
+{
+ if (vec_ && ix_ < vec_->num) { *ptr = vec_->vec[ix_]; return 1; } else { *ptr = 0; return 0; }
+}
+extern void abort (void);
+void __attribute__((noinline)) foo (size_t x)
+{
+ if (x != 18446744073709551614UL)
+ abort ();
+}
+void
+resort_type_method_vec (VEC_tree_gc *method_vec)
+{
+ int len = (VEC_tree_base_length(((method_vec) ? &(method_vec)->base : 0)));
+ size_t slot;
+ tree fn;
+
+ for (slot = 2;
+ (VEC_tree_base_iterate(((method_vec) ? &(method_vec)->base : 0),slot,&(fn)));
+ ++slot)
+ if (!(((((((fn)->base.code) == 225) ? (((struct tree_overload*)(fn))->function) : (fn)))->decl_minimal.name)))
+ break;
+
+ if (len - slot > 1)
+ foo (len - slot);
+}
+
+int main ()
+{
+ resort_type_method_vec ((void *)0);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr25183.c b/gcc/testsuite/gcc.dg/torture/pr25183.c
index a6c624cf472..0157b806c7d 100644
--- a/gcc/testsuite/gcc.dg/torture/pr25183.c
+++ b/gcc/testsuite/gcc.dg/torture/pr25183.c
@@ -12,11 +12,11 @@ static enum err E_;
int error()
{
switch (E_) {
- case err_IO : break; /* { dg-warning "overflow" } */
- case err_NM : break; /* { dg-warning "overflow" } */
- case err_EOF : break; /* { dg-warning "overflow" } */
- case err_SE : break; /* { dg-warning "overflow" } */
- case err_PT : break; /* { dg-warning "overflow" } */
+ case err_IO : break;
+ case err_NM : break;
+ case err_EOF : break;
+ case err_SE : break;
+ case err_PT : break;
default : return 0;
}
}
diff --git a/gcc/testsuite/gcc.dg/torture/pr36978.c b/gcc/testsuite/gcc.dg/torture/pr36978.c
new file mode 100644
index 00000000000..cd1af4ebc08
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr36978.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-funswitch-loops" } */
+
+unsigned short status;
+void foo (const _Bool flag)
+{
+ if (status == 2 || status == 7)
+ {
+ while (status != 2 && (status != 7 || !flag))
+ {
+ }
+ }
+}
+
diff --git a/gcc/testsuite/gcc.dg/torture/reassoc-1.c b/gcc/testsuite/gcc.dg/torture/reassoc-1.c
new file mode 100644
index 00000000000..f0c9014cc6e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/reassoc-1.c
@@ -0,0 +1,24 @@
+/* { dg-do run } */
+
+int x;
+
+int __attribute__((noinline))
+foo(int a, int b, int w)
+{
+ int tmp1 = a * w;
+ int tmp2 = b * w;
+ x = tmp1;
+ return tmp1 + tmp2;
+}
+
+extern void abort (void);
+
+int main()
+{
+ if (foo(1, 2, 3) != 9)
+ abort ();
+ if (x != 3)
+ abort ();
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/alloca-1.c b/gcc/testsuite/gcc.dg/torture/stackalign/alloca-1.c
new file mode 100644
index 00000000000..1370f63c292
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/stackalign/alloca-1.c
@@ -0,0 +1,44 @@
+/* { dg-do run } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT 64
+#endif
+
+typedef int aligned __attribute__((aligned(ALIGNMENT)));
+
+int global;
+
+void
+bar (char *p, int size)
+{
+ __builtin_strncpy (p, "good", size);
+}
+
+void
+foo (int size)
+{
+ char *p = __builtin_alloca (size + 1);
+ aligned i;
+
+ bar (p, size);
+ if (__builtin_strncmp (p, "good", size) != 0)
+ {
+#ifdef DEBUG
+ p[size] = '\0';
+ printf ("Failed: %s != good\n", p);
+#endif
+ abort ();
+ }
+
+ if (check_int (&i, __alignof__(i)) != i)
+ abort ();
+}
+
+int
+main()
+{
+ foo (5);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/alloca-2.c b/gcc/testsuite/gcc.dg/torture/stackalign/alloca-2.c
new file mode 100644
index 00000000000..b52dcf06566
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/stackalign/alloca-2.c
@@ -0,0 +1,56 @@
+/* PR middle-end/37009 */
+/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
+/* { dg-options "-msse2" } */
+
+#include <emmintrin.h>
+#include "cpuid.h"
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT 16
+#endif
+
+typedef int aligned __attribute__((aligned(ALIGNMENT)));
+
+void
+bar (char *p, int size)
+{
+ __builtin_strncpy (p, "good", size);
+}
+
+void
+__attribute__ ((noinline))
+foo (__m128 x, __m128 y ,__m128 z , int size)
+{
+ char *p = __builtin_alloca (size + 1);
+ aligned i;
+
+ bar (p, size);
+ if (__builtin_strncmp (p, "good", size) != 0)
+ {
+#ifdef DEBUG
+ p[size] = '\0';
+ printf ("Failed: %s != good\n", p);
+#endif
+ abort ();
+ }
+
+ if (check_int (&i, __alignof__(i)) != i)
+ abort ();
+}
+
+int
+main (void)
+{
+ __m128 x = { 1.0 };
+ unsigned int eax, ebx, ecx, edx;
+
+ if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx))
+ return 0;
+
+ /* Run SSE2 test only if host has SSE2 support. */
+ if (edx & bit_SSE2)
+ foo (x, x, x, 5);
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/alloca-3.c b/gcc/testsuite/gcc.dg/torture/stackalign/alloca-3.c
new file mode 100644
index 00000000000..47f3607c2a5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/stackalign/alloca-3.c
@@ -0,0 +1,56 @@
+/* PR middle-end/37009 */
+/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
+/* { dg-options "-msse2" } */
+
+#include <emmintrin.h>
+#include "cpuid.h"
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT 16
+#endif
+
+typedef int aligned __attribute__((aligned(ALIGNMENT)));
+
+void
+bar (char *p, int size)
+{
+ __builtin_strncpy (p, "good", size);
+}
+
+void
+__attribute__ ((noinline))
+foo (__m128 x, __m128 y ,__m128 z ,__m128 a, int size)
+{
+ char *p = __builtin_alloca (size + 1);
+ aligned i;
+
+ bar (p, size);
+ if (__builtin_strncmp (p, "good", size) != 0)
+ {
+#ifdef DEBUG
+ p[size] = '\0';
+ printf ("Failed: %s != good\n", p);
+#endif
+ abort ();
+ }
+
+ if (check_int (&i, __alignof__(i)) != i)
+ abort ();
+}
+
+int
+main (void)
+{
+ __m128 x = { 1.0 };
+ unsigned int eax, ebx, ecx, edx;
+
+ if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx))
+ return 0;
+
+ /* Run SSE2 test only if host has SSE2 support. */
+ if (edx & bit_SSE2)
+ foo (x, x, x, x, 5);
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/alloca-4.c b/gcc/testsuite/gcc.dg/torture/stackalign/alloca-4.c
new file mode 100644
index 00000000000..0ff0d02c43b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/stackalign/alloca-4.c
@@ -0,0 +1,41 @@
+/* PR middle-end/37009 */
+/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
+/* { dg-options "-m32 -mincoming-stack-boundary=2 -mpreferred-stack-boundary=2" } */
+
+#include "check.h"
+
+void
+bar (char *p, int size)
+{
+ __builtin_strncpy (p, "good", size);
+}
+
+void
+__attribute__ ((noinline))
+foo (double x, double y ,double z ,double a, int size)
+{
+ char *p = __builtin_alloca (size + 1);
+ double i;
+
+ bar (p, size);
+ if (__builtin_strncmp (p, "good", size) != 0)
+ {
+#ifdef DEBUG
+ p[size] = '\0';
+ printf ("Failed: %s != good\n", p);
+#endif
+ abort ();
+ }
+
+ check (&i, __alignof__(i));
+}
+
+int
+main (void)
+{
+ double x = 1.0 ;
+
+ foo (x, x, x, x, 5);
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/builtin-apply-1.c b/gcc/testsuite/gcc.dg/torture/stackalign/builtin-apply-1.c
new file mode 100644
index 00000000000..38b384e7cca
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/stackalign/builtin-apply-1.c
@@ -0,0 +1,9 @@
+/* PR 11184 */
+/* Origin: Dara Hazeghi <dhazeghi@yahoo.com> */
+
+void *
+objc_msg_sendv (char * arg_frame, void (*foo)())
+{
+ return __builtin_apply ( foo, arg_frame, 4);
+}
+
diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/builtin-apply-2.c b/gcc/testsuite/gcc.dg/torture/stackalign/builtin-apply-2.c
new file mode 100644
index 00000000000..a1ba20fce53
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/stackalign/builtin-apply-2.c
@@ -0,0 +1,30 @@
+/* PR target/12503 */
+/* Origin: <pierre.nguyen-tuong@asim.lip6.fr> */
+
+/* Verify that __builtin_apply behaves correctly on targets
+ with pre-pushed arguments (e.g. SPARC). */
+
+/* { dg-do run } */
+
+
+#define INTEGER_ARG 5
+
+extern void abort(void);
+
+void foo(char *name, double d, double e, double f, int g)
+{
+ if (g != INTEGER_ARG)
+ abort();
+}
+
+void bar(char *name, ...)
+{
+ __builtin_apply(foo, __builtin_apply_args(), 64);
+}
+
+int main(void)
+{
+ bar("eeee", 5.444567, 8.90765, 4.567789, INTEGER_ARG);
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/builtin-apply-3.c b/gcc/testsuite/gcc.dg/torture/stackalign/builtin-apply-3.c
new file mode 100644
index 00000000000..1335d09022a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/stackalign/builtin-apply-3.c
@@ -0,0 +1,31 @@
+/* PR middle-end/12210 */
+/* Origin: Ossadchy Yury A. <waspcoder@mail.ru> */
+
+/* This used to fail on i686 because the argument was not copied
+ to the right location by __builtin_apply after the direct call. */
+
+/* { dg-do run } */
+
+
+#define INTEGER_ARG 5
+
+extern void abort(void);
+
+void foo(int arg)
+{
+ if (arg != INTEGER_ARG)
+ abort();
+}
+
+void bar(int arg)
+{
+ foo(arg);
+ __builtin_apply(foo, __builtin_apply_args(), 16);
+}
+
+int main(void)
+{
+ bar(INTEGER_ARG);
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/builtin-apply-4.c b/gcc/testsuite/gcc.dg/torture/stackalign/builtin-apply-4.c
new file mode 100644
index 00000000000..28dc6106d07
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/stackalign/builtin-apply-4.c
@@ -0,0 +1,29 @@
+/* PR tree-optimization/20076 */
+/* { dg-do run } */
+
+extern void abort (void);
+
+double
+foo (int arg)
+{
+ if (arg != 116)
+ abort();
+ return arg + 1;
+}
+
+inline double
+bar (int arg)
+{
+ foo (arg);
+ __builtin_return (__builtin_apply ((void (*) ()) foo,
+ __builtin_apply_args (), 16));
+}
+
+int
+main (int argc, char **argv)
+{
+ if (bar (116) != 117.0)
+ abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/builtin-return-1.c b/gcc/testsuite/gcc.dg/torture/stackalign/builtin-return-1.c
new file mode 100644
index 00000000000..75c9acdf72a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/stackalign/builtin-return-1.c
@@ -0,0 +1,34 @@
+/* PR middle-end/11151 */
+/* Originator: Andrew Church <gcczilla@achurch.org> */
+/* { dg-do run } */
+
+/* This used to fail on SPARC because the (undefined) return
+ value of 'bar' was overwriting that of 'foo'. */
+
+extern void abort(void);
+
+int foo(int n)
+{
+ return n+1;
+}
+
+int bar(int n)
+{
+ __builtin_return(__builtin_apply((void (*)(void))foo, __builtin_apply_args(), 64));
+}
+
+char *g;
+
+int main(void)
+{
+ /* Allocate 64 bytes on the stack to make sure that __builtin_apply
+ can read at least 64 bytes above the return address. */
+ char dummy[64];
+
+ g = dummy;
+
+ if (bar(1) != 2)
+ abort();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/check.h b/gcc/testsuite/gcc.dg/torture/stackalign/check.h
new file mode 100644
index 00000000000..af198851274
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/stackalign/check.h
@@ -0,0 +1,36 @@
+#include <stddef.h>
+#ifdef DEBUG
+#include <stdio.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" void abort (void);
+#else
+extern void abort (void);
+#endif
+
+int
+check_int (int *i, int align)
+{
+ *i = 20;
+ if ((((ptrdiff_t) i) & (align - 1)) != 0)
+ {
+#ifdef DEBUG
+ printf ("\nUnalign address (%d): %p!\n", align, i);
+#endif
+ abort ();
+ }
+ return *i;
+}
+
+void
+check (void *p, int align)
+{
+ if ((((ptrdiff_t) p) & (align - 1)) != 0)
+ {
+#ifdef DEBUG
+ printf ("\nUnalign address (%d): %p!\n", align, p);
+#endif
+ abort ();
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/comp-goto-1.c b/gcc/testsuite/gcc.dg/torture/stackalign/comp-goto-1.c
new file mode 100644
index 00000000000..7558f01e2e8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/stackalign/comp-goto-1.c
@@ -0,0 +1,41 @@
+/* { dg-do run } */
+
+#ifdef STACK_SIZE
+#define DEPTH ((STACK_SIZE) / 512 + 1)
+#else
+#define DEPTH 1000
+#endif
+
+extern void abort (void);
+extern void exit (int);
+
+#if ! defined (NO_LABEL_VALUES) && !defined (NO_TRAMPOLINES)
+int
+x(a)
+{
+ __label__ xlab;
+ void y(a)
+ {
+ void *x = &&llab;
+ if (a==-1)
+ goto *x;
+ if (a==0)
+ goto xlab;
+ llab:
+ y (a-1);
+ }
+ y (a);
+ xlab:;
+ return a;
+}
+#endif
+
+int
+main ()
+{
+#if ! defined (NO_LABEL_VALUES) && !defined (NO_TRAMPOLINES)
+ if (x (DEPTH) != DEPTH)
+ abort ();
+#endif
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/fastcall-1.c b/gcc/testsuite/gcc.dg/torture/stackalign/fastcall-1.c
new file mode 100644
index 00000000000..d1cda10103b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/stackalign/fastcall-1.c
@@ -0,0 +1,31 @@
+/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT 64
+#endif
+
+typedef int aligned __attribute__((aligned(ALIGNMENT)));
+
+int global;
+
+__attribute__ ((fastcall))
+void
+foo (int j, int k, int m, int n, int o)
+{
+ aligned i;
+
+ if (check_int (&i, __alignof__(i)) != i)
+ abort ();
+
+ if (i != 20 || j != 1 || k != 2 || m != 3 || n != 4 || o != 5)
+ abort ();
+}
+
+int
+main()
+{
+ foo (1, 2, 3, 4, 5);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/global-1.c b/gcc/testsuite/gcc.dg/torture/stackalign/global-1.c
new file mode 100644
index 00000000000..284daad0eaf
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/stackalign/global-1.c
@@ -0,0 +1,27 @@
+/* { dg-do run } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT 64
+#endif
+
+typedef int aligned __attribute__((aligned(ALIGNMENT)));
+
+int global;
+
+void
+foo (void)
+{
+ aligned i;
+
+ if (check_int (&i, __alignof__(i)) != i)
+ abort ();
+}
+
+int
+main()
+{
+ foo ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/inline-1.c b/gcc/testsuite/gcc.dg/torture/stackalign/inline-1.c
new file mode 100644
index 00000000000..11e71c60a4c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/stackalign/inline-1.c
@@ -0,0 +1,28 @@
+/* { dg-do run } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT 64
+#endif
+
+typedef int aligned __attribute__((aligned(ALIGNMENT)));
+
+int global;
+
+static void
+inline __attribute__((always_inline))
+foo (void)
+{
+ aligned i;
+
+ if (check_int (&i, __alignof__(i)) != i)
+ abort ();
+}
+
+int
+main()
+{
+ foo ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/inline-2.c b/gcc/testsuite/gcc.dg/torture/stackalign/inline-2.c
new file mode 100644
index 00000000000..fd51b5f7110
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/stackalign/inline-2.c
@@ -0,0 +1,45 @@
+/* { dg-do run } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT 64
+#endif
+
+typedef int aligned __attribute__((aligned(ALIGNMENT)));
+
+int global;
+
+void
+bar (char *p, int size)
+{
+ __builtin_strncpy (p, "good", size);
+}
+
+static void
+inline __attribute__((always_inline))
+foo (int size)
+{
+ char *p = __builtin_alloca (size + 1);
+ aligned i;
+
+ bar (p, size);
+ if (__builtin_strncmp (p, "good", size) != 0)
+ {
+#ifdef DEBUG
+ p[size] = '\0';
+ printf ("Failed: %s != good\n", p);
+#endif
+ abort ();
+ }
+
+ if (check_int (&i, __alignof__(i)) != i)
+ abort ();
+}
+
+int
+main()
+{
+ foo (5);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/nested-1.c b/gcc/testsuite/gcc.dg/torture/stackalign/nested-1.c
new file mode 100644
index 00000000000..4e2c8729af0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/stackalign/nested-1.c
@@ -0,0 +1,44 @@
+/* { dg-do run } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT 64
+#endif
+
+typedef int aligned __attribute__((aligned(ALIGNMENT)));
+
+int global;
+
+void
+foo (void)
+{
+ aligned j;
+
+ void bar ()
+ {
+ aligned i;
+
+ if (check_int (&i, __alignof__(i)) != i)
+ abort ();
+
+ if (check_int (&j, __alignof__(j)) != j)
+ abort ();
+
+ j = -20;
+ }
+ bar ();
+
+ if (j != -20)
+ abort ();
+
+ if (check_int (&j, __alignof__(j)) != j)
+ abort ();
+}
+
+int
+main()
+{
+ foo ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/nested-2.c b/gcc/testsuite/gcc.dg/torture/stackalign/nested-2.c
new file mode 100644
index 00000000000..d54e3b92c9f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/stackalign/nested-2.c
@@ -0,0 +1,45 @@
+/* { dg-do run } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT 64
+#endif
+
+typedef int aligned __attribute__((aligned(ALIGNMENT)));
+
+int global;
+
+void
+foo (void)
+{
+ aligned j;
+
+ __attribute__ ((__noinline__))
+ void bar ()
+ {
+ aligned i;
+
+ if (check_int (&i, __alignof__(i)) != i)
+ abort ();
+
+ if (check_int (&j, __alignof__(j)) != j)
+ abort ();
+
+ j = -20;
+ }
+ bar ();
+
+ if (j != -20)
+ abort ();
+
+ if (check_int (&j, __alignof__(j)) != j)
+ abort ();
+}
+
+int
+main()
+{
+ foo ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/nested-3.c b/gcc/testsuite/gcc.dg/torture/stackalign/nested-3.c
new file mode 100644
index 00000000000..373299185a8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/stackalign/nested-3.c
@@ -0,0 +1,62 @@
+/* { dg-do run } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT 64
+#endif
+
+typedef int aligned __attribute__((aligned(ALIGNMENT)));
+
+int global;
+
+void
+copy (char *p, int size)
+{
+ __builtin_strncpy (p, "good", size);
+}
+
+void
+foo (int size)
+{
+ aligned j;
+
+ __attribute__ ((__noinline__))
+ void bar (int size)
+ {
+ char *p = __builtin_alloca (size + 1);
+ aligned i;
+
+ copy (p, size);
+ if (strncmp (p, "good", size) != 0)
+ {
+#ifdef DEBUG
+ p[size] = '\0';
+ printf ("Failed: %s != good\n", p);
+#endif
+ abort ();
+ }
+
+ if (check_int (&i, __alignof__(i)) != i)
+ abort ();
+
+ if (check_int (&j, __alignof__(j)) != j)
+ abort ();
+
+ j = -20;
+ }
+ bar (size);
+
+ if (j != -20)
+ abort ();
+
+ if (check_int (&j, __alignof__(j)) != j)
+ abort ();
+}
+
+int
+main()
+{
+ foo (5);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/nested-4.c b/gcc/testsuite/gcc.dg/torture/stackalign/nested-4.c
new file mode 100644
index 00000000000..60322fc62b6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/stackalign/nested-4.c
@@ -0,0 +1,33 @@
+/* { dg-do run } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT 64
+#endif
+
+typedef int aligned __attribute__((aligned(ALIGNMENT)));
+
+int n;
+
+void
+g (void)
+{
+ __label__ lab;
+ void h (void)
+ {
+ aligned t;
+ if (check_int (&t, __alignof__(t)) != t)
+ abort ();
+ if (n+t == 0) goto lab;
+ }
+ h();
+lab:
+ return;
+}
+
+int main()
+{
+ g();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/nested-5.c b/gcc/testsuite/gcc.dg/torture/stackalign/nested-5.c
new file mode 100644
index 00000000000..95eba0482f6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/stackalign/nested-5.c
@@ -0,0 +1,38 @@
+/* { dg-do run } */
+
+extern void abort (void);
+extern void exit (int);
+
+#ifndef NO_TRAMPOLINES
+static void recursive (int n, void (*proc) (void))
+{
+ __label__ l1;
+
+ void do_goto (void)
+ {
+ goto l1;
+ }
+
+ if (n == 3)
+ recursive (n - 1, do_goto);
+ else if (n > 0)
+ recursive (n - 1, proc);
+ else
+ (*proc) ();
+ return;
+
+l1:
+ if (n == 3)
+ exit (0);
+ else
+ abort ();
+}
+
+int main ()
+{
+ recursive (10, abort);
+ abort ();
+}
+#else
+int main () { return 0; }
+#endif
diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/nested-6.c b/gcc/testsuite/gcc.dg/torture/stackalign/nested-6.c
new file mode 100644
index 00000000000..d853825feb7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/stackalign/nested-6.c
@@ -0,0 +1,28 @@
+/* { dg-do run } */
+
+#ifndef NO_TRAMPOLINES
+
+typedef __SIZE_TYPE__ size_t;
+extern void abort (void);
+extern void exit (int);
+extern void qsort(void *, size_t, size_t, int (*)(const void *, const void *));
+
+int main ()
+{
+ __label__ nonlocal;
+ int compare (const void *a, const void *b)
+ {
+ goto nonlocal;
+ }
+
+ char array[3];
+ qsort (array, 3, 1, compare);
+ abort ();
+
+ nonlocal:
+ exit (0);
+}
+
+#else
+int main() { return 0; }
+#endif
diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/non-local-goto-1.c b/gcc/testsuite/gcc.dg/torture/stackalign/non-local-goto-1.c
new file mode 100644
index 00000000000..263d4486cf7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/stackalign/non-local-goto-1.c
@@ -0,0 +1,55 @@
+/* { dg-do run } */
+
+extern void abort (void);
+
+int global;
+
+static void foo(void) __attribute__((noinline));
+
+static void foo(void)
+{
+ global = 1;
+}
+
+static void bar(void)
+{
+ foo ();
+}
+
+int execute(int cmd)
+{
+ __label__ start;
+
+ void raise(void)
+ {
+ goto start;
+ }
+
+ int last = -1;
+
+ bar ();
+
+ last = 0;
+
+start:
+
+ if (last == 0)
+ while (1)
+ {
+ last = 1;
+ raise ();
+ }
+
+ if (last == 0)
+ return 0;
+ else
+ return cmd;
+}
+
+int main(void)
+{
+ if (execute (1) == 0)
+ abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/non-local-goto-2.c b/gcc/testsuite/gcc.dg/torture/stackalign/non-local-goto-2.c
new file mode 100644
index 00000000000..5a64d541964
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/stackalign/non-local-goto-2.c
@@ -0,0 +1,56 @@
+/* { dg-do run } */
+
+extern void abort (void);
+
+int global;
+
+static void foo(void) __attribute__((noinline));
+
+static void foo(void)
+{
+ global = 1;
+}
+
+static void bar(void)
+{
+ foo ();
+ global = 0;
+}
+
+int execute(int cmd)
+{
+ __label__ start;
+
+ void raise(void)
+ {
+ goto start;
+ }
+
+ int last = -1;
+
+ bar ();
+
+ last = 0;
+
+start:
+
+ if (last == 0)
+ while (1)
+ {
+ last = 1;
+ raise ();
+ }
+
+ if (last == 0)
+ return 0;
+ else
+ return cmd;
+}
+
+int main(void)
+{
+ if (execute (1) == 0)
+ abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/non-local-goto-3.c b/gcc/testsuite/gcc.dg/torture/stackalign/non-local-goto-3.c
new file mode 100644
index 00000000000..3afc8cc6a31
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/stackalign/non-local-goto-3.c
@@ -0,0 +1,42 @@
+/* { dg-do run } */
+
+#ifndef NO_TRAMPOLINES
+extern void abort (void);
+
+int x(int a, int b)
+{
+ __label__ xlab;
+
+ void y(int b)
+ {
+ switch (b)
+ {
+ case 1: goto xlab;
+ case 2: goto xlab;
+ }
+ }
+
+ a = a + 2;
+ y (b);
+
+ xlab:
+ return a;
+}
+
+int main ()
+{
+ int i, j;
+
+ for (j = 1; j <= 2; ++j)
+ for (i = 1; i <= 2; ++i)
+ {
+ int a = x (j, i);
+ if (a != 2 + j)
+ abort ();
+ }
+
+ return 0;
+}
+#else
+int main() { return 0; }
+#endif
diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/non-local-goto-4.c b/gcc/testsuite/gcc.dg/torture/stackalign/non-local-goto-4.c
new file mode 100644
index 00000000000..3673f1ac337
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/stackalign/non-local-goto-4.c
@@ -0,0 +1,38 @@
+/* { dg-do run } */
+
+extern void abort (void);
+extern void exit (int);
+
+#ifdef STACK_SIZE
+#define DEPTH ((STACK_SIZE) / 512 + 1)
+#else
+#define DEPTH 1000
+#endif
+
+#if ! defined (NO_LABEL_VALUES) && !defined (NO_TRAMPOLINES)
+int
+
+x(a)
+{
+ __label__ xlab;
+ void y(a)
+ {
+ if (a==0)
+ goto xlab;
+ y (a-1);
+ }
+ y (a);
+ xlab:;
+ return a;
+}
+#endif
+
+int
+main ()
+{
+#if ! defined (NO_LABEL_VALUES) && !defined (NO_TRAMPOLINES)
+ if (x (DEPTH) != DEPTH)
+ abort ();
+#endif
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/non-local-goto-5.c b/gcc/testsuite/gcc.dg/torture/stackalign/non-local-goto-5.c
new file mode 100644
index 00000000000..08ca95d765c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/stackalign/non-local-goto-5.c
@@ -0,0 +1,11 @@
+/* { dg-do run } */
+
+#if !defined (NO_LABEL_VALUES) && !defined (NO_TRAMPOLINES)
+extern void abort (void);
+extern void exit (int);
+int s(i){if(i>0){__label__ l1;int f(int i){if(i==2)goto l1;return 0;}return f(i);l1:;}return 1;}
+int x(){return s(0)==1&&s(1)==0&&s(2)==1;}
+int main(){if(x()!=1)abort();exit(0);}
+#else
+int main(){ exit (0); }
+#endif
diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/pr16660-1.c b/gcc/testsuite/gcc.dg/torture/stackalign/pr16660-1.c
new file mode 100644
index 00000000000..1bff181c24b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/stackalign/pr16660-1.c
@@ -0,0 +1,17 @@
+/* { dg-do run } */
+
+#include "check.h"
+
+void
+f ()
+{
+ unsigned long tmp[4] __attribute__((aligned(64)));
+ check (&tmp, 64);
+}
+
+int
+main()
+{
+ f();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/pr16660-2.c b/gcc/testsuite/gcc.dg/torture/stackalign/pr16660-2.c
new file mode 100644
index 00000000000..9a039eb2bf5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/stackalign/pr16660-2.c
@@ -0,0 +1,12 @@
+/* { dg-do run } */
+
+#include "check.h"
+
+typedef __SIZE_TYPE__ size_t;
+#define ALIGNMENT 256
+int main(void)
+{
+ int a[ALIGNMENT/sizeof(int)] __attribute__((aligned(ALIGNMENT)));
+ check (&a, ALIGNMENT);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/pr16660-3.c b/gcc/testsuite/gcc.dg/torture/stackalign/pr16660-3.c
new file mode 100644
index 00000000000..1c1ddd1dd74
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/stackalign/pr16660-3.c
@@ -0,0 +1,14 @@
+/* { dg-do run } */
+
+#include "check.h"
+
+typedef __SIZE_TYPE__ size_t;
+#define ALIGNMENT 256
+int main(void)
+{
+ int a[ALIGNMENT/sizeof(int)] __attribute__((aligned(ALIGNMENT)));
+ check (&a, ALIGNMENT);
+ int b[ALIGNMENT/sizeof(int)] __attribute__((aligned(ALIGNMENT)));
+ check (&b, ALIGNMENT);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/push-1.c b/gcc/testsuite/gcc.dg/torture/stackalign/push-1.c
new file mode 100644
index 00000000000..7417324e4bb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/stackalign/push-1.c
@@ -0,0 +1,59 @@
+/* PR middle-end/37010 */
+/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
+/* { dg-options "-msse2 -mpreferred-stack-boundary=2" } */
+
+#include <emmintrin.h>
+#include "cpuid.h"
+
+typedef __PTRDIFF_TYPE__ ptrdiff_t;
+typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__));
+typedef int aligned __attribute__((aligned(16)));
+
+extern void abort (void);
+
+__m128 r;
+
+int
+__attribute__ ((noinline))
+check_int (int *i, int align)
+{
+ *i = 20;
+ if ((((ptrdiff_t) i) & (align - 1)) != 0)
+ {
+ abort ();
+ }
+ return *i;
+}
+
+void
+__attribute__ ((noinline))
+foo (__m128 x, __m128 y ,__m128 z ,__m128 a, int size)
+{
+ aligned i;
+
+ if (size != 5 || check_int (&i, __alignof__(i)) != i)
+ abort ();
+
+ r = a;
+}
+
+int
+main (void)
+{
+ __m128 x = { 1.0 };
+ unsigned int eax, ebx, ecx, edx;
+
+ if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx))
+ return 0;
+
+ /* Run SSE2 test only if host has SSE2 support. */
+ if (edx & bit_SSE2)
+ {
+ foo (x, x, x, x, 5);
+
+ if (__builtin_memcmp (&r, &x, sizeof (r)))
+ abort ();
+ }
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/regparm-1.c b/gcc/testsuite/gcc.dg/torture/stackalign/regparm-1.c
new file mode 100644
index 00000000000..9dac024cc1b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/stackalign/regparm-1.c
@@ -0,0 +1,60 @@
+/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT 64
+#endif
+
+typedef int aligned __attribute__((aligned(ALIGNMENT)));
+
+int test_nested (int i)
+{
+ aligned y;
+
+ int __attribute__ ((__noinline__, __regparm__(2))) foo (int j, int k, int l)
+ {
+ aligned x;
+
+ if (check_int (&x, __alignof__(x)) != x)
+ abort ();
+
+ if (x != 20)
+ abort ();
+
+ return i + j + k + l;
+ }
+
+ if (check_int (&y, __alignof__(y)) != y)
+ abort ();
+
+ if (y != 20)
+ abort ();
+
+ return foo(i, i+1, i+2) * i;
+}
+
+int __attribute__ ((__noinline__, __regparm__(3), __force_align_arg_pointer__))
+test_realigned (int j, int k, int l)
+{
+ aligned y;
+
+ if (check_int (&y, __alignof__(y)) != y)
+ abort ();
+
+ if (y != 20)
+ abort ();
+
+ return j + k + l;
+}
+
+int main ()
+{
+ if (test_nested(10) != 430)
+ abort ();
+
+ if (test_realigned(10, 11, 12) != 33)
+ abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/ret-struct-1.c b/gcc/testsuite/gcc.dg/torture/stackalign/ret-struct-1.c
new file mode 100644
index 00000000000..163e54c5908
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/stackalign/ret-struct-1.c
@@ -0,0 +1,34 @@
+/* { dg-do run } */
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT 64
+#endif
+
+extern void abort();
+typedef struct my_struct
+{
+ char str[31];
+} stype ;
+
+stype g_s;
+
+stype __attribute__((noinline))
+foo (char arg1, char arg2, char arg3)
+{
+ stype __attribute__((aligned(ALIGNMENT))) s;
+ s.str[0] = arg1;
+ s.str[1] = arg2;
+ s.str[30] = arg3;
+ check(&s, ALIGNMENT);
+ return s;
+}
+
+int main()
+{
+ g_s = foo(1,2,3);
+
+ if (g_s.str[0] != 1 || g_s.str[1] != 2 || g_s.str[30] !=3)
+ abort();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/setjmp-1.c b/gcc/testsuite/gcc.dg/torture/stackalign/setjmp-1.c
new file mode 100644
index 00000000000..6ab67e395fb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/stackalign/setjmp-1.c
@@ -0,0 +1,43 @@
+/* { dg-do run } */
+
+extern int strcmp(const char *, const char *);
+extern char *strcpy(char *, const char *);
+extern void abort(void);
+extern void exit(int);
+
+void *buf[20];
+
+void __attribute__((noinline))
+sub2 (void)
+{
+ __builtin_longjmp (buf, 1);
+}
+
+int
+main ()
+{
+ char *p = 0;
+
+ p = (char *) __builtin_alloca (20);
+
+ strcpy (p, "test");
+
+ if (__builtin_setjmp (buf))
+ {
+ if (strcmp (p, "test") != 0)
+ abort ();
+
+ exit (0);
+ }
+
+ {
+ int *q = (int *) __builtin_alloca (p[2] * sizeof (int));
+ int i;
+
+ for (i = 0; i < p[2]; i++)
+ q[i] = 0;
+
+ while (1)
+ sub2 ();
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/setjmp-2.c b/gcc/testsuite/gcc.dg/torture/stackalign/setjmp-2.c
new file mode 100644
index 00000000000..c93ffa8673e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/stackalign/setjmp-2.c
@@ -0,0 +1,46 @@
+/* { dg-do run { target i?86-*-linux* x86_64-*-linux* } } */
+
+#include <setjmp.h>
+#include <signal.h>
+
+#ifndef NULL
+#define NULL ((void *)0)
+#endif
+static jmp_buf segv_jmpbuf;
+
+static void segv_handler(int seg)
+{
+ __builtin_longjmp(segv_jmpbuf, 1);
+}
+
+static int is_addressable(void *p, size_t size)
+{
+ volatile char * volatile cp = (volatile char *)p;
+ volatile int ret;
+ struct sigaction sa, origsa;
+ sigset_t mask;
+
+ sa.sa_handler = segv_handler;
+ sa.sa_flags = 0;
+ sigfillset(&sa.sa_mask);
+ sigaction(SIGSEGV, &sa, &origsa);
+ sigprocmask(SIG_SETMASK, NULL, &mask);
+
+ if (__builtin_setjmp(segv_jmpbuf) == 0) {
+ while(size--)
+ *cp++;
+ ret = 1;
+ } else
+ ret = 0;
+
+ sigaction(SIGSEGV, &origsa, NULL);
+ sigprocmask(SIG_SETMASK, &mask, NULL);
+
+ return ret;
+}
+
+int main(int argc, char **argv)
+{
+ is_addressable(0x0, 1);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/setjmp-3.c b/gcc/testsuite/gcc.dg/torture/stackalign/setjmp-3.c
new file mode 100644
index 00000000000..fee0d281ffa
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/stackalign/setjmp-3.c
@@ -0,0 +1,37 @@
+/* { dg-do run } */
+
+#include <setjmp.h>
+
+extern void abort (void);
+
+jmp_buf buf;
+
+void raise0(void)
+{
+ __builtin_longjmp (buf, 1);
+}
+
+int execute(int cmd)
+{
+ int last = 0;
+
+ if (__builtin_setjmp (buf) == 0)
+ while (1)
+ {
+ last = 1;
+ raise0 ();
+ }
+
+ if (last == 0)
+ return 0;
+ else
+ return cmd;
+}
+
+int main(void)
+{
+ if (execute (1) == 0)
+ abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/setjmp-4.c b/gcc/testsuite/gcc.dg/torture/stackalign/setjmp-4.c
new file mode 100644
index 00000000000..d1671223adb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/stackalign/setjmp-4.c
@@ -0,0 +1,39 @@
+/* { dg-do run } */
+
+#include <setjmp.h>
+
+extern void abort (void);
+
+jmp_buf buf;
+
+void raise0(void)
+{
+ __builtin_longjmp (buf, 1);
+}
+
+int execute(int cmd)
+{
+ int last = 0;
+
+ __builtin_setjmp (buf);
+
+ if (last == 0)
+ while (1)
+ {
+ last = 1;
+ raise0 ();
+ }
+
+ if (last == 0)
+ return 0;
+ else
+ return cmd;
+}
+
+int main(void)
+{
+ if (execute (1) == 0)
+ abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/sibcall-1.c b/gcc/testsuite/gcc.dg/torture/stackalign/sibcall-1.c
new file mode 100644
index 00000000000..8c174758fc1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/stackalign/sibcall-1.c
@@ -0,0 +1,35 @@
+/* { dg-do run } */
+
+extern int ok (int);
+extern void exit ();
+static int gen_x86_64_shrd (int);
+static int
+gen_x86_64_shrd(int a __attribute__ ((__unused__)))
+{
+ return 0;
+}
+
+extern int gen_x86_shrd_1 (int);
+extern void ix86_split_ashr (int);
+
+void
+ix86_split_ashr (int mode)
+{
+ (mode != 0
+ ? ok
+ : gen_x86_64_shrd) (0);
+}
+
+volatile int one = 1;
+int
+main (void)
+{
+ ix86_split_ashr (one);
+ return 1;
+}
+
+int
+ok (int i)
+{
+ exit (i);
+}
diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/stackalign.exp b/gcc/testsuite/gcc.dg/torture/stackalign/stackalign.exp
new file mode 100644
index 00000000000..3574e4dc891
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/stackalign/stackalign.exp
@@ -0,0 +1,52 @@
+# Copyright (C) 2008
+# Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# This harness is for tests that should be run at all optimisation levels.
+
+load_lib gcc-dg.exp
+
+# Only run on targets which support automatic stack alignment.
+if { ![check_effective_target_automatic_stack_alignment] } then {
+ return
+}
+
+set additional_flags ""
+if { [istarget i?86*-*-*] || [istarget x86_64-*-*] } then {
+ lappend additional_flags "-mstackrealign"
+ lappend additional_flags "-mpreferred-stack-boundary=5"
+}
+
+dg-init
+
+gcc-dg-runtest [lsort [glob $srcdir/$subdir/*.c]] $additional_flags
+if { [check_effective_target_fpic] } then {
+ set pic_additional_flags $additional_flags
+ lappend pic_additional_flags "-fpic"
+ gcc-dg-runtest [lsort [glob $srcdir/$subdir/*.c]] $pic_additional_flags
+}
+
+if { [istarget i?86*-*-*] || [istarget x86_64-*-*] } then {
+ lappend additional_flags "-mforce-drap"
+ gcc-dg-runtest [lsort [glob $srcdir/$subdir/*.c]] $additional_flags
+ if { [check_effective_target_fpic] } then {
+ set pic_additional_flags $additional_flags
+ lappend pic_additional_flags "-fpic"
+ gcc-dg-runtest [lsort [glob $srcdir/$subdir/*.c]] $pic_additional_flags
+ }
+}
+
+dg-finish
diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/struct-1.c b/gcc/testsuite/gcc.dg/torture/stackalign/struct-1.c
new file mode 100644
index 00000000000..79e3733484b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/stackalign/struct-1.c
@@ -0,0 +1,28 @@
+/* { dg-do run } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT 64
+#endif
+
+typedef int aligned __attribute__((aligned(ALIGNMENT)));
+
+void
+foo (void)
+{
+ struct i
+ {
+ aligned i;
+ } i;
+
+ if (check_int (&i.i, __alignof__(i.i)) != i.i)
+ abort ();
+}
+
+int
+main()
+{
+ foo ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/vararg-1.c b/gcc/testsuite/gcc.dg/torture/stackalign/vararg-1.c
new file mode 100644
index 00000000000..62b236522ec
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/stackalign/vararg-1.c
@@ -0,0 +1,59 @@
+/* { dg-do run } */
+
+#include <stdarg.h>
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT 64
+#endif
+
+typedef int aligned __attribute__((aligned(ALIGNMENT)));
+
+int global;
+
+void
+bar (char *p, int size)
+{
+ __builtin_strncpy (p, "good", size);
+}
+
+void
+foo (const char *fmt, ...)
+{
+ va_list arg;
+ char *p;
+ aligned i;
+ int size;
+ double x;
+
+ va_start (arg, fmt);
+ size = va_arg (arg, int);
+ if (size != 5)
+ abort ();
+ p = __builtin_alloca (size + 1);
+
+ x = va_arg (arg, double);
+ if (x != 5.0)
+ abort ();
+
+ bar (p, size);
+ if (__builtin_strncmp (p, "good", size) != 0)
+ {
+#ifdef DEBUG
+ p[size] = '\0';
+ printf ("Failed: %s != good\n", p);
+#endif
+ abort ();
+ }
+
+ if (check_int (&i, __alignof__(i)) != i)
+ abort ();
+ va_end (arg);
+}
+
+int
+main()
+{
+ foo ("foo", 5, 5.0);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/vararg-2.c b/gcc/testsuite/gcc.dg/torture/stackalign/vararg-2.c
new file mode 100644
index 00000000000..00b723b0dc4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/stackalign/vararg-2.c
@@ -0,0 +1,65 @@
+/* { dg-do run } */
+
+#include <stdarg.h>
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT 64
+#endif
+
+typedef int aligned __attribute__((aligned(ALIGNMENT)));
+
+int global;
+
+void
+bar (char *p, int size)
+{
+ __builtin_strncpy (p, "good", size);
+}
+
+void
+test (va_list arg)
+{
+ char *p;
+ aligned i;
+ int size;
+ double x;
+
+ size = va_arg (arg, int);
+ if (size != 5)
+ abort ();
+
+ p = __builtin_alloca (size + 1);
+
+ x = va_arg (arg, double);
+ if (x != 5.0)
+ abort ();
+
+ bar (p, size);
+ if (__builtin_strncmp (p, "good", size) != 0)
+ {
+#ifdef DEBUG
+ p[size] = '\0';
+ printf ("Failed: %s != good\n", p);
+#endif
+ abort ();
+ }
+
+ if (check_int (&i, __alignof__(i)) != i)
+ abort ();
+}
+
+void
+foo (const char *fmt, ...)
+{
+ va_list arg;
+ va_start (arg, fmt);
+ test (arg);
+ va_end (arg);
+}
+int
+main()
+{
+ foo ("foo", 5, 5.0);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/vararg-3.c b/gcc/testsuite/gcc.dg/torture/stackalign/vararg-3.c
new file mode 100644
index 00000000000..cac206499ed
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/stackalign/vararg-3.c
@@ -0,0 +1,84 @@
+/* PR middle-end/37009 */
+/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
+/* { dg-options "-msse2" } */
+
+#include <stdarg.h>
+#include <emmintrin.h>
+#include "cpuid.h"
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT 16
+#endif
+
+typedef int aligned __attribute__((aligned(ALIGNMENT)));
+
+void
+bar (char *p, int size)
+{
+ __builtin_strncpy (p, "good", size);
+}
+
+__m128 a = { 1.0 };
+
+void
+test (va_list arg)
+{
+ char *p;
+ aligned i;
+ int size;
+ double x;
+ __m128 e;
+
+ size = va_arg (arg, int);
+ if (size != 5)
+ abort ();
+
+ p = __builtin_alloca (size + 1);
+
+ x = va_arg (arg, double);
+ if (x != 5.0)
+ abort ();
+
+ bar (p, size);
+ if (__builtin_strncmp (p, "good", size) != 0)
+ {
+#ifdef DEBUG
+ p[size] = '\0';
+ printf ("Failed: %s != good\n", p);
+#endif
+ abort ();
+ }
+
+ if (check_int (&i, __alignof__(i)) != i)
+ abort ();
+
+ e = va_arg (arg, __m128);
+ if (__builtin_memcmp (&e, &a, sizeof (e)))
+ abort ();
+}
+
+void
+foo (const char *fmt, ...)
+{
+ va_list arg;
+ va_start (arg, fmt);
+ test (arg);
+ va_end (arg);
+}
+
+int
+main (void)
+{
+ __m128 x = { 1.0 };
+ unsigned int eax, ebx, ecx, edx;
+
+ if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx))
+ return 0;
+
+ /* Run SSE2 test only if host has SSE2 support. */
+ if (edx & bit_SSE2)
+ foo ("foo", 5, 5.0, x);
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/transparent-union-2.c b/gcc/testsuite/gcc.dg/transparent-union-2.c
index f466c4aa2be..09fbb4d9722 100644
--- a/gcc/testsuite/gcc.dg/transparent-union-2.c
+++ b/gcc/testsuite/gcc.dg/transparent-union-2.c
@@ -5,14 +5,14 @@
typedef union { int *i; long *l; } U
__attribute__((transparent_union));
-extern void f0 (U); /* { dg-error "previous declaration" } */
+extern void f0 (U); /* { dg-message "note: previous declaration" } */
extern void f0 (void *); /* { dg-error "conflicting types" } */
-extern void f1 (U); /* { dg-error "previous declaration" } */
+extern void f1 (U); /* { dg-message "note: previous declaration" } */
extern void f1 (unsigned long); /* { dg-error "conflicting types" } */
-extern void f2 (void *); /* { dg-error "previous declaration" } */
+extern void f2 (void *); /* { dg-message "note: previous declaration" } */
extern void f2 (U); /* { dg-error "conflicting types" } */
-extern void f3 (unsigned long); /* { dg-error "previous declaration" } */
+extern void f3 (unsigned long); /* { dg-message "note: previous declaration" } */
extern void f3 (U); /* { dg-error "conflicting types" } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/20030728-1.c b/gcc/testsuite/gcc.dg/tree-ssa/20030728-1.c
index 3b1ace80f39..1ad2c63653c 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/20030728-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/20030728-1.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-optimized" } */
+/* { dg-options "-O2 -fdump-tree-final_cleanup" } */
union tree_node;
@@ -42,6 +42,6 @@ objects_must_conflict_p (t1, t2)
}
/* There should be two assignments of variables to the value zero. */
-/* { dg-final { scan-tree-dump-times " = 0" 2 "optimized"} } */
+/* { dg-final { scan-tree-dump-times " = 0" 2 "final_cleanup"} } */
-/* { dg-final { cleanup-tree-dump "optimized" } } */
+/* { dg-final { cleanup-tree-dump "final_cleanup" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/20080530.c b/gcc/testsuite/gcc.dg/tree-ssa/20080530.c
new file mode 100644
index 00000000000..6da7cb8a03a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/20080530.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-einline" } */
+
+void bar (char *);
+int i;
+
+static void
+foo (void)
+{
+ char *p = __builtin_alloca (i);
+ bar (p);
+}
+
+int
+baz (void)
+{
+ foo (); /* foo() should not be inlined here because it calls alloca */
+ return 6;
+}
+
+/* { dg-final { scan-tree-dump-times "Inlining foo into baz" 0 "einline2"} } */
+/* { dg-final { cleanup-tree-dump "einline2" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/data-dep-1.c b/gcc/testsuite/gcc.dg/tree-ssa/data-dep-1.c
index 5eb71d9be9e..92b60999495 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/data-dep-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/data-dep-1.c
@@ -25,5 +25,5 @@ int foo (int n, int m)
outermost "k" loop: the 4 comes from the instantiation of the
number of iterations of loop "j". */
-/* { dg-final { scan-tree-dump-times "4, \\+, 1" 0 "ltrans" } } */
+/* { dg-final { scan-tree-dump-times "4, \\+, 1" 0 "ltrans" { xfail *-*-* } } } */
/* { dg-final { cleanup-tree-dump "ltrans" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/inline-2.c b/gcc/testsuite/gcc.dg/tree-ssa/inline-2.c
new file mode 100644
index 00000000000..8a7b9070de5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/inline-2.c
@@ -0,0 +1,17 @@
+/* { dg-do link } */
+/* { dg-options "-O" } */
+
+/* When optimized we expect the call to foo () in bar to be inlined
+ and the call to link_error optimized away. */
+
+extern void link_error (void);
+int __attribute__((always_inline)) foo(void) { return 0; }
+
+int main()
+{
+ int (*fn)(void) = foo;
+ if (fn())
+ link_error ();
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/loadpre1.c b/gcc/testsuite/gcc.dg/tree-ssa/loadpre1.c
index d3264367db8..e26fa9302b4 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/loadpre1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/loadpre1.c
@@ -14,5 +14,5 @@ int main(int *a, int argc)
e = *a;
return d + e;
}
-/* { dg-final { scan-tree-dump-times "Eliminated: 1" 1 "pre" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump-times "Eliminated: 1" 1 "pre" } } */
/* { dg-final { cleanup-tree-dump "pre" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr21658.c b/gcc/testsuite/gcc.dg/tree-ssa/pr21658.c
index 577e1795e74..d7b72f9f754 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr21658.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr21658.c
@@ -17,5 +17,5 @@ f (void)
link_error ();
}
-/* { dg-final { scan-tree-dump-times "Folded statement: if " 1 "ccp1"} } */
+/* { dg-final { scan-tree-dump-times "Folded into: if " 1 "ccp1"} } */
/* { dg-final { cleanup-tree-dump "ccp\[1-2\]" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr30375.c b/gcc/testsuite/gcc.dg/tree-ssa/pr30375.c
index 33c3f5c530c..50b3bfd565a 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr30375.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr30375.c
@@ -22,5 +22,5 @@ void test_signed_msg_encoding(void)
f();
}
-/* { dg-final { scan-tree-dump-times "signInfo = {};" 1 "dse1" } } */
+/* { dg-final { scan-tree-dump-times "signInfo = {}" 1 "dse1" } } */
/* { dg-final { cleanup-tree-dump "dse*" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-14.c b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-14.c
new file mode 100644
index 00000000000..24141ef34e3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-14.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-reassoc1" } */
+
+int test1 (int x, int y, int z, int weight)
+{
+ int tmp1 = x * weight;
+ int tmp2 = y * weight;
+ int tmp3 = (x - y) * weight;
+ return tmp1 + (tmp2 + tmp3);
+}
+
+int test2 (int x, int y, int z, int weight)
+{
+ int tmp1 = x * weight;
+ int tmp2 = y * weight * weight;
+ int tmp3 = z * weight * weight * weight;
+ return tmp1 + tmp2 + tmp3;
+}
+
+/* There should be one multiplication left in test1 and three in test2. */
+
+/* { dg-final { scan-tree-dump-times "\\\*" 4 "reassoc1" } } */
+/* { dg-final { cleanup-tree-dump "reassoc1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-15.c b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-15.c
new file mode 100644
index 00000000000..d9b74d27785
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-15.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-reassoc1" } */
+
+int test3 (int x, int y, int z, int weight, int w1, int w2, int w3)
+{
+ int wtmp1 = w1 * weight;
+ int wtmp2 = w2 * weight;
+ int wtmp3 = w3 * weight;
+ int tmp1 = x * wtmp1;
+ int tmp2 = y * wtmp2;
+ int tmp3 = z * wtmp3;
+ return tmp1 + tmp2 + tmp3;
+}
+
+/* The multiplication with weight should be un-distributed.
+ ??? This pattern is not recognized currently. */
+
+/* { dg-final { scan-tree-dump-times "\\\*" 4 "reassoc1" } } */
+/* { dg-final { cleanup-tree-dump "reassoc1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-16.c b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-16.c
new file mode 100644
index 00000000000..4dd54a8cba9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-16.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -ffast-math -fdump-tree-reassoc1" } */
+
+double test1 (double x, double y, double z, double weight)
+{
+ double tmp1 = x / weight;
+ double tmp2 = y / weight;
+ double tmp3 = -x / weight;
+ return tmp1 + tmp2 + tmp3;
+}
+
+/* The division should be un-distributed and all references to x should
+ be gone. */
+
+/* { dg-final { scan-tree-dump-times "/" 1 "reassoc1" } } */
+/* { dg-final { cleanup-tree-dump "reassoc1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-17.c b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-17.c
new file mode 100644
index 00000000000..255c786d737
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-17.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -ffast-math -fdump-tree-reassoc1" } */
+
+double test2 (double x, double y, double ddj, int b)
+{
+ double tmp1, tmp2, sum;
+ sum = 0.0;
+ if (b)
+ sum = 1.0;
+ tmp1 = sum/ddj;
+ tmp2 = x/ddj;
+ return tmp1 + y + tmp2;
+}
+
+/* { dg-final { scan-tree-dump-times "/" 1 "reassoc1" } } */
+/* { dg-final { cleanup-tree-dump "reassoc1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-18.c b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-18.c
new file mode 100644
index 00000000000..ce52cd0d04e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-18.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fdump-tree-reassoc1" } */
+
+int
+ETree_nFactorEntriesInFront (int b, int m)
+{
+ int nent = b*b + 2*b*m;
+ return nent;
+}
+
+/* { dg-final { scan-tree-dump-times "\\\*" 2 "reassoc1" } } */
+/* { dg-final { cleanup-tree-dump "reassoc1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-3.c b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-3.c
index 6103c400ecb..178e6a44822 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-3.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-3.c
@@ -1,3 +1,4 @@
+/* { dg-options "" } */
int main(int a, int b, int c, int d)
{
int e = (a & ~b) & (~c & d);
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/recip-2.c b/gcc/testsuite/gcc.dg/tree-ssa/recip-2.c
index af628053ad5..be754145e7d 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/recip-2.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/recip-2.c
@@ -1,7 +1,9 @@
/* { dg-do compile } */
/* { dg-options "-O1 -funsafe-math-optimizations -fdump-tree-recip" } */
-float e(float a, float b, float c, float d, float e, float f)
+float u, v, w, x, y, z;
+
+void e(float a, float b, float c, float d, float e, float f)
{
if (a < b)
{
@@ -20,7 +22,12 @@ float e(float a, float b, float c, float d, float e, float f)
/* This should not be left as a multiplication. */
c = 1 / c;
- return a + b + c + d + e + f;
+ u = a;
+ v = b;
+ w = c;
+ x = d;
+ y = e;
+ z = f;
}
/* { dg-final { scan-tree-dump-times " / " 2 "recip" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/recip-6.c b/gcc/testsuite/gcc.dg/tree-ssa/recip-6.c
index 60fefd01da5..b3334fb862a 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/recip-6.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/recip-6.c
@@ -5,7 +5,9 @@
extern int f2();
-double f1(double y, double z, double w)
+double m, n, o;
+
+void f1(double y, double z, double w)
{
double b, c, d, e, f;
@@ -18,7 +20,9 @@ double f1(double y, double z, double w)
e = c / y;
f = 1 / y;
- return d + e + f;
+ m = d;
+ n = e;
+ o = f;
}
/* { dg-final { scan-tree-dump-times " / " 1 "recip" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/recip-7.c b/gcc/testsuite/gcc.dg/tree-ssa/recip-7.c
index af1bf3c008b..98bbdca6e2c 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/recip-7.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/recip-7.c
@@ -5,7 +5,9 @@
extern double h();
-double f(int x, double z, double w)
+double m, n, o;
+
+void f(int x, double z, double w)
{
double b, c, d, e, f;
double y = h ();
@@ -19,7 +21,9 @@ double f(int x, double z, double w)
e = c / y;
f = 1 / y;
- return d + e + f;
+ m = d;
+ n = e;
+ o = f;
}
/* { dg-final { scan-tree-dump-times " / " 1 "recip" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-20.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-20.c
new file mode 100644
index 00000000000..63febd0e04f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-20.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fdump-tree-ccp1" } */
+
+/* Make sure CCP propagates through indirect calls. */
+
+int foo (void)
+{
+ int i = -5;
+ int (*fn)(int) = __builtin_abs;
+ int j = fn(i);
+ return j + 5;
+}
+
+/* { dg-final { scan-tree-dump "return 10;" "ccp1" } } */
+/* { dg-final { cleanup-tree-dump "ccp1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-21.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-21.c
new file mode 100644
index 00000000000..3b23c36238e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-21.c
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fdump-tree-ccp1" } */
+
+struct A {
+ struct B {
+ int i;
+ } b;
+} a;
+
+int foo (void)
+{
+ struct B *p = &a.b;
+ struct A *q = (struct A *) p;
+ return q->b.i;
+}
+
+int bar (void)
+{
+ struct A *p = &a;
+ struct B *q = (struct B *) p;
+ return q->i;
+}
+
+/* { dg-final { scan-tree-dump-times "a.b.i" 2 "ccp1" } } */
+/* { dg-final { cleanup-tree-dump "ccp1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-22.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-22.c
new file mode 100644
index 00000000000..01d11ecac87
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-22.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fdump-tree-ccp1" } */
+
+/* Make sure we propagate through builtins. */
+
+int foo (unsigned b)
+{
+ unsigned t = -1;
+ int x = b <= t;
+ long l = __builtin_expect (x, 0);
+ return l;
+}
+
+/* { dg-final { scan-tree-dump "return 1;" "ccp1" } } */
+/* { dg-final { cleanup-tree-dump "ccp1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-23.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-23.c
new file mode 100644
index 00000000000..ac7f068cfd1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-23.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fdump-tree-ccp1" } */
+
+/* Make sure we propagate through POINTER_PLUS_EXPRs. */
+
+struct A {
+ int i[2];
+} a;
+
+int foo (void)
+{
+ struct A *p = &a;
+ int *q = (int *)p;
+ int *x = q + 1;
+ return *x;
+}
+
+/* { dg-final { scan-tree-dump "a.i\\\[1\\\]" "ccp1" } } */
+/* { dg-final { cleanup-tree-dump "ccp1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-13.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-13.c
index 3253afe2927..bb48c0a391b 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-13.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-13.c
@@ -25,6 +25,6 @@ void foo(double (*q)[4], struct Foo *tmp1)
}
}
-/* { dg-final { scan-tree-dump "Inserted .* &a" "fre" } } */
-/* { dg-final { scan-tree-dump "Replaced tmp1_.\\\(D\\\)->data" "fre" } } */
+/* { dg-final { scan-tree-dump "Inserted .* &a" "fre" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump "Replaced tmp1_.\\\(D\\\)->data" "fre" { xfail *-*-* } } } */
/* { dg-final { cleanup-tree-dump "fre" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-14.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-14.c
index d2d5e01bcc4..61c5e00b554 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-14.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-14.c
@@ -27,6 +27,6 @@ void foo(double (*q)[4])
}
}
-/* { dg-final { scan-tree-dump "Inserted .* &a" "fre" } } */
-/* { dg-final { scan-tree-dump "Replaced tmp1.data" "fre" } } */
+/* { dg-final { scan-tree-dump "Inserted .* &a" "fre" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump "Replaced tmp1.data" "fre" { xfail *-*-* } } } */
/* { dg-final { cleanup-tree-dump "fre" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-17.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-17.c
index aced64977ea..68fbb454c76 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-17.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-17.c
@@ -18,6 +18,6 @@ int foo(int i, int j, int k)
return f.doms[0LL].dom;
}
-/* { dg-final { scan-tree-dump "Replaced f.doms\\\[0\\\].dom with i_" "fre" } } */
+/* { dg-final { scan-tree-dump "Replaced f.doms\\\[0\\\].dom with i_" "fre" { xfail *-*-* } } } */
/* { dg-final { cleanup-tree-dump "fre" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-7.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-7.c
index bd81831eba8..d93a1a21456 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-7.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-7.c
@@ -29,10 +29,10 @@ intflt foo(intflt j)
return a.u.k;
}
-/* { dg-final { scan-tree-dump-times "Inserted pretmp" 1 "fre" } } */
-/* { dg-final { scan-tree-dump-times "Replaced a.u.f with pretmp" 3 "fre" } } */
-/* { dg-final { scan-tree-dump-times "Replaced a.u.k with j" 1 "fre" } } */
-/* { dg-final { scan-tree-dump "= VIEW_CONVERT_EXPR<float>\\\(j_" "fre" } } */
-/* { dg-final { scan-tree-dump "return j" "optimized" } } */
+/* { dg-final { scan-tree-dump-times "Inserted pretmp" 1 "fre" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump-times "Replaced a.u.f with pretmp" 3 "fre" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump-times "Replaced a.u.k with j" 1 "fre" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump "= VIEW_CONVERT_EXPR<float>\\\(j_" "fre" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump "return j" "optimized" { xfail *-*-* } } } */
/* { dg-final { cleanup-tree-dump "fre" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-8.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-8.c
index 6e17bd531b3..1494dbbbd94 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-8.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-8.c
@@ -28,6 +28,6 @@ intflt foo(int i, int b)
}
}
-/* { dg-final { scan-tree-dump-times "Replaced u.f with pretmp" 2 "fre" } } */
-/* { dg-final { scan-tree-dump-times "Inserted pretmp" 2 "fre" } } */
+/* { dg-final { scan-tree-dump-times "Replaced u.f with pretmp" 2 "fre" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump-times "Inserted pretmp" 2 "fre" { xfail *-*-* } } } */
/* { dg-final { cleanup-tree-dump "fre" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-9.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-9.c
index 18595ed6fe5..24c4ae37167 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-9.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-9.c
@@ -23,6 +23,6 @@ void __frame_state_for1 (volatile char *state_in)
}
}
-/* { dg-final { scan-tree-dump-times "Eliminated: 1" 2 "fre" } } */
-/* { dg-final { scan-tree-dump-times "Insertions: 1" 2 "fre" } } */
+/* { dg-final { scan-tree-dump-times "Eliminated: 1" 2 "fre" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump-times "Insertions: 1" 2 "fre" { xfail *-*-* } } } */
/* { dg-final { cleanup-tree-dump "fre" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-15.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-15.c
index 518fda854e6..f080989d1de 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-15.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-15.c
@@ -12,5 +12,5 @@ __SIZE_TYPE__ mystrlen (const char *s)
return strlen(s);
}
-/* { dg-final { scan-tree-dump "= 0;" "optimized" } } */
+/* { dg-final { scan-tree-dump "= 0;" "optimized" { xfail *-*-* } } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-18.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-18.c
new file mode 100644
index 00000000000..5e92934f052
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-18.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-pre-details" } */
+
+struct Bar { int a; int b; };
+struct Foo { int x; struct Bar y; };
+
+int __attribute__((const)) foo (struct Bar);
+
+int bar (int b)
+{
+ struct Foo f;
+ int c;
+ while (b--)
+ {
+ c = foo(f.y);
+ }
+ return c;
+}
+
+/* { dg-final { scan-tree-dump "Replaced foo \\(f.y\\)" "pre" } } */
+/* { dg-final { cleanup-tree-dump "pre" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/tailcall-3.c b/gcc/testsuite/gcc.dg/tree-ssa/tailcall-3.c
new file mode 100644
index 00000000000..4055bc3f52d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/tailcall-3.c
@@ -0,0 +1,28 @@
+/* The return argument needs a type conversion which on some targets
+ (e.g. s390) needs additional code. So it is invalid to do tail
+ call optimization here. */
+
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+extern void abort (void);
+
+long long __attribute__((noinline))
+foo ()
+{
+ return 3;
+}
+
+int __attribute__((noinline))
+boo ()
+{
+ return foo ();
+}
+
+int
+main ()
+{
+ if (boo () != 3)
+ abort ();
+}
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/tailcall-4.c b/gcc/testsuite/gcc.dg/tree-ssa/tailcall-4.c
new file mode 100644
index 00000000000..e7983da31da
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/tailcall-4.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-tailc-details" } */
+/* PR tree-opt/37024 */
+
+double doubleValue();
+
+long
+longValue ()
+{
+ return (long) doubleValue ();
+}
+
+/* We should not tail call doubleValue in longValue as the mode changes. */
+/* { dg-final { scan-tree-dump-times "Found tail call" 0 "tailc"} } */
+/* { dg-final { cleanup-tree-dump "tailc" } } */
+
diff --git a/gcc/testsuite/gcc.dg/uninit-1-O0.c b/gcc/testsuite/gcc.dg/uninit-1-O0.c
new file mode 100644
index 00000000000..4fe5d6b111d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-1-O0.c
@@ -0,0 +1,30 @@
+/* Spurious uninitialized variable warnings, case 1.
+ Taken from cppfiles.c (merge_include_chains) */
+/* { dg-do compile } */
+/* { dg-options "-Wuninitialized" } */
+
+struct list
+{
+ struct list *next;
+ int id;
+};
+
+extern void free (void *);
+
+void remove_dupes (struct list *el)
+{
+ struct list *p, *q, *r; /* { dg-bogus "r" "uninitialized variable warning" } */
+
+ for (p = el; p; p = p->next)
+ {
+ for (q = el; q != p; q = q->next)
+ if (q->id == p->id)
+ {
+ r->next = p->next;
+ free (p);
+ p = r;
+ break;
+ }
+ r = p;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/uninit-10-O0.c b/gcc/testsuite/gcc.dg/uninit-10-O0.c
new file mode 100644
index 00000000000..f761ac91c41
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-10-O0.c
@@ -0,0 +1,109 @@
+/* { dg-do compile } */
+/* { dg-options "-Wall" } */
+/* On Alpha EV4, dead code elimination and cfg simplification conspired
+ to leave the register containing 'C' marked live, though all references
+ to the variable had been removed. */
+
+struct operand_data
+{
+ struct operand_data *next;
+ int index;
+ const char *predicate;
+ const char *constraint;
+ int mode;
+ unsigned char n_alternatives;
+ char address_p;
+ char strict_low;
+ char eliminable;
+ char seen;
+};
+
+struct data
+{
+ struct data *next;
+ const char *name;
+ const char *template;
+ int code_number;
+ int index_number;
+ int lineno;
+ int n_operands;
+ int n_dups;
+ int n_alternatives;
+ int operand_number;
+ int output_format;
+ struct operand_data operand[40];
+};
+
+extern void message_with_line (int, const char *, ...)
+ __attribute__ ((__format__ (__printf__, 2, 3)));
+extern int have_error;
+
+extern char *strchr (__const char *__s, int __c) __attribute__ ((__pure__));
+
+void
+validate_insn_alternatives (d)
+ struct data *d;
+{
+ int n = 0, start;
+
+ for (start = 0; start < d->n_operands; start++)
+ if (d->operand[start].n_alternatives > 0)
+ {
+ int len, i;
+ const char *p;
+ char c; /* { dg-bogus "used uninitialized" "uninitialized variable warning" } */
+ int which_alternative = 0;
+ int alternative_count_unsure = 0;
+
+ for (p = d->operand[start].constraint; (c = *p); p += len)
+ {
+ len = 1;
+
+ if (len < 1 || (len > 1 && strchr (",#*+=&%!0123456789", c)))
+ {
+ message_with_line (d->lineno,
+ "invalid length %d for char '%c' in alternative %d of operand %d",
+ len, c, which_alternative, start);
+ len = 1;
+ have_error = 1;
+ }
+
+ if (c == ',')
+ {
+ which_alternative++;
+ continue;
+ }
+
+ for (i = 1; i < len; i++)
+ if (p[i] == '\0')
+ {
+ message_with_line (d->lineno,
+ "NUL in alternative %d of operand %d",
+ which_alternative, start);
+ alternative_count_unsure = 1;
+ break;
+ }
+ else if (strchr (",#*", p[i]))
+ {
+ message_with_line (d->lineno,
+ "'%c' in alternative %d of operand %d",
+ p[i], which_alternative, start);
+ alternative_count_unsure = 1;
+ }
+ }
+ if (alternative_count_unsure)
+ have_error = 1;
+ else if (n == 0)
+ n = d->operand[start].n_alternatives;
+ else if (n != d->operand[start].n_alternatives)
+ {
+ message_with_line (d->lineno,
+ "wrong number of alternatives in operand %d",
+ start);
+ have_error = 1;
+ }
+ }
+
+
+ d->n_alternatives = n;
+}
diff --git a/gcc/testsuite/gcc.dg/uninit-11-O0.c b/gcc/testsuite/gcc.dg/uninit-11-O0.c
new file mode 100644
index 00000000000..23af4f69aa0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-11-O0.c
@@ -0,0 +1,42 @@
+/* Positive test for uninitialized variables. */
+/* { dg-do compile } */
+/* { dg-options "-Wuninitialized" } */
+
+int sink;
+
+void f1(int parm) /* { dg-bogus "uninitialized" "parameter" } */
+{
+ sink = parm; /* { dg-bogus "uninitialized" "parameter" } */
+}
+
+void f2(void)
+{
+ int x;
+ sink = x; /* { dg-warning "is used" "unconditional" } */
+}
+
+void f3(int p)
+{
+ int x; /* { dg-warning "may be used" "conditional" { xfail *-*-* } } */
+ if (p)
+ x = p;
+ sink = x;
+}
+
+void f4(int p)
+{
+ int x; /* { dg-bogus "uninitialized" "easy if" } */
+ if (p)
+ x = 1;
+ else
+ x = 2;
+ sink = x;
+}
+
+void f5(void)
+{
+ int x, i; /* { dg-bogus "uninitialized" "easy loop" } */
+ for (i = 0; i < 10; ++i)
+ x = 1;
+ sink = x;
+}
diff --git a/gcc/testsuite/gcc.dg/uninit-12-O0.c b/gcc/testsuite/gcc.dg/uninit-12-O0.c
new file mode 100644
index 00000000000..7c0664e4dfc
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-12-O0.c
@@ -0,0 +1,12 @@
+/* PR 23497 */
+/* { dg-do compile } */
+/* { dg-options "-Wuninitialized" } */
+
+typedef _Complex float C;
+C foo()
+{
+ C f;
+ __real__ f = 0;
+ __imag__ f = 0;
+ return f;
+}
diff --git a/gcc/testsuite/gcc.dg/uninit-13-O0.c b/gcc/testsuite/gcc.dg/uninit-13-O0.c
new file mode 100644
index 00000000000..af80fa88ca9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-13-O0.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-Wuninitialized" } */
+
+typedef _Complex float C;
+C foo()
+{
+ C f;
+ __imag__ f = 0; /* { dg-warning "is used" "unconditional" { xfail *-*-* } } */
+ return f;
+}
diff --git a/gcc/testsuite/gcc.dg/uninit-14-O0.c b/gcc/testsuite/gcc.dg/uninit-14-O0.c
new file mode 100644
index 00000000000..abde6ca86e6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-14-O0.c
@@ -0,0 +1,20 @@
+/* PR 24931 */
+/* { dg-do compile } */
+/* { dg-options "-Wuninitialized" } */
+
+struct p {
+ short x, y;
+};
+
+struct s {
+ int i;
+ struct p p;
+};
+
+struct s f()
+{
+ struct s s;
+ s.p = (struct p){};
+ s.i = (s.p.x || s.p.y);
+ return s;
+}
diff --git a/gcc/testsuite/gcc.dg/uninit-15-O0.c b/gcc/testsuite/gcc.dg/uninit-15-O0.c
new file mode 100644
index 00000000000..a3fd2b63ba7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-15-O0.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-Wuninitialized" } */
+
+/* XFAIL for now, the uninitialized pass runs before inlining only at -O0. */
+
+inline int __attribute__((always_inline))
+foo (int i)
+{
+ if (i) return 1; /* { dg-warning "is used uninitialized" {} { xfail *-*-* } } */
+ return 0;
+}
+
+void baz();
+
+void bar()
+{
+ int j; /* { dg-message "was declared here" {} { xfail *-*-* } } */
+ for (; foo(j); ++j)
+ baz();
+}
diff --git a/gcc/testsuite/gcc.dg/uninit-2-O0.c b/gcc/testsuite/gcc.dg/uninit-2-O0.c
new file mode 100644
index 00000000000..62a23fa6b64
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-2-O0.c
@@ -0,0 +1,52 @@
+/* Spurious uninitialized variable warnings, case 2.
+ Taken from cpphash.c (macroexpand) */
+/* { dg-do compile } */
+/* { dg-options "-Wuninitialized" } */
+
+struct definition
+{
+ int nargs;
+ int rest_args;
+};
+
+struct cpp_reader;
+
+enum cpp_token
+{
+ CPP_EOF, CPP_POP, CPP_COMMA, CPP_RPAREN
+};
+
+extern enum cpp_token macarg (struct cpp_reader *, int);
+
+void
+macroexpand (struct cpp_reader *pfile, struct definition *defn)
+{
+ int nargs = defn->nargs;
+
+ if (nargs >= 0)
+ {
+ enum cpp_token token; /* { dg-bogus "token" "uninitialized variable warning" } */
+ int i, rest_args;
+ i = 0;
+ rest_args = 0;
+ do
+ {
+ if (rest_args)
+ continue;
+ if (i < nargs || (nargs == 0 && i == 0))
+ {
+ /* if we are working on last arg which absorbs rest of args... */
+ if (i == nargs - 1 && defn->rest_args)
+ rest_args = 1;
+ token = macarg (pfile, rest_args);
+ }
+ else
+ token = macarg (pfile, 0);
+ if (token == CPP_EOF || token == CPP_POP)
+ return;
+
+ i++;
+ }
+ while (token == CPP_COMMA);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/uninit-3-O0.c b/gcc/testsuite/gcc.dg/uninit-3-O0.c
new file mode 100644
index 00000000000..d3dcf14edec
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-3-O0.c
@@ -0,0 +1,33 @@
+/* Spurious uninit variable warnings, case 3.
+ Inspired by cppexp.c (parse_charconst) */
+/* { dg-do compile } */
+/* { dg-options "-Wuninitialized" } */
+
+extern void error (char *);
+
+int
+parse_charconst (const char *start, const char *end)
+{
+ int c; /* { dg-bogus "c" "uninitialized variable warning" } */
+ int nchars, retval;
+
+ nchars = 0;
+ retval = 0;
+ while (start < end)
+ {
+ c = *start++;
+ if (c == '\'')
+ break;
+ nchars++;
+ retval += c;
+ retval <<= 8;
+ }
+
+ if (nchars == 0)
+ return 0;
+
+ if (c != '\'')
+ error ("malformed character constant");
+
+ return retval;
+}
diff --git a/gcc/testsuite/gcc.dg/uninit-4-O0.c b/gcc/testsuite/gcc.dg/uninit-4-O0.c
new file mode 100644
index 00000000000..0b9aeea7ddb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-4-O0.c
@@ -0,0 +1,52 @@
+/* Spurious uninit variable warnings, case 4.
+ Simplified version of cppexp.c (cpp_parse_expr).
+
+ This one is really fragile, it gets it right if you take out case
+ 1, or if the structure is replaced by an int, or if the structure
+ has fewer members (!) */
+
+/* { dg-do compile } */
+/* { dg-options "-Wuninitialized" } */
+
+extern void abort (void);
+
+struct operation {
+ short op;
+ char rprio;
+ char flags;
+ char unsignedp;
+ long value;
+};
+
+extern struct operation cpp_lex (void);
+
+void
+cpp_parse_expr (void)
+{
+ int rprio; /* { dg-bogus "rprio" "uninitialized variable warning PR19833" } */
+ struct operation op;
+
+ for (;;)
+ {
+ op = cpp_lex ();
+
+ switch (op.op)
+ {
+ case 0:
+ break;
+ case 1:
+ return;
+ case 2:
+ rprio = 1;
+ break;
+ default:
+ return;
+ }
+
+ if (op.op == 0)
+ return;
+
+ if (rprio != 1)
+ abort();
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/uninit-5-O0.c b/gcc/testsuite/gcc.dg/uninit-5-O0.c
new file mode 100644
index 00000000000..d9784b3f76c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-5-O0.c
@@ -0,0 +1,39 @@
+/* Spurious uninitialized-variable warnings. */
+
+/* { dg-do compile } */
+/* { dg-options "-Wuninitialized" } */
+
+extern void use(int);
+extern void foo(void);
+
+void
+func1(int cond)
+{
+ int x; /* { dg-bogus "x" "uninitialized variable warning" } */
+
+ if(cond)
+ x = 1;
+
+ foo();
+
+ if(cond)
+ use(x);
+}
+
+void
+func2 (int cond)
+{
+ int x; /* { dg-bogus "x" "uninitialized variable warning" } */
+ int flag = 0;
+
+ if(cond)
+ {
+ x = 1;
+ flag = 1;
+ }
+
+ foo();
+
+ if(flag)
+ use(x);
+}
diff --git a/gcc/testsuite/gcc.dg/uninit-6-O0.c b/gcc/testsuite/gcc.dg/uninit-6-O0.c
new file mode 100644
index 00000000000..e3fefe5e1c5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-6-O0.c
@@ -0,0 +1,47 @@
+/* Spurious uninitialized variable warnings.
+ This one inspired by java/class.c:build_utf8_ref. */
+
+/* { dg-do compile } */
+/* { dg-options "-Wuninitialized" } */
+
+#include <stddef.h>
+
+struct tree
+{
+ struct tree *car;
+ struct tree *cdr;
+ int type, data;
+};
+
+extern void *malloc(size_t);
+
+#define INTEGER_T 1
+#define PTR_T 2
+
+#define APPEND(TREE, LAST, TYPE, VALUE) \
+do { \
+ struct tree *tmp = malloc (sizeof (struct tree)); \
+ tmp->car = 0; tmp->cdr = 0; tmp->type = TYPE; \
+ tmp->data = VALUE; \
+ if (TREE->car) \
+ LAST->cdr = tmp; \
+ else \
+ TREE->car = tmp; \
+ LAST = tmp; \
+} while(0)
+
+struct tree *
+make_something(int a, int b, int c)
+{
+ struct tree *rv;
+ struct tree *field;
+
+ rv = malloc (sizeof (struct tree));
+ rv->car = 0;
+
+ APPEND(rv, field, INTEGER_T, a); /* { dg-bogus "field" "uninitialized variable warning" { xfail *-*-* } } */
+ APPEND(rv, field, PTR_T, b);
+ APPEND(rv, field, INTEGER_T, c);
+
+ return rv;
+}
diff --git a/gcc/testsuite/gcc.dg/uninit-8-O0.c b/gcc/testsuite/gcc.dg/uninit-8-O0.c
new file mode 100644
index 00000000000..b386896c7ea
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-8-O0.c
@@ -0,0 +1,32 @@
+/* Uninitialized variable warning tests...
+ Inspired by part of optabs.c:expand_binop.
+ May be the same as uninit-1.c. */
+
+/* { dg-do compile } */
+/* { dg-options "-Wuninitialized" } */
+
+#include <limits.h>
+
+void
+add_bignums (int *out, int *x, int *y)
+{
+ int p, sum;
+ int carry; /* { dg-bogus "carry" "uninitialized variable warning" } */
+
+ p = 0;
+ for (; *x; x++, y++, out++, p++)
+ {
+ if (p)
+ sum = *x + *y + carry;
+ else
+ sum = *x + *y;
+
+ if (sum < 0)
+ {
+ carry = 1;
+ sum -= INT_MAX;
+ }
+ else
+ carry = 0;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/uninit-9-O0.c b/gcc/testsuite/gcc.dg/uninit-9-O0.c
new file mode 100644
index 00000000000..493dd68d908
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-9-O0.c
@@ -0,0 +1,41 @@
+/* Spurious uninitialized variable warnings. Slight variant on the
+ documented case, inspired by reg-stack.c:record_asm_reg_life. */
+
+/* { dg-do compile } */
+/* { dg-options "-Wuninitialized" } */
+
+struct foo
+{
+ int type;
+ struct foo *car;
+ struct foo *cdr;
+ char *data;
+ int data2;
+};
+
+extern void use(struct foo *);
+
+#define CLOBBER 6
+#define PARALLEL 3
+
+void
+func(struct foo *list, int count)
+{
+ int n_clobbers = 0;
+ int i;
+ struct foo **clob_list; /* { dg-bogus "clob_list" "uninitialized variable warning" } */
+
+ if(list[0].type == PARALLEL)
+ {
+ clob_list = __builtin_alloca(count * sizeof(struct foo *));
+
+ for(i = 1; i < count; i++)
+ {
+ if(list[i].type == CLOBBER)
+ clob_list[n_clobbers++] = &list[i];
+ }
+ }
+
+ for(i = 0; i < n_clobbers; i++)
+ use(clob_list[i]);
+}
diff --git a/gcc/testsuite/gcc.dg/uninit-A-O0.c b/gcc/testsuite/gcc.dg/uninit-A-O0.c
new file mode 100644
index 00000000000..69376911563
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-A-O0.c
@@ -0,0 +1,117 @@
+/* Inspired by part of java/parse.y.
+ May be a real bug in CSE. */
+
+/* { dg-do compile } */
+/* { dg-options "-Wall" } */
+
+struct tree
+{
+ struct tree *car, *cdr, *wfl;
+ int code;
+ struct { unsigned int renp:1;
+ unsigned int rtnp:1;
+ unsigned int rpnp:1; } flags;
+};
+typedef struct tree *tree;
+#define NULL_TREE ((tree)0)
+
+/* Codes */
+enum
+{
+ CALL_EXPR, NEW_ARRAY_EXPR, NEW_CLASS_EXPR, CONVERT_EXPR,
+ ARRAY_REF, CONDITIONAL_EXPR, STRING_CST, EXPR_WITH_FILE_LOCATION
+};
+
+/* Flags */
+#define RESOLVE_EXPRESSION_NAME_P(t) ((t)->flags.renp)
+#define RESOLVE_TYPE_NAME_P(t) ((t)->flags.rtnp)
+#define RESOLVE_PACKAGE_NAME_P(t) ((t)->flags.rpnp)
+
+/* Macros */
+#define EXPR_WFL_QUALIFICATION(t) ((t)->wfl)
+#define QUAL_WFL(t) ((t)->wfl)
+#define EXPR_WFL_NODE(t) ((t)->wfl)
+#define TREE_CODE(t) ((t)->code)
+#define TREE_OPERAND(t,x) ((t)->car)
+#define CLASSTYPE_SUPER(t) ((t)->car)
+#define IDENTIFIER_LOCAL_VALUE(t) ((t)->car)
+#define TREE_CHAIN(t) ((t)->cdr)
+#define QUAL_RESOLUTION(t) ((t)->cdr)
+
+extern tree current_class, this_identifier_node;
+extern tree super_identifier_node, length_identifier_node;
+
+tree resolve_and_layout (tree, tree);
+tree lookup_field_wrapper (tree, tree);
+
+void
+qualify_ambiguous_name (id)
+ tree id;
+{
+ tree qual, qual_wfl, decl;
+ tree name; /* { dg-bogus "name" "uninitialized variable warning" } */
+ tree ptr_type; /* { dg-bogus "ptr_type" "uninitialized variable warning" } */
+ int again, new_array_found = 0;
+ int super_found = 0, this_found = 0;
+
+ qual = EXPR_WFL_QUALIFICATION (id);
+ do {
+ qual_wfl = QUAL_WFL (qual);
+ switch (TREE_CODE (qual_wfl))
+ {
+ case CALL_EXPR:
+ qual_wfl = TREE_OPERAND (qual_wfl, 0);
+ if (TREE_CODE (qual_wfl) != EXPR_WITH_FILE_LOCATION)
+ {
+ qual = EXPR_WFL_QUALIFICATION (qual_wfl);
+ qual_wfl = QUAL_WFL (qual);
+ }
+ break;
+ case NEW_ARRAY_EXPR:
+ qual = TREE_CHAIN (qual);
+ new_array_found = again = 1;
+ continue;
+ case NEW_CLASS_EXPR:
+ case CONVERT_EXPR:
+ qual_wfl = TREE_OPERAND (qual_wfl, 0);
+ break;
+ case ARRAY_REF:
+ while (TREE_CODE (qual_wfl) == ARRAY_REF)
+ qual_wfl = TREE_OPERAND (qual_wfl, 0);
+ break;
+ default:
+ break;
+ }
+
+ name = EXPR_WFL_NODE (qual_wfl);
+ ptr_type = current_class;
+ again = 0;
+
+ } while (again);
+
+ /* If you put straightforward uses of name and ptr_type here
+ instead of the if-else sequence below, the warnings go away.
+ Therefore I suspect a real bug. */
+
+ if (!this_found && !super_found && (decl = IDENTIFIER_LOCAL_VALUE (name)))
+ {
+ RESOLVE_EXPRESSION_NAME_P (qual_wfl) = 1;
+ QUAL_RESOLUTION (qual) = decl;
+ }
+ else if ((decl = lookup_field_wrapper (ptr_type, name))
+ || (new_array_found && name == length_identifier_node))
+ {
+ RESOLVE_EXPRESSION_NAME_P (qual_wfl) = 1;
+ QUAL_RESOLUTION (qual) = (new_array_found ? NULL_TREE : decl);
+ }
+ else if ((decl = resolve_and_layout (name, NULL_TREE)))
+ {
+ RESOLVE_TYPE_NAME_P (qual_wfl) = 1;
+ QUAL_RESOLUTION (qual) = decl;
+ }
+ else if (TREE_CODE (QUAL_WFL (qual)) == CALL_EXPR
+ || TREE_CODE (QUAL_WFL (qual)) == ARRAY_REF)
+ RESOLVE_EXPRESSION_NAME_P (qual_wfl) = 1;
+ else
+ RESOLVE_PACKAGE_NAME_P (qual_wfl) = 1;
+}
diff --git a/gcc/testsuite/gcc.dg/uninit-B-O0.c b/gcc/testsuite/gcc.dg/uninit-B-O0.c
new file mode 100644
index 00000000000..e2883a38ea8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-B-O0.c
@@ -0,0 +1,15 @@
+/* Origin: PR c/179 from Gray Watson <gray@256.com>, adapted as a testcase
+ by Joseph Myers <jsm28@cam.ac.uk>. */
+/* { dg-do compile } */
+/* { dg-options "-Wuninitialized" } */
+extern void foo (int *);
+extern void bar (int);
+
+void
+baz (void)
+{
+ int i;
+ if (i) /* { dg-warning "uninit" "uninit i warning" { xfail *-*-* } } */
+ bar (i);
+ foo (&i);
+}
diff --git a/gcc/testsuite/gcc.dg/uninit-C-O0.c b/gcc/testsuite/gcc.dg/uninit-C-O0.c
new file mode 100644
index 00000000000..305dd36707e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-C-O0.c
@@ -0,0 +1,21 @@
+/* Spurious uninitialized variable warning, inspired by libgcc2.c. */
+/* { dg-do compile } */
+/* { dg-options "-Wuninitialized" } */
+
+/* Not all platforms support TImode integers. */
+#if defined(__LP64__) && !defined(__hppa__)
+typedef int TItype __attribute__ ((mode (TI)));
+#else
+typedef long TItype;
+#endif
+
+
+TItype
+__subvdi3 (TItype a, TItype b)
+{
+ TItype w;
+
+ w = a - b;
+
+ return w;
+}
diff --git a/gcc/testsuite/gcc.dg/uninit-D-O0.c b/gcc/testsuite/gcc.dg/uninit-D-O0.c
new file mode 100644
index 00000000000..e63cb80aee0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-D-O0.c
@@ -0,0 +1,9 @@
+/* Test we do not warn about initializing variable with self. */
+/* { dg-do compile } */
+/* { dg-options "-Wuninitialized" } */
+
+int f()
+{
+ int i = i;
+ return i;
+}
diff --git a/gcc/testsuite/gcc.dg/uninit-E-O0.c b/gcc/testsuite/gcc.dg/uninit-E-O0.c
new file mode 100644
index 00000000000..2cc2459663d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-E-O0.c
@@ -0,0 +1,9 @@
+/* Test we do warn about initializing variable with self when -Winit-self is supplied. */
+/* { dg-do compile } */
+/* { dg-options "-Wuninitialized -Winit-self" } */
+
+int f()
+{
+ int i = i; /* { dg-warning "i" "uninitialized variable warning" } */
+ return i;
+}
diff --git a/gcc/testsuite/gcc.dg/uninit-F-O0.c b/gcc/testsuite/gcc.dg/uninit-F-O0.c
new file mode 100644
index 00000000000..737cc65007e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-F-O0.c
@@ -0,0 +1,9 @@
+/* Test we do warn about initializing variable with self in the initialization. */
+/* { dg-do compile } */
+/* { dg-options "-Wuninitialized" } */
+
+int f()
+{
+ int i = i + 1; /* { dg-warning "i" "uninitialized variable warning" } */
+ return i;
+}
diff --git a/gcc/testsuite/gcc.dg/uninit-G-O0.c b/gcc/testsuite/gcc.dg/uninit-G-O0.c
new file mode 100644
index 00000000000..d6edffede66
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-G-O0.c
@@ -0,0 +1,9 @@
+/* Test we do not warn about initializing variable with address of self in the initialization. */
+/* { dg-do compile } */
+/* { dg-options "-Wuninitialized" } */
+
+void *f()
+{
+ void *i = &i;
+ return i;
+}
diff --git a/gcc/testsuite/gcc.dg/uninit-H-O0.c b/gcc/testsuite/gcc.dg/uninit-H-O0.c
new file mode 100644
index 00000000000..97221462c02
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-H-O0.c
@@ -0,0 +1,33 @@
+/* PR 14204 */
+/* { dg-do compile } */
+/* { dg-options "-Wall -Werror" } */
+
+#if defined __alpha__
+# define ASM __asm__("$30")
+#elif defined __i386__
+# define ASM __asm__("esp")
+#elif defined (__powerpc__) || defined (__PPC__) || defined (__ppc__) || defined (_POWER)
+# define ASM __asm__("r1")
+#elif defined __s390__
+# define ASM __asm__("r15")
+#elif defined __mips
+# define ASM __asm__("$sp")
+#elif defined __sparc__
+# define ASM __asm__("sp")
+#elif defined __ia64__
+# define ASM __asm__("r12")
+#elif defined __hppa__
+# define ASM __asm__("%r30")
+#elif defined __xtensa__
+# define ASM __asm__("sp")
+#else
+/* The register name should be target-dependent so for other targets,
+ we just silence the test. */
+# define ASM = 0
+#endif
+
+void *load_PCB (void)
+{
+ register void *sp ASM;
+ return sp; /* { dg-bogus "uninitialized" } */
+}
diff --git a/gcc/testsuite/gcc.dg/uninit-I-O0.c b/gcc/testsuite/gcc.dg/uninit-I-O0.c
new file mode 100644
index 00000000000..655f5489279
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-I-O0.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-Wuninitialized" } */
+
+int sys_msgctl (void)
+{
+ struct { int mode; } setbuf; /* { dg-warning "'setbuf\.mode' is used" {} { xfail *-*-* } } */
+ return setbuf.mode;
+}
diff --git a/gcc/testsuite/gcc.dg/uninit-pr20644-O0.c b/gcc/testsuite/gcc.dg/uninit-pr20644-O0.c
new file mode 100644
index 00000000000..092d4116495
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-pr20644-O0.c
@@ -0,0 +1,24 @@
+/* PR 20644 */
+/* { dg-do compile } */
+/* { dg-options "-O0 -Wuninitialized" } */
+int foo ()
+{
+ int i = 0;
+ int j;
+
+ if (1 == i)
+ return j; /* { dg-bogus "uninitialized" "uninitialized" { xfail *-*-* } 10 } */
+
+ return 0;
+}
+
+int bar ()
+{
+ int i = 1;
+ int j;
+
+ if (1 == i)
+ return j; /* { dg-warning "uninitialized" "uninitialized" { target *-*-* } 21 } */
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/uninit-pr20644.c b/gcc/testsuite/gcc.dg/uninit-pr20644.c
new file mode 100644
index 00000000000..e13910becd1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-pr20644.c
@@ -0,0 +1,24 @@
+/* PR 20644 */
+/* { dg-do compile } */
+/* { dg-options "-O -Wuninitialized" } */
+int foo ()
+{
+ int i = 0;
+ int j;
+
+ if (1 == i)
+ return j;
+
+ return 0;
+}
+
+int bar ()
+{
+ int i = 1;
+ int j;
+
+ if (1 == i)
+ return j; /* { dg-warning "uninitialized" "uninitialized" { target *-*-* } 18 } */
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/unused-6-WallWextra.c b/gcc/testsuite/gcc.dg/unused-6-WallWextra.c
new file mode 100644
index 00000000000..d2d80be062a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/unused-6-WallWextra.c
@@ -0,0 +1,11 @@
+/* PR 28875 */
+/* { dg-do compile } */
+/* { dg-options "-O3 -Wextra -Wall" } */
+static int t(int i) /* { dg-warning "unused parameter" "unused parameter warning" } */
+{
+ return 0;
+}
+int tt()
+{
+ return t(0);
+}
diff --git a/gcc/testsuite/gcc.dg/unused-6-no.c b/gcc/testsuite/gcc.dg/unused-6-no.c
new file mode 100644
index 00000000000..0923cfb8132
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/unused-6-no.c
@@ -0,0 +1,11 @@
+/* PR 28875 */
+/* { dg-do compile } */
+/* { dg-options "-O3 -Wextra -Wno-unused-parameter -Wall" } */
+static int t(int i) /* { dg-bogus "unused parameter" "unused parameter warning" } */
+{
+ return 0;
+}
+int tt()
+{
+ return t(0);
+}
diff --git a/gcc/testsuite/gcc.dg/utf-array-short-wchar.c b/gcc/testsuite/gcc.dg/utf-array-short-wchar.c
new file mode 100644
index 00000000000..7d8c319d99a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/utf-array-short-wchar.c
@@ -0,0 +1,41 @@
+/* Contributed by Kris Van Hees <kris.van.hees@oracle.com> */
+/* Expected errors for char16_t/char32_t string literals. */
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99 -fshort-wchar" } */
+
+#include <wchar.h>
+
+typedef short unsigned int char16_t;
+typedef unsigned int char32_t;
+
+const char s_0[] = "ab";
+const char s_1[] = u"ab"; /* { dg-error "from wide string" } */
+const char s_2[] = U"ab"; /* { dg-error "from wide string" } */
+const char s_3[] = L"ab"; /* { dg-error "from wide string" } */
+
+const char16_t s16_0[] = "ab"; /* { dg-error "from non-wide" } */
+const char16_t s16_1[] = u"ab";
+const char16_t s16_2[] = U"ab"; /* { dg-error "from incompatible" } */
+const char16_t s16_3[] = L"ab";
+
+const char16_t s16_4[0] = u"ab"; /* { dg-warning "chars is too long" } */
+const char16_t s16_5[1] = u"ab"; /* { dg-warning "chars is too long" } */
+const char16_t s16_6[2] = u"ab";
+const char16_t s16_7[3] = u"ab";
+const char16_t s16_8[4] = u"ab";
+
+const char32_t s32_0[] = "ab"; /* { dg-error "from non-wide" } */
+const char32_t s32_1[] = u"ab"; /* { dg-error "from incompatible" } */
+const char32_t s32_2[] = U"ab";
+const char32_t s32_3[] = L"ab"; /* { dg-error "from incompatible" } */
+
+const char32_t s32_4[0] = U"ab"; /* { dg-warning "chars is too long" } */
+const char32_t s32_5[1] = U"ab"; /* { dg-warning "chars is too long" } */
+const char32_t s32_6[2] = U"ab";
+const char32_t s32_7[3] = U"ab";
+const char32_t s32_8[4] = U"ab";
+
+const wchar_t sw_0[] = "ab"; /* { dg-error "from non-wide" } */
+const wchar_t sw_1[] = u"ab";
+const wchar_t sw_2[] = U"ab"; /* { dg-error "from incompatible" } */
+const wchar_t sw_3[] = L"ab";
diff --git a/gcc/testsuite/gcc.dg/utf-array.c b/gcc/testsuite/gcc.dg/utf-array.c
new file mode 100644
index 00000000000..50a29fe9375
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/utf-array.c
@@ -0,0 +1,41 @@
+/* Contributed by Kris Van Hees <kris.van.hees@oracle.com> */
+/* Expected errors for char16_t/char32_t string literals. */
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99" } */
+
+#include <wchar.h>
+
+typedef short unsigned int char16_t;
+typedef unsigned int char32_t;
+
+const char s_0[] = "ab";
+const char s_1[] = u"ab"; /* { dg-error "from wide string" } */
+const char s_2[] = U"ab"; /* { dg-error "from wide string" } */
+const char s_3[] = L"ab"; /* { dg-error "from wide string" } */
+
+const char16_t s16_0[] = "ab"; /* { dg-error "from non-wide" } */
+const char16_t s16_1[] = u"ab";
+const char16_t s16_2[] = U"ab"; /* { dg-error "from incompatible" } */
+const char16_t s16_3[] = L"ab"; /* { dg-error "from incompatible" } */
+
+const char16_t s16_4[0] = u"ab"; /* { dg-warning "chars is too long" } */
+const char16_t s16_5[1] = u"ab"; /* { dg-warning "chars is too long" } */
+const char16_t s16_6[2] = u"ab";
+const char16_t s16_7[3] = u"ab";
+const char16_t s16_8[4] = u"ab";
+
+const char32_t s32_0[] = "ab"; /* { dg-error "from non-wide" } */
+const char32_t s32_1[] = u"ab"; /* { dg-error "from incompatible" } */
+const char32_t s32_2[] = U"ab";
+const char32_t s32_3[] = L"ab"; /* { dg-error "from incompatible" } */
+
+const char32_t s32_4[0] = U"ab"; /* { dg-warning "chars is too long" } */
+const char32_t s32_5[1] = U"ab"; /* { dg-warning "chars is too long" } */
+const char32_t s32_6[2] = U"ab";
+const char32_t s32_7[3] = U"ab";
+const char32_t s32_8[4] = U"ab";
+
+const wchar_t sw_0[] = "ab"; /* { dg-error "from non-wide" } */
+const wchar_t sw_1[] = u"ab"; /* { dg-error "from incompatible" } */
+const wchar_t sw_2[] = U"ab"; /* { dg-error "from incompatible" } */
+const wchar_t sw_3[] = L"ab";
diff --git a/gcc/testsuite/gcc.dg/utf-inc-init.c b/gcc/testsuite/gcc.dg/utf-inc-init.c
new file mode 100644
index 00000000000..17d59f3782f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/utf-inc-init.c
@@ -0,0 +1,45 @@
+/* Contributed by Kris Van Hees <kris.van.hees@oracle.com> */
+/* Test incremental initializers for char16_t/char32_t arrays. */
+/* { dg-do run } */
+/* { dg-options "-std=gnu99" } */
+
+typedef __SIZE_TYPE__ size_t;
+typedef short unsigned int char16_t;
+typedef unsigned int char32_t;
+
+extern int memcmp (const void *, const void *, size_t);
+extern void abort (void);
+extern void exit (int);
+
+struct A {
+ char16_t S[6];
+ int M;
+} a[] = { { { u"foo" }, 1 }, [0].S[2] = u'x', [0].S[4] = u'y' };
+struct A b[] = { { { u"foo" }, 1 }, [0] = { .S[0] = u'b' } };
+struct A c[] = { { { u"foo" }, 1 }, [0].S = { u"a" }, [0].M = 2 };
+
+struct B {
+ char32_t S[6];
+ int M;
+} d[] = { { { U"foo" }, 1 }, [0].S[2] = U'x', [0].S[4] = U'y' };
+struct B e[] = { { { U"foo" }, 1 }, [0] = { .S[0] = U'b' } };
+struct B f[] = { { { U"foo" }, 1 }, [0].S = { U"a" }, [0].M = 2 };
+
+int main (void)
+{
+ if (memcmp (a[0].S, u"fox\0y", 6 * sizeof(char16_t)) || a[0].M != 1)
+ abort ();
+ if (memcmp (b[0].S, u"b\0\0\0\0", 6) || b[0].M)
+ abort ();
+ if (memcmp (c[0].S, u"a\0\0\0\0", 6) || c[0].M != 2)
+ abort ();
+
+ if (memcmp (d[0].S, U"fox\0y", 6 * sizeof(char32_t)) || d[0].M != 1)
+ abort ();
+ if (memcmp (e[0].S, U"b\0\0\0\0", 6) || e[0].M)
+ abort ();
+ if (memcmp (f[0].S, U"a\0\0\0\0", 6) || f[0].M != 2)
+ abort ();
+
+ exit(0);
+}
diff --git a/gcc/testsuite/gcc.dg/utf-type.c b/gcc/testsuite/gcc.dg/utf-type.c
new file mode 100644
index 00000000000..1aa6020cbef
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/utf-type.c
@@ -0,0 +1,18 @@
+/* Contributed by Kris Van Hees <kris.van.hees@oracle.com> */
+/* Ensure that __CHAR16_TYPE__ and __CHAR32_TYPE__ exist, and are of the
+ correct width. */
+/* { dg-do run } */
+/* { dg-options "-std=gnu99 -Wall -Werror" } */
+
+typedef __CHAR16_TYPE__ char16_t;
+typedef __CHAR32_TYPE__ char32_t;
+
+extern void abort (void);
+
+int main ()
+{
+ if (sizeof (char16_t) != sizeof (u'a'))
+ abort();
+ if (sizeof (char32_t) != sizeof (U'a'))
+ abort();
+}
diff --git a/gcc/testsuite/gcc.dg/var-expand3.c b/gcc/testsuite/gcc.dg/var-expand3.c
index 7930ad94dec..a9d0fe917b8 100644
--- a/gcc/testsuite/gcc.dg/var-expand3.c
+++ b/gcc/testsuite/gcc.dg/var-expand3.c
@@ -1,5 +1,5 @@
/* { dg-do run { target { powerpc*-*-* && vmx_hw } } }} */
-/* { dg-options "-O2 -funroll-loops -ffast-math -fvariable-expansion-in-unroller -maltivec -fdump-rtl-loop2" } */
+/* { dg-options "-O2 -funroll-loops -ffast-math -fvariable-expansion-in-unroller -maltivec -fdump-rtl-loop2_unroll" } */
#include "altivec.h"
extern void abort (void);
diff --git a/gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-slp-34.c b/gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-slp-34.c
new file mode 100644
index 00000000000..376c7e4ee07
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-slp-34.c
@@ -0,0 +1,74 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "../../tree-vect.h"
+
+struct mystr {
+ int f1;
+ int f2;
+};
+
+struct mystr af[16] = {
+ 10, 11, 12, 13, 14, 15, 16, 17,
+ 20, 21, 22, 23, 24, 25, 26, 27,
+ 30, 31, 32, 33, 34, 35, 36, 37,
+ 40, 41, 42, 43, 44, 45, 46, 47
+};
+
+struct mystr bf[16] = {
+ 12, 13, 14, 15, 16, 17, 18, 19,
+ 22, 23, 24, 25, 26, 27, 28, 29,
+ 32, 33, 34, 35, 36, 37, 38, 39,
+ 42, 43, 44, 45, 46, 47, 48, 49
+};
+
+struct mystr cf[16];
+
+int res1[16] = {
+ 22, 26, 30, 34, 42, 46, 50, 54,
+ 62, 66, 70, 74, 82, 86, 90, 94,
+};
+
+int res2[16] = {
+ 24, 28, 32, 36, 44, 48, 52, 56,
+ 64, 68, 72, 76, 84, 88, 92, 96,
+};
+
+__attribute__ ((noinline)) void
+foo (void)
+{
+ int i;
+
+ for (i = 0; i < 16; i++)
+ {
+ cf[i].f1 = af[i].f1 + bf[i].f1;
+ cf[i].f2 = af[i].f2 + bf[i].f2;
+ }
+}
+
+
+
+int
+main (void)
+{
+ int i;
+
+ check_vect ();
+ foo ();
+
+ /* Check resiults. */
+ for (i = 0; i < 16; i++)
+ {
+ if (cf[i].f1 != res1[i])
+ abort ();
+ if (cf[i].f2 != res2[i])
+ abort ();
+
+ }
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorization not profitable" 0 "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/fast-math-pr35982.c b/gcc/testsuite/gcc.dg/vect/fast-math-pr35982.c
index d21c61dd934..2c788606771 100644
--- a/gcc/testsuite/gcc.dg/vect/fast-math-pr35982.c
+++ b/gcc/testsuite/gcc.dg/vect/fast-math-pr35982.c
@@ -19,7 +19,7 @@ float method2_int16 (struct mem *mem)
return avg;
}
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_extract_even_odd } } } */
-/* { dg-final { scan-tree-dump-times "vectorized 0 loops" 1 "vect" { xfail vect_extract_even_odd } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_extract_even_odd_wide } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 0 loops" 1 "vect" { xfail vect_extract_even_odd_wide } } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/fast-math-vect-complex-3.c b/gcc/testsuite/gcc.dg/vect/fast-math-vect-complex-3.c
new file mode 100644
index 00000000000..6110a231987
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/fast-math-vect-complex-3.c
@@ -0,0 +1,61 @@
+/* { dg-require-effective-target vect_float } */
+
+#include <stdio.h>
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 16
+
+_Complex float a[N] =
+ { 10.0F + 20.0iF, 11.0F + 21.0iF, 12.0F + 22.0iF, 13.0F + 23.0iF,
+ 14.0F + 24.0iF, 15.0F + 25.0iF, 16.0F + 26.0iF, 17.0F + 27.0iF,
+ 18.0F + 28.0iF, 19.0F + 29.0iF, 20.0F + 30.0iF, 21.0F + 31.0iF,
+ 22.0F + 32.0iF, 23.0F + 33.0iF, 24.0F + 34.0iF, 25.0F + 35.0iF };
+_Complex float b[N] =
+ { 30.0F + 40.0iF, 31.0F + 41.0iF, 32.0F + 42.0iF, 33.0F + 43.0iF,
+ 34.0F + 44.0iF, 35.0F + 45.0iF, 36.0F + 46.0iF, 37.0F + 47.0iF,
+ 38.0F + 48.0iF, 39.0F + 49.0iF, 40.0F + 50.0iF, 41.0F + 51.0iF,
+ 42.0F + 52.0iF, 43.0F + 53.0iF, 44.0F + 54.0iF, 45.0F + 55.0iF };
+
+_Complex float c[N];
+_Complex float res[N] =
+ { -500.0F + 1000.0iF, -520.0F + 1102.0iF,
+ -540.0F + 1208.0iF, -560.0F + 1318.0iF,
+ -580.0F + 1432.0iF, -600.0F + 1550.0iF,
+ -620.0F + 1672.0iF, -640.0F + 1798.0iF,
+ -660.0F + 1928.0iF, -680.0F + 2062.0iF,
+ -700.0F + 2200.0iF, -720.0F + 2342.0iF,
+ -740.0F + 2488.0iF, -760.0F + 2638.0iF,
+ -780.0F + 2792.0iF, -800.0F + 2950.0iF };
+
+
+__attribute__ ((noinline)) void
+foo (void)
+{
+ int i;
+
+ for (i = 0; i < N; i++)
+ c[i] = a[i] * b[i];
+
+}
+
+int
+main (void)
+{
+ int i;
+ check_vect ();
+
+ foo ();
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (c[i] != res[i])
+ abort ();
+ }
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_interleave && vect_extract_even_odd_wide } } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/slp-11.c b/gcc/testsuite/gcc.dg/vect/slp-11.c
index 118818c97bd..d606438fd20 100644
--- a/gcc/testsuite/gcc.dg/vect/slp-11.c
+++ b/gcc/testsuite/gcc.dg/vect/slp-11.c
@@ -106,8 +106,8 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { target { vect_strided && vect_int_mult } } } } */
-/* { dg-final { scan-tree-dump-times "vectorized 0 loops" 1 "vect" {target { ! { vect_int_mult && vect_strided } } } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { target { vect_strided_wide && vect_int_mult } } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 0 loops" 1 "vect" {target { ! { vect_int_mult && vect_strided_wide } } } } } */
/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/slp-12a.c b/gcc/testsuite/gcc.dg/vect/slp-12a.c
index 066bf7ff9a3..5cf404100ba 100644
--- a/gcc/testsuite/gcc.dg/vect/slp-12a.c
+++ b/gcc/testsuite/gcc.dg/vect/slp-12a.c
@@ -95,11 +95,11 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" {target { vect_strided && vect_int_mult} } } } */
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" {target { {! {vect_strided}} && vect_int_mult } } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" {target { vect_strided_wide && vect_int_mult} } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" {target { {! {vect_strided_wide}} && vect_int_mult } } } } */
/* { dg-final { scan-tree-dump-times "vectorized 0 loops" 1 "vect" {target { ! vect_int_mult } } } } */
-/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" {target { vect_strided && vect_int_mult } } } } */
-/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" {target { {! {vect_strided}} && vect_int_mult } } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" {target { vect_strided_wide && vect_int_mult } } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" {target { {! {vect_strided_wide}} && vect_int_mult } } } } */
/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" {target { ! vect_int_mult } } } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/slp-12b.c b/gcc/testsuite/gcc.dg/vect/slp-12b.c
index 39570016f38..7b65dfcfe35 100644
--- a/gcc/testsuite/gcc.dg/vect/slp-12b.c
+++ b/gcc/testsuite/gcc.dg/vect/slp-12b.c
@@ -43,9 +43,9 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" {target { vect_strided && vect_int_mult } } } } */
-/* { dg-final { scan-tree-dump-times "vectorized 0 loops" 1 "vect" {target { { ! { vect_int_mult }} || { ! {vect_strided}}} } } } */
-/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" {target { vect_strided && vect_int_mult } } } } */
-/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" {target { { ! { vect_int_mult }} || { ! {vect_strided}}} } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" {target { vect_strided_wide && vect_int_mult } } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 0 loops" 1 "vect" {target { { ! { vect_int_mult }} || { ! {vect_strided_wide}}} } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" {target { vect_strided_wide && vect_int_mult } } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" {target { { ! { vect_int_mult }} || { ! {vect_strided_wide}}} } } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/slp-19.c b/gcc/testsuite/gcc.dg/vect/slp-19.c
index d9a68cd69d4..1133df4f4e6 100644
--- a/gcc/testsuite/gcc.dg/vect/slp-19.c
+++ b/gcc/testsuite/gcc.dg/vect/slp-19.c
@@ -147,9 +147,9 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { target vect_strided } } } */
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { ! { vect_strided } } } } } */
-/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 3 "vect" { target vect_strided } } } */
-/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target { ! { vect_strided } } } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { target vect_strided_wide } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { ! { vect_strided_wide } } } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 3 "vect" { target vect_strided_wide } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target { ! { vect_strided_wide } } } } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/slp-23.c b/gcc/testsuite/gcc.dg/vect/slp-23.c
index 2bba580271d..27ec12587f4 100644
--- a/gcc/testsuite/gcc.dg/vect/slp-23.c
+++ b/gcc/testsuite/gcc.dg/vect/slp-23.c
@@ -106,8 +106,8 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" { target { vect_strided } && {! { vect_no_align} } } } } */
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { ! { vect_strided || vect_no_align} } } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" { target { vect_strided_wide } && {! { vect_no_align} } } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { ! { vect_strided_wide || vect_no_align} } } } } */
/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { xfail vect_no_align } } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/slp-5.c b/gcc/testsuite/gcc.dg/vect/slp-5.c
index 0f9c2eefb21..57e9e5df55f 100644
--- a/gcc/testsuite/gcc.dg/vect/slp-5.c
+++ b/gcc/testsuite/gcc.dg/vect/slp-5.c
@@ -121,8 +121,8 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { target { vect_strided } } } } */
-/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" { target { ! { vect_strided } } } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { target { vect_strided_wide } } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" { target { ! { vect_strided_wide } } } } } */
/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-1.c b/gcc/testsuite/gcc.dg/vect/vect-1.c
index 1ec195c5352..7a570541c73 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-1.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-1.c
@@ -86,6 +86,6 @@ foo (int n)
fbar (a);
}
-/* { dg-final { scan-tree-dump-times "vectorized 4 loops" 1 "vect" { target vect_extract_even_odd } } } */
-/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { xfail vect_extract_even_odd } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 4 loops" 1 "vect" { target vect_extract_even_odd_wide } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { xfail vect_extract_even_odd_wide } } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-107.c b/gcc/testsuite/gcc.dg/vect/vect-107.c
index 8c6a6950848..514fc362068 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-107.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-107.c
@@ -39,6 +39,6 @@ int main (void)
return main1 ();
}
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_extract_even_odd } } } */
-/* { dg-final { scan-tree-dump-times "vectorized 0 loops" 1 "vect" { xfail vect_extract_even_odd } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_extract_even_odd_wide } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 0 loops" 1 "vect" { xfail vect_extract_even_odd_wide } } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-112.c b/gcc/testsuite/gcc.dg/vect/vect-112.c
index 4b963eb2661..0bc185b361e 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-112.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-112.c
@@ -32,7 +32,7 @@ int main (void)
return main1 ();
}
-/* { dg-final { scan-tree-dump-times "vectorized 0 loops" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_unpack } } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-35.c b/gcc/testsuite/gcc.dg/vect/vect-35.c
index 569907c50b2..d75308f22fe 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-35.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-35.c
@@ -18,6 +18,8 @@ int main1 ()
for (i = 0; i < N; i++)
{
s.b[i] = 3*i;
+ if (i%3 == 0)
+ s.b[i] = 3*i;
}
/* Dependence analysis fails cause s.a and s.b may overlap.
diff --git a/gcc/testsuite/gcc.dg/vect/vect-72.c b/gcc/testsuite/gcc.dg/vect/vect-72.c
index 95bc7caede0..67a19751952 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-72.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-72.c
@@ -18,6 +18,9 @@ int main1 ()
for (i=0; i < N+1; i++)
{
ib[i] = i;
+ /* Avoid vectorization. */
+ if (i%3 == 0)
+ ib[i] = 5;
}
for (i = 1; i < N+1; i++)
diff --git a/gcc/testsuite/gcc.dg/vect/vect-98.c b/gcc/testsuite/gcc.dg/vect/vect-98.c
index 0987ec885dc..118f28fd334 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-98.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-98.c
@@ -38,6 +38,6 @@ int main (void)
}
/* Needs interleaving support. */
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_interleave && vect_extract_even_odd } } } } */
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" { xfail { vect_interleave && vect_extract_even_odd } } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_interleave && vect_extract_even_odd_wide } } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" { xfail { vect_interleave && vect_extract_even_odd_wide } } } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-complex-1.c b/gcc/testsuite/gcc.dg/vect/vect-complex-1.c
new file mode 100644
index 00000000000..9be88644b63
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-complex-1.c
@@ -0,0 +1,56 @@
+/* { dg-require-effective-target vect_float } */
+
+#include <stdio.h>
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 16
+
+_Complex float a[N] =
+ { 10.0F + 20.0iF, 11.0F + 21.0iF, 12.0F + 22.0iF, 13.0F + 23.0iF,
+ 14.0F + 24.0iF, 15.0F + 25.0iF, 16.0F + 26.0iF, 17.0F + 27.0iF,
+ 18.0F + 28.0iF, 19.0F + 29.0iF, 20.0F + 30.0iF, 21.0F + 31.0iF,
+ 22.0F + 32.0iF, 23.0F + 33.0iF, 24.0F + 34.0iF, 25.0F + 35.0iF };
+_Complex float b[N] =
+ { 30.0F + 40.0iF, 31.0F + 41.0iF, 32.0F + 42.0iF, 33.0F + 43.0iF,
+ 34.0F + 44.0iF, 35.0F + 45.0iF, 36.0F + 46.0iF, 37.0F + 47.0iF,
+ 38.0F + 48.0iF, 39.0F + 49.0iF, 40.0F + 50.0iF, 41.0F + 51.0iF,
+ 42.0F + 52.0iF, 43.0F + 53.0iF, 44.0F + 54.0iF, 45.0F + 55.0iF };
+
+_Complex float c[N];
+_Complex float res[N] =
+ { 40.0F + 60.0iF, 42.0F + 62.0iF, 44.0F + 64.0iF, 46.0F + 66.0iF,
+ 48.0F + 68.0iF, 50.0F + 70.0iF, 52.0F + 72.0iF, 54.0F + 74.0iF,
+ 56.0F + 76.0iF, 58.0F + 78.0iF, 60.0F + 80.0iF, 62.0F + 82.0iF,
+ 64.0F + 84.0iF, 66.0F + 86.0iF, 68.0F + 88.0iF, 70.0F + 90.0iF };
+
+
+__attribute__ ((noinline)) void
+foo (void)
+{
+ int i;
+
+ for (i = 0; i < N; i++)
+ c[i] = a[i] + b[i];
+
+}
+
+int
+main (void)
+{
+ int i;
+ check_vect ();
+
+ foo ();
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ if (c[i] != res[i])
+ abort ();
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-complex-2.c b/gcc/testsuite/gcc.dg/vect/vect-complex-2.c
new file mode 100644
index 00000000000..a034082cd4d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-complex-2.c
@@ -0,0 +1,56 @@
+/* { dg-require-effective-target vect_double } */
+
+#include <stdio.h>
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 16
+
+_Complex double a[N] =
+ { 10.0F + 20.0iF, 11.0F + 21.0iF, 12.0F + 22.0iF, 13.0F + 23.0iF,
+ 14.0F + 24.0iF, 15.0F + 25.0iF, 16.0F + 26.0iF, 17.0F + 27.0iF,
+ 18.0F + 28.0iF, 19.0F + 29.0iF, 20.0F + 30.0iF, 21.0F + 31.0iF,
+ 22.0F + 32.0iF, 23.0F + 33.0iF, 24.0F + 34.0iF, 25.0F + 35.0iF };
+_Complex double b[N] =
+ { 30.0F + 40.0iF, 31.0F + 41.0iF, 32.0F + 42.0iF, 33.0F + 43.0iF,
+ 34.0F + 44.0iF, 35.0F + 45.0iF, 36.0F + 46.0iF, 37.0F + 47.0iF,
+ 38.0F + 48.0iF, 39.0F + 49.0iF, 40.0F + 50.0iF, 41.0F + 51.0iF,
+ 42.0F + 52.0iF, 43.0F + 53.0iF, 44.0F + 54.0iF, 45.0F + 55.0iF };
+
+_Complex double c[N];
+_Complex double res[N] =
+ { 40.0F + 60.0iF, 42.0F + 62.0iF, 44.0F + 64.0iF, 46.0F + 66.0iF,
+ 48.0F + 68.0iF, 50.0F + 70.0iF, 52.0F + 72.0iF, 54.0F + 74.0iF,
+ 56.0F + 76.0iF, 58.0F + 78.0iF, 60.0F + 80.0iF, 62.0F + 82.0iF,
+ 64.0F + 84.0iF, 66.0F + 86.0iF, 68.0F + 88.0iF, 70.0F + 90.0iF };
+
+
+__attribute__ ((noinline)) void
+foo (void)
+{
+ int i;
+
+ for (i = 0; i < N; i++)
+ c[i] = a[i] + b[i];
+
+}
+
+int
+main (void)
+{
+ int i;
+ check_vect ();
+
+ foo ();
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ if (c[i] != res[i])
+ abort ();
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-complex-4.c b/gcc/testsuite/gcc.dg/vect/vect-complex-4.c
new file mode 100644
index 00000000000..85c416597f6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-complex-4.c
@@ -0,0 +1,109 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdio.h>
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 16
+
+struct foostr {
+ _Complex short f1;
+ _Complex short f2;
+};
+
+struct foostr a[16] __attribute__ ((__aligned__(16))) =
+ {
+ 11 + 23i, 24 + 22i,
+ 11 + 26i, 24 + 35i,
+ 19 + 20i, 29 + 14i,
+ 23 + 31i, 26 + 30i,
+ 29 + 39i, 24 + 18i,
+ 20 + 32i, 16 + 23i,
+ 13 + 26i, 37 + 34i,
+ 12 + 23i, 26 + 14i,
+ 36 + 14i, 31 + 17i,
+ 35 + 17i, 17 + 36i,
+ 13 + 34i, 19 + 12i,
+ 27 + 34i, 36 + 19i,
+ 21 + 39i, 16 + 33i,
+ 28 + 18i, 39 + 26i,
+ 32 + 27i, 13 + 38i,
+ 35 + 36i, 34 + 28i,
+ };
+
+struct foostr b[16] __attribute__ ((__aligned__(16))) =
+ {
+ 37 + 12i, 23 + 15i,
+ 14 + 11i, 13 + 25i,
+ 35 + 29i, 22 + 34i,
+ 24 + 34i, 16 + 39i,
+ 34 + 32i, 26 + 21i,
+ 34 + 36i, 11 + 37i,
+ 25 + 21i, 10 + 39i,
+ 10 + 36i, 35 + 22i,
+ 39 + 29i, 23 + 21i,
+ 34 + 33i, 39 + 14i,
+ 16 + 31i, 32 + 33i,
+ 20 + 14i, 35 + 30i,
+ 26 + 24i, 36 + 37i,
+ 31 + 20i, 32 + 28i,
+ 25 + 27i, 15 + 30i,
+ 10 + 31i, 37 + 37i,
+ };
+struct foostr c[16] __attribute__ ((__aligned__(16)));
+struct foostr res[N] =
+ {
+ 48 + 35i, 47 + 37i,
+ 25 + 37i, 37 + 60i,
+ 54 + 49i, 51 + 48i,
+ 47 + 65i, 42 + 69i,
+ 63 + 71i, 50 + 39i,
+ 54 + 68i, 27 + 60i,
+ 38 + 47i, 47 + 73i,
+ 22 + 59i, 61 + 36i,
+ 75 + 43i, 54 + 38i,
+ 69 + 50i, 56 + 50i,
+ 29 + 65i, 51 + 45i,
+ 47 + 48i, 71 + 49i,
+ 47 + 63i, 52 + 70i,
+ 59 + 38i, 71 + 54i,
+ 57 + 54i, 28 + 68i,
+ 45 + 67i, 71 + 65i,
+ };
+
+__attribute__ ((noinline)) void
+foo (void)
+{
+ int i;
+
+ for (i = 0; i < N; i++)
+ {
+ c[i].f1 = a[i].f1 + b[i].f1;
+ c[i].f2 = a[i].f2 + b[i].f2;
+ }
+
+}
+
+int
+main (void)
+{
+ int i;
+ check_vect ();
+
+ foo ();
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (c[i].f1 != res[i].f1)
+ abort ();
+ if (c[i].f2 != res[i].f2)
+ abort ();
+ }
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-complex-5.c b/gcc/testsuite/gcc.dg/vect/vect-complex-5.c
new file mode 100644
index 00000000000..91eb1f54b3c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-complex-5.c
@@ -0,0 +1,45 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdio.h>
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 16
+
+struct foostr {
+ _Complex short f1;
+ _Complex short f2;
+};
+
+_Complex short a1[64] __attribute__ ((__aligned__(16)));
+_Complex short a2[64] __attribute__ ((__aligned__(16)));
+_Complex short b1[64] __attribute__ ((__aligned__(16)));
+_Complex short b2[64] __attribute__ ((__aligned__(16)));
+struct foostr c[64] __attribute__ ((__aligned__(16)));
+
+__attribute__ ((noinline)) void
+foo (void)
+{
+ int i;
+
+ for (i = 0; i < N; i++)
+ {
+ c[i].f1 = a1[i] + b1[i];
+ c[i].f2 = a2[i] + b2[i];
+ }
+
+}
+
+int
+main (void)
+{
+ int i;
+ check_vect ();
+
+ foo ();
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-multitypes-12.c b/gcc/testsuite/gcc.dg/vect/vect-multitypes-12.c
new file mode 100644
index 00000000000..e4d5417547e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-multitypes-12.c
@@ -0,0 +1,44 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 64
+
+char x[N] __attribute__ ((__aligned__(16)));
+
+__attribute__ ((noinline)) int
+foo (int len, int *z) {
+ int i;
+
+ for (i=0; i<len; i++) {
+ z[i] = x[i];
+ }
+}
+
+
+int main (void)
+{
+ char i;
+ int z[N+4];
+
+ check_vect ();
+
+ for (i=0; i<N; i++) {
+ x[i] = i;
+ }
+
+ foo (N,z+2);
+
+ for (i=0; i<N; i++) {
+ if (z[i+2] != x[i])
+ abort ();
+ }
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" { target vect_unpack } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { ! vect_unpack } } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
+
diff --git a/gcc/testsuite/gcc.dg/vect/vect-multitypes-13.c b/gcc/testsuite/gcc.dg/vect/vect-multitypes-13.c
new file mode 100644
index 00000000000..32b3131ee20
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-multitypes-13.c
@@ -0,0 +1,63 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 64
+
+unsigned char uX[N] __attribute__ ((__aligned__(16)));
+unsigned int uresult[N];
+signed char X[N] __attribute__ ((__aligned__(16)));
+int result[N];
+
+/* Unsigned type promotion (qi->si) */
+__attribute__ ((noinline)) int
+foo1(int len) {
+ int i;
+
+ for (i=0; i<len; i++) {
+ uresult[i] = (unsigned int)uX[i];
+ }
+}
+
+/* Signed type promotion (qi->si) */
+__attribute__ ((noinline)) int
+foo2(int len) {
+ int i;
+
+ for (i=0; i<len; i++) {
+ result[i] = (int)X[i];
+ }
+}
+
+int main (void)
+{
+ int i;
+
+ check_vect ();
+
+ for (i=0; i<N; i++) {
+ X[i] = 16-i;
+ uX[i] = 16-i;
+ }
+
+ foo1 (N);
+
+ for (i=0; i<N; i++) {
+ if (uresult[i] != (unsigned int)uX[i])
+ abort ();
+ }
+
+ foo2 (N);
+
+ for (i=0; i<N; i++) {
+ if (result[i] != (int)X[i])
+ abort ();
+ }
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" { target vect_unpack } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
+
diff --git a/gcc/testsuite/gcc.dg/vect/vect-multitypes-14.c b/gcc/testsuite/gcc.dg/vect/vect-multitypes-14.c
new file mode 100644
index 00000000000..970535ff660
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-multitypes-14.c
@@ -0,0 +1,50 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 64
+
+unsigned char uX[N] __attribute__ ((__aligned__(16)));
+unsigned char uresultX[N];
+unsigned int uY[N] __attribute__ ((__aligned__(16)));
+unsigned char uresultY[N];
+
+/* Unsigned type demotion (si->qi) */
+
+__attribute__ ((noinline)) int
+foo1(int len) {
+ int i;
+
+ for (i=0; i<len; i++) {
+ uresultX[i] = uX[i];
+ uresultY[i] = (unsigned char)uY[i];
+ }
+}
+
+int main (void)
+{
+ int i;
+
+ check_vect ();
+
+ for (i=0; i<N; i++) {
+ uX[i] = 16-i;
+ uY[i] = 16-i;
+ }
+
+ foo1 (N);
+
+ for (i=0; i<N; i++) {
+ if (uresultX[i] != uX[i])
+ abort ();
+ if (uresultY[i] != (unsigned char)uY[i])
+ abort ();
+ }
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_pack_trunc } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
+
diff --git a/gcc/testsuite/gcc.dg/vect/vect-multitypes-15.c b/gcc/testsuite/gcc.dg/vect/vect-multitypes-15.c
new file mode 100644
index 00000000000..458705adada
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-multitypes-15.c
@@ -0,0 +1,50 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+#include <stdio.h>
+
+#define N 64
+
+#define DOT1 43680
+#define DOT2 -20832
+
+signed char X[N] __attribute__ ((__aligned__(16)));
+signed char Y[N] __attribute__ ((__aligned__(16)));
+unsigned char CX[N] __attribute__ ((__aligned__(16)));
+
+__attribute__ ((noinline)) void
+foo1(int len) {
+ int i;
+ int result1 = 0;
+
+ for (i=0; i<len; i++) {
+ result1 += (X[i] * Y[i]);
+ CX[i] = 5;
+ }
+
+ if (result1 != DOT1)
+ abort ();
+}
+
+
+int main (void)
+{
+ int i, dot1, dot2;
+
+ check_vect ();
+
+ for (i=0; i<N; i++) {
+ X[i] = i;
+ Y[i] = 64-i;
+ CX[i] = i;
+ }
+
+ foo1 (N);
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_sdot_hi || vect_uncpack } } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
+
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-4a.c b/gcc/testsuite/gcc.dg/vect/vect-outer-4a.c
index 8fd1a03db14..d7bcc9a2e8c 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-outer-4a.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-4a.c
@@ -6,8 +6,7 @@ signed short in[N+M];
signed short coeff[M];
signed short out[N];
-/* Outer-loop vectorization.
- Currently not vectorized because of multiple-data-types in the inner-loop. */
+/* Outer-loop vectorization. */
void
foo (){
@@ -23,9 +22,5 @@ foo (){
}
}
-/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" { xfail *-*-* } } } */
-/* FORNOW. not vectorized until we support 0-stride acceses like coeff[j]. should be:
- { scan-tree-dump-not "multiple types in nested loop." "vect" { xfail *-*-* } } } */
-
-/* { dg-final { scan-tree-dump-times "zero step in outer loop." 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" { target { vect_widen_mult_hi_to_si && vect_pack_trunc } } } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-4b.c b/gcc/testsuite/gcc.dg/vect/vect-outer-4b.c
index ba2f7b4d0df..407315a8dc3 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-outer-4b.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-4b.c
@@ -6,8 +6,7 @@ signed short in[N+M];
signed short coeff[M];
int out[N];
-/* Outer-loop vectorization.
- Currently not vectorized because of multiple-data-types in the inner-loop. */
+/* Outer-loop vectorization. */
void
foo (){
@@ -23,9 +22,5 @@ foo (){
}
}
-/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" { xfail *-*-* } } } */
-/* FORNOW. not vectorized until we support 0-stride acceses like coeff[j]. should be:
- { scan-tree-dump-not "multiple types in nested loop." "vect" { xfail *-*-* } } } */
-
-/* { dg-final { scan-tree-dump-times "zero step in outer loop." 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" { target vect_widen_mult_hi_to_si } } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-4f.c b/gcc/testsuite/gcc.dg/vect/vect-outer-4f.c
index cef37c42321..88d6b7abccd 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-outer-4f.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-4f.c
@@ -2,7 +2,7 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 40
+#define N 96
#define M 128
unsigned short in[N+M];
unsigned int out[N];
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-4g.c b/gcc/testsuite/gcc.dg/vect/vect-outer-4g.c
index cef37c42321..88d6b7abccd 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-outer-4g.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-4g.c
@@ -2,7 +2,7 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 40
+#define N 96
#define M 128
unsigned short in[N+M];
unsigned int out[N];
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-4i.c b/gcc/testsuite/gcc.dg/vect/vect-outer-4i.c
index bc43c5bc6d5..a244ac20ac2 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-outer-4i.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-4i.c
@@ -1,13 +1,17 @@
-/* { dg-do compile } */
+/* { dg-require-effective-target vect_int } */
-#define N 40
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 96
#define M 128
unsigned char in[N+M];
unsigned short out[N];
/* Outer-loop vectorization. */
-/* Not vectorized due to multiple-types in the inner-loop. */
+/* Multiple-types in the inner-loop. */
+__attribute__ ((noinline))
unsigned short
foo (){
int i,j;
@@ -24,5 +28,22 @@ foo (){
return s;
}
-/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" { xfail *-*-* } } } */
+int main (void)
+{
+ check_vect ();
+ int i;
+ unsigned short s;
+
+ for (i = 0; i < N+M; i++)
+ in[i] = (unsigned char)i;
+
+ s = foo ();
+
+ if (s != 34048)
+ abort ();
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" { target vect_unpack } } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-4j.c b/gcc/testsuite/gcc.dg/vect/vect-outer-4j.c
index 7e1b7ec81ee..db8f61c5e37 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-outer-4j.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-4j.c
@@ -1,12 +1,11 @@
/* { dg-do compile } */
-#define N 40
+#define N 96
#define M 128
unsigned char in[N+M];
unsigned short out[N];
/* Outer-loop vectorization. */
-/* Not vectorized due to multiple-types in the inner-loop. */
void
foo (){
@@ -22,5 +21,5 @@ foo (){
}
}
-/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" { target vect_unpack } } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-4k.c b/gcc/testsuite/gcc.dg/vect/vect-outer-4k.c
index cef37c42321..88d6b7abccd 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-outer-4k.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-4k.c
@@ -2,7 +2,7 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 40
+#define N 96
#define M 128
unsigned short in[N+M];
unsigned int out[N];
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-4l.c b/gcc/testsuite/gcc.dg/vect/vect-outer-4l.c
index cef37c42321..88d6b7abccd 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-outer-4l.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-4l.c
@@ -2,7 +2,7 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 40
+#define N 96
#define M 128
unsigned short in[N+M];
unsigned int out[N];
diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-s8c.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-s8c.c
index 081a5305a0d..80377bae9a4 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-s8c.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-s8c.c
@@ -11,8 +11,7 @@ signed char X[N] __attribute__ ((__aligned__(16)));
signed char Y[N] __attribute__ ((__aligned__(16)));
/* char->int->int dot product.
- Not detected as a dot-product pattern.
- Currently fails to be vectorized due to presence of type conversions. */
+ Not detected as a dot-product pattern. */
__attribute__ ((noinline)) int
foo3(int len) {
int i;
@@ -42,6 +41,5 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */
-
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_unpack } } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-u8a.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-u8a.c
index 38f8a6955ba..d8aefdad1a6 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-u8a.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-u8a.c
@@ -44,6 +44,8 @@ int main (void)
for (i=0; i<N; i++) {
X[i] = i;
Y[i] = 64-i;
+ if (i%5 == 0)
+ X[i] = i;
}
dot = foo (N);
diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-u8b.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-u8b.c
index bfe3769008b..5496f6af920 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-u8b.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-u8b.c
@@ -39,6 +39,9 @@ int main (void)
for (i=0; i<N; i++) {
X[i] = i;
Y[i] = 64-i;
+ /* Avoid vectorization. */
+ if (i%100 == 0)
+ X[i] = i;
}
dot = foo (N);
@@ -54,7 +57,7 @@ int main (void)
targets that support accumulation into int (powerpc, ia64) we'd have:
dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_udot_qi || vect_widen_mult_qi_to_hi } }
*/
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" {target vect_widen_mult_qi_to_hi} } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" {target { vect_widen_mult_qi_to_hi || vect_unpack } } } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1b.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1b.c
index 7d8bbf38001..6effa87ebb5 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1b.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1b.c
@@ -35,6 +35,6 @@ main (void)
}
/* { dg-final { scan-tree-dump-times "vect_recog_widen_sum_pattern: detected" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_widen_sum_qi_to_si } } } */
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" { target { ! vect_widen_sum_qi_to_si } } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_widen_sum_qi_to_si || vect_unpack } } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" { target { { ! vect_widen_sum_qi_to_si } && { ! vect_unpack } } } } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-2b.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-2b.c
index b24df184896..53d5f0d5cce 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-2b.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-2b.c
@@ -35,6 +35,6 @@ main (void)
}
/* { dg-final { scan-tree-dump-times "vect_recog_widen_sum_pattern: detected" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_widen_sum_qi_to_si } } } */
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" { target { ! vect_widen_sum_qi_to_si } } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_widen_sum_qi_to_si && vect_unpack } } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" { target { { ! vect_widen_sum_qi_to_si } && { ! vect_unpack } } } } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-strided-float.c b/gcc/testsuite/gcc.dg/vect/vect-strided-float.c
index 690cf94a47a..2417f2acd39 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-strided-float.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-strided-float.c
@@ -38,7 +38,7 @@ int main (void)
}
/* Needs interleaving support. */
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_interleave && vect_extract_even_odd } } } } */
-/* { dg-final { scan-tree-dump-times "vectorized 0 loops" 1 "vect" { xfail { vect_interleave && vect_extract_even_odd } } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_interleave && vect_extract_even_odd_wide } } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 0 loops" 1 "vect" { xfail { vect_interleave && vect_extract_even_odd_wide } } } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-strided-store-a-u8-i2.c b/gcc/testsuite/gcc.dg/vect/vect-strided-store-a-u8-i2.c
index dc6c6e3c400..8548d267ede 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-strided-store-a-u8-i2.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-strided-store-a-u8-i2.c
@@ -24,8 +24,8 @@ main1 ()
{
a[i] = i;
b[i] = i * 2;
- if (a[i] == 178)
- abort();
+ if (i%3 == 0)
+ a[i] = 10;
}
for (i = 0; i < N; i++)
diff --git a/gcc/testsuite/gcc.dg/vect/vect-widen-mult-u8.c b/gcc/testsuite/gcc.dg/vect/vect-widen-mult-u8.c
index 6052943ae07..63bd00227d7 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-widen-mult-u8.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-widen-mult-u8.c
@@ -28,6 +28,8 @@ int main (void)
for (i=0; i<N; i++) {
X[i] = i;
Y[i] = 64-i;
+ if (i%4 == 0)
+ X[i] = 5;
}
foo1 (N);
@@ -40,6 +42,6 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_widen_mult_qi_to_hi } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_widen_mult_qi_to_hi || vect_unpack } } } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/wrapv-vect-reduc-dot-s8b.c b/gcc/testsuite/gcc.dg/vect/wrapv-vect-reduc-dot-s8b.c
index 8307af4435a..31eb3f62054 100644
--- a/gcc/testsuite/gcc.dg/vect/wrapv-vect-reduc-dot-s8b.c
+++ b/gcc/testsuite/gcc.dg/vect/wrapv-vect-reduc-dot-s8b.c
@@ -40,6 +40,8 @@ int main (void)
for (i=0; i<N; i++) {
X[i] = i;
Y[i] = 64-i;
+ if (i%5 == 0)
+ X[i] = i;
}
dot = foo (N);
@@ -57,6 +59,6 @@ int main (void)
dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_sdot_qi } }
*/
/* In the meantime expect: */
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_widen_mult_qi_to_hi } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_widen_mult_qi_to_hi || vect_unpack } } } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/visibility-14.c b/gcc/testsuite/gcc.dg/visibility-14.c
new file mode 100644
index 00000000000..6b75608f2ac
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/visibility-14.c
@@ -0,0 +1,9 @@
+/* Test that called external functions are marked. */
+/* { dg-do compile } */
+/* { dg-require-visibility "" } */
+/* { dg-final { scan-hidden "foo" } } */
+
+extern void foo(void) __attribute__ ((visibility ("hidden")));
+int f () {
+ foo();
+}
diff --git a/gcc/testsuite/gcc.dg/visibility-15.c b/gcc/testsuite/gcc.dg/visibility-15.c
new file mode 100644
index 00000000000..4a3aa6803f0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/visibility-15.c
@@ -0,0 +1,11 @@
+/* Test that accessed external functions are marked. */
+/* { dg-do compile } */
+/* { dg-require-visibility "" } */
+/* { dg-final { scan-hidden "foo" } } */
+
+extern void foo(void) __attribute__ ((visibility ("hidden")));
+typedef void (*foo_t)(void);
+
+foo_t g(void) {
+ return foo;
+}
diff --git a/gcc/testsuite/gcc.dg/visibility-16.c b/gcc/testsuite/gcc.dg/visibility-16.c
new file mode 100644
index 00000000000..055d00f4856
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/visibility-16.c
@@ -0,0 +1,9 @@
+/* Test that accessed external variables are marked. */
+/* { dg-do compile } */
+/* { dg-require-visibility "" } */
+/* { dg-final { scan-hidden "foo" } } */
+
+extern int foo __attribute__ ((visibility ("hidden")));
+int f () {
+ return foo;
+}
diff --git a/gcc/testsuite/gcc.dg/visibility-17.c b/gcc/testsuite/gcc.dg/visibility-17.c
new file mode 100644
index 00000000000..99a1bc276de
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/visibility-17.c
@@ -0,0 +1,9 @@
+/* Test that external variable whose address is taken are marked. */
+/* { dg-do compile } */
+/* { dg-require-visibility "" } */
+/* { dg-final { scan-hidden "foo" } } */
+
+extern int foo __attribute__ ((visibility ("hidden")));
+int *f () {
+ return &foo;
+}
diff --git a/gcc/testsuite/gcc.dg/visibility-18.c b/gcc/testsuite/gcc.dg/visibility-18.c
new file mode 100644
index 00000000000..4e8706640ad
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/visibility-18.c
@@ -0,0 +1,7 @@
+/* Test that external variable whose address is taken are marked. */
+/* { dg-do compile } */
+/* { dg-require-visibility "" } */
+/* { dg-final { scan-hidden "foo" } } */
+
+extern int foo __attribute__ ((visibility ("hidden")));
+int *test = &foo;
diff --git a/gcc/testsuite/gcc.dg/visibility-19.c b/gcc/testsuite/gcc.dg/visibility-19.c
new file mode 100644
index 00000000000..f56f1360678
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/visibility-19.c
@@ -0,0 +1,8 @@
+/* Test that accessed external functions are marked. */
+/* { dg-do compile } */
+/* { dg-require-visibility "" } */
+/* { dg-final { scan-hidden "foo" } } */
+
+extern void foo(void) __attribute__ ((visibility ("hidden")));
+typedef void (*foo_t)(void);
+foo_t test = foo;
diff --git a/gcc/testsuite/gcc.dg/visibility-7.c b/gcc/testsuite/gcc.dg/visibility-7.c
index aaa8165e3e0..016f3dda6f3 100644
--- a/gcc/testsuite/gcc.dg/visibility-7.c
+++ b/gcc/testsuite/gcc.dg/visibility-7.c
@@ -5,7 +5,7 @@
extern int
__attribute__((visibility ("hidden")))
-xyzzy; /* { dg-warning "previous declaration" "" } */
+xyzzy; /* { dg-message "note: previous declaration" "" } */
int
__attribute__((visibility ("protected")))
diff --git a/gcc/testsuite/gcc.dg/winline-4.c b/gcc/testsuite/gcc.dg/winline-4.c
deleted file mode 100644
index 5ce0a02202d..00000000000
--- a/gcc/testsuite/gcc.dg/winline-4.c
+++ /dev/null
@@ -1,11 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-Winline -O1 -fno-unit-at-a-time" } */
-
-inline int q(void); /* { dg-warning "body not available" } */
-inline int t(void)
-{
- return q(); /* { dg-warning "called from here" } */
-}
-int q(void)
-{
-}
diff --git a/gcc/testsuite/gcc.dg/wtr-static-1.c b/gcc/testsuite/gcc.dg/wtr-static-1.c
index 42760e8cf6b..318b2f32ca2 100644
--- a/gcc/testsuite/gcc.dg/wtr-static-1.c
+++ b/gcc/testsuite/gcc.dg/wtr-static-1.c
@@ -4,7 +4,7 @@
/* { dg-do compile } */
/* { dg-options "-Wtraditional" } */
-static void testfunc1(void); /* { dg-warning "previous declaration" } */
+static void testfunc1(void); /* { dg-message "note: previous declaration" } */
void testfunc1() {} /* { dg-warning "non-static.*follows static" "non-static follows static" } */
# 11 "sys-header.h" 3
diff --git a/gcc/testsuite/gcc.target/i386/20060512-1.c b/gcc/testsuite/gcc.target/i386/20060512-1.c
index 3defe648ba7..8109f94b75c 100644
--- a/gcc/testsuite/gcc.target/i386/20060512-1.c
+++ b/gcc/testsuite/gcc.target/i386/20060512-1.c
@@ -1,6 +1,6 @@
/* { dg-do run } */
/* { dg-require-effective-target ilp32 } */
-/* { dg-options "-std=gnu99 -msse2" } */
+/* { dg-options "-std=gnu99 -msse2 -mpreferred-stack-boundary=4" } */
#include "sse2-check.h"
@@ -28,7 +28,7 @@ sse2_test (void)
int result;
asm ("pushl %esi"); /* Disalign runtime stack. */
result = self_aligning_function (g_1, g_2);
- asm ("popl %esi");
if (result != 42)
abort ();
+ asm ("popl %esi");
}
diff --git a/gcc/testsuite/gcc.target/i386/20060512-2.c b/gcc/testsuite/gcc.target/i386/20060512-2.c
index 0e446cf899e..fe1af563578 100644
--- a/gcc/testsuite/gcc.target/i386/20060512-2.c
+++ b/gcc/testsuite/gcc.target/i386/20060512-2.c
@@ -1,12 +1,12 @@
/* { dg-do compile } */
/* { dg-require-effective-target ilp32 } */
-/* { dg-options "-std=gnu99" } */
+/* { dg-options "-std=gnu99 -mpreferred-stack-boundary=4" } */
int
outer_function (int x, int y)
{
int __attribute__ ((__noinline__, __force_align_arg_pointer__))
nested_function (int x, int y)
- { /* { dg-error "force_align_arg_pointer not supported for nested functions" } */
+ {
return (x + y);
}
return (3 + nested_function (x, y));
diff --git a/gcc/testsuite/gcc.target/i386/20060512-3.c b/gcc/testsuite/gcc.target/i386/20060512-3.c
index 5ffa8129e38..847f0eb6d35 100644
--- a/gcc/testsuite/gcc.target/i386/20060512-3.c
+++ b/gcc/testsuite/gcc.target/i386/20060512-3.c
@@ -1,6 +1,6 @@
/* { dg-do run } */
/* { dg-require-effective-target ilp32 } */
-/* { dg-options "-std=gnu99 -msse2 -mstackrealign" } */
+/* { dg-options "-std=gnu99 -msse2 -mstackrealign -mpreferred-stack-boundary=4" } */
#include "sse2-check.h"
@@ -28,7 +28,7 @@ sse2_test (void)
int result;
asm ("pushl %esi"); /* Disalign runtime stack. */
result = self_aligning_function (g_1, g_2);
- asm ("popl %esi");
if (result != 42)
abort ();
+ asm ("popl %esi");
}
diff --git a/gcc/testsuite/gcc.target/i386/20060512-4.c b/gcc/testsuite/gcc.target/i386/20060512-4.c
index f2dd26486b6..ee7b8a4ad88 100644
--- a/gcc/testsuite/gcc.target/i386/20060512-4.c
+++ b/gcc/testsuite/gcc.target/i386/20060512-4.c
@@ -1,12 +1,12 @@
/* { dg-do compile } */
/* { dg-require-effective-target ilp32 } */
-/* { dg-options "-mstackrealign" } */
+/* { dg-options "-mstackrealign -mpreferred-stack-boundary=4" } */
int
outer_function (int x, int y)
{
int __attribute__ ((__noinline__))
nested_function (int x, int y)
- { /* { dg-warning "-mstackrealign ignored for nested functions" } */
+ {
return (x + y);
}
return (3 + nested_function (x, y));
diff --git a/gcc/testsuite/gcc.target/i386/20080723-1.c b/gcc/testsuite/gcc.target/i386/20080723-1.c
new file mode 100644
index 00000000000..a2ed5bf86df
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/20080723-1.c
@@ -0,0 +1,49 @@
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+extern void abort (void);
+extern void exit (int);
+
+static inline __attribute__((always_inline))
+void
+prefetch (void *x)
+{
+ asm volatile("prefetcht0 %0" : : "m" (*(unsigned long *)x));
+}
+
+struct hlist_head
+{
+ struct hlist_node *first;
+};
+
+struct hlist_node
+{
+ struct hlist_node *next;
+ unsigned long i_ino;
+};
+
+struct hlist_node * find_inode_fast(struct hlist_head *head, unsigned long ino)
+{
+ struct hlist_node *node;
+
+ for (node = head->first;
+ node && (prefetch (node->next), 1);
+ node = node->next)
+ {
+ if (node->i_ino == ino)
+ break;
+ }
+ return node ? node : 0;
+}
+
+struct hlist_node g2;
+struct hlist_node g1 = { &g2 };
+struct hlist_head h = { &g1 };
+
+int
+main()
+{
+ if (find_inode_fast (&h, 1) != 0)
+ abort ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.target/i386/align-main-1.c b/gcc/testsuite/gcc.target/i386/align-main-1.c
new file mode 100644
index 00000000000..5bbc101c0c7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/align-main-1.c
@@ -0,0 +1,25 @@
+/* Test for stack alignment when PREFERRED_STACK_BOUNDARY < alignment
+ of local variable. */
+/* { dg-do compile } */
+/* { dg-options "-O2 -mpreferred-stack-boundary=6 -mincoming-stack-boundary=6" } */
+/* { dg-final { scan-assembler "and\[lq\]?\[\\t \]*\\$-128,\[\\t \]*%\[re\]?sp" } } */
+/* { dg-final { scan-assembler-not "and\[lq\]?\[\\t \]*\\$-64,\[\\t \]*%\[re\]?sp" } } */
+
+#include <stddef.h>
+
+#define ALIGNMENT 128
+typedef int aligned __attribute__((aligned(ALIGNMENT)));
+extern void abort(void);
+
+void check(void * a)
+{
+ if (((ptrdiff_t)a & (ALIGNMENT-1)) != 0)
+ abort();
+}
+
+int main()
+{
+ aligned a = 1;
+ check(&a);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/align-main-2.c b/gcc/testsuite/gcc.target/i386/align-main-2.c
new file mode 100644
index 00000000000..df45f0e5106
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/align-main-2.c
@@ -0,0 +1,25 @@
+/* Test for stack alignment when PREFERRED_STACK_BOUNDARY > alignment
+ of local variable. */
+/* { dg-do compile } */
+/* { dg-options "-O2 -mpreferred-stack-boundary=6 -mincoming-stack-boundary=6" } */
+/* { dg-final { scan-assembler "and\[lq\]?\[\\t \]*\\$-64,\[\\t \]*%\[re\]?sp" } } */
+/* { dg-final { scan-assembler-not "and\[lq\]?\[\\t \]*\\$-128,\[\\t \]*%\[re\]?sp" } } */
+
+#include <stddef.h>
+
+#define ALIGNMENT 32
+typedef int aligned __attribute__((aligned(ALIGNMENT)));
+extern void abort(void);
+
+void check(void * a)
+{
+ if (((ptrdiff_t)a & (ALIGNMENT-1)) != 0)
+ abort();
+}
+
+int main()
+{
+ aligned a = 1;
+ check(&a);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/cmov8.c b/gcc/testsuite/gcc.target/i386/cmov8.c
new file mode 100644
index 00000000000..639fb62b0c0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cmov8.c
@@ -0,0 +1,13 @@
+/* PR target/36936 */
+/* { dg-do compile } */
+/* { dg-require-effective-target ilp32 } */
+/* { dg-options "-O2 -march=i686" } */
+/* { dg-final { scan-assembler "cmov\[^8\]" } } */
+
+int
+foo (int x)
+{
+ if (x < 0)
+ x = 1;
+ return x;
+}
diff --git a/gcc/testsuite/gcc.target/i386/cold-1.c b/gcc/testsuite/gcc.target/i386/cold-1.c
new file mode 100644
index 00000000000..bcdc471eb58
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cold-1.c
@@ -0,0 +1,13 @@
+/* Test whether using attribute((cold)) really turns on -Os. Do this test
+ by checking whether strcpy calls the library function rather than doing
+ the move inline. */
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=k8" } */
+/* { dg-final { scan-assembler "(jmp|call)\t(.*)strcpy" } } */
+
+void cold (char *) __attribute__((__cold__));
+
+void cold (char *a)
+{
+ __builtin_strcpy (a, "testing 1.2.3 testing 1.2.3");
+}
diff --git a/gcc/testsuite/gcc.target/i386/funcspec-1.c b/gcc/testsuite/gcc.target/i386/funcspec-1.c
new file mode 100644
index 00000000000..1ee43a0bbb8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/funcspec-1.c
@@ -0,0 +1,34 @@
+/* Test whether using target specific options, we can generate SSE2 code on
+ 32-bit, which does not generate SSE2 by default, but still generate 387 code
+ for a function that doesn't use attribute((option)). */
+/* { dg-do compile } */
+/* { dg-require-effective-target ilp32 } */
+/* { dg-options "-O3 -ftree-vectorize -march=i386" } */
+/* { dg-final { scan-assembler "addps\[ \t\]" } } */
+/* { dg-final { scan-assembler "fsubs\[ \t\]" } } */
+
+#ifndef SIZE
+#define SIZE 1024
+#endif
+
+static float a[SIZE] __attribute__((__aligned__(16)));
+static float b[SIZE] __attribute__((__aligned__(16)));
+static float c[SIZE] __attribute__((__aligned__(16)));
+
+void sse_addnums (void) __attribute__ ((__option__ ("sse2")));
+
+void
+sse_addnums (void)
+{
+ int i = 0;
+ for (; i < SIZE; ++i)
+ a[i] = b[i] + c[i];
+}
+
+void
+i387_subnums (void)
+{
+ int i = 0;
+ for (; i < SIZE; ++i)
+ a[i] = b[i] - c[i];
+}
diff --git a/gcc/testsuite/gcc.target/i386/funcspec-10.c b/gcc/testsuite/gcc.target/i386/funcspec-10.c
new file mode 100644
index 00000000000..9446cdf8f35
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/funcspec-10.c
@@ -0,0 +1,15 @@
+/* PR target/36936 */
+/* { dg-do compile } */
+/* { dg-require-effective-target ilp32 } */
+/* { dg-options "-O2 -march=i686" } */
+/* { dg-final { scan-assembler-not "cmov" } } */
+
+extern int foo (int) __attribute__((__option__("arch=i386")));
+
+int
+foo (int x)
+{
+ if (x < 0)
+ x = 1;
+ return x;
+}
diff --git a/gcc/testsuite/gcc.target/i386/funcspec-11.c b/gcc/testsuite/gcc.target/i386/funcspec-11.c
new file mode 100644
index 00000000000..ec32e0c669e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/funcspec-11.c
@@ -0,0 +1,15 @@
+/* PR target/36936 */
+/* { dg-do compile } */
+/* { dg-require-effective-target ilp32 } */
+/* { dg-options "-O2 -march=i386" } */
+/* { dg-final { scan-assembler "cmov" } } */
+
+extern int foo (int) __attribute__((__option__("arch=i686")));
+
+int
+foo (int x)
+{
+ if (x < 0)
+ x = 1;
+ return x;
+}
diff --git a/gcc/testsuite/gcc.target/i386/funcspec-2.c b/gcc/testsuite/gcc.target/i386/funcspec-2.c
new file mode 100644
index 00000000000..eb6f48bae1f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/funcspec-2.c
@@ -0,0 +1,99 @@
+/* Test whether using target specific options, we can generate SSE5 code. */
+/* { dg-do compile } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-options "-O2 -march=k8" } */
+
+extern void exit (int);
+
+#define SSE5_ATTR __attribute__((__option__("sse5,fused-madd")))
+extern float flt_mul_add (float a, float b, float c) SSE5_ATTR;
+extern float flt_mul_sub (float a, float b, float c) SSE5_ATTR;
+extern float flt_neg_mul_add (float a, float b, float c) SSE5_ATTR;
+extern float flt_neg_mul_sub (float a, float b, float c) SSE5_ATTR;
+
+extern double dbl_mul_add (double a, double b, double c) SSE5_ATTR;
+extern double dbl_mul_sub (double a, double b, double c) SSE5_ATTR;
+extern double dbl_neg_mul_add (double a, double b, double c) SSE5_ATTR;
+extern double dbl_neg_mul_sub (double a, double b, double c) SSE5_ATTR;
+
+float
+flt_mul_add (float a, float b, float c)
+{
+ return (a * b) + c;
+}
+
+double
+dbl_mul_add (double a, double b, double c)
+{
+ return (a * b) + c;
+}
+
+float
+flt_mul_sub (float a, float b, float c)
+{
+ return (a * b) - c;
+}
+
+double
+dbl_mul_sub (double a, double b, double c)
+{
+ return (a * b) - c;
+}
+
+float
+flt_neg_mul_add (float a, float b, float c)
+{
+ return (-(a * b)) + c;
+}
+
+double
+dbl_neg_mul_add (double a, double b, double c)
+{
+ return (-(a * b)) + c;
+}
+
+float
+flt_neg_mul_sub (float a, float b, float c)
+{
+ return (-(a * b)) - c;
+}
+
+double
+dbl_neg_mul_sub (double a, double b, double c)
+{
+ return (-(a * b)) - c;
+}
+
+float f[10] = { 2, 3, 4 };
+double d[10] = { 2, 3, 4 };
+
+int main ()
+{
+ f[3] = flt_mul_add (f[0], f[1], f[2]);
+ f[4] = flt_mul_sub (f[0], f[1], f[2]);
+ f[5] = flt_neg_mul_add (f[0], f[1], f[2]);
+ f[6] = flt_neg_mul_sub (f[0], f[1], f[2]);
+
+ d[3] = dbl_mul_add (d[0], d[1], d[2]);
+ d[4] = dbl_mul_sub (d[0], d[1], d[2]);
+ d[5] = dbl_neg_mul_add (d[0], d[1], d[2]);
+ d[6] = dbl_neg_mul_sub (d[0], d[1], d[2]);
+ exit (0);
+}
+
+/* { dg-final { scan-assembler "fmaddss" } } */
+/* { dg-final { scan-assembler "fmaddsd" } } */
+/* { dg-final { scan-assembler "fmsubss" } } */
+/* { dg-final { scan-assembler "fmsubsd" } } */
+/* { dg-final { scan-assembler "fnmaddss" } } */
+/* { dg-final { scan-assembler "fnmaddsd" } } */
+/* { dg-final { scan-assembler "fnmsubss" } } */
+/* { dg-final { scan-assembler "fnmsubsd" } } */
+/* { dg-final { scan-assembler "call\t(.*)flt_mul_add" } } */
+/* { dg-final { scan-assembler "call\t(.*)flt_mul_sub" } } */
+/* { dg-final { scan-assembler "call\t(.*)flt_neg_mul_add" } } */
+/* { dg-final { scan-assembler "call\t(.*)flt_neg_mul_sub" } } */
+/* { dg-final { scan-assembler "call\t(.*)dbl_mul_add" } } */
+/* { dg-final { scan-assembler "call\t(.*)dbl_mul_sub" } } */
+/* { dg-final { scan-assembler "call\t(.*)dbl_neg_mul_add" } } */
+/* { dg-final { scan-assembler "call\t(.*)dbl_neg_mul_sub" } } */
diff --git a/gcc/testsuite/gcc.target/i386/funcspec-3.c b/gcc/testsuite/gcc.target/i386/funcspec-3.c
new file mode 100644
index 00000000000..80ec23da09f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/funcspec-3.c
@@ -0,0 +1,66 @@
+/* Test whether using target specific options, we can generate popcnt by
+ setting the architecture. */
+/* { dg-do compile } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-options "-O2 -march=k8" } */
+
+extern void exit (int);
+extern void abort (void);
+
+#define SSE4A_ATTR __attribute__((__option__("arch=amdfam10")))
+#define SSE42_ATTR __attribute__((__option__("sse4.2")))
+
+static int sse4a_pop_i (int a) SSE4A_ATTR;
+static long sse42_pop_l (long a) SSE42_ATTR;
+static int generic_pop_i (int a);
+static long generic_pop_l (long a);
+
+static
+int sse4a_pop_i (int a)
+{
+ return __builtin_popcount (a);
+}
+
+static
+long sse42_pop_l (long a)
+{
+ return __builtin_popcountl (a);
+}
+
+static
+int generic_pop_i (int a)
+{
+ return __builtin_popcount (a);
+}
+
+static
+long generic_pop_l (long a)
+{
+ return __builtin_popcountl (a);
+}
+
+int five = 5;
+long seven = 7;
+
+int main ()
+{
+ if (sse4a_pop_i (five) != 2)
+ abort ();
+
+ if (sse42_pop_l (seven) != 3L)
+ abort ();
+
+ if (generic_pop_i (five) != 2)
+ abort ();
+
+ if (generic_pop_l (seven) != 3L)
+ abort ();
+
+ exit (0);
+}
+
+/* { dg-final { scan-assembler "popcntl" } } */
+/* { dg-final { scan-assembler "popcntq" } } */
+/* { dg-final { scan-assembler "call\t(.*)sse4a_pop_i" } } */
+/* { dg-final { scan-assembler "call\t(.*)sse42_pop_l" } } */
+/* { dg-final { scan-assembler "call\t(.*)popcountdi2" } } */
diff --git a/gcc/testsuite/gcc.target/i386/funcspec-4.c b/gcc/testsuite/gcc.target/i386/funcspec-4.c
new file mode 100644
index 00000000000..71251c314bb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/funcspec-4.c
@@ -0,0 +1,14 @@
+/* Test some error conditions with function specific options. */
+/* { dg-do compile } */
+
+/* no sse500 switch */
+extern void error1 (void) __attribute__((__option__("sse500"))); /* { dg-error "unknown" } */
+
+/* Multiple arch switches */
+extern void error2 (void) __attribute__((__option__("arch=core2,arch=k8"))); /* { dg-error "already specified" } */
+
+/* Unknown tune target */
+extern void error3 (void) __attribute__((__option__("tune=foobar"))); /* { dg-error "bad value" } */
+
+/* option on a variable */
+extern int error4 __attribute__((__option__("sse2"))); /* { dg-warning "ignored" } */
diff --git a/gcc/testsuite/gcc.target/i386/funcspec-5.c b/gcc/testsuite/gcc.target/i386/funcspec-5.c
new file mode 100644
index 00000000000..d4204bb1411
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/funcspec-5.c
@@ -0,0 +1,125 @@
+/* Test whether all of the 32-bit function specific options are accepted
+ without error. */
+/* { dg-do compile } */
+/* { dg-require-effective-target ilp32 } */
+
+extern void test_abm (void) __attribute__((__option__("abm")));
+extern void test_aes (void) __attribute__((__option__("aes")));
+extern void test_fused_madd (void) __attribute__((__option__("fused-madd")));
+extern void test_mmx (void) __attribute__((__option__("mmx")));
+extern void test_pclmul (void) __attribute__((__option__("pclmul")));
+extern void test_popcnt (void) __attribute__((__option__("popcnt")));
+extern void test_recip (void) __attribute__((__option__("recip")));
+extern void test_sse (void) __attribute__((__option__("sse")));
+extern void test_sse2 (void) __attribute__((__option__("sse2")));
+extern void test_sse3 (void) __attribute__((__option__("sse3")));
+extern void test_sse4 (void) __attribute__((__option__("sse4")));
+extern void test_sse4_1 (void) __attribute__((__option__("sse4.1")));
+extern void test_sse4_2 (void) __attribute__((__option__("sse4.2")));
+extern void test_sse4a (void) __attribute__((__option__("sse4a")));
+extern void test_sse5 (void) __attribute__((__option__("sse5")));
+extern void test_ssse3 (void) __attribute__((__option__("ssse3")));
+
+extern void test_no_abm (void) __attribute__((__option__("no-abm")));
+extern void test_no_aes (void) __attribute__((__option__("no-aes")));
+extern void test_no_fused_madd (void) __attribute__((__option__("no-fused-madd")));
+extern void test_no_mmx (void) __attribute__((__option__("no-mmx")));
+extern void test_no_pclmul (void) __attribute__((__option__("no-pclmul")));
+extern void test_no_popcnt (void) __attribute__((__option__("no-popcnt")));
+extern void test_no_recip (void) __attribute__((__option__("no-recip")));
+extern void test_no_sse (void) __attribute__((__option__("no-sse")));
+extern void test_no_sse2 (void) __attribute__((__option__("no-sse2")));
+extern void test_no_sse3 (void) __attribute__((__option__("no-sse3")));
+extern void test_no_sse4 (void) __attribute__((__option__("no-sse4")));
+extern void test_no_sse4_1 (void) __attribute__((__option__("no-sse4.1")));
+extern void test_no_sse4_2 (void) __attribute__((__option__("no-sse4.2")));
+extern void test_no_sse4a (void) __attribute__((__option__("no-sse4a")));
+extern void test_no_sse5 (void) __attribute__((__option__("no-sse5")));
+extern void test_no_ssse3 (void) __attribute__((__option__("no-ssse3")));
+
+extern void test_arch_i386 (void) __attribute__((__option__("arch=i386")));
+extern void test_arch_i486 (void) __attribute__((__option__("arch=i486")));
+extern void test_arch_i586 (void) __attribute__((__option__("arch=i586")));
+extern void test_arch_pentium (void) __attribute__((__option__("arch=pentium")));
+extern void test_arch_pentium_mmx (void) __attribute__((__option__("arch=pentium-mmx")));
+extern void test_arch_winchip_c6 (void) __attribute__((__option__("arch=winchip-c6")));
+extern void test_arch_winchip2 (void) __attribute__((__option__("arch=winchip2")));
+extern void test_arch_c3 (void) __attribute__((__option__("arch=c3")));
+extern void test_arch_c3_2 (void) __attribute__((__option__("arch=c3-2")));
+extern void test_arch_i686 (void) __attribute__((__option__("arch=i686")));
+extern void test_arch_pentiumpro (void) __attribute__((__option__("arch=pentiumpro")));
+extern void test_arch_pentium2 (void) __attribute__((__option__("arch=pentium2")));
+extern void test_arch_pentium3 (void) __attribute__((__option__("arch=pentium3")));
+extern void test_arch_pentium3m (void) __attribute__((__option__("arch=pentium3m")));
+extern void test_arch_pentium_m (void) __attribute__((__option__("arch=pentium-m")));
+extern void test_arch_pentium4 (void) __attribute__((__option__("arch=pentium4")));
+extern void test_arch_pentium4m (void) __attribute__((__option__("arch=pentium4m")));
+extern void test_arch_prescott (void) __attribute__((__option__("arch=prescott")));
+extern void test_arch_nocona (void) __attribute__((__option__("arch=nocona")));
+extern void test_arch_core2 (void) __attribute__((__option__("arch=core2")));
+extern void test_arch_geode (void) __attribute__((__option__("arch=geode")));
+extern void test_arch_k6 (void) __attribute__((__option__("arch=k6")));
+extern void test_arch_k6_2 (void) __attribute__((__option__("arch=k6-2")));
+extern void test_arch_k6_3 (void) __attribute__((__option__("arch=k6-3")));
+extern void test_arch_athlon (void) __attribute__((__option__("arch=athlon")));
+extern void test_arch_athlon_tbird (void) __attribute__((__option__("arch=athlon-tbird")));
+extern void test_arch_athlon_4 (void) __attribute__((__option__("arch=athlon-4")));
+extern void test_arch_athlon_xp (void) __attribute__((__option__("arch=athlon-xp")));
+extern void test_arch_athlon_mp (void) __attribute__((__option__("arch=athlon-mp")));
+extern void test_arch_k8 (void) __attribute__((__option__("arch=k8")));
+extern void test_arch_k8_sse3 (void) __attribute__((__option__("arch=k8-sse3")));
+extern void test_arch_opteron (void) __attribute__((__option__("arch=opteron")));
+extern void test_arch_opteron_sse3 (void) __attribute__((__option__("arch=opteron-sse3")));
+extern void test_arch_athlon64 (void) __attribute__((__option__("arch=athlon64")));
+extern void test_arch_athlon64_sse3 (void) __attribute__((__option__("arch=athlon64-sse3")));
+extern void test_arch_athlon_fx (void) __attribute__((__option__("arch=athlon-fx")));
+extern void test_arch_amdfam10 (void) __attribute__((__option__("arch=amdfam10")));
+extern void test_arch_barcelona (void) __attribute__((__option__("arch=barcelona")));
+extern void test_arch_foo (void) __attribute__((__option__("arch=foo"))); /* { dg-error "bad value" } */
+
+extern void test_tune_i386 (void) __attribute__((__option__("tune=i386")));
+extern void test_tune_i486 (void) __attribute__((__option__("tune=i486")));
+extern void test_tune_i586 (void) __attribute__((__option__("tune=i586")));
+extern void test_tune_pentium (void) __attribute__((__option__("tune=pentium")));
+extern void test_tune_pentium_mmx (void) __attribute__((__option__("tune=pentium-mmx")));
+extern void test_tune_winchip_c6 (void) __attribute__((__option__("tune=winchip-c6")));
+extern void test_tune_winchip2 (void) __attribute__((__option__("tune=winchip2")));
+extern void test_tune_c3 (void) __attribute__((__option__("tune=c3")));
+extern void test_tune_c3_2 (void) __attribute__((__option__("tune=c3-2")));
+extern void test_tune_i686 (void) __attribute__((__option__("tune=i686")));
+extern void test_tune_pentiumpro (void) __attribute__((__option__("tune=pentiumpro")));
+extern void test_tune_pentium2 (void) __attribute__((__option__("tune=pentium2")));
+extern void test_tune_pentium3 (void) __attribute__((__option__("tune=pentium3")));
+extern void test_tune_pentium3m (void) __attribute__((__option__("tune=pentium3m")));
+extern void test_tune_pentium_m (void) __attribute__((__option__("tune=pentium-m")));
+extern void test_tune_pentium4 (void) __attribute__((__option__("tune=pentium4")));
+extern void test_tune_pentium4m (void) __attribute__((__option__("tune=pentium4m")));
+extern void test_tune_prescott (void) __attribute__((__option__("tune=prescott")));
+extern void test_tune_nocona (void) __attribute__((__option__("tune=nocona")));
+extern void test_tune_core2 (void) __attribute__((__option__("tune=core2")));
+extern void test_tune_geode (void) __attribute__((__option__("tune=geode")));
+extern void test_tune_k6 (void) __attribute__((__option__("tune=k6")));
+extern void test_tune_k6_2 (void) __attribute__((__option__("tune=k6-2")));
+extern void test_tune_k6_3 (void) __attribute__((__option__("tune=k6-3")));
+extern void test_tune_athlon (void) __attribute__((__option__("tune=athlon")));
+extern void test_tune_athlon_tbird (void) __attribute__((__option__("tune=athlon-tbird")));
+extern void test_tune_athlon_4 (void) __attribute__((__option__("tune=athlon-4")));
+extern void test_tune_athlon_xp (void) __attribute__((__option__("tune=athlon-xp")));
+extern void test_tune_athlon_mp (void) __attribute__((__option__("tune=athlon-mp")));
+extern void test_tune_k8 (void) __attribute__((__option__("tune=k8")));
+extern void test_tune_k8_sse3 (void) __attribute__((__option__("tune=k8-sse3")));
+extern void test_tune_opteron (void) __attribute__((__option__("tune=opteron")));
+extern void test_tune_opteron_sse3 (void) __attribute__((__option__("tune=opteron-sse3")));
+extern void test_tune_athlon64 (void) __attribute__((__option__("tune=athlon64")));
+extern void test_tune_athlon64_sse3 (void) __attribute__((__option__("tune=athlon64-sse3")));
+extern void test_tune_athlon_fx (void) __attribute__((__option__("tune=athlon-fx")));
+extern void test_tune_amdfam10 (void) __attribute__((__option__("tune=amdfam10")));
+extern void test_tune_barcelona (void) __attribute__((__option__("tune=barcelona")));
+extern void test_tune_generic (void) __attribute__((__option__("tune=generic")));
+extern void test_tune_foo (void) __attribute__((__option__("tune=foo"))); /* { dg-error "bad value" } */
+
+extern void test_fpmath_sse (void) __attribute__((__option__("sse2,fpmath=sse")));
+extern void test_fpmath_387 (void) __attribute__((__option__("sse2,fpmath=387")));
+extern void test_fpmath_sse_387 (void) __attribute__((__option__("sse2,fpmath=sse+387")));
+extern void test_fpmath_387_sse (void) __attribute__((__option__("sse2,fpmath=387+sse")));
+extern void test_fpmath_both (void) __attribute__((__option__("sse2,fpmath=both")));
diff --git a/gcc/testsuite/gcc.target/i386/funcspec-6.c b/gcc/testsuite/gcc.target/i386/funcspec-6.c
new file mode 100644
index 00000000000..0c915975894
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/funcspec-6.c
@@ -0,0 +1,71 @@
+/* Test whether all of the 64-bit function specific options are accepted
+ without error. */
+/* { dg-do compile } */
+/* { dg-require-effective-target lp64 } */
+
+extern void test_abm (void) __attribute__((__option__("abm")));
+extern void test_aes (void) __attribute__((__option__("aes")));
+extern void test_fused_madd (void) __attribute__((__option__("fused-madd")));
+extern void test_mmx (void) __attribute__((__option__("mmx")));
+extern void test_pclmul (void) __attribute__((__option__("pclmul")));
+extern void test_popcnt (void) __attribute__((__option__("popcnt")));
+extern void test_recip (void) __attribute__((__option__("recip")));
+extern void test_sse (void) __attribute__((__option__("sse")));
+extern void test_sse2 (void) __attribute__((__option__("sse2")));
+extern void test_sse3 (void) __attribute__((__option__("sse3")));
+extern void test_sse4 (void) __attribute__((__option__("sse4")));
+extern void test_sse4_1 (void) __attribute__((__option__("sse4.1")));
+extern void test_sse4_2 (void) __attribute__((__option__("sse4.2")));
+extern void test_sse4a (void) __attribute__((__option__("sse4a")));
+extern void test_sse5 (void) __attribute__((__option__("sse5")));
+extern void test_ssse3 (void) __attribute__((__option__("ssse3")));
+
+extern void test_no_abm (void) __attribute__((__option__("no-abm")));
+extern void test_no_aes (void) __attribute__((__option__("no-aes")));
+extern void test_no_fused_madd (void) __attribute__((__option__("no-fused-madd")));
+extern void test_no_mmx (void) __attribute__((__option__("no-mmx")));
+extern void test_no_pclmul (void) __attribute__((__option__("no-pclmul")));
+extern void test_no_popcnt (void) __attribute__((__option__("no-popcnt")));
+extern void test_no_recip (void) __attribute__((__option__("no-recip")));
+extern void test_no_sse (void) __attribute__((__option__("no-sse")));
+extern void test_no_sse2 (void) __attribute__((__option__("no-sse2")));
+extern void test_no_sse3 (void) __attribute__((__option__("no-sse3")));
+extern void test_no_sse4 (void) __attribute__((__option__("no-sse4")));
+extern void test_no_sse4_1 (void) __attribute__((__option__("no-sse4.1")));
+extern void test_no_sse4_2 (void) __attribute__((__option__("no-sse4.2")));
+extern void test_no_sse4a (void) __attribute__((__option__("no-sse4a")));
+extern void test_no_sse5 (void) __attribute__((__option__("no-sse5")));
+extern void test_no_ssse3 (void) __attribute__((__option__("no-ssse3")));
+
+extern void test_arch_nocona (void) __attribute__((__option__("arch=nocona")));
+extern void test_arch_core2 (void) __attribute__((__option__("arch=core2")));
+extern void test_arch_k8 (void) __attribute__((__option__("arch=k8")));
+extern void test_arch_k8_sse3 (void) __attribute__((__option__("arch=k8-sse3")));
+extern void test_arch_opteron (void) __attribute__((__option__("arch=opteron")));
+extern void test_arch_opteron_sse3 (void) __attribute__((__option__("arch=opteron-sse3")));
+extern void test_arch_athlon64 (void) __attribute__((__option__("arch=athlon64")));
+extern void test_arch_athlon64_sse3 (void) __attribute__((__option__("arch=athlon64-sse3")));
+extern void test_arch_athlon_fx (void) __attribute__((__option__("arch=athlon-fx")));
+extern void test_arch_amdfam10 (void) __attribute__((__option__("arch=amdfam10")));
+extern void test_arch_barcelona (void) __attribute__((__option__("arch=barcelona")));
+extern void test_arch_foo (void) __attribute__((__option__("arch=foo"))); /* { dg-error "bad value" } */
+
+extern void test_tune_nocona (void) __attribute__((__option__("tune=nocona")));
+extern void test_tune_core2 (void) __attribute__((__option__("tune=core2")));
+extern void test_tune_k8 (void) __attribute__((__option__("tune=k8")));
+extern void test_tune_k8_sse3 (void) __attribute__((__option__("tune=k8-sse3")));
+extern void test_tune_opteron (void) __attribute__((__option__("tune=opteron")));
+extern void test_tune_opteron_sse3 (void) __attribute__((__option__("tune=opteron-sse3")));
+extern void test_tune_athlon64 (void) __attribute__((__option__("tune=athlon64")));
+extern void test_tune_athlon64_sse3 (void) __attribute__((__option__("tune=athlon64-sse3")));
+extern void test_tune_athlon_fx (void) __attribute__((__option__("tune=athlon-fx")));
+extern void test_tune_amdfam10 (void) __attribute__((__option__("tune=amdfam10")));
+extern void test_tune_barcelona (void) __attribute__((__option__("tune=barcelona")));
+extern void test_tune_generic (void) __attribute__((__option__("tune=generic")));
+extern void test_tune_foo (void) __attribute__((__option__("tune=foo"))); /* { dg-error "bad value" } */
+
+extern void test_fpmath_sse (void) __attribute__((__option__("sse2,fpmath=sse")));
+extern void test_fpmath_387 (void) __attribute__((__option__("sse2,fpmath=387")));
+extern void test_fpmath_sse_387 (void) __attribute__((__option__("sse2,fpmath=sse+387")));
+extern void test_fpmath_387_sse (void) __attribute__((__option__("sse2,fpmath=387+sse")));
+extern void test_fpmath_both (void) __attribute__((__option__("sse2,fpmath=both")));
diff --git a/gcc/testsuite/gcc.target/i386/funcspec-7.c b/gcc/testsuite/gcc.target/i386/funcspec-7.c
new file mode 100644
index 00000000000..a65ae251978
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/funcspec-7.c
@@ -0,0 +1,13 @@
+/* Test whether using target specific options, we can generate the reciprocal
+ square root instruction. */
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=k8 -mno-recip -mfpmath=sse -ffast-math" } */
+
+float do_recip (float a) __attribute__((__option__("recip")));
+float do_normal (float a);
+
+float do_recip (float a) { return 1.0f / __builtin_sqrtf (a); }
+float do_normal (float a) { return 1.0f / __builtin_sqrtf (a); }
+
+/* { dg-final { scan-assembler "sqrtss" } } */
+/* { dg-final { scan-assembler "rsqrtss" } } */
diff --git a/gcc/testsuite/gcc.target/i386/funcspec-8.c b/gcc/testsuite/gcc.target/i386/funcspec-8.c
new file mode 100644
index 00000000000..115f60866a2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/funcspec-8.c
@@ -0,0 +1,161 @@
+/* Test whether using target specific options, we can use the x86 builtin
+ functions in functions with the appropriate function specific options. */
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=k8 -mfpmath=sse" } */
+
+typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__));
+typedef double __m128d __attribute__ ((__vector_size__ (16), __may_alias__));
+typedef int __m128w __attribute__ ((__vector_size__ (16), __may_alias__));
+typedef long long __m128i __attribute__ ((__vector_size__ (16), __may_alias__));
+
+#ifdef __SSE3__
+#error "-msse3 should not be set for this test"
+#endif
+
+__m128d sse3_hsubpd (__m128d a, __m128d b) __attribute__((__option__("sse3")));
+__m128d generic_hsubpd (__m128d a, __m128d b);
+
+__m128d
+sse3_hsubpd (__m128d a, __m128d b)
+{
+ return __builtin_ia32_hsubpd (a, b);
+}
+
+__m128d
+generic_hsubpd (__m128d a, __m128d b)
+{
+ return __builtin_ia32_hsubpd (a, b); /* { dg-error "needs isa option" } */
+}
+
+#ifdef __SSSE3__
+#error "-mssse3 should not be set for this test"
+#endif
+
+__m128w ssse3_psignd128 (__m128w a, __m128w b) __attribute__((__option__("ssse3")));
+__m128w generic_psignd (__m128w ab, __m128w b);
+
+__m128w
+ssse3_psignd128 (__m128w a, __m128w b)
+{
+ return __builtin_ia32_psignd128 (a, b);
+}
+
+__m128w
+generic_psignd128 (__m128w a, __m128w b)
+{
+ return __builtin_ia32_psignd128 (a, b); /* { dg-error "needs isa option" } */
+}
+
+#ifdef __SSE4_1__
+#error "-msse4.1 should not be set for this test"
+#endif
+
+__m128d sse4_1_blendvpd (__m128d a, __m128d b, __m128d c) __attribute__((__option__("sse4.1")));
+__m128d generic_blendvpd (__m128d a, __m128d b, __m128d c);
+
+__m128d
+sse4_1_blendvpd (__m128d a, __m128d b, __m128d c)
+{
+ return __builtin_ia32_blendvpd (a, b, c);
+}
+
+__m128d
+generic_blendvpd (__m128d a, __m128d b, __m128d c)
+{
+ return __builtin_ia32_blendvpd (a, b, c); /* { dg-error "needs isa option" } */
+}
+
+#ifdef __SSE4_2__
+#error "-msse4.2 should not be set for this test"
+#endif
+
+__m128i sse4_2_pcmpgtq (__m128i a, __m128i b) __attribute__((__option__("sse4.2")));
+__m128i generic_pcmpgtq (__m128i ab, __m128i b);
+
+__m128i
+sse4_2_pcmpgtq (__m128i a, __m128i b)
+{
+ return __builtin_ia32_pcmpgtq (a, b);
+}
+
+__m128i
+generic_pcmpgtq (__m128i a, __m128i b)
+{
+ return __builtin_ia32_pcmpgtq (a, b); /* { dg-error "needs isa option" } */
+}
+
+#ifdef __SSE4A__
+#error "-msse4a should not be set for this test"
+#endif
+
+__m128i sse4_2_insertq (__m128i a, __m128i b) __attribute__((__option__("sse4a")));
+__m128i generic_insertq (__m128i ab, __m128i b);
+
+__m128i
+sse4_2_insertq (__m128i a, __m128i b)
+{
+ return __builtin_ia32_insertq (a, b);
+}
+
+__m128i
+generic_insertq (__m128i a, __m128i b)
+{
+ return __builtin_ia32_insertq (a, b); /* { dg-error "needs isa option" } */
+}
+
+#ifdef __SSE5__
+#error "-msse5 should not be set for this test"
+#endif
+
+__m128d sse5_fmaddpd (__m128d a, __m128d b, __m128d c) __attribute__((__option__("sse5")));
+__m128d generic_fmaddpd (__m128d a, __m128d b, __m128d c);
+
+__m128d
+sse5_fmaddpd (__m128d a, __m128d b, __m128d c)
+{
+ return __builtin_ia32_fmaddpd (a, b, c);
+}
+
+__m128d
+generic_fmaddpd (__m128d a, __m128d b, __m128d c)
+{
+ return __builtin_ia32_fmaddpd (a, b, c); /* { dg-error "needs isa option" } */
+}
+
+#ifdef __AES__
+#error "-maes should not be set for this test"
+#endif
+
+__m128i aes_aesimc128 (__m128i a) __attribute__((__option__("aes")));
+__m128i generic_aesimc128 (__m128i a);
+
+__m128i
+aes_aesimc128 (__m128i a)
+{
+ return __builtin_ia32_aesimc128 (a);
+}
+
+__m128i
+generic_aesimc128 (__m128i a)
+{
+ return __builtin_ia32_aesimc128 (a); /* { dg-error "needs isa option" } */
+}
+
+#ifdef __PCLMUL__
+#error "-mpclmul should not be set for this test"
+#endif
+
+__m128i pclmul_pclmulqdq128 (__m128i a, __m128i b) __attribute__((__option__("pclmul")));
+__m128i generic_pclmulqdq128 (__m128i a, __m128i b);
+
+__m128i
+pclmul_pclmulqdq128 (__m128i a, __m128i b)
+{
+ return __builtin_ia32_pclmulqdq128 (a, b, 5);
+}
+
+__m128i
+generic_pclmulqdq128 (__m128i a, __m128i b)
+{
+ return __builtin_ia32_pclmulqdq128 (a, b, 5); /* { dg-error "needs isa option" } */
+}
diff --git a/gcc/testsuite/gcc.target/i386/funcspec-9.c b/gcc/testsuite/gcc.target/i386/funcspec-9.c
new file mode 100644
index 00000000000..e6d19013101
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/funcspec-9.c
@@ -0,0 +1,36 @@
+/* Test whether using target specific options, we can generate SSE5 code. */
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=k8 -mfpmath=sse -msse2" } */
+
+extern void exit (int);
+
+#ifdef __SSE5__
+#warning "__SSE5__ should not be defined before #pragma GCC option."
+#endif
+
+#pragma GCC option (push)
+#pragma GCC option ("sse5,fused-madd")
+
+#ifndef __SSE5__
+#warning "__SSE5__ should have be defined after #pragma GCC option."
+#endif
+
+float
+flt_mul_add (float a, float b, float c)
+{
+ return (a * b) + c;
+}
+
+#pragma GCC option (pop)
+#ifdef __SSE5__
+#warning "__SSE5__ should not be defined after #pragma GCC pop option."
+#endif
+
+double
+dbl_mul_add (double a, double b, double c)
+{
+ return (a * b) + c;
+}
+
+/* { dg-final { scan-assembler "fmaddss" } } */
+/* { dg-final { scan-assembler "addsd" } } */
diff --git a/gcc/testsuite/gcc.target/i386/hot-1.c b/gcc/testsuite/gcc.target/i386/hot-1.c
new file mode 100644
index 00000000000..608f52fd6eb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/hot-1.c
@@ -0,0 +1,33 @@
+/* Test whether using attribute((hot)) really turns on -O3. Do this test
+ by checking whether we vectorize a simple loop. */
+/* { dg-do compile } */
+/* { dg-options "-O1 -msse2 -mfpmath=sse -march=k8" } */
+/* { dg-final { scan-assembler "addps" } } */
+/* { dg-final { scan-assembler "subss" } } */
+
+#define SIZE 1024
+float a[SIZE] __attribute__((__aligned__(32)));
+float b[SIZE] __attribute__((__aligned__(32)));
+float c[SIZE] __attribute__((__aligned__(32)));
+
+/* This should vectorize. */
+void hot (void) __attribute__((__hot__));
+
+void
+hot (void)
+{
+ int i;
+
+ for (i = 0; i < SIZE; i++)
+ a[i] = b[i] + c[i];
+}
+
+/* This should not vectorize. */
+void
+not_hot (void)
+{
+ int i;
+
+ for (i = 0; i < SIZE; i++)
+ a[i] = b[i] - c[i];
+}
diff --git a/gcc/testsuite/gcc.target/i386/incoming-1.c b/gcc/testsuite/gcc.target/i386/incoming-1.c
new file mode 100644
index 00000000000..86e98a79b47
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/incoming-1.c
@@ -0,0 +1,19 @@
+/* PR middle-end/37009 */
+/* { dg-do compile { target { { ! *-*-darwin* } && ilp32 } } } */
+/* { dg-options "-w -msse2 -mpreferred-stack-boundary=2" } */
+
+#include <emmintrin.h>
+
+extern void bar (int *);
+
+int
+foo(__m128 x, __m128 y, __m128 z, int size)
+{
+ int __attribute((aligned(16))) xxx;
+
+ xxx = 2;
+ bar (&xxx);
+ return size;
+}
+
+/* { dg-final { scan-assembler "andl\[\\t \]*\\$-16,\[\\t \]*%esp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/incoming-2.c b/gcc/testsuite/gcc.target/i386/incoming-2.c
new file mode 100644
index 00000000000..2947d3347cd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/incoming-2.c
@@ -0,0 +1,19 @@
+/* PR middle-end/37009 */
+/* { dg-do compile { target { { ! *-*-darwin* } && ilp32 } } } */
+/* { dg-options "-w -msse2 -mpreferred-stack-boundary=2" } */
+
+#include <emmintrin.h>
+
+extern void bar (int *);
+
+int
+foo(__m128 x, __m128 y, __m128 z, __m128 a, int size)
+{
+ int __attribute((aligned(16))) xxx;
+
+ xxx = 2;
+ bar (&xxx);
+ return size;
+}
+
+/* { dg-final { scan-assembler-not "and\[l\]\[ \t\]" } } */
diff --git a/gcc/testsuite/gcc.target/i386/incoming-3.c b/gcc/testsuite/gcc.target/i386/incoming-3.c
new file mode 100644
index 00000000000..1edbfda0b39
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/incoming-3.c
@@ -0,0 +1,19 @@
+/* PR middle-end/37009 */
+/* { dg-do compile { target { { ! *-*-darwin* } && ilp32 } } } */
+/* { dg-options "-w -msse2 -mpreferred-stack-boundary=2" } */
+
+#include <emmintrin.h>
+
+extern void bar (int *);
+
+int
+foo(__m128 y, int size, ...)
+{
+ int __attribute((aligned(16))) xxx;
+
+ xxx = 2;
+ bar (&xxx);
+ return size;
+}
+
+/* { dg-final { scan-assembler-not "and\[l\]\[ \t\]" } } */
diff --git a/gcc/testsuite/gcc.target/i386/incoming-4.c b/gcc/testsuite/gcc.target/i386/incoming-4.c
new file mode 100644
index 00000000000..80c169c2469
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/incoming-4.c
@@ -0,0 +1,20 @@
+/* PR middle-end/37009 */
+/* { dg-do compile { target { { ! *-*-darwin* } && ilp32 } } } */
+/* { dg-options "-w -msse2 -mpreferred-stack-boundary=2" } */
+
+#include <stdarg.h>
+#include <emmintrin.h>
+
+extern void bar (int *);
+
+__m128
+foo(va_list arg)
+{
+ int __attribute((aligned(16))) xxx;
+
+ xxx = 2;
+ bar (&xxx);
+ return va_arg (arg, __m128);
+}
+
+/* { dg-final { scan-assembler "andl\[\\t \]*\\$-16,\[\\t \]*%esp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/incoming-5.c b/gcc/testsuite/gcc.target/i386/incoming-5.c
new file mode 100644
index 00000000000..f083d403116
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/incoming-5.c
@@ -0,0 +1,16 @@
+/* PR middle-end/37009 */
+/* { dg-do compile { target { { ! *-*-darwin* } && ilp32 } } } */
+/* { dg-options "-m32 -mincoming-stack-boundary=2 -mpreferred-stack-boundary=2" } */
+
+extern void bar (double *);
+
+double
+foo(double x)
+{
+ double xxx = x + 13.0;
+
+ bar (&xxx);
+ return xxx;
+}
+
+/* { dg-final { scan-assembler "andl\[\\t \]*\\$-8,\[\\t \]*%esp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/opt-1.c b/gcc/testsuite/gcc.target/i386/opt-1.c
new file mode 100644
index 00000000000..28e2ef38c34
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/opt-1.c
@@ -0,0 +1,35 @@
+/* Test the attribute((optimize)) really works. Do this test by checking
+ whether we vectorize a simple loop. */
+/* { dg-do compile } */
+/* { dg-options "-O1 -msse2 -mfpmath=sse -march=k8" } */
+/* { dg-final { scan-assembler "prefetcht0" } } */
+/* { dg-final { scan-assembler "addps" } } */
+/* { dg-final { scan-assembler "subss" } } */
+
+#define SIZE 10240
+float a[SIZE] __attribute__((__aligned__(32)));
+float b[SIZE] __attribute__((__aligned__(32)));
+float c[SIZE] __attribute__((__aligned__(32)));
+
+/* This should vectorize. */
+void opt3 (void) __attribute__((__optimize__(3,"unroll-all-loops,-fprefetch-loop-arrays")));
+
+void
+opt3 (void)
+{
+ int i;
+
+ for (i = 0; i < SIZE; i++)
+ a[i] = b[i] + c[i];
+}
+
+/* This should not vectorize. */
+void
+not_opt3 (void)
+{
+ int i;
+
+ for (i = 0; i < SIZE; i++)
+ a[i] = b[i] - c[i];
+}
+
diff --git a/gcc/testsuite/gcc.target/i386/opt-2.c b/gcc/testsuite/gcc.target/i386/opt-2.c
new file mode 100644
index 00000000000..8d6ba6fe925
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/opt-2.c
@@ -0,0 +1,38 @@
+/* Test the attribute((optimize)) really works. Do this test by checking
+ whether we vectorize a simple loop. */
+/* { dg-do compile } */
+/* { dg-options "-O1 -msse2 -mfpmath=sse -march=k8" } */
+/* { dg-final { scan-assembler "prefetcht0" } } */
+/* { dg-final { scan-assembler "addps" } } */
+/* { dg-final { scan-assembler "subss" } } */
+
+#define SIZE 10240
+float a[SIZE] __attribute__((__aligned__(32)));
+float b[SIZE] __attribute__((__aligned__(32)));
+float c[SIZE] __attribute__((__aligned__(32)));
+
+/* This should vectorize. */
+#pragma GCC optimize push
+#pragma GCC optimize (3, "unroll-all-loops", "-fprefetch-loop-arrays")
+
+void
+opt3 (void)
+{
+ int i;
+
+ for (i = 0; i < SIZE; i++)
+ a[i] = b[i] + c[i];
+}
+
+#pragma GCC optimize pop
+
+/* This should not vectorize. */
+void
+not_opt3 (void)
+{
+ int i;
+
+ for (i = 0; i < SIZE; i++)
+ a[i] = b[i] - c[i];
+}
+
diff --git a/gcc/testsuite/gcc.target/i386/pr32000-2.c b/gcc/testsuite/gcc.target/i386/pr32000-2.c
new file mode 100644
index 00000000000..639b121dc1e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr32000-2.c
@@ -0,0 +1,26 @@
+/* { dg-do run } */
+/* { dg-skip-if "" { ! { ilp32 && dfp } } } */
+/* { dg-options "-O -msse2 -std=gnu99 -mpreferred-stack-boundary=2" } */
+
+#include "sse2-check.h"
+
+typedef struct { _Decimal128 f __attribute__((packed)); } packed;
+
+_Decimal128 __attribute__((noinline))
+foo (_Decimal128 a1, _Decimal128 a2, _Decimal128 a3, _Decimal128 a4,
+ _Decimal128 a5, _Decimal128 a6, _Decimal128 a7, _Decimal128 a8,
+ int b1, int b2, int b3, int b4, int b5, int b6, int b7, packed y)
+{
+ return y.f;
+}
+
+void
+sse2_test (void)
+{
+ packed x;
+ _Decimal128 y = -1;
+ x.f = y;
+ y = foo (0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, -1, x);
+ if (__builtin_memcmp (&y, &x.f, sizeof (y)))
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr36613.c b/gcc/testsuite/gcc.target/i386/pr36613.c
new file mode 100644
index 00000000000..e9d7d11cedc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr36613.c
@@ -0,0 +1,44 @@
+/* { dg-do run { target { { i?86-*-linux* x86_64-*-linux* } && ilp32 } } } */
+/* { dg-options "-Os" } */
+/* PR target/36613 */
+
+extern void abort (void);
+
+static inline int
+lshifts (int val, int cnt)
+{
+ if (val < 0)
+ return val;
+ return val << cnt;
+}
+
+static inline unsigned int
+lshiftu (unsigned int val, unsigned int cnt)
+{
+ if (cnt >= sizeof (unsigned int) * __CHAR_BIT__
+ || val > ((__INT_MAX__ * 2U) >> cnt))
+ return val;
+ return val << cnt;
+}
+
+static inline int
+rshifts (int val, unsigned int cnt)
+{
+ if (val < 0 || cnt >= sizeof (int) * __CHAR_BIT__)
+ return val;
+ return val >> cnt;
+}
+
+int
+foo (unsigned int val)
+{
+ return rshifts (1 + val, lshifts (lshiftu (val, val), 1));
+}
+
+int
+main (void)
+{
+ if (foo (1) != 0)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr36753.c b/gcc/testsuite/gcc.target/i386/pr36753.c
new file mode 100644
index 00000000000..2d43d42a021
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr36753.c
@@ -0,0 +1,31 @@
+/* { dg-options "-O2" } */
+/* { dg-do run } */
+
+#if defined __i386__
+#define REG "edi"
+#else
+#define REG "r14"
+#endif
+
+register unsigned long *ds asm(REG);
+
+extern void abort (void);
+
+__attribute__ ((noinline)) void
+test (void)
+{
+ *++ds = 31337;
+}
+
+int
+main ()
+{
+ unsigned long stack[2];
+ stack[0] = 0;
+ stack[1] = 0;
+ ds = stack;
+ test ();
+ if (ds != stack + 1 || *ds != 31337)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr36786.c b/gcc/testsuite/gcc.target/i386/pr36786.c
new file mode 100644
index 00000000000..692518e1bd1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr36786.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target lp64 } */
+
+typedef int DItype __attribute__ ((mode (DI)));
+typedef unsigned int UDItype __attribute__ ((mode (DI)));
+typedef int TItype __attribute__ ((mode (TI)));
+
+__floattisf (TItype u)
+{
+ DItype hi = u >> (8 * 8);
+ UDItype count, shift;
+ hi = u >> shift;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr36992-1.c b/gcc/testsuite/gcc.target/i386/pr36992-1.c
new file mode 100644
index 00000000000..7cd24cccf3e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr36992-1.c
@@ -0,0 +1,12 @@
+/* { dg-do compile }
+/* { dg-options "-O2 -msse2" } */
+
+#include <emmintrin.h>
+
+__m128i
+test (__m128i b)
+{
+ return _mm_move_epi64 (b);
+}
+
+/* { dg-final { scan-assembler-times "movq\[ \\t\]+.*%xmm" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr36992-2.c b/gcc/testsuite/gcc.target/i386/pr36992-2.c
new file mode 100644
index 00000000000..17696a5b276
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr36992-2.c
@@ -0,0 +1,12 @@
+/* { dg-do compile }
+/* { dg-options "-O2 -msse4" } */
+
+#include <emmintrin.h>
+
+__m128i
+test (__m128i b)
+{
+ return _mm_move_epi64 (b);
+}
+
+/* { dg-final { scan-assembler-times "movq\[ \\t\]+.*%xmm" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr37101.c b/gcc/testsuite/gcc.target/i386/pr37101.c
new file mode 100644
index 00000000000..8fd3bfc5f85
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr37101.c
@@ -0,0 +1,64 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -msse2 -ftree-vectorize -march=nocona" } */
+
+typedef __SIZE_TYPE__ size_t;
+extern void *malloc (size_t);
+extern void free (void *);
+
+typedef struct _Resource
+{
+ struct _Resource *next;
+ unsigned int id;
+} ResourceRec, *ResourcePtr;
+
+typedef struct _ClientResource
+{
+ ResourcePtr *resources;
+ int elements;
+ int buckets;
+ int hashsize;
+} ClientResourceRec;
+
+static ClientResourceRec clientTable[256];
+
+void
+RebuildTable (int client)
+{
+ int j;
+ ResourcePtr res, next;
+ ResourcePtr **tails, *resources;
+ ResourcePtr **tptr, *rptr;
+
+ j = 2 * clientTable[client].buckets;
+
+ tails =
+ (ResourcePtr **) malloc ((unsigned long) (j * sizeof (ResourcePtr *)));
+ resources =
+ (ResourcePtr *) malloc ((unsigned long) (j * sizeof (ResourcePtr)));
+
+ for (rptr = resources, tptr = tails; --j >= 0; rptr++, tptr++)
+ {
+ *rptr = ((ResourcePtr) ((void *) 0));
+ *tptr = rptr;
+ }
+
+ clientTable[client].hashsize++;
+ for (j = clientTable[client].buckets,
+ rptr = clientTable[client].resources; --j >= 0; rptr++)
+ {
+ for (res = *rptr; res; res = next)
+ {
+ next = res->next;
+ res->next = ((ResourcePtr) ((void *) 0));
+ tptr = &tails[Hash (client, res->id)];
+ **tptr = res;
+ *tptr = &res->next;
+ }
+ }
+ free ((void *) tails);
+ clientTable[client].buckets *= 2;
+ free ((void *) clientTable[client].resources);
+ clientTable[client].resources = resources;
+}
+
+/* { dg-final { scan-assembler-not "movlps" } } */
diff --git a/gcc/testsuite/gcc.target/i386/regparm.c b/gcc/testsuite/gcc.target/i386/regparm.c
index 7334c972d4d..9db191c7275 100644
--- a/gcc/testsuite/gcc.target/i386/regparm.c
+++ b/gcc/testsuite/gcc.target/i386/regparm.c
@@ -3,7 +3,7 @@
/* { dg-options "-W -Wall" } */
/* Verify that GCC correctly detects non-matching regparm attributes. */
-int __attribute__((regparm(3))) f (void); /* { dg-error "previous" } */
+int __attribute__((regparm(3))) f (void); /* { dg-message "note: previous" } */
int __attribute__((regparm(2))) f (void) { /* { dg-error "conflicting" } */
return 0;
diff --git a/gcc/testsuite/gcc.target/i386/sse-22.c b/gcc/testsuite/gcc.target/i386/sse-22.c
new file mode 100644
index 00000000000..a9b10333157
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/sse-22.c
@@ -0,0 +1,171 @@
+/* Same as sse-14, except converted to use #pragma GCC option. */
+/* { dg-do compile } */
+/* { dg-options "-O0 -Werror-implicit-function-declaration" } */
+
+#include <mm_malloc.h>
+
+/* Test that the intrinsics compile without optimization. All of them are
+ defined as inline functions in {,x,e,p,t,s,w,a,b}mmintrin.h and mm3dnow.h
+ that reference the proper builtin functions. Defining away "extern" and
+ "__inline" results in all of them being compiled as proper functions. */
+
+#define extern
+#define __inline
+
+#define _CONCAT(x,y) x ## y
+
+#define test_1(func, type, op1_type, imm) \
+ type _CONCAT(_,func) (op1_type A, int const I) \
+ { return func (A, imm); }
+
+#define test_1x(func, type, op1_type, imm1, imm2) \
+ type _CONCAT(_,func) (op1_type A, int const I, int const L) \
+ { return func (A, imm1, imm2); }
+
+#define test_2(func, type, op1_type, op2_type, imm) \
+ type _CONCAT(_,func) (op1_type A, op2_type B, int const I) \
+ { return func (A, B, imm); }
+
+#define test_2x(func, type, op1_type, op2_type, imm1, imm2) \
+ type _CONCAT(_,func) (op1_type A, op2_type B, int const I, int const L) \
+ { return func (A, B, imm1, imm2); }
+
+#define test_4(func, type, op1_type, op2_type, op3_type, op4_type, imm) \
+ type _CONCAT(_,func) (op1_type A, op2_type B, \
+ op3_type C, op4_type D, int const I) \
+ { return func (A, B, C, D, imm); }
+
+
+#ifndef DIFFERENT_PRAGMAS
+#pragma GCC option ("mmx,3dnow,sse,sse2,sse3,ssse3,sse4.1,sse4.2,sse5,aes,pclmul")
+#endif
+
+/* Following intrinsics require immediate arguments. They
+ are defined as macros for non-optimized compilations. */
+
+/* mmintrin.h (MMX). */
+#ifdef DIFFERENT_PRAGMAS
+#pragma GCC option ("mmx")
+#endif
+#include <mmintrin.h>
+
+/* mm3dnow.h (3DNOW). */
+#ifdef DIFFERENT_PRAGMAS
+#pragma GCC option ("3dnow")
+#endif
+#include <mm3dnow.h>
+
+/* xmmintrin.h (SSE). */
+#ifdef DIFFERENT_PRAGMAS
+#pragma GCC option ("sse")
+#endif
+#include <xmmintrin.h>
+test_2 (_mm_shuffle_ps, __m128, __m128, __m128, 1)
+test_1 (_mm_extract_pi16, int, __m64, 1)
+test_1 (_m_pextrw, int, __m64, 1)
+test_2 (_mm_insert_pi16, __m64, __m64, int, 1)
+test_2 (_m_pinsrw, __m64, __m64, int, 1)
+test_1 (_mm_shuffle_pi16, __m64, __m64, 1)
+test_1 (_m_pshufw, __m64, __m64, 1)
+test_1 (_mm_prefetch, void, void *, _MM_HINT_NTA)
+
+/* emmintrin.h (SSE2). */
+#ifdef DIFFERENT_PRAGMAS
+#pragma GCC option ("sse2")
+#endif
+#include <emmintrin.h>
+test_2 (_mm_shuffle_pd, __m128d, __m128d, __m128d, 1)
+test_1 (_mm_srli_si128, __m128i, __m128i, 1)
+test_1 (_mm_slli_si128, __m128i, __m128i, 1)
+test_1 (_mm_extract_epi16, int, __m128i, 1)
+test_2 (_mm_insert_epi16, __m128i, __m128i, int, 1)
+test_1 (_mm_shufflehi_epi16, __m128i, __m128i, 1)
+test_1 (_mm_shufflelo_epi16, __m128i, __m128i, 1)
+test_1 (_mm_shuffle_epi32, __m128i, __m128i, 1)
+
+/* pmmintrin.h (SSE3). */
+#ifdef DIFFERENT_PRAGMAS
+#pragma GCC option ("sse3")
+#endif
+#include <pmmintrin.h>
+
+/* tmmintrin.h (SSSE3). */
+#ifdef DIFFERENT_PRAGMAS
+#pragma GCC option ("ssse3")
+#endif
+#include <tmmintrin.h>
+test_2 (_mm_alignr_epi8, __m128i, __m128i, __m128i, 1)
+test_2 (_mm_alignr_pi8, __m64, __m64, __m64, 1)
+
+/* ammintrin.h (SSE4A). */
+#ifdef DIFFERENT_PRAGMAS
+#pragma GCC option ("sse4a")
+#endif
+#include <ammintrin.h>
+test_1x (_mm_extracti_si64, __m128i, __m128i, 1, 1)
+test_2x (_mm_inserti_si64, __m128i, __m128i, __m128i, 1, 1)
+
+/* smmintrin.h (SSE4.1). */
+/* nmmintrin.h (SSE4.2). */
+/* Note, nmmintrin.h includes smmintrin.h, and smmintrin.h checks for the
+ #ifdef. So just set the option to SSE4.2. */
+#ifdef DIFFERENT_PRAGMAS
+#pragma GCC option ("sse4.2")
+#endif
+#include <nmmintrin.h>
+test_2 (_mm_blend_epi16, __m128i, __m128i, __m128i, 1)
+test_2 (_mm_blend_ps, __m128, __m128, __m128, 1)
+test_2 (_mm_blend_pd, __m128d, __m128d, __m128d, 1)
+test_2 (_mm_dp_ps, __m128, __m128, __m128, 1)
+test_2 (_mm_dp_pd, __m128d, __m128d, __m128d, 1)
+test_2 (_mm_insert_ps, __m128, __m128, __m128, 1)
+test_1 (_mm_extract_ps, int, __m128, 1)
+test_2 (_mm_insert_epi8, __m128i, __m128i, int, 1)
+test_2 (_mm_insert_epi32, __m128i, __m128i, int, 1)
+#ifdef __x86_64__
+test_2 (_mm_insert_epi64, __m128i, __m128i, long long, 1)
+#endif
+test_1 (_mm_extract_epi8, int, __m128i, 1)
+test_1 (_mm_extract_epi32, int, __m128i, 1)
+#ifdef __x86_64__
+test_1 (_mm_extract_epi64, long long, __m128i, 1)
+#endif
+test_2 (_mm_mpsadbw_epu8, __m128i, __m128i, __m128i, 1)
+test_2 (_mm_cmpistrm, __m128i, __m128i, __m128i, 1)
+test_2 (_mm_cmpistri, int, __m128i, __m128i, 1)
+test_4 (_mm_cmpestrm, __m128i, __m128i, int, __m128i, int, 1)
+test_4 (_mm_cmpestri, int, __m128i, int, __m128i, int, 1)
+test_2 (_mm_cmpistra, int, __m128i, __m128i, 1)
+test_2 (_mm_cmpistrc, int, __m128i, __m128i, 1)
+test_2 (_mm_cmpistro, int, __m128i, __m128i, 1)
+test_2 (_mm_cmpistrs, int, __m128i, __m128i, 1)
+test_2 (_mm_cmpistrz, int, __m128i, __m128i, 1)
+test_4 (_mm_cmpestra, int, __m128i, int, __m128i, int, 1)
+test_4 (_mm_cmpestrc, int, __m128i, int, __m128i, int, 1)
+test_4 (_mm_cmpestro, int, __m128i, int, __m128i, int, 1)
+test_4 (_mm_cmpestrs, int, __m128i, int, __m128i, int, 1)
+test_4 (_mm_cmpestrz, int, __m128i, int, __m128i, int, 1)
+
+/* bmmintrin.h (SSE5). */
+#ifdef DIFFERENT_PRAGMAS
+#pragma GCC option ("sse5")
+#endif
+#include <bmmintrin.h>
+test_1 (_mm_roti_epi8, __m128i, __m128i, 1)
+test_1 (_mm_roti_epi16, __m128i, __m128i, 1)
+test_1 (_mm_roti_epi32, __m128i, __m128i, 1)
+test_1 (_mm_roti_epi64, __m128i, __m128i, 1)
+
+/* wmmintrin.h (AES/PCLMUL). */
+#ifdef DIFFERENT_PRAGMAS
+#pragma GCC option ("aes,pclmul")
+#endif
+#include <wmmintrin.h>
+test_1 (_mm_aeskeygenassist_si128, __m128i, __m128i, 1)
+test_2 (_mm_clmulepi64_si128, __m128i, __m128i, __m128i, 1)
+
+/* mmintrin-common.h */
+test_1 (_mm_round_pd, __m128d, __m128d, 1)
+test_1 (_mm_round_ps, __m128, __m128, 1)
+test_2 (_mm_round_sd, __m128d, __m128d, __m128d, 1)
+test_2 (_mm_round_ss, __m128, __m128, __m128, 1)
diff --git a/gcc/testsuite/gcc.target/i386/sse-23.c b/gcc/testsuite/gcc.target/i386/sse-23.c
new file mode 100644
index 00000000000..27b601452a5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/sse-23.c
@@ -0,0 +1,108 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -Werror-implicit-function-declaration -march=k8" } */
+
+#include <mm_malloc.h>
+
+/* Test that the intrinsics compile with optimization. All of them are
+ defined as inline functions in {,x,e,p,t,s,w,a,b}mmintrin.h and mm3dnow.h
+ that reference the proper builtin functions. Defining away "extern" and
+ "__inline" results in all of them being compiled as proper functions. */
+
+#define extern
+#define __inline
+
+/* Following intrinsics require immediate arguments. */
+
+/* ammintrin.h */
+#define __builtin_ia32_extrqi(X, I, L) __builtin_ia32_extrqi(X, 1, 1)
+#define __builtin_ia32_insertqi(X, Y, I, L) __builtin_ia32_insertqi(X, Y, 1, 1)
+
+/* wmmintrin.h */
+#define __builtin_ia32_aeskeygenassist128(X, C) __builtin_ia32_aeskeygenassist128(X, 1)
+#define __builtin_ia32_pclmulqdq128(X, Y, I) __builtin_ia32_pclmulqdq128(X, Y, 1)
+
+/* mmintrin-common.h */
+#define __builtin_ia32_roundpd(V, M) __builtin_ia32_roundpd(V, 1)
+#define __builtin_ia32_roundsd(D, V, M) __builtin_ia32_roundsd(D, V, 1)
+#define __builtin_ia32_roundps(V, M) __builtin_ia32_roundps(V, 1)
+#define __builtin_ia32_roundss(D, V, M) __builtin_ia32_roundss(D, V, 1)
+
+/* smmintrin.h */
+#define __builtin_ia32_pblendw128(X, Y, M) __builtin_ia32_pblendw128 (X, Y, 1)
+#define __builtin_ia32_blendps(X, Y, M) __builtin_ia32_blendps(X, Y, 1)
+#define __builtin_ia32_blendpd(X, Y, M) __builtin_ia32_blendpd(X, Y, 1)
+#define __builtin_ia32_dpps(X, Y, M) __builtin_ia32_dpps(X, Y, 1)
+#define __builtin_ia32_dppd(X, Y, M) __builtin_ia32_dppd(X, Y, 1)
+#define __builtin_ia32_insertps128(D, S, N) __builtin_ia32_insertps128(D, S, 1)
+#define __builtin_ia32_vec_ext_v4sf(X, N) __builtin_ia32_vec_ext_v4sf(X, 1)
+#define __builtin_ia32_vec_set_v16qi(D, S, N) __builtin_ia32_vec_set_v16qi(D, S, 1)
+#define __builtin_ia32_vec_set_v4si(D, S, N) __builtin_ia32_vec_set_v4si(D, S, 1)
+#define __builtin_ia32_vec_set_v2di(D, S, N) __builtin_ia32_vec_set_v2di(D, S, 1)
+#define __builtin_ia32_vec_ext_v16qi(X, N) __builtin_ia32_vec_ext_v16qi(X, 1)
+#define __builtin_ia32_vec_ext_v4si(X, N) __builtin_ia32_vec_ext_v4si(X, 1)
+#define __builtin_ia32_vec_ext_v2di(X, N) __builtin_ia32_vec_ext_v2di(X, 1)
+#define __builtin_ia32_mpsadbw128(X, Y, M) __builtin_ia32_mpsadbw128(X, Y, 1)
+#define __builtin_ia32_pcmpistrm128(X, Y, M) \
+ __builtin_ia32_pcmpistrm128(X, Y, 1)
+#define __builtin_ia32_pcmpistri128(X, Y, M) \
+ __builtin_ia32_pcmpistri128(X, Y, 1)
+#define __builtin_ia32_pcmpestrm128(X, LX, Y, LY, M) \
+ __builtin_ia32_pcmpestrm128(X, LX, Y, LY, 1)
+#define __builtin_ia32_pcmpestri128(X, LX, Y, LY, M) \
+ __builtin_ia32_pcmpestri128(X, LX, Y, LY, 1)
+#define __builtin_ia32_pcmpistria128(X, Y, M) \
+ __builtin_ia32_pcmpistria128(X, Y, 1)
+#define __builtin_ia32_pcmpistric128(X, Y, M) \
+ __builtin_ia32_pcmpistric128(X, Y, 1)
+#define __builtin_ia32_pcmpistrio128(X, Y, M) \
+ __builtin_ia32_pcmpistrio128(X, Y, 1)
+#define __builtin_ia32_pcmpistris128(X, Y, M) \
+ __builtin_ia32_pcmpistris128(X, Y, 1)
+#define __builtin_ia32_pcmpistriz128(X, Y, M) \
+ __builtin_ia32_pcmpistriz128(X, Y, 1)
+#define __builtin_ia32_pcmpestria128(X, LX, Y, LY, M) \
+ __builtin_ia32_pcmpestria128(X, LX, Y, LY, 1)
+#define __builtin_ia32_pcmpestric128(X, LX, Y, LY, M) \
+ __builtin_ia32_pcmpestric128(X, LX, Y, LY, 1)
+#define __builtin_ia32_pcmpestrio128(X, LX, Y, LY, M) \
+ __builtin_ia32_pcmpestrio128(X, LX, Y, LY, 1)
+#define __builtin_ia32_pcmpestris128(X, LX, Y, LY, M) \
+ __builtin_ia32_pcmpestris128(X, LX, Y, LY, 1)
+#define __builtin_ia32_pcmpestriz128(X, LX, Y, LY, M) \
+ __builtin_ia32_pcmpestriz128(X, LX, Y, LY, 1)
+
+/* tmmintrin.h */
+#define __builtin_ia32_palignr128(X, Y, N) __builtin_ia32_palignr128(X, Y, 8)
+#define __builtin_ia32_palignr(X, Y, N) __builtin_ia32_palignr(X, Y, 8)
+
+/* emmintrin.h */
+#define __builtin_ia32_psrldqi128(A, B) __builtin_ia32_psrldqi128(A, 8)
+#define __builtin_ia32_pslldqi128(A, B) __builtin_ia32_pslldqi128(A, 8)
+#define __builtin_ia32_pshufhw(A, N) __builtin_ia32_pshufhw(A, 0)
+#define __builtin_ia32_pshuflw(A, N) __builtin_ia32_pshuflw(A, 0)
+#define __builtin_ia32_pshufd(A, N) __builtin_ia32_pshufd(A, 0)
+#define __builtin_ia32_vec_set_v8hi(A, D, N) \
+ __builtin_ia32_vec_set_v8hi(A, D, 0)
+#define __builtin_ia32_vec_ext_v8hi(A, N) __builtin_ia32_vec_ext_v8hi(A, 0)
+#define __builtin_ia32_shufpd(A, B, N) __builtin_ia32_shufpd(A, B, 0)
+
+/* xmmintrin.h */
+#define __builtin_prefetch(P, A, I) __builtin_prefetch(P, A, _MM_HINT_NTA)
+#define __builtin_ia32_pshufw(A, N) __builtin_ia32_pshufw(A, 0)
+#define __builtin_ia32_vec_set_v4hi(A, D, N) \
+ __builtin_ia32_vec_set_v4hi(A, D, 0)
+#define __builtin_ia32_vec_ext_v4hi(A, N) __builtin_ia32_vec_ext_v4hi(A, 0)
+#define __builtin_ia32_shufps(A, B, N) __builtin_ia32_shufps(A, B, 0)
+
+/* bmmintrin.h */
+#define __builtin_ia32_protbi(A, B) __builtin_ia32_protbi(A,1)
+#define __builtin_ia32_protwi(A, B) __builtin_ia32_protwi(A,1)
+#define __builtin_ia32_protdi(A, B) __builtin_ia32_protdi(A,1)
+#define __builtin_ia32_protqi(A, B) __builtin_ia32_protqi(A,1)
+
+
+#pragma GCC option ("3dnow,sse4,sse5,aes,pclmul")
+#include <wmmintrin.h>
+#include <bmmintrin.h>
+#include <smmintrin.h>
+#include <mm3dnow.h>
diff --git a/gcc/testsuite/gcc.target/i386/stackalign/asm-1.c b/gcc/testsuite/gcc.target/i386/stackalign/asm-1.c
new file mode 100644
index 00000000000..e4d4f20bb18
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/stackalign/asm-1.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target ilp32 } */
+/* { dg-options "-mpreferred-stack-boundary=2" } */
+
+/* This case is to detect a compile time regression introduced in stack
+ branch development. */
+f(){asm("%0"::"r"(1.5F));}g(){asm("%0"::"r"(1.5));}
diff --git a/gcc/testsuite/gcc.target/i386/stackalign/return-1.c b/gcc/testsuite/gcc.target/i386/stackalign/return-1.c
new file mode 100644
index 00000000000..c5b32e5c421
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/stackalign/return-1.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target ilp32 } */
+/* { dg-options "-mpreferred-stack-boundary=2" } */
+
+/* This compile only test is to detect an assertion failure in stack branch
+ development. */
+
+double
+foo (void)
+{
+}
diff --git a/gcc/testsuite/gcc.target/i386/stackalign/return-2.c b/gcc/testsuite/gcc.target/i386/stackalign/return-2.c
new file mode 100644
index 00000000000..113e71b80da
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/stackalign/return-2.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target ilp32 } */
+/* { dg-options "-mpreferred-stack-boundary=2" } */
+
+/* This compile only test is to detect an assertion failure in stack branch
+ development. */
+void baz (void);
+
+double foo (void)
+{
+ baz ();
+ return;
+}
+
+double bar (void)
+{
+ baz ();
+}
diff --git a/gcc/testsuite/gcc.target/i386/stackalign/return-3.c b/gcc/testsuite/gcc.target/i386/stackalign/return-3.c
new file mode 100644
index 00000000000..8a682b8fca6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/stackalign/return-3.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-skip-if "" { ! { ilp32 && dfp } } } */
+/* { dg-options "-msse -std=gnu99 -mpreferred-stack-boundary=2" } */
+
+/* This compile only test is to detect an assertion failure in stack branch
+ development. */
+_Decimal128 test (void)
+{
+ return 1234123412341234.123412341234dl;
+}
diff --git a/gcc/testsuite/gcc.target/i386/stackalign/return-4.c b/gcc/testsuite/gcc.target/i386/stackalign/return-4.c
new file mode 100644
index 00000000000..c66c369c8fc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/stackalign/return-4.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-mpreferred-stack-boundary=4" } */
+/* { dg-final { scan-assembler-not "andl\[^\\n\]*-64,\[^\\n\]*sp" } } */
+
+/* This compile only test is to detect an assertion failure in stack branch
+ development. */
+typedef int aligned __attribute__((aligned(64)));
+
+aligned
+foo (void) { }
diff --git a/gcc/testsuite/gcc.target/i386/stackalign/return-5.c b/gcc/testsuite/gcc.target/i386/stackalign/return-5.c
new file mode 100644
index 00000000000..84531ddfe29
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/stackalign/return-5.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-mpreferred-stack-boundary=4" } */
+/* { dg-final { scan-assembler-not "andl\[^\\n\]*-64,\[^\\n\]*sp" } } */
+
+/* This compile only test is to detect an assertion failure in stack branch
+ development. */
+struct bar
+{
+ int x;
+} __attribute__((aligned(64)));
+
+
+struct bar
+foo (void) { }
diff --git a/gcc/testsuite/gcc.target/i386/stackalign/return-6.c b/gcc/testsuite/gcc.target/i386/stackalign/return-6.c
new file mode 100644
index 00000000000..ceadbad1acf
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/stackalign/return-6.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-mpreferred-stack-boundary=4" } */
+/* { dg-final { scan-assembler-not "andl\[^\\n\]*-64,\[^\\n\]*sp" } } */
+
+/* This compile only test is to detect an assertion failure in stack branch
+ development. */
+struct bar
+{
+ int x __attribute__((aligned(64)));
+};
+
+
+struct bar
+foo (void) { }
diff --git a/gcc/testsuite/gcc.target/i386/stackalign/stackalign.exp b/gcc/testsuite/gcc.target/i386/stackalign/stackalign.exp
new file mode 100644
index 00000000000..463ba612e0f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/stackalign/stackalign.exp
@@ -0,0 +1,47 @@
+# Copyright (C) 2008
+# Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# Exit immediately if this isn't a x86 target.
+if { ![istarget i?86*-*-*] && ![istarget x86_64-*-*] } then {
+ return
+}
+
+load_lib gcc-dg.exp
+
+# Only run on targets which support automatic stack alignment.
+if { ![check_effective_target_automatic_stack_alignment] } then {
+ return
+}
+
+# If a testcase doesn't have special options, use these.
+global DEFAULT_CFLAGS
+if ![info exists DEFAULT_CFLAGS] then {
+ set DEFAULT_CFLAGS "-w"
+}
+
+# Initialize `dg'.
+dg-init
+
+set additional_flags "-mstackrealign"
+
+dg-runtest [lsort [glob $srcdir/$subdir/*.c]] $additional_flags $DEFAULT_CFLAGS
+
+set additional_flags "-mno-stackrealign"
+
+dg-runtest [lsort [glob $srcdir/$subdir/*.c]] $additional_flags $DEFAULT_CFLAGS
+
+dg-finish
diff --git a/gcc/testsuite/gcc.target/i386/vararg-1.c b/gcc/testsuite/gcc.target/i386/vararg-1.c
new file mode 100644
index 00000000000..1875e0a6973
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/vararg-1.c
@@ -0,0 +1,32 @@
+/* PR middle-end/36858 */
+/* { dg-do run } */
+/* { dg-options "-w" { target { lp64 } } } */
+/* { dg-options "-w -msse2 -mpreferred-stack-boundary=2" { target { ilp32 } } } */
+
+#include "sse2-check.h"
+#include <stdarg.h>
+#include <emmintrin.h>
+
+int
+__attribute__((noinline))
+test (int a, ...)
+{
+ return a;
+}
+
+__m128 n1 = { -283.3, -23.3, 213.4, 1119.03 };
+
+int
+__attribute__((noinline))
+foo (void)
+{
+ return test (1, n1);
+}
+
+static void
+__attribute__((noinline))
+sse2_test (void)
+{
+ if (foo () != 1)
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/i386/vararg-2.c b/gcc/testsuite/gcc.target/i386/vararg-2.c
new file mode 100644
index 00000000000..0534ac77478
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/vararg-2.c
@@ -0,0 +1,40 @@
+/* PR middle-end/36859 */
+/* { dg-do run } */
+/* { dg-options "-w" { target { lp64 } } } */
+/* { dg-options "-w -msse2 -mpreferred-stack-boundary=2" { target { ilp32 } } } */
+
+#include "sse2-check.h"
+#include <stdarg.h>
+#include <emmintrin.h>
+
+__m128
+__attribute__((noinline))
+test (int a, ...)
+{
+ __m128 x;
+ va_list va_arglist;
+
+ va_start (va_arglist, a);
+ x = va_arg (va_arglist, __m128);
+ va_end (va_arglist);
+ return x;
+}
+
+__m128 n1 = { -283.3, -23.3, 213.4, 1119.03 };
+
+int
+__attribute__((noinline))
+foo (void)
+{
+ __m128 x = test (1, n1);
+ if (__builtin_memcmp (&x, &n1, sizeof (x)) != 0)
+ abort ();
+ return 0;
+}
+
+static void
+__attribute__((noinline))
+sse2_test (void)
+{
+ foo ();
+}
diff --git a/gcc/testsuite/gcc.target/ia64/20080802-1.c b/gcc/testsuite/gcc.target/ia64/20080802-1.c
new file mode 100644
index 00000000000..b689a5d8d5f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/ia64/20080802-1.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -msched-control-spec" } */
+
+struct cpp_reader;
+
+extern const char * parse_include (struct cpp_reader *, int *m, void *);
+extern int _cpp_compare_file_date (struct cpp_reader *, const char *, int);
+
+void
+_cpp_init_internal_pragmas (struct cpp_reader *pfile)
+{
+ const char *fname;
+ int angle_brackets, ordering;
+
+ fname = parse_include (pfile, &angle_brackets, (void *) 0);
+ if (!fname)
+ return;
+ ordering = _cpp_compare_file_date (pfile, fname, angle_brackets);
+}
diff --git a/gcc/testsuite/gcc.target/mips/ext-1.c b/gcc/testsuite/gcc.target/mips/ext-1.c
new file mode 100644
index 00000000000..1cd111d5e33
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/ext-1.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-mips-options "-O -mips64r2" } */
+/* { dg-final { scan-assembler "\tdext\t" } } */
+/* { dg-final { scan-assembler-not "and" } } */
+
+struct
+{
+ unsigned long long a:9;
+ unsigned long long d:35;
+ unsigned long long e:10;
+ unsigned long long f:10;
+} t;
+
+NOMIPS16 unsigned long long
+f (void)
+{
+ return t.d;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/altivec-macros.c b/gcc/testsuite/gcc.target/powerpc/altivec-macros.c
index d95a68dd966..ef497a44161 100644
--- a/gcc/testsuite/gcc.target/powerpc/altivec-macros.c
+++ b/gcc/testsuite/gcc.target/powerpc/altivec-macros.c
@@ -55,9 +55,9 @@ _Pragma ("__vector")
/* { dg-warning "redefined" "pixel redefined" { target *-*-* } 48 } */
/* { dg-warning "redefined" "bool redefined" { target *-*-* } 49 } */
-/* { dg-warning "previous" "prev __vector defn" { target *-*-* } 24 } */
-/* { dg-warning "previous" "prev __pixel defn" { target *-*-* } 27 } */
-/* { dg-warning "previous" "prev __bool defn" { target *-*-* } 30 } */
-/* { dg-warning "previous" "prev vector defn" { target *-*-* } 33 } */
-/* { dg-warning "previous" "prev pixel defn" { target *-*-* } 36 } */
-/* { dg-warning "previous" "prev bool defn" { target *-*-* } 39 } */
+/* { dg-message "note: previous" "prev __vector defn" { target *-*-* } 24 } */
+/* { dg-message "note: previous" "prev __pixel defn" { target *-*-* } 27 } */
+/* { dg-message "note: previous" "prev __bool defn" { target *-*-* } 30 } */
+/* { dg-message "note: previous" "prev vector defn" { target *-*-* } 33 } */
+/* { dg-message "note: previous" "prev pixel defn" { target *-*-* } 36 } */
+/* { dg-message "note: previous" "prev bool defn" { target *-*-* } 39 } */
diff --git a/gcc/testsuite/gcc.target/powerpc/longcall-1.c b/gcc/testsuite/gcc.target/powerpc/longcall-1.c
new file mode 100644
index 00000000000..e7187f17a83
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/longcall-1.c
@@ -0,0 +1,13 @@
+/* PR target/35100 */
+/* { dg-do compile { target fpic } } */
+/* { dg-options "-fpic" } */
+
+void foo (void) __attribute__((__longcall__));
+int baz (void) __attribute__((__longcall__));
+
+int
+bar (void)
+{
+ foo ();
+ return baz () + 1;
+}
diff --git a/gcc/testsuite/gcc.target/s390/pr36822.c b/gcc/testsuite/gcc.target/s390/pr36822.c
new file mode 100644
index 00000000000..a427d2e1eb1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/pr36822.c
@@ -0,0 +1,16 @@
+/* This used to ICE on s390 due to bug in the definition of the 'R'
+ constraint which replaced the 'm' constraint (together with 'T')
+ while adding z10 support. */
+
+/* { dg-do compile } */
+/* { dg-options "-O" } */
+
+int boo()
+{
+ struct {
+ unsigned char pad[4096];
+ unsigned long long bar;
+ } *foo;
+ asm volatile( "" : "=m" (*(unsigned long long*)(foo->bar))
+ : "a" (&foo->bar));
+}
diff --git a/gcc/testsuite/gcc.target/sparc/ultrasp3.c b/gcc/testsuite/gcc.target/sparc/ultrasp3.c
index 1e028add878..87025881361 100644
--- a/gcc/testsuite/gcc.target/sparc/ultrasp3.c
+++ b/gcc/testsuite/gcc.target/sparc/ultrasp3.c
@@ -1,5 +1,5 @@
/* { dg-do run } */
-/* { dg-require-effective-target ilp32 && ultrasparc_hw } */
+/* { dg-skip-if "" { ! { ilp32 && ultrasparc_hw } } } */
/* { dg-options "-mcpu=ultrasparc -mv8plus" } */
extern void abort (void);
diff --git a/gcc/testsuite/gcc.target/spu/vector-ansi.c b/gcc/testsuite/gcc.target/spu/vector-ansi.c
new file mode 100644
index 00000000000..3c086169947
--- /dev/null
+++ b/gcc/testsuite/gcc.target/spu/vector-ansi.c
@@ -0,0 +1,35 @@
+/* { dg-do compile } */
+/* { dg-options "-ansi" } */
+
+/* This is done by spu_internals.h, but we not include it here to keep
+ down the dependencies. */
+
+#ifndef __VECTOR_KEYWORD_SUPPORTED__
+#define vector __vector
+#endif
+
+/* __vector is expanded unconditionally by the preprocessor. */
+__vector int vi;
+__vector unsigned char vuc;
+__vector signed char vsc;
+__vector unsigned short vus;
+__vector signed short vss;
+__vector unsigned int vui;
+__vector signed int vsi;
+__vector unsigned long long ull;
+__vector signed long long sll;
+__vector float vf;
+__vector double vd;
+
+/* vector is expanded by the define above, regardless of context. */
+vector int vi;
+vector unsigned char vuc;
+vector signed char vsc;
+vector unsigned short vus;
+vector signed short vss;
+vector unsigned int vui;
+vector signed int vsi;
+vector unsigned long long ull;
+vector signed long long sll;
+vector float vf;
+vector double vd;
diff --git a/gcc/testsuite/gcc.target/spu/vector.c b/gcc/testsuite/gcc.target/spu/vector.c
new file mode 100644
index 00000000000..237f93b7e58
--- /dev/null
+++ b/gcc/testsuite/gcc.target/spu/vector.c
@@ -0,0 +1,32 @@
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+#ifndef __VECTOR_KEYWORD_SUPPORTED__
+#error __VECTOR_KEYWORD_SUPPORTED__ is not defined
+#endif
+
+/* __vector is expanded unconditionally. */
+__vector int vi;
+__vector unsigned char vuc;
+__vector signed char vsc;
+__vector unsigned short vus;
+__vector signed short vss;
+__vector unsigned int vui;
+__vector signed int vsi;
+__vector unsigned long long ull;
+__vector signed long long sll;
+__vector float vf;
+__vector double vd;
+
+/* vector is expanded conditionally, based on the context. */
+vector int vi;
+vector unsigned char vuc;
+vector signed char vsc;
+vector unsigned short vus;
+vector signed short vss;
+vector unsigned int vui;
+vector signed int vsi;
+vector unsigned long long ull;
+vector signed long long sll;
+vector float vf;
+vector double vd;
diff --git a/gcc/testsuite/gfortran.dg/allocatable_module_1.f90 b/gcc/testsuite/gfortran.dg/allocatable_module_1.f90
new file mode 100644
index 00000000000..47f10008efa
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/allocatable_module_1.f90
@@ -0,0 +1,18 @@
+! { dg-do compile }
+! PR 36934 - this used to give a spurious error and segfault with a
+! patch that wasn't complete
+! Test case contributed by Philip Mason
+
+module fred1
+real, allocatable :: default_clocks(:)
+end module fred1
+
+module fred2
+real, allocatable :: locks(:)
+end module fred2
+
+program fred
+use fred1
+use fred2
+end program fred
+! { dg-final { cleanup-modules "fred1 fred2" } }
diff --git a/gcc/testsuite/gfortran.dg/argument_checking_7.f90 b/gcc/testsuite/gfortran.dg/argument_checking_7.f90
index 17f043a5a85..1c74fc58fd9 100644
--- a/gcc/testsuite/gfortran.dg/argument_checking_7.f90
+++ b/gcc/testsuite/gfortran.dg/argument_checking_7.f90
@@ -12,7 +12,7 @@ module cyclic
character(len(y)-1) ouch
integer i
do i = 1, len(ouch)
- ouch(i:i) = achar(ieor(iachar(x(i:i)),iachar(y(i:i)))) ! { dg-error " PROCEDURE attribute conflicts" }
+ ouch(i:i) = achar(ieor(iachar(x(i:i)),iachar(y(i:i)))) ! { dg-error "Syntax error in argument list" }
end do
end function ouch
end module cyclic
diff --git a/gcc/testsuite/gfortran.dg/array_4.f90 b/gcc/testsuite/gfortran.dg/array_4.f90
new file mode 100644
index 00000000000..869522af08f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/array_4.f90
@@ -0,0 +1,12 @@
+! { dg-do compile }
+! PR fortran/36824
+!
+! Dimension of tgclist was not recognized as having constant bounds
+!
+program test
+implicit none
+integer, dimension( 3 ), parameter :: tgc = (/5, 6, 7 /)
+type tgccomp
+ integer, dimension( tgc( 1 ) : tgc( 2 ) ) :: tgclist
+end type tgccomp
+end program
diff --git a/gcc/testsuite/gfortran.dg/array_temporaries_1.f90 b/gcc/testsuite/gfortran.dg/array_temporaries_1.f90
new file mode 100644
index 00000000000..64fc59046f4
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/array_temporaries_1.f90
@@ -0,0 +1,19 @@
+! { dg-do compile }
+! { dg-options "-Warray-temporaries" }
+
+subroutine bar(a)
+ real, dimension(2) :: a
+end
+
+program main
+ integer, parameter :: n=3
+ integer :: i
+ real, dimension(n) :: a, b
+
+ a = 0.2
+ i = 2
+ a(i:i+1) = a(1:2) ! { dg-warning "Creating array temporary" }
+ a = cshift(a,1) ! { dg-warning "Creating array temporary" }
+ b = cshift(a,1)
+ call bar(a(1:3:2)) ! { dg-warning "Creating array temporary" }
+end program main
diff --git a/gcc/testsuite/gfortran.dg/array_temporaries_2.f90 b/gcc/testsuite/gfortran.dg/array_temporaries_2.f90
new file mode 100644
index 00000000000..86e0a45e712
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/array_temporaries_2.f90
@@ -0,0 +1,15 @@
+! { dg-do run }
+! { dg-options "-fcheck-array-temporaries" }
+ program test
+ implicit none
+ integer :: a(3,3)
+ call foo(a(:,1)) ! OK, no temporary created
+ call foo(a(1,:)) ! BAD, temporary var created
+contains
+ subroutine foo(x)
+ integer :: x(3)
+ x = 5
+ end subroutine foo
+end program test
+
+! { dg-output "At line 7 of file .*array_temporaries_2.f90(\n|\r\n|\r)Fortran runtime warning: An array temporary was created for argument 'x' of procedure 'foo'" }
diff --git a/gcc/testsuite/gfortran.dg/c_sizeof_2.f90 b/gcc/testsuite/gfortran.dg/c_sizeof_2.f90
index f6c3077f83d..6e32cb34687 100644
--- a/gcc/testsuite/gfortran.dg/c_sizeof_2.f90
+++ b/gcc/testsuite/gfortran.dg/c_sizeof_2.f90
@@ -2,8 +2,7 @@
! { dg-options "-std=f2003 -Wall" }
! Support F2008's c_sizeof()
!
-integer(4) :: i, j(10)
-i = c_sizeof(i) ! { dg-error "not included in the selected standard" }
-i = c_sizeof(j) ! { dg-error "not included in the selected standard" }
+integer(4) :: i
+i = c_sizeof(i) ! { dg-warning "Fortran 2008" }
end
diff --git a/gcc/testsuite/gfortran.dg/char_cshift_3.f90 b/gcc/testsuite/gfortran.dg/char_cshift_3.f90
new file mode 100644
index 00000000000..80c0ede3a27
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/char_cshift_3.f90
@@ -0,0 +1,13 @@
+! { dg-do run }
+! PR 36886 - misalignment of characters for cshift could cause
+! problems on some architectures.
+program main
+ character(len=2) :: c2
+ character(len=4), dimension(2,2) :: a, b, c, d
+ ! Force misalignment of a or b
+ common /foo/ a, c, c2, b, d
+ a = 'aa'
+ b = 'bb'
+ d = cshift(b,1)
+ c = cshift(a,1)
+end program main
diff --git a/gcc/testsuite/gfortran.dg/char_eoshift_5.f90 b/gcc/testsuite/gfortran.dg/char_eoshift_5.f90
new file mode 100644
index 00000000000..93c701a4f1b
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/char_eoshift_5.f90
@@ -0,0 +1,24 @@
+! { dg-do run }
+! { dg-options "-fdump-tree-original" }
+
+! PR fortran/36403
+! Check that the string length of BOUNDARY is added to the library-eoshift
+! call even if BOUNDARY is missing (as it is optional).
+! This is the original test from the PR.
+
+! Contributed by Kazumoto Kojima.
+
+ CHARACTER(LEN=3), DIMENSION(10) :: Z
+ call test_eoshift
+contains
+ subroutine test_eoshift
+ CHARACTER(LEN=1), DIMENSION(10) :: chk
+ chk(1:8) = "5"
+ chk(9:10) = " "
+ Z(:)="456"
+ if (any (EOSHIFT(Z(:)(2:2),2) .ne. chk)) call abort
+ END subroutine
+END
+
+! Check that _gfortran_eoshift* is called with 8 arguments:
+! { dg-final { scan-tree-dump "_gfortran_eoshift\[0-9_\]+char \\(\[&a-zA-Z0-9._\]*, \[&a-zA-Z0-9._\]*, \[&a-zA-Z0-9._\]*, \[&a-zA-Z0-9._\]*, \[&a-zA-Z0-9._\]*, \[&a-zA-Z0-9._\]*, \[&a-zA-Z0-9._\]*, \[&a-zA-Z0-9._\]*\\)" "original" } }
diff --git a/gcc/testsuite/gfortran.dg/char_expr_1.f90 b/gcc/testsuite/gfortran.dg/char_expr_1.f90
new file mode 100644
index 00000000000..ba0e1f23350
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/char_expr_1.f90
@@ -0,0 +1,20 @@
+! { dg-do "run" }
+! PR fortran/36795
+! "(str)" (= an expression) was regarded as "str" (= a variable)
+! and thus when yy was deallocated so was xx. Result: An invalid
+! memory access.
+!
+program main
+ implicit none
+ character (len=10), allocatable :: str(:)
+ allocate (str(1))
+ str(1) = "dog"
+ if (size(str) /= 1 .or. str(1) /= "dog") call abort()
+contains
+ subroutine foo(xx,yy)
+ character (len=*), intent(in) :: xx(:)
+ character (len=*), intent(out), allocatable :: yy(:)
+ allocate (yy(size(xx)))
+ yy = xx
+ end subroutine foo
+end program main
diff --git a/gcc/testsuite/gfortran.dg/char_expr_2.f90 b/gcc/testsuite/gfortran.dg/char_expr_2.f90
new file mode 100644
index 00000000000..86499eb454c
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/char_expr_2.f90
@@ -0,0 +1,15 @@
+! { dg-do compile }
+! PR fortran/36803
+! PR fortran/36795
+!
+! "(n)" was simplified to the EXPR_VARIABLE "n"
+! and thus "(n)" was judged as definable.
+!
+interface
+ subroutine foo(x)
+ character, intent(out) :: x(:) ! or INTENT(INOUT)
+ end subroutine foo
+end interface
+character :: n(5)
+call foo( (n) ) ! { dg-error "must be definable" }
+end
diff --git a/gcc/testsuite/gfortran.dg/conflicts.f90 b/gcc/testsuite/gfortran.dg/conflicts.f90
index b1b59f4ac4c..1f10a65ceed 100644
--- a/gcc/testsuite/gfortran.dg/conflicts.f90
+++ b/gcc/testsuite/gfortran.dg/conflicts.f90
@@ -2,16 +2,16 @@
! Check for conflicts
! PR fortran/29657
-function f1() ! { dg-error "has no IMPLICIT type" }
+function f1() ! { dg-error "PROCEDURE attribute conflicts with SAVE attribute" }
implicit none
- real, save :: f1 ! { dg-error "PROCEDURE attribute conflicts with SAVE attribute" }
+ real, save :: f1
f1 = 1.0
end function f1
-function f2()
+function f2() ! { dg-error "PROCEDURE attribute conflicts with SAVE attribute" }
implicit none
real :: f2
- save f2 ! { dg-error "PROCEDURE attribute conflicts with SAVE attribute" }
+ save f2
f2 = 1.0
end function f2
diff --git a/gcc/testsuite/gfortran.dg/cshift_nan_1.f90 b/gcc/testsuite/gfortran.dg/cshift_nan_1.f90
new file mode 100644
index 00000000000..896ecb3a4e1
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/cshift_nan_1.f90
@@ -0,0 +1,24 @@
+! { dg-do run }
+! Test cshift where the values are eight bytes,
+! but are aligned on a four-byte boundary. The
+! integers correspond to NaN values.
+program main
+ implicit none
+ integer :: i
+ type t
+ sequence
+ integer :: a,b
+ end type t
+ type(t), dimension(4) :: u,v
+ common /foo/ u, i, v
+
+ u(1)%a = 2142240768
+ u(2)%a = 2144337920
+ u(3)%a = -5242880
+ u(4)%a = -3145728
+ u%b = (/(i,i=-1,-4,-1)/)
+ v(1:3:2) = cshift(u(1:3:2),1)
+ v(2:4:2) = cshift(u(2:4:2),-1)
+ if (any(v%a /= (/-5242880, -3145728, 2142240768, 2144337920 /))) call abort
+ if (any(v%b /= (/-3, -4, -1, -2/))) call abort
+end program main
diff --git a/gcc/testsuite/gfortran.dg/extends_1.f03 b/gcc/testsuite/gfortran.dg/extends_1.f03
new file mode 100644
index 00000000000..57a50732c55
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/extends_1.f03
@@ -0,0 +1,73 @@
+! { dg-do run }
+! A basic functional test of derived type extension.
+!
+! Contributed by Paul Thomas <pault@gcc.gnu.org>
+!
+module persons
+ type :: person
+ character(24) :: name = ""
+ integer :: ss = 1
+ end type person
+end module persons
+
+module person_education
+ use persons
+ type, extends(person) :: education
+ integer :: attainment = 0
+ character(24) :: institution = ""
+ end type education
+end module person_education
+
+ use person_education
+ type, extends(education) :: service
+ integer :: personnel_number = 0
+ character(24) :: department = ""
+ end type service
+
+ type, extends(service) :: person_record
+ type (person_record), pointer :: supervisor => NULL ()
+ end type person_record
+
+ type(person_record), pointer :: recruit, supervisor
+
+! Check that references by ultimate component work
+
+ allocate (supervisor)
+ supervisor%name = "Joe Honcho"
+ supervisor%ss = 123455
+ supervisor%attainment = 100
+ supervisor%institution = "Celestial University"
+ supervisor%personnel_number = 1
+ supervisor%department = "Directorate"
+
+ recruit => entry ("John Smith", 123456, 1, "Bog Hill High School", &
+ 99, "Records", supervisor)
+
+ if (trim (recruit%name) /= "John Smith") call abort
+ if (recruit%name /= recruit%service%name) call abort
+ if (recruit%supervisor%ss /= 123455) call abort
+ if (recruit%supervisor%ss /= supervisor%person%ss) call abort
+
+ deallocate (supervisor)
+ deallocate (recruit)
+contains
+ function entry (name, ss, attainment, institution, &
+ personnel_number, department, supervisor) result (new_person)
+ integer :: ss, attainment, personnel_number
+ character (*) :: name, institution, department
+ type (person_record), pointer :: supervisor, new_person
+
+ allocate (new_person)
+
+! Check mixtures of references
+ new_person%person%name = name
+ new_person%service%education%person%ss = ss
+ new_person%service%attainment = attainment
+ new_person%education%institution = institution
+ new_person%personnel_number = personnel_number
+ new_person%service%department = department
+ new_person%supervisor => supervisor
+ end function
+end
+
+! { dg-final { cleanup-modules "persons person_education" } }
diff --git a/gcc/testsuite/gfortran.dg/extends_2.f03 b/gcc/testsuite/gfortran.dg/extends_2.f03
new file mode 100644
index 00000000000..aabbf662a4f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/extends_2.f03
@@ -0,0 +1,66 @@
+! { dg-do run }
+! A test of f95 style constructors with derived type extension.
+!
+! Contributed by Paul Thomas <pault@gcc.gnu.org>
+!
+module persons
+ type :: person
+ character(24) :: name = ""
+ integer :: ss = 1
+ end type person
+end module persons
+
+module person_education
+ use persons
+ type, extends(person) :: education
+ integer :: attainment = 0
+ character(24) :: institution = ""
+ end type education
+end module person_education
+
+ use person_education
+ type, extends(education) :: service
+ integer :: personnel_number = 0
+ character(24) :: department = ""
+ end type service
+
+ type, extends(service) :: person_record
+ type (person_record), pointer :: supervisor => NULL ()
+ end type person_record
+
+ type(person_record), pointer :: recruit, supervisor
+
+! Check that simple constructor works
+ allocate (supervisor)
+ supervisor%service = service ("Joe Honcho", 123455, 100, &
+ "Celestial University", 1, &
+ "Directorate")
+
+ recruit => entry ("John Smith", 123456, 1, "Bog Hill High School", &
+ 99, "Records", supervisor)
+
+ if (trim (recruit%name) /= "John Smith") call abort
+ if (recruit%name /= recruit%service%name) call abort
+ if (recruit%supervisor%ss /= 123455) call abort
+ if (recruit%supervisor%ss /= supervisor%person%ss) call abort
+
+ deallocate (supervisor)
+ deallocate (recruit)
+contains
+ function entry (name, ss, attainment, institution, &
+ personnel_number, department, supervisor) result (new_person)
+ integer :: ss, attainment, personnel_number
+ character (*) :: name, institution, department
+ type (person_record), pointer :: supervisor, new_person
+
+ allocate (new_person)
+
+! Check nested constructors
+ new_person = person_record (education (person (name, ss), &
+ attainment, institution), &
+ personnel_number, department, &
+ supervisor)
+ end function
+end
+
+! { dg-final { cleanup-modules "persons person_education" } }
diff --git a/gcc/testsuite/gfortran.dg/extends_3.f03 b/gcc/testsuite/gfortran.dg/extends_3.f03
new file mode 100644
index 00000000000..27ae670d95f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/extends_3.f03
@@ -0,0 +1,71 @@
+! { dg-do run }
+! A test of f2k style constructors with derived type extension.
+!
+! Contributed by Paul Thomas <pault@gcc.gnu.org>
+!
+module persons
+ type :: person
+ character(24) :: name = ""
+ integer :: ss = 1
+ end type person
+end module persons
+
+module person_education
+ use persons
+ type, extends(person) :: education
+ integer :: attainment = 0
+ character(24) :: institution = ""
+ end type education
+end module person_education
+
+ use person_education
+ type, extends(education) :: service
+ integer :: personnel_number = 0
+ character(24) :: department = ""
+ end type service
+
+ type, extends(service) :: person_record
+ type (person_record), pointer :: supervisor => NULL ()
+ end type person_record
+
+ type(person_record), pointer :: recruit, supervisor
+
+! Check that F2K constructor with missing entries works
+ allocate (supervisor)
+ supervisor%service = service (NAME = "Joe Honcho", SS= 123455)
+
+ recruit => entry ("John Smith", 123456, 1, "Bog Hill High School", &
+ 99, "Records", supervisor)
+
+ if (supervisor%ss /= 123455) call abort
+ if (trim (supervisor%name) /= "Joe Honcho") call abort
+ if (trim (supervisor%institution) /= "") call abort
+ if (supervisor%attainment /= 0) call abort
+
+ if (trim (recruit%name) /= "John Smith") call abort
+ if (recruit%name /= recruit%service%name) call abort
+ if (recruit%supervisor%ss /= 123455) call abort
+ if (recruit%supervisor%ss /= supervisor%person%ss) call abort
+
+ deallocate (supervisor)
+ deallocate (recruit)
+contains
+ function entry (name, ss, attainment, institution, &
+ personnel_number, department, supervisor) result (new_person)
+ integer :: ss, attainment, personnel_number
+ character (*) :: name, institution, department
+ type (person_record), pointer :: supervisor, new_person
+
+ allocate (new_person)
+
+! Check F2K constructor with order shuffled a bit
+ new_person = person_record (NAME = name, SS =ss, &
+ DEPARTMENT = department, &
+ INSTITUTION = institution, &
+ PERSONNEL_NUMBER = personnel_number, &
+ ATTAINMENT = attainment, &
+ SUPERVISOR = supervisor)
+ end function
+end
+
+! { dg-final { cleanup-modules "persons person_education" } }
diff --git a/gcc/testsuite/gfortran.dg/extends_4.f03 b/gcc/testsuite/gfortran.dg/extends_4.f03
new file mode 100644
index 00000000000..941a6639213
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/extends_4.f03
@@ -0,0 +1,52 @@
+! { dg-do run }
+! Check that derived type extension is compatible with renaming
+! the parent type and that allocatable components are OK. At
+! the same time, private type and components are checked.
+!
+! Contributed by Paul Thomas <pault@gcc.gnu.org>
+!
+module mymod
+ type :: a
+ real, allocatable :: x(:)
+ integer, private :: ia = 0
+ end type a
+ type :: b
+ private
+ real, allocatable :: x(:)
+ integer :: i
+ end type b
+contains
+ function set_b () result (res)
+ type(b) :: res
+ allocate (res%x(2))
+ res%x = [10.0, 20.0]
+ res%i = 1
+ end function
+ subroutine check_b (arg)
+ type(b) :: arg
+ if (any (arg%x /= [10.0, 20.0])) call abort
+ if (arg%i /= 1) call abort
+ end subroutine
+end module mymod
+
+ use mymod, e => a
+ type, extends(e) :: f
+ integer :: if
+ end type f
+ type, extends(b) :: d
+ integer :: id
+ end type d
+
+ type(f) :: p
+ type(d) :: q
+
+ p = f (x = [1.0, 2.0], if = 3)
+ if (any (p%e%x /= [1.0, 2.0])) call abort
+
+ q%b = set_b ()
+ call check_b (q%b)
+ q = d (b = set_b (), id = 99)
+ call check_b (q%b)
+end
+
+! { dg-final { cleanup-modules "persons person_education" } }
diff --git a/gcc/testsuite/gfortran.dg/extends_5.f03 b/gcc/testsuite/gfortran.dg/extends_5.f03
new file mode 100644
index 00000000000..5146d456355
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/extends_5.f03
@@ -0,0 +1,27 @@
+! { dg-do compile }
+! Some errors for derived type extension.
+!
+! Contributed by Paul Thomas <pault@gcc.gnu.org>
+!
+module m
+ use iso_c_binding
+ type :: date
+ sequence
+ integer :: yr, mon
+ integer,public :: day
+ end type
+ type, bind(c) :: dt
+ integer(c_int) :: yr, mon
+ integer(c_int) :: day
+ end type
+end module m
+
+ use m
+ type, extends(date) :: datetime ! { dg-error "because it is a SEQUENCE type" }
+ end type ! { dg-error "Expecting END PROGRAM" }
+
+ type, extends(dt) :: dt_type ! { dg-error "because it is BIND" }
+ end type ! { dg-error "Expecting END PROGRAM" }
+end
+
+! { dg-final { cleanup-modules "m" } }
diff --git a/gcc/testsuite/gfortran.dg/extends_6.f03 b/gcc/testsuite/gfortran.dg/extends_6.f03
new file mode 100644
index 00000000000..866fbbd1c50
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/extends_6.f03
@@ -0,0 +1,49 @@
+! { dg-do compile }
+! Some errors pointed out in the development of the patch.
+!
+! Contributed by Tobias Burnus <burnus@net-b.de>
+!
+module m
+ type :: date
+ private
+ integer :: yr, mon
+ integer,public :: day
+ end type
+ type :: dt
+ integer :: yr, mon
+ integer :: day
+ end type
+end module m
+
+ use m
+ type, extends(date) :: datetime
+ integer :: hr, min, sec
+ end type
+ type(datetime) :: o_dt
+
+ type :: one
+ integer :: i
+ end type one
+
+ type, extends(one) :: two
+ real :: r
+ end type two
+
+ o_dt%day = 5 ! VALID but failed in first version of EXTENDS patch
+ o_dt%yr = 5 ! { dg-error "All components of 'date' are PRIVATE" }
+
+ t = two(one = one(4), i = 5, r=4.4) ! { dg-error "has already been set" }
+
+ call foo
+contains
+ subroutine foo
+ use m, date_type => dt
+ type, extends(date_type) :: dt_type
+ end type
+ type (dt_type) :: foo_dt
+ foo_dt%date_type%day = 1
+ foo_dt%dt%day = 1 ! { dg-error "not a member" }
+ end subroutine
+end
+
+! { dg-final { cleanup-modules "m" } }
diff --git a/gcc/testsuite/gfortran.dg/finalize_9.f03 b/gcc/testsuite/gfortran.dg/finalize_9.f03
new file mode 100644
index 00000000000..464036efc38
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/finalize_9.f03
@@ -0,0 +1,8 @@
+! { dg-do compile }
+
+! Parsing of finalizer procedure definitions.
+! While ALLOCATABLE scalars are not implemented, this even used to ICE.
+! Thanks Tobias Burnus for the test!
+
+integer, allocatable :: x ! { dg-error "may not be ALLOCATABLE" }
+end
diff --git a/gcc/testsuite/gfortran.dg/fmt_error_3.f90 b/gcc/testsuite/gfortran.dg/fmt_error_3.f90
new file mode 100644
index 00000000000..257f876ed80
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/fmt_error_3.f90
@@ -0,0 +1,36 @@
+! { dg-do compile }
+
+! PR fortran/29835
+! Check for improved format error messages with correct locus and more detailed
+! "unexpected element" messages.
+
+SUBROUTINE format_labels
+ IMPLICIT NONE
+
+1 FORMAT (A, &
+ A, &
+ Q, & ! { dg-error "Unexpected element 'Q'" }
+ A)
+
+2 FORMAT (A, &
+ I, & ! { dg-error "Nonnegative width" }
+ A)
+
+END SUBROUTINE format_labels
+
+SUBROUTINE format_strings
+ IMPLICIT NONE
+ CHARACTER(len=32), PARAMETER :: str = "hello"
+ INTEGER :: x
+
+ PRINT '(A, Q, A)', & ! { dg-error "Unexpected element 'Q'" }
+ str, str, str ! { dg-bogus "Unexpected element" }
+
+ PRINT '(A, ' // & ! { dg-error "Nonnegative width" }
+ ' I, ' // &
+ ' A)', str, str, str ! { dg-bogus "Nonnegative width" }
+
+ READ '(Q)', & ! { dg-error "Unexpected element 'Q'" }
+ x ! { dg-bogus "Unexpected element" }
+
+END SUBROUTINE format_strings
diff --git a/gcc/testsuite/gfortran.dg/fmt_error_4.f90 b/gcc/testsuite/gfortran.dg/fmt_error_4.f90
new file mode 100644
index 00000000000..2310573bd1f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/fmt_error_4.f90
@@ -0,0 +1,22 @@
+! { dg-do run }
+! { dg-shouldfail "runtime error" }
+
+! PR fortran/29835
+! Check for improved format error messages with correct locus and more detailed
+! "unexpected element" messages.
+
+! Now with runtime supplied format strings
+SUBROUTINE format_runtime (fmtstr)
+ IMPLICIT NONE
+ CHARACTER(len=*) :: fmtstr
+ CHARACTER(len=32), PARAMETER :: str = "hello"
+
+ PRINT fmtstr, str, str, str
+END SUBROUTINE format_runtime
+
+PROGRAM main
+ IMPLICIT NONE
+ CALL format_runtime ('(A, Q, A)')
+END PROGRAM main
+
+! { dg-output "Unexpected element 'Q'.*(\n|\r\n|\r)\\(A, Q, A\\)(\n|\r\n|\r) \\^" }
diff --git a/gcc/testsuite/gfortran.dg/fmt_error_5.f90 b/gcc/testsuite/gfortran.dg/fmt_error_5.f90
new file mode 100644
index 00000000000..18de68e0719
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/fmt_error_5.f90
@@ -0,0 +1,22 @@
+! { dg-do run }
+! { dg-shouldfail "runtime error" }
+
+! PR fortran/29835
+! Check for improved format error messages with correct locus and more detailed
+! "unexpected element" messages.
+
+! Now with runtime supplied format strings
+SUBROUTINE format_runtime (fmtstr)
+ IMPLICIT NONE
+ CHARACTER(len=*) :: fmtstr
+ INTEGER :: x
+
+ PRINT fmtstr, x
+END SUBROUTINE format_runtime
+
+PROGRAM main
+ IMPLICIT NONE
+ CALL format_runtime ('(Q)')
+END PROGRAM main
+
+! { dg-output "Unexpected element 'Q'.*(\n|\r\n|\r)\\(Q\\)(\n|\r\n|\r) \\^" }
diff --git a/gcc/testsuite/gfortran.dg/fmt_g0_2.f08 b/gcc/testsuite/gfortran.dg/fmt_g0_2.f08
index c19e3f2dca4..3567561802b 100644
--- a/gcc/testsuite/gfortran.dg/fmt_g0_2.f08
+++ b/gcc/testsuite/gfortran.dg/fmt_g0_2.f08
@@ -1,5 +1,5 @@
! { dg-do run }
-! { dg-options "-std=f95 -pedantic" }
+! { dg-options "-std=f95 -pedantic -fall-intrinsics" }
! { dg-shouldfail "Zero width in format descriptor" }
! PR36420 Fortran 2008: g0 edit descriptor
! Test case provided by Jerry DeLisle <jvdelisle@gcc.gnu.org>
diff --git a/gcc/testsuite/gfortran.dg/fmt_g0_3.f08 b/gcc/testsuite/gfortran.dg/fmt_g0_3.f08
index a84b1f10847..b0b8139a3f3 100644
--- a/gcc/testsuite/gfortran.dg/fmt_g0_3.f08
+++ b/gcc/testsuite/gfortran.dg/fmt_g0_3.f08
@@ -3,5 +3,5 @@
! Test case provided by Jerry DeLisle <jvdelisle@gcc.gnu.org>
character(25) :: string = "(g0,g0,g0)"
character(33) :: buffer
- write(buffer, '(g0,g0,g0)') ':',12340,':' ! { dg-error "Fortran F2008:" }
+ write(buffer, '(g0,g0,g0)') ':',12340,':' ! { dg-error "Fortran 2008:" }
end
diff --git a/gcc/testsuite/gfortran.dg/fmt_t_7.f b/gcc/testsuite/gfortran.dg/fmt_t_7.f
index baef07ea7bd..718668ff404 100644
--- a/gcc/testsuite/gfortran.dg/fmt_t_7.f
+++ b/gcc/testsuite/gfortran.dg/fmt_t_7.f
@@ -1,16 +1,16 @@
-! { dg-do run { target fd_truncate } }
-! PR34974 null bytes when reverse-tabbing long records
-! Test case prpared by Jerry DeLisle <jvdelisle@gcc.gnu.org>
- program test
- character(1) :: a, b, c
- write (10,'(t50000,a,t1,a)') 'b', 'a'
- close (10)
- open (10, access="stream")
- read (10, pos=1) a
- read (10, pos=50000) b
- read (10, pos=25474) c
- close (10, status="delete")
- if (a /= "a") call abort
- if (b /= "b") call abort
- if (c /= " ") call abort
- end
+! { dg-do run { target fd_truncate } }
+! PR34974 null bytes when reverse-tabbing long records
+! Test case prepared by Jerry DeLisle <jvdelisle@gcc.gnu.org>
+ program test
+ character(1) :: a, b, c
+ write (10,'(t50000,a,t1,a)') 'b', 'a'
+ close (10)
+ open (10, access="stream")
+ read (10, pos=1) a
+ read (10, pos=50000) b
+ read (10, pos=25474) c
+ close (10, status="delete")
+ if (a /= "a") call abort
+ if (b /= "b") call abort
+ if (c /= " ") call abort
+ end
diff --git a/gcc/testsuite/gfortran.dg/gamma_2.f90 b/gcc/testsuite/gfortran.dg/gamma_2.f90
index 6e8cefa6858..5b0e922cb92 100644
--- a/gcc/testsuite/gfortran.dg/gamma_2.f90
+++ b/gcc/testsuite/gfortran.dg/gamma_2.f90
@@ -8,11 +8,11 @@
! PR fortran/32980
!
subroutine foo()
-intrinsic :: gamma
-intrinsic :: dgamma
-intrinsic :: lgamma
-intrinsic :: algama
-intrinsic :: dlgama
+intrinsic :: gamma ! { dg-error "Fortran 2008" }
+intrinsic :: dgamma ! { dg-error "extension" }
+intrinsic :: lgamma ! { dg-error "extension" }
+intrinsic :: algama ! { dg-error "extension" }
+intrinsic :: dlgama ! { dg-error "extension" }
integer, parameter :: sp = kind(1.0)
integer, parameter :: dp = kind(1.0d0)
@@ -20,13 +20,13 @@ integer, parameter :: dp = kind(1.0d0)
real(sp) :: rsp = 1.0_sp
real(dp) :: rdp = 1.0_dp
-rsp = gamma(rsp) ! FIXME "is not included in the selected standard"
-rdp = gamma(rdp) ! FIXME "is not included in the selected standard"
-rdp = dgamma(rdp) ! { dg-error "is not included in the selected standard" }
+rsp = gamma(rsp)
+rdp = gamma(rdp)
+rdp = dgamma(rdp)
-rsp = lgamma(rsp) ! { dg-error "is not included in the selected standard" }
-rdp = lgamma(rdp) ! { dg-error "is not included in the selected standard" }
-rsp = algama(rsp) ! { dg-error "is not included in the selected standard" }
-rdp = dlgama(rdp) ! { dg-error "is not included in the selected standard" }
+rsp = lgamma(rsp)
+rdp = lgamma(rdp)
+rsp = algama(rsp)
+rdp = dlgama(rdp)
end subroutine foo
end
diff --git a/gcc/testsuite/gfortran.dg/gomp/block-1.f90 b/gcc/testsuite/gfortran.dg/gomp/block-1.f90
index f03602ab2f4..04c39a40a02 100644
--- a/gcc/testsuite/gfortran.dg/gomp/block-1.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/block-1.f90
@@ -2,7 +2,7 @@
!$omp parallel
!$omp critical
- goto 10 ! { dg-error "invalid exit" }
+ goto 10 ! { dg-error "invalid (exit|branch)" }
!$omp end critical
10 x = 1
!$omp end parallel
diff --git a/gcc/testsuite/gfortran.dg/internal_pack_4.f90 b/gcc/testsuite/gfortran.dg/internal_pack_4.f90
new file mode 100644
index 00000000000..049931a4f4f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/internal_pack_4.f90
@@ -0,0 +1,31 @@
+! { dg-do run }
+! { dg-options "-fdump-tree-original" }
+!
+! PR fortran/36132
+!
+! Before invalid memory was accessed because an absent, optional
+! argument was packed before passing it as absent actual.
+! Getting it to crash is difficult, but valgrind shows the problem.
+!
+MODULE M1
+ INTEGER, PARAMETER :: dp=KIND(0.0D0)
+CONTAINS
+ SUBROUTINE S1(a)
+ REAL(dp), DIMENSION(45), INTENT(OUT), &
+ OPTIONAL :: a
+ if (present(a)) call abort()
+ END SUBROUTINE S1
+ SUBROUTINE S2(a)
+ REAL(dp), DIMENSION(:, :), INTENT(OUT), &
+ OPTIONAL :: a
+ CALL S1(a)
+ END SUBROUTINE
+END MODULE M1
+
+USE M1
+CALL S2()
+END
+
+! { dg-final { scan-tree-dump-times "a != 0B \\? _gfortran_internal_pack" 1 "original" } }
+! { dg-final { scan-tree-dump-times "if \\(a != 0B &&" 1 "original" } }
+! { dg-final { cleanup-tree-dump "original" } }
diff --git a/gcc/testsuite/gfortran.dg/internal_pack_5.f90 b/gcc/testsuite/gfortran.dg/internal_pack_5.f90
new file mode 100644
index 00000000000..87705fa716a
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/internal_pack_5.f90
@@ -0,0 +1,21 @@
+! { dg-do compile }
+! { dg-options "-fdump-tree-original" }
+!
+! PR fortran/36909
+!
+! Check that no unneeded internal_unpack is
+! called (INTENT(IN)!).
+!
+program test
+ implicit none
+ integer :: a(3,3)
+ call foo(a(1,:))
+contains
+ subroutine foo(x)
+ integer,intent(in) :: x(3)
+ end subroutine foo
+end program test
+
+! { dg-final { scan-tree-dump-times "_gfortran_internal_pack" 1 "original" } }
+! { dg-final { scan-tree-dump-times "_gfortran_internal_unpack" 0 "original" } }
+! { dg-final { cleanup-tree-dump "original" } }
diff --git a/gcc/testsuite/gfortran.dg/intrinsic_argument_conformance_2.f90 b/gcc/testsuite/gfortran.dg/intrinsic_argument_conformance_2.f90
new file mode 100644
index 00000000000..44a4b39f742
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/intrinsic_argument_conformance_2.f90
@@ -0,0 +1,44 @@
+! { dg-do compile }
+! Some CSHIFT, EOSHIFT and UNPACK conformance tests
+!
+program main
+ implicit none
+ real, dimension(1) :: a1, b1, c1
+ real, dimension(1,1) :: a2, b2, c2
+ real, dimension(1,0) :: a, b, c
+ real :: tempn(1), tempv(5)
+ real,allocatable :: foo(:)
+ allocate(foo(0))
+ tempn = 2.0
+
+ a1 = 0
+ a2 = 0
+ c1 = 0
+ a2 = 0
+
+ b1 = cshift (a1,1)
+ b1 = cshift (a1,(/1/)) ! { dg-error "must be a scalar" }
+ b1 = eoshift (a1,1)
+ b2 = eoshift (a1,c1(1)) ! { dg-error "must be INTEGER" }
+ b1 = eoshift (a1,(/1/)) ! { dg-error "must be a scalar" }
+ b1 = eoshift (a1,1,boundary=c1) ! { dg-error "must be a scalar" }
+ b1 = eoshift (a1,(/1/), boundary=c2) ! { dg-error "must be a scalar" }
+
+ b2 = cshift (a2,1)
+ b2 = cshift (a2,(/1/))
+ b2 = cshift (a2,reshape([1],[1,1])) ! { dg-error "have rank 1 or be a scalar" }
+ b2 = eoshift (a2,1)
+ b2 = eoshift (a2,c1) ! { dg-error "must be INTEGER" }
+ b2 = eoshift (a2,(/1/))
+ b2 = eoshift (a2,reshape([1],[1,1]), boundary=c1) ! { dg-error "have rank 1 or be a scalar" }
+ b2 = eoshift (a2,1,boundary=c2(:,:)) ! { dg-error "have rank 1 or be a scalar" }
+ b2 = eoshift (a2,(/1/), boundary=c2(:,:)) ! { dg-error "have rank 1 or be a scalar" }
+
+ b = eoshift (a,(/1/), boundary=c(1,:)) ! { dg-error "Different shape in dimension 1" }
+
+ if (any(eoshift(foo,dim=1,shift=1,boundary=(/42.0,-7.0/))/= 0)) call abort() ! { dg-error "must be a scalar" }
+ if (any(eoshift(tempn(2:1),dim=1,shift=1,boundary=(/42.0,-7.0/))/= 0)) call abort() ! { dg-error "must be a scalar" }
+
+ if (any(unpack(tempv,tempv(1:0)/=0,tempv) /= -47)) call abort() ! { dg-error "Different shape" }
+ if (any(unpack(tempv(5:4),tempv(1:0)/=0,tempv) /= -47)) call abort() ! { dg-error "Different shape" }
+end program main
diff --git a/gcc/testsuite/gfortran.dg/intrinsic_optional_char_arg_1.f90 b/gcc/testsuite/gfortran.dg/intrinsic_optional_char_arg_1.f90
new file mode 100644
index 00000000000..5352ee4bf26
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/intrinsic_optional_char_arg_1.f90
@@ -0,0 +1,31 @@
+! { dg-do compile }
+! { dg-options "-fdump-tree-original" }
+
+! PR fortran/36403
+! Check that string lengths of optional arguments are added to the library-call
+! even if those arguments are missing.
+
+PROGRAM main
+ IMPLICIT NONE
+
+ CHARACTER(len=1) :: vect(4)
+ CHARACTER(len=1) :: matrix(2, 2)
+
+ matrix(1, 1) = ""
+ matrix(2, 1) = "a"
+ matrix(1, 2) = "b"
+ matrix(2, 2) = ""
+ vect = (/ "w", "x", "y", "z" /)
+
+ ! Call the affected intrinsics
+ vect = EOSHIFT (vect, 2)
+ vect = PACK (matrix, matrix /= "")
+ matrix = RESHAPE (vect, (/ 2, 2 /))
+
+END PROGRAM main
+
+! All library function should be called with *two* trailing arguments "1" for
+! the string lengths of both the main array and the optional argument:
+! { dg-final { scan-tree-dump "_eoshift\[0-9_\]+char \\(\[&a-zA-Z0-9._, \]+, 1, 0\\)" "original" } }
+! { dg-final { scan-tree-dump "_reshape\[0-9_\]+char \\(\[&a-zA-Z0-9._, \]+, 1, 0\\)" "original" } }
+! { dg-final { scan-tree-dump "_pack\[0-9_\]+char \\(\[&a-zA-Z0-9._, \]+, 1, 0\\)" "original" } }
diff --git a/gcc/testsuite/gfortran.dg/intrinsic_shadow_1.f03 b/gcc/testsuite/gfortran.dg/intrinsic_shadow_1.f03
new file mode 100644
index 00000000000..776d0f692d9
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/intrinsic_shadow_1.f03
@@ -0,0 +1,57 @@
+! { dg-do compile }
+! { dg-options "-std=f2003 -Wintrinsic-shadow" }
+
+! PR fortran/33141
+! Check that the expected warnings are emitted if a user-procedure has the same
+! name as an intrinsic, but only if it is matched by the current -std=*.
+
+MODULE testmod
+ IMPLICIT NONE
+
+CONTAINS
+
+ ! ASIN is an intrinsic
+ REAL FUNCTION asin (arg) ! { dg-warning "shadow the intrinsic" }
+ IMPLICIT NONE
+ REAL :: arg
+ END FUNCTION asin
+
+ ! ASINH is one but not in F2003
+ REAL FUNCTION asinh (arg) ! { dg-bogus "shadow the intrinsic" }
+ IMPLICIT NONE
+ REAL :: arg
+ END FUNCTION asinh
+
+END MODULE testmod
+
+! ACOS is an intrinsic
+REAL FUNCTION acos (arg) ! { dg-warning "of an intrinsic" }
+ IMPLICIT NONE
+ REAL :: arg
+END FUNCTION acos
+
+! ACOSH not for F2003
+REAL FUNCTION acosh (arg) ! { dg-bogus "of an intrinsic" }
+ IMPLICIT NONE
+ REAL :: arg
+END FUNCTION acosh
+
+! A subroutine with the same name as an intrinsic subroutine
+SUBROUTINE random_number (arg) ! { dg-warning "of an intrinsic" }
+ IMPLICIT NONE
+ REAL, INTENT(OUT) :: arg
+END SUBROUTINE random_number
+
+! But a subroutine with the name of an intrinsic function is ok.
+SUBROUTINE atan (arg) ! { dg-bogus "of an intrinsic" }
+ IMPLICIT NONE
+ REAL :: arg
+END SUBROUTINE atan
+
+! As should be a function with the name of an intrinsic subroutine.
+REAL FUNCTION random_seed () ! { dg-bogus "of an intrinsic" }
+END FUNCTION random_seed
+
+! We do only compile, so no main program needed.
+
+! { dg-final { cleanup-modules "testmod" } }
diff --git a/gcc/testsuite/gfortran.dg/intrinsic_shadow_2.f03 b/gcc/testsuite/gfortran.dg/intrinsic_shadow_2.f03
new file mode 100644
index 00000000000..5c046166d76
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/intrinsic_shadow_2.f03
@@ -0,0 +1,29 @@
+! { dg-do compile }
+! { dg-options "-std=f2003 -Wintrinsic-shadow -fall-intrinsics" }
+
+! PR fortran/33141
+! Check that the expected warnings are emitted if a user-procedure has the same
+! name as an intrinsic, with -fall-intrinsics even regardless of std=*.
+
+MODULE testmod
+ IMPLICIT NONE
+
+CONTAINS
+
+ ! ASINH is one but not in F2003
+ REAL FUNCTION asinh (arg) ! { dg-warning "shadow the intrinsic" }
+ IMPLICIT NONE
+ REAL :: arg
+ END FUNCTION asinh
+
+END MODULE testmod
+
+! ACOSH not for F2003
+REAL FUNCTION acosh (arg) ! { dg-warning "of an intrinsic" }
+ IMPLICIT NONE
+ REAL :: arg
+END FUNCTION acosh
+
+! We do only compile, so no main program needed.
+
+! { dg-final { cleanup-modules "testmod" } }
diff --git a/gcc/testsuite/gfortran.dg/intrinsic_shadow_3.f03 b/gcc/testsuite/gfortran.dg/intrinsic_shadow_3.f03
new file mode 100644
index 00000000000..069a99b3433
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/intrinsic_shadow_3.f03
@@ -0,0 +1,27 @@
+! { dg-do compile }
+! { dg-options "-Wno-intrinsic-shadow -fall-intrinsics" }
+
+! PR fortran/33141
+! Check that the "intrinsic shadow" warnings are not emitted if the warning
+! is negated.
+
+MODULE testmod
+ IMPLICIT NONE
+
+CONTAINS
+
+ REAL FUNCTION asin (arg) ! { dg-bogus "shadow the intrinsic" }
+ IMPLICIT NONE
+ REAL :: arg
+ END FUNCTION asin
+
+END MODULE testmod
+
+REAL FUNCTION acos (arg) ! { dg-bogus "of an intrinsic" }
+ IMPLICIT NONE
+ REAL :: arg
+END FUNCTION acos
+
+! We do only compile, so no main program needed.
+
+! { dg-final { cleanup-modules "testmod" } }
diff --git a/gcc/testsuite/gfortran.dg/intrinsic_std_1.f90 b/gcc/testsuite/gfortran.dg/intrinsic_std_1.f90
new file mode 100644
index 00000000000..efb1dce5456
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/intrinsic_std_1.f90
@@ -0,0 +1,48 @@
+! { dg-do compile }
+! { dg-options "-std=f95 -Wintrinsics-std -fdump-tree-original" }
+
+! PR fortran/33141
+! Check for the expected behaviour when an intrinsic function/subroutine is
+! called that is not available in the defined standard or that is a GNU
+! extension:
+! There should be a warning emitted on the call, and the reference should be
+! treated like an external call.
+! For declaring a non-standard intrinsic INTRINSIC, a hard error should be
+! generated, of course.
+
+SUBROUTINE no_implicit
+ IMPLICIT NONE
+ REAL :: asinh ! { dg-warning "Fortran 2008" }
+
+ ! abort is a GNU extension
+ CALL abort () ! { dg-warning "extension" }
+
+ ! ASINH is an intrinsic of F2008
+ ! The warning should be issued in the declaration above where it is declared
+ ! EXTERNAL.
+ WRITE (*,*) ASINH (1.) ! { dg-bogus "Fortran 2008" }
+END SUBROUTINE no_implicit
+
+SUBROUTINE implicit_type
+ ! acosh has implicit type
+
+ WRITE (*,*) ACOSH (1.) ! { dg-warning "Fortran 2008" }
+ WRITE (*,*) ACOSH (1.) ! { dg-bogus "Fortran 2008" }
+END SUBROUTINE implicit_type
+
+SUBROUTINE specification_expression
+ CHARACTER(KIND=selected_char_kind("ascii")) :: x
+! { dg-error "specification function" "" { target "*-*-*" } 34 }
+! { dg-warning "Fortran 2003" "" { target "*-*-*" } 34 }
+END SUBROUTINE specification_expression
+
+SUBROUTINE intrinsic_decl
+ IMPLICIT NONE
+ INTRINSIC :: atanh ! { dg-error "Fortran 2008" }
+ INTRINSIC :: abort ! { dg-error "extension" }
+END SUBROUTINE intrinsic_decl
+
+! Scan that really external functions are called.
+! { dg-final { scan-tree-dump " abort " "original" } }
+! { dg-final { scan-tree-dump " asinh " "original" } }
+! { dg-final { scan-tree-dump " acosh " "original" } }
diff --git a/gcc/testsuite/gfortran.dg/intrinsic_std_2.f90 b/gcc/testsuite/gfortran.dg/intrinsic_std_2.f90
new file mode 100644
index 00000000000..6112d906d42
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/intrinsic_std_2.f90
@@ -0,0 +1,15 @@
+! { dg-do link }
+! { dg-options "-std=f95 -Wintrinsics-std -fall-intrinsics" }
+
+! PR fortran/33141
+! Check that -fall-intrinsics makes all intrinsics available.
+
+PROGRAM main
+ IMPLICIT NONE
+
+ ! abort is a GNU extension
+ CALL abort () ! { dg-bogus "extension" }
+
+ ! ASINH is an intrinsic of F2008
+ WRITE (*,*) ASINH (1.) ! { dg-bogus "Fortran 2008" }
+END PROGRAM main
diff --git a/gcc/testsuite/gfortran.dg/intrinsic_std_3.f90 b/gcc/testsuite/gfortran.dg/intrinsic_std_3.f90
new file mode 100644
index 00000000000..15a424b1c91
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/intrinsic_std_3.f90
@@ -0,0 +1,15 @@
+! { dg-do link }
+! { dg-options "-std=gnu -Wintrinsics-std" }
+
+! PR fortran/33141
+! -std=gnu should allow every intrinsic.
+
+PROGRAM main
+ IMPLICIT NONE
+
+ ! abort is a GNU extension
+ CALL abort () ! { dg-bogus "extension" }
+
+ ! ASINH is an intrinsic of F2008
+ WRITE (*,*) ASINH (1.) ! { dg-bogus "Fortran 2008" }
+END PROGRAM main
diff --git a/gcc/testsuite/gfortran.dg/intrinsic_std_4.f90 b/gcc/testsuite/gfortran.dg/intrinsic_std_4.f90
new file mode 100644
index 00000000000..e83ed4c884d
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/intrinsic_std_4.f90
@@ -0,0 +1,46 @@
+! { dg-do run }
+! { dg-options "-std=f95 -Wno-intrinsics-std" }
+
+! PR fortran/33141
+! Check that calls to intrinsics not in the current standard are "allowed" and
+! linked to external procedures with that name.
+! Addionally, this checks that -Wno-intrinsics-std turns off the warning.
+
+SUBROUTINE abort ()
+ IMPLICIT NONE
+ WRITE (*,*) "Correct"
+END SUBROUTINE abort
+
+REAL FUNCTION asinh (arg)
+ IMPLICIT NONE
+ REAL :: arg
+
+ WRITE (*,*) "Correct"
+ asinh = arg
+END FUNCTION asinh
+
+SUBROUTINE implicit_none
+ IMPLICIT NONE
+ REAL :: asinh ! { dg-bogus "Fortran 2008" }
+ REAL :: x
+
+ ! Both times our version above should be called
+ CALL abort () ! { dg-bogus "extension" }
+ x = ASINH (1.) ! { dg-bogus "Fortran 2008" }
+END SUBROUTINE implicit_none
+
+SUBROUTINE implicit_type
+ ! ASINH has implicit type here
+ REAL :: x
+
+ ! Our version should be called
+ x = ASINH (1.) ! { dg-bogus "Fortran 2008" }
+END SUBROUTINE implicit_type
+
+PROGRAM main
+ ! This should give a total of three "Correct"s
+ CALL implicit_none ()
+ CALL implicit_type ()
+END PROGRAM main
+
+! { dg-output "Correct\.*Correct\.*Correct" }
diff --git a/gcc/testsuite/gfortran.dg/module_md5_1.f90 b/gcc/testsuite/gfortran.dg/module_md5_1.f90
index b9bb5fa1eb6..f52426fbd00 100644
--- a/gcc/testsuite/gfortran.dg/module_md5_1.f90
+++ b/gcc/testsuite/gfortran.dg/module_md5_1.f90
@@ -10,5 +10,5 @@ program test
use foo
print *, pi
end program test
-! { dg-final { scan-module "foo" "MD5:2350094d1d87eb25ab22af5f8e96e011" } }
+! { dg-final { scan-module "foo" "MD5:596df8f39d3ddc0b847771cadcb26274" } }
! { dg-final { cleanup-modules "foo" } }
diff --git a/gcc/testsuite/gfortran.dg/namelist_52.f90 b/gcc/testsuite/gfortran.dg/namelist_52.f90
new file mode 100644
index 00000000000..6e31382927f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/namelist_52.f90
@@ -0,0 +1,32 @@
+! { dg-do run }
+! PR36582 Namelist I/O error: Bogus "Cannot match namelist object"
+! Test case derived from PR.
+module mod1
+
+type screen_io_type
+integer :: begin
+end type screen_io_type
+
+type adjoint_type
+type(screen_io_type) :: screen_io_fs_ntime
+character(12) :: solver_type
+end type adjoint_type
+
+type(adjoint_type) :: adjoint
+namelist/info_adjoint/adjoint
+
+end module mod1
+
+program gfortran_error_2
+use mod1
+adjoint%solver_type = "abcdefghijkl"
+open(31,status='scratch')
+write(31, '(a)') "&info_adjoint"
+write(31, '(a)') "adjoint%solver_type = 'direct'"
+write(31, '(a)') "adjoint%screen_io_fs_ntime%begin = 42"
+write(31, '(a)') "/"
+rewind(31)
+read(31,nml=info_adjoint)
+if (adjoint%solver_type /= 'direct') call abort
+if (adjoint%screen_io_fs_ntime%begin /= 42) call abort
+end program gfortran_error_2
diff --git a/gcc/testsuite/gfortran.dg/parameter_array_init_4.f90 b/gcc/testsuite/gfortran.dg/parameter_array_init_4.f90
index 5bdcb3723b1..f6c2f84b2a8 100644
--- a/gcc/testsuite/gfortran.dg/parameter_array_init_4.f90
+++ b/gcc/testsuite/gfortran.dg/parameter_array_init_4.f90
@@ -15,10 +15,10 @@ character(kind=1,len=*), parameter :: str1(2) = [ 1_'Ac',1_'cc']
character(kind=1,len=*), parameter :: str_s1 = 'Acc'
CHARACTER (kind=4,len=*) MY_STRING4(1:3), my_string_s4
-PARAMETER ( MY_STRING4 = (/ "A" , "B", "C" /) )
-PARAMETER ( MY_STRING_S4 = "AB C" )
-character(kind=4,len=*), parameter :: str4(2) = [ 1_'Ac',1_'cc']
-character(kind=4,len=*), parameter :: str_s4 = 'Acc'
+PARAMETER ( MY_STRING4 = (/ 4_"A" , 4_"B", 4_"C" /) )
+PARAMETER ( MY_STRING_S4 = 4_"AB C" )
+character(kind=4,len=*), parameter :: str4(2) = [ 4_'Ac',4_'cc']
+character(kind=4,len=*), parameter :: str_s4 = 4_'Acc'
if(len(MY_STRING) /= 1) call abort()
if( MY_STRING(1) /= "A" &
diff --git a/gcc/testsuite/gfortran.dg/pointer_to_substring.f90 b/gcc/testsuite/gfortran.dg/pointer_to_substring.f90
new file mode 100644
index 00000000000..054a29d56bb
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pointer_to_substring.f90
@@ -0,0 +1,10 @@
+! { dg-do compile }
+! PR36724 - ICE on pointer to substring
+! testcase contributed by Loukas Peristeras.
+
+ character(LEN=132), target :: line
+ character(LEN=1), pointer :: t
+
+ read(*,'(A)') line
+ t=>line(1:1)
+end
diff --git a/gcc/testsuite/gfortran.dg/pr36967.f b/gcc/testsuite/gfortran.dg/pr36967.f
new file mode 100644
index 00000000000..4f8589771b8
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr36967.f
@@ -0,0 +1,25 @@
+! { dg-options "-O2 -fpredictive-commoning" }
+ subroutine foo(x,y,n)
+ integer n
+ real*8 y(n,n,n),x(n,n,n)
+ integer k, j, i
+ do k = 2, n-1
+ do j = 2, n-1
+ do I = 2, n-1
+ y(i,j,k) = y(i,j,k)
+ + + (x(i-1,j-1,k)
+ + + x(i,j-1,k-1)
+ + + x(i,j+1,k-1)
+ + + x(i,j+1,k+1)
+ + + x(i+1,j,k+1))
+ + + (x(i-1,j-1,k-1)
+ + + x(i+1,j-1,k-1)
+ + + x(i-1,j+1,k-1)
+ + + x(i+1,j+1,k-1)
+ + + x(i-1,j+1,k+1)
+ + + x(i+1,j+1,k+1))
+ enddo
+ enddo
+ enddo
+ return
+ end
diff --git a/gcc/testsuite/gfortran.dg/private_type_6.f90 b/gcc/testsuite/gfortran.dg/private_type_6.f90
index d3cc809dfef..5e13ed53477 100644
--- a/gcc/testsuite/gfortran.dg/private_type_6.f90
+++ b/gcc/testsuite/gfortran.dg/private_type_6.f90
@@ -19,7 +19,7 @@ program foo_test
TYPE(footype) :: foo
TYPE(bartype) :: foo2
foo = footype(1) ! { dg-error "All components of 'footype' are PRIVATE" }
- foo2 = bartype(1,2) ! { dg-error "'dummy2' is PRIVATE" }
+ foo2 = bartype(1,2) ! { dg-error "is a PRIVATE component" }
foo2%dummy2 = 5 ! { dg-error "is a PRIVATE component" }
end program foo_test
! { dg-final { cleanup-modules "foomod" } }
diff --git a/gcc/testsuite/gfortran.dg/proc_decl_1.f90 b/gcc/testsuite/gfortran.dg/proc_decl_1.f90
index 3e7a3d18fb7..219722f7a2d 100644
--- a/gcc/testsuite/gfortran.dg/proc_decl_1.f90
+++ b/gcc/testsuite/gfortran.dg/proc_decl_1.f90
@@ -53,13 +53,13 @@ program prog
contains
- subroutine foo(a,c)
+ subroutine foo(a,c) ! { dg-error "PROCEDURE attribute conflicts with INTENT attribute" }
abstract interface
subroutine b() bind(C)
end subroutine b
end interface
procedure(b), bind(c,name="hjj") :: a ! { dg-error "may not have BIND.C. attribute with NAME" }
- procedure(c),intent(in):: c ! { dg-error "PROCEDURE attribute conflicts with INTENT attribute" }
+ procedure(b),intent(in):: c
end subroutine foo
end program
diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_9.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_9.f90
new file mode 100644
index 00000000000..22708b8f1a8
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/proc_ptr_9.f90
@@ -0,0 +1,18 @@
+! { dg-do compile }
+!
+! PR fortran/36705
+!
+! Contributed by Tobias Burnus <burnus@gcc.gnu.org>
+
+save :: p
+procedure() :: p
+pointer :: p
+
+contains
+
+subroutine bar(x)
+ procedure(), intent(in) :: x
+ pointer :: x
+end subroutine bar
+
+end
diff --git a/gcc/testsuite/gfortran.dg/rank_2.f90 b/gcc/testsuite/gfortran.dg/rank_2.f90
index b7d75dbeae4..cd52cc446e2 100644
--- a/gcc/testsuite/gfortran.dg/rank_2.f90
+++ b/gcc/testsuite/gfortran.dg/rank_2.f90
@@ -5,4 +5,8 @@
! Fortran 2008 allows 15 dimensions (including co-array ranks)
!
integer :: a(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15) ! { dg-error "more than 7 dimensions" }
+
+! PR fortran/36825:
+integer,parameter :: N=10
+complex,dimension(-N:N,-N:N,0:1,0:1,-N:N,-N:N,0:1,0:1) :: P ! { dg-error "more than 7 dimensions" }
end
diff --git a/gcc/testsuite/gfortran.dg/reassoc_4.f b/gcc/testsuite/gfortran.dg/reassoc_4.f
new file mode 100644
index 00000000000..70043658d22
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/reassoc_4.f
@@ -0,0 +1,43 @@
+! { dg-do compile }
+! { dg-options "-O3 -ffast-math -fdump-tree-reassoc1" }
+ subroutine anisonl(w,vo,anisox,s,ii1,jj1,weight)
+ integer ii1,jj1,i1,iii1,j1,jjj1,k1,l1,m1,n1
+ real*8 w(3,3),vo(3,3),anisox(3,3,3,3),s(60,60),weight
+!
+! This routine replaces the following lines in e_c3d.f for
+! an anisotropic material
+!
+ do i1=1,3
+ iii1=ii1+i1-1
+ do j1=1,3
+ jjj1=jj1+j1-1
+ do k1=1,3
+ do l1=1,3
+ s(iii1,jjj1)=s(iii1,jjj1)
+ & +anisox(i1,k1,j1,l1)*w(k1,l1)*weight
+ do m1=1,3
+ s(iii1,jjj1)=s(iii1,jjj1)
+ & +anisox(i1,k1,m1,l1)*w(k1,l1)
+ & *vo(j1,m1)*weight
+ & +anisox(m1,k1,j1,l1)*w(k1,l1)
+ & *vo(i1,m1)*weight
+ do n1=1,3
+ s(iii1,jjj1)=s(iii1,jjj1)
+ & +anisox(m1,k1,n1,l1)
+ & *w(k1,l1)*vo(i1,m1)*vo(j1,n1)*weight
+ enddo
+ enddo
+ enddo
+ enddo
+ enddo
+ enddo
+
+ return
+ end
+
+! There should be 22 multiplications left after un-distributing
+! weigth, w(k1,l1), vo(i1,m1) and vo(j1,m1) on the innermost two
+! unrolled loops.
+
+! { dg-final { scan-tree-dump-times "\[0-9\] \\\* " 22 "reassoc1" } }
+! { dg-final { cleanup-tree-dump "reassoc1" } }
diff --git a/gcc/testsuite/gfortran.dg/selected_char_kind_3.f90 b/gcc/testsuite/gfortran.dg/selected_char_kind_3.f90
index 5cc7b112496..a7b7ae7d895 100644
--- a/gcc/testsuite/gfortran.dg/selected_char_kind_3.f90
+++ b/gcc/testsuite/gfortran.dg/selected_char_kind_3.f90
@@ -1,10 +1,10 @@
! { dg-do compile }
-! { dg-options "-std=f95 -pedantic -Wall" }
+! { dg-options "-std=f95 -pedantic -Wall -Wno-intrinsics-std" }
!
! Check that SELECTED_CHAR_KIND is rejected with -std=f95
!
implicit none
- character(kind=selected_char_kind("ascii")) :: s ! { dg-error "is not included in the selected standard" }
+ character(kind=selected_char_kind("ascii")) :: s ! { dg-error "must be an intrinsic or a specification function" }
s = "" ! { dg-error "has no IMPLICIT type" }
print *, s
end
diff --git a/gcc/testsuite/gfortran.dg/structure_constructor_7.f03 b/gcc/testsuite/gfortran.dg/structure_constructor_7.f03
index 3ba79ea373b..5388e8805eb 100644
--- a/gcc/testsuite/gfortran.dg/structure_constructor_7.f03
+++ b/gcc/testsuite/gfortran.dg/structure_constructor_7.f03
@@ -13,6 +13,6 @@ PROGRAM test
TYPE(basics_t) :: basics
basics = basics_t (42, 1.5, 1000) ! { dg-error "Too many components" }
- basics = basics_t (42, xxx = 1000) ! { dg-error "Component 'xxx'" }
+ basics = basics_t (42, xxx = 1000) ! { dg-error "is not a member" }
END PROGRAM test
diff --git a/gcc/testsuite/gfortran.dg/structure_constructor_8.f03 b/gcc/testsuite/gfortran.dg/structure_constructor_8.f03
index 4b0bce779db..520b52853d5 100644
--- a/gcc/testsuite/gfortran.dg/structure_constructor_8.f03
+++ b/gcc/testsuite/gfortran.dg/structure_constructor_8.f03
@@ -47,8 +47,8 @@ PROGRAM test
struct2 = allpriv_t ()
! These should fail
- struct1 = haspriv_t (1, 2) ! { dg-error "'b' is PRIVATE" }
- struct1 = haspriv_t (b = 2, a = 1) ! { dg-error "'b' is PRIVATE" }
+ struct1 = haspriv_t (1, 2) ! { dg-error "is a PRIVATE component" }
+ struct1 = haspriv_t (b = 2, a = 1) ! { dg-error "is a PRIVATE component" }
! This should fail as all components are private
struct2 = allpriv_t (5) ! { dg-error "of 'allpriv_t' are PRIVATE" }
diff --git a/gcc/testsuite/gfortran.dg/warn_std_1.f90 b/gcc/testsuite/gfortran.dg/warn_std_1.f90
index 4d709a12cdf..b0e4b5d4148 100644
--- a/gcc/testsuite/gfortran.dg/warn_std_1.f90
+++ b/gcc/testsuite/gfortran.dg/warn_std_1.f90
@@ -1,5 +1,5 @@
! { dg-do compile }
-! { dg-options "-Wnonstd-intrinsics -std=gnu" }
+! { dg-options "-std=gnu" }
!
! PR fortran/32778 - pedantic warning: intrinsics that
! are GNU extensions not part of -std=gnu
diff --git a/gcc/testsuite/gfortran.dg/warn_std_2.f90 b/gcc/testsuite/gfortran.dg/warn_std_2.f90
index 0a8c509d5c6..325fc8cb6e1 100644
--- a/gcc/testsuite/gfortran.dg/warn_std_2.f90
+++ b/gcc/testsuite/gfortran.dg/warn_std_2.f90
@@ -1,5 +1,5 @@
! { dg-do compile }
-! { dg-options "-Wnonstd-intrinsics -std=f95" }
+! { dg-options "-std=f95 -Wintrinsics-std" }
!
! PR fortran/32778 - pedantic warning: intrinsics that
! are GNU extensions not part of -std=gnu
@@ -11,15 +11,15 @@ CHARACTER(len=255) :: tmp
REAL(8) :: x
! GNU extension, check overload of F77 standard intrinsic
-x = ZABS(CMPLX(0.0, 1.0, 8)) ! { dg-error "is not included in the selected standard" }
+x = ZABS(CMPLX(0.0, 1.0, 8)) ! { dg-warning "extension" }
! GNU extension
-CALL flush() ! { dg-error "is not included in the selected standard" }
+CALL flush() ! { dg-warning "extension" }
! F95
tmp = ADJUSTL(" gfortran ")
! F2003
-CALL GET_COMMAND (tmp) ! { dg-error "is not included in the selected standard" }
+CALL GET_COMMAND (tmp) ! { dg-warning "Fortran 2003" }
END
diff --git a/gcc/testsuite/gfortran.dg/warn_std_3.f90 b/gcc/testsuite/gfortran.dg/warn_std_3.f90
index 0d0a0f149bd..89fe257389b 100644
--- a/gcc/testsuite/gfortran.dg/warn_std_3.f90
+++ b/gcc/testsuite/gfortran.dg/warn_std_3.f90
@@ -1,5 +1,5 @@
! { dg-do compile }
-! { dg-options "-Wnonstd-intrinsics -std=f2003" }
+! { dg-options "-std=f2003 -Wintrinsics-std" }
!
! PR fortran/32778 - pedantic warning: intrinsics that
! are GNU extensions not part of -std=gnu
@@ -11,10 +11,10 @@ CHARACTER(len=255) :: tmp
REAL(8) :: x
! GNU extension, check overload of F77 standard intrinsic
-x = ZABS(CMPLX(0.0, 1.0, 8)) ! { dg-error "is not included in the selected standard" }
+x = ZABS(CMPLX(0.0, 1.0, 8)) ! { dg-warning "extension" }
! GNU extension
-CALL flush() ! { dg-error "is not included in the selected standard" }
+CALL flush() ! { dg-warning "extension" }
! F95
tmp = ADJUSTL(" gfortran ")
diff --git a/gcc/testsuite/gfortran.dg/zero_sized_1.f90 b/gcc/testsuite/gfortran.dg/zero_sized_1.f90
index 224b2c007d3..5461fb1a7f0 100644
--- a/gcc/testsuite/gfortran.dg/zero_sized_1.f90
+++ b/gcc/testsuite/gfortran.dg/zero_sized_1.f90
@@ -49,8 +49,8 @@ subroutine test_eoshift
if (any(eoshift(tempm(:,5:4),shift=(/1,-1/),dim=1,boundary=42.0)/= 0)) call abort
if (any(eoshift(tempm(:,5:4),shift=(/1,-1/),dim=2,boundary=42.0)/= 0)) call abort
- if (any(eoshift(foo,dim=1,shift=1,boundary=(/42.0,-7.0/))/= 0)) call abort
- if (any(eoshift(tempn(2:1),dim=1,shift=1,boundary=(/42.0,-7.0/))/= 0)) call abort
+ if (any(eoshift(foo,dim=1,shift=1,boundary=42.0)/= 0)) call abort
+ if (any(eoshift(tempn(2:1),dim=1,shift=1,boundary=-7.0)/= 0)) call abort
if (any(eoshift(bar,shift=(/1,-1/),dim=1,boundary=(/42.0,-7.0/))/= 0)) call abort
if (any(eoshift(bar,shift=(/1,-1/),dim=2,boundary=(/42.0,-7.0/))/= 0)) call abort
if (any(eoshift(gee,shift=(/1,-1/),dim=1,boundary=(/42.0,-7.0/))/= 0)) call abort
@@ -159,15 +159,17 @@ end
subroutine test_unpack
integer :: tempn(1,5), tempv(5)
integer,allocatable :: foo(:,:), bar(:)
+ integer :: zero
tempn = 2
tempv = 5
+ zero = 0
allocate(foo(0,1:7),bar(0:-1))
if (any(unpack(tempv,tempv/=0,tempv) /= 5) .or. &
size(unpack(tempv,tempv/=0,tempv)) /= 5) call abort
if (any(unpack(tempv(1:0),tempv/=0,tempv) /= 5) .or. &
size(unpack(tempv(1:0),tempv/=0,tempv)) /= 5) call abort
- if (any(unpack(tempv,tempv(1:0)/=0,tempv) /= -47)) call abort
- if (any(unpack(tempv(5:4),tempv(1:0)/=0,tempv) /= -47)) call abort
+ if (any(unpack(tempv,tempv(1:zero)/=0,tempv) /= -47)) call abort
+ if (any(unpack(tempv(5:4),tempv(1:zero)/=0,tempv) /= -47)) call abort
if (any(unpack(bar,foo==foo,foo) /= -47)) call abort
deallocate(foo,bar)
end
diff --git a/gcc/testsuite/gfortran.dg/zero_sized_5.f90 b/gcc/testsuite/gfortran.dg/zero_sized_5.f90
new file mode 100644
index 00000000000..30ca8bf8199
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/zero_sized_5.f90
@@ -0,0 +1,15 @@
+! { dg-do run }
+! These used to segfault.
+program main
+ real, dimension(1,0) :: a, b, c
+ integer, dimension(0) :: j
+ a = 0
+ c = 0
+ b = cshift (a,1)
+ b = cshift (a,j)
+ b = eoshift (a,1)
+ b = eoshift (a,(/1/))
+ b = eoshift (a,1,boundary=c(1,:))
+ b = eoshift (a, j, boundary=c(1,:))
+
+end program main
diff --git a/gcc/testsuite/gnat.dg/access_discr2.adb b/gcc/testsuite/gnat.dg/access_discr2.adb
new file mode 100644
index 00000000000..ceeeb464535
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/access_discr2.adb
@@ -0,0 +1,10 @@
+-- { dg-do run }
+
+procedure access_discr2 is
+ type X (I : not null access Integer) is tagged null record;
+
+ I : aliased Integer := 8;
+ Y : X (I'Access);
+begin
+ null;
+end access_discr2;
diff --git a/gcc/testsuite/gnat.dg/allocator_maxalign1.adb b/gcc/testsuite/gnat.dg/allocator_maxalign1.adb
new file mode 100644
index 00000000000..062c39bbf87
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/allocator_maxalign1.adb
@@ -0,0 +1,42 @@
+-- { dg-do run }
+
+with System.Storage_Elements; use System.Storage_Elements;
+with Ada.Unchecked_Deallocation;
+
+procedure Allocator_Maxalign1 is
+
+ Max_Alignment : constant := Standard'Maximum_Alignment;
+
+ type Block is record
+ X : Integer;
+ end record;
+ for Block'Alignment use Standard'Maximum_Alignment;
+
+ type Block_Access is access all Block;
+ procedure Free is new Ada.Unchecked_Deallocation (Block, Block_Access);
+
+ N_Blocks : constant := 500;
+ Blocks : array (1 .. N_Blocks) of Block_Access;
+begin
+ if Block'Alignment /= Max_Alignment then
+ raise Program_Error;
+ end if;
+
+ for K in 1 .. 4 loop
+
+ for I in Blocks'Range loop
+ Blocks (I) := new Block;
+ if Blocks (I).all'Address mod Block'Alignment /= 0 then
+ raise Program_Error;
+ end if;
+ Blocks(I).all.X := I;
+ end loop;
+
+ for I in Blocks'Range loop
+ Free (Blocks (I));
+ end loop;
+
+ end loop;
+
+end;
+
diff --git a/gcc/testsuite/gnat.dg/allocator_maxalign2.adb b/gcc/testsuite/gnat.dg/allocator_maxalign2.adb
new file mode 100644
index 00000000000..10644ea6b3c
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/allocator_maxalign2.adb
@@ -0,0 +1,33 @@
+with System, System.Storage_Elements;
+use System.Storage_Elements;
+
+package body Allocator_Maxalign2 is
+
+ Max_Align : constant Storage_Offset := Standard'Maximum_Alignment;
+
+ procedure Validate is
+ use type System.Address;
+ begin
+ if Addr mod Max_Align /= 0 then
+ raise Program_Error;
+ end if;
+ end;
+
+ procedure Check is
+ I : Integer;
+ B : Block;
+ type Block_Access is access all Block;
+ A : Block_Access;
+ begin
+ Addr := I'Address;
+ Addr := B'Address;
+ Validate;
+ for I in 1 .. 50 loop
+ A := new Block;
+ Addr := A.all'Address;
+ Validate;
+ end loop;
+
+ end;
+
+end;
diff --git a/gcc/testsuite/gnat.dg/allocator_maxalign2.ads b/gcc/testsuite/gnat.dg/allocator_maxalign2.ads
new file mode 100644
index 00000000000..43c01081cb6
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/allocator_maxalign2.ads
@@ -0,0 +1,12 @@
+with System;
+
+package Allocator_Maxalign2 is
+ type Block is record
+ X : Integer;
+ end record;
+ for Block'Alignment use Standard'Maximum_Alignment;
+
+ Addr : System.Address;
+
+ procedure Check;
+end;
diff --git a/gcc/testsuite/gnat.dg/bip_aggregate_bug.adb b/gcc/testsuite/gnat.dg/bip_aggregate_bug.adb
new file mode 100644
index 00000000000..ce8daeb5e16
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/bip_aggregate_bug.adb
@@ -0,0 +1,49 @@
+-- { dg-do run }
+
+procedure BIP_Aggregate_Bug is
+
+ package Limited_Types is
+
+ type Lim_Tagged is tagged limited record
+ Root_Comp : Integer;
+ end record;
+
+ type Lim_Ext is new Lim_Tagged with record
+ Ext_Comp : Integer;
+ end record;
+
+ function Func_Lim_Tagged (Choice : Integer) return Lim_Tagged'Class;
+
+ end Limited_Types;
+
+ package body Limited_Types is
+
+ function Func_Lim_Tagged (Choice : Integer) return Lim_Tagged'Class is
+ begin
+ case Choice is
+ when 111 =>
+ return Lim_Ext'(Root_Comp => Choice, Ext_Comp => Choice);
+ when 222 =>
+ return Result : Lim_Tagged'Class
+ := Lim_Ext'(Root_Comp => Choice, Ext_Comp => Choice);
+ when others =>
+ return Lim_Tagged'(Root_Comp => Choice);
+ end case;
+ end Func_Lim_Tagged;
+
+ end Limited_Types;
+
+ use Limited_Types;
+
+ LT_Root : Lim_Tagged'Class := Func_Lim_Tagged (Choice => 999);
+ LT_Ext1 : Lim_Tagged'Class := Func_Lim_Tagged (Choice => 111);
+ LT_Ext2 : Lim_Tagged'Class := Func_Lim_Tagged (Choice => 222);
+
+begin
+ if LT_Root.Root_Comp /= 999
+ or else Lim_Ext (LT_Ext1).Ext_Comp /= 111
+ or else Lim_Ext (LT_Ext2).Ext_Comp /= 222
+ then
+ raise Program_Error;
+ end if;
+end BIP_Aggregate_Bug;
diff --git a/gcc/testsuite/gnat.dg/boolean_expr1.adb b/gcc/testsuite/gnat.dg/boolean_expr1.adb
new file mode 100644
index 00000000000..ddfe32bfb64
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/boolean_expr1.adb
@@ -0,0 +1,30 @@
+-- PR middle-end/36554
+-- Origin: Laurent Guerby <laurent@guerby.net>
+
+-- { dg-do compile }
+-- { dg-options "-O2" }
+
+package body Boolean_Expr1 is
+
+ function Long_Float_Is_Valid (X : in Long_Float) return Boolean is
+ Is_Nan : constant Boolean := X /= X;
+ Is_P_Inf : constant Boolean := X > Long_Float'Last;
+ Is_M_Inf : constant Boolean := X < Long_Float'First;
+ Is_Invalid : constant Boolean := Is_Nan or Is_P_Inf or Is_M_Inf;
+ begin
+ return not Is_Invalid;
+ end Long_Float_Is_Valid;
+
+ function S (V : in Long_Float) return String is
+ begin
+ if not Long_Float_Is_Valid (V) then
+ return "INVALID";
+ else
+ return "OK";
+ end if;
+ exception
+ when others =>
+ return "ERROR";
+ end S;
+
+end Boolean_Expr1;
diff --git a/gcc/testsuite/gnat.dg/boolean_expr1.ads b/gcc/testsuite/gnat.dg/boolean_expr1.ads
new file mode 100644
index 00000000000..526551135f5
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/boolean_expr1.ads
@@ -0,0 +1,5 @@
+package Boolean_Expr1 is
+
+ function S (V : in Long_Float) return String;
+
+end Boolean_Expr1;
diff --git a/gcc/testsuite/gnat.dg/boolean_expr2.adb b/gcc/testsuite/gnat.dg/boolean_expr2.adb
new file mode 100644
index 00000000000..8bdcb84e933
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/boolean_expr2.adb
@@ -0,0 +1,18 @@
+-- { dg-do run }
+
+procedure Boolean_Expr2 is
+
+ function Ident_Bool (B : Boolean) return Boolean is
+ begin
+ return B;
+ end;
+
+begin
+ if Boolean'Succ (Ident_Bool(False)) /= True then
+ raise Program_Error;
+ end if;
+
+ if Boolean'Pred (Ident_Bool(True)) /= False then
+ raise Program_Error;
+ end if;
+end;
diff --git a/gcc/testsuite/gnat.dg/decl_ctx_def.ads b/gcc/testsuite/gnat.dg/decl_ctx_def.ads
new file mode 100644
index 00000000000..dd004dfe07a
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/decl_ctx_def.ads
@@ -0,0 +1,4 @@
+
+package DECL_CTX_Def is
+ X : exception;
+end;
diff --git a/gcc/testsuite/gnat.dg/decl_ctx_use.adb b/gcc/testsuite/gnat.dg/decl_ctx_use.adb
new file mode 100644
index 00000000000..c4fde2b3eb2
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/decl_ctx_use.adb
@@ -0,0 +1,14 @@
+-- { dg-do compile }
+-- { dg-options "-O1" }
+with DECL_CTX_Def; use DECL_CTX_Def;
+package body DECL_CTX_Use is
+ procedure Check_1 is
+ begin
+ raise X;
+ end;
+
+ procedure Check_2 is
+ begin
+ raise X;
+ end;
+end;
diff --git a/gcc/testsuite/gnat.dg/decl_ctx_use.ads b/gcc/testsuite/gnat.dg/decl_ctx_use.ads
new file mode 100644
index 00000000000..2f38f891793
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/decl_ctx_use.ads
@@ -0,0 +1,5 @@
+
+package DECL_CTX_Use is
+ procedure Check_1;
+ procedure Check_2;
+end;
diff --git a/gcc/testsuite/gnat.dg/deferred_const1.adb b/gcc/testsuite/gnat.dg/deferred_const1.adb
new file mode 100644
index 00000000000..79b9f4a0325
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/deferred_const1.adb
@@ -0,0 +1,12 @@
+-- { dg-do compile }
+
+with Text_IO; use Text_IO;
+
+procedure Deferred_Const1 is
+ I : Integer := 16#20_3A_2D_28#;
+ S : constant string(1..4);
+ for S'address use I'address; -- { dg-warning "constant overlays a variable" }
+ pragma Import (Ada, S);
+begin
+ Put_Line (S);
+end;
diff --git a/gcc/testsuite/gnat.dg/deferred_const2.adb b/gcc/testsuite/gnat.dg/deferred_const2.adb
new file mode 100644
index 00000000000..ee06db79cc9
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/deferred_const2.adb
@@ -0,0 +1,11 @@
+-- { dg-do run }
+
+with System; use System;
+with Deferred_Const2_Pkg; use Deferred_Const2_Pkg;
+
+procedure Deferred_Const2 is
+begin
+ if I'Address /= S'Address then
+ raise Program_Error;
+ end if;
+end;
diff --git a/gcc/testsuite/gnat.dg/deferred_const2_pkg.adb b/gcc/testsuite/gnat.dg/deferred_const2_pkg.adb
new file mode 100644
index 00000000000..b81d448863b
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/deferred_const2_pkg.adb
@@ -0,0 +1,11 @@
+with System; use System;
+
+package body Deferred_Const2_Pkg is
+
+ procedure Dummy is begin null; end;
+
+begin
+ if S'Address /= I'Address then
+ raise Program_Error;
+ end if;
+end Deferred_Const2_Pkg;
diff --git a/gcc/testsuite/gnat.dg/deferred_const2_pkg.ads b/gcc/testsuite/gnat.dg/deferred_const2_pkg.ads
new file mode 100644
index 00000000000..c76e5fdb802
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/deferred_const2_pkg.ads
@@ -0,0 +1,12 @@
+package Deferred_Const2_Pkg is
+
+ I : Integer := 16#20_3A_2D_28#;
+
+ pragma Warnings (Off);
+ S : constant string(1..4);
+ for S'address use I'address;
+ pragma Import (Ada, S);
+
+ procedure Dummy;
+
+end Deferred_Const2_Pkg;
diff --git a/gcc/testsuite/gnat.dg/deferred_const3.adb b/gcc/testsuite/gnat.dg/deferred_const3.adb
new file mode 100644
index 00000000000..84554d3063f
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/deferred_const3.adb
@@ -0,0 +1,19 @@
+-- { dg-do run }
+
+with System; use System;
+with Deferred_Const3_Pkg; use Deferred_Const3_Pkg;
+
+procedure Deferred_Const3 is
+begin
+ if C1'Address /= C'Address then
+ raise Program_Error;
+ end if;
+
+ if C2'Address /= C'Address then
+ raise Program_Error;
+ end if;
+
+ if C3'Address /= C'Address then
+ raise Program_Error;
+ end if;
+end;
diff --git a/gcc/testsuite/gnat.dg/deferred_const3_pkg.adb b/gcc/testsuite/gnat.dg/deferred_const3_pkg.adb
new file mode 100644
index 00000000000..e865494454b
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/deferred_const3_pkg.adb
@@ -0,0 +1,19 @@
+with System; use System;
+
+package body Deferred_Const3_Pkg is
+
+ procedure Dummy is begin null; end;
+
+begin
+ if C1'Address /= C'Address then
+ raise Program_Error;
+ end if;
+
+ if C2'Address /= C'Address then
+ raise Program_Error;
+ end if;
+
+ if C3'Address /= C'Address then
+ raise Program_Error;
+ end if;
+end Deferred_Const3_Pkg;
diff --git a/gcc/testsuite/gnat.dg/deferred_const3_pkg.ads b/gcc/testsuite/gnat.dg/deferred_const3_pkg.ads
new file mode 100644
index 00000000000..de6af3d52ac
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/deferred_const3_pkg.ads
@@ -0,0 +1,21 @@
+package Deferred_Const3_Pkg is
+
+ C : constant Natural := 1;
+
+ C1 : constant Natural := 1;
+ for C1'Address use C'Address;
+
+ C2 : constant Natural;
+ for C2'Address use C'Address;
+
+ C3 : constant Natural;
+
+ procedure Dummy;
+
+private
+ C2 : constant Natural := 1;
+
+ C3 : constant Natural := 1;
+ for C3'Address use C'Address;
+
+end Deferred_Const3_Pkg;
diff --git a/gcc/testsuite/gnat.dg/discr10.adb b/gcc/testsuite/gnat.dg/discr10.adb
new file mode 100644
index 00000000000..4ad834fd124
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/discr10.adb
@@ -0,0 +1,8 @@
+package body Discr10 is
+
+ function Get (X : R) return R is
+ begin
+ return R'(D1 => False, D2 => False, D3 => X.D3);
+ end;
+
+end Discr10;
diff --git a/gcc/testsuite/gnat.dg/discr10.ads b/gcc/testsuite/gnat.dg/discr10.ads
new file mode 100644
index 00000000000..8df7ef146c4
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/discr10.ads
@@ -0,0 +1,23 @@
+package Discr10 is
+
+ subtype Index is Natural range 0 .. 150;
+
+ type List is array (Index range <>) of Integer;
+
+ type R (D1 : Boolean := True; D2 : Boolean := False; D3 : Index := 0) is
+ record
+ case D2 is
+ when True =>
+ L : List (1 .. D3);
+ case D1 is
+ when True => I : Integer;
+ when False => null;
+ end case;
+ when False =>
+ null;
+ end case;
+ end record;
+
+ function Get (X : R) return R;
+
+end Discr10;
diff --git a/gcc/testsuite/gnat.dg/exp0_eval.adb b/gcc/testsuite/gnat.dg/exp0_eval.adb
new file mode 100644
index 00000000000..11edd7d097c
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/exp0_eval.adb
@@ -0,0 +1,31 @@
+-- { dg-do run }
+with Interfaces; use Interfaces;
+procedure Exp0_Eval is
+
+ F_Count : Natural := 0;
+
+ function F return Integer is
+ begin
+ F_Count := F_Count + 1;
+ return 1;
+ end F;
+
+ function F return Unsigned_32 is
+ begin
+ F_Count := F_Count + 1;
+ return 1;
+ end F;
+
+ R : constant Integer :=
+ F ** 0 +
+ F * 0 +
+ 0 * F +
+ Integer (Unsigned_32'(F) mod 1) +
+ Integer (Unsigned_32'(F) rem 1);
+ pragma Warnings (Off, R);
+begin
+ if F_Count /= 5 then
+ raise Program_Error
+ with "incorrect numbers of calls to F:" & F_Count'Img;
+ end if;
+end Exp0_Eval;
diff --git a/gcc/testsuite/gnat.dg/iface_test.adb b/gcc/testsuite/gnat.dg/iface_test.adb
new file mode 100644
index 00000000000..b47814f85d5
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/iface_test.adb
@@ -0,0 +1,28 @@
+-- { dg-do compile }
+package body Iface_Test is
+ protected SQLite_Safe is
+ function Prepare_Select
+ (DB : DT_1;
+ Iter : Standard.Iface_Test.Iface_2'Class)
+ return Standard.Iface_Test.Iface_2'Class;
+ end;
+
+ overriding procedure Prepare_Select
+ (DB : DT_1;
+ Iter : in out Standard.Iface_Test.Iface_2'Class)
+ is
+ begin
+ Iter := SQLite_Safe.Prepare_Select (DB, Iter); -- test
+ end;
+
+ protected body SQLite_Safe is
+ function Prepare_Select
+ (DB : DT_1;
+ Iter : Standard.Iface_Test.Iface_2'Class)
+ return Standard.Iface_Test.Iface_2'Class
+ is
+ begin
+ return Iter;
+ end;
+ end;
+end;
diff --git a/gcc/testsuite/gnat.dg/iface_test.ads b/gcc/testsuite/gnat.dg/iface_test.ads
new file mode 100644
index 00000000000..d093c28226f
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/iface_test.ads
@@ -0,0 +1,18 @@
+package Iface_Test is
+ type Iface_1 is interface;
+ type Iface_2 is interface;
+
+ procedure Prepare_Select
+ (DB : Iface_1;
+ Iter : in out Iface_2'Class) is abstract;
+
+ type DT_1 is new Iface_1 with null record;
+
+ type Iterator is new Iface_2 with record
+ More : Boolean;
+ end record;
+
+ overriding procedure Prepare_Select
+ (DB : DT_1;
+ Iter : in out Standard.Iface_Test.Iface_2'Class);
+end;
diff --git a/gcc/testsuite/gnat.dg/missing_acc_check.adb b/gcc/testsuite/gnat.dg/missing_acc_check.adb
new file mode 100644
index 00000000000..1c2d9cf502e
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/missing_acc_check.adb
@@ -0,0 +1,39 @@
+-- { dg-do run }
+
+procedure Missing_Acc_Check is
+
+ Test_Failed : Exception;
+
+ type Int_Access is access all Integer;
+
+ Save : Int_Access := null;
+
+ type Int_Rec is record
+ Int : aliased Integer;
+ end record;
+
+ type Ltd_Rec (IR_Acc : access Int_Rec) is limited null record;
+
+ function Pass_Rec (IR_Acc : access Int_Rec) return Int_Access is
+ begin
+ return IR_Acc.Int'Access; -- Accessibility check here
+ end Pass_Rec;
+
+ procedure Proc is
+ IR : aliased Int_Rec;
+ LR : Ltd_Rec (IR'Access);
+ begin
+ Save := Pass_Rec (LR.IR_Acc); -- Must raise Program_Error;
+
+ if Save /= null then
+ raise Test_Failed;
+ end if;
+
+ exception
+ when Program_Error =>
+ null;
+ end Proc;
+
+begin
+ Proc;
+end Missing_Acc_Check;
diff --git a/gcc/testsuite/gnat.dg/not_null.adb b/gcc/testsuite/gnat.dg/not_null.adb
new file mode 100644
index 00000000000..7d3c63dc9cd
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/not_null.adb
@@ -0,0 +1,24 @@
+-- { dg-do run }
+
+procedure not_null is
+ type Not_Null_Int_Ptr is not null access all Integer;
+
+ generic
+ F : Not_Null_Int_Ptr := null;
+ package GPack is
+ end GPack;
+
+begin
+ declare
+ pragma Warnings (Off, "*null not allowed in null-excluding objects");
+ pragma Warnings (Off, """Constraint_Error"" will be raised at run time");
+ package Inst_2 is new GPack (null);
+ pragma Warnings (On, "*null not allowed in null-excluding objects");
+ pragma Warnings (On, """Constraint_Error"" will be raised at run time");
+ begin
+ null;
+ end;
+exception
+ when Constraint_Error =>
+ null;
+end not_null;
diff --git a/gcc/testsuite/gnat.dg/protected_self_ref1.adb b/gcc/testsuite/gnat.dg/protected_self_ref1.adb
new file mode 100644
index 00000000000..b6c2aef6809
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/protected_self_ref1.adb
@@ -0,0 +1,25 @@
+-- { dg-do run }
+with System;
+
+procedure Protected_Self_Ref1 is
+
+ protected type P is
+ procedure Foo;
+ end P;
+
+ protected body P is
+ procedure Foo is
+ Ptr : access P; -- here P denotes the type P
+ T : Integer;
+ A : System.Address;
+ begin
+ Ptr := P'Access; -- here P denotes the "this" instance of P
+ T := P'Size;
+ A := P'Address;
+ end;
+ end P;
+
+ O : P;
+begin
+ O.Foo;
+end Protected_Self_Ref1;
diff --git a/gcc/testsuite/gnat.dg/protected_self_ref2.adb b/gcc/testsuite/gnat.dg/protected_self_ref2.adb
new file mode 100644
index 00000000000..825c0cc40e7
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/protected_self_ref2.adb
@@ -0,0 +1,18 @@
+-- { dg-do compile }
+procedure Protected_Self_Ref2 is
+
+ protected type P is
+ procedure Foo;
+ end P;
+
+ protected body P is
+ procedure Foo is
+ D : Integer;
+ begin
+ D := P'Digits; -- { dg-error "denotes current instance" }
+ end;
+ end P;
+
+begin
+ null;
+end Protected_Self_Ref2;
diff --git a/gcc/testsuite/gnat.dg/raise_from_pure.adb b/gcc/testsuite/gnat.dg/raise_from_pure.adb
new file mode 100644
index 00000000000..62e543e94db
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/raise_from_pure.adb
@@ -0,0 +1,11 @@
+package body raise_from_pure is
+ function Raise_CE_If_0 (P : Integer) return Integer is
+ begin
+ if P = 0 then
+ raise Constraint_error;
+ end if;
+ return 1;
+ end;
+end;
+
+
diff --git a/gcc/testsuite/gnat.dg/raise_from_pure.ads b/gcc/testsuite/gnat.dg/raise_from_pure.ads
new file mode 100644
index 00000000000..9c363a5be48
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/raise_from_pure.ads
@@ -0,0 +1,5 @@
+
+package raise_from_pure is
+ pragma Pure;
+ function Raise_CE_If_0 (P : Integer) return Integer;
+end;
diff --git a/gcc/testsuite/gnat.dg/specs/genericppc.ads b/gcc/testsuite/gnat.dg/specs/genericppc.ads
new file mode 100644
index 00000000000..494a8890b05
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/specs/genericppc.ads
@@ -0,0 +1,7 @@
+-- { dg-do compile }
+-- { dg-options "-gnatc" }
+
+generic
+ type T_Item is private;
+function genericppc (T : in t_Item; I : integer) return integer;
+pragma Precondition (I > 0);
diff --git a/gcc/testsuite/gnat.dg/specs/null_aggr_bug.ads b/gcc/testsuite/gnat.dg/specs/null_aggr_bug.ads
new file mode 100644
index 00000000000..95467f428eb
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/specs/null_aggr_bug.ads
@@ -0,0 +1,20 @@
+-- { dg-do compile }
+package Null_Aggr_Bug is
+
+ type Rec1 is null record;
+
+ type Rec2 is tagged null record;
+
+ type Rec3 is new Rec2 with null record;
+
+ X1 : Rec1 := (null record);
+ Y1 : Rec1 := (others => <>);
+
+ X2 : Rec2 := (null record);
+ Y2 : Rec2 := (others => <>);
+
+ X3 : Rec3 := (null record);
+ Y3 : Rec3 := (others => <>);
+ Z3 : Rec3 := (Rec2 with others => <>);
+
+end Null_Aggr_Bug;
diff --git a/gcc/testsuite/gnat.dg/specs/sync_iface_test.ads b/gcc/testsuite/gnat.dg/specs/sync_iface_test.ads
new file mode 100644
index 00000000000..4bccd255d7a
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/specs/sync_iface_test.ads
@@ -0,0 +1,14 @@
+-- { dg-do compile }
+-- { dg-options "-gnatc" }
+
+package Sync_Iface_Test is
+ type Iface is limited interface;
+ procedure Do_Test
+ (Container : in out Iface;
+ Process : access procedure (E : Natural)) is abstract;
+
+ protected type Buffer is new Iface with
+ overriding procedure Do_Test
+ (Process : access procedure (E : Natural));
+ end;
+end;
diff --git a/gcc/testsuite/gnat.dg/sync_iface_test.adb b/gcc/testsuite/gnat.dg/sync_iface_test.adb
new file mode 100644
index 00000000000..f431adfe243
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/sync_iface_test.adb
@@ -0,0 +1,19 @@
+-- { dg-do compile }
+package body Sync_Iface_Test is
+ protected body Buffer is
+ procedure Dummy is begin null; end;
+ end;
+
+ function First (Obj : Buffer) return Natural is
+ begin
+ return 0;
+ end;
+
+ procedure Do_Test (Dummy : Natural; Item : Buffer)
+ is
+ Position1 : Natural := First (Item);
+ Position2 : Natural := Item.First; -- Problem here
+ begin
+ null;
+ end;
+end;
diff --git a/gcc/testsuite/gnat.dg/sync_iface_test.ads b/gcc/testsuite/gnat.dg/sync_iface_test.ads
new file mode 100644
index 00000000000..c172d7fa2b1
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/sync_iface_test.ads
@@ -0,0 +1,11 @@
+package Sync_Iface_Test is
+ type Iface is limited interface;
+ function First (Obj : Iface) return Natural is abstract;
+
+ protected type Buffer is new Iface with
+ procedure Dummy;
+ end;
+ overriding function First (Obj : Buffer) return Natural;
+
+ procedure Do_Test (Dummy : Natural; Item : Buffer);
+end;
diff --git a/gcc/testsuite/gnat.dg/test_ai254.adb b/gcc/testsuite/gnat.dg/test_ai254.adb
new file mode 100644
index 00000000000..18f65837259
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/test_ai254.adb
@@ -0,0 +1,12 @@
+-- { dg-do compile }
+
+procedure test_ai254 is
+ function Func
+ (Obj : not null access protected function (X : Float) return Float)
+ return not null access protected function (X : Float) return Float is
+ begin
+ return null;
+ end;
+begin
+ null;
+end;
diff --git a/gcc/testsuite/gnat.dg/test_allocator_maxalign2.adb b/gcc/testsuite/gnat.dg/test_allocator_maxalign2.adb
new file mode 100644
index 00000000000..144914d2dc4
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/test_allocator_maxalign2.adb
@@ -0,0 +1,8 @@
+-- { dg-do run }
+
+with Allocator_Maxalign2;
+
+procedure Test_Allocator_Maxalign2 is
+begin
+ Allocator_Maxalign2.Check;
+end;
diff --git a/gcc/testsuite/gnat.dg/test_call.adb b/gcc/testsuite/gnat.dg/test_call.adb
new file mode 100644
index 00000000000..f1ea10f73b4
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/test_call.adb
@@ -0,0 +1,24 @@
+-- { dg-do compile }
+
+with System; with Ada.Unchecked_Conversion;
+procedure Test_Call is
+ type F_ACC is access function (Str : String) return String;
+
+ function Do_Something (V : F_Acc) return System.Address is
+ begin
+ return System.Null_Address;
+ end Do_Something;
+
+ function BUG_1 (This : access Integer) return F_Acc is
+ begin
+ return null;
+ end BUG_1;
+
+ function Unch is new Ada.Unchecked_Conversion (F_Acc, System.Address);
+ Func : System.Address := Unch (BUG_1 (null));
+
+ V : System.Address := Do_Something (BUG_1 (null));
+
+begin
+ null;
+end Test_Call;
diff --git a/gcc/testsuite/gnat.dg/test_raise_from_pure.adb b/gcc/testsuite/gnat.dg/test_raise_from_pure.adb
new file mode 100644
index 00000000000..ab1ed16db5c
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/test_raise_from_pure.adb
@@ -0,0 +1,9 @@
+-- { dg-do run }
+-- { dg-options "-O2" }
+with Wrap_Raise_From_Pure; use Wrap_Raise_From_Pure;
+procedure test_raise_from_pure is
+begin
+ Wrap_Raise_From_Pure.Check;
+exception
+ when Constraint_Error => null;
+end;
diff --git a/gcc/testsuite/gnat.dg/tree_static_def.adb b/gcc/testsuite/gnat.dg/tree_static_def.adb
new file mode 100644
index 00000000000..ed86747a8b1
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/tree_static_def.adb
@@ -0,0 +1,11 @@
+
+package body TREE_STATIC_Def is
+
+ procedure check (i : int; v : integer) is
+ begin
+ if i.value /= v then
+ raise program_error;
+ end if;
+ end;
+end;
+
diff --git a/gcc/testsuite/gnat.dg/tree_static_def.ads b/gcc/testsuite/gnat.dg/tree_static_def.ads
new file mode 100644
index 00000000000..1ea58ee03e4
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/tree_static_def.ads
@@ -0,0 +1,10 @@
+package TREE_STATIC_Def is
+
+ type Int is record
+ Value : Integer;
+ end record;
+
+ procedure check (I : Int; v : integer);
+
+ One : constant Int := (Value => 1);
+end;
diff --git a/gcc/testsuite/gnat.dg/tree_static_use.adb b/gcc/testsuite/gnat.dg/tree_static_use.adb
new file mode 100644
index 00000000000..ff02b54565c
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/tree_static_use.adb
@@ -0,0 +1,12 @@
+-- { dg-do run }
+-- { dg-options "-O1" }
+
+with TREE_STATIC_Def; use TREE_STATIC_Def;
+
+procedure TREE_STATIC_Use is
+ I : Int := One;
+begin
+ check (I, 1);
+end;
+
+
diff --git a/gcc/testsuite/gnat.dg/wrap_raise_from_pure.adb b/gcc/testsuite/gnat.dg/wrap_raise_from_pure.adb
new file mode 100644
index 00000000000..ec8f342c6b5
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/wrap_raise_from_pure.adb
@@ -0,0 +1,10 @@
+with Ada.Text_Io; use Ada.Text_Io;
+with Raise_From_Pure; use Raise_From_Pure;
+package body Wrap_Raise_From_Pure is
+ procedure Check is
+ K : Integer;
+ begin
+ K := Raise_CE_If_0 (0);
+ Put_Line ("Should never reach here");
+ end;
+end;
diff --git a/gcc/testsuite/gnat.dg/wrap_raise_from_pure.ads b/gcc/testsuite/gnat.dg/wrap_raise_from_pure.ads
new file mode 100644
index 00000000000..521c04a5fc9
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/wrap_raise_from_pure.ads
@@ -0,0 +1,4 @@
+
+package Wrap_Raise_From_Pure is
+ procedure Check;
+end;
diff --git a/gcc/testsuite/lib/compat.exp b/gcc/testsuite/lib/compat.exp
index ee7cff56fbe..e8ca8fc7987 100644
--- a/gcc/testsuite/lib/compat.exp
+++ b/gcc/testsuite/lib/compat.exp
@@ -280,7 +280,7 @@ proc compat-execute { src1 sid use_alt } {
# On the SPU, most of the compat test cases exceed local store size.
# Use automatic overlay support to make them fit.
- if { [istarget spu-*-elf*] } {
+ if { [check_effective_target_spu_auto_overlay] } {
set extra_flags_1 "$extra_flags_1 -Wl,--auto-overlay"
set extra_flags_1 "$extra_flags_1 -ffunction-sections"
set extra_flags_2 "$extra_flags_2 -ffunction-sections"
diff --git a/gcc/testsuite/lib/target-supports-dg.exp b/gcc/testsuite/lib/target-supports-dg.exp
index 4bff5fa4424..0f8c7255b55 100644
--- a/gcc/testsuite/lib/target-supports-dg.exp
+++ b/gcc/testsuite/lib/target-supports-dg.exp
@@ -117,6 +117,9 @@ proc dg-require-named-sections { args } {
proc dg-require-effective-target { args } {
set args [lreplace $args 0 0]
+ if { [llength $args] != 1 } {
+ error "syntax error, need a single effective-target keyword"
+ }
if { ![is-effective-target [lindex $args 0]] } {
upvar dg-do-what dg-do-what
set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 9c12dddaeed..2c9165c3c04 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -439,6 +439,14 @@ proc check_profiling_available { test_what } {
return 0
}
+ # We don't yet support profiling for MIPS16.
+ if { [istarget mips*-*-*]
+ && ![check_effective_target_nomips16]
+ && ([lindex $test_what 1] == "-p"
+ || [lindex $test_what 1] == "-pg") } {
+ return 0
+ }
+
# MinGW does not support -p.
if { [istarget *-*-mingw*] && [lindex $test_what 1] == "-p" } {
return 0
@@ -476,7 +484,7 @@ proc check_profiling_available { test_what } {
|| [istarget m68k-*-uclinux*]
|| [istarget mips*-*-elf*]
|| [istarget xstormy16-*]
- || [istarget xtensa-*-elf]
+ || [istarget xtensa*-*-elf]
|| [istarget *-*-vxworks*] } {
set profiling_available_saved 0
} else {
@@ -1203,6 +1211,8 @@ proc check_effective_target_vect_floatint_cvt { } {
} else {
set et_vect_floatint_cvt_saved 0
if { [istarget i?86-*-*]
+ || ([istarget powerpc*-*-*]
+ && ![istarget powerpc-*-linux*paired*])
|| [istarget x86_64-*-*] } {
set et_vect_floatint_cvt_saved 1
}
@@ -1249,6 +1259,17 @@ proc check_effective_target_arm_neon_ok { } {
}
}
+# Return 1 is this is an ARM target where -mthumb causes Thumb-1 to be
+# used.
+
+proc check_effective_target_arm_thumb1_ok { } {
+ return [check_no_compiler_messages arm_thumb1_ok assembly {
+ #if !defined(__arm__) || !defined(__thumb__) || defined(__thumb2__)
+ #error FOO
+ #endif
+ } "-mthumb"]
+}
+
# Return 1 if the target supports executing NEON instructions, 0
# otherwise. Cache the result.
@@ -1390,6 +1411,19 @@ proc check_effective_target_powerpc_altivec { } {
}
}
+# Return 1 if this is a SPU target with a toolchain that
+# supports automatic overlay generation.
+
+proc check_effective_target_spu_auto_overlay { } {
+ if { [istarget spu*-*-elf*] } {
+ return [check_no_compiler_messages spu_auto_overlay executable {
+ int main (void) { }
+ } "-Wl,--auto-overlay" ]
+ } else {
+ return 0
+ }
+}
+
# The VxWorks SPARC simulator accepts only EM_SPARC executables and
# chokes on EM_SPARC32PLUS or EM_SPARCV9 executables. Return 1 if the
# test environment appears to run executables on such a simulator.
@@ -1817,10 +1851,6 @@ proc check_effective_target_unaligned_stack { } {
verbose "check_effective_target_unaligned_stack: using cached result" 2
} else {
set et_unaligned_stack_saved 0
- if { ( [istarget i?86-*-*] || [istarget x86_64-*-*] )
- && (! [istarget *-*-darwin*] ) } {
- set et_unaligned_stack_saved 1
- }
}
verbose "check_effective_target_unaligned_stack: returning $et_unaligned_stack_saved" 2
return $et_unaligned_stack_saved
@@ -2058,6 +2088,27 @@ proc check_effective_target_vect_extract_even_odd { } {
return $et_vect_extract_even_odd_saved
}
+# Return 1 if the target supports vector even/odd elements extraction of
+# vectors with SImode elements or larger, 0 otherwise.
+
+proc check_effective_target_vect_extract_even_odd_wide { } {
+ global et_vect_extract_even_odd_wide_saved
+
+ if [info exists et_vect_extract_even_odd_wide_saved] {
+ verbose "check_effective_target_vect_extract_even_odd_wide: using cached result" 2
+ } else {
+ set et_vect_extract_even_odd_wide_saved 0
+ if { [istarget powerpc*-*-*]
+ || [istarget i?86-*-*]
+ || [istarget x86_64-*-*] } {
+ set et_vect_extract_even_odd_wide_saved 1
+ }
+ }
+
+ verbose "check_effective_target_vect_extract_even_wide_odd: returning $et_vect_extract_even_odd_wide_saved" 2
+ return $et_vect_extract_even_odd_wide_saved
+}
+
# Return 1 if the target supports vector interleaving, 0 otherwise.
proc check_effective_target_vect_interleave { } {
@@ -2096,6 +2147,25 @@ proc check_effective_target_vect_strided { } {
return $et_vect_strided_saved
}
+# Return 1 if the target supports vector interleaving and extract even/odd
+# for wide element types, 0 otherwise.
+proc check_effective_target_vect_strided_wide { } {
+ global et_vect_strided_wide_saved
+
+ if [info exists et_vect_strided_wide_saved] {
+ verbose "check_effective_target_vect_strided_wide: using cached result" 2
+ } else {
+ set et_vect_strided_wide_saved 0
+ if { [check_effective_target_vect_interleave]
+ && [check_effective_target_vect_extract_even_odd_wide] } {
+ set et_vect_strided_wide_saved 1
+ }
+ }
+
+ verbose "check_effective_target_vect_strided_wide: returning $et_vect_strided_wide_saved" 2
+ return $et_vect_strided_wide_saved
+}
+
# Return 1 if the target supports section-anchors
proc check_effective_target_section_anchors { } {
@@ -2442,3 +2512,14 @@ proc check_effective_target_4byte_wchar_t { } {
int dummy[sizeof (__WCHAR_TYPE__) >= 4 ? 1 : -1];
}]
}
+
+# Return 1 if the target supports automatic stack alignment.
+
+proc check_effective_target_automatic_stack_alignment { } {
+ if { [istarget i?86*-*-*]
+ || [istarget x86_64-*-*] } then {
+ return 1
+ } else {
+ return 0
+ }
+}
diff --git a/gcc/testsuite/objc.dg/gnu-encoding/gnu-encoding.exp b/gcc/testsuite/objc.dg/gnu-encoding/gnu-encoding.exp
index dc4d9245a32..75d1dcf6316 100644
--- a/gcc/testsuite/objc.dg/gnu-encoding/gnu-encoding.exp
+++ b/gcc/testsuite/objc.dg/gnu-encoding/gnu-encoding.exp
@@ -37,8 +37,20 @@ set generator_src "$srcdir/$subdir/struct-layout-encoding-1_generate.c"
set generator_src "$generator_src $srcdir/$subdir/generate-random.c"
set generator_src "$generator_src $srcdir/$subdir/generate-random_r.c"
set generator_cmd "-o $generator $generator_src"
+# Temporarily unset GCC_EXEC_PREFIX from environment, as that might
+# confuse the $HOSTCC.
+set orig_gcc_exec_prefix_saved 0
+if [info exists env(GCC_EXEC_PREFIX)] {
+ set orig_gcc_exec_prefix "$env(GCC_EXEC_PREFIX)"
+ set orig_gcc_exec_prefix_saved 1
+ unsetenv GCC_EXEC_PREFIX
+}
set status [remote_exec build "$HOSTCC $HOSTCFLAGS $generator_cmd"]
set status [lindex $status 0]
+if { $orig_gcc_exec_prefix_saved } {
+ set orig_gcc_exec_prefix_saved 0
+ setenv GCC_EXEC_PREFIX "$orig_gcc_exec_prefix"
+}
if { $status == 0 } then {
file delete -force $tstobjdir
file mkdir $tstobjdir
diff --git a/gcc/toplev.c b/gcc/toplev.c
index a35c105160e..bb49a970b49 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -82,6 +82,7 @@ along with GCC; see the file COPYING3. If not see
#include "alloc-pool.h"
#include "tree-mudflap.h"
#include "tree-pass.h"
+#include "gimple.h"
#if defined (DWARF2_UNWIND_INFO) || defined (DWARF2_DEBUGGING_INFO)
#include "dwarf2out.h"
@@ -202,11 +203,6 @@ tree current_function_decl;
if none. */
const char * current_function_func_begin_label;
-/* Temporarily suppress certain warnings.
- This is set while reading code from a system header file. */
-
-int in_system_header = 0;
-
/* Nonzero means to collect statistics which might be expensive
and to print them when we are done. */
int flag_detailed_statistics = 0;
@@ -249,11 +245,6 @@ int flag_pcc_struct_return = DEFAULT_PCC_STRUCT_RETURN;
int flag_complex_method = 1;
-/* Nonzero means that we don't want inlining by virtue of -fno-inline,
- not just because the tree inliner turned us off. */
-
-int flag_really_no_inline = 2;
-
/* Nonzero means we should be saving declaration info into a .X file. */
int flag_gen_aux_info = 0;
@@ -830,7 +821,7 @@ check_global_declaration_1 (tree decl)
|| TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))))
{
if (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
- pedwarn ("%q+F used but never defined", decl);
+ pedwarn (0, "%q+F used but never defined", decl);
else
warning (OPT_Wunused_function, "%q+F declared %<static%> but never defined", decl);
/* This symbol is effectively an "extern" declaration now. */
@@ -1653,6 +1644,19 @@ process_options (void)
This can happen with incorrect pre-processed input. */
debug_hooks = &do_nothing_debug_hooks;
+ /* This replaces set_Wunused. */
+ if (warn_unused_function == -1)
+ warn_unused_function = warn_unused;
+ if (warn_unused_label == -1)
+ warn_unused_label = warn_unused;
+ /* Wunused-parameter is enabled if both -Wunused -Wextra are enabled. */
+ if (warn_unused_parameter == -1)
+ warn_unused_parameter = (warn_unused && extra_warnings);
+ if (warn_unused_variable == -1)
+ warn_unused_variable = warn_unused;
+ if (warn_unused_value == -1)
+ warn_unused_value = warn_unused;
+
/* Allow the front end to perform consistency checks and do further
initialization based on the command line options. This hook also
sets the original filename if appropriate (e.g. foo.i -> foo.c)
@@ -1707,9 +1711,6 @@ process_options (void)
if (flag_asynchronous_unwind_tables)
flag_unwind_tables = 1;
- if (!flag_unit_at_a_time)
- flag_section_anchors = 0;
-
if (flag_value_profile_transformations)
flag_profile_values = 1;
@@ -2092,6 +2093,7 @@ dump_memory_report (bool final)
ggc_print_statistics ();
stringpool_statistics ();
dump_tree_statistics ();
+ dump_gimple_statistics ();
dump_rtx_statistics ();
dump_varray_statistics ();
dump_alloc_pool_statistics ();
diff --git a/gcc/toplev.h b/gcc/toplev.h
index 2668fac72a8..ddf46cd7f9d 100644
--- a/gcc/toplev.h
+++ b/gcc/toplev.h
@@ -20,6 +20,7 @@ along with GCC; see the file COPYING3. If not see
#ifndef GCC_TOPLEV_H
#define GCC_TOPLEV_H
+#include "input.h"
/* If non-NULL, return one past-the-end of the matching SUBPART of
the WHOLE string. */
@@ -55,14 +56,20 @@ extern void _fatal_insn (const char *, const_rtx, const char *, int, const char
#endif
extern void internal_error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2)
ATTRIBUTE_NORETURN;
-extern void warning0 (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
/* Pass one of the OPT_W* from options.h as the first parameter. */
-extern void warning (int, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
+extern bool warning (int, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
+extern bool warning_at (location_t, int, const char *, ...)
+ ATTRIBUTE_GCC_DIAG(3,4);
extern void error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
extern void fatal_error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2)
ATTRIBUTE_NORETURN;
-extern void pedwarn (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
-extern void permerror (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
+/* Pass one of the OPT_W* from options.h as the first parameter. */
+extern bool pedwarn (int, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
+extern bool pedwarn_at (location_t, int, const char *, ...)
+ ATTRIBUTE_GCC_DIAG(3,4);
+extern bool permerror (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
+extern bool permerror_at (location_t, const char *, ...)
+ ATTRIBUTE_GCC_DIAG(2,3);
extern void sorry (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
extern void inform (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
extern void verbatim (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
@@ -79,6 +86,7 @@ extern void announce_function (tree);
extern void error_for_asm (const_rtx, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
extern void warning_for_asm (const_rtx, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
extern void warn_deprecated_use (tree);
+extern bool parse_optimize_options (tree, bool);
#ifdef BUFSIZ
extern void output_quoted_string (FILE *, const char *);
@@ -155,6 +163,7 @@ extern void decode_d_option (const char *);
/* Return true iff flags are set as if -ffast-math. */
extern bool fast_math_flags_set_p (void);
+extern bool fast_math_flags_struct_set_p (struct cl_optimization *);
/* Return log2, or -1 if not exact. */
extern int exact_log2 (unsigned HOST_WIDE_INT);
diff --git a/gcc/tracer.c b/gcc/tracer.c
index 98f66cea949..fab2f49fa9f 100644
--- a/gcc/tracer.c
+++ b/gcc/tracer.c
@@ -102,13 +102,13 @@ ignore_bb_p (const_basic_block bb)
static int
count_insns (basic_block bb)
{
- block_stmt_iterator bsi;
- tree stmt;
+ gimple_stmt_iterator gsi;
+ gimple stmt;
int n = 0;
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- stmt = bsi_stmt (bsi);
+ stmt = gsi_stmt (gsi);
n += estimate_num_insns (stmt, &eni_size_weights);
}
return n;
diff --git a/gcc/tree-affine.c b/gcc/tree-affine.c
index 59ac3d786b4..0d329d06efd 100644
--- a/gcc/tree-affine.c
+++ b/gcc/tree-affine.c
@@ -30,7 +30,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-dump.h"
#include "pointer-set.h"
#include "tree-affine.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "flags.h"
/* Extends CST as appropriate for the affine combinations COMB. */
@@ -567,11 +567,13 @@ struct name_expansion
results. */
void
-aff_combination_expand (aff_tree *comb, struct pointer_map_t **cache)
+aff_combination_expand (aff_tree *comb ATTRIBUTE_UNUSED,
+ struct pointer_map_t **cache ATTRIBUTE_UNUSED)
{
unsigned i;
aff_tree to_add, current, curre;
- tree e, def, rhs;
+ tree e, rhs;
+ gimple def;
double_int scale;
void **slot;
struct name_expansion *exp;
@@ -580,6 +582,8 @@ aff_combination_expand (aff_tree *comb, struct pointer_map_t **cache)
for (i = 0; i < comb->n; i++)
{
tree type, name;
+ enum tree_code code;
+
e = comb->elts[i].val;
type = TREE_TYPE (e);
name = e;
@@ -591,19 +595,19 @@ aff_combination_expand (aff_tree *comb, struct pointer_map_t **cache)
if (TREE_CODE (name) != SSA_NAME)
continue;
def = SSA_NAME_DEF_STMT (name);
- if (TREE_CODE (def) != GIMPLE_MODIFY_STMT
- || GIMPLE_STMT_OPERAND (def, 0) != name)
+ if (!is_gimple_assign (def) || gimple_assign_lhs (def) != name)
continue;
- rhs = GIMPLE_STMT_OPERAND (def, 1);
- if (TREE_CODE (rhs) != SSA_NAME
- && !EXPR_P (rhs)
- && !is_gimple_min_invariant (rhs))
+ code = gimple_assign_rhs_code (def);
+ if (code != SSA_NAME
+ && !IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (code))
+ && (get_gimple_rhs_class (code) != GIMPLE_SINGLE_RHS
+ || !is_gimple_min_invariant (gimple_assign_rhs1 (def))))
continue;
/* We do not know whether the reference retains its value at the
place where the expansion is used. */
- if (REFERENCE_CLASS_P (rhs))
+ if (TREE_CODE_CLASS (code) == tcc_reference)
continue;
if (!*cache)
@@ -616,29 +620,27 @@ aff_combination_expand (aff_tree *comb, struct pointer_map_t **cache)
exp = XNEW (struct name_expansion);
exp->in_progress = 1;
*slot = exp;
- if (e != name)
+ /* In principle this is a generally valid folding, but
+ it is not unconditionally an optimization, so do it
+ here and not in fold_unary. */
+ /* Convert (T1)(X *+- CST) into (T1)X *+- (T1)CST if T1 is wider
+ than the type of X and overflow for the type of X is
+ undefined. */
+ if (e != name
+ && INTEGRAL_TYPE_P (type)
+ && INTEGRAL_TYPE_P (TREE_TYPE (name))
+ && TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (name))
+ && TYPE_PRECISION (type) > TYPE_PRECISION (TREE_TYPE (name))
+ && (code == PLUS_EXPR || code == MINUS_EXPR || code == MULT_EXPR)
+ && TREE_CODE (gimple_assign_rhs2 (def)) == INTEGER_CST)
+ rhs = fold_build2 (code, type,
+ fold_convert (type, gimple_assign_rhs1 (def)),
+ fold_convert (type, gimple_assign_rhs2 (def)));
+ else
{
- /* In principle this is a generally valid folding, but
- it is not unconditionally an optimization, so do it
- here and not in fold_unary. */
- /* Convert (T1)(X *+- CST) into (T1)X *+- (T1)CST if T1 is wider
- than the type of X and overflow for the type of X is
- undefined. */
- if (INTEGRAL_TYPE_P (type)
- && INTEGRAL_TYPE_P (TREE_TYPE (rhs))
- && TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (rhs))
- && TYPE_PRECISION (type) > TYPE_PRECISION (TREE_TYPE (rhs))
- && (TREE_CODE (rhs) == PLUS_EXPR
- || TREE_CODE (rhs) == MINUS_EXPR
- || TREE_CODE (rhs) == MULT_EXPR)
- && TREE_CODE (TREE_OPERAND (rhs, 1)) == INTEGER_CST)
- {
- rhs = fold_build2 (TREE_CODE (rhs), type,
- fold_convert (type, TREE_OPERAND (rhs, 0)),
- fold_convert (type, TREE_OPERAND (rhs, 1)));
- }
- else
- rhs = fold_convert (type, rhs);
+ rhs = gimple_assign_rhs_to_tree (def);
+ if (e != name)
+ rhs = fold_convert (type, rhs);
}
tree_to_aff_combination_expand (rhs, comb->type, &current, cache);
exp->expansion = current;
diff --git a/gcc/tree-call-cdce.c b/gcc/tree-call-cdce.c
index 8f7041bbf09..ce9572ca142 100644
--- a/gcc/tree-call-cdce.c
+++ b/gcc/tree-call-cdce.c
@@ -35,7 +35,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree.h"
#include "diagnostic.h"
#include "tree-flow.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "tree-dump.h"
#include "tree-pass.h"
#include "timevar.h"
@@ -99,7 +99,7 @@ typedef struct input_domain
bool is_ub_inclusive;
} inp_domain;
-static VEC (tree, heap) *cond_dead_built_in_calls;
+static VEC (gimple, heap) *cond_dead_built_in_calls;
/* A helper function to construct and return an input
domain object. LB is the lower bound, HAS_LB is
@@ -174,16 +174,16 @@ check_target_format (tree arg)
#define MAX_BASE_INT_BIT_SIZE 32
static bool
-check_pow (tree pow_call)
+check_pow (gimple pow_call)
{
tree base, expn;
enum tree_code bc, ec;
- if (call_expr_nargs (pow_call) != 2)
+ if (gimple_call_num_args (pow_call) != 2)
return false;
- base = CALL_EXPR_ARG (pow_call, 0);
- expn = CALL_EXPR_ARG (pow_call, 1);
+ base = gimple_call_arg (pow_call, 0);
+ expn = gimple_call_arg (pow_call, 1);
if (!check_target_format (expn))
return false;
@@ -212,20 +212,19 @@ check_pow (tree pow_call)
}
else if (bc == SSA_NAME)
{
- tree base_def, base_val, base_val0, base_var, type;
+ tree base_val0, base_var, type;
+ gimple base_def;
int bit_sz;
/* Only handles cases where base value is converted
from integer values. */
base_def = SSA_NAME_DEF_STMT (base);
- if (TREE_CODE (base_def) != GIMPLE_MODIFY_STMT)
+ if (gimple_code (base_def) != GIMPLE_ASSIGN)
return false;
- base_val = GIMPLE_STMT_OPERAND (base_def, 1);
-
- if (TREE_CODE (base_val) != FLOAT_EXPR)
+ if (gimple_assign_rhs_code (base_def) != FLOAT_EXPR)
return false;
- base_val0 = TREE_OPERAND (base_val, 0);
+ base_val0 = gimple_assign_rhs1 (base_def);
base_var = SSA_NAME_VAR (base_val0);
if (!DECL_P (base_var))
@@ -253,11 +252,11 @@ check_pow (tree pow_call)
Returns true if the function call is a candidate. */
static bool
-check_builtin_call (tree bcall)
+check_builtin_call (gimple bcall)
{
tree arg;
- arg = CALL_EXPR_ARG (bcall, 0);
+ arg = gimple_call_arg (bcall, 0);
return check_target_format (arg);
}
@@ -266,18 +265,18 @@ check_builtin_call (tree bcall)
is a candidate. */
static bool
-is_call_dce_candidate (tree call)
+is_call_dce_candidate (gimple call)
{
tree fn;
enum built_in_function fnc;
- if (!flag_tree_builtin_call_dce)
+ /* Only potentially dead calls are considered. */
+ if (gimple_call_lhs (call))
return false;
- gcc_assert (call && TREE_CODE (call) == CALL_EXPR);
-
- fn = get_callee_fndecl (call);
- if (!fn || !DECL_BUILT_IN (fn)
+ fn = gimple_call_fndecl (call);
+ if (!fn
+ || !DECL_BUILT_IN (fn)
|| (DECL_BUILT_IN_CLASS (fn) != BUILT_IN_NORMAL))
return false;
@@ -331,38 +330,35 @@ static void
gen_one_condition (tree arg, int lbub,
enum tree_code tcode,
const char *temp_name1,
- const char *temp_name2,
- VEC (tree, heap) *conds,
+ const char *temp_name2,
+ VEC (gimple, heap) *conds,
unsigned *nconds)
{
tree lbub_real_cst, lbub_cst, float_type;
tree temp, tempn, tempc, tempcn;
- tree stmt1, stmt2, stmt3;
+ gimple stmt1, stmt2, stmt3;
float_type = TREE_TYPE (arg);
lbub_cst = build_int_cst (integer_type_node, lbub);
lbub_real_cst = build_real_from_int_cst (float_type, lbub_cst);
temp = create_tmp_var (float_type, temp_name1);
- stmt1 = build_gimple_modify_stmt (temp, arg);
+ stmt1 = gimple_build_assign (temp, arg);
tempn = make_ssa_name (temp, stmt1);
- GIMPLE_STMT_OPERAND (stmt1, 0) = tempn;
+ gimple_assign_set_lhs (stmt1, tempn);
tempc = create_tmp_var (boolean_type_node, temp_name2);
- stmt2 = build_gimple_modify_stmt (tempc,
- fold_build2 (tcode,
- boolean_type_node,
- tempn, lbub_real_cst));
+ stmt2 = gimple_build_assign (tempc,
+ fold_build2 (tcode,
+ boolean_type_node,
+ tempn, lbub_real_cst));
tempcn = make_ssa_name (tempc, stmt2);
- GIMPLE_STMT_OPERAND (stmt2, 0) = tempcn;
-
- /* fold_built3 not used for gimple statement here,
- as it will hit assertion. */
- stmt3 = build3 (COND_EXPR, void_type_node,
- tempcn, NULL_TREE, NULL_TREE);
- VEC_quick_push (tree, conds, stmt1);
- VEC_quick_push (tree, conds, stmt2);
- VEC_quick_push (tree, conds, stmt3);
+ gimple_assign_set_lhs (stmt2, tempcn);
+
+ stmt3 = gimple_build_cond_from_tree (tempcn, NULL_TREE, NULL_TREE);
+ VEC_quick_push (gimple, conds, stmt1);
+ VEC_quick_push (gimple, conds, stmt2);
+ VEC_quick_push (gimple, conds, stmt3);
(*nconds)++;
}
@@ -377,7 +373,7 @@ gen_one_condition (tree arg, int lbub,
static void
gen_conditions_for_domain (tree arg, inp_domain domain,
- VEC (tree, heap) *conds,
+ VEC (gimple, heap) *conds,
unsigned *nconds)
{
if (domain.has_lb)
@@ -391,7 +387,7 @@ gen_conditions_for_domain (tree arg, inp_domain domain,
{
/* Now push a separator. */
if (domain.has_lb)
- VEC_quick_push (tree, conds, NULL);
+ VEC_quick_push (gimple, conds, NULL);
gen_one_condition (arg, domain.ub,
(domain.is_ub_inclusive
@@ -420,7 +416,7 @@ gen_conditions_for_domain (tree arg, inp_domain domain,
static void
gen_conditions_for_pow_cst_base (tree base, tree expn,
- VEC (tree, heap) *conds,
+ VEC (gimple, heap) *conds,
unsigned *nconds)
{
inp_domain exp_domain;
@@ -456,20 +452,21 @@ gen_conditions_for_pow_cst_base (tree base, tree expn,
static void
gen_conditions_for_pow_int_base (tree base, tree expn,
- VEC (tree, heap) *conds,
+ VEC (gimple, heap) *conds,
unsigned *nconds)
{
- tree base_def, base_nm, base_val, base_val0;
+ gimple base_def;
+ tree base_nm, base_val0;
tree base_var, int_type;
tree temp, tempn;
- tree cst0, stmt1, stmt2;
+ tree cst0;
+ gimple stmt1, stmt2;
int bit_sz, max_exp;
inp_domain exp_domain;
base_def = SSA_NAME_DEF_STMT (base);
- base_nm = GIMPLE_STMT_OPERAND (base_def, 0);
- base_val = GIMPLE_STMT_OPERAND (base_def, 1);
- base_val0 = TREE_OPERAND (base_val, 0);
+ base_nm = gimple_assign_lhs (base_def);
+ base_val0 = gimple_assign_rhs1 (base_def);
base_var = SSA_NAME_VAR (base_val0);
int_type = TREE_TYPE (base_var);
bit_sz = TYPE_PRECISION (int_type);
@@ -514,19 +511,17 @@ gen_conditions_for_pow_int_base (tree base, tree expn,
type is integer. */
/* Push a separator. */
- VEC_quick_push (tree, conds, NULL);
+ VEC_quick_push (gimple, conds, NULL);
temp = create_tmp_var (int_type, "DCE_COND1");
cst0 = build_int_cst (int_type, 0);
- stmt1 = build_gimple_modify_stmt (temp, base_val0);
+ stmt1 = gimple_build_assign (temp, base_val0);
tempn = make_ssa_name (temp, stmt1);
- GIMPLE_STMT_OPERAND (stmt1, 0) = tempn;
- stmt2 = build3 (COND_EXPR, void_type_node,
- fold_build2 (LE_EXPR, boolean_type_node, tempn, cst0),
- NULL_TREE, NULL_TREE);
+ gimple_assign_set_lhs (stmt1, tempn);
+ stmt2 = gimple_build_cond (LE_EXPR, tempn, cst0, NULL_TREE, NULL_TREE);
- VEC_quick_push (tree, conds, stmt1);
- VEC_quick_push (tree, conds, stmt2);
+ VEC_quick_push (gimple, conds, stmt1);
+ VEC_quick_push (gimple, conds, stmt2);
(*nconds)++;
}
@@ -548,7 +543,7 @@ gen_conditions_for_pow_int_base (tree base, tree expn,
and *NCONDS is the number of logical conditions. */
static void
-gen_conditions_for_pow (tree pow_call, VEC (tree, heap) *conds,
+gen_conditions_for_pow (gimple pow_call, VEC (gimple, heap) *conds,
unsigned *nconds)
{
tree base, expn;
@@ -560,18 +555,16 @@ gen_conditions_for_pow (tree pow_call, VEC (tree, heap) *conds,
*nconds = 0;
- base = CALL_EXPR_ARG (pow_call, 0);
- expn = CALL_EXPR_ARG (pow_call, 1);
+ base = gimple_call_arg (pow_call, 0);
+ expn = gimple_call_arg (pow_call, 1);
bc = TREE_CODE (base);
ec = TREE_CODE (expn);
if (bc == REAL_CST)
- gen_conditions_for_pow_cst_base (base, expn,
- conds, nconds);
+ gen_conditions_for_pow_cst_base (base, expn, conds, nconds);
else if (bc == SSA_NAME)
- gen_conditions_for_pow_int_base (base, expn,
- conds, nconds);
+ gen_conditions_for_pow_int_base (base, expn, conds, nconds);
else
gcc_unreachable ();
}
@@ -689,22 +682,19 @@ get_no_error_domain (enum built_in_function fnc)
condition are separated by NULL tree in the vector. */
static void
-gen_shrink_wrap_conditions (tree bi_call, VEC (tree, heap) *conds,
+gen_shrink_wrap_conditions (gimple bi_call, VEC (gimple, heap) *conds,
unsigned int *nconds)
{
- tree call, fn;
+ gimple call;
+ tree fn;
enum built_in_function fnc;
gcc_assert (nconds && conds);
- gcc_assert (VEC_length (tree, conds) == 0);
- gcc_assert (TREE_CODE (bi_call) == GIMPLE_MODIFY_STMT
- || TREE_CODE (bi_call) == CALL_EXPR);
+ gcc_assert (VEC_length (gimple, conds) == 0);
+ gcc_assert (is_gimple_call (bi_call));
call = bi_call;
- if (TREE_CODE (call) == GIMPLE_MODIFY_STMT)
- call = get_call_expr_in (bi_call);
-
- fn = get_callee_fndecl (call);
+ fn = gimple_call_fndecl (call);
gcc_assert (fn && DECL_BUILT_IN (fn));
fnc = DECL_FUNCTION_CODE (fn);
*nconds = 0;
@@ -716,7 +706,7 @@ gen_shrink_wrap_conditions (tree bi_call, VEC (tree, heap) *conds,
tree arg;
inp_domain domain = get_no_error_domain (fnc);
*nconds = 0;
- arg = CALL_EXPR_ARG (bi_call, 0);
+ arg = gimple_call_arg (bi_call, 0);
gen_conditions_for_domain (arg, domain, conds, nconds);
}
@@ -733,21 +723,21 @@ gen_shrink_wrap_conditions (tree bi_call, VEC (tree, heap) *conds,
transformation actually happens. */
static bool
-shrink_wrap_one_built_in_call (tree bi_call)
+shrink_wrap_one_built_in_call (gimple bi_call)
{
- block_stmt_iterator bi_call_bsi;
+ gimple_stmt_iterator bi_call_bsi;
basic_block bi_call_bb, join_tgt_bb, guard_bb, guard_bb0;
edge join_tgt_in_edge_from_call, join_tgt_in_edge_fall_thru;
edge bi_call_in_edge0, guard_bb_in_edge;
- VEC (tree, heap) *conds;
+ VEC (gimple, heap) *conds;
unsigned tn_cond_stmts, nconds;
unsigned ci;
- tree cond_expr = NULL;
- tree cond_expr_start;
+ gimple cond_expr = NULL;
+ gimple cond_expr_start;
tree bi_call_label_decl;
- tree bi_call_label;
+ gimple bi_call_label;
- conds = VEC_alloc (tree, heap, 12);
+ conds = VEC_alloc (gimple, heap, 12);
gen_shrink_wrap_conditions (bi_call, conds, &nconds);
/* This can happen if the condition generator decides
@@ -757,40 +747,40 @@ shrink_wrap_one_built_in_call (tree bi_call)
if (nconds == 0)
return false;
- bi_call_bb = bb_for_stmt (bi_call);
+ bi_call_bb = gimple_bb (bi_call);
/* Now find the join target bb -- split
bi_call_bb if needed. */
- bi_call_bsi = bsi_for_stmt (bi_call);
+ bi_call_bsi = gsi_for_stmt (bi_call);
join_tgt_in_edge_from_call = split_block (bi_call_bb, bi_call);
- bi_call_bsi = bsi_for_stmt (bi_call);
+ bi_call_bsi = gsi_for_stmt (bi_call);
join_tgt_bb = join_tgt_in_edge_from_call->dest;
/* Now it is time to insert the first conditional expression
into bi_call_bb and split this bb so that bi_call is
shrink-wrapped. */
- tn_cond_stmts = VEC_length (tree, conds);
+ tn_cond_stmts = VEC_length (gimple, conds);
cond_expr = NULL;
- cond_expr_start = VEC_index (tree, conds, 0);
+ cond_expr_start = VEC_index (gimple, conds, 0);
for (ci = 0; ci < tn_cond_stmts; ci++)
{
- tree c = VEC_index (tree, conds, ci);
+ gimple c = VEC_index (gimple, conds, ci);
gcc_assert (c || ci != 0);
if (!c)
break;
- bsi_insert_before (&bi_call_bsi, c, BSI_SAME_STMT);
+ gsi_insert_before (&bi_call_bsi, c, GSI_SAME_STMT);
cond_expr = c;
}
nconds--;
ci++;
- gcc_assert (cond_expr && TREE_CODE (cond_expr) == COND_EXPR);
+ gcc_assert (cond_expr && gimple_code (cond_expr) == GIMPLE_COND);
/* Now the label. */
bi_call_label_decl = create_artificial_label ();
- bi_call_label = build1 (LABEL_EXPR, void_type_node, bi_call_label_decl);
- bsi_insert_before (&bi_call_bsi, bi_call_label, BSI_SAME_STMT);
+ bi_call_label = gimple_build_label (bi_call_label_decl);
+ gsi_insert_before (&bi_call_bsi, bi_call_label, GSI_SAME_STMT);
bi_call_in_edge0 = split_block (bi_call_bb, cond_expr);
bi_call_in_edge0->flags &= ~EDGE_FALLTHRU;
@@ -810,21 +800,21 @@ shrink_wrap_one_built_in_call (tree bi_call)
{
unsigned ci0;
edge bi_call_in_edge;
- block_stmt_iterator guard_bsi = bsi_for_stmt (cond_expr_start);
+ gimple_stmt_iterator guard_bsi = gsi_for_stmt (cond_expr_start);
ci0 = ci;
- cond_expr_start = VEC_index (tree, conds, ci0);
+ cond_expr_start = VEC_index (gimple, conds, ci0);
for (; ci < tn_cond_stmts; ci++)
{
- tree c = VEC_index (tree, conds, ci);
+ gimple c = VEC_index (gimple, conds, ci);
gcc_assert (c || ci != ci0);
if (!c)
break;
- bsi_insert_before (&guard_bsi, c, BSI_SAME_STMT);
+ gsi_insert_before (&guard_bsi, c, GSI_SAME_STMT);
cond_expr = c;
}
nconds--;
ci++;
- gcc_assert (cond_expr && TREE_CODE (cond_expr) == COND_EXPR);
+ gcc_assert (cond_expr && gimple_code (cond_expr) == GIMPLE_COND);
guard_bb_in_edge = split_block (guard_bb, cond_expr);
guard_bb_in_edge->flags &= ~EDGE_FALLTHRU;
guard_bb_in_edge->flags |= EDGE_FALSE_VALUE;
@@ -836,11 +826,11 @@ shrink_wrap_one_built_in_call (tree bi_call)
REG_BR_PROB_BASE - bi_call_in_edge->probability;
}
- VEC_free (tree, heap, conds);
+ VEC_free (gimple, heap, conds);
if (dump_file && (dump_flags & TDF_DETAILS))
{
location_t loc;
- loc = EXPR_LOCATION (bi_call);
+ loc = gimple_location (bi_call);
fprintf (dump_file,
"%s:%d: note: function call is shrink-wrapped"
" into error conditions.\n",
@@ -859,13 +849,13 @@ shrink_wrap_conditional_dead_built_in_calls (void)
bool changed = false;
unsigned i = 0;
- unsigned n = VEC_length (tree, cond_dead_built_in_calls);
+ unsigned n = VEC_length (gimple, cond_dead_built_in_calls);
if (n == 0)
return false;
for (; i < n ; i++)
{
- tree bi_call = VEC_index (tree, cond_dead_built_in_calls, i);
+ gimple bi_call = VEC_index (gimple, cond_dead_built_in_calls, i);
changed |= shrink_wrap_one_built_in_call (bi_call);
}
@@ -878,34 +868,33 @@ static unsigned int
tree_call_cdce (void)
{
basic_block bb;
- block_stmt_iterator i;
+ gimple_stmt_iterator i;
bool something_changed = false;
- cond_dead_built_in_calls = VEC_alloc (tree, heap, 64);
+ cond_dead_built_in_calls = VEC_alloc (gimple, heap, 64);
FOR_EACH_BB (bb)
{
/* Collect dead call candidates. */
- for (i = bsi_start (bb); ! bsi_end_p (i); bsi_next (&i))
+ for (i = gsi_start_bb (bb); !gsi_end_p (i); gsi_next (&i))
{
- tree stmt = bsi_stmt (i);
- if (TREE_CODE (stmt) == CALL_EXPR
+ gimple stmt = gsi_stmt (i);
+ if (is_gimple_call (stmt)
&& is_call_dce_candidate (stmt))
{
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Found conditional dead call: ");
- print_generic_stmt (dump_file, stmt, TDF_SLIM);
+ print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM);
fprintf (dump_file, "\n");
}
- VEC_quick_push (tree, cond_dead_built_in_calls, stmt);
+ VEC_quick_push (gimple, cond_dead_built_in_calls, stmt);
}
}
}
- something_changed =
- shrink_wrap_conditional_dead_built_in_calls ();
+ something_changed = shrink_wrap_conditional_dead_built_in_calls ();
- VEC_free (tree, heap, cond_dead_built_in_calls);
+ VEC_free (gimple, heap, cond_dead_built_in_calls);
if (something_changed)
{
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 341a1de749d..99978efe35b 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -59,7 +59,7 @@ static const int initial_cfg_capacity = 20;
/* This hash table allows us to efficiently lookup all CASE_LABEL_EXPRs
which use a particular edge. The CASE_LABEL_EXPRs are chained together
via their TREE_CHAIN field, which we clear after we're done with the
- hash table to prevent problems with duplication of SWITCH_EXPRs.
+ hash table to prevent problems with duplication of GIMPLE_SWITCHes.
Access to this list of CASE_LABEL_EXPRs allows us to efficiently
update the case vector in response to edge redirections.
@@ -83,35 +83,32 @@ static struct cfg_stats_d cfg_stats;
static bool found_computed_goto;
/* Basic blocks and flowgraphs. */
-static basic_block create_bb (void *, void *, basic_block);
-static void make_blocks (tree);
+static void make_blocks (gimple_seq);
static void factor_computed_gotos (void);
/* Edges. */
static void make_edges (void);
static void make_cond_expr_edges (basic_block);
-static void make_switch_expr_edges (basic_block);
+static void make_gimple_switch_edges (basic_block);
static void make_goto_expr_edges (basic_block);
-static edge tree_redirect_edge_and_branch (edge, basic_block);
-static edge tree_try_redirect_by_replacing_jump (edge, basic_block);
+static edge gimple_redirect_edge_and_branch (edge, basic_block);
+static edge gimple_try_redirect_by_replacing_jump (edge, basic_block);
static unsigned int split_critical_edges (void);
/* Various helpers. */
-static inline bool stmt_starts_bb_p (const_tree, const_tree);
-static int tree_verify_flow_info (void);
-static void tree_make_forwarder_block (edge);
-static void tree_cfg2vcg (FILE *);
-static inline void change_bb_for_stmt (tree t, basic_block bb);
-static bool computed_goto_p (const_tree);
+static inline bool stmt_starts_bb_p (gimple, gimple);
+static int gimple_verify_flow_info (void);
+static void gimple_make_forwarder_block (edge);
+static void gimple_cfg2vcg (FILE *);
/* Flowgraph optimization and cleanup. */
-static void tree_merge_blocks (basic_block, basic_block);
-static bool tree_can_merge_blocks_p (basic_block, basic_block);
+static void gimple_merge_blocks (basic_block, basic_block);
+static bool gimple_can_merge_blocks_p (basic_block, basic_block);
static void remove_bb (basic_block);
static edge find_taken_edge_computed_goto (basic_block, tree);
static edge find_taken_edge_cond_expr (basic_block, tree);
static edge find_taken_edge_switch_expr (basic_block, tree);
-static tree find_case_label_for_value (tree, tree);
+static tree find_case_label_for_value (gimple, tree);
void
init_empty_tree_cfg_for_function (struct function *fn)
@@ -155,21 +152,21 @@ init_empty_tree_cfg (void)
Create basic blocks
---------------------------------------------------------------------------*/
-/* Entry point to the CFG builder for trees. TP points to the list of
+/* Entry point to the CFG builder for trees. SEQ is the sequence of
statements to be added to the flowgraph. */
static void
-build_tree_cfg (tree *tp)
+build_gimple_cfg (gimple_seq seq)
{
- /* Register specific tree functions. */
- tree_register_cfg_hooks ();
+ /* Register specific gimple functions. */
+ gimple_register_cfg_hooks ();
memset ((void *) &cfg_stats, 0, sizeof (cfg_stats));
init_empty_tree_cfg ();
found_computed_goto = 0;
- make_blocks (*tp);
+ make_blocks (seq);
/* Computed gotos are hell to deal with, especially if there are
lots of them with a large number of destinations. So we factor
@@ -207,7 +204,7 @@ build_tree_cfg (tree *tp)
FILE *vcg_file = dump_begin (TDI_vcg, &local_dump_flags);
if (vcg_file)
{
- tree_cfg2vcg (vcg_file);
+ gimple_cfg2vcg (vcg_file);
dump_end (TDI_vcg, vcg_file);
}
}
@@ -218,13 +215,13 @@ build_tree_cfg (tree *tp)
/* Dump a textual representation of the flowgraph. */
if (dump_file)
- dump_tree_cfg (dump_file, dump_flags);
+ gimple_dump_cfg (dump_file, dump_flags);
}
static unsigned int
execute_build_cfg (void)
{
- build_tree_cfg (&DECL_SAVED_TREE (current_function_decl));
+ build_gimple_cfg (gimple_body (current_function_decl));
return 0;
}
@@ -239,7 +236,7 @@ struct gimple_opt_pass pass_build_cfg =
NULL, /* next */
0, /* static_pass_number */
TV_TREE_CFG, /* tv_id */
- PROP_gimple_leh, /* properties_required */
+ PROP_gimple_leh, /* properties_required */
PROP_cfg, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
@@ -247,6 +244,17 @@ struct gimple_opt_pass pass_build_cfg =
}
};
+
+/* Return true if T is a computed goto. */
+
+static bool
+computed_goto_p (gimple t)
+{
+ return (gimple_code (t) == GIMPLE_GOTO
+ && TREE_CODE (gimple_goto_dest (t)) != LABEL_DECL);
+}
+
+
/* Search the CFG for any computed gotos. If found, factor them to a
common computed goto site. Also record the location of that site so
that we can un-factor the gotos after we have converted back to
@@ -258,8 +266,8 @@ factor_computed_gotos (void)
basic_block bb;
tree factored_label_decl = NULL;
tree var = NULL;
- tree factored_computed_goto_label = NULL;
- tree factored_computed_goto = NULL;
+ gimple factored_computed_goto_label = NULL;
+ gimple factored_computed_goto = NULL;
/* We know there are one or more computed gotos in this function.
Examine the last statement in each basic block to see if the block
@@ -267,12 +275,13 @@ factor_computed_gotos (void)
FOR_EACH_BB (bb)
{
- block_stmt_iterator bsi = bsi_last (bb);
- tree last;
+ gimple_stmt_iterator gsi = gsi_last_bb (bb);
+ gimple last;
- if (bsi_end_p (bsi))
+ if (gsi_end_p (gsi))
continue;
- last = bsi_stmt (bsi);
+
+ last = gsi_stmt (gsi);
/* Ignore the computed goto we create when we factor the original
computed gotos. */
@@ -282,15 +291,15 @@ factor_computed_gotos (void)
/* If the last statement is a computed goto, factor it. */
if (computed_goto_p (last))
{
- tree assignment;
+ gimple assignment;
/* The first time we find a computed goto we need to create
the factored goto block and the variable each original
computed goto will use for their goto destination. */
- if (! factored_computed_goto)
+ if (!factored_computed_goto)
{
basic_block new_bb = create_empty_bb (bb);
- block_stmt_iterator new_bsi = bsi_start (new_bb);
+ gimple_stmt_iterator new_gsi = gsi_start_bb (new_bb);
/* Create the destination of the factored goto. Each original
computed goto will put its desired destination into this
@@ -302,60 +311,58 @@ factor_computed_gotos (void)
factored computed goto. */
factored_label_decl = create_artificial_label ();
factored_computed_goto_label
- = build1 (LABEL_EXPR, void_type_node, factored_label_decl);
- bsi_insert_after (&new_bsi, factored_computed_goto_label,
- BSI_NEW_STMT);
+ = gimple_build_label (factored_label_decl);
+ gsi_insert_after (&new_gsi, factored_computed_goto_label,
+ GSI_NEW_STMT);
/* Build our new computed goto. */
- factored_computed_goto = build1 (GOTO_EXPR, void_type_node, var);
- bsi_insert_after (&new_bsi, factored_computed_goto,
- BSI_NEW_STMT);
+ factored_computed_goto = gimple_build_goto (var);
+ gsi_insert_after (&new_gsi, factored_computed_goto, GSI_NEW_STMT);
}
/* Copy the original computed goto's destination into VAR. */
- assignment = build_gimple_modify_stmt (var,
- GOTO_DESTINATION (last));
- bsi_insert_before (&bsi, assignment, BSI_SAME_STMT);
+ assignment = gimple_build_assign (var, gimple_goto_dest (last));
+ gsi_insert_before (&gsi, assignment, GSI_SAME_STMT);
/* And re-vector the computed goto to the new destination. */
- GOTO_DESTINATION (last) = factored_label_decl;
+ gimple_goto_set_dest (last, factored_label_decl);
}
}
}
-/* Build a flowgraph for the statement_list STMT_LIST. */
+/* Build a flowgraph for the sequence of stmts SEQ. */
static void
-make_blocks (tree stmt_list)
+make_blocks (gimple_seq seq)
{
- tree_stmt_iterator i = tsi_start (stmt_list);
- tree stmt = NULL;
+ gimple_stmt_iterator i = gsi_start (seq);
+ gimple stmt = NULL;
bool start_new_block = true;
- bool first_stmt_of_list = true;
+ bool first_stmt_of_seq = true;
basic_block bb = ENTRY_BLOCK_PTR;
- while (!tsi_end_p (i))
+ while (!gsi_end_p (i))
{
- tree prev_stmt;
+ gimple prev_stmt;
prev_stmt = stmt;
- stmt = tsi_stmt (i);
+ stmt = gsi_stmt (i);
/* If the statement starts a new basic block or if we have determined
in a previous pass that we need to create a new block for STMT, do
so now. */
if (start_new_block || stmt_starts_bb_p (stmt, prev_stmt))
{
- if (!first_stmt_of_list)
- stmt_list = tsi_split_statement_list_before (&i);
- bb = create_basic_block (stmt_list, NULL, bb);
+ if (!first_stmt_of_seq)
+ seq = gsi_split_seq_before (&i);
+ bb = create_basic_block (seq, NULL, bb);
start_new_block = false;
}
/* Now add STMT to BB and create the subgraphs for special statement
codes. */
- set_bb_for_stmt (stmt, bb);
+ gimple_set_bb (stmt, bb);
if (computed_goto_p (stmt))
found_computed_goto = true;
@@ -365,8 +372,8 @@ make_blocks (tree stmt_list)
if (stmt_ends_bb_p (stmt))
start_new_block = true;
- tsi_next (&i);
- first_stmt_of_list = false;
+ gsi_next (&i);
+ first_stmt_of_seq = false;
}
}
@@ -387,8 +394,8 @@ create_bb (void *h, void *e, basic_block after)
bb->index = last_basic_block;
bb->flags = BB_NEW;
- bb->il.tree = GGC_CNEW (struct tree_bb_info);
- set_bb_stmt_list (bb, h ? (tree) h : alloc_stmt_list ());
+ bb->il.gimple = GGC_CNEW (struct gimple_bb_info);
+ set_bb_seq (bb, h ? (gimple_seq) h : gimple_seq_alloc ());
/* Add the new block to the linked list of blocks. */
link_block (bb, after);
@@ -423,25 +430,31 @@ fold_cond_expr_cond (void)
FOR_EACH_BB (bb)
{
- tree stmt = last_stmt (bb);
+ gimple stmt = last_stmt (bb);
- if (stmt
- && TREE_CODE (stmt) == COND_EXPR)
+ if (stmt && gimple_code (stmt) == GIMPLE_COND)
{
tree cond;
bool zerop, onep;
fold_defer_overflow_warnings ();
- cond = fold (COND_EXPR_COND (stmt));
- zerop = integer_zerop (cond);
- onep = integer_onep (cond);
+ cond = fold_binary (gimple_cond_code (stmt), boolean_type_node,
+ gimple_cond_lhs (stmt), gimple_cond_rhs (stmt));
+ if (cond)
+ {
+ zerop = integer_zerop (cond);
+ onep = integer_onep (cond);
+ }
+ else
+ zerop = onep = false;
+
fold_undefer_overflow_warnings (zerop || onep,
stmt,
WARN_STRICT_OVERFLOW_CONDITIONAL);
if (zerop)
- COND_EXPR_COND (stmt) = boolean_false_node;
+ gimple_cond_make_false (stmt);
else if (onep)
- COND_EXPR_COND (stmt) = boolean_true_node;
+ gimple_cond_make_true (stmt);
}
}
}
@@ -461,40 +474,40 @@ make_edges (void)
/* Traverse the basic block array placing edges. */
FOR_EACH_BB (bb)
{
- tree last = last_stmt (bb);
+ gimple last = last_stmt (bb);
bool fallthru;
if (last)
{
- enum tree_code code = TREE_CODE (last);
+ enum gimple_code code = gimple_code (last);
switch (code)
{
- case GOTO_EXPR:
+ case GIMPLE_GOTO:
make_goto_expr_edges (bb);
fallthru = false;
break;
- case RETURN_EXPR:
+ case GIMPLE_RETURN:
make_edge (bb, EXIT_BLOCK_PTR, 0);
fallthru = false;
break;
- case COND_EXPR:
+ case GIMPLE_COND:
make_cond_expr_edges (bb);
fallthru = false;
break;
- case SWITCH_EXPR:
- make_switch_expr_edges (bb);
+ case GIMPLE_SWITCH:
+ make_gimple_switch_edges (bb);
fallthru = false;
break;
- case RESX_EXPR:
+ case GIMPLE_RESX:
make_eh_edges (last);
fallthru = false;
break;
- case CALL_EXPR:
+ case GIMPLE_CALL:
/* If this function receives a nonlocal goto, then we need to
make edges from this call site to all the nonlocal goto
handlers. */
- if (tree_can_make_abnormal_goto (last))
+ if (stmt_can_make_abnormal_goto (last))
make_abnormal_goto_edges (bb, true);
/* If this statement has reachable exception handlers, then
@@ -502,83 +515,78 @@ make_edges (void)
make_eh_edges (last);
/* Some calls are known not to return. */
- fallthru = !(call_expr_flags (last) & ECF_NORETURN);
+ fallthru = !(gimple_call_flags (last) & ECF_NORETURN);
break;
- case MODIFY_EXPR:
- gcc_unreachable ();
-
- case GIMPLE_MODIFY_STMT:
+ case GIMPLE_ASSIGN:
+ /* A GIMPLE_ASSIGN may throw internally and thus be considered
+ control-altering. */
if (is_ctrl_altering_stmt (last))
{
- /* A GIMPLE_MODIFY_STMT may have a CALL_EXPR on its RHS and
- the CALL_EXPR may have an abnormal edge. Search the RHS
- for this case and create any required edges. */
- if (tree_can_make_abnormal_goto (last))
- make_abnormal_goto_edges (bb, true);
-
make_eh_edges (last);
}
fallthru = true;
break;
- case OMP_PARALLEL:
- case OMP_TASK:
- case OMP_FOR:
- case OMP_SINGLE:
- case OMP_MASTER:
- case OMP_ORDERED:
- case OMP_CRITICAL:
- case OMP_SECTION:
+ case GIMPLE_OMP_PARALLEL:
+ case GIMPLE_OMP_TASK:
+ case GIMPLE_OMP_FOR:
+ case GIMPLE_OMP_SINGLE:
+ case GIMPLE_OMP_MASTER:
+ case GIMPLE_OMP_ORDERED:
+ case GIMPLE_OMP_CRITICAL:
+ case GIMPLE_OMP_SECTION:
cur_region = new_omp_region (bb, code, cur_region);
fallthru = true;
break;
- case OMP_SECTIONS:
+ case GIMPLE_OMP_SECTIONS:
cur_region = new_omp_region (bb, code, cur_region);
fallthru = true;
break;
- case OMP_SECTIONS_SWITCH:
+ case GIMPLE_OMP_SECTIONS_SWITCH:
fallthru = false;
break;
- case OMP_ATOMIC_LOAD:
- case OMP_ATOMIC_STORE:
+ case GIMPLE_OMP_ATOMIC_LOAD:
+ case GIMPLE_OMP_ATOMIC_STORE:
fallthru = true;
break;
- case OMP_RETURN:
- /* In the case of an OMP_SECTION, the edge will go somewhere
- other than the next block. This will be created later. */
+ case GIMPLE_OMP_RETURN:
+ /* In the case of a GIMPLE_OMP_SECTION, the edge will go
+ somewhere other than the next block. This will be
+ created later. */
cur_region->exit = bb;
- fallthru = cur_region->type != OMP_SECTION;
+ fallthru = cur_region->type != GIMPLE_OMP_SECTION;
cur_region = cur_region->outer;
break;
- case OMP_CONTINUE:
+ case GIMPLE_OMP_CONTINUE:
cur_region->cont = bb;
switch (cur_region->type)
{
- case OMP_FOR:
- /* Mark all OMP_FOR and OMP_CONTINUE succs edges as abnormal
- to prevent splitting them. */
+ case GIMPLE_OMP_FOR:
+ /* Mark all GIMPLE_OMP_FOR and GIMPLE_OMP_CONTINUE
+ succs edges as abnormal to prevent splitting
+ them. */
single_succ_edge (cur_region->entry)->flags |= EDGE_ABNORMAL;
/* Make the loopback edge. */
make_edge (bb, single_succ (cur_region->entry),
EDGE_ABNORMAL);
- /* Create an edge from OMP_FOR to exit, which corresponds to
- the case that the body of the loop is not executed at
- all. */
+ /* Create an edge from GIMPLE_OMP_FOR to exit, which
+ corresponds to the case that the body of the loop
+ is not executed at all. */
make_edge (cur_region->entry, bb->next_bb, EDGE_ABNORMAL);
make_edge (bb, bb->next_bb, EDGE_FALLTHRU | EDGE_ABNORMAL);
fallthru = false;
break;
- case OMP_SECTIONS:
+ case GIMPLE_OMP_SECTIONS:
/* Wire up the edges into and out of the nested sections. */
{
basic_block switch_bb = single_succ (cur_region->entry);
@@ -586,13 +594,13 @@ make_edges (void)
struct omp_region *i;
for (i = cur_region->inner; i ; i = i->next)
{
- gcc_assert (i->type == OMP_SECTION);
+ gcc_assert (i->type == GIMPLE_OMP_SECTION);
make_edge (switch_bb, i->entry, 0);
make_edge (i->exit, bb, EDGE_FALLTHRU);
}
/* Make the loopback edge to the block with
- OMP_SECTIONS_SWITCH. */
+ GIMPLE_OMP_SECTIONS_SWITCH. */
make_edge (bb, switch_bb, 0);
/* Make the edge from the switch to exit. */
@@ -626,35 +634,37 @@ make_edges (void)
}
-/* Create the edges for a COND_EXPR starting at block BB.
- At this point, both clauses must contain only simple gotos. */
+/* Create the edges for a GIMPLE_COND starting at block BB. */
static void
make_cond_expr_edges (basic_block bb)
{
- tree entry = last_stmt (bb);
+ gimple entry = last_stmt (bb);
+ gimple then_stmt, else_stmt;
basic_block then_bb, else_bb;
tree then_label, else_label;
edge e;
gcc_assert (entry);
- gcc_assert (TREE_CODE (entry) == COND_EXPR);
+ gcc_assert (gimple_code (entry) == GIMPLE_COND);
/* Entry basic blocks for each component. */
- then_label = GOTO_DESTINATION (COND_EXPR_THEN (entry));
- else_label = GOTO_DESTINATION (COND_EXPR_ELSE (entry));
+ then_label = gimple_cond_true_label (entry);
+ else_label = gimple_cond_false_label (entry);
then_bb = label_to_block (then_label);
else_bb = label_to_block (else_label);
+ then_stmt = first_stmt (then_bb);
+ else_stmt = first_stmt (else_bb);
e = make_edge (bb, then_bb, EDGE_TRUE_VALUE);
- e->goto_locus = EXPR_LOCATION (COND_EXPR_THEN (entry));
+ e->goto_locus = gimple_location (then_stmt);
e = make_edge (bb, else_bb, EDGE_FALSE_VALUE);
if (e)
- e->goto_locus = EXPR_LOCATION (COND_EXPR_ELSE (entry));
+ e->goto_locus = gimple_location (else_stmt);
- /* We do not need the gotos anymore. */
- COND_EXPR_THEN (entry) = NULL_TREE;
- COND_EXPR_ELSE (entry) = NULL_TREE;
+ /* We do not need the labels anymore. */
+ gimple_cond_set_true_label (entry, NULL_TREE);
+ gimple_cond_set_false_label (entry, NULL_TREE);
}
@@ -714,11 +724,10 @@ end_recording_case_labels (void)
Otherwise return NULL. */
static tree
-get_cases_for_edge (edge e, tree t)
+get_cases_for_edge (edge e, gimple t)
{
void **slot;
size_t i, n;
- tree vec;
/* If we are not recording cases, then we do not have CASE_LABEL_EXPR
chains available. Return NULL so the caller can detect this case. */
@@ -733,11 +742,10 @@ get_cases_for_edge (edge e, tree t)
time we have been queried for information about E & T. Add all the
elements from T to the hash table then perform the query again. */
- vec = SWITCH_LABELS (t);
- n = TREE_VEC_LENGTH (vec);
+ n = gimple_switch_num_labels (t);
for (i = 0; i < n; i++)
{
- tree elt = TREE_VEC_ELT (vec, i);
+ tree elt = gimple_switch_label (t, i);
tree lab = CASE_LABEL (elt);
basic_block label_bb = label_to_block (lab);
edge this_edge = find_edge (e->src, label_bb);
@@ -752,23 +760,19 @@ get_cases_for_edge (edge e, tree t)
return (tree) *pointer_map_contains (edge_to_cases, e);
}
-/* Create the edges for a SWITCH_EXPR starting at block BB.
- At this point, the switch body has been lowered and the
- SWITCH_LABELS filled in, so this is in effect a multi-way branch. */
+/* Create the edges for a GIMPLE_SWITCH starting at block BB. */
static void
-make_switch_expr_edges (basic_block bb)
+make_gimple_switch_edges (basic_block bb)
{
- tree entry = last_stmt (bb);
+ gimple entry = last_stmt (bb);
size_t i, n;
- tree vec;
- vec = SWITCH_LABELS (entry);
- n = TREE_VEC_LENGTH (vec);
+ n = gimple_switch_num_labels (entry);
for (i = 0; i < n; ++i)
{
- tree lab = CASE_LABEL (TREE_VEC_ELT (vec, i));
+ tree lab = CASE_LABEL (gimple_switch_label (entry, i));
basic_block label_bb = label_to_block (lab);
make_edge (bb, label_bb, 0);
}
@@ -787,12 +791,11 @@ label_to_block_fn (struct function *ifun, tree dest)
and undefined variable warnings quite right. */
if ((errorcount || sorrycount) && uid < 0)
{
- block_stmt_iterator bsi =
- bsi_start (BASIC_BLOCK (NUM_FIXED_BLOCKS));
- tree stmt;
+ gimple_stmt_iterator gsi = gsi_start_bb (BASIC_BLOCK (NUM_FIXED_BLOCKS));
+ gimple stmt;
- stmt = build1 (LABEL_EXPR, void_type_node, dest);
- bsi_insert_before (&bsi, stmt, BSI_NEW_STMT);
+ stmt = gimple_build_label (dest);
+ gsi_insert_before (&gsi, stmt, GSI_NEW_STMT);
uid = LABEL_DECL_UID (dest);
}
if (VEC_length (basic_block, ifun->cfg->x_label_to_block_map)
@@ -808,17 +811,18 @@ void
make_abnormal_goto_edges (basic_block bb, bool for_call)
{
basic_block target_bb;
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
FOR_EACH_BB (target_bb)
- for (bsi = bsi_start (target_bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ for (gsi = gsi_start_bb (target_bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- tree target = bsi_stmt (bsi);
+ gimple label_stmt = gsi_stmt (gsi);
+ tree target;
- if (TREE_CODE (target) != LABEL_EXPR)
+ if (gimple_code (label_stmt) != GIMPLE_LABEL)
break;
- target = LABEL_EXPR_LABEL (target);
+ target = gimple_label_label (label_stmt);
/* Make an edge to every label block that has been marked as a
potential target for a computed goto or a non-local goto. */
@@ -836,16 +840,16 @@ make_abnormal_goto_edges (basic_block bb, bool for_call)
static void
make_goto_expr_edges (basic_block bb)
{
- block_stmt_iterator last = bsi_last (bb);
- tree goto_t = bsi_stmt (last);
+ gimple_stmt_iterator last = gsi_last_bb (bb);
+ gimple goto_t = gsi_stmt (last);
/* A simple GOTO creates normal edges. */
if (simple_goto_p (goto_t))
{
- tree dest = GOTO_DESTINATION (goto_t);
+ tree dest = gimple_goto_dest (goto_t);
edge e = make_edge (bb, label_to_block (dest), EDGE_FALLTHRU);
- e->goto_locus = EXPR_LOCATION (goto_t);
- bsi_remove (&last, true);
+ e->goto_locus = gimple_location (goto_t);
+ gsi_remove (&last, true);
return;
}
@@ -898,7 +902,9 @@ update_eh_label (struct eh_region *region)
}
}
+
/* Given LABEL return the first label in the same basic block. */
+
static tree
main_block_label (tree label)
{
@@ -931,16 +937,17 @@ cleanup_dead_labels (void)
label if there is one, or otherwise just the first label we see. */
FOR_EACH_BB (bb)
{
- block_stmt_iterator i;
+ gimple_stmt_iterator i;
- for (i = bsi_start (bb); !bsi_end_p (i); bsi_next (&i))
+ for (i = gsi_start_bb (bb); !gsi_end_p (i); gsi_next (&i))
{
- tree label, stmt = bsi_stmt (i);
+ tree label;
+ gimple stmt = gsi_stmt (i);
- if (TREE_CODE (stmt) != LABEL_EXPR)
+ if (gimple_code (stmt) != GIMPLE_LABEL)
break;
- label = LABEL_EXPR_LABEL (stmt);
+ label = gimple_label_label (stmt);
/* If we have not yet seen a label for the current block,
remember this one and see if there are more labels. */
@@ -966,52 +973,45 @@ cleanup_dead_labels (void)
First do so for each block ending in a control statement. */
FOR_EACH_BB (bb)
{
- tree stmt = last_stmt (bb);
+ gimple stmt = last_stmt (bb);
if (!stmt)
continue;
- switch (TREE_CODE (stmt))
+ switch (gimple_code (stmt))
{
- case COND_EXPR:
+ case GIMPLE_COND:
{
- tree true_branch, false_branch;
-
- true_branch = COND_EXPR_THEN (stmt);
- false_branch = COND_EXPR_ELSE (stmt);
-
- if (true_branch)
- GOTO_DESTINATION (true_branch)
- = main_block_label (GOTO_DESTINATION (true_branch));
- if (false_branch)
- GOTO_DESTINATION (false_branch)
- = main_block_label (GOTO_DESTINATION (false_branch));
+ tree true_label = gimple_cond_true_label (stmt);
+ tree false_label = gimple_cond_false_label (stmt);
+ if (true_label)
+ gimple_cond_set_true_label (stmt, main_block_label (true_label));
+ if (false_label)
+ gimple_cond_set_false_label (stmt, main_block_label (false_label));
break;
}
- case SWITCH_EXPR:
+ case GIMPLE_SWITCH:
{
- size_t i;
- tree vec = SWITCH_LABELS (stmt);
- size_t n = TREE_VEC_LENGTH (vec);
+ size_t i, n = gimple_switch_num_labels (stmt);
/* Replace all destination labels. */
for (i = 0; i < n; ++i)
{
- tree elt = TREE_VEC_ELT (vec, i);
- tree label = main_block_label (CASE_LABEL (elt));
- CASE_LABEL (elt) = label;
+ tree case_label = gimple_switch_label (stmt, i);
+ tree label = main_block_label (CASE_LABEL (case_label));
+ CASE_LABEL (case_label) = label;
}
break;
}
- /* We have to handle GOTO_EXPRs until they're removed, and we don't
+ /* We have to handle gotos until they're removed, and we don't
remove them until after we've created the CFG edges. */
- case GOTO_EXPR:
- if (! computed_goto_p (stmt))
+ case GIMPLE_GOTO:
+ if (!computed_goto_p (stmt))
{
- GOTO_DESTINATION (stmt)
- = main_block_label (GOTO_DESTINATION (stmt));
+ tree new_dest = main_block_label (gimple_goto_dest (stmt));
+ gimple_goto_set_dest (stmt, new_dest);
break;
}
@@ -1027,7 +1027,7 @@ cleanup_dead_labels (void)
address taken are preserved. */
FOR_EACH_BB (bb)
{
- block_stmt_iterator i;
+ gimple_stmt_iterator i;
tree label_for_this_bb = label_for_bb[bb->index].label;
if (!label_for_this_bb)
@@ -1037,22 +1037,23 @@ cleanup_dead_labels (void)
if (!label_for_bb[bb->index].used)
label_for_this_bb = NULL;
- for (i = bsi_start (bb); !bsi_end_p (i); )
+ for (i = gsi_start_bb (bb); !gsi_end_p (i); )
{
- tree label, stmt = bsi_stmt (i);
+ tree label;
+ gimple stmt = gsi_stmt (i);
- if (TREE_CODE (stmt) != LABEL_EXPR)
+ if (gimple_code (stmt) != GIMPLE_LABEL)
break;
- label = LABEL_EXPR_LABEL (stmt);
+ label = gimple_label_label (stmt);
if (label == label_for_this_bb
- || ! DECL_ARTIFICIAL (label)
+ || !DECL_ARTIFICIAL (label)
|| DECL_NONLOCAL (label)
|| FORCED_LABEL (label))
- bsi_next (&i);
+ gsi_next (&i);
else
- bsi_remove (&i, true);
+ gsi_remove (&i, true);
}
}
@@ -1071,32 +1072,37 @@ group_case_labels (void)
FOR_EACH_BB (bb)
{
- tree stmt = last_stmt (bb);
- if (stmt && TREE_CODE (stmt) == SWITCH_EXPR)
+ gimple stmt = last_stmt (bb);
+ if (stmt && gimple_code (stmt) == GIMPLE_SWITCH)
{
- tree labels = SWITCH_LABELS (stmt);
- int old_size = TREE_VEC_LENGTH (labels);
+ int old_size = gimple_switch_num_labels (stmt);
int i, j, new_size = old_size;
tree default_case = NULL_TREE;
tree default_label = NULL_TREE;
+ bool has_default;
- /* The default label is always the last case in a switch
+ /* The default label is always the first case in a switch
statement after gimplification if it was not optimized
- away. */
- if (!CASE_LOW (TREE_VEC_ELT (labels, old_size - 1))
- && !CASE_HIGH (TREE_VEC_ELT (labels, old_size - 1)))
+ away */
+ if (!CASE_LOW (gimple_switch_default_label (stmt))
+ && !CASE_HIGH (gimple_switch_default_label (stmt)))
{
- default_case = TREE_VEC_ELT (labels, old_size - 1);
+ default_case = gimple_switch_default_label (stmt);
default_label = CASE_LABEL (default_case);
- old_size--;
+ has_default = true;
}
+ else
+ has_default = false;
/* Look for possible opportunities to merge cases. */
- i = 0;
+ if (has_default)
+ i = 1;
+ else
+ i = 0;
while (i < old_size)
{
tree base_case, base_label, base_high;
- base_case = TREE_VEC_ELT (labels, i);
+ base_case = gimple_switch_label (stmt, i);
gcc_assert (base_case);
base_label = CASE_LABEL (base_case);
@@ -1105,21 +1111,23 @@ group_case_labels (void)
default case. */
if (base_label == default_label)
{
- TREE_VEC_ELT (labels, i) = NULL_TREE;
+ gimple_switch_set_label (stmt, i, NULL_TREE);
i++;
new_size--;
continue;
}
- base_high = CASE_HIGH (base_case) ?
- CASE_HIGH (base_case) : CASE_LOW (base_case);
+ base_high = CASE_HIGH (base_case)
+ ? CASE_HIGH (base_case)
+ : CASE_LOW (base_case);
i++;
+
/* Try to merge case labels. Break out when we reach the end
of the label vector or when we cannot merge the next case
label with the current one. */
while (i < old_size)
{
- tree merge_case = TREE_VEC_ELT (labels, i);
+ tree merge_case = gimple_switch_label (stmt, i);
tree merge_label = CASE_LABEL (merge_case);
tree t = int_const_binop (PLUS_EXPR, base_high,
integer_one_node, 1);
@@ -1132,7 +1140,7 @@ group_case_labels (void)
base_high = CASE_HIGH (merge_case) ?
CASE_HIGH (merge_case) : CASE_LOW (merge_case);
CASE_HIGH (base_case) = base_high;
- TREE_VEC_ELT (labels, i) = NULL_TREE;
+ gimple_switch_set_label (stmt, i, NULL_TREE);
new_size--;
i++;
}
@@ -1145,11 +1153,14 @@ group_case_labels (void)
length of the vector. */
for (i = 0, j = 0; i < new_size; i++)
{
- while (! TREE_VEC_ELT (labels, j))
+ while (! gimple_switch_label (stmt, j))
j++;
- TREE_VEC_ELT (labels, i) = TREE_VEC_ELT (labels, j++);
+ gimple_switch_set_label (stmt, i,
+ gimple_switch_label (stmt, j++));
}
- TREE_VEC_LENGTH (labels) = new_size;
+
+ gcc_assert (new_size <= old_size);
+ gimple_switch_set_num_labels (stmt, new_size);
}
}
}
@@ -1157,11 +1168,11 @@ group_case_labels (void)
/* Checks whether we can merge block B into block A. */
static bool
-tree_can_merge_blocks_p (basic_block a, basic_block b)
+gimple_can_merge_blocks_p (basic_block a, basic_block b)
{
- const_tree stmt;
- block_stmt_iterator bsi;
- tree phi;
+ gimple stmt;
+ gimple_stmt_iterator gsi;
+ gimple_seq phis;
if (!single_succ_p (a))
return false;
@@ -1180,40 +1191,46 @@ tree_can_merge_blocks_p (basic_block a, basic_block b)
/* If A ends by a statement causing exceptions or something similar, we
cannot merge the blocks. */
- /* This CONST_CAST is okay because last_stmt doesn't modify its
- argument and the return value is assign to a const_tree. */
- stmt = last_stmt (CONST_CAST_BB (a));
+ stmt = last_stmt (a);
if (stmt && stmt_ends_bb_p (stmt))
return false;
/* Do not allow a block with only a non-local label to be merged. */
- if (stmt && TREE_CODE (stmt) == LABEL_EXPR
- && DECL_NONLOCAL (LABEL_EXPR_LABEL (stmt)))
+ if (stmt
+ && gimple_code (stmt) == GIMPLE_LABEL
+ && DECL_NONLOCAL (gimple_label_label (stmt)))
return false;
/* It must be possible to eliminate all phi nodes in B. If ssa form
is not up-to-date, we cannot eliminate any phis; however, if only
some symbols as whole are marked for renaming, this is not a problem,
as phi nodes for those symbols are irrelevant in updating anyway. */
- phi = phi_nodes (b);
- if (phi)
+ phis = phi_nodes (b);
+ if (!gimple_seq_empty_p (phis))
{
+ gimple_stmt_iterator i;
+
if (name_mappings_registered_p ())
return false;
- for (; phi; phi = PHI_CHAIN (phi))
- if (!is_gimple_reg (PHI_RESULT (phi))
- && !may_propagate_copy (PHI_RESULT (phi), PHI_ARG_DEF (phi, 0)))
- return false;
+ for (i = gsi_start (phis); !gsi_end_p (i); gsi_next (&i))
+ {
+ gimple phi = gsi_stmt (i);
+
+ if (!is_gimple_reg (gimple_phi_result (phi))
+ && !may_propagate_copy (gimple_phi_result (phi),
+ gimple_phi_arg_def (phi, 0)))
+ return false;
+ }
}
/* Do not remove user labels. */
- for (bsi = bsi_start (b); !bsi_end_p (bsi); bsi_next (&bsi))
+ for (gsi = gsi_start_bb (b); !gsi_end_p (gsi); gsi_next (&gsi))
{
- stmt = bsi_stmt (bsi);
- if (TREE_CODE (stmt) != LABEL_EXPR)
+ stmt = gsi_stmt (gsi);
+ if (gimple_code (stmt) != GIMPLE_LABEL)
break;
- if (!DECL_ARTIFICIAL (LABEL_EXPR_LABEL (stmt)))
+ if (!DECL_ARTIFICIAL (gimple_label_label (stmt)))
return false;
}
@@ -1232,21 +1249,21 @@ replace_uses_by (tree name, tree val)
{
imm_use_iterator imm_iter;
use_operand_p use;
- tree stmt;
+ gimple stmt;
edge e;
FOR_EACH_IMM_USE_STMT (stmt, imm_iter, name)
{
- if (TREE_CODE (stmt) != PHI_NODE)
+ if (gimple_code (stmt) != GIMPLE_PHI)
push_stmt_changes (&stmt);
FOR_EACH_IMM_USE_ON_STMT (use, imm_iter)
{
replace_exp (use, val);
- if (TREE_CODE (stmt) == PHI_NODE)
+ if (gimple_code (stmt) == GIMPLE_PHI)
{
- e = PHI_ARG_EDGE (stmt, PHI_ARG_INDEX_FROM_USE (use));
+ e = gimple_phi_arg_edge (stmt, PHI_ARG_INDEX_FROM_USE (use));
if (e->flags & EDGE_ABNORMAL)
{
/* This can only occur for virtual operands, since
@@ -1258,18 +1275,24 @@ replace_uses_by (tree name, tree val)
}
}
- if (TREE_CODE (stmt) != PHI_NODE)
+ if (gimple_code (stmt) != GIMPLE_PHI)
{
- tree rhs;
+ size_t i;
fold_stmt_inplace (stmt);
if (cfgcleanup_altered_bbs)
- bitmap_set_bit (cfgcleanup_altered_bbs, bb_for_stmt (stmt)->index);
+ bitmap_set_bit (cfgcleanup_altered_bbs, gimple_bb (stmt)->index);
/* FIXME. This should go in pop_stmt_changes. */
- rhs = get_rhs (stmt);
- if (TREE_CODE (rhs) == ADDR_EXPR)
- recompute_tree_invariant_for_addr_expr (rhs);
+ for (i = 0; i < gimple_num_ops (stmt); i++)
+ {
+ tree op = gimple_op (stmt, i);
+ /* Operands may be empty here. For example, the labels
+ of a GIMPLE_COND are nulled out following the creation
+ of the corresponding CFG edges. */
+ if (op && TREE_CODE (op) == ADDR_EXPR)
+ recompute_tree_invariant_for_addr_expr (op);
+ }
maybe_clean_or_replace_eh_stmt (stmt, stmt);
@@ -1295,23 +1318,24 @@ replace_uses_by (tree name, tree val)
/* Merge block B into block A. */
static void
-tree_merge_blocks (basic_block a, basic_block b)
+gimple_merge_blocks (basic_block a, basic_block b)
{
- block_stmt_iterator bsi;
- tree_stmt_iterator last;
- tree phi;
+ gimple_stmt_iterator last, gsi, psi;
+ gimple_seq phis = phi_nodes (b);
if (dump_file)
fprintf (dump_file, "Merging blocks %d and %d\n", a->index, b->index);
/* Remove all single-valued PHI nodes from block B of the form
V_i = PHI <V_j> by propagating V_j to all the uses of V_i. */
- bsi = bsi_last (a);
- for (phi = phi_nodes (b); phi; phi = phi_nodes (b))
+ gsi = gsi_last_bb (a);
+ for (psi = gsi_start (phis); !gsi_end_p (psi); )
{
- tree def = PHI_RESULT (phi), use = PHI_ARG_DEF (phi, 0);
- tree copy;
- bool may_replace_uses = may_propagate_copy (def, use);
+ gimple phi = gsi_stmt (psi);
+ tree def = gimple_phi_result (phi), use = gimple_phi_arg_def (phi, 0);
+ gimple copy;
+ bool may_replace_uses = !is_gimple_reg (def)
+ || may_propagate_copy (def, use);
/* In case we maintain loop closed ssa form, do not propagate arguments
of loop exit phi nodes. */
@@ -1330,10 +1354,9 @@ tree_merge_blocks (basic_block a, basic_block b)
with ordering of phi nodes. This is because A is the single
predecessor of B, therefore results of the phi nodes cannot
appear as arguments of the phi nodes. */
- copy = build_gimple_modify_stmt (def, use);
- bsi_insert_after (&bsi, copy, BSI_NEW_STMT);
- SSA_NAME_DEF_STMT (def) = copy;
- remove_phi_node (phi, NULL, false);
+ copy = gimple_build_assign (def, use);
+ gsi_insert_after (&gsi, copy, GSI_NEW_STMT);
+ remove_phi_node (&psi, false);
}
else
{
@@ -1344,7 +1367,7 @@ tree_merge_blocks (basic_block a, basic_block b)
{
imm_use_iterator iter;
use_operand_p use_p;
- tree stmt;
+ gimple stmt;
FOR_EACH_IMM_USE_STMT (stmt, iter, def)
FOR_EACH_IMM_USE_ON_STMT (use_p, iter)
@@ -1352,7 +1375,8 @@ tree_merge_blocks (basic_block a, basic_block b)
}
else
replace_uses_by (def, use);
- remove_phi_node (phi, NULL, true);
+
+ remove_phi_node (&psi, true);
}
}
@@ -1362,37 +1386,38 @@ tree_merge_blocks (basic_block a, basic_block b)
gcc_assert (single_succ_edge (a)->flags & EDGE_FALLTHRU);
gcc_assert (!last_stmt (a) || !stmt_ends_bb_p (last_stmt (a)));
- /* Remove labels from B and set bb_for_stmt to A for other statements. */
- for (bsi = bsi_start (b); !bsi_end_p (bsi);)
+ /* Remove labels from B and set gimple_bb to A for other statements. */
+ for (gsi = gsi_start_bb (b); !gsi_end_p (gsi);)
{
- if (TREE_CODE (bsi_stmt (bsi)) == LABEL_EXPR)
+ if (gimple_code (gsi_stmt (gsi)) == GIMPLE_LABEL)
{
- tree label = bsi_stmt (bsi);
+ gimple label = gsi_stmt (gsi);
+
+ gsi_remove (&gsi, false);
- bsi_remove (&bsi, false);
/* Now that we can thread computed gotos, we might have
a situation where we have a forced label in block B
However, the label at the start of block B might still be
used in other ways (think about the runtime checking for
Fortran assigned gotos). So we can not just delete the
label. Instead we move the label to the start of block A. */
- if (FORCED_LABEL (LABEL_EXPR_LABEL (label)))
+ if (FORCED_LABEL (gimple_label_label (label)))
{
- block_stmt_iterator dest_bsi = bsi_start (a);
- bsi_insert_before (&dest_bsi, label, BSI_NEW_STMT);
+ gimple_stmt_iterator dest_gsi = gsi_start_bb (a);
+ gsi_insert_before (&dest_gsi, label, GSI_NEW_STMT);
}
}
else
{
- change_bb_for_stmt (bsi_stmt (bsi), a);
- bsi_next (&bsi);
+ gimple_set_bb (gsi_stmt (gsi), a);
+ gsi_next (&gsi);
}
}
- /* Merge the chains. */
- last = tsi_last (bb_stmt_list (a));
- tsi_link_after (&last, bb_stmt_list (b), TSI_NEW_STMT);
- set_bb_stmt_list (b, NULL_TREE);
+ /* Merge the sequences. */
+ last = gsi_last_bb (a);
+ gsi_insert_seq_after (&last, bb_seq (b), GSI_NEW_STMT);
+ set_bb_seq (b, NULL);
if (cfgcleanup_altered_bbs)
bitmap_set_bit (cfgcleanup_altered_bbs, a->index);
@@ -1432,6 +1457,8 @@ single_noncomplex_succ (basic_block bb)
* Some unnecessary BIND_EXPRs are removed
+ * GOTO_EXPRs immediately preceding destination are removed.
+
Clearly more work could be done. The trick is doing the analysis
and removal fast enough to be a net improvement in compile times.
@@ -1441,208 +1468,172 @@ single_noncomplex_succ (basic_block bb)
struct rus_data
{
- tree *last_goto;
bool repeat;
bool may_throw;
bool may_branch;
bool has_label;
+ bool last_was_goto;
+ gimple_stmt_iterator last_goto_gsi;
};
-static void remove_useless_stmts_1 (tree *, struct rus_data *);
+
+static void remove_useless_stmts_1 (gimple_stmt_iterator *gsi, struct rus_data *);
+
+/* Given a statement sequence, find the first executable statement with
+ location information, and warn that it is unreachable. When searching,
+ descend into containers in execution order. */
static bool
-remove_useless_stmts_warn_notreached (tree stmt)
+remove_useless_stmts_warn_notreached (gimple_seq stmts)
{
- if (EXPR_HAS_LOCATION (stmt))
- {
- location_t loc = EXPR_LOCATION (stmt);
- if (LOCATION_LINE (loc) > 0)
- {
- warning (OPT_Wunreachable_code, "%Hwill never be executed", &loc);
- return true;
- }
- }
+ gimple_stmt_iterator gsi;
- switch (TREE_CODE (stmt))
+ for (gsi = gsi_start (stmts); !gsi_end_p (gsi); gsi_next (&gsi))
{
- case STATEMENT_LIST:
- {
- tree_stmt_iterator i;
- for (i = tsi_start (stmt); !tsi_end_p (i); tsi_next (&i))
- if (remove_useless_stmts_warn_notreached (tsi_stmt (i)))
- return true;
- }
- break;
+ gimple stmt = gsi_stmt (gsi);
- case COND_EXPR:
- if (remove_useless_stmts_warn_notreached (COND_EXPR_COND (stmt)))
- return true;
- if (remove_useless_stmts_warn_notreached (COND_EXPR_THEN (stmt)))
- return true;
- if (remove_useless_stmts_warn_notreached (COND_EXPR_ELSE (stmt)))
- return true;
- break;
+ if (gimple_has_location (stmt))
+ {
+ location_t loc = gimple_location (stmt);
+ if (LOCATION_LINE (loc) > 0)
+ {
+ warning (OPT_Wunreachable_code, "%Hwill never be executed", &loc);
+ return true;
+ }
+ }
- case TRY_FINALLY_EXPR:
- case TRY_CATCH_EXPR:
- if (remove_useless_stmts_warn_notreached (TREE_OPERAND (stmt, 0)))
- return true;
- if (remove_useless_stmts_warn_notreached (TREE_OPERAND (stmt, 1)))
- return true;
- break;
+ switch (gimple_code (stmt))
+ {
+ /* Unfortunately, we need the CFG now to detect unreachable
+ branches in a conditional, so conditionals are not handled here. */
- case CATCH_EXPR:
- return remove_useless_stmts_warn_notreached (CATCH_BODY (stmt));
- case EH_FILTER_EXPR:
- return remove_useless_stmts_warn_notreached (EH_FILTER_FAILURE (stmt));
- case BIND_EXPR:
- return remove_useless_stmts_warn_notreached (BIND_EXPR_BLOCK (stmt));
+ case GIMPLE_TRY:
+ if (remove_useless_stmts_warn_notreached (gimple_try_eval (stmt)))
+ return true;
+ if (remove_useless_stmts_warn_notreached (gimple_try_cleanup (stmt)))
+ return true;
+ break;
- default:
- /* Not a live container. */
- break;
+ case GIMPLE_CATCH:
+ return remove_useless_stmts_warn_notreached (gimple_catch_handler (stmt));
+
+ case GIMPLE_EH_FILTER:
+ return remove_useless_stmts_warn_notreached (gimple_eh_filter_failure (stmt));
+
+ case GIMPLE_BIND:
+ return remove_useless_stmts_warn_notreached (gimple_bind_body (stmt));
+
+ default:
+ break;
+ }
}
return false;
}
+/* Helper for remove_useless_stmts_1. Handle GIMPLE_COND statements. */
+
static void
-remove_useless_stmts_cond (tree *stmt_p, struct rus_data *data)
+remove_useless_stmts_cond (gimple_stmt_iterator *gsi, struct rus_data *data)
{
- tree then_clause, else_clause, cond;
- bool save_has_label, then_has_label, else_has_label;
+ gimple stmt = gsi_stmt (*gsi);
- save_has_label = data->has_label;
- data->has_label = false;
- data->last_goto = NULL;
+ /* The folded result must still be a conditional statement. */
+ fold_stmt_inplace (stmt);
- remove_useless_stmts_1 (&COND_EXPR_THEN (*stmt_p), data);
-
- then_has_label = data->has_label;
- data->has_label = false;
- data->last_goto = NULL;
-
- remove_useless_stmts_1 (&COND_EXPR_ELSE (*stmt_p), data);
-
- else_has_label = data->has_label;
- data->has_label = save_has_label | then_has_label | else_has_label;
-
- then_clause = COND_EXPR_THEN (*stmt_p);
- else_clause = COND_EXPR_ELSE (*stmt_p);
- cond = fold (COND_EXPR_COND (*stmt_p));
+ data->may_branch = true;
- /* If neither arm does anything at all, we can remove the whole IF. */
- if (!TREE_SIDE_EFFECTS (then_clause) && !TREE_SIDE_EFFECTS (else_clause))
+ /* Replace trivial conditionals with gotos. */
+ if (gimple_cond_true_p (stmt))
{
- *stmt_p = build_empty_stmt ();
- data->repeat = true;
- }
+ /* Goto THEN label. */
+ tree then_label = gimple_cond_true_label (stmt);
- /* If there are no reachable statements in an arm, then we can
- zap the entire conditional. */
- else if (integer_nonzerop (cond) && !else_has_label)
- {
- if (warn_notreached)
- remove_useless_stmts_warn_notreached (else_clause);
- *stmt_p = then_clause;
+ gsi_replace (gsi, gimple_build_goto (then_label), false);
+ data->last_goto_gsi = *gsi;
+ data->last_was_goto = true;
data->repeat = true;
}
- else if (integer_zerop (cond) && !then_has_label)
+ else if (gimple_cond_false_p (stmt))
{
- if (warn_notreached)
- remove_useless_stmts_warn_notreached (then_clause);
- *stmt_p = else_clause;
+ /* Goto ELSE label. */
+ tree else_label = gimple_cond_false_label (stmt);
+
+ gsi_replace (gsi, gimple_build_goto (else_label), false);
+ data->last_goto_gsi = *gsi;
+ data->last_was_goto = true;
data->repeat = true;
}
-
- /* Check a couple of simple things on then/else with single stmts. */
else
{
- tree then_stmt = expr_only (then_clause);
- tree else_stmt = expr_only (else_clause);
+ tree then_label = gimple_cond_true_label (stmt);
+ tree else_label = gimple_cond_false_label (stmt);
- /* Notice branches to a common destination. */
- if (then_stmt && else_stmt
- && TREE_CODE (then_stmt) == GOTO_EXPR
- && TREE_CODE (else_stmt) == GOTO_EXPR
- && (GOTO_DESTINATION (then_stmt) == GOTO_DESTINATION (else_stmt)))
- {
- *stmt_p = then_stmt;
+ if (then_label == else_label)
+ {
+ /* Goto common destination. */
+ gsi_replace (gsi, gimple_build_goto (then_label), false);
+ data->last_goto_gsi = *gsi;
+ data->last_was_goto = true;
data->repeat = true;
}
-
- /* If the THEN/ELSE clause merely assigns a value to a variable or
- parameter which is already known to contain that value, then
- remove the useless THEN/ELSE clause. */
- else if (TREE_CODE (cond) == VAR_DECL || TREE_CODE (cond) == PARM_DECL)
- {
- if (else_stmt
- && TREE_CODE (else_stmt) == GIMPLE_MODIFY_STMT
- && GIMPLE_STMT_OPERAND (else_stmt, 0) == cond
- && integer_zerop (GIMPLE_STMT_OPERAND (else_stmt, 1)))
- COND_EXPR_ELSE (*stmt_p) = alloc_stmt_list ();
- }
- else if ((TREE_CODE (cond) == EQ_EXPR || TREE_CODE (cond) == NE_EXPR)
- && (TREE_CODE (TREE_OPERAND (cond, 0)) == VAR_DECL
- || TREE_CODE (TREE_OPERAND (cond, 0)) == PARM_DECL)
- && TREE_CONSTANT (TREE_OPERAND (cond, 1)))
- {
- tree stmt = (TREE_CODE (cond) == EQ_EXPR
- ? then_stmt : else_stmt);
- tree *location = (TREE_CODE (cond) == EQ_EXPR
- ? &COND_EXPR_THEN (*stmt_p)
- : &COND_EXPR_ELSE (*stmt_p));
-
- if (stmt
- && TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
- && GIMPLE_STMT_OPERAND (stmt, 0) == TREE_OPERAND (cond, 0)
- && GIMPLE_STMT_OPERAND (stmt, 1) == TREE_OPERAND (cond, 1))
- *location = alloc_stmt_list ();
- }
}
- /* Protect GOTOs in the arm of COND_EXPRs from being removed. They
- would be re-introduced during lowering. */
- data->last_goto = NULL;
+ gsi_next (gsi);
+
+ data->last_was_goto = false;
}
+/* Helper for remove_useless_stmts_1.
+ Handle the try-finally case for GIMPLE_TRY statements. */
static void
-remove_useless_stmts_tf (tree *stmt_p, struct rus_data *data)
+remove_useless_stmts_tf (gimple_stmt_iterator *gsi, struct rus_data *data)
{
bool save_may_branch, save_may_throw;
bool this_may_branch, this_may_throw;
+ gimple_seq eval_seq, cleanup_seq;
+ gimple_stmt_iterator eval_gsi, cleanup_gsi;
+
+ gimple stmt = gsi_stmt (*gsi);
+
/* Collect may_branch and may_throw information for the body only. */
save_may_branch = data->may_branch;
save_may_throw = data->may_throw;
data->may_branch = false;
data->may_throw = false;
- data->last_goto = NULL;
+ data->last_was_goto = false;
- remove_useless_stmts_1 (&TREE_OPERAND (*stmt_p, 0), data);
+ eval_seq = gimple_try_eval (stmt);
+ eval_gsi = gsi_start (eval_seq);
+ remove_useless_stmts_1 (&eval_gsi, data);
this_may_branch = data->may_branch;
this_may_throw = data->may_throw;
data->may_branch |= save_may_branch;
data->may_throw |= save_may_throw;
- data->last_goto = NULL;
+ data->last_was_goto = false;
- remove_useless_stmts_1 (&TREE_OPERAND (*stmt_p, 1), data);
+ cleanup_seq = gimple_try_cleanup (stmt);
+ cleanup_gsi = gsi_start (cleanup_seq);
+ remove_useless_stmts_1 (&cleanup_gsi, data);
/* If the body is empty, then we can emit the FINALLY block without
the enclosing TRY_FINALLY_EXPR. */
- if (!TREE_SIDE_EFFECTS (TREE_OPERAND (*stmt_p, 0)))
+ if (gimple_seq_empty_p (eval_seq))
{
- *stmt_p = TREE_OPERAND (*stmt_p, 1);
+ gsi_insert_seq_before (gsi, cleanup_seq, GSI_SAME_STMT);
+ gsi_remove (gsi, false);
data->repeat = true;
}
/* If the handler is empty, then we can emit the TRY block without
the enclosing TRY_FINALLY_EXPR. */
- else if (!TREE_SIDE_EFFECTS (TREE_OPERAND (*stmt_p, 1)))
+ else if (gimple_seq_empty_p (cleanup_seq))
{
- *stmt_p = TREE_OPERAND (*stmt_p, 0);
+ gsi_insert_seq_before (gsi, eval_seq, GSI_SAME_STMT);
+ gsi_remove (gsi, false);
data->repeat = true;
}
@@ -1650,37 +1641,51 @@ remove_useless_stmts_tf (tree *stmt_p, struct rus_data *data)
string the TRY and FINALLY blocks together. */
else if (!this_may_branch && !this_may_throw)
{
- tree stmt = *stmt_p;
- *stmt_p = TREE_OPERAND (stmt, 0);
- append_to_statement_list (TREE_OPERAND (stmt, 1), stmt_p);
+ gsi_insert_seq_before (gsi, eval_seq, GSI_SAME_STMT);
+ gsi_insert_seq_before (gsi, cleanup_seq, GSI_SAME_STMT);
+ gsi_remove (gsi, false);
data->repeat = true;
}
+ else
+ gsi_next (gsi);
}
+/* Helper for remove_useless_stmts_1.
+ Handle the try-catch case for GIMPLE_TRY statements. */
static void
-remove_useless_stmts_tc (tree *stmt_p, struct rus_data *data)
+remove_useless_stmts_tc (gimple_stmt_iterator *gsi, struct rus_data *data)
{
bool save_may_throw, this_may_throw;
- tree_stmt_iterator i;
- tree stmt;
+
+ gimple_seq eval_seq, cleanup_seq, handler_seq, failure_seq;
+ gimple_stmt_iterator eval_gsi, cleanup_gsi, handler_gsi, failure_gsi;
+
+ gimple stmt = gsi_stmt (*gsi);
/* Collect may_throw information for the body only. */
save_may_throw = data->may_throw;
data->may_throw = false;
- data->last_goto = NULL;
+ data->last_was_goto = false;
- remove_useless_stmts_1 (&TREE_OPERAND (*stmt_p, 0), data);
+ eval_seq = gimple_try_eval (stmt);
+ eval_gsi = gsi_start (eval_seq);
+ remove_useless_stmts_1 (&eval_gsi, data);
this_may_throw = data->may_throw;
data->may_throw = save_may_throw;
+ cleanup_seq = gimple_try_cleanup (stmt);
+
/* If the body cannot throw, then we can drop the entire TRY_CATCH_EXPR. */
if (!this_may_throw)
{
if (warn_notreached)
- remove_useless_stmts_warn_notreached (TREE_OPERAND (*stmt_p, 1));
- *stmt_p = TREE_OPERAND (*stmt_p, 0);
+ {
+ remove_useless_stmts_warn_notreached (cleanup_seq);
+ }
+ gsi_insert_seq_before (gsi, eval_seq, GSI_SAME_STMT);
+ gsi_remove (gsi, false);
data->repeat = true;
return;
}
@@ -1689,142 +1694,164 @@ remove_useless_stmts_tc (tree *stmt_p, struct rus_data *data)
no exceptions propagate past this point. */
this_may_throw = true;
- i = tsi_start (TREE_OPERAND (*stmt_p, 1));
- stmt = tsi_stmt (i);
- data->last_goto = NULL;
+ cleanup_gsi = gsi_start (cleanup_seq);
+ stmt = gsi_stmt (cleanup_gsi);
+ data->last_was_goto = false;
- switch (TREE_CODE (stmt))
+ switch (gimple_code (stmt))
{
- case CATCH_EXPR:
- for (; !tsi_end_p (i); tsi_next (&i))
- {
- stmt = tsi_stmt (i);
+ case GIMPLE_CATCH:
+ /* If the first element is a catch, they all must be. */
+ while (!gsi_end_p (cleanup_gsi))
+ {
+ stmt = gsi_stmt (cleanup_gsi);
/* If we catch all exceptions, then the body does not
propagate exceptions past this point. */
- if (CATCH_TYPES (stmt) == NULL)
+ if (gimple_catch_types (stmt) == NULL)
this_may_throw = false;
- data->last_goto = NULL;
- remove_useless_stmts_1 (&CATCH_BODY (stmt), data);
+ data->last_was_goto = false;
+ handler_seq = gimple_catch_handler (stmt);
+ handler_gsi = gsi_start (handler_seq);
+ remove_useless_stmts_1 (&handler_gsi, data);
+ gsi_next (&cleanup_gsi);
}
+ gsi_next (gsi);
break;
- case EH_FILTER_EXPR:
- if (EH_FILTER_MUST_NOT_THROW (stmt))
+ case GIMPLE_EH_FILTER:
+ /* If the first element is an eh_filter, it should stand alone. */
+ if (gimple_eh_filter_must_not_throw (stmt))
this_may_throw = false;
- else if (EH_FILTER_TYPES (stmt) == NULL)
+ else if (gimple_eh_filter_types (stmt) == NULL)
this_may_throw = false;
- remove_useless_stmts_1 (&EH_FILTER_FAILURE (stmt), data);
+ failure_seq = gimple_eh_filter_failure (stmt);
+ failure_gsi = gsi_start (failure_seq);
+ remove_useless_stmts_1 (&failure_gsi, data);
+ gsi_next (gsi);
break;
default:
- /* Otherwise this is a cleanup. */
- remove_useless_stmts_1 (&TREE_OPERAND (*stmt_p, 1), data);
+ /* Otherwise this is a list of cleanup statements. */
+ remove_useless_stmts_1 (&cleanup_gsi, data);
/* If the cleanup is empty, then we can emit the TRY block without
the enclosing TRY_CATCH_EXPR. */
- if (!TREE_SIDE_EFFECTS (TREE_OPERAND (*stmt_p, 1)))
+ if (gimple_seq_empty_p (cleanup_seq))
{
- *stmt_p = TREE_OPERAND (*stmt_p, 0);
+ gsi_insert_seq_before (gsi, eval_seq, GSI_SAME_STMT);
+ gsi_remove(gsi, false);
data->repeat = true;
}
+ else
+ gsi_next (gsi);
break;
}
+
data->may_throw |= this_may_throw;
}
+/* Helper for remove_useless_stmts_1. Handle GIMPLE_BIND statements. */
static void
-remove_useless_stmts_bind (tree *stmt_p, struct rus_data *data)
+remove_useless_stmts_bind (gimple_stmt_iterator *gsi, struct rus_data *data ATTRIBUTE_UNUSED)
{
tree block;
+ gimple_seq body_seq, fn_body_seq;
+ gimple_stmt_iterator body_gsi;
+
+ gimple stmt = gsi_stmt (*gsi);
/* First remove anything underneath the BIND_EXPR. */
- remove_useless_stmts_1 (&BIND_EXPR_BODY (*stmt_p), data);
+
+ body_seq = gimple_bind_body (stmt);
+ body_gsi = gsi_start (body_seq);
+ remove_useless_stmts_1 (&body_gsi, data);
- /* If the BIND_EXPR has no variables, then we can pull everything
- up one level and remove the BIND_EXPR, unless this is the toplevel
- BIND_EXPR for the current function or an inlined function.
+ /* If the GIMPLE_BIND has no variables, then we can pull everything
+ up one level and remove the GIMPLE_BIND, unless this is the toplevel
+ GIMPLE_BIND for the current function or an inlined function.
When this situation occurs we will want to apply this
optimization again. */
- block = BIND_EXPR_BLOCK (*stmt_p);
- if (BIND_EXPR_VARS (*stmt_p) == NULL_TREE
- && *stmt_p != DECL_SAVED_TREE (current_function_decl)
+ block = gimple_bind_block (stmt);
+ fn_body_seq = gimple_body (current_function_decl);
+ if (gimple_bind_vars (stmt) == NULL_TREE
+ && (gimple_seq_empty_p (fn_body_seq)
+ || stmt != gimple_seq_first_stmt (fn_body_seq))
&& (! block
|| ! BLOCK_ABSTRACT_ORIGIN (block)
|| (TREE_CODE (BLOCK_ABSTRACT_ORIGIN (block))
!= FUNCTION_DECL)))
{
- *stmt_p = BIND_EXPR_BODY (*stmt_p);
+ gsi_insert_seq_before (gsi, body_seq, GSI_SAME_STMT);
+ gsi_remove (gsi, false);
data->repeat = true;
}
+ else
+ gsi_next (gsi);
}
+/* Helper for remove_useless_stmts_1. Handle GIMPLE_GOTO statements. */
static void
-remove_useless_stmts_goto (tree *stmt_p, struct rus_data *data)
+remove_useless_stmts_goto (gimple_stmt_iterator *gsi, struct rus_data *data)
{
- tree dest = GOTO_DESTINATION (*stmt_p);
+ gimple stmt = gsi_stmt (*gsi);
+
+ tree dest = gimple_goto_dest (stmt);
data->may_branch = true;
- data->last_goto = NULL;
+ data->last_was_goto = false;
- /* Record the last goto expr, so that we can delete it if unnecessary. */
+ /* Record iterator for last goto expr, so that we can delete it if unnecessary. */
if (TREE_CODE (dest) == LABEL_DECL)
- data->last_goto = stmt_p;
+ {
+ data->last_goto_gsi = *gsi;
+ data->last_was_goto = true;
+ }
+
+ gsi_next(gsi);
}
+/* Helper for remove_useless_stmts_1. Handle GIMPLE_LABEL statements. */
static void
-remove_useless_stmts_label (tree *stmt_p, struct rus_data *data)
+remove_useless_stmts_label (gimple_stmt_iterator *gsi, struct rus_data *data)
{
- tree label = LABEL_EXPR_LABEL (*stmt_p);
+ gimple stmt = gsi_stmt (*gsi);
+
+ tree label = gimple_label_label (stmt);
data->has_label = true;
/* We do want to jump across non-local label receiver code. */
if (DECL_NONLOCAL (label))
- data->last_goto = NULL;
+ data->last_was_goto = false;
- else if (data->last_goto && GOTO_DESTINATION (*data->last_goto) == label)
+ else if (data->last_was_goto
+ && gimple_goto_dest (gsi_stmt (data->last_goto_gsi)) == label)
{
- *data->last_goto = build_empty_stmt ();
+ /* Replace the preceding GIMPLE_GOTO statement with
+ a GIMPLE_NOP, which will be subsequently removed.
+ In this way, we avoid invalidating other iterators
+ active on the statement sequence. */
+ gsi_replace(&data->last_goto_gsi, gimple_build_nop(), false);
+ data->last_was_goto = false;
data->repeat = true;
}
/* ??? Add something here to delete unused labels. */
-}
-
-
-/* If the function is "const" or "pure", then clear TREE_SIDE_EFFECTS on its
- decl. This allows us to eliminate redundant or useless
- calls to "const" functions.
-
- Gimplifier already does the same operation, but we may notice functions
- being const and pure once their calls has been gimplified, so we need
- to update the flag. */
-static void
-update_call_expr_flags (tree call)
-{
- tree decl = get_callee_fndecl (call);
- int flags;
- if (!decl)
- return;
- flags = call_expr_flags (call);
- if (flags & (ECF_CONST | ECF_PURE) && !(flags & ECF_LOOPING_CONST_OR_PURE))
- TREE_SIDE_EFFECTS (call) = 0;
- if (TREE_NOTHROW (decl))
- TREE_NOTHROW (call) = 1;
+ gsi_next (gsi);
}
/* T is CALL_EXPR. Set current_function_calls_* flags. */
void
-notice_special_calls (tree t)
+notice_special_calls (gimple call)
{
- int flags = call_expr_flags (t);
+ int flags = gimple_call_flags (call);
if (flags & ECF_MAY_BE_ALLOCA)
cfun->calls_alloca = true;
@@ -1843,133 +1870,144 @@ clear_special_calls (void)
cfun->calls_setjmp = false;
}
+/* Remove useless statements from a statement sequence, and perform
+ some preliminary simplifications. */
static void
-remove_useless_stmts_1 (tree *tp, struct rus_data *data)
+remove_useless_stmts_1 (gimple_stmt_iterator *gsi, struct rus_data *data)
{
- tree t = *tp, op;
-
- switch (TREE_CODE (t))
+ while (!gsi_end_p (*gsi))
{
- case COND_EXPR:
- remove_useless_stmts_cond (tp, data);
- break;
-
- case TRY_FINALLY_EXPR:
- remove_useless_stmts_tf (tp, data);
- break;
-
- case TRY_CATCH_EXPR:
- remove_useless_stmts_tc (tp, data);
- break;
-
- case BIND_EXPR:
- remove_useless_stmts_bind (tp, data);
- break;
-
- case GOTO_EXPR:
- remove_useless_stmts_goto (tp, data);
- break;
-
- case LABEL_EXPR:
- remove_useless_stmts_label (tp, data);
- break;
+ gimple stmt = gsi_stmt (*gsi);
- case RETURN_EXPR:
- fold_stmt (tp);
- data->last_goto = NULL;
- data->may_branch = true;
- break;
-
- case CALL_EXPR:
- fold_stmt (tp);
- data->last_goto = NULL;
- notice_special_calls (t);
- update_call_expr_flags (t);
- if (tree_could_throw_p (t))
- data->may_throw = true;
- break;
-
- case MODIFY_EXPR:
- gcc_unreachable ();
-
- case GIMPLE_MODIFY_STMT:
- data->last_goto = NULL;
- fold_stmt (tp);
- op = get_call_expr_in (t);
- if (op)
- {
- update_call_expr_flags (op);
- notice_special_calls (op);
- }
- if (tree_could_throw_p (t))
- data->may_throw = true;
- break;
-
- case STATEMENT_LIST:
- {
- tree_stmt_iterator i = tsi_start (t);
- while (!tsi_end_p (i))
- {
- t = tsi_stmt (i);
- if (IS_EMPTY_STMT (t))
- {
- tsi_delink (&i);
- continue;
- }
-
- remove_useless_stmts_1 (tsi_stmt_ptr (i), data);
-
- t = tsi_stmt (i);
- if (TREE_CODE (t) == STATEMENT_LIST)
- {
- tsi_link_before (&i, t, TSI_SAME_STMT);
- tsi_delink (&i);
- }
- else
- tsi_next (&i);
- }
- }
- break;
- case ASM_EXPR:
- fold_stmt (tp);
- data->last_goto = NULL;
- break;
-
- case OMP_PARALLEL:
- case OMP_TASK:
- /* Make sure the outermost BIND_EXPR in OMP_BODY isn't removed
- as useless. */
- remove_useless_stmts_1 (&BIND_EXPR_BODY (OMP_TASKREG_BODY (*tp)), data);
- data->last_goto = NULL;
- break;
-
- case OMP_SECTIONS:
- case OMP_SINGLE:
- case OMP_SECTION:
- case OMP_MASTER:
- case OMP_ORDERED:
- case OMP_CRITICAL:
- remove_useless_stmts_1 (&OMP_BODY (*tp), data);
- data->last_goto = NULL;
- break;
-
- case OMP_FOR:
- remove_useless_stmts_1 (&OMP_FOR_BODY (*tp), data);
- data->last_goto = NULL;
- if (OMP_FOR_PRE_BODY (*tp))
- {
- remove_useless_stmts_1 (&OMP_FOR_PRE_BODY (*tp), data);
- data->last_goto = NULL;
- }
- break;
-
- default:
- data->last_goto = NULL;
- break;
+ switch (gimple_code (stmt))
+ {
+ case GIMPLE_COND:
+ remove_useless_stmts_cond (gsi, data);
+ break;
+
+ case GIMPLE_GOTO:
+ remove_useless_stmts_goto (gsi, data);
+ break;
+
+ case GIMPLE_LABEL:
+ remove_useless_stmts_label (gsi, data);
+ break;
+
+ case GIMPLE_ASSIGN:
+ fold_stmt (gsi);
+ stmt = gsi_stmt (*gsi);
+ data->last_was_goto = false;
+ if (stmt_could_throw_p (stmt))
+ data->may_throw = true;
+ gsi_next (gsi);
+ break;
+
+ case GIMPLE_ASM:
+ fold_stmt (gsi);
+ data->last_was_goto = false;
+ gsi_next (gsi);
+ break;
+
+ case GIMPLE_CALL:
+ fold_stmt (gsi);
+ stmt = gsi_stmt (*gsi);
+ data->last_was_goto = false;
+ if (is_gimple_call (stmt))
+ notice_special_calls (stmt);
+
+ /* We used to call update_gimple_call_flags here,
+ which copied side-effects and nothrows status
+ from the function decl to the call. In the new
+ tuplified GIMPLE, the accessors for this information
+ always consult the function decl, so this copying
+ is no longer necessary. */
+ if (stmt_could_throw_p (stmt))
+ data->may_throw = true;
+ gsi_next (gsi);
+ break;
+
+ case GIMPLE_RETURN:
+ fold_stmt (gsi);
+ data->last_was_goto = false;
+ data->may_branch = true;
+ gsi_next (gsi);
+ break;
+
+ case GIMPLE_BIND:
+ remove_useless_stmts_bind (gsi, data);
+ break;
+
+ case GIMPLE_TRY:
+ if (gimple_try_kind (stmt) == GIMPLE_TRY_CATCH)
+ remove_useless_stmts_tc (gsi, data);
+ else if (gimple_try_kind (stmt) == GIMPLE_TRY_FINALLY)
+ remove_useless_stmts_tf (gsi, data);
+ else
+ gcc_unreachable ();
+ break;
+
+ case GIMPLE_CATCH:
+ gcc_unreachable ();
+ break;
+
+ case GIMPLE_NOP:
+ gsi_remove (gsi, false);
+ break;
+
+ case GIMPLE_OMP_FOR:
+ {
+ gimple_seq pre_body_seq = gimple_omp_for_pre_body (stmt);
+ gimple_stmt_iterator pre_body_gsi = gsi_start (pre_body_seq);
+
+ remove_useless_stmts_1 (&pre_body_gsi, data);
+ data->last_was_goto = false;
+ }
+ /* FALLTHROUGH */
+ case GIMPLE_OMP_CRITICAL:
+ case GIMPLE_OMP_CONTINUE:
+ case GIMPLE_OMP_MASTER:
+ case GIMPLE_OMP_ORDERED:
+ case GIMPLE_OMP_SECTION:
+ case GIMPLE_OMP_SECTIONS:
+ case GIMPLE_OMP_SINGLE:
+ {
+ gimple_seq body_seq = gimple_omp_body (stmt);
+ gimple_stmt_iterator body_gsi = gsi_start (body_seq);
+
+ remove_useless_stmts_1 (&body_gsi, data);
+ data->last_was_goto = false;
+ gsi_next (gsi);
+ }
+ break;
+
+ case GIMPLE_OMP_PARALLEL:
+ case GIMPLE_OMP_TASK:
+ {
+ /* Make sure the outermost GIMPLE_BIND isn't removed
+ as useless. */
+ gimple_seq body_seq = gimple_omp_body (stmt);
+ gimple bind = gimple_seq_first_stmt (body_seq);
+ gimple_seq bind_seq = gimple_bind_body (bind);
+ gimple_stmt_iterator bind_gsi = gsi_start (bind_seq);
+
+ remove_useless_stmts_1 (&bind_gsi, data);
+ data->last_was_goto = false;
+ gsi_next (gsi);
+ }
+ break;
+
+ default:
+ data->last_was_goto = false;
+ gsi_next (gsi);
+ break;
+ }
}
}
+/* Walk the function tree, removing useless statements and performing
+ some preliminary simplifications. */
+
static unsigned int
remove_useless_stmts (void)
{
@@ -1979,8 +2017,11 @@ remove_useless_stmts (void)
do
{
+ gimple_stmt_iterator gsi;
+
+ gsi = gsi_start (gimple_body (current_function_decl));
memset (&data, 0, sizeof (data));
- remove_useless_stmts_1 (&DECL_SAVED_TREE (current_function_decl), &data);
+ remove_useless_stmts_1 (&gsi, &data);
}
while (data.repeat);
return 0;
@@ -2011,17 +2052,14 @@ struct gimple_opt_pass pass_remove_useless_stmts =
static void
remove_phi_nodes_and_edges_for_unreachable_block (basic_block bb)
{
- tree phi;
+ gimple_stmt_iterator gsi;
/* Since this block is no longer reachable, we can just delete all
of its PHI nodes. */
- phi = phi_nodes (bb);
- while (phi)
- {
- tree next = PHI_CHAIN (phi);
- remove_phi_node (phi, NULL_TREE, true);
- phi = next;
- }
+ for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); )
+ remove_phi_node (&gsi, true);
+
+ set_phi_nodes (bb, NULL);
/* Remove edges to BB's successors. */
while (EDGE_COUNT (bb->succs) > 0)
@@ -2034,7 +2072,7 @@ remove_phi_nodes_and_edges_for_unreachable_block (basic_block bb)
static void
remove_bb (basic_block bb)
{
- block_stmt_iterator i;
+ gimple_stmt_iterator i;
source_location loc = UNKNOWN_LOCATION;
if (dump_file)
@@ -2059,31 +2097,31 @@ remove_bb (basic_block bb)
}
/* Remove all the instructions in the block. */
- if (bb_stmt_list (bb) != NULL_TREE)
+ if (bb_seq (bb) != NULL)
{
- for (i = bsi_start (bb); !bsi_end_p (i);)
+ for (i = gsi_start_bb (bb); !gsi_end_p (i);)
{
- tree stmt = bsi_stmt (i);
- if (TREE_CODE (stmt) == LABEL_EXPR
- && (FORCED_LABEL (LABEL_EXPR_LABEL (stmt))
- || DECL_NONLOCAL (LABEL_EXPR_LABEL (stmt))))
+ gimple stmt = gsi_stmt (i);
+ if (gimple_code (stmt) == GIMPLE_LABEL
+ && (FORCED_LABEL (gimple_label_label (stmt))
+ || DECL_NONLOCAL (gimple_label_label (stmt))))
{
basic_block new_bb;
- block_stmt_iterator new_bsi;
+ gimple_stmt_iterator new_gsi;
/* A non-reachable non-local label may still be referenced.
But it no longer needs to carry the extra semantics of
non-locality. */
- if (DECL_NONLOCAL (LABEL_EXPR_LABEL (stmt)))
+ if (DECL_NONLOCAL (gimple_label_label (stmt)))
{
- DECL_NONLOCAL (LABEL_EXPR_LABEL (stmt)) = 0;
- FORCED_LABEL (LABEL_EXPR_LABEL (stmt)) = 1;
+ DECL_NONLOCAL (gimple_label_label (stmt)) = 0;
+ FORCED_LABEL (gimple_label_label (stmt)) = 1;
}
new_bb = bb->prev_bb;
- new_bsi = bsi_start (new_bb);
- bsi_remove (&i, false);
- bsi_insert_before (&new_bsi, stmt, BSI_NEW_STMT);
+ new_gsi = gsi_start_bb (new_bb);
+ gsi_remove (&i, false);
+ gsi_insert_before (&new_gsi, stmt, GSI_NEW_STMT);
}
else
{
@@ -2094,18 +2132,17 @@ remove_bb (basic_block bb)
if (gimple_in_ssa_p (cfun))
release_defs (stmt);
- bsi_remove (&i, true);
+ gsi_remove (&i, true);
}
/* Don't warn for removed gotos. Gotos are often removed due to
jump threading, thus resulting in bogus warnings. Not great,
since this way we lose warnings for gotos in the original
program that are indeed unreachable. */
- if (TREE_CODE (stmt) != GOTO_EXPR && EXPR_HAS_LOCATION (stmt) && !loc)
- {
- if (EXPR_HAS_LOCATION (stmt))
- loc = EXPR_LOCATION (stmt);
- }
+ if (gimple_code (stmt) != GIMPLE_GOTO
+ && gimple_has_location (stmt)
+ && !loc)
+ loc = gimple_location (stmt);
}
}
@@ -2117,7 +2154,7 @@ remove_bb (basic_block bb)
warning (OPT_Wunreachable_code, "%Hwill never be executed", &loc);
remove_phi_nodes_and_edges_for_unreachable_block (bb);
- bb->il.tree = NULL;
+ bb->il.gimple = NULL;
}
@@ -2128,21 +2165,23 @@ remove_bb (basic_block bb)
edge
find_taken_edge (basic_block bb, tree val)
{
- tree stmt;
+ gimple stmt;
stmt = last_stmt (bb);
gcc_assert (stmt);
gcc_assert (is_ctrl_stmt (stmt));
- gcc_assert (val);
- if (! is_gimple_min_invariant (val))
+ if (val == NULL)
+ return NULL;
+
+ if (!is_gimple_min_invariant (val))
return NULL;
- if (TREE_CODE (stmt) == COND_EXPR)
+ if (gimple_code (stmt) == GIMPLE_COND)
return find_taken_edge_cond_expr (bb, val);
- if (TREE_CODE (stmt) == SWITCH_EXPR)
+ if (gimple_code (stmt) == GIMPLE_SWITCH)
return find_taken_edge_switch_expr (bb, val);
if (computed_goto_p (stmt))
@@ -2204,12 +2243,13 @@ find_taken_edge_cond_expr (basic_block bb, tree val)
static edge
find_taken_edge_switch_expr (basic_block bb, tree val)
{
- tree switch_expr, taken_case;
basic_block dest_bb;
edge e;
+ gimple switch_stmt;
+ tree taken_case;
- switch_expr = last_stmt (bb);
- taken_case = find_case_label_for_value (switch_expr, val);
+ switch_stmt = last_stmt (bb);
+ taken_case = find_case_label_for_value (switch_stmt, val);
dest_bb = label_to_block (CASE_LABEL (taken_case));
e = find_edge (bb, dest_bb);
@@ -2218,21 +2258,20 @@ find_taken_edge_switch_expr (basic_block bb, tree val)
}
-/* Return the CASE_LABEL_EXPR that SWITCH_EXPR will take for VAL.
+/* Return the CASE_LABEL_EXPR that SWITCH_STMT will take for VAL.
We can make optimal use here of the fact that the case labels are
sorted: We can do a binary search for a case matching VAL. */
static tree
-find_case_label_for_value (tree switch_expr, tree val)
+find_case_label_for_value (gimple switch_stmt, tree val)
{
- tree vec = SWITCH_LABELS (switch_expr);
- size_t low, high, n = TREE_VEC_LENGTH (vec);
- tree default_case = TREE_VEC_ELT (vec, n - 1);
+ size_t low, high, n = gimple_switch_num_labels (switch_stmt);
+ tree default_case = gimple_switch_default_label (switch_stmt);
- for (low = -1, high = n - 1; high - low > 1; )
+ for (low = 0, high = n; high - low > 1; )
{
size_t i = (high + low) / 2;
- tree t = TREE_VEC_ELT (vec, i);
+ tree t = gimple_switch_label (switch_stmt, i);
int cmp;
/* Cache the result of comparing CASE_LOW and val. */
@@ -2261,36 +2300,21 @@ find_case_label_for_value (tree switch_expr, tree val)
}
-
-
-/*---------------------------------------------------------------------------
- Debugging functions
----------------------------------------------------------------------------*/
-
-/* Dump tree-specific information of block BB to file OUTF. */
-
-void
-tree_dump_bb (basic_block bb, FILE *outf, int indent)
-{
- dump_generic_bb (outf, bb, indent, TDF_VOPS|TDF_MEMSYMS);
-}
-
-
/* Dump a basic block on stderr. */
void
-debug_tree_bb (basic_block bb)
+gimple_debug_bb (basic_block bb)
{
- dump_bb (bb, stderr, 0);
+ gimple_dump_bb (bb, stderr, 0, TDF_VOPS|TDF_MEMSYMS);
}
/* Dump basic block with index N on stderr. */
basic_block
-debug_tree_bb_n (int n)
+gimple_debug_bb_n (int n)
{
- debug_tree_bb (BASIC_BLOCK (n));
+ gimple_debug_bb (BASIC_BLOCK (n));
return BASIC_BLOCK (n);
}
@@ -2301,9 +2325,9 @@ debug_tree_bb_n (int n)
(see TDF_* in tree-pass.h). */
void
-debug_tree_cfg (int flags)
+gimple_debug_cfg (int flags)
{
- dump_tree_cfg (stderr, flags);
+ gimple_dump_cfg (stderr, flags);
}
@@ -2313,7 +2337,7 @@ debug_tree_cfg (int flags)
tree.h). */
void
-dump_tree_cfg (FILE *file, int flags)
+gimple_dump_cfg (FILE *file, int flags)
{
if (flags & TDF_DETAILS)
{
@@ -2401,7 +2425,7 @@ debug_cfg_stats (void)
/* Dump the flowgraph to a .vcg FILE. */
static void
-tree_cfg2vcg (FILE *file)
+gimple_cfg2vcg (FILE *file)
{
edge e;
edge_iterator ei;
@@ -2431,17 +2455,17 @@ tree_cfg2vcg (FILE *file)
FOR_EACH_BB (bb)
{
- enum tree_code head_code, end_code;
+ enum gimple_code head_code, end_code;
const char *head_name, *end_name;
int head_line = 0;
int end_line = 0;
- tree first = first_stmt (bb);
- tree last = last_stmt (bb);
+ gimple first = first_stmt (bb);
+ gimple last = last_stmt (bb);
if (first)
{
- head_code = TREE_CODE (first);
- head_name = tree_code_name[head_code];
+ head_code = gimple_code (first);
+ head_name = gimple_code_name[head_code];
head_line = get_lineno (first);
}
else
@@ -2449,8 +2473,8 @@ tree_cfg2vcg (FILE *file)
if (last)
{
- end_code = TREE_CODE (last);
- end_name = tree_code_name[end_code];
+ end_code = gimple_code (last);
+ end_name = gimple_code_name[end_code];
end_line = get_lineno (last);
}
else
@@ -2491,13 +2515,13 @@ tree_cfg2vcg (FILE *file)
/* Return true if T represents a stmt that always transfers control. */
bool
-is_ctrl_stmt (const_tree t)
+is_ctrl_stmt (gimple t)
{
- return (TREE_CODE (t) == COND_EXPR
- || TREE_CODE (t) == SWITCH_EXPR
- || TREE_CODE (t) == GOTO_EXPR
- || TREE_CODE (t) == RETURN_EXPR
- || TREE_CODE (t) == RESX_EXPR);
+ return gimple_code (t) == GIMPLE_COND
+ || gimple_code (t) == GIMPLE_SWITCH
+ || gimple_code (t) == GIMPLE_GOTO
+ || gimple_code (t) == GIMPLE_RETURN
+ || gimple_code (t) == GIMPLE_RESX;
}
@@ -2505,50 +2529,41 @@ is_ctrl_stmt (const_tree t)
(e.g., a call to a non-returning function). */
bool
-is_ctrl_altering_stmt (const_tree t)
+is_ctrl_altering_stmt (gimple t)
{
- const_tree call;
-
gcc_assert (t);
- call = get_call_expr_in (CONST_CAST_TREE (t));
- if (call)
+
+ if (is_gimple_call (t))
{
- /* A non-pure/const CALL_EXPR alters flow control if the current
+ int flags = gimple_call_flags (t);
+
+ /* A non-pure/const call alters flow control if the current
function has nonlocal labels. */
- if (TREE_SIDE_EFFECTS (call) && cfun->has_nonlocal_label)
+ if (!(flags & (ECF_CONST | ECF_PURE))
+ && cfun->has_nonlocal_label)
return true;
- /* A CALL_EXPR also alters control flow if it does not return. */
- if (call_expr_flags (call) & ECF_NORETURN)
+ /* A call also alters control flow if it does not return. */
+ if (gimple_call_flags (t) & ECF_NORETURN)
return true;
}
/* OpenMP directives alter control flow. */
- if (OMP_DIRECTIVE_P (t))
+ if (is_gimple_omp (t))
return true;
/* If a statement can throw, it alters control flow. */
- return tree_can_throw_internal (t);
-}
-
-
-/* Return true if T is a computed goto. */
-
-static bool
-computed_goto_p (const_tree t)
-{
- return (TREE_CODE (t) == GOTO_EXPR
- && TREE_CODE (GOTO_DESTINATION (t)) != LABEL_DECL);
+ return stmt_can_throw_internal (t);
}
/* Return true if T is a simple local goto. */
bool
-simple_goto_p (const_tree t)
+simple_goto_p (gimple t)
{
- return (TREE_CODE (t) == GOTO_EXPR
- && TREE_CODE (GOTO_DESTINATION (t)) == LABEL_DECL);
+ return (gimple_code (t) == GIMPLE_GOTO
+ && TREE_CODE (gimple_goto_dest (t)) == LABEL_DECL);
}
@@ -2556,46 +2571,42 @@ simple_goto_p (const_tree t)
Transfers of control flow associated with EH are excluded. */
bool
-tree_can_make_abnormal_goto (const_tree t)
+stmt_can_make_abnormal_goto (gimple t)
{
if (computed_goto_p (t))
return true;
- if (TREE_CODE (t) == GIMPLE_MODIFY_STMT)
- t = GIMPLE_STMT_OPERAND (t, 1);
- if (TREE_CODE (t) == WITH_SIZE_EXPR)
- t = TREE_OPERAND (t, 0);
- if (TREE_CODE (t) == CALL_EXPR)
- return TREE_SIDE_EFFECTS (t) && cfun->has_nonlocal_label;
+ if (is_gimple_call (t))
+ return gimple_has_side_effects (t) && cfun->has_nonlocal_label;
return false;
}
-/* Return true if T should start a new basic block. PREV_T is the
- statement preceding T. It is used when T is a label or a case label.
- Labels should only start a new basic block if their previous statement
- wasn't a label. Otherwise, sequence of labels would generate
- unnecessary basic blocks that only contain a single label. */
+/* Return true if STMT should start a new basic block. PREV_STMT is
+ the statement preceding STMT. It is used when STMT is a label or a
+ case label. Labels should only start a new basic block if their
+ previous statement wasn't a label. Otherwise, sequence of labels
+ would generate unnecessary basic blocks that only contain a single
+ label. */
static inline bool
-stmt_starts_bb_p (const_tree t, const_tree prev_t)
+stmt_starts_bb_p (gimple stmt, gimple prev_stmt)
{
- if (t == NULL_TREE)
+ if (stmt == NULL)
return false;
- /* LABEL_EXPRs start a new basic block only if the preceding
- statement wasn't a label of the same type. This prevents the
- creation of consecutive blocks that have nothing but a single
- label. */
- if (TREE_CODE (t) == LABEL_EXPR)
+ /* Labels start a new basic block only if the preceding statement
+ wasn't a label of the same type. This prevents the creation of
+ consecutive blocks that have nothing but a single label. */
+ if (gimple_code (stmt) == GIMPLE_LABEL)
{
/* Nonlocal and computed GOTO targets always start a new block. */
- if (DECL_NONLOCAL (LABEL_EXPR_LABEL (t))
- || FORCED_LABEL (LABEL_EXPR_LABEL (t)))
+ if (DECL_NONLOCAL (gimple_label_label (stmt))
+ || FORCED_LABEL (gimple_label_label (stmt)))
return true;
- if (prev_t && TREE_CODE (prev_t) == LABEL_EXPR)
+ if (prev_stmt && gimple_code (prev_stmt) == GIMPLE_LABEL)
{
- if (DECL_NONLOCAL (LABEL_EXPR_LABEL (prev_t)))
+ if (DECL_NONLOCAL (gimple_label_label (prev_stmt)))
return true;
cfg_stats.num_merged_labels++;
@@ -2612,502 +2623,97 @@ stmt_starts_bb_p (const_tree t, const_tree prev_t)
/* Return true if T should end a basic block. */
bool
-stmt_ends_bb_p (const_tree t)
+stmt_ends_bb_p (gimple t)
{
return is_ctrl_stmt (t) || is_ctrl_altering_stmt (t);
}
-/* Remove block annotations and other datastructures. */
+/* Remove block annotations and other data structures. */
void
delete_tree_cfg_annotations (void)
{
- basic_block bb;
- block_stmt_iterator bsi;
-
- /* Remove annotations from every tree in the function. */
- FOR_EACH_BB (bb)
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
- {
- tree stmt = bsi_stmt (bsi);
- ggc_free (stmt->base.ann);
- stmt->base.ann = NULL;
- }
label_to_block_map = NULL;
}
/* Return the first statement in basic block BB. */
-tree
+gimple
first_stmt (basic_block bb)
{
- block_stmt_iterator i = bsi_start (bb);
- return !bsi_end_p (i) ? bsi_stmt (i) : NULL_TREE;
+ gimple_stmt_iterator i = gsi_start_bb (bb);
+ return !gsi_end_p (i) ? gsi_stmt (i) : NULL;
}
/* Return the last statement in basic block BB. */
-tree
+gimple
last_stmt (basic_block bb)
{
- block_stmt_iterator b = bsi_last (bb);
- return !bsi_end_p (b) ? bsi_stmt (b) : NULL_TREE;
+ gimple_stmt_iterator b = gsi_last_bb (bb);
+ return !gsi_end_p (b) ? gsi_stmt (b) : NULL;
}
/* Return the last statement of an otherwise empty block. Return NULL
if the block is totally empty, or if it contains more than one
statement. */
-tree
+gimple
last_and_only_stmt (basic_block bb)
{
- block_stmt_iterator i = bsi_last (bb);
- tree last, prev;
+ gimple_stmt_iterator i = gsi_last_bb (bb);
+ gimple last, prev;
- if (bsi_end_p (i))
- return NULL_TREE;
+ if (gsi_end_p (i))
+ return NULL;
- last = bsi_stmt (i);
- bsi_prev (&i);
- if (bsi_end_p (i))
+ last = gsi_stmt (i);
+ gsi_prev (&i);
+ if (gsi_end_p (i))
return last;
/* Empty statements should no longer appear in the instruction stream.
Everything that might have appeared before should be deleted by
- remove_useless_stmts, and the optimizers should just bsi_remove
+ remove_useless_stmts, and the optimizers should just gsi_remove
instead of smashing with build_empty_stmt.
Thus the only thing that should appear here in a block containing
one executable statement is a label. */
- prev = bsi_stmt (i);
- if (TREE_CODE (prev) == LABEL_EXPR)
+ prev = gsi_stmt (i);
+ if (gimple_code (prev) == GIMPLE_LABEL)
return last;
else
- return NULL_TREE;
-}
-
-
-/* Mark BB as the basic block holding statement T. */
-
-void
-set_bb_for_stmt (tree t, basic_block bb)
-{
- if (TREE_CODE (t) == PHI_NODE)
- PHI_BB (t) = bb;
- else if (TREE_CODE (t) == STATEMENT_LIST)
- {
- tree_stmt_iterator i;
- for (i = tsi_start (t); !tsi_end_p (i); tsi_next (&i))
- set_bb_for_stmt (tsi_stmt (i), bb);
- }
- else
- {
- stmt_ann_t ann = get_stmt_ann (t);
- ann->bb = bb;
-
- /* If the statement is a label, add the label to block-to-labels map
- so that we can speed up edge creation for GOTO_EXPRs. */
- if (TREE_CODE (t) == LABEL_EXPR)
- {
- int uid;
-
- t = LABEL_EXPR_LABEL (t);
- uid = LABEL_DECL_UID (t);
- if (uid == -1)
- {
- unsigned old_len = VEC_length (basic_block, label_to_block_map);
- LABEL_DECL_UID (t) = uid = cfun->cfg->last_label_uid++;
- if (old_len <= (unsigned) uid)
- {
- unsigned new_len = 3 * uid / 2;
-
- VEC_safe_grow_cleared (basic_block, gc, label_to_block_map,
- new_len);
- }
- }
- else
- /* We're moving an existing label. Make sure that we've
- removed it from the old block. */
- gcc_assert (!bb
- || !VEC_index (basic_block, label_to_block_map, uid));
- VEC_replace (basic_block, label_to_block_map, uid, bb);
- }
- }
-}
-
-/* Faster version of set_bb_for_stmt that assume that statement is being moved
- from one basic block to another.
- For BB splitting we can run into quadratic case, so performance is quite
- important and knowing that the tables are big enough, change_bb_for_stmt
- can inline as leaf function. */
-static inline void
-change_bb_for_stmt (tree t, basic_block bb)
-{
- get_stmt_ann (t)->bb = bb;
- if (TREE_CODE (t) == LABEL_EXPR)
- VEC_replace (basic_block, label_to_block_map,
- LABEL_DECL_UID (LABEL_EXPR_LABEL (t)), bb);
-}
-
-/* Finds iterator for STMT. */
-
-extern block_stmt_iterator
-bsi_for_stmt (tree stmt)
-{
- block_stmt_iterator bsi;
-
- for (bsi = bsi_start (bb_for_stmt (stmt)); !bsi_end_p (bsi); bsi_next (&bsi))
- if (bsi_stmt (bsi) == stmt)
- return bsi;
-
- gcc_unreachable ();
-}
-
-/* Mark statement T as modified, and update it. */
-static inline void
-update_modified_stmts (tree t)
-{
- if (!ssa_operands_active ())
- return;
- if (TREE_CODE (t) == STATEMENT_LIST)
- {
- tree_stmt_iterator i;
- tree stmt;
- for (i = tsi_start (t); !tsi_end_p (i); tsi_next (&i))
- {
- stmt = tsi_stmt (i);
- update_stmt_if_modified (stmt);
- }
- }
- else
- update_stmt_if_modified (t);
-}
-
-/* Insert statement (or statement list) T before the statement
- pointed-to by iterator I. M specifies how to update iterator I
- after insertion (see enum bsi_iterator_update). */
-
-void
-bsi_insert_before (block_stmt_iterator *i, tree t, enum bsi_iterator_update m)
-{
- set_bb_for_stmt (t, i->bb);
- update_modified_stmts (t);
- tsi_link_before (&i->tsi, t, m);
-}
-
-
-/* Insert statement (or statement list) T after the statement
- pointed-to by iterator I. M specifies how to update iterator I
- after insertion (see enum bsi_iterator_update). */
-
-void
-bsi_insert_after (block_stmt_iterator *i, tree t, enum bsi_iterator_update m)
-{
- set_bb_for_stmt (t, i->bb);
- update_modified_stmts (t);
- tsi_link_after (&i->tsi, t, m);
-}
-
-
-/* Remove the statement pointed to by iterator I. The iterator is updated
- to the next statement.
-
- When REMOVE_EH_INFO is true we remove the statement pointed to by
- iterator I from the EH tables. Otherwise we do not modify the EH
- tables.
-
- Generally, REMOVE_EH_INFO should be true when the statement is going to
- be removed from the IL and not reinserted elsewhere. */
-
-void
-bsi_remove (block_stmt_iterator *i, bool remove_eh_info)
-{
- tree t = bsi_stmt (*i);
- set_bb_for_stmt (t, NULL);
- delink_stmt_imm_use (t);
- tsi_delink (&i->tsi);
- mark_stmt_modified (t);
- if (remove_eh_info)
- {
- remove_stmt_from_eh_region (t);
- gimple_remove_stmt_histograms (cfun, t);
- }
-}
-
-
-/* Move the statement at FROM so it comes right after the statement at TO. */
-
-void
-bsi_move_after (block_stmt_iterator *from, block_stmt_iterator *to)
-{
- tree stmt = bsi_stmt (*from);
- bsi_remove (from, false);
- /* We must have BSI_NEW_STMT here, as bsi_move_after is sometimes used to
- move statements to an empty block. */
- bsi_insert_after (to, stmt, BSI_NEW_STMT);
-}
-
-
-/* Move the statement at FROM so it comes right before the statement at TO. */
-
-void
-bsi_move_before (block_stmt_iterator *from, block_stmt_iterator *to)
-{
- tree stmt = bsi_stmt (*from);
- bsi_remove (from, false);
- /* For consistency with bsi_move_after, it might be better to have
- BSI_NEW_STMT here; however, that breaks several places that expect
- that TO does not change. */
- bsi_insert_before (to, stmt, BSI_SAME_STMT);
-}
-
-
-/* Move the statement at FROM to the end of basic block BB. */
-
-void
-bsi_move_to_bb_end (block_stmt_iterator *from, basic_block bb)
-{
- block_stmt_iterator last = bsi_last (bb);
-
- /* Have to check bsi_end_p because it could be an empty block. */
- if (!bsi_end_p (last) && is_ctrl_stmt (bsi_stmt (last)))
- bsi_move_before (from, &last);
- else
- bsi_move_after (from, &last);
-}
-
-
-/* Replace the contents of the statement pointed to by iterator BSI
- with STMT. If UPDATE_EH_INFO is true, the exception handling
- information of the original statement is moved to the new statement. */
-
-void
-bsi_replace (const block_stmt_iterator *bsi, tree stmt, bool update_eh_info)
-{
- int eh_region;
- tree orig_stmt = bsi_stmt (*bsi);
-
- if (stmt == orig_stmt)
- return;
- SET_EXPR_LOCUS (stmt, EXPR_LOCUS (orig_stmt));
- set_bb_for_stmt (stmt, bsi->bb);
-
- /* Preserve EH region information from the original statement, if
- requested by the caller. */
- if (update_eh_info)
- {
- eh_region = lookup_stmt_eh_region (orig_stmt);
- if (eh_region >= 0)
- {
- remove_stmt_from_eh_region (orig_stmt);
- add_stmt_to_eh_region (stmt, eh_region);
- }
- }
-
- gimple_duplicate_stmt_histograms (cfun, stmt, cfun, orig_stmt);
- gimple_remove_stmt_histograms (cfun, orig_stmt);
- delink_stmt_imm_use (orig_stmt);
- *bsi_stmt_ptr (*bsi) = stmt;
- mark_stmt_modified (stmt);
- update_modified_stmts (stmt);
-}
-
-
-/* Insert the statement pointed-to by BSI into edge E. Every attempt
- is made to place the statement in an existing basic block, but
- sometimes that isn't possible. When it isn't possible, the edge is
- split and the statement is added to the new block.
-
- In all cases, the returned *BSI points to the correct location. The
- return value is true if insertion should be done after the location,
- or false if it should be done before the location. If new basic block
- has to be created, it is stored in *NEW_BB. */
-
-static bool
-tree_find_edge_insert_loc (edge e, block_stmt_iterator *bsi,
- basic_block *new_bb)
-{
- basic_block dest, src;
- tree tmp;
-
- dest = e->dest;
- restart:
-
- /* If the destination has one predecessor which has no PHI nodes,
- insert there. Except for the exit block.
-
- The requirement for no PHI nodes could be relaxed. Basically we
- would have to examine the PHIs to prove that none of them used
- the value set by the statement we want to insert on E. That
- hardly seems worth the effort. */
- if (single_pred_p (dest)
- && ! phi_nodes (dest)
- && dest != EXIT_BLOCK_PTR)
- {
- *bsi = bsi_start (dest);
- if (bsi_end_p (*bsi))
- return true;
-
- /* Make sure we insert after any leading labels. */
- tmp = bsi_stmt (*bsi);
- while (TREE_CODE (tmp) == LABEL_EXPR)
- {
- bsi_next (bsi);
- if (bsi_end_p (*bsi))
- break;
- tmp = bsi_stmt (*bsi);
- }
-
- if (bsi_end_p (*bsi))
- {
- *bsi = bsi_last (dest);
- return true;
- }
- else
- return false;
- }
-
- /* If the source has one successor, the edge is not abnormal and
- the last statement does not end a basic block, insert there.
- Except for the entry block. */
- src = e->src;
- if ((e->flags & EDGE_ABNORMAL) == 0
- && single_succ_p (src)
- && src != ENTRY_BLOCK_PTR)
- {
- *bsi = bsi_last (src);
- if (bsi_end_p (*bsi))
- return true;
-
- tmp = bsi_stmt (*bsi);
- if (!stmt_ends_bb_p (tmp))
- return true;
-
- /* Insert code just before returning the value. We may need to decompose
- the return in the case it contains non-trivial operand. */
- if (TREE_CODE (tmp) == RETURN_EXPR)
- {
- tree op = TREE_OPERAND (tmp, 0);
- if (op && !is_gimple_val (op))
- {
- gcc_assert (TREE_CODE (op) == GIMPLE_MODIFY_STMT);
- bsi_insert_before (bsi, op, BSI_NEW_STMT);
- TREE_OPERAND (tmp, 0) = GIMPLE_STMT_OPERAND (op, 0);
- }
- bsi_prev (bsi);
- return true;
- }
- }
-
- /* Otherwise, create a new basic block, and split this edge. */
- dest = split_edge (e);
- if (new_bb)
- *new_bb = dest;
- e = single_pred_edge (dest);
- goto restart;
-}
-
-
-/* This routine will commit all pending edge insertions, creating any new
- basic blocks which are necessary. */
-
-void
-bsi_commit_edge_inserts (void)
-{
- basic_block bb;
- edge e;
- edge_iterator ei;
-
- bsi_commit_one_edge_insert (single_succ_edge (ENTRY_BLOCK_PTR), NULL);
-
- FOR_EACH_BB (bb)
- FOR_EACH_EDGE (e, ei, bb->succs)
- bsi_commit_one_edge_insert (e, NULL);
-}
-
-
-/* Commit insertions pending at edge E. If a new block is created, set NEW_BB
- to this block, otherwise set it to NULL. */
-
-void
-bsi_commit_one_edge_insert (edge e, basic_block *new_bb)
-{
- if (new_bb)
- *new_bb = NULL;
- if (PENDING_STMT (e))
- {
- block_stmt_iterator bsi;
- tree stmt = PENDING_STMT (e);
-
- PENDING_STMT (e) = NULL_TREE;
-
- if (tree_find_edge_insert_loc (e, &bsi, new_bb))
- bsi_insert_after (&bsi, stmt, BSI_NEW_STMT);
- else
- bsi_insert_before (&bsi, stmt, BSI_NEW_STMT);
- }
-}
-
-
-/* Add STMT to the pending list of edge E. No actual insertion is
- made until a call to bsi_commit_edge_inserts () is made. */
-
-void
-bsi_insert_on_edge (edge e, tree stmt)
-{
- append_to_statement_list (stmt, &PENDING_STMT (e));
-}
-
-/* Similar to bsi_insert_on_edge+bsi_commit_edge_inserts. If a new
- block has to be created, it is returned. */
-
-basic_block
-bsi_insert_on_edge_immediate (edge e, tree stmt)
-{
- block_stmt_iterator bsi;
- basic_block new_bb = NULL;
-
- gcc_assert (!PENDING_STMT (e));
-
- if (tree_find_edge_insert_loc (e, &bsi, &new_bb))
- bsi_insert_after (&bsi, stmt, BSI_NEW_STMT);
- else
- bsi_insert_before (&bsi, stmt, BSI_NEW_STMT);
-
- return new_bb;
+ return NULL;
}
-/*---------------------------------------------------------------------------
- Tree specific functions for CFG manipulation
----------------------------------------------------------------------------*/
-
/* Reinstall those PHI arguments queued in OLD_EDGE to NEW_EDGE. */
static void
reinstall_phi_args (edge new_edge, edge old_edge)
{
- tree phi;
edge_var_map_vector v;
edge_var_map *vm;
int i;
-
+ gimple_stmt_iterator phis;
+
v = redirect_edge_var_map_vector (old_edge);
if (!v)
return;
-
- for (i = 0, phi = phi_nodes (new_edge->dest);
- VEC_iterate (edge_var_map, v, i, vm) && phi;
- i++, phi = PHI_CHAIN (phi))
+
+ for (i = 0, phis = gsi_start_phis (new_edge->dest);
+ VEC_iterate (edge_var_map, v, i, vm) && !gsi_end_p (phis);
+ i++, gsi_next (&phis))
{
+ gimple phi = gsi_stmt (phis);
tree result = redirect_edge_var_map_result (vm);
tree arg = redirect_edge_var_map_def (vm);
-
- gcc_assert (result == PHI_RESULT (phi));
-
+
+ gcc_assert (result == gimple_phi_result (phi));
+
add_phi_arg (phi, arg, new_edge);
}
-
+
redirect_edge_var_map_clear (old_edge);
}
@@ -3131,7 +2737,7 @@ split_edge_bb_loc (edge edge_in)
Abort on abnormal edges. */
static basic_block
-tree_split_edge (edge edge_in)
+gimple_split_edge (edge edge_in)
{
basic_block new_bb, after_bb, dest;
edge new_edge, e;
@@ -3194,10 +2800,7 @@ verify_expr (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
break;
case MODIFY_EXPR:
- gcc_unreachable ();
-
- case GIMPLE_MODIFY_STMT:
- x = GIMPLE_STMT_OPERAND (t, 0);
+ x = TREE_OPERAND (t, 0);
if (TREE_CODE (x) == BIT_FIELD_REF
&& is_gimple_reg (TREE_OPERAND (x, 0)))
{
@@ -3420,74 +3023,12 @@ verify_expr (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
#undef CHECK_OP
}
-/* Verifies if EXPR is a valid GIMPLE unary expression. Returns true
- if there is an error, otherwise false. */
-
-static bool
-verify_gimple_unary_expr (const_tree expr)
-{
- tree op = TREE_OPERAND (expr, 0);
- tree type = TREE_TYPE (expr);
-
- if (!is_gimple_val (op))
- {
- error ("invalid operand in unary expression");
- return true;
- }
-
- /* For general unary expressions we have the operations type
- as the effective type the operation is carried out on. So all
- we need to require is that the operand is trivially convertible
- to that type. */
- if (!useless_type_conversion_p (type, TREE_TYPE (op)))
- {
- error ("type mismatch in unary expression");
- debug_generic_expr (type);
- debug_generic_expr (TREE_TYPE (op));
- return true;
- }
-
- return false;
-}
-
-/* Verifies if EXPR is a valid GIMPLE binary expression. Returns true
- if there is an error, otherwise false. */
-
-static bool
-verify_gimple_binary_expr (const_tree expr)
-{
- tree op0 = TREE_OPERAND (expr, 0);
- tree op1 = TREE_OPERAND (expr, 1);
- tree type = TREE_TYPE (expr);
-
- if (!is_gimple_val (op0) || !is_gimple_val (op1))
- {
- error ("invalid operands in binary expression");
- return true;
- }
-
- /* For general binary expressions we have the operations type
- as the effective type the operation is carried out on. So all
- we need to require is that both operands are trivially convertible
- to that type. */
- if (!useless_type_conversion_p (type, TREE_TYPE (op0))
- || !useless_type_conversion_p (type, TREE_TYPE (op1)))
- {
- error ("type mismatch in binary expression");
- debug_generic_stmt (type);
- debug_generic_stmt (TREE_TYPE (op0));
- debug_generic_stmt (TREE_TYPE (op1));
- return true;
- }
-
- return false;
-}
/* Verify if EXPR is either a GIMPLE ID or a GIMPLE indirect reference.
Returns true if there is an error, otherwise false. */
static bool
-verify_gimple_min_lval (tree expr)
+verify_types_in_gimple_min_lval (tree expr)
{
tree op;
@@ -3525,7 +3066,7 @@ verify_gimple_min_lval (tree expr)
if there is an error, otherwise false. */
static bool
-verify_gimple_reference (tree expr)
+verify_types_in_gimple_reference (tree expr)
{
while (handled_component_p (expr))
{
@@ -3594,7 +3135,7 @@ verify_gimple_reference (tree expr)
expr = op;
}
- return verify_gimple_min_lval (expr);
+ return verify_types_in_gimple_min_lval (expr);
}
/* Returns true if there is one pointer type in TYPE_POINTER_TO (SRC_OBJ)
@@ -3627,59 +3168,123 @@ valid_fixed_convert_types_p (tree type1, tree type2)
|| FIXED_POINT_TYPE_P (type2)));
}
-/* Verify the GIMPLE expression EXPR. Returns true if there is an
- error, otherwise false. */
+/* Verify that OP is a valid GIMPLE operand. Return true if there is
+ an error, false otherwise. */
static bool
-verify_gimple_expr (tree expr)
+verify_types_in_gimple_op (tree op)
{
- tree type = TREE_TYPE (expr);
+ if (!is_gimple_val (op) && !is_gimple_lvalue (op))
+ {
+ error ("Invalid GIMPLE operand");
+ debug_generic_expr (op);
+ return true;
+ }
- if (is_gimple_val (expr))
- return false;
+ return false;
+}
+
+
+/* Verify the contents of a GIMPLE_CALL STMT. Returns true when there
+ is a problem, otherwise false. */
+
+static bool
+verify_types_in_gimple_call (gimple stmt)
+{
+ bool failed = false;
+ unsigned int i;
+ tree fn;
+
+ if (gimple_call_lhs (stmt))
+ failed |= verify_types_in_gimple_op (gimple_call_lhs (stmt));
+
+ fn = gimple_call_fn (stmt);
+ if (TREE_CODE (fn) != OBJ_TYPE_REF
+ && verify_types_in_gimple_op (fn))
+ failed = true;
+
+ if (gimple_call_chain (stmt))
+ failed |= verify_types_in_gimple_op (gimple_call_chain (stmt));
+
+ for (i = 0; i < gimple_call_num_args (stmt); i++)
+ failed |= verify_types_in_gimple_op (gimple_call_arg (stmt,i));
+
+ return failed;
+}
+
+
+/* Verify the contents of a GIMPLE_COND STMT. Returns true when there
+ is a problem, otherwise false. */
+
+static bool
+verify_types_in_gimple_cond (gimple stmt)
+{
+ bool failed = false;
+
+ failed |= verify_types_in_gimple_op (gimple_cond_lhs (stmt));
+ failed |= verify_types_in_gimple_op (gimple_cond_rhs (stmt));
+ failed |= verify_types_in_gimple_op (gimple_cond_true_label (stmt));
+ failed |= verify_types_in_gimple_op (gimple_cond_false_label (stmt));
+
+ return failed;
+}
+
+
+/* Verify the contents of a GIMPLE_ASSIGN STMT. Returns true when there
+ is a problem, otherwise false.
+
+ Verify that the types of the LHS and the RHS operands are
+ compatible. This verification largely depends on what kind of
+ operation is done on the RHS of the assignment. It is not always
+ the case that all the types of the operands must match (e.g., 'a =
+ (unsigned long) b' or 'ptr = ptr + 1'). */
+
+static bool
+verify_types_in_gimple_assign (gimple stmt)
+{
+ enum tree_code rhs_code = gimple_assign_rhs_code (stmt);
+ tree lhs = gimple_assign_lhs (stmt);
+ tree rhs1 = gimple_assign_rhs1 (stmt);
+ tree rhs2 = (gimple_num_ops (stmt) == 3) ? gimple_assign_rhs2 (stmt) : NULL;
+ tree lhs_type = TREE_TYPE (lhs);
+ tree rhs1_type = TREE_TYPE (rhs1);
+ tree rhs2_type = (rhs2) ? TREE_TYPE (rhs2) : NULL;
/* Special codes we cannot handle via their class. */
- switch (TREE_CODE (expr))
+ switch (rhs_code)
{
CASE_CONVERT:
{
- tree op = TREE_OPERAND (expr, 0);
- if (!is_gimple_val (op))
+ if (!is_gimple_val (rhs1))
{
error ("invalid operand in conversion");
return true;
}
- /* Allow conversions between integral types and between
- pointer types. */
- if ((INTEGRAL_TYPE_P (type) && INTEGRAL_TYPE_P (TREE_TYPE (op)))
- || (POINTER_TYPE_P (type) && POINTER_TYPE_P (TREE_TYPE (op))))
- return false;
-
/* Allow conversions between integral types and pointers only if
there is no sign or zero extension involved. */
- if (((POINTER_TYPE_P (type) && INTEGRAL_TYPE_P (TREE_TYPE (op)))
- || (POINTER_TYPE_P (TREE_TYPE (op)) && INTEGRAL_TYPE_P (type)))
- && (TYPE_PRECISION (type) == TYPE_PRECISION (TREE_TYPE (op))
+ if (((POINTER_TYPE_P (lhs_type) && INTEGRAL_TYPE_P (rhs1_type))
+ || (POINTER_TYPE_P (rhs1_type) && INTEGRAL_TYPE_P (lhs_type)))
+ && (TYPE_PRECISION (lhs_type) == TYPE_PRECISION (rhs1_type)
/* For targets were the precision of sizetype doesn't
match that of pointers we need the following. */
- || type == sizetype || TREE_TYPE (op) == sizetype))
+ || lhs_type == sizetype || rhs1_type == sizetype))
return false;
/* Allow conversion from integer to offset type and vice versa. */
- if ((TREE_CODE (type) == OFFSET_TYPE
- && TREE_CODE (TREE_TYPE (op)) == INTEGER_TYPE)
- || (TREE_CODE (type) == INTEGER_TYPE
- && TREE_CODE (TREE_TYPE (op)) == OFFSET_TYPE))
+ if ((TREE_CODE (lhs_type) == OFFSET_TYPE
+ && TREE_CODE (rhs1_type) == INTEGER_TYPE)
+ || (TREE_CODE (lhs_type) == INTEGER_TYPE
+ && TREE_CODE (rhs1_type) == OFFSET_TYPE))
return false;
/* Otherwise assert we are converting between types of the
same kind. */
- if (TREE_CODE (type) != TREE_CODE (TREE_TYPE (op)))
+ if (INTEGRAL_TYPE_P (lhs_type) != INTEGRAL_TYPE_P (rhs1_type))
{
error ("invalid types in nop conversion");
- debug_generic_expr (type);
- debug_generic_expr (TREE_TYPE (op));
+ debug_generic_expr (lhs_type);
+ debug_generic_expr (rhs1_type);
return true;
}
@@ -3688,19 +3293,18 @@ verify_gimple_expr (tree expr)
case FIXED_CONVERT_EXPR:
{
- tree op = TREE_OPERAND (expr, 0);
- if (!is_gimple_val (op))
+ if (!is_gimple_val (rhs1))
{
error ("invalid operand in conversion");
return true;
}
- if (!valid_fixed_convert_types_p (type, TREE_TYPE (op))
- && !valid_fixed_convert_types_p (TREE_TYPE (op), type))
+ if (!valid_fixed_convert_types_p (lhs_type, rhs1_type)
+ && !valid_fixed_convert_types_p (rhs1_type, lhs_type))
{
error ("invalid types in fixed-point conversion");
- debug_generic_expr (type);
- debug_generic_expr (TREE_TYPE (op));
+ debug_generic_expr (lhs_type);
+ debug_generic_expr (rhs1_type);
return true;
}
@@ -3709,79 +3313,70 @@ verify_gimple_expr (tree expr)
case FLOAT_EXPR:
{
- tree op = TREE_OPERAND (expr, 0);
- if (!is_gimple_val (op))
+ if (!is_gimple_val (rhs1))
{
error ("invalid operand in int to float conversion");
return true;
}
- if (!INTEGRAL_TYPE_P (TREE_TYPE (op))
- || !SCALAR_FLOAT_TYPE_P (type))
+
+ if (!INTEGRAL_TYPE_P (rhs1_type) || !SCALAR_FLOAT_TYPE_P (lhs_type))
{
error ("invalid types in conversion to floating point");
- debug_generic_expr (type);
- debug_generic_expr (TREE_TYPE (op));
+ debug_generic_expr (lhs_type);
+ debug_generic_expr (rhs1_type);
return true;
}
+
return false;
}
case FIX_TRUNC_EXPR:
{
- tree op = TREE_OPERAND (expr, 0);
- if (!is_gimple_val (op))
+ if (!is_gimple_val (rhs1))
{
error ("invalid operand in float to int conversion");
return true;
}
- if (!INTEGRAL_TYPE_P (type)
- || !SCALAR_FLOAT_TYPE_P (TREE_TYPE (op)))
+
+ if (!INTEGRAL_TYPE_P (lhs_type) || !SCALAR_FLOAT_TYPE_P (rhs1_type))
{
error ("invalid types in conversion to integer");
- debug_generic_expr (type);
- debug_generic_expr (TREE_TYPE (op));
+ debug_generic_expr (lhs_type);
+ debug_generic_expr (rhs1_type);
return true;
}
+
return false;
}
case COMPLEX_EXPR:
{
- tree op0 = TREE_OPERAND (expr, 0);
- tree op1 = TREE_OPERAND (expr, 1);
- if (!is_gimple_val (op0) || !is_gimple_val (op1))
+ if (!is_gimple_val (rhs1) || !is_gimple_val (rhs2))
{
error ("invalid operands in complex expression");
return true;
}
- if (!TREE_CODE (type) == COMPLEX_TYPE
- || !(TREE_CODE (TREE_TYPE (op0)) == INTEGER_TYPE
- || SCALAR_FLOAT_TYPE_P (TREE_TYPE (op0)))
- || !(TREE_CODE (TREE_TYPE (op1)) == INTEGER_TYPE
- || SCALAR_FLOAT_TYPE_P (TREE_TYPE (op1)))
- || !useless_type_conversion_p (TREE_TYPE (type),
- TREE_TYPE (op0))
- || !useless_type_conversion_p (TREE_TYPE (type),
- TREE_TYPE (op1)))
+
+ if (!TREE_CODE (lhs_type) == COMPLEX_TYPE
+ || !(TREE_CODE (rhs1_type) == INTEGER_TYPE
+ || SCALAR_FLOAT_TYPE_P (rhs1_type))
+ || !(TREE_CODE (rhs2_type) == INTEGER_TYPE
+ || SCALAR_FLOAT_TYPE_P (rhs2_type)))
{
error ("type mismatch in complex expression");
- debug_generic_stmt (TREE_TYPE (expr));
- debug_generic_stmt (TREE_TYPE (op0));
- debug_generic_stmt (TREE_TYPE (op1));
+ debug_generic_expr (lhs_type);
+ debug_generic_expr (rhs1_type);
+ debug_generic_expr (rhs2_type);
return true;
}
+
return false;
}
case CONSTRUCTOR:
{
- /* This is used like COMPLEX_EXPR but for vectors. */
- if (TREE_CODE (type) != VECTOR_TYPE)
- {
- error ("constructor not allowed for non-vector types");
- debug_generic_stmt (type);
- return true;
- }
+ /* In this context we know that we are on the RHS of an
+ assignment, so CONSTRUCTOR operands are OK. */
/* FIXME: verify constructor arguments. */
return false;
}
@@ -3791,113 +3386,83 @@ verify_gimple_expr (tree expr)
case LROTATE_EXPR:
case RROTATE_EXPR:
{
- tree op0 = TREE_OPERAND (expr, 0);
- tree op1 = TREE_OPERAND (expr, 1);
- if (!is_gimple_val (op0) || !is_gimple_val (op1))
+ if (!is_gimple_val (rhs1) || !is_gimple_val (rhs2))
{
error ("invalid operands in shift expression");
return true;
}
- if (!TREE_CODE (TREE_TYPE (op1)) == INTEGER_TYPE
- || !useless_type_conversion_p (type, TREE_TYPE (op0)))
+
+ if (!TREE_CODE (rhs1_type) == INTEGER_TYPE
+ || !useless_type_conversion_p (lhs_type, rhs1_type))
{
error ("type mismatch in shift expression");
- debug_generic_stmt (TREE_TYPE (expr));
- debug_generic_stmt (TREE_TYPE (op0));
- debug_generic_stmt (TREE_TYPE (op1));
+ debug_generic_expr (lhs_type);
+ debug_generic_expr (rhs1_type);
+ debug_generic_expr (rhs2_type);
return true;
}
+
return false;
}
case PLUS_EXPR:
case MINUS_EXPR:
{
- tree op0 = TREE_OPERAND (expr, 0);
- tree op1 = TREE_OPERAND (expr, 1);
- if (POINTER_TYPE_P (type)
- || POINTER_TYPE_P (TREE_TYPE (op0))
- || POINTER_TYPE_P (TREE_TYPE (op1)))
+ if (POINTER_TYPE_P (lhs_type)
+ || POINTER_TYPE_P (rhs1_type)
+ || POINTER_TYPE_P (rhs2_type))
{
error ("invalid (pointer) operands to plus/minus");
return true;
}
+
/* Continue with generic binary expression handling. */
break;
}
case POINTER_PLUS_EXPR:
{
- tree op0 = TREE_OPERAND (expr, 0);
- tree op1 = TREE_OPERAND (expr, 1);
- if (!is_gimple_val (op0) || !is_gimple_val (op1))
+ if (!is_gimple_val (rhs1) || !is_gimple_val (rhs2))
{
error ("invalid operands in pointer plus expression");
return true;
}
- if (!POINTER_TYPE_P (TREE_TYPE (op0))
- || !useless_type_conversion_p (type, TREE_TYPE (op0))
- || !useless_type_conversion_p (sizetype, TREE_TYPE (op1)))
+ if (!POINTER_TYPE_P (rhs1_type)
+ || !useless_type_conversion_p (lhs_type, rhs1_type)
+ || !useless_type_conversion_p (sizetype, rhs2_type))
{
error ("type mismatch in pointer plus expression");
- debug_generic_stmt (type);
- debug_generic_stmt (TREE_TYPE (op0));
- debug_generic_stmt (TREE_TYPE (op1));
+ debug_generic_stmt (lhs_type);
+ debug_generic_stmt (rhs1_type);
+ debug_generic_stmt (rhs2_type);
return true;
}
- return false;
- }
- case COND_EXPR:
- {
- tree op0 = TREE_OPERAND (expr, 0);
- tree op1 = TREE_OPERAND (expr, 1);
- tree op2 = TREE_OPERAND (expr, 2);
- if ((!is_gimple_val (op1)
- && TREE_CODE (TREE_TYPE (op1)) != VOID_TYPE)
- || (!is_gimple_val (op2)
- && TREE_CODE (TREE_TYPE (op2)) != VOID_TYPE))
- {
- error ("invalid operands in conditional expression");
- return true;
- }
- if (!INTEGRAL_TYPE_P (TREE_TYPE (op0))
- || (TREE_CODE (TREE_TYPE (op1)) != VOID_TYPE
- && !useless_type_conversion_p (type, TREE_TYPE (op1)))
- || (TREE_CODE (TREE_TYPE (op2)) != VOID_TYPE
- && !useless_type_conversion_p (type, TREE_TYPE (op2))))
- {
- error ("type mismatch in conditional expression");
- debug_generic_stmt (type);
- debug_generic_stmt (TREE_TYPE (op0));
- debug_generic_stmt (TREE_TYPE (op1));
- debug_generic_stmt (TREE_TYPE (op2));
- return true;
- }
- return verify_gimple_expr (op0);
- }
+ return false;
+ }
case ADDR_EXPR:
{
- tree op = TREE_OPERAND (expr, 0);
+ tree op = TREE_OPERAND (rhs1, 0);
if (!is_gimple_addressable (op))
{
error ("invalid operand in unary expression");
return true;
}
- if (!one_pointer_to_useless_type_conversion_p (type, TREE_TYPE (op))
+
+ if (!one_pointer_to_useless_type_conversion_p (lhs_type, TREE_TYPE (op))
/* FIXME: a longstanding wart, &a == &a[0]. */
&& (TREE_CODE (TREE_TYPE (op)) != ARRAY_TYPE
- || !one_pointer_to_useless_type_conversion_p (type,
+ || !one_pointer_to_useless_type_conversion_p (lhs_type,
TREE_TYPE (TREE_TYPE (op)))))
{
error ("type mismatch in address expression");
- debug_generic_stmt (TREE_TYPE (expr));
+ debug_generic_stmt (lhs_type);
debug_generic_stmt (TYPE_POINTER_TO (TREE_TYPE (op)));
return true;
}
- return verify_gimple_reference (op);
+ return verify_types_in_gimple_reference (TREE_OPERAND (rhs1, 0));
}
case TRUTH_ANDIF_EXPR:
@@ -3908,24 +3473,21 @@ verify_gimple_expr (tree expr)
case TRUTH_OR_EXPR:
case TRUTH_XOR_EXPR:
{
- tree op0 = TREE_OPERAND (expr, 0);
- tree op1 = TREE_OPERAND (expr, 1);
-
- if (!is_gimple_val (op0) || !is_gimple_val (op1))
+ if (!is_gimple_val (rhs1) || !is_gimple_val (rhs2))
{
error ("invalid operands in truth expression");
return true;
}
/* We allow any kind of integral typed argument and result. */
- if (!INTEGRAL_TYPE_P (TREE_TYPE (op0))
- || !INTEGRAL_TYPE_P (TREE_TYPE (op1))
- || !INTEGRAL_TYPE_P (type))
+ if (!INTEGRAL_TYPE_P (rhs1_type)
+ || !INTEGRAL_TYPE_P (rhs2_type)
+ || !INTEGRAL_TYPE_P (lhs_type))
{
error ("type mismatch in binary truth expression");
- debug_generic_stmt (type);
- debug_generic_stmt (TREE_TYPE (op0));
- debug_generic_stmt (TREE_TYPE (op1));
+ debug_generic_expr (lhs_type);
+ debug_generic_expr (rhs1_type);
+ debug_generic_expr (rhs2_type);
return true;
}
@@ -3934,9 +3496,7 @@ verify_gimple_expr (tree expr)
case TRUTH_NOT_EXPR:
{
- tree op = TREE_OPERAND (expr, 0);
-
- if (!is_gimple_val (op))
+ if (!is_gimple_val (rhs1))
{
error ("invalid operand in unary not");
return true;
@@ -3944,33 +3504,37 @@ verify_gimple_expr (tree expr)
/* For TRUTH_NOT_EXPR we can have any kind of integral
typed arguments and results. */
- if (!INTEGRAL_TYPE_P (TREE_TYPE (op))
- || !INTEGRAL_TYPE_P (type))
+ if (!INTEGRAL_TYPE_P (rhs1_type)
+ || !INTEGRAL_TYPE_P (lhs_type))
{
error ("type mismatch in not expression");
- debug_generic_expr (TREE_TYPE (expr));
- debug_generic_expr (TREE_TYPE (op));
+ debug_generic_expr (lhs_type);
+ debug_generic_expr (rhs1_type);
return true;
}
return false;
}
+ /* After gimplification we should not have any of these. */
+ case ASM_EXPR:
+ case BIND_EXPR:
case CALL_EXPR:
- /* FIXME. The C frontend passes unpromoted arguments in case it
- didn't see a function declaration before the call. */
+ case COND_EXPR:
+ case TREE_LIST:
+ case COMPOUND_EXPR:
+ case MODIFY_EXPR:
+ case INIT_EXPR:
+ case GOTO_EXPR:
+ case LABEL_EXPR:
+ case RETURN_EXPR:
+ case TRY_FINALLY_EXPR:
+ case TRY_CATCH_EXPR:
+ case EH_FILTER_EXPR:
+ case STATEMENT_LIST:
{
- tree decl = CALL_EXPR_FN (expr);
-
- if (TREE_CODE (decl) == FUNCTION_DECL
- && DECL_LOOPING_CONST_OR_PURE_P (decl)
- && (!DECL_PURE_P (decl))
- && (!TREE_READONLY (decl)))
- {
- error ("invalid pure const state for function");
- return true;
- }
- return false;
+ error ("tree node that should already be gimple.");
+ return true;
}
case OBJ_TYPE_REF:
@@ -3981,26 +3545,29 @@ verify_gimple_expr (tree expr)
}
/* Generic handling via classes. */
- switch (TREE_CODE_CLASS (TREE_CODE (expr)))
+ switch (TREE_CODE_CLASS (rhs_code))
{
case tcc_unary:
- return verify_gimple_unary_expr (expr);
-
- case tcc_binary:
- return verify_gimple_binary_expr (expr);
+ if (!useless_type_conversion_p (lhs_type, rhs1_type))
+ {
+ error ("non-trivial conversion at assignment");
+ debug_generic_expr (lhs);
+ debug_generic_expr (rhs1);
+ return true;
+ }
+ break;
case tcc_reference:
- return verify_gimple_reference (expr);
+ return verify_types_in_gimple_reference (rhs1);
case tcc_comparison:
{
- tree op0 = TREE_OPERAND (expr, 0);
- tree op1 = TREE_OPERAND (expr, 1);
- if (!is_gimple_val (op0) || !is_gimple_val (op1))
+ if (!is_gimple_val (rhs1) || !is_gimple_val (rhs2))
{
error ("invalid operands in comparison expression");
return true;
}
+
/* For comparisons we do not have the operations type as the
effective type the comparison is carried out in. Instead
we require that either the first operand is trivially
@@ -4008,186 +3575,196 @@ verify_gimple_expr (tree expr)
The resulting type of a comparison may be any integral type.
Because we special-case pointers to void we allow
comparisons of pointers with the same mode as well. */
- if ((!useless_type_conversion_p (TREE_TYPE (op0), TREE_TYPE (op1))
- && !useless_type_conversion_p (TREE_TYPE (op1), TREE_TYPE (op0))
- && (!POINTER_TYPE_P (TREE_TYPE (op0))
- || !POINTER_TYPE_P (TREE_TYPE (op1))
- || TYPE_MODE (TREE_TYPE (op0)) != TYPE_MODE (TREE_TYPE (op1))))
- || !INTEGRAL_TYPE_P (type))
+ if ((!useless_type_conversion_p (rhs1_type, rhs2_type)
+ && !useless_type_conversion_p (rhs2_type, rhs1_type)
+ && (!POINTER_TYPE_P (rhs1_type)
+ || !POINTER_TYPE_P (rhs2_type)
+ || TYPE_MODE (rhs1_type) != TYPE_MODE (rhs2_type)))
+ || !INTEGRAL_TYPE_P (lhs_type))
{
error ("type mismatch in comparison expression");
- debug_generic_stmt (TREE_TYPE (expr));
- debug_generic_stmt (TREE_TYPE (op0));
- debug_generic_stmt (TREE_TYPE (op1));
+ debug_generic_expr (lhs_type);
+ debug_generic_expr (rhs1_type);
+ debug_generic_expr (rhs2_type);
return true;
}
break;
}
- default:
- gcc_unreachable ();
+ default:;
}
return false;
}
-/* Verify the GIMPLE assignment statement STMT. Returns true if there
- is an error, otherwise false. */
+
+/* Verify the contents of a GIMPLE_RETURN STMT. Returns true when there
+ is a problem, otherwise false. */
static bool
-verify_gimple_modify_stmt (const_tree stmt)
+verify_types_in_gimple_return (gimple stmt)
{
- tree lhs = GIMPLE_STMT_OPERAND (stmt, 0);
- tree rhs = GIMPLE_STMT_OPERAND (stmt, 1);
+ tree op = gimple_return_retval (stmt);
+
+ if (op == NULL)
+ return false;
+
+ return verify_types_in_gimple_op (op);
+}
- gcc_assert (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT);
- if (!useless_type_conversion_p (TREE_TYPE (lhs),
- TREE_TYPE (rhs)))
+/* Verify the contents of a GIMPLE_SWITCH STMT. Returns true when there
+ is a problem, otherwise false. */
+
+static bool
+verify_types_in_gimple_switch (gimple stmt)
+{
+ if (!is_gimple_val (gimple_switch_index (stmt)))
{
- error ("non-trivial conversion at assignment");
- debug_generic_expr (TREE_TYPE (lhs));
- debug_generic_expr (TREE_TYPE (rhs));
+ error ("invalid operand to switch statement");
+ debug_generic_expr (gimple_switch_index (stmt));
return true;
}
- /* Loads/stores from/to a variable are ok. */
- if ((is_gimple_val (lhs)
- && is_gimple_variable (rhs))
- || (is_gimple_val (rhs)
- && is_gimple_variable (lhs)))
- return false;
+ return false;
+}
- /* Aggregate copies are ok. */
- if (!is_gimple_reg_type (TREE_TYPE (lhs))
- && !is_gimple_reg_type (TREE_TYPE (rhs)))
- return false;
- /* We might get 'loads' from a parameter which is not a gimple value. */
- if (TREE_CODE (rhs) == PARM_DECL)
- return verify_gimple_expr (lhs);
+/* Verify the contents of a GIMPLE_PHI. Returns true if there is a problem,
+ and false otherwise. */
- if (!is_gimple_variable (lhs)
- && verify_gimple_expr (lhs))
- return true;
+static bool
+verify_types_in_gimple_phi (gimple stmt)
+{
+ size_t i;
- if (!is_gimple_variable (rhs)
- && verify_gimple_expr (rhs))
+ if (verify_types_in_gimple_op (gimple_phi_result (stmt)))
return true;
+ for (i = 0; i < gimple_phi_num_args (stmt); i++)
+ if (verify_types_in_gimple_op (gimple_phi_arg_def (stmt, i)))
+ return true;
+
return false;
}
+
/* Verify the GIMPLE statement STMT. Returns true if there is an
error, otherwise false. */
static bool
-verify_gimple_stmt (tree stmt)
+verify_types_in_gimple_stmt (gimple stmt)
{
- if (!is_gimple_stmt (stmt))
- {
- error ("is not a valid GIMPLE statement");
- return true;
- }
-
- if (OMP_DIRECTIVE_P (stmt))
+ if (is_gimple_omp (stmt))
{
/* OpenMP directives are validated by the FE and never operated
- on by the optimizers. Furthermore, OMP_FOR may contain
+ on by the optimizers. Furthermore, GIMPLE_OMP_FOR may contain
non-gimple expressions when the main index variable has had
its address taken. This does not affect the loop itself
- because the header of an OMP_FOR is merely used to determine
+ because the header of an GIMPLE_OMP_FOR is merely used to determine
how to setup the parallel iteration. */
return false;
}
- switch (TREE_CODE (stmt))
+ switch (gimple_code (stmt))
{
- case GIMPLE_MODIFY_STMT:
- return verify_gimple_modify_stmt (stmt);
+ case GIMPLE_ASSIGN:
+ return verify_types_in_gimple_assign (stmt);
- case GOTO_EXPR:
- case LABEL_EXPR:
- return false;
+ case GIMPLE_LABEL:
+ return TREE_CODE (gimple_label_label (stmt)) != LABEL_DECL;
- case SWITCH_EXPR:
- if (!is_gimple_val (TREE_OPERAND (stmt, 0)))
- {
- error ("invalid operand to switch statement");
- debug_generic_expr (TREE_OPERAND (stmt, 0));
- }
- return false;
+ case GIMPLE_CALL:
+ return verify_types_in_gimple_call (stmt);
- case RETURN_EXPR:
- {
- tree op = TREE_OPERAND (stmt, 0);
+ case GIMPLE_COND:
+ return verify_types_in_gimple_cond (stmt);
- if (TREE_CODE (TREE_TYPE (stmt)) != VOID_TYPE)
- {
- error ("type error in return expression");
- return true;
- }
+ case GIMPLE_GOTO:
+ return verify_types_in_gimple_op (gimple_goto_dest (stmt));
- if (op == NULL_TREE
- || TREE_CODE (op) == RESULT_DECL)
- return false;
+ case GIMPLE_NOP:
+ case GIMPLE_PREDICT:
+ return false;
- return verify_gimple_modify_stmt (op);
- }
+ case GIMPLE_SWITCH:
+ return verify_types_in_gimple_switch (stmt);
- case CALL_EXPR:
- case COND_EXPR:
- return verify_gimple_expr (stmt);
+ case GIMPLE_RETURN:
+ return verify_types_in_gimple_return (stmt);
- case NOP_EXPR:
- case CHANGE_DYNAMIC_TYPE_EXPR:
- case ASM_EXPR:
- case PREDICT_EXPR:
+ case GIMPLE_ASM:
return false;
+ case GIMPLE_CHANGE_DYNAMIC_TYPE:
+ return verify_types_in_gimple_op (gimple_cdt_location (stmt));
+
+ case GIMPLE_PHI:
+ return verify_types_in_gimple_phi (stmt);
+
default:
gcc_unreachable ();
}
}
-/* Verify the GIMPLE statements inside the statement list STMTS.
- Returns true if there were any errors. */
+/* Verify the GIMPLE statements inside the sequence STMTS. */
static bool
-verify_gimple_2 (tree stmts)
+verify_types_in_gimple_seq_2 (gimple_seq stmts)
{
- tree_stmt_iterator tsi;
+ gimple_stmt_iterator ittr;
bool err = false;
- for (tsi = tsi_start (stmts); !tsi_end_p (tsi); tsi_next (&tsi))
+ for (ittr = gsi_start (stmts); !gsi_end_p (ittr); gsi_next (&ittr))
{
- tree stmt = tsi_stmt (tsi);
-
- switch (TREE_CODE (stmt))
- {
- case BIND_EXPR:
- err |= verify_gimple_2 (BIND_EXPR_BODY (stmt));
- break;
-
- case TRY_CATCH_EXPR:
- case TRY_FINALLY_EXPR:
- err |= verify_gimple_2 (TREE_OPERAND (stmt, 0));
- err |= verify_gimple_2 (TREE_OPERAND (stmt, 1));
- break;
-
- case CATCH_EXPR:
- err |= verify_gimple_2 (CATCH_BODY (stmt));
- break;
+ gimple stmt = gsi_stmt (ittr);
- case EH_FILTER_EXPR:
- err |= verify_gimple_2 (EH_FILTER_FAILURE (stmt));
- break;
+ switch (gimple_code (stmt))
+ {
+ case GIMPLE_BIND:
+ err |= verify_types_in_gimple_seq_2 (gimple_bind_body (stmt));
+ break;
+
+ case GIMPLE_TRY:
+ err |= verify_types_in_gimple_seq_2 (gimple_try_eval (stmt));
+ err |= verify_types_in_gimple_seq_2 (gimple_try_cleanup (stmt));
+ break;
+
+ case GIMPLE_EH_FILTER:
+ err |= verify_types_in_gimple_seq_2
+ (gimple_eh_filter_failure (stmt));
+ break;
+
+ case GIMPLE_CATCH:
+ err |= verify_types_in_gimple_seq_2 (gimple_catch_handler (stmt));
+ break;
+
+ case GIMPLE_OMP_CRITICAL:
+ case GIMPLE_OMP_CONTINUE:
+ case GIMPLE_OMP_MASTER:
+ case GIMPLE_OMP_ORDERED:
+ case GIMPLE_OMP_SECTION:
+ case GIMPLE_OMP_FOR:
+ case GIMPLE_OMP_PARALLEL:
+ case GIMPLE_OMP_TASK:
+ case GIMPLE_OMP_SECTIONS:
+ case GIMPLE_OMP_SINGLE:
+ case GIMPLE_OMP_ATOMIC_STORE:
+ case GIMPLE_OMP_ATOMIC_LOAD:
+ break;
+
+ /* Tuples that do not have trees. */
+ case GIMPLE_NOP:
+ case GIMPLE_RESX:
+ case GIMPLE_OMP_RETURN:
+ case GIMPLE_PREDICT:
+ break;
default:
{
- bool err2 = verify_gimple_stmt (stmt);
+ bool err2 = verify_types_in_gimple_stmt (stmt);
if (err2)
- debug_generic_expr (stmt);
+ debug_gimple_stmt (stmt);
err |= err2;
}
}
@@ -4200,54 +3777,66 @@ verify_gimple_2 (tree stmts)
/* Verify the GIMPLE statements inside the statement list STMTS. */
void
-verify_gimple_1 (tree stmts)
+verify_types_in_gimple_seq (gimple_seq stmts)
{
- if (verify_gimple_2 (stmts))
+ if (verify_types_in_gimple_seq_2 (stmts))
internal_error ("verify_gimple failed");
}
-/* Verify the GIMPLE statements inside the current function. */
-
-void
-verify_gimple (void)
-{
- verify_gimple_1 (BIND_EXPR_BODY (DECL_SAVED_TREE (cfun->decl)));
-}
/* Verify STMT, return true if STMT is not in GIMPLE form.
TODO: Implement type checking. */
static bool
-verify_stmt (tree stmt, bool last_in_block)
+verify_stmt (gimple_stmt_iterator *gsi)
{
tree addr;
+ struct walk_stmt_info wi;
+ bool last_in_block = gsi_one_before_end_p (*gsi);
+ gimple stmt = gsi_stmt (*gsi);
- if (OMP_DIRECTIVE_P (stmt))
+ if (is_gimple_omp (stmt))
{
/* OpenMP directives are validated by the FE and never operated
- on by the optimizers. Furthermore, OMP_FOR may contain
+ on by the optimizers. Furthermore, GIMPLE_OMP_FOR may contain
non-gimple expressions when the main index variable has had
its address taken. This does not affect the loop itself
- because the header of an OMP_FOR is merely used to determine
+ because the header of an GIMPLE_OMP_FOR is merely used to determine
how to setup the parallel iteration. */
return false;
}
- if (!is_gimple_stmt (stmt))
+ /* FIXME. The C frontend passes unpromoted arguments in case it
+ didn't see a function declaration before the call. */
+ if (is_gimple_call (stmt))
{
- error ("is not a valid GIMPLE statement");
- goto fail;
+ tree decl;
+
+ if (!is_gimple_call_addr (gimple_call_fn (stmt)))
+ {
+ error ("invalid function in call statement");
+ return true;
+ }
+
+ decl = gimple_call_fndecl (stmt);
+ if (decl
+ && TREE_CODE (decl) == FUNCTION_DECL
+ && DECL_LOOPING_CONST_OR_PURE_P (decl)
+ && (!DECL_PURE_P (decl))
+ && (!TREE_READONLY (decl)))
+ {
+ error ("invalid pure const state for function");
+ return true;
+ }
}
- addr = walk_tree (&stmt, verify_expr, NULL, NULL);
+ memset (&wi, 0, sizeof (wi));
+ addr = walk_gimple_op (gsi_stmt (*gsi), verify_expr, &wi);
if (addr)
{
- debug_generic_stmt (addr);
- if (addr != stmt)
- {
- inform ("in statement");
- debug_generic_stmt (stmt);
- }
+ debug_generic_expr (addr);
+ inform ("in statement");
+ debug_gimple_stmt (stmt);
return true;
}
@@ -4258,12 +3847,12 @@ verify_stmt (tree stmt, bool last_in_block)
to match. */
if (lookup_stmt_eh_region (stmt) >= 0)
{
- if (!tree_could_throw_p (stmt))
+ if (!stmt_could_throw_p (stmt))
{
error ("statement marked for throw, but doesn%'t");
goto fail;
}
- if (!last_in_block && tree_can_throw_internal (stmt))
+ if (!last_in_block && stmt_can_throw_internal (stmt))
{
error ("statement marked for throw in middle of block");
goto fail;
@@ -4273,7 +3862,7 @@ verify_stmt (tree stmt, bool last_in_block)
return false;
fail:
- debug_generic_stmt (stmt);
+ debug_gimple_stmt (stmt);
return true;
}
@@ -4307,12 +3896,13 @@ tree_node_can_be_shared (tree t)
}
-/* Called via walk_trees. Verify tree sharing. */
+/* Called via walk_gimple_stmt. Verify tree sharing. */
static tree
-verify_node_sharing (tree * tp, int *walk_subtrees, void *data)
+verify_node_sharing (tree *tp, int *walk_subtrees, void *data)
{
- struct pointer_set_t *visited = (struct pointer_set_t *) data;
+ struct walk_stmt_info *wi = (struct walk_stmt_info *) data;
+ struct pointer_set_t *visited = (struct pointer_set_t *) wi->info;
if (tree_node_can_be_shared (*tp))
{
@@ -4327,35 +3917,6 @@ verify_node_sharing (tree * tp, int *walk_subtrees, void *data)
}
-/* Helper function for verify_gimple_tuples. */
-
-static tree
-verify_gimple_tuples_1 (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED,
- void *data ATTRIBUTE_UNUSED)
-{
- switch (TREE_CODE (*tp))
- {
- case MODIFY_EXPR:
- error ("unexpected non-tuple");
- debug_tree (*tp);
- gcc_unreachable ();
- return NULL_TREE;
-
- default:
- return NULL_TREE;
- }
-}
-
-/* Verify that there are no trees that should have been converted to
- gimple tuples. Return true if T contains a node that should have
- been converted to a gimple tuple, but hasn't. */
-
-static bool
-verify_gimple_tuples (tree t)
-{
- return walk_tree (&t, verify_gimple_tuples_1, NULL, NULL) != NULL;
-}
-
static bool eh_error_found;
static int
verify_eh_throw_stmt_node (void **slot, void *data)
@@ -4366,52 +3927,56 @@ verify_eh_throw_stmt_node (void **slot, void *data)
if (!pointer_set_contains (visited, node->stmt))
{
error ("Dead STMT in EH table");
- debug_generic_stmt (node->stmt);
+ debug_gimple_stmt (node->stmt);
eh_error_found = true;
}
return 0;
}
-/* Verify the GIMPLE statement chain. */
+
+/* Verify the GIMPLE statements in every basic block. */
void
verify_stmts (void)
{
basic_block bb;
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
bool err = false;
struct pointer_set_t *visited, *visited_stmts;
tree addr;
+ struct walk_stmt_info wi;
timevar_push (TV_TREE_STMT_VERIFY);
visited = pointer_set_create ();
visited_stmts = pointer_set_create ();
+ memset (&wi, 0, sizeof (wi));
+ wi.info = (void *) visited;
+
FOR_EACH_BB (bb)
{
- tree phi;
- int i;
+ gimple phi;
+ size_t i;
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
+ for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- int phi_num_args = PHI_NUM_ARGS (phi);
-
+ phi = gsi_stmt (gsi);
pointer_set_insert (visited_stmts, phi);
- if (bb_for_stmt (phi) != bb)
+ if (gimple_bb (phi) != bb)
{
- error ("bb_for_stmt (phi) is set to a wrong basic block");
+ error ("gimple_bb (phi) is set to a wrong basic block");
err |= true;
}
- for (i = 0; i < phi_num_args; i++)
+ for (i = 0; i < gimple_phi_num_args (phi); i++)
{
- tree t = PHI_ARG_DEF (phi, i);
+ tree t = gimple_phi_arg_def (phi, i);
tree addr;
if (!t)
{
error ("missing PHI def");
- debug_generic_stmt (phi);
+ debug_gimple_stmt (phi);
err |= true;
continue;
}
@@ -4421,9 +3986,9 @@ verify_stmts (void)
&& TREE_CODE (t) != FUNCTION_DECL
&& !is_gimple_min_invariant (t))
{
- error ("PHI def is not a GIMPLE value");
- debug_generic_stmt (phi);
- debug_generic_stmt (t);
+ error ("PHI argument is not a GIMPLE value");
+ debug_gimple_stmt (phi);
+ debug_generic_expr (t);
err |= true;
}
@@ -4431,38 +3996,59 @@ verify_stmts (void)
if (addr)
{
error ("incorrect sharing of tree nodes");
- debug_generic_stmt (phi);
- debug_generic_stmt (addr);
+ debug_gimple_stmt (phi);
+ debug_generic_expr (addr);
err |= true;
}
}
}
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); )
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); )
{
- tree stmt = bsi_stmt (bsi);
+ gimple stmt = gsi_stmt (gsi);
+
+ if (gimple_code (stmt) == GIMPLE_WITH_CLEANUP_EXPR
+ || gimple_code (stmt) == GIMPLE_BIND)
+ {
+ error ("invalid GIMPLE statement");
+ debug_gimple_stmt (stmt);
+ err |= true;
+ }
pointer_set_insert (visited_stmts, stmt);
- err |= verify_gimple_tuples (stmt);
- if (bb_for_stmt (stmt) != bb)
+ if (gimple_bb (stmt) != bb)
{
- error ("bb_for_stmt (stmt) is set to a wrong basic block");
+ error ("gimple_bb (stmt) is set to a wrong basic block");
err |= true;
}
- bsi_next (&bsi);
- err |= verify_stmt (stmt, bsi_end_p (bsi));
- addr = walk_tree (&stmt, verify_node_sharing, visited, NULL);
+ if (gimple_code (stmt) == GIMPLE_LABEL)
+ {
+ tree decl = gimple_label_label (stmt);
+ int uid = LABEL_DECL_UID (decl);
+
+ if (uid == -1
+ || VEC_index (basic_block, label_to_block_map, uid) != bb)
+ {
+ error ("incorrect entry in label_to_block_map.\n");
+ err |= true;
+ }
+ }
+
+ err |= verify_stmt (&gsi);
+ addr = walk_gimple_op (gsi_stmt (gsi), verify_node_sharing, &wi);
if (addr)
{
error ("incorrect sharing of tree nodes");
- debug_generic_stmt (stmt);
- debug_generic_stmt (addr);
+ debug_gimple_stmt (stmt);
+ debug_generic_expr (addr);
err |= true;
}
+ gsi_next (&gsi);
}
}
+
eh_error_found = false;
if (get_eh_throw_stmt_table (cfun))
htab_traverse (get_eh_throw_stmt_table (cfun),
@@ -4482,22 +4068,22 @@ verify_stmts (void)
/* Verifies that the flow information is OK. */
static int
-tree_verify_flow_info (void)
+gimple_verify_flow_info (void)
{
int err = 0;
basic_block bb;
- block_stmt_iterator bsi;
- tree stmt;
+ gimple_stmt_iterator gsi;
+ gimple stmt;
edge e;
edge_iterator ei;
- if (ENTRY_BLOCK_PTR->il.tree)
+ if (ENTRY_BLOCK_PTR->il.gimple)
{
error ("ENTRY_BLOCK has IL associated with it");
err = 1;
}
- if (EXIT_BLOCK_PTR->il.tree)
+ if (EXIT_BLOCK_PTR->il.gimple)
{
error ("EXIT_BLOCK has IL associated with it");
err = 1;
@@ -4514,41 +4100,42 @@ tree_verify_flow_info (void)
{
bool found_ctrl_stmt = false;
- stmt = NULL_TREE;
+ stmt = NULL;
/* Skip labels on the start of basic block. */
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- tree prev_stmt = stmt;
+ tree label;
+ gimple prev_stmt = stmt;
- stmt = bsi_stmt (bsi);
+ stmt = gsi_stmt (gsi);
- if (TREE_CODE (stmt) != LABEL_EXPR)
+ if (gimple_code (stmt) != GIMPLE_LABEL)
break;
- if (prev_stmt && DECL_NONLOCAL (LABEL_EXPR_LABEL (stmt)))
+ label = gimple_label_label (stmt);
+ if (prev_stmt && DECL_NONLOCAL (label))
{
error ("nonlocal label ");
- print_generic_expr (stderr, LABEL_EXPR_LABEL (stmt), 0);
+ print_generic_expr (stderr, label, 0);
fprintf (stderr, " is not first in a sequence of labels in bb %d",
bb->index);
err = 1;
}
- if (label_to_block (LABEL_EXPR_LABEL (stmt)) != bb)
+ if (label_to_block (label) != bb)
{
error ("label ");
- print_generic_expr (stderr, LABEL_EXPR_LABEL (stmt), 0);
+ print_generic_expr (stderr, label, 0);
fprintf (stderr, " to block does not match in bb %d",
bb->index);
err = 1;
}
- if (decl_function_context (LABEL_EXPR_LABEL (stmt))
- != current_function_decl)
+ if (decl_function_context (label) != current_function_decl)
{
error ("label ");
- print_generic_expr (stderr, LABEL_EXPR_LABEL (stmt), 0);
+ print_generic_expr (stderr, label, 0);
fprintf (stderr, " has incorrect context in bb %d",
bb->index);
err = 1;
@@ -4556,9 +4143,9 @@ tree_verify_flow_info (void)
}
/* Verify that body of basic block BB is free of control flow. */
- for (; !bsi_end_p (bsi); bsi_next (&bsi))
+ for (; !gsi_end_p (gsi); gsi_next (&gsi))
{
- tree stmt = bsi_stmt (bsi);
+ gimple stmt = gsi_stmt (gsi);
if (found_ctrl_stmt)
{
@@ -4570,20 +4157,20 @@ tree_verify_flow_info (void)
if (stmt_ends_bb_p (stmt))
found_ctrl_stmt = true;
- if (TREE_CODE (stmt) == LABEL_EXPR)
+ if (gimple_code (stmt) == GIMPLE_LABEL)
{
error ("label ");
- print_generic_expr (stderr, LABEL_EXPR_LABEL (stmt), 0);
+ print_generic_expr (stderr, gimple_label_label (stmt), 0);
fprintf (stderr, " in the middle of basic block %d", bb->index);
err = 1;
}
}
- bsi = bsi_last (bb);
- if (bsi_end_p (bsi))
+ gsi = gsi_last_bb (bb);
+ if (gsi_end_p (gsi))
continue;
- stmt = bsi_stmt (bsi);
+ stmt = gsi_stmt (gsi);
err |= verify_eh_edges (stmt);
@@ -4598,37 +4185,30 @@ tree_verify_flow_info (void)
}
}
- if (TREE_CODE (stmt) != COND_EXPR)
+ if (gimple_code (stmt) != GIMPLE_COND)
{
/* Verify that there are no edges with EDGE_TRUE/FALSE_FLAG set
after anything else but if statement. */
FOR_EACH_EDGE (e, ei, bb->succs)
if (e->flags & (EDGE_TRUE_VALUE | EDGE_FALSE_VALUE))
{
- error ("true/false edge after a non-COND_EXPR in bb %d",
+ error ("true/false edge after a non-GIMPLE_COND in bb %d",
bb->index);
err = 1;
}
}
- switch (TREE_CODE (stmt))
+ switch (gimple_code (stmt))
{
- case COND_EXPR:
+ case GIMPLE_COND:
{
edge true_edge;
edge false_edge;
- if (COND_EXPR_THEN (stmt) != NULL_TREE
- || COND_EXPR_ELSE (stmt) != NULL_TREE)
- {
- error ("COND_EXPR with code in branches at the end of bb %d",
- bb->index);
- err = 1;
- }
-
extract_true_false_edges_from_block (bb, &true_edge, &false_edge);
- if (!true_edge || !false_edge
+ if (!true_edge
+ || !false_edge
|| !(true_edge->flags & EDGE_TRUE_VALUE)
|| !(false_edge->flags & EDGE_FALSE_VALUE)
|| (true_edge->flags & (EDGE_FALLTHRU | EDGE_ABNORMAL))
@@ -4642,7 +4222,7 @@ tree_verify_flow_info (void)
}
break;
- case GOTO_EXPR:
+ case GIMPLE_GOTO:
if (simple_goto_p (stmt))
{
error ("explicit goto at end of bb %d", bb->index);
@@ -4664,7 +4244,7 @@ tree_verify_flow_info (void)
}
break;
- case RETURN_EXPR:
+ case GIMPLE_RETURN:
if (!single_succ_p (bb)
|| (single_succ_edge (bb)->flags
& (EDGE_FALLTHRU | EDGE_ABNORMAL
@@ -4681,41 +4261,37 @@ tree_verify_flow_info (void)
}
break;
- case SWITCH_EXPR:
+ case GIMPLE_SWITCH:
{
tree prev;
edge e;
size_t i, n;
- tree vec;
- vec = SWITCH_LABELS (stmt);
- n = TREE_VEC_LENGTH (vec);
+ n = gimple_switch_num_labels (stmt);
/* Mark all the destination basic blocks. */
for (i = 0; i < n; ++i)
{
- tree lab = CASE_LABEL (TREE_VEC_ELT (vec, i));
+ tree lab = CASE_LABEL (gimple_switch_label (stmt, i));
basic_block label_bb = label_to_block (lab);
-
gcc_assert (!label_bb->aux || label_bb->aux == (void *)1);
label_bb->aux = (void *)1;
}
/* Verify that the case labels are sorted. */
- prev = TREE_VEC_ELT (vec, 0);
+ prev = gimple_switch_label (stmt, 0);
for (i = 1; i < n; ++i)
{
- tree c = TREE_VEC_ELT (vec, i);
- if (! CASE_LOW (c))
+ tree c = gimple_switch_label (stmt, i);
+ if (!CASE_LOW (c))
{
- if (i != n - 1)
- {
- error ("found default case not at end of case vector");
- err = 1;
- }
+ error ("found default case not at the start of "
+ "case vector");
+ err = 1;
continue;
}
- if (! tree_int_cst_lt (CASE_LOW (prev), CASE_LOW (c)))
+ if (CASE_LOW (prev)
+ && !tree_int_cst_lt (CASE_LOW (prev), CASE_LOW (c)))
{
error ("case labels not sorted: ");
print_generic_expr (stderr, prev, 0);
@@ -4738,6 +4314,7 @@ tree_verify_flow_info (void)
bb->index, e->dest->index);
err = 1;
}
+
e->dest->aux = (void *)2;
if ((e->flags & (EDGE_FALLTHRU | EDGE_ABNORMAL
| EDGE_TRUE_VALUE | EDGE_FALSE_VALUE)))
@@ -4751,13 +4328,12 @@ tree_verify_flow_info (void)
/* Check that we have all of them. */
for (i = 0; i < n; ++i)
{
- tree lab = CASE_LABEL (TREE_VEC_ELT (vec, i));
+ tree lab = CASE_LABEL (gimple_switch_label (stmt, i));
basic_block label_bb = label_to_block (lab);
if (label_bb->aux != (void *)2)
{
- error ("missing edge %i->%i",
- bb->index, label_bb->index);
+ error ("missing edge %i->%i", bb->index, label_bb->index);
err = 1;
}
}
@@ -4781,12 +4357,13 @@ tree_verify_flow_info (void)
by edge FALLTHRU. */
static void
-tree_make_forwarder_block (edge fallthru)
+gimple_make_forwarder_block (edge fallthru)
{
edge e;
edge_iterator ei;
basic_block dummy, bb;
- tree phi, new_phi, var;
+ tree var;
+ gimple_stmt_iterator gsi;
dummy = fallthru->src;
bb = fallthru->dest;
@@ -4796,18 +4373,18 @@ tree_make_forwarder_block (edge fallthru)
/* If we redirected a branch we must create new PHI nodes at the
start of BB. */
- for (phi = phi_nodes (dummy); phi; phi = PHI_CHAIN (phi))
+ for (gsi = gsi_start_phis (dummy); !gsi_end_p (gsi); gsi_next (&gsi))
{
- var = PHI_RESULT (phi);
+ gimple phi, new_phi;
+
+ phi = gsi_stmt (gsi);
+ var = gimple_phi_result (phi);
new_phi = create_phi_node (var, bb);
SSA_NAME_DEF_STMT (var) = new_phi;
- SET_PHI_RESULT (phi, make_ssa_name (SSA_NAME_VAR (var), phi));
- add_phi_arg (new_phi, PHI_RESULT (phi), fallthru);
+ gimple_phi_set_result (phi, make_ssa_name (SSA_NAME_VAR (var), phi));
+ add_phi_arg (new_phi, gimple_phi_result (phi), fallthru);
}
- /* Ensure that the PHI node chain is in the same order. */
- set_phi_nodes (bb, phi_reverse (phi_nodes (bb)));
-
/* Add the arguments we have stored on edges. */
FOR_EACH_EDGE (e, ei, bb->preds)
{
@@ -4823,29 +4400,30 @@ tree_make_forwarder_block (edge fallthru)
Create one if it doesn't exist. */
tree
-tree_block_label (basic_block bb)
+gimple_block_label (basic_block bb)
{
- block_stmt_iterator i, s = bsi_start (bb);
+ gimple_stmt_iterator i, s = gsi_start_bb (bb);
bool first = true;
- tree label, stmt;
+ tree label;
+ gimple stmt;
- for (i = s; !bsi_end_p (i); first = false, bsi_next (&i))
+ for (i = s; !gsi_end_p (i); first = false, gsi_next (&i))
{
- stmt = bsi_stmt (i);
- if (TREE_CODE (stmt) != LABEL_EXPR)
+ stmt = gsi_stmt (i);
+ if (gimple_code (stmt) != GIMPLE_LABEL)
break;
- label = LABEL_EXPR_LABEL (stmt);
+ label = gimple_label_label (stmt);
if (!DECL_NONLOCAL (label))
{
if (!first)
- bsi_move_before (&i, &s);
+ gsi_move_before (&i, &s);
return label;
}
}
label = create_artificial_label ();
- stmt = build1 (LABEL_EXPR, void_type_node, label);
- bsi_insert_before (&s, stmt, BSI_NEW_STMT);
+ stmt = gimple_build_label (label);
+ gsi_insert_before (&s, stmt, GSI_NEW_STMT);
return label;
}
@@ -4857,11 +4435,11 @@ tree_block_label (basic_block bb)
redirect_edge_and_branch. */
static edge
-tree_try_redirect_by_replacing_jump (edge e, basic_block target)
+gimple_try_redirect_by_replacing_jump (edge e, basic_block target)
{
basic_block src = e->src;
- block_stmt_iterator b;
- tree stmt;
+ gimple_stmt_iterator i;
+ gimple stmt;
/* We can replace or remove a complex jump only when we have exactly
two edges. */
@@ -4871,15 +4449,15 @@ tree_try_redirect_by_replacing_jump (edge e, basic_block target)
|| EDGE_SUCC (src, EDGE_SUCC (src, 0) == e)->dest != target)
return NULL;
- b = bsi_last (src);
- if (bsi_end_p (b))
+ i = gsi_last_bb (src);
+ if (gsi_end_p (i))
return NULL;
- stmt = bsi_stmt (b);
- if (TREE_CODE (stmt) == COND_EXPR
- || TREE_CODE (stmt) == SWITCH_EXPR)
+ stmt = gsi_stmt (i);
+
+ if (gimple_code (stmt) == GIMPLE_COND || gimple_code (stmt) == GIMPLE_SWITCH)
{
- bsi_remove (&b, true);
+ gsi_remove (&i, true);
e = ssa_redirect_edge (e, target);
e->flags = EDGE_FALLTHRU;
return e;
@@ -4893,41 +4471,41 @@ tree_try_redirect_by_replacing_jump (edge e, basic_block target)
edge representing the redirected branch. */
static edge
-tree_redirect_edge_and_branch (edge e, basic_block dest)
+gimple_redirect_edge_and_branch (edge e, basic_block dest)
{
basic_block bb = e->src;
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
edge ret;
- tree stmt;
+ gimple stmt;
if (e->flags & EDGE_ABNORMAL)
return NULL;
if (e->src != ENTRY_BLOCK_PTR
- && (ret = tree_try_redirect_by_replacing_jump (e, dest)))
+ && (ret = gimple_try_redirect_by_replacing_jump (e, dest)))
return ret;
if (e->dest == dest)
return NULL;
- bsi = bsi_last (bb);
- stmt = bsi_end_p (bsi) ? NULL : bsi_stmt (bsi);
+ gsi = gsi_last_bb (bb);
+ stmt = gsi_end_p (gsi) ? NULL : gsi_stmt (gsi);
- switch (stmt ? TREE_CODE (stmt) : ERROR_MARK)
+ switch (stmt ? gimple_code (stmt) : ERROR_MARK)
{
- case COND_EXPR:
+ case GIMPLE_COND:
/* For COND_EXPR, we only need to redirect the edge. */
break;
- case GOTO_EXPR:
+ case GIMPLE_GOTO:
/* No non-abnormal edges should lead from a non-simple goto, and
simple ones should be represented implicitly. */
gcc_unreachable ();
- case SWITCH_EXPR:
+ case GIMPLE_SWITCH:
{
+ tree label = gimple_block_label (dest);
tree cases = get_cases_for_edge (e, stmt);
- tree label = tree_block_label (dest);
/* If we have a list of cases associated with E, then use it
as it's a lot faster than walking the entire case vector. */
@@ -4956,13 +4534,11 @@ tree_redirect_edge_and_branch (edge e, basic_block dest)
}
else
{
- tree vec = SWITCH_LABELS (stmt);
- size_t i, n = TREE_VEC_LENGTH (vec);
+ size_t i, n = gimple_switch_num_labels (stmt);
for (i = 0; i < n; i++)
{
- tree elt = TREE_VEC_ELT (vec, i);
-
+ tree elt = gimple_switch_label (stmt, i);
if (label_to_block (CASE_LABEL (elt)) == e->dest)
CASE_LABEL (elt) = label;
}
@@ -4971,15 +4547,15 @@ tree_redirect_edge_and_branch (edge e, basic_block dest)
break;
}
- case RETURN_EXPR:
- bsi_remove (&bsi, true);
+ case GIMPLE_RETURN:
+ gsi_remove (&gsi, true);
e->flags |= EDGE_FALLTHRU;
break;
- case OMP_RETURN:
- case OMP_CONTINUE:
- case OMP_SECTIONS_SWITCH:
- case OMP_FOR:
+ case GIMPLE_OMP_RETURN:
+ case GIMPLE_OMP_CONTINUE:
+ case GIMPLE_OMP_SECTIONS_SWITCH:
+ case GIMPLE_OMP_FOR:
/* The edges from OMP constructs can be simply redirected. */
break;
@@ -5002,7 +4578,7 @@ tree_redirect_edge_and_branch (edge e, basic_block dest)
it to the destination of the other edge from E->src. */
static bool
-tree_can_remove_branch_p (const_edge e)
+gimple_can_remove_branch_p (const_edge e)
{
if (e->flags & EDGE_ABNORMAL)
return false;
@@ -5013,9 +4589,9 @@ tree_can_remove_branch_p (const_edge e)
/* Simple wrapper, as we can always redirect fallthru edges. */
static basic_block
-tree_redirect_edge_and_branch_force (edge e, basic_block dest)
+gimple_redirect_edge_and_branch_force (edge e, basic_block dest)
{
- e = tree_redirect_edge_and_branch (e, dest);
+ e = gimple_redirect_edge_and_branch (e, dest);
gcc_assert (e);
return NULL;
@@ -5026,11 +4602,12 @@ tree_redirect_edge_and_branch_force (edge e, basic_block dest)
labels). If STMT is NULL, BB is split just after the labels. */
static basic_block
-tree_split_block (basic_block bb, void *stmt)
+gimple_split_block (basic_block bb, void *stmt)
{
- block_stmt_iterator bsi;
- tree_stmt_iterator tsi_tgt;
- tree act, list;
+ gimple_stmt_iterator gsi;
+ gimple_stmt_iterator gsi_tgt;
+ gimple act;
+ gimple_seq list;
basic_block new_bb;
edge e;
edge_iterator ei;
@@ -5043,14 +4620,14 @@ tree_split_block (basic_block bb, void *stmt)
FOR_EACH_EDGE (e, ei, new_bb->succs)
e->src = new_bb;
- if (stmt && TREE_CODE ((tree) stmt) == LABEL_EXPR)
+ if (stmt && gimple_code ((gimple) stmt) == GIMPLE_LABEL)
stmt = NULL;
- /* Move everything from BSI to the new basic block. */
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ /* Move everything from GSI to the new basic block. */
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- act = bsi_stmt (bsi);
- if (TREE_CODE (act) == LABEL_EXPR)
+ act = gsi_stmt (gsi);
+ if (gimple_code (act) == GIMPLE_LABEL)
continue;
if (!stmt)
@@ -5058,23 +4635,23 @@ tree_split_block (basic_block bb, void *stmt)
if (stmt == act)
{
- bsi_next (&bsi);
+ gsi_next (&gsi);
break;
}
}
- if (bsi_end_p (bsi))
+ if (gsi_end_p (gsi))
return new_bb;
/* Split the statement list - avoid re-creating new containers as this
brings ugly quadratic memory consumption in the inliner.
(We are still quadratic since we need to update stmt BB pointers,
sadly.) */
- list = tsi_split_statement_list_before (&bsi.tsi);
- set_bb_stmt_list (new_bb, list);
- for (tsi_tgt = tsi_start (list);
- !tsi_end_p (tsi_tgt); tsi_next (&tsi_tgt))
- change_bb_for_stmt (tsi_stmt (tsi_tgt), new_bb);
+ list = gsi_split_seq_before (&gsi);
+ set_bb_seq (new_bb, list);
+ for (gsi_tgt = gsi_start (list);
+ !gsi_end_p (gsi_tgt); gsi_next (&gsi_tgt))
+ gimple_set_bb (gsi_stmt (gsi_tgt), new_bb);
return new_bb;
}
@@ -5083,7 +4660,7 @@ tree_split_block (basic_block bb, void *stmt)
/* Moves basic block BB after block AFTER. */
static bool
-tree_move_block_after (basic_block bb, basic_block after)
+gimple_move_block_after (basic_block bb, basic_block after)
{
if (bb->prev_bb == after)
return true;
@@ -5098,52 +4675,49 @@ tree_move_block_after (basic_block bb, basic_block after)
/* Return true if basic_block can be duplicated. */
static bool
-tree_can_duplicate_bb_p (const_basic_block bb ATTRIBUTE_UNUSED)
+gimple_can_duplicate_bb_p (const_basic_block bb ATTRIBUTE_UNUSED)
{
return true;
}
-
/* Create a duplicate of the basic block BB. NOTE: This does not
preserve SSA form. */
static basic_block
-tree_duplicate_bb (basic_block bb)
+gimple_duplicate_bb (basic_block bb)
{
basic_block new_bb;
- block_stmt_iterator bsi, bsi_tgt;
- tree phi;
+ gimple_stmt_iterator gsi, gsi_tgt;
+ gimple_seq phis = phi_nodes (bb);
+ gimple phi, stmt, copy;
new_bb = create_empty_bb (EXIT_BLOCK_PTR->prev_bb);
/* Copy the PHI nodes. We ignore PHI node arguments here because
the incoming edges have not been setup yet. */
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
+ for (gsi = gsi_start (phis); !gsi_end_p (gsi); gsi_next (&gsi))
{
- tree copy = create_phi_node (PHI_RESULT (phi), new_bb);
- create_new_def_for (PHI_RESULT (copy), copy, PHI_RESULT_PTR (copy));
+ phi = gsi_stmt (gsi);
+ copy = create_phi_node (gimple_phi_result (phi), new_bb);
+ create_new_def_for (gimple_phi_result (copy), copy,
+ gimple_phi_result_ptr (copy));
}
- /* Keep the chain of PHI nodes in the same order so that they can be
- updated by ssa_redirect_edge. */
- set_phi_nodes (new_bb, phi_reverse (phi_nodes (new_bb)));
-
- bsi_tgt = bsi_start (new_bb);
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ gsi_tgt = gsi_start_bb (new_bb);
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
def_operand_p def_p;
ssa_op_iter op_iter;
- tree stmt, copy;
int region;
- stmt = bsi_stmt (bsi);
- if (TREE_CODE (stmt) == LABEL_EXPR)
+ stmt = gsi_stmt (gsi);
+ if (gimple_code (stmt) == GIMPLE_LABEL)
continue;
/* Create a new copy of STMT and duplicate STMT's virtual
operands. */
- copy = unshare_expr (stmt);
- bsi_insert_after (&bsi_tgt, copy, BSI_NEW_STMT);
+ copy = gimple_copy (stmt);
+ gsi_insert_after (&gsi_tgt, copy, GSI_NEW_STMT);
copy_virtual_operands (copy, stmt);
region = lookup_stmt_eh_region (stmt);
if (region >= 0)
@@ -5167,9 +4741,11 @@ add_phi_args_after_copy_edge (edge e_copy)
basic_block bb, bb_copy = e_copy->src, dest;
edge e;
edge_iterator ei;
- tree phi, phi_copy, phi_next, def;
+ gimple phi, phi_copy;
+ tree def;
+ gimple_stmt_iterator psi, psi_copy;
- if (!phi_nodes (e_copy->dest))
+ if (gimple_seq_empty_p (phi_nodes (e_copy->dest)))
return;
bb = bb_copy->flags & BB_DUPLICATED ? get_bb_original (bb_copy) : bb_copy;
@@ -5195,11 +4771,13 @@ add_phi_args_after_copy_edge (edge e_copy)
gcc_assert (e != NULL);
}
- for (phi = phi_nodes (e->dest), phi_copy = phi_nodes (e_copy->dest);
- phi;
- phi = phi_next, phi_copy = PHI_CHAIN (phi_copy))
+ for (psi = gsi_start_phis (e->dest),
+ psi_copy = gsi_start_phis (e_copy->dest);
+ !gsi_end_p (psi);
+ gsi_next (&psi), gsi_next (&psi_copy))
{
- phi_next = PHI_CHAIN (phi);
+ phi = gsi_stmt (psi);
+ phi_copy = gsi_stmt (psi_copy);
def = PHI_ARG_DEF_FROM_EDGE (phi, e);
add_phi_arg (phi_copy, def, e_copy);
}
@@ -5213,8 +4791,8 @@ add_phi_args_after_copy_edge (edge e_copy)
void
add_phi_args_after_copy_bb (basic_block bb_copy)
{
- edge_iterator ei;
edge e_copy;
+ edge_iterator ei;
FOR_EACH_EDGE (e_copy, ei, bb_copy->succs)
{
@@ -5256,7 +4834,7 @@ add_phi_args_after_copy (basic_block *region_copy, unsigned n_region,
true otherwise. */
bool
-tree_duplicate_sese_region (edge entry, edge exit,
+gimple_duplicate_sese_region (edge entry, edge exit,
basic_block *region, unsigned n_region,
basic_block *region_copy)
{
@@ -5422,9 +5000,9 @@ tree_duplicate_sese_region (edge entry, edge exit,
*/
bool
-tree_duplicate_sese_tail (edge entry, edge exit,
- basic_block *region, unsigned n_region,
- basic_block *region_copy)
+gimple_duplicate_sese_tail (edge entry ATTRIBUTE_UNUSED, edge exit ATTRIBUTE_UNUSED,
+ basic_block *region ATTRIBUTE_UNUSED, unsigned n_region ATTRIBUTE_UNUSED,
+ basic_block *region_copy ATTRIBUTE_UNUSED)
{
unsigned i;
bool free_region_copy = false;
@@ -5435,8 +5013,8 @@ tree_duplicate_sese_tail (edge entry, edge exit,
int total_freq = 0, exit_freq = 0;
gcov_type total_count = 0, exit_count = 0;
edge exits[2], nexits[2], e;
- block_stmt_iterator bsi;
- tree cond;
+ gimple_stmt_iterator gsi;
+ gimple cond_stmt;
edge sorig, snew;
gcc_assert (EDGE_COUNT (exit->src->succs) == 2);
@@ -5525,10 +5103,13 @@ tree_duplicate_sese_tail (edge entry, edge exit,
switch_bb = split_edge (entry);
set_immediate_dominator (CDI_DOMINATORS, nentry_bb, switch_bb);
- bsi = bsi_last (switch_bb);
- cond = last_stmt (exit->src);
- gcc_assert (TREE_CODE (cond) == COND_EXPR);
- bsi_insert_after (&bsi, unshare_expr (cond), BSI_NEW_STMT);
+ gsi = gsi_last_bb (switch_bb);
+ cond_stmt = last_stmt (exit->src);
+ gcc_assert (gimple_code (cond_stmt) == GIMPLE_COND);
+ cond_stmt = gimple_copy (cond_stmt);
+ gimple_cond_set_lhs (cond_stmt, unshare_expr (gimple_cond_lhs (cond_stmt)));
+ gimple_cond_set_rhs (cond_stmt, unshare_expr (gimple_cond_rhs (cond_stmt)));
+ gsi_insert_after (&gsi, cond_stmt, GSI_NEW_STMT);
sorig = single_succ_edge (switch_bb);
sorig->flags = exits[1]->flags;
@@ -5543,9 +5124,9 @@ tree_duplicate_sese_tail (edge entry, edge exit,
/* Get rid of now superfluous conditions and associated edges (and phi node
arguments). */
e = redirect_edge_and_branch (exits[0], exits[1]->dest);
- PENDING_STMT (e) = NULL_TREE;
+ PENDING_STMT (e) = NULL;
e = redirect_edge_and_branch (nexits[1], nexits[0]->dest);
- PENDING_STMT (e) = NULL_TREE;
+ PENDING_STMT (e) = NULL;
/* Anything that is outside of the region, but was dominated by something
inside needs to update dominance info. */
@@ -5562,11 +5143,6 @@ tree_duplicate_sese_tail (edge entry, edge exit,
return true;
}
-/*
-DEF_VEC_P(basic_block);
-DEF_VEC_ALLOC_P(basic_block,heap);
-*/
-
/* Add all the blocks dominated by ENTRY to the array BBS_P. Stop
adding blocks when the dominator traversal reaches EXIT. This
function silently assumes that ENTRY strictly dominates EXIT. */
@@ -5627,6 +5203,7 @@ replace_by_duplicate_decl (tree *tp, struct pointer_map_t *vars_map,
*tp = new_t;
}
+
/* Creates an ssa name in TO_CONTEXT equivalent to NAME.
VARS_MAP maps old ssa names and var_decls to the new ones. */
@@ -5679,44 +5256,16 @@ struct move_stmt_d
DECL_CONTEXT of every local variable referenced in *TP. */
static tree
-move_stmt_r (tree *tp, int *walk_subtrees, void *data)
+move_stmt_op (tree *tp, int *walk_subtrees, void *data)
{
- struct move_stmt_d *p = (struct move_stmt_d *) data;
+ struct walk_stmt_info *wi = (struct walk_stmt_info *) data;
+ struct move_stmt_d *p = (struct move_stmt_d *) wi->info;
tree t = *tp;
- if (EXPR_P (t) || GIMPLE_STMT_P (t))
- {
- tree block = TREE_BLOCK (t);
- if (p->orig_block == NULL_TREE
- || block == p->orig_block
- || block == NULL_TREE)
- TREE_BLOCK (t) = p->new_block;
-#ifdef ENABLE_CHECKING
- else if (block != p->new_block)
- {
- while (block && block != p->orig_block)
- block = BLOCK_SUPERCONTEXT (block);
- gcc_assert (block);
- }
-#endif
- }
-
- if (OMP_DIRECTIVE_P (t)
- && TREE_CODE (t) != OMP_RETURN
- && TREE_CODE (t) != OMP_CONTINUE)
- {
- /* Do not remap variables inside OMP directives. Variables
- referenced in clauses and directive header belong to the
- parent function and should not be moved into the child
- function. */
- bool save_remap_decls_p = p->remap_decls_p;
- p->remap_decls_p = false;
- *walk_subtrees = 0;
-
- walk_tree (&OMP_BODY (t), move_stmt_r, p, NULL);
+ if (EXPR_P (t))
+ /* We should never have TREE_BLOCK set on non-statements. */
+ gcc_assert (!TREE_BLOCK (t));
- p->remap_decls_p = save_remap_decls_p;
- }
else if (DECL_P (t) || TREE_CODE (t) == SSA_NAME)
{
if (TREE_CODE (t) == SSA_NAME)
@@ -5764,20 +5313,67 @@ move_stmt_r (tree *tp, int *walk_subtrees, void *data)
return NULL_TREE;
}
+/* Like move_stmt_op, but for gimple statements.
+
+ Helper for move_block_to_fn. Set GIMPLE_BLOCK in every expression
+ contained in the current statement in *GSI_P and change the
+ DECL_CONTEXT of every local variable referenced in the current
+ statement. */
+
+static tree
+move_stmt_r (gimple_stmt_iterator *gsi_p, bool *handled_ops_p,
+ struct walk_stmt_info *wi)
+{
+ struct move_stmt_d *p = (struct move_stmt_d *) wi->info;
+ gimple stmt = gsi_stmt (*gsi_p);
+ tree block = gimple_block (stmt);
+
+ if (p->orig_block == NULL_TREE
+ || block == p->orig_block
+ || block == NULL_TREE)
+ gimple_set_block (stmt, p->new_block);
+#ifdef ENABLE_CHECKING
+ else if (block != p->new_block)
+ {
+ while (block && block != p->orig_block)
+ block = BLOCK_SUPERCONTEXT (block);
+ gcc_assert (block);
+ }
+#endif
+
+ if (is_gimple_omp (stmt)
+ && gimple_code (stmt) != GIMPLE_OMP_RETURN
+ && gimple_code (stmt) != GIMPLE_OMP_CONTINUE)
+ {
+ /* Do not remap variables inside OMP directives. Variables
+ referenced in clauses and directive header belong to the
+ parent function and should not be moved into the child
+ function. */
+ bool save_remap_decls_p = p->remap_decls_p;
+ p->remap_decls_p = false;
+ *handled_ops_p = true;
+
+ walk_gimple_seq (gimple_omp_body (stmt), move_stmt_r, move_stmt_op, wi);
+
+ p->remap_decls_p = save_remap_decls_p;
+ }
+
+ return NULL_TREE;
+}
+
/* Marks virtual operands of all statements in basic blocks BBS for
renaming. */
void
mark_virtual_ops_in_bb (basic_block bb)
{
- tree phi;
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
- mark_virtual_ops_for_renaming (phi);
+ for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ mark_virtual_ops_for_renaming (gsi_stmt (gsi));
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
- mark_virtual_ops_for_renaming (bsi_stmt (bsi));
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ mark_virtual_ops_for_renaming (gsi_stmt (gsi));
}
/* Marks virtual operands of all statements in basic blocks BBS for
@@ -5811,9 +5407,8 @@ move_block_to_fn (struct function *dest_cfun, basic_block bb,
struct control_flow_graph *cfg;
edge_iterator ei;
edge e;
- block_stmt_iterator si;
+ gimple_stmt_iterator si;
unsigned old_len, new_len;
- tree phi, next_phi;
/* Remove BB from dominance structures. */
delete_from_dominance_info (CDI_DOMINATORS, bb);
@@ -5853,18 +5448,18 @@ move_block_to_fn (struct function *dest_cfun, basic_block bb,
bb->index, bb);
/* Remap the variables in phi nodes. */
- for (phi = phi_nodes (bb); phi; phi = next_phi)
+ for (si = gsi_start_phis (bb); !gsi_end_p (si); )
{
+ gimple phi = gsi_stmt (si);
use_operand_p use;
tree op = PHI_RESULT (phi);
ssa_op_iter oi;
- next_phi = PHI_CHAIN (phi);
if (!is_gimple_reg (op))
{
/* Remove the phi nodes for virtual operands (alias analysis will be
run for the new function, anyway). */
- remove_phi_node (phi, NULL, true);
+ remove_phi_node (&si, true);
continue;
}
@@ -5876,18 +5471,23 @@ move_block_to_fn (struct function *dest_cfun, basic_block bb,
if (TREE_CODE (op) == SSA_NAME)
SET_USE (use, replace_ssa_name (op, d->vars_map, dest_cfun->decl));
}
+
+ gsi_next (&si);
}
- for (si = bsi_start (bb); !bsi_end_p (si); bsi_next (&si))
+ for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si))
{
- tree stmt = bsi_stmt (si);
+ gimple stmt = gsi_stmt (si);
int region;
+ struct walk_stmt_info wi;
- walk_tree (&stmt, move_stmt_r, d, NULL);
+ memset (&wi, 0, sizeof (wi));
+ wi.info = d;
+ walk_gimple_stmt (&si, move_stmt_r, move_stmt_op, &wi);
- if (TREE_CODE (stmt) == LABEL_EXPR)
+ if (gimple_code (stmt) == GIMPLE_LABEL)
{
- tree label = LABEL_EXPR_LABEL (stmt);
+ tree label = gimple_label_label (stmt);
int uid = LABEL_DECL_UID (label);
gcc_assert (uid > -1);
@@ -5908,11 +5508,8 @@ move_block_to_fn (struct function *dest_cfun, basic_block bb,
if (uid >= dest_cfun->cfg->last_label_uid)
dest_cfun->cfg->last_label_uid = uid + 1;
}
- else if (TREE_CODE (stmt) == RESX_EXPR && eh_offset != 0)
- TREE_OPERAND (stmt, 0) =
- build_int_cst (NULL_TREE,
- TREE_INT_CST_LOW (TREE_OPERAND (stmt, 0))
- + eh_offset);
+ else if (gimple_code (stmt) == GIMPLE_RESX && eh_offset != 0)
+ gimple_resx_set_region (stmt, gimple_resx_region (stmt) + eh_offset);
region = lookup_stmt_eh_region (stmt);
if (region >= 0)
@@ -5939,15 +5536,15 @@ static int
find_outermost_region_in_block (struct function *src_cfun,
basic_block bb, int region)
{
- block_stmt_iterator si;
+ gimple_stmt_iterator si;
- for (si = bsi_start (bb); !bsi_end_p (si); bsi_next (&si))
+ for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si))
{
- tree stmt = bsi_stmt (si);
+ gimple stmt = gsi_stmt (si);
int stmt_region;
- if (TREE_CODE (stmt) == RESX_EXPR)
- stmt_region = TREE_INT_CST_LOW (TREE_OPERAND (stmt, 0));
+ if (gimple_code (stmt) == GIMPLE_RESX)
+ stmt_region = gimple_resx_region (stmt);
else
stmt_region = lookup_stmt_eh_region_fn (src_cfun, stmt);
if (stmt_region > 0)
@@ -6242,7 +5839,8 @@ move_sese_region_to_fn (struct function *dest_cfun, basic_block entry_bb,
}
-/* Dump FUNCTION_DECL FN to file FILE using FLAGS (see TDF_* in tree.h) */
+/* Dump FUNCTION_DECL FN to file FILE using FLAGS (see TDF_* in tree-pass.h)
+ */
void
dump_function_to_file (tree fn, FILE *file, int flags)
@@ -6276,7 +5874,7 @@ dump_function_to_file (tree fn, FILE *file, int flags)
if (dsf && (flags & TDF_DETAILS))
dump_eh_tree (file, dsf);
- if (flags & TDF_RAW)
+ if (flags & TDF_RAW && !gimple_body (fn))
{
dump_node (fn, TDF_SLIM | flags, file);
return;
@@ -6307,7 +5905,7 @@ dump_function_to_file (tree fn, FILE *file, int flags)
if (cfun && cfun->decl == fn && cfun->cfg && basic_block_info)
{
- /* Make a CFG based dump. */
+ /* If the CFG has been built, emit a CFG-based dump. */
check_bb_profile (ENTRY_BLOCK_PTR, file);
if (!ignore_topmost_bind)
fprintf (file, "{\n");
@@ -6316,11 +5914,34 @@ dump_function_to_file (tree fn, FILE *file, int flags)
fprintf (file, "\n");
FOR_EACH_BB (bb)
- dump_generic_bb (file, bb, 2, flags);
+ gimple_dump_bb (bb, file, 2, flags);
fprintf (file, "}\n");
check_bb_profile (EXIT_BLOCK_PTR, file);
}
+ else if (DECL_SAVED_TREE (fn) == NULL)
+ {
+ /* The function is now in GIMPLE form but the CFG has not been
+ built yet. Emit the single sequence of GIMPLE statements
+ that make up its body. */
+ gimple_seq body = gimple_body (fn);
+
+ if (gimple_seq_first_stmt (body)
+ && gimple_seq_first_stmt (body) == gimple_seq_last_stmt (body)
+ && gimple_code (gimple_seq_first_stmt (body)) == GIMPLE_BIND)
+ print_gimple_seq (file, body, 0, flags);
+ else
+ {
+ if (!ignore_topmost_bind)
+ fprintf (file, "{\n");
+
+ if (any_var)
+ fprintf (file, "\n");
+
+ print_gimple_seq (file, body, 2, flags);
+ fprintf (file, "}\n");
+ }
+ }
else
{
int indent;
@@ -6417,7 +6038,7 @@ print_loops_bb (FILE *file, basic_block bb, int indent, int verbosity)
if (verbosity >= 3)
{
fprintf (file, "%s {\n", s_indent);
- tree_dump_bb (bb, file, indent + 4);
+ gimple_dump_bb (bb, file, indent + 4, TDF_VOPS|TDF_MEMSYMS);
fprintf (file, "%s }\n", s_indent);
}
}
@@ -6531,10 +6152,10 @@ debug_loop_num (unsigned num, int verbosity)
otherwise. */
static bool
-tree_block_ends_with_call_p (basic_block bb)
+gimple_block_ends_with_call_p (basic_block bb)
{
- block_stmt_iterator bsi = bsi_last (bb);
- return get_call_expr_in (bsi_stmt (bsi)) != NULL;
+ gimple_stmt_iterator gsi = gsi_last_bb (bb);
+ return is_gimple_call (gsi_stmt (gsi));
}
@@ -6542,23 +6163,21 @@ tree_block_ends_with_call_p (basic_block bb)
otherwise. */
static bool
-tree_block_ends_with_condjump_p (const_basic_block bb)
+gimple_block_ends_with_condjump_p (const_basic_block bb)
{
- /* This CONST_CAST is okay because last_stmt doesn't modify its
- argument and the return value is not modified. */
- const_tree stmt = last_stmt (CONST_CAST_BB(bb));
- return (stmt && TREE_CODE (stmt) == COND_EXPR);
+ gimple stmt = last_stmt (CONST_CAST_BB (bb));
+ return (stmt && gimple_code (stmt) == GIMPLE_COND);
}
/* Return true if we need to add fake edge to exit at statement T.
- Helper function for tree_flow_call_edges_add. */
+ Helper function for gimple_flow_call_edges_add. */
static bool
-need_fake_edge_p (tree t)
+need_fake_edge_p (gimple t)
{
- tree call, fndecl = NULL_TREE;
- int call_flags;
+ tree fndecl = NULL_TREE;
+ int call_flags = 0;
/* NORETURN and LONGJMP calls already have an edge to exit.
CONST and PURE calls do not need one.
@@ -6567,24 +6186,26 @@ need_fake_edge_p (tree t)
figured out from the RTL in mark_constant_function, and
the counter incrementation code from -fprofile-arcs
leads to different results from -fbranch-probabilities. */
- call = get_call_expr_in (t);
- if (call)
+ if (is_gimple_call (t))
{
- fndecl = get_callee_fndecl (call);
- call_flags = call_expr_flags (call);
+ fndecl = gimple_call_fndecl (t);
+ call_flags = gimple_call_flags (t);
}
- if (call && fndecl && DECL_BUILT_IN (fndecl)
+ if (is_gimple_call (t)
+ && fndecl
+ && DECL_BUILT_IN (fndecl)
&& (call_flags & ECF_NOTHROW)
&& !(call_flags & ECF_NORETURN)
&& !(call_flags & ECF_RETURNS_TWICE))
return false;
- if (call && !(call_flags & ECF_NORETURN))
+ if (is_gimple_call (t)
+ && !(call_flags & ECF_NORETURN))
return true;
- if (TREE_CODE (t) == ASM_EXPR
- && (ASM_VOLATILE_P (t) || ASM_INPUT_P (t)))
+ if (gimple_code (t) == ASM_EXPR
+ && (gimple_asm_volatile_p (t) || gimple_asm_input_p (t)))
return true;
return false;
@@ -6600,7 +6221,7 @@ need_fake_edge_p (tree t)
not imply that all subsequent instructions must be executed. */
static int
-tree_flow_call_edges_add (sbitmap blocks)
+gimple_flow_call_edges_add (sbitmap blocks)
{
int i;
int blocks_split = 0;
@@ -6630,10 +6251,11 @@ tree_flow_call_edges_add (sbitmap blocks)
if (check_last_block)
{
basic_block bb = EXIT_BLOCK_PTR->prev_bb;
- block_stmt_iterator bsi = bsi_last (bb);
- tree t = NULL_TREE;
- if (!bsi_end_p (bsi))
- t = bsi_stmt (bsi);
+ gimple_stmt_iterator gsi = gsi_last_bb (bb);
+ gimple t = NULL;
+
+ if (!gsi_end_p (gsi))
+ t = gsi_stmt (gsi);
if (t && need_fake_edge_p (t))
{
@@ -6642,8 +6264,8 @@ tree_flow_call_edges_add (sbitmap blocks)
e = find_edge (bb, EXIT_BLOCK_PTR);
if (e)
{
- bsi_insert_on_edge (e, build_empty_stmt ());
- bsi_commit_edge_inserts ();
+ gsi_insert_on_edge (e, gimple_build_nop ());
+ gsi_commit_edge_inserts ();
}
}
}
@@ -6654,8 +6276,8 @@ tree_flow_call_edges_add (sbitmap blocks)
for (i = 0; i < last_bb; i++)
{
basic_block bb = BASIC_BLOCK (i);
- block_stmt_iterator bsi;
- tree stmt, last_stmt;
+ gimple_stmt_iterator gsi;
+ gimple stmt, last_stmt;
if (!bb)
continue;
@@ -6663,16 +6285,17 @@ tree_flow_call_edges_add (sbitmap blocks)
if (blocks && !TEST_BIT (blocks, i))
continue;
- bsi = bsi_last (bb);
- if (!bsi_end_p (bsi))
+ gsi = gsi_last_bb (bb);
+ if (!gsi_end_p (gsi))
{
- last_stmt = bsi_stmt (bsi);
+ last_stmt = gsi_stmt (gsi);
do
{
- stmt = bsi_stmt (bsi);
+ stmt = gsi_stmt (gsi);
if (need_fake_edge_p (stmt))
{
edge e;
+
/* The handling above of the final block before the
epilogue should be enough to verify that there is
no edge to the exit block in CFG already.
@@ -6696,9 +6319,9 @@ tree_flow_call_edges_add (sbitmap blocks)
}
make_edge (bb, EXIT_BLOCK_PTR, EDGE_FAKE);
}
- bsi_prev (&bsi);
+ gsi_prev (&gsi);
}
- while (!bsi_end_p (bsi));
+ while (!gsi_end_p (gsi));
}
}
@@ -6711,17 +6334,17 @@ tree_flow_call_edges_add (sbitmap blocks)
/* Purge dead abnormal call edges from basic block BB. */
bool
-tree_purge_dead_abnormal_call_edges (basic_block bb)
+gimple_purge_dead_abnormal_call_edges (basic_block bb)
{
- bool changed = tree_purge_dead_eh_edges (bb);
+ bool changed = gimple_purge_dead_eh_edges (bb);
if (cfun->has_nonlocal_label)
{
- tree stmt = last_stmt (bb);
+ gimple stmt = last_stmt (bb);
edge_iterator ei;
edge e;
- if (!(stmt && tree_can_make_abnormal_goto (stmt)))
+ if (!(stmt && stmt_can_make_abnormal_goto (stmt)))
for (ei = ei_start (bb->succs); (e = ei_safe_edge (ei)); )
{
if (e->flags & EDGE_ABNORMAL)
@@ -6733,7 +6356,7 @@ tree_purge_dead_abnormal_call_edges (basic_block bb)
ei_next (&ei);
}
- /* See tree_purge_dead_eh_edges below. */
+ /* See gimple_purge_dead_eh_edges below. */
if (changed)
free_dominance_info (CDI_DOMINATORS);
}
@@ -6880,14 +6503,14 @@ remove_edge_and_dominated_blocks (edge e)
/* Purge dead EH edges from basic block BB. */
bool
-tree_purge_dead_eh_edges (basic_block bb)
+gimple_purge_dead_eh_edges (basic_block bb)
{
bool changed = false;
edge e;
edge_iterator ei;
- tree stmt = last_stmt (bb);
+ gimple stmt = last_stmt (bb);
- if (stmt && tree_can_throw_internal (stmt))
+ if (stmt && stmt_can_throw_internal (stmt))
return false;
for (ei = ei_start (bb->succs); (e = ei_safe_edge (ei)); )
@@ -6905,7 +6528,7 @@ tree_purge_dead_eh_edges (basic_block bb)
}
bool
-tree_purge_all_dead_eh_edges (const_bitmap blocks)
+gimple_purge_all_dead_eh_edges (const_bitmap blocks)
{
bool changed = false;
unsigned i;
@@ -6913,7 +6536,7 @@ tree_purge_all_dead_eh_edges (const_bitmap blocks)
EXECUTE_IF_SET_IN_BITMAP (blocks, 0, i, bi)
{
- changed |= tree_purge_dead_eh_edges (BASIC_BLOCK (i));
+ changed |= gimple_purge_dead_eh_edges (BASIC_BLOCK (i));
}
return changed;
@@ -6923,7 +6546,7 @@ tree_purge_all_dead_eh_edges (const_bitmap blocks)
redirected. */
static void
-tree_execute_on_growing_pred (edge e)
+gimple_execute_on_growing_pred (edge e)
{
basic_block bb = e->dest;
@@ -6935,7 +6558,7 @@ tree_execute_on_growing_pred (edge e)
the edge vector E->dest->preds. */
static void
-tree_execute_on_shrinking_pred (edge e)
+gimple_execute_on_shrinking_pred (edge e)
{
if (phi_nodes (e->dest))
remove_phi_args (e);
@@ -6951,14 +6574,15 @@ tree_execute_on_shrinking_pred (edge e)
on the edge by split_edge(). Later, additional edge 'e' was created to
connect 'new_head' and 'first'. Now this routine adds phi args on this
additional edge 'e' that new_head to second edge received as part of edge
- splitting.
-*/
+ splitting. */
static void
-tree_lv_adjust_loop_header_phi (basic_block first, basic_block second,
- basic_block new_head, edge e)
+gimple_lv_adjust_loop_header_phi (basic_block first, basic_block second,
+ basic_block new_head, edge e)
{
- tree phi1, phi2;
+ gimple phi1, phi2;
+ gimple_stmt_iterator psi1, psi2;
+ tree def;
edge e2 = find_edge (new_head, second);
/* Because NEW_HEAD has been created by splitting SECOND's incoming
@@ -6968,35 +6592,41 @@ tree_lv_adjust_loop_header_phi (basic_block first, basic_block second,
/* Browse all 'second' basic block phi nodes and add phi args to
edge 'e' for 'first' head. PHI args are always in correct order. */
- for (phi2 = phi_nodes (second), phi1 = phi_nodes (first);
- phi2 && phi1;
- phi2 = PHI_CHAIN (phi2), phi1 = PHI_CHAIN (phi1))
+ for (psi2 = gsi_start_phis (second),
+ psi1 = gsi_start_phis (first);
+ !gsi_end_p (psi2) && !gsi_end_p (psi1);
+ gsi_next (&psi2), gsi_next (&psi1))
{
- tree def = PHI_ARG_DEF (phi2, e2->dest_idx);
+ phi1 = gsi_stmt (psi1);
+ phi2 = gsi_stmt (psi2);
+ def = PHI_ARG_DEF (phi2, e2->dest_idx);
add_phi_arg (phi1, def, e);
}
}
+
/* Adds a if else statement to COND_BB with condition COND_EXPR.
SECOND_HEAD is the destination of the THEN and FIRST_HEAD is
the destination of the ELSE part. */
+
static void
-tree_lv_add_condition_to_bb (basic_block first_head ATTRIBUTE_UNUSED,
- basic_block second_head ATTRIBUTE_UNUSED,
- basic_block cond_bb, void *cond_e)
+gimple_lv_add_condition_to_bb (basic_block first_head ATTRIBUTE_UNUSED,
+ basic_block second_head ATTRIBUTE_UNUSED,
+ basic_block cond_bb, void *cond_e)
{
- block_stmt_iterator bsi;
- tree new_cond_expr = NULL_TREE;
+ gimple_stmt_iterator gsi;
+ gimple new_cond_expr;
tree cond_expr = (tree) cond_e;
edge e0;
/* Build new conditional expr */
- new_cond_expr = build3 (COND_EXPR, void_type_node, cond_expr,
- NULL_TREE, NULL_TREE);
+ new_cond_expr = gimple_build_cond_from_tree (cond_expr,
+ NULL_TREE, NULL_TREE);
/* Add new cond in cond_bb. */
- bsi = bsi_start (cond_bb);
- bsi_insert_after (&bsi, new_cond_expr, BSI_NEW_STMT);
+ gsi = gsi_last_bb (cond_bb);
+ gsi_insert_after (&gsi, new_cond_expr, GSI_NEW_STMT);
+
/* Adjust edges appropriately to connect new head with first head
as well as second head. */
e0 = single_succ_edge (cond_bb);
@@ -7004,34 +6634,34 @@ tree_lv_add_condition_to_bb (basic_block first_head ATTRIBUTE_UNUSED,
e0->flags |= EDGE_FALSE_VALUE;
}
-struct cfg_hooks tree_cfg_hooks = {
- "tree",
- tree_verify_flow_info,
- tree_dump_bb, /* dump_bb */
+struct cfg_hooks gimple_cfg_hooks = {
+ "gimple",
+ gimple_verify_flow_info,
+ gimple_dump_bb, /* dump_bb */
create_bb, /* create_basic_block */
- tree_redirect_edge_and_branch,/* redirect_edge_and_branch */
- tree_redirect_edge_and_branch_force,/* redirect_edge_and_branch_force */
- tree_can_remove_branch_p, /* can_remove_branch_p */
+ gimple_redirect_edge_and_branch, /* redirect_edge_and_branch */
+ gimple_redirect_edge_and_branch_force, /* redirect_edge_and_branch_force */
+ gimple_can_remove_branch_p, /* can_remove_branch_p */
remove_bb, /* delete_basic_block */
- tree_split_block, /* split_block */
- tree_move_block_after, /* move_block_after */
- tree_can_merge_blocks_p, /* can_merge_blocks_p */
- tree_merge_blocks, /* merge_blocks */
- tree_predict_edge, /* predict_edge */
- tree_predicted_by_p, /* predicted_by_p */
- tree_can_duplicate_bb_p, /* can_duplicate_block_p */
- tree_duplicate_bb, /* duplicate_block */
- tree_split_edge, /* split_edge */
- tree_make_forwarder_block, /* make_forward_block */
+ gimple_split_block, /* split_block */
+ gimple_move_block_after, /* move_block_after */
+ gimple_can_merge_blocks_p, /* can_merge_blocks_p */
+ gimple_merge_blocks, /* merge_blocks */
+ gimple_predict_edge, /* predict_edge */
+ gimple_predicted_by_p, /* predicted_by_p */
+ gimple_can_duplicate_bb_p, /* can_duplicate_block_p */
+ gimple_duplicate_bb, /* duplicate_block */
+ gimple_split_edge, /* split_edge */
+ gimple_make_forwarder_block, /* make_forward_block */
NULL, /* tidy_fallthru_edge */
- tree_block_ends_with_call_p, /* block_ends_with_call_p */
- tree_block_ends_with_condjump_p, /* block_ends_with_condjump_p */
- tree_flow_call_edges_add, /* flow_call_edges_add */
- tree_execute_on_growing_pred, /* execute_on_growing_pred */
- tree_execute_on_shrinking_pred, /* execute_on_shrinking_pred */
- tree_duplicate_loop_to_header_edge, /* duplicate loop for trees */
- tree_lv_add_condition_to_bb, /* lv_add_condition_to_bb */
- tree_lv_adjust_loop_header_phi, /* lv_adjust_loop_header_phi*/
+ gimple_block_ends_with_call_p,/* block_ends_with_call_p */
+ gimple_block_ends_with_condjump_p, /* block_ends_with_condjump_p */
+ gimple_flow_call_edges_add, /* flow_call_edges_add */
+ gimple_execute_on_growing_pred, /* execute_on_growing_pred */
+ gimple_execute_on_shrinking_pred, /* execute_on_shrinking_pred */
+ gimple_duplicate_loop_to_header_edge, /* duplicate loop for trees */
+ gimple_lv_add_condition_to_bb, /* lv_add_condition_to_bb */
+ gimple_lv_adjust_loop_header_phi, /* lv_adjust_loop_header_phi*/
extract_true_false_edges_from_block, /* extract_cond_bb_edges */
flush_pending_stmts /* flush_pending_stmts */
};
@@ -7081,39 +6711,12 @@ struct gimple_opt_pass pass_split_crit_edges =
}
};
-
-/* Return EXP if it is a valid GIMPLE rvalue, else gimplify it into
- a temporary, make sure and register it to be renamed if necessary,
- and finally return the temporary. Put the statements to compute
- EXP before the current statement in BSI. */
-
-tree
-gimplify_val (block_stmt_iterator *bsi, tree type, tree exp)
-{
- tree t, new_stmt, orig_stmt;
-
- if (is_gimple_val (exp))
- return exp;
-
- t = make_rename_temp (type, NULL);
- new_stmt = build_gimple_modify_stmt (t, exp);
-
- orig_stmt = bsi_stmt (*bsi);
- SET_EXPR_LOCUS (new_stmt, EXPR_LOCUS (orig_stmt));
- TREE_BLOCK (new_stmt) = TREE_BLOCK (orig_stmt);
-
- bsi_insert_before (bsi, new_stmt, BSI_SAME_STMT);
- if (gimple_in_ssa_p (cfun))
- mark_symbols_for_renaming (new_stmt);
-
- return t;
-}
-/* Build a ternary operation and gimplify it. Emit code before BSI.
+/* Build a ternary operation and gimplify it. Emit code before GSI.
Return the gimple_val holding the result. */
tree
-gimplify_build3 (block_stmt_iterator *bsi, enum tree_code code,
+gimplify_build3 (gimple_stmt_iterator *gsi, enum tree_code code,
tree type, tree a, tree b, tree c)
{
tree ret;
@@ -7121,14 +6724,15 @@ gimplify_build3 (block_stmt_iterator *bsi, enum tree_code code,
ret = fold_build3 (code, type, a, b, c);
STRIP_NOPS (ret);
- return gimplify_val (bsi, type, ret);
+ return force_gimple_operand_gsi (gsi, ret, true, NULL, true,
+ GSI_SAME_STMT);
}
-/* Build a binary operation and gimplify it. Emit code before BSI.
+/* Build a binary operation and gimplify it. Emit code before GSI.
Return the gimple_val holding the result. */
tree
-gimplify_build2 (block_stmt_iterator *bsi, enum tree_code code,
+gimplify_build2 (gimple_stmt_iterator *gsi, enum tree_code code,
tree type, tree a, tree b)
{
tree ret;
@@ -7136,14 +6740,15 @@ gimplify_build2 (block_stmt_iterator *bsi, enum tree_code code,
ret = fold_build2 (code, type, a, b);
STRIP_NOPS (ret);
- return gimplify_val (bsi, type, ret);
+ return force_gimple_operand_gsi (gsi, ret, true, NULL, true,
+ GSI_SAME_STMT);
}
-/* Build a unary operation and gimplify it. Emit code before BSI.
+/* Build a unary operation and gimplify it. Emit code before GSI.
Return the gimple_val holding the result. */
tree
-gimplify_build1 (block_stmt_iterator *bsi, enum tree_code code, tree type,
+gimplify_build1 (gimple_stmt_iterator *gsi, enum tree_code code, tree type,
tree a)
{
tree ret;
@@ -7151,7 +6756,8 @@ gimplify_build1 (block_stmt_iterator *bsi, enum tree_code code, tree type,
ret = fold_build1 (code, type, a);
STRIP_NOPS (ret);
- return gimplify_val (bsi, type, ret);
+ return force_gimple_operand_gsi (gsi, ret, true, NULL, true,
+ GSI_SAME_STMT);
}
@@ -7162,7 +6768,7 @@ static unsigned int
execute_warn_function_return (void)
{
source_location location;
- tree last;
+ gimple last;
edge e;
edge_iterator ei;
@@ -7174,8 +6780,8 @@ execute_warn_function_return (void)
FOR_EACH_EDGE (e, ei, EXIT_BLOCK_PTR->preds)
{
last = last_stmt (e->src);
- if (TREE_CODE (last) == RETURN_EXPR
- && (location = EXPR_LOCATION (last)) != UNKNOWN_LOCATION)
+ if (gimple_code (last) == GIMPLE_RETURN
+ && (location = gimple_location (last)) != UNKNOWN_LOCATION)
break;
}
if (location == UNKNOWN_LOCATION)
@@ -7192,15 +6798,15 @@ execute_warn_function_return (void)
{
FOR_EACH_EDGE (e, ei, EXIT_BLOCK_PTR->preds)
{
- tree last = last_stmt (e->src);
- if (TREE_CODE (last) == RETURN_EXPR
- && TREE_OPERAND (last, 0) == NULL
- && !TREE_NO_WARNING (last))
+ gimple last = last_stmt (e->src);
+ if (gimple_code (last) == GIMPLE_RETURN
+ && gimple_return_retval (last) == NULL
+ && !gimple_no_warning_p (last))
{
- location = EXPR_LOCATION (last);
+ location = gimple_location (last);
if (location == UNKNOWN_LOCATION)
location = cfun->function_end_locus;
- warning (OPT_Wreturn_type, "%Hcontrol reaches end of non-void function", &location);
+ warning_at (location, OPT_Wreturn_type, "control reaches end of non-void function");
TREE_NO_WARNING (cfun->decl) = 1;
break;
}
diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c
index 8970a9b96eb..433900c3a14 100644
--- a/gcc/tree-cfgcleanup.c
+++ b/gcc/tree-cfgcleanup.c
@@ -73,15 +73,17 @@ remove_fallthru_edge (VEC(edge,gc) *ev)
return false;
}
+
/* Disconnect an unreachable block in the control expression starting
at block BB. */
static bool
-cleanup_control_expr_graph (basic_block bb, block_stmt_iterator bsi)
+cleanup_control_expr_graph (basic_block bb, gimple_stmt_iterator gsi)
{
edge taken_edge;
bool retval = false;
- tree expr = bsi_stmt (bsi), val;
+ gimple stmt = gsi_stmt (gsi);
+ tree val;
if (!single_succ_p (bb))
{
@@ -90,26 +92,7 @@ cleanup_control_expr_graph (basic_block bb, block_stmt_iterator bsi)
bool warned;
fold_defer_overflow_warnings ();
-
- switch (TREE_CODE (expr))
- {
- case COND_EXPR:
- val = fold (COND_EXPR_COND (expr));
- break;
-
- case SWITCH_EXPR:
- val = fold (SWITCH_COND (expr));
- if (TREE_CODE (val) != INTEGER_CST)
- {
- fold_undefer_and_ignore_overflow_warnings ();
- return false;
- }
- break;
-
- default:
- gcc_unreachable ();
- }
-
+ val = gimple_fold (stmt);
taken_edge = find_taken_edge (bb, val);
if (!taken_edge)
{
@@ -126,7 +109,7 @@ cleanup_control_expr_graph (basic_block bb, block_stmt_iterator bsi)
if (!warned)
{
fold_undefer_overflow_warnings
- (true, expr, WARN_STRICT_OVERFLOW_CONDITIONAL);
+ (true, stmt, WARN_STRICT_OVERFLOW_CONDITIONAL);
warned = true;
}
@@ -147,7 +130,7 @@ cleanup_control_expr_graph (basic_block bb, block_stmt_iterator bsi)
taken_edge = single_succ_edge (bb);
bitmap_set_bit (cfgcleanup_altered_bbs, bb->index);
- bsi_remove (&bsi, true);
+ gsi_remove (&gsi, true);
taken_edge->flags = EDGE_FALLTHRU;
return retval;
@@ -159,30 +142,30 @@ cleanup_control_expr_graph (basic_block bb, block_stmt_iterator bsi)
static bool
cleanup_control_flow_bb (basic_block bb)
{
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
bool retval = false;
- tree stmt;
+ gimple stmt;
/* If the last statement of the block could throw and now cannot,
we need to prune cfg. */
- retval |= tree_purge_dead_eh_edges (bb);
+ retval |= gimple_purge_dead_eh_edges (bb);
- bsi = bsi_last (bb);
- if (bsi_end_p (bsi))
+ gsi = gsi_last_bb (bb);
+ if (gsi_end_p (gsi))
return retval;
- stmt = bsi_stmt (bsi);
+ stmt = gsi_stmt (gsi);
- if (TREE_CODE (stmt) == COND_EXPR
- || TREE_CODE (stmt) == SWITCH_EXPR)
- retval |= cleanup_control_expr_graph (bb, bsi);
- /* If we had a computed goto which has a compile-time determinable
- destination, then we can eliminate the goto. */
- else if (TREE_CODE (stmt) == GOTO_EXPR
- && TREE_CODE (GOTO_DESTINATION (stmt)) == ADDR_EXPR
- && (TREE_CODE (TREE_OPERAND (GOTO_DESTINATION (stmt), 0))
+ if (gimple_code (stmt) == GIMPLE_COND
+ || gimple_code (stmt) == GIMPLE_SWITCH)
+ retval |= cleanup_control_expr_graph (bb, gsi);
+ else if (gimple_code (stmt) == GIMPLE_GOTO
+ && TREE_CODE (gimple_goto_dest (stmt)) == ADDR_EXPR
+ && (TREE_CODE (TREE_OPERAND (gimple_goto_dest (stmt), 0))
== LABEL_DECL))
{
+ /* If we had a computed goto which has a compile-time determinable
+ destination, then we can eliminate the goto. */
edge e;
tree label;
edge_iterator ei;
@@ -191,7 +174,7 @@ cleanup_control_flow_bb (basic_block bb)
/* First look at all the outgoing edges. Delete any outgoing
edges which do not go to the right block. For the one
edge which goes to the right block, fix up its flags. */
- label = TREE_OPERAND (GOTO_DESTINATION (stmt), 0);
+ label = TREE_OPERAND (gimple_goto_dest (stmt), 0);
target_block = label_to_block (label);
for (ei = ei_start (bb->succs); (e = ei_safe_edge (ei)); )
{
@@ -213,13 +196,15 @@ cleanup_control_flow_bb (basic_block bb)
/* Remove the GOTO_EXPR as it is not needed. The CFG has all the
relevant information we need. */
- bsi_remove (&bsi, true);
+ gsi_remove (&gsi, true);
retval = true;
}
/* Check for indirect calls that have been turned into
noreturn calls. */
- else if (noreturn_call_p (stmt) && remove_fallthru_edge (bb->succs))
+ else if (is_gimple_call (stmt)
+ && gimple_call_noreturn_p (stmt)
+ && remove_fallthru_edge (bb->succs))
retval = true;
return retval;
@@ -235,7 +220,7 @@ cleanup_control_flow_bb (basic_block bb)
static bool
tree_forwarder_block_p (basic_block bb, bool phi_wanted)
{
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
edge_iterator ei;
edge e, succ;
basic_block dest;
@@ -244,7 +229,7 @@ tree_forwarder_block_p (basic_block bb, bool phi_wanted)
if (single_succ_p (bb) != 1
/* If PHI_WANTED is false, BB must not have any PHI nodes.
Otherwise, BB must have PHI nodes. */
- || (phi_nodes (bb) != NULL_TREE) != phi_wanted
+ || gimple_seq_empty_p (phi_nodes (bb)) == phi_wanted
/* BB may not be a predecessor of EXIT_BLOCK_PTR. */
|| single_succ (bb) == EXIT_BLOCK_PTR
/* Nor should this be an infinite loop. */
@@ -259,14 +244,14 @@ tree_forwarder_block_p (basic_block bb, bool phi_wanted)
/* Now walk through the statements backward. We can ignore labels,
anything else means this is not a forwarder block. */
- for (bsi = bsi_last (bb); !bsi_end_p (bsi); bsi_prev (&bsi))
+ for (gsi = gsi_last_bb (bb); !gsi_end_p (gsi); gsi_prev (&gsi))
{
- tree stmt = bsi_stmt (bsi);
+ gimple stmt = gsi_stmt (gsi);
- switch (TREE_CODE (stmt))
+ switch (gimple_code (stmt))
{
- case LABEL_EXPR:
- if (DECL_NONLOCAL (LABEL_EXPR_LABEL (stmt)))
+ case GIMPLE_LABEL:
+ if (DECL_NONLOCAL (gimple_label_label (stmt)))
return false;
break;
@@ -333,12 +318,13 @@ phi_alternatives_equal (basic_block dest, edge e1, edge e2)
{
int n1 = e1->dest_idx;
int n2 = e2->dest_idx;
- tree phi;
+ gimple_stmt_iterator gsi;
- for (phi = phi_nodes (dest); phi; phi = PHI_CHAIN (phi))
+ for (gsi = gsi_start_phis (dest); !gsi_end_p (gsi); gsi_next (&gsi))
{
- tree val1 = PHI_ARG_DEF (phi, n1);
- tree val2 = PHI_ARG_DEF (phi, n2);
+ gimple phi = gsi_stmt (gsi);
+ tree val1 = gimple_phi_arg_def (phi, n1);
+ tree val2 = gimple_phi_arg_def (phi, n2);
gcc_assert (val1 != NULL_TREE);
gcc_assert (val2 != NULL_TREE);
@@ -357,10 +343,9 @@ remove_forwarder_block (basic_block bb)
{
edge succ = single_succ_edge (bb), e, s;
basic_block dest = succ->dest;
- tree label;
- tree phi;
+ gimple label;
edge_iterator ei;
- block_stmt_iterator bsi, bsi_to;
+ gimple_stmt_iterator gsi, gsi_to;
bool seen_abnormal_edge = false;
/* We check for infinite loops already in tree_forwarder_block_p.
@@ -373,8 +358,8 @@ remove_forwarder_block (basic_block bb)
it. */
label = first_stmt (dest);
if (label
- && TREE_CODE (label) == LABEL_EXPR
- && DECL_NONLOCAL (LABEL_EXPR_LABEL (label)))
+ && gimple_code (label) == GIMPLE_LABEL
+ && DECL_NONLOCAL (gimple_label_label (label)))
return false;
/* If there is an abnormal edge to basic block BB, but not into
@@ -393,14 +378,14 @@ remove_forwarder_block (basic_block bb)
seen_abnormal_edge = true;
if (has_abnormal_incoming_edge_p (dest)
- || phi_nodes (dest) != NULL_TREE)
+ || !gimple_seq_empty_p (phi_nodes (dest)))
return false;
}
/* If there are phi nodes in DEST, and some of the blocks that are
predecessors of BB are also predecessors of DEST, check that the
phi node arguments match. */
- if (phi_nodes (dest))
+ if (!gimple_seq_empty_p (phi_nodes (dest)))
{
FOR_EACH_EDGE (e, ei, bb->preds)
{
@@ -431,8 +416,13 @@ remove_forwarder_block (basic_block bb)
{
/* Create arguments for the phi nodes, since the edge was not
here before. */
- for (phi = phi_nodes (dest); phi; phi = PHI_CHAIN (phi))
- add_phi_arg (phi, PHI_ARG_DEF (phi, succ->dest_idx), s);
+ for (gsi = gsi_start_phis (dest);
+ !gsi_end_p (gsi);
+ gsi_next (&gsi))
+ {
+ gimple phi = gsi_stmt (gsi);
+ add_phi_arg (phi, gimple_phi_arg_def (phi, succ->dest_idx), s);
+ }
}
}
@@ -440,14 +430,13 @@ remove_forwarder_block (basic_block bb)
{
/* Move the labels to the new block, so that the redirection of
the abnormal edges works. */
-
- bsi_to = bsi_start (dest);
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); )
+ gsi_to = gsi_start_bb (dest);
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); )
{
- label = bsi_stmt (bsi);
- gcc_assert (TREE_CODE (label) == LABEL_EXPR);
- bsi_remove (&bsi, false);
- bsi_insert_before (&bsi_to, label, BSI_CONTINUE_LINKING);
+ label = gsi_stmt (gsi);
+ gcc_assert (gimple_code (label) == GIMPLE_LABEL);
+ gsi_remove (&gsi, false);
+ gsi_insert_before (&gsi_to, label, GSI_CONTINUE_LINKING);
}
}
@@ -485,18 +474,18 @@ static bool
split_bbs_on_noreturn_calls (void)
{
bool changed = false;
- tree stmt;
+ gimple stmt;
basic_block bb;
/* Detect cases where a mid-block call is now known not to return. */
if (cfun->gimple_df)
- while (VEC_length (tree, MODIFIED_NORETURN_CALLS (cfun)))
+ while (VEC_length (gimple, MODIFIED_NORETURN_CALLS (cfun)))
{
- stmt = VEC_pop (tree, MODIFIED_NORETURN_CALLS (cfun));
- bb = bb_for_stmt (stmt);
+ stmt = VEC_pop (gimple, MODIFIED_NORETURN_CALLS (cfun));
+ bb = gimple_bb (stmt);
if (bb == NULL
|| last_stmt (bb) == stmt
- || !noreturn_call_p (stmt))
+ || !gimple_call_noreturn_p (stmt))
continue;
changed = true;
@@ -507,23 +496,23 @@ split_bbs_on_noreturn_calls (void)
return changed;
}
-/* If OMP_RETURN in basic block BB is unreachable, remove it. */
+/* If GIMPLE_OMP_RETURN in basic block BB is unreachable, remove it. */
static bool
cleanup_omp_return (basic_block bb)
{
- tree stmt = last_stmt (bb);
+ gimple stmt = last_stmt (bb);
basic_block control_bb;
- if (stmt == NULL_TREE
- || TREE_CODE (stmt) != OMP_RETURN
+ if (stmt == NULL
+ || gimple_code (stmt) != GIMPLE_OMP_RETURN
|| !single_pred_p (bb))
return false;
control_bb = single_pred (bb);
stmt = last_stmt (control_bb);
- if (TREE_CODE (stmt) != OMP_SECTIONS_SWITCH)
+ if (gimple_code (stmt) != GIMPLE_OMP_SECTIONS_SWITCH)
return false;
/* The block with the control statement normally has two entry edges -- one
@@ -553,7 +542,6 @@ cleanup_tree_cfg_bb (basic_block bb)
/* Forwarder blocks can carry line number information which is
useful when debugging, so we only clean them up when
optimizing. */
-
if (optimize > 0
&& tree_forwarder_block_p (bb, false)
&& remove_forwarder_block (bb))
@@ -716,7 +704,7 @@ remove_forwarder_block_with_phi (basic_block bb)
{
edge succ = single_succ_edge (bb);
basic_block dest = succ->dest;
- tree label;
+ gimple label;
basic_block dombb, domdest, dom;
/* We check for infinite loops already in tree_forwarder_block_p.
@@ -729,15 +717,15 @@ remove_forwarder_block_with_phi (basic_block bb)
merge it. */
label = first_stmt (dest);
if (label
- && TREE_CODE (label) == LABEL_EXPR
- && DECL_NONLOCAL (LABEL_EXPR_LABEL (label)))
+ && gimple_code (label) == GIMPLE_LABEL
+ && DECL_NONLOCAL (gimple_label_label (label)))
return;
/* Redirect each incoming edge to BB to DEST. */
while (EDGE_COUNT (bb->preds) > 0)
{
edge e = EDGE_PRED (bb, 0), s;
- tree phi;
+ gimple_stmt_iterator gsi;
s = find_edge (e->src, dest);
if (s)
@@ -765,9 +753,12 @@ remove_forwarder_block_with_phi (basic_block bb)
/* Add to the PHI nodes at DEST each PHI argument removed at the
destination of E. */
- for (phi = phi_nodes (dest); phi; phi = PHI_CHAIN (phi))
+ for (gsi = gsi_start_phis (dest);
+ !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
- tree def = PHI_ARG_DEF (phi, succ->dest_idx);
+ gimple phi = gsi_stmt (gsi);
+ tree def = gimple_phi_arg_def (phi, succ->dest_idx);
if (TREE_CODE (def) == SSA_NAME)
{
@@ -879,7 +870,7 @@ merge_phi_nodes (void)
}
else
{
- tree phi;
+ gimple_stmt_iterator gsi;
unsigned int dest_idx = single_succ_edge (bb)->dest_idx;
/* BB dominates DEST. There may be many users of the PHI
@@ -887,11 +878,13 @@ merge_phi_nodes (void)
can handle. If the result of every PHI in BB is used
only by a PHI in DEST, then we can trivially merge the
PHI nodes from BB into DEST. */
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
+ for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
- tree result = PHI_RESULT (phi);
+ gimple phi = gsi_stmt (gsi);
+ tree result = gimple_phi_result (phi);
use_operand_p imm_use;
- tree use_stmt;
+ gimple use_stmt;
/* If the PHI's result is never used, then we can just
ignore it. */
@@ -900,15 +893,15 @@ merge_phi_nodes (void)
/* Get the single use of the result of this PHI node. */
if (!single_imm_use (result, &imm_use, &use_stmt)
- || TREE_CODE (use_stmt) != PHI_NODE
- || bb_for_stmt (use_stmt) != dest
- || PHI_ARG_DEF (use_stmt, dest_idx) != result)
+ || gimple_code (use_stmt) != GIMPLE_PHI
+ || gimple_bb (use_stmt) != dest
+ || gimple_phi_arg_def (use_stmt, dest_idx) != result)
break;
}
/* If the loop above iterated through all the PHI nodes
in BB, then we can merge the PHIs from BB into DEST. */
- if (!phi)
+ if (gsi_end_p (gsi))
*current++ = bb;
}
}
diff --git a/gcc/tree-chrec.c b/gcc/tree-chrec.c
index 295fb7920c9..89e96fd53b6 100644
--- a/gcc/tree-chrec.c
+++ b/gcc/tree-chrec.c
@@ -343,9 +343,9 @@ chrec_fold_plus (tree type,
return chrec_fold_automatically_generated_operands (op0, op1);
if (integer_zerop (op0))
- return chrec_convert (type, op1, NULL_TREE);
+ return chrec_convert (type, op1, NULL);
if (integer_zerop (op1))
- return chrec_convert (type, op0, NULL_TREE);
+ return chrec_convert (type, op0, NULL);
if (POINTER_TYPE_P (type))
code = POINTER_PLUS_EXPR;
@@ -577,7 +577,7 @@ chrec_apply (unsigned var,
if (evolution_function_is_affine_p (chrec))
{
/* "{a, +, b} (x)" -> "a + b*x". */
- x = chrec_convert_rhs (type, x, NULL_TREE);
+ x = chrec_convert_rhs (type, x, NULL);
res = chrec_fold_multiply (TREE_TYPE (x), CHREC_RIGHT (chrec), x);
if (!integer_zerop (CHREC_LEFT (chrec)))
res = chrec_fold_plus (type, CHREC_LEFT (chrec), res);
@@ -1115,7 +1115,7 @@ avoid_arithmetics_in_type_p (const_tree type)
return false;
}
-static tree chrec_convert_1 (tree, tree, tree, bool);
+static tree chrec_convert_1 (tree, tree, gimple, bool);
/* Converts BASE and STEP of affine scev to TYPE. LOOP is the loop whose iv
the scev corresponds to. AT_STMT is the statement at that the scev is
@@ -1127,7 +1127,7 @@ static tree chrec_convert_1 (tree, tree, tree, bool);
bool
convert_affine_scev (struct loop *loop, tree type,
- tree *base, tree *step, tree at_stmt,
+ tree *base, tree *step, gimple at_stmt,
bool use_overflow_semantics)
{
tree ct = TREE_TYPE (*step);
@@ -1228,7 +1228,7 @@ convert_affine_scev (struct loop *loop, tree type,
/* Convert CHREC for the right hand side of a CREC.
The increment for a pointer type is always sizetype. */
tree
-chrec_convert_rhs (tree type, tree chrec, tree at_stmt)
+chrec_convert_rhs (tree type, tree chrec, gimple at_stmt)
{
if (POINTER_TYPE_P (type))
type = sizetype;
@@ -1260,7 +1260,7 @@ chrec_convert_rhs (tree type, tree chrec, tree at_stmt)
*/
tree
-chrec_convert (tree type, tree chrec, tree at_stmt)
+chrec_convert (tree type, tree chrec, gimple at_stmt)
{
return chrec_convert_1 (type, chrec, at_stmt, true);
}
@@ -1278,7 +1278,7 @@ chrec_convert (tree type, tree chrec, tree at_stmt)
tests, but also to enforce that the result follows them. */
static tree
-chrec_convert_1 (tree type, tree chrec, tree at_stmt,
+chrec_convert_1 (tree type, tree chrec, gimple at_stmt,
bool use_overflow_semantics)
{
tree ct, res;
@@ -1352,10 +1352,10 @@ chrec_convert_aggressive (tree type, tree chrec)
right = CHREC_RIGHT (chrec);
lc = chrec_convert_aggressive (type, left);
if (!lc)
- lc = chrec_convert (type, left, NULL_TREE);
+ lc = chrec_convert (type, left, NULL);
rc = chrec_convert_aggressive (rtype, right);
if (!rc)
- rc = chrec_convert (rtype, right, NULL_TREE);
+ rc = chrec_convert (rtype, right, NULL);
return build_polynomial_chrec (CHREC_VARIABLE (chrec), lc, rc);
}
diff --git a/gcc/tree-chrec.h b/gcc/tree-chrec.h
index 7f240c6c739..9000fb7dab4 100644
--- a/gcc/tree-chrec.h
+++ b/gcc/tree-chrec.h
@@ -57,8 +57,8 @@ tree_is_chrec (const_tree expr)
extern tree chrec_fold_plus (tree, tree, tree);
extern tree chrec_fold_minus (tree, tree, tree);
extern tree chrec_fold_multiply (tree, tree, tree);
-extern tree chrec_convert (tree, tree, tree);
-extern tree chrec_convert_rhs (tree, tree, tree);
+extern tree chrec_convert (tree, tree, gimple);
+extern tree chrec_convert_rhs (tree, tree, gimple);
extern tree chrec_convert_aggressive (tree, tree);
/* Operations. */
diff --git a/gcc/tree-complex.c b/gcc/tree-complex.c
index 0fc1cc5f305..bbf4c494218 100644
--- a/gcc/tree-complex.c
+++ b/gcc/tree-complex.c
@@ -26,7 +26,7 @@ along with GCC; see the file COPYING3. If not see
#include "real.h"
#include "flags.h"
#include "tree-flow.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "tree-iterator.h"
#include "tree-pass.h"
#include "tree-ssa-propagate.h"
@@ -104,16 +104,37 @@ some_nonzerop (tree t)
return !zerop;
}
-/* Compute a lattice value from T. It may be a gimple_val, or, as a
- special exception, a COMPLEX_EXPR. */
+
+/* Compute a lattice value from the components of a complex type REAL
+ and IMAG. */
static complex_lattice_t
-find_lattice_value (tree t)
+find_lattice_value_parts (tree real, tree imag)
{
- tree real, imag;
int r, i;
complex_lattice_t ret;
+ r = some_nonzerop (real);
+ i = some_nonzerop (imag);
+ ret = r * ONLY_REAL + i * ONLY_IMAG;
+
+ /* ??? On occasion we could do better than mapping 0+0i to real, but we
+ certainly don't want to leave it UNINITIALIZED, which eventually gets
+ mapped to VARYING. */
+ if (ret == UNINITIALIZED)
+ ret = ONLY_REAL;
+
+ return ret;
+}
+
+
+/* Compute a lattice value from gimple_val T. */
+
+static complex_lattice_t
+find_lattice_value (tree t)
+{
+ tree real, imag;
+
switch (TREE_CODE (t))
{
case SSA_NAME:
@@ -125,26 +146,11 @@ find_lattice_value (tree t)
imag = TREE_IMAGPART (t);
break;
- case COMPLEX_EXPR:
- real = TREE_OPERAND (t, 0);
- imag = TREE_OPERAND (t, 1);
- break;
-
default:
gcc_unreachable ();
}
- r = some_nonzerop (real);
- i = some_nonzerop (imag);
- ret = r*ONLY_REAL + i*ONLY_IMAG;
-
- /* ??? On occasion we could do better than mapping 0+0i to real, but we
- certainly don't want to leave it UNINITIALIZED, which eventually gets
- mapped to VARYING. */
- if (ret == UNINITIALIZED)
- ret = ONLY_REAL;
-
- return ret;
+ return find_lattice_value_parts (real, imag);
}
/* Determine if LHS is something for which we're interested in seeing
@@ -171,66 +177,72 @@ init_parameter_lattice_values (void)
SSA_NAME_VERSION (ssa_name), VARYING);
}
-/* Initialize DONT_SIMULATE_AGAIN for each stmt and phi. Return false if
- we found no statements we want to simulate, and thus there's nothing for
- the entire pass to do. */
+/* Initialize simulation state for each statement. Return false if we
+ found no statements we want to simulate, and thus there's nothing
+ for the entire pass to do. */
static bool
init_dont_simulate_again (void)
{
basic_block bb;
- block_stmt_iterator bsi;
- tree phi;
+ gimple_stmt_iterator gsi;
+ gimple phi;
bool saw_a_complex_op = false;
FOR_EACH_BB (bb)
{
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
- DONT_SIMULATE_AGAIN (phi) = !is_complex_reg (PHI_RESULT (phi));
+ for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ {
+ phi = gsi_stmt (gsi);
+ prop_set_simulate_again (phi,
+ is_complex_reg (gimple_phi_result (phi)));
+ }
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- tree orig_stmt, stmt, rhs = NULL;
- bool dsa;
+ gimple stmt;
+ tree op0, op1;
+ bool sim_again_p;
- orig_stmt = stmt = bsi_stmt (bsi);
+ stmt = gsi_stmt (gsi);
+ op0 = op1 = NULL_TREE;
/* Most control-altering statements must be initially
simulated, else we won't cover the entire cfg. */
- dsa = !stmt_ends_bb_p (stmt);
+ sim_again_p = stmt_ends_bb_p (stmt);
- switch (TREE_CODE (stmt))
+ switch (gimple_code (stmt))
{
- case RETURN_EXPR:
- /* We don't care what the lattice value of <retval> is,
- since it's never used as an input to another computation. */
- dsa = true;
- stmt = TREE_OPERAND (stmt, 0);
- if (!stmt || TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
- break;
- /* FALLTHRU */
+ case GIMPLE_CALL:
+ if (gimple_call_lhs (stmt))
+ sim_again_p = is_complex_reg (gimple_call_lhs (stmt));
+ break;
- case GIMPLE_MODIFY_STMT:
- dsa = !is_complex_reg (GIMPLE_STMT_OPERAND (stmt, 0));
- rhs = GIMPLE_STMT_OPERAND (stmt, 1);
+ case GIMPLE_ASSIGN:
+ sim_again_p = is_complex_reg (gimple_assign_lhs (stmt));
+ if (gimple_assign_rhs_code (stmt) == REALPART_EXPR
+ || gimple_assign_rhs_code (stmt) == IMAGPART_EXPR)
+ op0 = TREE_OPERAND (gimple_assign_rhs1 (stmt), 0);
+ else
+ op0 = gimple_assign_rhs1 (stmt);
+ if (gimple_num_ops (stmt) > 2)
+ op1 = gimple_assign_rhs2 (stmt);
break;
- case COND_EXPR:
- rhs = TREE_OPERAND (stmt, 0);
+ case GIMPLE_COND:
+ op0 = gimple_cond_lhs (stmt);
+ op1 = gimple_cond_rhs (stmt);
break;
default:
break;
}
- if (rhs)
- switch (TREE_CODE (rhs))
+ if (op0 || op1)
+ switch (gimple_expr_code (stmt))
{
case EQ_EXPR:
case NE_EXPR:
- rhs = TREE_OPERAND (rhs, 0);
- /* FALLTHRU */
-
case PLUS_EXPR:
case MINUS_EXPR:
case MULT_EXPR:
@@ -239,20 +251,25 @@ init_dont_simulate_again (void)
case FLOOR_DIV_EXPR:
case ROUND_DIV_EXPR:
case RDIV_EXPR:
+ if (TREE_CODE (TREE_TYPE (op0)) == COMPLEX_TYPE
+ || TREE_CODE (TREE_TYPE (op1)) == COMPLEX_TYPE)
+ saw_a_complex_op = true;
+ break;
+
case NEGATE_EXPR:
case CONJ_EXPR:
- if (TREE_CODE (TREE_TYPE (rhs)) == COMPLEX_TYPE)
+ if (TREE_CODE (TREE_TYPE (op0)) == COMPLEX_TYPE)
saw_a_complex_op = true;
break;
case REALPART_EXPR:
case IMAGPART_EXPR:
/* The total store transformation performed during
- gimplification creates such uninitialized loads
- and we need to lower the statement to be able
- to fix things up. */
- if (TREE_CODE (TREE_OPERAND (rhs, 0)) == SSA_NAME
- && ssa_undefined_value_p (TREE_OPERAND (rhs, 0)))
+ gimplification creates such uninitialized loads
+ and we need to lower the statement to be able
+ to fix things up. */
+ if (TREE_CODE (op0) == SSA_NAME
+ && ssa_undefined_value_p (op0))
saw_a_complex_op = true;
break;
@@ -260,7 +277,7 @@ init_dont_simulate_again (void)
break;
}
- DONT_SIMULATE_AGAIN (orig_stmt) = dsa;
+ prop_set_simulate_again (stmt, sim_again_p);
}
}
@@ -271,19 +288,18 @@ init_dont_simulate_again (void)
/* Evaluate statement STMT against the complex lattice defined above. */
static enum ssa_prop_result
-complex_visit_stmt (tree stmt, edge *taken_edge_p ATTRIBUTE_UNUSED,
+complex_visit_stmt (gimple stmt, edge *taken_edge_p ATTRIBUTE_UNUSED,
tree *result_p)
{
complex_lattice_t new_l, old_l, op1_l, op2_l;
unsigned int ver;
- tree lhs, rhs;
+ tree lhs;
- if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
+ lhs = gimple_get_lhs (stmt);
+ /* Skip anything but GIMPLE_ASSIGN and GIMPLE_CALL with a lhs. */
+ if (!lhs)
return SSA_PROP_VARYING;
- lhs = GIMPLE_STMT_OPERAND (stmt, 0);
- rhs = GIMPLE_STMT_OPERAND (stmt, 1);
-
/* These conditions should be satisfied due to the initial filter
set up in init_dont_simulate_again. */
gcc_assert (TREE_CODE (lhs) == SSA_NAME);
@@ -293,18 +309,22 @@ complex_visit_stmt (tree stmt, edge *taken_edge_p ATTRIBUTE_UNUSED,
ver = SSA_NAME_VERSION (lhs);
old_l = VEC_index (complex_lattice_t, complex_lattice_values, ver);
- switch (TREE_CODE (rhs))
+ switch (gimple_expr_code (stmt))
{
case SSA_NAME:
- case COMPLEX_EXPR:
case COMPLEX_CST:
- new_l = find_lattice_value (rhs);
+ new_l = find_lattice_value (gimple_assign_rhs1 (stmt));
+ break;
+
+ case COMPLEX_EXPR:
+ new_l = find_lattice_value_parts (gimple_assign_rhs1 (stmt),
+ gimple_assign_rhs2 (stmt));
break;
case PLUS_EXPR:
case MINUS_EXPR:
- op1_l = find_lattice_value (TREE_OPERAND (rhs, 0));
- op2_l = find_lattice_value (TREE_OPERAND (rhs, 1));
+ op1_l = find_lattice_value (gimple_assign_rhs1 (stmt));
+ op2_l = find_lattice_value (gimple_assign_rhs2 (stmt));
/* We've set up the lattice values such that IOR neatly
models addition. */
@@ -317,8 +337,8 @@ complex_visit_stmt (tree stmt, edge *taken_edge_p ATTRIBUTE_UNUSED,
case CEIL_DIV_EXPR:
case FLOOR_DIV_EXPR:
case ROUND_DIV_EXPR:
- op1_l = find_lattice_value (TREE_OPERAND (rhs, 0));
- op2_l = find_lattice_value (TREE_OPERAND (rhs, 1));
+ op1_l = find_lattice_value (gimple_assign_rhs1 (stmt));
+ op2_l = find_lattice_value (gimple_assign_rhs2 (stmt));
/* Obviously, if either varies, so does the result. */
if (op1_l == VARYING || op2_l == VARYING)
@@ -344,7 +364,7 @@ complex_visit_stmt (tree stmt, edge *taken_edge_p ATTRIBUTE_UNUSED,
case NEGATE_EXPR:
case CONJ_EXPR:
- new_l = find_lattice_value (TREE_OPERAND (rhs, 0));
+ new_l = find_lattice_value (gimple_assign_rhs1 (stmt));
break;
default:
@@ -363,14 +383,14 @@ complex_visit_stmt (tree stmt, edge *taken_edge_p ATTRIBUTE_UNUSED,
/* Evaluate a PHI node against the complex lattice defined above. */
static enum ssa_prop_result
-complex_visit_phi (tree phi)
+complex_visit_phi (gimple phi)
{
complex_lattice_t new_l, old_l;
unsigned int ver;
tree lhs;
int i;
- lhs = PHI_RESULT (phi);
+ lhs = gimple_phi_result (phi);
/* This condition should be satisfied due to the initial filter
set up in init_dont_simulate_again. */
@@ -378,8 +398,8 @@ complex_visit_phi (tree phi)
/* We've set up the lattice values such that IOR neatly models PHI meet. */
new_l = UNINITIALIZED;
- for (i = PHI_NUM_ARGS (phi) - 1; i >= 0; --i)
- new_l |= find_lattice_value (PHI_ARG_DEF (phi, i));
+ for (i = gimple_phi_num_args (phi) - 1; i >= 0; --i)
+ new_l |= find_lattice_value (gimple_phi_arg_def (phi, i));
ver = SSA_NAME_VERSION (lhs);
old_l = VEC_index (complex_lattice_t, complex_lattice_values, ver);
@@ -475,7 +495,7 @@ get_component_ssa_name (tree ssa_name, bool imag_p)
SSA_NAME_OCCURS_IN_ABNORMAL_PHI (ret)
= SSA_NAME_OCCURS_IN_ABNORMAL_PHI (ssa_name);
if (TREE_CODE (SSA_NAME_VAR (ssa_name)) == VAR_DECL
- && IS_EMPTY_STMT (SSA_NAME_DEF_STMT (ssa_name)))
+ && gimple_nop_p (SSA_NAME_DEF_STMT (ssa_name)))
{
SSA_NAME_DEF_STMT (ret) = SSA_NAME_DEF_STMT (ssa_name);
set_default_def (SSA_NAME_VAR (ret), ret);
@@ -487,15 +507,17 @@ get_component_ssa_name (tree ssa_name, bool imag_p)
return ret;
}
-/* Set a value for a complex component of SSA_NAME, return a STMT_LIST of
- stuff that needs doing. */
+/* Set a value for a complex component of SSA_NAME, return a
+ gimple_seq of stuff that needs doing. */
-static tree
+static gimple_seq
set_component_ssa_name (tree ssa_name, bool imag_p, tree value)
{
complex_lattice_t lattice = find_lattice_value (ssa_name);
size_t ssa_name_index;
- tree comp, list, last;
+ tree comp;
+ gimple last;
+ gimple_seq list;
/* We know the value must be zero, else there's a bug in our lattice
analysis. But the value may well be a variable known to contain
@@ -542,22 +564,21 @@ set_component_ssa_name (tree ssa_name, bool imag_p, tree value)
comp = get_component_ssa_name (ssa_name, imag_p);
/* Do all the work to assign VALUE to COMP. */
+ list = NULL;
value = force_gimple_operand (value, &list, false, NULL);
- last = build_gimple_modify_stmt (comp, value);
- append_to_statement_list (last, &list);
-
- gcc_assert (SSA_NAME_DEF_STMT (comp) == NULL);
- SSA_NAME_DEF_STMT (comp) = last;
+ last = gimple_build_assign (comp, value);
+ gimple_seq_add_stmt (&list, last);
+ gcc_assert (SSA_NAME_DEF_STMT (comp) == last);
return list;
}
/* Extract the real or imaginary part of a complex variable or constant.
Make sure that it's a proper gimple_val and gimplify it if not.
- Emit any new code before BSI. */
+ Emit any new code before gsi. */
static tree
-extract_component (block_stmt_iterator *bsi, tree t, bool imagpart_p,
+extract_component (gimple_stmt_iterator *gsi, tree t, bool imagpart_p,
bool gimple_p)
{
switch (TREE_CODE (t))
@@ -566,7 +587,7 @@ extract_component (block_stmt_iterator *bsi, tree t, bool imagpart_p,
return imagpart_p ? TREE_IMAGPART (t) : TREE_REALPART (t);
case COMPLEX_EXPR:
- return TREE_OPERAND (t, imagpart_p);
+ gcc_unreachable ();
case VAR_DECL:
case RESULT_DECL:
@@ -581,7 +602,8 @@ extract_component (block_stmt_iterator *bsi, tree t, bool imagpart_p,
inner_type, unshare_expr (t));
if (gimple_p)
- t = gimplify_val (bsi, inner_type, t);
+ t = force_gimple_operand_gsi (gsi, t, true, NULL, true,
+ GSI_SAME_STMT);
return t;
}
@@ -597,53 +619,53 @@ extract_component (block_stmt_iterator *bsi, tree t, bool imagpart_p,
/* Update the complex components of the ssa name on the lhs of STMT. */
static void
-update_complex_components (block_stmt_iterator *bsi, tree stmt, tree r, tree i)
+update_complex_components (gimple_stmt_iterator *gsi, gimple stmt, tree r,
+ tree i)
{
- tree lhs = GIMPLE_STMT_OPERAND (stmt, 0);
- tree list;
+ tree lhs;
+ gimple_seq list;
+
+ lhs = gimple_get_lhs (stmt);
list = set_component_ssa_name (lhs, false, r);
if (list)
- bsi_insert_after (bsi, list, BSI_CONTINUE_LINKING);
+ gsi_insert_seq_after (gsi, list, GSI_CONTINUE_LINKING);
list = set_component_ssa_name (lhs, true, i);
if (list)
- bsi_insert_after (bsi, list, BSI_CONTINUE_LINKING);
+ gsi_insert_seq_after (gsi, list, GSI_CONTINUE_LINKING);
}
static void
update_complex_components_on_edge (edge e, tree lhs, tree r, tree i)
{
- tree list;
+ gimple_seq list;
list = set_component_ssa_name (lhs, false, r);
if (list)
- bsi_insert_on_edge (e, list);
+ gsi_insert_seq_on_edge (e, list);
list = set_component_ssa_name (lhs, true, i);
if (list)
- bsi_insert_on_edge (e, list);
+ gsi_insert_seq_on_edge (e, list);
}
+
/* Update an assignment to a complex variable in place. */
static void
-update_complex_assignment (block_stmt_iterator *bsi, tree r, tree i)
+update_complex_assignment (gimple_stmt_iterator *gsi, tree r, tree i)
{
- tree stmt, mod;
- tree type;
-
- mod = stmt = bsi_stmt (*bsi);
- if (TREE_CODE (stmt) == RETURN_EXPR)
- mod = TREE_OPERAND (mod, 0);
- else if (gimple_in_ssa_p (cfun))
- update_complex_components (bsi, stmt, r, i);
-
- type = TREE_TYPE (GIMPLE_STMT_OPERAND (mod, 1));
- GIMPLE_STMT_OPERAND (mod, 1) = build2 (COMPLEX_EXPR, type, r, i);
- update_stmt (stmt);
+ gimple_stmt_iterator orig_si = *gsi;
+
+ if (gimple_in_ssa_p (cfun))
+ update_complex_components (gsi, gsi_stmt (*gsi), r, i);
+
+ gimple_assign_set_rhs_with_ops (&orig_si, COMPLEX_EXPR, r, i);
+ update_stmt (gsi_stmt (orig_si));
}
+
/* Generate code at the entry point of the function to initialize the
component variables for a complex parameter. */
@@ -678,49 +700,54 @@ update_parameter_components (void)
static void
update_phi_components (basic_block bb)
{
- tree phi;
+ gimple_stmt_iterator gsi;
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
- if (is_complex_reg (PHI_RESULT (phi)))
- {
- tree lr, li, pr = NULL, pi = NULL;
- unsigned int i, n;
+ for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ {
+ gimple phi = gsi_stmt (gsi);
- lr = get_component_ssa_name (PHI_RESULT (phi), false);
- if (TREE_CODE (lr) == SSA_NAME)
- {
- pr = create_phi_node (lr, bb);
- SSA_NAME_DEF_STMT (lr) = pr;
- }
+ if (is_complex_reg (gimple_phi_result (phi)))
+ {
+ tree lr, li;
+ gimple pr = NULL, pi = NULL;
+ unsigned int i, n;
- li = get_component_ssa_name (PHI_RESULT (phi), true);
- if (TREE_CODE (li) == SSA_NAME)
- {
- pi = create_phi_node (li, bb);
- SSA_NAME_DEF_STMT (li) = pi;
- }
-
- for (i = 0, n = PHI_NUM_ARGS (phi); i < n; ++i)
- {
- tree comp, arg = PHI_ARG_DEF (phi, i);
- if (pr)
- {
- comp = extract_component (NULL, arg, false, false);
- SET_PHI_ARG_DEF (pr, i, comp);
- }
- if (pi)
- {
- comp = extract_component (NULL, arg, true, false);
- SET_PHI_ARG_DEF (pi, i, comp);
- }
- }
- }
+ lr = get_component_ssa_name (gimple_phi_result (phi), false);
+ if (TREE_CODE (lr) == SSA_NAME)
+ {
+ pr = create_phi_node (lr, bb);
+ SSA_NAME_DEF_STMT (lr) = pr;
+ }
+
+ li = get_component_ssa_name (gimple_phi_result (phi), true);
+ if (TREE_CODE (li) == SSA_NAME)
+ {
+ pi = create_phi_node (li, bb);
+ SSA_NAME_DEF_STMT (li) = pi;
+ }
+
+ for (i = 0, n = gimple_phi_num_args (phi); i < n; ++i)
+ {
+ tree comp, arg = gimple_phi_arg_def (phi, i);
+ if (pr)
+ {
+ comp = extract_component (NULL, arg, false, false);
+ SET_PHI_ARG_DEF (pr, i, comp);
+ }
+ if (pi)
+ {
+ comp = extract_component (NULL, arg, true, false);
+ SET_PHI_ARG_DEF (pi, i, comp);
+ }
+ }
+ }
+ }
}
/* Mark each virtual op in STMT for ssa update. */
static void
-update_all_vops (tree stmt)
+update_all_vops (gimple stmt)
{
ssa_op_iter iter;
tree sym;
@@ -733,18 +760,35 @@ update_all_vops (tree stmt)
}
}
+
/* Expand a complex move to scalars. */
static void
-expand_complex_move (block_stmt_iterator *bsi, tree stmt, tree type,
- tree lhs, tree rhs)
+expand_complex_move (gimple_stmt_iterator *gsi, tree type)
{
tree inner_type = TREE_TYPE (type);
- tree r, i;
+ tree r, i, lhs, rhs;
+ gimple stmt = gsi_stmt (*gsi);
+
+ if (is_gimple_assign (stmt))
+ {
+ lhs = gimple_assign_lhs (stmt);
+ if (gimple_num_ops (stmt) == 2)
+ rhs = gimple_assign_rhs1 (stmt);
+ else
+ rhs = NULL_TREE;
+ }
+ else if (is_gimple_call (stmt))
+ {
+ lhs = gimple_call_lhs (stmt);
+ rhs = NULL_TREE;
+ }
+ else
+ gcc_unreachable ();
if (TREE_CODE (lhs) == SSA_NAME)
{
- if (is_ctrl_altering_stmt (bsi_stmt (*bsi)))
+ if (is_ctrl_altering_stmt (stmt))
{
edge_iterator ei;
edge e;
@@ -752,7 +796,7 @@ expand_complex_move (block_stmt_iterator *bsi, tree stmt, tree type,
/* The value is not assigned on the exception edges, so we need not
concern ourselves there. We do need to update on the fallthru
edge. Find it. */
- FOR_EACH_EDGE (e, ei, bsi->bb->succs)
+ FOR_EACH_EDGE (e, ei, gsi_bb (*gsi)->succs)
if (e->flags & EDGE_FALLTHRU)
goto found_fallthru;
gcc_unreachable ();
@@ -762,47 +806,57 @@ expand_complex_move (block_stmt_iterator *bsi, tree stmt, tree type,
i = build1 (IMAGPART_EXPR, inner_type, lhs);
update_complex_components_on_edge (e, lhs, r, i);
}
- else if (TREE_CODE (rhs) == CALL_EXPR || TREE_SIDE_EFFECTS (rhs)
- || TREE_CODE (rhs) == PAREN_EXPR)
+ else if (is_gimple_call (stmt)
+ || gimple_has_side_effects (stmt)
+ || gimple_assign_rhs_code (stmt) == PAREN_EXPR)
{
r = build1 (REALPART_EXPR, inner_type, lhs);
i = build1 (IMAGPART_EXPR, inner_type, lhs);
- update_complex_components (bsi, stmt, r, i);
+ update_complex_components (gsi, stmt, r, i);
}
else
{
- update_all_vops (bsi_stmt (*bsi));
- r = extract_component (bsi, rhs, 0, true);
- i = extract_component (bsi, rhs, 1, true);
- update_complex_assignment (bsi, r, i);
+ update_all_vops (stmt);
+ if (gimple_assign_rhs_code (stmt) != COMPLEX_EXPR)
+ {
+ r = extract_component (gsi, rhs, 0, true);
+ i = extract_component (gsi, rhs, 1, true);
+ }
+ else
+ {
+ r = gimple_assign_rhs1 (stmt);
+ i = gimple_assign_rhs2 (stmt);
+ }
+ update_complex_assignment (gsi, r, i);
}
}
- else if (TREE_CODE (rhs) == SSA_NAME && !TREE_SIDE_EFFECTS (lhs))
+ else if (rhs && TREE_CODE (rhs) == SSA_NAME && !TREE_SIDE_EFFECTS (lhs))
{
tree x;
+ gimple t;
- r = extract_component (bsi, rhs, 0, false);
- i = extract_component (bsi, rhs, 1, false);
+ r = extract_component (gsi, rhs, 0, false);
+ i = extract_component (gsi, rhs, 1, false);
x = build1 (REALPART_EXPR, inner_type, unshare_expr (lhs));
- x = build_gimple_modify_stmt (x, r);
- bsi_insert_before (bsi, x, BSI_SAME_STMT);
+ t = gimple_build_assign (x, r);
+ gsi_insert_before (gsi, t, GSI_SAME_STMT);
- if (stmt == bsi_stmt (*bsi))
+ if (stmt == gsi_stmt (*gsi))
{
x = build1 (IMAGPART_EXPR, inner_type, unshare_expr (lhs));
- GIMPLE_STMT_OPERAND (stmt, 0) = x;
- GIMPLE_STMT_OPERAND (stmt, 1) = i;
+ gimple_assign_set_lhs (stmt, x);
+ gimple_assign_set_rhs1 (stmt, i);
}
else
{
x = build1 (IMAGPART_EXPR, inner_type, unshare_expr (lhs));
- x = build_gimple_modify_stmt (x, i);
- bsi_insert_before (bsi, x, BSI_SAME_STMT);
+ t = gimple_build_assign (x, i);
+ gsi_insert_before (gsi, t, GSI_SAME_STMT);
- stmt = bsi_stmt (*bsi);
- gcc_assert (TREE_CODE (stmt) == RETURN_EXPR);
- GIMPLE_STMT_OPERAND (stmt, 0) = lhs;
+ stmt = gsi_stmt (*gsi);
+ gcc_assert (gimple_code (stmt) == GIMPLE_RETURN);
+ gimple_return_set_retval (stmt, lhs);
}
update_all_vops (stmt);
@@ -816,7 +870,7 @@ expand_complex_move (block_stmt_iterator *bsi, tree stmt, tree type,
*/
static void
-expand_complex_addition (block_stmt_iterator *bsi, tree inner_type,
+expand_complex_addition (gimple_stmt_iterator *gsi, tree inner_type,
tree ar, tree ai, tree br, tree bi,
enum tree_code code,
complex_lattice_t al, complex_lattice_t bl)
@@ -826,21 +880,21 @@ expand_complex_addition (block_stmt_iterator *bsi, tree inner_type,
switch (PAIR (al, bl))
{
case PAIR (ONLY_REAL, ONLY_REAL):
- rr = gimplify_build2 (bsi, code, inner_type, ar, br);
+ rr = gimplify_build2 (gsi, code, inner_type, ar, br);
ri = ai;
break;
case PAIR (ONLY_REAL, ONLY_IMAG):
rr = ar;
if (code == MINUS_EXPR)
- ri = gimplify_build2 (bsi, MINUS_EXPR, inner_type, ai, bi);
+ ri = gimplify_build2 (gsi, MINUS_EXPR, inner_type, ai, bi);
else
ri = bi;
break;
case PAIR (ONLY_IMAG, ONLY_REAL):
if (code == MINUS_EXPR)
- rr = gimplify_build2 (bsi, MINUS_EXPR, inner_type, ar, br);
+ rr = gimplify_build2 (gsi, MINUS_EXPR, inner_type, ar, br);
else
rr = br;
ri = ai;
@@ -848,23 +902,23 @@ expand_complex_addition (block_stmt_iterator *bsi, tree inner_type,
case PAIR (ONLY_IMAG, ONLY_IMAG):
rr = ar;
- ri = gimplify_build2 (bsi, code, inner_type, ai, bi);
+ ri = gimplify_build2 (gsi, code, inner_type, ai, bi);
break;
case PAIR (VARYING, ONLY_REAL):
- rr = gimplify_build2 (bsi, code, inner_type, ar, br);
+ rr = gimplify_build2 (gsi, code, inner_type, ar, br);
ri = ai;
break;
case PAIR (VARYING, ONLY_IMAG):
rr = ar;
- ri = gimplify_build2 (bsi, code, inner_type, ai, bi);
+ ri = gimplify_build2 (gsi, code, inner_type, ai, bi);
break;
case PAIR (ONLY_REAL, VARYING):
if (code == MINUS_EXPR)
goto general;
- rr = gimplify_build2 (bsi, code, inner_type, ar, br);
+ rr = gimplify_build2 (gsi, code, inner_type, ar, br);
ri = bi;
break;
@@ -872,38 +926,41 @@ expand_complex_addition (block_stmt_iterator *bsi, tree inner_type,
if (code == MINUS_EXPR)
goto general;
rr = br;
- ri = gimplify_build2 (bsi, code, inner_type, ai, bi);
+ ri = gimplify_build2 (gsi, code, inner_type, ai, bi);
break;
case PAIR (VARYING, VARYING):
general:
- rr = gimplify_build2 (bsi, code, inner_type, ar, br);
- ri = gimplify_build2 (bsi, code, inner_type, ai, bi);
+ rr = gimplify_build2 (gsi, code, inner_type, ar, br);
+ ri = gimplify_build2 (gsi, code, inner_type, ai, bi);
break;
default:
gcc_unreachable ();
}
- update_complex_assignment (bsi, rr, ri);
+ update_complex_assignment (gsi, rr, ri);
}
/* Expand a complex multiplication or division to a libcall to the c99
compliant routines. */
static void
-expand_complex_libcall (block_stmt_iterator *bsi, tree ar, tree ai,
+expand_complex_libcall (gimple_stmt_iterator *gsi, tree ar, tree ai,
tree br, tree bi, enum tree_code code)
{
enum machine_mode mode;
enum built_in_function bcode;
- tree fn, stmt, type;
+ tree fn, type, lhs;
+ gimple stmt;
- stmt = bsi_stmt (*bsi);
- type = TREE_TYPE (GIMPLE_STMT_OPERAND (stmt, 1));
+ stmt = gsi_stmt (*gsi);
+ lhs = gimple_assign_lhs (stmt);
+ type = TREE_TYPE (lhs);
mode = TYPE_MODE (type);
gcc_assert (GET_MODE_CLASS (mode) == MODE_COMPLEX_FLOAT);
+
if (code == MULT_EXPR)
bcode = BUILT_IN_COMPLEX_MUL_MIN + mode - MIN_MODE_COMPLEX_FLOAT;
else if (code == RDIV_EXPR)
@@ -912,16 +969,18 @@ expand_complex_libcall (block_stmt_iterator *bsi, tree ar, tree ai,
gcc_unreachable ();
fn = built_in_decls[bcode];
- GIMPLE_STMT_OPERAND (stmt, 1) = build_call_expr (fn, 4, ar, ai, br, bi);
+ stmt = gimple_build_call (fn, 4, ar, ai, br, bi);
+ gimple_call_set_lhs (stmt, lhs);
update_stmt (stmt);
+ gsi_replace (gsi, stmt, true);
if (gimple_in_ssa_p (cfun))
{
- tree lhs = GIMPLE_STMT_OPERAND (stmt, 0);
type = TREE_TYPE (type);
- update_complex_components (bsi, stmt,
+ update_complex_components (gsi, stmt,
build1 (REALPART_EXPR, type, lhs),
build1 (IMAGPART_EXPR, type, lhs));
+ SSA_NAME_DEF_STMT (lhs) = stmt;
}
}
@@ -930,7 +989,7 @@ expand_complex_libcall (block_stmt_iterator *bsi, tree ar, tree ai,
*/
static void
-expand_complex_multiplication (block_stmt_iterator *bsi, tree inner_type,
+expand_complex_multiplication (gimple_stmt_iterator *gsi, tree inner_type,
tree ar, tree ai, tree br, tree bi,
complex_lattice_t al, complex_lattice_t bl)
{
@@ -947,7 +1006,7 @@ expand_complex_multiplication (block_stmt_iterator *bsi, tree inner_type,
switch (PAIR (al, bl))
{
case PAIR (ONLY_REAL, ONLY_REAL):
- rr = gimplify_build2 (bsi, MULT_EXPR, inner_type, ar, br);
+ rr = gimplify_build2 (gsi, MULT_EXPR, inner_type, ar, br);
ri = ai;
break;
@@ -957,49 +1016,49 @@ expand_complex_multiplication (block_stmt_iterator *bsi, tree inner_type,
&& REAL_VALUES_IDENTICAL (TREE_REAL_CST (ai), dconst1))
ri = br;
else
- ri = gimplify_build2 (bsi, MULT_EXPR, inner_type, ai, br);
+ ri = gimplify_build2 (gsi, MULT_EXPR, inner_type, ai, br);
break;
case PAIR (ONLY_IMAG, ONLY_IMAG):
- rr = gimplify_build2 (bsi, MULT_EXPR, inner_type, ai, bi);
- rr = gimplify_build1 (bsi, NEGATE_EXPR, inner_type, rr);
+ rr = gimplify_build2 (gsi, MULT_EXPR, inner_type, ai, bi);
+ rr = gimplify_build1 (gsi, NEGATE_EXPR, inner_type, rr);
ri = ar;
break;
case PAIR (VARYING, ONLY_REAL):
- rr = gimplify_build2 (bsi, MULT_EXPR, inner_type, ar, br);
- ri = gimplify_build2 (bsi, MULT_EXPR, inner_type, ai, br);
+ rr = gimplify_build2 (gsi, MULT_EXPR, inner_type, ar, br);
+ ri = gimplify_build2 (gsi, MULT_EXPR, inner_type, ai, br);
break;
case PAIR (VARYING, ONLY_IMAG):
- rr = gimplify_build2 (bsi, MULT_EXPR, inner_type, ai, bi);
- rr = gimplify_build1 (bsi, NEGATE_EXPR, inner_type, rr);
- ri = gimplify_build2 (bsi, MULT_EXPR, inner_type, ar, bi);
+ rr = gimplify_build2 (gsi, MULT_EXPR, inner_type, ai, bi);
+ rr = gimplify_build1 (gsi, NEGATE_EXPR, inner_type, rr);
+ ri = gimplify_build2 (gsi, MULT_EXPR, inner_type, ar, bi);
break;
case PAIR (VARYING, VARYING):
if (flag_complex_method == 2 && SCALAR_FLOAT_TYPE_P (inner_type))
{
- expand_complex_libcall (bsi, ar, ai, br, bi, MULT_EXPR);
+ expand_complex_libcall (gsi, ar, ai, br, bi, MULT_EXPR);
return;
}
else
{
tree t1, t2, t3, t4;
- t1 = gimplify_build2 (bsi, MULT_EXPR, inner_type, ar, br);
- t2 = gimplify_build2 (bsi, MULT_EXPR, inner_type, ai, bi);
- t3 = gimplify_build2 (bsi, MULT_EXPR, inner_type, ar, bi);
+ t1 = gimplify_build2 (gsi, MULT_EXPR, inner_type, ar, br);
+ t2 = gimplify_build2 (gsi, MULT_EXPR, inner_type, ai, bi);
+ t3 = gimplify_build2 (gsi, MULT_EXPR, inner_type, ar, bi);
/* Avoid expanding redundant multiplication for the common
case of squaring a complex number. */
if (ar == br && ai == bi)
t4 = t3;
else
- t4 = gimplify_build2 (bsi, MULT_EXPR, inner_type, ai, br);
+ t4 = gimplify_build2 (gsi, MULT_EXPR, inner_type, ai, br);
- rr = gimplify_build2 (bsi, MINUS_EXPR, inner_type, t1, t2);
- ri = gimplify_build2 (bsi, PLUS_EXPR, inner_type, t3, t4);
+ rr = gimplify_build2 (gsi, MINUS_EXPR, inner_type, t1, t2);
+ ri = gimplify_build2 (gsi, PLUS_EXPR, inner_type, t3, t4);
}
break;
@@ -1007,7 +1066,7 @@ expand_complex_multiplication (block_stmt_iterator *bsi, tree inner_type,
gcc_unreachable ();
}
- update_complex_assignment (bsi, rr, ri);
+ update_complex_assignment (gsi, rr, ri);
}
/* Expand complex division to scalars, straightforward algorithm.
@@ -1016,43 +1075,44 @@ expand_complex_multiplication (block_stmt_iterator *bsi, tree inner_type,
*/
static void
-expand_complex_div_straight (block_stmt_iterator *bsi, tree inner_type,
+expand_complex_div_straight (gimple_stmt_iterator *gsi, tree inner_type,
tree ar, tree ai, tree br, tree bi,
enum tree_code code)
{
tree rr, ri, div, t1, t2, t3;
- t1 = gimplify_build2 (bsi, MULT_EXPR, inner_type, br, br);
- t2 = gimplify_build2 (bsi, MULT_EXPR, inner_type, bi, bi);
- div = gimplify_build2 (bsi, PLUS_EXPR, inner_type, t1, t2);
+ t1 = gimplify_build2 (gsi, MULT_EXPR, inner_type, br, br);
+ t2 = gimplify_build2 (gsi, MULT_EXPR, inner_type, bi, bi);
+ div = gimplify_build2 (gsi, PLUS_EXPR, inner_type, t1, t2);
- t1 = gimplify_build2 (bsi, MULT_EXPR, inner_type, ar, br);
- t2 = gimplify_build2 (bsi, MULT_EXPR, inner_type, ai, bi);
- t3 = gimplify_build2 (bsi, PLUS_EXPR, inner_type, t1, t2);
- rr = gimplify_build2 (bsi, code, inner_type, t3, div);
+ t1 = gimplify_build2 (gsi, MULT_EXPR, inner_type, ar, br);
+ t2 = gimplify_build2 (gsi, MULT_EXPR, inner_type, ai, bi);
+ t3 = gimplify_build2 (gsi, PLUS_EXPR, inner_type, t1, t2);
+ rr = gimplify_build2 (gsi, code, inner_type, t3, div);
- t1 = gimplify_build2 (bsi, MULT_EXPR, inner_type, ai, br);
- t2 = gimplify_build2 (bsi, MULT_EXPR, inner_type, ar, bi);
- t3 = gimplify_build2 (bsi, MINUS_EXPR, inner_type, t1, t2);
- ri = gimplify_build2 (bsi, code, inner_type, t3, div);
+ t1 = gimplify_build2 (gsi, MULT_EXPR, inner_type, ai, br);
+ t2 = gimplify_build2 (gsi, MULT_EXPR, inner_type, ar, bi);
+ t3 = gimplify_build2 (gsi, MINUS_EXPR, inner_type, t1, t2);
+ ri = gimplify_build2 (gsi, code, inner_type, t3, div);
- update_complex_assignment (bsi, rr, ri);
+ update_complex_assignment (gsi, rr, ri);
}
/* Expand complex division to scalars, modified algorithm to minimize
overflow with wide input ranges. */
static void
-expand_complex_div_wide (block_stmt_iterator *bsi, tree inner_type,
+expand_complex_div_wide (gimple_stmt_iterator *gsi, tree inner_type,
tree ar, tree ai, tree br, tree bi,
enum tree_code code)
{
tree rr, ri, ratio, div, t1, t2, tr, ti, compare;
basic_block bb_cond, bb_true, bb_false, bb_join;
+ gimple stmt;
/* Examine |br| < |bi|, and branch. */
- t1 = gimplify_build1 (bsi, ABS_EXPR, inner_type, br);
- t2 = gimplify_build1 (bsi, ABS_EXPR, inner_type, bi);
+ t1 = gimplify_build1 (gsi, ABS_EXPR, inner_type, br);
+ t2 = gimplify_build1 (gsi, ABS_EXPR, inner_type, bi);
compare = fold_build2 (LT_EXPR, boolean_type_node, t1, t2);
STRIP_NOPS (compare);
@@ -1061,20 +1121,25 @@ expand_complex_div_wide (block_stmt_iterator *bsi, tree inner_type,
if (!TREE_CONSTANT (compare))
{
edge e;
+ gimple stmt;
tree cond, tmp;
tmp = create_tmp_var (boolean_type_node, NULL);
- cond = build_gimple_modify_stmt (tmp, compare);
+ stmt = gimple_build_assign (tmp, compare);
if (gimple_in_ssa_p (cfun))
- tmp = make_ssa_name (tmp, cond);
- GIMPLE_STMT_OPERAND (cond, 0) = tmp;
- bsi_insert_before (bsi, cond, BSI_SAME_STMT);
+ {
+ tmp = make_ssa_name (tmp, stmt);
+ gimple_assign_set_lhs (stmt, tmp);
+ }
+
+ gsi_insert_before (gsi, stmt, GSI_SAME_STMT);
- cond = build3 (COND_EXPR, void_type_node, tmp, NULL_TREE, NULL_TREE);
- bsi_insert_before (bsi, cond, BSI_SAME_STMT);
+ cond = fold_build2 (EQ_EXPR, boolean_type_node, tmp, boolean_true_node);
+ stmt = gimple_build_cond_from_tree (cond, NULL_TREE, NULL_TREE);
+ gsi_insert_before (gsi, stmt, GSI_SAME_STMT);
/* Split the original block, and create the TRUE and FALSE blocks. */
- e = split_block (bsi->bb, cond);
+ e = split_block (gsi_bb (*gsi), stmt);
bb_cond = e->src;
bb_join = e->dest;
bb_true = create_empty_bb (bb_cond);
@@ -1110,31 +1175,31 @@ expand_complex_div_wide (block_stmt_iterator *bsi, tree inner_type,
{
if (bb_true)
{
- *bsi = bsi_last (bb_true);
- bsi_insert_after (bsi, build_empty_stmt (), BSI_NEW_STMT);
+ *gsi = gsi_last_bb (bb_true);
+ gsi_insert_after (gsi, gimple_build_nop (), GSI_NEW_STMT);
}
- ratio = gimplify_build2 (bsi, code, inner_type, br, bi);
+ ratio = gimplify_build2 (gsi, code, inner_type, br, bi);
- t1 = gimplify_build2 (bsi, MULT_EXPR, inner_type, br, ratio);
- div = gimplify_build2 (bsi, PLUS_EXPR, inner_type, t1, bi);
+ t1 = gimplify_build2 (gsi, MULT_EXPR, inner_type, br, ratio);
+ div = gimplify_build2 (gsi, PLUS_EXPR, inner_type, t1, bi);
- t1 = gimplify_build2 (bsi, MULT_EXPR, inner_type, ar, ratio);
- tr = gimplify_build2 (bsi, PLUS_EXPR, inner_type, t1, ai);
+ t1 = gimplify_build2 (gsi, MULT_EXPR, inner_type, ar, ratio);
+ tr = gimplify_build2 (gsi, PLUS_EXPR, inner_type, t1, ai);
- t1 = gimplify_build2 (bsi, MULT_EXPR, inner_type, ai, ratio);
- ti = gimplify_build2 (bsi, MINUS_EXPR, inner_type, t1, ar);
+ t1 = gimplify_build2 (gsi, MULT_EXPR, inner_type, ai, ratio);
+ ti = gimplify_build2 (gsi, MINUS_EXPR, inner_type, t1, ar);
- tr = gimplify_build2 (bsi, code, inner_type, tr, div);
- ti = gimplify_build2 (bsi, code, inner_type, ti, div);
+ tr = gimplify_build2 (gsi, code, inner_type, tr, div);
+ ti = gimplify_build2 (gsi, code, inner_type, ti, div);
if (bb_true)
{
- t1 = build_gimple_modify_stmt (rr, tr);
- bsi_insert_before (bsi, t1, BSI_SAME_STMT);
- t1 = build_gimple_modify_stmt (ri, ti);
- bsi_insert_before (bsi, t1, BSI_SAME_STMT);
- bsi_remove (bsi, true);
+ stmt = gimple_build_assign (rr, tr);
+ gsi_insert_before (gsi, stmt, GSI_SAME_STMT);
+ stmt = gimple_build_assign (ri, ti);
+ gsi_insert_before (gsi, stmt, GSI_SAME_STMT);
+ gsi_remove (gsi, true);
}
}
@@ -1149,46 +1214,46 @@ expand_complex_div_wide (block_stmt_iterator *bsi, tree inner_type,
{
if (bb_false)
{
- *bsi = bsi_last (bb_false);
- bsi_insert_after (bsi, build_empty_stmt (), BSI_NEW_STMT);
+ *gsi = gsi_last_bb (bb_false);
+ gsi_insert_after (gsi, gimple_build_nop (), GSI_NEW_STMT);
}
- ratio = gimplify_build2 (bsi, code, inner_type, bi, br);
+ ratio = gimplify_build2 (gsi, code, inner_type, bi, br);
- t1 = gimplify_build2 (bsi, MULT_EXPR, inner_type, bi, ratio);
- div = gimplify_build2 (bsi, PLUS_EXPR, inner_type, t1, br);
+ t1 = gimplify_build2 (gsi, MULT_EXPR, inner_type, bi, ratio);
+ div = gimplify_build2 (gsi, PLUS_EXPR, inner_type, t1, br);
- t1 = gimplify_build2 (bsi, MULT_EXPR, inner_type, ai, ratio);
- tr = gimplify_build2 (bsi, PLUS_EXPR, inner_type, t1, ar);
+ t1 = gimplify_build2 (gsi, MULT_EXPR, inner_type, ai, ratio);
+ tr = gimplify_build2 (gsi, PLUS_EXPR, inner_type, t1, ar);
- t1 = gimplify_build2 (bsi, MULT_EXPR, inner_type, ar, ratio);
- ti = gimplify_build2 (bsi, MINUS_EXPR, inner_type, ai, t1);
+ t1 = gimplify_build2 (gsi, MULT_EXPR, inner_type, ar, ratio);
+ ti = gimplify_build2 (gsi, MINUS_EXPR, inner_type, ai, t1);
- tr = gimplify_build2 (bsi, code, inner_type, tr, div);
- ti = gimplify_build2 (bsi, code, inner_type, ti, div);
+ tr = gimplify_build2 (gsi, code, inner_type, tr, div);
+ ti = gimplify_build2 (gsi, code, inner_type, ti, div);
if (bb_false)
{
- t1 = build_gimple_modify_stmt (rr, tr);
- bsi_insert_before (bsi, t1, BSI_SAME_STMT);
- t1 = build_gimple_modify_stmt (ri, ti);
- bsi_insert_before (bsi, t1, BSI_SAME_STMT);
- bsi_remove (bsi, true);
+ stmt = gimple_build_assign (rr, tr);
+ gsi_insert_before (gsi, stmt, GSI_SAME_STMT);
+ stmt = gimple_build_assign (ri, ti);
+ gsi_insert_before (gsi, stmt, GSI_SAME_STMT);
+ gsi_remove (gsi, true);
}
}
if (bb_join)
- *bsi = bsi_start (bb_join);
+ *gsi = gsi_start_bb (bb_join);
else
rr = tr, ri = ti;
- update_complex_assignment (bsi, rr, ri);
+ update_complex_assignment (gsi, rr, ri);
}
/* Expand complex division to scalars. */
static void
-expand_complex_division (block_stmt_iterator *bsi, tree inner_type,
+expand_complex_division (gimple_stmt_iterator *gsi, tree inner_type,
tree ar, tree ai, tree br, tree bi,
enum tree_code code,
complex_lattice_t al, complex_lattice_t bl)
@@ -1198,35 +1263,35 @@ expand_complex_division (block_stmt_iterator *bsi, tree inner_type,
switch (PAIR (al, bl))
{
case PAIR (ONLY_REAL, ONLY_REAL):
- rr = gimplify_build2 (bsi, code, inner_type, ar, br);
+ rr = gimplify_build2 (gsi, code, inner_type, ar, br);
ri = ai;
break;
case PAIR (ONLY_REAL, ONLY_IMAG):
rr = ai;
- ri = gimplify_build2 (bsi, code, inner_type, ar, bi);
- ri = gimplify_build1 (bsi, NEGATE_EXPR, inner_type, ri);
+ ri = gimplify_build2 (gsi, code, inner_type, ar, bi);
+ ri = gimplify_build1 (gsi, NEGATE_EXPR, inner_type, ri);
break;
case PAIR (ONLY_IMAG, ONLY_REAL):
rr = ar;
- ri = gimplify_build2 (bsi, code, inner_type, ai, br);
+ ri = gimplify_build2 (gsi, code, inner_type, ai, br);
break;
case PAIR (ONLY_IMAG, ONLY_IMAG):
- rr = gimplify_build2 (bsi, code, inner_type, ai, bi);
+ rr = gimplify_build2 (gsi, code, inner_type, ai, bi);
ri = ar;
break;
case PAIR (VARYING, ONLY_REAL):
- rr = gimplify_build2 (bsi, code, inner_type, ar, br);
- ri = gimplify_build2 (bsi, code, inner_type, ai, br);
+ rr = gimplify_build2 (gsi, code, inner_type, ar, br);
+ ri = gimplify_build2 (gsi, code, inner_type, ai, br);
break;
case PAIR (VARYING, ONLY_IMAG):
- rr = gimplify_build2 (bsi, code, inner_type, ai, bi);
- ri = gimplify_build2 (bsi, code, inner_type, ar, bi);
- ri = gimplify_build1 (bsi, NEGATE_EXPR, inner_type, ri);
+ rr = gimplify_build2 (gsi, code, inner_type, ai, bi);
+ ri = gimplify_build2 (gsi, code, inner_type, ar, bi);
+ ri = gimplify_build1 (gsi, NEGATE_EXPR, inner_type, ri);
case PAIR (ONLY_REAL, VARYING):
case PAIR (ONLY_IMAG, VARYING):
@@ -1235,20 +1300,20 @@ expand_complex_division (block_stmt_iterator *bsi, tree inner_type,
{
case 0:
/* straightforward implementation of complex divide acceptable. */
- expand_complex_div_straight (bsi, inner_type, ar, ai, br, bi, code);
+ expand_complex_div_straight (gsi, inner_type, ar, ai, br, bi, code);
break;
case 2:
if (SCALAR_FLOAT_TYPE_P (inner_type))
{
- expand_complex_libcall (bsi, ar, ai, br, bi, code);
+ expand_complex_libcall (gsi, ar, ai, br, bi, code);
break;
}
/* FALLTHRU */
case 1:
/* wide ranges of inputs must work for complex divide. */
- expand_complex_div_wide (bsi, inner_type, ar, ai, br, bi, code);
+ expand_complex_div_wide (gsi, inner_type, ar, ai, br, bi, code);
break;
default:
@@ -1260,7 +1325,7 @@ expand_complex_division (block_stmt_iterator *bsi, tree inner_type,
gcc_unreachable ();
}
- update_complex_assignment (bsi, rr, ri);
+ update_complex_assignment (gsi, rr, ri);
}
/* Expand complex negation to scalars:
@@ -1268,15 +1333,15 @@ expand_complex_division (block_stmt_iterator *bsi, tree inner_type,
*/
static void
-expand_complex_negation (block_stmt_iterator *bsi, tree inner_type,
+expand_complex_negation (gimple_stmt_iterator *gsi, tree inner_type,
tree ar, tree ai)
{
tree rr, ri;
- rr = gimplify_build1 (bsi, NEGATE_EXPR, inner_type, ar);
- ri = gimplify_build1 (bsi, NEGATE_EXPR, inner_type, ai);
+ rr = gimplify_build1 (gsi, NEGATE_EXPR, inner_type, ar);
+ ri = gimplify_build1 (gsi, NEGATE_EXPR, inner_type, ai);
- update_complex_assignment (bsi, rr, ri);
+ update_complex_assignment (gsi, rr, ri);
}
/* Expand complex conjugate to scalars:
@@ -1284,44 +1349,52 @@ expand_complex_negation (block_stmt_iterator *bsi, tree inner_type,
*/
static void
-expand_complex_conjugate (block_stmt_iterator *bsi, tree inner_type,
+expand_complex_conjugate (gimple_stmt_iterator *gsi, tree inner_type,
tree ar, tree ai)
{
tree ri;
- ri = gimplify_build1 (bsi, NEGATE_EXPR, inner_type, ai);
+ ri = gimplify_build1 (gsi, NEGATE_EXPR, inner_type, ai);
- update_complex_assignment (bsi, ar, ri);
+ update_complex_assignment (gsi, ar, ri);
}
/* Expand complex comparison (EQ or NE only). */
static void
-expand_complex_comparison (block_stmt_iterator *bsi, tree ar, tree ai,
+expand_complex_comparison (gimple_stmt_iterator *gsi, tree ar, tree ai,
tree br, tree bi, enum tree_code code)
{
- tree cr, ci, cc, stmt, expr, type;
+ tree cr, ci, cc, type;
+ gimple stmt;
- cr = gimplify_build2 (bsi, code, boolean_type_node, ar, br);
- ci = gimplify_build2 (bsi, code, boolean_type_node, ai, bi);
- cc = gimplify_build2 (bsi,
+ cr = gimplify_build2 (gsi, code, boolean_type_node, ar, br);
+ ci = gimplify_build2 (gsi, code, boolean_type_node, ai, bi);
+ cc = gimplify_build2 (gsi,
(code == EQ_EXPR ? TRUTH_AND_EXPR : TRUTH_OR_EXPR),
boolean_type_node, cr, ci);
- stmt = expr = bsi_stmt (*bsi);
+ stmt = gsi_stmt (*gsi);
- switch (TREE_CODE (stmt))
+ switch (gimple_code (stmt))
{
- case RETURN_EXPR:
- expr = TREE_OPERAND (stmt, 0);
- /* FALLTHRU */
- case GIMPLE_MODIFY_STMT:
- type = TREE_TYPE (GIMPLE_STMT_OPERAND (expr, 1));
- GIMPLE_STMT_OPERAND (expr, 1) = fold_convert (type, cc);
+ case GIMPLE_RETURN:
+ type = TREE_TYPE (gimple_return_retval (stmt));
+ gimple_return_set_retval (stmt, fold_convert (type, cc));
break;
- case COND_EXPR:
- TREE_OPERAND (stmt, 0) = cc;
+
+ case GIMPLE_ASSIGN:
+ type = TREE_TYPE (gimple_assign_lhs (stmt));
+ gimple_assign_set_rhs_from_tree (gsi, fold_convert (type, cc));
+ stmt = gsi_stmt (*gsi);
break;
+
+ case GIMPLE_COND:
+ gimple_cond_set_code (stmt, EQ_EXPR);
+ gimple_cond_set_lhs (stmt, cc);
+ gimple_cond_set_rhs (stmt, boolean_true_node);
+ break;
+
default:
gcc_unreachable ();
}
@@ -1329,41 +1402,24 @@ expand_complex_comparison (block_stmt_iterator *bsi, tree ar, tree ai,
update_stmt (stmt);
}
+
/* Process one statement. If we identify a complex operation, expand it. */
static void
-expand_complex_operations_1 (block_stmt_iterator *bsi)
+expand_complex_operations_1 (gimple_stmt_iterator *gsi)
{
- tree stmt = bsi_stmt (*bsi);
- tree rhs, type, inner_type;
+ gimple stmt = gsi_stmt (*gsi);
+ tree type, inner_type, lhs;
tree ac, ar, ai, bc, br, bi;
complex_lattice_t al, bl;
enum tree_code code;
- switch (TREE_CODE (stmt))
- {
- case RETURN_EXPR:
- stmt = TREE_OPERAND (stmt, 0);
- if (!stmt)
- return;
- if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
- return;
- /* FALLTHRU */
-
- case GIMPLE_MODIFY_STMT:
- rhs = GIMPLE_STMT_OPERAND (stmt, 1);
- break;
+ lhs = gimple_get_lhs (stmt);
+ if (!lhs && gimple_code (stmt) != GIMPLE_COND)
+ return;
- case COND_EXPR:
- rhs = TREE_OPERAND (stmt, 0);
- break;
-
- default:
- return;
- }
-
- type = TREE_TYPE (rhs);
- code = TREE_CODE (rhs);
+ type = TREE_TYPE (gimple_op (stmt, 0));
+ code = gimple_expr_code (stmt);
/* Initial filter for operations we handle. */
switch (code)
@@ -1385,32 +1441,36 @@ expand_complex_operations_1 (block_stmt_iterator *bsi)
case EQ_EXPR:
case NE_EXPR:
- inner_type = TREE_TYPE (TREE_OPERAND (rhs, 1));
+ /* Note, both GIMPLE_ASSIGN and GIMPLE_COND may have an EQ_EXPR
+ subocde, so we need to access the operands using gimple_op. */
+ inner_type = TREE_TYPE (gimple_op (stmt, 1));
if (TREE_CODE (inner_type) != COMPLEX_TYPE)
return;
break;
default:
{
- tree lhs, rhs;
+ tree rhs;
- /* COND_EXPR may also fallthru here, but we do not need to do anything
- with it. */
- if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
+ /* GIMPLE_COND may also fallthru here, but we do not need to
+ do anything with it. */
+ if (gimple_code (stmt) == GIMPLE_COND)
return;
- lhs = GIMPLE_STMT_OPERAND (stmt, 0);
- rhs = GIMPLE_STMT_OPERAND (stmt, 1);
-
if (TREE_CODE (type) == COMPLEX_TYPE)
- expand_complex_move (bsi, stmt, type, lhs, rhs);
- else if ((TREE_CODE (rhs) == REALPART_EXPR
- || TREE_CODE (rhs) == IMAGPART_EXPR)
- && TREE_CODE (TREE_OPERAND (rhs, 0)) == SSA_NAME)
+ expand_complex_move (gsi, type);
+ else if (is_gimple_assign (stmt)
+ && (gimple_assign_rhs_code (stmt) == REALPART_EXPR
+ || gimple_assign_rhs_code (stmt) == IMAGPART_EXPR)
+ && TREE_CODE (lhs) == SSA_NAME)
{
- GENERIC_TREE_OPERAND (stmt, 1)
- = extract_component (bsi, TREE_OPERAND (rhs, 0),
- TREE_CODE (rhs) == IMAGPART_EXPR, false);
+ rhs = gimple_assign_rhs1 (stmt);
+ rhs = extract_component (gsi, TREE_OPERAND (rhs, 0),
+ gimple_assign_rhs_code (stmt)
+ == IMAGPART_EXPR,
+ false);
+ gimple_assign_set_rhs_from_tree (gsi, rhs);
+ stmt = gsi_stmt (*gsi);
update_stmt (stmt);
}
}
@@ -1419,23 +1479,30 @@ expand_complex_operations_1 (block_stmt_iterator *bsi)
/* Extract the components of the two complex values. Make sure and
handle the common case of the same value used twice specially. */
- ac = TREE_OPERAND (rhs, 0);
- ar = extract_component (bsi, ac, 0, true);
- ai = extract_component (bsi, ac, 1, true);
-
- if (TREE_CODE_CLASS (code) == tcc_unary)
- bc = br = bi = NULL;
+ if (is_gimple_assign (stmt))
+ {
+ ac = gimple_assign_rhs1 (stmt);
+ bc = (gimple_num_ops (stmt) > 2) ? gimple_assign_rhs2 (stmt) : NULL;
+ }
+ /* GIMPLE_CALL can not get here. */
else
{
- bc = TREE_OPERAND (rhs, 1);
- if (ac == bc)
- br = ar, bi = ai;
- else
- {
- br = extract_component (bsi, bc, 0, true);
- bi = extract_component (bsi, bc, 1, true);
- }
+ ac = gimple_cond_lhs (stmt);
+ bc = gimple_cond_rhs (stmt);
+ }
+
+ ar = extract_component (gsi, ac, false, true);
+ ai = extract_component (gsi, ac, true, true);
+
+ if (ac == bc)
+ br = ar, bi = ai;
+ else if (bc)
+ {
+ br = extract_component (gsi, bc, 0, true);
+ bi = extract_component (gsi, bc, 1, true);
}
+ else
+ br = bi = NULL_TREE;
if (gimple_in_ssa_p (cfun))
{
@@ -1461,11 +1528,11 @@ expand_complex_operations_1 (block_stmt_iterator *bsi)
{
case PLUS_EXPR:
case MINUS_EXPR:
- expand_complex_addition (bsi, inner_type, ar, ai, br, bi, code, al, bl);
+ expand_complex_addition (gsi, inner_type, ar, ai, br, bi, code, al, bl);
break;
case MULT_EXPR:
- expand_complex_multiplication (bsi, inner_type, ar, ai, br, bi, al, bl);
+ expand_complex_multiplication (gsi, inner_type, ar, ai, br, bi, al, bl);
break;
case TRUNC_DIV_EXPR:
@@ -1473,20 +1540,20 @@ expand_complex_operations_1 (block_stmt_iterator *bsi)
case FLOOR_DIV_EXPR:
case ROUND_DIV_EXPR:
case RDIV_EXPR:
- expand_complex_division (bsi, inner_type, ar, ai, br, bi, code, al, bl);
+ expand_complex_division (gsi, inner_type, ar, ai, br, bi, code, al, bl);
break;
case NEGATE_EXPR:
- expand_complex_negation (bsi, inner_type, ar, ai);
+ expand_complex_negation (gsi, inner_type, ar, ai);
break;
case CONJ_EXPR:
- expand_complex_conjugate (bsi, inner_type, ar, ai);
+ expand_complex_conjugate (gsi, inner_type, ar, ai);
break;
case EQ_EXPR:
case NE_EXPR:
- expand_complex_comparison (bsi, ar, ai, br, bi, code);
+ expand_complex_comparison (gsi, ar, ai, br, bi, code);
break;
default:
@@ -1501,7 +1568,7 @@ static unsigned int
tree_lower_complex (void)
{
int old_last_basic_block;
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
basic_block bb;
if (!init_dont_simulate_again ())
@@ -1529,12 +1596,13 @@ tree_lower_complex (void)
{
if (bb->index >= old_last_basic_block)
continue;
+
update_phi_components (bb);
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
- expand_complex_operations_1 (&bsi);
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ expand_complex_operations_1 (&gsi);
}
- bsi_commit_edge_inserts ();
+ gsi_commit_edge_inserts ();
htab_delete (complex_variable_components);
VEC_free (tree, heap, complex_ssa_name_components);
@@ -1571,15 +1639,16 @@ static unsigned int
tree_lower_complex_O0 (void)
{
int old_last_basic_block = last_basic_block;
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
basic_block bb;
FOR_EACH_BB (bb)
{
if (bb->index >= old_last_basic_block)
continue;
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
- expand_complex_operations_1 (&bsi);
+
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ expand_complex_operations_1 (&gsi);
}
return 0;
}
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
index c024b74e09c..1b5e92b5af3 100644
--- a/gcc/tree-data-ref.c
+++ b/gcc/tree-data-ref.c
@@ -186,7 +186,7 @@ dump_data_reference (FILE *outf,
unsigned int i;
fprintf (outf, "(Data Ref: \n stmt: ");
- print_generic_stmt (outf, DR_STMT (dr), 0);
+ print_gimple_stmt (outf, DR_STMT (dr), 0, 0);
fprintf (outf, " ref: ");
print_generic_stmt (outf, DR_REF (dr), 0);
fprintf (outf, " base_object: ");
@@ -500,68 +500,65 @@ dump_ddrs (FILE *file, VEC (ddr_p, heap) *ddrs)
fprintf (file, "\n\n");
}
-/* Expresses EXP as VAR + OFF, where off is a constant. The type of OFF
- will be ssizetype. */
+/* Helper function for split_constant_offset. Expresses OP0 CODE OP1
+ (the type of the result is TYPE) as VAR + OFF, where OFF is a nonzero
+ constant of type ssizetype, and returns true. If we cannot do this
+ with OFF nonzero, OFF and VAR are set to NULL_TREE instead and false
+ is returned. */
-void
-split_constant_offset (tree exp, tree *var, tree *off)
+static bool
+split_constant_offset_1 (tree type, tree op0, enum tree_code code, tree op1,
+ tree *var, tree *off)
{
- tree type = TREE_TYPE (exp), otype;
tree var0, var1;
tree off0, off1;
- enum tree_code code;
+ enum tree_code ocode = code;
- *var = exp;
- STRIP_NOPS (exp);
- otype = TREE_TYPE (exp);
- code = TREE_CODE (exp);
+ *var = NULL_TREE;
+ *off = NULL_TREE;
switch (code)
{
case INTEGER_CST:
*var = build_int_cst (type, 0);
- *off = fold_convert (ssizetype, exp);
- return;
+ *off = fold_convert (ssizetype, op0);
+ return true;
case POINTER_PLUS_EXPR:
- code = PLUS_EXPR;
+ ocode = PLUS_EXPR;
/* FALLTHROUGH */
case PLUS_EXPR:
case MINUS_EXPR:
- split_constant_offset (TREE_OPERAND (exp, 0), &var0, &off0);
- split_constant_offset (TREE_OPERAND (exp, 1), &var1, &off1);
- *var = fold_convert (type, fold_build2 (TREE_CODE (exp), otype,
- var0, var1));
- *off = size_binop (code, off0, off1);
- return;
+ split_constant_offset (op0, &var0, &off0);
+ split_constant_offset (op1, &var1, &off1);
+ *var = fold_build2 (code, type, var0, var1);
+ *off = size_binop (ocode, off0, off1);
+ return true;
case MULT_EXPR:
- off1 = TREE_OPERAND (exp, 1);
- if (TREE_CODE (off1) != INTEGER_CST)
- break;
+ if (TREE_CODE (op1) != INTEGER_CST)
+ return false;
- split_constant_offset (TREE_OPERAND (exp, 0), &var0, &off0);
- *var = fold_convert (type, fold_build2 (MULT_EXPR, otype,
- var0, off1));
- *off = size_binop (MULT_EXPR, off0, fold_convert (ssizetype, off1));
- return;
+ split_constant_offset (op0, &var0, &off0);
+ *var = fold_build2 (MULT_EXPR, type, var0, op1);
+ *off = size_binop (MULT_EXPR, off0, fold_convert (ssizetype, op1));
+ return true;
case ADDR_EXPR:
{
- tree op, base, poffset;
+ tree base, poffset;
HOST_WIDE_INT pbitsize, pbitpos;
enum machine_mode pmode;
int punsignedp, pvolatilep;
- op = TREE_OPERAND (exp, 0);
- if (!handled_component_p (op))
- break;
+ if (!handled_component_p (op0))
+ return false;
- base = get_inner_reference (op, &pbitsize, &pbitpos, &poffset,
+ base = get_inner_reference (op0, &pbitsize, &pbitpos, &poffset,
&pmode, &punsignedp, &pvolatilep, false);
if (pbitpos % BITS_PER_UNIT != 0)
- break;
+ return false;
base = build_fold_addr_expr (base);
off0 = ssize_int (pbitpos / BITS_PER_UNIT);
@@ -595,40 +592,57 @@ split_constant_offset (tree exp, tree *var, tree *off)
while (POINTER_TYPE_P (type))
type = TREE_TYPE (type);
if (int_size_in_bytes (type) < 0)
- break;
+ return false;
*var = var0;
*off = off0;
- return;
+ return true;
}
case SSA_NAME:
{
- tree def_stmt = SSA_NAME_DEF_STMT (exp);
- if (TREE_CODE (def_stmt) == GIMPLE_MODIFY_STMT)
- {
- tree def_stmt_rhs = GIMPLE_STMT_OPERAND (def_stmt, 1);
+ gimple def_stmt = SSA_NAME_DEF_STMT (op0);
+ enum tree_code subcode;
- if (!TREE_SIDE_EFFECTS (def_stmt_rhs)
- && EXPR_P (def_stmt_rhs)
- && !REFERENCE_CLASS_P (def_stmt_rhs)
- && !get_call_expr_in (def_stmt_rhs))
- {
- split_constant_offset (def_stmt_rhs, &var0, &off0);
- var0 = fold_convert (type, var0);
- *var = var0;
- *off = off0;
- return;
- }
- }
- break;
+ if (gimple_code (def_stmt) != GIMPLE_ASSIGN)
+ return false;
+
+ var0 = gimple_assign_rhs1 (def_stmt);
+ subcode = gimple_assign_rhs_code (def_stmt);
+ var1 = gimple_assign_rhs2 (def_stmt);
+
+ return split_constant_offset_1 (type, var0, subcode, var1, var, off);
}
default:
- break;
+ return false;
}
+}
+
+/* Expresses EXP as VAR + OFF, where off is a constant. The type of OFF
+ will be ssizetype. */
+
+void
+split_constant_offset (tree exp, tree *var, tree *off)
+{
+ tree type = TREE_TYPE (exp), otype, op0, op1, e, o;
+ enum tree_code code;
+ *var = exp;
*off = ssize_int (0);
+ STRIP_NOPS (exp);
+
+ if (automatically_generated_chrec_p (exp))
+ return;
+
+ otype = TREE_TYPE (exp);
+ code = TREE_CODE (exp);
+ extract_ops_from_tree (exp, &code, &op0, &op1);
+ if (split_constant_offset_1 (otype, op0, code, op1, &e, &o))
+ {
+ *var = fold_convert (type, e);
+ *off = o;
+ }
}
/* Returns the address ADDR of an object in a canonical shape (without nop
@@ -658,7 +672,7 @@ canonicalize_base_object_address (tree addr)
void
dr_analyze_innermost (struct data_reference *dr)
{
- tree stmt = DR_STMT (dr);
+ gimple stmt = DR_STMT (dr);
struct loop *loop = loop_containing_stmt (stmt);
tree ref = DR_REF (dr);
HOST_WIDE_INT pbitsize, pbitpos;
@@ -729,7 +743,7 @@ dr_analyze_innermost (struct data_reference *dr)
static void
dr_analyze_indices (struct data_reference *dr, struct loop *nest)
{
- tree stmt = DR_STMT (dr);
+ gimple stmt = DR_STMT (dr);
struct loop *loop = loop_containing_stmt (stmt);
VEC (tree, heap) *access_fns = NULL;
tree ref = unshare_expr (DR_REF (dr)), aref = ref, op;
@@ -773,7 +787,7 @@ dr_analyze_indices (struct data_reference *dr, struct loop *nest)
static void
dr_analyze_alias (struct data_reference *dr)
{
- tree stmt = DR_STMT (dr);
+ gimple stmt = DR_STMT (dr);
tree ref = DR_REF (dr);
tree base = get_base_address (ref), addr, smt = NULL_TREE;
ssa_op_iter it;
@@ -834,7 +848,7 @@ free_data_ref (data_reference_p dr)
loop nest in that the reference should be analyzed. */
struct data_reference *
-create_data_ref (struct loop *nest, tree memref, tree stmt, bool is_read)
+create_data_ref (struct loop *nest, tree memref, gimple stmt, bool is_read)
{
struct data_reference *dr;
@@ -1537,8 +1551,8 @@ analyze_ziv_subscript (tree chrec_a,
fprintf (dump_file, "(analyze_ziv_subscript \n");
type = signed_type_for_types (TREE_TYPE (chrec_a), TREE_TYPE (chrec_b));
- chrec_a = chrec_convert (type, chrec_a, NULL_TREE);
- chrec_b = chrec_convert (type, chrec_b, NULL_TREE);
+ chrec_a = chrec_convert (type, chrec_a, NULL);
+ chrec_b = chrec_convert (type, chrec_b, NULL);
difference = chrec_fold_minus (type, chrec_a, chrec_b);
switch (TREE_CODE (difference))
@@ -1668,8 +1682,8 @@ analyze_siv_subscript_cst_affine (tree chrec_a,
tree type, difference, tmp;
type = signed_type_for_types (TREE_TYPE (chrec_a), TREE_TYPE (chrec_b));
- chrec_a = chrec_convert (type, chrec_a, NULL_TREE);
- chrec_b = chrec_convert (type, chrec_b, NULL_TREE);
+ chrec_a = chrec_convert (type, chrec_a, NULL);
+ chrec_b = chrec_convert (type, chrec_b, NULL);
difference = chrec_fold_minus (type, initial_condition (chrec_b), chrec_a);
if (!chrec_is_positive (initial_condition (difference), &value0))
@@ -1875,7 +1889,7 @@ initialize_matrix_A (lambda_matrix A, tree chrec, unsigned index, int mult)
case NOP_EXPR:
{
tree op = initialize_matrix_A (A, TREE_OPERAND (chrec, 0), index, mult);
- return chrec_convert (chrec_type (chrec), op, NULL_TREE);
+ return chrec_convert (chrec_type (chrec), op, NULL);
}
case INTEGER_CST:
@@ -2365,7 +2379,7 @@ can_use_analyze_subscript_affine_affine (tree *chrec_a, tree *chrec_b)
type = chrec_type (*chrec_a);
left_a = CHREC_LEFT (*chrec_a);
- left_b = chrec_convert (type, CHREC_LEFT (*chrec_b), NULL_TREE);
+ left_b = chrec_convert (type, CHREC_LEFT (*chrec_b), NULL);
diff = chrec_fold_minus (type, left_a, left_b);
if (!evolution_function_is_constant_p (diff))
@@ -2376,7 +2390,7 @@ can_use_analyze_subscript_affine_affine (tree *chrec_a, tree *chrec_b)
*chrec_a = build_polynomial_chrec (CHREC_VARIABLE (*chrec_a),
diff, CHREC_RIGHT (*chrec_a));
- right_b = chrec_convert (type, CHREC_RIGHT (*chrec_b), NULL_TREE);
+ right_b = chrec_convert (type, CHREC_RIGHT (*chrec_b), NULL);
*chrec_b = build_polynomial_chrec (CHREC_VARIABLE (*chrec_b),
build_int_cst (type, 0),
right_b);
@@ -2523,8 +2537,8 @@ analyze_miv_subscript (tree chrec_a,
fprintf (dump_file, "(analyze_miv_subscript \n");
type = signed_type_for_types (TREE_TYPE (chrec_a), TREE_TYPE (chrec_b));
- chrec_a = chrec_convert (type, chrec_a, NULL_TREE);
- chrec_b = chrec_convert (type, chrec_b, NULL_TREE);
+ chrec_a = chrec_convert (type, chrec_a, NULL);
+ chrec_b = chrec_convert (type, chrec_b, NULL);
difference = chrec_fold_minus (type, chrec_a, chrec_b);
if (eq_evolutions_p (chrec_a, chrec_b))
@@ -3474,8 +3488,8 @@ omega_setup_subscript (tree access_fun_a, tree access_fun_b,
int eq;
tree type = signed_type_for_types (TREE_TYPE (access_fun_a),
TREE_TYPE (access_fun_b));
- tree fun_a = chrec_convert (type, access_fun_a, NULL_TREE);
- tree fun_b = chrec_convert (type, access_fun_b, NULL_TREE);
+ tree fun_a = chrec_convert (type, access_fun_a, NULL);
+ tree fun_b = chrec_convert (type, access_fun_b, NULL);
tree difference = chrec_fold_minus (type, fun_a, fun_b);
/* When the fun_a - fun_b is not constant, the dependence is not
@@ -3835,9 +3849,9 @@ compute_affine_dependence (struct data_dependence_relation *ddr,
{
fprintf (dump_file, "(compute_affine_dependence\n");
fprintf (dump_file, " (stmt_a = \n");
- print_generic_expr (dump_file, DR_STMT (dra), 0);
+ print_gimple_stmt (dump_file, DR_STMT (dra), 0, 0);
fprintf (dump_file, ")\n (stmt_b = \n");
- print_generic_expr (dump_file, DR_STMT (drb), 0);
+ print_gimple_stmt (dump_file, DR_STMT (drb), 0, 0);
fprintf (dump_file, ")\n");
}
@@ -3988,32 +4002,32 @@ compute_all_dependences (VEC (data_reference_p, heap) *datarefs,
true if STMT clobbers memory, false otherwise. */
bool
-get_references_in_stmt (tree stmt, VEC (data_ref_loc, heap) **references)
+get_references_in_stmt (gimple stmt, VEC (data_ref_loc, heap) **references)
{
bool clobbers_memory = false;
data_ref_loc *ref;
- tree *op0, *op1, call;
+ tree *op0, *op1;
+ enum gimple_code stmt_code = gimple_code (stmt);
*references = NULL;
/* ASM_EXPR and CALL_EXPR may embed arbitrary side effects.
Calls have side-effects, except those to const or pure
functions. */
- call = get_call_expr_in (stmt);
- if ((call
- && !(call_expr_flags (call) & (ECF_CONST | ECF_PURE)))
- || (TREE_CODE (stmt) == ASM_EXPR
- && ASM_VOLATILE_P (stmt)))
+ if ((stmt_code == GIMPLE_CALL
+ && !(gimple_call_flags (stmt) & (ECF_CONST | ECF_PURE)))
+ || (stmt_code == GIMPLE_ASM
+ && gimple_asm_volatile_p (stmt)))
clobbers_memory = true;
if (ZERO_SSA_OPERANDS (stmt, SSA_OP_ALL_VIRTUALS))
return clobbers_memory;
- if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT)
+ if (stmt_code == GIMPLE_ASSIGN)
{
tree base;
- op0 = &GIMPLE_STMT_OPERAND (stmt, 0);
- op1 = &GIMPLE_STMT_OPERAND (stmt, 1);
+ op0 = gimple_assign_lhs_ptr (stmt);
+ op1 = gimple_assign_rhs1_ptr (stmt);
if (DECL_P (*op1)
|| (REFERENCE_CLASS_P (*op1)
@@ -4033,14 +4047,13 @@ get_references_in_stmt (tree stmt, VEC (data_ref_loc, heap) **references)
ref->is_read = false;
}
}
-
- if (call)
+ else if (stmt_code == GIMPLE_CALL)
{
- unsigned i, n = call_expr_nargs (call);
+ unsigned i, n = gimple_call_num_args (stmt);
for (i = 0; i < n; i++)
{
- op0 = &CALL_EXPR_ARG (call, i);
+ op0 = gimple_call_arg_ptr (stmt, i);
if (DECL_P (*op0)
|| (REFERENCE_CLASS_P (*op0) && get_base_address (*op0)))
@@ -4060,7 +4073,7 @@ get_references_in_stmt (tree stmt, VEC (data_ref_loc, heap) **references)
loop of the loop nest in that the references should be analyzed. */
static bool
-find_data_references_in_stmt (struct loop *nest, tree stmt,
+find_data_references_in_stmt (struct loop *nest, gimple stmt,
VEC (data_reference_p, heap) **datarefs)
{
unsigned i;
@@ -4110,7 +4123,7 @@ find_data_references_in_loop (struct loop *loop,
{
basic_block bb, *bbs;
unsigned int i;
- block_stmt_iterator bsi;
+ gimple_stmt_iterator bsi;
bbs = get_loop_body_in_dom_order (loop);
@@ -4118,9 +4131,9 @@ find_data_references_in_loop (struct loop *loop,
{
bb = bbs[i];
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
{
- tree stmt = bsi_stmt (bsi);
+ gimple stmt = gsi_stmt (bsi);
if (!find_data_references_in_stmt (loop, stmt, datarefs))
{
@@ -4443,7 +4456,7 @@ dump_rdg_vertex (FILE *file, struct graph *rdg, int i)
fprintf (file, " %d", e->dest);
fprintf (file, ") \n");
- print_generic_stmt (file, RDGV_STMT (v), TDF_VOPS|TDF_MEMSYMS);
+ print_gimple_stmt (file, RDGV_STMT (v), 0, TDF_VOPS|TDF_MEMSYMS);
fprintf (file, ")\n");
}
@@ -4579,14 +4592,14 @@ dot_rdg (struct graph *rdg)
struct rdg_vertex_info GTY(())
{
- tree stmt;
+ gimple stmt;
int index;
};
/* Returns the index of STMT in RDG. */
int
-rdg_vertex_for_stmt (struct graph *rdg, tree stmt)
+rdg_vertex_for_stmt (struct graph *rdg, gimple stmt)
{
struct rdg_vertex_info rvi, *slot;
@@ -4690,12 +4703,12 @@ create_rdg_edges (struct graph *rdg, VEC (ddr_p, heap) *ddrs)
/* Build the vertices of the reduced dependence graph RDG. */
static void
-create_rdg_vertices (struct graph *rdg, VEC (tree, heap) *stmts)
+create_rdg_vertices (struct graph *rdg, VEC (gimple, heap) *stmts)
{
int i, j;
- tree stmt;
+ gimple stmt;
- for (i = 0; VEC_iterate (tree, stmts, i, stmt); i++)
+ for (i = 0; VEC_iterate (gimple, stmts, i, stmt); i++)
{
VEC (data_ref_loc, heap) *references;
data_ref_loc *ref;
@@ -4717,7 +4730,7 @@ create_rdg_vertices (struct graph *rdg, VEC (tree, heap) *stmts)
RDG_MEM_WRITE_STMT (rdg, i) = false;
RDG_MEM_READS_STMT (rdg, i) = false;
- if (TREE_CODE (stmt) == PHI_NODE)
+ if (gimple_code (stmt) == GIMPLE_PHI)
continue;
get_references_in_stmt (stmt, &references);
@@ -4738,23 +4751,26 @@ create_rdg_vertices (struct graph *rdg, VEC (tree, heap) *stmts)
identifying statements. */
static void
-stmts_from_loop (struct loop *loop, VEC (tree, heap) **stmts)
+stmts_from_loop (struct loop *loop, VEC (gimple, heap) **stmts)
{
unsigned int i;
basic_block *bbs = get_loop_body_in_dom_order (loop);
for (i = 0; i < loop->num_nodes; i++)
{
- tree phi, stmt;
basic_block bb = bbs[i];
- block_stmt_iterator bsi;
+ gimple_stmt_iterator bsi;
+ gimple stmt;
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
- VEC_safe_push (tree, heap, *stmts, phi);
+ for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi); gsi_next (&bsi))
+ VEC_safe_push (gimple, heap, *stmts, gsi_stmt (bsi));
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
- if (TREE_CODE (stmt = bsi_stmt (bsi)) != LABEL_EXPR)
- VEC_safe_push (tree, heap, *stmts, stmt);
+ for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
+ {
+ stmt = gsi_stmt (bsi);
+ if (gimple_code (stmt) != GIMPLE_LABEL)
+ VEC_safe_push (gimple, heap, *stmts, stmt);
+ }
}
free (bbs);
@@ -4782,7 +4798,7 @@ hash_stmt_vertex_info (const void *elt)
{
const struct rdg_vertex_info *const rvi =
(const struct rdg_vertex_info *) elt;
- const_tree stmt = rvi->stmt;
+ gimple stmt = rvi->stmt;
return htab_hash_pointer (stmt);
}
@@ -4817,7 +4833,7 @@ build_rdg (struct loop *loop)
struct graph *rdg = NULL;
VEC (ddr_p, heap) *dependence_relations;
VEC (data_reference_p, heap) *datarefs;
- VEC (tree, heap) *stmts = VEC_alloc (tree, heap, nb_data_refs);
+ VEC (gimple, heap) *stmts = VEC_alloc (gimple, heap, nb_data_refs);
dependence_relations = VEC_alloc (ddr_p, heap, nb_data_refs * nb_data_refs) ;
datarefs = VEC_alloc (data_reference_p, heap, nb_data_refs);
@@ -4830,7 +4846,7 @@ build_rdg (struct loop *loop)
goto end_rdg;
stmts_from_loop (loop, &stmts);
- rdg = new_graph (VEC_length (tree, stmts));
+ rdg = new_graph (VEC_length (gimple, stmts));
rdg->indices = htab_create (nb_data_refs, hash_stmt_vertex_info,
eq_stmt_vertex_info, hash_stmt_vertex_del);
@@ -4840,7 +4856,7 @@ build_rdg (struct loop *loop)
end_rdg:
free_dependence_relations (dependence_relations);
free_data_refs (datarefs);
- VEC_free (tree, heap, stmts);
+ VEC_free (gimple, heap, stmts);
return rdg;
}
@@ -4863,7 +4879,7 @@ free_rdg (struct graph *rdg)
store to memory. */
void
-stores_from_loop (struct loop *loop, VEC (tree, heap) **stmts)
+stores_from_loop (struct loop *loop, VEC (gimple, heap) **stmts)
{
unsigned int i;
basic_block *bbs = get_loop_body_in_dom_order (loop);
@@ -4871,11 +4887,11 @@ stores_from_loop (struct loop *loop, VEC (tree, heap) **stmts)
for (i = 0; i < loop->num_nodes; i++)
{
basic_block bb = bbs[i];
- block_stmt_iterator bsi;
+ gimple_stmt_iterator bsi;
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
- if (!ZERO_SSA_OPERANDS (bsi_stmt (bsi), SSA_OP_VDEF))
- VEC_safe_push (tree, heap, *stmts, bsi_stmt (bsi));
+ for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
+ if (!ZERO_SSA_OPERANDS (gsi_stmt (bsi), SSA_OP_VDEF))
+ VEC_safe_push (gimple, heap, *stmts, gsi_stmt (bsi));
}
free (bbs);
@@ -4885,7 +4901,7 @@ stores_from_loop (struct loop *loop, VEC (tree, heap) **stmts)
address or NULL_TREE if the base is not determined. */
static inline tree
-ref_base_address (tree stmt, data_ref_loc *ref)
+ref_base_address (gimple stmt, data_ref_loc *ref)
{
tree base = NULL_TREE;
tree base_address;
@@ -4921,7 +4937,7 @@ ref_base_address (tree stmt, data_ref_loc *ref)
bool
rdg_defs_used_in_other_loops_p (struct graph *rdg, int v)
{
- tree stmt = RDG_STMT (rdg, v);
+ gimple stmt = RDG_STMT (rdg, v);
struct loop *loop = loop_containing_stmt (stmt);
use_operand_p imm_use_p;
imm_use_iterator iterator;
@@ -4949,7 +4965,7 @@ rdg_defs_used_in_other_loops_p (struct graph *rdg, int v)
ref_base_address is the same. */
bool
-have_similar_memory_accesses (tree s1, tree s2)
+have_similar_memory_accesses (gimple s1, gimple s2)
{
bool res = false;
unsigned i, j;
@@ -4983,8 +4999,8 @@ have_similar_memory_accesses (tree s1, tree s2)
static int
have_similar_memory_accesses_1 (const void *s1, const void *s2)
{
- return have_similar_memory_accesses (CONST_CAST_TREE ((const_tree)s1),
- CONST_CAST_TREE ((const_tree)s2));
+ return have_similar_memory_accesses (CONST_CAST_GIMPLE ((const_gimple) s1),
+ CONST_CAST_GIMPLE ((const_gimple) s2));
}
/* Helper function for the hashtab. */
@@ -4992,7 +5008,7 @@ have_similar_memory_accesses_1 (const void *s1, const void *s2)
static hashval_t
ref_base_address_1 (const void *s)
{
- tree stmt = CONST_CAST_TREE((const_tree)s);
+ gimple stmt = CONST_CAST_GIMPLE ((const_gimple) s);
unsigned i;
VEC (data_ref_loc, heap) *refs;
data_ref_loc *ref;
@@ -5014,21 +5030,21 @@ ref_base_address_1 (const void *s)
/* Try to remove duplicated write data references from STMTS. */
void
-remove_similar_memory_refs (VEC (tree, heap) **stmts)
+remove_similar_memory_refs (VEC (gimple, heap) **stmts)
{
unsigned i;
- tree stmt;
- htab_t seen = htab_create (VEC_length (tree, *stmts), ref_base_address_1,
+ gimple stmt;
+ htab_t seen = htab_create (VEC_length (gimple, *stmts), ref_base_address_1,
have_similar_memory_accesses_1, NULL);
- for (i = 0; VEC_iterate (tree, *stmts, i, stmt); )
+ for (i = 0; VEC_iterate (gimple, *stmts, i, stmt); )
{
void **slot;
slot = htab_find_slot (seen, stmt, INSERT);
if (*slot)
- VEC_ordered_remove (tree, *stmts, i);
+ VEC_ordered_remove (gimple, *stmts, i);
else
{
*slot = (void *) stmt;
diff --git a/gcc/tree-data-ref.h b/gcc/tree-data-ref.h
index c1672eb3d53..639a32bf82b 100644
--- a/gcc/tree-data-ref.h
+++ b/gcc/tree-data-ref.h
@@ -156,7 +156,7 @@ int access_matrix_get_index_for_parameter (tree, struct access_matrix *);
struct data_reference
{
/* A pointer to the statement that contains this DR. */
- tree stmt;
+ gimple stmt;
/* A pointer to the memory reference. */
tree ref;
@@ -368,7 +368,7 @@ typedef struct data_ref_loc_d
DEF_VEC_O (data_ref_loc);
DEF_VEC_ALLOC_O (data_ref_loc, heap);
-bool get_references_in_stmt (tree, VEC (data_ref_loc, heap) **);
+bool get_references_in_stmt (gimple, VEC (data_ref_loc, heap) **);
void dr_analyze_innermost (struct data_reference *);
extern bool compute_data_dependences_for_loop (struct loop *, bool,
VEC (data_reference_p, heap) **,
@@ -392,7 +392,7 @@ extern void free_dependence_relation (struct data_dependence_relation *);
extern void free_dependence_relations (VEC (ddr_p, heap) *);
extern void free_data_ref (data_reference_p);
extern void free_data_refs (VEC (data_reference_p, heap) *);
-struct data_reference *create_data_ref (struct loop *, tree, tree, bool);
+struct data_reference *create_data_ref (struct loop *, tree, gimple, bool);
bool find_loop_nest (struct loop *, VEC (loop_p, heap) **);
void compute_all_dependences (VEC (data_reference_p, heap) *,
VEC (ddr_p, heap) **, VEC (loop_p, heap) *, bool);
@@ -462,7 +462,7 @@ ddr_dependence_level (ddr_p ddr)
typedef struct rdg_vertex
{
/* The statement represented by this vertex. */
- tree stmt;
+ gimple stmt;
/* True when the statement contains a write to memory. */
bool has_mem_write;
@@ -485,7 +485,7 @@ void debug_rdg_component (struct graph *, int);
void dump_rdg (FILE *, struct graph *);
void debug_rdg (struct graph *);
void dot_rdg (struct graph *);
-int rdg_vertex_for_stmt (struct graph *, tree);
+int rdg_vertex_for_stmt (struct graph *, gimple);
/* Data dependence type. */
@@ -538,10 +538,10 @@ index_in_loop_nest (int var, VEC (loop_p, heap) *loop_nest)
return var_index;
}
-void stores_from_loop (struct loop *, VEC (tree, heap) **);
-void remove_similar_memory_refs (VEC (tree, heap) **);
+void stores_from_loop (struct loop *, VEC (gimple, heap) **);
+void remove_similar_memory_refs (VEC (gimple, heap) **);
bool rdg_defs_used_in_other_loops_p (struct graph *, int);
-bool have_similar_memory_accesses (tree, tree);
+bool have_similar_memory_accesses (gimple, gimple);
/* Determines whether RDG vertices V1 and V2 access to similar memory
locations, in which case they have to be in the same partition. */
diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c
index 285af39b3ca..df0be2df134 100644
--- a/gcc/tree-dfa.c
+++ b/gcc/tree-dfa.c
@@ -39,7 +39,7 @@ along with GCC; see the file COPYING3. If not see
#include "function.h"
#include "diagnostic.h"
#include "tree-dump.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "tree-flow.h"
#include "tree-inline.h"
#include "tree-pass.h"
@@ -52,13 +52,12 @@ along with GCC; see the file COPYING3. If not see
/* Counters used to display DFA and SSA statistics. */
struct dfa_stats_d
{
- long num_stmt_anns;
long num_var_anns;
long num_defs;
long num_uses;
long num_phis;
long num_phi_args;
- int max_num_phi_args;
+ size_t max_num_phi_args;
long num_vdefs;
long num_vuses;
};
@@ -66,7 +65,6 @@ struct dfa_stats_d
/* Local functions. */
static void collect_dfa_stats (struct dfa_stats_d *);
-static tree collect_dfa_stats_r (tree *, int *, void *);
static tree find_vars_r (tree *, int *, void *);
@@ -85,27 +83,28 @@ static unsigned int
find_referenced_vars (void)
{
basic_block bb;
- block_stmt_iterator si;
- tree phi;
+ gimple_stmt_iterator si;
FOR_EACH_BB (bb)
{
- for (si = bsi_start (bb); !bsi_end_p (si); bsi_next (&si))
+ for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si))
{
- tree *stmt_p = bsi_stmt_ptr (si);
- walk_tree (stmt_p, find_vars_r, NULL, NULL);
+ size_t i;
+ gimple stmt = gsi_stmt (si);
+ for (i = 0; i < gimple_num_ops (stmt); i++)
+ walk_tree (gimple_op_ptr (stmt, i), find_vars_r, NULL, NULL);
}
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
+ for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si))
{
- int len = PHI_NUM_ARGS (phi);
- int i;
+ gimple phi = gsi_stmt (si);
+ size_t i, len = gimple_phi_num_args (phi);
- walk_tree (&phi, find_vars_r, NULL, NULL);
+ walk_tree (gimple_phi_result_ptr (phi), find_vars_r, NULL, NULL);
for (i = 0; i < len; i++)
{
- tree arg = PHI_ARG_DEF (phi, i);
+ tree arg = gimple_phi_arg_def (phi, i);
walk_tree (&arg, find_vars_r, NULL, NULL);
}
}
@@ -176,29 +175,6 @@ create_function_ann (tree t)
return ann;
}
-/* Create a new annotation for a statement node T. */
-
-stmt_ann_t
-create_stmt_ann (tree t)
-{
- stmt_ann_t ann;
-
- gcc_assert (is_gimple_stmt (t));
- gcc_assert (!t->base.ann || t->base.ann->common.type == STMT_ANN);
-
- ann = GGC_CNEW (struct stmt_ann_d);
-
- ann->common.type = STMT_ANN;
-
- /* Since we just created the annotation, mark the statement modified. */
- ann->modified = true;
-
- ann->uid = inc_gimple_stmt_max_uid (cfun);
- t->base.ann = (tree_ann_t) ann;
-
- return ann;
-}
-
/* Renumber all of the gimple stmt uids. */
void
@@ -209,17 +185,11 @@ renumber_gimple_stmt_uids (void)
set_gimple_stmt_max_uid (cfun, 0);
FOR_ALL_BB (bb)
{
- block_stmt_iterator bsi;
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ gimple_stmt_iterator bsi;
+ for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
{
- tree stmt = bsi_stmt (bsi);
- /* If the stmt has an annotation, then overwrite it, if not,
- the process of getting it will set the number
- properly. */
- if (has_stmt_ann (stmt))
- set_gimple_stmt_uid (stmt, inc_gimple_stmt_max_uid (cfun));
- else
- get_stmt_ann (stmt);
+ gimple stmt = gsi_stmt (bsi);
+ gimple_set_uid (stmt, inc_gimple_stmt_max_uid (cfun));
}
}
}
@@ -237,6 +207,7 @@ create_tree_common_ann (tree t)
ann = GGC_CNEW (struct tree_ann_common_d);
ann->type = TREE_ANN_COMMON;
+ ann->rn = -1;
t->base.ann = (tree_ann_t) ann;
return ann;
@@ -448,11 +419,6 @@ dump_dfa_stats (FILE *file)
fprintf (file, fmt_str_1, "Referenced variables", (unsigned long)num_referenced_vars,
SCALE (size), LABEL (size));
- size = dfa_stats.num_stmt_anns * sizeof (struct stmt_ann_d);
- total += size;
- fprintf (file, fmt_str_1, "Statements annotated", dfa_stats.num_stmt_anns,
- SCALE (size), LABEL (size));
-
size = dfa_stats.num_var_anns * sizeof (struct var_ann_d);
total += size;
fprintf (file, fmt_str_1, "Variables annotated", dfa_stats.num_var_anns,
@@ -478,7 +444,7 @@ dump_dfa_stats (FILE *file)
fprintf (file, fmt_str_1, "VDEF operands", dfa_stats.num_vdefs,
SCALE (size), LABEL (size));
- size = dfa_stats.num_phis * sizeof (struct tree_phi_node);
+ size = dfa_stats.num_phis * sizeof (struct gimple_statement_phi);
total += size;
fprintf (file, fmt_str_1, "PHI nodes", dfa_stats.num_phis,
SCALE (size), LABEL (size));
@@ -495,9 +461,9 @@ dump_dfa_stats (FILE *file)
fprintf (file, "\n");
if (dfa_stats.num_phis)
- fprintf (file, "Average number of arguments per PHI node: %.1f (max: %d)\n",
+ fprintf (file, "Average number of arguments per PHI node: %.1f (max: %ld)\n",
(float) dfa_stats.num_phi_args / (float) dfa_stats.num_phis,
- dfa_stats.max_num_phi_args);
+ (long) dfa_stats.max_num_phi_args);
fprintf (file, "\n");
}
@@ -516,75 +482,44 @@ debug_dfa_stats (void)
DFA_STATS_P. */
static void
-collect_dfa_stats (struct dfa_stats_d *dfa_stats_p)
+collect_dfa_stats (struct dfa_stats_d *dfa_stats_p ATTRIBUTE_UNUSED)
{
- struct pointer_set_t *pset;
basic_block bb;
- block_stmt_iterator i;
+ referenced_var_iterator vi;
+ tree var;
gcc_assert (dfa_stats_p);
memset ((void *)dfa_stats_p, 0, sizeof (struct dfa_stats_d));
- /* Walk all the trees in the function counting references. Start at
- basic block NUM_FIXED_BLOCKS, but don't stop at block boundaries. */
- pset = pointer_set_create ();
-
- for (i = bsi_start (BASIC_BLOCK (NUM_FIXED_BLOCKS));
- !bsi_end_p (i); bsi_next (&i))
- walk_tree (bsi_stmt_ptr (i), collect_dfa_stats_r, (void *) dfa_stats_p,
- pset);
-
- pointer_set_destroy (pset);
+ /* Count all the variable annotations. */
+ FOR_EACH_REFERENCED_VAR (var, vi)
+ if (var_ann (var))
+ dfa_stats_p->num_var_anns++;
+ /* Walk all the statements in the function counting references. */
FOR_EACH_BB (bb)
{
- tree phi;
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
+ gimple_stmt_iterator si;
+
+ for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si))
{
+ gimple phi = gsi_stmt (si);
dfa_stats_p->num_phis++;
- dfa_stats_p->num_phi_args += PHI_NUM_ARGS (phi);
- if (PHI_NUM_ARGS (phi) > dfa_stats_p->max_num_phi_args)
- dfa_stats_p->max_num_phi_args = PHI_NUM_ARGS (phi);
+ dfa_stats_p->num_phi_args += gimple_phi_num_args (phi);
+ if (gimple_phi_num_args (phi) > dfa_stats_p->max_num_phi_args)
+ dfa_stats_p->max_num_phi_args = gimple_phi_num_args (phi);
}
- }
-}
-
-/* Callback for walk_tree to collect DFA statistics for a tree and its
- children. */
-
-static tree
-collect_dfa_stats_r (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED,
- void *data)
-{
- tree t = *tp;
- struct dfa_stats_d *dfa_stats_p = (struct dfa_stats_d *)data;
-
- if (t->base.ann)
- {
- switch (ann_type (t->base.ann))
+ for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si))
{
- case STMT_ANN:
- {
- dfa_stats_p->num_stmt_anns++;
- dfa_stats_p->num_defs += NUM_SSA_OPERANDS (t, SSA_OP_DEF);
- dfa_stats_p->num_uses += NUM_SSA_OPERANDS (t, SSA_OP_USE);
- dfa_stats_p->num_vdefs += NUM_SSA_OPERANDS (t, SSA_OP_VDEF);
- dfa_stats_p->num_vuses += NUM_SSA_OPERANDS (t, SSA_OP_VUSE);
- break;
- }
-
- case VAR_ANN:
- dfa_stats_p->num_var_anns++;
- break;
-
- default:
- break;
+ gimple stmt = gsi_stmt (si);
+ dfa_stats_p->num_defs += NUM_SSA_OPERANDS (stmt, SSA_OP_DEF);
+ dfa_stats_p->num_uses += NUM_SSA_OPERANDS (stmt, SSA_OP_USE);
+ dfa_stats_p->num_vdefs += NUM_SSA_OPERANDS (stmt, SSA_OP_VDEF);
+ dfa_stats_p->num_vuses += NUM_SSA_OPERANDS (stmt, SSA_OP_VUSE);
}
}
-
- return NULL;
}
@@ -800,7 +735,7 @@ get_virtual_var (tree var)
combination push_stmt_changes/pop_stmt_changes. */
void
-mark_symbols_for_renaming (tree stmt)
+mark_symbols_for_renaming (gimple stmt)
{
tree op;
ssa_op_iter iter;
@@ -814,8 +749,9 @@ mark_symbols_for_renaming (tree stmt)
}
-/* Find all variables within the gimplified statement that were not previously
- visible to the function and add them to the referenced variables list. */
+/* Find all variables within the gimplified statement that were not
+ previously visible to the function and add them to the referenced
+ variables list. */
static tree
find_new_referenced_vars_1 (tree *tp, int *walk_subtrees,
@@ -835,10 +771,13 @@ find_new_referenced_vars_1 (tree *tp, int *walk_subtrees,
return NULL;
}
+
+/* Find any new referenced variables in STMT. */
+
void
-find_new_referenced_vars (tree *stmt_p)
+find_new_referenced_vars (gimple stmt)
{
- walk_tree (stmt_p, find_new_referenced_vars_1, NULL, NULL);
+ walk_gimple_op (stmt, find_new_referenced_vars_1, NULL);
}
@@ -1013,7 +952,7 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset,
SSA_NAME_OCCURS_IN_ABNORMAL_PHI set, otherwise false. */
bool
-stmt_references_abnormal_ssa_name (tree stmt)
+stmt_references_abnormal_ssa_name (gimple stmt)
{
ssa_op_iter oi;
use_operand_p use_p;
@@ -1163,25 +1102,25 @@ refs_may_alias_p (tree ref1, tree ref2)
a PHI node as well. Note that if all VUSEs are default definitions
this function will return an empty statement. */
-tree
-get_single_def_stmt (tree stmt)
+gimple
+get_single_def_stmt (gimple stmt)
{
- tree def_stmt = NULL_TREE;
+ gimple def_stmt = NULL;
tree use;
ssa_op_iter iter;
FOR_EACH_SSA_TREE_OPERAND (use, stmt, iter, SSA_OP_VIRTUAL_USES)
{
- tree tmp = SSA_NAME_DEF_STMT (use);
+ gimple tmp = SSA_NAME_DEF_STMT (use);
/* ??? This is too simplistic for multiple virtual operands
reaching different PHI nodes of the same basic blocks or for
reaching all default definitions. */
if (def_stmt
&& def_stmt != tmp
- && !(IS_EMPTY_STMT (def_stmt)
- && IS_EMPTY_STMT (tmp)))
- return NULL_TREE;
+ && !(gimple_nop_p (def_stmt)
+ && gimple_nop_p (tmp)))
+ return NULL;
def_stmt = tmp;
}
@@ -1195,25 +1134,25 @@ get_single_def_stmt (tree stmt)
from a non-backedge. Returns NULL_TREE if such statement within
the above conditions cannot be found. */
-tree
-get_single_def_stmt_from_phi (tree ref, tree phi)
+gimple
+get_single_def_stmt_from_phi (tree ref, gimple phi)
{
tree def_arg = NULL_TREE;
- int i;
+ unsigned i;
/* Find the single PHI argument that is not flowing in from a
back edge and verify that the loop-carried definitions do
not alias the reference we look for. */
- for (i = 0; i < PHI_NUM_ARGS (phi); ++i)
+ for (i = 0; i < gimple_phi_num_args (phi); ++i)
{
tree arg = PHI_ARG_DEF (phi, i);
- tree def_stmt;
+ gimple def_stmt;
- if (!(PHI_ARG_EDGE (phi, i)->flags & EDGE_DFS_BACK))
+ if (!(gimple_phi_arg_edge (phi, i)->flags & EDGE_DFS_BACK))
{
/* Multiple non-back edges? Do not try to handle this. */
if (def_arg)
- return NULL_TREE;
+ return NULL;
def_arg = arg;
continue;
}
@@ -1223,14 +1162,14 @@ get_single_def_stmt_from_phi (tree ref, tree phi)
def_stmt = SSA_NAME_DEF_STMT (arg);
do
{
- if (TREE_CODE (def_stmt) != GIMPLE_MODIFY_STMT
- || refs_may_alias_p (ref, GIMPLE_STMT_OPERAND (def_stmt, 0)))
- return NULL_TREE;
+ if (!is_gimple_assign (def_stmt)
+ || refs_may_alias_p (ref, gimple_assign_lhs (def_stmt)))
+ return NULL;
/* ??? This will only work, reaching the PHI node again if
there is a single virtual operand on def_stmt. */
def_stmt = get_single_def_stmt (def_stmt);
if (!def_stmt)
- return NULL_TREE;
+ return NULL;
}
while (def_stmt != phi);
}
@@ -1243,8 +1182,8 @@ get_single_def_stmt_from_phi (tree ref, tree phi)
Take into account only definitions that alias REF if following
back-edges when looking through a loop PHI node. */
-tree
-get_single_def_stmt_with_phi (tree ref, tree stmt)
+gimple
+get_single_def_stmt_with_phi (tree ref, gimple stmt)
{
switch (NUM_SSA_OPERANDS (stmt, SSA_OP_VIRTUAL_USES))
{
@@ -1253,11 +1192,11 @@ get_single_def_stmt_with_phi (tree ref, tree stmt)
case 1:
{
- tree def_stmt = SSA_NAME_DEF_STMT (SINGLE_SSA_TREE_OPERAND
+ gimple def_stmt = SSA_NAME_DEF_STMT (SINGLE_SSA_TREE_OPERAND
(stmt, SSA_OP_VIRTUAL_USES));
/* We can handle lookups over PHI nodes only for a single
virtual operand. */
- if (TREE_CODE (def_stmt) == PHI_NODE)
+ if (gimple_code (def_stmt) == GIMPLE_PHI)
return get_single_def_stmt_from_phi (ref, def_stmt);
return def_stmt;
}
diff --git a/gcc/tree-dump.c b/gcc/tree-dump.c
index 7cc0285ff48..ffac189f449 100644
--- a/gcc/tree-dump.c
+++ b/gcc/tree-dump.c
@@ -598,11 +598,6 @@ dequeue_and_dump (dump_info_p di)
dump_child ("op 1", TREE_OPERAND (t, 1));
break;
- case GIMPLE_MODIFY_STMT:
- dump_child ("op 0", GIMPLE_STMT_OPERAND (t, 0));
- dump_child ("op 1", GIMPLE_STMT_OPERAND (t, 1));
- break;
-
case COMPONENT_REF:
dump_child ("op 0", TREE_OPERAND (t, 0));
dump_child ("op 1", TREE_OPERAND (t, 1));
@@ -825,7 +820,8 @@ static const struct dump_option_value_info dump_options[] =
{"memsyms", TDF_MEMSYMS},
{"verbose", TDF_VERBOSE},
{"all", ~(TDF_RAW | TDF_SLIM | TDF_LINENO | TDF_TREE | TDF_RTL | TDF_IPA
- | TDF_STMTADDR | TDF_GRAPH | TDF_DIAGNOSTIC | TDF_VERBOSE)},
+ | TDF_STMTADDR | TDF_GRAPH | TDF_DIAGNOSTIC | TDF_VERBOSE
+ | TDF_RHS_ONLY)},
{NULL, 0}
};
@@ -836,9 +832,9 @@ dump_register (const char *suffix, const char *swtch, const char *glob,
static int next_dump = FIRST_AUTO_NUMBERED_DUMP;
int num = next_dump++;
- size_t this = extra_dump_files_in_use++;
+ size_t count = extra_dump_files_in_use++;
- if (this >= extra_dump_files_alloced)
+ if (count >= extra_dump_files_alloced)
{
if (extra_dump_files_alloced == 0)
extra_dump_files_alloced = 32;
@@ -849,14 +845,14 @@ dump_register (const char *suffix, const char *swtch, const char *glob,
extra_dump_files_alloced);
}
- memset (&extra_dump_files[this], 0, sizeof (struct dump_file_info));
- extra_dump_files[this].suffix = suffix;
- extra_dump_files[this].swtch = swtch;
- extra_dump_files[this].glob = glob;
- extra_dump_files[this].flags = flags;
- extra_dump_files[this].num = num;
+ memset (&extra_dump_files[count], 0, sizeof (struct dump_file_info));
+ extra_dump_files[count].suffix = suffix;
+ extra_dump_files[count].swtch = swtch;
+ extra_dump_files[count].glob = glob;
+ extra_dump_files[count].flags = flags;
+ extra_dump_files[count].num = num;
- return this + TDI_end;
+ return count + TDI_end;
}
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index 965acce7490..a8885e36d1a 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -37,9 +37,12 @@ along with GCC; see the file COPYING3. If not see
#include "langhooks.h"
#include "ggc.h"
#include "toplev.h"
-#include "pointer-set.h"
+#include "gimple.h"
+
+/* In some instances a tree and a gimple need to be stored in a same table,
+ i.e. in hash tables. This is a structure to do this. */
+typedef union {tree *tp; tree t; gimple g;} treemple;
-
/* Nonzero if we are using EH to handle cleanups. */
static int using_eh_for_cleanups_p = 0;
@@ -48,7 +51,7 @@ using_eh_for_cleanups (void)
{
using_eh_for_cleanups_p = 1;
}
-
+
/* Misc functions used in this file. */
/* Compare and hash for any structure which begins with a canonical
@@ -70,7 +73,7 @@ struct_ptr_hash (const void *a)
return (size_t)*x >> 4;
}
-
+
/* Remember and lookup EH region data for arbitrary statements.
Really this means any statement that could_throw_p. We could
stuff this information into the stmt_ann data structure, but:
@@ -84,7 +87,7 @@ struct_ptr_hash (const void *a)
of space by only allocating memory for those that can throw. */
static void
-record_stmt_eh_region (struct eh_region *region, tree t)
+record_stmt_eh_region (struct eh_region *region, gimple t)
{
if (!region)
return;
@@ -92,14 +95,17 @@ record_stmt_eh_region (struct eh_region *region, tree t)
add_stmt_to_eh_region (t, get_eh_region_number (region));
}
+
+/* Add statement T in function IFUN to EH region NUM. */
+
void
-add_stmt_to_eh_region_fn (struct function *ifun, tree t, int num)
+add_stmt_to_eh_region_fn (struct function *ifun, gimple t, int num)
{
struct throw_stmt_node *n;
void **slot;
gcc_assert (num >= 0);
- gcc_assert (TREE_CODE (t) != RESX_EXPR);
+ gcc_assert (gimple_code (t) != GIMPLE_RESX);
n = GGC_NEW (struct throw_stmt_node);
n->stmt = t;
@@ -115,14 +121,21 @@ add_stmt_to_eh_region_fn (struct function *ifun, tree t, int num)
*slot = n;
}
+
+/* Add statement T in the current function (cfun) to EH region number
+ NUM. */
+
void
-add_stmt_to_eh_region (tree t, int num)
+add_stmt_to_eh_region (gimple t, int num)
{
add_stmt_to_eh_region_fn (cfun, t, num);
}
+
+/* Remove statement T in function IFUN from the EH region holding it. */
+
bool
-remove_stmt_from_eh_region_fn (struct function *ifun, tree t)
+remove_stmt_from_eh_region_fn (struct function *ifun, gimple t)
{
struct throw_stmt_node dummy;
void **slot;
@@ -142,54 +155,98 @@ remove_stmt_from_eh_region_fn (struct function *ifun, tree t)
return false;
}
+
+/* Remove statement T in the current function (cfun) from the EH
+ region holding it. */
+
bool
-remove_stmt_from_eh_region (tree t)
+remove_stmt_from_eh_region (gimple t)
{
return remove_stmt_from_eh_region_fn (cfun, t);
}
+/* Determine if statement T is inside an EH region in function IFUN.
+ Return the EH region number if found, return -2 if IFUN does not
+ have an EH table and -1 if T could not be found in IFUN's EH region
+ table. */
+
int
-lookup_stmt_eh_region_fn (struct function *ifun, const_tree t)
+lookup_stmt_eh_region_fn (struct function *ifun, gimple t)
{
struct throw_stmt_node *p, n;
if (!get_eh_throw_stmt_table (ifun))
return -2;
- /* The CONST_CAST is okay because we don't modify n.stmt throughout
- its scope, or the scope of p. */
- n.stmt = CONST_CAST_TREE (t);
- p = (struct throw_stmt_node *) htab_find (get_eh_throw_stmt_table (ifun),
- &n);
-
+ n.stmt = t;
+ p = (struct throw_stmt_node *) htab_find (get_eh_throw_stmt_table (ifun), &n);
return (p ? p->region_nr : -1);
}
+
+/* Determine if statement T is inside an EH region in the current
+ function (cfun). Return the EH region number if found, return -2
+ if cfun does not have an EH table and -1 if T could not be found in
+ cfun's EH region table. */
+
int
-lookup_stmt_eh_region (const_tree t)
+lookup_stmt_eh_region (gimple t)
{
/* We can get called from initialized data when -fnon-call-exceptions
is on; prevent crash. */
if (!cfun)
return -1;
+
return lookup_stmt_eh_region_fn (cfun, t);
}
-
-/* First pass of EH node decomposition. Build up a tree of TRY_FINALLY_EXPR
+
+/* Determine if expression T is inside an EH region in the current
+ function (cfun). Return the EH region number if found, return -2
+ if IFUN does not have an EH table and -1 if T could not be found in
+ IFUN's EH region table. */
+
+int
+lookup_expr_eh_region (tree t)
+{
+ /* We can get called from initialized data when -fnon-call-exceptions
+ is on; prevent crash. */
+ if (!cfun)
+ return -1;
+
+ if (!get_eh_throw_stmt_table (cfun))
+ return -2;
+
+ if (t && EXPR_P (t))
+ {
+ tree_ann_common_t ann = tree_common_ann (t);
+ if (ann)
+ return (int) ann->rn;
+ }
+
+ return -1;
+}
+
+
+/* First pass of EH node decomposition. Build up a tree of GIMPLE_TRY_FINALLY
nodes and LABEL_DECL nodes. We will use this during the second phase to
determine if a goto leaves the body of a TRY_FINALLY_EXPR node. */
struct finally_tree_node
{
- tree child, parent;
+ /* When storing a GIMPLE_TRY, we have to record a gimple. However
+ when deciding whether a GOTO to a certain LABEL_DECL (which is a
+ tree) leaves the TRY block, its necessary to record a tree in
+ this field. Thus a treemple is used. */
+ treemple child;
+ gimple parent;
};
/* Note that this table is *not* marked GTY. It is short-lived. */
static htab_t finally_tree;
static void
-record_in_finally_tree (tree child, tree parent)
+record_in_finally_tree (treemple child, gimple parent)
{
struct finally_tree_node *n;
void **slot;
@@ -204,40 +261,53 @@ record_in_finally_tree (tree child, tree parent)
}
static void
-collect_finally_tree (tree t, tree region)
+collect_finally_tree (gimple stmt, gimple region);
+
+/* Go through the gimple sequence. Works with collect_finally_tree to
+ record all GIMPLE_LABEL and GIMPLE_TRY statements. */
+
+static void
+collect_finally_tree_1 (gimple_seq seq, gimple region)
{
- tailrecurse:
- switch (TREE_CODE (t))
- {
- case LABEL_EXPR:
- record_in_finally_tree (LABEL_EXPR_LABEL (t), region);
- break;
+ gimple_stmt_iterator gsi;
- case TRY_FINALLY_EXPR:
- record_in_finally_tree (t, region);
- collect_finally_tree (TREE_OPERAND (t, 0), t);
- t = TREE_OPERAND (t, 1);
- goto tailrecurse;
+ for (gsi = gsi_start (seq); !gsi_end_p (gsi); gsi_next (&gsi))
+ collect_finally_tree (gsi_stmt (gsi), region);
+}
- case TRY_CATCH_EXPR:
- collect_finally_tree (TREE_OPERAND (t, 0), region);
- t = TREE_OPERAND (t, 1);
- goto tailrecurse;
+static void
+collect_finally_tree (gimple stmt, gimple region)
+{
+ treemple temp;
+
+ switch (gimple_code (stmt))
+ {
+ case GIMPLE_LABEL:
+ temp.t = gimple_label_label (stmt);
+ record_in_finally_tree (temp, region);
+ break;
- case CATCH_EXPR:
- t = CATCH_BODY (t);
- goto tailrecurse;
+ case GIMPLE_TRY:
+ if (gimple_try_kind (stmt) == GIMPLE_TRY_FINALLY)
+ {
+ temp.g = stmt;
+ record_in_finally_tree (temp, region);
+ collect_finally_tree_1 (gimple_try_eval (stmt), stmt);
+ collect_finally_tree_1 (gimple_try_cleanup (stmt), region);
+ }
+ else if (gimple_try_kind (stmt) == GIMPLE_TRY_CATCH)
+ {
+ collect_finally_tree_1 (gimple_try_eval (stmt), region);
+ collect_finally_tree_1 (gimple_try_cleanup (stmt), region);
+ }
+ break;
- case EH_FILTER_EXPR:
- t = EH_FILTER_FAILURE (t);
- goto tailrecurse;
+ case GIMPLE_CATCH:
+ collect_finally_tree_1 (gimple_catch_handler (stmt), region);
+ break;
- case STATEMENT_LIST:
- {
- tree_stmt_iterator i;
- for (i = tsi_start (t); !tsi_end_p (i); tsi_next (&i))
- collect_finally_tree (tsi_stmt (i), region);
- }
+ case GIMPLE_EH_FILTER:
+ collect_finally_tree_1 (gimple_eh_filter_failure (stmt), region);
break;
default:
@@ -247,11 +317,12 @@ collect_finally_tree (tree t, tree region)
}
}
+
/* Use the finally tree to determine if a jump from START to TARGET
would leave the try_finally node that START lives in. */
static bool
-outside_finally_tree (tree start, tree target)
+outside_finally_tree (treemple start, gimple target)
{
struct finally_tree_node n, *p;
@@ -261,15 +332,15 @@ outside_finally_tree (tree start, tree target)
p = (struct finally_tree_node *) htab_find (finally_tree, &n);
if (!p)
return true;
- start = p->parent;
+ start.g = p->parent;
}
- while (start != target);
+ while (start.g != target);
return false;
}
-
-/* Second pass of EH node decomposition. Actually transform the TRY_FINALLY
- and TRY_CATCH nodes into a set of gotos, magic labels, and eh regions.
+
+/* Second pass of EH node decomposition. Actually transform the GIMPLE_TRY
+ nodes into a set of gotos, magic labels, and eh regions.
The eh region creation is straight-forward, but frobbing all the gotos
and such into shape isn't. */
@@ -291,12 +362,15 @@ struct leh_state
struct leh_tf_state
{
- /* Pointer to the TRY_FINALLY node under discussion. The try_finally_expr
- is the original TRY_FINALLY_EXPR. We need to retain this so that
- outside_finally_tree can reliably reference the tree used in the
- collect_finally_tree data structures. */
- tree try_finally_expr;
- tree *top_p;
+ /* Pointer to the GIMPLE_TRY_FINALLY node under discussion. The
+ try_finally_expr is the original GIMPLE_TRY_FINALLY. We need to retain
+ this so that outside_finally_tree can reliably reference the tree used
+ in the collect_finally_tree data structures. */
+ gimple try_finally_expr;
+ gimple top_p;
+ /* While lowering a top_p usually it is expanded into multiple statements,
+ thus we need the following field to store them. */
+ gimple_seq top_p_seq;
/* The state outside this try_finally node. */
struct leh_state *outer;
@@ -304,13 +378,22 @@ struct leh_tf_state
/* The exception region created for it. */
struct eh_region *region;
- /* The GOTO_QUEUE is is an array of GOTO_EXPR and RETURN_EXPR statements
- that are seen to escape this TRY_FINALLY_EXPR node. */
+ /* The GOTO_QUEUE is is an array of GIMPLE_GOTO and GIMPLE_RETURN statements
+ that are seen to escape this GIMPLE_TRY_FINALLY node.
+ The idea is to record a gimple statement for everything except for
+ the conditionals, which get their labels recorded. Since labels are of
+ type 'tree', we need this node to store both gimple and tree objects.
+ REPL_STMT is the sequence used to replace the goto/return statement.
+ CONT_STMT is used to store the statement that allows the return/goto to
+ jump to the original destination. */
struct goto_queue_node {
- tree stmt;
- tree repl_stmt;
- tree cont_stmt;
+ treemple stmt;
+ gimple_seq repl_stmt;
+ gimple cont_stmt;
int index;
+ /* this is used when index >= 0 to indicate that stmt is a label(as
+ opposed to a goto stmt) */
+ int is_label;
} *goto_queue;
size_t goto_queue_size;
size_t goto_queue_active;
@@ -334,7 +417,7 @@ struct leh_tf_state
Cleared if the fallthru is converted to a goto. */
bool may_fallthru;
- /* True if any entry in goto_queue is a RETURN_EXPR. */
+ /* True if any entry in goto_queue is a GIMPLE_RETURN. */
bool may_return;
/* True if the finally block can receive an exception edge.
@@ -342,16 +425,17 @@ struct leh_tf_state
bool may_throw;
};
-static void lower_eh_filter (struct leh_state *, tree *);
-static void lower_eh_constructs_1 (struct leh_state *, tree *);
+static gimple_seq lower_eh_filter (struct leh_state *, gimple);
/* Search for STMT in the goto queue. Return the replacement,
or null if the statement isn't in the queue. */
#define LARGE_GOTO_QUEUE 20
-static tree
-find_goto_replacement (struct leh_tf_state *tf, tree stmt)
+static void lower_eh_constructs_1 (struct leh_state *state, gimple_seq seq);
+
+static gimple_seq
+find_goto_replacement (struct leh_tf_state *tf, treemple stmt)
{
unsigned int i;
void **slot;
@@ -359,7 +443,7 @@ find_goto_replacement (struct leh_tf_state *tf, tree stmt)
if (tf->goto_queue_active < LARGE_GOTO_QUEUE)
{
for (i = 0; i < tf->goto_queue_active; i++)
- if (tf->goto_queue[i].stmt == stmt)
+ if ( tf->goto_queue[i].stmt.g == stmt.g)
return tf->goto_queue[i].repl_stmt;
return NULL;
}
@@ -372,13 +456,14 @@ find_goto_replacement (struct leh_tf_state *tf, tree stmt)
tf->goto_queue_map = pointer_map_create ();
for (i = 0; i < tf->goto_queue_active; i++)
{
- slot = pointer_map_insert (tf->goto_queue_map, tf->goto_queue[i].stmt);
+ slot = pointer_map_insert (tf->goto_queue_map,
+ tf->goto_queue[i].stmt.g);
gcc_assert (*slot == NULL);
- *slot = (void *) &tf->goto_queue[i];
+ *slot = &tf->goto_queue[i];
}
}
- slot = pointer_map_contains (tf->goto_queue_map, stmt);
+ slot = pointer_map_contains (tf->goto_queue_map, stmt.g);
if (slot != NULL)
return (((struct goto_queue_node *) *slot)->repl_stmt);
@@ -386,91 +471,98 @@ find_goto_replacement (struct leh_tf_state *tf, tree stmt)
}
/* A subroutine of replace_goto_queue_1. Handles the sub-clauses of a
- lowered COND_EXPR. If, by chance, the replacement is a simple goto,
+ lowered GIMPLE_COND. If, by chance, the replacement is a simple goto,
then we can just splat it in, otherwise we add the new stmts immediately
- after the COND_EXPR and redirect. */
+ after the GIMPLE_COND and redirect. */
static void
replace_goto_queue_cond_clause (tree *tp, struct leh_tf_state *tf,
- tree_stmt_iterator *tsi)
+ gimple_stmt_iterator *gsi)
{
- tree new, one, label;
+ tree label;
+ gimple_seq new_seq;
+ treemple temp;
- new = find_goto_replacement (tf, *tp);
- if (!new)
+ temp.tp = tp;
+ new_seq = find_goto_replacement (tf, temp);
+ if (!new_seq)
return;
- one = expr_only (new);
- if (one && TREE_CODE (one) == GOTO_EXPR)
+ if (gimple_seq_singleton_p (new_seq)
+ && gimple_code (gimple_seq_first_stmt (new_seq)) == GIMPLE_GOTO)
{
- *tp = one;
+ *tp = gimple_goto_dest (gimple_seq_first_stmt (new_seq));
return;
}
- label = build1 (LABEL_EXPR, void_type_node, NULL_TREE);
- *tp = build_and_jump (&LABEL_EXPR_LABEL (label));
+ label = create_artificial_label ();
+ /* Set the new label for the GIMPLE_COND */
+ *tp = label;
- tsi_link_after (tsi, label, TSI_CONTINUE_LINKING);
- tsi_link_after (tsi, new, TSI_CONTINUE_LINKING);
+ gsi_insert_after (gsi, gimple_build_label (label), GSI_CONTINUE_LINKING);
+ gsi_insert_seq_after (gsi, gimple_seq_copy (new_seq), GSI_CONTINUE_LINKING);
}
/* The real work of replace_goto_queue. Returns with TSI updated to
point to the next statement. */
-static void replace_goto_queue_stmt_list (tree, struct leh_tf_state *);
+static void replace_goto_queue_stmt_list (gimple_seq, struct leh_tf_state *);
static void
-replace_goto_queue_1 (tree t, struct leh_tf_state *tf, tree_stmt_iterator *tsi)
+replace_goto_queue_1 (gimple stmt, struct leh_tf_state *tf,
+ gimple_stmt_iterator *gsi)
{
- switch (TREE_CODE (t))
+ gimple_seq seq;
+ treemple temp;
+ temp.g = NULL;
+
+ switch (gimple_code (stmt))
{
- case GOTO_EXPR:
- case RETURN_EXPR:
- t = find_goto_replacement (tf, t);
- if (t)
+ case GIMPLE_GOTO:
+ case GIMPLE_RETURN:
+ temp.g = stmt;
+ seq = find_goto_replacement (tf, temp);
+ if (seq)
{
- tsi_link_before (tsi, t, TSI_SAME_STMT);
- tsi_delink (tsi);
+ gsi_insert_seq_before (gsi, gimple_seq_copy (seq), GSI_SAME_STMT);
+ gsi_remove (gsi, false);
return;
}
break;
- case COND_EXPR:
- replace_goto_queue_cond_clause (&COND_EXPR_THEN (t), tf, tsi);
- replace_goto_queue_cond_clause (&COND_EXPR_ELSE (t), tf, tsi);
+ case GIMPLE_COND:
+ replace_goto_queue_cond_clause (gimple_op_ptr (stmt, 2), tf, gsi);
+ replace_goto_queue_cond_clause (gimple_op_ptr (stmt, 3), tf, gsi);
break;
- case TRY_FINALLY_EXPR:
- case TRY_CATCH_EXPR:
- replace_goto_queue_stmt_list (TREE_OPERAND (t, 0), tf);
- replace_goto_queue_stmt_list (TREE_OPERAND (t, 1), tf);
+ case GIMPLE_TRY:
+ replace_goto_queue_stmt_list (gimple_try_eval (stmt), tf);
+ replace_goto_queue_stmt_list (gimple_try_cleanup (stmt), tf);
break;
- case CATCH_EXPR:
- replace_goto_queue_stmt_list (CATCH_BODY (t), tf);
+ case GIMPLE_CATCH:
+ replace_goto_queue_stmt_list (gimple_catch_handler (stmt), tf);
break;
- case EH_FILTER_EXPR:
- replace_goto_queue_stmt_list (EH_FILTER_FAILURE (t), tf);
+ case GIMPLE_EH_FILTER:
+ replace_goto_queue_stmt_list (gimple_eh_filter_failure (stmt), tf);
break;
- case STATEMENT_LIST:
- gcc_unreachable ();
-
default:
/* These won't have gotos in them. */
break;
}
- tsi_next (tsi);
+ gsi_next (gsi);
}
-/* A subroutine of replace_goto_queue. Handles STATEMENT_LISTs. */
+/* A subroutine of replace_goto_queue. Handles GIMPLE_SEQ. */
static void
-replace_goto_queue_stmt_list (tree t, struct leh_tf_state *tf)
+replace_goto_queue_stmt_list (gimple_seq seq, struct leh_tf_state *tf)
{
- tree_stmt_iterator i = tsi_start (t);
- while (!tsi_end_p (i))
- replace_goto_queue_1 (tsi_stmt (i), tf, &i);
+ gimple_stmt_iterator gsi = gsi_start (seq);
+
+ while (!gsi_end_p (gsi))
+ replace_goto_queue_1 (gsi_stmt (gsi), tf, &gsi);
}
/* Replace all goto queue members. */
@@ -480,66 +572,21 @@ replace_goto_queue (struct leh_tf_state *tf)
{
if (tf->goto_queue_active == 0)
return;
- replace_goto_queue_stmt_list (*tf->top_p, tf);
+ replace_goto_queue_stmt_list (tf->top_p_seq, tf);
}
-/* For any GOTO_EXPR or RETURN_EXPR, decide whether it leaves a try_finally
- node, and if so record that fact in the goto queue associated with that
- try_finally node. */
+/* Add a new record to the goto queue contained in TF. NEW_STMT is the
+ data to be added, IS_LABEL indicates whether NEW_STMT is a label or
+ a gimple return. */
static void
-maybe_record_in_goto_queue (struct leh_state *state, tree stmt)
+record_in_goto_queue (struct leh_tf_state *tf,
+ treemple new_stmt,
+ int index,
+ bool is_label)
{
- struct leh_tf_state *tf = state->tf;
- struct goto_queue_node *q;
size_t active, size;
- int index;
-
- if (!tf)
- return;
-
- switch (TREE_CODE (stmt))
- {
- case GOTO_EXPR:
- {
- tree lab = GOTO_DESTINATION (stmt);
-
- /* Computed and non-local gotos do not get processed. Given
- their nature we can neither tell whether we've escaped the
- finally block nor redirect them if we knew. */
- if (TREE_CODE (lab) != LABEL_DECL)
- return;
-
- /* No need to record gotos that don't leave the try block. */
- if (! outside_finally_tree (lab, tf->try_finally_expr))
- return;
-
- if (! tf->dest_array)
- {
- tf->dest_array = VEC_alloc (tree, heap, 10);
- VEC_quick_push (tree, tf->dest_array, lab);
- index = 0;
- }
- else
- {
- int n = VEC_length (tree, tf->dest_array);
- for (index = 0; index < n; ++index)
- if (VEC_index (tree, tf->dest_array, index) == lab)
- break;
- if (index == n)
- VEC_safe_push (tree, heap, tf->dest_array, lab);
- }
- }
- break;
-
- case RETURN_EXPR:
- tf->may_return = true;
- index = -1;
- break;
-
- default:
- gcc_unreachable ();
- }
+ struct goto_queue_node *q;
gcc_assert (!tf->goto_queue_map);
@@ -557,32 +604,118 @@ maybe_record_in_goto_queue (struct leh_state *state, tree stmt)
tf->goto_queue_active = active + 1;
memset (q, 0, sizeof (*q));
- q->stmt = stmt;
+ q->stmt = new_stmt;
q->index = index;
+ q->is_label = is_label;
+}
+
+/* Record the LABEL label in the goto queue contained in TF.
+ TF is not null. */
+
+static void
+record_in_goto_queue_label (struct leh_tf_state *tf, treemple stmt, tree label)
+{
+ int index;
+ treemple temp, new_stmt;
+
+ if (!label)
+ return;
+
+ /* Computed and non-local gotos do not get processed. Given
+ their nature we can neither tell whether we've escaped the
+ finally block nor redirect them if we knew. */
+ if (TREE_CODE (label) != LABEL_DECL)
+ return;
+
+ /* No need to record gotos that don't leave the try block. */
+ temp.t = label;
+ if (!outside_finally_tree (temp, tf->try_finally_expr))
+ return;
+
+ if (! tf->dest_array)
+ {
+ tf->dest_array = VEC_alloc (tree, heap, 10);
+ VEC_quick_push (tree, tf->dest_array, label);
+ index = 0;
+ }
+ else
+ {
+ int n = VEC_length (tree, tf->dest_array);
+ for (index = 0; index < n; ++index)
+ if (VEC_index (tree, tf->dest_array, index) == label)
+ break;
+ if (index == n)
+ VEC_safe_push (tree, heap, tf->dest_array, label);
+ }
+
+ /* In the case of a GOTO we want to record the destination label,
+ since with a GIMPLE_COND we have an easy access to the then/else
+ labels. */
+ new_stmt = stmt;
+ record_in_goto_queue (tf, new_stmt, index, true);
+
+}
+
+/* For any GIMPLE_GOTO or GIMPLE_RETURN, decide whether it leaves a try_finally
+ node, and if so record that fact in the goto queue associated with that
+ try_finally node. */
+
+static void
+maybe_record_in_goto_queue (struct leh_state *state, gimple stmt)
+{
+ struct leh_tf_state *tf = state->tf;
+ treemple new_stmt;
+
+ if (!tf)
+ return;
+
+ switch (gimple_code (stmt))
+ {
+ case GIMPLE_COND:
+ new_stmt.tp = gimple_op_ptr (stmt, 2);
+ record_in_goto_queue_label (tf, new_stmt, gimple_cond_true_label (stmt));
+ new_stmt.tp = gimple_op_ptr (stmt, 3);
+ record_in_goto_queue_label (tf, new_stmt, gimple_cond_false_label (stmt));
+ break;
+ case GIMPLE_GOTO:
+ new_stmt.g = stmt;
+ record_in_goto_queue_label (tf, new_stmt, gimple_goto_dest (stmt));
+ break;
+
+ case GIMPLE_RETURN:
+ tf->may_return = true;
+ new_stmt.g = stmt;
+ record_in_goto_queue (tf, new_stmt, -1, false);
+ break;
+
+ default:
+ gcc_unreachable ();
+ }
}
+
#ifdef ENABLE_CHECKING
-/* We do not process SWITCH_EXPRs for now. As long as the original source
+/* We do not process GIMPLE_SWITCHes for now. As long as the original source
was in fact structured, and we've not yet done jump threading, then none
- of the labels will leave outer TRY_FINALLY_EXPRs. Verify this. */
+ of the labels will leave outer GIMPLE_TRY_FINALLY nodes. Verify this. */
static void
-verify_norecord_switch_expr (struct leh_state *state, tree switch_expr)
+verify_norecord_switch_expr (struct leh_state *state, gimple switch_expr)
{
struct leh_tf_state *tf = state->tf;
size_t i, n;
- tree vec;
if (!tf)
return;
- vec = SWITCH_LABELS (switch_expr);
- n = TREE_VEC_LENGTH (vec);
+ n = gimple_switch_num_labels (switch_expr);
for (i = 0; i < n; ++i)
{
- tree lab = CASE_LABEL (TREE_VEC_ELT (vec, i));
- gcc_assert (!outside_finally_tree (lab, tf->try_finally_expr));
+ treemple temp;
+ tree lab = CASE_LABEL (gimple_switch_label (switch_expr, i));
+ temp.t = lab;
+ gcc_assert (!outside_finally_tree (temp, tf->try_finally_expr));
}
}
#else
@@ -595,14 +728,24 @@ verify_norecord_switch_expr (struct leh_state *state, tree switch_expr)
variable to be used in manipulating the value returned from the function. */
static void
-do_return_redirection (struct goto_queue_node *q, tree finlab, tree mod,
+do_return_redirection (struct goto_queue_node *q, tree finlab, gimple_seq mod,
tree *return_value_p)
{
- tree ret_expr = TREE_OPERAND (q->stmt, 0);
- tree x;
+ tree ret_expr;
+ gimple x;
+
+ /* In the case of a return, the queue node must be a gimple statement. */
+ gcc_assert (!q->is_label);
+
+ ret_expr = gimple_return_retval (q->stmt.g);
if (ret_expr)
{
+ if (!*return_value_p)
+ *return_value_p = ret_expr;
+ else
+ gcc_assert (*return_value_p == ret_expr);
+ q->cont_stmt = q->stmt.g;
/* The nasty part about redirecting the return value is that the
return value itself is to be computed before the FINALLY block
is executed. e.g.
@@ -625,78 +768,50 @@ do_return_redirection (struct goto_queue_node *q, tree finlab, tree mod,
depends, I guess, but it does make generation of the switch in
lower_try_finally_switch easier. */
- switch (TREE_CODE (ret_expr))
+ if (TREE_CODE (ret_expr) == RESULT_DECL)
{
- case RESULT_DECL:
if (!*return_value_p)
*return_value_p = ret_expr;
else
gcc_assert (*return_value_p == ret_expr);
- q->cont_stmt = q->stmt;
- break;
-
- case GIMPLE_MODIFY_STMT:
- {
- tree result = GIMPLE_STMT_OPERAND (ret_expr, 0);
- tree new, old = GIMPLE_STMT_OPERAND (ret_expr, 1);
-
- if (!*return_value_p)
- {
- if (aggregate_value_p (TREE_TYPE (result),
- TREE_TYPE (current_function_decl)))
- /* If this function returns in memory, copy the argument
- into the return slot now. Otherwise, we might need to
- worry about magic return semantics, so we need to use a
- temporary to hold the value until we're actually ready
- to return. */
- new = result;
- else
- new = create_tmp_var (TREE_TYPE (old), "rettmp");
- *return_value_p = new;
- }
- else
- new = *return_value_p;
-
- x = build_gimple_modify_stmt (new, old);
- append_to_statement_list (x, &q->repl_stmt);
-
- if (new == result)
- x = result;
- else
- x = build_gimple_modify_stmt (result, new);
- q->cont_stmt = build1 (RETURN_EXPR, void_type_node, x);
- }
-
- default:
- gcc_unreachable ();
+ q->cont_stmt = q->stmt.g;
}
+ else
+ gcc_unreachable ();
}
else
- {
/* If we don't return a value, all return statements are the same. */
- q->cont_stmt = q->stmt;
- }
+ q->cont_stmt = q->stmt.g;
+
+ if (!q->repl_stmt)
+ q->repl_stmt = gimple_seq_alloc ();
if (mod)
- append_to_statement_list (mod, &q->repl_stmt);
+ gimple_seq_add_seq (&q->repl_stmt, mod);
- x = build1 (GOTO_EXPR, void_type_node, finlab);
- append_to_statement_list (x, &q->repl_stmt);
+ x = gimple_build_goto (finlab);
+ gimple_seq_add_stmt (&q->repl_stmt, x);
}
-/* Similar, but easier, for GOTO_EXPR. */
+/* Similar, but easier, for GIMPLE_GOTO. */
static void
-do_goto_redirection (struct goto_queue_node *q, tree finlab, tree mod)
+do_goto_redirection (struct goto_queue_node *q, tree finlab, gimple_seq mod,
+ struct leh_tf_state *tf)
{
- tree x;
+ gimple x;
+
+ gcc_assert (q->is_label);
+ if (!q->repl_stmt)
+ q->repl_stmt = gimple_seq_alloc ();
+
+ q->cont_stmt = gimple_build_goto (VEC_index (tree, tf->dest_array,q->index));
- q->cont_stmt = q->stmt;
if (mod)
- append_to_statement_list (mod, &q->repl_stmt);
+ gimple_seq_add_seq (&q->repl_stmt, mod);
- x = build1 (GOTO_EXPR, void_type_node, finlab);
- append_to_statement_list (x, &q->repl_stmt);
+ x = gimple_build_goto (finlab);
+ gimple_seq_add_stmt (&q->repl_stmt, x);
}
/* We want to transform
@@ -704,56 +819,59 @@ do_goto_redirection (struct goto_queue_node *q, tree finlab, tree mod)
to
body; goto over; lab: stuff; over:
- T is a TRY_FINALLY or TRY_CATCH node. LAB is the label that
+ TP is a GIMPLE_TRY node. LAB is the label that
should be placed before the second operand, or NULL. OVER is
an existing label that should be put at the exit, or NULL. */
-static void
-frob_into_branch_around (tree *tp, tree lab, tree over)
+static gimple_seq
+frob_into_branch_around (gimple tp, tree lab, tree over)
{
- tree x, op1;
+ gimple x;
+ gimple_seq cleanup, result;
- op1 = TREE_OPERAND (*tp, 1);
- *tp = TREE_OPERAND (*tp, 0);
+ cleanup = gimple_try_cleanup (tp);
+ result = gimple_try_eval (tp);
- if (block_may_fallthru (*tp))
+ if (gimple_seq_may_fallthru (result))
{
if (!over)
over = create_artificial_label ();
- x = build1 (GOTO_EXPR, void_type_node, over);
- append_to_statement_list (x, tp);
+ x = gimple_build_goto (over);
+ gimple_seq_add_stmt (&result, x);
}
if (lab)
{
- x = build1 (LABEL_EXPR, void_type_node, lab);
- append_to_statement_list (x, tp);
+ x = gimple_build_label (lab);
+ gimple_seq_add_stmt (&result, x);
}
- append_to_statement_list (op1, tp);
+ gimple_seq_add_seq (&result, cleanup);
if (over)
{
- x = build1 (LABEL_EXPR, void_type_node, over);
- append_to_statement_list (x, tp);
+ x = gimple_build_label (over);
+ gimple_seq_add_stmt (&result, x);
}
+ return result;
}
/* A subroutine of lower_try_finally. Duplicate the tree rooted at T.
Make sure to record all new labels found. */
-static tree
-lower_try_finally_dup_block (tree t, struct leh_state *outer_state)
+static gimple_seq
+lower_try_finally_dup_block (gimple_seq seq, struct leh_state *outer_state)
{
- tree region = NULL;
+ gimple region = NULL;
+ gimple_seq new_seq;
- t = unsave_expr_now (t);
+ new_seq = copy_gimple_seq_and_replace_locals (seq);
if (outer_state->tf)
region = outer_state->tf->try_finally_expr;
- collect_finally_tree (t, region);
+ collect_finally_tree_1 (new_seq, region);
- return t;
+ return new_seq;
}
/* A subroutine of lower_try_finally. Create a fallthru label for
@@ -764,12 +882,17 @@ static tree
lower_try_finally_fallthru_label (struct leh_tf_state *tf)
{
tree label = tf->fallthru_label;
+ treemple temp;
+
if (!label)
{
label = create_artificial_label ();
tf->fallthru_label = label;
if (tf->outer->tf)
- record_in_finally_tree (label, tf->outer->tf->try_finally_expr);
+ {
+ temp.t = label;
+ record_in_finally_tree (temp, tf->outer->tf->try_finally_expr);
+ }
}
return label;
}
@@ -799,9 +922,11 @@ honor_protect_cleanup_actions (struct leh_state *outer_state,
struct leh_state *this_state,
struct leh_tf_state *tf)
{
- tree protect_cleanup_actions, finally, x;
- tree_stmt_iterator i;
+ gimple protect_cleanup_actions;
+ gimple_stmt_iterator gsi;
bool finally_may_fallthru;
+ gimple_seq finally;
+ gimple x;
/* First check for nothing to do. */
if (lang_protect_cleanup_actions)
@@ -809,7 +934,7 @@ honor_protect_cleanup_actions (struct leh_state *outer_state,
else
protect_cleanup_actions = NULL;
- finally = TREE_OPERAND (*tf->top_p, 1);
+ finally = gimple_try_cleanup (tf->top_p);
/* If the EH case of the finally block can fall through, this may be a
structure of the form
@@ -832,7 +957,7 @@ honor_protect_cleanup_actions (struct leh_state *outer_state,
be used (via fallthru from the finally) we handle the eh case here,
whether or not protect_cleanup_actions is active. */
- finally_may_fallthru = block_may_fallthru (finally);
+ finally_may_fallthru = gimple_seq_may_fallthru (finally);
if (!finally_may_fallthru && !protect_cleanup_actions)
return;
@@ -848,14 +973,15 @@ honor_protect_cleanup_actions (struct leh_state *outer_state,
cp/decl.c). Since it's logically at an outer level, we should call
terminate before we get to it, so strip it away before adding the
MUST_NOT_THROW filter. */
- i = tsi_start (finally);
- x = tsi_stmt (i);
+ gsi = gsi_start (finally);
+ x = gsi_stmt (gsi);
if (protect_cleanup_actions
- && TREE_CODE (x) == TRY_CATCH_EXPR
- && TRY_CATCH_IS_CLEANUP (x))
+ && gimple_code (x) == GIMPLE_TRY
+ && gimple_try_kind (x) == GIMPLE_TRY_CATCH
+ && gimple_try_catch_is_cleanup (x))
{
- tsi_link_before (&i, TREE_OPERAND (x, 0), TSI_SAME_STMT);
- tsi_delink (&i);
+ gsi_insert_seq_before (&gsi, gimple_try_eval (x), GSI_SAME_STMT);
+ gsi_remove (&gsi, false);
}
/* Resume execution after the exception. Adding this now lets
@@ -864,55 +990,61 @@ honor_protect_cleanup_actions (struct leh_state *outer_state,
if (finally_may_fallthru)
{
tree save_eptr, save_filt;
+ tree tmp;
save_eptr = create_tmp_var (ptr_type_node, "save_eptr");
save_filt = create_tmp_var (integer_type_node, "save_filt");
- i = tsi_start (finally);
- x = build0 (EXC_PTR_EXPR, ptr_type_node);
- x = build_gimple_modify_stmt (save_eptr, x);
- tsi_link_before (&i, x, TSI_CONTINUE_LINKING);
+ gsi = gsi_start (finally);
+ tmp = build0 (EXC_PTR_EXPR, ptr_type_node);
+ x = gimple_build_assign (save_eptr, tmp);
+ gsi_insert_before (&gsi, x, GSI_CONTINUE_LINKING);
- x = build0 (FILTER_EXPR, integer_type_node);
- x = build_gimple_modify_stmt (save_filt, x);
- tsi_link_before (&i, x, TSI_CONTINUE_LINKING);
+ tmp = build0 (FILTER_EXPR, integer_type_node);
+ x = gimple_build_assign (save_filt, tmp);
+ gsi_insert_before (&gsi, x, GSI_CONTINUE_LINKING);
- i = tsi_last (finally);
- x = build0 (EXC_PTR_EXPR, ptr_type_node);
- x = build_gimple_modify_stmt (x, save_eptr);
- tsi_link_after (&i, x, TSI_CONTINUE_LINKING);
+ gsi = gsi_last (finally);
+ tmp = build0 (EXC_PTR_EXPR, ptr_type_node);
+ x = gimple_build_assign (tmp, save_eptr);
+ gsi_insert_after (&gsi, x, GSI_CONTINUE_LINKING);
- x = build0 (FILTER_EXPR, integer_type_node);
- x = build_gimple_modify_stmt (x, save_filt);
- tsi_link_after (&i, x, TSI_CONTINUE_LINKING);
+ tmp = build0 (FILTER_EXPR, integer_type_node);
+ x = gimple_build_assign (tmp, save_filt);
+ gsi_insert_after (&gsi, x, GSI_CONTINUE_LINKING);
- x = build_resx (get_eh_region_number (tf->region));
- tsi_link_after (&i, x, TSI_CONTINUE_LINKING);
+ x = gimple_build_resx (get_eh_region_number (tf->region));
+ gsi_insert_after (&gsi, x, GSI_CONTINUE_LINKING);
}
/* Wrap the block with protect_cleanup_actions as the action. */
if (protect_cleanup_actions)
{
- x = build2 (EH_FILTER_EXPR, void_type_node, NULL, NULL);
- append_to_statement_list (protect_cleanup_actions, &EH_FILTER_FAILURE (x));
- EH_FILTER_MUST_NOT_THROW (x) = 1;
- finally = build2 (TRY_CATCH_EXPR, void_type_node, finally, x);
- lower_eh_filter (outer_state, &finally);
+ gimple_seq seq = NULL, failure = NULL;
+
+ gimple_seq_add_stmt (&failure, protect_cleanup_actions);
+ x = gimple_build_eh_filter (NULL, failure);
+ gimple_eh_filter_set_must_not_throw (x, 1);
+
+ gimple_seq_add_stmt (&seq, x);
+ x = gimple_build_try (finally, seq, GIMPLE_TRY_CATCH);
+ finally = lower_eh_filter (outer_state, x);
}
else
- lower_eh_constructs_1 (outer_state, &finally);
+ lower_eh_constructs_1 (outer_state, finally);
/* Hook this up to the end of the existing try block. If we
previously fell through the end, we'll have to branch around.
This means adding a new goto, and adding it to the queue. */
- i = tsi_last (TREE_OPERAND (*tf->top_p, 0));
+ gsi = gsi_last (gimple_try_eval (tf->top_p));
if (tf->may_fallthru)
{
- x = lower_try_finally_fallthru_label (tf);
- x = build1 (GOTO_EXPR, void_type_node, x);
- tsi_link_after (&i, x, TSI_CONTINUE_LINKING);
+ tree tmp;
+ tmp = lower_try_finally_fallthru_label (tf);
+ x = gimple_build_goto (tmp);
+ gsi_insert_after (&gsi, x, GSI_CONTINUE_LINKING);
if (this_state)
maybe_record_in_goto_queue (this_state, x);
@@ -920,9 +1052,9 @@ honor_protect_cleanup_actions (struct leh_state *outer_state,
tf->may_fallthru = false;
}
- x = build1 (LABEL_EXPR, void_type_node, tf->eh_label);
- tsi_link_after (&i, x, TSI_CONTINUE_LINKING);
- tsi_link_after (&i, finally, TSI_CONTINUE_LINKING);
+ x = gimple_build_label (tf->eh_label);
+ gsi_insert_after (&gsi, x, GSI_CONTINUE_LINKING);
+ gsi_insert_seq_after (&gsi, finally, GSI_CONTINUE_LINKING);
/* Having now been handled, EH isn't to be considered with
the rest of the outgoing edges. */
@@ -935,9 +1067,12 @@ honor_protect_cleanup_actions (struct leh_state *outer_state,
try_finally node for this special case. */
static void
-lower_try_finally_nofallthru (struct leh_state *state, struct leh_tf_state *tf)
+lower_try_finally_nofallthru (struct leh_state *state,
+ struct leh_tf_state *tf)
{
- tree x, finally, lab, return_val;
+ tree lab, return_val;
+ gimple x;
+ gimple_seq finally;
struct goto_queue_node *q, *qe;
if (tf->may_throw)
@@ -945,11 +1080,12 @@ lower_try_finally_nofallthru (struct leh_state *state, struct leh_tf_state *tf)
else
lab = create_artificial_label ();
- finally = TREE_OPERAND (*tf->top_p, 1);
- *tf->top_p = TREE_OPERAND (*tf->top_p, 0);
+ /* We expect that tf->top_p is a GIMPLE_TRY. */
+ finally = gimple_try_cleanup (tf->top_p);
+ tf->top_p_seq = gimple_try_eval (tf->top_p);
- x = build1 (LABEL_EXPR, void_type_node, lab);
- append_to_statement_list (x, tf->top_p);
+ x = gimple_build_label (lab);
+ gimple_seq_add_stmt (&tf->top_p_seq, x);
return_val = NULL;
q = tf->goto_queue;
@@ -958,12 +1094,12 @@ lower_try_finally_nofallthru (struct leh_state *state, struct leh_tf_state *tf)
if (q->index < 0)
do_return_redirection (q, lab, NULL, &return_val);
else
- do_goto_redirection (q, lab, NULL);
+ do_goto_redirection (q, lab, NULL, tf);
replace_goto_queue (tf);
- lower_eh_constructs_1 (state, &finally);
- append_to_statement_list (finally, tf->top_p);
+ lower_eh_constructs_1 (state, finally);
+ gimple_seq_add_seq (&tf->top_p_seq, finally);
}
/* A subroutine of lower_try_finally. We have determined that there is
@@ -974,26 +1110,28 @@ static void
lower_try_finally_onedest (struct leh_state *state, struct leh_tf_state *tf)
{
struct goto_queue_node *q, *qe;
- tree x, finally, finally_label;
+ gimple x;
+ gimple_seq finally;
+ tree finally_label;
- finally = TREE_OPERAND (*tf->top_p, 1);
- *tf->top_p = TREE_OPERAND (*tf->top_p, 0);
+ finally = gimple_try_cleanup (tf->top_p);
+ tf->top_p_seq = gimple_try_eval (tf->top_p);
- lower_eh_constructs_1 (state, &finally);
+ lower_eh_constructs_1 (state, finally);
if (tf->may_throw)
{
/* Only reachable via the exception edge. Add the given label to
the head of the FINALLY block. Append a RESX at the end. */
- x = build1 (LABEL_EXPR, void_type_node, tf->eh_label);
- append_to_statement_list (x, tf->top_p);
+ x = gimple_build_label (tf->eh_label);
+ gimple_seq_add_stmt (&tf->top_p_seq, x);
- append_to_statement_list (finally, tf->top_p);
+ gimple_seq_add_seq (&tf->top_p_seq, finally);
- x = build_resx (get_eh_region_number (tf->region));
+ x = gimple_build_resx (get_eh_region_number (tf->region));
- append_to_statement_list (x, tf->top_p);
+ gimple_seq_add_stmt (&tf->top_p_seq, x);
return;
}
@@ -1002,15 +1140,15 @@ lower_try_finally_onedest (struct leh_state *state, struct leh_tf_state *tf)
{
/* Only reachable via the fallthru edge. Do nothing but let
the two blocks run together; we'll fall out the bottom. */
- append_to_statement_list (finally, tf->top_p);
+ gimple_seq_add_seq (&tf->top_p_seq, finally);
return;
}
finally_label = create_artificial_label ();
- x = build1 (LABEL_EXPR, void_type_node, finally_label);
- append_to_statement_list (x, tf->top_p);
+ x = gimple_build_label (finally_label);
+ gimple_seq_add_stmt (&tf->top_p_seq, x);
- append_to_statement_list (finally, tf->top_p);
+ gimple_seq_add_seq (&tf->top_p_seq, finally);
q = tf->goto_queue;
qe = q + tf->goto_queue_active;
@@ -1027,7 +1165,7 @@ lower_try_finally_onedest (struct leh_state *state, struct leh_tf_state *tf)
{
/* Reachable by goto expressions only. Redirect them. */
for (; q < qe; ++q)
- do_goto_redirection (q, finally_label, NULL);
+ do_goto_redirection (q, finally_label, NULL, tf);
replace_goto_queue (tf);
if (VEC_index (tree, tf->dest_array, 0) == tf->fallthru_label)
@@ -1040,11 +1178,11 @@ lower_try_finally_onedest (struct leh_state *state, struct leh_tf_state *tf)
}
}
- /* Reset the locus of the goto since we're moving
- goto to a different block which might be on a different line. */
- SET_EXPR_LOCUS (tf->goto_queue[0].cont_stmt, NULL);
- append_to_statement_list (tf->goto_queue[0].cont_stmt, tf->top_p);
- maybe_record_in_goto_queue (state, tf->goto_queue[0].cont_stmt);
+ /* Place the original return/goto to the original destination
+ immediately after the finally block. */
+ x = tf->goto_queue[0].cont_stmt;
+ gimple_seq_add_stmt (&tf->top_p_seq, x);
+ maybe_record_in_goto_queue (state, x);
}
/* A subroutine of lower_try_finally. There are multiple edges incoming
@@ -1054,36 +1192,38 @@ lower_try_finally_onedest (struct leh_state *state, struct leh_tf_state *tf)
static void
lower_try_finally_copy (struct leh_state *state, struct leh_tf_state *tf)
{
- tree finally, new_stmt;
- tree x;
+ gimple_seq finally;
+ gimple_seq new_stmt;
+ gimple_seq seq;
+ gimple x;
+ tree tmp;
- finally = TREE_OPERAND (*tf->top_p, 1);
- *tf->top_p = TREE_OPERAND (*tf->top_p, 0);
-
- new_stmt = NULL_TREE;
+ finally = gimple_try_cleanup (tf->top_p);
+ tf->top_p_seq = gimple_try_eval (tf->top_p);
+ new_stmt = NULL;
if (tf->may_fallthru)
{
- x = lower_try_finally_dup_block (finally, state);
- lower_eh_constructs_1 (state, &x);
- append_to_statement_list (x, &new_stmt);
+ seq = lower_try_finally_dup_block (finally, state);
+ lower_eh_constructs_1 (state, seq);
+ gimple_seq_add_seq (&new_stmt, seq);
- x = lower_try_finally_fallthru_label (tf);
- x = build1 (GOTO_EXPR, void_type_node, x);
- append_to_statement_list (x, &new_stmt);
+ tmp = lower_try_finally_fallthru_label (tf);
+ x = gimple_build_goto (tmp);
+ gimple_seq_add_stmt (&new_stmt, x);
}
if (tf->may_throw)
{
- x = build1 (LABEL_EXPR, void_type_node, tf->eh_label);
- append_to_statement_list (x, &new_stmt);
+ x = gimple_build_label (tf->eh_label);
+ gimple_seq_add_stmt (&new_stmt, x);
- x = lower_try_finally_dup_block (finally, state);
- lower_eh_constructs_1 (state, &x);
- append_to_statement_list (x, &new_stmt);
+ seq = lower_try_finally_dup_block (finally, state);
+ lower_eh_constructs_1 (state, seq);
+ gimple_seq_add_seq (&new_stmt, seq);
- x = build_resx (get_eh_region_number (tf->region));
- append_to_statement_list (x, &new_stmt);
+ x = gimple_build_resx (get_eh_region_number (tf->region));
+ gimple_seq_add_stmt (&new_stmt, x);
}
if (tf->goto_queue)
@@ -1123,16 +1263,16 @@ lower_try_finally_copy (struct leh_state *state, struct leh_tf_state *tf)
if (index == return_index)
do_return_redirection (q, lab, NULL, &return_val);
else
- do_goto_redirection (q, lab, NULL);
+ do_goto_redirection (q, lab, NULL, tf);
- x = build1 (LABEL_EXPR, void_type_node, lab);
- append_to_statement_list (x, &new_stmt);
+ x = gimple_build_label (lab);
+ gimple_seq_add_stmt (&new_stmt, x);
- x = lower_try_finally_dup_block (finally, state);
- lower_eh_constructs_1 (state, &x);
- append_to_statement_list (x, &new_stmt);
+ seq = lower_try_finally_dup_block (finally, state);
+ lower_eh_constructs_1 (state, seq);
+ gimple_seq_add_seq (&new_stmt, seq);
- append_to_statement_list (q->cont_stmt, &new_stmt);
+ gimple_seq_add_stmt (&new_stmt, q->cont_stmt);
maybe_record_in_goto_queue (state, q->cont_stmt);
}
@@ -1150,7 +1290,7 @@ lower_try_finally_copy (struct leh_state *state, struct leh_tf_state *tf)
if (index == return_index)
do_return_redirection (q, lab, NULL, &return_val);
else
- do_goto_redirection (q, lab, NULL);
+ do_goto_redirection (q, lab, NULL, tf);
}
replace_goto_queue (tf);
@@ -1159,7 +1299,7 @@ lower_try_finally_copy (struct leh_state *state, struct leh_tf_state *tf)
/* Need to link new stmts after running replace_goto_queue due
to not wanting to process the same goto stmts twice. */
- append_to_statement_list (new_stmt, tf->top_p);
+ gimple_seq_add_seq (&tf->top_p_seq, new_stmt);
}
/* A subroutine of lower_try_finally. There are multiple edges incoming
@@ -1172,18 +1312,26 @@ lower_try_finally_switch (struct leh_state *state, struct leh_tf_state *tf)
{
struct goto_queue_node *q, *qe;
tree return_val = NULL;
- tree finally, finally_tmp, finally_label;
+ tree finally_tmp, finally_label;
int return_index, eh_index, fallthru_index;
int nlabels, ndests, j, last_case_index;
- tree case_label_vec, switch_stmt, last_case, switch_body;
- tree x;
+ tree last_case;
+ VEC (tree,heap) *case_label_vec;
+ gimple_seq switch_body;
+ gimple x;
+ tree tmp;
+ gimple switch_stmt;
+ gimple_seq finally;
+ struct pointer_map_t *cont_map = NULL;
+
+ switch_body = gimple_seq_alloc ();
/* Mash the TRY block to the head of the chain. */
- finally = TREE_OPERAND (*tf->top_p, 1);
- *tf->top_p = TREE_OPERAND (*tf->top_p, 0);
+ finally = gimple_try_cleanup (tf->top_p);
+ tf->top_p_seq = gimple_try_eval (tf->top_p);
/* Lower the finally block itself. */
- lower_eh_constructs_1 (state, &finally);
+ lower_eh_constructs_1 (state, finally);
/* Prepare for switch statement generation. */
nlabels = VEC_length (tree, tf->dest_array);
@@ -1195,10 +1343,10 @@ lower_try_finally_switch (struct leh_state *state, struct leh_tf_state *tf)
finally_tmp = create_tmp_var (integer_type_node, "finally_tmp");
finally_label = create_artificial_label ();
- case_label_vec = make_tree_vec (ndests);
- switch_stmt = build3 (SWITCH_EXPR, integer_type_node, finally_tmp,
- NULL_TREE, case_label_vec);
- switch_body = NULL;
+ /* We use VEC_quick_push on case_label_vec throughout this function,
+ since we know the size in advance and allocate precisely as muce
+ space as needed. */
+ case_label_vec = VEC_alloc (tree, heap, ndests);
last_case = NULL;
last_case_index = 0;
@@ -1208,117 +1356,137 @@ lower_try_finally_switch (struct leh_state *state, struct leh_tf_state *tf)
if (tf->may_fallthru)
{
- x = build_gimple_modify_stmt (finally_tmp,
- build_int_cst (integer_type_node,
- fallthru_index));
- append_to_statement_list (x, tf->top_p);
+ x = gimple_build_assign (finally_tmp, build_int_cst (integer_type_node,
+ fallthru_index));
+ gimple_seq_add_stmt (&tf->top_p_seq, x);
if (tf->may_throw)
{
- x = build1 (GOTO_EXPR, void_type_node, finally_label);
- append_to_statement_list (x, tf->top_p);
+ x = gimple_build_goto (finally_label);
+ gimple_seq_add_stmt (&tf->top_p_seq, x);
}
last_case = build3 (CASE_LABEL_EXPR, void_type_node,
build_int_cst (NULL_TREE, fallthru_index), NULL,
create_artificial_label ());
- TREE_VEC_ELT (case_label_vec, last_case_index) = last_case;
+ VEC_quick_push (tree, case_label_vec, last_case);
last_case_index++;
- x = build1 (LABEL_EXPR, void_type_node, CASE_LABEL (last_case));
- append_to_statement_list (x, &switch_body);
+ x = gimple_build_label (CASE_LABEL (last_case));
+ gimple_seq_add_stmt (&switch_body, x);
- x = lower_try_finally_fallthru_label (tf);
- x = build1 (GOTO_EXPR, void_type_node, x);
- append_to_statement_list (x, &switch_body);
+ tmp = lower_try_finally_fallthru_label (tf);
+ x = gimple_build_goto (tmp);
+ gimple_seq_add_stmt (&switch_body, x);
}
if (tf->may_throw)
{
- x = build1 (LABEL_EXPR, void_type_node, tf->eh_label);
- append_to_statement_list (x, tf->top_p);
+ x = gimple_build_label (tf->eh_label);
+ gimple_seq_add_stmt (&tf->top_p_seq, x);
- x = build_gimple_modify_stmt (finally_tmp,
- build_int_cst (integer_type_node,
- eh_index));
- append_to_statement_list (x, tf->top_p);
+ x = gimple_build_assign (finally_tmp, build_int_cst (integer_type_node,
+ eh_index));
+ gimple_seq_add_stmt (&tf->top_p_seq, x);
last_case = build3 (CASE_LABEL_EXPR, void_type_node,
build_int_cst (NULL_TREE, eh_index), NULL,
create_artificial_label ());
- TREE_VEC_ELT (case_label_vec, last_case_index) = last_case;
+ VEC_quick_push (tree, case_label_vec, last_case);
last_case_index++;
- x = build1 (LABEL_EXPR, void_type_node, CASE_LABEL (last_case));
- append_to_statement_list (x, &switch_body);
- x = build_resx (get_eh_region_number (tf->region));
- append_to_statement_list (x, &switch_body);
+ x = gimple_build_label (CASE_LABEL (last_case));
+ gimple_seq_add_stmt (&switch_body, x);
+ x = gimple_build_resx (get_eh_region_number (tf->region));
+ gimple_seq_add_stmt (&switch_body, x);
}
- x = build1 (LABEL_EXPR, void_type_node, finally_label);
- append_to_statement_list (x, tf->top_p);
+ x = gimple_build_label (finally_label);
+ gimple_seq_add_stmt (&tf->top_p_seq, x);
- append_to_statement_list (finally, tf->top_p);
+ gimple_seq_add_seq (&tf->top_p_seq, finally);
/* Redirect each incoming goto edge. */
q = tf->goto_queue;
qe = q + tf->goto_queue_active;
j = last_case_index + tf->may_return;
+ /* Prepare the assignments to finally_tmp that are executed upon the
+ entrance through a particular edge. */
for (; q < qe; ++q)
{
- tree mod;
- int switch_id, case_index;
+ gimple_seq mod;
+ int switch_id;
+ unsigned int case_index;
+
+ mod = gimple_seq_alloc ();
if (q->index < 0)
{
- mod = build_gimple_modify_stmt (finally_tmp,
- build_int_cst (integer_type_node,
- return_index));
+ x = gimple_build_assign (finally_tmp,
+ build_int_cst (integer_type_node,
+ return_index));
+ gimple_seq_add_stmt (&mod, x);
do_return_redirection (q, finally_label, mod, &return_val);
switch_id = return_index;
}
else
{
- mod = build_gimple_modify_stmt (finally_tmp,
- build_int_cst (integer_type_node,
- q->index));
- do_goto_redirection (q, finally_label, mod);
+ x = gimple_build_assign (finally_tmp,
+ build_int_cst (integer_type_node, q->index));
+ gimple_seq_add_stmt (&mod, x);
+ do_goto_redirection (q, finally_label, mod, tf);
switch_id = q->index;
}
case_index = j + q->index;
- if (!TREE_VEC_ELT (case_label_vec, case_index))
- TREE_VEC_ELT (case_label_vec, case_index)
- = build3 (CASE_LABEL_EXPR, void_type_node,
- build_int_cst (NULL_TREE, switch_id), NULL,
- /* We store the cont_stmt in the
- CASE_LABEL, so that we can recover it
- in the loop below. We don't create
- the new label while walking the
- goto_queue because pointers don't
- offer a stable order. */
- q->cont_stmt);
+ if (VEC_length (tree, case_label_vec) <= case_index
+ || !VEC_index (tree, case_label_vec, case_index))
+ {
+ tree case_lab;
+ void **slot;
+ case_lab = build3 (CASE_LABEL_EXPR, void_type_node,
+ build_int_cst (NULL_TREE, switch_id), NULL,
+ NULL);
+ /* We store the cont_stmt in the pointer map, so that we can recover
+ it in the loop below. We don't create the new label while
+ walking the goto_queue because pointers don't offer a stable
+ order. */
+ if (!cont_map)
+ cont_map = pointer_map_create ();
+ slot = pointer_map_insert (cont_map, case_lab);
+ *slot = q->cont_stmt;
+ VEC_quick_push (tree, case_label_vec, case_lab);
+ }
}
for (j = last_case_index; j < last_case_index + nlabels; j++)
{
tree label;
- tree cont_stmt;
+ gimple cont_stmt;
+ void **slot;
- last_case = TREE_VEC_ELT (case_label_vec, j);
+ last_case = VEC_index (tree, case_label_vec, j);
gcc_assert (last_case);
+ gcc_assert (cont_map);
- cont_stmt = CASE_LABEL (last_case);
+ slot = pointer_map_contains (cont_map, last_case);
+ /* As the comment above suggests, CASE_LABEL (last_case) was just a
+ placeholder, it does not store an actual label, yet. */
+ gcc_assert (slot);
+ cont_stmt = *(gimple *) slot;
label = create_artificial_label ();
CASE_LABEL (last_case) = label;
- x = build1 (LABEL_EXPR, void_type_node, label);
- append_to_statement_list (x, &switch_body);
- append_to_statement_list (cont_stmt, &switch_body);
+ x = gimple_build_label (label);
+ gimple_seq_add_stmt (&switch_body, x);
+ gimple_seq_add_stmt (&switch_body, cont_stmt);
maybe_record_in_goto_queue (state, cont_stmt);
}
+ if (cont_map)
+ pointer_map_destroy (cont_map);
+
replace_goto_queue (tf);
/* Make sure that the last case is the default label, as one is required.
@@ -1326,10 +1494,15 @@ lower_try_finally_switch (struct leh_state *state, struct leh_tf_state *tf)
CASE_LOW (last_case) = NULL;
sort_case_labels (case_label_vec);
- /* Need to link switch_stmt after running replace_goto_queue due
- to not wanting to process the same goto stmts twice. */
- append_to_statement_list (switch_stmt, tf->top_p);
- append_to_statement_list (switch_body, tf->top_p);
+ /* Build the switch statement, setting last_case to be the default
+ label. */
+ switch_stmt = gimple_build_switch_vec (finally_tmp, last_case,
+ case_label_vec);
+
+ /* Need to link SWITCH_STMT after running replace_goto_queue
+ due to not wanting to process the same goto stmts twice. */
+ gimple_seq_add_stmt (&tf->top_p_seq, switch_stmt);
+ gimple_seq_add_seq (&tf->top_p_seq, switch_body);
}
/* Decide whether or not we are going to duplicate the finally block.
@@ -1347,7 +1520,7 @@ lower_try_finally_switch (struct leh_state *state, struct leh_tf_state *tf)
the estimate of the size of the switch machinery we'd have to add. */
static bool
-decide_copy_try_finally (int ndests, tree finally)
+decide_copy_try_finally (int ndests, gimple_seq finally)
{
int f_estimate, sw_estimate;
@@ -1355,7 +1528,7 @@ decide_copy_try_finally (int ndests, tree finally)
return false;
/* Finally estimate N times, plus N gotos. */
- f_estimate = estimate_num_insns (finally, &eni_size_weights);
+ f_estimate = count_insns_seq (finally, &eni_size_weights);
f_estimate = (f_estimate + 1) * ndests;
/* Switch statement (cost 10), N variable assignments, N gotos. */
@@ -1372,13 +1545,14 @@ decide_copy_try_finally (int ndests, tree finally)
return f_estimate < 40 || f_estimate * 2 < sw_estimate * 3;
}
-/* A subroutine of lower_eh_constructs_1. Lower a TRY_FINALLY_EXPR nodes
+
+/* A subroutine of lower_eh_constructs_1. Lower a GIMPLE_TRY_FINALLY nodes
to a sequence of labels and blocks, plus the exception region trees
that record all the magic. This is complicated by the need to
arrange for the FINALLY block to be executed on all exits. */
-static void
-lower_try_finally (struct leh_state *state, tree *tp)
+static gimple_seq
+lower_try_finally (struct leh_state *state, gimple tp)
{
struct leh_tf_state this_tf;
struct leh_state this_state;
@@ -1387,7 +1561,7 @@ lower_try_finally (struct leh_state *state, tree *tp)
/* Process the try block. */
memset (&this_tf, 0, sizeof (this_tf));
- this_tf.try_finally_expr = *tp;
+ this_tf.try_finally_expr = tp;
this_tf.top_p = tp;
this_tf.outer = state;
if (using_eh_for_cleanups_p)
@@ -1400,10 +1574,10 @@ lower_try_finally (struct leh_state *state, tree *tp)
this_state.prev_try = state->prev_try;
this_state.tf = &this_tf;
- lower_eh_constructs_1 (&this_state, &TREE_OPERAND (*tp, 0));
+ lower_eh_constructs_1 (&this_state, gimple_try_eval(tp));
/* Determine if the try block is escaped through the bottom. */
- this_tf.may_fallthru = block_may_fallthru (TREE_OPERAND (*tp, 0));
+ this_tf.may_fallthru = gimple_seq_may_fallthru (gimple_try_eval (tp));
/* Determine if any exceptions are possible within the try block. */
if (using_eh_for_cleanups_p)
@@ -1426,19 +1600,20 @@ lower_try_finally (struct leh_state *state, tree *tp)
/* If the FINALLY block is not reachable, dike it out. */
if (ndests == 0)
- *tp = TREE_OPERAND (*tp, 0);
-
+ {
+ gimple_seq_add_seq (&this_tf.top_p_seq, gimple_try_eval (tp));
+ gimple_try_set_cleanup (tp, NULL);
+ }
/* If the finally block doesn't fall through, then any destination
we might try to impose there isn't reached either. There may be
some minor amount of cleanup and redirection still needed. */
- else if (!block_may_fallthru (TREE_OPERAND (*tp, 1)))
+ else if (!gimple_seq_may_fallthru (gimple_try_cleanup (tp)))
lower_try_finally_nofallthru (state, &this_tf);
/* We can easily special-case redirection to a single destination. */
else if (ndests == 1)
lower_try_finally_onedest (state, &this_tf);
-
- else if (decide_copy_try_finally (ndests, TREE_OPERAND (*tp, 1)))
+ else if (decide_copy_try_finally (ndests, gimple_try_cleanup (tp)))
lower_try_finally_copy (state, &this_tf);
else
lower_try_finally_switch (state, &this_tf);
@@ -1447,8 +1622,9 @@ lower_try_finally (struct leh_state *state, tree *tp)
block, do so. */
if (this_tf.fallthru_label)
{
- tree x = build1 (LABEL_EXPR, void_type_node, this_tf.fallthru_label);
- append_to_statement_list (x, tp);
+ /* This must be reached only if ndests == 0. */
+ gimple x = gimple_build_label (this_tf.fallthru_label);
+ gimple_seq_add_stmt (&this_tf.top_p_seq, x);
}
VEC_free (tree, heap, this_tf.dest_array);
@@ -1456,18 +1632,20 @@ lower_try_finally (struct leh_state *state, tree *tp)
free (this_tf.goto_queue);
if (this_tf.goto_queue_map)
pointer_map_destroy (this_tf.goto_queue_map);
+
+ return this_tf.top_p_seq;
}
-/* A subroutine of lower_eh_constructs_1. Lower a TRY_CATCH_EXPR with a
- list of CATCH_EXPR nodes to a sequence of labels and blocks, plus the
- exception region trees that record all the magic. */
+/* A subroutine of lower_eh_constructs_1. Lower a GIMPLE_TRY_CATCH with a
+ list of GIMPLE_CATCH to a sequence of labels and blocks, plus the
+ exception region trees that records all the magic. */
-static void
-lower_catch (struct leh_state *state, tree *tp)
+static gimple_seq
+lower_catch (struct leh_state *state, gimple tp)
{
struct eh_region *try_region;
struct leh_state this_state;
- tree_stmt_iterator i;
+ gimple_stmt_iterator gsi;
tree out_label;
try_region = gen_eh_region_try (state->cur_region);
@@ -1475,118 +1653,121 @@ lower_catch (struct leh_state *state, tree *tp)
this_state.prev_try = try_region;
this_state.tf = state->tf;
- lower_eh_constructs_1 (&this_state, &TREE_OPERAND (*tp, 0));
+ lower_eh_constructs_1 (&this_state, gimple_try_eval (tp));
if (!get_eh_region_may_contain_throw (try_region))
{
- *tp = TREE_OPERAND (*tp, 0);
- return;
+ return gimple_try_eval (tp);
}
out_label = NULL;
- for (i = tsi_start (TREE_OPERAND (*tp, 1)); !tsi_end_p (i); )
+ for (gsi = gsi_start (gimple_try_cleanup (tp)); !gsi_end_p (gsi); )
{
struct eh_region *catch_region;
- tree catch, x, eh_label;
+ tree eh_label;
+ gimple x, gcatch;
- catch = tsi_stmt (i);
- catch_region = gen_eh_region_catch (try_region, CATCH_TYPES (catch));
+ gcatch = gsi_stmt (gsi);
+ catch_region = gen_eh_region_catch (try_region,
+ gimple_catch_types (gcatch));
this_state.cur_region = catch_region;
this_state.prev_try = state->prev_try;
- lower_eh_constructs_1 (&this_state, &CATCH_BODY (catch));
+ lower_eh_constructs_1 (&this_state, gimple_catch_handler (gcatch));
eh_label = create_artificial_label ();
set_eh_region_tree_label (catch_region, eh_label);
- x = build1 (LABEL_EXPR, void_type_node, eh_label);
- tsi_link_before (&i, x, TSI_SAME_STMT);
+ x = gimple_build_label (eh_label);
+ gsi_insert_before (&gsi, x, GSI_SAME_STMT);
- if (block_may_fallthru (CATCH_BODY (catch)))
+ if (gimple_seq_may_fallthru (gimple_catch_handler (gcatch)))
{
if (!out_label)
out_label = create_artificial_label ();
- x = build1 (GOTO_EXPR, void_type_node, out_label);
- append_to_statement_list (x, &CATCH_BODY (catch));
+ x = gimple_build_goto (out_label);
+ gimple_seq_add_stmt (gimple_catch_handler_ptr (gcatch), x);
}
- tsi_link_before (&i, CATCH_BODY (catch), TSI_SAME_STMT);
- tsi_delink (&i);
+ gsi_insert_seq_before (&gsi, gimple_catch_handler (gcatch),
+ GSI_SAME_STMT);
+ gsi_remove (&gsi, false);
}
- frob_into_branch_around (tp, NULL, out_label);
+ return frob_into_branch_around (tp, NULL, out_label);
}
-/* A subroutine of lower_eh_constructs_1. Lower a TRY_CATCH_EXPR with a
- EH_FILTER_EXPR to a sequence of labels and blocks, plus the exception
+/* A subroutine of lower_eh_constructs_1. Lower a GIMPLE_TRY with a
+ GIMPLE_EH_FILTER to a sequence of labels and blocks, plus the exception
region trees that record all the magic. */
-static void
-lower_eh_filter (struct leh_state *state, tree *tp)
+static gimple_seq
+lower_eh_filter (struct leh_state *state, gimple tp)
{
struct leh_state this_state;
struct eh_region *this_region;
- tree inner = expr_first (TREE_OPERAND (*tp, 1));
+ gimple inner;
tree eh_label;
- if (EH_FILTER_MUST_NOT_THROW (inner))
+ inner = gimple_seq_first_stmt (gimple_try_cleanup (tp));
+
+ if (gimple_eh_filter_must_not_throw (inner))
this_region = gen_eh_region_must_not_throw (state->cur_region);
else
this_region = gen_eh_region_allowed (state->cur_region,
- EH_FILTER_TYPES (inner));
+ gimple_eh_filter_types (inner));
this_state = *state;
this_state.cur_region = this_region;
/* For must not throw regions any cleanup regions inside it
can't reach outer catch regions. */
- if (EH_FILTER_MUST_NOT_THROW (inner))
+ if (gimple_eh_filter_must_not_throw (inner))
this_state.prev_try = NULL;
- lower_eh_constructs_1 (&this_state, &TREE_OPERAND (*tp, 0));
+ lower_eh_constructs_1 (&this_state, gimple_try_eval (tp));
if (!get_eh_region_may_contain_throw (this_region))
{
- *tp = TREE_OPERAND (*tp, 0);
- return;
+ return gimple_try_eval (tp);
}
- lower_eh_constructs_1 (state, &EH_FILTER_FAILURE (inner));
- TREE_OPERAND (*tp, 1) = EH_FILTER_FAILURE (inner);
+ lower_eh_constructs_1 (state, gimple_eh_filter_failure (inner));
+ gimple_try_set_cleanup (tp, gimple_eh_filter_failure (inner));
eh_label = create_artificial_label ();
set_eh_region_tree_label (this_region, eh_label);
- frob_into_branch_around (tp, eh_label, NULL);
+ return frob_into_branch_around (tp, eh_label, NULL);
}
/* Implement a cleanup expression. This is similar to try-finally,
except that we only execute the cleanup block for exception edges. */
-static void
-lower_cleanup (struct leh_state *state, tree *tp)
+static gimple_seq
+lower_cleanup (struct leh_state *state, gimple tp)
{
struct leh_state this_state;
struct eh_region *this_region;
struct leh_tf_state fake_tf;
+ gimple_seq result;
/* If not using eh, then exception-only cleanups are no-ops. */
if (!flag_exceptions)
{
- *tp = TREE_OPERAND (*tp, 0);
- lower_eh_constructs_1 (state, tp);
- return;
+ result = gimple_try_eval (tp);
+ lower_eh_constructs_1 (state, result);
+ return result;
}
this_region = gen_eh_region_cleanup (state->cur_region, state->prev_try);
this_state = *state;
this_state.cur_region = this_region;
- lower_eh_constructs_1 (&this_state, &TREE_OPERAND (*tp, 0));
+ lower_eh_constructs_1 (&this_state, gimple_try_eval (tp));
if (!get_eh_region_may_contain_throw (this_region))
{
- *tp = TREE_OPERAND (*tp, 0);
- return;
+ return gimple_try_eval (tp);
}
/* Build enough of a try-finally state so that we can reuse
@@ -1595,7 +1776,7 @@ lower_cleanup (struct leh_state *state, tree *tp)
fake_tf.top_p = tp;
fake_tf.outer = state;
fake_tf.region = this_region;
- fake_tf.may_fallthru = block_may_fallthru (TREE_OPERAND (*tp, 0));
+ fake_tf.may_fallthru = gimple_seq_may_fallthru (gimple_try_eval (tp));
fake_tf.may_throw = true;
fake_tf.eh_label = create_artificial_label ();
@@ -1607,118 +1788,119 @@ lower_cleanup (struct leh_state *state, tree *tp)
{
/* In this case honor_protect_cleanup_actions had nothing to do,
and we should process this normally. */
- lower_eh_constructs_1 (state, &TREE_OPERAND (*tp, 1));
- frob_into_branch_around (tp, fake_tf.eh_label, fake_tf.fallthru_label);
+ lower_eh_constructs_1 (state, gimple_try_cleanup (tp));
+ result = frob_into_branch_around (tp, fake_tf.eh_label,
+ fake_tf.fallthru_label);
}
else
{
/* In this case honor_protect_cleanup_actions did nearly all of
the work. All we have left is to append the fallthru_label. */
- *tp = TREE_OPERAND (*tp, 0);
+ result = gimple_try_eval (tp);
if (fake_tf.fallthru_label)
{
- tree x = build1 (LABEL_EXPR, void_type_node, fake_tf.fallthru_label);
- append_to_statement_list (x, tp);
+ gimple x = gimple_build_label (fake_tf.fallthru_label);
+ gimple_seq_add_stmt (&result, x);
}
}
+ return result;
}
-/* Main loop for lowering eh constructs. */
+
+
+/* Main loop for lowering eh constructs. Also moves gsi to the next
+ statement. */
static void
-lower_eh_constructs_1 (struct leh_state *state, tree *tp)
+lower_eh_constructs_2 (struct leh_state *state, gimple_stmt_iterator *gsi)
{
- tree_stmt_iterator i;
- tree t = *tp;
+ gimple_seq replace;
+ gimple x;
+ gimple stmt = gsi_stmt (*gsi);
- switch (TREE_CODE (t))
+ switch (gimple_code (stmt))
{
- case COND_EXPR:
- lower_eh_constructs_1 (state, &COND_EXPR_THEN (t));
- lower_eh_constructs_1 (state, &COND_EXPR_ELSE (t));
- break;
-
- case CALL_EXPR:
- /* Look for things that can throw exceptions, and record them. */
- if (state->cur_region && tree_could_throw_p (t))
- {
- record_stmt_eh_region (state->cur_region, t);
- note_eh_region_may_contain_throw (state->cur_region);
- }
- break;
-
- case GIMPLE_MODIFY_STMT:
+ case GIMPLE_CALL:
+ case GIMPLE_ASSIGN:
/* Look for things that can throw exceptions, and record them. */
- if (state->cur_region && tree_could_throw_p (t))
+ if (state->cur_region && stmt_could_throw_p (stmt))
{
- record_stmt_eh_region (state->cur_region, t);
+ record_stmt_eh_region (state->cur_region, stmt);
note_eh_region_may_contain_throw (state->cur_region);
}
break;
- case GOTO_EXPR:
- case RETURN_EXPR:
- maybe_record_in_goto_queue (state, t);
- break;
- case SWITCH_EXPR:
- verify_norecord_switch_expr (state, t);
+ case GIMPLE_COND:
+ case GIMPLE_GOTO:
+ case GIMPLE_RETURN:
+ maybe_record_in_goto_queue (state, stmt);
break;
- case TRY_FINALLY_EXPR:
- lower_try_finally (state, tp);
+ case GIMPLE_SWITCH:
+ verify_norecord_switch_expr (state, stmt);
break;
- case TRY_CATCH_EXPR:
- i = tsi_start (TREE_OPERAND (t, 1));
- switch (TREE_CODE (tsi_stmt (i)))
- {
- case CATCH_EXPR:
- lower_catch (state, tp);
- break;
- case EH_FILTER_EXPR:
- lower_eh_filter (state, tp);
- break;
- default:
- lower_cleanup (state, tp);
- break;
- }
- break;
-
- case STATEMENT_LIST:
- for (i = tsi_start (t); !tsi_end_p (i); )
+ case GIMPLE_TRY:
+ if (gimple_try_kind (stmt) == GIMPLE_TRY_FINALLY)
+ replace = lower_try_finally (state, stmt);
+ else
{
- lower_eh_constructs_1 (state, tsi_stmt_ptr (i));
- t = tsi_stmt (i);
- if (TREE_CODE (t) == STATEMENT_LIST)
+ x = gimple_seq_first_stmt (gimple_try_cleanup (stmt));
+ switch (gimple_code (x))
{
- tsi_link_before (&i, t, TSI_SAME_STMT);
- tsi_delink (&i);
+ case GIMPLE_CATCH:
+ replace = lower_catch (state, stmt);
+ break;
+ case GIMPLE_EH_FILTER:
+ replace = lower_eh_filter (state, stmt);
+ break;
+ default:
+ replace = lower_cleanup (state, stmt);
+ break;
}
- else
- tsi_next (&i);
}
- break;
+
+ /* Remove the old stmt and insert the transformed sequence
+ instead. */
+ gsi_insert_seq_before (gsi, replace, GSI_SAME_STMT);
+ gsi_remove (gsi, true);
+
+ /* Return since we don't want gsi_next () */
+ return;
default:
/* A type, a decl, or some kind of statement that we're not
interested in. Don't walk them. */
break;
}
+
+ gsi_next (gsi);
+}
+
+/* A helper to unwrap a gimple_seq and feed stmts to lower_eh_constructs_2. */
+
+static void
+lower_eh_constructs_1 (struct leh_state *state, gimple_seq seq)
+{
+ gimple_stmt_iterator gsi;
+ for (gsi = gsi_start (seq); !gsi_end_p (gsi);)
+ lower_eh_constructs_2 (state, &gsi);
}
static unsigned int
lower_eh_constructs (void)
{
struct leh_state null_state;
- tree *tp = &DECL_SAVED_TREE (current_function_decl);
+
+ gimple_seq bodyp = gimple_body (current_function_decl);
finally_tree = htab_create (31, struct_ptr_hash, struct_ptr_eq, free);
- collect_finally_tree (*tp, NULL);
+ collect_finally_tree_1 (bodyp, NULL);
memset (&null_state, 0, sizeof (null_state));
- lower_eh_constructs_1 (&null_state, tp);
+ lower_eh_constructs_1 (&null_state, bodyp);
htab_delete (finally_tree);
@@ -1751,27 +1933,28 @@ struct gimple_opt_pass pass_lower_eh =
static void
make_eh_edge (struct eh_region *region, void *data)
{
- tree stmt, lab;
+ gimple stmt;
+ tree lab;
basic_block src, dst;
- stmt = (tree) data;
+ stmt = (gimple) data;
lab = get_eh_region_tree_label (region);
- src = bb_for_stmt (stmt);
+ src = gimple_bb (stmt);
dst = label_to_block (lab);
make_edge (src, dst, EDGE_ABNORMAL | EDGE_EH);
}
void
-make_eh_edges (tree stmt)
+make_eh_edges (gimple stmt)
{
int region_nr;
bool is_resx;
- if (TREE_CODE (stmt) == RESX_EXPR)
+ if (gimple_code (stmt) == GIMPLE_RESX)
{
- region_nr = TREE_INT_CST_LOW (TREE_OPERAND (stmt, 0));
+ region_nr = gimple_resx_region (stmt);
is_resx = true;
}
else
@@ -1789,17 +1972,19 @@ static bool mark_eh_edge_found_error;
/* Mark edge make_eh_edge would create for given region by setting it aux
field, output error if something goes wrong. */
+
static void
mark_eh_edge (struct eh_region *region, void *data)
{
- tree stmt, lab;
+ gimple stmt;
+ tree lab;
basic_block src, dst;
edge e;
- stmt = (tree) data;
+ stmt = (gimple) data;
lab = get_eh_region_tree_label (region);
- src = bb_for_stmt (stmt);
+ src = gimple_bb (stmt);
dst = label_to_block (lab);
e = find_edge (src, dst);
@@ -1823,23 +2008,24 @@ mark_eh_edge (struct eh_region *region, void *data)
e->aux = (void *)1;
}
-/* Verify that BB containing stmt as last stmt has precisely the edges
- make_eh_edges would create. */
+/* Verify that BB containing STMT as the last statement, has precisely the
+ edges that make_eh_edges would create. */
+
bool
-verify_eh_edges (tree stmt)
+verify_eh_edges (gimple stmt)
{
int region_nr;
bool is_resx;
- basic_block bb = bb_for_stmt (stmt);
+ basic_block bb = gimple_bb (stmt);
edge_iterator ei;
edge e;
FOR_EACH_EDGE (e, ei, bb->succs)
gcc_assert (!e->aux);
mark_eh_edge_found_error = false;
- if (TREE_CODE (stmt) == RESX_EXPR)
+ if (gimple_code (stmt) == GIMPLE_RESX)
{
- region_nr = TREE_INT_CST_LOW (TREE_OPERAND (stmt, 0));
+ region_nr = gimple_resx_region (stmt);
is_resx = true;
}
else
@@ -1855,7 +2041,7 @@ verify_eh_edges (tree stmt)
}
return false;
}
- if (!tree_could_throw_p (stmt))
+ if (!stmt_could_throw_p (stmt))
{
error ("BB %i last statement has incorrectly set region", bb->index);
return true;
@@ -1874,42 +2060,151 @@ verify_eh_edges (tree stmt)
}
e->aux = NULL;
}
+
return mark_eh_edge_found_error;
}
-/* Return true if the expr can trap, as in dereferencing an invalid pointer
+/* Helper function for operation_could_trap_p and stmt_could_throw_p. */
+
+static bool
+operation_could_trap_helper_p (enum tree_code op,
+ bool fp_operation,
+ bool honor_trapv,
+ bool honor_nans,
+ bool honor_snans,
+ tree divisor,
+ bool *handled)
+{
+ *handled = true;
+ switch (op)
+ {
+ case TRUNC_DIV_EXPR:
+ case CEIL_DIV_EXPR:
+ case FLOOR_DIV_EXPR:
+ case ROUND_DIV_EXPR:
+ case EXACT_DIV_EXPR:
+ case CEIL_MOD_EXPR:
+ case FLOOR_MOD_EXPR:
+ case ROUND_MOD_EXPR:
+ case TRUNC_MOD_EXPR:
+ case RDIV_EXPR:
+ if (honor_snans || honor_trapv)
+ return true;
+ if (fp_operation)
+ return flag_trapping_math;
+ if (!TREE_CONSTANT (divisor) || integer_zerop (divisor))
+ return true;
+ return false;
+
+ case LT_EXPR:
+ case LE_EXPR:
+ case GT_EXPR:
+ case GE_EXPR:
+ case LTGT_EXPR:
+ /* Some floating point comparisons may trap. */
+ return honor_nans;
+
+ case EQ_EXPR:
+ case NE_EXPR:
+ case UNORDERED_EXPR:
+ case ORDERED_EXPR:
+ case UNLT_EXPR:
+ case UNLE_EXPR:
+ case UNGT_EXPR:
+ case UNGE_EXPR:
+ case UNEQ_EXPR:
+ return honor_snans;
+
+ case CONVERT_EXPR:
+ case FIX_TRUNC_EXPR:
+ /* Conversion of floating point might trap. */
+ return honor_nans;
+
+ case NEGATE_EXPR:
+ case ABS_EXPR:
+ case CONJ_EXPR:
+ /* These operations don't trap with floating point. */
+ if (honor_trapv)
+ return true;
+ return false;
+
+ case PLUS_EXPR:
+ case MINUS_EXPR:
+ case MULT_EXPR:
+ /* Any floating arithmetic may trap. */
+ if (fp_operation && flag_trapping_math)
+ return true;
+ if (honor_trapv)
+ return true;
+ return false;
+
+ default:
+ /* Any floating arithmetic may trap. */
+ if (fp_operation && flag_trapping_math)
+ return true;
+
+ *handled = false;
+ return false;
+ }
+}
+
+/* Return true if operation OP may trap. FP_OPERATION is true if OP is applied
+ on floating-point values. HONOR_TRAPV is true if OP is applied on integer
+ type operands that may trap. If OP is a division operator, DIVISOR contains
+ the value of the divisor. */
+
+bool
+operation_could_trap_p (enum tree_code op, bool fp_operation, bool honor_trapv,
+ tree divisor)
+{
+ bool honor_nans = (fp_operation && flag_trapping_math
+ && !flag_finite_math_only);
+ bool honor_snans = fp_operation && flag_signaling_nans != 0;
+ bool handled;
+
+ if (TREE_CODE_CLASS (op) != tcc_comparison
+ && TREE_CODE_CLASS (op) != tcc_unary
+ && TREE_CODE_CLASS (op) != tcc_binary)
+ return false;
+
+ return operation_could_trap_helper_p (op, fp_operation, honor_trapv,
+ honor_nans, honor_snans, divisor,
+ &handled);
+}
+
+/* Return true if EXPR can trap, as in dereferencing an invalid pointer
location or floating point arithmetic. C.f. the rtl version, may_trap_p.
This routine expects only GIMPLE lhs or rhs input. */
bool
tree_could_trap_p (tree expr)
{
- enum tree_code code = TREE_CODE (expr);
- bool honor_nans = false;
- bool honor_snans = false;
+ enum tree_code code;
bool fp_operation = false;
bool honor_trapv = false;
- tree t, base;
+ tree t, base, div = NULL_TREE;
- if (TREE_CODE_CLASS (code) == tcc_comparison
- || TREE_CODE_CLASS (code) == tcc_unary
- || TREE_CODE_CLASS (code) == tcc_binary)
+ if (!expr)
+ return false;
+
+ code = TREE_CODE (expr);
+ t = TREE_TYPE (expr);
+
+ if (t)
{
- t = TREE_TYPE (expr);
if (COMPARISON_CLASS_P (expr))
fp_operation = FLOAT_TYPE_P (TREE_TYPE (TREE_OPERAND (expr, 0)));
else
fp_operation = FLOAT_TYPE_P (t);
- if (fp_operation)
- {
- honor_nans = flag_trapping_math && !flag_finite_math_only;
- honor_snans = flag_signaling_nans != 0;
- }
- else if (INTEGRAL_TYPE_P (t) && TYPE_OVERFLOW_TRAPS (t))
- honor_trapv = true;
+ honor_trapv = INTEGRAL_TYPE_P (t) && TYPE_OVERFLOW_TRAPS (t);
}
+ if (TREE_CODE_CLASS (code) == tcc_binary)
+ div = TREE_OPERAND (expr, 1);
+ if (operation_could_trap_p (code, fp_operation, honor_trapv, div))
+ return true;
+
restart:
switch (code)
{
@@ -1958,93 +2253,126 @@ tree_could_trap_p (tree expr)
case ASM_EXPR:
return TREE_THIS_VOLATILE (expr);
- case TRUNC_DIV_EXPR:
- case CEIL_DIV_EXPR:
- case FLOOR_DIV_EXPR:
- case ROUND_DIV_EXPR:
- case EXACT_DIV_EXPR:
- case CEIL_MOD_EXPR:
- case FLOOR_MOD_EXPR:
- case ROUND_MOD_EXPR:
- case TRUNC_MOD_EXPR:
- case RDIV_EXPR:
- if (honor_snans || honor_trapv)
+
+ case CALL_EXPR:
+ t = get_callee_fndecl (expr);
+ /* Assume that calls to weak functions may trap. */
+ if (!t || !DECL_P (t) || DECL_WEAK (t))
return true;
- if (fp_operation)
- return flag_trapping_math;
- t = TREE_OPERAND (expr, 1);
- if (!TREE_CONSTANT (t) || integer_zerop (t))
- return true;
return false;
- case LT_EXPR:
- case LE_EXPR:
- case GT_EXPR:
- case GE_EXPR:
- case LTGT_EXPR:
- /* Some floating point comparisons may trap. */
- return honor_nans;
+ default:
+ return false;
+ }
+}
- case EQ_EXPR:
- case NE_EXPR:
- case UNORDERED_EXPR:
- case ORDERED_EXPR:
- case UNLT_EXPR:
- case UNLE_EXPR:
- case UNGT_EXPR:
- case UNGE_EXPR:
- case UNEQ_EXPR:
- return honor_snans;
- case CONVERT_EXPR:
- case FIX_TRUNC_EXPR:
- /* Conversion of floating point might trap. */
- return honor_nans;
+/* Helper for stmt_could_throw_p. Return true if STMT (assumed to be a
+ an assignment or a conditional) may throw. */
- case NEGATE_EXPR:
- case ABS_EXPR:
- case CONJ_EXPR:
- /* These operations don't trap with floating point. */
- if (honor_trapv)
- return true;
- return false;
+static bool
+stmt_could_throw_1_p (gimple stmt)
+{
+ enum tree_code code = gimple_expr_code (stmt);
+ bool honor_nans = false;
+ bool honor_snans = false;
+ bool fp_operation = false;
+ bool honor_trapv = false;
+ tree t;
+ size_t i;
+ bool handled, ret;
- case PLUS_EXPR:
- case MINUS_EXPR:
- case MULT_EXPR:
- /* Any floating arithmetic may trap. */
- if (fp_operation && flag_trapping_math)
- return true;
- if (honor_trapv)
- return true;
- return false;
+ if (TREE_CODE_CLASS (code) == tcc_comparison
+ || TREE_CODE_CLASS (code) == tcc_unary
+ || TREE_CODE_CLASS (code) == tcc_binary)
+ {
+ t = gimple_expr_type (stmt);
+ fp_operation = FLOAT_TYPE_P (t);
+ if (fp_operation)
+ {
+ honor_nans = flag_trapping_math && !flag_finite_math_only;
+ honor_snans = flag_signaling_nans != 0;
+ }
+ else if (INTEGRAL_TYPE_P (t) && TYPE_OVERFLOW_TRAPS (t))
+ honor_trapv = true;
+ }
+
+ /* Check if the main expression may trap. */
+ t = is_gimple_assign (stmt) ? gimple_assign_rhs2 (stmt) : NULL;
+ ret = operation_could_trap_helper_p (code, fp_operation, honor_trapv,
+ honor_nans, honor_snans, t,
+ &handled);
+ if (handled)
+ return ret;
+
+ /* If the expression does not trap, see if any of the individual operands may
+ trap. */
+ for (i = 0; i < gimple_num_ops (stmt); i++)
+ if (tree_could_trap_p (gimple_op (stmt, i)))
+ return true;
+
+ return false;
+}
+
+
+/* Return true if statement STMT could throw an exception. */
+
+bool
+stmt_could_throw_p (gimple stmt)
+{
+ enum gimple_code code;
+
+ if (!flag_exceptions)
+ return false;
+
+ /* The only statements that can throw an exception are assignments,
+ conditionals, calls and asms. */
+ code = gimple_code (stmt);
+ if (code != GIMPLE_ASSIGN
+ && code != GIMPLE_COND
+ && code != GIMPLE_CALL
+ && code != GIMPLE_ASM)
+ return false;
+
+ /* If exceptions can only be thrown by function calls and STMT is not a
+ GIMPLE_CALL, the statement cannot throw. */
+ if (!flag_non_call_exceptions && code != GIMPLE_CALL)
+ return false;
+
+ if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
+ return stmt_could_throw_1_p (stmt);
+ else if (is_gimple_call (stmt))
+ {
+ tree t = gimple_call_fndecl (stmt);
- case CALL_EXPR:
- t = get_callee_fndecl (expr);
/* Assume that calls to weak functions may trap. */
if (!t || !DECL_P (t) || DECL_WEAK (t))
return true;
- return false;
- default:
- /* Any floating arithmetic may trap. */
- if (fp_operation && flag_trapping_math)
- return true;
- return false;
+ return (gimple_call_flags (stmt) & ECF_NOTHROW) == 0;
}
+ else if (gimple_code (stmt) == GIMPLE_ASM)
+ return (gimple_asm_volatile_p (stmt));
+ else
+ gcc_unreachable ();
+
+ return false;
}
+
+/* Return true if expression T could throw an exception. */
+
bool
tree_could_throw_p (tree t)
{
if (!flag_exceptions)
return false;
- if (TREE_CODE (t) == GIMPLE_MODIFY_STMT)
+ if (TREE_CODE (t) == MODIFY_EXPR)
{
if (flag_non_call_exceptions
- && tree_could_trap_p (GIMPLE_STMT_OPERAND (t, 0)))
+ && tree_could_trap_p (TREE_OPERAND (t, 0)))
return true;
- t = GIMPLE_STMT_OPERAND (t, 1);
+ t = TREE_OPERAND (t, 1);
}
if (TREE_CODE (t) == WITH_SIZE_EXPR)
@@ -2056,36 +2384,30 @@ tree_could_throw_p (tree t)
return false;
}
+
+/* Return true if STMT can throw an exception that is caught within
+ the current function (CFUN). */
+
bool
-tree_can_throw_internal (const_tree stmt)
+stmt_can_throw_internal (gimple stmt)
{
int region_nr;
bool is_resx = false;
- if (TREE_CODE (stmt) == RESX_EXPR)
- region_nr = TREE_INT_CST_LOW (TREE_OPERAND (stmt, 0)), is_resx = true;
+ if (gimple_code (stmt) == GIMPLE_RESX)
+ {
+ region_nr = gimple_resx_region (stmt);
+ is_resx = true;
+ }
else
region_nr = lookup_stmt_eh_region (stmt);
+
if (region_nr < 0)
return false;
+
return can_throw_internal_1 (region_nr, is_resx);
}
-bool
-tree_can_throw_external (tree stmt)
-{
- int region_nr;
- bool is_resx = false;
-
- if (TREE_CODE (stmt) == RESX_EXPR)
- region_nr = TREE_INT_CST_LOW (TREE_OPERAND (stmt, 0)), is_resx = true;
- else
- region_nr = lookup_stmt_eh_region (stmt);
- if (region_nr < 0)
- return tree_could_throw_p (stmt);
- else
- return can_throw_external_1 (region_nr, is_resx);
-}
/* Given a statement OLD_STMT and a new statement NEW_STMT that has replaced
OLD_STMT in the function, remove OLD_STMT from the EH table and put NEW_STMT
@@ -2093,13 +2415,13 @@ tree_can_throw_external (tree stmt)
done that my require an EH edge purge. */
bool
-maybe_clean_or_replace_eh_stmt (tree old_stmt, tree new_stmt)
+maybe_clean_or_replace_eh_stmt (gimple old_stmt, gimple new_stmt)
{
int region_nr = lookup_stmt_eh_region (old_stmt);
if (region_nr >= 0)
{
- bool new_stmt_could_throw = tree_could_throw_p (new_stmt);
+ bool new_stmt_could_throw = stmt_could_throw_p (new_stmt);
if (new_stmt == old_stmt && new_stmt_could_throw)
return false;
@@ -2117,38 +2439,42 @@ maybe_clean_or_replace_eh_stmt (tree old_stmt, tree new_stmt)
return false;
}
-/* Returns TRUE if oneh and twoh are exception handlers (op 1 of
- TRY_CATCH_EXPR or TRY_FINALLY_EXPR that are similar enough to be
- considered the same. Currently this only handles handlers consisting of
- a single call, as that's the important case for C++: a destructor call
- for a particular object showing up in multiple handlers. */
+/* Returns TRUE if oneh and twoh are exception handlers (gimple_try_cleanup of
+ GIMPLE_TRY) that are similar enough to be considered the same. Currently
+ this only handles handlers consisting of a single call, as that's the
+ important case for C++: a destructor call for a particular object showing
+ up in multiple handlers. */
static bool
-same_handler_p (tree oneh, tree twoh)
+same_handler_p (gimple_seq oneh, gimple_seq twoh)
{
- tree_stmt_iterator i;
- tree ones, twos;
- int ai;
+ gimple_stmt_iterator gsi;
+ gimple ones, twos;
+ unsigned int ai;
- i = tsi_start (oneh);
- if (!tsi_one_before_end_p (i))
+ gsi = gsi_start (oneh);
+ if (!gsi_one_before_end_p (gsi))
return false;
- ones = tsi_stmt (i);
+ ones = gsi_stmt (gsi);
- i = tsi_start (twoh);
- if (!tsi_one_before_end_p (i))
+ gsi = gsi_start (twoh);
+ if (!gsi_one_before_end_p (gsi))
return false;
- twos = tsi_stmt (i);
-
- if (TREE_CODE (ones) != CALL_EXPR
- || TREE_CODE (twos) != CALL_EXPR
- || !operand_equal_p (CALL_EXPR_FN (ones), CALL_EXPR_FN (twos), 0)
- || call_expr_nargs (ones) != call_expr_nargs (twos))
+ twos = gsi_stmt (gsi);
+
+ if (!is_gimple_call (ones)
+ || !is_gimple_call (twos)
+ || gimple_call_lhs (ones)
+ || gimple_call_lhs (twos)
+ || gimple_call_chain (ones)
+ || gimple_call_chain (twos)
+ || !operand_equal_p (gimple_call_fn (ones), gimple_call_fn (twos), 0)
+ || gimple_call_num_args (ones) != gimple_call_num_args (twos))
return false;
- for (ai = 0; ai < call_expr_nargs (ones); ++ai)
- if (!operand_equal_p (CALL_EXPR_ARG (ones, ai),
- CALL_EXPR_ARG (twos, ai), 0))
+ for (ai = 0; ai < gimple_call_num_args (ones); ++ai)
+ if (!operand_equal_p (gimple_call_arg (ones, ai),
+ gimple_call_arg (twos, ai), 0))
return false;
return true;
@@ -2165,27 +2491,29 @@ same_handler_p (tree oneh, tree twoh)
temporary used in the initializer for A. */
static void
-optimize_double_finally (tree one, tree two)
+optimize_double_finally (gimple one, gimple two)
{
- tree oneh;
- tree_stmt_iterator i;
+ gimple oneh;
+ gimple_stmt_iterator gsi;
- i = tsi_start (TREE_OPERAND (one, 1));
- if (!tsi_one_before_end_p (i))
+ gsi = gsi_start (gimple_try_cleanup (one));
+ if (!gsi_one_before_end_p (gsi))
return;
- oneh = tsi_stmt (i);
- if (TREE_CODE (oneh) != TRY_CATCH_EXPR)
+ oneh = gsi_stmt (gsi);
+ if (gimple_code (oneh) != GIMPLE_TRY
+ || gimple_try_kind (oneh) != GIMPLE_TRY_CATCH)
return;
- if (same_handler_p (TREE_OPERAND (oneh, 1), TREE_OPERAND (two, 1)))
+ if (same_handler_p (gimple_try_cleanup (oneh), gimple_try_cleanup (two)))
{
- tree b = TREE_OPERAND (oneh, 0);
- TREE_OPERAND (one, 1) = b;
- TREE_SET_CODE (one, TRY_CATCH_EXPR);
+ gimple_seq seq = gimple_try_eval (oneh);
- i = tsi_start (TREE_OPERAND (two, 0));
- tsi_link_before (&i, unsave_expr_now (b), TSI_SAME_STMT);
+ gimple_try_set_cleanup (one, seq);
+ gimple_try_set_kind (one, GIMPLE_TRY_CATCH);
+ seq = copy_gimple_seq_and_replace_locals (seq);
+ gimple_seq_add_seq (&seq, gimple_try_eval (two));
+ gimple_try_set_eval (two, seq);
}
}
@@ -2193,60 +2521,55 @@ optimize_double_finally (tree one, tree two)
flow has been lowered but EH structures haven't. */
static void
-refactor_eh_r (tree t)
+refactor_eh_r (gimple_seq seq)
{
- tailrecurse:
- switch (TREE_CODE (t))
- {
- case TRY_FINALLY_EXPR:
- case TRY_CATCH_EXPR:
- refactor_eh_r (TREE_OPERAND (t, 0));
- t = TREE_OPERAND (t, 1);
- goto tailrecurse;
+ gimple_stmt_iterator gsi;
+ gimple one, two;
- case CATCH_EXPR:
- t = CATCH_BODY (t);
- goto tailrecurse;
-
- case EH_FILTER_EXPR:
- t = EH_FILTER_FAILURE (t);
- goto tailrecurse;
-
- case STATEMENT_LIST:
- {
- tree_stmt_iterator i;
- tree one = NULL_TREE, two = NULL_TREE;
- /* Try to refactor double try/finally. */
- for (i = tsi_start (t); !tsi_end_p (i); tsi_next (&i))
- {
- one = two;
- two = tsi_stmt (i);
- if (one && two
- && TREE_CODE (one) == TRY_FINALLY_EXPR
- && TREE_CODE (two) == TRY_FINALLY_EXPR)
- optimize_double_finally (one, two);
- if (one)
- refactor_eh_r (one);
- }
- if (two)
+ one = NULL;
+ two = NULL;
+ gsi = gsi_start (seq);
+ while (1)
+ {
+ one = two;
+ if (gsi_end_p (gsi))
+ two = NULL;
+ else
+ two = gsi_stmt (gsi);
+ if (one
+ && two
+ && gimple_code (one) == GIMPLE_TRY
+ && gimple_code (two) == GIMPLE_TRY
+ && gimple_try_kind (one) == GIMPLE_TRY_FINALLY
+ && gimple_try_kind (two) == GIMPLE_TRY_FINALLY)
+ optimize_double_finally (one, two);
+ if (one)
+ switch (gimple_code (one))
{
- t = two;
- goto tailrecurse;
+ case GIMPLE_TRY:
+ refactor_eh_r (gimple_try_eval (one));
+ refactor_eh_r (gimple_try_cleanup (one));
+ break;
+ case GIMPLE_CATCH:
+ refactor_eh_r (gimple_catch_handler (one));
+ break;
+ case GIMPLE_EH_FILTER:
+ refactor_eh_r (gimple_eh_filter_failure (one));
+ break;
+ default:
+ break;
}
- }
- break;
-
- default:
- /* A type, a decl, or some kind of statement that we're not
- interested in. Don't walk them. */
- break;
+ if (two)
+ gsi_next (&gsi);
+ else
+ break;
}
}
static unsigned
refactor_eh (void)
{
- refactor_eh_r (DECL_SAVED_TREE (current_function_decl));
+ refactor_eh_r (gimple_body (current_function_decl));
return 0;
}
diff --git a/gcc/tree-flow-inline.h b/gcc/tree-flow-inline.h
index 1eb284047e3..eefc983190e 100644
--- a/gcc/tree-flow-inline.h
+++ b/gcc/tree-flow-inline.h
@@ -235,52 +235,6 @@ get_function_ann (tree var)
return (ann) ? ann : create_function_ann (var);
}
-/* Return true if T has a statement annotation attached to it. */
-
-static inline bool
-has_stmt_ann (tree t)
-{
-#ifdef ENABLE_CHECKING
- gcc_assert (is_gimple_stmt (t));
-#endif
- return t->base.ann && t->base.ann->common.type == STMT_ANN;
-}
-
-/* Return the statement annotation for T, which must be a statement
- node. Return NULL if the statement annotation doesn't exist. */
-static inline stmt_ann_t
-stmt_ann (tree t)
-{
-#ifdef ENABLE_CHECKING
- gcc_assert (is_gimple_stmt (t));
-#endif
- gcc_assert (!t->base.ann || t->base.ann->common.type == STMT_ANN);
- return (stmt_ann_t) t->base.ann;
-}
-
-/* Return the statement annotation for T, which must be a statement
- node. Create the statement annotation if it doesn't exist. */
-static inline stmt_ann_t
-get_stmt_ann (tree stmt)
-{
- stmt_ann_t ann = stmt_ann (stmt);
- return (ann) ? ann : create_stmt_ann (stmt);
-}
-
-/* Set the uid of all non phi function statements. */
-static inline void
-set_gimple_stmt_uid (tree stmt, unsigned int uid)
-{
- get_stmt_ann (stmt)->uid = uid;
-}
-
-/* Get the uid of all non phi function statements. */
-static inline unsigned int
-gimple_stmt_uid (tree stmt)
-{
- return get_stmt_ann (stmt)->uid;
-}
-
/* Get the number of the next statement uid to be allocated. */
static inline unsigned int
gimple_stmt_max_uid (struct function *fn)
@@ -309,19 +263,6 @@ ann_type (tree_ann_t ann)
return ann->common.type;
}
-/* Return the basic block for statement T. */
-static inline basic_block
-bb_for_stmt (tree t)
-{
- stmt_ann_t ann;
-
- if (TREE_CODE (t) == PHI_NODE)
- return PHI_BB (t);
-
- ann = stmt_ann (t);
- return ann ? ann->bb : NULL;
-}
-
/* Return the may_aliases bitmap for variable VAR, or NULL if it has
no may aliases. */
static inline bitmap
@@ -333,71 +274,18 @@ may_aliases (const_tree var)
/* Return the line number for EXPR, or return -1 if we have no line
number information for it. */
static inline int
-get_lineno (const_tree expr)
+get_lineno (const_gimple stmt)
{
- if (expr == NULL_TREE)
- return -1;
-
- if (TREE_CODE (expr) == COMPOUND_EXPR)
- expr = TREE_OPERAND (expr, 0);
+ location_t loc;
- if (! EXPR_HAS_LOCATION (expr))
+ if (!stmt)
return -1;
- return EXPR_LINENO (expr);
-}
-
-/* Return true if T is a noreturn call. */
-static inline bool
-noreturn_call_p (tree t)
-{
- tree call = get_call_expr_in (t);
- return call != 0 && (call_expr_flags (call) & ECF_NORETURN) != 0;
-}
-
-/* Mark statement T as modified. */
-static inline void
-mark_stmt_modified (tree t)
-{
- stmt_ann_t ann;
- if (TREE_CODE (t) == PHI_NODE)
- return;
-
- ann = stmt_ann (t);
- if (ann == NULL)
- ann = create_stmt_ann (t);
- else if (noreturn_call_p (t) && cfun->gimple_df)
- VEC_safe_push (tree, gc, MODIFIED_NORETURN_CALLS (cfun), t);
- ann->modified = 1;
-}
-
-/* Mark statement T as modified, and update it. */
-static inline void
-update_stmt (tree t)
-{
- if (TREE_CODE (t) == PHI_NODE)
- return;
- mark_stmt_modified (t);
- update_stmt_operands (t);
-}
-
-static inline void
-update_stmt_if_modified (tree t)
-{
- if (stmt_modified_p (t))
- update_stmt_operands (t);
-}
-
-/* Return true if T is marked as modified, false otherwise. */
-static inline bool
-stmt_modified_p (tree t)
-{
- stmt_ann_t ann = stmt_ann (t);
+ loc = gimple_location (stmt);
+ if (loc != UNKNOWN_LOCATION)
+ return -1;
- /* Note that if the statement doesn't yet have an annotation, we consider it
- modified. This will force the next call to update_stmt_operands to scan
- the statement. */
- return ann ? ann->modified : true;
+ return LOCATION_LINE (loc);
}
/* Delink an immediate_uses node from its chain. */
@@ -457,13 +345,13 @@ set_ssa_use_from_ptr (use_operand_p use, tree val)
/* Link ssa_imm_use node LINKNODE into the chain for DEF, with use occurring
in STMT. */
static inline void
-link_imm_use_stmt (ssa_use_operand_t *linknode, tree def, tree stmt)
+link_imm_use_stmt (ssa_use_operand_t *linknode, tree def, gimple stmt)
{
if (stmt)
link_imm_use (linknode, def);
else
link_imm_use (linknode, NULL);
- linknode->stmt = stmt;
+ linknode->loc.stmt = stmt;
}
/* Relink a new node in place of an old node in the list. */
@@ -486,13 +374,14 @@ relink_imm_use (ssa_use_operand_t *node, ssa_use_operand_t *old)
/* Relink ssa_imm_use node LINKNODE into the chain for OLD, with use occurring
in STMT. */
static inline void
-relink_imm_use_stmt (ssa_use_operand_t *linknode, ssa_use_operand_t *old, tree stmt)
+relink_imm_use_stmt (ssa_use_operand_t *linknode, ssa_use_operand_t *old,
+ gimple stmt)
{
if (stmt)
relink_imm_use (linknode, old);
else
link_imm_use (linknode, NULL);
- linknode->stmt = stmt;
+ linknode->loc.stmt = stmt;
}
@@ -562,17 +451,17 @@ has_single_use (const_tree var)
/* If VAR has only a single immediate use, return true, and set USE_P and STMT
to the use pointer and stmt of occurrence. */
static inline bool
-single_imm_use (const_tree var, use_operand_p *use_p, tree *stmt)
+single_imm_use (const_tree var, use_operand_p *use_p, gimple *stmt)
{
const ssa_use_operand_t *const ptr = &(SSA_NAME_IMM_USE_NODE (var));
if (ptr != ptr->next && ptr == ptr->next->next)
{
*use_p = ptr->next;
- *stmt = ptr->next->stmt;
+ *stmt = ptr->next->loc.stmt;
return true;
}
*use_p = NULL_USE_OPERAND_P;
- *stmt = NULL_TREE;
+ *stmt = NULL;
return false;
}
@@ -590,75 +479,76 @@ num_imm_uses (const_tree var)
return num;
}
-/* Return the tree pointer to by USE. */
+/* Return the tree pointed-to by USE. */
static inline tree
get_use_from_ptr (use_operand_p use)
{
return *(use->use);
}
-/* Return the tree pointer to by DEF. */
+/* Return the tree pointed-to by DEF. */
static inline tree
get_def_from_ptr (def_operand_p def)
{
return *def;
}
-/* Return a def_operand_p pointer for the result of PHI. */
-static inline def_operand_p
-get_phi_result_ptr (tree phi)
+/* Return a use_operand_p pointer for argument I of PHI node GS. */
+
+static inline use_operand_p
+gimple_phi_arg_imm_use_ptr (gimple gs, int i)
{
- return &(PHI_RESULT_TREE (phi));
+ return &gimple_phi_arg (gs, i)->imm_use;
}
-/* Return a use_operand_p pointer for argument I of phinode PHI. */
-static inline use_operand_p
-get_phi_arg_def_ptr (tree phi, int i)
+/* Return the tree operand for argument I of PHI node GS. */
+
+static inline tree
+gimple_phi_arg_def (gimple gs, size_t index)
{
- return &(PHI_ARG_IMM_USE_NODE (phi,i));
+ struct phi_arg_d *pd = gimple_phi_arg (gs, index);
+ return get_use_from_ptr (&pd->imm_use);
}
+/* Return a pointer to the tree operand for argument I of PHI node GS. */
-/* Return the bitmap of addresses taken by STMT, or NULL if it takes
- no addresses. */
-static inline bitmap
-addresses_taken (tree stmt)
+static inline tree *
+gimple_phi_arg_def_ptr (gimple gs, size_t index)
+{
+ return &gimple_phi_arg (gs, index)->def;
+}
+
+/* Return the edge associated with argument I of phi node GS. */
+
+static inline edge
+gimple_phi_arg_edge (gimple gs, size_t i)
{
- stmt_ann_t ann = stmt_ann (stmt);
- return ann ? ann->addresses_taken : NULL;
+ return EDGE_PRED (gimple_bb (gs), i);
}
/* Return the PHI nodes for basic block BB, or NULL if there are no
PHI nodes. */
-static inline tree
+static inline gimple_seq
phi_nodes (const_basic_block bb)
{
gcc_assert (!(bb->flags & BB_RTL));
- if (!bb->il.tree)
+ if (!bb->il.gimple)
return NULL;
- return bb->il.tree->phi_nodes;
+ return bb->il.gimple->phi_nodes;
}
-/* Return pointer to the list of PHI nodes for basic block BB. */
-
-static inline tree *
-phi_nodes_ptr (basic_block bb)
-{
- gcc_assert (!(bb->flags & BB_RTL));
- return &bb->il.tree->phi_nodes;
-}
-
-/* Set list of phi nodes of a basic block BB to L. */
+/* Set PHI nodes of a basic block BB to SEQ. */
static inline void
-set_phi_nodes (basic_block bb, tree l)
+set_phi_nodes (basic_block bb, gimple_seq seq)
{
- tree phi;
+ gimple_stmt_iterator i;
gcc_assert (!(bb->flags & BB_RTL));
- bb->il.tree->phi_nodes = l;
- for (phi = l; phi; phi = PHI_CHAIN (phi))
- set_bb_for_stmt (phi, bb);
+ bb->il.gimple->phi_nodes = seq;
+ if (seq)
+ for (i = gsi_start (seq); !gsi_end_p (i); gsi_next (&i))
+ gimple_set_bb (gsi_stmt (i), bb);
}
/* Return the phi argument which contains the specified use. */
@@ -667,18 +557,18 @@ static inline int
phi_arg_index_from_use (use_operand_p use)
{
struct phi_arg_d *element, *root;
- int index;
- tree phi;
+ size_t index;
+ gimple phi;
/* Since the use is the first thing in a PHI argument element, we can
calculate its index based on casting it to an argument, and performing
pointer arithmetic. */
phi = USE_STMT (use);
- gcc_assert (TREE_CODE (phi) == PHI_NODE);
+ gcc_assert (gimple_code (phi) == GIMPLE_PHI);
element = (struct phi_arg_d *)use;
- root = &(PHI_ARG_ELT (phi, 0));
+ root = gimple_phi_arg (phi, 0);
index = element - root;
#ifdef ENABLE_CHECKING
@@ -686,7 +576,7 @@ phi_arg_index_from_use (use_operand_p use)
then imm_use is likely not the first element in phi_arg_d. */
gcc_assert (
(((char *)element - (char *)root) % sizeof (struct phi_arg_d)) == 0);
- gcc_assert (index >= 0 && index < PHI_ARG_CAPACITY (phi));
+ gcc_assert (index < gimple_phi_capacity (phi));
#endif
return index;
@@ -728,121 +618,13 @@ phi_ssa_name_p (const_tree t)
return false;
}
-/* ----------------------------------------------------------------------- */
-
-/* Returns the list of statements in BB. */
-
-static inline tree
-bb_stmt_list (const_basic_block bb)
-{
- gcc_assert (!(bb->flags & BB_RTL));
- return bb->il.tree->stmt_list;
-}
-
-/* Sets the list of statements in BB to LIST. */
-
-static inline void
-set_bb_stmt_list (basic_block bb, tree list)
-{
- gcc_assert (!(bb->flags & BB_RTL));
- bb->il.tree->stmt_list = list;
-}
-
-/* Return a block_stmt_iterator that points to beginning of basic
- block BB. */
-static inline block_stmt_iterator
-bsi_start (basic_block bb)
-{
- block_stmt_iterator bsi;
- if (bb->index < NUM_FIXED_BLOCKS)
- {
- bsi.tsi.ptr = NULL;
- bsi.tsi.container = NULL;
- }
- else
- bsi.tsi = tsi_start (bb_stmt_list (bb));
- bsi.bb = bb;
- return bsi;
-}
-
-/* Return a block statement iterator that points to the first non-label
- statement in block BB. */
-
-static inline block_stmt_iterator
-bsi_after_labels (basic_block bb)
-{
- block_stmt_iterator bsi = bsi_start (bb);
-
- while (!bsi_end_p (bsi) && TREE_CODE (bsi_stmt (bsi)) == LABEL_EXPR)
- bsi_next (&bsi);
-
- return bsi;
-}
-
-/* Return a block statement iterator that points to the end of basic
- block BB. */
-static inline block_stmt_iterator
-bsi_last (basic_block bb)
-{
- block_stmt_iterator bsi;
-
- if (bb->index < NUM_FIXED_BLOCKS)
- {
- bsi.tsi.ptr = NULL;
- bsi.tsi.container = NULL;
- }
- else
- bsi.tsi = tsi_last (bb_stmt_list (bb));
- bsi.bb = bb;
- return bsi;
-}
-
-/* Return true if block statement iterator I has reached the end of
- the basic block. */
-static inline bool
-bsi_end_p (block_stmt_iterator i)
-{
- return tsi_end_p (i.tsi);
-}
-
-/* Modify block statement iterator I so that it is at the next
- statement in the basic block. */
-static inline void
-bsi_next (block_stmt_iterator *i)
-{
- tsi_next (&i->tsi);
-}
-
-/* Modify block statement iterator I so that it is at the previous
- statement in the basic block. */
-static inline void
-bsi_prev (block_stmt_iterator *i)
-{
- tsi_prev (&i->tsi);
-}
-
-/* Return the statement that block statement iterator I is currently
- at. */
-static inline tree
-bsi_stmt (block_stmt_iterator i)
-{
- return tsi_stmt (i.tsi);
-}
-
-/* Return a pointer to the statement that block statement iterator I
- is currently at. */
-static inline tree *
-bsi_stmt_ptr (block_stmt_iterator i)
-{
- return tsi_stmt_ptr (i.tsi);
-}
/* Returns the loop of the statement STMT. */
static inline struct loop *
-loop_containing_stmt (tree stmt)
+loop_containing_stmt (gimple stmt)
{
- basic_block bb = bb_for_stmt (stmt);
+ basic_block bb = gimple_bb (stmt);
if (!bb)
return NULL;
@@ -1083,7 +865,7 @@ clear_and_done_ssa_iter (ssa_op_iter *ptr)
ptr->iter_type = ssa_op_iter_none;
ptr->phi_i = 0;
ptr->num_phi = 0;
- ptr->phi_stmt = NULL_TREE;
+ ptr->phi_stmt = NULL;
ptr->done = true;
ptr->vuse_index = 0;
ptr->mayuse_index = 0;
@@ -1091,22 +873,18 @@ clear_and_done_ssa_iter (ssa_op_iter *ptr)
/* Initialize the iterator PTR to the virtual defs in STMT. */
static inline void
-op_iter_init (ssa_op_iter *ptr, tree stmt, int flags)
+op_iter_init (ssa_op_iter *ptr, gimple stmt, int flags)
{
-#ifdef ENABLE_CHECKING
- gcc_assert (stmt_ann (stmt));
-#endif
-
- ptr->defs = (flags & SSA_OP_DEF) ? DEF_OPS (stmt) : NULL;
- ptr->uses = (flags & SSA_OP_USE) ? USE_OPS (stmt) : NULL;
- ptr->vuses = (flags & SSA_OP_VUSE) ? VUSE_OPS (stmt) : NULL;
- ptr->vdefs = (flags & SSA_OP_VDEF) ? VDEF_OPS (stmt) : NULL;
- ptr->mayuses = (flags & SSA_OP_VMAYUSE) ? VDEF_OPS (stmt) : NULL;
+ ptr->defs = (flags & SSA_OP_DEF) ? gimple_def_ops (stmt) : NULL;
+ ptr->uses = (flags & SSA_OP_USE) ? gimple_use_ops (stmt) : NULL;
+ ptr->vuses = (flags & SSA_OP_VUSE) ? gimple_vuse_ops (stmt) : NULL;
+ ptr->vdefs = (flags & SSA_OP_VDEF) ? gimple_vdef_ops (stmt) : NULL;
+ ptr->mayuses = (flags & SSA_OP_VMAYUSE) ? gimple_vdef_ops (stmt) : NULL;
ptr->done = false;
ptr->phi_i = 0;
ptr->num_phi = 0;
- ptr->phi_stmt = NULL_TREE;
+ ptr->phi_stmt = NULL;
ptr->vuse_index = 0;
ptr->mayuse_index = 0;
}
@@ -1114,7 +892,7 @@ op_iter_init (ssa_op_iter *ptr, tree stmt, int flags)
/* Initialize iterator PTR to the use operands in STMT based on FLAGS. Return
the first use. */
static inline use_operand_p
-op_iter_init_use (ssa_op_iter *ptr, tree stmt, int flags)
+op_iter_init_use (ssa_op_iter *ptr, gimple stmt, int flags)
{
gcc_assert ((flags & SSA_OP_ALL_DEFS) == 0);
op_iter_init (ptr, stmt, flags);
@@ -1125,7 +903,7 @@ op_iter_init_use (ssa_op_iter *ptr, tree stmt, int flags)
/* Initialize iterator PTR to the def operands in STMT based on FLAGS. Return
the first def. */
static inline def_operand_p
-op_iter_init_def (ssa_op_iter *ptr, tree stmt, int flags)
+op_iter_init_def (ssa_op_iter *ptr, gimple stmt, int flags)
{
gcc_assert ((flags & SSA_OP_ALL_USES) == 0);
op_iter_init (ptr, stmt, flags);
@@ -1136,7 +914,7 @@ op_iter_init_def (ssa_op_iter *ptr, tree stmt, int flags)
/* Initialize iterator PTR to the operands in STMT based on FLAGS. Return
the first operand as a tree. */
static inline tree
-op_iter_init_tree (ssa_op_iter *ptr, tree stmt, int flags)
+op_iter_init_tree (ssa_op_iter *ptr, gimple stmt, int flags)
{
op_iter_init (ptr, stmt, flags);
ptr->iter_type = ssa_op_iter_tree;
@@ -1185,10 +963,10 @@ op_iter_next_mustdef (use_operand_p *use, def_operand_p *def,
/* Initialize iterator PTR to the operands in STMT. Return the first operands
in USE and DEF. */
static inline void
-op_iter_init_vdef (ssa_op_iter *ptr, tree stmt, vuse_vec_p *use,
+op_iter_init_vdef (ssa_op_iter *ptr, gimple stmt, vuse_vec_p *use,
def_operand_p *def)
{
- gcc_assert (TREE_CODE (stmt) != PHI_NODE);
+ gcc_assert (gimple_code (stmt) != GIMPLE_PHI);
op_iter_init (ptr, stmt, SSA_OP_VMAYUSE);
ptr->iter_type = ssa_op_iter_vdef;
@@ -1199,7 +977,7 @@ op_iter_init_vdef (ssa_op_iter *ptr, tree stmt, vuse_vec_p *use,
/* If there is a single operand in STMT matching FLAGS, return it. Otherwise
return NULL. */
static inline tree
-single_ssa_tree_operand (tree stmt, int flags)
+single_ssa_tree_operand (gimple stmt, int flags)
{
tree var;
ssa_op_iter iter;
@@ -1217,7 +995,7 @@ single_ssa_tree_operand (tree stmt, int flags)
/* If there is a single operand in STMT matching FLAGS, return it. Otherwise
return NULL. */
static inline use_operand_p
-single_ssa_use_operand (tree stmt, int flags)
+single_ssa_use_operand (gimple stmt, int flags)
{
use_operand_p var;
ssa_op_iter iter;
@@ -1236,7 +1014,7 @@ single_ssa_use_operand (tree stmt, int flags)
/* If there is a single operand in STMT matching FLAGS, return it. Otherwise
return NULL. */
static inline def_operand_p
-single_ssa_def_operand (tree stmt, int flags)
+single_ssa_def_operand (gimple stmt, int flags)
{
def_operand_p var;
ssa_op_iter iter;
@@ -1254,7 +1032,7 @@ single_ssa_def_operand (tree stmt, int flags)
/* Return true if there are zero operands in STMT matching the type
given in FLAGS. */
static inline bool
-zero_ssa_operands (tree stmt, int flags)
+zero_ssa_operands (gimple stmt, int flags)
{
ssa_op_iter iter;
@@ -1265,7 +1043,7 @@ zero_ssa_operands (tree stmt, int flags)
/* Return the number of operands matching FLAGS in STMT. */
static inline int
-num_ssa_operands (tree stmt, int flags)
+num_ssa_operands (gimple stmt, int flags)
{
ssa_op_iter iter;
tree t;
@@ -1279,7 +1057,7 @@ num_ssa_operands (tree stmt, int flags)
/* Delink all immediate_use information for STMT. */
static inline void
-delink_stmt_imm_use (tree stmt)
+delink_stmt_imm_use (gimple stmt)
{
ssa_op_iter iter;
use_operand_p use_p;
@@ -1293,7 +1071,7 @@ delink_stmt_imm_use (tree stmt)
/* This routine will compare all the operands matching FLAGS in STMT1 to those
in STMT2. TRUE is returned if they are the same. STMTs can be NULL. */
static inline bool
-compare_ssa_operands_equal (tree stmt1, tree stmt2, int flags)
+compare_ssa_operands_equal (gimple stmt1, gimple stmt2, int flags)
{
ssa_op_iter iter1, iter2;
tree op1 = NULL_TREE;
@@ -1303,8 +1081,8 @@ compare_ssa_operands_equal (tree stmt1, tree stmt2, int flags)
if (stmt1 == stmt2)
return true;
- look1 = stmt1 && stmt_ann (stmt1);
- look2 = stmt2 && stmt_ann (stmt2);
+ look1 = stmt1 != NULL;
+ look2 = stmt2 != NULL;
if (look1)
{
@@ -1339,7 +1117,7 @@ compare_ssa_operands_equal (tree stmt1, tree stmt2, int flags)
/* If there is a single DEF in the PHI node which matches FLAG, return it.
Otherwise return NULL_DEF_OPERAND_P. */
static inline tree
-single_phi_def (tree stmt, int flags)
+single_phi_def (gimple stmt, int flags)
{
tree def = PHI_RESULT (stmt);
if ((flags & SSA_OP_DEF) && is_gimple_reg (def))
@@ -1352,9 +1130,9 @@ single_phi_def (tree stmt, int flags)
/* Initialize the iterator PTR for uses matching FLAGS in PHI. FLAGS should
be either SSA_OP_USES or SSA_OP_VIRTUAL_USES. */
static inline use_operand_p
-op_iter_init_phiuse (ssa_op_iter *ptr, tree phi, int flags)
+op_iter_init_phiuse (ssa_op_iter *ptr, gimple phi, int flags)
{
- tree phi_def = PHI_RESULT (phi);
+ tree phi_def = gimple_phi_result (phi);
int comp;
clear_and_done_ssa_iter (ptr);
@@ -1372,7 +1150,7 @@ op_iter_init_phiuse (ssa_op_iter *ptr, tree phi, int flags)
}
ptr->phi_stmt = phi;
- ptr->num_phi = PHI_NUM_ARGS (phi);
+ ptr->num_phi = gimple_phi_num_args (phi);
ptr->iter_type = ssa_op_iter_use;
return op_iter_next_use (ptr);
}
@@ -1381,7 +1159,7 @@ op_iter_init_phiuse (ssa_op_iter *ptr, tree phi, int flags)
/* Start an iterator for a PHI definition. */
static inline def_operand_p
-op_iter_init_phidef (ssa_op_iter *ptr, tree phi, int flags)
+op_iter_init_phidef (ssa_op_iter *ptr, gimple phi, int flags)
{
tree phi_def = PHI_RESULT (phi);
int comp;
@@ -1461,7 +1239,7 @@ link_use_stmts_after (use_operand_p head, imm_use_iterator *imm)
{
use_operand_p use_p;
use_operand_p last_p = head;
- tree head_stmt = USE_STMT (head);
+ gimple head_stmt = USE_STMT (head);
tree use = USE_FROM_PTR (head);
ssa_op_iter op_iter;
int flag;
@@ -1469,7 +1247,7 @@ link_use_stmts_after (use_operand_p head, imm_use_iterator *imm)
/* Only look at virtual or real uses, depending on the type of HEAD. */
flag = (is_gimple_reg (use) ? SSA_OP_USE : SSA_OP_VIRTUAL_USES);
- if (TREE_CODE (head_stmt) == PHI_NODE)
+ if (gimple_code (head_stmt) == GIMPLE_PHI)
{
FOR_EACH_PHI_ARG (use_p, head_stmt, op_iter, flag)
if (USE_FROM_PTR (use_p) == use)
@@ -1488,7 +1266,7 @@ link_use_stmts_after (use_operand_p head, imm_use_iterator *imm)
}
/* Initialize IMM to traverse over uses of VAR. Return the first statement. */
-static inline tree
+static inline gimple
first_imm_use_stmt (imm_use_iterator *imm, tree var)
{
gcc_assert (TREE_CODE (var) == SSA_NAME);
@@ -1502,11 +1280,11 @@ first_imm_use_stmt (imm_use_iterator *imm, tree var)
stmt and use, which indicates a marker node. */
imm->iter_node.prev = NULL_USE_OPERAND_P;
imm->iter_node.next = NULL_USE_OPERAND_P;
- imm->iter_node.stmt = NULL_TREE;
+ imm->iter_node.loc.stmt = NULL;
imm->iter_node.use = NULL_USE_OPERAND_P;
if (end_imm_use_stmt_p (imm))
- return NULL_TREE;
+ return NULL;
link_use_stmts_after (imm->imm_use, imm);
@@ -1515,7 +1293,7 @@ first_imm_use_stmt (imm_use_iterator *imm, tree var)
/* Bump IMM to the next stmt which has a use of var. */
-static inline tree
+static inline gimple
next_imm_use_stmt (imm_use_iterator *imm)
{
imm->imm_use = imm->iter_node.next;
@@ -1523,7 +1301,7 @@ next_imm_use_stmt (imm_use_iterator *imm)
{
if (imm->iter_node.prev != NULL)
delink_imm_use (&imm->iter_node);
- return NULL_TREE;
+ return NULL;
}
link_use_stmts_after (imm->imm_use, imm);
@@ -1694,7 +1472,7 @@ redirect_edge_var_map_result (edge_var_map *v)
in function cfun. */
static inline tree
-make_ssa_name (tree var, tree stmt)
+make_ssa_name (tree var, gimple stmt)
{
return make_ssa_name_fn (cfun, var, stmt);
}
diff --git a/gcc/tree-flow.h b/gcc/tree-flow.h
index a441893e004..1e94037f737 100644
--- a/gcc/tree-flow.h
+++ b/gcc/tree-flow.h
@@ -26,7 +26,7 @@ along with GCC; see the file COPYING3. If not see
#include "hard-reg-set.h"
#include "basic-block.h"
#include "hashtab.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "tree-ssa-operands.h"
#include "cgraph.h"
#include "ipa-reference.h"
@@ -141,12 +141,12 @@ struct gimple_df GTY(())
/* Array of all variables referenced in the function. */
htab_t GTY((param_is (union tree_node))) referenced_vars;
- /* A list of all the noreturn calls passed to modify_stmt.
+ /* A vector of all the noreturn calls passed to modify_stmt.
cleanup_control_flow uses it to detect cases where a mid-block
indirect call has been turned into a noreturn call. When this
happens, all the instructions after the call are no longer
reachable and must be deleted as dead. */
- VEC(tree,gc) *modified_noreturn_calls;
+ VEC(gimple,gc) *modified_noreturn_calls;
/* Array of all SSA_NAMEs used in the function. */
VEC(tree,gc) *ssa_names;
@@ -268,19 +268,27 @@ struct ptr_info_def GTY(())
/*---------------------------------------------------------------------------
Tree annotations stored in tree_base.ann
---------------------------------------------------------------------------*/
-enum tree_ann_type { TREE_ANN_COMMON, VAR_ANN, FUNCTION_ANN, STMT_ANN };
+enum tree_ann_type { TREE_ANN_COMMON, VAR_ANN, FUNCTION_ANN };
struct tree_ann_common_d GTY(())
{
/* Annotation type. */
enum tree_ann_type type;
- /* Auxiliary info specific to a pass. At all times, this
- should either point to valid data or be NULL. */
+ /* Record EH region number into a statement tree created during RTL
+ expansion (see gimple_to_tree). */
+ int rn;
+
+ /* Auxiliary info specific to a pass. At all times, this
+ should either point to valid data or be NULL. */
PTR GTY ((skip (""))) aux;
/* The value handle for this expression. Used by GVN-PRE. */
tree GTY((skip)) value_handle;
+
+ /* Pointer to original GIMPLE statement. Used during RTL expansion
+ (see gimple_to_tree). */
+ gimple stmt;
};
/* It is advantageous to avoid things like life analysis for variables which
@@ -417,6 +425,42 @@ struct function_ann_d GTY(())
ipa_reference_vars_info_t GTY ((skip)) reference_vars_info;
};
+
+/* Immediate use lists are used to directly access all uses for an SSA
+ name and get pointers to the statement for each use.
+
+ The structure ssa_use_operand_d consists of PREV and NEXT pointers
+ to maintain the list. A USE pointer, which points to address where
+ the use is located and a LOC pointer which can point to the
+ statement where the use is located, or, in the case of the root
+ node, it points to the SSA name itself.
+
+ The list is anchored by an occurrence of ssa_operand_d *in* the
+ ssa_name node itself (named 'imm_uses'). This node is uniquely
+ identified by having a NULL USE pointer. and the LOC pointer
+ pointing back to the ssa_name node itself. This node forms the
+ base for a circular list, and initially this is the only node in
+ the list.
+
+ Fast iteration allows each use to be examined, but does not allow
+ any modifications to the uses or stmts.
+
+ Normal iteration allows insertion, deletion, and modification. the
+ iterator manages this by inserting a marker node into the list
+ immediately before the node currently being examined in the list.
+ this marker node is uniquely identified by having null stmt *and* a
+ null use pointer.
+
+ When iterating to the next use, the iteration routines check to see
+ if the node after the marker has changed. if it has, then the node
+ following the marker is now the next one to be visited. if not, the
+ marker node is moved past that node in the list (visualize it as
+ bumping the marker node through the list). this continues until
+ the marker node is moved to the original anchor position. the
+ marker node is then removed from the list.
+
+ If iteration is halted early, the marker node must be removed from
+ the list before continuing. */
typedef struct immediate_use_iterator_d
{
/* This is the current use the iterator is processing. */
@@ -476,50 +520,16 @@ typedef struct immediate_use_iterator_d
-struct stmt_ann_d GTY(())
-{
- struct tree_ann_common_d common;
-
- /* Basic block that contains this statement. */
- basic_block bb;
-
- /* Operand cache for stmt. */
- struct stmt_operands_d GTY ((skip (""))) operands;
-
- /* Set of variables that have had their address taken in the statement. */
- bitmap addresses_taken;
-
- /* Unique identifier for this statement. These ID's are to be
- created by each pass on an as-needed basis in any order
- convenient for the pass which needs statement UIDs. This field
- should only be accessed thru set_gimple_stmt_uid and
- gimple_stmt_uid functions. */
- unsigned int uid;
-
- /* Nonzero if the statement references memory (at least one of its
- expressions contains a non-register operand). */
- unsigned references_memory : 1;
-
- /* Nonzero if the statement has been modified (meaning that the operands
- need to be scanned again). */
- unsigned modified : 1;
-
- /* Nonzero if the statement makes references to volatile storage. */
- unsigned has_volatile_ops : 1;
-};
-
union tree_ann_d GTY((desc ("ann_type ((tree_ann_t)&%h)")))
{
struct tree_ann_common_d GTY((tag ("TREE_ANN_COMMON"))) common;
struct var_ann_d GTY((tag ("VAR_ANN"))) vdecl;
struct function_ann_d GTY((tag ("FUNCTION_ANN"))) fdecl;
- struct stmt_ann_d GTY((tag ("STMT_ANN"))) stmt;
};
typedef union tree_ann_d *tree_ann_t;
typedef struct var_ann_d *var_ann_t;
typedef struct function_ann_d *function_ann_t;
-typedef struct stmt_ann_d *stmt_ann_t;
typedef struct tree_ann_common_d *tree_ann_common_t;
static inline tree_ann_common_t tree_common_ann (const_tree);
@@ -528,18 +538,10 @@ static inline var_ann_t var_ann (const_tree);
static inline var_ann_t get_var_ann (tree);
static inline function_ann_t function_ann (const_tree);
static inline function_ann_t get_function_ann (tree);
-static inline stmt_ann_t stmt_ann (tree);
-static inline bool has_stmt_ann (tree);
-static inline stmt_ann_t get_stmt_ann (tree);
static inline enum tree_ann_type ann_type (tree_ann_t);
-static inline basic_block bb_for_stmt (tree);
-extern void set_bb_for_stmt (tree, basic_block);
-static inline bool noreturn_call_p (tree);
-static inline void update_stmt (tree);
-static inline bool stmt_modified_p (tree);
+static inline void update_stmt (gimple);
static inline bitmap may_aliases (const_tree);
-static inline int get_lineno (const_tree);
-static inline bitmap addresses_taken (tree);
+static inline int get_lineno (const_gimple);
/*---------------------------------------------------------------------------
Structure representing predictions in tree level.
@@ -553,8 +555,8 @@ struct edge_prediction GTY((chain_next ("%h.ep_next")))
};
/* Accessors for basic block annotations. */
-static inline tree phi_nodes (const_basic_block);
-static inline void set_phi_nodes (basic_block, tree);
+static inline gimple_seq phi_nodes (const_basic_block);
+static inline void set_phi_nodes (basic_block, gimple_seq);
/*---------------------------------------------------------------------------
Global declarations
@@ -627,48 +629,6 @@ extern bool referenced_var_check_and_insert (tree);
#define PERCENT(x,y) ((float)(x) * 100.0 / (float)(y))
/*---------------------------------------------------------------------------
- Block iterators
----------------------------------------------------------------------------*/
-
-typedef struct {
- tree_stmt_iterator tsi;
- basic_block bb;
-} block_stmt_iterator;
-
-static inline block_stmt_iterator bsi_start (basic_block);
-static inline block_stmt_iterator bsi_last (basic_block);
-static inline block_stmt_iterator bsi_after_labels (basic_block);
-block_stmt_iterator bsi_for_stmt (tree);
-static inline bool bsi_end_p (block_stmt_iterator);
-static inline void bsi_next (block_stmt_iterator *);
-static inline void bsi_prev (block_stmt_iterator *);
-static inline tree bsi_stmt (block_stmt_iterator);
-static inline tree * bsi_stmt_ptr (block_stmt_iterator);
-
-extern void bsi_remove (block_stmt_iterator *, bool);
-extern void bsi_move_before (block_stmt_iterator *, block_stmt_iterator *);
-extern void bsi_move_after (block_stmt_iterator *, block_stmt_iterator *);
-extern void bsi_move_to_bb_end (block_stmt_iterator *, basic_block);
-
-enum bsi_iterator_update
-{
- /* Note that these are intentionally in the same order as TSI_FOO. They
- mean exactly the same as their TSI_* counterparts. */
- BSI_NEW_STMT,
- BSI_SAME_STMT,
- BSI_CHAIN_START,
- BSI_CHAIN_END,
- BSI_CONTINUE_LINKING
-};
-
-extern void bsi_insert_before (block_stmt_iterator *, tree,
- enum bsi_iterator_update);
-extern void bsi_insert_after (block_stmt_iterator *, tree,
- enum bsi_iterator_update);
-
-extern void bsi_replace (const block_stmt_iterator *, tree, bool);
-
-/*---------------------------------------------------------------------------
OpenMP Region Tree
---------------------------------------------------------------------------*/
@@ -702,7 +662,7 @@ struct omp_region
tree ws_args;
/* The code for the omp directive of this region. */
- enum tree_code type;
+ enum gimple_code type;
/* Schedule kind, only used for OMP_FOR type regions. */
enum omp_clause_schedule_kind sched_kind;
@@ -712,7 +672,7 @@ struct omp_region
};
extern struct omp_region *root_omp_region;
-extern struct omp_region *new_omp_region (basic_block, enum tree_code,
+extern struct omp_region *new_omp_region (basic_block, enum gimple_code,
struct omp_region *);
extern void free_omp_regions (void);
void omp_expand_local (basic_block);
@@ -725,20 +685,20 @@ tree copy_var_decl (tree, tree, tree);
/* In tree-cfg.c */
/* Location to track pending stmt for edge insertion. */
-#define PENDING_STMT(e) ((e)->insns.t)
+#define PENDING_STMT(e) ((e)->insns.g)
extern void delete_tree_cfg_annotations (void);
-extern bool stmt_ends_bb_p (const_tree);
-extern bool is_ctrl_stmt (const_tree);
-extern bool is_ctrl_altering_stmt (const_tree);
-extern bool simple_goto_p (const_tree);
-extern bool tree_can_make_abnormal_goto (const_tree);
+extern bool stmt_ends_bb_p (gimple);
+extern bool is_ctrl_stmt (gimple);
+extern bool is_ctrl_altering_stmt (gimple);
+extern bool simple_goto_p (gimple);
+extern bool stmt_can_make_abnormal_goto (gimple);
extern basic_block single_noncomplex_succ (basic_block bb);
-extern void tree_dump_bb (basic_block, FILE *, int);
-extern void debug_tree_bb (basic_block);
-extern basic_block debug_tree_bb_n (int);
-extern void dump_tree_cfg (FILE *, int);
-extern void debug_tree_cfg (int);
+extern void gimple_dump_bb (basic_block, FILE *, int, int);
+extern void gimple_debug_bb (basic_block);
+extern basic_block gimple_debug_bb_n (int);
+extern void gimple_dump_cfg (FILE *, int);
+extern void gimple_debug_cfg (int);
extern void dump_cfg_stats (FILE *);
extern void dot_cfg (void);
extern void debug_cfg_stats (void);
@@ -749,40 +709,35 @@ extern void print_loops (FILE *, int);
extern void print_loops_bb (FILE *, basic_block, int, int);
extern void cleanup_dead_labels (void);
extern void group_case_labels (void);
-extern tree first_stmt (basic_block);
-extern tree last_stmt (basic_block);
-extern tree last_and_only_stmt (basic_block);
+extern gimple first_stmt (basic_block);
+extern gimple last_stmt (basic_block);
+extern gimple last_and_only_stmt (basic_block);
extern edge find_taken_edge (basic_block, tree);
extern basic_block label_to_block_fn (struct function *, tree);
#define label_to_block(t) (label_to_block_fn (cfun, t))
-extern void bsi_insert_on_edge (edge, tree);
-extern basic_block bsi_insert_on_edge_immediate (edge, tree);
-extern void bsi_commit_one_edge_insert (edge, basic_block *);
-extern void bsi_commit_edge_inserts (void);
-extern void notice_special_calls (tree);
+extern void notice_special_calls (gimple);
extern void clear_special_calls (void);
extern void verify_stmts (void);
extern void verify_gimple (void);
-extern void verify_gimple_1 (tree);
-extern tree tree_block_label (basic_block);
+extern void verify_types_in_gimple_seq (gimple_seq);
+extern tree gimple_block_label (basic_block);
extern void extract_true_false_edges_from_block (basic_block, edge *, edge *);
-extern bool tree_duplicate_sese_region (edge, edge, basic_block *, unsigned,
+extern bool gimple_duplicate_sese_region (edge, edge, basic_block *, unsigned,
basic_block *);
-extern bool tree_duplicate_sese_tail (edge, edge, basic_block *, unsigned,
+extern bool gimple_duplicate_sese_tail (edge, edge, basic_block *, unsigned,
basic_block *);
extern void gather_blocks_in_sese_region (basic_block entry, basic_block exit,
VEC(basic_block,heap) **bbs_p);
extern void add_phi_args_after_copy_bb (basic_block);
extern void add_phi_args_after_copy (basic_block *, unsigned, edge);
-extern bool tree_purge_dead_abnormal_call_edges (basic_block);
-extern bool tree_purge_dead_eh_edges (basic_block);
-extern bool tree_purge_all_dead_eh_edges (const_bitmap);
-extern tree gimplify_val (block_stmt_iterator *, tree, tree);
-extern tree gimplify_build1 (block_stmt_iterator *, enum tree_code,
+extern bool gimple_purge_dead_abnormal_call_edges (basic_block);
+extern bool gimple_purge_dead_eh_edges (basic_block);
+extern bool gimple_purge_all_dead_eh_edges (const_bitmap);
+extern tree gimplify_build1 (gimple_stmt_iterator *, enum tree_code,
tree, tree);
-extern tree gimplify_build2 (block_stmt_iterator *, enum tree_code,
+extern tree gimplify_build2 (gimple_stmt_iterator *, enum tree_code,
tree, tree, tree);
-extern tree gimplify_build3 (block_stmt_iterator *, enum tree_code,
+extern tree gimplify_build3 (gimple_stmt_iterator *, enum tree_code,
tree, tree, tree, tree);
extern void init_empty_tree_cfg (void);
extern void init_empty_tree_cfg_for_function (struct function *);
@@ -807,7 +762,6 @@ extern const char *op_symbol_code (enum tree_code);
/* In tree-dfa.c */
extern var_ann_t create_var_ann (tree);
extern function_ann_t create_function_ann (tree);
-extern stmt_ann_t create_stmt_ann (tree);
extern void renumber_gimple_stmt_uids (void);
extern tree_ann_common_t create_tree_common_ann (tree);
extern void dump_dfa_stats (FILE *);
@@ -819,27 +773,26 @@ extern void debug_variable (tree);
extern tree get_virtual_var (tree);
extern void add_referenced_var (tree);
extern void remove_referenced_var (tree);
-extern void mark_symbols_for_renaming (tree);
-extern void find_new_referenced_vars (tree *);
+extern void mark_symbols_for_renaming (gimple);
+extern void find_new_referenced_vars (gimple);
extern tree make_rename_temp (tree, const char *);
extern void set_default_def (tree, tree);
extern tree gimple_default_def (struct function *, tree);
-extern bool stmt_references_abnormal_ssa_name (tree);
+extern bool stmt_references_abnormal_ssa_name (gimple);
extern bool refs_may_alias_p (tree, tree);
-extern tree get_single_def_stmt (tree);
-extern tree get_single_def_stmt_from_phi (tree, tree);
-extern tree get_single_def_stmt_with_phi (tree, tree);
+extern gimple get_single_def_stmt (gimple);
+extern gimple get_single_def_stmt_from_phi (tree, gimple);
+extern gimple get_single_def_stmt_with_phi (tree, gimple);
/* In tree-phinodes.c */
extern void reserve_phi_args_for_new_edge (basic_block);
-extern tree create_phi_node (tree, basic_block);
-extern void add_phi_arg (tree, tree, edge);
+extern gimple create_phi_node (tree, basic_block);
+extern void add_phi_arg (gimple, tree, edge);
extern void remove_phi_args (edge);
-extern void remove_phi_node (tree, tree, bool);
-extern tree phi_reverse (tree);
+extern void remove_phi_node (gimple_stmt_iterator *, bool);
extern void init_phinodes (void);
extern void fini_phinodes (void);
-extern void release_phi_node (tree);
+extern void release_phi_node (gimple);
#ifdef GATHER_STATISTICS
extern void phinodes_print_statistics (void);
#endif
@@ -848,6 +801,8 @@ extern void phinodes_print_statistics (void);
extern void record_vars_into (tree, tree);
extern void record_vars (tree);
extern bool block_may_fallthru (const_tree);
+extern bool gimple_seq_may_fallthru (gimple_seq);
+extern bool gimple_stmt_may_fallthru (gimple);
/* In tree-ssa-alias.c */
extern unsigned int compute_may_aliases (void);
@@ -864,7 +819,7 @@ extern bool may_alias_p (tree, alias_set_type, tree, alias_set_type, bool);
extern struct ptr_info_def *get_ptr_info (tree);
extern bool may_point_to_global_var (tree);
extern void new_type_alias (tree, tree, tree);
-extern void count_uses_and_derefs (tree, tree, unsigned *, unsigned *,
+extern void count_uses_and_derefs (tree, gimple, unsigned *, unsigned *,
unsigned *);
static inline bool ref_contains_array_ref (const_tree);
static inline bool array_ref_contains_indirect_ref (const_tree);
@@ -881,7 +836,7 @@ extern void debug_all_mem_sym_stats (void);
/* Call-back function for walk_use_def_chains(). At each reaching
definition, a function with this prototype is called. */
-typedef bool (*walk_use_def_chains_fn) (tree, tree, void *);
+typedef bool (*walk_use_def_chains_fn) (tree, gimple, void *);
/* In tree-ssa-alias-warnings.c */
extern void strict_aliasing_warning_backend (void);
@@ -912,13 +867,9 @@ extern void redirect_edge_var_map_destroy (void);
extern edge ssa_redirect_edge (edge, basic_block);
extern void flush_pending_stmts (edge);
-extern bool tree_ssa_useless_type_conversion (tree);
-extern bool useless_type_conversion_p (tree, tree);
-extern bool types_compatible_p (tree, tree);
extern void verify_ssa (bool);
extern void delete_tree_ssa (void);
extern void walk_use_def_chains (tree, walk_use_def_chains_fn, void *, bool);
-extern bool stmt_references_memory_p (tree);
extern bool ssa_undefined_value_p (tree);
@@ -926,14 +877,13 @@ extern bool ssa_undefined_value_p (tree);
void update_ssa (unsigned);
void delete_update_ssa (void);
void register_new_name_mapping (tree, tree);
-tree create_new_def_for (tree, tree, def_operand_p);
+tree create_new_def_for (tree, gimple, def_operand_p);
bool need_ssa_update_p (void);
bool name_mappings_registered_p (void);
bool name_registered_for_update_p (tree);
bitmap ssa_names_to_replace (void);
void release_ssa_name_after_update_ssa (tree);
void compute_global_livein (bitmap, bitmap);
-tree duplicate_ssa_name (tree, tree);
void mark_sym_for_renaming (tree);
void mark_set_for_renaming (bitmap);
tree get_current_def (tree);
@@ -942,11 +892,11 @@ void set_current_def (tree, tree);
/* In tree-ssanames.c */
extern void init_ssanames (struct function *, int);
extern void fini_ssanames (void);
-extern tree make_ssa_name_fn (struct function *, tree, tree);
-extern tree duplicate_ssa_name (tree, tree);
+extern tree make_ssa_name_fn (struct function *, tree, gimple);
+extern tree duplicate_ssa_name (tree, gimple);
extern void duplicate_ssa_name_ptr_info (tree, struct ptr_info_def *);
extern void release_ssa_name (tree);
-extern void release_defs (tree);
+extern void release_defs (gimple);
extern void replace_ssa_name_symbol (tree, tree);
#ifdef GATHER_STATISTICS
@@ -954,14 +904,14 @@ extern void ssanames_print_statistics (void);
#endif
/* In tree-ssa-ccp.c */
-bool fold_stmt (tree *);
-bool fold_stmt_inplace (tree);
+bool fold_stmt (gimple_stmt_iterator *);
+bool fold_stmt_inplace (gimple);
tree get_symbol_constant_value (tree);
tree fold_const_aggregate_ref (tree);
/* In tree-vrp.c */
-tree vrp_evaluate_conditional (enum tree_code, tree, tree, tree);
-void simplify_stmt_using_ranges (tree);
+tree vrp_evaluate_conditional (enum tree_code, tree, tree, gimple);
+void simplify_stmt_using_ranges (gimple);
/* In tree-ssa-dom.c */
extern void dump_dominator_optimization_stats (FILE *);
@@ -972,8 +922,10 @@ int loop_depth_of_name (tree);
extern void merge_alias_info (tree, tree);
extern void propagate_value (use_operand_p, tree);
extern void propagate_tree_value (tree *, tree);
+extern void propagate_tree_value_into_stmt (gimple_stmt_iterator *, tree);
extern void replace_exp (use_operand_p, tree);
extern bool may_propagate_copy (tree, tree);
+extern bool may_propagate_copy_into_stmt (gimple, tree);
extern bool may_propagate_copy_into_asm (tree);
/* Affine iv. */
@@ -1046,8 +998,8 @@ tree find_loop_niter (struct loop *, edge *);
tree loop_niter_by_eval (struct loop *, edge);
tree find_loop_niter_by_eval (struct loop *, edge *);
void estimate_numbers_of_iterations (void);
-bool scev_probably_wraps_p (tree, tree, tree, struct loop *, bool);
-bool convert_affine_scev (struct loop *, tree, tree *, tree *, tree, bool);
+bool scev_probably_wraps_p (tree, tree, gimple, struct loop *, bool);
+bool convert_affine_scev (struct loop *, tree, tree *, tree *, gimple, bool);
bool nowrap_type_p (tree);
enum ev_direction {EV_DIR_GROWS, EV_DIR_DECREASES, EV_DIR_UNKNOWN};
@@ -1058,14 +1010,14 @@ void free_numbers_of_iterations_estimates_loop (struct loop *);
void rewrite_into_loop_closed_ssa (bitmap, unsigned);
void verify_loop_closed_ssa (void);
bool for_each_index (tree *, bool (*) (tree, tree *, void *), void *);
-void create_iv (tree, tree, tree, struct loop *, block_stmt_iterator *, bool,
+void create_iv (tree, tree, tree, struct loop *, gimple_stmt_iterator *, bool,
tree *, tree *);
basic_block split_loop_exit_edge (edge);
-void standard_iv_increment_position (struct loop *, block_stmt_iterator *,
+void standard_iv_increment_position (struct loop *, gimple_stmt_iterator *,
bool *);
basic_block ip_end_pos (struct loop *);
basic_block ip_normal_pos (struct loop *);
-bool tree_duplicate_loop_to_header_edge (struct loop *, edge,
+bool gimple_duplicate_loop_to_header_edge (struct loop *, edge,
unsigned int, sbitmap,
edge, VEC (edge, heap) **,
int);
@@ -1085,13 +1037,13 @@ void tree_transform_and_unroll_loop (struct loop *, unsigned,
edge, struct tree_niter_desc *,
transform_callback, void *);
bool contains_abnormal_ssa_name_p (tree);
-bool stmt_dominates_stmt_p (tree, tree);
-void mark_virtual_ops_for_renaming (tree);
+bool stmt_dominates_stmt_p (gimple, gimple);
+void mark_virtual_ops_for_renaming (gimple);
/* In tree-ssa-threadedge.c */
extern bool potentially_threadable_block (basic_block);
-extern void thread_across_edge (tree, edge, bool,
- VEC(tree, heap) **, tree (*) (tree, tree));
+extern void thread_across_edge (gimple, edge, bool,
+ VEC(tree, heap) **, tree (*) (gimple, gimple));
/* In tree-ssa-loop-im.c */
/* The possibilities of statement movement. */
@@ -1103,7 +1055,7 @@ enum move_pos
become executed -- memory accesses, ... */
MOVE_POSSIBLE /* Unlimited movement. */
};
-extern enum move_pos movement_possibility (tree);
+extern enum move_pos movement_possibility (gimple);
char *get_lsm_tmp_name (tree, unsigned);
/* In tree-flow-inline.h */
@@ -1113,15 +1065,22 @@ static inline void set_is_used (tree);
static inline bool unmodifiable_var_p (const_tree);
/* In tree-eh.c */
-extern void make_eh_edges (tree);
+extern void make_eh_edges (gimple);
extern bool tree_could_trap_p (tree);
+extern bool operation_could_trap_p (enum tree_code, bool, bool, tree);
+extern bool stmt_could_throw_p (gimple);
extern bool tree_could_throw_p (tree);
-extern bool tree_can_throw_internal (const_tree);
-extern bool tree_can_throw_external (tree);
-extern int lookup_stmt_eh_region (const_tree);
-extern void add_stmt_to_eh_region (tree, int);
-extern bool remove_stmt_from_eh_region (tree);
-extern bool maybe_clean_or_replace_eh_stmt (tree, tree);
+extern bool stmt_can_throw_internal (gimple);
+extern void add_stmt_to_eh_region (gimple, int);
+extern bool remove_stmt_from_eh_region (gimple);
+extern bool maybe_clean_or_replace_eh_stmt (gimple, gimple);
+extern void add_stmt_to_eh_region_fn (struct function *, gimple, int);
+extern bool remove_stmt_from_eh_region_fn (struct function *, gimple);
+extern int lookup_stmt_eh_region_fn (struct function *, gimple);
+extern int lookup_expr_eh_region (tree);
+extern int lookup_stmt_eh_region (gimple);
+extern bool verify_eh_edges (gimple);
+
/* In tree-ssa-pre.c */
struct pre_expr_d;
@@ -1137,21 +1096,21 @@ bool expressions_equal_p (tree, tree);
void sort_vuses (VEC (tree, gc) *);
void sort_vuses_heap (VEC (tree, heap) *);
tree vn_lookup_or_add (tree);
-tree vn_lookup_or_add_with_stmt (tree, tree);
+tree vn_lookup_or_add_with_stmt (tree, gimple);
tree vn_lookup_or_add_with_vuses (tree, VEC (tree, gc) *);
void vn_add (tree, tree);
void vn_add_with_vuses (tree, tree, VEC (tree, gc) *);
-tree vn_lookup_with_stmt (tree, tree);
+tree vn_lookup_with_stmt (tree, gimple);
tree vn_lookup (tree);
tree vn_lookup_with_vuses (tree, VEC (tree, gc) *);
/* In tree-ssa-sink.c */
-bool is_hidden_global_store (tree);
+bool is_hidden_global_store (gimple);
/* In tree-sra.c */
-void insert_edge_copies (tree, basic_block);
-void sra_insert_before (block_stmt_iterator *, tree);
-void sra_insert_after (block_stmt_iterator *, tree);
+void insert_edge_copies_seq (gimple_seq, basic_block);
+void sra_insert_before (gimple_stmt_iterator *, gimple_seq);
+void sra_insert_after (gimple_stmt_iterator *, gimple_seq);
void sra_init_cache (void);
bool sra_type_can_be_decomposed_p (tree);
@@ -1163,6 +1122,7 @@ extern void tree_check_data_deps (void);
/* In tree-ssa-loop-ivopts.c */
bool expr_invariant_in_loop_p (struct loop *, tree);
+bool stmt_invariant_in_loop_p (struct loop *, gimple);
bool multiplier_allowed_in_address_p (HOST_WIDE_INT, enum machine_mode);
unsigned multiply_by_cost (HOST_WIDE_INT, enum machine_mode);
@@ -1171,9 +1131,9 @@ extern bool thread_through_all_blocks (bool);
extern void register_jump_thread (edge, edge);
/* In gimplify.c */
-tree force_gimple_operand (tree, tree *, bool, tree);
-tree force_gimple_operand_bsi (block_stmt_iterator *, tree, bool, tree,
- bool, enum bsi_iterator_update);
+tree force_gimple_operand (tree, gimple_seq *, bool, tree);
+tree force_gimple_operand_gsi (gimple_stmt_iterator *, tree, bool, tree,
+ bool, enum gsi_iterator_update);
tree gimple_fold_indirect_ref (tree);
/* In tree-ssa-structalias.c */
@@ -1194,7 +1154,7 @@ struct mem_address
};
struct affine_tree_combination;
-tree create_mem_ref (block_stmt_iterator *, tree,
+tree create_mem_ref (gimple_stmt_iterator *, tree,
struct affine_tree_combination *);
rtx addr_for_mem_ref (struct mem_address *, bool);
void get_address_description (tree, struct mem_address *);
@@ -1206,7 +1166,7 @@ unsigned int execute_fixup_cfg (void);
#include "tree-flow-inline.h"
-void swap_tree_operands (tree, tree *, tree *);
+void swap_tree_operands (gimple, tree *, tree *);
int least_common_multiple (int, int);
diff --git a/gcc/tree-gimple.c b/gcc/tree-gimple.c
deleted file mode 100644
index 8b05f93d505..00000000000
--- a/gcc/tree-gimple.c
+++ /dev/null
@@ -1,653 +0,0 @@
-/* Functions to analyze and validate GIMPLE trees.
- Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007
- Free Software Foundation, Inc.
- Contributed by Diego Novillo <dnovillo@redhat.com>
- Rewritten by Jason Merrill <jason@redhat.com>
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 3, or (at your option)
-any later version.
-
-GCC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GCC; see the file COPYING3. If not see
-<http://www.gnu.org/licenses/>. */
-
-#include "config.h"
-#include "system.h"
-#include "coretypes.h"
-#include "ggc.h"
-#include "tm.h"
-#include "tree.h"
-#include "tree-gimple.h"
-#include "tree-flow.h"
-#include "output.h"
-#include "rtl.h"
-#include "expr.h"
-#include "bitmap.h"
-
-/* For the definitive definition of GIMPLE, see doc/tree-ssa.texi. */
-
-/* Validation of GIMPLE expressions. */
-
-/* Return true if T is a GIMPLE RHS for an assignment to a temporary. */
-
-bool
-is_gimple_formal_tmp_rhs (tree t)
-{
- enum tree_code code = TREE_CODE (t);
-
- switch (TREE_CODE_CLASS (code))
- {
- case tcc_unary:
- case tcc_binary:
- case tcc_comparison:
- return true;
-
- default:
- break;
- }
-
- switch (code)
- {
- case TRUTH_NOT_EXPR:
- case TRUTH_AND_EXPR:
- case TRUTH_OR_EXPR:
- case TRUTH_XOR_EXPR:
- case COND_EXPR:
- case ADDR_EXPR:
- case CALL_EXPR:
- case CONSTRUCTOR:
- case COMPLEX_EXPR:
- case INTEGER_CST:
- case REAL_CST:
- case FIXED_CST:
- case STRING_CST:
- case COMPLEX_CST:
- case VECTOR_CST:
- case OBJ_TYPE_REF:
- case ASSERT_EXPR:
- return true;
-
- default:
- break;
- }
-
- return is_gimple_lvalue (t) || is_gimple_val (t);
-}
-
-/* Returns true iff T is a valid RHS for an assignment to a renamed
- user -- or front-end generated artificial -- variable. */
-
-bool
-is_gimple_reg_rhs (tree t)
-{
- /* If the RHS of the GIMPLE_MODIFY_STMT may throw or make a nonlocal goto
- and the LHS is a user variable, then we need to introduce a formal
- temporary. This way the optimizers can determine that the user
- variable is only modified if evaluation of the RHS does not throw.
-
- Don't force a temp of a non-renamable type; the copy could be
- arbitrarily expensive. Instead we will generate a VDEF for
- the assignment. */
-
- if (is_gimple_reg_type (TREE_TYPE (t))
- && ((TREE_CODE (t) == CALL_EXPR && TREE_SIDE_EFFECTS (t))
- || tree_could_throw_p (t)))
- return false;
-
- return is_gimple_formal_tmp_rhs (t);
-}
-
-/* Returns true iff T is a valid RHS for an assignment to an un-renamed
- LHS, or for a call argument. */
-
-bool
-is_gimple_mem_rhs (tree t)
-{
- /* If we're dealing with a renamable type, either source or dest must be
- a renamed variable. */
- if (is_gimple_reg_type (TREE_TYPE (t)))
- return is_gimple_val (t);
- else
- return is_gimple_formal_tmp_rhs (t);
-}
-
-/* Returns the appropriate RHS predicate for this LHS. */
-
-gimple_predicate
-rhs_predicate_for (tree lhs)
-{
- if (is_gimple_formal_tmp_var (lhs))
- return is_gimple_formal_tmp_rhs;
- else if (is_gimple_reg (lhs))
- return is_gimple_reg_rhs;
- else
- return is_gimple_mem_rhs;
-}
-
-/* Return true if T is a valid LHS for a GIMPLE assignment expression. */
-
-bool
-is_gimple_lvalue (tree t)
-{
- return (is_gimple_addressable (t)
- || TREE_CODE (t) == WITH_SIZE_EXPR
- /* These are complex lvalues, but don't have addresses, so they
- go here. */
- || TREE_CODE (t) == BIT_FIELD_REF);
-}
-
-/* Return true if T is a GIMPLE condition. */
-
-bool
-is_gimple_condexpr (tree t)
-{
- return (is_gimple_val (t) || (COMPARISON_CLASS_P (t)
- && !tree_could_trap_p (t)
- && is_gimple_val (TREE_OPERAND (t, 0))
- && is_gimple_val (TREE_OPERAND (t, 1))));
-}
-
-/* Return true if T is something whose address can be taken. */
-
-bool
-is_gimple_addressable (tree t)
-{
- return (is_gimple_id (t) || handled_component_p (t)
- || INDIRECT_REF_P (t));
-}
-
-/* Return true if T is a valid gimple constant. */
-
-bool
-is_gimple_constant (const_tree t)
-{
- switch (TREE_CODE (t))
- {
- case INTEGER_CST:
- case REAL_CST:
- case FIXED_CST:
- case STRING_CST:
- case COMPLEX_CST:
- case VECTOR_CST:
- return true;
-
- /* Vector constant constructors are gimple invariant. */
- case CONSTRUCTOR:
- if (TREE_TYPE (t) && TREE_CODE (TREE_TYPE (t)) == VECTOR_TYPE)
- return TREE_CONSTANT (t);
- else
- return false;
-
- default:
- return false;
- }
-}
-
-/* Return true if T is a gimple address. */
-
-bool
-is_gimple_address (const_tree t)
-{
- tree op;
-
- if (TREE_CODE (t) != ADDR_EXPR)
- return false;
-
- op = TREE_OPERAND (t, 0);
- while (handled_component_p (op))
- {
- if ((TREE_CODE (op) == ARRAY_REF
- || TREE_CODE (op) == ARRAY_RANGE_REF)
- && !is_gimple_val (TREE_OPERAND (op, 1)))
- return false;
-
- op = TREE_OPERAND (op, 0);
- }
-
- if (CONSTANT_CLASS_P (op) || INDIRECT_REF_P (op))
- return true;
-
- switch (TREE_CODE (op))
- {
- case PARM_DECL:
- case RESULT_DECL:
- case LABEL_DECL:
- case FUNCTION_DECL:
- case VAR_DECL:
- case CONST_DECL:
- return true;
-
- default:
- return false;
- }
-}
-
-/* Return true if T is a gimple invariant address. */
-
-bool
-is_gimple_invariant_address (const_tree t)
-{
- tree op;
-
- if (TREE_CODE (t) != ADDR_EXPR)
- return false;
-
- op = TREE_OPERAND (t, 0);
- while (handled_component_p (op))
- {
- switch (TREE_CODE (op))
- {
- case ARRAY_REF:
- case ARRAY_RANGE_REF:
- if (!is_gimple_constant (TREE_OPERAND (op, 1))
- || TREE_OPERAND (op, 2) != NULL_TREE
- || TREE_OPERAND (op, 3) != NULL_TREE)
- return false;
- break;
-
- case COMPONENT_REF:
- if (TREE_OPERAND (op, 2) != NULL_TREE)
- return false;
- break;
-
- default:;
- }
- op = TREE_OPERAND (op, 0);
- }
-
- return CONSTANT_CLASS_P (op) || decl_address_invariant_p (op);
-}
-
-/* Return true if T is a GIMPLE minimal invariant. It's a restricted
- form of function invariant. */
-
-bool
-is_gimple_min_invariant (const_tree t)
-{
- if (TREE_CODE (t) == ADDR_EXPR)
- return is_gimple_invariant_address (t);
-
- return is_gimple_constant (t);
-}
-
-/* Return true if T looks like a valid GIMPLE statement. */
-
-bool
-is_gimple_stmt (tree t)
-{
- const enum tree_code code = TREE_CODE (t);
-
- switch (code)
- {
- case NOP_EXPR:
- /* The only valid NOP_EXPR is the empty statement. */
- return IS_EMPTY_STMT (t);
-
- case BIND_EXPR:
- case COND_EXPR:
- /* These are only valid if they're void. */
- return TREE_TYPE (t) == NULL || VOID_TYPE_P (TREE_TYPE (t));
-
- case SWITCH_EXPR:
- case GOTO_EXPR:
- case RETURN_EXPR:
- case LABEL_EXPR:
- case CASE_LABEL_EXPR:
- case TRY_CATCH_EXPR:
- case TRY_FINALLY_EXPR:
- case EH_FILTER_EXPR:
- case CATCH_EXPR:
- case CHANGE_DYNAMIC_TYPE_EXPR:
- case ASM_EXPR:
- case RESX_EXPR:
- case PHI_NODE:
- case STATEMENT_LIST:
- case OMP_PARALLEL:
- case OMP_FOR:
- case OMP_SECTIONS:
- case OMP_SECTIONS_SWITCH:
- case OMP_SECTION:
- case OMP_SINGLE:
- case OMP_MASTER:
- case OMP_ORDERED:
- case OMP_CRITICAL:
- case OMP_RETURN:
- case OMP_CONTINUE:
- case OMP_TASK:
- case OMP_ATOMIC_LOAD:
- case OMP_ATOMIC_STORE:
- /* These are always void. */
- return true;
-
- case CALL_EXPR:
- case GIMPLE_MODIFY_STMT:
- case PREDICT_EXPR:
- /* These are valid regardless of their type. */
- return true;
-
- default:
- return false;
- }
-}
-
-/* Return true if T is a variable. */
-
-bool
-is_gimple_variable (tree t)
-{
- return (TREE_CODE (t) == VAR_DECL
- || TREE_CODE (t) == PARM_DECL
- || TREE_CODE (t) == RESULT_DECL
- || TREE_CODE (t) == SSA_NAME);
-}
-
-/* Return true if T is a GIMPLE identifier (something with an address). */
-
-bool
-is_gimple_id (tree t)
-{
- return (is_gimple_variable (t)
- || TREE_CODE (t) == FUNCTION_DECL
- || TREE_CODE (t) == LABEL_DECL
- || TREE_CODE (t) == CONST_DECL
- /* Allow string constants, since they are addressable. */
- || TREE_CODE (t) == STRING_CST);
-}
-
-/* Return true if TYPE is a suitable type for a scalar register variable. */
-
-bool
-is_gimple_reg_type (tree type)
-{
- /* In addition to aggregate types, we also exclude complex types if not
- optimizing because they can be subject to partial stores in GNU C by
- means of the __real__ and __imag__ operators and we cannot promote
- them to total stores (see gimplify_modify_expr_complex_part). */
- return !(AGGREGATE_TYPE_P (type)
- || (TREE_CODE (type) == COMPLEX_TYPE && !optimize));
-
-}
-
-/* Return true if T is a non-aggregate register variable. */
-
-bool
-is_gimple_reg (tree t)
-{
- if (TREE_CODE (t) == SSA_NAME)
- t = SSA_NAME_VAR (t);
-
- if (MTAG_P (t))
- return false;
-
- if (!is_gimple_variable (t))
- return false;
-
- if (!is_gimple_reg_type (TREE_TYPE (t)))
- return false;
-
- /* A volatile decl is not acceptable because we can't reuse it as
- needed. We need to copy it into a temp first. */
- if (TREE_THIS_VOLATILE (t))
- return false;
-
- /* We define "registers" as things that can be renamed as needed,
- which with our infrastructure does not apply to memory. */
- if (needs_to_live_in_memory (t))
- return false;
-
- /* Hard register variables are an interesting case. For those that
- are call-clobbered, we don't know where all the calls are, since
- we don't (want to) take into account which operations will turn
- into libcalls at the rtl level. For those that are call-saved,
- we don't currently model the fact that calls may in fact change
- global hard registers, nor do we examine ASM_CLOBBERS at the tree
- level, and so miss variable changes that might imply. All around,
- it seems safest to not do too much optimization with these at the
- tree level at all. We'll have to rely on the rtl optimizers to
- clean this up, as there we've got all the appropriate bits exposed. */
- if (TREE_CODE (t) == VAR_DECL && DECL_HARD_REGISTER (t))
- return false;
-
- /* Complex and vector values must have been put into SSA-like form.
- That is, no assignments to the individual components. */
- if (TREE_CODE (TREE_TYPE (t)) == COMPLEX_TYPE
- || TREE_CODE (TREE_TYPE (t)) == VECTOR_TYPE)
- return DECL_GIMPLE_REG_P (t);
-
- return true;
-}
-
-
-/* Returns true if T is a GIMPLE formal temporary variable. */
-
-bool
-is_gimple_formal_tmp_var (tree t)
-{
- if (TREE_CODE (t) == SSA_NAME)
- return true;
-
- return TREE_CODE (t) == VAR_DECL && DECL_GIMPLE_FORMAL_TEMP_P (t);
-}
-
-/* Returns true if T is a GIMPLE formal temporary register variable. */
-
-bool
-is_gimple_formal_tmp_reg (tree t)
-{
- /* The intent of this is to get hold of a value that won't change.
- An SSA_NAME qualifies no matter if its of a user variable or not. */
- if (TREE_CODE (t) == SSA_NAME)
- return true;
-
- /* We don't know the lifetime characteristics of user variables. */
- if (!is_gimple_formal_tmp_var (t))
- return false;
-
- /* Finally, it must be capable of being placed in a register. */
- return is_gimple_reg (t);
-}
-
-/* Return true if T is a GIMPLE variable whose address is not needed. */
-
-bool
-is_gimple_non_addressable (tree t)
-{
- if (TREE_CODE (t) == SSA_NAME)
- t = SSA_NAME_VAR (t);
-
- return (is_gimple_variable (t) && ! needs_to_live_in_memory (t));
-}
-
-/* Return true if T is a GIMPLE rvalue, i.e. an identifier or a constant. */
-
-bool
-is_gimple_val (tree t)
-{
- /* Make loads from volatiles and memory vars explicit. */
- if (is_gimple_variable (t)
- && is_gimple_reg_type (TREE_TYPE (t))
- && !is_gimple_reg (t))
- return false;
-
- /* FIXME make these decls. That can happen only when we expose the
- entire landing-pad construct at the tree level. */
- if (TREE_CODE (t) == EXC_PTR_EXPR || TREE_CODE (t) == FILTER_EXPR)
- return true;
-
- return (is_gimple_variable (t) || is_gimple_min_invariant (t));
-}
-
-/* Similarly, but accept hard registers as inputs to asm statements. */
-
-bool
-is_gimple_asm_val (tree t)
-{
- if (TREE_CODE (t) == VAR_DECL && DECL_HARD_REGISTER (t))
- return true;
-
- return is_gimple_val (t);
-}
-
-/* Return true if T is a GIMPLE minimal lvalue. */
-
-bool
-is_gimple_min_lval (tree t)
-{
- return (is_gimple_id (t)
- || TREE_CODE (t) == INDIRECT_REF);
-}
-
-/* Return true if T is a typecast operation. */
-
-bool
-is_gimple_cast (tree t)
-{
- return (CONVERT_EXPR_P (t)
- || TREE_CODE (t) == FIX_TRUNC_EXPR);
-}
-
-/* Return true if T is a valid function operand of a CALL_EXPR. */
-
-bool
-is_gimple_call_addr (tree t)
-{
- return (TREE_CODE (t) == OBJ_TYPE_REF
- || is_gimple_val (t));
-}
-
-/* If T makes a function call, return the corresponding CALL_EXPR operand.
- Otherwise, return NULL_TREE. */
-
-tree
-get_call_expr_in (tree t)
-{
- /* FIXME tuples: delete the assertion below when conversion complete. */
- gcc_assert (TREE_CODE (t) != MODIFY_EXPR);
- if (TREE_CODE (t) == GIMPLE_MODIFY_STMT)
- t = GIMPLE_STMT_OPERAND (t, 1);
- if (TREE_CODE (t) == WITH_SIZE_EXPR)
- t = TREE_OPERAND (t, 0);
- if (TREE_CODE (t) == CALL_EXPR)
- return t;
- return NULL_TREE;
-}
-
-/* Given a memory reference expression T, return its base address.
- The base address of a memory reference expression is the main
- object being referenced. For instance, the base address for
- 'array[i].fld[j]' is 'array'. You can think of this as stripping
- away the offset part from a memory address.
-
- This function calls handled_component_p to strip away all the inner
- parts of the memory reference until it reaches the base object. */
-
-tree
-get_base_address (tree t)
-{
- while (handled_component_p (t))
- t = TREE_OPERAND (t, 0);
-
- if (SSA_VAR_P (t)
- || TREE_CODE (t) == STRING_CST
- || TREE_CODE (t) == CONSTRUCTOR
- || INDIRECT_REF_P (t))
- return t;
- else
- return NULL_TREE;
-}
-
-void
-recalculate_side_effects (tree t)
-{
- enum tree_code code = TREE_CODE (t);
- int len = TREE_OPERAND_LENGTH (t);
- int i;
-
- switch (TREE_CODE_CLASS (code))
- {
- case tcc_expression:
- switch (code)
- {
- case INIT_EXPR:
- case GIMPLE_MODIFY_STMT:
- case VA_ARG_EXPR:
- case PREDECREMENT_EXPR:
- case PREINCREMENT_EXPR:
- case POSTDECREMENT_EXPR:
- case POSTINCREMENT_EXPR:
- /* All of these have side-effects, no matter what their
- operands are. */
- return;
-
- default:
- break;
- }
- /* Fall through. */
-
- case tcc_comparison: /* a comparison expression */
- case tcc_unary: /* a unary arithmetic expression */
- case tcc_binary: /* a binary arithmetic expression */
- case tcc_reference: /* a reference */
- case tcc_vl_exp: /* a function call */
- TREE_SIDE_EFFECTS (t) = TREE_THIS_VOLATILE (t);
- for (i = 0; i < len; ++i)
- {
- tree op = TREE_OPERAND (t, i);
- if (op && TREE_SIDE_EFFECTS (op))
- TREE_SIDE_EFFECTS (t) = 1;
- }
- break;
-
- default:
- /* Can never be used with non-expressions. */
- gcc_unreachable ();
- }
-}
-
-/* Canonicalize a tree T for use in a COND_EXPR as conditional. Returns
- a canonicalized tree that is valid for a COND_EXPR or NULL_TREE, if
- we failed to create one. */
-
-tree
-canonicalize_cond_expr_cond (tree t)
-{
- /* For (bool)x use x != 0. */
- if (TREE_CODE (t) == NOP_EXPR
- && TREE_TYPE (t) == boolean_type_node)
- {
- tree top0 = TREE_OPERAND (t, 0);
- t = build2 (NE_EXPR, TREE_TYPE (t),
- top0, build_int_cst (TREE_TYPE (top0), 0));
- }
- /* For !x use x == 0. */
- else if (TREE_CODE (t) == TRUTH_NOT_EXPR)
- {
- tree top0 = TREE_OPERAND (t, 0);
- t = build2 (EQ_EXPR, TREE_TYPE (t),
- top0, build_int_cst (TREE_TYPE (top0), 0));
- }
- /* For cmp ? 1 : 0 use cmp. */
- else if (TREE_CODE (t) == COND_EXPR
- && COMPARISON_CLASS_P (TREE_OPERAND (t, 0))
- && integer_onep (TREE_OPERAND (t, 1))
- && integer_zerop (TREE_OPERAND (t, 2)))
- {
- tree top0 = TREE_OPERAND (t, 0);
- t = build2 (TREE_CODE (top0), TREE_TYPE (t),
- TREE_OPERAND (top0, 0), TREE_OPERAND (top0, 1));
- }
-
- if (is_gimple_condexpr (t))
- return t;
-
- return NULL_TREE;
-}
diff --git a/gcc/tree-gimple.h b/gcc/tree-gimple.h
deleted file mode 100644
index 3691cbc5631..00000000000
--- a/gcc/tree-gimple.h
+++ /dev/null
@@ -1,235 +0,0 @@
-/* Functions to analyze and validate GIMPLE trees.
- Copyright (C) 2002, 2003, 2005, 2007 Free Software Foundation, Inc.
- Contributed by Diego Novillo <dnovillo@redhat.com>
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 3, or (at your option)
-any later version.
-
-GCC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GCC; see the file COPYING3. If not see
-<http://www.gnu.org/licenses/>. */
-
-#ifndef _TREE_SIMPLE_H
-#define _TREE_SIMPLE_H 1
-
-
-#include "tree-iterator.h"
-
-extern tree create_tmp_var_raw (tree, const char *);
-extern tree create_tmp_var_name (const char *);
-extern tree create_tmp_var (tree, const char *);
-extern tree get_initialized_tmp_var (tree, tree *, tree *);
-extern tree get_formal_tmp_var (tree, tree *);
-
-extern void declare_vars (tree, tree, bool);
-
-extern void annotate_all_with_locus (tree *, location_t);
-
-/* Validation of GIMPLE expressions. Note that these predicates only check
- the basic form of the expression, they don't recurse to make sure that
- underlying nodes are also of the right form. */
-
-typedef bool (*gimple_predicate)(tree);
-
-/* Returns true iff T is a valid GIMPLE statement. */
-extern bool is_gimple_stmt (tree);
-
-/* Returns true iff TYPE is a valid type for a scalar register variable. */
-extern bool is_gimple_reg_type (tree);
-/* Returns true iff T is a scalar register variable. */
-extern bool is_gimple_reg (tree);
-/* Returns true if T is a GIMPLE temporary variable, false otherwise. */
-extern bool is_gimple_formal_tmp_var (tree);
-/* Returns true if T is a GIMPLE temporary register variable. */
-extern bool is_gimple_formal_tmp_reg (tree);
-/* Returns true iff T is any sort of variable. */
-extern bool is_gimple_variable (tree);
-/* Returns true iff T is any sort of symbol. */
-extern bool is_gimple_id (tree);
-/* Returns true iff T is a variable or an INDIRECT_REF (of a variable). */
-extern bool is_gimple_min_lval (tree);
-/* Returns true iff T is something whose address can be taken. */
-extern bool is_gimple_addressable (tree);
-/* Returns true iff T is any valid GIMPLE lvalue. */
-extern bool is_gimple_lvalue (tree);
-
-/* Returns true iff T is a GIMPLE address. */
-bool is_gimple_address (const_tree);
-/* Returns true iff T is a GIMPLE invariant address. */
-bool is_gimple_invariant_address (const_tree);
-/* Returns true iff T is a valid GIMPLE constant. */
-bool is_gimple_constant (const_tree);
-/* Returns true iff T is a GIMPLE restricted function invariant. */
-extern bool is_gimple_min_invariant (const_tree);
-/* Returns true iff T is a GIMPLE rvalue. */
-extern bool is_gimple_val (tree);
-/* Returns true iff T is a GIMPLE asm statement input. */
-extern bool is_gimple_asm_val (tree);
-/* Returns true iff T is a valid rhs for a MODIFY_EXPR where the LHS is a
- GIMPLE temporary, a renamed user variable, or something else,
- respectively. */
-extern bool is_gimple_formal_tmp_rhs (tree);
-extern bool is_gimple_reg_rhs (tree);
-extern bool is_gimple_mem_rhs (tree);
-/* Returns the appropriate one of the above three predicates for the LHS
- T. */
-extern gimple_predicate rhs_predicate_for (tree);
-
-/* Returns true iff T is a valid if-statement condition. */
-extern bool is_gimple_condexpr (tree);
-
-/* Returns true iff T is a type conversion. */
-extern bool is_gimple_cast (tree);
-/* Returns true iff T is a variable that does not need to live in memory. */
-extern bool is_gimple_non_addressable (tree t);
-
-/* Returns true iff T is a valid call address expression. */
-extern bool is_gimple_call_addr (tree);
-/* If T makes a function call, returns the CALL_EXPR operand. */
-extern tree get_call_expr_in (tree t);
-/* Returns true iff T contains a CALL_EXPR not suitable for inlining. */
-#define CALL_STMT_CANNOT_INLINE_P(T) \
- CALL_CANNOT_INLINE_P (get_call_expr_in (T))
-
-extern void recalculate_side_effects (tree);
-
-/* FIXME we should deduce this from the predicate. */
-typedef enum fallback_t {
- fb_none = 0,
- fb_rvalue = 1,
- fb_lvalue = 2,
- fb_mayfail = 4,
- fb_either= fb_rvalue | fb_lvalue
-} fallback_t;
-
-enum gimplify_status {
- GS_ERROR = -2, /* Something Bad Seen. */
- GS_UNHANDLED = -1, /* A langhook result for "I dunno". */
- GS_OK = 0, /* We did something, maybe more to do. */
- GS_ALL_DONE = 1 /* The expression is fully gimplified. */
-};
-
-struct gimplify_ctx
-{
- struct gimplify_ctx *prev_context;
-
- tree current_bind_expr;
- tree temps;
- tree conditional_cleanups;
- tree exit_label;
- tree return_temp;
-
- VEC(tree,heap) *case_labels;
- /* The formal temporary table. Should this be persistent? */
- htab_t temp_htab;
-
- int conditions;
- bool save_stack;
- bool into_ssa;
- bool allow_rhs_cond_expr;
-};
-
-extern enum gimplify_status gimplify_expr (tree *, tree *, tree *,
- bool (*) (tree), fallback_t);
-extern void gimplify_type_sizes (tree, tree *);
-extern void gimplify_one_sizepos (tree *, tree *);
-extern void gimplify_stmt (tree *);
-extern void gimplify_to_stmt_list (tree *);
-extern void gimplify_body (tree *, tree, bool);
-extern void push_gimplify_context (struct gimplify_ctx *);
-extern void pop_gimplify_context (tree);
-extern void gimplify_and_add (tree, tree *);
-
-/* Miscellaneous helpers. */
-extern void gimple_add_tmp_var (tree);
-extern tree gimple_current_bind_expr (void);
-extern tree voidify_wrapper_expr (tree, tree);
-extern tree gimple_build_eh_filter (tree, tree, tree);
-extern tree build_and_jump (tree *);
-extern tree alloc_stmt_list (void);
-extern void free_stmt_list (tree);
-extern tree force_labels_r (tree *, int *, void *);
-extern enum gimplify_status gimplify_va_arg_expr (tree *, tree *, tree *);
-struct gimplify_omp_ctx;
-extern void omp_firstprivatize_variable (struct gimplify_omp_ctx *, tree);
-extern tree gimple_boolify (tree);
-extern tree canonicalize_cond_expr_cond (tree);
-
-/* In omp-low.c. */
-extern void diagnose_omp_structured_block_errors (tree);
-extern tree omp_reduction_init (tree, tree);
-
-/* In tree-nested.c. */
-extern void lower_nested_functions (tree);
-extern void insert_field_into_struct (tree, tree);
-
-/* Convenience routines to walk all statements of a gimple function.
- The difference between these walkers and the generic walk_tree is
- that walk_stmt provides context information to the callback
- routine to know whether it is currently on the LHS or RHS of an
- assignment (IS_LHS) or contexts where only GIMPLE values are
- allowed (VAL_ONLY).
-
- This is useful in walkers that need to re-write sub-expressions
- inside statements while making sure the result is still in GIMPLE
- form.
-
- Note that this is useful exclusively before the code is converted
- into SSA form. Once the program is in SSA form, the standard
- operand interface should be used to analyze/modify statements. */
-
-struct walk_stmt_info
-{
- /* For each statement, we invoke CALLBACK via walk_tree. The passed
- data is a walk_stmt_info structure. */
- walk_tree_fn callback;
-
- /* Points to the current statement being walked. */
- tree_stmt_iterator tsi;
-
- /* Additional data that CALLBACK may want to carry through the
- recursion. */
- void *info;
-
- /* Indicates whether the *TP being examined may be replaced
- with something that matches is_gimple_val (if true) or something
- slightly more complicated (if false). "Something" technically
- means the common subset of is_gimple_lvalue and is_gimple_rhs,
- but we never try to form anything more complicated than that, so
- we don't bother checking.
-
- Also note that CALLBACK should update this flag while walking the
- sub-expressions of a statement. For instance, when walking the
- statement 'foo (&var)', the flag VAL_ONLY will initially be set
- to true, however, when walking &var, the operand of that
- ADDR_EXPR does not need to be a GIMPLE value. */
- bool val_only;
-
- /* True if we are currently walking the LHS of an assignment. */
- bool is_lhs;
-
- /* Optional. Set to true by CALLBACK if it made any changes. */
- bool changed;
-
- /* True if we're interested in seeing BIND_EXPRs. */
- bool want_bind_expr;
-
- /* True if we're interested in seeing RETURN_EXPRs. */
- bool want_return_expr;
-
- /* True if we're interested in location information. */
- bool want_locations;
-};
-
-void walk_stmts (struct walk_stmt_info *, tree *);
-
-#endif /* _TREE_SIMPLE_H */
diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c
index 78b29a4a64b..d21bb9d49d1 100644
--- a/gcc/tree-if-conv.c
+++ b/gcc/tree-if-conv.c
@@ -100,31 +100,33 @@ along with GCC; see the file COPYING3. If not see
#include "tree-pass.h"
#include "target.h"
+
/* local function prototypes */
static unsigned int main_tree_if_conversion (void);
-static tree tree_if_convert_stmt (struct loop *loop, tree, tree,
- block_stmt_iterator *);
-static void tree_if_convert_cond_expr (struct loop *, tree, tree,
- block_stmt_iterator *);
-static bool if_convertible_phi_p (struct loop *, basic_block, tree);
-static bool if_convertible_gimple_modify_stmt_p (struct loop *, basic_block,
- tree);
-static bool if_convertible_stmt_p (struct loop *, basic_block, tree);
+static tree tree_if_convert_stmt (struct loop *loop, gimple, tree,
+ gimple_stmt_iterator *);
+static void tree_if_convert_cond_stmt (struct loop *, gimple, tree,
+ gimple_stmt_iterator *);
+static bool if_convertible_phi_p (struct loop *, basic_block, gimple);
+static bool if_convertible_gimple_assign_stmt_p (struct loop *, basic_block,
+ gimple);
+static bool if_convertible_stmt_p (struct loop *, basic_block, gimple);
static bool if_convertible_bb_p (struct loop *, basic_block, basic_block);
static bool if_convertible_loop_p (struct loop *, bool);
static void add_to_predicate_list (basic_block, tree);
static tree add_to_dst_predicate_list (struct loop * loop, edge,
tree, tree,
- block_stmt_iterator *);
+ gimple_stmt_iterator *);
static void clean_predicate_lists (struct loop *loop);
static basic_block find_phi_replacement_condition (struct loop *loop,
basic_block, tree *,
- block_stmt_iterator *);
-static void replace_phi_with_cond_gimple_modify_stmt (tree, tree, basic_block,
- block_stmt_iterator *);
+ gimple_stmt_iterator *);
+static void replace_phi_with_cond_gimple_assign_stmt (gimple, tree,
+ basic_block,
+ gimple_stmt_iterator *);
static void process_phi_nodes (struct loop *);
static void combine_blocks (struct loop *);
-static tree ifc_temp_var (tree, tree);
+static gimple ifc_temp_var (tree, tree);
static bool pred_blocks_visited_p (basic_block, bitmap *);
static basic_block * get_loop_body_in_if_conv_order (const struct loop *loop);
static bool bb_with_exit_edge_p (struct loop *, basic_block);
@@ -143,7 +145,7 @@ static bool
tree_if_conversion (struct loop *loop, bool for_vectorizer)
{
basic_block bb;
- block_stmt_iterator itr;
+ gimple_stmt_iterator itr;
unsigned int i;
ifc_bbs = NULL;
@@ -176,12 +178,12 @@ tree_if_conversion (struct loop *loop, bool for_vectorizer)
/* Process all statements in this basic block.
Remove conditional expression, if any, and annotate
destination basic block(s) appropriately. */
- for (itr = bsi_start (bb); !bsi_end_p (itr); /* empty */)
+ for (itr = gsi_start_bb (bb); !gsi_end_p (itr); /* empty */)
{
- tree t = bsi_stmt (itr);
+ gimple t = gsi_stmt (itr);
cond = tree_if_convert_stmt (loop, t, cond, &itr);
- if (!bsi_end_p (itr))
- bsi_next (&itr);
+ if (!gsi_end_p (itr))
+ gsi_next (&itr);
}
/* If current bb has only one successor, then consider it as an
@@ -214,41 +216,41 @@ tree_if_conversion (struct loop *loop, bool for_vectorizer)
}
/* if-convert stmt T which is part of LOOP.
- If T is a GIMPLE_MODIFY_STMT than it is converted into conditional modify
+ If T is a GIMPLE_ASSIGN then it is converted into conditional modify
expression using COND. For conditional expressions, add condition in the
destination basic block's predicate list and remove conditional
expression itself. BSI is the iterator used to traverse statements of
loop. It is used here when it is required to delete current statement. */
static tree
-tree_if_convert_stmt (struct loop * loop, tree t, tree cond,
- block_stmt_iterator *bsi)
+tree_if_convert_stmt (struct loop * loop, gimple t, tree cond,
+ gimple_stmt_iterator *gsi)
{
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "------if-convert stmt\n");
- print_generic_stmt (dump_file, t, TDF_SLIM);
+ print_gimple_stmt (dump_file, t, 0, TDF_SLIM);
print_generic_stmt (dump_file, cond, TDF_SLIM);
}
- switch (TREE_CODE (t))
+ switch (gimple_code (t))
{
/* Labels are harmless here. */
- case LABEL_EXPR:
+ case GIMPLE_LABEL:
break;
- case GIMPLE_MODIFY_STMT:
- /* This GIMPLE_MODIFY_STMT is killing previous value of LHS. Appropriate
+ case GIMPLE_ASSIGN:
+ /* This GIMPLE_ASSIGN is killing previous value of LHS. Appropriate
value will be selected by PHI node based on condition. It is possible
that before this transformation, PHI nodes was selecting default
value and now it will use this new value. This is OK because it does
not change validity the program. */
break;
- case COND_EXPR:
+ case GIMPLE_COND:
/* Update destination blocks' predicate list and remove this
condition expression. */
- tree_if_convert_cond_expr (loop, t, cond, bsi);
+ tree_if_convert_cond_stmt (loop, t, cond, gsi);
cond = NULL_TREE;
break;
@@ -258,41 +260,41 @@ tree_if_convert_stmt (struct loop * loop, tree t, tree cond,
return cond;
}
-/* STMT is COND_EXPR. Update two destination's predicate list.
+/* STMT is a GIMPLE_COND. Update two destination's predicate list.
Remove COND_EXPR, if it is not the loop exit condition. Otherwise
- update loop exit condition appropriately. BSI is the iterator
+ update loop exit condition appropriately. GSI is the iterator
used to traverse statement list. STMT is part of loop LOOP. */
static void
-tree_if_convert_cond_expr (struct loop *loop, tree stmt, tree cond,
- block_stmt_iterator *bsi)
+tree_if_convert_cond_stmt (struct loop *loop, gimple stmt, tree cond,
+ gimple_stmt_iterator *gsi)
{
tree c, c2;
edge true_edge, false_edge;
- gcc_assert (TREE_CODE (stmt) == COND_EXPR);
+ gcc_assert (gimple_code (stmt) == GIMPLE_COND);
- c = COND_EXPR_COND (stmt);
+ c = fold_build2 (gimple_cond_code (stmt), boolean_type_node,
+ gimple_cond_lhs (stmt), gimple_cond_rhs (stmt));
- extract_true_false_edges_from_block (bb_for_stmt (stmt),
+ extract_true_false_edges_from_block (gimple_bb (stmt),
&true_edge, &false_edge);
/* Add new condition into destination's predicate list. */
- /* If 'c' is true then TRUE_EDGE is taken. */
- add_to_dst_predicate_list (loop, true_edge, cond,
- unshare_expr (c), bsi);
+ /* If C is true then TRUE_EDGE is taken. */
+ add_to_dst_predicate_list (loop, true_edge, cond, c, gsi);
/* If 'c' is false then FALSE_EDGE is taken. */
c2 = invert_truthvalue (unshare_expr (c));
- add_to_dst_predicate_list (loop, false_edge, cond, c2, bsi);
+ add_to_dst_predicate_list (loop, false_edge, cond, c2, gsi);
/* Now this conditional statement is redundant. Remove it.
But, do not remove exit condition! Update exit condition
using new condition. */
- if (!bb_with_exit_edge_p (loop, bb_for_stmt (stmt)))
+ if (!bb_with_exit_edge_p (loop, gimple_bb (stmt)))
{
- bsi_remove (bsi, true);
+ gsi_remove (gsi, true);
cond = NULL_TREE;
}
return;
@@ -306,22 +308,22 @@ tree_if_convert_cond_expr (struct loop *loop, tree stmt, tree cond,
- Virtual PHI on BB other than header. */
static bool
-if_convertible_phi_p (struct loop *loop, basic_block bb, tree phi)
+if_convertible_phi_p (struct loop *loop, basic_block bb, gimple phi)
{
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "-------------------------\n");
- print_generic_stmt (dump_file, phi, TDF_SLIM);
+ print_gimple_stmt (dump_file, phi, 0, TDF_SLIM);
}
- if (bb != loop->header && PHI_NUM_ARGS (phi) != 2)
+ if (bb != loop->header && gimple_phi_num_args (phi) != 2)
{
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "More than two phi node args.\n");
return false;
}
- if (!is_gimple_reg (SSA_NAME_VAR (PHI_RESULT (phi))))
+ if (!is_gimple_reg (SSA_NAME_VAR (gimple_phi_result (phi))))
{
imm_use_iterator imm_iter;
use_operand_p use_p;
@@ -332,9 +334,9 @@ if_convertible_phi_p (struct loop *loop, basic_block bb, tree phi)
fprintf (dump_file, "Virtual phi not on loop header.\n");
return false;
}
- FOR_EACH_IMM_USE_FAST (use_p, imm_iter, PHI_RESULT (phi))
+ FOR_EACH_IMM_USE_FAST (use_p, imm_iter, gimple_phi_result (phi))
{
- if (TREE_CODE (USE_STMT (use_p)) == PHI_NODE)
+ if (gimple_code (USE_STMT (use_p)) == GIMPLE_PHI)
{
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "Difficult to handle this virtual phi.\n");
@@ -346,37 +348,36 @@ if_convertible_phi_p (struct loop *loop, basic_block bb, tree phi)
return true;
}
-/* Return true, if M_EXPR is if-convertible.
- GIMPLE_MODIFY_STMT is not if-convertible if,
+/* Return true, if STMT is if-convertible.
+ GIMPLE_ASSIGN statement is not if-convertible if,
- It is not movable.
- It could trap.
- LHS is not var decl.
- GIMPLE_MODIFY_STMT is part of block BB, which is inside loop LOOP.
-*/
+ GIMPLE_ASSIGN is part of block BB, which is inside loop LOOP. */
static bool
-if_convertible_gimple_modify_stmt_p (struct loop *loop, basic_block bb,
- tree m_expr)
+if_convertible_gimple_assign_stmt_p (struct loop *loop, basic_block bb,
+ gimple stmt)
{
- tree lhs, rhs;
+ tree lhs;
- if (TREE_CODE (m_expr) != GIMPLE_MODIFY_STMT)
+ if (!is_gimple_assign (stmt))
return false;
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "-------------------------\n");
- print_generic_stmt (dump_file, m_expr, TDF_SLIM);
+ print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM);
}
- lhs = GIMPLE_STMT_OPERAND (m_expr, 0);
- rhs = GIMPLE_STMT_OPERAND (m_expr, 1);
+ lhs = gimple_assign_lhs (stmt);
/* Some of these constrains might be too conservative. */
- if (stmt_ends_bb_p (m_expr) || stmt_ann (m_expr)->has_volatile_ops
+ if (stmt_ends_bb_p (stmt)
+ || gimple_has_volatile_ops (stmt)
|| (TREE_CODE (lhs) == SSA_NAME
&& SSA_NAME_OCCURS_IN_ABNORMAL_PHI (lhs))
- || TREE_SIDE_EFFECTS (rhs))
+ || gimple_has_side_effects (stmt))
{
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "stmt not suitable for ifcvt\n");
@@ -385,57 +386,49 @@ if_convertible_gimple_modify_stmt_p (struct loop *loop, basic_block bb,
/* See if it needs speculative loading or not. */
if (bb != loop->header
- && tree_could_trap_p (GIMPLE_STMT_OPERAND (m_expr, 1)))
+ && gimple_assign_rhs_could_trap_p (stmt))
{
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "tree could trap...\n");
return false;
}
- if (TREE_CODE (GIMPLE_STMT_OPERAND (m_expr, 1)) == CALL_EXPR)
- {
- if (dump_file && (dump_flags & TDF_DETAILS))
- fprintf (dump_file, "CALL_EXPR \n");
- return false;
- }
-
- if (TREE_CODE (GIMPLE_STMT_OPERAND (m_expr, 0)) != SSA_NAME
+ if (TREE_CODE (lhs) != SSA_NAME
&& bb != loop->header
&& !bb_with_exit_edge_p (loop, bb))
{
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "LHS is not var\n");
- print_generic_stmt (dump_file, m_expr, TDF_SLIM);
+ print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM);
}
return false;
}
-
return true;
}
/* Return true, iff STMT is if-convertible.
Statement is if-convertible if,
- - It is if-convertible GIMPLE_MODIFY_STMT
- - IT is LABEL_EXPR or COND_EXPR.
+ - It is if-convertible GIMPLE_ASSGIN
+ - It is GIMPLE_LABEL or GIMPLE_COND.
STMT is inside block BB, which is inside loop LOOP. */
static bool
-if_convertible_stmt_p (struct loop *loop, basic_block bb, tree stmt)
+if_convertible_stmt_p (struct loop *loop, basic_block bb, gimple stmt)
{
- switch (TREE_CODE (stmt))
+ switch (gimple_code (stmt))
{
- case LABEL_EXPR:
+ case GIMPLE_LABEL:
break;
- case GIMPLE_MODIFY_STMT:
+ case GIMPLE_ASSIGN:
- if (!if_convertible_gimple_modify_stmt_p (loop, bb, stmt))
+ if (!if_convertible_gimple_assign_stmt_p (loop, bb, stmt))
return false;
break;
- case COND_EXPR:
+ case GIMPLE_COND:
break;
default:
@@ -443,7 +436,7 @@ if_convertible_stmt_p (struct loop *loop, basic_block bb, tree stmt)
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "don't know what to do\n");
- print_generic_stmt (dump_file, stmt, TDF_SLIM);
+ print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM);
}
return false;
break;
@@ -521,9 +514,8 @@ if_convertible_bb_p (struct loop *loop, basic_block bb, basic_block exit_bb)
static bool
if_convertible_loop_p (struct loop *loop, bool for_vectorizer ATTRIBUTE_UNUSED)
{
- tree phi;
basic_block bb;
- block_stmt_iterator itr;
+ gimple_stmt_iterator itr;
unsigned int i;
edge e;
edge_iterator ei;
@@ -584,22 +576,22 @@ if_convertible_loop_p (struct loop *loop, bool for_vectorizer ATTRIBUTE_UNUSED)
return false;
/* Check statements. */
- for (itr = bsi_start (bb); !bsi_end_p (itr); bsi_next (&itr))
- if (!if_convertible_stmt_p (loop, bb, bsi_stmt (itr)))
+ for (itr = gsi_start_bb (bb); !gsi_end_p (itr); gsi_next (&itr))
+ if (!if_convertible_stmt_p (loop, bb, gsi_stmt (itr)))
return false;
/* ??? Check data dependency for vectorizer. */
/* What about phi nodes ? */
- phi = phi_nodes (bb);
+ itr = gsi_start_phis (bb);
/* Clear aux field of incoming edges to a bb with a phi node. */
- if (phi)
+ if (!gsi_end_p (itr))
FOR_EACH_EDGE (e, ei, bb->preds)
e->aux = NULL;
/* Check statements. */
- for (; phi; phi = PHI_CHAIN (phi))
- if (!if_convertible_phi_p (loop, bb, phi))
+ for (; !gsi_end_p (itr); gsi_next (&itr))
+ if (!if_convertible_phi_p (loop, bb, gsi_stmt (itr)))
return false;
if (bb_with_exit_edge_p (loop, bb))
@@ -637,7 +629,7 @@ add_to_predicate_list (basic_block bb, tree new_cond)
static tree
add_to_dst_predicate_list (struct loop * loop, edge e,
tree prev_cond, tree cond,
- block_stmt_iterator *bsi)
+ gimple_stmt_iterator *gsi)
{
tree new_cond = NULL_TREE;
@@ -649,13 +641,13 @@ add_to_dst_predicate_list (struct loop * loop, edge e,
else
{
tree tmp;
- tree tmp_stmt = NULL_TREE;
+ gimple tmp_stmt = NULL;
- prev_cond = force_gimple_operand_bsi (bsi, unshare_expr (prev_cond),
- true, NULL, true, BSI_SAME_STMT);
+ prev_cond = force_gimple_operand_gsi (gsi, unshare_expr (prev_cond),
+ true, NULL, true, GSI_SAME_STMT);
- cond = force_gimple_operand_bsi (bsi, unshare_expr (cond),
- true, NULL, true, BSI_SAME_STMT);
+ cond = force_gimple_operand_gsi (gsi, unshare_expr (cond),
+ true, NULL, true, GSI_SAME_STMT);
/* Add the condition to aux field of the edge. In case edge
destination is a PHI node, this condition will be ANDed with
@@ -666,8 +658,8 @@ add_to_dst_predicate_list (struct loop * loop, edge e,
tmp = build2 (TRUTH_AND_EXPR, boolean_type_node,
unshare_expr (prev_cond), cond);
tmp_stmt = ifc_temp_var (boolean_type_node, tmp);
- bsi_insert_before (bsi, tmp_stmt, BSI_SAME_STMT);
- new_cond = GIMPLE_STMT_OPERAND (tmp_stmt, 0);
+ gsi_insert_before (gsi, tmp_stmt, GSI_SAME_STMT);
+ new_cond = gimple_assign_lhs (tmp_stmt);
}
add_to_predicate_list (e->dest, new_cond);
return new_cond;
@@ -703,7 +695,7 @@ clean_predicate_lists (struct loop *loop)
static basic_block
find_phi_replacement_condition (struct loop *loop,
basic_block bb, tree *cond,
- block_stmt_iterator *bsi)
+ gimple_stmt_iterator *gsi)
{
edge first_edge, second_edge;
tree tmp_cond;
@@ -788,16 +780,16 @@ find_phi_replacement_condition (struct loop *loop,
condition in vector compare operation. Using gimple value allows
compiler to emit vector compare and select RTL without exposing
compare's result. */
- *cond = force_gimple_operand_bsi (bsi, unshare_expr (*cond),
+ *cond = force_gimple_operand_gsi (gsi, unshare_expr (*cond),
false, NULL_TREE,
- true, BSI_SAME_STMT);
+ true, GSI_SAME_STMT);
if (!is_gimple_reg (*cond) && !is_gimple_condexpr (*cond))
{
- tree new_stmt;
+ gimple new_stmt;
new_stmt = ifc_temp_var (TREE_TYPE (*cond), unshare_expr (*cond));
- bsi_insert_before (bsi, new_stmt, BSI_SAME_STMT);
- *cond = GIMPLE_STMT_OPERAND (new_stmt, 0);
+ gsi_insert_before (gsi, new_stmt, GSI_SAME_STMT);
+ *cond = gimple_assign_lhs (new_stmt);
}
gcc_assert (*cond);
@@ -817,33 +809,33 @@ find_phi_replacement_condition (struct loop *loop,
*/
static void
-replace_phi_with_cond_gimple_modify_stmt (tree phi, tree cond,
+replace_phi_with_cond_gimple_assign_stmt (gimple phi, tree cond,
basic_block true_bb,
- block_stmt_iterator *bsi)
+ gimple_stmt_iterator *gsi)
{
- tree new_stmt;
+ gimple new_stmt;
basic_block bb;
tree rhs;
tree arg_0, arg_1;
- gcc_assert (TREE_CODE (phi) == PHI_NODE);
+ gcc_assert (gimple_code (phi) == GIMPLE_PHI);
/* If this is not filtered earlier, then now it is too late. */
- gcc_assert (PHI_NUM_ARGS (phi) == 2);
+ gcc_assert (gimple_phi_num_args (phi) == 2);
/* Find basic block and initialize iterator. */
- bb = bb_for_stmt (phi);
+ bb = gimple_bb (phi);
/* Use condition that is not TRUTH_NOT_EXPR in conditional modify expr. */
if (EDGE_PRED (bb, 1)->src == true_bb)
{
- arg_0 = PHI_ARG_DEF (phi, 1);
- arg_1 = PHI_ARG_DEF (phi, 0);
+ arg_0 = gimple_phi_arg_def (phi, 1);
+ arg_1 = gimple_phi_arg_def (phi, 0);
}
else
{
- arg_0 = PHI_ARG_DEF (phi, 0);
- arg_1 = PHI_ARG_DEF (phi, 1);
+ arg_0 = gimple_phi_arg_def (phi, 0);
+ arg_1 = gimple_phi_arg_def (phi, 1);
}
/* Build new RHS using selected condition and arguments. */
@@ -851,20 +843,20 @@ replace_phi_with_cond_gimple_modify_stmt (tree phi, tree cond,
unshare_expr (cond), unshare_expr (arg_0),
unshare_expr (arg_1));
- /* Create new MODIFY expression using RHS. */
- new_stmt = build_gimple_modify_stmt (unshare_expr (PHI_RESULT (phi)), rhs);
+ /* Create new GIMPLE_ASSIGN statement using RHS. */
+ new_stmt = gimple_build_assign (unshare_expr (PHI_RESULT (phi)), rhs);
/* Make new statement definition of the original phi result. */
- SSA_NAME_DEF_STMT (PHI_RESULT (phi)) = new_stmt;
+ SSA_NAME_DEF_STMT (gimple_phi_result (phi)) = new_stmt;
/* Insert using iterator. */
- bsi_insert_before (bsi, new_stmt, BSI_SAME_STMT);
+ gsi_insert_before (gsi, new_stmt, GSI_SAME_STMT);
update_stmt (new_stmt);
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "new phi replacement stmt\n");
- print_generic_stmt (dump_file, new_stmt, TDF_SLIM);
+ print_gimple_stmt (dump_file, new_stmt, 0, TDF_SLIM);
}
}
@@ -881,30 +873,31 @@ process_phi_nodes (struct loop *loop)
/* Replace phi nodes with cond. modify expr. */
for (i = 1; i < orig_loop_num_nodes; i++)
{
- tree phi, cond = NULL_TREE;
- block_stmt_iterator bsi;
+ gimple phi;
+ tree cond = NULL_TREE;
+ gimple_stmt_iterator gsi, phi_gsi;
basic_block true_bb = NULL;
bb = ifc_bbs[i];
if (bb == loop->header)
continue;
- phi = phi_nodes (bb);
- bsi = bsi_after_labels (bb);
+ phi_gsi = gsi_start_phis (bb);
+ gsi = gsi_after_labels (bb);
/* BB has two predecessors. Using predecessor's aux field, set
appropriate condition for the PHI node replacement. */
- if (phi)
- true_bb = find_phi_replacement_condition (loop, bb, &cond, &bsi);
+ if (!gsi_end_p (phi_gsi))
+ true_bb = find_phi_replacement_condition (loop, bb, &cond, &gsi);
- while (phi)
+ while (!gsi_end_p (phi_gsi))
{
- tree next = PHI_CHAIN (phi);
- replace_phi_with_cond_gimple_modify_stmt (phi, cond, true_bb, &bsi);
+ phi = gsi_stmt (phi_gsi);
+ replace_phi_with_cond_gimple_assign_stmt (phi, cond, true_bb, &gsi);
release_phi_node (phi);
- phi = next;
+ gsi_next (&phi_gsi);
}
- set_phi_nodes (bb, NULL_TREE);
+ set_phi_nodes (bb, NULL);
}
return;
}
@@ -978,8 +971,8 @@ combine_blocks (struct loop *loop)
merge_target_bb = loop->header;
for (i = 1; i < orig_loop_num_nodes; i++)
{
- block_stmt_iterator bsi;
- tree_stmt_iterator last;
+ gimple_stmt_iterator gsi;
+ gimple_stmt_iterator last;
bb = ifc_bbs[i];
@@ -987,21 +980,21 @@ combine_blocks (struct loop *loop)
continue;
/* Remove labels and make stmts member of loop->header. */
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); )
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); )
{
- if (TREE_CODE (bsi_stmt (bsi)) == LABEL_EXPR)
- bsi_remove (&bsi, true);
+ if (gimple_code (gsi_stmt (gsi)) == GIMPLE_LABEL)
+ gsi_remove (&gsi, true);
else
{
- set_bb_for_stmt (bsi_stmt (bsi), merge_target_bb);
- bsi_next (&bsi);
+ gimple_set_bb (gsi_stmt (gsi), merge_target_bb);
+ gsi_next (&gsi);
}
}
/* Update stmt list. */
- last = tsi_last (bb_stmt_list (merge_target_bb));
- tsi_link_after (&last, bb_stmt_list (bb), TSI_NEW_STMT);
- set_bb_stmt_list (bb, alloc_stmt_list());
+ last = gsi_last_bb (merge_target_bb);
+ gsi_insert_seq_after (&last, bb_seq (bb), GSI_NEW_STMT);
+ set_bb_seq (bb, NULL);
delete_basic_block (bb);
}
@@ -1015,30 +1008,29 @@ combine_blocks (struct loop *loop)
merge_blocks (loop->header, exit_bb);
}
-/* Make new temp variable of type TYPE. Add GIMPLE_MODIFY_STMT to assign EXP
+/* Make a new temp variable of type TYPE. Add GIMPLE_ASSIGN to assign EXP
to the new variable. */
-static tree
+static gimple
ifc_temp_var (tree type, tree exp)
{
const char *name = "_ifc_";
- tree var, stmt, new_name;
-
- if (is_gimple_reg (exp))
- return exp;
+ tree var, new_name;
+ gimple stmt;
/* Create new temporary variable. */
var = create_tmp_var (type, name);
add_referenced_var (var);
/* Build new statement to assign EXP to new variable. */
- stmt = build_gimple_modify_stmt (var, exp);
+ stmt = gimple_build_assign (var, exp);
/* Get SSA name for the new variable and set make new statement
its definition statement. */
new_name = make_ssa_name (var, stmt);
- GIMPLE_STMT_OPERAND (stmt, 0) = new_name;
+ gimple_assign_set_lhs (stmt, new_name);
SSA_NAME_DEF_STMT (new_name) = stmt;
+ update_stmt (stmt);
return stmt;
}
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index c0f4c880f7f..ef9e75c88c6 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -56,13 +56,13 @@ along with GCC; see the file COPYING3. If not see
/* I'm not real happy about this, but we need to handle gimple and
non-gimple trees. */
-#include "tree-gimple.h"
+#include "gimple.h"
/* Inlining, Cloning, Versioning, Parallelization
Inlining: a function body is duplicated, but the PARM_DECLs are
remapped into VAR_DECLs, and non-void RETURN_EXPRs become
- GIMPLE_MODIFY_STMTs that store to a dedicated returned-value variable.
+ MODIFY_EXPRs that store to a dedicated returned-value variable.
The duplicated eh_region info of the copy will later be appended
to the info for the caller; the eh_region info in copied throwing
statements and RESX_EXPRs is adjusted accordingly.
@@ -88,14 +88,7 @@ along with GCC; see the file COPYING3. If not see
updated to point into the new body. (Note that the original
callgraph node and edge list will not be altered.)
- See the CALL_EXPR handling case in copy_body_r (). */
-
-/* 0 if we should not perform inlining.
- 1 if we should expand functions calls inline at the tree level.
- 2 if we should consider *all* functions to be inline
- candidates. */
-
-int flag_inline_trees = 0;
+ See the CALL_EXPR handling case in copy_tree_body_r (). */
/* To Do:
@@ -140,6 +133,7 @@ static void add_lexical_block (tree current_block, tree new_block);
static tree copy_decl_to_var (tree, copy_body_data *);
static tree copy_result_decl_to_var (tree, copy_body_data *);
static tree copy_decl_maybe_to_var (tree, copy_body_data *);
+static gimple remap_gimple_stmt (gimple, copy_body_data *);
/* Insert a tree->tree mapping for ID. Despite the name suggests
that the trees should be variables, it is used for more than that. */
@@ -160,7 +154,7 @@ insert_decl_map (copy_body_data *id, tree key, tree value)
static tree
remap_ssa_name (tree name, copy_body_data *id)
{
- tree new;
+ tree new_tree;
tree *n;
gcc_assert (TREE_CODE (name) == SSA_NAME);
@@ -171,59 +165,61 @@ remap_ssa_name (tree name, copy_body_data *id)
/* Do not set DEF_STMT yet as statement is not copied yet. We do that
in copy_bb. */
- new = remap_decl (SSA_NAME_VAR (name), id);
+ new_tree = remap_decl (SSA_NAME_VAR (name), id);
+
/* We might've substituted constant or another SSA_NAME for
the variable.
Replace the SSA name representing RESULT_DECL by variable during
inlining: this saves us from need to introduce PHI node in a case
return value is just partly initialized. */
- if ((TREE_CODE (new) == VAR_DECL || TREE_CODE (new) == PARM_DECL)
+ if ((TREE_CODE (new_tree) == VAR_DECL || TREE_CODE (new_tree) == PARM_DECL)
&& (TREE_CODE (SSA_NAME_VAR (name)) != RESULT_DECL
|| !id->transform_return_to_modify))
{
- new = make_ssa_name (new, NULL);
- insert_decl_map (id, name, new);
- SSA_NAME_OCCURS_IN_ABNORMAL_PHI (new)
+ new_tree = make_ssa_name (new_tree, NULL);
+ insert_decl_map (id, name, new_tree);
+ SSA_NAME_OCCURS_IN_ABNORMAL_PHI (new_tree)
= SSA_NAME_OCCURS_IN_ABNORMAL_PHI (name);
- TREE_TYPE (new) = TREE_TYPE (SSA_NAME_VAR (new));
- if (IS_EMPTY_STMT (SSA_NAME_DEF_STMT (name)))
+ TREE_TYPE (new_tree) = TREE_TYPE (SSA_NAME_VAR (new_tree));
+ if (gimple_nop_p (SSA_NAME_DEF_STMT (name)))
{
/* By inlining function having uninitialized variable, we might
extend the lifetime (variable might get reused). This cause
ICE in the case we end up extending lifetime of SSA name across
abnormal edge, but also increase register pressure.
- We simply initialize all uninitialized vars by 0 except for case
- we are inlining to very first BB. We can avoid this for all
- BBs that are not withing strongly connected regions of the CFG,
- but this is bit expensive to test.
- */
- if (id->entry_bb && is_gimple_reg (SSA_NAME_VAR (name))
+ We simply initialize all uninitialized vars by 0 except
+ for case we are inlining to very first BB. We can avoid
+ this for all BBs that are not inside strongly connected
+ regions of the CFG, but this is expensive to test. */
+ if (id->entry_bb
+ && is_gimple_reg (SSA_NAME_VAR (name))
&& TREE_CODE (SSA_NAME_VAR (name)) != PARM_DECL
&& (id->entry_bb != EDGE_SUCC (ENTRY_BLOCK_PTR, 0)->dest
|| EDGE_COUNT (id->entry_bb->preds) != 1))
{
- block_stmt_iterator bsi = bsi_last (id->entry_bb);
- tree init_stmt
- = build_gimple_modify_stmt (new,
- fold_convert (TREE_TYPE (new),
+ gimple_stmt_iterator gsi = gsi_last_bb (id->entry_bb);
+ gimple init_stmt;
+
+ init_stmt = gimple_build_assign (new_tree,
+ fold_convert (TREE_TYPE (new_tree),
integer_zero_node));
- bsi_insert_after (&bsi, init_stmt, BSI_NEW_STMT);
- SSA_NAME_DEF_STMT (new) = init_stmt;
- SSA_NAME_IS_DEFAULT_DEF (new) = 0;
+ gsi_insert_after (&gsi, init_stmt, GSI_NEW_STMT);
+ SSA_NAME_IS_DEFAULT_DEF (new_tree) = 0;
}
else
{
- SSA_NAME_DEF_STMT (new) = build_empty_stmt ();
- if (gimple_default_def (id->src_cfun, SSA_NAME_VAR (name)) == name)
- set_default_def (SSA_NAME_VAR (new), new);
+ SSA_NAME_DEF_STMT (new_tree) = gimple_build_nop ();
+ if (gimple_default_def (id->src_cfun, SSA_NAME_VAR (name))
+ == name)
+ set_default_def (SSA_NAME_VAR (new_tree), new_tree);
}
}
}
else
- insert_decl_map (id, name, new);
- return new;
+ insert_decl_map (id, name, new_tree);
+ return new_tree;
}
/* Remap DECL during the copying of the BLOCK tree for the function. */
@@ -262,15 +258,15 @@ remap_decl (tree decl, copy_body_data *id)
DECL_ORIGINAL_TYPE (t) = remap_type (DECL_ORIGINAL_TYPE (t), id);
/* Remap sizes as necessary. */
- walk_tree (&DECL_SIZE (t), copy_body_r, id, NULL);
- walk_tree (&DECL_SIZE_UNIT (t), copy_body_r, id, NULL);
+ walk_tree (&DECL_SIZE (t), copy_tree_body_r, id, NULL);
+ walk_tree (&DECL_SIZE_UNIT (t), copy_tree_body_r, id, NULL);
/* If fields, do likewise for offset and qualifier. */
if (TREE_CODE (t) == FIELD_DECL)
{
- walk_tree (&DECL_FIELD_OFFSET (t), copy_body_r, id, NULL);
+ walk_tree (&DECL_FIELD_OFFSET (t), copy_tree_body_r, id, NULL);
if (TREE_CODE (DECL_CONTEXT (t)) == QUAL_UNION_TYPE)
- walk_tree (&DECL_QUALIFIER (t), copy_body_r, id, NULL);
+ walk_tree (&DECL_QUALIFIER (t), copy_tree_body_r, id, NULL);
}
if (cfun && gimple_in_ssa_p (cfun)
@@ -285,7 +281,7 @@ remap_decl (tree decl, copy_body_data *id)
/* Watch out RESULT_DECLs whose SSA names map directly
to them. */
if (TREE_CODE (map) == SSA_NAME
- && IS_EMPTY_STMT (SSA_NAME_DEF_STMT (map)))
+ && gimple_nop_p (SSA_NAME_DEF_STMT (map)))
set_default_def (t, map);
}
add_referenced_var (t);
@@ -299,31 +295,31 @@ remap_decl (tree decl, copy_body_data *id)
static tree
remap_type_1 (tree type, copy_body_data *id)
{
- tree new, t;
+ tree new_tree, t;
/* We do need a copy. build and register it now. If this is a pointer or
reference type, remap the designated type and make a new pointer or
reference type. */
if (TREE_CODE (type) == POINTER_TYPE)
{
- new = build_pointer_type_for_mode (remap_type (TREE_TYPE (type), id),
+ new_tree = build_pointer_type_for_mode (remap_type (TREE_TYPE (type), id),
TYPE_MODE (type),
TYPE_REF_CAN_ALIAS_ALL (type));
- insert_decl_map (id, type, new);
- return new;
+ insert_decl_map (id, type, new_tree);
+ return new_tree;
}
else if (TREE_CODE (type) == REFERENCE_TYPE)
{
- new = build_reference_type_for_mode (remap_type (TREE_TYPE (type), id),
+ new_tree = build_reference_type_for_mode (remap_type (TREE_TYPE (type), id),
TYPE_MODE (type),
TYPE_REF_CAN_ALIAS_ALL (type));
- insert_decl_map (id, type, new);
- return new;
+ insert_decl_map (id, type, new_tree);
+ return new_tree;
}
else
- new = copy_node (type);
+ new_tree = copy_node (type);
- insert_decl_map (id, type, new);
+ insert_decl_map (id, type, new_tree);
/* This is a new type, not a copy of an old type. Need to reassociate
variants. We can handle everything except the main variant lazily. */
@@ -331,47 +327,47 @@ remap_type_1 (tree type, copy_body_data *id)
if (type != t)
{
t = remap_type (t, id);
- TYPE_MAIN_VARIANT (new) = t;
- TYPE_NEXT_VARIANT (new) = TYPE_NEXT_VARIANT (t);
- TYPE_NEXT_VARIANT (t) = new;
+ TYPE_MAIN_VARIANT (new_tree) = t;
+ TYPE_NEXT_VARIANT (new_tree) = TYPE_NEXT_VARIANT (t);
+ TYPE_NEXT_VARIANT (t) = new_tree;
}
else
{
- TYPE_MAIN_VARIANT (new) = new;
- TYPE_NEXT_VARIANT (new) = NULL;
+ TYPE_MAIN_VARIANT (new_tree) = new_tree;
+ TYPE_NEXT_VARIANT (new_tree) = NULL;
}
if (TYPE_STUB_DECL (type))
- TYPE_STUB_DECL (new) = remap_decl (TYPE_STUB_DECL (type), id);
+ TYPE_STUB_DECL (new_tree) = remap_decl (TYPE_STUB_DECL (type), id);
/* Lazily create pointer and reference types. */
- TYPE_POINTER_TO (new) = NULL;
- TYPE_REFERENCE_TO (new) = NULL;
+ TYPE_POINTER_TO (new_tree) = NULL;
+ TYPE_REFERENCE_TO (new_tree) = NULL;
- switch (TREE_CODE (new))
+ switch (TREE_CODE (new_tree))
{
case INTEGER_TYPE:
case REAL_TYPE:
case FIXED_POINT_TYPE:
case ENUMERAL_TYPE:
case BOOLEAN_TYPE:
- t = TYPE_MIN_VALUE (new);
+ t = TYPE_MIN_VALUE (new_tree);
if (t && TREE_CODE (t) != INTEGER_CST)
- walk_tree (&TYPE_MIN_VALUE (new), copy_body_r, id, NULL);
+ walk_tree (&TYPE_MIN_VALUE (new_tree), copy_tree_body_r, id, NULL);
- t = TYPE_MAX_VALUE (new);
+ t = TYPE_MAX_VALUE (new_tree);
if (t && TREE_CODE (t) != INTEGER_CST)
- walk_tree (&TYPE_MAX_VALUE (new), copy_body_r, id, NULL);
- return new;
+ walk_tree (&TYPE_MAX_VALUE (new_tree), copy_tree_body_r, id, NULL);
+ return new_tree;
case FUNCTION_TYPE:
- TREE_TYPE (new) = remap_type (TREE_TYPE (new), id);
- walk_tree (&TYPE_ARG_TYPES (new), copy_body_r, id, NULL);
- return new;
+ TREE_TYPE (new_tree) = remap_type (TREE_TYPE (new_tree), id);
+ walk_tree (&TYPE_ARG_TYPES (new_tree), copy_tree_body_r, id, NULL);
+ return new_tree;
case ARRAY_TYPE:
- TREE_TYPE (new) = remap_type (TREE_TYPE (new), id);
- TYPE_DOMAIN (new) = remap_type (TYPE_DOMAIN (new), id);
+ TREE_TYPE (new_tree) = remap_type (TREE_TYPE (new_tree), id);
+ TYPE_DOMAIN (new_tree) = remap_type (TYPE_DOMAIN (new_tree), id);
break;
case RECORD_TYPE:
@@ -380,14 +376,14 @@ remap_type_1 (tree type, copy_body_data *id)
{
tree f, nf = NULL;
- for (f = TYPE_FIELDS (new); f ; f = TREE_CHAIN (f))
+ for (f = TYPE_FIELDS (new_tree); f ; f = TREE_CHAIN (f))
{
t = remap_decl (f, id);
- DECL_CONTEXT (t) = new;
+ DECL_CONTEXT (t) = new_tree;
TREE_CHAIN (t) = nf;
nf = t;
}
- TYPE_FIELDS (new) = nreverse (nf);
+ TYPE_FIELDS (new_tree) = nreverse (nf);
}
break;
@@ -397,10 +393,10 @@ remap_type_1 (tree type, copy_body_data *id)
gcc_unreachable ();
}
- walk_tree (&TYPE_SIZE (new), copy_body_r, id, NULL);
- walk_tree (&TYPE_SIZE_UNIT (new), copy_body_r, id, NULL);
+ walk_tree (&TYPE_SIZE (new_tree), copy_tree_body_r, id, NULL);
+ walk_tree (&TYPE_SIZE_UNIT (new_tree), copy_tree_body_r, id, NULL);
- return new;
+ return new_tree;
}
tree
@@ -442,9 +438,10 @@ remap_decls (tree decls, copy_body_data *id)
{
tree new_var;
- /* We can not chain the local static declarations into the local_decls
- as we can't duplicate them or break one decl rule. Go ahead and link
- them into local_decls. */
+ /* We cannot chain the local static declarations into the local_decls
+ as we can't duplicate them or break one decl rule. Go ahead
+ and link them into local_decls. */
+
if (!auto_var_in_fn_p (old_var, id->src_fn)
&& !DECL_EXTERNAL (old_var))
{
@@ -456,7 +453,7 @@ remap_decls (tree decls, copy_body_data *id)
/* Remap the variable. */
new_var = remap_decl (old_var, id);
- /* If we didn't remap this variable, so we can't mess with its
+ /* If we didn't remap this variable, we can't mess with its
TREE_CHAIN. If we remapped this variable to the return slot, it's
already declared somewhere else, so don't declare it here. */
if (!new_var || new_var == id->retvar)
@@ -507,28 +504,28 @@ static tree
remap_blocks (tree block, copy_body_data *id)
{
tree t;
- tree new = block;
+ tree new_tree = block;
if (!block)
return NULL;
- remap_block (&new, id);
- gcc_assert (new != block);
+ remap_block (&new_tree, id);
+ gcc_assert (new_tree != block);
for (t = BLOCK_SUBBLOCKS (block); t ; t = BLOCK_CHAIN (t))
- add_lexical_block (new, remap_blocks (t, id));
- return new;
+ add_lexical_block (new_tree, remap_blocks (t, id));
+ return new_tree;
}
static void
copy_statement_list (tree *tp)
{
tree_stmt_iterator oi, ni;
- tree new;
+ tree new_tree;
- new = alloc_stmt_list ();
- ni = tsi_start (new);
+ new_tree = alloc_stmt_list ();
+ ni = tsi_start (new_tree);
oi = tsi_start (*tp);
- *tp = new;
+ *tp = new_tree;
for (; !tsi_end_p (oi); tsi_next (&oi))
tsi_link_after (&ni, tsi_stmt (oi), TSI_NEW_STMT);
@@ -552,11 +549,234 @@ copy_bind_expr (tree *tp, int *walk_subtrees, copy_body_data *id)
BIND_EXPR_VARS (*tp) = remap_decls (BIND_EXPR_VARS (*tp), id);
}
-/* Called from copy_body_id via walk_tree. DATA is really an
+
+/* Create a new gimple_seq by remapping all the statements in BODY
+ using the inlining information in ID. */
+
+gimple_seq
+remap_gimple_seq (gimple_seq body, copy_body_data *id)
+{
+ gimple_stmt_iterator si;
+ gimple_seq new_body = NULL;
+
+ for (si = gsi_start (body); !gsi_end_p (si); gsi_next (&si))
+ {
+ gimple new_stmt = remap_gimple_stmt (gsi_stmt (si), id);
+ gimple_seq_add_stmt (&new_body, new_stmt);
+ }
+
+ return new_body;
+}
+
+
+/* Copy a GIMPLE_BIND statement STMT, remapping all the symbols in its
+ block using the mapping information in ID. */
+
+static gimple
+copy_gimple_bind (gimple stmt, copy_body_data *id)
+{
+ gimple new_bind;
+ tree new_block, new_vars;
+ gimple_seq body, new_body;
+
+ /* Copy the statement. Note that we purposely don't use copy_stmt
+ here because we need to remap statements as we copy. */
+ body = gimple_bind_body (stmt);
+ new_body = remap_gimple_seq (body, id);
+
+ new_block = gimple_bind_block (stmt);
+ if (new_block)
+ remap_block (&new_block, id);
+
+ /* This will remap a lot of the same decls again, but this should be
+ harmless. */
+ new_vars = gimple_bind_vars (stmt);
+ if (new_vars)
+ new_vars = remap_decls (new_vars, id);
+
+ new_bind = gimple_build_bind (new_vars, new_body, new_block);
+
+ return new_bind;
+}
+
+
+/* Remap the GIMPLE operand pointed to by *TP. DATA is really a
+ 'struct walk_stmt_info *'. DATA->INFO is a 'copy_body_data *'.
+ WALK_SUBTREES is used to indicate walk_gimple_op whether to keep
+ recursing into the children nodes of *TP. */
+
+static tree
+remap_gimple_op_r (tree *tp, int *walk_subtrees, void *data)
+{
+ struct walk_stmt_info *wi_p = (struct walk_stmt_info *) data;
+ copy_body_data *id = (copy_body_data *) wi_p->info;
+ tree fn = id->src_fn;
+
+ if (TREE_CODE (*tp) == SSA_NAME)
+ {
+ *tp = remap_ssa_name (*tp, id);
+ *walk_subtrees = 0;
+ return NULL;
+ }
+ else if (auto_var_in_fn_p (*tp, fn))
+ {
+ /* Local variables and labels need to be replaced by equivalent
+ variables. We don't want to copy static variables; there's
+ only one of those, no matter how many times we inline the
+ containing function. Similarly for globals from an outer
+ function. */
+ tree new_decl;
+
+ /* Remap the declaration. */
+ new_decl = remap_decl (*tp, id);
+ gcc_assert (new_decl);
+ /* Replace this variable with the copy. */
+ STRIP_TYPE_NOPS (new_decl);
+ *tp = new_decl;
+ *walk_subtrees = 0;
+ }
+ else if (TREE_CODE (*tp) == STATEMENT_LIST)
+ gcc_unreachable ();
+ else if (TREE_CODE (*tp) == SAVE_EXPR)
+ gcc_unreachable ();
+ else if (TREE_CODE (*tp) == LABEL_DECL
+ && (!DECL_CONTEXT (*tp)
+ || decl_function_context (*tp) == id->src_fn))
+ /* These may need to be remapped for EH handling. */
+ *tp = remap_decl (*tp, id);
+ else if (TYPE_P (*tp))
+ /* Types may need remapping as well. */
+ *tp = remap_type (*tp, id);
+ else if (CONSTANT_CLASS_P (*tp))
+ {
+ /* If this is a constant, we have to copy the node iff the type
+ will be remapped. copy_tree_r will not copy a constant. */
+ tree new_type = remap_type (TREE_TYPE (*tp), id);
+
+ if (new_type == TREE_TYPE (*tp))
+ *walk_subtrees = 0;
+
+ else if (TREE_CODE (*tp) == INTEGER_CST)
+ *tp = build_int_cst_wide (new_type, TREE_INT_CST_LOW (*tp),
+ TREE_INT_CST_HIGH (*tp));
+ else
+ {
+ *tp = copy_node (*tp);
+ TREE_TYPE (*tp) = new_type;
+ }
+ }
+ else
+ {
+ /* Otherwise, just copy the node. Note that copy_tree_r already
+ knows not to copy VAR_DECLs, etc., so this is safe. */
+ if (TREE_CODE (*tp) == INDIRECT_REF)
+ {
+ /* Get rid of *& from inline substitutions that can happen when a
+ pointer argument is an ADDR_EXPR. */
+ tree decl = TREE_OPERAND (*tp, 0);
+ tree *n;
+
+ n = (tree *) pointer_map_contains (id->decl_map, decl);
+ if (n)
+ {
+ tree type, new_tree, old;
+
+ /* If we happen to get an ADDR_EXPR in n->value, strip
+ it manually here as we'll eventually get ADDR_EXPRs
+ which lie about their types pointed to. In this case
+ build_fold_indirect_ref wouldn't strip the
+ INDIRECT_REF, but we absolutely rely on that. As
+ fold_indirect_ref does other useful transformations,
+ try that first, though. */
+ type = TREE_TYPE (TREE_TYPE (*n));
+ new_tree = unshare_expr (*n);
+ old = *tp;
+ *tp = gimple_fold_indirect_ref (new_tree);
+ if (!*tp)
+ {
+ if (TREE_CODE (new_tree) == ADDR_EXPR)
+ {
+ *tp = fold_indirect_ref_1 (type, new_tree);
+ /* ??? We should either assert here or build
+ a VIEW_CONVERT_EXPR instead of blindly leaking
+ incompatible types to our IL. */
+ if (! *tp)
+ *tp = TREE_OPERAND (new_tree, 0);
+ }
+ else
+ {
+ *tp = build1 (INDIRECT_REF, type, new_tree);
+ TREE_THIS_VOLATILE (*tp) = TREE_THIS_VOLATILE (old);
+ }
+ }
+ *walk_subtrees = 0;
+ return NULL;
+ }
+ }
+
+ /* Here is the "usual case". Copy this tree node, and then
+ tweak some special cases. */
+ copy_tree_r (tp, walk_subtrees, NULL);
+
+ /* Global variables we haven't seen yet need to go into referenced
+ vars. If not referenced from types only. */
+ if (gimple_in_ssa_p (cfun)
+ && TREE_CODE (*tp) == VAR_DECL
+ && id->remapping_type_depth == 0)
+ add_referenced_var (*tp);
+
+ /* We should never have TREE_BLOCK set on non-statements. */
+ if (EXPR_P (*tp))
+ gcc_assert (!TREE_BLOCK (*tp));
+
+ if (TREE_CODE (*tp) != OMP_CLAUSE)
+ TREE_TYPE (*tp) = remap_type (TREE_TYPE (*tp), id);
+
+ if (TREE_CODE (*tp) == TARGET_EXPR && TREE_OPERAND (*tp, 3))
+ {
+ /* The copied TARGET_EXPR has never been expanded, even if the
+ original node was expanded already. */
+ TREE_OPERAND (*tp, 1) = TREE_OPERAND (*tp, 3);
+ TREE_OPERAND (*tp, 3) = NULL_TREE;
+ }
+ else if (TREE_CODE (*tp) == ADDR_EXPR)
+ {
+ /* Variable substitution need not be simple. In particular,
+ the INDIRECT_REF substitution above. Make sure that
+ TREE_CONSTANT and friends are up-to-date. But make sure
+ to not improperly set TREE_BLOCK on some sub-expressions. */
+ int invariant = is_gimple_min_invariant (*tp);
+ tree block = id->block;
+ id->block = NULL_TREE;
+ walk_tree (&TREE_OPERAND (*tp, 0), copy_tree_body_r, id, NULL);
+ id->block = block;
+
+ /* Handle the case where we substituted an INDIRECT_REF
+ into the operand of the ADDR_EXPR. */
+ if (TREE_CODE (TREE_OPERAND (*tp, 0)) == INDIRECT_REF)
+ *tp = TREE_OPERAND (TREE_OPERAND (*tp, 0), 0);
+ else
+ recompute_tree_invariant_for_addr_expr (*tp);
+
+ /* If this used to be invariant, but is not any longer,
+ then regimplification is probably needed. */
+ if (invariant && !is_gimple_min_invariant (*tp))
+ id->regimplify = true;
+
+ *walk_subtrees = 0;
+ }
+ }
+
+ /* Keep iterating. */
+ return NULL_TREE;
+}
+
+
+/* Called from copy_body_id via walk_tree. DATA is really a
`copy_body_data *'. */
tree
-copy_body_r (tree *tp, int *walk_subtrees, void *data)
+copy_tree_body_r (tree *tp, int *walk_subtrees, void *data)
{
copy_body_data *id = (copy_body_data *) data;
tree fn = id->src_fn;
@@ -569,7 +789,7 @@ copy_body_r (tree *tp, int *walk_subtrees, void *data)
duplicated and/or tweaked. */
/* When requested, RETURN_EXPRs should be transformed to just the
- contained GIMPLE_MODIFY_STMT. The branch semantics of the return will
+ contained MODIFY_EXPR. The branch semantics of the return will
be handled elsewhere by manipulating the CFG rather than a statement. */
if (TREE_CODE (*tp) == RETURN_EXPR && id->transform_return_to_modify)
{
@@ -580,10 +800,10 @@ copy_body_r (tree *tp, int *walk_subtrees, void *data)
If the "assignment" is just the result decl, the result
decl has already been set (e.g. a recent "foo (&result_decl,
...)"); just toss the entire RETURN_EXPR. */
- if (assignment && TREE_CODE (assignment) == GIMPLE_MODIFY_STMT)
+ if (assignment && TREE_CODE (assignment) == MODIFY_EXPR)
{
/* Replace the RETURN_EXPR with (a copy of) the
- GIMPLE_MODIFY_STMT hanging underneath. */
+ MODIFY_EXPR hanging underneath. */
*tp = copy_node (assignment);
}
else /* Else the RETURN_EXPR returns no value. */
@@ -656,14 +876,14 @@ copy_body_r (tree *tp, int *walk_subtrees, void *data)
/* Here we handle trees that are not completely rewritten.
First we detect some inlining-induced bogosities for
discarding. */
- if (TREE_CODE (*tp) == GIMPLE_MODIFY_STMT
- && GIMPLE_STMT_OPERAND (*tp, 0) == GIMPLE_STMT_OPERAND (*tp, 1)
- && (auto_var_in_fn_p (GIMPLE_STMT_OPERAND (*tp, 0), fn)))
+ if (TREE_CODE (*tp) == MODIFY_EXPR
+ && TREE_OPERAND (*tp, 0) == TREE_OPERAND (*tp, 1)
+ && (auto_var_in_fn_p (TREE_OPERAND (*tp, 0), fn)))
{
/* Some assignments VAR = VAR; don't generate any rtl code
and thus don't count as variable modification. Avoid
keeping bogosities like 0 = 0. */
- tree decl = GIMPLE_STMT_OPERAND (*tp, 0), value;
+ tree decl = TREE_OPERAND (*tp, 0), value;
tree *n;
n = (tree *) pointer_map_contains (id->decl_map, decl);
@@ -674,7 +894,7 @@ copy_body_r (tree *tp, int *walk_subtrees, void *data)
if (TREE_CONSTANT (value) || TREE_READONLY (value))
{
*tp = build_empty_stmt ();
- return copy_body_r (tp, walk_subtrees, data);
+ return copy_tree_body_r (tp, walk_subtrees, data);
}
}
}
@@ -688,7 +908,7 @@ copy_body_r (tree *tp, int *walk_subtrees, void *data)
n = (tree *) pointer_map_contains (id->decl_map, decl);
if (n)
{
- tree new;
+ tree new_tree;
tree old;
/* If we happen to get an ADDR_EXPR in n->value, strip
it manually here as we'll eventually get ADDR_EXPRs
@@ -697,23 +917,23 @@ copy_body_r (tree *tp, int *walk_subtrees, void *data)
but we absolutely rely on that. As fold_indirect_ref
does other useful transformations, try that first, though. */
tree type = TREE_TYPE (TREE_TYPE (*n));
- new = unshare_expr (*n);
+ new_tree = unshare_expr (*n);
old = *tp;
- *tp = gimple_fold_indirect_ref (new);
+ *tp = gimple_fold_indirect_ref (new_tree);
if (! *tp)
{
- if (TREE_CODE (new) == ADDR_EXPR)
+ if (TREE_CODE (new_tree) == ADDR_EXPR)
{
- *tp = fold_indirect_ref_1 (type, new);
+ *tp = fold_indirect_ref_1 (type, new_tree);
/* ??? We should either assert here or build
a VIEW_CONVERT_EXPR instead of blindly leaking
incompatible types to our IL. */
if (! *tp)
- *tp = TREE_OPERAND (new, 0);
+ *tp = TREE_OPERAND (new_tree, 0);
}
else
{
- *tp = build1 (INDIRECT_REF, type, new);
+ *tp = build1 (INDIRECT_REF, type, new_tree);
TREE_THIS_VOLATILE (*tp) = TREE_THIS_VOLATILE (old);
TREE_SIDE_EFFECTS (*tp) = TREE_SIDE_EFFECTS (old);
}
@@ -729,14 +949,15 @@ copy_body_r (tree *tp, int *walk_subtrees, void *data)
/* Global variables we haven't seen yet needs to go into referenced
vars. If not referenced from types only. */
- if (gimple_in_ssa_p (cfun) && TREE_CODE (*tp) == VAR_DECL
+ if (gimple_in_ssa_p (cfun)
+ && TREE_CODE (*tp) == VAR_DECL
&& id->remapping_type_depth == 0)
add_referenced_var (*tp);
/* If EXPR has block defined, map it to newly constructed block.
When inlining we want EXPRs without block appear in the block
of function call. */
- if (EXPR_P (*tp) || GIMPLE_STMT_P (*tp))
+ if (EXPR_P (*tp))
{
new_block = id->block;
if (TREE_BLOCK (*tp))
@@ -752,11 +973,11 @@ copy_body_r (tree *tp, int *walk_subtrees, void *data)
if (TREE_CODE (*tp) == RESX_EXPR && id->eh_region_offset)
TREE_OPERAND (*tp, 0) =
- build_int_cst
- (NULL_TREE,
- id->eh_region_offset + TREE_INT_CST_LOW (TREE_OPERAND (*tp, 0)));
+ build_int_cst (NULL_TREE,
+ id->eh_region_offset
+ + TREE_INT_CST_LOW (TREE_OPERAND (*tp, 0)));
- if (!GIMPLE_TUPLE_P (*tp) && TREE_CODE (*tp) != OMP_CLAUSE)
+ if (TREE_CODE (*tp) != OMP_CLAUSE)
TREE_TYPE (*tp) = remap_type (TREE_TYPE (*tp), id);
/* The copied TARGET_EXPR has never been expanded, even if the
@@ -773,17 +994,20 @@ copy_body_r (tree *tp, int *walk_subtrees, void *data)
else if (TREE_CODE (*tp) == ADDR_EXPR)
{
int invariant = is_gimple_min_invariant (*tp);
- walk_tree (&TREE_OPERAND (*tp, 0), copy_body_r, id, NULL);
+ walk_tree (&TREE_OPERAND (*tp, 0), copy_tree_body_r, id, NULL);
+
/* Handle the case where we substituted an INDIRECT_REF
into the operand of the ADDR_EXPR. */
if (TREE_CODE (TREE_OPERAND (*tp, 0)) == INDIRECT_REF)
*tp = TREE_OPERAND (TREE_OPERAND (*tp, 0), 0);
else
recompute_tree_invariant_for_addr_expr (*tp);
+
/* If this used to be invariant, but is not any longer,
then regimplification is probably needed. */
if (invariant && !is_gimple_min_invariant (*tp))
id->regimplify = true;
+
*walk_subtrees = 0;
}
}
@@ -792,6 +1016,209 @@ copy_body_r (tree *tp, int *walk_subtrees, void *data)
return NULL_TREE;
}
+
+/* Helper for copy_bb. Remap statement STMT using the inlining
+ information in ID. Return the new statement copy. */
+
+static gimple
+remap_gimple_stmt (gimple stmt, copy_body_data *id)
+{
+ gimple copy = NULL;
+ struct walk_stmt_info wi;
+ tree new_block;
+
+ /* Begin by recognizing trees that we'll completely rewrite for the
+ inlining context. Our output for these trees is completely
+ different from out input (e.g. RETURN_EXPR is deleted, and morphs
+ into an edge). Further down, we'll handle trees that get
+ duplicated and/or tweaked. */
+
+ /* When requested, GIMPLE_RETURNs should be transformed to just the
+ contained GIMPLE_ASSIGN. The branch semantics of the return will
+ be handled elsewhere by manipulating the CFG rather than the
+ statement. */
+ if (gimple_code (stmt) == GIMPLE_RETURN && id->transform_return_to_modify)
+ {
+ tree retval = gimple_return_retval (stmt);
+
+ /* If we're returning something, just turn that into an
+ assignment into the equivalent of the original RESULT_DECL.
+ If RETVAL is just the result decl, the result decl has
+ already been set (e.g. a recent "foo (&result_decl, ...)");
+ just toss the entire GIMPLE_RETURN. */
+ if (retval && TREE_CODE (retval) != RESULT_DECL)
+ copy = gimple_build_assign (id->retvar, retval);
+ else
+ return gimple_build_nop ();
+ }
+ else if (gimple_has_substatements (stmt))
+ {
+ gimple_seq s1, s2;
+
+ /* When cloning bodies from the C++ front end, we will be handed bodies
+ in High GIMPLE form. Handle here all the High GIMPLE statements that
+ have embedded statements. */
+ switch (gimple_code (stmt))
+ {
+ case GIMPLE_BIND:
+ copy = copy_gimple_bind (stmt, id);
+ break;
+
+ case GIMPLE_CATCH:
+ s1 = remap_gimple_seq (gimple_catch_handler (stmt), id);
+ copy = gimple_build_catch (gimple_catch_types (stmt), s1);
+ break;
+
+ case GIMPLE_EH_FILTER:
+ s1 = remap_gimple_seq (gimple_eh_filter_failure (stmt), id);
+ copy = gimple_build_eh_filter (gimple_eh_filter_types (stmt), s1);
+ break;
+
+ case GIMPLE_TRY:
+ s1 = remap_gimple_seq (gimple_try_eval (stmt), id);
+ s2 = remap_gimple_seq (gimple_try_cleanup (stmt), id);
+ copy = gimple_build_try (s1, s2, gimple_try_kind (stmt));
+ break;
+
+ case GIMPLE_WITH_CLEANUP_EXPR:
+ s1 = remap_gimple_seq (gimple_wce_cleanup (stmt), id);
+ copy = gimple_build_wce (s1);
+ break;
+
+ case GIMPLE_OMP_PARALLEL:
+ s1 = remap_gimple_seq (gimple_omp_body (stmt), id);
+ copy = gimple_build_omp_parallel
+ (s1,
+ gimple_omp_parallel_clauses (stmt),
+ gimple_omp_parallel_child_fn (stmt),
+ gimple_omp_parallel_data_arg (stmt));
+ break;
+
+ case GIMPLE_OMP_TASK:
+ s1 = remap_gimple_seq (gimple_omp_body (stmt), id);
+ copy = gimple_build_omp_task
+ (s1,
+ gimple_omp_task_clauses (stmt),
+ gimple_omp_task_child_fn (stmt),
+ gimple_omp_task_data_arg (stmt),
+ gimple_omp_task_copy_fn (stmt),
+ gimple_omp_task_arg_size (stmt),
+ gimple_omp_task_arg_align (stmt));
+ break;
+
+ case GIMPLE_OMP_FOR:
+ s1 = remap_gimple_seq (gimple_omp_body (stmt), id);
+ s2 = remap_gimple_seq (gimple_omp_for_pre_body (stmt), id);
+ copy = gimple_build_omp_for (s1, gimple_omp_for_clauses (stmt),
+ gimple_omp_for_collapse (stmt), s2);
+ {
+ size_t i;
+ for (i = 0; i < gimple_omp_for_collapse (stmt); i++)
+ {
+ gimple_omp_for_set_index (copy, i,
+ gimple_omp_for_index (stmt, i));
+ gimple_omp_for_set_initial (copy, i,
+ gimple_omp_for_initial (stmt, i));
+ gimple_omp_for_set_final (copy, i,
+ gimple_omp_for_final (stmt, i));
+ gimple_omp_for_set_incr (copy, i,
+ gimple_omp_for_incr (stmt, i));
+ gimple_omp_for_set_cond (copy, i,
+ gimple_omp_for_cond (stmt, i));
+ }
+ }
+ break;
+
+ case GIMPLE_OMP_MASTER:
+ s1 = remap_gimple_seq (gimple_omp_body (stmt), id);
+ copy = gimple_build_omp_master (s1);
+ break;
+
+ case GIMPLE_OMP_ORDERED:
+ s1 = remap_gimple_seq (gimple_omp_body (stmt), id);
+ copy = gimple_build_omp_ordered (s1);
+ break;
+
+ case GIMPLE_OMP_SECTION:
+ s1 = remap_gimple_seq (gimple_omp_body (stmt), id);
+ copy = gimple_build_omp_section (s1);
+ break;
+
+ case GIMPLE_OMP_SECTIONS:
+ s1 = remap_gimple_seq (gimple_omp_body (stmt), id);
+ copy = gimple_build_omp_sections
+ (s1, gimple_omp_sections_clauses (stmt));
+ break;
+
+ case GIMPLE_OMP_SINGLE:
+ s1 = remap_gimple_seq (gimple_omp_body (stmt), id);
+ copy = gimple_build_omp_single
+ (s1, gimple_omp_single_clauses (stmt));
+ break;
+
+ default:
+ gcc_unreachable ();
+ }
+ }
+ else
+ {
+ if (gimple_assign_copy_p (stmt)
+ && gimple_assign_lhs (stmt) == gimple_assign_rhs1 (stmt)
+ && auto_var_in_fn_p (gimple_assign_lhs (stmt), id->src_fn))
+ {
+ /* Here we handle statements that are not completely rewritten.
+ First we detect some inlining-induced bogosities for
+ discarding. */
+
+ /* Some assignments VAR = VAR; don't generate any rtl code
+ and thus don't count as variable modification. Avoid
+ keeping bogosities like 0 = 0. */
+ tree decl = gimple_assign_lhs (stmt), value;
+ tree *n;
+
+ n = (tree *) pointer_map_contains (id->decl_map, decl);
+ if (n)
+ {
+ value = *n;
+ STRIP_TYPE_NOPS (value);
+ if (TREE_CONSTANT (value) || TREE_READONLY (value))
+ return gimple_build_nop ();
+ }
+ }
+
+ /* Create a new deep copy of the statement. */
+ copy = gimple_copy (stmt);
+ }
+
+ /* If STMT has a block defined, map it to the newly constructed
+ block. When inlining we want statements without a block to
+ appear in the block of the function call. */
+ new_block = id->block;
+ if (gimple_block (copy))
+ {
+ tree *n;
+ n = (tree *) pointer_map_contains (id->decl_map, gimple_block (copy));
+ gcc_assert (n);
+ new_block = *n;
+ }
+
+ gimple_set_block (copy, new_block);
+
+ /* Remap all the operands in COPY. */
+ memset (&wi, 0, sizeof (wi));
+ wi.info = id;
+ walk_gimple_op (copy, remap_gimple_op_r, &wi);
+
+ /* We have to handle EH region remapping of GIMPLE_RESX specially because
+ the region number is not an operand. */
+ if (gimple_code (stmt) == GIMPLE_RESX && id->eh_region_offset)
+ {
+ gimple_resx_set_region (copy, gimple_resx_region (stmt) + id->eh_region_offset);
+ }
+ return copy;
+}
+
+
/* Copy basic block, scale profile accordingly. Edges will be taken care of
later */
@@ -799,8 +1226,9 @@ static basic_block
copy_bb (copy_body_data *id, basic_block bb, int frequency_scale,
gcov_type count_scale)
{
- block_stmt_iterator bsi, copy_bsi;
+ gimple_stmt_iterator gsi, copy_gsi;
basic_block copy_basic_block;
+ tree decl;
/* create_basic_block() will append every new block to
basic_block_info automatically. */
@@ -808,237 +1236,226 @@ copy_bb (copy_body_data *id, basic_block bb, int frequency_scale,
(basic_block) bb->prev_bb->aux);
copy_basic_block->count = bb->count * count_scale / REG_BR_PROB_BASE;
- /* We are going to rebuild frequencies from scratch. These values have just
- small importance to drive canonicalize_loop_headers. */
+ /* We are going to rebuild frequencies from scratch. These values
+ have just small importance to drive canonicalize_loop_headers. */
copy_basic_block->frequency = ((gcov_type)bb->frequency
- * frequency_scale / REG_BR_PROB_BASE);
+ * frequency_scale / REG_BR_PROB_BASE);
+
if (copy_basic_block->frequency > BB_FREQ_MAX)
copy_basic_block->frequency = BB_FREQ_MAX;
- copy_bsi = bsi_start (copy_basic_block);
- for (bsi = bsi_start (bb);
- !bsi_end_p (bsi); bsi_next (&bsi))
+ copy_gsi = gsi_start_bb (copy_basic_block);
+
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- tree stmt = bsi_stmt (bsi);
- tree orig_stmt = stmt;
+ gimple stmt = gsi_stmt (gsi);
+ gimple orig_stmt = stmt;
id->regimplify = false;
- walk_tree (&stmt, copy_body_r, id, NULL);
+ stmt = remap_gimple_stmt (stmt, id);
+ if (gimple_nop_p (stmt))
+ continue;
- /* RETURN_EXPR might be removed,
- this is signalled by making stmt pointer NULL. */
- if (stmt)
- {
- tree call, decl;
+ gimple_duplicate_stmt_histograms (cfun, stmt, id->src_cfun, orig_stmt);
- gimple_duplicate_stmt_histograms (cfun, stmt, id->src_cfun, orig_stmt);
+ /* With return slot optimization we can end up with
+ non-gimple (foo *)&this->m, fix that here. */
+ if (is_gimple_assign (stmt)
+ && gimple_assign_rhs_code (stmt) == NOP_EXPR
+ && !is_gimple_val (gimple_assign_rhs1 (stmt)))
+ {
+ tree new_rhs;
+ new_rhs = force_gimple_operand_gsi (&copy_gsi,
+ gimple_assign_rhs1 (stmt),
+ true, NULL, true, GSI_SAME_STMT);
+ gimple_assign_set_rhs1 (stmt, new_rhs);
+ }
+ else if (id->regimplify)
+ gimple_regimplify_operands (stmt, &copy_gsi);
- /* With return slot optimization we can end up with
- non-gimple (foo *)&this->m, fix that here. */
- if ((TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
- && TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 1)) == NOP_EXPR
- && !is_gimple_val (TREE_OPERAND (GIMPLE_STMT_OPERAND (stmt, 1), 0)))
- || id->regimplify)
- gimplify_stmt (&stmt);
+ gsi_insert_after (&copy_gsi, stmt, GSI_NEW_STMT);
- bsi_insert_after (&copy_bsi, stmt, BSI_NEW_STMT);
+ /* Process the new statement. The call to gimple_regimplify_operands
+ possibly turned the statement into multiple statements, we
+ need to process all of them. */
+ while (!gsi_end_p (copy_gsi))
+ {
+ if (is_gimple_call (stmt)
+ && gimple_call_va_arg_pack_p (stmt)
+ && id->gimple_call)
+ {
+ /* __builtin_va_arg_pack () should be replaced by
+ all arguments corresponding to ... in the caller. */
+ tree p;
+ gimple new_call;
+ VEC(tree, heap) *argarray;
+ size_t nargs = gimple_call_num_args (id->gimple_call);
+ size_t n;
+
+ for (p = DECL_ARGUMENTS (id->src_fn); p; p = TREE_CHAIN (p))
+ nargs--;
+
+ /* Create the new array of arguments. */
+ n = nargs + gimple_call_num_args (stmt);
+ argarray = VEC_alloc (tree, heap, n);
+ VEC_safe_grow (tree, heap, argarray, n);
+
+ /* Copy all the arguments before '...' */
+ memcpy (VEC_address (tree, argarray),
+ gimple_call_arg_ptr (stmt, 0),
+ gimple_call_num_args (stmt) * sizeof (tree));
+
+ /* Append the arguments passed in '...' */
+ memcpy (VEC_address(tree, argarray) + gimple_call_num_args (stmt),
+ gimple_call_arg_ptr (id->gimple_call, 0)
+ + (gimple_call_num_args (id->gimple_call) - nargs),
+ nargs * sizeof (tree));
+
+ new_call = gimple_build_call_vec (gimple_call_fn (stmt),
+ argarray);
+
+ VEC_free (tree, heap, argarray);
+
+ /* Copy all GIMPLE_CALL flags, location and block, except
+ GF_CALL_VA_ARG_PACK. */
+ gimple_call_copy_flags (new_call, stmt);
+ gimple_call_set_va_arg_pack (new_call, false);
+ gimple_set_location (new_call, gimple_location (stmt));
+ gimple_set_block (new_call, gimple_block (stmt));
+ gimple_call_set_lhs (new_call, gimple_call_lhs (stmt));
+
+ gsi_replace (&copy_gsi, new_call, false);
+ stmt = new_call;
+ }
+ else if (is_gimple_call (stmt)
+ && id->gimple_call
+ && (decl = gimple_call_fndecl (stmt))
+ && DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL
+ && DECL_FUNCTION_CODE (decl) == BUILT_IN_VA_ARG_PACK_LEN)
+ {
+ /* __builtin_va_arg_pack_len () should be replaced by
+ the number of anonymous arguments. */
+ size_t nargs = gimple_call_num_args (id->gimple_call);
+ tree count, p;
+ gimple new_stmt;
+
+ for (p = DECL_ARGUMENTS (id->src_fn); p; p = TREE_CHAIN (p))
+ nargs--;
+
+ count = build_int_cst (integer_type_node, nargs);
+ new_stmt = gimple_build_assign (gimple_call_lhs (stmt), count);
+ gsi_replace (&copy_gsi, new_stmt, false);
+ stmt = new_stmt;
+ }
- /* Process new statement. gimplify_stmt possibly turned statement
- into multiple statements, we need to process all of them. */
- while (!bsi_end_p (copy_bsi))
+ /* Statements produced by inlining can be unfolded, especially
+ when we constant propagated some operands. We can't fold
+ them right now for two reasons:
+ 1) folding require SSA_NAME_DEF_STMTs to be correct
+ 2) we can't change function calls to builtins.
+ So we just mark statement for later folding. We mark
+ all new statements, instead just statements that has changed
+ by some nontrivial substitution so even statements made
+ foldable indirectly are updated. If this turns out to be
+ expensive, copy_body can be told to watch for nontrivial
+ changes. */
+ if (id->statements_to_fold)
+ pointer_set_insert (id->statements_to_fold, stmt);
+
+ /* We're duplicating a CALL_EXPR. Find any corresponding
+ callgraph edges and update or duplicate them. */
+ if (is_gimple_call (stmt))
{
- tree *stmtp = bsi_stmt_ptr (copy_bsi);
- tree stmt = *stmtp;
- call = get_call_expr_in (stmt);
+ struct cgraph_node *node;
+ struct cgraph_edge *edge;
- if (call && CALL_EXPR_VA_ARG_PACK (call) && id->call_expr)
- {
- /* __builtin_va_arg_pack () should be replaced by
- all arguments corresponding to ... in the caller. */
- tree p, *argarray, new_call, *call_ptr;
- int nargs = call_expr_nargs (id->call_expr);
-
- for (p = DECL_ARGUMENTS (id->src_fn); p; p = TREE_CHAIN (p))
- nargs--;
-
- argarray = (tree *) alloca ((nargs + call_expr_nargs (call))
- * sizeof (tree));
-
- memcpy (argarray, CALL_EXPR_ARGP (call),
- call_expr_nargs (call) * sizeof (*argarray));
- memcpy (argarray + call_expr_nargs (call),
- CALL_EXPR_ARGP (id->call_expr)
- + (call_expr_nargs (id->call_expr) - nargs),
- nargs * sizeof (*argarray));
-
- new_call = build_call_array (TREE_TYPE (call),
- CALL_EXPR_FN (call),
- nargs + call_expr_nargs (call),
- argarray);
- /* Copy all CALL_EXPR flags, locus and block, except
- CALL_EXPR_VA_ARG_PACK flag. */
- CALL_EXPR_STATIC_CHAIN (new_call)
- = CALL_EXPR_STATIC_CHAIN (call);
- CALL_EXPR_TAILCALL (new_call) = CALL_EXPR_TAILCALL (call);
- CALL_EXPR_RETURN_SLOT_OPT (new_call)
- = CALL_EXPR_RETURN_SLOT_OPT (call);
- CALL_FROM_THUNK_P (new_call) = CALL_FROM_THUNK_P (call);
- CALL_CANNOT_INLINE_P (new_call)
- = CALL_CANNOT_INLINE_P (call);
- TREE_NOTHROW (new_call) = TREE_NOTHROW (call);
- SET_EXPR_LOCUS (new_call, EXPR_LOCUS (call));
- TREE_BLOCK (new_call) = TREE_BLOCK (call);
-
- call_ptr = stmtp;
- if (TREE_CODE (*call_ptr) == GIMPLE_MODIFY_STMT)
- call_ptr = &GIMPLE_STMT_OPERAND (*call_ptr, 1);
- if (TREE_CODE (*call_ptr) == WITH_SIZE_EXPR)
- call_ptr = &TREE_OPERAND (*call_ptr, 0);
- gcc_assert (*call_ptr == call);
- if (call_ptr == stmtp)
- {
- bsi_replace (&copy_bsi, new_call, true);
- stmtp = bsi_stmt_ptr (copy_bsi);
- stmt = *stmtp;
- }
- else
- {
- *call_ptr = new_call;
- stmt = *stmtp;
- update_stmt (stmt);
- }
- }
- else if (call
- && id->call_expr
- && (decl = get_callee_fndecl (call))
- && DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL
- && DECL_FUNCTION_CODE (decl)
- == BUILT_IN_VA_ARG_PACK_LEN)
+ switch (id->transform_call_graph_edges)
{
- /* __builtin_va_arg_pack_len () should be replaced by
- the number of anonymous arguments. */
- int nargs = call_expr_nargs (id->call_expr);
- tree count, *call_ptr, p;
-
- for (p = DECL_ARGUMENTS (id->src_fn); p; p = TREE_CHAIN (p))
- nargs--;
-
- count = build_int_cst (integer_type_node, nargs);
- call_ptr = stmtp;
- if (TREE_CODE (*call_ptr) == GIMPLE_MODIFY_STMT)
- call_ptr = &GIMPLE_STMT_OPERAND (*call_ptr, 1);
- if (TREE_CODE (*call_ptr) == WITH_SIZE_EXPR)
- call_ptr = &TREE_OPERAND (*call_ptr, 0);
- gcc_assert (*call_ptr == call && call_ptr != stmtp);
- *call_ptr = count;
- stmt = *stmtp;
- update_stmt (stmt);
- call = NULL_TREE;
+ case CB_CGE_DUPLICATE:
+ edge = cgraph_edge (id->src_node, orig_stmt);
+ if (edge)
+ cgraph_clone_edge (edge, id->dst_node, stmt,
+ REG_BR_PROB_BASE, 1,
+ edge->frequency, true);
+ break;
+
+ case CB_CGE_MOVE_CLONES:
+ for (node = id->dst_node->next_clone;
+ node;
+ node = node->next_clone)
+ {
+ edge = cgraph_edge (node, orig_stmt);
+ if (edge)
+ cgraph_set_call_stmt (edge, stmt);
+ }
+ /* FALLTHRU */
+
+ case CB_CGE_MOVE:
+ edge = cgraph_edge (id->dst_node, orig_stmt);
+ if (edge)
+ cgraph_set_call_stmt (edge, stmt);
+ break;
+
+ default:
+ gcc_unreachable ();
}
+ }
- /* Statements produced by inlining can be unfolded, especially
- when we constant propagated some operands. We can't fold
- them right now for two reasons:
- 1) folding require SSA_NAME_DEF_STMTs to be correct
- 2) we can't change function calls to builtins.
- So we just mark statement for later folding. We mark
- all new statements, instead just statements that has changed
- by some nontrivial substitution so even statements made
- foldable indirectly are updated. If this turns out to be
- expensive, copy_body can be told to watch for nontrivial
- changes. */
- if (id->statements_to_fold)
- pointer_set_insert (id->statements_to_fold, stmt);
- /* We're duplicating a CALL_EXPR. Find any corresponding
- callgraph edges and update or duplicate them. */
- if (call && (decl = get_callee_fndecl (call)))
- {
- struct cgraph_node *node;
- struct cgraph_edge *edge;
-
- switch (id->transform_call_graph_edges)
- {
- case CB_CGE_DUPLICATE:
- edge = cgraph_edge (id->src_node, orig_stmt);
- if (edge)
- cgraph_clone_edge (edge, id->dst_node, stmt,
- REG_BR_PROB_BASE, 1, edge->frequency, true);
- break;
-
- case CB_CGE_MOVE_CLONES:
- for (node = id->dst_node->next_clone;
- node;
- node = node->next_clone)
- {
- edge = cgraph_edge (node, orig_stmt);
- gcc_assert (edge);
- cgraph_set_call_stmt (edge, stmt);
- }
- /* FALLTHRU */
-
- case CB_CGE_MOVE:
- edge = cgraph_edge (id->dst_node, orig_stmt);
- if (edge)
- cgraph_set_call_stmt (edge, stmt);
- break;
-
- default:
- gcc_unreachable ();
- }
- }
- /* If you think we can abort here, you are wrong.
- There is no region 0 in tree land. */
- gcc_assert (lookup_stmt_eh_region_fn (id->src_cfun, orig_stmt)
- != 0);
-
- if (tree_could_throw_p (stmt)
- /* When we are cloning for inlining, we are supposed to
- construct a clone that calls precisely the same functions
- as original. However IPA optimizers might've proved
- earlier some function calls as non-trapping that might
- render some basic blocks dead that might become
- unreachable.
-
- We can't update SSA with unreachable blocks in CFG and thus
- we prevent the scenario by preserving even the "dead" eh
- edges until the point they are later removed by
- fixup_cfg pass. */
- || (id->transform_call_graph_edges == CB_CGE_MOVE_CLONES
- && lookup_stmt_eh_region_fn (id->src_cfun, orig_stmt) > 0))
- {
- int region = lookup_stmt_eh_region_fn (id->src_cfun, orig_stmt);
- /* Add an entry for the copied tree in the EH hashtable.
- When cloning or versioning, use the hashtable in
- cfun, and just copy the EH number. When inlining, use the
- hashtable in the caller, and adjust the region number. */
- if (region > 0)
- add_stmt_to_eh_region (stmt, region + id->eh_region_offset);
-
- /* If this tree doesn't have a region associated with it,
- and there is a "current region,"
- then associate this tree with the current region
- and add edges associated with this region. */
- if ((lookup_stmt_eh_region_fn (id->src_cfun,
- orig_stmt) <= 0
- && id->eh_region > 0)
- && tree_could_throw_p (stmt))
- add_stmt_to_eh_region (stmt, id->eh_region);
- }
- if (gimple_in_ssa_p (cfun))
- {
- ssa_op_iter i;
- tree def;
+ /* If you think we can abort here, you are wrong.
+ There is no region 0 in gimple. */
+ gcc_assert (lookup_stmt_eh_region_fn (id->src_cfun, orig_stmt) != 0);
+
+ if (stmt_could_throw_p (stmt)
+ /* When we are cloning for inlining, we are supposed to
+ construct a clone that calls precisely the same functions
+ as original. However IPA optimizers might've proved
+ earlier some function calls as non-trapping that might
+ render some basic blocks dead that might become
+ unreachable.
+
+ We can't update SSA with unreachable blocks in CFG and thus
+ we prevent the scenario by preserving even the "dead" eh
+ edges until the point they are later removed by
+ fixup_cfg pass. */
+ || (id->transform_call_graph_edges == CB_CGE_MOVE_CLONES
+ && lookup_stmt_eh_region_fn (id->src_cfun, orig_stmt) > 0))
+ {
+ int region = lookup_stmt_eh_region_fn (id->src_cfun, orig_stmt);
+
+ /* Add an entry for the copied tree in the EH hashtable.
+ When cloning or versioning, use the hashtable in
+ cfun, and just copy the EH number. When inlining, use the
+ hashtable in the caller, and adjust the region number. */
+ if (region > 0)
+ add_stmt_to_eh_region (stmt, region + id->eh_region_offset);
+
+ /* If this tree doesn't have a region associated with it,
+ and there is a "current region,"
+ then associate this tree with the current region
+ and add edges associated with this region. */
+ if (lookup_stmt_eh_region_fn (id->src_cfun, orig_stmt) <= 0
+ && id->eh_region > 0
+ && stmt_could_throw_p (stmt))
+ add_stmt_to_eh_region (stmt, id->eh_region);
+ }
- find_new_referenced_vars (bsi_stmt_ptr (copy_bsi));
- FOR_EACH_SSA_TREE_OPERAND (def, stmt, i, SSA_OP_DEF)
- if (TREE_CODE (def) == SSA_NAME)
- SSA_NAME_DEF_STMT (def) = stmt;
- }
- bsi_next (&copy_bsi);
+ if (gimple_in_ssa_p (cfun))
+ {
+ ssa_op_iter i;
+ tree def;
+
+ find_new_referenced_vars (gsi_stmt (copy_gsi));
+ FOR_EACH_SSA_TREE_OPERAND (def, stmt, i, SSA_OP_DEF)
+ if (TREE_CODE (def) == SSA_NAME)
+ SSA_NAME_DEF_STMT (def) = stmt;
}
- copy_bsi = bsi_last (copy_basic_block);
+
+ gsi_next (&copy_gsi);
}
+
+ copy_gsi = gsi_last_bb (copy_basic_block);
}
+
return copy_basic_block;
}
@@ -1071,27 +1488,31 @@ update_ssa_across_abnormal_edges (basic_block bb, basic_block ret_bb,
if (!e->dest->aux
|| ((basic_block)e->dest->aux)->index == ENTRY_BLOCK)
{
- tree phi;
+ gimple phi;
+ gimple_stmt_iterator si;
gcc_assert (e->flags & EDGE_ABNORMAL);
+
if (!nonlocal_goto)
gcc_assert (e->flags & EDGE_EH);
+
if (!can_throw)
gcc_assert (!(e->flags & EDGE_EH));
- for (phi = phi_nodes (e->dest); phi; phi = PHI_CHAIN (phi))
+
+ for (si = gsi_start_phis (e->dest); !gsi_end_p (si); gsi_next (&si))
{
edge re;
+ phi = gsi_stmt (si);
+
/* There shouldn't be any PHI nodes in the ENTRY_BLOCK. */
gcc_assert (!e->dest->aux);
- gcc_assert (SSA_NAME_OCCURS_IN_ABNORMAL_PHI
- (PHI_RESULT (phi)));
+ gcc_assert (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (PHI_RESULT (phi)));
if (!is_gimple_reg (PHI_RESULT (phi)))
{
- mark_sym_for_renaming
- (SSA_NAME_VAR (PHI_RESULT (phi)));
+ mark_sym_for_renaming (SSA_NAME_VAR (PHI_RESULT (phi)));
continue;
}
@@ -1106,16 +1527,18 @@ update_ssa_across_abnormal_edges (basic_block bb, basic_block ret_bb,
}
}
+
/* Copy edges from BB into its copy constructed earlier, scale profile
accordingly. Edges will be taken care of later. Assume aux
pointers to point to the copies of each BB. */
+
static void
copy_edges_for_bb (basic_block bb, gcov_type count_scale, basic_block ret_bb)
{
basic_block new_bb = (basic_block) bb->aux;
edge_iterator ei;
edge old_edge;
- block_stmt_iterator bsi;
+ gimple_stmt_iterator si;
int flags;
/* Use the indices from the original blocks to create edges for the
@@ -1123,7 +1546,7 @@ copy_edges_for_bb (basic_block bb, gcov_type count_scale, basic_block ret_bb)
FOR_EACH_EDGE (old_edge, ei, bb->succs)
if (!(old_edge->flags & EDGE_EH))
{
- edge new;
+ edge new_edge;
flags = old_edge->flags;
@@ -1131,25 +1554,26 @@ copy_edges_for_bb (basic_block bb, gcov_type count_scale, basic_block ret_bb)
if (old_edge->dest->index == EXIT_BLOCK && !old_edge->flags
&& old_edge->dest->aux != EXIT_BLOCK_PTR)
flags |= EDGE_FALLTHRU;
- new = make_edge (new_bb, (basic_block) old_edge->dest->aux, flags);
- new->count = old_edge->count * count_scale / REG_BR_PROB_BASE;
- new->probability = old_edge->probability;
+ new_edge = make_edge (new_bb, (basic_block) old_edge->dest->aux, flags);
+ new_edge->count = old_edge->count * count_scale / REG_BR_PROB_BASE;
+ new_edge->probability = old_edge->probability;
}
if (bb->index == ENTRY_BLOCK || bb->index == EXIT_BLOCK)
return;
- for (bsi = bsi_start (new_bb); !bsi_end_p (bsi);)
+ for (si = gsi_start_bb (new_bb); !gsi_end_p (si);)
{
- tree copy_stmt;
+ gimple copy_stmt;
bool can_throw, nonlocal_goto;
- copy_stmt = bsi_stmt (bsi);
+ copy_stmt = gsi_stmt (si);
update_stmt (copy_stmt);
if (gimple_in_ssa_p (cfun))
mark_symbols_for_renaming (copy_stmt);
+
/* Do this before the possible split_block. */
- bsi_next (&bsi);
+ gsi_next (&si);
/* If this tree could throw an exception, there are two
cases where we need to add abnormal edge(s): the
@@ -1162,13 +1586,12 @@ copy_edges_for_bb (basic_block bb, gcov_type count_scale, basic_block ret_bb)
propagation can change an INDIRECT_REF which throws
into a COMPONENT_REF which doesn't. If the copy
can throw, the original could also throw. */
-
- can_throw = tree_can_throw_internal (copy_stmt);
- nonlocal_goto = tree_can_make_abnormal_goto (copy_stmt);
+ can_throw = stmt_can_throw_internal (copy_stmt);
+ nonlocal_goto = stmt_can_make_abnormal_goto (copy_stmt);
if (can_throw || nonlocal_goto)
{
- if (!bsi_end_p (bsi))
+ if (!gsi_end_p (si))
/* Note that bb's predecessor edges aren't necessarily
right at this point; split_block doesn't care. */
{
@@ -1176,7 +1599,7 @@ copy_edges_for_bb (basic_block bb, gcov_type count_scale, basic_block ret_bb)
new_bb = e->dest;
new_bb->aux = e->src->aux;
- bsi = bsi_start (new_bb);
+ si = gsi_start_bb (new_bb);
}
}
@@ -1184,11 +1607,11 @@ copy_edges_for_bb (basic_block bb, gcov_type count_scale, basic_block ret_bb)
make_eh_edges (copy_stmt);
if (nonlocal_goto)
- make_abnormal_goto_edges (bb_for_stmt (copy_stmt), true);
+ make_abnormal_goto_edges (gimple_bb (copy_stmt), true);
if ((can_throw || nonlocal_goto)
&& gimple_in_ssa_p (cfun))
- update_ssa_across_abnormal_edges (bb_for_stmt (copy_stmt), ret_bb,
+ update_ssa_across_abnormal_edges (gimple_bb (copy_stmt), ret_bb,
can_throw, nonlocal_goto);
}
}
@@ -1203,27 +1626,33 @@ copy_phis_for_bb (basic_block bb, copy_body_data *id)
{
basic_block const new_bb = (basic_block) bb->aux;
edge_iterator ei;
- tree phi;
+ gimple phi;
+ gimple_stmt_iterator si;
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
+ for (si = gsi_start (phi_nodes (bb)); !gsi_end_p (si); gsi_next (&si))
{
- tree res = PHI_RESULT (phi);
- tree new_res = res;
- tree new_phi;
+ tree res, new_res;
+ gimple new_phi;
edge new_edge;
+ phi = gsi_stmt (si);
+ res = PHI_RESULT (phi);
+ new_res = res;
if (is_gimple_reg (res))
{
- walk_tree (&new_res, copy_body_r, id, NULL);
+ walk_tree (&new_res, copy_tree_body_r, id, NULL);
SSA_NAME_DEF_STMT (new_res)
= new_phi = create_phi_node (new_res, new_bb);
FOR_EACH_EDGE (new_edge, ei, new_bb->preds)
{
- edge const old_edge = find_edge ((basic_block) new_edge->src->aux, bb);
+ edge const old_edge
+ = find_edge ((basic_block) new_edge->src->aux, bb);
tree arg = PHI_ARG_DEF_FROM_EDGE (phi, old_edge);
tree new_arg = arg;
-
- walk_tree (&new_arg, copy_body_r, id, NULL);
+ tree block = id->block;
+ id->block = NULL_TREE;
+ walk_tree (&new_arg, copy_tree_body_r, id, NULL);
+ id->block = block;
gcc_assert (new_arg);
/* With return slot optimization we can end up with
non-gimple (foo *)&this->m, fix that here. */
@@ -1231,10 +1660,9 @@ copy_phis_for_bb (basic_block bb, copy_body_data *id)
&& TREE_CODE (new_arg) != FUNCTION_DECL
&& !is_gimple_val (new_arg))
{
- tree stmts = NULL_TREE;
- new_arg = force_gimple_operand (new_arg, &stmts,
- true, NULL);
- bsi_insert_on_edge_immediate (new_edge, stmts);
+ gimple_seq stmts = NULL;
+ new_arg = force_gimple_operand (new_arg, &stmts, true, NULL);
+ gsi_insert_seq_on_edge_immediate (new_edge, stmts);
}
add_phi_arg (new_phi, new_arg, new_edge);
}
@@ -1242,7 +1670,9 @@ copy_phis_for_bb (basic_block bb, copy_body_data *id)
}
}
+
/* Wrapper for remap_decl so it can be used as a callback. */
+
static tree
remap_decl_1 (tree decl, void *data)
{
@@ -1275,7 +1705,7 @@ initialize_cfun (tree new_fndecl, tree callee_fndecl, gcov_type count,
frequency_scale = count_scale;
/* Register specific tree functions. */
- tree_register_cfg_hooks ();
+ gimple_register_cfg_hooks ();
*new_cfun = *DECL_STRUCT_FUNCTION (callee_fndecl);
new_cfun->funcdef_no = get_next_funcdef_no ();
VALUE_HISTOGRAMS (new_cfun) = NULL;
@@ -1340,7 +1770,7 @@ copy_cfg_body (copy_body_data * id, gcov_type count, int frequency,
frequency_scale = count_scale;
/* Register specific tree functions. */
- tree_register_cfg_hooks ();
+ gimple_register_cfg_hooks ();
/* Must have a CFG here at this point. */
gcc_assert (ENTRY_BLOCK_PTR_FOR_FUNCTION
@@ -1348,7 +1778,6 @@ copy_cfg_body (copy_body_data * id, gcov_type count, int frequency,
cfun_to_copy = id->src_cfun = DECL_STRUCT_FUNCTION (callee_fndecl);
-
ENTRY_BLOCK_PTR_FOR_FUNCTION (cfun_to_copy)->aux = entry_block_map;
EXIT_BLOCK_PTR_FOR_FUNCTION (cfun_to_copy)->aux = exit_block_map;
entry_block_map->aux = ENTRY_BLOCK_PTR_FOR_FUNCTION (cfun_to_copy);
@@ -1361,26 +1790,31 @@ copy_cfg_body (copy_body_data * id, gcov_type count, int frequency,
= duplicate_eh_regions (cfun_to_copy, remap_decl_1, id,
0, id->eh_region);
}
+
/* Use aux pointers to map the original blocks to copy. */
FOR_EACH_BB_FN (bb, cfun_to_copy)
{
- basic_block new = copy_bb (id, bb, frequency_scale, count_scale);
- bb->aux = new;
- new->aux = bb;
+ basic_block new_bb = copy_bb (id, bb, frequency_scale, count_scale);
+ bb->aux = new_bb;
+ new_bb->aux = bb;
}
last = last_basic_block;
+
/* Now that we've duplicated the blocks, duplicate their edges. */
FOR_ALL_BB_FN (bb, cfun_to_copy)
copy_edges_for_bb (bb, count_scale, exit_block_map);
+
if (gimple_in_ssa_p (cfun))
FOR_ALL_BB_FN (bb, cfun_to_copy)
copy_phis_for_bb (bb, id);
+
FOR_ALL_BB_FN (bb, cfun_to_copy)
{
((basic_block)bb->aux)->aux = NULL;
bb->aux = NULL;
}
+
/* Zero out AUX fields of newly created block during EH edge
insertion. */
for (; last < last_basic_block; last++)
@@ -1391,21 +1825,6 @@ copy_cfg_body (copy_body_data * id, gcov_type count, int frequency,
return new_fndecl;
}
-/* Make a copy of the body of FN so that it can be inserted inline in
- another function. */
-
-tree
-copy_generic_body (copy_body_data *id)
-{
- tree body;
- tree fndecl = id->src_fn;
-
- body = DECL_SAVED_TREE (fndecl);
- walk_tree (&body, copy_body_r, id, NULL);
-
- return body;
-}
-
static tree
copy_body (copy_body_data *id, gcov_type count, int frequency,
basic_block entry_block_map, basic_block exit_block_map)
@@ -1440,7 +1859,7 @@ static void
setup_one_parameter (copy_body_data *id, tree p, tree value, tree fn,
basic_block bb, tree *vars)
{
- tree init_stmt;
+ gimple init_stmt;
tree var;
tree rhs = value;
tree def = (gimple_in_ssa_p (cfun)
@@ -1556,7 +1975,7 @@ setup_one_parameter (copy_body_data *id, tree p, tree value, tree fn,
the argument to the proper type in case it was promoted. */
if (value)
{
- block_stmt_iterator bsi = bsi_last (bb);
+ gimple_stmt_iterator si = gsi_last_bb (bb);
if (rhs == error_mark_node)
{
@@ -1566,21 +1985,20 @@ setup_one_parameter (copy_body_data *id, tree p, tree value, tree fn,
STRIP_USELESS_TYPE_CONVERSION (rhs);
- /* We want to use GIMPLE_MODIFY_STMT, not INIT_EXPR here so that we
+ /* We want to use MODIFY_EXPR, not INIT_EXPR here so that we
keep our trees in gimple form. */
if (def && gimple_in_ssa_p (cfun) && is_gimple_reg (p))
{
def = remap_ssa_name (def, id);
- init_stmt = build_gimple_modify_stmt (def, rhs);
- SSA_NAME_DEF_STMT (def) = init_stmt;
+ init_stmt = gimple_build_assign (def, rhs);
SSA_NAME_IS_DEFAULT_DEF (def) = 0;
set_default_def (var, NULL);
}
else
- init_stmt = build_gimple_modify_stmt (var, rhs);
+ init_stmt = gimple_build_assign (var, rhs);
/* If we did not create a gimple value and we did not create a gimple
- cast of a gimple value, then we will need to gimplify INIT_STMTS
+ cast of a gimple value, then we will need to gimplify INIT_STMT
at the end. Note that is_gimple_cast only checks the outer
tree code, not its operand. Thus the explicit check that its
operand is a gimple value. */
@@ -1589,54 +2007,67 @@ setup_one_parameter (copy_body_data *id, tree p, tree value, tree fn,
|| !is_gimple_val (TREE_OPERAND (rhs, 0))))
|| !is_gimple_reg (var))
{
- tree_stmt_iterator i;
+ gimple_stmt_iterator i;
+ gimple_seq seq = gimple_seq_alloc ();
struct gimplify_ctx gctx;
push_gimplify_context (&gctx);
- gimplify_stmt (&init_stmt);
+
+ i = gsi_start (seq);
+ gimple_regimplify_operands (init_stmt, &i);
+
if (gimple_in_ssa_p (cfun)
- && init_stmt && TREE_CODE (init_stmt) == STATEMENT_LIST)
+ && init_stmt
+ && !gimple_seq_empty_p (seq))
{
/* The replacement can expose previously unreferenced
variables. */
- for (i = tsi_start (init_stmt); !tsi_end_p (i); tsi_next (&i))
- find_new_referenced_vars (tsi_stmt_ptr (i));
+ for (i = gsi_start (seq); !gsi_end_p (i); gsi_next (&i))
+ find_new_referenced_vars (gsi_stmt (i));
+
+ /* Insert the gimplified sequence needed for INIT_STMT
+ after SI. INIT_STMT will be inserted after SEQ. */
+ gsi_insert_seq_after (&si, seq, GSI_NEW_STMT);
}
+
pop_gimplify_context (NULL);
}
/* If VAR represents a zero-sized variable, it's possible that the
assignment statement may result in no gimple statements. */
if (init_stmt)
- bsi_insert_after (&bsi, init_stmt, BSI_NEW_STMT);
+ gsi_insert_after (&si, init_stmt, GSI_NEW_STMT);
+
if (gimple_in_ssa_p (cfun))
- for (;!bsi_end_p (bsi); bsi_next (&bsi))
- mark_symbols_for_renaming (bsi_stmt (bsi));
+ for (;!gsi_end_p (si); gsi_next (&si))
+ mark_symbols_for_renaming (gsi_stmt (si));
}
}
/* Generate code to initialize the parameters of the function at the
- top of the stack in ID from the CALL_EXPR EXP. */
+ top of the stack in ID from the GIMPLE_CALL STMT. */
static void
-initialize_inlined_parameters (copy_body_data *id, tree exp,
+initialize_inlined_parameters (copy_body_data *id, gimple stmt,
tree fn, basic_block bb)
{
tree parms;
- tree a;
+ size_t i;
tree p;
tree vars = NULL_TREE;
- call_expr_arg_iterator iter;
- tree static_chain = CALL_EXPR_STATIC_CHAIN (exp);
+ tree static_chain = gimple_call_chain (stmt);
/* Figure out what the parameters are. */
parms = DECL_ARGUMENTS (fn);
/* Loop through the parameter declarations, replacing each with an
equivalent VAR_DECL, appropriately initialized. */
- for (p = parms, a = first_call_expr_arg (exp, &iter); p;
- a = next_call_expr_arg (&iter), p = TREE_CHAIN (p))
- setup_one_parameter (id, p, a, fn, bb, &vars);
+ for (p = parms, i = 0; p; p = TREE_CHAIN (p), i++)
+ {
+ tree val;
+ val = i < gimple_call_num_args (stmt) ? gimple_call_arg (stmt, i) : NULL;
+ setup_one_parameter (id, p, val, fn, bb, &vars);
+ }
/* Initialize the static chain. */
p = DECL_STRUCT_FUNCTION (fn)->static_chain_decl;
@@ -1652,6 +2083,7 @@ initialize_inlined_parameters (copy_body_data *id, tree exp,
declare_inline_vars (id->block, vars);
}
+
/* Declare a return variable to replace the RESULT_DECL for the
function we are calling. An appropriate DECL_STMT is returned.
The USE_STMT is filled to contain a use of the declaration to
@@ -1659,7 +2091,7 @@ initialize_inlined_parameters (copy_body_data *id, tree exp,
RETURN_SLOT, if non-null is place where to store the result. It
is set only for CALL_EXPR_RETURN_SLOT_OPT. MODIFY_DEST, if non-null,
- was the LHS of the GIMPLE_MODIFY_STMT to which this call is the RHS.
+ was the LHS of the MODIFY_EXPR to which this call is the RHS.
The return value is a (possibly null) value that is the result of the
function as seen by the callee. *USE_P is a (possibly null) value that
@@ -1839,37 +2271,89 @@ declare_return_variable (copy_body_data *id, tree return_slot, tree modify_dest,
bool
tree_inlinable_function_p (tree fn)
{
- return inlinable_function_p (fn);
+ bool ret = inlinable_function_p (fn);
+
+ if (getenv ("TUPLES_INLINE"))
+ fprintf (stderr, "Function %s is %sinlinable\n", get_name (fn),
+ ret ? "" : "not ");
+
+ return ret;
}
static const char *inline_forbidden_reason;
+/* A callback for walk_gimple_seq to handle tree operands. Returns
+ NULL_TREE if a function can be inlined, otherwise sets the reason
+ why not and returns a tree representing the offending operand. */
+
static tree
-inline_forbidden_p_1 (tree *nodep, int *walk_subtrees ATTRIBUTE_UNUSED,
- void *fnp)
+inline_forbidden_p_op (tree *nodep, int *walk_subtrees ATTRIBUTE_UNUSED,
+ void *fnp ATTRIBUTE_UNUSED)
{
tree node = *nodep;
- tree fn = (tree) fnp;
tree t;
- switch (TREE_CODE (node))
+ if (TREE_CODE (node) == RECORD_TYPE || TREE_CODE (node) == UNION_TYPE)
{
- case CALL_EXPR:
+ /* We cannot inline a function of the form
+
+ void F (int i) { struct S { int ar[i]; } s; }
+
+ Attempting to do so produces a catch-22.
+ If walk_tree examines the TYPE_FIELDS chain of RECORD_TYPE/
+ UNION_TYPE nodes, then it goes into infinite recursion on a
+ structure containing a pointer to its own type. If it doesn't,
+ then the type node for S doesn't get adjusted properly when
+ F is inlined.
+
+ ??? This is likely no longer true, but it's too late in the 4.0
+ cycle to try to find out. This should be checked for 4.1. */
+ for (t = TYPE_FIELDS (node); t; t = TREE_CHAIN (t))
+ if (variably_modified_type_p (TREE_TYPE (t), NULL))
+ {
+ inline_forbidden_reason
+ = G_("function %q+F can never be inlined "
+ "because it uses variable sized variables");
+ return node;
+ }
+ }
+
+ return NULL_TREE;
+}
+
+
+/* A callback for walk_gimple_seq to handle statements. Returns
+ non-NULL iff a function can not be inlined. Also sets the reason
+ why. */
+
+static tree
+inline_forbidden_p_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p,
+ struct walk_stmt_info *wip)
+{
+ tree fn = (tree) wip->info;
+ tree t;
+ gimple stmt = gsi_stmt (*gsi);
+
+ switch (gimple_code (stmt))
+ {
+ case GIMPLE_CALL:
/* Refuse to inline alloca call unless user explicitly forced so as
this may change program's memory overhead drastically when the
function using alloca is called in loop. In GCC present in
SPEC2000 inlining into schedule_block cause it to require 2GB of
RAM instead of 256MB. */
- if (alloca_call_p (node)
+ if (gimple_alloca_call_p (stmt)
&& !lookup_attribute ("always_inline", DECL_ATTRIBUTES (fn)))
{
inline_forbidden_reason
= G_("function %q+F can never be inlined because it uses "
"alloca (override using the always_inline attribute)");
- return node;
+ *handled_ops_p = true;
+ return fn;
}
- t = get_callee_fndecl (node);
- if (! t)
+
+ t = gimple_call_fndecl (stmt);
+ if (t == NULL_TREE)
break;
/* We cannot inline functions that call setjmp. */
@@ -1877,7 +2361,8 @@ inline_forbidden_p_1 (tree *nodep, int *walk_subtrees ATTRIBUTE_UNUSED,
{
inline_forbidden_reason
= G_("function %q+F can never be inlined because it uses setjmp");
- return node;
+ *handled_ops_p = true;
+ return t;
}
if (DECL_BUILT_IN_CLASS (t) == BUILT_IN_NORMAL)
@@ -1891,7 +2376,8 @@ inline_forbidden_p_1 (tree *nodep, int *walk_subtrees ATTRIBUTE_UNUSED,
inline_forbidden_reason
= G_("function %q+F can never be inlined because it "
"uses variable argument lists");
- return node;
+ *handled_ops_p = true;
+ return t;
case BUILT_IN_LONGJMP:
/* We can't inline functions that call __builtin_longjmp at
@@ -1902,14 +2388,16 @@ inline_forbidden_p_1 (tree *nodep, int *walk_subtrees ATTRIBUTE_UNUSED,
inline_forbidden_reason
= G_("function %q+F can never be inlined because "
"it uses setjmp-longjmp exception handling");
- return node;
+ *handled_ops_p = true;
+ return t;
case BUILT_IN_NONLOCAL_GOTO:
/* Similarly. */
inline_forbidden_reason
= G_("function %q+F can never be inlined because "
"it uses non-local goto");
- return node;
+ *handled_ops_p = true;
+ return t;
case BUILT_IN_RETURN:
case BUILT_IN_APPLY_ARGS:
@@ -1920,15 +2408,16 @@ inline_forbidden_p_1 (tree *nodep, int *walk_subtrees ATTRIBUTE_UNUSED,
inline_forbidden_reason
= G_("function %q+F can never be inlined because "
"it uses __builtin_return or __builtin_apply_args");
- return node;
+ *handled_ops_p = true;
+ return t;
default:
break;
}
break;
- case GOTO_EXPR:
- t = TREE_OPERAND (node, 0);
+ case GIMPLE_GOTO:
+ t = gimple_goto_dest (stmt);
/* We will not inline a function which uses computed goto. The
addresses of its local labels, which may be tucked into
@@ -1939,12 +2428,13 @@ inline_forbidden_p_1 (tree *nodep, int *walk_subtrees ATTRIBUTE_UNUSED,
inline_forbidden_reason
= G_("function %q+F can never be inlined "
"because it contains a computed goto");
- return node;
+ *handled_ops_p = true;
+ return t;
}
break;
- case LABEL_EXPR:
- t = TREE_OPERAND (node, 0);
+ case GIMPLE_LABEL:
+ t = gimple_label_label (stmt);
if (DECL_NONLOCAL (t))
{
/* We cannot inline a function that receives a non-local goto
@@ -1953,41 +2443,20 @@ inline_forbidden_p_1 (tree *nodep, int *walk_subtrees ATTRIBUTE_UNUSED,
inline_forbidden_reason
= G_("function %q+F can never be inlined "
"because it receives a non-local goto");
- return node;
+ *handled_ops_p = true;
+ return t;
}
break;
- case RECORD_TYPE:
- case UNION_TYPE:
- /* We cannot inline a function of the form
-
- void F (int i) { struct S { int ar[i]; } s; }
-
- Attempting to do so produces a catch-22.
- If walk_tree examines the TYPE_FIELDS chain of RECORD_TYPE/
- UNION_TYPE nodes, then it goes into infinite recursion on a
- structure containing a pointer to its own type. If it doesn't,
- then the type node for S doesn't get adjusted properly when
- F is inlined.
-
- ??? This is likely no longer true, but it's too late in the 4.0
- cycle to try to find out. This should be checked for 4.1. */
- for (t = TYPE_FIELDS (node); t; t = TREE_CHAIN (t))
- if (variably_modified_type_p (TREE_TYPE (t), NULL))
- {
- inline_forbidden_reason
- = G_("function %q+F can never be inlined "
- "because it uses variable sized variables");
- return node;
- }
-
default:
break;
}
+ *handled_ops_p = false;
return NULL_TREE;
}
+
static tree
inline_forbidden_p_2 (tree *nodep, int *walk_subtrees,
void *fnp)
@@ -2009,25 +2478,35 @@ inline_forbidden_p_2 (tree *nodep, int *walk_subtrees,
return NULL_TREE;
}
-/* Return subexpression representing possible alloca call, if any. */
-static tree
+/* Return true if FNDECL is a function that cannot be inlined into
+ another one. */
+
+static bool
inline_forbidden_p (tree fndecl)
{
location_t saved_loc = input_location;
- block_stmt_iterator bsi;
- basic_block bb;
- tree ret = NULL_TREE;
struct function *fun = DECL_STRUCT_FUNCTION (fndecl);
tree step;
+ struct walk_stmt_info wi;
+ struct pointer_set_t *visited_nodes;
+ basic_block bb;
+ bool forbidden_p = false;
+
+ visited_nodes = pointer_set_create ();
+ memset (&wi, 0, sizeof (wi));
+ wi.info = (void *) fndecl;
+ wi.pset = visited_nodes;
FOR_EACH_BB_FN (bb, fun)
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
- {
- ret = walk_tree_without_duplicates (bsi_stmt_ptr (bsi),
- inline_forbidden_p_1, fndecl);
- if (ret)
- goto egress;
- }
+ {
+ gimple ret;
+ gimple_seq seq = bb_seq (bb);
+ ret = walk_gimple_seq (seq, inline_forbidden_p_stmt,
+ inline_forbidden_p_op, &wi);
+ forbidden_p = (ret != NULL);
+ if (forbidden_p)
+ goto egress;
+ }
for (step = fun->local_decls; step; step = TREE_CHAIN (step))
{
@@ -2036,15 +2515,20 @@ inline_forbidden_p (tree fndecl)
&& TREE_STATIC (decl)
&& !DECL_EXTERNAL (decl)
&& DECL_INITIAL (decl))
- ret = walk_tree_without_duplicates (&DECL_INITIAL (decl),
- inline_forbidden_p_2, fndecl);
- if (ret)
- goto egress;
+ {
+ tree ret;
+ ret = walk_tree_without_duplicates (&DECL_INITIAL (decl),
+ inline_forbidden_p_2, fndecl);
+ forbidden_p = (ret != NULL);
+ if (forbidden_p)
+ goto egress;
+ }
}
egress:
+ pointer_set_destroy (visited_nodes);
input_location = saved_loc;
- return ret;
+ return forbidden_p;
}
/* Returns nonzero if FN is a function that does not have any
@@ -2064,13 +2548,12 @@ inlinable_function_p (tree fn)
/* We only warn for functions declared `inline' by the user. */
do_warning = (warn_inline
- && DECL_INLINE (fn)
&& DECL_DECLARED_INLINE_P (fn)
&& !DECL_IN_SYSTEM_HEADER (fn));
always_inline = lookup_attribute ("always_inline", DECL_ATTRIBUTES (fn));
- if (flag_really_no_inline
+ if (flag_no_inline
&& always_inline == NULL)
{
if (do_warning)
@@ -2096,27 +2579,9 @@ inlinable_function_p (tree fn)
/* If we don't have the function body available, we can't inline it.
However, this should not be recorded since we also get here for
forward declared inline functions. Therefore, return at once. */
- if (!DECL_SAVED_TREE (fn))
+ if (!gimple_body (fn))
return false;
- /* If we're not inlining at all, then we cannot inline this function. */
- else if (!flag_inline_trees)
- inlinable = false;
-
- /* Only try to inline functions if DECL_INLINE is set. This should be
- true for all functions declared `inline', and for all other functions
- as well with -finline-functions.
-
- Don't think of disregarding DECL_INLINE when flag_inline_trees == 2;
- it's the front-end that must set DECL_INLINE in this case, because
- dwarf2out loses if a function that does not have DECL_INLINE set is
- inlined anyway. That is why we have both DECL_INLINE and
- DECL_DECLARED_INLINE_P. */
- /* FIXME: When flag_inline_trees dies, the check for flag_unit_at_a_time
- here should be redundant. */
- else if (!DECL_INLINE (fn) && !flag_unit_at_a_time)
- inlinable = false;
-
else if (inline_forbidden_p (fn))
{
/* See if we should warn about uninlinable functions. Previously,
@@ -2157,151 +2622,21 @@ estimate_move_cost (tree type)
return ((size + MOVE_MAX_PIECES - 1) / MOVE_MAX_PIECES);
}
-/* Arguments for estimate_num_insns_1. */
+/* Returns cost of operation CODE, according to WEIGHTS */
-struct eni_data
+static int
+estimate_operator_cost (enum tree_code code, eni_weights *weights)
{
- /* Used to return the number of insns. */
- int count;
-
- /* Weights of various constructs. */
- eni_weights *weights;
-};
-
-/* Used by estimate_num_insns. Estimate number of instructions seen
- by given statement. */
-
-static tree
-estimate_num_insns_1 (tree *tp, int *walk_subtrees, void *data)
-{
- struct eni_data *const d = (struct eni_data *) data;
- tree x = *tp;
- unsigned cost;
-
- if (IS_TYPE_OR_DECL_P (x))
+ switch (code)
{
- *walk_subtrees = 0;
- return NULL;
- }
- /* Assume that constants and references counts nothing. These should
- be majorized by amount of operations among them we count later
- and are common target of CSE and similar optimizations. */
- else if (CONSTANT_CLASS_P (x) || REFERENCE_CLASS_P (x))
- return NULL;
-
- switch (TREE_CODE (x))
- {
- /* Containers have no cost. */
- case TREE_LIST:
- case TREE_VEC:
- case BLOCK:
- case COMPONENT_REF:
- case BIT_FIELD_REF:
- case INDIRECT_REF:
- case ALIGN_INDIRECT_REF:
- case MISALIGNED_INDIRECT_REF:
- case ARRAY_REF:
- case ARRAY_RANGE_REF:
- case OBJ_TYPE_REF:
- case EXC_PTR_EXPR: /* ??? */
- case FILTER_EXPR: /* ??? */
- case COMPOUND_EXPR:
- case BIND_EXPR:
- case WITH_CLEANUP_EXPR:
- case PAREN_EXPR:
- CASE_CONVERT:
- case VIEW_CONVERT_EXPR:
- case SAVE_EXPR:
- case ADDR_EXPR:
- case COMPLEX_EXPR:
+ /* These are "free" conversions, or their presumed cost
+ is folded into other operations. */
case RANGE_EXPR:
- case CASE_LABEL_EXPR:
- case SSA_NAME:
- case CATCH_EXPR:
- case EH_FILTER_EXPR:
- case STATEMENT_LIST:
- case ERROR_MARK:
- case FDESC_EXPR:
- case VA_ARG_EXPR:
- case TRY_CATCH_EXPR:
- case TRY_FINALLY_EXPR:
- case LABEL_EXPR:
- case GOTO_EXPR:
- case RETURN_EXPR:
- case EXIT_EXPR:
- case LOOP_EXPR:
- case PHI_NODE:
- case WITH_SIZE_EXPR:
- case OMP_CLAUSE:
- case OMP_RETURN:
- case OMP_CONTINUE:
- case OMP_SECTIONS_SWITCH:
- case OMP_ATOMIC_STORE:
- break;
-
- /* We don't account constants for now. Assume that the cost is amortized
- by operations that do use them. We may re-consider this decision once
- we are able to optimize the tree before estimating its size and break
- out static initializers. */
- case IDENTIFIER_NODE:
- case INTEGER_CST:
- case REAL_CST:
- case FIXED_CST:
- case COMPLEX_CST:
- case VECTOR_CST:
- case STRING_CST:
- case PREDICT_EXPR:
- *walk_subtrees = 0;
- return NULL;
-
- /* CHANGE_DYNAMIC_TYPE_EXPR explicitly expands to nothing. */
- case CHANGE_DYNAMIC_TYPE_EXPR:
- *walk_subtrees = 0;
- return NULL;
-
- /* Try to estimate the cost of assignments. We have three cases to
- deal with:
- 1) Simple assignments to registers;
- 2) Stores to things that must live in memory. This includes
- "normal" stores to scalars, but also assignments of large
- structures, or constructors of big arrays;
- 3) TARGET_EXPRs.
-
- Let us look at the first two cases, assuming we have "a = b + C":
- <GIMPLE_MODIFY_STMT <var_decl "a">
- <plus_expr <var_decl "b"> <constant C>>
- If "a" is a GIMPLE register, the assignment to it is free on almost
- any target, because "a" usually ends up in a real register. Hence
- the only cost of this expression comes from the PLUS_EXPR, and we
- can ignore the GIMPLE_MODIFY_STMT.
- If "a" is not a GIMPLE register, the assignment to "a" will most
- likely be a real store, so the cost of the GIMPLE_MODIFY_STMT is the cost
- of moving something into "a", which we compute using the function
- estimate_move_cost.
-
- The third case deals with TARGET_EXPRs, for which the semantics are
- that a temporary is assigned, unless the TARGET_EXPR itself is being
- assigned to something else. In the latter case we do not need the
- temporary. E.g. in:
- <GIMPLE_MODIFY_STMT <var_decl "a"> <target_expr>>, the
- GIMPLE_MODIFY_STMT is free. */
- case INIT_EXPR:
- case GIMPLE_MODIFY_STMT:
- /* Is the right and side a TARGET_EXPR? */
- if (TREE_CODE (GENERIC_TREE_OPERAND (x, 1)) == TARGET_EXPR)
- break;
- /* ... fall through ... */
-
- case TARGET_EXPR:
- x = GENERIC_TREE_OPERAND (x, 0);
- /* Is this an assignments to a register? */
- if (is_gimple_reg (x))
- break;
- /* Otherwise it's a store, so fall through to compute the move cost. */
-
- case CONSTRUCTOR:
- d->count += estimate_move_cost (TREE_TYPE (x));
- break;
+ case CONVERT_EXPR:
+ case COMPLEX_EXPR:
+ case PAREN_EXPR:
+ case NOP_EXPR:
+ return 0;
/* Assign cost of 1 to usual operations.
??? We may consider mapping RTL costs to this. */
@@ -2364,15 +2699,15 @@ estimate_num_insns_1 (tree *tp, int *walk_subtrees, void *data)
case POSTDECREMENT_EXPR:
case POSTINCREMENT_EXPR:
- case ASM_EXPR:
-
case REALIGN_LOAD_EXPR:
case REDUC_MAX_EXPR:
case REDUC_MIN_EXPR:
case REDUC_PLUS_EXPR:
case WIDEN_SUM_EXPR:
- case DOT_PROD_EXPR:
+ case WIDEN_MULT_EXPR:
+ case DOT_PROD_EXPR:
+
case VEC_WIDEN_MULT_HI_EXPR:
case VEC_WIDEN_MULT_LO_EXPR:
case VEC_UNPACK_HI_EXPR:
@@ -2382,26 +2717,12 @@ estimate_num_insns_1 (tree *tp, int *walk_subtrees, void *data)
case VEC_PACK_TRUNC_EXPR:
case VEC_PACK_SAT_EXPR:
case VEC_PACK_FIX_TRUNC_EXPR:
-
- case WIDEN_MULT_EXPR:
-
case VEC_EXTRACT_EVEN_EXPR:
case VEC_EXTRACT_ODD_EXPR:
case VEC_INTERLEAVE_HIGH_EXPR:
case VEC_INTERLEAVE_LOW_EXPR:
- case RESX_EXPR:
- d->count += 1;
- break;
-
- case SWITCH_EXPR:
- /* Take into account cost of the switch + guess 2 conditional jumps for
- each case label.
-
- TODO: once the switch expansion logic is sufficiently separated, we can
- do better job on estimating cost of the switch. */
- d->count += TREE_VEC_LENGTH (SWITCH_LABELS (x)) * 2;
- break;
+ return 1;
/* Few special cases of expensive operations. This is useful
to avoid inlining on functions having too many of these. */
@@ -2415,34 +2736,115 @@ estimate_num_insns_1 (tree *tp, int *walk_subtrees, void *data)
case FLOOR_MOD_EXPR:
case ROUND_MOD_EXPR:
case RDIV_EXPR:
- d->count += d->weights->div_mod_cost;
+ return weights->div_mod_cost;
+
+ default:
+ /* We expect a copy assignment with no operator. */
+ gcc_assert (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS);
+ return 0;
+ }
+}
+
+
+/* Estimate number of instructions that will be created by expanding
+ the statements in the statement sequence STMTS.
+ WEIGHTS contains weights attributed to various constructs. */
+
+static
+int estimate_num_insns_seq (gimple_seq stmts, eni_weights *weights)
+{
+ int cost;
+ gimple_stmt_iterator gsi;
+
+ cost = 0;
+ for (gsi = gsi_start (stmts); !gsi_end_p (gsi); gsi_next (&gsi))
+ cost += estimate_num_insns (gsi_stmt (gsi), weights);
+
+ return cost;
+}
+
+
+/* Estimate number of instructions that will be created by expanding STMT.
+ WEIGHTS contains weights attributed to various constructs. */
+
+int
+estimate_num_insns (gimple stmt, eni_weights *weights)
+{
+ unsigned cost, i;
+ enum gimple_code code = gimple_code (stmt);
+ tree lhs;
+
+ switch (code)
+ {
+ case GIMPLE_ASSIGN:
+ /* Try to estimate the cost of assignments. We have three cases to
+ deal with:
+ 1) Simple assignments to registers;
+ 2) Stores to things that must live in memory. This includes
+ "normal" stores to scalars, but also assignments of large
+ structures, or constructors of big arrays;
+
+ Let us look at the first two cases, assuming we have "a = b + C":
+ <GIMPLE_ASSIGN <var_decl "a">
+ <plus_expr <var_decl "b"> <constant C>>
+ If "a" is a GIMPLE register, the assignment to it is free on almost
+ any target, because "a" usually ends up in a real register. Hence
+ the only cost of this expression comes from the PLUS_EXPR, and we
+ can ignore the GIMPLE_ASSIGN.
+ If "a" is not a GIMPLE register, the assignment to "a" will most
+ likely be a real store, so the cost of the GIMPLE_ASSIGN is the cost
+ of moving something into "a", which we compute using the function
+ estimate_move_cost. */
+ lhs = gimple_assign_lhs (stmt);
+ if (is_gimple_reg (lhs))
+ cost = 0;
+ else
+ cost = estimate_move_cost (TREE_TYPE (lhs));
+
+ cost += estimate_operator_cost (gimple_assign_rhs_code (stmt), weights);
+ break;
+
+ case GIMPLE_COND:
+ cost = 1 + estimate_operator_cost (gimple_cond_code (stmt), weights);
+ break;
+
+ case GIMPLE_SWITCH:
+ /* Take into account cost of the switch + guess 2 conditional jumps for
+ each case label.
+
+ TODO: once the switch expansion logic is sufficiently separated, we can
+ do better job on estimating cost of the switch. */
+ cost = gimple_switch_num_labels (stmt) * 2;
break;
- case CALL_EXPR:
+
+ case GIMPLE_CALL:
{
- tree decl = get_callee_fndecl (x);
- tree addr = CALL_EXPR_FN (x);
+ tree decl = gimple_call_fndecl (stmt);
+ tree addr = gimple_call_fn (stmt);
tree funtype = TREE_TYPE (addr);
- gcc_assert (POINTER_TYPE_P (funtype));
- funtype = TREE_TYPE (funtype);
+ if (POINTER_TYPE_P (funtype))
+ funtype = TREE_TYPE (funtype);
if (decl && DECL_BUILT_IN_CLASS (decl) == BUILT_IN_MD)
- cost = d->weights->target_builtin_call_cost;
+ cost = weights->target_builtin_call_cost;
else
- cost = d->weights->call_cost;
+ cost = weights->call_cost;
if (decl && DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL)
switch (DECL_FUNCTION_CODE (decl))
{
case BUILT_IN_CONSTANT_P:
- *walk_subtrees = 0;
- return NULL_TREE;
+ return 0;
case BUILT_IN_EXPECT:
- return NULL_TREE;
+ cost = 0;
+ break;
+
/* Prefetch instruction is not expensive. */
case BUILT_IN_PREFETCH:
- cost = 1;
+ cost = weights->target_builtin_call_cost;
break;
+
default:
break;
}
@@ -2450,96 +2852,117 @@ estimate_num_insns_1 (tree *tp, int *walk_subtrees, void *data)
if (decl)
funtype = TREE_TYPE (decl);
- /* Our cost must be kept in sync with cgraph_estimate_size_after_inlining
- that does use function declaration to figure out the arguments.
-
- When we deal with function with no body nor prototype, base estimates on
- actual parameters of the call expression. Otherwise use either the actual
- arguments types or function declaration for more precise answer. */
+ /* Our cost must be kept in sync with
+ cgraph_estimate_size_after_inlining that does use function
+ declaration to figure out the arguments. */
if (decl && DECL_ARGUMENTS (decl))
{
tree arg;
for (arg = DECL_ARGUMENTS (decl); arg; arg = TREE_CHAIN (arg))
- d->count += estimate_move_cost (TREE_TYPE (arg));
+ cost += estimate_move_cost (TREE_TYPE (arg));
}
else if (funtype && prototype_p (funtype))
{
tree t;
for (t = TYPE_ARG_TYPES (funtype); t; t = TREE_CHAIN (t))
- d->count += estimate_move_cost (TREE_VALUE (t));
+ cost += estimate_move_cost (TREE_VALUE (t));
}
else
{
- tree a;
- call_expr_arg_iterator iter;
- FOR_EACH_CALL_EXPR_ARG (a, iter, x)
- d->count += estimate_move_cost (TREE_TYPE (a));
+ for (i = 0; i < gimple_call_num_args (stmt); i++)
+ {
+ tree arg = gimple_call_arg (stmt, i);
+ cost += estimate_move_cost (TREE_TYPE (arg));
+ }
}
- d->count += cost;
break;
}
- case OMP_PARALLEL:
- case OMP_TASK:
- case OMP_FOR:
- case OMP_SECTIONS:
- case OMP_SINGLE:
- case OMP_SECTION:
- case OMP_MASTER:
- case OMP_ORDERED:
- case OMP_CRITICAL:
- case OMP_ATOMIC:
- case OMP_ATOMIC_LOAD:
- /* OpenMP directives are generally very expensive. */
- d->count += d->weights->omp_cost;
- break;
+ case GIMPLE_GOTO:
+ case GIMPLE_LABEL:
+ case GIMPLE_NOP:
+ case GIMPLE_PHI:
+ case GIMPLE_RETURN:
+ case GIMPLE_CHANGE_DYNAMIC_TYPE:
+ case GIMPLE_PREDICT:
+ return 0;
+
+ case GIMPLE_ASM:
+ case GIMPLE_RESX:
+ return 1;
+
+ case GIMPLE_BIND:
+ return estimate_num_insns_seq (gimple_bind_body (stmt), weights);
+
+ case GIMPLE_EH_FILTER:
+ return estimate_num_insns_seq (gimple_eh_filter_failure (stmt), weights);
+
+ case GIMPLE_CATCH:
+ return estimate_num_insns_seq (gimple_catch_handler (stmt), weights);
+
+ case GIMPLE_TRY:
+ return (estimate_num_insns_seq (gimple_try_eval (stmt), weights)
+ + estimate_num_insns_seq (gimple_try_cleanup (stmt), weights));
+
+ /* OpenMP directives are generally very expensive. */
+
+ case GIMPLE_OMP_RETURN:
+ case GIMPLE_OMP_SECTIONS_SWITCH:
+ case GIMPLE_OMP_ATOMIC_STORE:
+ case GIMPLE_OMP_CONTINUE:
+ /* ...except these, which are cheap. */
+ return 0;
+
+ case GIMPLE_OMP_ATOMIC_LOAD:
+ return weights->omp_cost;
+
+ case GIMPLE_OMP_FOR:
+ return (weights->omp_cost
+ + estimate_num_insns_seq (gimple_omp_body (stmt), weights)
+ + estimate_num_insns_seq (gimple_omp_for_pre_body (stmt), weights));
+
+ case GIMPLE_OMP_PARALLEL:
+ case GIMPLE_OMP_TASK:
+ case GIMPLE_OMP_CRITICAL:
+ case GIMPLE_OMP_MASTER:
+ case GIMPLE_OMP_ORDERED:
+ case GIMPLE_OMP_SECTION:
+ case GIMPLE_OMP_SECTIONS:
+ case GIMPLE_OMP_SINGLE:
+ return (weights->omp_cost
+ + estimate_num_insns_seq (gimple_omp_body (stmt), weights));
default:
gcc_unreachable ();
}
- return NULL;
+
+ return cost;
}
-/* Estimate number of instructions that will be created by expanding EXPR.
- WEIGHTS contains weights attributed to various constructs. */
+/* Estimate number of instructions that will be created by expanding
+ function FNDECL. WEIGHTS contains weights attributed to various
+ constructs. */
int
-estimate_num_insns (tree expr, eni_weights *weights)
+estimate_num_insns_fn (tree fndecl, eni_weights *weights)
{
- struct pointer_set_t *visited_nodes;
+ struct function *my_function = DECL_STRUCT_FUNCTION (fndecl);
+ gimple_stmt_iterator bsi;
basic_block bb;
- block_stmt_iterator bsi;
- struct function *my_function;
- struct eni_data data;
+ int n = 0;
- data.count = 0;
- data.weights = weights;
-
- /* If we're given an entire function, walk the CFG. */
- if (TREE_CODE (expr) == FUNCTION_DECL)
+ gcc_assert (my_function && my_function->cfg);
+ FOR_EACH_BB_FN (bb, my_function)
{
- my_function = DECL_STRUCT_FUNCTION (expr);
- gcc_assert (my_function && my_function->cfg);
- visited_nodes = pointer_set_create ();
- FOR_EACH_BB_FN (bb, my_function)
- {
- for (bsi = bsi_start (bb);
- !bsi_end_p (bsi);
- bsi_next (&bsi))
- {
- walk_tree (bsi_stmt_ptr (bsi), estimate_num_insns_1,
- &data, visited_nodes);
- }
- }
- pointer_set_destroy (visited_nodes);
+ for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
+ n += estimate_num_insns (gsi_stmt (bsi), weights);
}
- else
- walk_tree_without_duplicates (&expr, estimate_num_insns_1, &data);
- return data.count;
+ return n;
}
+
/* Initializes weights used by estimate_num_insns. */
void
@@ -2565,7 +2988,22 @@ init_inline_once (void)
eni_time_weights.omp_cost = 40;
}
+/* Estimate the number of instructions in a gimple_seq. */
+
+int
+count_insns_seq (gimple_seq seq, eni_weights *weights)
+{
+ gimple_stmt_iterator gsi;
+ int n = 0;
+ for (gsi = gsi_start (seq); !gsi_end_p (gsi); gsi_next (&gsi))
+ n += estimate_num_insns (gsi_stmt (gsi), weights);
+
+ return n;
+}
+
+
/* Install new lexical TREE_BLOCK underneath 'current_block'. */
+
static void
add_lexical_block (tree current_block, tree new_block)
{
@@ -2580,13 +3018,25 @@ add_lexical_block (tree current_block, tree new_block)
BLOCK_SUPERCONTEXT (new_block) = current_block;
}
-/* If *TP is a CALL_EXPR, replace it with its inline expansion. */
+/* Fetch callee declaration from the call graph edge going from NODE and
+ associated with STMR call statement. Return NULL_TREE if not found. */
+static tree
+get_indirect_callee_fndecl (struct cgraph_node *node, gimple stmt)
+{
+ struct cgraph_edge *cs;
+
+ cs = cgraph_edge (node, stmt);
+ if (cs)
+ return cs->callee->decl;
+
+ return NULL_TREE;
+}
+
+/* If STMT is a GIMPLE_CALL, replace it with its inline expansion. */
static bool
-expand_call_inline (basic_block bb, tree stmt, tree *tp, void *data)
+expand_call_inline (basic_block bb, gimple stmt, copy_body_data *id)
{
- copy_body_data *id;
- tree t;
tree retvar, use_retvar;
tree fn;
struct pointer_map_t *st;
@@ -2597,45 +3047,45 @@ expand_call_inline (basic_block bb, tree stmt, tree *tp, void *data)
const char *reason;
basic_block return_block;
edge e;
- block_stmt_iterator bsi, stmt_bsi;
+ gimple_stmt_iterator gsi, stmt_gsi;
bool successfully_inlined = FALSE;
bool purge_dead_abnormal_edges;
tree t_step;
tree var;
- /* See what we've got. */
- id = (copy_body_data *) data;
- t = *tp;
-
/* Set input_location here so we get the right instantiation context
if we call instantiate_decl from inlinable_function_p. */
saved_location = input_location;
- if (EXPR_HAS_LOCATION (t))
- input_location = EXPR_LOCATION (t);
+ if (gimple_has_location (stmt))
+ input_location = gimple_location (stmt);
/* From here on, we're only interested in CALL_EXPRs. */
- if (TREE_CODE (t) != CALL_EXPR)
+ if (gimple_code (stmt) != GIMPLE_CALL)
goto egress;
/* First, see if we can figure out what function is being called.
If we cannot, then there is no hope of inlining the function. */
- fn = get_callee_fndecl (t);
+ fn = gimple_call_fndecl (stmt);
if (!fn)
- goto egress;
+ {
+ fn = get_indirect_callee_fndecl (id->dst_node, stmt);
+ if (!fn)
+ goto egress;
+ }
/* Turn forward declarations into real ones. */
fn = cgraph_node (fn)->decl;
- /* If fn is a declaration of a function in a nested scope that was
+ /* If FN is a declaration of a function in a nested scope that was
globally declared inline, we don't set its DECL_INITIAL.
However, we can't blindly follow DECL_ABSTRACT_ORIGIN because the
C++ front-end uses it for cdtors to refer to their internal
declarations, that are not real functions. Fortunately those
don't have trees to be saved, so we can tell by checking their
- DECL_SAVED_TREE. */
- if (! DECL_INITIAL (fn)
+ gimple_body. */
+ if (!DECL_INITIAL (fn)
&& DECL_ABSTRACT_ORIGIN (fn)
- && DECL_SAVED_TREE (DECL_ABSTRACT_ORIGIN (fn)))
+ && gimple_body (DECL_ABSTRACT_ORIGIN (fn)))
fn = DECL_ABSTRACT_ORIGIN (fn);
/* Objective C and fortran still calls tree_rest_of_compilation directly.
@@ -2655,7 +3105,7 @@ expand_call_inline (basic_block bb, tree stmt, tree *tp, void *data)
where previous inlining turned indirect call into direct call by
constant propagating arguments. In all other cases we hit a bug
(incorrect node sharing is most common reason for missing edges. */
- gcc_assert (dest->needed || !flag_unit_at_a_time);
+ gcc_assert (dest->needed);
cgraph_create_edge (id->dst_node, dest, stmt,
bb->count, CGRAPH_FREQ_BASE,
bb->loop_depth)->inline_failed
@@ -2672,9 +3122,15 @@ expand_call_inline (basic_block bb, tree stmt, tree *tp, void *data)
inlining. */
if (!cgraph_inline_p (cg_edge, &reason))
{
+ /* If this call was originally indirect, we do not want to emit any
+ inlining related warnings or sorry messages because there are no
+ guarantees regarding those. */
+ if (cg_edge->indirect_call)
+ goto egress;
+
if (lookup_attribute ("always_inline", DECL_ATTRIBUTES (fn))
/* Avoid warnings during early inline pass. */
- && (!flag_unit_at_a_time || cgraph_global_info_ready))
+ && cgraph_global_info_ready)
{
sorry ("inlining failed in call to %q+F: %s", fn, reason);
sorry ("called from here");
@@ -2684,7 +3140,7 @@ expand_call_inline (basic_block bb, tree stmt, tree *tp, void *data)
&& strlen (reason)
&& !lookup_attribute ("noinline", DECL_ATTRIBUTES (fn))
/* Avoid warnings during early inline pass. */
- && (!flag_unit_at_a_time || cgraph_global_info_ready))
+ && cgraph_global_info_ready)
{
warning (OPT_Winline, "inlining failed in call to %q+F: %s",
fn, reason);
@@ -2702,7 +3158,7 @@ expand_call_inline (basic_block bb, tree stmt, tree *tp, void *data)
/* We will be inlining this callee. */
id->eh_region = lookup_stmt_eh_region (stmt);
- /* Split the block holding the CALL_EXPR. */
+ /* Split the block holding the GIMPLE_CALL. */
e = split_block (bb, stmt);
bb = e->src;
return_block = e->dest;
@@ -2711,26 +3167,26 @@ expand_call_inline (basic_block bb, tree stmt, tree *tp, void *data)
/* split_block splits after the statement; work around this by
moving the call into the second block manually. Not pretty,
but seems easier than doing the CFG manipulation by hand
- when the CALL_EXPR is in the last statement of BB. */
- stmt_bsi = bsi_last (bb);
- bsi_remove (&stmt_bsi, false);
+ when the GIMPLE_CALL is in the last statement of BB. */
+ stmt_gsi = gsi_last_bb (bb);
+ gsi_remove (&stmt_gsi, false);
- /* If the CALL_EXPR was in the last statement of BB, it may have
+ /* If the GIMPLE_CALL was in the last statement of BB, it may have
been the source of abnormal edges. In this case, schedule
the removal of dead abnormal edges. */
- bsi = bsi_start (return_block);
- if (bsi_end_p (bsi))
+ gsi = gsi_start_bb (return_block);
+ if (gsi_end_p (gsi))
{
- bsi_insert_after (&bsi, stmt, BSI_NEW_STMT);
+ gsi_insert_after (&gsi, stmt, GSI_NEW_STMT);
purge_dead_abnormal_edges = true;
}
else
{
- bsi_insert_before (&bsi, stmt, BSI_NEW_STMT);
+ gsi_insert_before (&gsi, stmt, GSI_NEW_STMT);
purge_dead_abnormal_edges = false;
}
- stmt_bsi = bsi_start (return_block);
+ stmt_gsi = gsi_start_bb (return_block);
/* Build a block containing code to initialize the arguments, the
actual inline expansion of the body, and a label for the return
@@ -2739,7 +3195,7 @@ expand_call_inline (basic_block bb, tree stmt, tree *tp, void *data)
id->block = make_node (BLOCK);
BLOCK_ABSTRACT_ORIGIN (id->block) = fn;
BLOCK_SOURCE_LOCATION (id->block) = input_location;
- add_lexical_block (TREE_BLOCK (stmt), id->block);
+ add_lexical_block (gimple_block (stmt), id->block);
/* Local declarations will be replaced by their equivalents in this
map. */
@@ -2750,27 +3206,26 @@ expand_call_inline (basic_block bb, tree stmt, tree *tp, void *data)
id->src_fn = fn;
id->src_node = cg_edge->callee;
id->src_cfun = DECL_STRUCT_FUNCTION (fn);
- id->call_expr = t;
+ id->gimple_call = stmt;
gcc_assert (!id->src_cfun->after_inlining);
id->entry_bb = bb;
- initialize_inlined_parameters (id, t, fn, bb);
+ initialize_inlined_parameters (id, stmt, fn, bb);
if (DECL_INITIAL (fn))
add_lexical_block (id->block, remap_blocks (DECL_INITIAL (fn), id));
/* Return statements in the function body will be replaced by jumps
to the RET_LABEL. */
-
gcc_assert (DECL_INITIAL (fn));
gcc_assert (TREE_CODE (DECL_INITIAL (fn)) == BLOCK);
- /* Find the lhs to which the result of this call is assigned. */
+ /* Find the LHS to which the result of this call is assigned. */
return_slot = NULL;
- if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT)
+ if (gimple_call_lhs (stmt))
{
- modify_dest = GIMPLE_STMT_OPERAND (stmt, 0);
+ modify_dest = gimple_call_lhs (stmt);
/* The function which we are inlining might not return a value,
in which case we should issue a warning that the function
@@ -2780,7 +3235,8 @@ expand_call_inline (basic_block bb, tree stmt, tree *tp, void *data)
uninitialized variable. */
if (DECL_P (modify_dest))
TREE_NO_WARNING (modify_dest) = 1;
- if (CALL_EXPR_RETURN_SLOT_OPT (t))
+
+ if (gimple_call_return_slot_opt_p (stmt))
{
return_slot = modify_dest;
modify_dest = NULL;
@@ -2801,8 +3257,7 @@ expand_call_inline (basic_block bb, tree stmt, tree *tp, void *data)
}
/* Declare the return variable for the function. */
- retvar = declare_return_variable (id, return_slot,
- modify_dest, &use_retvar);
+ retvar = declare_return_variable (id, return_slot, modify_dest, &use_retvar);
if (DECL_IS_OPERATOR_NEW (fn))
{
@@ -2836,56 +3291,65 @@ expand_call_inline (basic_block bb, tree stmt, tree *tp, void *data)
id->decl_map = st;
/* If the inlined function returns a result that we care about,
- clobber the CALL_EXPR with a reference to the return variable. */
- if (use_retvar && (TREE_CODE (bsi_stmt (stmt_bsi)) != CALL_EXPR))
+ substitute the GIMPLE_CALL with an assignment of the return
+ variable to the LHS of the call. That is, if STMT was
+ 'a = foo (...)', substitute the call with 'a = USE_RETVAR'. */
+ if (use_retvar && gimple_call_lhs (stmt))
{
- *tp = use_retvar;
+ gimple old_stmt = stmt;
+ stmt = gimple_build_assign (gimple_call_lhs (stmt), use_retvar);
+ gsi_replace (&stmt_gsi, stmt, false);
if (gimple_in_ssa_p (cfun))
{
update_stmt (stmt);
mark_symbols_for_renaming (stmt);
}
- maybe_clean_or_replace_eh_stmt (stmt, stmt);
+ maybe_clean_or_replace_eh_stmt (old_stmt, stmt);
}
else
- /* We're modifying a TSI owned by gimple_expand_calls_inline();
- tsi_delink() will leave the iterator in a sane state. */
{
- /* Handle case of inlining function that miss return statement so
- return value becomes undefined. */
- if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
- && TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 0)) == SSA_NAME)
+ /* Handle the case of inlining a function with no return
+ statement, which causes the return value to become undefined. */
+ if (gimple_call_lhs (stmt)
+ && TREE_CODE (gimple_call_lhs (stmt)) == SSA_NAME)
{
- tree name = GIMPLE_STMT_OPERAND (stmt, 0);
- tree var = SSA_NAME_VAR (GIMPLE_STMT_OPERAND (stmt, 0));
+ tree name = gimple_call_lhs (stmt);
+ tree var = SSA_NAME_VAR (name);
tree def = gimple_default_def (cfun, var);
- /* If the variable is used undefined, make this name undefined via
- move. */
if (def)
{
- GIMPLE_STMT_OPERAND (stmt, 1) = def;
+ /* If the variable is used undefined, make this name
+ undefined via a move. */
+ stmt = gimple_build_assign (gimple_call_lhs (stmt), def);
+ gsi_replace (&stmt_gsi, stmt, true);
update_stmt (stmt);
}
- /* Otherwise make this variable undefined. */
else
{
- bsi_remove (&stmt_bsi, true);
+ /* Otherwise make this variable undefined. */
+ gsi_remove (&stmt_gsi, true);
set_default_def (var, name);
- SSA_NAME_DEF_STMT (name) = build_empty_stmt ();
+ SSA_NAME_DEF_STMT (name) = gimple_build_nop ();
}
}
else
- bsi_remove (&stmt_bsi, true);
+ gsi_remove (&stmt_gsi, true);
}
if (purge_dead_abnormal_edges)
- tree_purge_dead_abnormal_call_edges (return_block);
+ gimple_purge_dead_abnormal_call_edges (return_block);
/* If the value of the new expression is ignored, that's OK. We
don't warn about this for CALL_EXPRs, so we shouldn't warn about
the equivalent inlined version either. */
- TREE_USED (*tp) = 1;
+ if (is_gimple_assign (stmt))
+ {
+ gcc_assert (gimple_assign_single_p (stmt)
+ || gimple_assign_rhs_code (stmt) == NOP_EXPR
+ || gimple_assign_rhs_code (stmt) == CONVERT_EXPR);
+ TREE_USED (gimple_assign_rhs1 (stmt)) = 1;
+ }
/* Output the inlining info for this abstract function, since it has been
inlined. If we don't do this now, we can lose the information about the
@@ -2906,58 +3370,58 @@ expand_call_inline (basic_block bb, tree stmt, tree *tp, void *data)
/* Expand call statements reachable from STMT_P.
We can only have CALL_EXPRs as the "toplevel" tree code or nested
- in a GIMPLE_MODIFY_STMT. See tree-gimple.c:get_call_expr_in(). We can
+ in a MODIFY_EXPR. See tree-gimple.c:get_call_expr_in(). We can
unfortunately not use that function here because we need a pointer
to the CALL_EXPR, not the tree itself. */
static bool
gimple_expand_calls_inline (basic_block bb, copy_body_data *id)
{
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
- /* Register specific tree functions. */
- tree_register_cfg_hooks ();
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- tree *expr_p = bsi_stmt_ptr (bsi);
- tree stmt = *expr_p;
+ gimple stmt = gsi_stmt (gsi);
- if (TREE_CODE (*expr_p) == GIMPLE_MODIFY_STMT)
- expr_p = &GIMPLE_STMT_OPERAND (*expr_p, 1);
- if (TREE_CODE (*expr_p) == WITH_SIZE_EXPR)
- expr_p = &TREE_OPERAND (*expr_p, 0);
- if (TREE_CODE (*expr_p) == CALL_EXPR)
- if (expand_call_inline (bb, stmt, expr_p, id))
- return true;
+ if (is_gimple_call (stmt)
+ && expand_call_inline (bb, stmt, id))
+ return true;
}
+
return false;
}
+
/* Walk all basic blocks created after FIRST and try to fold every statement
in the STATEMENTS pointer set. */
+
static void
fold_marked_statements (int first, struct pointer_set_t *statements)
{
- for (;first < n_basic_blocks;first++)
+ for (; first < n_basic_blocks; first++)
if (BASIC_BLOCK (first))
{
- block_stmt_iterator bsi;
- for (bsi = bsi_start (BASIC_BLOCK (first));
- !bsi_end_p (bsi); bsi_next (&bsi))
- if (pointer_set_contains (statements, bsi_stmt (bsi)))
+ gimple_stmt_iterator gsi;
+
+ for (gsi = gsi_start_bb (BASIC_BLOCK (first));
+ !gsi_end_p (gsi);
+ gsi_next (&gsi))
+ if (pointer_set_contains (statements, gsi_stmt (gsi)))
{
- tree old_stmt = bsi_stmt (bsi);
- tree old_call = get_call_expr_in (old_stmt);
+ gimple old_stmt = gsi_stmt (gsi);
- if (fold_stmt (bsi_stmt_ptr (bsi)))
+ if (fold_stmt (&gsi))
{
- update_stmt (bsi_stmt (bsi));
- if (old_call)
- cgraph_update_edges_for_call_stmt (old_stmt, old_call,
- bsi_stmt (bsi));
- if (maybe_clean_or_replace_eh_stmt (old_stmt,
- bsi_stmt (bsi)))
- tree_purge_dead_eh_edges (BASIC_BLOCK (first));
+ /* Re-read the statement from GSI as fold_stmt() may
+ have changed it. */
+ gimple new_stmt = gsi_stmt (gsi);
+ update_stmt (new_stmt);
+
+ if (is_gimple_call (old_stmt))
+ cgraph_update_edges_for_call_stmt (old_stmt, new_stmt);
+
+ if (maybe_clean_or_replace_eh_stmt (old_stmt, new_stmt))
+ gimple_purge_dead_eh_edges (BASIC_BLOCK (first));
}
}
}
@@ -3021,6 +3485,9 @@ optimize_inline_calls (tree fn)
free_dominance_info (CDI_DOMINATORS);
free_dominance_info (CDI_POST_DOMINATORS);
+ /* Register specific gimple functions. */
+ gimple_register_cfg_hooks ();
+
/* Reach the trees by walking over the CFG, and note the
enclosing basic-blocks in the call edges. */
/* We walk the blocks going forward, because inlined function bodies
@@ -3058,11 +3525,13 @@ optimize_inline_calls (tree fn)
cgraph_node_remove_callees (id.dst_node);
fold_cond_expr_cond ();
+
/* It would be nice to check SSA/CFG/statement consistency here, but it is
not possible yet - the IPA passes might make various functions to not
throw and they don't care to proactively update local EH info. This is
done later in fixup_cfg pass that also execute the verification. */
- return (TODO_update_ssa | TODO_cleanup_cfg
+ return (TODO_update_ssa
+ | TODO_cleanup_cfg
| (gimple_in_ssa_p (cfun) ? TODO_remove_unused_locals : 0)
| (profile_status != PROFILE_ABSENT ? TODO_rebuild_frequencies : 0));
}
@@ -3077,7 +3546,6 @@ copy_tree_r (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
/* We make copies of most nodes. */
if (IS_EXPR_CODE_CLASS (cl)
- || IS_GIMPLE_STMT_CODE_CLASS (cl)
|| code == TREE_LIST
|| code == TREE_VEC
|| code == TYPE_DECL
@@ -3085,19 +3553,18 @@ copy_tree_r (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
{
/* Because the chain gets clobbered when we make a copy, we save it
here. */
- tree chain = NULL_TREE, new;
+ tree chain = NULL_TREE, new_tree;
- if (!GIMPLE_TUPLE_P (*tp))
- chain = TREE_CHAIN (*tp);
+ chain = TREE_CHAIN (*tp);
/* Copy the node. */
- new = copy_node (*tp);
+ new_tree = copy_node (*tp);
/* Propagate mudflap marked-ness. */
if (flag_mudflap && mf_marked_p (*tp))
- mf_mark (new);
+ mf_mark (new_tree);
- *tp = new;
+ *tp = new_tree;
/* Now, restore the chain, if appropriate. That will cause
walk_tree to walk into the chain as well. */
@@ -3115,17 +3582,17 @@ copy_tree_r (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
{
/* CONSTRUCTOR nodes need special handling because
we need to duplicate the vector of elements. */
- tree new;
+ tree new_tree;
- new = copy_node (*tp);
+ new_tree = copy_node (*tp);
/* Propagate mudflap marked-ness. */
if (flag_mudflap && mf_marked_p (*tp))
- mf_mark (new);
+ mf_mark (new_tree);
- CONSTRUCTOR_ELTS (new) = VEC_copy (constructor_elt, gc,
+ CONSTRUCTOR_ELTS (new_tree) = VEC_copy (constructor_elt, gc,
CONSTRUCTOR_ELTS (*tp));
- *tp = new;
+ *tp = new_tree;
}
else if (TREE_CODE_CLASS (code) == tcc_type)
*walk_subtrees = 0;
@@ -3248,7 +3715,7 @@ unsave_r (tree *tp, int *walk_subtrees, void *data)
}
else if (TREE_CODE (*tp) == STATEMENT_LIST)
- copy_statement_list (tp);
+ gcc_unreachable ();
else if (TREE_CODE (*tp) == BIND_EXPR)
copy_bind_expr (tp, walk_subtrees, id);
else if (TREE_CODE (*tp) == SAVE_EXPR)
@@ -3301,6 +3768,162 @@ unsave_expr_now (tree expr)
return expr;
}
+/* Called via walk_gimple_seq. If *GSIP points to a GIMPLE_LABEL for a local
+ label, copies the declaration and enters it in the splay_tree in DATA (which
+ is really a 'copy_body_data *'. */
+
+static tree
+mark_local_labels_stmt (gimple_stmt_iterator *gsip,
+ bool *handled_ops_p ATTRIBUTE_UNUSED,
+ struct walk_stmt_info *wi)
+{
+ copy_body_data *id = (copy_body_data *) wi->info;
+ gimple stmt = gsi_stmt (*gsip);
+
+ if (gimple_code (stmt) == GIMPLE_LABEL)
+ {
+ tree decl = gimple_label_label (stmt);
+
+ /* Copy the decl and remember the copy. */
+ insert_decl_map (id, decl, id->copy_decl (decl, id));
+ }
+
+ return NULL_TREE;
+}
+
+
+/* Called via walk_gimple_seq by copy_gimple_seq_and_replace_local.
+ Using the splay_tree pointed to by ST (which is really a `splay_tree'),
+ remaps all local declarations to appropriate replacements in gimple
+ operands. */
+
+static tree
+replace_locals_op (tree *tp, int *walk_subtrees, void *data)
+{
+ struct walk_stmt_info *wi = (struct walk_stmt_info*) data;
+ copy_body_data *id = (copy_body_data *) wi->info;
+ struct pointer_map_t *st = id->decl_map;
+ tree *n;
+ tree expr = *tp;
+
+ /* Only a local declaration (variable or label). */
+ if ((TREE_CODE (expr) == VAR_DECL
+ && !TREE_STATIC (expr))
+ || TREE_CODE (expr) == LABEL_DECL)
+ {
+ /* Lookup the declaration. */
+ n = (tree *) pointer_map_contains (st, expr);
+
+ /* If it's there, remap it. */
+ if (n)
+ *tp = *n;
+ *walk_subtrees = 0;
+ }
+ else if (TREE_CODE (expr) == STATEMENT_LIST
+ || TREE_CODE (expr) == BIND_EXPR
+ || TREE_CODE (expr) == SAVE_EXPR)
+ gcc_unreachable ();
+ else if (TREE_CODE (expr) == TARGET_EXPR)
+ {
+ /* Don't mess with a TARGET_EXPR that hasn't been expanded.
+ It's OK for this to happen if it was part of a subtree that
+ isn't immediately expanded, such as operand 2 of another
+ TARGET_EXPR. */
+ if (!TREE_OPERAND (expr, 1))
+ {
+ TREE_OPERAND (expr, 1) = TREE_OPERAND (expr, 3);
+ TREE_OPERAND (expr, 3) = NULL_TREE;
+ }
+ }
+
+ /* Keep iterating. */
+ return NULL_TREE;
+}
+
+
+/* Called via walk_gimple_seq by copy_gimple_seq_and_replace_local.
+ Using the splay_tree pointed to by ST (which is really a `splay_tree'),
+ remaps all local declarations to appropriate replacements in gimple
+ statements. */
+
+static tree
+replace_locals_stmt (gimple_stmt_iterator *gsip,
+ bool *handled_ops_p ATTRIBUTE_UNUSED,
+ struct walk_stmt_info *wi)
+{
+ copy_body_data *id = (copy_body_data *) wi->info;
+ gimple stmt = gsi_stmt (*gsip);
+
+ if (gimple_code (stmt) == GIMPLE_BIND)
+ {
+ tree block = gimple_bind_block (stmt);
+
+ if (block)
+ {
+ remap_block (&block, id);
+ gimple_bind_set_block (stmt, block);
+ }
+
+ /* This will remap a lot of the same decls again, but this should be
+ harmless. */
+ if (gimple_bind_vars (stmt))
+ gimple_bind_set_vars (stmt, remap_decls (gimple_bind_vars (stmt), id));
+ }
+
+ /* Keep iterating. */
+ return NULL_TREE;
+}
+
+
+/* Copies everything in SEQ and replaces variables and labels local to
+ current_function_decl. */
+
+gimple_seq
+copy_gimple_seq_and_replace_locals (gimple_seq seq)
+{
+ copy_body_data id;
+ struct walk_stmt_info wi;
+ struct pointer_set_t *visited;
+ gimple_seq copy;
+
+ /* There's nothing to do for NULL_TREE. */
+ if (seq == NULL)
+ return seq;
+
+ /* Set up ID. */
+ memset (&id, 0, sizeof (id));
+ id.src_fn = current_function_decl;
+ id.dst_fn = current_function_decl;
+ id.decl_map = pointer_map_create ();
+
+ id.copy_decl = copy_decl_no_change;
+ id.transform_call_graph_edges = CB_CGE_DUPLICATE;
+ id.transform_new_cfg = false;
+ id.transform_return_to_modify = false;
+ id.transform_lang_insert_block = NULL;
+
+ /* Walk the tree once to find local labels. */
+ memset (&wi, 0, sizeof (wi));
+ visited = pointer_set_create ();
+ wi.info = &id;
+ wi.pset = visited;
+ walk_gimple_seq (seq, mark_local_labels_stmt, NULL, &wi);
+ pointer_set_destroy (visited);
+
+ copy = gimple_seq_copy (seq);
+
+ /* Walk the copy, remapping decls. */
+ memset (&wi, 0, sizeof (wi));
+ wi.info = &id;
+ walk_gimple_seq (copy, replace_locals_stmt, replace_locals_op, &wi);
+
+ /* Clean up. */
+ pointer_map_destroy (id.decl_map);
+
+ return copy;
+}
+
+
/* Allow someone to determine if SEARCH is a child of TOP from gdb. */
static tree
@@ -3337,7 +3960,6 @@ declare_inline_vars (tree block, tree vars)
BLOCK_VARS (block) = chainon (BLOCK_VARS (block), vars);
}
-
/* Copy NODE (which must be a DECL). The DECL originally was in the FROM_FN,
but now it will be in the TO_FN. PARM_TO_VAR means enable PARM_DECL to
VAR_DECL translation. */
@@ -3430,7 +4052,6 @@ copy_result_decl_to_var (tree decl, copy_body_data *id)
return copy_decl_for_dup_finish (id, decl, copy);
}
-
tree
copy_decl_no_change (tree decl, copy_body_data *id)
{
@@ -3471,10 +4092,10 @@ copy_arguments_for_versioning (tree orig_parm, copy_body_data * id)
arg_copy = &orig_parm;
for (parg = arg_copy; *parg; parg = &TREE_CHAIN (*parg))
{
- tree new = remap_decl (*parg, id);
- lang_hooks.dup_lang_specific_decl (new);
- TREE_CHAIN (new) = TREE_CHAIN (*parg);
- *parg = new;
+ tree new_tree = remap_decl (*parg, id);
+ lang_hooks.dup_lang_specific_decl (new_tree);
+ TREE_CHAIN (new_tree) = TREE_CHAIN (*parg);
+ *parg = new_tree;
}
return orig_parm;
}
@@ -3488,10 +4109,10 @@ copy_static_chain (tree static_chain, copy_body_data * id)
chain_copy = &static_chain;
for (pvar = chain_copy; *pvar; pvar = &TREE_CHAIN (*pvar))
{
- tree new = remap_decl (*pvar, id);
- lang_hooks.dup_lang_specific_decl (new);
- TREE_CHAIN (new) = TREE_CHAIN (*pvar);
- *pvar = new;
+ tree new_tree = remap_decl (*pvar, id);
+ lang_hooks.dup_lang_specific_decl (new_tree);
+ TREE_CHAIN (new_tree) = TREE_CHAIN (*pvar);
+ *pvar = new_tree;
}
return static_chain;
}
@@ -3592,7 +4213,8 @@ tree_function_versioning (tree old_decl, tree new_decl, varray_type tree_map,
if (tree_map)
for (i = 0; i < VARRAY_ACTIVE_SIZE (tree_map); i++)
{
- replace_info = (struct ipa_replace_map *) VARRAY_GENERIC_PTR (tree_map, i);
+ replace_info
+ = (struct ipa_replace_map *) VARRAY_GENERIC_PTR (tree_map, i);
if (replace_info->replace_p)
insert_decl_map (&id, replace_info->old_tree,
replace_info->new_tree);
@@ -3683,3 +4305,34 @@ build_duplicate_type (tree type)
return type;
}
+
+/* Return whether it is safe to inline a function because it used different
+ target specific options or different optimization options. */
+bool
+tree_can_inline_p (tree caller, tree callee)
+{
+ /* Don't inline a function with a higher optimization level than the
+ caller, or with different space constraints (hot/cold functions). */
+ tree caller_tree = DECL_FUNCTION_SPECIFIC_OPTIMIZATION (caller);
+ tree callee_tree = DECL_FUNCTION_SPECIFIC_OPTIMIZATION (callee);
+
+ if (caller_tree != callee_tree)
+ {
+ struct cl_optimization *caller_opt
+ = TREE_OPTIMIZATION ((caller_tree)
+ ? caller_tree
+ : optimization_default_node);
+
+ struct cl_optimization *callee_opt
+ = TREE_OPTIMIZATION ((callee_tree)
+ ? callee_tree
+ : optimization_default_node);
+
+ if ((caller_opt->optimize > callee_opt->optimize)
+ || (caller_opt->optimize_size != callee_opt->optimize_size))
+ return false;
+ }
+
+ /* Allow the backend to decide if inlining is ok. */
+ return targetm.target_option.can_inline_p (caller, callee);
+}
diff --git a/gcc/tree-inline.h b/gcc/tree-inline.h
index a69afd00f99..e590e1465a7 100644
--- a/gcc/tree-inline.h
+++ b/gcc/tree-inline.h
@@ -32,13 +32,17 @@ typedef struct copy_body_data
/* FUNCTION_DECL for function being inlined, or in general the
source function providing the original trees. */
tree src_fn;
+
/* FUNCTION_DECL for function being inlined into, or in general
the destination function receiving the new trees. */
tree dst_fn;
+
/* Callgraph node of the source function. */
struct cgraph_node *src_node;
+
/* Callgraph node of the destination function. */
struct cgraph_node *dst_node;
+
/* struct function for function being inlined. Usually this is the same
as DECL_STRUCT_FUNCTION (src_fn), but can be different if saved_cfg
and saved_eh are in use. */
@@ -46,6 +50,7 @@ typedef struct copy_body_data
/* The VAR_DECL for the return value. */
tree retvar;
+
/* The map from local declarations in the inlined function to
equivalents in the function into which it is being inlined. */
struct pointer_map_t *decl_map;
@@ -56,12 +61,13 @@ typedef struct copy_body_data
/* Current BLOCK. */
tree block;
- /* CALL_EXPR if va arg parameter packs should be expanded or NULL
+ /* GIMPLE_CALL if va arg parameter packs should be expanded or NULL
is not. */
- tree call_expr;
+ gimple gimple_call;
/* Exception region the inlined call lie in. */
int eh_region;
+
/* Take region number in the function being copied, add this value and
get eh region number of the duplicate in the function we inline into. */
int eh_region_offset;
@@ -137,30 +143,27 @@ extern eni_weights eni_time_weights;
/* Function prototypes. */
-extern tree copy_body_r (tree *, int *, void *);
+extern tree copy_tree_body_r (tree *, int *, void *);
extern void insert_decl_map (copy_body_data *, tree, tree);
unsigned int optimize_inline_calls (tree);
bool tree_inlinable_function_p (tree);
tree copy_tree_r (tree *, int *, void *);
-tree copy_generic_body (copy_body_data *id);
tree copy_decl_no_change (tree decl, copy_body_data *id);
void save_body (tree, tree *, tree *);
int estimate_move_cost (tree type);
-int estimate_num_insns (tree expr, eni_weights *);
+int estimate_num_insns (gimple, eni_weights *);
+int estimate_num_insns_fn (tree, eni_weights *);
+int count_insns_seq (gimple_seq, eni_weights *);
bool tree_versionable_function_p (tree);
void tree_function_versioning (tree, tree, varray_type, bool);
+bool tree_can_inline_p (tree, tree);
+extern gimple_seq remap_gimple_seq (gimple_seq, copy_body_data *);
extern tree remap_decl (tree decl, copy_body_data *id);
extern tree remap_type (tree type, copy_body_data *id);
+extern gimple_seq copy_gimple_seq_and_replace_locals (gimple_seq seq);
extern HOST_WIDE_INT estimated_stack_frame_size (void);
-/* 0 if we should not perform inlining.
- 1 if we should expand functions calls inline at the tree level.
- 2 if we should consider *all* functions to be inline
- candidates. */
-
-extern int flag_inline_trees;
-
#endif /* GCC_TREE_INLINE_H */
diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c
index c9e99efa9d1..f0c55905060 100644
--- a/gcc/tree-into-ssa.c
+++ b/gcc/tree-into-ssa.c
@@ -36,7 +36,7 @@ along with GCC; see the file COPYING3. If not see
#include "diagnostic.h"
#include "bitmap.h"
#include "tree-flow.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "tree-inline.h"
#include "varray.h"
#include "timevar.h"
@@ -49,6 +49,7 @@ along with GCC; see the file COPYING3. If not see
#include "params.h"
#include "vecprim.h"
+
/* This file builds the SSA form for a function as described in:
R. Cytron, J. Ferrante, B. Rosen, M. Wegman, and K. Zadeck. Efficiently
Computing Static Single Assignment Form and the Control Dependence
@@ -102,6 +103,7 @@ static htab_t def_blocks;
associated with the current block. */
static VEC(tree,heap) *block_defs_stack;
+
/* Set of existing SSA names being replaced by update_ssa. */
static sbitmap old_ssa_names;
@@ -110,6 +112,7 @@ static sbitmap old_ssa_names;
the operations done on them are presence tests. */
static sbitmap new_ssa_names;
+
/* Symbols whose SSA form needs to be updated or created for the first
time. */
static bitmap syms_to_rename;
@@ -129,11 +132,11 @@ static bitmap names_to_release;
/* For each block, the PHI nodes that need to be rewritten are stored into
these vectors. */
-typedef VEC(tree, heap) *tree_vec;
-DEF_VEC_P (tree_vec);
-DEF_VEC_ALLOC_P (tree_vec, heap);
+typedef VEC(gimple, heap) *gimple_vec;
+DEF_VEC_P (gimple_vec);
+DEF_VEC_ALLOC_P (gimple_vec, heap);
-static VEC(tree_vec, heap) *phis_to_rewrite;
+static VEC(gimple_vec, heap) *phis_to_rewrite;
/* The bitmap of non-NULL elements of PHIS_TO_REWRITE. */
static bitmap blocks_with_phis_to_rewrite;
@@ -152,6 +155,7 @@ struct repl_map_d
bitmap set;
};
+
/* NEW -> OLD_SET replacement table. If we are replacing several
existing SSA names O_1, O_2, ..., O_j with a new name N_i,
then REPL_TBL[N_i] = { O_1, O_2, ..., O_j }. */
@@ -239,19 +243,6 @@ enum rewrite_mode {
};
-/* Use TREE_VISITED to keep track of which statements we want to
- rename. When renaming a subset of the variables, not all
- statements will be processed. This is decided in mark_def_sites. */
-#define REWRITE_THIS_STMT(T) TREE_VISITED (T)
-
-/* Use the unsigned flag to keep track of which statements we want to
- visit when marking new definition sites. This is slightly
- different than REWRITE_THIS_STMT: it's used by update_ssa to
- distinguish statements that need to have both uses and defs
- processed from those that only need to have their defs processed.
- Statements that define new SSA names only need to have their defs
- registered, but they don't need to have their uses renamed. */
-#define REGISTER_DEFS_IN_THIS_STMT(T) (T)->base.unsigned_flag
/* Prototypes for debugging functions. */
@@ -271,6 +262,50 @@ extern void debug_defs_stack (int);
extern void dump_currdefs (FILE *);
extern void debug_currdefs (void);
+/* Return true if STMT needs to be rewritten. When renaming a subset
+ of the variables, not all statements will be processed. This is
+ decided in mark_def_sites. */
+
+static inline bool
+rewrite_uses_p (gimple stmt)
+{
+ return gimple_visited_p (stmt);
+}
+
+
+/* Set the rewrite marker on STMT to the value given by REWRITE_P. */
+
+static inline void
+set_rewrite_uses (gimple stmt, bool rewrite_p)
+{
+ gimple_set_visited (stmt, rewrite_p);
+}
+
+
+/* Return true if the DEFs created by statement STMT should be
+ registered when marking new definition sites. This is slightly
+ different than rewrite_uses_p: it's used by update_ssa to
+ distinguish statements that need to have both uses and defs
+ processed from those that only need to have their defs processed.
+ Statements that define new SSA names only need to have their defs
+ registered, but they don't need to have their uses renamed. */
+
+static inline bool
+register_defs_p (gimple stmt)
+{
+ return gimple_plf (stmt, GF_PLF_1) != 0;
+}
+
+
+/* If REGISTER_DEFS_P is true, mark STMT to have its DEFs registered. */
+
+static inline void
+set_register_defs (gimple stmt, bool register_defs_p)
+{
+ gimple_set_plf (stmt, GF_PLF_1, register_defs_p);
+}
+
+
/* Get the information associated with NAME. */
static inline ssa_name_info_p
@@ -371,7 +406,7 @@ set_current_def (tree var, tree def)
for LIVEIN). */
void
-compute_global_livein (bitmap livein, bitmap def_blocks)
+compute_global_livein (bitmap livein ATTRIBUTE_UNUSED, bitmap def_blocks ATTRIBUTE_UNUSED)
{
basic_block bb, *worklist, *tos;
unsigned i;
@@ -419,24 +454,26 @@ compute_global_livein (bitmap livein, bitmap def_blocks)
static void
initialize_flags_in_bb (basic_block bb)
{
- tree phi, stmt;
- block_stmt_iterator bsi;
+ gimple stmt;
+ gimple_stmt_iterator gsi;
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
+ for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- REWRITE_THIS_STMT (phi) = 0;
- REGISTER_DEFS_IN_THIS_STMT (phi) = 0;
+ gimple phi = gsi_stmt (gsi);
+ set_rewrite_uses (phi, false);
+ set_register_defs (phi, false);
}
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- stmt = bsi_stmt (bsi);
+ stmt = gsi_stmt (gsi);
+
/* We are going to use the operand cache API, such as
SET_USE, SET_DEF, and FOR_EACH_IMM_USE_FAST. The operand
cache for each statement should be up-to-date. */
- gcc_assert (!stmt_modified_p (stmt));
- REWRITE_THIS_STMT (stmt) = 0;
- REGISTER_DEFS_IN_THIS_STMT (stmt) = 0;
+ gcc_assert (!gimple_modified_p (stmt));
+ set_rewrite_uses (stmt, false);
+ set_register_defs (stmt, false);
}
}
@@ -601,15 +638,15 @@ repl_map_free (void *p)
}
-/* Return the names replaced by NEW (i.e., REPL_TBL[NEW].SET). */
+/* Return the names replaced by NEW_TREE (i.e., REPL_TBL[NEW_TREE].SET). */
static inline bitmap
-names_replaced_by (tree new)
+names_replaced_by (tree new_tree)
{
struct repl_map_d m;
void **slot;
- m.name = new;
+ m.name = new_tree;
slot = htab_find_slot (repl_tbl, (void *) &m, NO_INSERT);
/* If N was not registered in the replacement table, return NULL. */
@@ -620,20 +657,20 @@ names_replaced_by (tree new)
}
-/* Add OLD to REPL_TBL[NEW].SET. */
+/* Add OLD to REPL_TBL[NEW_TREE].SET. */
static inline void
-add_to_repl_tbl (tree new, tree old)
+add_to_repl_tbl (tree new_tree, tree old)
{
struct repl_map_d m, *mp;
void **slot;
- m.name = new;
+ m.name = new_tree;
slot = htab_find_slot (repl_tbl, (void *) &m, INSERT);
if (*slot == NULL)
{
mp = XNEW (struct repl_map_d);
- mp->name = new;
+ mp->name = new_tree;
mp->set = BITMAP_ALLOC (NULL);
*slot = (void *) mp;
}
@@ -644,23 +681,23 @@ add_to_repl_tbl (tree new, tree old)
}
-/* Add a new mapping NEW -> OLD REPL_TBL. Every entry N_i in REPL_TBL
+/* Add a new mapping NEW_TREE -> OLD REPL_TBL. Every entry N_i in REPL_TBL
represents the set of names O_1 ... O_j replaced by N_i. This is
used by update_ssa and its helpers to introduce new SSA names in an
already formed SSA web. */
static void
-add_new_name_mapping (tree new, tree old)
+add_new_name_mapping (tree new_tree, tree old)
{
timevar_push (TV_TREE_SSA_INCREMENTAL);
- /* OLD and NEW must be different SSA names for the same symbol. */
- gcc_assert (new != old && SSA_NAME_VAR (new) == SSA_NAME_VAR (old));
+ /* OLD and NEW_TREE must be different SSA names for the same symbol. */
+ gcc_assert (new_tree != old && SSA_NAME_VAR (new_tree) == SSA_NAME_VAR (old));
/* If this mapping is for virtual names, we will need to update
virtual operands. If this is a mapping for .MEM, then we gather
the symbols associated with each name. */
- if (!is_gimple_reg (new))
+ if (!is_gimple_reg (new_tree))
{
tree sym;
@@ -675,7 +712,7 @@ add_new_name_mapping (tree new, tree old)
will make more sense to rename the symbols from scratch.
Otherwise, the insertion of PHI nodes for each of the old
names in these mappings will be very slow. */
- sym = SSA_NAME_VAR (new);
+ sym = SSA_NAME_VAR (new_tree);
bitmap_set_bit (update_ssa_stats.virtual_symbols, DECL_UID (sym));
}
@@ -689,16 +726,16 @@ add_new_name_mapping (tree new, tree old)
}
/* Update the REPL_TBL table. */
- add_to_repl_tbl (new, old);
+ add_to_repl_tbl (new_tree, old);
/* If OLD had already been registered as a new name, then all the
- names that OLD replaces should also be replaced by NEW. */
+ names that OLD replaces should also be replaced by NEW_TREE. */
if (is_new_name (old))
- bitmap_ior_into (names_replaced_by (new), names_replaced_by (old));
+ bitmap_ior_into (names_replaced_by (new_tree), names_replaced_by (old));
- /* Register NEW and OLD in NEW_SSA_NAMES and OLD_SSA_NAMES,
+ /* Register NEW_TREE and OLD in NEW_SSA_NAMES and OLD_SSA_NAMES,
respectively. */
- SET_BIT (new_ssa_names, SSA_NAME_VERSION (new));
+ SET_BIT (new_ssa_names, SSA_NAME_VERSION (new_tree));
SET_BIT (old_ssa_names, SSA_NAME_VERSION (old));
/* Update mapping counter to use in the virtual mapping heuristic. */
@@ -724,23 +761,26 @@ add_new_name_mapping (tree new, tree old)
static void
mark_def_sites (struct dom_walk_data *walk_data, basic_block bb,
- block_stmt_iterator bsi)
+ gimple_stmt_iterator gsi)
{
struct mark_def_sites_global_data *gd;
bitmap kills;
- tree stmt, def;
+ tree def;
+ gimple stmt;
use_operand_p use_p;
ssa_op_iter iter;
- stmt = bsi_stmt (bsi);
- update_stmt_if_modified (stmt);
+ /* Since this is the first time that we rewrite the program into SSA
+ form, force an operand scan on every statement. */
+ stmt = gsi_stmt (gsi);
+ update_stmt (stmt);
gd = (struct mark_def_sites_global_data *) walk_data->global_data;
kills = gd->kills;
gcc_assert (blocks_to_update == NULL);
- REGISTER_DEFS_IN_THIS_STMT (stmt) = 0;
- REWRITE_THIS_STMT (stmt) = 0;
+ set_register_defs (stmt, false);
+ set_rewrite_uses (stmt, false);
/* If a variable is used before being set, then the variable is live
across a block boundary, so mark it live-on-entry to BB. */
@@ -750,7 +790,7 @@ mark_def_sites (struct dom_walk_data *walk_data, basic_block bb,
gcc_assert (DECL_P (sym));
if (!bitmap_bit_p (kills, DECL_UID (sym)))
set_livein_block (sym, bb);
- REWRITE_THIS_STMT (stmt) = 1;
+ set_rewrite_uses (stmt, true);
}
/* Now process the defs. Mark BB as the definition block and add
@@ -760,12 +800,12 @@ mark_def_sites (struct dom_walk_data *walk_data, basic_block bb,
gcc_assert (DECL_P (def));
set_def_block (def, bb, false);
bitmap_set_bit (kills, DECL_UID (def));
- REGISTER_DEFS_IN_THIS_STMT (stmt) = 1;
+ set_register_defs (stmt, true);
}
/* If we found the statement interesting then also mark the block BB
as interesting. */
- if (REWRITE_THIS_STMT (stmt) || REGISTER_DEFS_IN_THIS_STMT (stmt))
+ if (rewrite_uses_p (stmt) || register_defs_p (stmt))
SET_BIT (gd->interesting_blocks, bb->index);
}
@@ -1007,7 +1047,7 @@ get_default_def_for (tree sym)
if (ddef == NULL_TREE)
{
- ddef = make_ssa_name (sym, build_empty_stmt ());
+ ddef = make_ssa_name (sym, gimple_build_nop ());
set_default_def (sym, ddef);
}
@@ -1018,30 +1058,30 @@ get_default_def_for (tree sym)
/* Marks phi node PHI in basic block BB for rewrite. */
static void
-mark_phi_for_rewrite (basic_block bb, tree phi)
+mark_phi_for_rewrite (basic_block bb, gimple phi)
{
- tree_vec phis;
+ gimple_vec phis;
unsigned i, idx = bb->index;
- if (REWRITE_THIS_STMT (phi))
+ if (rewrite_uses_p (phi))
return;
- REWRITE_THIS_STMT (phi) = 1;
+ set_rewrite_uses (phi, true);
if (!blocks_with_phis_to_rewrite)
return;
bitmap_set_bit (blocks_with_phis_to_rewrite, idx);
- VEC_reserve (tree_vec, heap, phis_to_rewrite, last_basic_block + 1);
- for (i = VEC_length (tree_vec, phis_to_rewrite); i <= idx; i++)
- VEC_quick_push (tree_vec, phis_to_rewrite, NULL);
+ VEC_reserve (gimple_vec, heap, phis_to_rewrite, last_basic_block + 1);
+ for (i = VEC_length (gimple_vec, phis_to_rewrite); i <= idx; i++)
+ VEC_quick_push (gimple_vec, phis_to_rewrite, NULL);
- phis = VEC_index (tree_vec, phis_to_rewrite, idx);
+ phis = VEC_index (gimple_vec, phis_to_rewrite, idx);
if (!phis)
- phis = VEC_alloc (tree, heap, 10);
+ phis = VEC_alloc (gimple, heap, 10);
- VEC_safe_push (tree, heap, phis, phi);
- VEC_replace (tree_vec, phis_to_rewrite, idx, phis);
+ VEC_safe_push (gimple, heap, phis, phi);
+ VEC_replace (gimple_vec, phis_to_rewrite, idx, phis);
}
@@ -1060,7 +1100,7 @@ insert_phi_nodes_for (tree var, bitmap phi_insertion_points, bool update_p)
{
unsigned bb_index;
edge e;
- tree phi;
+ gimple phi;
basic_block bb;
bitmap_iterator bi;
struct def_blocks_d *def_map;
@@ -1082,7 +1122,7 @@ insert_phi_nodes_for (tree var, bitmap phi_insertion_points, bool update_p)
if (update_p)
mark_block_for_update (bb);
- phi = NULL_TREE;
+ phi = NULL;
if (TREE_CODE (var) == SSA_NAME)
{
@@ -1097,7 +1137,7 @@ insert_phi_nodes_for (tree var, bitmap phi_insertion_points, bool update_p)
phi = create_phi_node (var, bb);
new_lhs = duplicate_ssa_name (var, phi);
- SET_PHI_RESULT (phi, new_lhs);
+ gimple_phi_set_result (phi, new_lhs);
add_new_name_mapping (new_lhs, var);
/* Add VAR to every argument slot of PHI. We need VAR in
@@ -1116,7 +1156,7 @@ insert_phi_nodes_for (tree var, bitmap phi_insertion_points, bool update_p)
}
/* Mark this PHI node as interesting for update_ssa. */
- REGISTER_DEFS_IN_THIS_STMT (phi) = 1;
+ set_register_defs (phi, true);
mark_phi_for_rewrite (bb, phi);
}
}
@@ -1231,7 +1271,8 @@ static void
rewrite_initialize_block (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
basic_block bb)
{
- tree phi;
+ gimple phi;
+ gimple_stmt_iterator gsi;
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "\n\nRenaming block #%d\n\n", bb->index);
@@ -1242,9 +1283,12 @@ rewrite_initialize_block (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
/* Step 1. Register new definitions for every PHI node in the block.
Conceptually, all the PHI nodes are executed in parallel and each PHI
node introduces a new version for the associated variable. */
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
+ for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- tree result = PHI_RESULT (phi);
+ tree result;
+
+ phi = gsi_stmt (gsi);
+ result = gimple_phi_result (phi);
gcc_assert (is_gimple_reg (result));
register_new_def (result, SSA_NAME_VAR (result));
}
@@ -1283,30 +1327,30 @@ get_reaching_def (tree var)
static void
rewrite_stmt (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
- basic_block bb ATTRIBUTE_UNUSED, block_stmt_iterator si)
+ basic_block bb ATTRIBUTE_UNUSED, gimple_stmt_iterator si)
{
- tree stmt;
+ gimple stmt;
use_operand_p use_p;
def_operand_p def_p;
ssa_op_iter iter;
- stmt = bsi_stmt (si);
+ stmt = gsi_stmt (si);
/* If mark_def_sites decided that we don't need to rewrite this
statement, ignore it. */
gcc_assert (blocks_to_update == NULL);
- if (!REWRITE_THIS_STMT (stmt) && !REGISTER_DEFS_IN_THIS_STMT (stmt))
+ if (!rewrite_uses_p (stmt) && !register_defs_p (stmt))
return;
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Renaming statement ");
- print_generic_stmt (dump_file, stmt, TDF_SLIM);
+ print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM);
fprintf (dump_file, "\n");
}
/* Step 1. Rewrite USES in the statement. */
- if (REWRITE_THIS_STMT (stmt))
+ if (rewrite_uses_p (stmt))
FOR_EACH_SSA_USE_OPERAND (use_p, stmt, iter, SSA_OP_USE)
{
tree var = USE_FROM_PTR (use_p);
@@ -1315,7 +1359,7 @@ rewrite_stmt (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
}
/* Step 2. Register the statement's DEF operands. */
- if (REGISTER_DEFS_IN_THIS_STMT (stmt))
+ if (register_defs_p (stmt))
FOR_EACH_SSA_DEF_OPERAND (def_p, stmt, iter, SSA_OP_DEF)
{
tree var = DEF_FROM_PTR (def_p);
@@ -1340,12 +1384,15 @@ rewrite_add_phi_arguments (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
FOR_EACH_EDGE (e, ei, bb->succs)
{
- tree phi;
+ gimple phi;
+ gimple_stmt_iterator gsi;
- for (phi = phi_nodes (e->dest); phi; phi = PHI_CHAIN (phi))
+ for (gsi = gsi_start_phis (e->dest); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
tree currdef;
- currdef = get_reaching_def (SSA_NAME_VAR (PHI_RESULT (phi)));
+ phi = gsi_stmt (gsi);
+ currdef = get_reaching_def (SSA_NAME_VAR (gimple_phi_result (phi)));
add_phi_arg (phi, currdef, e);
}
}
@@ -1721,8 +1768,8 @@ rewrite_update_init_block (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
{
edge e;
edge_iterator ei;
- tree phi;
bool is_abnormal_phi;
+ gimple_stmt_iterator gsi;
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "\n\nRegistering new PHI nodes in block #%d\n\n",
@@ -1749,14 +1796,15 @@ rewrite_update_init_block (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
register it as a new definition for its corresponding name. Also
register definitions for names whose underlying symbols are
marked for renaming. */
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
+ for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
tree lhs, lhs_sym;
+ gimple phi = gsi_stmt (gsi);
- if (!REGISTER_DEFS_IN_THIS_STMT (phi))
+ if (!register_defs_p (phi))
continue;
- lhs = PHI_RESULT (phi);
+ lhs = gimple_phi_result (phi);
lhs_sym = SSA_NAME_VAR (lhs);
if (symbol_marked_for_renaming (lhs_sym))
@@ -1834,7 +1882,7 @@ maybe_replace_use (use_operand_p use_p)
DEF_P. */
static inline void
-maybe_register_def (def_operand_p def_p, tree stmt)
+maybe_register_def (def_operand_p def_p, gimple stmt)
{
tree def = DEF_FROM_PTR (def_p);
tree sym = DECL_P (def) ? def : SSA_NAME_VAR (def);
@@ -1876,33 +1924,31 @@ maybe_register_def (def_operand_p def_p, tree stmt)
static void
rewrite_update_stmt (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
basic_block bb ATTRIBUTE_UNUSED,
- block_stmt_iterator si)
+ gimple_stmt_iterator si)
{
- stmt_ann_t ann;
- tree stmt;
+ gimple stmt;
use_operand_p use_p;
def_operand_p def_p;
ssa_op_iter iter;
- stmt = bsi_stmt (si);
- ann = stmt_ann (stmt);
+ stmt = gsi_stmt (si);
gcc_assert (bitmap_bit_p (blocks_to_update, bb->index));
/* Only update marked statements. */
- if (!REWRITE_THIS_STMT (stmt) && !REGISTER_DEFS_IN_THIS_STMT (stmt))
+ if (!rewrite_uses_p (stmt) && !register_defs_p (stmt))
return;
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Updating SSA information for statement ");
- print_generic_stmt (dump_file, stmt, TDF_SLIM);
+ print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM);
fprintf (dump_file, "\n");
}
/* Rewrite USES included in OLD_SSA_NAMES and USES whose underlying
symbol is marked for renaming. */
- if (REWRITE_THIS_STMT (stmt))
+ if (rewrite_uses_p (stmt))
{
FOR_EACH_SSA_USE_OPERAND (use_p, stmt, iter, SSA_OP_USE)
maybe_replace_use (use_p);
@@ -1915,7 +1961,7 @@ rewrite_update_stmt (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
/* Register definitions of names in NEW_SSA_NAMES and OLD_SSA_NAMES.
Also register definitions for names whose underlying symbol is
marked for renaming. */
- if (REGISTER_DEFS_IN_THIS_STMT (stmt))
+ if (register_defs_p (stmt))
{
FOR_EACH_SSA_DEF_OPERAND (def_p, stmt, iter, SSA_OP_DEF)
maybe_register_def (def_p, stmt);
@@ -1942,19 +1988,19 @@ rewrite_update_phi_arguments (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
FOR_EACH_EDGE (e, ei, bb->succs)
{
- tree phi;
- tree_vec phis;
+ gimple phi;
+ gimple_vec phis;
if (!bitmap_bit_p (blocks_with_phis_to_rewrite, e->dest->index))
continue;
- phis = VEC_index (tree_vec, phis_to_rewrite, e->dest->index);
- for (i = 0; VEC_iterate (tree, phis, i, phi); i++)
+ phis = VEC_index (gimple_vec, phis_to_rewrite, e->dest->index);
+ for (i = 0; VEC_iterate (gimple, phis, i, phi); i++)
{
tree arg, lhs_sym;
use_operand_p arg_p;
- gcc_assert (REWRITE_THIS_STMT (phi));
+ gcc_assert (rewrite_uses_p (phi));
arg_p = PHI_ARG_DEF_PTR_FROM_EDGE (phi, e);
arg = USE_FROM_PTR (arg_p);
@@ -1962,7 +2008,7 @@ rewrite_update_phi_arguments (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
if (arg && !DECL_P (arg) && TREE_CODE (arg) != SSA_NAME)
continue;
- lhs_sym = SSA_NAME_VAR (PHI_RESULT (phi));
+ lhs_sym = SSA_NAME_VAR (gimple_phi_result (phi));
if (arg == NULL_TREE)
{
@@ -2168,7 +2214,6 @@ fini_ssa_renamer (void)
cfun->gimple_df->in_ssa_p = true;
}
-
/* Main entry point into the SSA builder. The renaming process
proceeds in four main phases:
@@ -2264,14 +2309,14 @@ struct gimple_opt_pass pass_build_ssa =
renamer. BLOCKS is the set of blocks that need updating. */
static void
-mark_def_interesting (tree var, tree stmt, basic_block bb, bool insert_phi_p)
+mark_def_interesting (tree var, gimple stmt, basic_block bb, bool insert_phi_p)
{
gcc_assert (bitmap_bit_p (blocks_to_update, bb->index));
- REGISTER_DEFS_IN_THIS_STMT (stmt) = 1;
+ set_register_defs (stmt, true);
if (insert_phi_p)
{
- bool is_phi_p = TREE_CODE (stmt) == PHI_NODE;
+ bool is_phi_p = gimple_code (stmt) == GIMPLE_PHI;
set_def_block (var, bb, is_phi_p);
@@ -2295,17 +2340,17 @@ mark_def_interesting (tree var, tree stmt, basic_block bb, bool insert_phi_p)
nodes. */
static inline void
-mark_use_interesting (tree var, tree stmt, basic_block bb, bool insert_phi_p)
+mark_use_interesting (tree var, gimple stmt, basic_block bb, bool insert_phi_p)
{
- basic_block def_bb = bb_for_stmt (stmt);
+ basic_block def_bb = gimple_bb (stmt);
mark_block_for_update (def_bb);
mark_block_for_update (bb);
- if (TREE_CODE (stmt) == PHI_NODE)
+ if (gimple_code (stmt) == GIMPLE_PHI)
mark_phi_for_rewrite (def_bb, stmt);
else
- REWRITE_THIS_STMT (stmt) = 1;
+ set_rewrite_uses (stmt, true);
/* If VAR has not been defined in BB, then it is live-on-entry
to BB. Note that we cannot just use the block holding VAR's
@@ -2340,8 +2385,7 @@ static void
prepare_block_for_update (basic_block bb, bool insert_phi_p)
{
basic_block son;
- block_stmt_iterator si;
- tree phi;
+ gimple_stmt_iterator si;
edge e;
edge_iterator ei;
@@ -2349,14 +2393,16 @@ prepare_block_for_update (basic_block bb, bool insert_phi_p)
/* Process PHI nodes marking interesting those that define or use
the symbols that we are interested in. */
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
+ for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si))
{
- tree lhs_sym, lhs = PHI_RESULT (phi);
+ gimple phi = gsi_stmt (si);
+ tree lhs_sym, lhs = gimple_phi_result (phi);
lhs_sym = DECL_P (lhs) ? lhs : SSA_NAME_VAR (lhs);
if (!symbol_marked_for_renaming (lhs_sym))
continue;
+
mark_def_interesting (lhs_sym, phi, bb, insert_phi_p);
/* Mark the uses in phi nodes as interesting. It would be more correct
@@ -2367,20 +2413,18 @@ prepare_block_for_update (basic_block bb, bool insert_phi_p)
block that also contains its definition, and thus insert a few more
phi nodes for it. */
FOR_EACH_EDGE (e, ei, bb->preds)
- {
- mark_use_interesting (lhs_sym, phi, e->src, insert_phi_p);
- }
+ mark_use_interesting (lhs_sym, phi, e->src, insert_phi_p);
}
/* Process the statements. */
- for (si = bsi_start (bb); !bsi_end_p (si); bsi_next (&si))
+ for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si))
{
- tree stmt;
+ gimple stmt;
ssa_op_iter i;
use_operand_p use_p;
def_operand_p def_p;
- stmt = bsi_stmt (si);
+ stmt = gsi_stmt (si);
FOR_EACH_SSA_USE_OPERAND (use_p, stmt, i, SSA_OP_ALL_USES)
{
@@ -2419,13 +2463,13 @@ prepare_use_sites_for (tree name, bool insert_phi_p)
FOR_EACH_IMM_USE_FAST (use_p, iter, name)
{
- tree stmt = USE_STMT (use_p);
- basic_block bb = bb_for_stmt (stmt);
+ gimple stmt = USE_STMT (use_p);
+ basic_block bb = gimple_bb (stmt);
- if (TREE_CODE (stmt) == PHI_NODE)
+ if (gimple_code (stmt) == GIMPLE_PHI)
{
int ix = PHI_ARG_INDEX_FROM_USE (use_p);
- edge e = PHI_ARG_EDGE (stmt, ix);
+ edge e = gimple_phi_arg_edge (stmt, ix);
mark_use_interesting (name, stmt, e->src, insert_phi_p);
}
else
@@ -2445,14 +2489,14 @@ prepare_use_sites_for (tree name, bool insert_phi_p)
static void
prepare_def_site_for (tree name, bool insert_phi_p)
{
- tree stmt;
+ gimple stmt;
basic_block bb;
gcc_assert (names_to_release == NULL
|| !bitmap_bit_p (names_to_release, SSA_NAME_VERSION (name)));
stmt = SSA_NAME_DEF_STMT (name);
- bb = bb_for_stmt (stmt);
+ bb = gimple_bb (stmt);
if (bb)
{
gcc_assert (bb->index < last_basic_block);
@@ -2659,10 +2703,10 @@ delete_update_ssa (void)
if (blocks_with_phis_to_rewrite)
EXECUTE_IF_SET_IN_BITMAP (blocks_with_phis_to_rewrite, 0, i, bi)
{
- tree_vec phis = VEC_index (tree_vec, phis_to_rewrite, i);
+ gimple_vec phis = VEC_index (gimple_vec, phis_to_rewrite, i);
- VEC_free (tree, heap, phis);
- VEC_replace (tree_vec, phis_to_rewrite, i, NULL);
+ VEC_free (gimple, heap, phis);
+ VEC_replace (gimple_vec, phis_to_rewrite, i, NULL);
}
BITMAP_FREE (blocks_with_phis_to_rewrite);
@@ -2676,17 +2720,17 @@ delete_update_ssa (void)
update_ssa's tables. */
tree
-create_new_def_for (tree old_name, tree stmt, def_operand_p def)
+create_new_def_for (tree old_name, gimple stmt, def_operand_p def)
{
tree new_name = duplicate_ssa_name (old_name, stmt);
SET_DEF (def, new_name);
- if (TREE_CODE (stmt) == PHI_NODE)
+ if (gimple_code (stmt) == GIMPLE_PHI)
{
edge e;
edge_iterator ei;
- basic_block bb = bb_for_stmt (stmt);
+ basic_block bb = gimple_bb (stmt);
/* If needed, mark NEW_NAME as occurring in an abnormal PHI node. */
FOR_EACH_EDGE (e, ei, bb->preds)
@@ -2713,12 +2757,12 @@ create_new_def_for (tree old_name, tree stmt, def_operand_p def)
update_ssa. */
void
-register_new_name_mapping (tree new, tree old)
+register_new_name_mapping (tree new_Tree ATTRIBUTE_UNUSED, tree old ATTRIBUTE_UNUSED)
{
if (need_to_initialize_update_ssa_p)
init_update_ssa ();
- add_new_name_mapping (new, old);
+ add_new_name_mapping (new_Tree, old);
}
@@ -2779,7 +2823,7 @@ name_mappings_registered_p (void)
/* Return true if name N has been registered in the replacement table. */
bool
-name_registered_for_update_p (tree n)
+name_registered_for_update_p (tree n ATTRIBUTE_UNUSED)
{
if (!need_ssa_update_p ())
return false;
@@ -3079,7 +3123,7 @@ update_ssa (unsigned update_flags)
blocks_with_phis_to_rewrite = BITMAP_ALLOC (NULL);
if (!phis_to_rewrite)
- phis_to_rewrite = VEC_alloc (tree_vec, heap, last_basic_block);
+ phis_to_rewrite = VEC_alloc (gimple_vec, heap, last_basic_block);
blocks_to_update = BITMAP_ALLOC (NULL);
/* Ensure that the dominance information is up-to-date. */
diff --git a/gcc/tree-iterator.c b/gcc/tree-iterator.c
index 9816f249e1b..d8c151a9f54 100644
--- a/gcc/tree-iterator.c
+++ b/gcc/tree-iterator.c
@@ -22,7 +22,7 @@ along with GCC; see the file COPYING3. If not see
#include "system.h"
#include "coretypes.h"
#include "tree.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "tree-iterator.h"
#include "ggc.h"
diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c
index d15ab80377f..d86391e2af3 100644
--- a/gcc/tree-loop-distribution.c
+++ b/gcc/tree-loop-distribution.c
@@ -84,22 +84,25 @@ static void
update_phis_for_loop_copy (struct loop *orig_loop, struct loop *new_loop)
{
tree new_ssa_name;
- tree phi_new, phi_orig;
+ gimple_stmt_iterator si_new, si_orig;
edge orig_loop_latch = loop_latch_edge (orig_loop);
edge orig_entry_e = loop_preheader_edge (orig_loop);
edge new_loop_entry_e = loop_preheader_edge (new_loop);
/* Scan the phis in the headers of the old and new loops
(they are organized in exactly the same order). */
-
- for (phi_new = phi_nodes (new_loop->header),
- phi_orig = phi_nodes (orig_loop->header);
- phi_new && phi_orig;
- phi_new = PHI_CHAIN (phi_new), phi_orig = PHI_CHAIN (phi_orig))
+ for (si_new = gsi_start_phis (new_loop->header),
+ si_orig = gsi_start_phis (orig_loop->header);
+ !gsi_end_p (si_new) && !gsi_end_p (si_orig);
+ gsi_next (&si_new), gsi_next (&si_orig))
{
+ tree def;
+ gimple phi_new = gsi_stmt (si_new);
+ gimple phi_orig = gsi_stmt (si_orig);
+
/* Add the first phi argument for the phi in NEW_LOOP (the one
associated with the entry of NEW_LOOP) */
- tree def = PHI_ARG_DEF_FROM_EDGE (phi_orig, orig_entry_e);
+ def = PHI_ARG_DEF_FROM_EDGE (phi_orig, orig_entry_e);
add_phi_arg (phi_new, def, new_loop_entry_e);
/* Add the second phi argument for the phi in NEW_LOOP (the one
@@ -171,7 +174,7 @@ static bool
generate_loops_for_partition (struct loop *loop, bitmap partition, bool copy_p)
{
unsigned i, x;
- block_stmt_iterator bsi;
+ gimple_stmt_iterator bsi;
basic_block *bbs;
if (copy_p)
@@ -192,27 +195,19 @@ generate_loops_for_partition (struct loop *loop, bitmap partition, bool copy_p)
for (x = 0, i = 0; i < loop->num_nodes; i++)
{
basic_block bb = bbs[i];
- tree phi, prev = NULL_TREE, next;
- for (phi = phi_nodes (bb); phi;)
+ for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi);)
if (!bitmap_bit_p (partition, x++))
- {
- next = PHI_CHAIN (phi);
- remove_phi_node (phi, prev, true);
- phi = next;
- }
+ remove_phi_node (&bsi, true);
else
- {
- prev = phi;
- phi = PHI_CHAIN (phi);
- }
+ gsi_next (&bsi);
- for (bsi = bsi_start (bb); !bsi_end_p (bsi);)
- if (TREE_CODE (bsi_stmt (bsi)) != LABEL_EXPR
+ for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi);)
+ if (gimple_code (gsi_stmt (bsi)) != GIMPLE_LABEL
&& !bitmap_bit_p (partition, x++))
- bsi_remove (&bsi, false);
+ gsi_remove (&bsi, false);
else
- bsi_next (&bsi);
+ gsi_next (&bsi);
mark_virtual_ops_in_bb (bb);
}
@@ -224,22 +219,22 @@ generate_loops_for_partition (struct loop *loop, bitmap partition, bool copy_p)
/* Generate a call to memset. Return true when the operation succeeded. */
static bool
-generate_memset_zero (tree stmt, tree op0, tree nb_iter,
- block_stmt_iterator bsi)
+generate_memset_zero (gimple stmt, tree op0, tree nb_iter,
+ gimple_stmt_iterator bsi)
{
- tree s, t, stmts, nb_bytes, addr_base;
+ tree t, nb_bytes, addr_base;
bool res = false;
- tree stmt_list = NULL_TREE;
- tree args [3];
- tree fn_call, mem, fndecl, fntype, fn;
- tree_stmt_iterator i;
+ gimple_seq stmts = NULL, stmt_list = NULL;
+ gimple fn_call;
+ tree mem, fndecl, fntype, fn;
+ gimple_stmt_iterator i;
ssa_op_iter iter;
struct data_reference *dr = XCNEW (struct data_reference);
nb_bytes = fold_build2 (MULT_EXPR, TREE_TYPE (nb_iter),
nb_iter, TYPE_SIZE_UNIT (TREE_TYPE (op0)));
nb_bytes = force_gimple_operand (nb_bytes, &stmts, true, NULL);
- append_to_statement_list_force (stmts, &stmt_list);
+ gimple_seq_add_seq (&stmt_list, stmts);
DR_STMT (dr) = stmt;
DR_REF (dr) = op0;
@@ -261,7 +256,7 @@ generate_memset_zero (tree stmt, tree op0, tree nb_iter,
addr_base = size_binop (PLUS_EXPR, DR_OFFSET (dr), DR_INIT (dr));
addr_base = fold_build2 (MINUS_EXPR, sizetype, addr_base, nb_bytes);
addr_base = force_gimple_operand (addr_base, &stmts, true, NULL);
- append_to_statement_list_force (stmts, &stmt_list);
+ gimple_seq_add_seq (&stmt_list, stmts);
addr_base = fold_build2 (POINTER_PLUS_EXPR,
TREE_TYPE (DR_BASE_ADDRESS (dr)),
@@ -271,23 +266,18 @@ generate_memset_zero (tree stmt, tree op0, tree nb_iter,
goto end;
mem = force_gimple_operand (addr_base, &stmts, true, NULL);
- append_to_statement_list_force (stmts, &stmt_list);
-
+ gimple_seq_add_seq (&stmt_list, stmts);
fndecl = implicit_built_in_decls [BUILT_IN_MEMSET];
fntype = TREE_TYPE (fndecl);
fn = build1 (ADDR_EXPR, build_pointer_type (fntype), fndecl);
- args[0] = mem;
- args[1] = integer_zero_node;
- args[2] = nb_bytes;
-
- fn_call = build_call_array (fntype, fn, 3, args);
- append_to_statement_list_force (fn_call, &stmt_list);
+ fn_call = gimple_build_call (fn, 3, mem, integer_zero_node, nb_bytes);
+ gimple_seq_add_stmt (&stmt_list, fn_call);
- for (i = tsi_start (stmt_list); !tsi_end_p (i); tsi_next (&i))
+ for (i = gsi_start (stmt_list); !gsi_end_p (i); gsi_next (&i))
{
- s = tsi_stmt (i);
+ gimple s = gsi_stmt (i);
update_stmt_if_modified (s);
FOR_EACH_SSA_TREE_OPERAND (t, s, iter, SSA_OP_VIRTUAL_DEFS)
@@ -303,6 +293,7 @@ generate_memset_zero (tree stmt, tree op0, tree nb_iter,
{
if (TREE_CODE (t) == SSA_NAME)
{
+ gimple s;
imm_use_iterator imm_iter;
FOR_EACH_IMM_USE_STMT (s, imm_iter, t)
@@ -313,7 +304,7 @@ generate_memset_zero (tree stmt, tree op0, tree nb_iter,
mark_sym_for_renaming (t);
}
- bsi_insert_after (&bsi, stmt_list, BSI_CONTINUE_LINKING);
+ gsi_insert_seq_after (&bsi, stmt_list, GSI_CONTINUE_LINKING);
res = true;
if (dump_file && (dump_flags & TDF_DETAILS))
@@ -334,9 +325,9 @@ generate_builtin (struct loop *loop, bitmap partition, bool copy_p)
bool res = false;
unsigned i, x = 0;
basic_block *bbs;
- tree write = NULL_TREE;
+ gimple write = NULL;
tree op0, op1;
- block_stmt_iterator bsi;
+ gimple_stmt_iterator bsi;
tree nb_iter = number_of_exit_cond_executions (loop);
if (!nb_iter || nb_iter == chrec_dont_know)
@@ -347,18 +338,17 @@ generate_builtin (struct loop *loop, bitmap partition, bool copy_p)
for (i = 0; i < loop->num_nodes; i++)
{
basic_block bb = bbs[i];
- tree phi;
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
+ for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi); gsi_next (&bsi))
x++;
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
{
- tree stmt = bsi_stmt (bsi);
+ gimple stmt = gsi_stmt (bsi);
if (bitmap_bit_p (partition, x++)
- && TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
- && !is_gimple_reg (GIMPLE_STMT_OPERAND (stmt, 0)))
+ && is_gimple_assign (stmt)
+ && !is_gimple_reg (gimple_assign_lhs (stmt)))
{
/* Don't generate the builtins when there are more than
one memory write. */
@@ -373,17 +363,18 @@ generate_builtin (struct loop *loop, bitmap partition, bool copy_p)
if (!write)
goto end;
- op0 = GIMPLE_STMT_OPERAND (write, 0);
- op1 = GIMPLE_STMT_OPERAND (write, 1);
+ op0 = gimple_assign_lhs (write);
+ op1 = gimple_assign_rhs1 (write);
if (!(TREE_CODE (op0) == ARRAY_REF
|| TREE_CODE (op0) == INDIRECT_REF))
goto end;
/* The new statements will be placed before LOOP. */
- bsi = bsi_last (loop_preheader_edge (loop)->src);
+ bsi = gsi_last_bb (loop_preheader_edge (loop)->src);
- if (integer_zerop (op1) || real_zerop (op1))
+ if (gimple_assign_rhs_code (write) == INTEGER_CST
+ && (integer_zerop (op1) || real_zerop (op1)))
res = generate_memset_zero (write, op0, nb_iter, bsi);
/* If this is the last partition for which we generate code, we have
@@ -557,7 +548,7 @@ rdg_flag_uses (struct graph *rdg, int u, bitmap partition, bitmap loops,
ssa_op_iter iter;
use_operand_p use_p;
struct vertex *x = &(rdg->vertices[u]);
- tree stmt = RDGV_STMT (x);
+ gimple stmt = RDGV_STMT (x);
struct graph_edge *anti_dep = has_anti_dependence (x);
/* Keep in the same partition the destination of an antidependence,
@@ -572,7 +563,7 @@ rdg_flag_uses (struct graph *rdg, int u, bitmap partition, bitmap loops,
processed, part_has_writes);
}
- if (TREE_CODE (stmt) != PHI_NODE)
+ if (gimple_code (stmt) != GIMPLE_PHI)
{
FOR_EACH_SSA_USE_OPERAND (use_p, stmt, iter, SSA_OP_VIRTUAL_USES)
{
@@ -580,7 +571,7 @@ rdg_flag_uses (struct graph *rdg, int u, bitmap partition, bitmap loops,
if (TREE_CODE (use) == SSA_NAME)
{
- tree def_stmt = SSA_NAME_DEF_STMT (use);
+ gimple def_stmt = SSA_NAME_DEF_STMT (use);
int v = rdg_vertex_for_stmt (rdg, def_stmt);
if (v >= 0
@@ -591,10 +582,9 @@ rdg_flag_uses (struct graph *rdg, int u, bitmap partition, bitmap loops,
}
}
- if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
- && has_upstream_mem_writes (u))
+ if (is_gimple_assign (stmt) && has_upstream_mem_writes (u))
{
- tree op0 = GIMPLE_STMT_OPERAND (stmt, 0);
+ tree op0 = gimple_assign_lhs (stmt);
/* Scalar channels don't have enough space for transmitting data
between tasks, unless we add more storage by privatizing. */
@@ -667,7 +657,7 @@ rdg_flag_vertex_and_dependent (struct graph *rdg, int v, bitmap partition,
blocks of LOOP. */
static void
-collect_condition_stmts (struct loop *loop, VEC (tree, heap) **conds)
+collect_condition_stmts (struct loop *loop, VEC (gimple, heap) **conds)
{
unsigned i;
edge e;
@@ -675,10 +665,10 @@ collect_condition_stmts (struct loop *loop, VEC (tree, heap) **conds)
for (i = 0; VEC_iterate (edge, exits, i, e); i++)
{
- tree cond = last_stmt (e->src);
+ gimple cond = last_stmt (e->src);
if (cond)
- VEC_safe_push (tree, heap, *conds, cond);
+ VEC_safe_push (gimple, heap, *conds, cond);
}
VEC_free (edge, heap, exits);
@@ -694,14 +684,14 @@ rdg_flag_loop_exits (struct graph *rdg, bitmap loops, bitmap partition,
{
unsigned i;
bitmap_iterator bi;
- VEC (tree, heap) *conds = VEC_alloc (tree, heap, 3);
+ VEC (gimple, heap) *conds = VEC_alloc (gimple, heap, 3);
EXECUTE_IF_SET_IN_BITMAP (loops, 0, i, bi)
collect_condition_stmts (get_loop (i), &conds);
- while (!VEC_empty (tree, conds))
+ while (!VEC_empty (gimple, conds))
{
- tree cond = VEC_pop (tree, conds);
+ gimple cond = VEC_pop (gimple, conds);
int v = rdg_vertex_for_stmt (rdg, cond);
bitmap new_loops = BITMAP_ALLOC (NULL);
@@ -1050,11 +1040,11 @@ ldist_gen (struct loop *loop, struct graph *rdg,
Returns the number of distributed loops. */
static int
-distribute_loop (struct loop *loop, VEC (tree, heap) *stmts)
+distribute_loop (struct loop *loop, VEC (gimple, heap) *stmts)
{
bool res = false;
struct graph *rdg;
- tree s;
+ gimple s;
unsigned i;
VEC (int, heap) *vertices;
@@ -1085,7 +1075,7 @@ distribute_loop (struct loop *loop, VEC (tree, heap) *stmts)
if (dump_file && (dump_flags & TDF_DETAILS))
dump_rdg (dump_file, rdg);
- for (i = 0; VEC_iterate (tree, stmts, i, s); i++)
+ for (i = 0; VEC_iterate (gimple, stmts, i, s); i++)
{
int v = rdg_vertex_for_stmt (rdg, s);
@@ -1117,7 +1107,7 @@ tree_loop_distribution (void)
FOR_EACH_LOOP (li, loop, 0)
{
- VEC (tree, heap) *work_list = VEC_alloc (tree, heap, 3);
+ VEC (gimple, heap) *work_list = VEC_alloc (gimple, heap, 3);
/* With the following working list, we're asking distribute_loop
to separate the stores of the loop: when dependences allow,
@@ -1143,7 +1133,7 @@ tree_loop_distribution (void)
verify_loop_structure ();
- VEC_free (tree, heap, work_list);
+ VEC_free (gimple, heap, work_list);
}
return 0;
diff --git a/gcc/tree-loop-linear.c b/gcc/tree-loop-linear.c
index f58bd11b7fb..66d25ec1beb 100644
--- a/gcc/tree-loop-linear.c
+++ b/gcc/tree-loop-linear.c
@@ -89,13 +89,13 @@ along with GCC; see the file COPYING3. If not see
*/
static void
-gather_interchange_stats (VEC (ddr_p, heap) *dependence_relations,
- VEC (data_reference_p, heap) *datarefs,
- struct loop *loop,
- struct loop *first_loop,
- unsigned int *dependence_steps,
- unsigned int *nb_deps_not_carried_by_loop,
- double_int *access_strides)
+gather_interchange_stats (VEC (ddr_p, heap) *dependence_relations ATTRIBUTE_UNUSED,
+ VEC (data_reference_p, heap) *datarefs ATTRIBUTE_UNUSED,
+ struct loop *loop ATTRIBUTE_UNUSED,
+ struct loop *first_loop ATTRIBUTE_UNUSED,
+ unsigned int *dependence_steps ATTRIBUTE_UNUSED,
+ unsigned int *nb_deps_not_carried_by_loop ATTRIBUTE_UNUSED,
+ double_int *access_strides ATTRIBUTE_UNUSED)
{
unsigned int i, j;
struct data_dependence_relation *ddr;
@@ -135,7 +135,7 @@ gather_interchange_stats (VEC (ddr_p, heap) *dependence_relations,
{
unsigned int it;
tree ref = DR_REF (dr);
- tree stmt = DR_STMT (dr);
+ gimple stmt = DR_STMT (dr);
struct loop *stmt_loop = loop_containing_stmt (stmt);
struct loop *inner_loop = first_loop->inner;
@@ -319,9 +319,9 @@ linear_transform_loops (void)
VEC(tree,heap) *oldivs = NULL;
VEC(tree,heap) *invariants = NULL;
VEC(tree,heap) *lambda_parameters = NULL;
- VEC(tree,heap) *remove_ivs = VEC_alloc (tree, heap, 3);
+ VEC(gimple,heap) *remove_ivs = VEC_alloc (gimple, heap, 3);
struct loop *loop_nest;
- tree oldiv_stmt;
+ gimple oldiv_stmt;
unsigned i;
FOR_EACH_LOOP (li, loop_nest, 0)
@@ -412,12 +412,12 @@ linear_transform_loops (void)
free_data_refs (datarefs);
}
- for (i = 0; VEC_iterate (tree, remove_ivs, i, oldiv_stmt); i++)
+ for (i = 0; VEC_iterate (gimple, remove_ivs, i, oldiv_stmt); i++)
remove_iv (oldiv_stmt);
VEC_free (tree, heap, oldivs);
VEC_free (tree, heap, invariants);
- VEC_free (tree, heap, remove_ivs);
+ VEC_free (gimple, heap, remove_ivs);
scev_reset ();
if (modified)
diff --git a/gcc/tree-mudflap.c b/gcc/tree-mudflap.c
index 46650b37dd4..3f77b2cb1f6 100644
--- a/gcc/tree-mudflap.c
+++ b/gcc/tree-mudflap.c
@@ -33,7 +33,8 @@ along with GCC; see the file COPYING3. If not see
#include "flags.h"
#include "function.h"
#include "tree-inline.h"
-#include "tree-gimple.h"
+#include "gimple.h"
+#include "tree-iterator.h"
#include "tree-flow.h"
#include "tree-mudflap.h"
#include "tree-dump.h"
@@ -45,6 +46,7 @@ along with GCC; see the file COPYING3. If not see
#include "ggc.h"
#include "cgraph.h"
#include "toplev.h"
+#include "gimple.h"
/* Internal function decls */
@@ -64,9 +66,10 @@ static void mf_xform_derefs (void);
static unsigned int execute_mudflap_function_ops (void);
/* Addressable variables instrumentation. */
-static void mf_xform_decls (tree, tree);
-static tree mx_xfn_xform_decls (tree *, int *, void *);
-static void mx_register_decls (tree, tree *);
+static void mf_xform_decls (gimple_seq, tree);
+static tree mx_xfn_xform_decls (gimple_stmt_iterator *, bool *,
+ struct walk_stmt_info *);
+static gimple_seq mx_register_decls (tree, gimple_seq, location_t);
static unsigned int execute_mudflap_function_decls (void);
@@ -451,8 +454,8 @@ execute_mudflap_function_ops (void)
static void
mf_decl_cache_locals (void)
{
- tree t, shift_init_stmts, mask_init_stmts;
- tree_stmt_iterator tsi;
+ gimple g;
+ gimple_seq seq = gimple_seq_alloc ();
/* Build the cache vars. */
mf_cache_shift_decl_l
@@ -465,28 +468,17 @@ mf_decl_cache_locals (void)
/* Build initialization nodes for the cache vars. We just load the
globals into the cache variables. */
- t = build_gimple_modify_stmt (mf_cache_shift_decl_l, mf_cache_shift_decl);
- SET_EXPR_LOCATION (t, DECL_SOURCE_LOCATION (current_function_decl));
- gimplify_to_stmt_list (&t);
- shift_init_stmts = t;
-
- t = build_gimple_modify_stmt (mf_cache_mask_decl_l, mf_cache_mask_decl);
- SET_EXPR_LOCATION (t, DECL_SOURCE_LOCATION (current_function_decl));
- gimplify_to_stmt_list (&t);
- mask_init_stmts = t;
-
- /* Anticipating multiple entry points, we insert the cache vars
- initializers in each successor of the ENTRY_BLOCK_PTR. */
- for (tsi = tsi_start (shift_init_stmts);
- ! tsi_end_p (tsi);
- tsi_next (&tsi))
- insert_edge_copies (tsi_stmt (tsi), ENTRY_BLOCK_PTR);
-
- for (tsi = tsi_start (mask_init_stmts);
- ! tsi_end_p (tsi);
- tsi_next (&tsi))
- insert_edge_copies (tsi_stmt (tsi), ENTRY_BLOCK_PTR);
- bsi_commit_edge_inserts ();
+ g = gimple_build_assign (mf_cache_shift_decl_l, mf_cache_shift_decl);
+ gimple_set_location (g, DECL_SOURCE_LOCATION (current_function_decl));
+ gimple_seq_add_stmt (&seq, g);
+
+ g = gimple_build_assign (mf_cache_mask_decl_l, mf_cache_mask_decl);
+ gimple_set_location (g, DECL_SOURCE_LOCATION (current_function_decl));
+ gimple_seq_add_stmt (&seq, g);
+
+ insert_edge_copies_seq (seq, ENTRY_BLOCK_PTR);
+
+ gsi_commit_edge_inserts ();
}
@@ -500,27 +492,28 @@ mf_decl_clear_locals (void)
static void
mf_build_check_statement_for (tree base, tree limit,
- block_stmt_iterator *instr_bsi,
- location_t *locus, tree dirflag)
+ gimple_stmt_iterator *instr_gsi,
+ location_t location, tree dirflag)
{
- tree_stmt_iterator head, tsi;
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
basic_block cond_bb, then_bb, join_bb;
edge e;
tree cond, t, u, v;
tree mf_base;
tree mf_elem;
tree mf_limit;
+ gimple g;
+ gimple_seq seq;
/* We first need to split the current basic block, and start altering
the CFG. This allows us to insert the statements we're about to
construct into the right basic blocks. */
- cond_bb = bb_for_stmt (bsi_stmt (*instr_bsi));
- bsi = *instr_bsi;
- bsi_prev (&bsi);
- if (! bsi_end_p (bsi))
- e = split_block (cond_bb, bsi_stmt (bsi));
+ cond_bb = gimple_bb (gsi_stmt (*instr_gsi));
+ gsi = *instr_gsi;
+ gsi_prev (&gsi);
+ if (! gsi_end_p (gsi))
+ e = split_block (cond_bb, gsi_stmt (gsi));
else
e = split_block_after_labels (cond_bb);
cond_bb = e->src;
@@ -558,21 +551,19 @@ mf_build_check_statement_for (tree base, tree limit,
mf_limit = create_tmp_var (mf_uintptr_type, "__mf_limit");
/* Build: __mf_base = (uintptr_t) <base address expression>. */
- t = build_gimple_modify_stmt (mf_base,
- fold_convert (mf_uintptr_type,
- unshare_expr (base)));
- SET_EXPR_LOCUS (t, locus);
- gimplify_to_stmt_list (&t);
- head = tsi_start (t);
- tsi = tsi_last (t);
+ seq = gimple_seq_alloc ();
+ t = fold_convert (mf_uintptr_type, unshare_expr (base));
+ gimplify_expr (&t, &seq, &seq, is_gimple_reg_rhs, fb_rvalue);
+ g = gimple_build_assign (mf_base, t);
+ gimple_set_location (g, location);
+ gimple_seq_add_stmt (&seq, g);
/* Build: __mf_limit = (uintptr_t) <limit address expression>. */
- t = build_gimple_modify_stmt (mf_limit,
- fold_convert (mf_uintptr_type,
- unshare_expr (limit)));
- SET_EXPR_LOCUS (t, locus);
- gimplify_to_stmt_list (&t);
- tsi_link_after (&tsi, t, TSI_CONTINUE_LINKING);
+ t = fold_convert (mf_uintptr_type, unshare_expr (limit));
+ gimplify_expr (&t, &seq, &seq, is_gimple_reg_rhs, fb_rvalue);
+ g = gimple_build_assign (mf_limit, t);
+ gimple_set_location (g, location);
+ gimple_seq_add_stmt (&seq, g);
/* Build: __mf_elem = &__mf_lookup_cache [(__mf_base >> __mf_shift)
& __mf_mask]. */
@@ -586,10 +577,10 @@ mf_build_check_statement_for (tree base, tree limit,
TREE_TYPE (TREE_TYPE (mf_cache_array_decl)),
mf_cache_array_decl, t, NULL_TREE, NULL_TREE);
t = build1 (ADDR_EXPR, mf_cache_structptr_type, t);
- t = build_gimple_modify_stmt (mf_elem, t);
- SET_EXPR_LOCUS (t, locus);
- gimplify_to_stmt_list (&t);
- tsi_link_after (&tsi, t, TSI_CONTINUE_LINKING);
+ gimplify_expr (&t, &seq, &seq, is_gimple_reg_rhs, fb_rvalue);
+ g = gimple_build_assign (mf_elem, t);
+ gimple_set_location (g, location);
+ gimple_seq_add_stmt (&seq, g);
/* Quick validity check.
@@ -631,16 +622,18 @@ mf_build_check_statement_for (tree base, tree limit,
result of the evaluation of 't' in a temporary variable which we
can use as the condition for the conditional jump. */
t = build2 (TRUTH_OR_EXPR, boolean_type_node, t, u);
+ gimplify_expr (&t, &seq, &seq, is_gimple_reg_rhs, fb_rvalue);
cond = create_tmp_var (boolean_type_node, "__mf_unlikely_cond");
- t = build_gimple_modify_stmt (cond, t);
- gimplify_to_stmt_list (&t);
- tsi_link_after (&tsi, t, TSI_CONTINUE_LINKING);
+ g = gimple_build_assign (cond, t);
+ gimple_set_location (g, location);
+ gimple_seq_add_stmt (&seq, g);
/* Build the conditional jump. 'cond' is just a temporary so we can
simply build a void COND_EXPR. We do need labels in both arms though. */
- t = build3 (COND_EXPR, void_type_node, cond, NULL_TREE, NULL_TREE);
- SET_EXPR_LOCUS (t, locus);
- tsi_link_after (&tsi, t, TSI_CONTINUE_LINKING);
+ g = gimple_build_cond (NE_EXPR, cond, integer_zero_node, NULL_TREE,
+ NULL_TREE);
+ gimple_set_location (g, location);
+ gimple_seq_add_stmt (&seq, g);
/* At this point, after so much hard work, we have only constructed
the conditional jump,
@@ -653,9 +646,8 @@ mf_build_check_statement_for (tree base, tree limit,
We can insert this now in the current basic block, i.e. the one that
the statement we're instrumenting was originally in. */
- bsi = bsi_last (cond_bb);
- for (tsi = head; ! tsi_end_p (tsi); tsi_next (&tsi))
- bsi_insert_after (&bsi, tsi_stmt (tsi), BSI_CONTINUE_LINKING);
+ gsi = gsi_last_bb (cond_bb);
+ gsi_insert_seq_after (&gsi, seq, GSI_CONTINUE_LINKING);
/* Now build up the body of the cache-miss handling:
@@ -664,33 +656,31 @@ mf_build_check_statement_for (tree base, tree limit,
This is the body of the conditional. */
- u = mf_file_function_line_tree (locus == NULL ? UNKNOWN_LOCATION : *locus);
+ seq = gimple_seq_alloc ();
+ /* u is a string, so it is already a gimple value. */
+ u = mf_file_function_line_tree (location);
/* NB: we pass the overall [base..limit] range to mf_check. */
v = fold_build2 (PLUS_EXPR, integer_type_node,
fold_build2 (MINUS_EXPR, mf_uintptr_type, mf_limit, mf_base),
integer_one_node);
- t = build_call_expr (mf_check_fndecl, 4, mf_base, v, dirflag, u);
- gimplify_to_stmt_list (&t);
- head = tsi_start (t);
- tsi = tsi_last (t);
+ gimplify_expr (&v, &seq, &seq, is_gimple_mem_rhs, fb_rvalue);
+ g = gimple_build_call (mf_check_fndecl, 4, mf_base, v, dirflag, u);
+ gimple_seq_add_stmt (&seq, g);
if (! flag_mudflap_threads)
{
- t = build_gimple_modify_stmt (mf_cache_shift_decl_l,
- mf_cache_shift_decl);
- tsi_link_after (&tsi, t, TSI_CONTINUE_LINKING);
+ g = gimple_build_assign (mf_cache_shift_decl_l, mf_cache_shift_decl);
+ gimple_seq_add_stmt (&seq, g);
- t = build_gimple_modify_stmt (mf_cache_mask_decl_l,
- mf_cache_mask_decl);
- tsi_link_after (&tsi, t, TSI_CONTINUE_LINKING);
+ g = gimple_build_assign (mf_cache_mask_decl_l, mf_cache_mask_decl);
+ gimple_seq_add_stmt (&seq, g);
}
/* Insert the check code in the THEN block. */
- bsi = bsi_start (then_bb);
- for (tsi = head; ! tsi_end_p (tsi); tsi_next (&tsi))
- bsi_insert_after (&bsi, tsi_stmt (tsi), BSI_CONTINUE_LINKING);
+ gsi = gsi_start_bb (then_bb);
+ gsi_insert_seq_after (&gsi, seq, GSI_CONTINUE_LINKING);
- *instr_bsi = bsi_start (join_bb);
+ *instr_gsi = gsi_start_bb (join_bb);
}
@@ -717,8 +707,8 @@ mf_decl_eligible_p (tree decl)
static void
-mf_xform_derefs_1 (block_stmt_iterator *iter, tree *tp,
- location_t *locus, tree dirflag)
+mf_xform_derefs_1 (gimple_stmt_iterator *iter, tree *tp,
+ location_t location, tree dirflag)
{
tree type, base, limit, addr, size, t;
@@ -898,44 +888,45 @@ mf_xform_derefs_1 (block_stmt_iterator *iter, tree *tp,
return;
}
- mf_build_check_statement_for (base, limit, iter, locus, dirflag);
+ mf_build_check_statement_for (base, limit, iter, location, dirflag);
}
static void
mf_xform_derefs (void)
{
basic_block bb, next;
- block_stmt_iterator i;
+ gimple_stmt_iterator i;
int saved_last_basic_block = last_basic_block;
+ enum gimple_rhs_class grhs_class;
bb = ENTRY_BLOCK_PTR ->next_bb;
do
{
next = bb->next_bb;
- for (i = bsi_start (bb); !bsi_end_p (i); bsi_next (&i))
+ for (i = gsi_start_bb (bb); !gsi_end_p (i); gsi_next (&i))
{
- tree s = bsi_stmt (i);
+ gimple s = gsi_stmt (i);
/* Only a few GIMPLE statements can reference memory. */
- switch (TREE_CODE (s))
+ switch (gimple_code (s))
{
- case GIMPLE_MODIFY_STMT:
- mf_xform_derefs_1 (&i, &GIMPLE_STMT_OPERAND (s, 0),
- EXPR_LOCUS (s), integer_one_node);
- mf_xform_derefs_1 (&i, &GIMPLE_STMT_OPERAND (s, 1),
- EXPR_LOCUS (s), integer_zero_node);
+ case GIMPLE_ASSIGN:
+ mf_xform_derefs_1 (&i, gimple_assign_lhs_ptr (s),
+ gimple_location (s), integer_one_node);
+ mf_xform_derefs_1 (&i, gimple_assign_rhs1_ptr (s),
+ gimple_location (s), integer_zero_node);
+ grhs_class = get_gimple_rhs_class (gimple_assign_rhs_code (s));
+ if (grhs_class == GIMPLE_BINARY_RHS)
+ mf_xform_derefs_1 (&i, gimple_assign_rhs2_ptr (s),
+ gimple_location (s), integer_zero_node);
break;
- case RETURN_EXPR:
- if (TREE_OPERAND (s, 0) != NULL_TREE)
+ case GIMPLE_RETURN:
+ if (gimple_return_retval (s) != NULL_TREE)
{
- if (TREE_CODE (TREE_OPERAND (s, 0)) == GIMPLE_MODIFY_STMT)
- mf_xform_derefs_1 (&i, &GIMPLE_STMT_OPERAND
- (TREE_OPERAND (s, 0), 1),
- EXPR_LOCUS (s), integer_zero_node);
- else
- mf_xform_derefs_1 (&i, &TREE_OPERAND (s, 0), EXPR_LOCUS (s),
- integer_zero_node);
+ mf_xform_derefs_1 (&i, gimple_return_retval_ptr (s),
+ gimple_location (s),
+ integer_zero_node);
}
break;
@@ -970,7 +961,7 @@ execute_mudflap_function_decls (void)
push_gimplify_context (&gctx);
- mf_xform_decls (DECL_SAVED_TREE (current_function_decl),
+ mf_xform_decls (gimple_body (current_function_decl),
DECL_ARGUMENTS (current_function_decl));
pop_gimplify_context (NULL);
@@ -988,12 +979,13 @@ struct mf_xform_decls_data
/* Synthesize a CALL_EXPR and a TRY_FINALLY_EXPR, for this chain of
_DECLs if appropriate. Arrange to call the __mf_register function
- now, and the __mf_unregister function later for each. */
-static void
-mx_register_decls (tree decl, tree *stmt_list)
+ now, and the __mf_unregister function later for each. Return the
+ gimple sequence after synthesis. */
+gimple_seq
+mx_register_decls (tree decl, gimple_seq seq, location_t location)
{
- tree finally_stmts = NULL_TREE;
- tree_stmt_iterator initially_stmts = tsi_start (*stmt_list);
+ gimple_seq finally_stmts = NULL;
+ gimple_stmt_iterator initially_stmts = gsi_start (seq);
while (decl != NULL_TREE)
{
@@ -1005,46 +997,46 @@ mx_register_decls (tree decl, tree *stmt_list)
&& ! TREE_STATIC (decl))
{
tree size = NULL_TREE, variable_name;
- tree unregister_fncall, unregister_fncall_param;
- tree register_fncall, register_fncall_param;
+ gimple unregister_fncall, register_fncall;
+ tree unregister_fncall_param, register_fncall_param;
+ /* Variable-sized objects should have sizes already been
+ gimplified when we got here. */
size = convert (size_type_node, TYPE_SIZE_UNIT (TREE_TYPE (decl)));
-
+ gcc_assert (is_gimple_val (size));
+
unregister_fncall_param =
- convert (ptr_type_node,
- mf_mark (build1 (ADDR_EXPR,
- build_pointer_type (TREE_TYPE (decl)),
- decl)));
+ mf_mark (build1 (ADDR_EXPR,
+ build_pointer_type (TREE_TYPE (decl)),
+ decl));
/* __mf_unregister (&VARIABLE, sizeof (VARIABLE), __MF_TYPE_STACK) */
- unregister_fncall = build_call_expr (mf_unregister_fndecl, 3,
- unregister_fncall_param,
- size,
- build_int_cst (NULL_TREE, 3));
+ unregister_fncall = gimple_build_call (mf_unregister_fndecl, 3,
+ unregister_fncall_param,
+ size,
+ build_int_cst (NULL_TREE, 3));
variable_name = mf_varname_tree (decl);
register_fncall_param =
- convert (ptr_type_node,
- mf_mark (build1 (ADDR_EXPR,
- build_pointer_type (TREE_TYPE (decl)),
- decl)));
+ mf_mark (build1 (ADDR_EXPR,
+ build_pointer_type (TREE_TYPE (decl)),
+ decl));
/* __mf_register (&VARIABLE, sizeof (VARIABLE), __MF_TYPE_STACK,
"name") */
- register_fncall = build_call_expr (mf_register_fndecl, 4,
- register_fncall_param,
- size,
- build_int_cst (NULL_TREE, 3),
- variable_name);
-
+ register_fncall = gimple_build_call (mf_register_fndecl, 4,
+ register_fncall_param,
+ size,
+ build_int_cst (NULL_TREE, 3),
+ variable_name);
+
/* Accumulate the two calls. */
- /* ??? Set EXPR_LOCATION. */
- gimplify_stmt (&register_fncall);
- gimplify_stmt (&unregister_fncall);
+ gimple_set_location (register_fncall, location);
+ gimple_set_location (unregister_fncall, location);
/* Add the __mf_register call at the current appending point. */
- if (tsi_end_p (initially_stmts))
+ if (gsi_end_p (initially_stmts))
{
if (!DECL_ARTIFICIAL (decl))
warning (OPT_Wmudflap,
@@ -1053,11 +1045,11 @@ mx_register_decls (tree decl, tree *stmt_list)
}
else
{
- tsi_link_before (&initially_stmts, register_fncall,
- TSI_SAME_STMT);
+ gsi_insert_before (&initially_stmts, register_fncall,
+ GSI_SAME_STMT);
/* Accumulate the FINALLY piece. */
- append_to_statement_list (unregister_fncall, &finally_stmts);
+ gimple_seq_add_stmt (&finally_stmts, unregister_fncall);
}
mf_mark (decl);
}
@@ -1066,39 +1058,46 @@ mx_register_decls (tree decl, tree *stmt_list)
}
/* Actually, (initially_stmts!=NULL) <=> (finally_stmts!=NULL) */
- if (finally_stmts != NULL_TREE)
+ if (finally_stmts != NULL)
{
- tree t = build2 (TRY_FINALLY_EXPR, void_type_node,
- *stmt_list, finally_stmts);
- *stmt_list = NULL;
- append_to_statement_list (t, stmt_list);
+ gimple stmt = gimple_build_try (seq, finally_stmts, GIMPLE_TRY_FINALLY);
+ gimple_seq new_seq = gimple_seq_alloc ();
+
+ gimple_seq_add_stmt (&new_seq, stmt);
+ return new_seq;
}
+ else
+ return seq;
}
/* Process every variable mentioned in BIND_EXPRs. */
static tree
-mx_xfn_xform_decls (tree *t, int *continue_p, void *data)
+mx_xfn_xform_decls (gimple_stmt_iterator *gsi,
+ bool *handled_operands_p ATTRIBUTE_UNUSED,
+ struct walk_stmt_info *wi)
{
- struct mf_xform_decls_data* d = (struct mf_xform_decls_data*) data;
-
- if (*t == NULL_TREE || *t == error_mark_node)
- {
- *continue_p = 0;
- return NULL_TREE;
- }
+ struct mf_xform_decls_data *d = (struct mf_xform_decls_data *) wi->info;
+ gimple stmt = gsi_stmt (*gsi);
- *continue_p = 1;
-
- switch (TREE_CODE (*t))
+ switch (gimple_code (stmt))
{
- case BIND_EXPR:
+ case GIMPLE_BIND:
{
/* Process function parameters now (but only once). */
- mx_register_decls (d->param_decls, &BIND_EXPR_BODY (*t));
- d->param_decls = NULL_TREE;
+ if (d->param_decls)
+ {
+ gimple_bind_set_body (stmt,
+ mx_register_decls (d->param_decls,
+ gimple_bind_body (stmt),
+ gimple_location (stmt)));
+ d->param_decls = NULL_TREE;
+ }
- mx_register_decls (BIND_EXPR_VARS (*t), &BIND_EXPR_BODY (*t));
+ gimple_bind_set_body (stmt,
+ mx_register_decls (gimple_bind_vars (stmt),
+ gimple_bind_body (stmt),
+ gimple_location (stmt)));
}
break;
@@ -1118,11 +1117,18 @@ mx_xfn_xform_decls (tree *t, int *continue_p, void *data)
*/
static void
-mf_xform_decls (tree fnbody, tree fnparams)
+mf_xform_decls (gimple_seq fnbody, tree fnparams)
{
struct mf_xform_decls_data d;
+ struct walk_stmt_info wi;
+ struct pointer_set_t *pset = pointer_set_create ();
+
d.param_decls = fnparams;
- walk_tree_without_duplicates (&fnbody, mx_xfn_xform_decls, &d);
+ memset (&wi, 0, sizeof (wi));
+ wi.info = (void*) &d;
+ wi.pset = pset;
+ walk_gimple_seq (fnbody, mx_xfn_xform_decls, NULL, &wi);
+ pointer_set_destroy (pset);
}
diff --git a/gcc/tree-nested.c b/gcc/tree-nested.c
index 225605071cc..cfa1dd4b1ee 100644
--- a/gcc/tree-nested.c
+++ b/gcc/tree-nested.c
@@ -1,4 +1,4 @@
-/* Nested function decomposition for trees.
+/* Nested function decomposition for GIMPLE.
Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
This file is part of GCC.
@@ -15,7 +15,7 @@
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
-<http://www.gnu.org/licenses/>. */
+ <http://www.gnu.org/licenses/>. */
#include "config.h"
#include "system.h"
@@ -27,7 +27,7 @@
#include "function.h"
#include "tree-dump.h"
#include "tree-inline.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "tree-iterator.h"
#include "tree-flow.h"
#include "cgraph.h"
@@ -355,46 +355,69 @@ get_chain_field (struct nesting_info *info)
return field;
}
+/* Initialize a new temporary with the GIMPLE_CALL STMT. */
+
+static tree
+init_tmp_var_with_call (struct nesting_info *info, gimple_stmt_iterator *gsi,
+ gimple call)
+{
+ tree t;
+
+ t = create_tmp_var_for (info, gimple_call_return_type (call), NULL);
+ gimple_call_set_lhs (call, t);
+ if (! gsi_end_p (*gsi))
+ gimple_set_location (call, gimple_location (gsi_stmt (*gsi)));
+ gsi_insert_before (gsi, call, GSI_SAME_STMT);
+
+ return t;
+}
+
+
/* Copy EXP into a temporary. Allocate the temporary in the context of
- INFO and insert the initialization statement before TSI. */
+ INFO and insert the initialization statement before GSI. */
static tree
-init_tmp_var (struct nesting_info *info, tree exp, tree_stmt_iterator *tsi)
+init_tmp_var (struct nesting_info *info, tree exp, gimple_stmt_iterator *gsi)
{
- tree t, stmt;
+ tree t;
+ gimple stmt;
t = create_tmp_var_for (info, TREE_TYPE (exp), NULL);
- stmt = build_gimple_modify_stmt (t, exp);
- SET_EXPR_LOCUS (stmt, EXPR_LOCUS (tsi_stmt (*tsi)));
- tsi_link_before (tsi, stmt, TSI_SAME_STMT);
+ stmt = gimple_build_assign (t, exp);
+ if (! gsi_end_p (*gsi))
+ gimple_set_location (stmt, gimple_location (gsi_stmt (*gsi)));
+ gsi_insert_before_without_update (gsi, stmt, GSI_SAME_STMT);
return t;
}
+
/* Similarly, but only do so to force EXP to satisfy is_gimple_val. */
static tree
-tsi_gimplify_val (struct nesting_info *info, tree exp, tree_stmt_iterator *tsi)
+gsi_gimplify_val (struct nesting_info *info, tree exp,
+ gimple_stmt_iterator *gsi)
{
if (is_gimple_val (exp))
return exp;
else
- return init_tmp_var (info, exp, tsi);
+ return init_tmp_var (info, exp, gsi);
}
/* Similarly, but copy from the temporary and insert the statement
after the iterator. */
static tree
-save_tmp_var (struct nesting_info *info, tree exp,
- tree_stmt_iterator *tsi)
+save_tmp_var (struct nesting_info *info, tree exp, gimple_stmt_iterator *gsi)
{
- tree t, stmt;
+ tree t;
+ gimple stmt;
t = create_tmp_var_for (info, TREE_TYPE (exp), NULL);
- stmt = build_gimple_modify_stmt (exp, t);
- SET_EXPR_LOCUS (stmt, EXPR_LOCUS (tsi_stmt (*tsi)));
- tsi_link_after (tsi, stmt, TSI_SAME_STMT);
+ stmt = gimple_build_assign (exp, t);
+ if (! gsi_end_p (*gsi))
+ gimple_set_location (stmt, gimple_location (gsi_stmt (*gsi)));
+ gsi_insert_after_without_update (gsi, stmt, GSI_SAME_STMT);
return t;
}
@@ -512,236 +535,102 @@ get_nl_goto_field (struct nesting_info *info)
return field;
}
-
-/* Helper function for walk_stmts. Walk output operands of an ASM_EXPR. */
-
-static void
-walk_asm_expr (struct walk_stmt_info *wi, tree stmt)
-{
- int noutputs = list_length (ASM_OUTPUTS (stmt));
- const char **oconstraints
- = (const char **) alloca ((noutputs) * sizeof (const char *));
- int i;
- tree link;
- const char *constraint;
- bool allows_mem, allows_reg, is_inout;
-
- wi->is_lhs = true;
- for (i=0, link = ASM_OUTPUTS (stmt); link; ++i, link = TREE_CHAIN (link))
- {
- constraint = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (link)));
- oconstraints[i] = constraint;
- parse_output_constraint (&constraint, i, 0, 0, &allows_mem,
- &allows_reg, &is_inout);
-
- wi->val_only = (allows_reg || !allows_mem);
- walk_tree (&TREE_VALUE (link), wi->callback, wi, NULL);
- }
-
- for (link = ASM_INPUTS (stmt); link; link = TREE_CHAIN (link))
- {
- constraint = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (link)));
- parse_input_constraint (&constraint, 0, 0, noutputs, 0,
- oconstraints, &allows_mem, &allows_reg);
-
- wi->val_only = (allows_reg || !allows_mem);
- /* Although input "m" is not really a LHS, we need a lvalue. */
- wi->is_lhs = !wi->val_only;
- walk_tree (&TREE_VALUE (link), wi->callback, wi, NULL);
- }
-
- wi->is_lhs = false;
- wi->val_only = true;
-}
-
-/* Iterate over all sub-statements of *TP calling walk_tree with
- WI->CALLBACK for every sub-expression in each statement found. */
-
-void
-walk_stmts (struct walk_stmt_info *wi, tree *tp)
-{
- tree t = *tp;
- int walk_subtrees;
-
- if (!t)
- return;
- if (wi->want_locations && EXPR_HAS_LOCATION (t))
- input_location = EXPR_LOCATION (t);
-
- switch (TREE_CODE (t))
- {
- case STATEMENT_LIST:
- {
- tree_stmt_iterator i;
- for (i = tsi_start (t); !tsi_end_p (i); tsi_next (&i))
- {
- wi->tsi = i;
- walk_stmts (wi, tsi_stmt_ptr (i));
- }
- }
- break;
-
- case COND_EXPR:
- walk_tree (&COND_EXPR_COND (t), wi->callback, wi, NULL);
- walk_stmts (wi, &COND_EXPR_THEN (t));
- walk_stmts (wi, &COND_EXPR_ELSE (t));
- break;
- case CATCH_EXPR:
- walk_stmts (wi, &CATCH_BODY (t));
- break;
- case EH_FILTER_EXPR:
- walk_stmts (wi, &EH_FILTER_FAILURE (t));
- break;
- case TRY_CATCH_EXPR:
- case TRY_FINALLY_EXPR:
- walk_stmts (wi, &TREE_OPERAND (t, 0));
- walk_stmts (wi, &TREE_OPERAND (t, 1));
- break;
-
- case BIND_EXPR:
- if (wi->want_bind_expr)
- {
- walk_subtrees = 1;
- wi->callback (tp, &walk_subtrees, wi);
- if (!walk_subtrees)
- break;
- }
- walk_stmts (wi, &BIND_EXPR_BODY (t));
- break;
-
- case RETURN_EXPR:
- if (wi->want_return_expr)
- {
- walk_subtrees = 1;
- wi->callback (tp, &walk_subtrees, wi);
- if (!walk_subtrees)
- break;
- }
- walk_stmts (wi, &TREE_OPERAND (t, 0));
- break;
-
- case GIMPLE_MODIFY_STMT:
- /* A formal temporary lhs may use a COMPONENT_REF rhs. */
- wi->val_only = !is_gimple_formal_tmp_var (GIMPLE_STMT_OPERAND (t, 0));
- walk_tree (&GIMPLE_STMT_OPERAND (t, 1), wi->callback, wi, NULL);
-
- /* If the rhs is appropriate for a memory, we may use a
- COMPONENT_REF on the lhs. */
- wi->val_only = !is_gimple_mem_rhs (GIMPLE_STMT_OPERAND (t, 1));
- wi->is_lhs = true;
- walk_tree (&GIMPLE_STMT_OPERAND (t, 0), wi->callback, wi, NULL);
-
- wi->val_only = true;
- wi->is_lhs = false;
- break;
-
- case ASM_EXPR:
- walk_asm_expr (wi, *tp);
- break;
-
- default:
- wi->val_only = true;
- walk_tree (tp, wi->callback, wi, NULL);
- break;
- }
-}
-
-/* Invoke CALLBACK on all statements of *STMT_P. */
+/* Invoke CALLBACK on all statements of GIMPLE sequence SEQ. */
static void
-walk_body (walk_tree_fn callback, struct nesting_info *info, tree *stmt_p)
+walk_body (walk_stmt_fn callback_stmt, walk_tree_fn callback_op,
+ struct nesting_info *info, gimple_seq seq)
{
struct walk_stmt_info wi;
memset (&wi, 0, sizeof (wi));
- wi.callback = callback;
wi.info = info;
wi.val_only = true;
-
- walk_stmts (&wi, stmt_p);
+ walk_gimple_seq (seq, callback_stmt, callback_op, &wi);
}
-/* Invoke CALLBACK on all statements of INFO->CONTEXT. */
+
+/* Invoke CALLBACK_STMT/CALLBACK_OP on all statements of INFO->CONTEXT. */
static inline void
-walk_function (walk_tree_fn callback, struct nesting_info *info)
+walk_function (walk_stmt_fn callback_stmt, walk_tree_fn callback_op,
+ struct nesting_info *info)
{
- walk_body (callback, info, &DECL_SAVED_TREE (info->context));
+ walk_body (callback_stmt, callback_op, info, gimple_body (info->context));
}
-/* Invoke CALLBACK on OMP_FOR init, cond, incr and pre-body. */
+/* Invoke CALLBACK on a GIMPLE_OMP_FOR's init, cond, incr and pre-body. */
static void
-walk_omp_for (walk_tree_fn callback, struct nesting_info *info, tree for_stmt)
+walk_gimple_omp_for (gimple for_stmt,
+ walk_stmt_fn callback_stmt, walk_tree_fn callback_op,
+ struct nesting_info *info)
{
struct walk_stmt_info wi;
- tree t, list = NULL, empty;
- int i;
+ gimple_seq seq;
+ tree t;
+ size_t i;
- walk_body (callback, info, &OMP_FOR_PRE_BODY (for_stmt));
+ walk_body (callback_stmt, callback_op, info, gimple_omp_for_pre_body (for_stmt));
- empty = build_empty_stmt ();
- append_to_statement_list_force (empty, &list);
+ seq = gimple_seq_alloc ();
memset (&wi, 0, sizeof (wi));
- wi.callback = callback;
wi.info = info;
- wi.tsi = tsi_last (list);
+ wi.gsi = gsi_last (seq);
- for (i = 0; i < TREE_VEC_LENGTH (OMP_FOR_INIT (for_stmt)); i++)
+ for (i = 0; i < gimple_omp_for_collapse (for_stmt); i++)
{
- t = TREE_VEC_ELT (OMP_FOR_INIT (for_stmt), i);
- gcc_assert (TREE_CODE (t) == GIMPLE_MODIFY_STMT);
- SET_EXPR_LOCUS (empty, EXPR_LOCUS (t));
wi.val_only = false;
- walk_tree (&GIMPLE_STMT_OPERAND (t, 0), callback, &wi, NULL);
+ walk_tree (gimple_omp_for_index_ptr (for_stmt, i), callback_op,
+ &wi, NULL);
wi.val_only = true;
wi.is_lhs = false;
- walk_tree (&GIMPLE_STMT_OPERAND (t, 1), callback, &wi, NULL);
+ walk_tree (gimple_omp_for_initial_ptr (for_stmt, i), callback_op,
+ &wi, NULL);
- t = TREE_VEC_ELT (OMP_FOR_COND (for_stmt), i);
- gcc_assert (COMPARISON_CLASS_P (t));
- SET_EXPR_LOCUS (empty, EXPR_LOCUS (t));
- wi.val_only = false;
- walk_tree (&TREE_OPERAND (t, 0), callback, &wi, NULL);
wi.val_only = true;
wi.is_lhs = false;
- walk_tree (&TREE_OPERAND (t, 1), callback, &wi, NULL);
+ walk_tree (gimple_omp_for_final_ptr (for_stmt, i), callback_op,
+ &wi, NULL);
- t = TREE_VEC_ELT (OMP_FOR_INCR (for_stmt), i);
- gcc_assert (TREE_CODE (t) == GIMPLE_MODIFY_STMT);
- SET_EXPR_LOCUS (empty, EXPR_LOCUS (t));
- wi.val_only = false;
- walk_tree (&GIMPLE_STMT_OPERAND (t, 0), callback, &wi, NULL);
- t = GIMPLE_STMT_OPERAND (t, 1);
+ t = gimple_omp_for_incr (for_stmt, i);
gcc_assert (BINARY_CLASS_P (t));
wi.val_only = false;
- walk_tree (&TREE_OPERAND (t, 0), callback, &wi, NULL);
+ walk_tree (&TREE_OPERAND (t, 0), callback_op, &wi, NULL);
wi.val_only = true;
wi.is_lhs = false;
- walk_tree (&TREE_OPERAND (t, 1), callback, &wi, NULL);
+ walk_tree (&TREE_OPERAND (t, 1), callback_op, &wi, NULL);
}
- /* Remove empty statement added above from the end of statement list. */
- tsi_delink (&wi.tsi);
- append_to_statement_list (list, &OMP_FOR_PRE_BODY (for_stmt));
+ if (gimple_seq_empty_p (seq))
+ gimple_seq_free (seq);
+ else
+ {
+ gimple_seq pre_body = gimple_omp_for_pre_body (for_stmt);
+ annotate_all_with_location (seq, gimple_location (for_stmt));
+ gimple_seq_add_seq (&pre_body, seq);
+ gimple_omp_for_set_pre_body (for_stmt, pre_body);
+ }
}
/* Similarly for ROOT and all functions nested underneath, depth first. */
static void
-walk_all_functions (walk_tree_fn callback, struct nesting_info *root)
+walk_all_functions (walk_stmt_fn callback_stmt, walk_tree_fn callback_op,
+ struct nesting_info *root)
{
do
{
if (root->inner)
- walk_all_functions (callback, root->inner);
- walk_function (callback, root);
+ walk_all_functions (callback_stmt, callback_op, root->inner);
+ walk_function (callback_stmt, callback_op, root);
root = root->next;
}
while (root);
}
-
+
+
/* We have to check for a fairly pathological case. The operands of function
nested function are to be interpreted in the context of the enclosing
function. So if any are variably-sized, they will get remapped when the
@@ -817,7 +706,7 @@ create_nesting_tree (struct cgraph_node *cgn)
static tree
get_static_chain (struct nesting_info *info, tree target_context,
- tree_stmt_iterator *tsi)
+ gimple_stmt_iterator *gsi)
{
struct nesting_info *i;
tree x;
@@ -836,20 +725,21 @@ get_static_chain (struct nesting_info *info, tree target_context,
x = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (x)), x);
x = build3 (COMPONENT_REF, TREE_TYPE (field), x, field, NULL_TREE);
- x = init_tmp_var (info, x, tsi);
+ x = init_tmp_var (info, x, gsi);
}
}
return x;
}
+
/* Return an expression referencing FIELD from TARGET_CONTEXT's non-local
frame as seen from INFO->CONTEXT. Insert any necessary computations
- before TSI. */
+ before GSI. */
static tree
get_frame_field (struct nesting_info *info, tree target_context,
- tree field, tree_stmt_iterator *tsi)
+ tree field, gimple_stmt_iterator *gsi)
{
struct nesting_info *i;
tree x;
@@ -870,7 +760,7 @@ get_frame_field (struct nesting_info *info, tree target_context,
x = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (x)), x);
x = build3 (COMPONENT_REF, TREE_TYPE (field), x, field, NULL_TREE);
- x = init_tmp_var (info, x, tsi);
+ x = init_tmp_var (info, x, gsi);
}
x = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (x)), x);
@@ -880,7 +770,8 @@ get_frame_field (struct nesting_info *info, tree target_context,
return x;
}
-/* A subroutine of convert_nonlocal_reference. Create a local variable
+
+/* A subroutine of convert_nonlocal_reference_op. Create a local variable
in the nested function with DECL_VALUE_EXPR set to reference the true
variable in the parent function. This is used both for debug info
and in OpenMP lowering. */
@@ -947,7 +838,8 @@ get_nonlocal_debug_decl (struct nesting_info *info, tree decl)
return new_decl;
}
-/* Called via walk_function+walk_tree, rewrite all references to VAR
+
+/* Callback for walk_gimple_stmt, rewrite all references to VAR
and PARM_DECLs that belong to outer functions.
The rewrite will involve some number of structure accesses back up
@@ -955,16 +847,12 @@ get_nonlocal_debug_decl (struct nesting_info *info, tree decl)
be CHAIN->FOO. For two levels it'll be CHAIN->__chain->FOO. Further
indirections apply to decls for which use_pointer_in_frame is true. */
-static bool convert_nonlocal_omp_clauses (tree *, struct walk_stmt_info *);
-
static tree
-convert_nonlocal_reference (tree *tp, int *walk_subtrees, void *data)
+convert_nonlocal_reference_op (tree *tp, int *walk_subtrees, void *data)
{
struct walk_stmt_info *wi = (struct walk_stmt_info *) data;
struct nesting_info *const info = (struct nesting_info *) wi->info;
tree t = *tp;
- tree save_local_var_chain;
- bitmap save_suppress;
*walk_subtrees = 0;
switch (TREE_CODE (t))
@@ -989,10 +877,10 @@ convert_nonlocal_reference (tree *tp, int *walk_subtrees, void *data)
for (i = info->outer; i->context != target_context; i = i->outer)
continue;
x = lookup_field_for_decl (i, t, INSERT);
- x = get_frame_field (info, target_context, x, &wi->tsi);
+ x = get_frame_field (info, target_context, x, &wi->gsi);
if (use_pointer_in_frame (t))
{
- x = init_tmp_var (info, x, &wi->tsi);
+ x = init_tmp_var (info, x, &wi->gsi);
x = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (x)), x);
}
}
@@ -1000,25 +888,15 @@ convert_nonlocal_reference (tree *tp, int *walk_subtrees, void *data)
if (wi->val_only)
{
if (wi->is_lhs)
- x = save_tmp_var (info, x, &wi->tsi);
+ x = save_tmp_var (info, x, &wi->gsi);
else
- x = init_tmp_var (info, x, &wi->tsi);
+ x = init_tmp_var (info, x, &wi->gsi);
}
*tp = x;
}
break;
- case GOTO_EXPR:
- /* Don't walk non-local gotos for now. */
- if (TREE_CODE (GOTO_DESTINATION (t)) != LABEL_DECL)
- {
- *walk_subtrees = 1;
- wi->val_only = true;
- wi->is_lhs = false;
- }
- break;
-
case LABEL_DECL:
/* We're taking the address of a label from a parent function, but
this is not itself a non-local goto. Mark the label such that it
@@ -1035,7 +913,7 @@ convert_nonlocal_reference (tree *tp, int *walk_subtrees, void *data)
wi->val_only = false;
wi->is_lhs = false;
wi->changed = false;
- walk_tree (&TREE_OPERAND (t, 0), convert_nonlocal_reference, wi, NULL);
+ walk_tree (&TREE_OPERAND (t, 0), convert_nonlocal_reference_op, wi, 0);
wi->val_only = true;
if (wi->changed)
@@ -1053,8 +931,8 @@ convert_nonlocal_reference (tree *tp, int *walk_subtrees, void *data)
where we only accept variables (and min_invariant, presumably),
then compute the address into a temporary. */
if (save_val_only)
- *tp = tsi_gimplify_val ((struct nesting_info *) wi->info,
- t, &wi->tsi);
+ *tp = gsi_gimplify_val ((struct nesting_info *) wi->info,
+ t, &wi->gsi);
}
}
break;
@@ -1073,28 +951,28 @@ convert_nonlocal_reference (tree *tp, int *walk_subtrees, void *data)
for (; handled_component_p (t); tp = &TREE_OPERAND (t, 0), t = *tp)
{
if (TREE_CODE (t) == COMPONENT_REF)
- walk_tree (&TREE_OPERAND (t, 2), convert_nonlocal_reference, wi,
+ walk_tree (&TREE_OPERAND (t, 2), convert_nonlocal_reference_op, wi,
NULL);
else if (TREE_CODE (t) == ARRAY_REF
|| TREE_CODE (t) == ARRAY_RANGE_REF)
{
- walk_tree (&TREE_OPERAND (t, 1), convert_nonlocal_reference, wi,
- NULL);
- walk_tree (&TREE_OPERAND (t, 2), convert_nonlocal_reference, wi,
- NULL);
- walk_tree (&TREE_OPERAND (t, 3), convert_nonlocal_reference, wi,
- NULL);
+ walk_tree (&TREE_OPERAND (t, 1), convert_nonlocal_reference_op,
+ wi, NULL);
+ walk_tree (&TREE_OPERAND (t, 2), convert_nonlocal_reference_op,
+ wi, NULL);
+ walk_tree (&TREE_OPERAND (t, 3), convert_nonlocal_reference_op,
+ wi, NULL);
}
else if (TREE_CODE (t) == BIT_FIELD_REF)
{
- walk_tree (&TREE_OPERAND (t, 1), convert_nonlocal_reference, wi,
- NULL);
- walk_tree (&TREE_OPERAND (t, 2), convert_nonlocal_reference, wi,
- NULL);
+ walk_tree (&TREE_OPERAND (t, 1), convert_nonlocal_reference_op,
+ wi, NULL);
+ walk_tree (&TREE_OPERAND (t, 2), convert_nonlocal_reference_op,
+ wi, NULL);
}
}
wi->val_only = false;
- walk_tree (tp, convert_nonlocal_reference, wi, NULL);
+ walk_tree (tp, convert_nonlocal_reference_op, wi, NULL);
break;
case VIEW_CONVERT_EXPR:
@@ -1104,52 +982,6 @@ convert_nonlocal_reference (tree *tp, int *walk_subtrees, void *data)
*walk_subtrees = 1;
break;
- case OMP_PARALLEL:
- case OMP_TASK:
- save_suppress = info->suppress_expansion;
- if (convert_nonlocal_omp_clauses (&OMP_TASKREG_CLAUSES (t), wi))
- {
- tree c, decl;
- decl = get_chain_decl (info);
- c = build_omp_clause (OMP_CLAUSE_FIRSTPRIVATE);
- OMP_CLAUSE_DECL (c) = decl;
- OMP_CLAUSE_CHAIN (c) = OMP_TASKREG_CLAUSES (t);
- OMP_TASKREG_CLAUSES (t) = c;
- }
-
- save_local_var_chain = info->new_local_var_chain;
- info->new_local_var_chain = NULL;
-
- walk_body (convert_nonlocal_reference, info, &OMP_TASKREG_BODY (t));
-
- if (info->new_local_var_chain)
- declare_vars (info->new_local_var_chain, OMP_TASKREG_BODY (t), false);
- info->new_local_var_chain = save_local_var_chain;
- info->suppress_expansion = save_suppress;
- break;
-
- case OMP_FOR:
- save_suppress = info->suppress_expansion;
- convert_nonlocal_omp_clauses (&OMP_FOR_CLAUSES (t), wi);
- walk_omp_for (convert_nonlocal_reference, info, t);
- walk_body (convert_nonlocal_reference, info, &OMP_FOR_BODY (t));
- info->suppress_expansion = save_suppress;
- break;
-
- case OMP_SECTIONS:
- case OMP_SINGLE:
- save_suppress = info->suppress_expansion;
- convert_nonlocal_omp_clauses (&OMP_CLAUSES (t), wi);
- walk_body (convert_nonlocal_reference, info, &OMP_BODY (t));
- info->suppress_expansion = save_suppress;
- break;
-
- case OMP_SECTION:
- case OMP_MASTER:
- case OMP_ORDERED:
- walk_body (convert_nonlocal_reference, info, &OMP_BODY (t));
- break;
-
default:
if (!IS_TYPE_OR_DECL_P (t))
{
@@ -1163,6 +995,12 @@ convert_nonlocal_reference (tree *tp, int *walk_subtrees, void *data)
return NULL_TREE;
}
+static tree convert_nonlocal_reference_stmt (gimple_stmt_iterator *, bool *,
+ struct walk_stmt_info *);
+
+/* Helper for convert_nonlocal_references, rewrite all references to VAR
+ and PARM_DECLs that belong to outer functions. */
+
static bool
convert_nonlocal_omp_clauses (tree *pclauses, struct walk_stmt_info *wi)
{
@@ -1185,7 +1023,7 @@ convert_nonlocal_omp_clauses (tree *pclauses, struct walk_stmt_info *wi)
goto do_decl_clause;
case OMP_CLAUSE_LASTPRIVATE:
- if (OMP_CLAUSE_LASTPRIVATE_STMT (clause))
+ if (OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (clause))
need_stmts = true;
goto do_decl_clause;
@@ -1214,8 +1052,8 @@ convert_nonlocal_omp_clauses (tree *pclauses, struct walk_stmt_info *wi)
case OMP_CLAUSE_NUM_THREADS:
wi->val_only = true;
wi->is_lhs = false;
- convert_nonlocal_reference (&OMP_CLAUSE_OPERAND (clause, 0), &dummy,
- wi);
+ convert_nonlocal_reference_op (&OMP_CLAUSE_OPERAND (clause, 0),
+ &dummy, wi);
break;
case OMP_CLAUSE_NOWAIT:
@@ -1244,18 +1082,21 @@ convert_nonlocal_omp_clauses (tree *pclauses, struct walk_stmt_info *wi)
= DECL_CONTEXT (OMP_CLAUSE_REDUCTION_PLACEHOLDER (clause));
DECL_CONTEXT (OMP_CLAUSE_REDUCTION_PLACEHOLDER (clause))
= info->context;
- walk_body (convert_nonlocal_reference, info,
- &OMP_CLAUSE_REDUCTION_INIT (clause));
- walk_body (convert_nonlocal_reference, info,
- &OMP_CLAUSE_REDUCTION_MERGE (clause));
+ walk_body (convert_nonlocal_reference_stmt,
+ convert_nonlocal_reference_op, info,
+ OMP_CLAUSE_REDUCTION_GIMPLE_INIT (clause));
+ walk_body (convert_nonlocal_reference_stmt,
+ convert_nonlocal_reference_op, info,
+ OMP_CLAUSE_REDUCTION_GIMPLE_MERGE (clause));
DECL_CONTEXT (OMP_CLAUSE_REDUCTION_PLACEHOLDER (clause))
= old_context;
}
break;
case OMP_CLAUSE_LASTPRIVATE:
- walk_body (convert_nonlocal_reference, info,
- &OMP_CLAUSE_LASTPRIVATE_STMT (clause));
+ walk_body (convert_nonlocal_reference_stmt,
+ convert_nonlocal_reference_op, info,
+ OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (clause));
break;
default:
@@ -1265,6 +1106,110 @@ convert_nonlocal_omp_clauses (tree *pclauses, struct walk_stmt_info *wi)
return need_chain;
}
+
+/* Callback for walk_gimple_stmt. Rewrite all references to VAR and
+ PARM_DECLs that belong to outer functions. This handles statements
+ that are not handled via the standard recursion done in
+ walk_gimple_stmt. STMT is the statement to examine, DATA is as in
+ convert_nonlocal_reference_op. Set *HANDLED_OPS_P to true if all the
+ operands of STMT have been handled by this function. */
+
+static tree
+convert_nonlocal_reference_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p,
+ struct walk_stmt_info *wi)
+{
+ struct nesting_info *info = (struct nesting_info *) wi->info;
+ tree save_local_var_chain;
+ bitmap save_suppress;
+ gimple stmt = gsi_stmt (*gsi);
+
+ switch (gimple_code (stmt))
+ {
+ case GIMPLE_GOTO:
+ /* Don't walk non-local gotos for now. */
+ if (TREE_CODE (gimple_goto_dest (stmt)) != LABEL_DECL)
+ {
+ wi->val_only = true;
+ wi->is_lhs = false;
+ *handled_ops_p = true;
+ return NULL_TREE;
+ }
+ break;
+
+ case GIMPLE_OMP_PARALLEL:
+ case GIMPLE_OMP_TASK:
+ save_suppress = info->suppress_expansion;
+ if (convert_nonlocal_omp_clauses (gimple_omp_taskreg_clauses_ptr (stmt),
+ wi))
+ {
+ tree c, decl;
+ decl = get_chain_decl (info);
+ c = build_omp_clause (OMP_CLAUSE_FIRSTPRIVATE);
+ OMP_CLAUSE_DECL (c) = decl;
+ OMP_CLAUSE_CHAIN (c) = gimple_omp_taskreg_clauses (stmt);
+ gimple_omp_taskreg_set_clauses (stmt, c);
+ }
+
+ save_local_var_chain = info->new_local_var_chain;
+ info->new_local_var_chain = NULL;
+
+ walk_body (convert_nonlocal_reference_stmt, convert_nonlocal_reference_op,
+ info, gimple_omp_body (stmt));
+
+ if (info->new_local_var_chain)
+ declare_vars (info->new_local_var_chain,
+ gimple_seq_first_stmt (gimple_omp_body (stmt)),
+ false);
+ info->new_local_var_chain = save_local_var_chain;
+ info->suppress_expansion = save_suppress;
+ break;
+
+ case GIMPLE_OMP_FOR:
+ save_suppress = info->suppress_expansion;
+ convert_nonlocal_omp_clauses (gimple_omp_for_clauses_ptr (stmt), wi);
+ walk_gimple_omp_for (stmt, convert_nonlocal_reference_stmt,
+ convert_nonlocal_reference_op, info);
+ walk_body (convert_nonlocal_reference_stmt,
+ convert_nonlocal_reference_op, info, gimple_omp_body (stmt));
+ info->suppress_expansion = save_suppress;
+ break;
+
+ case GIMPLE_OMP_SECTIONS:
+ save_suppress = info->suppress_expansion;
+ convert_nonlocal_omp_clauses (gimple_omp_sections_clauses_ptr (stmt), wi);
+ walk_body (convert_nonlocal_reference_stmt, convert_nonlocal_reference_op,
+ info, gimple_omp_body (stmt));
+ info->suppress_expansion = save_suppress;
+ break;
+
+ case GIMPLE_OMP_SINGLE:
+ save_suppress = info->suppress_expansion;
+ convert_nonlocal_omp_clauses (gimple_omp_single_clauses_ptr (stmt), wi);
+ walk_body (convert_nonlocal_reference_stmt, convert_nonlocal_reference_op,
+ info, gimple_omp_body (stmt));
+ info->suppress_expansion = save_suppress;
+ break;
+
+ case GIMPLE_OMP_SECTION:
+ case GIMPLE_OMP_MASTER:
+ case GIMPLE_OMP_ORDERED:
+ walk_body (convert_nonlocal_reference_stmt, convert_nonlocal_reference_op,
+ info, gimple_omp_body (stmt));
+ break;
+
+ default:
+ /* For every other statement that we are not interested in
+ handling here, let the walker traverse the operands. */
+ *handled_ops_p = false;
+ return NULL_TREE;
+ }
+
+ /* We have handled all of STMT operands, no need to traverse the operands. */
+ *handled_ops_p = true;
+ return NULL_TREE;
+}
+
+
/* A subroutine of convert_local_reference. Create a local variable
in the parent function with DECL_VALUE_EXPR set to reference the
field in FRAME. This is used both for debug info and in OpenMP
@@ -1309,21 +1254,20 @@ get_local_debug_decl (struct nesting_info *info, tree decl, tree field)
return new_decl;
}
-/* Called via walk_function+walk_tree, rewrite all references to VAR
+
+/* Called via walk_function+walk_gimple_stmt, rewrite all references to VAR
and PARM_DECLs that were referenced by inner nested functions.
The rewrite will be a structure reference to the local frame variable. */
static bool convert_local_omp_clauses (tree *, struct walk_stmt_info *);
static tree
-convert_local_reference (tree *tp, int *walk_subtrees, void *data)
+convert_local_reference_op (tree *tp, int *walk_subtrees, void *data)
{
struct walk_stmt_info *wi = (struct walk_stmt_info *) data;
struct nesting_info *const info = (struct nesting_info *) wi->info;
tree t = *tp, field, x;
bool save_val_only;
- tree save_local_var_chain;
- bitmap save_suppress;
*walk_subtrees = 0;
switch (TREE_CODE (t))
@@ -1351,14 +1295,14 @@ convert_local_reference (tree *tp, int *walk_subtrees, void *data)
x = get_local_debug_decl (info, t, field);
if (!bitmap_bit_p (info->suppress_expansion, DECL_UID (t)))
- x = get_frame_field (info, info->context, field, &wi->tsi);
+ x = get_frame_field (info, info->context, field, &wi->gsi);
if (wi->val_only)
{
if (wi->is_lhs)
- x = save_tmp_var (info, x, &wi->tsi);
+ x = save_tmp_var (info, x, &wi->gsi);
else
- x = init_tmp_var (info, x, &wi->tsi);
+ x = init_tmp_var (info, x, &wi->gsi);
}
*tp = x;
@@ -1370,7 +1314,7 @@ convert_local_reference (tree *tp, int *walk_subtrees, void *data)
wi->val_only = false;
wi->is_lhs = false;
wi->changed = false;
- walk_tree (&TREE_OPERAND (t, 0), convert_local_reference, wi, NULL);
+ walk_tree (&TREE_OPERAND (t, 0), convert_local_reference_op, wi, NULL);
wi->val_only = save_val_only;
/* If we converted anything ... */
@@ -1389,7 +1333,8 @@ convert_local_reference (tree *tp, int *walk_subtrees, void *data)
/* If we are in a context where we only accept values, then
compute the address into a temporary. */
if (save_val_only)
- *tp = tsi_gimplify_val ((struct nesting_info *)wi->info, t, &wi->tsi);
+ *tp = gsi_gimplify_val ((struct nesting_info *) wi->info,
+ t, &wi->gsi);
}
break;
@@ -1408,28 +1353,28 @@ convert_local_reference (tree *tp, int *walk_subtrees, void *data)
for (; handled_component_p (t); tp = &TREE_OPERAND (t, 0), t = *tp)
{
if (TREE_CODE (t) == COMPONENT_REF)
- walk_tree (&TREE_OPERAND (t, 2), convert_local_reference, wi,
+ walk_tree (&TREE_OPERAND (t, 2), convert_local_reference_op, wi,
NULL);
else if (TREE_CODE (t) == ARRAY_REF
|| TREE_CODE (t) == ARRAY_RANGE_REF)
{
- walk_tree (&TREE_OPERAND (t, 1), convert_local_reference, wi,
+ walk_tree (&TREE_OPERAND (t, 1), convert_local_reference_op, wi,
NULL);
- walk_tree (&TREE_OPERAND (t, 2), convert_local_reference, wi,
+ walk_tree (&TREE_OPERAND (t, 2), convert_local_reference_op, wi,
NULL);
- walk_tree (&TREE_OPERAND (t, 3), convert_local_reference, wi,
+ walk_tree (&TREE_OPERAND (t, 3), convert_local_reference_op, wi,
NULL);
}
else if (TREE_CODE (t) == BIT_FIELD_REF)
{
- walk_tree (&TREE_OPERAND (t, 1), convert_local_reference, wi,
+ walk_tree (&TREE_OPERAND (t, 1), convert_local_reference_op, wi,
NULL);
- walk_tree (&TREE_OPERAND (t, 2), convert_local_reference, wi,
+ walk_tree (&TREE_OPERAND (t, 2), convert_local_reference_op, wi,
NULL);
}
}
wi->val_only = false;
- walk_tree (tp, convert_local_reference, wi, NULL);
+ walk_tree (tp, convert_local_reference_op, wi, NULL);
wi->val_only = save_val_only;
break;
@@ -1440,52 +1385,6 @@ convert_local_reference (tree *tp, int *walk_subtrees, void *data)
*walk_subtrees = 1;
break;
- case OMP_PARALLEL:
- case OMP_TASK:
- save_suppress = info->suppress_expansion;
- if (convert_local_omp_clauses (&OMP_TASKREG_CLAUSES (t), wi))
- {
- tree c;
- (void) get_frame_type (info);
- c = build_omp_clause (OMP_CLAUSE_SHARED);
- OMP_CLAUSE_DECL (c) = info->frame_decl;
- OMP_CLAUSE_CHAIN (c) = OMP_TASKREG_CLAUSES (t);
- OMP_TASKREG_CLAUSES (t) = c;
- }
-
- save_local_var_chain = info->new_local_var_chain;
- info->new_local_var_chain = NULL;
-
- walk_body (convert_local_reference, info, &OMP_TASKREG_BODY (t));
-
- if (info->new_local_var_chain)
- declare_vars (info->new_local_var_chain, OMP_TASKREG_BODY (t), false);
- info->new_local_var_chain = save_local_var_chain;
- info->suppress_expansion = save_suppress;
- break;
-
- case OMP_FOR:
- save_suppress = info->suppress_expansion;
- convert_local_omp_clauses (&OMP_FOR_CLAUSES (t), wi);
- walk_omp_for (convert_local_reference, info, t);
- walk_body (convert_local_reference, info, &OMP_FOR_BODY (t));
- info->suppress_expansion = save_suppress;
- break;
-
- case OMP_SECTIONS:
- case OMP_SINGLE:
- save_suppress = info->suppress_expansion;
- convert_local_omp_clauses (&OMP_CLAUSES (t), wi);
- walk_body (convert_local_reference, info, &OMP_BODY (t));
- info->suppress_expansion = save_suppress;
- break;
-
- case OMP_SECTION:
- case OMP_MASTER:
- case OMP_ORDERED:
- walk_body (convert_local_reference, info, &OMP_BODY (t));
- break;
-
default:
if (!IS_TYPE_OR_DECL_P (t))
{
@@ -1499,6 +1398,12 @@ convert_local_reference (tree *tp, int *walk_subtrees, void *data)
return NULL_TREE;
}
+static tree convert_local_reference_stmt (gimple_stmt_iterator *, bool *,
+ struct walk_stmt_info *);
+
+/* Helper for convert_local_reference. Convert all the references in
+ the chain of clauses at *PCLAUSES. WI is as in convert_local_reference. */
+
static bool
convert_local_omp_clauses (tree *pclauses, struct walk_stmt_info *wi)
{
@@ -1521,7 +1426,7 @@ convert_local_omp_clauses (tree *pclauses, struct walk_stmt_info *wi)
goto do_decl_clause;
case OMP_CLAUSE_LASTPRIVATE:
- if (OMP_CLAUSE_LASTPRIVATE_STMT (clause))
+ if (OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (clause))
need_stmts = true;
goto do_decl_clause;
@@ -1556,7 +1461,8 @@ convert_local_omp_clauses (tree *pclauses, struct walk_stmt_info *wi)
case OMP_CLAUSE_NUM_THREADS:
wi->val_only = true;
wi->is_lhs = false;
- convert_local_reference (&OMP_CLAUSE_OPERAND (clause, 0), &dummy, wi);
+ convert_local_reference_op (&OMP_CLAUSE_OPERAND (clause, 0), &dummy,
+ wi);
break;
case OMP_CLAUSE_NOWAIT:
@@ -1585,18 +1491,21 @@ convert_local_omp_clauses (tree *pclauses, struct walk_stmt_info *wi)
= DECL_CONTEXT (OMP_CLAUSE_REDUCTION_PLACEHOLDER (clause));
DECL_CONTEXT (OMP_CLAUSE_REDUCTION_PLACEHOLDER (clause))
= info->context;
- walk_body (convert_local_reference, info,
- &OMP_CLAUSE_REDUCTION_INIT (clause));
- walk_body (convert_local_reference, info,
- &OMP_CLAUSE_REDUCTION_MERGE (clause));
+ walk_body (convert_local_reference_stmt,
+ convert_local_reference_op, info,
+ OMP_CLAUSE_REDUCTION_GIMPLE_INIT (clause));
+ walk_body (convert_local_reference_stmt,
+ convert_local_reference_op, info,
+ OMP_CLAUSE_REDUCTION_GIMPLE_MERGE (clause));
DECL_CONTEXT (OMP_CLAUSE_REDUCTION_PLACEHOLDER (clause))
= old_context;
}
break;
case OMP_CLAUSE_LASTPRIVATE:
- walk_body (convert_local_reference, info,
- &OMP_CLAUSE_LASTPRIVATE_STMT (clause));
+ walk_body (convert_local_reference_stmt,
+ convert_local_reference_op, info,
+ OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (clause));
break;
default:
@@ -1606,27 +1515,128 @@ convert_local_omp_clauses (tree *pclauses, struct walk_stmt_info *wi)
return need_frame;
}
-/* Called via walk_function+walk_tree, rewrite all GOTO_EXPRs that
- reference labels from outer functions. The rewrite will be a
+
+/* Called via walk_function+walk_gimple_stmt, rewrite all references to VAR
+ and PARM_DECLs that were referenced by inner nested functions.
+ The rewrite will be a structure reference to the local frame variable. */
+
+static tree
+convert_local_reference_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p,
+ struct walk_stmt_info *wi)
+{
+ struct nesting_info *info = (struct nesting_info *) wi->info;
+ tree save_local_var_chain;
+ bitmap save_suppress;
+ gimple stmt = gsi_stmt (*gsi);
+
+ switch (gimple_code (stmt))
+ {
+ case GIMPLE_OMP_PARALLEL:
+ case GIMPLE_OMP_TASK:
+ save_suppress = info->suppress_expansion;
+ if (convert_local_omp_clauses (gimple_omp_taskreg_clauses_ptr (stmt),
+ wi))
+ {
+ tree c;
+ (void) get_frame_type (info);
+ c = build_omp_clause (OMP_CLAUSE_SHARED);
+ OMP_CLAUSE_DECL (c) = info->frame_decl;
+ OMP_CLAUSE_CHAIN (c) = gimple_omp_taskreg_clauses (stmt);
+ gimple_omp_taskreg_set_clauses (stmt, c);
+ }
+
+ save_local_var_chain = info->new_local_var_chain;
+ info->new_local_var_chain = NULL;
+
+ walk_body (convert_local_reference_stmt, convert_local_reference_op, info,
+ gimple_omp_body (stmt));
+
+ if (info->new_local_var_chain)
+ declare_vars (info->new_local_var_chain,
+ gimple_seq_first_stmt (gimple_omp_body (stmt)), false);
+ info->new_local_var_chain = save_local_var_chain;
+ info->suppress_expansion = save_suppress;
+ break;
+
+ case GIMPLE_OMP_FOR:
+ save_suppress = info->suppress_expansion;
+ convert_local_omp_clauses (gimple_omp_for_clauses_ptr (stmt), wi);
+ walk_gimple_omp_for (stmt, convert_local_reference_stmt,
+ convert_local_reference_op, info);
+ walk_body (convert_local_reference_stmt, convert_local_reference_op,
+ info, gimple_omp_body (stmt));
+ info->suppress_expansion = save_suppress;
+ break;
+
+ case GIMPLE_OMP_SECTIONS:
+ save_suppress = info->suppress_expansion;
+ convert_local_omp_clauses (gimple_omp_sections_clauses_ptr (stmt), wi);
+ walk_body (convert_local_reference_stmt, convert_local_reference_op,
+ info, gimple_omp_body (stmt));
+ info->suppress_expansion = save_suppress;
+ break;
+
+ case GIMPLE_OMP_SINGLE:
+ save_suppress = info->suppress_expansion;
+ convert_local_omp_clauses (gimple_omp_single_clauses_ptr (stmt), wi);
+ walk_body (convert_local_reference_stmt, convert_local_reference_op,
+ info, gimple_omp_body (stmt));
+ info->suppress_expansion = save_suppress;
+ break;
+
+ case GIMPLE_OMP_SECTION:
+ case GIMPLE_OMP_MASTER:
+ case GIMPLE_OMP_ORDERED:
+ walk_body (convert_local_reference_stmt, convert_local_reference_op,
+ info, gimple_omp_body (stmt));
+ break;
+
+ default:
+ /* For every other statement that we are not interested in
+ handling here, let the walker traverse the operands. */
+ *handled_ops_p = false;
+ return NULL_TREE;
+ }
+
+ /* Indicate that we have handled all the operands ourselves. */
+ *handled_ops_p = true;
+ return NULL_TREE;
+}
+
+
+/* Called via walk_function+walk_gimple_stmt, rewrite all GIMPLE_GOTOs
+ that reference labels from outer functions. The rewrite will be a
call to __builtin_nonlocal_goto. */
static tree
-convert_nl_goto_reference (tree *tp, int *walk_subtrees, void *data)
+convert_nl_goto_reference (gimple_stmt_iterator *gsi, bool *handled_ops_p,
+ struct walk_stmt_info *wi)
{
- struct walk_stmt_info *wi = (struct walk_stmt_info *) data;
struct nesting_info *const info = (struct nesting_info *) wi->info, *i;
- tree t = *tp, label, new_label, target_context, x, field;
+ tree label, new_label, target_context, x, field;
void **slot;
+ gimple call;
+ gimple stmt = gsi_stmt (*gsi);
- *walk_subtrees = 0;
- if (TREE_CODE (t) != GOTO_EXPR)
- return NULL_TREE;
- label = GOTO_DESTINATION (t);
+ if (gimple_code (stmt) != GIMPLE_GOTO)
+ {
+ *handled_ops_p = false;
+ return NULL_TREE;
+ }
+
+ label = gimple_goto_dest (stmt);
if (TREE_CODE (label) != LABEL_DECL)
- return NULL_TREE;
+ {
+ *handled_ops_p = false;
+ return NULL_TREE;
+ }
+
target_context = decl_function_context (label);
if (target_context == info->context)
- return NULL_TREE;
+ {
+ *handled_ops_p = false;
+ return NULL_TREE;
+ }
for (i = info->outer; target_context != i->context; i = i->outer)
continue;
@@ -1650,69 +1660,80 @@ convert_nl_goto_reference (tree *tp, int *walk_subtrees, void *data)
/* Build: __builtin_nl_goto(new_label, &chain->nl_goto_field). */
field = get_nl_goto_field (i);
- x = get_frame_field (info, target_context, field, &wi->tsi);
+ x = get_frame_field (info, target_context, field, &wi->gsi);
x = build_addr (x, target_context);
- x = tsi_gimplify_val (info, x, &wi->tsi);
- x = build_call_expr (implicit_built_in_decls[BUILT_IN_NONLOCAL_GOTO], 2,
- build_addr (new_label, target_context), x);
-
- SET_EXPR_LOCUS (x, EXPR_LOCUS (tsi_stmt (wi->tsi)));
- *tsi_stmt_ptr (wi->tsi) = x;
+ x = gsi_gimplify_val (info, x, &wi->gsi);
+ call = gimple_build_call (implicit_built_in_decls[BUILT_IN_NONLOCAL_GOTO], 2,
+ build_addr (new_label, target_context), x);
+ gsi_replace (&wi->gsi, call, false);
+ /* We have handled all of STMT's operands, no need to keep going. */
+ *handled_ops_p = true;
return NULL_TREE;
}
-/* Called via walk_function+walk_tree, rewrite all LABEL_EXPRs that
+
+/* Called via walk_function+walk_tree, rewrite all GIMPLE_LABELs whose labels
are referenced via nonlocal goto from a nested function. The rewrite
will involve installing a newly generated DECL_NONLOCAL label, and
- (potentially) a branch around the rtl gunk that is assumed to be
+ (potentially) a branch around the rtl gunk that is assumed to be
attached to such a label. */
static tree
-convert_nl_goto_receiver (tree *tp, int *walk_subtrees, void *data)
+convert_nl_goto_receiver (gimple_stmt_iterator *gsi, bool *handled_ops_p,
+ struct walk_stmt_info *wi)
{
- struct walk_stmt_info *wi = (struct walk_stmt_info *) data;
struct nesting_info *const info = (struct nesting_info *) wi->info;
- tree t = *tp, label, new_label, x;
- tree_stmt_iterator tmp_tsi;
+ tree label, new_label;
+ gimple_stmt_iterator tmp_gsi;
void **slot;
+ gimple stmt = gsi_stmt (*gsi);
- *walk_subtrees = 0;
- if (TREE_CODE (t) != LABEL_EXPR)
- return NULL_TREE;
- label = LABEL_EXPR_LABEL (t);
+ if (gimple_code (stmt) != GIMPLE_LABEL)
+ {
+ *handled_ops_p = false;
+ return NULL_TREE;
+ }
+
+ label = gimple_label_label (stmt);
slot = pointer_map_contains (info->var_map, label);
if (!slot)
- return NULL_TREE;
+ {
+ *handled_ops_p = false;
+ return NULL_TREE;
+ }
/* If there's any possibility that the previous statement falls through,
then we must branch around the new non-local label. */
- tmp_tsi = wi->tsi;
- tsi_prev (&tmp_tsi);
- if (tsi_end_p (tmp_tsi) || block_may_fallthru (tsi_stmt (tmp_tsi)))
+ tmp_gsi = wi->gsi;
+ gsi_prev (&tmp_gsi);
+ if (gsi_end_p (tmp_gsi) || gimple_stmt_may_fallthru (gsi_stmt (tmp_gsi)))
{
- x = build1 (GOTO_EXPR, void_type_node, label);
- tsi_link_before (&wi->tsi, x, TSI_SAME_STMT);
+ gimple stmt = gimple_build_goto (label);
+ gsi_insert_before (gsi, stmt, GSI_SAME_STMT);
}
new_label = (tree) *slot;
- x = build1 (LABEL_EXPR, void_type_node, new_label);
- tsi_link_before (&wi->tsi, x, TSI_SAME_STMT);
+ stmt = gimple_build_label (new_label);
+ gsi_insert_before (gsi, stmt, GSI_SAME_STMT);
+ *handled_ops_p = true;
return NULL_TREE;
}
-/* Called via walk_function+walk_tree, rewrite all references to addresses
+
+/* Called via walk_function+walk_stmt, rewrite all references to addresses
of nested functions that require the use of trampolines. The rewrite
will involve a reference a trampoline generated for the occasion. */
static tree
-convert_tramp_reference (tree *tp, int *walk_subtrees, void *data)
+convert_tramp_reference_op (tree *tp, int *walk_subtrees, void *data)
{
struct walk_stmt_info *wi = (struct walk_stmt_info *) data;
struct nesting_info *const info = (struct nesting_info *) wi->info, *i;
- tree t = *tp, decl, target_context, x;
+ tree t = *tp, decl, target_context, x, builtin;
+ gimple call;
*walk_subtrees = 0;
switch (TREE_CODE (t))
@@ -1749,85 +1770,103 @@ convert_tramp_reference (tree *tp, int *walk_subtrees, void *data)
x = lookup_tramp_for_decl (i, decl, INSERT);
/* Compute the address of the field holding the trampoline. */
- x = get_frame_field (info, target_context, x, &wi->tsi);
+ x = get_frame_field (info, target_context, x, &wi->gsi);
x = build_addr (x, target_context);
- x = tsi_gimplify_val (info, x, &wi->tsi);
+ x = gsi_gimplify_val (info, x, &wi->gsi);
/* Do machine-specific ugliness. Normally this will involve
computing extra alignment, but it can really be anything. */
- x = build_call_expr (implicit_built_in_decls[BUILT_IN_ADJUST_TRAMPOLINE],
- 1, x);
- x = init_tmp_var (info, x, &wi->tsi);
+ builtin = implicit_built_in_decls[BUILT_IN_ADJUST_TRAMPOLINE];
+ call = gimple_build_call (builtin, 1, x);
+ x = init_tmp_var_with_call (info, &wi->gsi, call);
/* Cast back to the proper function type. */
x = build1 (NOP_EXPR, TREE_TYPE (t), x);
- x = init_tmp_var (info, x, &wi->tsi);
+ x = init_tmp_var (info, x, &wi->gsi);
*tp = x;
break;
- case CALL_EXPR:
- /* Only walk call arguments, lest we generate trampolines for
- direct calls. */
+ default:
+ if (!IS_TYPE_OR_DECL_P (t))
+ *walk_subtrees = 1;
+ break;
+ }
+
+ return NULL_TREE;
+}
+
+
+/* Called via walk_function+walk_gimple_stmt, rewrite all references
+ to addresses of nested functions that require the use of
+ trampolines. The rewrite will involve a reference a trampoline
+ generated for the occasion. */
+
+static tree
+convert_tramp_reference_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p,
+ struct walk_stmt_info *wi)
+{
+ gimple stmt = gsi_stmt (*gsi);
+
+ switch (gimple_code (stmt))
+ {
+ case GIMPLE_CALL:
{
- int nargs = call_expr_nargs (t);
- int i;
+ /* Only walk call arguments, lest we generate trampolines for
+ direct calls. */
+ unsigned long i, nargs = gimple_call_num_args (stmt);
for (i = 0; i < nargs; i++)
- walk_tree (&CALL_EXPR_ARG (t, i), convert_tramp_reference, wi, NULL);
+ walk_tree (gimple_call_arg_ptr (stmt, i), convert_tramp_reference_op,
+ wi, NULL);
+
+ *handled_ops_p = true;
+ return NULL_TREE;
}
- break;
default:
- if (!IS_TYPE_OR_DECL_P (t))
- *walk_subtrees = 1;
break;
}
+ *handled_ops_p = false;
return NULL_TREE;
}
-/* Called via walk_function+walk_tree, rewrite all CALL_EXPRs that
- reference nested functions to make sure that the static chain is
- set up properly for the call. */
+
+
+/* Called via walk_function+walk_gimple_stmt, rewrite all GIMPLE_CALLs
+ that reference nested functions to make sure that the static chain
+ is set up properly for the call. */
static tree
-convert_call_expr (tree *tp, int *walk_subtrees, void *data)
+convert_gimple_call (gimple_stmt_iterator *gsi, bool *handled_ops_p,
+ struct walk_stmt_info *wi)
{
- struct walk_stmt_info *wi = (struct walk_stmt_info *) data;
struct nesting_info *const info = (struct nesting_info *) wi->info;
- tree t = *tp, decl, target_context;
+ tree decl, target_context;
char save_static_chain_added;
int i;
+ gimple stmt = gsi_stmt (*gsi);
- *walk_subtrees = 0;
- switch (TREE_CODE (t))
+ switch (gimple_code (stmt))
{
- case CALL_EXPR:
- decl = get_callee_fndecl (t);
+ case GIMPLE_CALL:
+ decl = gimple_call_fndecl (stmt);
if (!decl)
break;
target_context = decl_function_context (decl);
if (target_context && !DECL_NO_STATIC_CHAIN (decl))
{
- CALL_EXPR_STATIC_CHAIN (t)
- = get_static_chain (info, target_context, &wi->tsi);
- info->static_chain_added
- |= (1 << (info->context != target_context));
+ gimple_call_set_chain (stmt, get_static_chain (info, target_context,
+ &wi->gsi));
+ info->static_chain_added |= (1 << (info->context != target_context));
}
break;
- case RETURN_EXPR:
- case GIMPLE_MODIFY_STMT:
- case WITH_SIZE_EXPR:
- /* Only return modify and with_size_expr may contain calls. */
- *walk_subtrees = 1;
- break;
-
- case OMP_PARALLEL:
- case OMP_TASK:
+ case GIMPLE_OMP_PARALLEL:
+ case GIMPLE_OMP_TASK:
save_static_chain_added = info->static_chain_added;
info->static_chain_added = 0;
- walk_body (convert_call_expr, info, &OMP_TASKREG_BODY (t));
+ walk_body (convert_gimple_call, NULL, info, gimple_omp_body (stmt));
for (i = 0; i < 2; i++)
{
tree c, decl;
@@ -1835,7 +1874,9 @@ convert_call_expr (tree *tp, int *walk_subtrees, void *data)
continue;
decl = i ? get_chain_decl (info) : info->frame_decl;
/* Don't add CHAIN.* or FRAME.* twice. */
- for (c = OMP_TASKREG_CLAUSES (t); c; c = OMP_CLAUSE_CHAIN (c))
+ for (c = gimple_omp_taskreg_clauses (stmt);
+ c;
+ c = OMP_CLAUSE_CHAIN (c))
if ((OMP_CLAUSE_CODE (c) == OMP_CLAUSE_FIRSTPRIVATE
|| OMP_CLAUSE_CODE (c) == OMP_CLAUSE_SHARED)
&& OMP_CLAUSE_DECL (c) == decl)
@@ -1845,32 +1886,37 @@ convert_call_expr (tree *tp, int *walk_subtrees, void *data)
c = build_omp_clause (i ? OMP_CLAUSE_FIRSTPRIVATE
: OMP_CLAUSE_SHARED);
OMP_CLAUSE_DECL (c) = decl;
- OMP_CLAUSE_CHAIN (c) = OMP_TASKREG_CLAUSES (t);
- OMP_TASKREG_CLAUSES (t) = c;
+ OMP_CLAUSE_CHAIN (c) = gimple_omp_taskreg_clauses (stmt);
+ gimple_omp_taskreg_set_clauses (stmt, c);
}
}
info->static_chain_added |= save_static_chain_added;
break;
- case OMP_FOR:
- walk_body (convert_call_expr, info, &OMP_FOR_PRE_BODY (t));
+ case GIMPLE_OMP_FOR:
+ walk_body (convert_gimple_call, NULL, info,
+ gimple_omp_for_pre_body (stmt));
/* FALLTHRU */
- case OMP_SECTIONS:
- case OMP_SECTION:
- case OMP_SINGLE:
- case OMP_MASTER:
- case OMP_ORDERED:
- case OMP_CRITICAL:
- walk_body (convert_call_expr, info, &OMP_BODY (t));
+ case GIMPLE_OMP_SECTIONS:
+ case GIMPLE_OMP_SECTION:
+ case GIMPLE_OMP_SINGLE:
+ case GIMPLE_OMP_MASTER:
+ case GIMPLE_OMP_ORDERED:
+ case GIMPLE_OMP_CRITICAL:
+ walk_body (convert_gimple_call, NULL, info, gimple_omp_body (stmt));
break;
default:
- break;
+ /* Keep looking for other operands. */
+ *handled_ops_p = false;
+ return NULL_TREE;
}
+ *handled_ops_p = true;
return NULL_TREE;
}
+
/* Walk the nesting tree starting with ROOT, depth first. Convert all
trampolines and call expressions. On the way back up, determine if
a nested function actually uses its static chain; if not, remember that. */
@@ -1883,8 +1929,9 @@ convert_all_function_calls (struct nesting_info *root)
if (root->inner)
convert_all_function_calls (root->inner);
- walk_function (convert_tramp_reference, root);
- walk_function (convert_call_expr, root);
+ walk_function (convert_tramp_reference_stmt, convert_tramp_reference_op,
+ root);
+ walk_function (convert_gimple_call, NULL, root);
/* If the function does not use a static chain, then remember that. */
if (root->outer && !root->chain_decl && !root->chain_field)
@@ -1905,10 +1952,13 @@ convert_all_function_calls (struct nesting_info *root)
static void
finalize_nesting_tree_1 (struct nesting_info *root)
{
- tree stmt_list = NULL;
+ gimple_seq stmt_list;
+ gimple stmt;
tree context = root->context;
struct function *sf;
+ stmt_list = NULL;
+
/* If we created a non-local frame type or decl, we need to lay them
out at this time. */
if (root->frame_type)
@@ -1943,8 +1993,8 @@ finalize_nesting_tree_1 (struct nesting_info *root)
y = build3 (COMPONENT_REF, TREE_TYPE (field),
root->frame_decl, field, NULL_TREE);
- x = build_gimple_modify_stmt (y, x);
- append_to_statement_list (x, &stmt_list);
+ stmt = gimple_build_assign (y, x);
+ gimple_seq_add_stmt (&stmt_list, stmt);
}
}
@@ -1954,8 +2004,8 @@ finalize_nesting_tree_1 (struct nesting_info *root)
{
tree x = build3 (COMPONENT_REF, TREE_TYPE (root->chain_field),
root->frame_decl, root->chain_field, NULL_TREE);
- x = build_gimple_modify_stmt (x, get_chain_decl (root));
- append_to_statement_list (x, &stmt_list);
+ stmt = gimple_build_assign (x, get_chain_decl (root));
+ gimple_seq_add_stmt (&stmt_list, stmt);
}
/* If trampolines were created, then we need to initialize them. */
@@ -1982,19 +2032,19 @@ finalize_nesting_tree_1 (struct nesting_info *root)
arg1 = build_addr (x, context);
x = implicit_built_in_decls[BUILT_IN_INIT_TRAMPOLINE];
- x = build_call_expr (x, 3, arg1, arg2, arg3);
- append_to_statement_list (x, &stmt_list);
+ stmt = gimple_build_call (x, 3, arg1, arg2, arg3);
+ gimple_seq_add_stmt (&stmt_list, stmt);
}
}
/* If we created initialization statements, insert them. */
if (stmt_list)
{
- annotate_all_with_locus (&stmt_list,
- DECL_SOURCE_LOCATION (context));
- append_to_statement_list (BIND_EXPR_BODY (DECL_SAVED_TREE (context)),
- &stmt_list);
- BIND_EXPR_BODY (DECL_SAVED_TREE (context)) = stmt_list;
+ gimple bind;
+ annotate_all_with_location (stmt_list, DECL_SOURCE_LOCATION (context));
+ bind = gimple_seq_first_stmt (gimple_body (context));
+ gimple_seq_add_seq (&stmt_list, gimple_bind_body (bind));
+ gimple_bind_set_body (bind, stmt_list);
}
/* If a chain_decl was created, then it needs to be registered with
@@ -2014,10 +2064,12 @@ finalize_nesting_tree_1 (struct nesting_info *root)
/* Make sure all new local variables get inserted into the
proper BIND_EXPR. */
if (root->new_local_var_chain)
- declare_vars (root->new_local_var_chain, DECL_SAVED_TREE (root->context),
+ declare_vars (root->new_local_var_chain,
+ gimple_seq_first_stmt (gimple_body (root->context)),
false);
if (root->debug_var_chain)
- declare_vars (root->debug_var_chain, DECL_SAVED_TREE (root->context),
+ declare_vars (root->debug_var_chain,
+ gimple_seq_first_stmt (gimple_body (root->context)),
true);
/* Dump the translated tree function. */
@@ -2101,10 +2153,14 @@ lower_nested_functions (tree fndecl)
bitmap_obstack_initialize (&nesting_info_bitmap_obstack);
root = create_nesting_tree (cgn);
- walk_all_functions (convert_nonlocal_reference, root);
- walk_all_functions (convert_local_reference, root);
- walk_all_functions (convert_nl_goto_reference, root);
- walk_all_functions (convert_nl_goto_receiver, root);
+ walk_all_functions (convert_nonlocal_reference_stmt,
+ convert_nonlocal_reference_op,
+ root);
+ walk_all_functions (convert_local_reference_stmt,
+ convert_local_reference_op,
+ root);
+ walk_all_functions (convert_nl_goto_reference, NULL, root);
+ walk_all_functions (convert_nl_goto_receiver, NULL, root);
convert_all_function_calls (root);
finalize_nesting_tree (root);
unnest_nesting_tree (root);
diff --git a/gcc/tree-nomudflap.c b/gcc/tree-nomudflap.c
index 8d1ae7519b3..8e618a100f4 100644
--- a/gcc/tree-nomudflap.c
+++ b/gcc/tree-nomudflap.c
@@ -27,7 +27,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-inline.h"
#include "c-tree.h"
#include "c-common.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "diagnostic.h"
#include "hashtab.h"
#include "output.h"
diff --git a/gcc/tree-nrv.c b/gcc/tree-nrv.c
index cdf6c3fd9e6..40e7508f613 100644
--- a/gcc/tree-nrv.c
+++ b/gcc/tree-nrv.c
@@ -74,7 +74,8 @@ static tree finalize_nrv_r (tree *, int *, void *);
static tree
finalize_nrv_r (tree *tp, int *walk_subtrees, void *data)
{
- struct nrv_data *dp = (struct nrv_data *)data;
+ struct walk_stmt_info *wi = (struct walk_stmt_info *) data;
+ struct nrv_data *dp = (struct nrv_data *) wi->info;
/* No need to walk into types. */
if (TYPE_P (*tp))
@@ -107,7 +108,7 @@ tree_nrv (void)
tree result_type = TREE_TYPE (result);
tree found = NULL;
basic_block bb;
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
struct nrv_data data;
/* If this function does not return an aggregate type in memory, then
@@ -123,24 +124,29 @@ tree_nrv (void)
/* Look through each block for assignments to the RESULT_DECL. */
FOR_EACH_BB (bb)
{
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- tree stmt = bsi_stmt (bsi);
- tree ret_expr;
+ gimple stmt = gsi_stmt (gsi);
+ tree ret_val;
- if (TREE_CODE (stmt) == RETURN_EXPR)
+ if (gimple_code (stmt) == GIMPLE_RETURN)
{
/* In a function with an aggregate return value, the
gimplifier has changed all non-empty RETURN_EXPRs to
return the RESULT_DECL. */
- ret_expr = TREE_OPERAND (stmt, 0);
- if (ret_expr)
- gcc_assert (ret_expr == result);
+ ret_val = gimple_return_retval (stmt);
+ if (ret_val)
+ gcc_assert (ret_val == result);
}
- else if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
- && GIMPLE_STMT_OPERAND (stmt, 0) == result)
+ else if (is_gimple_assign (stmt)
+ && gimple_assign_lhs (stmt) == result)
{
- ret_expr = GIMPLE_STMT_OPERAND (stmt, 1);
+ tree rhs;
+
+ if (!gimple_assign_copy_p (stmt))
+ return 0;
+
+ rhs = gimple_assign_rhs1 (stmt);
/* Now verify that this return statement uses the same value
as any previously encountered return statement. */
@@ -149,11 +155,11 @@ tree_nrv (void)
/* If we found a return statement using a different variable
than previous return statements, then we can not perform
NRV optimizations. */
- if (found != ret_expr)
+ if (found != rhs)
return 0;
}
else
- found = ret_expr;
+ found = rhs;
/* The returned value must be a local automatic variable of the
same type and alignment as the function's result. */
@@ -167,9 +173,9 @@ tree_nrv (void)
TREE_TYPE (found)))
return 0;
}
- else if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT)
+ else if (is_gimple_assign (stmt))
{
- tree addr = get_base_address (GIMPLE_STMT_OPERAND (stmt, 0));
+ tree addr = get_base_address (gimple_assign_lhs (stmt));
/* If there's any MODIFY of component of RESULT,
then bail out. */
if (addr && addr == result)
@@ -205,18 +211,21 @@ tree_nrv (void)
data.result = result;
FOR_EACH_BB (bb)
{
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); )
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); )
{
- tree *tp = bsi_stmt_ptr (bsi);
+ gimple stmt = gsi_stmt (gsi);
/* If this is a copy from VAR to RESULT, remove it. */
- if (TREE_CODE (*tp) == GIMPLE_MODIFY_STMT
- && GIMPLE_STMT_OPERAND (*tp, 0) == result
- && GIMPLE_STMT_OPERAND (*tp, 1) == found)
- bsi_remove (&bsi, true);
+ if (gimple_assign_copy_p (stmt)
+ && gimple_assign_lhs (stmt) == result
+ && gimple_assign_rhs1 (stmt) == found)
+ gsi_remove (&gsi, true);
else
{
- walk_tree (tp, finalize_nrv_r, &data, 0);
- bsi_next (&bsi);
+ struct walk_stmt_info wi;
+ memset (&wi, 0, sizeof (wi));
+ wi.info = &data;
+ walk_gimple_op (stmt, finalize_nrv_r, &wi);
+ gsi_next (&gsi);
}
}
}
@@ -226,12 +235,18 @@ tree_nrv (void)
return 0;
}
+static bool
+gate_pass_return_slot (void)
+{
+ return optimize > 0;
+}
+
struct gimple_opt_pass pass_nrv =
{
{
GIMPLE_PASS,
"nrv", /* name */
- NULL, /* gate */
+ gate_pass_return_slot, /* gate */
tree_nrv, /* execute */
NULL, /* sub */
NULL, /* next */
@@ -271,7 +286,7 @@ dest_safe_for_nrv_p (tree dest)
return true;
}
-/* Walk through the function looking for GIMPLE_MODIFY_STMTs with calls that
+/* Walk through the function looking for GIMPLE_ASSIGNs with calls that
return in memory on the RHS. For each of these, determine whether it is
safe to pass the address of the LHS as the return slot, and mark the
call appropriately if so.
@@ -290,21 +305,24 @@ execute_return_slot_opt (void)
FOR_EACH_BB (bb)
{
- block_stmt_iterator i;
- for (i = bsi_start (bb); !bsi_end_p (i); bsi_next (&i))
+ gimple_stmt_iterator gsi;
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- tree stmt = bsi_stmt (i);
- tree call;
-
- if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
- && (call = GIMPLE_STMT_OPERAND (stmt, 1),
- TREE_CODE (call) == CALL_EXPR)
- && !CALL_EXPR_RETURN_SLOT_OPT (call)
- && aggregate_value_p (call, call))
- /* Check if the location being assigned to is
- call-clobbered. */
- CALL_EXPR_RETURN_SLOT_OPT (call) =
- dest_safe_for_nrv_p (GIMPLE_STMT_OPERAND (stmt, 0)) ? 1 : 0;
+ gimple stmt = gsi_stmt (gsi);
+ bool slot_opt_p;
+
+ if (is_gimple_call (stmt)
+ && gimple_call_lhs (stmt)
+ && !gimple_call_return_slot_opt_p (stmt)
+ && aggregate_value_p (TREE_TYPE (gimple_call_lhs (stmt)),
+ gimple_call_fndecl (stmt))
+ )
+ {
+ /* Check if the location being assigned to is
+ call-clobbered. */
+ slot_opt_p = dest_safe_for_nrv_p (gimple_call_lhs (stmt));
+ gimple_call_set_return_slot_opt (stmt, slot_opt_p);
+ }
}
}
return 0;
diff --git a/gcc/tree-object-size.c b/gcc/tree-object-size.c
index c1b3b5f1264..22c495154d4 100644
--- a/gcc/tree-object-size.c
+++ b/gcc/tree-object-size.c
@@ -43,13 +43,13 @@ static unsigned HOST_WIDE_INT unknown[4] = { -1, -1, 0, 0 };
static tree compute_object_offset (const_tree, const_tree);
static unsigned HOST_WIDE_INT addr_object_size (const_tree, int);
-static unsigned HOST_WIDE_INT alloc_object_size (const_tree, int);
-static tree pass_through_call (const_tree);
+static unsigned HOST_WIDE_INT alloc_object_size (const_gimple, int);
+static tree pass_through_call (const_gimple);
static void collect_object_sizes_for (struct object_size_info *, tree);
static void expr_object_size (struct object_size_info *, tree, tree);
static bool merge_object_sizes (struct object_size_info *, tree, tree,
unsigned HOST_WIDE_INT);
-static bool plus_expr_object_size (struct object_size_info *, tree, tree);
+static bool plus_stmt_object_size (struct object_size_info *, tree, gimple);
static bool cond_expr_object_size (struct object_size_info *, tree, tree);
static unsigned int compute_object_sizes (void);
static void init_offset_limit (void);
@@ -219,21 +219,21 @@ addr_object_size (const_tree ptr, int object_size_type)
}
-/* Compute __builtin_object_size for CALL, which is a CALL_EXPR.
+/* Compute __builtin_object_size for CALL, which is a GIMPLE_CALL.
Handles various allocation calls. OBJECT_SIZE_TYPE is the second
argument from __builtin_object_size. If unknown, return
unknown[object_size_type]. */
static unsigned HOST_WIDE_INT
-alloc_object_size (const_tree call, int object_size_type)
+alloc_object_size (const_gimple call, int object_size_type)
{
tree callee, bytes = NULL_TREE;
tree alloc_size;
int arg1 = -1, arg2 = -1;
- gcc_assert (TREE_CODE (call) == CALL_EXPR);
+ gcc_assert (is_gimple_call (call));
- callee = get_callee_fndecl (call);
+ callee = gimple_call_fndecl (call);
if (!callee)
return unknown[object_size_type];
@@ -244,7 +244,7 @@ alloc_object_size (const_tree call, int object_size_type)
arg1 = TREE_INT_CST_LOW (TREE_VALUE (p))-1;
if (TREE_CHAIN (p))
- arg2 = TREE_INT_CST_LOW (TREE_VALUE (TREE_CHAIN (p)))-1;
+ arg2 = TREE_INT_CST_LOW (TREE_VALUE (TREE_CHAIN (p)))-1;
}
if (DECL_BUILT_IN_CLASS (callee) == BUILT_IN_NORMAL)
@@ -260,19 +260,19 @@ alloc_object_size (const_tree call, int object_size_type)
break;
}
- if (arg1 < 0 || arg1 >= call_expr_nargs (call)
- || TREE_CODE (CALL_EXPR_ARG (call, arg1)) != INTEGER_CST
+ if (arg1 < 0 || arg1 >= (int)gimple_call_num_args (call)
+ || TREE_CODE (gimple_call_arg (call, arg1)) != INTEGER_CST
|| (arg2 >= 0
- && (arg2 >= call_expr_nargs (call)
- || TREE_CODE (CALL_EXPR_ARG (call, arg2)) != INTEGER_CST)))
+ && (arg2 >= (int)gimple_call_num_args (call)
+ || TREE_CODE (gimple_call_arg (call, arg2)) != INTEGER_CST)))
return unknown[object_size_type];
if (arg2 >= 0)
bytes = size_binop (MULT_EXPR,
- fold_convert (sizetype, CALL_EXPR_ARG (call, arg1)),
- fold_convert (sizetype, CALL_EXPR_ARG (call, arg2)));
+ fold_convert (sizetype, gimple_call_arg (call, arg1)),
+ fold_convert (sizetype, gimple_call_arg (call, arg2)));
else if (arg1 >= 0)
- bytes = fold_convert (sizetype, CALL_EXPR_ARG (call, arg1));
+ bytes = fold_convert (sizetype, gimple_call_arg (call, arg1));
if (bytes && host_integerp (bytes, 1))
return tree_low_cst (bytes, 1);
@@ -282,13 +282,13 @@ alloc_object_size (const_tree call, int object_size_type)
/* If object size is propagated from one of function's arguments directly
- to its return value, return that argument for CALL_EXPR CALL.
+ to its return value, return that argument for GIMPLE_CALL statement CALL.
Otherwise return NULL. */
static tree
-pass_through_call (const_tree call)
+pass_through_call (const_gimple call)
{
- tree callee = get_callee_fndecl (call);
+ tree callee = gimple_call_fndecl (call);
if (callee
&& DECL_BUILT_IN_CLASS (callee) == BUILT_IN_NORMAL)
@@ -308,8 +308,8 @@ pass_through_call (const_tree call)
case BUILT_IN_STRNCPY_CHK:
case BUILT_IN_STRCAT_CHK:
case BUILT_IN_STRNCAT_CHK:
- if (call_expr_nargs (call) >= 1)
- return CALL_EXPR_ARG (call, 0);
+ if (gimple_call_num_args (call) >= 1)
+ return gimple_call_arg (call, 0);
break;
default:
break;
@@ -332,16 +332,8 @@ compute_builtin_object_size (tree ptr, int object_size_type)
if (TREE_CODE (ptr) == ADDR_EXPR)
return addr_object_size (ptr, object_size_type);
- else if (TREE_CODE (ptr) == CALL_EXPR)
- {
- tree arg = pass_through_call (ptr);
- if (arg)
- return compute_builtin_object_size (arg, object_size_type);
- else
- return alloc_object_size (ptr, object_size_type);
- }
- else if (TREE_CODE (ptr) == SSA_NAME
+ if (TREE_CODE (ptr) == SSA_NAME
&& POINTER_TYPE_P (TREE_TYPE (ptr))
&& object_sizes[object_size_type] != NULL)
{
@@ -463,9 +455,7 @@ compute_builtin_object_size (tree ptr, int object_size_type)
return unknown[object_size_type];
}
-
-/* Compute object_sizes for PTR, defined to VALUE, which is not
- a SSA_NAME. */
+/* Compute object_sizes for PTR, defined to VALUE, which is not an SSA_NAME. */
static void
expr_object_size (struct object_size_info *osi, tree ptr, tree value)
@@ -487,8 +477,6 @@ expr_object_size (struct object_size_info *osi, tree ptr, tree value)
if (TREE_CODE (value) == ADDR_EXPR)
bytes = addr_object_size (value, object_size_type);
- else if (TREE_CODE (value) == CALL_EXPR)
- bytes = alloc_object_size (value, object_size_type);
else
bytes = unknown[object_size_type];
@@ -505,6 +493,64 @@ expr_object_size (struct object_size_info *osi, tree ptr, tree value)
}
+/* Compute object_sizes for PTR, defined to the result of a call. */
+
+static void
+call_object_size (struct object_size_info *osi, tree ptr, gimple call)
+{
+ int object_size_type = osi->object_size_type;
+ unsigned int varno = SSA_NAME_VERSION (ptr);
+ unsigned HOST_WIDE_INT bytes;
+
+ gcc_assert (is_gimple_call (call));
+
+ gcc_assert (object_sizes[object_size_type][varno]
+ != unknown[object_size_type]);
+ gcc_assert (osi->pass == 0);
+
+ bytes = alloc_object_size (call, object_size_type);
+
+ if ((object_size_type & 2) == 0)
+ {
+ if (object_sizes[object_size_type][varno] < bytes)
+ object_sizes[object_size_type][varno] = bytes;
+ }
+ else
+ {
+ if (object_sizes[object_size_type][varno] > bytes)
+ object_sizes[object_size_type][varno] = bytes;
+ }
+}
+
+
+/* Compute object_sizes for PTR, defined to an unknown value. */
+
+static void
+unknown_object_size (struct object_size_info *osi, tree ptr)
+{
+ int object_size_type = osi->object_size_type;
+ unsigned int varno = SSA_NAME_VERSION (ptr);
+ unsigned HOST_WIDE_INT bytes;
+
+ gcc_assert (object_sizes[object_size_type][varno]
+ != unknown[object_size_type]);
+ gcc_assert (osi->pass == 0);
+
+ bytes = unknown[object_size_type];
+
+ if ((object_size_type & 2) == 0)
+ {
+ if (object_sizes[object_size_type][varno] < bytes)
+ object_sizes[object_size_type][varno] = bytes;
+ }
+ else
+ {
+ if (object_sizes[object_size_type][varno] > bytes)
+ object_sizes[object_size_type][varno] = bytes;
+ }
+}
+
+
/* Merge object sizes of ORIG + OFFSET into DEST. Return true if
the object size might need reexamination later. */
@@ -552,20 +598,22 @@ merge_object_sizes (struct object_size_info *osi, tree dest, tree orig,
}
-/* Compute object_sizes for PTR, defined to VALUE, which is
- a POINTER_PLUS_EXPR. Return true if the object size might need reexamination
- later. */
+/* Compute object_sizes for VAR, defined to the result of an assignment
+ with operator POINTER_PLUS_EXPR. Return true if the object size might
+ need reexamination later. */
static bool
-plus_expr_object_size (struct object_size_info *osi, tree var, tree value)
+plus_stmt_object_size (struct object_size_info *osi, tree var, gimple stmt)
{
- tree op0 = TREE_OPERAND (value, 0);
- tree op1 = TREE_OPERAND (value, 1);
int object_size_type = osi->object_size_type;
unsigned int varno = SSA_NAME_VERSION (var);
unsigned HOST_WIDE_INT bytes;
+ tree op0, op1;
+
+ gcc_assert (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR);
- gcc_assert (TREE_CODE (value) == POINTER_PLUS_EXPR);
+ op0 = gimple_assign_rhs1 (stmt);
+ op1 = gimple_assign_rhs2 (stmt);
if (object_sizes[object_size_type][varno] == unknown[object_size_type])
return false;
@@ -583,6 +631,7 @@ plus_expr_object_size (struct object_size_info *osi, tree var, tree value)
{
unsigned HOST_WIDE_INT off = tree_low_cst (op1, 1);
+ /* op0 will be ADDR_EXPR here. */
bytes = compute_builtin_object_size (op0, object_size_type);
if (bytes == unknown[object_size_type])
;
@@ -611,7 +660,7 @@ plus_expr_object_size (struct object_size_info *osi, tree var, tree value)
}
-/* Compute object_sizes for PTR, defined to VALUE, which is
+/* Compute object_sizes for VAR, defined to VALUE, which is
a COND_EXPR. Return true if the object size might need reexamination
later. */
@@ -644,12 +693,11 @@ cond_expr_object_size (struct object_size_info *osi, tree var, tree value)
return reexamine;
}
-
/* Compute object sizes for VAR.
For ADDR_EXPR an object size is the number of remaining bytes
to the end of the object (where what is considered an object depends on
OSI->object_size_type).
- For allocation CALL_EXPR like malloc or calloc object size is the size
+ For allocation GIMPLE_CALL like malloc or calloc object size is the size
of the allocation.
For POINTER_PLUS_EXPR where second operand is a constant integer,
object size is object size of the first operand minus the constant.
@@ -660,7 +708,7 @@ cond_expr_object_size (struct object_size_info *osi, tree var, tree value)
unknown[object_size_type] for all objects bigger than half of the address
space, and constants less than half of the address space are considered
addition, while bigger constants subtraction.
- For a memcpy like CALL_EXPR that always returns one of its arguments, the
+ For a memcpy like GIMPLE_CALL that always returns one of its arguments, the
object size is object size of that argument.
Otherwise, object size is the maximum of object sizes of variables
that it might be set to. */
@@ -670,7 +718,7 @@ collect_object_sizes_for (struct object_size_info *osi, tree var)
{
int object_size_type = osi->object_size_type;
unsigned int varno = SSA_NAME_VERSION (var);
- tree stmt;
+ gimple stmt;
bool reexamine;
if (bitmap_bit_p (computed[object_size_type], varno))
@@ -709,51 +757,57 @@ collect_object_sizes_for (struct object_size_info *osi, tree var)
stmt = SSA_NAME_DEF_STMT (var);
reexamine = false;
- switch (TREE_CODE (stmt))
+ switch (gimple_code (stmt))
{
- case RETURN_EXPR:
- gcc_assert (TREE_CODE (TREE_OPERAND (stmt, 0)) == GIMPLE_MODIFY_STMT);
- stmt = TREE_OPERAND (stmt, 0);
- /* FALLTHRU */
-
- case GIMPLE_MODIFY_STMT:
+ case GIMPLE_ASSIGN:
{
- tree rhs = GIMPLE_STMT_OPERAND (stmt, 1), arg;
- STRIP_NOPS (rhs);
-
- if (TREE_CODE (rhs) == CALL_EXPR)
- {
- arg = pass_through_call (rhs);
- if (arg)
- rhs = arg;
- }
-
- if (TREE_CODE (rhs) == SSA_NAME
- && POINTER_TYPE_P (TREE_TYPE (rhs)))
- reexamine = merge_object_sizes (osi, var, rhs, 0);
-
- else if (TREE_CODE (rhs) == POINTER_PLUS_EXPR)
- reexamine = plus_expr_object_size (osi, var, rhs);
-
- else if (TREE_CODE (rhs) == COND_EXPR)
- reexamine = cond_expr_object_size (osi, var, rhs);
+ if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR)
+ reexamine = plus_stmt_object_size (osi, var, stmt);
+ else if (gimple_assign_single_p (stmt)
+ || gimple_assign_unary_nop_p (stmt))
+ {
+ tree rhs = gimple_assign_rhs1 (stmt);
+
+ if (TREE_CODE (rhs) == SSA_NAME
+ && POINTER_TYPE_P (TREE_TYPE (rhs)))
+ reexamine = merge_object_sizes (osi, var, rhs, 0);
+ else if (TREE_CODE (rhs) == COND_EXPR)
+ reexamine = cond_expr_object_size (osi, var, rhs);
+ else
+ expr_object_size (osi, var, rhs);
+ }
+ else
+ unknown_object_size (osi, var);
+ break;
+ }
- else
- expr_object_size (osi, var, rhs);
+ case GIMPLE_CALL:
+ {
+ tree arg = pass_through_call (stmt);
+ if (arg)
+ {
+ if (TREE_CODE (arg) == SSA_NAME
+ && POINTER_TYPE_P (TREE_TYPE (arg)))
+ reexamine = merge_object_sizes (osi, var, arg, 0);
+ else if (TREE_CODE (arg) == COND_EXPR)
+ reexamine = cond_expr_object_size (osi, var, arg);
+ else
+ expr_object_size (osi, var, arg);
+ }
+ else
+ call_object_size (osi, var, stmt);
break;
}
- case ASM_EXPR:
+ case GIMPLE_ASM:
/* Pointers defined by __asm__ statements can point anywhere. */
object_sizes[object_size_type][varno] = unknown[object_size_type];
break;
- case NOP_EXPR:
+ case GIMPLE_NOP:
{
tree decl = SSA_NAME_VAR (var);
- gcc_assert (IS_EMPTY_STMT (stmt));
-
if (TREE_CODE (decl) != PARM_DECL && DECL_INITIAL (decl))
expr_object_size (osi, var, DECL_INITIAL (decl));
else
@@ -761,13 +815,13 @@ collect_object_sizes_for (struct object_size_info *osi, tree var)
}
break;
- case PHI_NODE:
+ case GIMPLE_PHI:
{
- int i;
+ unsigned i;
- for (i = 0; i < PHI_NUM_ARGS (stmt); i++)
+ for (i = 0; i < gimple_phi_num_args (stmt); i++)
{
- tree rhs = PHI_ARG_DEF (stmt, i);
+ tree rhs = gimple_phi_arg (stmt, i)->def;
if (object_sizes[object_size_type][varno]
== unknown[object_size_type])
@@ -780,6 +834,7 @@ collect_object_sizes_for (struct object_size_info *osi, tree var)
}
break;
}
+
default:
gcc_unreachable ();
}
@@ -810,7 +865,7 @@ static void
check_for_plus_in_loops_1 (struct object_size_info *osi, tree var,
unsigned int depth)
{
- tree stmt = SSA_NAME_DEF_STMT (var);
+ gimple stmt = SSA_NAME_DEF_STMT (var);
unsigned int varno = SSA_NAME_VERSION (var);
if (osi->depths[varno])
@@ -838,57 +893,61 @@ check_for_plus_in_loops_1 (struct object_size_info *osi, tree var,
osi->depths[varno] = depth;
*osi->tos++ = varno;
- switch (TREE_CODE (stmt))
+ switch (gimple_code (stmt))
{
- case RETURN_EXPR:
- gcc_assert (TREE_CODE (TREE_OPERAND (stmt, 0)) == GIMPLE_MODIFY_STMT);
- stmt = TREE_OPERAND (stmt, 0);
- /* FALLTHRU */
- case GIMPLE_MODIFY_STMT:
+ case GIMPLE_ASSIGN:
{
- tree rhs = GIMPLE_STMT_OPERAND (stmt, 1), arg;
- STRIP_NOPS (rhs);
-
- if (TREE_CODE (rhs) == CALL_EXPR)
- {
- arg = pass_through_call (rhs);
- if (arg)
- rhs = arg;
- }
-
- if (TREE_CODE (rhs) == SSA_NAME)
- check_for_plus_in_loops_1 (osi, rhs, depth);
- else if (TREE_CODE (rhs) == POINTER_PLUS_EXPR)
- {
- tree op0 = TREE_OPERAND (rhs, 0);
- tree op1 = TREE_OPERAND (rhs, 1);
- tree cst, basevar;
-
- basevar = op0;
- cst = op1;
- gcc_assert (TREE_CODE (cst) == INTEGER_CST);
+ if ((gimple_assign_single_p (stmt)
+ || gimple_assign_unary_nop_p (stmt))
+ && TREE_CODE (gimple_assign_rhs1 (stmt)) == SSA_NAME)
+ {
+ tree rhs = gimple_assign_rhs1 (stmt);
+
+ check_for_plus_in_loops_1 (osi, rhs, depth);
+ }
+ else if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR)
+ {
+ tree basevar = gimple_assign_rhs1 (stmt);
+ tree cst = gimple_assign_rhs2 (stmt);
+
+ gcc_assert (TREE_CODE (cst) == INTEGER_CST);
+
+ check_for_plus_in_loops_1 (osi, basevar,
+ depth + !integer_zerop (cst));
+ }
+ else
+ gcc_unreachable ();
+ break;
+ }
- check_for_plus_in_loops_1 (osi, basevar,
- depth + !integer_zerop (cst));
- }
- else
- gcc_unreachable ();
- break;
+ case GIMPLE_CALL:
+ {
+ tree arg = pass_through_call (stmt);
+ if (arg)
+ {
+ if (TREE_CODE (arg) == SSA_NAME)
+ check_for_plus_in_loops_1 (osi, arg, depth);
+ else
+ gcc_unreachable ();
+ }
+ break;
}
- case PHI_NODE:
+
+ case GIMPLE_PHI:
{
- int i;
+ unsigned i;
- for (i = 0; i < PHI_NUM_ARGS (stmt); i++)
+ for (i = 0; i < gimple_phi_num_args (stmt); i++)
{
- tree rhs = PHI_ARG_DEF (stmt, i);
+ tree rhs = gimple_phi_arg (stmt, i)->def;
if (TREE_CODE (rhs) == SSA_NAME)
check_for_plus_in_loops_1 (osi, rhs, depth);
}
break;
}
+
default:
gcc_unreachable ();
}
@@ -905,50 +964,29 @@ check_for_plus_in_loops_1 (struct object_size_info *osi, tree var,
static void
check_for_plus_in_loops (struct object_size_info *osi, tree var)
{
- tree stmt = SSA_NAME_DEF_STMT (var);
+ gimple stmt = SSA_NAME_DEF_STMT (var);
- switch (TREE_CODE (stmt))
- {
- case RETURN_EXPR:
- gcc_assert (TREE_CODE (TREE_OPERAND (stmt, 0)) == GIMPLE_MODIFY_STMT);
- stmt = TREE_OPERAND (stmt, 0);
- /* FALLTHRU */
-
- case GIMPLE_MODIFY_STMT:
- {
- tree rhs = GIMPLE_STMT_OPERAND (stmt, 1), arg;
- STRIP_NOPS (rhs);
-
- if (TREE_CODE (rhs) == CALL_EXPR)
- {
- arg = pass_through_call (rhs);
- if (arg)
- rhs = arg;
- }
+ /* NOTE: In the pre-tuples code, we handled a CALL_EXPR here,
+ and looked for a POINTER_PLUS_EXPR in the pass-through
+ argument, if any. In GIMPLE, however, such an expression
+ is not a valid call operand. */
- if (TREE_CODE (rhs) == POINTER_PLUS_EXPR)
- {
- tree op0 = TREE_OPERAND (rhs, 0);
- tree op1 = TREE_OPERAND (rhs, 1);
- tree cst, basevar;
-
- basevar = op0;
- cst = op1;
- gcc_assert (TREE_CODE (cst) == INTEGER_CST);
-
- if (integer_zerop (cst))
- break;
-
- osi->depths[SSA_NAME_VERSION (basevar)] = 1;
- *osi->tos++ = SSA_NAME_VERSION (basevar);
- check_for_plus_in_loops_1 (osi, var, 2);
- osi->depths[SSA_NAME_VERSION (basevar)] = 0;
- osi->tos--;
- }
- break;
- }
- default:
- break;
+ if (is_gimple_assign (stmt)
+ && gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR)
+ {
+ tree basevar = gimple_assign_rhs1 (stmt);
+ tree cst = gimple_assign_rhs2 (stmt);
+
+ gcc_assert (TREE_CODE (cst) == INTEGER_CST);
+
+ if (integer_zerop (cst))
+ return;
+
+ osi->depths[SSA_NAME_VERSION (basevar)] = 1;
+ *osi->tos++ = SSA_NAME_VERSION (basevar);
+ check_for_plus_in_loops_1 (osi, var, 2);
+ osi->depths[SSA_NAME_VERSION (basevar)] = 0;
+ osi->tos--;
}
}
@@ -997,30 +1035,29 @@ compute_object_sizes (void)
basic_block bb;
FOR_EACH_BB (bb)
{
- block_stmt_iterator i;
- for (i = bsi_start (bb); !bsi_end_p (i); bsi_next (&i))
+ gimple_stmt_iterator i;
+ for (i = gsi_start_bb (bb); !gsi_end_p (i); gsi_next (&i))
{
- tree *stmtp = bsi_stmt_ptr (i);
- tree call = get_rhs (*stmtp);
tree callee, result;
+ gimple call = gsi_stmt (i);
- if (!call || TREE_CODE (call) != CALL_EXPR)
+ if (gimple_code (call) != GIMPLE_CALL)
continue;
- callee = get_callee_fndecl (call);
+ callee = gimple_call_fndecl (call);
if (!callee
|| DECL_BUILT_IN_CLASS (callee) != BUILT_IN_NORMAL
|| DECL_FUNCTION_CODE (callee) != BUILT_IN_OBJECT_SIZE)
continue;
init_object_sizes ();
- result = fold_call_expr (call, false);
+ result = fold_call_stmt (call, false);
if (!result)
{
- if (call_expr_nargs (call) == 2
- && POINTER_TYPE_P (TREE_TYPE (CALL_EXPR_ARG (call, 0))))
+ if (gimple_call_num_args (call) == 2
+ && POINTER_TYPE_P (TREE_TYPE (gimple_call_arg (call, 0))))
{
- tree ost = CALL_EXPR_ARG (call, 1);
+ tree ost = gimple_call_arg (call, 1);
if (host_integerp (ost, 1))
{
@@ -1042,17 +1079,19 @@ compute_object_sizes (void)
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Simplified\n ");
- print_generic_stmt (dump_file, *stmtp, dump_flags);
+ print_gimple_stmt (dump_file, call, 0, dump_flags);
}
- if (!set_rhs (stmtp, result))
+ if (!update_call_from_tree (&i, result))
gcc_unreachable ();
- update_stmt (*stmtp);
+
+ /* NOTE: In the pre-tuples code, we called update_stmt here. This is
+ now handled by gsi_replace, called from update_call_from_tree. */
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "to\n ");
- print_generic_stmt (dump_file, *stmtp, dump_flags);
+ print_gimple_stmt (dump_file, call, 0, dump_flags);
fprintf (dump_file, "\n");
}
}
diff --git a/gcc/tree-optimize.c b/gcc/tree-optimize.c
index 35feaa1be5b..ba3d0fcc9e0 100644
--- a/gcc/tree-optimize.c
+++ b/gcc/tree-optimize.c
@@ -115,7 +115,7 @@ execute_early_local_optimizations (void)
cgraph state so newly inserted functions are also early optimized.
However we execute early local optimizations for lately inserted
functions, in that case don't reset cgraph state back to IPA_SSA. */
- if (flag_unit_at_a_time && cgraph_state < CGRAPH_STATE_IPA_SSA)
+ if (cgraph_state < CGRAPH_STATE_IPA_SSA)
cgraph_state = CGRAPH_STATE_IPA_SSA;
return 0;
}
@@ -289,7 +289,7 @@ unsigned int
execute_fixup_cfg (void)
{
basic_block bb;
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
int todo = gimple_in_ssa_p (cfun) ? TODO_verify_ssa : 0;
cfun->after_inlining = true;
@@ -297,35 +297,36 @@ execute_fixup_cfg (void)
if (cfun->eh)
FOR_EACH_BB (bb)
{
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- tree stmt = bsi_stmt (bsi);
- tree call = get_call_expr_in (stmt);
- tree decl = call ? get_callee_fndecl (call) : NULL;
-
- if (decl && call_expr_flags (call) & (ECF_CONST | ECF_PURE
- | ECF_LOOPING_CONST_OR_PURE)
- && TREE_SIDE_EFFECTS (call))
+ gimple stmt = gsi_stmt (gsi);
+ tree decl = is_gimple_call (stmt)
+ ? gimple_call_fndecl (stmt)
+ : NULL;
+
+ if (decl
+ && gimple_call_flags (stmt) & (ECF_CONST
+ | ECF_PURE
+ | ECF_LOOPING_CONST_OR_PURE))
{
if (gimple_in_ssa_p (cfun))
{
todo |= TODO_update_ssa | TODO_cleanup_cfg;
update_stmt (stmt);
}
- TREE_SIDE_EFFECTS (call) = 0;
}
- if (decl && TREE_NOTHROW (decl))
- TREE_NOTHROW (call) = 1;
- if (!tree_could_throw_p (stmt) && lookup_stmt_eh_region (stmt))
+
+ if (!stmt_could_throw_p (stmt) && lookup_stmt_eh_region (stmt))
remove_stmt_from_eh_region (stmt);
}
- if (tree_purge_dead_eh_edges (bb))
+
+ if (gimple_purge_dead_eh_edges (bb))
todo |= TODO_cleanup_cfg;
}
/* Dump a textual representation of the flowgraph. */
if (dump_file)
- dump_tree_cfg (dump_file, dump_flags);
+ gimple_dump_cfg (dump_file, dump_flags);
return todo;
}
@@ -341,20 +342,12 @@ execute_init_datastructures (void)
return 0;
}
-/* Gate: initialize or not the SSA datastructures. */
-
-static bool
-gate_init_datastructures (void)
-{
- return (optimize >= 1);
-}
-
struct gimple_opt_pass pass_init_datastructures =
{
{
GIMPLE_PASS,
NULL, /* name */
- gate_init_datastructures, /* gate */
+ NULL, /* gate */
execute_init_datastructures, /* execute */
NULL, /* sub */
NULL, /* next */
@@ -375,7 +368,7 @@ tree_lowering_passes (tree fn)
current_function_decl = fn;
push_cfun (DECL_STRUCT_FUNCTION (fn));
- tree_register_cfg_hooks ();
+ gimple_register_cfg_hooks ();
bitmap_obstack_initialize (NULL);
execute_pass_list (all_lowering_passes);
if (optimize && cgraph_global_info_ready)
@@ -399,7 +392,7 @@ tree_rest_of_compilation (tree fndecl)
timevar_push (TV_EXPAND);
- gcc_assert (!flag_unit_at_a_time || cgraph_global_info_ready);
+ gcc_assert (cgraph_global_info_ready);
node = cgraph_node (fndecl);
@@ -418,7 +411,7 @@ tree_rest_of_compilation (tree fndecl)
not safe to try to expand expressions involving them. */
cfun->dont_save_pending_sizes_p = 1;
- tree_register_cfg_hooks ();
+ gimple_register_cfg_hooks ();
bitmap_obstack_initialize (&reg_obstack); /* FIXME, only at RTL generation*/
/* Perform all tree transforms and optimizations. */
@@ -429,7 +422,6 @@ tree_rest_of_compilation (tree fndecl)
/* Release the default bitmap obstack. */
bitmap_obstack_release (NULL);
- DECL_SAVED_TREE (fndecl) = NULL;
set_cfun (NULL);
/* If requested, warn about function definitions where the function will
@@ -456,20 +448,17 @@ tree_rest_of_compilation (tree fndecl)
}
}
- if (!flag_inline_trees)
+ gimple_set_body (fndecl, NULL);
+ if (DECL_STRUCT_FUNCTION (fndecl) == 0
+ && !cgraph_node (fndecl)->origin)
{
- DECL_SAVED_TREE (fndecl) = NULL;
- if (DECL_STRUCT_FUNCTION (fndecl) == 0
- && !cgraph_node (fndecl)->origin)
- {
- /* Stop pointing to the local nodes about to be freed.
- But DECL_INITIAL must remain nonzero so we know this
- was an actual function definition.
- For a nested function, this is done in c_pop_function_context.
- If rest_of_compilation set this to 0, leave it 0. */
- if (DECL_INITIAL (fndecl) != 0)
- DECL_INITIAL (fndecl) = error_mark_node;
- }
+ /* Stop pointing to the local nodes about to be freed.
+ But DECL_INITIAL must remain nonzero so we know this
+ was an actual function definition.
+ For a nested function, this is done in c_pop_function_context.
+ If rest_of_compilation set this to 0, leave it 0. */
+ if (DECL_INITIAL (fndecl) != 0)
+ DECL_INITIAL (fndecl) = error_mark_node;
}
input_location = saved_loc;
diff --git a/gcc/tree-outof-ssa.c b/gcc/tree-outof-ssa.c
index 21f362b9059..58aed883007 100644
--- a/gcc/tree-outof-ssa.c
+++ b/gcc/tree-outof-ssa.c
@@ -141,9 +141,9 @@ create_temp (tree t)
static void
insert_copy_on_edge (edge e, tree dest, tree src)
{
- tree copy;
+ gimple copy;
- copy = build_gimple_modify_stmt (dest, src);
+ copy = gimple_build_assign (dest, src);
set_is_used (dest);
if (TREE_CODE (src) == ADDR_EXPR)
@@ -157,11 +157,11 @@ insert_copy_on_edge (edge e, tree dest, tree src)
"Inserting a copy on edge BB%d->BB%d :",
e->src->index,
e->dest->index);
- print_generic_expr (dump_file, copy, dump_flags);
+ print_gimple_stmt (dump_file, copy, 0, dump_flags);
fprintf (dump_file, "\n");
}
- bsi_insert_on_edge (e, copy);
+ gsi_insert_on_edge (e, copy);
}
@@ -315,15 +315,17 @@ eliminate_name (elim_graph g, tree T)
static void
eliminate_build (elim_graph g, basic_block B)
{
- tree phi;
tree T0, Ti;
int p0, pi;
+ gimple_stmt_iterator gsi;
clear_elim_graph (g);
- for (phi = phi_nodes (B); phi; phi = PHI_CHAIN (phi))
+ for (gsi = gsi_start_phis (B); !gsi_end_p (gsi); gsi_next (&gsi))
{
- T0 = var_to_partition_to_var (g->map, PHI_RESULT (phi));
+ gimple phi = gsi_stmt (gsi);
+
+ T0 = var_to_partition_to_var (g->map, gimple_phi_result (phi));
/* Ignore results which are not in partitions. */
if (T0 == NULL_TREE)
@@ -551,7 +553,7 @@ assign_vars (var_map map)
If the stmt is changed, return true. */
static inline bool
-replace_use_variable (var_map map, use_operand_p p, tree *expr)
+replace_use_variable (var_map map, use_operand_p p, gimple *expr)
{
tree new_var;
tree var = USE_FROM_PTR (p);
@@ -562,11 +564,7 @@ replace_use_variable (var_map map, use_operand_p p, tree *expr)
int version = SSA_NAME_VERSION (var);
if (expr[version])
{
- tree new_expr = GIMPLE_STMT_OPERAND (expr[version], 1);
- SET_USE (p, new_expr);
-
- /* Clear the stmt's RHS, or GC might bite us. */
- GIMPLE_STMT_OPERAND (expr[version], 1) = NULL_TREE;
+ SET_USE (p, gimple_assign_rhs_to_tree (expr[version]));
return true;
}
}
@@ -614,20 +612,20 @@ static void
eliminate_virtual_phis (void)
{
basic_block bb;
- tree phi, next;
+ gimple_stmt_iterator gsi;
FOR_EACH_BB (bb)
{
- for (phi = phi_nodes (bb); phi; phi = next)
+ for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); )
{
- next = PHI_CHAIN (phi);
- if (!is_gimple_reg (SSA_NAME_VAR (PHI_RESULT (phi))))
+ gimple phi = gsi_stmt (gsi);
+ if (!is_gimple_reg (SSA_NAME_VAR (gimple_phi_result (phi))))
{
#ifdef ENABLE_CHECKING
- int i;
+ size_t i;
/* There should be no arguments of this PHI which are in
the partition list, or we get incorrect results. */
- for (i = 0; i < PHI_NUM_ARGS (phi); i++)
+ for (i = 0; i < gimple_phi_num_args (phi); i++)
{
tree arg = PHI_ARG_DEF (phi, i);
if (TREE_CODE (arg) == SSA_NAME
@@ -636,13 +634,15 @@ eliminate_virtual_phis (void)
fprintf (stderr, "Argument of PHI is not virtual (");
print_generic_expr (stderr, arg, TDF_SLIM);
fprintf (stderr, "), but the result is :");
- print_generic_stmt (stderr, phi, TDF_SLIM);
+ print_gimple_stmt (stderr, phi, 0, TDF_SLIM);
internal_error ("SSA corruption");
}
}
#endif
- remove_phi_node (phi, NULL_TREE, true);
+ remove_phi_node (&gsi, true);
}
+ else
+ gsi_next (&gsi);
}
}
}
@@ -655,13 +655,13 @@ eliminate_virtual_phis (void)
variable. */
static void
-rewrite_trees (var_map map, tree *values)
+rewrite_trees (var_map map, gimple *values)
{
elim_graph g;
basic_block bb;
- block_stmt_iterator si;
+ gimple_stmt_iterator gsi;
edge e;
- tree phi;
+ gimple_seq phi;
bool changed;
#ifdef ENABLE_CHECKING
@@ -670,14 +670,14 @@ rewrite_trees (var_map map, tree *values)
create incorrect code. */
FOR_EACH_BB (bb)
{
- tree phi;
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
+ for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- tree T0 = var_to_partition_to_var (map, PHI_RESULT (phi));
+ gimple phi = gsi_stmt (gsi);
+ tree T0 = var_to_partition_to_var (map, gimple_phi_result (phi));
if (T0 == NULL_TREE)
{
- int i;
- for (i = 0; i < PHI_NUM_ARGS (phi); i++)
+ size_t i;
+ for (i = 0; i < gimple_phi_num_args (phi); i++)
{
tree arg = PHI_ARG_DEF (phi, i);
@@ -687,7 +687,7 @@ rewrite_trees (var_map map, tree *values)
fprintf (stderr, "Argument of PHI is in a partition :(");
print_generic_expr (stderr, arg, TDF_SLIM);
fprintf (stderr, "), but the result is not :");
- print_generic_stmt (stderr, phi, TDF_SLIM);
+ print_gimple_stmt (stderr, phi, 0, TDF_SLIM);
internal_error ("SSA corruption");
}
}
@@ -701,21 +701,18 @@ rewrite_trees (var_map map, tree *values)
g->map = map;
FOR_EACH_BB (bb)
{
- for (si = bsi_start (bb); !bsi_end_p (si); )
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); )
{
- tree stmt = bsi_stmt (si);
+ gimple stmt = gsi_stmt (gsi);
use_operand_p use_p, copy_use_p;
def_operand_p def_p;
bool remove = false, is_copy = false;
int num_uses = 0;
- stmt_ann_t ann;
ssa_op_iter iter;
- ann = stmt_ann (stmt);
changed = false;
- if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
- && (TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 1)) == SSA_NAME))
+ if (gimple_assign_copy_p (stmt))
is_copy = true;
copy_use_p = NULL_USE_OPERAND_P;
@@ -759,13 +756,13 @@ rewrite_trees (var_map map, tree *values)
/* Remove any stmts marked for removal. */
if (remove)
- bsi_remove (&si, true);
+ gsi_remove (&gsi, true);
else
{
if (changed)
if (maybe_clean_or_replace_eh_stmt (stmt, stmt))
- tree_purge_dead_eh_edges (bb);
- bsi_next (&si);
+ gimple_purge_dead_eh_edges (bb);
+ gsi_next (&gsi);
}
}
@@ -784,7 +781,7 @@ rewrite_trees (var_map map, tree *values)
/* These are the local work structures used to determine the best place to
insert the copies that were placed on edges by the SSA->normal pass.. */
static VEC(edge,heap) *edge_leader;
-static VEC(tree,heap) *stmt_list;
+static VEC(gimple_seq,heap) *stmt_list;
static bitmap leader_has_match = NULL;
static edge leader_match = NULL;
@@ -803,22 +800,19 @@ same_stmt_list_p (edge e)
/* Return TRUE if S1 and S2 are equivalent copies. */
static inline bool
-identical_copies_p (const_tree s1, const_tree s2)
+identical_copies_p (const_gimple s1, const_gimple s2)
{
#ifdef ENABLE_CHECKING
- gcc_assert (TREE_CODE (s1) == GIMPLE_MODIFY_STMT);
- gcc_assert (TREE_CODE (s2) == GIMPLE_MODIFY_STMT);
- gcc_assert (DECL_P (GIMPLE_STMT_OPERAND (s1, 0)));
- gcc_assert (DECL_P (GIMPLE_STMT_OPERAND (s2, 0)));
+ gcc_assert (is_gimple_assign (s1));
+ gcc_assert (is_gimple_assign (s2));
+ gcc_assert (DECL_P (gimple_assign_lhs (s1)));
+ gcc_assert (DECL_P (gimple_assign_lhs (s2)));
#endif
- if (GIMPLE_STMT_OPERAND (s1, 0) != GIMPLE_STMT_OPERAND (s2, 0))
+ if (gimple_assign_lhs (s1) != gimple_assign_lhs (s2))
return false;
- s1 = GIMPLE_STMT_OPERAND (s1, 1);
- s2 = GIMPLE_STMT_OPERAND (s2, 1);
-
- if (s1 != s2)
+ if (gimple_assign_rhs1 (s1) != gimple_assign_rhs1 (s2))
return false;
return true;
@@ -831,22 +825,19 @@ identical_copies_p (const_tree s1, const_tree s2)
static inline bool
identical_stmt_lists_p (const_edge e1, const_edge e2)
{
- tree t1 = PENDING_STMT (e1);
- tree t2 = PENDING_STMT (e2);
- tree_stmt_iterator tsi1, tsi2;
+ gimple_seq t1 = PENDING_STMT (e1);
+ gimple_seq t2 = PENDING_STMT (e2);
+ gimple_stmt_iterator gsi1, gsi2;
- gcc_assert (TREE_CODE (t1) == STATEMENT_LIST);
- gcc_assert (TREE_CODE (t2) == STATEMENT_LIST);
-
- for (tsi1 = tsi_start (t1), tsi2 = tsi_start (t2);
- !tsi_end_p (tsi1) && !tsi_end_p (tsi2);
- tsi_next (&tsi1), tsi_next (&tsi2))
+ for (gsi1 = gsi_start (t1), gsi2 = gsi_start (t2);
+ !gsi_end_p (gsi1) && !gsi_end_p (gsi2);
+ gsi_next (&gsi1), gsi_next (&gsi2))
{
- if (!identical_copies_p (tsi_stmt (tsi1), tsi_stmt (tsi2)))
+ if (!identical_copies_p (gsi_stmt (gsi1), gsi_stmt (gsi2)))
break;
}
- if (!tsi_end_p (tsi1) || ! tsi_end_p (tsi2))
+ if (!gsi_end_p (gsi1) || !gsi_end_p (gsi2))
return false;
return true;
@@ -859,7 +850,7 @@ static void
init_analyze_edges_for_bb (void)
{
edge_leader = VEC_alloc (edge, heap, 25);
- stmt_list = VEC_alloc (tree, heap, 25);
+ stmt_list = VEC_alloc (gimple_seq, heap, 25);
leader_has_match = BITMAP_ALLOC (NULL);
}
@@ -870,7 +861,7 @@ static void
fini_analyze_edges_for_bb (void)
{
VEC_free (edge, heap, edge_leader);
- VEC_free (tree, heap, stmt_list);
+ VEC_free (gimple_seq, heap, stmt_list);
BITMAP_FREE (leader_has_match);
}
@@ -902,13 +893,14 @@ contains_tree_r (tree * tp, int *walk_subtrees, void *data)
static bool
process_single_block_loop_latch (edge single_edge)
{
- tree stmts;
+ gimple_seq stmts;
basic_block b_exit, b_pheader, b_loop = single_edge->src;
edge_iterator ei;
edge e;
- block_stmt_iterator bsi, bsi_exit;
- tree_stmt_iterator tsi;
- tree expr, stmt;
+ gimple_stmt_iterator gsi, gsi_exit;
+ gimple_stmt_iterator tsi;
+ tree expr;
+ gimple stmt;
unsigned int count = 0;
if (single_edge == NULL || (single_edge->dest != single_edge->src)
@@ -941,29 +933,31 @@ process_single_block_loop_latch (edge single_edge)
if (b_exit == b_pheader || b_exit == b_loop || b_pheader == b_loop)
return false;
- bsi_exit = bsi_after_labels (b_exit);
+ gsi_exit = gsi_after_labels (b_exit);
/* Get the last stmt in the loop body. */
- bsi = bsi_last (single_edge->src);
- stmt = bsi_stmt (bsi);
+ gsi = gsi_last_bb (single_edge->src);
+ stmt = gsi_stmt (gsi);
- if (TREE_CODE (stmt) != COND_EXPR)
+ if (gimple_code (stmt) != GIMPLE_COND)
return false;
- expr = COND_EXPR_COND (stmt);
+
+ expr = build2 (gimple_cond_code (stmt), boolean_type_node,
+ gimple_cond_lhs (stmt), gimple_cond_rhs (stmt));
/* Iterate over the insns on the latch and count them. */
- for (tsi = tsi_start (stmts); !tsi_end_p (tsi); tsi_next (&tsi))
+ for (tsi = gsi_start (stmts); !gsi_end_p (tsi); gsi_next (&tsi))
{
- tree stmt1 = tsi_stmt (tsi);
+ gimple stmt1 = gsi_stmt (tsi);
tree var;
count++;
/* Check that the condition does not contain any new definition
created in the latch as the stmts from the latch intended
to precede it. */
- if (TREE_CODE (stmt1) != GIMPLE_MODIFY_STMT)
+ if (gimple_code (stmt1) != GIMPLE_ASSIGN)
return false;
- var = GIMPLE_STMT_OPERAND (stmt1, 0);
+ var = gimple_assign_lhs (stmt1);
if (TREE_THIS_VOLATILE (var)
|| TYPE_VOLATILE (TREE_TYPE (var))
|| walk_tree (&expr, contains_tree_r, var, NULL))
@@ -999,25 +993,26 @@ process_single_block_loop_latch (edge single_edge)
var = tmp_var;
...
*/
- for (tsi = tsi_start (stmts); !tsi_end_p (tsi); tsi_next (&tsi))
+ for (tsi = gsi_start (stmts); !gsi_end_p (tsi); gsi_next (&tsi))
{
- tree stmt1 = tsi_stmt (tsi);
- tree var, tmp_var, copy;
+ gimple stmt1 = gsi_stmt (tsi);
+ tree var, tmp_var;
+ gimple copy;
/* Create a new variable to load back the value of var in case
we exit the loop. */
- var = GIMPLE_STMT_OPERAND (stmt1, 0);
+ var = gimple_assign_lhs (stmt1);
tmp_var = create_temp (var);
- copy = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (tmp_var), tmp_var, var);
+ copy = gimple_build_assign (tmp_var, var);
set_is_used (tmp_var);
- bsi_insert_before (&bsi, copy, BSI_SAME_STMT);
- copy = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (tmp_var), var, tmp_var);
- bsi_insert_before (&bsi_exit, copy, BSI_SAME_STMT);
+ gsi_insert_before (&gsi, copy, GSI_SAME_STMT);
+ copy = gimple_build_assign (var, tmp_var);
+ gsi_insert_before (&gsi_exit, copy, GSI_SAME_STMT);
}
PENDING_STMT (single_edge) = 0;
/* Insert the new stmts to the loop body. */
- bsi_insert_before (&bsi, stmts, BSI_NEW_STMT);
+ gsi_insert_seq_before (&gsi, stmts, GSI_NEW_STMT);
if (dump_file)
fprintf (dump_file,
@@ -1038,8 +1033,8 @@ analyze_edges_for_bb (basic_block bb)
int count;
unsigned int x;
bool have_opportunity;
- block_stmt_iterator bsi;
- tree stmt;
+ gimple_stmt_iterator gsi;
+ gimple stmt;
edge single_edge = NULL;
bool is_label;
edge leader;
@@ -1061,7 +1056,7 @@ analyze_edges_for_bb (basic_block bb)
{
FOR_EACH_EDGE (e, ei, bb->preds)
if (PENDING_STMT (e))
- bsi_commit_one_edge_insert (e, NULL);
+ gsi_commit_one_edge_insert (e, NULL);
return;
}
@@ -1074,18 +1069,19 @@ analyze_edges_for_bb (basic_block bb)
gcc_assert (!(e->flags & EDGE_ABNORMAL));
if (e->flags & EDGE_FALLTHRU)
{
- bsi = bsi_start (e->src);
- if (!bsi_end_p (bsi))
+ gsi = gsi_start_bb (e->src);
+ if (!gsi_end_p (gsi))
{
- stmt = bsi_stmt (bsi);
- bsi_next (&bsi);
- gcc_assert (stmt != NULL_TREE);
- is_label = (TREE_CODE (stmt) == LABEL_EXPR);
+ stmt = gsi_stmt (gsi);
+ gsi_next (&gsi);
+ gcc_assert (stmt != NULL);
+ is_label = (gimple_code (stmt) == GIMPLE_LABEL);
/* Punt if it has non-label stmts, or isn't local. */
- if (!is_label || DECL_NONLOCAL (TREE_OPERAND (stmt, 0))
- || !bsi_end_p (bsi))
+ if (!is_label
+ || DECL_NONLOCAL (gimple_label_label (stmt))
+ || !gsi_end_p (gsi))
{
- bsi_commit_one_edge_insert (e, NULL);
+ gsi_commit_one_edge_insert (e, NULL);
continue;
}
}
@@ -1103,7 +1099,7 @@ analyze_edges_for_bb (basic_block bb)
/* Add stmts to the edge unless processed specially as a
single-block loop latch edge. */
if (!process_single_block_loop_latch (single_edge))
- bsi_commit_one_edge_insert (single_edge, NULL);
+ gsi_commit_one_edge_insert (single_edge, NULL);
}
return;
}
@@ -1111,7 +1107,7 @@ analyze_edges_for_bb (basic_block bb)
/* Ensure that we have empty worklists. */
#ifdef ENABLE_CHECKING
gcc_assert (VEC_length (edge, edge_leader) == 0);
- gcc_assert (VEC_length (tree, stmt_list) == 0);
+ gcc_assert (VEC_length (gimple_seq, stmt_list) == 0);
gcc_assert (bitmap_empty_p (leader_has_match));
#endif
@@ -1144,7 +1140,7 @@ analyze_edges_for_bb (basic_block bb)
if (!found)
{
VEC_safe_push (edge, heap, edge_leader, e);
- VEC_safe_push (tree, heap, stmt_list, PENDING_STMT (e));
+ VEC_safe_push (gimple_seq, heap, stmt_list, PENDING_STMT (e));
}
}
}
@@ -1153,9 +1149,9 @@ analyze_edges_for_bb (basic_block bb)
if (!have_opportunity)
{
for (x = 0; VEC_iterate (edge, edge_leader, x, leader); x++)
- bsi_commit_one_edge_insert (leader, NULL);
+ gsi_commit_one_edge_insert (leader, NULL);
VEC_truncate (edge, edge_leader, 0);
- VEC_truncate (tree, stmt_list, 0);
+ VEC_truncate (gimple_seq, stmt_list, 0);
bitmap_clear (leader_has_match);
return;
}
@@ -1170,8 +1166,8 @@ analyze_edges_for_bb (basic_block bb)
if (bitmap_bit_p (leader_has_match, x))
{
edge new_edge;
- block_stmt_iterator bsi;
- tree curr_stmt_list;
+ gimple_stmt_iterator gsi;
+ gimple_seq curr_stmt_list;
leader_match = leader;
@@ -1181,7 +1177,7 @@ analyze_edges_for_bb (basic_block bb)
and use the saved stmt list. */
PENDING_STMT (leader) = NULL;
leader->aux = leader;
- curr_stmt_list = VEC_index (tree, stmt_list, x);
+ curr_stmt_list = VEC_index (gimple_seq, stmt_list, x);
new_edge = make_forwarder_block (leader->dest, same_stmt_list_p,
NULL);
@@ -1191,7 +1187,7 @@ analyze_edges_for_bb (basic_block bb)
fprintf (dump_file, "Splitting BB %d for Common stmt list. ",
leader->dest->index);
fprintf (dump_file, "Original block is now BB%d.\n", bb->index);
- print_generic_stmt (dump_file, curr_stmt_list, TDF_VOPS);
+ print_gimple_seq (dump_file, curr_stmt_list, 0, TDF_VOPS);
}
FOR_EACH_EDGE (e, ei, new_edge->src->preds)
@@ -1202,22 +1198,22 @@ analyze_edges_for_bb (basic_block bb)
e->src->index, e->dest->index);
}
- bsi = bsi_last (leader->dest);
- bsi_insert_after (&bsi, curr_stmt_list, BSI_NEW_STMT);
+ gsi = gsi_last_bb (leader->dest);
+ gsi_insert_seq_after (&gsi, curr_stmt_list, GSI_NEW_STMT);
leader_match = NULL;
/* We should never get a new block now. */
}
else
{
- PENDING_STMT (leader) = VEC_index (tree, stmt_list, x);
- bsi_commit_one_edge_insert (leader, NULL);
+ PENDING_STMT (leader) = VEC_index (gimple_seq, stmt_list, x);
+ gsi_commit_one_edge_insert (leader, NULL);
}
/* Clear the working data structures. */
VEC_truncate (edge, edge_leader, 0);
- VEC_truncate (tree, stmt_list, 0);
+ VEC_truncate (gimple_seq, stmt_list, 0);
bitmap_clear (leader_has_match);
}
@@ -1297,9 +1293,9 @@ static void
remove_ssa_form (bool perform_ter)
{
basic_block bb;
- tree phi, next;
- tree *values = NULL;
+ gimple *values = NULL;
var_map map;
+ gimple_stmt_iterator gsi;
map = coalesce_ssa_name ();
@@ -1336,13 +1332,8 @@ remove_ssa_form (bool perform_ter)
/* Remove PHI nodes which have been translated back to real variables. */
FOR_EACH_BB (bb)
- {
- for (phi = phi_nodes (bb); phi; phi = next)
- {
- next = PHI_CHAIN (phi);
- remove_phi_node (phi, NULL_TREE, true);
- }
- }
+ for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi);)
+ remove_phi_node (&gsi, true);
/* If any copies were inserted on edges, analyze and insert them now. */
perform_edge_inserts ();
@@ -1364,25 +1355,25 @@ static void
insert_backedge_copies (void)
{
basic_block bb;
+ gimple_stmt_iterator gsi;
FOR_EACH_BB (bb)
{
- tree phi;
-
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
+ for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- tree result = PHI_RESULT (phi);
+ gimple phi = gsi_stmt (gsi);
+ tree result = gimple_phi_result (phi);
tree result_var;
- int i;
+ size_t i;
if (!is_gimple_reg (result))
continue;
result_var = SSA_NAME_VAR (result);
- for (i = 0; i < PHI_NUM_ARGS (phi); i++)
+ for (i = 0; i < gimple_phi_num_args (phi); i++)
{
- tree arg = PHI_ARG_DEF (phi, i);
- edge e = PHI_ARG_EDGE (phi, i);
+ tree arg = gimple_phi_arg_def (phi, i);
+ edge e = gimple_phi_arg_edge (phi, i);
/* If the argument is not an SSA_NAME, then we will need a
constant initialization. If the argument is an SSA_NAME with
@@ -1392,12 +1383,13 @@ insert_backedge_copies (void)
&& (TREE_CODE (arg) != SSA_NAME
|| SSA_NAME_VAR (arg) != result_var))
{
- tree stmt, name, last = NULL;
- block_stmt_iterator bsi;
+ tree name;
+ gimple stmt, last = NULL;
+ gimple_stmt_iterator gsi2;
- bsi = bsi_last (PHI_ARG_EDGE (phi, i)->src);
- if (!bsi_end_p (bsi))
- last = bsi_stmt (bsi);
+ gsi2 = gsi_last_bb (gimple_phi_arg_edge (phi, i)->src);
+ if (!gsi_end_p (gsi2))
+ last = gsi_stmt (gsi2);
/* In theory the only way we ought to get back to the
start of a loop should be with a COND_EXPR or GOTO_EXPR.
@@ -1418,17 +1410,17 @@ insert_backedge_copies (void)
/* Create a new instance of the underlying variable of the
PHI result. */
- stmt = build_gimple_modify_stmt (NULL_TREE,
- PHI_ARG_DEF (phi, i));
+ stmt = gimple_build_assign (result_var,
+ gimple_phi_arg_def (phi, i));
name = make_ssa_name (result_var, stmt);
- GIMPLE_STMT_OPERAND (stmt, 0) = name;
+ gimple_assign_set_lhs (stmt, name);
/* Insert the new statement into the block and update
the PHI node. */
if (last && stmt_ends_bb_p (last))
- bsi_insert_before (&bsi, stmt, BSI_NEW_STMT);
+ gsi_insert_before (&gsi2, stmt, GSI_NEW_STMT);
else
- bsi_insert_after (&bsi, stmt, BSI_NEW_STMT);
+ gsi_insert_after (&gsi2, stmt, GSI_NEW_STMT);
SET_PHI_ARG_DEF (phi, i, name);
}
}
@@ -1454,12 +1446,12 @@ rewrite_out_of_ssa (void)
eliminate_virtual_phis ();
if (dump_file && (dump_flags & TDF_DETAILS))
- dump_tree_cfg (dump_file, dump_flags & ~TDF_DETAILS);
+ gimple_dump_cfg (dump_file, dump_flags & ~TDF_DETAILS);
remove_ssa_form (flag_tree_ter && !flag_mudflap);
if (dump_file && (dump_flags & TDF_DETAILS))
- dump_tree_cfg (dump_file, dump_flags & ~TDF_DETAILS);
+ gimple_dump_cfg (dump_file, dump_flags & ~TDF_DETAILS);
cfun->gimple_df->in_ssa_p = false;
return 0;
diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c
index be0fd9cbac4..f2b8d042ef5 100644
--- a/gcc/tree-parloops.c
+++ b/gcc/tree-parloops.c
@@ -41,14 +41,14 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
The implementation is straightforward -- for each loop we test whether its
iterations are independent, and if it is the case (and some additional
conditions regarding profitability and correctness are satisfied), we
- add OMP_PARALLEL and OMP_FOR codes and let omp expansion machinery do
- its job.
+ add GIMPLE_OMP_PARALLEL and GIMPLE_OMP_FOR codes and let omp expansion
+ machinery do its job.
The most of the complexity is in bringing the code into shape expected
by the omp expanders:
- -- for OMP_FOR, ensuring that the loop has only one induction variable
- and that the exit test is at the start of the loop body
- -- for OMP_PARALLEL, replacing the references to local addressable
+ -- for GIMPLE_OMP_FOR, ensuring that the loop has only one induction
+ variable and that the exit test is at the start of the loop body
+ -- for GIMPLE_OMP_PARALLEL, replacing the references to local addressable
variables by accesses through pointers, and breaking up ssa chains
by storing the values incoming to the parallelized loop to a structure
passed to the new function as an argument (something similar is done
@@ -122,11 +122,11 @@ parloop
sum.27_11 = D.1827_8 + sum.27_29;
- OMP_CONTINUE
+ GIMPLE_OMP_CONTINUE
# Adding this reduction phi is done at create_phi_for_local_result() #
# sum.27_56 = PHI <sum.27_11, 0>
- OMP_RETURN
+ GIMPLE_OMP_RETURN
# Creating the atomic operation is done at
create_call_for_reduction_1() #
@@ -136,7 +136,7 @@ parloop
D.1840_60 = sum.27_56 + D.1839_59;
#pragma omp atomic_store (D.1840_60);
- OMP_RETURN
+ GIMPLE_OMP_RETURN
# collecting the result after the join of the threads is done at
create_loads_for_reductions().
@@ -166,15 +166,15 @@ parloop
reduction in the current loop. */
struct reduction_info
{
- tree reduc_stmt; /* reduction statement. */
- tree reduc_phi; /* The phi node defining the reduction. */
- enum tree_code reduction_code; /* code for the reduction operation. */
- tree keep_res; /* The PHI_RESULT of this phi is the resulting value
+ gimple reduc_stmt; /* reduction statement. */
+ gimple reduc_phi; /* The phi node defining the reduction. */
+ enum tree_code reduction_code;/* code for the reduction operation. */
+ gimple keep_res; /* The PHI_RESULT of this phi is the resulting value
of the reduction variable when existing the loop. */
tree initial_value; /* The initial value of the reduction var before entering the loop. */
tree field; /* the name of the field in the parloop data structure intended for reduction. */
tree init; /* reduction initialization value. */
- tree new_phi; /* (helper field) Newly created phi node whose result
+ gimple new_phi; /* (helper field) Newly created phi node whose result
will be passed to the atomic operation. Represents
the local result each thread computed for the reduction
operation. */
@@ -200,7 +200,7 @@ reduction_info_hash (const void *aa)
}
static struct reduction_info *
-reduction_phi (htab_t reduction_list, tree phi)
+reduction_phi (htab_t reduction_list, gimple phi)
{
struct reduction_info tmpred, *red;
@@ -249,14 +249,15 @@ name_to_copy_elt_hash (const void *aa)
reductions are found, they are inserted to the REDUCTION_LIST. */
static bool
-loop_parallel_p (struct loop *loop, htab_t reduction_list, struct tree_niter_desc *niter)
+loop_parallel_p (struct loop *loop, htab_t reduction_list,
+ struct tree_niter_desc *niter)
{
edge exit = single_dom_exit (loop);
VEC (ddr_p, heap) * dependence_relations;
- VEC (data_reference_p, heap) * datarefs;
+ VEC (data_reference_p, heap) *datarefs;
lambda_trans_matrix trans;
bool ret = false;
- tree phi;
+ gimple_stmt_iterator gsi;
loop_vec_info simple_loop_info;
/* Only consider innermost loops with just one exit. The innermost-loop
@@ -279,9 +280,10 @@ loop_parallel_p (struct loop *loop, htab_t reduction_list, struct tree_niter_des
simple_loop_info = vect_analyze_loop_form (loop);
- for (phi = phi_nodes (loop->header); phi; phi = PHI_CHAIN (phi))
+ for (gsi = gsi_start_phis (loop->header); !gsi_end_p (gsi); gsi_next (&gsi))
{
- tree reduc_stmt = NULL, operation;
+ gimple phi = gsi_stmt (gsi);
+ gimple reduc_stmt = NULL;
/* ??? TODO: Change this into a generic function that
recognizes reductions. */
@@ -302,7 +304,7 @@ loop_parallel_p (struct loop *loop, htab_t reduction_list, struct tree_niter_des
{
fprintf (dump_file,
"Detected reduction. reduction stmt is: \n");
- print_generic_stmt (dump_file, reduc_stmt, 0);
+ print_gimple_stmt (dump_file, reduc_stmt, 0, 0);
fprintf (dump_file, "\n");
}
@@ -310,8 +312,7 @@ loop_parallel_p (struct loop *loop, htab_t reduction_list, struct tree_niter_des
new_reduction->reduc_stmt = reduc_stmt;
new_reduction->reduc_phi = phi;
- operation = GIMPLE_STMT_OPERAND (reduc_stmt, 1);
- new_reduction->reduction_code = TREE_CODE (operation);
+ new_reduction->reduction_code = gimple_assign_rhs_code (reduc_stmt);
slot = htab_find_slot (reduction_list, new_reduction, INSERT);
*slot = new_reduction;
}
@@ -320,13 +321,13 @@ loop_parallel_p (struct loop *loop, htab_t reduction_list, struct tree_niter_des
/* Get rid of the information created by the vectorizer functions. */
destroy_loop_vec_info (simple_loop_info, true);
- for (phi = phi_nodes (exit->dest); phi; phi = PHI_CHAIN (phi))
+ for (gsi = gsi_start_phis (exit->dest); !gsi_end_p (gsi); gsi_next (&gsi))
{
+ gimple phi = gsi_stmt (gsi);
struct reduction_info *red;
imm_use_iterator imm_iter;
use_operand_p use_p;
- tree reduc_phi;
-
+ gimple reduc_phi;
tree val = PHI_ARG_DEF_FROM_EDGE (phi, exit);
if (is_gimple_reg (val))
@@ -334,7 +335,7 @@ loop_parallel_p (struct loop *loop, htab_t reduction_list, struct tree_niter_des
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "phi is ");
- print_generic_expr (dump_file, phi, 0);
+ print_gimple_stmt (dump_file, phi, 0, 0);
fprintf (dump_file, "arg of phi to exit: value ");
print_generic_expr (dump_file, val, 0);
fprintf (dump_file, " used outside loop\n");
@@ -351,7 +352,7 @@ loop_parallel_p (struct loop *loop, htab_t reduction_list, struct tree_niter_des
reduc_phi = NULL;
FOR_EACH_IMM_USE_FAST (use_p, imm_iter, val)
{
- if (flow_bb_inside_loop_p (loop, bb_for_stmt (USE_STMT (use_p))))
+ if (flow_bb_inside_loop_p (loop, gimple_bb (USE_STMT (use_p))))
{
reduc_phi = USE_STMT (use_p);
break;
@@ -368,9 +369,9 @@ loop_parallel_p (struct loop *loop, htab_t reduction_list, struct tree_niter_des
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "reduction phi is ");
- print_generic_expr (dump_file, red->reduc_phi, 0);
+ print_gimple_stmt (dump_file, red->reduc_phi, 0, 0);
fprintf (dump_file, "reduction stmt is ");
- print_generic_expr (dump_file, red->reduc_stmt, 0);
+ print_gimple_stmt (dump_file, red->reduc_stmt, 0, 0);
}
}
@@ -378,8 +379,9 @@ loop_parallel_p (struct loop *loop, htab_t reduction_list, struct tree_niter_des
/* The iterations of the loop may communicate only through bivs whose
iteration space can be distributed efficiently. */
- for (phi = phi_nodes (loop->header); phi; phi = PHI_CHAIN (phi))
+ for (gsi = gsi_start_phis (loop->header); !gsi_end_p (gsi); gsi_next (&gsi))
{
+ gimple phi = gsi_stmt (gsi);
tree def = PHI_RESULT (phi);
affine_iv iv;
@@ -465,7 +467,9 @@ take_address_of (tree obj, tree type, edge entry, htab_t decl_address)
int uid;
void **dslot;
struct int_tree_map ielt, *nielt;
- tree *var_p, name, bvar, stmt, addr;
+ tree *var_p, name, bvar, addr;
+ gimple stmt;
+ gimple_seq stmts;
/* Since the address of OBJ is invariant, the trees may be shared.
Avoid rewriting unrelated parts of the code. */
@@ -483,10 +487,10 @@ take_address_of (tree obj, tree type, edge entry, htab_t decl_address)
addr = build_addr (*var_p, current_function_decl);
bvar = create_tmp_var (TREE_TYPE (addr), get_name (*var_p));
add_referenced_var (bvar);
- stmt = build_gimple_modify_stmt (bvar, addr);
+ stmt = gimple_build_assign (bvar, addr);
name = make_ssa_name (bvar, stmt);
- GIMPLE_STMT_OPERAND (stmt, 0) = name;
- bsi_insert_on_edge_immediate (entry, stmt);
+ gimple_assign_set_lhs (stmt, name);
+ gsi_insert_on_edge_immediate (entry, stmt);
nielt = XNEW (struct int_tree_map);
nielt->uid = uid;
@@ -500,17 +504,17 @@ take_address_of (tree obj, tree type, edge entry, htab_t decl_address)
{
*var_p = build1 (INDIRECT_REF, TREE_TYPE (*var_p), name);
name = force_gimple_operand (build_addr (obj, current_function_decl),
- &stmt, true, NULL_TREE);
- if (stmt)
- bsi_insert_on_edge_immediate (entry, stmt);
+ &stmts, true, NULL_TREE);
+ if (!gimple_seq_empty_p (stmts))
+ gsi_insert_seq_on_edge_immediate (entry, stmts);
}
if (TREE_TYPE (name) != type)
{
- name = force_gimple_operand (fold_convert (type, name), &stmt, true,
+ name = force_gimple_operand (fold_convert (type, name), &stmts, true,
NULL_TREE);
- if (stmt)
- bsi_insert_on_edge_immediate (entry, stmt);
+ if (!gimple_seq_empty_p (stmts))
+ gsi_insert_seq_on_edge_immediate (entry, stmts);
}
return name;
@@ -543,8 +547,7 @@ initialize_reductions (void **slot, void *data)
c = build_omp_clause (OMP_CLAUSE_REDUCTION);
OMP_CLAUSE_REDUCTION_CODE (c) = reduc->reduction_code;
- OMP_CLAUSE_DECL (c) =
- SSA_NAME_VAR (GIMPLE_STMT_OPERAND (reduc->reduc_stmt, 0));
+ OMP_CLAUSE_DECL (c) = SSA_NAME_VAR (gimple_assign_lhs (reduc->reduc_stmt));
init = omp_reduction_init (c, TREE_TYPE (bvar));
reduc->init = init;
@@ -569,6 +572,7 @@ initialize_reductions (void **slot, void *data)
struct elv_data
{
+ struct walk_stmt_info info;
edge entry;
htab_t decl_address;
bool changed;
@@ -632,7 +636,7 @@ eliminate_local_variables_1 (tree *tp, int *walk_subtrees, void *data)
return NULL_TREE;
}
- if (!EXPR_P (t) && !GIMPLE_STMT_P (t))
+ if (!EXPR_P (t))
*walk_subtrees = 0;
return NULL_TREE;
@@ -644,16 +648,17 @@ eliminate_local_variables_1 (tree *tp, int *walk_subtrees, void *data)
already. */
static void
-eliminate_local_variables_stmt (edge entry, tree stmt,
+eliminate_local_variables_stmt (edge entry, gimple stmt,
htab_t decl_address)
{
struct elv_data dta;
+ memset (&dta.info, '\0', sizeof (dta.info));
dta.entry = entry;
dta.decl_address = decl_address;
dta.changed = false;
- walk_tree (&stmt, eliminate_local_variables_1, &dta, NULL);
+ walk_gimple_op (stmt, eliminate_local_variables_1, &dta.info);
if (dta.changed)
update_stmt (stmt);
@@ -676,7 +681,7 @@ eliminate_local_variables (edge entry, edge exit)
basic_block bb;
VEC (basic_block, heap) *body = VEC_alloc (basic_block, heap, 3);
unsigned i;
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
htab_t decl_address = htab_create (10, int_tree_map_hash, int_tree_map_eq,
free);
basic_block entry_bb = entry->src;
@@ -686,8 +691,8 @@ eliminate_local_variables (edge entry, edge exit)
for (i = 0; VEC_iterate (basic_block, body, i, bb); i++)
if (bb != entry_bb && bb != exit_bb)
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
- eliminate_local_variables_stmt (entry, bsi_stmt (bsi),
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ eliminate_local_variables_stmt (entry, gsi_stmt (gsi),
decl_address);
htab_delete (decl_address);
@@ -703,14 +708,13 @@ expr_invariant_in_region_p (edge entry, edge exit, tree expr)
basic_block entry_bb = entry->src;
basic_block exit_bb = exit->dest;
basic_block def_bb;
- unsigned i, len;
if (is_gimple_min_invariant (expr))
return true;
if (TREE_CODE (expr) == SSA_NAME)
{
- def_bb = bb_for_stmt (SSA_NAME_DEF_STMT (expr));
+ def_bb = gimple_bb (SSA_NAME_DEF_STMT (expr));
if (def_bb
&& dominated_by_p (CDI_DOMINATORS, def_bb, entry_bb)
&& !dominated_by_p (CDI_DOMINATORS, def_bb, exit_bb))
@@ -719,15 +723,7 @@ expr_invariant_in_region_p (edge entry, edge exit, tree expr)
return true;
}
- if (!EXPR_P (expr) && !GIMPLE_STMT_P (expr))
- return false;
-
- len = TREE_OPERAND_LENGTH (expr);
- for (i = 0; i < len; i++)
- if (!expr_invariant_in_region_p (entry, exit, TREE_OPERAND (expr, i)))
- return false;
-
- return true;
+ return false;
}
/* If COPY_NAME_P is true, creates and returns a duplicate of NAME.
@@ -788,7 +784,7 @@ separate_decls_in_region_name (tree name,
if (copy_name_p)
{
- copy = duplicate_ssa_name (name, NULL_TREE);
+ copy = duplicate_ssa_name (name, NULL);
nelt = XNEW (struct name_to_copy_elt);
nelt->version = idx;
nelt->new_name = copy;
@@ -813,7 +809,7 @@ separate_decls_in_region_name (tree name,
replacement decls are stored in DECL_COPIES. */
static void
-separate_decls_in_region_stmt (edge entry, edge exit, tree stmt,
+separate_decls_in_region_stmt (edge entry, edge exit, gimple stmt,
htab_t name_copies, htab_t decl_copies)
{
use_operand_p use;
@@ -855,7 +851,7 @@ add_field_for_reduction (void **slot, void *data)
struct reduction_info *const red = (struct reduction_info *) *slot;
tree const type = (tree) data;
- tree var = SSA_NAME_VAR (GIMPLE_STMT_OPERAND (red->reduc_stmt, 0));
+ tree var = SSA_NAME_VAR (gimple_assign_lhs (red->reduc_stmt));
tree field = build_decl (FIELD_DECL, DECL_NAME (var), TREE_TYPE (var));
insert_field_into_struct (type, field);
@@ -896,13 +892,13 @@ create_phi_for_local_result (void **slot, void *data)
struct reduction_info *const reduc = (struct reduction_info *) *slot;
const struct loop *const loop = (const struct loop *) data;
edge e;
- tree new_phi;
+ gimple new_phi;
basic_block store_bb;
tree local_res;
/* STORE_BB is the block where the phi
should be stored. It is the destination of the loop exit.
- (Find the fallthru edge from OMP_CONTINUE). */
+ (Find the fallthru edge from GIMPLE_OMP_CONTINUE). */
store_bb = FALLTHRU_EDGE (loop->latch)->dest;
/* STORE_BB has two predecessors. One coming from the loop
@@ -914,11 +910,13 @@ create_phi_for_local_result (void **slot, void *data)
e = EDGE_PRED (store_bb, 1);
else
e = EDGE_PRED (store_bb, 0);
- local_res = make_ssa_name (SSA_NAME_VAR (GIMPLE_STMT_OPERAND (reduc->reduc_stmt, 0)), NULL_TREE);
+ local_res
+ = make_ssa_name (SSA_NAME_VAR (gimple_assign_lhs (reduc->reduc_stmt)),
+ NULL);
new_phi = create_phi_node (local_res, store_bb);
SSA_NAME_DEF_STMT (local_res) = new_phi;
add_phi_arg (new_phi, reduc->init, e);
- add_phi_arg (new_phi, GIMPLE_STMT_OPERAND (reduc->reduc_stmt, 0),
+ add_phi_arg (new_phi, gimple_assign_lhs (reduc->reduc_stmt),
FALLTHRU_EDGE (loop->latch));
reduc->new_phi = new_phi;
@@ -944,7 +942,7 @@ create_call_for_reduction_1 (void **slot, void *data)
{
struct reduction_info *const reduc = (struct reduction_info *) *slot;
struct clsn_data *const clsn_data = (struct clsn_data *) data;
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
tree type = TREE_TYPE (PHI_RESULT (reduc->reduc_phi));
tree struct_type = TREE_TYPE (TREE_TYPE (clsn_data->load));
tree load_struct;
@@ -952,7 +950,8 @@ create_call_for_reduction_1 (void **slot, void *data)
basic_block new_bb;
edge e;
tree t, addr, addr_type, ref, x;
- tree tmp_load, load, name;
+ tree tmp_load, name;
+ gimple load;
load_struct = fold_build1 (INDIRECT_REF, struct_type, clsn_data->load);
t = build3 (COMPONENT_REF, type, load_struct, reduc->field, NULL_TREE);
@@ -969,27 +968,23 @@ create_call_for_reduction_1 (void **slot, void *data)
tmp_load = create_tmp_var (TREE_TYPE (TREE_TYPE (addr)), NULL);
add_referenced_var (tmp_load);
tmp_load = make_ssa_name (tmp_load, NULL);
- load = build2 (OMP_ATOMIC_LOAD, void_type_node, tmp_load, addr);
+ load = gimple_build_omp_atomic_load (tmp_load, addr);
SSA_NAME_DEF_STMT (tmp_load) = load;
- bsi = bsi_start (new_bb);
- bsi_insert_after (&bsi, load, BSI_NEW_STMT);
+ gsi = gsi_start_bb (new_bb);
+ gsi_insert_after (&gsi, load, GSI_NEW_STMT);
e = split_block (new_bb, load);
new_bb = e->dest;
- bsi = bsi_start (new_bb);
+ gsi = gsi_start_bb (new_bb);
ref = tmp_load;
- x =
- fold_build2 (reduc->reduction_code,
- TREE_TYPE (PHI_RESULT (reduc->new_phi)), ref,
- PHI_RESULT (reduc->new_phi));
-
- name =
- force_gimple_operand_bsi (&bsi, x, true, NULL_TREE, true,
- BSI_CONTINUE_LINKING);
+ x = fold_build2 (reduc->reduction_code,
+ TREE_TYPE (PHI_RESULT (reduc->new_phi)), ref,
+ PHI_RESULT (reduc->new_phi));
- x = build1 (OMP_ATOMIC_STORE, void_type_node, name);
+ name = force_gimple_operand_gsi (&gsi, x, true, NULL_TREE, true,
+ GSI_CONTINUE_LINKING);
- bsi_insert_after (&bsi, x, BSI_NEW_STMT);
+ gsi_insert_after (&gsi, gimple_build_omp_atomic_store (name), GSI_NEW_STMT);
return 1;
}
@@ -1002,7 +997,7 @@ create_call_for_reduction (struct loop *loop, htab_t reduction_list,
struct clsn_data *ld_st_data)
{
htab_traverse (reduction_list, create_phi_for_local_result, loop);
- /* Find the fallthru edge from OMP_CONTINUE. */
+ /* Find the fallthru edge from GIMPLE_OMP_CONTINUE. */
ld_st_data->load_bb = FALLTHRU_EDGE (loop->latch)->dest;
htab_traverse (reduction_list, create_call_for_reduction_1, ld_st_data);
}
@@ -1015,30 +1010,34 @@ create_loads_for_reductions (void **slot, void *data)
{
struct reduction_info *const red = (struct reduction_info *) *slot;
struct clsn_data *const clsn_data = (struct clsn_data *) data;
- tree stmt;
- block_stmt_iterator bsi;
- tree type = TREE_TYPE (GIMPLE_STMT_OPERAND (red->reduc_stmt, 0));
+ gimple stmt;
+ gimple_stmt_iterator gsi;
+ tree type = TREE_TYPE (gimple_assign_lhs (red->reduc_stmt));
tree struct_type = TREE_TYPE (TREE_TYPE (clsn_data->load));
tree load_struct;
tree name;
tree x;
- bsi = bsi_after_labels (clsn_data->load_bb);
+ gsi = gsi_after_labels (clsn_data->load_bb);
load_struct = fold_build1 (INDIRECT_REF, struct_type, clsn_data->load);
load_struct = build3 (COMPONENT_REF, type, load_struct, red->field,
NULL_TREE);
x = load_struct;
name = PHI_RESULT (red->keep_res);
- stmt = build_gimple_modify_stmt (name, x);
- GIMPLE_STMT_OPERAND (stmt, 0) = name;
+ stmt = gimple_build_assign (name, x);
SSA_NAME_DEF_STMT (name) = stmt;
- bsi_insert_after (&bsi, stmt, BSI_NEW_STMT);
+ gsi_insert_after (&gsi, stmt, GSI_NEW_STMT);
- remove_phi_node (red->keep_res, NULL_TREE, false);
-
- return 1;
+ for (gsi = gsi_start_phis (gimple_bb (red->keep_res));
+ !gsi_end_p (gsi); gsi_next (&gsi))
+ if (gsi_stmt (gsi) == red->keep_res)
+ {
+ remove_phi_node (&gsi, false);
+ return 1;
+ }
+ gcc_unreachable ();
}
/* Load the reduction result that was stored in LD_ST_DATA.
@@ -1048,18 +1047,16 @@ static void
create_final_loads_for_reduction (htab_t reduction_list,
struct clsn_data *ld_st_data)
{
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
tree t;
+ gimple stmt;
- bsi = bsi_after_labels (ld_st_data->load_bb);
+ gsi = gsi_after_labels (ld_st_data->load_bb);
t = build_fold_addr_expr (ld_st_data->store);
- t =
- build_gimple_modify_stmt (ld_st_data->load,
- build_fold_addr_expr (ld_st_data->store));
+ stmt = gimple_build_assign (ld_st_data->load, t);
- bsi_insert_before (&bsi, t, BSI_NEW_STMT);
- SSA_NAME_DEF_STMT (ld_st_data->load) = t;
- GIMPLE_STMT_OPERAND (t, 0) = ld_st_data->load;
+ gsi_insert_before (&gsi, stmt, GSI_NEW_STMT);
+ SSA_NAME_DEF_STMT (ld_st_data->load) = stmt;
htab_traverse (reduction_list, create_loads_for_reductions, ld_st_data);
@@ -1076,18 +1073,16 @@ create_stores_for_reduction (void **slot, void *data)
{
struct reduction_info *const red = (struct reduction_info *) *slot;
struct clsn_data *const clsn_data = (struct clsn_data *) data;
- tree stmt;
- block_stmt_iterator bsi;
- tree type = TREE_TYPE (GIMPLE_STMT_OPERAND (red->reduc_stmt, 0));
-
- bsi = bsi_last (clsn_data->store_bb);
- stmt =
- build_gimple_modify_stmt (build3
- (COMPONENT_REF, type, clsn_data->store,
- red->field, NULL_TREE),
- red->initial_value);
+ tree t;
+ gimple stmt;
+ gimple_stmt_iterator gsi;
+ tree type = TREE_TYPE (gimple_assign_lhs (red->reduc_stmt));
+
+ gsi = gsi_last_bb (clsn_data->store_bb);
+ t = build3 (COMPONENT_REF, type, clsn_data->store, red->field, NULL_TREE);
+ stmt = gimple_build_assign (t, red->initial_value);
mark_virtual_ops_for_renaming (stmt);
- bsi_insert_after (&bsi, stmt, BSI_NEW_STMT);
+ gsi_insert_after (&gsi, stmt, GSI_NEW_STMT);
return 1;
}
@@ -1101,28 +1096,25 @@ create_loads_and_stores_for_name (void **slot, void *data)
{
struct name_to_copy_elt *const elt = (struct name_to_copy_elt *) *slot;
struct clsn_data *const clsn_data = (struct clsn_data *) data;
- tree stmt;
- block_stmt_iterator bsi;
+ tree t;
+ gimple stmt;
+ gimple_stmt_iterator gsi;
tree type = TREE_TYPE (elt->new_name);
tree struct_type = TREE_TYPE (TREE_TYPE (clsn_data->load));
tree load_struct;
- bsi = bsi_last (clsn_data->store_bb);
- stmt =
- build_gimple_modify_stmt (build3
- (COMPONENT_REF, type, clsn_data->store,
- elt->field, NULL_TREE),
- ssa_name (elt->version));
+ gsi = gsi_last_bb (clsn_data->store_bb);
+ t = build3 (COMPONENT_REF, type, clsn_data->store, elt->field, NULL_TREE);
+ stmt = gimple_build_assign (t, ssa_name (elt->version));
mark_virtual_ops_for_renaming (stmt);
- bsi_insert_after (&bsi, stmt, BSI_NEW_STMT);
+ gsi_insert_after (&gsi, stmt, GSI_NEW_STMT);
- bsi = bsi_last (clsn_data->load_bb);
+ gsi = gsi_last_bb (clsn_data->load_bb);
load_struct = fold_build1 (INDIRECT_REF, struct_type, clsn_data->load);
- stmt = build_gimple_modify_stmt (elt->new_name,
- build3 (COMPONENT_REF, type, load_struct,
- elt->field, NULL_TREE));
+ t = build3 (COMPONENT_REF, type, load_struct, elt->field, NULL_TREE);
+ stmt = gimple_build_assign (elt->new_name, t);
SSA_NAME_DEF_STMT (elt->new_name) = stmt;
- bsi_insert_after (&bsi, stmt, BSI_NEW_STMT);
+ gsi_insert_after (&gsi, stmt, GSI_NEW_STMT);
return 1;
}
@@ -1174,27 +1166,27 @@ separate_decls_in_region (edge entry, edge exit, htab_t reduction_list,
htab_t decl_copies = htab_create (10, int_tree_map_hash, int_tree_map_eq,
free);
unsigned i;
- tree phi, type, type_name, nvar;
- block_stmt_iterator bsi;
+ tree type, type_name, nvar;
+ gimple_stmt_iterator gsi;
struct clsn_data clsn_data;
VEC (basic_block, heap) *body = VEC_alloc (basic_block, heap, 3);
basic_block bb;
basic_block entry_bb = bb1;
basic_block exit_bb = exit->dest;
- entry = single_succ_edge(entry_bb);
+ entry = single_succ_edge (entry_bb);
gather_blocks_in_sese_region (entry_bb, exit_bb, &body);
for (i = 0; VEC_iterate (basic_block, body, i, bb); i++)
{
if (bb != entry_bb && bb != exit_bb)
{
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
- separate_decls_in_region_stmt (entry, exit, phi, name_copies,
- decl_copies);
-
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
- separate_decls_in_region_stmt (entry, exit, bsi_stmt (bsi),
+ for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ separate_decls_in_region_stmt (entry, exit, gsi_stmt (gsi),
+ name_copies, decl_copies);
+
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ separate_decls_in_region_stmt (entry, exit, gsi_stmt (gsi),
name_copies, decl_copies);
}
}
@@ -1230,7 +1222,7 @@ separate_decls_in_region (edge entry, edge exit, htab_t reduction_list,
add_referenced_var (*arg_struct);
nvar = create_tmp_var (build_pointer_type (type), ".paral_data_load");
add_referenced_var (nvar);
- *new_arg_struct = make_ssa_name (nvar, NULL_TREE);
+ *new_arg_struct = make_ssa_name (nvar, NULL);
ld_st_data->store = *arg_struct;
ld_st_data->load = *new_arg_struct;
@@ -1246,7 +1238,7 @@ separate_decls_in_region (edge entry, edge exit, htab_t reduction_list,
{
htab_traverse (reduction_list, create_stores_for_reduction,
ld_st_data);
- clsn_data.load = make_ssa_name (nvar, NULL_TREE);
+ clsn_data.load = make_ssa_name (nvar, NULL);
clsn_data.load_bb = exit->dest;
clsn_data.store = ld_st_data->store;
create_final_loads_for_reduction (reduction_list, &clsn_data);
@@ -1338,15 +1330,18 @@ static void
canonicalize_loop_ivs (struct loop *loop, htab_t reduction_list, tree nit)
{
unsigned precision = TYPE_PRECISION (TREE_TYPE (nit));
- tree phi, prev, res, type, var_before, val, atype, mtype, t, next;
- block_stmt_iterator bsi;
+ tree res, type, var_before, val, atype, mtype;
+ gimple_stmt_iterator gsi, psi;
+ gimple phi, stmt;
bool ok;
affine_iv iv;
edge exit = single_dom_exit (loop);
struct reduction_info *red;
- for (phi = phi_nodes (loop->header); phi; phi = PHI_CHAIN (phi))
+ for (psi = gsi_start_phis (loop->header);
+ !gsi_end_p (psi); gsi_next (&psi))
{
+ phi = gsi_stmt (psi);
res = PHI_RESULT (phi);
if (is_gimple_reg (res) && TYPE_PRECISION (TREE_TYPE (res)) > precision)
@@ -1355,20 +1350,19 @@ canonicalize_loop_ivs (struct loop *loop, htab_t reduction_list, tree nit)
type = lang_hooks.types.type_for_size (precision, 1);
- bsi = bsi_last (loop->latch);
+ gsi = gsi_last_bb (loop->latch);
create_iv (build_int_cst_type (type, 0), build_int_cst (type, 1), NULL_TREE,
- loop, &bsi, true, &var_before, NULL);
+ loop, &gsi, true, &var_before, NULL);
- bsi = bsi_after_labels (loop->header);
- prev = NULL;
- for (phi = phi_nodes (loop->header); phi; phi = next)
+ gsi = gsi_after_labels (loop->header);
+ for (psi = gsi_start_phis (loop->header); !gsi_end_p (psi); )
{
- next = PHI_CHAIN (phi);
+ phi = gsi_stmt (psi);
res = PHI_RESULT (phi);
if (!is_gimple_reg (res) || res == var_before)
{
- prev = phi;
+ gsi_next (&psi);
continue;
}
@@ -1377,12 +1371,12 @@ canonicalize_loop_ivs (struct loop *loop, htab_t reduction_list, tree nit)
/* We preserve the reduction phi nodes. */
if (!ok && red)
{
- prev = phi;
+ gsi_next (&psi);
continue;
}
else
gcc_assert (ok);
- remove_phi_node (phi, prev, false);
+ remove_phi_node (&psi, false);
atype = TREE_TYPE (res);
mtype = POINTER_TYPE_P (atype) ? sizetype : atype;
@@ -1391,14 +1385,14 @@ canonicalize_loop_ivs (struct loop *loop, htab_t reduction_list, tree nit)
val = fold_build2 (POINTER_TYPE_P (atype)
? POINTER_PLUS_EXPR : PLUS_EXPR,
atype, unshare_expr (iv.base), val);
- val = force_gimple_operand_bsi (&bsi, val, false, NULL_TREE, true,
- BSI_SAME_STMT);
- t = build_gimple_modify_stmt (res, val);
- bsi_insert_before (&bsi, t, BSI_SAME_STMT);
- SSA_NAME_DEF_STMT (res) = t;
+ val = force_gimple_operand_gsi (&gsi, val, false, NULL_TREE, true,
+ GSI_SAME_STMT);
+ stmt = gimple_build_assign (res, val);
+ gsi_insert_before (&gsi, stmt, GSI_SAME_STMT);
+ SSA_NAME_DEF_STMT (res) = stmt;
}
- t = last_stmt (exit->src);
+ stmt = last_stmt (exit->src);
/* Make the loop exit if the control condition is not satisfied. */
if (exit->flags & EDGE_TRUE_VALUE)
{
@@ -1408,7 +1402,9 @@ canonicalize_loop_ivs (struct loop *loop, htab_t reduction_list, tree nit)
te->flags = EDGE_FALSE_VALUE;
fe->flags = EDGE_TRUE_VALUE;
}
- COND_EXPR_COND (t) = build2 (LT_EXPR, boolean_type_node, var_before, nit);
+ gimple_cond_set_code (stmt, LT_EXPR);
+ gimple_cond_set_lhs (stmt, var_before);
+ gimple_cond_set_rhs (stmt, nit);
}
/* Moves the exit condition of LOOP to the beginning of its header, and
@@ -1430,22 +1426,23 @@ transform_to_exit_first_loop (struct loop *loop, htab_t reduction_list, tree nit
unsigned n;
bool ok;
edge exit = single_dom_exit (loop), hpred;
- tree phi, nphi, cond, control, control_name, res, t, cond_stmt;
- block_stmt_iterator bsi;
+ tree control, control_name, res, t;
+ gimple phi, nphi, cond_stmt, stmt;
+ gimple_stmt_iterator gsi;
split_block_after_labels (loop->header);
orig_header = single_succ (loop->header);
hpred = single_succ_edge (loop->header);
cond_stmt = last_stmt (exit->src);
- cond = COND_EXPR_COND (cond_stmt);
- control = TREE_OPERAND (cond, 0);
- gcc_assert (TREE_OPERAND (cond, 1) == nit);
+ control = gimple_cond_lhs (cond_stmt);
+ gcc_assert (gimple_cond_rhs (cond_stmt) == nit);
/* Make sure that we have phi nodes on exit for all loop header phis
(create_parallel_loop requires that). */
- for (phi = phi_nodes (loop->header); phi; phi = PHI_CHAIN (phi))
+ for (gsi = gsi_start_phis (loop->header); !gsi_end_p (gsi); gsi_next (&gsi))
{
+ phi = gsi_stmt (gsi);
res = PHI_RESULT (phi);
t = make_ssa_name (SSA_NAME_VAR (res), phi);
SET_PHI_RESULT (phi, t);
@@ -1456,7 +1453,7 @@ transform_to_exit_first_loop (struct loop *loop, htab_t reduction_list, tree nit
if (res == control)
{
- TREE_OPERAND (cond, 0) = t;
+ gimple_cond_set_lhs (cond_stmt, t);
update_stmt (cond_stmt);
control = t;
}
@@ -1466,22 +1463,26 @@ transform_to_exit_first_loop (struct loop *loop, htab_t reduction_list, tree nit
for (n = 0; bbs[n] != exit->src; n++)
continue;
nbbs = XNEWVEC (basic_block, n);
- ok = tree_duplicate_sese_tail (single_succ_edge (loop->header), exit,
- bbs + 1, n, nbbs);
+ ok = gimple_duplicate_sese_tail (single_succ_edge (loop->header), exit,
+ bbs + 1, n, nbbs);
gcc_assert (ok);
free (bbs);
ex_bb = nbbs[0];
free (nbbs);
/* Other than reductions, the only gimple reg that should be copied
- out of the loop is the control variable. */
+ out of the loop is the control variable. */
control_name = NULL_TREE;
- for (phi = phi_nodes (ex_bb); phi; phi = PHI_CHAIN (phi))
+ for (gsi = gsi_start_phis (ex_bb); !gsi_end_p (gsi); )
{
+ phi = gsi_stmt (gsi);
res = PHI_RESULT (phi);
if (!is_gimple_reg (res))
- continue;
+ {
+ gsi_next (&gsi);
+ continue;
+ }
/* Check if it is a part of reduction. If it is,
keep the phi at the reduction's keep_res field. The
@@ -1498,93 +1499,95 @@ transform_to_exit_first_loop (struct loop *loop, htab_t reduction_list, tree nit
red = reduction_phi (reduction_list, SSA_NAME_DEF_STMT (val));
if (red)
- red->keep_res = phi;
+ {
+ red->keep_res = phi;
+ gsi_next (&gsi);
+ continue;
+ }
}
- else
- gcc_assert (control_name == NULL_TREE
- && SSA_NAME_VAR (res) == SSA_NAME_VAR (control));
+ gcc_assert (control_name == NULL_TREE
+ && SSA_NAME_VAR (res) == SSA_NAME_VAR (control));
control_name = res;
+ remove_phi_node (&gsi, false);
}
gcc_assert (control_name != NULL_TREE);
- phi = SSA_NAME_DEF_STMT (control_name);
- remove_phi_node (phi, NULL_TREE, false);
/* Initialize the control variable to NIT. */
- bsi = bsi_after_labels (ex_bb);
- nit = force_gimple_operand_bsi (&bsi,
+ gsi = gsi_after_labels (ex_bb);
+ nit = force_gimple_operand_gsi (&gsi,
fold_convert (TREE_TYPE (control_name), nit),
- false, NULL_TREE, false, BSI_SAME_STMT);
- t = build_gimple_modify_stmt (control_name, nit);
- bsi_insert_before (&bsi, t, BSI_NEW_STMT);
- SSA_NAME_DEF_STMT (control_name) = t;
+ false, NULL_TREE, false, GSI_SAME_STMT);
+ stmt = gimple_build_assign (control_name, nit);
+ gsi_insert_before (&gsi, stmt, GSI_NEW_STMT);
+ SSA_NAME_DEF_STMT (control_name) = stmt;
}
/* Create the parallel constructs for LOOP as described in gen_parallel_loop.
- LOOP_FN and DATA are the arguments of OMP_PARALLEL.
+ LOOP_FN and DATA are the arguments of GIMPLE_OMP_PARALLEL.
NEW_DATA is the variable that should be initialized from the argument
of LOOP_FN. N_THREADS is the requested number of threads. Returns the
- basic block containing OMP_PARALLEL tree. */
+ basic block containing GIMPLE_OMP_PARALLEL tree. */
static basic_block
create_parallel_loop (struct loop *loop, tree loop_fn, tree data,
tree new_data, unsigned n_threads)
{
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
basic_block bb, paral_bb, for_bb, ex_bb;
- tree t, param, res, for_stmt;
- tree cvar, cvar_init, initvar, cvar_next, cvar_base, cond, phi, type;
+ tree t, param, res;
+ gimple stmt, for_stmt, phi, cond_stmt;
+ tree cvar, cvar_init, initvar, cvar_next, cvar_base, type;
edge exit, nexit, guard, end, e;
- /* Prepare the OMP_PARALLEL statement. */
+ /* Prepare the GIMPLE_OMP_PARALLEL statement. */
bb = loop_preheader_edge (loop)->src;
paral_bb = single_pred (bb);
- bsi = bsi_last (paral_bb);
+ gsi = gsi_last_bb (paral_bb);
t = build_omp_clause (OMP_CLAUSE_NUM_THREADS);
OMP_CLAUSE_NUM_THREADS_EXPR (t)
= build_int_cst (integer_type_node, n_threads);
- t = build4 (OMP_PARALLEL, void_type_node, NULL_TREE, t, loop_fn, data);
+ stmt = gimple_build_omp_parallel (NULL, t, loop_fn, data);
- bsi_insert_after (&bsi, t, BSI_NEW_STMT);
+ gsi_insert_after (&gsi, stmt, GSI_NEW_STMT);
/* Initialize NEW_DATA. */
if (data)
{
- bsi = bsi_after_labels (bb);
-
- param = make_ssa_name (DECL_ARGUMENTS (loop_fn), NULL_TREE);
- t = build_gimple_modify_stmt (param, build_fold_addr_expr (data));
- bsi_insert_before (&bsi, t, BSI_SAME_STMT);
- SSA_NAME_DEF_STMT (param) = t;
-
- t = build_gimple_modify_stmt (new_data,
- fold_convert (TREE_TYPE (new_data),
- param));
- bsi_insert_before (&bsi, t, BSI_SAME_STMT);
- SSA_NAME_DEF_STMT (new_data) = t;
+ gsi = gsi_after_labels (bb);
+
+ param = make_ssa_name (DECL_ARGUMENTS (loop_fn), NULL);
+ stmt = gimple_build_assign (param, build_fold_addr_expr (data));
+ gsi_insert_before (&gsi, stmt, GSI_SAME_STMT);
+ SSA_NAME_DEF_STMT (param) = stmt;
+
+ stmt = gimple_build_assign (new_data,
+ fold_convert (TREE_TYPE (new_data), param));
+ gsi_insert_before (&gsi, stmt, GSI_SAME_STMT);
+ SSA_NAME_DEF_STMT (new_data) = stmt;
}
- /* Emit OMP_RETURN for OMP_PARALLEL. */
+ /* Emit GIMPLE_OMP_RETURN for GIMPLE_OMP_PARALLEL. */
bb = split_loop_exit_edge (single_dom_exit (loop));
- bsi = bsi_last (bb);
- bsi_insert_after (&bsi, make_node (OMP_RETURN), BSI_NEW_STMT);
+ gsi = gsi_last_bb (bb);
+ gsi_insert_after (&gsi, gimple_build_omp_return (false), GSI_NEW_STMT);
- /* Extract data for OMP_FOR. */
+ /* Extract data for GIMPLE_OMP_FOR. */
gcc_assert (loop->header == single_dom_exit (loop)->src);
- cond = COND_EXPR_COND (last_stmt (loop->header));
+ cond_stmt = last_stmt (loop->header);
- cvar = TREE_OPERAND (cond, 0);
+ cvar = gimple_cond_lhs (cond_stmt);
cvar_base = SSA_NAME_VAR (cvar);
phi = SSA_NAME_DEF_STMT (cvar);
cvar_init = PHI_ARG_DEF_FROM_EDGE (phi, loop_preheader_edge (loop));
- initvar = make_ssa_name (cvar_base, NULL_TREE);
+ initvar = make_ssa_name (cvar_base, NULL);
SET_USE (PHI_ARG_DEF_PTR_FROM_EDGE (phi, loop_preheader_edge (loop)),
initvar);
cvar_next = PHI_ARG_DEF_FROM_EDGE (phi, loop_latch_edge (loop));
- bsi = bsi_last (loop->latch);
- gcc_assert (bsi_stmt (bsi) == SSA_NAME_DEF_STMT (cvar_next));
- bsi_remove (&bsi, true);
+ gsi = gsi_last_bb (loop->latch);
+ gcc_assert (gsi_stmt (gsi) == SSA_NAME_DEF_STMT (cvar_next));
+ gsi_remove (&gsi, true);
/* Prepare cfg. */
for_bb = split_edge (loop_preheader_edge (loop));
@@ -1595,56 +1598,48 @@ create_parallel_loop (struct loop *loop, tree loop_fn, tree data,
guard = make_edge (for_bb, ex_bb, 0);
single_succ_edge (loop->latch)->flags = 0;
end = make_edge (loop->latch, ex_bb, EDGE_FALLTHRU);
- for (phi = phi_nodes (ex_bb); phi; phi = PHI_CHAIN (phi))
+ for (gsi = gsi_start_phis (ex_bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
+ phi = gsi_stmt (gsi);
res = PHI_RESULT (phi);
- gcc_assert (!is_gimple_reg (phi));
- t = SSA_NAME_DEF_STMT (PHI_ARG_DEF_FROM_EDGE (phi, exit));
- add_phi_arg (phi, PHI_ARG_DEF_FROM_EDGE (t, loop_preheader_edge (loop)),
+ stmt = SSA_NAME_DEF_STMT (PHI_ARG_DEF_FROM_EDGE (phi, exit));
+ add_phi_arg (phi,
+ PHI_ARG_DEF_FROM_EDGE (stmt, loop_preheader_edge (loop)),
guard);
- add_phi_arg (phi, PHI_ARG_DEF_FROM_EDGE (t, loop_latch_edge (loop)),
+ add_phi_arg (phi, PHI_ARG_DEF_FROM_EDGE (stmt, loop_latch_edge (loop)),
end);
}
e = redirect_edge_and_branch (exit, nexit->dest);
PENDING_STMT (e) = NULL;
- /* Emit OMP_FOR. */
- TREE_OPERAND (cond, 0) = cvar_base;
+ /* Emit GIMPLE_OMP_FOR. */
+ gimple_cond_set_lhs (cond_stmt, cvar_base);
type = TREE_TYPE (cvar);
t = build_omp_clause (OMP_CLAUSE_SCHEDULE);
OMP_CLAUSE_SCHEDULE_KIND (t) = OMP_CLAUSE_SCHEDULE_STATIC;
- for_stmt = make_node (OMP_FOR);
- TREE_TYPE (for_stmt) = void_type_node;
- OMP_FOR_CLAUSES (for_stmt) = t;
- OMP_FOR_INIT (for_stmt) = make_tree_vec (1);
- TREE_VEC_ELT (OMP_FOR_INIT (for_stmt), 0)
- = build_gimple_modify_stmt (initvar, cvar_init);
- OMP_FOR_COND (for_stmt) = make_tree_vec (1);
- TREE_VEC_ELT (OMP_FOR_COND (for_stmt), 0) = cond;
- OMP_FOR_INCR (for_stmt) = make_tree_vec (2);
- TREE_VEC_ELT (OMP_FOR_INCR (for_stmt), 0)
- = build_gimple_modify_stmt (cvar_base,
- build2 (PLUS_EXPR, type, cvar_base,
- build_int_cst (type, 1)));
- OMP_FOR_BODY (for_stmt) = NULL_TREE;
- OMP_FOR_PRE_BODY (for_stmt) = NULL_TREE;
-
- bsi = bsi_last (for_bb);
- bsi_insert_after (&bsi, for_stmt, BSI_NEW_STMT);
+ for_stmt = gimple_build_omp_for (NULL, t, 1, NULL);
+ gimple_omp_for_set_index (for_stmt, 0, initvar);
+ gimple_omp_for_set_initial (for_stmt, 0, cvar_init);
+ gimple_omp_for_set_final (for_stmt, 0, gimple_cond_rhs (cond_stmt));
+ gimple_omp_for_set_cond (for_stmt, 0, gimple_cond_code (cond_stmt));
+ gimple_omp_for_set_incr (for_stmt, 0, build2 (PLUS_EXPR, type,
+ cvar_base,
+ build_int_cst (type, 1)));
+
+ gsi = gsi_last_bb (for_bb);
+ gsi_insert_after (&gsi, for_stmt, GSI_NEW_STMT);
SSA_NAME_DEF_STMT (initvar) = for_stmt;
- /* Emit OMP_CONTINUE. */
- bsi = bsi_last (loop->latch);
- t = build2 (OMP_CONTINUE, void_type_node, cvar_next, cvar);
- bsi_insert_after (&bsi, t, BSI_NEW_STMT);
- SSA_NAME_DEF_STMT (cvar_next) = t;
+ /* Emit GIMPLE_OMP_CONTINUE. */
+ gsi = gsi_last_bb (loop->latch);
+ stmt = gimple_build_omp_continue (cvar_next, cvar);
+ gsi_insert_after (&gsi, stmt, GSI_NEW_STMT);
+ SSA_NAME_DEF_STMT (cvar_next) = stmt;
- /* Emit OMP_RETURN for OMP_FOR. */
- bsi = bsi_last (ex_bb);
- t = make_node (OMP_RETURN);
- OMP_RETURN_NOWAIT (t) = 1;
- bsi_insert_after (&bsi, t, BSI_NEW_STMT);
+ /* Emit GIMPLE_OMP_RETURN for GIMPLE_OMP_FOR. */
+ gsi = gsi_last_bb (ex_bb);
+ gsi_insert_after (&gsi, gimple_build_omp_return (true), GSI_NEW_STMT);
return paral_bb;
}
@@ -1660,7 +1655,8 @@ gen_parallel_loop (struct loop *loop, htab_t reduction_list,
struct loop *nloop;
loop_iterator li;
tree many_iterations_cond, type, nit;
- tree stmts, arg_struct, new_arg_struct;
+ tree arg_struct, new_arg_struct;
+ gimple_seq stmts;
basic_block parallel_head;
edge entry, exit;
struct clsn_data clsn_data;
@@ -1690,14 +1686,14 @@ gen_parallel_loop (struct loop *loop, htab_t reduction_list,
BODY1;
store all local loop-invariant variables used in body of the loop to DATA.
- OMP_PARALLEL (OMP_CLAUSE_NUM_THREADS (N_THREADS), LOOPFN, DATA);
+ GIMPLE_OMP_PARALLEL (OMP_CLAUSE_NUM_THREADS (N_THREADS), LOOPFN, DATA);
load the variables from DATA.
- OMP_FOR (IV = INIT; COND; IV += STEP) (OMP_CLAUSE_SCHEDULE (static))
+ GIMPLE_OMP_FOR (IV = INIT; COND; IV += STEP) (OMP_CLAUSE_SCHEDULE (static))
BODY2;
BODY1;
- OMP_CONTINUE;
- OMP_RETURN -- OMP_FOR
- OMP_RETURN -- OMP_PARALLEL
+ GIMPLE_OMP_CONTINUE;
+ GIMPLE_OMP_RETURN -- GIMPLE_OMP_FOR
+ GIMPLE_OMP_RETURN -- GIMPLE_OMP_PARALLEL
goto end;
original:
@@ -1723,7 +1719,7 @@ gen_parallel_loop (struct loop *loop, htab_t reduction_list,
nit = force_gimple_operand (unshare_expr (niter->niter), &stmts, true,
NULL_TREE);
if (stmts)
- bsi_insert_on_edge_immediate (loop_preheader_edge (loop), stmts);
+ gsi_insert_seq_on_edge_immediate (loop_preheader_edge (loop), stmts);
many_iterations_cond =
fold_build2 (GE_EXPR, boolean_type_node,
@@ -1735,14 +1731,14 @@ gen_parallel_loop (struct loop *loop, htab_t reduction_list,
many_iterations_cond
= force_gimple_operand (many_iterations_cond, &stmts, false, NULL_TREE);
if (stmts)
- bsi_insert_on_edge_immediate (loop_preheader_edge (loop), stmts);
+ gsi_insert_seq_on_edge_immediate (loop_preheader_edge (loop), stmts);
if (!is_gimple_condexpr (many_iterations_cond))
{
many_iterations_cond
= force_gimple_operand (many_iterations_cond, &stmts,
true, NULL_TREE);
if (stmts)
- bsi_insert_on_edge_immediate (loop_preheader_edge (loop), stmts);
+ gsi_insert_seq_on_edge_immediate (loop_preheader_edge (loop), stmts);
}
initialize_original_copy_tables ();
@@ -1803,16 +1799,16 @@ gen_parallel_loop (struct loop *loop, htab_t reduction_list,
/* Returns true when LOOP contains vector phi nodes. */
static bool
-loop_has_vector_phi_nodes (struct loop *loop)
+loop_has_vector_phi_nodes (struct loop *loop ATTRIBUTE_UNUSED)
{
unsigned i;
basic_block *bbs = get_loop_body_in_dom_order (loop);
+ gimple_stmt_iterator gsi;
bool res = true;
- tree phi;
for (i = 0; i < loop->num_nodes; i++)
- for (phi = phi_nodes (bbs[i]); phi; phi = PHI_CHAIN (phi))
- if (TREE_CODE (TREE_TYPE (PHI_RESULT (phi))) == VECTOR_TYPE)
+ for (gsi = gsi_start_phis (bbs[i]); !gsi_end_p (gsi); gsi_next (&gsi))
+ if (TREE_CODE (TREE_TYPE (PHI_RESULT (gsi_stmt (gsi)))) == VECTOR_TYPE)
goto end;
res = false;
@@ -1841,6 +1837,7 @@ parallelize_loops (void)
reduction_list = htab_create (10, reduction_info_hash,
reduction_info_eq, free);
+ init_stmt_vec_info_vec ();
FOR_EACH_LOOP (li, loop, 0)
{
@@ -1865,6 +1862,7 @@ parallelize_loops (void)
verify_loop_closed_ssa ();
}
+ free_stmt_vec_info_vec ();
htab_delete (reduction_list);
return changed;
}
diff --git a/gcc/tree-pass.h b/gcc/tree-pass.h
index c695863e553..ea7e34334ee 100644
--- a/gcc/tree-pass.h
+++ b/gcc/tree-pass.h
@@ -72,7 +72,9 @@ enum tree_dump_index
#define TDF_DIAGNOSTIC (1 << 15) /* A dump to be put in a diagnostic
message. */
#define TDF_VERBOSE (1 << 16) /* A dump that uses the full tree
- dumper to print stmts. */
+ dumper to print stmts. */
+#define TDF_RHS_ONLY (1 << 17) /* a flag to only print the RHS of
+ a gimple stmt. */
extern char *get_dump_file_name (enum tree_dump_index);
extern int dump_enabled_p (enum tree_dump_index);
@@ -102,7 +104,8 @@ struct opt_pass
SIMPLE_IPA_PASS,
IPA_PASS
} type;
- /* Terse name of the pass used as a fragment of the dump file name. */
+ /* Terse name of the pass used as a fragment of the dump file
+ name. If the name starts with a star, no dump happens. */
const char *name;
/* If non-null, this pass and all sub-passes are executed only if
@@ -504,7 +507,6 @@ extern struct rtl_opt_pass pass_final;
extern struct rtl_opt_pass pass_rtl_seqabstr;
extern struct gimple_opt_pass pass_release_ssa_names;
extern struct gimple_opt_pass pass_early_inline;
-extern struct gimple_opt_pass pass_O0_always_inline;
extern struct gimple_opt_pass pass_inline_parameters;
extern struct gimple_opt_pass pass_all_early_optimizations;
extern struct gimple_opt_pass pass_update_address_taken;
diff --git a/gcc/tree-phinodes.c b/gcc/tree-phinodes.c
index 9d20b0e64c9..511e84bf9b9 100644
--- a/gcc/tree-phinodes.c
+++ b/gcc/tree-phinodes.c
@@ -28,6 +28,7 @@ along with GCC; see the file COPYING3. If not see
#include "basic-block.h"
#include "tree-flow.h"
#include "toplev.h"
+#include "gimple.h"
/* Rewriting a function into SSA form can create a huge number of PHIs
many of which may be thrown away shortly after their creation if jumps
@@ -76,11 +77,10 @@ along with GCC; see the file COPYING3. If not see
the -2 on all the calculations below. */
#define NUM_BUCKETS 10
-static GTY ((deletable (""))) tree free_phinodes[NUM_BUCKETS - 2];
+static GTY ((deletable (""))) VEC(gimple,gc) *free_phinodes[NUM_BUCKETS - 2];
static unsigned long free_phinode_count;
static int ideal_phi_node_len (int);
-static void resize_phi_node (tree *, int);
#ifdef GATHER_STATISTICS
unsigned int phi_nodes_reused;
@@ -126,13 +126,13 @@ phinodes_print_statistics (void)
happens to contain a PHI node with LEN arguments or more, return
that one. */
-static inline tree
-allocate_phi_node (int len)
+static inline gimple
+allocate_phi_node (size_t len)
{
- tree phi;
- int bucket = NUM_BUCKETS - 2;
- int size = (sizeof (struct tree_phi_node)
- + (len - 1) * sizeof (struct phi_arg_d));
+ gimple phi;
+ size_t bucket = NUM_BUCKETS - 2;
+ size_t size = sizeof (struct gimple_statement_phi)
+ + (len - 1) * sizeof (struct phi_arg_d);
if (free_phinode_count)
for (bucket = len - 2; bucket < NUM_BUCKETS - 2; bucket++)
@@ -141,22 +141,27 @@ allocate_phi_node (int len)
/* If our free list has an element, then use it. */
if (bucket < NUM_BUCKETS - 2
- && PHI_ARG_CAPACITY (free_phinodes[bucket]) >= len)
+ && gimple_phi_capacity (VEC_index (gimple, free_phinodes[bucket], 0))
+ >= len)
{
free_phinode_count--;
- phi = free_phinodes[bucket];
- free_phinodes[bucket] = PHI_CHAIN (free_phinodes[bucket]);
+ phi = VEC_pop (gimple, free_phinodes[bucket]);
+ if (VEC_empty (gimple, free_phinodes[bucket]))
+ VEC_free (gimple, gc, free_phinodes[bucket]);
#ifdef GATHER_STATISTICS
phi_nodes_reused++;
#endif
}
else
{
- phi = (tree) ggc_alloc (size);
+ phi = (gimple) ggc_alloc (size);
#ifdef GATHER_STATISTICS
phi_nodes_created++;
- tree_node_counts[(int) phi_kind]++;
- tree_node_sizes[(int) phi_kind] += size;
+ {
+ enum gimple_alloc_kind kind = gimple_alloc_kind (GIMPLE_PHI);
+ gimple_alloc_counts[(int) kind]++;
+ gimple_alloc_sizes[(int) kind] += size;
+ }
#endif
}
@@ -184,7 +189,8 @@ ideal_phi_node_len (int len)
len = 2;
/* Compute the number of bytes of the original request. */
- size = sizeof (struct tree_phi_node) + (len - 1) * sizeof (struct phi_arg_d);
+ size = sizeof (struct gimple_statement_phi)
+ + (len - 1) * sizeof (struct phi_arg_d);
/* Round it up to the next power of two. */
log2 = ceil_log2 (size);
@@ -199,10 +205,10 @@ ideal_phi_node_len (int len)
/* Return a PHI node with LEN argument slots for variable VAR. */
-static tree
+static gimple
make_phi_node (tree var, int len)
{
- tree phi;
+ gimple phi;
int capacity, i;
capacity = ideal_phi_node_len (len);
@@ -212,24 +218,25 @@ make_phi_node (tree var, int len)
/* We need to clear the entire PHI node, including the argument
portion, because we represent a "missing PHI argument" by placing
NULL_TREE in PHI_ARG_DEF. */
- memset (phi, 0, (sizeof (struct tree_phi_node) - sizeof (struct phi_arg_d)
+ memset (phi, 0, (sizeof (struct gimple_statement_phi)
+ - sizeof (struct phi_arg_d)
+ sizeof (struct phi_arg_d) * len));
- TREE_SET_CODE (phi, PHI_NODE);
- PHI_NUM_ARGS (phi) = len;
- PHI_ARG_CAPACITY (phi) = capacity;
+ phi->gsbase.code = GIMPLE_PHI;
+ phi->gimple_phi.nargs = len;
+ phi->gimple_phi.capacity = capacity;
if (TREE_CODE (var) == SSA_NAME)
- SET_PHI_RESULT (phi, var);
+ gimple_phi_set_result (phi, var);
else
- SET_PHI_RESULT (phi, make_ssa_name (var, phi));
+ gimple_phi_set_result (phi, make_ssa_name (var, phi));
for (i = 0; i < capacity; i++)
{
use_operand_p imm;
- imm = &(PHI_ARG_IMM_USE_NODE (phi, i));
- imm->use = &(PHI_ARG_DEF_TREE (phi, i));
+ imm = gimple_phi_arg_imm_use_ptr (phi, i);
+ imm->use = gimple_phi_arg_def_ptr (phi, i);
imm->prev = NULL;
imm->next = NULL;
- imm->stmt = phi;
+ imm->loc.stmt = phi;
}
return phi;
@@ -238,66 +245,66 @@ make_phi_node (tree var, int len)
/* We no longer need PHI, release it so that it may be reused. */
void
-release_phi_node (tree phi)
+release_phi_node (gimple phi)
{
- int bucket;
- int len = PHI_ARG_CAPACITY (phi);
- int x;
+ size_t bucket;
+ size_t len = gimple_phi_capacity (phi);
+ size_t x;
- for (x = 0; x < PHI_NUM_ARGS (phi); x++)
+ for (x = 0; x < gimple_phi_num_args (phi); x++)
{
use_operand_p imm;
- imm = &(PHI_ARG_IMM_USE_NODE (phi, x));
+ imm = gimple_phi_arg_imm_use_ptr (phi, x);
delink_imm_use (imm);
}
bucket = len > NUM_BUCKETS - 1 ? NUM_BUCKETS - 1 : len;
bucket -= 2;
- PHI_CHAIN (phi) = free_phinodes[bucket];
- free_phinodes[bucket] = phi;
+ VEC_safe_push (gimple, gc, free_phinodes[bucket], phi);
free_phinode_count++;
}
+
/* Resize an existing PHI node. The only way is up. Return the
possibly relocated phi. */
static void
-resize_phi_node (tree *phi, int len)
+resize_phi_node (gimple *phi, size_t len)
{
- int old_size, i;
- tree new_phi;
+ size_t old_size, i;
+ gimple new_phi;
- gcc_assert (len > PHI_ARG_CAPACITY (*phi));
+ gcc_assert (len > gimple_phi_capacity (*phi));
/* The garbage collector will not look at the PHI node beyond the
first PHI_NUM_ARGS elements. Therefore, all we have to copy is a
portion of the PHI node currently in use. */
- old_size = (sizeof (struct tree_phi_node)
- + (PHI_NUM_ARGS (*phi) - 1) * sizeof (struct phi_arg_d));
+ old_size = sizeof (struct gimple_statement_phi)
+ + (gimple_phi_num_args (*phi) - 1) * sizeof (struct phi_arg_d);
new_phi = allocate_phi_node (len);
memcpy (new_phi, *phi, old_size);
- for (i = 0; i < PHI_NUM_ARGS (new_phi); i++)
+ for (i = 0; i < gimple_phi_num_args (new_phi); i++)
{
use_operand_p imm, old_imm;
- imm = &(PHI_ARG_IMM_USE_NODE (new_phi, i));
- old_imm = &(PHI_ARG_IMM_USE_NODE (*phi, i));
- imm->use = &(PHI_ARG_DEF_TREE (new_phi, i));
+ imm = gimple_phi_arg_imm_use_ptr (new_phi, i);
+ old_imm = gimple_phi_arg_imm_use_ptr (*phi, i);
+ imm->use = gimple_phi_arg_def_ptr (new_phi, i);
relink_imm_use_stmt (imm, old_imm, new_phi);
}
- PHI_ARG_CAPACITY (new_phi) = len;
+ new_phi->gimple_phi.capacity = len;
- for (i = PHI_NUM_ARGS (new_phi); i < len; i++)
+ for (i = gimple_phi_num_args (new_phi); i < len; i++)
{
use_operand_p imm;
- imm = &(PHI_ARG_IMM_USE_NODE (new_phi, i));
- imm->use = &(PHI_ARG_DEF_TREE (new_phi, i));
+ imm = gimple_phi_arg_imm_use_ptr (new_phi, i);
+ imm->use = gimple_phi_arg_def_ptr (new_phi, i);
imm->prev = NULL;
imm->next = NULL;
- imm->stmt = new_phi;
+ imm->loc.stmt = new_phi;
}
*phi = new_phi;
@@ -308,22 +315,22 @@ resize_phi_node (tree *phi, int len)
void
reserve_phi_args_for_new_edge (basic_block bb)
{
- tree *loc;
- int len = EDGE_COUNT (bb->preds);
- int cap = ideal_phi_node_len (len + 4);
+ size_t len = EDGE_COUNT (bb->preds);
+ size_t cap = ideal_phi_node_len (len + 4);
+ gimple_stmt_iterator gsi;
- for (loc = phi_nodes_ptr (bb);
- *loc;
- loc = &PHI_CHAIN (*loc))
+ for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- if (len > PHI_ARG_CAPACITY (*loc))
+ gimple *loc = gsi_stmt_ptr (&gsi);
+
+ if (len > gimple_phi_capacity (*loc))
{
- tree old_phi = *loc;
+ gimple old_phi = *loc;
resize_phi_node (loc, cap);
- /* The result of the phi is defined by this phi node. */
- SSA_NAME_DEF_STMT (PHI_RESULT (*loc)) = *loc;
+ /* The result of the PHI is defined by this PHI node. */
+ SSA_NAME_DEF_STMT (gimple_phi_result (*loc)) = *loc;
release_phi_node (old_phi);
}
@@ -337,26 +344,28 @@ reserve_phi_args_for_new_edge (basic_block bb)
batch. */
SET_PHI_ARG_DEF (*loc, len - 1, NULL_TREE);
- PHI_NUM_ARGS (*loc)++;
+ (*loc)->gimple_phi.nargs++;
}
}
/* Create a new PHI node for variable VAR at basic block BB. */
-tree
+gimple
create_phi_node (tree var, basic_block bb)
{
- tree phi;
-
- phi = make_phi_node (var, EDGE_COUNT (bb->preds));
+ gimple_stmt_iterator gsi;
+ gimple phi = make_phi_node (var, EDGE_COUNT (bb->preds));
/* Add the new PHI node to the list of PHI nodes for block BB. */
- PHI_CHAIN (phi) = phi_nodes (bb);
- set_phi_nodes (bb, phi);
+ if (phi_nodes (bb) == NULL)
+ set_phi_nodes (bb, gimple_seq_alloc ());
+
+ gsi = gsi_last (phi_nodes (bb));
+ gsi_insert_after (&gsi, phi, GSI_NEW_STMT);
/* Associate BB to the PHI node. */
- set_bb_for_stmt (phi, bb);
+ gimple_set_bb (phi, bb);
return phi;
}
@@ -369,19 +378,19 @@ create_phi_node (tree var, basic_block bb)
PHI points to the reallocated phi node when we return. */
void
-add_phi_arg (tree phi, tree def, edge e)
+add_phi_arg (gimple phi, tree def, edge e)
{
basic_block bb = e->dest;
- gcc_assert (bb == bb_for_stmt (phi));
+ gcc_assert (bb == gimple_bb (phi));
/* We resize PHI nodes upon edge creation. We should always have
enough room at this point. */
- gcc_assert (PHI_NUM_ARGS (phi) <= PHI_ARG_CAPACITY (phi));
+ gcc_assert (gimple_phi_num_args (phi) <= gimple_phi_capacity (phi));
/* We resize PHI nodes upon edge creation. We should always have
enough room at this point. */
- gcc_assert (e->dest_idx < (unsigned int) PHI_NUM_ARGS (phi));
+ gcc_assert (e->dest_idx < gimple_phi_num_args (phi));
/* Copy propagation needs to know what object occur in abnormal
PHI nodes. This is a convenient place to record such information. */
@@ -401,22 +410,22 @@ add_phi_arg (tree phi, tree def, edge e)
is consistent with how we remove an edge from the edge vector. */
static void
-remove_phi_arg_num (tree phi, int i)
+remove_phi_arg_num (gimple phi, int i)
{
- int num_elem = PHI_NUM_ARGS (phi);
+ int num_elem = gimple_phi_num_args (phi);
gcc_assert (i < num_elem);
/* Delink the item which is being removed. */
- delink_imm_use (&(PHI_ARG_IMM_USE_NODE (phi, i)));
+ delink_imm_use (gimple_phi_arg_imm_use_ptr (phi, i));
/* If it is not the last element, move the last element
to the element we want to delete, resetting all the links. */
if (i != num_elem - 1)
{
use_operand_p old_p, new_p;
- old_p = &PHI_ARG_IMM_USE_NODE (phi, num_elem - 1);
- new_p = &PHI_ARG_IMM_USE_NODE (phi, i);
+ old_p = gimple_phi_arg_imm_use_ptr (phi, num_elem - 1);
+ new_p = gimple_phi_arg_imm_use_ptr (phi, i);
/* Set use on new node, and link into last element's place. */
*(new_p->use) = *(old_p->use);
relink_imm_use (new_p, old_p);
@@ -425,7 +434,7 @@ remove_phi_arg_num (tree phi, int i)
/* Shrink the vector and return. Note that we do not have to clear
PHI_ARG_DEF because the garbage collector will not look at those
elements beyond the first PHI_NUM_ARGS elements of the array. */
- PHI_NUM_ARGS (phi)--;
+ phi->gimple_phi.nargs--;
}
@@ -434,60 +443,29 @@ remove_phi_arg_num (tree phi, int i)
void
remove_phi_args (edge e)
{
- tree phi;
+ gimple_stmt_iterator gsi;
- for (phi = phi_nodes (e->dest); phi; phi = PHI_CHAIN (phi))
- remove_phi_arg_num (phi, e->dest_idx);
+ for (gsi = gsi_start_phis (e->dest); !gsi_end_p (gsi); gsi_next (&gsi))
+ remove_phi_arg_num (gsi_stmt (gsi), e->dest_idx);
}
-/* Remove PHI node PHI from basic block BB. If PREV is non-NULL, it is
- used as the node immediately before PHI in the linked list. If
- RELEASE_LHS_P is true, the LHS of this PHI node is released into
- the free pool of SSA names. */
+/* Remove the PHI node pointed-to by iterator GSI from basic block BB. After
+ removal, iterator GSI is updated to point to the next PHI node in the
+ sequence. If RELEASE_LHS_P is true, the LHS of this PHI node is released
+ into the free pool of SSA names. */
void
-remove_phi_node (tree phi, tree prev, bool release_lhs_p)
+remove_phi_node (gimple_stmt_iterator *gsi, bool release_lhs_p)
{
- tree *loc;
-
- if (prev)
- {
- loc = &PHI_CHAIN (prev);
- }
- else
- {
- for (loc = phi_nodes_ptr (bb_for_stmt (phi));
- *loc != phi;
- loc = &PHI_CHAIN (*loc))
- ;
- }
-
- /* Remove PHI from the chain. */
- *loc = PHI_CHAIN (phi);
+ gimple phi = gsi_stmt (*gsi);
+ gsi_remove (gsi, false);
/* If we are deleting the PHI node, then we should release the
SSA_NAME node so that it can be reused. */
release_phi_node (phi);
if (release_lhs_p)
- release_ssa_name (PHI_RESULT (phi));
-}
-
-
-/* Reverse the order of PHI nodes in the chain PHI.
- Return the new head of the chain (old last PHI node). */
-
-tree
-phi_reverse (tree phi)
-{
- tree prev = NULL_TREE, next;
- for (; phi; phi = next)
- {
- next = PHI_CHAIN (phi);
- PHI_CHAIN (phi) = prev;
- prev = phi;
- }
- return prev;
+ release_ssa_name (gimple_phi_result (phi));
}
#include "gt-tree-phinodes.h"
diff --git a/gcc/tree-predcom.c b/gcc/tree-predcom.c
index 32d7fbe00ca..e26149fd1b4 100644
--- a/gcc/tree-predcom.c
+++ b/gcc/tree-predcom.c
@@ -207,7 +207,8 @@ along with GCC; see the file COPYING3. If not see
#define MAX_DISTANCE (target_avail_regs < 16 ? 4 : 8)
-/* Data references. */
+/* Data references (or phi nodes that carry data reference values across
+ loop iterations). */
typedef struct dref
{
@@ -215,7 +216,12 @@ typedef struct dref
struct data_reference *ref;
/* The statement in that the reference appears. */
- tree stmt;
+ gimple stmt;
+
+ /* In case that STMT is a phi node, this field is set to the SSA name
+ defined by it in replace_phis_by_defined_names (in order to avoid
+ pointing to phi node that got reallocated in the meantime). */
+ tree name_defined_by_phi;
/* Distance of the reference from the root of the chain (in number of
iterations of the loop). */
@@ -261,7 +267,7 @@ typedef struct chain
/* For combination chains, the operator and the two chains that are
combined, and the type of the result. */
- enum tree_code operator;
+ enum tree_code op;
tree rslt_type;
struct chain *ch1, *ch2;
@@ -349,12 +355,12 @@ dump_dref (FILE *file, dref ref)
}
else
{
- if (TREE_CODE (ref->stmt) == PHI_NODE)
+ if (gimple_code (ref->stmt) == GIMPLE_PHI)
fprintf (file, " looparound ref\n");
else
fprintf (file, " combination ref\n");
fprintf (file, " in statement ");
- print_generic_expr (file, ref->stmt, TDF_SLIM);
+ print_gimple_stmt (file, ref->stmt, 0, TDF_SLIM);
fprintf (file, "\n");
fprintf (file, " distance %u\n", ref->distance);
}
@@ -403,7 +409,7 @@ dump_chain (FILE *file, chain_p chain)
if (chain->type == CT_COMBINATION)
{
fprintf (file, " equal to %p %s %p in type ",
- (void *) chain->ch1, op_symbol_code (chain->operator),
+ (void *) chain->ch1, op_symbol_code (chain->op),
(void *) chain->ch2);
print_generic_expr (file, chain->rslt_type, TDF_SLIM);
fprintf (file, "\n");
@@ -777,7 +783,7 @@ split_data_refs_to_components (struct loop *loop,
dataref->always_accessed
= dominated_by_p (CDI_DOMINATORS, last_always_executed,
- bb_for_stmt (dataref->stmt));
+ gimple_bb (dataref->stmt));
dataref->pos = VEC_length (dref, comp->refs);
VEC_quick_push (dref, comp->refs, dataref);
}
@@ -813,7 +819,7 @@ suitable_component_p (struct loop *loop, struct component *comp)
for (i = 0; VEC_iterate (dref, comp->refs, i, a); i++)
{
- ba = bb_for_stmt (a->stmt);
+ ba = gimple_bb (a->stmt);
if (!just_once_each_iteration_p (loop, ba))
return false;
@@ -989,12 +995,12 @@ name_for_ref (dref ref)
{
tree name;
- if (TREE_CODE (ref->stmt) == GIMPLE_MODIFY_STMT)
+ if (is_gimple_assign (ref->stmt))
{
if (!ref->ref || DR_IS_READ (ref->ref))
- name = GIMPLE_STMT_OPERAND (ref->stmt, 0);
+ name = gimple_assign_lhs (ref->stmt);
else
- name = GIMPLE_STMT_OPERAND (ref->stmt, 1);
+ name = gimple_assign_rhs1 (ref->stmt);
}
else
name = PHI_RESULT (ref->stmt);
@@ -1052,44 +1058,49 @@ valid_initializer_p (struct data_reference *ref,
iteration), returns the phi node. Otherwise, NULL_TREE is returned. ROOT
is the root of the current chain. */
-static tree
+static gimple
find_looparound_phi (struct loop *loop, dref ref, dref root)
{
- tree name, phi, init, init_stmt, init_ref;
+ tree name, init, init_ref;
+ gimple phi = NULL, init_stmt;
edge latch = loop_latch_edge (loop);
struct data_reference init_dr;
+ gimple_stmt_iterator psi;
- if (TREE_CODE (ref->stmt) == GIMPLE_MODIFY_STMT)
+ if (is_gimple_assign (ref->stmt))
{
if (DR_IS_READ (ref->ref))
- name = GIMPLE_STMT_OPERAND (ref->stmt, 0);
+ name = gimple_assign_lhs (ref->stmt);
else
- name = GIMPLE_STMT_OPERAND (ref->stmt, 1);
+ name = gimple_assign_rhs1 (ref->stmt);
}
else
name = PHI_RESULT (ref->stmt);
if (!name)
- return NULL_TREE;
+ return NULL;
- for (phi = phi_nodes (loop->header); phi; phi = PHI_CHAIN (phi))
- if (PHI_ARG_DEF_FROM_EDGE (phi, latch) == name)
- break;
+ for (psi = gsi_start_phis (loop->header); !gsi_end_p (psi); gsi_next (&psi))
+ {
+ phi = gsi_stmt (psi);
+ if (PHI_ARG_DEF_FROM_EDGE (phi, latch) == name)
+ break;
+ }
- if (!phi)
- return NULL_TREE;
+ if (gsi_end_p (psi))
+ return NULL;
init = PHI_ARG_DEF_FROM_EDGE (phi, loop_preheader_edge (loop));
if (TREE_CODE (init) != SSA_NAME)
- return NULL_TREE;
+ return NULL;
init_stmt = SSA_NAME_DEF_STMT (init);
- if (TREE_CODE (init_stmt) != GIMPLE_MODIFY_STMT)
- return NULL_TREE;
- gcc_assert (GIMPLE_STMT_OPERAND (init_stmt, 0) == init);
+ if (gimple_code (init_stmt) != GIMPLE_ASSIGN)
+ return NULL;
+ gcc_assert (gimple_assign_lhs (init_stmt) == init);
- init_ref = GIMPLE_STMT_OPERAND (init_stmt, 1);
+ init_ref = gimple_assign_rhs1 (init_stmt);
if (!REFERENCE_CLASS_P (init_ref)
&& !DECL_P (init_ref))
- return NULL_TREE;
+ return NULL;
/* Analyze the behavior of INIT_REF with respect to LOOP (innermost
loop enclosing PHI). */
@@ -1099,7 +1110,7 @@ find_looparound_phi (struct loop *loop, dref ref, dref root)
dr_analyze_innermost (&init_dr);
if (!valid_initializer_p (&init_dr, ref->distance + 1, root->ref))
- return NULL_TREE;
+ return NULL;
return phi;
}
@@ -1107,7 +1118,7 @@ find_looparound_phi (struct loop *loop, dref ref, dref root)
/* Adds a reference for the looparound copy of REF in PHI to CHAIN. */
static void
-insert_looparound_copy (chain_p chain, dref ref, tree phi)
+insert_looparound_copy (chain_p chain, dref ref, gimple phi)
{
dref nw = XCNEW (struct dref), aref;
unsigned i;
@@ -1138,7 +1149,7 @@ add_looparound_copies (struct loop *loop, chain_p chain)
{
unsigned i;
dref ref, root = get_chain_root (chain);
- tree phi;
+ gimple phi;
for (i = 0; VEC_iterate (dref, chain->refs, i, ref); i++)
{
@@ -1213,74 +1224,90 @@ determine_roots (struct loop *loop,
}
/* Replace the reference in statement STMT with temporary variable
- NEW. If SET is true, NEW is instead initialized to the value of
+ NEW_TREE. If SET is true, NEW_TREE is instead initialized to the value of
the reference in the statement. IN_LHS is true if the reference
is in the lhs of STMT, false if it is in rhs. */
static void
-replace_ref_with (tree stmt, tree new, bool set, bool in_lhs)
+replace_ref_with (gimple stmt, tree new_tree, bool set, bool in_lhs)
{
- tree val, new_stmt;
- block_stmt_iterator bsi;
+ tree val;
+ gimple new_stmt;
+ gimple_stmt_iterator bsi, psi;
- if (TREE_CODE (stmt) == PHI_NODE)
+ if (gimple_code (stmt) == GIMPLE_PHI)
{
gcc_assert (!in_lhs && !set);
val = PHI_RESULT (stmt);
- bsi = bsi_after_labels (bb_for_stmt (stmt));
- remove_phi_node (stmt, NULL_TREE, false);
+ bsi = gsi_after_labels (gimple_bb (stmt));
+ psi = gsi_for_stmt (stmt);
+ remove_phi_node (&psi, false);
- /* Turn the phi node into GIMPLE_MODIFY_STMT. */
- new_stmt = build_gimple_modify_stmt (val, new);
- SSA_NAME_DEF_STMT (val) = new_stmt;
- bsi_insert_before (&bsi, new_stmt, BSI_NEW_STMT);
+ /* Turn the phi node into GIMPLE_ASSIGN. */
+ new_stmt = gimple_build_assign (val, new_tree);
+ gsi_insert_before (&bsi, new_stmt, GSI_NEW_STMT);
return;
}
/* Since the reference is of gimple_reg type, it should only
appear as lhs or rhs of modify statement. */
- gcc_assert (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT);
+ gcc_assert (is_gimple_assign (stmt));
- /* If we do not need to initialize NEW, just replace the use of OLD. */
+ bsi = gsi_for_stmt (stmt);
+
+ /* If we do not need to initialize NEW_TREE, just replace the use of OLD. */
if (!set)
{
gcc_assert (!in_lhs);
- GIMPLE_STMT_OPERAND (stmt, 1) = new;
+ gimple_assign_set_rhs_from_tree (&bsi, new_tree);
+ stmt = gsi_stmt (bsi);
update_stmt (stmt);
return;
}
- bsi = bsi_for_stmt (stmt);
if (in_lhs)
{
- val = GIMPLE_STMT_OPERAND (stmt, 1);
+ /* We have statement
+
+ OLD = VAL
- /* OLD = VAL
-
- is transformed to
+ If OLD is a memory reference, then VAL is gimple_val, and we transform
+ this to
OLD = VAL
NEW = VAL
- (since the reference is of gimple_reg type, VAL is either gimple
- invariant or ssa name). */
+ Otherwise, we are replacing a combination chain,
+ VAL is the expression that performs the combination, and OLD is an
+ SSA name. In this case, we transform the assignment to
+
+ OLD = VAL
+ NEW = OLD
+
+ */
+
+ val = gimple_assign_lhs (stmt);
+ if (TREE_CODE (val) != SSA_NAME)
+ {
+ gcc_assert (gimple_assign_copy_p (stmt));
+ val = gimple_assign_rhs1 (stmt);
+ }
}
else
{
- val = GIMPLE_STMT_OPERAND (stmt, 0);
-
/* VAL = OLD
is transformed to
VAL = OLD
NEW = VAL */
+
+ val = gimple_assign_lhs (stmt);
}
- new_stmt = build_gimple_modify_stmt (new, unshare_expr (val));
- bsi_insert_after (&bsi, new_stmt, BSI_NEW_STMT);
- SSA_NAME_DEF_STMT (new) = new_stmt;
+ new_stmt = gimple_build_assign (new_tree, unshare_expr (val));
+ gsi_insert_after (&bsi, new_stmt, GSI_NEW_STMT);
}
/* Returns the reference to the address of REF in the ITER-th iteration of
@@ -1379,7 +1406,7 @@ get_init_expr (chain_p chain, unsigned index)
tree e1 = get_init_expr (chain->ch1, index);
tree e2 = get_init_expr (chain->ch2, index);
- return fold_build2 (chain->operator, chain->rslt_type, e1, e2);
+ return fold_build2 (chain->op, chain->rslt_type, e1, e2);
}
else
return VEC_index (tree, chain->inits, index);
@@ -1388,12 +1415,12 @@ get_init_expr (chain_p chain, unsigned index)
/* Marks all virtual operands of statement STMT for renaming. */
void
-mark_virtual_ops_for_renaming (tree stmt)
+mark_virtual_ops_for_renaming (gimple stmt)
{
ssa_op_iter iter;
tree var;
- if (TREE_CODE (stmt) == PHI_NODE)
+ if (gimple_code (stmt) == GIMPLE_PHI)
{
var = PHI_RESULT (stmt);
if (is_gimple_reg (var))
@@ -1418,12 +1445,12 @@ mark_virtual_ops_for_renaming (tree stmt)
/* Calls mark_virtual_ops_for_renaming for all members of LIST. */
static void
-mark_virtual_ops_for_renaming_list (tree list)
+mark_virtual_ops_for_renaming_list (gimple_seq list)
{
- tree_stmt_iterator tsi;
+ gimple_stmt_iterator gsi;
- for (tsi = tsi_start (list); !tsi_end_p (tsi); tsi_next (&tsi))
- mark_virtual_ops_for_renaming (tsi_stmt (tsi));
+ for (gsi = gsi_start (list); !gsi_end_p (gsi); gsi_next (&gsi))
+ mark_virtual_ops_for_renaming (gsi_stmt (gsi));
}
/* Returns a new temporary variable used for the I-th variable carrying
@@ -1457,8 +1484,9 @@ initialize_root_vars (struct loop *loop, chain_p chain, bitmap tmp_vars)
unsigned n = chain->length;
dref root = get_chain_root (chain);
bool reuse_first = !chain->has_max_use_after;
- tree ref, init, var, next, stmts;
- tree phi;
+ tree ref, init, var, next;
+ gimple phi;
+ gimple_seq stmts;
edge entry = loop_preheader_edge (loop), latch = loop_latch_edge (loop);
/* If N == 0, then all the references are within the single iteration. And
@@ -1468,7 +1496,7 @@ initialize_root_vars (struct loop *loop, chain_p chain, bitmap tmp_vars)
chain->vars = VEC_alloc (tree, heap, n + 1);
if (chain->type == CT_COMBINATION)
- ref = GIMPLE_STMT_OPERAND (root->stmt, 0);
+ ref = gimple_assign_lhs (root->stmt);
else
ref = DR_REF (root->ref);
@@ -1481,7 +1509,7 @@ initialize_root_vars (struct loop *loop, chain_p chain, bitmap tmp_vars)
VEC_quick_push (tree, chain->vars, VEC_index (tree, chain->vars, 0));
for (i = 0; VEC_iterate (tree, chain->vars, i, var); i++)
- VEC_replace (tree, chain->vars, i, make_ssa_name (var, NULL_TREE));
+ VEC_replace (tree, chain->vars, i, make_ssa_name (var, NULL));
for (i = 0; i < n; i++)
{
@@ -1493,7 +1521,7 @@ initialize_root_vars (struct loop *loop, chain_p chain, bitmap tmp_vars)
if (stmts)
{
mark_virtual_ops_for_renaming_list (stmts);
- bsi_insert_on_edge_immediate (entry, stmts);
+ gsi_insert_seq_on_edge_immediate (entry, stmts);
}
phi = create_phi_node (var, loop->header);
@@ -1533,8 +1561,9 @@ initialize_root_vars_lm (struct loop *loop, dref root, bool written,
bitmap tmp_vars)
{
unsigned i;
- tree ref = DR_REF (root->ref), init, var, next, stmts;
- tree phi;
+ tree ref = DR_REF (root->ref), init, var, next;
+ gimple_seq stmts;
+ gimple phi;
edge entry = loop_preheader_edge (loop), latch = loop_latch_edge (loop);
/* Find the initializer for the variable, and check that it cannot
@@ -1548,7 +1577,7 @@ initialize_root_vars_lm (struct loop *loop, dref root, bool written,
VEC_quick_push (tree, *vars, VEC_index (tree, *vars, 0));
for (i = 0; VEC_iterate (tree, *vars, i, var); i++)
- VEC_replace (tree, *vars, i, make_ssa_name (var, NULL_TREE));
+ VEC_replace (tree, *vars, i, make_ssa_name (var, NULL));
var = VEC_index (tree, *vars, 0);
@@ -1556,7 +1585,7 @@ initialize_root_vars_lm (struct loop *loop, dref root, bool written,
if (stmts)
{
mark_virtual_ops_for_renaming_list (stmts);
- bsi_insert_on_edge_immediate (entry, stmts);
+ gsi_insert_seq_on_edge_immediate (entry, stmts);
}
if (written)
@@ -1569,10 +1598,9 @@ initialize_root_vars_lm (struct loop *loop, dref root, bool written,
}
else
{
- init = build_gimple_modify_stmt (var, init);
- SSA_NAME_DEF_STMT (var) = init;
- mark_virtual_ops_for_renaming (init);
- bsi_insert_on_edge_immediate (entry, init);
+ gimple init_stmt = gimple_build_assign (var, init);
+ mark_virtual_ops_for_renaming (init_stmt);
+ gsi_insert_on_edge_immediate (entry, init_stmt);
}
}
@@ -1613,7 +1641,7 @@ execute_load_motion (struct loop *loop, chain_p chain, bitmap tmp_vars)
if (n_writes)
{
var = VEC_index (tree, vars, 0);
- var = make_ssa_name (SSA_NAME_VAR (var), NULL_TREE);
+ var = make_ssa_name (SSA_NAME_VAR (var), NULL);
VEC_replace (tree, vars, 0, var);
}
else
@@ -1629,20 +1657,20 @@ execute_load_motion (struct loop *loop, chain_p chain, bitmap tmp_vars)
/* Returns the single statement in that NAME is used, excepting
the looparound phi nodes contained in one of the chains. If there is no
- such statement, or more statements, NULL_TREE is returned. */
+ such statement, or more statements, NULL is returned. */
-static tree
+static gimple
single_nonlooparound_use (tree name)
{
use_operand_p use;
imm_use_iterator it;
- tree stmt, ret = NULL_TREE;
+ gimple stmt, ret = NULL;
FOR_EACH_IMM_USE_FAST (use, it, name)
{
stmt = USE_STMT (use);
- if (TREE_CODE (stmt) == PHI_NODE)
+ if (gimple_code (stmt) == GIMPLE_PHI)
{
/* Ignore uses in looparound phi nodes. Uses in other phi nodes
could not be processed anyway, so just fail for them. */
@@ -1650,10 +1678,10 @@ single_nonlooparound_use (tree name)
SSA_NAME_VERSION (PHI_RESULT (stmt))))
continue;
- return NULL_TREE;
+ return NULL;
}
- else if (ret != NULL_TREE)
- return NULL_TREE;
+ else if (ret != NULL)
+ return NULL;
else
ret = stmt;
}
@@ -1665,19 +1693,22 @@ single_nonlooparound_use (tree name)
used. */
static void
-remove_stmt (tree stmt)
+remove_stmt (gimple stmt)
{
- tree next, name;
+ tree name;
+ gimple next;
+ gimple_stmt_iterator psi;
- if (TREE_CODE (stmt) == PHI_NODE)
+ if (gimple_code (stmt) == GIMPLE_PHI)
{
name = PHI_RESULT (stmt);
next = single_nonlooparound_use (name);
- remove_phi_node (stmt, NULL_TREE, true);
+ psi = gsi_for_stmt (stmt);
+ remove_phi_node (&psi, true);
if (!next
- || TREE_CODE (next) != GIMPLE_MODIFY_STMT
- || GIMPLE_STMT_OPERAND (next, 1) != name)
+ || !gimple_assign_ssa_name_copy_p (next)
+ || gimple_assign_rhs1 (next) != name)
return;
stmt = next;
@@ -1685,21 +1716,22 @@ remove_stmt (tree stmt)
while (1)
{
- block_stmt_iterator bsi;
+ gimple_stmt_iterator bsi;
- bsi = bsi_for_stmt (stmt);
+ bsi = gsi_for_stmt (stmt);
- name = GIMPLE_STMT_OPERAND (stmt, 0);
+ name = gimple_assign_lhs (stmt);
gcc_assert (TREE_CODE (name) == SSA_NAME);
next = single_nonlooparound_use (name);
mark_virtual_ops_for_renaming (stmt);
- bsi_remove (&bsi, true);
+ gsi_remove (&bsi, true);
+ release_defs (stmt);
if (!next
- || TREE_CODE (next) != GIMPLE_MODIFY_STMT
- || GIMPLE_STMT_OPERAND (next, 1) != name)
+ || !gimple_assign_ssa_name_copy_p (next)
+ || gimple_assign_rhs1 (next) != name)
return;
stmt = next;
@@ -1794,7 +1826,7 @@ execute_pred_commoning (struct loop *loop, VEC (chain_p, heap) *chains,
}
/* For each reference in CHAINS, if its defining statement is
- ssa name, set it to phi node that defines it. */
+ phi node, record the ssa name that is defined by it. */
static void
replace_phis_by_defined_names (VEC (chain_p, heap) *chains)
@@ -1806,14 +1838,16 @@ replace_phis_by_defined_names (VEC (chain_p, heap) *chains)
for (i = 0; VEC_iterate (chain_p, chains, i, chain); i++)
for (j = 0; VEC_iterate (dref, chain->refs, j, a); j++)
{
- gcc_assert (TREE_CODE (a->stmt) != SSA_NAME);
- if (TREE_CODE (a->stmt) == PHI_NODE)
- a->stmt = PHI_RESULT (a->stmt);
+ if (gimple_code (a->stmt) == GIMPLE_PHI)
+ {
+ a->name_defined_by_phi = PHI_RESULT (a->stmt);
+ a->stmt = NULL;
+ }
}
}
-/* For each reference in CHAINS, if its defining statement is
- phi node, set it to the ssa name that is defined by it. */
+/* For each reference in CHAINS, if name_defined_by_phi is not
+ NULL, use it to set the stmt field. */
static void
replace_names_by_phis (VEC (chain_p, heap) *chains)
@@ -1824,10 +1858,11 @@ replace_names_by_phis (VEC (chain_p, heap) *chains)
for (i = 0; VEC_iterate (chain_p, chains, i, chain); i++)
for (j = 0; VEC_iterate (dref, chain->refs, j, a); j++)
- if (TREE_CODE (a->stmt) == SSA_NAME)
+ if (a->stmt == NULL)
{
- a->stmt = SSA_NAME_DEF_STMT (a->stmt);
- gcc_assert (TREE_CODE (a->stmt) == PHI_NODE);
+ a->stmt = SSA_NAME_DEF_STMT (a->name_defined_by_phi);
+ gcc_assert (gimple_code (a->stmt) == GIMPLE_PHI);
+ a->name_defined_by_phi = NULL_TREE;
}
}
@@ -1896,7 +1931,7 @@ should_unroll_loop_p (struct loop *loop, unsigned factor,
static void
base_names_in_chain_on (struct loop *loop, tree name, tree var)
{
- tree stmt, phi;
+ gimple stmt, phi;
imm_use_iterator iter;
edge e;
@@ -1907,8 +1942,8 @@ base_names_in_chain_on (struct loop *loop, tree name, tree var)
phi = NULL;
FOR_EACH_IMM_USE_STMT (stmt, iter, name)
{
- if (TREE_CODE (stmt) == PHI_NODE
- && flow_bb_inside_loop_p (loop, bb_for_stmt (stmt)))
+ if (gimple_code (stmt) == GIMPLE_PHI
+ && flow_bb_inside_loop_p (loop, gimple_bb (stmt)))
{
phi = stmt;
BREAK_FROM_IMM_USE_STMT (iter);
@@ -1917,10 +1952,10 @@ base_names_in_chain_on (struct loop *loop, tree name, tree var)
if (!phi)
return;
- if (bb_for_stmt (phi) == loop->header)
+ if (gimple_bb (phi) == loop->header)
e = loop_latch_edge (loop);
else
- e = single_pred_edge (bb_for_stmt (stmt));
+ e = single_pred_edge (gimple_bb (stmt));
name = PHI_RESULT (phi);
SSA_NAME_VAR (name) = var;
@@ -1936,11 +1971,14 @@ static void
eliminate_temp_copies (struct loop *loop, bitmap tmp_vars)
{
edge e;
- tree phi, name, use, var, stmt;
+ gimple phi, stmt;
+ tree name, use, var;
+ gimple_stmt_iterator psi;
e = loop_latch_edge (loop);
- for (phi = phi_nodes (loop->header); phi; phi = PHI_CHAIN (phi))
+ for (psi = gsi_start_phis (loop->header); !gsi_end_p (psi); gsi_next (&psi))
{
+ phi = gsi_stmt (psi);
name = PHI_RESULT (phi);
var = SSA_NAME_VAR (name);
if (!bitmap_bit_p (tmp_vars, DECL_UID (var)))
@@ -1950,15 +1988,15 @@ eliminate_temp_copies (struct loop *loop, bitmap tmp_vars)
/* Base all the ssa names in the ud and du chain of NAME on VAR. */
stmt = SSA_NAME_DEF_STMT (use);
- while (TREE_CODE (stmt) == PHI_NODE
+ while (gimple_code (stmt) == GIMPLE_PHI
/* In case we could not unroll the loop enough to eliminate
all copies, we may reach the loop header before the defining
statement (in that case, some register copies will be present
in loop latch in the final code, corresponding to the newly
created looparound phi nodes). */
- && bb_for_stmt (stmt) != loop->header)
+ && gimple_bb (stmt) != loop->header)
{
- gcc_assert (single_pred_p (bb_for_stmt (stmt)));
+ gcc_assert (single_pred_p (gimple_bb (stmt)));
use = PHI_ARG_DEF (stmt, 0);
stmt = SSA_NAME_DEF_STMT (use);
}
@@ -1980,38 +2018,40 @@ chain_can_be_combined_p (chain_p chain)
statements, NAME is replaced with the actual name used in the returned
statement. */
-static tree
+static gimple
find_use_stmt (tree *name)
{
- tree stmt, rhs, lhs;
+ gimple stmt;
+ tree rhs, lhs;
/* Skip over assignments. */
while (1)
{
stmt = single_nonlooparound_use (*name);
if (!stmt)
- return NULL_TREE;
+ return NULL;
- if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
- return NULL_TREE;
+ if (gimple_code (stmt) != GIMPLE_ASSIGN)
+ return NULL;
- lhs = GIMPLE_STMT_OPERAND (stmt, 0);
+ lhs = gimple_assign_lhs (stmt);
if (TREE_CODE (lhs) != SSA_NAME)
- return NULL_TREE;
+ return NULL;
- rhs = GIMPLE_STMT_OPERAND (stmt, 1);
- if (rhs != *name)
- break;
+ if (gimple_assign_copy_p (stmt))
+ {
+ rhs = gimple_assign_rhs1 (stmt);
+ if (rhs != *name)
+ return NULL;
- *name = lhs;
+ *name = lhs;
+ }
+ else if (get_gimple_rhs_class (gimple_assign_rhs_code (stmt))
+ == GIMPLE_BINARY_RHS)
+ return stmt;
+ else
+ return NULL;
}
-
- if (!EXPR_P (rhs)
- || REFERENCE_CLASS_P (rhs)
- || TREE_CODE_LENGTH (TREE_CODE (rhs)) != 2)
- return NULL_TREE;
-
- return stmt;
}
/* Returns true if we may perform reassociation for operation CODE in TYPE. */
@@ -2031,27 +2071,26 @@ may_reassociate_p (tree type, enum tree_code code)
tree of the same operations and returns its root. Distance to the root
is stored in DISTANCE. */
-static tree
-find_associative_operation_root (tree stmt, unsigned *distance)
+static gimple
+find_associative_operation_root (gimple stmt, unsigned *distance)
{
- tree rhs = GIMPLE_STMT_OPERAND (stmt, 1), lhs, next;
- enum tree_code code = TREE_CODE (rhs);
+ tree lhs;
+ gimple next;
+ enum tree_code code = gimple_assign_rhs_code (stmt);
+ tree type = TREE_TYPE (gimple_assign_lhs (stmt));
unsigned dist = 0;
- if (!may_reassociate_p (TREE_TYPE (rhs), code))
- return NULL_TREE;
+ if (!may_reassociate_p (type, code))
+ return NULL;
while (1)
{
- lhs = GIMPLE_STMT_OPERAND (stmt, 0);
+ lhs = gimple_assign_lhs (stmt);
gcc_assert (TREE_CODE (lhs) == SSA_NAME);
next = find_use_stmt (&lhs);
- if (!next)
- break;
-
- rhs = GIMPLE_STMT_OPERAND (next, 1);
- if (TREE_CODE (rhs) != code)
+ if (!next
+ || gimple_assign_rhs_code (next) != code)
break;
stmt = next;
@@ -2069,30 +2108,30 @@ find_associative_operation_root (tree stmt, unsigned *distance)
tree formed by this operation instead of the statement that uses NAME1 or
NAME2. */
-static tree
+static gimple
find_common_use_stmt (tree *name1, tree *name2)
{
- tree stmt1, stmt2;
+ gimple stmt1, stmt2;
stmt1 = find_use_stmt (name1);
if (!stmt1)
- return NULL_TREE;
+ return NULL;
stmt2 = find_use_stmt (name2);
if (!stmt2)
- return NULL_TREE;
+ return NULL;
if (stmt1 == stmt2)
return stmt1;
stmt1 = find_associative_operation_root (stmt1, NULL);
if (!stmt1)
- return NULL_TREE;
+ return NULL;
stmt2 = find_associative_operation_root (stmt2, NULL);
if (!stmt2)
- return NULL_TREE;
+ return NULL;
- return (stmt1 == stmt2 ? stmt1 : NULL_TREE);
+ return (stmt1 == stmt2 ? stmt1 : NULL);
}
/* Checks whether R1 and R2 are combined together using CODE, with the result
@@ -2106,7 +2145,8 @@ combinable_refs_p (dref r1, dref r2,
enum tree_code acode;
bool aswap;
tree atype;
- tree name1, name2, stmt, rhs;
+ tree name1, name2;
+ gimple stmt;
name1 = name_for_ref (r1);
name2 = name_for_ref (r2);
@@ -2117,11 +2157,10 @@ combinable_refs_p (dref r1, dref r2,
if (!stmt)
return false;
- rhs = GIMPLE_STMT_OPERAND (stmt, 1);
- acode = TREE_CODE (rhs);
+ acode = gimple_assign_rhs_code (stmt);
aswap = (!commutative_tree_code (acode)
- && TREE_OPERAND (rhs, 0) != name1);
- atype = TREE_TYPE (rhs);
+ && gimple_assign_rhs1 (stmt) != name1);
+ atype = TREE_TYPE (gimple_assign_lhs (stmt));
if (*code == ERROR_MARK)
{
@@ -2140,43 +2179,49 @@ combinable_refs_p (dref r1, dref r2,
an assignment of the remaining operand. */
static void
-remove_name_from_operation (tree stmt, tree op)
+remove_name_from_operation (gimple stmt, tree op)
{
- tree *rhs;
+ tree other_op;
+ gimple_stmt_iterator si;
- gcc_assert (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT);
+ gcc_assert (is_gimple_assign (stmt));
- rhs = &GIMPLE_STMT_OPERAND (stmt, 1);
- if (TREE_OPERAND (*rhs, 0) == op)
- *rhs = TREE_OPERAND (*rhs, 1);
- else if (TREE_OPERAND (*rhs, 1) == op)
- *rhs = TREE_OPERAND (*rhs, 0);
+ if (gimple_assign_rhs1 (stmt) == op)
+ other_op = gimple_assign_rhs2 (stmt);
else
- gcc_unreachable ();
+ other_op = gimple_assign_rhs1 (stmt);
+
+ si = gsi_for_stmt (stmt);
+ gimple_assign_set_rhs_from_tree (&si, other_op);
+
+ /* We should not have reallocated STMT. */
+ gcc_assert (gsi_stmt (si) == stmt);
+
update_stmt (stmt);
}
/* Reassociates the expression in that NAME1 and NAME2 are used so that they
are combined in a single statement, and returns this statement. */
-static tree
+static gimple
reassociate_to_the_same_stmt (tree name1, tree name2)
{
- tree stmt1, stmt2, root1, root2, r1, r2, s1, s2;
- tree new_stmt, tmp_stmt, new_name, tmp_name, var;
+ gimple stmt1, stmt2, root1, root2, s1, s2;
+ gimple new_stmt, tmp_stmt;
+ tree new_name, tmp_name, var, r1, r2;
unsigned dist1, dist2;
enum tree_code code;
tree type = TREE_TYPE (name1);
- block_stmt_iterator bsi;
+ gimple_stmt_iterator bsi;
stmt1 = find_use_stmt (&name1);
stmt2 = find_use_stmt (&name2);
root1 = find_associative_operation_root (stmt1, &dist1);
root2 = find_associative_operation_root (stmt2, &dist2);
- code = TREE_CODE (GIMPLE_STMT_OPERAND (stmt1, 1));
+ code = gimple_assign_rhs_code (stmt1);
gcc_assert (root1 && root2 && root1 == root2
- && code == TREE_CODE (GIMPLE_STMT_OPERAND (stmt2, 1)));
+ && code == gimple_assign_rhs_code (stmt2));
/* Find the root of the nearest expression in that both NAME1 and NAME2
are used. */
@@ -2188,22 +2233,22 @@ reassociate_to_the_same_stmt (tree name1, tree name2)
while (dist1 > dist2)
{
s1 = find_use_stmt (&r1);
- r1 = GIMPLE_STMT_OPERAND (s1, 0);
+ r1 = gimple_assign_lhs (s1);
dist1--;
}
while (dist2 > dist1)
{
s2 = find_use_stmt (&r2);
- r2 = GIMPLE_STMT_OPERAND (s2, 0);
+ r2 = gimple_assign_lhs (s2);
dist2--;
}
while (s1 != s2)
{
s1 = find_use_stmt (&r1);
- r1 = GIMPLE_STMT_OPERAND (s1, 0);
+ r1 = gimple_assign_lhs (s1);
s2 = find_use_stmt (&r2);
- r2 = GIMPLE_STMT_OPERAND (s2, 0);
+ r2 = gimple_assign_lhs (s2);
}
/* Remove NAME1 and NAME2 from the statements in that they are used
@@ -2215,24 +2260,28 @@ reassociate_to_the_same_stmt (tree name1, tree name2)
combine it with the rhs of S1. */
var = create_tmp_var (type, "predreastmp");
add_referenced_var (var);
- new_name = make_ssa_name (var, NULL_TREE);
- new_stmt = build_gimple_modify_stmt (new_name,
- fold_build2 (code, type, name1, name2));
- SSA_NAME_DEF_STMT (new_name) = new_stmt;
+ new_name = make_ssa_name (var, NULL);
+ new_stmt = gimple_build_assign_with_ops (code, new_name, name1, name2);
var = create_tmp_var (type, "predreastmp");
add_referenced_var (var);
- tmp_name = make_ssa_name (var, NULL_TREE);
- tmp_stmt = build_gimple_modify_stmt (tmp_name,
- GIMPLE_STMT_OPERAND (s1, 1));
- SSA_NAME_DEF_STMT (tmp_name) = tmp_stmt;
-
- GIMPLE_STMT_OPERAND (s1, 1) = fold_build2 (code, type, new_name, tmp_name);
+ tmp_name = make_ssa_name (var, NULL);
+
+ /* Rhs of S1 may now be either a binary expression with operation
+ CODE, or gimple_val (in case that stmt1 == s1 or stmt2 == s1,
+ so that name1 or name2 was removed from it). */
+ tmp_stmt = gimple_build_assign_with_ops (gimple_assign_rhs_code (s1),
+ tmp_name,
+ gimple_assign_rhs1 (s1),
+ gimple_assign_rhs2 (s1));
+
+ bsi = gsi_for_stmt (s1);
+ gimple_assign_set_rhs_with_ops (&bsi, code, new_name, tmp_name);
+ s1 = gsi_stmt (bsi);
update_stmt (s1);
- bsi = bsi_for_stmt (s1);
- bsi_insert_before (&bsi, new_stmt, BSI_SAME_STMT);
- bsi_insert_before (&bsi, tmp_stmt, BSI_SAME_STMT);
+ gsi_insert_before (&bsi, new_stmt, GSI_SAME_STMT);
+ gsi_insert_before (&bsi, tmp_stmt, GSI_SAME_STMT);
return new_stmt;
}
@@ -2242,10 +2291,10 @@ reassociate_to_the_same_stmt (tree name1, tree name2)
associative and commutative operation in the same expression, reassociate
the expression so that they are used in the same statement. */
-static tree
+static gimple
stmt_combining_refs (dref r1, dref r2)
{
- tree stmt1, stmt2;
+ gimple stmt1, stmt2;
tree name1 = name_for_ref (r1);
tree name2 = name_for_ref (r2);
@@ -2268,7 +2317,7 @@ combine_chains (chain_p ch1, chain_p ch2)
bool swap = false;
chain_p new_chain;
unsigned i;
- tree root_stmt;
+ gimple root_stmt;
tree rslt_type = NULL_TREE;
if (ch1 == ch2)
@@ -2298,7 +2347,7 @@ combine_chains (chain_p ch1, chain_p ch2)
new_chain = XCNEW (struct chain);
new_chain->type = CT_COMBINATION;
- new_chain->operator = op;
+ new_chain->op = op;
new_chain->ch1 = ch1;
new_chain->ch2 = ch2;
new_chain->rslt_type = rslt_type;
@@ -2399,7 +2448,8 @@ prepare_initializers_chain (struct loop *loop, chain_p chain)
{
unsigned i, n = (chain->type == CT_INVARIANT) ? 1 : chain->length;
struct data_reference *dr = get_chain_root (chain)->ref;
- tree init, stmts;
+ tree init;
+ gimple_seq stmts;
dref laref;
edge entry = loop_preheader_edge (loop);
@@ -2413,7 +2463,7 @@ prepare_initializers_chain (struct loop *loop, chain_p chain)
instead of creating our own. */
for (i = 0; VEC_iterate (dref, chain->refs, i, laref); i++)
{
- if (TREE_CODE (laref->stmt) != PHI_NODE)
+ if (gimple_code (laref->stmt) != GIMPLE_PHI)
continue;
gcc_assert (laref->distance > 0);
@@ -2437,7 +2487,7 @@ prepare_initializers_chain (struct loop *loop, chain_p chain)
if (stmts)
{
mark_virtual_ops_for_renaming_list (stmts);
- bsi_insert_on_edge_immediate (entry, stmts);
+ gsi_insert_seq_on_edge_immediate (entry, stmts);
}
set_alias_info (init, dr);
diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c
index fce766cc61e..5708eedf3b2 100644
--- a/gcc/tree-pretty-print.c
+++ b/gcc/tree-pretty-print.c
@@ -44,11 +44,8 @@ static void pretty_print_string (pretty_printer *, const char*);
static void print_call_name (pretty_printer *, const_tree);
static void newline_and_indent (pretty_printer *, int);
static void maybe_init_pretty_print (FILE *);
-static void print_declaration (pretty_printer *, tree, int, int);
static void print_struct_decl (pretty_printer *, const_tree, int, int);
static void do_niy (pretty_printer *, const_tree);
-static void dump_vops (pretty_printer *, tree, int, int);
-static void dump_generic_bb_buff (pretty_printer *, basic_block, int, int);
#define INDENT(SPACE) do { \
int i; for (i = 0; i<SPACE; i++) pp_space (buffer); } while (0)
@@ -409,7 +406,7 @@ dump_omp_clause (pretty_printer *buffer, tree clause, int spc, int flags)
/* Dump the list of OpenMP clauses. BUFFER, SPC and FLAGS are as in
dump_generic_node. */
-static void
+void
dump_omp_clauses (pretty_printer *buffer, tree clause, int spc, int flags)
{
if (clause == NULL)
@@ -427,33 +424,6 @@ dump_omp_clauses (pretty_printer *buffer, tree clause, int spc, int flags)
}
-/* Dump the set of decls SYMS. BUFFER, SPC and FLAGS are as in
- dump_generic_node. */
-
-static void
-dump_symbols (pretty_printer *buffer, bitmap syms, int flags)
-{
- unsigned i;
- bitmap_iterator bi;
-
- if (syms == NULL)
- pp_string (buffer, "NIL");
- else
- {
- pp_string (buffer, " { ");
-
- EXECUTE_IF_SET_IN_BITMAP (syms, 0, i, bi)
- {
- tree sym = referenced_var_lookup (i);
- dump_generic_node (buffer, sym, 0, flags, false);
- pp_string (buffer, " ");
- }
-
- pp_string (buffer, "}");
- }
-}
-
-
/* Dump the node NODE on the pretty_printer BUFFER, SPC spaces of
indent. FLAGS specifies details to show in the dump (see TDF_* in
tree-pass.h). If IS_STMT is true, the object printed is considered
@@ -471,18 +441,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
if (node == NULL_TREE)
return spc;
- is_expr = EXPR_P (node) || GIMPLE_STMT_P (node);
-
- /* We use has_stmt_ann because CALL_EXPR can be both an expression
- and a statement, and we have no guarantee that it will have a
- stmt_ann when it is used as an RHS expression. stmt_ann will assert
- if you call it on something with a non-stmt annotation attached. */
- if (TREE_CODE (node) != ERROR_MARK
- && is_gimple_stmt (node)
- && (flags & (TDF_VOPS|TDF_MEMSYMS))
- && has_stmt_ann (node)
- && TREE_CODE (node) != PHI_NODE)
- dump_vops (buffer, node, spc, flags);
+ is_expr = EXPR_P (node);
if (is_stmt && (flags & TDF_STMTADDR))
pp_printf (buffer, "<&%p> ", (void *)node);
@@ -560,7 +519,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
case BOOLEAN_TYPE:
{
unsigned int quals = TYPE_QUALS (node);
- enum tree_code_class class;
+ enum tree_code_class tclass;
if (quals & TYPE_QUAL_CONST)
pp_string (buffer, "const ");
@@ -569,16 +528,16 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
else if (quals & TYPE_QUAL_RESTRICT)
pp_string (buffer, "restrict ");
- class = TREE_CODE_CLASS (TREE_CODE (node));
+ tclass = TREE_CODE_CLASS (TREE_CODE (node));
- if (class == tcc_declaration)
+ if (tclass == tcc_declaration)
{
if (DECL_NAME (node))
dump_decl_name (buffer, node, flags);
else
pp_string (buffer, "<unnamed type decl>");
}
- else if (class == tcc_type)
+ else if (tclass == tcc_type)
{
if (TYPE_NAME (node))
{
@@ -1095,24 +1054,16 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
break;
case MODIFY_EXPR:
- case GIMPLE_MODIFY_STMT:
case INIT_EXPR:
- dump_generic_node (buffer, GENERIC_TREE_OPERAND (node, 0), spc, flags,
+ dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags,
false);
pp_space (buffer);
pp_character (buffer, '=');
- if (TREE_CODE (node) == GIMPLE_MODIFY_STMT
+ if (TREE_CODE (node) == MODIFY_EXPR
&& MOVE_NONTEMPORAL (node))
pp_string (buffer, "{nt}");
- if (TREE_CODE (node) == GIMPLE_MODIFY_STMT)
- {
- stmt_ann_t ann;
- if ((ann = stmt_ann (node))
- && ann->has_volatile_ops)
- pp_string (buffer, "{v}");
- }
pp_space (buffer);
- dump_generic_node (buffer, GENERIC_TREE_OPERAND (node, 1), spc, flags,
+ dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags,
false);
break;
@@ -1622,9 +1573,8 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
if (op0)
{
pp_space (buffer);
- if (TREE_CODE (op0) == MODIFY_EXPR
- || TREE_CODE (op0) == GIMPLE_MODIFY_STMT)
- dump_generic_node (buffer, GENERIC_TREE_OPERAND (op0, 1),
+ if (TREE_CODE (op0) == MODIFY_EXPR)
+ dump_generic_node (buffer, TREE_OPERAND (op0, 1),
spc, flags, false);
else
dump_generic_node (buffer, op0, spc, flags, false);
@@ -1730,7 +1680,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
dump_generic_node (buffer, CASE_LOW (node), spc, flags, false);
}
else
- pp_string (buffer, "default ");
+ pp_string (buffer, "default");
pp_character (buffer, ':');
break;
@@ -1745,28 +1695,6 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
pp_character (buffer, ')');
break;
- case PHI_NODE:
- {
- int i;
-
- dump_generic_node (buffer, PHI_RESULT (node), spc, flags, false);
- pp_string (buffer, " = PHI <");
- for (i = 0; i < PHI_NUM_ARGS (node); i++)
- {
- dump_generic_node (buffer, PHI_ARG_DEF (node, i), spc, flags, false);
- pp_string (buffer, "(");
- pp_decimal_int (buffer, PHI_ARG_EDGE (node, i)->src->index);
- pp_string (buffer, ")");
- if (i < PHI_NUM_ARGS (node) - 1)
- pp_string (buffer, ", ");
- }
- pp_string (buffer, ">");
-
- if (stmt_references_memory_p (node) && (flags & TDF_MEMSYMS))
- dump_symbols (buffer, STORED_SYMS (node), flags);
- }
- break;
-
case SSA_NAME:
dump_generic_node (buffer, SSA_NAME_VAR (node), spc, flags, false);
pp_string (buffer, "_");
@@ -1844,21 +1772,6 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
case OMP_PARALLEL:
pp_string (buffer, "#pragma omp parallel");
dump_omp_clauses (buffer, OMP_PARALLEL_CLAUSES (node), spc, flags);
- if (OMP_PARALLEL_FN (node))
- {
- pp_string (buffer, " [child fn: ");
- dump_generic_node (buffer, OMP_PARALLEL_FN (node), spc, flags, false);
-
- pp_string (buffer, " (");
-
- if (OMP_PARALLEL_DATA_ARG (node))
- dump_generic_node (buffer, OMP_PARALLEL_DATA_ARG (node), spc, flags,
- false);
- else
- pp_string (buffer, "???");
-
- pp_string (buffer, ")]");
- }
dump_omp_body:
if (!(flags & TDF_SLIM) && OMP_BODY (node))
@@ -1876,28 +1789,6 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
case OMP_TASK:
pp_string (buffer, "#pragma omp task");
dump_omp_clauses (buffer, OMP_TASK_CLAUSES (node), spc, flags);
- if (OMP_TASK_FN (node))
- {
- pp_string (buffer, " [child fn: ");
- dump_generic_node (buffer, OMP_TASK_FN (node), spc, flags, false);
-
- pp_string (buffer, " (");
-
- if (OMP_TASK_DATA_ARG (node))
- dump_generic_node (buffer, OMP_TASK_DATA_ARG (node), spc, flags,
- false);
- else
- pp_string (buffer, "???");
-
- pp_character (buffer, ')');
- if (OMP_TASK_COPYFN (node))
- {
- pp_string (buffer, ", copy fn: ");
- dump_generic_node (buffer, OMP_TASK_COPYFN (node), spc,
- flags, false);
- }
- pp_character (buffer, ']');
- }
goto dump_omp_body;
case OMP_FOR:
@@ -1956,21 +1847,9 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
case OMP_SECTIONS:
pp_string (buffer, "#pragma omp sections");
- if (OMP_SECTIONS_CONTROL (node))
- {
- pp_string (buffer, " <");
- dump_generic_node (buffer, OMP_SECTIONS_CONTROL (node), spc,
- flags, false);
- pp_string (buffer, ">");
- }
dump_omp_clauses (buffer, OMP_SECTIONS_CLAUSES (node), spc, flags);
goto dump_omp_body;
- case OMP_SECTIONS_SWITCH:
- pp_string (buffer, "OMP_SECTIONS_SWITCH");
- is_expr = false;
- break;
-
case OMP_SECTION:
pp_string (buffer, "#pragma omp section");
goto dump_omp_body;
@@ -2005,44 +1884,11 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
break;
- case OMP_ATOMIC_LOAD:
- pp_string (buffer, "#pragma omp atomic_load");
- newline_and_indent (buffer, spc + 2);
- dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
- pp_space (buffer);
- pp_character (buffer, '=');
- pp_space (buffer);
- pp_character (buffer, '*');
- dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
- break;
-
- case OMP_ATOMIC_STORE:
- pp_string (buffer, "#pragma omp atomic_store (");
- dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
- pp_character (buffer, ')');
- break;
-
case OMP_SINGLE:
pp_string (buffer, "#pragma omp single");
dump_omp_clauses (buffer, OMP_SINGLE_CLAUSES (node), spc, flags);
goto dump_omp_body;
- case OMP_RETURN:
- pp_string (buffer, "OMP_RETURN");
- if (OMP_RETURN_NOWAIT (node))
- pp_string (buffer, " [nowait]");
- is_expr = false;
- break;
-
- case OMP_CONTINUE:
- pp_string (buffer, "OMP_CONTINUE <");
- dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
- pp_string (buffer, " <- ");
- dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
- pp_string (buffer, ">");
- is_expr = false;
- break;
-
case OMP_CLAUSE:
dump_omp_clause (buffer, node, spc, flags);
is_expr = false;
@@ -2237,7 +2083,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
/* Print the declaration of a variable. */
-static void
+void
print_declaration (pretty_printer *buffer, tree t, int spc, int flags)
{
INDENT (spc);
@@ -2415,7 +2261,6 @@ op_prio (const_tree op)
return 1;
case MODIFY_EXPR:
- case GIMPLE_MODIFY_STMT:
case INIT_EXPR:
return 2;
@@ -2549,7 +2394,6 @@ op_symbol_code (enum tree_code code)
switch (code)
{
case MODIFY_EXPR:
- case GIMPLE_MODIFY_STMT:
return "=";
case TRUTH_OR_EXPR:
@@ -2890,342 +2734,3 @@ newline_and_indent (pretty_printer *buffer, int spc)
pp_newline (buffer);
INDENT (spc);
}
-
-
-static void
-dump_vops (pretty_printer *buffer, tree stmt, int spc, int flags)
-{
- struct voptype_d *vdefs;
- struct voptype_d *vuses;
- int i, n;
-
- if (!ssa_operands_active () || !stmt_references_memory_p (stmt))
- return;
-
- /* Even if the statement doesn't have virtual operators yet, it may
- contain symbol information (this happens before aliases have been
- computed). */
- if ((flags & TDF_MEMSYMS)
- && VUSE_OPS (stmt) == NULL
- && VDEF_OPS (stmt) == NULL)
- {
- if (LOADED_SYMS (stmt))
- {
- pp_string (buffer, "# LOADS: ");
- dump_symbols (buffer, LOADED_SYMS (stmt), flags);
- newline_and_indent (buffer, spc);
- }
-
- if (STORED_SYMS (stmt))
- {
- pp_string (buffer, "# STORES: ");
- dump_symbols (buffer, STORED_SYMS (stmt), flags);
- newline_and_indent (buffer, spc);
- }
-
- return;
- }
-
- vuses = VUSE_OPS (stmt);
- while (vuses)
- {
- pp_string (buffer, "# VUSE <");
-
- n = VUSE_NUM (vuses);
- for (i = 0; i < n; i++)
- {
- dump_generic_node (buffer, VUSE_OP (vuses, i), spc + 2, flags, false);
- if (i < n - 1)
- pp_string (buffer, ", ");
- }
-
- pp_string (buffer, ">");
-
- if (flags & TDF_MEMSYMS)
- dump_symbols (buffer, LOADED_SYMS (stmt), flags);
-
- newline_and_indent (buffer, spc);
- vuses = vuses->next;
- }
-
- vdefs = VDEF_OPS (stmt);
- while (vdefs)
- {
- pp_string (buffer, "# ");
- dump_generic_node (buffer, VDEF_RESULT (vdefs), spc + 2, flags, false);
- pp_string (buffer, " = VDEF <");
-
- n = VDEF_NUM (vdefs);
- for (i = 0; i < n; i++)
- {
- dump_generic_node (buffer, VDEF_OP (vdefs, i), spc + 2, flags, 0);
- if (i < n - 1)
- pp_string (buffer, ", ");
- }
-
- pp_string (buffer, ">");
-
- if ((flags & TDF_MEMSYMS) && vdefs->next == NULL)
- dump_symbols (buffer, STORED_SYMS (stmt), flags);
-
- newline_and_indent (buffer, spc);
- vdefs = vdefs->next;
- }
-}
-
-
-/* Dumps basic block BB to FILE with details described by FLAGS and
- indented by INDENT spaces. */
-
-void
-dump_generic_bb (FILE *file, basic_block bb, int indent, int flags)
-{
- maybe_init_pretty_print (file);
- dump_generic_bb_buff (&buffer, bb, indent, flags);
- pp_flush (&buffer);
-}
-
-/* Dumps header of basic block BB to buffer BUFFER indented by INDENT
- spaces and details described by flags. */
-
-static void
-dump_bb_header (pretty_printer *buffer, basic_block bb, int indent, int flags)
-{
- edge e;
- tree stmt;
- edge_iterator ei;
-
- if (flags & TDF_BLOCKS)
- {
- INDENT (indent);
- pp_string (buffer, "# BLOCK ");
- pp_decimal_int (buffer, bb->index);
- if (bb->frequency)
- {
- pp_string (buffer, " freq:");
- pp_decimal_int (buffer, bb->frequency);
- }
- if (bb->count)
- {
- pp_string (buffer, " count:");
- pp_widest_integer (buffer, bb->count);
- }
-
- if (flags & TDF_LINENO)
- {
- block_stmt_iterator bsi;
-
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
- if (get_lineno (bsi_stmt (bsi)) != -1)
- {
- pp_string (buffer, ", starting at line ");
- pp_decimal_int (buffer, get_lineno (bsi_stmt (bsi)));
- break;
- }
- }
- newline_and_indent (buffer, indent);
-
- pp_string (buffer, "# PRED:");
- pp_write_text_to_stream (buffer);
- FOR_EACH_EDGE (e, ei, bb->preds)
- if (flags & TDF_SLIM)
- {
- pp_string (buffer, " ");
- if (e->src == ENTRY_BLOCK_PTR)
- pp_string (buffer, "ENTRY");
- else
- pp_decimal_int (buffer, e->src->index);
- }
- else
- dump_edge_info (buffer->buffer->stream, e, 0);
- pp_newline (buffer);
- }
- else
- {
- stmt = first_stmt (bb);
- if (!stmt || TREE_CODE (stmt) != LABEL_EXPR)
- {
- INDENT (indent - 2);
- pp_string (buffer, "<bb ");
- pp_decimal_int (buffer, bb->index);
- pp_string (buffer, ">:");
- pp_newline (buffer);
- }
- }
- pp_write_text_to_stream (buffer);
- check_bb_profile (bb, buffer->buffer->stream);
-}
-
-/* Dumps end of basic block BB to buffer BUFFER indented by INDENT
- spaces. */
-
-static void
-dump_bb_end (pretty_printer *buffer, basic_block bb, int indent, int flags)
-{
- edge e;
- edge_iterator ei;
-
- INDENT (indent);
- pp_string (buffer, "# SUCC:");
- pp_write_text_to_stream (buffer);
- FOR_EACH_EDGE (e, ei, bb->succs)
- if (flags & TDF_SLIM)
- {
- pp_string (buffer, " ");
- if (e->dest == EXIT_BLOCK_PTR)
- pp_string (buffer, "EXIT");
- else
- pp_decimal_int (buffer, e->dest->index);
- }
- else
- dump_edge_info (buffer->buffer->stream, e, 1);
- pp_newline (buffer);
-}
-
-/* Dump PHI nodes of basic block BB to BUFFER with details described
- by FLAGS and indented by INDENT spaces. */
-
-static void
-dump_phi_nodes (pretty_printer *buffer, basic_block bb, int indent, int flags)
-{
- tree phi = phi_nodes (bb);
- if (!phi)
- return;
-
- for (; phi; phi = PHI_CHAIN (phi))
- {
- if (is_gimple_reg (PHI_RESULT (phi)) || (flags & TDF_VOPS))
- {
- INDENT (indent);
- pp_string (buffer, "# ");
- dump_generic_node (buffer, phi, indent, flags, false);
- pp_newline (buffer);
- if (flags & TDF_VERBOSE)
- print_node (buffer->buffer->stream, "", phi, indent);
- }
- }
-}
-
-
-/* Dump jump to basic block BB that is represented implicitly in the cfg
- to BUFFER. */
-
-static void
-pp_cfg_jump (pretty_printer *buffer, basic_block bb)
-{
- tree stmt;
-
- stmt = first_stmt (bb);
-
- pp_string (buffer, "goto <bb ");
- pp_decimal_int (buffer, bb->index);
- pp_string (buffer, ">");
- if (stmt && TREE_CODE (stmt) == LABEL_EXPR)
- {
- pp_string (buffer, " (");
- dump_generic_node (buffer, LABEL_EXPR_LABEL (stmt), 0, 0, false);
- pp_string (buffer, ")");
- }
- pp_semicolon (buffer);
-}
-
-/* Dump edges represented implicitly in basic block BB to BUFFER, indented
- by INDENT spaces, with details given by FLAGS. */
-
-static void
-dump_implicit_edges (pretty_printer *buffer, basic_block bb, int indent,
- int flags)
-{
- edge e;
- edge_iterator ei;
- tree stmt;
-
- stmt = last_stmt (bb);
- if (stmt && TREE_CODE (stmt) == COND_EXPR)
- {
- edge true_edge, false_edge;
-
- /* When we are emitting the code or changing CFG, it is possible that
- the edges are not yet created. When we are using debug_bb in such
- a situation, we do not want it to crash. */
- if (EDGE_COUNT (bb->succs) != 2)
- return;
- extract_true_false_edges_from_block (bb, &true_edge, &false_edge);
-
- INDENT (indent + 2);
- pp_cfg_jump (buffer, true_edge->dest);
- newline_and_indent (buffer, indent);
- pp_string (buffer, "else");
- newline_and_indent (buffer, indent + 2);
- pp_cfg_jump (buffer, false_edge->dest);
- pp_newline (buffer);
- return;
- }
-
- /* If there is a fallthru edge, we may need to add an artificial goto to the
- dump. */
- FOR_EACH_EDGE (e, ei, bb->succs)
- if (e->flags & EDGE_FALLTHRU)
- break;
- if (e && e->dest != bb->next_bb)
- {
- INDENT (indent);
-
- if ((flags & TDF_LINENO) && e->goto_locus != UNKNOWN_LOCATION)
- {
- expanded_location goto_xloc;
- goto_xloc = expand_location (e->goto_locus);
- pp_character (buffer, '[');
- if (goto_xloc.file)
- {
- pp_string (buffer, goto_xloc.file);
- pp_string (buffer, " : ");
- }
- pp_decimal_int (buffer, goto_xloc.line);
- pp_string (buffer, "] ");
- }
-
- pp_cfg_jump (buffer, e->dest);
- pp_newline (buffer);
- }
-}
-
-/* Dumps basic block BB to buffer BUFFER with details described by FLAGS and
- indented by INDENT spaces. */
-
-static void
-dump_generic_bb_buff (pretty_printer *buffer, basic_block bb,
- int indent, int flags)
-{
- block_stmt_iterator bsi;
- tree stmt;
- int label_indent = indent - 2;
-
- if (label_indent < 0)
- label_indent = 0;
-
- dump_bb_header (buffer, bb, indent, flags);
-
- dump_phi_nodes (buffer, bb, indent, flags);
-
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
- {
- int curr_indent;
-
- stmt = bsi_stmt (bsi);
-
- curr_indent = TREE_CODE (stmt) == LABEL_EXPR ? label_indent : indent;
-
- INDENT (curr_indent);
- dump_generic_node (buffer, stmt, curr_indent, flags, true);
- pp_newline (buffer);
- dump_histograms_for_stmt (cfun, buffer->buffer->stream, stmt);
- if (flags & TDF_VERBOSE)
- print_node (buffer->buffer->stream, "", stmt, curr_indent);
- }
-
- dump_implicit_edges (buffer, bb, indent, flags);
-
- if (flags & TDF_BLOCKS)
- dump_bb_end (buffer, bb, indent, flags);
-}
diff --git a/gcc/tree-profile.c b/gcc/tree-profile.c
index 9aac154b436..20ded1b9f75 100644
--- a/gcc/tree-profile.c
+++ b/gcc/tree-profile.c
@@ -164,12 +164,13 @@ tree_init_edge_profiler (void)
/* Output instructions as GIMPLE trees to increment the edge
execution count, and insert them on E. We rely on
- bsi_insert_on_edge to preserve the order. */
+ gsi_insert_on_edge to preserve the order. */
static void
tree_gen_edge_profiler (int edgeno, edge e)
{
- tree ref, one, stmt1, stmt2, stmt3;
+ tree ref, one;
+ gimple stmt1, stmt2, stmt3;
/* We share one temporary variable declaration per function. This
gets re-set in tree_profiling. */
@@ -177,26 +178,24 @@ tree_gen_edge_profiler (int edgeno, edge e)
gcov_type_tmp_var = create_tmp_var (gcov_type_node, "PROF_edge_counter");
ref = tree_coverage_counter_ref (GCOV_COUNTER_ARCS, edgeno);
one = build_int_cst (gcov_type_node, 1);
- stmt1 = build_gimple_modify_stmt (gcov_type_tmp_var, ref);
- stmt2 = build_gimple_modify_stmt (gcov_type_tmp_var,
- build2 (PLUS_EXPR, gcov_type_node,
- gcov_type_tmp_var, one));
- stmt3 = build_gimple_modify_stmt (unshare_expr (ref), gcov_type_tmp_var);
- bsi_insert_on_edge (e, stmt1);
- bsi_insert_on_edge (e, stmt2);
- bsi_insert_on_edge (e, stmt3);
+ stmt1 = gimple_build_assign (gcov_type_tmp_var, ref);
+ stmt2 = gimple_build_assign_with_ops (PLUS_EXPR, gcov_type_tmp_var,
+ gcov_type_tmp_var, one);
+ stmt3 = gimple_build_assign (unshare_expr (ref), gcov_type_tmp_var);
+ gsi_insert_on_edge (e, stmt1);
+ gsi_insert_on_edge (e, stmt2);
+ gsi_insert_on_edge (e, stmt3);
}
-/* Emits code to get VALUE to instrument at BSI, and returns the
+/* Emits code to get VALUE to instrument at GSI, and returns the
variable containing the value. */
static tree
-prepare_instrumented_value (block_stmt_iterator *bsi,
- histogram_value value)
+prepare_instrumented_value (gimple_stmt_iterator *gsi, histogram_value value)
{
tree val = value->hvalue.value;
- return force_gimple_operand_bsi (bsi, fold_convert (gcov_type_node, val),
- true, NULL_TREE, true, BSI_SAME_STMT);
+ return force_gimple_operand_gsi (gsi, fold_convert (gcov_type_node, val),
+ true, NULL_TREE, true, GSI_SAME_STMT);
}
/* Output instructions as GIMPLE trees to increment the interval histogram
@@ -206,20 +205,23 @@ prepare_instrumented_value (block_stmt_iterator *bsi,
static void
tree_gen_interval_profiler (histogram_value value, unsigned tag, unsigned base)
{
- tree stmt = value->hvalue.stmt;
- block_stmt_iterator bsi = bsi_for_stmt (stmt);
+ gimple stmt = value->hvalue.stmt;
+ gimple_stmt_iterator gsi = gsi_for_stmt (stmt);
tree ref = tree_coverage_counter_ref (tag, base), ref_ptr;
- tree call, val;
- tree start = build_int_cst_type (integer_type_node, value->hdata.intvl.int_start);
- tree steps = build_int_cst_type (unsigned_type_node, value->hdata.intvl.steps);
+ gimple call;
+ tree val;
+ tree start = build_int_cst_type (integer_type_node,
+ value->hdata.intvl.int_start);
+ tree steps = build_int_cst_type (unsigned_type_node,
+ value->hdata.intvl.steps);
- ref_ptr = force_gimple_operand_bsi (&bsi,
+ ref_ptr = force_gimple_operand_gsi (&gsi,
build_addr (ref, current_function_decl),
- true, NULL_TREE, true, BSI_SAME_STMT);
- val = prepare_instrumented_value (&bsi, value);
- call = build_call_expr (tree_interval_profiler_fn, 4,
- ref_ptr, val, start, steps);
- bsi_insert_before (&bsi, call, BSI_SAME_STMT);
+ true, NULL_TREE, true, GSI_SAME_STMT);
+ val = prepare_instrumented_value (&gsi, value);
+ call = gimple_build_call (tree_interval_profiler_fn, 4,
+ ref_ptr, val, start, steps);
+ gsi_insert_before (&gsi, call, GSI_SAME_STMT);
}
/* Output instructions as GIMPLE trees to increment the power of two histogram
@@ -229,16 +231,17 @@ tree_gen_interval_profiler (histogram_value value, unsigned tag, unsigned base)
static void
tree_gen_pow2_profiler (histogram_value value, unsigned tag, unsigned base)
{
- tree stmt = value->hvalue.stmt;
- block_stmt_iterator bsi = bsi_for_stmt (stmt);
+ gimple stmt = value->hvalue.stmt;
+ gimple_stmt_iterator gsi = gsi_for_stmt (stmt);
tree ref_ptr = tree_coverage_counter_addr (tag, base);
- tree call, val;
+ gimple call;
+ tree val;
- ref_ptr = force_gimple_operand_bsi (&bsi, ref_ptr,
- true, NULL_TREE, true, BSI_SAME_STMT);
- val = prepare_instrumented_value (&bsi, value);
- call = build_call_expr (tree_pow2_profiler_fn, 2, ref_ptr, val);
- bsi_insert_before (&bsi, call, BSI_SAME_STMT);
+ ref_ptr = force_gimple_operand_gsi (&gsi, ref_ptr,
+ true, NULL_TREE, true, GSI_SAME_STMT);
+ val = prepare_instrumented_value (&gsi, value);
+ call = gimple_build_call (tree_pow2_profiler_fn, 2, ref_ptr, val);
+ gsi_insert_before (&gsi, call, GSI_SAME_STMT);
}
/* Output instructions as GIMPLE trees for code to find the most common value.
@@ -248,16 +251,17 @@ tree_gen_pow2_profiler (histogram_value value, unsigned tag, unsigned base)
static void
tree_gen_one_value_profiler (histogram_value value, unsigned tag, unsigned base)
{
- tree stmt = value->hvalue.stmt;
- block_stmt_iterator bsi = bsi_for_stmt (stmt);
+ gimple stmt = value->hvalue.stmt;
+ gimple_stmt_iterator gsi = gsi_for_stmt (stmt);
tree ref_ptr = tree_coverage_counter_addr (tag, base);
- tree call, val;
+ gimple call;
+ tree val;
- ref_ptr = force_gimple_operand_bsi (&bsi, ref_ptr,
- true, NULL_TREE, true, BSI_SAME_STMT);
- val = prepare_instrumented_value (&bsi, value);
- call = build_call_expr (tree_one_value_profiler_fn, 2, ref_ptr, val);
- bsi_insert_before (&bsi, call, BSI_SAME_STMT);
+ ref_ptr = force_gimple_operand_gsi (&gsi, ref_ptr,
+ true, NULL_TREE, true, GSI_SAME_STMT);
+ val = prepare_instrumented_value (&gsi, value);
+ call = gimple_build_call (tree_one_value_profiler_fn, 2, ref_ptr, val);
+ gsi_insert_before (&gsi, call, GSI_SAME_STMT);
}
@@ -270,13 +274,14 @@ tree_gen_one_value_profiler (histogram_value value, unsigned tag, unsigned base)
static void
tree_gen_ic_profiler (histogram_value value, unsigned tag, unsigned base)
{
- tree tmp1, stmt1, stmt2, stmt3;
- tree stmt = value->hvalue.stmt;
- block_stmt_iterator bsi = bsi_for_stmt (stmt);
+ tree tmp1;
+ gimple stmt1, stmt2, stmt3;
+ gimple stmt = value->hvalue.stmt;
+ gimple_stmt_iterator gsi = gsi_for_stmt (stmt);
tree ref_ptr = tree_coverage_counter_addr (tag, base);
- ref_ptr = force_gimple_operand_bsi (&bsi, ref_ptr,
- true, NULL_TREE, true, BSI_SAME_STMT);
+ ref_ptr = force_gimple_operand_gsi (&gsi, ref_ptr,
+ true, NULL_TREE, true, GSI_SAME_STMT);
/* Insert code:
@@ -285,13 +290,13 @@ tree_gen_ic_profiler (histogram_value value, unsigned tag, unsigned base)
*/
tmp1 = create_tmp_var (ptr_void, "PROF");
- stmt1 = build_gimple_modify_stmt (ic_gcov_type_ptr_var, ref_ptr);
- stmt2 = build_gimple_modify_stmt (tmp1, unshare_expr (value->hvalue.value));
- stmt3 = build_gimple_modify_stmt (ic_void_ptr_var, tmp1);
+ stmt1 = gimple_build_assign (ic_gcov_type_ptr_var, ref_ptr);
+ stmt2 = gimple_build_assign (tmp1, unshare_expr (value->hvalue.value));
+ stmt3 = gimple_build_assign (ic_void_ptr_var, tmp1);
- bsi_insert_before (&bsi, stmt1, BSI_SAME_STMT);
- bsi_insert_before (&bsi, stmt2, BSI_SAME_STMT);
- bsi_insert_before (&bsi, stmt3, BSI_SAME_STMT);
+ gsi_insert_before (&gsi, stmt1, GSI_SAME_STMT);
+ gsi_insert_before (&gsi, stmt2, GSI_SAME_STMT);
+ gsi_insert_before (&gsi, stmt3, GSI_SAME_STMT);
}
@@ -304,18 +309,15 @@ static void
tree_gen_ic_func_profiler (void)
{
struct cgraph_node * c_node = cgraph_node (current_function_decl);
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
edge e;
basic_block bb;
edge_iterator ei;
- tree stmt1, stmt2;
+ gimple stmt1, stmt2;
tree tree_uid, cur_func;
- if (flag_unit_at_a_time)
- {
- if (!c_node->needed)
- return;
- }
+ if (!c_node->needed)
+ return;
tree_init_edge_profiler ();
@@ -324,30 +326,30 @@ tree_gen_ic_func_profiler (void)
tree void0;
bb = split_edge (e);
- bsi = bsi_start (bb);
+ gsi = gsi_start_bb (bb);
- cur_func = force_gimple_operand_bsi (&bsi,
+ cur_func = force_gimple_operand_gsi (&gsi,
build_addr (current_function_decl,
current_function_decl),
true, NULL_TREE,
- true, BSI_SAME_STMT);
+ true, GSI_SAME_STMT);
tree_uid = build_int_cst (gcov_type_node, c_node->pid);
- stmt1 = build_call_expr (tree_indirect_call_profiler_fn, 4,
- ic_gcov_type_ptr_var,
- tree_uid,
- cur_func,
- ic_void_ptr_var);
- bsi_insert_after (&bsi, stmt1, BSI_NEW_STMT);
+ stmt1 = gimple_build_call (tree_indirect_call_profiler_fn, 4,
+ ic_gcov_type_ptr_var,
+ tree_uid,
+ cur_func,
+ ic_void_ptr_var);
+ gsi_insert_after (&gsi, stmt1, GSI_NEW_STMT);
gcc_assert (EDGE_COUNT (bb->succs) == 1);
bb = split_edge (EDGE_I (bb->succs, 0));
- bsi = bsi_start (bb);
+ gsi = gsi_start_bb (bb);
/* Set __gcov_indirect_call_callee to 0,
so that calls from other modules won't get misattributed
to the last caller of the current callee. */
void0 = build_int_cst (build_pointer_type (void_type_node), 0);
- stmt2 = build_gimple_modify_stmt (ic_void_ptr_var, void0);
- bsi_insert_after (&bsi, stmt2, BSI_NEW_STMT);
+ stmt2 = gimple_build_assign (ic_void_ptr_var, void0);
+ gsi_insert_after (&gsi, stmt2, GSI_NEW_STMT);
}
}
@@ -357,9 +359,9 @@ tree_gen_ic_func_profiler (void)
section for counters, BASE is offset of the counter position. */
static void
-tree_gen_const_delta_profiler (histogram_value value ATTRIBUTE_UNUSED,
- unsigned tag ATTRIBUTE_UNUSED,
- unsigned base ATTRIBUTE_UNUSED)
+tree_gen_const_delta_profiler (histogram_value value ATTRIBUTE_UNUSED,
+ unsigned tag ATTRIBUTE_UNUSED,
+ unsigned base ATTRIBUTE_UNUSED)
{
/* FIXME implement this. */
#ifdef ENABLE_CHECKING
@@ -375,17 +377,18 @@ tree_gen_const_delta_profiler (histogram_value value ATTRIBUTE_UNUSED,
static void
tree_gen_average_profiler (histogram_value value, unsigned tag, unsigned base)
{
- tree stmt = value->hvalue.stmt;
- block_stmt_iterator bsi = bsi_for_stmt (stmt);
+ gimple stmt = value->hvalue.stmt;
+ gimple_stmt_iterator gsi = gsi_for_stmt (stmt);
tree ref_ptr = tree_coverage_counter_addr (tag, base);
- tree call, val;
+ gimple call;
+ tree val;
- ref_ptr = force_gimple_operand_bsi (&bsi, ref_ptr,
+ ref_ptr = force_gimple_operand_gsi (&gsi, ref_ptr,
true, NULL_TREE,
- true, BSI_SAME_STMT);
- val = prepare_instrumented_value (&bsi, value);
- call = build_call_expr (tree_average_profiler_fn, 2, ref_ptr, val);
- bsi_insert_before (&bsi, call, BSI_SAME_STMT);
+ true, GSI_SAME_STMT);
+ val = prepare_instrumented_value (&gsi, value);
+ call = gimple_build_call (tree_average_profiler_fn, 2, ref_ptr, val);
+ gsi_insert_before (&gsi, call, GSI_SAME_STMT);
}
/* Output instructions as GIMPLE trees to increment the ior histogram
@@ -395,16 +398,17 @@ tree_gen_average_profiler (histogram_value value, unsigned tag, unsigned base)
static void
tree_gen_ior_profiler (histogram_value value, unsigned tag, unsigned base)
{
- tree stmt = value->hvalue.stmt;
- block_stmt_iterator bsi = bsi_for_stmt (stmt);
+ gimple stmt = value->hvalue.stmt;
+ gimple_stmt_iterator gsi = gsi_for_stmt (stmt);
tree ref_ptr = tree_coverage_counter_addr (tag, base);
- tree call, val;
+ gimple call;
+ tree val;
- ref_ptr = force_gimple_operand_bsi (&bsi, ref_ptr,
- true, NULL_TREE, true, BSI_SAME_STMT);
- val = prepare_instrumented_value (&bsi, value);
- call = build_call_expr (tree_ior_profiler_fn, 2, ref_ptr, val);
- bsi_insert_before (&bsi, call, BSI_SAME_STMT);
+ ref_ptr = force_gimple_operand_gsi (&gsi, ref_ptr,
+ true, NULL_TREE, true, GSI_SAME_STMT);
+ val = prepare_instrumented_value (&gsi, value);
+ call = gimple_build_call (tree_ior_profiler_fn, 2, ref_ptr, val);
+ gsi_insert_before (&gsi, call, GSI_SAME_STMT);
}
/* Return 1 if tree-based profiling is in effect, else 0.
@@ -417,7 +421,7 @@ do_tree_profiling (void)
if (profile_arc_flag || flag_test_coverage || flag_branch_probabilities)
{
tree_register_profile_hooks ();
- tree_register_value_prof_hooks ();
+ gimple_register_value_prof_hooks ();
return true;
}
return false;
diff --git a/gcc/tree-scalar-evolution.c b/gcc/tree-scalar-evolution.c
index 57fe59b186e..67fcd08dda0 100644
--- a/gcc/tree-scalar-evolution.c
+++ b/gcc/tree-scalar-evolution.c
@@ -48,7 +48,7 @@ along with GCC; see the file COPYING3. If not see
Given a scalar variable to be analyzed, follow the SSA edge to
its definition:
- - When the definition is a GIMPLE_MODIFY_STMT: if the right hand side
+ - When the definition is a GIMPLE_ASSIGN: if the right hand side
(RHS) of the definition cannot be statically analyzed, the answer
of the analyzer is: "don't know".
Otherwise, for all the variables that are not yet analyzed in the
@@ -397,7 +397,7 @@ chrec_contains_symbols_defined_in_loop (const_tree chrec, unsigned loop_nb)
if (TREE_CODE (chrec) == SSA_NAME)
{
- tree def = SSA_NAME_DEF_STMT (chrec);
+ gimple def = SSA_NAME_DEF_STMT (chrec);
struct loop *def_loop = loop_containing_stmt (def);
struct loop *loop = get_loop (loop_nb);
@@ -421,13 +421,13 @@ chrec_contains_symbols_defined_in_loop (const_tree chrec, unsigned loop_nb)
/* Return true when PHI is a loop-phi-node. */
static bool
-loop_phi_node_p (tree phi)
+loop_phi_node_p (gimple phi)
{
/* The implementation of this function is based on the following
property: "all the loop-phi-nodes of a loop are contained in the
loop's header basic block". */
- return loop_containing_stmt (phi)->header == bb_for_stmt (phi);
+ return loop_containing_stmt (phi)->header == gimple_bb (phi);
}
/* Compute the scalar evolution for EVOLUTION_FN after crossing LOOP.
@@ -656,7 +656,7 @@ get_scalar_evolution (tree scalar)
static tree
add_to_evolution_1 (unsigned loop_nb, tree chrec_before, tree to_add,
- tree at_stmt)
+ gimple at_stmt)
{
tree type, left, right;
struct loop *loop = get_loop (loop_nb), *chloop;
@@ -853,7 +853,7 @@ add_to_evolution_1 (unsigned loop_nb, tree chrec_before, tree to_add,
static tree
add_to_evolution (unsigned loop_nb, tree chrec_before, enum tree_code code,
- tree to_add, tree at_stmt)
+ tree to_add, gimple at_stmt)
{
tree type = chrec_type (to_add);
tree res = NULL_TREE;
@@ -918,47 +918,14 @@ set_nb_iterations_in_loop (struct loop *loop,
scalar evolution analysis. For the moment, greedily select all the
loop nests we could analyze. */
-/* Return true when it is possible to analyze the condition expression
- EXPR. */
-
-static bool
-analyzable_condition (const_tree expr)
-{
- tree condition;
-
- if (TREE_CODE (expr) != COND_EXPR)
- return false;
-
- condition = TREE_OPERAND (expr, 0);
-
- switch (TREE_CODE (condition))
- {
- case SSA_NAME:
- return true;
-
- case LT_EXPR:
- case LE_EXPR:
- case GT_EXPR:
- case GE_EXPR:
- case EQ_EXPR:
- case NE_EXPR:
- return true;
-
- default:
- return false;
- }
-
- return false;
-}
-
/* For a loop with a single exit edge, return the COND_EXPR that
guards the exit edge. If the expression is too difficult to
analyze, then give up. */
-tree
+gimple
get_loop_exit_condition (const struct loop *loop)
{
- tree res = NULL_TREE;
+ gimple res = NULL;
edge exit_edge = single_exit (loop);
if (dump_file && (dump_flags & TDF_DETAILS))
@@ -966,16 +933,16 @@ get_loop_exit_condition (const struct loop *loop)
if (exit_edge)
{
- tree expr;
+ gimple stmt;
- expr = last_stmt (exit_edge->src);
- if (analyzable_condition (expr))
- res = expr;
+ stmt = last_stmt (exit_edge->src);
+ if (gimple_code (stmt) == GIMPLE_COND)
+ res = stmt;
}
if (dump_file && (dump_flags & TDF_DETAILS))
{
- print_generic_expr (dump_file, res, 0);
+ print_gimple_stmt (dump_file, res, 0, 0);
fprintf (dump_file, ")\n");
}
@@ -986,7 +953,7 @@ get_loop_exit_condition (const struct loop *loop)
static void
get_exit_conditions_rec (struct loop *loop,
- VEC(tree,heap) **exit_conditions)
+ VEC(gimple,heap) **exit_conditions)
{
if (!loop)
return;
@@ -997,10 +964,10 @@ get_exit_conditions_rec (struct loop *loop,
if (single_exit (loop))
{
- tree loop_condition = get_loop_exit_condition (loop);
+ gimple loop_condition = get_loop_exit_condition (loop);
if (loop_condition)
- VEC_safe_push (tree, heap, *exit_conditions, loop_condition);
+ VEC_safe_push (gimple, heap, *exit_conditions, loop_condition);
}
}
@@ -1008,7 +975,7 @@ get_exit_conditions_rec (struct loop *loop,
initializes the EXIT_CONDITIONS array. */
static void
-select_loops_exit_conditions (VEC(tree,heap) **exit_conditions)
+select_loops_exit_conditions (VEC(gimple,heap) **exit_conditions)
{
struct loop *function_body = current_loops->tree_root;
@@ -1025,59 +992,23 @@ typedef enum t_bool {
} t_bool;
-static t_bool follow_ssa_edge (struct loop *loop, tree, tree, tree *, int);
+static t_bool follow_ssa_edge (struct loop *loop, gimple, gimple, tree *, int);
-/* Follow the ssa edge into the right hand side RHS of an assignment.
+/* Follow the ssa edge into the binary expression RHS0 CODE RHS1.
Return true if the strongly connected component has been found. */
static t_bool
-follow_ssa_edge_in_rhs (struct loop *loop, tree at_stmt, tree rhs,
- tree halting_phi, tree *evolution_of_loop, int limit)
+follow_ssa_edge_binary (struct loop *loop, gimple at_stmt,
+ tree type, tree rhs0, enum tree_code code, tree rhs1,
+ gimple halting_phi, tree *evolution_of_loop, int limit)
{
t_bool res = t_false;
- tree rhs0, rhs1;
- tree type_rhs = TREE_TYPE (rhs);
tree evol;
- enum tree_code code;
-
- /* The RHS is one of the following cases:
- - an SSA_NAME,
- - an INTEGER_CST,
- - a PLUS_EXPR,
- - a POINTER_PLUS_EXPR,
- - a MINUS_EXPR,
- - an ASSERT_EXPR,
- - other cases are not yet handled. */
- code = TREE_CODE (rhs);
+
switch (code)
{
- case NOP_EXPR:
- /* This assignment is under the form "a_1 = (cast) rhs. */
- res = follow_ssa_edge_in_rhs (loop, at_stmt, TREE_OPERAND (rhs, 0),
- halting_phi, evolution_of_loop, limit);
- *evolution_of_loop = chrec_convert (TREE_TYPE (rhs),
- *evolution_of_loop, at_stmt);
- break;
-
- case INTEGER_CST:
- /* This assignment is under the form "a_1 = 7". */
- res = t_false;
- break;
-
- case SSA_NAME:
- /* This assignment is under the form: "a_1 = b_2". */
- res = follow_ssa_edge
- (loop, SSA_NAME_DEF_STMT (rhs), halting_phi, evolution_of_loop, limit);
- break;
-
case POINTER_PLUS_EXPR:
case PLUS_EXPR:
- /* This case is under the form "rhs0 + rhs1". */
- rhs0 = TREE_OPERAND (rhs, 0);
- rhs1 = TREE_OPERAND (rhs, 1);
- STRIP_TYPE_NOPS (rhs0);
- STRIP_TYPE_NOPS (rhs1);
-
if (TREE_CODE (rhs0) == SSA_NAME)
{
if (TREE_CODE (rhs1) == SSA_NAME)
@@ -1092,13 +1023,12 @@ follow_ssa_edge_in_rhs (struct loop *loop, tree at_stmt, tree rhs,
evol = *evolution_of_loop;
res = follow_ssa_edge
- (loop, SSA_NAME_DEF_STMT (rhs0), halting_phi,
- &evol, limit);
+ (loop, SSA_NAME_DEF_STMT (rhs0), halting_phi, &evol, limit);
if (res == t_true)
*evolution_of_loop = add_to_evolution
(loop->num,
- chrec_convert (type_rhs, evol, at_stmt),
+ chrec_convert (type, evol, at_stmt),
code, rhs1, at_stmt);
else if (res == t_false)
@@ -1110,7 +1040,7 @@ follow_ssa_edge_in_rhs (struct loop *loop, tree at_stmt, tree rhs,
if (res == t_true)
*evolution_of_loop = add_to_evolution
(loop->num,
- chrec_convert (type_rhs, *evolution_of_loop, at_stmt),
+ chrec_convert (type, *evolution_of_loop, at_stmt),
code, rhs0, at_stmt);
else if (res == t_dont_know)
@@ -1130,7 +1060,7 @@ follow_ssa_edge_in_rhs (struct loop *loop, tree at_stmt, tree rhs,
evolution_of_loop, limit);
if (res == t_true)
*evolution_of_loop = add_to_evolution
- (loop->num, chrec_convert (type_rhs, *evolution_of_loop,
+ (loop->num, chrec_convert (type, *evolution_of_loop,
at_stmt),
code, rhs1, at_stmt);
@@ -1148,7 +1078,7 @@ follow_ssa_edge_in_rhs (struct loop *loop, tree at_stmt, tree rhs,
evolution_of_loop, limit);
if (res == t_true)
*evolution_of_loop = add_to_evolution
- (loop->num, chrec_convert (type_rhs, *evolution_of_loop,
+ (loop->num, chrec_convert (type, *evolution_of_loop,
at_stmt),
code, rhs0, at_stmt);
@@ -1161,16 +1091,10 @@ follow_ssa_edge_in_rhs (struct loop *loop, tree at_stmt, tree rhs,
"a = ... + ...". */
/* And there is nothing to do. */
res = t_false;
-
break;
case MINUS_EXPR:
/* This case is under the form "opnd0 = rhs0 - rhs1". */
- rhs0 = TREE_OPERAND (rhs, 0);
- rhs1 = TREE_OPERAND (rhs, 1);
- STRIP_TYPE_NOPS (rhs0);
- STRIP_TYPE_NOPS (rhs1);
-
if (TREE_CODE (rhs0) == SSA_NAME)
{
/* Match an assignment under the form:
@@ -1186,7 +1110,7 @@ follow_ssa_edge_in_rhs (struct loop *loop, tree at_stmt, tree rhs,
evolution_of_loop, limit);
if (res == t_true)
*evolution_of_loop = add_to_evolution
- (loop->num, chrec_convert (type_rhs, *evolution_of_loop, at_stmt),
+ (loop->num, chrec_convert (type, *evolution_of_loop, at_stmt),
MINUS_EXPR, rhs1, at_stmt);
else if (res == t_dont_know)
@@ -1197,14 +1121,72 @@ follow_ssa_edge_in_rhs (struct loop *loop, tree at_stmt, tree rhs,
"a = ... - ...". */
/* And there is nothing to do. */
res = t_false;
-
break;
+
+ default:
+ res = t_false;
+ }
+
+ return res;
+}
+/* Follow the ssa edge into the expression EXPR.
+ Return true if the strongly connected component has been found. */
+
+static t_bool
+follow_ssa_edge_expr (struct loop *loop, gimple at_stmt, tree expr,
+ gimple halting_phi, tree *evolution_of_loop, int limit)
+{
+ t_bool res = t_false;
+ tree rhs0, rhs1;
+ tree type = TREE_TYPE (expr);
+ enum tree_code code;
+
+ /* The EXPR is one of the following cases:
+ - an SSA_NAME,
+ - an INTEGER_CST,
+ - a PLUS_EXPR,
+ - a POINTER_PLUS_EXPR,
+ - a MINUS_EXPR,
+ - an ASSERT_EXPR,
+ - other cases are not yet handled. */
+ code = TREE_CODE (expr);
+ switch (code)
+ {
+ case NOP_EXPR:
+ /* This assignment is under the form "a_1 = (cast) rhs. */
+ res = follow_ssa_edge_expr (loop, at_stmt, TREE_OPERAND (expr, 0),
+ halting_phi, evolution_of_loop, limit);
+ *evolution_of_loop = chrec_convert (type, *evolution_of_loop, at_stmt);
+ break;
+
+ case INTEGER_CST:
+ /* This assignment is under the form "a_1 = 7". */
+ res = t_false;
+ break;
+
+ case SSA_NAME:
+ /* This assignment is under the form: "a_1 = b_2". */
+ res = follow_ssa_edge
+ (loop, SSA_NAME_DEF_STMT (expr), halting_phi, evolution_of_loop, limit);
+ break;
+
+ case POINTER_PLUS_EXPR:
+ case PLUS_EXPR:
+ case MINUS_EXPR:
+ /* This case is under the form "rhs0 +- rhs1". */
+ rhs0 = TREE_OPERAND (expr, 0);
+ rhs1 = TREE_OPERAND (expr, 1);
+ STRIP_TYPE_NOPS (rhs0);
+ STRIP_TYPE_NOPS (rhs1);
+ return follow_ssa_edge_binary (loop, at_stmt, type, rhs0, code, rhs1,
+ halting_phi, evolution_of_loop, limit);
+
case ASSERT_EXPR:
{
/* This assignment is of the form: "a_1 = ASSERT_EXPR <a_2, ...>"
It must be handled as a copy assignment of the form a_1 = a_2. */
- tree op0 = ASSERT_EXPR_VAR (rhs);
+ tree op0 = ASSERT_EXPR_VAR (expr);
if (TREE_CODE (op0) == SSA_NAME)
res = follow_ssa_edge (loop, SSA_NAME_DEF_STMT (op0),
halting_phi, evolution_of_loop, limit);
@@ -1222,12 +1204,37 @@ follow_ssa_edge_in_rhs (struct loop *loop, tree at_stmt, tree rhs,
return res;
}
+/* Follow the ssa edge into the right hand side of an assignment STMT.
+ Return true if the strongly connected component has been found. */
+
+static t_bool
+follow_ssa_edge_in_rhs (struct loop *loop, gimple stmt,
+ gimple halting_phi, tree *evolution_of_loop, int limit)
+{
+ tree type = TREE_TYPE (gimple_assign_lhs (stmt));
+ enum tree_code code = gimple_assign_rhs_code (stmt);
+
+ switch (get_gimple_rhs_class (code))
+ {
+ case GIMPLE_BINARY_RHS:
+ return follow_ssa_edge_binary (loop, stmt, type,
+ gimple_assign_rhs1 (stmt), code,
+ gimple_assign_rhs2 (stmt),
+ halting_phi, evolution_of_loop, limit);
+ case GIMPLE_SINGLE_RHS:
+ return follow_ssa_edge_expr (loop, stmt, gimple_assign_rhs1 (stmt),
+ halting_phi, evolution_of_loop, limit);
+ default:
+ return t_false;
+ }
+}
+
/* Checks whether the I-th argument of a PHI comes from a backedge. */
static bool
-backedge_phi_arg_p (const_tree phi, int i)
+backedge_phi_arg_p (gimple phi, int i)
{
- const_edge e = PHI_ARG_EDGE (phi, i);
+ const_edge e = gimple_phi_arg_edge (phi, i);
/* We would in fact like to test EDGE_DFS_BACK here, but we do not care
about updating it anywhere, and this should work as well most of the
@@ -1245,8 +1252,8 @@ backedge_phi_arg_p (const_tree phi, int i)
static inline t_bool
follow_ssa_edge_in_condition_phi_branch (int i,
struct loop *loop,
- tree condition_phi,
- tree halting_phi,
+ gimple condition_phi,
+ gimple halting_phi,
tree *evolution_of_branch,
tree init_cond, int limit)
{
@@ -1280,11 +1287,11 @@ follow_ssa_edge_in_condition_phi_branch (int i,
static t_bool
follow_ssa_edge_in_condition_phi (struct loop *loop,
- tree condition_phi,
- tree halting_phi,
+ gimple condition_phi,
+ gimple halting_phi,
tree *evolution_of_loop, int limit)
{
- int i;
+ int i, n;
tree init = *evolution_of_loop;
tree evolution_of_branch;
t_bool res = follow_ssa_edge_in_condition_phi_branch (0, loop, condition_phi,
@@ -1297,10 +1304,11 @@ follow_ssa_edge_in_condition_phi (struct loop *loop,
*evolution_of_loop = evolution_of_branch;
/* If the phi node is just a copy, do not increase the limit. */
- if (PHI_NUM_ARGS (condition_phi) > 1)
+ n = gimple_phi_num_args (condition_phi);
+ if (n > 1)
limit++;
- for (i = 1; i < PHI_NUM_ARGS (condition_phi); i++)
+ for (i = 1; i < n; i++)
{
/* Quickly give up when the evolution of one of the branches is
not known. */
@@ -1328,8 +1336,8 @@ follow_ssa_edge_in_condition_phi (struct loop *loop,
static t_bool
follow_ssa_edge_inner_loop_phi (struct loop *outer_loop,
- tree loop_phi_node,
- tree halting_phi,
+ gimple loop_phi_node,
+ gimple halting_phi,
tree *evolution_of_loop, int limit)
{
struct loop *loop = loop_containing_stmt (loop_phi_node);
@@ -1340,19 +1348,19 @@ follow_ssa_edge_inner_loop_phi (struct loop *outer_loop,
if (ev == PHI_RESULT (loop_phi_node))
{
t_bool res = t_false;
- int i;
+ int i, n = gimple_phi_num_args (loop_phi_node);
- for (i = 0; i < PHI_NUM_ARGS (loop_phi_node); i++)
+ for (i = 0; i < n; i++)
{
tree arg = PHI_ARG_DEF (loop_phi_node, i);
basic_block bb;
/* Follow the edges that exit the inner loop. */
- bb = PHI_ARG_EDGE (loop_phi_node, i)->src;
+ bb = gimple_phi_arg_edge (loop_phi_node, i)->src;
if (!flow_bb_inside_loop_p (loop, bb))
- res = follow_ssa_edge_in_rhs (outer_loop, loop_phi_node,
- arg, halting_phi,
- evolution_of_loop, limit);
+ res = follow_ssa_edge_expr (outer_loop, loop_phi_node,
+ arg, halting_phi,
+ evolution_of_loop, limit);
if (res == t_true)
break;
}
@@ -1366,20 +1374,20 @@ follow_ssa_edge_inner_loop_phi (struct loop *outer_loop,
/* Otherwise, compute the overall effect of the inner loop. */
ev = compute_overall_effect_of_inner_loop (loop, ev);
- return follow_ssa_edge_in_rhs (outer_loop, loop_phi_node, ev, halting_phi,
- evolution_of_loop, limit);
+ return follow_ssa_edge_expr (outer_loop, loop_phi_node, ev, halting_phi,
+ evolution_of_loop, limit);
}
/* Follow an SSA edge from a loop-phi-node to itself, constructing a
path that is analyzed on the return walk. */
static t_bool
-follow_ssa_edge (struct loop *loop, tree def, tree halting_phi,
+follow_ssa_edge (struct loop *loop, gimple def, gimple halting_phi,
tree *evolution_of_loop, int limit)
{
struct loop *def_loop;
- if (TREE_CODE (def) == NOP_EXPR)
+ if (gimple_nop_p (def))
return t_false;
/* Give up if the path is longer than the MAX that we allow. */
@@ -1388,9 +1396,9 @@ follow_ssa_edge (struct loop *loop, tree def, tree halting_phi,
def_loop = loop_containing_stmt (def);
- switch (TREE_CODE (def))
+ switch (gimple_code (def))
{
- case PHI_NODE:
+ case GIMPLE_PHI:
if (!loop_phi_node_p (def))
/* DEF is a condition-phi-node. Follow the branches, and
record their evolutions. Finally, merge the collected
@@ -1419,15 +1427,13 @@ follow_ssa_edge (struct loop *loop, tree def, tree halting_phi,
/* Outer loop. */
return t_false;
- case GIMPLE_MODIFY_STMT:
- return follow_ssa_edge_in_rhs (loop, def,
- GIMPLE_STMT_OPERAND (def, 1),
- halting_phi,
+ case GIMPLE_ASSIGN:
+ return follow_ssa_edge_in_rhs (loop, def, halting_phi,
evolution_of_loop, limit);
default:
/* At this level of abstraction, the program is just a set
- of GIMPLE_MODIFY_STMTs and PHI_NODEs. In principle there is no
+ of GIMPLE_ASSIGNs and PHI_NODEs. In principle there is no
other node to be handled. */
return t_false;
}
@@ -1439,10 +1445,10 @@ follow_ssa_edge (struct loop *loop, tree def, tree halting_phi,
function from LOOP_PHI_NODE to LOOP_PHI_NODE in the loop. */
static tree
-analyze_evolution_in_loop (tree loop_phi_node,
+analyze_evolution_in_loop (gimple loop_phi_node,
tree init_cond)
{
- int i;
+ int i, n = gimple_phi_num_args (loop_phi_node);
tree evolution_function = chrec_not_analyzed_yet;
struct loop *loop = loop_containing_stmt (loop_phi_node);
basic_block bb;
@@ -1451,18 +1457,19 @@ analyze_evolution_in_loop (tree loop_phi_node,
{
fprintf (dump_file, "(analyze_evolution_in_loop \n");
fprintf (dump_file, " (loop_phi_node = ");
- print_generic_expr (dump_file, loop_phi_node, 0);
+ print_gimple_stmt (dump_file, loop_phi_node, 0, 0);
fprintf (dump_file, ")\n");
}
- for (i = 0; i < PHI_NUM_ARGS (loop_phi_node); i++)
+ for (i = 0; i < n; i++)
{
tree arg = PHI_ARG_DEF (loop_phi_node, i);
- tree ssa_chain, ev_fn;
+ gimple ssa_chain;
+ tree ev_fn;
t_bool res;
/* Select the edges that enter the loop body. */
- bb = PHI_ARG_EDGE (loop_phi_node, i)->src;
+ bb = gimple_phi_arg_edge (loop_phi_node, i)->src;
if (!flow_bb_inside_loop_p (loop, bb))
continue;
@@ -1509,24 +1516,25 @@ analyze_evolution_in_loop (tree loop_phi_node,
loop, and leaves this task to the on-demand tree reconstructor. */
static tree
-analyze_initial_condition (tree loop_phi_node)
+analyze_initial_condition (gimple loop_phi_node)
{
- int i;
+ int i, n;
tree init_cond = chrec_not_analyzed_yet;
- struct loop *loop = bb_for_stmt (loop_phi_node)->loop_father;
+ struct loop *loop = loop_containing_stmt (loop_phi_node);
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "(analyze_initial_condition \n");
fprintf (dump_file, " (loop_phi_node = \n");
- print_generic_expr (dump_file, loop_phi_node, 0);
+ print_gimple_stmt (dump_file, loop_phi_node, 0, 0);
fprintf (dump_file, ")\n");
}
- for (i = 0; i < PHI_NUM_ARGS (loop_phi_node); i++)
+ n = gimple_phi_num_args (loop_phi_node);
+ for (i = 0; i < n; i++)
{
tree branch = PHI_ARG_DEF (loop_phi_node, i);
- basic_block bb = PHI_ARG_EDGE (loop_phi_node, i)->src;
+ basic_block bb = gimple_phi_arg_edge (loop_phi_node, i)->src;
/* When the branch is oriented to the loop's body, it does
not contribute to the initial condition. */
@@ -1565,7 +1573,7 @@ analyze_initial_condition (tree loop_phi_node)
/* Analyze the scalar evolution for LOOP_PHI_NODE. */
static tree
-interpret_loop_phi (struct loop *loop, tree loop_phi_node)
+interpret_loop_phi (struct loop *loop, gimple loop_phi_node)
{
tree res;
struct loop *phi_loop = loop_containing_stmt (loop_phi_node);
@@ -1597,12 +1605,12 @@ interpret_loop_phi (struct loop *loop, tree loop_phi_node)
analyzed. */
static tree
-interpret_condition_phi (struct loop *loop, tree condition_phi)
+interpret_condition_phi (struct loop *loop, gimple condition_phi)
{
- int i;
+ int i, n = gimple_phi_num_args (condition_phi);
tree res = chrec_not_analyzed_yet;
- for (i = 0; i < PHI_NUM_ARGS (condition_phi); i++)
+ for (i = 0; i < n; i++)
{
tree branch_chrec;
@@ -1621,88 +1629,83 @@ interpret_condition_phi (struct loop *loop, tree condition_phi)
return res;
}
-/* Interpret the right hand side of a GIMPLE_MODIFY_STMT OPND1. If we didn't
+/* Interpret the operation RHS1 OP RHS2. If we didn't
analyze this node before, follow the definitions until ending
- either on an analyzed GIMPLE_MODIFY_STMT, or on a loop-phi-node. On the
+ either on an analyzed GIMPLE_ASSIGN, or on a loop-phi-node. On the
return path, this function propagates evolutions (ala constant copy
propagation). OPND1 is not a GIMPLE expression because we could
analyze the effect of an inner loop: see interpret_loop_phi. */
static tree
-interpret_rhs_modify_stmt (struct loop *loop, tree at_stmt,
- tree opnd1, tree type)
+interpret_rhs_expr (struct loop *loop, gimple at_stmt,
+ tree type, tree rhs1, enum tree_code code, tree rhs2)
{
- tree res, opnd10, opnd11, chrec10, chrec11;
+ tree res, chrec1, chrec2;
+
+ if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
+ {
+ if (is_gimple_min_invariant (rhs1))
+ return chrec_convert (type, rhs1, at_stmt);
+
+ if (code == SSA_NAME)
+ return chrec_convert (type, analyze_scalar_evolution (loop, rhs1),
+ at_stmt);
- if (is_gimple_min_invariant (opnd1))
- return chrec_convert (type, opnd1, at_stmt);
+ if (code == ASSERT_EXPR)
+ {
+ rhs1 = ASSERT_EXPR_VAR (rhs1);
+ return chrec_convert (type, analyze_scalar_evolution (loop, rhs1),
+ at_stmt);
+ }
+
+ return chrec_dont_know;
+ }
- switch (TREE_CODE (opnd1))
+ switch (code)
{
case POINTER_PLUS_EXPR:
- opnd10 = TREE_OPERAND (opnd1, 0);
- opnd11 = TREE_OPERAND (opnd1, 1);
- chrec10 = analyze_scalar_evolution (loop, opnd10);
- chrec11 = analyze_scalar_evolution (loop, opnd11);
- chrec10 = chrec_convert (type, chrec10, at_stmt);
- chrec11 = chrec_convert (sizetype, chrec11, at_stmt);
- res = chrec_fold_plus (type, chrec10, chrec11);
+ chrec1 = analyze_scalar_evolution (loop, rhs1);
+ chrec2 = analyze_scalar_evolution (loop, rhs2);
+ chrec1 = chrec_convert (type, chrec1, at_stmt);
+ chrec2 = chrec_convert (sizetype, chrec2, at_stmt);
+ res = chrec_fold_plus (type, chrec1, chrec2);
break;
case PLUS_EXPR:
- opnd10 = TREE_OPERAND (opnd1, 0);
- opnd11 = TREE_OPERAND (opnd1, 1);
- chrec10 = analyze_scalar_evolution (loop, opnd10);
- chrec11 = analyze_scalar_evolution (loop, opnd11);
- chrec10 = chrec_convert (type, chrec10, at_stmt);
- chrec11 = chrec_convert (type, chrec11, at_stmt);
- res = chrec_fold_plus (type, chrec10, chrec11);
+ chrec1 = analyze_scalar_evolution (loop, rhs1);
+ chrec2 = analyze_scalar_evolution (loop, rhs2);
+ chrec1 = chrec_convert (type, chrec1, at_stmt);
+ chrec2 = chrec_convert (type, chrec2, at_stmt);
+ res = chrec_fold_plus (type, chrec1, chrec2);
break;
case MINUS_EXPR:
- opnd10 = TREE_OPERAND (opnd1, 0);
- opnd11 = TREE_OPERAND (opnd1, 1);
- chrec10 = analyze_scalar_evolution (loop, opnd10);
- chrec11 = analyze_scalar_evolution (loop, opnd11);
- chrec10 = chrec_convert (type, chrec10, at_stmt);
- chrec11 = chrec_convert (type, chrec11, at_stmt);
- res = chrec_fold_minus (type, chrec10, chrec11);
+ chrec1 = analyze_scalar_evolution (loop, rhs1);
+ chrec2 = analyze_scalar_evolution (loop, rhs2);
+ chrec1 = chrec_convert (type, chrec1, at_stmt);
+ chrec2 = chrec_convert (type, chrec2, at_stmt);
+ res = chrec_fold_minus (type, chrec1, chrec2);
break;
case NEGATE_EXPR:
- opnd10 = TREE_OPERAND (opnd1, 0);
- chrec10 = analyze_scalar_evolution (loop, opnd10);
- chrec10 = chrec_convert (type, chrec10, at_stmt);
+ chrec1 = analyze_scalar_evolution (loop, rhs1);
+ chrec1 = chrec_convert (type, chrec1, at_stmt);
/* TYPE may be integer, real or complex, so use fold_convert. */
- res = chrec_fold_multiply (type, chrec10,
+ res = chrec_fold_multiply (type, chrec1,
fold_convert (type, integer_minus_one_node));
break;
case MULT_EXPR:
- opnd10 = TREE_OPERAND (opnd1, 0);
- opnd11 = TREE_OPERAND (opnd1, 1);
- chrec10 = analyze_scalar_evolution (loop, opnd10);
- chrec11 = analyze_scalar_evolution (loop, opnd11);
- chrec10 = chrec_convert (type, chrec10, at_stmt);
- chrec11 = chrec_convert (type, chrec11, at_stmt);
- res = chrec_fold_multiply (type, chrec10, chrec11);
- break;
-
- case SSA_NAME:
- res = chrec_convert (type, analyze_scalar_evolution (loop, opnd1),
- at_stmt);
- break;
-
- case ASSERT_EXPR:
- opnd10 = ASSERT_EXPR_VAR (opnd1);
- res = chrec_convert (type, analyze_scalar_evolution (loop, opnd10),
- at_stmt);
+ chrec1 = analyze_scalar_evolution (loop, rhs1);
+ chrec2 = analyze_scalar_evolution (loop, rhs2);
+ chrec1 = chrec_convert (type, chrec1, at_stmt);
+ chrec2 = chrec_convert (type, chrec2, at_stmt);
+ res = chrec_fold_multiply (type, chrec1, chrec2);
break;
CASE_CONVERT:
- opnd10 = TREE_OPERAND (opnd1, 0);
- chrec10 = analyze_scalar_evolution (loop, opnd10);
- res = chrec_convert (type, chrec10, at_stmt);
+ chrec1 = analyze_scalar_evolution (loop, rhs1);
+ res = chrec_convert (type, chrec1, at_stmt);
break;
default:
@@ -1713,6 +1716,39 @@ interpret_rhs_modify_stmt (struct loop *loop, tree at_stmt,
return res;
}
+/* Interpret the expression EXPR. */
+
+static tree
+interpret_expr (struct loop *loop, gimple at_stmt, tree expr)
+{
+ enum tree_code code;
+ tree type = TREE_TYPE (expr), op0, op1;
+
+ if (automatically_generated_chrec_p (expr))
+ return expr;
+
+ if (TREE_CODE (expr) == POLYNOMIAL_CHREC)
+ return chrec_dont_know;
+
+ extract_ops_from_tree (expr, &code, &op0, &op1);
+
+ return interpret_rhs_expr (loop, at_stmt, type,
+ op0, code, op1);
+}
+
+/* Interpret the rhs of the assignment STMT. */
+
+static tree
+interpret_gimple_assign (struct loop *loop, gimple stmt)
+{
+ tree type = TREE_TYPE (gimple_assign_lhs (stmt));
+ enum tree_code code = gimple_assign_rhs_code (stmt);
+
+ return interpret_rhs_expr (loop, stmt, type,
+ gimple_assign_rhs1 (stmt), code,
+ gimple_assign_rhs2 (stmt));
+}
+
/* This section contains all the entry points:
@@ -1744,7 +1780,8 @@ compute_scalar_evolution_in_loop (struct loop *wrto_loop,
static tree
analyze_scalar_evolution_1 (struct loop *loop, tree var, tree res)
{
- tree def, type = TREE_TYPE (var);
+ tree type = TREE_TYPE (var);
+ gimple def;
basic_block bb;
struct loop *def_loop;
@@ -1752,10 +1789,10 @@ analyze_scalar_evolution_1 (struct loop *loop, tree var, tree res)
return chrec_dont_know;
if (TREE_CODE (var) != SSA_NAME)
- return interpret_rhs_modify_stmt (loop, NULL_TREE, var, type);
+ return interpret_expr (loop, NULL, var);
def = SSA_NAME_DEF_STMT (var);
- bb = bb_for_stmt (def);
+ bb = gimple_bb (def);
def_loop = bb ? bb->loop_father : NULL;
if (bb == NULL
@@ -1783,14 +1820,13 @@ analyze_scalar_evolution_1 (struct loop *loop, tree var, tree res)
goto set_and_end;
}
- switch (TREE_CODE (def))
+ switch (gimple_code (def))
{
- case GIMPLE_MODIFY_STMT:
- res = interpret_rhs_modify_stmt (loop, def,
- GIMPLE_STMT_OPERAND (def, 1), type);
+ case GIMPLE_ASSIGN:
+ res = interpret_gimple_assign (loop, def);
break;
- case PHI_NODE:
+ case GIMPLE_PHI:
if (loop_phi_node_p (def))
res = interpret_loop_phi (loop, def);
else
@@ -1845,9 +1881,6 @@ analyze_scalar_evolution (struct loop *loop, tree var)
res = analyze_scalar_evolution_1 (loop, var, get_scalar_evolution (var));
- if (TREE_CODE (var) == SSA_NAME && res == chrec_dont_know)
- res = var;
-
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, ")\n");
@@ -1934,7 +1967,8 @@ loop_closed_phi_def (tree var)
{
struct loop *loop;
edge exit;
- tree phi;
+ gimple phi;
+ gimple_stmt_iterator psi;
if (var == NULL_TREE
|| TREE_CODE (var) != SSA_NAME)
@@ -1945,9 +1979,12 @@ loop_closed_phi_def (tree var)
if (!exit)
return NULL_TREE;
- for (phi = phi_nodes (exit->dest); phi; phi = PHI_CHAIN (phi))
- if (PHI_ARG_DEF_FROM_EDGE (phi, exit) == var)
- return PHI_RESULT (phi);
+ for (psi = gsi_start_phis (exit->dest); !gsi_end_p (psi); gsi_next (&psi))
+ {
+ phi = gsi_stmt (psi);
+ if (PHI_ARG_DEF_FROM_EDGE (phi, exit) == var)
+ return PHI_RESULT (phi);
+ }
return NULL_TREE;
}
@@ -1987,7 +2024,7 @@ instantiate_scev_1 (struct loop *instantiation_loop,
switch (TREE_CODE (chrec))
{
case SSA_NAME:
- def_bb = bb_for_stmt (SSA_NAME_DEF_STMT (chrec));
+ def_bb = gimple_bb (SSA_NAME_DEF_STMT (chrec));
/* A parameter (or loop invariant and we do not want to include
evolutions in outer loops), nothing to do. */
@@ -2073,7 +2110,7 @@ instantiate_scev_1 (struct loop *instantiation_loop,
if (CHREC_LEFT (chrec) != op0
|| CHREC_RIGHT (chrec) != op1)
{
- op1 = chrec_convert_rhs (chrec_type (op0), op1, NULL_TREE);
+ op1 = chrec_convert_rhs (chrec_type (op0), op1, NULL);
chrec = build_polynomial_chrec (CHREC_VARIABLE (chrec), op0, op1);
}
return chrec;
@@ -2095,8 +2132,8 @@ instantiate_scev_1 (struct loop *instantiation_loop,
if (TREE_OPERAND (chrec, 0) != op0
|| TREE_OPERAND (chrec, 1) != op1)
{
- op0 = chrec_convert (type, op0, NULL_TREE);
- op1 = chrec_convert_rhs (type, op1, NULL_TREE);
+ op0 = chrec_convert (type, op0, NULL);
+ op1 = chrec_convert_rhs (type, op1, NULL);
chrec = chrec_fold_plus (type, op0, op1);
}
return chrec;
@@ -2117,8 +2154,8 @@ instantiate_scev_1 (struct loop *instantiation_loop,
if (TREE_OPERAND (chrec, 0) != op0
|| TREE_OPERAND (chrec, 1) != op1)
{
- op0 = chrec_convert (type, op0, NULL_TREE);
- op1 = chrec_convert (type, op1, NULL_TREE);
+ op0 = chrec_convert (type, op0, NULL);
+ op1 = chrec_convert (type, op1, NULL);
chrec = chrec_fold_minus (type, op0, op1);
}
return chrec;
@@ -2139,8 +2176,8 @@ instantiate_scev_1 (struct loop *instantiation_loop,
if (TREE_OPERAND (chrec, 0) != op0
|| TREE_OPERAND (chrec, 1) != op1)
{
- op0 = chrec_convert (type, op0, NULL_TREE);
- op1 = chrec_convert (type, op1, NULL_TREE);
+ op0 = chrec_convert (type, op0, NULL);
+ op1 = chrec_convert (type, op1, NULL);
chrec = chrec_fold_multiply (type, op0, op1);
}
return chrec;
@@ -2168,7 +2205,7 @@ instantiate_scev_1 (struct loop *instantiation_loop,
if (fold_conversions)
return fold_convert (TREE_TYPE (chrec), op0);
- return chrec_convert (TREE_TYPE (chrec), op0, NULL_TREE);
+ return chrec_convert (TREE_TYPE (chrec), op0, NULL);
case SCEV_NOT_KNOWN:
return chrec_dont_know;
@@ -2388,14 +2425,14 @@ number_of_exit_cond_executions (struct loop *loop)
from the EXIT_CONDITIONS array. */
static void
-number_of_iterations_for_all_loops (VEC(tree,heap) **exit_conditions)
+number_of_iterations_for_all_loops (VEC(gimple,heap) **exit_conditions)
{
unsigned int i;
unsigned nb_chrec_dont_know_loops = 0;
unsigned nb_static_loops = 0;
- tree cond;
+ gimple cond;
- for (i = 0; VEC_iterate (tree, *exit_conditions, i, cond); i++)
+ for (i = 0; VEC_iterate (gimple, *exit_conditions, i, cond); i++)
{
tree res = number_of_latch_executions (loop_containing_stmt (cond));
if (chrec_contains_undetermined (res))
@@ -2540,33 +2577,37 @@ gather_chrec_stats (tree chrec, struct chrec_stats *stats)
index. This allows the parallelization of the loop. */
static void
-analyze_scalar_evolution_for_all_loop_phi_nodes (VEC(tree,heap) **exit_conditions)
+analyze_scalar_evolution_for_all_loop_phi_nodes (VEC(gimple,heap) **exit_conditions)
{
unsigned int i;
struct chrec_stats stats;
- tree cond;
+ gimple cond, phi;
+ gimple_stmt_iterator psi;
reset_chrecs_counters (&stats);
- for (i = 0; VEC_iterate (tree, *exit_conditions, i, cond); i++)
+ for (i = 0; VEC_iterate (gimple, *exit_conditions, i, cond); i++)
{
struct loop *loop;
basic_block bb;
- tree phi, chrec;
+ tree chrec;
loop = loop_containing_stmt (cond);
bb = loop->header;
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
- if (is_gimple_reg (PHI_RESULT (phi)))
- {
- chrec = instantiate_parameters
- (loop,
- analyze_scalar_evolution (loop, PHI_RESULT (phi)));
+ for (psi = gsi_start_phis (bb); !gsi_end_p (psi); gsi_next (&psi))
+ {
+ phi = gsi_stmt (psi);
+ if (is_gimple_reg (PHI_RESULT (phi)))
+ {
+ chrec = instantiate_parameters
+ (loop,
+ analyze_scalar_evolution (loop, PHI_RESULT (phi)));
- if (dump_file && (dump_flags & TDF_STATS))
- gather_chrec_stats (chrec, &stats);
- }
+ if (dump_file && (dump_flags & TDF_STATS))
+ gather_chrec_stats (chrec, &stats);
+ }
+ }
}
if (dump_file && (dump_flags & TDF_STATS))
@@ -2671,10 +2712,10 @@ scev_reset (void)
overflow (e.g. because it is computed in signed arithmetics). */
bool
-simple_iv (struct loop *loop, tree stmt, tree op, affine_iv *iv,
+simple_iv (struct loop *loop, gimple stmt, tree op, affine_iv *iv,
bool allow_nonconstant_step)
{
- basic_block bb = bb_for_stmt (stmt);
+ basic_block bb = gimple_bb (stmt);
tree type, ev;
bool folded_casts;
@@ -2730,16 +2771,16 @@ simple_iv (struct loop *loop, tree stmt, tree op, affine_iv *iv,
void
scev_analysis (void)
{
- VEC(tree,heap) *exit_conditions;
+ VEC(gimple,heap) *exit_conditions;
- exit_conditions = VEC_alloc (tree, heap, 37);
+ exit_conditions = VEC_alloc (gimple, heap, 37);
select_loops_exit_conditions (&exit_conditions);
if (dump_file && (dump_flags & TDF_STATS))
analyze_scalar_evolution_for_all_loop_phi_nodes (&exit_conditions);
number_of_iterations_for_all_loops (&exit_conditions);
- VEC_free (tree, heap, exit_conditions);
+ VEC_free (gimple, heap, exit_conditions);
}
/* Finalize the scalar evolution analysis. */
@@ -2765,11 +2806,13 @@ unsigned int
scev_const_prop (void)
{
basic_block bb;
- tree name, phi, next_phi, type, ev;
+ tree name, type, ev;
+ gimple phi, ass;
struct loop *loop, *ex_loop;
bitmap ssa_names_to_remove = NULL;
unsigned i;
loop_iterator li;
+ gimple_stmt_iterator psi;
if (number_of_loops () <= 1)
return 0;
@@ -2778,8 +2821,9 @@ scev_const_prop (void)
{
loop = bb->loop_father;
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
+ for (psi = gsi_start_phis (bb); !gsi_end_p (psi); gsi_next (&psi))
{
+ phi = gsi_stmt (psi);
name = PHI_RESULT (phi);
if (!is_gimple_reg (name))
@@ -2815,11 +2859,13 @@ scev_const_prop (void)
EXECUTE_IF_SET_IN_BITMAP (ssa_names_to_remove, 0, i, bi)
{
+ gimple_stmt_iterator psi;
name = ssa_name (i);
phi = SSA_NAME_DEF_STMT (name);
- gcc_assert (TREE_CODE (phi) == PHI_NODE);
- remove_phi_node (phi, NULL, true);
+ gcc_assert (gimple_code (phi) == GIMPLE_PHI);
+ psi = gsi_for_stmt (phi);
+ remove_phi_node (&psi, true);
}
BITMAP_FREE (ssa_names_to_remove);
@@ -2830,8 +2876,8 @@ scev_const_prop (void)
FOR_EACH_LOOP (li, loop, LI_FROM_INNERMOST)
{
edge exit;
- tree def, rslt, ass, niter;
- block_stmt_iterator bsi;
+ tree def, rslt, niter;
+ gimple_stmt_iterator bsi;
/* If we do not know exact number of iterations of the loop, we cannot
replace the final value. */
@@ -2852,22 +2898,28 @@ scev_const_prop (void)
/* Ensure that it is possible to insert new statements somewhere. */
if (!single_pred_p (exit->dest))
split_loop_exit_edge (exit);
- bsi = bsi_after_labels (exit->dest);
+ bsi = gsi_after_labels (exit->dest);
ex_loop = superloop_at_depth (loop,
loop_depth (exit->dest->loop_father) + 1);
- for (phi = phi_nodes (exit->dest); phi; phi = next_phi)
+ for (psi = gsi_start_phis (exit->dest); !gsi_end_p (psi); )
{
- next_phi = PHI_CHAIN (phi);
+ phi = gsi_stmt (psi);
rslt = PHI_RESULT (phi);
def = PHI_ARG_DEF_FROM_EDGE (phi, exit);
if (!is_gimple_reg (def))
- continue;
+ {
+ gsi_next (&psi);
+ continue;
+ }
if (!POINTER_TYPE_P (TREE_TYPE (def))
&& !INTEGRAL_TYPE_P (TREE_TYPE (def)))
- continue;
+ {
+ gsi_next (&psi);
+ continue;
+ }
def = analyze_scalar_evolution_in_loop (ex_loop, loop, def, NULL);
def = compute_overall_effect_of_inner_loop (ex_loop, def);
@@ -2877,23 +2929,20 @@ scev_const_prop (void)
of some ssa names, which may cause problems if they appear
on abnormal edges. */
|| contains_abnormal_ssa_name_p (def))
- continue;
+ {
+ gsi_next (&psi);
+ continue;
+ }
/* Eliminate the PHI node and replace it by a computation outside
the loop. */
def = unshare_expr (def);
- remove_phi_node (phi, NULL_TREE, false);
-
- ass = build_gimple_modify_stmt (rslt, NULL_TREE);
- SSA_NAME_DEF_STMT (rslt) = ass;
- {
- block_stmt_iterator dest = bsi;
- bsi_insert_before (&dest, ass, BSI_NEW_STMT);
- def = force_gimple_operand_bsi (&dest, def, false, NULL_TREE,
- true, BSI_SAME_STMT);
- }
- GIMPLE_STMT_OPERAND (ass, 1) = def;
- update_stmt (ass);
+ remove_phi_node (&psi, false);
+
+ def = force_gimple_operand_gsi (&bsi, def, false, NULL_TREE,
+ true, GSI_SAME_STMT);
+ ass = gimple_build_assign (rslt, def);
+ gsi_insert_before (&bsi, ass, GSI_SAME_STMT);
}
}
return 0;
diff --git a/gcc/tree-scalar-evolution.h b/gcc/tree-scalar-evolution.h
index 472b194d307..5d6d711afa9 100644
--- a/gcc/tree-scalar-evolution.h
+++ b/gcc/tree-scalar-evolution.h
@@ -23,7 +23,7 @@ along with GCC; see the file COPYING3. If not see
extern tree number_of_latch_executions (struct loop *);
extern tree number_of_exit_cond_executions (struct loop *);
-extern tree get_loop_exit_condition (const struct loop *);
+extern gimple get_loop_exit_condition (const struct loop *);
extern void scev_initialize (void);
extern void scev_reset (void);
@@ -35,7 +35,7 @@ extern void gather_stats_on_scev_database (void);
extern void scev_analysis (void);
unsigned int scev_const_prop (void);
-extern bool simple_iv (struct loop *, tree, tree, affine_iv *, bool);
+extern bool simple_iv (struct loop *, gimple, tree, affine_iv *, bool);
/* Analyze all the parameters of the chrec that were left under a
symbolic form. LOOP is the loop in which symbolic names have to
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index 21cf367b23a..5ae1c51350c 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -37,7 +37,7 @@ along with GCC; see the file COPYING3. If not see
#include "langhooks.h"
#include "tree-inline.h"
#include "tree-flow.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "tree-dump.h"
#include "tree-pass.h"
#include "timevar.h"
@@ -208,8 +208,9 @@ extern void debug_sra_elt_name (struct sra_elt *);
/* Forward declarations. */
static tree generate_element_ref (struct sra_elt *);
-static tree sra_build_assignment (tree dst, tree src);
-static void mark_all_v_defs (tree list);
+static gimple_seq sra_build_assignment (tree dst, tree src);
+static void mark_all_v_defs_seq (gimple_seq);
+static void mark_all_v_defs_stmt (gimple);
/* Return true if DECL is an SRA candidate. */
@@ -719,7 +720,7 @@ maybe_lookup_element_for_expr (tree expr)
references, and categorize them. */
/* A set of callbacks for phases 2 and 4. They'll be invoked for the
- various kinds of references seen. In all cases, *BSI is an iterator
+ various kinds of references seen. In all cases, *GSI is an iterator
pointing to the statement being processed. */
struct sra_walk_fns
{
@@ -729,21 +730,21 @@ struct sra_walk_fns
is a left-hand-side reference. USE_ALL is true if we saw something we
couldn't quite identify and had to force the use of the entire object. */
void (*use) (struct sra_elt *elt, tree *expr_p,
- block_stmt_iterator *bsi, bool is_output, bool use_all);
+ gimple_stmt_iterator *gsi, bool is_output, bool use_all);
/* Invoked when we have a copy between two scalarizable references. */
void (*copy) (struct sra_elt *lhs_elt, struct sra_elt *rhs_elt,
- block_stmt_iterator *bsi);
+ gimple_stmt_iterator *gsi);
/* Invoked when ELT is initialized from a constant. VALUE may be NULL,
in which case it should be treated as an empty CONSTRUCTOR. */
- void (*init) (struct sra_elt *elt, tree value, block_stmt_iterator *bsi);
+ void (*init) (struct sra_elt *elt, tree value, gimple_stmt_iterator *gsi);
/* Invoked when we have a copy between one scalarizable reference ELT
and one non-scalarizable reference OTHER without side-effects.
IS_OUTPUT is true if ELT is on the left-hand side. */
void (*ldst) (struct sra_elt *elt, tree other,
- block_stmt_iterator *bsi, bool is_output);
+ gimple_stmt_iterator *gsi, bool is_output);
/* True during phase 2, false during phase 4. */
/* ??? This is a hack. */
@@ -777,7 +778,7 @@ sra_find_candidate_decl (tree *tp, int *walk_subtrees,
If we find one, invoke FNS->USE. */
static void
-sra_walk_expr (tree *expr_p, block_stmt_iterator *bsi, bool is_output,
+sra_walk_expr (tree *expr_p, gimple_stmt_iterator *gsi, bool is_output,
const struct sra_walk_fns *fns)
{
tree expr = *expr_p;
@@ -804,7 +805,7 @@ sra_walk_expr (tree *expr_p, block_stmt_iterator *bsi, bool is_output,
if (disable_scalarization)
elt->cannot_scalarize = true;
else
- fns->use (elt, expr_p, bsi, is_output, use_all_p);
+ fns->use (elt, expr_p, gsi, is_output, use_all_p);
}
return;
@@ -881,6 +882,7 @@ sra_walk_expr (tree *expr_p, block_stmt_iterator *bsi, bool is_output,
goto use_all;
case NOP_EXPR:
+ case CONVERT_EXPR:
/* Similarly, a nop explicitly wants to look at an object in a
type other than the one we've scalarized. */
goto use_all;
@@ -916,60 +918,62 @@ sra_walk_expr (tree *expr_p, block_stmt_iterator *bsi, bool is_output,
}
}
-/* Walk a TREE_LIST of values looking for scalarizable aggregates.
+/* Walk the arguments of a GIMPLE_CALL looking for scalarizable aggregates.
If we find one, invoke FNS->USE. */
static void
-sra_walk_tree_list (tree list, block_stmt_iterator *bsi, bool is_output,
- const struct sra_walk_fns *fns)
-{
- tree op;
- for (op = list; op ; op = TREE_CHAIN (op))
- sra_walk_expr (&TREE_VALUE (op), bsi, is_output, fns);
-}
-
-/* Walk the arguments of a CALL_EXPR looking for scalarizable aggregates.
- If we find one, invoke FNS->USE. */
-
-static void
-sra_walk_call_expr (tree expr, block_stmt_iterator *bsi,
+sra_walk_gimple_call (gimple stmt, gimple_stmt_iterator *gsi,
const struct sra_walk_fns *fns)
{
int i;
- int nargs = call_expr_nargs (expr);
+ int nargs = gimple_call_num_args (stmt);
+
for (i = 0; i < nargs; i++)
- sra_walk_expr (&CALL_EXPR_ARG (expr, i), bsi, false, fns);
+ sra_walk_expr (gimple_call_arg_ptr (stmt, i), gsi, false, fns);
+
+ if (gimple_call_lhs (stmt))
+ sra_walk_expr (gimple_call_lhs_ptr (stmt), gsi, true, fns);
}
-/* Walk the inputs and outputs of an ASM_EXPR looking for scalarizable
+/* Walk the inputs and outputs of a GIMPLE_ASM looking for scalarizable
aggregates. If we find one, invoke FNS->USE. */
static void
-sra_walk_asm_expr (tree expr, block_stmt_iterator *bsi,
+sra_walk_gimple_asm (gimple stmt, gimple_stmt_iterator *gsi,
const struct sra_walk_fns *fns)
{
- sra_walk_tree_list (ASM_INPUTS (expr), bsi, false, fns);
- sra_walk_tree_list (ASM_OUTPUTS (expr), bsi, true, fns);
+ size_t i;
+ for (i = 0; i < gimple_asm_ninputs (stmt); i++)
+ sra_walk_expr (&TREE_VALUE (gimple_asm_input_op (stmt, i)), gsi, false, fns);
+ for (i = 0; i < gimple_asm_noutputs (stmt); i++)
+ sra_walk_expr (&TREE_VALUE (gimple_asm_output_op (stmt, i)), gsi, true, fns);
}
-/* Walk a GIMPLE_MODIFY_STMT and categorize the assignment appropriately. */
+/* Walk a GIMPLE_ASSIGN and categorize the assignment appropriately. */
static void
-sra_walk_gimple_modify_stmt (tree expr, block_stmt_iterator *bsi,
- const struct sra_walk_fns *fns)
+sra_walk_gimple_assign (gimple stmt, gimple_stmt_iterator *gsi,
+ const struct sra_walk_fns *fns)
{
- struct sra_elt *lhs_elt, *rhs_elt;
+ struct sra_elt *lhs_elt = NULL, *rhs_elt = NULL;
tree lhs, rhs;
- lhs = GIMPLE_STMT_OPERAND (expr, 0);
- rhs = GIMPLE_STMT_OPERAND (expr, 1);
+ /* If there is more than 1 element on the RHS, only walk the lhs. */
+ if (!gimple_assign_single_p (stmt))
+ {
+ sra_walk_expr (gimple_assign_lhs_ptr (stmt), gsi, true, fns);
+ return;
+ }
+
+ lhs = gimple_assign_lhs (stmt);
+ rhs = gimple_assign_rhs1 (stmt);
lhs_elt = maybe_lookup_element_for_expr (lhs);
rhs_elt = maybe_lookup_element_for_expr (rhs);
/* If both sides are scalarizable, this is a COPY operation. */
if (lhs_elt && rhs_elt)
{
- fns->copy (lhs_elt, rhs_elt, bsi);
+ fns->copy (lhs_elt, rhs_elt, gsi);
return;
}
@@ -977,9 +981,9 @@ sra_walk_gimple_modify_stmt (tree expr, block_stmt_iterator *bsi,
if (rhs_elt)
{
if (!rhs_elt->is_scalar && !TREE_SIDE_EFFECTS (lhs))
- fns->ldst (rhs_elt, lhs, bsi, false);
+ fns->ldst (rhs_elt, lhs, gsi, false);
else
- fns->use (rhs_elt, &GIMPLE_STMT_OPERAND (expr, 1), bsi, false, false);
+ fns->use (rhs_elt, gimple_assign_rhs1_ptr (stmt), gsi, false, false);
}
/* If it isn't scalarizable, there may be scalarizable variables within, so
@@ -988,13 +992,7 @@ sra_walk_gimple_modify_stmt (tree expr, block_stmt_iterator *bsi,
that the statements get inserted in the proper place, before any
copy-out operations. */
else
- {
- tree call = get_call_expr_in (rhs);
- if (call)
- sra_walk_call_expr (call, bsi, fns);
- else
- sra_walk_expr (&GIMPLE_STMT_OPERAND (expr, 1), bsi, false, fns);
- }
+ sra_walk_expr (gimple_assign_rhs1_ptr (stmt), gsi, false, fns);
/* Likewise, handle the LHS being scalarizable. We have cases similar
to those above, but also want to handle RHS being constant. */
@@ -1005,7 +1003,7 @@ sra_walk_gimple_modify_stmt (tree expr, block_stmt_iterator *bsi,
if (TREE_CODE (rhs) == COMPLEX_EXPR
|| TREE_CODE (rhs) == COMPLEX_CST
|| TREE_CODE (rhs) == CONSTRUCTOR)
- fns->init (lhs_elt, rhs, bsi);
+ fns->init (lhs_elt, rhs, gsi);
/* If this is an assignment from read-only memory, treat this as if
we'd been passed the constructor directly. Invoke INIT. */
@@ -1013,7 +1011,7 @@ sra_walk_gimple_modify_stmt (tree expr, block_stmt_iterator *bsi,
&& TREE_STATIC (rhs)
&& TREE_READONLY (rhs)
&& targetm.binds_local_p (rhs))
- fns->init (lhs_elt, DECL_INITIAL (rhs), bsi);
+ fns->init (lhs_elt, DECL_INITIAL (rhs), gsi);
/* If this is a copy from a non-scalarizable lvalue, invoke LDST.
The lvalue requirement prevents us from trying to directly scalarize
@@ -1021,19 +1019,19 @@ sra_walk_gimple_modify_stmt (tree expr, block_stmt_iterator *bsi,
the function multiple times, and other evil things. */
else if (!lhs_elt->is_scalar
&& !TREE_SIDE_EFFECTS (rhs) && is_gimple_addressable (rhs))
- fns->ldst (lhs_elt, rhs, bsi, true);
+ fns->ldst (lhs_elt, rhs, gsi, true);
/* Otherwise we're being used in some context that requires the
aggregate to be seen as a whole. Invoke USE. */
else
- fns->use (lhs_elt, &GIMPLE_STMT_OPERAND (expr, 0), bsi, true, false);
+ fns->use (lhs_elt, gimple_assign_lhs_ptr (stmt), gsi, true, false);
}
/* Similarly to above, LHS_ELT being null only means that the LHS as a
whole is not a scalarizable reference. There may be occurrences of
scalarizable variables within, which implies a USE. */
else
- sra_walk_expr (&GIMPLE_STMT_OPERAND (expr, 0), bsi, true, fns);
+ sra_walk_expr (gimple_assign_lhs_ptr (stmt), gsi, true, fns);
}
/* Entry point to the walk functions. Search the entire function,
@@ -1044,22 +1042,20 @@ static void
sra_walk_function (const struct sra_walk_fns *fns)
{
basic_block bb;
- block_stmt_iterator si, ni;
+ gimple_stmt_iterator si, ni;
/* ??? Phase 4 could derive some benefit to walking the function in
dominator tree order. */
FOR_EACH_BB (bb)
- for (si = bsi_start (bb); !bsi_end_p (si); si = ni)
+ for (si = gsi_start_bb (bb); !gsi_end_p (si); si = ni)
{
- tree stmt, t;
- stmt_ann_t ann;
+ gimple stmt;
- stmt = bsi_stmt (si);
- ann = stmt_ann (stmt);
+ stmt = gsi_stmt (si);
ni = si;
- bsi_next (&ni);
+ gsi_next (&ni);
/* If the statement has no virtual operands, then it doesn't
make any structure references that we care about. */
@@ -1067,35 +1063,28 @@ sra_walk_function (const struct sra_walk_fns *fns)
&& ZERO_SSA_OPERANDS (stmt, (SSA_OP_VIRTUAL_DEFS | SSA_OP_VUSE)))
continue;
- switch (TREE_CODE (stmt))
+ switch (gimple_code (stmt))
{
- case RETURN_EXPR:
+ case GIMPLE_RETURN:
/* If we have "return <retval>" then the return value is
already exposed for our pleasure. Walk it as a USE to
force all the components back in place for the return.
-
- If we have an embedded assignment, then <retval> is of
- a type that gets returned in registers in this ABI, and
- we do not wish to extend their lifetimes. Treat this
- as a USE of the variable on the RHS of this assignment. */
-
- t = TREE_OPERAND (stmt, 0);
- if (t == NULL_TREE)
+ */
+ if (gimple_return_retval (stmt) == NULL_TREE)
;
- else if (TREE_CODE (t) == GIMPLE_MODIFY_STMT)
- sra_walk_expr (&GIMPLE_STMT_OPERAND (t, 1), &si, false, fns);
else
- sra_walk_expr (&TREE_OPERAND (stmt, 0), &si, false, fns);
+ sra_walk_expr (gimple_return_retval_ptr (stmt), &si, false,
+ fns);
break;
- case GIMPLE_MODIFY_STMT:
- sra_walk_gimple_modify_stmt (stmt, &si, fns);
+ case GIMPLE_ASSIGN:
+ sra_walk_gimple_assign (stmt, &si, fns);
break;
- case CALL_EXPR:
- sra_walk_call_expr (stmt, &si, fns);
+ case GIMPLE_CALL:
+ sra_walk_gimple_call (stmt, &si, fns);
break;
- case ASM_EXPR:
- sra_walk_asm_expr (stmt, &si, fns);
+ case GIMPLE_ASM:
+ sra_walk_gimple_asm (stmt, &si, fns);
break;
default:
@@ -1136,7 +1125,7 @@ find_candidates_for_sra (void)
static void
scan_use (struct sra_elt *elt, tree *expr_p ATTRIBUTE_UNUSED,
- block_stmt_iterator *bsi ATTRIBUTE_UNUSED,
+ gimple_stmt_iterator *gsi ATTRIBUTE_UNUSED,
bool is_output ATTRIBUTE_UNUSED, bool use_all ATTRIBUTE_UNUSED)
{
elt->n_uses += 1;
@@ -1144,7 +1133,7 @@ scan_use (struct sra_elt *elt, tree *expr_p ATTRIBUTE_UNUSED,
static void
scan_copy (struct sra_elt *lhs_elt, struct sra_elt *rhs_elt,
- block_stmt_iterator *bsi ATTRIBUTE_UNUSED)
+ gimple_stmt_iterator *gsi ATTRIBUTE_UNUSED)
{
lhs_elt->n_copies += 1;
rhs_elt->n_copies += 1;
@@ -1152,14 +1141,14 @@ scan_copy (struct sra_elt *lhs_elt, struct sra_elt *rhs_elt,
static void
scan_init (struct sra_elt *lhs_elt, tree rhs ATTRIBUTE_UNUSED,
- block_stmt_iterator *bsi ATTRIBUTE_UNUSED)
+ gimple_stmt_iterator *gsi ATTRIBUTE_UNUSED)
{
lhs_elt->n_copies += 1;
}
static void
scan_ldst (struct sra_elt *elt, tree other ATTRIBUTE_UNUSED,
- block_stmt_iterator *bsi ATTRIBUTE_UNUSED,
+ gimple_stmt_iterator *gsi ATTRIBUTE_UNUSED,
bool is_output ATTRIBUTE_UNUSED)
{
elt->n_copies += 1;
@@ -1350,10 +1339,12 @@ instantiate_element (struct sra_elt *elt)
|| (var != elt->replacement
&& TREE_CODE (elt->replacement) == BIT_FIELD_REF))
{
- tree init = sra_build_assignment (var, fold_convert (TREE_TYPE (var),
- integer_zero_node));
- insert_edge_copies (init, ENTRY_BLOCK_PTR);
- mark_all_v_defs (init);
+ gimple_seq init = sra_build_assignment (var,
+ fold_convert (TREE_TYPE (var),
+ integer_zero_node)
+ );
+ insert_edge_copies_seq (init, ENTRY_BLOCK_PTR);
+ mark_all_v_defs_seq (init);
}
if (dump_file)
@@ -2030,7 +2021,7 @@ decide_instantiations (void)
non-scalar. */
static void
-mark_all_v_defs_1 (tree stmt)
+mark_all_v_defs_stmt (gimple stmt)
{
tree sym;
ssa_op_iter iter;
@@ -2050,18 +2041,13 @@ mark_all_v_defs_1 (tree stmt)
LIST for renaming. */
static void
-mark_all_v_defs (tree list)
+mark_all_v_defs_seq (gimple_seq seq)
{
- if (TREE_CODE (list) != STATEMENT_LIST)
- mark_all_v_defs_1 (list);
- else
- {
- tree_stmt_iterator i;
- for (i = tsi_start (list); !tsi_end_p (i); tsi_next (&i))
- mark_all_v_defs_1 (tsi_stmt (i));
- }
-}
+ gimple_stmt_iterator gsi;
+ for (gsi = gsi_start (seq); !gsi_end_p (gsi); gsi_next (&gsi))
+ mark_all_v_defs_stmt (gsi_stmt (gsi));
+}
/* Mark every replacement under ELT with TREE_NO_WARNING. */
@@ -2155,9 +2141,11 @@ scalar_bitfield_p (tree bf)
/* Create an assignment statement from SRC to DST. */
-static tree
+static gimple_seq
sra_build_assignment (tree dst, tree src)
{
+ gimple stmt;
+ gimple_seq seq = NULL;
/* Turning BIT_FIELD_REFs into bit operations enables other passes
to do a much better job at optimizing the code.
From dst = BIT_FIELD_REF <var, sz, off> we produce
@@ -2172,7 +2160,6 @@ sra_build_assignment (tree dst, tree src)
{
tree var, shift, width;
tree utype, stype, stmp, utmp, dtmp;
- tree list, stmt;
bool unsignedp = (INTEGRAL_TYPE_P (TREE_TYPE (src))
? TYPE_UNSIGNED (TREE_TYPE (src)) : true);
@@ -2205,7 +2192,6 @@ sra_build_assignment (tree dst, tree src)
else if (!TYPE_UNSIGNED (utype))
utype = unsigned_type_for (utype);
- list = NULL;
stmp = make_rename_temp (stype, "SR");
/* Convert the base var of the BIT_FIELD_REF to the scalar type
@@ -2213,22 +2199,19 @@ sra_build_assignment (tree dst, tree src)
if (!useless_type_conversion_p (stype, TREE_TYPE (var)))
{
if (INTEGRAL_TYPE_P (TREE_TYPE (var)))
- stmt = build_gimple_modify_stmt (stmp,
- fold_convert (stype, var));
+ stmt = gimple_build_assign (stmp, fold_convert (stype, var));
else
- stmt = build_gimple_modify_stmt (stmp,
- fold_build1 (VIEW_CONVERT_EXPR,
- stype, var));
- append_to_statement_list (stmt, &list);
+ stmt = gimple_build_assign (stmp, fold_build1 (VIEW_CONVERT_EXPR,
+ stype, var));
+ gimple_seq_add_stmt (&seq, stmt);
var = stmp;
}
if (!integer_zerop (shift))
{
- stmt = build_gimple_modify_stmt (stmp,
- fold_build2 (RSHIFT_EXPR, stype,
- var, shift));
- append_to_statement_list (stmt, &list);
+ stmt = gimple_build_assign (stmp, fold_build2 (RSHIFT_EXPR, stype,
+ var, shift));
+ gimple_seq_add_stmt (&seq, stmt);
var = stmp;
}
@@ -2241,10 +2224,9 @@ sra_build_assignment (tree dst, tree src)
tree mask = int_const_binop (LSHIFT_EXPR, one, width, 0);
mask = int_const_binop (MINUS_EXPR, mask, one, 0);
- stmt = build_gimple_modify_stmt (stmp,
- fold_build2 (BIT_AND_EXPR, stype,
- var, mask));
- append_to_statement_list (stmt, &list);
+ stmt = gimple_build_assign (stmp, fold_build2 (BIT_AND_EXPR, stype,
+ var, mask));
+ gimple_seq_add_stmt (&seq, stmt);
var = stmp;
}
@@ -2254,8 +2236,8 @@ sra_build_assignment (tree dst, tree src)
{
utmp = make_rename_temp (utype, "SR");
- stmt = build_gimple_modify_stmt (utmp, fold_convert (utype, var));
- append_to_statement_list (stmt, &list);
+ stmt = gimple_build_assign (utmp, fold_convert (utype, var));
+ gimple_seq_add_stmt (&seq, stmt);
var = utmp;
}
@@ -2269,15 +2251,13 @@ sra_build_assignment (tree dst, tree src)
size_binop (MINUS_EXPR, width,
bitsize_int (1)), 0);
- stmt = build_gimple_modify_stmt (utmp,
- fold_build2 (BIT_XOR_EXPR, utype,
- var, signbit));
- append_to_statement_list (stmt, &list);
+ stmt = gimple_build_assign (utmp, fold_build2 (BIT_XOR_EXPR, utype,
+ var, signbit));
+ gimple_seq_add_stmt (&seq, stmt);
- stmt = build_gimple_modify_stmt (utmp,
- fold_build2 (MINUS_EXPR, utype,
- utmp, signbit));
- append_to_statement_list (stmt, &list);
+ stmt = gimple_build_assign (utmp, fold_build2 (MINUS_EXPR, utype,
+ utmp, signbit));
+ gimple_seq_add_stmt (&seq, stmt);
var = utmp;
}
@@ -2298,15 +2278,15 @@ sra_build_assignment (tree dst, tree src)
if (!is_gimple_reg (dst))
{
dtmp = make_rename_temp (TREE_TYPE (dst), "SR");
- stmt = build_gimple_modify_stmt (dtmp, var);
- append_to_statement_list (stmt, &list);
+ stmt = gimple_build_assign (dtmp, var);
+ gimple_seq_add_stmt (&seq, stmt);
var = dtmp;
}
}
- stmt = build_gimple_modify_stmt (dst, var);
- append_to_statement_list (stmt, &list);
+ stmt = gimple_build_assign (dst, var);
+ gimple_seq_add_stmt (&seq, stmt);
- return list;
+ return seq;
}
/* fold_build3 (BIT_FIELD_REF, ...) sometimes returns a cast. */
@@ -2329,7 +2309,9 @@ sra_build_assignment (tree dst, tree src)
&& !useless_type_conversion_p (TREE_TYPE (dst), TREE_TYPE (src)))
src = fold_convert (TREE_TYPE (dst), src);
- return build_gimple_modify_stmt (dst, src);
+ stmt = gimple_build_assign (dst, src);
+ gimple_seq_add_stmt (&seq, stmt);
+ return seq;
}
/* BIT_FIELD_REFs must not be shared. sra_build_elt_assignment()
@@ -2339,11 +2321,12 @@ sra_build_assignment (tree dst, tree src)
/* Emit an assignment from SRC to DST, but if DST is a scalarizable
BIT_FIELD_REF, turn it into bit operations. */
-static tree
+static gimple_seq
sra_build_bf_assignment (tree dst, tree src)
{
tree var, type, utype, tmp, tmp2, tmp3;
- tree list, stmt;
+ gimple_seq seq;
+ gimple stmt;
tree cst, cst2, mask;
tree minshift, maxshift;
@@ -2355,7 +2338,7 @@ sra_build_bf_assignment (tree dst, tree src)
if (!scalar_bitfield_p (dst))
return sra_build_assignment (REPLDUP (dst), src);
- list = NULL;
+ seq = NULL;
cst = fold_convert (bitsizetype, TREE_OPERAND (dst, 2));
cst2 = size_binop (PLUS_EXPR,
@@ -2404,11 +2387,11 @@ sra_build_bf_assignment (tree dst, tree src)
tmp2 = make_rename_temp (utype, "SR");
if (INTEGRAL_TYPE_P (TREE_TYPE (var)))
- stmt = build_gimple_modify_stmt (tmp2, fold_convert (utype, tmp));
+ stmt = gimple_build_assign (tmp2, fold_convert (utype, tmp));
else
- stmt = build_gimple_modify_stmt (tmp2, fold_build1 (VIEW_CONVERT_EXPR,
- utype, tmp));
- append_to_statement_list (stmt, &list);
+ stmt = gimple_build_assign (tmp2, fold_build1 (VIEW_CONVERT_EXPR,
+ utype, tmp));
+ gimple_seq_add_stmt (&seq, stmt);
}
else
tmp2 = var;
@@ -2416,10 +2399,9 @@ sra_build_bf_assignment (tree dst, tree src)
if (!integer_zerop (mask))
{
tmp = make_rename_temp (utype, "SR");
- stmt = build_gimple_modify_stmt (tmp,
- fold_build2 (BIT_AND_EXPR, utype,
+ stmt = gimple_build_assign (tmp, fold_build2 (BIT_AND_EXPR, utype,
tmp2, mask));
- append_to_statement_list (stmt, &list);
+ gimple_seq_add_stmt (&seq, stmt);
}
else
tmp = mask;
@@ -2428,28 +2410,31 @@ sra_build_bf_assignment (tree dst, tree src)
tmp2 = src;
else if (INTEGRAL_TYPE_P (TREE_TYPE (src)))
{
+ gimple_seq tmp_seq;
tmp2 = make_rename_temp (TREE_TYPE (src), "SR");
- stmt = sra_build_assignment (tmp2, src);
- append_to_statement_list (stmt, &list);
+ tmp_seq = sra_build_assignment (tmp2, src);
+ gimple_seq_add_seq (&seq, tmp_seq);
}
else
{
+ gimple_seq tmp_seq;
tmp2 = make_rename_temp
(lang_hooks.types.type_for_size
(TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (src))),
1), "SR");
- stmt = sra_build_assignment (tmp2, fold_build1 (VIEW_CONVERT_EXPR,
+ tmp_seq = sra_build_assignment (tmp2, fold_build1 (VIEW_CONVERT_EXPR,
TREE_TYPE (tmp2), src));
- append_to_statement_list (stmt, &list);
+ gimple_seq_add_seq (&seq, tmp_seq);
}
if (!TYPE_UNSIGNED (TREE_TYPE (tmp2)))
{
+ gimple_seq tmp_seq;
tree ut = unsigned_type_for (TREE_TYPE (tmp2));
tmp3 = make_rename_temp (ut, "SR");
tmp2 = fold_convert (ut, tmp2);
- stmt = sra_build_assignment (tmp3, tmp2);
- append_to_statement_list (stmt, &list);
+ tmp_seq = sra_build_assignment (tmp3, tmp2);
+ gimple_seq_add_seq (&seq, tmp_seq);
tmp2 = fold_build1 (BIT_NOT_EXPR, utype, mask);
tmp2 = int_const_binop (RSHIFT_EXPR, tmp2, minshift, true);
@@ -2459,8 +2444,8 @@ sra_build_bf_assignment (tree dst, tree src)
if (tmp3 != tmp2)
{
tmp3 = make_rename_temp (ut, "SR");
- stmt = sra_build_assignment (tmp3, tmp2);
- append_to_statement_list (stmt, &list);
+ tmp_seq = sra_build_assignment (tmp3, tmp2);
+ gimple_seq_add_seq (&seq, tmp_seq);
}
tmp2 = tmp3;
@@ -2468,20 +2453,20 @@ sra_build_bf_assignment (tree dst, tree src)
if (TYPE_MAIN_VARIANT (TREE_TYPE (tmp2)) != TYPE_MAIN_VARIANT (utype))
{
+ gimple_seq tmp_seq;
tmp3 = make_rename_temp (utype, "SR");
tmp2 = fold_convert (utype, tmp2);
- stmt = sra_build_assignment (tmp3, tmp2);
- append_to_statement_list (stmt, &list);
+ tmp_seq = sra_build_assignment (tmp3, tmp2);
+ gimple_seq_add_seq (&seq, tmp_seq);
tmp2 = tmp3;
}
if (!integer_zerop (minshift))
{
tmp3 = make_rename_temp (utype, "SR");
- stmt = build_gimple_modify_stmt (tmp3,
- fold_build2 (LSHIFT_EXPR, utype,
- tmp2, minshift));
- append_to_statement_list (stmt, &list);
+ stmt = gimple_build_assign (tmp3, fold_build2 (LSHIFT_EXPR, utype,
+ tmp2, minshift));
+ gimple_seq_add_stmt (&seq, stmt);
tmp2 = tmp3;
}
@@ -2489,35 +2474,34 @@ sra_build_bf_assignment (tree dst, tree src)
tmp3 = make_rename_temp (utype, "SR");
else
tmp3 = var;
- stmt = build_gimple_modify_stmt (tmp3,
- fold_build2 (BIT_IOR_EXPR, utype,
- tmp, tmp2));
- append_to_statement_list (stmt, &list);
+ stmt = gimple_build_assign (tmp3, fold_build2 (BIT_IOR_EXPR, utype,
+ tmp, tmp2));
+ gimple_seq_add_stmt (&seq, stmt);
if (tmp3 != var)
{
if (TREE_TYPE (var) == type)
- stmt = build_gimple_modify_stmt (var,
- fold_convert (type, tmp3));
+ stmt = gimple_build_assign (var, fold_convert (type, tmp3));
else
- stmt = build_gimple_modify_stmt (var,
- fold_build1 (VIEW_CONVERT_EXPR,
+ stmt = gimple_build_assign (var, fold_build1 (VIEW_CONVERT_EXPR,
TREE_TYPE (var), tmp3));
- append_to_statement_list (stmt, &list);
+ gimple_seq_add_stmt (&seq, stmt);
}
- return list;
+ return seq;
}
/* Expand an assignment of SRC to the scalarized representation of
ELT. If it is a field group, try to widen the assignment to cover
the full variable. */
-static tree
+static gimple_seq
sra_build_elt_assignment (struct sra_elt *elt, tree src)
{
tree dst = elt->replacement;
- tree var, tmp, cst, cst2, list, stmt;
+ tree var, tmp, cst, cst2;
+ gimple stmt;
+ gimple_seq seq;
if (TREE_CODE (dst) != BIT_FIELD_REF
|| !elt->in_bitfld_block)
@@ -2553,7 +2537,8 @@ sra_build_elt_assignment (struct sra_elt *elt, tree src)
if (TYPE_MAIN_VARIANT (TREE_TYPE (var))
!= TYPE_MAIN_VARIANT (TREE_TYPE (src)))
{
- list = NULL;
+ gimple_seq tmp_seq;
+ seq = NULL;
if (!INTEGRAL_TYPE_P (TREE_TYPE (src)))
src = fold_build1 (VIEW_CONVERT_EXPR,
@@ -2564,15 +2549,15 @@ sra_build_elt_assignment (struct sra_elt *elt, tree src)
gcc_assert (TYPE_UNSIGNED (TREE_TYPE (src)));
tmp = make_rename_temp (TREE_TYPE (src), "SR");
- stmt = build_gimple_modify_stmt (tmp, src);
- append_to_statement_list (stmt, &list);
+ stmt = gimple_build_assign (tmp, src);
+ gimple_seq_add_stmt (&seq, stmt);
- stmt = sra_build_assignment (var,
- fold_convert (TREE_TYPE (var),
- tmp));
- append_to_statement_list (stmt, &list);
+ tmp_seq = sra_build_assignment (var,
+ fold_convert (TREE_TYPE (var),
+ tmp));
+ gimple_seq_add_seq (&seq, tmp_seq);
- return list;
+ return seq;
}
src = fold_convert (TREE_TYPE (var), src);
@@ -2595,9 +2580,10 @@ sra_build_elt_assignment (struct sra_elt *elt, tree src)
static void
generate_copy_inout (struct sra_elt *elt, bool copy_out, tree expr,
- tree *list_p)
+ gimple_seq *seq_p)
{
struct sra_elt *c;
+ gimple_seq tmp_seq;
tree t;
if (!copy_out && TREE_CODE (expr) == SSA_NAME
@@ -2611,24 +2597,25 @@ generate_copy_inout (struct sra_elt *elt, bool copy_out, tree expr,
i = c->replacement;
t = build2 (COMPLEX_EXPR, elt->type, r, i);
- t = sra_build_bf_assignment (expr, t);
- SSA_NAME_DEF_STMT (expr) = t;
- append_to_statement_list (t, list_p);
+ tmp_seq = sra_build_bf_assignment (expr, t);
+ gcc_assert (gimple_seq_singleton_p (tmp_seq));
+ SSA_NAME_DEF_STMT (expr) = gimple_seq_first_stmt (tmp_seq);
+ gimple_seq_add_seq (seq_p, tmp_seq);
}
else if (elt->replacement)
{
if (copy_out)
- t = sra_build_elt_assignment (elt, expr);
+ tmp_seq = sra_build_elt_assignment (elt, expr);
else
- t = sra_build_bf_assignment (expr, REPLDUP (elt->replacement));
- append_to_statement_list (t, list_p);
+ tmp_seq = sra_build_bf_assignment (expr, REPLDUP (elt->replacement));
+ gimple_seq_add_seq (seq_p, tmp_seq);
}
else
{
FOR_EACH_ACTUAL_CHILD (c, elt)
{
t = generate_one_element_ref (c, unshare_expr (expr));
- generate_copy_inout (c, copy_out, t, list_p);
+ generate_copy_inout (c, copy_out, t, seq_p);
}
}
}
@@ -2638,7 +2625,7 @@ generate_copy_inout (struct sra_elt *elt, bool copy_out, tree expr,
correspondence of instantiated elements. */
static void
-generate_element_copy (struct sra_elt *dst, struct sra_elt *src, tree *list_p)
+generate_element_copy (struct sra_elt *dst, struct sra_elt *src, gimple_seq *seq_p)
{
struct sra_elt *dc, *sc;
@@ -2653,7 +2640,7 @@ generate_element_copy (struct sra_elt *dst, struct sra_elt *src, tree *list_p)
{
sc = lookup_element (src, dcs->element, NULL, NO_INSERT);
gcc_assert (sc);
- generate_element_copy (dcs, sc, list_p);
+ generate_element_copy (dcs, sc, seq_p);
}
continue;
@@ -2685,17 +2672,17 @@ generate_element_copy (struct sra_elt *dst, struct sra_elt *src, tree *list_p)
sc = lookup_element (src, f, NULL, NO_INSERT);
}
- generate_element_copy (dc, sc, list_p);
+ generate_element_copy (dc, sc, seq_p);
}
if (dst->replacement)
{
- tree t;
+ gimple_seq tmp_seq;
gcc_assert (src->replacement);
- t = sra_build_elt_assignment (dst, REPLDUP (src->replacement));
- append_to_statement_list (t, list_p);
+ tmp_seq = sra_build_elt_assignment (dst, REPLDUP (src->replacement));
+ gimple_seq_add_seq (seq_p, tmp_seq);
}
}
@@ -2705,7 +2692,7 @@ generate_element_copy (struct sra_elt *dst, struct sra_elt *src, tree *list_p)
with generate_element_init. */
static void
-generate_element_zero (struct sra_elt *elt, tree *list_p)
+generate_element_zero (struct sra_elt *elt, gimple_seq *seq_p)
{
struct sra_elt *c;
@@ -2717,17 +2704,18 @@ generate_element_zero (struct sra_elt *elt, tree *list_p)
if (!elt->in_bitfld_block)
FOR_EACH_ACTUAL_CHILD (c, elt)
- generate_element_zero (c, list_p);
+ generate_element_zero (c, seq_p);
if (elt->replacement)
{
tree t;
+ gimple_seq tmp_seq;
gcc_assert (elt->is_scalar);
t = fold_convert (elt->type, integer_zero_node);
- t = sra_build_elt_assignment (elt, t);
- append_to_statement_list (t, list_p);
+ tmp_seq = sra_build_elt_assignment (elt, t);
+ gimple_seq_add_seq (seq_p, tmp_seq);
}
}
@@ -2735,11 +2723,10 @@ generate_element_zero (struct sra_elt *elt, tree *list_p)
Add the result to *LIST_P. */
static void
-generate_one_element_init (struct sra_elt *elt, tree init, tree *list_p)
+generate_one_element_init (struct sra_elt *elt, tree init, gimple_seq *seq_p)
{
- /* The replacement can be almost arbitrarily complex. Gimplify. */
- tree stmt = sra_build_elt_assignment (elt, init);
- gimplify_and_add (stmt, list_p);
+ gimple_seq tmp_seq = sra_build_elt_assignment (elt, init);
+ gimple_seq_add_seq (seq_p, tmp_seq);
}
/* Generate a set of assignment statements in *LIST_P to set all instantiated
@@ -2749,7 +2736,7 @@ generate_one_element_init (struct sra_elt *elt, tree init, tree *list_p)
handle. */
static bool
-generate_element_init_1 (struct sra_elt *elt, tree init, tree *list_p)
+generate_element_init_1 (struct sra_elt *elt, tree init, gimple_seq *seq_p)
{
bool result = true;
enum tree_code init_code;
@@ -2767,7 +2754,7 @@ generate_element_init_1 (struct sra_elt *elt, tree init, tree *list_p)
{
if (elt->replacement)
{
- generate_one_element_init (elt, init, list_p);
+ generate_one_element_init (elt, init, seq_p);
elt->visited = true;
}
return result;
@@ -2785,7 +2772,7 @@ generate_element_init_1 (struct sra_elt *elt, tree init, tree *list_p)
else
t = (init_code == COMPLEX_EXPR
? TREE_OPERAND (init, 1) : TREE_IMAGPART (init));
- result &= generate_element_init_1 (sub, t, list_p);
+ result &= generate_element_init_1 (sub, t, seq_p);
}
break;
@@ -2801,7 +2788,7 @@ generate_element_init_1 (struct sra_elt *elt, tree init, tree *list_p)
{
sub = lookup_element (elt, lower, NULL, NO_INSERT);
if (sub != NULL)
- result &= generate_element_init_1 (sub, value, list_p);
+ result &= generate_element_init_1 (sub, value, seq_p);
if (tree_int_cst_equal (lower, upper))
break;
lower = int_const_binop (PLUS_EXPR, lower,
@@ -2812,7 +2799,7 @@ generate_element_init_1 (struct sra_elt *elt, tree init, tree *list_p)
{
sub = lookup_element (elt, purpose, NULL, NO_INSERT);
if (sub != NULL)
- result &= generate_element_init_1 (sub, value, list_p);
+ result &= generate_element_init_1 (sub, value, seq_p);
}
}
break;
@@ -2829,96 +2816,86 @@ generate_element_init_1 (struct sra_elt *elt, tree init, tree *list_p)
gimplification. */
static bool
-generate_element_init (struct sra_elt *elt, tree init, tree *list_p)
+generate_element_init (struct sra_elt *elt, tree init, gimple_seq *seq_p)
{
bool ret;
struct gimplify_ctx gctx;
push_gimplify_context (&gctx);
- ret = generate_element_init_1 (elt, init, list_p);
+ ret = generate_element_init_1 (elt, init, seq_p);
pop_gimplify_context (NULL);
/* The replacement can expose previously unreferenced variables. */
- if (ret && *list_p)
+ if (ret && *seq_p)
{
- tree_stmt_iterator i;
+ gimple_stmt_iterator i;
- for (i = tsi_start (*list_p); !tsi_end_p (i); tsi_next (&i))
- find_new_referenced_vars (tsi_stmt_ptr (i));
+ for (i = gsi_start (*seq_p); !gsi_end_p (i); gsi_next (&i))
+ find_new_referenced_vars (gsi_stmt (i));
}
return ret;
}
-/* Insert STMT on all the outgoing edges out of BB. Note that if BB
- has more than one edge, STMT will be replicated for each edge. Also,
- abnormal edges will be ignored. */
+/* Insert a gimple_seq SEQ on all the outgoing edges out of BB. Note that
+ if BB has more than one edge, STMT will be replicated for each edge.
+ Also, abnormal edges will be ignored. */
void
-insert_edge_copies (tree stmt, basic_block bb)
+insert_edge_copies_seq (gimple_seq seq, basic_block bb)
{
edge e;
edge_iterator ei;
- bool first_copy;
+ unsigned n_copies = -1;
- first_copy = true;
FOR_EACH_EDGE (e, ei, bb->succs)
- {
- /* We don't need to insert copies on abnormal edges. The
- value of the scalar replacement is not guaranteed to
- be valid through an abnormal edge. */
- if (!(e->flags & EDGE_ABNORMAL))
- {
- if (first_copy)
- {
- bsi_insert_on_edge (e, stmt);
- first_copy = false;
- }
- else
- bsi_insert_on_edge (e, unsave_expr_now (stmt));
- }
- }
+ if (!(e->flags & EDGE_ABNORMAL))
+ n_copies++;
+
+ FOR_EACH_EDGE (e, ei, bb->succs)
+ if (!(e->flags & EDGE_ABNORMAL))
+ gsi_insert_seq_on_edge (e, n_copies-- > 0 ? gimple_seq_copy (seq) : seq);
}
-/* Helper function to insert LIST before BSI, and set up line number info. */
+/* Helper function to insert LIST before GSI, and set up line number info. */
void
-sra_insert_before (block_stmt_iterator *bsi, tree list)
+sra_insert_before (gimple_stmt_iterator *gsi, gimple_seq seq)
{
- tree stmt = bsi_stmt (*bsi);
+ gimple stmt = gsi_stmt (*gsi);
- if (EXPR_HAS_LOCATION (stmt))
- annotate_all_with_locus (&list, EXPR_LOCATION (stmt));
- bsi_insert_before (bsi, list, BSI_SAME_STMT);
+ if (gimple_has_location (stmt))
+ annotate_all_with_location (seq, gimple_location (stmt));
+ gsi_insert_seq_before (gsi, seq, GSI_SAME_STMT);
}
-/* Similarly, but insert after BSI. Handles insertion onto edges as well. */
+/* Similarly, but insert after GSI. Handles insertion onto edges as well. */
void
-sra_insert_after (block_stmt_iterator *bsi, tree list)
+sra_insert_after (gimple_stmt_iterator *gsi, gimple_seq seq)
{
- tree stmt = bsi_stmt (*bsi);
+ gimple stmt = gsi_stmt (*gsi);
- if (EXPR_HAS_LOCATION (stmt))
- annotate_all_with_locus (&list, EXPR_LOCATION (stmt));
+ if (gimple_has_location (stmt))
+ annotate_all_with_location (seq, gimple_location (stmt));
if (stmt_ends_bb_p (stmt))
- insert_edge_copies (list, bsi->bb);
+ insert_edge_copies_seq (seq, gsi_bb (*gsi));
else
- bsi_insert_after (bsi, list, BSI_SAME_STMT);
+ gsi_insert_seq_after (gsi, seq, GSI_SAME_STMT);
}
-/* Similarly, but replace the statement at BSI. */
+/* Similarly, but replace the statement at GSI. */
static void
-sra_replace (block_stmt_iterator *bsi, tree list)
+sra_replace (gimple_stmt_iterator *gsi, gimple_seq seq)
{
- sra_insert_before (bsi, list);
- bsi_remove (bsi, false);
- if (bsi_end_p (*bsi))
- *bsi = bsi_last (bsi->bb);
+ sra_insert_before (gsi, seq);
+ gsi_remove (gsi, false);
+ if (gsi_end_p (*gsi))
+ *gsi = gsi_last (gsi_seq (*gsi));
else
- bsi_prev (bsi);
+ gsi_prev (gsi);
}
/* Data structure that bitfield_overlaps_p fills in with information
@@ -3032,7 +3009,7 @@ bitfield_overlaps_p (tree blen, tree bpos, struct sra_elt *fld,
static void
sra_explode_bitfield_assignment (tree var, tree vpos, bool to_var,
- tree *listp, tree blen, tree bpos,
+ gimple_seq *seq_p, tree blen, tree bpos,
struct sra_elt *elt)
{
struct sra_elt *fld;
@@ -3050,7 +3027,8 @@ sra_explode_bitfield_assignment (tree var, tree vpos, bool to_var,
if (fld->replacement)
{
- tree infld, invar, st, type;
+ tree infld, invar, type;
+ gimple_seq st;
infld = fld->replacement;
@@ -3089,7 +3067,7 @@ sra_explode_bitfield_assignment (tree var, tree vpos, bool to_var,
else
st = sra_build_bf_assignment (infld, invar);
- append_to_statement_list (st, listp);
+ gimple_seq_add_seq (seq_p, st);
}
else
{
@@ -3098,7 +3076,7 @@ sra_explode_bitfield_assignment (tree var, tree vpos, bool to_var,
if (flp.overlap_pos)
sub = size_binop (PLUS_EXPR, sub, flp.overlap_pos);
- sra_explode_bitfield_assignment (var, sub, to_var, listp,
+ sra_explode_bitfield_assignment (var, sub, to_var, seq_p,
flen, fpos, fld);
}
}
@@ -3111,7 +3089,8 @@ sra_explode_bitfield_assignment (tree var, tree vpos, bool to_var,
full variable back to the scalarized variables. */
static void
-sra_sync_for_bitfield_assignment (tree *listbeforep, tree *listafterp,
+sra_sync_for_bitfield_assignment (gimple_seq *seq_before_p,
+ gimple_seq *seq_after_p,
tree blen, tree bpos,
struct sra_elt *elt)
{
@@ -3124,18 +3103,18 @@ sra_sync_for_bitfield_assignment (tree *listbeforep, tree *listafterp,
if (fld->replacement || (!flp.overlap_len && !flp.overlap_pos))
{
generate_copy_inout (fld, false, generate_element_ref (fld),
- listbeforep);
+ seq_before_p);
mark_no_warning (fld);
- if (listafterp)
+ if (seq_after_p)
generate_copy_inout (fld, true, generate_element_ref (fld),
- listafterp);
+ seq_after_p);
}
else
{
tree flen = flp.overlap_len ? flp.overlap_len : flp.field_len;
tree fpos = flp.overlap_pos ? flp.overlap_pos : bitsize_int (0);
- sra_sync_for_bitfield_assignment (listbeforep, listafterp,
+ sra_sync_for_bitfield_assignment (seq_before_p, seq_after_p,
flen, fpos, fld);
}
}
@@ -3146,10 +3125,10 @@ sra_sync_for_bitfield_assignment (tree *listbeforep, tree *listafterp,
aggregate. IS_OUTPUT is true if ELT is being modified. */
static void
-scalarize_use (struct sra_elt *elt, tree *expr_p, block_stmt_iterator *bsi,
+scalarize_use (struct sra_elt *elt, tree *expr_p, gimple_stmt_iterator *gsi,
bool is_output, bool use_all)
{
- tree stmt = bsi_stmt (*bsi);
+ gimple stmt = gsi_stmt (*gsi);
tree bfexpr;
if (elt->replacement)
@@ -3161,52 +3140,43 @@ scalarize_use (struct sra_elt *elt, tree *expr_p, block_stmt_iterator *bsi,
if (is_output
&& TREE_CODE (elt->replacement) == BIT_FIELD_REF
&& is_gimple_reg (TREE_OPERAND (elt->replacement, 0))
- && TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
- && &GIMPLE_STMT_OPERAND (stmt, 0) == expr_p)
+ && is_gimple_assign (stmt)
+ && gimple_assign_lhs_ptr (stmt) == expr_p)
{
- tree newstmt = sra_build_elt_assignment
- (elt, GIMPLE_STMT_OPERAND (stmt, 1));
- if (TREE_CODE (newstmt) != STATEMENT_LIST)
- {
- tree list = NULL;
- append_to_statement_list (newstmt, &list);
- newstmt = list;
- }
- sra_replace (bsi, newstmt);
+ gimple_seq newseq;
+ /* RHS must be a single operand. */
+ gcc_assert (gimple_assign_single_p (stmt));
+ newseq = sra_build_elt_assignment (elt, gimple_assign_rhs1 (stmt));
+ sra_replace (gsi, newseq);
return;
}
else if (!is_output
&& TREE_CODE (elt->replacement) == BIT_FIELD_REF
- && TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
- && &GIMPLE_STMT_OPERAND (stmt, 1) == expr_p)
+ && is_gimple_assign (stmt)
+ && gimple_assign_rhs1_ptr (stmt) == expr_p)
{
tree tmp = make_rename_temp
- (TREE_TYPE (GIMPLE_STMT_OPERAND (stmt, 0)), "SR");
- tree newstmt = sra_build_assignment (tmp, REPLDUP (elt->replacement));
+ (TREE_TYPE (gimple_assign_lhs (stmt)), "SR");
+ gimple_seq newseq = sra_build_assignment (tmp, REPLDUP (elt->replacement));
- if (TREE_CODE (newstmt) != STATEMENT_LIST)
- {
- tree list = NULL;
- append_to_statement_list (newstmt, &list);
- newstmt = list;
- }
- sra_insert_before (bsi, newstmt);
+ sra_insert_before (gsi, newseq);
replacement = tmp;
}
if (is_output)
- mark_all_v_defs (stmt);
+ mark_all_v_defs_stmt (stmt);
*expr_p = REPLDUP (replacement);
update_stmt (stmt);
}
else if (use_all && is_output
- && TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
+ && is_gimple_assign (stmt)
&& TREE_CODE (bfexpr
- = GIMPLE_STMT_OPERAND (stmt, 0)) == BIT_FIELD_REF
+ = gimple_assign_lhs (stmt)) == BIT_FIELD_REF
&& &TREE_OPERAND (bfexpr, 0) == expr_p
&& INTEGRAL_TYPE_P (TREE_TYPE (bfexpr))
&& TREE_CODE (TREE_TYPE (*expr_p)) == RECORD_TYPE)
{
- tree listbefore = NULL, listafter = NULL;
+ gimple_seq seq_before = NULL;
+ gimple_seq seq_after = NULL;
tree blen = fold_convert (bitsizetype, TREE_OPERAND (bfexpr, 1));
tree bpos = fold_convert (bitsizetype, TREE_OPERAND (bfexpr, 2));
bool update = false;
@@ -3214,18 +3184,18 @@ scalarize_use (struct sra_elt *elt, tree *expr_p, block_stmt_iterator *bsi,
if (!elt->use_block_copy)
{
tree type = TREE_TYPE (bfexpr);
- tree var = make_rename_temp (type, "SR"), tmp, st, vpos;
+ tree var = make_rename_temp (type, "SR"), tmp, vpos;
+ gimple st;
- GIMPLE_STMT_OPERAND (stmt, 0) = var;
+ gimple_assign_set_lhs (stmt, var);
update = true;
if (!TYPE_UNSIGNED (type))
{
type = unsigned_type_for (type);
tmp = make_rename_temp (type, "SR");
- st = build_gimple_modify_stmt (tmp,
- fold_convert (type, var));
- append_to_statement_list (st, &listafter);
+ st = gimple_build_assign (tmp, fold_convert (type, var));
+ gimple_seq_add_stmt (&seq_after, st);
var = tmp;
}
@@ -3238,35 +3208,35 @@ scalarize_use (struct sra_elt *elt, tree *expr_p, block_stmt_iterator *bsi,
else
vpos = bitsize_int (0);
sra_explode_bitfield_assignment
- (var, vpos, false, &listafter, blen, bpos, elt);
+ (var, vpos, false, &seq_after, blen, bpos, elt);
}
else
sra_sync_for_bitfield_assignment
- (&listbefore, &listafter, blen, bpos, elt);
+ (&seq_before, &seq_after, blen, bpos, elt);
- if (listbefore)
+ if (seq_before)
{
- mark_all_v_defs (listbefore);
- sra_insert_before (bsi, listbefore);
+ mark_all_v_defs_seq (seq_before);
+ sra_insert_before (gsi, seq_before);
}
- if (listafter)
+ if (seq_after)
{
- mark_all_v_defs (listafter);
- sra_insert_after (bsi, listafter);
+ mark_all_v_defs_seq (seq_after);
+ sra_insert_after (gsi, seq_after);
}
if (update)
update_stmt (stmt);
}
else if (use_all && !is_output
- && TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
+ && is_gimple_assign (stmt)
&& TREE_CODE (bfexpr
- = GIMPLE_STMT_OPERAND (stmt, 1)) == BIT_FIELD_REF
- && &TREE_OPERAND (GIMPLE_STMT_OPERAND (stmt, 1), 0) == expr_p
+ = gimple_assign_rhs1 (stmt)) == BIT_FIELD_REF
+ && &TREE_OPERAND (gimple_assign_rhs1 (stmt), 0) == expr_p
&& INTEGRAL_TYPE_P (TREE_TYPE (bfexpr))
&& TREE_CODE (TREE_TYPE (*expr_p)) == RECORD_TYPE)
{
- tree list = NULL;
+ gimple_seq seq = NULL;
tree blen = fold_convert (bitsizetype, TREE_OPERAND (bfexpr, 1));
tree bpos = fold_convert (bitsizetype, TREE_OPERAND (bfexpr, 2));
bool update = false;
@@ -3281,9 +3251,9 @@ scalarize_use (struct sra_elt *elt, tree *expr_p, block_stmt_iterator *bsi,
var = make_rename_temp (type, "SR");
- append_to_statement_list (build_gimple_modify_stmt
- (var, build_int_cst_wide (type, 0, 0)),
- &list);
+ gimple_seq_add_stmt (&seq,
+ gimple_build_assign
+ (var, build_int_cst_wide (type, 0, 0)));
/* If VAR is wider than BLEN bits, it is padded at the
most-significant end. We want to set VPOS such that
@@ -3294,19 +3264,19 @@ scalarize_use (struct sra_elt *elt, tree *expr_p, block_stmt_iterator *bsi,
else
vpos = bitsize_int (0);
sra_explode_bitfield_assignment
- (var, vpos, true, &list, blen, bpos, elt);
+ (var, vpos, true, &seq, blen, bpos, elt);
- GIMPLE_STMT_OPERAND (stmt, 1) = var;
+ gimple_assign_set_rhs1 (stmt, var);
update = true;
}
else
sra_sync_for_bitfield_assignment
- (&list, NULL, blen, bpos, elt);
+ (&seq, NULL, blen, bpos, elt);
- if (list)
+ if (seq)
{
- mark_all_v_defs (list);
- sra_insert_before (bsi, list);
+ mark_all_v_defs_seq (seq);
+ sra_insert_before (gsi, seq);
}
if (update)
@@ -3314,7 +3284,7 @@ scalarize_use (struct sra_elt *elt, tree *expr_p, block_stmt_iterator *bsi,
}
else
{
- tree list = NULL;
+ gimple_seq seq = NULL;
/* Otherwise we need some copies. If ELT is being read, then we
want to store all (modified) sub-elements back into the
@@ -3330,15 +3300,15 @@ scalarize_use (struct sra_elt *elt, tree *expr_p, block_stmt_iterator *bsi,
This optimization would be most effective if sra_walk_function
processed the blocks in dominator order. */
- generate_copy_inout (elt, is_output, generate_element_ref (elt), &list);
- if (list == NULL)
+ generate_copy_inout (elt, is_output, generate_element_ref (elt), &seq);
+ if (seq == NULL)
return;
- mark_all_v_defs (list);
+ mark_all_v_defs_seq (seq);
if (is_output)
- sra_insert_after (bsi, list);
+ sra_insert_after (gsi, seq);
else
{
- sra_insert_before (bsi, list);
+ sra_insert_before (gsi, seq);
if (use_all)
mark_no_warning (elt);
}
@@ -3350,21 +3320,24 @@ scalarize_use (struct sra_elt *elt, tree *expr_p, block_stmt_iterator *bsi,
static void
scalarize_copy (struct sra_elt *lhs_elt, struct sra_elt *rhs_elt,
- block_stmt_iterator *bsi)
+ gimple_stmt_iterator *gsi)
{
- tree list, stmt;
+ gimple_seq seq;
+ gimple stmt;
if (lhs_elt->replacement && rhs_elt->replacement)
{
/* If we have two scalar operands, modify the existing statement. */
- stmt = bsi_stmt (*bsi);
+ stmt = gsi_stmt (*gsi);
/* See the commentary in sra_walk_function concerning
RETURN_EXPR, and why we should never see one here. */
- gcc_assert (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT);
+ gcc_assert (is_gimple_assign (stmt));
+ gcc_assert (gimple_assign_copy_p (stmt));
- GIMPLE_STMT_OPERAND (stmt, 0) = lhs_elt->replacement;
- GIMPLE_STMT_OPERAND (stmt, 1) = REPLDUP (rhs_elt->replacement);
+
+ gimple_assign_set_lhs (stmt, lhs_elt->replacement);
+ gimple_assign_set_rhs1 (stmt, REPLDUP (rhs_elt->replacement));
update_stmt (stmt);
}
else if (lhs_elt->use_block_copy || rhs_elt->use_block_copy)
@@ -3377,22 +3350,22 @@ scalarize_copy (struct sra_elt *lhs_elt, struct sra_elt *rhs_elt,
would at least allow those elements that are instantiated in
both structures to be optimized well. */
- list = NULL;
+ seq = NULL;
generate_copy_inout (rhs_elt, false,
- generate_element_ref (rhs_elt), &list);
- if (list)
+ generate_element_ref (rhs_elt), &seq);
+ if (seq)
{
- mark_all_v_defs (list);
- sra_insert_before (bsi, list);
+ mark_all_v_defs_seq (seq);
+ sra_insert_before (gsi, seq);
}
- list = NULL;
+ seq = NULL;
generate_copy_inout (lhs_elt, true,
- generate_element_ref (lhs_elt), &list);
- if (list)
+ generate_element_ref (lhs_elt), &seq);
+ if (seq)
{
- mark_all_v_defs (list);
- sra_insert_after (bsi, list);
+ mark_all_v_defs_seq (seq);
+ sra_insert_after (gsi, seq);
}
}
else
@@ -3401,14 +3374,14 @@ scalarize_copy (struct sra_elt *lhs_elt, struct sra_elt *rhs_elt,
case perform pair-wise element assignments and replace the
original block copy statement. */
- stmt = bsi_stmt (*bsi);
- mark_all_v_defs (stmt);
+ stmt = gsi_stmt (*gsi);
+ mark_all_v_defs_stmt (stmt);
- list = NULL;
- generate_element_copy (lhs_elt, rhs_elt, &list);
- gcc_assert (list);
- mark_all_v_defs (list);
- sra_replace (bsi, list);
+ seq = NULL;
+ generate_element_copy (lhs_elt, rhs_elt, &seq);
+ gcc_assert (seq);
+ mark_all_v_defs_seq (seq);
+ sra_replace (gsi, seq);
}
}
@@ -3418,23 +3391,23 @@ scalarize_copy (struct sra_elt *lhs_elt, struct sra_elt *rhs_elt,
CONSTRUCTOR. */
static void
-scalarize_init (struct sra_elt *lhs_elt, tree rhs, block_stmt_iterator *bsi)
+scalarize_init (struct sra_elt *lhs_elt, tree rhs, gimple_stmt_iterator *gsi)
{
bool result = true;
- tree list = NULL, init_list = NULL;
+ gimple_seq seq = NULL, init_seq = NULL;
/* Generate initialization statements for all members extant in the RHS. */
if (rhs)
{
/* Unshare the expression just in case this is from a decl's initial. */
rhs = unshare_expr (rhs);
- result = generate_element_init (lhs_elt, rhs, &init_list);
+ result = generate_element_init (lhs_elt, rhs, &init_seq);
}
/* CONSTRUCTOR is defined such that any member not mentioned is assigned
a zero value. Initialize the rest of the instantiated elements. */
- generate_element_zero (lhs_elt, &list);
- append_to_statement_list (init_list, &list);
+ generate_element_zero (lhs_elt, &seq);
+ gimple_seq_add_seq (&seq, init_seq);
if (!result)
{
@@ -3444,11 +3417,11 @@ scalarize_init (struct sra_elt *lhs_elt, tree rhs, block_stmt_iterator *bsi)
constants. The easiest way to do this is to generate a complete
copy-out, and then follow that with the constant assignments
that we were able to build. DCE will clean things up. */
- tree list0 = NULL;
+ gimple_seq seq0 = NULL;
generate_copy_inout (lhs_elt, true, generate_element_ref (lhs_elt),
- &list0);
- append_to_statement_list (list, &list0);
- list = list0;
+ &seq0);
+ gimple_seq_add_seq (&seq0, seq);
+ seq = seq0;
}
if (lhs_elt->use_block_copy || !result)
@@ -3456,20 +3429,20 @@ scalarize_init (struct sra_elt *lhs_elt, tree rhs, block_stmt_iterator *bsi)
/* Since LHS is not fully instantiated, we must leave the structure
assignment in place. Treating this case differently from a USE
exposes constants to later optimizations. */
- if (list)
+ if (seq)
{
- mark_all_v_defs (list);
- sra_insert_after (bsi, list);
+ mark_all_v_defs_seq (seq);
+ sra_insert_after (gsi, seq);
}
}
else
{
/* The LHS is fully instantiated. The list of initializations
replaces the original structure assignment. */
- gcc_assert (list);
- mark_all_v_defs (bsi_stmt (*bsi));
- mark_all_v_defs (list);
- sra_replace (bsi, list);
+ gcc_assert (seq);
+ mark_all_v_defs_stmt (gsi_stmt (*gsi));
+ mark_all_v_defs_seq (seq);
+ sra_replace (gsi, seq);
}
}
@@ -3498,7 +3471,7 @@ mark_notrap (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
static void
scalarize_ldst (struct sra_elt *elt, tree other,
- block_stmt_iterator *bsi, bool is_output)
+ gimple_stmt_iterator *gsi, bool is_output)
{
/* Shouldn't have gotten called for a scalar. */
gcc_assert (!elt->replacement);
@@ -3507,7 +3480,7 @@ scalarize_ldst (struct sra_elt *elt, tree other,
{
/* Since ELT is not fully instantiated, we have to leave the
block copy in place. Treat this as a USE. */
- scalarize_use (elt, NULL, bsi, is_output, false);
+ scalarize_use (elt, NULL, gsi, is_output, false);
}
else
{
@@ -3515,19 +3488,21 @@ scalarize_ldst (struct sra_elt *elt, tree other,
case we can have each element stored/loaded directly to/from the
corresponding slot in OTHER. This avoids a block copy. */
- tree list = NULL, stmt = bsi_stmt (*bsi);
+ gimple_seq seq = NULL;
+ gimple stmt = gsi_stmt (*gsi);
- mark_all_v_defs (stmt);
- generate_copy_inout (elt, is_output, other, &list);
- gcc_assert (list);
- mark_all_v_defs (list);
+ mark_all_v_defs_stmt (stmt);
+ generate_copy_inout (elt, is_output, other, &seq);
+ gcc_assert (seq);
+ mark_all_v_defs_seq (seq);
/* Preserve EH semantics. */
if (stmt_ends_bb_p (stmt))
{
- tree_stmt_iterator tsi;
- tree first, blist = NULL;
- bool thr = tree_could_throw_p (stmt);
+ gimple_stmt_iterator si;
+ gimple first;
+ gimple_seq blist = NULL;
+ bool thr = stmt_could_throw_p (stmt);
/* If the last statement of this BB created an EH edge
before scalarization, we have to locate the first
@@ -3538,26 +3513,26 @@ scalarize_ldst (struct sra_elt *elt, tree other,
list will be added to normal outgoing edges of the same
BB. If they access any memory, it's the same memory, so
we can assume they won't throw. */
- tsi = tsi_start (list);
- for (first = tsi_stmt (tsi);
- thr && !tsi_end_p (tsi) && !tree_could_throw_p (first);
- first = tsi_stmt (tsi))
+ si = gsi_start (seq);
+ for (first = gsi_stmt (si);
+ thr && !gsi_end_p (si) && !stmt_could_throw_p (first);
+ first = gsi_stmt (si))
{
- tsi_delink (&tsi);
- append_to_statement_list (first, &blist);
+ gsi_remove (&si, false);
+ gimple_seq_add_stmt (&blist, first);
}
/* Extract the first remaining statement from LIST, this is
the EH statement if there is one. */
- tsi_delink (&tsi);
+ gsi_remove (&si, false);
if (blist)
- sra_insert_before (bsi, blist);
+ sra_insert_before (gsi, blist);
/* Replace the old statement with this new representative. */
- bsi_replace (bsi, first, true);
+ gsi_replace (gsi, first, true);
- if (!tsi_end_p (tsi))
+ if (!gsi_end_p (si))
{
/* If any reference would trap, then they all would. And more
to the point, the first would. Therefore none of the rest
@@ -3566,16 +3541,16 @@ scalarize_ldst (struct sra_elt *elt, tree other,
TREE_THIS_NOTRAP in all INDIRECT_REFs. */
do
{
- walk_tree (tsi_stmt_ptr (tsi), mark_notrap, NULL, NULL);
- tsi_next (&tsi);
+ walk_gimple_stmt (&si, NULL, mark_notrap, NULL);
+ gsi_next (&si);
}
- while (!tsi_end_p (tsi));
+ while (!gsi_end_p (si));
- insert_edge_copies (list, bsi->bb);
+ insert_edge_copies_seq (seq, gsi_bb (*gsi));
}
}
else
- sra_replace (bsi, list);
+ sra_replace (gsi, seq);
}
}
@@ -3584,7 +3559,7 @@ scalarize_ldst (struct sra_elt *elt, tree other,
static void
scalarize_parms (void)
{
- tree list = NULL;
+ gimple_seq seq = NULL;
unsigned i;
bitmap_iterator bi;
@@ -3592,13 +3567,13 @@ scalarize_parms (void)
{
tree var = referenced_var (i);
struct sra_elt *elt = lookup_element (NULL, var, NULL, NO_INSERT);
- generate_copy_inout (elt, true, var, &list);
+ generate_copy_inout (elt, true, var, &seq);
}
- if (list)
+ if (seq)
{
- insert_edge_copies (list, ENTRY_BLOCK_PTR);
- mark_all_v_defs (list);
+ insert_edge_copies_seq (seq, ENTRY_BLOCK_PTR);
+ mark_all_v_defs_seq (seq);
}
}
@@ -3613,7 +3588,7 @@ scalarize_function (void)
sra_walk_function (&fns);
scalarize_parms ();
- bsi_commit_edge_inserts ();
+ gsi_commit_edge_inserts ();
}
@@ -3663,13 +3638,14 @@ debug_sra_elt_name (struct sra_elt *elt)
void
sra_init_cache (void)
{
- if (sra_type_decomp_cache)
+ if (sra_type_decomp_cache)
return;
sra_type_decomp_cache = BITMAP_ALLOC (NULL);
sra_type_inst_cache = BITMAP_ALLOC (NULL);
}
+
/* Main entry point. */
static unsigned int
diff --git a/gcc/tree-ssa-address.c b/gcc/tree-ssa-address.c
index 55d43a5e362..198adb409e6 100644
--- a/gcc/tree-ssa-address.c
+++ b/gcc/tree-ssa-address.c
@@ -556,31 +556,31 @@ addr_to_parts (aff_tree *addr, struct mem_address *parts)
/* Force the PARTS to register. */
static void
-gimplify_mem_ref_parts (block_stmt_iterator *bsi, struct mem_address *parts)
+gimplify_mem_ref_parts (gimple_stmt_iterator *gsi, struct mem_address *parts)
{
if (parts->base)
- parts->base = force_gimple_operand_bsi (bsi, parts->base,
+ parts->base = force_gimple_operand_gsi (gsi, parts->base,
true, NULL_TREE,
- true, BSI_SAME_STMT);
+ true, GSI_SAME_STMT);
if (parts->index)
- parts->index = force_gimple_operand_bsi (bsi, parts->index,
+ parts->index = force_gimple_operand_gsi (gsi, parts->index,
true, NULL_TREE,
- true, BSI_SAME_STMT);
+ true, GSI_SAME_STMT);
}
/* Creates and returns a TARGET_MEM_REF for address ADDR. If necessary
- computations are emitted in front of BSI. TYPE is the mode
+ computations are emitted in front of GSI. TYPE is the mode
of created memory reference. */
tree
-create_mem_ref (block_stmt_iterator *bsi, tree type, aff_tree *addr)
+create_mem_ref (gimple_stmt_iterator *gsi, tree type, aff_tree *addr)
{
tree mem_ref, tmp;
tree atype;
struct mem_address parts;
addr_to_parts (addr, &parts);
- gimplify_mem_ref_parts (bsi, &parts);
+ gimplify_mem_ref_parts (gsi, &parts);
mem_ref = create_mem_ref_raw (type, &parts);
if (mem_ref)
return mem_ref;
@@ -591,10 +591,10 @@ create_mem_ref (block_stmt_iterator *bsi, tree type, aff_tree *addr)
{
/* Move the multiplication to index. */
gcc_assert (parts.index);
- parts.index = force_gimple_operand_bsi (bsi,
+ parts.index = force_gimple_operand_gsi (gsi,
fold_build2 (MULT_EXPR, sizetype,
parts.index, parts.step),
- true, NULL_TREE, true, BSI_SAME_STMT);
+ true, NULL_TREE, true, GSI_SAME_STMT);
parts.step = NULL_TREE;
mem_ref = create_mem_ref_raw (type, &parts);
@@ -616,11 +616,11 @@ create_mem_ref (block_stmt_iterator *bsi, tree type, aff_tree *addr)
if (parts.index)
{
atype = TREE_TYPE (tmp);
- parts.base = force_gimple_operand_bsi (bsi,
+ parts.base = force_gimple_operand_gsi (gsi,
fold_build2 (PLUS_EXPR, atype,
fold_convert (atype, parts.base),
tmp),
- true, NULL_TREE, true, BSI_SAME_STMT);
+ true, NULL_TREE, true, GSI_SAME_STMT);
}
else
{
@@ -643,11 +643,11 @@ create_mem_ref (block_stmt_iterator *bsi, tree type, aff_tree *addr)
if (parts.base)
{
atype = TREE_TYPE (parts.base);
- parts.base = force_gimple_operand_bsi (bsi,
+ parts.base = force_gimple_operand_gsi (gsi,
fold_build2 (POINTER_PLUS_EXPR, atype,
parts.base,
parts.index),
- true, NULL_TREE, true, BSI_SAME_STMT);
+ true, NULL_TREE, true, GSI_SAME_STMT);
}
else
parts.base = parts.index;
@@ -664,11 +664,11 @@ create_mem_ref (block_stmt_iterator *bsi, tree type, aff_tree *addr)
if (parts.base)
{
atype = TREE_TYPE (parts.base);
- parts.base = force_gimple_operand_bsi (bsi,
+ parts.base = force_gimple_operand_gsi (gsi,
fold_build2 (POINTER_PLUS_EXPR, atype,
parts.base,
fold_convert (sizetype, parts.offset)),
- true, NULL_TREE, true, BSI_SAME_STMT);
+ true, NULL_TREE, true, GSI_SAME_STMT);
}
else
parts.base = parts.offset;
diff --git a/gcc/tree-ssa-alias-warnings.c b/gcc/tree-ssa-alias-warnings.c
index be26cb37d49..5bae978187a 100644
--- a/gcc/tree-ssa-alias-warnings.c
+++ b/gcc/tree-ssa-alias-warnings.c
@@ -244,7 +244,7 @@ struct alias_match
{
tree rhs;
bool is_rhs_pointer;
- tree site;
+ gimple site;
};
@@ -252,15 +252,14 @@ struct alias_match
of STMT matches DATA. */
static bool
-find_alias_site_helper (tree var ATTRIBUTE_UNUSED, tree stmt, void *data)
+find_alias_site_helper (tree var ATTRIBUTE_UNUSED, gimple stmt, void *data)
{
struct alias_match *match = (struct alias_match *) data;
- tree rhs_pointer = get_rhs (stmt);
+ tree rhs_pointer = NULL_TREE;
tree to_match = NULL_TREE;
- while (CONVERT_EXPR_P (rhs_pointer)
- || TREE_CODE (rhs_pointer) == VIEW_CONVERT_EXPR)
- rhs_pointer = TREE_OPERAND (rhs_pointer, 0);
+ if (gimple_assign_cast_p (stmt))
+ rhs_pointer = gimple_assign_rhs1 (stmt);
if (!rhs_pointer)
/* Not a type conversion. */
@@ -287,7 +286,7 @@ find_alias_site_helper (tree var ATTRIBUTE_UNUSED, tree stmt, void *data)
For now, just implement the case where OBJECT1 is an SSA name defined
by a PHI statement. */
-static tree
+static gimple
find_alias_site (tree object1, bool is_ptr1 ATTRIBUTE_UNUSED,
tree object2, bool is_ptr2)
{
@@ -295,10 +294,10 @@ find_alias_site (tree object1, bool is_ptr1 ATTRIBUTE_UNUSED,
match.rhs = object2;
match.is_rhs_pointer = is_ptr2;
- match.site = NULL_TREE;
+ match.site = NULL;
if (TREE_CODE (object1) != SSA_NAME)
- return NULL_TREE;
+ return NULL;
walk_use_def_chains (object1, find_alias_site_helper, &match, false);
return match.site;
@@ -344,29 +343,55 @@ get_ssa_base (tree expr)
objs: <ptr, 2>
PTR shows up twice as an object, but is dereferenced only once.
- The elements of the hash tables are tree_map objects. */
+ The elements of the hash tables are gimple_map objects. */
struct reference_matches
{
htab_t ptrs;
htab_t objs;
};
+struct gimple_tree_map
+{
+ tree from;
+ gimple to;
+};
+
+/* Return true if the from tree in both gimple-tree maps are equal.
+ VA and VB are really instances of struct gimple_tree_map. */
+
+static int
+gimple_tree_map_eq (const void *va, const void *vb)
+{
+ const struct gimple_tree_map *const a = (const struct gimple_tree_map *) va;
+ const struct gimple_tree_map *const b = (const struct gimple_tree_map *) vb;
+ return (a->from == b->from);
+}
+
+/* Hash a from tree in a gimple_tree_map. ITEM is really an instance
+ of struct gimple_tree_map. */
+
+static unsigned int
+gimple_tree_map_hash (const void *item)
+{
+ return htab_hash_pointer (((const struct gimple_tree_map *)item)->from);
+}
-/* Return the match, if any. Otherwise, return NULL_TREE. It will
- return NULL_TREE even when a match was found, if the value associated
- to KEY is NULL_TREE. */
+/* Return the match, if any. Otherwise, return NULL. It will return
+ NULL even when a match was found, if the value associated to KEY is
+ NULL. */
-static inline tree
+static inline gimple
match (htab_t ref_map, tree key)
{
- struct tree_map *found;
+ struct gimple_tree_map *found;
void **slot = NULL;
slot = htab_find_slot (ref_map, &key, NO_INSERT);
if (!slot)
- return NULL_TREE;
+ return NULL;
+
+ found = (struct gimple_tree_map *) *slot;
- found = (struct tree_map *) *slot;
return found->to;
}
@@ -375,9 +400,11 @@ match (htab_t ref_map, tree key)
already exists and its value is NULL_TREE. Otherwise, do nothing. */
static inline void
-maybe_add_match (htab_t ref_map, struct tree_map *key)
+maybe_add_match (htab_t ref_map, struct gimple_tree_map *key)
{
- struct tree_map *found = (struct tree_map *) htab_find (ref_map, key);
+ struct gimple_tree_map *found;
+
+ found = (struct gimple_tree_map *) htab_find (ref_map, key);
if (found && !found->to)
found->to = key->to;
@@ -390,10 +417,12 @@ static void
add_key (htab_t ht, tree t, alloc_pool references_pool)
{
void **slot;
- struct tree_map *tp = (struct tree_map *) pool_alloc (references_pool);
+ struct gimple_tree_map *tp;
+
+ tp = (struct gimple_tree_map *) pool_alloc (references_pool);
- tp->base.from = t;
- tp->to = NULL_TREE;
+ tp->from = t;
+ tp->to = NULL;
slot = htab_find_slot (ht, &t, INSERT);
*slot = (void *) tp;
}
@@ -412,8 +441,9 @@ reference_table_alloc_pool (bool build)
if (ref_table_alloc_pool || !build)
return ref_table_alloc_pool;
- ref_table_alloc_pool =
- create_alloc_pool ("ref_table_alloc_pool", sizeof (struct tree_map), 20);
+ ref_table_alloc_pool = create_alloc_pool ("ref_table_alloc_pool",
+ sizeof (struct gimple_tree_map),
+ 20);
return ref_table_alloc_pool;
}
@@ -430,8 +460,10 @@ build_reference_table (void)
alloc_pool references_pool = reference_table_alloc_pool (true);
ref_table = XNEW (struct reference_matches);
- ref_table->objs = htab_create (10, tree_map_base_hash, tree_map_eq, NULL);
- ref_table->ptrs = htab_create (10, tree_map_base_hash, tree_map_eq, NULL);
+ ref_table->objs = htab_create (10, gimple_tree_map_hash, gimple_tree_map_eq,
+ NULL);
+ ref_table->ptrs = htab_create (10, gimple_tree_map_hash, gimple_tree_map_eq,
+ NULL);
for (i = 1; i < num_ssa_names; i++)
{
@@ -518,8 +550,9 @@ find_references_in_tree_helper (tree *tp,
int *walk_subtrees ATTRIBUTE_UNUSED,
void *data)
{
- struct tree_map match;
+ struct gimple_tree_map match;
static int parent_tree_code = ERROR_MARK;
+ struct walk_stmt_info *wi = (struct walk_stmt_info *) data;
/* Do not report references just for the purpose of taking an address.
XXX: we rely on the fact that the tree walk is in preorder
@@ -528,16 +561,16 @@ find_references_in_tree_helper (tree *tp,
if (parent_tree_code == ADDR_EXPR)
goto finish;
- match.to = (tree) data;
+ match.to = (gimple) wi->info;
if (TREE_CODE (*tp) == INDIRECT_REF)
{
- match.base.from = TREE_OPERAND (*tp, 0);
+ match.from = TREE_OPERAND (*tp, 0);
maybe_add_match (reference_table (true)->ptrs, &match);
}
else
{
- match.base.from = *tp;
+ match.from = *tp;
maybe_add_match (reference_table (true)->objs, &match);
}
@@ -553,12 +586,16 @@ static void
find_references_in_function (void)
{
basic_block bb;
- block_stmt_iterator i;
+ gimple_stmt_iterator i;
FOR_EACH_BB (bb)
- for (i = bsi_start (bb); !bsi_end_p (i); bsi_next (&i))
- walk_tree (bsi_stmt_ptr (i), find_references_in_tree_helper,
- (void *) *bsi_stmt_ptr (i), NULL);
+ for (i = gsi_start_bb (bb); !gsi_end_p (i); gsi_next (&i))
+ {
+ struct walk_stmt_info wi;
+ memset (&wi, 0, sizeof (wi));
+ wi.info = (void *) gsi_stmt (i);
+ walk_gimple_op (gsi_stmt (i), find_references_in_tree_helper, &wi);
+ }
}
@@ -567,7 +604,7 @@ find_references_in_function (void)
XXX: only the first site is returned in the current
implementation. If there are no matching sites, return NULL_TREE. */
-static tree
+static gimple
reference_site (tree object, bool is_ptr)
{
if (is_ptr)
@@ -590,19 +627,19 @@ reference_site (tree object, bool is_ptr)
static void
maybe_find_missing_stmts (tree object1, bool is_ptr1,
tree object2, bool is_ptr2,
- tree *alias_site,
- tree *deref_site1,
- tree *deref_site2)
+ gimple *alias_site,
+ gimple *deref_site1,
+ gimple *deref_site2)
{
if (object1 && object2)
{
- if (!*alias_site || !EXPR_HAS_LOCATION (*alias_site))
+ if (!*alias_site || !gimple_has_location (*alias_site))
*alias_site = find_alias_site (object1, is_ptr1, object2, is_ptr2);
- if (!*deref_site1 || !EXPR_HAS_LOCATION (*deref_site1))
+ if (!*deref_site1 || !gimple_has_location (*deref_site1))
*deref_site1 = reference_site (object1, is_ptr1);
- if (!*deref_site2 || !EXPR_HAS_LOCATION (*deref_site2))
+ if (!*deref_site2 || !gimple_has_location (*deref_site2))
*deref_site2 = reference_site (object2, is_ptr2);
}
@@ -683,7 +720,6 @@ get_maybe_star_prefix (tree object, bool is_ptr)
&& TREE_CODE (TREE_TYPE (object)) == POINTER_TYPE) ? "*" : "";
}
-
/* Callback for contains_node_type_p.
Returns true if *T has tree code *(int*)DATA. */
@@ -710,18 +746,13 @@ contains_node_type_p (tree t, int type)
/* Return true if a warning was issued in the front end at STMT. */
static bool
-already_warned_in_frontend_p (tree stmt)
+already_warned_in_frontend_p (gimple stmt)
{
- tree rhs_pointer;
-
- if (stmt == NULL_TREE)
+ if (stmt == NULL)
return false;
- rhs_pointer = get_rhs (stmt);
-
- if ((CONVERT_EXPR_P (rhs_pointer)
- || TREE_CODE (rhs_pointer) == VIEW_CONVERT_EXPR)
- && TREE_NO_WARNING (rhs_pointer))
+ if (gimple_assign_cast_p (stmt)
+ && TREE_NO_WARNING (gimple_assign_rhs1 (stmt)))
return true;
else
return false;
@@ -749,13 +780,13 @@ is_method_pointer (tree type)
case, that is where a pointer was assigned to the address of an object. */
static bool
-strict_aliasing_warn (tree alias_site,
+strict_aliasing_warn (gimple alias_site,
tree object1, bool is_ptr1,
tree object2, bool is_ptr2,
bool filter_artificials)
{
- tree ref_site1 = NULL_TREE;
- tree ref_site2 = NULL_TREE;
+ gimple ref_site1 = NULL;
+ gimple ref_site2 = NULL;
const char *name1;
const char *name2;
location_t alias_loc;
@@ -773,18 +804,18 @@ strict_aliasing_warn (tree alias_site,
maybe_find_missing_stmts (object1, is_ptr1, object2, is_ptr2, &alias_site,
&ref_site1, &ref_site2);
- if (EXPR_HAS_LOCATION (alias_site))
- alias_loc = EXPR_LOCATION (alias_site);
+ if (gimple_has_location (alias_site))
+ alias_loc = gimple_location (alias_site);
else
return false;
- if (EXPR_HAS_LOCATION (ref_site1))
- ref1_loc = EXPR_LOCATION (ref_site1);
+ if (gimple_has_location (ref_site1))
+ ref1_loc = gimple_location (ref_site1);
else
ref1_loc = alias_loc;
- if (EXPR_HAS_LOCATION (ref_site2))
- ref2_loc = EXPR_LOCATION (ref_site2);
+ if (gimple_has_location (ref_site2))
+ ref2_loc = gimple_location (ref_site2);
else
ref2_loc = alias_loc;
@@ -858,6 +889,10 @@ nonstandard_alias_p (tree ptr, tree alias, bool ptr_ptr)
tree ptr_type = get_otype (ptr, true);
tree alias_type = get_otype (alias, ptr_ptr);
+ /* If this is a ref-all pointer the access is ok. */
+ if (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (ptr)))
+ return false;
+
/* XXX: for now, say it's OK if the alias escapes.
Not sure this is needed in general, but otherwise GCC will not
bootstrap. */
@@ -900,7 +935,7 @@ skip_this_pointer (tree ptr ATTRIBUTE_UNUSED, struct ptr_info_def *pi)
/* Find aliasing to named objects for pointer PTR. */
static void
-dsa_named_for (tree ptr)
+dsa_named_for (tree ptr ATTRIBUTE_UNUSED)
{
struct ptr_info_def *pi = SSA_NAME_PTR_INFO (ptr);
@@ -970,7 +1005,7 @@ processed_func_p (tree func)
void **slot = NULL;
if (!seen)
- seen = htab_create (10, tree_map_base_hash, tree_map_eq, NULL);
+ seen = htab_create (10, gimple_tree_map_hash, gimple_tree_map_eq, NULL);
slot = htab_find_slot (seen, &func, INSERT);
gcc_assert (slot);
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c
index 3aa79feddd6..e1540f3b8f8 100644
--- a/gcc/tree-ssa-alias.c
+++ b/gcc/tree-ssa-alias.c
@@ -1,5 +1,5 @@
/* Alias analysis for trees.
- Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
Contributed by Diego Novillo <dnovillo@redhat.com>
This file is part of GCC.
@@ -35,7 +35,7 @@ along with GCC; see the file COPYING3. If not see
#include "function.h"
#include "diagnostic.h"
#include "tree-dump.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "tree-flow.h"
#include "tree-inline.h"
#include "tree-pass.h"
@@ -752,7 +752,7 @@ static void
count_mem_refs (long *num_vuses_p, long *num_vdefs_p,
long *num_partitioned_p, long *num_unpartitioned_p)
{
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
basic_block bb;
long num_vdefs, num_vuses, num_partitioned, num_unpartitioned;
referenced_var_iterator rvi;
@@ -762,10 +762,10 @@ count_mem_refs (long *num_vuses_p, long *num_vdefs_p,
if (num_vuses_p || num_vdefs_p)
FOR_EACH_BB (bb)
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- tree stmt = bsi_stmt (bsi);
- if (stmt_references_memory_p (stmt))
+ gimple stmt = gsi_stmt (gsi);
+ if (gimple_references_memory_p (stmt))
{
num_vuses += NUM_SSA_OPERANDS (stmt, SSA_OP_VUSE);
num_vdefs += NUM_SSA_OPERANDS (stmt, SSA_OP_VDEF);
@@ -1006,7 +1006,7 @@ debug_mp_info (VEC(mem_sym_stats_t,heap) *mp_info)
recorded by this function, see compute_memory_partitions). */
void
-update_mem_sym_stats_from_stmt (tree var, tree stmt, long num_direct_reads,
+update_mem_sym_stats_from_stmt (tree var, gimple stmt, long num_direct_reads,
long num_direct_writes)
{
mem_sym_stats_t stats;
@@ -1016,11 +1016,11 @@ update_mem_sym_stats_from_stmt (tree var, tree stmt, long num_direct_reads,
stats = get_mem_sym_stats_for (var);
stats->num_direct_reads += num_direct_reads;
- stats->frequency_reads += ((long) bb_for_stmt (stmt)->frequency
+ stats->frequency_reads += ((long) gimple_bb (stmt)->frequency
* num_direct_reads);
stats->num_direct_writes += num_direct_writes;
- stats->frequency_writes += ((long) bb_for_stmt (stmt)->frequency
+ stats->frequency_writes += ((long) gimple_bb (stmt)->frequency
* num_direct_writes);
}
@@ -1629,7 +1629,6 @@ done:
timevar_pop (TV_MEMORY_PARTITIONING);
}
-
/* Compute may-alias information for every variable referenced in function
FNDECL.
@@ -1812,11 +1811,11 @@ compute_may_aliases (void)
/* Populate all virtual operands and newly promoted register operands. */
{
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
basic_block bb;
FOR_EACH_BB (bb)
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
- update_stmt_if_modified (bsi_stmt (bsi));
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ update_stmt_if_modified (gsi_stmt (gsi));
}
/* Debugging dumps. */
@@ -1852,7 +1851,8 @@ compute_may_aliases (void)
struct count_ptr_d
{
tree ptr;
- unsigned count;
+ unsigned num_stores;
+ unsigned num_loads;
};
@@ -1862,7 +1862,8 @@ struct count_ptr_d
static tree
count_ptr_derefs (tree *tp, int *walk_subtrees, void *data)
{
- struct count_ptr_d *count_p = (struct count_ptr_d *) data;
+ struct walk_stmt_info *wi_p = (struct walk_stmt_info *) data;
+ struct count_ptr_d *count_p = (struct count_ptr_d *) wi_p->info;
/* Do not walk inside ADDR_EXPR nodes. In the expression &ptr->fld,
pointer 'ptr' is *not* dereferenced, it is simply used to compute
@@ -1874,7 +1875,12 @@ count_ptr_derefs (tree *tp, int *walk_subtrees, void *data)
}
if (INDIRECT_REF_P (*tp) && TREE_OPERAND (*tp, 0) == count_p->ptr)
- count_p->count++;
+ {
+ if (wi_p->is_lhs)
+ count_p->num_stores++;
+ else
+ count_p->num_loads++;
+ }
return NULL_TREE;
}
@@ -1887,7 +1893,7 @@ count_ptr_derefs (tree *tp, int *walk_subtrees, void *data)
stored in *NUM_STORES_P and *NUM_LOADS_P. */
void
-count_uses_and_derefs (tree ptr, tree stmt, unsigned *num_uses_p,
+count_uses_and_derefs (tree ptr, gimple stmt, unsigned *num_uses_p,
unsigned *num_loads_p, unsigned *num_stores_p)
{
ssa_op_iter i;
@@ -1909,59 +1915,24 @@ count_uses_and_derefs (tree ptr, tree stmt, unsigned *num_uses_p,
find all the indirect and direct uses of x_1 inside. The only
shortcut we can take is the fact that GIMPLE only allows
INDIRECT_REFs inside the expressions below. */
- if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
- || (TREE_CODE (stmt) == RETURN_EXPR
- && TREE_CODE (TREE_OPERAND (stmt, 0)) == GIMPLE_MODIFY_STMT)
- || TREE_CODE (stmt) == ASM_EXPR
- || TREE_CODE (stmt) == CALL_EXPR)
+ if (is_gimple_assign (stmt)
+ || gimple_code (stmt) == GIMPLE_RETURN
+ || gimple_code (stmt) == GIMPLE_ASM
+ || is_gimple_call (stmt))
{
- tree lhs, rhs;
+ struct walk_stmt_info wi;
+ struct count_ptr_d count;
- if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT)
- {
- lhs = GIMPLE_STMT_OPERAND (stmt, 0);
- rhs = GIMPLE_STMT_OPERAND (stmt, 1);
- }
- else if (TREE_CODE (stmt) == RETURN_EXPR)
- {
- tree e = TREE_OPERAND (stmt, 0);
- lhs = GIMPLE_STMT_OPERAND (e, 0);
- rhs = GIMPLE_STMT_OPERAND (e, 1);
- }
- else if (TREE_CODE (stmt) == ASM_EXPR)
- {
- lhs = ASM_OUTPUTS (stmt);
- rhs = ASM_INPUTS (stmt);
- }
- else
- {
- lhs = NULL_TREE;
- rhs = stmt;
- }
+ count.ptr = ptr;
+ count.num_stores = 0;
+ count.num_loads = 0;
- if (lhs
- && (TREE_CODE (lhs) == TREE_LIST
- || EXPR_P (lhs)
- || GIMPLE_STMT_P (lhs)))
- {
- struct count_ptr_d count;
- count.ptr = ptr;
- count.count = 0;
- walk_tree (&lhs, count_ptr_derefs, &count, NULL);
- *num_stores_p = count.count;
- }
+ memset (&wi, 0, sizeof (wi));
+ wi.info = &count;
+ walk_gimple_op (stmt, count_ptr_derefs, &wi);
- if (rhs
- && (TREE_CODE (rhs) == TREE_LIST
- || EXPR_P (rhs)
- || GIMPLE_STMT_P (rhs)))
- {
- struct count_ptr_d count;
- count.ptr = ptr;
- count.count = 0;
- walk_tree (&rhs, count_ptr_derefs, &count, NULL);
- *num_loads_p = count.count;
- }
+ *num_stores_p = count.num_stores;
+ *num_loads_p = count.num_loads;
}
gcc_assert (*num_uses_p >= *num_loads_p + *num_stores_p);
@@ -2503,7 +2474,7 @@ create_alias_map_for (tree var, struct alias_info *ai)
ADDRESSABLE_VARS. */
static void
-update_alias_info_1 (tree stmt, struct alias_info *ai)
+update_alias_info_1 (gimple stmt, struct alias_info *ai)
{
bitmap addr_taken;
use_operand_p use_p;
@@ -2525,7 +2496,7 @@ update_alias_info_1 (tree stmt, struct alias_info *ai)
mem_ref_stats->num_asm_sites++;
/* Mark all the variables whose address are taken by the statement. */
- addr_taken = addresses_taken (stmt);
+ addr_taken = gimple_addresses_taken (stmt);
if (addr_taken)
bitmap_ior_into (gimple_addressable_vars (cfun), addr_taken);
@@ -2547,7 +2518,7 @@ update_alias_info_1 (tree stmt, struct alias_info *ai)
{
bitmap addressable_vars = gimple_addressable_vars (cfun);
- gcc_assert (TREE_CODE (stmt) == PHI_NODE);
+ gcc_assert (gimple_code (stmt) == GIMPLE_PHI);
gcc_assert (addressable_vars);
/* PHI nodes don't have annotations for pinning the set
@@ -2587,7 +2558,7 @@ update_alias_info_1 (tree stmt, struct alias_info *ai)
/* If STMT is a PHI node, then it will not have pointer
dereferences and it will not be an escape point. */
- if (TREE_CODE (stmt) == PHI_NODE)
+ if (gimple_code (stmt) == GIMPLE_PHI)
continue;
/* Determine whether OP is a dereferenced pointer, and if STMT
@@ -2621,13 +2592,13 @@ update_alias_info_1 (tree stmt, struct alias_info *ai)
are not GIMPLE invariants), they can only appear on the RHS
of an assignment and their base address is always an
INDIRECT_REF expression. */
- if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
- && TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 1)) == ADDR_EXPR
- && !is_gimple_val (GIMPLE_STMT_OPERAND (stmt, 1)))
+ if (is_gimple_assign (stmt)
+ && gimple_assign_rhs_code (stmt) == ADDR_EXPR
+ && !is_gimple_val (gimple_assign_rhs1 (stmt)))
{
/* If the RHS if of the form &PTR->FLD and PTR == OP, then
this represents a potential dereference of PTR. */
- tree rhs = GIMPLE_STMT_OPERAND (stmt, 1);
+ tree rhs = gimple_assign_rhs1 (stmt);
tree base = get_base_address (TREE_OPERAND (rhs, 0));
if (TREE_CODE (base) == INDIRECT_REF
&& TREE_OPERAND (base, 0) == op)
@@ -2673,7 +2644,7 @@ update_alias_info_1 (tree stmt, struct alias_info *ai)
/* If the statement makes a function call, assume
that pointer OP will be dereferenced in a store
operation inside the called function. */
- if (get_call_expr_in (stmt)
+ if (is_gimple_call (stmt)
|| stmt_escape_type == ESCAPE_STORED_IN_GLOBAL)
{
pointer_set_insert (ai->dereferenced_ptrs_store, var);
@@ -2682,12 +2653,12 @@ update_alias_info_1 (tree stmt, struct alias_info *ai)
}
}
- if (TREE_CODE (stmt) == PHI_NODE)
+ if (gimple_code (stmt) == GIMPLE_PHI)
return;
/* Mark stored variables in STMT as being written to and update the
memory reference stats for all memory symbols referenced by STMT. */
- if (stmt_references_memory_p (stmt))
+ if (gimple_references_memory_p (stmt))
{
unsigned i;
bitmap_iterator bi;
@@ -2716,8 +2687,8 @@ update_alias_info_1 (tree stmt, struct alias_info *ai)
dereferences (e.g., MEMORY_VAR = *PTR) or if a call site has
memory symbols in its argument list, but these cases do not
occur so frequently as to constitute a serious problem. */
- if (STORED_SYMS (stmt))
- EXECUTE_IF_SET_IN_BITMAP (STORED_SYMS (stmt), 0, i, bi)
+ if (gimple_stored_syms (stmt))
+ EXECUTE_IF_SET_IN_BITMAP (gimple_stored_syms (stmt), 0, i, bi)
{
tree sym = referenced_var (i);
pointer_set_insert (ai->written_vars, sym);
@@ -2729,11 +2700,11 @@ update_alias_info_1 (tree stmt, struct alias_info *ai)
}
if (!stmt_dereferences_ptr_p
- && LOADED_SYMS (stmt)
+ && gimple_loaded_syms (stmt)
&& stmt_escape_type != ESCAPE_TO_CALL
&& stmt_escape_type != ESCAPE_TO_PURE_CONST
&& stmt_escape_type != ESCAPE_TO_ASM)
- EXECUTE_IF_SET_IN_BITMAP (LOADED_SYMS (stmt), 0, i, bi)
+ EXECUTE_IF_SET_IN_BITMAP (gimple_loaded_syms (stmt), 0, i, bi)
update_mem_sym_stats_from_stmt (referenced_var (i), stmt, 1, 0);
}
}
@@ -2749,15 +2720,18 @@ update_alias_info (struct alias_info *ai)
FOR_EACH_BB (bb)
{
- block_stmt_iterator bsi;
- tree phi;
+ gimple_stmt_iterator gsi;
+ gimple phi;
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
- if (is_gimple_reg (PHI_RESULT (phi)))
- update_alias_info_1 (phi, ai);
+ for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ {
+ phi = gsi_stmt (gsi);
+ if (is_gimple_reg (PHI_RESULT (phi)))
+ update_alias_info_1 (phi, ai);
+ }
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
- update_alias_info_1 (bsi_stmt (bsi), ai);
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ update_alias_info_1 (gsi_stmt (gsi), ai);
}
}
@@ -3059,11 +3033,11 @@ may_alias_p (tree ptr, alias_set_type mem_alias_set,
/* The star count is -1 if the type at the end of the
pointer_to chain is not a record or union type. */
- if (!alias_set_only
- && ipa_type_escape_star_count_of_interesting_type (var_type) >= 0)
+ if (!alias_set_only &&
+ 0 /* FIXME tuples ipa_type_escape_star_count_of_interesting_type (var_type) >= 0*/)
{
int ptr_star_count = 0;
-
+
/* ipa_type_escape_star_count_of_interesting_type is a
little too restrictive for the pointer type, need to
allow pointers to primitive types as long as those
@@ -3185,21 +3159,20 @@ set_pt_anything (tree ptr)
if none. */
enum escape_type
-is_escape_site (tree stmt)
+is_escape_site (gimple stmt)
{
- tree call = get_call_expr_in (stmt);
- if (call != NULL_TREE)
+ if (is_gimple_call (stmt))
{
- if (!TREE_SIDE_EFFECTS (call))
+ if (gimple_call_flags (stmt) & (ECF_PURE | ECF_CONST))
return ESCAPE_TO_PURE_CONST;
return ESCAPE_TO_CALL;
}
- else if (TREE_CODE (stmt) == ASM_EXPR)
+ else if (gimple_code (stmt) == GIMPLE_ASM)
return ESCAPE_TO_ASM;
- else if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT)
+ else if (is_gimple_assign (stmt))
{
- tree lhs = GIMPLE_STMT_OPERAND (stmt, 0);
+ tree lhs = gimple_assign_lhs (stmt);
/* Get to the base of _REF nodes. */
if (TREE_CODE (lhs) != SSA_NAME)
@@ -3210,12 +3183,10 @@ is_escape_site (tree stmt)
if (lhs == NULL_TREE)
return ESCAPE_UNKNOWN;
- if (CONVERT_EXPR_P (GIMPLE_STMT_OPERAND (stmt, 1))
- || TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 1)) == VIEW_CONVERT_EXPR)
+ if (gimple_assign_cast_p (stmt))
{
- tree from
- = TREE_TYPE (TREE_OPERAND (GIMPLE_STMT_OPERAND (stmt, 1), 0));
- tree to = TREE_TYPE (GIMPLE_STMT_OPERAND (stmt, 1));
+ tree from = TREE_TYPE (gimple_assign_rhs1 (stmt));
+ tree to = TREE_TYPE (lhs);
/* If the RHS is a conversion between a pointer and an integer, the
pointer escapes since we can't track the integer. */
@@ -3245,7 +3216,7 @@ is_escape_site (tree stmt)
Applications (OOPSLA), pp. 1-19, 1999. */
return ESCAPE_STORED_IN_GLOBAL;
}
- else if (TREE_CODE (stmt) == RETURN_EXPR)
+ else if (gimple_code (stmt) == RETURN_EXPR)
return ESCAPE_TO_RETURN;
return NO_ESCAPE;
@@ -3539,7 +3510,6 @@ get_ptr_info (tree t)
return pi;
}
-
/* Dump points-to information for SSA_NAME PTR into FILE. */
void
@@ -3595,10 +3565,10 @@ debug_points_to_info_for (tree var)
it needs to traverse the whole CFG looking for pointer SSA_NAMEs. */
void
-dump_points_to_info (FILE *file)
+dump_points_to_info (FILE *file ATTRIBUTE_UNUSED)
{
basic_block bb;
- block_stmt_iterator si;
+ gimple_stmt_iterator si;
ssa_op_iter iter;
const char *fname =
lang_hooks.decl_printable_name (current_function_decl, 2);
@@ -3623,18 +3593,17 @@ dump_points_to_info (FILE *file)
/* Dump points-to information for every pointer defined in the program. */
FOR_EACH_BB (bb)
{
- tree phi;
-
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
+ for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si))
{
+ gimple phi = gsi_stmt (si);
tree ptr = PHI_RESULT (phi);
if (POINTER_TYPE_P (TREE_TYPE (ptr)))
dump_points_to_info_for (file, ptr);
}
- for (si = bsi_start (bb); !bsi_end_p (si); bsi_next (&si))
+ for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si))
{
- tree stmt = bsi_stmt (si);
+ gimple stmt = gsi_stmt (si);
tree def;
FOR_EACH_SSA_TREE_OPERAND (def, stmt, iter, SSA_OP_DEF)
if (TREE_CODE (def) == SSA_NAME
@@ -3689,7 +3658,6 @@ debug_may_aliases_for (tree var)
dump_may_aliases_for (stderr, var);
}
-
/* Return true if VAR may be aliased. */
bool
@@ -3714,17 +3682,7 @@ may_be_aliased (tree var)
if (!TREE_STATIC (var))
return false;
- /* If we're in unit-at-a-time mode, then we must have seen all
- occurrences of address-of operators, and so we can trust
- TREE_ADDRESSABLE. Otherwise we can only be sure the variable
- isn't addressable if it's local to the current function. */
- if (flag_unit_at_a_time)
- return false;
-
- if (decl_function_context (var) == current_function_decl)
- return false;
-
- return true;
+ return false;
}
/* The following is based on code in add_stmt_operand to ensure that the
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index 4b6fe6a1b69..2e34bd99d6b 100644
--- a/gcc/tree-ssa-ccp.c
+++ b/gcc/tree-ssa-ccp.c
@@ -268,6 +268,7 @@ debug_lattice_value (prop_value_t val)
}
+
/* If SYM is a constant variable with known value, return the value.
NULL_TREE is returned otherwise. */
@@ -339,9 +340,9 @@ get_default_value (tree var)
}
else
{
- tree stmt = SSA_NAME_DEF_STMT (var);
+ gimple stmt = SSA_NAME_DEF_STMT (var);
- if (IS_EMPTY_STMT (stmt))
+ if (gimple_nop_p (stmt))
{
/* Variables defined by an empty statement are those used
before being initialized. If VAR is a local variable, we
@@ -352,9 +353,13 @@ get_default_value (tree var)
else
val.lattice_val = VARYING;
}
- else if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
- || TREE_CODE (stmt) == PHI_NODE)
- {
+ else if (is_gimple_assign (stmt)
+ /* Value-returning GIMPLE_CALL statements assign to
+ a variable, and are treated similarly to GIMPLE_ASSIGN. */
+ || (is_gimple_call (stmt)
+ && gimple_call_lhs (stmt) != NULL_TREE)
+ || gimple_code (stmt) == GIMPLE_PHI)
+ {
/* Any other variable defined by an assignment or a PHI node
is considered UNDEFINED. */
val.lattice_val = UNDEFINED;
@@ -497,18 +502,24 @@ set_lattice_value (tree var, prop_value_t new_val)
Else return VARYING. */
static ccp_lattice_t
-likely_value (tree stmt)
+likely_value (gimple stmt)
{
bool has_constant_operand, has_undefined_operand, all_undefined_operands;
- stmt_ann_t ann;
tree use;
ssa_op_iter iter;
- ann = stmt_ann (stmt);
+ enum tree_code code = gimple_code (stmt);
+
+ /* This function appears to be called only for assignments, calls,
+ conditionals, and switches, due to the logic in visit_stmt. */
+ gcc_assert (code == GIMPLE_ASSIGN
+ || code == GIMPLE_CALL
+ || code == GIMPLE_COND
+ || code == GIMPLE_SWITCH);
/* If the statement has volatile operands, it won't fold to a
constant value. */
- if (ann->has_volatile_ops)
+ if (gimple_has_volatile_ops (stmt))
return VARYING;
/* If we are not doing store-ccp, statements with loads
@@ -517,23 +528,24 @@ likely_value (tree stmt)
&& !ZERO_SSA_OPERANDS (stmt, SSA_OP_ALL_VIRTUALS))
return VARYING;
+ /* Note that only a GIMPLE_SINGLE_RHS assignment can satisfy
+ is_gimple_min_invariant, so we do not consider calls or
+ other forms of assignment. */
+ if (gimple_assign_single_p (stmt)
+ && is_gimple_min_invariant (gimple_assign_rhs1 (stmt)))
+ return CONSTANT;
- /* A CALL_EXPR is assumed to be varying. NOTE: This may be overly
- conservative, in the presence of const and pure calls. */
- if (get_call_expr_in (stmt) != NULL_TREE)
- return VARYING;
-
- /* Anything other than assignments and conditional jumps are not
- interesting for CCP. */
- if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT
- && !(TREE_CODE (stmt) == RETURN_EXPR && get_rhs (stmt) != NULL_TREE)
- && TREE_CODE (stmt) != COND_EXPR
- && TREE_CODE (stmt) != SWITCH_EXPR)
- return VARYING;
+ if (code == GIMPLE_COND
+ && is_gimple_min_invariant (gimple_cond_lhs (stmt))
+ && is_gimple_min_invariant (gimple_cond_rhs (stmt)))
+ return CONSTANT;
- if (is_gimple_min_invariant (get_rhs (stmt)))
+ if (code == GIMPLE_SWITCH
+ && is_gimple_min_invariant (gimple_switch_index (stmt)))
return CONSTANT;
+ /* Arrive here for more complex cases. */
+
has_constant_operand = false;
has_undefined_operand = false;
all_undefined_operands = true;
@@ -553,13 +565,11 @@ likely_value (tree stmt)
/* If the operation combines operands like COMPLEX_EXPR make sure to
not mark the result UNDEFINED if only one part of the result is
undefined. */
- if (has_undefined_operand
- && all_undefined_operands)
+ if (has_undefined_operand && all_undefined_operands)
return UNDEFINED;
- else if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
- && has_undefined_operand)
+ else if (code == GIMPLE_ASSIGN && has_undefined_operand)
{
- switch (TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 1)))
+ switch (gimple_assign_rhs_code (stmt))
{
/* Unary operators are handled with all_undefined_operands. */
case PLUS_EXPR:
@@ -595,11 +605,11 @@ likely_value (tree stmt)
/* Returns true if STMT cannot be constant. */
static bool
-surely_varying_stmt_p (tree stmt)
+surely_varying_stmt_p (gimple stmt)
{
/* If the statement has operands that we cannot handle, it cannot be
constant. */
- if (stmt_ann (stmt)->has_volatile_ops)
+ if (gimple_has_volatile_ops (stmt))
return true;
if (!ZERO_SSA_OPERANDS (stmt, SSA_OP_ALL_VIRTUALS))
@@ -613,16 +623,23 @@ surely_varying_stmt_p (tree stmt)
return true;
}
- /* If it contains a call, it is varying. */
- if (get_call_expr_in (stmt) != NULL_TREE)
- return true;
+ /* If it is a call and does not return a value or is not a
+ builtin and not an indirect call, it is varying. */
+ if (is_gimple_call (stmt))
+ {
+ tree fndecl;
+ if (!gimple_call_lhs (stmt)
+ || ((fndecl = gimple_call_fndecl (stmt)) != NULL_TREE
+ && !DECL_BUILT_IN (fndecl)))
+ return true;
+ }
/* Anything other than assignments and conditional jumps are not
interesting for CCP. */
- if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT
- && !(TREE_CODE (stmt) == RETURN_EXPR && get_rhs (stmt) != NULL_TREE)
- && TREE_CODE (stmt) != COND_EXPR
- && TREE_CODE (stmt) != SWITCH_EXPR)
+ if (gimple_code (stmt) != GIMPLE_ASSIGN
+ && gimple_code (stmt) != GIMPLE_COND
+ && gimple_code (stmt) != GIMPLE_SWITCH
+ && gimple_code (stmt) != GIMPLE_CALL)
return true;
return false;
@@ -640,11 +657,11 @@ ccp_initialize (void)
/* Initialize simulation flags for PHI nodes and statements. */
FOR_EACH_BB (bb)
{
- block_stmt_iterator i;
+ gimple_stmt_iterator i;
- for (i = bsi_start (bb); !bsi_end_p (i); bsi_next (&i))
+ for (i = gsi_start_bb (bb); !gsi_end_p (i); gsi_next (&i))
{
- tree stmt = bsi_stmt (i);
+ gimple stmt = gsi_stmt (i);
bool is_varying = surely_varying_stmt_p (stmt);
if (is_varying)
@@ -660,24 +677,25 @@ ccp_initialize (void)
set_value_varying (def);
}
}
-
- DONT_SIMULATE_AGAIN (stmt) = is_varying;
+ prop_set_simulate_again (stmt, !is_varying);
}
}
- /* Now process PHI nodes. We never set DONT_SIMULATE_AGAIN on phi node,
- since we do not know which edges are executable yet, except for
- phi nodes for virtual operands when we do not do store ccp. */
+ /* Now process PHI nodes. We never clear the simulate_again flag on
+ phi nodes, since we do not know which edges are executable yet,
+ except for phi nodes for virtual operands when we do not do store ccp. */
FOR_EACH_BB (bb)
{
- tree phi;
+ gimple_stmt_iterator i;
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
- {
- if (!do_store_ccp && !is_gimple_reg (PHI_RESULT (phi)))
- DONT_SIMULATE_AGAIN (phi) = true;
+ for (i = gsi_start_phis (bb); !gsi_end_p (i); gsi_next (&i))
+ {
+ gimple phi = gsi_stmt (i);
+
+ if (!do_store_ccp && !is_gimple_reg (gimple_phi_result (phi)))
+ prop_set_simulate_again (phi, false);
else
- DONT_SIMULATE_AGAIN (phi) = false;
+ prop_set_simulate_again (phi, true);
}
}
}
@@ -763,18 +781,18 @@ ccp_lattice_meet (prop_value_t *val1, prop_value_t *val2)
of the PHI node that are incoming via executable edges. */
static enum ssa_prop_result
-ccp_visit_phi_node (tree phi)
+ccp_visit_phi_node (gimple phi)
{
- int i;
+ unsigned i;
prop_value_t *old_val, new_val;
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "\nVisiting PHI node: ");
- print_generic_expr (dump_file, phi, dump_flags);
+ print_gimple_stmt (dump_file, phi, 0, dump_flags);
}
- old_val = get_value (PHI_RESULT (phi));
+ old_val = get_value (gimple_phi_result (phi));
switch (old_val->lattice_val)
{
case VARYING:
@@ -794,11 +812,11 @@ ccp_visit_phi_node (tree phi)
gcc_unreachable ();
}
- for (i = 0; i < PHI_NUM_ARGS (phi); i++)
+ for (i = 0; i < gimple_phi_num_args (phi); i++)
{
/* Compute the meet operator over all the PHI arguments flowing
through executable edges. */
- edge e = PHI_ARG_EDGE (phi, i);
+ edge e = gimple_phi_arg_edge (phi, i);
if (dump_file && (dump_flags & TDF_DETAILS))
{
@@ -812,7 +830,7 @@ ccp_visit_phi_node (tree phi)
the existing value of the PHI node and the current PHI argument. */
if (e->flags & EDGE_EXECUTABLE)
{
- tree arg = PHI_ARG_DEF (phi, i);
+ tree arg = gimple_phi_arg (phi, i)->def;
prop_value_t arg_val;
if (is_gimple_min_invariant (arg))
@@ -846,7 +864,7 @@ ccp_visit_phi_node (tree phi)
}
/* Make the transition to the new value. */
- if (set_lattice_value (PHI_RESULT (phi), new_val))
+ if (set_lattice_value (gimple_phi_result (phi), new_val))
{
if (new_val.lattice_val == VARYING)
return SSA_PROP_VARYING;
@@ -865,179 +883,257 @@ ccp_visit_phi_node (tree phi)
operands are constants.
If simplification is possible, return the simplified RHS,
- otherwise return the original RHS. */
+ otherwise return the original RHS or NULL_TREE. */
static tree
-ccp_fold (tree stmt)
+ccp_fold (gimple stmt)
{
- tree rhs = get_rhs (stmt);
- enum tree_code code = TREE_CODE (rhs);
- enum tree_code_class kind = TREE_CODE_CLASS (code);
- tree retval = NULL_TREE;
-
- if (TREE_CODE (rhs) == SSA_NAME)
- {
- /* If the RHS is an SSA_NAME, return its known constant value,
- if any. */
- return get_value (rhs)->value;
- }
- else if (do_store_ccp && stmt_makes_single_load (stmt))
+ switch (gimple_code (stmt))
{
- /* If the RHS is a memory load, see if the VUSEs associated with
- it are a valid constant for that memory load. */
- prop_value_t *val = get_value_loaded_by (stmt, const_val);
- if (val && val->mem_ref)
- {
- if (operand_equal_p (val->mem_ref, rhs, 0))
- return val->value;
-
- /* If RHS is extracting REALPART_EXPR or IMAGPART_EXPR of a
- complex type with a known constant value, return it. */
- if ((TREE_CODE (rhs) == REALPART_EXPR
- || TREE_CODE (rhs) == IMAGPART_EXPR)
- && operand_equal_p (val->mem_ref, TREE_OPERAND (rhs, 0), 0))
- return fold_build1 (TREE_CODE (rhs), TREE_TYPE (rhs), val->value);
- }
- return NULL_TREE;
- }
+ case GIMPLE_ASSIGN:
+ {
+ enum tree_code subcode = gimple_assign_rhs_code (stmt);
+
+ switch (get_gimple_rhs_class (subcode))
+ {
+ case GIMPLE_SINGLE_RHS:
+ {
+ tree rhs = gimple_assign_rhs1 (stmt);
+ enum tree_code_class kind = TREE_CODE_CLASS (subcode);
+
+ if (TREE_CODE (rhs) == SSA_NAME)
+ {
+ /* If the RHS is an SSA_NAME, return its known constant value,
+ if any. */
+ return get_value (rhs)->value;
+ }
+ /* Handle propagating invariant addresses into address operations.
+ The folding we do here matches that in tree-ssa-forwprop.c. */
+ else if (TREE_CODE (rhs) == ADDR_EXPR)
+ {
+ tree *base;
+ base = &TREE_OPERAND (rhs, 0);
+ while (handled_component_p (*base))
+ base = &TREE_OPERAND (*base, 0);
+ if (TREE_CODE (*base) == INDIRECT_REF
+ && TREE_CODE (TREE_OPERAND (*base, 0)) == SSA_NAME)
+ {
+ prop_value_t *val = get_value (TREE_OPERAND (*base, 0));
+ if (val->lattice_val == CONSTANT
+ && TREE_CODE (val->value) == ADDR_EXPR
+ && useless_type_conversion_p
+ (TREE_TYPE (TREE_OPERAND (*base, 0)),
+ TREE_TYPE (val->value))
+ && useless_type_conversion_p
+ (TREE_TYPE (*base),
+ TREE_TYPE (TREE_OPERAND (val->value, 0))))
+ {
+ /* We need to return a new tree, not modify the IL
+ or share parts of it. So play some tricks to
+ avoid manually building it. */
+ tree ret, save = *base;
+ *base = TREE_OPERAND (val->value, 0);
+ ret = unshare_expr (rhs);
+ recompute_tree_invariant_for_addr_expr (ret);
+ *base = save;
+ return ret;
+ }
+ }
+ }
- /* Unary operators. Note that we know the single operand must
- be a constant. So this should almost always return a
- simplified RHS. */
- if (kind == tcc_unary)
- {
- /* Handle unary operators which can appear in GIMPLE form. */
- tree op0 = TREE_OPERAND (rhs, 0);
+ else if (do_store_ccp && stmt_makes_single_load (stmt))
+ {
+ /* If the RHS is a memory load, see if the VUSEs associated with
+ it are a valid constant for that memory load. */
+ prop_value_t *val = get_value_loaded_by (stmt, const_val);
+ if (val && val->mem_ref)
+ {
+ if (operand_equal_p (val->mem_ref, rhs, 0))
+ return val->value;
+
+ /* If RHS is extracting REALPART_EXPR or IMAGPART_EXPR of a
+ complex type with a known constant value, return it. */
+ if ((TREE_CODE (rhs) == REALPART_EXPR
+ || TREE_CODE (rhs) == IMAGPART_EXPR)
+ && operand_equal_p (val->mem_ref, TREE_OPERAND (rhs, 0), 0))
+ return fold_build1 (TREE_CODE (rhs), TREE_TYPE (rhs), val->value);
+ }
+ }
+
+ if (kind == tcc_reference)
+ return fold_const_aggregate_ref (rhs);
+ else if (kind == tcc_declaration)
+ return get_symbol_constant_value (rhs);
+ return rhs;
+ }
+
+ case GIMPLE_UNARY_RHS:
+ {
+ /* Handle unary operators that can appear in GIMPLE form.
+ Note that we know the single operand must be a constant,
+ so this should almost always return a simplified RHS. */
+ tree lhs = gimple_assign_lhs (stmt);
+ tree op0 = gimple_assign_rhs1 (stmt);
+
+ /* Simplify the operand down to a constant. */
+ if (TREE_CODE (op0) == SSA_NAME)
+ {
+ prop_value_t *val = get_value (op0);
+ if (val->lattice_val == CONSTANT)
+ op0 = get_value (op0)->value;
+ }
+
+ /* Conversions are useless for CCP purposes if they are
+ value-preserving. Thus the restrictions that
+ useless_type_conversion_p places for pointer type conversions
+ do not apply here. Substitution later will only substitute to
+ allowed places. */
+ if (IS_CONVERT_EXPR_CODE_P (subcode)
+ && POINTER_TYPE_P (TREE_TYPE (lhs))
+ && POINTER_TYPE_P (TREE_TYPE (op0))
+ /* Do not allow differences in volatile qualification
+ as this might get us confused as to whether a
+ propagation destination statement is volatile
+ or not. See PR36988. */
+ && (TYPE_VOLATILE (TREE_TYPE (TREE_TYPE (lhs)))
+ == TYPE_VOLATILE (TREE_TYPE (TREE_TYPE (op0)))))
+ {
+ tree tem;
+ /* Still try to generate a constant of correct type. */
+ if (!useless_type_conversion_p (TREE_TYPE (lhs),
+ TREE_TYPE (op0))
+ && ((tem = maybe_fold_offset_to_address
+ (op0, integer_zero_node, TREE_TYPE (lhs)))
+ != NULL_TREE))
+ return tem;
+ return op0;
+ }
- /* Simplify the operand down to a constant. */
- if (TREE_CODE (op0) == SSA_NAME)
- {
- prop_value_t *val = get_value (op0);
- if (val->lattice_val == CONSTANT)
- op0 = get_value (op0)->value;
- }
+ return fold_unary (subcode, gimple_expr_type (stmt), op0);
+ }
+
+ case GIMPLE_BINARY_RHS:
+ {
+ /* Handle binary operators that can appear in GIMPLE form. */
+ tree op0 = gimple_assign_rhs1 (stmt);
+ tree op1 = gimple_assign_rhs2 (stmt);
+
+ /* Simplify the operands down to constants when appropriate. */
+ if (TREE_CODE (op0) == SSA_NAME)
+ {
+ prop_value_t *val = get_value (op0);
+ if (val->lattice_val == CONSTANT)
+ op0 = val->value;
+ }
+
+ if (TREE_CODE (op1) == SSA_NAME)
+ {
+ prop_value_t *val = get_value (op1);
+ if (val->lattice_val == CONSTANT)
+ op1 = val->value;
+ }
+
+ /* Fold &foo + CST into an invariant reference if possible. */
+ if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR
+ && TREE_CODE (op0) == ADDR_EXPR
+ && TREE_CODE (op1) == INTEGER_CST)
+ {
+ tree lhs = gimple_assign_lhs (stmt);
+ tree tem = maybe_fold_offset_to_address (op0, op1,
+ TREE_TYPE (lhs));
+ if (tem != NULL_TREE)
+ return tem;
+ }
- /* Conversions are useless for CCP purposes if they are
- value-preserving. Thus the restrictions that
- useless_type_conversion_p places for pointer type conversions do
- not apply here. Substitution later will only substitute to
- allowed places. */
- if ((code == NOP_EXPR || code == CONVERT_EXPR)
- && ((POINTER_TYPE_P (TREE_TYPE (rhs))
- && POINTER_TYPE_P (TREE_TYPE (op0)))
- || useless_type_conversion_p (TREE_TYPE (rhs), TREE_TYPE (op0))))
- return op0;
- return fold_unary (code, TREE_TYPE (rhs), op0);
- }
-
- /* Binary and comparison operators. We know one or both of the
- operands are constants. */
- else if (kind == tcc_binary
- || kind == tcc_comparison
- || code == TRUTH_AND_EXPR
- || code == TRUTH_OR_EXPR
- || code == TRUTH_XOR_EXPR)
- {
- /* Handle binary and comparison operators that can appear in
- GIMPLE form. */
- tree op0 = TREE_OPERAND (rhs, 0);
- tree op1 = TREE_OPERAND (rhs, 1);
-
- /* Simplify the operands down to constants when appropriate. */
- if (TREE_CODE (op0) == SSA_NAME)
- {
- prop_value_t *val = get_value (op0);
- if (val->lattice_val == CONSTANT)
- op0 = val->value;
- }
+ return fold_binary (subcode, gimple_expr_type (stmt), op0, op1);
+ }
- if (TREE_CODE (op1) == SSA_NAME)
- {
- prop_value_t *val = get_value (op1);
- if (val->lattice_val == CONSTANT)
- op1 = val->value;
- }
+ default:
+ gcc_unreachable ();
+ }
+ }
+ break;
- return fold_binary (code, TREE_TYPE (rhs), op0, op1);
- }
+ case GIMPLE_CALL:
+ {
+ tree fn = gimple_call_fn (stmt);
+ prop_value_t *val;
- else if (kind == tcc_declaration)
- return get_symbol_constant_value (rhs);
+ if (TREE_CODE (fn) == SSA_NAME)
+ {
+ val = get_value (fn);
+ if (val->lattice_val == CONSTANT)
+ fn = val->value;
+ }
+ if (TREE_CODE (fn) == ADDR_EXPR
+ && DECL_BUILT_IN (TREE_OPERAND (fn, 0)))
+ {
+ tree *args = XALLOCAVEC (tree, gimple_call_num_args (stmt));
+ tree call, retval;
+ unsigned i;
+ for (i = 0; i < gimple_call_num_args (stmt); ++i)
+ {
+ args[i] = gimple_call_arg (stmt, i);
+ if (TREE_CODE (args[i]) == SSA_NAME)
+ {
+ val = get_value (args[i]);
+ if (val->lattice_val == CONSTANT)
+ args[i] = val->value;
+ }
+ }
+ call = build_call_array (gimple_call_return_type (stmt),
+ fn, gimple_call_num_args (stmt), args);
+ retval = fold_call_expr (call, false);
+ if (retval)
+ /* fold_call_expr wraps the result inside a NOP_EXPR. */
+ STRIP_NOPS (retval);
+ return retval;
+ }
+ return NULL_TREE;
+ }
- else if (kind == tcc_reference)
- return fold_const_aggregate_ref (rhs);
+ case GIMPLE_COND:
+ {
+ /* Handle comparison operators that can appear in GIMPLE form. */
+ tree op0 = gimple_cond_lhs (stmt);
+ tree op1 = gimple_cond_rhs (stmt);
+ enum tree_code code = gimple_cond_code (stmt);
+
+ /* Simplify the operands down to constants when appropriate. */
+ if (TREE_CODE (op0) == SSA_NAME)
+ {
+ prop_value_t *val = get_value (op0);
+ if (val->lattice_val == CONSTANT)
+ op0 = val->value;
+ }
+
+ if (TREE_CODE (op1) == SSA_NAME)
+ {
+ prop_value_t *val = get_value (op1);
+ if (val->lattice_val == CONSTANT)
+ op1 = val->value;
+ }
+
+ return fold_binary (code, boolean_type_node, op0, op1);
+ }
- /* Handle propagating invariant addresses into address operations.
- The folding we do here matches that in tree-ssa-forwprop.c. */
- else if (code == ADDR_EXPR)
- {
- tree *base;
- base = &TREE_OPERAND (rhs, 0);
- while (handled_component_p (*base))
- base = &TREE_OPERAND (*base, 0);
- if (TREE_CODE (*base) == INDIRECT_REF
- && TREE_CODE (TREE_OPERAND (*base, 0)) == SSA_NAME)
- {
- prop_value_t *val = get_value (TREE_OPERAND (*base, 0));
- if (val->lattice_val == CONSTANT
- && TREE_CODE (val->value) == ADDR_EXPR
- && useless_type_conversion_p (TREE_TYPE (TREE_OPERAND (*base, 0)),
- TREE_TYPE (val->value))
- && useless_type_conversion_p (TREE_TYPE (*base),
- TREE_TYPE (TREE_OPERAND (val->value, 0))))
- {
- /* We need to return a new tree, not modify the IL or share
- parts of it. So play some tricks to avoid manually
- building it. */
- tree ret, save = *base;
- *base = TREE_OPERAND (val->value, 0);
- ret = unshare_expr (rhs);
- recompute_tree_invariant_for_addr_expr (ret);
- *base = save;
- return ret;
- }
- }
- }
+ case GIMPLE_SWITCH:
+ {
+ tree rhs = gimple_switch_index (stmt);
- /* We may be able to fold away calls to builtin functions if their
- arguments are constants. */
- else if (code == CALL_EXPR
- && TREE_CODE (CALL_EXPR_FN (rhs)) == ADDR_EXPR
- && TREE_CODE (TREE_OPERAND (CALL_EXPR_FN (rhs), 0)) == FUNCTION_DECL
- && DECL_BUILT_IN (TREE_OPERAND (CALL_EXPR_FN (rhs), 0)))
- {
- if (!ZERO_SSA_OPERANDS (stmt, SSA_OP_USE))
- {
- tree *orig, var;
- size_t i = 0;
- ssa_op_iter iter;
- use_operand_p var_p;
-
- /* Preserve the original values of every operand. */
- orig = XNEWVEC (tree, NUM_SSA_OPERANDS (stmt, SSA_OP_USE));
- FOR_EACH_SSA_TREE_OPERAND (var, stmt, iter, SSA_OP_USE)
- orig[i++] = var;
-
- /* Substitute operands with their values and try to fold. */
- replace_uses_in (stmt, NULL, const_val);
- retval = fold_call_expr (rhs, false);
-
- /* Restore operands to their original form. */
- i = 0;
- FOR_EACH_SSA_USE_OPERAND (var_p, stmt, iter, SSA_OP_USE)
- SET_USE (var_p, orig[i++]);
- free (orig);
- }
- }
- else
- return rhs;
+ if (TREE_CODE (rhs) == SSA_NAME)
+ {
+ /* If the RHS is an SSA_NAME, return its known constant value,
+ if any. */
+ return get_value (rhs)->value;
+ }
- /* If we got a simplified form, see if we need to convert its type. */
- if (retval)
- return fold_convert (TREE_TYPE (rhs), retval);
+ return rhs;
+ }
- /* No simplification was possible. */
- return rhs;
+ default:
+ gcc_unreachable ();
+ }
}
@@ -1206,11 +1302,12 @@ fold_const_aggregate_ref (tree t)
return NULL_TREE;
}
-
-/* Evaluate statement STMT. */
+
+/* Evaluate statement STMT.
+ Valid only for assignments, calls, conditionals, and switches. */
static prop_value_t
-evaluate_stmt (tree stmt)
+evaluate_stmt (gimple stmt)
{
prop_value_t val;
tree simplified = NULL_TREE;
@@ -1223,12 +1320,31 @@ evaluate_stmt (tree stmt)
/* If the statement is likely to have a CONSTANT result, then try
to fold the statement to determine the constant value. */
+ /* FIXME. This is the only place that we call ccp_fold.
+ Since likely_value never returns CONSTANT for calls, we will
+ not attempt to fold them, including builtins that may profit. */
if (likelyvalue == CONSTANT)
simplified = ccp_fold (stmt);
/* If the statement is likely to have a VARYING result, then do not
bother folding the statement. */
else if (likelyvalue == VARYING)
- simplified = get_rhs (stmt);
+ {
+ enum tree_code code = gimple_code (stmt);
+ if (code == GIMPLE_ASSIGN)
+ {
+ enum tree_code subcode = gimple_assign_rhs_code (stmt);
+
+ /* Other cases cannot satisfy is_gimple_min_invariant
+ without folding. */
+ if (get_gimple_rhs_class (subcode) == GIMPLE_SINGLE_RHS)
+ simplified = gimple_assign_rhs1 (stmt);
+ }
+ else if (code == GIMPLE_SWITCH)
+ simplified = gimple_switch_index (stmt);
+ else
+ /* These cannot satisfy is_gimple_min_invariant without folding. */
+ gcc_assert (code == GIMPLE_CALL || code == GIMPLE_COND);
+ }
is_constant = simplified && is_gimple_min_invariant (simplified);
@@ -1275,45 +1391,55 @@ evaluate_stmt (tree stmt)
return val;
}
-
/* Visit the assignment statement STMT. Set the value of its LHS to the
value computed by the RHS and store LHS in *OUTPUT_P. If STMT
creates virtual definitions, set the value of each new name to that
- of the RHS (if we can derive a constant out of the RHS). */
+ of the RHS (if we can derive a constant out of the RHS).
+ Value-returning call statements also perform an assignment, and
+ are handled here. */
static enum ssa_prop_result
-visit_assignment (tree stmt, tree *output_p)
+visit_assignment (gimple stmt, tree *output_p)
{
prop_value_t val;
- tree lhs, rhs;
enum ssa_prop_result retval;
- lhs = GIMPLE_STMT_OPERAND (stmt, 0);
- rhs = GIMPLE_STMT_OPERAND (stmt, 1);
+ tree lhs = gimple_get_lhs (stmt);
- if (TREE_CODE (rhs) == SSA_NAME)
- {
- /* For a simple copy operation, we copy the lattice values. */
- prop_value_t *nval = get_value (rhs);
- val = *nval;
- }
- else if (do_store_ccp && stmt_makes_single_load (stmt))
+ gcc_assert (gimple_code (stmt) != GIMPLE_CALL
+ || gimple_call_lhs (stmt) != NULL_TREE);
+
+ if (gimple_assign_copy_p (stmt))
{
- /* Same as above, but the RHS is not a gimple register and yet
- has a known VUSE. If STMT is loading from the same memory
- location that created the SSA_NAMEs for the virtual operands,
- we can propagate the value on the RHS. */
- prop_value_t *nval = get_value_loaded_by (stmt, const_val);
+ tree rhs = gimple_assign_rhs1 (stmt);
- if (nval
- && nval->mem_ref
- && operand_equal_p (nval->mem_ref, rhs, 0))
- val = *nval;
+ if (TREE_CODE (rhs) == SSA_NAME)
+ {
+ /* For a simple copy operation, we copy the lattice values. */
+ prop_value_t *nval = get_value (rhs);
+ val = *nval;
+ }
+ else if (do_store_ccp && stmt_makes_single_load (stmt))
+ {
+ /* Same as above, but the RHS is not a gimple register and yet
+ has a known VUSE. If STMT is loading from the same memory
+ location that created the SSA_NAMEs for the virtual operands,
+ we can propagate the value on the RHS. */
+ prop_value_t *nval = get_value_loaded_by (stmt, const_val);
+
+ if (nval
+ && nval->mem_ref
+ && operand_equal_p (nval->mem_ref, rhs, 0))
+ val = *nval;
+ else
+ val = evaluate_stmt (stmt);
+ }
else
- val = evaluate_stmt (stmt);
+ val = evaluate_stmt (stmt);
}
else
- /* Evaluate the statement. */
+ /* Evaluate the statement, which could be
+ either a GIMPLE_ASSIGN or a GIMPLE_CALL. */
val = evaluate_stmt (stmt);
retval = SSA_PROP_NOT_INTERESTING;
@@ -1382,12 +1508,12 @@ visit_assignment (tree stmt, tree *output_p)
SSA_PROP_VARYING. */
static enum ssa_prop_result
-visit_cond_stmt (tree stmt, edge *taken_edge_p)
+visit_cond_stmt (gimple stmt, edge *taken_edge_p)
{
prop_value_t val;
basic_block block;
- block = bb_for_stmt (stmt);
+ block = gimple_bb (stmt);
val = evaluate_stmt (stmt);
/* Find which edge out of the conditional block will be taken and add it
@@ -1412,7 +1538,7 @@ visit_cond_stmt (tree stmt, edge *taken_edge_p)
value, return SSA_PROP_VARYING. */
static enum ssa_prop_result
-ccp_visit_stmt (tree stmt, edge *taken_edge_p, tree *output_p)
+ccp_visit_stmt (gimple stmt, edge *taken_edge_p, tree *output_p)
{
tree def;
ssa_op_iter iter;
@@ -1420,21 +1546,33 @@ ccp_visit_stmt (tree stmt, edge *taken_edge_p, tree *output_p)
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "\nVisiting statement:\n");
- print_generic_stmt (dump_file, stmt, dump_flags);
+ print_gimple_stmt (dump_file, stmt, 0, dump_flags);
}
- if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT)
+ switch (gimple_code (stmt))
{
- /* If the statement is an assignment that produces a single
- output value, evaluate its RHS to see if the lattice value of
- its output has changed. */
- return visit_assignment (stmt, output_p);
- }
- else if (TREE_CODE (stmt) == COND_EXPR || TREE_CODE (stmt) == SWITCH_EXPR)
- {
- /* If STMT is a conditional branch, see if we can determine
- which branch will be taken. */
- return visit_cond_stmt (stmt, taken_edge_p);
+ case GIMPLE_ASSIGN:
+ /* If the statement is an assignment that produces a single
+ output value, evaluate its RHS to see if the lattice value of
+ its output has changed. */
+ return visit_assignment (stmt, output_p);
+
+ case GIMPLE_CALL:
+ /* A value-returning call also performs an assignment. */
+ if (gimple_call_lhs (stmt) != NULL_TREE)
+ return visit_assignment (stmt, output_p);
+ break;
+
+ case GIMPLE_COND:
+ case GIMPLE_SWITCH:
+ /* If STMT is a conditional branch, see if we can determine
+ which branch will be taken. */
+ /* FIXME. It appears that we should be able to optimize
+ computed GOTOs here as well. */
+ return visit_cond_stmt (stmt, taken_edge_p);
+
+ default:
+ break;
}
/* Any other kind of statement is not interesting for constant
@@ -1830,15 +1968,16 @@ maybe_fold_offset_to_reference (tree base, tree offset, tree orig_type)
so it needs to be removed and new COMPONENT_REF constructed.
The wrong COMPONENT_REF are often constructed by folding the
(type *)&object within the expression (type *)&object+offset */
- if (handled_component_p (base) && 0)
+ if (handled_component_p (base))
{
HOST_WIDE_INT sub_offset, size, maxsize;
tree newbase;
newbase = get_ref_base_and_extent (base, &sub_offset,
&size, &maxsize);
gcc_assert (newbase);
- gcc_assert (!(sub_offset & (BITS_PER_UNIT - 1)));
- if (size == maxsize)
+ if (size == maxsize
+ && size != -1
+ && !(sub_offset & (BITS_PER_UNIT - 1)))
{
base = newbase;
if (sub_offset)
@@ -1870,6 +2009,63 @@ maybe_fold_offset_to_reference (tree base, tree offset, tree orig_type)
return ret;
}
+/* Attempt to express (ORIG_TYPE)&BASE+OFFSET as &BASE->field_of_orig_type
+ or &BASE[index] or by combination of those.
+
+ Before attempting the conversion strip off existing component refs. */
+
+tree
+maybe_fold_offset_to_address (tree addr, tree offset, tree orig_type)
+{
+ tree t;
+
+ gcc_assert (POINTER_TYPE_P (TREE_TYPE (addr))
+ && POINTER_TYPE_P (orig_type));
+
+ t = maybe_fold_offset_to_reference (addr, offset, TREE_TYPE (orig_type));
+ if (t != NULL_TREE)
+ {
+ tree orig = addr;
+ tree ptr_type;
+
+ /* For __builtin_object_size to function correctly we need to
+ make sure not to fold address arithmetic so that we change
+ reference from one array to another. This would happen for
+ example for
+
+ struct X { char s1[10]; char s2[10] } s;
+ char *foo (void) { return &s.s2[-4]; }
+
+ where we need to avoid generating &s.s1[6]. As the C and
+ C++ frontends create different initial trees
+ (char *) &s.s1 + -4 vs. &s.s1[-4] we have to do some
+ sophisticated comparisons here. Note that checking for the
+ condition after the fact is easier than trying to avoid doing
+ the folding. */
+ STRIP_NOPS (orig);
+ if (TREE_CODE (orig) == ADDR_EXPR)
+ orig = TREE_OPERAND (orig, 0);
+ if ((TREE_CODE (orig) == ARRAY_REF
+ || (TREE_CODE (orig) == COMPONENT_REF
+ && TREE_CODE (TREE_TYPE (TREE_OPERAND (orig, 1))) == ARRAY_TYPE))
+ && (TREE_CODE (t) == ARRAY_REF
+ || (TREE_CODE (t) == COMPONENT_REF
+ && TREE_CODE (TREE_TYPE (TREE_OPERAND (t, 1))) == ARRAY_TYPE))
+ && !operand_equal_p (TREE_CODE (orig) == ARRAY_REF
+ ? TREE_OPERAND (orig, 0) : orig,
+ TREE_CODE (t) == ARRAY_REF
+ ? TREE_OPERAND (t, 0) : t, 0))
+ return NULL_TREE;
+
+ ptr_type = build_pointer_type (TREE_TYPE (t));
+ if (!useless_type_conversion_p (orig_type, ptr_type))
+ return NULL_TREE;
+ return build_fold_addr_expr_with_type (t, ptr_type);
+ }
+
+ return NULL_TREE;
+}
+
/* A subroutine of fold_stmt_r. Attempt to simplify *(BASE+OFFSET).
Return the simplified expression, or NULL if nothing could be done. */
@@ -1965,30 +2161,24 @@ maybe_fold_stmt_indirect (tree expr, tree base, tree offset)
}
-/* A subroutine of fold_stmt_r. EXPR is a POINTER_PLUS_EXPR.
-
- A quaint feature extant in our address arithmetic is that there
+/* A quaint feature extant in our address arithmetic is that there
can be hidden type changes here. The type of the result need
not be the same as the type of the input pointer.
What we're after here is an expression of the form
(T *)(&array + const)
- where the cast doesn't actually exist, but is implicit in the
+ where array is OP0, const is OP1, RES_TYPE is T and
+ the cast doesn't actually exist, but is implicit in the
type of the POINTER_PLUS_EXPR. We'd like to turn this into
&array[x]
which may be able to propagate further. */
-static tree
-maybe_fold_stmt_addition (tree expr)
+tree
+maybe_fold_stmt_addition (tree res_type, tree op0, tree op1)
{
- tree op0 = TREE_OPERAND (expr, 0);
- tree op1 = TREE_OPERAND (expr, 1);
- tree ptr_type = TREE_TYPE (expr);
tree ptd_type;
tree t;
- gcc_assert (TREE_CODE (expr) == POINTER_PLUS_EXPR);
-
/* It had better be a constant. */
if (TREE_CODE (op1) != INTEGER_CST)
return NULL_TREE;
@@ -2039,7 +2229,7 @@ maybe_fold_stmt_addition (tree expr)
op0 = array_obj;
}
- ptd_type = TREE_TYPE (ptr_type);
+ ptd_type = TREE_TYPE (res_type);
/* If we want a pointer to void, reconstruct the reference from the
array element type. A pointer to that can be trivially converted
to void *. This happens as we fold (void *)(ptr p+ off). */
@@ -2053,7 +2243,7 @@ maybe_fold_stmt_addition (tree expr)
t = maybe_fold_offset_to_component_ref (TREE_TYPE (op0), op0, op1,
ptd_type, false);
if (t)
- t = build1 (ADDR_EXPR, ptr_type, t);
+ t = build1 (ADDR_EXPR, res_type, t);
return t;
}
@@ -2063,7 +2253,7 @@ maybe_fold_stmt_addition (tree expr)
struct fold_stmt_r_data
{
- tree stmt;
+ gimple stmt;
bool *changed_p;
bool *inside_addr_expr_p;
};
@@ -2074,12 +2264,17 @@ struct fold_stmt_r_data
static tree
fold_stmt_r (tree *expr_p, int *walk_subtrees, void *data)
{
- struct fold_stmt_r_data *fold_stmt_r_data = (struct fold_stmt_r_data *) data;
- bool *inside_addr_expr_p = fold_stmt_r_data->inside_addr_expr_p;
- bool *changed_p = fold_stmt_r_data->changed_p;
+ struct walk_stmt_info *wi = (struct walk_stmt_info *) data;
+ struct fold_stmt_r_data *fold_stmt_r_data;
+ bool *inside_addr_expr_p;
+ bool *changed_p;
tree expr = *expr_p, t;
bool volatile_p = TREE_THIS_VOLATILE (expr);
+ fold_stmt_r_data = (struct fold_stmt_r_data *) wi->info;
+ inside_addr_expr_p = fold_stmt_r_data->inside_addr_expr_p;
+ changed_p = fold_stmt_r_data->changed_p;
+
/* ??? It'd be nice if walk_tree had a pre-order option. */
switch (TREE_CODE (expr))
{
@@ -2106,16 +2301,10 @@ fold_stmt_r (tree *expr_p, int *walk_subtrees, void *data)
if (POINTER_TYPE_P (TREE_TYPE (expr))
&& POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (expr, 0)))
- && (t = maybe_fold_offset_to_reference
- (TREE_OPERAND (expr, 0),
- integer_zero_node,
- TREE_TYPE (TREE_TYPE (expr)))))
- {
- tree ptr_type = build_pointer_type (TREE_TYPE (t));
- if (!useless_type_conversion_p (TREE_TYPE (expr), ptr_type))
- return NULL_TREE;
- t = build_fold_addr_expr_with_type (t, ptr_type);
- }
+ && (t = maybe_fold_offset_to_address (TREE_OPERAND (expr, 0),
+ integer_zero_node,
+ TREE_TYPE (TREE_TYPE (expr)))))
+ return t;
break;
/* ??? Could handle more ARRAY_REFs here, as a variant of INDIRECT_REF.
@@ -2145,18 +2334,6 @@ fold_stmt_r (tree *expr_p, int *walk_subtrees, void *data)
recompute_tree_invariant_for_addr_expr (expr);
return NULL_TREE;
- case POINTER_PLUS_EXPR:
- t = walk_tree (&TREE_OPERAND (expr, 0), fold_stmt_r, data, NULL);
- if (t)
- return t;
- t = walk_tree (&TREE_OPERAND (expr, 1), fold_stmt_r, data, NULL);
- if (t)
- return t;
- *walk_subtrees = 0;
-
- t = maybe_fold_stmt_addition (expr);
- break;
-
case COMPONENT_REF:
t = walk_tree (&TREE_OPERAND (expr, 0), fold_stmt_r, data, NULL);
if (t)
@@ -2182,6 +2359,20 @@ fold_stmt_r (tree *expr_p, int *walk_subtrees, void *data)
t = maybe_fold_tmr (expr);
break;
+ case POINTER_PLUS_EXPR:
+ t = walk_tree (&TREE_OPERAND (expr, 0), fold_stmt_r, data, NULL);
+ if (t)
+ return t;
+ t = walk_tree (&TREE_OPERAND (expr, 1), fold_stmt_r, data, NULL);
+ if (t)
+ return t;
+ *walk_subtrees = 0;
+
+ t = maybe_fold_stmt_addition (TREE_TYPE (expr),
+ TREE_OPERAND (expr, 0),
+ TREE_OPERAND (expr, 1));
+ break;
+
case COND_EXPR:
if (COMPARISON_CLASS_P (TREE_OPERAND (expr, 0)))
{
@@ -2193,11 +2384,15 @@ fold_stmt_r (tree *expr_p, int *walk_subtrees, void *data)
tem = fold_binary (TREE_CODE (op0), TREE_TYPE (op0),
TREE_OPERAND (op0, 0),
TREE_OPERAND (op0, 1));
- set = tem && set_rhs (expr_p, tem);
+ /* This is actually a conditional expression, not a GIMPLE
+ conditional statement, however, the valid_gimple_rhs_p
+ test still applies. */
+ set = tem && is_gimple_condexpr (tem) && valid_gimple_rhs_p (tem);
fold_undefer_overflow_warnings (set, fold_stmt_r_data->stmt, 0);
if (set)
{
- t = *expr_p;
+ COND_EXPR_COND (expr) = tem;
+ t = expr;
break;
}
}
@@ -2218,7 +2413,6 @@ fold_stmt_r (tree *expr_p, int *walk_subtrees, void *data)
return NULL_TREE;
}
-
/* Return the string length, maximum string length or maximum value of
ARG in LENGTH.
If ARG is an SSA name variable, follow its use-def chains. If LENGTH
@@ -2231,7 +2425,8 @@ fold_stmt_r (tree *expr_p, int *walk_subtrees, void *data)
static bool
get_maxval_strlen (tree arg, tree *length, bitmap visited, int type)
{
- tree var, def_stmt, val;
+ tree var, val;
+ gimple def_stmt;
if (TREE_CODE (arg) != SSA_NAME)
{
@@ -2290,74 +2485,75 @@ get_maxval_strlen (tree arg, tree *length, bitmap visited, int type)
var = arg;
def_stmt = SSA_NAME_DEF_STMT (var);
- switch (TREE_CODE (def_stmt))
- {
- case GIMPLE_MODIFY_STMT:
- {
- tree rhs;
-
- /* The RHS of the statement defining VAR must either have a
- constant length or come from another SSA_NAME with a constant
- length. */
- rhs = GIMPLE_STMT_OPERAND (def_stmt, 1);
- STRIP_NOPS (rhs);
- return get_maxval_strlen (rhs, length, visited, type);
- }
-
- case PHI_NODE:
+ switch (gimple_code (def_stmt))
+ {
+ case GIMPLE_ASSIGN:
+ /* The RHS of the statement defining VAR must either have a
+ constant length or come from another SSA_NAME with a constant
+ length. */
+ if (gimple_assign_single_p (def_stmt)
+ || gimple_assign_unary_nop_p (def_stmt))
+ {
+ tree rhs = gimple_assign_rhs1 (def_stmt);
+ return get_maxval_strlen (rhs, length, visited, type);
+ }
+ return false;
+
+ case GIMPLE_PHI:
{
/* All the arguments of the PHI node must have the same constant
length. */
- int i;
-
- for (i = 0; i < PHI_NUM_ARGS (def_stmt); i++)
- {
- tree arg = PHI_ARG_DEF (def_stmt, i);
-
- /* If this PHI has itself as an argument, we cannot
- determine the string length of this argument. However,
- if we can find a constant string length for the other
- PHI args then we can still be sure that this is a
- constant string length. So be optimistic and just
- continue with the next argument. */
- if (arg == PHI_RESULT (def_stmt))
- continue;
-
- if (!get_maxval_strlen (arg, length, visited, type))
- return false;
- }
-
- return true;
- }
+ unsigned i;
+
+ for (i = 0; i < gimple_phi_num_args (def_stmt); i++)
+ {
+ tree arg = gimple_phi_arg (def_stmt, i)->def;
+
+ /* If this PHI has itself as an argument, we cannot
+ determine the string length of this argument. However,
+ if we can find a constant string length for the other
+ PHI args then we can still be sure that this is a
+ constant string length. So be optimistic and just
+ continue with the next argument. */
+ if (arg == gimple_phi_result (def_stmt))
+ continue;
+
+ if (!get_maxval_strlen (arg, length, visited, type))
+ return false;
+ }
+ }
+ return true;
default:
- break;
+ return false;
}
-
-
- return false;
}
-/* Fold builtin call FN in statement STMT. If it cannot be folded into a
- constant, return NULL_TREE. Otherwise, return its constant value. */
+/* Fold builtin call in statement STMT. Returns a simplified tree.
+ We may return a non-constant expression, including another call
+ to a different function and with different arguments, e.g.,
+ substituting memcpy for strcpy when the string length is known.
+ Note that some builtins expand into inline code that may not
+ be valid in GIMPLE. Callers must take care. */
static tree
-ccp_fold_builtin (tree stmt, tree fn)
+ccp_fold_builtin (gimple stmt)
{
tree result, val[3];
tree callee, a;
int arg_mask, i, type;
bitmap visited;
bool ignore;
- call_expr_arg_iterator iter;
int nargs;
- ignore = TREE_CODE (stmt) != GIMPLE_MODIFY_STMT;
+ gcc_assert (is_gimple_call (stmt));
+
+ ignore = (gimple_call_lhs (stmt) == NULL);
/* First try the generic builtin folder. If that succeeds, return the
result directly. */
- result = fold_call_expr (fn, ignore);
+ result = fold_call_stmt (stmt, ignore);
if (result)
{
if (ignore)
@@ -2366,13 +2562,13 @@ ccp_fold_builtin (tree stmt, tree fn)
}
/* Ignore MD builtins. */
- callee = get_callee_fndecl (fn);
+ callee = gimple_call_fndecl (stmt);
if (DECL_BUILT_IN_CLASS (callee) == BUILT_IN_MD)
return NULL_TREE;
/* If the builtin could not be folded, and it has no argument list,
we're done. */
- nargs = call_expr_nargs (fn);
+ nargs = gimple_call_num_args (stmt);
if (nargs == 0)
return NULL_TREE;
@@ -2416,16 +2612,15 @@ ccp_fold_builtin (tree stmt, tree fn)
visited = BITMAP_ALLOC (NULL);
memset (val, 0, sizeof (val));
- init_call_expr_arg_iterator (fn, &iter);
- for (i = 0; arg_mask; i++, arg_mask >>= 1)
+ for (i = 0; i < nargs; i++)
{
- a = next_call_expr_arg (&iter);
- if (arg_mask & 1)
- {
- bitmap_clear (visited);
- if (!get_maxval_strlen (a, &val[i], visited, type))
- val[i] = NULL_TREE;
- }
+ if ((arg_mask >> i) & 1)
+ {
+ a = gimple_call_arg (stmt, i);
+ bitmap_clear (visited);
+ if (!get_maxval_strlen (a, &val[i], visited, type))
+ val[i] = NULL_TREE;
+ }
}
BITMAP_FREE (visited);
@@ -2436,7 +2631,8 @@ ccp_fold_builtin (tree stmt, tree fn)
case BUILT_IN_STRLEN:
if (val[0])
{
- tree new_val = fold_convert (TREE_TYPE (fn), val[0]);
+ tree new_val =
+ fold_convert (TREE_TYPE (gimple_call_lhs (stmt)), val[0]);
/* If the result is not a valid gimple value, or not a cast
of a valid gimple value, then we can not use the result. */
@@ -2450,32 +2646,30 @@ ccp_fold_builtin (tree stmt, tree fn)
case BUILT_IN_STRCPY:
if (val[1] && is_gimple_val (val[1]) && nargs == 2)
result = fold_builtin_strcpy (callee,
- CALL_EXPR_ARG (fn, 0),
- CALL_EXPR_ARG (fn, 1),
+ gimple_call_arg (stmt, 0),
+ gimple_call_arg (stmt, 1),
val[1]);
break;
case BUILT_IN_STRNCPY:
if (val[1] && is_gimple_val (val[1]) && nargs == 3)
result = fold_builtin_strncpy (callee,
- CALL_EXPR_ARG (fn, 0),
- CALL_EXPR_ARG (fn, 1),
- CALL_EXPR_ARG (fn, 2),
+ gimple_call_arg (stmt, 0),
+ gimple_call_arg (stmt, 1),
+ gimple_call_arg (stmt, 2),
val[1]);
break;
case BUILT_IN_FPUTS:
- result = fold_builtin_fputs (CALL_EXPR_ARG (fn, 0),
- CALL_EXPR_ARG (fn, 1),
- TREE_CODE (stmt) != GIMPLE_MODIFY_STMT, 0,
- val[0]);
+ result = fold_builtin_fputs (gimple_call_arg (stmt, 0),
+ gimple_call_arg (stmt, 1),
+ ignore, false, val[0]);
break;
case BUILT_IN_FPUTS_UNLOCKED:
- result = fold_builtin_fputs (CALL_EXPR_ARG (fn, 0),
- CALL_EXPR_ARG (fn, 1),
- TREE_CODE (stmt) != GIMPLE_MODIFY_STMT, 1,
- val[0]);
+ result = fold_builtin_fputs (gimple_call_arg (stmt, 0),
+ gimple_call_arg (stmt, 1),
+ ignore, true, val[0]);
break;
case BUILT_IN_MEMCPY_CHK:
@@ -2484,10 +2678,10 @@ ccp_fold_builtin (tree stmt, tree fn)
case BUILT_IN_MEMSET_CHK:
if (val[2] && is_gimple_val (val[2]))
result = fold_builtin_memory_chk (callee,
- CALL_EXPR_ARG (fn, 0),
- CALL_EXPR_ARG (fn, 1),
- CALL_EXPR_ARG (fn, 2),
- CALL_EXPR_ARG (fn, 3),
+ gimple_call_arg (stmt, 0),
+ gimple_call_arg (stmt, 1),
+ gimple_call_arg (stmt, 2),
+ gimple_call_arg (stmt, 3),
val[2], ignore,
DECL_FUNCTION_CODE (callee));
break;
@@ -2496,27 +2690,27 @@ ccp_fold_builtin (tree stmt, tree fn)
case BUILT_IN_STPCPY_CHK:
if (val[1] && is_gimple_val (val[1]))
result = fold_builtin_stxcpy_chk (callee,
- CALL_EXPR_ARG (fn, 0),
- CALL_EXPR_ARG (fn, 1),
- CALL_EXPR_ARG (fn, 2),
+ gimple_call_arg (stmt, 0),
+ gimple_call_arg (stmt, 1),
+ gimple_call_arg (stmt, 2),
val[1], ignore,
DECL_FUNCTION_CODE (callee));
break;
case BUILT_IN_STRNCPY_CHK:
if (val[2] && is_gimple_val (val[2]))
- result = fold_builtin_strncpy_chk (CALL_EXPR_ARG (fn, 0),
- CALL_EXPR_ARG (fn, 1),
- CALL_EXPR_ARG (fn, 2),
- CALL_EXPR_ARG (fn, 3),
+ result = fold_builtin_strncpy_chk (gimple_call_arg (stmt, 0),
+ gimple_call_arg (stmt, 1),
+ gimple_call_arg (stmt, 2),
+ gimple_call_arg (stmt, 3),
val[2]);
break;
case BUILT_IN_SNPRINTF_CHK:
case BUILT_IN_VSNPRINTF_CHK:
if (val[1] && is_gimple_val (val[1]))
- result = fold_builtin_snprintf_chk (fn, val[1],
- DECL_FUNCTION_CODE (callee));
+ result = gimple_fold_builtin_snprintf_chk (stmt, val[1],
+ DECL_FUNCTION_CODE (callee));
break;
default:
@@ -2528,114 +2722,262 @@ ccp_fold_builtin (tree stmt, tree fn)
return result;
}
+/* Attempt to fold an assignment statement pointed-to by SI. Returns a
+ replacement rhs for the statement or NULL_TREE if no simplification
+ could be made. It is assumed that the operands have been previously
+ folded. */
+
+static tree
+fold_gimple_assign (gimple_stmt_iterator *si)
+{
+ gimple stmt = gsi_stmt (*si);
+ enum tree_code subcode = gimple_assign_rhs_code (stmt);
+
+ tree result = NULL;
+
+ switch (get_gimple_rhs_class (subcode))
+ {
+ case GIMPLE_SINGLE_RHS:
+ {
+ tree rhs = gimple_assign_rhs1 (stmt);
+
+ /* Try to fold a conditional expression. */
+ if (TREE_CODE (rhs) == COND_EXPR)
+ {
+ tree temp = fold (COND_EXPR_COND (rhs));
+ if (temp != COND_EXPR_COND (rhs))
+ result = fold_build3 (COND_EXPR, TREE_TYPE (rhs), temp,
+ COND_EXPR_THEN (rhs), COND_EXPR_ELSE (rhs));
+ }
+
+ /* If we couldn't fold the RHS, hand over to the generic
+ fold routines. */
+ if (result == NULL_TREE)
+ result = fold (rhs);
+
+ /* Strip away useless type conversions. Both the NON_LVALUE_EXPR
+ that may have been added by fold, and "useless" type
+ conversions that might now be apparent due to propagation. */
+ STRIP_USELESS_TYPE_CONVERSION (result);
+
+ if (result != rhs && valid_gimple_rhs_p (result))
+ return result;
+ else
+ /* It is possible that fold_stmt_r simplified the RHS.
+ Make sure that the subcode of this statement still
+ reflects the principal operator of the rhs operand. */
+ return rhs;
+ }
+ break;
+
+ case GIMPLE_UNARY_RHS:
+ result = fold_unary (subcode,
+ gimple_expr_type (stmt),
+ gimple_assign_rhs1 (stmt));
+
+ if (result)
+ {
+ STRIP_USELESS_TYPE_CONVERSION (result);
+ if (valid_gimple_rhs_p (result))
+ return result;
+ }
+ else if ((gimple_assign_rhs_code (stmt) == NOP_EXPR
+ || gimple_assign_rhs_code (stmt) == CONVERT_EXPR)
+ && POINTER_TYPE_P (gimple_expr_type (stmt))
+ && POINTER_TYPE_P (TREE_TYPE (gimple_assign_rhs1 (stmt))))
+ {
+ tree type = gimple_expr_type (stmt);
+ tree t = maybe_fold_offset_to_address (gimple_assign_rhs1 (stmt),
+ integer_zero_node, type);
+ if (t)
+ return t;
+ }
+ break;
+
+ case GIMPLE_BINARY_RHS:
+ /* Try to fold pointer addition. */
+ if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR)
+ result = maybe_fold_stmt_addition (
+ TREE_TYPE (gimple_assign_lhs (stmt)),
+ gimple_assign_rhs1 (stmt),
+ gimple_assign_rhs2 (stmt));
+
+ if (!result)
+ result = fold_binary (subcode,
+ TREE_TYPE (gimple_assign_lhs (stmt)),
+ gimple_assign_rhs1 (stmt),
+ gimple_assign_rhs2 (stmt));
+
+ if (result)
+ {
+ STRIP_USELESS_TYPE_CONVERSION (result);
+ if (valid_gimple_rhs_p (result))
+ return result;
+ }
+ break;
+
+ case GIMPLE_INVALID_RHS:
+ gcc_unreachable ();
+ }
+
+ return NULL_TREE;
+}
+
+/* Attempt to fold a conditional statement. Return true if any changes were
+ made. We only attempt to fold the condition expression, and do not perform
+ any transformation that would require alteration of the cfg. It is
+ assumed that the operands have been previously folded. */
+
+static bool
+fold_gimple_cond (gimple stmt)
+{
+ tree result = fold_binary (gimple_cond_code (stmt),
+ boolean_type_node,
+ gimple_cond_lhs (stmt),
+ gimple_cond_rhs (stmt));
+
+ if (result)
+ {
+ STRIP_USELESS_TYPE_CONVERSION (result);
+ if (is_gimple_condexpr (result) && valid_gimple_rhs_p (result))
+ {
+ gimple_cond_set_condition_from_tree (stmt, result);
+ return true;
+ }
+ }
+
+ return false;
+}
+
+
+/* Attempt to fold a call statement referenced by the statement iterator GSI.
+ The statement may be replaced by another statement, e.g., if the call
+ simplifies to a constant value. Return true if any changes were made.
+ It is assumed that the operands have been previously folded. */
-/* Fold the statement pointed to by STMT_P. In some cases, this function may
+static bool
+fold_gimple_call (gimple_stmt_iterator *gsi)
+{
+ gimple stmt = gsi_stmt (*gsi);
+
+ tree callee = gimple_call_fndecl (stmt);
+
+ /* Check for builtins that CCP can handle using information not
+ available in the generic fold routines. */
+ if (callee && DECL_BUILT_IN (callee))
+ {
+ tree result = ccp_fold_builtin (stmt);
+
+ if (result)
+ return update_call_from_tree (gsi, result);
+ }
+ else
+ {
+ /* Check for resolvable OBJ_TYPE_REF. The only sorts we can resolve
+ here are when we've propagated the address of a decl into the
+ object slot. */
+ /* ??? Should perhaps do this in fold proper. However, doing it
+ there requires that we create a new CALL_EXPR, and that requires
+ copying EH region info to the new node. Easier to just do it
+ here where we can just smash the call operand. */
+ /* ??? Is there a good reason not to do this in fold_stmt_inplace? */
+ callee = gimple_call_fn (stmt);
+ if (TREE_CODE (callee) == OBJ_TYPE_REF
+ && lang_hooks.fold_obj_type_ref
+ && TREE_CODE (OBJ_TYPE_REF_OBJECT (callee)) == ADDR_EXPR
+ && DECL_P (TREE_OPERAND
+ (OBJ_TYPE_REF_OBJECT (callee), 0)))
+ {
+ tree t;
+
+ /* ??? Caution: Broken ADDR_EXPR semantics means that
+ looking at the type of the operand of the addr_expr
+ can yield an array type. See silly exception in
+ check_pointer_types_r. */
+ t = TREE_TYPE (TREE_TYPE (OBJ_TYPE_REF_OBJECT (callee)));
+ t = lang_hooks.fold_obj_type_ref (callee, t);
+ if (t)
+ {
+ gimple_call_set_fn (stmt, t);
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+/* Fold the statement pointed to by GSI. In some cases, this function may
replace the whole statement with a new one. Returns true iff folding
makes any changes. */
bool
-fold_stmt (tree *stmt_p)
+fold_stmt (gimple_stmt_iterator *gsi)
{
- tree rhs, result, stmt;
+ tree res;
struct fold_stmt_r_data fold_stmt_r_data;
+ struct walk_stmt_info wi;
+
bool changed = false;
bool inside_addr_expr = false;
- stmt = *stmt_p;
+ gimple stmt = gsi_stmt (*gsi);
fold_stmt_r_data.stmt = stmt;
fold_stmt_r_data.changed_p = &changed;
fold_stmt_r_data.inside_addr_expr_p = &inside_addr_expr;
- /* If we replaced constants and the statement makes pointer dereferences,
- then we may need to fold instances of *&VAR into VAR, etc. */
- if (walk_tree (stmt_p, fold_stmt_r, &fold_stmt_r_data, NULL))
- {
- *stmt_p = build_call_expr (implicit_built_in_decls[BUILT_IN_TRAP], 0);
- return true;
- }
+ memset (&wi, 0, sizeof (wi));
+ wi.info = &fold_stmt_r_data;
- rhs = get_rhs (stmt);
- if (!rhs)
- return changed;
- result = NULL_TREE;
+ /* Fold the individual operands.
+ For example, fold instances of *&VAR into VAR, etc. */
+ res = walk_gimple_op (stmt, fold_stmt_r, &wi);
+ gcc_assert (!res);
- if (TREE_CODE (rhs) == CALL_EXPR)
+ /* Fold the main computation performed by the statement. */
+ switch (gimple_code (stmt))
{
- tree callee;
-
- /* Check for builtins that CCP can handle using information not
- available in the generic fold routines. */
- callee = get_callee_fndecl (rhs);
- if (callee && DECL_BUILT_IN (callee))
- result = ccp_fold_builtin (stmt, rhs);
- else
- {
- /* Check for resolvable OBJ_TYPE_REF. The only sorts we can resolve
- here are when we've propagated the address of a decl into the
- object slot. */
- /* ??? Should perhaps do this in fold proper. However, doing it
- there requires that we create a new CALL_EXPR, and that requires
- copying EH region info to the new node. Easier to just do it
- here where we can just smash the call operand. Also
- CALL_EXPR_RETURN_SLOT_OPT needs to be handled correctly and
- copied, fold_call_expr does not have not information. */
- callee = CALL_EXPR_FN (rhs);
- if (TREE_CODE (callee) == OBJ_TYPE_REF
- && lang_hooks.fold_obj_type_ref
- && TREE_CODE (OBJ_TYPE_REF_OBJECT (callee)) == ADDR_EXPR
- && DECL_P (TREE_OPERAND
- (OBJ_TYPE_REF_OBJECT (callee), 0)))
- {
- tree t;
-
- /* ??? Caution: Broken ADDR_EXPR semantics means that
- looking at the type of the operand of the addr_expr
- can yield an array type. See silly exception in
- check_pointer_types_r. */
+ case GIMPLE_ASSIGN:
+ {
+ tree new_rhs = fold_gimple_assign (gsi);
+ if (new_rhs != NULL_TREE)
+ {
+ gimple_assign_set_rhs_from_tree (gsi, new_rhs);
+ changed = true;
+ }
+ stmt = gsi_stmt (*gsi);
+ break;
+ }
+ case GIMPLE_COND:
+ changed |= fold_gimple_cond (stmt);
+ break;
+ case GIMPLE_CALL:
+ /* The entire statement may be replaced in this case. */
+ changed |= fold_gimple_call (gsi);
+ break;
- t = TREE_TYPE (TREE_TYPE (OBJ_TYPE_REF_OBJECT (callee)));
- t = lang_hooks.fold_obj_type_ref (callee, t);
- if (t)
- {
- CALL_EXPR_FN (rhs) = t;
- changed = true;
- }
- }
- }
- }
- else if (TREE_CODE (rhs) == COND_EXPR)
- {
- tree temp = fold (COND_EXPR_COND (rhs));
- if (temp != COND_EXPR_COND (rhs))
- result = fold_build3 (COND_EXPR, TREE_TYPE (rhs), temp,
- COND_EXPR_THEN (rhs), COND_EXPR_ELSE (rhs));
+ default:
+ return changed;
+ break;
}
- /* If we couldn't fold the RHS, hand over to the generic fold routines. */
- if (result == NULL_TREE)
- result = fold (rhs);
-
- /* Strip away useless type conversions. Both the NON_LVALUE_EXPR that
- may have been added by fold, and "useless" type conversions that might
- now be apparent due to propagation. */
- STRIP_USELESS_TYPE_CONVERSION (result);
-
- if (result != rhs)
- changed |= set_rhs (stmt_p, result);
-
return changed;
}
/* Perform the minimal folding on statement STMT. Only operations like
*&x created by constant propagation are handled. The statement cannot
- be replaced with a new one. */
+ be replaced with a new one. Return true if the statement was
+ changed, false otherwise. */
bool
-fold_stmt_inplace (tree stmt)
+fold_stmt_inplace (gimple stmt)
{
- tree old_stmt = stmt, rhs, new_rhs;
+ tree res;
struct fold_stmt_r_data fold_stmt_r_data;
+ struct walk_stmt_info wi;
+ gimple_stmt_iterator si;
+
bool changed = false;
bool inside_addr_expr = false;
@@ -2643,24 +2985,50 @@ fold_stmt_inplace (tree stmt)
fold_stmt_r_data.changed_p = &changed;
fold_stmt_r_data.inside_addr_expr_p = &inside_addr_expr;
- walk_tree (&stmt, fold_stmt_r, &fold_stmt_r_data, NULL);
- gcc_assert (stmt == old_stmt);
+ memset (&wi, 0, sizeof (wi));
+ wi.info = &fold_stmt_r_data;
- rhs = get_rhs (stmt);
- if (!rhs || rhs == stmt)
- return changed;
+ /* Fold the individual operands.
+ For example, fold instances of *&VAR into VAR, etc.
- new_rhs = fold (rhs);
- STRIP_USELESS_TYPE_CONVERSION (new_rhs);
- if (new_rhs == rhs)
- return changed;
+ It appears that, at one time, maybe_fold_stmt_indirect
+ would cause the walk to return non-null in order to
+ signal that the entire statement should be replaced with
+ a call to _builtin_trap. This functionality is currently
+ disabled, as noted in a FIXME, and cannot be supported here. */
+ res = walk_gimple_op (stmt, fold_stmt_r, &wi);
+ gcc_assert (!res);
- changed |= set_rhs (&stmt, new_rhs);
- gcc_assert (stmt == old_stmt);
+ /* Fold the main computation performed by the statement. */
+ switch (gimple_code (stmt))
+ {
+ case GIMPLE_ASSIGN:
+ {
+ unsigned old_num_ops;
+ tree new_rhs;
+ old_num_ops = gimple_num_ops (stmt);
+ si = gsi_for_stmt (stmt);
+ new_rhs = fold_gimple_assign (&si);
+ if (new_rhs != NULL_TREE
+ && get_gimple_rhs_num_ops (TREE_CODE (new_rhs)) < old_num_ops)
+ {
+ gimple_assign_set_rhs_from_tree (&si, new_rhs);
+ changed = true;
+ }
+ gcc_assert (gsi_stmt (si) == stmt);
+ break;
+ }
+ case GIMPLE_COND:
+ changed |= fold_gimple_cond (stmt);
+ break;
+
+ default:
+ break;
+ }
return changed;
}
-
+
/* Try to optimize out __builtin_stack_restore. Optimize it out
if there is another __builtin_stack_restore in the same basic
block and no calls or ASM_EXPRs are in between, or if this block's
@@ -2668,28 +3036,30 @@ fold_stmt_inplace (tree stmt)
ASM_EXPRs after this __builtin_stack_restore. */
static tree
-optimize_stack_restore (basic_block bb, tree call, block_stmt_iterator i)
+optimize_stack_restore (gimple_stmt_iterator i)
{
- tree stack_save, stmt, callee;
+ tree callee, rhs;
+ gimple stmt, stack_save;
+ gimple_stmt_iterator stack_save_gsi;
- if (TREE_CODE (call) != CALL_EXPR
- || call_expr_nargs (call) != 1
- || TREE_CODE (CALL_EXPR_ARG (call, 0)) != SSA_NAME
- || !POINTER_TYPE_P (TREE_TYPE (CALL_EXPR_ARG (call, 0))))
+ basic_block bb = gsi_bb (i);
+ gimple call = gsi_stmt (i);
+
+ if (gimple_code (call) != GIMPLE_CALL
+ || gimple_call_num_args (call) != 1
+ || TREE_CODE (gimple_call_arg (call, 0)) != SSA_NAME
+ || !POINTER_TYPE_P (TREE_TYPE (gimple_call_arg (call, 0))))
return NULL_TREE;
- for (bsi_next (&i); !bsi_end_p (i); bsi_next (&i))
+ for (gsi_next (&i); !gsi_end_p (i); gsi_next (&i))
{
- tree call;
-
- stmt = bsi_stmt (i);
- if (TREE_CODE (stmt) == ASM_EXPR)
+ stmt = gsi_stmt (i);
+ if (gimple_code (stmt) == GIMPLE_ASM)
return NULL_TREE;
- call = get_call_expr_in (stmt);
- if (call == NULL)
+ if (gimple_code (stmt) != GIMPLE_CALL)
continue;
- callee = get_callee_fndecl (call);
+ callee = gimple_call_fndecl (stmt);
if (!callee || DECL_BUILT_IN_CLASS (callee) != BUILT_IN_NORMAL)
return NULL_TREE;
@@ -2697,55 +3067,54 @@ optimize_stack_restore (basic_block bb, tree call, block_stmt_iterator i)
break;
}
- if (bsi_end_p (i)
+ if (gsi_end_p (i)
&& (! single_succ_p (bb)
|| single_succ_edge (bb)->dest != EXIT_BLOCK_PTR))
return NULL_TREE;
- stack_save = SSA_NAME_DEF_STMT (CALL_EXPR_ARG (call, 0));
- if (TREE_CODE (stack_save) != GIMPLE_MODIFY_STMT
- || GIMPLE_STMT_OPERAND (stack_save, 0) != CALL_EXPR_ARG (call, 0)
- || TREE_CODE (GIMPLE_STMT_OPERAND (stack_save, 1)) != CALL_EXPR
- || tree_could_throw_p (stack_save)
- || !has_single_use (CALL_EXPR_ARG (call, 0)))
+ stack_save = SSA_NAME_DEF_STMT (gimple_call_arg (call, 0));
+ if (gimple_code (stack_save) != GIMPLE_CALL
+ || gimple_call_lhs (stack_save) != gimple_call_arg (call, 0)
+ || stmt_could_throw_p (stack_save)
+ || !has_single_use (gimple_call_arg (call, 0)))
return NULL_TREE;
- callee = get_callee_fndecl (GIMPLE_STMT_OPERAND (stack_save, 1));
+ callee = gimple_call_fndecl (stack_save);
if (!callee
|| DECL_BUILT_IN_CLASS (callee) != BUILT_IN_NORMAL
|| DECL_FUNCTION_CODE (callee) != BUILT_IN_STACK_SAVE
- || call_expr_nargs (GIMPLE_STMT_OPERAND (stack_save, 1)) != 0)
+ || gimple_call_num_args (stack_save) != 0)
return NULL_TREE;
- stmt = stack_save;
- push_stmt_changes (&stmt);
- if (!set_rhs (&stmt,
- build_int_cst (TREE_TYPE (CALL_EXPR_ARG (call, 0)), 0)))
+ stack_save_gsi = gsi_for_stmt (stack_save);
+ push_stmt_changes (gsi_stmt_ptr (&stack_save_gsi));
+ rhs = build_int_cst (TREE_TYPE (gimple_call_arg (call, 0)), 0);
+ if (!update_call_from_tree (&stack_save_gsi, rhs))
{
- discard_stmt_changes (&stmt);
+ discard_stmt_changes (gsi_stmt_ptr (&stack_save_gsi));
return NULL_TREE;
}
- gcc_assert (stmt == stack_save);
- pop_stmt_changes (&stmt);
+ pop_stmt_changes (gsi_stmt_ptr (&stack_save_gsi));
+ /* No effect, so the statement will be deleted. */
return integer_zero_node;
}
-
+
/* If va_list type is a simple pointer and nothing special is needed,
optimize __builtin_va_start (&ap, 0) into ap = __builtin_next_arg (0),
__builtin_va_end (&ap) out as NOP and __builtin_va_copy into a simple
pointer assignment. */
static tree
-optimize_stdarg_builtin (tree call)
+optimize_stdarg_builtin (gimple call)
{
tree callee, lhs, rhs, cfun_va_list;
bool va_list_simple_ptr;
- if (TREE_CODE (call) != CALL_EXPR)
+ if (gimple_code (call) != GIMPLE_CALL)
return NULL_TREE;
- callee = get_callee_fndecl (call);
+ callee = gimple_call_fndecl (call);
cfun_va_list = targetm.fn_abi_va_list (callee);
va_list_simple_ptr = POINTER_TYPE_P (cfun_va_list)
@@ -2757,21 +3126,21 @@ optimize_stdarg_builtin (tree call)
case BUILT_IN_VA_START:
if (!va_list_simple_ptr
|| targetm.expand_builtin_va_start != NULL
- || built_in_decls[BUILT_IN_NEXT_ARG] == NULL)
+ || built_in_decls[BUILT_IN_NEXT_ARG] == NULL)
return NULL_TREE;
- if (call_expr_nargs (call) != 2)
+ if (gimple_call_num_args (call) != 2)
return NULL_TREE;
- lhs = CALL_EXPR_ARG (call, 0);
+ lhs = gimple_call_arg (call, 0);
if (!POINTER_TYPE_P (TREE_TYPE (lhs))
|| TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (lhs)))
!= TYPE_MAIN_VARIANT (cfun_va_list))
return NULL_TREE;
-
+
lhs = build_fold_indirect_ref (lhs);
rhs = build_call_expr (built_in_decls[BUILT_IN_NEXT_ARG],
- 1, integer_zero_node);
+ 1, integer_zero_node);
rhs = fold_convert (TREE_TYPE (lhs), rhs);
return build2 (MODIFY_EXPR, TREE_TYPE (lhs), lhs, rhs);
@@ -2779,17 +3148,17 @@ optimize_stdarg_builtin (tree call)
if (!va_list_simple_ptr)
return NULL_TREE;
- if (call_expr_nargs (call) != 2)
+ if (gimple_call_num_args (call) != 2)
return NULL_TREE;
- lhs = CALL_EXPR_ARG (call, 0);
+ lhs = gimple_call_arg (call, 0);
if (!POINTER_TYPE_P (TREE_TYPE (lhs))
|| TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (lhs)))
!= TYPE_MAIN_VARIANT (cfun_va_list))
return NULL_TREE;
lhs = build_fold_indirect_ref (lhs);
- rhs = CALL_EXPR_ARG (call, 1);
+ rhs = gimple_call_arg (call, 1);
if (TYPE_MAIN_VARIANT (TREE_TYPE (rhs))
!= TYPE_MAIN_VARIANT (cfun_va_list))
return NULL_TREE;
@@ -2798,53 +3167,73 @@ optimize_stdarg_builtin (tree call)
return build2 (MODIFY_EXPR, TREE_TYPE (lhs), lhs, rhs);
case BUILT_IN_VA_END:
+ /* No effect, so the statement will be deleted. */
return integer_zero_node;
default:
gcc_unreachable ();
}
}
-
+
/* Convert EXPR into a GIMPLE value suitable for substitution on the
RHS of an assignment. Insert the necessary statements before
- iterator *SI_P.
- When IGNORE is set, don't worry about the return value. */
+ iterator *SI_P. The statement at *SI_P, which must be a GIMPLE_CALL
+ is replaced. If the call is expected to produces a result, then it
+ is replaced by an assignment of the new RHS to the result variable.
+ If the result is to be ignored, then the call is replaced by a
+ GIMPLE_NOP. */
-static tree
-convert_to_gimple_builtin (block_stmt_iterator *si_p, tree expr, bool ignore)
+static void
+gimplify_and_update_call_from_tree (gimple_stmt_iterator *si_p, tree expr)
{
- tree_stmt_iterator ti;
- tree stmt = bsi_stmt (*si_p);
- tree tmp, stmts = NULL;
+ tree lhs;
+ tree tmp = NULL_TREE; /* Silence warning. */
+ gimple stmt, new_stmt;
+ gimple_stmt_iterator i;
+ gimple_seq stmts = gimple_seq_alloc();
struct gimplify_ctx gctx;
+ stmt = gsi_stmt (*si_p);
+
+ gcc_assert (is_gimple_call (stmt));
+
+ lhs = gimple_call_lhs (stmt);
+
push_gimplify_context (&gctx);
- if (ignore)
- {
- tmp = build_empty_stmt ();
- gimplify_and_add (expr, &stmts);
- }
- else
+
+ if (lhs == NULL_TREE)
+ gimplify_and_add (expr, &stmts);
+ else
tmp = get_initialized_tmp_var (expr, &stmts, NULL);
+
pop_gimplify_context (NULL);
- if (EXPR_HAS_LOCATION (stmt))
- annotate_all_with_locus (&stmts, EXPR_LOCATION (stmt));
+ if (gimple_has_location (stmt))
+ annotate_all_with_location (stmts, gimple_location (stmt));
/* The replacement can expose previously unreferenced variables. */
- for (ti = tsi_start (stmts); !tsi_end_p (ti); tsi_next (&ti))
+ for (i = gsi_start (stmts); !gsi_end_p (i); gsi_next (&i))
+ {
+ new_stmt = gsi_stmt (i);
+ find_new_referenced_vars (new_stmt);
+ gsi_insert_before (si_p, new_stmt, GSI_NEW_STMT);
+ mark_symbols_for_renaming (new_stmt);
+ gsi_next (si_p);
+ }
+
+ if (lhs == NULL_TREE)
+ new_stmt = gimple_build_nop ();
+ else
{
- tree new_stmt = tsi_stmt (ti);
- find_new_referenced_vars (tsi_stmt_ptr (ti));
- bsi_insert_before (si_p, new_stmt, BSI_NEW_STMT);
- mark_symbols_for_renaming (new_stmt);
- bsi_next (si_p);
+ new_stmt = gimple_build_assign (lhs, tmp);
+ copy_virtual_operands (new_stmt, stmt);
+ move_ssa_defining_stmt_for_defs (new_stmt, stmt);
}
- return tmp;
+ gimple_set_location (new_stmt, gimple_location (stmt));
+ gsi_replace (si_p, new_stmt, false);
}
-
/* A simple pass that attempts to fold all builtin functions. This pass
is run after we've propagated as many constants as we can. */
@@ -2857,32 +3246,32 @@ execute_fold_all_builtins (void)
FOR_EACH_BB (bb)
{
- block_stmt_iterator i;
- for (i = bsi_start (bb); !bsi_end_p (i); )
+ gimple_stmt_iterator i;
+ for (i = gsi_start_bb (bb); !gsi_end_p (i); )
{
- tree *stmtp = bsi_stmt_ptr (i);
- tree old_stmt = *stmtp;
- tree call = get_rhs (*stmtp);
+ gimple stmt, old_stmt;
tree callee, result;
enum built_in_function fcode;
- if (!call || TREE_CODE (call) != CALL_EXPR)
+ stmt = gsi_stmt (i);
+
+ if (gimple_code (stmt) != GIMPLE_CALL)
{
- bsi_next (&i);
+ gsi_next (&i);
continue;
}
- callee = get_callee_fndecl (call);
+ callee = gimple_call_fndecl (stmt);
if (!callee || DECL_BUILT_IN_CLASS (callee) != BUILT_IN_NORMAL)
{
- bsi_next (&i);
+ gsi_next (&i);
continue;
}
fcode = DECL_FUNCTION_CODE (callee);
- result = ccp_fold_builtin (*stmtp, call);
+ result = ccp_fold_builtin (stmt);
if (result)
- gimple_remove_stmt_histograms (cfun, *stmtp);
+ gimple_remove_stmt_histograms (cfun, stmt);
if (!result)
switch (DECL_FUNCTION_CODE (callee))
@@ -2891,77 +3280,71 @@ execute_fold_all_builtins (void)
/* Resolve __builtin_constant_p. If it hasn't been
folded to integer_one_node by now, it's fairly
certain that the value simply isn't constant. */
- result = integer_zero_node;
+ result = integer_zero_node;
break;
case BUILT_IN_STACK_RESTORE:
- result = optimize_stack_restore (bb, *stmtp, i);
+ result = optimize_stack_restore (i);
if (result)
break;
- bsi_next (&i);
+ gsi_next (&i);
continue;
case BUILT_IN_VA_START:
case BUILT_IN_VA_END:
case BUILT_IN_VA_COPY:
/* These shouldn't be folded before pass_stdarg. */
- result = optimize_stdarg_builtin (*stmtp);
+ result = optimize_stdarg_builtin (stmt);
if (result)
break;
/* FALLTHRU */
default:
- bsi_next (&i);
+ gsi_next (&i);
continue;
}
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Simplified\n ");
- print_generic_stmt (dump_file, *stmtp, dump_flags);
+ print_gimple_stmt (dump_file, stmt, 0, dump_flags);
}
- push_stmt_changes (stmtp);
+ old_stmt = stmt;
+ push_stmt_changes (gsi_stmt_ptr (&i));
- if (!set_rhs (stmtp, result))
- {
- result = convert_to_gimple_builtin (&i, result,
- TREE_CODE (old_stmt)
- != GIMPLE_MODIFY_STMT);
- if (result)
- {
- bool ok = set_rhs (stmtp, result);
- gcc_assert (ok);
- todoflags |= TODO_rebuild_alias;
- }
- }
+ if (!update_call_from_tree (&i, result))
+ {
+ gimplify_and_update_call_from_tree (&i, result);
+ todoflags |= TODO_rebuild_alias;
+ }
- pop_stmt_changes (stmtp);
+ stmt = gsi_stmt (i);
+ pop_stmt_changes (gsi_stmt_ptr (&i));
- if (maybe_clean_or_replace_eh_stmt (old_stmt, *stmtp)
- && tree_purge_dead_eh_edges (bb))
+ if (maybe_clean_or_replace_eh_stmt (old_stmt, stmt)
+ && gimple_purge_dead_eh_edges (bb))
cfg_changed = true;
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "to\n ");
- print_generic_stmt (dump_file, *stmtp, dump_flags);
+ print_gimple_stmt (dump_file, stmt, 0, dump_flags);
fprintf (dump_file, "\n");
}
/* Retry the same statement if it changed into another
builtin, there might be new opportunities now. */
- call = get_rhs (*stmtp);
- if (!call || TREE_CODE (call) != CALL_EXPR)
+ if (gimple_code (stmt) != GIMPLE_CALL)
{
- bsi_next (&i);
+ gsi_next (&i);
continue;
}
- callee = get_callee_fndecl (call);
+ callee = gimple_call_fndecl (stmt);
if (!callee
- || DECL_BUILT_IN_CLASS (callee) != BUILT_IN_NORMAL
+ || DECL_BUILT_IN_CLASS (callee) != BUILT_IN_NORMAL
|| DECL_FUNCTION_CODE (callee) == fcode)
- bsi_next (&i);
+ gsi_next (&i);
}
}
diff --git a/gcc/tree-ssa-coalesce.c b/gcc/tree-ssa-coalesce.c
index 388437d44bb..d5e5f8702ff 100644
--- a/gcc/tree-ssa-coalesce.c
+++ b/gcc/tree-ssa-coalesce.c
@@ -841,16 +841,15 @@ build_ssa_conflict_graph (tree_live_info_p liveinfo)
FOR_EACH_BB (bb)
{
- block_stmt_iterator bsi;
- tree phi;
+ gimple_stmt_iterator gsi;
/* Start with live on exit temporaries. */
live_track_init (live, live_on_exit (liveinfo, bb));
- for (bsi = bsi_last (bb); !bsi_end_p (bsi); bsi_prev (&bsi))
+ for (gsi = gsi_last_bb (bb); !gsi_end_p (gsi); gsi_prev (&gsi))
{
tree var;
- tree stmt = bsi_stmt (bsi);
+ gimple stmt = gsi_stmt (gsi);
/* A copy between 2 partitions does not introduce an interference
by itself. If they did, you would never be able to coalesce
@@ -859,12 +858,14 @@ build_ssa_conflict_graph (tree_live_info_p liveinfo)
This is handled by simply removing the SRC of the copy from the
live list, and processing the stmt normally. */
- if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT)
+ if (is_gimple_assign (stmt))
{
- tree lhs = GIMPLE_STMT_OPERAND (stmt, 0);
- tree rhs = GIMPLE_STMT_OPERAND (stmt, 1);
- if (TREE_CODE (lhs) == SSA_NAME && TREE_CODE (rhs) == SSA_NAME)
- live_track_clear_var (live, rhs);
+ tree lhs = gimple_assign_lhs (stmt);
+ tree rhs1 = gimple_assign_rhs1 (stmt);
+ if (gimple_assign_copy_p (stmt)
+ && TREE_CODE (lhs) == SSA_NAME
+ && TREE_CODE (rhs1) == SSA_NAME)
+ live_track_clear_var (live, rhs1);
}
FOR_EACH_SSA_TREE_OPERAND (var, stmt, iter, SSA_OP_DEF)
@@ -880,8 +881,9 @@ build_ssa_conflict_graph (tree_live_info_p liveinfo)
There must be a conflict recorded between the result of the PHI and
any variables that are live. Otherwise the out-of-ssa translation
may create incorrect code. */
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
+ for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
+ gimple phi = gsi_stmt (gsi);
tree result = PHI_RESULT (phi);
if (live_track_live_p (live, result))
live_track_process_def (live, result, graph);
@@ -915,11 +917,11 @@ print_exprs (FILE *f, const char *str1, tree expr1, const char *str2,
printed and compilation is then terminated. */
static inline void
-abnormal_corrupt (tree phi, int i)
+abnormal_corrupt (gimple phi, int i)
{
- edge e = PHI_ARG_EDGE (phi, i);
- tree res = PHI_RESULT (phi);
- tree arg = PHI_ARG_DEF (phi, i);
+ edge e = gimple_phi_arg_edge (phi, i);
+ tree res = gimple_phi_result (phi);
+ tree arg = gimple_phi_arg_def (phi, i);
fprintf (stderr, " Corrupt SSA across abnormal edge BB%d->BB%d\n",
e->src->index, e->dest->index);
@@ -959,10 +961,10 @@ fail_abnormal_edge_coalesce (int x, int y)
static var_map
create_outofssa_var_map (coalesce_list_p cl, bitmap used_in_copy)
{
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
basic_block bb;
tree var;
- tree stmt;
+ gimple stmt;
tree first;
var_map map;
ssa_op_iter iter;
@@ -981,24 +983,25 @@ create_outofssa_var_map (coalesce_list_p cl, bitmap used_in_copy)
FOR_EACH_BB (bb)
{
- tree phi, arg;
+ tree arg;
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
+ for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- int i;
+ gimple phi = gsi_stmt (gsi);
+ size_t i;
int ver;
tree res;
bool saw_copy = false;
- res = PHI_RESULT (phi);
+ res = gimple_phi_result (phi);
ver = SSA_NAME_VERSION (res);
register_ssa_partition (map, res);
/* Register ssa_names and coalesces between the args and the result
of all PHI. */
- for (i = 0; i < PHI_NUM_ARGS (phi); i++)
+ for (i = 0; i < gimple_phi_num_args (phi); i++)
{
- edge e = PHI_ARG_EDGE (phi, i);
+ edge e = gimple_phi_arg_edge (phi, i);
arg = PHI_ARG_DEF (phi, i);
if (TREE_CODE (arg) == SSA_NAME)
register_ssa_partition (map, arg);
@@ -1024,27 +1027,29 @@ create_outofssa_var_map (coalesce_list_p cl, bitmap used_in_copy)
bitmap_set_bit (used_in_copy, ver);
}
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- stmt = bsi_stmt (bsi);
+ stmt = gsi_stmt (gsi);
/* Register USE and DEF operands in each statement. */
FOR_EACH_SSA_TREE_OPERAND (var, stmt, iter, (SSA_OP_DEF|SSA_OP_USE))
register_ssa_partition (map, var);
/* Check for copy coalesces. */
- switch (TREE_CODE (stmt))
+ switch (gimple_code (stmt))
{
- case GIMPLE_MODIFY_STMT:
+ case GIMPLE_ASSIGN:
{
- tree op1 = GIMPLE_STMT_OPERAND (stmt, 0);
- tree op2 = GIMPLE_STMT_OPERAND (stmt, 1);
- if (TREE_CODE (op1) == SSA_NAME
- && TREE_CODE (op2) == SSA_NAME
- && SSA_NAME_VAR (op1) == SSA_NAME_VAR (op2))
+ tree lhs = gimple_assign_lhs (stmt);
+ tree rhs1 = gimple_assign_rhs1 (stmt);
+
+ if (gimple_assign_copy_p (stmt)
+ && TREE_CODE (lhs) == SSA_NAME
+ && TREE_CODE (rhs1) == SSA_NAME
+ && SSA_NAME_VAR (lhs) == SSA_NAME_VAR (rhs1))
{
- v1 = SSA_NAME_VERSION (op1);
- v2 = SSA_NAME_VERSION (op2);
+ v1 = SSA_NAME_VERSION (lhs);
+ v2 = SSA_NAME_VERSION (rhs1);
cost = coalesce_cost_bb (bb);
add_coalesce (cl, v1, v2, cost);
bitmap_set_bit (used_in_copy, v1);
@@ -1053,24 +1058,31 @@ create_outofssa_var_map (coalesce_list_p cl, bitmap used_in_copy)
}
break;
- case ASM_EXPR:
+ case GIMPLE_ASM:
{
unsigned long noutputs, i;
+ unsigned long ninputs;
tree *outputs, link;
- noutputs = list_length (ASM_OUTPUTS (stmt));
+ noutputs = gimple_asm_noutputs (stmt);
+ ninputs = gimple_asm_ninputs (stmt);
outputs = (tree *) alloca (noutputs * sizeof (tree));
- for (i = 0, link = ASM_OUTPUTS (stmt); link;
- ++i, link = TREE_CHAIN (link))
+ for (i = 0; i < noutputs; ++i) {
+ link = gimple_asm_output_op (stmt, i);
outputs[i] = TREE_VALUE (link);
+ }
- for (link = ASM_INPUTS (stmt); link; link = TREE_CHAIN (link))
+ for (i = 0; i < ninputs; ++i)
{
- const char *constraint
- = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (link)));
- tree input = TREE_VALUE (link);
+ const char *constraint;
+ tree input;
char *end;
unsigned long match;
+ link = gimple_asm_input_op (stmt, i);
+ constraint
+ = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (link)));
+ input = TREE_VALUE (link);
+
if (TREE_CODE (input) != SSA_NAME)
continue;
@@ -1247,7 +1259,7 @@ coalesce_partitions (var_map map, ssa_conflicts_p graph, coalesce_list_p cl,
FILE *debug)
{
int x = 0, y = 0;
- tree var1, var2, phi;
+ tree var1, var2;
int cost;
basic_block bb;
edge e;
@@ -1262,8 +1274,11 @@ coalesce_partitions (var_map map, ssa_conflicts_p graph, coalesce_list_p cl,
FOR_EACH_EDGE (e, ei, bb->preds)
if (e->flags & EDGE_ABNORMAL)
{
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
+ gimple_stmt_iterator gsi;
+ for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
+ gimple phi = gsi_stmt (gsi);
tree res = PHI_RESULT (phi);
tree arg = PHI_ARG_DEF (phi, e->dest_idx);
int v1 = SSA_NAME_VERSION (res);
@@ -1297,6 +1312,24 @@ coalesce_partitions (var_map map, ssa_conflicts_p graph, coalesce_list_p cl,
}
}
+/* Returns a hash code for P. */
+
+static hashval_t
+hash_ssa_name_by_var (const void *p)
+{
+ const_tree n = (const_tree) p;
+ return (hashval_t) htab_hash_pointer (SSA_NAME_VAR (n));
+}
+
+/* Returns nonzero if P1 and P2 are equal. */
+
+static int
+eq_ssa_name_by_var (const void *p1, const void *p2)
+{
+ const_tree n1 = (const_tree) p1;
+ const_tree n2 = (const_tree) p2;
+ return SSA_NAME_VAR (n1) == SSA_NAME_VAR (n2);
+}
/* Reduce the number of copies by coalescing variables in the function. Return
a partition map with the resulting coalesces. */
@@ -1310,10 +1343,42 @@ coalesce_ssa_name (void)
coalesce_list_p cl;
bitmap used_in_copies = BITMAP_ALLOC (NULL);
var_map map;
+ unsigned int i;
+ static htab_t ssa_name_hash;
cl = create_coalesce_list ();
map = create_outofssa_var_map (cl, used_in_copies);
+ /* We need to coalesce all names originating same SSA_NAME_VAR
+ so debug info remains undisturbed. */
+ if (!optimize)
+ {
+ ssa_name_hash = htab_create (10, hash_ssa_name_by_var,
+ eq_ssa_name_by_var, NULL);
+ for (i = 1; i < num_ssa_names; i++)
+ {
+ tree a = ssa_name (i);
+
+ if (a && SSA_NAME_VAR (a) && !DECL_ARTIFICIAL (SSA_NAME_VAR (a)))
+ {
+ tree *slot = (tree *) htab_find_slot (ssa_name_hash, a, INSERT);
+
+ if (!*slot)
+ *slot = a;
+ else
+ {
+ add_coalesce (cl, SSA_NAME_VERSION (a), SSA_NAME_VERSION (*slot),
+ MUST_COALESCE_COST - 1);
+ bitmap_set_bit (used_in_copies, SSA_NAME_VERSION (a));
+ bitmap_set_bit (used_in_copies, SSA_NAME_VERSION (*slot));
+ }
+ }
+ }
+ htab_delete (ssa_name_hash);
+ }
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ dump_var_map (dump_file, map);
+
/* Don't calculate live ranges for variables not in the coalesce list. */
partition_view_bitmap (map, used_in_copies, true);
BITMAP_FREE (used_in_copies);
@@ -1387,4 +1452,3 @@ coalesce_ssa_name (void)
return map;
}
-
diff --git a/gcc/tree-ssa-copy.c b/gcc/tree-ssa-copy.c
index bc8a874eeda..c228725e59e 100644
--- a/gcc/tree-ssa-copy.c
+++ b/gcc/tree-ssa-copy.c
@@ -184,6 +184,55 @@ may_propagate_copy (tree dest, tree orig)
return true;
}
+/* Like may_propagate_copy, but use as the destination expression
+ the principal expression (typically, the RHS) contained in
+ statement DEST. This is more efficient when working with the
+ gimple tuples representation. */
+
+bool
+may_propagate_copy_into_stmt (gimple dest, tree orig)
+{
+ tree type_d;
+ tree type_o;
+
+ /* If the statement is a switch or a single-rhs assignment,
+ then the expression to be replaced by the propagation may
+ be an SSA_NAME. Fortunately, there is an explicit tree
+ for the expression, so we delegate to may_propagate_copy. */
+
+ if (gimple_assign_single_p (dest))
+ return may_propagate_copy (gimple_assign_rhs1 (dest), orig);
+ else if (gimple_code (dest) == GIMPLE_SWITCH)
+ return may_propagate_copy (gimple_switch_index (dest), orig);
+
+ /* In other cases, the expression is not materialized, so there
+ is no destination to pass to may_propagate_copy. On the other
+ hand, the expression cannot be an SSA_NAME, so the analysis
+ is much simpler. */
+
+ if (TREE_CODE (orig) == SSA_NAME
+ && (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (orig)
+ || TREE_CODE (SSA_NAME_VAR (orig)) == MEMORY_PARTITION_TAG))
+ return false;
+
+ if (is_gimple_assign (dest))
+ type_d = TREE_TYPE (gimple_assign_lhs (dest));
+ else if (gimple_code (dest) == GIMPLE_COND)
+ type_d = boolean_type_node;
+ else if (is_gimple_call (dest)
+ && gimple_call_lhs (dest) != NULL_TREE)
+ type_d = TREE_TYPE (gimple_call_lhs (dest));
+ else
+ gcc_unreachable ();
+
+ type_o = TREE_TYPE (orig);
+
+ if (!useless_type_conversion_p (type_d, type_o))
+ return false;
+
+ return true;
+}
+
/* Similarly, but we know that we're propagating into an ASM_EXPR. */
bool
@@ -303,7 +352,7 @@ merge_alias_info (tree orig_name, tree new_name)
static void
replace_exp_1 (use_operand_p op_p, tree val,
- bool for_propagation ATTRIBUTE_UNUSED)
+ bool for_propagation ATTRIBUTE_UNUSED)
{
tree op = USE_FROM_PTR (op_p);
@@ -337,6 +386,18 @@ propagate_value (use_operand_p op_p, tree val)
replace_exp_1 (op_p, val, true);
}
+/* Replace *OP_P with value VAL (assumed to be a constant or another SSA_NAME).
+
+ Use this version when not const/copy propagating values. For example,
+ PRE uses this version when building expressions as they would appear
+ in specific blocks taking into account actions of PHI nodes. */
+
+void
+replace_exp (use_operand_p op_p, tree val)
+{
+ replace_exp_1 (op_p, val, false);
+}
+
/* Propagate the value VAL (assumed to be a constant or another SSA_NAME)
into the tree pointed to by OP_P.
@@ -351,13 +412,14 @@ propagate_tree_value (tree *op_p, tree val)
{
#if defined ENABLE_CHECKING
gcc_assert (!(TREE_CODE (val) == SSA_NAME
+ && *op_p
&& TREE_CODE (*op_p) == SSA_NAME
&& !may_propagate_copy (*op_p, val)));
#endif
if (TREE_CODE (val) == SSA_NAME)
{
- if (TREE_CODE (*op_p) == SSA_NAME && POINTER_TYPE_P (TREE_TYPE (*op_p)))
+ if (*op_p && TREE_CODE (*op_p) == SSA_NAME && POINTER_TYPE_P (TREE_TYPE (*op_p)))
merge_alias_info (*op_p, val);
*op_p = val;
}
@@ -366,18 +428,52 @@ propagate_tree_value (tree *op_p, tree val)
}
-/* Replace *OP_P with value VAL (assumed to be a constant or another SSA_NAME).
-
- Use this version when not const/copy propagating values. For example,
- PRE uses this version when building expressions as they would appear
- in specific blocks taking into account actions of PHI nodes. */
+/* Like propagate_tree_value, but use as the operand to replace
+ the principal expression (typically, the RHS) contained in the
+ statement referenced by iterator GSI. Note that it is not
+ always possible to update the statement in-place, so a new
+ statement may be created to replace the original. */
void
-replace_exp (use_operand_p op_p, tree val)
+propagate_tree_value_into_stmt (gimple_stmt_iterator *gsi, tree val)
{
- replace_exp_1 (op_p, val, false);
-}
+ gimple stmt = gsi_stmt (*gsi);
+ if (is_gimple_assign (stmt))
+ {
+ tree expr = NULL_TREE;
+ if (gimple_assign_single_p (stmt))
+ expr = gimple_assign_rhs1 (stmt);
+ propagate_tree_value (&expr, val);
+ gimple_assign_set_rhs_from_tree (gsi, expr);
+ stmt = gsi_stmt (*gsi);
+ }
+ else if (gimple_code (stmt) == GIMPLE_COND)
+ {
+ tree lhs = NULL_TREE;
+ tree rhs = fold_convert (TREE_TYPE (val), integer_zero_node);
+ propagate_tree_value (&lhs, val);
+ gimple_cond_set_code (stmt, NE_EXPR);
+ gimple_cond_set_lhs (stmt, lhs);
+ gimple_cond_set_rhs (stmt, rhs);
+ }
+ else if (is_gimple_call (stmt)
+ && gimple_call_lhs (stmt) != NULL_TREE)
+ {
+ gimple new_stmt;
+
+ tree expr = NULL_TREE;
+ propagate_tree_value (&expr, val);
+ new_stmt = gimple_build_assign (gimple_call_lhs (stmt), expr);
+ copy_virtual_operands (new_stmt, stmt);
+ move_ssa_defining_stmt_for_defs (new_stmt, stmt);
+ gsi_replace (gsi, new_stmt, false);
+ }
+ else if (gimple_code (stmt) == GIMPLE_SWITCH)
+ propagate_tree_value (gimple_switch_index_ptr (stmt), val);
+ else
+ gcc_unreachable ();
+}
/*---------------------------------------------------------------------------
Copy propagation
@@ -403,24 +499,17 @@ static tree *cached_last_copy_of;
/* Return true if this statement may generate a useful copy. */
static bool
-stmt_may_generate_copy (tree stmt)
+stmt_may_generate_copy (gimple stmt)
{
- tree lhs, rhs;
- stmt_ann_t ann;
-
- if (TREE_CODE (stmt) == PHI_NODE)
- return !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (PHI_RESULT (stmt));
+ if (gimple_code (stmt) == GIMPLE_PHI)
+ return !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (gimple_phi_result (stmt));
- if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
+ if (gimple_code (stmt) != GIMPLE_ASSIGN)
return false;
- lhs = GIMPLE_STMT_OPERAND (stmt, 0);
- rhs = GIMPLE_STMT_OPERAND (stmt, 1);
- ann = stmt_ann (stmt);
-
/* If the statement has volatile operands, it won't generate a
useful copy. */
- if (ann->has_volatile_ops)
+ if (gimple_has_volatile_ops (stmt))
return false;
/* Statements with loads and/or stores will never generate a useful copy. */
@@ -430,8 +519,8 @@ stmt_may_generate_copy (tree stmt)
/* Otherwise, the only statements that generate useful copies are
assignments whose RHS is just an SSA name that doesn't flow
through abnormal edges. */
- return (TREE_CODE (rhs) == SSA_NAME
- && !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (rhs));
+ return (gimple_assign_rhs_code (stmt) == SSA_NAME
+ && !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (gimple_assign_rhs1 (stmt)));
}
@@ -584,15 +673,16 @@ dump_copy_of (FILE *file, tree var)
all, the names generated will be VUSEd in the same statements. */
static enum ssa_prop_result
-copy_prop_visit_assignment (tree stmt, tree *result_p)
+copy_prop_visit_assignment (gimple stmt, tree *result_p)
{
tree lhs, rhs;
prop_value_t *rhs_val;
- lhs = GIMPLE_STMT_OPERAND (stmt, 0);
- rhs = GIMPLE_STMT_OPERAND (stmt, 1);
+ lhs = gimple_assign_lhs (stmt);
+ rhs = gimple_assign_rhs1 (stmt);
+
- gcc_assert (TREE_CODE (rhs) == SSA_NAME);
+ gcc_assert (gimple_assign_rhs_code (stmt) == SSA_NAME);
rhs_val = get_copy_of_val (rhs);
@@ -620,45 +710,42 @@ copy_prop_visit_assignment (tree stmt, tree *result_p)
}
-/* Visit the COND_EXPR STMT. Return SSA_PROP_INTERESTING
+/* Visit the GIMPLE_COND STMT. Return SSA_PROP_INTERESTING
if it can determine which edge will be taken. Otherwise, return
SSA_PROP_VARYING. */
static enum ssa_prop_result
-copy_prop_visit_cond_stmt (tree stmt, edge *taken_edge_p)
+copy_prop_visit_cond_stmt (gimple stmt, edge *taken_edge_p)
{
- enum ssa_prop_result retval;
- tree cond;
+ enum ssa_prop_result retval = SSA_PROP_VARYING;
- cond = COND_EXPR_COND (stmt);
- retval = SSA_PROP_VARYING;
+ tree op0 = gimple_cond_lhs (stmt);
+ tree op1 = gimple_cond_rhs (stmt);
/* The only conditionals that we may be able to compute statically
are predicates involving two SSA_NAMEs. */
- if (COMPARISON_CLASS_P (cond)
- && TREE_CODE (TREE_OPERAND (cond, 0)) == SSA_NAME
- && TREE_CODE (TREE_OPERAND (cond, 1)) == SSA_NAME)
+ if (TREE_CODE (op0) == SSA_NAME && TREE_CODE (op1) == SSA_NAME)
{
- tree op0 = get_last_copy_of (TREE_OPERAND (cond, 0));
- tree op1 = get_last_copy_of (TREE_OPERAND (cond, 1));
+ op0 = get_last_copy_of (op0);
+ op1 = get_last_copy_of (op1);
/* See if we can determine the predicate's value. */
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Trying to determine truth value of ");
fprintf (dump_file, "predicate ");
- print_generic_stmt (dump_file, cond, 0);
+ print_gimple_stmt (dump_file, stmt, 0, 0);
}
/* We can fold COND and get a useful result only when we have
the same SSA_NAME on both sides of a comparison operator. */
if (op0 == op1)
{
- tree folded_cond = fold_binary (TREE_CODE (cond), boolean_type_node,
- op0, op1);
+ tree folded_cond = fold_binary (gimple_cond_code (stmt),
+ boolean_type_node, op0, op1);
if (folded_cond)
{
- basic_block bb = bb_for_stmt (stmt);
+ basic_block bb = gimple_bb (stmt);
*taken_edge_p = find_taken_edge (bb, folded_cond);
if (*taken_edge_p)
retval = SSA_PROP_INTERESTING;
@@ -685,26 +772,26 @@ copy_prop_visit_cond_stmt (tree stmt, edge *taken_edge_p)
SSA_PROP_VARYING. */
static enum ssa_prop_result
-copy_prop_visit_stmt (tree stmt, edge *taken_edge_p, tree *result_p)
+copy_prop_visit_stmt (gimple stmt, edge *taken_edge_p, tree *result_p)
{
enum ssa_prop_result retval;
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "\nVisiting statement:\n");
- print_generic_stmt (dump_file, stmt, dump_flags);
+ print_gimple_stmt (dump_file, stmt, 0, dump_flags);
fprintf (dump_file, "\n");
}
- if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
- && TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 1)) == SSA_NAME
- && TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 0)) == SSA_NAME)
+ if (gimple_assign_single_p (stmt)
+ && TREE_CODE (gimple_assign_lhs (stmt)) == SSA_NAME
+ && TREE_CODE (gimple_assign_rhs1 (stmt)) == SSA_NAME)
{
/* If the statement is a copy assignment, evaluate its RHS to
see if the lattice value of its output has changed. */
retval = copy_prop_visit_assignment (stmt, result_p);
}
- else if (TREE_CODE (stmt) == COND_EXPR)
+ else if (gimple_code (stmt) == GIMPLE_COND)
{
/* See if we can determine which edge goes out of a conditional
jump. */
@@ -738,27 +825,26 @@ copy_prop_visit_stmt (tree stmt, edge *taken_edge_p, tree *result_p)
set it to be the value of the LHS of PHI. */
static enum ssa_prop_result
-copy_prop_visit_phi_node (tree phi)
+copy_prop_visit_phi_node (gimple phi)
{
enum ssa_prop_result retval;
- int i;
- tree lhs;
+ unsigned i;
prop_value_t phi_val = { 0, NULL_TREE, NULL_TREE };
- lhs = PHI_RESULT (phi);
+ tree lhs = gimple_phi_result (phi);
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "\nVisiting PHI node: ");
- print_generic_expr (dump_file, phi, dump_flags);
+ print_gimple_stmt (dump_file, phi, 0, dump_flags);
fprintf (dump_file, "\n\n");
}
- for (i = 0; i < PHI_NUM_ARGS (phi); i++)
+ for (i = 0; i < gimple_phi_num_args (phi); i++)
{
prop_value_t *arg_val;
- tree arg = PHI_ARG_DEF (phi, i);
- edge e = PHI_ARG_EDGE (phi, i);
+ tree arg = gimple_phi_arg_def (phi, i);
+ edge e = gimple_phi_arg_edge (phi, i);
/* We don't care about values flowing through non-executable
edges. */
@@ -860,14 +946,14 @@ init_copy_prop (void)
FOR_EACH_BB (bb)
{
- block_stmt_iterator si;
- tree phi, def;
+ gimple_stmt_iterator si;
int depth = bb->loop_depth;
- for (si = bsi_start (bb); !bsi_end_p (si); bsi_next (&si))
+ for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si))
{
- tree stmt = bsi_stmt (si);
+ gimple stmt = gsi_stmt (si);
ssa_op_iter iter;
+ tree def;
/* The only statements that we care about are those that may
generate useful copies. We also need to mark conditional
@@ -880,31 +966,37 @@ init_copy_prop (void)
value was loop invariant, it will be hoisted by LICM and
exposed for copy propagation. */
if (stmt_ends_bb_p (stmt))
- DONT_SIMULATE_AGAIN (stmt) = false;
+ prop_set_simulate_again (stmt, true);
else if (stmt_may_generate_copy (stmt)
- && loop_depth_of_name (GIMPLE_STMT_OPERAND (stmt, 1)) <= depth)
- DONT_SIMULATE_AGAIN (stmt) = false;
+ /* Since we are iterating over the statements in
+ BB, not the phi nodes, STMT will always be an
+ assignment. */
+ && loop_depth_of_name (gimple_assign_rhs1 (stmt)) <= depth)
+ prop_set_simulate_again (stmt, true);
else
- DONT_SIMULATE_AGAIN (stmt) = true;
+ prop_set_simulate_again (stmt, false);
/* Mark all the outputs of this statement as not being
the copy of anything. */
FOR_EACH_SSA_TREE_OPERAND (def, stmt, iter, SSA_OP_ALL_DEFS)
- if (DONT_SIMULATE_AGAIN (stmt))
+ if (!prop_simulate_again_p (stmt))
set_copy_of_val (def, def);
else
cached_last_copy_of[SSA_NAME_VERSION (def)] = def;
}
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
+ for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si))
{
- def = PHI_RESULT (phi);
+ gimple phi = gsi_stmt (si);
+ tree def;
+
+ def = gimple_phi_result (phi);
if (!is_gimple_reg (def))
- DONT_SIMULATE_AGAIN (phi) = true;
+ prop_set_simulate_again (phi, false);
else
- DONT_SIMULATE_AGAIN (phi) = false;
+ prop_set_simulate_again (phi, true);
- if (DONT_SIMULATE_AGAIN (phi))
+ if (!prop_simulate_again_p (phi))
set_copy_of_val (def, def);
else
cached_last_copy_of[SSA_NAME_VERSION (def)] = def;
@@ -1084,4 +1176,3 @@ struct gimple_opt_pass pass_copy_prop =
| TODO_update_ssa /* todo_flags_finish */
}
};
-
diff --git a/gcc/tree-ssa-copyrename.c b/gcc/tree-ssa-copyrename.c
index 46b33143cb0..d30e2372e7e 100644
--- a/gcc/tree-ssa-copyrename.c
+++ b/gcc/tree-ssa-copyrename.c
@@ -23,13 +23,14 @@ along with GCC; see the file COPYING3. If not see
#include "coretypes.h"
#include "tm.h"
#include "tree.h"
+#include "gimple.h"
#include "flags.h"
#include "basic-block.h"
#include "function.h"
#include "diagnostic.h"
#include "bitmap.h"
#include "tree-flow.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "tree-inline.h"
#include "timevar.h"
#include "hashtab.h"
@@ -300,8 +301,9 @@ rename_ssa_copies (void)
{
var_map map;
basic_block bb;
- block_stmt_iterator bsi;
- tree phi, stmt, var, part_var;
+ gimple_stmt_iterator gsi;
+ tree var, part_var;
+ gimple stmt, phi;
unsigned x;
FILE *debug;
bool updated = false;
@@ -316,16 +318,15 @@ rename_ssa_copies (void)
FOR_EACH_BB (bb)
{
/* Scan for real copies. */
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- stmt = bsi_stmt (bsi);
- if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT)
+ stmt = gsi_stmt (gsi);
+ if (gimple_assign_ssa_name_copy_p (stmt))
{
- tree lhs = GIMPLE_STMT_OPERAND (stmt, 0);
- tree rhs = GIMPLE_STMT_OPERAND (stmt, 1);
+ tree lhs = gimple_assign_lhs (stmt);
+ tree rhs = gimple_assign_rhs1 (stmt);
- if (TREE_CODE (lhs) == SSA_NAME && TREE_CODE (rhs) == SSA_NAME)
- updated |= copy_rename_partition_coalesce (map, lhs, rhs, debug);
+ updated |= copy_rename_partition_coalesce (map, lhs, rhs, debug);
}
}
}
@@ -333,18 +334,21 @@ rename_ssa_copies (void)
FOR_EACH_BB (bb)
{
/* Treat PHI nodes as copies between the result and each argument. */
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
+ for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- int i;
- tree res = PHI_RESULT (phi);
+ size_t i;
+ tree res;
+
+ phi = gsi_stmt (gsi);
+ res = gimple_phi_result (phi);
/* Do not process virtual SSA_NAMES. */
if (!is_gimple_reg (SSA_NAME_VAR (res)))
continue;
- for (i = 0; i < PHI_NUM_ARGS (phi); i++)
+ for (i = 0; i < gimple_phi_num_args (phi); i++)
{
- tree arg = PHI_ARG_DEF (phi, i);
+ tree arg = gimple_phi_arg (phi, i)->def;
if (TREE_CODE (arg) == SSA_NAME)
updated |= copy_rename_partition_coalesce (map, res, arg, debug);
}
@@ -407,4 +411,3 @@ struct gimple_opt_pass pass_rename_ssa_copies =
TODO_dump_func | TODO_verify_ssa /* todo_flags_finish */
}
};
-
diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c
index 760e20d14bc..3c750469682 100644
--- a/gcc/tree-ssa-dce.c
+++ b/gcc/tree-ssa-dce.c
@@ -1,5 +1,5 @@
/* Dead code elimination pass for the GNU compiler.
- Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007
+ Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008
Free Software Foundation, Inc.
Contributed by Ben Elliston <bje@redhat.com>
and Andrew MacLeod <amacleod@redhat.com>
@@ -59,14 +59,14 @@ along with GCC; see the file COPYING3. If not see
#include "tree.h"
#include "diagnostic.h"
#include "tree-flow.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "tree-dump.h"
#include "tree-pass.h"
#include "timevar.h"
#include "flags.h"
#include "cfgloop.h"
#include "tree-scalar-evolution.h"
-
+
static struct stmt_stats
{
int total;
@@ -75,7 +75,9 @@ static struct stmt_stats
int removed_phis;
} stats;
-static VEC(tree,heap) *worklist;
+#define STMT_NECESSARY GF_PLF_1
+
+static VEC(gimple,heap) *worklist;
/* Vector indicating an SSA name has already been processed and marked
as necessary. */
@@ -196,30 +198,26 @@ find_all_control_dependences (struct edge_list *el)
find_control_dependence (el, i);
}
-
-#define NECESSARY(stmt) stmt->base.asm_written_flag
-
/* If STMT is not already marked necessary, mark it, and add it to the
worklist if ADD_TO_WORKLIST is true. */
static inline void
-mark_stmt_necessary (tree stmt, bool add_to_worklist)
+mark_stmt_necessary (gimple stmt, bool add_to_worklist)
{
gcc_assert (stmt);
- gcc_assert (!DECL_P (stmt));
- if (NECESSARY (stmt))
+ if (gimple_plf (stmt, STMT_NECESSARY))
return;
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Marking useful stmt: ");
- print_generic_stmt (dump_file, stmt, TDF_SLIM);
+ print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM);
fprintf (dump_file, "\n");
}
- NECESSARY (stmt) = 1;
+ gimple_set_plf (stmt, STMT_NECESSARY, true);
if (add_to_worklist)
- VEC_safe_push (tree, heap, worklist, stmt);
+ VEC_safe_push (gimple, heap, worklist, stmt);
}
@@ -228,7 +226,7 @@ mark_stmt_necessary (tree stmt, bool add_to_worklist)
static inline void
mark_operand_necessary (tree op)
{
- tree stmt;
+ gimple stmt;
int ver;
gcc_assert (op);
@@ -241,11 +239,11 @@ mark_operand_necessary (tree op)
stmt = SSA_NAME_DEF_STMT (op);
gcc_assert (stmt);
- if (NECESSARY (stmt) || IS_EMPTY_STMT (stmt))
+ if (gimple_plf (stmt, STMT_NECESSARY) || gimple_nop_p (stmt))
return;
- NECESSARY (stmt) = 1;
- VEC_safe_push (tree, heap, worklist, stmt);
+ gimple_set_plf (stmt, STMT_NECESSARY, true);
+ VEC_safe_push (gimple, heap, worklist, stmt);
}
@@ -256,77 +254,76 @@ mark_operand_necessary (tree op)
necessary. */
static void
-mark_stmt_if_obviously_necessary (tree stmt, bool aggressive)
+mark_stmt_if_obviously_necessary (gimple stmt, bool aggressive)
{
- stmt_ann_t ann;
- tree op;
-
+ tree lhs = NULL_TREE;
/* With non-call exceptions, we have to assume that all statements could
throw. If a statement may throw, it is inherently necessary. */
if (flag_non_call_exceptions
- && tree_could_throw_p (stmt))
+ && stmt_could_throw_p (stmt))
{
mark_stmt_necessary (stmt, true);
return;
}
- /* Statements that are implicitly live. Most function calls, asm and return
- statements are required. Labels and BIND_EXPR nodes are kept because
- they are control flow, and we have no way of knowing whether they can be
- removed. DCE can eliminate all the other statements in a block, and CFG
- can then remove the block and labels. */
- switch (TREE_CODE (stmt))
+ /* Statements that are implicitly live. Most function calls, asm
+ and return statements are required. Labels and GIMPLE_BIND nodes
+ are kept because they are control flow, and we have no way of
+ knowing whether they can be removed. DCE can eliminate all the
+ other statements in a block, and CFG can then remove the block
+ and labels. */
+ switch (gimple_code (stmt))
{
- case PREDICT_EXPR:
- case LABEL_EXPR:
- case CASE_LABEL_EXPR:
+ case GIMPLE_PREDICT:
+ case GIMPLE_LABEL:
mark_stmt_necessary (stmt, false);
return;
- case ASM_EXPR:
- case RESX_EXPR:
- case RETURN_EXPR:
- case CHANGE_DYNAMIC_TYPE_EXPR:
+ case GIMPLE_ASM:
+ case GIMPLE_RESX:
+ case GIMPLE_RETURN:
+ case GIMPLE_CHANGE_DYNAMIC_TYPE:
mark_stmt_necessary (stmt, true);
return;
- case CALL_EXPR:
+ case GIMPLE_CALL:
/* Most, but not all function calls are required. Function calls that
produce no result and have no side effects (i.e. const pure
functions) are unnecessary. */
- if (TREE_SIDE_EFFECTS (stmt))
- mark_stmt_necessary (stmt, true);
- return;
-
- case GIMPLE_MODIFY_STMT:
- op = get_call_expr_in (stmt);
- if (op && TREE_SIDE_EFFECTS (op))
+ if (gimple_has_side_effects (stmt))
{
mark_stmt_necessary (stmt, true);
return;
}
-
+ if (!gimple_call_lhs (stmt))
+ return;
+ lhs = gimple_call_lhs (stmt);
+ /* Fall through */
+
+ case GIMPLE_ASSIGN:
+ if (!lhs)
+ lhs = gimple_assign_lhs (stmt);
/* These values are mildly magic bits of the EH runtime. We can't
see the entire lifetime of these values until landing pads are
generated. */
- if (TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 0)) == EXC_PTR_EXPR
- || TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 0)) == FILTER_EXPR)
+ if (TREE_CODE (lhs) == EXC_PTR_EXPR
+ || TREE_CODE (lhs) == FILTER_EXPR)
{
mark_stmt_necessary (stmt, true);
return;
}
break;
- case GOTO_EXPR:
+ case GIMPLE_GOTO:
gcc_assert (!simple_goto_p (stmt));
mark_stmt_necessary (stmt, true);
return;
- case COND_EXPR:
- gcc_assert (EDGE_COUNT (bb_for_stmt (stmt)->succs) == 2);
+ case GIMPLE_COND:
+ gcc_assert (EDGE_COUNT (gimple_bb (stmt)->succs) == 2);
/* Fall through. */
- case SWITCH_EXPR:
+ case GIMPLE_SWITCH:
if (! aggressive)
mark_stmt_necessary (stmt, true);
break;
@@ -335,12 +332,10 @@ mark_stmt_if_obviously_necessary (tree stmt, bool aggressive)
break;
}
- ann = stmt_ann (stmt);
-
/* If the statement has volatile operands, it needs to be preserved.
Same for statements that can alter control flow in unpredictable
ways. */
- if (ann->has_volatile_ops || is_ctrl_altering_stmt (stmt))
+ if (gimple_has_volatile_ops (stmt) || is_ctrl_altering_stmt (stmt))
{
mark_stmt_necessary (stmt, true);
return;
@@ -372,16 +367,16 @@ mark_control_dependent_edges_necessary (basic_block bb, struct edge_list *el)
EXECUTE_IF_CONTROL_DEPENDENT (bi, bb->index, edge_number)
{
- tree t;
+ gimple stmt;
basic_block cd_bb = INDEX_EDGE_PRED_BB (el, edge_number);
if (TEST_BIT (last_stmt_necessary, cd_bb->index))
continue;
SET_BIT (last_stmt_necessary, cd_bb->index);
- t = last_stmt (cd_bb);
- if (t && is_ctrl_stmt (t))
- mark_stmt_necessary (t, true);
+ stmt = last_stmt (cd_bb);
+ if (stmt && is_ctrl_stmt (stmt))
+ mark_stmt_necessary (stmt, true);
}
}
@@ -397,22 +392,24 @@ static void
find_obviously_necessary_stmts (struct edge_list *el)
{
basic_block bb;
- block_stmt_iterator i;
+ gimple_stmt_iterator gsi;
edge e;
+ gimple phi, stmt;
FOR_EACH_BB (bb)
{
- tree phi;
-
/* PHI nodes are never inherently necessary. */
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
- NECESSARY (phi) = 0;
+ for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ {
+ phi = gsi_stmt (gsi);
+ gimple_set_plf (phi, STMT_NECESSARY, false);
+ }
/* Check all statements in the block. */
- for (i = bsi_start (bb); ! bsi_end_p (i); bsi_next (&i))
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- tree stmt = bsi_stmt (i);
- NECESSARY (stmt) = 0;
+ stmt = gsi_stmt (gsi);
+ gimple_set_plf (stmt, STMT_NECESSARY, false);
mark_stmt_if_obviously_necessary (stmt, el != NULL);
}
}
@@ -442,21 +439,21 @@ find_obviously_necessary_stmts (struct edge_list *el)
static void
propagate_necessity (struct edge_list *el)
{
- tree stmt;
+ gimple stmt;
bool aggressive = (el ? true : false);
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "\nProcessing worklist:\n");
- while (VEC_length (tree, worklist) > 0)
+ while (VEC_length (gimple, worklist) > 0)
{
/* Take STMT from worklist. */
- stmt = VEC_pop (tree, worklist);
+ stmt = VEC_pop (gimple, worklist);
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "processing: ");
- print_generic_stmt (dump_file, stmt, TDF_SLIM);
+ print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM);
fprintf (dump_file, "\n");
}
@@ -465,7 +462,7 @@ propagate_necessity (struct edge_list *el)
/* Mark the last statements of the basic blocks that the block
containing STMT is control dependent on, but only if we haven't
already done so. */
- basic_block bb = bb_for_stmt (stmt);
+ basic_block bb = gimple_bb (stmt);
if (bb != ENTRY_BLOCK_PTR
&& ! TEST_BIT (visited_control_parents, bb->index))
{
@@ -474,7 +471,7 @@ propagate_necessity (struct edge_list *el)
}
}
- if (TREE_CODE (stmt) == PHI_NODE)
+ if (gimple_code (stmt) == GIMPLE_PHI)
{
/* PHI nodes are somewhat special in that each PHI alternative has
data and control dependencies. All the statements feeding the
@@ -482,9 +479,9 @@ propagate_necessity (struct edge_list *el)
we also consider the control dependent edges leading to the
predecessor block associated with each PHI alternative as
necessary. */
- int k;
+ size_t k;
- for (k = 0; k < PHI_NUM_ARGS (stmt); k++)
+ for (k = 0; k < gimple_phi_num_args (stmt); k++)
{
tree arg = PHI_ARG_DEF (stmt, k);
if (TREE_CODE (arg) == SSA_NAME)
@@ -493,9 +490,9 @@ propagate_necessity (struct edge_list *el)
if (aggressive)
{
- for (k = 0; k < PHI_NUM_ARGS (stmt); k++)
+ for (k = 0; k < gimple_phi_num_args (stmt); k++)
{
- basic_block arg_bb = PHI_ARG_EDGE (stmt, k)->src;
+ basic_block arg_bb = gimple_phi_arg_edge (stmt, k)->src;
if (arg_bb != ENTRY_BLOCK_PTR
&& ! TEST_BIT (visited_control_parents, arg_bb->index))
{
@@ -529,35 +526,33 @@ propagate_necessity (struct edge_list *el)
static bool
remove_dead_phis (basic_block bb)
{
- tree prev, phi;
bool something_changed = false;
+ gimple_seq phis;
+ gimple phi;
+ gimple_stmt_iterator gsi;
+ phis = phi_nodes (bb);
- prev = NULL_TREE;
- phi = phi_nodes (bb);
- while (phi)
+ for (gsi = gsi_start (phis); !gsi_end_p (gsi);)
{
stats.total_phis++;
+ phi = gsi_stmt (gsi);
- if (! NECESSARY (phi))
+ if (!gimple_plf (phi, STMT_NECESSARY))
{
- tree next = PHI_CHAIN (phi);
-
something_changed = true;
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Deleting : ");
- print_generic_stmt (dump_file, phi, TDF_SLIM);
+ print_gimple_stmt (dump_file, phi, 0, TDF_SLIM);
fprintf (dump_file, "\n");
}
- remove_phi_node (phi, prev, true);
+ remove_phi_node (&gsi, true);
stats.removed_phis++;
- phi = next;
}
else
{
- prev = phi;
- phi = PHI_CHAIN (phi);
+ gsi_next (&gsi);
}
}
return something_changed;
@@ -568,14 +563,14 @@ remove_dead_phis (basic_block bb)
containing I so that we don't have to look it up. */
static void
-remove_dead_stmt (block_stmt_iterator *i, basic_block bb)
+remove_dead_stmt (gimple_stmt_iterator *i, basic_block bb)
{
- tree t = bsi_stmt (*i);
+ gimple stmt = gsi_stmt (*i);
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Deleting : ");
- print_generic_stmt (dump_file, t, TDF_SLIM);
+ print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM);
fprintf (dump_file, "\n");
}
@@ -587,7 +582,7 @@ remove_dead_stmt (block_stmt_iterator *i, basic_block bb)
immediate post-dominator. The blocks we are circumventing will be
removed by cleanup_tree_cfg if this change in the flow graph makes them
unreachable. */
- if (is_ctrl_stmt (t))
+ if (is_ctrl_stmt (stmt))
{
basic_block post_dom_bb;
@@ -649,8 +644,8 @@ remove_dead_stmt (block_stmt_iterator *i, basic_block bb)
}
}
- bsi_remove (i, true);
- release_defs (t);
+ gsi_remove (i, true);
+ release_defs (stmt);
}
@@ -662,7 +657,9 @@ eliminate_unnecessary_stmts (void)
{
bool something_changed = false;
basic_block bb;
- block_stmt_iterator i;
+ gimple_stmt_iterator gsi;
+ gimple stmt;
+ tree call;
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "\nEliminating unnecessary statements:\n");
@@ -677,51 +674,56 @@ eliminate_unnecessary_stmts (void)
FOR_EACH_BB (bb)
{
/* Remove dead statements. */
- for (i = bsi_start (bb); ! bsi_end_p (i) ; )
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi);)
{
- tree t = bsi_stmt (i);
+ stmt = gsi_stmt (gsi);
stats.total++;
- /* If `i' is not necessary then remove it. */
- if (! NECESSARY (t))
+ /* If GSI is not necessary then remove it. */
+ if (!gimple_plf (stmt, STMT_NECESSARY))
{
- remove_dead_stmt (&i, bb);
+ remove_dead_stmt (&gsi, bb);
something_changed = true;
}
- else
+ else if (is_gimple_call (stmt))
{
- tree call = get_call_expr_in (t);
+ call = gimple_call_fndecl (stmt);
if (call)
{
tree name;
+ gimple g;
/* When LHS of var = call (); is dead, simplify it into
call (); saving one operand. */
- if (TREE_CODE (t) == GIMPLE_MODIFY_STMT
- && (TREE_CODE ((name = GIMPLE_STMT_OPERAND (t, 0)))
- == SSA_NAME)
- && !TEST_BIT (processed, SSA_NAME_VERSION (name)))
+ name = gimple_call_lhs (stmt);
+ if (name && TREE_CODE (name) == SSA_NAME
+ && !TEST_BIT (processed, SSA_NAME_VERSION (name)))
{
- tree oldlhs = GIMPLE_STMT_OPERAND (t, 0);
something_changed = true;
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Deleting LHS of call: ");
- print_generic_stmt (dump_file, t, TDF_SLIM);
+ print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM);
fprintf (dump_file, "\n");
}
- push_stmt_changes (bsi_stmt_ptr (i));
- TREE_BLOCK (call) = TREE_BLOCK (t);
- bsi_replace (&i, call, false);
- maybe_clean_or_replace_eh_stmt (t, call);
- mark_symbols_for_renaming (call);
- pop_stmt_changes (bsi_stmt_ptr (i));
- release_ssa_name (oldlhs);
+
+ push_stmt_changes (gsi_stmt_ptr (&gsi));
+ g = gimple_copy (stmt);
+ gimple_call_set_lhs (g, NULL_TREE);
+ gsi_replace (&gsi, g, false);
+ maybe_clean_or_replace_eh_stmt (stmt, g);
+ mark_symbols_for_renaming (g);
+ pop_stmt_changes (gsi_stmt_ptr (&gsi));
+ release_ssa_name (name);
}
- notice_special_calls (call);
+ notice_special_calls (stmt);
}
- bsi_next (&i);
+ gsi_next (&gsi);
+ }
+ else
+ {
+ gsi_next (&gsi);
}
}
}
@@ -749,7 +751,7 @@ print_stats (void)
fprintf (dump_file, "Removed %d of %d PHI nodes (%d%%)\n",
stats.removed_phis, stats.total_phis, (int) percg);
}
-
+
/* Initialization for this pass. Set up the used data structures. */
static void
@@ -772,7 +774,7 @@ tree_dce_init (bool aggressive)
processed = sbitmap_alloc (num_ssa_names + 1);
sbitmap_zero (processed);
- worklist = VEC_alloc (tree, heap, 64);
+ worklist = VEC_alloc (gimple, heap, 64);
cfg_altered = false;
}
@@ -795,9 +797,9 @@ tree_dce_done (bool aggressive)
sbitmap_free (processed);
- VEC_free (tree, heap, worklist);
+ VEC_free (gimple, heap, worklist);
}
-
+
/* Main routine to eliminate dead code.
AGGRESSIVE controls the aggressiveness of the algorithm.
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index 0b159382e7e..4e7a390d91e 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -46,6 +46,37 @@ along with GCC; see the file COPYING3. If not see
/* This file implements optimizations on the dominator tree. */
+/* Representation of a "naked" right-hand-side expression, to be used
+ in recording available expressions in the expression hash table. */
+
+enum expr_kind
+{
+ EXPR_SINGLE,
+ EXPR_UNARY,
+ EXPR_BINARY,
+ EXPR_CALL
+};
+
+struct hashable_expr
+{
+ tree type;
+ enum expr_kind kind;
+ union {
+ struct { tree rhs; } single;
+ struct { enum tree_code op; tree opnd; } unary;
+ struct { enum tree_code op; tree opnd0; tree opnd1; } binary;
+ struct { tree fn; bool pure; size_t nargs; tree *args; } call;
+ } ops;
+};
+
+/* Structure for recording known values of a conditional expression
+ at the exits from its block. */
+
+struct cond_equivalence
+{
+ struct hashable_expr cond;
+ tree value;
+};
/* Structure for recording edge equivalences as well as any pending
edge redirections during the dominator optimizer.
@@ -72,11 +103,10 @@ struct edge_info
are true or false. The number of recorded conditions can vary, but
can be determined by the condition's code. So we have an array
and its maximum index rather than use a varray. */
- tree *cond_equivalences;
+ struct cond_equivalence *cond_equivalences;
unsigned int max_cond_equivalences;
};
-
/* Hash table with expressions made available during the renaming process.
When an assignment of the form X_i = EXPR is found, the statement is
stored in this table. If the same expression EXPR is later found on the
@@ -91,7 +121,11 @@ static htab_t avail_exprs;
(null). When we finish processing the block, we pop off entries and
remove the expressions from the global hash table until we hit the
marker. */
-static VEC(tree,heap) *avail_exprs_stack;
+typedef struct expr_hash_elt * expr_hash_elt_t;
+DEF_VEC_P(expr_hash_elt_t);
+DEF_VEC_ALLOC_P(expr_hash_elt_t,heap);
+
+static VEC(expr_hash_elt_t,heap) *avail_exprs_stack;
/* Stack of statements we need to rescan during finalization for newly
exposed variables.
@@ -100,22 +134,13 @@ static VEC(tree,heap) *avail_exprs_stack;
expressions are removed from AVAIL_EXPRS. Else we may change the
hash code for an expression and be unable to find/remove it from
AVAIL_EXPRS. */
-typedef tree *tree_p;
-DEF_VEC_P(tree_p);
-DEF_VEC_ALLOC_P(tree_p,heap);
-
-static VEC(tree_p,heap) *stmts_to_rescan;
+typedef gimple *gimple_p;
+DEF_VEC_P(gimple_p);
+DEF_VEC_ALLOC_P(gimple_p,heap);
-/* Structure for entries in the expression hash table.
+static VEC(gimple_p,heap) *stmts_to_rescan;
- This requires more memory for the hash table entries, but allows us
- to avoid creating silly tree nodes and annotations for conditionals,
- eliminates 2 global hash tables and two block local varrays.
-
- It also allows us to reduce the number of hash table lookups we
- have to perform in lookup_avail_expr and finally it allows us to
- significantly reduce the number of calls into the hashing routine
- itself. */
+/* Structure for entries in the expression hash table. */
struct expr_hash_elt
{
@@ -123,13 +148,17 @@ struct expr_hash_elt
tree lhs;
/* The expression (rhs) we want to record. */
- tree rhs;
+ struct hashable_expr expr;
/* The stmt pointer if this element corresponds to a statement. */
- tree stmt;
+ gimple stmt;
- /* The hash value for RHS/ann. */
+ /* The hash value for RHS. */
hashval_t hash;
+
+ /* A unique stamp, typically the address of the hash
+ element itself, used in removing entries from the table. */
+ struct expr_hash_elt *stamp;
};
/* Stack of dest,src pairs that need to be restored during finalization.
@@ -157,28 +186,22 @@ struct opt_stats_d
static struct opt_stats_d opt_stats;
-struct eq_expr_value
-{
- tree src;
- tree dst;
-};
-
/* Local functions. */
static void optimize_stmt (struct dom_walk_data *,
- basic_block bb,
- block_stmt_iterator);
-static tree lookup_avail_expr (tree, bool);
+ basic_block,
+ gimple_stmt_iterator);
+static tree lookup_avail_expr (gimple, bool);
static hashval_t avail_expr_hash (const void *);
static hashval_t real_avail_expr_hash (const void *);
static int avail_expr_eq (const void *, const void *);
static void htab_statistics (FILE *, htab_t);
-static void record_cond (tree, tree);
+static void record_cond (struct cond_equivalence *);
static void record_const_or_copy (tree, tree);
static void record_equality (tree, tree);
static void record_equivalences_from_phis (basic_block);
static void record_equivalences_from_incoming_edge (basic_block);
-static bool eliminate_redundant_computations (tree);
-static void record_equivalences_from_stmt (tree, int, stmt_ann_t);
+static bool eliminate_redundant_computations (gimple_stmt_iterator *);
+static void record_equivalences_from_stmt (gimple, int);
static void dom_thread_across_edge (struct dom_walk_data *, edge);
static void dom_opt_finalize_block (struct dom_walk_data *, basic_block);
static void dom_opt_initialize_block (struct dom_walk_data *, basic_block);
@@ -188,6 +211,366 @@ static void restore_vars_to_original_value (void);
static edge single_incoming_edge_ignoring_loop_edges (basic_block);
+/* Given a statement STMT, initialize the hash table element pointed to
+ by ELEMENT. */
+
+static void
+initialize_hash_element (gimple stmt, tree lhs,
+ struct expr_hash_elt *element)
+{
+ enum gimple_code code = gimple_code (stmt);
+ struct hashable_expr *expr = &element->expr;
+
+ if (code == GIMPLE_ASSIGN)
+ {
+ enum tree_code subcode = gimple_assign_rhs_code (stmt);
+
+ expr->type = NULL_TREE;
+
+ switch (get_gimple_rhs_class (subcode))
+ {
+ case GIMPLE_SINGLE_RHS:
+ expr->kind = EXPR_SINGLE;
+ expr->ops.single.rhs = gimple_assign_rhs1 (stmt);
+ break;
+ case GIMPLE_UNARY_RHS:
+ expr->kind = EXPR_UNARY;
+ expr->type = TREE_TYPE (gimple_assign_lhs (stmt));
+ expr->ops.unary.op = subcode;
+ expr->ops.unary.opnd = gimple_assign_rhs1 (stmt);
+ break;
+ case GIMPLE_BINARY_RHS:
+ expr->kind = EXPR_BINARY;
+ expr->type = TREE_TYPE (gimple_assign_lhs (stmt));
+ expr->ops.binary.op = subcode;
+ expr->ops.binary.opnd0 = gimple_assign_rhs1 (stmt);
+ expr->ops.binary.opnd1 = gimple_assign_rhs2 (stmt);
+ break;
+ default:
+ gcc_unreachable ();
+ }
+ }
+ else if (code == GIMPLE_COND)
+ {
+ expr->type = boolean_type_node;
+ expr->kind = EXPR_BINARY;
+ expr->ops.binary.op = gimple_cond_code (stmt);
+ expr->ops.binary.opnd0 = gimple_cond_lhs (stmt);
+ expr->ops.binary.opnd1 = gimple_cond_rhs (stmt);
+ }
+ else if (code == GIMPLE_CALL)
+ {
+ size_t nargs = gimple_call_num_args (stmt);
+ size_t i;
+
+ gcc_assert (gimple_call_lhs (stmt));
+
+ expr->type = TREE_TYPE (gimple_call_lhs (stmt));
+ expr->kind = EXPR_CALL;
+ expr->ops.call.fn = gimple_call_fn (stmt);
+
+ if (gimple_call_flags (stmt) & (ECF_CONST | ECF_PURE))
+ expr->ops.call.pure = true;
+ else
+ expr->ops.call.pure = false;
+
+ expr->ops.call.nargs = nargs;
+ expr->ops.call.args = (tree *) xcalloc (nargs, sizeof (tree));
+ for (i = 0; i < nargs; i++)
+ expr->ops.call.args[i] = gimple_call_arg (stmt, i);
+ }
+ else if (code == GIMPLE_SWITCH)
+ {
+ expr->type = TREE_TYPE (gimple_switch_index (stmt));
+ expr->kind = EXPR_SINGLE;
+ expr->ops.single.rhs = gimple_switch_index (stmt);
+ }
+ else if (code == GIMPLE_GOTO)
+ {
+ expr->type = TREE_TYPE (gimple_goto_dest (stmt));
+ expr->kind = EXPR_SINGLE;
+ expr->ops.single.rhs = gimple_goto_dest (stmt);
+ }
+ else
+ gcc_unreachable ();
+
+ element->lhs = lhs;
+ element->stmt = stmt;
+ element->hash = avail_expr_hash (element);
+ element->stamp = element;
+}
+
+/* Given a conditional expression COND as a tree, initialize
+ a hashable_expr expression EXPR. The conditional must be a
+ comparison or logical negation. A constant or a variable is
+ not permitted. */
+
+static void
+initialize_expr_from_cond (tree cond, struct hashable_expr *expr)
+{
+ expr->type = boolean_type_node;
+
+ if (COMPARISON_CLASS_P (cond))
+ {
+ expr->kind = EXPR_BINARY;
+ expr->ops.binary.op = TREE_CODE (cond);
+ expr->ops.binary.opnd0 = TREE_OPERAND (cond, 0);
+ expr->ops.binary.opnd1 = TREE_OPERAND (cond, 1);
+ }
+ else if (TREE_CODE (cond) == TRUTH_NOT_EXPR)
+ {
+ expr->kind = EXPR_UNARY;
+ expr->ops.unary.op = TRUTH_NOT_EXPR;
+ expr->ops.unary.opnd = TREE_OPERAND (cond, 0);
+ }
+ else
+ gcc_unreachable ();
+}
+
+/* Given a hashable_expr expression EXPR and an LHS,
+ initialize the hash table element pointed to by ELEMENT. */
+
+static void
+initialize_hash_element_from_expr (struct hashable_expr *expr,
+ tree lhs,
+ struct expr_hash_elt *element)
+{
+ element->expr = *expr;
+ element->lhs = lhs;
+ element->stmt = NULL;
+ element->hash = avail_expr_hash (element);
+ element->stamp = element;
+}
+
+/* Compare two hashable_expr structures for equivalence.
+ They are considered equivalent when the the expressions
+ they denote must necessarily be equal. The logic is intended
+ to follow that of operand_equal_p in fold-const.c */
+
+static bool
+hashable_expr_equal_p (const struct hashable_expr *expr0,
+ const struct hashable_expr *expr1)
+{
+ tree type0 = expr0->type;
+ tree type1 = expr1->type;
+
+ /* If either type is NULL, there is nothing to check. */
+ if ((type0 == NULL_TREE) ^ (type1 == NULL_TREE))
+ return false;
+
+ /* If both types don't have the same signedness, precision, and mode,
+ then we can't consider them equal. */
+ if (type0 != type1
+ && (TREE_CODE (type0) == ERROR_MARK
+ || TREE_CODE (type1) == ERROR_MARK
+ || TYPE_UNSIGNED (type0) != TYPE_UNSIGNED (type1)
+ || TYPE_PRECISION (type0) != TYPE_PRECISION (type1)
+ || TYPE_MODE (type0) != TYPE_MODE (type1)))
+ return false;
+
+ if (expr0->kind != expr1->kind)
+ return false;
+
+ switch (expr0->kind)
+ {
+ case EXPR_SINGLE:
+ return operand_equal_p (expr0->ops.single.rhs,
+ expr1->ops.single.rhs, 0);
+
+ case EXPR_UNARY:
+ if (expr0->ops.unary.op != expr1->ops.unary.op)
+ return false;
+
+ if ((expr0->ops.unary.op == NOP_EXPR
+ || expr0->ops.unary.op == CONVERT_EXPR
+ || expr0->ops.unary.op == NON_LVALUE_EXPR)
+ && TYPE_UNSIGNED (expr0->type) != TYPE_UNSIGNED (expr1->type))
+ return false;
+
+ return operand_equal_p (expr0->ops.unary.opnd,
+ expr1->ops.unary.opnd, 0);
+
+ case EXPR_BINARY:
+ {
+ if (expr0->ops.binary.op != expr1->ops.binary.op)
+ return false;
+
+ if (operand_equal_p (expr0->ops.binary.opnd0,
+ expr1->ops.binary.opnd0, 0)
+ && operand_equal_p (expr0->ops.binary.opnd1,
+ expr1->ops.binary.opnd1, 0))
+ return true;
+
+ /* For commutative ops, allow the other order. */
+ return (commutative_tree_code (expr0->ops.binary.op)
+ && operand_equal_p (expr0->ops.binary.opnd0,
+ expr1->ops.binary.opnd1, 0)
+ && operand_equal_p (expr0->ops.binary.opnd1,
+ expr1->ops.binary.opnd0, 0));
+ }
+
+ case EXPR_CALL:
+ {
+ size_t i;
+
+ /* If the calls are to different functions, then they
+ clearly cannot be equal. */
+ if (! operand_equal_p (expr0->ops.call.fn,
+ expr1->ops.call.fn, 0))
+ return false;
+
+ if (! expr0->ops.call.pure)
+ return false;
+
+ if (expr0->ops.call.nargs != expr1->ops.call.nargs)
+ return false;
+
+ for (i = 0; i < expr0->ops.call.nargs; i++)
+ if (! operand_equal_p (expr0->ops.call.args[i],
+ expr1->ops.call.args[i], 0))
+ return false;
+
+ return true;
+ }
+
+ default:
+ gcc_unreachable ();
+ }
+}
+
+/* Compute a hash value for a hashable_expr value EXPR and a
+ previously accumulated hash value VAL. If two hashable_expr
+ values compare equal with hashable_expr_equal_p, they must
+ hash to the same value, given an identical value of VAL.
+ The logic is intended to follow iterative_hash_expr in tree.c. */
+
+static hashval_t
+iterative_hash_hashable_expr (const struct hashable_expr *expr, hashval_t val)
+{
+ switch (expr->kind)
+ {
+ case EXPR_SINGLE:
+ val = iterative_hash_expr (expr->ops.single.rhs, val);
+ break;
+
+ case EXPR_UNARY:
+ val = iterative_hash_object (expr->ops.unary.op, val);
+
+ /* Make sure to include signedness in the hash computation.
+ Don't hash the type, that can lead to having nodes which
+ compare equal according to operand_equal_p, but which
+ have different hash codes. */
+ if (expr->ops.unary.op == NOP_EXPR
+ || expr->ops.unary.op == CONVERT_EXPR
+ || expr->ops.unary.op == NON_LVALUE_EXPR)
+ val += TYPE_UNSIGNED (expr->type);
+
+ val = iterative_hash_expr (expr->ops.unary.opnd, val);
+ break;
+
+ case EXPR_BINARY:
+ val = iterative_hash_object (expr->ops.binary.op, val);
+ if (commutative_tree_code (expr->ops.binary.op))
+ val = iterative_hash_exprs_commutative (expr->ops.binary.opnd0,
+ expr->ops.binary.opnd1, val);
+ else
+ {
+ val = iterative_hash_expr (expr->ops.binary.opnd0, val);
+ val = iterative_hash_expr (expr->ops.binary.opnd1, val);
+ }
+ break;
+
+ case EXPR_CALL:
+ {
+ size_t i;
+ enum tree_code code = CALL_EXPR;
+
+ val = iterative_hash_object (code, val);
+ val = iterative_hash_expr (expr->ops.call.fn, val);
+ for (i = 0; i < expr->ops.call.nargs; i++)
+ val = iterative_hash_expr (expr->ops.call.args[i], val);
+ }
+ break;
+
+ default:
+ gcc_unreachable ();
+ }
+
+ return val;
+}
+
+/* Print a diagnostic dump of an expression hash table entry. */
+
+static void
+print_expr_hash_elt (FILE * stream, const struct expr_hash_elt *element)
+{
+ if (element->stmt)
+ fprintf (stream, "STMT ");
+ else
+ fprintf (stream, "COND ");
+
+ if (element->lhs)
+ {
+ print_generic_expr (stream, element->lhs, 0);
+ fprintf (stream, " = ");
+ }
+
+ switch (element->expr.kind)
+ {
+ case EXPR_SINGLE:
+ print_generic_expr (stream, element->expr.ops.single.rhs, 0);
+ break;
+
+ case EXPR_UNARY:
+ fprintf (stream, "%s ", tree_code_name[element->expr.ops.unary.op]);
+ print_generic_expr (stream, element->expr.ops.unary.opnd, 0);
+ break;
+
+ case EXPR_BINARY:
+ print_generic_expr (stream, element->expr.ops.binary.opnd0, 0);
+ fprintf (stream, " %s ", tree_code_name[element->expr.ops.binary.op]);
+ print_generic_expr (stream, element->expr.ops.binary.opnd1, 0);
+ break;
+
+ case EXPR_CALL:
+ {
+ size_t i;
+ size_t nargs = element->expr.ops.call.nargs;
+
+ print_generic_expr (stream, element->expr.ops.call.fn, 0);
+ fprintf (stream, " (");
+ for (i = 0; i < nargs; i++)
+ {
+ print_generic_expr (stream, element->expr.ops.call.args[i], 0);
+ if (i + 1 < nargs)
+ fprintf (stream, ", ");
+ }
+ fprintf (stream, ")");
+ }
+ break;
+ }
+ fprintf (stream, "\n");
+
+ if (element->stmt)
+ {
+ fprintf (stream, " ");
+ print_gimple_stmt (stream, element->stmt, 0, 0);
+ }
+}
+
+/* Delete an expr_hash_elt and reclaim its storage. */
+
+static void
+free_expr_hash_elt (void *elt)
+{
+ struct expr_hash_elt *element = ((struct expr_hash_elt *)elt);
+
+ if (element->expr.kind == EXPR_CALL)
+ free (element->expr.ops.call.args);
+
+ free (element);
+}
+
/* Allocate an EDGE_INFO for edge E and attach it to E.
Return the new EDGE_INFO structure. */
@@ -247,10 +630,10 @@ tree_ssa_dominator_optimize (void)
memset (&opt_stats, 0, sizeof (opt_stats));
/* Create our hash tables. */
- avail_exprs = htab_create (1024, real_avail_expr_hash, avail_expr_eq, free);
- avail_exprs_stack = VEC_alloc (tree, heap, 20);
+ avail_exprs = htab_create (1024, real_avail_expr_hash, avail_expr_eq, free_expr_hash_elt);
+ avail_exprs_stack = VEC_alloc (expr_hash_elt_t, heap, 20);
const_and_copies_stack = VEC_alloc (tree, heap, 20);
- stmts_to_rescan = VEC_alloc (tree_p, heap, 20);
+ stmts_to_rescan = VEC_alloc (gimple_p, heap, 20);
need_eh_cleanup = BITMAP_ALLOC (NULL);
/* Setup callbacks for the generic dominator tree walker. */
@@ -291,12 +674,11 @@ tree_ssa_dominator_optimize (void)
walk_dominator_tree (&walk_data, ENTRY_BLOCK_PTR);
{
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
basic_block bb;
FOR_EACH_BB (bb)
- {
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
- update_stmt_if_modified (bsi_stmt (bsi));
+ {for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ update_stmt_if_modified (gsi_stmt (gsi));
}
}
@@ -336,7 +718,7 @@ tree_ssa_dominator_optimize (void)
}
}
- tree_purge_all_dead_eh_edges (need_eh_cleanup);
+ gimple_purge_all_dead_eh_edges (need_eh_cleanup);
bitmap_zero (need_eh_cleanup);
}
@@ -379,9 +761,10 @@ tree_ssa_dominator_optimize (void)
/* Free asserted bitmaps and stacks. */
BITMAP_FREE (need_eh_cleanup);
- VEC_free (tree, heap, avail_exprs_stack);
+ VEC_free (expr_hash_elt_t, heap, avail_exprs_stack);
VEC_free (tree, heap, const_and_copies_stack);
- VEC_free (tree_p, heap, stmts_to_rescan);
+ VEC_free (gimple_p, heap, stmts_to_rescan);
+
return 0;
}
@@ -414,22 +797,22 @@ struct gimple_opt_pass pass_dominator =
};
-/* Given a stmt CONDSTMT containing a COND_EXPR, canonicalize the
- COND_EXPR into a canonical form. */
+/* Given a conditional statement CONDSTMT, convert the
+ condition to a canonical form. */
static void
-canonicalize_comparison (tree condstmt)
+canonicalize_comparison (gimple condstmt)
{
- tree cond = COND_EXPR_COND (condstmt);
tree op0;
tree op1;
- enum tree_code code = TREE_CODE (cond);
+ enum tree_code code;
- if (!COMPARISON_CLASS_P (cond))
- return;
+ gcc_assert (gimple_code (condstmt) == GIMPLE_COND);
- op0 = TREE_OPERAND (cond, 0);
- op1 = TREE_OPERAND (cond, 1);
+ op0 = gimple_cond_lhs (condstmt);
+ op1 = gimple_cond_rhs (condstmt);
+
+ code = gimple_cond_code (condstmt);
/* If it would be profitable to swap the operands, then do so to
canonicalize the statement, enabling better optimization.
@@ -446,17 +829,13 @@ canonicalize_comparison (tree condstmt)
|| code == LE_EXPR
|| code == GE_EXPR)
{
- TREE_SET_CODE (cond, swap_tree_comparison (code));
- swap_tree_operands (condstmt,
- &TREE_OPERAND (cond, 0),
- &TREE_OPERAND (cond, 1));
- /* If one operand was in the operand cache, but the other is
- not, because it is a constant, this is a case that the
- internal updating code of swap_tree_operands can't handle
- properly. */
- if (TREE_CODE_CLASS (TREE_CODE (op0))
- != TREE_CODE_CLASS (TREE_CODE (op1)))
- update_stmt (condstmt);
+ code = swap_tree_comparison (code);
+
+ gimple_cond_set_code (condstmt, code);
+ gimple_cond_set_lhs (condstmt, op1);
+ gimple_cond_set_rhs (condstmt, op0);
+
+ update_stmt (condstmt);
}
}
}
@@ -474,7 +853,7 @@ dom_opt_initialize_block (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
/* Push a marker on the stacks of local information so that we know how
far to unwind when we finalize this block. */
- VEC_safe_push (tree, heap, avail_exprs_stack, NULL_TREE);
+ VEC_safe_push (expr_hash_elt_t, heap, avail_exprs_stack, NULL);
VEC_safe_push (tree, heap, const_and_copies_stack, NULL_TREE);
record_equivalences_from_incoming_edge (bb);
@@ -483,52 +862,6 @@ dom_opt_initialize_block (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
record_equivalences_from_phis (bb);
}
-/* Given an expression EXPR (a relational expression or a statement),
- initialize the hash table element pointed to by ELEMENT. */
-
-static void
-initialize_hash_element (tree expr, tree lhs, struct expr_hash_elt *element)
-{
- /* Hash table elements may be based on conditional expressions or statements.
-
- For the former case, we have no annotation and we want to hash the
- conditional expression. In the latter case we have an annotation and
- we want to record the expression the statement evaluates. */
- if (COMPARISON_CLASS_P (expr) || TREE_CODE (expr) == TRUTH_NOT_EXPR)
- {
- element->stmt = NULL;
- element->rhs = expr;
- }
- else if (TREE_CODE (expr) == COND_EXPR)
- {
- element->stmt = expr;
- element->rhs = COND_EXPR_COND (expr);
- }
- else if (TREE_CODE (expr) == SWITCH_EXPR)
- {
- element->stmt = expr;
- element->rhs = SWITCH_COND (expr);
- }
- else if (TREE_CODE (expr) == RETURN_EXPR && TREE_OPERAND (expr, 0))
- {
- element->stmt = expr;
- element->rhs = GIMPLE_STMT_OPERAND (TREE_OPERAND (expr, 0), 1);
- }
- else if (TREE_CODE (expr) == GOTO_EXPR)
- {
- element->stmt = expr;
- element->rhs = GOTO_DESTINATION (expr);
- }
- else
- {
- element->stmt = expr;
- element->rhs = GENERIC_TREE_OPERAND (expr, 1);
- }
-
- element->lhs = lhs;
- element->hash = avail_expr_hash (element);
-}
-
/* Remove all the expressions in LOCALS from TABLE, stopping when there are
LIMIT entries left in LOCALs. */
@@ -536,15 +869,25 @@ static void
remove_local_expressions_from_table (void)
{
/* Remove all the expressions made available in this block. */
- while (VEC_length (tree, avail_exprs_stack) > 0)
+ while (VEC_length (expr_hash_elt_t, avail_exprs_stack) > 0)
{
struct expr_hash_elt element;
- tree expr = VEC_pop (tree, avail_exprs_stack);
+ expr_hash_elt_t victim = VEC_pop (expr_hash_elt_t, avail_exprs_stack);
- if (expr == NULL_TREE)
+ if (victim == NULL)
break;
- initialize_hash_element (expr, NULL, &element);
+ element = *victim;
+
+ /* This must precede the actual removal from the hash table,
+ as ELEMENT and the table entry may share a call argument
+ vector which will be freed during removal. */
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "<<<< ");
+ print_expr_hash_elt (dump_file, &element);
+ }
+
htab_remove_elt_with_hash (avail_exprs, &element, element.hash);
}
}
@@ -565,6 +908,15 @@ restore_vars_to_original_value (void)
if (dest == NULL)
break;
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "<<<< COPY ");
+ print_generic_expr (dump_file, dest, 0);
+ fprintf (dump_file, " = ");
+ print_generic_expr (dump_file, SSA_NAME_VALUE (dest), 0);
+ fprintf (dump_file, "\n");
+ }
+
prev_value = VEC_pop (tree, const_and_copies_stack);
SSA_NAME_VALUE (dest) = prev_value;
}
@@ -573,7 +925,8 @@ restore_vars_to_original_value (void)
/* A trivial wrapper so that we can present the generic jump
threading code with a simple API for simplifying statements. */
static tree
-simplify_stmt_for_jump_threading (tree stmt, tree within_stmt ATTRIBUTE_UNUSED)
+simplify_stmt_for_jump_threading (gimple stmt,
+ gimple within_stmt ATTRIBUTE_UNUSED)
{
return lookup_avail_expr (stmt, false);
}
@@ -585,16 +938,16 @@ simplify_stmt_for_jump_threading (tree stmt, tree within_stmt ATTRIBUTE_UNUSED)
static void
dom_thread_across_edge (struct dom_walk_data *walk_data, edge e)
{
- /* If we don't already have a dummy condition, build it now. */
if (! walk_data->global_data)
- {
- tree dummy_cond = build2 (NE_EXPR, boolean_type_node,
- integer_zero_node, integer_zero_node);
- dummy_cond = build3 (COND_EXPR, void_type_node, dummy_cond, NULL, NULL);
- walk_data->global_data = dummy_cond;
- }
+ {
+ gimple dummy_cond =
+ gimple_build_cond (NE_EXPR,
+ integer_zero_node, integer_zero_node,
+ NULL, NULL);
+ walk_data->global_data = dummy_cond;
+ }
- thread_across_edge ((tree) walk_data->global_data, e, false,
+ thread_across_edge ((gimple) walk_data->global_data, e, false,
&const_and_copies_stack,
simplify_stmt_for_jump_threading);
}
@@ -606,8 +959,7 @@ dom_thread_across_edge (struct dom_walk_data *walk_data, edge e)
static void
dom_opt_finalize_block (struct dom_walk_data *walk_data, basic_block bb)
{
- tree last;
-
+ gimple last;
/* If we have an outgoing edge to a block with multiple incoming and
outgoing edges, then we may be able to thread the edge, i.e., we
@@ -620,9 +972,7 @@ dom_opt_finalize_block (struct dom_walk_data *walk_data, basic_block bb)
dom_thread_across_edge (walk_data, single_succ_edge (bb));
}
else if ((last = last_stmt (bb))
- && TREE_CODE (last) == COND_EXPR
- && (COMPARISON_CLASS_P (COND_EXPR_COND (last))
- || TREE_CODE (COND_EXPR_COND (last)) == SSA_NAME)
+ && gimple_code (last) == GIMPLE_COND
&& EDGE_COUNT (bb->succs) == 2
&& (EDGE_SUCC (bb, 0)->flags & EDGE_ABNORMAL) == 0
&& (EDGE_SUCC (bb, 1)->flags & EDGE_ABNORMAL) == 0)
@@ -641,33 +991,28 @@ dom_opt_finalize_block (struct dom_walk_data *walk_data, basic_block bb)
/* Push a marker onto the available expression stack so that we
unwind any expressions related to the TRUE arm before processing
the false arm below. */
- VEC_safe_push (tree, heap, avail_exprs_stack, NULL_TREE);
+ VEC_safe_push (expr_hash_elt_t, heap, avail_exprs_stack, NULL);
VEC_safe_push (tree, heap, const_and_copies_stack, NULL_TREE);
edge_info = (struct edge_info *) true_edge->aux;
/* If we have info associated with this edge, record it into
- our equivalency tables. */
+ our equivalence tables. */
if (edge_info)
{
- tree *cond_equivalences = edge_info->cond_equivalences;
+ struct cond_equivalence *cond_equivalences = edge_info->cond_equivalences;
tree lhs = edge_info->lhs;
tree rhs = edge_info->rhs;
- /* If we have a simple NAME = VALUE equivalency record it. */
+ /* If we have a simple NAME = VALUE equivalence, record it. */
if (lhs && TREE_CODE (lhs) == SSA_NAME)
record_const_or_copy (lhs, rhs);
/* If we have 0 = COND or 1 = COND equivalences, record them
into our expression hash tables. */
if (cond_equivalences)
- for (i = 0; i < edge_info->max_cond_equivalences; i += 2)
- {
- tree expr = cond_equivalences[i];
- tree value = cond_equivalences[i + 1];
-
- record_cond (expr, value);
- }
+ for (i = 0; i < edge_info->max_cond_equivalences; i++)
+ record_cond (&cond_equivalences[i]);
}
dom_thread_across_edge (walk_data, true_edge);
@@ -687,27 +1032,22 @@ dom_opt_finalize_block (struct dom_walk_data *walk_data, basic_block bb)
edge_info = (struct edge_info *) false_edge->aux;
/* If we have info associated with this edge, record it into
- our equivalency tables. */
+ our equivalence tables. */
if (edge_info)
{
- tree *cond_equivalences = edge_info->cond_equivalences;
+ struct cond_equivalence *cond_equivalences = edge_info->cond_equivalences;
tree lhs = edge_info->lhs;
tree rhs = edge_info->rhs;
- /* If we have a simple NAME = VALUE equivalency record it. */
+ /* If we have a simple NAME = VALUE equivalence, record it. */
if (lhs && TREE_CODE (lhs) == SSA_NAME)
record_const_or_copy (lhs, rhs);
/* If we have 0 = COND or 1 = COND equivalences, record them
into our expression hash tables. */
if (cond_equivalences)
- for (i = 0; i < edge_info->max_cond_equivalences; i += 2)
- {
- tree expr = cond_equivalences[i];
- tree value = cond_equivalences[i + 1];
-
- record_cond (expr, value);
- }
+ for (i = 0; i < edge_info->max_cond_equivalences; i++)
+ record_cond (&cond_equivalences[i]);
}
/* Now thread the edge. */
@@ -724,16 +1064,16 @@ dom_opt_finalize_block (struct dom_walk_data *walk_data, basic_block bb)
/* If we queued any statements to rescan in this block, then
go ahead and rescan them now. */
- while (VEC_length (tree_p, stmts_to_rescan) > 0)
+ while (VEC_length (gimple_p, stmts_to_rescan) > 0)
{
- tree *stmt_p = VEC_last (tree_p, stmts_to_rescan);
- tree stmt = *stmt_p;
- basic_block stmt_bb = bb_for_stmt (stmt);
+ gimple *stmt_p = VEC_last (gimple_p, stmts_to_rescan);
+ gimple stmt = *stmt_p;
+ basic_block stmt_bb = gimple_bb (stmt);
if (stmt_bb != bb)
break;
- VEC_pop (tree_p, stmts_to_rescan);
+ VEC_pop (gimple_p, stmts_to_rescan);
pop_stmt_changes (stmt_p);
}
}
@@ -747,17 +1087,19 @@ dom_opt_finalize_block (struct dom_walk_data *walk_data, basic_block bb)
static void
record_equivalences_from_phis (basic_block bb)
{
- tree phi;
-
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
+ gimple_stmt_iterator gsi;
+
+ for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- tree lhs = PHI_RESULT (phi);
+ gimple phi = gsi_stmt (gsi);
+
+ tree lhs = gimple_phi_result (phi);
tree rhs = NULL;
- int i;
+ size_t i;
- for (i = 0; i < PHI_NUM_ARGS (phi); i++)
+ for (i = 0; i < gimple_phi_num_args (phi); i++)
{
- tree t = PHI_ARG_DEF (phi, i);
+ tree t = gimple_phi_arg_def (phi, i);
/* Ignore alternatives which are the same as our LHS. Since
LHS is a PHI_RESULT, it is known to be a SSA_NAME, so we
@@ -787,8 +1129,7 @@ record_equivalences_from_phis (basic_block bb)
this, since this is a true assignment and not an equivalence
inferred from a comparison. All uses of this ssa name are dominated
by this assignment, so unwinding just costs time and space. */
- if (i == PHI_NUM_ARGS (phi)
- && may_propagate_copy (lhs, rhs))
+ if (i == gimple_phi_num_args (phi) && may_propagate_copy (lhs, rhs))
SSA_NAME_VALUE (lhs) = rhs;
}
}
@@ -851,21 +1192,14 @@ record_equivalences_from_incoming_edge (basic_block bb)
{
tree lhs = edge_info->lhs;
tree rhs = edge_info->rhs;
- tree *cond_equivalences = edge_info->cond_equivalences;
+ struct cond_equivalence *cond_equivalences = edge_info->cond_equivalences;
if (lhs)
record_equality (lhs, rhs);
if (cond_equivalences)
- {
- for (i = 0; i < edge_info->max_cond_equivalences; i += 2)
- {
- tree expr = cond_equivalences[i];
- tree value = cond_equivalences[i + 1];
-
- record_cond (expr, value);
- }
- }
+ for (i = 0; i < edge_info->max_cond_equivalences; i++)
+ record_cond (&cond_equivalences[i]);
}
}
}
@@ -907,38 +1241,56 @@ htab_statistics (FILE *file, htab_t htab)
htab_collisions (htab));
}
-/* Enter a statement into the true/false expression hash table indicating
- that the condition COND has the value VALUE. */
+
+/* Enter condition equivalence into the expression hash table.
+ This indicates that a conditional expression has a known
+ boolean value. */
static void
-record_cond (tree cond, tree value)
+record_cond (struct cond_equivalence *p)
{
struct expr_hash_elt *element = XCNEW (struct expr_hash_elt);
void **slot;
- initialize_hash_element (cond, value, element);
+ initialize_hash_element_from_expr (&p->cond, p->value, element);
slot = htab_find_slot_with_hash (avail_exprs, (void *)element,
element->hash, INSERT);
if (*slot == NULL)
{
*slot = (void *) element;
- VEC_safe_push (tree, heap, avail_exprs_stack, cond);
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "1>>> ");
+ print_expr_hash_elt (dump_file, element);
+ }
+
+ VEC_safe_push (expr_hash_elt_t, heap, avail_exprs_stack, element);
}
else
free (element);
}
-/* Build a new conditional using NEW_CODE, OP0 and OP1 and store
- the new conditional into *p, then store a boolean_true_node
- into *(p + 1). */
+/* Build a cond_equivalence record indicating that the comparison
+ CODE holds between operands OP0 and OP1. */
static void
-build_and_record_new_cond (enum tree_code new_code, tree op0, tree op1, tree *p)
+build_and_record_new_cond (enum tree_code code,
+ tree op0, tree op1,
+ struct cond_equivalence *p)
{
- *p = build2 (new_code, boolean_type_node, op0, op1);
- p++;
- *p = boolean_true_node;
+ struct hashable_expr *cond = &p->cond;
+
+ gcc_assert (TREE_CODE_CLASS (code) == tcc_comparison);
+
+ cond->type = boolean_type_node;
+ cond->kind = EXPR_BINARY;
+ cond->ops.binary.op = code;
+ cond->ops.binary.opnd0 = op0;
+ cond->ops.binary.opnd1 = op1;
+
+ p->value = boolean_true_node;
}
/* Record that COND is true and INVERTED is false into the edge information
@@ -964,119 +1316,125 @@ record_conditions (struct edge_info *edge_info, tree cond, tree inverted)
case GT_EXPR:
if (FLOAT_TYPE_P (TREE_TYPE (op0)))
{
- edge_info->max_cond_equivalences = 12;
- edge_info->cond_equivalences = XNEWVEC (tree, 12);
+ edge_info->max_cond_equivalences = 6;
+ edge_info->cond_equivalences = XNEWVEC (struct cond_equivalence, 6);
build_and_record_new_cond (ORDERED_EXPR, op0, op1,
- &edge_info->cond_equivalences[8]);
+ &edge_info->cond_equivalences[4]);
build_and_record_new_cond (LTGT_EXPR, op0, op1,
- &edge_info->cond_equivalences[10]);
+ &edge_info->cond_equivalences[5]);
}
else
- {
- edge_info->max_cond_equivalences = 8;
- edge_info->cond_equivalences = XNEWVEC (tree, 8);
+ {
+ edge_info->max_cond_equivalences = 4;
+ edge_info->cond_equivalences = XNEWVEC (struct cond_equivalence, 4);
}
build_and_record_new_cond ((TREE_CODE (cond) == LT_EXPR
? LE_EXPR : GE_EXPR),
- op0, op1, &edge_info->cond_equivalences[4]);
+ op0, op1, &edge_info->cond_equivalences[2]);
build_and_record_new_cond (NE_EXPR, op0, op1,
- &edge_info->cond_equivalences[6]);
+ &edge_info->cond_equivalences[3]);
break;
case GE_EXPR:
case LE_EXPR:
if (FLOAT_TYPE_P (TREE_TYPE (op0)))
{
- edge_info->max_cond_equivalences = 6;
- edge_info->cond_equivalences = XNEWVEC (tree, 6);
+ edge_info->max_cond_equivalences = 3;
+ edge_info->cond_equivalences = XNEWVEC (struct cond_equivalence, 3);
build_and_record_new_cond (ORDERED_EXPR, op0, op1,
- &edge_info->cond_equivalences[4]);
+ &edge_info->cond_equivalences[2]);
}
else
{
- edge_info->max_cond_equivalences = 4;
- edge_info->cond_equivalences = XNEWVEC (tree, 4);
+ edge_info->max_cond_equivalences = 2;
+ edge_info->cond_equivalences = XNEWVEC (struct cond_equivalence, 2);
}
break;
case EQ_EXPR:
if (FLOAT_TYPE_P (TREE_TYPE (op0)))
{
- edge_info->max_cond_equivalences = 10;
- edge_info->cond_equivalences = XNEWVEC (tree, 10);
+ edge_info->max_cond_equivalences = 5;
+ edge_info->cond_equivalences = XNEWVEC (struct cond_equivalence, 5);
build_and_record_new_cond (ORDERED_EXPR, op0, op1,
- &edge_info->cond_equivalences[8]);
+ &edge_info->cond_equivalences[4]);
}
else
{
- edge_info->max_cond_equivalences = 8;
- edge_info->cond_equivalences = XNEWVEC (tree, 8);
+ edge_info->max_cond_equivalences = 4;
+ edge_info->cond_equivalences = XNEWVEC (struct cond_equivalence, 4);
}
build_and_record_new_cond (LE_EXPR, op0, op1,
- &edge_info->cond_equivalences[4]);
+ &edge_info->cond_equivalences[2]);
build_and_record_new_cond (GE_EXPR, op0, op1,
- &edge_info->cond_equivalences[6]);
+ &edge_info->cond_equivalences[3]);
break;
case UNORDERED_EXPR:
- edge_info->max_cond_equivalences = 16;
- edge_info->cond_equivalences = XNEWVEC (tree, 16);
+ edge_info->max_cond_equivalences = 8;
+ edge_info->cond_equivalences = XNEWVEC (struct cond_equivalence, 8);
build_and_record_new_cond (NE_EXPR, op0, op1,
- &edge_info->cond_equivalences[4]);
+ &edge_info->cond_equivalences[2]);
build_and_record_new_cond (UNLE_EXPR, op0, op1,
- &edge_info->cond_equivalences[6]);
+ &edge_info->cond_equivalences[3]);
build_and_record_new_cond (UNGE_EXPR, op0, op1,
- &edge_info->cond_equivalences[8]);
+ &edge_info->cond_equivalences[4]);
build_and_record_new_cond (UNEQ_EXPR, op0, op1,
- &edge_info->cond_equivalences[10]);
+ &edge_info->cond_equivalences[5]);
build_and_record_new_cond (UNLT_EXPR, op0, op1,
- &edge_info->cond_equivalences[12]);
+ &edge_info->cond_equivalences[6]);
build_and_record_new_cond (UNGT_EXPR, op0, op1,
- &edge_info->cond_equivalences[14]);
+ &edge_info->cond_equivalences[7]);
break;
case UNLT_EXPR:
case UNGT_EXPR:
- edge_info->max_cond_equivalences = 8;
- edge_info->cond_equivalences = XNEWVEC (tree, 8);
+ edge_info->max_cond_equivalences = 4;
+ edge_info->cond_equivalences = XNEWVEC (struct cond_equivalence, 4);
build_and_record_new_cond ((TREE_CODE (cond) == UNLT_EXPR
? UNLE_EXPR : UNGE_EXPR),
- op0, op1, &edge_info->cond_equivalences[4]);
+ op0, op1, &edge_info->cond_equivalences[2]);
build_and_record_new_cond (NE_EXPR, op0, op1,
- &edge_info->cond_equivalences[6]);
+ &edge_info->cond_equivalences[3]);
break;
case UNEQ_EXPR:
- edge_info->max_cond_equivalences = 8;
- edge_info->cond_equivalences = XNEWVEC (tree, 8);
+ edge_info->max_cond_equivalences = 4;
+ edge_info->cond_equivalences = XNEWVEC (struct cond_equivalence, 4);
build_and_record_new_cond (UNLE_EXPR, op0, op1,
- &edge_info->cond_equivalences[4]);
+ &edge_info->cond_equivalences[2]);
build_and_record_new_cond (UNGE_EXPR, op0, op1,
- &edge_info->cond_equivalences[6]);
+ &edge_info->cond_equivalences[3]);
break;
case LTGT_EXPR:
- edge_info->max_cond_equivalences = 8;
- edge_info->cond_equivalences = XNEWVEC (tree, 8);
+ edge_info->max_cond_equivalences = 4;
+ edge_info->cond_equivalences = XNEWVEC (struct cond_equivalence, 4);
build_and_record_new_cond (NE_EXPR, op0, op1,
- &edge_info->cond_equivalences[4]);
+ &edge_info->cond_equivalences[2]);
build_and_record_new_cond (ORDERED_EXPR, op0, op1,
- &edge_info->cond_equivalences[6]);
+ &edge_info->cond_equivalences[3]);
break;
default:
- edge_info->max_cond_equivalences = 4;
- edge_info->cond_equivalences = XNEWVEC (tree, 4);
+ edge_info->max_cond_equivalences = 2;
+ edge_info->cond_equivalences = XNEWVEC (struct cond_equivalence, 2);
break;
}
/* Now store the original true and false conditions into the first
two slots. */
- edge_info->cond_equivalences[0] = cond;
- edge_info->cond_equivalences[1] = boolean_true_node;
- edge_info->cond_equivalences[2] = inverted;
- edge_info->cond_equivalences[3] = boolean_false_node;
+ initialize_expr_from_cond (cond, &edge_info->cond_equivalences[0].cond);
+ edge_info->cond_equivalences[0].value = boolean_true_node;
+
+ /* It is possible for INVERTED to be the negation of a comparison,
+ and not a valid RHS or GIMPLE_COND condition. This happens because
+ invert_truthvalue may return such an expression when asked to invert
+ a floating-point comparison. These comparisons are not assumed to
+ obey the trichotomy law. */
+ initialize_expr_from_cond (inverted, &edge_info->cond_equivalences[1].cond);
+ edge_info->cond_equivalences[1].value = boolean_false_node;
}
/* A helper function for record_const_or_copy and record_equality.
@@ -1087,12 +1445,20 @@ record_const_or_copy_1 (tree x, tree y, tree prev_x)
{
SSA_NAME_VALUE (x) = y;
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "0>>> COPY ");
+ print_generic_expr (dump_file, x, 0);
+ fprintf (dump_file, " = ");
+ print_generic_expr (dump_file, y, 0);
+ fprintf (dump_file, "\n");
+ }
+
VEC_reserve (tree, heap, const_and_copies_stack, 2);
VEC_quick_push (tree, const_and_copies_stack, prev_x);
VEC_quick_push (tree, const_and_copies_stack, x);
}
-
/* Return the loop depth of the basic block of the defining statement of X.
This number should not be treated as absolutely correct because the loop
information may not be completely up-to-date when dom runs. However, it
@@ -1102,7 +1468,7 @@ record_const_or_copy_1 (tree x, tree y, tree prev_x)
int
loop_depth_of_name (tree x)
{
- tree defstmt;
+ gimple defstmt;
basic_block defbb;
/* If it's not an SSA_NAME, we have no clue where the definition is. */
@@ -1113,14 +1479,13 @@ loop_depth_of_name (tree x)
Note that there may not actually be a bb for this statement, if the
ssa_name is live on entry. */
defstmt = SSA_NAME_DEF_STMT (x);
- defbb = bb_for_stmt (defstmt);
+ defbb = gimple_bb (defstmt);
if (!defbb)
return 0;
return defbb->loop_depth;
}
-
/* Record that X is equal to Y in const_and_copies. Record undo
information in the block-local vector. */
@@ -1129,6 +1494,8 @@ record_const_or_copy (tree x, tree y)
{
tree prev_x = SSA_NAME_VALUE (x);
+ gcc_assert (TREE_CODE (x) == SSA_NAME);
+
if (TREE_CODE (y) == SSA_NAME)
{
tree tmp = SSA_NAME_VALUE (y);
@@ -1189,34 +1556,34 @@ record_equality (tree x, tree y)
i_2 = i_1 +/- ... */
static bool
-simple_iv_increment_p (tree stmt)
+simple_iv_increment_p (gimple stmt)
{
- tree lhs, rhs, preinc, phi;
- unsigned i;
+ tree lhs, preinc;
+ gimple phi;
+ size_t i;
- if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
+ if (gimple_code (stmt) != GIMPLE_ASSIGN)
return false;
- lhs = GIMPLE_STMT_OPERAND (stmt, 0);
+ lhs = gimple_assign_lhs (stmt);
if (TREE_CODE (lhs) != SSA_NAME)
return false;
- rhs = GIMPLE_STMT_OPERAND (stmt, 1);
-
- if (TREE_CODE (rhs) != PLUS_EXPR
- && TREE_CODE (rhs) != MINUS_EXPR)
+ if (gimple_assign_rhs_code (stmt) != PLUS_EXPR
+ && gimple_assign_rhs_code (stmt) != MINUS_EXPR)
return false;
- preinc = TREE_OPERAND (rhs, 0);
+ preinc = gimple_assign_rhs1 (stmt);
+
if (TREE_CODE (preinc) != SSA_NAME)
return false;
phi = SSA_NAME_DEF_STMT (preinc);
- if (TREE_CODE (phi) != PHI_NODE)
+ if (gimple_code (phi) != GIMPLE_PHI)
return false;
- for (i = 0; i < (unsigned) PHI_NUM_ARGS (phi); i++)
- if (PHI_ARG_DEF (phi, i) == lhs)
+ for (i = 0; i < gimple_phi_num_args (phi); i++)
+ if (gimple_phi_arg_def (phi, i) == lhs)
return true;
return false;
@@ -1236,29 +1603,30 @@ cprop_into_successor_phis (basic_block bb)
FOR_EACH_EDGE (e, ei, bb->succs)
{
- tree phi;
int indx;
+ gimple_stmt_iterator gsi;
/* If this is an abnormal edge, then we do not want to copy propagate
into the PHI alternative associated with this edge. */
if (e->flags & EDGE_ABNORMAL)
continue;
- phi = phi_nodes (e->dest);
- if (! phi)
+ gsi = gsi_start_phis (e->dest);
+ if (gsi_end_p (gsi))
continue;
indx = e->dest_idx;
- for ( ; phi; phi = PHI_CHAIN (phi))
+ for ( ; !gsi_end_p (gsi); gsi_next (&gsi))
{
tree new_val;
use_operand_p orig_p;
tree orig_val;
+ gimple phi = gsi_stmt (gsi);
/* The alternative may be associated with a constant, so verify
it is an SSA_NAME before doing anything with it. */
- orig_p = PHI_ARG_DEF_PTR (phi, indx);
- orig_val = USE_FROM_PTR (orig_p);
+ orig_p = gimple_phi_arg_imm_use_ptr (phi, indx);
+ orig_val = get_use_from_ptr (orig_p);
if (TREE_CODE (orig_val) != SSA_NAME)
continue;
@@ -1281,30 +1649,29 @@ cprop_into_successor_phis (basic_block bb)
static void
record_edge_info (basic_block bb)
{
- block_stmt_iterator bsi = bsi_last (bb);
+ gimple_stmt_iterator gsi = gsi_last_bb (bb);
struct edge_info *edge_info;
- if (! bsi_end_p (bsi))
+ if (! gsi_end_p (gsi))
{
- tree stmt = bsi_stmt (bsi);
+ gimple stmt = gsi_stmt (gsi);
- if (stmt && TREE_CODE (stmt) == SWITCH_EXPR)
+ if (gimple_code (stmt) == GIMPLE_SWITCH)
{
- tree cond = SWITCH_COND (stmt);
+ tree index = gimple_switch_index (stmt);
- if (TREE_CODE (cond) == SSA_NAME)
+ if (TREE_CODE (index) == SSA_NAME)
{
- tree labels = SWITCH_LABELS (stmt);
- int i, n_labels = TREE_VEC_LENGTH (labels);
+ int i;
+ int n_labels = gimple_switch_num_labels (stmt);
tree *info = XCNEWVEC (tree, last_basic_block);
edge e;
edge_iterator ei;
for (i = 0; i < n_labels; i++)
{
- tree label = TREE_VEC_ELT (labels, i);
+ tree label = gimple_switch_label (stmt, i);
basic_block target_bb = label_to_block (CASE_LABEL (label));
-
if (CASE_HIGH (label)
|| !CASE_LOW (label)
|| info[target_bb->index])
@@ -1316,13 +1683,13 @@ record_edge_info (basic_block bb)
FOR_EACH_EDGE (e, ei, bb->succs)
{
basic_block target_bb = e->dest;
- tree node = info[target_bb->index];
+ tree label = info[target_bb->index];
- if (node != NULL && node != error_mark_node)
+ if (label != NULL && label != error_mark_node)
{
- tree x = fold_convert (TREE_TYPE (cond), CASE_LOW (node));
+ tree x = fold_convert (TREE_TYPE (index), CASE_LOW (label));
edge_info = allocate_edge_info (e);
- edge_info->lhs = cond;
+ edge_info->lhs = index;
edge_info->rhs = x;
}
}
@@ -1331,133 +1698,116 @@ record_edge_info (basic_block bb)
}
/* A COND_EXPR may create equivalences too. */
- if (stmt && TREE_CODE (stmt) == COND_EXPR)
+ if (gimple_code (stmt) == GIMPLE_COND)
{
- tree cond = COND_EXPR_COND (stmt);
edge true_edge;
edge false_edge;
- extract_true_false_edges_from_block (bb, &true_edge, &false_edge);
-
- /* If the conditional is a single variable 'X', record 'X = 1'
- for the true edge and 'X = 0' on the false edge. */
- if (SSA_VAR_P (cond))
- {
- struct edge_info *edge_info;
-
- edge_info = allocate_edge_info (true_edge);
- edge_info->lhs = cond;
- edge_info->rhs = constant_boolean_node (1, TREE_TYPE (cond));
-
- edge_info = allocate_edge_info (false_edge);
- edge_info->lhs = cond;
- edge_info->rhs = constant_boolean_node (0, TREE_TYPE (cond));
- }
- /* Equality tests may create one or two equivalences. */
- else if (COMPARISON_CLASS_P (cond))
- {
- tree op0 = TREE_OPERAND (cond, 0);
- tree op1 = TREE_OPERAND (cond, 1);
-
- /* Special case comparing booleans against a constant as we
- know the value of OP0 on both arms of the branch, i.e., we
- can record an equivalence for OP0 rather than COND. */
- if ((TREE_CODE (cond) == EQ_EXPR || TREE_CODE (cond) == NE_EXPR)
- && TREE_CODE (op0) == SSA_NAME
- && TREE_CODE (TREE_TYPE (op0)) == BOOLEAN_TYPE
- && is_gimple_min_invariant (op1))
- {
- if (TREE_CODE (cond) == EQ_EXPR)
- {
- edge_info = allocate_edge_info (true_edge);
- edge_info->lhs = op0;
- edge_info->rhs = (integer_zerop (op1)
- ? boolean_false_node
- : boolean_true_node);
-
- edge_info = allocate_edge_info (false_edge);
- edge_info->lhs = op0;
- edge_info->rhs = (integer_zerop (op1)
- ? boolean_true_node
- : boolean_false_node);
- }
- else
- {
- edge_info = allocate_edge_info (true_edge);
- edge_info->lhs = op0;
- edge_info->rhs = (integer_zerop (op1)
- ? boolean_true_node
- : boolean_false_node);
-
- edge_info = allocate_edge_info (false_edge);
- edge_info->lhs = op0;
- edge_info->rhs = (integer_zerop (op1)
- ? boolean_false_node
- : boolean_true_node);
- }
- }
-
- else if (is_gimple_min_invariant (op0)
- && (TREE_CODE (op1) == SSA_NAME
- || is_gimple_min_invariant (op1)))
- {
- tree inverted = invert_truthvalue (cond);
- struct edge_info *edge_info;
-
- edge_info = allocate_edge_info (true_edge);
- record_conditions (edge_info, cond, inverted);
-
- if (TREE_CODE (cond) == EQ_EXPR)
- {
- edge_info->lhs = op1;
- edge_info->rhs = op0;
- }
-
- edge_info = allocate_edge_info (false_edge);
- record_conditions (edge_info, inverted, cond);
-
- if (TREE_CODE (cond) == NE_EXPR)
- {
- edge_info->lhs = op1;
- edge_info->rhs = op0;
- }
- }
-
- else if (TREE_CODE (op0) == SSA_NAME
- && (is_gimple_min_invariant (op1)
- || TREE_CODE (op1) == SSA_NAME))
- {
- tree inverted = invert_truthvalue (cond);
- struct edge_info *edge_info;
-
- edge_info = allocate_edge_info (true_edge);
- record_conditions (edge_info, cond, inverted);
-
- if (TREE_CODE (cond) == EQ_EXPR)
- {
- edge_info->lhs = op0;
- edge_info->rhs = op1;
- }
-
- edge_info = allocate_edge_info (false_edge);
- record_conditions (edge_info, inverted, cond);
+ tree op0 = gimple_cond_lhs (stmt);
+ tree op1 = gimple_cond_rhs (stmt);
+ enum tree_code code = gimple_cond_code (stmt);
- if (TREE_CODE (cond) == NE_EXPR)
- {
- edge_info->lhs = op0;
- edge_info->rhs = op1;
- }
- }
- }
+ extract_true_false_edges_from_block (bb, &true_edge, &false_edge);
- /* ??? TRUTH_NOT_EXPR can create an equivalence too. */
- }
+ /* Special case comparing booleans against a constant as we
+ know the value of OP0 on both arms of the branch. i.e., we
+ can record an equivalence for OP0 rather than COND. */
+ if ((code == EQ_EXPR || code == NE_EXPR)
+ && TREE_CODE (op0) == SSA_NAME
+ && TREE_CODE (TREE_TYPE (op0)) == BOOLEAN_TYPE
+ && is_gimple_min_invariant (op1))
+ {
+ if (code == EQ_EXPR)
+ {
+ edge_info = allocate_edge_info (true_edge);
+ edge_info->lhs = op0;
+ edge_info->rhs = (integer_zerop (op1)
+ ? boolean_false_node
+ : boolean_true_node);
+
+ edge_info = allocate_edge_info (false_edge);
+ edge_info->lhs = op0;
+ edge_info->rhs = (integer_zerop (op1)
+ ? boolean_true_node
+ : boolean_false_node);
+ }
+ else
+ {
+ edge_info = allocate_edge_info (true_edge);
+ edge_info->lhs = op0;
+ edge_info->rhs = (integer_zerop (op1)
+ ? boolean_true_node
+ : boolean_false_node);
+
+ edge_info = allocate_edge_info (false_edge);
+ edge_info->lhs = op0;
+ edge_info->rhs = (integer_zerop (op1)
+ ? boolean_false_node
+ : boolean_true_node);
+ }
+ }
+ else if (is_gimple_min_invariant (op0)
+ && (TREE_CODE (op1) == SSA_NAME
+ || is_gimple_min_invariant (op1)))
+ {
+ tree cond = build2 (code, boolean_type_node, op0, op1);
+ tree inverted = invert_truthvalue (cond);
+ struct edge_info *edge_info;
+
+ edge_info = allocate_edge_info (true_edge);
+ record_conditions (edge_info, cond, inverted);
+
+ if (code == EQ_EXPR)
+ {
+ edge_info->lhs = op1;
+ edge_info->rhs = op0;
+ }
+
+ edge_info = allocate_edge_info (false_edge);
+ record_conditions (edge_info, inverted, cond);
+
+ if (code == NE_EXPR)
+ {
+ edge_info->lhs = op1;
+ edge_info->rhs = op0;
+ }
+ }
+
+ else if (TREE_CODE (op0) == SSA_NAME
+ && (is_gimple_min_invariant (op1)
+ || TREE_CODE (op1) == SSA_NAME))
+ {
+ tree cond = build2 (code, boolean_type_node, op0, op1);
+ tree inverted = invert_truthvalue (cond);
+ struct edge_info *edge_info;
+
+ edge_info = allocate_edge_info (true_edge);
+ record_conditions (edge_info, cond, inverted);
+
+ if (code == EQ_EXPR)
+ {
+ edge_info->lhs = op0;
+ edge_info->rhs = op1;
+ }
+
+ edge_info = allocate_edge_info (false_edge);
+ record_conditions (edge_info, inverted, cond);
+
+ if (TREE_CODE (cond) == NE_EXPR)
+ {
+ edge_info->lhs = op0;
+ edge_info->rhs = op1;
+ }
+ }
+ }
+
+ /* ??? TRUTH_NOT_EXPR can create an equivalence too. */
}
}
/* Propagate information from BB to its outgoing edges.
- This can include equivalency information implied by control statements
+ This can include equivalence information implied by control statements
at the end of BB and const/copy propagation into PHIs in BB's
successor blocks. */
@@ -1476,16 +1826,17 @@ propagate_to_outgoing_edges (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
table. */
static bool
-eliminate_redundant_computations (tree stmt)
+eliminate_redundant_computations (gimple_stmt_iterator* gsi)
{
- tree *expr_p, def = NULL_TREE;
- bool insert = true;
+ tree expr_type;
tree cached_lhs;
+ bool insert = true;
bool retval = false;
- bool modify_expr_p = false;
+ bool assigns_var_p = false;
- if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT)
- def = GIMPLE_STMT_OPERAND (stmt, 0);
+ gimple stmt = gsi_stmt (*gsi);
+
+ tree def = gimple_get_lhs (stmt);
/* Certain expressions on the RHS can be optimized away, but can not
themselves be entered into the hash tables. */
@@ -1503,80 +1854,117 @@ eliminate_redundant_computations (tree stmt)
opt_stats.num_exprs_considered++;
- /* Get a pointer to the expression we are trying to optimize. */
- if (TREE_CODE (stmt) == COND_EXPR)
- expr_p = &COND_EXPR_COND (stmt);
- else if (TREE_CODE (stmt) == SWITCH_EXPR)
- expr_p = &SWITCH_COND (stmt);
- else if (TREE_CODE (stmt) == RETURN_EXPR && TREE_OPERAND (stmt, 0))
+ /* Get the type of the expression we are trying to optimize. */
+ if (is_gimple_assign (stmt))
{
- expr_p = &GIMPLE_STMT_OPERAND (TREE_OPERAND (stmt, 0), 1);
- modify_expr_p = true;
+ expr_type = TREE_TYPE (gimple_assign_lhs (stmt));
+ assigns_var_p = true;
}
- else
+ else if (gimple_code (stmt) == GIMPLE_COND)
+ expr_type = boolean_type_node;
+ else if (is_gimple_call (stmt))
{
- expr_p = &GENERIC_TREE_OPERAND (stmt, 1);
- modify_expr_p = true;
+ gcc_assert (gimple_call_lhs (stmt));
+ expr_type = TREE_TYPE (gimple_call_lhs (stmt));
+ assigns_var_p = true;
}
+ else if (gimple_code (stmt) == GIMPLE_SWITCH)
+ expr_type = TREE_TYPE (gimple_switch_index (stmt));
+ else
+ gcc_unreachable ();
+
+ if (!cached_lhs)
+ return false;
/* It is safe to ignore types here since we have already done
type checking in the hashing and equality routines. In fact
type checking here merely gets in the way of constant
propagation. Also, make sure that it is safe to propagate
- CACHED_LHS into *EXPR_P. */
- if (cached_lhs
- && ((TREE_CODE (cached_lhs) != SSA_NAME
- && (modify_expr_p
- || useless_type_conversion_p (TREE_TYPE (*expr_p),
- TREE_TYPE (cached_lhs))))
- || may_propagate_copy (*expr_p, cached_lhs)))
- {
+ CACHED_LHS into the expression in STMT. */
+ if ((TREE_CODE (cached_lhs) != SSA_NAME
+ && (assigns_var_p
+ || useless_type_conversion_p (expr_type, TREE_TYPE (cached_lhs))))
+ || may_propagate_copy_into_stmt (stmt, cached_lhs))
+ {
+#if defined ENABLE_CHECKING
+ gcc_assert (TREE_CODE (cached_lhs) == SSA_NAME
+ || is_gimple_min_invariant (cached_lhs));
+#endif
+
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, " Replaced redundant expr '");
- print_generic_expr (dump_file, *expr_p, dump_flags);
+ print_gimple_expr (dump_file, stmt, 0, dump_flags);
fprintf (dump_file, "' with '");
print_generic_expr (dump_file, cached_lhs, dump_flags);
- fprintf (dump_file, "'\n");
+ fprintf (dump_file, "'\n");
}
opt_stats.num_re++;
-#if defined ENABLE_CHECKING
- gcc_assert (TREE_CODE (cached_lhs) == SSA_NAME
- || is_gimple_min_invariant (cached_lhs));
-#endif
-
if (TREE_CODE (cached_lhs) == ADDR_EXPR
- || (POINTER_TYPE_P (TREE_TYPE (*expr_p))
+ || (POINTER_TYPE_P (expr_type)
&& is_gimple_min_invariant (cached_lhs)))
retval = true;
- if (modify_expr_p
- && !useless_type_conversion_p (TREE_TYPE (*expr_p),
- TREE_TYPE (cached_lhs)))
- cached_lhs = fold_convert (TREE_TYPE (*expr_p), cached_lhs);
+ if (assigns_var_p
+ && !useless_type_conversion_p (expr_type, TREE_TYPE (cached_lhs)))
+ cached_lhs = fold_convert (expr_type, cached_lhs);
- propagate_tree_value (expr_p, cached_lhs);
- mark_stmt_modified (stmt);
- }
+ propagate_tree_value_into_stmt (gsi, cached_lhs);
+
+ /* Since it is always necessary to mark the result as modified,
+ perhaps we should move this into propagate_tree_value_into_stmt
+ itself. */
+ gimple_set_modified (gsi_stmt (*gsi), true);
+ }
return retval;
}
-/* STMT, a GIMPLE_MODIFY_STMT, may create certain equivalences, in either
+/* Return true if statement GS is an assignment that peforms a useless
+ type conversion. It is is intended to be a tuples analog of function
+ tree_ssa_useless_type_conversion. */
+
+static bool
+gimple_assign_unary_useless_conversion_p (gimple gs)
+{
+ if (is_gimple_assign (gs)
+ && (gimple_assign_rhs_code (gs) == NOP_EXPR
+ || gimple_assign_rhs_code (gs) == CONVERT_EXPR
+ || gimple_assign_rhs_code (gs) == VIEW_CONVERT_EXPR
+ || gimple_assign_rhs_code (gs) == NON_LVALUE_EXPR))
+ {
+ tree lhs_type = TREE_TYPE (gimple_assign_lhs (gs));
+ tree rhs_type = TREE_TYPE (gimple_assign_rhs1 (gs));
+ return useless_type_conversion_p (lhs_type, rhs_type);
+ }
+
+ return false;
+}
+
+/* STMT, a GIMPLE_ASSIGN, may create certain equivalences, in either
the available expressions table or the const_and_copies table.
Detect and record those equivalences. */
+/* We handle only very simple copy equivalences here. The heavy
+ lifing is done by eliminate_redundant_computations. */
static void
-record_equivalences_from_stmt (tree stmt, int may_optimize_p, stmt_ann_t ann)
+record_equivalences_from_stmt (gimple stmt, int may_optimize_p)
{
- tree lhs = GIMPLE_STMT_OPERAND (stmt, 0);
- enum tree_code lhs_code = TREE_CODE (lhs);
+ tree lhs;
+ enum tree_code lhs_code;
- if (lhs_code == SSA_NAME)
- {
- tree rhs = GIMPLE_STMT_OPERAND (stmt, 1);
+ gcc_assert (is_gimple_assign (stmt));
+
+ lhs = gimple_assign_lhs (stmt);
+ lhs_code = TREE_CODE (lhs);
+ if (lhs_code == SSA_NAME
+ && (gimple_assign_single_p (stmt)
+ || gimple_assign_unary_useless_conversion_p (stmt)))
+ {
+ tree rhs = gimple_assign_rhs1 (stmt);
+
/* Strip away any useless type conversions. */
STRIP_USELESS_TYPE_CONVERSION (rhs);
@@ -1589,24 +1977,53 @@ record_equivalences_from_stmt (tree stmt, int may_optimize_p, stmt_ann_t ann)
if (may_optimize_p
&& (TREE_CODE (rhs) == SSA_NAME
|| is_gimple_min_invariant (rhs)))
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "==== ASGN ");
+ print_generic_expr (dump_file, lhs, 0);
+ fprintf (dump_file, " = ");
+ print_generic_expr (dump_file, rhs, 0);
+ fprintf (dump_file, "\n");
+ }
+
SSA_NAME_VALUE (lhs) = rhs;
+ }
}
/* A memory store, even an aliased store, creates a useful
equivalence. By exchanging the LHS and RHS, creating suitable
vops and recording the result in the available expression table,
we may be able to expose more redundant loads. */
- if (!ann->has_volatile_ops
- && stmt_references_memory_p (stmt)
- && (TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 1)) == SSA_NAME
- || is_gimple_min_invariant (GIMPLE_STMT_OPERAND (stmt, 1)))
+ if (!gimple_has_volatile_ops (stmt)
+ && gimple_references_memory_p (stmt)
+ && gimple_assign_single_p (stmt)
+ && (TREE_CODE (gimple_assign_rhs1 (stmt)) == SSA_NAME
+ || is_gimple_min_invariant (gimple_assign_rhs1 (stmt)))
&& !is_gimple_reg (lhs))
{
- tree rhs = GIMPLE_STMT_OPERAND (stmt, 1);
- tree new_stmt;
+ tree rhs = gimple_assign_rhs1 (stmt);
+ gimple new_stmt;
/* Build a new statement with the RHS and LHS exchanged. */
- new_stmt = build_gimple_modify_stmt (rhs, lhs);
+ if (TREE_CODE (rhs) == SSA_NAME)
+ {
+ /* NOTE tuples. The call to gimple_build_assign below replaced
+ a call to build_gimple_modify_stmt, which did not set the
+ SSA_NAME_DEF_STMT on the LHS of the assignment. Doing so
+ may cause an SSA validation failure, as the LHS may be a
+ default-initialized name and should have no definition. I'm
+ a bit dubious of this, as the artificial statement that we
+ generate here may in fact be ill-formed, but it is simply
+ used as an internal device in this pass, and never becomes
+ part of the CFG. */
+ gimple defstmt = SSA_NAME_DEF_STMT (rhs);
+ new_stmt = gimple_build_assign (rhs, lhs);
+ SSA_NAME_DEF_STMT (rhs) = defstmt;
+ }
+ else
+ new_stmt = gimple_build_assign (rhs, lhs);
+
create_ssa_artificial_load_stmt (new_stmt, stmt, true);
/* Finally enter the statement into the available expression
@@ -1619,7 +2036,7 @@ record_equivalences_from_stmt (tree stmt, int may_optimize_p, stmt_ann_t ann)
CONST_AND_COPIES. */
static bool
-cprop_operand (tree stmt, use_operand_p op_p)
+cprop_operand (gimple stmt, use_operand_p op_p)
{
bool may_have_exposed_new_symbols = false;
tree val;
@@ -1645,7 +2062,7 @@ cprop_operand (tree stmt, use_operand_p op_p)
return false;
/* Do not replace hard register operands in asm statements. */
- if (TREE_CODE (stmt) == ASM_EXPR
+ if (gimple_code (stmt) == GIMPLE_ASM
&& !may_propagate_copy_into_asm (op))
return false;
@@ -1717,7 +2134,7 @@ cprop_operand (tree stmt, use_operand_p op_p)
/* And note that we modified this statement. This is now
safe, even if we changed virtual operands since we will
rescan the statement and rewrite its operands again. */
- mark_stmt_modified (stmt);
+ gimple_set_modified (stmt, true);
}
return may_have_exposed_new_symbols;
}
@@ -1729,7 +2146,7 @@ cprop_operand (tree stmt, use_operand_p op_p)
vdef_ops of STMT. */
static bool
-cprop_into_stmt (tree stmt)
+cprop_into_stmt (gimple stmt)
{
bool may_have_exposed_new_symbols = false;
use_operand_p op_p;
@@ -1744,7 +2161,6 @@ cprop_into_stmt (tree stmt)
return may_have_exposed_new_symbols;
}
-
/* Optimize the statement pointed to by iterator SI.
We try to perform some simplistic global redundancy elimination and
@@ -1762,28 +2178,26 @@ cprop_into_stmt (tree stmt)
static void
optimize_stmt (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
- basic_block bb, block_stmt_iterator si)
+ basic_block bb, gimple_stmt_iterator si)
{
- stmt_ann_t ann;
- tree stmt, old_stmt;
+ gimple stmt, old_stmt;
bool may_optimize_p;
bool may_have_exposed_new_symbols = false;
- old_stmt = stmt = bsi_stmt (si);
+ old_stmt = stmt = gsi_stmt (si);
- if (TREE_CODE (stmt) == COND_EXPR)
+ if (gimple_code (stmt) == GIMPLE_COND)
canonicalize_comparison (stmt);
update_stmt_if_modified (stmt);
- ann = stmt_ann (stmt);
opt_stats.num_stmts++;
may_have_exposed_new_symbols = false;
- push_stmt_changes (bsi_stmt_ptr (si));
+ push_stmt_changes (gsi_stmt_ptr (&si));
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Optimizing statement ");
- print_generic_stmt (dump_file, stmt, TDF_SLIM);
+ print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM);
}
/* Const/copy propagate into USES, VUSES and the RHS of VDEFs. */
@@ -1791,27 +2205,34 @@ optimize_stmt (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
/* If the statement has been modified with constant replacements,
fold its RHS before checking for redundant computations. */
- if (ann->modified)
+ if (gimple_modified_p (stmt))
{
- tree rhs;
+ tree rhs = NULL;
/* Try to fold the statement making sure that STMT is kept
up to date. */
- if (fold_stmt (bsi_stmt_ptr (si)))
+ if (fold_stmt (&si))
{
- stmt = bsi_stmt (si);
- ann = stmt_ann (stmt);
+ stmt = gsi_stmt (si);
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, " Folded to: ");
- print_generic_stmt (dump_file, stmt, TDF_SLIM);
+ print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM);
}
}
- rhs = get_rhs (stmt);
+ /* We only need to consider cases that can yield a gimple operand. */
+ if (gimple_assign_single_p (stmt))
+ rhs = gimple_assign_rhs1 (stmt);
+ else if (gimple_code (stmt) == GIMPLE_GOTO)
+ rhs = gimple_goto_dest (stmt);
+ else if (gimple_code (stmt) == GIMPLE_SWITCH)
+ /* This should never be an ADDR_EXPR. */
+ rhs = gimple_switch_index (stmt);
+
if (rhs && TREE_CODE (rhs) == ADDR_EXPR)
- recompute_tree_invariant_for_addr_expr (rhs);
+ recompute_tree_invariant_for_addr_expr (rhs);
/* Constant/copy propagation above may change the set of
virtual operands associated with this statement. Folding
@@ -1823,26 +2244,24 @@ optimize_stmt (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
/* Check for redundant computations. Do this optimization only
for assignments that have no volatile ops and conditionals. */
- may_optimize_p = (!ann->has_volatile_ops
- && ((TREE_CODE (stmt) == RETURN_EXPR
- && TREE_OPERAND (stmt, 0)
- && TREE_CODE (TREE_OPERAND (stmt, 0))
- == GIMPLE_MODIFY_STMT
- && ! (TREE_SIDE_EFFECTS
- (GIMPLE_STMT_OPERAND
- (TREE_OPERAND (stmt, 0), 1))))
- || (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
- && ! TREE_SIDE_EFFECTS (GIMPLE_STMT_OPERAND (stmt,
- 1)))
- || TREE_CODE (stmt) == COND_EXPR
- || TREE_CODE (stmt) == SWITCH_EXPR));
+ may_optimize_p = (!gimple_has_volatile_ops (stmt)
+ && ((is_gimple_assign (stmt)
+ && !gimple_rhs_has_side_effects (stmt))
+ || (is_gimple_call (stmt)
+ && gimple_call_lhs (stmt) != NULL_TREE
+ && !gimple_rhs_has_side_effects (stmt))
+ || gimple_code (stmt) == GIMPLE_COND
+ || gimple_code (stmt) == GIMPLE_SWITCH));
if (may_optimize_p)
- may_have_exposed_new_symbols |= eliminate_redundant_computations (stmt);
+ {
+ may_have_exposed_new_symbols |= eliminate_redundant_computations (&si);
+ stmt = gsi_stmt (si);
+ }
/* Record any additional equivalences created by this statement. */
- if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT)
- record_equivalences_from_stmt (stmt, may_optimize_p, ann);
+ if (is_gimple_assign (stmt))
+ record_equivalences_from_stmt (stmt, may_optimize_p);
/* If STMT is a COND_EXPR and it was modified, then we may know
where it goes. If that is the case, then mark the CFG as altered.
@@ -1869,14 +2288,15 @@ optimize_stmt (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
Ultimately I suspect we're going to need to change the interface
into the SSA_NAME manager. */
- if (ann->modified)
+ if (gimple_modified_p (stmt))
{
tree val = NULL;
- if (TREE_CODE (stmt) == COND_EXPR)
- val = COND_EXPR_COND (stmt);
- else if (TREE_CODE (stmt) == SWITCH_EXPR)
- val = SWITCH_COND (stmt);
+ if (gimple_code (stmt) == GIMPLE_COND)
+ val = fold_binary (gimple_cond_code (stmt), boolean_type_node,
+ gimple_cond_lhs (stmt), gimple_cond_rhs (stmt));
+ else if (gimple_code (stmt) == GIMPLE_SWITCH)
+ val = gimple_switch_index (stmt);
if (val && TREE_CODE (val) == INTEGER_CST && find_taken_edge (bb, val))
cfg_altered = true;
@@ -1897,47 +2317,50 @@ optimize_stmt (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
AVAIL_EXPRS have been processed. The change buffer stack for
all the pushed statements will be processed when this queue
is emptied. */
- VEC_safe_push (tree_p, heap, stmts_to_rescan, bsi_stmt_ptr (si));
+ VEC_safe_push (gimple_p, heap, stmts_to_rescan, gsi_stmt_ptr (&si));
}
else
{
/* Otherwise, just discard the recently pushed change buffer. If
not, the STMTS_TO_RESCAN queue will get out of synch with the
change buffer stack. */
- discard_stmt_changes (bsi_stmt_ptr (si));
+ discard_stmt_changes (gsi_stmt_ptr (&si));
}
}
-/* Search for an existing instance of STMT in the AVAIL_EXPRS table. If
- found, return its LHS. Otherwise insert STMT in the table and return
- NULL_TREE.
+/* Search for an existing instance of STMT in the AVAIL_EXPRS table.
+ If found, return its LHS. Otherwise insert STMT in the table and
+ return NULL_TREE.
- Also, when an expression is first inserted in the AVAIL_EXPRS table, it
- is also added to the stack pointed to by BLOCK_AVAIL_EXPRS_P, so that they
- can be removed when we finish processing this block and its children.
-
- NOTE: This function assumes that STMT is a GIMPLE_MODIFY_STMT node that
- contains no CALL_EXPR on its RHS and makes no volatile nor
- aliased references. */
+ Also, when an expression is first inserted in the table, it is also
+ is also added to AVAIL_EXPRS_STACK, so that it can be removed when
+ we finish processing this block and its children. */
static tree
-lookup_avail_expr (tree stmt, bool insert)
+lookup_avail_expr (gimple stmt, bool insert)
{
void **slot;
tree lhs;
tree temp;
struct expr_hash_elt *element = XNEW (struct expr_hash_elt);
- lhs = TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
- ? GIMPLE_STMT_OPERAND (stmt, 0) : NULL;
+ /* Get LHS of assignment or call, else NULL_TREE. */
+ lhs = gimple_get_lhs (stmt);
initialize_hash_element (stmt, lhs, element);
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "LKUP ");
+ print_expr_hash_elt (dump_file, element);
+ }
+
/* Don't bother remembering constant assignments and copy operations.
Constants and copy operations are handled by the constant/copy propagator
in optimize_stmt. */
- if (TREE_CODE (element->rhs) == SSA_NAME
- || is_gimple_min_invariant (element->rhs))
+ if (element->expr.kind == EXPR_SINGLE
+ && (TREE_CODE (element->expr.ops.single.rhs) == SSA_NAME
+ || is_gimple_min_invariant (element->expr.ops.single.rhs)))
{
free (element);
return NULL_TREE;
@@ -1949,14 +2372,20 @@ lookup_avail_expr (tree stmt, bool insert)
if (slot == NULL)
{
free (element);
- return NULL_TREE;
+ return NULL_TREE;
}
if (*slot == NULL)
{
*slot = (void *) element;
- VEC_safe_push (tree, heap, avail_exprs_stack,
- stmt ? stmt : element->rhs);
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "2>>> ");
+ print_expr_hash_elt (dump_file, element);
+ }
+
+ VEC_safe_push (expr_hash_elt_t, heap, avail_exprs_stack, element);
return NULL_TREE;
}
@@ -1974,31 +2403,36 @@ lookup_avail_expr (tree stmt, bool insert)
}
free (element);
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "FIND: ");
+ print_generic_expr (dump_file, lhs, 0);
+ fprintf (dump_file, "\n");
+ }
+
return lhs;
}
-/* Hashing and equality functions for AVAIL_EXPRS. The table stores
- GIMPLE_MODIFY_STMT statements. We compute a value number for expressions
- using the code of the expression and the SSA numbers of its operands. */
+/* Hashing and equality functions for AVAIL_EXPRS. We compute a value number
+ for expressions using the code of the expression and the SSA numbers of
+ its operands. */
static hashval_t
avail_expr_hash (const void *p)
{
- tree stmt = ((const struct expr_hash_elt *)p)->stmt;
- tree rhs = ((const struct expr_hash_elt *)p)->rhs;
+ gimple stmt = ((const struct expr_hash_elt *)p)->stmt;
+ const struct hashable_expr *expr = &((const struct expr_hash_elt *)p)->expr;
tree vuse;
ssa_op_iter iter;
hashval_t val = 0;
- /* iterative_hash_expr knows how to deal with any expression and
- deals with commutative operators as well, so just use it instead
- of duplicating such complexities here. */
- val = iterative_hash_expr (rhs, val);
+ val = iterative_hash_hashable_expr (expr, val);
/* If the hash table entry is not associated with a statement, then we
can just hash the expression and not worry about virtual operands
and such. */
- if (!stmt || !stmt_ann (stmt))
+ if (!stmt)
return val;
/* Add the SSA version numbers of every vuse operand. This is important
@@ -2020,27 +2454,34 @@ real_avail_expr_hash (const void *p)
static int
avail_expr_eq (const void *p1, const void *p2)
{
- tree stmt1 = ((const struct expr_hash_elt *)p1)->stmt;
- tree rhs1 = ((const struct expr_hash_elt *)p1)->rhs;
- tree stmt2 = ((const struct expr_hash_elt *)p2)->stmt;
- tree rhs2 = ((const struct expr_hash_elt *)p2)->rhs;
-
- /* If they are the same physical expression, return true. */
- if (rhs1 == rhs2 && stmt1 == stmt2)
+ gimple stmt1 = ((const struct expr_hash_elt *)p1)->stmt;
+ const struct hashable_expr *expr1 = &((const struct expr_hash_elt *)p1)->expr;
+ const struct expr_hash_elt *stamp1 = ((const struct expr_hash_elt *)p1)->stamp;
+ gimple stmt2 = ((const struct expr_hash_elt *)p2)->stmt;
+ const struct hashable_expr *expr2 = &((const struct expr_hash_elt *)p2)->expr;
+ const struct expr_hash_elt *stamp2 = ((const struct expr_hash_elt *)p2)->stamp;
+
+ /* This case should apply only when removing entries from the table. */
+ if (stamp1 == stamp2)
return true;
- /* If their codes are not equal, then quit now. */
- if (TREE_CODE (rhs1) != TREE_CODE (rhs2))
+ /* FIXME tuples:
+ We add stmts to a hash table and them modify them. To detect the case
+ that we modify a stmt and then search for it, we assume that the hash
+ is always modified by that change.
+ We have to fully check why this doesn't happen on trunk or rewrite
+ this in a more reliable (and easier to understand) way. */
+ if (((const struct expr_hash_elt *)p1)->hash
+ != ((const struct expr_hash_elt *)p2)->hash)
return false;
/* In case of a collision, both RHS have to be identical and have the
same VUSE operands. */
- if (types_compatible_p (TREE_TYPE (rhs1), TREE_TYPE (rhs2))
- && operand_equal_p (rhs1, rhs2, OEP_PURE_SAME))
+ if (hashable_expr_equal_p (expr1, expr2)
+ && types_compatible_p (expr1->type, expr2->type))
{
+ /* Note that STMT1 and/or STMT2 may be NULL. */
bool ret = compare_ssa_operands_equal (stmt1, stmt2, SSA_OP_VUSE);
- gcc_assert (!ret || ((const struct expr_hash_elt *)p1)->hash
- == ((const struct expr_hash_elt *)p2)->hash);
return ret;
}
@@ -2054,18 +2495,18 @@ avail_expr_eq (const void *p1, const void *p2)
NULL. */
static tree
-degenerate_phi_result (tree phi)
+degenerate_phi_result (gimple phi)
{
- tree lhs = PHI_RESULT (phi);
+ tree lhs = gimple_phi_result (phi);
tree val = NULL;
- int i;
+ size_t i;
/* Ignoring arguments which are the same as LHS, if all the remaining
arguments are the same, then the PHI is a degenerate and has the
value of that common argument. */
- for (i = 0; i < PHI_NUM_ARGS (phi); i++)
+ for (i = 0; i < gimple_phi_num_args (phi); i++)
{
- tree arg = PHI_ARG_DEF (phi, i);
+ tree arg = gimple_phi_arg_def (phi, i);
if (arg == lhs)
continue;
@@ -2074,51 +2515,54 @@ degenerate_phi_result (tree phi)
else if (!operand_equal_p (arg, val, 0))
break;
}
- return (i == PHI_NUM_ARGS (phi) ? val : NULL);
+ return (i == gimple_phi_num_args (phi) ? val : NULL);
}
-/* Given a tree node T, which is either a PHI_NODE or GIMPLE_MODIFY_STMT,
+/* Given a statement STMT, which is either a PHI node or an assignment,
remove it from the IL. */
static void
-remove_stmt_or_phi (tree t)
+remove_stmt_or_phi (gimple stmt)
{
- if (TREE_CODE (t) == PHI_NODE)
- remove_phi_node (t, NULL, true);
+ gimple_stmt_iterator gsi = gsi_for_stmt (stmt);
+
+ if (gimple_code (stmt) == GIMPLE_PHI)
+ remove_phi_node (&gsi, true);
else
{
- block_stmt_iterator bsi = bsi_for_stmt (t);
- bsi_remove (&bsi, true);
- release_defs (t);
+ gsi_remove (&gsi, true);
+ release_defs (stmt);
}
}
-/* Given a tree node T, which is either a PHI_NODE or GIMPLE_MODIFY_STMT,
+/* Given a statement STMT, which is either a PHI node or an assignment,
return the "rhs" of the node, in the case of a non-degenerate
- PHI, NULL is returned. */
+ phi, NULL is returned. */
static tree
-get_rhs_or_phi_arg (tree t)
+get_rhs_or_phi_arg (gimple stmt)
{
- if (TREE_CODE (t) == PHI_NODE)
- return degenerate_phi_result (t);
- else if (TREE_CODE (t) == GIMPLE_MODIFY_STMT)
- return GIMPLE_STMT_OPERAND (t, 1);
- gcc_unreachable ();
+ if (gimple_code (stmt) == GIMPLE_PHI)
+ return degenerate_phi_result (stmt);
+ else if (gimple_assign_single_p (stmt))
+ return gimple_assign_rhs1 (stmt);
+ else
+ gcc_unreachable ();
}
-/* Given a tree node T, which is either a PHI_NODE or a GIMPLE_MODIFY_STMT,
+/* Given a statement STMT, which is either a PHI node or an assignment,
return the "lhs" of the node. */
static tree
-get_lhs_or_phi_result (tree t)
+get_lhs_or_phi_result (gimple stmt)
{
- if (TREE_CODE (t) == PHI_NODE)
- return PHI_RESULT (t);
- else if (TREE_CODE (t) == GIMPLE_MODIFY_STMT)
- return GIMPLE_STMT_OPERAND (t, 0);
- gcc_unreachable ();
+ if (gimple_code (stmt) == GIMPLE_PHI)
+ return gimple_phi_result (stmt);
+ else if (is_gimple_assign (stmt))
+ return gimple_assign_lhs (stmt);
+ else
+ gcc_unreachable ();
}
/* Propagate RHS into all uses of LHS (when possible).
@@ -2133,7 +2577,7 @@ get_lhs_or_phi_result (tree t)
opportunities. */
static void
-propagate_rhs_into_lhs (tree stmt, tree lhs, tree rhs, bitmap interesting_names)
+propagate_rhs_into_lhs (gimple stmt, tree lhs, tree rhs, bitmap interesting_names)
{
/* First verify that propagation is valid and isn't going to move a
loop variant variable outside its loop. */
@@ -2145,7 +2589,7 @@ propagate_rhs_into_lhs (tree stmt, tree lhs, tree rhs, bitmap interesting_names)
{
use_operand_p use_p;
imm_use_iterator iter;
- tree use_stmt;
+ gimple use_stmt;
bool all = true;
/* Dump details. */
@@ -2166,8 +2610,8 @@ propagate_rhs_into_lhs (tree stmt, tree lhs, tree rhs, bitmap interesting_names)
{
/* It's not always safe to propagate into an ASM_EXPR. */
- if (TREE_CODE (use_stmt) == ASM_EXPR
- && ! may_propagate_copy_into_asm (lhs))
+ if (gimple_code (use_stmt) == GIMPLE_ASM
+ && ! may_propagate_copy_into_asm (lhs))
{
all = false;
continue;
@@ -2177,8 +2621,7 @@ propagate_rhs_into_lhs (tree stmt, tree lhs, tree rhs, bitmap interesting_names)
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, " Original statement:");
- print_generic_expr (dump_file, use_stmt, dump_flags);
- fprintf (dump_file, "\n");
+ print_gimple_stmt (dump_file, use_stmt, 0, dump_flags);
}
push_stmt_changes (&use_stmt);
@@ -2197,7 +2640,7 @@ propagate_rhs_into_lhs (tree stmt, tree lhs, tree rhs, bitmap interesting_names)
Second, if we're propagating a virtual operand and the
propagation does not change the underlying _DECL node for
the virtual operand, then no further actions are necessary. */
- if (TREE_CODE (use_stmt) == PHI_NODE
+ if (gimple_code (use_stmt) == GIMPLE_PHI
|| (! is_gimple_reg (lhs)
&& TREE_CODE (rhs) == SSA_NAME
&& SSA_NAME_VAR (lhs) == SSA_NAME_VAR (rhs)))
@@ -2206,13 +2649,12 @@ propagate_rhs_into_lhs (tree stmt, tree lhs, tree rhs, bitmap interesting_names)
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, " Updated statement:");
- print_generic_expr (dump_file, use_stmt, dump_flags);
- fprintf (dump_file, "\n");
+ print_gimple_stmt (dump_file, use_stmt, 0, dump_flags);
}
/* Propagation into a PHI may expose new degenerate PHIs,
so mark the result of the PHI as interesting. */
- if (TREE_CODE (use_stmt) == PHI_NODE)
+ if (gimple_code (use_stmt) == GIMPLE_PHI)
{
tree result = get_lhs_or_phi_result (use_stmt);
bitmap_set_bit (interesting_names, SSA_NAME_VERSION (result));
@@ -2226,6 +2668,12 @@ propagate_rhs_into_lhs (tree stmt, tree lhs, tree rhs, bitmap interesting_names)
real statement. Folding may (or may not) be possible,
we may expose new operands, expose dead EH edges,
etc. */
+ /* NOTE tuples. In the tuples world, fold_stmt_inplace
+ cannot fold a call that simplifies to a constant,
+ because the GIMPLE_CALL must be replaced by a
+ GIMPLE_ASSIGN, and there is no way to effect such a
+ transformation in-place. We might want to consider
+ using the more general fold_stmt here. */
fold_stmt_inplace (use_stmt);
/* Sometimes propagation can expose new operands to the
@@ -2237,34 +2685,32 @@ propagate_rhs_into_lhs (tree stmt, tree lhs, tree rhs, bitmap interesting_names)
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, " Updated statement:");
- print_generic_expr (dump_file, use_stmt, dump_flags);
- fprintf (dump_file, "\n");
+ print_gimple_stmt (dump_file, use_stmt, 0, dump_flags);
}
/* If we replaced a variable index with a constant, then
we would need to update the invariant flag for ADDR_EXPRs. */
- if (TREE_CODE (use_stmt) == GIMPLE_MODIFY_STMT
- && TREE_CODE (GIMPLE_STMT_OPERAND (use_stmt, 1)) == ADDR_EXPR)
+ if (gimple_assign_single_p (use_stmt)
+ && TREE_CODE (gimple_assign_rhs1 (use_stmt)) == ADDR_EXPR)
recompute_tree_invariant_for_addr_expr
- (GIMPLE_STMT_OPERAND (use_stmt, 1));
+ (gimple_assign_rhs1 (use_stmt));
/* If we cleaned up EH information from the statement,
mark its containing block as needing EH cleanups. */
if (maybe_clean_or_replace_eh_stmt (use_stmt, use_stmt))
{
- bitmap_set_bit (need_eh_cleanup, bb_for_stmt (use_stmt)->index);
+ bitmap_set_bit (need_eh_cleanup, gimple_bb (use_stmt)->index);
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, " Flagged to clear EH edges.\n");
}
/* Propagation may expose new trivial copy/constant propagation
opportunities. */
- if (TREE_CODE (use_stmt) == GIMPLE_MODIFY_STMT
- && TREE_CODE (GIMPLE_STMT_OPERAND (use_stmt, 0)) == SSA_NAME
- && (TREE_CODE (GIMPLE_STMT_OPERAND (use_stmt, 1)) == SSA_NAME
- || is_gimple_min_invariant (GIMPLE_STMT_OPERAND (use_stmt,
- 1))))
- {
+ if (gimple_assign_single_p (use_stmt)
+ && TREE_CODE (gimple_assign_lhs (use_stmt)) == SSA_NAME
+ && (TREE_CODE (gimple_assign_rhs1 (use_stmt)) == SSA_NAME
+ || is_gimple_min_invariant (gimple_assign_rhs1 (use_stmt))))
+ {
tree result = get_lhs_or_phi_result (use_stmt);
bitmap_set_bit (interesting_names, SSA_NAME_VERSION (result));
}
@@ -2273,41 +2719,44 @@ propagate_rhs_into_lhs (tree stmt, tree lhs, tree rhs, bitmap interesting_names)
the CFG unexecutable. We want to identify them as PHI nodes
at the destination of those unexecutable edges may become
degenerates. */
- else if (TREE_CODE (use_stmt) == COND_EXPR
- || TREE_CODE (use_stmt) == SWITCH_EXPR
- || TREE_CODE (use_stmt) == GOTO_EXPR)
- {
+ else if (gimple_code (use_stmt) == GIMPLE_COND
+ || gimple_code (use_stmt) == GIMPLE_SWITCH
+ || gimple_code (use_stmt) == GIMPLE_GOTO)
+ {
tree val;
- if (TREE_CODE (use_stmt) == COND_EXPR)
- val = COND_EXPR_COND (use_stmt);
- else if (TREE_CODE (use_stmt) == SWITCH_EXPR)
- val = SWITCH_COND (use_stmt);
+ if (gimple_code (use_stmt) == GIMPLE_COND)
+ val = fold_binary (gimple_cond_code (use_stmt),
+ boolean_type_node,
+ gimple_cond_lhs (use_stmt),
+ gimple_cond_rhs (use_stmt));
+ else if (gimple_code (use_stmt) == GIMPLE_SWITCH)
+ val = gimple_switch_index (use_stmt);
else
- val = GOTO_DESTINATION (use_stmt);
+ val = gimple_goto_dest (use_stmt);
- if (is_gimple_min_invariant (val))
+ if (val && is_gimple_min_invariant (val))
{
- basic_block bb = bb_for_stmt (use_stmt);
+ basic_block bb = gimple_bb (use_stmt);
edge te = find_taken_edge (bb, val);
edge_iterator ei;
edge e;
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi, psi;
/* Remove all outgoing edges except TE. */
for (ei = ei_start (bb->succs); (e = ei_safe_edge (ei));)
{
if (e != te)
{
- tree phi;
-
/* Mark all the PHI nodes at the destination of
the unexecutable edge as interesting. */
- for (phi = phi_nodes (e->dest);
- phi;
- phi = PHI_CHAIN (phi))
- {
- tree result = PHI_RESULT (phi);
+ for (psi = gsi_start_phis (e->dest);
+ !gsi_end_p (psi);
+ gsi_next (&psi))
+ {
+ gimple phi = gsi_stmt (psi);
+
+ tree result = gimple_phi_result (phi);
int version = SSA_NAME_VERSION (result);
bitmap_set_bit (interesting_names, version);
@@ -2323,8 +2772,8 @@ propagate_rhs_into_lhs (tree stmt, tree lhs, tree rhs, bitmap interesting_names)
ei_next (&ei);
}
- bsi = bsi_last (bb_for_stmt (use_stmt));
- bsi_remove (&bsi, true);
+ gsi = gsi_last_bb (gimple_bb (use_stmt));
+ gsi_remove (&gsi, true);
/* And fixup the flags on the single remaining edge. */
te->flags &= ~(EDGE_TRUE_VALUE | EDGE_FALSE_VALUE);
@@ -2346,7 +2795,7 @@ propagate_rhs_into_lhs (tree stmt, tree lhs, tree rhs, bitmap interesting_names)
}
}
-/* T is either a PHI node (potentially a degenerate PHI node) or
+/* STMT is either a PHI node (potentially a degenerate PHI node) or
a statement that is a trivial copy or constant initialization.
Attempt to eliminate T by propagating its RHS into all uses of
@@ -2354,12 +2803,12 @@ propagate_rhs_into_lhs (tree stmt, tree lhs, tree rhs, bitmap interesting_names)
for nodes we want to revisit later.
All exit paths should clear INTERESTING_NAMES for the result
- of T. */
+ of STMT. */
static void
-eliminate_const_or_copy (tree t, bitmap interesting_names)
+eliminate_const_or_copy (gimple stmt, bitmap interesting_names)
{
- tree lhs = get_lhs_or_phi_result (t);
+ tree lhs = get_lhs_or_phi_result (stmt);
tree rhs;
int version = SSA_NAME_VERSION (lhs);
@@ -2371,22 +2820,22 @@ eliminate_const_or_copy (tree t, bitmap interesting_names)
if (has_zero_uses (lhs))
{
bitmap_clear_bit (interesting_names, version);
- remove_stmt_or_phi (t);
+ remove_stmt_or_phi (stmt);
return;
}
/* Get the RHS of the assignment or PHI node if the PHI is a
degenerate. */
- rhs = get_rhs_or_phi_arg (t);
+ rhs = get_rhs_or_phi_arg (stmt);
if (!rhs)
{
bitmap_clear_bit (interesting_names, version);
return;
}
- propagate_rhs_into_lhs (t, lhs, rhs, interesting_names);
+ propagate_rhs_into_lhs (stmt, lhs, rhs, interesting_names);
- /* Note that T may well have been deleted by now, so do
+ /* Note that STMT may well have been deleted by now, so do
not access it, instead use the saved version # to clear
T's entry in the worklist. */
bitmap_clear_bit (interesting_names, version);
@@ -2400,12 +2849,13 @@ eliminate_const_or_copy (tree t, bitmap interesting_names)
static void
eliminate_degenerate_phis_1 (basic_block bb, bitmap interesting_names)
{
- tree phi, next;
+ gimple_stmt_iterator gsi;
basic_block son;
- for (phi = phi_nodes (bb); phi; phi = next)
+ for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- next = PHI_CHAIN (phi);
+ gimple phi = gsi_stmt (gsi);
+
eliminate_const_or_copy (phi, interesting_names);
}
@@ -2512,7 +2962,7 @@ eliminate_degenerate_phis (void)
such edges from the CFG as needed. */
if (!bitmap_empty_p (need_eh_cleanup))
{
- tree_purge_all_dead_eh_edges (need_eh_cleanup);
+ gimple_purge_all_dead_eh_edges (need_eh_cleanup);
BITMAP_FREE (need_eh_cleanup);
}
diff --git a/gcc/tree-ssa-dse.c b/gcc/tree-ssa-dse.c
index 2f7e9238ab1..b4be5142e01 100644
--- a/gcc/tree-ssa-dse.c
+++ b/gcc/tree-ssa-dse.c
@@ -63,7 +63,7 @@ along with GCC; see the file COPYING3. If not see
relationship between dead store and redundant load elimination. In
fact, they are the same transformation applied to different views of
the CFG. */
-
+
struct dse_global_data
{
@@ -97,7 +97,7 @@ static void dse_initialize_block_local_data (struct dom_walk_data *,
bool);
static void dse_optimize_stmt (struct dom_walk_data *,
basic_block,
- block_stmt_iterator);
+ gimple_stmt_iterator);
static void dse_record_phis (struct dom_walk_data *, basic_block);
static void dse_finalize_block (struct dom_walk_data *, basic_block);
static void record_voperand_set (bitmap, bitmap *, unsigned int);
@@ -105,12 +105,13 @@ static void record_voperand_set (bitmap, bitmap *, unsigned int);
/* Returns uid of statement STMT. */
static unsigned
-get_stmt_uid (tree stmt)
+get_stmt_uid (gimple stmt)
{
- if (TREE_CODE (stmt) == PHI_NODE)
- return SSA_NAME_VERSION (PHI_RESULT (stmt)) + gimple_stmt_max_uid (cfun);
+ if (gimple_code (stmt) == GIMPLE_PHI)
+ return SSA_NAME_VERSION (gimple_phi_result (stmt))
+ + gimple_stmt_max_uid (cfun);
- return gimple_stmt_uid (stmt);
+ return gimple_uid (stmt);
}
/* Set bit UID in bitmaps GLOBAL and *LOCAL, creating *LOCAL as needed. */
@@ -162,7 +163,7 @@ memory_ssa_name_same (tree *expr_p, int *walk_subtrees ATTRIBUTE_UNUSED,
{
struct address_walk_data *walk_data = (struct address_walk_data *) data;
tree expr = *expr_p;
- tree def_stmt;
+ gimple def_stmt;
basic_block def_bb;
if (TREE_CODE (expr) != SSA_NAME)
@@ -174,7 +175,7 @@ memory_ssa_name_same (tree *expr_p, int *walk_subtrees ATTRIBUTE_UNUSED,
return NULL_TREE;
def_stmt = SSA_NAME_DEF_STMT (expr);
- def_bb = bb_for_stmt (def_stmt);
+ def_bb = gimple_bb (def_stmt);
/* DEF_STMT must dominate both stores. So if it is in the same
basic block as one, it does not post-dominate that store. */
@@ -185,7 +186,7 @@ memory_ssa_name_same (tree *expr_p, int *walk_subtrees ATTRIBUTE_UNUSED,
|| !dominated_by_p (CDI_POST_DOMINATORS, walk_data->store2_bb,
def_bb))
/* Return non-NULL to stop the walk. */
- return def_stmt;
+ return *expr_p;
}
return NULL_TREE;
@@ -195,14 +196,14 @@ memory_ssa_name_same (tree *expr_p, int *walk_subtrees ATTRIBUTE_UNUSED,
might be modified after STORE1, before control reaches STORE2. */
static bool
-memory_address_same (tree store1, tree store2)
+memory_address_same (gimple store1, gimple store2)
{
struct address_walk_data walk_data;
- walk_data.store1_bb = bb_for_stmt (store1);
- walk_data.store2_bb = bb_for_stmt (store2);
+ walk_data.store1_bb = gimple_bb (store1);
+ walk_data.store2_bb = gimple_bb (store2);
- return (walk_tree (&GIMPLE_STMT_OPERAND (store1, 0), memory_ssa_name_same,
+ return (walk_tree (gimple_assign_lhs_ptr (store1), memory_ssa_name_same,
&walk_data, NULL)
== NULL);
}
@@ -214,15 +215,15 @@ memory_address_same (tree store1, tree store2)
STMT. *USE_P is set to the vop killed by *USE_STMT. */
static bool
-get_kill_of_stmt_lhs (tree stmt,
+get_kill_of_stmt_lhs (gimple stmt,
use_operand_p * first_use_p,
- use_operand_p * use_p, tree * use_stmt)
+ use_operand_p * use_p, gimple * use_stmt)
{
tree lhs;
- gcc_assert (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT);
+ gcc_assert (is_gimple_assign (stmt));
- lhs = GIMPLE_STMT_OPERAND (stmt, 0);
+ lhs = gimple_assign_lhs (stmt);
/* We now walk the chain of single uses of the single VDEFs.
We succeeded finding a kill if the lhs of the use stmt is
@@ -231,7 +232,7 @@ get_kill_of_stmt_lhs (tree stmt,
the stmt. */
do
{
- tree use_lhs, use_rhs;
+ tree use_lhs;
def_operand_p def_p;
/* The stmt must have a single VDEF. */
@@ -245,17 +246,14 @@ get_kill_of_stmt_lhs (tree stmt,
first_use_p = use_p;
/* If there are possible hidden uses, give up. */
- if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
- return false;
- use_rhs = GIMPLE_STMT_OPERAND (stmt, 1);
- if (TREE_CODE (use_rhs) == CALL_EXPR
- || (!is_gimple_min_invariant (use_rhs)
- && TREE_CODE (use_rhs) != SSA_NAME))
+ if (!gimple_assign_single_p (stmt)
+ || (TREE_CODE (gimple_assign_rhs1 (stmt)) != SSA_NAME
+ && !is_gimple_min_invariant (gimple_assign_rhs1 (stmt))))
return false;
/* If the use stmts lhs matches the original lhs we have
found the kill, otherwise continue walking. */
- use_lhs = GIMPLE_STMT_OPERAND (stmt, 0);
+ use_lhs = gimple_assign_lhs (stmt);
if (operand_equal_p (use_lhs, lhs, 0))
{
*use_stmt = stmt;
@@ -266,16 +264,16 @@ get_kill_of_stmt_lhs (tree stmt,
}
/* A helper of dse_optimize_stmt.
- Given a GIMPLE_MODIFY_STMT in STMT, check that each VDEF has one
+ Given a GIMPLE_ASSIGN in STMT, check that each VDEF has one
use, and that one use is another VDEF clobbering the first one.
Return TRUE if the above conditions are met, otherwise FALSE. */
static bool
-dse_possible_dead_store_p (tree stmt,
+dse_possible_dead_store_p (gimple stmt,
use_operand_p *first_use_p,
use_operand_p *use_p,
- tree *use_stmt,
+ gimple *use_stmt,
struct dse_global_data *dse_gd,
struct dse_block_local_data *bd)
{
@@ -283,8 +281,9 @@ dse_possible_dead_store_p (tree stmt,
bool fail = false;
def_operand_p var1;
vuse_vec_p vv;
- tree defvar = NULL_TREE, temp;
+ tree defvar = NULL_TREE;
tree prev_defvar = NULL_TREE;
+ gimple temp;
/* We want to verify that each virtual definition in STMT has
precisely one use and that all the virtual definitions are
@@ -309,9 +308,9 @@ dse_possible_dead_store_p (tree stmt,
gcc_assert (*use_p != NULL_USE_OPERAND_P);
*first_use_p = *use_p;
- /* ??? If we hit a PHI_NODE we could skip to the PHI_RESULT uses.
+ /* ??? If we hit a GIMPLE_PHI we could skip to the PHI_RESULT uses.
Don't bother to do that for now. */
- if (TREE_CODE (temp) == PHI_NODE)
+ if (gimple_code (temp) == GIMPLE_PHI)
{
fail = true;
break;
@@ -326,10 +325,10 @@ dse_possible_dead_store_p (tree stmt,
So we must make sure we're talking about the same LHS.
*/
- if (TREE_CODE (temp) == GIMPLE_MODIFY_STMT)
+ if (is_gimple_assign (temp))
{
- tree base1 = get_base_address (GIMPLE_STMT_OPERAND (stmt, 0));
- tree base2 = get_base_address (GIMPLE_STMT_OPERAND (temp, 0));
+ tree base1 = get_base_address (gimple_assign_lhs (stmt));
+ tree base2 = get_base_address (gimple_assign_lhs (temp));
while (base1 && INDIRECT_REF_P (base1))
base1 = TREE_OPERAND (base1, 0);
@@ -360,7 +359,7 @@ dse_possible_dead_store_p (tree stmt,
if (fail)
{
- record_voperand_set (dse_gd->stores, &bd->stores, gimple_stmt_uid (stmt));
+ record_voperand_set (dse_gd->stores, &bd->stores, gimple_uid (stmt));
return false;
}
@@ -382,36 +381,35 @@ dse_possible_dead_store_p (tree stmt,
static void
dse_optimize_stmt (struct dom_walk_data *walk_data,
basic_block bb ATTRIBUTE_UNUSED,
- block_stmt_iterator bsi)
+ gimple_stmt_iterator gsi)
{
struct dse_block_local_data *bd
= (struct dse_block_local_data *)
VEC_last (void_p, walk_data->block_data_stack);
struct dse_global_data *dse_gd
= (struct dse_global_data *) walk_data->global_data;
- tree stmt = bsi_stmt (bsi);
- stmt_ann_t ann = stmt_ann (stmt);
+ gimple stmt = gsi_stmt (gsi);
/* If this statement has no virtual defs, then there is nothing
to do. */
if (ZERO_SSA_OPERANDS (stmt, SSA_OP_VDEF))
return;
- /* We know we have virtual definitions. If this is a GIMPLE_MODIFY_STMT
+ /* We know we have virtual definitions. If this is a GIMPLE_ASSIGN
that's not also a function call, then record it into our table. */
- if (get_call_expr_in (stmt))
+ if (is_gimple_call (stmt) && gimple_call_fndecl (stmt))
return;
- if (ann->has_volatile_ops)
+ if (gimple_has_volatile_ops (stmt))
return;
- if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT)
+ if (is_gimple_assign (stmt))
{
use_operand_p first_use_p = NULL_USE_OPERAND_P;
use_operand_p use_p = NULL;
- tree use_stmt;
+ gimple use_stmt;
- if (!dse_possible_dead_store_p (stmt, &first_use_p, &use_p, &use_stmt,
+ if (!dse_possible_dead_store_p (stmt, &first_use_p, &use_p, &use_stmt,
dse_gd, bd))
return;
@@ -421,8 +419,8 @@ dse_optimize_stmt (struct dom_walk_data *walk_data,
SSA-form variables in the address will have the same values. */
if (use_p != NULL_USE_OPERAND_P
&& bitmap_bit_p (dse_gd->stores, get_stmt_uid (use_stmt))
- && !operand_equal_p (GIMPLE_STMT_OPERAND (stmt, 0),
- GIMPLE_STMT_OPERAND (use_stmt, 0), 0)
+ && !operand_equal_p (gimple_assign_lhs (stmt),
+ gimple_assign_lhs (use_stmt), 0)
&& memory_address_same (stmt, use_stmt))
{
/* If we have precisely one immediate use at this point, but
@@ -431,7 +429,8 @@ dse_optimize_stmt (struct dom_walk_data *walk_data,
memory location. */
if (!get_kill_of_stmt_lhs (stmt, &first_use_p, &use_p, &use_stmt))
{
- record_voperand_set (dse_gd->stores, &bd->stores, gimple_stmt_uid (stmt));
+ record_voperand_set (dse_gd->stores, &bd->stores,
+ gimple_uid (stmt));
return;
}
}
@@ -442,8 +441,8 @@ dse_optimize_stmt (struct dom_walk_data *walk_data,
memory location, then we may have found redundant store. */
if (use_p != NULL_USE_OPERAND_P
&& bitmap_bit_p (dse_gd->stores, get_stmt_uid (use_stmt))
- && operand_equal_p (GIMPLE_STMT_OPERAND (stmt, 0),
- GIMPLE_STMT_OPERAND (use_stmt, 0), 0)
+ && operand_equal_p (gimple_assign_lhs (stmt),
+ gimple_assign_lhs (use_stmt), 0)
&& memory_address_same (stmt, use_stmt))
{
ssa_op_iter op_iter;
@@ -462,18 +461,19 @@ dse_optimize_stmt (struct dom_walk_data *walk_data,
*p = *u; *p = *v; where p might be v, then USE_STMT
acts as a use as well as definition, so store in STMT
is not dead. */
- if (LOADED_SYMS (use_stmt)
- && bitmap_intersect_p (LOADED_SYMS (use_stmt),
- STORED_SYMS (use_stmt)))
+ if (gimple_loaded_syms (use_stmt)
+ && bitmap_intersect_p (gimple_loaded_syms (use_stmt),
+ gimple_stored_syms (use_stmt)))
{
- record_voperand_set (dse_gd->stores, &bd->stores, ann->uid);
+ record_voperand_set (dse_gd->stores, &bd->stores,
+ gimple_uid (stmt));
return;
}
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, " Deleted dead store '");
- print_generic_expr (dump_file, bsi_stmt (bsi), dump_flags);
+ print_gimple_stmt (dump_file, gsi_stmt (gsi), dump_flags, 0);
fprintf (dump_file, "'\n");
}
@@ -481,7 +481,8 @@ dse_optimize_stmt (struct dom_walk_data *walk_data,
stmt_lhs = USE_FROM_PTR (first_use_p);
FOR_EACH_SSA_VDEF_OPERAND (var1, vv, stmt, op_iter)
{
- tree usevar, temp;
+ tree usevar;
+ gimple temp;
single_imm_use (DEF_FROM_PTR (var1), &use_p, &temp);
gcc_assert (VUSE_VECT_NUM_ELEM (*vv) == 1);
@@ -494,14 +495,14 @@ dse_optimize_stmt (struct dom_walk_data *walk_data,
}
/* Remove the dead store. */
- bsi_remove (&bsi, true);
+ gsi_remove (&gsi, true);
/* And release any SSA_NAMEs set in this statement back to the
SSA_NAME manager. */
release_defs (stmt);
}
- record_voperand_set (dse_gd->stores, &bd->stores, gimple_stmt_uid (stmt));
+ record_voperand_set (dse_gd->stores, &bd->stores, gimple_uid (stmt));
}
}
@@ -515,13 +516,15 @@ dse_record_phis (struct dom_walk_data *walk_data, basic_block bb)
VEC_last (void_p, walk_data->block_data_stack);
struct dse_global_data *dse_gd
= (struct dse_global_data *) walk_data->global_data;
- tree phi;
+ gimple phi;
+ gimple_stmt_iterator gsi;
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
- if (!is_gimple_reg (PHI_RESULT (phi)))
- record_voperand_set (dse_gd->stores,
- &bd->stores,
- get_stmt_uid (phi));
+ for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ {
+ phi = gsi_stmt (gsi);
+ if (!is_gimple_reg (gimple_phi_result (phi)))
+ record_voperand_set (dse_gd->stores, &bd->stores, get_stmt_uid (phi));
+ }
}
static void
@@ -633,7 +636,7 @@ struct gimple_opt_pass pass_dse =
static unsigned int
execute_simple_dse (void)
{
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
basic_block bb;
bitmap variables_loaded = BITMAP_ALLOC (NULL);
unsigned int todo = 0;
@@ -641,24 +644,29 @@ execute_simple_dse (void)
/* Collect into VARIABLES LOADED all variables that are read in function
body. */
FOR_EACH_BB (bb)
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
- if (LOADED_SYMS (bsi_stmt (bsi)))
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+
+ if (gimple_loaded_syms (gsi_stmt (gsi)))
bitmap_ior_into (variables_loaded,
- LOADED_SYMS (bsi_stmt (bsi)));
+ gimple_loaded_syms (gsi_stmt (gsi)));
/* Look for statements writing into the write only variables.
And try to remove them. */
FOR_EACH_BB (bb)
- for (bsi = bsi_start (bb); !bsi_end_p (bsi);)
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi);)
{
- tree stmt = bsi_stmt (bsi), op;
+ gimple stmt = gsi_stmt (gsi);
+ tree op;
bool removed = false;
ssa_op_iter iter;
- if (STORED_SYMS (stmt) && TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
- && TREE_CODE (stmt) != RETURN_EXPR
- && !bitmap_intersect_p (STORED_SYMS (stmt), variables_loaded))
+ if (gimple_stored_syms (stmt)
+ && !bitmap_empty_p (gimple_stored_syms (stmt))
+ && (is_gimple_assign (stmt)
+ || (is_gimple_call (stmt)
+ && gimple_call_lhs (stmt)))
+ && !bitmap_intersect_p (gimple_stored_syms (stmt), variables_loaded))
{
unsigned int i;
bitmap_iterator bi;
@@ -673,7 +681,7 @@ execute_simple_dse (void)
from removing them as dead. The flag thus has no use for us
and we need to look into all operands. */
- EXECUTE_IF_SET_IN_BITMAP (STORED_SYMS (stmt), 0, i, bi)
+ EXECUTE_IF_SET_IN_BITMAP (gimple_stored_syms (stmt), 0, i, bi)
{
tree var = referenced_var_lookup (i);
if (TREE_ADDRESSABLE (var)
@@ -682,8 +690,8 @@ execute_simple_dse (void)
dead = false;
}
- if (dead && LOADED_SYMS (stmt))
- EXECUTE_IF_SET_IN_BITMAP (LOADED_SYMS (stmt), 0, i, bi)
+ if (dead && gimple_loaded_syms (stmt))
+ EXECUTE_IF_SET_IN_BITMAP (gimple_loaded_syms (stmt), 0, i, bi)
if (TREE_THIS_VOLATILE (referenced_var_lookup (i)))
dead = false;
@@ -695,49 +703,44 @@ execute_simple_dse (void)
/* Look for possible occurrence var = indirect_ref (...) where
indirect_ref itself is volatile. */
- if (dead && TREE_THIS_VOLATILE (GIMPLE_STMT_OPERAND (stmt, 1)))
+ if (dead && is_gimple_assign (stmt)
+ && TREE_THIS_VOLATILE (gimple_assign_rhs1 (stmt)))
dead = false;
if (dead)
{
- tree call = get_call_expr_in (stmt);
-
/* When LHS of var = call (); is dead, simplify it into
call (); saving one operand. */
- if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
- && call
- && TREE_SIDE_EFFECTS (call))
+ if (is_gimple_call (stmt)
+ && gimple_has_side_effects (stmt))
{
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Deleted LHS of call: ");
- print_generic_stmt (dump_file, stmt, TDF_SLIM);
+ print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM);
fprintf (dump_file, "\n");
}
- push_stmt_changes (bsi_stmt_ptr (bsi));
- TREE_BLOCK (call) = TREE_BLOCK (stmt);
- bsi_replace (&bsi, call, false);
- maybe_clean_or_replace_eh_stmt (stmt, call);
- mark_symbols_for_renaming (call);
- pop_stmt_changes (bsi_stmt_ptr (bsi));
+ push_stmt_changes (gsi_stmt_ptr (&gsi));
+ gimple_call_set_lhs (stmt, NULL);
+ pop_stmt_changes (gsi_stmt_ptr (&gsi));
}
else
{
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, " Deleted dead store '");
- print_generic_expr (dump_file, stmt, dump_flags);
+ print_gimple_stmt (dump_file, stmt, 0, dump_flags);
fprintf (dump_file, "'\n");
}
removed = true;
- bsi_remove (&bsi, true);
+ gsi_remove (&gsi, true);
todo |= TODO_cleanup_cfg;
}
todo |= TODO_remove_unused_locals | TODO_ggc_collect;
}
}
if (!removed)
- bsi_next (&bsi);
+ gsi_next (&gsi);
}
BITMAP_FREE (variables_loaded);
return todo;
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
index c49f0a48909..6c5c6cabc46 100644
--- a/gcc/tree-ssa-forwprop.c
+++ b/gcc/tree-ssa-forwprop.c
@@ -33,17 +33,13 @@ along with GCC; see the file COPYING3. If not see
#include "tree-dump.h"
#include "langhooks.h"
#include "flags.h"
+#include "gimple.h"
/* This pass propagates the RHS of assignment statements into use
sites of the LHS of the assignment. It's basically a specialized
form of tree combination. It is hoped all of this can disappear
when we have a generalized tree combiner.
- Note carefully that after propagation the resulting statement
- must still be a proper gimple statement. Right now we simply
- only perform propagations we know will result in valid gimple
- code. One day we'll want to generalize this code.
-
One class of common cases we handle is forward propagating a single use
variable into a COND_EXPR.
@@ -162,6 +158,7 @@ static bool forward_propagate_addr_expr (tree name, tree rhs);
/* Set to true if we delete EH edges during the optimization. */
static bool cfg_changed;
+static tree rhs_to_tree (tree type, gimple stmt);
/* Get the next statement we can propagate NAME's value into skipping
trivial copies. Returns the statement that is suitable as a
@@ -169,25 +166,25 @@ static bool cfg_changed;
This only returns destinations in a single-use chain. FINAL_NAME_P
if non-NULL is written to the ssa name that represents the use. */
-static tree
+static gimple
get_prop_dest_stmt (tree name, tree *final_name_p)
{
use_operand_p use;
- tree use_stmt;
+ gimple use_stmt;
do {
/* If name has multiple uses, bail out. */
if (!single_imm_use (name, &use, &use_stmt))
- return NULL_TREE;
+ return NULL;
/* If this is not a trivial copy, we found it. */
- if (TREE_CODE (use_stmt) != GIMPLE_MODIFY_STMT
- || TREE_CODE (GIMPLE_STMT_OPERAND (use_stmt, 0)) != SSA_NAME
- || GIMPLE_STMT_OPERAND (use_stmt, 1) != name)
+ if (!gimple_assign_copy_p (use_stmt)
+ || TREE_CODE (gimple_assign_lhs (use_stmt)) != SSA_NAME
+ || gimple_assign_rhs1 (use_stmt) != name)
break;
/* Continue searching uses of the copy destination. */
- name = GIMPLE_STMT_OPERAND (use_stmt, 0);
+ name = gimple_assign_lhs (use_stmt);
} while (1);
if (final_name_p)
@@ -204,27 +201,28 @@ get_prop_dest_stmt (tree name, tree *final_name_p)
it is set to whether the chain to NAME is a single use chain
or not. SINGLE_USE_P is not written to if SINGLE_USE_ONLY is set. */
-static tree
+static gimple
get_prop_source_stmt (tree name, bool single_use_only, bool *single_use_p)
{
bool single_use = true;
do {
- tree def_stmt = SSA_NAME_DEF_STMT (name);
+ gimple def_stmt = SSA_NAME_DEF_STMT (name);
if (!has_single_use (name))
{
single_use = false;
if (single_use_only)
- return NULL_TREE;
+ return NULL;
}
/* If name is defined by a PHI node or is the default def, bail out. */
- if (TREE_CODE (def_stmt) != GIMPLE_MODIFY_STMT)
- return NULL_TREE;
+ if (gimple_code (def_stmt) != GIMPLE_ASSIGN)
+ return NULL;
/* If name is not a simple copy destination, we found it. */
- if (TREE_CODE (GIMPLE_STMT_OPERAND (def_stmt, 1)) != SSA_NAME)
+ if (!gimple_assign_copy_p (def_stmt)
+ || TREE_CODE (gimple_assign_rhs1 (def_stmt)) != SSA_NAME)
{
tree rhs;
@@ -233,19 +231,19 @@ get_prop_source_stmt (tree name, bool single_use_only, bool *single_use_p)
/* We can look through pointer conversions in the search
for a useful stmt for the comparison folding. */
- rhs = GIMPLE_STMT_OPERAND (def_stmt, 1);
- if (CONVERT_EXPR_P (rhs)
- && TREE_CODE (TREE_OPERAND (rhs, 0)) == SSA_NAME
- && POINTER_TYPE_P (TREE_TYPE (rhs))
- && POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (rhs, 0))))
- name = TREE_OPERAND (rhs, 0);
+ rhs = gimple_assign_rhs1 (def_stmt);
+ if (IS_CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (def_stmt))
+ && TREE_CODE (rhs) == SSA_NAME
+ && POINTER_TYPE_P (TREE_TYPE (gimple_assign_lhs (def_stmt)))
+ && POINTER_TYPE_P (TREE_TYPE (rhs)))
+ name = rhs;
else
return def_stmt;
}
else
{
/* Continue searching the def of the copy source name. */
- name = GIMPLE_STMT_OPERAND (def_stmt, 1);
+ name = gimple_assign_rhs1 (def_stmt);
}
} while (1);
}
@@ -254,41 +252,43 @@ get_prop_source_stmt (tree name, bool single_use_only, bool *single_use_p)
propagation source. Returns true if so, otherwise false. */
static bool
-can_propagate_from (tree def_stmt)
+can_propagate_from (gimple def_stmt)
{
- tree rhs = GIMPLE_STMT_OPERAND (def_stmt, 1);
use_operand_p use_p;
ssa_op_iter iter;
+ gcc_assert (is_gimple_assign (def_stmt));
/* If the rhs has side-effects we cannot propagate from it. */
- if (TREE_SIDE_EFFECTS (rhs))
+ if (gimple_has_volatile_ops (def_stmt))
return false;
/* If the rhs is a load we cannot propagate from it. */
- if (REFERENCE_CLASS_P (rhs)
- || DECL_P (rhs))
+ if (TREE_CODE_CLASS (gimple_assign_rhs_code (def_stmt)) == tcc_reference
+ || TREE_CODE_CLASS (gimple_assign_rhs_code (def_stmt)) == tcc_declaration)
return false;
/* Constants can be always propagated. */
- if (is_gimple_min_invariant (rhs))
+ if (is_gimple_min_invariant
+ (rhs_to_tree (TREE_TYPE (gimple_assign_lhs (def_stmt)), def_stmt)))
return true;
- /* If any of the SSA operands occurs in abnormal PHIs we cannot
- propagate from this stmt. */
+ /* We cannot propagate ssa names that occur in abnormal phi nodes. */
FOR_EACH_SSA_USE_OPERAND (use_p, def_stmt, iter, SSA_OP_USE)
if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (USE_FROM_PTR (use_p)))
return false;
/* If the definition is a conversion of a pointer to a function type,
- then we can not apply optimizations as some targets require function
- pointers to be canonicalized and in this case this optimization could
- eliminate a necessary canonicalization. */
- if (CONVERT_EXPR_P (rhs)
- && POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (rhs, 0)))
- && TREE_CODE (TREE_TYPE (TREE_TYPE
- (TREE_OPERAND (rhs, 0)))) == FUNCTION_TYPE)
- return false;
-
+ then we can not apply optimizations as some targets require
+ function pointers to be canonicalized and in this case this
+ optimization could eliminate a necessary canonicalization. */
+ if (is_gimple_assign (def_stmt)
+ && (IS_CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (def_stmt))))
+ {
+ tree rhs = gimple_assign_rhs1 (def_stmt);
+ if (POINTER_TYPE_P (TREE_TYPE (rhs))
+ && TREE_CODE (TREE_TYPE (TREE_TYPE (rhs))) == FUNCTION_TYPE)
+ return false;
+ }
return true;
}
@@ -299,10 +299,10 @@ can_propagate_from (tree def_stmt)
as well, otherwise false. */
static bool
-remove_prop_source_from_use (tree name, tree up_to_stmt)
+remove_prop_source_from_use (tree name, gimple up_to_stmt)
{
- block_stmt_iterator bsi;
- tree stmt;
+ gimple_stmt_iterator gsi;
+ gimple stmt;
do {
if (!has_zero_uses (name))
@@ -312,16 +312,38 @@ remove_prop_source_from_use (tree name, tree up_to_stmt)
if (stmt == up_to_stmt)
return true;
- bsi = bsi_for_stmt (stmt);
+ gsi = gsi_for_stmt (stmt);
release_defs (stmt);
- bsi_remove (&bsi, true);
+ gsi_remove (&gsi, true);
- name = GIMPLE_STMT_OPERAND (stmt, 1);
- } while (TREE_CODE (name) == SSA_NAME);
+ name = (gimple_assign_copy_p (stmt)) ? gimple_assign_rhs1 (stmt) : NULL;
+ } while (name && TREE_CODE (name) == SSA_NAME);
return false;
}
+/* Return the rhs of a gimple_assign STMT in a form of a single tree,
+ converted to type TYPE.
+
+ This should disappear, but is needed so we can combine expressions and use
+ the fold() interfaces. Long term, we need to develop folding and combine
+ routines that deal with gimple exclusively . */
+
+static tree
+rhs_to_tree (tree type, gimple stmt)
+{
+ enum tree_code code = gimple_assign_rhs_code (stmt);
+ if (get_gimple_rhs_class (code) == GIMPLE_BINARY_RHS)
+ return fold_convert (type, build2 (code, type, gimple_assign_rhs1 (stmt),
+ gimple_assign_rhs2 (stmt)));
+ else if (get_gimple_rhs_class (code) == GIMPLE_UNARY_RHS)
+ return fold_convert (type, build1 (code, type, gimple_assign_rhs1 (stmt)));
+ else if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
+ return gimple_assign_rhs1 (stmt);
+ else
+ gcc_unreachable ();
+}
+
/* Combine OP0 CODE OP1 in the context of a COND_EXPR. Returns
the folded result in a form suitable for COND_EXPR_COND or
NULL_TREE, if there is no suitable simplified form. If
@@ -347,28 +369,124 @@ combine_cond_expr_cond (enum tree_code code, tree type,
t = canonicalize_cond_expr_cond (t);
/* Bail out if we required an invariant but didn't get one. */
- if (!t
- || (invariant_only
- && !is_gimple_min_invariant (t)))
+ if (!t || (invariant_only && !is_gimple_min_invariant (t)))
return NULL_TREE;
return t;
}
/* Propagate from the ssa name definition statements of COND_EXPR
- in statement STMT into the conditional if that simplifies it.
+ in GIMPLE_COND statement STMT into the conditional if that simplifies it.
+ Returns zero if no statement was changed, one if there were
+ changes and two if cfg_cleanup needs to run.
+
+ This must be kept in sync with forward_propagate_into_cond. */
+
+static int
+forward_propagate_into_gimple_cond (gimple stmt)
+{
+ int did_something = 0;
+
+ do {
+ tree tmp = NULL_TREE;
+ tree name, rhs0 = NULL_TREE, rhs1 = NULL_TREE;
+ gimple def_stmt;
+ bool single_use0_p = false, single_use1_p = false;
+ enum tree_code code = gimple_cond_code (stmt);
+
+ /* We can do tree combining on SSA_NAME and comparison expressions. */
+ if (TREE_CODE_CLASS (gimple_cond_code (stmt)) == tcc_comparison
+ && TREE_CODE (gimple_cond_lhs (stmt)) == SSA_NAME)
+ {
+ /* For comparisons use the first operand, that is likely to
+ simplify comparisons against constants. */
+ name = gimple_cond_lhs (stmt);
+ def_stmt = get_prop_source_stmt (name, false, &single_use0_p);
+ if (def_stmt && can_propagate_from (def_stmt))
+ {
+ tree op1 = gimple_cond_rhs (stmt);
+ rhs0 = rhs_to_tree (TREE_TYPE (op1), def_stmt);
+ tmp = combine_cond_expr_cond (code, boolean_type_node, rhs0,
+ op1, !single_use0_p);
+ }
+ /* If that wasn't successful, try the second operand. */
+ if (tmp == NULL_TREE
+ && TREE_CODE (gimple_cond_rhs (stmt)) == SSA_NAME)
+ {
+ tree op0 = gimple_cond_lhs (stmt);
+ name = gimple_cond_rhs (stmt);
+ def_stmt = get_prop_source_stmt (name, false, &single_use1_p);
+ if (!def_stmt || !can_propagate_from (def_stmt))
+ return did_something;
+
+ rhs1 = rhs_to_tree (TREE_TYPE (op0), def_stmt);
+ tmp = combine_cond_expr_cond (code, boolean_type_node, op0, rhs1,
+ !single_use1_p);
+ }
+ /* If that wasn't successful either, try both operands. */
+ if (tmp == NULL_TREE
+ && rhs0 != NULL_TREE
+ && rhs1 != NULL_TREE)
+ tmp = combine_cond_expr_cond (code, boolean_type_node, rhs0,
+ fold_convert (TREE_TYPE (rhs0), rhs1),
+ !(single_use0_p && single_use1_p));
+ }
+
+ if (tmp)
+ {
+ if (dump_file && tmp)
+ {
+ tree cond = build2 (gimple_cond_code (stmt),
+ boolean_type_node,
+ gimple_cond_lhs (stmt),
+ gimple_cond_rhs (stmt));
+ fprintf (dump_file, " Replaced '");
+ print_generic_expr (dump_file, cond, 0);
+ fprintf (dump_file, "' with '");
+ print_generic_expr (dump_file, tmp, 0);
+ fprintf (dump_file, "'\n");
+ }
+
+ gimple_cond_set_condition_from_tree (stmt, unshare_expr (tmp));
+ update_stmt (stmt);
+
+ /* Remove defining statements. */
+ remove_prop_source_from_use (name, NULL);
+
+ if (is_gimple_min_invariant (tmp))
+ did_something = 2;
+ else if (did_something == 0)
+ did_something = 1;
+
+ /* Continue combining. */
+ continue;
+ }
+
+ break;
+ } while (1);
+
+ return did_something;
+}
+
+
+/* Propagate from the ssa name definition statements of COND_EXPR
+ in the rhs of statement STMT into the conditional if that simplifies it.
Returns zero if no statement was changed, one if there were
- changes and two if cfg_cleanup needs to run. */
+ changes and two if cfg_cleanup needs to run.
+
+ This must be kept in sync with forward_propagate_into_gimple_cond. */
static int
-forward_propagate_into_cond (tree cond_expr, tree stmt)
+forward_propagate_into_cond (gimple_stmt_iterator *gsi_p)
{
+ gimple stmt = gsi_stmt (*gsi_p);
int did_something = 0;
do {
tree tmp = NULL_TREE;
- tree cond = COND_EXPR_COND (cond_expr);
- tree name, def_stmt, rhs0 = NULL_TREE, rhs1 = NULL_TREE;
+ tree cond = gimple_assign_rhs1 (stmt);
+ tree name, rhs0 = NULL_TREE, rhs1 = NULL_TREE;
+ gimple def_stmt;
bool single_use0_p = false, single_use1_p = false;
/* We can do tree combining on SSA_NAME and comparison expressions. */
@@ -379,14 +497,12 @@ forward_propagate_into_cond (tree cond_expr, tree stmt)
simplify comparisons against constants. */
name = TREE_OPERAND (cond, 0);
def_stmt = get_prop_source_stmt (name, false, &single_use0_p);
- if (def_stmt != NULL_TREE
- && can_propagate_from (def_stmt))
+ if (def_stmt && can_propagate_from (def_stmt))
{
tree op1 = TREE_OPERAND (cond, 1);
- rhs0 = GIMPLE_STMT_OPERAND (def_stmt, 1);
+ rhs0 = rhs_to_tree (TREE_TYPE (op1), def_stmt);
tmp = combine_cond_expr_cond (TREE_CODE (cond), boolean_type_node,
- fold_convert (TREE_TYPE (op1), rhs0),
- op1, !single_use0_p);
+ rhs0, op1, !single_use0_p);
}
/* If that wasn't successful, try the second operand. */
if (tmp == NULL_TREE
@@ -395,34 +511,30 @@ forward_propagate_into_cond (tree cond_expr, tree stmt)
tree op0 = TREE_OPERAND (cond, 0);
name = TREE_OPERAND (cond, 1);
def_stmt = get_prop_source_stmt (name, false, &single_use1_p);
- if (def_stmt == NULL_TREE
- || !can_propagate_from (def_stmt))
+ if (!def_stmt || !can_propagate_from (def_stmt))
return did_something;
- rhs1 = GIMPLE_STMT_OPERAND (def_stmt, 1);
+ rhs1 = rhs_to_tree (TREE_TYPE (op0), def_stmt);
tmp = combine_cond_expr_cond (TREE_CODE (cond), boolean_type_node,
- op0,
- fold_convert (TREE_TYPE (op0), rhs1),
- !single_use1_p);
+ op0, rhs1, !single_use1_p);
}
/* If that wasn't successful either, try both operands. */
if (tmp == NULL_TREE
&& rhs0 != NULL_TREE
&& rhs1 != NULL_TREE)
tmp = combine_cond_expr_cond (TREE_CODE (cond), boolean_type_node,
- rhs0,
- fold_convert (TREE_TYPE (rhs0), rhs1),
+ rhs0, fold_convert (TREE_TYPE (rhs0),
+ rhs1),
!(single_use0_p && single_use1_p));
}
else if (TREE_CODE (cond) == SSA_NAME)
{
name = cond;
def_stmt = get_prop_source_stmt (name, true, NULL);
- if (def_stmt == NULL_TREE
- || !can_propagate_from (def_stmt))
+ if (def_stmt || !can_propagate_from (def_stmt))
return did_something;
- rhs0 = GIMPLE_STMT_OPERAND (def_stmt, 1);
+ rhs0 = gimple_assign_rhs1 (def_stmt);
tmp = combine_cond_expr_cond (NE_EXPR, boolean_type_node, rhs0,
build_int_cst (TREE_TYPE (rhs0), 0),
false);
@@ -439,7 +551,8 @@ forward_propagate_into_cond (tree cond_expr, tree stmt)
fprintf (dump_file, "'\n");
}
- COND_EXPR_COND (cond_expr) = unshare_expr (tmp);
+ gimple_assign_set_rhs_from_tree (gsi_p, unshare_expr (tmp));
+ stmt = gsi_stmt (*gsi_p);
update_stmt (stmt);
/* Remove defining statements. */
@@ -464,20 +577,20 @@ forward_propagate_into_cond (tree cond_expr, tree stmt)
relevant data structures to match. */
static void
-tidy_after_forward_propagate_addr (tree stmt)
+tidy_after_forward_propagate_addr (gimple stmt)
{
/* We may have turned a trapping insn into a non-trapping insn. */
if (maybe_clean_or_replace_eh_stmt (stmt, stmt)
- && tree_purge_dead_eh_edges (bb_for_stmt (stmt)))
+ && gimple_purge_dead_eh_edges (gimple_bb (stmt)))
cfg_changed = true;
- if (TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 1)) == ADDR_EXPR)
- recompute_tree_invariant_for_addr_expr (GIMPLE_STMT_OPERAND (stmt, 1));
+ if (TREE_CODE (gimple_assign_rhs1 (stmt)) == ADDR_EXPR)
+ recompute_tree_invariant_for_addr_expr (gimple_assign_rhs1 (stmt));
mark_symbols_for_renaming (stmt);
}
-/* DEF_RHS contains the address of the 0th element in an array.
+/* DEF_RHS contains the address of the 0th element in an array.
USE_STMT uses type of DEF_RHS to compute the address of an
arbitrary element within the array. The (variable) byte offset
of the element is contained in OFFSET.
@@ -494,9 +607,11 @@ tidy_after_forward_propagate_addr (tree stmt)
static bool
forward_propagate_addr_into_variable_array_index (tree offset,
- tree def_rhs, tree use_stmt)
+ tree def_rhs,
+ gimple_stmt_iterator *use_stmt_gsi)
{
tree index;
+ gimple offset_def, use_stmt = gsi_stmt (*use_stmt_gsi);
/* Try to find an expression for a proper index. This is either
a multiplication expression by the element size or just the
@@ -506,31 +621,32 @@ forward_propagate_addr_into_variable_array_index (tree offset,
else
{
/* Get the offset's defining statement. */
- offset = SSA_NAME_DEF_STMT (offset);
+ offset_def = SSA_NAME_DEF_STMT (offset);
/* The statement which defines OFFSET before type conversion
- must be a simple GIMPLE_MODIFY_STMT. */
- if (TREE_CODE (offset) != GIMPLE_MODIFY_STMT)
+ must be a simple GIMPLE_ASSIGN. */
+ if (gimple_code (offset_def) != GIMPLE_ASSIGN)
return false;
/* The RHS of the statement which defines OFFSET must be a
multiplication of an object by the size of the array elements.
This implicitly verifies that the size of the array elements
is constant. */
- offset = GIMPLE_STMT_OPERAND (offset, 1);
- if (TREE_CODE (offset) != MULT_EXPR
- || TREE_CODE (TREE_OPERAND (offset, 1)) != INTEGER_CST
- || !simple_cst_equal (TREE_OPERAND (offset, 1),
- TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (def_rhs)))))
+ offset = gimple_assign_rhs1 (offset_def);
+ if (gimple_assign_rhs_code (offset_def) != MULT_EXPR
+ || TREE_CODE (gimple_assign_rhs2 (offset_def)) != INTEGER_CST
+ || !simple_cst_equal (gimple_assign_rhs2 (offset_def),
+ TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (def_rhs)))))
return false;
/* The first operand to the MULT_EXPR is the desired index. */
- index = TREE_OPERAND (offset, 0);
+ index = offset;
}
/* Replace the pointer addition with array indexing. */
- GIMPLE_STMT_OPERAND (use_stmt, 1) = unshare_expr (def_rhs);
- TREE_OPERAND (TREE_OPERAND (GIMPLE_STMT_OPERAND (use_stmt, 1), 0), 1)
+ gimple_assign_set_rhs_from_tree (use_stmt_gsi, unshare_expr (def_rhs));
+ use_stmt = gsi_stmt (*use_stmt_gsi);
+ TREE_OPERAND (TREE_OPERAND (gimple_assign_rhs1 (use_stmt), 0), 1)
= index;
/* That should have created gimple, so there is no need to
@@ -546,21 +662,25 @@ forward_propagate_addr_into_variable_array_index (tree offset,
Try to forward propagate the ADDR_EXPR into the use USE_STMT.
Often this will allow for removal of an ADDR_EXPR and INDIRECT_REF
node or for recovery of array indexing from pointer arithmetic.
-
+
Return true if the propagation was successful (the propagation can
be not totally successful, yet things may have been changed). */
static bool
-forward_propagate_addr_expr_1 (tree name, tree def_rhs, tree use_stmt,
+forward_propagate_addr_expr_1 (tree name, tree def_rhs,
+ gimple_stmt_iterator *use_stmt_gsi,
bool single_use_p)
{
- tree lhs, rhs, array_ref;
+ tree lhs, rhs, rhs2, array_ref;
tree *rhsp, *lhsp;
+ gimple use_stmt = gsi_stmt (*use_stmt_gsi);
+ enum tree_code rhs_code;
gcc_assert (TREE_CODE (def_rhs) == ADDR_EXPR);
- lhs = GIMPLE_STMT_OPERAND (use_stmt, 0);
- rhs = GIMPLE_STMT_OPERAND (use_stmt, 1);
+ lhs = gimple_assign_lhs (use_stmt);
+ rhs_code = gimple_assign_rhs_code (use_stmt);
+ rhs = gimple_assign_rhs1 (use_stmt);
/* Trivial cases. The use statement could be a trivial copy or a
useless conversion. Recurse to the uses of the lhs as copyprop does
@@ -568,21 +688,22 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs, tree use_stmt,
all useless conversions. Treat the case of a single-use name and
a conversion to def_rhs type separate, though. */
if (TREE_CODE (lhs) == SSA_NAME
- && (rhs == name
- || CONVERT_EXPR_P (rhs))
- && useless_type_conversion_p (TREE_TYPE (rhs), TREE_TYPE (def_rhs)))
+ && ((rhs_code == SSA_NAME && rhs == name)
+ || IS_CONVERT_EXPR_CODE_P (rhs_code))
+ && useless_type_conversion_p (TREE_TYPE (lhs), TREE_TYPE (def_rhs)))
{
/* Only recurse if we don't deal with a single use. */
if (!single_use_p)
return forward_propagate_addr_expr (lhs, def_rhs);
- GIMPLE_STMT_OPERAND (use_stmt, 1) = unshare_expr (def_rhs);
+ gimple_assign_set_rhs1 (use_stmt, unshare_expr (def_rhs));
+ gimple_assign_set_rhs_code (use_stmt, TREE_CODE (def_rhs));
return true;
}
/* Now strip away any outer COMPONENT_REF/ARRAY_REF nodes from the LHS.
ADDR_EXPR will not appear on the LHS. */
- lhsp = &GIMPLE_STMT_OPERAND (use_stmt, 0);
+ lhsp = gimple_assign_lhs_ptr (use_stmt);
while (handled_component_p (*lhsp))
lhsp = &TREE_OPERAND (*lhsp, 0);
lhs = *lhsp;
@@ -609,13 +730,13 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs, tree use_stmt,
/* Strip away any outer COMPONENT_REF, ARRAY_REF or ADDR_EXPR
nodes from the RHS. */
- rhsp = &GIMPLE_STMT_OPERAND (use_stmt, 1);
+ rhsp = gimple_assign_rhs1_ptr (use_stmt);
while (handled_component_p (*rhsp)
|| TREE_CODE (*rhsp) == ADDR_EXPR)
rhsp = &TREE_OPERAND (*rhsp, 0);
rhs = *rhsp;
- /* Now see if the RHS node is an INDIRECT_REF using NAME. If so,
+ /* Now see if the RHS node is an INDIRECT_REF using NAME. If so,
propagate the ADDR_EXPR into the use of NAME and fold the result. */
if (TREE_CODE (rhs) == INDIRECT_REF
&& TREE_OPERAND (rhs, 0) == name
@@ -654,8 +775,8 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs, tree use_stmt,
/* If we have folded the VCE, then we have to create a new statement. */
if (TREE_CODE (new_rhs) != VIEW_CONVERT_EXPR)
{
- block_stmt_iterator bsi = bsi_for_stmt (use_stmt);
- new_rhs = force_gimple_operand_bsi (&bsi, new_rhs, true, NULL, true, BSI_SAME_STMT);
+ gimple_stmt_iterator gsi = gsi_for_stmt (use_stmt);
+ new_rhs = force_gimple_operand_gsi (&gsi, new_rhs, true, NULL, true, GSI_SAME_STMT);
/* As we change the deference to a SSA_NAME, we need to return false to make sure that
the statement does not get removed. */
res = false;
@@ -668,8 +789,8 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs, tree use_stmt,
/* If the use of the ADDR_EXPR is not a POINTER_PLUS_EXPR, there
is nothing to do. */
- if (TREE_CODE (rhs) != POINTER_PLUS_EXPR
- || TREE_OPERAND (rhs, 0) != name)
+ if (gimple_assign_rhs_code (use_stmt) != POINTER_PLUS_EXPR
+ || gimple_assign_rhs1 (use_stmt) != name)
return false;
/* The remaining cases are all for turning pointer arithmetic into
@@ -682,44 +803,33 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs, tree use_stmt,
|| !integer_zerop (TREE_OPERAND (array_ref, 1)))
return false;
+ rhs2 = gimple_assign_rhs2 (use_stmt);
/* Try to optimize &x[0] p+ C where C is a multiple of the size
of the elements in X into &x[C/element size]. */
- if (TREE_CODE (TREE_OPERAND (rhs, 1)) == INTEGER_CST)
+ if (TREE_CODE (rhs2) == INTEGER_CST)
{
- tree orig = unshare_expr (rhs);
- TREE_OPERAND (rhs, 0) = unshare_expr (def_rhs);
-
- /* If folding succeeds, then we have just exposed new variables
- in USE_STMT which will need to be renamed. If folding fails,
- then we need to put everything back the way it was. */
- if (fold_stmt_inplace (use_stmt))
+ tree new_rhs = maybe_fold_stmt_addition (gimple_expr_type (use_stmt),
+ array_ref, rhs2);
+ if (new_rhs)
{
+ gimple_assign_set_rhs_from_tree (use_stmt_gsi, new_rhs);
+ use_stmt = gsi_stmt (*use_stmt_gsi);
+ update_stmt (use_stmt);
tidy_after_forward_propagate_addr (use_stmt);
return true;
}
- else
- {
- GIMPLE_STMT_OPERAND (use_stmt, 1) = orig;
- update_stmt (use_stmt);
- return false;
- }
}
/* Try to optimize &x[0] p+ OFFSET where OFFSET is defined by
converting a multiplication of an index by the size of the
array elements, then the result is converted into the proper
type for the arithmetic. */
- if (TREE_CODE (TREE_OPERAND (rhs, 1)) == SSA_NAME
+ if (TREE_CODE (rhs2) == SSA_NAME
/* Avoid problems with IVopts creating PLUS_EXPRs with a
different type than their operands. */
- && useless_type_conversion_p (TREE_TYPE (rhs), TREE_TYPE (name)))
- {
- bool res;
-
- res = forward_propagate_addr_into_variable_array_index (TREE_OPERAND (rhs, 1),
- def_rhs, use_stmt);
- return res;
- }
+ && useless_type_conversion_p (TREE_TYPE (lhs), TREE_TYPE (name)))
+ return forward_propagate_addr_into_variable_array_index (rhs2, def_rhs,
+ use_stmt_gsi);
return false;
}
@@ -733,9 +843,9 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs, tree use_stmt,
static bool
forward_propagate_addr_expr (tree name, tree rhs)
{
- int stmt_loop_depth = bb_for_stmt (SSA_NAME_DEF_STMT (name))->loop_depth;
+ int stmt_loop_depth = gimple_bb (SSA_NAME_DEF_STMT (name))->loop_depth;
imm_use_iterator iter;
- tree use_stmt;
+ gimple use_stmt;
bool all = true;
bool single_use_p = has_single_use (name);
@@ -746,16 +856,16 @@ forward_propagate_addr_expr (tree name, tree rhs)
/* If the use is not in a simple assignment statement, then
there is nothing we can do. */
- if (TREE_CODE (use_stmt) != GIMPLE_MODIFY_STMT)
+ if (gimple_code (use_stmt) != GIMPLE_ASSIGN)
{
all = false;
continue;
}
/* If the use is in a deeper loop nest, then we do not want
- to propagate the ADDR_EXPR into the loop as that is likely
- adding expression evaluations into the loop. */
- if (bb_for_stmt (use_stmt)->loop_depth > stmt_loop_depth)
+ to propagate the ADDR_EXPR into the loop as that is likely
+ adding expression evaluations into the loop. */
+ if (gimple_bb (use_stmt)->loop_depth > stmt_loop_depth)
{
all = false;
continue;
@@ -763,30 +873,34 @@ forward_propagate_addr_expr (tree name, tree rhs)
push_stmt_changes (&use_stmt);
- result = forward_propagate_addr_expr_1 (name, rhs, use_stmt,
- single_use_p);
+ {
+ gimple_stmt_iterator gsi = gsi_for_stmt (use_stmt);
+ result = forward_propagate_addr_expr_1 (name, rhs, &gsi,
+ single_use_p);
+ use_stmt = gsi_stmt (gsi);
+ }
all &= result;
pop_stmt_changes (&use_stmt);
/* Remove intermediate now unused copy and conversion chains. */
- use_rhs = GIMPLE_STMT_OPERAND (use_stmt, 1);
+ use_rhs = gimple_assign_rhs1 (use_stmt);
if (result
- && TREE_CODE (GIMPLE_STMT_OPERAND (use_stmt, 0)) == SSA_NAME
+ && TREE_CODE (gimple_assign_lhs (use_stmt)) == SSA_NAME
&& (TREE_CODE (use_rhs) == SSA_NAME
|| (CONVERT_EXPR_P (use_rhs)
&& TREE_CODE (TREE_OPERAND (use_rhs, 0)) == SSA_NAME)))
{
- block_stmt_iterator bsi = bsi_for_stmt (use_stmt);
+ gimple_stmt_iterator gsi = gsi_for_stmt (use_stmt);
release_defs (use_stmt);
- bsi_remove (&bsi, true);
+ gsi_remove (&gsi, true);
}
}
return all;
}
-/* Forward propagate the comparison COND defined in STMT like
+/* Forward propagate the comparison defined in STMT like
cond_1 = x CMP y to uses of the form
a_1 = (T')cond_1
a_1 = !cond_1
@@ -794,83 +908,95 @@ forward_propagate_addr_expr (tree name, tree rhs)
Returns true if stmt is now unused. */
static bool
-forward_propagate_comparison (tree cond, tree stmt)
+forward_propagate_comparison (gimple stmt)
{
- tree name = GIMPLE_STMT_OPERAND (stmt, 0);
- tree use_stmt, tmp = NULL_TREE;
+ tree name = gimple_assign_lhs (stmt);
+ gimple use_stmt;
+ tree tmp = NULL_TREE;
/* Don't propagate ssa names that occur in abnormal phis. */
- if ((TREE_CODE (TREE_OPERAND (cond, 0)) == SSA_NAME
- && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (TREE_OPERAND (cond, 0)))
- || (TREE_CODE (TREE_OPERAND (cond, 1)) == SSA_NAME
- && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (TREE_OPERAND (cond, 1))))
+ if ((TREE_CODE (gimple_assign_rhs1 (stmt)) == SSA_NAME
+ && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (gimple_assign_rhs1 (stmt)))
+ || (TREE_CODE (gimple_assign_rhs2 (stmt)) == SSA_NAME
+ && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (gimple_assign_rhs2 (stmt))))
return false;
/* Do not un-cse comparisons. But propagate through copies. */
use_stmt = get_prop_dest_stmt (name, &name);
- if (use_stmt == NULL_TREE)
+ if (!use_stmt)
return false;
/* Conversion of the condition result to another integral type. */
- if (TREE_CODE (use_stmt) == GIMPLE_MODIFY_STMT
- && (CONVERT_EXPR_P (GIMPLE_STMT_OPERAND (use_stmt, 1))
- || COMPARISON_CLASS_P (GIMPLE_STMT_OPERAND (use_stmt, 1))
- || TREE_CODE (GIMPLE_STMT_OPERAND (use_stmt, 1)) == TRUTH_NOT_EXPR)
- && INTEGRAL_TYPE_P (TREE_TYPE (GIMPLE_STMT_OPERAND (use_stmt, 0))))
+ if (is_gimple_assign (use_stmt)
+ && (IS_CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (use_stmt))
+ || TREE_CODE_CLASS (gimple_assign_rhs_code (use_stmt))
+ == tcc_comparison
+ || gimple_assign_rhs_code (use_stmt) == TRUTH_NOT_EXPR)
+ && INTEGRAL_TYPE_P (TREE_TYPE (gimple_assign_lhs (use_stmt))))
{
- tree lhs = GIMPLE_STMT_OPERAND (use_stmt, 0);
- tree rhs = GIMPLE_STMT_OPERAND (use_stmt, 1);
+ tree lhs = gimple_assign_lhs (use_stmt);
/* We can propagate the condition into a conversion. */
- if (CONVERT_EXPR_P (rhs))
+ if (IS_CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (use_stmt)))
{
/* Avoid using fold here as that may create a COND_EXPR with
non-boolean condition as canonical form. */
- tmp = build2 (TREE_CODE (cond), TREE_TYPE (lhs),
- TREE_OPERAND (cond, 0), TREE_OPERAND (cond, 1));
+ tmp = build2 (gimple_assign_rhs_code (stmt), TREE_TYPE (lhs),
+ gimple_assign_rhs1 (stmt), gimple_assign_rhs2 (stmt));
}
/* We can propagate the condition into X op CST where op
is EQ_EXPR or NE_EXPR and CST is either one or zero. */
- else if (COMPARISON_CLASS_P (rhs)
- && TREE_CODE (TREE_OPERAND (rhs, 0)) == SSA_NAME
- && TREE_CODE (TREE_OPERAND (rhs, 1)) == INTEGER_CST)
- {
- enum tree_code code = TREE_CODE (rhs);
- tree cst = TREE_OPERAND (rhs, 1);
-
- tmp = combine_cond_expr_cond (code, TREE_TYPE (lhs),
- fold_convert (TREE_TYPE (cst), cond),
- cst, false);
- if (tmp == NULL_TREE)
- return false;
- }
+ else if (TREE_CODE_CLASS (gimple_assign_rhs_code (use_stmt))
+ == tcc_comparison
+ && TREE_CODE (gimple_assign_rhs1 (use_stmt)) == SSA_NAME
+ && TREE_CODE (gimple_assign_rhs2 (use_stmt)) == INTEGER_CST)
+ {
+ enum tree_code code = gimple_assign_rhs_code (use_stmt);
+ tree cst = gimple_assign_rhs2 (use_stmt);
+ tree cond;
+
+ cond = build2 (gimple_assign_rhs_code (stmt),
+ TREE_TYPE (cst),
+ gimple_assign_rhs1 (stmt),
+ gimple_assign_rhs2 (stmt));
+
+ tmp = combine_cond_expr_cond (code, TREE_TYPE (lhs), cond, cst, false);
+ if (tmp == NULL_TREE)
+ return false;
+ }
/* We can propagate the condition into a statement that
computes the logical negation of the comparison result. */
- else if (TREE_CODE (rhs) == TRUTH_NOT_EXPR)
+ else if (gimple_assign_rhs_code (use_stmt) == TRUTH_NOT_EXPR)
{
- tree type = TREE_TYPE (TREE_OPERAND (cond, 0));
+ tree type = TREE_TYPE (gimple_assign_rhs1 (stmt));
bool nans = HONOR_NANS (TYPE_MODE (type));
enum tree_code code;
- code = invert_tree_comparison (TREE_CODE (cond), nans);
+ code = invert_tree_comparison (gimple_assign_rhs_code (stmt), nans);
if (code == ERROR_MARK)
return false;
- tmp = build2 (code, TREE_TYPE (lhs), TREE_OPERAND (cond, 0),
- TREE_OPERAND (cond, 1));
+ tmp = build2 (code, TREE_TYPE (lhs), gimple_assign_rhs1 (stmt),
+ gimple_assign_rhs2 (stmt));
}
else
return false;
- GIMPLE_STMT_OPERAND (use_stmt, 1) = unshare_expr (tmp);
- update_stmt (use_stmt);
+ {
+ gimple_stmt_iterator gsi = gsi_for_stmt (use_stmt);
+ gimple_assign_set_rhs_from_tree (&gsi, unshare_expr (tmp));
+ use_stmt = gsi_stmt (gsi);
+ update_stmt (use_stmt);
+ }
/* Remove defining statements. */
remove_prop_source_from_use (name, stmt);
if (dump_file && (dump_flags & TDF_DETAILS))
{
+ tree old_rhs = rhs_to_tree (TREE_TYPE (gimple_assign_lhs (stmt)),
+ stmt);
fprintf (dump_file, " Replaced '");
- print_generic_expr (dump_file, rhs, dump_flags);
+ print_generic_expr (dump_file, old_rhs, dump_flags);
fprintf (dump_file, "' with '");
print_generic_expr (dump_file, tmp, dump_flags);
fprintf (dump_file, "'\n");
@@ -897,23 +1023,24 @@ forward_propagate_comparison (tree cond, tree stmt)
than one forward link. */
static void
-simplify_not_neg_expr (tree stmt)
+simplify_not_neg_expr (gimple_stmt_iterator *gsi_p)
{
- tree rhs = GIMPLE_STMT_OPERAND (stmt, 1);
- tree rhs_def_stmt = SSA_NAME_DEF_STMT (TREE_OPERAND (rhs, 0));
+ gimple stmt = gsi_stmt (*gsi_p);
+ tree rhs = gimple_assign_rhs1 (stmt);
+ gimple rhs_def_stmt = SSA_NAME_DEF_STMT (rhs);
/* See if the RHS_DEF_STMT has the same form as our statement. */
- if (TREE_CODE (rhs_def_stmt) == GIMPLE_MODIFY_STMT
- && TREE_CODE (GIMPLE_STMT_OPERAND (rhs_def_stmt, 1)) == TREE_CODE (rhs))
+ if (is_gimple_assign (rhs_def_stmt)
+ && gimple_assign_rhs_code (rhs_def_stmt) == gimple_assign_rhs_code (stmt))
{
- tree rhs_def_operand =
- TREE_OPERAND (GIMPLE_STMT_OPERAND (rhs_def_stmt, 1), 0);
+ tree rhs_def_operand = gimple_assign_rhs1 (rhs_def_stmt);
/* Verify that RHS_DEF_OPERAND is a suitable SSA_NAME. */
if (TREE_CODE (rhs_def_operand) == SSA_NAME
&& ! SSA_NAME_OCCURS_IN_ABNORMAL_PHI (rhs_def_operand))
{
- GIMPLE_STMT_OPERAND (stmt, 1) = rhs_def_operand;
+ gimple_assign_set_rhs_from_tree (gsi_p, rhs_def_operand);
+ stmt = gsi_stmt (*gsi_p);
update_stmt (stmt);
}
}
@@ -923,26 +1050,26 @@ simplify_not_neg_expr (tree stmt)
the condition which we may be able to optimize better. */
static void
-simplify_switch_expr (tree stmt)
+simplify_gimple_switch (gimple stmt)
{
- tree cond = SWITCH_COND (stmt);
+ tree cond = gimple_switch_index (stmt);
tree def, to, ti;
+ gimple def_stmt;
/* The optimization that we really care about is removing unnecessary
casts. That will let us do much better in propagating the inferred
constant at the switch target. */
if (TREE_CODE (cond) == SSA_NAME)
{
- def = SSA_NAME_DEF_STMT (cond);
- if (TREE_CODE (def) == GIMPLE_MODIFY_STMT)
+ def_stmt = SSA_NAME_DEF_STMT (cond);
+ if (is_gimple_assign (def_stmt))
{
- def = GIMPLE_STMT_OPERAND (def, 1);
- if (TREE_CODE (def) == NOP_EXPR)
+ if (gimple_assign_rhs_code (def_stmt) == NOP_EXPR)
{
int need_precision;
bool fail;
- def = TREE_OPERAND (def, 0);
+ def = gimple_assign_rhs1 (def_stmt);
#ifdef ENABLE_CHECKING
/* ??? Why was Jeff testing this? We are gimple... */
@@ -968,7 +1095,7 @@ simplify_switch_expr (tree stmt)
if (!fail)
{
- SWITCH_COND (stmt) = def;
+ gimple_switch_set_index (stmt, def);
update_stmt (stmt);
}
}
@@ -988,33 +1115,32 @@ tree_ssa_forward_propagate_single_use_vars (void)
FOR_EACH_BB (bb)
{
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
- /* Note we update BSI within the loop as necessary. */
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); )
+ /* Note we update GSI within the loop as necessary. */
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); )
{
- tree stmt = bsi_stmt (bsi);
+ gimple stmt = gsi_stmt (gsi);
/* If this statement sets an SSA_NAME to an address,
try to propagate the address into the uses of the SSA_NAME. */
- if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT)
+ if (is_gimple_assign (stmt))
{
- tree lhs = GIMPLE_STMT_OPERAND (stmt, 0);
- tree rhs = GIMPLE_STMT_OPERAND (stmt, 1);
-
+ tree lhs = gimple_assign_lhs (stmt);
+ tree rhs = gimple_assign_rhs1 (stmt);
if (TREE_CODE (lhs) != SSA_NAME)
{
- bsi_next (&bsi);
+ gsi_next (&gsi);
continue;
}
- if (TREE_CODE (rhs) == ADDR_EXPR
+ if (gimple_assign_rhs_code (stmt) == ADDR_EXPR
/* Handle pointer conversions on invariant addresses
as well, as this is valid gimple. */
- || (CONVERT_EXPR_P (rhs)
- && TREE_CODE (TREE_OPERAND (rhs, 0)) == ADDR_EXPR
- && POINTER_TYPE_P (TREE_TYPE (rhs))))
+ || (IS_CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (stmt))
+ && TREE_CODE (rhs) == ADDR_EXPR
+ && POINTER_TYPE_P (TREE_TYPE (lhs))))
{
STRIP_NOPS (rhs);
if (!stmt_references_abnormal_ssa_name (stmt)
@@ -1022,61 +1148,64 @@ tree_ssa_forward_propagate_single_use_vars (void)
{
release_defs (stmt);
todoflags |= TODO_remove_unused_locals;
- bsi_remove (&bsi, true);
+ gsi_remove (&gsi, true);
}
else
- bsi_next (&bsi);
+ gsi_next (&gsi);
}
- else if ((TREE_CODE (rhs) == BIT_NOT_EXPR
- || TREE_CODE (rhs) == NEGATE_EXPR)
- && TREE_CODE (TREE_OPERAND (rhs, 0)) == SSA_NAME)
+ else if ((gimple_assign_rhs_code (stmt) == BIT_NOT_EXPR
+ || gimple_assign_rhs_code (stmt) == NEGATE_EXPR)
+ && TREE_CODE (rhs) == SSA_NAME)
{
- simplify_not_neg_expr (stmt);
- bsi_next (&bsi);
+ simplify_not_neg_expr (&gsi);
+ gsi_next (&gsi);
}
- else if (TREE_CODE (rhs) == COND_EXPR)
+ else if (gimple_assign_rhs_code (stmt) == COND_EXPR)
{
+ /* In this case the entire COND_EXPR is in rhs1. */
int did_something;
fold_defer_overflow_warnings ();
- did_something = forward_propagate_into_cond (rhs, stmt);
+ did_something = forward_propagate_into_cond (&gsi);
+ stmt = gsi_stmt (gsi);
if (did_something == 2)
cfg_changed = true;
fold_undefer_overflow_warnings (!TREE_NO_WARNING (rhs)
&& did_something, stmt, WARN_STRICT_OVERFLOW_CONDITIONAL);
- bsi_next (&bsi);
+ gsi_next (&gsi);
}
- else if (COMPARISON_CLASS_P (rhs))
+ else if (TREE_CODE_CLASS (gimple_assign_rhs_code (stmt))
+ == tcc_comparison)
{
- if (forward_propagate_comparison (rhs, stmt))
+ if (forward_propagate_comparison (stmt))
{
release_defs (stmt);
todoflags |= TODO_remove_unused_locals;
- bsi_remove (&bsi, true);
+ gsi_remove (&gsi, true);
}
else
- bsi_next (&bsi);
+ gsi_next (&gsi);
}
else
- bsi_next (&bsi);
+ gsi_next (&gsi);
}
- else if (TREE_CODE (stmt) == SWITCH_EXPR)
+ else if (gimple_code (stmt) == GIMPLE_SWITCH)
{
- simplify_switch_expr (stmt);
- bsi_next (&bsi);
+ simplify_gimple_switch (stmt);
+ gsi_next (&gsi);
}
- else if (TREE_CODE (stmt) == COND_EXPR)
+ else if (gimple_code (stmt) == GIMPLE_COND)
{
int did_something;
fold_defer_overflow_warnings ();
- did_something = forward_propagate_into_cond (stmt, stmt);
+ did_something = forward_propagate_into_gimple_cond (stmt);
if (did_something == 2)
cfg_changed = true;
fold_undefer_overflow_warnings (did_something, stmt,
WARN_STRICT_OVERFLOW_CONDITIONAL);
- bsi_next (&bsi);
+ gsi_next (&gsi);
}
else
- bsi_next (&bsi);
+ gsi_next (&gsi);
}
}
diff --git a/gcc/tree-ssa-ifcombine.c b/gcc/tree-ssa-ifcombine.c
index 93e7810cb3b..143608e28eb 100644
--- a/gcc/tree-ssa-ifcombine.c
+++ b/gcc/tree-ssa-ifcombine.c
@@ -101,14 +101,13 @@ recognize_if_then_else (basic_block cond_bb,
static bool
bb_no_side_effects_p (basic_block bb)
{
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- tree stmt = bsi_stmt (bsi);
- stmt_ann_t ann = stmt_ann (stmt);
+ gimple stmt = gsi_stmt (gsi);
- if (ann->has_volatile_ops
+ if (gimple_has_volatile_ops (stmt)
|| !ZERO_SSA_OPERANDS (stmt, SSA_OP_ALL_VIRTUALS))
return false;
}
@@ -125,12 +124,16 @@ same_phi_args_p (basic_block bb1, basic_block bb2, basic_block dest)
{
edge e1 = find_edge (bb1, dest);
edge e2 = find_edge (bb2, dest);
- tree phi;
+ gimple_stmt_iterator gsi;
+ gimple phi;
- for (phi = phi_nodes (dest); phi; phi = PHI_CHAIN (phi))
- if (!operand_equal_p (PHI_ARG_DEF_FROM_EDGE (phi, e1),
- PHI_ARG_DEF_FROM_EDGE (phi, e2), 0))
- return false;
+ for (gsi = gsi_start_phis (dest); !gsi_end_p (gsi); gsi_next (&gsi))
+ {
+ phi = gsi_stmt (gsi);
+ if (!operand_equal_p (PHI_ARG_DEF_FROM_EDGE (phi, e1),
+ PHI_ARG_DEF_FROM_EDGE (phi, e2), 0))
+ return false;
+ }
return true;
}
@@ -146,71 +149,86 @@ get_name_for_bit_test (tree candidate)
if (TREE_CODE (candidate) == SSA_NAME
&& has_single_use (candidate))
{
- tree def_stmt = SSA_NAME_DEF_STMT (candidate);
- if (TREE_CODE (def_stmt) == GIMPLE_MODIFY_STMT
- && CONVERT_EXPR_P (GIMPLE_STMT_OPERAND (def_stmt, 1)))
+ gimple def_stmt = SSA_NAME_DEF_STMT (candidate);
+ if (is_gimple_assign (def_stmt)
+ && gimple_assign_cast_p (def_stmt))
{
- tree rhs = GIMPLE_STMT_OPERAND (def_stmt, 1);
- if (TYPE_PRECISION (TREE_TYPE (rhs))
- <= TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (rhs, 0))))
- return TREE_OPERAND (rhs, 0);
+ if (TYPE_PRECISION (TREE_TYPE (candidate))
+ <= TYPE_PRECISION (TREE_TYPE (gimple_assign_rhs1 (def_stmt))))
+ return gimple_assign_rhs1 (def_stmt);
}
}
return candidate;
}
-/* Recognize a single bit test pattern in COND_EXPR and its defining
+/* Helpers for recognize_single_bit_test defined mainly for source code
+ formating. */
+
+static int
+operand_precision (tree t)
+{
+ return TYPE_PRECISION (TREE_TYPE (t));
+}
+
+static bool
+integral_operand_p (tree t)
+{
+ return INTEGRAL_TYPE_P (TREE_TYPE (t));
+}
+
+/* Recognize a single bit test pattern in GIMPLE_COND and its defining
statements. Store the name being tested in *NAME and the bit
- in *BIT. The COND_EXPR computes *NAME & (1 << *BIT).
+ in *BIT. The GIMPLE_COND computes *NAME & (1 << *BIT).
Returns true if the pattern matched, false otherwise. */
static bool
-recognize_single_bit_test (tree cond_expr, tree *name, tree *bit)
+recognize_single_bit_test (gimple cond, tree *name, tree *bit)
{
- tree t;
+ gimple stmt;
/* Get at the definition of the result of the bit test. */
- t = TREE_OPERAND (cond_expr, 0);
- if (TREE_CODE (t) == NE_EXPR
- && integer_zerop (TREE_OPERAND (t, 1)))
- t = TREE_OPERAND (t, 0);
- if (TREE_CODE (t) != SSA_NAME)
+ if (gimple_cond_code (cond) != NE_EXPR
+ || TREE_CODE (gimple_cond_lhs (cond)) != SSA_NAME
+ || !integer_zerop (gimple_cond_rhs (cond)))
return false;
- t = SSA_NAME_DEF_STMT (t);
- if (TREE_CODE (t) != GIMPLE_MODIFY_STMT)
+ stmt = SSA_NAME_DEF_STMT (gimple_cond_lhs (cond));
+ if (!is_gimple_assign (stmt))
return false;
- t = GIMPLE_STMT_OPERAND (t, 1);
/* Look at which bit is tested. One form to recognize is
D.1985_5 = state_3(D) >> control1_4(D);
D.1986_6 = (int) D.1985_5;
D.1987_7 = op0 & 1;
if (D.1987_7 != 0) */
- if (TREE_CODE (t) == BIT_AND_EXPR
- && integer_onep (TREE_OPERAND (t, 1))
- && TREE_CODE (TREE_OPERAND (t, 0)) == SSA_NAME)
+ if (gimple_assign_rhs_code (stmt) == BIT_AND_EXPR
+ && integer_onep (gimple_assign_rhs2 (stmt))
+ && TREE_CODE (gimple_assign_rhs1 (stmt)) == SSA_NAME)
{
- tree orig_name = TREE_OPERAND (t, 0);
+ tree orig_name = gimple_assign_rhs1 (stmt);
/* Look through copies and conversions to eventually
find the stmt that computes the shift. */
- t = orig_name;
- do {
- t = SSA_NAME_DEF_STMT (t);
- if (TREE_CODE (t) != GIMPLE_MODIFY_STMT)
- break;
- t = GIMPLE_STMT_OPERAND (t, 1);
- if (CONVERT_EXPR_P (t))
- t = TREE_OPERAND (t, 0);
- } while (TREE_CODE (t) == SSA_NAME);
+ stmt = SSA_NAME_DEF_STMT (orig_name);
+
+ while (is_gimple_assign (stmt)
+ && (gimple_assign_copy_p (stmt)
+ || (gimple_assign_cast_p (stmt)
+ && integral_operand_p (gimple_assign_lhs (stmt))
+ && integral_operand_p (gimple_assign_rhs1 (stmt))
+ && (operand_precision (gimple_assign_lhs (stmt))
+ <= operand_precision (gimple_assign_rhs1 (stmt))))))
+ {
+ stmt = SSA_NAME_DEF_STMT (gimple_assign_rhs1 (stmt));
+ }
/* If we found such, decompose it. */
- if (TREE_CODE (t) == RSHIFT_EXPR)
+ if (is_gimple_assign (stmt)
+ && gimple_assign_rhs_code (stmt) == RSHIFT_EXPR)
{
/* op0 & (1 << op1) */
- *bit = TREE_OPERAND (t, 1);
- *name = TREE_OPERAND (t, 0);
+ *bit = gimple_assign_rhs2 (stmt);
+ *name = gimple_assign_rhs1 (stmt);
}
else
{
@@ -225,13 +243,13 @@ recognize_single_bit_test (tree cond_expr, tree *name, tree *bit)
/* Another form is
D.1987_7 = op0 & (1 << CST)
if (D.1987_7 != 0) */
- if (TREE_CODE (t) == BIT_AND_EXPR
- && TREE_CODE (TREE_OPERAND (t, 0)) == SSA_NAME
- && integer_pow2p (TREE_OPERAND (t, 1)))
+ if (gimple_assign_rhs_code (stmt) == BIT_AND_EXPR
+ && TREE_CODE (gimple_assign_rhs1 (stmt)) == SSA_NAME
+ && integer_pow2p (gimple_assign_rhs2 (stmt)))
{
- *name = TREE_OPERAND (t, 0);
+ *name = gimple_assign_rhs1 (stmt);
*bit = build_int_cst (integer_type_node,
- tree_log2 (TREE_OPERAND (t, 1)));
+ tree_log2 (gimple_assign_rhs2 (stmt)));
return true;
}
@@ -239,31 +257,31 @@ recognize_single_bit_test (tree cond_expr, tree *name, tree *bit)
D.1986_6 = 1 << control1_4(D)
D.1987_7 = op0 & D.1986_6
if (D.1987_7 != 0) */
- if (TREE_CODE (t) == BIT_AND_EXPR
- && TREE_CODE (TREE_OPERAND (t, 0)) == SSA_NAME
- && TREE_CODE (TREE_OPERAND (t, 1)) == SSA_NAME)
+ if (gimple_assign_rhs_code (stmt) == BIT_AND_EXPR
+ && TREE_CODE (gimple_assign_rhs1 (stmt)) == SSA_NAME
+ && TREE_CODE (gimple_assign_rhs2 (stmt)) == SSA_NAME)
{
- tree tmp;
+ gimple tmp;
/* Both arguments of the BIT_AND_EXPR can be the single-bit
specifying expression. */
- tmp = SSA_NAME_DEF_STMT (TREE_OPERAND (t, 0));
- if (TREE_CODE (tmp) == GIMPLE_MODIFY_STMT
- && TREE_CODE (GIMPLE_STMT_OPERAND (tmp, 1)) == LSHIFT_EXPR
- && integer_onep (TREE_OPERAND (GIMPLE_STMT_OPERAND (tmp, 1), 0)))
+ tmp = SSA_NAME_DEF_STMT (gimple_assign_rhs1 (stmt));
+ if (is_gimple_assign (tmp)
+ && gimple_assign_rhs_code (tmp) == LSHIFT_EXPR
+ && integer_onep (gimple_assign_rhs1 (tmp)))
{
- *name = TREE_OPERAND (t, 1);
- *bit = TREE_OPERAND (GIMPLE_STMT_OPERAND (tmp, 1), 1);
+ *name = gimple_assign_rhs2 (stmt);
+ *bit = gimple_assign_rhs2 (tmp);
return true;
}
- tmp = SSA_NAME_DEF_STMT (TREE_OPERAND (t, 1));
- if (TREE_CODE (tmp) == GIMPLE_MODIFY_STMT
- && TREE_CODE (GIMPLE_STMT_OPERAND (tmp, 1)) == LSHIFT_EXPR
- && integer_onep (TREE_OPERAND (GIMPLE_STMT_OPERAND (tmp, 1), 0)))
+ tmp = SSA_NAME_DEF_STMT (gimple_assign_rhs2 (stmt));
+ if (is_gimple_assign (tmp)
+ && gimple_assign_rhs_code (tmp) == LSHIFT_EXPR
+ && integer_onep (gimple_assign_rhs1 (tmp)))
{
- *name = TREE_OPERAND (t, 0);
- *bit = TREE_OPERAND (GIMPLE_STMT_OPERAND (tmp, 1), 1);
+ *name = gimple_assign_rhs1 (stmt);
+ *bit = gimple_assign_rhs2 (tmp);
return true;
}
}
@@ -271,33 +289,28 @@ recognize_single_bit_test (tree cond_expr, tree *name, tree *bit)
return false;
}
-/* Recognize a bit test pattern in COND_EXPR and its defining
+/* Recognize a bit test pattern in a GIMPLE_COND and its defining
statements. Store the name being tested in *NAME and the bits
in *BITS. The COND_EXPR computes *NAME & *BITS.
Returns true if the pattern matched, false otherwise. */
static bool
-recognize_bits_test (tree cond_expr, tree *name, tree *bits)
+recognize_bits_test (gimple cond, tree *name, tree *bits)
{
- tree t;
+ gimple stmt;
/* Get at the definition of the result of the bit test. */
- t = TREE_OPERAND (cond_expr, 0);
- if (TREE_CODE (t) == NE_EXPR
- && integer_zerop (TREE_OPERAND (t, 1)))
- t = TREE_OPERAND (t, 0);
- if (TREE_CODE (t) != SSA_NAME)
- return false;
- t = SSA_NAME_DEF_STMT (t);
- if (TREE_CODE (t) != GIMPLE_MODIFY_STMT)
+ if (gimple_cond_code (cond) != NE_EXPR
+ || TREE_CODE (gimple_cond_lhs (cond)) != SSA_NAME
+ || !integer_zerop (gimple_cond_rhs (cond)))
return false;
- t = GIMPLE_STMT_OPERAND (t, 1);
-
- if (TREE_CODE (t) != BIT_AND_EXPR)
+ stmt = SSA_NAME_DEF_STMT (gimple_cond_lhs (cond));
+ if (!is_gimple_assign (stmt)
+ || gimple_assign_rhs_code (stmt) != BIT_AND_EXPR)
return false;
- *name = get_name_for_bit_test (TREE_OPERAND (t, 0));
- *bits = TREE_OPERAND (t, 1);
+ *name = get_name_for_bit_test (gimple_assign_rhs1 (stmt));
+ *bits = gimple_assign_rhs2 (stmt);
return true;
}
@@ -309,18 +322,18 @@ recognize_bits_test (tree cond_expr, tree *name, tree *bits)
static bool
ifcombine_ifandif (basic_block inner_cond_bb, basic_block outer_cond_bb)
{
- block_stmt_iterator bsi;
- tree inner_cond, outer_cond;
+ gimple_stmt_iterator gsi;
+ gimple inner_cond, outer_cond;
tree name1, name2, bit1, bit2;
inner_cond = last_stmt (inner_cond_bb);
if (!inner_cond
- || TREE_CODE (inner_cond) != COND_EXPR)
+ || gimple_code (inner_cond) != GIMPLE_COND)
return false;
outer_cond = last_stmt (outer_cond_bb);
if (!outer_cond
- || TREE_CODE (outer_cond) != COND_EXPR)
+ || gimple_code (outer_cond) != GIMPLE_COND)
return false;
/* See if we test a single bit of the same name in both tests. In
@@ -334,23 +347,23 @@ ifcombine_ifandif (basic_block inner_cond_bb, basic_block outer_cond_bb)
tree t, t2;
/* Do it. */
- bsi = bsi_for_stmt (inner_cond);
+ gsi = gsi_for_stmt (inner_cond);
t = fold_build2 (LSHIFT_EXPR, TREE_TYPE (name1),
build_int_cst (TREE_TYPE (name1), 1), bit1);
t2 = fold_build2 (LSHIFT_EXPR, TREE_TYPE (name1),
build_int_cst (TREE_TYPE (name1), 1), bit2);
t = fold_build2 (BIT_IOR_EXPR, TREE_TYPE (name1), t, t2);
- t = force_gimple_operand_bsi (&bsi, t, true, NULL_TREE,
- true, BSI_SAME_STMT);
+ t = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE,
+ true, GSI_SAME_STMT);
t2 = fold_build2 (BIT_AND_EXPR, TREE_TYPE (name1), name1, t);
- t2 = force_gimple_operand_bsi (&bsi, t2, true, NULL_TREE,
- true, BSI_SAME_STMT);
- COND_EXPR_COND (inner_cond) = fold_build2 (EQ_EXPR, boolean_type_node,
- t2, t);
+ t2 = force_gimple_operand_gsi (&gsi, t2, true, NULL_TREE,
+ true, GSI_SAME_STMT);
+ t = fold_build2 (EQ_EXPR, boolean_type_node, t2, t);
+ gimple_cond_set_condition_from_tree (inner_cond, t);
update_stmt (inner_cond);
/* Leave CFG optimization to cfg_cleanup. */
- COND_EXPR_COND (outer_cond) = boolean_true_node;
+ gimple_cond_set_condition_from_tree (outer_cond, boolean_true_node);
update_stmt (outer_cond);
if (dump_file)
@@ -378,17 +391,17 @@ ifcombine_ifandif (basic_block inner_cond_bb, basic_block outer_cond_bb)
static bool
ifcombine_iforif (basic_block inner_cond_bb, basic_block outer_cond_bb)
{
- tree inner_cond, outer_cond;
+ gimple inner_cond, outer_cond;
tree name1, name2, bits1, bits2;
inner_cond = last_stmt (inner_cond_bb);
if (!inner_cond
- || TREE_CODE (inner_cond) != COND_EXPR)
+ || gimple_code (inner_cond) != GIMPLE_COND)
return false;
outer_cond = last_stmt (outer_cond_bb);
if (!outer_cond
- || TREE_CODE (outer_cond) != COND_EXPR)
+ || gimple_code (outer_cond) != GIMPLE_COND)
return false;
/* See if we have two bit tests of the same name in both tests.
@@ -397,7 +410,7 @@ ifcombine_iforif (basic_block inner_cond_bb, basic_block outer_cond_bb)
if (recognize_bits_test (inner_cond, &name1, &bits1)
&& recognize_bits_test (outer_cond, &name2, &bits2))
{
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
tree t;
/* Find the common name which is bit-tested. */
@@ -428,19 +441,20 @@ ifcombine_iforif (basic_block inner_cond_bb, basic_block outer_cond_bb)
return false;
/* Do it. */
- bsi = bsi_for_stmt (inner_cond);
+ gsi = gsi_for_stmt (inner_cond);
t = fold_build2 (BIT_IOR_EXPR, TREE_TYPE (name1), bits1, bits2);
- t = force_gimple_operand_bsi (&bsi, t, true, NULL_TREE,
- true, BSI_SAME_STMT);
+ t = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE,
+ true, GSI_SAME_STMT);
t = fold_build2 (BIT_AND_EXPR, TREE_TYPE (name1), name1, t);
- t = force_gimple_operand_bsi (&bsi, t, true, NULL_TREE,
- true, BSI_SAME_STMT);
- COND_EXPR_COND (inner_cond) = fold_build2 (NE_EXPR, boolean_type_node, t,
- build_int_cst (TREE_TYPE (t), 0));
+ t = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE,
+ true, GSI_SAME_STMT);
+ t = fold_build2 (NE_EXPR, boolean_type_node, t,
+ build_int_cst (TREE_TYPE (t), 0));
+ gimple_cond_set_condition_from_tree (inner_cond, t);
update_stmt (inner_cond);
/* Leave CFG optimization to cfg_cleanup. */
- COND_EXPR_COND (outer_cond) = boolean_false_node;
+ gimple_cond_set_condition_from_tree (outer_cond, boolean_false_node);
update_stmt (outer_cond);
if (dump_file)
@@ -460,17 +474,15 @@ ifcombine_iforif (basic_block inner_cond_bb, basic_block outer_cond_bb)
/* See if we have two comparisons that we can merge into one.
This happens for C++ operator overloading where for example
GE_EXPR is implemented as GT_EXPR || EQ_EXPR. */
- else if (COMPARISON_CLASS_P (COND_EXPR_COND (inner_cond))
- && COMPARISON_CLASS_P (COND_EXPR_COND (outer_cond))
- && operand_equal_p (TREE_OPERAND (COND_EXPR_COND (inner_cond), 0),
- TREE_OPERAND (COND_EXPR_COND (outer_cond), 0), 0)
- && operand_equal_p (TREE_OPERAND (COND_EXPR_COND (inner_cond), 1),
- TREE_OPERAND (COND_EXPR_COND (outer_cond), 1), 0))
+ else if (TREE_CODE_CLASS (gimple_cond_code (inner_cond)) == tcc_comparison
+ && TREE_CODE_CLASS (gimple_cond_code (outer_cond)) == tcc_comparison
+ && operand_equal_p (gimple_cond_lhs (inner_cond),
+ gimple_cond_lhs (outer_cond), 0)
+ && operand_equal_p (gimple_cond_rhs (inner_cond),
+ gimple_cond_rhs (outer_cond), 0))
{
- tree ccond1 = COND_EXPR_COND (inner_cond);
- tree ccond2 = COND_EXPR_COND (outer_cond);
- enum tree_code code1 = TREE_CODE (ccond1);
- enum tree_code code2 = TREE_CODE (ccond2);
+ enum tree_code code1 = gimple_cond_code (inner_cond);
+ enum tree_code code2 = gimple_cond_code (outer_cond);
enum tree_code code;
tree t;
@@ -487,7 +499,7 @@ ifcombine_iforif (basic_block inner_cond_bb, basic_block outer_cond_bb)
code = LE_EXPR;
else if (CHK (GT, GE))
code = GE_EXPR;
- else if (INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (ccond1, 0)))
+ else if (INTEGRAL_TYPE_P (TREE_TYPE (gimple_cond_lhs (inner_cond)))
|| flag_unsafe_math_optimizations)
{
if (CHK (LT, GT))
@@ -505,16 +517,16 @@ ifcombine_iforif (basic_block inner_cond_bb, basic_block outer_cond_bb)
#undef CHK
/* Do it. */
- t = fold_build2 (code, boolean_type_node,
- TREE_OPERAND (ccond2, 0), TREE_OPERAND (ccond2, 1));
+ t = fold_build2 (code, boolean_type_node, gimple_cond_lhs (outer_cond),
+ gimple_cond_rhs (outer_cond));
t = canonicalize_cond_expr_cond (t);
if (!t)
return false;
- COND_EXPR_COND (inner_cond) = t;
+ gimple_cond_set_condition_from_tree (inner_cond, t);
update_stmt (inner_cond);
/* Leave CFG optimization to cfg_cleanup. */
- COND_EXPR_COND (outer_cond) = boolean_false_node;
+ gimple_cond_set_condition_from_tree (outer_cond, boolean_false_node);
update_stmt (outer_cond);
if (dump_file)
@@ -611,10 +623,10 @@ tree_ssa_ifcombine (void)
for (i = 0; i < n_basic_blocks - NUM_FIXED_BLOCKS; ++i)
{
basic_block bb = bbs[i];
- tree stmt = last_stmt (bb);
+ gimple stmt = last_stmt (bb);
if (stmt
- && TREE_CODE (stmt) == COND_EXPR)
+ && gimple_code (stmt) == GIMPLE_COND)
cfg_changed |= tree_ssa_ifcombine_bb (bb);
}
diff --git a/gcc/tree-ssa-live.c b/gcc/tree-ssa-live.c
index c277980ed86..fa3834d21c5 100644
--- a/gcc/tree-ssa-live.c
+++ b/gcc/tree-ssa-live.c
@@ -403,8 +403,7 @@ static inline void mark_all_vars_used (tree *, void *data);
/* Helper function for mark_all_vars_used, called via walk_tree. */
static tree
-mark_all_vars_used_1 (tree *tp, int *walk_subtrees,
- void *data)
+mark_all_vars_used_1 (tree *tp, int *walk_subtrees, void *data)
{
tree t = *tp;
enum tree_code_class c = TREE_CODE_CLASS (TREE_CODE (t));
@@ -412,8 +411,8 @@ mark_all_vars_used_1 (tree *tp, int *walk_subtrees,
if (TREE_CODE (t) == SSA_NAME)
t = SSA_NAME_VAR (t);
- if ((IS_EXPR_CODE_CLASS (c)
- || IS_GIMPLE_STMT_CODE_CLASS (c))
+
+ if (IS_EXPR_CODE_CLASS (c)
&& (b = TREE_BLOCK (t)) != NULL)
TREE_USED (b) = true;
@@ -582,7 +581,9 @@ remove_unused_locals (void)
var_ann_t ann;
bitmap global_unused_vars = NULL;
- mark_scope_block_unused (DECL_INITIAL (current_function_decl));
+ if (optimize)
+ mark_scope_block_unused (DECL_INITIAL (current_function_decl));
+
/* Assume all locals are unused. */
FOR_EACH_REFERENCED_VAR (t, rvi)
var_ann (t)->used = false;
@@ -590,23 +591,34 @@ remove_unused_locals (void)
/* Walk the CFG marking all referenced symbols. */
FOR_EACH_BB (bb)
{
- block_stmt_iterator bsi;
- tree phi, def;
+ gimple_stmt_iterator gsi;
+ size_t i;
/* Walk the statements. */
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
- mark_all_vars_used (bsi_stmt_ptr (bsi), NULL);
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ {
+ gimple stmt = gsi_stmt (gsi);
+ tree b = gimple_block (stmt);
+
+ if (b)
+ TREE_USED (b) = true;
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
+ for (i = 0; i < gimple_num_ops (stmt); i++)
+ mark_all_vars_used (gimple_op_ptr (gsi_stmt (gsi), i), NULL);
+ }
+
+ for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
use_operand_p arg_p;
ssa_op_iter i;
+ tree def;
+ gimple phi = gsi_stmt (gsi);
/* No point processing globals. */
- if (is_global_var (SSA_NAME_VAR (PHI_RESULT (phi))))
+ if (is_global_var (SSA_NAME_VAR (gimple_phi_result (phi))))
continue;
- def = PHI_RESULT (phi);
+ def = gimple_phi_result (phi);
mark_all_vars_used (&def, NULL);
FOR_EACH_PHI_ARG (arg_p, phi, i, SSA_OP_ALL_USES)
@@ -661,7 +673,8 @@ remove_unused_locals (void)
if (TREE_CODE (var) == VAR_DECL
&& is_global_var (var)
- && bitmap_bit_p (global_unused_vars, DECL_UID (var)))
+ && bitmap_bit_p (global_unused_vars, DECL_UID (var))
+ && (optimize || DECL_ARTIFICIAL (var)))
*cell = TREE_CHAIN (*cell);
else
cell = &TREE_CHAIN (*cell);
@@ -681,9 +694,11 @@ remove_unused_locals (void)
&& TREE_CODE (t) != RESULT_DECL
&& !(ann = var_ann (t))->used
&& !ann->symbol_mem_tag
- && !TREE_ADDRESSABLE (t))
+ && !TREE_ADDRESSABLE (t)
+ && (optimize || DECL_ARTIFICIAL (t)))
remove_referenced_var (t);
- remove_unused_scope_block_p (DECL_INITIAL (current_function_decl));
+ if (optimize)
+ remove_unused_scope_block_p (DECL_INITIAL (current_function_decl));
}
@@ -818,7 +833,7 @@ static void
set_var_live_on_entry (tree ssa_name, tree_live_info_p live)
{
int p;
- tree stmt;
+ gimple stmt;
use_operand_p use;
basic_block def_bb = NULL;
imm_use_iterator imm_iter;
@@ -831,7 +846,7 @@ set_var_live_on_entry (tree ssa_name, tree_live_info_p live)
stmt = SSA_NAME_DEF_STMT (ssa_name);
if (stmt)
{
- def_bb = bb_for_stmt (stmt);
+ def_bb = gimple_bb (stmt);
/* Mark defs in liveout bitmap temporarily. */
if (def_bb)
bitmap_set_bit (live->liveout[def_bb->index], p);
@@ -843,16 +858,16 @@ set_var_live_on_entry (tree ssa_name, tree_live_info_p live)
add it to the list of live on entry blocks. */
FOR_EACH_IMM_USE_FAST (use, imm_iter, ssa_name)
{
- tree use_stmt = USE_STMT (use);
+ gimple use_stmt = USE_STMT (use);
basic_block add_block = NULL;
- if (TREE_CODE (use_stmt) == PHI_NODE)
+ if (gimple_code (use_stmt) == GIMPLE_PHI)
{
/* Uses in PHI's are considered to be live at exit of the SRC block
as this is where a copy would be inserted. Check to see if it is
defined in that block, or whether its live on entry. */
int index = PHI_ARG_INDEX_FROM_USE (use);
- edge e = PHI_ARG_EDGE (use_stmt, index);
+ edge e = gimple_phi_arg_edge (use_stmt, index);
if (e->src != ENTRY_BLOCK_PTR)
{
if (e->src != def_bb)
@@ -862,7 +877,7 @@ set_var_live_on_entry (tree ssa_name, tree_live_info_p live)
else
{
/* If its not defined in this block, its live on entry. */
- basic_block use_bb = bb_for_stmt (use_stmt);
+ basic_block use_bb = gimple_bb (use_stmt);
if (use_bb != def_bb)
add_block = use_bb;
}
@@ -887,9 +902,6 @@ set_var_live_on_entry (tree ssa_name, tree_live_info_p live)
void
calculate_live_on_exit (tree_live_info_p liveinfo)
{
- unsigned i;
- int p;
- tree t, phi;
basic_block bb;
edge e;
edge_iterator ei;
@@ -901,20 +913,29 @@ calculate_live_on_exit (tree_live_info_p liveinfo)
/* Set all the live-on-exit bits for uses in PHIs. */
FOR_EACH_BB (bb)
{
+ gimple_stmt_iterator gsi;
+ size_t i;
+
/* Mark the PHI arguments which are live on exit to the pred block. */
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
- for (i = 0; i < (unsigned)PHI_NUM_ARGS (phi); i++)
- {
- t = PHI_ARG_DEF (phi, i);
- if (TREE_CODE (t) != SSA_NAME)
- continue;
- p = var_to_partition (liveinfo->map, t);
- if (p == NO_PARTITION)
- continue;
- e = PHI_ARG_EDGE (phi, i);
- if (e->src != ENTRY_BLOCK_PTR)
- bitmap_set_bit (liveinfo->liveout[e->src->index], p);
- }
+ for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ {
+ gimple phi = gsi_stmt (gsi);
+ for (i = 0; i < gimple_phi_num_args (phi); i++)
+ {
+ tree t = PHI_ARG_DEF (phi, i);
+ int p;
+
+ if (TREE_CODE (t) != SSA_NAME)
+ continue;
+
+ p = var_to_partition (liveinfo->map, t);
+ if (p == NO_PARTITION)
+ continue;
+ e = gimple_phi_arg_edge (phi, i);
+ if (e->src != ENTRY_BLOCK_PTR)
+ bitmap_set_bit (liveinfo->liveout[e->src->index], p);
+ }
+ }
/* Add each successors live on entry to this bock live on exit. */
FOR_EACH_EDGE (e, ei, bb->succs)
@@ -1063,7 +1084,7 @@ verify_live_on_entry (tree_live_info_p live)
{
unsigned i;
tree var;
- tree phi, stmt;
+ gimple stmt;
basic_block bb;
edge e;
int num;
@@ -1087,13 +1108,13 @@ verify_live_on_entry (tree_live_info_p live)
bitmap loe;
var = partition_to_var (map, i);
stmt = SSA_NAME_DEF_STMT (var);
- tmp = bb_for_stmt (stmt);
+ tmp = gimple_bb (stmt);
d = gimple_default_def (cfun, SSA_NAME_VAR (var));
loe = live_on_entry (live, e->dest);
if (loe && bitmap_bit_p (loe, i))
{
- if (!IS_EMPTY_STMT (stmt))
+ if (!gimple_nop_p (stmt))
{
num++;
print_generic_expr (stderr, var, TDF_SLIM);
@@ -1101,7 +1122,7 @@ verify_live_on_entry (tree_live_info_p live)
if (tmp)
fprintf (stderr, " in BB%d, ", tmp->index);
fprintf (stderr, "by:\n");
- print_generic_expr (stderr, stmt, TDF_SLIM);
+ print_gimple_stmt (stderr, stmt, 0, TDF_SLIM);
fprintf (stderr, "\nIt is also live-on-entry to entry BB %d",
entry_block);
fprintf (stderr, " So it appears to have multiple defs.\n");
@@ -1112,7 +1133,8 @@ verify_live_on_entry (tree_live_info_p live)
{
num++;
print_generic_expr (stderr, var, TDF_SLIM);
- fprintf (stderr, " is live-on-entry to BB%d ",entry_block);
+ fprintf (stderr, " is live-on-entry to BB%d ",
+ entry_block);
if (d)
{
fprintf (stderr, " but is not the default def of ");
@@ -1129,15 +1151,18 @@ verify_live_on_entry (tree_live_info_p live)
{
/* The only way this var shouldn't be marked live on entry is
if it occurs in a PHI argument of the block. */
- int z, ok = 0;
- for (phi = phi_nodes (e->dest);
- phi && !ok;
- phi = PHI_CHAIN (phi))
+ size_t z;
+ bool ok = false;
+ gimple_stmt_iterator gsi;
+ for (gsi = gsi_start_phis (e->dest);
+ !gsi_end_p (gsi) && !ok;
+ gsi_next (&gsi))
{
- for (z = 0; z < PHI_NUM_ARGS (phi); z++)
- if (var == PHI_ARG_DEF (phi, z))
+ gimple phi = gsi_stmt (gsi);
+ for (z = 0; z < gimple_phi_num_args (phi); z++)
+ if (var == gimple_phi_arg_def (phi, z))
{
- ok = 1;
+ ok = true;
break;
}
}
diff --git a/gcc/tree-ssa-live.h b/gcc/tree-ssa-live.h
index 4f021609b2f..de4726245f8 100644
--- a/gcc/tree-ssa-live.h
+++ b/gcc/tree-ssa-live.h
@@ -361,8 +361,8 @@ extern var_map coalesce_ssa_name (void);
/* From tree-ssa-ter.c */
-extern tree *find_replaceable_exprs (var_map);
-extern void dump_replaceable_exprs (FILE *, tree *);
+extern gimple *find_replaceable_exprs (var_map);
+extern void dump_replaceable_exprs (FILE *, gimple *);
#endif /* _TREE_SSA_LIVE_H */
diff --git a/gcc/tree-ssa-loop-ch.c b/gcc/tree-ssa-loop-ch.c
index 47b93f8beeb..9a0dca7265e 100644
--- a/gcc/tree-ssa-loop-ch.c
+++ b/gcc/tree-ssa-loop-ch.c
@@ -50,8 +50,8 @@ static bool
should_duplicate_loop_header_p (basic_block header, struct loop *loop,
int *limit)
{
- block_stmt_iterator bsi;
- tree last;
+ gimple_stmt_iterator bsi;
+ gimple last;
/* Do not copy one block more than once (we do not really want to do
loop peeling here). */
@@ -71,19 +71,19 @@ should_duplicate_loop_header_p (basic_block header, struct loop *loop,
return false;
last = last_stmt (header);
- if (TREE_CODE (last) != COND_EXPR)
+ if (gimple_code (last) != GIMPLE_COND)
return false;
/* Approximately copy the conditions that used to be used in jump.c --
at most 20 insns and no calls. */
- for (bsi = bsi_start (header); !bsi_end_p (bsi); bsi_next (&bsi))
+ for (bsi = gsi_start_bb (header); !gsi_end_p (bsi); gsi_next (&bsi))
{
- last = bsi_stmt (bsi);
+ last = gsi_stmt (bsi);
- if (TREE_CODE (last) == LABEL_EXPR)
+ if (gimple_code (last) == GIMPLE_LABEL)
continue;
- if (get_call_expr_in (last))
+ if (is_gimple_call (last))
return false;
*limit -= estimate_num_insns (last, &eni_size_weights);
@@ -99,17 +99,17 @@ should_duplicate_loop_header_p (basic_block header, struct loop *loop,
static bool
do_while_loop_p (struct loop *loop)
{
- tree stmt = last_stmt (loop->latch);
+ gimple stmt = last_stmt (loop->latch);
/* If the latch of the loop is not empty, it is not a do-while loop. */
if (stmt
- && TREE_CODE (stmt) != LABEL_EXPR)
+ && gimple_code (stmt) != GIMPLE_LABEL)
return false;
/* If the header contains just a condition, it is not a do-while loop. */
stmt = last_and_only_stmt (loop->header);
if (stmt
- && TREE_CODE (stmt) == COND_EXPR)
+ && gimple_code (stmt) == GIMPLE_COND)
return false;
return true;
@@ -196,7 +196,7 @@ copy_loop_headers (void)
entry = loop_preheader_edge (loop);
- if (!tree_duplicate_sese_region (entry, exit, bbs, n_bbs, copied_bbs))
+ if (!gimple_duplicate_sese_region (entry, exit, bbs, n_bbs, copied_bbs))
{
fprintf (dump_file, "Duplication failed.\n");
continue;
@@ -208,27 +208,27 @@ copy_loop_headers (void)
we assume that "j < j + 10" is true. We don't want to warn
about that case for -Wstrict-overflow, because in general we
don't warn about overflow involving loops. Prevent the
- warning by setting TREE_NO_WARNING. */
+ warning by setting the no_warning flag in the condition. */
if (warn_strict_overflow > 0)
{
unsigned int i;
for (i = 0; i < n_bbs; ++i)
{
- block_stmt_iterator bsi;
+ gimple_stmt_iterator bsi;
- for (bsi = bsi_start (copied_bbs[i]);
- !bsi_end_p (bsi);
- bsi_next (&bsi))
+ for (bsi = gsi_start_bb (copied_bbs[i]);
+ !gsi_end_p (bsi);
+ gsi_next (&bsi))
{
- tree stmt = bsi_stmt (bsi);
- if (TREE_CODE (stmt) == COND_EXPR)
- TREE_NO_WARNING (stmt) = 1;
- else if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT)
+ gimple stmt = gsi_stmt (bsi);
+ if (gimple_code (stmt) == GIMPLE_COND)
+ gimple_set_no_warning (stmt, true);
+ else if (is_gimple_assign (stmt))
{
- tree rhs = GIMPLE_STMT_OPERAND (stmt, 1);
- if (COMPARISON_CLASS_P (rhs))
- TREE_NO_WARNING (stmt) = 1;
+ enum tree_code rhs_code = gimple_assign_rhs_code (stmt);
+ if (TREE_CODE_CLASS (rhs_code) == tcc_comparison)
+ gimple_set_no_warning (stmt, true);
}
}
}
diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c
index 899eb8ab1a9..4c85c878e6c 100644
--- a/gcc/tree-ssa-loop-im.c
+++ b/gcc/tree-ssa-loop-im.c
@@ -70,7 +70,7 @@ along with GCC; see the file COPYING3. If not see
struct depend
{
- tree stmt;
+ gimple stmt;
struct depend *next;
};
@@ -99,16 +99,16 @@ struct lim_aux_data
MAX_LOOP loop. */
};
-#define LIM_DATA(STMT) (TREE_CODE (STMT) == PHI_NODE \
- ? NULL \
- : (struct lim_aux_data *) (stmt_ann (STMT)->common.aux))
+/* Maps statements to their lim_aux_data. */
+
+static struct pointer_map_t *lim_aux_data_map;
/* Description of a memory reference location. */
typedef struct mem_ref_loc
{
tree *ref; /* The reference itself. */
- tree stmt; /* The statement in that it occurs. */
+ gimple stmt; /* The statement in that it occurs. */
} *mem_ref_loc_p;
DEF_VEC_P(mem_ref_loc_p);
@@ -203,6 +203,51 @@ static bool ref_indep_loop_p (struct loop *, mem_ref_p);
block will be executed. */
#define ALWAYS_EXECUTED_IN(BB) ((struct loop *) (BB)->aux)
+static struct lim_aux_data *
+init_lim_data (gimple stmt)
+{
+ void **p = pointer_map_insert (lim_aux_data_map, stmt);
+
+ *p = XCNEW (struct lim_aux_data);
+ return (struct lim_aux_data *) *p;
+}
+
+static struct lim_aux_data *
+get_lim_data (gimple stmt)
+{
+ void **p = pointer_map_contains (lim_aux_data_map, stmt);
+ if (!p)
+ return NULL;
+
+ return (struct lim_aux_data *) *p;
+}
+
+/* Releases the memory occupied by DATA. */
+
+static void
+free_lim_aux_data (struct lim_aux_data *data)
+{
+ struct depend *dep, *next;
+
+ for (dep = data->depends; dep; dep = next)
+ {
+ next = dep->next;
+ free (dep);
+ }
+ free (data);
+}
+
+static void
+clear_lim_data (gimple stmt)
+{
+ void **p = pointer_map_contains (lim_aux_data_map, stmt);
+ if (!p)
+ return;
+
+ free_lim_aux_data ((struct lim_aux_data *) *p);
+ *p = NULL;
+}
+
/* Calls CBCK for each index in memory reference ADDR_P. There are two
kinds situations handled; in each of these cases, the memory reference
and DATA are passed to the callback:
@@ -301,46 +346,32 @@ for_each_index (tree *addr_p, bool (*cbck) (tree, tree *, void *), void *data)
Otherwise return MOVE_IMPOSSIBLE. */
enum move_pos
-movement_possibility (tree stmt)
+movement_possibility (gimple stmt)
{
- tree lhs, rhs;
+ tree lhs;
+ enum move_pos ret = MOVE_POSSIBLE;
if (flag_unswitch_loops
- && TREE_CODE (stmt) == COND_EXPR)
+ && gimple_code (stmt) == GIMPLE_COND)
{
/* If we perform unswitching, force the operands of the invariant
condition to be moved out of the loop. */
return MOVE_POSSIBLE;
}
- if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
+ if (gimple_get_lhs (stmt) == NULL_TREE)
return MOVE_IMPOSSIBLE;
if (!ZERO_SSA_OPERANDS (stmt, SSA_OP_VIRTUAL_DEFS))
return MOVE_IMPOSSIBLE;
- if (stmt_ends_bb_p (stmt))
- return MOVE_IMPOSSIBLE;
-
- if (stmt_ann (stmt)->has_volatile_ops)
- return MOVE_IMPOSSIBLE;
-
- lhs = GIMPLE_STMT_OPERAND (stmt, 0);
- if (TREE_CODE (lhs) == SSA_NAME
- && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (lhs))
+ if (stmt_ends_bb_p (stmt)
+ || gimple_has_volatile_ops (stmt)
+ || gimple_has_side_effects (stmt)
+ || stmt_could_throw_p (stmt))
return MOVE_IMPOSSIBLE;
- rhs = GIMPLE_STMT_OPERAND (stmt, 1);
-
- if (TREE_SIDE_EFFECTS (rhs)
- || tree_could_throw_p (rhs))
- return MOVE_IMPOSSIBLE;
-
- if (TREE_CODE (lhs) != SSA_NAME
- || tree_could_trap_p (rhs))
- return MOVE_PRESERVE_EXECUTION;
-
- if (get_call_expr_in (stmt))
+ if (is_gimple_call (stmt))
{
/* While pure or const call is guaranteed to have no side effects, we
cannot move it arbitrarily. Consider code like
@@ -360,9 +391,23 @@ movement_possibility (tree stmt)
invalid arguments, moving out a function call that is not executed
may cause performance regressions in case the call is costly and
not executed at all. */
- return MOVE_PRESERVE_EXECUTION;
+ ret = MOVE_PRESERVE_EXECUTION;
+ lhs = gimple_call_lhs (stmt);
}
- return MOVE_POSSIBLE;
+ else if (is_gimple_assign (stmt))
+ lhs = gimple_assign_lhs (stmt);
+ else
+ return MOVE_IMPOSSIBLE;
+
+ if (TREE_CODE (lhs) == SSA_NAME
+ && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (lhs))
+ return MOVE_IMPOSSIBLE;
+
+ if (TREE_CODE (lhs) != SSA_NAME
+ || gimple_could_trap_p (stmt))
+ return MOVE_PRESERVE_EXECUTION;
+
+ return ret;
}
/* Suppose that operand DEF is used inside the LOOP. Returns the outermost
@@ -373,23 +418,31 @@ movement_possibility (tree stmt)
static struct loop *
outermost_invariant_loop (tree def, struct loop *loop)
{
- tree def_stmt;
+ gimple def_stmt;
basic_block def_bb;
struct loop *max_loop;
+ struct lim_aux_data *lim_data;
- if (TREE_CODE (def) != SSA_NAME)
+ if (!def)
return superloop_at_depth (loop, 1);
+ if (TREE_CODE (def) != SSA_NAME)
+ {
+ gcc_assert (is_gimple_min_invariant (def));
+ return superloop_at_depth (loop, 1);
+ }
+
def_stmt = SSA_NAME_DEF_STMT (def);
- def_bb = bb_for_stmt (def_stmt);
+ def_bb = gimple_bb (def_stmt);
if (!def_bb)
return superloop_at_depth (loop, 1);
max_loop = find_common_loop (loop, def_bb->loop_father);
- if (LIM_DATA (def_stmt) && LIM_DATA (def_stmt)->max_loop)
+ lim_data = get_lim_data (def_stmt);
+ if (lim_data != NULL && lim_data->max_loop != NULL)
max_loop = find_common_loop (max_loop,
- loop_outer (LIM_DATA (def_stmt)->max_loop));
+ loop_outer (lim_data->max_loop));
if (max_loop == loop)
return NULL;
max_loop = superloop_at_depth (loop, loop_depth (max_loop) + 1);
@@ -397,42 +450,6 @@ outermost_invariant_loop (tree def, struct loop *loop)
return max_loop;
}
-/* Returns the outermost superloop of LOOP in that the expression EXPR is
- invariant. */
-
-static struct loop *
-outermost_invariant_loop_expr (tree expr, struct loop *loop)
-{
- enum tree_code_class codeclass = TREE_CODE_CLASS (TREE_CODE (expr));
- unsigned i, nops;
- struct loop *max_loop = superloop_at_depth (loop, 1), *aloop;
-
- if (TREE_CODE (expr) == SSA_NAME
- || TREE_CODE (expr) == INTEGER_CST
- || is_gimple_min_invariant (expr))
- return outermost_invariant_loop (expr, loop);
-
- if (codeclass != tcc_unary
- && codeclass != tcc_binary
- && codeclass != tcc_expression
- && codeclass != tcc_vl_exp
- && codeclass != tcc_comparison)
- return NULL;
-
- nops = TREE_OPERAND_LENGTH (expr);
- for (i = 0; i < nops; i++)
- {
- aloop = outermost_invariant_loop_expr (TREE_OPERAND (expr, i), loop);
- if (!aloop)
- return NULL;
-
- if (flow_loop_nested_p (max_loop, aloop))
- max_loop = aloop;
- }
-
- return max_loop;
-}
-
/* DATA is a structure containing information associated with a statement
inside LOOP. DEF is one of the operands of this statement.
@@ -449,10 +466,11 @@ static bool
add_dependency (tree def, struct lim_aux_data *data, struct loop *loop,
bool add_cost)
{
- tree def_stmt = SSA_NAME_DEF_STMT (def);
- basic_block def_bb = bb_for_stmt (def_stmt);
+ gimple def_stmt = SSA_NAME_DEF_STMT (def);
+ basic_block def_bb = gimple_bb (def_stmt);
struct loop *max_loop;
struct depend *dep;
+ struct lim_aux_data *def_data;
if (!def_bb)
return true;
@@ -464,7 +482,8 @@ add_dependency (tree def, struct lim_aux_data *data, struct loop *loop,
if (flow_loop_nested_p (data->max_loop, max_loop))
data->max_loop = max_loop;
- if (!LIM_DATA (def_stmt))
+ def_data = get_lim_data (def_stmt);
+ if (!def_data)
return true;
if (add_cost
@@ -473,7 +492,7 @@ add_dependency (tree def, struct lim_aux_data *data, struct loop *loop,
on it, we will be able to avoid creating a new register for
it (since it will be only used in these dependent invariants). */
&& def_bb->loop_father == loop)
- data->cost += LIM_DATA (def_stmt)->cost;
+ data->cost += def_data->cost;
dep = XNEW (struct depend);
dep->stmt = def_stmt;
@@ -488,36 +507,39 @@ add_dependency (tree def, struct lim_aux_data *data, struct loop *loop,
values. */
static unsigned
-stmt_cost (tree stmt)
+stmt_cost (gimple stmt)
{
- tree rhs;
+ tree fndecl;
unsigned cost = 1;
/* Always try to create possibilities for unswitching. */
- if (TREE_CODE (stmt) == COND_EXPR)
+ if (gimple_code (stmt) == GIMPLE_COND)
return LIM_EXPENSIVE;
- rhs = GENERIC_TREE_OPERAND (stmt, 1);
-
/* Hoisting memory references out should almost surely be a win. */
- if (stmt_references_memory_p (stmt))
+ if (gimple_references_memory_p (stmt))
cost += 20;
- switch (TREE_CODE (rhs))
+ if (is_gimple_call (stmt))
{
- case CALL_EXPR:
/* We should be hoisting calls if possible. */
/* Unless the call is a builtin_constant_p; this always folds to a
constant, so moving it is useless. */
- rhs = get_callee_fndecl (rhs);
- if (DECL_BUILT_IN_CLASS (rhs) == BUILT_IN_NORMAL
- && DECL_FUNCTION_CODE (rhs) == BUILT_IN_CONSTANT_P)
+ fndecl = gimple_call_fndecl (stmt);
+ if (fndecl
+ && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL
+ && DECL_FUNCTION_CODE (fndecl) == BUILT_IN_CONSTANT_P)
return 0;
- cost += 20;
- break;
+ return cost + 20;
+ }
+
+ if (gimple_code (stmt) != GIMPLE_ASSIGN)
+ return cost;
+ switch (gimple_assign_rhs_code (stmt))
+ {
case MULT_EXPR:
case TRUNC_DIV_EXPR:
case CEIL_DIV_EXPR:
@@ -575,27 +597,31 @@ outermost_indep_loop (struct loop *outer, struct loop *loop, mem_ref_p ref)
it is a store or load. Otherwise, returns NULL. */
static tree *
-simple_mem_ref_in_stmt (tree stmt, bool *is_store)
+simple_mem_ref_in_stmt (gimple stmt, bool *is_store)
{
- tree *lhs, *rhs;
+ tree *lhs;
+ enum tree_code code;
/* Recognize MEM = (SSA_NAME | invariant) and SSA_NAME = MEM patterns. */
- if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
+ if (gimple_code (stmt) != GIMPLE_ASSIGN)
return NULL;
- lhs = &GIMPLE_STMT_OPERAND (stmt, 0);
- rhs = &GIMPLE_STMT_OPERAND (stmt, 1);
+ code = gimple_assign_rhs_code (stmt);
+
+ lhs = gimple_assign_lhs_ptr (stmt);
if (TREE_CODE (*lhs) == SSA_NAME)
{
- if (!is_gimple_addressable (*rhs))
+ if (get_gimple_rhs_class (code) != GIMPLE_SINGLE_RHS
+ || !is_gimple_addressable (gimple_assign_rhs1 (stmt)))
return NULL;
*is_store = false;
- return rhs;
+ return gimple_assign_rhs1_ptr (stmt);
}
- else if (TREE_CODE (*rhs) == SSA_NAME
- || is_gimple_min_invariant (*rhs))
+ else if (code == SSA_NAME
+ || (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS
+ && is_gimple_min_invariant (gimple_assign_rhs1 (stmt))))
{
*is_store = true;
return lhs;
@@ -607,7 +633,7 @@ simple_mem_ref_in_stmt (tree stmt, bool *is_store)
/* Returns the memory reference contained in STMT. */
static mem_ref_p
-mem_ref_in_stmt (tree stmt)
+mem_ref_in_stmt (gimple stmt)
{
bool store;
tree *mem = simple_mem_ref_in_stmt (stmt, &store);
@@ -636,12 +662,12 @@ mem_ref_in_stmt (tree stmt)
is defined in, and true otherwise. */
static bool
-determine_max_movement (tree stmt, bool must_preserve_exec)
+determine_max_movement (gimple stmt, bool must_preserve_exec)
{
- basic_block bb = bb_for_stmt (stmt);
+ basic_block bb = gimple_bb (stmt);
struct loop *loop = bb->loop_father;
struct loop *level;
- struct lim_aux_data *lim_data = LIM_DATA (stmt);
+ struct lim_aux_data *lim_data = get_lim_data (stmt);
tree val;
ssa_op_iter iter;
@@ -687,24 +713,25 @@ determine_max_movement (tree stmt, bool must_preserve_exec)
operands) is hoisted at least out of the loop LEVEL. */
static void
-set_level (tree stmt, struct loop *orig_loop, struct loop *level)
+set_level (gimple stmt, struct loop *orig_loop, struct loop *level)
{
- struct loop *stmt_loop = bb_for_stmt (stmt)->loop_father;
+ struct loop *stmt_loop = gimple_bb (stmt)->loop_father;
struct depend *dep;
+ struct lim_aux_data *lim_data;
stmt_loop = find_common_loop (orig_loop, stmt_loop);
- if (LIM_DATA (stmt) && LIM_DATA (stmt)->tgt_loop)
+ lim_data = get_lim_data (stmt);
+ if (lim_data != NULL && lim_data->tgt_loop != NULL)
stmt_loop = find_common_loop (stmt_loop,
- loop_outer (LIM_DATA (stmt)->tgt_loop));
+ loop_outer (lim_data->tgt_loop));
if (flow_loop_nested_p (stmt_loop, level))
return;
- gcc_assert (LIM_DATA (stmt));
- gcc_assert (level == LIM_DATA (stmt)->max_loop
- || flow_loop_nested_p (LIM_DATA (stmt)->max_loop, level));
+ gcc_assert (level == lim_data->max_loop
+ || flow_loop_nested_p (lim_data->max_loop, level));
- LIM_DATA (stmt)->tgt_loop = level;
- for (dep = LIM_DATA (stmt)->depends; dep; dep = dep->next)
+ lim_data->tgt_loop = level;
+ for (dep = lim_data->depends; dep; dep = dep->next)
set_level (dep->stmt, orig_loop, level);
}
@@ -713,70 +740,50 @@ set_level (tree stmt, struct loop *orig_loop, struct loop *level)
information to set it more sanely. */
static void
-set_profitable_level (tree stmt)
+set_profitable_level (gimple stmt)
{
- set_level (stmt, bb_for_stmt (stmt)->loop_father, LIM_DATA (stmt)->max_loop);
+ set_level (stmt, gimple_bb (stmt)->loop_father, get_lim_data (stmt)->max_loop);
}
-/* Returns true if STMT is not a pure call. */
+/* Returns true if STMT is a call that has side effects. */
static bool
-nonpure_call_p (tree stmt)
+nonpure_call_p (gimple stmt)
{
- tree call = get_call_expr_in (stmt);
-
- if (!call)
+ if (gimple_code (stmt) != GIMPLE_CALL)
return false;
- return TREE_SIDE_EFFECTS (call) != 0;
-}
-
-/* Releases the memory occupied by DATA. */
-
-static void
-free_lim_aux_data (struct lim_aux_data *data)
-{
- struct depend *dep, *next;
-
- for (dep = data->depends; dep; dep = next)
- {
- next = dep->next;
- free (dep);
- }
- free (data);
+ return gimple_has_side_effects (stmt);
}
/* Rewrite a/b to a*(1/b). Return the invariant stmt to process. */
-static tree
-rewrite_reciprocal (block_stmt_iterator *bsi)
+static gimple
+rewrite_reciprocal (gimple_stmt_iterator *bsi)
{
- tree stmt, lhs, rhs, stmt1, stmt2, var, name, tmp;
+ gimple stmt, stmt1, stmt2;
+ tree var, name, lhs, type;
- stmt = bsi_stmt (*bsi);
- lhs = GENERIC_TREE_OPERAND (stmt, 0);
- rhs = GENERIC_TREE_OPERAND (stmt, 1);
+ stmt = gsi_stmt (*bsi);
+ lhs = gimple_assign_lhs (stmt);
+ type = TREE_TYPE (lhs);
- /* stmt must be GIMPLE_MODIFY_STMT. */
- var = create_tmp_var (TREE_TYPE (rhs), "reciptmp");
+ var = create_tmp_var (type, "reciptmp");
add_referenced_var (var);
- tmp = build2 (RDIV_EXPR, TREE_TYPE (rhs),
- build_real (TREE_TYPE (rhs), dconst1),
- TREE_OPERAND (rhs, 1));
- stmt1 = build_gimple_modify_stmt (var, tmp);
+ stmt1 = gimple_build_assign_with_ops (RDIV_EXPR,
+ var, build_real (type, dconst1), gimple_assign_rhs2 (stmt));
name = make_ssa_name (var, stmt1);
- GIMPLE_STMT_OPERAND (stmt1, 0) = name;
- tmp = build2 (MULT_EXPR, TREE_TYPE (rhs),
- name, TREE_OPERAND (rhs, 0));
- stmt2 = build_gimple_modify_stmt (lhs, tmp);
+ gimple_assign_set_lhs (stmt1, name);
+
+ stmt2 = gimple_build_assign_with_ops (MULT_EXPR, lhs, name,
+ gimple_assign_rhs1 (stmt));
/* Replace division stmt with reciprocal and multiply stmts.
The multiply stmt is not invariant, so update iterator
and avoid rescanning. */
- bsi_replace (bsi, stmt1, true);
- bsi_insert_after (bsi, stmt2, BSI_NEW_STMT);
- SSA_NAME_DEF_STMT (lhs) = stmt2;
+ gsi_replace (bsi, stmt1, true);
+ gsi_insert_after (bsi, stmt2, GSI_NEW_STMT);
/* Continue processing with invariant reciprocal statement. */
return stmt1;
@@ -785,82 +792,79 @@ rewrite_reciprocal (block_stmt_iterator *bsi)
/* Check if the pattern at *BSI is a bittest of the form
(A >> B) & 1 != 0 and in this case rewrite it to A & (1 << B) != 0. */
-static tree
-rewrite_bittest (block_stmt_iterator *bsi)
+static gimple
+rewrite_bittest (gimple_stmt_iterator *bsi)
{
- tree stmt, lhs, rhs, var, name, use_stmt, stmt1, stmt2, t;
+ gimple stmt, use_stmt, stmt1, stmt2;
+ tree lhs, var, name, t, a, b;
use_operand_p use;
- stmt = bsi_stmt (*bsi);
- lhs = GENERIC_TREE_OPERAND (stmt, 0);
- rhs = GENERIC_TREE_OPERAND (stmt, 1);
+ stmt = gsi_stmt (*bsi);
+ lhs = gimple_assign_lhs (stmt);
/* Verify that the single use of lhs is a comparison against zero. */
if (TREE_CODE (lhs) != SSA_NAME
|| !single_imm_use (lhs, &use, &use_stmt)
- || TREE_CODE (use_stmt) != COND_EXPR)
+ || gimple_code (use_stmt) != GIMPLE_COND)
return stmt;
- t = COND_EXPR_COND (use_stmt);
- if (TREE_OPERAND (t, 0) != lhs
- || (TREE_CODE (t) != NE_EXPR
- && TREE_CODE (t) != EQ_EXPR)
- || !integer_zerop (TREE_OPERAND (t, 1)))
+ if (gimple_cond_lhs (use_stmt) != lhs
+ || (gimple_cond_code (use_stmt) != NE_EXPR
+ && gimple_cond_code (use_stmt) != EQ_EXPR)
+ || !integer_zerop (gimple_cond_rhs (use_stmt)))
return stmt;
/* Get at the operands of the shift. The rhs is TMP1 & 1. */
- stmt1 = SSA_NAME_DEF_STMT (TREE_OPERAND (rhs, 0));
- if (TREE_CODE (stmt1) != GIMPLE_MODIFY_STMT)
+ stmt1 = SSA_NAME_DEF_STMT (gimple_assign_rhs1 (stmt));
+ if (gimple_code (stmt1) != GIMPLE_ASSIGN)
return stmt;
/* There is a conversion in between possibly inserted by fold. */
- t = GIMPLE_STMT_OPERAND (stmt1, 1);
- if (CONVERT_EXPR_P (t))
+ if (gimple_assign_rhs_code (stmt1) == NOP_EXPR
+ || gimple_assign_rhs_code (stmt1) == CONVERT_EXPR)
{
- t = TREE_OPERAND (t, 0);
+ t = gimple_assign_rhs1 (stmt1);
if (TREE_CODE (t) != SSA_NAME
|| !has_single_use (t))
return stmt;
stmt1 = SSA_NAME_DEF_STMT (t);
- if (TREE_CODE (stmt1) != GIMPLE_MODIFY_STMT)
+ if (gimple_code (stmt1) != GIMPLE_ASSIGN)
return stmt;
- t = GIMPLE_STMT_OPERAND (stmt1, 1);
}
/* Verify that B is loop invariant but A is not. Verify that with
all the stmt walking we are still in the same loop. */
- if (TREE_CODE (t) == RSHIFT_EXPR
- && loop_containing_stmt (stmt1) == loop_containing_stmt (stmt)
- && outermost_invariant_loop_expr (TREE_OPERAND (t, 1),
- loop_containing_stmt (stmt1)) != NULL
- && outermost_invariant_loop_expr (TREE_OPERAND (t, 0),
- loop_containing_stmt (stmt1)) == NULL)
- {
- tree a = TREE_OPERAND (t, 0);
- tree b = TREE_OPERAND (t, 1);
+ if (gimple_assign_rhs_code (stmt1) != RSHIFT_EXPR
+ || loop_containing_stmt (stmt1) != loop_containing_stmt (stmt))
+ return stmt;
+ a = gimple_assign_rhs1 (stmt1);
+ b = gimple_assign_rhs2 (stmt1);
+
+ if (outermost_invariant_loop (b, loop_containing_stmt (stmt1)) != NULL
+ && outermost_invariant_loop (a, loop_containing_stmt (stmt1)) == NULL)
+ {
/* 1 << B */
var = create_tmp_var (TREE_TYPE (a), "shifttmp");
add_referenced_var (var);
t = fold_build2 (LSHIFT_EXPR, TREE_TYPE (a),
build_int_cst (TREE_TYPE (a), 1), b);
- stmt1 = build_gimple_modify_stmt (var, t);
+ stmt1 = gimple_build_assign (var, t);
name = make_ssa_name (var, stmt1);
- GIMPLE_STMT_OPERAND (stmt1, 0) = name;
+ gimple_assign_set_lhs (stmt1, name);
/* A & (1 << B) */
t = fold_build2 (BIT_AND_EXPR, TREE_TYPE (a), a, name);
- stmt2 = build_gimple_modify_stmt (var, t);
+ stmt2 = gimple_build_assign (var, t);
name = make_ssa_name (var, stmt2);
- GIMPLE_STMT_OPERAND (stmt2, 0) = name;
+ gimple_assign_set_lhs (stmt2, name);
/* Replace the SSA_NAME we compare against zero. Adjust
the type of zero accordingly. */
SET_USE (use, name);
- TREE_OPERAND (COND_EXPR_COND (use_stmt), 1)
- = build_int_cst_type (TREE_TYPE (name), 0);
+ gimple_cond_set_rhs (use_stmt, build_int_cst_type (TREE_TYPE (name), 0));
- bsi_insert_before (bsi, stmt1, BSI_SAME_STMT);
- bsi_replace (bsi, stmt2, true);
+ gsi_insert_before (bsi, stmt1, GSI_SAME_STMT);
+ gsi_replace (bsi, stmt2, true);
return stmt1;
}
@@ -878,10 +882,11 @@ determine_invariantness_stmt (struct dom_walk_data *dw_data ATTRIBUTE_UNUSED,
basic_block bb)
{
enum move_pos pos;
- block_stmt_iterator bsi;
- tree stmt, rhs;
+ gimple_stmt_iterator bsi;
+ gimple stmt;
bool maybe_never = ALWAYS_EXECUTED_IN (bb) == NULL;
struct loop *outermost = ALWAYS_EXECUTED_IN (bb);
+ struct lim_aux_data *lim_data;
if (!loop_outer (bb->loop_father))
return;
@@ -890,9 +895,9 @@ determine_invariantness_stmt (struct dom_walk_data *dw_data ATTRIBUTE_UNUSED,
fprintf (dump_file, "Basic block %d (loop %d -- depth %d):\n\n",
bb->index, bb->loop_father->num, loop_depth (bb->loop_father));
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
{
- stmt = bsi_stmt (bsi);
+ stmt = gsi_stmt (bsi);
pos = movement_possibility (stmt);
if (pos == MOVE_IMPOSSIBLE)
@@ -906,61 +911,63 @@ determine_invariantness_stmt (struct dom_walk_data *dw_data ATTRIBUTE_UNUSED,
store-motion work. */
else if (stmt_makes_single_store (stmt))
{
- stmt_ann (stmt)->common.aux
- = xcalloc (1, sizeof (struct lim_aux_data));
- LIM_DATA (stmt)->always_executed_in = outermost;
+ struct lim_aux_data *lim_data = init_lim_data (stmt);
+ lim_data->always_executed_in = outermost;
}
continue;
}
- if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT)
+ if (is_gimple_assign (stmt)
+ && (get_gimple_rhs_class (gimple_assign_rhs_code (stmt))
+ == GIMPLE_BINARY_RHS))
{
- rhs = GIMPLE_STMT_OPERAND (stmt, 1);
+ tree op0 = gimple_assign_rhs1 (stmt);
+ tree op1 = gimple_assign_rhs2 (stmt);
+ struct loop *ol1 = outermost_invariant_loop (op1,
+ loop_containing_stmt (stmt));
/* If divisor is invariant, convert a/b to a*(1/b), allowing reciprocal
to be hoisted out of loop, saving expensive divide. */
if (pos == MOVE_POSSIBLE
- && TREE_CODE (rhs) == RDIV_EXPR
+ && gimple_assign_rhs_code (stmt) == RDIV_EXPR
&& flag_unsafe_math_optimizations
&& !flag_trapping_math
- && outermost_invariant_loop_expr (TREE_OPERAND (rhs, 1),
- loop_containing_stmt (stmt)) != NULL
- && outermost_invariant_loop_expr (rhs,
- loop_containing_stmt (stmt)) == NULL)
+ && ol1 != NULL
+ && outermost_invariant_loop (op0, ol1) == NULL)
stmt = rewrite_reciprocal (&bsi);
/* If the shift count is invariant, convert (A >> B) & 1 to
A & (1 << B) allowing the bit mask to be hoisted out of the loop
saving an expensive shift. */
if (pos == MOVE_POSSIBLE
- && TREE_CODE (rhs) == BIT_AND_EXPR
- && integer_onep (TREE_OPERAND (rhs, 1))
- && TREE_CODE (TREE_OPERAND (rhs, 0)) == SSA_NAME
- && has_single_use (TREE_OPERAND (rhs, 0)))
+ && gimple_assign_rhs_code (stmt) == BIT_AND_EXPR
+ && integer_onep (op1)
+ && TREE_CODE (op0) == SSA_NAME
+ && has_single_use (op0))
stmt = rewrite_bittest (&bsi);
}
- stmt_ann (stmt)->common.aux = xcalloc (1, sizeof (struct lim_aux_data));
- LIM_DATA (stmt)->always_executed_in = outermost;
+ lim_data = init_lim_data (stmt);
+ lim_data->always_executed_in = outermost;
if (maybe_never && pos == MOVE_PRESERVE_EXECUTION)
continue;
if (!determine_max_movement (stmt, pos == MOVE_PRESERVE_EXECUTION))
{
- LIM_DATA (stmt)->max_loop = NULL;
+ lim_data->max_loop = NULL;
continue;
}
if (dump_file && (dump_flags & TDF_DETAILS))
{
- print_generic_stmt_indented (dump_file, stmt, 0, 2);
+ print_gimple_stmt (dump_file, stmt, 2, 0);
fprintf (dump_file, " invariant up to level %d, cost %d.\n\n",
- loop_depth (LIM_DATA (stmt)->max_loop),
- LIM_DATA (stmt)->cost);
+ loop_depth (lim_data->max_loop),
+ lim_data->cost);
}
- if (LIM_DATA (stmt)->cost >= LIM_EXPENSIVE)
+ if (lim_data->cost >= LIM_EXPENSIVE)
set_profitable_level (stmt);
}
}
@@ -993,50 +1000,51 @@ move_computations_stmt (struct dom_walk_data *dw_data ATTRIBUTE_UNUSED,
basic_block bb)
{
struct loop *level;
- block_stmt_iterator bsi;
- tree stmt;
+ gimple_stmt_iterator bsi;
+ gimple stmt;
unsigned cost = 0;
+ struct lim_aux_data *lim_data;
if (!loop_outer (bb->loop_father))
return;
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); )
+ for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); )
{
- stmt = bsi_stmt (bsi);
+ stmt = gsi_stmt (bsi);
- if (!LIM_DATA (stmt))
+ lim_data = get_lim_data (stmt);
+ if (lim_data == NULL)
{
- bsi_next (&bsi);
+ gsi_next (&bsi);
continue;
}
- cost = LIM_DATA (stmt)->cost;
- level = LIM_DATA (stmt)->tgt_loop;
- free_lim_aux_data (LIM_DATA (stmt));
- stmt_ann (stmt)->common.aux = NULL;
+ cost = lim_data->cost;
+ level = lim_data->tgt_loop;
+ clear_lim_data (stmt);
if (!level)
{
- bsi_next (&bsi);
+ gsi_next (&bsi);
continue;
}
/* We do not really want to move conditionals out of the loop; we just
placed it here to force its operands to be moved if necessary. */
- if (TREE_CODE (stmt) == COND_EXPR)
+ if (gimple_code (stmt) == GIMPLE_COND)
continue;
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Moving statement\n");
- print_generic_stmt (dump_file, stmt, 0);
+ print_gimple_stmt (dump_file, stmt, 0, 0);
fprintf (dump_file, "(cost %u) out of loop %d.\n\n",
cost, level->num);
}
mark_virtual_ops_for_renaming (stmt);
- bsi_insert_on_edge (loop_preheader_edge (level), stmt);
- bsi_remove (&bsi, false);
+ gsi_insert_on_edge (loop_preheader_edge (level), stmt);
+ gsi_remove (&bsi, false);
}
}
@@ -1056,7 +1064,7 @@ move_computations (void)
walk_dominator_tree (&walk_data, ENTRY_BLOCK_PTR);
fini_walk_dominator_tree (&walk_data);
- bsi_commit_edge_inserts ();
+ gsi_commit_edge_inserts ();
if (need_ssa_update_p ())
rewrite_into_loop_closed_ssa (NULL, TODO_update_ssa);
}
@@ -1067,20 +1075,20 @@ move_computations (void)
static bool
may_move_till (tree ref, tree *index, void *data)
{
- struct loop *loop = (struct loop*) data, *max_loop;
+ struct loop *loop = (struct loop *) data, *max_loop;
/* If REF is an array reference, check also that the step and the lower
bound is invariant in LOOP. */
if (TREE_CODE (ref) == ARRAY_REF)
{
- tree step = array_ref_element_size (ref);
- tree lbound = array_ref_low_bound (ref);
+ tree step = TREE_OPERAND (ref, 3);
+ tree lbound = TREE_OPERAND (ref, 2);
- max_loop = outermost_invariant_loop_expr (step, loop);
+ max_loop = outermost_invariant_loop (step, loop);
if (!max_loop)
return false;
- max_loop = outermost_invariant_loop_expr (lbound, loop);
+ max_loop = outermost_invariant_loop (lbound, loop);
if (!max_loop)
return false;
}
@@ -1092,35 +1100,25 @@ may_move_till (tree ref, tree *index, void *data)
return true;
}
-/* Forces statements defining (invariant) SSA names in expression EXPR to be
+/* If OP is SSA NAME, force the statement that defines it to be
moved out of the LOOP. ORIG_LOOP is the loop in that EXPR is used. */
static void
-force_move_till_expr (tree expr, struct loop *orig_loop, struct loop *loop)
+force_move_till_op (tree op, struct loop *orig_loop, struct loop *loop)
{
- enum tree_code_class codeclass = TREE_CODE_CLASS (TREE_CODE (expr));
- unsigned i, nops;
-
- if (TREE_CODE (expr) == SSA_NAME)
- {
- tree stmt = SSA_NAME_DEF_STMT (expr);
- if (IS_EMPTY_STMT (stmt))
- return;
+ gimple stmt;
- set_level (stmt, orig_loop, loop);
- return;
- }
+ if (!op
+ || is_gimple_min_invariant (op))
+ return;
- if (codeclass != tcc_unary
- && codeclass != tcc_binary
- && codeclass != tcc_expression
- && codeclass != tcc_vl_exp
- && codeclass != tcc_comparison)
+ gcc_assert (TREE_CODE (op) == SSA_NAME);
+
+ stmt = SSA_NAME_DEF_STMT (op);
+ if (gimple_nop_p (stmt))
return;
- nops = TREE_OPERAND_LENGTH (expr);
- for (i = 0; i < nops; i++)
- force_move_till_expr (TREE_OPERAND (expr, i), orig_loop, loop);
+ set_level (stmt, orig_loop, loop);
}
/* Forces statement defining invariants in REF (and *INDEX) to be moved out of
@@ -1136,26 +1134,18 @@ struct fmt_data
static bool
force_move_till (tree ref, tree *index, void *data)
{
- tree stmt;
struct fmt_data *fmt_data = (struct fmt_data *) data;
if (TREE_CODE (ref) == ARRAY_REF)
{
- tree step = array_ref_element_size (ref);
- tree lbound = array_ref_low_bound (ref);
+ tree step = TREE_OPERAND (ref, 3);
+ tree lbound = TREE_OPERAND (ref, 2);
- force_move_till_expr (step, fmt_data->orig_loop, fmt_data->loop);
- force_move_till_expr (lbound, fmt_data->orig_loop, fmt_data->loop);
+ force_move_till_op (step, fmt_data->orig_loop, fmt_data->loop);
+ force_move_till_op (lbound, fmt_data->orig_loop, fmt_data->loop);
}
- if (TREE_CODE (*index) != SSA_NAME)
- return true;
-
- stmt = SSA_NAME_DEF_STMT (*index);
- if (IS_EMPTY_STMT (stmt))
- return true;
-
- set_level (stmt, fmt_data->orig_loop, fmt_data->loop);
+ force_move_till_op (*index, fmt_data->orig_loop, fmt_data->loop);
return true;
}
@@ -1256,7 +1246,7 @@ mem_ref_locs_alloc (void)
description REF. The reference occurs in statement STMT. */
static void
-record_mem_ref_loc (mem_ref_p ref, struct loop *loop, tree stmt, tree *loc)
+record_mem_ref_loc (mem_ref_p ref, struct loop *loop, gimple stmt, tree *loc)
{
mem_ref_loc_p aref = XNEW (struct mem_ref_loc);
mem_ref_locs_p accs;
@@ -1298,7 +1288,7 @@ mark_ref_stored (mem_ref_p ref, struct loop *loop)
well. */
static void
-gather_mem_refs_stmt (struct loop *loop, tree stmt)
+gather_mem_refs_stmt (struct loop *loop, gimple stmt)
{
tree *mem = NULL;
hashval_t hash;
@@ -1358,7 +1348,7 @@ fail:
static void
gather_mem_refs_in_loops (void)
{
- block_stmt_iterator bsi;
+ gimple_stmt_iterator bsi;
basic_block bb;
struct loop *loop;
loop_iterator li;
@@ -1371,8 +1361,8 @@ gather_mem_refs_in_loops (void)
if (loop == current_loops->tree_root)
continue;
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
- gather_mem_refs_stmt (loop, bsi_stmt (bsi));
+ for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
+ gather_mem_refs_stmt (loop, gsi_stmt (bsi));
}
/* Propagate the information about clobbered vops and accessed memory
@@ -1826,9 +1816,10 @@ execute_sm (struct loop *loop, VEC (edge, heap) *exits, mem_ref_p ref)
{
tree tmp_var;
unsigned i;
- tree load, store;
+ gimple load, store;
struct fmt_data fmt_data;
edge ex;
+ struct lim_aux_data *lim_data;
if (dump_file && (dump_flags & TDF_DETAILS))
{
@@ -1847,19 +1838,19 @@ execute_sm (struct loop *loop, VEC (edge, heap) *exits, mem_ref_p ref)
rewrite_mem_refs (loop, ref, tmp_var);
/* Emit the load & stores. */
- load = build_gimple_modify_stmt (tmp_var, unshare_expr (ref->mem));
- get_stmt_ann (load)->common.aux = xcalloc (1, sizeof (struct lim_aux_data));
- LIM_DATA (load)->max_loop = loop;
- LIM_DATA (load)->tgt_loop = loop;
+ load = gimple_build_assign (tmp_var, unshare_expr (ref->mem));
+ lim_data = init_lim_data (load);
+ lim_data->max_loop = loop;
+ lim_data->tgt_loop = loop;
/* Put this into the latch, so that we are sure it will be processed after
all dependencies. */
- bsi_insert_on_edge (loop_latch_edge (loop), load);
+ gsi_insert_on_edge (loop_latch_edge (loop), load);
for (i = 0; VEC_iterate (edge, exits, i, ex); i++)
{
- store = build_gimple_modify_stmt (unshare_expr (ref->mem), tmp_var);
- bsi_insert_on_edge (ex, store);
+ store = gimple_build_assign (unshare_expr (ref->mem), tmp_var);
+ gsi_insert_on_edge (ex, store);
}
}
@@ -1895,10 +1886,10 @@ ref_always_accessed_p (struct loop *loop, mem_ref_p ref)
get_all_locs_in_loop (loop, ref, &locs);
for (i = 0; VEC_iterate (mem_ref_loc_p, locs, i, loc); i++)
{
- if (!LIM_DATA (loc->stmt))
+ if (!get_lim_data (loc->stmt))
continue;
- must_exec = LIM_DATA (loc->stmt)->always_executed_in;
+ must_exec = get_lim_data (loc->stmt)->always_executed_in;
if (!must_exec)
continue;
@@ -2135,7 +2126,7 @@ store_motion (void)
store_motion_loop (loop, sm_executed);
BITMAP_FREE (sm_executed);
- bsi_commit_edge_inserts ();
+ gsi_commit_edge_inserts ();
}
/* Fills ALWAYS_EXECUTED_IN information for basic blocks of LOOP, i.e.
@@ -2212,20 +2203,20 @@ static void
tree_ssa_lim_initialize (void)
{
sbitmap contains_call = sbitmap_alloc (last_basic_block);
- block_stmt_iterator bsi;
+ gimple_stmt_iterator bsi;
struct loop *loop;
basic_block bb;
sbitmap_zero (contains_call);
FOR_EACH_BB (bb)
{
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
{
- if (nonpure_call_p (bsi_stmt (bsi)))
+ if (nonpure_call_p (gsi_stmt (bsi)))
break;
}
- if (!bsi_end_p (bsi))
+ if (!gsi_end_p (bsi))
SET_BIT (contains_call, bb->index);
}
@@ -2233,6 +2224,8 @@ tree_ssa_lim_initialize (void)
fill_always_executed_in (loop, contains_call);
sbitmap_free (contains_call);
+
+ lim_aux_data_map = pointer_map_create ();
}
/* Cleans up after the invariant motion pass. */
@@ -2250,6 +2243,8 @@ tree_ssa_lim_finalize (void)
bb->aux = NULL;
}
+ pointer_map_destroy (lim_aux_data_map);
+
VEC_free (mem_ref_p, heap, memory_accesses.refs_list);
htab_delete (memory_accesses.refs);
diff --git a/gcc/tree-ssa-loop-ivcanon.c b/gcc/tree-ssa-loop-ivcanon.c
index 67af0b374d6..00965465342 100644
--- a/gcc/tree-ssa-loop-ivcanon.c
+++ b/gcc/tree-ssa-loop-ivcanon.c
@@ -1,5 +1,5 @@
/* Induction variable canonicalization.
- Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
This file is part of GCC.
@@ -72,8 +72,9 @@ static void
create_canonical_iv (struct loop *loop, edge exit, tree niter)
{
edge in;
- tree cond, type, var;
- block_stmt_iterator incr_at;
+ tree type, var;
+ gimple cond;
+ gimple_stmt_iterator incr_at;
enum tree_code cmp;
if (dump_file && (dump_flags & TDF_DETAILS))
@@ -97,16 +98,16 @@ create_canonical_iv (struct loop *loop, edge exit, tree niter)
niter = fold_build2 (PLUS_EXPR, type,
niter,
build_int_cst (type, 1));
- incr_at = bsi_last (in->src);
+ incr_at = gsi_last_bb (in->src);
create_iv (niter,
build_int_cst (type, -1),
NULL_TREE, loop,
&incr_at, false, NULL, &var);
cmp = (exit->flags & EDGE_TRUE_VALUE) ? EQ_EXPR : NE_EXPR;
- COND_EXPR_COND (cond) = build2 (cmp, boolean_type_node,
- var,
- build_int_cst (type, 0));
+ gimple_cond_set_code (cond, cmp);
+ gimple_cond_set_lhs (cond, var);
+ gimple_cond_set_rhs (cond, build_int_cst (type, 0));
update_stmt (cond);
}
@@ -116,12 +117,12 @@ unsigned
tree_num_loop_insns (struct loop *loop, eni_weights *weights)
{
basic_block *body = get_loop_body (loop);
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
unsigned size = 1, i;
for (i = 0; i < loop->num_nodes; i++)
- for (bsi = bsi_start (body[i]); !bsi_end_p (bsi); bsi_next (&bsi))
- size += estimate_num_insns (bsi_stmt (bsi), weights);
+ for (gsi = gsi_start_bb (body[i]); !gsi_end_p (gsi); gsi_next (&gsi))
+ size += estimate_num_insns (gsi_stmt (gsi), weights);
free (body);
return size;
@@ -163,7 +164,7 @@ try_unroll_loop_completely (struct loop *loop,
enum unroll_level ul)
{
unsigned HOST_WIDE_INT n_unroll, ninsns, max_unroll, unr_insns;
- tree cond;
+ gimple cond;
if (loop->inner)
return false;
@@ -183,10 +184,6 @@ try_unroll_loop_completely (struct loop *loop,
ninsns = tree_num_loop_insns (loop, &eni_size_weights);
- if (n_unroll * ninsns
- > (unsigned) PARAM_VALUE (PARAM_MAX_COMPLETELY_PEELED_INSNS))
- return false;
-
unr_insns = estimated_unrolled_size (ninsns, n_unroll);
if (dump_file && (dump_flags & TDF_DETAILS))
{
@@ -195,6 +192,17 @@ try_unroll_loop_completely (struct loop *loop,
(int) unr_insns);
}
+ if (unr_insns > ninsns
+ && (unr_insns
+ > (unsigned) PARAM_VALUE (PARAM_MAX_COMPLETELY_PEELED_INSNS)))
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "Not unrolling loop %d "
+ "(--param max-completely-peeled-insns limit reached).\n",
+ loop->num);
+ return false;
+ }
+
if (ul == UL_NO_GROWTH
&& unr_insns > ninsns)
{
@@ -216,11 +224,11 @@ try_unroll_loop_completely (struct loop *loop,
sbitmap_ones (wont_exit);
RESET_BIT (wont_exit, 0);
- if (!tree_duplicate_loop_to_header_edge (loop, loop_preheader_edge (loop),
- n_unroll, wont_exit,
- exit, &to_remove,
- DLTHE_FLAG_UPDATE_FREQ
- | DLTHE_FLAG_COMPLETTE_PEEL))
+ if (!gimple_duplicate_loop_to_header_edge (loop, loop_preheader_edge (loop),
+ n_unroll, wont_exit,
+ exit, &to_remove,
+ DLTHE_FLAG_UPDATE_FREQ
+ | DLTHE_FLAG_COMPLETTE_PEEL))
{
free_original_copy_tables ();
free (wont_exit);
@@ -239,8 +247,10 @@ try_unroll_loop_completely (struct loop *loop,
}
cond = last_stmt (exit->src);
- COND_EXPR_COND (cond) = (exit->flags & EDGE_TRUE_VALUE) ? boolean_true_node
- : boolean_false_node;
+ if (exit->flags & EDGE_TRUE_VALUE)
+ gimple_cond_make_true (cond);
+ else
+ gimple_cond_make_false (cond);
update_stmt (cond);
update_ssa (TODO_update_ssa);
@@ -386,11 +396,9 @@ empty_loop_p (struct loop *loop)
{
edge exit;
struct tree_niter_desc niter;
- tree phi, def;
basic_block *body;
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
unsigned i;
- tree stmt;
/* If the loop has multiple exits, it is too hard for us to handle.
Similarly, if the exit is not dominating, we cannot determine
@@ -404,8 +412,11 @@ empty_loop_p (struct loop *loop)
return false;
/* Values of all loop exit phi nodes must be invariants. */
- for (phi = phi_nodes (exit->dest); phi; phi = PHI_CHAIN (phi))
+ for (gsi = gsi_start(phi_nodes (exit->dest)); !gsi_end_p (gsi); gsi_next (&gsi))
{
+ gimple phi = gsi_stmt (gsi);
+ tree def;
+
if (!is_gimple_reg (PHI_RESULT (phi)))
continue;
@@ -427,11 +438,12 @@ empty_loop_p (struct loop *loop)
return false;
}
- for (bsi = bsi_start (body[i]); !bsi_end_p (bsi); bsi_next (&bsi))
+ for (gsi = gsi_start_bb (body[i]); !gsi_end_p (gsi); gsi_next (&gsi))
{
- stmt = bsi_stmt (bsi);
+ gimple stmt = gsi_stmt (gsi);
+
if (!ZERO_SSA_OPERANDS (stmt, SSA_OP_VIRTUAL_DEFS)
- || stmt_ann (stmt)->has_volatile_ops)
+ || gimple_has_volatile_ops (stmt))
{
free (body);
return false;
@@ -439,25 +451,19 @@ empty_loop_p (struct loop *loop)
/* Also, asm statements and calls may have side effects and we
cannot change the number of times they are executed. */
- switch (TREE_CODE (stmt))
+ switch (gimple_code (stmt))
{
- case RETURN_EXPR:
- case GIMPLE_MODIFY_STMT:
- stmt = get_call_expr_in (stmt);
- if (!stmt)
- break;
-
- case CALL_EXPR:
- if (TREE_SIDE_EFFECTS (stmt))
+ case GIMPLE_CALL:
+ if (gimple_has_side_effects (stmt))
{
free (body);
return false;
}
break;
- case ASM_EXPR:
+ case GIMPLE_ASM:
/* We cannot remove volatile assembler. */
- if (ASM_VOLATILE_P (stmt))
+ if (gimple_asm_volatile_p (stmt))
{
free (body);
return false;
@@ -480,8 +486,7 @@ static void
remove_empty_loop (struct loop *loop)
{
edge exit = single_dom_exit (loop), non_exit;
- tree cond_stmt = last_stmt (exit->src);
- tree do_exit;
+ gimple cond_stmt = last_stmt (exit->src);
basic_block *body;
unsigned n_before, freq_in, freq_h;
gcov_type exit_count = exit->count;
@@ -494,11 +499,9 @@ remove_empty_loop (struct loop *loop)
non_exit = EDGE_SUCC (exit->src, 1);
if (exit->flags & EDGE_TRUE_VALUE)
- do_exit = boolean_true_node;
+ gimple_cond_make_true (cond_stmt);
else
- do_exit = boolean_false_node;
-
- COND_EXPR_COND (cond_stmt) = do_exit;
+ gimple_cond_make_false (cond_stmt);
update_stmt (cond_stmt);
/* Let us set the probabilities of the edges coming from the exit block. */
@@ -569,3 +572,4 @@ remove_empty_loops (void)
}
return 0;
}
+
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c
index ce5c05cd88f..1a1e58b1a81 100644
--- a/gcc/tree-ssa-loop-ivopts.c
+++ b/gcc/tree-ssa-loop-ivopts.c
@@ -163,7 +163,7 @@ struct iv_use
unsigned id; /* The id of the use. */
enum use_type type; /* Type of the use. */
struct iv *iv; /* The induction variable it is based on. */
- tree stmt; /* Statement in that it occurs. */
+ gimple stmt; /* Statement in that it occurs. */
tree *op_p; /* The place where it occurs. */
bitmap related_cands; /* The set of "related" iv candidates, plus the common
important ones. */
@@ -191,7 +191,7 @@ struct iv_cand
bool important; /* Whether this is an "important" candidate, i.e. such
that it should be considered by all uses. */
enum iv_position pos; /* Where it is computed. */
- tree incremented_at; /* For original biv, the statement where it is
+ gimple incremented_at;/* For original biv, the statement where it is
incremented. */
tree var_before; /* The variable used for it before increment. */
tree var_after; /* The variable used for it after increment. */
@@ -448,7 +448,7 @@ dump_use (FILE *file, struct iv_use *use)
}
fprintf (file, " in statement ");
- print_generic_expr (file, use->stmt, TDF_SLIM);
+ print_gimple_stmt (file, use->stmt, 0, 0);
fprintf (file, "\n");
fprintf (file, " at position ");
@@ -544,9 +544,9 @@ name_info (struct ivopts_data *data, tree name)
emitted in LOOP. */
static bool
-stmt_after_ip_normal_pos (struct loop *loop, tree stmt)
+stmt_after_ip_normal_pos (struct loop *loop, gimple stmt)
{
- basic_block bb = ip_normal_pos (loop), sbb = bb_for_stmt (stmt);
+ basic_block bb = ip_normal_pos (loop), sbb = gimple_bb (stmt);
gcc_assert (bb);
@@ -563,11 +563,11 @@ stmt_after_ip_normal_pos (struct loop *loop, tree stmt)
variable CAND is incremented. */
static bool
-stmt_after_ip_original_pos (struct iv_cand *cand, tree stmt)
+stmt_after_ip_original_pos (struct iv_cand *cand, gimple stmt)
{
- basic_block cand_bb = bb_for_stmt (cand->incremented_at);
- basic_block stmt_bb = bb_for_stmt (stmt);
- block_stmt_iterator bsi;
+ basic_block cand_bb = gimple_bb (cand->incremented_at);
+ basic_block stmt_bb = gimple_bb (stmt);
+ gimple_stmt_iterator bsi;
if (!dominated_by_p (CDI_DOMINATORS, stmt_bb, cand_bb))
return false;
@@ -577,11 +577,11 @@ stmt_after_ip_original_pos (struct iv_cand *cand, tree stmt)
/* Scan the block from the end, since the original ivs are usually
incremented at the end of the loop body. */
- for (bsi = bsi_last (stmt_bb); ; bsi_prev (&bsi))
+ for (bsi = gsi_last_bb (stmt_bb); ; gsi_prev (&bsi))
{
- if (bsi_stmt (bsi) == cand->incremented_at)
+ if (gsi_stmt (bsi) == cand->incremented_at)
return false;
- if (bsi_stmt (bsi) == stmt)
+ if (gsi_stmt (bsi) == stmt)
return true;
}
}
@@ -590,7 +590,7 @@ stmt_after_ip_original_pos (struct iv_cand *cand, tree stmt)
CAND is incremented in LOOP. */
static bool
-stmt_after_increment (struct loop *loop, struct iv_cand *cand, tree stmt)
+stmt_after_increment (struct loop *loop, struct iv_cand *cand, gimple stmt)
{
switch (cand->pos)
{
@@ -858,7 +858,7 @@ get_iv (struct ivopts_data *data, tree var)
if (!name_info (data, var)->iv)
{
- bb = bb_for_stmt (SSA_NAME_DEF_STMT (var));
+ bb = gimple_bb (SSA_NAME_DEF_STMT (var));
if (!bb
|| !flow_bb_inside_loop_p (data->current_loop, bb))
@@ -872,9 +872,9 @@ get_iv (struct ivopts_data *data, tree var)
not define a simple affine biv with nonzero step. */
static tree
-determine_biv_step (tree phi)
+determine_biv_step (gimple phi)
{
- struct loop *loop = bb_for_stmt (phi)->loop_father;
+ struct loop *loop = gimple_bb (phi)->loop_father;
tree name = PHI_RESULT (phi);
affine_iv iv;
@@ -892,12 +892,16 @@ determine_biv_step (tree phi)
static bool
find_bivs (struct ivopts_data *data)
{
- tree phi, step, type, base;
+ gimple phi;
+ tree step, type, base;
bool found = false;
struct loop *loop = data->current_loop;
+ gimple_stmt_iterator psi;
- for (phi = phi_nodes (loop->header); phi; phi = PHI_CHAIN (phi))
+ for (psi = gsi_start_phis (loop->header); !gsi_end_p (psi); gsi_next (&psi))
{
+ phi = gsi_stmt (psi);
+
if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (PHI_RESULT (phi)))
continue;
@@ -933,13 +937,17 @@ find_bivs (struct ivopts_data *data)
static void
mark_bivs (struct ivopts_data *data)
{
- tree phi, var;
+ gimple phi;
+ tree var;
struct iv *iv, *incr_iv;
struct loop *loop = data->current_loop;
basic_block incr_bb;
+ gimple_stmt_iterator psi;
- for (phi = phi_nodes (loop->header); phi; phi = PHI_CHAIN (phi))
+ for (psi = gsi_start_phis (loop->header); !gsi_end_p (psi); gsi_next (&psi))
{
+ phi = gsi_stmt (psi);
+
iv = get_iv (data, PHI_RESULT (phi));
if (!iv)
continue;
@@ -950,7 +958,7 @@ mark_bivs (struct ivopts_data *data)
continue;
/* If the increment is in the subloop, ignore it. */
- incr_bb = bb_for_stmt (SSA_NAME_DEF_STMT (var));
+ incr_bb = gimple_bb (SSA_NAME_DEF_STMT (var));
if (incr_bb->loop_father != data->current_loop
|| (incr_bb->flags & BB_IRREDUCIBLE_LOOP))
continue;
@@ -964,7 +972,7 @@ mark_bivs (struct ivopts_data *data)
parameters to IV. */
static bool
-find_givs_in_stmt_scev (struct ivopts_data *data, tree stmt, affine_iv *iv)
+find_givs_in_stmt_scev (struct ivopts_data *data, gimple stmt, affine_iv *iv)
{
tree lhs;
struct loop *loop = data->current_loop;
@@ -972,14 +980,14 @@ find_givs_in_stmt_scev (struct ivopts_data *data, tree stmt, affine_iv *iv)
iv->base = NULL_TREE;
iv->step = NULL_TREE;
- if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
+ if (gimple_code (stmt) != GIMPLE_ASSIGN)
return false;
- lhs = GIMPLE_STMT_OPERAND (stmt, 0);
+ lhs = gimple_assign_lhs (stmt);
if (TREE_CODE (lhs) != SSA_NAME)
return false;
- if (!simple_iv (loop, stmt, GIMPLE_STMT_OPERAND (stmt, 1), iv, true))
+ if (!simple_iv (loop, stmt, lhs, iv, true))
return false;
iv->base = expand_simple_operations (iv->base);
@@ -993,14 +1001,14 @@ find_givs_in_stmt_scev (struct ivopts_data *data, tree stmt, affine_iv *iv)
/* Finds general ivs in statement STMT. */
static void
-find_givs_in_stmt (struct ivopts_data *data, tree stmt)
+find_givs_in_stmt (struct ivopts_data *data, gimple stmt)
{
affine_iv iv;
if (!find_givs_in_stmt_scev (data, stmt, &iv))
return;
- set_iv (data, GIMPLE_STMT_OPERAND (stmt, 0), iv.base, iv.step);
+ set_iv (data, gimple_assign_lhs (stmt), iv.base, iv.step);
}
/* Finds general ivs in basic block BB. */
@@ -1008,10 +1016,10 @@ find_givs_in_stmt (struct ivopts_data *data, tree stmt)
static void
find_givs_in_bb (struct ivopts_data *data, basic_block bb)
{
- block_stmt_iterator bsi;
+ gimple_stmt_iterator bsi;
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
- find_givs_in_stmt (data, bsi_stmt (bsi));
+ for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
+ find_givs_in_stmt (data, gsi_stmt (bsi));
}
/* Finds general ivs. */
@@ -1070,7 +1078,7 @@ find_induction_variables (struct ivopts_data *data)
static struct iv_use *
record_use (struct ivopts_data *data, tree *use_p, struct iv *iv,
- tree stmt, enum use_type use_type)
+ gimple stmt, enum use_type use_type)
{
struct iv_use *use = XCNEW (struct iv_use);
@@ -1107,7 +1115,7 @@ record_invariant (struct ivopts_data *data, tree op, bool nonlinear_use)
|| !is_gimple_reg (op))
return;
- bb = bb_for_stmt (SSA_NAME_DEF_STMT (op));
+ bb = gimple_bb (SSA_NAME_DEF_STMT (op));
if (bb
&& flow_bb_inside_loop_p (data->current_loop, bb))
return;
@@ -1127,7 +1135,7 @@ find_interesting_uses_op (struct ivopts_data *data, tree op)
{
struct iv *iv;
struct iv *civ;
- tree stmt;
+ gimple stmt;
struct iv_use *use;
if (TREE_CODE (op) != SSA_NAME)
@@ -1156,8 +1164,8 @@ find_interesting_uses_op (struct ivopts_data *data, tree op)
*civ = *iv;
stmt = SSA_NAME_DEF_STMT (op);
- gcc_assert (TREE_CODE (stmt) == PHI_NODE
- || TREE_CODE (stmt) == GIMPLE_MODIFY_STMT);
+ gcc_assert (gimple_code (stmt) == GIMPLE_PHI
+ || is_gimple_assign (stmt));
use = record_use (data, NULL, civ, stmt, USE_NONLINEAR_EXPR);
iv->use_id = use->id;
@@ -1165,47 +1173,40 @@ find_interesting_uses_op (struct ivopts_data *data, tree op)
return use;
}
-/* Given a condition *COND_P, checks whether it is a compare of an induction
- variable and an invariant. If this is the case, CONTROL_VAR is set
- to location of the iv, BOUND to the location of the invariant,
- IV_VAR and IV_BOUND are set to the corresponding induction variable
- descriptions, and true is returned. If this is not the case,
- CONTROL_VAR and BOUND are set to the arguments of the condition and
- false is returned. */
+/* Given a condition in statement STMT, checks whether it is a compare
+ of an induction variable and an invariant. If this is the case,
+ CONTROL_VAR is set to location of the iv, BOUND to the location of
+ the invariant, IV_VAR and IV_BOUND are set to the corresponding
+ induction variable descriptions, and true is returned. If this is not
+ the case, CONTROL_VAR and BOUND are set to the arguments of the
+ condition and false is returned. */
static bool
-extract_cond_operands (struct ivopts_data *data, tree *cond_p,
+extract_cond_operands (struct ivopts_data *data, gimple stmt,
tree **control_var, tree **bound,
struct iv **iv_var, struct iv **iv_bound)
{
- /* The nodes returned when COND has just one operand. Note that you should
- not modify anything in BOUND or IV_BOUND because of this. */
+ /* The objects returned when COND has constant operands. */
static struct iv const_iv;
static tree zero;
- tree cond = *cond_p;
tree *op0 = &zero, *op1 = &zero, *tmp_op;
struct iv *iv0 = &const_iv, *iv1 = &const_iv, *tmp_iv;
bool ret = false;
- zero = integer_zero_node;
- const_iv.step = integer_zero_node;
-
- if (TREE_CODE (cond) == SSA_NAME)
+ if (gimple_code (stmt) == GIMPLE_COND)
{
- op0 = cond_p;
- iv0 = get_iv (data, cond);
- ret = (iv0 && !integer_zerop (iv0->step));
- goto end;
+ op0 = gimple_cond_lhs_ptr (stmt);
+ op1 = gimple_cond_rhs_ptr (stmt);
}
-
- if (!COMPARISON_CLASS_P (cond))
+ else
{
- op0 = cond_p;
- goto end;
+ op0 = gimple_assign_rhs1_ptr (stmt);
+ op1 = gimple_assign_rhs2_ptr (stmt);
}
- op0 = &TREE_OPERAND (cond, 0);
- op1 = &TREE_OPERAND (cond, 1);
+ zero = integer_zero_node;
+ const_iv.step = integer_zero_node;
+
if (TREE_CODE (*op0) == SSA_NAME)
iv0 = get_iv (data, *op0);
if (TREE_CODE (*op1) == SSA_NAME)
@@ -1237,16 +1238,16 @@ end:
return ret;
}
-/* Checks whether the condition *COND_P in STMT is interesting
- and if so, records it. */
+/* Checks whether the condition in STMT is interesting and if so,
+ records it. */
static void
-find_interesting_uses_cond (struct ivopts_data *data, tree stmt, tree *cond_p)
+find_interesting_uses_cond (struct ivopts_data *data, gimple stmt)
{
tree *var_p, *bound_p;
struct iv *var_iv, *civ;
- if (!extract_cond_operands (data, cond_p, &var_p, &bound_p, &var_iv, NULL))
+ if (!extract_cond_operands (data, stmt, &var_p, &bound_p, &var_iv, NULL))
{
find_interesting_uses_op (data, *var_p);
find_interesting_uses_op (data, *bound_p);
@@ -1255,7 +1256,7 @@ find_interesting_uses_cond (struct ivopts_data *data, tree stmt, tree *cond_p)
civ = XNEW (struct iv);
*civ = *var_iv;
- record_use (data, cond_p, civ, stmt, USE_COMPARE);
+ record_use (data, NULL, civ, stmt, USE_COMPARE);
}
/* Returns true if expression EXPR is obviously invariant in LOOP,
@@ -1275,7 +1276,7 @@ expr_invariant_in_loop_p (struct loop *loop, tree expr)
if (TREE_CODE (expr) == SSA_NAME)
{
- def_bb = bb_for_stmt (SSA_NAME_DEF_STMT (expr));
+ def_bb = gimple_bb (SSA_NAME_DEF_STMT (expr));
if (def_bb
&& flow_bb_inside_loop_p (loop, def_bb))
return false;
@@ -1283,7 +1284,7 @@ expr_invariant_in_loop_p (struct loop *loop, tree expr)
return true;
}
- if (!EXPR_P (expr) && !GIMPLE_STMT_P (expr))
+ if (!EXPR_P (expr))
return false;
len = TREE_OPERAND_LENGTH (expr);
@@ -1294,6 +1295,29 @@ expr_invariant_in_loop_p (struct loop *loop, tree expr)
return true;
}
+/* Returns true if statement STMT is obviously invariant in LOOP,
+ i.e. if all its operands on the RHS are defined outside of the LOOP.
+ LOOP should not be the function body. */
+
+bool
+stmt_invariant_in_loop_p (struct loop *loop, gimple stmt)
+{
+ unsigned i;
+ tree lhs;
+
+ gcc_assert (loop_depth (loop) > 0);
+
+ lhs = gimple_get_lhs (stmt);
+ for (i = 0; i < gimple_num_ops (stmt); i++)
+ {
+ tree op = gimple_op (stmt, i);
+ if (op != lhs && !expr_invariant_in_loop_p (loop, op))
+ return false;
+ }
+
+ return true;
+}
+
/* Cumulates the steps of indices into DATA and replaces their values with the
initial ones. Returns false when the value of the index cannot be determined.
Callback for for_each_index. */
@@ -1301,7 +1325,7 @@ expr_invariant_in_loop_p (struct loop *loop, tree expr)
struct ifs_ivopts_data
{
struct ivopts_data *ivopts_data;
- tree stmt;
+ gimple stmt;
tree step;
};
@@ -1553,7 +1577,7 @@ may_be_nonaddressable_p (tree expr)
/* Finds addresses in *OP_P inside STMT. */
static void
-find_interesting_uses_address (struct ivopts_data *data, tree stmt, tree *op_p)
+find_interesting_uses_address (struct ivopts_data *data, gimple stmt, tree *op_p)
{
tree base = *op_p, step = build_int_cst (sizetype, 0);
struct iv *civ;
@@ -1561,7 +1585,7 @@ find_interesting_uses_address (struct ivopts_data *data, tree stmt, tree *op_p)
/* Do not play with volatile memory references. A bit too conservative,
perhaps, but safe. */
- if (stmt_ann (stmt)->has_volatile_ops)
+ if (gimple_has_volatile_ops (stmt))
goto fail;
/* Ignore bitfields for now. Not really something terribly complicated
@@ -1657,7 +1681,7 @@ fail:
/* Finds and records invariants used in STMT. */
static void
-find_invariants_stmt (struct ivopts_data *data, tree stmt)
+find_invariants_stmt (struct ivopts_data *data, gimple stmt)
{
ssa_op_iter iter;
use_operand_p use_p;
@@ -1673,61 +1697,55 @@ find_invariants_stmt (struct ivopts_data *data, tree stmt)
/* Finds interesting uses of induction variables in the statement STMT. */
static void
-find_interesting_uses_stmt (struct ivopts_data *data, tree stmt)
+find_interesting_uses_stmt (struct ivopts_data *data, gimple stmt)
{
struct iv *iv;
- tree op, lhs, rhs;
+ tree op, *lhs, *rhs;
ssa_op_iter iter;
use_operand_p use_p;
+ enum tree_code code;
find_invariants_stmt (data, stmt);
- if (TREE_CODE (stmt) == COND_EXPR)
+ if (gimple_code (stmt) == GIMPLE_COND)
{
- find_interesting_uses_cond (data, stmt, &COND_EXPR_COND (stmt));
+ find_interesting_uses_cond (data, stmt);
return;
}
- if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT)
+ if (is_gimple_assign (stmt))
{
- lhs = GIMPLE_STMT_OPERAND (stmt, 0);
- rhs = GIMPLE_STMT_OPERAND (stmt, 1);
+ lhs = gimple_assign_lhs_ptr (stmt);
+ rhs = gimple_assign_rhs1_ptr (stmt);
- if (TREE_CODE (lhs) == SSA_NAME)
+ if (TREE_CODE (*lhs) == SSA_NAME)
{
/* If the statement defines an induction variable, the uses are not
interesting by themselves. */
- iv = get_iv (data, lhs);
+ iv = get_iv (data, *lhs);
if (iv && !integer_zerop (iv->step))
return;
}
- switch (TREE_CODE_CLASS (TREE_CODE (rhs)))
+ code = gimple_assign_rhs_code (stmt);
+ if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS
+ && (REFERENCE_CLASS_P (*rhs)
+ || is_gimple_val (*rhs)))
{
- case tcc_comparison:
- find_interesting_uses_cond (data, stmt,
- &GIMPLE_STMT_OPERAND (stmt, 1));
- return;
+ if (REFERENCE_CLASS_P (*rhs))
+ find_interesting_uses_address (data, stmt, rhs);
+ else
+ find_interesting_uses_op (data, *rhs);
- case tcc_reference:
- find_interesting_uses_address (data, stmt,
- &GIMPLE_STMT_OPERAND (stmt, 1));
- if (REFERENCE_CLASS_P (lhs))
- find_interesting_uses_address (data, stmt,
- &GIMPLE_STMT_OPERAND (stmt, 0));
+ if (REFERENCE_CLASS_P (*lhs))
+ find_interesting_uses_address (data, stmt, lhs);
return;
-
- default: ;
}
-
- if (REFERENCE_CLASS_P (lhs)
- && is_gimple_val (rhs))
+ else if (TREE_CODE_CLASS (code) == tcc_comparison)
{
- find_interesting_uses_address (data, stmt,
- &GIMPLE_STMT_OPERAND (stmt, 0));
- find_interesting_uses_op (data, rhs);
+ find_interesting_uses_cond (data, stmt);
return;
}
@@ -1740,11 +1758,10 @@ find_interesting_uses_stmt (struct ivopts_data *data, tree stmt)
call (memory). */
}
- if (TREE_CODE (stmt) == PHI_NODE
- && bb_for_stmt (stmt) == data->current_loop->header)
+ if (gimple_code (stmt) == GIMPLE_PHI
+ && gimple_bb (stmt) == data->current_loop->header)
{
- lhs = PHI_RESULT (stmt);
- iv = get_iv (data, lhs);
+ iv = get_iv (data, PHI_RESULT (stmt));
if (iv && !integer_zerop (iv->step))
return;
@@ -1771,10 +1788,13 @@ find_interesting_uses_stmt (struct ivopts_data *data, tree stmt)
static void
find_interesting_uses_outside (struct ivopts_data *data, edge exit)
{
- tree phi, def;
+ gimple phi;
+ gimple_stmt_iterator psi;
+ tree def;
- for (phi = phi_nodes (exit->dest); phi; phi = PHI_CHAIN (phi))
+ for (psi = gsi_start_phis (exit->dest); !gsi_end_p (psi); gsi_next (&psi))
{
+ phi = gsi_stmt (psi);
def = PHI_ARG_DEF_FROM_EDGE (phi, exit);
if (is_gimple_reg (def))
find_interesting_uses_op (data, def);
@@ -1787,8 +1807,7 @@ static void
find_interesting_uses (struct ivopts_data *data)
{
basic_block bb;
- block_stmt_iterator bsi;
- tree phi;
+ gimple_stmt_iterator bsi;
basic_block *body = get_loop_body (data->current_loop);
unsigned i;
struct version_info *info;
@@ -1807,10 +1826,10 @@ find_interesting_uses (struct ivopts_data *data)
&& !flow_bb_inside_loop_p (data->current_loop, e->dest))
find_interesting_uses_outside (data, e);
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
- find_interesting_uses_stmt (data, phi);
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
- find_interesting_uses_stmt (data, bsi_stmt (bsi));
+ for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi); gsi_next (&bsi))
+ find_interesting_uses_stmt (data, gsi_stmt (bsi));
+ for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
+ find_interesting_uses_stmt (data, gsi_stmt (bsi));
}
if (dump_file && (dump_flags & TDF_DETAILS))
@@ -2033,7 +2052,7 @@ find_depends (tree *expr_p, int *ws ATTRIBUTE_UNUSED, void *data)
static struct iv_cand *
add_candidate_1 (struct ivopts_data *data,
tree base, tree step, bool important, enum iv_position pos,
- struct iv_use *use, tree incremented_at)
+ struct iv_use *use, gimple incremented_at)
{
unsigned i;
struct iv_cand *cand = NULL;
@@ -2157,10 +2176,10 @@ add_candidate (struct ivopts_data *data,
tree base, tree step, bool important, struct iv_use *use)
{
if (ip_normal_pos (data->current_loop))
- add_candidate_1 (data, base, step, important, IP_NORMAL, use, NULL_TREE);
+ add_candidate_1 (data, base, step, important, IP_NORMAL, use, NULL);
if (ip_end_pos (data->current_loop)
&& allow_ip_end_pos_p (data->current_loop))
- add_candidate_1 (data, base, step, important, IP_END, use, NULL_TREE);
+ add_candidate_1 (data, base, step, important, IP_END, use, NULL);
}
/* Add a standard "0 + 1 * iteration" iv candidate for a
@@ -2193,7 +2212,8 @@ add_standard_iv_candidates (struct ivopts_data *data)
static void
add_old_iv_candidates (struct ivopts_data *data, struct iv *iv)
{
- tree phi, def;
+ gimple phi;
+ tree def;
struct iv_cand *cand;
add_candidate (data, iv->base, iv->step, true, NULL);
@@ -2204,7 +2224,7 @@ add_old_iv_candidates (struct ivopts_data *data, struct iv *iv)
iv->step, true, NULL);
phi = SSA_NAME_DEF_STMT (iv->ssa_name);
- if (TREE_CODE (phi) == PHI_NODE)
+ if (gimple_code (phi) == GIMPLE_PHI)
{
/* Additionally record the possibility of leaving the original iv
untouched. */
@@ -2255,9 +2275,11 @@ add_iv_value_candidates (struct ivopts_data *data,
add_candidate (data, build_int_cst (basetype, 0),
iv->step, true, use);
- /* Third, try removing the constant offset. */
+ /* Third, try removing the constant offset. Make sure to even
+ add a candidate for &a[0] vs. (T *)&a. */
base = strip_offset (iv->base, &offset);
- if (offset)
+ if (offset
+ || base != iv->base)
add_candidate (data, base, iv->step, false, use);
}
@@ -2643,7 +2665,7 @@ computation_cost (tree expr)
/* Returns variable containing the value of candidate CAND at statement AT. */
static tree
-var_at_stmt (struct loop *loop, struct iv_cand *cand, tree stmt)
+var_at_stmt (struct loop *loop, struct iv_cand *cand, gimple stmt)
{
if (stmt_after_increment (loop, cand, stmt))
return cand->var_after;
@@ -2713,7 +2735,7 @@ determine_common_wider_type (tree *a, tree *b)
static bool
get_computation_aff (struct loop *loop,
- struct iv_use *use, struct iv_cand *cand, tree at,
+ struct iv_use *use, struct iv_cand *cand, gimple at,
struct affine_tree_combination *aff)
{
tree ubase = use->iv->base;
@@ -2788,7 +2810,7 @@ get_computation_aff (struct loop *loop,
static tree
get_computation_at (struct loop *loop,
- struct iv_use *use, struct iv_cand *cand, tree at)
+ struct iv_use *use, struct iv_cand *cand, gimple at)
{
aff_tree aff;
tree type = TREE_TYPE (use->iv->base);
@@ -3458,7 +3480,7 @@ difference_cost (struct ivopts_data *data,
static comp_cost
get_computation_cost_at (struct ivopts_data *data,
struct iv_use *use, struct iv_cand *cand,
- bool address_p, bitmap *depends_on, tree at)
+ bool address_p, bitmap *depends_on, gimple at)
{
tree ubase = use->iv->base, ustep = use->iv->step;
tree cbase, cstep;
@@ -3672,7 +3694,7 @@ determine_use_iv_cost_address (struct ivopts_data *data,
stores it to VAL. */
static void
-cand_value_at (struct loop *loop, struct iv_cand *cand, tree at, tree niter,
+cand_value_at (struct loop *loop, struct iv_cand *cand, gimple at, tree niter,
aff_tree *val)
{
aff_tree step, delta, nit;
@@ -3725,7 +3747,7 @@ iv_elimination_compare (struct ivopts_data *data, struct iv_use *use)
basic_block ex_bb;
edge exit;
- ex_bb = bb_for_stmt (use->stmt);
+ ex_bb = gimple_bb (use->stmt);
exit = EDGE_SUCC (ex_bb, 0);
if (flow_bb_inside_loop_p (loop, exit->dest))
exit = EDGE_SUCC (ex_bb, 1);
@@ -3751,11 +3773,10 @@ may_eliminate_iv (struct ivopts_data *data,
/* For now works only for exits that dominate the loop latch.
TODO: extend to other conditions inside loop body. */
- ex_bb = bb_for_stmt (use->stmt);
+ ex_bb = gimple_bb (use->stmt);
if (use->stmt != last_stmt (ex_bb)
- || TREE_CODE (use->stmt) != COND_EXPR)
- return false;
- if (!dominated_by_p (CDI_DOMINATORS, loop->latch, ex_bb))
+ || gimple_code (use->stmt) != GIMPLE_COND
+ || !dominated_by_p (CDI_DOMINATORS, loop->latch, ex_bb))
return false;
exit = EDGE_SUCC (ex_bb, 0);
@@ -3834,7 +3855,7 @@ determine_use_iv_cost_condition (struct ivopts_data *data,
/* Try expressing the original giv. If it is compared with an invariant,
note that we cannot get rid of it. */
- ok = extract_cond_operands (data, use->op_p, NULL, NULL, NULL, &cmp_iv);
+ ok = extract_cond_operands (data, use->stmt, NULL, NULL, NULL, &cmp_iv);
gcc_assert (ok);
express_cost = get_computation_cost (data, use, cand, false,
@@ -4050,7 +4071,9 @@ static void
determine_set_costs (struct ivopts_data *data)
{
unsigned j, n;
- tree phi, op;
+ gimple phi;
+ gimple_stmt_iterator psi;
+ tree op;
struct loop *loop = data->current_loop;
bitmap_iterator bi;
@@ -4083,8 +4106,9 @@ determine_set_costs (struct ivopts_data *data)
}
n = 0;
- for (phi = phi_nodes (loop->header); phi; phi = PHI_CHAIN (phi))
+ for (psi = gsi_start_phis (loop->header); !gsi_end_p (psi); gsi_next (&psi))
{
+ phi = gsi_stmt (psi);
op = PHI_RESULT (phi);
if (!is_gimple_reg (op))
@@ -4925,7 +4949,7 @@ find_optimal_iv_set (struct ivopts_data *data)
static void
create_new_iv (struct ivopts_data *data, struct iv_cand *cand)
{
- block_stmt_iterator incr_pos;
+ gimple_stmt_iterator incr_pos;
tree base;
bool after = false;
@@ -4935,11 +4959,11 @@ create_new_iv (struct ivopts_data *data, struct iv_cand *cand)
switch (cand->pos)
{
case IP_NORMAL:
- incr_pos = bsi_last (ip_normal_pos (data->current_loop));
+ incr_pos = gsi_last_bb (ip_normal_pos (data->current_loop));
break;
case IP_END:
- incr_pos = bsi_last (ip_end_pos (data->current_loop));
+ incr_pos = gsi_last_bb (ip_end_pos (data->current_loop));
after = true;
break;
@@ -4984,17 +5008,15 @@ create_new_ivs (struct ivopts_data *data, struct iv_ca *set)
is true, remove also the ssa name defined by the statement. */
static void
-remove_statement (tree stmt, bool including_defined_name)
+remove_statement (gimple stmt, bool including_defined_name)
{
- if (TREE_CODE (stmt) == PHI_NODE)
- {
- remove_phi_node (stmt, NULL_TREE, including_defined_name);
- }
+ gimple_stmt_iterator bsi = gsi_for_stmt (stmt);
+
+ if (gimple_code (stmt) == GIMPLE_PHI)
+ remove_phi_node (&bsi, including_defined_name);
else
{
- block_stmt_iterator bsi = bsi_for_stmt (stmt);
-
- bsi_remove (&bsi, true);
+ gsi_remove (&bsi, true);
release_defs (stmt);
}
}
@@ -5007,8 +5029,9 @@ rewrite_use_nonlinear_expr (struct ivopts_data *data,
struct iv_use *use, struct iv_cand *cand)
{
tree comp;
- tree op, tgt, ass;
- block_stmt_iterator bsi;
+ tree op, tgt;
+ gimple ass;
+ gimple_stmt_iterator bsi;
/* An important special case -- if we are asked to express value of
the original iv by itself, just exit; there is no need to
@@ -5018,10 +5041,10 @@ rewrite_use_nonlinear_expr (struct ivopts_data *data,
&& cand->incremented_at == use->stmt)
{
tree step, ctype, utype;
- enum tree_code incr_code = PLUS_EXPR;
+ enum tree_code incr_code = PLUS_EXPR, old_code;
- gcc_assert (TREE_CODE (use->stmt) == GIMPLE_MODIFY_STMT);
- gcc_assert (GIMPLE_STMT_OPERAND (use->stmt, 0) == cand->var_after);
+ gcc_assert (is_gimple_assign (use->stmt));
+ gcc_assert (gimple_assign_lhs (use->stmt) == cand->var_after);
step = cand->iv->step;
ctype = TREE_TYPE (step);
@@ -5037,16 +5060,16 @@ rewrite_use_nonlinear_expr (struct ivopts_data *data,
computations in the loop -- otherwise, the computation
we rely upon may be removed in remove_unused_ivs,
thus leading to ICE. */
- op = GIMPLE_STMT_OPERAND (use->stmt, 1);
- if (TREE_CODE (op) == PLUS_EXPR
- || TREE_CODE (op) == MINUS_EXPR
- || TREE_CODE (op) == POINTER_PLUS_EXPR)
+ old_code = gimple_assign_rhs_code (use->stmt);
+ if (old_code == PLUS_EXPR
+ || old_code == MINUS_EXPR
+ || old_code == POINTER_PLUS_EXPR)
{
- if (TREE_OPERAND (op, 0) == cand->var_before)
- op = TREE_OPERAND (op, 1);
- else if (TREE_CODE (op) != MINUS_EXPR
- && TREE_OPERAND (op, 1) == cand->var_before)
- op = TREE_OPERAND (op, 0);
+ if (gimple_assign_rhs1 (use->stmt) == cand->var_before)
+ op = gimple_assign_rhs2 (use->stmt);
+ else if (old_code != MINUS_EXPR
+ && gimple_assign_rhs2 (use->stmt) == cand->var_before)
+ op = gimple_assign_rhs1 (use->stmt);
else
op = NULL_TREE;
}
@@ -5071,39 +5094,41 @@ rewrite_use_nonlinear_expr (struct ivopts_data *data,
gcc_assert (comp != NULL_TREE);
}
- switch (TREE_CODE (use->stmt))
+ switch (gimple_code (use->stmt))
{
- case PHI_NODE:
+ case GIMPLE_PHI:
tgt = PHI_RESULT (use->stmt);
/* If we should keep the biv, do not replace it. */
if (name_info (data, tgt)->preserve_biv)
return;
- bsi = bsi_after_labels (bb_for_stmt (use->stmt));
+ bsi = gsi_after_labels (gimple_bb (use->stmt));
break;
- case GIMPLE_MODIFY_STMT:
- tgt = GIMPLE_STMT_OPERAND (use->stmt, 0);
- bsi = bsi_for_stmt (use->stmt);
+ case GIMPLE_ASSIGN:
+ tgt = gimple_assign_lhs (use->stmt);
+ bsi = gsi_for_stmt (use->stmt);
break;
default:
gcc_unreachable ();
}
- op = force_gimple_operand_bsi (&bsi, comp, false, SSA_NAME_VAR (tgt),
- true, BSI_SAME_STMT);
+ op = force_gimple_operand_gsi (&bsi, comp, false, SSA_NAME_VAR (tgt),
+ true, GSI_SAME_STMT);
- if (TREE_CODE (use->stmt) == PHI_NODE)
+ if (gimple_code (use->stmt) == GIMPLE_PHI)
{
- ass = build_gimple_modify_stmt (tgt, op);
- bsi_insert_before (&bsi, ass, BSI_SAME_STMT);
+ ass = gimple_build_assign (tgt, op);
+ gsi_insert_before (&bsi, ass, GSI_SAME_STMT);
remove_statement (use->stmt, false);
- SSA_NAME_DEF_STMT (tgt) = ass;
}
else
- GIMPLE_STMT_OPERAND (use->stmt, 1) = op;
+ {
+ gimple_assign_set_rhs_from_tree (&bsi, op);
+ use->stmt = gsi_stmt (bsi);
+ }
}
/* Replaces ssa name in index IDX by its basic variable. Callback for
@@ -5222,7 +5247,7 @@ rewrite_use_address (struct ivopts_data *data,
struct iv_use *use, struct iv_cand *cand)
{
aff_tree aff;
- block_stmt_iterator bsi = bsi_for_stmt (use->stmt);
+ gimple_stmt_iterator bsi = gsi_for_stmt (use->stmt);
tree ref;
bool ok;
@@ -5243,7 +5268,7 @@ rewrite_use_compare (struct ivopts_data *data,
struct iv_use *use, struct iv_cand *cand)
{
tree comp, *var_p, op, bound;
- block_stmt_iterator bsi = bsi_for_stmt (use->stmt);
+ gimple_stmt_iterator bsi = gsi_for_stmt (use->stmt);
enum tree_code compare;
struct cost_pair *cp = get_use_iv_cost (data, use, cand);
bool ok;
@@ -5256,10 +5281,12 @@ rewrite_use_compare (struct ivopts_data *data,
compare = iv_elimination_compare (data, use);
bound = unshare_expr (fold_convert (var_type, bound));
- op = force_gimple_operand_bsi (&bsi, bound, true, NULL_TREE,
- true, BSI_SAME_STMT);
+ op = force_gimple_operand_gsi (&bsi, bound, true, NULL_TREE,
+ true, GSI_SAME_STMT);
- *use->op_p = build2 (compare, boolean_type_node, var, op);
+ gimple_cond_set_lhs (use->stmt, var);
+ gimple_cond_set_code (use->stmt, compare);
+ gimple_cond_set_rhs (use->stmt, op);
return;
}
@@ -5268,11 +5295,11 @@ rewrite_use_compare (struct ivopts_data *data,
comp = get_computation (data->current_loop, use, cand);
gcc_assert (comp != NULL_TREE);
- ok = extract_cond_operands (data, use->op_p, &var_p, NULL, NULL, NULL);
+ ok = extract_cond_operands (data, use->stmt, &var_p, NULL, NULL, NULL);
gcc_assert (ok);
- *var_p = force_gimple_operand_bsi (&bsi, comp, true, SSA_NAME_VAR (*var_p),
- true, BSI_SAME_STMT);
+ *var_p = force_gimple_operand_gsi (&bsi, comp, true, SSA_NAME_VAR (*var_p),
+ true, GSI_SAME_STMT);
}
/* Rewrites USE using candidate CAND. */
@@ -5452,7 +5479,7 @@ tree_ssa_iv_optimize_loop (struct ivopts_data *data, struct loop *loop)
{
fprintf (dump_file, " single exit %d -> %d, exit condition ",
exit->src->index, exit->dest->index);
- print_generic_expr (dump_file, last_stmt (exit->src), TDF_SLIM);
+ print_gimple_stmt (dump_file, last_stmt (exit->src), 0, TDF_SLIM);
fprintf (dump_file, "\n");
}
diff --git a/gcc/tree-ssa-loop-manip.c b/gcc/tree-ssa-loop-manip.c
index 1ff6254c0b1..05e87d241cd 100644
--- a/gcc/tree-ssa-loop-manip.c
+++ b/gcc/tree-ssa-loop-manip.c
@@ -49,10 +49,12 @@ along with GCC; see the file COPYING3. If not see
void
create_iv (tree base, tree step, tree var, struct loop *loop,
- block_stmt_iterator *incr_pos, bool after,
+ gimple_stmt_iterator *incr_pos, bool after,
tree *var_before, tree *var_after)
{
- tree stmt, initial, step1, stmts;
+ gimple stmt;
+ tree initial, step1;
+ gimple_seq stmts;
tree vb, va;
enum tree_code incr_op = PLUS_EXPR;
edge pe = loop_preheader_edge (loop);
@@ -63,10 +65,10 @@ create_iv (tree base, tree step, tree var, struct loop *loop,
add_referenced_var (var);
}
- vb = make_ssa_name (var, NULL_TREE);
+ vb = make_ssa_name (var, NULL);
if (var_before)
*var_before = vb;
- va = make_ssa_name (var, NULL_TREE);
+ va = make_ssa_name (var, NULL);
if (var_after)
*var_after = va;
@@ -106,20 +108,17 @@ create_iv (tree base, tree step, tree var, struct loop *loop,
loop (i.e. the step should be loop invariant). */
step = force_gimple_operand (step, &stmts, true, NULL_TREE);
if (stmts)
- bsi_insert_on_edge_immediate (pe, stmts);
+ gsi_insert_seq_on_edge_immediate (pe, stmts);
- stmt = build_gimple_modify_stmt (va,
- build2 (incr_op, TREE_TYPE (base),
- vb, step));
- SSA_NAME_DEF_STMT (va) = stmt;
+ stmt = gimple_build_assign_with_ops (incr_op, va, vb, step);
if (after)
- bsi_insert_after (incr_pos, stmt, BSI_NEW_STMT);
+ gsi_insert_after (incr_pos, stmt, GSI_NEW_STMT);
else
- bsi_insert_before (incr_pos, stmt, BSI_NEW_STMT);
+ gsi_insert_before (incr_pos, stmt, GSI_NEW_STMT);
initial = force_gimple_operand (base, &stmts, true, var);
if (stmts)
- bsi_insert_on_edge_immediate (pe, stmts);
+ gsi_insert_seq_on_edge_immediate (pe, stmts);
stmt = create_phi_node (vb, loop->header);
SSA_NAME_DEF_STMT (vb) = stmt;
@@ -132,8 +131,8 @@ create_iv (tree base, tree step, tree var, struct loop *loop,
static void
add_exit_phis_edge (basic_block exit, tree use)
{
- tree phi, def_stmt = SSA_NAME_DEF_STMT (use);
- basic_block def_bb = bb_for_stmt (def_stmt);
+ gimple phi, def_stmt = SSA_NAME_DEF_STMT (use);
+ basic_block def_bb = gimple_bb (def_stmt);
struct loop *def_loop;
edge e;
edge_iterator ei;
@@ -151,7 +150,8 @@ add_exit_phis_edge (basic_block exit, tree use)
return;
phi = create_phi_node (use, exit);
- create_new_def_for (PHI_RESULT (phi), phi, PHI_RESULT_PTR (phi));
+ create_new_def_for (gimple_phi_result (phi), phi,
+ gimple_phi_result_ptr (phi));
FOR_EACH_EDGE (e, ei, exit->preds)
add_phi_arg (phi, use, e);
}
@@ -164,7 +164,7 @@ add_exit_phis_var (tree var, bitmap livein, bitmap exits)
{
bitmap def;
unsigned index;
- basic_block def_bb = bb_for_stmt (SSA_NAME_DEF_STMT (var));
+ basic_block def_bb = gimple_bb (SSA_NAME_DEF_STMT (var));
bitmap_iterator bi;
if (is_gimple_reg (var))
@@ -243,7 +243,7 @@ find_uses_to_rename_use (basic_block bb, tree use, bitmap *use_blocks,
return;
ver = SSA_NAME_VERSION (use);
- def_bb = bb_for_stmt (SSA_NAME_DEF_STMT (use));
+ def_bb = gimple_bb (SSA_NAME_DEF_STMT (use));
if (!def_bb)
return;
def_loop = def_bb->loop_father;
@@ -270,11 +270,11 @@ find_uses_to_rename_use (basic_block bb, tree use, bitmap *use_blocks,
NEED_PHIS. */
static void
-find_uses_to_rename_stmt (tree stmt, bitmap *use_blocks, bitmap need_phis)
+find_uses_to_rename_stmt (gimple stmt, bitmap *use_blocks, bitmap need_phis)
{
ssa_op_iter iter;
tree var;
- basic_block bb = bb_for_stmt (stmt);
+ basic_block bb = gimple_bb (stmt);
FOR_EACH_SSA_TREE_OPERAND (var, stmt, iter, SSA_OP_ALL_USES)
find_uses_to_rename_use (bb, var, use_blocks, need_phis);
@@ -288,18 +288,17 @@ find_uses_to_rename_stmt (tree stmt, bitmap *use_blocks, bitmap need_phis)
static void
find_uses_to_rename_bb (basic_block bb, bitmap *use_blocks, bitmap need_phis)
{
- block_stmt_iterator bsi;
+ gimple_stmt_iterator bsi;
edge e;
edge_iterator ei;
- tree phi;
FOR_EACH_EDGE (e, ei, bb->succs)
- for (phi = phi_nodes (e->dest); phi; phi = PHI_CHAIN (phi))
- find_uses_to_rename_use (bb, PHI_ARG_DEF_FROM_EDGE (phi, e),
+ for (bsi = gsi_start_phis (e->dest); !gsi_end_p (bsi); gsi_next (&bsi))
+ find_uses_to_rename_use (bb, PHI_ARG_DEF_FROM_EDGE (gsi_stmt (bsi), e),
use_blocks, need_phis);
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
- find_uses_to_rename_stmt (bsi_stmt (bsi), use_blocks, need_phis);
+ for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
+ find_uses_to_rename_stmt (gsi_stmt (bsi), use_blocks, need_phis);
}
/* Marks names that are used outside of the loop they are defined in
@@ -407,14 +406,14 @@ rewrite_into_loop_closed_ssa (bitmap changed_bbs, unsigned update_flag)
static void
check_loop_closed_ssa_use (basic_block bb, tree use)
{
- tree def;
+ gimple def;
basic_block def_bb;
if (TREE_CODE (use) != SSA_NAME || !is_gimple_reg (use))
return;
def = SSA_NAME_DEF_STMT (use);
- def_bb = bb_for_stmt (def);
+ def_bb = gimple_bb (def);
gcc_assert (!def_bb
|| flow_bb_inside_loop_p (def_bb->loop_father, bb));
}
@@ -422,7 +421,7 @@ check_loop_closed_ssa_use (basic_block bb, tree use)
/* Checks invariants of loop closed ssa form in statement STMT in BB. */
static void
-check_loop_closed_ssa_stmt (basic_block bb, tree stmt)
+check_loop_closed_ssa_stmt (basic_block bb, gimple stmt)
{
ssa_op_iter iter;
tree var;
@@ -437,9 +436,10 @@ void
verify_loop_closed_ssa (void)
{
basic_block bb;
- block_stmt_iterator bsi;
- tree phi;
- unsigned i;
+ gimple_stmt_iterator bsi;
+ gimple phi;
+ edge e;
+ edge_iterator ei;
if (number_of_loops () <= 1)
return;
@@ -448,13 +448,16 @@ verify_loop_closed_ssa (void)
FOR_EACH_BB (bb)
{
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
- for (i = 0; i < (unsigned) PHI_NUM_ARGS (phi); i++)
- check_loop_closed_ssa_use (PHI_ARG_EDGE (phi, i)->src,
- PHI_ARG_DEF (phi, i));
+ for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi); gsi_next (&bsi))
+ {
+ phi = gsi_stmt (bsi);
+ FOR_EACH_EDGE (e, ei, bb->preds)
+ check_loop_closed_ssa_use (e->src,
+ PHI_ARG_DEF_FROM_EDGE (phi, e));
+ }
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
- check_loop_closed_ssa_stmt (bb, bsi_stmt (bsi));
+ for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
+ check_loop_closed_ssa_stmt (bb, gsi_stmt (bsi));
}
}
@@ -466,11 +469,14 @@ split_loop_exit_edge (edge exit)
{
basic_block dest = exit->dest;
basic_block bb = split_edge (exit);
- tree phi, new_phi, new_name, name;
+ gimple phi, new_phi;
+ tree new_name, name;
use_operand_p op_p;
+ gimple_stmt_iterator psi;
- for (phi = phi_nodes (dest); phi; phi = PHI_CHAIN (phi))
+ for (psi = gsi_start_phis (dest); !gsi_end_p (psi); gsi_next (&psi))
{
+ phi = gsi_stmt (psi);
op_p = PHI_ARG_DEF_PTR_FROM_EDGE (phi, single_succ_edge (bb));
name = USE_FROM_PTR (op_p);
@@ -507,7 +513,7 @@ ip_end_pos (struct loop *loop)
basic_block
ip_normal_pos (struct loop *loop)
{
- tree last;
+ gimple last;
basic_block bb;
edge exit;
@@ -517,7 +523,7 @@ ip_normal_pos (struct loop *loop)
bb = single_pred (loop->latch);
last = last_stmt (bb);
if (!last
- || TREE_CODE (last) != COND_EXPR)
+ || gimple_code (last) != GIMPLE_COND)
return NULL;
exit = EDGE_SUCC (bb, 0);
@@ -536,21 +542,21 @@ ip_normal_pos (struct loop *loop)
the increment should be inserted after *BSI. */
void
-standard_iv_increment_position (struct loop *loop, block_stmt_iterator *bsi,
+standard_iv_increment_position (struct loop *loop, gimple_stmt_iterator *bsi,
bool *insert_after)
{
basic_block bb = ip_normal_pos (loop), latch = ip_end_pos (loop);
- tree last = last_stmt (latch);
+ gimple last = last_stmt (latch);
if (!bb
- || (last && TREE_CODE (last) != LABEL_EXPR))
+ || (last && gimple_code (last) != GIMPLE_LABEL))
{
- *bsi = bsi_last (latch);
+ *bsi = gsi_last_bb (latch);
*insert_after = true;
}
else
{
- *bsi = bsi_last (bb);
+ *bsi = gsi_last_bb (bb);
*insert_after = false;
}
}
@@ -584,7 +590,7 @@ copy_phi_node_args (unsigned first_new_block)
after the loop has been duplicated. */
bool
-tree_duplicate_loop_to_header_edge (struct loop *loop, edge e,
+gimple_duplicate_loop_to_header_edge (struct loop *loop, edge e,
unsigned int ndupl, sbitmap wont_exit,
edge orig, VEC (edge, heap) **to_remove,
int flags)
@@ -673,7 +679,7 @@ determine_exit_conditions (struct loop *loop, struct tree_niter_desc *desc,
tree *exit_base, tree *exit_step,
enum tree_code *exit_cmp, tree *exit_bound)
{
- tree stmts;
+ gimple_seq stmts;
tree base = desc->control.base;
tree step = desc->control.step;
tree bound = desc->bound;
@@ -748,7 +754,7 @@ determine_exit_conditions (struct loop *loop, struct tree_niter_desc *desc,
cond = force_gimple_operand (unshare_expr (cond), &stmts, false, NULL_TREE);
if (stmts)
- bsi_insert_on_edge_immediate (loop_preheader_edge (loop), stmts);
+ gsi_insert_seq_on_edge_immediate (loop_preheader_edge (loop), stmts);
/* cond now may be a gimple comparison, which would be OK, but also any
other gimple rhs (say a && b). In this case we need to force it to
operand. */
@@ -756,16 +762,16 @@ determine_exit_conditions (struct loop *loop, struct tree_niter_desc *desc,
{
cond = force_gimple_operand (cond, &stmts, true, NULL_TREE);
if (stmts)
- bsi_insert_on_edge_immediate (loop_preheader_edge (loop), stmts);
+ gsi_insert_seq_on_edge_immediate (loop_preheader_edge (loop), stmts);
}
*enter_cond = cond;
base = force_gimple_operand (unshare_expr (base), &stmts, true, NULL_TREE);
if (stmts)
- bsi_insert_on_edge_immediate (loop_preheader_edge (loop), stmts);
+ gsi_insert_seq_on_edge_immediate (loop_preheader_edge (loop), stmts);
bound = force_gimple_operand (unshare_expr (bound), &stmts, true, NULL_TREE);
if (stmts)
- bsi_insert_on_edge_immediate (loop_preheader_edge (loop), stmts);
+ gsi_insert_seq_on_edge_immediate (loop_preheader_edge (loop), stmts);
*exit_base = base;
*exit_step = bigstep;
@@ -859,15 +865,18 @@ tree_transform_and_unroll_loop (struct loop *loop, unsigned factor,
transform_callback transform,
void *data)
{
- tree exit_if, ctr_before, ctr_after;
+ gimple exit_if;
+ tree ctr_before, ctr_after;
tree enter_main_cond, exit_base, exit_step, exit_bound;
enum tree_code exit_cmp;
- tree phi_old_loop, phi_new_loop, phi_rest, init, next, new_init, var;
+ gimple phi_old_loop, phi_new_loop, phi_rest;
+ gimple_stmt_iterator psi_old_loop, psi_new_loop;
+ tree init, next, new_init, var;
struct loop *new_loop;
basic_block rest, exit_bb;
edge old_entry, new_entry, old_latch, precond_edge, new_exit;
edge new_nonexit, e;
- block_stmt_iterator bsi;
+ gimple_stmt_iterator bsi;
use_operand_p op;
bool ok;
unsigned est_niter, prob_entry, scale_unrolled, scale_rest, freq_e, freq_h;
@@ -937,11 +946,12 @@ tree_transform_and_unroll_loop (struct loop *loop, unsigned factor,
REG_BR_PROB_BASE,
REG_BR_PROB_BASE - exit->probability);
- bsi = bsi_last (exit_bb);
- exit_if = build3 (COND_EXPR, void_type_node, boolean_true_node,
- NULL_TREE, NULL_TREE);
+ bsi = gsi_last_bb (exit_bb);
+ exit_if = gimple_build_cond (EQ_EXPR, integer_zero_node,
+ integer_zero_node,
+ NULL_TREE, NULL_TREE);
- bsi_insert_after (&bsi, exit_if, BSI_NEW_STMT);
+ gsi_insert_after (&bsi, exit_if, GSI_NEW_STMT);
new_exit = make_edge (exit_bb, rest, EDGE_FALSE_VALUE | irr);
rescan_loop_exit (new_exit, true, false);
@@ -962,12 +972,14 @@ tree_transform_and_unroll_loop (struct loop *loop, unsigned factor,
old_entry = loop_preheader_edge (loop);
new_entry = loop_preheader_edge (new_loop);
old_latch = loop_latch_edge (loop);
- for (phi_old_loop = phi_nodes (loop->header),
- phi_new_loop = phi_nodes (new_loop->header);
- phi_old_loop;
- phi_old_loop = PHI_CHAIN (phi_old_loop),
- phi_new_loop = PHI_CHAIN (phi_new_loop))
+ for (psi_old_loop = gsi_start_phis (loop->header),
+ psi_new_loop = gsi_start_phis (new_loop->header);
+ !gsi_end_p (psi_old_loop);
+ gsi_next (&psi_old_loop), gsi_next (&psi_new_loop))
{
+ phi_old_loop = gsi_stmt (psi_old_loop);
+ phi_new_loop = gsi_stmt (psi_new_loop);
+
init = PHI_ARG_DEF_FROM_EDGE (phi_old_loop, old_entry);
op = PHI_ARG_DEF_PTR_FROM_EDGE (phi_new_loop, new_entry);
gcc_assert (operand_equal_for_phi_arg_p (init, USE_FROM_PTR (op)));
@@ -986,7 +998,7 @@ tree_transform_and_unroll_loop (struct loop *loop, unsigned factor,
add_referenced_var (var);
}
- new_init = make_ssa_name (var, NULL_TREE);
+ new_init = make_ssa_name (var, NULL);
phi_rest = create_phi_node (new_init, rest);
SSA_NAME_DEF_STMT (new_init) = phi_rest;
@@ -1007,7 +1019,7 @@ tree_transform_and_unroll_loop (struct loop *loop, unsigned factor,
sbitmap_ones (wont_exit);
RESET_BIT (wont_exit, factor - 1);
- ok = tree_duplicate_loop_to_header_edge
+ ok = gimple_duplicate_loop_to_header_edge
(loop, loop_latch_edge (loop), factor - 1,
wont_exit, new_exit, &to_remove, DLTHE_FLAG_UPDATE_FREQ);
free (wont_exit);
@@ -1049,12 +1061,13 @@ tree_transform_and_unroll_loop (struct loop *loop, unsigned factor,
/* Finally create the new counter for number of iterations and add the new
exit instruction. */
- bsi = bsi_last (exit_bb);
- exit_if = bsi_stmt (bsi);
+ bsi = gsi_last_bb (exit_bb);
+ exit_if = gsi_stmt (bsi);
create_iv (exit_base, exit_step, NULL_TREE, loop,
&bsi, false, &ctr_before, &ctr_after);
- COND_EXPR_COND (exit_if) = build2 (exit_cmp, boolean_type_node, ctr_after,
- exit_bound);
+ gimple_cond_set_code (exit_if, exit_cmp);
+ gimple_cond_set_lhs (exit_if, ctr_after);
+ gimple_cond_set_rhs (exit_if, exit_bound);
update_stmt (exit_if);
#ifdef ENABLE_CHECKING
diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c
index 80b45c298b7..1eedf7544af 100644
--- a/gcc/tree-ssa-loop-niter.c
+++ b/gcc/tree-ssa-loop-niter.c
@@ -368,7 +368,8 @@ bound_difference (struct loop *loop, tree x, tree y, bounds *bnds)
int cnt = 0;
edge e;
basic_block bb;
- tree cond, c0, c1;
+ tree c0, c1;
+ gimple cond;
enum tree_code cmp;
/* Get rid of unnecessary casts, but preserve the value of
@@ -427,12 +428,10 @@ bound_difference (struct loop *loop, tree x, tree y, bounds *bnds)
if (!(e->flags & (EDGE_TRUE_VALUE | EDGE_FALSE_VALUE)))
continue;
- cond = COND_EXPR_COND (last_stmt (e->src));
- if (!COMPARISON_CLASS_P (cond))
- continue;
- c0 = TREE_OPERAND (cond, 0);
- cmp = TREE_CODE (cond);
- c1 = TREE_OPERAND (cond, 1);
+ cond = last_stmt (e->src);
+ c0 = gimple_cond_lhs (cond);
+ cmp = gimple_cond_code (cond);
+ c1 = gimple_cond_rhs (cond);
if (e->flags & EDGE_FALSE_VALUE)
cmp = invert_tree_comparison (cmp, false);
@@ -698,7 +697,7 @@ number_of_iterations_lt_to_ne (tree type, affine_iv *iv0, affine_iv *iv1,
/* The final value of the iv is iv1->base + MOD, assuming that this
computation does not overflow, and that
iv0->base <= iv1->base + MOD. */
- if (!iv1->no_overflow && !integer_zerop (mod))
+ if (!iv0->no_overflow && !integer_zerop (mod))
{
bound = fold_build2 (MINUS_EXPR, type,
TYPE_MAX_VALUE (type1), tmod);
@@ -720,7 +719,7 @@ number_of_iterations_lt_to_ne (tree type, affine_iv *iv0, affine_iv *iv1,
/* The final value of the iv is iv0->base - MOD, assuming that this
computation does not overflow, and that
iv0->base - MOD <= iv1->base. */
- if (!iv0->no_overflow && !integer_zerop (mod))
+ if (!iv1->no_overflow && !integer_zerop (mod))
{
bound = fold_build2 (PLUS_EXPR, type1,
TYPE_MIN_VALUE (type1), tmod);
@@ -1349,7 +1348,7 @@ simplify_replace_tree (tree expr, tree old, tree new_tree)
|| operand_equal_p (expr, old, 0))
return unshare_expr (new_tree);
- if (!EXPR_P (expr) && !GIMPLE_STMT_P (expr))
+ if (!EXPR_P (expr))
return expr;
n = TREE_OPERAND_LENGTH (expr);
@@ -1376,8 +1375,9 @@ tree
expand_simple_operations (tree expr)
{
unsigned i, n;
- tree ret = NULL_TREE, e, ee, stmt;
+ tree ret = NULL_TREE, e, ee, e1;
enum tree_code code;
+ gimple stmt;
if (expr == NULL_TREE)
return expr;
@@ -1415,17 +1415,17 @@ expand_simple_operations (tree expr)
return expr;
stmt = SSA_NAME_DEF_STMT (expr);
- if (TREE_CODE (stmt) == PHI_NODE)
+ if (gimple_code (stmt) == GIMPLE_PHI)
{
basic_block src, dest;
- if (PHI_NUM_ARGS (stmt) != 1)
+ if (gimple_phi_num_args (stmt) != 1)
return expr;
e = PHI_ARG_DEF (stmt, 0);
/* Avoid propagating through loop exit phi nodes, which
could break loop-closed SSA form restrictions. */
- dest = bb_for_stmt (stmt);
+ dest = gimple_bb (stmt);
src = single_pred (dest);
if (TREE_CODE (e) == SSA_NAME
&& src->loop_father != dest->loop_father)
@@ -1433,24 +1433,44 @@ expand_simple_operations (tree expr)
return expand_simple_operations (e);
}
- if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
+ if (gimple_code (stmt) != GIMPLE_ASSIGN)
return expr;
- e = GIMPLE_STMT_OPERAND (stmt, 1);
- if (/* Casts are simple. */
- !CONVERT_EXPR_P (e)
- /* Copies are simple. */
- && TREE_CODE (e) != SSA_NAME
- /* Assignments of invariants are simple. */
- && !is_gimple_min_invariant (e)
+ e = gimple_assign_rhs1 (stmt);
+ code = gimple_assign_rhs_code (stmt);
+ if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
+ {
+ if (is_gimple_min_invariant (e))
+ return e;
+
+ if (code == SSA_NAME)
+ return expand_simple_operations (e);
+
+ return expr;
+ }
+
+ switch (code)
+ {
+ case NOP_EXPR:
+ case CONVERT_EXPR:
+ /* Casts are simple. */
+ ee = expand_simple_operations (e);
+ return fold_build1 (code, TREE_TYPE (expr), ee);
+
+ case PLUS_EXPR:
+ case MINUS_EXPR:
+ case POINTER_PLUS_EXPR:
/* And increments and decrements by a constant are simple. */
- && !((TREE_CODE (e) == PLUS_EXPR
- || TREE_CODE (e) == MINUS_EXPR
- || TREE_CODE (e) == POINTER_PLUS_EXPR)
- && is_gimple_min_invariant (TREE_OPERAND (e, 1))))
- return expr;
+ e1 = gimple_assign_rhs2 (stmt);
+ if (!is_gimple_min_invariant (e1))
+ return expr;
+
+ ee = expand_simple_operations (e);
+ return fold_build2 (code, TREE_TYPE (expr), ee, e1);
- return expand_simple_operations (e);
+ default:
+ return expr;
+ }
}
/* Tries to simplify EXPR using the condition COND. Returns the simplified
@@ -1585,6 +1605,7 @@ simplify_using_initial_conditions (struct loop *loop, tree expr)
{
edge e;
basic_block bb;
+ gimple stmt;
tree cond;
int cnt = 0;
@@ -1605,7 +1626,11 @@ simplify_using_initial_conditions (struct loop *loop, tree expr)
if (!(e->flags & (EDGE_TRUE_VALUE | EDGE_FALSE_VALUE)))
continue;
- cond = COND_EXPR_COND (last_stmt (e->src));
+ stmt = last_stmt (e->src);
+ cond = fold_build2 (gimple_cond_code (stmt),
+ boolean_type_node,
+ gimple_cond_lhs (stmt),
+ gimple_cond_rhs (stmt));
if (e->flags & EDGE_FALSE_VALUE)
cond = invert_truthvalue (cond);
expr = tree_simplify_using_condition (cond, expr);
@@ -1676,9 +1701,9 @@ bool
loop_only_exit_p (const struct loop *loop, const_edge exit)
{
basic_block *body;
- block_stmt_iterator bsi;
+ gimple_stmt_iterator bsi;
unsigned i;
- tree call;
+ gimple call;
if (exit != single_exit (loop))
return false;
@@ -1686,10 +1711,13 @@ loop_only_exit_p (const struct loop *loop, const_edge exit)
body = get_loop_body (loop);
for (i = 0; i < loop->num_nodes; i++)
{
- for (bsi = bsi_start (body[0]); !bsi_end_p (bsi); bsi_next (&bsi))
+ for (bsi = gsi_start_bb (body[i]); !gsi_end_p (bsi); gsi_next (&bsi))
{
- call = get_call_expr_in (bsi_stmt (bsi));
- if (call && TREE_SIDE_EFFECTS (call))
+ call = gsi_stmt (bsi);
+ if (gimple_code (call) != GIMPLE_CALL)
+ continue;
+
+ if (gimple_has_side_effects (call))
{
free (body);
return false;
@@ -1714,7 +1742,8 @@ number_of_iterations_exit (struct loop *loop, edge exit,
struct tree_niter_desc *niter,
bool warn)
{
- tree stmt, cond, type;
+ gimple stmt;
+ tree type;
tree op0, op1;
enum tree_code code;
affine_iv iv0, iv1;
@@ -1724,15 +1753,14 @@ number_of_iterations_exit (struct loop *loop, edge exit,
niter->assumptions = boolean_false_node;
stmt = last_stmt (exit->src);
- if (!stmt || TREE_CODE (stmt) != COND_EXPR)
+ if (!stmt || gimple_code (stmt) != GIMPLE_COND)
return false;
/* We want the condition for staying inside loop. */
- cond = COND_EXPR_COND (stmt);
+ code = gimple_cond_code (stmt);
if (exit->flags & EDGE_TRUE_VALUE)
- cond = invert_truthvalue (cond);
+ code = invert_tree_comparison (code, false);
- code = TREE_CODE (cond);
switch (code)
{
case GT_EXPR:
@@ -1746,8 +1774,8 @@ number_of_iterations_exit (struct loop *loop, edge exit,
return false;
}
- op0 = TREE_OPERAND (cond, 0);
- op1 = TREE_OPERAND (cond, 1);
+ op0 = gimple_cond_lhs (stmt);
+ op1 = gimple_cond_rhs (stmt);
type = TREE_TYPE (op0);
if (TREE_CODE (type) != INTEGER_TYPE
@@ -1805,7 +1833,7 @@ number_of_iterations_exit (struct loop *loop, edge exit,
if (warn)
{
const char *wording;
- location_t loc = EXPR_LOCATION (stmt);
+ location_t loc = gimple_location (stmt);
/* We can provide a more specific warning if one of the operator is
constant and the other advances by +1 or -1. */
@@ -1915,36 +1943,43 @@ find_loop_niter (struct loop *loop, edge *exit)
result by a chain of operations such that all but exactly one of their
operands are constants. */
-static tree
+static gimple
chain_of_csts_start (struct loop *loop, tree x)
{
- tree stmt = SSA_NAME_DEF_STMT (x);
+ gimple stmt = SSA_NAME_DEF_STMT (x);
tree use;
- basic_block bb = bb_for_stmt (stmt);
+ basic_block bb = gimple_bb (stmt);
+ enum tree_code code;
if (!bb
|| !flow_bb_inside_loop_p (loop, bb))
- return NULL_TREE;
+ return NULL;
- if (TREE_CODE (stmt) == PHI_NODE)
+ if (gimple_code (stmt) == GIMPLE_PHI)
{
if (bb == loop->header)
return stmt;
- return NULL_TREE;
+ return NULL;
}
- if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
- return NULL_TREE;
+ if (gimple_code (stmt) != GIMPLE_ASSIGN)
+ return NULL;
- if (!ZERO_SSA_OPERANDS (stmt, SSA_OP_ALL_VIRTUALS))
- return NULL_TREE;
- if (SINGLE_SSA_DEF_OPERAND (stmt, SSA_OP_DEF) == NULL_DEF_OPERAND_P)
- return NULL_TREE;
+ code = gimple_assign_rhs_code (stmt);
+ if (gimple_references_memory_p (stmt)
+ /* Before alias information is computed, operand scanning marks
+ statements that write memory volatile. However, the statements
+ that only read memory are not marked, thus gimple_references_memory_p
+ returns false for them. */
+ || TREE_CODE_CLASS (code) == tcc_reference
+ || TREE_CODE_CLASS (code) == tcc_declaration
+ || SINGLE_SSA_DEF_OPERAND (stmt, SSA_OP_DEF) == NULL_DEF_OPERAND_P)
+ return NULL;
use = SINGLE_SSA_TREE_OPERAND (stmt, SSA_OP_USE);
if (use == NULL_USE_OPERAND_P)
- return NULL_TREE;
+ return NULL;
return chain_of_csts_start (loop, use);
}
@@ -1957,32 +1992,32 @@ chain_of_csts_start (struct loop *loop, tree x)
* the value of the phi node in the next iteration can be derived from the
value in the current iteration by a chain of operations with constants.
- If such phi node exists, it is returned. If X is a constant, X is returned
- unchanged. Otherwise NULL_TREE is returned. */
+ If such phi node exists, it is returned, otherwise NULL is returned. */
-static tree
+static gimple
get_base_for (struct loop *loop, tree x)
{
- tree phi, init, next;
+ gimple phi;
+ tree init, next;
if (is_gimple_min_invariant (x))
- return x;
+ return NULL;
phi = chain_of_csts_start (loop, x);
if (!phi)
- return NULL_TREE;
+ return NULL;
init = PHI_ARG_DEF_FROM_EDGE (phi, loop_preheader_edge (loop));
next = PHI_ARG_DEF_FROM_EDGE (phi, loop_latch_edge (loop));
if (TREE_CODE (next) != SSA_NAME)
- return NULL_TREE;
+ return NULL;
if (!is_gimple_min_invariant (init))
- return NULL_TREE;
+ return NULL;
if (chain_of_csts_start (loop, next) != phi)
- return NULL_TREE;
+ return NULL;
return phi;
}
@@ -1998,9 +2033,7 @@ get_base_for (struct loop *loop, tree x)
static tree
get_val_for (tree x, tree base)
{
- tree stmt, nx, val;
- use_operand_p op;
- ssa_op_iter iter;
+ gimple stmt;
gcc_assert (is_gimple_min_invariant (base));
@@ -2008,24 +2041,41 @@ get_val_for (tree x, tree base)
return base;
stmt = SSA_NAME_DEF_STMT (x);
- if (TREE_CODE (stmt) == PHI_NODE)
+ if (gimple_code (stmt) == GIMPLE_PHI)
return base;
- FOR_EACH_SSA_USE_OPERAND (op, stmt, iter, SSA_OP_USE)
+ gcc_assert (is_gimple_assign (stmt));
+
+ /* STMT must be either an assignment of a single SSA name or an
+ expression involving an SSA name and a constant. Try to fold that
+ expression using the value for the SSA name. */
+ if (gimple_assign_ssa_name_copy_p (stmt))
+ return get_val_for (gimple_assign_rhs1 (stmt), base);
+ else if (gimple_assign_rhs_class (stmt) == GIMPLE_UNARY_RHS
+ && TREE_CODE (gimple_assign_rhs1 (stmt)) == SSA_NAME)
{
- nx = USE_FROM_PTR (op);
- val = get_val_for (nx, base);
- SET_USE (op, val);
- val = fold (GIMPLE_STMT_OPERAND (stmt, 1));
- SET_USE (op, nx);
- /* only iterate loop once. */
- return val;
+ return fold_build1 (gimple_assign_rhs_code (stmt),
+ gimple_expr_type (stmt),
+ get_val_for (gimple_assign_rhs1 (stmt), base));
}
-
- /* Should never reach here. */
- gcc_unreachable ();
+ else if (gimple_assign_rhs_class (stmt) == GIMPLE_BINARY_RHS)
+ {
+ tree rhs1 = gimple_assign_rhs1 (stmt);
+ tree rhs2 = gimple_assign_rhs2 (stmt);
+ if (TREE_CODE (rhs1) == SSA_NAME)
+ rhs1 = get_val_for (rhs1, base);
+ else if (TREE_CODE (rhs2) == SSA_NAME)
+ rhs2 = get_val_for (rhs2, base);
+ else
+ gcc_unreachable ();
+ return fold_build2 (gimple_assign_rhs_code (stmt),
+ gimple_expr_type (stmt), rhs1, rhs2);
+ }
+ else
+ gcc_unreachable ();
}
+
/* Tries to count the number of iterations of LOOP till it exits by EXIT
by brute force -- i.e. by determining the value of the operands of the
condition at EXIT in first few iterations of the loop (assuming that
@@ -2036,20 +2086,20 @@ get_val_for (tree x, tree base)
tree
loop_niter_by_eval (struct loop *loop, edge exit)
{
- tree cond, cnd, acnd;
- tree op[2], val[2], next[2], aval[2], phi[2];
+ tree acnd;
+ tree op[2], val[2], next[2], aval[2];
+ gimple phi, cond;
unsigned i, j;
enum tree_code cmp;
cond = last_stmt (exit->src);
- if (!cond || TREE_CODE (cond) != COND_EXPR)
+ if (!cond || gimple_code (cond) != GIMPLE_COND)
return chrec_dont_know;
- cnd = COND_EXPR_COND (cond);
+ cmp = gimple_cond_code (cond);
if (exit->flags & EDGE_TRUE_VALUE)
- cnd = invert_truthvalue (cnd);
+ cmp = invert_tree_comparison (cmp, false);
- cmp = TREE_CODE (cnd);
switch (cmp)
{
case EQ_EXPR:
@@ -2058,8 +2108,8 @@ loop_niter_by_eval (struct loop *loop, edge exit)
case GE_EXPR:
case LT_EXPR:
case LE_EXPR:
- for (j = 0; j < 2; j++)
- op[j] = TREE_OPERAND (cnd, j);
+ op[0] = gimple_cond_lhs (cond);
+ op[1] = gimple_cond_rhs (cond);
break;
default:
@@ -2068,23 +2118,19 @@ loop_niter_by_eval (struct loop *loop, edge exit)
for (j = 0; j < 2; j++)
{
- phi[j] = get_base_for (loop, op[j]);
- if (!phi[j])
- return chrec_dont_know;
- }
-
- for (j = 0; j < 2; j++)
- {
- if (TREE_CODE (phi[j]) == PHI_NODE)
+ if (is_gimple_min_invariant (op[j]))
{
- val[j] = PHI_ARG_DEF_FROM_EDGE (phi[j], loop_preheader_edge (loop));
- next[j] = PHI_ARG_DEF_FROM_EDGE (phi[j], loop_latch_edge (loop));
+ val[j] = op[j];
+ next[j] = NULL_TREE;
+ op[j] = NULL_TREE;
}
else
{
- val[j] = phi[j];
- next[j] = NULL_TREE;
- op[j] = NULL_TREE;
+ phi = get_base_for (loop, op[j]);
+ if (!phi)
+ return chrec_dont_know;
+ val[j] = PHI_ARG_DEF_FROM_EDGE (phi, loop_preheader_edge (loop));
+ next[j] = PHI_ARG_DEF_FROM_EDGE (phi, loop_latch_edge (loop));
}
}
@@ -2166,17 +2212,48 @@ find_loop_niter_by_eval (struct loop *loop, edge *exit)
*/
+static double_int derive_constant_upper_bound_ops (tree, tree,
+ enum tree_code, tree);
+
+/* Returns a constant upper bound on the value of the right-hand side of
+ an assignment statement STMT. */
+
+static double_int
+derive_constant_upper_bound_assign (gimple stmt)
+{
+ enum tree_code code = gimple_assign_rhs_code (stmt);
+ tree op0 = gimple_assign_rhs1 (stmt);
+ tree op1 = gimple_assign_rhs2 (stmt);
+
+ return derive_constant_upper_bound_ops (TREE_TYPE (gimple_assign_lhs (stmt)),
+ op0, code, op1);
+}
+
/* Returns a constant upper bound on the value of expression VAL. VAL
is considered to be unsigned. If its type is signed, its value must
be nonnegative. */
static double_int
-derive_constant_upper_bound (const_tree val)
+derive_constant_upper_bound (tree val)
{
- tree type = TREE_TYPE (val);
- tree op0, op1, subtype, maxt;
+ enum tree_code code;
+ tree op0, op1;
+
+ extract_ops_from_tree (val, &code, &op0, &op1);
+ return derive_constant_upper_bound_ops (TREE_TYPE (val), op0, code, op1);
+}
+
+/* Returns a constant upper bound on the value of expression OP0 CODE OP1,
+ whose type is TYPE. The expression is considered to be unsigned. If
+ its type is signed, its value must be nonnegative. */
+
+static double_int
+derive_constant_upper_bound_ops (tree type, tree op0,
+ enum tree_code code, tree op1)
+{
+ tree subtype, maxt;
double_int bnd, max, mmax, cst;
- tree stmt;
+ gimple stmt;
if (INTEGRAL_TYPE_P (type))
maxt = TYPE_MAX_VALUE (type);
@@ -2185,13 +2262,12 @@ derive_constant_upper_bound (const_tree val)
max = tree_to_double_int (maxt);
- switch (TREE_CODE (val))
+ switch (code)
{
case INTEGER_CST:
- return tree_to_double_int (val);
+ return tree_to_double_int (op0);
CASE_CONVERT:
- op0 = TREE_OPERAND (val, 0);
subtype = TREE_TYPE (op0);
if (!TYPE_UNSIGNED (subtype)
/* If TYPE is also signed, the fact that VAL is nonnegative implies
@@ -2219,9 +2295,6 @@ derive_constant_upper_bound (const_tree val)
case PLUS_EXPR:
case POINTER_PLUS_EXPR:
case MINUS_EXPR:
- op0 = TREE_OPERAND (val, 0);
- op1 = TREE_OPERAND (val, 1);
-
if (TREE_CODE (op1) != INTEGER_CST
|| !tree_expr_nonnegative_p (op0))
return max;
@@ -2231,7 +2304,7 @@ derive_constant_upper_bound (const_tree val)
of the signedness of the type. */
cst = tree_to_double_int (op1);
cst = double_int_sext (cst, TYPE_PRECISION (type));
- if (TREE_CODE (val) == PLUS_EXPR)
+ if (code != MINUS_EXPR)
cst = double_int_neg (cst);
bnd = derive_constant_upper_bound (op0);
@@ -2285,8 +2358,6 @@ derive_constant_upper_bound (const_tree val)
case FLOOR_DIV_EXPR:
case EXACT_DIV_EXPR:
- op0 = TREE_OPERAND (val, 0);
- op1 = TREE_OPERAND (val, 1);
if (TREE_CODE (op1) != INTEGER_CST
|| tree_int_cst_sign_bit (op1))
return max;
@@ -2295,18 +2366,17 @@ derive_constant_upper_bound (const_tree val)
return double_int_udiv (bnd, tree_to_double_int (op1), FLOOR_DIV_EXPR);
case BIT_AND_EXPR:
- op1 = TREE_OPERAND (val, 1);
if (TREE_CODE (op1) != INTEGER_CST
|| tree_int_cst_sign_bit (op1))
return max;
return tree_to_double_int (op1);
case SSA_NAME:
- stmt = SSA_NAME_DEF_STMT (val);
- if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT
- || GIMPLE_STMT_OPERAND (stmt, 0) != val)
+ stmt = SSA_NAME_DEF_STMT (op0);
+ if (gimple_code (stmt) != GIMPLE_ASSIGN
+ || gimple_assign_lhs (stmt) != op0)
return max;
- return derive_constant_upper_bound (GIMPLE_STMT_OPERAND (stmt, 1));
+ return derive_constant_upper_bound_assign (stmt);
default:
return max;
@@ -2349,7 +2419,7 @@ record_niter_bound (struct loop *loop, double_int i_bound, bool realistic,
static void
record_estimate (struct loop *loop, tree bound, double_int i_bound,
- tree at_stmt, bool is_exit, bool realistic, bool upper)
+ gimple at_stmt, bool is_exit, bool realistic, bool upper)
{
double_int delta;
edge exit;
@@ -2357,7 +2427,7 @@ record_estimate (struct loop *loop, tree bound, double_int i_bound,
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Statement %s", is_exit ? "(exit)" : "");
- print_generic_expr (dump_file, at_stmt, TDF_SLIM);
+ print_gimple_stmt (dump_file, at_stmt, 0, TDF_SLIM);
fprintf (dump_file, " is %sexecuted at most ",
upper ? "" : "probably ");
print_generic_expr (dump_file, bound, TDF_SLIM);
@@ -2395,7 +2465,7 @@ record_estimate (struct loop *loop, tree bound, double_int i_bound,
if (is_exit
|| (exit != NULL
&& dominated_by_p (CDI_DOMINATORS,
- exit->src, bb_for_stmt (at_stmt))))
+ exit->src, gimple_bb (at_stmt))))
delta = double_int_one;
else
delta = double_int_two;
@@ -2415,7 +2485,7 @@ record_estimate (struct loop *loop, tree bound, double_int i_bound,
UPPER is true if we are sure the induction variable does not wrap. */
static void
-record_nonwrapping_iv (struct loop *loop, tree base, tree step, tree stmt,
+record_nonwrapping_iv (struct loop *loop, tree base, tree step, gimple stmt,
tree low, tree high, bool realistic, bool upper)
{
tree niter_bound, extreme, delta;
@@ -2434,7 +2504,7 @@ record_nonwrapping_iv (struct loop *loop, tree base, tree step, tree stmt,
fprintf (dump_file, " + ");
print_generic_expr (dump_file, step, TDF_SLIM);
fprintf (dump_file, " * iteration does not wrap in statement ");
- print_generic_expr (dump_file, stmt, TDF_SLIM);
+ print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM);
fprintf (dump_file, " in loop %d.\n", loop->num);
}
@@ -2515,7 +2585,7 @@ array_at_struct_end_p (tree ref)
struct ilb_data
{
struct loop *loop;
- tree stmt;
+ gimple stmt;
bool reliable;
};
@@ -2602,7 +2672,7 @@ idx_infer_loop_bounds (tree base, tree *idx, void *dta)
STMT is guaranteed to be executed in every iteration of LOOP.*/
static void
-infer_loop_bounds_from_ref (struct loop *loop, tree stmt, tree ref,
+infer_loop_bounds_from_ref (struct loop *loop, gimple stmt, tree ref,
bool reliable)
{
struct ilb_data data;
@@ -2618,14 +2688,12 @@ infer_loop_bounds_from_ref (struct loop *loop, tree stmt, tree ref,
executed in every iteration of LOOP. */
static void
-infer_loop_bounds_from_array (struct loop *loop, tree stmt, bool reliable)
+infer_loop_bounds_from_array (struct loop *loop, gimple stmt, bool reliable)
{
- tree call;
-
- if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT)
+ if (is_gimple_assign (stmt))
{
- tree op0 = GIMPLE_STMT_OPERAND (stmt, 0);
- tree op1 = GIMPLE_STMT_OPERAND (stmt, 1);
+ tree op0 = gimple_assign_lhs (stmt);
+ tree op1 = gimple_assign_rhs1 (stmt);
/* For each memory access, analyze its access function
and record a bound on the loop iteration domain. */
@@ -2635,17 +2703,21 @@ infer_loop_bounds_from_array (struct loop *loop, tree stmt, bool reliable)
if (REFERENCE_CLASS_P (op1))
infer_loop_bounds_from_ref (loop, stmt, op1, reliable);
}
-
-
- call = get_call_expr_in (stmt);
- if (call)
+ else if (is_gimple_call (stmt))
{
- tree arg;
- call_expr_arg_iterator iter;
+ tree arg, lhs;
+ unsigned i, n = gimple_call_num_args (stmt);
+
+ lhs = gimple_call_lhs (stmt);
+ if (lhs && REFERENCE_CLASS_P (lhs))
+ infer_loop_bounds_from_ref (loop, stmt, lhs, reliable);
- FOR_EACH_CALL_EXPR_ARG (arg, iter, call)
- if (REFERENCE_CLASS_P (arg))
- infer_loop_bounds_from_ref (loop, stmt, arg, reliable);
+ for (i = 0; i < n; i++)
+ {
+ arg = gimple_call_arg (stmt, i);
+ if (REFERENCE_CLASS_P (arg))
+ infer_loop_bounds_from_ref (loop, stmt, arg, reliable);
+ }
}
}
@@ -2653,14 +2725,14 @@ infer_loop_bounds_from_array (struct loop *loop, tree stmt, bool reliable)
that signed arithmetics in STMT does not overflow. */
static void
-infer_loop_bounds_from_signedness (struct loop *loop, tree stmt)
+infer_loop_bounds_from_signedness (struct loop *loop, gimple stmt)
{
tree def, base, step, scev, type, low, high;
- if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
+ if (gimple_code (stmt) != GIMPLE_ASSIGN)
return;
- def = GIMPLE_STMT_OPERAND (stmt, 0);
+ def = gimple_assign_lhs (stmt);
if (TREE_CODE (def) != SSA_NAME)
return;
@@ -2703,7 +2775,7 @@ infer_loop_bounds_from_undefined (struct loop *loop)
{
unsigned i;
basic_block *bbs;
- block_stmt_iterator bsi;
+ gimple_stmt_iterator bsi;
basic_block bb;
bool reliable;
@@ -2718,9 +2790,9 @@ infer_loop_bounds_from_undefined (struct loop *loop)
# of iterations of the loop. However, we can use it as a guess. */
reliable = dominated_by_p (CDI_DOMINATORS, loop->latch, bb);
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
{
- tree stmt = bsi_stmt (bsi);
+ gimple stmt = gsi_stmt (bsi);
infer_loop_bounds_from_array (loop, stmt, reliable);
@@ -2830,9 +2902,9 @@ estimate_numbers_of_iterations (void)
/* Returns true if statement S1 dominates statement S2. */
bool
-stmt_dominates_stmt_p (tree s1, tree s2)
+stmt_dominates_stmt_p (gimple s1, gimple s2)
{
- basic_block bb1 = bb_for_stmt (s1), bb2 = bb_for_stmt (s2);
+ basic_block bb1 = gimple_bb (s1), bb2 = gimple_bb (s2);
if (!bb1
|| s1 == s2)
@@ -2840,10 +2912,16 @@ stmt_dominates_stmt_p (tree s1, tree s2)
if (bb1 == bb2)
{
- block_stmt_iterator bsi;
+ gimple_stmt_iterator bsi;
+
+ if (gimple_code (s2) == GIMPLE_PHI)
+ return false;
+
+ if (gimple_code (s1) == GIMPLE_PHI)
+ return true;
- for (bsi = bsi_start (bb1); bsi_stmt (bsi) != s2; bsi_next (&bsi))
- if (bsi_stmt (bsi) == s1)
+ for (bsi = gsi_start_bb (bb1); gsi_stmt (bsi) != s2; gsi_next (&bsi))
+ if (gsi_stmt (bsi) == s1)
return true;
return false;
@@ -2859,7 +2937,7 @@ stmt_dominates_stmt_p (tree s1, tree s2)
statements in the loop. */
static bool
-n_of_executions_at_most (tree stmt,
+n_of_executions_at_most (gimple stmt,
struct nb_iter_bound *niter_bound,
tree niter)
{
@@ -2900,7 +2978,7 @@ n_of_executions_at_most (tree stmt,
else
{
if (!stmt
- || (bb_for_stmt (stmt) != bb_for_stmt (niter_bound->stmt)
+ || (gimple_bb (stmt) != gimple_bb (niter_bound->stmt)
&& !stmt_dominates_stmt_p (niter_bound->stmt, stmt)))
{
bound = double_int_add (bound, double_int_one);
@@ -2943,7 +3021,7 @@ nowrap_type_p (tree type)
bool
scev_probably_wraps_p (tree base, tree step,
- tree at_stmt, struct loop *loop,
+ gimple at_stmt, struct loop *loop,
bool use_overflow_semantics)
{
struct nb_iter_bound *bound;
diff --git a/gcc/tree-ssa-loop-prefetch.c b/gcc/tree-ssa-loop-prefetch.c
index 14044c407d7..02b4d7347df 100644
--- a/gcc/tree-ssa-loop-prefetch.c
+++ b/gcc/tree-ssa-loop-prefetch.c
@@ -201,7 +201,7 @@ struct mem_ref_group
struct mem_ref
{
- tree stmt; /* Statement in that the reference appears. */
+ gimple stmt; /* Statement in that the reference appears. */
tree mem; /* The reference. */
HOST_WIDE_INT delta; /* Constant offset of the reference. */
struct mem_ref_group *group; /* The group of references it belongs to. */
@@ -278,7 +278,7 @@ find_or_create_group (struct mem_ref_group **groups, tree base,
WRITE_P. The reference occurs in statement STMT. */
static void
-record_ref (struct mem_ref_group *group, tree stmt, tree mem,
+record_ref (struct mem_ref_group *group, gimple stmt, tree mem,
HOST_WIDE_INT delta, bool write_p)
{
struct mem_ref **aref;
@@ -344,7 +344,7 @@ release_mem_refs (struct mem_ref_group *groups)
struct ar_data
{
struct loop *loop; /* Loop of the reference. */
- tree stmt; /* Statement of the reference. */
+ gimple stmt; /* Statement of the reference. */
HOST_WIDE_INT *step; /* Step of the memory reference. */
HOST_WIDE_INT *delta; /* Offset of the memory reference. */
};
@@ -411,7 +411,7 @@ idx_analyze_ref (tree base, tree *index, void *data)
static bool
analyze_ref (struct loop *loop, tree *ref_p, tree *base,
HOST_WIDE_INT *step, HOST_WIDE_INT *delta,
- tree stmt)
+ gimple stmt)
{
struct ar_data ar_data;
tree off;
@@ -451,7 +451,7 @@ analyze_ref (struct loop *loop, tree *ref_p, tree *base,
static bool
gather_memory_references_ref (struct loop *loop, struct mem_ref_group **refs,
- tree ref, bool write_p, tree stmt)
+ tree ref, bool write_p, gimple stmt)
{
tree base;
HOST_WIDE_INT step, delta;
@@ -480,8 +480,9 @@ gather_memory_references (struct loop *loop, bool *no_other_refs)
basic_block *body = get_loop_body_in_dom_order (loop);
basic_block bb;
unsigned i;
- block_stmt_iterator bsi;
- tree stmt, lhs, rhs, call;
+ gimple_stmt_iterator bsi;
+ gimple stmt;
+ tree lhs, rhs;
struct mem_ref_group *refs = NULL;
*no_other_refs = true;
@@ -494,22 +495,21 @@ gather_memory_references (struct loop *loop, bool *no_other_refs)
if (bb->loop_father != loop)
continue;
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
{
- stmt = bsi_stmt (bsi);
- call = get_call_expr_in (stmt);
- if (call && !(call_expr_flags (call) & ECF_CONST))
- *no_other_refs = false;
+ stmt = gsi_stmt (bsi);
- if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
+ if (gimple_code (stmt) != GIMPLE_ASSIGN)
{
- if (!ZERO_SSA_OPERANDS (stmt, SSA_OP_ALL_VIRTUALS))
+ if (!ZERO_SSA_OPERANDS (stmt, SSA_OP_ALL_VIRTUALS)
+ || (is_gimple_call (stmt)
+ && !(gimple_call_flags (stmt) & ECF_CONST)))
*no_other_refs = false;
continue;
}
- lhs = GIMPLE_STMT_OPERAND (stmt, 0);
- rhs = GIMPLE_STMT_OPERAND (stmt, 1);
+ lhs = gimple_assign_lhs (stmt);
+ rhs = gimple_assign_rhs1 (stmt);
if (REFERENCE_CLASS_P (rhs))
*no_other_refs &= gather_memory_references_ref (loop, &refs,
@@ -869,8 +869,9 @@ static void
issue_prefetch_ref (struct mem_ref *ref, unsigned unroll_factor, unsigned ahead)
{
HOST_WIDE_INT delta;
- tree addr, addr_base, prefetch, write_p, local;
- block_stmt_iterator bsi;
+ tree addr, addr_base, write_p, local;
+ gimple prefetch;
+ gimple_stmt_iterator bsi;
unsigned n_prefetches, ap;
bool nontemporal = ref->reuse_distance >= L2_CACHE_SIZE_BYTES;
@@ -879,13 +880,13 @@ issue_prefetch_ref (struct mem_ref *ref, unsigned unroll_factor, unsigned ahead)
nontemporal ? " nontemporal" : "",
(void *) ref);
- bsi = bsi_for_stmt (ref->stmt);
+ bsi = gsi_for_stmt (ref->stmt);
n_prefetches = ((unroll_factor + ref->prefetch_mod - 1)
/ ref->prefetch_mod);
addr_base = build_fold_addr_expr_with_type (ref->mem, ptr_type_node);
- addr_base = force_gimple_operand_bsi (&bsi, unshare_expr (addr_base),
- true, NULL, true, BSI_SAME_STMT);
+ addr_base = force_gimple_operand_gsi (&bsi, unshare_expr (addr_base),
+ true, NULL, true, GSI_SAME_STMT);
write_p = ref->write_p ? integer_one_node : integer_zero_node;
local = build_int_cst (integer_type_node, nontemporal ? 0 : 3);
@@ -895,13 +896,13 @@ issue_prefetch_ref (struct mem_ref *ref, unsigned unroll_factor, unsigned ahead)
delta = (ahead + ap * ref->prefetch_mod) * ref->group->step;
addr = fold_build2 (POINTER_PLUS_EXPR, ptr_type_node,
addr_base, size_int (delta));
- addr = force_gimple_operand_bsi (&bsi, unshare_expr (addr), true, NULL,
- true, BSI_SAME_STMT);
+ addr = force_gimple_operand_gsi (&bsi, unshare_expr (addr), true, NULL,
+ true, GSI_SAME_STMT);
/* Create the prefetch instruction. */
- prefetch = build_call_expr (built_in_decls[BUILT_IN_PREFETCH],
- 3, addr, write_p, local);
- bsi_insert_before (&bsi, prefetch, BSI_SAME_STMT);
+ prefetch = gimple_build_call (built_in_decls[BUILT_IN_PREFETCH],
+ 3, addr, write_p, local);
+ gsi_insert_before (&bsi, prefetch, GSI_SAME_STMT);
}
}
@@ -960,7 +961,7 @@ mark_nontemporal_store (struct mem_ref *ref)
fprintf (dump_file, "Marked reference %p as a nontemporal store.\n",
(void *) ref);
- MOVE_NONTEMPORAL (ref->stmt) = true;
+ gimple_assign_set_nontemporal_move (ref->stmt, true);
ref->storent_p = true;
return true;
@@ -973,22 +974,22 @@ emit_mfence_after_loop (struct loop *loop)
{
VEC (edge, heap) *exits = get_loop_exit_edges (loop);
edge exit;
- tree call;
- block_stmt_iterator bsi;
+ gimple call;
+ gimple_stmt_iterator bsi;
unsigned i;
for (i = 0; VEC_iterate (edge, exits, i, exit); i++)
{
- call = build_function_call_expr (FENCE_FOLLOWING_MOVNT, NULL_TREE);
+ call = gimple_build_call (FENCE_FOLLOWING_MOVNT, 0);
if (!single_pred_p (exit->dest)
/* If possible, we prefer not to insert the fence on other paths
in cfg. */
&& !(exit->flags & EDGE_ABNORMAL))
split_loop_exit_edge (exit);
- bsi = bsi_after_labels (exit->dest);
+ bsi = gsi_after_labels (exit->dest);
- bsi_insert_before (&bsi, call, BSI_NEW_STMT);
+ gsi_insert_before (&bsi, call, GSI_NEW_STMT);
mark_virtual_ops_for_renaming (call);
}
diff --git a/gcc/tree-ssa-loop-unswitch.c b/gcc/tree-ssa-loop-unswitch.c
index b63c2095df4..850270f49c0 100644
--- a/gcc/tree-ssa-loop-unswitch.c
+++ b/gcc/tree-ssa-loop-unswitch.c
@@ -103,26 +103,29 @@ tree_ssa_unswitch_loops (void)
static tree
tree_may_unswitch_on (basic_block bb, struct loop *loop)
{
- tree stmt, def, cond, use;
+ gimple stmt, def;
+ tree cond, use;
basic_block def_bb;
ssa_op_iter iter;
/* BB must end in a simple conditional jump. */
stmt = last_stmt (bb);
- if (!stmt || TREE_CODE (stmt) != COND_EXPR)
+ if (!stmt || gimple_code (stmt) != GIMPLE_COND)
return NULL_TREE;
/* Condition must be invariant. */
FOR_EACH_SSA_TREE_OPERAND (use, stmt, iter, SSA_OP_USE)
{
def = SSA_NAME_DEF_STMT (use);
- def_bb = bb_for_stmt (def);
+ def_bb = gimple_bb (def);
if (def_bb
&& flow_bb_inside_loop_p (loop, def_bb))
return NULL_TREE;
}
- cond = COND_EXPR_COND (stmt);
+ cond = build2 (gimple_cond_code (stmt), boolean_type_node,
+ gimple_cond_lhs (stmt), gimple_cond_rhs (stmt));
+
/* To keep the things simple, we do not directly remove the conditions,
but just replace tests with 0/1. Prevent the infinite loop where we
would unswitch again on such a condition. */
@@ -140,14 +143,18 @@ static tree
simplify_using_entry_checks (struct loop *loop, tree cond)
{
edge e = loop_preheader_edge (loop);
- tree stmt;
+ gimple stmt;
while (1)
{
stmt = last_stmt (e->src);
if (stmt
- && TREE_CODE (stmt) == COND_EXPR
- && operand_equal_p (COND_EXPR_COND (stmt), cond, 0))
+ && gimple_code (stmt) == GIMPLE_COND
+ && gimple_cond_code (stmt) == TREE_CODE (cond)
+ && operand_equal_p (gimple_cond_lhs (stmt),
+ TREE_OPERAND (cond, 0), 0)
+ && operand_equal_p (gimple_cond_rhs (stmt),
+ TREE_OPERAND (cond, 1), 0))
return (e->flags & EDGE_TRUE_VALUE
? boolean_true_node
: boolean_false_node);
@@ -171,7 +178,8 @@ tree_unswitch_single_loop (struct loop *loop, int num)
basic_block *bbs;
struct loop *nloop;
unsigned i;
- tree cond = NULL_TREE, stmt;
+ tree cond = NULL_TREE;
+ gimple stmt;
bool changed = false;
/* Do not unswitch too much. */
@@ -220,13 +228,13 @@ tree_unswitch_single_loop (struct loop *loop, int num)
if (integer_nonzerop (cond))
{
/* Remove false path. */
- COND_EXPR_COND (stmt) = boolean_true_node;
+ gimple_cond_set_condition_from_tree (stmt, boolean_true_node);
changed = true;
}
else if (integer_zerop (cond))
{
/* Remove true path. */
- COND_EXPR_COND (stmt) = boolean_false_node;
+ gimple_cond_set_condition_from_tree (stmt, boolean_false_node);
changed = true;
}
else
diff --git a/gcc/tree-ssa-loop.c b/gcc/tree-ssa-loop.c
index 52f5a7f58f8..ec3782a5450 100644
--- a/gcc/tree-ssa-loop.c
+++ b/gcc/tree-ssa-loop.c
@@ -37,16 +37,6 @@ along with GCC; see the file COPYING3. If not see
#include "tree-inline.h"
#include "tree-scalar-evolution.h"
-/* Initializes the loop structures. */
-
-static void
-tree_loop_optimizer_init (void)
-{
- loop_optimizer_init (LOOPS_NORMAL
- | LOOPS_HAVE_RECORDED_EXITS);
- rewrite_into_loop_closed_ssa (NULL, TODO_update_ssa);
-}
-
/* The loop superpass. */
static bool
@@ -79,7 +69,10 @@ struct gimple_opt_pass pass_tree_loop =
static unsigned int
tree_ssa_loop_init (void)
{
- tree_loop_optimizer_init ();
+ loop_optimizer_init (LOOPS_NORMAL
+ | LOOPS_HAVE_RECORDED_EXITS);
+ rewrite_into_loop_closed_ssa (NULL, TODO_update_ssa);
+
if (number_of_loops () <= 1)
return 0;
diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c
index 49fd1707d1e..844ec9d1ad0 100644
--- a/gcc/tree-ssa-math-opts.c
+++ b/gcc/tree-ssa-math-opts.c
@@ -110,9 +110,9 @@ struct occurrence {
inserted in BB. */
tree recip_def;
- /* If non-NULL, the GIMPLE_MODIFY_STMT for a reciprocal computation that
+ /* If non-NULL, the GIMPLE_ASSIGN for a reciprocal computation that
was inserted in BB. */
- tree recip_def_stmt;
+ gimple recip_def_stmt;
/* Pointer to a list of "struct occurrence"s for blocks dominated
by BB. */
@@ -271,15 +271,15 @@ compute_merit (struct occurrence *occ)
/* Return whether USE_STMT is a floating-point division by DEF. */
static inline bool
-is_division_by (tree use_stmt, tree def)
+is_division_by (gimple use_stmt, tree def)
{
- return TREE_CODE (use_stmt) == GIMPLE_MODIFY_STMT
- && TREE_CODE (GIMPLE_STMT_OPERAND (use_stmt, 1)) == RDIV_EXPR
- && TREE_OPERAND (GIMPLE_STMT_OPERAND (use_stmt, 1), 1) == def
+ return is_gimple_assign (use_stmt)
+ && gimple_assign_rhs_code (use_stmt) == RDIV_EXPR
+ && gimple_assign_rhs2 (use_stmt) == def
/* Do not recognize x / x as valid division, as we are getting
confused later by replacing all immediate uses x in such
a stmt. */
- && TREE_OPERAND (GIMPLE_STMT_OPERAND (use_stmt, 1), 0) != def;
+ && gimple_assign_rhs1 (use_stmt) != def;
}
/* Walk the subset of the dominator tree rooted at OCC, setting the
@@ -292,11 +292,12 @@ is_division_by (tree use_stmt, tree def)
be used. */
static void
-insert_reciprocals (block_stmt_iterator *def_bsi, struct occurrence *occ,
+insert_reciprocals (gimple_stmt_iterator *def_gsi, struct occurrence *occ,
tree def, tree recip_def, int threshold)
{
- tree type, new_stmt;
- block_stmt_iterator bsi;
+ tree type;
+ gimple new_stmt;
+ gimple_stmt_iterator gsi;
struct occurrence *occ_child;
if (!recip_def
@@ -306,34 +307,31 @@ insert_reciprocals (block_stmt_iterator *def_bsi, struct occurrence *occ,
/* Make a variable with the replacement and substitute it. */
type = TREE_TYPE (def);
recip_def = make_rename_temp (type, "reciptmp");
- new_stmt = build_gimple_modify_stmt (recip_def,
- fold_build2 (RDIV_EXPR, type,
- build_one_cst (type),
- def));
-
+ new_stmt = gimple_build_assign_with_ops (RDIV_EXPR, recip_def,
+ build_one_cst (type), def);
if (occ->bb_has_division)
{
/* Case 1: insert before an existing division. */
- bsi = bsi_after_labels (occ->bb);
- while (!bsi_end_p (bsi) && !is_division_by (bsi_stmt (bsi), def))
- bsi_next (&bsi);
+ gsi = gsi_after_labels (occ->bb);
+ while (!gsi_end_p (gsi) && !is_division_by (gsi_stmt (gsi), def))
+ gsi_next (&gsi);
- bsi_insert_before (&bsi, new_stmt, BSI_SAME_STMT);
+ gsi_insert_before (&gsi, new_stmt, GSI_SAME_STMT);
}
- else if (def_bsi && occ->bb == def_bsi->bb)
+ else if (def_gsi && occ->bb == def_gsi->bb)
{
/* Case 2: insert right after the definition. Note that this will
never happen if the definition statement can throw, because in
that case the sole successor of the statement's basic block will
dominate all the uses as well. */
- bsi_insert_after (def_bsi, new_stmt, BSI_NEW_STMT);
+ gsi_insert_after (def_gsi, new_stmt, GSI_NEW_STMT);
}
else
{
/* Case 3: insert in a basic block not containing defs/uses. */
- bsi = bsi_after_labels (occ->bb);
- bsi_insert_before (&bsi, new_stmt, BSI_SAME_STMT);
+ gsi = gsi_after_labels (occ->bb);
+ gsi_insert_before (&gsi, new_stmt, GSI_SAME_STMT);
}
occ->recip_def_stmt = new_stmt;
@@ -341,7 +339,7 @@ insert_reciprocals (block_stmt_iterator *def_bsi, struct occurrence *occ,
occ->recip_def = recip_def;
for (occ_child = occ->children; occ_child; occ_child = occ_child->next)
- insert_reciprocals (def_bsi, occ_child, def, recip_def, threshold);
+ insert_reciprocals (def_gsi, occ_child, def, recip_def, threshold);
}
@@ -351,13 +349,13 @@ insert_reciprocals (block_stmt_iterator *def_bsi, struct occurrence *occ,
static inline void
replace_reciprocal (use_operand_p use_p)
{
- tree use_stmt = USE_STMT (use_p);
- basic_block bb = bb_for_stmt (use_stmt);
+ gimple use_stmt = USE_STMT (use_p);
+ basic_block bb = gimple_bb (use_stmt);
struct occurrence *occ = (struct occurrence *) bb->aux;
if (occ->recip_def && use_stmt != occ->recip_def_stmt)
{
- TREE_SET_CODE (GIMPLE_STMT_OPERAND (use_stmt, 1), MULT_EXPR);
+ gimple_assign_set_rhs_code (use_stmt, MULT_EXPR);
SET_USE (use_p, occ->recip_def);
fold_stmt_inplace (use_stmt);
update_stmt (use_stmt);
@@ -398,7 +396,7 @@ free_bb (struct occurrence *occ)
DEF must be a GIMPLE register of a floating-point type. */
static void
-execute_cse_reciprocals_1 (block_stmt_iterator *def_bsi, tree def)
+execute_cse_reciprocals_1 (gimple_stmt_iterator *def_gsi, tree def)
{
use_operand_p use_p;
imm_use_iterator use_iter;
@@ -409,10 +407,10 @@ execute_cse_reciprocals_1 (block_stmt_iterator *def_bsi, tree def)
FOR_EACH_IMM_USE_FAST (use_p, use_iter, def)
{
- tree use_stmt = USE_STMT (use_p);
+ gimple use_stmt = USE_STMT (use_p);
if (is_division_by (use_stmt, def))
{
- register_division_in (bb_for_stmt (use_stmt));
+ register_division_in (gimple_bb (use_stmt));
count++;
}
}
@@ -421,11 +419,11 @@ execute_cse_reciprocals_1 (block_stmt_iterator *def_bsi, tree def)
threshold = targetm.min_divisions_for_recip_mul (TYPE_MODE (TREE_TYPE (def)));
if (count >= threshold)
{
- tree use_stmt;
+ gimple use_stmt;
for (occ = occ_head; occ; occ = occ->next)
{
compute_merit (occ);
- insert_reciprocals (def_bsi, occ, def, NULL, threshold);
+ insert_reciprocals (def_gsi, occ, def, NULL, threshold);
}
FOR_EACH_IMM_USE_STMT (use_stmt, use_iter, def)
@@ -478,56 +476,55 @@ execute_cse_reciprocals (void)
FOR_EACH_BB (bb)
{
- block_stmt_iterator bsi;
- tree phi, def;
+ gimple_stmt_iterator gsi;
+ gimple phi;
+ tree def;
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
+ for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
+ phi = gsi_stmt (gsi);
def = PHI_RESULT (phi);
if (FLOAT_TYPE_P (TREE_TYPE (def))
&& is_gimple_reg (def))
execute_cse_reciprocals_1 (NULL, def);
}
- for (bsi = bsi_after_labels (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ for (gsi = gsi_after_labels (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- tree stmt = bsi_stmt (bsi);
+ gimple stmt = gsi_stmt (gsi);
- if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
+ if (gimple_has_lhs (stmt)
&& (def = SINGLE_SSA_TREE_OPERAND (stmt, SSA_OP_DEF)) != NULL
&& FLOAT_TYPE_P (TREE_TYPE (def))
&& TREE_CODE (def) == SSA_NAME)
- execute_cse_reciprocals_1 (&bsi, def);
+ execute_cse_reciprocals_1 (&gsi, def);
}
/* Scan for a/func(b) and convert it to reciprocal a*rfunc(b). */
- for (bsi = bsi_after_labels (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ for (gsi = gsi_after_labels (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- tree stmt = bsi_stmt (bsi);
+ gimple stmt = gsi_stmt (gsi);
tree fndecl;
- if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
- && TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 1)) == RDIV_EXPR)
+ if (is_gimple_assign (stmt)
+ && gimple_assign_rhs_code (stmt) == RDIV_EXPR)
{
- tree arg1 = TREE_OPERAND (GIMPLE_STMT_OPERAND (stmt, 1), 1);
- tree stmt1;
+ tree arg1 = gimple_assign_rhs2 (stmt);
+ gimple stmt1;
if (TREE_CODE (arg1) != SSA_NAME)
continue;
stmt1 = SSA_NAME_DEF_STMT (arg1);
- if (TREE_CODE (stmt1) == GIMPLE_MODIFY_STMT
- && TREE_CODE (GIMPLE_STMT_OPERAND (stmt1, 1)) == CALL_EXPR
- && (fndecl
- = get_callee_fndecl (GIMPLE_STMT_OPERAND (stmt1, 1)))
+ if (is_gimple_call (stmt1)
+ && gimple_call_lhs (stmt1)
+ && (fndecl = gimple_call_fndecl (stmt1))
&& (DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL
|| DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_MD))
{
enum built_in_function code;
bool md_code;
- tree arg10;
- tree tmp;
code = DECL_FUNCTION_CODE (fndecl);
md_code = DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_MD;
@@ -536,12 +533,10 @@ execute_cse_reciprocals (void)
if (!fndecl)
continue;
- arg10 = CALL_EXPR_ARG (GIMPLE_STMT_OPERAND (stmt1, 1), 0);
- tmp = build_call_expr (fndecl, 1, arg10);
- GIMPLE_STMT_OPERAND (stmt1, 1) = tmp;
+ gimple_call_set_fndecl (stmt1, fndecl);
update_stmt (stmt1);
- TREE_SET_CODE (GIMPLE_STMT_OPERAND (stmt, 1), MULT_EXPR);
+ gimple_assign_set_rhs_code (stmt, MULT_EXPR);
fold_stmt_inplace (stmt);
update_stmt (stmt);
}
@@ -582,18 +577,18 @@ struct gimple_opt_pass pass_cse_reciprocals =
statements in the vector. */
static bool
-maybe_record_sincos (VEC(tree, heap) **stmts,
- basic_block *top_bb, tree use_stmt)
+maybe_record_sincos (VEC(gimple, heap) **stmts,
+ basic_block *top_bb, gimple use_stmt)
{
- basic_block use_bb = bb_for_stmt (use_stmt);
+ basic_block use_bb = gimple_bb (use_stmt);
if (*top_bb
&& (*top_bb == use_bb
|| dominated_by_p (CDI_DOMINATORS, use_bb, *top_bb)))
- VEC_safe_push (tree, heap, *stmts, use_stmt);
+ VEC_safe_push (gimple, heap, *stmts, use_stmt);
else if (!*top_bb
|| dominated_by_p (CDI_DOMINATORS, *top_bb, use_bb))
{
- VEC_safe_push (tree, heap, *stmts, use_stmt);
+ VEC_safe_push (gimple, heap, *stmts, use_stmt);
*top_bb = use_bb;
}
else
@@ -613,20 +608,21 @@ maybe_record_sincos (VEC(tree, heap) **stmts,
static void
execute_cse_sincos_1 (tree name)
{
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
imm_use_iterator use_iter;
- tree def_stmt, use_stmt, fndecl, res, call, stmt, type;
+ tree fndecl, res, type;
+ gimple def_stmt, use_stmt, stmt;
int seen_cos = 0, seen_sin = 0, seen_cexpi = 0;
- VEC(tree, heap) *stmts = NULL;
+ VEC(gimple, heap) *stmts = NULL;
basic_block top_bb = NULL;
int i;
type = TREE_TYPE (name);
FOR_EACH_IMM_USE_STMT (use_stmt, use_iter, name)
{
- if (TREE_CODE (use_stmt) != GIMPLE_MODIFY_STMT
- || TREE_CODE (GIMPLE_STMT_OPERAND (use_stmt, 1)) != CALL_EXPR
- || !(fndecl = get_callee_fndecl (GIMPLE_STMT_OPERAND (use_stmt, 1)))
+ if (gimple_code (use_stmt) != GIMPLE_CALL
+ || !gimple_call_lhs (use_stmt)
+ || !(fndecl = gimple_call_fndecl (use_stmt))
|| DECL_BUILT_IN_CLASS (fndecl) != BUILT_IN_NORMAL)
continue;
@@ -650,7 +646,7 @@ execute_cse_sincos_1 (tree name)
if (seen_cos + seen_sin + seen_cexpi <= 1)
{
- VEC_free(tree, heap, stmts);
+ VEC_free(gimple, heap, stmts);
return;
}
@@ -660,51 +656,57 @@ execute_cse_sincos_1 (tree name)
if (!fndecl)
return;
res = make_rename_temp (TREE_TYPE (TREE_TYPE (fndecl)), "sincostmp");
- call = build_call_expr (fndecl, 1, name);
- stmt = build_gimple_modify_stmt (res, call);
+ stmt = gimple_build_call (fndecl, 1, name);
+ gimple_call_set_lhs (stmt, res);
+
def_stmt = SSA_NAME_DEF_STMT (name);
if (!SSA_NAME_IS_DEFAULT_DEF (name)
- && TREE_CODE (def_stmt) != PHI_NODE
- && bb_for_stmt (def_stmt) == top_bb)
+ && gimple_code (def_stmt) != GIMPLE_PHI
+ && gimple_bb (def_stmt) == top_bb)
{
- bsi = bsi_for_stmt (def_stmt);
- bsi_insert_after (&bsi, stmt, BSI_SAME_STMT);
+ gsi = gsi_for_stmt (def_stmt);
+ gsi_insert_after (&gsi, stmt, GSI_SAME_STMT);
}
else
{
- bsi = bsi_after_labels (top_bb);
- bsi_insert_before (&bsi, stmt, BSI_SAME_STMT);
+ gsi = gsi_after_labels (top_bb);
+ gsi_insert_before (&gsi, stmt, GSI_SAME_STMT);
}
update_stmt (stmt);
/* And adjust the recorded old call sites. */
- for (i = 0; VEC_iterate(tree, stmts, i, use_stmt); ++i)
+ for (i = 0; VEC_iterate(gimple, stmts, i, use_stmt); ++i)
{
- fndecl = get_callee_fndecl (GIMPLE_STMT_OPERAND (use_stmt, 1));
+ tree rhs = NULL;
+ fndecl = gimple_call_fndecl (use_stmt);
+
switch (DECL_FUNCTION_CODE (fndecl))
{
CASE_FLT_FN (BUILT_IN_COS):
- GIMPLE_STMT_OPERAND (use_stmt, 1) = fold_build1 (REALPART_EXPR,
- type, res);
+ rhs = fold_build1 (REALPART_EXPR, type, res);
break;
CASE_FLT_FN (BUILT_IN_SIN):
- GIMPLE_STMT_OPERAND (use_stmt, 1) = fold_build1 (IMAGPART_EXPR,
- type, res);
+ rhs = fold_build1 (IMAGPART_EXPR, type, res);
break;
CASE_FLT_FN (BUILT_IN_CEXPI):
- GIMPLE_STMT_OPERAND (use_stmt, 1) = res;
+ rhs = res;
break;
default:;
gcc_unreachable ();
}
- update_stmt (use_stmt);
+ /* Replace call with a copy. */
+ stmt = gimple_build_assign (gimple_call_lhs (use_stmt), rhs);
+
+ gsi = gsi_for_stmt (use_stmt);
+ gsi_insert_after (&gsi, stmt, GSI_SAME_STMT);
+ gsi_remove (&gsi, true);
}
- VEC_free(tree, heap, stmts);
+ VEC_free(gimple, heap, stmts);
}
/* Go through all calls to sin, cos and cexpi and call execute_cse_sincos_1
@@ -719,16 +721,16 @@ execute_cse_sincos (void)
FOR_EACH_BB (bb)
{
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
- for (bsi = bsi_after_labels (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ for (gsi = gsi_after_labels (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- tree stmt = bsi_stmt (bsi);
+ gimple stmt = gsi_stmt (gsi);
tree fndecl;
- if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
- && TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 1)) == CALL_EXPR
- && (fndecl = get_callee_fndecl (GIMPLE_STMT_OPERAND (stmt, 1)))
+ if (is_gimple_call (stmt)
+ && gimple_call_lhs (stmt)
+ && (fndecl = gimple_call_fndecl (stmt))
&& DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL)
{
tree arg;
@@ -738,8 +740,7 @@ execute_cse_sincos (void)
CASE_FLT_FN (BUILT_IN_COS):
CASE_FLT_FN (BUILT_IN_SIN):
CASE_FLT_FN (BUILT_IN_CEXPI):
- arg = GIMPLE_STMT_OPERAND (stmt, 1);
- arg = CALL_EXPR_ARG (arg, 0);
+ arg = gimple_call_arg (stmt, 0);
if (TREE_CODE (arg) == SSA_NAME)
execute_cse_sincos_1 (arg);
break;
@@ -793,23 +794,23 @@ execute_convert_to_rsqrt (void)
FOR_EACH_BB (bb)
{
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
- for (bsi = bsi_after_labels (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ for (gsi = gsi_after_labels (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- tree stmt = bsi_stmt (bsi);
+ gimple stmt = gsi_stmt (gsi);
tree fndecl;
- if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
- && TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 1)) == CALL_EXPR
- && (fndecl = get_callee_fndecl (GIMPLE_STMT_OPERAND (stmt, 1)))
+ if (is_gimple_call (stmt)
+ && gimple_call_lhs (stmt)
+ && (fndecl = gimple_call_fndecl (stmt))
&& (DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL
|| DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_MD))
{
enum built_in_function code;
bool md_code;
tree arg1;
- tree stmt1;
+ gimple stmt1;
code = DECL_FUNCTION_CODE (fndecl);
md_code = DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_MD;
@@ -818,30 +819,28 @@ execute_convert_to_rsqrt (void)
if (!fndecl)
continue;
- arg1 = CALL_EXPR_ARG (GIMPLE_STMT_OPERAND (stmt, 1), 0);
+ arg1 = gimple_call_arg (stmt, 0);
if (TREE_CODE (arg1) != SSA_NAME)
continue;
stmt1 = SSA_NAME_DEF_STMT (arg1);
- if (TREE_CODE (stmt1) == GIMPLE_MODIFY_STMT
- && TREE_CODE (GIMPLE_STMT_OPERAND (stmt1, 1)) == RDIV_EXPR)
+ if (is_gimple_assign (stmt1)
+ && gimple_assign_rhs_code (stmt1) == RDIV_EXPR)
{
tree arg10, arg11;
- tree tmp;
- arg10 = TREE_OPERAND (GIMPLE_STMT_OPERAND (stmt1, 1), 0);
- arg11 = TREE_OPERAND (GIMPLE_STMT_OPERAND (stmt1, 1), 1);
+ arg10 = gimple_assign_rhs1 (stmt1);
+ arg11 = gimple_assign_rhs2 (stmt1);
/* Swap operands of RDIV_EXPR. */
- TREE_OPERAND (GIMPLE_STMT_OPERAND (stmt1, 1), 0) = arg11;
- TREE_OPERAND (GIMPLE_STMT_OPERAND (stmt1, 1), 1) = arg10;
+ gimple_assign_set_rhs1 (stmt1, arg11);
+ gimple_assign_set_rhs2 (stmt1, arg10);
fold_stmt_inplace (stmt1);
update_stmt (stmt1);
- tmp = build_call_expr (fndecl, 1, arg1);
- GIMPLE_STMT_OPERAND (stmt, 1) = tmp;
+ gimple_call_set_fndecl (stmt, fndecl);
update_stmt (stmt);
}
}
diff --git a/gcc/tree-ssa-operands.c b/gcc/tree-ssa-operands.c
index 0aeea9f7f93..304df53863e 100644
--- a/gcc/tree-ssa-operands.c
+++ b/gcc/tree-ssa-operands.c
@@ -1,5 +1,6 @@
/* SSA operands management for trees.
- Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008
+ Free Software Foundation, Inc.
This file is part of GCC.
@@ -74,6 +75,10 @@ along with GCC; see the file COPYING3. If not see
operand vector for VUSE, then the new vector will also be modified
such that it contains 'a_5' rather than 'a'. */
+/* Helper functions from gimple.c. These are GIMPLE manipulation
+ routines that only the operand scanner should need. */
+void gimple_set_stored_syms (gimple, bitmap, bitmap_obstack *);
+void gimple_set_loaded_syms (gimple, bitmap, bitmap_obstack *);
/* Structure storing statistics on how many call clobbers we have, and
how many where avoided. */
@@ -122,7 +127,7 @@ static struct
#define opf_no_vops (1 << 1)
/* Operand is an implicit reference. This is used to distinguish
- explicit assignments in the form of GIMPLE_MODIFY_STMT from
+ explicit assignments in the form of MODIFY_EXPR from
clobbering sites like function calls or ASM_EXPRs. */
#define opf_implicit (1 << 2)
@@ -148,7 +153,7 @@ static bitmap build_loads;
/* Set for building all the stored symbols. */
static bitmap build_stores;
-static void get_expr_operands (tree, tree *, int);
+static void get_expr_operands (gimple, tree *, int);
/* Number of functions with initialized ssa_operands. */
static int n_initialized = 0;
@@ -178,7 +183,7 @@ static int n_initialized = 0;
struct scb_d
{
/* Pointer to the statement being modified. */
- tree *stmt_p;
+ gimple *stmt_p;
/* If the statement references memory these are the sets of symbols
loaded and stored by the statement. */
@@ -256,12 +261,18 @@ operand_build_sort_virtual (VEC(tree,heap) *list)
operand_build_cmp);
}
-
/* Return true if the SSA operands cache is active. */
bool
ssa_operands_active (void)
{
+ /* This function may be invoked from contexts where CFUN is NULL
+ (IPA passes), return false for now. FIXME: operands may be
+ active in each individual function, maybe this function should
+ take CFUN as a parameter. */
+ if (cfun == NULL)
+ return false;
+
return cfun->gimple_df && gimple_ssa_operands (cfun)->ops_active;
}
@@ -430,6 +441,7 @@ fini_ssa_operands (void)
if (!n_initialized)
bitmap_obstack_release (&operands_bitmap_obstack);
+
if (dump_file && (dump_flags & TDF_STATS))
{
fprintf (dump_file, "Original clobbered vars: %d\n",
@@ -571,11 +583,11 @@ alloc_vop (int num)
sure the stmt pointer is set to the current stmt. */
static inline void
-set_virtual_use_link (use_operand_p ptr, tree stmt)
+set_virtual_use_link (use_operand_p ptr, gimple stmt)
{
/* fold_stmt may have changed the stmt pointers. */
- if (ptr->stmt != stmt)
- ptr->stmt = stmt;
+ if (ptr->loc.stmt != stmt)
+ ptr->loc.stmt = stmt;
/* If this use isn't in a list, add it to the correct list. */
if (!ptr->prev)
@@ -601,7 +613,7 @@ add_def_op (tree *op, def_optype_p last)
/* Adds OP to the list of uses of statement STMT after LAST. */
static inline use_optype_p
-add_use_op (tree stmt, tree *op, use_optype_p last)
+add_use_op (gimple stmt, tree *op, use_optype_p last)
{
use_optype_p new_use;
@@ -619,7 +631,7 @@ add_use_op (tree stmt, tree *op, use_optype_p last)
The new vop is appended after PREV. */
static inline voptype_p
-add_vop (tree stmt, tree op, int num, voptype_p prev)
+add_vop (gimple stmt, tree op, int num, voptype_p prev)
{
voptype_p new_vop;
int x;
@@ -645,7 +657,7 @@ add_vop (tree stmt, tree op, int num, voptype_p prev)
LAST to the new element. */
static inline voptype_p
-add_vuse_op (tree stmt, tree op, int num, voptype_p last)
+add_vuse_op (gimple stmt, tree op, int num, voptype_p last)
{
voptype_p new_vop = add_vop (stmt, op, num, last);
VDEF_RESULT (new_vop) = NULL_TREE;
@@ -657,7 +669,7 @@ add_vuse_op (tree stmt, tree op, int num, voptype_p last)
LAST to the new element. */
static inline voptype_p
-add_vdef_op (tree stmt, tree op, int num, voptype_p last)
+add_vdef_op (gimple stmt, tree op, int num, voptype_p last)
{
voptype_p new_vop = add_vop (stmt, op, num, last);
VDEF_RESULT (new_vop) = op;
@@ -669,7 +681,7 @@ add_vdef_op (tree stmt, tree op, int num, voptype_p last)
TODO -- Make build_defs VEC of tree *. */
static inline void
-finalize_ssa_defs (tree stmt)
+finalize_ssa_defs (gimple stmt)
{
unsigned new_i;
struct def_optype_d new_list;
@@ -677,12 +689,12 @@ finalize_ssa_defs (tree stmt)
unsigned int num = VEC_length (tree, build_defs);
/* There should only be a single real definition per assignment. */
- gcc_assert ((stmt && TREE_CODE (stmt) != GIMPLE_MODIFY_STMT) || num <= 1);
+ gcc_assert ((stmt && gimple_code (stmt) != GIMPLE_ASSIGN) || num <= 1);
new_list.next = NULL;
last = &new_list;
- old_ops = DEF_OPS (stmt);
+ old_ops = gimple_def_ops (stmt);
new_i = 0;
@@ -703,13 +715,13 @@ finalize_ssa_defs (tree stmt)
last = add_def_op ((tree *) VEC_index (tree, build_defs, new_i), last);
/* Now set the stmt's operands. */
- DEF_OPS (stmt) = new_list.next;
+ gimple_set_def_ops (stmt, new_list.next);
#ifdef ENABLE_CHECKING
{
def_optype_p ptr;
unsigned x = 0;
- for (ptr = DEF_OPS (stmt); ptr; ptr = ptr->next)
+ for (ptr = gimple_def_ops (stmt); ptr; ptr = ptr->next)
x++;
gcc_assert (x == num);
@@ -722,30 +734,16 @@ finalize_ssa_defs (tree stmt)
TODO -- Make build_uses VEC of tree *. */
static inline void
-finalize_ssa_uses (tree stmt)
+finalize_ssa_uses (gimple stmt)
{
unsigned new_i;
struct use_optype_d new_list;
use_optype_p old_ops, ptr, last;
-#ifdef ENABLE_CHECKING
- {
- unsigned x;
- unsigned num = VEC_length (tree, build_uses);
-
- /* If the pointer to the operand is the statement itself, something is
- wrong. It means that we are pointing to a local variable (the
- initial call to update_stmt_operands does not pass a pointer to a
- statement). */
- for (x = 0; x < num; x++)
- gcc_assert (*((tree *)VEC_index (tree, build_uses, x)) != stmt);
- }
-#endif
-
new_list.next = NULL;
last = &new_list;
- old_ops = USE_OPS (stmt);
+ old_ops = gimple_use_ops (stmt);
/* If there is anything in the old list, free it. */
if (old_ops)
@@ -763,12 +761,12 @@ finalize_ssa_uses (tree stmt)
last);
/* Now set the stmt's operands. */
- USE_OPS (stmt) = new_list.next;
+ gimple_set_use_ops (stmt, new_list.next);
#ifdef ENABLE_CHECKING
{
unsigned x = 0;
- for (ptr = USE_OPS (stmt); ptr; ptr = ptr->next)
+ for (ptr = gimple_use_ops (stmt); ptr; ptr = ptr->next)
x++;
gcc_assert (x == VEC_length (tree, build_uses));
@@ -778,27 +776,17 @@ finalize_ssa_uses (tree stmt)
/* Takes elements from BUILD_VDEFS and turns them into vdef operands of
- STMT. FIXME, for now VDEF operators should have a single operand
- in their RHS. */
+ STMT. */
static inline void
-finalize_ssa_vdefs (tree stmt)
+finalize_ssa_vdefs (gimple stmt)
{
unsigned new_i;
struct voptype_d new_list;
voptype_p old_ops, ptr, last;
- stmt_ann_t ann = stmt_ann (stmt);
/* Set the symbols referenced by STMT. */
- if (!bitmap_empty_p (build_stores))
- {
- if (ann->operands.stores == NULL)
- ann->operands.stores = BITMAP_ALLOC (&operands_bitmap_obstack);
-
- bitmap_copy (ann->operands.stores, build_stores);
- }
- else
- BITMAP_FREE (ann->operands.stores);
+ gimple_set_stored_syms (stmt, build_stores, &operands_bitmap_obstack);
/* If aliases have not been computed, do not instantiate a virtual
operator on STMT. Initially, we only compute the SSA form on
@@ -813,7 +801,7 @@ finalize_ssa_vdefs (tree stmt)
new_list.next = NULL;
last = &new_list;
- old_ops = VDEF_OPS (stmt);
+ old_ops = gimple_vdef_ops (stmt);
new_i = 0;
while (old_ops && new_i < VEC_length (tree, build_vdefs))
{
@@ -868,12 +856,12 @@ finalize_ssa_vdefs (tree stmt)
}
/* Now set STMT's operands. */
- VDEF_OPS (stmt) = new_list.next;
+ gimple_set_vdef_ops (stmt, new_list.next);
#ifdef ENABLE_CHECKING
{
unsigned x = 0;
- for (ptr = VDEF_OPS (stmt); ptr; ptr = ptr->next)
+ for (ptr = gimple_vdef_ops (stmt); ptr; ptr = ptr->next)
x++;
gcc_assert (x == VEC_length (tree, build_vdefs));
@@ -886,24 +874,14 @@ finalize_ssa_vdefs (tree stmt)
STMT. */
static inline void
-finalize_ssa_vuse_ops (tree stmt)
+finalize_ssa_vuse_ops (gimple stmt)
{
unsigned new_i, old_i;
voptype_p old_ops, last;
VEC(tree,heap) *new_ops;
- stmt_ann_t ann;
/* Set the symbols referenced by STMT. */
- ann = stmt_ann (stmt);
- if (!bitmap_empty_p (build_loads))
- {
- if (ann->operands.loads == NULL)
- ann->operands.loads = BITMAP_ALLOC (&operands_bitmap_obstack);
-
- bitmap_copy (ann->operands.loads, build_loads);
- }
- else
- BITMAP_FREE (ann->operands.loads);
+ gimple_set_loaded_syms (stmt, build_loads, &operands_bitmap_obstack);
/* If aliases have not been computed, do not instantiate a virtual
operator on STMT. Initially, we only compute the SSA form on
@@ -916,7 +894,7 @@ finalize_ssa_vuse_ops (tree stmt)
return;
/* STMT should have at most one VUSE operator. */
- old_ops = VUSE_OPS (stmt);
+ old_ops = gimple_vuse_ops (stmt);
gcc_assert (old_ops == NULL || old_ops->next == NULL);
new_ops = NULL;
@@ -961,7 +939,7 @@ finalize_ssa_vuse_ops (tree stmt)
for (old_i = 0; old_i < VUSE_NUM (old_ops); old_i++)
delink_imm_use (VUSE_OP_PTR (old_ops, old_i));
add_vop_to_freelist (old_ops);
- VUSE_OPS (stmt) = NULL;
+ gimple_set_vuse_ops (stmt, NULL);
}
/* If there are any operands, instantiate a VUSE operator for STMT. */
@@ -975,7 +953,7 @@ finalize_ssa_vuse_ops (tree stmt)
for (i = 0; VEC_iterate (tree, new_ops, i, op); i++)
SET_USE (VUSE_OP_PTR (last, (int) i), op);
- VUSE_OPS (stmt) = last;
+ gimple_set_vuse_ops (stmt, last);
VEC_free (tree, heap, new_ops);
}
@@ -983,10 +961,10 @@ finalize_ssa_vuse_ops (tree stmt)
{
unsigned x;
- if (VUSE_OPS (stmt))
+ if (gimple_vuse_ops (stmt))
{
- gcc_assert (VUSE_OPS (stmt)->next == NULL);
- x = VUSE_NUM (VUSE_OPS (stmt));
+ gcc_assert (gimple_vuse_ops (stmt)->next == NULL);
+ x = VUSE_NUM (gimple_vuse_ops (stmt));
}
else
x = 0;
@@ -999,7 +977,7 @@ finalize_ssa_vuse_ops (tree stmt)
/* Return a new VUSE operand vector for STMT. */
static void
-finalize_ssa_vuses (tree stmt)
+finalize_ssa_vuses (gimple stmt)
{
unsigned num, num_vdefs;
unsigned vuse_index;
@@ -1069,12 +1047,15 @@ cleanup_build_arrays (void)
/* Finalize all the build vectors, fill the new ones into INFO. */
static inline void
-finalize_ssa_stmt_operands (tree stmt)
+finalize_ssa_stmt_operands (gimple stmt)
{
finalize_ssa_defs (stmt);
finalize_ssa_uses (stmt);
- finalize_ssa_vdefs (stmt);
- finalize_ssa_vuses (stmt);
+ if (gimple_has_mem_ops (stmt))
+ {
+ finalize_ssa_vdefs (stmt);
+ finalize_ssa_vuses (stmt);
+ }
cleanup_build_arrays ();
}
@@ -1323,7 +1304,7 @@ access_can_touch_variable (tree ref, tree alias, HOST_WIDE_INT offset,
return true;
}
-/* Add VAR to the virtual operands array. FLAGS is as in
+/* Add VAR to the virtual operands for STMT. FLAGS is as in
get_expr_operands. FULL_REF is a tree that contains the entire
pointer dereference expression, if available, or NULL otherwise.
OFFSET and SIZE come from the memory access expression that
@@ -1331,7 +1312,7 @@ access_can_touch_variable (tree ref, tree alias, HOST_WIDE_INT offset,
affected statement is a call site. */
static void
-add_virtual_operand (tree var, stmt_ann_t s_ann, int flags,
+add_virtual_operand (tree var, gimple stmt, int flags,
tree full_ref, HOST_WIDE_INT offset,
HOST_WIDE_INT size, bool is_call_site)
{
@@ -1343,7 +1324,7 @@ add_virtual_operand (tree var, stmt_ann_t s_ann, int flags,
v_ann = var_ann (sym);
/* Mark the statement as having memory operands. */
- s_ann->references_memory = true;
+ gimple_set_references_memory (stmt, true);
/* If the variable cannot be modified and this is a VDEF change
it into a VUSE. This happens when read-only variables are marked
@@ -1351,7 +1332,7 @@ add_virtual_operand (tree var, stmt_ann_t s_ann, int flags,
check that this only happens on non-specific stores.
Note that if this is a specific store, i.e. associated with a
- GIMPLE_MODIFY_STMT, then we can't suppress the VDEF, lest we run
+ MODIFY_EXPR, then we can't suppress the VDEF, lest we run
into validation problems.
This can happen when programs cast away const, leaving us with a
@@ -1373,9 +1354,8 @@ add_virtual_operand (tree var, stmt_ann_t s_ann, int flags,
if (aliases == NULL)
{
- if (!gimple_aliases_computed_p (cfun)
- && (flags & opf_def))
- s_ann->has_volatile_ops = true;
+ if (!gimple_aliases_computed_p (cfun) && (flags & opf_def))
+ gimple_set_has_volatile_ops (stmt, true);
/* The variable is not aliased or it is an alias tag. */
if (flags & opf_def)
@@ -1449,18 +1429,18 @@ add_virtual_operand (tree var, stmt_ann_t s_ann, int flags,
}
-/* Add *VAR_P to the appropriate operand array for S_ANN. FLAGS is as in
- get_expr_operands. If *VAR_P is a GIMPLE register, it will be added to
- the statement's real operands, otherwise it is added to virtual
- operands. */
+/* Add *VAR_P to the appropriate operand array for statement STMT.
+ FLAGS is as in get_expr_operands. If *VAR_P is a GIMPLE register,
+ it will be added to the statement's real operands, otherwise it is
+ added to virtual operands. */
static void
-add_stmt_operand (tree *var_p, stmt_ann_t s_ann, int flags)
+add_stmt_operand (tree *var_p, gimple stmt, int flags)
{
tree var, sym;
var_ann_t v_ann;
- gcc_assert (SSA_VAR_P (*var_p) && s_ann);
+ gcc_assert (SSA_VAR_P (*var_p));
var = *var_p;
sym = (TREE_CODE (var) == SSA_NAME ? SSA_NAME_VAR (var) : var);
@@ -1468,7 +1448,7 @@ add_stmt_operand (tree *var_p, stmt_ann_t s_ann, int flags)
/* Mark statements with volatile operands. */
if (TREE_THIS_VOLATILE (sym))
- s_ann->has_volatile_ops = true;
+ gimple_set_has_volatile_ops (stmt, true);
if (is_gimple_reg (sym))
{
@@ -1479,7 +1459,7 @@ add_stmt_operand (tree *var_p, stmt_ann_t s_ann, int flags)
append_use (var_p);
}
else
- add_virtual_operand (var, s_ann, flags, NULL_TREE, 0, -1, false);
+ add_virtual_operand (var, stmt, flags, NULL_TREE, 0, -1, false);
}
/* Subroutine of get_indirect_ref_operands. ADDR is the address
@@ -1487,14 +1467,14 @@ add_stmt_operand (tree *var_p, stmt_ann_t s_ann, int flags)
is the same as in get_indirect_ref_operands. */
static void
-get_addr_dereference_operands (tree stmt, tree *addr, int flags, tree full_ref,
- HOST_WIDE_INT offset, HOST_WIDE_INT size,
- bool recurse_on_base)
+get_addr_dereference_operands (gimple stmt, tree *addr, int flags,
+ tree full_ref, HOST_WIDE_INT offset,
+ HOST_WIDE_INT size, bool recurse_on_base)
{
tree ptr = *addr;
- stmt_ann_t s_ann = stmt_ann (stmt);
- s_ann->references_memory = true;
+ /* Mark the statement as having memory operands. */
+ gimple_set_references_memory (stmt, true);
if (SSA_VAR_P (ptr))
{
@@ -1506,7 +1486,7 @@ get_addr_dereference_operands (tree stmt, tree *addr, int flags, tree full_ref,
&& pi->name_mem_tag)
{
/* PTR has its own memory tag. Use it. */
- add_virtual_operand (pi->name_mem_tag, s_ann, flags,
+ add_virtual_operand (pi->name_mem_tag, stmt, flags,
full_ref, offset, size, false);
}
else
@@ -1530,7 +1510,7 @@ get_addr_dereference_operands (tree stmt, tree *addr, int flags, tree full_ref,
"NOTE: no flow-sensitive alias info for ");
print_generic_expr (dump_file, ptr, dump_flags);
fprintf (dump_file, " in ");
- print_generic_stmt (dump_file, stmt, 0);
+ print_gimple_stmt (dump_file, stmt, 0, 0);
}
if (TREE_CODE (ptr) == SSA_NAME)
@@ -1542,7 +1522,7 @@ get_addr_dereference_operands (tree stmt, tree *addr, int flags, tree full_ref,
and size. */
if (v_ann->symbol_mem_tag)
{
- add_virtual_operand (v_ann->symbol_mem_tag, s_ann, flags,
+ add_virtual_operand (v_ann->symbol_mem_tag, stmt, flags,
full_ref, 0, -1, false);
/* Make sure we add the SMT itself. */
if (!(flags & opf_no_vops))
@@ -1558,7 +1538,7 @@ get_addr_dereference_operands (tree stmt, tree *addr, int flags, tree full_ref,
volatile so we won't optimize it out too actively. */
else if (!gimple_aliases_computed_p (cfun)
&& (flags & opf_def))
- s_ann->has_volatile_ops = true;
+ gimple_set_has_volatile_ops (stmt, true);
}
}
else if (TREE_CODE (ptr) == INTEGER_CST)
@@ -1566,7 +1546,7 @@ get_addr_dereference_operands (tree stmt, tree *addr, int flags, tree full_ref,
/* If a constant is used as a pointer, we can't generate a real
operand for it but we mark the statement volatile to prevent
optimizations from messing things up. */
- s_ann->has_volatile_ops = true;
+ gimple_set_has_volatile_ops (stmt, true);
return;
}
else
@@ -1600,15 +1580,14 @@ get_addr_dereference_operands (tree stmt, tree *addr, int flags, tree full_ref,
something else will do it for us. */
static void
-get_indirect_ref_operands (tree stmt, tree expr, int flags, tree full_ref,
+get_indirect_ref_operands (gimple stmt, tree expr, int flags, tree full_ref,
HOST_WIDE_INT offset, HOST_WIDE_INT size,
bool recurse_on_base)
{
tree *pptr = &TREE_OPERAND (expr, 0);
- stmt_ann_t s_ann = stmt_ann (stmt);
if (TREE_THIS_VOLATILE (expr))
- s_ann->has_volatile_ops = true;
+ gimple_set_has_volatile_ops (stmt, true);
get_addr_dereference_operands (stmt, pptr, flags, full_ref, offset, size,
recurse_on_base);
@@ -1618,26 +1597,25 @@ get_indirect_ref_operands (tree stmt, tree expr, int flags, tree full_ref,
/* A subroutine of get_expr_operands to handle TARGET_MEM_REF. */
static void
-get_tmr_operands (tree stmt, tree expr, int flags)
+get_tmr_operands (gimple stmt, tree expr, int flags)
{
tree tag;
- stmt_ann_t s_ann = stmt_ann (stmt);
- /* This statement references memory. */
- s_ann->references_memory = 1;
+ /* Mark the statement as having memory operands. */
+ gimple_set_references_memory (stmt, true);
/* First record the real operands. */
get_expr_operands (stmt, &TMR_BASE (expr), opf_use);
get_expr_operands (stmt, &TMR_INDEX (expr), opf_use);
if (TMR_SYMBOL (expr))
- add_to_addressable_set (TMR_SYMBOL (expr), &s_ann->addresses_taken);
+ gimple_add_to_addresses_taken (stmt, TMR_SYMBOL (expr));
tag = TMR_TAG (expr);
if (!tag)
{
/* Something weird, so ensure that we will be careful. */
- s_ann->has_volatile_ops = true;
+ gimple_set_has_volatile_ops (stmt, true);
return;
}
if (!MTAG_P (tag))
@@ -1646,7 +1624,7 @@ get_tmr_operands (tree stmt, tree expr, int flags)
return;
}
- add_virtual_operand (tag, s_ann, flags, expr, 0, -1, false);
+ add_virtual_operand (tag, stmt, flags, expr, 0, -1, false);
}
@@ -1654,21 +1632,19 @@ get_tmr_operands (tree stmt, tree expr, int flags)
clobbered variables in the function. */
static void
-add_call_clobber_ops (tree stmt, tree callee)
+add_call_clobber_ops (gimple stmt, tree callee ATTRIBUTE_UNUSED)
{
unsigned u;
bitmap_iterator bi;
- stmt_ann_t s_ann = stmt_ann (stmt);
bitmap not_read_b, not_written_b;
- tree call = get_call_expr_in (stmt);
- gcc_assert (!(call_expr_flags (call) & (ECF_PURE | ECF_CONST)));
+ gcc_assert (!(gimple_call_flags (stmt) & (ECF_PURE | ECF_CONST)));
/* If we created .GLOBAL_VAR earlier, just use it. */
if (gimple_global_var (cfun))
{
tree var = gimple_global_var (cfun);
- add_virtual_operand (var, s_ann, opf_def, NULL, 0, -1, true);
+ add_virtual_operand (var, stmt, opf_def, NULL, 0, -1, true);
return;
}
@@ -1676,7 +1652,8 @@ add_call_clobber_ops (tree stmt, tree callee)
set for each static if the call being processed does not read
or write that variable. */
not_read_b = callee ? ipa_reference_get_not_read_global (callee) : NULL;
- not_written_b = callee ? ipa_reference_get_not_written_global (callee) : NULL;
+ not_written_b = callee ? ipa_reference_get_not_written_global (callee) : NULL;
+
/* Add a VDEF operand for every call clobbered variable. */
EXECUTE_IF_SET_IN_BITMAP (gimple_call_clobbered_vars (cfun), 0, u, bi)
{
@@ -1702,12 +1679,12 @@ add_call_clobber_ops (tree stmt, tree callee)
{
clobber_stats.static_write_clobbers_avoided++;
if (!not_read)
- add_virtual_operand (var, s_ann, opf_use, NULL, 0, -1, true);
+ add_virtual_operand (var, stmt, opf_use, NULL, 0, -1, true);
else
clobber_stats.static_read_clobbers_avoided++;
}
else
- add_virtual_operand (var, s_ann, opf_def, NULL, 0, -1, true);
+ add_virtual_operand (var, stmt, opf_def, NULL, 0, -1, true);
}
}
@@ -1716,22 +1693,20 @@ add_call_clobber_ops (tree stmt, tree callee)
function. */
static void
-add_call_read_ops (tree stmt, tree callee)
+add_call_read_ops (gimple stmt, tree callee ATTRIBUTE_UNUSED)
{
unsigned u;
bitmap_iterator bi;
- stmt_ann_t s_ann = stmt_ann (stmt);
bitmap not_read_b;
- tree call = get_call_expr_in (stmt);
/* Const functions do not reference memory. */
- if (call_expr_flags (call) & ECF_CONST)
+ if (gimple_call_flags (stmt) & ECF_CONST)
return;
not_read_b = callee ? ipa_reference_get_not_read_global (callee) : NULL;
/* For pure functions we compute non-escaped uses separately. */
- if (call_expr_flags (call) & ECF_PURE)
+ if (gimple_call_flags (stmt) & ECF_PURE)
EXECUTE_IF_SET_IN_BITMAP (gimple_call_used_vars (cfun), 0, u, bi)
{
tree var = referenced_var_lookup (u);
@@ -1749,7 +1724,7 @@ add_call_read_ops (tree stmt, tree callee)
/* See if this variable is really used by this function. */
if (!not_read)
- add_virtual_operand (var, s_ann, opf_use, NULL, 0, -1, true);
+ add_virtual_operand (var, stmt, opf_use, NULL, 0, -1, true);
else
clobber_stats.static_readonly_clobbers_avoided++;
}
@@ -1760,7 +1735,7 @@ add_call_read_ops (tree stmt, tree callee)
if (gimple_global_var (cfun))
{
tree var = gimple_global_var (cfun);
- add_virtual_operand (var, s_ann, opf_use, NULL, 0, -1, true);
+ add_virtual_operand (var, stmt, opf_use, NULL, 0, -1, true);
return;
}
@@ -1782,67 +1757,55 @@ add_call_read_ops (tree stmt, tree callee)
continue;
}
- add_virtual_operand (var, s_ann, opf_use, NULL, 0, -1, true);
+ add_virtual_operand (var, stmt, opf_use, NULL, 0, -1, true);
}
}
-/* A subroutine of get_expr_operands to handle CALL_EXPR. */
+/* If STMT is a call that may clobber globals and other symbols that
+ escape, add them to the VDEF/VUSE lists for it. */
static void
-get_call_expr_operands (tree stmt, tree expr)
+maybe_add_call_clobbered_vops (gimple stmt)
{
- int call_flags = call_expr_flags (expr);
- int i, nargs;
- stmt_ann_t ann = stmt_ann (stmt);
+ int call_flags = gimple_call_flags (stmt);
- ann->references_memory = true;
+ /* Mark the statement as having memory operands. */
+ gimple_set_references_memory (stmt, true);
/* If aliases have been computed already, add VDEF or VUSE
operands for all the symbols that have been found to be
call-clobbered. */
- if (gimple_aliases_computed_p (cfun)
- && !(call_flags & ECF_NOVOPS))
+ if (gimple_aliases_computed_p (cfun) && !(call_flags & ECF_NOVOPS))
{
/* A 'pure' or a 'const' function never call-clobbers anything.
A 'noreturn' function might, but since we don't return anyway
there is no point in recording that. */
- if (TREE_SIDE_EFFECTS (expr)
- && !(call_flags & (ECF_PURE | ECF_CONST | ECF_NORETURN)))
- add_call_clobber_ops (stmt, get_callee_fndecl (expr));
+ if (!(call_flags & (ECF_PURE | ECF_CONST | ECF_NORETURN)))
+ add_call_clobber_ops (stmt, gimple_call_fndecl (stmt));
else if (!(call_flags & ECF_CONST))
- add_call_read_ops (stmt, get_callee_fndecl (expr));
+ add_call_read_ops (stmt, gimple_call_fndecl (stmt));
}
-
- /* Find uses in the called function. */
- get_expr_operands (stmt, &CALL_EXPR_FN (expr), opf_use);
- nargs = call_expr_nargs (expr);
- for (i = 0; i < nargs; i++)
- get_expr_operands (stmt, &CALL_EXPR_ARG (expr, i), opf_use);
-
- get_expr_operands (stmt, &CALL_EXPR_STATIC_CHAIN (expr), opf_use);
}
/* Scan operands in the ASM_EXPR stmt referred to in INFO. */
static void
-get_asm_expr_operands (tree stmt)
+get_asm_expr_operands (gimple stmt)
{
- stmt_ann_t s_ann;
- int i, noutputs;
+ size_t i, noutputs;
const char **oconstraints;
const char *constraint;
bool allows_mem, allows_reg, is_inout;
- tree link;
- s_ann = stmt_ann (stmt);
- noutputs = list_length (ASM_OUTPUTS (stmt));
+ noutputs = gimple_asm_noutputs (stmt);
oconstraints = (const char **) alloca ((noutputs) * sizeof (const char *));
/* Gather all output operands. */
- for (i = 0, link = ASM_OUTPUTS (stmt); link; i++, link = TREE_CHAIN (link))
+ for (i = 0; i < gimple_asm_noutputs (stmt); i++)
{
+ tree link = gimple_asm_output_op (stmt, i);
constraint = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (link)));
oconstraints[i] = constraint;
parse_output_constraint (&constraint, i, 0, 0, &allows_mem,
@@ -1856,16 +1819,17 @@ get_asm_expr_operands (tree stmt)
if (!allows_reg && allows_mem)
{
tree t = get_base_address (TREE_VALUE (link));
- if (t && DECL_P (t) && s_ann)
- add_to_addressable_set (t, &s_ann->addresses_taken);
+ if (t && DECL_P (t))
+ gimple_add_to_addresses_taken (stmt, t);
}
get_expr_operands (stmt, &TREE_VALUE (link), opf_def);
}
/* Gather all input operands. */
- for (link = ASM_INPUTS (stmt); link; link = TREE_CHAIN (link))
+ for (i = 0; i < gimple_asm_ninputs (stmt); i++)
{
+ tree link = gimple_asm_input_op (stmt, i);
constraint = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (link)));
parse_input_constraint (&constraint, 0, 0, noutputs, 0, oconstraints,
&allows_mem, &allows_reg);
@@ -1875,57 +1839,39 @@ get_asm_expr_operands (tree stmt)
if (!allows_reg && allows_mem)
{
tree t = get_base_address (TREE_VALUE (link));
- if (t && DECL_P (t) && s_ann)
- add_to_addressable_set (t, &s_ann->addresses_taken);
+ if (t && DECL_P (t))
+ gimple_add_to_addresses_taken (stmt, t);
}
get_expr_operands (stmt, &TREE_VALUE (link), 0);
}
/* Clobber all memory and addressable symbols for asm ("" : : : "memory"); */
- for (link = ASM_CLOBBERS (stmt); link; link = TREE_CHAIN (link))
- if (strcmp (TREE_STRING_POINTER (TREE_VALUE (link)), "memory") == 0)
- {
- unsigned i;
- bitmap_iterator bi;
-
- s_ann->references_memory = true;
-
- EXECUTE_IF_SET_IN_BITMAP (gimple_call_clobbered_vars (cfun), 0, i, bi)
- {
- tree var = referenced_var (i);
- add_stmt_operand (&var, s_ann, opf_def | opf_implicit);
- }
-
- EXECUTE_IF_SET_IN_BITMAP (gimple_addressable_vars (cfun), 0, i, bi)
- {
- tree var = referenced_var (i);
- add_stmt_operand (&var, s_ann, opf_def | opf_implicit);
- }
- break;
- }
-}
-
-
-/* Scan operands for the assignment expression EXPR in statement STMT. */
-
-static void
-get_modify_stmt_operands (tree stmt, tree expr)
-{
- /* First get operands from the RHS. */
- get_expr_operands (stmt, &GIMPLE_STMT_OPERAND (expr, 1), opf_use);
+ for (i = 0; i < gimple_asm_nclobbers (stmt); i++)
+ {
+ tree link = gimple_asm_clobber_op (stmt, i);
+ if (strcmp (TREE_STRING_POINTER (TREE_VALUE (link)), "memory") == 0)
+ {
+ unsigned i;
+ bitmap_iterator bi;
- /* For the LHS, use a regular definition (opf_def) for GIMPLE
- registers. If the LHS is a store to memory, we will need
- a preserving definition (VDEF).
+ /* Mark the statement as having memory operands. */
+ gimple_set_references_memory (stmt, true);
- Preserving definitions are those that modify a part of an
- aggregate object. Stores through a pointer are also represented
- with VDEF operators.
+ EXECUTE_IF_SET_IN_BITMAP (gimple_call_clobbered_vars (cfun), 0, i, bi)
+ {
+ tree var = referenced_var (i);
+ add_stmt_operand (&var, stmt, opf_def | opf_implicit);
+ }
- We used to distinguish between preserving and killing definitions.
- We always emit preserving definitions now. */
- get_expr_operands (stmt, &GIMPLE_STMT_OPERAND (expr, 0), opf_def);
+ EXECUTE_IF_SET_IN_BITMAP (gimple_addressable_vars (cfun), 0, i, bi)
+ {
+ tree var = referenced_var (i);
+ add_stmt_operand (&var, stmt, opf_def | opf_implicit);
+ }
+ break;
+ }
+ }
}
@@ -1934,12 +1880,11 @@ get_modify_stmt_operands (tree stmt, tree expr)
interpret the operands found. */
static void
-get_expr_operands (tree stmt, tree *expr_p, int flags)
+get_expr_operands (gimple stmt, tree *expr_p, int flags)
{
enum tree_code code;
enum tree_code_class codeclass;
tree expr = *expr_p;
- stmt_ann_t s_ann = stmt_ann (stmt);
if (expr == NULL)
return;
@@ -1954,7 +1899,7 @@ get_expr_operands (tree stmt, tree *expr_p, int flags)
reference to it, but the fact that the statement takes its
address will be of interest to some passes (e.g. alias
resolution). */
- add_to_addressable_set (TREE_OPERAND (expr, 0), &s_ann->addresses_taken);
+ gimple_add_to_addresses_taken (stmt, TREE_OPERAND (expr, 0));
/* If the address is invariant, there may be no interesting
variable references inside. */
@@ -1973,13 +1918,13 @@ get_expr_operands (tree stmt, tree *expr_p, int flags)
case SSA_NAME:
case SYMBOL_MEMORY_TAG:
case NAME_MEMORY_TAG:
- add_stmt_operand (expr_p, s_ann, flags);
+ add_stmt_operand (expr_p, stmt, flags);
return;
case VAR_DECL:
case PARM_DECL:
case RESULT_DECL:
- add_stmt_operand (expr_p, s_ann, flags);
+ add_stmt_operand (expr_p, stmt, flags);
return;
case MISALIGNED_INDIRECT_REF:
@@ -2005,7 +1950,7 @@ get_expr_operands (tree stmt, tree *expr_p, int flags)
HOST_WIDE_INT offset, size, maxsize;
if (TREE_THIS_VOLATILE (expr))
- s_ann->has_volatile_ops = true;
+ gimple_set_has_volatile_ops (stmt, true);
ref = get_ref_base_and_extent (expr, &offset, &size, &maxsize);
if (TREE_CODE (ref) == INDIRECT_REF)
@@ -2020,7 +1965,7 @@ get_expr_operands (tree stmt, tree *expr_p, int flags)
if (code == COMPONENT_REF)
{
if (TREE_THIS_VOLATILE (TREE_OPERAND (expr, 1)))
- s_ann->has_volatile_ops = true;
+ gimple_set_has_volatile_ops (stmt, true);
get_expr_operands (stmt, &TREE_OPERAND (expr, 2), opf_use);
}
else if (code == ARRAY_REF || code == ARRAY_RANGE_REF)
@@ -2040,10 +1985,6 @@ get_expr_operands (tree stmt, tree *expr_p, int flags)
get_expr_operands (stmt, &TREE_OPERAND (expr, 0), flags);
return;
- case CALL_EXPR:
- get_call_expr_operands (stmt, expr);
- return;
-
case COND_EXPR:
case VEC_COND_EXPR:
get_expr_operands (stmt, &TREE_OPERAND (expr, 0), opf_use);
@@ -2051,10 +1992,6 @@ get_expr_operands (tree stmt, tree *expr_p, int flags)
get_expr_operands (stmt, &TREE_OPERAND (expr, 2), opf_use);
return;
- case GIMPLE_MODIFY_STMT:
- get_modify_stmt_operands (stmt, expr);
- return;
-
case CONSTRUCTOR:
{
/* General aggregate CONSTRUCTORs have been decomposed, but they
@@ -2100,101 +2037,14 @@ get_expr_operands (tree stmt, tree *expr_p, int flags)
}
case CHANGE_DYNAMIC_TYPE_EXPR:
- get_expr_operands (stmt, &CHANGE_DYNAMIC_TYPE_LOCATION (expr), opf_use);
- return;
-
- case OMP_FOR:
- {
- tree c, clauses = OMP_FOR_CLAUSES (stmt);
- int i;
-
- for (i = 0; i < TREE_VEC_LENGTH (OMP_FOR_INIT (expr)); i++)
- {
- tree init = TREE_VEC_ELT (OMP_FOR_INIT (expr), i);
- tree cond = TREE_VEC_ELT (OMP_FOR_COND (expr), i);
- tree incr = TREE_VEC_ELT (OMP_FOR_INCR (expr), i);
-
- get_expr_operands (stmt, &GIMPLE_STMT_OPERAND (init, 0), opf_def);
- get_expr_operands (stmt, &GIMPLE_STMT_OPERAND (init, 1), opf_use);
- get_expr_operands (stmt, &TREE_OPERAND (cond, 1), opf_use);
- get_expr_operands (stmt,
- &TREE_OPERAND (GIMPLE_STMT_OPERAND (incr, 1),
- 1), opf_use);
- }
-
- c = find_omp_clause (clauses, OMP_CLAUSE_SCHEDULE);
- if (c)
- get_expr_operands (stmt, &OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (c),
- opf_use);
- return;
- }
-
- case OMP_CONTINUE:
- {
- get_expr_operands (stmt, &TREE_OPERAND (expr, 0), opf_def);
- get_expr_operands (stmt, &TREE_OPERAND (expr, 1), opf_use);
- return;
- }
-
- case OMP_PARALLEL:
- {
- tree c, clauses = OMP_PARALLEL_CLAUSES (stmt);
-
- if (OMP_PARALLEL_DATA_ARG (stmt))
- {
- get_expr_operands (stmt, &OMP_PARALLEL_DATA_ARG (stmt), opf_use);
- add_to_addressable_set (OMP_PARALLEL_DATA_ARG (stmt),
- &s_ann->addresses_taken);
- }
-
- c = find_omp_clause (clauses, OMP_CLAUSE_IF);
- if (c)
- get_expr_operands (stmt, &OMP_CLAUSE_IF_EXPR (c), opf_use);
- c = find_omp_clause (clauses, OMP_CLAUSE_NUM_THREADS);
- if (c)
- get_expr_operands (stmt, &OMP_CLAUSE_NUM_THREADS_EXPR (c), opf_use);
- return;
- }
-
- case OMP_SECTIONS:
- {
- get_expr_operands (stmt, &OMP_SECTIONS_CONTROL (expr), opf_def);
- return;
- }
-
- case OMP_ATOMIC_LOAD:
- {
- tree *addr = &TREE_OPERAND (expr, 1);
- get_expr_operands (stmt, &TREE_OPERAND (expr, 0), opf_def);
-
- if (TREE_CODE (*addr) == ADDR_EXPR)
- get_expr_operands (stmt, &TREE_OPERAND (*addr, 0), opf_def);
- else
- get_addr_dereference_operands (stmt, addr, opf_def,
- NULL_TREE, 0, -1, true);
- return;
- }
-
- case OMP_ATOMIC_STORE:
- {
- get_expr_operands (stmt, &TREE_OPERAND (expr, 0), opf_use);
- return;
- }
+ gcc_unreachable ();
- case BLOCK:
case FUNCTION_DECL:
- case EXC_PTR_EXPR:
- case FILTER_EXPR:
case LABEL_DECL:
case CONST_DECL:
- case OMP_SINGLE:
- case OMP_MASTER:
- case OMP_ORDERED:
- case OMP_CRITICAL:
- case OMP_RETURN:
- case OMP_SECTION:
- case OMP_SECTIONS_SWITCH:
- case PREDICT_EXPR:
+ case CASE_LABEL_EXPR:
+ case FILTER_EXPR:
+ case EXC_PTR_EXPR:
/* Expressions that make no memory references. */
return;
@@ -2221,59 +2071,28 @@ get_expr_operands (tree stmt, tree *expr_p, int flags)
build_* operand vectors will have potential operands in them. */
static void
-parse_ssa_operands (tree stmt)
+parse_ssa_operands (gimple stmt)
{
- enum tree_code code;
+ enum gimple_code code = gimple_code (stmt);
- code = TREE_CODE (stmt);
- switch (code)
+ if (code == GIMPLE_ASM)
+ get_asm_expr_operands (stmt);
+ else
{
- case GIMPLE_MODIFY_STMT:
- get_modify_stmt_operands (stmt, stmt);
- break;
-
- case COND_EXPR:
- get_expr_operands (stmt, &COND_EXPR_COND (stmt), opf_use);
- break;
-
- case SWITCH_EXPR:
- get_expr_operands (stmt, &SWITCH_COND (stmt), opf_use);
- break;
-
- case ASM_EXPR:
- get_asm_expr_operands (stmt);
- break;
-
- case RETURN_EXPR:
- get_expr_operands (stmt, &TREE_OPERAND (stmt, 0), opf_use);
- break;
-
- case GOTO_EXPR:
- get_expr_operands (stmt, &GOTO_DESTINATION (stmt), opf_use);
- break;
+ size_t i, start = 0;
- case LABEL_EXPR:
- get_expr_operands (stmt, &LABEL_EXPR_LABEL (stmt), opf_use);
- break;
+ if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
+ {
+ get_expr_operands (stmt, gimple_op_ptr (stmt, 0), opf_def);
+ start = 1;
+ }
- case BIND_EXPR:
- case CASE_LABEL_EXPR:
- case TRY_CATCH_EXPR:
- case TRY_FINALLY_EXPR:
- case EH_FILTER_EXPR:
- case CATCH_EXPR:
- case RESX_EXPR:
- /* These nodes contain no variable references. */
- break;
+ for (i = start; i < gimple_num_ops (stmt); i++)
+ get_expr_operands (stmt, gimple_op_ptr (stmt, i), opf_use);
- default:
- /* Notice that if get_expr_operands tries to use &STMT as the
- operand pointer (which may only happen for USE operands), we
- will fail in add_stmt_operand. This default will handle
- statements like empty statements, or CALL_EXPRs that may
- appear on the RHS of a statement or as statements themselves. */
- get_expr_operands (stmt, &stmt, opf_use);
- break;
+ /* Add call-clobbered operands, if needed. */
+ if (code == GIMPLE_CALL)
+ maybe_add_call_clobbered_vops (stmt);
}
}
@@ -2281,17 +2100,16 @@ parse_ssa_operands (tree stmt)
/* Create an operands cache for STMT. */
static void
-build_ssa_operands (tree stmt)
+build_ssa_operands (gimple stmt)
{
- stmt_ann_t ann = get_stmt_ann (stmt);
-
/* Initially assume that the statement has no volatile operands and
makes no memory references. */
- ann->has_volatile_ops = false;
- ann->references_memory = false;
+ gimple_set_has_volatile_ops (stmt, false);
+ gimple_set_references_memory (stmt, false);
+
/* Just clear the bitmap so we don't end up reallocating it over and over. */
- if (ann->addresses_taken)
- bitmap_clear (ann->addresses_taken);
+ if (gimple_addresses_taken (stmt))
+ bitmap_clear (gimple_addresses_taken (stmt));
start_ssa_stmt_operands ();
parse_ssa_operands (stmt);
@@ -2299,13 +2117,10 @@ build_ssa_operands (tree stmt)
operand_build_sort_virtual (build_vdefs);
finalize_ssa_stmt_operands (stmt);
- if (ann->addresses_taken && bitmap_empty_p (ann->addresses_taken))
- ann->addresses_taken = NULL;
-
/* For added safety, assume that statements with volatile operands
also reference memory. */
- if (ann->has_volatile_ops)
- ann->references_memory = true;
+ if (gimple_has_volatile_ops (stmt))
+ gimple_set_references_memory (stmt, true);
}
@@ -2313,12 +2128,12 @@ build_ssa_operands (tree stmt)
the stmt operand lists. */
void
-free_stmt_operands (tree stmt)
+free_stmt_operands (gimple stmt)
{
- def_optype_p defs = DEF_OPS (stmt), last_def;
- use_optype_p uses = USE_OPS (stmt), last_use;
- voptype_p vuses = VUSE_OPS (stmt);
- voptype_p vdefs = VDEF_OPS (stmt), vdef, next_vdef;
+ def_optype_p defs = gimple_def_ops (stmt), last_def;
+ use_optype_p uses = gimple_use_ops (stmt), last_use;
+ voptype_p vuses = gimple_vuse_ops (stmt);
+ voptype_p vdefs = gimple_vdef_ops (stmt), vdef, next_vdef;
unsigned i;
if (defs)
@@ -2327,7 +2142,7 @@ free_stmt_operands (tree stmt)
continue;
last_def->next = gimple_ssa_operands (cfun)->free_defs;
gimple_ssa_operands (cfun)->free_defs = defs;
- DEF_OPS (stmt) = NULL;
+ gimple_set_def_ops (stmt, NULL);
}
if (uses)
@@ -2337,7 +2152,7 @@ free_stmt_operands (tree stmt)
delink_imm_use (USE_OP_PTR (last_use));
last_use->next = gimple_ssa_operands (cfun)->free_uses;
gimple_ssa_operands (cfun)->free_uses = uses;
- USE_OPS (stmt) = NULL;
+ gimple_set_use_ops (stmt, NULL);
}
if (vuses)
@@ -2345,7 +2160,7 @@ free_stmt_operands (tree stmt)
for (i = 0; i < VUSE_NUM (vuses); i++)
delink_imm_use (VUSE_OP_PTR (vuses, i));
add_vop_to_freelist (vuses);
- VUSE_OPS (stmt) = NULL;
+ gimple_set_vuse_ops (stmt, NULL);
}
if (vdefs)
@@ -2356,46 +2171,35 @@ free_stmt_operands (tree stmt)
delink_imm_use (VDEF_OP_PTR (vdef, 0));
add_vop_to_freelist (vdef);
}
- VDEF_OPS (stmt) = NULL;
+ gimple_set_vdef_ops (stmt, NULL);
}
-}
-
-/* Free any operands vectors in OPS. */
+ if (gimple_has_ops (stmt))
+ gimple_set_addresses_taken (stmt, NULL);
-void
-free_ssa_operands (stmt_operands_p ops)
-{
- ops->def_ops = NULL;
- ops->use_ops = NULL;
- ops->vdef_ops = NULL;
- ops->vuse_ops = NULL;
- BITMAP_FREE (ops->loads);
- BITMAP_FREE (ops->stores);
+ if (gimple_has_mem_ops (stmt))
+ {
+ gimple_set_stored_syms (stmt, NULL, &operands_bitmap_obstack);
+ gimple_set_loaded_syms (stmt, NULL, &operands_bitmap_obstack);
+ }
}
/* Get the operands of statement STMT. */
void
-update_stmt_operands (tree stmt)
+update_stmt_operands (gimple stmt)
{
- stmt_ann_t ann = get_stmt_ann (stmt);
-
/* If update_stmt_operands is called before SSA is initialized, do
nothing. */
if (!ssa_operands_active ())
return;
- /* The optimizers cannot handle statements that are nothing but a
- _DECL. This indicates a bug in the gimplifier. */
- gcc_assert (!SSA_VAR_P (stmt));
-
timevar_push (TV_TREE_OPS);
- gcc_assert (ann->modified);
+ gcc_assert (gimple_modified_p (stmt));
build_ssa_operands (stmt);
- ann->modified = 0;
+ gimple_set_modified (stmt, false);
timevar_pop (TV_TREE_OPS);
}
@@ -2404,50 +2208,45 @@ update_stmt_operands (tree stmt)
/* Copies virtual operands from SRC to DST. */
void
-copy_virtual_operands (tree dest, tree src)
+copy_virtual_operands (gimple dest, gimple src)
{
unsigned int i, n;
voptype_p src_vuses, dest_vuses;
voptype_p src_vdefs, dest_vdefs;
struct voptype_d vuse;
struct voptype_d vdef;
- stmt_ann_t dest_ann;
- VDEF_OPS (dest) = NULL;
- VUSE_OPS (dest) = NULL;
+ if (!gimple_has_mem_ops (src))
+ return;
- dest_ann = get_stmt_ann (dest);
- BITMAP_FREE (dest_ann->operands.loads);
- BITMAP_FREE (dest_ann->operands.stores);
+ gimple_set_vdef_ops (dest, NULL);
+ gimple_set_vuse_ops (dest, NULL);
- if (LOADED_SYMS (src))
- {
- dest_ann->operands.loads = BITMAP_ALLOC (&operands_bitmap_obstack);
- bitmap_copy (dest_ann->operands.loads, LOADED_SYMS (src));
- }
-
- if (STORED_SYMS (src))
- {
- dest_ann->operands.stores = BITMAP_ALLOC (&operands_bitmap_obstack);
- bitmap_copy (dest_ann->operands.stores, STORED_SYMS (src));
- }
+ gimple_set_stored_syms (dest, gimple_stored_syms (src),
+ &operands_bitmap_obstack);
+ gimple_set_loaded_syms (dest, gimple_loaded_syms (src),
+ &operands_bitmap_obstack);
/* Copy all the VUSE operators and corresponding operands. */
dest_vuses = &vuse;
- for (src_vuses = VUSE_OPS (src); src_vuses; src_vuses = src_vuses->next)
+ for (src_vuses = gimple_vuse_ops (src);
+ src_vuses;
+ src_vuses = src_vuses->next)
{
n = VUSE_NUM (src_vuses);
dest_vuses = add_vuse_op (dest, NULL_TREE, n, dest_vuses);
for (i = 0; i < n; i++)
SET_USE (VUSE_OP_PTR (dest_vuses, i), VUSE_OP (src_vuses, i));
- if (VUSE_OPS (dest) == NULL)
- VUSE_OPS (dest) = vuse.next;
+ if (gimple_vuse_ops (dest) == NULL)
+ gimple_set_vuse_ops (dest, vuse.next);
}
/* Copy all the VDEF operators and corresponding operands. */
dest_vdefs = &vdef;
- for (src_vdefs = VDEF_OPS (src); src_vdefs; src_vdefs = src_vdefs->next)
+ for (src_vdefs = gimple_vdef_ops (src);
+ src_vdefs;
+ src_vdefs = src_vdefs->next)
{
n = VUSE_NUM (src_vdefs);
dest_vdefs = add_vdef_op (dest, NULL_TREE, n, dest_vdefs);
@@ -2455,8 +2254,8 @@ copy_virtual_operands (tree dest, tree src)
for (i = 0; i < n; i++)
SET_USE (VUSE_OP_PTR (dest_vdefs, i), VUSE_OP (src_vdefs, i));
- if (VDEF_OPS (dest) == NULL)
- VDEF_OPS (dest) = vdef.next;
+ if (gimple_vdef_ops (dest) == NULL)
+ gimple_set_vdef_ops (dest, vdef.next);
}
}
@@ -2469,19 +2268,15 @@ copy_virtual_operands (tree dest, tree src)
uses of this stmt will be de-linked. */
void
-create_ssa_artificial_load_stmt (tree new_stmt, tree old_stmt,
+create_ssa_artificial_load_stmt (gimple new_stmt, gimple old_stmt,
bool delink_imm_uses_p)
{
tree op;
ssa_op_iter iter;
use_operand_p use_p;
unsigned i;
- stmt_ann_t ann;
- /* Create the stmt annotation but make sure to not mark the stmt
- as modified as we will build operands ourselves. */
- ann = get_stmt_ann (new_stmt);
- ann->modified = 0;
+ gimple_set_modified (new_stmt, false);
/* Process NEW_STMT looking for operands. */
start_ssa_stmt_operands ();
@@ -2521,7 +2316,7 @@ create_ssa_artificial_load_stmt (tree new_stmt, tree old_stmt,
to test the validity of the swap operation. */
void
-swap_tree_operands (tree stmt, tree *exp0, tree *exp1)
+swap_tree_operands (gimple stmt, tree *exp0, tree *exp1)
{
tree op0, op1;
op0 = *exp0;
@@ -2536,14 +2331,14 @@ swap_tree_operands (tree stmt, tree *exp0, tree *exp1)
use0 = use1 = NULL;
/* Find the 2 operands in the cache, if they are there. */
- for (ptr = USE_OPS (stmt); ptr; ptr = ptr->next)
+ for (ptr = gimple_use_ops (stmt); ptr; ptr = ptr->next)
if (USE_OP_PTR (ptr)->use == exp0)
{
use0 = ptr;
break;
}
- for (ptr = USE_OPS (stmt); ptr; ptr = ptr->next)
+ for (ptr = gimple_use_ops (stmt); ptr; ptr = ptr->next)
if (USE_OP_PTR (ptr)->use == exp1)
{
use1 = ptr;
@@ -2565,19 +2360,13 @@ swap_tree_operands (tree stmt, tree *exp0, tree *exp1)
*exp1 = op0;
}
-
-/* Add the base address of REF to the set *ADDRESSES_TAKEN. If
- *ADDRESSES_TAKEN is NULL, a new set is created. REF may be
- a single variable whose address has been taken or any other valid
- GIMPLE memory reference (structure reference, array, etc). */
+/* Add the base address of REF to SET. */
void
-add_to_addressable_set (tree ref, bitmap *addresses_taken)
+add_to_addressable_set (tree ref, bitmap *set)
{
tree var;
- gcc_assert (addresses_taken);
-
/* Note that it is *NOT OKAY* to use the target of a COMPONENT_REF
as the only thing we take the address of. If VAR is a structure,
taking the address of a field means that the whole structure may
@@ -2586,14 +2375,29 @@ add_to_addressable_set (tree ref, bitmap *addresses_taken)
var = get_base_address (ref);
if (var && SSA_VAR_P (var))
{
- if (*addresses_taken == NULL)
- *addresses_taken = BITMAP_GGC_ALLOC ();
- bitmap_set_bit (*addresses_taken, DECL_UID (var));
+ if (*set == NULL)
+ *set = BITMAP_ALLOC (&operands_bitmap_obstack);
+
+ bitmap_set_bit (*set, DECL_UID (var));
TREE_ADDRESSABLE (var) = 1;
}
}
+/* Add the base address of REF to the set of addresses taken by STMT.
+ REF may be a single variable whose address has been taken or any
+ other valid GIMPLE memory reference (structure reference, array,
+ etc). If the base address of REF is a decl that has sub-variables,
+ also add all of its sub-variables. */
+
+void
+gimple_add_to_addresses_taken (gimple stmt, tree ref)
+{
+ gcc_assert (gimple_has_ops (stmt));
+ add_to_addressable_set (ref, gimple_addresses_taken_ptr (stmt));
+}
+
+
/* Scan the immediate_use list for VAR making sure its linked properly.
Return TRUE if there is a problem and emit an error message to F. */
@@ -2653,10 +2457,10 @@ verify_imm_links (FILE *f, tree var)
return false;
error:
- if (ptr->stmt && stmt_modified_p (ptr->stmt))
+ if (ptr->loc.stmt && gimple_modified_p (ptr->loc.stmt))
{
- fprintf (f, " STMT MODIFIED. - <%p> ", (void *)ptr->stmt);
- print_generic_stmt (f, ptr->stmt, TDF_SLIM);
+ fprintf (f, " STMT MODIFIED. - <%p> ", (void *)ptr->loc.stmt);
+ print_gimple_stmt (f, ptr->loc.stmt, 0, TDF_SLIM);
}
fprintf (f, " IMM ERROR : (use_p : tree - %p:%p)", (void *)ptr,
(void *)ptr->use);
@@ -2688,13 +2492,13 @@ dump_immediate_uses_for (FILE *file, tree var)
FOR_EACH_IMM_USE_FAST (use_p, iter, var)
{
- if (use_p->stmt == NULL && use_p->use == NULL)
+ if (use_p->loc.stmt == NULL && use_p->use == NULL)
fprintf (file, "***end of stmt iterator marker***\n");
else
if (!is_gimple_reg (USE_FROM_PTR (use_p)))
- print_generic_stmt (file, USE_STMT (use_p), TDF_VOPS|TDF_MEMSYMS);
+ print_gimple_stmt (file, USE_STMT (use_p), 0, TDF_VOPS|TDF_MEMSYMS);
else
- print_generic_stmt (file, USE_STMT (use_p), TDF_SLIM);
+ print_gimple_stmt (file, USE_STMT (use_p), 0, TDF_SLIM);
}
fprintf(file, "\n");
}
@@ -2745,15 +2549,15 @@ debug_immediate_uses_for (tree var)
needed to keep the SSA form up to date. */
void
-push_stmt_changes (tree *stmt_p)
+push_stmt_changes (gimple *stmt_p)
{
- tree stmt;
+ gimple stmt;
scb_t buf;
-
+
stmt = *stmt_p;
/* It makes no sense to keep track of PHI nodes. */
- if (TREE_CODE (stmt) == PHI_NODE)
+ if (gimple_code (stmt) == GIMPLE_PHI)
return;
buf = XNEW (struct scb_d);
@@ -2761,7 +2565,7 @@ push_stmt_changes (tree *stmt_p)
buf->stmt_p = stmt_p;
- if (stmt_references_memory_p (stmt))
+ if (gimple_references_memory_p (stmt))
{
tree op;
ssa_op_iter i;
@@ -2815,9 +2619,10 @@ mark_difference_for_renaming (bitmap s1, bitmap s2)
the statement. */
void
-pop_stmt_changes (tree *stmt_p)
+pop_stmt_changes (gimple *stmt_p)
{
- tree op, stmt;
+ tree op;
+ gimple stmt;
ssa_op_iter iter;
bitmap loads, stores;
scb_t buf;
@@ -2825,7 +2630,7 @@ pop_stmt_changes (tree *stmt_p)
stmt = *stmt_p;
/* It makes no sense to keep track of PHI nodes. */
- if (TREE_CODE (stmt) == PHI_NODE)
+ if (gimple_code (stmt) == GIMPLE_PHI)
return;
buf = VEC_pop (scb_t, scb_stack);
@@ -2843,7 +2648,7 @@ pop_stmt_changes (tree *stmt_p)
memory anymore, but we still need to act on the differences in
the sets of symbols. */
loads = stores = NULL;
- if (stmt_references_memory_p (stmt))
+ if (gimple_references_memory_p (stmt))
{
tree op;
ssa_op_iter i;
@@ -2906,14 +2711,14 @@ pop_stmt_changes (tree *stmt_p)
statement. It avoids the expensive operand re-scan. */
void
-discard_stmt_changes (tree *stmt_p)
+discard_stmt_changes (gimple *stmt_p)
{
scb_t buf;
- tree stmt;
+ gimple stmt;
/* It makes no sense to keep track of PHI nodes. */
stmt = *stmt_p;
- if (TREE_CODE (stmt) == PHI_NODE)
+ if (gimple_code (stmt) == GIMPLE_PHI)
return;
buf = VEC_pop (scb_t, scb_stack);
@@ -2925,15 +2730,3 @@ discard_stmt_changes (tree *stmt_p)
buf->stmt_p = NULL;
free (buf);
}
-
-
-/* Returns true if statement STMT may access memory. */
-
-bool
-stmt_references_memory_p (tree stmt)
-{
- if (!gimple_ssa_operands (cfun)->ops_active || TREE_CODE (stmt) == PHI_NODE)
- return false;
-
- return stmt_ann (stmt)->references_memory;
-}
diff --git a/gcc/tree-ssa-operands.h b/gcc/tree-ssa-operands.h
index ba9793d8346..cdbc050b579 100644
--- a/gcc/tree-ssa-operands.h
+++ b/gcc/tree-ssa-operands.h
@@ -157,15 +157,7 @@ typedef struct stmt_operands_d *stmt_operands_p;
#define SET_USE(USE, V) set_ssa_use_from_ptr (USE, V)
#define SET_DEF(DEF, V) ((*(DEF)) = (V))
-#define USE_STMT(USE) (USE)->stmt
-
-#define DEF_OPS(STMT) (stmt_ann (STMT)->operands.def_ops)
-#define USE_OPS(STMT) (stmt_ann (STMT)->operands.use_ops)
-#define VUSE_OPS(STMT) (stmt_ann (STMT)->operands.vuse_ops)
-#define VDEF_OPS(STMT) (stmt_ann (STMT)->operands.vdef_ops)
-
-#define LOADED_SYMS(STMT) (stmt_ann (STMT)->operands.loads)
-#define STORED_SYMS(STMT) (stmt_ann (STMT)->operands.stores)
+#define USE_STMT(USE) (USE)->loc.stmt
#define USE_OP_PTR(OP) (&((OP)->use_ptr))
#define USE_OP(OP) (USE_FROM_PTR (USE_OP_PTR (OP)))
@@ -187,11 +179,11 @@ typedef struct stmt_operands_d *stmt_operands_p;
#define VDEF_NUM(OP) VUSE_VECT_NUM_ELEM ((OP)->usev)
#define VDEF_VECT(OP) &((OP)->usev)
-#define PHI_RESULT_PTR(PHI) get_phi_result_ptr (PHI)
+#define PHI_RESULT_PTR(PHI) gimple_phi_result_ptr (PHI)
#define PHI_RESULT(PHI) DEF_FROM_PTR (PHI_RESULT_PTR (PHI))
#define SET_PHI_RESULT(PHI, V) SET_DEF (PHI_RESULT_PTR (PHI), (V))
-#define PHI_ARG_DEF_PTR(PHI, I) get_phi_arg_def_ptr ((PHI), (I))
+#define PHI_ARG_DEF_PTR(PHI, I) gimple_phi_arg_imm_use_ptr ((PHI), (I))
#define PHI_ARG_DEF(PHI, I) USE_FROM_PTR (PHI_ARG_DEF_PTR ((PHI), (I)))
#define SET_PHI_ARG_DEF(PHI, I, V) \
SET_USE (PHI_ARG_DEF_PTR ((PHI), (I)), (V))
@@ -204,14 +196,13 @@ typedef struct stmt_operands_d *stmt_operands_p;
extern void init_ssa_operands (void);
extern void fini_ssa_operands (void);
-extern void free_ssa_operands (stmt_operands_p);
-extern void update_stmt_operands (tree);
-extern void free_stmt_operands (tree);
+extern void update_stmt_operands (gimple);
+extern void free_stmt_operands (gimple);
extern bool verify_imm_links (FILE *f, tree var);
-extern void copy_virtual_operands (tree, tree);
+extern void copy_virtual_operands (gimple, gimple);
extern int operand_build_cmp (const void *, const void *);
-extern void create_ssa_artificial_load_stmt (tree, tree, bool);
+extern void create_ssa_artificial_load_stmt (gimple, gimple, bool);
extern void dump_immediate_uses (FILE *file);
extern void dump_immediate_uses_for (FILE *file, tree var);
@@ -222,10 +213,10 @@ extern void debug_decl_set (bitmap);
extern bool ssa_operands_active (void);
-extern void add_to_addressable_set (tree, bitmap *);
-extern void push_stmt_changes (tree *);
-extern void pop_stmt_changes (tree *);
-extern void discard_stmt_changes (tree *);
+extern void push_stmt_changes (gimple *);
+extern void pop_stmt_changes (gimple *);
+extern void discard_stmt_changes (gimple *);
+void add_to_addressable_set (tree, bitmap *);
enum ssa_op_iter_type {
ssa_op_iter_none = 0,
@@ -250,7 +241,7 @@ typedef struct ssa_operand_iterator_d
enum ssa_op_iter_type iter_type;
int phi_i;
int num_phi;
- tree phi_stmt;
+ gimple phi_stmt;
bool done;
unsigned int vuse_index;
unsigned int mayuse_index;
@@ -316,7 +307,7 @@ typedef struct ssa_operand_iterator_d
/* This macro will execute a loop over a stmt, regardless of whether it is
a real stmt or a PHI node, looking at the USE nodes matching FLAGS. */
#define FOR_EACH_PHI_OR_STMT_USE(USEVAR, STMT, ITER, FLAGS) \
- for ((USEVAR) = (TREE_CODE (STMT) == PHI_NODE \
+ for ((USEVAR) = (gimple_code (STMT) == GIMPLE_PHI \
? op_iter_init_phiuse (&(ITER), STMT, FLAGS) \
: op_iter_init_use (&(ITER), STMT, FLAGS)); \
!op_iter_done (&(ITER)); \
@@ -325,7 +316,7 @@ typedef struct ssa_operand_iterator_d
/* This macro will execute a loop over a stmt, regardless of whether it is
a real stmt or a PHI node, looking at the DEF nodes matching FLAGS. */
#define FOR_EACH_PHI_OR_STMT_DEF(DEFVAR, STMT, ITER, FLAGS) \
- for ((DEFVAR) = (TREE_CODE (STMT) == PHI_NODE \
+ for ((DEFVAR) = (gimple_code (STMT) == GIMPLE_PHI \
? op_iter_init_phidef (&(ITER), STMT, FLAGS) \
: op_iter_init_def (&(ITER), STMT, FLAGS)); \
!op_iter_done (&(ITER)); \
diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c
index 80917a88525..72ba04a09b8 100644
--- a/gcc/tree-ssa-phiopt.c
+++ b/gcc/tree-ssa-phiopt.c
@@ -37,19 +37,20 @@ along with GCC; see the file COPYING3. If not see
#include "pointer-set.h"
#include "domwalk.h"
+static unsigned int tree_ssa_phiopt (void);
static unsigned int tree_ssa_phiopt_worker (bool);
static bool conditional_replacement (basic_block, basic_block,
- edge, edge, tree, tree, tree);
+ edge, edge, gimple, tree, tree);
static bool value_replacement (basic_block, basic_block,
- edge, edge, tree, tree, tree);
+ edge, edge, gimple, tree, tree);
static bool minmax_replacement (basic_block, basic_block,
- edge, edge, tree, tree, tree);
+ edge, edge, gimple, tree, tree);
static bool abs_replacement (basic_block, basic_block,
- edge, edge, tree, tree, tree);
+ edge, edge, gimple, tree, tree);
static bool cond_store_replacement (basic_block, basic_block, edge, edge,
struct pointer_set_t *);
static struct pointer_set_t * get_non_trapping (void);
-static void replace_phi_edge_with_variable (basic_block, edge, tree, tree);
+static void replace_phi_edge_with_variable (basic_block, edge, gimple, tree);
/* This pass tries to replaces an if-then-else block with an
assignment. We have four kinds of transformations. Some of these
@@ -208,18 +209,17 @@ tree_ssa_phiopt_worker (bool do_store_elim)
for (i = 0; i < n; i++)
{
- tree cond_expr;
- tree phi;
+ gimple cond_stmt, phi;
basic_block bb1, bb2;
edge e1, e2;
tree arg0, arg1;
bb = bb_order[i];
- cond_expr = last_stmt (bb);
- /* Check to see if the last statement is a COND_EXPR. */
- if (!cond_expr
- || TREE_CODE (cond_expr) != COND_EXPR)
+ cond_stmt = last_stmt (bb);
+ /* Check to see if the last statement is a GIMPLE_COND. */
+ if (!cond_stmt
+ || gimple_code (cond_stmt) != GIMPLE_COND)
continue;
e1 = EDGE_SUCC (bb, 0);
@@ -278,16 +278,17 @@ tree_ssa_phiopt_worker (bool do_store_elim)
}
else
{
- phi = phi_nodes (bb2);
+ gimple_seq phis = phi_nodes (bb2);
/* Check to make sure that there is only one PHI node.
TODO: we could do it with more than one iff the other PHI nodes
have the same elements for these two edges. */
- if (!phi || PHI_CHAIN (phi) != NULL)
+ if (! gimple_seq_singleton_p (phis))
continue;
- arg0 = PHI_ARG_DEF_TREE (phi, e1->dest_idx);
- arg1 = PHI_ARG_DEF_TREE (phi, e2->dest_idx);
+ phi = gsi_stmt (gsi_start (phis));
+ arg0 = gimple_phi_arg_def (phi, e1->dest_idx);
+ arg1 = gimple_phi_arg_def (phi, e2->dest_idx);
/* Something is wrong if we cannot find the arguments in the PHI
node. */
@@ -314,7 +315,7 @@ tree_ssa_phiopt_worker (bool do_store_elim)
{
/* In cond-store replacement we have added some loads on edges
and new VOPS (as we moved the store, and created a load). */
- bsi_commit_edge_inserts ();
+ gsi_commit_edge_inserts ();
return TODO_cleanup_cfg | TODO_update_ssa_only_virtuals;
}
else if (cfgchanged)
@@ -382,19 +383,8 @@ blocks_in_phiopt_order (void)
bool
empty_block_p (basic_block bb)
{
- block_stmt_iterator bsi;
-
/* BB must have no executable statements. */
- bsi = bsi_start (bb);
- while (!bsi_end_p (bsi)
- && (TREE_CODE (bsi_stmt (bsi)) == LABEL_EXPR
- || IS_EMPTY_STMT (bsi_stmt (bsi))))
- bsi_next (&bsi);
-
- if (!bsi_end_p (bsi))
- return false;
-
- return true;
+ return gsi_end_p (gsi_after_labels (bb));
}
/* Replace PHI node element whose edge is E in block BB with variable NEW.
@@ -403,11 +393,11 @@ empty_block_p (basic_block bb)
static void
replace_phi_edge_with_variable (basic_block cond_block,
- edge e, tree phi, tree new_tree)
+ edge e, gimple phi, tree new_tree)
{
- basic_block bb = bb_for_stmt (phi);
+ basic_block bb = gimple_bb (phi);
basic_block block_to_remove;
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
/* Change the PHI argument to new. */
SET_USE (PHI_ARG_DEF_PTR (phi, e->dest_idx), new_tree);
@@ -435,8 +425,8 @@ replace_phi_edge_with_variable (basic_block cond_block,
delete_basic_block (block_to_remove);
/* Eliminate the COND_EXPR at the end of COND_BLOCK. */
- bsi = bsi_last (cond_block);
- bsi_remove (&bsi, true);
+ gsi = gsi_last_bb (cond_block);
+ gsi_remove (&gsi, true);
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file,
@@ -453,16 +443,15 @@ replace_phi_edge_with_variable (basic_block cond_block,
static bool
conditional_replacement (basic_block cond_bb, basic_block middle_bb,
- edge e0, edge e1, tree phi,
+ edge e0, edge e1, gimple phi,
tree arg0, tree arg1)
{
tree result;
- tree old_result = NULL;
- tree new_stmt, cond;
- block_stmt_iterator bsi;
+ gimple stmt, new_stmt;
+ tree cond;
+ gimple_stmt_iterator gsi;
edge true_edge, false_edge;
- tree new_var = NULL;
- tree new_var1;
+ tree new_var, new_var2;
/* FIXME: Gimplification of complex type is too hard for now. */
if (TREE_CODE (TREE_TYPE (arg0)) == COMPLEX_TYPE
@@ -480,61 +469,7 @@ conditional_replacement (basic_block cond_bb, basic_block middle_bb,
if (!empty_block_p (middle_bb))
return false;
- /* If the condition is not a naked SSA_NAME and its type does not
- match the type of the result, then we have to create a new
- variable to optimize this case as it would likely create
- non-gimple code when the condition was converted to the
- result's type. */
- cond = COND_EXPR_COND (last_stmt (cond_bb));
- result = PHI_RESULT (phi);
- if (TREE_CODE (cond) != SSA_NAME
- && !useless_type_conversion_p (TREE_TYPE (result), TREE_TYPE (cond)))
- {
- tree tmp;
-
- if (!COMPARISON_CLASS_P (cond))
- return false;
-
- tmp = create_tmp_var (TREE_TYPE (cond), NULL);
- add_referenced_var (tmp);
- new_var = make_ssa_name (tmp, NULL);
- old_result = cond;
- cond = new_var;
- }
-
- /* If the condition was a naked SSA_NAME and the type is not the
- same as the type of the result, then convert the type of the
- condition. */
- if (!useless_type_conversion_p (TREE_TYPE (result), TREE_TYPE (cond)))
- cond = fold_convert (TREE_TYPE (result), cond);
-
- /* We need to know which is the true edge and which is the false
- edge so that we know when to invert the condition below. */
- extract_true_false_edges_from_block (cond_bb, &true_edge, &false_edge);
-
- /* Insert our new statement at the end of conditional block before the
- COND_EXPR. */
- bsi = bsi_last (cond_bb);
- bsi_insert_before (&bsi, build_empty_stmt (), BSI_NEW_STMT);
-
- if (old_result)
- {
- tree new1;
-
- new1 = build2 (TREE_CODE (old_result), TREE_TYPE (old_result),
- TREE_OPERAND (old_result, 0),
- TREE_OPERAND (old_result, 1));
-
- new1 = build_gimple_modify_stmt (new_var, new1);
- SSA_NAME_DEF_STMT (new_var) = new1;
-
- bsi_insert_after (&bsi, new1, BSI_NEW_STMT);
- }
-
- new_var1 = duplicate_ssa_name (PHI_RESULT (phi), NULL);
-
-
- /* At this point we know we have a COND_EXPR with two successors.
+ /* At this point we know we have a GIMPLE_COND with two successors.
One successor is BB, the other successor is an empty block which
falls through into BB.
@@ -549,71 +484,46 @@ conditional_replacement (basic_block cond_bb, basic_block middle_bb,
We use the condition as-is if the argument associated with the
true edge has the value one or the argument associated with the
false edge as the value zero. Note that those conditions are not
- the same since only one of the outgoing edges from the COND_EXPR
+ the same since only one of the outgoing edges from the GIMPLE_COND
will directly reach BB and thus be associated with an argument. */
- if ((e0 == true_edge && integer_onep (arg0))
- || (e0 == false_edge && integer_zerop (arg0))
- || (e1 == true_edge && integer_onep (arg1))
- || (e1 == false_edge && integer_zerop (arg1)))
- {
- new_stmt = build_gimple_modify_stmt (new_var1, cond);
- }
- else
- {
- tree cond1 = invert_truthvalue (cond);
-
- cond = cond1;
-
- /* If what we get back is a conditional expression, there is no
- way that it can be gimple. */
- if (TREE_CODE (cond) == COND_EXPR)
- {
- release_ssa_name (new_var1);
- return false;
- }
- /* If COND is not something we can expect to be reducible to a GIMPLE
- condition, return early. */
- if (is_gimple_cast (cond))
- cond1 = TREE_OPERAND (cond, 0);
- if (TREE_CODE (cond1) == TRUTH_NOT_EXPR
- && !is_gimple_val (TREE_OPERAND (cond1, 0)))
- {
- release_ssa_name (new_var1);
- return false;
- }
+ stmt = last_stmt (cond_bb);
+ result = PHI_RESULT (phi);
- /* If what we get back is not gimple try to create it as gimple by
- using a temporary variable. */
- if (is_gimple_cast (cond)
- && !is_gimple_val (TREE_OPERAND (cond, 0)))
- {
- tree op0, tmp, cond_tmp;
-
- /* Only "real" casts are OK here, not everything that is
- acceptable to is_gimple_cast. Make sure we don't do
- anything stupid here. */
- gcc_assert (CONVERT_EXPR_P (cond));
-
- op0 = TREE_OPERAND (cond, 0);
- tmp = create_tmp_var (TREE_TYPE (op0), NULL);
- add_referenced_var (tmp);
- cond_tmp = make_ssa_name (tmp, NULL);
- new_stmt = build_gimple_modify_stmt (cond_tmp, op0);
- SSA_NAME_DEF_STMT (cond_tmp) = new_stmt;
-
- bsi_insert_after (&bsi, new_stmt, BSI_NEW_STMT);
- cond = fold_convert (TREE_TYPE (result), cond_tmp);
- }
+ /* To handle special cases like floating point comparison, it is easier and
+ less error-prone to build a tree and gimplify it on the fly though it is
+ less efficient. */
+ cond = fold_build2 (gimple_cond_code (stmt), boolean_type_node,
+ gimple_cond_lhs (stmt), gimple_cond_rhs (stmt));
- new_stmt = build_gimple_modify_stmt (new_var1, cond);
+ /* We need to know which is the true edge and which is the false
+ edge so that we know when to invert the condition below. */
+ extract_true_false_edges_from_block (cond_bb, &true_edge, &false_edge);
+ if ((e0 == true_edge && integer_zerop (arg0))
+ || (e0 == false_edge && integer_onep (arg0))
+ || (e1 == true_edge && integer_zerop (arg1))
+ || (e1 == false_edge && integer_onep (arg1)))
+ cond = fold_build1 (TRUTH_NOT_EXPR, TREE_TYPE (cond), cond);
+
+ /* Insert our new statements at the end of conditional block before the
+ COND_STMT. */
+ gsi = gsi_for_stmt (stmt);
+ new_var = force_gimple_operand_gsi (&gsi, cond, true, NULL, true,
+ GSI_SAME_STMT);
+
+ if (!useless_type_conversion_p (TREE_TYPE (result), TREE_TYPE (new_var)))
+ {
+ new_var2 = create_tmp_var (TREE_TYPE (result), NULL);
+ add_referenced_var (new_var2);
+ new_stmt = gimple_build_assign_with_ops (CONVERT_EXPR, new_var2,
+ new_var, NULL);
+ new_var2 = make_ssa_name (new_var2, new_stmt);
+ gimple_assign_set_lhs (new_stmt, new_var2);
+ gsi_insert_before (&gsi, new_stmt, GSI_SAME_STMT);
+ new_var = new_var2;
}
- bsi_insert_after (&bsi, new_stmt, BSI_NEW_STMT);
-
- SSA_NAME_DEF_STMT (new_var1) = new_stmt;
-
- replace_phi_edge_with_variable (cond_bb, e1, phi, new_var1);
+ replace_phi_edge_with_variable (cond_bb, e1, phi, new_var);
/* Note that we optimized this PHI. */
return true;
@@ -627,11 +537,12 @@ conditional_replacement (basic_block cond_bb, basic_block middle_bb,
static bool
value_replacement (basic_block cond_bb, basic_block middle_bb,
- edge e0, edge e1, tree phi,
+ edge e0, edge e1, gimple phi,
tree arg0, tree arg1)
{
- tree cond;
+ gimple cond;
edge true_edge, false_edge;
+ enum tree_code code;
/* If the type says honor signed zeros we cannot do this
optimization. */
@@ -641,10 +552,11 @@ value_replacement (basic_block cond_bb, basic_block middle_bb,
if (!empty_block_p (middle_bb))
return false;
- cond = COND_EXPR_COND (last_stmt (cond_bb));
+ cond = last_stmt (cond_bb);
+ code = gimple_cond_code (cond);
/* This transformation is only valid for equality comparisons. */
- if (TREE_CODE (cond) != NE_EXPR && TREE_CODE (cond) != EQ_EXPR)
+ if (code != NE_EXPR && code != EQ_EXPR)
return false;
/* We need to know which is the true edge and which is the false
@@ -662,10 +574,10 @@ value_replacement (basic_block cond_bb, basic_block middle_bb,
We now need to verify that the two arguments in the PHI node match
the two arguments to the equality comparison. */
- if ((operand_equal_for_phi_arg_p (arg0, TREE_OPERAND (cond, 0))
- && operand_equal_for_phi_arg_p (arg1, TREE_OPERAND (cond, 1)))
- || (operand_equal_for_phi_arg_p (arg1, TREE_OPERAND (cond, 0))
- && operand_equal_for_phi_arg_p (arg0, TREE_OPERAND (cond, 1))))
+ if ((operand_equal_for_phi_arg_p (arg0, gimple_cond_lhs (cond))
+ && operand_equal_for_phi_arg_p (arg1, gimple_cond_rhs (cond)))
+ || (operand_equal_for_phi_arg_p (arg1, gimple_cond_lhs (cond))
+ && operand_equal_for_phi_arg_p (arg0, gimple_cond_rhs (cond))))
{
edge e;
tree arg;
@@ -673,7 +585,7 @@ value_replacement (basic_block cond_bb, basic_block middle_bb,
/* For NE_EXPR, we want to build an assignment result = arg where
arg is the PHI argument associated with the true edge. For
EQ_EXPR we want the PHI argument associated with the false edge. */
- e = (TREE_CODE (cond) == NE_EXPR ? true_edge : false_edge);
+ e = (code == NE_EXPR ? true_edge : false_edge);
/* Unfortunately, E may not reach BB (it may instead have gone to
OTHER_BLOCK). If that is the case, then we want the single outgoing
@@ -705,15 +617,15 @@ value_replacement (basic_block cond_bb, basic_block middle_bb,
static bool
minmax_replacement (basic_block cond_bb, basic_block middle_bb,
- edge e0, edge e1, tree phi,
+ edge e0, edge e1, gimple phi,
tree arg0, tree arg1)
{
tree result, type;
- tree cond, new_stmt;
+ gimple cond, new_stmt;
edge true_edge, false_edge;
enum tree_code cmp, minmax, ass_code;
tree smaller, larger, arg_true, arg_false;
- block_stmt_iterator bsi, bsi_from;
+ gimple_stmt_iterator gsi, gsi_from;
type = TREE_TYPE (PHI_RESULT (phi));
@@ -721,21 +633,21 @@ minmax_replacement (basic_block cond_bb, basic_block middle_bb,
if (HONOR_NANS (TYPE_MODE (type)))
return false;
- cond = COND_EXPR_COND (last_stmt (cond_bb));
- cmp = TREE_CODE (cond);
+ cond = last_stmt (cond_bb);
+ cmp = gimple_cond_code (cond);
result = PHI_RESULT (phi);
/* This transformation is only valid for order comparisons. Record which
operand is smaller/larger if the result of the comparison is true. */
if (cmp == LT_EXPR || cmp == LE_EXPR)
{
- smaller = TREE_OPERAND (cond, 0);
- larger = TREE_OPERAND (cond, 1);
+ smaller = gimple_cond_lhs (cond);
+ larger = gimple_cond_rhs (cond);
}
else if (cmp == GT_EXPR || cmp == GE_EXPR)
{
- smaller = TREE_OPERAND (cond, 1);
- larger = TREE_OPERAND (cond, 0);
+ smaller = gimple_cond_rhs (cond);
+ larger = gimple_cond_lhs (cond);
}
else
return false;
@@ -796,20 +708,19 @@ minmax_replacement (basic_block cond_bb, basic_block middle_bb,
b = MAX (a, d);
x = MIN (b, u); */
- tree assign = last_and_only_stmt (middle_bb);
- tree lhs, rhs, op0, op1, bound;
+ gimple assign = last_and_only_stmt (middle_bb);
+ tree lhs, op0, op1, bound;
if (!assign
- || TREE_CODE (assign) != GIMPLE_MODIFY_STMT)
+ || gimple_code (assign) != GIMPLE_ASSIGN)
return false;
- lhs = GIMPLE_STMT_OPERAND (assign, 0);
- rhs = GIMPLE_STMT_OPERAND (assign, 1);
- ass_code = TREE_CODE (rhs);
+ lhs = gimple_assign_lhs (assign);
+ ass_code = gimple_assign_rhs_code (assign);
if (ass_code != MAX_EXPR && ass_code != MIN_EXPR)
return false;
- op0 = TREE_OPERAND (rhs, 0);
- op1 = TREE_OPERAND (rhs, 1);
+ op0 = gimple_assign_rhs1 (assign);
+ op1 = gimple_assign_rhs2 (assign);
if (true_edge->src == middle_bb)
{
@@ -931,17 +842,16 @@ minmax_replacement (basic_block cond_bb, basic_block middle_bb,
}
/* Move the statement from the middle block. */
- bsi = bsi_last (cond_bb);
- bsi_from = bsi_last (middle_bb);
- bsi_move_before (&bsi_from, &bsi);
+ gsi = gsi_last_bb (cond_bb);
+ gsi_from = gsi_last_bb (middle_bb);
+ gsi_move_before (&gsi_from, &gsi);
}
/* Emit the statement to compute min/max. */
result = duplicate_ssa_name (PHI_RESULT (phi), NULL);
- new_stmt = build_gimple_modify_stmt (result, build2 (minmax, type, arg0, arg1));
- SSA_NAME_DEF_STMT (result) = new_stmt;
- bsi = bsi_last (cond_bb);
- bsi_insert_before (&bsi, new_stmt, BSI_NEW_STMT);
+ new_stmt = gimple_build_assign_with_ops (minmax, result, arg0, arg1);
+ gsi = gsi_last_bb (cond_bb);
+ gsi_insert_before (&gsi, new_stmt, GSI_NEW_STMT);
replace_phi_edge_with_variable (cond_bb, e1, phi, result);
return true;
@@ -956,13 +866,13 @@ minmax_replacement (basic_block cond_bb, basic_block middle_bb,
static bool
abs_replacement (basic_block cond_bb, basic_block middle_bb,
edge e0 ATTRIBUTE_UNUSED, edge e1,
- tree phi, tree arg0, tree arg1)
+ gimple phi, tree arg0, tree arg1)
{
tree result;
- tree new_stmt, cond;
- block_stmt_iterator bsi;
+ gimple new_stmt, cond;
+ gimple_stmt_iterator gsi;
edge true_edge, false_edge;
- tree assign;
+ gimple assign;
edge e;
tree rhs, lhs;
bool negate;
@@ -985,38 +895,37 @@ abs_replacement (basic_block cond_bb, basic_block middle_bb,
/* If we got here, then we have found the only executable statement
in OTHER_BLOCK. If it is anything other than arg = -arg1 or
arg1 = -arg0, then we can not optimize. */
- if (TREE_CODE (assign) != GIMPLE_MODIFY_STMT)
+ if (gimple_code (assign) != GIMPLE_ASSIGN)
return false;
- lhs = GIMPLE_STMT_OPERAND (assign, 0);
- rhs = GIMPLE_STMT_OPERAND (assign, 1);
+ lhs = gimple_assign_lhs (assign);
- if (TREE_CODE (rhs) != NEGATE_EXPR)
+ if (gimple_assign_rhs_code (assign) != NEGATE_EXPR)
return false;
- rhs = TREE_OPERAND (rhs, 0);
+ rhs = gimple_assign_rhs1 (assign);
/* The assignment has to be arg0 = -arg1 or arg1 = -arg0. */
if (!(lhs == arg0 && rhs == arg1)
&& !(lhs == arg1 && rhs == arg0))
return false;
- cond = COND_EXPR_COND (last_stmt (cond_bb));
+ cond = last_stmt (cond_bb);
result = PHI_RESULT (phi);
/* Only relationals comparing arg[01] against zero are interesting. */
- cond_code = TREE_CODE (cond);
+ cond_code = gimple_cond_code (cond);
if (cond_code != GT_EXPR && cond_code != GE_EXPR
&& cond_code != LT_EXPR && cond_code != LE_EXPR)
return false;
/* Make sure the conditional is arg[01] OP y. */
- if (TREE_OPERAND (cond, 0) != rhs)
+ if (gimple_cond_lhs (cond) != rhs)
return false;
- if (FLOAT_TYPE_P (TREE_TYPE (TREE_OPERAND (cond, 1)))
- ? real_zerop (TREE_OPERAND (cond, 1))
- : integer_zerop (TREE_OPERAND (cond, 1)))
+ if (FLOAT_TYPE_P (TREE_TYPE (gimple_cond_rhs (cond)))
+ ? real_zerop (gimple_cond_rhs (cond))
+ : integer_zerop (gimple_cond_rhs (cond)))
;
else
return false;
@@ -1050,24 +959,19 @@ abs_replacement (basic_block cond_bb, basic_block middle_bb,
lhs = result;
/* Build the modify expression with abs expression. */
- new_stmt = build_gimple_modify_stmt (lhs,
- build1 (ABS_EXPR, TREE_TYPE (lhs), rhs));
- SSA_NAME_DEF_STMT (lhs) = new_stmt;
+ new_stmt = gimple_build_assign_with_ops (ABS_EXPR, lhs, rhs, NULL);
- bsi = bsi_last (cond_bb);
- bsi_insert_before (&bsi, new_stmt, BSI_NEW_STMT);
+ gsi = gsi_last_bb (cond_bb);
+ gsi_insert_before (&gsi, new_stmt, GSI_NEW_STMT);
if (negate)
{
- /* Get the right BSI. We want to insert after the recently
+ /* Get the right GSI. We want to insert after the recently
added ABS_EXPR statement (which we know is the first statement
in the block. */
- new_stmt = build_gimple_modify_stmt (result,
- build1 (NEGATE_EXPR, TREE_TYPE (lhs),
- lhs));
- SSA_NAME_DEF_STMT (result) = new_stmt;
+ new_stmt = gimple_build_assign_with_ops (NEGATE_EXPR, result, lhs, NULL);
- bsi_insert_after (&bsi, new_stmt, BSI_NEW_STMT);
+ gsi_insert_after (&gsi, new_stmt, GSI_NEW_STMT);
}
replace_phi_edge_with_variable (cond_bb, e1, phi, result);
@@ -1188,21 +1092,22 @@ add_or_mark_expr (basic_block bb, tree exp,
static void
nt_init_block (struct dom_walk_data *data ATTRIBUTE_UNUSED, basic_block bb)
{
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
/* Mark this BB as being on the path to dominator root. */
bb->aux = (void*)1;
/* And walk the statements in order. */
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- tree stmt = bsi_stmt (bsi);
+ gimple stmt = gsi_stmt (gsi);
- if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT)
+ if (is_gimple_assign (stmt))
{
- tree lhs = GIMPLE_STMT_OPERAND (stmt, 0);
- tree rhs = GIMPLE_STMT_OPERAND (stmt, 1);
- add_or_mark_expr (bb, rhs, nontrap_set, false);
- add_or_mark_expr (bb, lhs, nontrap_set, true);
+ add_or_mark_expr (bb, gimple_assign_lhs (stmt), nontrap_set, true);
+ add_or_mark_expr (bb, gimple_assign_rhs1 (stmt), nontrap_set, false);
+ if (get_gimple_rhs_num_ops (gimple_assign_rhs_code (stmt)) > 1)
+ add_or_mark_expr (bb, gimple_assign_rhs2 (stmt), nontrap_set,
+ false);
}
}
}
@@ -1274,21 +1179,26 @@ static bool
cond_store_replacement (basic_block middle_bb, basic_block join_bb,
edge e0, edge e1, struct pointer_set_t *nontrap)
{
- tree assign = last_and_only_stmt (middle_bb);
- tree lhs, rhs, newexpr, name;
- tree newphi;
- block_stmt_iterator bsi;
+ gimple assign = last_and_only_stmt (middle_bb);
+ tree lhs, rhs, name;
+ gimple newphi, new_stmt;
+ gimple_stmt_iterator gsi;
+ enum tree_code code;
/* Check if middle_bb contains of only one store. */
if (!assign
- || TREE_CODE (assign) != GIMPLE_MODIFY_STMT)
+ || gimple_code (assign) != GIMPLE_ASSIGN)
return false;
- lhs = GIMPLE_STMT_OPERAND (assign, 0);
+ lhs = gimple_assign_lhs (assign);
+ rhs = gimple_assign_rhs1 (assign);
if (!INDIRECT_REF_P (lhs))
return false;
- rhs = GIMPLE_STMT_OPERAND (assign, 1);
- if (TREE_CODE (rhs) != SSA_NAME && !is_gimple_min_invariant (rhs))
+
+ /* RHS is either a single SSA_NAME or a constant. */
+ code = gimple_assign_rhs_code (assign);
+ if (get_gimple_rhs_class (code) != GIMPLE_SINGLE_RHS
+ || (code != SSA_NAME && !is_gimple_min_invariant (rhs)))
return false;
/* Prove that we can move the store down. We could also check
TREE_THIS_NOTRAP here, but in that case we also could move stores,
@@ -1299,8 +1209,8 @@ cond_store_replacement (basic_block middle_bb, basic_block join_bb,
/* Now we've checked the constraints, so do the transformation:
1) Remove the single store. */
mark_symbols_for_renaming (assign);
- bsi = bsi_for_stmt (assign);
- bsi_remove (&bsi, true);
+ gsi = gsi_for_stmt (assign);
+ gsi_remove (&gsi, true);
/* 2) Create a temporary where we can store the old content
of the memory touched by the store, if we need to. */
@@ -1317,11 +1227,11 @@ cond_store_replacement (basic_block middle_bb, basic_block join_bb,
/* 3) Insert a load from the memory of the store to the temporary
on the edge which did not contain the store. */
lhs = unshare_expr (lhs);
- newexpr = build_gimple_modify_stmt (condstoretemp, lhs);
- name = make_ssa_name (condstoretemp, newexpr);
- GIMPLE_STMT_OPERAND (newexpr, 0) = name;
- mark_symbols_for_renaming (newexpr);
- bsi_insert_on_edge (e1, newexpr);
+ new_stmt = gimple_build_assign (condstoretemp, lhs);
+ name = make_ssa_name (condstoretemp, new_stmt);
+ gimple_assign_set_lhs (new_stmt, name);
+ mark_symbols_for_renaming (new_stmt);
+ gsi_insert_on_edge (e1, new_stmt);
/* 4) Create a PHI node at the join block, with one argument
holding the old RHS, and the other holding the temporary
@@ -1331,20 +1241,18 @@ cond_store_replacement (basic_block middle_bb, basic_block join_bb,
add_phi_arg (newphi, name, e1);
lhs = unshare_expr (lhs);
- newexpr = build_gimple_modify_stmt (lhs, PHI_RESULT (newphi));
- mark_symbols_for_renaming (newexpr);
+ new_stmt = gimple_build_assign (lhs, PHI_RESULT (newphi));
+ mark_symbols_for_renaming (new_stmt);
/* 5) Insert that PHI node. */
- bsi = bsi_start (join_bb);
- while (!bsi_end_p (bsi) && TREE_CODE (bsi_stmt (bsi)) == LABEL_EXPR)
- bsi_next (&bsi);
- if (bsi_end_p (bsi))
+ gsi = gsi_after_labels (join_bb);
+ if (gsi_end_p (gsi))
{
- bsi = bsi_last (join_bb);
- bsi_insert_after (&bsi, newexpr, BSI_NEW_STMT);
+ gsi = gsi_last_bb (join_bb);
+ gsi_insert_after (&gsi, new_stmt, GSI_NEW_STMT);
}
else
- bsi_insert_before (&bsi, newexpr, BSI_NEW_STMT);
+ gsi_insert_before (&gsi, new_stmt, GSI_NEW_STMT);
return true;
}
diff --git a/gcc/tree-ssa-phiprop.c b/gcc/tree-ssa-phiprop.c
index f408939b07d..ff3ee4a439f 100644
--- a/gcc/tree-ssa-phiprop.c
+++ b/gcc/tree-ssa-phiprop.c
@@ -95,7 +95,7 @@ along with GCC; see the file COPYING3. If not see
struct phiprop_d
{
tree value;
- tree vop_stmt;
+ gimple vop_stmt;
};
/* Verify if the value recorded for NAME in PHIVN is still valid at
@@ -104,7 +104,7 @@ struct phiprop_d
static bool
phivn_valid_p (struct phiprop_d *phivn, tree name, basic_block bb)
{
- tree vop_stmt = phivn[SSA_NAME_VERSION (name)].vop_stmt;
+ gimple vop_stmt = phivn[SSA_NAME_VERSION (name)].vop_stmt;
ssa_op_iter ui;
tree vuse;
@@ -112,17 +112,17 @@ phivn_valid_p (struct phiprop_d *phivn, tree name, basic_block bb)
by bb. */
FOR_EACH_SSA_TREE_OPERAND (vuse, vop_stmt, ui, SSA_OP_VUSE)
{
- tree use_stmt;
+ gimple use_stmt;
imm_use_iterator ui2;
bool ok = true;
FOR_EACH_IMM_USE_STMT (use_stmt, ui2, vuse)
{
/* If BB does not dominate a VDEF, the value is invalid. */
- if (((TREE_CODE (use_stmt) == GIMPLE_MODIFY_STMT
+ if (((is_gimple_assign (use_stmt)
&& !ZERO_SSA_OPERANDS (use_stmt, SSA_OP_VDEF))
- || TREE_CODE (use_stmt) == PHI_NODE)
- && !dominated_by_p (CDI_DOMINATORS, bb_for_stmt (use_stmt), bb))
+ || gimple_code (use_stmt) == GIMPLE_PHI)
+ && !dominated_by_p (CDI_DOMINATORS, gimple_bb (use_stmt), bb))
{
ok = false;
BREAK_FROM_IMM_USE_STMT (ui2);
@@ -139,31 +139,36 @@ phivn_valid_p (struct phiprop_d *phivn, tree name, basic_block bb)
BB with the virtual operands from USE_STMT. */
static tree
-phiprop_insert_phi (basic_block bb, tree phi, tree use_stmt,
+phiprop_insert_phi (basic_block bb, gimple phi, gimple use_stmt,
struct phiprop_d *phivn, size_t n)
{
- tree res, new_phi;
+ tree res;
+ gimple new_phi;
edge_iterator ei;
edge e;
+ gcc_assert (is_gimple_assign (use_stmt)
+ && gimple_assign_rhs_code (use_stmt) == INDIRECT_REF);
+
/* Build a new PHI node to replace the definition of
the indirect reference lhs. */
- res = GIMPLE_STMT_OPERAND (use_stmt, 0);
+ res = gimple_assign_lhs (use_stmt);
SSA_NAME_DEF_STMT (res) = new_phi = create_phi_node (res, bb);
/* Add PHI arguments for each edge inserting loads of the
addressable operands. */
FOR_EACH_EDGE (e, ei, bb->preds)
{
- tree old_arg, new_var, tmp;
+ tree old_arg, new_var;
+ gimple tmp;
old_arg = PHI_ARG_DEF_FROM_EDGE (phi, e);
while (TREE_CODE (old_arg) == SSA_NAME
&& (SSA_NAME_VERSION (old_arg) >= n
|| phivn[SSA_NAME_VERSION (old_arg)].value == NULL_TREE))
{
- tree def_stmt = SSA_NAME_DEF_STMT (old_arg);
- old_arg = GIMPLE_STMT_OPERAND (def_stmt, 1);
+ gimple def_stmt = SSA_NAME_DEF_STMT (old_arg);
+ old_arg = gimple_assign_rhs1 (def_stmt);
}
if (TREE_CODE (old_arg) == SSA_NAME)
@@ -171,18 +176,19 @@ phiprop_insert_phi (basic_block bb, tree phi, tree use_stmt,
new_var = phivn[SSA_NAME_VERSION (old_arg)].value;
else
{
+ gcc_assert (TREE_CODE (old_arg) == ADDR_EXPR);
old_arg = TREE_OPERAND (old_arg, 0);
new_var = create_tmp_var (TREE_TYPE (old_arg), NULL);
- tmp = build2 (GIMPLE_MODIFY_STMT, void_type_node,
- NULL_TREE, unshare_expr (old_arg));
+ tmp = gimple_build_assign (new_var, unshare_expr (old_arg));
if (TREE_CODE (TREE_TYPE (old_arg)) == COMPLEX_TYPE
|| TREE_CODE (TREE_TYPE (old_arg)) == VECTOR_TYPE)
DECL_GIMPLE_REG_P (new_var) = 1;
+ gcc_assert (is_gimple_reg (new_var));
add_referenced_var (new_var);
new_var = make_ssa_name (new_var, tmp);
- GIMPLE_STMT_OPERAND (tmp, 0) = new_var;
+ gimple_assign_set_lhs (tmp, new_var);
- bsi_insert_on_edge (e, tmp);
+ gsi_insert_on_edge (e, tmp);
update_stmt (tmp);
mark_symbols_for_renaming (tmp);
@@ -211,11 +217,13 @@ phiprop_insert_phi (basic_block bb, tree phi, tree use_stmt,
with aliasing issues as we are moving memory reads. */
static bool
-propagate_with_phi (basic_block bb, tree phi, struct phiprop_d *phivn, size_t n)
+propagate_with_phi (basic_block bb, gimple phi, struct phiprop_d *phivn,
+ size_t n)
{
tree ptr = PHI_RESULT (phi);
- tree use_stmt, res = NULL_TREE;
- block_stmt_iterator bsi;
+ gimple use_stmt;
+ tree res = NULL_TREE;
+ gimple_stmt_iterator gsi;
imm_use_iterator ui;
use_operand_p arg_p, use;
ssa_op_iter i;
@@ -238,10 +246,10 @@ propagate_with_phi (basic_block bb, tree phi, struct phiprop_d *phivn, size_t n)
&& (SSA_NAME_VERSION (arg) >= n
|| phivn[SSA_NAME_VERSION (arg)].value == NULL_TREE))
{
- tree def_stmt = SSA_NAME_DEF_STMT (arg);
- if (TREE_CODE (def_stmt) != GIMPLE_MODIFY_STMT)
+ gimple def_stmt = SSA_NAME_DEF_STMT (arg);
+ if (gimple_code (def_stmt) != GIMPLE_ASSIGN)
return false;
- arg = GIMPLE_STMT_OPERAND (def_stmt, 1);
+ arg = gimple_assign_rhs1 (def_stmt);
}
if ((TREE_CODE (arg) != ADDR_EXPR
/* Avoid to have to decay *&a to a[0] later. */
@@ -255,10 +263,8 @@ propagate_with_phi (basic_block bb, tree phi, struct phiprop_d *phivn, size_t n)
/* Find a dereferencing use. First follow (single use) ssa
copy chains for ptr. */
while (single_imm_use (ptr, &use, &use_stmt)
- && TREE_CODE (use_stmt) == GIMPLE_MODIFY_STMT
- && GIMPLE_STMT_OPERAND (use_stmt, 1) == ptr
- && TREE_CODE (GIMPLE_STMT_OPERAND (use_stmt, 0)) == SSA_NAME)
- ptr = GIMPLE_STMT_OPERAND (use_stmt, 0);
+ && gimple_assign_ssa_name_copy_p (use_stmt))
+ ptr = gimple_assign_lhs (use_stmt);
/* Replace the first dereference of *ptr if there is one and if we
can move the loads to the place of the ptr phi node. */
@@ -269,23 +275,23 @@ propagate_with_phi (basic_block bb, tree phi, struct phiprop_d *phivn, size_t n)
tree vuse;
/* Check whether this is a load of *ptr. */
- if (!(TREE_CODE (use_stmt) == GIMPLE_MODIFY_STMT
- && TREE_CODE (GIMPLE_STMT_OPERAND (use_stmt, 0)) == SSA_NAME
- && TREE_CODE (GIMPLE_STMT_OPERAND (use_stmt, 1)) == INDIRECT_REF
- && TREE_OPERAND (GIMPLE_STMT_OPERAND (use_stmt, 1), 0) == ptr
+ if (!(is_gimple_assign (use_stmt)
+ && TREE_CODE (gimple_assign_lhs (use_stmt)) == SSA_NAME
+ && gimple_assign_rhs_code (use_stmt) == INDIRECT_REF
+ && TREE_OPERAND (gimple_assign_rhs1 (use_stmt), 0) == ptr
/* We cannot replace a load that may throw or is volatile. */
- && !tree_can_throw_internal (use_stmt)))
+ && !stmt_can_throw_internal (use_stmt)))
continue;
/* Check if we can move the loads. The def stmts of all virtual uses
need to be post-dominated by bb. */
FOR_EACH_SSA_TREE_OPERAND (vuse, use_stmt, ui2, SSA_OP_VUSE)
{
- tree def_stmt = SSA_NAME_DEF_STMT (vuse);
+ gimple def_stmt = SSA_NAME_DEF_STMT (vuse);
if (!SSA_NAME_IS_DEFAULT_DEF (vuse)
- && (bb_for_stmt (def_stmt) == bb
+ && (gimple_bb (def_stmt) == bb
|| !dominated_by_p (CDI_DOMINATORS,
- bb, bb_for_stmt (def_stmt))))
+ bb, gimple_bb (def_stmt))))
goto next;
}
@@ -302,8 +308,8 @@ propagate_with_phi (basic_block bb, tree phi, struct phiprop_d *phivn, size_t n)
/* Remove old stmt. The phi is taken care of by DCE, if we
want to delete it here we also have to delete all intermediate
copies. */
- bsi = bsi_for_stmt (use_stmt);
- bsi_remove (&bsi, 0);
+ gsi = gsi_for_stmt (use_stmt);
+ gsi_remove (&gsi, false);
phi_inserted = true;
}
@@ -311,7 +317,7 @@ propagate_with_phi (basic_block bb, tree phi, struct phiprop_d *phivn, size_t n)
{
/* Further replacements are easy, just make a copy out of the
load. */
- GIMPLE_STMT_OPERAND (use_stmt, 1) = res;
+ gimple_assign_set_rhs1 (use_stmt, res);
update_stmt (use_stmt);
}
@@ -330,10 +336,10 @@ tree_ssa_phiprop_1 (basic_block bb, struct phiprop_d *phivn, size_t n)
{
bool did_something = false;
basic_block son;
- tree phi;
+ gimple_stmt_iterator gsi;
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
- did_something |= propagate_with_phi (bb, phi, phivn, n);
+ for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ did_something |= propagate_with_phi (bb, gsi_stmt (gsi), phivn, n);
for (son = first_dom_son (CDI_DOMINATORS, bb);
son;
@@ -355,7 +361,7 @@ tree_ssa_phiprop (void)
phivn = XCNEWVEC (struct phiprop_d, num_ssa_names);
if (tree_ssa_phiprop_1 (ENTRY_BLOCK_PTR, phivn, num_ssa_names))
- bsi_commit_edge_inserts ();
+ gsi_commit_edge_inserts ();
free (phivn);
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index 07290bc48c4..9e8ff56495e 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -30,7 +30,7 @@ along with GCC; see the file COPYING3. If not see
#include "diagnostic.h"
#include "tree-inline.h"
#include "tree-flow.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "tree-dump.h"
#include "timevar.h"
#include "fibheap.h"
@@ -60,7 +60,7 @@ along with GCC; see the file COPYING3. If not see
*/
/* For ease of terminology, "expression node" in the below refers to
- every expression node but GIMPLE_MODIFY_STMT, because GIMPLE_MODIFY_STMT's
+ every expression node but GIMPLE_ASSIGN, because GIMPLE_ASSIGNs
represent the actual statement containing the expressions we care about,
and we cache the value number by putting it in the expression. */
@@ -193,8 +193,8 @@ pre_expr_eq (const void *p1, const void *p2)
switch (e1->kind)
{
case CONSTANT:
- return expressions_equal_p (PRE_EXPR_CONSTANT (e1),
- PRE_EXPR_CONSTANT (e2));
+ return vn_constant_eq_with_type (PRE_EXPR_CONSTANT (e1),
+ PRE_EXPR_CONSTANT (e2));
case NAME:
return PRE_EXPR_NAME (e1) == PRE_EXPR_NAME (e2);
case NARY:
@@ -214,7 +214,7 @@ pre_expr_hash (const void *p1)
switch (e->kind)
{
case CONSTANT:
- return iterative_hash_expr (PRE_EXPR_CONSTANT (e), 0);
+ return vn_hash_constant_with_type (PRE_EXPR_CONSTANT (e));
case NAME:
return iterative_hash_expr (PRE_EXPR_NAME (e), 0);
case NARY:
@@ -422,7 +422,7 @@ static struct
} pre_stats;
static bool do_partial_partial;
-static pre_expr bitmap_find_leader (bitmap_set_t, unsigned int , tree);
+static pre_expr bitmap_find_leader (bitmap_set_t, unsigned int, gimple);
static void bitmap_value_insert_into_set (bitmap_set_t, pre_expr);
static void bitmap_value_replace_in_set (bitmap_set_t, pre_expr);
static void bitmap_set_copy (bitmap_set_t, bitmap_set_t);
@@ -430,9 +430,10 @@ static bool bitmap_set_contains_value (bitmap_set_t, unsigned int);
static void bitmap_insert_into_set (bitmap_set_t, pre_expr);
static void bitmap_insert_into_set_1 (bitmap_set_t, pre_expr, bool);
static bitmap_set_t bitmap_set_new (void);
-static tree create_expression_by_pieces (basic_block, pre_expr, tree, tree,
- tree);
-static tree find_or_generate_expression (basic_block, pre_expr, tree, tree);
+static tree create_expression_by_pieces (basic_block, pre_expr, gimple_seq *,
+ gimple, tree);
+static tree find_or_generate_expression (basic_block, pre_expr, gimple_seq *,
+ gimple);
/* We can add and remove elements and entries to and from sets
and hash tables, so we use alloc pools for them. */
@@ -593,7 +594,16 @@ get_expr_value_id (pre_expr expr)
switch (expr->kind)
{
case CONSTANT:
- return get_or_alloc_constant_value_id (PRE_EXPR_CONSTANT (expr));
+ {
+ unsigned int id;
+ id = get_constant_value_id (PRE_EXPR_CONSTANT (expr));
+ if (id == 0)
+ {
+ id = get_or_alloc_constant_value_id (PRE_EXPR_CONSTANT (expr));
+ add_to_value (id, expr);
+ }
+ return id;
+ }
case NAME:
return VN_INFO (PRE_EXPR_NAME (expr))->value_id;
case NARY:
@@ -1036,6 +1046,30 @@ get_or_alloc_expr_for (tree t)
return get_or_alloc_expr_for_name (t);
else if (is_gimple_min_invariant (t))
return get_or_alloc_expr_for_constant (t);
+ else
+ {
+ /* More complex expressions can result from SCCVN expression
+ simplification that inserts values for them. As they all
+ do not have VOPs the get handled by the nary ops struct. */
+ vn_nary_op_t result;
+ unsigned int result_id;
+ vn_nary_op_lookup (t, &result);
+ if (result != NULL)
+ {
+ pre_expr e = (pre_expr) pool_alloc (pre_expr_pool);
+ e->kind = NARY;
+ PRE_EXPR_NARY (e) = result;
+ result_id = lookup_expression_id (e);
+ if (result_id != 0)
+ {
+ pool_free (pre_expr_pool, e);
+ e = expression_for_id (result_id);
+ return e;
+ }
+ alloc_expression_id (e);
+ return e;
+ }
+ }
return NULL;
}
@@ -1060,13 +1094,24 @@ fully_constant_expression (pre_expr e)
constants. */
tree naryop0 = nary->op[0];
tree naryop1 = nary->op[1];
- pre_expr rep0 = get_or_alloc_expr_for (naryop0);
- pre_expr rep1 = get_or_alloc_expr_for (naryop1);
- unsigned int vrep0 = get_expr_value_id (rep0);
- unsigned int vrep1 = get_expr_value_id (rep1);
- tree const0 = get_constant_for_value_id (vrep0);
- tree const1 = get_constant_for_value_id (vrep1);
- tree result = NULL;
+ tree const0, const1, result;
+ if (is_gimple_min_invariant (naryop0))
+ const0 = naryop0;
+ else
+ {
+ pre_expr rep0 = get_or_alloc_expr_for (naryop0);
+ unsigned int vrep0 = get_expr_value_id (rep0);
+ const0 = get_constant_for_value_id (vrep0);
+ }
+ if (is_gimple_min_invariant (naryop1))
+ const1 = naryop1;
+ else
+ {
+ pre_expr rep1 = get_or_alloc_expr_for (naryop1);
+ unsigned int vrep1 = get_expr_value_id (rep1);
+ const1 = get_constant_for_value_id (vrep1);
+ }
+ result = NULL;
if (const0 && const1)
{
tree type1 = TREE_TYPE (nary->op[0]);
@@ -1085,10 +1130,16 @@ fully_constant_expression (pre_expr e)
/* We have to go from trees to pre exprs to value ids to
constants. */
tree naryop0 = nary->op[0];
- pre_expr rep0 = get_or_alloc_expr_for (naryop0);
- unsigned int vrep0 = get_expr_value_id (rep0);
- tree const0 = get_constant_for_value_id (vrep0);
- tree result = NULL;
+ tree const0, result;
+ if (is_gimple_min_invariant (naryop0))
+ const0 = naryop0;
+ else
+ {
+ pre_expr rep0 = get_or_alloc_expr_for (naryop0);
+ unsigned int vrep0 = get_expr_value_id (rep0);
+ const0 = get_constant_for_value_id (vrep0);
+ }
+ result = NULL;
if (const0)
{
tree type1 = TREE_TYPE (nary->op[0]);
@@ -1125,11 +1176,11 @@ translate_vuses_through_block (VEC (tree, gc) *vuses,
for (i = 0; VEC_iterate (tree, vuses, i, oldvuse); i++)
{
- tree phi = SSA_NAME_DEF_STMT (oldvuse);
- if (TREE_CODE (phi) == PHI_NODE
- && bb_for_stmt (phi) == phiblock)
+ gimple phi = SSA_NAME_DEF_STMT (oldvuse);
+ if (gimple_code (phi) == GIMPLE_PHI
+ && gimple_bb (phi) == phiblock)
{
- edge e = find_edge (block, bb_for_stmt (phi));
+ edge e = find_edge (block, gimple_bb (phi));
if (e)
{
tree def = PHI_ARG_DEF (phi, e->dest_idx);
@@ -1163,9 +1214,9 @@ find_leader_in_sets (unsigned int val, bitmap_set_t set1, bitmap_set_t set2)
{
pre_expr result;
- result = bitmap_find_leader (set1, val, NULL_TREE);
+ result = bitmap_find_leader (set1, val, NULL);
if (!result && set2)
- result = bitmap_find_leader (set2, val, NULL_TREE);
+ result = bitmap_find_leader (set2, val, NULL);
return result;
}
@@ -1224,6 +1275,7 @@ get_representative_for (const pre_expr e)
case NAME:
return PRE_EXPR_NAME (e);
case CONSTANT:
+ return PRE_EXPR_CONSTANT (e);
case NARY:
case REFERENCE:
{
@@ -1264,7 +1316,7 @@ get_representative_for (const pre_expr e)
get_var_ann (pretemp);
}
- name = make_ssa_name (pretemp, build_empty_stmt ());
+ name = make_ssa_name (pretemp, gimple_build_nop ());
VN_INFO_GET (name)->value_id = value_id;
if (e->kind == CONSTANT)
VN_INFO (name)->valnum = PRE_EXPR_CONSTANT (e);
@@ -1552,19 +1604,19 @@ phi_translate_1 (pre_expr expr, bitmap_set_t set1, bitmap_set_t set2,
break;
case NAME:
{
- tree phi = NULL;
+ gimple phi = NULL;
edge e;
- tree def_stmt;
+ gimple def_stmt;
tree name = PRE_EXPR_NAME (expr);
def_stmt = SSA_NAME_DEF_STMT (name);
- if (TREE_CODE (def_stmt) == PHI_NODE
- && bb_for_stmt (def_stmt) == phiblock)
+ if (gimple_code (def_stmt) == GIMPLE_PHI
+ && gimple_bb (def_stmt) == phiblock)
phi = def_stmt;
else
return expr;
- e = find_edge (pred, bb_for_stmt (phi));
+ e = find_edge (pred, gimple_bb (phi));
if (e)
{
tree def = PHI_ARG_DEF (phi, e->dest_idx);
@@ -1643,7 +1695,7 @@ phi_translate_set (bitmap_set_t dest, bitmap_set_t set, basic_block pred,
Return NULL if no leader is found. */
static pre_expr
-bitmap_find_leader (bitmap_set_t set, unsigned int val, tree stmt)
+bitmap_find_leader (bitmap_set_t set, unsigned int val, gimple stmt)
{
if (value_id_constant_p (val))
{
@@ -1683,10 +1735,10 @@ bitmap_find_leader (bitmap_set_t set, unsigned int val, tree stmt)
be an SSA_NAME first in the list of expressions. */
if (stmt)
{
- tree def_stmt = SSA_NAME_DEF_STMT (PRE_EXPR_NAME (val));
- if (TREE_CODE (def_stmt) != PHI_NODE
- && bb_for_stmt (def_stmt) == bb_for_stmt (stmt)
- && stmt_ann (def_stmt)->uid >= stmt_ann (stmt)->uid)
+ gimple def_stmt = SSA_NAME_DEF_STMT (PRE_EXPR_NAME (val));
+ if (gimple_code (def_stmt) != GIMPLE_PHI
+ && gimple_bb (def_stmt) == gimple_bb (stmt)
+ && gimple_uid (def_stmt) >= gimple_uid (stmt))
continue;
}
return val;
@@ -1714,11 +1766,11 @@ value_dies_in_block_x (pre_expr expr, basic_block block)
rather than stores. */
for (i = 0; VEC_iterate (tree, vuses, i, vuse); i++)
{
- tree def = SSA_NAME_DEF_STMT (vuse);
+ gimple def = SSA_NAME_DEF_STMT (vuse);
- if (bb_for_stmt (def) != block)
+ if (gimple_bb (def) != block)
continue;
- if (TREE_CODE (def) == PHI_NODE)
+ if (gimple_code (def) == GIMPLE_PHI)
continue;
return true;
}
@@ -2323,11 +2375,9 @@ compute_antic (void)
if we have a pure or constant call. */
static bool
-can_value_number_call (tree stmt)
+can_value_number_call (gimple stmt)
{
- tree call = get_call_expr_in (stmt);
-
- if (call_expr_flags (call) & (ECF_PURE | ECF_CONST))
+ if (gimple_call_flags (stmt) & (ECF_PURE | ECF_CONST))
return true;
return false;
}
@@ -2336,9 +2386,11 @@ can_value_number_call (tree stmt)
FILTER_EXPR or EXC_PTR_EXPR. */
static bool
-is_exception_related (tree op)
+is_exception_related (gimple stmt)
{
- return TREE_CODE (op) == FILTER_EXPR || TREE_CODE (op) == EXC_PTR_EXPR;
+ return (is_gimple_assign (stmt)
+ && (gimple_assign_rhs_code (stmt) == FILTER_EXPR
+ || gimple_assign_rhs_code (stmt) == EXC_PTR_EXPR));
}
/* Return true if OP is a tree which we can perform PRE on
@@ -2362,67 +2414,71 @@ can_PRE_operation (tree op)
/* Inserted expressions are placed onto this worklist, which is used
for performing quick dead code elimination of insertions we made
that didn't turn out to be necessary. */
-static VEC(tree,heap) *inserted_exprs;
+static VEC(gimple,heap) *inserted_exprs;
/* Pool allocated fake store expressions are placed onto this
worklist, which, after performing dead code elimination, is walked
to see which expressions need to be put into GC'able memory */
-static VEC(tree, heap) *need_creation;
+static VEC(gimple, heap) *need_creation;
-/* For COMPONENT_REF's and ARRAY_REF's, we can't have any intermediates for the
- COMPONENT_REF or INDIRECT_REF or ARRAY_REF portion, because we'd end up with
- trying to rename aggregates into ssa form directly, which is a no
- no.
-
- Thus, this routine doesn't create temporaries, it just builds a
- single access expression for the array, calling
- find_or_generate_expression to build the innermost pieces.
+/* The actual worker for create_component_ref_by_pieces. */
- This function is a subroutine of create_expression_by_pieces, and
- should not be called on it's own unless you really know what you
- are doing.
-*/
static tree
-create_component_ref_by_pieces (basic_block block, vn_reference_t ref,
- unsigned int operand,
- tree stmts,
- tree domstmt,
- bool in_call)
+create_component_ref_by_pieces_1 (basic_block block, vn_reference_t ref,
+ unsigned int *operand, gimple_seq *stmts,
+ gimple domstmt)
{
vn_reference_op_t currop = VEC_index (vn_reference_op_s, ref->operands,
- operand);
+ *operand);
tree genop;
+ ++*operand;
switch (currop->opcode)
{
case CALL_EXPR:
{
- tree folded;
- unsigned int i;
- vn_reference_op_t declop = VEC_index (vn_reference_op_s,
- ref->operands, 1);
- unsigned int nargs = VEC_length (vn_reference_op_s, ref->operands) - 2;
- tree *args = XNEWVEC (tree, nargs);
-
- for (i = 0; i < nargs; i++)
+ tree folded, sc = currop->op1;
+ unsigned int nargs = 0;
+ tree *args = XNEWVEC (tree, VEC_length (vn_reference_op_s,
+ ref->operands) - 1);
+ while (*operand < VEC_length (vn_reference_op_s, ref->operands))
{
- args[i] = create_component_ref_by_pieces (block, ref,
- operand + 2 + i, stmts,
- domstmt, true);
+ args[nargs] = create_component_ref_by_pieces_1 (block, ref,
+ operand, stmts,
+ domstmt);
+ nargs++;
}
- folded = build_call_array (currop->type, declop->op0, nargs, args);
+ folded = build_call_array (currop->type,
+ TREE_CODE (currop->op0) == FUNCTION_DECL
+ ? build_fold_addr_expr (currop->op0)
+ : currop->op0,
+ nargs, args);
free (args);
+ if (sc)
+ {
+ pre_expr scexpr = get_or_alloc_expr_for (sc);
+ sc = find_or_generate_expression (block, scexpr, stmts, domstmt);
+ if (!sc)
+ return NULL_TREE;
+ CALL_EXPR_STATIC_CHAIN (folded) = sc;
+ }
return folded;
}
break;
+ case ADDR_EXPR:
+ if (currop->op0)
+ {
+ gcc_assert (is_gimple_min_invariant (currop->op0));
+ return currop->op0;
+ }
+ /* Fallthrough. */
case REALPART_EXPR:
case IMAGPART_EXPR:
case VIEW_CONVERT_EXPR:
{
tree folded;
- tree genop0 = create_component_ref_by_pieces (block, ref,
- operand + 1,
- stmts, domstmt,
- in_call);
+ tree genop0 = create_component_ref_by_pieces_1 (block, ref,
+ operand,
+ stmts, domstmt);
if (!genop0)
return NULL_TREE;
folded = fold_build1 (currop->opcode, currop->type,
@@ -2434,45 +2490,25 @@ create_component_ref_by_pieces (basic_block block, vn_reference_t ref,
case MISALIGNED_INDIRECT_REF:
case INDIRECT_REF:
{
- /* Inside a CALL_EXPR op0 is the actual indirect_ref. */
- if (in_call)
- {
- tree folded;
- tree op0 = TREE_OPERAND (currop->op0, 0);
- pre_expr op0expr = get_or_alloc_expr_for (op0);
- tree genop0 = find_or_generate_expression (block, op0expr, stmts,
- domstmt);
- if (!genop0)
- return NULL_TREE;
- folded = fold_build1 (currop->opcode, currop->type,
- genop0);
- return folded;
- }
- else
- {
-
- tree folded;
- tree genop1 = create_component_ref_by_pieces (block, ref,
- operand + 1,
- stmts, domstmt,
- in_call);
- if (!genop1)
- return NULL_TREE;
- genop1 = fold_convert (build_pointer_type (currop->type),
- genop1);
+ tree folded;
+ tree genop1 = create_component_ref_by_pieces_1 (block, ref,
+ operand,
+ stmts, domstmt);
+ if (!genop1)
+ return NULL_TREE;
+ genop1 = fold_convert (build_pointer_type (currop->type),
+ genop1);
- folded = fold_build1 (currop->opcode, currop->type,
- genop1);
- return folded;
- }
+ folded = fold_build1 (currop->opcode, currop->type,
+ genop1);
+ return folded;
}
break;
case BIT_FIELD_REF:
{
tree folded;
- tree genop0 = create_component_ref_by_pieces (block, ref, operand + 1,
- stmts, domstmt,
- in_call);
+ tree genop0 = create_component_ref_by_pieces_1 (block, ref, operand,
+ stmts, domstmt);
pre_expr op1expr = get_or_alloc_expr_for (currop->op0);
pre_expr op2expr = get_or_alloc_expr_for (currop->op1);
tree genop1;
@@ -2497,17 +2533,14 @@ create_component_ref_by_pieces (basic_block block, vn_reference_t ref,
case ARRAY_RANGE_REF:
case ARRAY_REF:
{
- vn_reference_op_t op0expr;
tree genop0;
tree genop1 = currop->op0;
pre_expr op1expr;
tree genop2 = currop->op1;
pre_expr op2expr;
tree genop3;
- op0expr = VEC_index (vn_reference_op_s, ref->operands, operand + 1);
- genop0 = create_component_ref_by_pieces (block, ref, operand + 1,
- stmts, domstmt,
- in_call);
+ genop0 = create_component_ref_by_pieces_1 (block, ref, operand,
+ stmts, domstmt);
if (!genop0)
return NULL_TREE;
op1expr = get_or_alloc_expr_for (genop1);
@@ -2533,8 +2566,8 @@ create_component_ref_by_pieces (basic_block block, vn_reference_t ref,
tree op1;
tree genop2 = currop->op1;
pre_expr op2expr;
- op0 = create_component_ref_by_pieces (block, ref, operand + 1,
- stmts, domstmt, in_call);
+ op0 = create_component_ref_by_pieces_1 (block, ref, operand,
+ stmts, domstmt);
if (!op0)
return NULL_TREE;
/* op1 should be a FIELD_DECL, which are represented by
@@ -2570,11 +2603,6 @@ create_component_ref_by_pieces (basic_block block, vn_reference_t ref,
case CONST_DECL:
case RESULT_DECL:
case FUNCTION_DECL:
- /* For ADDR_EXPR in a CALL_EXPR, op0 is actually the entire
- ADDR_EXPR, not just it's operand. */
- case ADDR_EXPR:
- if (currop->opcode == ADDR_EXPR)
- gcc_assert (currop->op0 != NULL);
return currop->op0;
default:
@@ -2582,6 +2610,26 @@ create_component_ref_by_pieces (basic_block block, vn_reference_t ref,
}
}
+/* For COMPONENT_REF's and ARRAY_REF's, we can't have any intermediates for the
+ COMPONENT_REF or INDIRECT_REF or ARRAY_REF portion, because we'd end up with
+ trying to rename aggregates into ssa form directly, which is a no no.
+
+ Thus, this routine doesn't create temporaries, it just builds a
+ single access expression for the array, calling
+ find_or_generate_expression to build the innermost pieces.
+
+ This function is a subroutine of create_expression_by_pieces, and
+ should not be called on it's own unless you really know what you
+ are doing. */
+
+static tree
+create_component_ref_by_pieces (basic_block block, vn_reference_t ref,
+ gimple_seq *stmts, gimple domstmt)
+{
+ unsigned int op = 0;
+ return create_component_ref_by_pieces_1 (block, ref, &op, stmts, domstmt);
+}
+
/* Find a leader for an expression, or generate one using
create_expression_by_pieces if it's ANTIC but
complex.
@@ -2596,8 +2644,8 @@ create_component_ref_by_pieces (basic_block block, vn_reference_t ref,
on failure. */
static tree
-find_or_generate_expression (basic_block block, pre_expr expr, tree stmts,
- tree domstmt)
+find_or_generate_expression (basic_block block, pre_expr expr,
+ gimple_seq *stmts, gimple domstmt)
{
pre_expr leader = bitmap_find_leader (AVAIL_OUT (block),
get_expr_value_id (expr), domstmt);
@@ -2641,7 +2689,7 @@ find_or_generate_expression (basic_block block, pre_expr expr, tree stmts,
return genop;
}
-#define NECESSARY(stmt) stmt->base.asm_written_flag
+#define NECESSARY GF_PLF_1
/* Create an expression in pieces, so that we can handle very complex
expressions that may be ANTIC, but not necessary GIMPLE.
@@ -2662,16 +2710,17 @@ find_or_generate_expression (basic_block block, pre_expr expr, tree stmts,
can return NULL_TREE to signal failure. */
static tree
-create_expression_by_pieces (basic_block block, pre_expr expr, tree stmts,
- tree domstmt,
- tree type)
+create_expression_by_pieces (basic_block block, pre_expr expr,
+ gimple_seq *stmts, gimple domstmt, tree type)
{
tree temp, name;
- tree folded, forced_stmts, newexpr;
+ tree folded, newexpr;
+ gimple_seq forced_stmts;
unsigned int value_id;
- tree_stmt_iterator tsi;
+ gimple_stmt_iterator gsi;
tree exprtype = type ? type : get_expr_type (expr);
pre_expr nameexpr;
+ gimple newstmt;
switch (expr->kind)
{
@@ -2686,8 +2735,7 @@ create_expression_by_pieces (basic_block block, pre_expr expr, tree stmts,
case REFERENCE:
{
vn_reference_t ref = PRE_EXPR_REFERENCE (expr);
- folded = create_component_ref_by_pieces (block, ref, 0, stmts,
- domstmt, false);
+ folded = create_component_ref_by_pieces (block, ref, stmts, domstmt);
}
break;
case NARY:
@@ -2751,14 +2799,14 @@ create_expression_by_pieces (basic_block block, pre_expr expr, tree stmts,
to the value sets and chain them in the instruction stream. */
if (forced_stmts)
{
- tsi = tsi_start (forced_stmts);
- for (; !tsi_end_p (tsi); tsi_next (&tsi))
+ gsi = gsi_start (forced_stmts);
+ for (; !gsi_end_p (gsi); gsi_next (&gsi))
{
- tree stmt = tsi_stmt (tsi);
- tree forcedname = GIMPLE_STMT_OPERAND (stmt, 0);
+ gimple stmt = gsi_stmt (gsi);
+ tree forcedname = gimple_get_lhs (stmt);
pre_expr nameexpr;
- VEC_safe_push (tree, heap, inserted_exprs, stmt);
+ VEC_safe_push (gimple, heap, inserted_exprs, stmt);
if (TREE_CODE (forcedname) == SSA_NAME)
{
VN_INFO_GET (forcedname)->valnum = forcedname;
@@ -2770,8 +2818,7 @@ create_expression_by_pieces (basic_block block, pre_expr expr, tree stmts,
}
mark_symbols_for_renaming (stmt);
}
- tsi = tsi_last (stmts);
- tsi_link_after (&tsi, forced_stmts, TSI_CONTINUE_LINKING);
+ gimple_seq_add_seq (stmts, forced_stmts);
}
/* Build and insert the assignment of the end result to the temporary
@@ -2789,17 +2836,16 @@ create_expression_by_pieces (basic_block block, pre_expr expr, tree stmts,
|| TREE_CODE (exprtype) == VECTOR_TYPE)
DECL_GIMPLE_REG_P (temp) = 1;
- newexpr = build_gimple_modify_stmt (temp, newexpr);
- name = make_ssa_name (temp, newexpr);
- GIMPLE_STMT_OPERAND (newexpr, 0) = name;
- NECESSARY (newexpr) = 0;
+ newstmt = gimple_build_assign (temp, newexpr);
+ name = make_ssa_name (temp, newstmt);
+ gimple_assign_set_lhs (newstmt, name);
+ gimple_set_plf (newstmt, NECESSARY, false);
- tsi = tsi_last (stmts);
- tsi_link_after (&tsi, newexpr, TSI_CONTINUE_LINKING);
- VEC_safe_push (tree, heap, inserted_exprs, newexpr);
+ gimple_seq_add_stmt (stmts, newstmt);
+ VEC_safe_push (gimple, heap, inserted_exprs, newstmt);
/* All the symbols in NEWEXPR should be put into SSA form. */
- mark_symbols_for_renaming (newexpr);
+ mark_symbols_for_renaming (newstmt);
/* Add a value number to the temporary.
The value may already exist in either NEW_SETS, or AVAIL_OUT, because
@@ -2819,7 +2865,7 @@ create_expression_by_pieces (basic_block block, pre_expr expr, tree stmts,
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Inserted ");
- print_generic_expr (dump_file, newexpr, 0);
+ print_gimple_stmt (dump_file, newstmt, 0, 0);
fprintf (dump_file, " in predecessor %d\n", block->index);
}
@@ -2847,6 +2893,7 @@ insert_into_preds_of_block (basic_block block, unsigned int exprnum,
edge_iterator ei;
tree type = get_expr_type (expr);
tree temp;
+ gimple phi;
if (dump_file && (dump_flags & TDF_DETAILS))
{
@@ -2878,7 +2925,7 @@ insert_into_preds_of_block (basic_block block, unsigned int exprnum,
/* Make the necessary insertions. */
FOR_EACH_EDGE (pred, ei, block->preds)
{
- tree stmts = alloc_stmt_list ();
+ gimple_seq stmts = NULL;
tree builtexpr;
bprime = pred->src;
eprime = avail[bprime->index];
@@ -2887,10 +2934,10 @@ insert_into_preds_of_block (basic_block block, unsigned int exprnum,
{
builtexpr = create_expression_by_pieces (bprime,
eprime,
- stmts, NULL_TREE,
+ &stmts, NULL,
type);
gcc_assert (!(pred->flags & EDGE_ABNORMAL));
- bsi_insert_on_edge (pred, stmts);
+ gsi_insert_seq_on_edge (pred, stmts);
avail[bprime->index] = get_or_alloc_expr_for_name (builtexpr);
insertions = true;
}
@@ -2925,18 +2972,16 @@ insert_into_preds_of_block (basic_block block, unsigned int exprnum,
}
if (stmts)
{
- tree_stmt_iterator tsi;
- tsi = tsi_start (stmts);
- for (; !tsi_end_p (tsi); tsi_next (&tsi))
+ gimple_stmt_iterator gsi;
+ gsi = gsi_start (stmts);
+ for (; !gsi_end_p (gsi); gsi_next (&gsi))
{
- tree stmt = tsi_stmt (tsi);
- tree lhs = GIMPLE_STMT_OPERAND (stmt, 0);
- VEC_safe_push (tree, heap, inserted_exprs, stmt);
- NECESSARY (lhs) = 0;
+ gimple stmt = gsi_stmt (gsi);
+ VEC_safe_push (gimple, heap, inserted_exprs, stmt);
+ gimple_set_plf (stmt, NECESSARY, false);
}
- bsi_insert_on_edge (pred, stmts);
+ gsi_insert_seq_on_edge (pred, stmts);
}
- NECESSARY (forcedexpr) = 0;
avail[bprime->index] = get_or_alloc_expr_for_name (forcedexpr);
}
}
@@ -2966,18 +3011,16 @@ insert_into_preds_of_block (basic_block block, unsigned int exprnum,
if (stmts)
{
- tree_stmt_iterator tsi;
- tsi = tsi_start (stmts);
- for (; !tsi_end_p (tsi); tsi_next (&tsi))
+ gimple_stmt_iterator gsi;
+ gsi = gsi_start (stmts);
+ for (; !gsi_end_p (gsi); gsi_next (&gsi))
{
- tree stmt = tsi_stmt (tsi);
- tree lhs = GIMPLE_STMT_OPERAND (stmt, 0);
- VEC_safe_push (tree, heap, inserted_exprs, stmt);
- NECESSARY (lhs) = 0;
+ gimple stmt = gsi_stmt (gsi);
+ VEC_safe_push (gimple, heap, inserted_exprs, stmt);
+ gimple_set_plf (stmt, NECESSARY, false);
}
- bsi_insert_on_edge (pred, stmts);
+ gsi_insert_seq_on_edge (pred, stmts);
}
- NECESSARY (forcedexpr) = 0;
avail[bprime->index] = get_or_alloc_expr_for_name (forcedexpr);
}
}
@@ -3004,24 +3047,24 @@ insert_into_preds_of_block (basic_block block, unsigned int exprnum,
if (TREE_CODE (type) == COMPLEX_TYPE
|| TREE_CODE (type) == VECTOR_TYPE)
DECL_GIMPLE_REG_P (temp) = 1;
- temp = create_phi_node (temp, block);
+ phi = create_phi_node (temp, block);
- NECESSARY (temp) = 0;
- VN_INFO_GET (PHI_RESULT (temp))->valnum = PHI_RESULT (temp);
- VN_INFO (PHI_RESULT (temp))->value_id = val;
- VEC_safe_push (tree, heap, inserted_exprs, temp);
+ gimple_set_plf (phi, NECESSARY, false);
+ VN_INFO_GET (gimple_phi_result (phi))->valnum = gimple_phi_result (phi);
+ VN_INFO (gimple_phi_result (phi))->value_id = val;
+ VEC_safe_push (gimple, heap, inserted_exprs, phi);
FOR_EACH_EDGE (pred, ei, block->preds)
{
pre_expr ae = avail[pred->src->index];
gcc_assert (get_expr_type (ae) == type
|| useless_type_conversion_p (type, get_expr_type (ae)));
if (ae->kind == CONSTANT)
- add_phi_arg (temp, PRE_EXPR_CONSTANT (ae), pred);
+ add_phi_arg (phi, PRE_EXPR_CONSTANT (ae), pred);
else
- add_phi_arg (temp, PRE_EXPR_NAME (avail[pred->src->index]), pred);
+ add_phi_arg (phi, PRE_EXPR_NAME (avail[pred->src->index]), pred);
}
- newphi = get_or_alloc_expr_for_name (PHI_RESULT (temp));
+ newphi = get_or_alloc_expr_for_name (gimple_phi_result (phi));
add_to_value (val, newphi);
/* The value should *not* exist in PHI_GEN, or else we wouldn't be doing
@@ -3047,7 +3090,7 @@ insert_into_preds_of_block (basic_block block, unsigned int exprnum,
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Created phi ");
- print_generic_expr (dump_file, temp, 0);
+ print_gimple_stmt (dump_file, phi, 0, 0);
fprintf (dump_file, " in block %d\n", block->index);
}
pre_stats.phis++;
@@ -3143,7 +3186,7 @@ do_regular_insertion (basic_block block, basic_block dom)
eprime = fully_constant_expression (eprime);
vprime = get_expr_value_id (eprime);
edoubleprime = bitmap_find_leader (AVAIL_OUT (bprime),
- vprime, NULL_TREE);
+ vprime, NULL);
if (edoubleprime == NULL)
{
avail[bprime->index] = eprime;
@@ -3277,7 +3320,7 @@ do_partial_partial_insertion (basic_block block, basic_block dom)
eprime = fully_constant_expression (eprime);
vprime = get_expr_value_id (eprime);
edoubleprime = bitmap_find_leader (AVAIL_OUT (bprime),
- vprime, NULL_TREE);
+ vprime, NULL);
if (edoubleprime == NULL)
{
by_all = false;
@@ -3391,128 +3434,18 @@ add_to_exp_gen (basic_block block, tree op)
result = get_or_alloc_expr_for_name (op);
bitmap_value_insert_into_set (EXP_GEN (block), result);
if (TREE_CODE (op) != SSA_NAME
- || TREE_CODE (SSA_NAME_DEF_STMT (op)) != PHI_NODE)
+ || gimple_code (SSA_NAME_DEF_STMT (op)) != GIMPLE_PHI)
bitmap_value_insert_into_set (maximal_set, result);
}
}
-/* For each real store operation of the form
- *a = <value> that we see, create a corresponding fake store of the
- form storetmp_<version> = *a.
-
- This enables AVAIL computation to mark the results of stores as
- available. Without this, you'd need to do some computation to
- mark the result of stores as ANTIC and AVAIL at all the right
- points.
- To save memory, we keep the store
- statements pool allocated until we decide whether they are
- necessary or not. */
-
-static void
-insert_fake_stores (void)
-{
- basic_block block;
-
- FOR_ALL_BB (block)
- {
- block_stmt_iterator bsi;
- for (bsi = bsi_start (block); !bsi_end_p (bsi); bsi_next (&bsi))
- {
- tree stmt = bsi_stmt (bsi);
-
- /* We can't generate SSA names for stores that are complex
- or aggregate. We also want to ignore things whose
- virtual uses occur in abnormal phis. */
-
- if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
- && (TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 0)) == INDIRECT_REF
- || handled_component_p (GIMPLE_STMT_OPERAND (stmt, 0)))
- && !AGGREGATE_TYPE_P (TREE_TYPE (GIMPLE_STMT_OPERAND (stmt, 0))))
- {
- ssa_op_iter iter;
- def_operand_p defp;
- tree lhs = GIMPLE_STMT_OPERAND (stmt, 0);
- tree rhs = GIMPLE_STMT_OPERAND (stmt, 1);
- tree new_tree, new_lhs;
- bool notokay = false;
-
- FOR_EACH_SSA_DEF_OPERAND (defp, stmt, iter, SSA_OP_VIRTUAL_DEFS)
- {
- tree defvar = DEF_FROM_PTR (defp);
- if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (defvar))
- {
- notokay = true;
- break;
- }
- }
-
- if (notokay)
- continue;
-
- if (!storetemp || TREE_TYPE (rhs) != TREE_TYPE (storetemp))
- {
- storetemp = create_tmp_var (TREE_TYPE (rhs), "storetmp");
- if (TREE_CODE (TREE_TYPE (storetemp)) == VECTOR_TYPE
- || TREE_CODE (TREE_TYPE (storetemp)) == COMPLEX_TYPE)
- DECL_GIMPLE_REG_P (storetemp) = 1;
- get_var_ann (storetemp);
- }
-
- new_tree = build_gimple_modify_stmt (NULL_TREE, lhs);
- new_lhs = make_ssa_name (storetemp, new_tree);
- GIMPLE_STMT_OPERAND (new_tree, 0) = new_lhs;
- create_ssa_artificial_load_stmt (new_tree, stmt, false);
-
- NECESSARY (new_tree) = 0;
- VEC_safe_push (tree, heap, inserted_exprs, new_tree);
- VEC_safe_push (tree, heap, need_creation, new_tree);
- bsi_insert_after (&bsi, new_tree, BSI_NEW_STMT);
- }
- }
- }
-}
-
-/* Turn the pool allocated fake stores that we created back into real
- GC allocated ones if they turned out to be necessary to PRE some
- expressions. */
-
-static void
-realify_fake_stores (void)
-{
- unsigned int i;
- tree stmt;
-
- for (i = 0; VEC_iterate (tree, need_creation, i, stmt); i++)
- {
- if (NECESSARY (stmt))
- {
- block_stmt_iterator bsi, bsi2;
- tree rhs;
-
- /* Mark the temp variable as referenced */
- add_referenced_var (SSA_NAME_VAR (GIMPLE_STMT_OPERAND (stmt, 0)));
-
- /* Put the statement before the store in the IR stream
- as a plain ssa name copy. */
- bsi = bsi_for_stmt (stmt);
- bsi_prev (&bsi);
- rhs = GIMPLE_STMT_OPERAND (bsi_stmt (bsi), 1);
- GIMPLE_STMT_OPERAND (stmt, 1) = rhs;
- bsi2 = bsi_for_stmt (stmt);
- bsi_remove (&bsi2, true);
- bsi_insert_before (&bsi, stmt, BSI_SAME_STMT);
- }
- else
- release_defs (stmt);
- }
-}
-
/* Create value ids for PHI in BLOCK. */
static void
-make_values_for_phi (tree phi, basic_block block)
+make_values_for_phi (gimple phi, basic_block block)
{
- tree result = PHI_RESULT (phi);
+ tree result = gimple_phi_result (phi);
+
/* We have no need for virtual phis, as they don't represent
actual computations. */
if (is_gimple_reg (result))
@@ -3596,8 +3529,8 @@ compute_avail (void)
/* Loop until the worklist is empty. */
while (sp)
{
- block_stmt_iterator bsi;
- tree stmt, phi;
+ gimple_stmt_iterator gsi;
+ gimple stmt;
basic_block dom;
unsigned int stmt_uid = 1;
@@ -3611,21 +3544,18 @@ compute_avail (void)
bitmap_set_copy (AVAIL_OUT (block), AVAIL_OUT (dom));
/* Generate values for PHI nodes. */
- for (phi = phi_nodes (block); phi; phi = PHI_CHAIN (phi))
- make_values_for_phi (phi, block);
+ for (gsi = gsi_start_phis (block); !gsi_end_p (gsi); gsi_next (&gsi))
+ make_values_for_phi (gsi_stmt (gsi), block);
/* Now compute value numbers and populate value sets with all
the expressions computed in BLOCK. */
- for (bsi = bsi_start (block); !bsi_end_p (bsi); bsi_next (&bsi))
+ for (gsi = gsi_start_bb (block); !gsi_end_p (gsi); gsi_next (&gsi))
{
- stmt_ann_t ann;
ssa_op_iter iter;
tree op;
- stmt = bsi_stmt (bsi);
- ann = stmt_ann (stmt);
-
- set_gimple_stmt_uid (stmt, stmt_uid++);
+ stmt = gsi_stmt (gsi);
+ gimple_set_uid (stmt, stmt_uid++);
FOR_EACH_SSA_TREE_OPERAND (op, stmt, iter, SSA_OP_DEF)
{
@@ -3640,106 +3570,151 @@ compute_avail (void)
bitmap_value_insert_into_set (AVAIL_OUT (block), e);
}
- switch (TREE_CODE (stmt))
+ if (gimple_has_volatile_ops (stmt)
+ || stmt_could_throw_p (stmt))
+ continue;
+
+ switch (gimple_code (stmt))
{
- case RETURN_EXPR:
- if (!ann->has_volatile_ops)
- FOR_EACH_SSA_TREE_OPERAND (op, stmt, iter, SSA_OP_USE)
- add_to_exp_gen (block, op);
+ case GIMPLE_RETURN:
+ FOR_EACH_SSA_TREE_OPERAND (op, stmt, iter, SSA_OP_USE)
+ add_to_exp_gen (block, op);
continue;
- case GIMPLE_MODIFY_STMT:
+
+ case GIMPLE_CALL:
{
- tree rhs = GIMPLE_STMT_OPERAND (stmt, 1);
- if (!ann->has_volatile_ops
- && !tree_could_throw_p (stmt))
- {
- pre_expr result = NULL;
- switch (TREE_CODE_CLASS (TREE_CODE (rhs)))
- {
- case tcc_unary:
- if (is_exception_related (rhs))
- continue;
- case tcc_binary:
- {
- vn_nary_op_t nary;
- unsigned int i;
+ vn_reference_t ref;
+ unsigned int i;
+ vn_reference_op_t vro;
+ pre_expr result = NULL;
+ VEC(vn_reference_op_s, heap) *ops = NULL;
- vn_nary_op_lookup (rhs, &nary);
+ if (!can_value_number_call (stmt))
+ continue;
- if (!nary)
- continue;
+ copy_reference_ops_from_call (stmt, &ops);
+ vn_reference_lookup_pieces (shared_vuses_from_stmt (stmt),
+ ops, &ref);
+ VEC_free (vn_reference_op_s, heap, ops);
+ if (!ref)
+ continue;
- for (i = 0; i < nary->length; i++)
- if (TREE_CODE (nary->op[i]) == SSA_NAME)
- add_to_exp_gen (block, nary->op[i]);
+ for (i = 0; VEC_iterate (vn_reference_op_s,
+ ref->operands, i,
+ vro); i++)
+ {
+ if (vro->op0 && TREE_CODE (vro->op0) == SSA_NAME)
+ add_to_exp_gen (block, vro->op0);
+ if (vro->op1 && TREE_CODE (vro->op1) == SSA_NAME)
+ add_to_exp_gen (block, vro->op1);
+ if (vro->op2 && TREE_CODE (vro->op2) == SSA_NAME)
+ add_to_exp_gen (block, vro->op2);
+ }
+ result = (pre_expr) pool_alloc (pre_expr_pool);
+ result->kind = REFERENCE;
+ result->id = 0;
+ PRE_EXPR_REFERENCE (result) = ref;
+
+ get_or_alloc_expression_id (result);
+ add_to_value (get_expr_value_id (result), result);
+ if (!in_fre)
+ {
+ bitmap_value_insert_into_set (EXP_GEN (block),
+ result);
+ bitmap_value_insert_into_set (maximal_set, result);
+ }
+ continue;
+ }
- result = (pre_expr) pool_alloc (pre_expr_pool);
- result->kind = NARY;
- result->id = 0;
- PRE_EXPR_NARY (result) = nary;
- }
- break;
- case tcc_vl_exp:
- if (!can_value_number_call (rhs))
- continue;
+ case GIMPLE_ASSIGN:
+ {
+ pre_expr result = NULL;
+ switch (TREE_CODE_CLASS (gimple_assign_rhs_code (stmt)))
+ {
+ case tcc_unary:
+ if (is_exception_related (stmt))
+ continue;
+ case tcc_binary:
+ {
+ vn_nary_op_t nary;
+ unsigned int i;
+
+ vn_nary_op_lookup_pieces (gimple_num_ops (stmt) - 1,
+ gimple_assign_rhs_code (stmt),
+ gimple_expr_type (stmt),
+ gimple_assign_rhs1 (stmt),
+ gimple_assign_rhs2 (stmt),
+ NULL_TREE, NULL_TREE, &nary);
+
+ if (!nary)
+ continue;
+
+ for (i = 0; i < nary->length; i++)
+ if (TREE_CODE (nary->op[i]) == SSA_NAME)
+ add_to_exp_gen (block, nary->op[i]);
+
+ result = (pre_expr) pool_alloc (pre_expr_pool);
+ result->kind = NARY;
+ result->id = 0;
+ PRE_EXPR_NARY (result) = nary;
+ break;
+ }
- case tcc_declaration:
- case tcc_reference:
- {
- vn_reference_t ref;
- unsigned int i;
- vn_reference_op_t vro;
-
- vn_reference_lookup (rhs,
- shared_vuses_from_stmt (stmt),
- true, &ref);
- if (!ref)
- continue;
-
- for (i = 0; VEC_iterate (vn_reference_op_s,
- ref->operands, i,
- vro); i++)
- {
- if (vro->op0 && TREE_CODE (vro->op0) == SSA_NAME)
- add_to_exp_gen (block, vro->op0);
- if (vro->op1 && TREE_CODE (vro->op1) == SSA_NAME)
- add_to_exp_gen (block, vro->op1);
- }
- result = (pre_expr) pool_alloc (pre_expr_pool);
- result->kind = REFERENCE;
- result->id = 0;
- PRE_EXPR_REFERENCE (result) = ref;
- }
- break;
- default:
+ case tcc_declaration:
+ case tcc_reference:
+ {
+ vn_reference_t ref;
+ unsigned int i;
+ vn_reference_op_t vro;
+
+ vn_reference_lookup (gimple_assign_rhs1 (stmt),
+ shared_vuses_from_stmt (stmt),
+ false, &ref);
+ if (!ref)
+ continue;
+
+ for (i = 0; VEC_iterate (vn_reference_op_s,
+ ref->operands, i,
+ vro); i++)
{
- /* For any other statement that we don't
- recognize, simply add all referenced
- SSA_NAMEs to EXP_GEN. */
- FOR_EACH_SSA_TREE_OPERAND (op, stmt, iter, SSA_OP_USE)
- add_to_exp_gen (block, op);
- continue;
+ if (vro->op0 && TREE_CODE (vro->op0) == SSA_NAME)
+ add_to_exp_gen (block, vro->op0);
+ if (vro->op1 && TREE_CODE (vro->op1) == SSA_NAME)
+ add_to_exp_gen (block, vro->op1);
+ if (vro->op2 && TREE_CODE (vro->op2) == SSA_NAME)
+ add_to_exp_gen (block, vro->op2);
}
- }
- get_or_alloc_expression_id (result);
- add_to_value (get_expr_value_id (result), result);
- if (!in_fre)
- {
- bitmap_value_insert_into_set (EXP_GEN (block),
- result);
- bitmap_value_insert_into_set (maximal_set, result);
- }
+ result = (pre_expr) pool_alloc (pre_expr_pool);
+ result->kind = REFERENCE;
+ result->id = 0;
+ PRE_EXPR_REFERENCE (result) = ref;
+ break;
+ }
+ default:
+ /* For any other statement that we don't
+ recognize, simply add all referenced
+ SSA_NAMEs to EXP_GEN. */
+ FOR_EACH_SSA_TREE_OPERAND (op, stmt, iter, SSA_OP_USE)
+ add_to_exp_gen (block, op);
+ continue;
}
+
+ get_or_alloc_expression_id (result);
+ add_to_value (get_expr_value_id (result), result);
+ if (!in_fre)
+ {
+ bitmap_value_insert_into_set (EXP_GEN (block), result);
+ bitmap_value_insert_into_set (maximal_set, result);
+ }
+
continue;
}
default:
break;
-
}
-
-
}
+
/* Put the dominator children of BLOCK on the worklist of blocks
to compute available sets for. */
for (son = first_dom_son (CDI_DOMINATORS, block);
@@ -3757,30 +3732,27 @@ compute_avail (void)
be used for replacement. */
static tree
-do_SCCVN_insertion (tree stmt, tree ssa_vn)
+do_SCCVN_insertion (gimple stmt, tree ssa_vn)
{
- basic_block bb = bb_for_stmt (stmt);
- block_stmt_iterator bsi;
- tree expr, stmts;
+ basic_block bb = gimple_bb (stmt);
+ gimple_stmt_iterator gsi;
+ gimple_seq stmts = NULL;
+ tree expr;
pre_expr e;
/* First create a value expression from the expression we want
to insert and associate it with the value handle for SSA_VN. */
-
- /* TODO: Handle complex expressions. */
- e = get_or_alloc_expr_for (VN_INFO (ssa_vn)->expr);
+ e = get_or_alloc_expr_for (vn_get_expr_for (ssa_vn));
if (e == NULL)
return NULL_TREE;
-/* Then use create_expression_by_pieces to generate a valid
+ /* Then use create_expression_by_pieces to generate a valid
expression to insert at this point of the IL stream. */
- stmts = alloc_stmt_list ();
- expr = create_expression_by_pieces (bb, e, stmts, stmt,
- NULL);
+ expr = create_expression_by_pieces (bb, e, &stmts, stmt, NULL);
if (expr == NULL_TREE)
return NULL_TREE;
- bsi = bsi_for_stmt (stmt);
- bsi_insert_before (&bsi, stmts, BSI_SAME_STMT);
+ gsi = gsi_for_stmt (stmt);
+ gsi_insert_seq_before (&gsi, stmts, GSI_SAME_STMT);
return expr;
}
@@ -3795,30 +3767,35 @@ eliminate (void)
FOR_EACH_BB (b)
{
- block_stmt_iterator i;
+ gimple_stmt_iterator i;
- for (i = bsi_start (b); !bsi_end_p (i); bsi_next (&i))
+ for (i = gsi_start_bb (b); !gsi_end_p (i); gsi_next (&i))
{
- tree stmt = bsi_stmt (i);
+ gimple stmt = gsi_stmt (i);
/* Lookup the RHS of the expression, see if we have an
available computation for it. If so, replace the RHS with
the available computation. */
- if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
- && TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 0)) == SSA_NAME
- && TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 1)) != SSA_NAME
- && !is_gimple_min_invariant (GIMPLE_STMT_OPERAND (stmt, 1))
- && !stmt_ann (stmt)->has_volatile_ops)
+ if (gimple_has_lhs (stmt)
+ && TREE_CODE (gimple_get_lhs (stmt)) == SSA_NAME
+ && !gimple_assign_ssa_name_copy_p (stmt)
+ && (!gimple_assign_single_p (stmt)
+ || !is_gimple_min_invariant (gimple_assign_rhs1 (stmt)))
+ && !gimple_has_volatile_ops (stmt)
+ && !has_zero_uses (gimple_get_lhs (stmt)))
{
- tree lhs = GIMPLE_STMT_OPERAND (stmt, 0);
- tree *rhs_p = &GIMPLE_STMT_OPERAND (stmt, 1);
+ tree lhs = gimple_get_lhs (stmt);
+ tree rhs = NULL_TREE;
tree sprime = NULL;
pre_expr lhsexpr = get_or_alloc_expr_for_name (lhs);
pre_expr sprimeexpr;
+ if (gimple_assign_single_p (stmt))
+ rhs = gimple_assign_rhs1 (stmt);
+
sprimeexpr = bitmap_find_leader (AVAIL_OUT (b),
get_expr_value_id (lhsexpr),
- NULL_TREE);
+ NULL);
if (sprimeexpr)
{
@@ -3840,14 +3817,15 @@ eliminate (void)
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Replaced ");
- print_generic_expr (dump_file, *rhs_p, 0);
+ print_gimple_expr (dump_file, stmt, 0, 0);
fprintf (dump_file, " with ");
print_generic_expr (dump_file, sprime, 0);
fprintf (dump_file, " in ");
- print_generic_stmt (dump_file, stmt, 0);
+ print_gimple_stmt (dump_file, stmt, 0, 0);
}
pre_stats.eliminations++;
- propagate_tree_value (rhs_p, sprime);
+ propagate_tree_value_into_stmt (&i, sprime);
+ stmt = gsi_stmt (i);
update_stmt (stmt);
continue;
}
@@ -3861,38 +3839,41 @@ eliminate (void)
if (val != VN_TOP
&& TREE_CODE (val) == SSA_NAME
&& VN_INFO (val)->needs_insertion
- && can_PRE_operation (VN_INFO (val)->expr))
+ && can_PRE_operation (vn_get_expr_for (val)))
sprime = do_SCCVN_insertion (stmt, val);
}
if (sprime
&& sprime != lhs
- && (TREE_CODE (*rhs_p) != SSA_NAME
- || may_propagate_copy (*rhs_p, sprime)))
+ && (rhs == NULL_TREE
+ || TREE_CODE (rhs) != SSA_NAME
+ || may_propagate_copy (rhs, sprime)))
{
- gcc_assert (sprime != *rhs_p);
+ gcc_assert (sprime != rhs);
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Replaced ");
- print_generic_expr (dump_file, *rhs_p, 0);
+ print_gimple_expr (dump_file, stmt, 0, 0);
fprintf (dump_file, " with ");
print_generic_expr (dump_file, sprime, 0);
fprintf (dump_file, " in ");
- print_generic_stmt (dump_file, stmt, 0);
+ print_gimple_stmt (dump_file, stmt, 0, 0);
}
if (TREE_CODE (sprime) == SSA_NAME)
- NECESSARY (SSA_NAME_DEF_STMT (sprime)) = 1;
+ gimple_set_plf (SSA_NAME_DEF_STMT (sprime),
+ NECESSARY, true);
/* We need to make sure the new and old types actually match,
which may require adding a simple cast, which fold_convert
will do for us. */
- if (TREE_CODE (*rhs_p) != SSA_NAME
- && !useless_type_conversion_p (TREE_TYPE (*rhs_p),
- TREE_TYPE (sprime)))
- sprime = fold_convert (TREE_TYPE (*rhs_p), sprime);
+ if ((!rhs || TREE_CODE (rhs) != SSA_NAME)
+ && !useless_type_conversion_p (gimple_expr_type (stmt),
+ TREE_TYPE (sprime)))
+ sprime = fold_convert (gimple_expr_type (stmt), sprime);
pre_stats.eliminations++;
- propagate_tree_value (rhs_p, sprime);
+ propagate_tree_value_into_stmt (&i, sprime);
+ stmt = gsi_stmt (i);
update_stmt (stmt);
/* If we removed EH side effects from the statement, clean
@@ -3900,7 +3881,7 @@ eliminate (void)
if (maybe_clean_or_replace_eh_stmt (stmt, stmt))
{
bitmap_set_bit (need_eh_cleanup,
- bb_for_stmt (stmt)->index);
+ gimple_bb (stmt)->index);
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, " Removed EH side effects.\n");
}
@@ -3908,36 +3889,24 @@ eliminate (void)
}
/* Visit COND_EXPRs and fold the comparison with the
available value-numbers. */
- else if (TREE_CODE (stmt) == COND_EXPR
- && COMPARISON_CLASS_P (COND_EXPR_COND (stmt)))
+ else if (gimple_code (stmt) == GIMPLE_COND)
{
- tree cond = COND_EXPR_COND (stmt);
- tree op0 = TREE_OPERAND (cond, 0);
- tree op1 = TREE_OPERAND (cond, 1);
+ tree op0 = gimple_cond_lhs (stmt);
+ tree op1 = gimple_cond_rhs (stmt);
tree result;
if (TREE_CODE (op0) == SSA_NAME)
op0 = VN_INFO (op0)->valnum;
if (TREE_CODE (op1) == SSA_NAME)
op1 = VN_INFO (op1)->valnum;
- result = fold_binary (TREE_CODE (cond), TREE_TYPE (cond),
+ result = fold_binary (gimple_cond_code (stmt), boolean_type_node,
op0, op1);
if (result && TREE_CODE (result) == INTEGER_CST)
{
- COND_EXPR_COND (stmt) = result;
- update_stmt (stmt);
- todo = TODO_cleanup_cfg;
- }
- }
- else if (TREE_CODE (stmt) == COND_EXPR
- && TREE_CODE (COND_EXPR_COND (stmt)) == SSA_NAME)
- {
- tree op = COND_EXPR_COND (stmt);
- op = VN_INFO (op)->valnum;
- if (TREE_CODE (op) == INTEGER_CST)
- {
- COND_EXPR_COND (stmt) = integer_zerop (op)
- ? boolean_false_node : boolean_true_node;
+ if (integer_zerop (result))
+ gimple_cond_make_false (stmt);
+ else
+ gimple_cond_make_true (stmt);
update_stmt (stmt);
todo = TODO_cleanup_cfg;
}
@@ -3956,10 +3925,10 @@ eliminate (void)
mark that statement necessary. Return the stmt, if it is newly
necessary. */
-static inline tree
+static inline gimple
mark_operand_necessary (tree op)
{
- tree stmt;
+ gimple stmt;
gcc_assert (op);
@@ -3969,11 +3938,11 @@ mark_operand_necessary (tree op)
stmt = SSA_NAME_DEF_STMT (op);
gcc_assert (stmt);
- if (NECESSARY (stmt)
- || IS_EMPTY_STMT (stmt))
+ if (gimple_plf (stmt, NECESSARY)
+ || gimple_nop_p (stmt))
return NULL;
- NECESSARY (stmt) = 1;
+ gimple_set_plf (stmt, NECESSARY, true);
return stmt;
}
@@ -3985,36 +3954,36 @@ mark_operand_necessary (tree op)
static void
remove_dead_inserted_code (void)
{
- VEC(tree,heap) *worklist = NULL;
+ VEC(gimple,heap) *worklist = NULL;
int i;
- tree t;
+ gimple t;
- worklist = VEC_alloc (tree, heap, VEC_length (tree, inserted_exprs));
- for (i = 0; VEC_iterate (tree, inserted_exprs, i, t); i++)
+ worklist = VEC_alloc (gimple, heap, VEC_length (gimple, inserted_exprs));
+ for (i = 0; VEC_iterate (gimple, inserted_exprs, i, t); i++)
{
- if (NECESSARY (t))
- VEC_quick_push (tree, worklist, t);
+ if (gimple_plf (t, NECESSARY))
+ VEC_quick_push (gimple, worklist, t);
}
- while (VEC_length (tree, worklist) > 0)
+ while (VEC_length (gimple, worklist) > 0)
{
- t = VEC_pop (tree, worklist);
+ t = VEC_pop (gimple, worklist);
/* PHI nodes are somewhat special in that each PHI alternative has
data and control dependencies. All the statements feeding the
PHI node's arguments are always necessary. */
- if (TREE_CODE (t) == PHI_NODE)
+ if (gimple_code (t) == GIMPLE_PHI)
{
- int k;
+ unsigned k;
- VEC_reserve (tree, heap, worklist, PHI_NUM_ARGS (t));
- for (k = 0; k < PHI_NUM_ARGS (t); k++)
+ VEC_reserve (gimple, heap, worklist, gimple_phi_num_args (t));
+ for (k = 0; k < gimple_phi_num_args (t); k++)
{
tree arg = PHI_ARG_DEF (t, k);
if (TREE_CODE (arg) == SSA_NAME)
{
- arg = mark_operand_necessary (arg);
- if (arg)
- VEC_quick_push (tree, worklist, arg);
+ gimple n = mark_operand_necessary (arg);
+ if (n)
+ VEC_quick_push (gimple, worklist, n);
}
}
}
@@ -4033,38 +4002,34 @@ remove_dead_inserted_code (void)
FOR_EACH_SSA_TREE_OPERAND (use, t, iter, SSA_OP_ALL_USES)
{
- tree n = mark_operand_necessary (use);
+ gimple n = mark_operand_necessary (use);
if (n)
- VEC_safe_push (tree, heap, worklist, n);
+ VEC_safe_push (gimple, heap, worklist, n);
}
}
}
- for (i = 0; VEC_iterate (tree, inserted_exprs, i, t); i++)
+ for (i = 0; VEC_iterate (gimple, inserted_exprs, i, t); i++)
{
- if (!NECESSARY (t))
+ if (!gimple_plf (t, NECESSARY))
{
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Removing unnecessary insertion:");
- print_generic_stmt (dump_file, t, 0);
+ print_gimple_stmt (dump_file, t, 0, 0);
}
- if (TREE_CODE (t) == PHI_NODE)
- {
- remove_phi_node (t, NULL_TREE, true);
- }
+ gsi = gsi_for_stmt (t);
+ if (gimple_code (t) == GIMPLE_PHI)
+ remove_phi_node (&gsi, true);
else
- {
- bsi = bsi_for_stmt (t);
- bsi_remove (&bsi, true);
- release_defs (t);
- }
+ gsi_remove (&gsi, true);
+ release_defs (t);
}
}
- VEC_free (tree, heap, worklist);
+ VEC_free (gimple, heap, worklist);
}
/* Initialize data structures used by PRE. */
@@ -4129,14 +4094,14 @@ init_pre (bool do_fre)
/* Deallocate data structures used by PRE. */
static void
-fini_pre (void)
+fini_pre (bool do_fre)
{
basic_block bb;
free (postorder);
VEC_free (bitmap_set_t, heap, value_expressions);
- VEC_free (tree, heap, inserted_exprs);
- VEC_free (tree, heap, need_creation);
+ VEC_free (gimple, heap, inserted_exprs);
+ VEC_free (gimple, heap, need_creation);
bitmap_obstack_release (&grand_bitmap_obstack);
free_alloc_pool (bitmap_set_pool);
free_alloc_pool (pre_expr_pool);
@@ -4154,13 +4119,13 @@ fini_pre (void)
if (!bitmap_empty_p (need_eh_cleanup))
{
- tree_purge_all_dead_eh_edges (need_eh_cleanup);
+ gimple_purge_all_dead_eh_edges (need_eh_cleanup);
cleanup_tree_cfg ();
}
BITMAP_FREE (need_eh_cleanup);
- if (current_loops != NULL)
+ if (!do_fre)
loop_optimizer_finalize ();
}
@@ -4168,7 +4133,7 @@ fini_pre (void)
only wants to do full redundancy elimination. */
static unsigned int
-execute_pre (bool do_fre)
+execute_pre (bool do_fre ATTRIBUTE_UNUSED)
{
unsigned int todo = 0;
@@ -4178,8 +4143,6 @@ execute_pre (bool do_fre)
loop_optimizer_init may create new phis, etc. */
if (!do_fre)
loop_optimizer_init (LOOPS_NORMAL);
- if (0 && !do_fre)
- insert_fake_stores ();
if (!run_scc_vn (do_fre))
{
@@ -4230,18 +4193,14 @@ execute_pre (bool do_fre)
statistics_counter_event (cfun, "New PHIs", pre_stats.phis);
statistics_counter_event (cfun, "Eliminated", pre_stats.eliminations);
statistics_counter_event (cfun, "Constified", pre_stats.constified);
- bsi_commit_edge_inserts ();
+ gsi_commit_edge_inserts ();
clear_expression_ids ();
free_scc_vn ();
if (!do_fre)
- {
- remove_dead_inserted_code ();
- if (0)
- realify_fake_stores ();
- }
+ remove_dead_inserted_code ();
- fini_pre ();
+ fini_pre (do_fre);
return todo;
}
diff --git a/gcc/tree-ssa-propagate.c b/gcc/tree-ssa-propagate.c
index b0371805568..611f2b2847d 100644
--- a/gcc/tree-ssa-propagate.c
+++ b/gcc/tree-ssa-propagate.c
@@ -41,6 +41,7 @@
#include "varray.h"
#include "vec.h"
#include "value-prof.h"
+#include "gimple.h"
/* This file implements a generic value propagation engine based on
the same propagation used by the SSA-CCP algorithm [1].
@@ -96,7 +97,7 @@
5- Simulation terminates when all three work lists are drained.
Before calling ssa_propagate, it is important to clear
- DONT_SIMULATE_AGAIN for all the statements in the program that
+ prop_simulate_again_p for all the statements in the program that
should be simulated. This initialization allows an implementation
to specify which statements should never be simulated.
@@ -118,13 +119,16 @@
static ssa_prop_visit_stmt_fn ssa_prop_visit_stmt;
static ssa_prop_visit_phi_fn ssa_prop_visit_phi;
-/* Use the deprecated flag to mark statements that have been
- added to one of the SSA edges worklists. This flag is used to
- avoid visiting statements unnecessarily when draining an SSA edge
- worklist. If while simulating a basic block, we find a statement with
+/* Keep track of statements that have been added to one of the SSA
+ edges worklists. This flag is used to avoid visiting statements
+ unnecessarily when draining an SSA edge worklist. If while
+ simulating a basic block, we find a statement with
STMT_IN_SSA_EDGE_WORKLIST set, we clear it to prevent SSA edge
- processing from visiting it again. */
-#define STMT_IN_SSA_EDGE_WORKLIST(T) ((T)->base.deprecated_flag)
+ processing from visiting it again.
+
+ NOTE: users of the propagation engine are not allowed to use
+ the GF_PLF_1 flag. */
+#define STMT_IN_SSA_EDGE_WORKLIST GF_PLF_1
/* A bitmap to keep track of executable blocks in the CFG. */
static sbitmap executable_blocks;
@@ -142,7 +146,7 @@ static sbitmap bb_in_list;
definition has changed. SSA edges are def-use edges in the SSA
web. For each D-U edge, we store the target statement or PHI node
U. */
-static GTY(()) VEC(tree,gc) *interesting_ssa_edges;
+static GTY(()) VEC(gimple,gc) *interesting_ssa_edges;
/* Identical to INTERESTING_SSA_EDGES. For performance reasons, the
list of SSA edges is split into two. One contains all SSA edges
@@ -158,7 +162,7 @@ static GTY(()) VEC(tree,gc) *interesting_ssa_edges;
don't use a separate worklist for VARYING edges, we end up with
situations where lattice values move from
UNDEFINED->INTERESTING->VARYING instead of UNDEFINED->VARYING. */
-static GTY(()) VEC(tree,gc) *varying_ssa_edges;
+static GTY(()) VEC(gimple,gc) *varying_ssa_edges;
/* Return true if the block worklist empty. */
@@ -257,16 +261,16 @@ add_ssa_edge (tree var, bool is_varying)
FOR_EACH_IMM_USE_FAST (use_p, iter, var)
{
- tree use_stmt = USE_STMT (use_p);
+ gimple use_stmt = USE_STMT (use_p);
- if (!DONT_SIMULATE_AGAIN (use_stmt)
- && !STMT_IN_SSA_EDGE_WORKLIST (use_stmt))
+ if (prop_simulate_again_p (use_stmt)
+ && !gimple_plf (use_stmt, STMT_IN_SSA_EDGE_WORKLIST))
{
- STMT_IN_SSA_EDGE_WORKLIST (use_stmt) = 1;
+ gimple_set_plf (use_stmt, STMT_IN_SSA_EDGE_WORKLIST, true);
if (is_varying)
- VEC_safe_push (tree, gc, varying_ssa_edges, use_stmt);
+ VEC_safe_push (gimple, gc, varying_ssa_edges, use_stmt);
else
- VEC_safe_push (tree, gc, interesting_ssa_edges, use_stmt);
+ VEC_safe_push (gimple, gc, interesting_ssa_edges, use_stmt);
}
}
}
@@ -302,7 +306,7 @@ add_control_edge (edge e)
/* Simulate the execution of STMT and update the work lists accordingly. */
static void
-simulate_stmt (tree stmt)
+simulate_stmt (gimple stmt)
{
enum ssa_prop_result val = SSA_PROP_NOT_INTERESTING;
edge taken_edge = NULL;
@@ -310,20 +314,20 @@ simulate_stmt (tree stmt)
/* Don't bother visiting statements that are already
considered varying by the propagator. */
- if (DONT_SIMULATE_AGAIN (stmt))
+ if (!prop_simulate_again_p (stmt))
return;
- if (TREE_CODE (stmt) == PHI_NODE)
+ if (gimple_code (stmt) == GIMPLE_PHI)
{
val = ssa_prop_visit_phi (stmt);
- output_name = PHI_RESULT (stmt);
+ output_name = gimple_phi_result (stmt);
}
else
val = ssa_prop_visit_stmt (stmt, &taken_edge, &output_name);
if (val == SSA_PROP_VARYING)
{
- DONT_SIMULATE_AGAIN (stmt) = 1;
+ prop_set_simulate_again (stmt, false);
/* If the statement produced a new varying value, add the SSA
edges coming out of OUTPUT_NAME. */
@@ -336,7 +340,7 @@ simulate_stmt (tree stmt)
{
edge e;
edge_iterator ei;
- basic_block bb = bb_for_stmt (stmt);
+ basic_block bb = gimple_bb (stmt);
FOR_EACH_EDGE (e, ei, bb->succs)
add_control_edge (e);
}
@@ -362,36 +366,36 @@ simulate_stmt (tree stmt)
SSA edge is added to it in simulate_stmt. */
static void
-process_ssa_edge_worklist (VEC(tree,gc) **worklist)
+process_ssa_edge_worklist (VEC(gimple,gc) **worklist)
{
/* Drain the entire worklist. */
- while (VEC_length (tree, *worklist) > 0)
+ while (VEC_length (gimple, *worklist) > 0)
{
basic_block bb;
/* Pull the statement to simulate off the worklist. */
- tree stmt = VEC_pop (tree, *worklist);
+ gimple stmt = VEC_pop (gimple, *worklist);
/* If this statement was already visited by simulate_block, then
we don't need to visit it again here. */
- if (!STMT_IN_SSA_EDGE_WORKLIST (stmt))
+ if (!gimple_plf (stmt, STMT_IN_SSA_EDGE_WORKLIST))
continue;
/* STMT is no longer in a worklist. */
- STMT_IN_SSA_EDGE_WORKLIST (stmt) = 0;
+ gimple_set_plf (stmt, STMT_IN_SSA_EDGE_WORKLIST, false);
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "\nSimulating statement (from ssa_edges): ");
- print_generic_stmt (dump_file, stmt, dump_flags);
+ print_gimple_stmt (dump_file, stmt, 0, dump_flags);
}
- bb = bb_for_stmt (stmt);
+ bb = gimple_bb (stmt);
/* PHI nodes are always visited, regardless of whether or not
the destination block is executable. Otherwise, visit the
statement only if its block is marked executable. */
- if (TREE_CODE (stmt) == PHI_NODE
+ if (gimple_code (stmt) == GIMPLE_PHI
|| TEST_BIT (executable_blocks, bb->index))
simulate_stmt (stmt);
}
@@ -404,7 +408,7 @@ process_ssa_edge_worklist (VEC(tree,gc) **worklist)
static void
simulate_block (basic_block block)
{
- tree phi;
+ gimple_stmt_iterator gsi;
/* There is nothing to do for the exit block. */
if (block == EXIT_BLOCK_PTR)
@@ -415,14 +419,14 @@ simulate_block (basic_block block)
/* Always simulate PHI nodes, even if we have simulated this block
before. */
- for (phi = phi_nodes (block); phi; phi = PHI_CHAIN (phi))
- simulate_stmt (phi);
+ for (gsi = gsi_start_phis (block); !gsi_end_p (gsi); gsi_next (&gsi))
+ simulate_stmt (gsi_stmt (gsi));
/* If this is the first time we've simulated this block, then we
must simulate each of its statements. */
if (!TEST_BIT (executable_blocks, block->index))
{
- block_stmt_iterator j;
+ gimple_stmt_iterator j;
unsigned int normal_edge_count;
edge e, normal_edge;
edge_iterator ei;
@@ -430,17 +434,17 @@ simulate_block (basic_block block)
/* Note that we have simulated this block. */
SET_BIT (executable_blocks, block->index);
- for (j = bsi_start (block); !bsi_end_p (j); bsi_next (&j))
+ for (j = gsi_start_bb (block); !gsi_end_p (j); gsi_next (&j))
{
- tree stmt = bsi_stmt (j);
+ gimple stmt = gsi_stmt (j);
/* If this statement is already in the worklist then
"cancel" it. The reevaluation implied by the worklist
entry will produce the same value we generate here and
thus reevaluating it again from the worklist is
pointless. */
- if (STMT_IN_SSA_EDGE_WORKLIST (stmt))
- STMT_IN_SSA_EDGE_WORKLIST (stmt) = 0;
+ if (gimple_plf (stmt, STMT_IN_SSA_EDGE_WORKLIST))
+ gimple_set_plf (stmt, STMT_IN_SSA_EDGE_WORKLIST, false);
simulate_stmt (stmt);
}
@@ -482,8 +486,8 @@ ssa_prop_init (void)
size_t i;
/* Worklists of SSA edges. */
- interesting_ssa_edges = VEC_alloc (tree, gc, 20);
- varying_ssa_edges = VEC_alloc (tree, gc, 20);
+ interesting_ssa_edges = VEC_alloc (gimple, gc, 20);
+ varying_ssa_edges = VEC_alloc (gimple, gc, 20);
executable_blocks = sbitmap_alloc (last_basic_block);
sbitmap_zero (executable_blocks);
@@ -506,10 +510,13 @@ ssa_prop_init (void)
(including the edges coming out of ENTRY_BLOCK_PTR). */
FOR_ALL_BB (bb)
{
- block_stmt_iterator si;
+ gimple_stmt_iterator si;
- for (si = bsi_start (bb); !bsi_end_p (si); bsi_next (&si))
- STMT_IN_SSA_EDGE_WORKLIST (bsi_stmt (si)) = 0;
+ for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si))
+ gimple_set_plf (gsi_stmt (si), STMT_IN_SSA_EDGE_WORKLIST, false);
+
+ for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si))
+ gimple_set_plf (gsi_stmt (si), STMT_IN_SSA_EDGE_WORKLIST, false);
FOR_EACH_EDGE (e, ei, bb->succs)
e->flags &= ~EDGE_EXECUTABLE;
@@ -527,8 +534,8 @@ ssa_prop_init (void)
static void
ssa_prop_fini (void)
{
- VEC_free (tree, gc, interesting_ssa_edges);
- VEC_free (tree, gc, varying_ssa_edges);
+ VEC_free (gimple, gc, interesting_ssa_edges);
+ VEC_free (gimple, gc, varying_ssa_edges);
VEC_free (basic_block, heap, cfg_blocks);
cfg_blocks = NULL;
sbitmap_free (bb_in_list);
@@ -536,47 +543,20 @@ ssa_prop_fini (void)
}
-/* Get the main expression from statement STMT. */
-
-tree
-get_rhs (tree stmt)
-{
- enum tree_code code = TREE_CODE (stmt);
-
- switch (code)
- {
- case RETURN_EXPR:
- stmt = TREE_OPERAND (stmt, 0);
- if (!stmt || TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
- return stmt;
- /* FALLTHRU */
-
- case GIMPLE_MODIFY_STMT:
- stmt = GENERIC_TREE_OPERAND (stmt, 1);
- if (TREE_CODE (stmt) == WITH_SIZE_EXPR)
- return TREE_OPERAND (stmt, 0);
- else
- return stmt;
-
- case COND_EXPR:
- return COND_EXPR_COND (stmt);
- case SWITCH_EXPR:
- return SWITCH_COND (stmt);
- case GOTO_EXPR:
- return GOTO_DESTINATION (stmt);
- case LABEL_EXPR:
- return LABEL_EXPR_LABEL (stmt);
-
- default:
- return stmt;
- }
-}
-
-
-/* Return true if EXPR is a valid GIMPLE expression. */
+/* Return true if EXPR is an acceptable right-hand-side for a
+ GIMPLE assignment. We validate the entire tree, not just
+ the root node, thus catching expressions that embed complex
+ operands that are not permitted in GIMPLE. This function
+ is needed because the folding routines in fold-const.c
+ may return such expressions in some cases, e.g., an array
+ access with an embedded index addition. It may make more
+ sense to have folding routines that are sensitive to the
+ constraints on GIMPLE operands, rather than abandoning any
+ any attempt to fold if the usual folding turns out to be too
+ aggressive. */
bool
-valid_gimple_expression_p (tree expr)
+valid_gimple_rhs_p (tree expr)
{
enum tree_code code = TREE_CODE (expr);
@@ -588,6 +568,7 @@ valid_gimple_expression_p (tree expr)
break;
case tcc_constant:
+ /* All constants are ok. */
break;
case tcc_binary:
@@ -604,23 +585,26 @@ valid_gimple_expression_p (tree expr)
case tcc_expression:
switch (code)
- {
- case ADDR_EXPR:
- {
- tree t = TREE_OPERAND (expr, 0);
- while (handled_component_p (t))
- {
- /* ??? More checks needed, see the GIMPLE verifier. */
- if ((TREE_CODE (t) == ARRAY_REF
- || TREE_CODE (t) == ARRAY_RANGE_REF)
- && !is_gimple_val (TREE_OPERAND (t, 1)))
- return false;
- t = TREE_OPERAND (t, 0);
- }
- if (!is_gimple_id (t))
- return false;
- break;
- }
+ {
+ case ADDR_EXPR:
+ {
+ tree t;
+ if (is_gimple_min_invariant (expr))
+ return true;
+ t = TREE_OPERAND (expr, 0);
+ while (handled_component_p (t))
+ {
+ /* ??? More checks needed, see the GIMPLE verifier. */
+ if ((TREE_CODE (t) == ARRAY_REF
+ || TREE_CODE (t) == ARRAY_RANGE_REF)
+ && !is_gimple_val (TREE_OPERAND (t, 1)))
+ return false;
+ t = TREE_OPERAND (t, 0);
+ }
+ if (!is_gimple_id (t))
+ return false;
+ }
+ break;
case TRUTH_NOT_EXPR:
if (!is_gimple_val (TREE_OPERAND (expr, 0)))
@@ -645,24 +629,11 @@ valid_gimple_expression_p (tree expr)
break;
case tcc_vl_exp:
- switch (code)
- {
- case CALL_EXPR:
- break;
- default:
- return false;
- }
- break;
+ return false;
case tcc_exceptional:
- switch (code)
- {
- case SSA_NAME:
- break;
-
- default:
- return false;
- }
+ if (code != SSA_NAME)
+ return false;
break;
default:
@@ -673,101 +644,144 @@ valid_gimple_expression_p (tree expr)
}
-/* Set the main expression of *STMT_P to EXPR. If EXPR is not a valid
- GIMPLE expression no changes are done and the function returns
- false. */
+/* Return true if EXPR is a CALL_EXPR suitable for representation
+ as a single GIMPLE_CALL statement. If the arguments require
+ further gimplification, return false. */
bool
-set_rhs (tree *stmt_p, tree expr)
+valid_gimple_call_p (tree expr)
{
- tree stmt = *stmt_p, op;
- tree new_stmt;
- tree var;
- ssa_op_iter iter;
- int eh_region;
+ unsigned i, nargs;
- if (!valid_gimple_expression_p (expr))
+ if (TREE_CODE (expr) != CALL_EXPR)
return false;
- if (EXPR_HAS_LOCATION (stmt)
- && (EXPR_P (expr)
- || GIMPLE_STMT_P (expr))
- && ! EXPR_HAS_LOCATION (expr)
- && TREE_SIDE_EFFECTS (expr)
- && TREE_CODE (expr) != LABEL_EXPR)
- SET_EXPR_LOCATION (expr, EXPR_LOCATION (stmt));
+ nargs = call_expr_nargs (expr);
+ for (i = 0; i < nargs; i++)
+ if (! is_gimple_operand (CALL_EXPR_ARG (expr, i)))
+ return false;
- switch (TREE_CODE (stmt))
- {
- case RETURN_EXPR:
- op = TREE_OPERAND (stmt, 0);
- if (TREE_CODE (op) != GIMPLE_MODIFY_STMT)
- {
- GIMPLE_STMT_OPERAND (stmt, 0) = expr;
- break;
- }
- stmt = op;
- /* FALLTHRU */
+ return true;
+}
- case GIMPLE_MODIFY_STMT:
- op = GIMPLE_STMT_OPERAND (stmt, 1);
- if (TREE_CODE (op) == WITH_SIZE_EXPR)
- TREE_OPERAND (op, 0) = expr;
- else
- GIMPLE_STMT_OPERAND (stmt, 1) = expr;
- break;
- case COND_EXPR:
- if (!is_gimple_condexpr (expr))
- return false;
- COND_EXPR_COND (stmt) = expr;
- break;
- case SWITCH_EXPR:
- SWITCH_COND (stmt) = expr;
- break;
- case GOTO_EXPR:
- GOTO_DESTINATION (stmt) = expr;
- break;
- case LABEL_EXPR:
- LABEL_EXPR_LABEL (stmt) = expr;
- break;
+/* Make SSA names defined by OLD_STMT point to NEW_STMT
+ as their defining statement. */
- default:
- /* Replace the whole statement with EXPR. If EXPR has no side
- effects, then replace *STMT_P with an empty statement. */
- new_stmt = TREE_SIDE_EFFECTS (expr) ? expr : build_empty_stmt ();
- *stmt_p = new_stmt;
-
- /* Preserve the annotation, the histograms and the EH region information
- associated with the original statement. The EH information
- needs to be preserved only if the new statement still can throw. */
- new_stmt->base.ann = (tree_ann_t) stmt_ann (stmt);
- gimple_move_stmt_histograms (cfun, new_stmt, stmt);
- if (tree_could_throw_p (new_stmt))
- {
- eh_region = lookup_stmt_eh_region (stmt);
- /* We couldn't possibly turn a nothrow into a throw statement. */
- gcc_assert (eh_region >= 0);
- remove_stmt_from_eh_region (stmt);
- add_stmt_to_eh_region (new_stmt, eh_region);
- }
+void
+move_ssa_defining_stmt_for_defs (gimple new_stmt, gimple old_stmt)
+{
+ tree var;
+ ssa_op_iter iter;
- if (gimple_in_ssa_p (cfun)
- && TREE_SIDE_EFFECTS (expr))
- {
- /* Fix all the SSA_NAMEs created by *STMT_P to point to its new
- replacement. */
- FOR_EACH_SSA_TREE_OPERAND (var, stmt, iter, SSA_OP_ALL_DEFS)
- {
- if (TREE_CODE (var) == SSA_NAME)
- SSA_NAME_DEF_STMT (var) = *stmt_p;
- }
- }
- stmt->base.ann = NULL;
- break;
+ if (gimple_in_ssa_p (cfun))
+ {
+ /* Make defined SSA_NAMEs point to the new
+ statement as their definition. */
+ FOR_EACH_SSA_TREE_OPERAND (var, old_stmt, iter, SSA_OP_ALL_DEFS)
+ {
+ if (TREE_CODE (var) == SSA_NAME)
+ SSA_NAME_DEF_STMT (var) = new_stmt;
+ }
}
+}
- return true;
+
+/* Update a GIMPLE_CALL statement at iterator *SI_P to reflect the
+ value of EXPR, which is expected to be the result of folding the
+ call. This can only be done if EXPR is a CALL_EXPR with valid
+ GIMPLE operands as arguments, or if it is a suitable RHS expression
+ for a GIMPLE_ASSIGN. More complex expressions will require
+ gimplification, which will introduce addtional statements. In this
+ event, no update is performed, and the function returns false.
+ Note that we cannot mutate a GIMPLE_CALL in-place, so we always
+ replace the statement at *SI_P with an entirely new statement.
+ The new statement need not be a call, e.g., if the original call
+ folded to a constant. */
+
+bool
+update_call_from_tree (gimple_stmt_iterator *si_p, tree expr)
+{
+ tree lhs;
+
+ gimple stmt = gsi_stmt (*si_p);
+
+ gcc_assert (is_gimple_call (stmt));
+
+ lhs = gimple_call_lhs (stmt);
+
+ if (valid_gimple_call_p (expr))
+ {
+ /* The call has simplified to another call. */
+ tree fn = CALL_EXPR_FN (expr);
+ unsigned i;
+ unsigned nargs = call_expr_nargs (expr);
+ VEC(tree, heap) *args = NULL;
+ gimple new_stmt;
+
+ if (nargs > 0)
+ {
+ args = VEC_alloc (tree, heap, nargs);
+ VEC_safe_grow (tree, heap, args, nargs);
+
+ for (i = 0; i < nargs; i++)
+ VEC_replace (tree, args, i, CALL_EXPR_ARG (expr, i));
+ }
+
+ new_stmt = gimple_build_call_vec (fn, args);
+ gimple_call_set_lhs (new_stmt, lhs);
+ copy_virtual_operands (new_stmt, stmt);
+ move_ssa_defining_stmt_for_defs (new_stmt, stmt);
+ gimple_set_location (new_stmt, gimple_location (stmt));
+ gsi_replace (si_p, new_stmt, false);
+ VEC_free (tree, heap, args);
+
+ return true;
+ }
+ else if (valid_gimple_rhs_p (expr))
+ {
+ gimple new_stmt;
+
+ /* The call has simplified to an expression
+ that cannot be represented as a GIMPLE_CALL. */
+ if (lhs)
+ {
+ /* A value is expected.
+ Introduce a new GIMPLE_ASSIGN statement. */
+ STRIP_USELESS_TYPE_CONVERSION (expr);
+ new_stmt = gimple_build_assign (lhs, expr);
+ copy_virtual_operands (new_stmt, stmt);
+ move_ssa_defining_stmt_for_defs (new_stmt, stmt);
+ }
+ else if (!TREE_SIDE_EFFECTS (expr))
+ {
+ /* No value is expected, and EXPR has no effect.
+ Replace it with an empty statement. */
+ new_stmt = gimple_build_nop ();
+ }
+ else
+ {
+ /* No value is expected, but EXPR has an effect,
+ e.g., it could be a reference to a volatile
+ variable. Create an assignment statement
+ with a dummy (unused) lhs variable. */
+ STRIP_USELESS_TYPE_CONVERSION (expr);
+ lhs = create_tmp_var (TREE_TYPE (expr), NULL);
+ new_stmt = gimple_build_assign (lhs, expr);
+ add_referenced_var (lhs);
+ lhs = make_ssa_name (lhs, new_stmt);
+ gimple_assign_set_lhs (new_stmt, lhs);
+ copy_virtual_operands (new_stmt, stmt);
+ move_ssa_defining_stmt_for_defs (new_stmt, stmt);
+ }
+ gimple_set_location (new_stmt, gimple_location (stmt));
+ gsi_replace (si_p, new_stmt, false);
+ return true;
+ }
+ else
+ /* The call simplified to an expression that is
+ not a valid GIMPLE RHS. */
+ return false;
}
@@ -787,8 +801,8 @@ ssa_propagate (ssa_prop_visit_stmt_fn visit_stmt,
/* Iterate until the worklists are empty. */
while (!cfg_blocks_empty_p ()
- || VEC_length (tree, interesting_ssa_edges) > 0
- || VEC_length (tree, varying_ssa_edges) > 0)
+ || VEC_length (gimple, interesting_ssa_edges) > 0
+ || VEC_length (gimple, varying_ssa_edges) > 0)
{
if (!cfg_blocks_empty_p ())
{
@@ -812,7 +826,7 @@ ssa_propagate (ssa_prop_visit_stmt_fn visit_stmt,
/* Return the first VDEF operand for STMT. */
tree
-first_vdef (tree stmt)
+first_vdef (gimple stmt)
{
ssa_op_iter iter;
tree op;
@@ -831,18 +845,23 @@ first_vdef (tree stmt)
because they are not interesting for the optimizers. */
bool
-stmt_makes_single_load (tree stmt)
+stmt_makes_single_load (gimple stmt)
{
tree rhs;
- if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
+ if (gimple_code (stmt) != GIMPLE_ASSIGN)
+ return false;
+
+ /* Only a GIMPLE_SINGLE_RHS assignment may have a
+ declaration or reference as its RHS. */
+ if (get_gimple_rhs_class (gimple_assign_rhs_code (stmt))
+ != GIMPLE_SINGLE_RHS)
return false;
if (ZERO_SSA_OPERANDS (stmt, SSA_OP_VDEF|SSA_OP_VUSE))
return false;
- rhs = GIMPLE_STMT_OPERAND (stmt, 1);
- STRIP_NOPS (rhs);
+ rhs = gimple_assign_rhs1 (stmt);
return (!TREE_THIS_VOLATILE (rhs)
&& (DECL_P (rhs)
@@ -856,18 +875,22 @@ stmt_makes_single_load (tree stmt)
because they are not interesting for the optimizers. */
bool
-stmt_makes_single_store (tree stmt)
+stmt_makes_single_store (gimple stmt)
{
tree lhs;
- if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
+ if (gimple_code (stmt) != GIMPLE_ASSIGN
+ && gimple_code (stmt) != GIMPLE_CALL)
return false;
if (ZERO_SSA_OPERANDS (stmt, SSA_OP_VDEF))
return false;
- lhs = GIMPLE_STMT_OPERAND (stmt, 0);
- STRIP_NOPS (lhs);
+ lhs = gimple_get_lhs (stmt);
+
+ /* A call statement may have a null LHS. */
+ if (!lhs)
+ return false;
return (!TREE_THIS_VOLATILE (lhs)
&& (DECL_P (lhs)
@@ -880,7 +903,7 @@ stmt_makes_single_store (tree stmt)
NULL. */
prop_value_t *
-get_value_loaded_by (tree stmt, prop_value_t *values)
+get_value_loaded_by (gimple stmt, prop_value_t *values)
{
ssa_op_iter i;
tree vuse;
@@ -911,13 +934,10 @@ struct prop_stats_d
static struct prop_stats_d prop_stats;
/* Replace USE references in statement STMT with the values stored in
- PROP_VALUE. Return true if at least one reference was replaced. If
- REPLACED_ADDRESSES_P is given, it will be set to true if an address
- constant was replaced. */
+ PROP_VALUE. Return true if at least one reference was replaced. */
-bool
-replace_uses_in (tree stmt, bool *replaced_addresses_p,
- prop_value_t *prop_value)
+static bool
+replace_uses_in (gimple stmt, prop_value_t *prop_value)
{
bool replaced = false;
use_operand_p use;
@@ -931,7 +951,7 @@ replace_uses_in (tree stmt, bool *replaced_addresses_p,
if (val == tuse || val == NULL_TREE)
continue;
- if (TREE_CODE (stmt) == ASM_EXPR
+ if (gimple_code (stmt) == GIMPLE_ASM
&& !may_propagate_copy_into_asm (tuse))
continue;
@@ -946,8 +966,6 @@ replace_uses_in (tree stmt, bool *replaced_addresses_p,
propagate_value (use, val);
replaced = true;
- if (POINTER_TYPE_P (TREE_TYPE (tuse)) && replaced_addresses_p)
- *replaced_addresses_p = true;
}
return replaced;
@@ -955,9 +973,7 @@ replace_uses_in (tree stmt, bool *replaced_addresses_p,
/* Replace the VUSE references in statement STMT with the values
- stored in PROP_VALUE. Return true if a reference was replaced. If
- REPLACED_ADDRESSES_P is given, it will be set to true if an address
- constant was replaced.
+ stored in PROP_VALUE. Return true if a reference was replaced.
Replacing VUSE operands is slightly more complex than replacing
regular USEs. We are only interested in two types of replacements
@@ -1016,8 +1032,7 @@ replace_uses_in (tree stmt, bool *replaced_addresses_p,
replace_uses_in. */
static bool
-replace_vuses_in (tree stmt, bool *replaced_addresses_p,
- prop_value_t *prop_value)
+replace_vuses_in (gimple stmt, prop_value_t *prop_value)
{
bool replaced = false;
ssa_op_iter iter;
@@ -1029,29 +1044,21 @@ replace_vuses_in (tree stmt, bool *replaced_addresses_p,
see if we are trying to propagate a constant or a GIMPLE
register (case #1 above). */
prop_value_t *val = get_value_loaded_by (stmt, prop_value);
- tree rhs = GIMPLE_STMT_OPERAND (stmt, 1);
+ tree rhs = gimple_assign_rhs1 (stmt);
if (val
&& val->value
&& (is_gimple_reg (val->value)
|| is_gimple_min_invariant (val->value))
&& simple_cst_equal (rhs, val->mem_ref) == 1)
-
{
- /* If we are replacing a constant address, inform our
- caller. */
- if (TREE_CODE (val->value) != SSA_NAME
- && POINTER_TYPE_P (TREE_TYPE (GIMPLE_STMT_OPERAND (stmt, 1)))
- && replaced_addresses_p)
- *replaced_addresses_p = true;
-
/* We can only perform the substitution if the load is done
from the same memory location as the original store.
Since we already know that there are no intervening
stores between DEF_STMT and STMT, we only need to check
that the RHS of STMT is the same as the memory reference
propagated together with the value. */
- GIMPLE_STMT_OPERAND (stmt, 1) = val->value;
+ gimple_assign_set_rhs1 (stmt, val->value);
if (TREE_CODE (val->value) != SSA_NAME)
prop_stats.num_const_prop++;
@@ -1094,18 +1101,20 @@ replace_vuses_in (tree stmt, bool *replaced_addresses_p,
values from PROP_VALUE. */
static void
-replace_phi_args_in (tree phi, prop_value_t *prop_value)
+replace_phi_args_in (gimple phi, prop_value_t *prop_value)
{
- int i;
+ size_t i;
bool replaced = false;
- tree prev_phi = NULL;
if (dump_file && (dump_flags & TDF_DETAILS))
- prev_phi = unshare_expr (phi);
+ {
+ fprintf (dump_file, "Folding PHI node: ");
+ print_gimple_stmt (dump_file, phi, 0, TDF_SLIM);
+ }
- for (i = 0; i < PHI_NUM_ARGS (phi); i++)
+ for (i = 0; i < gimple_phi_num_args (phi); i++)
{
- tree arg = PHI_ARG_DEF (phi, i);
+ tree arg = gimple_phi_arg_def (phi, i);
if (TREE_CODE (arg) == SSA_NAME)
{
@@ -1125,72 +1134,84 @@ replace_phi_args_in (tree phi, prop_value_t *prop_value)
through an abnormal edge, update the replacement
accordingly. */
if (TREE_CODE (val) == SSA_NAME
- && PHI_ARG_EDGE (phi, i)->flags & EDGE_ABNORMAL)
+ && gimple_phi_arg_edge (phi, i)->flags & EDGE_ABNORMAL)
SSA_NAME_OCCURS_IN_ABNORMAL_PHI (val) = 1;
}
}
}
- if (replaced && dump_file && (dump_flags & TDF_DETAILS))
+ if (dump_file && (dump_flags & TDF_DETAILS))
{
- fprintf (dump_file, "Folded PHI node: ");
- print_generic_stmt (dump_file, prev_phi, TDF_SLIM);
- fprintf (dump_file, " into: ");
- print_generic_stmt (dump_file, phi, TDF_SLIM);
- fprintf (dump_file, "\n");
+ if (!replaced)
+ fprintf (dump_file, "No folding possible\n");
+ else
+ {
+ fprintf (dump_file, "Folded into: ");
+ print_gimple_stmt (dump_file, phi, 0, TDF_SLIM);
+ fprintf (dump_file, "\n");
+ }
}
}
-/* If STMT has a predicate whose value can be computed using the value
- range information computed by VRP, compute its value and return true.
- Otherwise, return false. */
+/* If the statement pointed by SI has a predicate whose value can be
+ computed using the value range information computed by VRP, compute
+ its value and return true. Otherwise, return false. */
static bool
-fold_predicate_in (tree stmt)
+fold_predicate_in (gimple_stmt_iterator *si)
{
- tree *pred_p = NULL;
- bool modify_stmt_p = false;
+ bool assignment_p = false;
tree val;
+ gimple stmt = gsi_stmt (*si);
- if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
- && COMPARISON_CLASS_P (GIMPLE_STMT_OPERAND (stmt, 1)))
+ if (is_gimple_assign (stmt)
+ && TREE_CODE_CLASS (gimple_assign_rhs_code (stmt)) == tcc_comparison)
{
- modify_stmt_p = true;
- pred_p = &GIMPLE_STMT_OPERAND (stmt, 1);
+ assignment_p = true;
+ val = vrp_evaluate_conditional (gimple_assign_rhs_code (stmt),
+ gimple_assign_rhs1 (stmt),
+ gimple_assign_rhs2 (stmt),
+ stmt);
}
- else if (TREE_CODE (stmt) == COND_EXPR)
- pred_p = &COND_EXPR_COND (stmt);
+ else if (gimple_code (stmt) == GIMPLE_COND)
+ val = vrp_evaluate_conditional (gimple_cond_code (stmt),
+ gimple_cond_lhs (stmt),
+ gimple_cond_rhs (stmt),
+ stmt);
else
return false;
- if (TREE_CODE (*pred_p) == SSA_NAME)
- val = vrp_evaluate_conditional (EQ_EXPR,
- *pred_p,
- boolean_true_node,
- stmt);
- else
- val = vrp_evaluate_conditional (TREE_CODE (*pred_p),
- TREE_OPERAND (*pred_p, 0),
- TREE_OPERAND (*pred_p, 1),
- stmt);
if (val)
{
- if (modify_stmt_p)
- val = fold_convert (TREE_TYPE (*pred_p), val);
+ if (assignment_p)
+ val = fold_convert (gimple_expr_type (stmt), val);
if (dump_file)
{
fprintf (dump_file, "Folding predicate ");
- print_generic_expr (dump_file, *pred_p, 0);
+ print_gimple_expr (dump_file, stmt, 0, 0);
fprintf (dump_file, " to ");
print_generic_expr (dump_file, val, 0);
fprintf (dump_file, "\n");
}
prop_stats.num_pred_folded++;
- *pred_p = val;
+
+ if (is_gimple_assign (stmt))
+ gimple_assign_set_rhs_from_tree (si, val);
+ else
+ {
+ gcc_assert (gimple_code (stmt) == GIMPLE_COND);
+ if (integer_zerop (val))
+ gimple_cond_make_false (stmt);
+ else if (integer_onep (val))
+ gimple_cond_make_true (stmt);
+ else
+ gcc_unreachable ();
+ }
+
return true;
}
@@ -1222,78 +1243,83 @@ substitute_and_fold (prop_value_t *prop_value, bool use_ranges_p)
return false;
if (dump_file && (dump_flags & TDF_DETAILS))
- fprintf (dump_file, "\nSubstituing values and folding statements\n\n");
+ fprintf (dump_file, "\nSubstituting values and folding statements\n\n");
memset (&prop_stats, 0, sizeof (prop_stats));
/* Substitute values in every statement of every basic block. */
FOR_EACH_BB (bb)
{
- block_stmt_iterator i;
- tree phi;
+ gimple_stmt_iterator i;
/* Propagate known values into PHI nodes. */
if (prop_value)
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
- replace_phi_args_in (phi, prop_value);
+ for (i = gsi_start_phis (bb); !gsi_end_p (i); gsi_next (&i))
+ replace_phi_args_in (gsi_stmt (i), prop_value);
/* Propagate known values into stmts. Do a backward walk to expose
more trivially deletable stmts. */
- for (i = bsi_last (bb); !bsi_end_p (i);)
+ for (i = gsi_last_bb (bb); !gsi_end_p (i);)
{
- bool replaced_address, did_replace;
- tree call, prev_stmt = NULL;
- tree stmt = bsi_stmt (i);
+ bool did_replace;
+ gimple stmt = gsi_stmt (i);
+ enum gimple_code code = gimple_code (stmt);
/* Ignore ASSERT_EXPRs. They are used by VRP to generate
range information for names and they are discarded
afterwards. */
- if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
- && TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 1)) == ASSERT_EXPR)
+
+ if (code == GIMPLE_ASSIGN
+ && TREE_CODE (gimple_assign_rhs1 (stmt)) == ASSERT_EXPR)
{
- bsi_prev (&i);
+ gsi_prev (&i);
continue;
}
/* No point propagating into a stmt whose result is not used,
but instead we might be able to remove a trivially dead stmt. */
- if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
- && TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 0)) == SSA_NAME
- && !stmt_ann (stmt)->has_volatile_ops
- && has_zero_uses (GIMPLE_STMT_OPERAND (stmt, 0))
- && !tree_could_throw_p (stmt)
- && (!(call = get_call_expr_in (stmt))
- || !TREE_SIDE_EFFECTS (call)))
+ if (gimple_get_lhs (stmt)
+ && TREE_CODE (gimple_get_lhs (stmt)) == SSA_NAME
+ && has_zero_uses (gimple_get_lhs (stmt))
+ && !stmt_could_throw_p (stmt)
+ && !gimple_has_side_effects (stmt))
{
- block_stmt_iterator i2;
+ gimple_stmt_iterator i2;
+
if (dump_file && dump_flags & TDF_DETAILS)
{
fprintf (dump_file, "Removing dead stmt ");
- print_generic_expr (dump_file, stmt, 0);
+ print_gimple_stmt (dump_file, stmt, 0, 0);
fprintf (dump_file, "\n");
}
prop_stats.num_dce++;
- bsi_prev (&i);
- i2 = bsi_for_stmt (stmt);
- bsi_remove (&i2, true);
+ gsi_prev (&i);
+ i2 = gsi_for_stmt (stmt);
+ gsi_remove (&i2, true);
release_defs (stmt);
continue;
}
/* Record the state of the statement before replacements. */
- push_stmt_changes (bsi_stmt_ptr (i));
+ push_stmt_changes (gsi_stmt_ptr (&i));
/* Replace the statement with its folded version and mark it
folded. */
did_replace = false;
- replaced_address = false;
if (dump_file && (dump_flags & TDF_DETAILS))
- prev_stmt = unshare_expr (stmt);
+ {
+ fprintf (dump_file, "Folding statement: ");
+ print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM);
+ }
/* If we have range information, see if we can fold
predicate expressions. */
if (use_ranges_p)
- did_replace = fold_predicate_in (stmt);
+ {
+ did_replace = fold_predicate_in (&i);
+ /* fold_predicate_in should not have reallocated STMT. */
+ gcc_assert (gsi_stmt (i) == stmt);
+ }
if (prop_value)
{
@@ -1302,48 +1328,54 @@ substitute_and_fold (prop_value_t *prop_value, bool use_ranges_p)
information is not collected on virtuals, so we only
need to check this for real uses). */
if (!did_replace)
- did_replace |= replace_uses_in (stmt, &replaced_address,
- prop_value);
+ did_replace |= replace_uses_in (stmt, prop_value);
- did_replace |= replace_vuses_in (stmt, &replaced_address,
- prop_value);
+ did_replace |= replace_vuses_in (stmt, prop_value);
}
/* If we made a replacement, fold and cleanup the statement. */
if (did_replace)
{
- tree old_stmt = stmt;
- tree rhs;
+ gimple old_stmt = stmt;
- fold_stmt (bsi_stmt_ptr (i));
- stmt = bsi_stmt (i);
+ fold_stmt (&i);
+ stmt = gsi_stmt (i);
/* If we cleaned up EH information from the statement,
remove EH edges. */
if (maybe_clean_or_replace_eh_stmt (old_stmt, stmt))
- tree_purge_dead_eh_edges (bb);
-
- rhs = get_rhs (stmt);
- if (TREE_CODE (rhs) == ADDR_EXPR)
- recompute_tree_invariant_for_addr_expr (rhs);
-
- if (dump_file && (dump_flags & TDF_DETAILS))
- {
- fprintf (dump_file, "Folded statement: ");
- print_generic_stmt (dump_file, prev_stmt, TDF_SLIM);
- fprintf (dump_file, " into: ");
- print_generic_stmt (dump_file, stmt, TDF_SLIM);
- fprintf (dump_file, "\n");
- }
+ gimple_purge_dead_eh_edges (bb);
+
+ if (is_gimple_assign (stmt)
+ && (get_gimple_rhs_class (gimple_assign_rhs_code (stmt))
+ == GIMPLE_SINGLE_RHS))
+ {
+ tree rhs = gimple_assign_rhs1 (stmt);
+
+ if (TREE_CODE (rhs) == ADDR_EXPR)
+ recompute_tree_invariant_for_addr_expr (rhs);
+ }
/* Determine what needs to be done to update the SSA form. */
- pop_stmt_changes (bsi_stmt_ptr (i));
+ pop_stmt_changes (gsi_stmt_ptr (&i));
something_changed = true;
}
else
{
/* The statement was not modified, discard the change buffer. */
- discard_stmt_changes (bsi_stmt_ptr (i));
+ discard_stmt_changes (gsi_stmt_ptr (&i));
+ }
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ if (did_replace)
+ {
+ fprintf (dump_file, "Folded into: ");
+ print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM);
+ fprintf (dump_file, "\n");
+ }
+ else
+ fprintf (dump_file, "Not folded\n");
}
/* Some statements may be simplified using ranges. For
@@ -1355,7 +1387,7 @@ substitute_and_fold (prop_value_t *prop_value, bool use_ranges_p)
if (use_ranges_p)
simplify_stmt_using_ranges (stmt);
- bsi_prev (&i);
+ gsi_prev (&i);
}
}
diff --git a/gcc/tree-ssa-propagate.h b/gcc/tree-ssa-propagate.h
index 18133788309..e472baca7c7 100644
--- a/gcc/tree-ssa-propagate.h
+++ b/gcc/tree-ssa-propagate.h
@@ -22,9 +22,21 @@ along with GCC; see the file COPYING3. If not see
#ifndef _TREE_SSA_PROPAGATE_H
#define _TREE_SSA_PROPAGATE_H 1
-/* Use the TREE_VISITED bitflag to mark statements and PHI nodes that
- have been deemed varying and should not be simulated again. */
-#define DONT_SIMULATE_AGAIN(T) TREE_VISITED (T)
+/* If SIM_P is true, statement S will be simulated again. */
+
+static inline void
+prop_set_simulate_again (gimple s, bool visit_p)
+{
+ gimple_set_visited (s, visit_p);
+}
+
+/* Return true if statement T should be simulated again. */
+
+static inline bool
+prop_simulate_again_p (gimple s)
+{
+ return gimple_visited_p (s);
+}
/* Lattice values used for propagation purposes. Specific instances
of a propagation engine must return these values from the statement
@@ -106,20 +118,20 @@ typedef struct value_range_d value_range_t;
/* Call-back functions used by the value propagation engine. */
-typedef enum ssa_prop_result (*ssa_prop_visit_stmt_fn) (tree, edge *, tree *);
-typedef enum ssa_prop_result (*ssa_prop_visit_phi_fn) (tree);
+typedef enum ssa_prop_result (*ssa_prop_visit_stmt_fn) (gimple, edge *, tree *);
+typedef enum ssa_prop_result (*ssa_prop_visit_phi_fn) (gimple);
/* In tree-ssa-propagate.c */
void ssa_propagate (ssa_prop_visit_stmt_fn, ssa_prop_visit_phi_fn);
-tree get_rhs (tree);
-bool valid_gimple_expression_p (tree expr);
-bool set_rhs (tree *, tree);
-tree first_vdef (tree);
-bool stmt_makes_single_load (tree);
-bool stmt_makes_single_store (tree);
-prop_value_t *get_value_loaded_by (tree, prop_value_t *);
-bool replace_uses_in (tree, bool *, prop_value_t *);
+bool valid_gimple_rhs_p (tree);
+bool valid_gimple_call_p (tree);
+void move_ssa_defining_stmt_for_defs (gimple, gimple);
+bool update_call_from_tree (gimple_stmt_iterator *, tree);
+tree first_vdef (gimple);
+bool stmt_makes_single_load (gimple);
+bool stmt_makes_single_store (gimple);
+prop_value_t *get_value_loaded_by (gimple, prop_value_t *);
bool substitute_and_fold (prop_value_t *, bool);
#endif /* _TREE_SSA_PROPAGATE_H */
diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c
index 5fcaa7bbb16..be68331faf2 100644
--- a/gcc/tree-ssa-reassoc.c
+++ b/gcc/tree-ssa-reassoc.c
@@ -29,7 +29,7 @@ along with GCC; see the file COPYING3. If not see
#include "diagnostic.h"
#include "tree-inline.h"
#include "tree-flow.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "tree-dump.h"
#include "timevar.h"
#include "tree-iterator.h"
@@ -230,23 +230,21 @@ get_rank (tree e)
if (TREE_CODE (e) == SSA_NAME)
{
- tree stmt;
- tree rhs;
+ gimple stmt;
long rank, maxrank;
- int i;
- int n;
+ int i, n;
if (TREE_CODE (SSA_NAME_VAR (e)) == PARM_DECL
&& SSA_NAME_IS_DEFAULT_DEF (e))
return find_operand_rank (e);
stmt = SSA_NAME_DEF_STMT (e);
- if (bb_for_stmt (stmt) == NULL)
+ if (gimple_bb (stmt) == NULL)
return 0;
- if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT
+ if (!is_gimple_assign (stmt)
|| !ZERO_SSA_OPERANDS (stmt, SSA_OP_VIRTUAL_DEFS))
- return bb_rank[bb_for_stmt (stmt)->index];
+ return bb_rank[gimple_bb (stmt)->index];
/* If we already have a rank for this expression, use that. */
rank = find_operand_rank (e);
@@ -256,19 +254,28 @@ get_rank (tree e)
/* Otherwise, find the maximum rank for the operands, or the bb
rank, whichever is less. */
rank = 0;
- maxrank = bb_rank[bb_for_stmt(stmt)->index];
- rhs = GIMPLE_STMT_OPERAND (stmt, 1);
- n = TREE_OPERAND_LENGTH (rhs);
- if (n == 0)
- rank = MAX (rank, get_rank (rhs));
+ maxrank = bb_rank[gimple_bb(stmt)->index];
+ if (gimple_assign_single_p (stmt))
+ {
+ tree rhs = gimple_assign_rhs1 (stmt);
+ n = TREE_OPERAND_LENGTH (rhs);
+ if (n == 0)
+ rank = MAX (rank, get_rank (rhs));
+ else
+ {
+ for (i = 0;
+ i < n && TREE_OPERAND (rhs, i) && rank != maxrank; i++)
+ rank = MAX(rank, get_rank (TREE_OPERAND (rhs, i)));
+ }
+ }
else
{
- for (i = 0;
- i < n
- && TREE_OPERAND (rhs, i)
- && rank != maxrank;
- i++)
- rank = MAX(rank, get_rank (TREE_OPERAND (rhs, i)));
+ n = gimple_num_ops (stmt);
+ for (i = 1; i < n && rank != maxrank; i++)
+ {
+ gcc_assert (gimple_op (stmt, i));
+ rank = MAX(rank, get_rank (gimple_op (stmt, i)));
+ }
}
if (dump_file && (dump_flags & TDF_DETAILS))
@@ -349,21 +356,21 @@ add_to_ops_vec (VEC(operand_entry_t, heap) **ops, tree op)
operation with tree code CODE, and is inside LOOP. */
static bool
-is_reassociable_op (tree stmt, enum tree_code code, struct loop *loop)
+is_reassociable_op (gimple stmt, enum tree_code code, struct loop *loop)
{
- basic_block bb;
+ basic_block bb = gimple_bb (stmt);
- if (IS_EMPTY_STMT (stmt))
+ if (gimple_bb (stmt) == NULL)
return false;
- bb = bb_for_stmt (stmt);
if (!flow_bb_inside_loop_p (loop, bb))
return false;
- if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
- && TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 1)) == code
- && has_single_use (GIMPLE_STMT_OPERAND (stmt, 0)))
+ if (is_gimple_assign (stmt)
+ && gimple_assign_rhs_code (stmt) == code
+ && has_single_use (gimple_assign_lhs (stmt)))
return true;
+
return false;
}
@@ -374,15 +381,13 @@ is_reassociable_op (tree stmt, enum tree_code code, struct loop *loop)
static tree
get_unary_op (tree name, enum tree_code opcode)
{
- tree stmt = SSA_NAME_DEF_STMT (name);
- tree rhs;
+ gimple stmt = SSA_NAME_DEF_STMT (name);
- if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
+ if (!is_gimple_assign (stmt))
return NULL_TREE;
- rhs = GIMPLE_STMT_OPERAND (stmt, 1);
- if (TREE_CODE (rhs) == opcode)
- return TREE_OPERAND (rhs, 0);
+ if (gimple_assign_rhs_code (stmt) == opcode)
+ return gimple_assign_rhs1 (stmt);
return NULL_TREE;
}
@@ -722,6 +727,415 @@ eliminate_using_constants (enum tree_code opcode,
}
}
+
+static void linearize_expr_tree (VEC(operand_entry_t, heap) **, gimple,
+ bool, bool);
+
+/* Structure for tracking and counting operands. */
+typedef struct oecount_s {
+ int cnt;
+ enum tree_code oecode;
+ tree op;
+} oecount;
+
+DEF_VEC_O(oecount);
+DEF_VEC_ALLOC_O(oecount,heap);
+
+/* The heap for the oecount hashtable and the sorted list of operands. */
+static VEC (oecount, heap) *cvec;
+
+/* Hash function for oecount. */
+
+static hashval_t
+oecount_hash (const void *p)
+{
+ const oecount *c = VEC_index (oecount, cvec, (size_t)p - 42);
+ return htab_hash_pointer (c->op) ^ (hashval_t)c->oecode;
+}
+
+/* Comparison function for oecount. */
+
+static int
+oecount_eq (const void *p1, const void *p2)
+{
+ const oecount *c1 = VEC_index (oecount, cvec, (size_t)p1 - 42);
+ const oecount *c2 = VEC_index (oecount, cvec, (size_t)p2 - 42);
+ return (c1->oecode == c2->oecode
+ && c1->op == c2->op);
+}
+
+/* Comparison function for qsort sorting oecount elements by count. */
+
+static int
+oecount_cmp (const void *p1, const void *p2)
+{
+ const oecount *c1 = (const oecount *)p1;
+ const oecount *c2 = (const oecount *)p2;
+ return c1->cnt - c2->cnt;
+}
+
+/* Walks the linear chain with result *DEF searching for an operation
+ with operand OP and code OPCODE removing that from the chain. *DEF
+ is updated if there is only one operand but no operation left. */
+
+static void
+zero_one_operation (tree *def, enum tree_code opcode, tree op)
+{
+ gimple stmt = SSA_NAME_DEF_STMT (*def);
+
+ do
+ {
+ tree name = gimple_assign_rhs1 (stmt);
+
+ /* If this is the operation we look for and one of the operands
+ is ours simply propagate the other operand into the stmts
+ single use. */
+ if (gimple_assign_rhs_code (stmt) == opcode
+ && (name == op
+ || gimple_assign_rhs2 (stmt) == op))
+ {
+ gimple use_stmt;
+ use_operand_p use;
+ gimple_stmt_iterator gsi;
+ if (name == op)
+ name = gimple_assign_rhs2 (stmt);
+ gcc_assert (has_single_use (gimple_assign_lhs (stmt)));
+ single_imm_use (gimple_assign_lhs (stmt), &use, &use_stmt);
+ if (gimple_assign_lhs (stmt) == *def)
+ *def = name;
+ SET_USE (use, name);
+ if (TREE_CODE (name) != SSA_NAME)
+ update_stmt (use_stmt);
+ gsi = gsi_for_stmt (stmt);
+ gsi_remove (&gsi, true);
+ release_defs (stmt);
+ return;
+ }
+
+ /* Continue walking the chain. */
+ gcc_assert (name != op
+ && TREE_CODE (name) == SSA_NAME);
+ stmt = SSA_NAME_DEF_STMT (name);
+ }
+ while (1);
+}
+
+/* Builds one statement performing OP1 OPCODE OP2 using TMPVAR for
+ the result. Places the statement after the definition of either
+ OP1 or OP2. Returns the new statement. */
+
+static gimple
+build_and_add_sum (tree tmpvar, tree op1, tree op2, enum tree_code opcode)
+{
+ gimple op1def = NULL, op2def = NULL;
+ gimple_stmt_iterator gsi;
+ tree op;
+ gimple sum;
+
+ /* Create the addition statement. */
+ sum = gimple_build_assign_with_ops (opcode, tmpvar, op1, op2);
+ op = make_ssa_name (tmpvar, sum);
+ gimple_assign_set_lhs (sum, op);
+
+ /* Find an insertion place and insert. */
+ if (TREE_CODE (op1) == SSA_NAME)
+ op1def = SSA_NAME_DEF_STMT (op1);
+ if (TREE_CODE (op2) == SSA_NAME)
+ op2def = SSA_NAME_DEF_STMT (op2);
+ if ((!op1def || gimple_nop_p (op1def))
+ && (!op2def || gimple_nop_p (op2def)))
+ {
+ gsi = gsi_start_bb (single_succ (ENTRY_BLOCK_PTR));
+ gsi_insert_before (&gsi, sum, GSI_NEW_STMT);
+ }
+ else if ((!op1def || gimple_nop_p (op1def))
+ || (op2def && !gimple_nop_p (op2def)
+ && stmt_dominates_stmt_p (op1def, op2def)))
+ {
+ if (gimple_code (op2def) == GIMPLE_PHI)
+ {
+ gsi = gsi_start_bb (gimple_bb (op2def));
+ gsi_insert_before (&gsi, sum, GSI_NEW_STMT);
+ }
+ else
+ {
+ gsi = gsi_for_stmt (op2def);
+ gsi_insert_after (&gsi, sum, GSI_NEW_STMT);
+ }
+ }
+ else
+ {
+ if (gimple_code (op1def) == GIMPLE_PHI)
+ {
+ gsi = gsi_start_bb (gimple_bb (op1def));
+ gsi_insert_before (&gsi, sum, GSI_NEW_STMT);
+ }
+ else
+ {
+ gsi = gsi_for_stmt (op1def);
+ gsi_insert_after (&gsi, sum, GSI_NEW_STMT);
+ }
+ }
+ update_stmt (sum);
+
+ return sum;
+}
+
+/* Perform un-distribution of divisions and multiplications.
+ A * X + B * X is transformed into (A + B) * X and A / X + B / X
+ to (A + B) / X for real X.
+
+ The algorithm is organized as follows.
+
+ - First we walk the addition chain *OPS looking for summands that
+ are defined by a multiplication or a real division. This results
+ in the candidates bitmap with relevant indices into *OPS.
+
+ - Second we build the chains of multiplications or divisions for
+ these candidates, counting the number of occurences of (operand, code)
+ pairs in all of the candidates chains.
+
+ - Third we sort the (operand, code) pairs by number of occurence and
+ process them starting with the pair with the most uses.
+
+ * For each such pair we walk the candidates again to build a
+ second candidate bitmap noting all multiplication/division chains
+ that have at least one occurence of (operand, code).
+
+ * We build an alternate addition chain only covering these
+ candidates with one (operand, code) operation removed from their
+ multiplication/division chain.
+
+ * The first candidate gets replaced by the alternate addition chain
+ multiplied/divided by the operand.
+
+ * All candidate chains get disabled for further processing and
+ processing of (operand, code) pairs continues.
+
+ The alternate addition chains built are re-processed by the main
+ reassociation algorithm which allows optimizing a * x * y + b * y * x
+ to (a + b ) * x * y in one invocation of the reassociation pass. */
+
+static bool
+undistribute_ops_list (enum tree_code opcode,
+ VEC (operand_entry_t, heap) **ops, struct loop *loop)
+{
+ unsigned int length = VEC_length (operand_entry_t, *ops);
+ operand_entry_t oe1;
+ unsigned i, j;
+ sbitmap candidates, candidates2;
+ unsigned nr_candidates, nr_candidates2;
+ sbitmap_iterator sbi0;
+ VEC (operand_entry_t, heap) **subops;
+ htab_t ctable;
+ bool changed = false;
+
+ if (length <= 1
+ || opcode != PLUS_EXPR)
+ return false;
+
+ /* Build a list of candidates to process. */
+ candidates = sbitmap_alloc (length);
+ sbitmap_zero (candidates);
+ nr_candidates = 0;
+ for (i = 0; VEC_iterate (operand_entry_t, *ops, i, oe1); ++i)
+ {
+ enum tree_code dcode;
+ gimple oe1def;
+
+ if (TREE_CODE (oe1->op) != SSA_NAME)
+ continue;
+ oe1def = SSA_NAME_DEF_STMT (oe1->op);
+ if (!is_gimple_assign (oe1def))
+ continue;
+ dcode = gimple_assign_rhs_code (oe1def);
+ if ((dcode != MULT_EXPR
+ && dcode != RDIV_EXPR)
+ || !is_reassociable_op (oe1def, dcode, loop))
+ continue;
+
+ SET_BIT (candidates, i);
+ nr_candidates++;
+ }
+
+ if (nr_candidates < 2)
+ {
+ sbitmap_free (candidates);
+ return false;
+ }
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "searching for un-distribute opportunities ");
+ print_generic_expr (dump_file,
+ VEC_index (operand_entry_t, *ops,
+ sbitmap_first_set_bit (candidates))->op, 0);
+ fprintf (dump_file, " %d\n", nr_candidates);
+ }
+
+ /* Build linearized sub-operand lists and the counting table. */
+ cvec = NULL;
+ ctable = htab_create (15, oecount_hash, oecount_eq, NULL);
+ subops = XCNEWVEC (VEC (operand_entry_t, heap) *,
+ VEC_length (operand_entry_t, *ops));
+ EXECUTE_IF_SET_IN_SBITMAP (candidates, 0, i, sbi0)
+ {
+ gimple oedef;
+ enum tree_code oecode;
+ unsigned j;
+
+ oedef = SSA_NAME_DEF_STMT (VEC_index (operand_entry_t, *ops, i)->op);
+ oecode = gimple_assign_rhs_code (oedef);
+ linearize_expr_tree (&subops[i], oedef,
+ associative_tree_code (oecode), false);
+
+ for (j = 0; VEC_iterate (operand_entry_t, subops[i], j, oe1); ++j)
+ {
+ oecount c;
+ void **slot;
+ size_t idx;
+ c.oecode = oecode;
+ c.cnt = 1;
+ c.op = oe1->op;
+ VEC_safe_push (oecount, heap, cvec, &c);
+ idx = VEC_length (oecount, cvec) + 41;
+ slot = htab_find_slot (ctable, (void *)idx, INSERT);
+ if (!*slot)
+ {
+ *slot = (void *)idx;
+ }
+ else
+ {
+ VEC_pop (oecount, cvec);
+ VEC_index (oecount, cvec, (size_t)*slot - 42)->cnt++;
+ }
+ }
+ }
+ htab_delete (ctable);
+
+ /* Sort the counting table. */
+ qsort (VEC_address (oecount, cvec), VEC_length (oecount, cvec),
+ sizeof (oecount), oecount_cmp);
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ oecount *c;
+ fprintf (dump_file, "Candidates:\n");
+ for (j = 0; VEC_iterate (oecount, cvec, j, c); ++j)
+ {
+ fprintf (dump_file, " %u %s: ", c->cnt,
+ c->oecode == MULT_EXPR
+ ? "*" : c->oecode == RDIV_EXPR ? "/" : "?");
+ print_generic_expr (dump_file, c->op, 0);
+ fprintf (dump_file, "\n");
+ }
+ }
+
+ /* Process the (operand, code) pairs in order of most occurence. */
+ candidates2 = sbitmap_alloc (length);
+ while (!VEC_empty (oecount, cvec))
+ {
+ oecount *c = VEC_last (oecount, cvec);
+ if (c->cnt < 2)
+ break;
+
+ /* Now collect the operands in the outer chain that contain
+ the common operand in their inner chain. */
+ sbitmap_zero (candidates2);
+ nr_candidates2 = 0;
+ EXECUTE_IF_SET_IN_SBITMAP (candidates, 0, i, sbi0)
+ {
+ gimple oedef;
+ enum tree_code oecode;
+ unsigned j;
+ tree op = VEC_index (operand_entry_t, *ops, i)->op;
+
+ /* If we undistributed in this chain already this may be
+ a constant. */
+ if (TREE_CODE (op) != SSA_NAME)
+ continue;
+
+ oedef = SSA_NAME_DEF_STMT (op);
+ oecode = gimple_assign_rhs_code (oedef);
+ if (oecode != c->oecode)
+ continue;
+
+ for (j = 0; VEC_iterate (operand_entry_t, subops[i], j, oe1); ++j)
+ {
+ if (oe1->op == c->op)
+ {
+ SET_BIT (candidates2, i);
+ ++nr_candidates2;
+ break;
+ }
+ }
+ }
+
+ if (nr_candidates2 >= 2)
+ {
+ operand_entry_t oe1, oe2;
+ tree tmpvar;
+ gimple prod;
+ int first = sbitmap_first_set_bit (candidates2);
+
+ /* Build the new addition chain. */
+ oe1 = VEC_index (operand_entry_t, *ops, first);
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "Building (");
+ print_generic_expr (dump_file, oe1->op, 0);
+ }
+ tmpvar = create_tmp_var (TREE_TYPE (oe1->op), NULL);
+ add_referenced_var (tmpvar);
+ zero_one_operation (&oe1->op, c->oecode, c->op);
+ EXECUTE_IF_SET_IN_SBITMAP (candidates2, first+1, i, sbi0)
+ {
+ gimple sum;
+ oe2 = VEC_index (operand_entry_t, *ops, i);
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, " + ");
+ print_generic_expr (dump_file, oe2->op, 0);
+ }
+ zero_one_operation (&oe2->op, c->oecode, c->op);
+ sum = build_and_add_sum (tmpvar, oe1->op, oe2->op, opcode);
+ oe2->op = fold_convert (TREE_TYPE (oe2->op), integer_zero_node);
+ oe2->rank = 0;
+ oe1->op = gimple_get_lhs (sum);
+ }
+
+ /* Apply the multiplication/division. */
+ prod = build_and_add_sum (tmpvar, oe1->op, c->op, c->oecode);
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, ") %s ", c->oecode == MULT_EXPR ? "*" : "/");
+ print_generic_expr (dump_file, c->op, 0);
+ fprintf (dump_file, "\n");
+ }
+
+ /* Record it in the addition chain and disable further
+ undistribution with this op. */
+ oe1->op = gimple_assign_lhs (prod);
+ oe1->rank = get_rank (oe1->op);
+ VEC_free (operand_entry_t, heap, subops[first]);
+
+ changed = true;
+ }
+
+ VEC_pop (oecount, cvec);
+ }
+
+ for (i = 0; i < VEC_length (operand_entry_t, *ops); ++i)
+ VEC_free (operand_entry_t, heap, subops[i]);
+ free (subops);
+ VEC_free (oecount, heap, cvec);
+ sbitmap_free (candidates);
+ sbitmap_free (candidates2);
+
+ return changed;
+}
+
+
/* Perform various identities and other optimizations on the list of
operand entries, stored in OPS. The tree code for the binary
operation between all the operands is OPCODE. */
@@ -806,18 +1220,20 @@ optimize_ops_list (enum tree_code opcode,
update" operation. */
static bool
-is_phi_for_stmt (tree stmt, tree operand)
+is_phi_for_stmt (gimple stmt, tree operand)
{
- tree def_stmt;
- tree lhs = GIMPLE_STMT_OPERAND (stmt, 0);
+ gimple def_stmt;
+ tree lhs;
use_operand_p arg_p;
ssa_op_iter i;
if (TREE_CODE (operand) != SSA_NAME)
return false;
+ lhs = gimple_assign_lhs (stmt);
+
def_stmt = SSA_NAME_DEF_STMT (operand);
- if (TREE_CODE (def_stmt) != PHI_NODE)
+ if (gimple_code (def_stmt) != GIMPLE_PHI)
return false;
FOR_EACH_PHI_ARG (arg_p, def_stmt, i, SSA_OP_USE)
@@ -831,10 +1247,11 @@ is_phi_for_stmt (tree stmt, tree operand)
order. */
static void
-rewrite_expr_tree (tree stmt, unsigned int opindex,
+rewrite_expr_tree (gimple stmt, unsigned int opindex,
VEC(operand_entry_t, heap) * ops)
{
- tree rhs = GIMPLE_STMT_OPERAND (stmt, 1);
+ tree rhs1 = gimple_assign_rhs1 (stmt);
+ tree rhs2 = gimple_assign_rhs2 (stmt);
operand_entry_t oe;
/* If we have three operands left, then we want to make sure the one
@@ -897,24 +1314,22 @@ rewrite_expr_tree (tree stmt, unsigned int opindex,
oe1 = VEC_index (operand_entry_t, ops, opindex);
oe2 = VEC_index (operand_entry_t, ops, opindex + 1);
- if (TREE_OPERAND (rhs, 0) != oe1->op
- || TREE_OPERAND (rhs, 1) != oe2->op)
+ if (rhs1 != oe1->op || rhs2 != oe2->op)
{
-
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Transforming ");
- print_generic_expr (dump_file, rhs, 0);
+ print_gimple_stmt (dump_file, stmt, 0, 0);
}
- TREE_OPERAND (rhs, 0) = oe1->op;
- TREE_OPERAND (rhs, 1) = oe2->op;
+ gimple_assign_set_rhs1 (stmt, oe1->op);
+ gimple_assign_set_rhs2 (stmt, oe2->op);
update_stmt (stmt);
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, " into ");
- print_generic_stmt (dump_file, rhs, 0);
+ print_gimple_stmt (dump_file, stmt, 0, 0);
}
}
@@ -927,28 +1342,27 @@ rewrite_expr_tree (tree stmt, unsigned int opindex,
/* Rewrite the next operator. */
oe = VEC_index (operand_entry_t, ops, opindex);
- if (oe->op != TREE_OPERAND (rhs, 1))
+ if (oe->op != rhs2)
{
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Transforming ");
- print_generic_expr (dump_file, rhs, 0);
+ print_gimple_stmt (dump_file, stmt, 0, 0);
}
- TREE_OPERAND (rhs, 1) = oe->op;
+ gimple_assign_set_rhs2 (stmt, oe->op);
update_stmt (stmt);
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, " into ");
- print_generic_stmt (dump_file, rhs, 0);
+ print_gimple_stmt (dump_file, stmt, 0, 0);
}
}
/* Recurse on the LHS of the binary operator, which is guaranteed to
be the non-leaf side. */
- rewrite_expr_tree (SSA_NAME_DEF_STMT (TREE_OPERAND (rhs, 0)),
- opindex + 1, ops);
+ rewrite_expr_tree (SSA_NAME_DEF_STMT (rhs1), opindex + 1, ops);
}
/* Transform STMT, which is really (A +B) + (C + D) into the left
@@ -956,114 +1370,114 @@ rewrite_expr_tree (tree stmt, unsigned int opindex,
Recurse on D if necessary. */
static void
-linearize_expr (tree stmt)
+linearize_expr (gimple stmt)
{
- block_stmt_iterator bsinow, bsirhs;
- tree rhs = GIMPLE_STMT_OPERAND (stmt, 1);
- enum tree_code rhscode = TREE_CODE (rhs);
- tree binrhs = SSA_NAME_DEF_STMT (TREE_OPERAND (rhs, 1));
- tree binlhs = SSA_NAME_DEF_STMT (TREE_OPERAND (rhs, 0));
- tree newbinrhs = NULL_TREE;
+ gimple_stmt_iterator gsinow, gsirhs;
+ gimple binlhs = SSA_NAME_DEF_STMT (gimple_assign_rhs1 (stmt));
+ gimple binrhs = SSA_NAME_DEF_STMT (gimple_assign_rhs2 (stmt));
+ enum tree_code rhscode = gimple_assign_rhs_code (stmt);
+ gimple newbinrhs = NULL;
struct loop *loop = loop_containing_stmt (stmt);
- gcc_assert (is_reassociable_op (binlhs, TREE_CODE (rhs), loop)
- && is_reassociable_op (binrhs, TREE_CODE (rhs), loop));
+ gcc_assert (is_reassociable_op (binlhs, rhscode, loop)
+ && is_reassociable_op (binrhs, rhscode, loop));
- bsinow = bsi_for_stmt (stmt);
- bsirhs = bsi_for_stmt (binrhs);
- bsi_move_before (&bsirhs, &bsinow);
+ gsinow = gsi_for_stmt (stmt);
+ gsirhs = gsi_for_stmt (binrhs);
+ gsi_move_before (&gsirhs, &gsinow);
- TREE_OPERAND (rhs, 1) = TREE_OPERAND (GIMPLE_STMT_OPERAND (binrhs, 1), 0);
- if (TREE_CODE (TREE_OPERAND (rhs, 1)) == SSA_NAME)
- newbinrhs = SSA_NAME_DEF_STMT (TREE_OPERAND (rhs, 1));
- TREE_OPERAND (GIMPLE_STMT_OPERAND (binrhs, 1), 0)
- = GIMPLE_STMT_OPERAND (binlhs, 0);
- TREE_OPERAND (rhs, 0) = GIMPLE_STMT_OPERAND (binrhs, 0);
+ gimple_assign_set_rhs2 (stmt, gimple_assign_rhs1 (binrhs));
+ gimple_assign_set_rhs1 (binrhs, gimple_assign_lhs (binlhs));
+ gimple_assign_set_rhs1 (stmt, gimple_assign_lhs (binrhs));
+
+ if (TREE_CODE (gimple_assign_rhs2 (stmt)) == SSA_NAME)
+ newbinrhs = SSA_NAME_DEF_STMT (gimple_assign_rhs2 (stmt));
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Linearized: ");
- print_generic_stmt (dump_file, rhs, 0);
+ print_gimple_stmt (dump_file, stmt, 0, 0);
}
reassociate_stats.linearized++;
update_stmt (binrhs);
update_stmt (binlhs);
update_stmt (stmt);
- TREE_VISITED (binrhs) = 1;
- TREE_VISITED (binlhs) = 1;
- TREE_VISITED (stmt) = 1;
+
+ gimple_set_visited (stmt, true);
+ gimple_set_visited (binlhs, true);
+ gimple_set_visited (binrhs, true);
/* Tail recurse on the new rhs if it still needs reassociation. */
if (newbinrhs && is_reassociable_op (newbinrhs, rhscode, loop))
+ /* ??? This should probably be linearize_expr (newbinrhs) but I don't
+ want to change the algorithm while converting to tuples. */
linearize_expr (stmt);
}
-/* If LHS has a single immediate use that is a GIMPLE_MODIFY_STMT, return
+/* If LHS has a single immediate use that is a GIMPLE_ASSIGN statement, return
it. Otherwise, return NULL. */
-static tree
+static gimple
get_single_immediate_use (tree lhs)
{
use_operand_p immuse;
- tree immusestmt;
+ gimple immusestmt;
if (TREE_CODE (lhs) == SSA_NAME
- && single_imm_use (lhs, &immuse, &immusestmt))
- {
- if (TREE_CODE (immusestmt) == RETURN_EXPR)
- immusestmt = TREE_OPERAND (immusestmt, 0);
- if (TREE_CODE (immusestmt) == GIMPLE_MODIFY_STMT)
- return immusestmt;
- }
- return NULL_TREE;
+ && single_imm_use (lhs, &immuse, &immusestmt)
+ && is_gimple_assign (immusestmt))
+ return immusestmt;
+
+ return NULL;
}
-static VEC(tree, heap) *broken_up_subtracts;
+static VEC(tree, heap) *broken_up_subtracts;
/* Recursively negate the value of TONEGATE, and return the SSA_NAME
representing the negated value. Insertions of any necessary
- instructions go before BSI.
+ instructions go before GSI.
This function is recursive in that, if you hand it "a_5" as the
value to negate, and a_5 is defined by "a_5 = b_3 + b_4", it will
transform b_3 + b_4 into a_5 = -b_3 + -b_4. */
static tree
-negate_value (tree tonegate, block_stmt_iterator *bsi)
+negate_value (tree tonegate, gimple_stmt_iterator *gsi)
{
- tree negatedef = tonegate;
+ gimple negatedefstmt= NULL;
tree resultofnegate;
- if (TREE_CODE (tonegate) == SSA_NAME)
- negatedef = SSA_NAME_DEF_STMT (tonegate);
-
/* If we are trying to negate a name, defined by an add, negate the
add operands instead. */
+ if (TREE_CODE (tonegate) == SSA_NAME)
+ negatedefstmt = SSA_NAME_DEF_STMT (tonegate);
if (TREE_CODE (tonegate) == SSA_NAME
- && TREE_CODE (negatedef) == GIMPLE_MODIFY_STMT
- && TREE_CODE (GIMPLE_STMT_OPERAND (negatedef, 0)) == SSA_NAME
- && has_single_use (GIMPLE_STMT_OPERAND (negatedef, 0))
- && TREE_CODE (GIMPLE_STMT_OPERAND (negatedef, 1)) == PLUS_EXPR)
+ && is_gimple_assign (negatedefstmt)
+ && TREE_CODE (gimple_assign_lhs (negatedefstmt)) == SSA_NAME
+ && has_single_use (gimple_assign_lhs (negatedefstmt))
+ && gimple_assign_rhs_code (negatedefstmt) == PLUS_EXPR)
{
- block_stmt_iterator bsi;
- tree binop = GIMPLE_STMT_OPERAND (negatedef, 1);
-
- bsi = bsi_for_stmt (negatedef);
- TREE_OPERAND (binop, 0) = negate_value (TREE_OPERAND (binop, 0),
- &bsi);
- bsi = bsi_for_stmt (negatedef);
- TREE_OPERAND (binop, 1) = negate_value (TREE_OPERAND (binop, 1),
- &bsi);
- update_stmt (negatedef);
- return GIMPLE_STMT_OPERAND (negatedef, 0);
+ gimple_stmt_iterator gsi;
+ tree rhs1 = gimple_assign_rhs1 (negatedefstmt);
+ tree rhs2 = gimple_assign_rhs2 (negatedefstmt);
+
+ gsi = gsi_for_stmt (negatedefstmt);
+ rhs1 = negate_value (rhs1, &gsi);
+ gimple_assign_set_rhs1 (negatedefstmt, rhs1);
+
+ gsi = gsi_for_stmt (negatedefstmt);
+ rhs2 = negate_value (rhs2, &gsi);
+ gimple_assign_set_rhs2 (negatedefstmt, rhs2);
+
+ update_stmt (negatedefstmt);
+ return gimple_assign_lhs (negatedefstmt);
}
tonegate = fold_build1 (NEGATE_EXPR, TREE_TYPE (tonegate), tonegate);
- resultofnegate = force_gimple_operand_bsi (bsi, tonegate, true,
- NULL_TREE, true, BSI_SAME_STMT);
+ resultofnegate = force_gimple_operand_gsi (gsi, tonegate, true,
+ NULL_TREE, true, GSI_SAME_STMT);
VEC_safe_push (tree, heap, broken_up_subtracts, resultofnegate);
return resultofnegate;
-
}
/* Return true if we should break up the subtract in STMT into an add
@@ -1073,14 +1487,12 @@ negate_value (tree tonegate, block_stmt_iterator *bsi)
exposes the adds to reassociation. */
static bool
-should_break_up_subtract (tree stmt)
+should_break_up_subtract (gimple stmt)
{
-
- tree lhs = GIMPLE_STMT_OPERAND (stmt, 0);
- tree rhs = GIMPLE_STMT_OPERAND (stmt, 1);
- tree binlhs = TREE_OPERAND (rhs, 0);
- tree binrhs = TREE_OPERAND (rhs, 1);
- tree immusestmt;
+ tree lhs = gimple_assign_lhs (stmt);
+ tree binlhs = gimple_assign_rhs1 (stmt);
+ tree binrhs = gimple_assign_rhs2 (stmt);
+ gimple immusestmt;
struct loop *loop = loop_containing_stmt (stmt);
if (TREE_CODE (binlhs) == SSA_NAME
@@ -1093,28 +1505,29 @@ should_break_up_subtract (tree stmt)
if (TREE_CODE (lhs) == SSA_NAME
&& (immusestmt = get_single_immediate_use (lhs))
- && TREE_CODE (GIMPLE_STMT_OPERAND (immusestmt, 1)) == PLUS_EXPR)
+ && is_gimple_assign (immusestmt)
+ && (gimple_assign_rhs_code (immusestmt) == PLUS_EXPR
+ || gimple_assign_rhs_code (immusestmt) == MULT_EXPR))
return true;
return false;
-
}
/* Transform STMT from A - B into A + -B. */
static void
-break_up_subtract (tree stmt, block_stmt_iterator *bsi)
+break_up_subtract (gimple stmt, gimple_stmt_iterator *gsip)
{
- tree rhs = GIMPLE_STMT_OPERAND (stmt, 1);
+ tree rhs1 = gimple_assign_rhs1 (stmt);
+ tree rhs2 = gimple_assign_rhs2 (stmt);
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Breaking up subtract ");
- print_generic_stmt (dump_file, stmt, 0);
+ print_gimple_stmt (dump_file, stmt, 0, 0);
}
- TREE_SET_CODE (GIMPLE_STMT_OPERAND (stmt, 1), PLUS_EXPR);
- TREE_OPERAND (rhs, 1) = negate_value (TREE_OPERAND (rhs, 1), bsi);
-
+ rhs2 = negate_value (rhs2, gsip);
+ gimple_assign_set_rhs_with_ops (gsip, PLUS_EXPR, rhs1, rhs2);
update_stmt (stmt);
}
@@ -1122,19 +1535,20 @@ break_up_subtract (tree stmt, block_stmt_iterator *bsi)
Place the operands of the expression tree in the vector named OPS. */
static void
-linearize_expr_tree (VEC(operand_entry_t, heap) **ops, tree stmt)
+linearize_expr_tree (VEC(operand_entry_t, heap) **ops, gimple stmt,
+ bool is_associative, bool set_visited)
{
- block_stmt_iterator bsinow, bsilhs;
- tree rhs = GENERIC_TREE_OPERAND (stmt, 1);
- tree binrhs = TREE_OPERAND (rhs, 1);
- tree binlhs = TREE_OPERAND (rhs, 0);
- tree binlhsdef, binrhsdef;
+ gimple_stmt_iterator gsinow, gsilhs;
+ tree binlhs = gimple_assign_rhs1 (stmt);
+ tree binrhs = gimple_assign_rhs2 (stmt);
+ gimple binlhsdef, binrhsdef;
bool binlhsisreassoc = false;
bool binrhsisreassoc = false;
- enum tree_code rhscode = TREE_CODE (rhs);
+ enum tree_code rhscode = gimple_assign_rhs_code (stmt);
struct loop *loop = loop_containing_stmt (stmt);
- TREE_VISITED (stmt) = 1;
+ if (set_visited)
+ gimple_set_visited (stmt, true);
if (TREE_CODE (binlhs) == SSA_NAME)
{
@@ -1158,6 +1572,13 @@ linearize_expr_tree (VEC(operand_entry_t, heap) **ops, tree stmt)
{
tree temp;
+ /* If this is not a associative operation like division, give up. */
+ if (!is_associative)
+ {
+ add_to_ops_vec (ops, binrhs);
+ return;
+ }
+
if (!binrhsisreassoc)
{
add_to_ops_vec (ops, binrhs);
@@ -1168,17 +1589,18 @@ linearize_expr_tree (VEC(operand_entry_t, heap) **ops, tree stmt)
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "swapping operands of ");
- print_generic_expr (dump_file, stmt, 0);
+ print_gimple_stmt (dump_file, stmt, 0, 0);
}
- swap_tree_operands (stmt, &TREE_OPERAND (rhs, 0),
- &TREE_OPERAND (rhs, 1));
+ swap_tree_operands (stmt,
+ gimple_assign_rhs1_ptr (stmt),
+ gimple_assign_rhs2_ptr (stmt));
update_stmt (stmt);
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, " is now ");
- print_generic_stmt (dump_file, stmt, 0);
+ print_gimple_stmt (dump_file, stmt, 0, 0);
}
/* We want to make it so the lhs is always the reassociative op,
@@ -1190,18 +1612,18 @@ linearize_expr_tree (VEC(operand_entry_t, heap) **ops, tree stmt)
else if (binrhsisreassoc)
{
linearize_expr (stmt);
- gcc_assert (rhs == GIMPLE_STMT_OPERAND (stmt, 1));
- binlhs = TREE_OPERAND (rhs, 0);
- binrhs = TREE_OPERAND (rhs, 1);
+ binlhs = gimple_assign_rhs1 (stmt);
+ binrhs = gimple_assign_rhs2 (stmt);
}
gcc_assert (TREE_CODE (binrhs) != SSA_NAME
|| !is_reassociable_op (SSA_NAME_DEF_STMT (binrhs),
rhscode, loop));
- bsinow = bsi_for_stmt (stmt);
- bsilhs = bsi_for_stmt (SSA_NAME_DEF_STMT (binlhs));
- bsi_move_before (&bsilhs, &bsinow);
- linearize_expr_tree (ops, SSA_NAME_DEF_STMT (binlhs));
+ gsinow = gsi_for_stmt (stmt);
+ gsilhs = gsi_for_stmt (SSA_NAME_DEF_STMT (binlhs));
+ gsi_move_before (&gsilhs, &gsinow);
+ linearize_expr_tree (ops, SSA_NAME_DEF_STMT (binlhs),
+ is_associative, set_visited);
add_to_ops_vec (ops, binrhs);
}
@@ -1216,7 +1638,7 @@ repropagate_negates (void)
for (i = 0; VEC_iterate (tree, broken_up_subtracts, i, negate); i++)
{
- tree user = get_single_immediate_use (negate);
+ gimple user = get_single_immediate_use (negate);
/* The negate operand can be either operand of a PLUS_EXPR
(it can be the LHS if the RHS is a constant for example).
@@ -1224,27 +1646,27 @@ repropagate_negates (void)
Force the negate operand to the RHS of the PLUS_EXPR, then
transform the PLUS_EXPR into a MINUS_EXPR. */
if (user
- && TREE_CODE (user) == GIMPLE_MODIFY_STMT
- && TREE_CODE (GIMPLE_STMT_OPERAND (user, 1)) == PLUS_EXPR)
+ && is_gimple_assign (user)
+ && gimple_assign_rhs_code (user) == PLUS_EXPR)
{
- tree rhs = GIMPLE_STMT_OPERAND (user, 1);
-
/* If the negated operand appears on the LHS of the
PLUS_EXPR, exchange the operands of the PLUS_EXPR
to force the negated operand to the RHS of the PLUS_EXPR. */
- if (TREE_OPERAND (GIMPLE_STMT_OPERAND (user, 1), 0) == negate)
+ if (gimple_assign_rhs1 (user) == negate)
{
- tree temp = TREE_OPERAND (rhs, 0);
- TREE_OPERAND (rhs, 0) = TREE_OPERAND (rhs, 1);
- TREE_OPERAND (rhs, 1) = temp;
+ swap_tree_operands (user,
+ gimple_assign_rhs1_ptr (user),
+ gimple_assign_rhs2_ptr (user));
}
/* Now transform the PLUS_EXPR into a MINUS_EXPR and replace
the RHS of the PLUS_EXPR with the operand of the NEGATE_EXPR. */
- if (TREE_OPERAND (GIMPLE_STMT_OPERAND (user, 1), 1) == negate)
+ if (gimple_assign_rhs2 (user) == negate)
{
- TREE_SET_CODE (rhs, MINUS_EXPR);
- TREE_OPERAND (rhs, 1) = get_unary_op (negate, NEGATE_EXPR);
+ tree rhs1 = gimple_assign_rhs1 (user);
+ tree rhs2 = get_unary_op (negate, NEGATE_EXPR);
+ gimple_stmt_iterator gsi = gsi_for_stmt (user);
+ gimple_assign_set_rhs_with_ops (&gsi, MINUS_EXPR, rhs1, rhs2);
update_stmt (user);
}
}
@@ -1264,43 +1686,50 @@ repropagate_negates (void)
k = t - q
we want to break up k = t - q, but we won't until we've transformed q
- = b - r, which won't be broken up until we transform b = c - d. */
+ = b - r, which won't be broken up until we transform b = c - d.
+
+ En passant, clear the GIMPLE visited flag on every statement. */
static void
break_up_subtract_bb (basic_block bb)
{
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
basic_block son;
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- tree stmt = bsi_stmt (bsi);
+ gimple stmt = gsi_stmt (gsi);
+ gimple_set_visited (stmt, false);
- if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT)
+ /* Look for simple gimple subtract operations. */
+ if (is_gimple_assign (stmt)
+ && gimple_assign_rhs_code (stmt) == MINUS_EXPR)
{
- tree lhs = GIMPLE_STMT_OPERAND (stmt, 0);
- tree rhs = GIMPLE_STMT_OPERAND (stmt, 1);
+ tree lhs = gimple_assign_lhs (stmt);
+ tree rhs1 = gimple_assign_rhs1 (stmt);
+ tree rhs2 = gimple_assign_rhs2 (stmt);
- TREE_VISITED (stmt) = 0;
/* If associative-math we can do reassociation for
non-integral types. Or, we can do reassociation for
non-saturating fixed-point types. */
if ((!INTEGRAL_TYPE_P (TREE_TYPE (lhs))
- || !INTEGRAL_TYPE_P (TREE_TYPE (rhs)))
- && (!SCALAR_FLOAT_TYPE_P (TREE_TYPE (rhs))
- || !SCALAR_FLOAT_TYPE_P (TREE_TYPE(lhs))
+ || !INTEGRAL_TYPE_P (TREE_TYPE (rhs1))
+ || !INTEGRAL_TYPE_P (TREE_TYPE (rhs2)))
+ && (!SCALAR_FLOAT_TYPE_P (TREE_TYPE (lhs))
+ || !SCALAR_FLOAT_TYPE_P (TREE_TYPE(rhs1))
+ || !SCALAR_FLOAT_TYPE_P (TREE_TYPE(rhs2))
|| !flag_associative_math)
- && (!NON_SAT_FIXED_POINT_TYPE_P (TREE_TYPE (rhs))
- || !NON_SAT_FIXED_POINT_TYPE_P (TREE_TYPE(lhs))))
+ && (!NON_SAT_FIXED_POINT_TYPE_P (TREE_TYPE (lhs))
+ || !NON_SAT_FIXED_POINT_TYPE_P (TREE_TYPE(rhs1))
+ || !NON_SAT_FIXED_POINT_TYPE_P (TREE_TYPE(rhs2))))
continue;
/* Check for a subtract used only in an addition. If this
is the case, transform it into add of a negate for better
reassociation. IE transform C = A-B into C = A + -B if C
is only used in an addition. */
- if (TREE_CODE (rhs) == MINUS_EXPR)
- if (should_break_up_subtract (stmt))
- break_up_subtract (stmt, &bsi);
+ if (should_break_up_subtract (stmt))
+ break_up_subtract (stmt, &gsi);
}
}
for (son = first_dom_son (CDI_DOMINATORS, bb);
@@ -1315,36 +1744,57 @@ break_up_subtract_bb (basic_block bb)
static void
reassociate_bb (basic_block bb)
{
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
basic_block son;
- for (bsi = bsi_last (bb); !bsi_end_p (bsi); bsi_prev (&bsi))
+ for (gsi = gsi_last_bb (bb); !gsi_end_p (gsi); gsi_prev (&gsi))
{
- tree stmt = bsi_stmt (bsi);
+ gimple stmt = gsi_stmt (gsi);
- if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT)
+ if (is_gimple_assign (stmt))
{
- tree lhs = GIMPLE_STMT_OPERAND (stmt, 0);
- tree rhs = GIMPLE_STMT_OPERAND (stmt, 1);
+ tree lhs, rhs1, rhs2;
+ enum tree_code rhs_code = gimple_assign_rhs_code (stmt);
- /* If this was part of an already processed tree, we don't
- need to touch it again. */
- if (TREE_VISITED (stmt))
+ /* If this is not a gimple binary expression, there is
+ nothing for us to do with it. */
+ if (get_gimple_rhs_class (rhs_code) != GIMPLE_BINARY_RHS)
continue;
+ /* If this was part of an already processed statement,
+ we don't need to touch it again. */
+ if (gimple_visited_p (stmt))
+ {
+ /* This statement might have become dead because of previous
+ reassociations. */
+ if (has_zero_uses (gimple_get_lhs (stmt)))
+ {
+ gsi_remove (&gsi, true);
+ release_defs (stmt);
+ }
+ continue;
+ }
+
+ lhs = gimple_assign_lhs (stmt);
+ rhs1 = gimple_assign_rhs1 (stmt);
+ rhs2 = gimple_assign_rhs2 (stmt);
+
/* If associative-math we can do reassociation for
non-integral types. Or, we can do reassociation for
non-saturating fixed-point types. */
if ((!INTEGRAL_TYPE_P (TREE_TYPE (lhs))
- || !INTEGRAL_TYPE_P (TREE_TYPE (rhs)))
- && (!SCALAR_FLOAT_TYPE_P (TREE_TYPE (rhs))
- || !SCALAR_FLOAT_TYPE_P (TREE_TYPE(lhs))
+ || !INTEGRAL_TYPE_P (TREE_TYPE (rhs1))
+ || !INTEGRAL_TYPE_P (TREE_TYPE (rhs2)))
+ && (!SCALAR_FLOAT_TYPE_P (TREE_TYPE (lhs))
+ || !SCALAR_FLOAT_TYPE_P (TREE_TYPE(rhs1))
+ || !SCALAR_FLOAT_TYPE_P (TREE_TYPE(rhs2))
|| !flag_associative_math)
- && (!NON_SAT_FIXED_POINT_TYPE_P (TREE_TYPE (rhs))
- || !NON_SAT_FIXED_POINT_TYPE_P (TREE_TYPE(lhs))))
+ && (!NON_SAT_FIXED_POINT_TYPE_P (TREE_TYPE (lhs))
+ || !NON_SAT_FIXED_POINT_TYPE_P (TREE_TYPE(rhs1))
+ || !NON_SAT_FIXED_POINT_TYPE_P (TREE_TYPE(rhs2))))
continue;
- if (associative_tree_code (TREE_CODE (rhs)))
+ if (associative_tree_code (rhs_code))
{
VEC(operand_entry_t, heap) *ops = NULL;
@@ -1353,30 +1803,40 @@ reassociate_bb (basic_block bb)
if (TREE_CODE (lhs) == SSA_NAME && has_zero_uses (lhs))
continue;
- TREE_VISITED (stmt) = 1;
- linearize_expr_tree (&ops, stmt);
+ gimple_set_visited (stmt, true);
+ linearize_expr_tree (&ops, stmt, true, true);
qsort (VEC_address (operand_entry_t, ops),
VEC_length (operand_entry_t, ops),
sizeof (operand_entry_t),
sort_by_operand_rank);
- optimize_ops_list (TREE_CODE (rhs), &ops);
+ optimize_ops_list (rhs_code, &ops);
+ if (undistribute_ops_list (rhs_code, &ops,
+ loop_containing_stmt (stmt)))
+ {
+ qsort (VEC_address (operand_entry_t, ops),
+ VEC_length (operand_entry_t, ops),
+ sizeof (operand_entry_t),
+ sort_by_operand_rank);
+ optimize_ops_list (rhs_code, &ops);
+ }
if (VEC_length (operand_entry_t, ops) == 1)
{
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Transforming ");
- print_generic_expr (dump_file, rhs, 0);
+ print_gimple_stmt (dump_file, stmt, 0, 0);
}
- GIMPLE_STMT_OPERAND (stmt, 1)
- = VEC_last (operand_entry_t, ops)->op;
+
+ gimple_assign_set_rhs_from_tree (&gsi,
+ VEC_last (operand_entry_t,
+ ops)->op);
update_stmt (stmt);
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, " into ");
- print_generic_stmt (dump_file,
- GIMPLE_STMT_OPERAND (stmt, 1), 0);
+ print_gimple_stmt (dump_file, stmt, 0, 0);
}
}
else
@@ -1408,7 +1868,7 @@ dump_ops_vector (FILE *file, VEC (operand_entry_t, heap) *ops)
for (i = 0; VEC_iterate (operand_entry_t, ops, i, oe); i++)
{
fprintf (file, "Op %d -> rank: %d, tree: ", i, oe->rank);
- print_generic_stmt (file, oe->op, 0);
+ print_generic_expr (file, oe->op, 0);
}
}
@@ -1542,3 +2002,4 @@ struct gimple_opt_pass pass_reassoc =
TODO_dump_func | TODO_ggc_collect | TODO_verify_ssa /* todo_flags_finish */
}
};
+
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index f1318656b9b..f502440b46f 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -29,7 +29,7 @@ along with GCC; see the file COPYING3. If not see
#include "diagnostic.h"
#include "tree-inline.h"
#include "tree-flow.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "tree-dump.h"
#include "timevar.h"
#include "fibheap.h"
@@ -210,6 +210,86 @@ VN_INFO_GET (tree name)
}
+/* Get the representative expression for the SSA_NAME NAME. Returns
+ the representative SSA_NAME if there is no expression associated with it. */
+
+tree
+vn_get_expr_for (tree name)
+{
+ vn_ssa_aux_t vn = VN_INFO (name);
+ gimple def_stmt;
+ tree expr = NULL_TREE;
+
+ if (vn->valnum == VN_TOP)
+ return name;
+
+ /* If the value-number is a constant it is the representative
+ expression. */
+ if (TREE_CODE (vn->valnum) != SSA_NAME)
+ return vn->valnum;
+
+ /* Get to the information of the value of this SSA_NAME. */
+ vn = VN_INFO (vn->valnum);
+
+ /* If the value-number is a constant it is the representative
+ expression. */
+ if (TREE_CODE (vn->valnum) != SSA_NAME)
+ return vn->valnum;
+
+ /* Else if we have an expression, return it. */
+ if (vn->expr != NULL_TREE)
+ return vn->expr;
+
+ /* Otherwise use the defining statement to build the expression. */
+ def_stmt = SSA_NAME_DEF_STMT (vn->valnum);
+
+ /* If the value number is a default-definition or a PHI result
+ use it directly. */
+ if (gimple_nop_p (def_stmt)
+ || gimple_code (def_stmt) == GIMPLE_PHI)
+ return vn->valnum;
+
+ if (!is_gimple_assign (def_stmt))
+ return vn->valnum;
+
+ /* FIXME tuples. This is incomplete and likely will miss some
+ simplifications. */
+ switch (TREE_CODE_CLASS (gimple_assign_rhs_code (def_stmt)))
+ {
+ case tcc_reference:
+ if (gimple_assign_rhs_code (def_stmt) == VIEW_CONVERT_EXPR
+ && gimple_assign_rhs_code (def_stmt) == REALPART_EXPR
+ && gimple_assign_rhs_code (def_stmt) == IMAGPART_EXPR)
+ expr = fold_build1 (gimple_assign_rhs_code (def_stmt),
+ gimple_expr_type (def_stmt),
+ TREE_OPERAND (gimple_assign_rhs1 (def_stmt), 0));
+ break;
+
+ case tcc_unary:
+ expr = fold_build1 (gimple_assign_rhs_code (def_stmt),
+ gimple_expr_type (def_stmt),
+ gimple_assign_rhs1 (def_stmt));
+ break;
+
+ case tcc_binary:
+ expr = fold_build2 (gimple_assign_rhs_code (def_stmt),
+ gimple_expr_type (def_stmt),
+ gimple_assign_rhs1 (def_stmt),
+ gimple_assign_rhs2 (def_stmt));
+ break;
+
+ default:;
+ }
+ if (expr == NULL_TREE)
+ return vn->valnum;
+
+ /* Cache the expression. */
+ vn->expr = expr;
+
+ return expr;
+}
+
+
/* Free a phi operation structure VP. */
static void
@@ -236,7 +316,7 @@ vn_constant_eq (const void *p1, const void *p2)
const struct vn_constant_s *vc1 = (const struct vn_constant_s *) p1;
const struct vn_constant_s *vc2 = (const struct vn_constant_s *) p2;
- return expressions_equal_p (vc1->constant, vc2->constant);
+ return vn_constant_eq_with_type (vc1->constant, vc2->constant);
}
/* Hash table hash function for vn_constant_t. */
@@ -248,6 +328,24 @@ vn_constant_hash (const void *p1)
return vc1->hashcode;
}
+/* Lookup a value id for CONSTANT and return it. If it does not
+ exist returns 0. */
+
+unsigned int
+get_constant_value_id (tree constant)
+{
+ void **slot;
+ struct vn_constant_s vc;
+
+ vc.hashcode = vn_hash_constant_with_type (constant);
+ vc.constant = constant;
+ slot = htab_find_slot_with_hash (constant_to_value_id, &vc,
+ vc.hashcode, NO_INSERT);
+ if (slot)
+ return ((vn_constant_t)*slot)->value_id;
+ return 0;
+}
+
/* Lookup a value id for CONSTANT, and if it does not exist, create a
new one and return it. If it does exist, return it. */
@@ -257,7 +355,7 @@ get_or_alloc_constant_value_id (tree constant)
void **slot;
vn_constant_t vc = XNEW (struct vn_constant_s);
- vc->hashcode = iterative_hash_expr (constant, 0);
+ vc->hashcode = vn_hash_constant_with_type (constant);
vc->constant = constant;
slot = htab_find_slot_with_hash (constant_to_value_id, vc,
vc->hashcode, INSERT);
@@ -301,7 +399,8 @@ static hashval_t
vn_reference_op_compute_hash (const vn_reference_op_t vro1)
{
return iterative_hash_expr (vro1->op0, vro1->opcode)
- + iterative_hash_expr (vro1->op1, vro1->opcode);
+ + iterative_hash_expr (vro1->op1, vro1->opcode)
+ + iterative_hash_expr (vro1->op2, vro1->opcode);
}
/* Return the hashcode for a given reference operation P1. */
@@ -380,7 +479,7 @@ vn_reference_eq (const void *p1, const void *p2)
/* Place the vuses from STMT into *result. */
static inline void
-vuses_to_vec (tree stmt, VEC (tree, gc) **result)
+vuses_to_vec (gimple stmt, VEC (tree, gc) **result)
{
ssa_op_iter iter;
tree vuse;
@@ -400,7 +499,7 @@ vuses_to_vec (tree stmt, VEC (tree, gc) **result)
the vector. */
VEC (tree, gc) *
-copy_vuses_from_stmt (tree stmt)
+copy_vuses_from_stmt (gimple stmt)
{
VEC (tree, gc) *vuses = NULL;
@@ -412,7 +511,7 @@ copy_vuses_from_stmt (tree stmt)
/* Place the vdefs from STMT into *result. */
static inline void
-vdefs_to_vec (tree stmt, VEC (tree, gc) **result)
+vdefs_to_vec (gimple stmt, VEC (tree, gc) **result)
{
ssa_op_iter iter;
tree vdef;
@@ -430,7 +529,7 @@ vdefs_to_vec (tree stmt, VEC (tree, gc) **result)
the vector. */
static VEC (tree, gc) *
-copy_vdefs_from_stmt (tree stmt)
+copy_vdefs_from_stmt (gimple stmt)
{
VEC (tree, gc) *vdefs = NULL;
@@ -447,7 +546,7 @@ static VEC (tree, gc) *shared_lookup_vops;
variable. */
VEC (tree, gc) *
-shared_vuses_from_stmt (tree stmt)
+shared_vuses_from_stmt (gimple stmt)
{
VEC_truncate (tree, shared_lookup_vops, 0);
vuses_to_vec (stmt, &shared_lookup_vops);
@@ -455,54 +554,12 @@ shared_vuses_from_stmt (tree stmt)
return shared_lookup_vops;
}
-/* Copy the operations present in load/store/call REF into RESULT, a vector of
+/* Copy the operations present in load/store REF into RESULT, a vector of
vn_reference_op_s's. */
-static void
+void
copy_reference_ops_from_ref (tree ref, VEC(vn_reference_op_s, heap) **result)
{
- /* Calls are different from all other reference operations. */
- if (TREE_CODE (ref) == CALL_EXPR)
- {
- vn_reference_op_s temp;
- tree callfn;
- call_expr_arg_iterator iter;
- tree callarg;
-
- /* Copy the call_expr opcode, type, function being called, and
- arguments. */
- memset (&temp, 0, sizeof (temp));
- temp.type = TREE_TYPE (ref);
- temp.opcode = CALL_EXPR;
- VEC_safe_push (vn_reference_op_s, heap, *result, &temp);
-
- /* We make no attempt to simplify the called function because
- the typical &FUNCTION_DECL form is also used in function pointer
- cases that become constant. If we simplify the original to
- FUNCTION_DECL but not the function pointer case (which can
- happen because we have no fold functions that operate on
- vn_reference_t), we will claim they are not equivalent.
-
- An example of this behavior can be see if CALL_EXPR_FN below is
- replaced with get_callee_fndecl and gcc.dg/tree-ssa/ssa-pre-13.c
- is compiled. */
- callfn = CALL_EXPR_FN (ref);
- temp.type = TREE_TYPE (callfn);
- temp.opcode = TREE_CODE (callfn);
- temp.op0 = callfn;
- VEC_safe_push (vn_reference_op_s, heap, *result, &temp);
-
- FOR_EACH_CALL_EXPR_ARG (callarg, iter, ref)
- {
- memset (&temp, 0, sizeof (temp));
- temp.type = TREE_TYPE (callarg);
- temp.opcode = TREE_CODE (callarg);
- temp.op0 = callarg;
- VEC_safe_push (vn_reference_op_s, heap, *result, &temp);
- }
- return;
- }
-
if (TREE_CODE (ref) == TARGET_MEM_REF)
{
vn_reference_op_s temp;
@@ -589,6 +646,13 @@ copy_reference_ops_from_ref (tree ref, VEC(vn_reference_op_s, heap) **result)
case SSA_NAME:
temp.op0 = ref;
break;
+ case ADDR_EXPR:
+ if (is_gimple_min_invariant (ref))
+ {
+ temp.op0 = ref;
+ break;
+ }
+ /* Fallthrough. */
/* These are only interesting for their operands, their
existence, and their type. They will never be the last
ref in the chain of references (IE they require an
@@ -597,21 +661,48 @@ copy_reference_ops_from_ref (tree ref, VEC(vn_reference_op_s, heap) **result)
case IMAGPART_EXPR:
case REALPART_EXPR:
case VIEW_CONVERT_EXPR:
- case ADDR_EXPR:
break;
default:
gcc_unreachable ();
-
}
VEC_safe_push (vn_reference_op_s, heap, *result, &temp);
- if (REFERENCE_CLASS_P (ref) || TREE_CODE (ref) == ADDR_EXPR)
+ if (REFERENCE_CLASS_P (ref)
+ || (TREE_CODE (ref) == ADDR_EXPR
+ && !is_gimple_min_invariant (ref)))
ref = TREE_OPERAND (ref, 0);
else
ref = NULL_TREE;
}
}
+/* Copy the operations present in load/store/call REF into RESULT, a vector of
+ vn_reference_op_s's. */
+
+void
+copy_reference_ops_from_call (gimple call,
+ VEC(vn_reference_op_s, heap) **result)
+{
+ vn_reference_op_s temp;
+ unsigned i;
+
+ /* Copy the type, opcode, function being called and static chain. */
+ memset (&temp, 0, sizeof (temp));
+ temp.type = gimple_call_return_type (call);
+ temp.opcode = CALL_EXPR;
+ temp.op0 = gimple_call_fn (call);
+ temp.op1 = gimple_call_chain (call);
+ VEC_safe_push (vn_reference_op_s, heap, *result, &temp);
+
+ /* Copy the call arguments. As they can be references as well,
+ just chain them together. */
+ for (i = 0; i < gimple_call_num_args (call); ++i)
+ {
+ tree callarg = gimple_call_arg (call, i);
+ copy_reference_ops_from_ref (callarg, result);
+ }
+}
+
/* Create a vector of vn_reference_op_s structures from REF, a
REFERENCE_CLASS_P tree. The vector is not shared. */
@@ -624,6 +715,18 @@ create_reference_ops_from_ref (tree ref)
return result;
}
+/* Create a vector of vn_reference_op_s structures from CALL, a
+ call statement. The vector is not shared. */
+
+static VEC(vn_reference_op_s, heap) *
+create_reference_ops_from_call (gimple call)
+{
+ VEC (vn_reference_op_s, heap) *result = NULL;
+
+ copy_reference_ops_from_call (call, &result);
+ return result;
+}
+
static VEC(vn_reference_op_s, heap) *shared_lookup_references;
/* Create a vector of vn_reference_op_s structures from REF, a
@@ -640,6 +743,20 @@ shared_reference_ops_from_ref (tree ref)
return shared_lookup_references;
}
+/* Create a vector of vn_reference_op_s structures from CALL, a
+ call statement. The vector is shared among all callers of
+ this function. */
+
+static VEC(vn_reference_op_s, heap) *
+shared_reference_ops_from_call (gimple call)
+{
+ if (!call)
+ return NULL;
+ VEC_truncate (vn_reference_op_s, shared_lookup_references, 0);
+ copy_reference_ops_from_call (call, &shared_lookup_references);
+ return shared_lookup_references;
+}
+
/* Transform any SSA_NAME's in a vector of vn_reference_op_s
structures into their value numbers. This is done in-place, and
@@ -701,16 +818,17 @@ valueize_vuses (VEC (tree, gc) *orig)
Take into account only definitions that alias REF if following
back-edges. */
-static tree
+static gimple
get_def_ref_stmt_vuses (tree ref, VEC (tree, gc) *vuses)
{
- tree def_stmt, vuse;
+ gimple def_stmt;
+ tree vuse;
unsigned int i;
gcc_assert (VEC_length (tree, vuses) >= 1);
def_stmt = SSA_NAME_DEF_STMT (VEC_index (tree, vuses, 0));
- if (TREE_CODE (def_stmt) == PHI_NODE)
+ if (gimple_code (def_stmt) == GIMPLE_PHI)
{
/* We can only handle lookups over PHI nodes for a single
virtual operand. */
@@ -720,23 +838,22 @@ get_def_ref_stmt_vuses (tree ref, VEC (tree, gc) *vuses)
goto cont;
}
else
- return NULL_TREE;
+ return NULL;
}
/* Verify each VUSE reaches the same defining stmt. */
for (i = 1; VEC_iterate (tree, vuses, i, vuse); ++i)
{
- tree tmp = SSA_NAME_DEF_STMT (vuse);
+ gimple tmp = SSA_NAME_DEF_STMT (vuse);
if (tmp != def_stmt)
- return NULL_TREE;
+ return NULL;
}
/* Now see if the definition aliases ref, and loop until it does. */
cont:
while (def_stmt
- && TREE_CODE (def_stmt) == GIMPLE_MODIFY_STMT
- && !get_call_expr_in (def_stmt)
- && !refs_may_alias_p (ref, GIMPLE_STMT_OPERAND (def_stmt, 0)))
+ && is_gimple_assign (def_stmt)
+ && !refs_may_alias_p (ref, gimple_get_lhs (def_stmt)))
def_stmt = get_single_def_stmt_with_phi (ref, def_stmt);
return def_stmt;
@@ -804,7 +921,8 @@ vn_reference_lookup (tree op, VEC (tree, gc) *vuses, bool maywalk,
vn_reference_t *vnresult)
{
struct vn_reference_s vr1;
- tree result, def_stmt;
+ tree result;
+ gimple def_stmt;
if (vnresult)
*vnresult = NULL;
@@ -819,12 +937,8 @@ vn_reference_lookup (tree op, VEC (tree, gc) *vuses, bool maywalk,
&& maywalk
&& vr1.vuses
&& VEC_length (tree, vr1.vuses) >= 1
- && !get_call_expr_in (op)
&& (def_stmt = get_def_ref_stmt_vuses (op, vr1.vuses))
- && TREE_CODE (def_stmt) == GIMPLE_MODIFY_STMT
- /* If there is a call involved, op must be assumed to
- be clobbered. */
- && !get_call_expr_in (def_stmt))
+ && is_gimple_assign (def_stmt))
{
/* We are now at an aliasing definition for the vuses we want to
look up. Re-do the lookup with the vdefs for this stmt. */
@@ -1037,6 +1151,38 @@ vn_nary_op_lookup (tree op, vn_nary_op_t *vnresult)
return ((vn_nary_op_t)*slot)->result;
}
+/* Lookup the rhs of STMT in the current hash table, and return the resulting
+ value number if it exists in the hash table. Return NULL_TREE if
+ it does not exist in the hash table. VNRESULT will contain the
+ vn_nary_op_t from the hashtable if it exists. */
+
+tree
+vn_nary_op_lookup_stmt (gimple stmt, vn_nary_op_t *vnresult)
+{
+ void **slot;
+ struct vn_nary_op_s vno1;
+ unsigned i;
+
+ if (vnresult)
+ *vnresult = NULL;
+ vno1.opcode = gimple_assign_rhs_code (stmt);
+ vno1.length = gimple_num_ops (stmt) - 1;
+ vno1.type = TREE_TYPE (gimple_assign_lhs (stmt));
+ for (i = 0; i < vno1.length; ++i)
+ vno1.op[i] = gimple_op (stmt, i + 1);
+ vno1.hashcode = vn_nary_op_compute_hash (&vno1);
+ slot = htab_find_slot_with_hash (current_info->nary, &vno1, vno1.hashcode,
+ NO_INSERT);
+ if (!slot && current_info == optimistic_info)
+ slot = htab_find_slot_with_hash (valid_info->nary, &vno1, vno1.hashcode,
+ NO_INSERT);
+ if (!slot)
+ return NULL_TREE;
+ if (vnresult)
+ *vnresult = (vn_nary_op_t)*slot;
+ return ((vn_nary_op_t)*slot)->result;
+}
+
/* Insert a n-ary operation into the current hash table using it's
pieces. Return the vn_nary_op_t structure we created and put in
the hashtable. */
@@ -1108,6 +1254,36 @@ vn_nary_op_insert (tree op, tree result)
return vno1;
}
+/* Insert the rhs of STMT into the current hash table with a value number of
+ RESULT. */
+
+vn_nary_op_t
+vn_nary_op_insert_stmt (gimple stmt, tree result)
+{
+ unsigned length = gimple_num_ops (stmt) - 1;
+ void **slot;
+ vn_nary_op_t vno1;
+ unsigned i;
+
+ vno1 = (vn_nary_op_t) obstack_alloc (&current_info->nary_obstack,
+ (sizeof (struct vn_nary_op_s)
+ - sizeof (tree) * (4 - length)));
+ vno1->value_id = VN_INFO (result)->value_id;
+ vno1->opcode = gimple_assign_rhs_code (stmt);
+ vno1->length = length;
+ vno1->type = TREE_TYPE (gimple_assign_lhs (stmt));
+ for (i = 0; i < vno1->length; ++i)
+ vno1->op[i] = gimple_op (stmt, i + 1);
+ vno1->result = result;
+ vno1->hashcode = vn_nary_op_compute_hash (vno1);
+ slot = htab_find_slot_with_hash (current_info->nary, vno1, vno1->hashcode,
+ INSERT);
+ gcc_assert (!*slot);
+
+ *slot = vno1;
+ return vno1;
+}
+
/* Compute a hashcode for PHI operation VP1 and return it. */
static inline hashval_t
@@ -1173,23 +1349,23 @@ static VEC(tree, heap) *shared_lookup_phiargs;
it does not exist in the hash table. */
static tree
-vn_phi_lookup (tree phi)
+vn_phi_lookup (gimple phi)
{
void **slot;
struct vn_phi_s vp1;
- int i;
+ unsigned i;
VEC_truncate (tree, shared_lookup_phiargs, 0);
/* Canonicalize the SSA_NAME's to their value number. */
- for (i = 0; i < PHI_NUM_ARGS (phi); i++)
+ for (i = 0; i < gimple_phi_num_args (phi); i++)
{
tree def = PHI_ARG_DEF (phi, i);
def = TREE_CODE (def) == SSA_NAME ? SSA_VAL (def) : def;
VEC_safe_push (tree, heap, shared_lookup_phiargs, def);
}
vp1.phiargs = shared_lookup_phiargs;
- vp1.block = bb_for_stmt (phi);
+ vp1.block = gimple_bb (phi);
vp1.hashcode = vn_phi_compute_hash (&vp1);
slot = htab_find_slot_with_hash (current_info->phis, &vp1, vp1.hashcode,
NO_INSERT);
@@ -1205,15 +1381,15 @@ vn_phi_lookup (tree phi)
RESULT. */
static vn_phi_t
-vn_phi_insert (tree phi, tree result)
+vn_phi_insert (gimple phi, tree result)
{
void **slot;
vn_phi_t vp1 = (vn_phi_t) pool_alloc (current_info->phis_pool);
- int i;
+ unsigned i;
VEC (tree, heap) *args = NULL;
/* Canonicalize the SSA_NAME's to their value number. */
- for (i = 0; i < PHI_NUM_ARGS (phi); i++)
+ for (i = 0; i < gimple_phi_num_args (phi); i++)
{
tree def = PHI_ARG_DEF (phi, i);
def = TREE_CODE (def) == SSA_NAME ? SSA_VAL (def) : def;
@@ -1221,7 +1397,7 @@ vn_phi_insert (tree phi, tree result)
}
vp1->value_id = VN_INFO (result)->value_id;
vp1->phiargs = args;
- vp1->block = bb_for_stmt (phi);
+ vp1->block = gimple_bb (phi);
vp1->result = result;
vp1->hashcode = vn_phi_compute_hash (vp1);
@@ -1295,7 +1471,7 @@ set_ssa_val_to (tree from, tree to)
Return true if a value number changed. */
static bool
-defs_to_varying (tree stmt)
+defs_to_varying (gimple stmt)
{
bool changed = false;
ssa_op_iter iter;
@@ -1312,7 +1488,7 @@ defs_to_varying (tree stmt)
}
static bool expr_has_constants (tree expr);
-static tree try_to_simplify (tree stmt, tree rhs);
+static tree try_to_simplify (gimple stmt);
/* Visit a copy between LHS and RHS, return true if the value number
changed. */
@@ -1320,7 +1496,6 @@ static tree try_to_simplify (tree stmt, tree rhs);
static bool
visit_copy (tree lhs, tree rhs)
{
-
/* Follow chains of copies to their destination. */
while (SSA_VAL (rhs) != rhs && TREE_CODE (SSA_VAL (rhs)) == SSA_NAME)
rhs = SSA_VAL (rhs);
@@ -1337,10 +1512,10 @@ visit_copy (tree lhs, tree rhs)
value number of LHS has changed as a result. */
static bool
-visit_unary_op (tree lhs, tree op)
+visit_unary_op (tree lhs, gimple stmt)
{
bool changed = false;
- tree result = vn_nary_op_lookup (op, NULL);
+ tree result = vn_nary_op_lookup_stmt (stmt, NULL);
if (result)
{
@@ -1349,7 +1524,7 @@ visit_unary_op (tree lhs, tree op)
else
{
changed = set_ssa_val_to (lhs, lhs);
- vn_nary_op_insert (op, lhs);
+ vn_nary_op_insert_stmt (stmt, lhs);
}
return changed;
@@ -1359,19 +1534,60 @@ visit_unary_op (tree lhs, tree op)
value number of LHS has changed as a result. */
static bool
-visit_binary_op (tree lhs, tree op)
+visit_binary_op (tree lhs, gimple stmt)
+{
+ bool changed = false;
+ tree result = vn_nary_op_lookup_stmt (stmt, NULL);
+
+ if (result)
+ {
+ changed = set_ssa_val_to (lhs, result);
+ }
+ else
+ {
+ changed = set_ssa_val_to (lhs, lhs);
+ vn_nary_op_insert_stmt (stmt, lhs);
+ }
+
+ return changed;
+}
+
+/* Visit a call STMT storing into LHS. Return true if the value number
+ of the LHS has changed as a result. */
+
+static bool
+visit_reference_op_call (tree lhs, gimple stmt)
{
bool changed = false;
- tree result = vn_nary_op_lookup (op, NULL);
+ struct vn_reference_s vr1;
+ tree result;
+ vr1.vuses = valueize_vuses (shared_vuses_from_stmt (stmt));
+ vr1.operands = valueize_refs (shared_reference_ops_from_call (stmt));
+ vr1.hashcode = vn_reference_compute_hash (&vr1);
+ result = vn_reference_lookup_1 (&vr1, NULL);
if (result)
{
changed = set_ssa_val_to (lhs, result);
+ if (TREE_CODE (result) == SSA_NAME
+ && VN_INFO (result)->has_constants)
+ VN_INFO (lhs)->has_constants = true;
}
else
{
+ void **slot;
+ vn_reference_t vr2;
changed = set_ssa_val_to (lhs, lhs);
- vn_nary_op_insert (op, lhs);
+ vr2 = (vn_reference_t) pool_alloc (current_info->references_pool);
+ vr2->vuses = valueize_vuses (copy_vuses_from_stmt (stmt));
+ vr2->operands = valueize_refs (create_reference_ops_from_call (stmt));
+ vr2->hashcode = vr1.hashcode;
+ vr2->result = lhs;
+ slot = htab_find_slot_with_hash (current_info->references,
+ vr2, vr2->hashcode, INSERT);
+ if (*slot)
+ free_reference (*slot);
+ *slot = vr2;
}
return changed;
@@ -1381,7 +1597,7 @@ visit_binary_op (tree lhs, tree op)
and return true if the value number of the LHS has changed as a result. */
static bool
-visit_reference_op_load (tree lhs, tree op, tree stmt)
+visit_reference_op_load (tree lhs, tree op, gimple stmt)
{
bool changed = false;
tree result = vn_reference_lookup (op, shared_vuses_from_stmt (stmt), true,
@@ -1402,7 +1618,7 @@ visit_reference_op_load (tree lhs, tree op, tree stmt)
&& !is_gimple_min_invariant (val)
&& TREE_CODE (val) != SSA_NAME)
{
- tree tem = try_to_simplify (stmt, val);
+ tree tem = try_to_simplify (stmt);
if (tem)
val = tem;
}
@@ -1414,9 +1630,10 @@ visit_reference_op_load (tree lhs, tree op, tree stmt)
a new SSA_NAME we create. */
if (!result && may_insert)
{
- result = make_ssa_name (SSA_NAME_VAR (lhs), NULL_TREE);
+ result = make_ssa_name (SSA_NAME_VAR (lhs), NULL);
/* Initialize value-number information properly. */
VN_INFO_GET (result)->valnum = result;
+ VN_INFO (result)->value_id = get_next_value_id ();
VN_INFO (result)->expr = val;
VN_INFO (result)->has_constants = expr_has_constants (val);
VN_INFO (result)->needs_insertion = true;
@@ -1470,7 +1687,7 @@ visit_reference_op_load (tree lhs, tree op, tree stmt)
and return true if the value number of the LHS has changed as a result. */
static bool
-visit_reference_op_store (tree lhs, tree op, tree stmt)
+visit_reference_op_store (tree lhs, tree op, gimple stmt)
{
bool changed = false;
tree result;
@@ -1569,13 +1786,13 @@ visit_reference_op_store (tree lhs, tree op, tree stmt)
changed. */
static bool
-visit_phi (tree phi)
+visit_phi (gimple phi)
{
bool changed = false;
tree result;
tree sameval = VN_TOP;
bool allsame = true;
- int i;
+ unsigned i;
/* TODO: We could check for this in init_sccvn, and replace this
with a gcc_assert. */
@@ -1584,7 +1801,7 @@ visit_phi (tree phi)
/* See if all non-TOP arguments have the same value. TOP is
equivalent to everything, so we can ignore it. */
- for (i = 0; i < PHI_NUM_ARGS (phi); i++)
+ for (i = 0; i < gimple_phi_num_args (phi); i++)
{
tree def = PHI_ARG_DEF (phi, i);
@@ -1671,6 +1888,32 @@ expr_has_constants (tree expr)
return false;
}
+/* Return true if STMT contains constants. */
+
+static bool
+stmt_has_constants (gimple stmt)
+{
+ if (gimple_code (stmt) != GIMPLE_ASSIGN)
+ return false;
+
+ switch (get_gimple_rhs_class (gimple_assign_rhs_code (stmt)))
+ {
+ case GIMPLE_UNARY_RHS:
+ return is_gimple_min_invariant (gimple_assign_rhs1 (stmt));
+
+ case GIMPLE_BINARY_RHS:
+ return (is_gimple_min_invariant (gimple_assign_rhs1 (stmt))
+ || is_gimple_min_invariant (gimple_assign_rhs2 (stmt)));
+ case GIMPLE_SINGLE_RHS:
+ /* Constants inside reference ops are rarely interesting, but
+ it can take a lot of looking to find them. */
+ return is_gimple_min_invariant (gimple_assign_rhs1 (stmt));
+ default:
+ gcc_unreachable ();
+ }
+ return false;
+}
+
/* Replace SSA_NAMES in expr with their value numbers, and return the
result.
This is performed in place. */
@@ -1703,11 +1946,11 @@ valueize_expr (tree expr)
simplified. */
static tree
-simplify_binary_expression (tree stmt, tree rhs)
+simplify_binary_expression (gimple stmt)
{
tree result = NULL_TREE;
- tree op0 = TREE_OPERAND (rhs, 0);
- tree op1 = TREE_OPERAND (rhs, 1);
+ tree op0 = gimple_assign_rhs1 (stmt);
+ tree op1 = gimple_assign_rhs2 (stmt);
/* This will not catch every single case we could combine, but will
catch those with constants. The goal here is to simultaneously
@@ -1715,8 +1958,9 @@ simplify_binary_expression (tree stmt, tree rhs)
expansion of expressions during simplification. */
if (TREE_CODE (op0) == SSA_NAME)
{
- if (VN_INFO (op0)->has_constants)
- op0 = valueize_expr (VN_INFO (op0)->expr);
+ if (VN_INFO (op0)->has_constants
+ || TREE_CODE_CLASS (gimple_assign_rhs_code (stmt)) == tcc_comparison)
+ op0 = valueize_expr (vn_get_expr_for (op0));
else if (SSA_VAL (op0) != VN_TOP && SSA_VAL (op0) != op0)
op0 = SSA_VAL (op0);
}
@@ -1724,28 +1968,29 @@ simplify_binary_expression (tree stmt, tree rhs)
if (TREE_CODE (op1) == SSA_NAME)
{
if (VN_INFO (op1)->has_constants)
- op1 = valueize_expr (VN_INFO (op1)->expr);
+ op1 = valueize_expr (vn_get_expr_for (op1));
else if (SSA_VAL (op1) != VN_TOP && SSA_VAL (op1) != op1)
op1 = SSA_VAL (op1);
}
/* Avoid folding if nothing changed. */
- if (op0 == TREE_OPERAND (rhs, 0)
- && op1 == TREE_OPERAND (rhs, 1))
+ if (op0 == gimple_assign_rhs1 (stmt)
+ && op1 == gimple_assign_rhs2 (stmt))
return NULL_TREE;
fold_defer_overflow_warnings ();
- result = fold_binary (TREE_CODE (rhs), TREE_TYPE (rhs), op0, op1);
+ result = fold_binary (gimple_assign_rhs_code (stmt),
+ TREE_TYPE (gimple_get_lhs (stmt)), op0, op1);
- fold_undefer_overflow_warnings (result && valid_gimple_expression_p (result),
+ fold_undefer_overflow_warnings (result && valid_gimple_rhs_p (result),
stmt, 0);
/* Make sure result is not a complex expression consisting
of operators of operators (IE (a + b) + (a + c))
Otherwise, we will end up with unbounded expressions if
fold does anything at all. */
- if (result && valid_gimple_expression_p (result))
+ if (result && valid_gimple_rhs_p (result))
return result;
return NULL_TREE;
@@ -1755,24 +2000,32 @@ simplify_binary_expression (tree stmt, tree rhs)
simplified. */
static tree
-simplify_unary_expression (tree rhs)
+simplify_unary_expression (gimple stmt)
{
tree result = NULL_TREE;
- tree op0 = TREE_OPERAND (rhs, 0);
+ tree orig_op0, op0 = gimple_assign_rhs1 (stmt);
+
+ /* We handle some tcc_reference codes here that are all
+ GIMPLE_ASSIGN_SINGLE codes. */
+ if (gimple_assign_rhs_code (stmt) == REALPART_EXPR
+ || gimple_assign_rhs_code (stmt) == IMAGPART_EXPR
+ || gimple_assign_rhs_code (stmt) == VIEW_CONVERT_EXPR)
+ op0 = TREE_OPERAND (op0, 0);
if (TREE_CODE (op0) != SSA_NAME)
return NULL_TREE;
+ orig_op0 = op0;
if (VN_INFO (op0)->has_constants)
- op0 = valueize_expr (VN_INFO (op0)->expr);
- else if (CONVERT_EXPR_P (rhs)
- || TREE_CODE (rhs) == REALPART_EXPR
- || TREE_CODE (rhs) == IMAGPART_EXPR
- || TREE_CODE (rhs) == VIEW_CONVERT_EXPR)
+ op0 = valueize_expr (vn_get_expr_for (op0));
+ else if (gimple_assign_cast_p (stmt)
+ || gimple_assign_rhs_code (stmt) == REALPART_EXPR
+ || gimple_assign_rhs_code (stmt) == IMAGPART_EXPR
+ || gimple_assign_rhs_code (stmt) == VIEW_CONVERT_EXPR)
{
/* We want to do tree-combining on conversion-like expressions.
Make sure we feed only SSA_NAMEs or constants to fold though. */
- tree tem = valueize_expr (VN_INFO (op0)->expr);
+ tree tem = valueize_expr (vn_get_expr_for (op0));
if (UNARY_CLASS_P (tem)
|| BINARY_CLASS_P (tem)
|| TREE_CODE (tem) == VIEW_CONVERT_EXPR
@@ -1782,36 +2035,38 @@ simplify_unary_expression (tree rhs)
}
/* Avoid folding if nothing changed, but remember the expression. */
- if (op0 == TREE_OPERAND (rhs, 0))
- return rhs;
+ if (op0 == orig_op0)
+ return NULL_TREE;
- result = fold_unary (TREE_CODE (rhs), TREE_TYPE (rhs), op0);
+ result = fold_unary (gimple_assign_rhs_code (stmt),
+ gimple_expr_type (stmt), op0);
if (result)
{
STRIP_USELESS_TYPE_CONVERSION (result);
- if (valid_gimple_expression_p (result))
+ if (valid_gimple_rhs_p (result))
return result;
}
- return rhs;
+ return NULL_TREE;
}
/* Try to simplify RHS using equivalences and constant folding. */
static tree
-try_to_simplify (tree stmt, tree rhs)
+try_to_simplify (gimple stmt)
{
tree tem;
/* For stores we can end up simplifying a SSA_NAME rhs. Just return
in this case, there is no point in doing extra work. */
- if (TREE_CODE (rhs) == SSA_NAME)
- return rhs;
+ if (gimple_assign_copy_p (stmt)
+ && TREE_CODE (gimple_assign_rhs1 (stmt)) == SSA_NAME)
+ return NULL_TREE;
- switch (TREE_CODE_CLASS (TREE_CODE (rhs)))
+ switch (TREE_CODE_CLASS (gimple_assign_rhs_code (stmt)))
{
case tcc_declaration:
- tem = get_symbol_constant_value (rhs);
+ tem = get_symbol_constant_value (gimple_assign_rhs1 (stmt));
if (tem)
return tem;
break;
@@ -1819,29 +2074,29 @@ try_to_simplify (tree stmt, tree rhs)
case tcc_reference:
/* Do not do full-blown reference lookup here, but simplify
reads from constant aggregates. */
- tem = fold_const_aggregate_ref (rhs);
+ tem = fold_const_aggregate_ref (gimple_assign_rhs1 (stmt));
if (tem)
return tem;
/* Fallthrough for some codes that can operate on registers. */
- if (!(TREE_CODE (rhs) == REALPART_EXPR
- || TREE_CODE (rhs) == IMAGPART_EXPR
- || TREE_CODE (rhs) == VIEW_CONVERT_EXPR))
+ if (!(TREE_CODE (gimple_assign_rhs1 (stmt)) == REALPART_EXPR
+ || TREE_CODE (gimple_assign_rhs1 (stmt)) == IMAGPART_EXPR
+ || TREE_CODE (gimple_assign_rhs1 (stmt)) == VIEW_CONVERT_EXPR))
break;
/* We could do a little more with unary ops, if they expand
into binary ops, but it's debatable whether it is worth it. */
case tcc_unary:
- return simplify_unary_expression (rhs);
+ return simplify_unary_expression (stmt);
break;
case tcc_comparison:
case tcc_binary:
- return simplify_binary_expression (stmt, rhs);
+ return simplify_binary_expression (stmt);
break;
default:
break;
}
- return rhs;
+ return NULL_TREE;
}
/* Visit and value number USE, return true if the value number
@@ -1851,67 +2106,52 @@ static bool
visit_use (tree use)
{
bool changed = false;
- tree stmt = SSA_NAME_DEF_STMT (use);
- stmt_ann_t ann;
+ gimple stmt = SSA_NAME_DEF_STMT (use);
VN_INFO (use)->use_processed = true;
gcc_assert (!SSA_NAME_IN_FREE_LIST (use));
if (dump_file && (dump_flags & TDF_DETAILS)
- && !IS_EMPTY_STMT (stmt))
+ && !SSA_NAME_IS_DEFAULT_DEF (use))
{
fprintf (dump_file, "Value numbering ");
print_generic_expr (dump_file, use, 0);
fprintf (dump_file, " stmt = ");
- print_generic_stmt (dump_file, stmt, 0);
+ print_gimple_stmt (dump_file, stmt, 0, 0);
}
- /* RETURN_EXPR may have an embedded MODIFY_STMT. */
- if (TREE_CODE (stmt) == RETURN_EXPR
- && TREE_CODE (TREE_OPERAND (stmt, 0)) == GIMPLE_MODIFY_STMT)
- stmt = TREE_OPERAND (stmt, 0);
-
- ann = stmt_ann (stmt);
-
/* Handle uninitialized uses. */
- if (IS_EMPTY_STMT (stmt))
- {
- changed = set_ssa_val_to (use, use);
- }
+ if (SSA_NAME_IS_DEFAULT_DEF (use))
+ changed = set_ssa_val_to (use, use);
else
{
- if (TREE_CODE (stmt) == PHI_NODE)
- {
- changed = visit_phi (stmt);
- }
- else if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT
- || (ann && ann->has_volatile_ops)
- || tree_could_throw_p (stmt))
+ if (gimple_code (stmt) == GIMPLE_PHI)
+ changed = visit_phi (stmt);
+ else if (!gimple_has_lhs (stmt)
+ || gimple_has_volatile_ops (stmt)
+ || stmt_could_throw_p (stmt))
+ changed = defs_to_varying (stmt);
+ else if (is_gimple_assign (stmt))
{
- changed = defs_to_varying (stmt);
- }
- else
- {
- tree lhs = GIMPLE_STMT_OPERAND (stmt, 0);
- tree rhs = GIMPLE_STMT_OPERAND (stmt, 1);
+ tree lhs = gimple_assign_lhs (stmt);
tree simplified;
- STRIP_USELESS_TYPE_CONVERSION (rhs);
-
/* Shortcut for copies. Simplifying copies is pointless,
since we copy the expression and value they represent. */
- if (TREE_CODE (rhs) == SSA_NAME && TREE_CODE (lhs) == SSA_NAME)
+ if (gimple_assign_copy_p (stmt)
+ && TREE_CODE (gimple_assign_rhs1 (stmt)) == SSA_NAME
+ && TREE_CODE (lhs) == SSA_NAME)
{
- changed = visit_copy (lhs, rhs);
+ changed = visit_copy (lhs, gimple_assign_rhs1 (stmt));
goto done;
}
- simplified = try_to_simplify (stmt, rhs);
- if (simplified && simplified != rhs)
+ simplified = try_to_simplify (stmt);
+ if (simplified)
{
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "RHS ");
- print_generic_expr (dump_file, rhs, 0);
+ print_gimple_expr (dump_file, stmt, 0, 0);
fprintf (dump_file, " simplified to ");
print_generic_expr (dump_file, simplified, 0);
if (TREE_CODE (lhs) == SSA_NAME)
@@ -1925,16 +2165,17 @@ visit_use (tree use)
screw up phi congruence because constants are not
uniquely associated with a single ssa name that can be
looked up. */
- if (simplified && is_gimple_min_invariant (simplified)
- && TREE_CODE (lhs) == SSA_NAME
- && simplified != rhs)
+ if (simplified
+ && is_gimple_min_invariant (simplified)
+ && TREE_CODE (lhs) == SSA_NAME)
{
VN_INFO (lhs)->expr = simplified;
VN_INFO (lhs)->has_constants = true;
changed = set_ssa_val_to (lhs, simplified);
goto done;
}
- else if (simplified && TREE_CODE (simplified) == SSA_NAME
+ else if (simplified
+ && TREE_CODE (simplified) == SSA_NAME
&& TREE_CODE (lhs) == SSA_NAME)
{
changed = visit_copy (lhs, simplified);
@@ -1949,13 +2190,10 @@ visit_use (tree use)
valuizing may change the IL stream. */
VN_INFO (lhs)->expr = unshare_expr (simplified);
}
- rhs = simplified;
- }
- else if (expr_has_constants (rhs) && TREE_CODE (lhs) == SSA_NAME)
- {
- VN_INFO (lhs)->has_constants = true;
- VN_INFO (lhs)->expr = unshare_expr (rhs);
}
+ else if (stmt_has_constants (stmt)
+ && TREE_CODE (lhs) == SSA_NAME)
+ VN_INFO (lhs)->has_constants = true;
else if (TREE_CODE (lhs) == SSA_NAME)
{
/* We reset expr and constantness here because we may
@@ -1964,56 +2202,64 @@ visit_use (tree use)
even if they were optimistically constant. */
VN_INFO (lhs)->has_constants = false;
- VN_INFO (lhs)->expr = lhs;
+ VN_INFO (lhs)->expr = NULL_TREE;
}
if (TREE_CODE (lhs) == SSA_NAME
/* We can substitute SSA_NAMEs that are live over
abnormal edges with their constant value. */
- && !is_gimple_min_invariant (rhs)
+ && !(gimple_assign_copy_p (stmt)
+ && is_gimple_min_invariant (gimple_assign_rhs1 (stmt)))
+ && !(simplified
+ && is_gimple_min_invariant (simplified))
&& SSA_NAME_OCCURS_IN_ABNORMAL_PHI (lhs))
changed = defs_to_varying (stmt);
else if (REFERENCE_CLASS_P (lhs) || DECL_P (lhs))
{
- changed = visit_reference_op_store (lhs, rhs, stmt);
+ changed = visit_reference_op_store (lhs, gimple_assign_rhs1 (stmt), stmt);
}
else if (TREE_CODE (lhs) == SSA_NAME)
{
- if (is_gimple_min_invariant (rhs))
+ if ((gimple_assign_copy_p (stmt)
+ && is_gimple_min_invariant (gimple_assign_rhs1 (stmt)))
+ || (simplified
+ && is_gimple_min_invariant (simplified)))
{
VN_INFO (lhs)->has_constants = true;
- VN_INFO (lhs)->expr = rhs;
- changed = set_ssa_val_to (lhs, rhs);
+ if (simplified)
+ changed = set_ssa_val_to (lhs, simplified);
+ else
+ changed = set_ssa_val_to (lhs, gimple_assign_rhs1 (stmt));
}
else
{
- switch (TREE_CODE_CLASS (TREE_CODE (rhs)))
+ switch (get_gimple_rhs_class (gimple_assign_rhs_code (stmt)))
{
- case tcc_unary:
- changed = visit_unary_op (lhs, rhs);
- break;
- case tcc_binary:
- changed = visit_binary_op (lhs, rhs);
- break;
- /* If tcc_vl_expr ever encompasses more than
- CALL_EXPR, this will need to be changed. */
- case tcc_vl_exp:
- if (call_expr_flags (rhs) & (ECF_PURE | ECF_CONST))
- changed = visit_reference_op_load (lhs, rhs, stmt);
- else
- changed = defs_to_varying (stmt);
+ case GIMPLE_UNARY_RHS:
+ changed = visit_unary_op (lhs, stmt);
break;
- case tcc_declaration:
- case tcc_reference:
- changed = visit_reference_op_load (lhs, rhs, stmt);
+ case GIMPLE_BINARY_RHS:
+ changed = visit_binary_op (lhs, stmt);
break;
- case tcc_expression:
- if (TREE_CODE (rhs) == ADDR_EXPR)
+ case GIMPLE_SINGLE_RHS:
+ switch (TREE_CODE_CLASS (gimple_assign_rhs_code (stmt)))
{
- changed = visit_unary_op (lhs, rhs);
- goto done;
+ case tcc_declaration:
+ case tcc_reference:
+ changed = visit_reference_op_load
+ (lhs, gimple_assign_rhs1 (stmt), stmt);
+ break;
+ case tcc_expression:
+ if (gimple_assign_rhs_code (stmt) == ADDR_EXPR)
+ {
+ changed = visit_unary_op (lhs, stmt);
+ break;
+ }
+ /* Fallthrough. */
+ default:
+ changed = defs_to_varying (stmt);
}
- /* Fallthrough. */
+ break;
default:
changed = defs_to_varying (stmt);
break;
@@ -2023,6 +2269,39 @@ visit_use (tree use)
else
changed = defs_to_varying (stmt);
}
+ else if (is_gimple_call (stmt))
+ {
+ tree lhs = gimple_call_lhs (stmt);
+
+ /* ??? We could try to simplify calls. */
+
+ if (stmt_has_constants (stmt)
+ && TREE_CODE (lhs) == SSA_NAME)
+ VN_INFO (lhs)->has_constants = true;
+ else if (TREE_CODE (lhs) == SSA_NAME)
+ {
+ /* We reset expr and constantness here because we may
+ have been value numbering optimistically, and
+ iterating. They may become non-constant in this case,
+ even if they were optimistically constant. */
+ VN_INFO (lhs)->has_constants = false;
+ VN_INFO (lhs)->expr = NULL_TREE;
+ }
+
+ if (TREE_CODE (lhs) == SSA_NAME
+ && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (lhs))
+ changed = defs_to_varying (stmt);
+ /* ??? We should handle stores from calls. */
+ else if (TREE_CODE (lhs) == SSA_NAME)
+ {
+ if (gimple_call_flags (stmt) & (ECF_PURE | ECF_CONST))
+ changed = visit_reference_op_call (lhs, stmt);
+ else
+ changed = defs_to_varying (stmt);
+ }
+ else
+ changed = defs_to_varying (stmt);
+ }
}
done:
return changed;
@@ -2035,20 +2314,20 @@ compare_ops (const void *pa, const void *pb)
{
const tree opa = *((const tree *)pa);
const tree opb = *((const tree *)pb);
- tree opstmta = SSA_NAME_DEF_STMT (opa);
- tree opstmtb = SSA_NAME_DEF_STMT (opb);
+ gimple opstmta = SSA_NAME_DEF_STMT (opa);
+ gimple opstmtb = SSA_NAME_DEF_STMT (opb);
basic_block bba;
basic_block bbb;
- if (IS_EMPTY_STMT (opstmta) && IS_EMPTY_STMT (opstmtb))
+ if (gimple_nop_p (opstmta) && gimple_nop_p (opstmtb))
return 0;
- else if (IS_EMPTY_STMT (opstmta))
+ else if (gimple_nop_p (opstmta))
return -1;
- else if (IS_EMPTY_STMT (opstmtb))
+ else if (gimple_nop_p (opstmtb))
return 1;
- bba = bb_for_stmt (opstmta);
- bbb = bb_for_stmt (opstmtb);
+ bba = gimple_bb (opstmta);
+ bbb = gimple_bb (opstmtb);
if (!bba && !bbb)
return 0;
@@ -2059,13 +2338,14 @@ compare_ops (const void *pa, const void *pb)
if (bba == bbb)
{
- if (TREE_CODE (opstmta) == PHI_NODE && TREE_CODE (opstmtb) == PHI_NODE)
+ if (gimple_code (opstmta) == GIMPLE_PHI
+ && gimple_code (opstmtb) == GIMPLE_PHI)
return 0;
- else if (TREE_CODE (opstmta) == PHI_NODE)
+ else if (gimple_code (opstmta) == GIMPLE_PHI)
return -1;
- else if (TREE_CODE (opstmtb) == PHI_NODE)
+ else if (gimple_code (opstmtb) == GIMPLE_PHI)
return 1;
- return gimple_stmt_uid (opstmta) - gimple_stmt_uid (opstmtb);
+ return gimple_uid (opstmta) - gimple_uid (opstmtb);
}
return rpo_numbers[bba->index] - rpo_numbers[bbb->index];
}
@@ -2111,6 +2391,9 @@ process_scc (VEC (tree, heap) *scc)
{
changed = false;
iterations++;
+ /* As we are value-numbering optimistically we have to
+ clear the expression tables and the simplified expressions
+ in each iteration until we converge. */
htab_empty (optimistic_info->nary);
htab_empty (optimistic_info->phis);
htab_empty (optimistic_info->references);
@@ -2119,6 +2402,8 @@ process_scc (VEC (tree, heap) *scc)
empty_alloc_pool (optimistic_info->phis_pool);
empty_alloc_pool (optimistic_info->references_pool);
for (i = 0; VEC_iterate (tree, scc, i, var); i++)
+ VN_INFO (var)->expr = NULL_TREE;
+ for (i = 0; VEC_iterate (tree, scc, i, var); i++)
changed |= visit_use (var);
}
@@ -2191,7 +2476,8 @@ DFS (tree name)
VEC(ssa_op_iter, heap) *itervec = NULL;
VEC(tree, heap) *namevec = NULL;
use_operand_p usep = NULL;
- tree defstmt, use;
+ gimple defstmt;
+ tree use;
ssa_op_iter iter;
start_over:
@@ -2205,10 +2491,10 @@ start_over:
defstmt = SSA_NAME_DEF_STMT (name);
/* Recursively DFS on our operands, looking for SCC's. */
- if (!IS_EMPTY_STMT (defstmt))
+ if (!gimple_nop_p (defstmt))
{
/* Push a new iterator. */
- if (TREE_CODE (defstmt) == PHI_NODE)
+ if (gimple_code (defstmt) == GIMPLE_PHI)
usep = op_iter_init_phiuse (&iter, defstmt, SSA_OP_ALL_USES);
else
usep = op_iter_init_use (&iter, defstmt, SSA_OP_ALL_USES);
@@ -2359,7 +2645,7 @@ init_scc_vn (void)
if (name)
{
VN_INFO_GET (name)->valnum = VN_TOP;
- VN_INFO (name)->expr = name;
+ VN_INFO (name)->expr = NULL_TREE;
VN_INFO (name)->value_id = 0;
}
}
@@ -2569,20 +2855,20 @@ get_next_value_id (void)
}
-/* Compare two expressions E1 and E2 and return true if they are
- equal. */
+/* Compare two expressions E1 and E2 and return true if they are equal. */
bool
expressions_equal_p (tree e1, tree e2)
{
- tree te1, te2;
-
+ /* The obvious case. */
if (e1 == e2)
return true;
- te1 = TREE_TYPE (e1);
- te2 = TREE_TYPE (e2);
+ /* If only one of them is null, they cannot be equal. */
+ if (!e1 || !e2)
+ return false;
+ /* Recurse on elements of lists. */
if (TREE_CODE (e1) == TREE_LIST && TREE_CODE (e2) == TREE_LIST)
{
tree lop1 = e1;
@@ -2597,10 +2883,11 @@ expressions_equal_p (tree e1, tree e2)
return false;
}
return true;
-
}
- else if (TREE_CODE (e1) == TREE_CODE (e2)
- && operand_equal_p (e1, e2, OEP_PURE_SAME))
+
+ /* Now perform the actual comparison. */
+ if (TREE_CODE (e1) == TREE_CODE (e2)
+ && operand_equal_p (e1, e2, OEP_PURE_SAME))
return true;
return false;
diff --git a/gcc/tree-ssa-sccvn.h b/gcc/tree-ssa-sccvn.h
index 9f391af43aa..d648cd9bb94 100644
--- a/gcc/tree-ssa-sccvn.h
+++ b/gcc/tree-ssa-sccvn.h
@@ -104,7 +104,30 @@ typedef struct vn_constant_s
hashval_t hashcode;
tree constant;
} *vn_constant_t;
-
+
+/* Hash the constant CONSTANT with distinguishing type incompatible
+ constants in the types_compatible_p sense. */
+
+static inline hashval_t
+vn_hash_constant_with_type (tree constant)
+{
+ tree type = TREE_TYPE (constant);
+ return (iterative_hash_expr (constant, 0)
+ + INTEGRAL_TYPE_P (type)
+ + (INTEGRAL_TYPE_P (type)
+ ? TYPE_PRECISION (type) + TYPE_UNSIGNED (type) : 0));
+}
+
+/* Compare the constants C1 and C2 with distinguishing type incompatible
+ constants in the types_compatible_p sense. */
+
+static inline bool
+vn_constant_eq_with_type (tree c1, tree c2)
+{
+ return (expressions_equal_p (c1, c2)
+ && types_compatible_p (TREE_TYPE (c1), TREE_TYPE (c2)));
+}
+
typedef struct vn_ssa_aux
{
/* Value number. This may be an SSA name or a constant. */
@@ -138,16 +161,21 @@ typedef struct vn_ssa_aux
/* Return the value numbering info for an SSA_NAME. */
extern vn_ssa_aux_t VN_INFO (tree);
extern vn_ssa_aux_t VN_INFO_GET (tree);
+tree vn_get_expr_for (tree);
bool run_scc_vn (bool);
void free_scc_vn (void);
tree vn_nary_op_lookup (tree, vn_nary_op_t *);
+tree vn_nary_op_lookup_stmt (gimple, vn_nary_op_t *);
tree vn_nary_op_lookup_pieces (unsigned int, enum tree_code,
tree, tree, tree, tree, tree,
vn_nary_op_t *);
vn_nary_op_t vn_nary_op_insert (tree, tree);
+vn_nary_op_t vn_nary_op_insert_stmt (gimple, tree);
vn_nary_op_t vn_nary_op_insert_pieces (unsigned int, enum tree_code,
tree, tree, tree, tree,
tree, tree, unsigned int);
+void copy_reference_ops_from_ref (tree, VEC(vn_reference_op_s, heap) **);
+void copy_reference_ops_from_call (gimple, VEC(vn_reference_op_s, heap) **);
tree vn_reference_lookup_pieces (VEC (tree, gc) *,
VEC (vn_reference_op_s, heap) *,
vn_reference_t *);
@@ -163,8 +191,9 @@ hashval_t vn_reference_compute_hash (const vn_reference_t);
int vn_reference_eq (const void *, const void *);
unsigned int get_max_value_id (void);
unsigned int get_next_value_id (void);
+unsigned int get_constant_value_id (tree);
unsigned int get_or_alloc_constant_value_id (tree);
bool value_id_constant_p (unsigned int);
-VEC (tree, gc) *shared_vuses_from_stmt (tree);
-VEC (tree, gc) *copy_vuses_from_stmt (tree);
+VEC (tree, gc) *shared_vuses_from_stmt (gimple);
+VEC (tree, gc) *copy_vuses_from_stmt (gimple);
#endif /* TREE_SSA_SCCVN_H */
diff --git a/gcc/tree-ssa-sink.c b/gcc/tree-ssa-sink.c
index ebf54e2070b..e56cce0edb1 100644
--- a/gcc/tree-ssa-sink.c
+++ b/gcc/tree-ssa-sink.c
@@ -28,7 +28,7 @@ along with GCC; see the file COPYING3. If not see
#include "diagnostic.h"
#include "tree-inline.h"
#include "tree-flow.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "tree-dump.h"
#include "timevar.h"
#include "fibheap.h"
@@ -82,18 +82,18 @@ static struct
we return NULL. */
static basic_block
-find_bb_for_arg (tree phi, tree def)
+find_bb_for_arg (gimple phi, tree def)
{
- int i;
+ size_t i;
bool foundone = false;
basic_block result = NULL;
- for (i = 0; i < PHI_NUM_ARGS (phi); i++)
+ for (i = 0; i < gimple_phi_num_args (phi); i++)
if (PHI_ARG_DEF (phi, i) == def)
{
if (foundone)
return NULL;
foundone = true;
- result = PHI_ARG_EDGE (phi, i)->src;
+ result = gimple_phi_arg_edge (phi, i)->src;
}
return result;
}
@@ -107,9 +107,9 @@ find_bb_for_arg (tree phi, tree def)
used in, so that you only have one place you can sink it to. */
static bool
-all_immediate_uses_same_place (tree stmt)
+all_immediate_uses_same_place (gimple stmt)
{
- tree firstuse = NULL_TREE;
+ gimple firstuse = NULL;
ssa_op_iter op_iter;
imm_use_iterator imm_iter;
use_operand_p use_p;
@@ -119,7 +119,7 @@ all_immediate_uses_same_place (tree stmt)
{
FOR_EACH_IMM_USE_FAST (use_p, imm_iter, var)
{
- if (firstuse == NULL_TREE)
+ if (firstuse == NULL)
firstuse = USE_STMT (use_p);
else
if (firstuse != USE_STMT (use_p))
@@ -134,16 +134,16 @@ all_immediate_uses_same_place (tree stmt)
but we still must avoid moving them around. */
bool
-is_hidden_global_store (tree stmt)
+is_hidden_global_store (gimple stmt)
{
/* Check virtual definitions. If we get here, the only virtual
- definitions we should see are those generated by assignment
+ definitions we should see are those generated by assignment or call
statements. */
if (!ZERO_SSA_OPERANDS (stmt, SSA_OP_VIRTUAL_DEFS))
{
tree lhs;
- gcc_assert (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT);
+ gcc_assert (is_gimple_assign (stmt) || is_gimple_call (stmt));
/* Note that we must not check the individual virtual operands
here. In particular, if this is an aliased store, we could
@@ -170,7 +170,8 @@ is_hidden_global_store (tree stmt)
address is a pointer, we check if its name tag or symbol tag is
a global variable. Otherwise, we check if the base variable
is a global. */
- lhs = GIMPLE_STMT_OPERAND (stmt, 0);
+ lhs = gimple_get_lhs (stmt);
+
if (REFERENCE_CLASS_P (lhs))
lhs = get_base_address (lhs);
@@ -200,7 +201,7 @@ is_hidden_global_store (tree stmt)
/* Find the nearest common dominator of all of the immediate uses in IMM. */
static basic_block
-nearest_common_dominator_of_uses (tree stmt)
+nearest_common_dominator_of_uses (gimple stmt)
{
bitmap blocks = BITMAP_ALLOC (NULL);
basic_block commondom;
@@ -216,18 +217,18 @@ nearest_common_dominator_of_uses (tree stmt)
{
FOR_EACH_IMM_USE_FAST (use_p, imm_iter, var)
{
- tree usestmt = USE_STMT (use_p);
+ gimple usestmt = USE_STMT (use_p);
basic_block useblock;
- if (TREE_CODE (usestmt) == PHI_NODE)
+ if (gimple_code (usestmt) == GIMPLE_PHI)
{
int idx = PHI_ARG_INDEX_FROM_USE (use_p);
- useblock = PHI_ARG_EDGE (usestmt, idx)->src;
+ useblock = gimple_phi_arg_edge (usestmt, idx)->src;
}
else
{
- useblock = bb_for_stmt (usestmt);
+ useblock = gimple_bb (usestmt);
}
/* Short circuit. Nothing dominates the entry block. */
@@ -249,23 +250,22 @@ nearest_common_dominator_of_uses (tree stmt)
/* Given a statement (STMT) and the basic block it is currently in (FROMBB),
determine the location to sink the statement to, if any.
- Returns true if there is such location; in that case, TOBB is set to the
- basic block of the location, and TOBSI points to the statement before
- that STMT should be moved. */
+ Returns true if there is such location; in that case, TOGSI points to the
+ statement before that STMT should be moved. */
static bool
-statement_sink_location (tree stmt, basic_block frombb, basic_block *tobb,
- block_stmt_iterator *tobsi)
+statement_sink_location (gimple stmt, basic_block frombb,
+ gimple_stmt_iterator *togsi)
{
- tree use, def;
+ gimple use;
+ tree def;
use_operand_p one_use = NULL_USE_OPERAND_P;
basic_block sinkbb;
use_operand_p use_p;
def_operand_p def_p;
ssa_op_iter iter;
- stmt_ann_t ann;
- tree rhs;
imm_use_iterator imm_iter;
+ enum tree_code code;
FOR_EACH_SSA_TREE_OPERAND (def, stmt, iter, SSA_OP_ALL_DEFS)
{
@@ -281,9 +281,8 @@ statement_sink_location (tree stmt, basic_block frombb, basic_block *tobb,
if (one_use == NULL_USE_OPERAND_P)
return false;
- if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
+ if (gimple_code (stmt) != GIMPLE_ASSIGN)
return false;
- rhs = GIMPLE_STMT_OPERAND (stmt, 1);
/* There are a few classes of things we can't or don't move, some because we
don't have code to handle it, some because it's not profitable and some
@@ -305,13 +304,13 @@ statement_sink_location (tree stmt, basic_block frombb, basic_block *tobb,
sunk.
*/
- ann = stmt_ann (stmt);
+ code = gimple_assign_rhs_code (stmt);
if (stmt_ends_bb_p (stmt)
- || TREE_SIDE_EFFECTS (rhs)
- || TREE_CODE (rhs) == EXC_PTR_EXPR
- || TREE_CODE (rhs) == FILTER_EXPR
+ || gimple_has_side_effects (stmt)
+ || code == EXC_PTR_EXPR
+ || code == FILTER_EXPR
|| is_hidden_global_store (stmt)
- || ann->has_volatile_ops
+ || gimple_has_volatile_ops (stmt)
|| !ZERO_SSA_OPERANDS (stmt, SSA_OP_VUSE))
return false;
@@ -365,20 +364,19 @@ statement_sink_location (tree stmt, basic_block frombb, basic_block *tobb,
fprintf (dump_file, "Common dominator of all uses is %d\n",
commondom->index);
}
- *tobb = commondom;
- *tobsi = bsi_after_labels (commondom);
+ *togsi = gsi_after_labels (commondom);
return true;
}
use = USE_STMT (one_use);
- if (TREE_CODE (use) != PHI_NODE)
+ if (gimple_code (use) != GIMPLE_PHI)
{
- sinkbb = bb_for_stmt (use);
+ sinkbb = gimple_bb (use);
if (sinkbb == frombb || sinkbb->loop_depth > frombb->loop_depth
|| sinkbb->loop_father != frombb->loop_father)
return false;
- *tobb = sinkbb;
- *tobsi = bsi_for_stmt (use);
+
+ *togsi = gsi_for_stmt (use);
return true;
}
@@ -399,14 +397,13 @@ statement_sink_location (tree stmt, basic_block frombb, basic_block *tobb,
If the use is a phi, and is in the same bb as the def,
we can't sink it. */
- if (bb_for_stmt (use) == frombb)
+ if (gimple_bb (use) == frombb)
return false;
if (sinkbb == frombb || sinkbb->loop_depth > frombb->loop_depth
|| sinkbb->loop_father != frombb->loop_father)
return false;
- *tobb = sinkbb;
- *tobsi = bsi_after_labels (sinkbb);
+ *togsi = gsi_after_labels (sinkbb);
return true;
}
@@ -417,7 +414,7 @@ static void
sink_code_in_bb (basic_block bb)
{
basic_block son;
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
edge_iterator ei;
edge e;
bool last = true;
@@ -432,50 +429,49 @@ sink_code_in_bb (basic_block bb)
if (e->flags & EDGE_ABNORMAL)
goto earlyout;
- for (bsi = bsi_last (bb); !bsi_end_p (bsi);)
+ for (gsi = gsi_last_bb (bb); !gsi_end_p (gsi);)
{
- tree stmt = bsi_stmt (bsi);
- block_stmt_iterator tobsi;
- basic_block tobb;
+ gimple stmt = gsi_stmt (gsi);
+ gimple_stmt_iterator togsi;
- if (!statement_sink_location (stmt, bb, &tobb, &tobsi))
+ if (!statement_sink_location (stmt, bb, &togsi))
{
- if (!bsi_end_p (bsi))
- bsi_prev (&bsi);
+ if (!gsi_end_p (gsi))
+ gsi_prev (&gsi);
last = false;
continue;
}
if (dump_file)
{
fprintf (dump_file, "Sinking ");
- print_generic_expr (dump_file, stmt, TDF_VOPS);
+ print_gimple_stmt (dump_file, stmt, 0, TDF_VOPS);
fprintf (dump_file, " from bb %d to bb %d\n",
- bb->index, tobb->index);
+ bb->index, (gsi_bb (togsi))->index);
}
/* If this is the end of the basic block, we need to insert at the end
of the basic block. */
- if (bsi_end_p (tobsi))
- bsi_move_to_bb_end (&bsi, tobb);
+ if (gsi_end_p (togsi))
+ gsi_move_to_bb_end (&gsi, gsi_bb (togsi));
else
- bsi_move_before (&bsi, &tobsi);
+ gsi_move_before (&gsi, &togsi);
sink_stats.sunk++;
/* If we've just removed the last statement of the BB, the
- bsi_end_p() test below would fail, but bsi_prev() would have
+ gsi_end_p() test below would fail, but gsi_prev() would have
succeeded, and we want it to succeed. So we keep track of
whether we're at the last statement and pick up the new last
statement. */
if (last)
{
- bsi = bsi_last (bb);
+ gsi = gsi_last_bb (bb);
continue;
}
last = false;
- if (!bsi_end_p (bsi))
- bsi_prev (&bsi);
+ if (!gsi_end_p (gsi))
+ gsi_prev (&gsi);
}
earlyout:
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index 6121437b245..4198498800b 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -39,7 +39,7 @@
#include "tree-inline.h"
#include "varray.h"
#include "c-tree.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "hashtab.h"
#include "function.h"
#include "cgraph.h"
@@ -3087,7 +3087,6 @@ get_constraint_for_1 (tree t, VEC (ce_s, heap) **results, bool address_p)
switch (TREE_CODE_CLASS (TREE_CODE (t)))
{
case tcc_expression:
- case tcc_vl_exp:
{
switch (TREE_CODE (t))
{
@@ -3109,37 +3108,6 @@ get_constraint_for_1 (tree t, VEC (ce_s, heap) **results, bool address_p)
return;
}
break;
- case CALL_EXPR:
- /* XXX: In interprocedural mode, if we didn't have the
- body, we would need to do *each pointer argument =
- &ANYTHING added. */
- if (call_expr_flags (t) & (ECF_MALLOC | ECF_MAY_BE_ALLOCA))
- {
- varinfo_t vi;
- tree heapvar = heapvar_lookup (t);
-
- if (heapvar == NULL)
- {
- heapvar = create_tmp_var_raw (ptr_type_node, "HEAP");
- DECL_EXTERNAL (heapvar) = 1;
- get_var_ann (heapvar)->is_heapvar = 1;
- if (gimple_referenced_vars (cfun))
- add_referenced_var (heapvar);
- heapvar_insert (t, heapvar);
- }
-
- temp.var = create_variable_info_for (heapvar,
- alias_get_name (heapvar));
-
- vi = get_varinfo (temp.var);
- vi->is_artificial_var = 1;
- vi->is_heap_var = 1;
- temp.type = ADDRESSOF;
- temp.offset = 0;
- VEC_safe_push (ce_s, heap, *results, &temp);
- return;
- }
- break;
default:;
}
break;
@@ -3163,48 +3131,10 @@ get_constraint_for_1 (tree t, VEC (ce_s, heap) **results, bool address_p)
}
break;
}
- case tcc_unary:
- {
- switch (TREE_CODE (t))
- {
- CASE_CONVERT:
- {
- tree op = TREE_OPERAND (t, 0);
-
- /* Cast from non-pointer to pointers are bad news for us.
- Anything else, we see through */
- if (!(POINTER_TYPE_P (TREE_TYPE (t))
- && ! POINTER_TYPE_P (TREE_TYPE (op))))
- {
- get_constraint_for_1 (op, results, address_p);
- return;
- }
-
- /* FALLTHRU */
- }
- default:;
- }
- break;
- }
- case tcc_binary:
- {
- if (TREE_CODE (t) == POINTER_PLUS_EXPR)
- {
- get_constraint_for_ptr_offset (TREE_OPERAND (t, 0),
- TREE_OPERAND (t, 1), results);
- return;
- }
- break;
- }
case tcc_exceptional:
{
switch (TREE_CODE (t))
{
- case PHI_NODE:
- {
- get_constraint_for_1 (PHI_RESULT (t), results, address_p);
- return;
- }
case SSA_NAME:
{
get_constraint_for_ssa_var (t, results, address_p);
@@ -3544,20 +3474,23 @@ make_escape_constraint (tree op)
RHS. */
static void
-handle_rhs_call (tree rhs)
+handle_rhs_call (gimple stmt)
{
- tree arg;
- call_expr_arg_iterator iter;
+ unsigned i;
- FOR_EACH_CALL_EXPR_ARG (arg, iter, rhs)
- /* Find those pointers being passed, and make sure they end up
- pointing to anything. */
- if (could_have_pointers (arg))
- make_escape_constraint (arg);
+ for (i = 0; i < gimple_call_num_args (stmt); ++i)
+ {
+ tree arg = gimple_call_arg (stmt, i);
+
+ /* Find those pointers being passed, and make sure they end up
+ pointing to anything. */
+ if (could_have_pointers (arg))
+ make_escape_constraint (arg);
+ }
/* The static chain escapes as well. */
- if (CALL_EXPR_STATIC_CHAIN (rhs))
- make_escape_constraint (CALL_EXPR_STATIC_CHAIN (rhs));
+ if (gimple_call_chain (stmt))
+ make_escape_constraint (gimple_call_chain (stmt));
}
/* For non-IPA mode, generate constraints necessary for a call
@@ -3612,22 +3545,20 @@ handle_lhs_call (tree lhs, int flags)
const function that returns a pointer in the statement STMT. */
static void
-handle_const_call (tree stmt)
+handle_const_call (gimple stmt)
{
- tree lhs = GIMPLE_STMT_OPERAND (stmt, 0);
- tree call = get_call_expr_in (stmt);
+ tree lhs = gimple_call_lhs (stmt);
VEC(ce_s, heap) *lhsc = NULL;
struct constraint_expr rhsc;
- unsigned int j;
+ unsigned int j, k;
struct constraint_expr *lhsp;
- tree arg, tmpvar;
- call_expr_arg_iterator iter;
+ tree tmpvar;
struct constraint_expr tmpc;
get_constraint_for (lhs, &lhsc);
/* If this is a nested function then it can return anything. */
- if (CALL_EXPR_STATIC_CHAIN (call))
+ if (gimple_call_chain (stmt))
{
rhsc.var = anything_id;
rhsc.offset = 0;
@@ -3652,18 +3583,22 @@ handle_const_call (tree stmt)
process_constraint (new_constraint (tmpc, rhsc));
/* May return arguments. */
- FOR_EACH_CALL_EXPR_ARG (arg, iter, call)
- if (could_have_pointers (arg))
- {
- VEC(ce_s, heap) *argc = NULL;
- struct constraint_expr *argp;
- int i;
-
- get_constraint_for (arg, &argc);
- for (i = 0; VEC_iterate (ce_s, argc, i, argp); i++)
- process_constraint (new_constraint (tmpc, *argp));
- VEC_free (ce_s, heap, argc);
- }
+ for (k = 0; k < gimple_call_num_args (stmt); ++k)
+ {
+ tree arg = gimple_call_arg (stmt, k);
+
+ if (could_have_pointers (arg))
+ {
+ VEC(ce_s, heap) *argc = NULL;
+ struct constraint_expr *argp;
+ int i;
+
+ get_constraint_for (arg, &argc);
+ for (i = 0; VEC_iterate (ce_s, argc, i, argp); i++)
+ process_constraint (new_constraint (tmpc, *argp));
+ VEC_free (ce_s, heap, argc);
+ }
+ }
for (j = 0; VEC_iterate (ce_s, lhsc, j, lhsp); j++)
process_constraint (new_constraint (*lhsp, tmpc));
@@ -3675,28 +3610,30 @@ handle_const_call (tree stmt)
pure function in statement STMT. */
static void
-handle_pure_call (tree stmt)
+handle_pure_call (gimple stmt)
{
- tree call = get_call_expr_in (stmt);
- tree arg;
- call_expr_arg_iterator iter;
+ unsigned i;
/* Memory reached from pointer arguments is call-used. */
- FOR_EACH_CALL_EXPR_ARG (arg, iter, call)
- if (could_have_pointers (arg))
- make_constraint_to (callused_id, arg);
+ for (i = 0; i < gimple_call_num_args (stmt); ++i)
+ {
+ tree arg = gimple_call_arg (stmt, i);
+
+ if (could_have_pointers (arg))
+ make_constraint_to (callused_id, arg);
+ }
/* The static chain is used as well. */
- if (CALL_EXPR_STATIC_CHAIN (call))
- make_constraint_to (callused_id, CALL_EXPR_STATIC_CHAIN (call));
+ if (gimple_call_chain (stmt))
+ make_constraint_to (callused_id, gimple_call_chain (stmt));
/* If the call returns a pointer it may point to reachable memory
from the arguments. Not so for malloc functions though. */
- if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
- && could_have_pointers (GIMPLE_STMT_OPERAND (stmt, 0))
- && !(call_expr_flags (call) & ECF_MALLOC))
+ if (gimple_call_lhs (stmt)
+ && could_have_pointers (gimple_call_lhs (stmt))
+ && !(gimple_call_flags (stmt) & ECF_MALLOC))
{
- tree lhs = GIMPLE_STMT_OPERAND (stmt, 0);
+ tree lhs = gimple_call_lhs (stmt);
VEC(ce_s, heap) *lhsc = NULL;
struct constraint_expr rhsc;
struct constraint_expr *lhsp;
@@ -3705,7 +3642,7 @@ handle_pure_call (tree stmt)
get_constraint_for (lhs, &lhsc);
/* If this is a nested function then it can return anything. */
- if (CALL_EXPR_STATIC_CHAIN (call))
+ if (gimple_call_chain (stmt))
{
rhsc.var = anything_id;
rhsc.offset = 0;
@@ -3733,40 +3670,37 @@ handle_pure_call (tree stmt)
when building alias sets and computing alias grouping heuristics. */
static void
-find_func_aliases (tree origt)
+find_func_aliases (gimple origt)
{
- tree call, t = origt;
+ gimple t = origt;
VEC(ce_s, heap) *lhsc = NULL;
VEC(ce_s, heap) *rhsc = NULL;
struct constraint_expr *c;
enum escape_type stmt_escape_type;
- if (TREE_CODE (t) == RETURN_EXPR && TREE_OPERAND (t, 0))
- t = TREE_OPERAND (t, 0);
-
/* Now build constraints expressions. */
- if (TREE_CODE (t) == PHI_NODE)
+ if (gimple_code (t) == GIMPLE_PHI)
{
- gcc_assert (!AGGREGATE_TYPE_P (TREE_TYPE (PHI_RESULT (t))));
+ gcc_assert (!AGGREGATE_TYPE_P (TREE_TYPE (gimple_phi_result (t))));
/* Only care about pointers and structures containing
pointers. */
- if (could_have_pointers (PHI_RESULT (t)))
+ if (could_have_pointers (gimple_phi_result (t)))
{
- int i;
+ size_t i;
unsigned int j;
/* For a phi node, assign all the arguments to
the result. */
- get_constraint_for (PHI_RESULT (t), &lhsc);
- for (i = 0; i < PHI_NUM_ARGS (t); i++)
+ get_constraint_for (gimple_phi_result (t), &lhsc);
+ for (i = 0; i < gimple_phi_num_args (t); i++)
{
tree rhstype;
tree strippedrhs = PHI_ARG_DEF (t, i);
STRIP_NOPS (strippedrhs);
rhstype = TREE_TYPE (strippedrhs);
- get_constraint_for (PHI_ARG_DEF (t, i), &rhsc);
+ get_constraint_for (gimple_phi_arg_def (t, i), &rhsc);
for (j = 0; VEC_iterate (ce_s, lhsc, j, c); j++)
{
@@ -3782,87 +3716,73 @@ find_func_aliases (tree origt)
}
}
/* In IPA mode, we need to generate constraints to pass call
- arguments through their calls. There are two cases, either a
- GIMPLE_MODIFY_STMT when we are returning a value, or just a plain
- CALL_EXPR when we are not.
+ arguments through their calls. There are two cases,
+ either a GIMPLE_CALL returning a value, or just a plain
+ GIMPLE_CALL when we are not.
In non-ipa mode, we need to generate constraints for each
pointer passed by address. */
- else if ((call = get_call_expr_in (t)) != NULL_TREE)
+ else if (is_gimple_call (t))
{
- int flags = call_expr_flags (call);
if (!in_ipa_mode)
{
+ int flags = gimple_call_flags (t);
+
/* Const functions can return their arguments and addresses
of global memory but not of escaped memory. */
if (flags & ECF_CONST)
{
- if (TREE_CODE (t) == GIMPLE_MODIFY_STMT
- && could_have_pointers (GIMPLE_STMT_OPERAND (t, 1)))
+ if (gimple_call_lhs (t)
+ && could_have_pointers (gimple_call_lhs (t)))
handle_const_call (t);
}
+ /* Pure functions can return addresses in and of memory
+ reachable from their arguments, but they are not an escape
+ point for reachable memory of their arguments. */
else if (flags & ECF_PURE)
{
handle_pure_call (t);
- if (TREE_CODE (t) == GIMPLE_MODIFY_STMT
- && could_have_pointers (GIMPLE_STMT_OPERAND (t, 1)))
- handle_lhs_call (GIMPLE_STMT_OPERAND (t, 0), flags);
+ if (gimple_call_lhs (t)
+ && could_have_pointers (gimple_call_lhs (t)))
+ handle_lhs_call (gimple_call_lhs (t), flags);
}
- /* Pure functions can return addresses in and of memory
- reachable from their arguments, but they are not an escape
- point for reachable memory of their arguments. But as we
- do not compute call-used memory separately we cannot do
- something special here. */
- else if (TREE_CODE (t) == GIMPLE_MODIFY_STMT)
+ else
{
- handle_rhs_call (GIMPLE_STMT_OPERAND (t, 1));
- if (could_have_pointers (GIMPLE_STMT_OPERAND (t, 1)))
- handle_lhs_call (GIMPLE_STMT_OPERAND (t, 0), flags);
+ handle_rhs_call (t);
+ if (gimple_call_lhs (t)
+ && could_have_pointers (gimple_call_lhs (t)))
+ handle_lhs_call (gimple_call_lhs (t), flags);
}
- else
- handle_rhs_call (t);
}
else
{
tree lhsop;
- tree rhsop;
- tree arg;
- call_expr_arg_iterator iter;
varinfo_t fi;
int i = 1;
+ size_t j;
tree decl;
- if (TREE_CODE (t) == GIMPLE_MODIFY_STMT)
- {
- lhsop = GIMPLE_STMT_OPERAND (t, 0);
- rhsop = GIMPLE_STMT_OPERAND (t, 1);
- }
- else
- {
- lhsop = NULL;
- rhsop = t;
- }
- decl = get_callee_fndecl (rhsop);
+
+ lhsop = gimple_call_lhs (t);
+ decl = gimple_call_fndecl (t);
/* If we can directly resolve the function being called, do so.
Otherwise, it must be some sort of indirect expression that
we should still be able to handle. */
if (decl)
- {
- fi = get_vi_for_tree (decl);
- }
+ fi = get_vi_for_tree (decl);
else
{
- decl = CALL_EXPR_FN (rhsop);
+ decl = gimple_call_fn (t);
fi = get_vi_for_tree (decl);
}
/* Assign all the passed arguments to the appropriate incoming
parameters of the function. */
-
- FOR_EACH_CALL_EXPR_ARG (arg, iter, rhsop)
+ for (j = 0; j < gimple_call_num_args (t); j++)
{
struct constraint_expr lhs ;
struct constraint_expr *rhsp;
+ tree arg = gimple_call_arg (t, j);
get_constraint_for (arg, &rhsc);
if (TREE_CODE (decl) != FUNCTION_DECL)
@@ -3914,19 +3834,36 @@ find_func_aliases (tree origt)
/* Otherwise, just a regular assignment statement. Only care about
operations with pointer result, others are dealt with as escape
points if they have pointer operands. */
- else if (TREE_CODE (t) == GIMPLE_MODIFY_STMT
- && could_have_pointers (GIMPLE_STMT_OPERAND (t, 0)))
+ else if (is_gimple_assign (t)
+ && could_have_pointers (gimple_assign_lhs (t)))
{
- tree lhsop = GIMPLE_STMT_OPERAND (t, 0);
- tree rhsop = GIMPLE_STMT_OPERAND (t, 1);
+ /* Otherwise, just a regular assignment statement. */
+ tree lhsop = gimple_assign_lhs (t);
+ tree rhsop = (gimple_num_ops (t) == 2) ? gimple_assign_rhs1 (t) : NULL;
- if (AGGREGATE_TYPE_P (TREE_TYPE (lhsop)))
+ if (rhsop && AGGREGATE_TYPE_P (TREE_TYPE (lhsop)))
do_structure_copy (lhsop, rhsop);
else
{
unsigned int j;
+ struct constraint_expr temp;
get_constraint_for (lhsop, &lhsc);
- get_constraint_for (rhsop, &rhsc);
+
+ if (gimple_assign_rhs_code (t) == POINTER_PLUS_EXPR)
+ get_constraint_for_ptr_offset (gimple_assign_rhs1 (t),
+ gimple_assign_rhs2 (t), &rhsc);
+ else if ((IS_CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (t))
+ && !(POINTER_TYPE_P (gimple_expr_type (t))
+ && !POINTER_TYPE_P (TREE_TYPE (rhsop))))
+ || gimple_assign_single_p (t))
+ get_constraint_for (rhsop, &rhsc);
+ else
+ {
+ temp.type = ADDRESSOF;
+ temp.var = anything_id;
+ temp.offset = 0;
+ VEC_safe_push (ce_s, heap, rhsc, &temp);
+ }
for (j = 0; VEC_iterate (ce_s, lhsc, j, c); j++)
{
struct constraint_expr *c2;
@@ -3937,11 +3874,11 @@ find_func_aliases (tree origt)
}
}
}
- else if (TREE_CODE (t) == CHANGE_DYNAMIC_TYPE_EXPR)
+ else if (gimple_code (t) == GIMPLE_CHANGE_DYNAMIC_TYPE)
{
unsigned int j;
- get_constraint_for (CHANGE_DYNAMIC_TYPE_LOCATION (t), &lhsc);
+ get_constraint_for (gimple_cdt_location (t), &lhsc);
for (j = 0; VEC_iterate (ce_s, lhsc, j, c); ++j)
get_varinfo (c->var)->no_tbaa_pruning = true;
}
@@ -3949,48 +3886,46 @@ find_func_aliases (tree origt)
stmt_escape_type = is_escape_site (t);
if (stmt_escape_type == ESCAPE_STORED_IN_GLOBAL)
{
- tree rhs;
- gcc_assert (TREE_CODE (t) == GIMPLE_MODIFY_STMT);
- rhs = GIMPLE_STMT_OPERAND (t, 1);
- if (TREE_CODE (rhs) == ADDR_EXPR)
+ gcc_assert (is_gimple_assign (t));
+ if (gimple_assign_rhs_code (t) == ADDR_EXPR)
{
+ tree rhs = gimple_assign_rhs1 (t);
tree base = get_base_address (TREE_OPERAND (rhs, 0));
if (base
&& (!DECL_P (base)
|| !is_global_var (base)))
make_escape_constraint (rhs);
}
- else if (TREE_CODE (rhs) == SSA_NAME
- && POINTER_TYPE_P (TREE_TYPE (rhs)))
- make_escape_constraint (rhs);
- else if (could_have_pointers (rhs))
- make_escape_constraint (rhs);
+ else if (get_gimple_rhs_class (gimple_assign_rhs_code (t))
+ == GIMPLE_SINGLE_RHS)
+ {
+ if (could_have_pointers (gimple_assign_rhs1 (t)))
+ make_escape_constraint (gimple_assign_rhs1 (t));
+ }
+ else
+ gcc_unreachable ();
}
else if (stmt_escape_type == ESCAPE_BAD_CAST)
{
- tree rhs;
- gcc_assert (TREE_CODE (t) == GIMPLE_MODIFY_STMT);
- rhs = GIMPLE_STMT_OPERAND (t, 1);
- gcc_assert (CONVERT_EXPR_P (rhs)
- || TREE_CODE (rhs) == VIEW_CONVERT_EXPR);
- rhs = TREE_OPERAND (rhs, 0);
- make_escape_constraint (rhs);
+ gcc_assert (is_gimple_assign (t));
+ gcc_assert (IS_CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (t))
+ || gimple_assign_rhs_code (t) == VIEW_CONVERT_EXPR);
+ make_escape_constraint (gimple_assign_rhs1 (t));
}
else if (stmt_escape_type == ESCAPE_TO_ASM)
{
- tree link;
- int i;
- for (i = 0, link = ASM_OUTPUTS (t); link; i++, link = TREE_CHAIN (link))
+ unsigned i;
+ for (i = 0; i < gimple_asm_noutputs (t); ++i)
{
- tree op = TREE_VALUE (link);
+ tree op = TREE_VALUE (gimple_asm_output_op (t, i));
if (op && could_have_pointers (op))
/* Strictly we'd only need the constraints from ESCAPED and
NONLOCAL. */
make_escape_constraint (op);
}
- for (i = 0, link = ASM_INPUTS (t); link; i++, link = TREE_CHAIN (link))
+ for (i = 0; i < gimple_asm_ninputs (t); ++i)
{
- tree op = TREE_VALUE (link);
+ tree op = TREE_VALUE (gimple_asm_input_op (t, i));
if (op && could_have_pointers (op))
/* Strictly we'd only need the constraint to ESCAPED. */
make_escape_constraint (op);
@@ -4002,7 +3937,7 @@ find_func_aliases (tree origt)
number of statements re-scanned. It's not really necessary to
re-scan *all* statements. */
if (!in_ipa_mode)
- mark_stmt_modified (origt);
+ gimple_set_modified (origt, true);
VEC_free (ce_s, heap, rhsc);
VEC_free (ce_s, heap, lhsc);
}
@@ -4411,8 +4346,8 @@ create_variable_info_for (tree decl, const char *name)
{
unsigned int index = VEC_length (varinfo_t, varmap);
varinfo_t vi;
- tree decltype = TREE_TYPE (decl);
- tree declsize = DECL_P (decl) ? DECL_SIZE (decl) : TYPE_SIZE (decltype);
+ tree decl_type = TREE_TYPE (decl);
+ tree declsize = DECL_P (decl) ? DECL_SIZE (decl) : TYPE_SIZE (decl_type);
bool is_global = DECL_P (decl) ? is_global_var (decl) : false;
VEC (fieldoff_s,heap) *fieldstack = NULL;
@@ -4420,7 +4355,7 @@ create_variable_info_for (tree decl, const char *name)
return create_function_info_for (decl, name);
if (var_can_have_subvars (decl) && use_field_sensitive)
- push_fields_onto_fieldstack (decltype, &fieldstack, 0);
+ push_fields_onto_fieldstack (decl_type, &fieldstack, 0);
/* If the variable doesn't have subvars, we may end up needing to
sort the field list and create fake variables for all the
@@ -5435,25 +5370,28 @@ compute_points_to_sets (void)
/* Now walk all statements and derive aliases. */
FOR_EACH_BB (bb)
{
- block_stmt_iterator bsi;
- tree phi;
+ gimple_stmt_iterator gsi;
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
- if (is_gimple_reg (PHI_RESULT (phi)))
- find_func_aliases (phi);
+ for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ {
+ gimple phi = gsi_stmt (gsi);
+
+ if (is_gimple_reg (gimple_phi_result (phi)))
+ find_func_aliases (phi);
+ }
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); )
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); )
{
- tree stmt = bsi_stmt (bsi);
+ gimple stmt = gsi_stmt (gsi);
find_func_aliases (stmt);
- /* The information in CHANGE_DYNAMIC_TYPE_EXPR nodes has now
- been captured, and we can remove them. */
- if (TREE_CODE (stmt) == CHANGE_DYNAMIC_TYPE_EXPR)
- bsi_remove (&bsi, true);
+ /* The information in GIMPLE_CHANGE_DYNAMIC_TYPE statements
+ has now been captured, and we can remove them. */
+ if (gimple_code (stmt) == GIMPLE_CHANGE_DYNAMIC_TYPE)
+ gsi_remove (&gsi, true);
else
- bsi_next (&bsi);
+ gsi_next (&gsi);
}
}
@@ -5559,8 +5497,7 @@ delete_points_to_sets (void)
static bool
gate_ipa_pta (void)
{
- return (flag_unit_at_a_time != 0
- && flag_ipa_pta
+ return (flag_ipa_pta
/* Don't bother doing anything if the program has errors. */
&& !(errorcount || sorrycount));
}
@@ -5608,22 +5545,19 @@ ipa_pta_execute (void)
FOR_EACH_BB_FN (bb, func)
{
- block_stmt_iterator bsi;
- tree phi;
+ gimple_stmt_iterator gsi;
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
+ for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
- if (is_gimple_reg (PHI_RESULT (phi)))
- {
- find_func_aliases (phi);
- }
- }
+ gimple phi = gsi_stmt (gsi);
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
- {
- tree stmt = bsi_stmt (bsi);
- find_func_aliases (stmt);
+ if (is_gimple_reg (gimple_phi_result (phi)))
+ find_func_aliases (phi);
}
+
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ find_func_aliases (gsi_stmt (gsi));
}
current_function_decl = old_func_decl;
pop_cfun ();
@@ -5709,5 +5643,4 @@ delete_alias_heapvars (void)
heapvar_for_stmt = NULL;
}
-
#include "gt-tree-ssa-structalias.h"
diff --git a/gcc/tree-ssa-structalias.h b/gcc/tree-ssa-structalias.h
index 0d0d6bdf073..e684f5def7f 100644
--- a/gcc/tree-ssa-structalias.h
+++ b/gcc/tree-ssa-structalias.h
@@ -25,8 +25,8 @@ struct constraint;
typedef struct constraint *constraint_t;
/* In tree-ssa-alias.c. */
-enum escape_type is_escape_site (tree);
-void update_mem_sym_stats_from_stmt (tree, tree, long, long);
+enum escape_type is_escape_site (gimple);
+void update_mem_sym_stats_from_stmt (tree, gimple, long, long);
/* In tree-ssa-structalias.c. */
extern void compute_points_to_sets (void);
diff --git a/gcc/tree-ssa-ter.c b/gcc/tree-ssa-ter.c
index a93001a985b..099c19742e4 100644
--- a/gcc/tree-ssa-ter.c
+++ b/gcc/tree-ssa-ter.c
@@ -30,6 +30,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-flow.h"
#include "tree-dump.h"
#include "tree-ssa-live.h"
+#include "flags.h"
/* Temporary Expression Replacement (TER)
@@ -88,7 +89,7 @@ along with GCC; see the file COPYING3. If not see
TER implements this but stepping through the instructions in a block and
tracking potential expressions for replacement, and the partitions they are
dependent on. Expressions are represented by the SSA_NAME_VERSION of the
- DEF on the LHS of a GIMPLE_MODIFY_STMT and the expression is the RHS.
+ DEF on the LHS of a GIMPLE_ASSIGN and the expression is the RHS.
When a stmt is determined to be a possible replacement expression, the
following steps are taken:
@@ -158,7 +159,7 @@ typedef struct temp_expr_table_d
{
var_map map;
bitmap *partition_dependencies; /* Partitions expr is dependent on. */
- tree *replaceable_expressions; /* Replacement expression table. */
+ gimple *replaceable_expressions; /* Replacement expression table. */
bitmap *expr_decl_uids; /* Base uids of exprs. */
bitmap *kill_list; /* Expr's killed by a partition. */
int virtual_partition; /* Pseudo partition for virtual ops. */
@@ -215,10 +216,10 @@ new_temp_expr_table (var_map map)
/* Free TER table T. If there are valid replacements, return the expression
vector. */
-static tree *
+static gimple *
free_temp_expr_table (temp_expr_table_p t)
{
- tree *ret = NULL;
+ gimple *ret = NULL;
unsigned i;
#ifdef ENABLE_CHECKING
@@ -254,7 +255,7 @@ version_to_be_replaced_p (temp_expr_table_p tab, int version)
{
if (!tab->replaceable_expressions)
return false;
- return tab->replaceable_expressions[version] != NULL_TREE;
+ return tab->replaceable_expressions[version] != NULL;
}
@@ -359,18 +360,20 @@ add_dependence (temp_expr_table_p tab, int version, tree var)
/* Return TRUE if expression STMT is suitable for replacement. */
static inline bool
-is_replaceable_p (tree stmt)
+is_replaceable_p (gimple stmt)
{
- tree call_expr;
use_operand_p use_p;
- tree def, use_stmt;
+ tree def;
+ gimple use_stmt;
+ location_t locus1, locus2;
+ tree block1, block2;
/* Only consider modify stmts. */
- if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
+ if (!is_gimple_assign (stmt))
return false;
/* If the statement may throw an exception, it cannot be replaced. */
- if (tree_could_throw_p (stmt))
+ if (stmt_could_throw_p (stmt))
return false;
/* Punt if there is more than 1 def. */
@@ -383,36 +386,57 @@ is_replaceable_p (tree stmt)
return false;
/* If the use isn't in this block, it wont be replaced either. */
- if (bb_for_stmt (use_stmt) != bb_for_stmt (stmt))
+ if (gimple_bb (use_stmt) != gimple_bb (stmt))
+ return false;
+
+ locus1 = gimple_location (stmt);
+ block1 = gimple_block (stmt);
+
+ if (gimple_code (use_stmt) == GIMPLE_PHI)
+ {
+ locus2 = 0;
+ block2 = NULL_TREE;
+ }
+ else
+ {
+ locus2 = gimple_location (use_stmt);
+ block2 = gimple_block (use_stmt);
+ }
+
+ if (!optimize
+ && ((locus1 && locus1 != locus2) || (block1 && block1 != block2)))
return false;
/* Used in this block, but at the TOP of the block, not the end. */
- if (TREE_CODE (use_stmt) == PHI_NODE)
+ if (gimple_code (use_stmt) == GIMPLE_PHI)
return false;
/* There must be no VDEFs. */
if (!(ZERO_SSA_OPERANDS (stmt, SSA_OP_VDEF)))
return false;
+ /* Without alias info we can't move around loads. */
+ if (gimple_references_memory_p (stmt) && !optimize)
+ return false;
+
/* Float expressions must go through memory if float-store is on. */
if (flag_float_store
- && FLOAT_TYPE_P (TREE_TYPE (GENERIC_TREE_OPERAND (stmt, 1))))
+ && FLOAT_TYPE_P (gimple_expr_type (stmt)))
return false;
/* An assignment with a register variable on the RHS is not
replaceable. */
- if (TREE_CODE (GENERIC_TREE_OPERAND (stmt, 1)) == VAR_DECL
- && DECL_HARD_REGISTER (GENERIC_TREE_OPERAND (stmt, 1)))
+ if (gimple_assign_rhs_code (stmt) == VAR_DECL
+ && DECL_HARD_REGISTER (gimple_assign_rhs1 (stmt)))
return false;
/* No function calls can be replaced. */
- if ((call_expr = get_call_expr_in (stmt)) != NULL_TREE)
+ if (is_gimple_call (stmt))
return false;
/* Leave any stmt with volatile operands alone as well. */
- if (stmt_ann (stmt)->has_volatile_ops)
+ if (gimple_has_volatile_ops (stmt))
return false;
-
return true;
}
@@ -444,7 +468,7 @@ finished_with_expr (temp_expr_table_p tab, int version, bool free_expr)
/* Create an expression entry for a replaceable expression. */
static void
-process_replaceable (temp_expr_table_p tab, tree stmt)
+process_replaceable (temp_expr_table_p tab, gimple stmt)
{
tree var, def, basevar;
int version;
@@ -538,7 +562,7 @@ mark_replaceable (temp_expr_table_p tab, tree var, bool more_replacing)
/* Set the replaceable expression. */
if (!tab->replaceable_expressions)
- tab->replaceable_expressions = XCNEWVEC (tree, num_ssa_names + 1);
+ tab->replaceable_expressions = XCNEWVEC (gimple, num_ssa_names + 1);
tab->replaceable_expressions[version] = SSA_NAME_DEF_STMT (var);
}
@@ -549,20 +573,20 @@ mark_replaceable (temp_expr_table_p tab, tree var, bool more_replacing)
static void
find_replaceable_in_bb (temp_expr_table_p tab, basic_block bb)
{
- block_stmt_iterator bsi;
- tree stmt, def, use;
- stmt_ann_t ann;
+ gimple_stmt_iterator bsi;
+ gimple stmt;
+ tree def, use;
int partition;
var_map map = tab->map;
ssa_op_iter iter;
bool stmt_replaceable;
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
{
- stmt = bsi_stmt (bsi);
- ann = stmt_ann (stmt);
+ stmt = gsi_stmt (bsi);
stmt_replaceable = is_replaceable_p (stmt);
+
/* Determine if this stmt finishes an existing expression. */
FOR_EACH_SSA_TREE_OPERAND (use, stmt, iter, SSA_OP_USE)
{
@@ -591,7 +615,7 @@ find_replaceable_in_bb (temp_expr_table_p tab, basic_block bb)
/* Mark expression as replaceable unless stmt is volatile or the
def variable has the same root variable as something in the
substitution list. */
- if (ann->has_volatile_ops || same_root_var)
+ if (gimple_has_volatile_ops (stmt) || same_root_var)
finished_with_expr (tab, ver, true);
else
mark_replaceable (tab, use, stmt_replaceable);
@@ -629,12 +653,12 @@ find_replaceable_in_bb (temp_expr_table_p tab, basic_block bb)
NULL is returned by the function, otherwise an expression vector indexed
by SSA_NAME version numbers. */
-extern tree *
+extern gimple *
find_replaceable_exprs (var_map map)
{
basic_block bb;
temp_expr_table_p table;
- tree *ret;
+ gimple *ret;
table = new_temp_expr_table (map);
FOR_EACH_BB (bb)
@@ -664,23 +688,20 @@ find_replaceable_exprs (var_map map)
/* Dump TER expression table EXPR to file F. */
-extern void
-dump_replaceable_exprs (FILE *f, tree *expr)
+void
+dump_replaceable_exprs (FILE *f, gimple *expr)
{
- tree stmt, var;
- int x;
+ tree var;
+ unsigned x;
fprintf (f, "\nReplacing Expressions\n");
- for (x = 0; x < (int)num_ssa_names; x++)
+ for (x = 0; x < num_ssa_names; x++)
if (expr[x])
{
- stmt = expr[x];
- var = SINGLE_SSA_TREE_OPERAND (stmt, SSA_OP_DEF);
- gcc_assert (var != NULL_TREE);
+ var = ssa_name (x);
print_generic_expr (f, var, TDF_SLIM);
fprintf (f, " replace with --> ");
- print_generic_expr (f, GENERIC_TREE_OPERAND (stmt, 1),
- TDF_SLIM);
+ print_gimple_stmt (f, expr[x], 0, TDF_SLIM);
fprintf (f, "\n");
}
fprintf (f, "\n");
@@ -692,7 +713,7 @@ dump_replaceable_exprs (FILE *f, tree *expr)
exclusively to debug TER. F is the place to send debug info and T is the
table being debugged. */
-extern void
+void
debug_ter (FILE *f, temp_expr_table_p t)
{
unsigned x, y;
diff --git a/gcc/tree-ssa-threadedge.c b/gcc/tree-ssa-threadedge.c
index 462da5d6058..6a821611800 100644
--- a/gcc/tree-ssa-threadedge.c
+++ b/gcc/tree-ssa-threadedge.c
@@ -55,7 +55,7 @@ static int stmt_count;
bool
potentially_threadable_block (basic_block bb)
{
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
/* If BB has a single successor or a single predecessor, then
there is no threading opportunity. */
@@ -64,12 +64,12 @@ potentially_threadable_block (basic_block bb)
/* If BB does not end with a conditional, switch or computed goto,
then there is no threading opportunity. */
- bsi = bsi_last (bb);
- if (bsi_end_p (bsi)
- || ! bsi_stmt (bsi)
- || (TREE_CODE (bsi_stmt (bsi)) != COND_EXPR
- && TREE_CODE (bsi_stmt (bsi)) != GOTO_EXPR
- && TREE_CODE (bsi_stmt (bsi)) != SWITCH_EXPR))
+ gsi = gsi_last_bb (bb);
+ if (gsi_end_p (gsi)
+ || ! gsi_stmt (gsi)
+ || (gimple_code (gsi_stmt (gsi)) != GIMPLE_COND
+ && gimple_code (gsi_stmt (gsi)) != GIMPLE_GOTO
+ && gimple_code (gsi_stmt (gsi)) != GIMPLE_SWITCH))
return false;
return true;
@@ -80,28 +80,27 @@ potentially_threadable_block (basic_block bb)
BB. If no such ASSERT_EXPR is found, return OP. */
static tree
-lhs_of_dominating_assert (tree op, basic_block bb, tree stmt)
+lhs_of_dominating_assert (tree op, basic_block bb, gimple stmt)
{
imm_use_iterator imm_iter;
- tree use_stmt;
+ gimple use_stmt;
use_operand_p use_p;
FOR_EACH_IMM_USE_FAST (use_p, imm_iter, op)
{
use_stmt = USE_STMT (use_p);
if (use_stmt != stmt
- && TREE_CODE (use_stmt) == GIMPLE_MODIFY_STMT
- && TREE_CODE (GIMPLE_STMT_OPERAND (use_stmt, 1)) == ASSERT_EXPR
- && TREE_OPERAND (GIMPLE_STMT_OPERAND (use_stmt, 1), 0) == op
- && dominated_by_p (CDI_DOMINATORS, bb, bb_for_stmt (use_stmt)))
+ && gimple_assign_single_p (use_stmt)
+ && TREE_CODE (gimple_assign_rhs1 (use_stmt)) == ASSERT_EXPR
+ && TREE_OPERAND (gimple_assign_rhs1 (use_stmt), 0) == op
+ && dominated_by_p (CDI_DOMINATORS, bb, gimple_bb (use_stmt)))
{
- return GIMPLE_STMT_OPERAND (use_stmt, 0);
+ return gimple_assign_lhs (use_stmt);
}
}
return op;
}
-
/* We record temporary equivalences created by PHI nodes or
statements within the target block. Doing so allows us to
identify more jump threading opportunities, even in blocks
@@ -161,23 +160,24 @@ record_temporary_equivalence (tree x, tree y, VEC(tree, heap) **stack)
static bool
record_temporary_equivalences_from_phis (edge e, VEC(tree, heap) **stack)
{
- tree phi;
+ gimple_stmt_iterator gsi;
/* Each PHI creates a temporary equivalence, record them.
These are context sensitive equivalences and will be removed
later. */
- for (phi = phi_nodes (e->dest); phi; phi = PHI_CHAIN (phi))
+ for (gsi = gsi_start_phis (e->dest); !gsi_end_p (gsi); gsi_next (&gsi))
{
+ gimple phi = gsi_stmt (gsi);
tree src = PHI_ARG_DEF_FROM_EDGE (phi, e);
- tree dst = PHI_RESULT (phi);
+ tree dst = gimple_phi_result (phi);
/* If the desired argument is not the same as this PHI's result
and it is set by a PHI in E->dest, then we can not thread
through E->dest. */
if (src != dst
&& TREE_CODE (src) == SSA_NAME
- && TREE_CODE (SSA_NAME_DEF_STMT (src)) == PHI_NODE
- && bb_for_stmt (SSA_NAME_DEF_STMT (src)) == e->dest)
+ && gimple_code (SSA_NAME_DEF_STMT (src)) == GIMPLE_PHI
+ && gimple_bb (SSA_NAME_DEF_STMT (src)) == e->dest)
return false;
/* We consider any non-virtual PHI as a statement since it
@@ -190,6 +190,56 @@ record_temporary_equivalences_from_phis (edge e, VEC(tree, heap) **stack)
return true;
}
+/* Fold the RHS of an assignment statement and return it as a tree.
+ May return NULL_TREE if no simplification is possible. */
+
+static tree
+fold_assignment_stmt (gimple stmt)
+{
+ enum tree_code subcode = gimple_assign_rhs_code (stmt);
+
+ switch (get_gimple_rhs_class (subcode))
+ {
+ case GIMPLE_SINGLE_RHS:
+ {
+ tree rhs = gimple_assign_rhs1 (stmt);
+
+ if (TREE_CODE (rhs) == COND_EXPR)
+ {
+ /* Sadly, we have to handle conditional assignments specially
+ here, because fold expects all the operands of an expression
+ to be folded before the expression itself is folded, but we
+ can't just substitute the folded condition here. */
+ tree cond = fold (COND_EXPR_COND (rhs));
+ if (cond == boolean_true_node)
+ rhs = COND_EXPR_THEN (rhs);
+ else if (cond == boolean_false_node)
+ rhs = COND_EXPR_ELSE (rhs);
+ }
+
+ return fold (rhs);
+ }
+ break;
+ case GIMPLE_UNARY_RHS:
+ {
+ tree lhs = gimple_assign_lhs (stmt);
+ tree op0 = gimple_assign_rhs1 (stmt);
+ return fold_unary (subcode, TREE_TYPE (lhs), op0);
+ }
+ break;
+ case GIMPLE_BINARY_RHS:
+ {
+ tree lhs = gimple_assign_lhs (stmt);
+ tree op0 = gimple_assign_rhs1 (stmt);
+ tree op1 = gimple_assign_rhs2 (stmt);
+ return fold_binary (subcode, TREE_TYPE (lhs), op0, op1);
+ }
+ break;
+ default:
+ gcc_unreachable ();
+ }
+}
+
/* Try to simplify each statement in E->dest, ultimately leading to
a simplification of the COND_EXPR at the end of E->dest.
@@ -204,17 +254,17 @@ record_temporary_equivalences_from_phis (edge e, VEC(tree, heap) **stack)
If we are able to simplify a statement into the form
SSA_NAME = (SSA_NAME | gimple invariant), then we can record
- a context sensitive equivalency which may help us simplify
+ a context sensitive equivalence which may help us simplify
later statements in E->dest. */
-static tree
+static gimple
record_temporary_equivalences_from_stmts_at_dest (edge e,
VEC(tree, heap) **stack,
- tree (*simplify) (tree,
- tree))
+ tree (*simplify) (gimple,
+ gimple))
{
- block_stmt_iterator bsi;
- tree stmt = NULL;
+ gimple stmt = NULL;
+ gimple_stmt_iterator gsi;
int max_stmt_count;
max_stmt_count = PARAM_VALUE (PARAM_MAX_JUMP_THREAD_DUPLICATION_STMTS);
@@ -223,21 +273,20 @@ record_temporary_equivalences_from_stmts_at_dest (edge e,
we discover. Note any equivalences we discover are context
sensitive (ie, are dependent on traversing E) and must be unwound
when we're finished processing E. */
- for (bsi = bsi_start (e->dest); ! bsi_end_p (bsi); bsi_next (&bsi))
+ for (gsi = gsi_start_bb (e->dest); !gsi_end_p (gsi); gsi_next (&gsi))
{
tree cached_lhs = NULL;
- tree rhs;
- stmt = bsi_stmt (bsi);
+ stmt = gsi_stmt (gsi);
/* Ignore empty statements and labels. */
- if (IS_EMPTY_STMT (stmt) || TREE_CODE (stmt) == LABEL_EXPR)
+ if (gimple_code (stmt) == GIMPLE_NOP || gimple_code (stmt) == GIMPLE_LABEL)
continue;
/* If the statement has volatile operands, then we assume we
can not thread through this block. This is overly
conservative in some ways. */
- if (TREE_CODE (stmt) == ASM_EXPR && ASM_VOLATILE_P (stmt))
+ if (gimple_code (stmt) == GIMPLE_ASM && gimple_asm_volatile_p (stmt))
return NULL;
/* If duplicating this block is going to cause too much code
@@ -246,15 +295,16 @@ record_temporary_equivalences_from_stmts_at_dest (edge e,
if (stmt_count > max_stmt_count)
return NULL;
- /* If this is not a GIMPLE_MODIFY_STMT which sets an SSA_NAME to a new
+ /* If this is not a statement that sets an SSA_NAME to a new
value, then do not try to simplify this statement as it will
not simplify in any way that is helpful for jump threading. */
- if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT
- || TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 0)) != SSA_NAME)
+ if ((gimple_code (stmt) != GIMPLE_ASSIGN
+ || TREE_CODE (gimple_assign_lhs (stmt)) != SSA_NAME)
+ && (gimple_code (stmt) != GIMPLE_CALL
+ || gimple_call_lhs (stmt) == NULL_TREE
+ || TREE_CODE (gimple_call_lhs (stmt)) != SSA_NAME))
continue;
- rhs = GIMPLE_STMT_OPERAND (stmt, 1);
-
/* The result of __builtin_object_size depends on all the arguments
of a phi node. Temporarily using only one edge produces invalid
results. For example
@@ -272,9 +322,9 @@ record_temporary_equivalences_from_stmts_at_dest (edge e,
remaining bytes. If we use only one edge on the phi, the result will
change to be the remaining bytes for the corresponding phi argument. */
- if (TREE_CODE (rhs) == CALL_EXPR)
+ if (is_gimple_call (stmt))
{
- tree fndecl = get_callee_fndecl (rhs);
+ tree fndecl = gimple_call_fndecl (stmt);
if (fndecl && DECL_FUNCTION_CODE (fndecl) == BUILT_IN_OBJECT_SIZE)
continue;
}
@@ -286,16 +336,18 @@ record_temporary_equivalences_from_stmts_at_dest (edge e,
Handle simple copy operations as well as implied copies from
ASSERT_EXPRs. */
- if (TREE_CODE (rhs) == SSA_NAME)
- cached_lhs = rhs;
- else if (TREE_CODE (rhs) == ASSERT_EXPR)
- cached_lhs = TREE_OPERAND (rhs, 0);
+ if (gimple_assign_single_p (stmt)
+ && TREE_CODE (gimple_assign_rhs1 (stmt)) == SSA_NAME)
+ cached_lhs = gimple_assign_rhs1 (stmt);
+ else if (gimple_assign_single_p (stmt)
+ && TREE_CODE (gimple_assign_rhs1 (stmt)) == ASSERT_EXPR)
+ cached_lhs = TREE_OPERAND (gimple_assign_rhs1 (stmt), 0);
else
{
/* A statement that is not a trivial copy or ASSERT_EXPR.
We're going to temporarily copy propagate the operands
and see if that allows us to simplify this statement. */
- tree *copy, pre_fold_expr;
+ tree *copy;
ssa_op_iter iter;
use_operand_p use_p;
unsigned int num, i = 0;
@@ -318,33 +370,17 @@ record_temporary_equivalences_from_stmts_at_dest (edge e,
}
/* Try to fold/lookup the new expression. Inserting the
- expression into the hash table is unlikely to help
- Sadly, we have to handle conditional assignments specially
- here, because fold expects all the operands of an expression
- to be folded before the expression itself is folded, but we
- can't just substitute the folded condition here. */
- if (TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 1)) == COND_EXPR)
- {
- tree cond = COND_EXPR_COND (GIMPLE_STMT_OPERAND (stmt, 1));
- cond = fold (cond);
- if (cond == boolean_true_node)
- pre_fold_expr = COND_EXPR_THEN (GIMPLE_STMT_OPERAND (stmt, 1));
- else if (cond == boolean_false_node)
- pre_fold_expr = COND_EXPR_ELSE (GIMPLE_STMT_OPERAND (stmt, 1));
- else
- pre_fold_expr = GIMPLE_STMT_OPERAND (stmt, 1);
- }
+ expression into the hash table is unlikely to help. */
+ if (is_gimple_call (stmt))
+ cached_lhs = fold_call_stmt (stmt, false);
else
- pre_fold_expr = GIMPLE_STMT_OPERAND (stmt, 1);
-
- if (pre_fold_expr)
- {
- cached_lhs = fold (pre_fold_expr);
- if (TREE_CODE (cached_lhs) != SSA_NAME
- && !is_gimple_min_invariant (cached_lhs))
- cached_lhs = (*simplify) (stmt, stmt);
- }
+ cached_lhs = fold_assignment_stmt (stmt);
+ if (!cached_lhs
+ || (TREE_CODE (cached_lhs) != SSA_NAME
+ && !is_gimple_min_invariant (cached_lhs)))
+ cached_lhs = (*simplify) (stmt, stmt);
+
/* Restore the statement's original uses/defs. */
i = 0;
FOR_EACH_SSA_USE_OPERAND (use_p, stmt, iter, SSA_OP_USE | SSA_OP_VUSE)
@@ -358,16 +394,14 @@ record_temporary_equivalences_from_stmts_at_dest (edge e,
if (cached_lhs
&& (TREE_CODE (cached_lhs) == SSA_NAME
|| is_gimple_min_invariant (cached_lhs)))
- record_temporary_equivalence (GIMPLE_STMT_OPERAND (stmt, 0),
- cached_lhs,
- stack);
+ record_temporary_equivalence (gimple_get_lhs (stmt), cached_lhs, stack);
}
return stmt;
}
/* Simplify the control statement at the end of the block E->dest.
- To avoid allocating memory unnecessarily, a scratch COND_EXPR
+ To avoid allocating memory unnecessarily, a scratch GIMPLE_COND
is available to use/clobber in DUMMY_COND.
Use SIMPLIFY (a pointer to a callback function) to further simplify
@@ -378,30 +412,24 @@ record_temporary_equivalences_from_stmts_at_dest (edge e,
static tree
simplify_control_stmt_condition (edge e,
- tree stmt,
- tree dummy_cond,
- tree (*simplify) (tree, tree),
+ gimple stmt,
+ gimple dummy_cond,
+ tree (*simplify) (gimple, gimple),
bool handle_dominating_asserts)
{
tree cond, cached_lhs;
-
- if (TREE_CODE (stmt) == COND_EXPR)
- cond = COND_EXPR_COND (stmt);
- else if (TREE_CODE (stmt) == GOTO_EXPR)
- cond = GOTO_DESTINATION (stmt);
- else
- cond = SWITCH_COND (stmt);
+ enum gimple_code code = gimple_code (stmt);
/* For comparisons, we have to update both operands, then try
to simplify the comparison. */
- if (COMPARISON_CLASS_P (cond))
+ if (code == GIMPLE_COND)
{
tree op0, op1;
enum tree_code cond_code;
- op0 = TREE_OPERAND (cond, 0);
- op1 = TREE_OPERAND (cond, 1);
- cond_code = TREE_CODE (cond);
+ op0 = gimple_cond_lhs (stmt);
+ op1 = gimple_cond_rhs (stmt);
+ cond_code = gimple_cond_code (stmt);
/* Get the current value of both operands. */
if (TREE_CODE (op0) == SSA_NAME)
@@ -434,11 +462,10 @@ simplify_control_stmt_condition (edge e,
example, op0 might be a constant while op1 is an
SSA_NAME. Failure to canonicalize will cause us to
miss threading opportunities. */
- if (cond_code != SSA_NAME
- && tree_swap_operands_p (op0, op1, false))
+ if (tree_swap_operands_p (op0, op1, false))
{
tree tmp;
- cond_code = swap_tree_comparison (TREE_CODE (cond));
+ cond_code = swap_tree_comparison (cond_code);
tmp = op0;
op0 = op1;
op1 = tmp;
@@ -446,34 +473,47 @@ simplify_control_stmt_condition (edge e,
/* Stuff the operator and operands into our dummy conditional
expression. */
- TREE_SET_CODE (COND_EXPR_COND (dummy_cond), cond_code);
- TREE_OPERAND (COND_EXPR_COND (dummy_cond), 0) = op0;
- TREE_OPERAND (COND_EXPR_COND (dummy_cond), 1) = op1;
+ gimple_cond_set_code (dummy_cond, cond_code);
+ gimple_cond_set_lhs (dummy_cond, op0);
+ gimple_cond_set_rhs (dummy_cond, op1);
/* We absolutely do not care about any type conversions
we only care about a zero/nonzero value. */
fold_defer_overflow_warnings ();
- cached_lhs = fold (COND_EXPR_COND (dummy_cond));
- while (CONVERT_EXPR_P (cached_lhs))
- cached_lhs = TREE_OPERAND (cached_lhs, 0);
+ cached_lhs = fold_binary (cond_code, boolean_type_node, op0, op1);
+ if (cached_lhs)
+ while (TREE_CODE (cached_lhs) == NOP_EXPR
+ || TREE_CODE (cached_lhs) == CONVERT_EXPR)
+ cached_lhs = TREE_OPERAND (cached_lhs, 0);
- fold_undefer_overflow_warnings (is_gimple_min_invariant (cached_lhs),
+ fold_undefer_overflow_warnings ((cached_lhs
+ && is_gimple_min_invariant (cached_lhs)),
stmt, WARN_STRICT_OVERFLOW_CONDITIONAL);
/* If we have not simplified the condition down to an invariant,
then use the pass specific callback to simplify the condition. */
- if (! is_gimple_min_invariant (cached_lhs))
- cached_lhs = (*simplify) (dummy_cond, stmt);
+ if (!cached_lhs
+ || !is_gimple_min_invariant (cached_lhs))
+ cached_lhs = (*simplify) (dummy_cond, stmt);
+
+ return cached_lhs;
}
+ if (code == GIMPLE_SWITCH)
+ cond = gimple_switch_index (stmt);
+ else if (code == GIMPLE_GOTO)
+ cond = gimple_goto_dest (stmt);
+ else
+ gcc_unreachable ();
+
/* We can have conditionals which just test the state of a variable
rather than use a relational operator. These are simpler to handle. */
- else if (TREE_CODE (cond) == SSA_NAME)
+ if (TREE_CODE (cond) == SSA_NAME)
{
cached_lhs = cond;
- /* Get the variable's current value from the equivalency chains.
+ /* Get the variable's current value from the equivalence chains.
It is possible to get loops in the SSA_NAME_VALUE chains
(consider threading the backedge of a loop where we have
@@ -527,13 +567,13 @@ simplify_control_stmt_condition (edge e,
SIMPLIFY is a pass-specific function used to simplify statements. */
void
-thread_across_edge (tree dummy_cond,
+thread_across_edge (gimple dummy_cond,
edge e,
bool handle_dominating_asserts,
VEC(tree, heap) **stack,
- tree (*simplify) (tree, tree))
+ tree (*simplify) (gimple, gimple))
{
- tree stmt;
+ gimple stmt;
/* If E is a backedge, then we want to verify that the COND_EXPR,
SWITCH_EXPR or GOTO_EXPR at the end of e->dest is not affected
@@ -543,15 +583,15 @@ thread_across_edge (tree dummy_cond,
{
ssa_op_iter iter;
use_operand_p use_p;
- tree last = bsi_stmt (bsi_last (e->dest));
+ gimple last = gsi_stmt (gsi_last_bb (e->dest));
FOR_EACH_SSA_USE_OPERAND (use_p, last, iter, SSA_OP_USE | SSA_OP_VUSE)
{
tree use = USE_FROM_PTR (use_p);
if (TREE_CODE (use) == SSA_NAME
- && TREE_CODE (SSA_NAME_DEF_STMT (use)) != PHI_NODE
- && bb_for_stmt (SSA_NAME_DEF_STMT (use)) == e->dest)
+ && gimple_code (SSA_NAME_DEF_STMT (use)) != GIMPLE_PHI
+ && gimple_bb (SSA_NAME_DEF_STMT (use)) == e->dest)
goto fail;
}
}
@@ -570,9 +610,9 @@ thread_across_edge (tree dummy_cond,
/* If we stopped at a COND_EXPR or SWITCH_EXPR, see if we know which arm
will be taken. */
- if (TREE_CODE (stmt) == COND_EXPR
- || TREE_CODE (stmt) == GOTO_EXPR
- || TREE_CODE (stmt) == SWITCH_EXPR)
+ if (gimple_code (stmt) == GIMPLE_COND
+ || gimple_code (stmt) == GIMPLE_GOTO
+ || gimple_code (stmt) == GIMPLE_SWITCH)
{
tree cond;
diff --git a/gcc/tree-ssa-threadupdate.c b/gcc/tree-ssa-threadupdate.c
index 54f87afaf68..dedd00ecb9a 100644
--- a/gcc/tree-ssa-threadupdate.c
+++ b/gcc/tree-ssa-threadupdate.c
@@ -169,23 +169,23 @@ struct thread_stats_d thread_stats;
static void
remove_ctrl_stmt_and_useless_edges (basic_block bb, basic_block dest_bb)
{
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
edge e;
edge_iterator ei;
- bsi = bsi_last (bb);
+ gsi = gsi_last_bb (bb);
/* If the duplicate ends with a control statement, then remove it.
Note that if we are duplicating the template block rather than the
original basic block, then the duplicate might not have any real
statements in it. */
- if (!bsi_end_p (bsi)
- && bsi_stmt (bsi)
- && (TREE_CODE (bsi_stmt (bsi)) == COND_EXPR
- || TREE_CODE (bsi_stmt (bsi)) == GOTO_EXPR
- || TREE_CODE (bsi_stmt (bsi)) == SWITCH_EXPR))
- bsi_remove (&bsi, true);
+ if (!gsi_end_p (gsi)
+ && gsi_stmt (gsi)
+ && (gimple_code (gsi_stmt (gsi)) == GIMPLE_COND
+ || gimple_code (gsi_stmt (gsi)) == GIMPLE_GOTO
+ || gimple_code (gsi_stmt (gsi)) == GIMPLE_SWITCH))
+ gsi_remove (&gsi, true);
for (ei = ei_start (bb->succs); (e = ei_safe_edge (ei)); )
{
@@ -311,7 +311,7 @@ static void
create_edge_and_update_destination_phis (struct redirection_data *rd)
{
edge e = make_edge (rd->dup_block, rd->outgoing_edge->dest, EDGE_FALLTHRU);
- tree phi;
+ gimple_stmt_iterator gsi;
rescan_loop_exit (e, true, false);
e->probability = REG_BR_PROB_BASE;
@@ -322,10 +322,12 @@ create_edge_and_update_destination_phis (struct redirection_data *rd)
from the duplicate block, then we will need to add a new argument
to them. The argument should have the same value as the argument
associated with the outgoing edge stored in RD. */
- for (phi = phi_nodes (e->dest); phi; phi = PHI_CHAIN (phi))
+ for (gsi = gsi_start_phis (e->dest); !gsi_end_p (gsi); gsi_next (&gsi))
{
+ gimple phi = gsi_stmt (gsi);
+
int indx = rd->outgoing_edge->dest_idx;
- add_phi_arg (phi, PHI_ARG_DEF (phi, indx), e);
+ add_phi_arg (phi, gimple_phi_arg_def (phi, indx), e);
}
}
@@ -468,24 +470,24 @@ redirect_edges (void **slot, void *data)
static bool
redirection_block_p (basic_block bb)
{
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
/* Advance to the first executable statement. */
- bsi = bsi_start (bb);
- while (!bsi_end_p (bsi)
- && (TREE_CODE (bsi_stmt (bsi)) == LABEL_EXPR
- || IS_EMPTY_STMT (bsi_stmt (bsi))))
- bsi_next (&bsi);
-
+ gsi = gsi_start_bb (bb);
+ while (!gsi_end_p (gsi)
+ && (gimple_code (gsi_stmt (gsi)) == GIMPLE_LABEL
+ || gimple_nop_p (gsi_stmt (gsi))))
+ gsi_next (&gsi);
+
/* Check if this is an empty block. */
- if (bsi_end_p (bsi))
+ if (gsi_end_p (gsi))
return true;
/* Test that we've reached the terminating control statement. */
- return bsi_stmt (bsi)
- && (TREE_CODE (bsi_stmt (bsi)) == COND_EXPR
- || TREE_CODE (bsi_stmt (bsi)) == GOTO_EXPR
- || TREE_CODE (bsi_stmt (bsi)) == SWITCH_EXPR);
+ return gsi_stmt (gsi)
+ && (gimple_code (gsi_stmt (gsi)) == GIMPLE_COND
+ || gimple_code (gsi_stmt (gsi)) == GIMPLE_GOTO
+ || gimple_code (gsi_stmt (gsi)) == GIMPLE_SWITCH);
}
/* BB is a block which ends with a COND_EXPR or SWITCH_EXPR and when BB
diff --git a/gcc/tree-ssa-uncprop.c b/gcc/tree-ssa-uncprop.c
index 0d19c2dfa5f..335d7aed14b 100644
--- a/gcc/tree-ssa-uncprop.c
+++ b/gcc/tree-ssa-uncprop.c
@@ -1,5 +1,5 @@
/* Routines for discovering and unpropagating edge equivalences.
- Copyright (C) 2005, 2007 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2007, 2008 Free Software Foundation, Inc.
This file is part of GCC.
@@ -65,50 +65,35 @@ associate_equivalences_with_edges (void)
then it might create a useful equivalence. */
FOR_EACH_BB (bb)
{
- block_stmt_iterator bsi = bsi_last (bb);
- tree stmt;
+ gimple_stmt_iterator gsi = gsi_last_bb (bb);
+ gimple stmt;
/* If the block does not end with a COND_EXPR or SWITCH_EXPR
then there is nothing to do. */
- if (bsi_end_p (bsi))
+ if (gsi_end_p (gsi))
continue;
- stmt = bsi_stmt (bsi);
+ stmt = gsi_stmt (gsi);
if (!stmt)
continue;
/* A COND_EXPR may create an equivalency in a variety of different
ways. */
- if (TREE_CODE (stmt) == COND_EXPR)
+ if (gimple_code (stmt) == GIMPLE_COND)
{
- tree cond = COND_EXPR_COND (stmt);
edge true_edge;
edge false_edge;
struct edge_equivalency *equivalency;
+ enum tree_code code = gimple_cond_code (stmt);
extract_true_false_edges_from_block (bb, &true_edge, &false_edge);
- /* If the conditional is a single variable 'X', record 'X = 1'
- for the true edge and 'X = 0' on the false edge. */
- if (TREE_CODE (cond) == SSA_NAME
- && !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (cond))
- {
- equivalency = XNEW (struct edge_equivalency);
- equivalency->rhs = constant_boolean_node (1, TREE_TYPE (cond));
- equivalency->lhs = cond;
- true_edge->aux = equivalency;
-
- equivalency = XNEW (struct edge_equivalency);
- equivalency->rhs = constant_boolean_node (0, TREE_TYPE (cond));
- equivalency->lhs = cond;
- false_edge->aux = equivalency;
- }
/* Equality tests may create one or two equivalences. */
- else if (TREE_CODE (cond) == EQ_EXPR || TREE_CODE (cond) == NE_EXPR)
+ if (code == EQ_EXPR || code == NE_EXPR)
{
- tree op0 = TREE_OPERAND (cond, 0);
- tree op1 = TREE_OPERAND (cond, 1);
+ tree op0 = gimple_cond_lhs (stmt);
+ tree op1 = gimple_cond_rhs (stmt);
/* Special case comparing booleans against a constant as we
know the value of OP0 on both arms of the branch. i.e., we
@@ -118,7 +103,7 @@ associate_equivalences_with_edges (void)
&& TREE_CODE (TREE_TYPE (op0)) == BOOLEAN_TYPE
&& is_gimple_min_invariant (op1))
{
- if (TREE_CODE (cond) == EQ_EXPR)
+ if (code == EQ_EXPR)
{
equivalency = XNEW (struct edge_equivalency);
equivalency->lhs = op0;
@@ -170,7 +155,7 @@ associate_equivalences_with_edges (void)
equivalency = XNEW (struct edge_equivalency);
equivalency->lhs = op0;
equivalency->rhs = op1;
- if (TREE_CODE (cond) == EQ_EXPR)
+ if (code == EQ_EXPR)
true_edge->aux = equivalency;
else
false_edge->aux = equivalency;
@@ -184,15 +169,14 @@ associate_equivalences_with_edges (void)
/* For a SWITCH_EXPR, a case label which represents a single
value and which is the only case label which reaches the
target block creates an equivalence. */
- if (TREE_CODE (stmt) == SWITCH_EXPR)
+ else if (gimple_code (stmt) == GIMPLE_SWITCH)
{
- tree cond = SWITCH_COND (stmt);
+ tree cond = gimple_switch_index (stmt);
if (TREE_CODE (cond) == SSA_NAME
&& !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (cond))
{
- tree labels = SWITCH_LABELS (stmt);
- int i, n_labels = TREE_VEC_LENGTH (labels);
+ int i, n_labels = gimple_switch_num_labels (stmt);
tree *info = XCNEWVEC (tree, n_basic_blocks);
/* Walk over the case label vector. Record blocks
@@ -200,10 +184,9 @@ associate_equivalences_with_edges (void)
a single value. */
for (i = 0; i < n_labels; i++)
{
- tree label = TREE_VEC_ELT (labels, i);
+ tree label = gimple_switch_label (stmt, i);
basic_block bb = label_to_block (CASE_LABEL (label));
-
if (CASE_HIGH (label)
|| !CASE_LOW (label)
|| info[bb->index])
@@ -475,11 +458,12 @@ uncprop_into_successor_phis (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
destination of the edge. Then remove the temporary equivalence. */
FOR_EACH_EDGE (e, ei, bb->succs)
{
- tree phi = phi_nodes (e->dest);
+ gimple_seq phis = phi_nodes (e->dest);
+ gimple_stmt_iterator gsi;
/* If there are no PHI nodes in this destination, then there is
no sense in recording any equivalences. */
- if (!phi)
+ if (!phis)
continue;
/* Record any equivalency associated with E. */
@@ -490,9 +474,10 @@ uncprop_into_successor_phis (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
}
/* Walk over the PHI nodes, unpropagating values. */
- for ( ; phi; phi = PHI_CHAIN (phi))
+ for (gsi = gsi_start (phis) ; !gsi_end_p (gsi); gsi_next (&gsi))
{
/* Sigh. We'll have more efficient access to this one day. */
+ gimple phi = gsi_stmt (gsi);
tree arg = PHI_ARG_DEF (phi, e->dest_idx);
struct equiv_hash_elt equiv_hash_elt;
void **slot;
@@ -624,3 +609,4 @@ struct gimple_opt_pass pass_uncprop =
TODO_dump_func | TODO_verify_ssa /* todo_flags_finish */
}
};
+
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c
index 7f567b57a2e..74968bf5539 100644
--- a/gcc/tree-ssa.c
+++ b/gcc/tree-ssa.c
@@ -37,7 +37,7 @@ along with GCC; see the file COPYING3. If not see
#include "bitmap.h"
#include "pointer-set.h"
#include "tree-flow.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "tree-inline.h"
#include "varray.h"
#include "timevar.h"
@@ -171,19 +171,23 @@ redirect_edge_var_map_destroy (void)
edge
ssa_redirect_edge (edge e, basic_block dest)
{
- tree phi;
+ gimple_stmt_iterator gsi;
+ gimple phi;
redirect_edge_var_map_clear (e);
/* Remove the appropriate PHI arguments in E's destination block. */
- for (phi = phi_nodes (e->dest); phi; phi = PHI_CHAIN (phi))
+ for (gsi = gsi_start_phis (e->dest); !gsi_end_p (gsi); gsi_next (&gsi))
{
- tree def = PHI_ARG_DEF (phi, e->dest_idx);
+ tree def;
+
+ phi = gsi_stmt (gsi);
+ def = gimple_phi_arg_def (phi, e->dest_idx);
if (def == NULL_TREE)
continue;
- redirect_edge_var_map_add (e, PHI_RESULT (phi), def);
+ redirect_edge_var_map_add (e, gimple_phi_result (phi), def);
}
e = redirect_edge_succ_nodup (e, dest);
@@ -191,26 +195,31 @@ ssa_redirect_edge (edge e, basic_block dest)
return e;
}
+
/* Add PHI arguments queued in PENDING_STMT list on edge E to edge
E->dest. */
void
flush_pending_stmts (edge e)
{
- tree phi;
+ gimple phi;
edge_var_map_vector v;
edge_var_map *vm;
int i;
+ gimple_stmt_iterator gsi;
v = redirect_edge_var_map_vector (e);
if (!v)
return;
- for (phi = phi_nodes (e->dest), i = 0;
- phi && VEC_iterate (edge_var_map, v, i, vm);
- phi = PHI_CHAIN (phi), i++)
+ for (gsi = gsi_start_phis (e->dest), i = 0;
+ !gsi_end_p (gsi) && VEC_iterate (edge_var_map, v, i, vm);
+ gsi_next (&gsi), i++)
{
- tree def = redirect_edge_var_map_def (vm);
+ tree def;
+
+ phi = gsi_stmt (gsi);
+ def = redirect_edge_var_map_def (vm);
add_phi_arg (phi, def, e);
}
@@ -256,7 +265,7 @@ verify_ssa_name (tree ssa_name, bool is_virtual)
}
if (SSA_NAME_IS_DEFAULT_DEF (ssa_name)
- && !IS_EMPTY_STMT (SSA_NAME_DEF_STMT (ssa_name)))
+ && !gimple_nop_p (SSA_NAME_DEF_STMT (ssa_name)))
{
error ("found a default name with a non-empty defining statement");
return true;
@@ -279,7 +288,7 @@ verify_ssa_name (tree ssa_name, bool is_virtual)
static bool
verify_def (basic_block bb, basic_block *definition_block, tree ssa_name,
- tree stmt, bool is_virtual)
+ gimple stmt, bool is_virtual)
{
if (verify_ssa_name (ssa_name, is_virtual))
goto err;
@@ -297,9 +306,9 @@ verify_def (basic_block bb, basic_block *definition_block, tree ssa_name,
{
error ("SSA_NAME_DEF_STMT is wrong");
fprintf (stderr, "Expected definition statement:\n");
- print_generic_stmt (stderr, SSA_NAME_DEF_STMT (ssa_name), TDF_VOPS);
+ print_gimple_stmt (stderr, SSA_NAME_DEF_STMT (ssa_name), 4, TDF_VOPS);
fprintf (stderr, "\nActual definition statement:\n");
- print_generic_stmt (stderr, stmt, TDF_VOPS);
+ print_gimple_stmt (stderr, stmt, 4, TDF_VOPS);
goto err;
}
@@ -309,7 +318,7 @@ err:
fprintf (stderr, "while verifying SSA_NAME ");
print_generic_expr (stderr, ssa_name, 0);
fprintf (stderr, " in statement\n");
- print_generic_stmt (stderr, stmt, TDF_VOPS);
+ print_gimple_stmt (stderr, stmt, 4, TDF_VOPS);
return true;
}
@@ -331,7 +340,7 @@ err:
static bool
verify_use (basic_block bb, basic_block def_bb, use_operand_p use_p,
- tree stmt, bool check_abnormal, bitmap names_defined_in_bb)
+ gimple stmt, bool check_abnormal, bitmap names_defined_in_bb)
{
bool err = false;
tree ssa_name = USE_FROM_PTR (use_p);
@@ -342,7 +351,7 @@ verify_use (basic_block bb, basic_block def_bb, use_operand_p use_p,
TREE_VISITED (ssa_name) = 1;
- if (IS_EMPTY_STMT (SSA_NAME_DEF_STMT (ssa_name))
+ if (gimple_nop_p (SSA_NAME_DEF_STMT (ssa_name))
&& SSA_NAME_IS_DEFAULT_DEF (ssa_name))
; /* Default definitions have empty statements. Nothing to do. */
else if (!def_bb)
@@ -381,9 +390,9 @@ verify_use (basic_block bb, basic_block def_bb, use_operand_p use_p,
}
else
{
- tree listvar ;
+ tree listvar;
if (use_p->prev->use == NULL)
- listvar = use_p->prev->stmt;
+ listvar = use_p->prev->loc.ssa_name;
else
listvar = USE_FROM_PTR (use_p->prev);
if (listvar != ssa_name)
@@ -398,7 +407,7 @@ verify_use (basic_block bb, basic_block def_bb, use_operand_p use_p,
fprintf (stderr, "for SSA_NAME: ");
print_generic_expr (stderr, ssa_name, TDF_VOPS);
fprintf (stderr, " in statement:\n");
- print_generic_stmt (stderr, stmt, TDF_VOPS);
+ print_gimple_stmt (stderr, stmt, 0, TDF_VOPS);
}
return err;
@@ -414,11 +423,11 @@ verify_use (basic_block bb, basic_block def_bb, use_operand_p use_p,
definition of SSA_NAME. */
static bool
-verify_phi_args (tree phi, basic_block bb, basic_block *definition_block)
+verify_phi_args (gimple phi, basic_block bb, basic_block *definition_block)
{
edge e;
bool err = false;
- unsigned i, phi_num_args = PHI_NUM_ARGS (phi);
+ size_t i, phi_num_args = gimple_phi_num_args (phi);
if (EDGE_COUNT (bb->preds) != phi_num_args)
{
@@ -429,7 +438,7 @@ verify_phi_args (tree phi, basic_block bb, basic_block *definition_block)
for (i = 0; i < phi_num_args; i++)
{
- use_operand_p op_p = PHI_ARG_DEF_PTR (phi, i);
+ use_operand_p op_p = gimple_phi_arg_imm_use_ptr (phi, i);
tree op = USE_FROM_PTR (op_p);
e = EDGE_PRED (bb, i);
@@ -451,7 +460,7 @@ verify_phi_args (tree phi, basic_block bb, basic_block *definition_block)
if (TREE_CODE (op) == SSA_NAME)
{
- err = verify_ssa_name (op, !is_gimple_reg (PHI_RESULT (phi)));
+ err = verify_ssa_name (op, !is_gimple_reg (gimple_phi_result (phi)));
err |= verify_use (e->src, definition_block[SSA_NAME_VERSION (op)],
op_p, phi, e->flags & EDGE_ABNORMAL, NULL);
}
@@ -475,7 +484,7 @@ error:
if (err)
{
fprintf (stderr, "for PHI node\n");
- print_generic_stmt (stderr, phi, TDF_VOPS|TDF_MEMSYMS);
+ print_gimple_stmt (stderr, phi, 0, TDF_VOPS|TDF_MEMSYMS);
}
@@ -735,13 +744,13 @@ verify_ssa (bool check_modified_stmt)
tree name = ssa_name (i);
if (name)
{
- tree stmt;
+ gimple stmt;
TREE_VISITED (name) = 0;
stmt = SSA_NAME_DEF_STMT (name);
- if (!IS_EMPTY_STMT (stmt))
+ if (!gimple_nop_p (stmt))
{
- basic_block bb = bb_for_stmt (stmt);
+ basic_block bb = gimple_bb (stmt);
verify_def (bb, definition_block,
name, stmt, !is_gimple_reg (name));
@@ -756,9 +765,9 @@ verify_ssa (bool check_modified_stmt)
FOR_EACH_BB (bb)
{
edge e;
- tree phi;
+ gimple phi;
edge_iterator ei;
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
/* Make sure that all edges have a clear 'aux' field. */
FOR_EACH_EDGE (e, ei, bb->preds)
@@ -772,45 +781,46 @@ verify_ssa (bool check_modified_stmt)
}
/* Verify the arguments for every PHI node in the block. */
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
+ for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
+ phi = gsi_stmt (gsi);
if (verify_phi_args (phi, bb, definition_block))
goto err;
bitmap_set_bit (names_defined_in_bb,
- SSA_NAME_VERSION (PHI_RESULT (phi)));
+ SSA_NAME_VERSION (gimple_phi_result (phi)));
}
/* Now verify all the uses and vuses in every statement of the block. */
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- tree stmt = bsi_stmt (bsi);
+ gimple stmt = gsi_stmt (gsi);
use_operand_p use_p;
- if (check_modified_stmt && stmt_modified_p (stmt))
+ if (check_modified_stmt && gimple_modified_p (stmt))
{
error ("stmt (%p) marked modified after optimization pass: ",
(void *)stmt);
- print_generic_stmt (stderr, stmt, TDF_VOPS);
+ print_gimple_stmt (stderr, stmt, 0, TDF_VOPS);
goto err;
}
- if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
- && TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 0)) != SSA_NAME)
+ if (is_gimple_assign (stmt)
+ && TREE_CODE (gimple_assign_lhs (stmt)) != SSA_NAME)
{
tree lhs, base_address;
- lhs = GIMPLE_STMT_OPERAND (stmt, 0);
+ lhs = gimple_assign_lhs (stmt);
base_address = get_base_address (lhs);
if (base_address
&& gimple_aliases_computed_p (cfun)
&& SSA_VAR_P (base_address)
- && !stmt_ann (stmt)->has_volatile_ops
+ && !gimple_has_volatile_ops (stmt)
&& ZERO_SSA_OPERANDS (stmt, SSA_OP_VDEF))
{
error ("statement makes a memory store, but has no VDEFS");
- print_generic_stmt (stderr, stmt, TDF_VOPS);
+ print_gimple_stmt (stderr, stmt, 0, TDF_VOPS);
goto err;
}
}
@@ -820,7 +830,7 @@ verify_ssa (bool check_modified_stmt)
if (verify_ssa_name (op, true))
{
error ("in statement");
- print_generic_stmt (stderr, stmt, TDF_VOPS|TDF_MEMSYMS);
+ print_gimple_stmt (stderr, stmt, 0, TDF_VOPS|TDF_MEMSYMS);
goto err;
}
}
@@ -830,7 +840,7 @@ verify_ssa (bool check_modified_stmt)
if (verify_ssa_name (op, false))
{
error ("in statement");
- print_generic_stmt (stderr, stmt, TDF_VOPS|TDF_MEMSYMS);
+ print_gimple_stmt (stderr, stmt, 0, TDF_VOPS|TDF_MEMSYMS);
goto err;
}
}
@@ -951,7 +961,7 @@ delete_tree_ssa (void)
{
size_t i;
basic_block bb;
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
referenced_var_iterator rvi;
tree var;
@@ -967,17 +977,32 @@ delete_tree_ssa (void)
release_ssa_name (var);
}
- /* Remove annotations from every tree in the function. */
+ /* FIXME. This may not be necessary. We will release all this
+ memory en masse in free_ssa_operands. This clearing used to be
+ necessary to avoid problems with the inliner, but it may not be
+ needed anymore. */
FOR_EACH_BB (bb)
{
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- tree stmt = bsi_stmt (bsi);
- stmt_ann_t ann = get_stmt_ann (stmt);
+ gimple stmt = gsi_stmt (gsi);
+
+ if (gimple_has_ops (stmt))
+ {
+ gimple_set_def_ops (stmt, NULL);
+ gimple_set_use_ops (stmt, NULL);
+ gimple_set_addresses_taken (stmt, NULL);
+ }
- free_ssa_operands (&ann->operands);
- ann->addresses_taken = 0;
- mark_stmt_modified (stmt);
+ if (gimple_has_mem_ops (stmt))
+ {
+ gimple_set_vdef_ops (stmt, NULL);
+ gimple_set_vuse_ops (stmt, NULL);
+ BITMAP_FREE (stmt->gsmem.membase.stores);
+ BITMAP_FREE (stmt->gsmem.membase.loads);
+ }
+
+ gimple_set_modified (stmt, true);
}
set_phi_nodes (bb, NULL);
}
@@ -1001,7 +1026,8 @@ delete_tree_ssa (void)
fini_ssanames ();
fini_phinodes ();
- /* we no longer maintain the SSA operand cache at this point. */
+
+ /* We no longer maintain the SSA operand cache at this point. */
if (ssa_operands_active ())
fini_ssa_operands ();
@@ -1139,12 +1165,18 @@ useless_type_conversion_p_1 (tree outer_type, tree inner_type)
if (TREE_CODE (inner_type) != TREE_CODE (outer_type))
return false;
- /* ??? Add structural equivalence check. */
+ /* ??? This seems to be necessary even for aggregates that don't
+ have TYPE_STRUCTURAL_EQUALITY_P set. */
/* ??? This should eventually just return false. */
return lang_hooks.types_compatible_p (inner_type, outer_type);
}
-
+ /* Also for functions and possibly other types with
+ TYPE_STRUCTURAL_EQUALITY_P set. */
+ else if (TYPE_STRUCTURAL_EQUALITY_P (inner_type)
+ && TYPE_STRUCTURAL_EQUALITY_P (outer_type))
+ return lang_hooks.types_compatible_p (inner_type, outer_type);
+
return false;
}
@@ -1209,12 +1241,9 @@ tree_ssa_useless_type_conversion (tree expr)
if (CONVERT_EXPR_P (expr)
|| TREE_CODE (expr) == VIEW_CONVERT_EXPR
|| TREE_CODE (expr) == NON_LVALUE_EXPR)
- /* FIXME: Use of GENERIC_TREE_TYPE here is a temporary measure to work
- around known bugs with GIMPLE_MODIFY_STMTs appearing in places
- they shouldn't. See PR 30391. */
return useless_type_conversion_p
(TREE_TYPE (expr),
- GENERIC_TREE_TYPE (TREE_OPERAND (expr, 0)));
+ TREE_TYPE (TREE_OPERAND (expr, 0)));
return false;
}
@@ -1238,33 +1267,33 @@ static bool
walk_use_def_chains_1 (tree var, walk_use_def_chains_fn fn, void *data,
struct pointer_set_t *visited, bool is_dfs)
{
- tree def_stmt;
+ gimple def_stmt;
if (pointer_set_insert (visited, var))
return false;
def_stmt = SSA_NAME_DEF_STMT (var);
- if (TREE_CODE (def_stmt) != PHI_NODE)
+ if (gimple_code (def_stmt) != GIMPLE_PHI)
{
/* If we reached the end of the use-def chain, call FN. */
return fn (var, def_stmt, data);
}
else
{
- int i;
+ size_t i;
/* When doing a breadth-first search, call FN before following the
use-def links for each argument. */
if (!is_dfs)
- for (i = 0; i < PHI_NUM_ARGS (def_stmt); i++)
- if (fn (PHI_ARG_DEF (def_stmt, i), def_stmt, data))
+ for (i = 0; i < gimple_phi_num_args (def_stmt); i++)
+ if (fn (gimple_phi_arg_def (def_stmt, i), def_stmt, data))
return true;
/* Follow use-def links out of each PHI argument. */
- for (i = 0; i < PHI_NUM_ARGS (def_stmt); i++)
+ for (i = 0; i < gimple_phi_num_args (def_stmt); i++)
{
- tree arg = PHI_ARG_DEF (def_stmt, i);
+ tree arg = gimple_phi_arg_def (def_stmt, i);
/* ARG may be NULL for newly introduced PHI nodes. */
if (arg
@@ -1276,8 +1305,8 @@ walk_use_def_chains_1 (tree var, walk_use_def_chains_fn fn, void *data,
/* When doing a depth-first search, call FN after following the
use-def links for each argument. */
if (is_dfs)
- for (i = 0; i < PHI_NUM_ARGS (def_stmt); i++)
- if (fn (PHI_ARG_DEF (def_stmt, i), def_stmt, data))
+ for (i = 0; i < gimple_phi_num_args (def_stmt); i++)
+ if (fn (gimple_phi_arg_def (def_stmt, i), def_stmt, data))
return true;
}
@@ -1310,7 +1339,7 @@ void
walk_use_def_chains (tree var, walk_use_def_chains_fn fn, void *data,
bool is_dfs)
{
- tree def_stmt;
+ gimple def_stmt;
gcc_assert (TREE_CODE (var) == SSA_NAME);
@@ -1318,7 +1347,7 @@ walk_use_def_chains (tree var, walk_use_def_chains_fn fn, void *data,
/* We only need to recurse if the reaching definition comes from a PHI
node. */
- if (TREE_CODE (def_stmt) != PHI_NODE)
+ if (gimple_code (def_stmt) != GIMPLE_PHI)
(*fn) (var, def_stmt, data);
else
{
@@ -1345,7 +1374,7 @@ ssa_undefined_value_p (tree t)
return false;
/* The value is undefined iff its definition statement is empty. */
- return IS_EMPTY_STMT (SSA_NAME_DEF_STMT (t));
+ return gimple_nop_p (SSA_NAME_DEF_STMT (t));
}
/* Emit warnings for uninitialized variables. This is done in two passes.
@@ -1370,8 +1399,8 @@ static void
warn_uninit (tree t, const char *gmsgid, void *data)
{
tree var = SSA_NAME_VAR (t);
- tree context = (tree) data;
- location_t *locus;
+ gimple context = (gimple) data;
+ location_t location;
expanded_location xloc, floc;
if (!ssa_undefined_value_p (t))
@@ -1382,23 +1411,26 @@ warn_uninit (tree t, const char *gmsgid, void *data)
if (TREE_NO_WARNING (var))
return;
- locus = (context != NULL && EXPR_HAS_LOCATION (context)
- ? EXPR_LOCUS (context)
- : &DECL_SOURCE_LOCATION (var));
- warning (OPT_Wuninitialized, gmsgid, locus, var);
- xloc = expand_location (*locus);
+ location = (context != NULL && gimple_has_location (context))
+ ? gimple_location (context)
+ : DECL_SOURCE_LOCATION (var);
+ xloc = expand_location (location);
floc = expand_location (DECL_SOURCE_LOCATION (cfun->decl));
- if (xloc.file != floc.file
- || xloc.line < floc.line
- || xloc.line > LOCATION_LINE (cfun->function_end_locus))
- inform ("%J%qD was declared here", var, var);
+ if (warning_at (location, OPT_Wuninitialized, gmsgid, var))
+ {
+ TREE_NO_WARNING (var) = 1;
- TREE_NO_WARNING (var) = 1;
+ if (xloc.file != floc.file
+ || xloc.line < floc.line
+ || xloc.line > LOCATION_LINE (cfun->function_end_locus))
+ inform ("%J%qD was declared here", var, var);
+ }
}
struct walk_data {
- tree stmt;
+ gimple stmt;
bool always_executed;
+ bool warn_possibly_uninitialized;
};
/* Called via walk_tree, look for SSA_NAMEs that have empty definitions
@@ -1407,7 +1439,8 @@ struct walk_data {
static tree
warn_uninitialized_var (tree *tp, int *walk_subtrees, void *data_)
{
- struct walk_data *data = (struct walk_data *)data_;
+ struct walk_stmt_info *wi = (struct walk_stmt_info *) data_;
+ struct walk_data *data = (struct walk_data *) wi->info;
tree t = *tp;
switch (TREE_CODE (t))
@@ -1416,10 +1449,10 @@ warn_uninitialized_var (tree *tp, int *walk_subtrees, void *data_)
/* We only do data flow with SSA_NAMEs, so that's all we
can warn about. */
if (data->always_executed)
- warn_uninit (t, "%H%qD is used uninitialized in this function",
+ warn_uninit (t, "%qD is used uninitialized in this function",
data->stmt);
- else
- warn_uninit (t, "%H%qD may be used uninitialized in this function",
+ else if (data->warn_possibly_uninitialized)
+ warn_uninit (t, "%qD may be used uninitialized in this function",
data->stmt);
*walk_subtrees = 0;
break;
@@ -1446,60 +1479,78 @@ warn_uninitialized_var (tree *tp, int *walk_subtrees, void *data_)
and warn about them. */
static void
-warn_uninitialized_phi (tree phi)
+warn_uninitialized_phi (gimple phi)
{
- int i, n = PHI_NUM_ARGS (phi);
+ size_t i, n = gimple_phi_num_args (phi);
/* Don't look at memory tags. */
- if (!is_gimple_reg (PHI_RESULT (phi)))
+ if (!is_gimple_reg (gimple_phi_result (phi)))
return;
for (i = 0; i < n; ++i)
{
- tree op = PHI_ARG_DEF (phi, i);
+ tree op = gimple_phi_arg_def (phi, i);
if (TREE_CODE (op) == SSA_NAME)
- warn_uninit (op, "%H%qD may be used uninitialized in this function",
+ warn_uninit (op, "%qD may be used uninitialized in this function",
NULL);
}
}
static unsigned int
-execute_early_warn_uninitialized (void)
+warn_uninitialized_vars (bool warn_possibly_uninitialized)
{
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
basic_block bb;
struct walk_data data;
+ data.warn_possibly_uninitialized = warn_possibly_uninitialized;
+
calculate_dominance_info (CDI_POST_DOMINATORS);
FOR_EACH_BB (bb)
{
data.always_executed = dominated_by_p (CDI_POST_DOMINATORS,
single_succ (ENTRY_BLOCK_PTR), bb);
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
- {
- data.stmt = bsi_stmt (bsi);
- walk_tree (bsi_stmt_ptr (bsi), warn_uninitialized_var,
- &data, NULL);
- }
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ {
+ struct walk_stmt_info wi;
+ data.stmt = gsi_stmt (gsi);
+ memset (&wi, 0, sizeof (wi));
+ wi.info = &data;
+ walk_gimple_op (gsi_stmt (gsi), warn_uninitialized_var, &wi);
+ }
}
return 0;
}
static unsigned int
+execute_early_warn_uninitialized (void)
+{
+ /* Currently, this pass runs always but
+ execute_late_warn_uninitialized only runs with optimization. With
+ optimization we want to warn about possible uninitialized as late
+ as possible, thus don't do it here. However, without
+ optimization we need to warn here about "may be uninitialized".
+ */
+ warn_uninitialized_vars (/*warn_possibly_uninitialized=*/!optimize);
+ return 0;
+}
+
+static unsigned int
execute_late_warn_uninitialized (void)
{
basic_block bb;
- tree phi;
+ gimple_stmt_iterator gsi;
/* Re-do the plain uninitialized variable check, as optimization may have
straightened control flow. Do this first so that we don't accidentally
get a "may be" warning when we'd have seen an "is" warning later. */
- execute_early_warn_uninitialized ();
+ warn_uninitialized_vars (/*warn_possibly_uninitialized=*/1);
FOR_EACH_BB (bb)
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
- warn_uninitialized_phi (phi);
+ for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ warn_uninitialized_phi (gsi_stmt (gsi));
+
return 0;
}
@@ -1554,32 +1605,33 @@ execute_update_addresses_taken (void)
{
tree var;
referenced_var_iterator rvi;
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
basic_block bb;
bitmap addresses_taken = BITMAP_ALLOC (NULL);
bitmap vars_updated = BITMAP_ALLOC (NULL);
bool update_vops = false;
- tree phi;
/* Collect into ADDRESSES_TAKEN all variables whose address is taken within
the function body. */
FOR_EACH_BB (bb)
{
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- stmt_ann_t s_ann = stmt_ann (bsi_stmt (bsi));
-
- if (s_ann->addresses_taken)
- bitmap_ior_into (addresses_taken, s_ann->addresses_taken);
+ bitmap taken = gimple_addresses_taken (gsi_stmt (gsi));
+ if (taken)
+ bitmap_ior_into (addresses_taken, taken);
}
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
+
+ for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- unsigned i, phi_num_args = PHI_NUM_ARGS (phi);
- for (i = 0; i < phi_num_args; i++)
+ size_t i;
+ gimple phi = gsi_stmt (gsi);
+
+ for (i = 0; i < gimple_phi_num_args (phi); i++)
{
tree op = PHI_ARG_DEF (phi, i), var;
if (TREE_CODE (op) == ADDR_EXPR
- && (var = get_base_address (TREE_OPERAND (op, 0))) != NULL_TREE
+ && (var = get_base_address (TREE_OPERAND (op, 0))) != NULL
&& DECL_P (var))
bitmap_set_bit (addresses_taken, DECL_UID (var));
}
@@ -1611,14 +1663,14 @@ execute_update_addresses_taken (void)
variables. */
if (update_vops)
FOR_EACH_BB (bb)
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- tree stmt = bsi_stmt (bsi);
+ gimple stmt = gsi_stmt (gsi);
- if ((LOADED_SYMS (stmt)
- && bitmap_intersect_p (LOADED_SYMS (stmt), vars_updated))
- || (STORED_SYMS (stmt)
- && bitmap_intersect_p (STORED_SYMS (stmt), vars_updated)))
+ if ((gimple_loaded_syms (stmt)
+ && bitmap_intersect_p (gimple_loaded_syms (stmt), vars_updated))
+ || (gimple_stored_syms (stmt)
+ && bitmap_intersect_p (gimple_stored_syms (stmt), vars_updated)))
update_stmt (stmt);
}
BITMAP_FREE (addresses_taken);
diff --git a/gcc/tree-ssanames.c b/gcc/tree-ssanames.c
index 8d675b43c49..f3101d28271 100644
--- a/gcc/tree-ssanames.c
+++ b/gcc/tree-ssanames.c
@@ -115,17 +115,12 @@ ssanames_print_statistics (void)
used without a preceding definition). */
tree
-make_ssa_name_fn (struct function *fn, tree var, tree stmt)
+make_ssa_name_fn (struct function *fn, tree var, gimple stmt)
{
tree t;
use_operand_p imm;
- gcc_assert (DECL_P (var)
- || TREE_CODE (var) == INDIRECT_REF);
-
- gcc_assert (!stmt
- || EXPR_P (stmt) || GIMPLE_STMT_P (stmt)
- || TREE_CODE (stmt) == PHI_NODE);
+ gcc_assert (DECL_P (var));
/* If our free list has an element, then use it. */
if (FREE_SSANAMES (fn))
@@ -161,7 +156,7 @@ make_ssa_name_fn (struct function *fn, tree var, tree stmt)
imm->use = NULL;
imm->prev = imm;
imm->next = imm;
- imm->stmt = t;
+ imm->loc.ssa_name = t;
return t;
}
@@ -219,7 +214,8 @@ release_ssa_name (tree var)
imm->prev = imm;
imm->next = imm;
- imm->stmt = var;
+ imm->loc.ssa_name = var;
+
/* First put back the right tree node so that the tree checking
macros do not complain. */
TREE_SET_CODE (var, SSA_NAME);
@@ -243,7 +239,7 @@ release_ssa_name (tree var)
/* Creates a duplicate of a ssa name NAME defined in statement STMT. */
tree
-duplicate_ssa_name (tree name, tree stmt)
+duplicate_ssa_name (tree name, gimple stmt)
{
tree new_name = make_ssa_name (SSA_NAME_VAR (name), stmt);
struct ptr_info_def *old_ptr_info = SSA_NAME_PTR_INFO (name);
@@ -285,7 +281,7 @@ duplicate_ssa_name_ptr_info (tree name, struct ptr_info_def *ptr_info)
/* Release all the SSA_NAMEs created by STMT. */
void
-release_defs (tree stmt)
+release_defs (gimple stmt)
{
tree def;
ssa_op_iter iter;
diff --git a/gcc/tree-stdarg.c b/gcc/tree-stdarg.c
index f9228872dc2..96a72fad08e 100644
--- a/gcc/tree-stdarg.c
+++ b/gcc/tree-stdarg.c
@@ -112,7 +112,8 @@ static unsigned HOST_WIDE_INT
va_list_counter_bump (struct stdarg_info *si, tree counter, tree rhs,
bool gpr_p)
{
- tree stmt, lhs, orig_lhs;
+ tree lhs, orig_lhs;
+ gimple stmt;
unsigned HOST_WIDE_INT ret = 0, val, counter_val;
unsigned int max_size;
@@ -130,6 +131,8 @@ va_list_counter_bump (struct stdarg_info *si, tree counter, tree rhs,
orig_lhs = lhs = rhs;
while (lhs)
{
+ enum tree_code rhs_code;
+
if (si->offsets[SSA_NAME_VERSION (lhs)] != -1)
{
if (counter_val >= max_size)
@@ -144,38 +147,32 @@ va_list_counter_bump (struct stdarg_info *si, tree counter, tree rhs,
stmt = SSA_NAME_DEF_STMT (lhs);
- if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT
- || GIMPLE_STMT_OPERAND (stmt, 0) != lhs)
+ if (!is_gimple_assign (stmt) || gimple_assign_lhs (stmt) != lhs)
return (unsigned HOST_WIDE_INT) -1;
- rhs = GIMPLE_STMT_OPERAND (stmt, 1);
- if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
- rhs = TREE_OPERAND (rhs, 0);
-
- if (TREE_CODE (rhs) == SSA_NAME)
+ rhs_code = gimple_assign_rhs_code (stmt);
+ if ((get_gimple_rhs_class (rhs_code) == GIMPLE_SINGLE_RHS
+ || gimple_assign_cast_p (stmt))
+ && TREE_CODE (gimple_assign_rhs1 (stmt)) == SSA_NAME)
{
- lhs = rhs;
+ lhs = gimple_assign_rhs1 (stmt);
continue;
}
- if (CONVERT_EXPR_P (rhs)
- && TREE_CODE (TREE_OPERAND (rhs, 0)) == SSA_NAME)
+ if ((rhs_code == POINTER_PLUS_EXPR
+ || rhs_code == PLUS_EXPR)
+ && TREE_CODE (gimple_assign_rhs1 (stmt)) == SSA_NAME
+ && host_integerp (gimple_assign_rhs2 (stmt), 1))
{
- lhs = TREE_OPERAND (rhs, 0);
+ ret += tree_low_cst (gimple_assign_rhs2 (stmt), 1);
+ lhs = gimple_assign_rhs1 (stmt);
continue;
}
- if ((TREE_CODE (rhs) == POINTER_PLUS_EXPR
- || TREE_CODE (rhs) == PLUS_EXPR)
- && TREE_CODE (TREE_OPERAND (rhs, 0)) == SSA_NAME
- && TREE_CODE (TREE_OPERAND (rhs, 1)) == INTEGER_CST
- && host_integerp (TREE_OPERAND (rhs, 1), 1))
- {
- ret += tree_low_cst (TREE_OPERAND (rhs, 1), 1);
- lhs = TREE_OPERAND (rhs, 0);
- continue;
- }
+ if (get_gimple_rhs_class (rhs_code) != GIMPLE_SINGLE_RHS)
+ return (unsigned HOST_WIDE_INT) -1;
+ rhs = gimple_assign_rhs1 (stmt);
if (TREE_CODE (counter) != TREE_CODE (rhs))
return (unsigned HOST_WIDE_INT) -1;
@@ -196,6 +193,8 @@ va_list_counter_bump (struct stdarg_info *si, tree counter, tree rhs,
val = ret + counter_val;
while (lhs)
{
+ enum tree_code rhs_code;
+
if (si->offsets[SSA_NAME_VERSION (lhs)] != -1)
break;
@@ -206,31 +205,22 @@ va_list_counter_bump (struct stdarg_info *si, tree counter, tree rhs,
stmt = SSA_NAME_DEF_STMT (lhs);
- rhs = GIMPLE_STMT_OPERAND (stmt, 1);
- if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
- rhs = TREE_OPERAND (rhs, 0);
-
- if (TREE_CODE (rhs) == SSA_NAME)
+ rhs_code = gimple_assign_rhs_code (stmt);
+ if ((get_gimple_rhs_class (rhs_code) == GIMPLE_SINGLE_RHS
+ || gimple_assign_cast_p (stmt))
+ && TREE_CODE (gimple_assign_rhs1 (stmt)) == SSA_NAME)
{
- lhs = rhs;
+ lhs = gimple_assign_rhs1 (stmt);
continue;
}
- if (CONVERT_EXPR_P (rhs)
- && TREE_CODE (TREE_OPERAND (rhs, 0)) == SSA_NAME)
+ if ((rhs_code == POINTER_PLUS_EXPR
+ || rhs_code == PLUS_EXPR)
+ && TREE_CODE (gimple_assign_rhs1 (stmt)) == SSA_NAME
+ && host_integerp (gimple_assign_rhs2 (stmt), 1))
{
- lhs = TREE_OPERAND (rhs, 0);
- continue;
- }
-
- if ((TREE_CODE (rhs) == POINTER_PLUS_EXPR
- || TREE_CODE (rhs) == PLUS_EXPR)
- && TREE_CODE (TREE_OPERAND (rhs, 0)) == SSA_NAME
- && TREE_CODE (TREE_OPERAND (rhs, 1)) == INTEGER_CST
- && host_integerp (TREE_OPERAND (rhs, 1), 1))
- {
- val -= tree_low_cst (TREE_OPERAND (rhs, 1), 1);
- lhs = TREE_OPERAND (rhs, 0);
+ val -= tree_low_cst (gimple_assign_rhs2 (stmt), 1);
+ lhs = gimple_assign_rhs1 (stmt);
continue;
}
@@ -247,7 +237,7 @@ static tree
find_va_list_reference (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED,
void *data)
{
- bitmap va_list_vars = (bitmap) data;
+ bitmap va_list_vars = (bitmap) ((struct walk_stmt_info *) data)->info;
tree var = *tp;
if (TREE_CODE (var) == SSA_NAME)
@@ -442,12 +432,6 @@ check_va_list_escapes (struct stdarg_info *si, tree lhs, tree rhs)
if (! POINTER_TYPE_P (TREE_TYPE (rhs)))
return;
- if (((TREE_CODE (rhs) == POINTER_PLUS_EXPR
- || TREE_CODE (rhs) == PLUS_EXPR)
- && TREE_CODE (TREE_OPERAND (rhs, 1)) == INTEGER_CST)
- || CONVERT_EXPR_P (rhs))
- rhs = TREE_OPERAND (rhs, 0);
-
if (TREE_CODE (rhs) != SSA_NAME
|| ! bitmap_bit_p (si->va_list_escape_vars,
DECL_UID (SSA_NAME_VAR (rhs))))
@@ -504,11 +488,12 @@ check_all_va_list_escapes (struct stdarg_info *si)
FOR_EACH_BB (bb)
{
- block_stmt_iterator i;
+ gimple_stmt_iterator i;
- for (i = bsi_start (bb); !bsi_end_p (i); bsi_next (&i))
+ for (i = gsi_start_bb (bb); !gsi_end_p (i); gsi_next (&i))
{
- tree stmt = bsi_stmt (i), use;
+ gimple stmt = gsi_stmt (i);
+ tree use;
ssa_op_iter iter;
FOR_EACH_SSA_TREE_OPERAND (use, stmt, iter, SSA_OP_ALL_USES)
@@ -517,16 +502,13 @@ check_all_va_list_escapes (struct stdarg_info *si)
DECL_UID (SSA_NAME_VAR (use))))
continue;
- if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT)
+ if (is_gimple_assign (stmt))
{
- tree lhs = GIMPLE_STMT_OPERAND (stmt, 0);
- tree rhs = GIMPLE_STMT_OPERAND (stmt, 1);
-
- if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
- rhs = TREE_OPERAND (rhs, 0);
+ tree rhs = gimple_assign_rhs1 (stmt);
+ enum tree_code rhs_code = gimple_assign_rhs_code (stmt);
/* x = *ap_temp; */
- if (TREE_CODE (rhs) == INDIRECT_REF
+ if (gimple_assign_rhs_code (stmt) == INDIRECT_REF
&& TREE_OPERAND (rhs, 0) == use
&& TYPE_SIZE_UNIT (TREE_TYPE (rhs))
&& host_integerp (TYPE_SIZE_UNIT (TREE_TYPE (rhs)), 1)
@@ -550,13 +532,16 @@ check_all_va_list_escapes (struct stdarg_info *si)
other_ap_temp = (some_type *) ap_temp;
ap = ap_temp;
statements. */
- if ((TREE_CODE (rhs) == POINTER_PLUS_EXPR
- && TREE_CODE (TREE_OPERAND (rhs, 1)) == INTEGER_CST)
- || CONVERT_EXPR_P (rhs))
- rhs = TREE_OPERAND (rhs, 0);
-
- if (rhs == use)
+ if (rhs == use
+ && ((rhs_code == POINTER_PLUS_EXPR
+ && (TREE_CODE (gimple_assign_rhs2 (stmt))
+ == INTEGER_CST))
+ || gimple_assign_cast_p (stmt)
+ || (get_gimple_rhs_class (rhs_code)
+ == GIMPLE_SINGLE_RHS)))
{
+ tree lhs = gimple_assign_lhs (stmt);
+
if (TREE_CODE (lhs) == SSA_NAME
&& bitmap_bit_p (si->va_list_escape_vars,
DECL_UID (SSA_NAME_VAR (lhs))))
@@ -572,7 +557,7 @@ check_all_va_list_escapes (struct stdarg_info *si)
if (dump_file && (dump_flags & TDF_DETAILS))
{
fputs ("va_list escapes in ", dump_file);
- print_generic_expr (dump_file, stmt, dump_flags);
+ print_gimple_stmt (dump_file, stmt, 0, dump_flags);
fputc ('\n', dump_file);
}
return true;
@@ -604,6 +589,7 @@ execute_optimize_stdarg (void)
bool va_list_escapes = false;
bool va_list_simple_ptr;
struct stdarg_info si;
+ struct walk_stmt_info wi;
const char *funcname = NULL;
tree cfun_va_list;
@@ -624,18 +610,17 @@ execute_optimize_stdarg (void)
FOR_EACH_BB (bb)
{
- block_stmt_iterator i;
+ gimple_stmt_iterator i;
- for (i = bsi_start (bb); !bsi_end_p (i); bsi_next (&i))
+ for (i = gsi_start_bb (bb); !gsi_end_p (i); gsi_next (&i))
{
- tree stmt = bsi_stmt (i);
- tree call = get_call_expr_in (stmt), callee;
- tree ap;
+ gimple stmt = gsi_stmt (i);
+ tree callee, ap;
- if (!call)
+ if (!is_gimple_call (stmt))
continue;
- callee = get_callee_fndecl (call);
+ callee = gimple_call_fndecl (stmt);
if (!callee
|| DECL_BUILT_IN_CLASS (callee) != BUILT_IN_NORMAL)
continue;
@@ -655,7 +640,7 @@ execute_optimize_stdarg (void)
}
si.va_start_count++;
- ap = CALL_EXPR_ARG (call, 0);
+ ap = gimple_call_arg (stmt, 0);
if (TREE_CODE (ap) != ADDR_EXPR)
{
@@ -731,10 +716,12 @@ execute_optimize_stdarg (void)
cfun->va_list_fpr_size = VA_LIST_MAX_FPR_SIZE;
calculate_dominance_info (CDI_DOMINATORS);
+ memset (&wi, 0, sizeof (wi));
+ wi.info = si.va_list_vars;
FOR_EACH_BB (bb)
{
- block_stmt_iterator i;
+ gimple_stmt_iterator i;
si.compute_sizes = -1;
si.bb = bb;
@@ -745,12 +732,13 @@ execute_optimize_stdarg (void)
any real data movement. */
if (va_list_simple_ptr)
{
- tree phi, lhs, rhs;
+ tree lhs, rhs;
use_operand_p uop;
ssa_op_iter soi;
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
+ for (i = gsi_start_phis (bb); !gsi_end_p (i); gsi_next (&i))
{
+ gimple phi = gsi_stmt (i);
lhs = PHI_RESULT (phi);
if (!is_gimple_reg (lhs))
@@ -766,14 +754,12 @@ execute_optimize_stdarg (void)
else
check_va_list_escapes (&si, lhs, rhs);
- if (si.va_list_escapes
- || walk_tree (&phi, find_va_list_reference,
- si.va_list_vars, NULL))
+ if (si.va_list_escapes)
{
if (dump_file && (dump_flags & TDF_DETAILS))
{
fputs ("va_list escapes in ", dump_file);
- print_generic_expr (dump_file, phi, dump_flags);
+ print_gimple_stmt (dump_file, phi, 0, dump_flags);
fputc ('\n', dump_file);
}
va_list_escapes = true;
@@ -782,18 +768,16 @@ execute_optimize_stdarg (void)
}
}
- for (i = bsi_start (bb);
- !bsi_end_p (i) && !va_list_escapes;
- bsi_next (&i))
+ for (i = gsi_start_bb (bb);
+ !gsi_end_p (i) && !va_list_escapes;
+ gsi_next (&i))
{
- tree stmt = bsi_stmt (i);
- tree call;
+ gimple stmt = gsi_stmt (i);
/* Don't look at __builtin_va_{start,end}, they are ok. */
- call = get_call_expr_in (stmt);
- if (call)
+ if (is_gimple_call (stmt))
{
- tree callee = get_callee_fndecl (call);
+ tree callee = gimple_call_fndecl (stmt);
if (callee
&& DECL_BUILT_IN_CLASS (callee) == BUILT_IN_NORMAL
@@ -802,44 +786,54 @@ execute_optimize_stdarg (void)
continue;
}
- if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT)
+ if (is_gimple_assign (stmt))
{
- tree lhs = GIMPLE_STMT_OPERAND (stmt, 0);
- tree rhs = GIMPLE_STMT_OPERAND (stmt, 1);
-
- if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
- rhs = TREE_OPERAND (rhs, 0);
+ tree lhs = gimple_assign_lhs (stmt);
+ tree rhs = gimple_assign_rhs1 (stmt);
if (va_list_simple_ptr)
{
- /* Check for tem = ap. */
- if (va_list_ptr_read (&si, rhs, lhs))
- continue;
+ if (get_gimple_rhs_class (gimple_assign_rhs_code (stmt))
+ == GIMPLE_SINGLE_RHS)
+ {
+ /* Check for tem = ap. */
+ if (va_list_ptr_read (&si, rhs, lhs))
+ continue;
- /* Check for the last insn in:
- tem1 = ap;
- tem2 = tem1 + CST;
- ap = tem2;
- sequence. */
- else if (va_list_ptr_write (&si, lhs, rhs))
- continue;
+ /* Check for the last insn in:
+ tem1 = ap;
+ tem2 = tem1 + CST;
+ ap = tem2;
+ sequence. */
+ else if (va_list_ptr_write (&si, lhs, rhs))
+ continue;
+ }
- else
+ if ((gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR
+ && TREE_CODE (gimple_assign_rhs2 (stmt)) == INTEGER_CST)
+ || IS_CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (stmt))
+ || (get_gimple_rhs_class (gimple_assign_rhs_code (stmt))
+ == GIMPLE_SINGLE_RHS))
check_va_list_escapes (&si, lhs, rhs);
}
else
{
- /* Check for ap[0].field = temp. */
- if (va_list_counter_struct_op (&si, lhs, rhs, true))
- continue;
+ if (get_gimple_rhs_class (gimple_assign_rhs_code (stmt))
+ == GIMPLE_SINGLE_RHS)
+ {
+ /* Check for ap[0].field = temp. */
+ if (va_list_counter_struct_op (&si, lhs, rhs, true))
+ continue;
- /* Check for temp = ap[0].field. */
- else if (va_list_counter_struct_op (&si, rhs, lhs, false))
- continue;
+ /* Check for temp = ap[0].field. */
+ else if (va_list_counter_struct_op (&si, rhs, lhs,
+ false))
+ continue;
+ }
/* Do any architecture specific checking. */
- else if (targetm.stdarg_optimize_hook
- && targetm.stdarg_optimize_hook (&si, lhs, rhs))
+ if (targetm.stdarg_optimize_hook
+ && targetm.stdarg_optimize_hook (&si, stmt))
continue;
}
}
@@ -851,13 +845,12 @@ execute_optimize_stdarg (void)
fully), or some unexpected use of va_list. None of these should
happen in a gimplified VA_ARG_EXPR. */
if (si.va_list_escapes
- || walk_tree (&stmt, find_va_list_reference,
- si.va_list_vars, NULL))
+ || walk_gimple_op (stmt, find_va_list_reference, &wi))
{
if (dump_file && (dump_flags & TDF_DETAILS))
{
fputs ("va_list escapes in ", dump_file);
- print_generic_expr (dump_file, stmt, dump_flags);
+ print_gimple_stmt (dump_file, stmt, 0, dump_flags);
fputc ('\n', dump_file);
}
va_list_escapes = true;
diff --git a/gcc/tree-switch-conversion.c b/gcc/tree-switch-conversion.c
index 36c87f9bd51..8bcfcfde5ca 100644
--- a/gcc/tree-switch-conversion.c
+++ b/gcc/tree-switch-conversion.c
@@ -147,10 +147,10 @@ struct switch_conv_info
/* The first load statement that loads a temporary from a new static array.
*/
- tree arr_ref_first;
+ gimple arr_ref_first;
/* The last load statement that loads a temporary from a new static array. */
- tree arr_ref_last;
+ gimple arr_ref_last;
/* String reason why the case wasn't a good candidate that is written to the
dump file, if there is one. */
@@ -166,22 +166,21 @@ static struct switch_conv_info info;
satisfies the size of the new array. */
static bool
-check_range (tree swtch)
+check_range (gimple swtch)
{
tree min_case, max_case;
- tree cases = SWITCH_LABELS (swtch);
- unsigned int branch_num = TREE_VEC_LENGTH (cases);
+ unsigned int branch_num = gimple_switch_num_labels (swtch);
tree range_max;
/* The gimplifier has already sorted the cases by CASE_LOW and ensured there
is a default label which is the last in the vector. */
- min_case = TREE_VEC_ELT (cases, 0);
+ min_case = gimple_switch_label (swtch, 1);
info.range_min = CASE_LOW (min_case);
gcc_assert (branch_num > 1);
- gcc_assert (CASE_LOW (TREE_VEC_ELT (cases, branch_num - 1)) == NULL_TREE);
- max_case = TREE_VEC_ELT (cases, branch_num - 2);
+ gcc_assert (CASE_LOW (gimple_switch_label (swtch, 0)) == NULL_TREE);
+ max_case = gimple_switch_label (swtch, branch_num - 1);
if (CASE_HIGH (max_case) != NULL_TREE)
range_max = CASE_HIGH (max_case);
else
@@ -283,25 +282,26 @@ check_process_case (tree cs)
static bool
check_final_bb (void)
{
- tree phi;
+ gimple_stmt_iterator gsi;
info.phi_count = 0;
- for (phi = phi_nodes (info.final_bb); phi; phi = PHI_CHAIN (phi))
+ for (gsi = gsi_start_phis (info.final_bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- int i;
+ gimple phi = gsi_stmt (gsi);
+ unsigned int i;
info.phi_count++;
- for (i = 0; i < PHI_NUM_ARGS (phi); i++)
+ for (i = 0; i < gimple_phi_num_args (phi); i++)
{
- basic_block bb = PHI_ARG_EDGE (phi, i)->src;
+ basic_block bb = gimple_phi_arg_edge (phi, i)->src;
if ((bb == info.switch_bb
|| (single_pred_p (bb) && single_pred (bb) == info.switch_bb))
- && !is_gimple_min_invariant (PHI_ARG_ELT (phi, i).def))
+ && !is_gimple_min_invariant (gimple_phi_arg_def (phi, i)))
{
info.reason = " Non-invariant value from a case\n";
- return false; /* non invariant argument */
+ return false; /* Non-invariant argument. */
}
}
}
@@ -326,10 +326,8 @@ create_temp_arrays (void)
sizeof (tree));
for (i = 0; i < info.phi_count; i++)
- {
- info.constructors[i] = VEC_alloc (constructor_elt, gc,
- tree_low_cst (info.range_size, 1) + 1);
- }
+ info.constructors[i]
+ = VEC_alloc (constructor_elt, gc, tree_low_cst (info.range_size, 1) + 1);
}
/* Free the arrays created by create_temp_arrays(). The vectors that are
@@ -351,10 +349,10 @@ free_temp_arrays (void)
static void
gather_default_values (tree default_case)
{
- tree phi;
+ gimple_stmt_iterator gsi;
basic_block bb = label_to_block (CASE_LABEL (default_case));
edge e;
- int i;
+ int i = 0;
gcc_assert (CASE_LOW (default_case) == NULL_TREE);
@@ -363,11 +361,12 @@ gather_default_values (tree default_case)
else
e = single_succ_edge (bb);
- for (phi = phi_nodes (info.final_bb), i = 0; phi; phi = PHI_CHAIN (phi), i++)
+ for (gsi = gsi_start_phis (info.final_bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
+ gimple phi = gsi_stmt (gsi);
tree val = PHI_ARG_DEF_FROM_EDGE (phi, e);
gcc_assert (val);
- info.default_values[i] = val;
+ info.default_values[i++] = val;
}
}
@@ -376,18 +375,18 @@ gather_default_values (tree default_case)
order of phi nodes. SWTCH is the switch statement being converted. */
static void
-build_constructors (tree swtch)
+build_constructors (gimple swtch)
{
- int i;
- tree cases = SWITCH_LABELS (swtch);
+ unsigned i, branch_num = gimple_switch_num_labels (swtch);
tree pos = info.range_min;
- for (i = 0; i < TREE_VEC_LENGTH (cases) - 1; i++)
+ for (i = 1; i < branch_num; i++)
{
- tree cs = TREE_VEC_ELT (cases, i);
+ tree cs = gimple_switch_label (swtch, i);
basic_block bb = label_to_block (CASE_LABEL (cs));
edge e;
- tree phi, high;
+ tree high;
+ gimple_stmt_iterator gsi;
int j;
if (bb == info.final_bb)
@@ -405,7 +404,8 @@ build_constructors (tree swtch)
elt = VEC_quick_push (constructor_elt,
info.constructors[k], NULL);
- elt->index = int_const_binop (MINUS_EXPR, pos, info.range_min, 0);
+ elt->index = int_const_binop (MINUS_EXPR, pos,
+ info.range_min, 0);
elt->value = info.default_values[k];
}
@@ -418,8 +418,10 @@ build_constructors (tree swtch)
high = CASE_HIGH (cs);
else
high = CASE_LOW (cs);
- for (phi = phi_nodes (info.final_bb); phi; phi = PHI_CHAIN (phi))
+ for (gsi = gsi_start_phis (info.final_bb);
+ !gsi_end_p (gsi); gsi_next (&gsi))
{
+ gimple phi = gsi_stmt (gsi);
tree val = PHI_ARG_DEF_FROM_EDGE (phi, e);
pos = CASE_LOW (cs);
@@ -449,15 +451,12 @@ build_constructors (tree swtch)
is a temporary variable holding the index for loads from the new array. */
static void
-build_one_array (tree swtch, int num, tree arr_index_type, tree phi, tree tidx)
+build_one_array (gimple swtch, int num, tree arr_index_type, gimple phi,
+ tree tidx)
{
- tree array_type;
- tree ctor;
- tree decl;
- tree value_type;
- tree name;
- tree fetch, load;
- block_stmt_iterator bsi;
+ tree array_type, ctor, decl, value_type, name, fetch;
+ gimple load;
+ gimple_stmt_iterator gsi;
gcc_assert (info.default_values[num]);
value_type = TREE_TYPE (info.default_values[num]);
@@ -474,24 +473,23 @@ build_one_array (tree swtch, int num, tree arr_index_type, tree phi, tree tidx)
DECL_ARTIFICIAL (decl) = 1;
TREE_CONSTANT (decl) = 1;
add_referenced_var (decl);
- assemble_variable (decl, 0, 0, 0);
+ varpool_mark_needed_node (varpool_node (decl));
+ varpool_finalize_decl (decl);
mark_sym_for_renaming (decl);
- name = make_ssa_name (SSA_NAME_VAR (PHI_RESULT (phi)), NULL_TREE);
+ name = make_ssa_name (SSA_NAME_VAR (PHI_RESULT (phi)), NULL);
info.target_inbound_names[num] = name;
fetch = build4 (ARRAY_REF, value_type, decl, tidx, NULL_TREE,
NULL_TREE);
- load = build_gimple_modify_stmt (name, fetch);
+ load = gimple_build_assign (name, fetch);
SSA_NAME_DEF_STMT (name) = load;
- bsi = bsi_for_stmt (swtch);
- bsi_insert_before (&bsi, load, BSI_SAME_STMT);
+ gsi = gsi_for_stmt (swtch);
+ gsi_insert_before (&gsi, load, GSI_SAME_STMT);
mark_symbols_for_renaming (load);
info.arr_ref_last = load;
-
- return;
}
/* Builds and initializes static arrays initialized with values gathered from
@@ -499,54 +497,53 @@ build_one_array (tree swtch, int num, tree arr_index_type, tree phi, tree tidx)
them. */
static void
-build_arrays (tree swtch)
+build_arrays (gimple swtch)
{
tree arr_index_type;
tree tidx, sub;
- block_stmt_iterator bsi;
- tree phi = phi_nodes (info.final_bb);
+ gimple stmt;
+ gimple_stmt_iterator gsi;
int i;
- bsi = bsi_for_stmt (swtch);
+ gsi = gsi_for_stmt (swtch);
arr_index_type = build_index_type (info.range_size);
tidx = make_rename_temp (arr_index_type, "csti");
sub = fold_build2 (MINUS_EXPR, TREE_TYPE (info.index_expr), info.index_expr,
fold_convert (TREE_TYPE (info.index_expr),
info.range_min));
- sub = force_gimple_operand_bsi (&bsi, fold_convert (arr_index_type, sub),
- false, NULL, true, BSI_SAME_STMT);
- sub = build_gimple_modify_stmt (tidx, sub);
-
- bsi_insert_before (&bsi, sub, BSI_SAME_STMT);
- mark_symbols_for_renaming (sub);
- info.arr_ref_first = sub;
+ sub = force_gimple_operand_gsi (&gsi, fold_convert (arr_index_type, sub),
+ false, NULL, true, GSI_SAME_STMT);
+ stmt = gimple_build_assign (tidx, sub);
- for (phi = phi_nodes (info.final_bb), i = 0; phi; phi = PHI_CHAIN (phi), i++)
- build_one_array (swtch, i, arr_index_type, phi, tidx);
+ gsi_insert_before (&gsi, stmt, GSI_SAME_STMT);
+ mark_symbols_for_renaming (stmt);
+ info.arr_ref_first = stmt;
- return;
+ for (gsi = gsi_start_phis (info.final_bb), i = 0;
+ !gsi_end_p (gsi); gsi_next (&gsi), i++)
+ build_one_array (swtch, i, arr_index_type, gsi_stmt (gsi), tidx);
}
/* Generates and appropriately inserts loads of default values at the position
given by BSI. Returns the last inserted statement. */
-static tree
-gen_def_assigns (block_stmt_iterator *bsi)
+static gimple
+gen_def_assigns (gimple_stmt_iterator *gsi)
{
int i;
- tree assign = NULL_TREE;
+ gimple assign = NULL;
for (i = 0; i < info.phi_count; i++)
{
- tree name = make_ssa_name (SSA_NAME_VAR (info.target_inbound_names[i]),
- NULL_TREE);
+ tree name
+ = make_ssa_name (SSA_NAME_VAR (info.target_inbound_names[i]), NULL);
info.target_outbound_names[i] = name;
- assign = build_gimple_modify_stmt (name, info.default_values[i]);
+ assign = gimple_build_assign (name, info.default_values[i]);
SSA_NAME_DEF_STMT (name) = assign;
- bsi_insert_before (bsi, assign, BSI_SAME_STMT);
- find_new_referenced_vars (&assign);
+ gsi_insert_before (gsi, assign, GSI_SAME_STMT);
+ find_new_referenced_vars (assign);
mark_symbols_for_renaming (assign);
}
return assign;
@@ -582,11 +579,13 @@ prune_bbs (basic_block bbd, basic_block final)
static void
fix_phi_nodes (edge e1f, edge e2f, basic_block bbf)
{
- tree phi;
+ gimple_stmt_iterator gsi;
int i;
- for (phi = phi_nodes (bbf), i = 0; phi; phi = PHI_CHAIN (phi), i++)
+ for (gsi = gsi_start_phis (bbf), i = 0;
+ !gsi_end_p (gsi); gsi_next (&gsi), i++)
{
+ gimple phi = gsi_stmt (gsi);
add_phi_arg (phi, info.target_inbound_names[i], e1f);
add_phi_arg (phi, info.target_outbound_names[i], e2f);
}
@@ -615,28 +614,29 @@ fix_phi_nodes (edge e1f, edge e2f, basic_block bbf)
*/
static void
-gen_inbound_check (tree swtch)
+gen_inbound_check (gimple swtch)
{
tree label_decl1 = create_artificial_label ();
tree label_decl2 = create_artificial_label ();
tree label_decl3 = create_artificial_label ();
- tree label1, label2, label3;
+ gimple label1, label2, label3;
tree utype;
tree tmp_u;
- tree cast, cast_assign;
- tree ulb, minus, minus_assign;
+ tree cast;
+ gimple cast_assign, minus_assign;
+ tree ulb, minus;
tree bound;
- tree if_expr;
+ gimple cond_stmt;
- tree last_assign;
- block_stmt_iterator bsi;
+ gimple last_assign;
+ gimple_stmt_iterator gsi;
basic_block bb0, bb1, bb2, bbf, bbd;
edge e01, e02, e21, e1d, e1f, e2f;
gcc_assert (info.default_values);
- bb0 = bb_for_stmt (swtch);
+ bb0 = gimple_bb (swtch);
/* Make sure we do not generate arithmetics in a subrange. */
if (TREE_TYPE (TREE_TYPE (info.index_expr)))
@@ -645,52 +645,50 @@ gen_inbound_check (tree swtch)
utype = unsigned_type_for (TREE_TYPE (info.index_expr));
/* (end of) block 0 */
- bsi = bsi_for_stmt (info.arr_ref_first);
+ gsi = gsi_for_stmt (info.arr_ref_first);
tmp_u = make_rename_temp (utype, "csui");
cast = fold_convert (utype, info.index_expr);
- cast_assign = build_gimple_modify_stmt (tmp_u, cast);
- find_new_referenced_vars (&cast_assign);
- bsi_insert_before (&bsi, cast_assign, BSI_SAME_STMT);
+ cast_assign = gimple_build_assign (tmp_u, cast);
+ find_new_referenced_vars (cast_assign);
+ gsi_insert_before (&gsi, cast_assign, GSI_SAME_STMT);
mark_symbols_for_renaming (cast_assign);
ulb = fold_convert (utype, info.range_min);
minus = fold_build2 (MINUS_EXPR, utype, tmp_u, ulb);
- minus = force_gimple_operand_bsi (&bsi, minus, false, NULL, true,
- BSI_SAME_STMT);
- minus_assign = build_gimple_modify_stmt (tmp_u, minus);
- find_new_referenced_vars (&minus_assign);
- bsi_insert_before (&bsi, minus_assign, BSI_SAME_STMT);
+ minus = force_gimple_operand_gsi (&gsi, minus, false, NULL, true,
+ GSI_SAME_STMT);
+ minus_assign = gimple_build_assign (tmp_u, minus);
+ find_new_referenced_vars (minus_assign);
+ gsi_insert_before (&gsi, minus_assign, GSI_SAME_STMT);
mark_symbols_for_renaming (minus_assign);
bound = fold_convert (utype, info.range_size);
- if_expr = build3 (COND_EXPR, void_type_node,
- build2 (LE_EXPR, boolean_type_node, tmp_u, bound),
- NULL_TREE, NULL_TREE);
+ cond_stmt = gimple_build_cond (LE_EXPR, tmp_u, bound, NULL_TREE, NULL_TREE);
- find_new_referenced_vars (&if_expr);
- bsi_insert_before (&bsi, if_expr, BSI_SAME_STMT);
- mark_symbols_for_renaming (if_expr);
+ find_new_referenced_vars (cond_stmt);
+ gsi_insert_before (&gsi, cond_stmt, GSI_SAME_STMT);
+ mark_symbols_for_renaming (cond_stmt);
/* block 2 */
- bsi = bsi_for_stmt (info.arr_ref_first);
- label2 = build1 (LABEL_EXPR, void_type_node, label_decl2);
- bsi_insert_before (&bsi, label2, BSI_SAME_STMT);
- last_assign = gen_def_assigns (&bsi);
+ gsi = gsi_for_stmt (info.arr_ref_first);
+ label2 = gimple_build_label (label_decl2);
+ gsi_insert_before (&gsi, label2, GSI_SAME_STMT);
+ last_assign = gen_def_assigns (&gsi);
/* block 1 */
- bsi = bsi_for_stmt (info.arr_ref_first);
- label1 = build1 (LABEL_EXPR, void_type_node, label_decl1);
- bsi_insert_before (&bsi, label1, BSI_SAME_STMT);
+ gsi = gsi_for_stmt (info.arr_ref_first);
+ label1 = gimple_build_label (label_decl1);
+ gsi_insert_before (&gsi, label1, GSI_SAME_STMT);
/* block F */
- bsi = bsi_start (info.final_bb);
- label3 = build1 (LABEL_EXPR, void_type_node, label_decl3);
- bsi_insert_before (&bsi, label3, BSI_SAME_STMT);
+ gsi = gsi_start_bb (info.final_bb);
+ label3 = gimple_build_label (label_decl3);
+ gsi_insert_before (&gsi, label3, GSI_SAME_STMT);
/* cfg fix */
- e02 = split_block (bb0, if_expr);
+ e02 = split_block (bb0, cond_stmt);
bb2 = e02->dest;
e21 = split_block (bb2, last_assign);
@@ -727,8 +725,8 @@ gen_inbound_check (tree swtch)
bb2->frequency = EDGE_FREQUENCY (e02);
bbf->frequency = EDGE_FREQUENCY (e1f) + EDGE_FREQUENCY (e2f);
- prune_bbs (bbd, info.final_bb); /* to keep calc_dfs_tree() in dominance.c
- happy */
+ prune_bbs (bbd, info.final_bb); /* To keep calc_dfs_tree() in dominance.c
+ happy. */
fix_phi_nodes (e1f, e2f, bbf);
@@ -741,31 +739,24 @@ gen_inbound_check (tree swtch)
one after another until one fails or the conversion is completed. */
static bool
-process_switch (tree swtch)
+process_switch (gimple swtch)
{
- int i;
- tree cases;
+ unsigned int i, branch_num = gimple_switch_num_labels (swtch);
tree index_type;
/* Operand 2 is either NULL_TREE or a vector of cases (stmt.c). */
- if (TREE_OPERAND (swtch, 2) == NULL_TREE)
+ if (branch_num < 2)
{
- info.reason = "swtch has no labels\n";
+ info.reason = "switch has no labels\n";
return false;
}
- /* Comment from stmt.c:
- The switch body is lowered in gimplify.c, we should never have switches
- with a non-NULL SWITCH_BODY here. */
- gcc_assert (!SWITCH_BODY (swtch));
-
- cases = SWITCH_LABELS (swtch);
info.final_bb = NULL;
- info.switch_bb = bb_for_stmt (swtch);
- info.index_expr = SWITCH_COND (swtch);
+ info.switch_bb = gimple_bb (swtch);
+ info.index_expr = gimple_switch_index (swtch);
index_type = TREE_TYPE (info.index_expr);
- info.arr_ref_first = NULL_TREE;
- info.arr_ref_last = NULL_TREE;
+ info.arr_ref_first = NULL;
+ info.arr_ref_last = NULL;
info.default_prob = 0;
info.default_count = 0;
info.other_count = 0;
@@ -784,16 +775,13 @@ process_switch (tree swtch)
/* For all the cases, see whether they are empty, the assignments they
represent constant and so on... */
- for (i = 0; i < TREE_VEC_LENGTH (cases); i++)
- {
- tree part_case = TREE_VEC_ELT (cases, i);
- if (!check_process_case (part_case))
- {
- if (dump_file)
- fprintf (dump_file, "Processing of case %i failed\n", i);
- return false;
- }
- }
+ for (i = 0; i < branch_num; i++)
+ if (!check_process_case (gimple_switch_label (swtch, i)))
+ {
+ if (dump_file)
+ fprintf (dump_file, "Processing of case %i failed\n", i);
+ return false;
+ }
if (!check_final_bb ())
return false;
@@ -802,7 +790,7 @@ process_switch (tree swtch)
transformation. */
create_temp_arrays ();
- gather_default_values (TREE_VEC_ELT (cases, TREE_VEC_LENGTH (cases) - 1));
+ gather_default_values (gimple_switch_label (swtch, 0));
build_constructors (swtch);
build_arrays (swtch); /* Build the static arrays and assignments. */
@@ -823,17 +811,17 @@ do_switchconv (void)
FOR_EACH_BB (bb)
{
- tree stmt = last_stmt (bb);
- if (stmt && TREE_CODE (stmt) == SWITCH_EXPR)
+ gimple stmt = last_stmt (bb);
+ if (stmt && gimple_code (stmt) == GIMPLE_SWITCH)
{
- expanded_location loc = expand_location (EXPR_LOCATION (stmt));
-
if (dump_file)
{
+ expanded_location loc = expand_location (gimple_location (stmt));
+
fprintf (dump_file, "beginning to process the following "
"SWITCH statement (%s:%d) : ------- \n",
loc.file, loc.line);
- print_generic_stmt (dump_file, stmt, 2);
+ print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM);
fprintf (dump_file, "\n");
}
diff --git a/gcc/tree-tailcall.c b/gcc/tree-tailcall.c
index 92127b4b7af..935b41941a0 100644
--- a/gcc/tree-tailcall.c
+++ b/gcc/tree-tailcall.c
@@ -100,11 +100,8 @@ along with GCC; see the file COPYING3. If not see
struct tailcall
{
- /* The block in that the call occur. */
- basic_block call_block;
-
/* The iterator pointing to the call statement. */
- block_stmt_iterator call_bsi;
+ gimple_stmt_iterator call_gsi;
/* True if it is a call to the current function. */
bool tail_recursion;
@@ -191,13 +188,13 @@ suitable_for_tail_call_opt_p (void)
}
/* Checks whether the expression EXPR in stmt AT is independent of the
- statement pointed to by BSI (in a sense that we already know EXPR's value
- at BSI). We use the fact that we are only called from the chain of
+ statement pointed to by GSI (in a sense that we already know EXPR's value
+ at GSI). We use the fact that we are only called from the chain of
basic blocks that have only single successor. Returns the expression
- containing the value of EXPR at BSI. */
+ containing the value of EXPR at GSI. */
static tree
-independent_of_stmt_p (tree expr, tree at, block_stmt_iterator bsi)
+independent_of_stmt_p (tree expr, gimple at, gimple_stmt_iterator gsi)
{
basic_block bb, call_bb, at_bb;
edge e;
@@ -210,8 +207,8 @@ independent_of_stmt_p (tree expr, tree at, block_stmt_iterator bsi)
return NULL_TREE;
/* Mark the blocks in the chain leading to the end. */
- at_bb = bb_for_stmt (at);
- call_bb = bb_for_stmt (bsi_stmt (bsi));
+ at_bb = gimple_bb (at);
+ call_bb = gimple_bb (gsi_stmt (gsi));
for (bb = call_bb; bb != at_bb; bb = single_succ (bb))
bb->aux = &bb->aux;
bb->aux = &bb->aux;
@@ -219,7 +216,7 @@ independent_of_stmt_p (tree expr, tree at, block_stmt_iterator bsi)
while (1)
{
at = SSA_NAME_DEF_STMT (expr);
- bb = bb_for_stmt (at);
+ bb = gimple_bb (at);
/* The default definition or defined before the chain. */
if (!bb || !bb->aux)
@@ -227,16 +224,16 @@ independent_of_stmt_p (tree expr, tree at, block_stmt_iterator bsi)
if (bb == call_bb)
{
- for (; !bsi_end_p (bsi); bsi_next (&bsi))
- if (bsi_stmt (bsi) == at)
+ for (; !gsi_end_p (gsi); gsi_next (&gsi))
+ if (gsi_stmt (gsi) == at)
break;
- if (!bsi_end_p (bsi))
+ if (!gsi_end_p (gsi))
expr = NULL_TREE;
break;
}
- if (TREE_CODE (at) != PHI_NODE)
+ if (gimple_code (at) != GIMPLE_PHI)
{
expr = NULL_TREE;
break;
@@ -263,27 +260,33 @@ independent_of_stmt_p (tree expr, tree at, block_stmt_iterator bsi)
return expr;
}
-/* Simulates the effect of an assignment of ASS in STMT on the return value
- of the tail recursive CALL passed in ASS_VAR. M and A are the
- multiplicative and the additive factor for the real return value. */
+/* Simulates the effect of an assignment STMT on the return value of the tail
+ recursive CALL passed in ASS_VAR. M and A are the multiplicative and the
+ additive factor for the real return value. */
static bool
-process_assignment (tree ass, tree stmt, block_stmt_iterator call, tree *m,
+process_assignment (gimple stmt, gimple_stmt_iterator call, tree *m,
tree *a, tree *ass_var)
{
tree op0, op1, non_ass_var;
- tree dest = GIMPLE_STMT_OPERAND (ass, 0);
- tree src = GIMPLE_STMT_OPERAND (ass, 1);
- enum tree_code code = TREE_CODE (src);
- tree src_var = src;
-
+ tree dest = gimple_assign_lhs (stmt);
+ enum tree_code code = gimple_assign_rhs_code (stmt);
+ enum gimple_rhs_class rhs_class = get_gimple_rhs_class (code);
+ tree src_var = gimple_assign_rhs1 (stmt);
+
/* See if this is a simple copy operation of an SSA name to the function
result. In that case we may have a simple tail call. Ignore type
conversions that can never produce extra code between the function
call and the function return. */
- STRIP_NOPS (src_var);
- if (TREE_CODE (src_var) == SSA_NAME)
+ if ((rhs_class == GIMPLE_SINGLE_RHS || gimple_assign_cast_p (stmt))
+ && (TREE_CODE (src_var) == SSA_NAME))
{
+ /* Reject a tailcall if the type conversion might need
+ additional code. */
+ if (gimple_assign_cast_p (stmt)
+ && TYPE_MODE (TREE_TYPE (dest)) != TYPE_MODE (TREE_TYPE (src_var)))
+ return false;
+
if (src_var != *ass_var)
return false;
@@ -291,7 +294,7 @@ process_assignment (tree ass, tree stmt, block_stmt_iterator call, tree *m,
return true;
}
- if (TREE_CODE_CLASS (code) != tcc_binary)
+ if (rhs_class != GIMPLE_BINARY_RHS)
return false;
/* Accumulator optimizations will reverse the order of operations.
@@ -311,8 +314,8 @@ process_assignment (tree ass, tree stmt, block_stmt_iterator call, tree *m,
TODO -- Extend it for cases where the linear transformation of the output
is expressed in a more complicated way. */
- op0 = TREE_OPERAND (src, 0);
- op1 = TREE_OPERAND (src, 1);
+ op0 = gimple_assign_rhs1 (stmt);
+ op1 = gimple_assign_rhs2 (stmt);
if (op0 == *ass_var
&& (non_ass_var = independent_of_stmt_p (op1, stmt, call)))
@@ -346,7 +349,8 @@ process_assignment (tree ass, tree stmt, block_stmt_iterator call, tree *m,
*ass_var = dest;
return true;
- /* TODO -- Handle other codes (NEGATE_EXPR, MINUS_EXPR, POINTER_PLUS_EXPR). */
+ /* TODO -- Handle other codes (NEGATE_EXPR, MINUS_EXPR,
+ POINTER_PLUS_EXPR). */
default:
return false;
@@ -359,12 +363,14 @@ static tree
propagate_through_phis (tree var, edge e)
{
basic_block dest = e->dest;
- tree phi;
-
- for (phi = phi_nodes (dest); phi; phi = PHI_CHAIN (phi))
- if (PHI_ARG_DEF_FROM_EDGE (phi, e) == var)
- return PHI_RESULT (phi);
-
+ gimple_stmt_iterator gsi;
+
+ for (gsi = gsi_start_phis (dest); !gsi_end_p (gsi); gsi_next (&gsi))
+ {
+ gimple phi = gsi_stmt (gsi);
+ if (PHI_ARG_DEF_FROM_EDGE (phi, e) == var)
+ return PHI_RESULT (phi);
+ }
return var;
}
@@ -374,52 +380,44 @@ propagate_through_phis (tree var, edge e)
static void
find_tail_calls (basic_block bb, struct tailcall **ret)
{
- tree ass_var, ret_var, stmt, func, param, call = NULL_TREE;
- block_stmt_iterator bsi, absi;
+ tree ass_var = NULL_TREE, ret_var, func, param;
+ gimple stmt, call = NULL;
+ gimple_stmt_iterator gsi, agsi;
bool tail_recursion;
struct tailcall *nw;
edge e;
tree m, a;
basic_block abb;
- stmt_ann_t ann;
+ size_t idx;
if (!single_succ_p (bb))
return;
- for (bsi = bsi_last (bb); !bsi_end_p (bsi); bsi_prev (&bsi))
+ for (gsi = gsi_last_bb (bb); !gsi_end_p (gsi); gsi_prev (&gsi))
{
- stmt = bsi_stmt (bsi);
+ stmt = gsi_stmt (gsi);
/* Ignore labels. */
- if (TREE_CODE (stmt) == LABEL_EXPR)
+ if (gimple_code (stmt) == GIMPLE_LABEL)
continue;
/* Check for a call. */
- if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT)
- {
- ass_var = GIMPLE_STMT_OPERAND (stmt, 0);
- call = GIMPLE_STMT_OPERAND (stmt, 1);
- if (TREE_CODE (call) == WITH_SIZE_EXPR)
- call = TREE_OPERAND (call, 0);
- }
- else
+ if (is_gimple_call (stmt))
{
- ass_var = NULL_TREE;
call = stmt;
+ ass_var = gimple_call_lhs (stmt);
+ break;
}
- if (TREE_CODE (call) == CALL_EXPR)
- break;
-
/* If the statement has virtual or volatile operands, fail. */
- ann = stmt_ann (stmt);
if (!ZERO_SSA_OPERANDS (stmt, (SSA_OP_VUSE | SSA_OP_VIRTUAL_DEFS))
- || ann->has_volatile_ops
- || (!gimple_aliases_computed_p (cfun) && ann->references_memory))
+ || gimple_has_volatile_ops (stmt)
+ || (!gimple_aliases_computed_p (cfun)
+ && gimple_references_memory_p (stmt)))
return;
}
- if (bsi_end_p (bsi))
+ if (gsi_end_p (gsi))
{
edge_iterator ei;
/* Recurse to the predecessors. */
@@ -445,16 +443,15 @@ find_tail_calls (basic_block bb, struct tailcall **ret)
/* We found the call, check whether it is suitable. */
tail_recursion = false;
- func = get_callee_fndecl (call);
+ func = gimple_call_fndecl (call);
if (func == current_function_decl)
{
- call_expr_arg_iterator iter;
tree arg;
- for (param = DECL_ARGUMENTS (func),
- arg = first_call_expr_arg (call, &iter);
- param && arg;
- param = TREE_CHAIN (param), arg = next_call_expr_arg (&iter))
+ for (param = DECL_ARGUMENTS (func), idx = 0;
+ param && idx < gimple_call_num_args (call);
+ param = TREE_CHAIN (param), idx ++)
{
+ arg = gimple_call_arg (call, idx);
if (param != arg)
{
/* Make sure there are no problems with copying. The parameter
@@ -463,7 +460,7 @@ find_tail_calls (basic_block bb, struct tailcall **ret)
we emitted a suitable type conversion statement. */
if (!is_gimple_reg_type (TREE_TYPE (param))
|| !useless_type_conversion_p (TREE_TYPE (param),
- TREE_TYPE (arg)))
+ TREE_TYPE (arg)))
break;
/* The parameter should be a real operand, so that phi node
@@ -471,13 +468,13 @@ find_tail_calls (basic_block bb, struct tailcall **ret)
of copying the value. This test implies is_gimple_reg_type
from the previous condition, however this one could be
relaxed by being more careful with copying the new value
- of the parameter (emitting appropriate GIMPLE_MODIFY_STMT and
+ of the parameter (emitting appropriate GIMPLE_ASSIGN and
updating the virtual operands). */
if (!is_gimple_reg (param))
break;
}
}
- if (!arg && !param)
+ if (idx == gimple_call_num_args (call) && !param)
tail_recursion = true;
}
@@ -489,48 +486,36 @@ find_tail_calls (basic_block bb, struct tailcall **ret)
a = NULL_TREE;
abb = bb;
- absi = bsi;
+ agsi = gsi;
while (1)
{
- bsi_next (&absi);
+ gsi_next (&agsi);
- while (bsi_end_p (absi))
+ while (gsi_end_p (agsi))
{
ass_var = propagate_through_phis (ass_var, single_succ_edge (abb));
abb = single_succ (abb);
- absi = bsi_start (abb);
+ agsi = gsi_start_bb (abb);
}
- stmt = bsi_stmt (absi);
+ stmt = gsi_stmt (agsi);
- if (TREE_CODE (stmt) == LABEL_EXPR)
+ if (gimple_code (stmt) == GIMPLE_LABEL)
continue;
- if (TREE_CODE (stmt) == RETURN_EXPR)
+ if (gimple_code (stmt) == GIMPLE_RETURN)
break;
- if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
+ if (gimple_code (stmt) != GIMPLE_ASSIGN)
return;
- if (!process_assignment (stmt, stmt, bsi, &m, &a, &ass_var))
+ /* This is a gimple assign. */
+ if (! process_assignment (stmt, gsi, &m, &a, &ass_var))
return;
}
/* See if this is a tail call we can handle. */
- ret_var = TREE_OPERAND (stmt, 0);
- if (ret_var
- && TREE_CODE (ret_var) == GIMPLE_MODIFY_STMT)
- {
- tree ret_op = GIMPLE_STMT_OPERAND (ret_var, 1);
- STRIP_NOPS (ret_op);
- if (!tail_recursion
- && TREE_CODE (ret_op) != SSA_NAME)
- return;
-
- if (!process_assignment (ret_var, stmt, bsi, &m, &a, &ass_var))
- return;
- ret_var = GIMPLE_STMT_OPERAND (ret_var, 0);
- }
+ ret_var = gimple_return_retval (stmt);
/* We may proceed if there either is no return value, or the return value
is identical to the call's return. */
@@ -545,8 +530,7 @@ find_tail_calls (basic_block bb, struct tailcall **ret)
nw = XNEW (struct tailcall);
- nw->call_block = bb;
- nw->call_bsi = bsi;
+ nw->call_gsi = gsi;
nw->tail_recursion = tail_recursion;
@@ -557,15 +541,70 @@ find_tail_calls (basic_block bb, struct tailcall **ret)
*ret = nw;
}
-/* Adjust the accumulator values according to A and M after BSI, and update
- the phi nodes on edge BACK. */
+/* Helper to insert PHI_ARGH to the phi of VAR in the destination of edge E. */
static void
-adjust_accumulator_values (block_stmt_iterator bsi, tree m, tree a, edge back)
+add_successor_phi_arg (edge e, tree var, tree phi_arg)
+{
+ gimple_stmt_iterator gsi;
+
+ for (gsi = gsi_start_phis (e->dest); !gsi_end_p (gsi); gsi_next (&gsi))
+ if (PHI_RESULT (gsi_stmt (gsi)) == var)
+ break;
+
+ gcc_assert (!gsi_end_p (gsi));
+ add_phi_arg (gsi_stmt (gsi), phi_arg, e);
+}
+
+/* Creates a GIMPLE statement which computes the operation specified by
+ CODE, OP0 and OP1 to a new variable with name LABEL and inserts the
+ statement in the position specified by GSI and UPDATE. Returns the
+ tree node of the statement's result. */
+
+static tree
+adjust_return_value_with_ops (enum tree_code code, const char *label,
+ tree op0, tree op1, gimple_stmt_iterator gsi,
+ enum gsi_iterator_update update)
{
- tree stmt, var, phi, tmp;
+
tree ret_type = TREE_TYPE (DECL_RESULT (current_function_decl));
- tree a_acc_arg = a_acc, m_acc_arg = m_acc;
+ tree tmp = create_tmp_var (ret_type, label);
+ gimple stmt = gimple_build_assign_with_ops (code, tmp, op0, op1);
+ tree result;
+
+ add_referenced_var (tmp);
+ result = make_ssa_name (tmp, stmt);
+ gimple_assign_set_lhs (stmt, result);
+ update_stmt (stmt);
+ gsi_insert_before (&gsi, stmt, update);
+ return result;
+}
+
+/* Creates a new GIMPLE statement that adjusts the value of accumulator ACC by
+ the computation specified by CODE and OP1 and insert the statement
+ at the position specified by GSI as a new statement. Returns new SSA name
+ of updated accumulator. */
+
+static tree
+update_accumulator_with_ops (enum tree_code code, tree acc, tree op1,
+ gimple_stmt_iterator gsi)
+{
+ gimple stmt = gimple_build_assign_with_ops (code, SSA_NAME_VAR (acc), acc,
+ op1);
+ tree var = make_ssa_name (SSA_NAME_VAR (acc), stmt);
+ gimple_assign_set_lhs (stmt, var);
+ update_stmt (stmt);
+ gsi_insert_after (&gsi, stmt, GSI_NEW_STMT);
+ return var;
+}
+
+/* Adjust the accumulator values according to A and M after GSI, and update
+ the phi nodes on edge BACK. */
+
+static void
+adjust_accumulator_values (gimple_stmt_iterator gsi, tree m, tree a, edge back)
+{
+ tree var, a_acc_arg = a_acc, m_acc_arg = m_acc;
if (a)
{
@@ -574,58 +613,23 @@ adjust_accumulator_values (block_stmt_iterator bsi, tree m, tree a, edge back)
if (integer_onep (a))
var = m_acc;
else
- {
- stmt = build_gimple_modify_stmt (NULL_TREE,
- build2 (MULT_EXPR, ret_type,
- m_acc, a));
-
- tmp = create_tmp_var (ret_type, "acc_tmp");
- add_referenced_var (tmp);
-
- var = make_ssa_name (tmp, stmt);
- GIMPLE_STMT_OPERAND (stmt, 0) = var;
- bsi_insert_after (&bsi, stmt, BSI_NEW_STMT);
- }
+ var = adjust_return_value_with_ops (MULT_EXPR, "acc_tmp", m_acc,
+ a, gsi, GSI_NEW_STMT);
}
else
var = a;
- stmt = build_gimple_modify_stmt (NULL_TREE, build2 (PLUS_EXPR, ret_type,
- a_acc, var));
- var = make_ssa_name (SSA_NAME_VAR (a_acc), stmt);
- GIMPLE_STMT_OPERAND (stmt, 0) = var;
- bsi_insert_after (&bsi, stmt, BSI_NEW_STMT);
- a_acc_arg = var;
+ a_acc_arg = update_accumulator_with_ops (PLUS_EXPR, a_acc, var, gsi);
}
if (m)
- {
- stmt = build_gimple_modify_stmt (NULL_TREE,
- build2 (MULT_EXPR, ret_type,
- m_acc, m));
- var = make_ssa_name (SSA_NAME_VAR (m_acc), stmt);
- GIMPLE_STMT_OPERAND (stmt, 0) = var;
- bsi_insert_after (&bsi, stmt, BSI_NEW_STMT);
- m_acc_arg = var;
- }
+ m_acc_arg = update_accumulator_with_ops (MULT_EXPR, m_acc, m, gsi);
if (a_acc)
- {
- for (phi = phi_nodes (back->dest); phi; phi = PHI_CHAIN (phi))
- if (PHI_RESULT (phi) == a_acc)
- break;
-
- add_phi_arg (phi, a_acc_arg, back);
- }
+ add_successor_phi_arg (back, a_acc, a_acc_arg);
if (m_acc)
- {
- for (phi = phi_nodes (back->dest); phi; phi = PHI_CHAIN (phi))
- if (PHI_RESULT (phi) == m_acc)
- break;
-
- add_phi_arg (phi, m_acc_arg, back);
- }
+ add_successor_phi_arg (back, m_acc, m_acc_arg);
}
/* Adjust value of the return at the end of BB according to M and A
@@ -634,56 +638,23 @@ adjust_accumulator_values (block_stmt_iterator bsi, tree m, tree a, edge back)
static void
adjust_return_value (basic_block bb, tree m, tree a)
{
- tree ret_stmt = last_stmt (bb), ret_var, var, stmt, tmp;
- tree ret_type = TREE_TYPE (DECL_RESULT (current_function_decl));
- tree *ret_op;
- block_stmt_iterator bsi = bsi_last (bb);
+ tree retval;
+ gimple ret_stmt = gimple_seq_last_stmt (bb_seq (bb));
+ gimple_stmt_iterator gsi = gsi_last_bb (bb);
- gcc_assert (TREE_CODE (ret_stmt) == RETURN_EXPR);
+ gcc_assert (gimple_code (ret_stmt) == GIMPLE_RETURN);
- ret_var = TREE_OPERAND (ret_stmt, 0);
- if (!ret_var)
+ retval = gimple_return_retval (ret_stmt);
+ if (!retval || retval == error_mark_node)
return;
- if (TREE_CODE (ret_var) == GIMPLE_MODIFY_STMT)
- {
- ret_op = &GIMPLE_STMT_OPERAND (ret_var, 1);
- ret_var = *ret_op;
- }
- else
- ret_op = &TREE_OPERAND (ret_stmt, 0);
-
if (m)
- {
- stmt = build_gimple_modify_stmt (NULL_TREE,
- build2 (MULT_EXPR, ret_type,
- m_acc, ret_var));
-
- tmp = create_tmp_var (ret_type, "acc_tmp");
- add_referenced_var (tmp);
-
- var = make_ssa_name (tmp, stmt);
- GIMPLE_STMT_OPERAND (stmt, 0) = var;
- bsi_insert_before (&bsi, stmt, BSI_SAME_STMT);
- }
- else
- var = ret_var;
-
+ retval = adjust_return_value_with_ops (MULT_EXPR, "mul_tmp", m_acc, retval,
+ gsi, GSI_SAME_STMT);
if (a)
- {
- stmt = build_gimple_modify_stmt (NULL_TREE,
- build2 (PLUS_EXPR, ret_type,
- a_acc, var));
-
- tmp = create_tmp_var (ret_type, "acc_tmp");
- add_referenced_var (tmp);
-
- var = make_ssa_name (tmp, stmt);
- GIMPLE_STMT_OPERAND (stmt, 0) = var;
- bsi_insert_before (&bsi, stmt, BSI_SAME_STMT);
- }
-
- *ret_op = var;
+ retval = adjust_return_value_with_ops (PLUS_EXPR, "acc_tmp", a_acc, retval,
+ gsi, GSI_SAME_STMT);
+ gimple_return_set_retval (ret_stmt, retval);
update_stmt (ret_stmt);
}
@@ -735,90 +706,92 @@ arg_needs_copy_p (tree param)
static void
eliminate_tail_call (struct tailcall *t)
{
- tree param, stmt, rslt, call;
+ tree param, rslt;
+ gimple stmt, call;
tree arg;
- call_expr_arg_iterator iter;
+ size_t idx;
basic_block bb, first;
edge e;
- tree phi;
- block_stmt_iterator bsi;
- tree orig_stmt;
+ gimple phi;
+ gimple_stmt_iterator gsi;
+ gimple orig_stmt;
- stmt = orig_stmt = bsi_stmt (t->call_bsi);
- bb = t->call_block;
+ stmt = orig_stmt = gsi_stmt (t->call_gsi);
+ bb = gsi_bb (t->call_gsi);
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Eliminated tail recursion in bb %d : ",
bb->index);
- print_generic_stmt (dump_file, stmt, TDF_SLIM);
+ print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM);
fprintf (dump_file, "\n");
}
- if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT)
- stmt = GIMPLE_STMT_OPERAND (stmt, 1);
+ gcc_assert (is_gimple_call (stmt));
first = single_succ (ENTRY_BLOCK_PTR);
- /* Remove the code after call_bsi that will become unreachable. The
+ /* Remove the code after call_gsi that will become unreachable. The
possibly unreachable code in other blocks is removed later in
cfg cleanup. */
- bsi = t->call_bsi;
- bsi_next (&bsi);
- while (!bsi_end_p (bsi))
+ gsi = t->call_gsi;
+ gsi_next (&gsi);
+ while (!gsi_end_p (gsi))
{
- tree t = bsi_stmt (bsi);
+ gimple t = gsi_stmt (gsi);
/* Do not remove the return statement, so that redirect_edge_and_branch
sees how the block ends. */
- if (TREE_CODE (t) == RETURN_EXPR)
+ if (gimple_code (t) == GIMPLE_RETURN)
break;
- bsi_remove (&bsi, true);
+ gsi_remove (&gsi, true);
release_defs (t);
}
/* Number of executions of function has reduced by the tailcall. */
- e = single_succ_edge (t->call_block);
+ e = single_succ_edge (gsi_bb (t->call_gsi));
decrease_profile (EXIT_BLOCK_PTR, e->count, EDGE_FREQUENCY (e));
decrease_profile (ENTRY_BLOCK_PTR, e->count, EDGE_FREQUENCY (e));
if (e->dest != EXIT_BLOCK_PTR)
decrease_profile (e->dest, e->count, EDGE_FREQUENCY (e));
/* Replace the call by a jump to the start of function. */
- e = redirect_edge_and_branch (single_succ_edge (t->call_block), first);
+ e = redirect_edge_and_branch (single_succ_edge (gsi_bb (t->call_gsi)),
+ first);
gcc_assert (e);
- PENDING_STMT (e) = NULL_TREE;
+ PENDING_STMT (e) = NULL;
/* Add phi node entries for arguments. The ordering of the phi nodes should
be the same as the ordering of the arguments. */
for (param = DECL_ARGUMENTS (current_function_decl),
- arg = first_call_expr_arg (stmt, &iter),
- phi = phi_nodes (first);
+ idx = 0, gsi = gsi_start_phis (first);
param;
- param = TREE_CHAIN (param), arg = next_call_expr_arg (&iter))
+ param = TREE_CHAIN (param), idx++)
{
if (!arg_needs_copy_p (param))
continue;
+
+ arg = gimple_call_arg (stmt, idx);
+ phi = gsi_stmt (gsi);
gcc_assert (param == SSA_NAME_VAR (PHI_RESULT (phi)));
add_phi_arg (phi, arg, e);
- phi = PHI_CHAIN (phi);
+ gsi_next (&gsi);
}
/* Update the values of accumulators. */
- adjust_accumulator_values (t->call_bsi, t->mult, t->add, e);
+ adjust_accumulator_values (t->call_gsi, t->mult, t->add, e);
- call = bsi_stmt (t->call_bsi);
- if (TREE_CODE (call) == GIMPLE_MODIFY_STMT)
+ call = gsi_stmt (t->call_gsi);
+ rslt = gimple_call_lhs (call);
+ if (rslt != NULL_TREE)
{
- rslt = GIMPLE_STMT_OPERAND (call, 0);
-
/* Result of the call will no longer be defined. So adjust the
SSA_NAME_DEF_STMT accordingly. */
- SSA_NAME_DEF_STMT (rslt) = build_empty_stmt ();
+ SSA_NAME_DEF_STMT (rslt) = gimple_build_nop ();
}
- bsi_remove (&t->call_bsi, true);
+ gsi_remove (&t->call_gsi, true);
release_defs (call);
}
@@ -866,21 +839,40 @@ optimize_tail_call (struct tailcall *t, bool opt_tailcalls)
if (opt_tailcalls)
{
- tree stmt = bsi_stmt (t->call_bsi);
+ gimple stmt = gsi_stmt (t->call_gsi);
- stmt = get_call_expr_in (stmt);
- CALL_EXPR_TAILCALL (stmt) = 1;
+ gimple_call_set_tail (stmt, true);
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Found tail call ");
- print_generic_expr (dump_file, stmt, dump_flags);
- fprintf (dump_file, " in bb %i\n", t->call_block->index);
+ print_gimple_stmt (dump_file, stmt, 0, dump_flags);
+ fprintf (dump_file, " in bb %i\n", (gsi_bb (t->call_gsi))->index);
}
}
return false;
}
+/* Creates a tail-call accumulator of the same type as the return type of the
+ current function. LABEL is the name used to creating the temporary
+ variable for the accumulator. The accumulator will be inserted in the
+ phis of a basic block BB with single predecessor with an initial value
+ INIT converted to the current function return type. */
+
+static tree
+create_tailcall_accumulator (const char *label, basic_block bb, tree init)
+{
+ tree ret_type = TREE_TYPE (DECL_RESULT (current_function_decl));
+ tree tmp = create_tmp_var (ret_type, label);
+ gimple phi;
+
+ add_referenced_var (tmp);
+ phi = create_phi_node (tmp, bb);
+ /* RET_TYPE can be a float when -ffast-maths is enabled. */
+ add_phi_arg (phi, fold_convert (ret_type, init), single_pred_edge (bb));
+ return PHI_RESULT (phi);
+}
+
/* Optimizes tail calls in the function, turning the tail recursion
into iteration. */
@@ -892,7 +884,8 @@ tree_optimize_tail_calls_1 (bool opt_tailcalls)
struct tailcall *tailcalls = NULL, *act, *next;
bool changed = false;
basic_block first = single_succ (ENTRY_BLOCK_PTR);
- tree stmt, param, ret_type, tmp, phi;
+ tree param;
+ gimple stmt;
edge_iterator ei;
if (!suitable_for_tail_opt_p ())
@@ -907,7 +900,7 @@ tree_optimize_tail_calls_1 (bool opt_tailcalls)
stmt = last_stmt (e->src);
if (stmt
- && TREE_CODE (stmt) == RETURN_EXPR)
+ && gimple_code (stmt) == GIMPLE_RETURN)
find_tail_calls (e->src, &tailcalls);
}
@@ -932,7 +925,7 @@ tree_optimize_tail_calls_1 (bool opt_tailcalls)
{
tree name = gimple_default_def (cfun, param);
tree new_name = make_ssa_name (param, SSA_NAME_DEF_STMT (name));
- tree phi;
+ gimple phi;
set_default_def (param, new_name);
phi = create_phi_node (name, first);
@@ -943,44 +936,12 @@ tree_optimize_tail_calls_1 (bool opt_tailcalls)
}
if (act->add && !a_acc)
- {
- ret_type = TREE_TYPE (DECL_RESULT (current_function_decl));
-
- tmp = create_tmp_var (ret_type, "add_acc");
- add_referenced_var (tmp);
-
- phi = create_phi_node (tmp, first);
- add_phi_arg (phi,
- /* RET_TYPE can be a float when -ffast-maths is
- enabled. */
- fold_convert (ret_type, integer_zero_node),
- single_pred_edge (first));
- a_acc = PHI_RESULT (phi);
- }
+ a_acc = create_tailcall_accumulator ("add_acc", first,
+ integer_zero_node);
if (act->mult && !m_acc)
- {
- ret_type = TREE_TYPE (DECL_RESULT (current_function_decl));
-
- tmp = create_tmp_var (ret_type, "mult_acc");
- add_referenced_var (tmp);
-
- phi = create_phi_node (tmp, first);
- add_phi_arg (phi,
- /* RET_TYPE can be a float when -ffast-maths is
- enabled. */
- fold_convert (ret_type, integer_one_node),
- single_pred_edge (first));
- m_acc = PHI_RESULT (phi);
- }
- }
-
-
- if (phis_constructed)
- {
- /* Reverse the order of the phi nodes, so that it matches the order
- of operands of the function, as assumed by eliminate_tail_call. */
- set_phi_nodes (first, phi_reverse (phi_nodes (first)));
+ m_acc = create_tailcall_accumulator ("mult_acc", first,
+ integer_one_node);
}
for (; tailcalls; tailcalls = next)
@@ -998,7 +959,7 @@ tree_optimize_tail_calls_1 (bool opt_tailcalls)
stmt = last_stmt (e->src);
if (stmt
- && TREE_CODE (stmt) == RETURN_EXPR)
+ && gimple_code (stmt) == GIMPLE_RETURN)
adjust_return_value (e->src, m_acc, a_acc);
}
}
diff --git a/gcc/tree-vect-analyze.c b/gcc/tree-vect-analyze.c
index 9f2640d09d6..c9753a0598d 100644
--- a/gcc/tree-vect-analyze.c
+++ b/gcc/tree-vect-analyze.c
@@ -75,10 +75,10 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
basic_block *bbs = LOOP_VINFO_BBS (loop_vinfo);
int nbbs = loop->num_nodes;
- block_stmt_iterator si;
+ gimple_stmt_iterator si;
unsigned int vectorization_factor = 0;
tree scalar_type;
- tree phi;
+ gimple phi;
tree vectype;
unsigned int nunits;
stmt_vec_info stmt_info;
@@ -91,13 +91,14 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
{
basic_block bb = bbs[i];
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
+ for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si))
{
+ phi = gsi_stmt (si);
stmt_info = vinfo_for_stmt (phi);
if (vect_print_dump_info (REPORT_DETAILS))
{
fprintf (vect_dump, "==> examining phi: ");
- print_generic_expr (vect_dump, phi, TDF_SLIM);
+ print_gimple_stmt (vect_dump, phi, 0, TDF_SLIM);
}
gcc_assert (stmt_info);
@@ -142,15 +143,15 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
}
}
- for (si = bsi_start (bb); !bsi_end_p (si); bsi_next (&si))
+ for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si))
{
- tree stmt = bsi_stmt (si);
+ gimple stmt = gsi_stmt (si);
stmt_info = vinfo_for_stmt (stmt);
if (vect_print_dump_info (REPORT_DETAILS))
{
fprintf (vect_dump, "==> examining statement: ");
- print_generic_expr (vect_dump, stmt, TDF_SLIM);
+ print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
gcc_assert (stmt_info);
@@ -164,23 +165,22 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
continue;
}
- if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
+ if (gimple_get_lhs (stmt) == NULL_TREE)
{
if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS))
{
fprintf (vect_dump, "not vectorized: irregular stmt.");
- print_generic_expr (vect_dump, stmt, TDF_SLIM);
+ print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
return false;
}
- if (!GIMPLE_STMT_P (stmt)
- && VECTOR_MODE_P (TYPE_MODE (TREE_TYPE (stmt))))
+ if (VECTOR_MODE_P (TYPE_MODE (gimple_expr_type (stmt))))
{
if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS))
{
fprintf (vect_dump, "not vectorized: vector stmt in loop:");
- print_generic_expr (vect_dump, stmt, TDF_SLIM);
+ print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
return false;
}
@@ -196,7 +196,6 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
}
else
{
- tree operation;
gcc_assert (! STMT_VINFO_DATA_REF (stmt_info)
&& !is_pattern_stmt_p (stmt_info));
@@ -216,16 +215,16 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
cannot rely on invariant motion to always take invariants out
of the loop, and so in the case of promotion we also have to
check the rhs. */
- scalar_type = TREE_TYPE (GIMPLE_STMT_OPERAND (stmt, 0));
+ scalar_type = gimple_expr_type (stmt);
- operation = GIMPLE_STMT_OPERAND (stmt, 1);
- if (CONVERT_EXPR_P (operation)
- || TREE_CODE (operation) == WIDEN_MULT_EXPR
- || TREE_CODE (operation) == FLOAT_EXPR)
+ if (is_gimple_assign (stmt)
+ && (gimple_assign_cast_p (stmt)
+ || gimple_assign_rhs_code (stmt) == WIDEN_MULT_EXPR
+ || gimple_assign_rhs_code (stmt) == FLOAT_EXPR))
{
- tree rhs_type = TREE_TYPE (TREE_OPERAND (operation, 0));
- if (TREE_INT_CST_LOW (TYPE_SIZE_UNIT (rhs_type)) <
- TREE_INT_CST_LOW (TYPE_SIZE_UNIT (scalar_type)))
+ tree rhs_type = TREE_TYPE (gimple_assign_rhs1 (stmt));
+ if (TREE_INT_CST_LOW (TYPE_SIZE_UNIT (rhs_type))
+ < TREE_INT_CST_LOW (TYPE_SIZE_UNIT (scalar_type)))
scalar_type = rhs_type;
}
@@ -315,11 +314,11 @@ vect_analyze_operations (loop_vec_info loop_vinfo)
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
basic_block *bbs = LOOP_VINFO_BBS (loop_vinfo);
int nbbs = loop->num_nodes;
- block_stmt_iterator si;
+ gimple_stmt_iterator si;
unsigned int vectorization_factor = 0;
int i;
bool ok;
- tree phi;
+ gimple phi;
stmt_vec_info stmt_info;
bool need_to_vectorize = false;
int min_profitable_iters;
@@ -337,15 +336,16 @@ vect_analyze_operations (loop_vec_info loop_vinfo)
{
basic_block bb = bbs[i];
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
+ for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si))
{
+ phi = gsi_stmt (si);
ok = true;
stmt_info = vinfo_for_stmt (phi);
if (vect_print_dump_info (REPORT_DETAILS))
{
fprintf (vect_dump, "examining phi: ");
- print_generic_expr (vect_dump, phi, TDF_SLIM);
+ print_gimple_stmt (vect_dump, phi, 0, TDF_SLIM);
}
if (! is_loop_header_bb_p (bb))
@@ -398,22 +398,22 @@ vect_analyze_operations (loop_vec_info loop_vinfo)
{
fprintf (vect_dump,
"not vectorized: relevant phi not supported: ");
- print_generic_expr (vect_dump, phi, TDF_SLIM);
+ print_gimple_stmt (vect_dump, phi, 0, TDF_SLIM);
}
return false;
}
}
- for (si = bsi_start (bb); !bsi_end_p (si); bsi_next (&si))
+ for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si))
{
- tree stmt = bsi_stmt (si);
+ gimple stmt = gsi_stmt (si);
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
enum vect_def_type relevance = STMT_VINFO_RELEVANT (stmt_info);
if (vect_print_dump_info (REPORT_DETAILS))
{
fprintf (vect_dump, "==> examining statement: ");
- print_generic_expr (vect_dump, stmt, TDF_SLIM);
+ print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
gcc_assert (stmt_info);
@@ -454,8 +454,7 @@ vect_analyze_operations (loop_vec_info loop_vinfo)
if (STMT_VINFO_RELEVANT_P (stmt_info))
{
- gcc_assert (GIMPLE_STMT_P (stmt)
- || !VECTOR_MODE_P (TYPE_MODE (TREE_TYPE (stmt))));
+ gcc_assert (!VECTOR_MODE_P (TYPE_MODE (gimple_expr_type (stmt))));
gcc_assert (STMT_VINFO_VECTYPE (stmt_info));
need_to_vectorize = true;
}
@@ -480,7 +479,7 @@ vect_analyze_operations (loop_vec_info loop_vinfo)
{
fprintf (vect_dump, "not vectorized: relevant stmt not ");
fprintf (vect_dump, "supported: ");
- print_generic_expr (vect_dump, stmt, TDF_SLIM);
+ print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
return false;
}
@@ -497,7 +496,7 @@ vect_analyze_operations (loop_vec_info loop_vinfo)
{
fprintf (vect_dump, "not vectorized: live stmt not ");
fprintf (vect_dump, "supported: ");
- print_generic_expr (vect_dump, stmt, TDF_SLIM);
+ print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
return false;
}
@@ -520,7 +519,7 @@ vect_analyze_operations (loop_vec_info loop_vinfo)
{
fprintf (vect_dump, "not vectorized: the size of group "
"of strided accesses is not a power of 2");
- print_generic_expr (vect_dump, stmt, TDF_SLIM);
+ print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
return false;
}
@@ -649,7 +648,7 @@ vect_analyze_operations (loop_vec_info loop_vinfo)
used in STMT for anything other than indexing an array. */
static bool
-exist_non_indexing_operands_for_use_p (tree use, tree stmt)
+exist_non_indexing_operands_for_use_p (tree use, gimple stmt)
{
tree operand;
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
@@ -673,10 +672,12 @@ exist_non_indexing_operands_for_use_p (tree use, tree stmt)
Therefore, all we need to check is if STMT falls into the
first case, and whether var corresponds to USE. */
- if (TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 0)) == SSA_NAME)
+ if (TREE_CODE (gimple_assign_lhs (stmt)) == SSA_NAME)
return false;
- operand = GIMPLE_STMT_OPERAND (stmt, 1);
+ if (!gimple_assign_copy_p (stmt))
+ return false;
+ operand = gimple_assign_rhs1 (stmt);
if (TREE_CODE (operand) != SSA_NAME)
return false;
@@ -698,17 +699,18 @@ exist_non_indexing_operands_for_use_p (tree use, tree stmt)
static void
vect_analyze_scalar_cycles_1 (loop_vec_info loop_vinfo, struct loop *loop)
{
- tree phi;
basic_block bb = loop->header;
tree dumy;
- VEC(tree,heap) *worklist = VEC_alloc (tree, heap, 64);
+ VEC(gimple,heap) *worklist = VEC_alloc (gimple, heap, 64);
+ gimple_stmt_iterator gsi;
if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "=== vect_analyze_scalar_cycles ===");
/* First - identify all inductions. */
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
+ for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
+ gimple phi = gsi_stmt (gsi);
tree access_fn = NULL;
tree def = PHI_RESULT (phi);
stmt_vec_info stmt_vinfo = vinfo_for_stmt (phi);
@@ -716,7 +718,7 @@ vect_analyze_scalar_cycles_1 (loop_vec_info loop_vinfo, struct loop *loop)
if (vect_print_dump_info (REPORT_DETAILS))
{
fprintf (vect_dump, "Analyze phi: ");
- print_generic_expr (vect_dump, phi, TDF_SLIM);
+ print_gimple_stmt (vect_dump, phi, 0, TDF_SLIM);
}
/* Skip virtual phi's. The data dependences that are associated with
@@ -737,7 +739,7 @@ vect_analyze_scalar_cycles_1 (loop_vec_info loop_vinfo, struct loop *loop)
if (!access_fn
|| !vect_is_simple_iv_evolution (loop->num, access_fn, &dumy, &dumy))
{
- VEC_safe_push (tree, heap, worklist, phi);
+ VEC_safe_push (gimple, heap, worklist, phi);
continue;
}
@@ -748,17 +750,17 @@ vect_analyze_scalar_cycles_1 (loop_vec_info loop_vinfo, struct loop *loop)
/* Second - identify all reductions. */
- while (VEC_length (tree, worklist) > 0)
+ while (VEC_length (gimple, worklist) > 0)
{
- tree phi = VEC_pop (tree, worklist);
+ gimple phi = VEC_pop (gimple, worklist);
tree def = PHI_RESULT (phi);
stmt_vec_info stmt_vinfo = vinfo_for_stmt (phi);
- tree reduc_stmt;
+ gimple reduc_stmt;
if (vect_print_dump_info (REPORT_DETAILS))
{
fprintf (vect_dump, "Analyze phi: ");
- print_generic_expr (vect_dump, phi, TDF_SLIM);
+ print_gimple_stmt (vect_dump, phi, 0, TDF_SLIM);
}
gcc_assert (is_gimple_reg (SSA_NAME_VAR (def)));
@@ -778,7 +780,7 @@ vect_analyze_scalar_cycles_1 (loop_vec_info loop_vinfo, struct loop *loop)
fprintf (vect_dump, "Unknown def-use cycle pattern.");
}
- VEC_free (tree, heap, worklist);
+ VEC_free (gimple, heap, worklist);
return;
}
@@ -833,7 +835,8 @@ static void
vect_insert_into_interleaving_chain (struct data_reference *dra,
struct data_reference *drb)
{
- tree prev, next, next_init;
+ gimple prev, next;
+ tree next_init;
stmt_vec_info stmtinfo_a = vinfo_for_stmt (DR_STMT (dra));
stmt_vec_info stmtinfo_b = vinfo_for_stmt (DR_STMT (drb));
@@ -855,7 +858,7 @@ vect_insert_into_interleaving_chain (struct data_reference *dra,
/* We got to the end of the list. Insert here. */
DR_GROUP_NEXT_DR (vinfo_for_stmt (prev)) = DR_STMT (dra);
- DR_GROUP_NEXT_DR (stmtinfo_a) = NULL_TREE;
+ DR_GROUP_NEXT_DR (stmtinfo_a) = NULL;
}
@@ -888,8 +891,10 @@ vect_update_interleaving_chain (struct data_reference *drb,
{
stmt_vec_info stmtinfo_a = vinfo_for_stmt (DR_STMT (dra));
stmt_vec_info stmtinfo_b = vinfo_for_stmt (DR_STMT (drb));
- tree next_init, init_dra_chain, init_drb_chain, first_a, first_b;
- tree node, prev, next, node_init, first_stmt;
+ tree next_init, init_dra_chain, init_drb_chain;
+ gimple first_a, first_b;
+ tree node_init;
+ gimple node, prev, next, first_stmt;
/* 1. New stmts - both DRA and DRB are not a part of any chain. */
if (!DR_GROUP_FIRST_DR (stmtinfo_a) && !DR_GROUP_FIRST_DR (stmtinfo_b))
@@ -912,10 +917,10 @@ vect_update_interleaving_chain (struct data_reference *drb,
/* 3. DRA is a part of a chain and DRB is not. */
if (DR_GROUP_FIRST_DR (stmtinfo_a) && !DR_GROUP_FIRST_DR (stmtinfo_b))
{
- tree old_first_stmt = DR_GROUP_FIRST_DR (stmtinfo_a);
+ gimple old_first_stmt = DR_GROUP_FIRST_DR (stmtinfo_a);
tree init_old = DR_INIT (STMT_VINFO_DATA_REF (vinfo_for_stmt (
old_first_stmt)));
- tree tmp;
+ gimple tmp;
if (tree_int_cst_compare (init_old, DR_INIT (drb)) > 0)
{
@@ -991,7 +996,7 @@ vect_update_interleaving_chain (struct data_reference *drb,
{
/* We got to the end of the list. Insert here. */
DR_GROUP_NEXT_DR (vinfo_for_stmt (prev)) = node;
- DR_GROUP_NEXT_DR (vinfo_for_stmt (node)) = NULL_TREE;
+ DR_GROUP_NEXT_DR (vinfo_for_stmt (node)) = NULL;
prev = node;
}
DR_GROUP_FIRST_DR (vinfo_for_stmt (node)) = first_stmt;
@@ -1122,8 +1127,8 @@ vect_check_interleaving (struct data_reference *dra,
static bool
vect_same_range_drs (data_reference_p dr_i, data_reference_p dr_j)
{
- tree stmt_i = DR_STMT (dr_i);
- tree stmt_j = DR_STMT (dr_j);
+ gimple stmt_i = DR_STMT (dr_i);
+ gimple stmt_j = DR_STMT (dr_j);
if (operand_equal_p (DR_REF (dr_i), DR_REF (dr_j), 0)
|| (DR_GROUP_FIRST_DR (vinfo_for_stmt (stmt_i))
@@ -1351,7 +1356,7 @@ vect_analyze_data_ref_dependences (loop_vec_info loop_vinfo)
static bool
vect_compute_data_ref_alignment (struct data_reference *dr)
{
- tree stmt = DR_STMT (dr);
+ gimple stmt = DR_STMT (dr);
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info);
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
@@ -1570,7 +1575,7 @@ vect_verify_datarefs_alignment (loop_vec_info loop_vinfo)
for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++)
{
- tree stmt = DR_STMT (dr);
+ gimple stmt = DR_STMT (dr);
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
/* For interleaving, only the alignment of the first access matters. */
@@ -1608,7 +1613,7 @@ vect_verify_datarefs_alignment (loop_vec_info loop_vinfo)
static bool
vector_alignment_reachable_p (struct data_reference *dr)
{
- tree stmt = DR_STMT (dr);
+ gimple stmt = DR_STMT (dr);
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
tree vectype = STMT_VINFO_VECTYPE (stmt_info);
@@ -1773,7 +1778,7 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo)
bool do_peeling = false;
bool do_versioning = false;
bool stat;
- tree stmt;
+ gimple stmt;
stmt_vec_info stmt_info;
int vect_versioning_for_alias_required;
@@ -1857,7 +1862,7 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo)
{
int mis;
int npeel = 0;
- tree stmt = DR_STMT (dr0);
+ gimple stmt = DR_STMT (dr0);
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
tree vectype = STMT_VINFO_VECTYPE (stmt_info);
int nelements = TYPE_VECTOR_SUBPARTS (vectype);
@@ -1973,12 +1978,12 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo)
if (!supportable_dr_alignment)
{
- tree stmt;
+ gimple stmt;
int mask;
tree vectype;
if (known_alignment_for_access_p (dr)
- || VEC_length (tree,
+ || VEC_length (gimple,
LOOP_VINFO_MAY_MISALIGN_STMTS (loop_vinfo))
>= (unsigned) PARAM_VALUE (PARAM_VECT_MAX_VERSION_FOR_ALIGNMENT_CHECKS))
{
@@ -2004,29 +2009,29 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo)
gcc_assert (!LOOP_VINFO_PTR_MASK (loop_vinfo)
|| LOOP_VINFO_PTR_MASK (loop_vinfo) == mask);
LOOP_VINFO_PTR_MASK (loop_vinfo) = mask;
- VEC_safe_push (tree, heap,
+ VEC_safe_push (gimple, heap,
LOOP_VINFO_MAY_MISALIGN_STMTS (loop_vinfo),
DR_STMT (dr));
}
}
/* Versioning requires at least one misaligned data reference. */
- if (VEC_length (tree, LOOP_VINFO_MAY_MISALIGN_STMTS (loop_vinfo)) == 0)
+ if (VEC_length (gimple, LOOP_VINFO_MAY_MISALIGN_STMTS (loop_vinfo)) == 0)
do_versioning = false;
else if (!do_versioning)
- VEC_truncate (tree, LOOP_VINFO_MAY_MISALIGN_STMTS (loop_vinfo), 0);
+ VEC_truncate (gimple, LOOP_VINFO_MAY_MISALIGN_STMTS (loop_vinfo), 0);
}
if (do_versioning)
{
- VEC(tree,heap) *may_misalign_stmts
+ VEC(gimple,heap) *may_misalign_stmts
= LOOP_VINFO_MAY_MISALIGN_STMTS (loop_vinfo);
- tree stmt;
+ gimple stmt;
/* It can now be assumed that the data references in the statements
in LOOP_VINFO_MAY_MISALIGN_STMTS will be aligned in the version
of the loop being vectorized. */
- for (i = 0; VEC_iterate (tree, may_misalign_stmts, i, stmt); i++)
+ for (i = 0; VEC_iterate (gimple, may_misalign_stmts, i, stmt); i++)
{
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
dr = STMT_VINFO_DATA_REF (stmt_info);
@@ -2088,7 +2093,7 @@ vect_analyze_group_access (struct data_reference *dr)
tree step = DR_STEP (dr);
tree scalar_type = TREE_TYPE (DR_REF (dr));
HOST_WIDE_INT type_size = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (scalar_type));
- tree stmt = DR_STMT (dr);
+ gimple stmt = DR_STMT (dr);
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info);
HOST_WIDE_INT dr_step = TREE_INT_CST_LOW (step);
@@ -2132,12 +2137,12 @@ vect_analyze_group_access (struct data_reference *dr)
if (DR_GROUP_FIRST_DR (vinfo_for_stmt (stmt)) == stmt)
{
/* First stmt in the interleaving chain. Check the chain. */
- tree next = DR_GROUP_NEXT_DR (vinfo_for_stmt (stmt));
+ gimple next = DR_GROUP_NEXT_DR (vinfo_for_stmt (stmt));
struct data_reference *data_ref = dr;
unsigned int count = 1;
tree next_step;
tree prev_init = DR_INIT (data_ref);
- tree prev = stmt;
+ gimple prev = stmt;
HOST_WIDE_INT diff, count_in_bytes;
while (next)
@@ -2280,7 +2285,7 @@ vect_analyze_group_access (struct data_reference *dr)
/* SLP: create an SLP data structure for every interleaving group of
stores for further analysis in vect_analyse_slp. */
if (!DR_IS_READ (dr) && !slp_impossible)
- VEC_safe_push (tree, heap, LOOP_VINFO_STRIDED_STORES (loop_vinfo), stmt);
+ VEC_safe_push (gimple, heap, LOOP_VINFO_STRIDED_STORES (loop_vinfo), stmt);
}
return true;
@@ -2296,7 +2301,7 @@ vect_analyze_data_ref_access (struct data_reference *dr)
{
tree step = DR_STEP (dr);
tree scalar_type = TREE_TYPE (DR_REF (dr));
- tree stmt = DR_STMT (dr);
+ gimple stmt = DR_STMT (dr);
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info);
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
@@ -2317,7 +2322,7 @@ vect_analyze_data_ref_access (struct data_reference *dr)
{
/* Interleaved accesses are not yet supported within outer-loop
vectorization for references in the inner-loop. */
- DR_GROUP_FIRST_DR (vinfo_for_stmt (stmt)) = NULL_TREE;
+ DR_GROUP_FIRST_DR (vinfo_for_stmt (stmt)) = NULL;
/* For the rest of the analysis we use the outer-loop step. */
step = STMT_VINFO_DR_STEP (stmt_info);
@@ -2338,7 +2343,7 @@ vect_analyze_data_ref_access (struct data_reference *dr)
if (!tree_int_cst_compare (step, TYPE_SIZE_UNIT (scalar_type)))
{
/* Mark that it is not interleaving. */
- DR_GROUP_FIRST_DR (vinfo_for_stmt (stmt)) = NULL_TREE;
+ DR_GROUP_FIRST_DR (vinfo_for_stmt (stmt)) = NULL;
return true;
}
@@ -2470,23 +2475,23 @@ vect_free_slp_tree (slp_tree node)
if (SLP_TREE_RIGHT (node))
vect_free_slp_tree (SLP_TREE_RIGHT (node));
- VEC_free (tree, heap, SLP_TREE_SCALAR_STMTS (node));
+ VEC_free (gimple, heap, SLP_TREE_SCALAR_STMTS (node));
if (SLP_TREE_VEC_STMTS (node))
- VEC_free (tree, heap, SLP_TREE_VEC_STMTS (node));
+ VEC_free (gimple, heap, SLP_TREE_VEC_STMTS (node));
free (node);
}
-/* Get the defs for the RHS (collect them in DEF_STMTS0/1), check that they are
- of a legal type and that they match the defs of the first stmt of the SLP
- group (stored in FIRST_STMT_...). */
+/* Get the defs for the rhs of STMT (collect them in DEF_STMTS0/1), check that
+ they are of a legal type and that they match the defs of the first stmt of
+ the SLP group (stored in FIRST_STMT_...). */
static bool
vect_get_and_check_slp_defs (loop_vec_info loop_vinfo, slp_tree slp_node,
- tree rhs, VEC (tree, heap) **def_stmts0,
- VEC (tree, heap) **def_stmts1,
+ gimple stmt, VEC (gimple, heap) **def_stmts0,
+ VEC (gimple, heap) **def_stmts1,
enum vect_def_type *first_stmt_dt0,
enum vect_def_type *first_stmt_dt1,
tree *first_stmt_def0_type,
@@ -2495,25 +2500,20 @@ vect_get_and_check_slp_defs (loop_vec_info loop_vinfo, slp_tree slp_node,
int ncopies_for_cost)
{
tree oprnd;
- enum operation_type op_type = TREE_OPERAND_LENGTH (rhs);
- unsigned int i, number_of_oprnds = op_type;
- tree def, def_stmt;
+ unsigned int i, number_of_oprnds;
+ tree def;
+ gimple def_stmt;
enum vect_def_type dt[2] = {vect_unknown_def_type, vect_unknown_def_type};
stmt_vec_info stmt_info =
- vinfo_for_stmt (VEC_index (tree, SLP_TREE_SCALAR_STMTS (slp_node), 0));
+ vinfo_for_stmt (VEC_index (gimple, SLP_TREE_SCALAR_STMTS (slp_node), 0));
+ enum gimple_rhs_class rhs_class;
- /* Store. */
- if (!op_type)
- number_of_oprnds = 1;
- else
- gcc_assert (op_type == unary_op || op_type == binary_op);
+ rhs_class = get_gimple_rhs_class (gimple_assign_rhs_code (stmt));
+ number_of_oprnds = gimple_num_ops (stmt) - 1; /* RHS only */
for (i = 0; i < number_of_oprnds; i++)
{
- if (op_type)
- oprnd = TREE_OPERAND (rhs, i);
- else
- oprnd = rhs;
+ oprnd = gimple_op (stmt, i + 1);
if (!vect_is_simple_use (oprnd, loop_vinfo, &def_stmt, &def, &dt[i])
|| (!def_stmt && dt[i] != vect_constant_def))
@@ -2537,7 +2537,7 @@ vect_get_and_check_slp_defs (loop_vec_info loop_vinfo, slp_tree slp_node,
*first_stmt_const_oprnd = oprnd;
/* Analyze costs (for the first stmt of the group only). */
- if (op_type)
+ if (rhs_class != GIMPLE_SINGLE_RHS)
/* Not memory operation (we don't call this functions for loads). */
vect_model_simple_cost (stmt_info, ncopies_for_cost, dt, slp_node);
else
@@ -2600,9 +2600,9 @@ vect_get_and_check_slp_defs (loop_vec_info loop_vinfo, slp_tree slp_node,
case vect_loop_def:
if (i == 0)
- VEC_safe_push (tree, heap, *def_stmts0, def_stmt);
+ VEC_safe_push (gimple, heap, *def_stmts0, def_stmt);
else
- VEC_safe_push (tree, heap, *def_stmts1, def_stmt);
+ VEC_safe_push (gimple, heap, *def_stmts1, def_stmt);
break;
default:
@@ -2634,15 +2634,16 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, slp_tree *node,
int *inside_cost, int *outside_cost,
int ncopies_for_cost)
{
- VEC (tree, heap) *def_stmts0 = VEC_alloc (tree, heap, group_size);
- VEC (tree, heap) *def_stmts1 = VEC_alloc (tree, heap, group_size);
+ VEC (gimple, heap) *def_stmts0 = VEC_alloc (gimple, heap, group_size);
+ VEC (gimple, heap) *def_stmts1 = VEC_alloc (gimple, heap, group_size);
unsigned int i;
- VEC (tree, heap) *stmts = SLP_TREE_SCALAR_STMTS (*node);
- tree stmt = VEC_index (tree, stmts, 0);
+ VEC (gimple, heap) *stmts = SLP_TREE_SCALAR_STMTS (*node);
+ gimple stmt = VEC_index (gimple, stmts, 0);
enum vect_def_type first_stmt_dt0 = 0, first_stmt_dt1 = 0;
- enum tree_code first_stmt_code = 0;
+ enum tree_code first_stmt_code = 0, rhs_code;
tree first_stmt_def1_type = NULL_TREE, first_stmt_def0_type = NULL_TREE;
- tree lhs, rhs, prev_stmt = NULL_TREE;
+ tree lhs;
+ gimple prev_stmt = NULL;
bool stop_recursion = false, need_same_oprnds = false;
tree vectype, scalar_type, first_op1 = NULL_TREE;
unsigned int vectorization_factor = 0, ncopies;
@@ -2654,26 +2655,28 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, slp_tree *node,
struct data_reference *first_dr;
/* For every stmt in NODE find its def stmt/s. */
- for (i = 0; VEC_iterate (tree, stmts, i, stmt); i++)
+ for (i = 0; VEC_iterate (gimple, stmts, i, stmt); i++)
{
if (vect_print_dump_info (REPORT_SLP))
{
fprintf (vect_dump, "Build SLP for ");
- print_generic_expr (vect_dump, stmt, TDF_SLIM);
+ print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
- if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
+ lhs = gimple_get_lhs (stmt);
+ if (lhs == NULL_TREE)
{
if (vect_print_dump_info (REPORT_SLP))
{
- fprintf (vect_dump, "Build SLP failed: not MODIFY_STMT ");
- print_generic_expr (vect_dump, stmt, TDF_SLIM);
+ fprintf (vect_dump,
+ "Build SLP failed: not GIMPLE_ASSIGN nor GIMPLE_CALL");
+ print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
return false;
}
- scalar_type = TREE_TYPE (GIMPLE_STMT_OPERAND (stmt, 0));
+ scalar_type = TREE_TYPE (lhs);
vectype = get_vectype_for_scalar_type (scalar_type);
if (!vectype)
{
@@ -2698,24 +2701,26 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, slp_tree *node,
return false;
}
- lhs = GIMPLE_STMT_OPERAND (stmt, 0);
- rhs = GIMPLE_STMT_OPERAND (stmt, 1);
+ if (is_gimple_call (stmt))
+ rhs_code = CALL_EXPR;
+ else
+ rhs_code = gimple_assign_rhs_code (stmt);
/* Check the operation. */
if (i == 0)
{
- first_stmt_code = TREE_CODE (rhs);
+ first_stmt_code = rhs_code;
/* Shift arguments should be equal in all the packed stmts for a
vector shift with scalar shift operand. */
- if (TREE_CODE (rhs) == LSHIFT_EXPR || TREE_CODE (rhs) == RSHIFT_EXPR
- || TREE_CODE (rhs) == LROTATE_EXPR
- || TREE_CODE (rhs) == RROTATE_EXPR)
+ if (rhs_code == LSHIFT_EXPR || rhs_code == RSHIFT_EXPR
+ || rhs_code == LROTATE_EXPR
+ || rhs_code == RROTATE_EXPR)
{
vec_mode = TYPE_MODE (vectype);
/* First see if we have a vector/vector shift. */
- optab = optab_for_tree_code (TREE_CODE (rhs), vectype,
+ optab = optab_for_tree_code (rhs_code, vectype,
optab_vector);
if (!optab
@@ -2723,7 +2728,7 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, slp_tree *node,
== CODE_FOR_nothing))
{
/* No vector/vector shift, try for a vector/scalar shift. */
- optab = optab_for_tree_code (TREE_CODE (rhs), vectype,
+ optab = optab_for_tree_code (rhs_code, vectype,
optab_scalar);
if (!optab)
@@ -2744,33 +2749,37 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, slp_tree *node,
if (!VECTOR_MODE_P (optab_op2_mode))
{
need_same_oprnds = true;
- first_op1 = TREE_OPERAND (rhs, 1);
+ first_op1 = gimple_assign_rhs2 (stmt);
}
}
}
}
else
{
- if (first_stmt_code != TREE_CODE (rhs))
+ if (first_stmt_code != rhs_code
+ && (first_stmt_code != IMAGPART_EXPR
+ || rhs_code != REALPART_EXPR)
+ && (first_stmt_code != REALPART_EXPR
+ || rhs_code != IMAGPART_EXPR))
{
if (vect_print_dump_info (REPORT_SLP))
{
fprintf (vect_dump,
"Build SLP failed: different operation in stmt ");
- print_generic_expr (vect_dump, stmt, TDF_SLIM);
+ print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
return false;
}
if (need_same_oprnds
- && !operand_equal_p (first_op1, TREE_OPERAND (rhs, 1), 0))
+ && !operand_equal_p (first_op1, gimple_assign_rhs2 (stmt), 0))
{
if (vect_print_dump_info (REPORT_SLP))
{
fprintf (vect_dump,
"Build SLP failed: different shift arguments in ");
- print_generic_expr (vect_dump, stmt, TDF_SLIM);
+ print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
return false;
@@ -2783,7 +2792,7 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, slp_tree *node,
if (REFERENCE_CLASS_P (lhs))
{
/* Store. */
- if (!vect_get_and_check_slp_defs (loop_vinfo, *node, rhs,
+ if (!vect_get_and_check_slp_defs (loop_vinfo, *node, stmt,
&def_stmts0, &def_stmts1,
&first_stmt_dt0,
&first_stmt_dt1,
@@ -2810,7 +2819,7 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, slp_tree *node,
{
fprintf (vect_dump, "Build SLP failed: strided "
" loads need permutation or have gaps ");
- print_generic_expr (vect_dump, stmt, TDF_SLIM);
+ print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
return false;
@@ -2824,7 +2833,7 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, slp_tree *node,
{
fprintf (vect_dump, "Build SLP failed: unsupported "
" unaligned load ");
- print_generic_expr (vect_dump, stmt, TDF_SLIM);
+ print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
return false;
@@ -2847,7 +2856,7 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, slp_tree *node,
{
fprintf (vect_dump, "Build SLP failed: strided "
" loads need permutation or have gaps ");
- print_generic_expr (vect_dump, stmt, TDF_SLIM);
+ print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
return false;
}
@@ -2862,13 +2871,13 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, slp_tree *node,
} /* Strided access. */
else
{
- if (REFERENCE_CLASS_P (rhs))
+ if (TREE_CODE_CLASS (rhs_code) == tcc_reference)
{
/* Not strided load. */
if (vect_print_dump_info (REPORT_SLP))
{
fprintf (vect_dump, "Build SLP failed: not strided load ");
- print_generic_expr (vect_dump, stmt, TDF_SLIM);
+ print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
/* FORNOW: Not strided loads are not supported. */
@@ -2876,22 +2885,23 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, slp_tree *node,
}
/* Not memory operation. */
- if (!BINARY_CLASS_P (rhs) && !UNARY_CLASS_P (rhs))
+ if (TREE_CODE_CLASS (rhs_code) != tcc_binary
+ && TREE_CODE_CLASS (rhs_code) != tcc_unary)
{
if (vect_print_dump_info (REPORT_SLP))
{
fprintf (vect_dump, "Build SLP failed: operation");
fprintf (vect_dump, " unsupported ");
- print_generic_expr (vect_dump, stmt, TDF_SLIM);
+ print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
return false;
}
/* Find the def-stmts. */
- if (!vect_get_and_check_slp_defs (loop_vinfo, *node, rhs, &def_stmts0,
- &def_stmts1, &first_stmt_dt0,
- &first_stmt_dt1,
+ if (!vect_get_and_check_slp_defs (loop_vinfo, *node, stmt,
+ &def_stmts0, &def_stmts1,
+ &first_stmt_dt0, &first_stmt_dt1,
&first_stmt_def0_type,
&first_stmt_def1_type,
&first_stmt_const_oprnd,
@@ -2951,16 +2961,16 @@ static void
vect_print_slp_tree (slp_tree node)
{
int i;
- tree stmt;
+ gimple stmt;
if (!node)
return;
fprintf (vect_dump, "node ");
- for (i = 0; VEC_iterate (tree, SLP_TREE_SCALAR_STMTS (node), i, stmt); i++)
+ for (i = 0; VEC_iterate (gimple, SLP_TREE_SCALAR_STMTS (node), i, stmt); i++)
{
fprintf (vect_dump, "\n\tstmt %d ", i);
- print_generic_expr (vect_dump, stmt, TDF_SLIM);
+ print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
fprintf (vect_dump, "\n");
@@ -2978,12 +2988,12 @@ static void
vect_mark_slp_stmts (slp_tree node, enum slp_vect_type mark, int j)
{
int i;
- tree stmt;
+ gimple stmt;
if (!node)
return;
- for (i = 0; VEC_iterate (tree, SLP_TREE_SCALAR_STMTS (node), i, stmt); i++)
+ for (i = 0; VEC_iterate (gimple, SLP_TREE_SCALAR_STMTS (node), i, stmt); i++)
if (j < 0 || i == j)
STMT_SLP_TYPE (vinfo_for_stmt (stmt)) = mark;
@@ -2997,13 +3007,14 @@ vect_mark_slp_stmts (slp_tree node, enum slp_vect_type mark, int j)
Return FALSE if it's impossible to SLP any stmt in the loop. */
static bool
-vect_analyze_slp_instance (loop_vec_info loop_vinfo, tree stmt)
+vect_analyze_slp_instance (loop_vec_info loop_vinfo, gimple stmt)
{
slp_instance new_instance;
slp_tree node = XNEW (struct _slp_tree);
unsigned int group_size = DR_GROUP_SIZE (vinfo_for_stmt (stmt));
unsigned int unrolling_factor = 1, nunits;
- tree vectype, scalar_type, next;
+ tree vectype, scalar_type;
+ gimple next;
unsigned int vectorization_factor = 0, ncopies;
bool slp_impossible = false;
int inside_cost = 0, outside_cost = 0, ncopies_for_cost;
@@ -3033,12 +3044,12 @@ vect_analyze_slp_instance (loop_vec_info loop_vinfo, tree stmt)
}
/* Create a node (a root of the SLP tree) for the packed strided stores. */
- SLP_TREE_SCALAR_STMTS (node) = VEC_alloc (tree, heap, group_size);
+ SLP_TREE_SCALAR_STMTS (node) = VEC_alloc (gimple, heap, group_size);
next = stmt;
/* Collect the stores and store them in SLP_TREE_SCALAR_STMTS. */
while (next)
{
- VEC_safe_push (tree, heap, SLP_TREE_SCALAR_STMTS (node), next);
+ VEC_safe_push (gimple, heap, SLP_TREE_SCALAR_STMTS (node), next);
next = DR_GROUP_NEXT_DR (vinfo_for_stmt (next));
}
@@ -3096,13 +3107,13 @@ static bool
vect_analyze_slp (loop_vec_info loop_vinfo)
{
unsigned int i;
- VEC (tree, heap) *strided_stores = LOOP_VINFO_STRIDED_STORES (loop_vinfo);
- tree store;
+ VEC (gimple, heap) *strided_stores = LOOP_VINFO_STRIDED_STORES (loop_vinfo);
+ gimple store;
if (vect_print_dump_info (REPORT_SLP))
fprintf (vect_dump, "=== vect_analyze_slp ===");
- for (i = 0; VEC_iterate (tree, strided_stores, i, store); i++)
+ for (i = 0; VEC_iterate (gimple, strided_stores, i, store); i++)
if (!vect_analyze_slp_instance (loop_vinfo, store))
{
/* SLP failed. No instance can be SLPed in the loop. */
@@ -3158,17 +3169,17 @@ static void
vect_detect_hybrid_slp_stmts (slp_tree node)
{
int i;
- tree stmt;
+ gimple stmt;
imm_use_iterator imm_iter;
- tree use_stmt;
+ gimple use_stmt;
if (!node)
return;
- for (i = 0; VEC_iterate (tree, SLP_TREE_SCALAR_STMTS (node), i, stmt); i++)
+ for (i = 0; VEC_iterate (gimple, SLP_TREE_SCALAR_STMTS (node), i, stmt); i++)
if (PURE_SLP_STMT (vinfo_for_stmt (stmt))
- && TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 0)) == SSA_NAME)
- FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter, GIMPLE_STMT_OPERAND (stmt, 0))
+ && TREE_CODE (gimple_op (stmt, 0)) == SSA_NAME)
+ FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter, gimple_op (stmt, 0))
if (vinfo_for_stmt (use_stmt)
&& !STMT_SLP_TYPE (vinfo_for_stmt (use_stmt)))
vect_mark_slp_stmts (node, hybrid, i);
@@ -3231,7 +3242,7 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo)
for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++)
{
- tree stmt;
+ gimple stmt;
stmt_vec_info stmt_info;
basic_block bb;
tree base, offset, init;
@@ -3253,7 +3264,7 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo)
if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS))
{
fprintf (vect_dump, "not vectorized: data ref analysis failed ");
- print_generic_expr (vect_dump, stmt, TDF_SLIM);
+ print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
return false;
}
@@ -3281,7 +3292,7 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo)
init = unshare_expr (DR_INIT (dr));
/* Update DR field in stmt_vec_info struct. */
- bb = bb_for_stmt (stmt);
+ bb = gimple_bb (stmt);
/* If the dataref is in an inner-loop of the loop that is considered for
for vectorization, we also want to analyze the access relative to
@@ -3392,7 +3403,7 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo)
{
fprintf (vect_dump,
"not vectorized: more than one data ref in stmt: ");
- print_generic_expr (vect_dump, stmt, TDF_SLIM);
+ print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
return false;
}
@@ -3408,7 +3419,7 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo)
{
fprintf (vect_dump,
"not vectorized: no vectype for stmt: ");
- print_generic_expr (vect_dump, stmt, TDF_SLIM);
+ print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
fprintf (vect_dump, " scalar_type: ");
print_generic_expr (vect_dump, scalar_type, TDF_DETAILS);
}
@@ -3427,7 +3438,7 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo)
Mark STMT as "relevant for vectorization" and add it to WORKLIST. */
static void
-vect_mark_relevant (VEC(tree,heap) **worklist, tree stmt,
+vect_mark_relevant (VEC(gimple,heap) **worklist, gimple stmt,
enum vect_relevant relevant, bool live_p)
{
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
@@ -3439,7 +3450,7 @@ vect_mark_relevant (VEC(tree,heap) **worklist, tree stmt,
if (STMT_VINFO_IN_PATTERN_P (stmt_info))
{
- tree pattern_stmt;
+ gimple pattern_stmt;
/* This is the last stmt in a sequence that was detected as a
pattern that can potentially be vectorized. Don't mark the stmt
@@ -3469,7 +3480,7 @@ vect_mark_relevant (VEC(tree,heap) **worklist, tree stmt,
return;
}
- VEC_safe_push (tree, heap, *worklist, stmt);
+ VEC_safe_push (gimple, heap, *worklist, stmt);
}
@@ -3486,7 +3497,7 @@ vect_mark_relevant (VEC(tree,heap) **worklist, tree stmt,
CHECKME: what other side effects would the vectorizer allow? */
static bool
-vect_stmt_relevant_p (tree stmt, loop_vec_info loop_vinfo,
+vect_stmt_relevant_p (gimple stmt, loop_vec_info loop_vinfo,
enum vect_relevant *relevant, bool *live_p)
{
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
@@ -3504,7 +3515,7 @@ vect_stmt_relevant_p (tree stmt, loop_vec_info loop_vinfo,
*relevant = vect_used_in_loop;
/* changing memory. */
- if (TREE_CODE (stmt) != PHI_NODE)
+ if (gimple_code (stmt) != GIMPLE_PHI)
if (!ZERO_SSA_OPERANDS (stmt, SSA_OP_VIRTUAL_DEFS))
{
if (vect_print_dump_info (REPORT_DETAILS))
@@ -3517,7 +3528,7 @@ vect_stmt_relevant_p (tree stmt, loop_vec_info loop_vinfo,
{
FOR_EACH_IMM_USE_FAST (use_p, imm_iter, DEF_FROM_PTR (def_p))
{
- basic_block bb = bb_for_stmt (USE_STMT (use_p));
+ basic_block bb = gimple_bb (USE_STMT (use_p));
if (!flow_bb_inside_loop_p (loop, bb))
{
if (vect_print_dump_info (REPORT_DETAILS))
@@ -3525,7 +3536,7 @@ vect_stmt_relevant_p (tree stmt, loop_vec_info loop_vinfo,
/* We expect all such uses to be in the loop exit phis
(because of loop closed form) */
- gcc_assert (TREE_CODE (USE_STMT (use_p)) == PHI_NODE);
+ gcc_assert (gimple_code (USE_STMT (use_p)) == GIMPLE_PHI);
gcc_assert (bb == single_exit (loop)->dest);
*live_p = true;
@@ -3563,14 +3574,15 @@ vect_stmt_relevant_p (tree stmt, loop_vec_info loop_vinfo,
Return true if everything is as expected. Return false otherwise. */
static bool
-process_use (tree stmt, tree use, loop_vec_info loop_vinfo, bool live_p,
- enum vect_relevant relevant, VEC(tree,heap) **worklist)
+process_use (gimple stmt, tree use, loop_vec_info loop_vinfo, bool live_p,
+ enum vect_relevant relevant, VEC(gimple,heap) **worklist)
{
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
stmt_vec_info stmt_vinfo = vinfo_for_stmt (stmt);
stmt_vec_info dstmt_vinfo;
basic_block bb, def_bb;
- tree def, def_stmt;
+ tree def;
+ gimple def_stmt;
enum vect_def_type dt;
/* case 1: we are only interested in uses that need to be vectorized. Uses
@@ -3585,10 +3597,10 @@ process_use (tree stmt, tree use, loop_vec_info loop_vinfo, bool live_p,
return false;
}
- if (!def_stmt || IS_EMPTY_STMT (def_stmt))
+ if (!def_stmt || gimple_nop_p (def_stmt))
return true;
- def_bb = bb_for_stmt (def_stmt);
+ def_bb = gimple_bb (def_stmt);
if (!flow_bb_inside_loop_p (loop, def_bb))
{
if (vect_print_dump_info (REPORT_DETAILS))
@@ -3602,10 +3614,10 @@ process_use (tree stmt, tree use, loop_vec_info loop_vinfo, bool live_p,
as there should be no other uses for DEF_STMT in the loop. So we just
check that everything is as expected, and we are done. */
dstmt_vinfo = vinfo_for_stmt (def_stmt);
- bb = bb_for_stmt (stmt);
- if (TREE_CODE (stmt) == PHI_NODE
+ bb = gimple_bb (stmt);
+ if (gimple_code (stmt) == GIMPLE_PHI
&& STMT_VINFO_DEF_TYPE (stmt_vinfo) == vect_reduction_def
- && TREE_CODE (def_stmt) != PHI_NODE
+ && gimple_code (def_stmt) != GIMPLE_PHI
&& STMT_VINFO_DEF_TYPE (dstmt_vinfo) == vect_reduction_def
&& bb->loop_father == def_bb->loop_father)
{
@@ -3710,47 +3722,47 @@ process_use (tree stmt, tree use, loop_vec_info loop_vinfo, bool live_p,
static bool
vect_mark_stmts_to_be_vectorized (loop_vec_info loop_vinfo)
{
- VEC(tree,heap) *worklist;
+ VEC(gimple,heap) *worklist;
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
basic_block *bbs = LOOP_VINFO_BBS (loop_vinfo);
unsigned int nbbs = loop->num_nodes;
- block_stmt_iterator si;
- tree stmt;
- stmt_ann_t ann;
+ gimple_stmt_iterator si;
+ gimple stmt;
unsigned int i;
stmt_vec_info stmt_vinfo;
basic_block bb;
- tree phi;
+ gimple phi;
bool live_p;
enum vect_relevant relevant;
if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "=== vect_mark_stmts_to_be_vectorized ===");
- worklist = VEC_alloc (tree, heap, 64);
+ worklist = VEC_alloc (gimple, heap, 64);
/* 1. Init worklist. */
for (i = 0; i < nbbs; i++)
{
bb = bbs[i];
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
+ for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si))
{
+ phi = gsi_stmt (si);
if (vect_print_dump_info (REPORT_DETAILS))
{
fprintf (vect_dump, "init: phi relevant? ");
- print_generic_expr (vect_dump, phi, TDF_SLIM);
+ print_gimple_stmt (vect_dump, phi, 0, TDF_SLIM);
}
if (vect_stmt_relevant_p (phi, loop_vinfo, &relevant, &live_p))
vect_mark_relevant (&worklist, phi, relevant, live_p);
}
- for (si = bsi_start (bb); !bsi_end_p (si); bsi_next (&si))
+ for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si))
{
- stmt = bsi_stmt (si);
+ stmt = gsi_stmt (si);
if (vect_print_dump_info (REPORT_DETAILS))
{
fprintf (vect_dump, "init: stmt relevant? ");
- print_generic_expr (vect_dump, stmt, TDF_SLIM);
+ print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
if (vect_stmt_relevant_p (stmt, loop_vinfo, &relevant, &live_p))
@@ -3759,22 +3771,21 @@ vect_mark_stmts_to_be_vectorized (loop_vec_info loop_vinfo)
}
/* 2. Process_worklist */
- while (VEC_length (tree, worklist) > 0)
+ while (VEC_length (gimple, worklist) > 0)
{
use_operand_p use_p;
ssa_op_iter iter;
- stmt = VEC_pop (tree, worklist);
+ stmt = VEC_pop (gimple, worklist);
if (vect_print_dump_info (REPORT_DETAILS))
{
fprintf (vect_dump, "worklist: examine stmt: ");
- print_generic_expr (vect_dump, stmt, TDF_SLIM);
+ print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
/* Examine the USEs of STMT. For each USE, mark the stmt that defines it
(DEF_STMT) as relevant/irrelevant and live/dead according to the
liveness and relevance properties of STMT. */
- ann = stmt_ann (stmt);
stmt_vinfo = vinfo_for_stmt (stmt);
relevant = STMT_VINFO_RELEVANT (stmt_vinfo);
live_p = STMT_VINFO_LIVE_P (stmt_vinfo);
@@ -3812,25 +3823,25 @@ vect_mark_stmts_to_be_vectorized (loop_vec_info loop_vinfo)
switch (tmp_relevant)
{
case vect_unused_in_loop:
- gcc_assert (TREE_CODE (stmt) != PHI_NODE);
+ gcc_assert (gimple_code (stmt) != GIMPLE_PHI);
relevant = vect_used_by_reduction;
break;
case vect_used_in_outer_by_reduction:
case vect_used_in_outer:
- gcc_assert (TREE_CODE (stmt) != WIDEN_SUM_EXPR
- && TREE_CODE (stmt) != DOT_PROD_EXPR);
+ gcc_assert (gimple_code (stmt) != WIDEN_SUM_EXPR
+ && gimple_code (stmt) != DOT_PROD_EXPR);
break;
case vect_used_by_reduction:
- if (TREE_CODE (stmt) == PHI_NODE)
+ if (gimple_code (stmt) == GIMPLE_PHI)
break;
/* fall through */
case vect_used_in_loop:
default:
if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "unsupported use of reduction.");
- VEC_free (tree, heap, worklist);
+ VEC_free (gimple, heap, worklist);
return false;
}
live_p = false;
@@ -3841,13 +3852,13 @@ vect_mark_stmts_to_be_vectorized (loop_vec_info loop_vinfo)
tree op = USE_FROM_PTR (use_p);
if (!process_use (stmt, op, loop_vinfo, live_p, relevant, &worklist))
{
- VEC_free (tree, heap, worklist);
+ VEC_free (gimple, heap, worklist);
return false;
}
}
} /* while worklist */
- VEC_free (tree, heap, worklist);
+ VEC_free (gimple, heap, worklist);
return true;
}
@@ -3866,22 +3877,24 @@ vect_can_advance_ivs_p (loop_vec_info loop_vinfo)
{
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
basic_block bb = loop->header;
- tree phi;
+ gimple phi;
+ gimple_stmt_iterator gsi;
/* Analyze phi functions of the loop header. */
if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "vect_can_advance_ivs_p:");
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
+ for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
tree access_fn = NULL;
tree evolution_part;
+ phi = gsi_stmt (gsi);
if (vect_print_dump_info (REPORT_DETAILS))
{
fprintf (vect_dump, "Analyze phi: ");
- print_generic_expr (vect_dump, phi, TDF_SLIM);
+ print_gimple_stmt (vect_dump, phi, 0, TDF_SLIM);
}
/* Skip virtual phi's. The data dependences that are associated with
@@ -3948,7 +3961,7 @@ vect_can_advance_ivs_p (loop_vec_info loop_vinfo)
can be constructed, place it in NUMBER_OF_ITERATIONS.
Return the loop exit condition. */
-static tree
+static gimple
vect_get_loop_niters (struct loop *loop, tree *number_of_iterations)
{
tree niters;
@@ -4016,7 +4029,7 @@ loop_vec_info
vect_analyze_loop_form (struct loop *loop)
{
loop_vec_info loop_vinfo;
- tree loop_cond;
+ gimple loop_cond;
tree number_of_iterations = NULL;
loop_vec_info inner_loop_vinfo = NULL;
diff --git a/gcc/tree-vect-generic.c b/gcc/tree-vect-generic.c
index 8313e54bdbc..9919389dfc3 100644
--- a/gcc/tree-vect-generic.c
+++ b/gcc/tree-vect-generic.c
@@ -30,7 +30,7 @@ along with GCC; see the file COPYING3. If not see
#include "machmode.h"
#include "langhooks.h"
#include "tree-flow.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "tree-iterator.h"
#include "tree-pass.h"
#include "flags.h"
@@ -96,35 +96,35 @@ build_word_mode_vector_type (int nunits)
return vector_last_type;
}
-typedef tree (*elem_op_func) (block_stmt_iterator *,
+typedef tree (*elem_op_func) (gimple_stmt_iterator *,
tree, tree, tree, tree, tree, enum tree_code);
static inline tree
-tree_vec_extract (block_stmt_iterator *bsi, tree type,
+tree_vec_extract (gimple_stmt_iterator *gsi, tree type,
tree t, tree bitsize, tree bitpos)
{
if (bitpos)
- return gimplify_build3 (bsi, BIT_FIELD_REF, type, t, bitsize, bitpos);
+ return gimplify_build3 (gsi, BIT_FIELD_REF, type, t, bitsize, bitpos);
else
- return gimplify_build1 (bsi, VIEW_CONVERT_EXPR, type, t);
+ return gimplify_build1 (gsi, VIEW_CONVERT_EXPR, type, t);
}
static tree
-do_unop (block_stmt_iterator *bsi, tree inner_type, tree a,
+do_unop (gimple_stmt_iterator *gsi, tree inner_type, tree a,
tree b ATTRIBUTE_UNUSED, tree bitpos, tree bitsize,
enum tree_code code)
{
- a = tree_vec_extract (bsi, inner_type, a, bitsize, bitpos);
- return gimplify_build1 (bsi, code, inner_type, a);
+ a = tree_vec_extract (gsi, inner_type, a, bitsize, bitpos);
+ return gimplify_build1 (gsi, code, inner_type, a);
}
static tree
-do_binop (block_stmt_iterator *bsi, tree inner_type, tree a, tree b,
+do_binop (gimple_stmt_iterator *gsi, tree inner_type, tree a, tree b,
tree bitpos, tree bitsize, enum tree_code code)
{
- a = tree_vec_extract (bsi, inner_type, a, bitsize, bitpos);
- b = tree_vec_extract (bsi, inner_type, b, bitsize, bitpos);
- return gimplify_build2 (bsi, code, inner_type, a, b);
+ a = tree_vec_extract (gsi, inner_type, a, bitsize, bitpos);
+ b = tree_vec_extract (gsi, inner_type, b, bitsize, bitpos);
+ return gimplify_build2 (gsi, code, inner_type, a, b);
}
/* Expand vector addition to scalars. This does bit twiddling
@@ -141,7 +141,7 @@ do_binop (block_stmt_iterator *bsi, tree inner_type, tree a, tree b,
This optimization should be done only if 4 vector items or more
fit into a word. */
static tree
-do_plus_minus (block_stmt_iterator *bsi, tree word_type, tree a, tree b,
+do_plus_minus (gimple_stmt_iterator *gsi, tree word_type, tree a, tree b,
tree bitpos ATTRIBUTE_UNUSED, tree bitsize ATTRIBUTE_UNUSED,
enum tree_code code)
{
@@ -153,26 +153,26 @@ do_plus_minus (block_stmt_iterator *bsi, tree word_type, tree a, tree b,
low_bits = build_replicated_const (word_type, inner_type, max >> 1);
high_bits = build_replicated_const (word_type, inner_type, max & ~(max >> 1));
- a = tree_vec_extract (bsi, word_type, a, bitsize, bitpos);
- b = tree_vec_extract (bsi, word_type, b, bitsize, bitpos);
+ a = tree_vec_extract (gsi, word_type, a, bitsize, bitpos);
+ b = tree_vec_extract (gsi, word_type, b, bitsize, bitpos);
- signs = gimplify_build2 (bsi, BIT_XOR_EXPR, word_type, a, b);
- b_low = gimplify_build2 (bsi, BIT_AND_EXPR, word_type, b, low_bits);
+ signs = gimplify_build2 (gsi, BIT_XOR_EXPR, word_type, a, b);
+ b_low = gimplify_build2 (gsi, BIT_AND_EXPR, word_type, b, low_bits);
if (code == PLUS_EXPR)
- a_low = gimplify_build2 (bsi, BIT_AND_EXPR, word_type, a, low_bits);
+ a_low = gimplify_build2 (gsi, BIT_AND_EXPR, word_type, a, low_bits);
else
{
- a_low = gimplify_build2 (bsi, BIT_IOR_EXPR, word_type, a, high_bits);
- signs = gimplify_build1 (bsi, BIT_NOT_EXPR, word_type, signs);
+ a_low = gimplify_build2 (gsi, BIT_IOR_EXPR, word_type, a, high_bits);
+ signs = gimplify_build1 (gsi, BIT_NOT_EXPR, word_type, signs);
}
- signs = gimplify_build2 (bsi, BIT_AND_EXPR, word_type, signs, high_bits);
- result_low = gimplify_build2 (bsi, code, word_type, a_low, b_low);
- return gimplify_build2 (bsi, BIT_XOR_EXPR, word_type, result_low, signs);
+ signs = gimplify_build2 (gsi, BIT_AND_EXPR, word_type, signs, high_bits);
+ result_low = gimplify_build2 (gsi, code, word_type, a_low, b_low);
+ return gimplify_build2 (gsi, BIT_XOR_EXPR, word_type, result_low, signs);
}
static tree
-do_negate (block_stmt_iterator *bsi, tree word_type, tree b,
+do_negate (gimple_stmt_iterator *gsi, tree word_type, tree b,
tree unused ATTRIBUTE_UNUSED, tree bitpos ATTRIBUTE_UNUSED,
tree bitsize ATTRIBUTE_UNUSED,
enum tree_code code ATTRIBUTE_UNUSED)
@@ -185,19 +185,19 @@ do_negate (block_stmt_iterator *bsi, tree word_type, tree b,
low_bits = build_replicated_const (word_type, inner_type, max >> 1);
high_bits = build_replicated_const (word_type, inner_type, max & ~(max >> 1));
- b = tree_vec_extract (bsi, word_type, b, bitsize, bitpos);
+ b = tree_vec_extract (gsi, word_type, b, bitsize, bitpos);
- b_low = gimplify_build2 (bsi, BIT_AND_EXPR, word_type, b, low_bits);
- signs = gimplify_build1 (bsi, BIT_NOT_EXPR, word_type, b);
- signs = gimplify_build2 (bsi, BIT_AND_EXPR, word_type, signs, high_bits);
- result_low = gimplify_build2 (bsi, MINUS_EXPR, word_type, high_bits, b_low);
- return gimplify_build2 (bsi, BIT_XOR_EXPR, word_type, result_low, signs);
+ b_low = gimplify_build2 (gsi, BIT_AND_EXPR, word_type, b, low_bits);
+ signs = gimplify_build1 (gsi, BIT_NOT_EXPR, word_type, b);
+ signs = gimplify_build2 (gsi, BIT_AND_EXPR, word_type, signs, high_bits);
+ result_low = gimplify_build2 (gsi, MINUS_EXPR, word_type, high_bits, b_low);
+ return gimplify_build2 (gsi, BIT_XOR_EXPR, word_type, result_low, signs);
}
/* Expand a vector operation to scalars, by using many operations
whose type is the vector type's inner type. */
static tree
-expand_vector_piecewise (block_stmt_iterator *bsi, elem_op_func f,
+expand_vector_piecewise (gimple_stmt_iterator *gsi, elem_op_func f,
tree type, tree inner_type,
tree a, tree b, enum tree_code code)
{
@@ -213,7 +213,7 @@ expand_vector_piecewise (block_stmt_iterator *bsi, elem_op_func f,
for (i = 0; i < nunits;
i += delta, index = int_const_binop (PLUS_EXPR, index, part_width, 0))
{
- tree result = f (bsi, inner_type, a, b, index, part_width, code);
+ tree result = f (gsi, inner_type, a, b, index, part_width, code);
constructor_elt *ce = VEC_quick_push (constructor_elt, v, NULL);
ce->index = NULL_TREE;
ce->value = result;
@@ -226,7 +226,7 @@ expand_vector_piecewise (block_stmt_iterator *bsi, elem_op_func f,
a scalar integer type, or to use a different size for the items
in the vector type. */
static tree
-expand_vector_parallel (block_stmt_iterator *bsi, elem_op_func f, tree type,
+expand_vector_parallel (gimple_stmt_iterator *gsi, elem_op_func f, tree type,
tree a, tree b,
enum tree_code code)
{
@@ -239,23 +239,24 @@ expand_vector_parallel (block_stmt_iterator *bsi, elem_op_func f, tree type,
one word, do it a word at a time; finally, if the vector is smaller
than one word, do it as a scalar. */
if (TYPE_MODE (TREE_TYPE (type)) == word_mode)
- return expand_vector_piecewise (bsi, f,
+ return expand_vector_piecewise (gsi, f,
type, TREE_TYPE (type),
a, b, code);
else if (n_words > 1)
{
tree word_type = build_word_mode_vector_type (n_words);
- result = expand_vector_piecewise (bsi, f,
+ result = expand_vector_piecewise (gsi, f,
word_type, TREE_TYPE (word_type),
a, b, code);
- result = gimplify_val (bsi, word_type, result);
+ result = force_gimple_operand_gsi (gsi, result, true, NULL, true,
+ GSI_SAME_STMT);
}
else
{
/* Use a single scalar operation with a mode no wider than word_mode. */
mode = mode_for_size (tree_low_cst (TYPE_SIZE (type), 1), MODE_INT, 0);
compute_type = lang_hooks.types.type_for_mode (mode, 1);
- result = f (bsi, compute_type, a, b, NULL_TREE, NULL_TREE, code);
+ result = f (gsi, compute_type, a, b, NULL_TREE, NULL_TREE, code);
}
return result;
@@ -267,7 +268,7 @@ expand_vector_parallel (block_stmt_iterator *bsi, elem_op_func f, tree type,
they can process at least four items, that is, only if the vector
holds at least four items and if a word can hold four items. */
static tree
-expand_vector_addition (block_stmt_iterator *bsi,
+expand_vector_addition (gimple_stmt_iterator *gsi,
elem_op_func f, elem_op_func f_parallel,
tree type, tree a, tree b, enum tree_code code)
{
@@ -277,17 +278,17 @@ expand_vector_addition (block_stmt_iterator *bsi,
if (INTEGRAL_TYPE_P (TREE_TYPE (type))
&& parts_per_word >= 4
&& TYPE_VECTOR_SUBPARTS (type) >= 4)
- return expand_vector_parallel (bsi, f_parallel,
+ return expand_vector_parallel (gsi, f_parallel,
type, a, b, code);
else
- return expand_vector_piecewise (bsi, f,
+ return expand_vector_piecewise (gsi, f,
type, TREE_TYPE (type),
a, b, code);
}
static tree
-expand_vector_operation (block_stmt_iterator *bsi, tree type, tree compute_type,
- tree rhs, enum tree_code code)
+expand_vector_operation (gimple_stmt_iterator *gsi, tree type, tree compute_type,
+ gimple assign, enum tree_code code)
{
enum machine_mode compute_mode = TYPE_MODE (compute_type);
@@ -305,28 +306,28 @@ expand_vector_operation (block_stmt_iterator *bsi, tree type, tree compute_type,
case PLUS_EXPR:
case MINUS_EXPR:
if (!TYPE_OVERFLOW_TRAPS (type))
- return expand_vector_addition (bsi, do_binop, do_plus_minus, type,
- TREE_OPERAND (rhs, 0),
- TREE_OPERAND (rhs, 1), code);
+ return expand_vector_addition (gsi, do_binop, do_plus_minus, type,
+ gimple_assign_rhs1 (assign),
+ gimple_assign_rhs2 (assign), code);
break;
case NEGATE_EXPR:
if (!TYPE_OVERFLOW_TRAPS (type))
- return expand_vector_addition (bsi, do_unop, do_negate, type,
- TREE_OPERAND (rhs, 0),
+ return expand_vector_addition (gsi, do_unop, do_negate, type,
+ gimple_assign_rhs1 (assign),
NULL_TREE, code);
break;
case BIT_AND_EXPR:
case BIT_IOR_EXPR:
case BIT_XOR_EXPR:
- return expand_vector_parallel (bsi, do_binop, type,
- TREE_OPERAND (rhs, 0),
- TREE_OPERAND (rhs, 1), code);
+ return expand_vector_parallel (gsi, do_binop, type,
+ gimple_assign_rhs1 (assign),
+ gimple_assign_rhs2 (assign), code);
case BIT_NOT_EXPR:
- return expand_vector_parallel (bsi, do_unop, type,
- TREE_OPERAND (rhs, 0),
+ return expand_vector_parallel (gsi, do_unop, type,
+ gimple_assign_rhs1 (assign),
NULL_TREE, code);
default:
@@ -334,13 +335,13 @@ expand_vector_operation (block_stmt_iterator *bsi, tree type, tree compute_type,
}
if (TREE_CODE_CLASS (code) == tcc_unary)
- return expand_vector_piecewise (bsi, do_unop, type, compute_type,
- TREE_OPERAND (rhs, 0),
+ return expand_vector_piecewise (gsi, do_unop, type, compute_type,
+ gimple_assign_rhs1 (assign),
NULL_TREE, code);
else
- return expand_vector_piecewise (bsi, do_binop, type, compute_type,
- TREE_OPERAND (rhs, 0),
- TREE_OPERAND (rhs, 1), code);
+ return expand_vector_piecewise (gsi, do_binop, type, compute_type,
+ gimple_assign_rhs1 (assign),
+ gimple_assign_rhs2 (assign), code);
}
/* Return a type for the widest vector mode whose components are of mode
@@ -387,43 +388,34 @@ type_for_widest_vector_mode (enum machine_mode inner_mode, optab op, int satp)
/* Process one statement. If we identify a vector operation, expand it. */
static void
-expand_vector_operations_1 (block_stmt_iterator *bsi)
+expand_vector_operations_1 (gimple_stmt_iterator *gsi)
{
- tree stmt = bsi_stmt (*bsi);
- tree *p_lhs, *p_rhs, lhs, rhs, type, compute_type;
+ gimple stmt = gsi_stmt (*gsi);
+ tree lhs, rhs1, rhs2 = NULL, type, compute_type;
enum tree_code code;
enum machine_mode compute_mode;
optab op;
+ enum gimple_rhs_class rhs_class;
+ tree new_rhs;
- switch (TREE_CODE (stmt))
- {
- case RETURN_EXPR:
- stmt = TREE_OPERAND (stmt, 0);
- if (!stmt || TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
- return;
+ if (gimple_code (stmt) != GIMPLE_ASSIGN)
+ return;
- /* FALLTHRU */
+ code = gimple_assign_rhs_code (stmt);
+ rhs_class = get_gimple_rhs_class (code);
- case GIMPLE_MODIFY_STMT:
- p_lhs = &GIMPLE_STMT_OPERAND (stmt, 0);
- p_rhs = &GIMPLE_STMT_OPERAND (stmt, 1);
- lhs = *p_lhs;
- rhs = *p_rhs;
- break;
+ if (rhs_class != GIMPLE_UNARY_RHS && rhs_class != GIMPLE_BINARY_RHS)
+ return;
- default:
- return;
- }
+ lhs = gimple_assign_lhs (stmt);
+ rhs1 = gimple_assign_rhs1 (stmt);
+ type = gimple_expr_type (stmt);
+ if (rhs_class == GIMPLE_BINARY_RHS)
+ rhs2 = gimple_assign_rhs2 (stmt);
- type = TREE_TYPE (rhs);
if (TREE_CODE (type) != VECTOR_TYPE)
return;
- code = TREE_CODE (rhs);
- if (TREE_CODE_CLASS (code) != tcc_unary
- && TREE_CODE_CLASS (code) != tcc_binary)
- return;
-
if (code == NOP_EXPR
|| code == FLOAT_EXPR
|| code == FIX_TRUNC_EXPR
@@ -435,17 +427,18 @@ expand_vector_operations_1 (block_stmt_iterator *bsi)
/* The signedness is determined from input argument. */
if (code == VEC_UNPACK_FLOAT_HI_EXPR
|| code == VEC_UNPACK_FLOAT_LO_EXPR)
- type = TREE_TYPE (TREE_OPERAND (rhs, 0));
+ type = TREE_TYPE (rhs1);
/* Choose between vector shift/rotate by vector and vector shift/rotate by
scalar */
- if (code == LSHIFT_EXPR || code == RSHIFT_EXPR || code == LROTATE_EXPR
+ if (code == LSHIFT_EXPR
+ || code == RSHIFT_EXPR
+ || code == LROTATE_EXPR
|| code == RROTATE_EXPR)
{
/* If the 2nd argument is vector, we need a vector/vector shift */
- if (VECTOR_MODE_P (TYPE_MODE (TREE_TYPE (TREE_OPERAND (rhs, 1)))))
+ if (VECTOR_MODE_P (TYPE_MODE (TREE_TYPE (rhs2))))
op = optab_for_tree_code (code, type, optab_vector);
-
else
{
/* Try for a vector/scalar shift, and if we don't have one, see if we
@@ -471,7 +464,7 @@ expand_vector_operations_1 (block_stmt_iterator *bsi)
|| code == VEC_PACK_TRUNC_EXPR
|| code == VEC_PACK_SAT_EXPR
|| code == VEC_PACK_FIX_TRUNC_EXPR)
- type = TREE_TYPE (TREE_OPERAND (rhs, 0));
+ type = TREE_TYPE (rhs1);
/* Optabs will try converting a negation into a subtraction, so
look for it as well. TODO: negation of floating-point vectors
@@ -513,13 +506,17 @@ expand_vector_operations_1 (block_stmt_iterator *bsi)
}
gcc_assert (code != VEC_LSHIFT_EXPR && code != VEC_RSHIFT_EXPR);
- rhs = expand_vector_operation (bsi, type, compute_type, rhs, code);
- if (useless_type_conversion_p (TREE_TYPE (lhs), TREE_TYPE (rhs)))
- *p_rhs = rhs;
- else
- *p_rhs = gimplify_build1 (bsi, VIEW_CONVERT_EXPR, TREE_TYPE (lhs), rhs);
+ new_rhs = expand_vector_operation (gsi, type, compute_type, stmt, code);
+ if (!useless_type_conversion_p (TREE_TYPE (lhs), TREE_TYPE (new_rhs)))
+ new_rhs = gimplify_build1 (gsi, VIEW_CONVERT_EXPR, TREE_TYPE (lhs),
+ new_rhs);
+
+ /* NOTE: We should avoid using gimple_assign_set_rhs_from_tree. One
+ way to do it is change expand_vector_operation and its callees to
+ return a tree_code, RHS1 and RHS2 instead of a tree. */
+ gimple_assign_set_rhs_from_tree (gsi, new_rhs);
- mark_stmt_modified (bsi_stmt (*bsi));
+ gimple_set_modified (gsi_stmt (*gsi), true);
}
/* Use this to lower vector operations introduced by the vectorizer,
@@ -534,15 +531,15 @@ gate_expand_vector_operations (void)
static unsigned int
expand_vector_operations (void)
{
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
basic_block bb;
FOR_EACH_BB (bb)
{
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- expand_vector_operations_1 (&bsi);
- update_stmt_if_modified (bsi_stmt (bsi));
+ expand_vector_operations_1 (&gsi);
+ update_stmt_if_modified (gsi_stmt (gsi));
}
}
return 0;
diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c
index b9a302d8430..d5bff5a4822 100644
--- a/gcc/tree-vect-patterns.c
+++ b/gcc/tree-vect-patterns.c
@@ -1,5 +1,5 @@
/* Analysis Utilities for Loop Vectorization.
- Copyright (C) 2006, 2007 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc.
Contributed by Dorit Nuzman <dorit@il.ibm.com>
This file is part of GCC.
@@ -42,14 +42,14 @@ along with GCC; see the file COPYING3. If not see
/* Function prototypes */
static void vect_pattern_recog_1
- (tree (* ) (tree, tree *, tree *), block_stmt_iterator);
-static bool widened_name_p (tree, tree, tree *, tree *);
+ (gimple (* ) (gimple, tree *, tree *), gimple_stmt_iterator);
+static bool widened_name_p (tree, gimple, tree *, gimple *);
/* Pattern recognition functions */
-static tree vect_recog_widen_sum_pattern (tree, tree *, tree *);
-static tree vect_recog_widen_mult_pattern (tree, tree *, tree *);
-static tree vect_recog_dot_prod_pattern (tree, tree *, tree *);
-static tree vect_recog_pow_pattern (tree, tree *, tree *);
+static gimple vect_recog_widen_sum_pattern (gimple, tree *, tree *);
+static gimple vect_recog_widen_mult_pattern (gimple, tree *, tree *);
+static gimple vect_recog_dot_prod_pattern (gimple, tree *, tree *);
+static gimple vect_recog_pow_pattern (gimple, tree *, tree *);
static vect_recog_func_ptr vect_vect_recog_func_ptrs[NUM_PATTERNS] = {
vect_recog_widen_mult_pattern,
vect_recog_widen_sum_pattern,
@@ -66,12 +66,12 @@ static vect_recog_func_ptr vect_vect_recog_func_ptrs[NUM_PATTERNS] = {
*/
static bool
-widened_name_p (tree name, tree use_stmt, tree *half_type, tree *def_stmt)
+widened_name_p (tree name, gimple use_stmt, tree *half_type, gimple *def_stmt)
{
tree dummy;
+ gimple dummy_gimple;
loop_vec_info loop_vinfo;
stmt_vec_info stmt_vinfo;
- tree expr;
tree type = TREE_TYPE (name);
tree oprnd0;
enum vect_def_type dt;
@@ -90,14 +90,13 @@ widened_name_p (tree name, tree use_stmt, tree *half_type, tree *def_stmt)
if (! *def_stmt)
return false;
- if (TREE_CODE (*def_stmt) != GIMPLE_MODIFY_STMT)
+ if (!is_gimple_assign (*def_stmt))
return false;
- expr = GIMPLE_STMT_OPERAND (*def_stmt, 1);
- if (TREE_CODE (expr) != NOP_EXPR)
+ if (gimple_assign_rhs_code (*def_stmt) != NOP_EXPR)
return false;
- oprnd0 = TREE_OPERAND (expr, 0);
+ oprnd0 = gimple_assign_rhs1 (*def_stmt);
*half_type = TREE_TYPE (oprnd0);
if (!INTEGRAL_TYPE_P (type) || !INTEGRAL_TYPE_P (*half_type)
@@ -105,12 +104,24 @@ widened_name_p (tree name, tree use_stmt, tree *half_type, tree *def_stmt)
|| (TYPE_PRECISION (type) < (TYPE_PRECISION (*half_type) * 2)))
return false;
- if (!vect_is_simple_use (oprnd0, loop_vinfo, &dummy, &dummy, &dt))
+ if (!vect_is_simple_use (oprnd0, loop_vinfo, &dummy_gimple, &dummy, &dt))
return false;
return true;
}
+/* Helper to return a new temporary for pattern of TYPE for STMT. If STMT
+ is NULL, the caller must set SSA_NAME_DEF_STMT for the returned SSA var. */
+
+static tree
+vect_recog_temp_ssa_var (tree type, gimple stmt)
+{
+ tree var = create_tmp_var (type, "patt");
+
+ add_referenced_var (var);
+ var = make_ssa_name (var, stmt);
+ return var;
+}
/* Function vect_recog_dot_prod_pattern
@@ -157,24 +168,24 @@ widened_name_p (tree name, tree use_stmt, tree *half_type, tree *def_stmt)
the correct order (as is the case when this computation is in an
inner-loop nested in an outer-loop that us being vectorized). */
-static tree
-vect_recog_dot_prod_pattern (tree last_stmt, tree *type_in, tree *type_out)
+static gimple
+vect_recog_dot_prod_pattern (gimple last_stmt, tree *type_in, tree *type_out)
{
- tree stmt, expr;
+ gimple stmt;
tree oprnd0, oprnd1;
tree oprnd00, oprnd01;
stmt_vec_info stmt_vinfo = vinfo_for_stmt (last_stmt);
tree type, half_type;
- tree pattern_expr;
+ gimple pattern_stmt;
tree prod_type;
loop_vec_info loop_info = STMT_VINFO_LOOP_VINFO (stmt_vinfo);
struct loop *loop = LOOP_VINFO_LOOP (loop_info);
+ tree var, rhs;
- if (TREE_CODE (last_stmt) != GIMPLE_MODIFY_STMT)
+ if (!is_gimple_assign (last_stmt))
return NULL;
- expr = GIMPLE_STMT_OPERAND (last_stmt, 1);
- type = TREE_TYPE (expr);
+ type = gimple_expr_type (last_stmt);
/* Look for the following pattern
DX = (TYPE1) X;
@@ -200,7 +211,7 @@ vect_recog_dot_prod_pattern (tree last_stmt, tree *type_in, tree *type_out)
/* Starting from LAST_STMT, follow the defs of its uses in search
of the above pattern. */
- if (TREE_CODE (expr) != PLUS_EXPR)
+ if (gimple_assign_rhs_code (last_stmt) != PLUS_EXPR)
return NULL;
if (STMT_VINFO_IN_PATTERN_P (stmt_vinfo))
@@ -208,22 +219,21 @@ vect_recog_dot_prod_pattern (tree last_stmt, tree *type_in, tree *type_out)
/* Has been detected as widening-summation? */
stmt = STMT_VINFO_RELATED_STMT (stmt_vinfo);
- expr = GIMPLE_STMT_OPERAND (stmt, 1);
- type = TREE_TYPE (expr);
- if (TREE_CODE (expr) != WIDEN_SUM_EXPR)
+ type = gimple_expr_type (stmt);
+ if (gimple_assign_rhs_code (stmt) != WIDEN_SUM_EXPR)
return NULL;
- oprnd0 = TREE_OPERAND (expr, 0);
- oprnd1 = TREE_OPERAND (expr, 1);
+ oprnd0 = gimple_assign_rhs1 (stmt);
+ oprnd1 = gimple_assign_rhs2 (stmt);
half_type = TREE_TYPE (oprnd0);
}
else
{
- tree def_stmt;
+ gimple def_stmt;
if (STMT_VINFO_DEF_TYPE (stmt_vinfo) != vect_reduction_def)
return NULL;
- oprnd0 = TREE_OPERAND (expr, 0);
- oprnd1 = TREE_OPERAND (expr, 1);
+ oprnd0 = gimple_assign_rhs1 (last_stmt);
+ oprnd1 = gimple_assign_rhs2 (last_stmt);
if (TYPE_MAIN_VARIANT (TREE_TYPE (oprnd0)) != TYPE_MAIN_VARIANT (type)
|| TYPE_MAIN_VARIANT (TREE_TYPE (oprnd1)) != TYPE_MAIN_VARIANT (type))
return NULL;
@@ -232,8 +242,7 @@ vect_recog_dot_prod_pattern (tree last_stmt, tree *type_in, tree *type_out)
if (widened_name_p (oprnd0, stmt, &half_type, &def_stmt))
{
stmt = def_stmt;
- expr = GIMPLE_STMT_OPERAND (stmt, 1);
- oprnd0 = TREE_OPERAND (expr, 0);
+ oprnd0 = gimple_assign_rhs1 (stmt);
}
else
half_type = type;
@@ -248,37 +257,35 @@ vect_recog_dot_prod_pattern (tree last_stmt, tree *type_in, tree *type_out)
stmt = SSA_NAME_DEF_STMT (oprnd0);
/* FORNOW. Can continue analyzing the def-use chain when this stmt in a phi
inside the loop (in case we are analyzing an outer-loop). */
- if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
+ if (!is_gimple_assign (stmt))
return NULL;
stmt_vinfo = vinfo_for_stmt (stmt);
gcc_assert (stmt_vinfo);
if (STMT_VINFO_DEF_TYPE (stmt_vinfo) != vect_loop_def)
return NULL;
- expr = GIMPLE_STMT_OPERAND (stmt, 1);
- if (TREE_CODE (expr) != MULT_EXPR)
+ if (gimple_assign_rhs_code (stmt) != MULT_EXPR)
return NULL;
if (STMT_VINFO_IN_PATTERN_P (stmt_vinfo))
{
/* Has been detected as a widening multiplication? */
stmt = STMT_VINFO_RELATED_STMT (stmt_vinfo);
- expr = GIMPLE_STMT_OPERAND (stmt, 1);
- if (TREE_CODE (expr) != WIDEN_MULT_EXPR)
+ if (gimple_assign_rhs_code (stmt) != WIDEN_MULT_EXPR)
return NULL;
stmt_vinfo = vinfo_for_stmt (stmt);
gcc_assert (stmt_vinfo);
gcc_assert (STMT_VINFO_DEF_TYPE (stmt_vinfo) == vect_loop_def);
- oprnd00 = TREE_OPERAND (expr, 0);
- oprnd01 = TREE_OPERAND (expr, 1);
+ oprnd00 = gimple_assign_rhs1 (stmt);
+ oprnd01 = gimple_assign_rhs2 (stmt);
}
else
{
tree half_type0, half_type1;
- tree def_stmt;
+ gimple def_stmt;
tree oprnd0, oprnd1;
- oprnd0 = TREE_OPERAND (expr, 0);
- oprnd1 = TREE_OPERAND (expr, 1);
+ oprnd0 = gimple_assign_rhs1 (stmt);
+ oprnd1 = gimple_assign_rhs2 (stmt);
if (TYPE_MAIN_VARIANT (TREE_TYPE (oprnd0))
!= TYPE_MAIN_VARIANT (prod_type)
|| TYPE_MAIN_VARIANT (TREE_TYPE (oprnd1))
@@ -286,10 +293,10 @@ vect_recog_dot_prod_pattern (tree last_stmt, tree *type_in, tree *type_out)
return NULL;
if (!widened_name_p (oprnd0, stmt, &half_type0, &def_stmt))
return NULL;
- oprnd00 = TREE_OPERAND (GIMPLE_STMT_OPERAND (def_stmt, 1), 0);
+ oprnd00 = gimple_assign_rhs1 (def_stmt);
if (!widened_name_p (oprnd1, stmt, &half_type1, &def_stmt))
return NULL;
- oprnd01 = TREE_OPERAND (GIMPLE_STMT_OPERAND (def_stmt, 1), 0);
+ oprnd01 = gimple_assign_rhs1 (def_stmt);
if (TYPE_MAIN_VARIANT (half_type0) != TYPE_MAIN_VARIANT (half_type1))
return NULL;
if (TYPE_PRECISION (prod_type) != TYPE_PRECISION (half_type0) * 2)
@@ -301,11 +308,14 @@ vect_recog_dot_prod_pattern (tree last_stmt, tree *type_in, tree *type_out)
*type_out = type;
/* Pattern detected. Create a stmt to be used to replace the pattern: */
- pattern_expr = build3 (DOT_PROD_EXPR, type, oprnd00, oprnd01, oprnd1);
+ var = vect_recog_temp_ssa_var (type, NULL);
+ rhs = build3 (DOT_PROD_EXPR, type, oprnd00, oprnd01, oprnd1),
+ pattern_stmt = gimple_build_assign (var, rhs);
+
if (vect_print_dump_info (REPORT_DETAILS))
{
fprintf (vect_dump, "vect_recog_dot_prod_pattern: detected: ");
- print_generic_expr (vect_dump, pattern_expr, TDF_SLIM);
+ print_gimple_stmt (vect_dump, pattern_stmt, 0, TDF_SLIM);
}
/* We don't allow changing the order of the computation in the inner-loop
@@ -317,10 +327,9 @@ vect_recog_dot_prod_pattern (tree last_stmt, tree *type_in, tree *type_out)
return NULL;
}
- return pattern_expr;
+ return pattern_stmt;
}
-
-
+
/* Function vect_recog_widen_mult_pattern
Try to find the following pattern:
@@ -352,34 +361,34 @@ vect_recog_dot_prod_pattern (tree last_stmt, tree *type_in, tree *type_out)
WIDEN_MULT <a_t, b_t>
*/
-static tree
-vect_recog_widen_mult_pattern (tree last_stmt,
+static gimple
+vect_recog_widen_mult_pattern (gimple last_stmt,
tree *type_in,
tree *type_out)
{
- tree expr;
- tree def_stmt0, def_stmt1;
+ gimple def_stmt0, def_stmt1;
tree oprnd0, oprnd1;
tree type, half_type0, half_type1;
- tree pattern_expr;
+ gimple pattern_stmt;
tree vectype;
tree dummy;
+ tree var;
enum tree_code dummy_code;
+ bool dummy_bool;
- if (TREE_CODE (last_stmt) != GIMPLE_MODIFY_STMT)
+ if (!is_gimple_assign (last_stmt))
return NULL;
- expr = GIMPLE_STMT_OPERAND (last_stmt, 1);
- type = TREE_TYPE (expr);
+ type = gimple_expr_type (last_stmt);
/* Starting from LAST_STMT, follow the defs of its uses in search
of the above pattern. */
- if (TREE_CODE (expr) != MULT_EXPR)
+ if (gimple_assign_rhs_code (last_stmt) != MULT_EXPR)
return NULL;
- oprnd0 = TREE_OPERAND (expr, 0);
- oprnd1 = TREE_OPERAND (expr, 1);
+ oprnd0 = gimple_assign_rhs1 (last_stmt);
+ oprnd1 = gimple_assign_rhs2 (last_stmt);
if (TYPE_MAIN_VARIANT (TREE_TYPE (oprnd0)) != TYPE_MAIN_VARIANT (type)
|| TYPE_MAIN_VARIANT (TREE_TYPE (oprnd1)) != TYPE_MAIN_VARIANT (type))
return NULL;
@@ -387,12 +396,12 @@ vect_recog_widen_mult_pattern (tree last_stmt,
/* Check argument 0 */
if (!widened_name_p (oprnd0, last_stmt, &half_type0, &def_stmt0))
return NULL;
- oprnd0 = TREE_OPERAND (GIMPLE_STMT_OPERAND (def_stmt0, 1), 0);
+ oprnd0 = gimple_assign_rhs1 (def_stmt0);
/* Check argument 1 */
if (!widened_name_p (oprnd1, last_stmt, &half_type1, &def_stmt1))
return NULL;
- oprnd1 = TREE_OPERAND (GIMPLE_STMT_OPERAND (def_stmt1, 1), 0);
+ oprnd1 = gimple_assign_rhs1 (def_stmt1);
if (TYPE_MAIN_VARIANT (half_type0) != TYPE_MAIN_VARIANT (half_type1))
return NULL;
@@ -405,18 +414,23 @@ vect_recog_widen_mult_pattern (tree last_stmt,
vectype = get_vectype_for_scalar_type (half_type0);
if (!vectype
|| !supportable_widening_operation (WIDEN_MULT_EXPR, last_stmt, vectype,
- &dummy, &dummy, &dummy_code,
- &dummy_code))
+ &dummy, &dummy, &dummy_code,
+ &dummy_code, &dummy_bool, &dummy))
return NULL;
*type_in = vectype;
*type_out = NULL_TREE;
/* Pattern supported. Create a stmt to be used to replace the pattern: */
- pattern_expr = build2 (WIDEN_MULT_EXPR, type, oprnd0, oprnd1);
+ var = vect_recog_temp_ssa_var (type, NULL);
+ pattern_stmt = gimple_build_assign_with_ops (WIDEN_MULT_EXPR, var, oprnd0,
+ oprnd1);
+ SSA_NAME_DEF_STMT (var) = pattern_stmt;
+
if (vect_print_dump_info (REPORT_DETAILS))
- print_generic_expr (vect_dump, pattern_expr, TDF_SLIM);
- return pattern_expr;
+ print_gimple_stmt (vect_dump, pattern_stmt, 0, TDF_SLIM);
+
+ return pattern_stmt;
}
@@ -441,43 +455,40 @@ vect_recog_widen_mult_pattern (tree last_stmt,
* Return value: A new stmt that will be used to replace the sequence of
stmts that constitute the pattern. In this case it will be:
- x * x
+ x = x * x
or
- sqrt (x)
+ x = sqrt (x)
*/
-static tree
-vect_recog_pow_pattern (tree last_stmt, tree *type_in, tree *type_out)
+static gimple
+vect_recog_pow_pattern (gimple last_stmt, tree *type_in, tree *type_out)
{
- tree expr;
tree type;
- tree fn, base, exp;
+ tree fn, base, exp = NULL;
+ gimple stmt;
+ tree var;
- if (TREE_CODE (last_stmt) != GIMPLE_MODIFY_STMT)
+ if (!is_gimple_call (last_stmt) || gimple_call_lhs (last_stmt) == NULL)
return NULL;
- expr = GIMPLE_STMT_OPERAND (last_stmt, 1);
- type = TREE_TYPE (expr);
-
- if (TREE_CODE (expr) != CALL_EXPR)
- return NULL_TREE;
+ type = gimple_expr_type (last_stmt);
- fn = get_callee_fndecl (expr);
+ fn = gimple_call_fndecl (last_stmt);
switch (DECL_FUNCTION_CODE (fn))
{
case BUILT_IN_POWIF:
case BUILT_IN_POWI:
case BUILT_IN_POWF:
case BUILT_IN_POW:
- base = CALL_EXPR_ARG (expr, 0);
- exp = CALL_EXPR_ARG (expr, 1);
+ base = gimple_call_arg (last_stmt, 0);
+ exp = gimple_call_arg (last_stmt, 1);
if (TREE_CODE (exp) != REAL_CST
&& TREE_CODE (exp) != INTEGER_CST)
- return NULL_TREE;
+ return NULL;
break;
- default:;
- return NULL_TREE;
+ default:
+ return NULL;
}
/* We now have a pow or powi builtin function call with a constant
@@ -492,7 +503,11 @@ vect_recog_pow_pattern (tree last_stmt, tree *type_in, tree *type_out)
&& REAL_VALUES_EQUAL (TREE_REAL_CST (exp), dconst2)))
{
*type_in = TREE_TYPE (base);
- return build2 (MULT_EXPR, TREE_TYPE (base), base, base);
+
+ var = vect_recog_temp_ssa_var (TREE_TYPE (base), NULL);
+ stmt = gimple_build_assign_with_ops (MULT_EXPR, var, base, base);
+ SSA_NAME_DEF_STMT (var) = stmt;
+ return stmt;
}
/* Catch square root. */
@@ -503,13 +518,18 @@ vect_recog_pow_pattern (tree last_stmt, tree *type_in, tree *type_out)
*type_in = get_vectype_for_scalar_type (TREE_TYPE (base));
if (*type_in)
{
- newfn = build_call_expr (newfn, 1, base);
- if (vectorizable_function (newfn, *type_in, *type_in) != NULL_TREE)
- return newfn;
+ gimple stmt = gimple_build_call (newfn, 1, base);
+ if (vectorizable_function (stmt, *type_in, *type_in)
+ != NULL_TREE)
+ {
+ var = vect_recog_temp_ssa_var (TREE_TYPE (base), stmt);
+ gimple_call_set_lhs (stmt, var);
+ return stmt;
+ }
}
}
- return NULL_TREE;
+ return NULL;
}
@@ -552,22 +572,22 @@ vect_recog_pow_pattern (tree last_stmt, tree *type_in, tree *type_out)
the correct order (as is the case when this computation is in an
inner-loop nested in an outer-loop that us being vectorized). */
-static tree
-vect_recog_widen_sum_pattern (tree last_stmt, tree *type_in, tree *type_out)
+static gimple
+vect_recog_widen_sum_pattern (gimple last_stmt, tree *type_in, tree *type_out)
{
- tree stmt, expr;
+ gimple stmt;
tree oprnd0, oprnd1;
stmt_vec_info stmt_vinfo = vinfo_for_stmt (last_stmt);
tree type, half_type;
- tree pattern_expr;
+ gimple pattern_stmt;
loop_vec_info loop_info = STMT_VINFO_LOOP_VINFO (stmt_vinfo);
struct loop *loop = LOOP_VINFO_LOOP (loop_info);
+ tree var;
- if (TREE_CODE (last_stmt) != GIMPLE_MODIFY_STMT)
+ if (!is_gimple_assign (last_stmt))
return NULL;
- expr = GIMPLE_STMT_OPERAND (last_stmt, 1);
- type = TREE_TYPE (expr);
+ type = gimple_expr_type (last_stmt);
/* Look for the following pattern
DX = (TYPE) X;
@@ -579,14 +599,14 @@ vect_recog_widen_sum_pattern (tree last_stmt, tree *type_in, tree *type_out)
/* Starting from LAST_STMT, follow the defs of its uses in search
of the above pattern. */
- if (TREE_CODE (expr) != PLUS_EXPR)
+ if (gimple_assign_rhs_code (last_stmt) != PLUS_EXPR)
return NULL;
if (STMT_VINFO_DEF_TYPE (stmt_vinfo) != vect_reduction_def)
return NULL;
- oprnd0 = TREE_OPERAND (expr, 0);
- oprnd1 = TREE_OPERAND (expr, 1);
+ oprnd0 = gimple_assign_rhs1 (last_stmt);
+ oprnd1 = gimple_assign_rhs2 (last_stmt);
if (TYPE_MAIN_VARIANT (TREE_TYPE (oprnd0)) != TYPE_MAIN_VARIANT (type)
|| TYPE_MAIN_VARIANT (TREE_TYPE (oprnd1)) != TYPE_MAIN_VARIANT (type))
return NULL;
@@ -600,16 +620,20 @@ vect_recog_widen_sum_pattern (tree last_stmt, tree *type_in, tree *type_out)
if (!widened_name_p (oprnd0, last_stmt, &half_type, &stmt))
return NULL;
- oprnd0 = TREE_OPERAND (GIMPLE_STMT_OPERAND (stmt, 1), 0);
+ oprnd0 = gimple_assign_rhs1 (stmt);
*type_in = half_type;
*type_out = type;
/* Pattern detected. Create a stmt to be used to replace the pattern: */
- pattern_expr = build2 (WIDEN_SUM_EXPR, type, oprnd0, oprnd1);
+ var = vect_recog_temp_ssa_var (type, NULL);
+ pattern_stmt = gimple_build_assign_with_ops (WIDEN_SUM_EXPR, var,
+ oprnd0, oprnd1);
+ SSA_NAME_DEF_STMT (var) = pattern_stmt;
+
if (vect_print_dump_info (REPORT_DETAILS))
{
fprintf (vect_dump, "vect_recog_widen_sum_pattern: detected: ");
- print_generic_expr (vect_dump, pattern_expr, TDF_SLIM);
+ print_gimple_stmt (vect_dump, pattern_stmt, 0, TDF_SLIM);
}
/* We don't allow changing the order of the computation in the inner-loop
@@ -621,7 +645,7 @@ vect_recog_widen_sum_pattern (tree last_stmt, tree *type_in, tree *type_out)
return NULL;
}
- return pattern_expr;
+ return pattern_stmt;
}
@@ -649,23 +673,19 @@ vect_recog_widen_sum_pattern (tree last_stmt, tree *type_in, tree *type_out)
static void
vect_pattern_recog_1 (
- tree (* vect_recog_func) (tree, tree *, tree *),
- block_stmt_iterator si)
+ gimple (* vect_recog_func) (gimple, tree *, tree *),
+ gimple_stmt_iterator si)
{
- tree stmt = bsi_stmt (si);
+ gimple stmt = gsi_stmt (si), pattern_stmt;
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
stmt_vec_info pattern_stmt_info;
loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info);
- tree pattern_expr;
tree pattern_vectype;
tree type_in, type_out;
- tree pattern_type;
enum tree_code code;
- tree var, var_name;
- stmt_ann_t ann;
- pattern_expr = (* vect_recog_func) (stmt, &type_in, &type_out);
- if (!pattern_expr)
+ pattern_stmt = (* vect_recog_func) (stmt, &type_in, &type_out);
+ if (!pattern_stmt)
return;
if (VECTOR_MODE_P (TYPE_MODE (type_in)))
@@ -685,8 +705,15 @@ vect_pattern_recog_1 (
if (!pattern_vectype)
return;
- optab = optab_for_tree_code (TREE_CODE (pattern_expr), pattern_vectype,
- optab_default);
+ if (is_gimple_assign (pattern_stmt))
+ code = gimple_assign_rhs_code (pattern_stmt);
+ else
+ {
+ gcc_assert (is_gimple_call (pattern_stmt));
+ code = CALL_EXPR;
+ }
+
+ optab = optab_for_tree_code (code, pattern_vectype, optab_default);
vec_mode = TYPE_MODE (pattern_vectype);
if (!optab
|| (icode = optab_handler (optab, vec_mode)->insn_code) ==
@@ -702,28 +729,20 @@ vect_pattern_recog_1 (
if (vect_print_dump_info (REPORT_DETAILS))
{
fprintf (vect_dump, "pattern recognized: ");
- print_generic_expr (vect_dump, pattern_expr, TDF_SLIM);
+ print_gimple_stmt (vect_dump, pattern_stmt, 0, TDF_SLIM);
}
- /* Mark the stmts that are involved in the pattern,
- create a new stmt to express the pattern and insert it. */
- code = TREE_CODE (pattern_expr);
- pattern_type = TREE_TYPE (pattern_expr);
- var = create_tmp_var (pattern_type, "patt");
- add_referenced_var (var);
- var_name = make_ssa_name (var, NULL_TREE);
- pattern_expr = build_gimple_modify_stmt (var_name, pattern_expr);
- SSA_NAME_DEF_STMT (var_name) = pattern_expr;
- bsi_insert_before (&si, pattern_expr, BSI_SAME_STMT);
- ann = stmt_ann (pattern_expr);
- set_stmt_info (ann, new_stmt_vec_info (pattern_expr, loop_vinfo));
- pattern_stmt_info = vinfo_for_stmt (pattern_expr);
+ /* Mark the stmts that are involved in the pattern. */
+ gsi_insert_before (&si, pattern_stmt, GSI_SAME_STMT);
+ set_vinfo_for_stmt (pattern_stmt,
+ new_stmt_vec_info (pattern_stmt, loop_vinfo));
+ pattern_stmt_info = vinfo_for_stmt (pattern_stmt);
STMT_VINFO_RELATED_STMT (pattern_stmt_info) = stmt;
STMT_VINFO_DEF_TYPE (pattern_stmt_info) = STMT_VINFO_DEF_TYPE (stmt_info);
STMT_VINFO_VECTYPE (pattern_stmt_info) = pattern_vectype;
STMT_VINFO_IN_PATTERN_P (stmt_info) = true;
- STMT_VINFO_RELATED_STMT (stmt_info) = pattern_expr;
+ STMT_VINFO_RELATED_STMT (stmt_info) = pattern_stmt;
return;
}
@@ -804,10 +823,10 @@ vect_pattern_recog (loop_vec_info loop_vinfo)
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
basic_block *bbs = LOOP_VINFO_BBS (loop_vinfo);
unsigned int nbbs = loop->num_nodes;
- block_stmt_iterator si;
- tree stmt;
+ gimple_stmt_iterator si;
+ gimple stmt;
unsigned int i, j;
- tree (* vect_recog_func_ptr) (tree, tree *, tree *);
+ gimple (* vect_recog_func_ptr) (gimple, tree *, tree *);
if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "=== vect_pattern_recog ===");
@@ -817,9 +836,9 @@ vect_pattern_recog (loop_vec_info loop_vinfo)
for (i = 0; i < nbbs; i++)
{
basic_block bb = bbs[i];
- for (si = bsi_start (bb); !bsi_end_p (si); bsi_next (&si))
+ for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si))
{
- stmt = bsi_stmt (si);
+ stmt = gsi_stmt (si);
/* Scan over all generic vect_recog_xxx_pattern functions. */
for (j = 0; j < NUM_PATTERNS; j++)
diff --git a/gcc/tree-vect-transform.c b/gcc/tree-vect-transform.c
index 1fa786da0b9..eb370775cba 100644
--- a/gcc/tree-vect-transform.c
+++ b/gcc/tree-vect-transform.c
@@ -46,20 +46,22 @@ along with GCC; see the file COPYING3. If not see
#include "real.h"
/* Utility functions for the code transformation. */
-static bool vect_transform_stmt (tree, block_stmt_iterator *, bool *, slp_tree);
+static bool vect_transform_stmt (gimple, gimple_stmt_iterator *, bool *,
+ slp_tree);
static tree vect_create_destination_var (tree, tree);
static tree vect_create_data_ref_ptr
- (tree, struct loop*, tree, tree *, tree *, bool, bool *);
+ (gimple, struct loop*, tree, tree *, gimple *, bool, bool *);
static tree vect_create_addr_base_for_vector_ref
- (tree, tree *, tree, struct loop *);
+ (gimple, gimple_seq *, tree, struct loop *);
static tree vect_get_new_vect_var (tree, enum vect_var_kind, const char *);
-static tree vect_get_vec_def_for_operand (tree, tree, tree *);
-static tree vect_init_vector (tree, tree, tree, block_stmt_iterator *);
+static tree vect_get_vec_def_for_operand (tree, gimple, tree *);
+static tree vect_init_vector (gimple, tree, tree, gimple_stmt_iterator *);
static void vect_finish_stmt_generation
- (tree stmt, tree vec_stmt, block_stmt_iterator *);
+ (gimple stmt, gimple vec_stmt, gimple_stmt_iterator *);
static bool vect_is_simple_cond (tree, loop_vec_info);
-static void vect_create_epilog_for_reduction (tree, tree, enum tree_code, tree);
-static tree get_initial_def_for_reduction (tree, tree, tree *);
+static void vect_create_epilog_for_reduction
+ (tree, gimple, int, enum tree_code, gimple);
+static tree get_initial_def_for_reduction (gimple, tree, tree *);
/* Utility function dealing with loop peeling (not peeling itself). */
static void vect_generate_tmps_on_preheader
@@ -73,7 +75,7 @@ static int vect_min_worthwhile_factor (enum tree_code);
static int
-cost_for_stmt (tree stmt)
+cost_for_stmt (gimple stmt)
{
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
@@ -148,11 +150,11 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo)
/* Requires loop versioning tests to handle misalignment. */
- if (VEC_length (tree, LOOP_VINFO_MAY_MISALIGN_STMTS (loop_vinfo)))
+ if (VEC_length (gimple, LOOP_VINFO_MAY_MISALIGN_STMTS (loop_vinfo)))
{
/* FIXME: Make cost depend on complexity of individual check. */
vec_outside_cost +=
- VEC_length (tree, LOOP_VINFO_MAY_MISALIGN_STMTS (loop_vinfo));
+ VEC_length (gimple, LOOP_VINFO_MAY_MISALIGN_STMTS (loop_vinfo));
if (vect_print_dump_info (REPORT_COST))
fprintf (vect_dump, "cost model: Adding cost of checks for loop "
"versioning to treat misalignment.\n");
@@ -168,7 +170,7 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo)
"versioning aliasing.\n");
}
- if (VEC_length (tree, LOOP_VINFO_MAY_MISALIGN_STMTS (loop_vinfo))
+ if (VEC_length (gimple, LOOP_VINFO_MAY_MISALIGN_STMTS (loop_vinfo))
|| VEC_length (ddr_p, LOOP_VINFO_MAY_ALIAS_DDRS (loop_vinfo)))
{
vec_outside_cost += TARG_COND_TAKEN_BRANCH_COST;
@@ -188,7 +190,7 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo)
for (i = 0; i < nbbs; i++)
{
- block_stmt_iterator si;
+ gimple_stmt_iterator si;
basic_block bb = bbs[i];
if (bb->loop_father == loop->inner)
@@ -196,9 +198,9 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo)
else
factor = 1;
- for (si = bsi_start (bb); !bsi_end_p (si); bsi_next (&si))
+ for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si))
{
- tree stmt = bsi_stmt (si);
+ gimple stmt = gsi_stmt (si);
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
/* Skip stmts that are not vectorized inside the loop. */
if (!STMT_VINFO_RELEVANT_P (stmt_info)
@@ -338,7 +340,7 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo)
if (runtime_test)
{
/* Cost model check occurs at versioning. */
- if (VEC_length (tree, LOOP_VINFO_MAY_MISALIGN_STMTS (loop_vinfo))
+ if (VEC_length (gimple, LOOP_VINFO_MAY_MISALIGN_STMTS (loop_vinfo))
|| VEC_length (ddr_p, LOOP_VINFO_MAY_ALIAS_DDRS (loop_vinfo)))
scalar_outside_cost += TARG_COND_NOT_TAKEN_BRANCH_COST;
else
@@ -451,18 +453,34 @@ vect_model_reduction_cost (stmt_vec_info stmt_info, enum tree_code reduc_code,
enum tree_code code;
optab optab;
tree vectype;
- tree orig_stmt;
+ gimple stmt, orig_stmt;
tree reduction_op;
enum machine_mode mode;
- tree operation = GIMPLE_STMT_OPERAND (STMT_VINFO_STMT (stmt_info), 1);
- int op_type = TREE_CODE_LENGTH (TREE_CODE (operation));
loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info);
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
+
/* Cost of reduction op inside loop. */
STMT_VINFO_INSIDE_OF_LOOP_COST (stmt_info) += ncopies * TARG_VEC_STMT_COST;
- reduction_op = TREE_OPERAND (operation, op_type-1);
+ stmt = STMT_VINFO_STMT (stmt_info);
+
+ switch (get_gimple_rhs_class (gimple_assign_rhs_code (stmt)))
+ {
+ case GIMPLE_SINGLE_RHS:
+ gcc_assert (TREE_OPERAND_LENGTH (gimple_assign_rhs1 (stmt)) == ternary_op);
+ reduction_op = TREE_OPERAND (gimple_assign_rhs1 (stmt), 2);
+ break;
+ case GIMPLE_UNARY_RHS:
+ reduction_op = gimple_assign_rhs1 (stmt);
+ break;
+ case GIMPLE_BINARY_RHS:
+ reduction_op = gimple_assign_rhs2 (stmt);
+ break;
+ default:
+ gcc_unreachable ();
+ }
+
vectype = get_vectype_for_scalar_type (TREE_TYPE (reduction_op));
if (!vectype)
{
@@ -480,7 +498,7 @@ vect_model_reduction_cost (stmt_vec_info stmt_info, enum tree_code reduc_code,
if (!orig_stmt)
orig_stmt = STMT_VINFO_STMT (stmt_info);
- code = TREE_CODE (GIMPLE_STMT_OPERAND (orig_stmt, 1));
+ code = gimple_assign_rhs_code (orig_stmt);
/* Add in cost for initial definition. */
outer_cost += TARG_SCALAR_TO_VEC_COST;
@@ -498,7 +516,7 @@ vect_model_reduction_cost (stmt_vec_info stmt_info, enum tree_code reduc_code,
{
int vec_size_in_bits = tree_low_cst (TYPE_SIZE (vectype), 1);
tree bitsize =
- TYPE_SIZE (TREE_TYPE ( GIMPLE_STMT_OPERAND (orig_stmt, 0)));
+ TYPE_SIZE (TREE_TYPE (gimple_assign_lhs (orig_stmt)));
int element_bitsize = tree_low_cst (bitsize, 1);
int nelements = vec_size_in_bits / element_bitsize;
@@ -562,6 +580,10 @@ vect_model_simple_cost (stmt_vec_info stmt_info, int ncopies,
int i;
int inside_cost = 0, outside_cost = 0;
+ /* The SLP costs were already calculated during SLP tree build. */
+ if (PURE_SLP_STMT (stmt_info))
+ return;
+
inside_cost = ncopies * TARG_VEC_STMT_COST;
/* FORNOW: Assuming maximum 2 args per stmts. */
@@ -590,7 +612,7 @@ vect_model_simple_cost (stmt_vec_info stmt_info, int ncopies,
static int
vect_cost_strided_group_size (stmt_vec_info stmt_info)
{
- tree first_stmt = DR_GROUP_FIRST_DR (stmt_info);
+ gimple first_stmt = DR_GROUP_FIRST_DR (stmt_info);
if (first_stmt == STMT_VINFO_STMT (stmt_info))
return DR_GROUP_SIZE (stmt_info);
@@ -611,11 +633,15 @@ vect_model_store_cost (stmt_vec_info stmt_info, int ncopies,
int group_size;
int inside_cost = 0, outside_cost = 0;
+ /* The SLP costs were already calculated during SLP tree build. */
+ if (PURE_SLP_STMT (stmt_info))
+ return;
+
if (dt == vect_constant_def || dt == vect_invariant_def)
outside_cost = TARG_SCALAR_TO_VEC_COST;
/* Strided access? */
- if (DR_GROUP_FIRST_DR (stmt_info))
+ if (DR_GROUP_FIRST_DR (stmt_info) && !slp_node)
group_size = vect_cost_strided_group_size (stmt_info);
/* Not a strided access. */
else
@@ -661,10 +687,14 @@ vect_model_load_cost (stmt_vec_info stmt_info, int ncopies, slp_tree slp_node)
{
int group_size;
int alignment_support_cheme;
- tree first_stmt;
+ gimple first_stmt;
struct data_reference *dr = STMT_VINFO_DATA_REF (stmt_info), *first_dr;
int inside_cost = 0, outside_cost = 0;
+ /* The SLP costs were already calculated during SLP tree build. */
+ if (PURE_SLP_STMT (stmt_info))
+ return;
+
/* Strided accesses? */
first_stmt = DR_GROUP_FIRST_DR (stmt_info);
if (first_stmt && !slp_node)
@@ -846,21 +876,21 @@ vect_get_new_vect_var (tree type, enum vect_var_kind var_kind, const char *name)
FORNOW: We are only handling array accesses with step 1. */
static tree
-vect_create_addr_base_for_vector_ref (tree stmt,
- tree *new_stmt_list,
+vect_create_addr_base_for_vector_ref (gimple stmt,
+ gimple_seq *new_stmt_list,
tree offset,
struct loop *loop)
{
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
struct data_reference *dr = STMT_VINFO_DATA_REF (stmt_info);
- struct loop *containing_loop = (bb_for_stmt (stmt))->loop_father;
+ struct loop *containing_loop = (gimple_bb (stmt))->loop_father;
tree data_ref_base = unshare_expr (DR_BASE_ADDRESS (dr));
tree base_name;
tree data_ref_base_var;
- tree new_base_stmt;
tree vec_stmt;
tree addr_base, addr_expr;
- tree dest, new_stmt;
+ tree dest;
+ gimple_seq seq = NULL;
tree base_offset = unshare_expr (DR_OFFSET (dr));
tree init = unshare_expr (DR_INIT (dr));
tree vect_ptr_type, addr_expr2;
@@ -883,17 +913,17 @@ vect_create_addr_base_for_vector_ref (tree stmt,
base_name = build_fold_indirect_ref (data_ref_base);
data_ref_base_var = create_tmp_var (TREE_TYPE (data_ref_base), "batmp");
add_referenced_var (data_ref_base_var);
- data_ref_base = force_gimple_operand (data_ref_base, &new_base_stmt,
- true, data_ref_base_var);
- append_to_statement_list_force(new_base_stmt, new_stmt_list);
+ data_ref_base = force_gimple_operand (data_ref_base, &seq, true,
+ data_ref_base_var);
+ gimple_seq_add_seq (new_stmt_list, seq);
/* Create base_offset */
base_offset = size_binop (PLUS_EXPR, base_offset, init);
base_offset = fold_convert (sizetype, base_offset);
dest = create_tmp_var (TREE_TYPE (base_offset), "base_off");
add_referenced_var (dest);
- base_offset = force_gimple_operand (base_offset, &new_stmt, true, dest);
- append_to_statement_list_force (new_stmt, new_stmt_list);
+ base_offset = force_gimple_operand (base_offset, &seq, true, dest);
+ gimple_seq_add_seq (new_stmt_list, seq);
if (offset)
{
@@ -903,8 +933,8 @@ vect_create_addr_base_for_vector_ref (tree stmt,
offset = fold_build2 (MULT_EXPR, TREE_TYPE (offset), offset, step);
base_offset = fold_build2 (PLUS_EXPR, TREE_TYPE (base_offset),
base_offset, offset);
- base_offset = force_gimple_operand (base_offset, &new_stmt, false, tmp);
- append_to_statement_list_force (new_stmt, new_stmt_list);
+ base_offset = force_gimple_operand (base_offset, &seq, false, tmp);
+ gimple_seq_add_seq (new_stmt_list, seq);
}
/* base + base_offset */
@@ -921,8 +951,8 @@ vect_create_addr_base_for_vector_ref (tree stmt,
addr_expr2 = vect_get_new_vect_var (vect_ptr_type, vect_pointer_var,
get_name (base_name));
add_referenced_var (addr_expr2);
- vec_stmt = force_gimple_operand (vec_stmt, &new_stmt, false, addr_expr2);
- append_to_statement_list_force (new_stmt, new_stmt_list);
+ vec_stmt = force_gimple_operand (vec_stmt, &seq, false, addr_expr2);
+ gimple_seq_add_seq (new_stmt_list, seq);
if (vect_print_dump_info (REPORT_DETAILS))
{
@@ -944,8 +974,8 @@ vect_create_addr_base_for_vector_ref (tree stmt,
Input:
1. STMT: a stmt that references memory. Expected to be of the form
- GIMPLE_MODIFY_STMT <name, data-ref> or
- GIMPLE_MODIFY_STMT <data-ref, name>.
+ GIMPLE_ASSIGN <name, data-ref> or
+ GIMPLE_ASSIGN <data-ref, name>.
2. AT_LOOP: the loop where the vector memref is to be created.
3. OFFSET (optional): an offset to be added to the initial address accessed
by the data-ref in STMT.
@@ -978,8 +1008,8 @@ vect_create_addr_base_for_vector_ref (tree stmt,
4. Return the pointer. */
static tree
-vect_create_data_ref_ptr (tree stmt, struct loop *at_loop,
- tree offset, tree *initial_address, tree *ptr_incr,
+vect_create_data_ref_ptr (gimple stmt, struct loop *at_loop,
+ tree offset, tree *initial_address, gimple *ptr_incr,
bool only_init, bool *inv_p)
{
tree base_name;
@@ -987,23 +1017,23 @@ vect_create_data_ref_ptr (tree stmt, struct loop *at_loop,
loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info);
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
bool nested_in_vect_loop = nested_in_vect_loop_p (loop, stmt);
- struct loop *containing_loop = (bb_for_stmt (stmt))->loop_father;
+ struct loop *containing_loop = (gimple_bb (stmt))->loop_father;
tree vectype = STMT_VINFO_VECTYPE (stmt_info);
tree vect_ptr_type;
tree vect_ptr;
tree tag;
tree new_temp;
- tree vec_stmt;
- tree new_stmt_list = NULL_TREE;
+ gimple vec_stmt;
+ gimple_seq new_stmt_list = NULL;
edge pe;
basic_block new_bb;
tree vect_ptr_init;
struct data_reference *dr = STMT_VINFO_DATA_REF (stmt_info);
tree vptr;
- block_stmt_iterator incr_bsi;
+ gimple_stmt_iterator incr_gsi;
bool insert_after;
tree indx_before_incr, indx_after_incr;
- tree incr;
+ gimple incr;
tree step;
/* Check the step (evolution) of the load in LOOP, and record
@@ -1020,7 +1050,7 @@ vect_create_data_ref_ptr (tree stmt, struct loop *at_loop,
/* Create an expression for the first address accessed by this load
in LOOP. */
- base_name = build_fold_indirect_ref (unshare_expr (DR_BASE_ADDRESS (dr)));
+ base_name = build_fold_indirect_ref (unshare_expr (DR_BASE_ADDRESS (dr)));
if (vect_print_dump_info (REPORT_DETAILS))
{
@@ -1099,18 +1129,18 @@ vect_create_data_ref_ptr (tree stmt, struct loop *at_loop,
pe = loop_preheader_edge (loop);
if (new_stmt_list)
{
- new_bb = bsi_insert_on_edge_immediate (pe, new_stmt_list);
+ new_bb = gsi_insert_seq_on_edge_immediate (pe, new_stmt_list);
gcc_assert (!new_bb);
}
*initial_address = new_temp;
/* Create: p = (vectype *) initial_base */
- vec_stmt = fold_convert (vect_ptr_type, new_temp);
- vec_stmt = build_gimple_modify_stmt (vect_ptr, vec_stmt);
+ vec_stmt = gimple_build_assign (vect_ptr,
+ fold_convert (vect_ptr_type, new_temp));
vect_ptr_init = make_ssa_name (vect_ptr, vec_stmt);
- GIMPLE_STMT_OPERAND (vec_stmt, 0) = vect_ptr_init;
- new_bb = bsi_insert_on_edge_immediate (pe, vec_stmt);
+ gimple_assign_set_lhs (vec_stmt, vect_ptr_init);
+ new_bb = gsi_insert_on_edge_immediate (pe, vec_stmt);
gcc_assert (!new_bb);
@@ -1135,15 +1165,14 @@ vect_create_data_ref_ptr (tree stmt, struct loop *at_loop,
if (*inv_p)
step = size_zero_node;
- standard_iv_increment_position (loop, &incr_bsi, &insert_after);
+ standard_iv_increment_position (loop, &incr_gsi, &insert_after);
create_iv (vect_ptr_init,
fold_convert (vect_ptr_type, step),
- NULL_TREE, loop, &incr_bsi, insert_after,
+ NULL_TREE, loop, &incr_gsi, insert_after,
&indx_before_incr, &indx_after_incr);
- incr = bsi_stmt (incr_bsi);
- set_stmt_info (stmt_ann (incr),
- new_stmt_vec_info (incr, loop_vinfo));
+ incr = gsi_stmt (incr_gsi);
+ set_vinfo_for_stmt (incr, new_stmt_vec_info (incr, loop_vinfo));
/* Copy the points-to information if it exists. */
if (DR_PTR_INFO (dr))
@@ -1169,13 +1198,13 @@ vect_create_data_ref_ptr (tree stmt, struct loop *at_loop,
gcc_assert (nested_in_vect_loop);
if (!only_init)
{
- standard_iv_increment_position (containing_loop, &incr_bsi,
+ standard_iv_increment_position (containing_loop, &incr_gsi,
&insert_after);
create_iv (vptr, fold_convert (vect_ptr_type, DR_STEP (dr)), NULL_TREE,
- containing_loop, &incr_bsi, insert_after, &indx_before_incr,
+ containing_loop, &incr_gsi, insert_after, &indx_before_incr,
&indx_after_incr);
- incr = bsi_stmt (incr_bsi);
- set_stmt_info (stmt_ann (incr), new_stmt_vec_info (incr, loop_vinfo));
+ incr = gsi_stmt (incr_gsi);
+ set_vinfo_for_stmt (incr, new_stmt_vec_info (incr, loop_vinfo));
/* Copy the points-to information if it exists. */
if (DR_PTR_INFO (dr))
@@ -1230,16 +1259,15 @@ vect_create_data_ref_ptr (tree stmt, struct loop *at_loop,
*/
static tree
-bump_vector_ptr (tree dataref_ptr, tree ptr_incr, block_stmt_iterator *bsi,
- tree stmt, tree bump)
+bump_vector_ptr (tree dataref_ptr, gimple ptr_incr, gimple_stmt_iterator *gsi,
+ gimple stmt, tree bump)
{
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
struct data_reference *dr = STMT_VINFO_DATA_REF (stmt_info);
tree vectype = STMT_VINFO_VECTYPE (stmt_info);
- tree vptr_type = TREE_TYPE (dataref_ptr);
tree ptr_var = SSA_NAME_VAR (dataref_ptr);
tree update = TYPE_SIZE_UNIT (vectype);
- tree incr_stmt;
+ gimple incr_stmt;
ssa_op_iter iter;
use_operand_p use_p;
tree new_dataref_ptr;
@@ -1247,12 +1275,11 @@ bump_vector_ptr (tree dataref_ptr, tree ptr_incr, block_stmt_iterator *bsi,
if (bump)
update = bump;
- incr_stmt = build_gimple_modify_stmt (ptr_var,
- build2 (POINTER_PLUS_EXPR, vptr_type,
- dataref_ptr, update));
+ incr_stmt = gimple_build_assign_with_ops (POINTER_PLUS_EXPR, ptr_var,
+ dataref_ptr, update);
new_dataref_ptr = make_ssa_name (ptr_var, incr_stmt);
- GIMPLE_STMT_OPERAND (incr_stmt, 0) = new_dataref_ptr;
- vect_finish_stmt_generation (stmt, incr_stmt, bsi);
+ gimple_assign_set_lhs (incr_stmt, new_dataref_ptr);
+ vect_finish_stmt_generation (stmt, incr_stmt, gsi);
/* Copy the points-to information if it exists. */
if (DR_PTR_INFO (dr))
@@ -1313,12 +1340,12 @@ vect_create_destination_var (tree scalar_dest, tree vectype)
It will be used in the vectorization of STMT. */
static tree
-vect_init_vector (tree stmt, tree vector_var, tree vector_type,
- block_stmt_iterator *bsi)
+vect_init_vector (gimple stmt, tree vector_var, tree vector_type,
+ gimple_stmt_iterator *gsi)
{
stmt_vec_info stmt_vinfo = vinfo_for_stmt (stmt);
tree new_var;
- tree init_stmt;
+ gimple init_stmt;
tree vec_oprnd;
edge pe;
tree new_temp;
@@ -1326,12 +1353,12 @@ vect_init_vector (tree stmt, tree vector_var, tree vector_type,
new_var = vect_get_new_vect_var (vector_type, vect_simple_var, "cst_");
add_referenced_var (new_var);
- init_stmt = build_gimple_modify_stmt (new_var, vector_var);
+ init_stmt = gimple_build_assign (new_var, vector_var);
new_temp = make_ssa_name (new_var, init_stmt);
- GIMPLE_STMT_OPERAND (init_stmt, 0) = new_temp;
+ gimple_assign_set_lhs (init_stmt, new_temp);
- if (bsi)
- vect_finish_stmt_generation (stmt, init_stmt, bsi);
+ if (gsi)
+ vect_finish_stmt_generation (stmt, init_stmt, gsi);
else
{
loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_vinfo);
@@ -1340,17 +1367,17 @@ vect_init_vector (tree stmt, tree vector_var, tree vector_type,
if (nested_in_vect_loop_p (loop, stmt))
loop = loop->inner;
pe = loop_preheader_edge (loop);
- new_bb = bsi_insert_on_edge_immediate (pe, init_stmt);
+ new_bb = gsi_insert_on_edge_immediate (pe, init_stmt);
gcc_assert (!new_bb);
}
if (vect_print_dump_info (REPORT_DETAILS))
{
fprintf (vect_dump, "created new init_stmt: ");
- print_generic_expr (vect_dump, init_stmt, TDF_SLIM);
+ print_gimple_stmt (vect_dump, init_stmt, 0, TDF_SLIM);
}
- vec_oprnd = GIMPLE_STMT_OPERAND (init_stmt, 0);
+ vec_oprnd = gimple_assign_lhs (init_stmt);
return vec_oprnd;
}
@@ -1364,8 +1391,8 @@ static void
vect_get_constant_vectors (slp_tree slp_node, VEC(tree,heap) **vec_oprnds,
unsigned int op_num)
{
- VEC (tree, heap) *stmts = SLP_TREE_SCALAR_STMTS (slp_node);
- tree stmt = VEC_index (tree, stmts, 0);
+ VEC (gimple, heap) *stmts = SLP_TREE_SCALAR_STMTS (slp_node);
+ gimple stmt = VEC_index (gimple, stmts, 0);
stmt_vec_info stmt_vinfo = vinfo_for_stmt (stmt);
tree vectype = STMT_VINFO_VECTYPE (stmt_vinfo);
int nunits = TYPE_VECTOR_SUBPARTS (vectype);
@@ -1373,8 +1400,8 @@ vect_get_constant_vectors (slp_tree slp_node, VEC(tree,heap) **vec_oprnds,
tree t = NULL_TREE;
int j, number_of_places_left_in_vector;
tree vector_type;
- tree op, vop, operation;
- int group_size = VEC_length (tree, stmts);
+ tree op, vop;
+ int group_size = VEC_length (gimple, stmts);
unsigned int vec_num, i;
int number_of_copies = 1;
bool is_store = false;
@@ -1407,13 +1434,12 @@ vect_get_constant_vectors (slp_tree slp_node, VEC(tree,heap) **vec_oprnds,
constant_p = true;
for (j = 0; j < number_of_copies; j++)
{
- for (i = group_size - 1; VEC_iterate (tree, stmts, i, stmt); i--)
+ for (i = group_size - 1; VEC_iterate (gimple, stmts, i, stmt); i--)
{
- operation = GIMPLE_STMT_OPERAND (stmt, 1);
if (is_store)
- op = operation;
+ op = gimple_assign_rhs1 (stmt);
else
- op = TREE_OPERAND (operation, op_num);
+ op = gimple_op (stmt, op_num + 1);
if (!CONSTANT_CLASS_P (op))
constant_p = false;
@@ -1471,17 +1497,17 @@ static void
vect_get_slp_vect_defs (slp_tree slp_node, VEC (tree,heap) **vec_oprnds)
{
tree vec_oprnd;
- tree vec_def_stmt;
+ gimple vec_def_stmt;
unsigned int i;
gcc_assert (SLP_TREE_VEC_STMTS (slp_node));
for (i = 0;
- VEC_iterate (tree, SLP_TREE_VEC_STMTS (slp_node), i, vec_def_stmt);
+ VEC_iterate (gimple, SLP_TREE_VEC_STMTS (slp_node), i, vec_def_stmt);
i++)
{
gcc_assert (vec_def_stmt);
- vec_oprnd = GIMPLE_STMT_OPERAND (vec_def_stmt, 0);
+ vec_oprnd = gimple_get_lhs (vec_def_stmt);
VEC_quick_push (tree, *vec_oprnds, vec_oprnd);
}
}
@@ -1500,7 +1526,8 @@ static void
vect_get_slp_defs (slp_tree slp_node, VEC (tree,heap) **vec_oprnds0,
VEC (tree,heap) **vec_oprnds1)
{
- tree operation, first_stmt;
+ gimple first_stmt;
+ enum tree_code code;
/* Allocate memory for vectorized defs. */
*vec_oprnds0 = VEC_alloc (tree, heap,
@@ -1515,14 +1542,14 @@ vect_get_slp_defs (slp_tree slp_node, VEC (tree,heap) **vec_oprnds0,
/* Build vectors from scalar defs. */
vect_get_constant_vectors (slp_node, vec_oprnds0, 0);
- first_stmt = VEC_index (tree, SLP_TREE_SCALAR_STMTS (slp_node), 0);
+ first_stmt = VEC_index (gimple, SLP_TREE_SCALAR_STMTS (slp_node), 0);
if (STMT_VINFO_DATA_REF (vinfo_for_stmt (first_stmt)))
/* Since we don't call this function with loads, this is a group of
stores. */
return;
- operation = GIMPLE_STMT_OPERAND (first_stmt, 1);
- if (TREE_OPERAND_LENGTH (operation) == unary_op || !vec_oprnds1)
+ code = gimple_assign_rhs_code (first_stmt);
+ if (get_gimple_rhs_class (code) != GIMPLE_BINARY_RHS || !vec_oprnds1)
return;
*vec_oprnds1 = VEC_alloc (tree, heap,
@@ -1550,12 +1577,12 @@ vect_get_slp_defs (slp_tree slp_node, VEC (tree,heap) **vec_oprnds0,
[X, X + S, X + 2*S, X + 3*S]. */
static tree
-get_initial_def_for_induction (tree iv_phi)
+get_initial_def_for_induction (gimple iv_phi)
{
stmt_vec_info stmt_vinfo = vinfo_for_stmt (iv_phi);
loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_vinfo);
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
- tree scalar_type = TREE_TYPE (PHI_RESULT_TREE (iv_phi));
+ tree scalar_type = TREE_TYPE (gimple_phi_result (iv_phi));
tree vectype;
int nunits;
edge pe = loop_preheader_edge (loop);
@@ -1565,8 +1592,8 @@ get_initial_def_for_induction (tree iv_phi)
tree access_fn;
tree new_var;
tree new_name;
- tree init_stmt;
- tree induction_phi, induc_def, new_stmt, vec_def, vec_dest;
+ gimple init_stmt, induction_phi, new_stmt;
+ tree induc_def, vec_def, vec_dest;
tree init_expr, step_expr;
int vf = LOOP_VINFO_VECT_FACTOR (loop_vinfo);
int i;
@@ -1575,14 +1602,14 @@ get_initial_def_for_induction (tree iv_phi)
tree expr;
stmt_vec_info phi_info = vinfo_for_stmt (iv_phi);
bool nested_in_vect_loop = false;
- tree stmts;
+ gimple_seq stmts = NULL;
imm_use_iterator imm_iter;
use_operand_p use_p;
- tree exit_phi;
+ gimple exit_phi;
edge latch_e;
tree loop_arg;
- block_stmt_iterator si;
- basic_block bb = bb_for_stmt (iv_phi);
+ gimple_stmt_iterator si;
+ basic_block bb = gimple_bb (iv_phi);
vectype = get_vectype_for_scalar_type (scalar_type);
gcc_assert (vectype);
@@ -1593,9 +1620,9 @@ get_initial_def_for_induction (tree iv_phi)
gcc_assert (ncopies >= 1);
/* Find the first insertion point in the BB. */
- si = bsi_after_labels (bb);
+ si = gsi_after_labels (bb);
- if (INTEGRAL_TYPE_P (scalar_type))
+ if (INTEGRAL_TYPE_P (scalar_type) || POINTER_TYPE_P (scalar_type))
step_expr = build_int_cst (scalar_type, 0);
else
step_expr = build_real (scalar_type, dconst0);
@@ -1608,7 +1635,7 @@ get_initial_def_for_induction (tree iv_phi)
}
else
iv_loop = loop;
- gcc_assert (iv_loop == (bb_for_stmt (iv_phi))->loop_father);
+ gcc_assert (iv_loop == (gimple_bb (iv_phi))->loop_father);
latch_e = loop_latch_edge (iv_loop);
loop_arg = PHI_ARG_DEF_FROM_EDGE (iv_phi, latch_e);
@@ -1639,7 +1666,7 @@ get_initial_def_for_induction (tree iv_phi)
new_name = force_gimple_operand (init_expr, &stmts, false, new_var);
if (stmts)
{
- new_bb = bsi_insert_on_edge_immediate (pe, stmts);
+ new_bb = gsi_insert_seq_on_edge_immediate (pe, stmts);
gcc_assert (!new_bb);
}
@@ -1647,21 +1674,21 @@ get_initial_def_for_induction (tree iv_phi)
t = tree_cons (NULL_TREE, init_expr, t);
for (i = 1; i < nunits; i++)
{
- tree tmp;
-
/* Create: new_name_i = new_name + step_expr */
- tmp = fold_build2 (PLUS_EXPR, scalar_type, new_name, step_expr);
- init_stmt = build_gimple_modify_stmt (new_var, tmp);
+ enum tree_code code = POINTER_TYPE_P (scalar_type)
+ ? POINTER_PLUS_EXPR : PLUS_EXPR;
+ init_stmt = gimple_build_assign_with_ops (code, new_var,
+ new_name, step_expr);
new_name = make_ssa_name (new_var, init_stmt);
- GIMPLE_STMT_OPERAND (init_stmt, 0) = new_name;
+ gimple_assign_set_lhs (init_stmt, new_name);
- new_bb = bsi_insert_on_edge_immediate (pe, init_stmt);
+ new_bb = gsi_insert_on_edge_immediate (pe, init_stmt);
gcc_assert (!new_bb);
if (vect_print_dump_info (REPORT_DETAILS))
{
fprintf (vect_dump, "created new init_stmt: ");
- print_generic_expr (vect_dump, init_stmt, TDF_SLIM);
+ print_gimple_stmt (vect_dump, init_stmt, 0, TDF_SLIM);
}
t = tree_cons (NULL_TREE, new_name, t);
}
@@ -1707,19 +1734,17 @@ get_initial_def_for_induction (tree iv_phi)
vec_dest = vect_get_new_vect_var (vectype, vect_simple_var, "vec_iv_");
add_referenced_var (vec_dest);
induction_phi = create_phi_node (vec_dest, iv_loop->header);
- set_stmt_info (get_stmt_ann (induction_phi),
- new_stmt_vec_info (induction_phi, loop_vinfo));
+ set_vinfo_for_stmt (induction_phi,
+ new_stmt_vec_info (induction_phi, loop_vinfo));
induc_def = PHI_RESULT (induction_phi);
/* Create the iv update inside the loop */
- new_stmt = build_gimple_modify_stmt (NULL_TREE,
- build2 (PLUS_EXPR, vectype,
- induc_def, vec_step));
+ new_stmt = gimple_build_assign_with_ops (PLUS_EXPR, vec_dest,
+ induc_def, vec_step);
vec_def = make_ssa_name (vec_dest, new_stmt);
- GIMPLE_STMT_OPERAND (new_stmt, 0) = vec_def;
- bsi_insert_before (&si, new_stmt, BSI_SAME_STMT);
- set_stmt_info (get_stmt_ann (new_stmt),
- new_stmt_vec_info (new_stmt, loop_vinfo));
+ gimple_assign_set_lhs (new_stmt, vec_def);
+ gsi_insert_before (&si, new_stmt, GSI_SAME_STMT);
+ set_vinfo_for_stmt (new_stmt, new_stmt_vec_info (new_stmt, loop_vinfo));
/* Set the arguments of the phi node: */
add_phi_arg (induction_phi, vec_init, pe);
@@ -1752,16 +1777,15 @@ get_initial_def_for_induction (tree iv_phi)
prev_stmt_vinfo = vinfo_for_stmt (induction_phi);
for (i = 1; i < ncopies; i++)
{
- tree tmp;
-
/* vec_i = vec_prev + vec_step */
- tmp = build2 (PLUS_EXPR, vectype, vec_def, vec_step);
- new_stmt = build_gimple_modify_stmt (NULL_TREE, tmp);
+ new_stmt = gimple_build_assign_with_ops (PLUS_EXPR, vec_dest,
+ vec_def, vec_step);
vec_def = make_ssa_name (vec_dest, new_stmt);
- GIMPLE_STMT_OPERAND (new_stmt, 0) = vec_def;
- bsi_insert_before (&si, new_stmt, BSI_SAME_STMT);
- set_stmt_info (get_stmt_ann (new_stmt),
- new_stmt_vec_info (new_stmt, loop_vinfo));
+ gimple_assign_set_lhs (new_stmt, vec_def);
+
+ gsi_insert_before (&si, new_stmt, GSI_SAME_STMT);
+ set_vinfo_for_stmt (new_stmt,
+ new_stmt_vec_info (new_stmt, loop_vinfo));
STMT_VINFO_RELATED_STMT (prev_stmt_vinfo) = new_stmt;
prev_stmt_vinfo = vinfo_for_stmt (new_stmt);
}
@@ -1774,7 +1798,7 @@ get_initial_def_for_induction (tree iv_phi)
exit_phi = NULL;
FOR_EACH_IMM_USE_FAST (use_p, imm_iter, loop_arg)
{
- if (!flow_bb_inside_loop_p (iv_loop, bb_for_stmt (USE_STMT (use_p))))
+ if (!flow_bb_inside_loop_p (iv_loop, gimple_bb (USE_STMT (use_p))))
{
exit_phi = USE_STMT (use_p);
break;
@@ -1792,7 +1816,7 @@ get_initial_def_for_induction (tree iv_phi)
if (vect_print_dump_info (REPORT_DETAILS))
{
fprintf (vect_dump, "vector of inductions after inner-loop:");
- print_generic_expr (vect_dump, new_stmt, TDF_SLIM);
+ print_gimple_stmt (vect_dump, new_stmt, 0, TDF_SLIM);
}
}
}
@@ -1800,10 +1824,10 @@ get_initial_def_for_induction (tree iv_phi)
if (vect_print_dump_info (REPORT_DETAILS))
{
- fprintf (vect_dump, "transform induction: created def-use cycle:");
- print_generic_expr (vect_dump, induction_phi, TDF_SLIM);
+ fprintf (vect_dump, "transform induction: created def-use cycle: ");
+ print_gimple_stmt (vect_dump, induction_phi, 0, TDF_SLIM);
fprintf (vect_dump, "\n");
- print_generic_expr (vect_dump, SSA_NAME_DEF_STMT (vec_def), TDF_SLIM);
+ print_gimple_stmt (vect_dump, SSA_NAME_DEF_STMT (vec_def), 0, TDF_SLIM);
}
STMT_VINFO_VEC_STMT (phi_info) = induction_phi;
@@ -1823,11 +1847,11 @@ get_initial_def_for_induction (tree iv_phi)
needs to be introduced. */
static tree
-vect_get_vec_def_for_operand (tree op, tree stmt, tree *scalar_def)
+vect_get_vec_def_for_operand (tree op, gimple stmt, tree *scalar_def)
{
tree vec_oprnd;
- tree vec_stmt;
- tree def_stmt;
+ gimple vec_stmt;
+ gimple def_stmt;
stmt_vec_info def_stmt_info = NULL;
stmt_vec_info stmt_vinfo = vinfo_for_stmt (stmt);
tree vectype = STMT_VINFO_VECTYPE (stmt_vinfo);
@@ -1860,7 +1884,7 @@ vect_get_vec_def_for_operand (tree op, tree stmt, tree *scalar_def)
if (def_stmt)
{
fprintf (vect_dump, " def_stmt = ");
- print_generic_expr (vect_dump, def_stmt, TDF_SLIM);
+ print_gimple_stmt (vect_dump, def_stmt, 0, TDF_SLIM);
}
}
@@ -1913,16 +1937,18 @@ vect_get_vec_def_for_operand (tree op, tree stmt, tree *scalar_def)
case vect_loop_def:
{
if (scalar_def)
- *scalar_def = def_stmt;
+ *scalar_def = NULL/* FIXME tuples: def_stmt*/;
/* Get the def from the vectorized stmt. */
def_stmt_info = vinfo_for_stmt (def_stmt);
vec_stmt = STMT_VINFO_VEC_STMT (def_stmt_info);
gcc_assert (vec_stmt);
- if (TREE_CODE (vec_stmt) == PHI_NODE)
+ if (gimple_code (vec_stmt) == GIMPLE_PHI)
vec_oprnd = PHI_RESULT (vec_stmt);
+ else if (is_gimple_call (vec_stmt))
+ vec_oprnd = gimple_call_lhs (vec_stmt);
else
- vec_oprnd = GIMPLE_STMT_OPERAND (vec_stmt, 0);
+ vec_oprnd = gimple_assign_lhs (vec_stmt);
return vec_oprnd;
}
@@ -1931,8 +1957,8 @@ vect_get_vec_def_for_operand (tree op, tree stmt, tree *scalar_def)
{
struct loop *loop;
- gcc_assert (TREE_CODE (def_stmt) == PHI_NODE);
- loop = (bb_for_stmt (def_stmt))->loop_father;
+ gcc_assert (gimple_code (def_stmt) == GIMPLE_PHI);
+ loop = (gimple_bb (def_stmt))->loop_father;
/* Get the def before the loop */
op = PHI_ARG_DEF_FROM_EDGE (def_stmt, loop_preheader_edge (loop));
@@ -1942,12 +1968,12 @@ vect_get_vec_def_for_operand (tree op, tree stmt, tree *scalar_def)
/* Case 5: operand is defined by loop-header phi - induction. */
case vect_induction_def:
{
- gcc_assert (TREE_CODE (def_stmt) == PHI_NODE);
+ gcc_assert (gimple_code (def_stmt) == GIMPLE_PHI);
/* Get the def from the vectorized stmt. */
def_stmt_info = vinfo_for_stmt (def_stmt);
vec_stmt = STMT_VINFO_VEC_STMT (def_stmt_info);
- gcc_assert (vec_stmt && (TREE_CODE (vec_stmt) == PHI_NODE));
+ gcc_assert (vec_stmt && gimple_code (vec_stmt) == GIMPLE_PHI);
vec_oprnd = PHI_RESULT (vec_stmt);
return vec_oprnd;
}
@@ -2017,7 +2043,7 @@ vect_get_vec_def_for_operand (tree op, tree stmt, tree *scalar_def)
static tree
vect_get_vec_def_for_stmt_copy (enum vect_def_type dt, tree vec_oprnd)
{
- tree vec_stmt_for_operand;
+ gimple vec_stmt_for_operand;
stmt_vec_info def_stmt_info;
/* Do nothing; can reuse same def. */
@@ -2029,7 +2055,11 @@ vect_get_vec_def_for_stmt_copy (enum vect_def_type dt, tree vec_oprnd)
gcc_assert (def_stmt_info);
vec_stmt_for_operand = STMT_VINFO_RELATED_STMT (def_stmt_info);
gcc_assert (vec_stmt_for_operand);
- vec_oprnd = GIMPLE_STMT_OPERAND (vec_stmt_for_operand, 0);
+ vec_oprnd = gimple_get_lhs (vec_stmt_for_operand);
+ if (gimple_code (vec_stmt_for_operand) == GIMPLE_PHI)
+ vec_oprnd = PHI_RESULT (vec_stmt_for_operand);
+ else
+ vec_oprnd = gimple_get_lhs (vec_stmt_for_operand);
return vec_oprnd;
}
@@ -2059,8 +2089,9 @@ vect_get_vec_defs_for_stmt_copy (enum vect_def_type *dt,
/* Get vectorized definitions for OP0 and OP1, or SLP_NODE if it is not NULL. */
static void
-vect_get_vec_defs (tree op0, tree op1, tree stmt, VEC(tree,heap) **vec_oprnds0,
- VEC(tree,heap) **vec_oprnds1, slp_tree slp_node)
+vect_get_vec_defs (tree op0, tree op1, gimple stmt,
+ VEC(tree,heap) **vec_oprnds0, VEC(tree,heap) **vec_oprnds1,
+ slp_tree slp_node)
{
if (slp_node)
vect_get_slp_defs (slp_node, vec_oprnds0, vec_oprnds1);
@@ -2087,30 +2118,29 @@ vect_get_vec_defs (tree op0, tree op1, tree stmt, VEC(tree,heap) **vec_oprnds0,
Insert a new stmt. */
static void
-vect_finish_stmt_generation (tree stmt, tree vec_stmt,
- block_stmt_iterator *bsi)
+vect_finish_stmt_generation (gimple stmt, gimple vec_stmt,
+ gimple_stmt_iterator *gsi)
{
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info);
- gcc_assert (stmt == bsi_stmt (*bsi));
- gcc_assert (TREE_CODE (stmt) != LABEL_EXPR);
+ gcc_assert (stmt == gsi_stmt (*gsi));
+ gcc_assert (gimple_code (stmt) != GIMPLE_LABEL);
- bsi_insert_before (bsi, vec_stmt, BSI_SAME_STMT);
+ gsi_insert_before (gsi, vec_stmt, GSI_SAME_STMT);
- set_stmt_info (get_stmt_ann (vec_stmt),
- new_stmt_vec_info (vec_stmt, loop_vinfo));
+ set_vinfo_for_stmt (vec_stmt, new_stmt_vec_info (vec_stmt, loop_vinfo));
if (vect_print_dump_info (REPORT_DETAILS))
{
fprintf (vect_dump, "add new stmt: ");
- print_generic_expr (vect_dump, vec_stmt, TDF_SLIM);
+ print_gimple_stmt (vect_dump, vec_stmt, 0, TDF_SLIM);
}
- /* Make sure bsi points to the stmt that is being vectorized. */
- gcc_assert (stmt == bsi_stmt (*bsi));
+ /* Make sure gsi points to the stmt that is being vectorized. */
+ gcc_assert (stmt == gsi_stmt (*gsi));
- SET_EXPR_LOCATION (vec_stmt, EXPR_LOCATION (stmt));
+ gimple_set_location (vec_stmt, gimple_location (stmt));
}
@@ -2158,14 +2188,14 @@ vect_finish_stmt_generation (tree stmt, tree vec_stmt,
A cost model should help decide between these two schemes. */
static tree
-get_initial_def_for_reduction (tree stmt, tree init_val, tree *adjustment_def)
+get_initial_def_for_reduction (gimple stmt, tree init_val, tree *adjustment_def)
{
stmt_vec_info stmt_vinfo = vinfo_for_stmt (stmt);
loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_vinfo);
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
tree vectype = STMT_VINFO_VECTYPE (stmt_vinfo);
int nunits = TYPE_VECTOR_SUBPARTS (vectype);
- enum tree_code code = TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 1));
+ enum tree_code code = gimple_assign_rhs_code (stmt);
tree type = TREE_TYPE (init_val);
tree vecdef;
tree def_for_init;
@@ -2179,7 +2209,7 @@ get_initial_def_for_reduction (tree stmt, tree init_val, tree *adjustment_def)
if (nested_in_vect_loop_p (loop, stmt))
nested_in_vect_loop = true;
else
- gcc_assert (loop == (bb_for_stmt (stmt))->loop_father);
+ gcc_assert (loop == (gimple_bb (stmt))->loop_father);
vecdef = vect_get_vec_def_for_operand (init_val, stmt, NULL);
@@ -2225,6 +2255,11 @@ get_initial_def_for_reduction (tree stmt, tree init_val, tree *adjustment_def)
VECT_DEF is a vector of partial results.
REDUC_CODE is the tree-code for the epilog reduction.
+ NCOPIES is > 1 in case the vectorization factor (VF) is bigger than the
+ number of elements that we can fit in a vectype (nunits). In this case
+ we have to generate more than one vector stmt - i.e - we need to "unroll"
+ the vector stmt by a factor VF/nunits. For more details see documentation
+ in vectorizable_operation.
STMT is the scalar reduction stmt that is being vectorized.
REDUCTION_PHI is the phi-node that carries the reduction computation.
@@ -2267,10 +2302,13 @@ get_initial_def_for_reduction (tree stmt, tree init_val, tree *adjustment_def)
*/
static void
-vect_create_epilog_for_reduction (tree vect_def, tree stmt,
- enum tree_code reduc_code, tree reduction_phi)
+vect_create_epilog_for_reduction (tree vect_def, gimple stmt,
+ int ncopies,
+ enum tree_code reduc_code,
+ gimple reduction_phi)
{
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
+ stmt_vec_info prev_phi_info;
tree vectype;
enum machine_mode mode;
loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info);
@@ -2278,29 +2316,29 @@ vect_create_epilog_for_reduction (tree vect_def, tree stmt,
basic_block exit_bb;
tree scalar_dest;
tree scalar_type;
- tree new_phi;
- block_stmt_iterator exit_bsi;
+ gimple new_phi = NULL, phi;
+ gimple_stmt_iterator exit_gsi;
tree vec_dest;
tree new_temp = NULL_TREE;
tree new_name;
- tree epilog_stmt = NULL_TREE;
- tree new_scalar_dest, exit_phi, new_dest;
+ gimple epilog_stmt = NULL;
+ tree new_scalar_dest, new_dest;
+ gimple exit_phi;
tree bitsize, bitpos, bytesize;
- enum tree_code code = TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 1));
+ enum tree_code code = gimple_assign_rhs_code (stmt);
tree adjustment_def;
- tree vec_initial_def;
+ tree vec_initial_def, def;
tree orig_name;
imm_use_iterator imm_iter;
use_operand_p use_p;
bool extract_scalar_result = false;
tree reduction_op, expr;
- tree orig_stmt;
- tree use_stmt;
- tree operation = GIMPLE_STMT_OPERAND (stmt, 1);
+ gimple orig_stmt;
+ gimple use_stmt;
bool nested_in_vect_loop = false;
- int op_type;
- VEC(tree,heap) *phis = NULL;
- int i;
+ VEC(gimple,heap) *phis = NULL;
+ enum vect_def_type dt = vect_unknown_def_type;
+ int j, i;
if (nested_in_vect_loop_p (loop, stmt))
{
@@ -2308,33 +2346,56 @@ vect_create_epilog_for_reduction (tree vect_def, tree stmt,
nested_in_vect_loop = true;
}
- op_type = TREE_OPERAND_LENGTH (operation);
- reduction_op = TREE_OPERAND (operation, op_type-1);
+ switch (get_gimple_rhs_class (gimple_assign_rhs_code (stmt)))
+ {
+ case GIMPLE_SINGLE_RHS:
+ gcc_assert (TREE_OPERAND_LENGTH (gimple_assign_rhs1 (stmt)) == ternary_op);
+ reduction_op = TREE_OPERAND (gimple_assign_rhs1 (stmt), 2);
+ break;
+ case GIMPLE_UNARY_RHS:
+ reduction_op = gimple_assign_rhs1 (stmt);
+ break;
+ case GIMPLE_BINARY_RHS:
+ reduction_op = gimple_assign_rhs2 (stmt);
+ break;
+ default:
+ gcc_unreachable ();
+ }
+
vectype = get_vectype_for_scalar_type (TREE_TYPE (reduction_op));
gcc_assert (vectype);
mode = TYPE_MODE (vectype);
/*** 1. Create the reduction def-use cycle ***/
- /* 1.1 set the loop-entry arg of the reduction-phi: */
/* For the case of reduction, vect_get_vec_def_for_operand returns
the scalar def before the loop, that defines the initial value
of the reduction variable. */
vec_initial_def = vect_get_vec_def_for_operand (reduction_op, stmt,
&adjustment_def);
- add_phi_arg (reduction_phi, vec_initial_def, loop_preheader_edge (loop));
- /* 1.2 set the loop-latch arg for the reduction-phi: */
- add_phi_arg (reduction_phi, vect_def, loop_latch_edge (loop));
-
- if (vect_print_dump_info (REPORT_DETAILS))
+ phi = reduction_phi;
+ def = vect_def;
+ for (j = 0; j < ncopies; j++)
{
- fprintf (vect_dump, "transform reduction: created def-use cycle:");
- print_generic_expr (vect_dump, reduction_phi, TDF_SLIM);
- fprintf (vect_dump, "\n");
- print_generic_expr (vect_dump, SSA_NAME_DEF_STMT (vect_def), TDF_SLIM);
- }
+ /* 1.1 set the loop-entry arg of the reduction-phi: */
+ add_phi_arg (phi, vec_initial_def, loop_preheader_edge (loop));
+
+ /* 1.2 set the loop-latch arg for the reduction-phi: */
+ if (j > 0)
+ def = vect_get_vec_def_for_stmt_copy (dt, def);
+ add_phi_arg (phi, def, loop_latch_edge (loop));
+
+ if (vect_print_dump_info (REPORT_DETAILS))
+ {
+ fprintf (vect_dump, "transform reduction: created def-use cycle: ");
+ print_gimple_stmt (vect_dump, phi, 0, TDF_SLIM);
+ fprintf (vect_dump, "\n");
+ print_gimple_stmt (vect_dump, SSA_NAME_DEF_STMT (def), 0, TDF_SLIM);
+ }
+ phi = STMT_VINFO_RELATED_STMT (vinfo_for_stmt (phi));
+ }
/*** 2. Create epilog code
The reduction epilog code operates across the elements of the vector
@@ -2358,7 +2419,7 @@ vect_create_epilog_for_reduction (tree vect_def, tree stmt,
s_out3 = extract_field <v_out2, 0> # step 2
s_out4 = adjust_result <s_out3> # step 3
- (step 3 is optional, and step2 1 and 2 may be combined).
+ (step 3 is optional, and steps 1 and 2 may be combined).
Lastly, the uses of s_out0 are replaced by s_out4.
***/
@@ -2367,9 +2428,23 @@ vect_create_epilog_for_reduction (tree vect_def, tree stmt,
v_out1 = phi <v_loop> */
exit_bb = single_exit (loop)->dest;
- new_phi = create_phi_node (SSA_NAME_VAR (vect_def), exit_bb);
- SET_PHI_ARG_DEF (new_phi, single_exit (loop)->dest_idx, vect_def);
- exit_bsi = bsi_after_labels (exit_bb);
+ def = vect_def;
+ prev_phi_info = NULL;
+ for (j = 0; j < ncopies; j++)
+ {
+ phi = create_phi_node (SSA_NAME_VAR (vect_def), exit_bb);
+ set_vinfo_for_stmt (phi, new_stmt_vec_info (phi, loop_vinfo));
+ if (j == 0)
+ new_phi = phi;
+ else
+ {
+ def = vect_get_vec_def_for_stmt_copy (dt, def);
+ STMT_VINFO_RELATED_STMT (prev_phi_info) = phi;
+ }
+ SET_PHI_ARG_DEF (phi, single_exit (loop)->dest_idx, def);
+ prev_phi_info = vinfo_for_stmt (phi);
+ }
+ exit_gsi = gsi_after_labels (exit_bb);
/* 2.2 Get the relevant tree-code to use in the epilog for schemes 2,3
(i.e. when reduc_code is not available) and in the final adjustment
@@ -2393,8 +2468,8 @@ vect_create_epilog_for_reduction (tree vect_def, tree stmt,
gcc_assert (STMT_VINFO_IN_PATTERN_P (stmt_vinfo));
gcc_assert (STMT_VINFO_RELATED_STMT (stmt_vinfo) == stmt);
}
- code = TREE_CODE (GIMPLE_STMT_OPERAND (orig_stmt, 1));
- scalar_dest = GIMPLE_STMT_OPERAND (orig_stmt, 0);
+ code = gimple_assign_rhs_code (orig_stmt);
+ scalar_dest = gimple_assign_lhs (orig_stmt);
scalar_type = TREE_TYPE (scalar_dest);
new_scalar_dest = vect_create_destination_var (scalar_dest, NULL);
bitsize = TYPE_SIZE (scalar_type);
@@ -2409,6 +2484,9 @@ vect_create_epilog_for_reduction (tree vect_def, tree stmt,
if (nested_in_vect_loop)
goto vect_finalize_reduction;
+ /* FORNOW */
+ gcc_assert (ncopies = 1);
+
/* 2.3 Create the reduction code, using one of the three schemes described
above. */
@@ -2424,10 +2502,10 @@ vect_create_epilog_for_reduction (tree vect_def, tree stmt,
vec_dest = vect_create_destination_var (scalar_dest, vectype);
tmp = build1 (reduc_code, vectype, PHI_RESULT (new_phi));
- epilog_stmt = build_gimple_modify_stmt (vec_dest, tmp);
+ epilog_stmt = gimple_build_assign (vec_dest, tmp);
new_temp = make_ssa_name (vec_dest, epilog_stmt);
- GIMPLE_STMT_OPERAND (epilog_stmt, 0) = new_temp;
- bsi_insert_before (&exit_bsi, epilog_stmt, BSI_SAME_STMT);
+ gimple_assign_set_lhs (epilog_stmt, new_temp);
+ gsi_insert_before (&exit_gsi, epilog_stmt, GSI_SAME_STMT);
extract_scalar_result = true;
}
@@ -2480,17 +2558,17 @@ vect_create_epilog_for_reduction (tree vect_def, tree stmt,
bit_offset /= 2)
{
tree bitpos = size_int (bit_offset);
- tree tmp = build2 (shift_code, vectype, new_temp, bitpos);
- epilog_stmt = build_gimple_modify_stmt (vec_dest, tmp);
+ epilog_stmt = gimple_build_assign_with_ops (shift_code, vec_dest,
+ new_temp, bitpos);
new_name = make_ssa_name (vec_dest, epilog_stmt);
- GIMPLE_STMT_OPERAND (epilog_stmt, 0) = new_name;
- bsi_insert_before (&exit_bsi, epilog_stmt, BSI_SAME_STMT);
+ gimple_assign_set_lhs (epilog_stmt, new_name);
+ gsi_insert_before (&exit_gsi, epilog_stmt, GSI_SAME_STMT);
- tmp = build2 (code, vectype, new_name, new_temp);
- epilog_stmt = build_gimple_modify_stmt (vec_dest, tmp);
+ epilog_stmt = gimple_build_assign_with_ops (code, vec_dest,
+ new_name, new_temp);
new_temp = make_ssa_name (vec_dest, epilog_stmt);
- GIMPLE_STMT_OPERAND (epilog_stmt, 0) = new_temp;
- bsi_insert_before (&exit_bsi, epilog_stmt, BSI_SAME_STMT);
+ gimple_assign_set_lhs (epilog_stmt, new_temp);
+ gsi_insert_before (&exit_gsi, epilog_stmt, GSI_SAME_STMT);
}
extract_scalar_result = true;
@@ -2516,30 +2594,30 @@ vect_create_epilog_for_reduction (tree vect_def, tree stmt,
vec_size_in_bits = tree_low_cst (TYPE_SIZE (vectype), 1);
rhs = build3 (BIT_FIELD_REF, scalar_type, vec_temp, bitsize,
bitsize_zero_node);
- epilog_stmt = build_gimple_modify_stmt (new_scalar_dest, rhs);
+ epilog_stmt = gimple_build_assign (new_scalar_dest, rhs);
new_temp = make_ssa_name (new_scalar_dest, epilog_stmt);
- GIMPLE_STMT_OPERAND (epilog_stmt, 0) = new_temp;
- bsi_insert_before (&exit_bsi, epilog_stmt, BSI_SAME_STMT);
+ gimple_assign_set_lhs (epilog_stmt, new_temp);
+ gsi_insert_before (&exit_gsi, epilog_stmt, GSI_SAME_STMT);
for (bit_offset = element_bitsize;
bit_offset < vec_size_in_bits;
bit_offset += element_bitsize)
{
- tree tmp;
tree bitpos = bitsize_int (bit_offset);
tree rhs = build3 (BIT_FIELD_REF, scalar_type, vec_temp, bitsize,
bitpos);
- epilog_stmt = build_gimple_modify_stmt (new_scalar_dest, rhs);
+ epilog_stmt = gimple_build_assign (new_scalar_dest, rhs);
new_name = make_ssa_name (new_scalar_dest, epilog_stmt);
- GIMPLE_STMT_OPERAND (epilog_stmt, 0) = new_name;
- bsi_insert_before (&exit_bsi, epilog_stmt, BSI_SAME_STMT);
+ gimple_assign_set_lhs (epilog_stmt, new_name);
+ gsi_insert_before (&exit_gsi, epilog_stmt, GSI_SAME_STMT);
- tmp = build2 (code, scalar_type, new_name, new_temp);
- epilog_stmt = build_gimple_modify_stmt (new_scalar_dest, tmp);
+ epilog_stmt = gimple_build_assign_with_ops (code,
+ new_scalar_dest,
+ new_name, new_temp);
new_temp = make_ssa_name (new_scalar_dest, epilog_stmt);
- GIMPLE_STMT_OPERAND (epilog_stmt, 0) = new_temp;
- bsi_insert_before (&exit_bsi, epilog_stmt, BSI_SAME_STMT);
+ gimple_assign_set_lhs (epilog_stmt, new_temp);
+ gsi_insert_before (&exit_gsi, epilog_stmt, GSI_SAME_STMT);
}
extract_scalar_result = false;
@@ -2565,10 +2643,10 @@ vect_create_epilog_for_reduction (tree vect_def, tree stmt,
bitpos = bitsize_zero_node;
rhs = build3 (BIT_FIELD_REF, scalar_type, new_temp, bitsize, bitpos);
- epilog_stmt = build_gimple_modify_stmt (new_scalar_dest, rhs);
+ epilog_stmt = gimple_build_assign (new_scalar_dest, rhs);
new_temp = make_ssa_name (new_scalar_dest, epilog_stmt);
- GIMPLE_STMT_OPERAND (epilog_stmt, 0) = new_temp;
- bsi_insert_before (&exit_bsi, epilog_stmt, BSI_SAME_STMT);
+ gimple_assign_set_lhs (epilog_stmt, new_temp);
+ gsi_insert_before (&exit_gsi, epilog_stmt, GSI_SAME_STMT);
}
vect_finalize_reduction:
@@ -2592,10 +2670,11 @@ vect_finalize_reduction:
expr = build2 (code, scalar_type, new_temp, adjustment_def);
new_dest = vect_create_destination_var (scalar_dest, scalar_type);
}
- epilog_stmt = build_gimple_modify_stmt (new_dest, expr);
+ epilog_stmt = gimple_build_assign (new_dest, expr);
new_temp = make_ssa_name (new_dest, epilog_stmt);
- GIMPLE_STMT_OPERAND (epilog_stmt, 0) = new_temp;
- bsi_insert_before (&exit_bsi, epilog_stmt, BSI_SAME_STMT);
+ gimple_assign_set_lhs (epilog_stmt, new_temp);
+ SSA_NAME_DEF_STMT (new_temp) = epilog_stmt;
+ gsi_insert_before (&exit_gsi, epilog_stmt, GSI_SAME_STMT);
}
@@ -2605,33 +2684,37 @@ vect_finalize_reduction:
Find the loop-closed-use at the loop exit of the original scalar result.
(The reduction result is expected to have two immediate uses - one at the
latch block, and one at the loop exit). */
- phis = VEC_alloc (tree, heap, 10);
+ phis = VEC_alloc (gimple, heap, 10);
FOR_EACH_IMM_USE_FAST (use_p, imm_iter, scalar_dest)
{
- if (!flow_bb_inside_loop_p (loop, bb_for_stmt (USE_STMT (use_p))))
+ if (!flow_bb_inside_loop_p (loop, gimple_bb (USE_STMT (use_p))))
{
exit_phi = USE_STMT (use_p);
- VEC_quick_push (tree, phis, exit_phi);
+ VEC_quick_push (gimple, phis, exit_phi);
}
}
/* We expect to have found an exit_phi because of loop-closed-ssa form. */
- gcc_assert (!VEC_empty (tree, phis));
+ gcc_assert (!VEC_empty (gimple, phis));
- for (i = 0; VEC_iterate (tree, phis, i, exit_phi); i++)
+ for (i = 0; VEC_iterate (gimple, phis, i, exit_phi); i++)
{
if (nested_in_vect_loop)
{
stmt_vec_info stmt_vinfo = vinfo_for_stmt (exit_phi);
- /* FORNOW. Currently not supporting the case that an inner-loop reduction
- is not used in the outer-loop (but only outside the outer-loop). */
+ /* FORNOW. Currently not supporting the case that an inner-loop
+ reduction is not used in the outer-loop (but only outside the
+ outer-loop). */
gcc_assert (STMT_VINFO_RELEVANT_P (stmt_vinfo)
&& !STMT_VINFO_LIVE_P (stmt_vinfo));
- epilog_stmt = adjustment_def ? epilog_stmt : new_phi;
+ epilog_stmt = adjustment_def ? epilog_stmt : new_phi;
STMT_VINFO_VEC_STMT (stmt_vinfo) = epilog_stmt;
- set_stmt_info (get_stmt_ann (epilog_stmt),
- new_stmt_vec_info (epilog_stmt, loop_vinfo));
+ set_vinfo_for_stmt (epilog_stmt,
+ new_stmt_vec_info (epilog_stmt, loop_vinfo));
+ if (adjustment_def)
+ STMT_VINFO_RELATED_STMT (vinfo_for_stmt (epilog_stmt)) =
+ STMT_VINFO_RELATED_STMT (vinfo_for_stmt (new_phi));
continue;
}
@@ -2641,7 +2724,7 @@ vect_finalize_reduction:
FOR_EACH_IMM_USE_ON_STMT (use_p, imm_iter)
SET_USE (use_p, new_temp);
}
- VEC_free (tree, heap, phis);
+ VEC_free (gimple, heap, phis);
}
@@ -2686,49 +2769,44 @@ vect_finalize_reduction:
does *NOT* necessarily hold for reduction patterns. */
bool
-vectorizable_reduction (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt)
+vectorizable_reduction (gimple stmt, gimple_stmt_iterator *gsi,
+ gimple *vec_stmt)
{
tree vec_dest;
tree scalar_dest;
- tree op;
tree loop_vec_def0 = NULL_TREE, loop_vec_def1 = NULL_TREE;
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
tree vectype = STMT_VINFO_VECTYPE (stmt_info);
loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info);
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
- tree operation;
enum tree_code code, orig_code, epilog_reduc_code = 0;
enum machine_mode vec_mode;
int op_type;
optab optab, reduc_optab;
tree new_temp = NULL_TREE;
- tree def, def_stmt;
+ tree def;
+ gimple def_stmt;
enum vect_def_type dt;
- tree new_phi;
+ gimple new_phi = NULL;
tree scalar_type;
bool is_simple_use;
- tree orig_stmt;
+ gimple orig_stmt;
stmt_vec_info orig_stmt_info;
tree expr = NULL_TREE;
int i;
int nunits = TYPE_VECTOR_SUBPARTS (vectype);
int ncopies = LOOP_VINFO_VECT_FACTOR (loop_vinfo) / nunits;
- stmt_vec_info prev_stmt_info;
+ int epilog_copies;
+ stmt_vec_info prev_stmt_info, prev_phi_info;
+ gimple first_phi = NULL;
+ bool single_defuse_cycle = false;
tree reduc_def;
- tree new_stmt = NULL_TREE;
+ gimple new_stmt = NULL;
int j;
+ tree ops[3];
if (nested_in_vect_loop_p (loop, stmt))
- {
- loop = loop->inner;
- /* FORNOW. This restriction should be relaxed. */
- if (ncopies > 1)
- {
- if (vect_print_dump_info (REPORT_DETAILS))
- fprintf (vect_dump, "multiple types in nested loop.");
- return false;
- }
- }
+ loop = loop->inner;
gcc_assert (ncopies >= 1);
@@ -2772,14 +2850,41 @@ vectorizable_reduction (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt)
inside the loop body. The last operand is the reduction variable,
which is defined by the loop-header-phi. */
- gcc_assert (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT);
+ gcc_assert (is_gimple_assign (stmt));
- operation = GIMPLE_STMT_OPERAND (stmt, 1);
- code = TREE_CODE (operation);
- op_type = TREE_OPERAND_LENGTH (operation);
- if (op_type != binary_op && op_type != ternary_op)
- return false;
- scalar_dest = GIMPLE_STMT_OPERAND (stmt, 0);
+ /* Flatten RHS */
+ switch (get_gimple_rhs_class (gimple_assign_rhs_code (stmt)))
+ {
+ case GIMPLE_SINGLE_RHS:
+ op_type = TREE_OPERAND_LENGTH (gimple_assign_rhs1 (stmt));
+ if (op_type == ternary_op)
+ {
+ tree rhs = gimple_assign_rhs1 (stmt);
+ ops[0] = TREE_OPERAND (rhs, 0);
+ ops[1] = TREE_OPERAND (rhs, 1);
+ ops[2] = TREE_OPERAND (rhs, 2);
+ code = TREE_CODE (rhs);
+ }
+ else
+ return false;
+ break;
+
+ case GIMPLE_BINARY_RHS:
+ code = gimple_assign_rhs_code (stmt);
+ op_type = TREE_CODE_LENGTH (code);
+ gcc_assert (op_type == binary_op);
+ ops[0] = gimple_assign_rhs1 (stmt);
+ ops[1] = gimple_assign_rhs2 (stmt);
+ break;
+
+ case GIMPLE_UNARY_RHS:
+ return false;
+
+ default:
+ gcc_unreachable ();
+ }
+
+ scalar_dest = gimple_assign_lhs (stmt);
scalar_type = TREE_TYPE (scalar_dest);
if (!POINTER_TYPE_P (scalar_type) && !INTEGRAL_TYPE_P (scalar_type)
&& !SCALAR_FLOAT_TYPE_P (scalar_type))
@@ -2789,8 +2894,8 @@ vectorizable_reduction (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt)
The last use is the reduction variable. */
for (i = 0; i < op_type-1; i++)
{
- op = TREE_OPERAND (operation, i);
- is_simple_use = vect_is_simple_use (op, loop_vinfo, &def_stmt, &def, &dt);
+ is_simple_use = vect_is_simple_use (ops[i], loop_vinfo, &def_stmt,
+ &def, &dt);
gcc_assert (is_simple_use);
if (dt != vect_loop_def
&& dt != vect_invariant_def
@@ -2799,11 +2904,10 @@ vectorizable_reduction (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt)
return false;
}
- op = TREE_OPERAND (operation, i);
- is_simple_use = vect_is_simple_use (op, loop_vinfo, &def_stmt, &def, &dt);
+ is_simple_use = vect_is_simple_use (ops[i], loop_vinfo, &def_stmt, &def, &dt);
gcc_assert (is_simple_use);
gcc_assert (dt == vect_reduction_def);
- gcc_assert (TREE_CODE (def_stmt) == PHI_NODE);
+ gcc_assert (gimple_code (def_stmt) == GIMPLE_PHI);
if (orig_stmt)
gcc_assert (orig_stmt == vect_is_simple_reduction (loop_vinfo, def_stmt));
else
@@ -2883,7 +2987,7 @@ vectorizable_reduction (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt)
{
/* This is a reduction pattern: get the vectype from the type of the
reduction variable, and get the tree-code from orig_stmt. */
- orig_code = TREE_CODE (GIMPLE_STMT_OPERAND (orig_stmt, 1));
+ orig_code = gimple_assign_rhs_code (orig_stmt);
vectype = get_vectype_for_scalar_type (TREE_TYPE (def));
if (!vectype)
{
@@ -2936,31 +3040,64 @@ vectorizable_reduction (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt)
/* Create the destination vector */
vec_dest = vect_create_destination_var (scalar_dest, vectype);
- /* Create the reduction-phi that defines the reduction-operand. */
- new_phi = create_phi_node (vec_dest, loop->header);
-
/* In case the vectorization factor (VF) is bigger than the number
of elements that we can fit in a vectype (nunits), we have to generate
more than one vector stmt - i.e - we need to "unroll" the
vector stmt by a factor VF/nunits. For more details see documentation
in vectorizable_operation. */
+ /* If the reduction is used in an outer loop we need to generate
+ VF intermediate results, like so (e.g. for ncopies=2):
+ r0 = phi (init, r0)
+ r1 = phi (init, r1)
+ r0 = x0 + r0;
+ r1 = x1 + r1;
+ (i.e. we generate VF results in 2 registers).
+ In this case we have a separate def-use cycle for each copy, and therefore
+ for each copy we get the vector def for the reduction variable from the
+ respective phi node created for this copy.
+
+ Otherwise (the reduction is unused in the loop nest), we can combine
+ together intermediate results, like so (e.g. for ncopies=2):
+ r = phi (init, r)
+ r = x0 + r;
+ r = x1 + r;
+ (i.e. we generate VF/2 results in a single register).
+ In this case for each copy we get the vector def for the reduction variable
+ from the vectorized reduction operation generated in the previous iteration.
+ */
+
+ if (STMT_VINFO_RELEVANT (stmt_info) == vect_unused_in_loop)
+ {
+ single_defuse_cycle = true;
+ epilog_copies = 1;
+ }
+ else
+ epilog_copies = ncopies;
+
prev_stmt_info = NULL;
+ prev_phi_info = NULL;
for (j = 0; j < ncopies; j++)
{
+ if (j == 0 || !single_defuse_cycle)
+ {
+ /* Create the reduction-phi that defines the reduction-operand. */
+ new_phi = create_phi_node (vec_dest, loop->header);
+ set_vinfo_for_stmt (new_phi, new_stmt_vec_info (new_phi, loop_vinfo));
+ }
+
/* Handle uses. */
if (j == 0)
{
- op = TREE_OPERAND (operation, 0);
- loop_vec_def0 = vect_get_vec_def_for_operand (op, stmt, NULL);
+ loop_vec_def0 = vect_get_vec_def_for_operand (ops[0], stmt, NULL);
if (op_type == ternary_op)
{
- op = TREE_OPERAND (operation, 1);
- loop_vec_def1 = vect_get_vec_def_for_operand (op, stmt, NULL);
+ loop_vec_def1 = vect_get_vec_def_for_operand (ops[1], stmt, NULL);
}
/* Get the vector def for the reduction variable from the phi node */
reduc_def = PHI_RESULT (new_phi);
+ first_phi = new_phi;
}
else
{
@@ -2969,9 +3106,12 @@ vectorizable_reduction (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt)
if (op_type == ternary_op)
loop_vec_def1 = vect_get_vec_def_for_stmt_copy (dt, loop_vec_def1);
- /* Get the vector def for the reduction variable from the vectorized
- reduction operation generated in the previous iteration (j-1) */
- reduc_def = GIMPLE_STMT_OPERAND (new_stmt ,0);
+ if (single_defuse_cycle)
+ reduc_def = gimple_assign_lhs (new_stmt);
+ else
+ reduc_def = PHI_RESULT (new_phi);
+
+ STMT_VINFO_RELATED_STMT (prev_phi_info) = new_phi;
}
/* Arguments are ready. create the new vector stmt. */
@@ -2980,21 +3120,25 @@ vectorizable_reduction (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt)
else
expr = build3 (code, vectype, loop_vec_def0, loop_vec_def1,
reduc_def);
- new_stmt = build_gimple_modify_stmt (vec_dest, expr);
+ new_stmt = gimple_build_assign (vec_dest, expr);
new_temp = make_ssa_name (vec_dest, new_stmt);
- GIMPLE_STMT_OPERAND (new_stmt, 0) = new_temp;
- vect_finish_stmt_generation (stmt, new_stmt, bsi);
+ gimple_assign_set_lhs (new_stmt, new_temp);
+ vect_finish_stmt_generation (stmt, new_stmt, gsi);
if (j == 0)
STMT_VINFO_VEC_STMT (stmt_info) = *vec_stmt = new_stmt;
else
STMT_VINFO_RELATED_STMT (prev_stmt_info) = new_stmt;
prev_stmt_info = vinfo_for_stmt (new_stmt);
+ prev_phi_info = vinfo_for_stmt (new_phi);
}
/* Finalize the reduction-phi (set it's arguments) and create the
epilog reduction code. */
- vect_create_epilog_for_reduction (new_temp, stmt, epilog_reduc_code, new_phi);
+ if (!single_defuse_cycle)
+ new_temp = gimple_assign_lhs (*vec_stmt);
+ vect_create_epilog_for_reduction (new_temp, stmt, epilog_copies,
+ epilog_reduc_code, first_phi);
return true;
}
@@ -3003,14 +3147,14 @@ vectorizable_reduction (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt)
of the function, or NULL_TREE if the function cannot be vectorized. */
tree
-vectorizable_function (tree call, tree vectype_out, tree vectype_in)
+vectorizable_function (gimple call, tree vectype_out, tree vectype_in)
{
- tree fndecl = get_callee_fndecl (call);
+ tree fndecl = gimple_call_fndecl (call);
enum built_in_function code;
/* We only handle functions that do not read or clobber memory -- i.e.
const or novops ones. */
- if (!(call_expr_flags (call) & (ECF_CONST | ECF_NOVOPS)))
+ if (!(gimple_call_flags (call) & (ECF_CONST | ECF_NOVOPS)))
return NULL_TREE;
if (!fndecl
@@ -3031,11 +3175,10 @@ vectorizable_function (tree call, tree vectype_out, tree vectype_in)
Return FALSE if not a vectorizable STMT, TRUE otherwise. */
bool
-vectorizable_call (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt)
+vectorizable_call (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt)
{
tree vec_dest;
tree scalar_dest;
- tree operation;
tree op, type;
tree vec_oprnd0 = NULL_TREE, vec_oprnd1 = NULL_TREE;
stmt_vec_info stmt_info = vinfo_for_stmt (stmt), prev_stmt_info;
@@ -3043,14 +3186,14 @@ vectorizable_call (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt)
int nunits_in;
int nunits_out;
loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info);
- struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
- tree fndecl, rhs, new_temp, def, def_stmt, rhs_type, lhs_type;
+ tree fndecl, new_temp, def, rhs_type, lhs_type;
+ gimple def_stmt;
enum vect_def_type dt[2] = {vect_unknown_def_type, vect_unknown_def_type};
- tree new_stmt;
- int ncopies, j, nargs;
- call_expr_arg_iterator iter;
- tree vargs;
+ gimple new_stmt;
+ int ncopies, j;
+ VEC(tree, heap) *vargs = NULL;
enum { NARROW, NONE, WIDEN } modifier;
+ size_t i, nargs;
if (!STMT_VINFO_RELEVANT_P (stmt_info))
return false;
@@ -3063,26 +3206,25 @@ vectorizable_call (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt)
return false;
/* Is STMT a vectorizable call? */
- if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
- return false;
-
- if (TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 0)) != SSA_NAME)
+ if (!is_gimple_call (stmt))
return false;
- operation = GIMPLE_STMT_OPERAND (stmt, 1);
- if (TREE_CODE (operation) != CALL_EXPR)
+ if (TREE_CODE (gimple_call_lhs (stmt)) != SSA_NAME)
return false;
/* Process function arguments. */
rhs_type = NULL_TREE;
- nargs = 0;
- FOR_EACH_CALL_EXPR_ARG (op, iter, operation)
+ nargs = gimple_call_num_args (stmt);
+
+ /* Bail out if the function has more than two arguments, we
+ do not have interesting builtin functions to vectorize with
+ more than two arguments. No arguments is also not good. */
+ if (nargs == 0 || nargs > 2)
+ return false;
+
+ for (i = 0; i < nargs; i++)
{
- /* Bail out if the function has more than two arguments, we
- do not have interesting builtin functions to vectorize with
- more than two arguments. */
- if (nargs >= 2)
- return false;
+ op = gimple_call_arg (stmt, i);
/* We can only handle calls with arguments of the same type. */
if (rhs_type
@@ -3094,26 +3236,20 @@ vectorizable_call (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt)
}
rhs_type = TREE_TYPE (op);
- if (!vect_is_simple_use (op, loop_vinfo, &def_stmt, &def, &dt[nargs]))
+ if (!vect_is_simple_use (op, loop_vinfo, &def_stmt, &def, &dt[i]))
{
if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "use not simple.");
return false;
}
-
- ++nargs;
}
- /* No arguments is also not good. */
- if (nargs == 0)
- return false;
-
vectype_in = get_vectype_for_scalar_type (rhs_type);
if (!vectype_in)
return false;
nunits_in = TYPE_VECTOR_SUBPARTS (vectype_in);
- lhs_type = TREE_TYPE (GIMPLE_STMT_OPERAND (stmt, 0));
+ lhs_type = TREE_TYPE (gimple_call_lhs (stmt));
vectype_out = get_vectype_for_scalar_type (lhs_type);
if (!vectype_out)
return false;
@@ -3133,7 +3269,7 @@ vectorizable_call (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt)
is available. TODO -- in some cases, it might be profitable to
insert the calls for pieces of the vector, in order to be able
to vectorize other operations in the loop. */
- fndecl = vectorizable_function (operation, vectype_out, vectype_in);
+ fndecl = vectorizable_function (stmt, vectype_out, vectype_in);
if (fndecl == NULL_TREE)
{
if (vect_print_dump_info (REPORT_DETAILS))
@@ -3153,14 +3289,6 @@ vectorizable_call (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt)
needs to be generated. */
gcc_assert (ncopies >= 1);
- /* FORNOW. This restriction should be relaxed. */
- if (nested_in_vect_loop_p (loop, stmt) && ncopies > 1)
- {
- if (vect_print_dump_info (REPORT_DETAILS))
- fprintf (vect_dump, "multiple types in nested loop.");
- return false;
- }
-
if (!vec_stmt) /* transformation not required. */
{
STMT_VINFO_TYPE (stmt_info) = call_vec_info_type;
@@ -3175,16 +3303,8 @@ vectorizable_call (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt)
if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "transform operation.");
- /* FORNOW. This restriction should be relaxed. */
- if (nested_in_vect_loop_p (loop, stmt) && ncopies > 1)
- {
- if (vect_print_dump_info (REPORT_DETAILS))
- fprintf (vect_dump, "multiple types in nested loop.");
- return false;
- }
-
/* Handle def. */
- scalar_dest = GIMPLE_STMT_OPERAND (stmt, 0);
+ scalar_dest = gimple_call_lhs (stmt);
vec_dest = vect_create_destination_var (scalar_dest, vectype_out);
prev_stmt_info = NULL;
@@ -3194,12 +3314,14 @@ vectorizable_call (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt)
for (j = 0; j < ncopies; ++j)
{
/* Build argument list for the vectorized call. */
- /* FIXME: Rewrite this so that it doesn't
- construct a temporary list. */
- vargs = NULL_TREE;
- nargs = 0;
- FOR_EACH_CALL_EXPR_ARG (op, iter, operation)
+ if (j == 0)
+ vargs = VEC_alloc (tree, heap, nargs);
+ else
+ VEC_truncate (tree, vargs, 0);
+
+ for (i = 0; i < nargs; i++)
{
+ op = gimple_call_arg (stmt, i);
if (j == 0)
vec_oprnd0
= vect_get_vec_def_for_operand (op, stmt, NULL);
@@ -3207,18 +3329,14 @@ vectorizable_call (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt)
vec_oprnd0
= vect_get_vec_def_for_stmt_copy (dt[nargs], vec_oprnd0);
- vargs = tree_cons (NULL_TREE, vec_oprnd0, vargs);
-
- ++nargs;
+ VEC_quick_push (tree, vargs, vec_oprnd0);
}
- vargs = nreverse (vargs);
- rhs = build_function_call_expr (fndecl, vargs);
- new_stmt = build_gimple_modify_stmt (vec_dest, rhs);
+ new_stmt = gimple_build_call_vec (fndecl, vargs);
new_temp = make_ssa_name (vec_dest, new_stmt);
- GIMPLE_STMT_OPERAND (new_stmt, 0) = new_temp;
+ gimple_call_set_lhs (new_stmt, new_temp);
- vect_finish_stmt_generation (stmt, new_stmt, bsi);
+ vect_finish_stmt_generation (stmt, new_stmt, gsi);
if (j == 0)
STMT_VINFO_VEC_STMT (stmt_info) = *vec_stmt = new_stmt;
@@ -3234,12 +3352,14 @@ vectorizable_call (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt)
for (j = 0; j < ncopies; ++j)
{
/* Build argument list for the vectorized call. */
- /* FIXME: Rewrite this so that it doesn't
- construct a temporary list. */
- vargs = NULL_TREE;
- nargs = 0;
- FOR_EACH_CALL_EXPR_ARG (op, iter, operation)
+ if (j == 0)
+ vargs = VEC_alloc (tree, heap, nargs * 2);
+ else
+ VEC_truncate (tree, vargs, 0);
+
+ for (i = 0; i < nargs; i++)
{
+ op = gimple_call_arg (stmt, i);
if (j == 0)
{
vec_oprnd0
@@ -3255,19 +3375,15 @@ vectorizable_call (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt)
= vect_get_vec_def_for_stmt_copy (dt[nargs], vec_oprnd0);
}
- vargs = tree_cons (NULL_TREE, vec_oprnd0, vargs);
- vargs = tree_cons (NULL_TREE, vec_oprnd1, vargs);
-
- ++nargs;
+ VEC_quick_push (tree, vargs, vec_oprnd0);
+ VEC_quick_push (tree, vargs, vec_oprnd1);
}
- vargs = nreverse (vargs);
- rhs = build_function_call_expr (fndecl, vargs);
- new_stmt = build_gimple_modify_stmt (vec_dest, rhs);
+ new_stmt = gimple_build_call_vec (fndecl, vargs);
new_temp = make_ssa_name (vec_dest, new_stmt);
- GIMPLE_STMT_OPERAND (new_stmt, 0) = new_temp;
+ gimple_call_set_lhs (new_stmt, new_temp);
- vect_finish_stmt_generation (stmt, new_stmt, bsi);
+ vect_finish_stmt_generation (stmt, new_stmt, gsi);
if (j == 0)
STMT_VINFO_VEC_STMT (stmt_info) = new_stmt;
@@ -3286,13 +3402,21 @@ vectorizable_call (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt)
return false;
}
+ VEC_free (tree, heap, vargs);
+
/* The call in STMT might prevent it from being removed in dce.
We however cannot remove it here, due to the way the ssa name
it defines is mapped to the new definition. So just replace
rhs of the statement with something harmless. */
+
type = TREE_TYPE (scalar_dest);
- GIMPLE_STMT_OPERAND (stmt, 1) = fold_convert (type, integer_zero_node);
- update_stmt (stmt);
+ new_stmt = gimple_build_assign (gimple_call_lhs (stmt),
+ fold_convert (type, integer_zero_node));
+ set_vinfo_for_stmt (new_stmt, stmt_info);
+ set_vinfo_for_stmt (stmt, NULL);
+ STMT_VINFO_STMT (stmt_info) = new_stmt;
+ gsi_replace (gsi, new_stmt, false);
+ SSA_NAME_DEF_STMT (gimple_assign_lhs (new_stmt)) = new_stmt;
return true;
}
@@ -3307,14 +3431,15 @@ vectorizable_call (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt)
needs to be created (DECL is a function-decl of a target-builtin).
STMT is the original scalar stmt that we are vectorizing. */
-static tree
-vect_gen_widened_results_half (enum tree_code code, tree vectype, tree decl,
+static gimple
+vect_gen_widened_results_half (enum tree_code code,
+ tree vectype ATTRIBUTE_UNUSED,
+ tree decl,
tree vec_oprnd0, tree vec_oprnd1, int op_type,
- tree vec_dest, block_stmt_iterator *bsi,
- tree stmt)
+ tree vec_dest, gimple_stmt_iterator *gsi,
+ gimple stmt)
{
- tree expr;
- tree new_stmt;
+ gimple new_stmt;
tree new_temp;
tree sym;
ssa_op_iter iter;
@@ -3324,23 +3449,24 @@ vect_gen_widened_results_half (enum tree_code code, tree vectype, tree decl,
{
/* Target specific support */
if (op_type == binary_op)
- expr = build_call_expr (decl, 2, vec_oprnd0, vec_oprnd1);
+ new_stmt = gimple_build_call (decl, 2, vec_oprnd0, vec_oprnd1);
else
- expr = build_call_expr (decl, 1, vec_oprnd0);
+ new_stmt = gimple_build_call (decl, 1, vec_oprnd0);
+ new_temp = make_ssa_name (vec_dest, new_stmt);
+ gimple_call_set_lhs (new_stmt, new_temp);
}
else
- {
+ {
/* Generic support */
gcc_assert (op_type == TREE_CODE_LENGTH (code));
- if (op_type == binary_op)
- expr = build2 (code, vectype, vec_oprnd0, vec_oprnd1);
- else
- expr = build1 (code, vectype, vec_oprnd0);
+ if (op_type != binary_op)
+ vec_oprnd1 = NULL;
+ new_stmt = gimple_build_assign_with_ops (code, vec_dest, vec_oprnd0,
+ vec_oprnd1);
+ new_temp = make_ssa_name (vec_dest, new_stmt);
+ gimple_assign_set_lhs (new_stmt, new_temp);
}
- new_stmt = build_gimple_modify_stmt (vec_dest, expr);
- new_temp = make_ssa_name (vec_dest, new_stmt);
- GIMPLE_STMT_OPERAND (new_stmt, 0) = new_temp;
- vect_finish_stmt_generation (stmt, new_stmt, bsi);
+ vect_finish_stmt_generation (stmt, new_stmt, gsi);
if (code == CALL_EXPR)
{
@@ -3362,23 +3488,22 @@ vect_gen_widened_results_half (enum tree_code code, tree vectype, tree decl,
Return FALSE if not a vectorizable STMT, TRUE otherwise. */
bool
-vectorizable_conversion (tree stmt, block_stmt_iterator *bsi,
- tree *vec_stmt, slp_tree slp_node)
+vectorizable_conversion (gimple stmt, gimple_stmt_iterator *gsi,
+ gimple *vec_stmt, slp_tree slp_node)
{
tree vec_dest;
tree scalar_dest;
- tree operation;
tree op0;
tree vec_oprnd0 = NULL_TREE, vec_oprnd1 = NULL_TREE;
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info);
- struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
enum tree_code code, code1 = ERROR_MARK, code2 = ERROR_MARK;
tree decl1 = NULL_TREE, decl2 = NULL_TREE;
tree new_temp;
- tree def, def_stmt;
+ tree def;
+ gimple def_stmt;
enum vect_def_type dt[2] = {vect_unknown_def_type, vect_unknown_def_type};
- tree new_stmt = NULL_TREE;
+ gimple new_stmt = NULL;
stmt_vec_info prev_stmt_info;
int nunits_in;
int nunits_out;
@@ -3391,6 +3516,9 @@ vectorizable_conversion (tree stmt, block_stmt_iterator *bsi,
int i;
VEC(tree,heap) *vec_oprnds0 = NULL;
tree vop0;
+ tree integral_type;
+ tree dummy;
+ bool dummy_bool;
/* Is STMT a vectorizable conversion? */
@@ -3400,26 +3528,25 @@ vectorizable_conversion (tree stmt, block_stmt_iterator *bsi,
if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_loop_def)
return false;
- if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
+ if (!is_gimple_assign (stmt))
return false;
- if (TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 0)) != SSA_NAME)
+ if (TREE_CODE (gimple_assign_lhs (stmt)) != SSA_NAME)
return false;
- operation = GIMPLE_STMT_OPERAND (stmt, 1);
- code = TREE_CODE (operation);
+ code = gimple_assign_rhs_code (stmt);
if (code != FIX_TRUNC_EXPR && code != FLOAT_EXPR)
return false;
/* Check types of lhs and rhs. */
- op0 = TREE_OPERAND (operation, 0);
+ op0 = gimple_assign_rhs1 (stmt);
rhs_type = TREE_TYPE (op0);
vectype_in = get_vectype_for_scalar_type (rhs_type);
if (!vectype_in)
return false;
nunits_in = TYPE_VECTOR_SUBPARTS (vectype_in);
- scalar_dest = GIMPLE_STMT_OPERAND (stmt, 0);
+ scalar_dest = gimple_assign_lhs (stmt);
lhs_type = TREE_TYPE (scalar_dest);
vectype_out = get_vectype_for_scalar_type (lhs_type);
if (!vectype_out)
@@ -3444,6 +3571,8 @@ vectorizable_conversion (tree stmt, block_stmt_iterator *bsi,
|| (!INTEGRAL_TYPE_P (rhs_type) && !INTEGRAL_TYPE_P (lhs_type)))
return false;
+ integral_type = INTEGRAL_TYPE_P (rhs_type) ? vectype_in : vectype_out;
+
if (modifier == NARROW)
ncopies = LOOP_VINFO_VECT_FACTOR (loop_vinfo) / nunits_out;
else
@@ -3458,14 +3587,6 @@ vectorizable_conversion (tree stmt, block_stmt_iterator *bsi,
needs to be generated. */
gcc_assert (ncopies >= 1);
- /* FORNOW. This restriction should be relaxed. */
- if (nested_in_vect_loop_p (loop, stmt) && ncopies > 1)
- {
- if (vect_print_dump_info (REPORT_DETAILS))
- fprintf (vect_dump, "multiple types in nested loop.");
- return false;
- }
-
/* Check the operands of the operation. */
if (!vect_is_simple_use (op0, loop_vinfo, &def_stmt, &def, &dt[0]))
{
@@ -3476,17 +3597,18 @@ vectorizable_conversion (tree stmt, block_stmt_iterator *bsi,
/* Supportable by target? */
if ((modifier == NONE
- && !targetm.vectorize.builtin_conversion (code, vectype_in))
+ && !targetm.vectorize.builtin_conversion (code, integral_type))
|| (modifier == WIDEN
&& !supportable_widening_operation (code, stmt, vectype_in,
&decl1, &decl2,
- &code1, &code2))
+ &code1, &code2,
+ &dummy_bool, &dummy))
|| (modifier == NARROW
&& !supportable_narrowing_operation (code, stmt, vectype_in,
- &code1)))
+ &code1, &dummy_bool, &dummy)))
{
if (vect_print_dump_info (REPORT_DETAILS))
- fprintf (vect_dump, "op not supported by target.");
+ fprintf (vect_dump, "conversion not supported by target.");
return false;
}
@@ -3529,16 +3651,14 @@ vectorizable_conversion (tree stmt, block_stmt_iterator *bsi,
vect_get_vec_defs_for_stmt_copy (dt, &vec_oprnds0, NULL);
builtin_decl =
- targetm.vectorize.builtin_conversion (code, vectype_in);
+ targetm.vectorize.builtin_conversion (code, integral_type);
for (i = 0; VEC_iterate (tree, vec_oprnds0, i, vop0); i++)
{
- new_stmt = build_call_expr (builtin_decl, 1, vop0);
-
/* Arguments are ready. create the new vector stmt. */
- new_stmt = build_gimple_modify_stmt (vec_dest, new_stmt);
+ new_stmt = gimple_build_call (builtin_decl, 1, vop0);
new_temp = make_ssa_name (vec_dest, new_stmt);
- GIMPLE_STMT_OPERAND (new_stmt, 0) = new_temp;
- vect_finish_stmt_generation (stmt, new_stmt, bsi);
+ gimple_call_set_lhs (new_stmt, new_temp);
+ vect_finish_stmt_generation (stmt, new_stmt, gsi);
FOR_EACH_SSA_TREE_OPERAND (sym, new_stmt, iter,
SSA_OP_ALL_VIRTUALS)
{
@@ -3547,7 +3667,7 @@ vectorizable_conversion (tree stmt, block_stmt_iterator *bsi,
mark_sym_for_renaming (sym);
}
if (slp_node)
- VEC_quick_push (tree, SLP_TREE_VEC_STMTS (slp_node), new_stmt);
+ VEC_quick_push (gimple, SLP_TREE_VEC_STMTS (slp_node), new_stmt);
}
if (j == 0)
@@ -3576,7 +3696,7 @@ vectorizable_conversion (tree stmt, block_stmt_iterator *bsi,
new_stmt
= vect_gen_widened_results_half (code1, vectype_out, decl1,
vec_oprnd0, vec_oprnd1,
- unary_op, vec_dest, bsi, stmt);
+ unary_op, vec_dest, gsi, stmt);
if (j == 0)
STMT_VINFO_VEC_STMT (stmt_info) = new_stmt;
else
@@ -3587,7 +3707,7 @@ vectorizable_conversion (tree stmt, block_stmt_iterator *bsi,
new_stmt
= vect_gen_widened_results_half (code2, vectype_out, decl2,
vec_oprnd0, vec_oprnd1,
- unary_op, vec_dest, bsi, stmt);
+ unary_op, vec_dest, gsi, stmt);
STMT_VINFO_RELATED_STMT (prev_stmt_info) = new_stmt;
prev_stmt_info = vinfo_for_stmt (new_stmt);
}
@@ -3614,10 +3734,11 @@ vectorizable_conversion (tree stmt, block_stmt_iterator *bsi,
/* Arguments are ready. Create the new vector stmt. */
expr = build2 (code1, vectype_out, vec_oprnd0, vec_oprnd1);
- new_stmt = build_gimple_modify_stmt (vec_dest, expr);
+ new_stmt = gimple_build_assign_with_ops (code1, vec_dest, vec_oprnd0,
+ vec_oprnd1);
new_temp = make_ssa_name (vec_dest, new_stmt);
- GIMPLE_STMT_OPERAND (new_stmt, 0) = new_temp;
- vect_finish_stmt_generation (stmt, new_stmt, bsi);
+ gimple_assign_set_lhs (new_stmt, new_temp);
+ vect_finish_stmt_generation (stmt, new_stmt, gsi);
if (j == 0)
STMT_VINFO_VEC_STMT (stmt_info) = new_stmt;
@@ -3645,8 +3766,8 @@ vectorizable_conversion (tree stmt, block_stmt_iterator *bsi,
Return FALSE if not a vectorizable STMT, TRUE otherwise. */
bool
-vectorizable_assignment (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt,
- slp_tree slp_node)
+vectorizable_assignment (gimple stmt, gimple_stmt_iterator *gsi,
+ gimple *vec_stmt, slp_tree slp_node)
{
tree vec_dest;
tree scalar_dest;
@@ -3655,7 +3776,8 @@ vectorizable_assignment (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt,
tree vectype = STMT_VINFO_VECTYPE (stmt_info);
loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info);
tree new_temp;
- tree def, def_stmt;
+ tree def;
+ gimple def_stmt;
enum vect_def_type dt[2] = {vect_unknown_def_type, vect_unknown_def_type};
int nunits = TYPE_VECTOR_SUBPARTS (vectype);
int ncopies = LOOP_VINFO_VECT_FACTOR (loop_vinfo) / nunits;
@@ -3679,14 +3801,19 @@ vectorizable_assignment (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt,
return false;
/* Is vectorizable assignment? */
- if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
+ if (!is_gimple_assign (stmt))
return false;
- scalar_dest = GIMPLE_STMT_OPERAND (stmt, 0);
+ scalar_dest = gimple_assign_lhs (stmt);
if (TREE_CODE (scalar_dest) != SSA_NAME)
return false;
- op = GIMPLE_STMT_OPERAND (stmt, 1);
+ if (gimple_assign_single_p (stmt)
+ || gimple_assign_rhs_code (stmt) == PAREN_EXPR)
+ op = gimple_assign_rhs1 (stmt);
+ else
+ return false;
+
if (!vect_is_simple_use (op, loop_vinfo, &def_stmt, &def, &dt[0]))
{
if (vect_print_dump_info (REPORT_DETAILS))
@@ -3716,14 +3843,14 @@ vectorizable_assignment (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt,
/* Arguments are ready. create the new vector stmt. */
for (i = 0; VEC_iterate (tree, vec_oprnds, i, vop); i++)
{
- *vec_stmt = build_gimple_modify_stmt (vec_dest, vop);
+ *vec_stmt = gimple_build_assign (vec_dest, vop);
new_temp = make_ssa_name (vec_dest, *vec_stmt);
- GIMPLE_STMT_OPERAND (*vec_stmt, 0) = new_temp;
- vect_finish_stmt_generation (stmt, *vec_stmt, bsi);
+ gimple_assign_set_lhs (*vec_stmt, new_temp);
+ vect_finish_stmt_generation (stmt, *vec_stmt, gsi);
STMT_VINFO_VEC_STMT (stmt_info) = *vec_stmt;
if (slp_node)
- VEC_quick_push (tree, SLP_TREE_VEC_STMTS (slp_node), *vec_stmt);
+ VEC_quick_push (gimple, SLP_TREE_VEC_STMTS (slp_node), *vec_stmt);
}
VEC_free (tree, heap, vec_oprnds);
@@ -3766,17 +3893,25 @@ vect_min_worthwhile_factor (enum tree_code code)
Return FALSE if not a vectorizable STMT, TRUE otherwise. */
bool
-vectorizable_induction (tree phi, block_stmt_iterator *bsi ATTRIBUTE_UNUSED,
- tree *vec_stmt)
+vectorizable_induction (gimple phi, gimple_stmt_iterator *gsi ATTRIBUTE_UNUSED,
+ gimple *vec_stmt)
{
stmt_vec_info stmt_info = vinfo_for_stmt (phi);
tree vectype = STMT_VINFO_VECTYPE (stmt_info);
loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info);
+ struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
int nunits = TYPE_VECTOR_SUBPARTS (vectype);
int ncopies = LOOP_VINFO_VECT_FACTOR (loop_vinfo) / nunits;
tree vec_def;
gcc_assert (ncopies >= 1);
+ /* FORNOW. This restriction should be relaxed. */
+ if (nested_in_vect_loop_p (loop, phi) && ncopies > 1)
+ {
+ if (vect_print_dump_info (REPORT_DETAILS))
+ fprintf (vect_dump, "multiple types in nested loop.");
+ return false;
+ }
if (!STMT_VINFO_RELEVANT_P (stmt_info))
return false;
@@ -3787,7 +3922,7 @@ vectorizable_induction (tree phi, block_stmt_iterator *bsi ATTRIBUTE_UNUSED,
gcc_assert (STMT_VINFO_DEF_TYPE (stmt_info) == vect_induction_def);
- if (TREE_CODE (phi) != PHI_NODE)
+ if (gimple_code (phi) != GIMPLE_PHI)
return false;
if (!vec_stmt) /* transformation not required. */
@@ -3818,18 +3953,16 @@ vectorizable_induction (tree phi, block_stmt_iterator *bsi ATTRIBUTE_UNUSED,
Return FALSE if not a vectorizable STMT, TRUE otherwise. */
bool
-vectorizable_operation (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt,
- slp_tree slp_node)
+vectorizable_operation (gimple stmt, gimple_stmt_iterator *gsi,
+ gimple *vec_stmt, slp_tree slp_node)
{
tree vec_dest;
tree scalar_dest;
- tree operation;
tree op0, op1 = NULL;
tree vec_oprnd1 = NULL_TREE;
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
tree vectype = STMT_VINFO_VECTYPE (stmt_info);
loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info);
- struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
enum tree_code code;
enum machine_mode vec_mode;
tree new_temp;
@@ -3837,9 +3970,10 @@ vectorizable_operation (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt,
optab optab;
int icode;
enum machine_mode optab_op2_mode;
- tree def, def_stmt;
+ tree def;
+ gimple def_stmt;
enum vect_def_type dt[2] = {vect_unknown_def_type, vect_unknown_def_type};
- tree new_stmt = NULL_TREE;
+ gimple new_stmt = NULL;
stmt_vec_info prev_stmt_info;
int nunits_in = TYPE_VECTOR_SUBPARTS (vectype);
int nunits_out;
@@ -3857,13 +3991,6 @@ vectorizable_operation (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt,
if (slp_node)
ncopies = 1;
gcc_assert (ncopies >= 1);
- /* FORNOW. This restriction should be relaxed. */
- if (nested_in_vect_loop_p (loop, stmt) && ncopies > 1)
- {
- if (vect_print_dump_info (REPORT_DETAILS))
- fprintf (vect_dump, "multiple types in nested loop.");
- return false;
- }
if (!STMT_VINFO_RELEVANT_P (stmt_info))
return false;
@@ -3872,13 +3999,13 @@ vectorizable_operation (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt,
return false;
/* Is STMT a vectorizable binary/unary operation? */
- if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
+ if (!is_gimple_assign (stmt))
return false;
- if (TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 0)) != SSA_NAME)
+ if (TREE_CODE (gimple_assign_lhs (stmt)) != SSA_NAME)
return false;
- scalar_dest = GIMPLE_STMT_OPERAND (stmt, 0);
+ scalar_dest = gimple_assign_lhs (stmt);
vectype_out = get_vectype_for_scalar_type (TREE_TYPE (scalar_dest));
if (!vectype_out)
return false;
@@ -3886,8 +4013,7 @@ vectorizable_operation (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt,
if (nunits_out != nunits_in)
return false;
- operation = GIMPLE_STMT_OPERAND (stmt, 1);
- code = TREE_CODE (operation);
+ code = gimple_assign_rhs_code (stmt);
/* For pointer addition, we should use the normal plus for
the vector addition. */
@@ -3895,7 +4021,7 @@ vectorizable_operation (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt,
code = PLUS_EXPR;
/* Support only unary or binary operations. */
- op_type = TREE_OPERAND_LENGTH (operation);
+ op_type = TREE_CODE_LENGTH (code);
if (op_type != unary_op && op_type != binary_op)
{
if (vect_print_dump_info (REPORT_DETAILS))
@@ -3903,7 +4029,7 @@ vectorizable_operation (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt,
return false;
}
- op0 = TREE_OPERAND (operation, 0);
+ op0 = gimple_assign_rhs1 (stmt);
if (!vect_is_simple_use (op0, loop_vinfo, &def_stmt, &def, &dt[0]))
{
if (vect_print_dump_info (REPORT_DETAILS))
@@ -3913,7 +4039,7 @@ vectorizable_operation (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt,
if (op_type == binary_op)
{
- op1 = TREE_OPERAND (operation, 1);
+ op1 = gimple_assign_rhs2 (stmt);
if (!vect_is_simple_use (op1, loop_vinfo, &def_stmt, &def, &dt[1]))
{
if (vect_print_dump_info (REPORT_DETAILS))
@@ -4140,21 +4266,14 @@ vectorizable_operation (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt,
/* Arguments are ready. Create the new vector stmt. */
for (i = 0; VEC_iterate (tree, vec_oprnds0, i, vop0); i++)
{
- if (op_type == binary_op)
- {
- vop1 = VEC_index (tree, vec_oprnds1, i);
- new_stmt = build_gimple_modify_stmt (vec_dest,
- build2 (code, vectype, vop0, vop1));
- }
- else
- new_stmt = build_gimple_modify_stmt (vec_dest,
- build1 (code, vectype, vop0));
-
+ vop1 = ((op_type == binary_op)
+ ? VEC_index (tree, vec_oprnds1, i) : NULL);
+ new_stmt = gimple_build_assign_with_ops (code, vec_dest, vop0, vop1);
new_temp = make_ssa_name (vec_dest, new_stmt);
- GIMPLE_STMT_OPERAND (new_stmt, 0) = new_temp;
- vect_finish_stmt_generation (stmt, new_stmt, bsi);
+ gimple_assign_set_lhs (new_stmt, new_temp);
+ vect_finish_stmt_generation (stmt, new_stmt, gsi);
if (slp_node)
- VEC_quick_push (tree, SLP_TREE_VEC_STMTS (slp_node), new_stmt);
+ VEC_quick_push (gimple, SLP_TREE_VEC_STMTS (slp_node), new_stmt);
}
if (j == 0)
@@ -4181,30 +4300,32 @@ vectorizable_operation (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt,
Return FALSE if not a vectorizable STMT, TRUE otherwise. */
bool
-vectorizable_type_demotion (tree stmt, block_stmt_iterator *bsi,
- tree *vec_stmt)
+vectorizable_type_demotion (gimple stmt, gimple_stmt_iterator *gsi,
+ gimple *vec_stmt)
{
tree vec_dest;
tree scalar_dest;
- tree operation;
tree op0;
tree vec_oprnd0=NULL, vec_oprnd1=NULL;
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info);
- struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
enum tree_code code, code1 = ERROR_MARK;
tree new_temp;
- tree def, def_stmt;
+ tree def;
+ gimple def_stmt;
enum vect_def_type dt[2] = {vect_unknown_def_type, vect_unknown_def_type};
- tree new_stmt;
+ gimple new_stmt;
stmt_vec_info prev_stmt_info;
int nunits_in;
int nunits_out;
tree vectype_out;
int ncopies;
int j;
- tree expr;
tree vectype_in;
+ tree intermediate_type = NULL_TREE, narrow_type, double_vec_dest;
+ bool double_op = false;
+ tree first_vector, second_vector;
+ tree vec_oprnd2 = NULL_TREE, vec_oprnd3 = NULL_TREE, last_oprnd = NULL_TREE;
if (!STMT_VINFO_RELEVANT_P (stmt_info))
return false;
@@ -4213,40 +4334,33 @@ vectorizable_type_demotion (tree stmt, block_stmt_iterator *bsi,
return false;
/* Is STMT a vectorizable type-demotion operation? */
- if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
+ if (!is_gimple_assign (stmt))
return false;
- if (TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 0)) != SSA_NAME)
+ if (TREE_CODE (gimple_assign_lhs (stmt)) != SSA_NAME)
return false;
- operation = GIMPLE_STMT_OPERAND (stmt, 1);
- code = TREE_CODE (operation);
+ code = gimple_assign_rhs_code (stmt);
if (code != NOP_EXPR && code != CONVERT_EXPR)
return false;
- op0 = TREE_OPERAND (operation, 0);
+ op0 = gimple_assign_rhs1 (stmt);
vectype_in = get_vectype_for_scalar_type (TREE_TYPE (op0));
if (!vectype_in)
return false;
nunits_in = TYPE_VECTOR_SUBPARTS (vectype_in);
- scalar_dest = GIMPLE_STMT_OPERAND (stmt, 0);
+ scalar_dest = gimple_assign_lhs (stmt);
vectype_out = get_vectype_for_scalar_type (TREE_TYPE (scalar_dest));
if (!vectype_out)
return false;
nunits_out = TYPE_VECTOR_SUBPARTS (vectype_out);
- if (nunits_in != nunits_out / 2) /* FORNOW */
+ if (nunits_in != nunits_out / 2
+ && nunits_in != nunits_out/4)
return false;
ncopies = LOOP_VINFO_VECT_FACTOR (loop_vinfo) / nunits_out;
gcc_assert (ncopies >= 1);
- /* FORNOW. This restriction should be relaxed. */
- if (nested_in_vect_loop_p (loop, stmt) && ncopies > 1)
- {
- if (vect_print_dump_info (REPORT_DETAILS))
- fprintf (vect_dump, "multiple types in nested loop.");
- return false;
- }
if (! ((INTEGRAL_TYPE_P (TREE_TYPE (scalar_dest))
&& INTEGRAL_TYPE_P (TREE_TYPE (op0)))
@@ -4264,7 +4378,8 @@ vectorizable_type_demotion (tree stmt, block_stmt_iterator *bsi,
}
/* Supportable by target? */
- if (!supportable_narrowing_operation (code, stmt, vectype_in, &code1))
+ if (!supportable_narrowing_operation (code, stmt, vectype_in, &code1,
+ &double_op, &intermediate_type))
return false;
STMT_VINFO_VECTYPE (stmt_info) = vectype_in;
@@ -4284,8 +4399,15 @@ vectorizable_type_demotion (tree stmt, block_stmt_iterator *bsi,
ncopies);
/* Handle def. */
- vec_dest = vect_create_destination_var (scalar_dest, vectype_out);
-
+ /* In case of double demotion, we first generate demotion operation to the
+ intermediate type, and then from that type to the final one. */
+ if (double_op)
+ narrow_type = intermediate_type;
+ else
+ narrow_type = vectype_out;
+ vec_dest = vect_create_destination_var (scalar_dest, narrow_type);
+ double_vec_dest = vect_create_destination_var (scalar_dest, vectype_out);
+
/* In case the vectorization factor (VF) is bigger than the number
of elements that we can fit in a vectype (nunits), we have to generate
more than one vector stmt - i.e - we need to "unroll" the
@@ -4296,21 +4418,58 @@ vectorizable_type_demotion (tree stmt, block_stmt_iterator *bsi,
/* Handle uses. */
if (j == 0)
{
- vec_oprnd0 = vect_get_vec_def_for_operand (op0, stmt, NULL);
- vec_oprnd1 = vect_get_vec_def_for_stmt_copy (dt[0], vec_oprnd0);
+ vec_oprnd0 = vect_get_vec_def_for_operand (op0, stmt, NULL);
+ vec_oprnd1 = vect_get_vec_def_for_stmt_copy (dt[0], vec_oprnd0);
+ if (double_op)
+ {
+ /* For double demotion we need four operands. */
+ vec_oprnd2 = vect_get_vec_def_for_stmt_copy (dt[0], vec_oprnd1);
+ vec_oprnd3 = vect_get_vec_def_for_stmt_copy (dt[0], vec_oprnd2);
+ }
}
else
{
- vec_oprnd0 = vect_get_vec_def_for_stmt_copy (dt[0], vec_oprnd1);
- vec_oprnd1 = vect_get_vec_def_for_stmt_copy (dt[0], vec_oprnd0);
+ vec_oprnd0 = vect_get_vec_def_for_stmt_copy (dt[0], last_oprnd);
+ vec_oprnd1 = vect_get_vec_def_for_stmt_copy (dt[0], vec_oprnd0);
+ if (double_op)
+ {
+ /* For double demotion we need four operands. */
+ vec_oprnd2 = vect_get_vec_def_for_stmt_copy (dt[0], vec_oprnd1);
+ vec_oprnd3 = vect_get_vec_def_for_stmt_copy (dt[0], vec_oprnd2);
+ }
}
- /* Arguments are ready. Create the new vector stmt. */
- expr = build2 (code1, vectype_out, vec_oprnd0, vec_oprnd1);
- new_stmt = build_gimple_modify_stmt (vec_dest, expr);
- new_temp = make_ssa_name (vec_dest, new_stmt);
- GIMPLE_STMT_OPERAND (new_stmt, 0) = new_temp;
- vect_finish_stmt_generation (stmt, new_stmt, bsi);
+ /* Arguments are ready. Create the new vector stmts. */
+ new_stmt = gimple_build_assign_with_ops (code1, vec_dest, vec_oprnd0,
+ vec_oprnd1);
+ first_vector = make_ssa_name (vec_dest, new_stmt);
+ gimple_assign_set_lhs (new_stmt, first_vector);
+ vect_finish_stmt_generation (stmt, new_stmt, gsi);
+
+ /* In the next iteration we will get copy for this operand. */
+ last_oprnd = vec_oprnd1;
+
+ if (double_op)
+ {
+ /* For double demotion operation we first generate two demotion
+ operations from the source type to the intermediate type, and
+ then combine the results in one demotion to the destination
+ type. */
+ new_stmt = gimple_build_assign_with_ops (code1, vec_dest, vec_oprnd2,
+ vec_oprnd3);
+ second_vector = make_ssa_name (vec_dest, new_stmt);
+ gimple_assign_set_lhs (new_stmt, second_vector);
+ vect_finish_stmt_generation (stmt, new_stmt, gsi);
+
+ new_stmt = gimple_build_assign_with_ops (code1, double_vec_dest,
+ first_vector, second_vector);
+ new_temp = make_ssa_name (double_vec_dest, new_stmt);
+ gimple_assign_set_lhs (new_stmt, new_temp);
+ vect_finish_stmt_generation (stmt, new_stmt, gsi);
+
+ /* In the next iteration we will get copy for this operand. */
+ last_oprnd = vec_oprnd3;
+ }
if (j == 0)
STMT_VINFO_VEC_STMT (stmt_info) = new_stmt;
@@ -4334,23 +4493,22 @@ vectorizable_type_demotion (tree stmt, block_stmt_iterator *bsi,
Return FALSE if not a vectorizable STMT, TRUE otherwise. */
bool
-vectorizable_type_promotion (tree stmt, block_stmt_iterator *bsi,
- tree *vec_stmt)
+vectorizable_type_promotion (gimple stmt, gimple_stmt_iterator *gsi,
+ gimple *vec_stmt)
{
tree vec_dest;
tree scalar_dest;
- tree operation;
tree op0, op1 = NULL;
tree vec_oprnd0=NULL, vec_oprnd1=NULL;
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info);
- struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
enum tree_code code, code1 = ERROR_MARK, code2 = ERROR_MARK;
tree decl1 = NULL_TREE, decl2 = NULL_TREE;
int op_type;
- tree def, def_stmt;
+ tree def;
+ gimple def_stmt;
enum vect_def_type dt[2] = {vect_unknown_def_type, vect_unknown_def_type};
- tree new_stmt;
+ gimple new_stmt;
stmt_vec_info prev_stmt_info;
int nunits_in;
int nunits_out;
@@ -4358,6 +4516,9 @@ vectorizable_type_promotion (tree stmt, block_stmt_iterator *bsi,
int ncopies;
int j;
tree vectype_in;
+ tree intermediate_type = NULL_TREE, first_vector, second_vector;
+ bool double_op;
+ tree wide_type, double_vec_dest;
if (!STMT_VINFO_RELEVANT_P (stmt_info))
return false;
@@ -4366,41 +4527,33 @@ vectorizable_type_promotion (tree stmt, block_stmt_iterator *bsi,
return false;
/* Is STMT a vectorizable type-promotion operation? */
- if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
+ if (!is_gimple_assign (stmt))
return false;
- if (TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 0)) != SSA_NAME)
+ if (TREE_CODE (gimple_assign_lhs (stmt)) != SSA_NAME)
return false;
- operation = GIMPLE_STMT_OPERAND (stmt, 1);
- code = TREE_CODE (operation);
+ code = gimple_assign_rhs_code (stmt);
if (code != NOP_EXPR && code != CONVERT_EXPR
&& code != WIDEN_MULT_EXPR)
return false;
- op0 = TREE_OPERAND (operation, 0);
+ op0 = gimple_assign_rhs1 (stmt);
vectype_in = get_vectype_for_scalar_type (TREE_TYPE (op0));
if (!vectype_in)
return false;
nunits_in = TYPE_VECTOR_SUBPARTS (vectype_in);
- scalar_dest = GIMPLE_STMT_OPERAND (stmt, 0);
+ scalar_dest = gimple_assign_lhs (stmt);
vectype_out = get_vectype_for_scalar_type (TREE_TYPE (scalar_dest));
if (!vectype_out)
return false;
nunits_out = TYPE_VECTOR_SUBPARTS (vectype_out);
- if (nunits_out != nunits_in / 2) /* FORNOW */
+ if (nunits_out != nunits_in / 2 && nunits_out != nunits_in/4)
return false;
ncopies = LOOP_VINFO_VECT_FACTOR (loop_vinfo) / nunits_in;
gcc_assert (ncopies >= 1);
- /* FORNOW. This restriction should be relaxed. */
- if (nested_in_vect_loop_p (loop, stmt) && ncopies > 1)
- {
- if (vect_print_dump_info (REPORT_DETAILS))
- fprintf (vect_dump, "multiple types in nested loop.");
- return false;
- }
if (! ((INTEGRAL_TYPE_P (TREE_TYPE (scalar_dest))
&& INTEGRAL_TYPE_P (TREE_TYPE (op0)))
@@ -4420,7 +4573,7 @@ vectorizable_type_promotion (tree stmt, block_stmt_iterator *bsi,
op_type = TREE_CODE_LENGTH (code);
if (op_type == binary_op)
{
- op1 = TREE_OPERAND (operation, 1);
+ op1 = gimple_assign_rhs2 (stmt);
if (!vect_is_simple_use (op1, loop_vinfo, &def_stmt, &def, &dt[1]))
{
if (vect_print_dump_info (REPORT_DETAILS))
@@ -4431,9 +4584,14 @@ vectorizable_type_promotion (tree stmt, block_stmt_iterator *bsi,
/* Supportable by target? */
if (!supportable_widening_operation (code, stmt, vectype_in,
- &decl1, &decl2, &code1, &code2))
+ &decl1, &decl2, &code1, &code2,
+ &double_op, &intermediate_type))
return false;
+ /* Binary widening operation can only be supported directly by the
+ architecture. */
+ gcc_assert (!(double_op && op_type == binary_op));
+
STMT_VINFO_VECTYPE (stmt_info) = vectype_in;
if (!vec_stmt) /* transformation not required. */
@@ -4452,7 +4610,13 @@ vectorizable_type_promotion (tree stmt, block_stmt_iterator *bsi,
ncopies);
/* Handle def. */
- vec_dest = vect_create_destination_var (scalar_dest, vectype_out);
+ if (double_op)
+ wide_type = intermediate_type;
+ else
+ wide_type = vectype_out;
+
+ vec_dest = vect_create_destination_var (scalar_dest, wide_type);
+ double_vec_dest = vect_create_destination_var (scalar_dest, vectype_out);
/* In case the vectorization factor (VF) is bigger than the number
of elements that we can fit in a vectype (nunits), we have to generate
@@ -4479,22 +4643,75 @@ vectorizable_type_promotion (tree stmt, block_stmt_iterator *bsi,
/* Arguments are ready. Create the new vector stmt. We are creating
two vector defs because the widened result does not fit in one vector.
The vectorized stmt can be expressed as a call to a target builtin,
- or a using a tree-code. */
+ or a using a tree-code. In case of double promotion (from char to int,
+ for example), the promotion is performed in two phases: first we
+ generate a promotion operation from the source type to the intermediate
+ type (short in case of char->int promotion), and then for each of the
+ created vectors we generate a promotion statement from the intermediate
+ type to the destination type. */
/* Generate first half of the widened result: */
- new_stmt = vect_gen_widened_results_half (code1, vectype_out, decl1,
- vec_oprnd0, vec_oprnd1, op_type, vec_dest, bsi, stmt);
- if (j == 0)
- STMT_VINFO_VEC_STMT (stmt_info) = new_stmt;
+ new_stmt = vect_gen_widened_results_half (code1, wide_type, decl1,
+ vec_oprnd0, vec_oprnd1, op_type, vec_dest, gsi, stmt);
+ if (is_gimple_call (new_stmt))
+ first_vector = gimple_call_lhs (new_stmt);
else
- STMT_VINFO_RELATED_STMT (prev_stmt_info) = new_stmt;
- prev_stmt_info = vinfo_for_stmt (new_stmt);
+ first_vector = gimple_assign_lhs (new_stmt);
+
+ if (!double_op)
+ {
+ if (j == 0)
+ STMT_VINFO_VEC_STMT (stmt_info) = new_stmt;
+ else
+ STMT_VINFO_RELATED_STMT (prev_stmt_info) = new_stmt;
+ prev_stmt_info = vinfo_for_stmt (new_stmt);
+ }
/* Generate second half of the widened result: */
- new_stmt = vect_gen_widened_results_half (code2, vectype_out, decl2,
- vec_oprnd0, vec_oprnd1, op_type, vec_dest, bsi, stmt);
- STMT_VINFO_RELATED_STMT (prev_stmt_info) = new_stmt;
- prev_stmt_info = vinfo_for_stmt (new_stmt);
+ new_stmt = vect_gen_widened_results_half (code2, wide_type, decl2,
+ vec_oprnd0, vec_oprnd1, op_type, vec_dest, gsi, stmt);
+ if (is_gimple_call (new_stmt))
+ second_vector = gimple_call_lhs (new_stmt);
+ else
+ second_vector = gimple_assign_lhs (new_stmt);
+ if (!double_op)
+ {
+ STMT_VINFO_RELATED_STMT (prev_stmt_info) = new_stmt;
+ prev_stmt_info = vinfo_for_stmt (new_stmt);
+ }
+ else
+ {
+ /* FIRST_VECTOR and SECOND_VECTOR are the results of source type
+ to intermediate type promotion. Now we generate promotions
+ for both of them to the destination type (i.e., four
+ statements). */
+ new_stmt = vect_gen_widened_results_half (code1, vectype_out,
+ decl1, first_vector, NULL_TREE, op_type,
+ double_vec_dest, gsi, stmt);
+ if (j == 0)
+ STMT_VINFO_VEC_STMT (stmt_info) = new_stmt;
+ else
+ STMT_VINFO_RELATED_STMT (prev_stmt_info) = new_stmt;
+ prev_stmt_info = vinfo_for_stmt (new_stmt);
+
+ new_stmt = vect_gen_widened_results_half (code2, vectype_out,
+ decl2, first_vector, NULL_TREE, op_type,
+ double_vec_dest, gsi, stmt);
+ STMT_VINFO_RELATED_STMT (prev_stmt_info) = new_stmt;
+ prev_stmt_info = vinfo_for_stmt (new_stmt);
+
+ new_stmt = vect_gen_widened_results_half (code1, vectype_out,
+ decl1, second_vector, NULL_TREE, op_type,
+ double_vec_dest, gsi, stmt);
+ STMT_VINFO_RELATED_STMT (prev_stmt_info) = new_stmt;
+ prev_stmt_info = vinfo_for_stmt (new_stmt);
+
+ new_stmt = vect_gen_widened_results_half (code2, vectype_out,
+ decl2, second_vector, NULL_TREE, op_type,
+ double_vec_dest, gsi, stmt);
+ STMT_VINFO_RELATED_STMT (prev_stmt_info) = new_stmt;
+ prev_stmt_info = vinfo_for_stmt (new_stmt);
+ }
}
*vec_stmt = STMT_VINFO_VEC_STMT (stmt_info);
@@ -4605,17 +4822,19 @@ vect_strided_store_supported (tree vectype)
static bool
vect_permute_store_chain (VEC(tree,heap) *dr_chain,
unsigned int length,
- tree stmt,
- block_stmt_iterator *bsi,
+ gimple stmt,
+ gimple_stmt_iterator *gsi,
VEC(tree,heap) **result_chain)
{
- tree perm_dest, perm_stmt, vect1, vect2, high, low;
+ tree perm_dest, vect1, vect2, high, low;
+ gimple perm_stmt;
tree vectype = STMT_VINFO_VECTYPE (vinfo_for_stmt (stmt));
- tree scalar_dest, tmp;
+ tree scalar_dest;
int i;
unsigned int j;
+ enum tree_code high_code, low_code;
- scalar_dest = GIMPLE_STMT_OPERAND (stmt, 0);
+ scalar_dest = gimple_assign_lhs (stmt);
/* Check that the operation is supported. */
if (!vect_strided_store_supported (vectype))
@@ -4639,13 +4858,20 @@ vect_permute_store_chain (VEC(tree,heap) *dr_chain,
DECL_GIMPLE_REG_P (perm_dest) = 1;
add_referenced_var (perm_dest);
if (BYTES_BIG_ENDIAN)
- tmp = build2 (VEC_INTERLEAVE_HIGH_EXPR, vectype, vect1, vect2);
+ {
+ high_code = VEC_INTERLEAVE_HIGH_EXPR;
+ low_code = VEC_INTERLEAVE_LOW_EXPR;
+ }
else
- tmp = build2 (VEC_INTERLEAVE_LOW_EXPR, vectype, vect1, vect2);
- perm_stmt = build_gimple_modify_stmt (perm_dest, tmp);
+ {
+ low_code = VEC_INTERLEAVE_HIGH_EXPR;
+ high_code = VEC_INTERLEAVE_LOW_EXPR;
+ }
+ perm_stmt = gimple_build_assign_with_ops (high_code, perm_dest,
+ vect1, vect2);
high = make_ssa_name (perm_dest, perm_stmt);
- GIMPLE_STMT_OPERAND (perm_stmt, 0) = high;
- vect_finish_stmt_generation (stmt, perm_stmt, bsi);
+ gimple_assign_set_lhs (perm_stmt, high);
+ vect_finish_stmt_generation (stmt, perm_stmt, gsi);
VEC_replace (tree, *result_chain, 2*j, high);
/* Create interleaving stmt:
@@ -4656,14 +4882,11 @@ vect_permute_store_chain (VEC(tree,heap) *dr_chain,
perm_dest = create_tmp_var (vectype, "vect_inter_low");
DECL_GIMPLE_REG_P (perm_dest) = 1;
add_referenced_var (perm_dest);
- if (BYTES_BIG_ENDIAN)
- tmp = build2 (VEC_INTERLEAVE_LOW_EXPR, vectype, vect1, vect2);
- else
- tmp = build2 (VEC_INTERLEAVE_HIGH_EXPR, vectype, vect1, vect2);
- perm_stmt = build_gimple_modify_stmt (perm_dest, tmp);
+ perm_stmt = gimple_build_assign_with_ops (low_code, perm_dest,
+ vect1, vect2);
low = make_ssa_name (perm_dest, perm_stmt);
- GIMPLE_STMT_OPERAND (perm_stmt, 0) = low;
- vect_finish_stmt_generation (stmt, perm_stmt, bsi);
+ gimple_assign_set_lhs (perm_stmt, low);
+ vect_finish_stmt_generation (stmt, perm_stmt, gsi);
VEC_replace (tree, *result_chain, 2*j+1, low);
}
dr_chain = VEC_copy (tree, heap, *result_chain);
@@ -4681,7 +4904,7 @@ vect_permute_store_chain (VEC(tree,heap) *dr_chain,
Return FALSE if not a vectorizable STMT, TRUE otherwise. */
bool
-vectorizable_store (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt,
+vectorizable_store (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
slp_tree slp_node)
{
tree scalar_dest;
@@ -4696,14 +4919,15 @@ vectorizable_store (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt,
enum machine_mode vec_mode;
tree dummy;
enum dr_alignment_support alignment_support_scheme;
- tree def, def_stmt;
+ tree def;
+ gimple def_stmt;
enum vect_def_type dt;
stmt_vec_info prev_stmt_info = NULL;
tree dataref_ptr = NULL_TREE;
int nunits = TYPE_VECTOR_SUBPARTS (vectype);
int ncopies = LOOP_VINFO_VECT_FACTOR (loop_vinfo) / nunits;
int j;
- tree next_stmt, first_stmt = NULL_TREE;
+ gimple next_stmt, first_stmt = NULL;
bool strided_store = false;
unsigned int group_size, i;
VEC(tree,heap) *dr_chain = NULL, *oprnds = NULL, *result_chain = NULL;
@@ -4736,16 +4960,17 @@ vectorizable_store (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt,
/* Is vectorizable store? */
- if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
+ if (!is_gimple_assign (stmt))
return false;
- scalar_dest = GIMPLE_STMT_OPERAND (stmt, 0);
+ scalar_dest = gimple_assign_lhs (stmt);
if (TREE_CODE (scalar_dest) != ARRAY_REF
&& TREE_CODE (scalar_dest) != INDIRECT_REF
&& !STMT_VINFO_STRIDED_ACCESS (stmt_info))
return false;
- op = GIMPLE_STMT_OPERAND (stmt, 1);
+ gcc_assert (gimple_assign_single_p (stmt));
+ op = gimple_assign_rhs1 (stmt);
if (!vect_is_simple_use (op, loop_vinfo, &def_stmt, &def, &dt))
{
if (vect_print_dump_info (REPORT_DETAILS))
@@ -4795,7 +5020,8 @@ vectorizable_store (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt,
next_stmt = DR_GROUP_NEXT_DR (stmt_info);
while (next_stmt)
{
- op = GIMPLE_STMT_OPERAND (next_stmt, 1);
+ gcc_assert (gimple_assign_single_p (next_stmt));
+ op = gimple_assign_rhs1 (next_stmt);
if (!vect_is_simple_use (op, loop_vinfo, &def_stmt, &def, &dt))
{
if (vect_print_dump_info (REPORT_DETAILS))
@@ -4810,8 +5036,7 @@ vectorizable_store (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt,
if (!vec_stmt) /* transformation not required. */
{
STMT_VINFO_TYPE (stmt_info) = store_vec_info_type;
- if (!PURE_SLP_STMT (stmt_info))
- vect_model_store_cost (stmt_info, ncopies, dt, NULL);
+ vect_model_store_cost (stmt_info, ncopies, dt, NULL);
return true;
}
@@ -4833,7 +5058,7 @@ vectorizable_store (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt,
< DR_GROUP_SIZE (vinfo_for_stmt (first_stmt))
&& !slp)
{
- *vec_stmt = NULL_TREE;
+ *vec_stmt = NULL;
return true;
}
@@ -4906,8 +5131,8 @@ vectorizable_store (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt,
prev_stmt_info = NULL;
for (j = 0; j < ncopies; j++)
{
- tree new_stmt;
- tree ptr_incr;
+ gimple new_stmt;
+ gimple ptr_incr;
if (j == 0)
{
@@ -4936,7 +5161,8 @@ vectorizable_store (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt,
there is no interleaving, GROUP_SIZE is 1, and only one
iteration of the loop will be executed. */
gcc_assert (next_stmt);
- op = GIMPLE_STMT_OPERAND (next_stmt, 1);
+ gcc_assert (gimple_assign_single_p (next_stmt));
+ op = gimple_assign_rhs1 (next_stmt);
vec_oprnd = vect_get_vec_def_for_operand (op, next_stmt,
NULL);
@@ -4972,14 +5198,14 @@ vectorizable_store (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt,
VEC_replace(tree, oprnds, i, vec_oprnd);
}
dataref_ptr =
- bump_vector_ptr (dataref_ptr, ptr_incr, bsi, stmt, NULL_TREE);
+ bump_vector_ptr (dataref_ptr, ptr_incr, gsi, stmt, NULL_TREE);
}
if (strided_store)
{
result_chain = VEC_alloc (tree, heap, group_size);
/* Permute. */
- if (!vect_permute_store_chain (dr_chain, group_size, stmt, bsi,
+ if (!vect_permute_store_chain (dr_chain, group_size, stmt, gsi,
&result_chain))
return false;
}
@@ -4989,7 +5215,7 @@ vectorizable_store (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt,
{
if (i > 0)
/* Bump the vector pointer. */
- dataref_ptr = bump_vector_ptr (dataref_ptr, ptr_incr, bsi, stmt,
+ dataref_ptr = bump_vector_ptr (dataref_ptr, ptr_incr, gsi, stmt,
NULL_TREE);
if (slp)
@@ -5001,8 +5227,8 @@ vectorizable_store (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt,
data_ref = build_fold_indirect_ref (dataref_ptr);
/* Arguments are ready. Create the new vector stmt. */
- new_stmt = build_gimple_modify_stmt (data_ref, vec_oprnd);
- vect_finish_stmt_generation (stmt, new_stmt, bsi);
+ new_stmt = gimple_build_assign (data_ref, vec_oprnd);
+ vect_finish_stmt_generation (stmt, new_stmt, gsi);
mark_symbols_for_renaming (new_stmt);
if (j == 0)
@@ -5078,7 +5304,7 @@ vectorizable_store (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt,
Return value - the result of the loop-header phi node. */
static tree
-vect_setup_realignment (tree stmt, block_stmt_iterator *bsi,
+vect_setup_realignment (gimple stmt, gimple_stmt_iterator *gsi,
tree *realignment_token,
enum dr_alignment_support alignment_support_scheme,
tree init_addr,
@@ -5089,22 +5315,22 @@ vect_setup_realignment (tree stmt, block_stmt_iterator *bsi,
loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info);
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
edge pe;
- tree scalar_dest = GIMPLE_STMT_OPERAND (stmt, 0);
+ tree scalar_dest = gimple_assign_lhs (stmt);
tree vec_dest;
- tree inc;
+ gimple inc;
tree ptr;
tree data_ref;
- tree new_stmt;
+ gimple new_stmt;
basic_block new_bb;
tree msq_init = NULL_TREE;
tree new_temp;
- tree phi_stmt;
+ gimple phi_stmt;
tree msq = NULL_TREE;
- tree stmts = NULL_TREE;
+ gimple_seq stmts = NULL;
bool inv_p;
bool compute_in_loop = false;
bool nested_in_vect_loop = nested_in_vect_loop_p (loop, stmt);
- struct loop *containing_loop = (bb_for_stmt (stmt))->loop_father;
+ struct loop *containing_loop = (gimple_bb (stmt))->loop_father;
struct loop *loop_for_initial_load;
gcc_assert (alignment_support_scheme == dr_explicit_realign
@@ -5188,13 +5414,13 @@ vect_setup_realignment (tree stmt, block_stmt_iterator *bsi,
ptr = vect_create_data_ref_ptr (stmt, loop_for_initial_load, NULL_TREE,
&init_addr, &inc, true, &inv_p);
data_ref = build1 (ALIGN_INDIRECT_REF, vectype, ptr);
- new_stmt = build_gimple_modify_stmt (vec_dest, data_ref);
+ new_stmt = gimple_build_assign (vec_dest, data_ref);
new_temp = make_ssa_name (vec_dest, new_stmt);
- GIMPLE_STMT_OPERAND (new_stmt, 0) = new_temp;
+ gimple_assign_set_lhs (new_stmt, new_temp);
mark_symbols_for_renaming (new_stmt);
- new_bb = bsi_insert_on_edge_immediate (pe, new_stmt);
+ new_bb = gsi_insert_on_edge_immediate (pe, new_stmt);
gcc_assert (!new_bb);
- msq_init = GIMPLE_STMT_OPERAND (new_stmt, 0);
+ msq_init = gimple_assign_lhs (new_stmt);
}
/* 4. Create realignment token using a target builtin, if available.
@@ -5214,29 +5440,29 @@ vect_setup_realignment (tree stmt, block_stmt_iterator *bsi,
init_addr = vect_create_addr_base_for_vector_ref (stmt, &stmts,
NULL_TREE, loop);
pe = loop_preheader_edge (loop);
- new_bb = bsi_insert_on_edge_immediate (pe, stmts);
+ new_bb = gsi_insert_seq_on_edge_immediate (pe, stmts);
gcc_assert (!new_bb);
}
builtin_decl = targetm.vectorize.builtin_mask_for_load ();
- new_stmt = build_call_expr (builtin_decl, 1, init_addr);
- vec_dest = vect_create_destination_var (scalar_dest,
- TREE_TYPE (new_stmt));
- new_stmt = build_gimple_modify_stmt (vec_dest, new_stmt);
+ new_stmt = gimple_build_call (builtin_decl, 1, init_addr);
+ vec_dest =
+ vect_create_destination_var (scalar_dest,
+ gimple_call_return_type (new_stmt));
new_temp = make_ssa_name (vec_dest, new_stmt);
- GIMPLE_STMT_OPERAND (new_stmt, 0) = new_temp;
+ gimple_call_set_lhs (new_stmt, new_temp);
if (compute_in_loop)
- bsi_insert_before (bsi, new_stmt, BSI_SAME_STMT);
+ gsi_insert_before (gsi, new_stmt, GSI_SAME_STMT);
else
{
/* Generate the misalignment computation outside LOOP. */
pe = loop_preheader_edge (loop);
- new_bb = bsi_insert_on_edge_immediate (pe, new_stmt);
+ new_bb = gsi_insert_on_edge_immediate (pe, new_stmt);
gcc_assert (!new_bb);
}
- *realignment_token = GIMPLE_STMT_OPERAND (new_stmt, 0);
+ *realignment_token = gimple_call_lhs (new_stmt);
/* The result of the CALL_EXPR to this builtin is determined from
the value of the parameter and no global variables are touched
@@ -5257,7 +5483,7 @@ vect_setup_realignment (tree stmt, block_stmt_iterator *bsi,
pe = loop_preheader_edge (containing_loop);
vec_dest = vect_create_destination_var (scalar_dest, vectype);
- msq = make_ssa_name (vec_dest, NULL_TREE);
+ msq = make_ssa_name (vec_dest, NULL);
phi_stmt = create_phi_node (msq, containing_loop->header);
SSA_NAME_DEF_STMT (msq) = phi_stmt;
add_phi_arg (phi_stmt, msq_init, pe);
@@ -5393,13 +5619,13 @@ vect_strided_load_supported (tree vectype)
static bool
vect_permute_load_chain (VEC(tree,heap) *dr_chain,
unsigned int length,
- tree stmt,
- block_stmt_iterator *bsi,
+ gimple stmt,
+ gimple_stmt_iterator *gsi,
VEC(tree,heap) **result_chain)
{
- tree perm_dest, perm_stmt, data_ref, first_vect, second_vect;
+ tree perm_dest, data_ref, first_vect, second_vect;
+ gimple perm_stmt;
tree vectype = STMT_VINFO_VECTYPE (vinfo_for_stmt (stmt));
- tree tmp;
int i;
unsigned int j;
@@ -5420,13 +5646,13 @@ vect_permute_load_chain (VEC(tree,heap) *dr_chain,
DECL_GIMPLE_REG_P (perm_dest) = 1;
add_referenced_var (perm_dest);
- tmp = build2 (VEC_EXTRACT_EVEN_EXPR, vectype,
- first_vect, second_vect);
- perm_stmt = build_gimple_modify_stmt (perm_dest, tmp);
+ perm_stmt = gimple_build_assign_with_ops (VEC_EXTRACT_EVEN_EXPR,
+ perm_dest, first_vect,
+ second_vect);
data_ref = make_ssa_name (perm_dest, perm_stmt);
- GIMPLE_STMT_OPERAND (perm_stmt, 0) = data_ref;
- vect_finish_stmt_generation (stmt, perm_stmt, bsi);
+ gimple_assign_set_lhs (perm_stmt, data_ref);
+ vect_finish_stmt_generation (stmt, perm_stmt, gsi);
mark_symbols_for_renaming (perm_stmt);
VEC_replace (tree, *result_chain, j/2, data_ref);
@@ -5436,12 +5662,12 @@ vect_permute_load_chain (VEC(tree,heap) *dr_chain,
DECL_GIMPLE_REG_P (perm_dest) = 1;
add_referenced_var (perm_dest);
- tmp = build2 (VEC_EXTRACT_ODD_EXPR, vectype,
- first_vect, second_vect);
- perm_stmt = build_gimple_modify_stmt (perm_dest, tmp);
+ perm_stmt = gimple_build_assign_with_ops (VEC_EXTRACT_ODD_EXPR,
+ perm_dest, first_vect,
+ second_vect);
data_ref = make_ssa_name (perm_dest, perm_stmt);
- GIMPLE_STMT_OPERAND (perm_stmt, 0) = data_ref;
- vect_finish_stmt_generation (stmt, perm_stmt, bsi);
+ gimple_assign_set_lhs (perm_stmt, data_ref);
+ vect_finish_stmt_generation (stmt, perm_stmt, gsi);
mark_symbols_for_renaming (perm_stmt);
VEC_replace (tree, *result_chain, j/2+length/2, data_ref);
@@ -5460,12 +5686,12 @@ vect_permute_load_chain (VEC(tree,heap) *dr_chain,
*/
static bool
-vect_transform_strided_load (tree stmt, VEC(tree,heap) *dr_chain, int size,
- block_stmt_iterator *bsi)
+vect_transform_strided_load (gimple stmt, VEC(tree,heap) *dr_chain, int size,
+ gimple_stmt_iterator *gsi)
{
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
- tree first_stmt = DR_GROUP_FIRST_DR (stmt_info);
- tree next_stmt, new_stmt;
+ gimple first_stmt = DR_GROUP_FIRST_DR (stmt_info);
+ gimple next_stmt, new_stmt;
VEC(tree,heap) *result_chain = NULL;
unsigned int i, gap_count;
tree tmp_data_ref;
@@ -5475,7 +5701,7 @@ vect_transform_strided_load (tree stmt, VEC(tree,heap) *dr_chain, int size,
vectors, that are ready for vector computation. */
result_chain = VEC_alloc (tree, heap, size);
/* Permute. */
- if (!vect_permute_load_chain (dr_chain, size, stmt, bsi, &result_chain))
+ if (!vect_permute_load_chain (dr_chain, size, stmt, gsi, &result_chain))
return false;
/* Put a permuted data-ref in the VECTORIZED_STMT field.
@@ -5512,9 +5738,10 @@ vect_transform_strided_load (tree stmt, VEC(tree,heap) *dr_chain, int size,
STMT_VINFO_VEC_STMT (vinfo_for_stmt (next_stmt)) = new_stmt;
else
{
- tree prev_stmt = STMT_VINFO_VEC_STMT (vinfo_for_stmt (next_stmt));
- tree rel_stmt = STMT_VINFO_RELATED_STMT (
- vinfo_for_stmt (prev_stmt));
+ gimple prev_stmt =
+ STMT_VINFO_VEC_STMT (vinfo_for_stmt (next_stmt));
+ gimple rel_stmt =
+ STMT_VINFO_RELATED_STMT (vinfo_for_stmt (prev_stmt));
while (rel_stmt)
{
prev_stmt = rel_stmt;
@@ -5546,44 +5773,44 @@ vect_transform_strided_load (tree stmt, VEC(tree,heap) *dr_chain, int size,
Return FALSE if not a vectorizable STMT, TRUE otherwise. */
bool
-vectorizable_load (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt,
+vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
slp_tree slp_node)
{
tree scalar_dest;
tree vec_dest = NULL;
tree data_ref = NULL;
- tree op;
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
stmt_vec_info prev_stmt_info;
loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info);
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
- struct loop *containing_loop = (bb_for_stmt (stmt))->loop_father;
+ struct loop *containing_loop = (gimple_bb (stmt))->loop_father;
bool nested_in_vect_loop = nested_in_vect_loop_p (loop, stmt);
struct data_reference *dr = STMT_VINFO_DATA_REF (stmt_info), *first_dr;
tree vectype = STMT_VINFO_VECTYPE (stmt_info);
tree new_temp;
int mode;
- tree new_stmt = NULL_TREE;
+ gimple new_stmt = NULL;
tree dummy;
enum dr_alignment_support alignment_support_scheme;
tree dataref_ptr = NULL_TREE;
- tree ptr_incr;
+ gimple ptr_incr;
int nunits = TYPE_VECTOR_SUBPARTS (vectype);
int ncopies = LOOP_VINFO_VECT_FACTOR (loop_vinfo) / nunits;
int i, j, group_size;
tree msq = NULL_TREE, lsq;
tree offset = NULL_TREE;
tree realignment_token = NULL_TREE;
- tree phi = NULL_TREE;
+ gimple phi = NULL;
VEC(tree,heap) *dr_chain = NULL;
bool strided_load = false;
- tree first_stmt;
+ gimple first_stmt;
tree scalar_type;
bool inv_p;
bool compute_in_loop = false;
struct loop *at_loop;
int vec_num;
bool slp = (slp_node != NULL);
+ enum tree_code code;
/* FORNOW: SLP with multiple types is not supported. The SLP analysis verifies
this, so we can safely override NCOPIES with 1 here. */
@@ -5607,16 +5834,16 @@ vectorizable_load (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt,
return false;
/* Is vectorizable load? */
- if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
+ if (!is_gimple_assign (stmt))
return false;
- scalar_dest = GIMPLE_STMT_OPERAND (stmt, 0);
+ scalar_dest = gimple_assign_lhs (stmt);
if (TREE_CODE (scalar_dest) != SSA_NAME)
return false;
- op = GIMPLE_STMT_OPERAND (stmt, 1);
- if (TREE_CODE (op) != ARRAY_REF
- && TREE_CODE (op) != INDIRECT_REF
+ code = gimple_assign_rhs_code (stmt);
+ if (code != ARRAY_REF
+ && code != INDIRECT_REF
&& !STMT_VINFO_STRIDED_ACCESS (stmt_info))
return false;
@@ -5818,7 +6045,7 @@ vectorizable_load (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt,
|| alignment_support_scheme == dr_explicit_realign)
&& !compute_in_loop)
{
- msq = vect_setup_realignment (first_stmt, bsi, &realignment_token,
+ msq = vect_setup_realignment (first_stmt, gsi, &realignment_token,
alignment_support_scheme, NULL_TREE,
&at_loop);
if (alignment_support_scheme == dr_explicit_realign_optimized)
@@ -5841,12 +6068,12 @@ vectorizable_load (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt,
&inv_p);
else
dataref_ptr =
- bump_vector_ptr (dataref_ptr, ptr_incr, bsi, stmt, NULL_TREE);
+ bump_vector_ptr (dataref_ptr, ptr_incr, gsi, stmt, NULL_TREE);
for (i = 0; i < vec_num; i++)
{
if (i > 0)
- dataref_ptr = bump_vector_ptr (dataref_ptr, ptr_incr, bsi, stmt,
+ dataref_ptr = bump_vector_ptr (dataref_ptr, ptr_incr, gsi, stmt,
NULL_TREE);
/* 2. Create the vector-load in the loop. */
@@ -5872,24 +6099,24 @@ vectorizable_load (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt,
tree vs_minus_1 = size_int (TYPE_VECTOR_SUBPARTS (vectype) - 1);
if (compute_in_loop)
- msq = vect_setup_realignment (first_stmt, bsi,
+ msq = vect_setup_realignment (first_stmt, gsi,
&realignment_token,
dr_explicit_realign,
dataref_ptr, NULL);
data_ref = build1 (ALIGN_INDIRECT_REF, vectype, dataref_ptr);
vec_dest = vect_create_destination_var (scalar_dest, vectype);
- new_stmt = build_gimple_modify_stmt (vec_dest, data_ref);
+ new_stmt = gimple_build_assign (vec_dest, data_ref);
new_temp = make_ssa_name (vec_dest, new_stmt);
- GIMPLE_STMT_OPERAND (new_stmt, 0) = new_temp;
- vect_finish_stmt_generation (stmt, new_stmt, bsi);
+ gimple_assign_set_lhs (new_stmt, new_temp);
+ vect_finish_stmt_generation (stmt, new_stmt, gsi);
copy_virtual_operands (new_stmt, stmt);
mark_symbols_for_renaming (new_stmt);
msq = new_temp;
bump = size_binop (MULT_EXPR, vs_minus_1,
TYPE_SIZE_UNIT (scalar_type));
- ptr = bump_vector_ptr (dataref_ptr, NULL_TREE, bsi, stmt, bump);
+ ptr = bump_vector_ptr (dataref_ptr, NULL, gsi, stmt, bump);
data_ref = build1 (ALIGN_INDIRECT_REF, vectype, ptr);
break;
}
@@ -5900,10 +6127,10 @@ vectorizable_load (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt,
gcc_unreachable ();
}
vec_dest = vect_create_destination_var (scalar_dest, vectype);
- new_stmt = build_gimple_modify_stmt (vec_dest, data_ref);
+ new_stmt = gimple_build_assign (vec_dest, data_ref);
new_temp = make_ssa_name (vec_dest, new_stmt);
- GIMPLE_STMT_OPERAND (new_stmt, 0) = new_temp;
- vect_finish_stmt_generation (stmt, new_stmt, bsi);
+ gimple_assign_set_lhs (new_stmt, new_temp);
+ vect_finish_stmt_generation (stmt, new_stmt, gsi);
mark_symbols_for_renaming (new_stmt);
/* 3. Handle explicit realignment if necessary/supported. Create in
@@ -5911,19 +6138,22 @@ vectorizable_load (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt,
if (alignment_support_scheme == dr_explicit_realign_optimized
|| alignment_support_scheme == dr_explicit_realign)
{
- lsq = GIMPLE_STMT_OPERAND (new_stmt, 0);
+ tree tmp;
+
+ lsq = gimple_assign_lhs (new_stmt);
if (!realignment_token)
realignment_token = dataref_ptr;
vec_dest = vect_create_destination_var (scalar_dest, vectype);
- new_stmt = build3 (REALIGN_LOAD_EXPR, vectype, msq, lsq,
- realignment_token);
- new_stmt = build_gimple_modify_stmt (vec_dest, new_stmt);
+ tmp = build3 (REALIGN_LOAD_EXPR, vectype, msq, lsq,
+ realignment_token);
+ new_stmt = gimple_build_assign (vec_dest, tmp);
new_temp = make_ssa_name (vec_dest, new_stmt);
- GIMPLE_STMT_OPERAND (new_stmt, 0) = new_temp;
- vect_finish_stmt_generation (stmt, new_stmt, bsi);
+ gimple_assign_set_lhs (new_stmt, new_temp);
+ vect_finish_stmt_generation (stmt, new_stmt, gsi);
if (alignment_support_scheme == dr_explicit_realign_optimized)
{
+ gcc_assert (phi);
if (i == vec_num - 1 && j == ncopies - 1)
add_phi_arg (phi, lsq, loop_latch_edge (containing_loop));
msq = lsq;
@@ -5944,19 +6174,19 @@ vectorizable_load (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt,
/* CHECKME: bitpos depends on endianess? */
bitpos = bitsize_zero_node;
vec_inv = build3 (BIT_FIELD_REF, scalar_type, new_temp,
- bitsize, bitpos);
+ bitsize, bitpos);
vec_dest =
vect_create_destination_var (scalar_dest, NULL_TREE);
- new_stmt = build_gimple_modify_stmt (vec_dest, vec_inv);
+ new_stmt = gimple_build_assign (vec_dest, vec_inv);
new_temp = make_ssa_name (vec_dest, new_stmt);
- GIMPLE_STMT_OPERAND (new_stmt, 0) = new_temp;
- vect_finish_stmt_generation (stmt, new_stmt, bsi);
+ gimple_assign_set_lhs (new_stmt, new_temp);
+ vect_finish_stmt_generation (stmt, new_stmt, gsi);
for (k = nunits - 1; k >= 0; --k)
t = tree_cons (NULL_TREE, new_temp, t);
/* FIXME: use build_constructor directly. */
vec_inv = build_constructor_from_list (vectype, t);
- new_temp = vect_init_vector (stmt, vec_inv, vectype, bsi);
+ new_temp = vect_init_vector (stmt, vec_inv, vectype, gsi);
new_stmt = SSA_NAME_DEF_STMT (new_temp);
}
else
@@ -5970,7 +6200,7 @@ vectorizable_load (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt,
/* Store vector loads in the corresponding SLP_NODE. */
if (slp)
- VEC_quick_push (tree, SLP_TREE_VEC_STMTS (slp_node), new_stmt);
+ VEC_quick_push (gimple, SLP_TREE_VEC_STMTS (slp_node), new_stmt);
}
/* FORNOW: SLP with multiple types is unsupported. */
@@ -5979,7 +6209,7 @@ vectorizable_load (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt,
if (strided_load)
{
- if (!vect_transform_strided_load (stmt, dr_chain, group_size, bsi))
+ if (!vect_transform_strided_load (stmt, dr_chain, group_size, gsi))
return false;
*vec_stmt = STMT_VINFO_VEC_STMT (stmt_info);
VEC_free (tree, heap, dr_chain);
@@ -6008,37 +6238,42 @@ vectorizable_load (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt,
it can be supported. */
bool
-vectorizable_live_operation (tree stmt,
- block_stmt_iterator *bsi ATTRIBUTE_UNUSED,
- tree *vec_stmt ATTRIBUTE_UNUSED)
+vectorizable_live_operation (gimple stmt,
+ gimple_stmt_iterator *gsi ATTRIBUTE_UNUSED,
+ gimple *vec_stmt ATTRIBUTE_UNUSED)
{
- tree operation;
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info);
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
int i;
int op_type;
tree op;
- tree def, def_stmt;
+ tree def;
+ gimple def_stmt;
enum vect_def_type dt;
+ enum tree_code code;
+ enum gimple_rhs_class rhs_class;
gcc_assert (STMT_VINFO_LIVE_P (stmt_info));
if (STMT_VINFO_DEF_TYPE (stmt_info) == vect_reduction_def)
return false;
- if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
+ if (!is_gimple_assign (stmt))
return false;
- if (TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 0)) != SSA_NAME)
+ if (TREE_CODE (gimple_assign_lhs (stmt)) != SSA_NAME)
return false;
/* FORNOW. CHECKME. */
if (nested_in_vect_loop_p (loop, stmt))
return false;
- operation = GIMPLE_STMT_OPERAND (stmt, 1);
- op_type = TREE_OPERAND_LENGTH (operation);
+ code = gimple_assign_rhs_code (stmt);
+ op_type = TREE_CODE_LENGTH (code);
+ rhs_class = get_gimple_rhs_class (code);
+ gcc_assert (rhs_class != GIMPLE_UNARY_RHS || op_type == unary_op);
+ gcc_assert (rhs_class != GIMPLE_BINARY_RHS || op_type == binary_op);
/* FORNOW: support only if all uses are invariant. This means
that the scalar operations can remain in place, unvectorized.
@@ -6046,7 +6281,10 @@ vectorizable_live_operation (tree stmt,
for (i = 0; i < op_type; i++)
{
- op = TREE_OPERAND (operation, i);
+ if (rhs_class == GIMPLE_SINGLE_RHS)
+ op = TREE_OPERAND (gimple_op (stmt, 1), i);
+ else
+ op = gimple_op (stmt, i + 1);
if (op && !vect_is_simple_use (op, loop_vinfo, &def_stmt, &def, &dt))
{
if (vect_print_dump_info (REPORT_DETAILS))
@@ -6087,7 +6325,7 @@ vect_is_simple_cond (tree cond, loop_vec_info loop_vinfo)
if (TREE_CODE (lhs) == SSA_NAME)
{
- tree lhs_def_stmt = SSA_NAME_DEF_STMT (lhs);
+ gimple lhs_def_stmt = SSA_NAME_DEF_STMT (lhs);
if (!vect_is_simple_use (lhs, loop_vinfo, &lhs_def_stmt, &def, &dt))
return false;
}
@@ -6097,7 +6335,7 @@ vect_is_simple_cond (tree cond, loop_vec_info loop_vinfo)
if (TREE_CODE (rhs) == SSA_NAME)
{
- tree rhs_def_stmt = SSA_NAME_DEF_STMT (rhs);
+ gimple rhs_def_stmt = SSA_NAME_DEF_STMT (rhs);
if (!vect_is_simple_use (rhs, loop_vinfo, &rhs_def_stmt, &def, &dt))
return false;
}
@@ -6118,7 +6356,8 @@ vect_is_simple_cond (tree cond, loop_vec_info loop_vinfo)
Return FALSE if not a vectorizable STMT, TRUE otherwise. */
bool
-vectorizable_condition (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt)
+vectorizable_condition (gimple stmt, gimple_stmt_iterator *gsi,
+ gimple *vec_stmt)
{
tree scalar_dest = NULL_TREE;
tree vec_dest = NULL_TREE;
@@ -6135,6 +6374,7 @@ vectorizable_condition (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt)
enum vect_def_type dt;
int nunits = TYPE_VECTOR_SUBPARTS (vectype);
int ncopies = LOOP_VINFO_VECT_FACTOR (loop_vinfo) / nunits;
+ enum tree_code code;
gcc_assert (ncopies >= 1);
if (ncopies > 1)
@@ -6159,14 +6399,16 @@ vectorizable_condition (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt)
}
/* Is vectorizable conditional operation? */
- if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
+ if (!is_gimple_assign (stmt))
return false;
- op = GIMPLE_STMT_OPERAND (stmt, 1);
+ code = gimple_assign_rhs_code (stmt);
- if (TREE_CODE (op) != COND_EXPR)
+ if (code != COND_EXPR)
return false;
+ gcc_assert (gimple_assign_single_p (stmt));
+ op = gimple_assign_rhs1 (stmt);
cond_expr = TREE_OPERAND (op, 0);
then_clause = TREE_OPERAND (op, 1);
else_clause = TREE_OPERAND (op, 2);
@@ -6181,7 +6423,7 @@ vectorizable_condition (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt)
if (TREE_CODE (then_clause) == SSA_NAME)
{
- tree then_def_stmt = SSA_NAME_DEF_STMT (then_clause);
+ gimple then_def_stmt = SSA_NAME_DEF_STMT (then_clause);
if (!vect_is_simple_use (then_clause, loop_vinfo,
&then_def_stmt, &def, &dt))
return false;
@@ -6193,7 +6435,7 @@ vectorizable_condition (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt)
if (TREE_CODE (else_clause) == SSA_NAME)
{
- tree else_def_stmt = SSA_NAME_DEF_STMT (else_clause);
+ gimple else_def_stmt = SSA_NAME_DEF_STMT (else_clause);
if (!vect_is_simple_use (else_clause, loop_vinfo,
&else_def_stmt, &def, &dt))
return false;
@@ -6215,7 +6457,7 @@ vectorizable_condition (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt)
/* Transform */
/* Handle def. */
- scalar_dest = GIMPLE_STMT_OPERAND (stmt, 0);
+ scalar_dest = gimple_assign_lhs (stmt);
vec_dest = vect_create_destination_var (scalar_dest, vectype);
/* Handle cond expr. */
@@ -6232,10 +6474,10 @@ vectorizable_condition (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt)
vec_cond_expr = build3 (VEC_COND_EXPR, vectype,
vec_compare, vec_then_clause, vec_else_clause);
- *vec_stmt = build_gimple_modify_stmt (vec_dest, vec_cond_expr);
+ *vec_stmt = gimple_build_assign (vec_dest, vec_cond_expr);
new_temp = make_ssa_name (vec_dest, *vec_stmt);
- GIMPLE_STMT_OPERAND (*vec_stmt, 0) = new_temp;
- vect_finish_stmt_generation (stmt, *vec_stmt, bsi);
+ gimple_assign_set_lhs (*vec_stmt, new_temp);
+ vect_finish_stmt_generation (stmt, *vec_stmt, gsi);
return true;
}
@@ -6246,57 +6488,57 @@ vectorizable_condition (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt)
Create a vectorized stmt to replace STMT, and insert it at BSI. */
static bool
-vect_transform_stmt (tree stmt, block_stmt_iterator *bsi, bool *strided_store,
- slp_tree slp_node)
+vect_transform_stmt (gimple stmt, gimple_stmt_iterator *gsi,
+ bool *strided_store, slp_tree slp_node)
{
bool is_store = false;
- tree vec_stmt = NULL_TREE;
+ gimple vec_stmt = NULL;
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
- tree orig_stmt_in_pattern;
+ gimple orig_stmt_in_pattern;
bool done;
switch (STMT_VINFO_TYPE (stmt_info))
{
case type_demotion_vec_info_type:
gcc_assert (!slp_node);
- done = vectorizable_type_demotion (stmt, bsi, &vec_stmt);
+ done = vectorizable_type_demotion (stmt, gsi, &vec_stmt);
gcc_assert (done);
break;
case type_promotion_vec_info_type:
gcc_assert (!slp_node);
- done = vectorizable_type_promotion (stmt, bsi, &vec_stmt);
+ done = vectorizable_type_promotion (stmt, gsi, &vec_stmt);
gcc_assert (done);
break;
case type_conversion_vec_info_type:
- done = vectorizable_conversion (stmt, bsi, &vec_stmt, slp_node);
+ done = vectorizable_conversion (stmt, gsi, &vec_stmt, slp_node);
gcc_assert (done);
break;
case induc_vec_info_type:
gcc_assert (!slp_node);
- done = vectorizable_induction (stmt, bsi, &vec_stmt);
+ done = vectorizable_induction (stmt, gsi, &vec_stmt);
gcc_assert (done);
break;
case op_vec_info_type:
- done = vectorizable_operation (stmt, bsi, &vec_stmt, slp_node);
+ done = vectorizable_operation (stmt, gsi, &vec_stmt, slp_node);
gcc_assert (done);
break;
case assignment_vec_info_type:
- done = vectorizable_assignment (stmt, bsi, &vec_stmt, slp_node);
+ done = vectorizable_assignment (stmt, gsi, &vec_stmt, slp_node);
gcc_assert (done);
break;
case load_vec_info_type:
- done = vectorizable_load (stmt, bsi, &vec_stmt, slp_node);
+ done = vectorizable_load (stmt, gsi, &vec_stmt, slp_node);
gcc_assert (done);
break;
case store_vec_info_type:
- done = vectorizable_store (stmt, bsi, &vec_stmt, slp_node);
+ done = vectorizable_store (stmt, gsi, &vec_stmt, slp_node);
gcc_assert (done);
if (STMT_VINFO_STRIDED_ACCESS (stmt_info))
{
@@ -6314,18 +6556,18 @@ vect_transform_stmt (tree stmt, block_stmt_iterator *bsi, bool *strided_store,
case condition_vec_info_type:
gcc_assert (!slp_node);
- done = vectorizable_condition (stmt, bsi, &vec_stmt);
+ done = vectorizable_condition (stmt, gsi, &vec_stmt);
gcc_assert (done);
break;
case call_vec_info_type:
gcc_assert (!slp_node);
- done = vectorizable_call (stmt, bsi, &vec_stmt);
+ done = vectorizable_call (stmt, gsi, &vec_stmt);
break;
case reduc_vec_info_type:
gcc_assert (!slp_node);
- done = vectorizable_reduction (stmt, bsi, &vec_stmt);
+ done = vectorizable_reduction (stmt, gsi, &vec_stmt);
gcc_assert (done);
break;
@@ -6341,7 +6583,7 @@ vect_transform_stmt (tree stmt, block_stmt_iterator *bsi, bool *strided_store,
if (STMT_VINFO_LIVE_P (stmt_info)
&& STMT_VINFO_TYPE (stmt_info) != reduc_vec_info_type)
{
- done = vectorizable_live_operation (stmt, bsi, &vec_stmt);
+ done = vectorizable_live_operation (stmt, gsi, &vec_stmt);
gcc_assert (done);
}
@@ -6375,19 +6617,20 @@ vect_transform_stmt (tree stmt, block_stmt_iterator *bsi, bool *strided_store,
static tree
vect_build_loop_niters (loop_vec_info loop_vinfo)
{
- tree ni_name, stmt, var;
+ tree ni_name, var;
+ gimple_seq stmts = NULL;
edge pe;
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
tree ni = unshare_expr (LOOP_VINFO_NITERS (loop_vinfo));
var = create_tmp_var (TREE_TYPE (ni), "niters");
add_referenced_var (var);
- ni_name = force_gimple_operand (ni, &stmt, false, var);
+ ni_name = force_gimple_operand (ni, &stmts, false, var);
pe = loop_preheader_edge (loop);
- if (stmt)
+ if (stmts)
{
- basic_block new_bb = bsi_insert_on_edge_immediate (pe, stmt);
+ basic_block new_bb = gsi_insert_seq_on_edge_immediate (pe, stmts);
gcc_assert (!new_bb);
}
@@ -6412,7 +6655,8 @@ vect_generate_tmps_on_preheader (loop_vec_info loop_vinfo,
edge pe;
basic_block new_bb;
- tree stmt, ni_name;
+ gimple_seq stmts;
+ tree ni_name;
tree var;
tree ratio_name;
tree ratio_mult_vf_name;
@@ -6437,9 +6681,10 @@ vect_generate_tmps_on_preheader (loop_vec_info loop_vinfo,
var = create_tmp_var (TREE_TYPE (ni), "bnd");
add_referenced_var (var);
- ratio_name = force_gimple_operand (ratio_name, &stmt, true, var);
+ stmts = NULL;
+ ratio_name = force_gimple_operand (ratio_name, &stmts, true, var);
pe = loop_preheader_edge (loop);
- new_bb = bsi_insert_on_edge_immediate (pe, stmt);
+ new_bb = gsi_insert_seq_on_edge_immediate (pe, stmts);
gcc_assert (!new_bb);
}
@@ -6452,10 +6697,11 @@ vect_generate_tmps_on_preheader (loop_vec_info loop_vinfo,
var = create_tmp_var (TREE_TYPE (ni), "ratio_mult_vf");
add_referenced_var (var);
- ratio_mult_vf_name = force_gimple_operand (ratio_mult_vf_name, &stmt,
+ stmts = NULL;
+ ratio_mult_vf_name = force_gimple_operand (ratio_mult_vf_name, &stmts,
true, var);
pe = loop_preheader_edge (loop);
- new_bb = bsi_insert_on_edge_immediate (pe, stmt);
+ new_bb = gsi_insert_seq_on_edge_immediate (pe, stmts);
gcc_assert (!new_bb);
}
@@ -6514,7 +6760,8 @@ vect_update_ivs_after_vectorizer (loop_vec_info loop_vinfo, tree niters,
{
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
basic_block exit_bb = single_exit (loop)->dest;
- tree phi, phi1;
+ gimple phi, phi1;
+ gimple_stmt_iterator gsi, gsi1;
basic_block update_bb = update_e->dest;
/* gcc_assert (vect_can_advance_ivs_p (loop_vinfo)); */
@@ -6522,21 +6769,23 @@ vect_update_ivs_after_vectorizer (loop_vec_info loop_vinfo, tree niters,
/* Make sure there exists a single-predecessor exit bb: */
gcc_assert (single_pred_p (exit_bb));
- for (phi = phi_nodes (loop->header), phi1 = phi_nodes (update_bb);
- phi && phi1;
- phi = PHI_CHAIN (phi), phi1 = PHI_CHAIN (phi1))
+ for (gsi = gsi_start_phis (loop->header), gsi1 = gsi_start_phis (update_bb);
+ !gsi_end_p (gsi) && !gsi_end_p (gsi1);
+ gsi_next (&gsi), gsi_next (&gsi1))
{
tree access_fn = NULL;
tree evolution_part;
tree init_expr;
tree step_expr;
tree var, ni, ni_name;
- block_stmt_iterator last_bsi;
+ gimple_stmt_iterator last_gsi;
+ phi = gsi_stmt (gsi);
+ phi1 = gsi_stmt (gsi1);
if (vect_print_dump_info (REPORT_DETAILS))
{
fprintf (vect_dump, "vect_update_ivs_after_vectorizer: phi: ");
- print_generic_expr (vect_dump, phi, TDF_SLIM);
+ print_gimple_stmt (vect_dump, phi, 0, TDF_SLIM);
}
/* Skip virtual phi's. */
@@ -6588,9 +6837,9 @@ vect_update_ivs_after_vectorizer (loop_vec_info loop_vinfo, tree niters,
var = create_tmp_var (TREE_TYPE (init_expr), "tmp");
add_referenced_var (var);
- last_bsi = bsi_last (exit_bb);
- ni_name = force_gimple_operand_bsi (&last_bsi, ni, false, var,
- true, BSI_SAME_STMT);
+ last_gsi = gsi_last_bb (exit_bb);
+ ni_name = force_gimple_operand_gsi (&last_gsi, ni, false, var,
+ true, GSI_SAME_STMT);
/* Fix phi expressions in the successor bb. */
SET_PHI_ARG_DEF (phi1, update_e->dest_idx, ni_name);
@@ -6665,7 +6914,7 @@ vect_do_peeling_for_loop_bound (loop_vec_info loop_vinfo, tree *ratio)
/* If cost model check not done during versioning and
peeling for alignment. */
- if (!VEC_length (tree, LOOP_VINFO_MAY_MISALIGN_STMTS (loop_vinfo))
+ if (!VEC_length (gimple, LOOP_VINFO_MAY_MISALIGN_STMTS (loop_vinfo))
&& !VEC_length (ddr_p, LOOP_VINFO_MAY_ALIAS_DDRS (loop_vinfo))
&& !LOOP_PEELING_FOR_ALIGNMENT (loop_vinfo))
{
@@ -6745,11 +6994,12 @@ vect_gen_niters_for_prolog_loop (loop_vec_info loop_vinfo, tree loop_niters)
{
struct data_reference *dr = LOOP_VINFO_UNALIGNED_DR (loop_vinfo);
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
- tree var, stmt;
+ tree var;
+ gimple_seq stmts;
tree iters, iters_name;
edge pe;
basic_block new_bb;
- tree dr_stmt = DR_STMT (dr);
+ gimple dr_stmt = DR_STMT (dr);
stmt_vec_info stmt_info = vinfo_for_stmt (dr_stmt);
tree vectype = STMT_VINFO_VECTYPE (stmt_info);
int vectype_align = TYPE_ALIGN (vectype) / BITS_PER_UNIT;
@@ -6776,7 +7026,7 @@ vect_gen_niters_for_prolog_loop (loop_vec_info loop_vinfo, tree loop_niters)
}
else
{
- tree new_stmts = NULL_TREE;
+ gimple_seq new_stmts = NULL;
tree start_addr = vect_create_addr_base_for_vector_ref (dr_stmt,
&new_stmts, NULL_TREE, loop);
tree ptr_type = TREE_TYPE (start_addr);
@@ -6790,7 +7040,7 @@ vect_gen_niters_for_prolog_loop (loop_vec_info loop_vinfo, tree loop_niters)
tree byte_misalign;
tree elem_misalign;
- new_bb = bsi_insert_on_edge_immediate (pe, new_stmts);
+ new_bb = gsi_insert_seq_on_edge_immediate (pe, new_stmts);
gcc_assert (!new_bb);
/* Create: byte_misalign = addr & (vectype_size - 1) */
@@ -6822,12 +7072,13 @@ vect_gen_niters_for_prolog_loop (loop_vec_info loop_vinfo, tree loop_niters)
var = create_tmp_var (niters_type, "prolog_loop_niters");
add_referenced_var (var);
- iters_name = force_gimple_operand (iters, &stmt, false, var);
+ stmts = NULL;
+ iters_name = force_gimple_operand (iters, &stmts, false, var);
/* Insert stmt on loop preheader edge. */
- if (stmt)
+ if (stmts)
{
- basic_block new_bb = bsi_insert_on_edge_immediate (pe, stmt);
+ basic_block new_bb = gsi_insert_seq_on_edge_immediate (pe, stmts);
gcc_assert (!new_bb);
}
@@ -6905,7 +7156,7 @@ vect_do_peeling_for_alignment (loop_vec_info loop_vinfo)
/* If cost model check not done during versioning. */
- if (!VEC_length (tree, LOOP_VINFO_MAY_MISALIGN_STMTS (loop_vinfo))
+ if (!VEC_length (gimple, LOOP_VINFO_MAY_MISALIGN_STMTS (loop_vinfo))
&& !VEC_length (ddr_p, LOOP_VINFO_MAY_ALIAS_DDRS (loop_vinfo)))
{
check_profitability = true;
@@ -6971,12 +7222,12 @@ vect_do_peeling_for_alignment (loop_vec_info loop_vinfo)
static void
vect_create_cond_for_align_checks (loop_vec_info loop_vinfo,
tree *cond_expr,
- tree *cond_expr_stmt_list)
+ gimple_seq *cond_expr_stmt_list)
{
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
- VEC(tree,heap) *may_misalign_stmts
+ VEC(gimple,heap) *may_misalign_stmts
= LOOP_VINFO_MAY_MISALIGN_STMTS (loop_vinfo);
- tree ref_stmt, tmp;
+ gimple ref_stmt;
int mask = LOOP_VINFO_PTR_MASK (loop_vinfo);
tree mask_cst;
unsigned int i;
@@ -6984,7 +7235,8 @@ vect_create_cond_for_align_checks (loop_vec_info loop_vinfo,
tree int_ptrsize_type;
char tmp_name[20];
tree or_tmp_name = NULL_TREE;
- tree and_tmp, and_tmp_name, and_stmt;
+ tree and_tmp, and_tmp_name;
+ gimple and_stmt;
tree ptrsize_zero;
tree part_cond_expr;
@@ -7001,28 +7253,28 @@ vect_create_cond_for_align_checks (loop_vec_info loop_vinfo,
/* Create expression (mask & (dr_1 || ... || dr_n)) where dr_i is the address
of the first vector of the i'th data reference. */
- for (i = 0; VEC_iterate (tree, may_misalign_stmts, i, ref_stmt); i++)
+ for (i = 0; VEC_iterate (gimple, may_misalign_stmts, i, ref_stmt); i++)
{
- tree new_stmt_list = NULL_TREE;
+ gimple_seq new_stmt_list = NULL;
tree addr_base;
- tree addr_tmp, addr_tmp_name, addr_stmt;
- tree or_tmp, new_or_tmp_name, or_stmt;
+ tree addr_tmp, addr_tmp_name;
+ tree or_tmp, new_or_tmp_name;
+ gimple addr_stmt, or_stmt;
/* create: addr_tmp = (int)(address_of_first_vector) */
- addr_base = vect_create_addr_base_for_vector_ref (ref_stmt,
- &new_stmt_list, NULL_TREE, loop);
-
- if (new_stmt_list != NULL_TREE)
- append_to_statement_list_force (new_stmt_list, cond_expr_stmt_list);
+ addr_base =
+ vect_create_addr_base_for_vector_ref (ref_stmt, &new_stmt_list,
+ NULL_TREE, loop);
+ if (new_stmt_list != NULL)
+ gimple_seq_add_seq (cond_expr_stmt_list, new_stmt_list);
sprintf (tmp_name, "%s%d", "addr2int", i);
addr_tmp = create_tmp_var (int_ptrsize_type, tmp_name);
add_referenced_var (addr_tmp);
- addr_tmp_name = make_ssa_name (addr_tmp, NULL_TREE);
- addr_stmt = fold_convert (int_ptrsize_type, addr_base);
- addr_stmt = build_gimple_modify_stmt (addr_tmp_name, addr_stmt);
+ addr_tmp_name = make_ssa_name (addr_tmp, NULL);
+ addr_stmt = gimple_build_assign (addr_tmp_name, addr_base);
SSA_NAME_DEF_STMT (addr_tmp_name) = addr_stmt;
- append_to_statement_list_force (addr_stmt, cond_expr_stmt_list);
+ gimple_seq_add_stmt (cond_expr_stmt_list, addr_stmt);
/* The addresses are OR together. */
@@ -7032,12 +7284,12 @@ vect_create_cond_for_align_checks (loop_vec_info loop_vinfo,
sprintf (tmp_name, "%s%d", "orptrs", i);
or_tmp = create_tmp_var (int_ptrsize_type, tmp_name);
add_referenced_var (or_tmp);
- new_or_tmp_name = make_ssa_name (or_tmp, NULL_TREE);
- tmp = build2 (BIT_IOR_EXPR, int_ptrsize_type,
- or_tmp_name, addr_tmp_name);
- or_stmt = build_gimple_modify_stmt (new_or_tmp_name, tmp);
+ new_or_tmp_name = make_ssa_name (or_tmp, NULL);
+ or_stmt = gimple_build_assign_with_ops (BIT_IOR_EXPR,
+ new_or_tmp_name,
+ or_tmp_name, addr_tmp_name);
SSA_NAME_DEF_STMT (new_or_tmp_name) = or_stmt;
- append_to_statement_list_force (or_stmt, cond_expr_stmt_list);
+ gimple_seq_add_stmt (cond_expr_stmt_list, or_stmt);
or_tmp_name = new_or_tmp_name;
}
else
@@ -7050,12 +7302,12 @@ vect_create_cond_for_align_checks (loop_vec_info loop_vinfo,
/* create: and_tmp = or_tmp & mask */
and_tmp = create_tmp_var (int_ptrsize_type, "andmask" );
add_referenced_var (and_tmp);
- and_tmp_name = make_ssa_name (and_tmp, NULL_TREE);
+ and_tmp_name = make_ssa_name (and_tmp, NULL);
- tmp = build2 (BIT_AND_EXPR, int_ptrsize_type, or_tmp_name, mask_cst);
- and_stmt = build_gimple_modify_stmt (and_tmp_name, tmp);
+ and_stmt = gimple_build_assign_with_ops (BIT_AND_EXPR, and_tmp_name,
+ or_tmp_name, mask_cst);
SSA_NAME_DEF_STMT (and_tmp_name) = and_stmt;
- append_to_statement_list_force (and_stmt, cond_expr_stmt_list);
+ gimple_seq_add_stmt (cond_expr_stmt_list, and_stmt);
/* Make and_tmp the left operand of the conditional test against zero.
if and_tmp has a nonzero bit then some address is unaligned. */
@@ -7124,7 +7376,7 @@ vect_vfa_segment_size (struct data_reference *dr, tree vect_factor)
static void
vect_create_cond_for_alias_checks (loop_vec_info loop_vinfo,
tree * cond_expr,
- tree * cond_expr_stmt_list)
+ gimple_seq * cond_expr_stmt_list)
{
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
VEC (ddr_p, heap) * may_alias_ddrs =
@@ -7151,10 +7403,10 @@ vect_create_cond_for_alias_checks (loop_vec_info loop_vinfo,
for (i = 0; VEC_iterate (ddr_p, may_alias_ddrs, i, ddr); i++)
{
struct data_reference *dr_a, *dr_b;
- tree dr_group_first_a, dr_group_first_b;
+ gimple dr_group_first_a, dr_group_first_b;
tree addr_base_a, addr_base_b;
tree segment_length_a, segment_length_b;
- tree stmt_a, stmt_b;
+ gimple stmt_a, stmt_b;
dr_a = DDR_A (ddr);
stmt_a = DR_STMT (DDR_A (ddr));
@@ -7209,7 +7461,7 @@ vect_create_cond_for_alias_checks (loop_vec_info loop_vinfo,
if (*cond_expr)
*cond_expr = fold_build2 (TRUTH_AND_EXPR, boolean_type_node,
- *cond_expr, part_cond_expr);
+ *cond_expr, part_cond_expr);
else
*cond_expr = part_cond_expr;
}
@@ -7241,15 +7493,16 @@ vect_loop_versioning (loop_vec_info loop_vinfo)
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
struct loop *nloop;
tree cond_expr = NULL_TREE;
- tree cond_expr_stmt_list = NULL_TREE;
+ gimple_seq cond_expr_stmt_list = NULL;
basic_block condition_bb;
- block_stmt_iterator cond_exp_bsi;
+ gimple_stmt_iterator gsi, cond_exp_gsi;
basic_block merge_bb;
basic_block new_exit_bb;
edge new_exit_e, e;
- tree orig_phi, new_phi, arg;
+ gimple orig_phi, new_phi;
+ tree arg;
unsigned prob = 4 * REG_BR_PROB_BASE / 5;
- tree gimplify_stmt_list;
+ gimple_seq gimplify_stmt_list = NULL;
tree scalar_loop_iters = LOOP_VINFO_NITERS (loop_vinfo);
int min_profitable_iters = 0;
unsigned int th;
@@ -7267,7 +7520,7 @@ vect_loop_versioning (loop_vec_info loop_vinfo)
cond_expr = force_gimple_operand (cond_expr, &cond_expr_stmt_list,
false, NULL_TREE);
- if (VEC_length (tree, LOOP_VINFO_MAY_MISALIGN_STMTS (loop_vinfo)))
+ if (VEC_length (gimple, LOOP_VINFO_MAY_MISALIGN_STMTS (loop_vinfo)))
vect_create_cond_for_align_checks (loop_vinfo, &cond_expr,
&cond_expr_stmt_list);
@@ -7278,9 +7531,8 @@ vect_loop_versioning (loop_vec_info loop_vinfo)
cond_expr =
fold_build2 (NE_EXPR, boolean_type_node, cond_expr, integer_zero_node);
cond_expr =
- force_gimple_operand (cond_expr, &gimplify_stmt_list, true,
- NULL_TREE);
- append_to_statement_list (gimplify_stmt_list, &cond_expr_stmt_list);
+ force_gimple_operand (cond_expr, &gimplify_stmt_list, true, NULL_TREE);
+ gimple_seq_add_seq (&cond_expr_stmt_list, gimplify_stmt_list);
initialize_original_copy_tables ();
nloop = loop_version (loop, cond_expr, &condition_bb,
@@ -7301,9 +7553,9 @@ vect_loop_versioning (loop_vec_info loop_vinfo)
new_exit_e = single_exit (loop);
e = EDGE_SUCC (new_exit_bb, 0);
- for (orig_phi = phi_nodes (merge_bb); orig_phi;
- orig_phi = PHI_CHAIN (orig_phi))
+ for (gsi = gsi_start_phis (merge_bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
+ orig_phi = gsi_stmt (gsi);
new_phi = create_phi_node (SSA_NAME_VAR (PHI_RESULT (orig_phi)),
new_exit_bb);
arg = PHI_ARG_DEF_FROM_EDGE (orig_phi, e);
@@ -7316,8 +7568,8 @@ vect_loop_versioning (loop_vec_info loop_vinfo)
update_ssa (TODO_update_ssa);
if (cond_expr_stmt_list)
{
- cond_exp_bsi = bsi_last (condition_bb);
- bsi_insert_before (&cond_exp_bsi, cond_expr_stmt_list, BSI_SAME_STMT);
+ cond_exp_gsi = gsi_last_bb (condition_bb);
+ gsi_insert_seq_before (&cond_exp_gsi, cond_expr_stmt_list, GSI_SAME_STMT);
}
}
@@ -7325,17 +7577,17 @@ vect_loop_versioning (loop_vec_info loop_vinfo)
stmt_vec_info. */
static void
-vect_remove_stores (tree first_stmt)
+vect_remove_stores (gimple first_stmt)
{
- tree next = first_stmt;
- tree tmp;
- block_stmt_iterator next_si;
+ gimple next = first_stmt;
+ gimple tmp;
+ gimple_stmt_iterator next_si;
while (next)
{
/* Free the attached stmt_vec_info and remove the stmt. */
- next_si = bsi_for_stmt (next);
- bsi_remove (&next_si, true);
+ next_si = gsi_for_stmt (next);
+ gsi_remove (&next_si, true);
tmp = DR_GROUP_NEXT_DR (vinfo_for_stmt (next));
free_stmt_vec_info (next);
next = tmp;
@@ -7348,9 +7600,9 @@ vect_remove_stores (tree first_stmt)
static bool
vect_schedule_slp_instance (slp_tree node, unsigned int vec_stmts_size)
{
- tree stmt;
+ gimple stmt;
bool strided_store, is_store;
- block_stmt_iterator si;
+ gimple_stmt_iterator si;
stmt_vec_info stmt_info;
if (!node)
@@ -7359,18 +7611,18 @@ vect_schedule_slp_instance (slp_tree node, unsigned int vec_stmts_size)
vect_schedule_slp_instance (SLP_TREE_LEFT (node), vec_stmts_size);
vect_schedule_slp_instance (SLP_TREE_RIGHT (node), vec_stmts_size);
- stmt = VEC_index(tree, SLP_TREE_SCALAR_STMTS (node), 0);
+ stmt = VEC_index(gimple, SLP_TREE_SCALAR_STMTS (node), 0);
stmt_info = vinfo_for_stmt (stmt);
- SLP_TREE_VEC_STMTS (node) = VEC_alloc (tree, heap, vec_stmts_size);
+ SLP_TREE_VEC_STMTS (node) = VEC_alloc (gimple, heap, vec_stmts_size);
SLP_TREE_NUMBER_OF_VEC_STMTS (node) = vec_stmts_size;
if (vect_print_dump_info (REPORT_DETAILS))
{
fprintf (vect_dump, "------>vectorizing SLP node starting from: ");
- print_generic_expr (vect_dump, stmt, TDF_SLIM);
+ print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
- si = bsi_for_stmt (stmt);
+ si = gsi_for_stmt (stmt);
is_store = vect_transform_stmt (stmt, &si, &strided_store, node);
if (is_store)
{
@@ -7436,7 +7688,7 @@ vect_transform_loop (loop_vec_info loop_vinfo)
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
basic_block *bbs = LOOP_VINFO_BBS (loop_vinfo);
int nbbs = loop->num_nodes;
- block_stmt_iterator si;
+ gimple_stmt_iterator si;
int i;
tree ratio = NULL;
int vectorization_factor = LOOP_VINFO_VECT_FACTOR (loop_vinfo);
@@ -7447,7 +7699,7 @@ vect_transform_loop (loop_vec_info loop_vinfo)
if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "=== vec_transform_loop ===");
- if (VEC_length (tree, LOOP_VINFO_MAY_MISALIGN_STMTS (loop_vinfo))
+ if (VEC_length (gimple, LOOP_VINFO_MAY_MISALIGN_STMTS (loop_vinfo))
|| VEC_length (ddr_p, LOOP_VINFO_MAY_ALIAS_DDRS (loop_vinfo)))
vect_loop_versioning (loop_vinfo);
@@ -7493,14 +7745,15 @@ vect_transform_loop (loop_vec_info loop_vinfo)
{
basic_block bb = bbs[i];
stmt_vec_info stmt_info;
- tree phi;
+ gimple phi;
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
+ for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si))
{
+ phi = gsi_stmt (si);
if (vect_print_dump_info (REPORT_DETAILS))
{
fprintf (vect_dump, "------>vectorizing phi: ");
- print_generic_expr (vect_dump, phi, TDF_SLIM);
+ print_gimple_stmt (vect_dump, phi, 0, TDF_SLIM);
}
stmt_info = vinfo_for_stmt (phi);
if (!stmt_info)
@@ -7523,15 +7776,15 @@ vect_transform_loop (loop_vec_info loop_vinfo)
}
}
- for (si = bsi_start (bb); !bsi_end_p (si);)
+ for (si = gsi_start_bb (bb); !gsi_end_p (si);)
{
- tree stmt = bsi_stmt (si);
+ gimple stmt = gsi_stmt (si);
bool is_store;
if (vect_print_dump_info (REPORT_DETAILS))
{
fprintf (vect_dump, "------>vectorizing statement: ");
- print_generic_expr (vect_dump, stmt, TDF_SLIM);
+ print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
stmt_info = vinfo_for_stmt (stmt);
@@ -7541,14 +7794,14 @@ vect_transform_loop (loop_vec_info loop_vinfo)
need to be vectorized. */
if (!stmt_info)
{
- bsi_next (&si);
+ gsi_next (&si);
continue;
}
if (!STMT_VINFO_RELEVANT_P (stmt_info)
&& !STMT_VINFO_LIVE_P (stmt_info))
{
- bsi_next (&si);
+ gsi_next (&si);
continue;
}
@@ -7580,7 +7833,7 @@ vect_transform_loop (loop_vec_info loop_vinfo)
vect_schedule_slp_instance and their vinfo is destroyed. */
if (is_store)
{
- bsi_next (&si);
+ gsi_next (&si);
continue;
}
}
@@ -7588,7 +7841,7 @@ vect_transform_loop (loop_vec_info loop_vinfo)
/* Hybrid SLP stmts must be vectorized in addition to SLP. */
if (PURE_SLP_STMT (stmt_info))
{
- bsi_next (&si);
+ gsi_next (&si);
continue;
}
}
@@ -7607,18 +7860,18 @@ vect_transform_loop (loop_vec_info loop_vinfo)
interleaving chain was completed - free all the stores in
the chain. */
vect_remove_stores (DR_GROUP_FIRST_DR (stmt_info));
- bsi_remove (&si, true);
+ gsi_remove (&si, true);
continue;
}
else
{
/* Free the attached stmt_vec_info and remove the stmt. */
free_stmt_vec_info (stmt);
- bsi_remove (&si, true);
+ gsi_remove (&si, true);
continue;
}
}
- bsi_next (&si);
+ gsi_next (&si);
} /* stmts in BB */
} /* BBs in loop */
diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c
index 5bfa30b21d4..78f82624c23 100644
--- a/gcc/tree-vectorizer.c
+++ b/gcc/tree-vectorizer.c
@@ -144,8 +144,10 @@ along with GCC; see the file COPYING3. If not see
#include "tree-data-ref.h"
#include "tree-scalar-evolution.h"
#include "input.h"
+#include "hashtab.h"
#include "tree-vectorizer.h"
#include "tree-pass.h"
+#include "langhooks.h"
/*************************************************************************
General Vectorization Utilities
@@ -163,6 +165,10 @@ static LOC vect_loop_location;
/* Bitmap of virtual variables to be renamed. */
bitmap vect_memsyms_to_rename;
+
+/* Vector mapping GIMPLE stmt to stmt_vec_info. */
+VEC(vec_void_p,heap) *stmt_vec_info_vec;
+
/*************************************************************************
Simple Loop Peeling Utilities
@@ -198,18 +204,17 @@ rename_use_op (use_operand_p op_p)
static void
rename_variables_in_bb (basic_block bb)
{
- tree phi;
- block_stmt_iterator bsi;
- tree stmt;
+ gimple_stmt_iterator gsi;
+ gimple stmt;
use_operand_p use_p;
ssa_op_iter iter;
edge e;
edge_iterator ei;
struct loop *loop = bb->loop_father;
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- stmt = bsi_stmt (bsi);
+ stmt = gsi_stmt (gsi);
FOR_EACH_SSA_USE_OPERAND (use_p, stmt, iter, SSA_OP_ALL_USES)
rename_use_op (use_p);
}
@@ -218,8 +223,8 @@ rename_variables_in_bb (basic_block bb)
{
if (!flow_bb_inside_loop_p (loop, e->dest))
continue;
- for (phi = phi_nodes (e->dest); phi; phi = PHI_CHAIN (phi))
- rename_use_op (PHI_ARG_DEF_PTR_FROM_EDGE (phi, e));
+ for (gsi = gsi_start_phis (e->dest); !gsi_end_p (gsi); gsi_next (&gsi))
+ rename_use_op (PHI_ARG_DEF_PTR_FROM_EDGE (gsi_stmt (gsi), e));
}
}
@@ -253,13 +258,14 @@ slpeel_update_phis_for_duplicate_loop (struct loop *orig_loop,
struct loop *new_loop, bool after)
{
tree new_ssa_name;
- tree phi_new, phi_orig;
+ gimple phi_new, phi_orig;
tree def;
edge orig_loop_latch = loop_latch_edge (orig_loop);
edge orig_entry_e = loop_preheader_edge (orig_loop);
edge new_loop_exit_e = single_exit (new_loop);
edge new_loop_entry_e = loop_preheader_edge (new_loop);
edge entry_arg_e = (after ? orig_loop_latch : orig_entry_e);
+ gimple_stmt_iterator gsi_new, gsi_orig;
/*
step 1. For each loop-header-phi:
@@ -290,11 +296,14 @@ slpeel_update_phis_for_duplicate_loop (struct loop *orig_loop,
/* Scan the phis in the headers of the old and new loops
(they are organized in exactly the same order). */
- for (phi_new = phi_nodes (new_loop->header),
- phi_orig = phi_nodes (orig_loop->header);
- phi_new && phi_orig;
- phi_new = PHI_CHAIN (phi_new), phi_orig = PHI_CHAIN (phi_orig))
+ for (gsi_new = gsi_start_phis (new_loop->header),
+ gsi_orig = gsi_start_phis (orig_loop->header);
+ !gsi_end_p (gsi_new) && !gsi_end_p (gsi_orig);
+ gsi_next (&gsi_new), gsi_next (&gsi_orig))
{
+ phi_new = gsi_stmt (gsi_new);
+ phi_orig = gsi_stmt (gsi_orig);
+
/* step 1. */
def = PHI_ARG_DEF_FROM_EDGE (phi_orig, entry_arg_e);
add_phi_arg (phi_new, def, new_loop_entry_e);
@@ -485,8 +494,8 @@ slpeel_update_phi_nodes_for_guard1 (edge guard_edge, struct loop *loop,
bool is_new_loop, basic_block *new_exit_bb,
bitmap *defs)
{
- tree orig_phi, new_phi;
- tree update_phi, update_phi2;
+ gimple orig_phi, new_phi;
+ gimple update_phi, update_phi2;
tree guard_arg, loop_arg;
basic_block new_merge_bb = guard_edge->dest;
edge e = EDGE_SUCC (new_merge_bb, 0);
@@ -495,16 +504,21 @@ slpeel_update_phi_nodes_for_guard1 (edge guard_edge, struct loop *loop,
edge new_exit_e;
tree current_new_name;
tree name;
+ gimple_stmt_iterator gsi_orig, gsi_update;
/* Create new bb between loop and new_merge_bb. */
*new_exit_bb = split_edge (single_exit (loop));
new_exit_e = EDGE_SUCC (*new_exit_bb, 0);
- for (orig_phi = phi_nodes (orig_bb), update_phi = phi_nodes (update_bb);
- orig_phi && update_phi;
- orig_phi = PHI_CHAIN (orig_phi), update_phi = PHI_CHAIN (update_phi))
+ for (gsi_orig = gsi_start_phis (orig_bb),
+ gsi_update = gsi_start_phis (update_bb);
+ !gsi_end_p (gsi_orig) && !gsi_end_p (gsi_update);
+ gsi_next (&gsi_orig), gsi_next (&gsi_update))
{
+ orig_phi = gsi_stmt (gsi_orig);
+ update_phi = gsi_stmt (gsi_update);
+
/* Virtual phi; Mark it for renaming. We actually want to call
mar_sym_for_renaming, but since all ssa renaming datastructures
are going to be freed before we get to call ssa_update, we just
@@ -578,8 +592,6 @@ slpeel_update_phi_nodes_for_guard1 (edge guard_edge, struct loop *loop,
set_current_def (current_new_name, PHI_RESULT (new_phi));
bitmap_set_bit (*defs, SSA_NAME_VERSION (current_new_name));
}
-
- set_phi_nodes (new_merge_bb, phi_reverse (phi_nodes (new_merge_bb)));
}
@@ -613,8 +625,8 @@ static void
slpeel_update_phi_nodes_for_guard2 (edge guard_edge, struct loop *loop,
bool is_new_loop, basic_block *new_exit_bb)
{
- tree orig_phi, new_phi;
- tree update_phi, update_phi2;
+ gimple orig_phi, new_phi;
+ gimple update_phi, update_phi2;
tree guard_arg, loop_arg;
basic_block new_merge_bb = guard_edge->dest;
edge e = EDGE_SUCC (new_merge_bb, 0);
@@ -623,15 +635,16 @@ slpeel_update_phi_nodes_for_guard2 (edge guard_edge, struct loop *loop,
tree orig_def, orig_def_new_name;
tree new_name, new_name2;
tree arg;
+ gimple_stmt_iterator gsi;
/* Create new bb between loop and new_merge_bb. */
*new_exit_bb = split_edge (single_exit (loop));
new_exit_e = EDGE_SUCC (*new_exit_bb, 0);
- for (update_phi = phi_nodes (update_bb); update_phi;
- update_phi = PHI_CHAIN (update_phi))
+ for (gsi = gsi_start_phis (update_bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
+ update_phi = gsi_stmt (gsi);
orig_phi = update_phi;
orig_def = PHI_ARG_DEF_FROM_EDGE (orig_phi, e);
/* This loop-closed-phi actually doesn't represent a use
@@ -732,8 +745,6 @@ slpeel_update_phi_nodes_for_guard2 (edge guard_edge, struct loop *loop,
== guard_arg);
SET_PHI_ARG_DEF (update_phi2, guard_edge->dest_idx, PHI_RESULT (new_phi));
}
-
- set_phi_nodes (new_merge_bb, phi_reverse (phi_nodes (new_merge_bb)));
}
@@ -745,35 +756,40 @@ slpeel_update_phi_nodes_for_guard2 (edge guard_edge, struct loop *loop,
void
slpeel_make_loop_iterate_ntimes (struct loop *loop, tree niters)
{
- tree indx_before_incr, indx_after_incr, cond_stmt, cond;
- tree orig_cond;
+ tree indx_before_incr, indx_after_incr;
+ gimple cond_stmt;
+ gimple orig_cond;
edge exit_edge = single_exit (loop);
- block_stmt_iterator loop_cond_bsi;
- block_stmt_iterator incr_bsi;
+ gimple_stmt_iterator loop_cond_gsi;
+ gimple_stmt_iterator incr_gsi;
bool insert_after;
tree init = build_int_cst (TREE_TYPE (niters), 0);
tree step = build_int_cst (TREE_TYPE (niters), 1);
LOC loop_loc;
+ enum tree_code code;
orig_cond = get_loop_exit_condition (loop);
gcc_assert (orig_cond);
- loop_cond_bsi = bsi_for_stmt (orig_cond);
+ loop_cond_gsi = gsi_for_stmt (orig_cond);
- standard_iv_increment_position (loop, &incr_bsi, &insert_after);
+ standard_iv_increment_position (loop, &incr_gsi, &insert_after);
create_iv (init, step, NULL_TREE, loop,
- &incr_bsi, insert_after, &indx_before_incr, &indx_after_incr);
+ &incr_gsi, insert_after, &indx_before_incr, &indx_after_incr);
+
+ indx_after_incr = force_gimple_operand_gsi (&loop_cond_gsi, indx_after_incr,
+ true, NULL_TREE, true,
+ GSI_SAME_STMT);
+ niters = force_gimple_operand_gsi (&loop_cond_gsi, niters, true, NULL_TREE,
+ true, GSI_SAME_STMT);
- if (exit_edge->flags & EDGE_TRUE_VALUE) /* 'then' edge exits the loop. */
- cond = build2 (GE_EXPR, boolean_type_node, indx_after_incr, niters);
- else /* 'then' edge loops back. */
- cond = build2 (LT_EXPR, boolean_type_node, indx_after_incr, niters);
+ code = (exit_edge->flags & EDGE_TRUE_VALUE) ? GE_EXPR : LT_EXPR;
+ cond_stmt = gimple_build_cond (code, indx_after_incr, niters, NULL_TREE,
+ NULL_TREE);
- cond_stmt = build3 (COND_EXPR, TREE_TYPE (orig_cond), cond,
- NULL_TREE, NULL_TREE);
- bsi_insert_before (&loop_cond_bsi, cond_stmt, BSI_SAME_STMT);
+ gsi_insert_before (&loop_cond_gsi, cond_stmt, GSI_SAME_STMT);
/* Remove old loop exit test: */
- bsi_remove (&loop_cond_bsi, true);
+ gsi_remove (&loop_cond_gsi, true);
loop_loc = find_loop_location (loop);
if (dump_file && (dump_flags & TDF_DETAILS))
@@ -781,7 +797,7 @@ slpeel_make_loop_iterate_ntimes (struct loop *loop, tree niters)
if (loop_loc != UNKNOWN_LOC)
fprintf (dump_file, "\nloop at %s:%d: ",
LOC_FILE (loop_loc), LOC_LINE (loop_loc));
- print_generic_expr (dump_file, cond_stmt, TDF_SLIM);
+ print_gimple_stmt (dump_file, cond_stmt, 0, TDF_SLIM);
}
loop->nb_iterations = niters;
@@ -799,8 +815,10 @@ slpeel_tree_duplicate_loop_to_edge_cfg (struct loop *loop, edge e)
bool at_exit;
bool was_imm_dom;
basic_block exit_dest;
- tree phi, phi_arg;
+ gimple phi;
+ tree phi_arg;
edge exit, new_exit;
+ gimple_stmt_iterator gsi;
at_exit = (e == single_exit (loop));
if (!at_exit && e != loop_preheader_edge (loop))
@@ -837,8 +855,9 @@ slpeel_tree_duplicate_loop_to_edge_cfg (struct loop *loop, edge e)
/* Duplicating phi args at exit bbs as coming
also from exit of duplicated loop. */
- for (phi = phi_nodes (exit_dest); phi; phi = PHI_CHAIN (phi))
+ for (gsi = gsi_start_phis (exit_dest); !gsi_end_p (gsi); gsi_next (&gsi))
{
+ phi = gsi_stmt (gsi);
phi_arg = PHI_ARG_DEF_FROM_EDGE (phi, single_exit (loop));
if (phi_arg)
{
@@ -880,8 +899,11 @@ slpeel_tree_duplicate_loop_to_edge_cfg (struct loop *loop, edge e)
/* We have to add phi args to the loop->header here as coming
from new_exit_e edge. */
- for (phi = phi_nodes (loop->header); phi; phi = PHI_CHAIN (phi))
+ for (gsi = gsi_start_phis (loop->header);
+ !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
+ phi = gsi_stmt (gsi);
phi_arg = PHI_ARG_DEF_FROM_EDGE (phi, entry_e);
if (phi_arg)
add_phi_arg (phi, phi_arg, new_exit_e);
@@ -908,26 +930,26 @@ static edge
slpeel_add_loop_guard (basic_block guard_bb, tree cond, basic_block exit_bb,
basic_block dom_bb)
{
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
edge new_e, enter_e;
- tree cond_stmt;
- tree gimplify_stmt_list;
+ gimple cond_stmt;
+ gimple_seq gimplify_stmt_list = NULL;
enter_e = EDGE_SUCC (guard_bb, 0);
enter_e->flags &= ~EDGE_FALLTHRU;
enter_e->flags |= EDGE_FALSE_VALUE;
- bsi = bsi_last (guard_bb);
+ gsi = gsi_last_bb (guard_bb);
cond =
force_gimple_operand (cond, &gimplify_stmt_list, true,
NULL_TREE);
- cond_stmt = build3 (COND_EXPR, void_type_node, cond,
- NULL_TREE, NULL_TREE);
+ cond_stmt = gimple_build_cond (NE_EXPR, cond, integer_zero_node,
+ NULL_TREE, NULL_TREE);
if (gimplify_stmt_list)
- bsi_insert_after (&bsi, gimplify_stmt_list, BSI_NEW_STMT);
+ gsi_insert_seq_after (&gsi, gimplify_stmt_list, GSI_NEW_STMT);
- bsi = bsi_last (guard_bb);
- bsi_insert_after (&bsi, cond_stmt, BSI_NEW_STMT);
+ gsi = gsi_last_bb (guard_bb);
+ gsi_insert_after (&gsi, cond_stmt, GSI_NEW_STMT);
/* Add new edge to connect guard block to the merge/loop-exit block. */
new_e = make_edge (guard_bb, exit_bb, EDGE_TRUE_VALUE);
@@ -949,8 +971,8 @@ slpeel_can_duplicate_loop_p (const struct loop *loop, const_edge e)
{
edge exit_e = single_exit (loop);
edge entry_e = loop_preheader_edge (loop);
- tree orig_cond = get_loop_exit_condition (loop);
- block_stmt_iterator loop_exit_bsi = bsi_last (exit_e->src);
+ gimple orig_cond = get_loop_exit_condition (loop);
+ gimple_stmt_iterator loop_exit_gsi = gsi_last_bb (exit_e->src);
if (need_ssa_update_p ())
return false;
@@ -963,7 +985,7 @@ slpeel_can_duplicate_loop_p (const struct loop *loop, const_edge e)
|| !empty_block_p (loop->latch)
|| !single_exit (loop)
/* Verify that new loop exit condition can be trivially modified. */
- || (!orig_cond || orig_cond != bsi_stmt (loop_exit_bsi))
+ || (!orig_cond || orig_cond != gsi_stmt (loop_exit_gsi))
|| (e != exit_e && e != entry_e))
return false;
@@ -1017,12 +1039,12 @@ set_prologue_iterations (basic_block bb_before_first_loop,
{
edge e;
basic_block cond_bb, then_bb;
- tree var, prologue_after_cost_adjust_name, stmt;
- block_stmt_iterator bsi;
- tree newphi;
+ tree var, prologue_after_cost_adjust_name;
+ gimple_stmt_iterator gsi;
+ gimple newphi;
edge e_true, e_false, e_fallthru;
- tree cond_stmt;
- tree gimplify_stmt_list;
+ gimple cond_stmt;
+ gimple_seq gimplify_stmt_list = NULL, stmts = NULL;
tree cost_pre_condition = NULL_TREE;
tree scalar_loop_iters =
unshare_expr (LOOP_VINFO_NITERS_UNCHANGED (loop_vec_info_for_loop (loop)));
@@ -1050,25 +1072,25 @@ set_prologue_iterations (basic_block bb_before_first_loop,
cost_pre_condition =
force_gimple_operand (cost_pre_condition, &gimplify_stmt_list,
true, NULL_TREE);
- cond_stmt = build3 (COND_EXPR, void_type_node, cost_pre_condition,
- NULL_TREE, NULL_TREE);
+ cond_stmt = gimple_build_cond (NE_EXPR, cost_pre_condition,
+ integer_zero_node, NULL_TREE, NULL_TREE);
- bsi = bsi_last (cond_bb);
+ gsi = gsi_last_bb (cond_bb);
if (gimplify_stmt_list)
- bsi_insert_after (&bsi, gimplify_stmt_list, BSI_NEW_STMT);
+ gsi_insert_seq_after (&gsi, gimplify_stmt_list, GSI_NEW_STMT);
- bsi = bsi_last (cond_bb);
- bsi_insert_after (&bsi, cond_stmt, BSI_NEW_STMT);
+ gsi = gsi_last_bb (cond_bb);
+ gsi_insert_after (&gsi, cond_stmt, GSI_NEW_STMT);
var = create_tmp_var (TREE_TYPE (scalar_loop_iters),
"prologue_after_cost_adjust");
add_referenced_var (var);
prologue_after_cost_adjust_name =
- force_gimple_operand (scalar_loop_iters, &stmt, false, var);
+ force_gimple_operand (scalar_loop_iters, &stmts, false, var);
- bsi = bsi_last (then_bb);
- if (stmt)
- bsi_insert_after (&bsi, stmt, BSI_NEW_STMT);
+ gsi = gsi_last_bb (then_bb);
+ if (stmts)
+ gsi_insert_seq_after (&gsi, stmts, GSI_NEW_STMT);
newphi = create_phi_node (var, bb_before_first_loop);
add_phi_arg (newphi, prologue_after_cost_adjust_name, e_fallthru);
@@ -1150,7 +1172,7 @@ slpeel_tree_peel_loop_to_edge (struct loop *loop,
cfg_hooks->split_edge, the function tree_split_edge
is actually called and, when calling cfg_hooks->duplicate_block,
the function tree_duplicate_bb is called. */
- tree_register_cfg_hooks ();
+ gimple_register_cfg_hooks ();
/* 1. Generate a copy of LOOP and put it on E (E is the entry/exit of LOOP).
@@ -1381,18 +1403,17 @@ slpeel_tree_peel_loop_to_edge (struct loop *loop,
LOC
find_loop_location (struct loop *loop)
{
- tree node = NULL_TREE;
+ gimple stmt = NULL;
basic_block bb;
- block_stmt_iterator si;
+ gimple_stmt_iterator si;
if (!loop)
return UNKNOWN_LOC;
- node = get_loop_exit_condition (loop);
+ stmt = get_loop_exit_condition (loop);
- if (node && CAN_HAVE_LOCATION_P (node) && EXPR_HAS_LOCATION (node)
- && EXPR_FILENAME (node) && EXPR_LINENO (node))
- return EXPR_LOC (node);
+ if (stmt && gimple_location (stmt) != UNKNOWN_LOC)
+ return gimple_location (stmt);
/* If we got here the loop is probably not "well formed",
try to estimate the loop location */
@@ -1402,11 +1423,11 @@ find_loop_location (struct loop *loop)
bb = loop->header;
- for (si = bsi_start (bb); !bsi_end_p (si); bsi_next (&si))
+ for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si))
{
- node = bsi_stmt (si);
- if (node && CAN_HAVE_LOCATION_P (node) && EXPR_HAS_LOCATION (node))
- return EXPR_LOC (node);
+ stmt = gsi_stmt (si);
+ if (gimple_location (stmt) != UNKNOWN_LOC)
+ return gimple_location (stmt);
}
return UNKNOWN_LOC;
@@ -1504,7 +1525,7 @@ vect_print_dump_info (enum verbosity_levels vl)
Create and initialize a new stmt_vec_info struct for STMT. */
stmt_vec_info
-new_stmt_vec_info (tree stmt, loop_vec_info loop_vinfo)
+new_stmt_vec_info (gimple stmt, loop_vec_info loop_vinfo)
{
stmt_vec_info res;
res = (stmt_vec_info) xcalloc (1, sizeof (struct _stmt_vec_info));
@@ -1526,7 +1547,8 @@ new_stmt_vec_info (tree stmt, loop_vec_info loop_vinfo)
STMT_VINFO_DR_STEP (res) = NULL;
STMT_VINFO_DR_ALIGNED_TO (res) = NULL;
- if (TREE_CODE (stmt) == PHI_NODE && is_loop_header_bb_p (bb_for_stmt (stmt)))
+ if (gimple_code (stmt) == GIMPLE_PHI
+ && is_loop_header_bb_p (gimple_bb (stmt)))
STMT_VINFO_DEF_TYPE (res) = vect_unknown_def_type;
else
STMT_VINFO_DEF_TYPE (res) = vect_loop_def;
@@ -1534,22 +1556,39 @@ new_stmt_vec_info (tree stmt, loop_vec_info loop_vinfo)
STMT_VINFO_INSIDE_OF_LOOP_COST (res) = 0;
STMT_VINFO_OUTSIDE_OF_LOOP_COST (res) = 0;
STMT_SLP_TYPE (res) = 0;
- DR_GROUP_FIRST_DR (res) = NULL_TREE;
- DR_GROUP_NEXT_DR (res) = NULL_TREE;
+ DR_GROUP_FIRST_DR (res) = NULL;
+ DR_GROUP_NEXT_DR (res) = NULL;
DR_GROUP_SIZE (res) = 0;
DR_GROUP_STORE_COUNT (res) = 0;
DR_GROUP_GAP (res) = 0;
- DR_GROUP_SAME_DR_STMT (res) = NULL_TREE;
+ DR_GROUP_SAME_DR_STMT (res) = NULL;
DR_GROUP_READ_WRITE_DEPENDENCE (res) = false;
return res;
}
+/* Create a hash table for stmt_vec_info. */
+
+void
+init_stmt_vec_info_vec (void)
+{
+ gcc_assert (!stmt_vec_info_vec);
+ stmt_vec_info_vec = VEC_alloc (vec_void_p, heap, 50);
+}
+
+/* Free hash table for stmt_vec_info. */
+
+void
+free_stmt_vec_info_vec (void)
+{
+ gcc_assert (stmt_vec_info_vec);
+ VEC_free (vec_void_p, heap, stmt_vec_info_vec);
+}
/* Free stmt vectorization related info. */
void
-free_stmt_vec_info (tree stmt)
+free_stmt_vec_info (gimple stmt)
{
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
@@ -1557,8 +1596,8 @@ free_stmt_vec_info (tree stmt)
return;
VEC_free (dr_p, heap, STMT_VINFO_SAME_ALIGN_REFS (stmt_info));
+ set_vinfo_for_stmt (stmt, NULL);
free (stmt_info);
- set_stmt_info (stmt_ann (stmt), NULL);
}
@@ -1586,7 +1625,7 @@ new_loop_vec_info (struct loop *loop)
{
loop_vec_info res;
basic_block *bbs;
- block_stmt_iterator si;
+ gimple_stmt_iterator si;
unsigned int i, nbbs;
res = (loop_vec_info) xcalloc (1, sizeof (struct _loop_vec_info));
@@ -1598,7 +1637,6 @@ new_loop_vec_info (struct loop *loop)
for (i = 0; i < loop->num_nodes; i++)
{
basic_block bb = bbs[i];
- tree phi;
/* BBs in a nested inner-loop will have been already processed (because
we will have called vect_analyze_loop_form for any nested inner-loop).
@@ -1611,18 +1649,21 @@ new_loop_vec_info (struct loop *loop)
{
/* Inner-loop bb. */
gcc_assert (loop->inner && bb->loop_father == loop->inner);
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
+ for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si))
{
+ gimple phi = gsi_stmt (si);
stmt_vec_info stmt_info = vinfo_for_stmt (phi);
- loop_vec_info inner_loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info);
+ loop_vec_info inner_loop_vinfo =
+ STMT_VINFO_LOOP_VINFO (stmt_info);
gcc_assert (loop->inner == LOOP_VINFO_LOOP (inner_loop_vinfo));
STMT_VINFO_LOOP_VINFO (stmt_info) = res;
}
- for (si = bsi_start (bb); !bsi_end_p (si); bsi_next (&si))
+ for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si))
{
- tree stmt = bsi_stmt (si);
+ gimple stmt = gsi_stmt (si);
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
- loop_vec_info inner_loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info);
+ loop_vec_info inner_loop_vinfo =
+ STMT_VINFO_LOOP_VINFO (stmt_info);
gcc_assert (loop->inner == LOOP_VINFO_LOOP (inner_loop_vinfo));
STMT_VINFO_LOOP_VINFO (stmt_info) = res;
}
@@ -1630,17 +1671,18 @@ new_loop_vec_info (struct loop *loop)
else
{
/* bb in current nest. */
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
+ for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si))
{
- stmt_ann_t ann = get_stmt_ann (phi);
- set_stmt_info (ann, new_stmt_vec_info (phi, res));
+ gimple phi = gsi_stmt (si);
+ gimple_set_uid (phi, 0);
+ set_vinfo_for_stmt (phi, new_stmt_vec_info (phi, res));
}
- for (si = bsi_start (bb); !bsi_end_p (si); bsi_next (&si))
+ for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si))
{
- tree stmt = bsi_stmt (si);
- stmt_ann_t ann = stmt_ann (stmt);
- set_stmt_info (ann, new_stmt_vec_info (stmt, res));
+ gimple stmt = gsi_stmt (si);
+ gimple_set_uid (stmt, 0);
+ set_vinfo_for_stmt (stmt, new_stmt_vec_info (stmt, res));
}
}
}
@@ -1667,10 +1709,12 @@ new_loop_vec_info (struct loop *loop)
LOOP_VINFO_DDRS (res) = VEC_alloc (ddr_p, heap, 10 * 10);
LOOP_VINFO_UNALIGNED_DR (res) = NULL;
LOOP_VINFO_MAY_MISALIGN_STMTS (res) =
- VEC_alloc (tree, heap, PARAM_VALUE (PARAM_VECT_MAX_VERSION_FOR_ALIGNMENT_CHECKS));
+ VEC_alloc (gimple, heap,
+ PARAM_VALUE (PARAM_VECT_MAX_VERSION_FOR_ALIGNMENT_CHECKS));
LOOP_VINFO_MAY_ALIAS_DDRS (res) =
- VEC_alloc (ddr_p, heap, PARAM_VALUE (PARAM_VECT_MAX_VERSION_FOR_ALIAS_CHECKS));
- LOOP_VINFO_STRIDED_STORES (res) = VEC_alloc (tree, heap, 10);
+ VEC_alloc (ddr_p, heap,
+ PARAM_VALUE (PARAM_VECT_MAX_VERSION_FOR_ALIAS_CHECKS));
+ LOOP_VINFO_STRIDED_STORES (res) = VEC_alloc (gimple, heap, 10);
LOOP_VINFO_SLP_INSTANCES (res) = VEC_alloc (slp_instance, heap, 10);
LOOP_VINFO_SLP_UNROLLING_FACTOR (res) = 1;
@@ -1689,7 +1733,7 @@ destroy_loop_vec_info (loop_vec_info loop_vinfo, bool clean_stmts)
struct loop *loop;
basic_block *bbs;
int nbbs;
- block_stmt_iterator si;
+ gimple_stmt_iterator si;
int j;
VEC (slp_instance, heap) *slp_instances;
slp_instance instance;
@@ -1707,7 +1751,7 @@ destroy_loop_vec_info (loop_vec_info loop_vinfo, bool clean_stmts)
free (LOOP_VINFO_BBS (loop_vinfo));
free_data_refs (LOOP_VINFO_DATAREFS (loop_vinfo));
free_dependence_relations (LOOP_VINFO_DDRS (loop_vinfo));
- VEC_free (tree, heap, LOOP_VINFO_MAY_MISALIGN_STMTS (loop_vinfo));
+ VEC_free (gimple, heap, LOOP_VINFO_MAY_MISALIGN_STMTS (loop_vinfo));
free (loop_vinfo);
loop->aux = NULL;
@@ -1717,14 +1761,13 @@ destroy_loop_vec_info (loop_vec_info loop_vinfo, bool clean_stmts)
for (j = 0; j < nbbs; j++)
{
basic_block bb = bbs[j];
- tree phi;
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
- free_stmt_vec_info (phi);
+ for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si))
+ free_stmt_vec_info (gsi_stmt (si));
- for (si = bsi_start (bb); !bsi_end_p (si); )
+ for (si = gsi_start_bb (bb); !gsi_end_p (si); )
{
- tree stmt = bsi_stmt (si);
+ gimple stmt = gsi_stmt (si);
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
if (stmt_info)
@@ -1732,7 +1775,7 @@ destroy_loop_vec_info (loop_vec_info loop_vinfo, bool clean_stmts)
/* Check if this is a "pattern stmt" (introduced by the
vectorizer during the pattern recognition pass). */
bool remove_stmt_p = false;
- tree orig_stmt = STMT_VINFO_RELATED_STMT (stmt_info);
+ gimple orig_stmt = STMT_VINFO_RELATED_STMT (stmt_info);
if (orig_stmt)
{
stmt_vec_info orig_stmt_info = vinfo_for_stmt (orig_stmt);
@@ -1746,22 +1789,22 @@ destroy_loop_vec_info (loop_vec_info loop_vinfo, bool clean_stmts)
/* Remove dead "pattern stmts". */
if (remove_stmt_p)
- bsi_remove (&si, true);
+ gsi_remove (&si, true);
}
- bsi_next (&si);
+ gsi_next (&si);
}
}
free (LOOP_VINFO_BBS (loop_vinfo));
free_data_refs (LOOP_VINFO_DATAREFS (loop_vinfo));
free_dependence_relations (LOOP_VINFO_DDRS (loop_vinfo));
- VEC_free (tree, heap, LOOP_VINFO_MAY_MISALIGN_STMTS (loop_vinfo));
+ VEC_free (gimple, heap, LOOP_VINFO_MAY_MISALIGN_STMTS (loop_vinfo));
VEC_free (ddr_p, heap, LOOP_VINFO_MAY_ALIAS_DDRS (loop_vinfo));
slp_instances = LOOP_VINFO_SLP_INSTANCES (loop_vinfo);
for (j = 0; VEC_iterate (slp_instance, slp_instances, j, instance); j++)
vect_free_slp_tree (SLP_INSTANCE_TREE (instance));
VEC_free (slp_instance, heap, LOOP_VINFO_SLP_INSTANCES (loop_vinfo));
- VEC_free (tree, heap, LOOP_VINFO_STRIDED_STORES (loop_vinfo));
+ VEC_free (gimple, heap, LOOP_VINFO_STRIDED_STORES (loop_vinfo));
free (loop_vinfo);
loop->aux = NULL;
@@ -1788,9 +1831,7 @@ vect_can_force_dr_alignment_p (const_tree decl, unsigned int alignment)
if (TREE_STATIC (decl))
return (alignment <= MAX_OFILE_ALIGNMENT);
else
- /* This used to be PREFERRED_STACK_BOUNDARY, however, that is not 100%
- correct until someone implements forced stack alignment. */
- return (alignment <= STACK_BOUNDARY);
+ return (alignment <= MAX_STACK_ALIGNMENT);
}
@@ -1850,7 +1891,7 @@ get_vectype_for_scalar_type (tree scalar_type)
enum dr_alignment_support
vect_supportable_dr_alignment (struct data_reference *dr)
{
- tree stmt = DR_STMT (dr);
+ gimple stmt = DR_STMT (dr);
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
tree vectype = STMT_VINFO_VECTYPE (stmt_info);
enum machine_mode mode = (int) TYPE_MODE (vectype);
@@ -1972,14 +2013,14 @@ vect_supportable_dr_alignment (struct data_reference *dr)
in reduction/induction computations). */
bool
-vect_is_simple_use (tree operand, loop_vec_info loop_vinfo, tree *def_stmt,
+vect_is_simple_use (tree operand, loop_vec_info loop_vinfo, gimple *def_stmt,
tree *def, enum vect_def_type *dt)
{
basic_block bb;
stmt_vec_info stmt_vinfo;
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
- *def_stmt = NULL_TREE;
+ *def_stmt = NULL;
*def = NULL_TREE;
if (vect_print_dump_info (REPORT_DETAILS))
@@ -2014,7 +2055,7 @@ vect_is_simple_use (tree operand, loop_vec_info loop_vinfo, tree *def_stmt,
}
*def_stmt = SSA_NAME_DEF_STMT (operand);
- if (*def_stmt == NULL_TREE )
+ if (*def_stmt == NULL)
{
if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "no def_stmt.");
@@ -2024,27 +2065,19 @@ vect_is_simple_use (tree operand, loop_vec_info loop_vinfo, tree *def_stmt,
if (vect_print_dump_info (REPORT_DETAILS))
{
fprintf (vect_dump, "def_stmt: ");
- print_generic_expr (vect_dump, *def_stmt, TDF_SLIM);
+ print_gimple_stmt (vect_dump, *def_stmt, 0, TDF_SLIM);
}
/* empty stmt is expected only in case of a function argument.
- (Otherwise - we expect a phi_node or a GIMPLE_MODIFY_STMT). */
- if (IS_EMPTY_STMT (*def_stmt))
+ (Otherwise - we expect a phi_node or a GIMPLE_ASSIGN). */
+ if (gimple_nop_p (*def_stmt))
{
- tree arg = TREE_OPERAND (*def_stmt, 0);
- if (is_gimple_min_invariant (arg))
- {
- *def = operand;
- *dt = vect_invariant_def;
- return true;
- }
-
- if (vect_print_dump_info (REPORT_DETAILS))
- fprintf (vect_dump, "Unexpected empty stmt.");
- return false;
+ *def = operand;
+ *dt = vect_invariant_def;
+ return true;
}
- bb = bb_for_stmt (*def_stmt);
+ bb = gimple_bb (*def_stmt);
if (!flow_bb_inside_loop_p (loop, bb))
*dt = vect_invariant_def;
else
@@ -2063,16 +2096,21 @@ vect_is_simple_use (tree operand, loop_vec_info loop_vinfo, tree *def_stmt,
if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "type of def: %d.",*dt);
- switch (TREE_CODE (*def_stmt))
+ switch (gimple_code (*def_stmt))
{
- case PHI_NODE:
- *def = PHI_RESULT (*def_stmt);
+ case GIMPLE_PHI:
+ *def = gimple_phi_result (*def_stmt);
break;
- case GIMPLE_MODIFY_STMT:
- *def = GIMPLE_STMT_OPERAND (*def_stmt, 0);
+ case GIMPLE_ASSIGN:
+ *def = gimple_assign_lhs (*def_stmt);
break;
+ case GIMPLE_CALL:
+ *def = gimple_call_lhs (*def_stmt);
+ if (*def != NULL)
+ break;
+ /* FALLTHRU */
default:
if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "unsupported defining stmt: ");
@@ -2099,12 +2137,17 @@ vect_is_simple_use (tree operand, loop_vec_info loop_vinfo, tree *def_stmt,
vectorizing the operation, if available.
- DECL1 and DECL2 are decls of target builtin functions to be used
when vectorizing the operation, if available. In this case,
- CODE1 and CODE2 are CALL_EXPR. */
+ CODE1 and CODE2 are CALL_EXPR.
+ - DOUBLE_OP determines if the operation is a double cast, like
+ char->short->int
+ - INTERM_TYPE is the intermediate type required to perform the
+ widening operation (short in the above example) */
bool
-supportable_widening_operation (enum tree_code code, tree stmt, tree vectype,
+supportable_widening_operation (enum tree_code code, gimple stmt, tree vectype,
tree *decl1, tree *decl2,
- enum tree_code *code1, enum tree_code *code2)
+ enum tree_code *code1, enum tree_code *code2,
+ bool *double_op, tree *interm_type)
{
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
loop_vec_info loop_info = STMT_VINFO_LOOP_VINFO (stmt_info);
@@ -2113,11 +2156,12 @@ supportable_widening_operation (enum tree_code code, tree stmt, tree vectype,
enum machine_mode vec_mode;
enum insn_code icode1, icode2;
optab optab1, optab2;
- tree expr = GIMPLE_STMT_OPERAND (stmt, 1);
- tree type = TREE_TYPE (expr);
+ tree type = gimple_expr_type (stmt);
tree wide_vectype = get_vectype_for_scalar_type (type);
enum tree_code c1, c2;
+ *double_op = false;
+
/* The result of a vectorized widening operation usually requires two vectors
(because the widened results do not fit int one vector). The generated
vector results would normally be expected to be generated in the same
@@ -2228,12 +2272,57 @@ supportable_widening_operation (enum tree_code code, tree stmt, tree vectype,
vec_mode = TYPE_MODE (vectype);
if ((icode1 = optab_handler (optab1, vec_mode)->insn_code) == CODE_FOR_nothing
- || insn_data[icode1].operand[0].mode != TYPE_MODE (wide_vectype)
|| (icode2 = optab_handler (optab2, vec_mode)->insn_code)
- == CODE_FOR_nothing
- || insn_data[icode2].operand[0].mode != TYPE_MODE (wide_vectype))
+ == CODE_FOR_nothing)
return false;
+ /* Check if it's a double cast, like char->int. In such case the intermediate
+ type is short, and we check that char->short->int operaion is supported by
+ the target. */
+ if (insn_data[icode1].operand[0].mode != TYPE_MODE (wide_vectype)
+ || insn_data[icode2].operand[0].mode != TYPE_MODE (wide_vectype))
+ {
+ if (code == NOP_EXPR)
+ {
+ enum machine_mode intermediate_mode =
+ insn_data[icode1].operand[0].mode;
+ tree intermediate_type =
+ lang_hooks.types.type_for_mode (intermediate_mode,
+ TYPE_UNSIGNED (vectype));
+ optab optab3 = optab_for_tree_code (c1, intermediate_type,
+ optab_default);
+ optab optab4 = optab_for_tree_code (c2, intermediate_type,
+ optab_default);
+
+ if (!optab3 || !optab4)
+ return false;
+
+ if ((icode1 = optab1->handlers[(int) vec_mode].insn_code)
+ == CODE_FOR_nothing
+ || insn_data[icode1].operand[0].mode != intermediate_mode
+ || (icode2 = optab2->handlers[(int) vec_mode].insn_code)
+ == CODE_FOR_nothing
+ || insn_data[icode2].operand[0].mode != intermediate_mode
+ || (icode1 = optab3->handlers[(int) intermediate_mode].insn_code)
+ == CODE_FOR_nothing
+ || insn_data[icode1].operand[0].mode != TYPE_MODE (wide_vectype)
+ || (icode2 = optab4->handlers[(int) intermediate_mode].insn_code)
+ == CODE_FOR_nothing
+ || insn_data[icode2].operand[0].mode != TYPE_MODE (wide_vectype))
+ return false;
+ else
+ {
+ *double_op = true;
+ *interm_type = intermediate_type;
+ *code1 = c1;
+ *code2 = c2;
+ return true;
+ }
+ }
+
+ return false;
+ }
+
*code1 = c1;
*code2 = c2;
return true;
@@ -2252,18 +2341,22 @@ supportable_widening_operation (enum tree_code code, tree stmt, tree vectype,
Output:
- CODE1 is the code of a vector operation to be used when
- vectorizing the operation, if available. */
+ vectorizing the operation, if available.
+ - DOUBLE_OP determines if the operation is a double cast, like
+ int->short->char
+ - INTERMIDIATE_TYPE is the intermediate type required to perform the
+ widening operation (short in the above example) */
bool
supportable_narrowing_operation (enum tree_code code,
- const_tree stmt, const_tree vectype,
- enum tree_code *code1)
+ const_gimple stmt, const_tree vectype,
+ enum tree_code *code1, bool *double_op,
+ tree *intermediate_type)
{
enum machine_mode vec_mode;
enum insn_code icode1;
- optab optab1;
- tree expr = GIMPLE_STMT_OPERAND (stmt, 1);
- tree type = TREE_TYPE (expr);
+ optab optab1, interm_optab;
+ tree type = gimple_expr_type (stmt);
tree narrow_vectype = get_vectype_for_scalar_type (type);
enum tree_code c1;
@@ -2296,10 +2389,30 @@ supportable_narrowing_operation (enum tree_code code,
return false;
vec_mode = TYPE_MODE (vectype);
- if ((icode1 = optab_handler (optab1, vec_mode)->insn_code) == CODE_FOR_nothing
- || insn_data[icode1].operand[0].mode != TYPE_MODE (narrow_vectype))
+ if ((icode1 = optab_handler (optab1, vec_mode)->insn_code)
+ == CODE_FOR_nothing)
return false;
+ /* In case of NUNITS_IN == NUNITS_OUT/4 check that the it is possible to
+ perform the operation using an intermediate type of NUNITS_OUT/2. */
+ if (insn_data[icode1].operand[0].mode != TYPE_MODE (narrow_vectype))
+ {
+ enum machine_mode intermediate_mode = insn_data[icode1].operand[0].mode;
+ *intermediate_type = lang_hooks.types.type_for_mode (intermediate_mode,
+ TYPE_UNSIGNED (vectype));
+ interm_optab = optab_for_tree_code (VEC_PACK_TRUNC_EXPR,
+ *intermediate_type, optab_default);
+ if (!interm_optab)
+ return false;
+
+ if ((icode1 = interm_optab->handlers[(int) intermediate_mode].insn_code)
+ == CODE_FOR_nothing
+ || insn_data[icode1].operand[0].mode != TYPE_MODE (narrow_vectype))
+ return false;
+
+ *double_op = true;
+ }
+
*code1 = c1;
return true;
}
@@ -2340,6 +2453,15 @@ reduction_code_for_scalar_code (enum tree_code code,
}
}
+/* Error reporting helper for vect_is_simple_reduction below. GIMPLE statement
+ STMT is printed with a message MSG. */
+
+static void
+report_vect_op (gimple stmt, const char *msg)
+{
+ fprintf (vect_dump, "%s", msg);
+ print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
+}
/* Function vect_is_simple_reduction
@@ -2360,17 +2482,16 @@ reduction_code_for_scalar_code (enum tree_code code,
Condition 1 is tested here.
Conditions 2,3 are tested in vect_mark_stmts_to_be_vectorized. */
-tree
-vect_is_simple_reduction (loop_vec_info loop_info, tree phi)
+gimple
+vect_is_simple_reduction (loop_vec_info loop_info, gimple phi)
{
- struct loop *loop = (bb_for_stmt (phi))->loop_father;
+ struct loop *loop = (gimple_bb (phi))->loop_father;
struct loop *vect_loop = LOOP_VINFO_LOOP (loop_info);
edge latch_e = loop_latch_edge (loop);
tree loop_arg = PHI_ARG_DEF_FROM_EDGE (phi, latch_e);
- tree def_stmt, def1, def2;
+ gimple def_stmt, def1, def2;
enum tree_code code;
- int op_type;
- tree operation, op1, op2;
+ tree op1, op2;
tree type;
int nloop_uses;
tree name;
@@ -2383,8 +2504,8 @@ vect_is_simple_reduction (loop_vec_info loop_info, tree phi)
nloop_uses = 0;
FOR_EACH_IMM_USE_FAST (use_p, imm_iter, name)
{
- tree use_stmt = USE_STMT (use_p);
- if (flow_bb_inside_loop_p (loop, bb_for_stmt (use_stmt))
+ gimple use_stmt = USE_STMT (use_p);
+ if (flow_bb_inside_loop_p (loop, gimple_bb (use_stmt))
&& vinfo_for_stmt (use_stmt)
&& !is_pattern_stmt_p (vinfo_for_stmt (use_stmt)))
nloop_uses++;
@@ -2392,7 +2513,7 @@ vect_is_simple_reduction (loop_vec_info loop_info, tree phi)
{
if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "reduction used in loop.");
- return NULL_TREE;
+ return NULL;
}
}
@@ -2403,7 +2524,7 @@ vect_is_simple_reduction (loop_vec_info loop_info, tree phi)
fprintf (vect_dump, "reduction: not ssa_name: ");
print_generic_expr (vect_dump, loop_arg, TDF_SLIM);
}
- return NULL_TREE;
+ return NULL;
}
def_stmt = SSA_NAME_DEF_STMT (loop_arg);
@@ -2411,22 +2532,22 @@ vect_is_simple_reduction (loop_vec_info loop_info, tree phi)
{
if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "reduction: no def_stmt.");
- return NULL_TREE;
+ return NULL;
}
- if (TREE_CODE (def_stmt) != GIMPLE_MODIFY_STMT)
+ if (!is_gimple_assign (def_stmt))
{
if (vect_print_dump_info (REPORT_DETAILS))
- print_generic_expr (vect_dump, def_stmt, TDF_SLIM);
- return NULL_TREE;
+ print_gimple_stmt (vect_dump, def_stmt, 0, TDF_SLIM);
+ return NULL;
}
- name = GIMPLE_STMT_OPERAND (def_stmt, 0);
+ name = gimple_assign_lhs (def_stmt);
nloop_uses = 0;
FOR_EACH_IMM_USE_FAST (use_p, imm_iter, name)
{
- tree use_stmt = USE_STMT (use_p);
- if (flow_bb_inside_loop_p (loop, bb_for_stmt (use_stmt))
+ gimple use_stmt = USE_STMT (use_p);
+ if (flow_bb_inside_loop_p (loop, gimple_bb (use_stmt))
&& vinfo_for_stmt (use_stmt)
&& !is_pattern_stmt_p (vinfo_for_stmt (use_stmt)))
nloop_uses++;
@@ -2434,47 +2555,37 @@ vect_is_simple_reduction (loop_vec_info loop_info, tree phi)
{
if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "reduction used in loop.");
- return NULL_TREE;
+ return NULL;
}
}
- operation = GIMPLE_STMT_OPERAND (def_stmt, 1);
- code = TREE_CODE (operation);
+ code = gimple_assign_rhs_code (def_stmt);
+
if (!commutative_tree_code (code) || !associative_tree_code (code))
{
if (vect_print_dump_info (REPORT_DETAILS))
- {
- fprintf (vect_dump, "reduction: not commutative/associative: ");
- print_generic_expr (vect_dump, operation, TDF_SLIM);
- }
- return NULL_TREE;
+ report_vect_op (def_stmt, "reduction: not commutative/associative: ");
+ return NULL;
}
- op_type = TREE_OPERAND_LENGTH (operation);
- if (op_type != binary_op)
+ if (get_gimple_rhs_class (code) != GIMPLE_BINARY_RHS)
{
if (vect_print_dump_info (REPORT_DETAILS))
- {
- fprintf (vect_dump, "reduction: not binary operation: ");
- print_generic_expr (vect_dump, operation, TDF_SLIM);
- }
- return NULL_TREE;
+ report_vect_op (def_stmt, "reduction: not binary operation: ");
+ return NULL;
}
- op1 = TREE_OPERAND (operation, 0);
- op2 = TREE_OPERAND (operation, 1);
+ op1 = gimple_assign_rhs1 (def_stmt);
+ op2 = gimple_assign_rhs2 (def_stmt);
if (TREE_CODE (op1) != SSA_NAME || TREE_CODE (op2) != SSA_NAME)
{
if (vect_print_dump_info (REPORT_DETAILS))
- {
- fprintf (vect_dump, "reduction: uses not ssa_names: ");
- print_generic_expr (vect_dump, operation, TDF_SLIM);
- }
- return NULL_TREE;
+ report_vect_op (def_stmt, "reduction: uses not ssa_names: ");
+ return NULL;
}
/* Check that it's ok to change the order of the computation. */
- type = TREE_TYPE (operation);
+ type = TREE_TYPE (gimple_assign_lhs (def_stmt));
if (TYPE_MAIN_VARIANT (type) != TYPE_MAIN_VARIANT (TREE_TYPE (op1))
|| TYPE_MAIN_VARIANT (type) != TYPE_MAIN_VARIANT (TREE_TYPE (op2)))
{
@@ -2487,7 +2598,7 @@ vect_is_simple_reduction (loop_vec_info loop_info, tree phi)
fprintf (vect_dump, ",");
print_generic_expr (vect_dump, TREE_TYPE (op2), TDF_SLIM);
}
- return NULL_TREE;
+ return NULL;
}
/* Generally, when vectorizing a reduction we change the order of the
@@ -2503,32 +2614,24 @@ vect_is_simple_reduction (loop_vec_info loop_info, tree phi)
{
/* Changing the order of operations changes the semantics. */
if (vect_print_dump_info (REPORT_DETAILS))
- {
- fprintf (vect_dump, "reduction: unsafe fp math optimization: ");
- print_generic_expr (vect_dump, operation, TDF_SLIM);
- }
- return NULL_TREE;
+ report_vect_op (def_stmt, "reduction: unsafe fp math optimization: ");
+ return NULL;
}
else if (INTEGRAL_TYPE_P (type) && TYPE_OVERFLOW_TRAPS (type)
&& !nested_in_vect_loop_p (vect_loop, def_stmt))
{
/* Changing the order of operations changes the semantics. */
if (vect_print_dump_info (REPORT_DETAILS))
- {
- fprintf (vect_dump, "reduction: unsafe int math optimization: ");
- print_generic_expr (vect_dump, operation, TDF_SLIM);
- }
- return NULL_TREE;
+ report_vect_op (def_stmt, "reduction: unsafe int math optimization: ");
+ return NULL;
}
else if (SAT_FIXED_POINT_TYPE_P (type))
{
/* Changing the order of operations changes the semantics. */
if (vect_print_dump_info (REPORT_DETAILS))
- {
- fprintf (vect_dump, "reduction: unsafe fixed-point math optimization: ");
- print_generic_expr (vect_dump, operation, TDF_SLIM);
- }
- return NULL_TREE;
+ report_vect_op (def_stmt,
+ "reduction: unsafe fixed-point math optimization: ");
+ return NULL;
}
/* reduction is safe. we're dealing with one of the following:
@@ -2537,14 +2640,11 @@ vect_is_simple_reduction (loop_vec_info loop_info, tree phi)
*/
def1 = SSA_NAME_DEF_STMT (op1);
def2 = SSA_NAME_DEF_STMT (op2);
- if (!def1 || !def2 || IS_EMPTY_STMT (def1) || IS_EMPTY_STMT (def2))
+ if (!def1 || !def2 || gimple_nop_p (def1) || gimple_nop_p (def2))
{
if (vect_print_dump_info (REPORT_DETAILS))
- {
- fprintf (vect_dump, "reduction: no defs for operands: ");
- print_generic_expr (vect_dump, operation, TDF_SLIM);
- }
- return NULL_TREE;
+ report_vect_op (def_stmt, "reduction: no defs for operands: ");
+ return NULL;
}
@@ -2553,48 +2653,40 @@ vect_is_simple_reduction (loop_vec_info loop_info, tree phi)
or it's an induction (defined by a loop-header phi-node). */
if (def2 == phi
- && flow_bb_inside_loop_p (loop, bb_for_stmt (def1))
- && (TREE_CODE (def1) == GIMPLE_MODIFY_STMT
+ && flow_bb_inside_loop_p (loop, gimple_bb (def1))
+ && (is_gimple_assign (def1)
|| STMT_VINFO_DEF_TYPE (vinfo_for_stmt (def1)) == vect_induction_def
- || (TREE_CODE (def1) == PHI_NODE
+ || (gimple_code (def1) == GIMPLE_PHI
&& STMT_VINFO_DEF_TYPE (vinfo_for_stmt (def1)) == vect_loop_def
- && !is_loop_header_bb_p (bb_for_stmt (def1)))))
+ && !is_loop_header_bb_p (gimple_bb (def1)))))
{
if (vect_print_dump_info (REPORT_DETAILS))
- {
- fprintf (vect_dump, "detected reduction:");
- print_generic_expr (vect_dump, operation, TDF_SLIM);
- }
+ report_vect_op (def_stmt, "detected reduction:");
return def_stmt;
}
else if (def1 == phi
- && flow_bb_inside_loop_p (loop, bb_for_stmt (def2))
- && (TREE_CODE (def2) == GIMPLE_MODIFY_STMT
+ && flow_bb_inside_loop_p (loop, gimple_bb (def2))
+ && (is_gimple_assign (def2)
|| STMT_VINFO_DEF_TYPE (vinfo_for_stmt (def2)) == vect_induction_def
- || (TREE_CODE (def2) == PHI_NODE
+ || (gimple_code (def2) == GIMPLE_PHI
&& STMT_VINFO_DEF_TYPE (vinfo_for_stmt (def2)) == vect_loop_def
- && !is_loop_header_bb_p (bb_for_stmt (def2)))))
+ && !is_loop_header_bb_p (gimple_bb (def2)))))
{
/* Swap operands (just for simplicity - so that the rest of the code
can assume that the reduction variable is always the last (second)
argument). */
if (vect_print_dump_info (REPORT_DETAILS))
- {
- fprintf (vect_dump, "detected reduction: need to swap operands:");
- print_generic_expr (vect_dump, operation, TDF_SLIM);
- }
- swap_tree_operands (def_stmt, &TREE_OPERAND (operation, 0),
- &TREE_OPERAND (operation, 1));
+ report_vect_op (def_stmt ,
+ "detected reduction: need to swap operands:");
+ swap_tree_operands (def_stmt, gimple_assign_rhs1_ptr (def_stmt),
+ gimple_assign_rhs2_ptr (def_stmt));
return def_stmt;
}
else
{
if (vect_print_dump_info (REPORT_DETAILS))
- {
- fprintf (vect_dump, "reduction: unknown pattern.");
- print_generic_expr (vect_dump, operation, TDF_SLIM);
- }
- return NULL_TREE;
+ report_vect_op (def_stmt, "reduction: unknown pattern.");
+ return NULL;
}
}
@@ -2673,6 +2765,8 @@ vectorize_loops (void)
need to be renamed. */
vect_memsyms_to_rename = BITMAP_ALLOC (NULL);
+ init_stmt_vec_info_vec ();
+
/* ----------- Analyze loops. ----------- */
/* If some loop was duplicated, it gets bigger number
@@ -2717,6 +2811,8 @@ vectorize_loops (void)
loop->aux = NULL;
}
+ free_stmt_vec_info_vec ();
+
return num_vectorized_loops > 0 ? TODO_cleanup_cfg : 0;
}
diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h
index 1c082f85bef..cf7c5b123e9 100644
--- a/gcc/tree-vectorizer.h
+++ b/gcc/tree-vectorizer.h
@@ -89,9 +89,9 @@ typedef struct _slp_tree {
struct _slp_tree *left;
struct _slp_tree *right;
/* A group of scalar stmts to be vectorized together. */
- VEC (tree, heap) *stmts;
+ VEC (gimple, heap) *stmts;
/* Vectorized stmt/s. */
- VEC (tree, heap) *vec_stmts;
+ VEC (gimple, heap) *vec_stmts;
/* Number of vector stmts that are created to replace the group of scalar
stmts. It is calculated during the transformation phase as the number of
scalar elements in one scalar iteration (GROUP_SIZE) multiplied by VF
@@ -200,14 +200,14 @@ typedef struct _loop_vec_info {
/* Statements in the loop that have data references that are candidates for a
runtime (loop versioning) misalignment check. */
- VEC(tree,heap) *may_misalign_stmts;
+ VEC(gimple,heap) *may_misalign_stmts;
/* The loop location in the source. */
LOC loop_line_number;
/* All interleaving chains of stores in the loop, represented by the first
stmt in the chain. */
- VEC(tree, heap) *strided_stores;
+ VEC(gimple, heap) *strided_stores;
/* All SLP instances in the loop. This is a subset of the set of STRIDED_STORES
of the loop. */
@@ -255,10 +255,10 @@ loop_vec_info_for_loop (struct loop *loop)
}
static inline bool
-nested_in_vect_loop_p (struct loop *loop, tree stmt)
+nested_in_vect_loop_p (struct loop *loop, gimple stmt)
{
return (loop->inner
- && (loop->inner == (bb_for_stmt (stmt))->loop_father));
+ && (loop->inner == (gimple_bb (stmt))->loop_father));
}
/*-----------------------------------------------------------------*/
@@ -329,7 +329,7 @@ typedef struct _stmt_vec_info {
enum stmt_vec_info_type type;
/* The stmt to which this info struct refers to. */
- tree stmt;
+ gimple stmt;
/* The loop_vec_info with respect to which STMT is vectorized. */
loop_vec_info loop_vinfo;
@@ -347,7 +347,7 @@ typedef struct _stmt_vec_info {
tree vectype;
/* The vectorized version of the stmt. */
- tree vectorized_stmt;
+ gimple vectorized_stmt;
/** The following is relevant only for stmts that contain a non-scalar
@@ -378,7 +378,7 @@ typedef struct _stmt_vec_info {
related_stmt of the "pattern stmt" points back to this stmt (which is
the last stmt in the original sequence of stmts that constitutes the
pattern). */
- tree related_stmt;
+ gimple related_stmt;
/* List of datarefs that are known to have the same alignment as the dataref
of this stmt. */
@@ -389,9 +389,9 @@ typedef struct _stmt_vec_info {
/* Interleaving info. */
/* First data-ref in the interleaving group. */
- tree first_dr;
+ gimple first_dr;
/* Pointer to the next data-ref in the group. */
- tree next_dr;
+ gimple next_dr;
/* The size of the interleaving group. */
unsigned int size;
/* For stores, number of stores from this group seen. We vectorize the last
@@ -402,7 +402,7 @@ typedef struct _stmt_vec_info {
unsigned int gap;
/* In case that two or more stmts share data-ref, this is the pointer to the
previously detected stmt with the same dr. */
- tree same_dr_stmt;
+ gimple same_dr_stmt;
/* For loads only, if there is a store with the same location, this field is
TRUE. */
bool read_write_dep;
@@ -522,27 +522,46 @@ typedef struct _stmt_vec_info {
#define TARG_VEC_STORE_COST 1
#endif
-static inline void set_stmt_info (stmt_ann_t ann, stmt_vec_info stmt_info);
-static inline stmt_vec_info vinfo_for_stmt (tree stmt);
+/* Avoid GTY(()) on stmt_vec_info. */
+typedef void *vec_void_p;
+DEF_VEC_P (vec_void_p);
+DEF_VEC_ALLOC_P (vec_void_p, heap);
-static inline void
-set_stmt_info (stmt_ann_t ann, stmt_vec_info stmt_info)
+extern VEC(vec_void_p,heap) *stmt_vec_info_vec;
+
+void init_stmt_vec_info_vec (void);
+void free_stmt_vec_info_vec (void);
+
+static inline stmt_vec_info
+vinfo_for_stmt (gimple stmt)
{
- if (ann)
- ann->common.aux = (char *) stmt_info;
+ unsigned int uid = gimple_uid (stmt);
+ if (uid == 0)
+ return NULL;
+
+ gcc_assert (uid <= VEC_length (vec_void_p, stmt_vec_info_vec));
+ return (stmt_vec_info) VEC_index (vec_void_p, stmt_vec_info_vec, uid - 1);
}
-static inline stmt_vec_info
-vinfo_for_stmt (tree stmt)
+static inline void
+set_vinfo_for_stmt (gimple stmt, stmt_vec_info info)
{
- stmt_ann_t ann = stmt_ann (stmt);
- return ann ? (stmt_vec_info) ann->common.aux : NULL;
+ unsigned int uid = gimple_uid (stmt);
+ if (uid == 0)
+ {
+ gcc_assert (info);
+ uid = VEC_length (vec_void_p, stmt_vec_info_vec) + 1;
+ gimple_set_uid (stmt, uid);
+ VEC_safe_push (vec_void_p, heap, stmt_vec_info_vec, (vec_void_p) info);
+ }
+ else
+ VEC_replace (vec_void_p, stmt_vec_info_vec, uid - 1, (vec_void_p) info);
}
static inline bool
is_pattern_stmt_p (stmt_vec_info stmt_info)
{
- tree related_stmt;
+ gimple related_stmt;
stmt_vec_info related_stmt_info;
related_stmt = STMT_VINFO_RELATED_STMT (stmt_info);
@@ -643,24 +662,24 @@ extern void slpeel_verify_cfg_after_peeling (struct loop *, struct loop *);
*************************************************************************/
/** In tree-vectorizer.c **/
extern tree get_vectype_for_scalar_type (tree);
-extern bool vect_is_simple_use (tree, loop_vec_info, tree *, tree *,
+extern bool vect_is_simple_use (tree, loop_vec_info, gimple *, tree *,
enum vect_def_type *);
extern bool vect_is_simple_iv_evolution (unsigned, tree, tree *, tree *);
-extern tree vect_is_simple_reduction (loop_vec_info, tree);
+extern gimple vect_is_simple_reduction (loop_vec_info, gimple);
extern bool vect_can_force_dr_alignment_p (const_tree, unsigned int);
extern enum dr_alignment_support vect_supportable_dr_alignment
(struct data_reference *);
extern bool reduction_code_for_scalar_code (enum tree_code, enum tree_code *);
-extern bool supportable_widening_operation (enum tree_code, tree, tree,
- tree *, tree *, enum tree_code *, enum tree_code *);
-extern bool supportable_narrowing_operation (enum tree_code, const_tree,
- const_tree, enum tree_code *);
+extern bool supportable_widening_operation (enum tree_code, gimple, tree,
+ tree *, tree *, enum tree_code *, enum tree_code *, bool *, tree *);
+extern bool supportable_narrowing_operation (enum tree_code, const_gimple,
+ const_tree, enum tree_code *, bool *, tree *);
/* Creation and deletion of loop and stmt info structs. */
extern loop_vec_info new_loop_vec_info (struct loop *loop);
extern void destroy_loop_vec_info (loop_vec_info, bool);
-extern stmt_vec_info new_stmt_vec_info (tree stmt, loop_vec_info);
-extern void free_stmt_vec_info (tree stmt);
+extern stmt_vec_info new_stmt_vec_info (gimple stmt, loop_vec_info);
+extern void free_stmt_vec_info (gimple stmt);
/** In tree-vect-analyze.c **/
@@ -673,28 +692,33 @@ extern loop_vec_info vect_analyze_loop_form (struct loop *);
/* Pattern recognition functions.
Additional pattern recognition functions can (and will) be added
in the future. */
-typedef tree (* vect_recog_func_ptr) (tree, tree *, tree *);
+typedef gimple (* vect_recog_func_ptr) (gimple, tree *, tree *);
#define NUM_PATTERNS 4
void vect_pattern_recog (loop_vec_info);
/** In tree-vect-transform.c **/
-extern bool vectorizable_load (tree, block_stmt_iterator *, tree *, slp_tree);
-extern bool vectorizable_store (tree, block_stmt_iterator *, tree *, slp_tree);
-extern bool vectorizable_operation (tree, block_stmt_iterator *, tree *,
+extern bool vectorizable_load (gimple, gimple_stmt_iterator *, gimple *,
+ slp_tree);
+extern bool vectorizable_store (gimple, gimple_stmt_iterator *, gimple *,
+ slp_tree);
+extern bool vectorizable_operation (gimple, gimple_stmt_iterator *, gimple *,
slp_tree);
-extern bool vectorizable_type_promotion (tree, block_stmt_iterator *, tree *);
-extern bool vectorizable_type_demotion (tree, block_stmt_iterator *, tree *);
-extern bool vectorizable_conversion (tree, block_stmt_iterator *,
- tree *, slp_tree);
-extern bool vectorizable_assignment (tree, block_stmt_iterator *, tree *,
+extern bool vectorizable_type_promotion (gimple, gimple_stmt_iterator *,
+ gimple *);
+extern bool vectorizable_type_demotion (gimple, gimple_stmt_iterator *,
+ gimple *);
+extern bool vectorizable_conversion (gimple, gimple_stmt_iterator *, gimple *,
+ slp_tree);
+extern bool vectorizable_assignment (gimple, gimple_stmt_iterator *, gimple *,
slp_tree);
-extern tree vectorizable_function (tree, tree, tree);
-extern bool vectorizable_call (tree, block_stmt_iterator *, tree *);
-extern bool vectorizable_condition (tree, block_stmt_iterator *, tree *);
-extern bool vectorizable_live_operation (tree, block_stmt_iterator *, tree *);
-extern bool vectorizable_reduction (tree, block_stmt_iterator *, tree *);
-extern bool vectorizable_induction (tree, block_stmt_iterator *, tree *);
+extern tree vectorizable_function (gimple, tree, tree);
+extern bool vectorizable_call (gimple, gimple_stmt_iterator *, gimple *);
+extern bool vectorizable_condition (gimple, gimple_stmt_iterator *, gimple *);
+extern bool vectorizable_live_operation (gimple, gimple_stmt_iterator *,
+ gimple *);
+extern bool vectorizable_reduction (gimple, gimple_stmt_iterator *, gimple *);
+extern bool vectorizable_induction (gimple, gimple_stmt_iterator *, gimple *);
extern int vect_estimate_min_profitable_iters (loop_vec_info);
extern void vect_model_simple_cost (stmt_vec_info, int, enum vect_def_type *,
slp_tree);
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 404531f4504..af4060c6a1e 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -38,6 +38,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-ssa-propagate.h"
#include "tree-chrec.h"
+
/* Set of SSA names found during the dominator traversal of a
sub-graph in find_assert_locations. */
static sbitmap found_in_subgraph;
@@ -64,7 +65,7 @@ struct assert_locus_d
edge e;
/* Pointer to the statement that generated this assertion. */
- block_stmt_iterator si;
+ gimple_stmt_iterator si;
/* Predicate code for the ASSERT_EXPR. Must be COMPARISON_CLASS_P. */
enum tree_code comp_code;
@@ -104,7 +105,7 @@ static value_range_t **vr_value;
static int *vr_phi_edge_counts;
typedef struct {
- tree stmt;
+ gimple stmt;
tree vec;
} switch_update;
@@ -276,6 +277,18 @@ is_overflow_infinity (const_tree val)
&& (vrp_val_is_min (val) || vrp_val_is_max (val)));
}
+/* Return whether STMT has a constant rhs that is_overflow_infinity. */
+
+static inline bool
+stmt_overflow_infinity (gimple stmt)
+{
+ if (is_gimple_assign (stmt)
+ && get_gimple_rhs_class (gimple_assign_rhs_code (stmt)) ==
+ GIMPLE_SINGLE_RHS)
+ return is_overflow_infinity (gimple_assign_rhs1 (stmt));
+ return false;
+}
+
/* If VAL is now an overflow infinity, return VAL. Otherwise, return
the same value with TREE_OVERFLOW clear. This can be used to avoid
confusing a regular value with an overflow value. */
@@ -777,21 +790,143 @@ vrp_expr_computes_nonnegative (tree expr, bool *strict_overflow_p)
&& ssa_name_nonnegative_p (expr)));
}
+/* Return true if the result of assignment STMT is know to be non-negative.
+ If the return value is based on the assumption that signed overflow is
+ undefined, set *STRICT_OVERFLOW_P to true; otherwise, don't change
+ *STRICT_OVERFLOW_P.*/
+
+static bool
+gimple_assign_nonnegative_warnv_p (gimple stmt, bool *strict_overflow_p)
+{
+ enum tree_code code = gimple_assign_rhs_code (stmt);
+ switch (get_gimple_rhs_class (code))
+ {
+ case GIMPLE_UNARY_RHS:
+ return tree_unary_nonnegative_warnv_p (gimple_assign_rhs_code (stmt),
+ gimple_expr_type (stmt),
+ gimple_assign_rhs1 (stmt),
+ strict_overflow_p);
+ case GIMPLE_BINARY_RHS:
+ return tree_binary_nonnegative_warnv_p (gimple_assign_rhs_code (stmt),
+ gimple_expr_type (stmt),
+ gimple_assign_rhs1 (stmt),
+ gimple_assign_rhs2 (stmt),
+ strict_overflow_p);
+ case GIMPLE_SINGLE_RHS:
+ return tree_single_nonnegative_warnv_p (gimple_assign_rhs1 (stmt),
+ strict_overflow_p);
+ case GIMPLE_INVALID_RHS:
+ gcc_unreachable ();
+ default:
+ gcc_unreachable ();
+ }
+}
+
+/* Return true if return value of call STMT is know to be non-negative.
+ If the return value is based on the assumption that signed overflow is
+ undefined, set *STRICT_OVERFLOW_P to true; otherwise, don't change
+ *STRICT_OVERFLOW_P.*/
+
+static bool
+gimple_call_nonnegative_warnv_p (gimple stmt, bool *strict_overflow_p)
+{
+ tree arg0 = gimple_call_num_args (stmt) > 0 ?
+ gimple_call_arg (stmt, 0) : NULL_TREE;
+ tree arg1 = gimple_call_num_args (stmt) > 1 ?
+ gimple_call_arg (stmt, 1) : NULL_TREE;
+
+ return tree_call_nonnegative_warnv_p (gimple_expr_type (stmt),
+ gimple_call_fndecl (stmt),
+ arg0,
+ arg1,
+ strict_overflow_p);
+}
+
+/* Return true if STMT is know to to compute a non-negative value.
+ If the return value is based on the assumption that signed overflow is
+ undefined, set *STRICT_OVERFLOW_P to true; otherwise, don't change
+ *STRICT_OVERFLOW_P.*/
+
+static bool
+gimple_stmt_nonnegative_warnv_p (gimple stmt, bool *strict_overflow_p)
+{
+ switch (gimple_code (stmt))
+ {
+ case GIMPLE_ASSIGN:
+ return gimple_assign_nonnegative_warnv_p (stmt, strict_overflow_p);
+ case GIMPLE_CALL:
+ return gimple_call_nonnegative_warnv_p (stmt, strict_overflow_p);
+ default:
+ gcc_unreachable ();
+ }
+}
+
+/* Return true if the result of assignment STMT is know to be non-zero.
+ If the return value is based on the assumption that signed overflow is
+ undefined, set *STRICT_OVERFLOW_P to true; otherwise, don't change
+ *STRICT_OVERFLOW_P.*/
+
+static bool
+gimple_assign_nonzero_warnv_p (gimple stmt, bool *strict_overflow_p)
+{
+ enum tree_code code = gimple_assign_rhs_code (stmt);
+ switch (get_gimple_rhs_class (code))
+ {
+ case GIMPLE_UNARY_RHS:
+ return tree_unary_nonzero_warnv_p (gimple_assign_rhs_code (stmt),
+ gimple_expr_type (stmt),
+ gimple_assign_rhs1 (stmt),
+ strict_overflow_p);
+ case GIMPLE_BINARY_RHS:
+ return tree_binary_nonzero_warnv_p (gimple_assign_rhs_code (stmt),
+ gimple_expr_type (stmt),
+ gimple_assign_rhs1 (stmt),
+ gimple_assign_rhs2 (stmt),
+ strict_overflow_p);
+ case GIMPLE_SINGLE_RHS:
+ return tree_single_nonzero_warnv_p (gimple_assign_rhs1 (stmt),
+ strict_overflow_p);
+ case GIMPLE_INVALID_RHS:
+ gcc_unreachable ();
+ default:
+ gcc_unreachable ();
+ }
+}
+
+/* Return true if STMT is know to to compute a non-zero value.
+ If the return value is based on the assumption that signed overflow is
+ undefined, set *STRICT_OVERFLOW_P to true; otherwise, don't change
+ *STRICT_OVERFLOW_P.*/
+
+static bool
+gimple_stmt_nonzero_warnv_p (gimple stmt, bool *strict_overflow_p)
+{
+ switch (gimple_code (stmt))
+ {
+ case GIMPLE_ASSIGN:
+ return gimple_assign_nonzero_warnv_p (stmt, strict_overflow_p);
+ case GIMPLE_CALL:
+ return gimple_alloca_call_p (stmt);
+ default:
+ gcc_unreachable ();
+ }
+}
+
/* Like tree_expr_nonzero_warnv_p, but this function uses value ranges
obtained so far. */
static bool
-vrp_expr_computes_nonzero (tree expr, bool *strict_overflow_p)
+vrp_stmt_computes_nonzero (gimple stmt, bool *strict_overflow_p)
{
- if (tree_expr_nonzero_warnv_p (expr, strict_overflow_p)
- || (TREE_CODE (expr) == SSA_NAME
- && ssa_name_nonzero_p (expr)))
+ if (gimple_stmt_nonzero_warnv_p (stmt, strict_overflow_p))
return true;
/* If we have an expression of the form &X->a, then the expression
is nonnull if X is nonnull. */
- if (TREE_CODE (expr) == ADDR_EXPR)
+ if (is_gimple_assign (stmt)
+ && gimple_assign_rhs_code (stmt) == ADDR_EXPR)
{
+ tree expr = gimple_assign_rhs1 (stmt);
tree base = get_base_address (TREE_OPERAND (expr, 0));
if (base != NULL_TREE
@@ -2709,10 +2844,9 @@ extract_range_from_comparison (value_range_t *vr, enum tree_code code,
tree type, tree op0, tree op1)
{
bool sop = false;
- tree val = vrp_evaluate_conditional_warnv_with_ops (code,
- op0,
- op1,
- false, &sop);
+ tree val;
+
+ val = vrp_evaluate_conditional_warnv_with_ops (code, op0, op1, false, &sop);
/* A disadvantage of using a special infinity as an overflow
representation is that we lose the ability to record overflow
@@ -2735,56 +2869,67 @@ extract_range_from_comparison (value_range_t *vr, enum tree_code code,
set_value_range_to_truthvalue (vr, type);
}
+/* Try to derive a nonnegative or nonzero range out of STMT relying
+ primarily on generic routines in fold in conjunction with range data.
+ Store the result in *VR */
-/* Try to compute a useful range out of expression EXPR and store it
+static void
+extract_range_basic (value_range_t *vr, gimple stmt)
+{
+ bool sop = false;
+ tree type = gimple_expr_type (stmt);
+
+ if (INTEGRAL_TYPE_P (type)
+ && gimple_stmt_nonnegative_warnv_p (stmt, &sop))
+ set_value_range_to_nonnegative (vr, type,
+ sop || stmt_overflow_infinity (stmt));
+ else if (vrp_stmt_computes_nonzero (stmt, &sop)
+ && !sop)
+ set_value_range_to_nonnull (vr, type);
+ else
+ set_value_range_to_varying (vr);
+}
+
+
+/* Try to compute a useful range out of assignment STMT and store it
in *VR. */
static void
-extract_range_from_expr (value_range_t *vr, tree expr)
+extract_range_from_assignment (value_range_t *vr, gimple stmt)
{
- enum tree_code code = TREE_CODE (expr);
+ enum tree_code code = gimple_assign_rhs_code (stmt);
if (code == ASSERT_EXPR)
- extract_range_from_assert (vr, expr);
+ extract_range_from_assert (vr, gimple_assign_rhs1 (stmt));
else if (code == SSA_NAME)
- extract_range_from_ssa_name (vr, expr);
+ extract_range_from_ssa_name (vr, gimple_assign_rhs1 (stmt));
else if (TREE_CODE_CLASS (code) == tcc_binary
|| code == TRUTH_AND_EXPR
|| code == TRUTH_OR_EXPR
|| code == TRUTH_XOR_EXPR)
- extract_range_from_binary_expr (vr, TREE_CODE (expr), TREE_TYPE (expr),
- TREE_OPERAND (expr, 0),
- TREE_OPERAND (expr, 1));
+ extract_range_from_binary_expr (vr, gimple_assign_rhs_code (stmt),
+ gimple_expr_type (stmt),
+ gimple_assign_rhs1 (stmt),
+ gimple_assign_rhs2 (stmt));
else if (TREE_CODE_CLASS (code) == tcc_unary)
- extract_range_from_unary_expr (vr, TREE_CODE (expr), TREE_TYPE (expr),
- TREE_OPERAND (expr, 0));
+ extract_range_from_unary_expr (vr, gimple_assign_rhs_code (stmt),
+ gimple_expr_type (stmt),
+ gimple_assign_rhs1 (stmt));
else if (code == COND_EXPR)
- extract_range_from_cond_expr (vr, expr);
+ extract_range_from_cond_expr (vr, gimple_assign_rhs1 (stmt));
else if (TREE_CODE_CLASS (code) == tcc_comparison)
- extract_range_from_comparison (vr, TREE_CODE (expr), TREE_TYPE (expr),
- TREE_OPERAND (expr, 0),
- TREE_OPERAND (expr, 1));
- else if (is_gimple_min_invariant (expr))
- set_value_range_to_value (vr, expr, NULL);
+ extract_range_from_comparison (vr, gimple_assign_rhs_code (stmt),
+ gimple_expr_type (stmt),
+ gimple_assign_rhs1 (stmt),
+ gimple_assign_rhs2 (stmt));
+ else if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS
+ && is_gimple_min_invariant (gimple_assign_rhs1 (stmt)))
+ set_value_range_to_value (vr, gimple_assign_rhs1 (stmt), NULL);
else
set_value_range_to_varying (vr);
- /* If we got a varying range from the tests above, try a final
- time to derive a nonnegative or nonzero range. This time
- relying primarily on generic routines in fold in conjunction
- with range data. */
if (vr->type == VR_VARYING)
- {
- bool sop = false;
-
- if (INTEGRAL_TYPE_P (TREE_TYPE (expr))
- && vrp_expr_computes_nonnegative (expr, &sop))
- set_value_range_to_nonnegative (vr, TREE_TYPE (expr),
- sop || is_overflow_infinity (expr));
- else if (vrp_expr_computes_nonzero (expr, &sop)
- && !sop)
- set_value_range_to_nonnull (vr, TREE_TYPE (expr));
- }
+ extract_range_basic (vr, stmt);
}
/* Given a range VR, a LOOP and a variable VAR, determine whether it
@@ -2792,8 +2937,8 @@ extract_range_from_expr (value_range_t *vr, tree expr)
for VAR. If so, update VR with the new limits. */
static void
-adjust_range_with_scev (value_range_t *vr, struct loop *loop, tree stmt,
- tree var)
+adjust_range_with_scev (value_range_t *vr, struct loop *loop,
+ gimple stmt, tree var)
{
tree init, step, chrec, tmin, tmax, min, max, type;
enum ev_direction dir;
@@ -2926,7 +3071,7 @@ adjust_range_with_scev (value_range_t *vr, struct loop *loop, tree stmt,
overflow. */
static bool
-vrp_var_may_overflow (tree var, tree stmt)
+vrp_var_may_overflow (tree var, gimple stmt)
{
struct loop *l;
tree chrec, init, step;
@@ -3374,31 +3519,32 @@ debug_all_value_ranges (void)
create a new SSA name N and return the assertion assignment
'V = ASSERT_EXPR <V, V OP W>'. */
-static tree
+static gimple
build_assert_expr_for (tree cond, tree v)
{
- tree n, assertion;
+ tree n;
+ gimple assertion;
gcc_assert (TREE_CODE (v) == SSA_NAME);
- n = duplicate_ssa_name (v, NULL_TREE);
+ n = duplicate_ssa_name (v, NULL);
if (COMPARISON_CLASS_P (cond))
{
tree a = build2 (ASSERT_EXPR, TREE_TYPE (v), v, cond);
- assertion = build_gimple_modify_stmt (n, a);
+ assertion = gimple_build_assign (n, a);
}
else if (TREE_CODE (cond) == TRUTH_NOT_EXPR)
{
/* Given !V, build the assignment N = false. */
tree op0 = TREE_OPERAND (cond, 0);
gcc_assert (op0 == v);
- assertion = build_gimple_modify_stmt (n, boolean_false_node);
+ assertion = gimple_build_assign (n, boolean_false_node);
}
else if (TREE_CODE (cond) == SSA_NAME)
{
/* Given V, build the assignment N = true. */
gcc_assert (v == cond);
- assertion = build_gimple_modify_stmt (n, boolean_true_node);
+ assertion = gimple_build_assign (n, boolean_true_node);
}
else
gcc_unreachable ();
@@ -3419,10 +3565,11 @@ build_assert_expr_for (tree cond, tree v)
point values. */
static inline bool
-fp_predicate (const_tree expr)
+fp_predicate (gimple stmt)
{
- return (COMPARISON_CLASS_P (expr)
- && FLOAT_TYPE_P (TREE_TYPE (TREE_OPERAND (expr, 0))));
+ GIMPLE_CHECK (stmt, GIMPLE_COND);
+
+ return FLOAT_TYPE_P (TREE_TYPE (gimple_cond_lhs (stmt)));
}
@@ -3432,7 +3579,7 @@ fp_predicate (const_tree expr)
inferred. */
static bool
-infer_value_range (tree stmt, tree op, enum tree_code *comp_code_p, tree *val_p)
+infer_value_range (gimple stmt, tree op, enum tree_code *comp_code_p, tree *val_p)
{
*val_p = NULL_TREE;
*comp_code_p = ERROR_MARK;
@@ -3444,19 +3591,21 @@ infer_value_range (tree stmt, tree op, enum tree_code *comp_code_p, tree *val_p)
/* Similarly, don't infer anything from statements that may throw
exceptions. */
- if (tree_could_throw_p (stmt))
+ if (stmt_could_throw_p (stmt))
return false;
/* If STMT is the last statement of a basic block with no
successors, there is no point inferring anything about any of its
operands. We would not be able to find a proper insertion point
for the assertion, anyway. */
- if (stmt_ends_bb_p (stmt) && EDGE_COUNT (bb_for_stmt (stmt)->succs) == 0)
+ if (stmt_ends_bb_p (stmt) && EDGE_COUNT (gimple_bb (stmt)->succs) == 0)
return false;
/* We can only assume that a pointer dereference will yield
non-NULL if -fdelete-null-pointer-checks is enabled. */
- if (flag_delete_null_pointer_checks && POINTER_TYPE_P (TREE_TYPE (op)))
+ if (flag_delete_null_pointer_checks
+ && POINTER_TYPE_P (TREE_TYPE (op))
+ && gimple_code (stmt) != GIMPLE_ASM)
{
unsigned num_uses, num_loads, num_stores;
@@ -3493,7 +3642,7 @@ dump_asserts_for (FILE *file, tree name)
while (loc)
{
fprintf (file, "\t");
- print_generic_expr (file, bsi_stmt (loc->si), 0);
+ print_gimple_stmt (file, gsi_stmt (loc->si), 0, 0);
fprintf (file, "\n\tBB #%d", loc->bb->index);
if (loc->e)
{
@@ -3563,7 +3712,7 @@ register_new_assert_for (tree name, tree expr,
tree val,
basic_block bb,
edge e,
- block_stmt_iterator si)
+ gimple_stmt_iterator si)
{
assert_locus_t n, loc, last_loc;
bool found;
@@ -3573,8 +3722,8 @@ register_new_assert_for (tree name, tree expr,
gcc_assert (bb == NULL || e == NULL);
if (e == NULL)
- gcc_assert (TREE_CODE (bsi_stmt (si)) != COND_EXPR
- && TREE_CODE (bsi_stmt (si)) != SWITCH_EXPR);
+ gcc_assert (gimple_code (gsi_stmt (si)) != GIMPLE_COND
+ && gimple_code (gsi_stmt (si)) != GIMPLE_SWITCH);
#endif
/* The new assertion A will be inserted at BB or E. We need to
@@ -3746,7 +3895,7 @@ extract_code_and_val_from_cond_with_ops (tree name, enum tree_code cond_code,
Return true if an assertion for NAME could be registered. */
static bool
-register_edge_assert_for_2 (tree name, edge e, block_stmt_iterator bsi,
+register_edge_assert_for_2 (tree name, edge e, gimple_stmt_iterator bsi,
enum tree_code cond_code,
tree cond_op0, tree cond_op1, bool invert)
{
@@ -3778,30 +3927,29 @@ register_edge_assert_for_2 (tree name, edge e, block_stmt_iterator bsi,
&& TREE_CODE (val) == INTEGER_CST
&& TYPE_UNSIGNED (TREE_TYPE (val)))
{
- tree def_stmt = SSA_NAME_DEF_STMT (name);
+ gimple def_stmt = SSA_NAME_DEF_STMT (name);
tree cst2 = NULL_TREE, name2 = NULL_TREE, name3 = NULL_TREE;
/* Extract CST2 from the (optional) addition. */
- if (TREE_CODE (def_stmt) == GIMPLE_MODIFY_STMT
- && TREE_CODE (GIMPLE_STMT_OPERAND (def_stmt, 1)) == PLUS_EXPR)
+ if (is_gimple_assign (def_stmt)
+ && gimple_assign_rhs_code (def_stmt) == PLUS_EXPR)
{
- name2 = TREE_OPERAND (GIMPLE_STMT_OPERAND (def_stmt, 1), 0);
- cst2 = TREE_OPERAND (GIMPLE_STMT_OPERAND (def_stmt, 1), 1);
+ name2 = gimple_assign_rhs1 (def_stmt);
+ cst2 = gimple_assign_rhs2 (def_stmt);
if (TREE_CODE (name2) == SSA_NAME
&& TREE_CODE (cst2) == INTEGER_CST)
def_stmt = SSA_NAME_DEF_STMT (name2);
}
/* Extract NAME2 from the (optional) sign-changing cast. */
- if (TREE_CODE (def_stmt) == GIMPLE_MODIFY_STMT
- && CONVERT_EXPR_P (GIMPLE_STMT_OPERAND (def_stmt, 1)))
+ if (gimple_assign_cast_p (def_stmt))
{
- tree rhs = GIMPLE_STMT_OPERAND (def_stmt, 1);
- if (CONVERT_EXPR_P (rhs)
- && ! TYPE_UNSIGNED (TREE_TYPE (TREE_OPERAND (rhs, 0)))
- && (TYPE_PRECISION (TREE_TYPE (rhs))
- == TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (rhs, 0)))))
- name3 = TREE_OPERAND (GIMPLE_STMT_OPERAND (def_stmt, 1), 0);
+ if ((gimple_assign_rhs_code (def_stmt) == NOP_EXPR
+ || gimple_assign_rhs_code (def_stmt) == CONVERT_EXPR)
+ && ! TYPE_UNSIGNED (TREE_TYPE (gimple_assign_rhs1 (def_stmt)))
+ && (TYPE_PRECISION (gimple_expr_type (def_stmt))
+ == TYPE_PRECISION (TREE_TYPE (gimple_assign_rhs1 (def_stmt)))))
+ name3 = gimple_assign_rhs1 (def_stmt);
}
/* If name3 is used later, create an ASSERT_EXPR for it. */
@@ -3878,10 +4026,11 @@ register_edge_assert_for_2 (tree name, edge e, block_stmt_iterator bsi,
static bool
register_edge_assert_for_1 (tree op, enum tree_code code,
- edge e, block_stmt_iterator bsi)
+ edge e, gimple_stmt_iterator bsi)
{
bool retval = false;
- tree op_def, rhs, val;
+ gimple op_def;
+ tree val;
enum tree_code rhs_code;
/* We only care about SSA_NAMEs. */
@@ -3905,17 +4054,16 @@ register_edge_assert_for_1 (tree op, enum tree_code code,
a truth operation or some bit operations, then we may be able
to register information about the operands of that assignment. */
op_def = SSA_NAME_DEF_STMT (op);
- if (TREE_CODE (op_def) != GIMPLE_MODIFY_STMT)
+ if (gimple_code (op_def) != GIMPLE_ASSIGN)
return retval;
- rhs = GIMPLE_STMT_OPERAND (op_def, 1);
- rhs_code = TREE_CODE (rhs);
+ rhs_code = gimple_assign_rhs_code (op_def);
- if (COMPARISON_CLASS_P (rhs))
+ if (TREE_CODE_CLASS (rhs_code) == tcc_comparison)
{
bool invert = (code == EQ_EXPR ? true : false);
- tree op0 = TREE_OPERAND (rhs, 0);
- tree op1 = TREE_OPERAND (rhs, 1);
+ tree op0 = gimple_assign_rhs1 (op_def);
+ tree op1 = gimple_assign_rhs2 (op_def);
if (TREE_CODE (op0) == SSA_NAME)
retval |= register_edge_assert_for_2 (op0, e, bsi, rhs_code, op0, op1,
@@ -3925,34 +4073,36 @@ register_edge_assert_for_1 (tree op, enum tree_code code,
invert);
}
else if ((code == NE_EXPR
- && (TREE_CODE (rhs) == TRUTH_AND_EXPR
- || TREE_CODE (rhs) == BIT_AND_EXPR))
+ && (gimple_assign_rhs_code (op_def) == TRUTH_AND_EXPR
+ || gimple_assign_rhs_code (op_def) == BIT_AND_EXPR))
|| (code == EQ_EXPR
- && (TREE_CODE (rhs) == TRUTH_OR_EXPR
- || TREE_CODE (rhs) == BIT_IOR_EXPR)))
+ && (gimple_assign_rhs_code (op_def) == TRUTH_OR_EXPR
+ || gimple_assign_rhs_code (op_def) == BIT_IOR_EXPR)))
{
/* Recurse on each operand. */
- retval |= register_edge_assert_for_1 (TREE_OPERAND (rhs, 0),
+ retval |= register_edge_assert_for_1 (gimple_assign_rhs1 (op_def),
code, e, bsi);
- retval |= register_edge_assert_for_1 (TREE_OPERAND (rhs, 1),
+ retval |= register_edge_assert_for_1 (gimple_assign_rhs2 (op_def),
code, e, bsi);
}
- else if (TREE_CODE (rhs) == TRUTH_NOT_EXPR)
+ else if (gimple_assign_rhs_code (op_def) == TRUTH_NOT_EXPR)
{
/* Recurse, flipping CODE. */
code = invert_tree_comparison (code, false);
- retval |= register_edge_assert_for_1 (TREE_OPERAND (rhs, 0),
+ retval |= register_edge_assert_for_1 (gimple_assign_rhs1 (op_def),
code, e, bsi);
}
- else if (TREE_CODE (rhs) == SSA_NAME)
+ else if (gimple_assign_rhs_code (op_def) == SSA_NAME)
{
/* Recurse through the copy. */
- retval |= register_edge_assert_for_1 (rhs, code, e, bsi);
+ retval |= register_edge_assert_for_1 (gimple_assign_rhs1 (op_def),
+ code, e, bsi);
}
- else if (CONVERT_EXPR_P (rhs))
+ else if (gimple_assign_rhs_code (op_def) == NOP_EXPR
+ || gimple_assign_rhs_code (op_def) == CONVERT_EXPR)
{
/* Recurse through the type conversion. */
- retval |= register_edge_assert_for_1 (TREE_OPERAND (rhs, 0),
+ retval |= register_edge_assert_for_1 (gimple_assign_rhs1 (op_def),
code, e, bsi);
}
@@ -3964,7 +4114,7 @@ register_edge_assert_for_1 (tree op, enum tree_code code,
Return true if an assertion for NAME could be registered. */
static bool
-register_edge_assert_for (tree name, edge e, block_stmt_iterator si,
+register_edge_assert_for (tree name, edge e, gimple_stmt_iterator si,
enum tree_code cond_code, tree cond_op0,
tree cond_op1)
{
@@ -3999,14 +4149,14 @@ register_edge_assert_for (tree name, edge e, block_stmt_iterator si,
if (((comp_code == EQ_EXPR && integer_onep (val))
|| (comp_code == NE_EXPR && integer_zerop (val))))
{
- tree def_stmt = SSA_NAME_DEF_STMT (name);
+ gimple def_stmt = SSA_NAME_DEF_STMT (name);
- if (TREE_CODE (def_stmt) == GIMPLE_MODIFY_STMT
- && (TREE_CODE (GIMPLE_STMT_OPERAND (def_stmt, 1)) == TRUTH_AND_EXPR
- || TREE_CODE (GIMPLE_STMT_OPERAND (def_stmt, 1)) == BIT_AND_EXPR))
+ if (is_gimple_assign (def_stmt)
+ && (gimple_assign_rhs_code (def_stmt) == TRUTH_AND_EXPR
+ || gimple_assign_rhs_code (def_stmt) == BIT_AND_EXPR))
{
- tree op0 = TREE_OPERAND (GIMPLE_STMT_OPERAND (def_stmt, 1), 0);
- tree op1 = TREE_OPERAND (GIMPLE_STMT_OPERAND (def_stmt, 1), 1);
+ tree op0 = gimple_assign_rhs1 (def_stmt);
+ tree op1 = gimple_assign_rhs2 (def_stmt);
retval |= register_edge_assert_for_1 (op0, NE_EXPR, e, si);
retval |= register_edge_assert_for_1 (op1, NE_EXPR, e, si);
}
@@ -4018,18 +4168,17 @@ register_edge_assert_for (tree name, edge e, block_stmt_iterator si,
if (((comp_code == EQ_EXPR && integer_zerop (val))
|| (comp_code == NE_EXPR && integer_onep (val))))
{
- tree def_stmt = SSA_NAME_DEF_STMT (name);
+ gimple def_stmt = SSA_NAME_DEF_STMT (name);
- if (TREE_CODE (def_stmt) == GIMPLE_MODIFY_STMT
- && (TREE_CODE (GIMPLE_STMT_OPERAND (def_stmt, 1)) == TRUTH_OR_EXPR
+ if (is_gimple_assign (def_stmt)
+ && (gimple_assign_rhs_code (def_stmt) == TRUTH_OR_EXPR
/* For BIT_IOR_EXPR only if NAME == 0 both operands have
necessarily zero value. */
|| (comp_code == EQ_EXPR
- && (TREE_CODE (GIMPLE_STMT_OPERAND (def_stmt, 1))
- == BIT_IOR_EXPR))))
+ && (gimple_assign_rhs_code (def_stmt) == BIT_IOR_EXPR))))
{
- tree op0 = TREE_OPERAND (GIMPLE_STMT_OPERAND (def_stmt, 1), 0);
- tree op1 = TREE_OPERAND (GIMPLE_STMT_OPERAND (def_stmt, 1), 1);
+ tree op0 = gimple_assign_rhs1 (def_stmt);
+ tree op1 = gimple_assign_rhs2 (def_stmt);
retval |= register_edge_assert_for_1 (op0, EQ_EXPR, e, si);
retval |= register_edge_assert_for_1 (op1, EQ_EXPR, e, si);
}
@@ -4050,17 +4199,17 @@ static bool find_assert_locations (basic_block bb);
list of assertions for the corresponding operands. */
static bool
-find_conditional_asserts (basic_block bb, tree last)
+find_conditional_asserts (basic_block bb, gimple last)
{
bool need_assert;
- block_stmt_iterator bsi;
+ gimple_stmt_iterator bsi;
tree op;
edge_iterator ei;
edge e;
ssa_op_iter iter;
need_assert = false;
- bsi = bsi_for_stmt (last);
+ bsi = gsi_for_stmt (last);
/* Look for uses of the operands in each of the sub-graphs
rooted at BB. We need to check each of the outgoing edges
@@ -4104,15 +4253,10 @@ find_conditional_asserts (basic_block bb, tree last)
conditional predicate. */
FOR_EACH_SSA_TREE_OPERAND (op, last, iter, SSA_OP_USE)
{
- tree cond = COND_EXPR_COND (last);
- if (op != cond)
- need_assert |= register_edge_assert_for (op, e, bsi,
- TREE_CODE (cond),
- TREE_OPERAND (cond, 0),
- TREE_OPERAND (cond, 1));
- else
- need_assert |= register_edge_assert_for (op, e, bsi, EQ_EXPR, op,
- boolean_true_node);
+ need_assert |= register_edge_assert_for (op, e, bsi,
+ gimple_cond_code (last),
+ gimple_cond_lhs (last),
+ gimple_cond_rhs (last));
}
}
@@ -4160,26 +4304,26 @@ compare_case_labels (const void *p1, const void *p2)
list of assertions for the corresponding operands. */
static bool
-find_switch_asserts (basic_block bb, tree last)
+find_switch_asserts (basic_block bb, gimple last)
{
bool need_assert;
- block_stmt_iterator bsi;
+ gimple_stmt_iterator bsi;
tree op;
edge e;
- tree vec = SWITCH_LABELS (last), vec2;
- size_t n = TREE_VEC_LENGTH (vec);
+ tree vec2;
+ size_t n = gimple_switch_num_labels(last);
unsigned int idx;
need_assert = false;
- bsi = bsi_for_stmt (last);
- op = TREE_OPERAND (last, 0);
+ bsi = gsi_for_stmt (last);
+ op = gimple_switch_index (last);
if (TREE_CODE (op) != SSA_NAME)
return false;
/* Build a vector of case labels sorted by destination label. */
vec2 = make_tree_vec (n);
for (idx = 0; idx < n; ++idx)
- TREE_VEC_ELT (vec2, idx) = TREE_VEC_ELT (vec, idx);
+ TREE_VEC_ELT (vec2, idx) = gimple_switch_label (last, idx);
qsort (&TREE_VEC_ELT (vec2, 0), n, sizeof (tree), compare_case_labels);
for (idx = 0; idx < n; ++idx)
@@ -4319,8 +4463,9 @@ find_switch_asserts (basic_block bb, tree last)
static bool
find_assert_locations (basic_block bb)
{
- block_stmt_iterator si;
- tree last, phi;
+ gimple_stmt_iterator si;
+ gimple last;
+ gimple phi;
bool need_assert;
basic_block son;
@@ -4332,10 +4477,11 @@ find_assert_locations (basic_block bb)
need_assert = false;
/* Traverse all PHI nodes in BB marking used operands. */
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
+ for (si = gsi_start_phis (bb); !gsi_end_p(si); gsi_next (&si))
{
use_operand_p arg_p;
ssa_op_iter i;
+ phi = gsi_stmt (si);
FOR_EACH_PHI_ARG (arg_p, phi, i, SSA_OP_USE)
{
@@ -4350,13 +4496,14 @@ find_assert_locations (basic_block bb)
/* Traverse all the statements in BB marking used names and looking
for statements that may infer assertions for their used operands. */
- last = NULL_TREE;
- for (si = bsi_start (bb); !bsi_end_p (si); bsi_next (&si))
+ last = NULL;
+ for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si))
{
- tree stmt, op;
+ gimple stmt;
+ tree op;
ssa_op_iter i;
- stmt = bsi_stmt (si);
+ stmt = gsi_stmt (si);
/* See if we can derive an assertion for any of STMT's operands. */
FOR_EACH_SSA_TREE_OPERAND (op, stmt, i, SSA_OP_USE)
@@ -4385,20 +4532,16 @@ find_assert_locations (basic_block bb)
if (comp_code == NE_EXPR && integer_zerop (value))
{
tree t = op;
- tree def_stmt = SSA_NAME_DEF_STMT (t);
+ gimple def_stmt = SSA_NAME_DEF_STMT (t);
- while (TREE_CODE (def_stmt) == GIMPLE_MODIFY_STMT
+ while (is_gimple_assign (def_stmt)
+ && gimple_assign_rhs_code (def_stmt) == NOP_EXPR
&& TREE_CODE
- (GIMPLE_STMT_OPERAND (def_stmt, 1)) == NOP_EXPR
- && TREE_CODE
- (TREE_OPERAND (GIMPLE_STMT_OPERAND (def_stmt, 1),
- 0)) == SSA_NAME
+ (gimple_assign_rhs1 (def_stmt)) == SSA_NAME
&& POINTER_TYPE_P
- (TREE_TYPE (TREE_OPERAND
- (GIMPLE_STMT_OPERAND (def_stmt,
- 1), 0))))
+ (TREE_TYPE (gimple_assign_rhs1 (def_stmt))))
{
- t = TREE_OPERAND (GIMPLE_STMT_OPERAND (def_stmt, 1), 0);
+ t = gimple_assign_rhs1 (def_stmt);
def_stmt = SSA_NAME_DEF_STMT (t);
/* Note we want to register the assert for the
@@ -4433,13 +4576,13 @@ find_assert_locations (basic_block bb)
involving integer operands, recurse into each of the sub-graphs
rooted at BB to determine if we need to add ASSERT_EXPRs. */
if (last
- && TREE_CODE (last) == COND_EXPR
- && !fp_predicate (COND_EXPR_COND (last))
+ && gimple_code (last) == GIMPLE_COND
+ && !fp_predicate (last)
&& !ZERO_SSA_OPERANDS (last, SSA_OP_USE))
need_assert |= find_conditional_asserts (bb, last);
if (last
- && TREE_CODE (last) == SWITCH_EXPR
+ && gimple_code (last) == GIMPLE_SWITCH
&& !ZERO_SSA_OPERANDS (last, SSA_OP_USE))
need_assert |= find_switch_asserts (bb, last);
@@ -4460,32 +4603,33 @@ static bool
process_assert_insertions_for (tree name, assert_locus_t loc)
{
/* Build the comparison expression NAME_i COMP_CODE VAL. */
- tree stmt, cond, assert_expr;
+ gimple stmt;
+ tree cond;
+ gimple assert_stmt;
edge_iterator ei;
edge e;
cond = build2 (loc->comp_code, boolean_type_node, loc->expr, loc->val);
- assert_expr = build_assert_expr_for (cond, name);
-
+ assert_stmt = build_assert_expr_for (cond, name);
if (loc->e)
{
/* We have been asked to insert the assertion on an edge. This
is used only by COND_EXPR and SWITCH_EXPR assertions. */
#if defined ENABLE_CHECKING
- gcc_assert (TREE_CODE (bsi_stmt (loc->si)) == COND_EXPR
- || TREE_CODE (bsi_stmt (loc->si)) == SWITCH_EXPR);
+ gcc_assert (gimple_code (gsi_stmt (loc->si)) == GIMPLE_COND
+ || gimple_code (gsi_stmt (loc->si)) == GIMPLE_SWITCH);
#endif
- bsi_insert_on_edge (loc->e, assert_expr);
+ gsi_insert_on_edge (loc->e, assert_stmt);
return true;
}
/* Otherwise, we can insert right after LOC->SI iff the
statement must not be the last statement in the block. */
- stmt = bsi_stmt (loc->si);
+ stmt = gsi_stmt (loc->si);
if (!stmt_ends_bb_p (stmt))
{
- bsi_insert_after (&loc->si, assert_expr, BSI_SAME_STMT);
+ gsi_insert_after (&loc->si, assert_stmt, GSI_SAME_STMT);
return false;
}
@@ -4496,7 +4640,7 @@ process_assert_insertions_for (tree name, assert_locus_t loc)
FOR_EACH_EDGE (e, ei, loc->bb->succs)
if (!(e->flags & EDGE_ABNORMAL))
{
- bsi_insert_on_edge (e, assert_expr);
+ gsi_insert_on_edge (e, assert_stmt);
return true;
}
@@ -4535,7 +4679,7 @@ process_assert_insertions (void)
}
if (update_edges_p)
- bsi_commit_edge_inserts ();
+ gsi_commit_edge_inserts ();
statistics_counter_event (cfun, "Number of ASSERT_EXPR expressions inserted",
num_asserts);
@@ -4622,7 +4766,7 @@ insert_range_assertions (void)
IGNORE_OFF_BY_ONE is true if the ARRAY_REF is inside a ADDR_EXPR. */
static void
-check_array_ref (tree ref, location_t* locus, bool ignore_off_by_one)
+check_array_ref (tree ref, const location_t *location, bool ignore_off_by_one)
{
value_range_t* vr = NULL;
tree low_sub, up_sub;
@@ -4662,7 +4806,7 @@ check_array_ref (tree ref, location_t* locus, bool ignore_off_by_one)
&& tree_int_cst_lt (low_sub, low_bound))
{
warning (OPT_Warray_bounds,
- "%Harray subscript is outside array bounds", locus);
+ "%Harray subscript is outside array bounds", location);
TREE_NO_WARNING (ref) = 1;
}
}
@@ -4677,14 +4821,14 @@ check_array_ref (tree ref, location_t* locus, bool ignore_off_by_one)
up_sub)))
{
warning (OPT_Warray_bounds, "%Harray subscript is above array bounds",
- locus);
+ location);
TREE_NO_WARNING (ref) = 1;
}
else if (TREE_CODE (low_sub) == INTEGER_CST
&& tree_int_cst_lt (low_sub, low_bound))
{
warning (OPT_Warray_bounds, "%Harray subscript is below array bounds",
- locus);
+ location);
TREE_NO_WARNING (ref) = 1;
}
}
@@ -4693,14 +4837,20 @@ check_array_ref (tree ref, location_t* locus, bool ignore_off_by_one)
address of an ARRAY_REF, and call check_array_ref on it. */
static void
-search_for_addr_array(tree t, location_t* location)
+search_for_addr_array(tree t, const location_t *location)
{
while (TREE_CODE (t) == SSA_NAME)
{
- t = SSA_NAME_DEF_STMT (t);
- if (TREE_CODE (t) != GIMPLE_MODIFY_STMT)
+ gimple g = SSA_NAME_DEF_STMT (t);
+
+ if (gimple_code (g) != GIMPLE_ASSIGN)
return;
- t = GIMPLE_STMT_OPERAND (t, 1);
+
+ if (get_gimple_rhs_class (gimple_assign_rhs_code (g)) !=
+ GIMPLE_SINGLE_RHS)
+ return;
+
+ t = gimple_assign_rhs1 (g);
}
@@ -4729,14 +4879,8 @@ static tree
check_array_bounds (tree *tp, int *walk_subtree, void *data)
{
tree t = *tp;
- tree stmt = (tree)data;
- location_t *location = EXPR_LOCUS (stmt);
-
- if (!EXPR_HAS_LOCATION (stmt))
- {
- *walk_subtree = FALSE;
- return NULL_TREE;
- }
+ struct walk_stmt_info *wi = (struct walk_stmt_info *) data;
+ const location_t *location = (const location_t *) wi->info;
*walk_subtree = TRUE;
@@ -4746,14 +4890,6 @@ check_array_bounds (tree *tp, int *walk_subtree, void *data)
if (TREE_CODE (t) == INDIRECT_REF
|| (TREE_CODE (t) == RETURN_EXPR && TREE_OPERAND (t, 0)))
search_for_addr_array (TREE_OPERAND (t, 0), location);
- else if (TREE_CODE (t) == CALL_EXPR)
- {
- tree arg;
- call_expr_arg_iterator iter;
-
- FOR_EACH_CALL_EXPR_ARG (arg, iter, t)
- search_for_addr_array (arg, location);
- }
if (TREE_CODE (t) == ADDR_EXPR)
*walk_subtree = FALSE;
@@ -4768,7 +4904,7 @@ static void
check_all_array_refs (void)
{
basic_block bb;
- block_stmt_iterator si;
+ gimple_stmt_iterator si;
FOR_EACH_BB (bb)
{
@@ -4776,21 +4912,46 @@ check_all_array_refs (void)
if (single_pred_p (bb))
{
basic_block pred_bb = EDGE_PRED (bb, 0)->src;
- tree ls = NULL_TREE;
+ gimple ls = NULL;
- if (!bsi_end_p (bsi_last (pred_bb)))
- ls = bsi_stmt (bsi_last (pred_bb));
+ if (!gsi_end_p (gsi_last_bb (pred_bb)))
+ ls = gsi_stmt (gsi_last_bb (pred_bb));
- if (ls && TREE_CODE (ls) == COND_EXPR
- && ((COND_EXPR_COND (ls) == boolean_false_node
+ if (ls && gimple_code (ls) == GIMPLE_COND
+ && ((gimple_cond_false_p (ls)
&& (EDGE_PRED (bb, 0)->flags & EDGE_TRUE_VALUE))
- || (COND_EXPR_COND (ls) == boolean_true_node
+ || (gimple_cond_true_p (ls)
&& (EDGE_PRED (bb, 0)->flags & EDGE_FALSE_VALUE))))
continue;
}
- for (si = bsi_start (bb); !bsi_end_p (si); bsi_next (&si))
- walk_tree (bsi_stmt_ptr (si), check_array_bounds,
- bsi_stmt (si), NULL);
+ for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si))
+ {
+ gimple stmt = gsi_stmt (si);
+ const location_t *location = gimple_location_ptr (stmt);
+ struct walk_stmt_info wi;
+ if (!gimple_has_location (stmt))
+ continue;
+
+ if (is_gimple_call (stmt))
+ {
+ size_t i;
+ size_t n = gimple_call_num_args (stmt);
+ for (i = 0; i < n; i++)
+ {
+ tree arg = gimple_call_arg (stmt, i);
+ search_for_addr_array (arg, location);
+ }
+ }
+ else
+ {
+ memset (&wi, 0, sizeof (wi));
+ wi.info = CONST_CAST (void *, (const void *) location);
+
+ walk_gimple_op (gsi_stmt (si),
+ check_array_bounds,
+ &wi);
+ }
+ }
}
}
@@ -4822,21 +4983,22 @@ static void
remove_range_assertions (void)
{
basic_block bb;
- block_stmt_iterator si;
+ gimple_stmt_iterator si;
/* Note that the BSI iterator bump happens at the bottom of the
loop and no bump is necessary if we're removing the statement
referenced by the current BSI. */
FOR_EACH_BB (bb)
- for (si = bsi_start (bb); !bsi_end_p (si);)
+ for (si = gsi_start_bb (bb); !gsi_end_p (si);)
{
- tree stmt = bsi_stmt (si);
- tree use_stmt;
+ gimple stmt = gsi_stmt (si);
+ gimple use_stmt;
- if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
- && TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 1)) == ASSERT_EXPR)
+ if (is_gimple_assign (stmt)
+ && gimple_assign_rhs_code (stmt) == ASSERT_EXPR)
{
- tree rhs = GIMPLE_STMT_OPERAND (stmt, 1), var;
+ tree rhs = gimple_assign_rhs1 (stmt);
+ tree var;
tree cond = fold (ASSERT_EXPR_COND (rhs));
use_operand_p use_p;
imm_use_iterator iter;
@@ -4846,7 +5008,7 @@ remove_range_assertions (void)
/* Propagate the RHS into every use of the LHS. */
var = ASSERT_EXPR_VAR (rhs);
FOR_EACH_IMM_USE_STMT (use_stmt, iter,
- GIMPLE_STMT_OPERAND (stmt, 0))
+ gimple_assign_lhs (stmt))
FOR_EACH_IMM_USE_ON_STMT (use_p, iter)
{
SET_USE (use_p, var);
@@ -4854,11 +5016,11 @@ remove_range_assertions (void)
}
/* And finally, remove the copy, it is not needed. */
- bsi_remove (&si, true);
+ gsi_remove (&si, true);
release_defs (stmt);
}
else
- bsi_next (&si);
+ gsi_next (&si);
}
sbitmap_free (blocks_visited);
@@ -4868,32 +5030,31 @@ remove_range_assertions (void)
/* Return true if STMT is interesting for VRP. */
static bool
-stmt_interesting_for_vrp (tree stmt)
+stmt_interesting_for_vrp (gimple stmt)
{
- if (TREE_CODE (stmt) == PHI_NODE
- && is_gimple_reg (PHI_RESULT (stmt))
- && (INTEGRAL_TYPE_P (TREE_TYPE (PHI_RESULT (stmt)))
- || POINTER_TYPE_P (TREE_TYPE (PHI_RESULT (stmt)))))
+ if (gimple_code (stmt) == GIMPLE_PHI
+ && is_gimple_reg (gimple_phi_result (stmt))
+ && (INTEGRAL_TYPE_P (TREE_TYPE (gimple_phi_result (stmt)))
+ || POINTER_TYPE_P (TREE_TYPE (gimple_phi_result (stmt)))))
return true;
- else if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT)
+ else if (is_gimple_assign (stmt) || is_gimple_call (stmt))
{
- tree lhs = GIMPLE_STMT_OPERAND (stmt, 0);
- tree rhs = GIMPLE_STMT_OPERAND (stmt, 1);
+ tree lhs = gimple_get_lhs (stmt);
/* In general, assignments with virtual operands are not useful
for deriving ranges, with the obvious exception of calls to
builtin functions. */
- if (TREE_CODE (lhs) == SSA_NAME
+ if (lhs && TREE_CODE (lhs) == SSA_NAME
&& (INTEGRAL_TYPE_P (TREE_TYPE (lhs))
|| POINTER_TYPE_P (TREE_TYPE (lhs)))
- && ((TREE_CODE (rhs) == CALL_EXPR
- && TREE_CODE (CALL_EXPR_FN (rhs)) == ADDR_EXPR
- && DECL_P (TREE_OPERAND (CALL_EXPR_FN (rhs), 0))
- && DECL_IS_BUILTIN (TREE_OPERAND (CALL_EXPR_FN (rhs), 0)))
+ && ((is_gimple_call (stmt)
+ && gimple_call_fndecl (stmt) != NULL_TREE
+ && DECL_IS_BUILTIN (gimple_call_fndecl (stmt)))
|| ZERO_SSA_OPERANDS (stmt, SSA_OP_ALL_VIRTUALS)))
return true;
}
- else if (TREE_CODE (stmt) == COND_EXPR || TREE_CODE (stmt) == SWITCH_EXPR)
+ else if (gimple_code (stmt) == GIMPLE_COND
+ || gimple_code (stmt) == GIMPLE_SWITCH)
return true;
return false;
@@ -4912,24 +5073,24 @@ vrp_initialize (void)
FOR_EACH_BB (bb)
{
- block_stmt_iterator si;
- tree phi;
+ gimple_stmt_iterator si;
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
+ for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si))
{
+ gimple phi = gsi_stmt (si);
if (!stmt_interesting_for_vrp (phi))
{
tree lhs = PHI_RESULT (phi);
set_value_range_to_varying (get_value_range (lhs));
- DONT_SIMULATE_AGAIN (phi) = true;
+ prop_set_simulate_again (phi, false);
}
else
- DONT_SIMULATE_AGAIN (phi) = false;
+ prop_set_simulate_again (phi, true);
}
- for (si = bsi_start (bb); !bsi_end_p (si); bsi_next (&si))
+ for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si))
{
- tree stmt = bsi_stmt (si);
+ gimple stmt = gsi_stmt (si);
if (!stmt_interesting_for_vrp (stmt))
{
@@ -4937,11 +5098,11 @@ vrp_initialize (void)
tree def;
FOR_EACH_SSA_TREE_OPERAND (def, stmt, i, SSA_OP_DEF)
set_value_range_to_varying (get_value_range (def));
- DONT_SIMULATE_AGAIN (stmt) = true;
+ prop_set_simulate_again (stmt, false);
}
else
{
- DONT_SIMULATE_AGAIN (stmt) = false;
+ prop_set_simulate_again (stmt, true);
}
}
}
@@ -4952,13 +5113,12 @@ vrp_initialize (void)
the SSA name in *OUTPUT_P. */
static enum ssa_prop_result
-vrp_visit_assignment (tree stmt, tree *output_p)
+vrp_visit_assignment_or_call (gimple stmt, tree *output_p)
{
- tree lhs, rhs, def;
+ tree def, lhs;
ssa_op_iter iter;
-
- lhs = GIMPLE_STMT_OPERAND (stmt, 0);
- rhs = GIMPLE_STMT_OPERAND (stmt, 1);
+ enum gimple_code code = gimple_code (stmt);
+ lhs = gimple_get_lhs (stmt);
/* We only keep track of ranges in integral and pointer types. */
if (TREE_CODE (lhs) == SSA_NAME
@@ -4972,7 +5132,10 @@ vrp_visit_assignment (tree stmt, tree *output_p)
struct loop *l;
value_range_t new_vr = { VR_UNDEFINED, NULL_TREE, NULL_TREE, NULL };
- extract_range_from_expr (&new_vr, rhs);
+ if (code == GIMPLE_CALL)
+ extract_range_basic (&new_vr, stmt);
+ else
+ extract_range_from_assignment (&new_vr, stmt);
/* If STMT is inside a loop, we may be able to know something
else about the range of LHS by examining scalar evolution
@@ -5233,15 +5396,12 @@ vrp_evaluate_conditional_warnv_with_ops (enum tree_code code, tree op0,
if (use_equiv_p)
{
if (TREE_CODE (op0) == SSA_NAME && TREE_CODE (op1) == SSA_NAME)
- return compare_names (code, op0, op1,
- strict_overflow_p);
+ return compare_names (code, op0, op1, strict_overflow_p);
else if (TREE_CODE (op0) == SSA_NAME)
- return compare_name_with_value (code, op0, op1,
- strict_overflow_p);
+ return compare_name_with_value (code, op0, op1, strict_overflow_p);
else if (TREE_CODE (op1) == SSA_NAME)
return (compare_name_with_value
- (swap_tree_comparison (code), op1, op0,
- strict_overflow_p));
+ (swap_tree_comparison (code), op1, op0, strict_overflow_p));
}
else
{
@@ -5251,15 +5411,12 @@ vrp_evaluate_conditional_warnv_with_ops (enum tree_code code, tree op0,
vr1 = (TREE_CODE (op1) == SSA_NAME) ? get_value_range (op1) : NULL;
if (vr0 && vr1)
- return compare_ranges (code, vr0, vr1,
- strict_overflow_p);
+ return compare_ranges (code, vr0, vr1, strict_overflow_p);
else if (vr0 && vr1 == NULL)
- return compare_range_with_value (code, vr0, op1,
- strict_overflow_p);
+ return compare_range_with_value (code, vr0, op1, strict_overflow_p);
else if (vr0 == NULL && vr1)
return (compare_range_with_value
- (swap_tree_comparison (code), vr1, op0,
- strict_overflow_p));
+ (swap_tree_comparison (code), vr1, op0, strict_overflow_p));
}
return NULL_TREE;
}
@@ -5272,17 +5429,13 @@ vrp_evaluate_conditional_warnv_with_ops (enum tree_code code, tree op0,
appropriate. */
tree
-vrp_evaluate_conditional (enum tree_code code, tree op0, tree op1, tree stmt)
+vrp_evaluate_conditional (enum tree_code code, tree op0, tree op1, gimple stmt)
{
bool sop;
tree ret;
sop = false;
- ret = vrp_evaluate_conditional_warnv_with_ops (code,
- op0,
- op1,
- true,
- &sop);
+ ret = vrp_evaluate_conditional_warnv_with_ops (code, op0, op1, true, &sop);
if (ret && sop)
{
@@ -5304,13 +5457,13 @@ vrp_evaluate_conditional (enum tree_code code, tree op0, tree op1, tree stmt)
if (issue_strict_overflow_warning (wc))
{
- location_t locus;
+ location_t location;
- if (!EXPR_HAS_LOCATION (stmt))
- locus = input_location;
+ if (!gimple_has_location (stmt))
+ location = input_location;
else
- locus = EXPR_LOCATION (stmt);
- warning (OPT_Wstrict_overflow, "%H%s", &locus, warnmsg);
+ location = gimple_location (stmt);
+ warning (OPT_Wstrict_overflow, "%H%s", &location, warnmsg);
}
}
@@ -5344,14 +5497,14 @@ vrp_evaluate_conditional (enum tree_code code, tree op0, tree op1, tree stmt)
if (warnmsg)
{
- location_t locus;
+ location_t location;
- if (!EXPR_HAS_LOCATION (stmt))
- locus = input_location;
+ if (!gimple_has_location (stmt))
+ location = input_location;
else
- locus = EXPR_LOCATION (stmt);
+ location = gimple_location (stmt);
- warning (OPT_Wtype_limits, "%H%s", &locus, warnmsg);
+ warning (OPT_Wtype_limits, "%H%s", &location, warnmsg);
}
}
@@ -5365,13 +5518,12 @@ vrp_evaluate_conditional (enum tree_code code, tree op0, tree op1, tree stmt)
SSA_PROP_VARYING. */
static enum ssa_prop_result
-vrp_visit_cond_stmt (tree stmt, edge *taken_edge_p)
+vrp_visit_cond_stmt (gimple stmt, edge *taken_edge_p)
{
- tree cond, val;
+ tree val;
bool sop;
*taken_edge_p = NULL;
- cond = COND_EXPR_COND (stmt);
if (dump_file && (dump_flags & TDF_DETAILS))
{
@@ -5379,7 +5531,7 @@ vrp_visit_cond_stmt (tree stmt, edge *taken_edge_p)
ssa_op_iter i;
fprintf (dump_file, "\nVisiting conditional with predicate: ");
- print_generic_expr (dump_file, cond, 0);
+ print_gimple_stmt (dump_file, stmt, 0, 0);
fprintf (dump_file, "\nWith known ranges\n");
FOR_EACH_SSA_TREE_OPERAND (use, stmt, i, SSA_OP_USE)
@@ -5437,22 +5589,14 @@ vrp_visit_cond_stmt (tree stmt, edge *taken_edge_p)
4 more predicates folded in SPEC. */
sop = false;
- if (TREE_CODE (cond) == SSA_NAME)
- val = vrp_evaluate_conditional_warnv_with_ops (EQ_EXPR,
- cond,
- boolean_true_node,
- false,
- &sop);
- else
- val = vrp_evaluate_conditional_warnv_with_ops (TREE_CODE (cond),
- TREE_OPERAND (cond, 0),
- TREE_OPERAND (cond, 1),
- false,
- &sop);
+ val = vrp_evaluate_conditional_warnv_with_ops (gimple_cond_code (stmt),
+ gimple_cond_lhs (stmt),
+ gimple_cond_rhs (stmt),
+ false, &sop);
if (val)
{
if (!sop)
- *taken_edge_p = find_taken_edge (bb_for_stmt (stmt), val);
+ *taken_edge_p = find_taken_edge (gimple_bb (stmt), val);
else
{
if (dump_file && (dump_flags & TDF_DETAILS))
@@ -5477,7 +5621,7 @@ vrp_visit_cond_stmt (tree stmt, edge *taken_edge_p)
/* Searches the case label vector VEC for the index *IDX of the CASE_LABEL
that includes the value VAL. The search is restricted to the range
- [START_IDX, n - 2] where n is the size of VEC (n - 1 is the default label).
+ [START_IDX, n - 1] where n is the size of VEC.
If there is a CASE_LABEL for VAL, its index is placed in IDX and true is
returned.
@@ -5485,25 +5629,25 @@ vrp_visit_cond_stmt (tree stmt, edge *taken_edge_p)
If there is no CASE_LABEL for VAL and the is one that is larger than VAL,
it is placed in IDX and false is returned.
- If VAL is larger than any CASE_LABEL, n - 1 is placed on IDX and false is
+ If VAL is larger than any CASE_LABEL, n is placed on IDX and false is
returned. */
static bool
-find_case_label_index (tree vec, size_t start_idx, tree val, size_t *idx)
+find_case_label_index (gimple stmt, size_t start_idx, tree val, size_t *idx)
{
- size_t n = TREE_VEC_LENGTH (vec);
+ size_t n = gimple_switch_num_labels (stmt);
size_t low, high;
/* Find case label for minimum of the value range or the next one.
At each iteration we are searching in [low, high - 1]. */
- for (low = start_idx, high = n - 1; high != low; )
+ for (low = start_idx, high = n; high != low; )
{
tree t;
int cmp;
- /* Note that i != high, so we never ask for n - 1. */
+ /* Note that i != high, so we never ask for n. */
size_t i = (high + low) / 2;
- t = TREE_VEC_ELT (vec, i);
+ t = gimple_switch_label (stmt, i);
/* Cache the result of comparing CASE_LOW and val. */
cmp = tree_int_cst_compare (CASE_LOW (t), val);
@@ -5539,11 +5683,12 @@ find_case_label_index (tree vec, size_t start_idx, tree val, size_t *idx)
Returns true if the default label is not needed. */
static bool
-find_case_label_range (tree vec, tree min, tree max, size_t *min_idx, size_t *max_idx)
+find_case_label_range (gimple stmt, tree min, tree max, size_t *min_idx,
+ size_t *max_idx)
{
size_t i, j;
- bool min_take_default = !find_case_label_index (vec, 0, min, &i);
- bool max_take_default = !find_case_label_index (vec, i, max, &j);
+ bool min_take_default = !find_case_label_index (stmt, 1, min, &i);
+ bool max_take_default = !find_case_label_index (stmt, i, max, &j);
if (i == j
&& min_take_default
@@ -5566,20 +5711,20 @@ find_case_label_range (tree vec, tree min, tree max, size_t *min_idx, size_t *ma
/* If the case label range is continuous, we do not need
the default case label. Verify that. */
- high = CASE_LOW (TREE_VEC_ELT (vec, i));
- if (CASE_HIGH (TREE_VEC_ELT (vec, i)))
- high = CASE_HIGH (TREE_VEC_ELT (vec, i));
+ high = CASE_LOW (gimple_switch_label (stmt, i));
+ if (CASE_HIGH (gimple_switch_label (stmt, i)))
+ high = CASE_HIGH (gimple_switch_label (stmt, i));
for (k = i + 1; k <= j; ++k)
{
- low = CASE_LOW (TREE_VEC_ELT (vec, k));
+ low = CASE_LOW (gimple_switch_label (stmt, k));
if (!integer_onep (int_const_binop (MINUS_EXPR, low, high, 0)))
{
take_default = true;
break;
}
high = low;
- if (CASE_HIGH (TREE_VEC_ELT (vec, k)))
- high = CASE_HIGH (TREE_VEC_ELT (vec, k));
+ if (CASE_HIGH (gimple_switch_label (stmt, k)))
+ high = CASE_HIGH (gimple_switch_label (stmt, k));
}
*min_idx = i;
@@ -5594,16 +5739,15 @@ find_case_label_range (tree vec, tree min, tree max, size_t *min_idx, size_t *ma
SSA_PROP_VARYING. */
static enum ssa_prop_result
-vrp_visit_switch_stmt (tree stmt, edge *taken_edge_p)
+vrp_visit_switch_stmt (gimple stmt, edge *taken_edge_p)
{
tree op, val;
value_range_t *vr;
size_t i = 0, j = 0, n;
- tree vec;
bool take_default;
*taken_edge_p = NULL;
- op = TREE_OPERAND (stmt, 0);
+ op = gimple_switch_index (stmt);
if (TREE_CODE (op) != SSA_NAME)
return SSA_PROP_VARYING;
@@ -5622,26 +5766,26 @@ vrp_visit_switch_stmt (tree stmt, edge *taken_edge_p)
return SSA_PROP_VARYING;
/* Find the single edge that is taken from the switch expression. */
- vec = SWITCH_LABELS (stmt);
- n = TREE_VEC_LENGTH (vec);
+ n = gimple_switch_num_labels (stmt);
- take_default = !find_case_label_range (vec, vr->min, vr->max, &i, &j);
+ take_default = !find_case_label_range (stmt, vr->min, vr->max, &i, &j);
/* Check if the range spans no CASE_LABEL. If so, we only reach the default
label */
if (j < i)
{
gcc_assert (take_default);
- val = TREE_VEC_ELT (vec, n - 1);
+ val = gimple_switch_default_label (stmt);
}
else
{
/* Check if labels with index i to j and maybe the default label
are all reaching the same label. */
- val = TREE_VEC_ELT (vec, i);
+ val = gimple_switch_label (stmt, i);
if (take_default
- && CASE_LABEL (TREE_VEC_ELT (vec, n - 1)) != CASE_LABEL (val))
+ && CASE_LABEL (gimple_switch_default_label (stmt))
+ != CASE_LABEL (val))
{
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, " not a single destination for this "
@@ -5650,7 +5794,7 @@ vrp_visit_switch_stmt (tree stmt, edge *taken_edge_p)
}
for (++i; i <= j; ++i)
{
- if (CASE_LABEL (TREE_VEC_ELT (vec, i)) != CASE_LABEL (val))
+ if (CASE_LABEL (gimple_switch_label (stmt, i)) != CASE_LABEL (val))
{
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, " not a single destination for this "
@@ -5660,7 +5804,7 @@ vrp_visit_switch_stmt (tree stmt, edge *taken_edge_p)
}
}
- *taken_edge_p = find_edge (bb_for_stmt (stmt),
+ *taken_edge_p = find_edge (gimple_bb (stmt),
label_to_block (CASE_LABEL (val)));
if (dump_file && (dump_flags & TDF_DETAILS))
@@ -5683,37 +5827,33 @@ vrp_visit_switch_stmt (tree stmt, edge *taken_edge_p)
If STMT produces a varying value, return SSA_PROP_VARYING. */
static enum ssa_prop_result
-vrp_visit_stmt (tree stmt, edge *taken_edge_p, tree *output_p)
+vrp_visit_stmt (gimple stmt, edge *taken_edge_p, tree *output_p)
{
tree def;
ssa_op_iter iter;
- stmt_ann_t ann;
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "\nVisiting statement:\n");
- print_generic_stmt (dump_file, stmt, dump_flags);
+ print_gimple_stmt (dump_file, stmt, 0, dump_flags);
fprintf (dump_file, "\n");
}
- ann = stmt_ann (stmt);
- if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT)
+ if (is_gimple_assign (stmt) || is_gimple_call (stmt))
{
- tree rhs = GIMPLE_STMT_OPERAND (stmt, 1);
-
/* In general, assignments with virtual operands are not useful
for deriving ranges, with the obvious exception of calls to
builtin functions. */
- if ((TREE_CODE (rhs) == CALL_EXPR
- && TREE_CODE (CALL_EXPR_FN (rhs)) == ADDR_EXPR
- && DECL_P (TREE_OPERAND (CALL_EXPR_FN (rhs), 0))
- && DECL_IS_BUILTIN (TREE_OPERAND (CALL_EXPR_FN (rhs), 0)))
+
+ if ((is_gimple_call (stmt)
+ && gimple_call_fndecl (stmt) != NULL_TREE
+ && DECL_IS_BUILTIN (gimple_call_fndecl (stmt)))
|| ZERO_SSA_OPERANDS (stmt, SSA_OP_ALL_VIRTUALS))
- return vrp_visit_assignment (stmt, output_p);
+ return vrp_visit_assignment_or_call (stmt, output_p);
}
- else if (TREE_CODE (stmt) == COND_EXPR)
+ else if (gimple_code (stmt) == GIMPLE_COND)
return vrp_visit_cond_stmt (stmt, taken_edge_p);
- else if (TREE_CODE (stmt) == SWITCH_EXPR)
+ else if (gimple_code (stmt) == GIMPLE_SWITCH)
return vrp_visit_switch_stmt (stmt, taken_edge_p);
/* All other statements produce nothing of interest for VRP, so mark
@@ -5876,9 +6016,9 @@ give_up:
value ranges, set a new range for the LHS of PHI. */
static enum ssa_prop_result
-vrp_visit_phi_node (tree phi)
+vrp_visit_phi_node (gimple phi)
{
- int i;
+ size_t i;
tree lhs = PHI_RESULT (phi);
value_range_t *lhs_vr = get_value_range (lhs);
value_range_t vr_result = { VR_UNDEFINED, NULL_TREE, NULL_TREE, NULL };
@@ -5889,19 +6029,19 @@ vrp_visit_phi_node (tree phi)
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "\nVisiting PHI node: ");
- print_generic_expr (dump_file, phi, dump_flags);
+ print_gimple_stmt (dump_file, phi, 0, dump_flags);
}
edges = 0;
- for (i = 0; i < PHI_NUM_ARGS (phi); i++)
+ for (i = 0; i < gimple_phi_num_args (phi); i++)
{
- edge e = PHI_ARG_EDGE (phi, i);
+ edge e = gimple_phi_arg_edge (phi, i);
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file,
"\n Argument #%d (%d -> %d %sexecutable)\n",
- i, e->src->index, e->dest->index,
+ (int) i, e->src->index, e->dest->index,
(e->flags & EDGE_EXECUTABLE) ? "" : "not ");
}
@@ -6027,13 +6167,15 @@ varying:
than zero and the second operand is an exact power of two. */
static void
-simplify_div_or_mod_using_ranges (tree stmt, tree rhs, enum tree_code rhs_code)
+simplify_div_or_mod_using_ranges (gimple stmt)
{
+ enum tree_code rhs_code = gimple_assign_rhs_code (stmt);
tree val = NULL;
- tree op = TREE_OPERAND (rhs, 0);
- value_range_t *vr = get_value_range (TREE_OPERAND (rhs, 0));
+ tree op0 = gimple_assign_rhs1 (stmt);
+ tree op1 = gimple_assign_rhs2 (stmt);
+ value_range_t *vr = get_value_range (gimple_assign_rhs1 (stmt));
- if (TYPE_UNSIGNED (TREE_TYPE (op)))
+ if (TYPE_UNSIGNED (TREE_TYPE (op0)))
{
val = integer_one_node;
}
@@ -6048,39 +6190,41 @@ simplify_div_or_mod_using_ranges (tree stmt, tree rhs, enum tree_code rhs_code)
&& integer_onep (val)
&& issue_strict_overflow_warning (WARN_STRICT_OVERFLOW_MISC))
{
- location_t locus;
+ location_t location;
- if (!EXPR_HAS_LOCATION (stmt))
- locus = input_location;
+ if (!gimple_has_location (stmt))
+ location = input_location;
else
- locus = EXPR_LOCATION (stmt);
+ location = gimple_location (stmt);
warning (OPT_Wstrict_overflow,
("%Hassuming signed overflow does not occur when "
"simplifying / or %% to >> or &"),
- &locus);
+ &location);
}
}
if (val && integer_onep (val))
{
tree t;
- tree op0 = TREE_OPERAND (rhs, 0);
- tree op1 = TREE_OPERAND (rhs, 1);
if (rhs_code == TRUNC_DIV_EXPR)
{
t = build_int_cst (NULL_TREE, tree_log2 (op1));
- t = build2 (RSHIFT_EXPR, TREE_TYPE (op0), op0, t);
+ gimple_assign_set_rhs_code (stmt, RSHIFT_EXPR);
+ gimple_assign_set_rhs1 (stmt, op0);
+ gimple_assign_set_rhs2 (stmt, t);
}
else
{
t = build_int_cst (TREE_TYPE (op1), 1);
t = int_const_binop (MINUS_EXPR, op1, t, 0);
t = fold_convert (TREE_TYPE (op0), t);
- t = build2 (BIT_AND_EXPR, TREE_TYPE (op0), op0, t);
+
+ gimple_assign_set_rhs_code (stmt, BIT_AND_EXPR);
+ gimple_assign_set_rhs1 (stmt, op0);
+ gimple_assign_set_rhs2 (stmt, t);
}
- GIMPLE_STMT_OPERAND (stmt, 1) = t;
update_stmt (stmt);
}
}
@@ -6090,12 +6234,12 @@ simplify_div_or_mod_using_ranges (tree stmt, tree rhs, enum tree_code rhs_code)
ABS_EXPR into a NEGATE_EXPR. */
static void
-simplify_abs_using_ranges (tree stmt, tree rhs)
+simplify_abs_using_ranges (gimple stmt)
{
tree val = NULL;
- tree op = TREE_OPERAND (rhs, 0);
+ tree op = gimple_assign_rhs1 (stmt);
tree type = TREE_TYPE (op);
- value_range_t *vr = get_value_range (TREE_OPERAND (rhs, 0));
+ value_range_t *vr = get_value_range (op);
if (TYPE_UNSIGNED (type))
{
@@ -6124,28 +6268,25 @@ simplify_abs_using_ranges (tree stmt, tree rhs)
if (val
&& (integer_onep (val) || integer_zerop (val)))
{
- tree t;
-
if (sop && issue_strict_overflow_warning (WARN_STRICT_OVERFLOW_MISC))
{
- location_t locus;
+ location_t location;
- if (!EXPR_HAS_LOCATION (stmt))
- locus = input_location;
+ if (!gimple_has_location (stmt))
+ location = input_location;
else
- locus = EXPR_LOCATION (stmt);
+ location = gimple_location (stmt);
warning (OPT_Wstrict_overflow,
("%Hassuming signed overflow does not occur when "
"simplifying abs (X) to X or -X"),
- &locus);
+ &location);
}
+ gimple_assign_set_rhs1 (stmt, op);
if (integer_onep (val))
- t = build1 (NEGATE_EXPR, TREE_TYPE (op), op);
+ gimple_assign_set_rhs_code (stmt, NEGATE_EXPR);
else
- t = op;
-
- GIMPLE_STMT_OPERAND (stmt, 1) = t;
+ gimple_assign_set_rhs_code (stmt, SSA_NAME);
update_stmt (stmt);
}
}
@@ -6224,12 +6365,11 @@ test_for_singularity (enum tree_code cond_code, tree op0,
the original conditional. */
static void
-simplify_cond_using_ranges (tree stmt)
+simplify_cond_using_ranges (gimple stmt)
{
- tree cond = COND_EXPR_COND (stmt);
- tree op0 = TREE_OPERAND (cond, 0);
- tree op1 = TREE_OPERAND (cond, 1);
- enum tree_code cond_code = TREE_CODE (cond);
+ tree op0 = gimple_cond_lhs (stmt);
+ tree op1 = gimple_cond_rhs (stmt);
+ enum tree_code cond_code = gimple_cond_code (stmt);
if (cond_code != NE_EXPR
&& cond_code != EQ_EXPR
@@ -6243,24 +6383,26 @@ simplify_cond_using_ranges (tree stmt)
able to simplify this conditional. */
if (vr->type == VR_RANGE)
{
- tree new = test_for_singularity (cond_code, op0, op1, vr);
+ tree new_tree = test_for_singularity (cond_code, op0, op1, vr);
- if (new)
+ if (new_tree)
{
if (dump_file)
{
fprintf (dump_file, "Simplified relational ");
- print_generic_expr (dump_file, cond, 0);
+ print_gimple_stmt (dump_file, stmt, 0, 0);
fprintf (dump_file, " into ");
}
- COND_EXPR_COND (stmt)
- = build2 (EQ_EXPR, boolean_type_node, op0, new);
+ gimple_cond_set_code (stmt, EQ_EXPR);
+ gimple_cond_set_lhs (stmt, op0);
+ gimple_cond_set_rhs (stmt, new_tree);
+
update_stmt (stmt);
if (dump_file)
{
- print_generic_expr (dump_file, COND_EXPR_COND (stmt), 0);
+ print_gimple_stmt (dump_file, stmt, 0, 0);
fprintf (dump_file, "\n");
}
return;
@@ -6271,24 +6413,26 @@ simplify_cond_using_ranges (tree stmt)
with integral types here, so no need to worry about
issues with inverting FP comparisons. */
cond_code = invert_tree_comparison (cond_code, false);
- new = test_for_singularity (cond_code, op0, op1, vr);
+ new_tree = test_for_singularity (cond_code, op0, op1, vr);
- if (new)
+ if (new_tree)
{
if (dump_file)
{
fprintf (dump_file, "Simplified relational ");
- print_generic_expr (dump_file, cond, 0);
+ print_gimple_stmt (dump_file, stmt, 0, 0);
fprintf (dump_file, " into ");
}
- COND_EXPR_COND (stmt)
- = build2 (NE_EXPR, boolean_type_node, op0, new);
+ gimple_cond_set_code (stmt, NE_EXPR);
+ gimple_cond_set_lhs (stmt, op0);
+ gimple_cond_set_rhs (stmt, new_tree);
+
update_stmt (stmt);
if (dump_file)
{
- print_generic_expr (dump_file, COND_EXPR_COND (stmt), 0);
+ print_gimple_stmt (dump_file, stmt, 0, 0);
fprintf (dump_file, "\n");
}
return;
@@ -6302,15 +6446,15 @@ simplify_cond_using_ranges (tree stmt)
argument. */
static void
-simplify_switch_using_ranges (tree stmt)
+simplify_switch_using_ranges (gimple stmt)
{
- tree op = TREE_OPERAND (stmt, 0);
+ tree op = gimple_switch_index (stmt);
value_range_t *vr;
bool take_default;
edge e;
edge_iterator ei;
size_t i = 0, j = 0, n, n2;
- tree vec, vec2;
+ tree vec2;
switch_update su;
if (TREE_CODE (op) != SSA_NAME)
@@ -6324,35 +6468,36 @@ simplify_switch_using_ranges (tree stmt)
return;
/* Find case label for min/max of the value range. */
- vec = SWITCH_LABELS (stmt);
- n = TREE_VEC_LENGTH (vec);
- take_default = !find_case_label_range (vec, vr->min, vr->max, &i, &j);
+ n = gimple_switch_num_labels (stmt);
+ take_default = !find_case_label_range (stmt, vr->min, vr->max, &i, &j);
/* Bail out if this is just all edges taken. */
- if (i == 0
- && j == n - 2
+ if (i == 1
+ && j == n - 1
&& take_default)
return;
/* Build a new vector of taken case labels. */
vec2 = make_tree_vec (j - i + 1 + (int)take_default);
- for (n2 = 0; i <= j; ++i, ++n2)
- TREE_VEC_ELT (vec2, n2) = TREE_VEC_ELT (vec, i);
+ n2 = 0;
/* Add the default edge, if necessary. */
if (take_default)
- TREE_VEC_ELT (vec2, n2++) = TREE_VEC_ELT (vec, n - 1);
+ TREE_VEC_ELT (vec2, n2++) = gimple_switch_default_label (stmt);
+
+ for (; i <= j; ++i, ++n2)
+ TREE_VEC_ELT (vec2, n2) = gimple_switch_label (stmt, i);
/* Mark needed edges. */
for (i = 0; i < n2; ++i)
{
- e = find_edge (bb_for_stmt (stmt),
+ e = find_edge (gimple_bb (stmt),
label_to_block (CASE_LABEL (TREE_VEC_ELT (vec2, i))));
e->aux = (void *)-1;
}
/* Queue not needed edges for later removal. */
- FOR_EACH_EDGE (e, ei, bb_for_stmt (stmt)->succs)
+ FOR_EACH_EDGE (e, ei, gimple_bb (stmt)->succs)
{
if (e->aux == (void *)-1)
{
@@ -6376,31 +6521,29 @@ simplify_switch_using_ranges (tree stmt)
/* Simplify STMT using ranges if possible. */
void
-simplify_stmt_using_ranges (tree stmt)
+simplify_stmt_using_ranges (gimple stmt)
{
- if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT)
+ if (is_gimple_assign (stmt))
{
- tree rhs = GIMPLE_STMT_OPERAND (stmt, 1);
- enum tree_code rhs_code = TREE_CODE (rhs);
+ enum tree_code rhs_code = gimple_assign_rhs_code (stmt);
/* Transform TRUNC_DIV_EXPR and TRUNC_MOD_EXPR into RSHIFT_EXPR
and BIT_AND_EXPR respectively if the first operand is greater
than zero and the second operand is an exact power of two. */
if ((rhs_code == TRUNC_DIV_EXPR || rhs_code == TRUNC_MOD_EXPR)
- && INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (rhs, 0)))
- && integer_pow2p (TREE_OPERAND (rhs, 1)))
- simplify_div_or_mod_using_ranges (stmt, rhs, rhs_code);
+ && INTEGRAL_TYPE_P (TREE_TYPE (gimple_assign_rhs1 (stmt)))
+ && integer_pow2p (gimple_assign_rhs2 (stmt)))
+ simplify_div_or_mod_using_ranges (stmt);
/* Transform ABS (X) into X or -X as appropriate. */
if (rhs_code == ABS_EXPR
- && TREE_CODE (TREE_OPERAND (rhs, 0)) == SSA_NAME
- && INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (rhs, 0))))
- simplify_abs_using_ranges (stmt, rhs);
+ && TREE_CODE (gimple_assign_rhs1 (stmt)) == SSA_NAME
+ && INTEGRAL_TYPE_P (TREE_TYPE (gimple_assign_rhs1 (stmt))))
+ simplify_abs_using_ranges (stmt);
}
- else if (TREE_CODE (stmt) == COND_EXPR
- && COMPARISON_CLASS_P (COND_EXPR_COND (stmt)))
+ else if (gimple_code (stmt) == GIMPLE_COND)
simplify_cond_using_ranges (stmt);
- else if (TREE_CODE (stmt) == SWITCH_EXPR)
+ else if (gimple_code (stmt) == GIMPLE_SWITCH)
simplify_switch_using_ranges (stmt);
}
@@ -6417,26 +6560,17 @@ static VEC(tree,heap) *stack;
for any overflow warnings. */
static tree
-simplify_stmt_for_jump_threading (tree stmt, tree within_stmt)
+simplify_stmt_for_jump_threading (gimple stmt, gimple within_stmt)
{
- tree conditional;
/* We only use VRP information to simplify conditionals. This is
overly conservative, but it's unclear if doing more would be
worth the compile time cost. */
- if (TREE_CODE (stmt) != COND_EXPR)
+ if (gimple_code (stmt) != GIMPLE_COND)
return NULL;
- conditional = COND_EXPR_COND (stmt);
- if (TREE_CODE (conditional) == SSA_NAME)
- return vrp_evaluate_conditional (EQ_EXPR,
- conditional,
- boolean_true_node,
- within_stmt);
- else
- return vrp_evaluate_conditional (TREE_CODE (conditional),
- TREE_OPERAND (conditional, 0),
- TREE_OPERAND (conditional, 1),
- within_stmt);
+ return vrp_evaluate_conditional (gimple_cond_code (stmt),
+ gimple_cond_lhs (stmt),
+ gimple_cond_rhs (stmt), within_stmt);
}
/* Blocks which have more than one predecessor and more than
@@ -6463,7 +6597,7 @@ static void
identify_jump_threads (void)
{
basic_block bb;
- tree dummy;
+ gimple dummy;
int i;
edge e;
@@ -6491,8 +6625,9 @@ identify_jump_threads (void)
/* To avoid lots of silly node creation, we create a single
conditional and just modify it in-place when attempting to
thread jumps. */
- dummy = build2 (EQ_EXPR, boolean_type_node, NULL, NULL);
- dummy = build3 (COND_EXPR, void_type_node, dummy, NULL, NULL);
+ dummy = gimple_build_cond (EQ_EXPR,
+ integer_zero_node, integer_zero_node,
+ NULL, NULL);
/* Walk through all the blocks finding those which present a
potential jump threading opportunity. We could set this up
@@ -6502,7 +6637,7 @@ identify_jump_threads (void)
point in compilation. */
FOR_EACH_BB (bb)
{
- tree last, cond;
+ gimple last;
/* If the generic jump threading code does not find this block
interesting, then there is nothing to do. */
@@ -6512,21 +6647,17 @@ identify_jump_threads (void)
/* We only care about blocks ending in a COND_EXPR. While there
may be some value in handling SWITCH_EXPR here, I doubt it's
terribly important. */
- last = bsi_stmt (bsi_last (bb));
- if (TREE_CODE (last) != COND_EXPR)
+ last = gsi_stmt (gsi_last_bb (bb));
+ if (gimple_code (last) != GIMPLE_COND)
continue;
/* We're basically looking for any kind of conditional with
integral type arguments. */
- cond = COND_EXPR_COND (last);
- if ((TREE_CODE (cond) == SSA_NAME
- && INTEGRAL_TYPE_P (TREE_TYPE (cond)))
- || (COMPARISON_CLASS_P (cond)
- && TREE_CODE (TREE_OPERAND (cond, 0)) == SSA_NAME
- && INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (cond, 0)))
- && (TREE_CODE (TREE_OPERAND (cond, 1)) == SSA_NAME
- || is_gimple_min_invariant (TREE_OPERAND (cond, 1)))
- && INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (cond, 1)))))
+ if (TREE_CODE (gimple_cond_lhs (last)) == SSA_NAME
+ && INTEGRAL_TYPE_P (TREE_TYPE (gimple_cond_lhs (last)))
+ && (TREE_CODE (gimple_cond_rhs (last)) == SSA_NAME
+ || is_gimple_min_invariant (gimple_cond_rhs (last)))
+ && INTEGRAL_TYPE_P (TREE_TYPE (gimple_cond_rhs (last))))
{
edge_iterator ei;
@@ -6541,8 +6672,7 @@ identify_jump_threads (void)
if (e->flags & (EDGE_DFS_BACK | EDGE_COMPLEX))
continue;
- thread_across_edge (dummy, e, true,
- &stack,
+ thread_across_edge (dummy, e, true, &stack,
simplify_stmt_for_jump_threading);
}
}
@@ -6718,7 +6848,13 @@ execute_vrp (void)
remove_edge (e);
/* Update SWITCH_EXPR case label vector. */
for (i = 0; VEC_iterate (switch_update, to_update_switch_stmts, i, su); ++i)
- SWITCH_LABELS (su->stmt) = su->vec;
+ {
+ size_t j;
+ size_t n = TREE_VEC_LENGTH (su->vec);
+ gimple_switch_set_num_labels (su->stmt, n);
+ for (j = 0; j < n; j++)
+ gimple_switch_set_label (su->stmt, j, TREE_VEC_ELT (su->vec, j));
+ }
if (VEC_length (edge, to_remove_edges) > 0)
free_dominance_info (CDI_DOMINATORS);
@@ -6728,7 +6864,6 @@ execute_vrp (void)
scev_finalize ();
loop_optimizer_finalize ();
-
return 0;
}
diff --git a/gcc/tree.c b/gcc/tree.c
index 6441ae6ef33..c92beef74ca 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -105,8 +105,7 @@ const char *const tree_code_class_strings[] =
"binary",
"statement",
"vl_exp",
- "expression",
- "gimple_stmt"
+ "expression"
};
/* obstack.[ch] explicitly declined to prototype this. */
@@ -132,14 +131,12 @@ static const char * const tree_node_kind_names[] = {
"temp_tree_lists",
"vecs",
"binfos",
- "phi_nodes",
"ssa names",
"constructors",
"random kinds",
"lang_decl kinds",
"lang_type kinds",
"omp clauses",
- "gimple statements"
};
#endif /* GATHER_STATISTICS */
@@ -175,6 +172,16 @@ static GTY (()) tree int_cst_node;
static GTY ((if_marked ("ggc_marked_p"), param_is (union tree_node)))
htab_t int_cst_hash_table;
+/* Hash table for optimization flags and target option flags. Use the same
+ hash table for both sets of options. Nodes for building the current
+ optimization and target option nodes. The assumption is most of the time
+ the options created will already be in the hash table, so we avoid
+ allocating and freeing up a node repeatably. */
+static GTY (()) tree cl_optimization_node;
+static GTY (()) tree cl_target_option_node;
+static GTY ((if_marked ("ggc_marked_p"), param_is (union tree_node)))
+ htab_t cl_option_hash_table;
+
/* General tree->tree mapping structure for use in hash tables. */
@@ -196,6 +203,8 @@ static int type_hash_eq (const void *, const void *);
static hashval_t type_hash_hash (const void *);
static hashval_t int_cst_hash_hash (const void *);
static int int_cst_hash_eq (const void *, const void *);
+static hashval_t cl_option_hash_hash (const void *);
+static int cl_option_hash_eq (const void *, const void *);
static void print_type_hash_statistics (void);
static void print_debug_expr_statistics (void);
static void print_value_expr_statistics (void);
@@ -273,6 +282,12 @@ init_ttree (void)
int_cst_node = make_node (INTEGER_CST);
+ cl_option_hash_table = htab_create_ggc (64, cl_option_hash_hash,
+ cl_option_hash_eq, NULL);
+
+ cl_optimization_node = make_node (OPTIMIZATION_NODE);
+ cl_target_option_node = make_node (TARGET_OPTION_NODE);
+
tree_contains_struct[FUNCTION_DECL][TS_DECL_NON_COMMON] = 1;
tree_contains_struct[TRANSLATION_UNIT_DECL][TS_DECL_NON_COMMON] = 1;
tree_contains_struct[TYPE_DECL][TS_DECL_NON_COMMON] = 1;
@@ -422,7 +437,7 @@ decl_assembler_name_hash (const_tree asmname)
/* Compute the number of bytes occupied by a tree with code CODE.
This function cannot be used for nodes that have variable sizes,
- including TREE_VEC, PHI_NODE, STRING_CST, and CALL_EXPR. */
+ including TREE_VEC, STRING_CST, and CALL_EXPR. */
size_t
tree_code_size (enum tree_code code)
{
@@ -470,10 +485,6 @@ tree_code_size (enum tree_code code)
return (sizeof (struct tree_exp)
+ (TREE_CODE_LENGTH (code) - 1) * sizeof (tree));
- case tcc_gimple_stmt:
- return (sizeof (struct gimple_stmt)
- + (TREE_CODE_LENGTH (code) - 1) * sizeof (char *));
-
case tcc_constant: /* a constant */
switch (code)
{
@@ -497,14 +508,15 @@ tree_code_size (enum tree_code code)
case PLACEHOLDER_EXPR: return sizeof (struct tree_common);
case TREE_VEC:
- case OMP_CLAUSE:
- case PHI_NODE: gcc_unreachable ();
+ case OMP_CLAUSE: gcc_unreachable ();
case SSA_NAME: return sizeof (struct tree_ssa_name);
case STATEMENT_LIST: return sizeof (struct tree_statement_list);
case BLOCK: return sizeof (struct tree_block);
case CONSTRUCTOR: return sizeof (struct tree_constructor);
+ case OPTIMIZATION_NODE: return sizeof (struct tree_optimization_option);
+ case TARGET_OPTION_NODE: return sizeof (struct tree_target_option);
default:
return lang_hooks.tree_size (code);
@@ -523,10 +535,6 @@ tree_size (const_tree node)
const enum tree_code code = TREE_CODE (node);
switch (code)
{
- case PHI_NODE:
- return (sizeof (struct tree_phi_node)
- + (PHI_ARG_CAPACITY (node) - 1) * sizeof (struct phi_arg_d));
-
case TREE_BINFO:
return (offsetof (struct tree_binfo, base_binfos)
+ VEC_embedded_size (tree, BINFO_N_BASE_BINFOS (node)));
@@ -554,9 +562,8 @@ tree_size (const_tree node)
/* Return a newly allocated node of code CODE. For decl and type
nodes, some other fields are initialized. The rest of the node is
- initialized to zero. This function cannot be used for PHI_NODE,
- TREE_VEC or OMP_CLAUSE nodes, which is enforced by asserts in
- tree_code_size.
+ initialized to zero. This function cannot be used for TREE_VEC or
+ OMP_CLAUSE nodes, which is enforced by asserts in tree_code_size.
Achoo! I got a code in the node. */
@@ -598,10 +605,6 @@ make_node_stat (enum tree_code code MEM_STAT_DECL)
kind = c_kind;
break;
- case tcc_gimple_stmt:
- kind = gimple_stmt_kind;
- break;
-
case tcc_exceptional: /* something random, like an identifier. */
switch (code)
{
@@ -617,10 +620,6 @@ make_node_stat (enum tree_code code MEM_STAT_DECL)
kind = binfo_kind;
break;
- case PHI_NODE:
- kind = phi_kind;
- break;
-
case SSA_NAME:
kind = ssa_name_kind;
break;
@@ -663,8 +662,6 @@ make_node_stat (enum tree_code code MEM_STAT_DECL)
break;
case tcc_declaration:
- if (CODE_CONTAINS_STRUCT (code, TS_DECL_WITH_VIS))
- DECL_IN_SYSTEM_HEADER (t) = in_system_header;
if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON))
{
if (code == FUNCTION_DECL)
@@ -721,17 +718,6 @@ make_node_stat (enum tree_code code MEM_STAT_DECL)
}
break;
- case tcc_gimple_stmt:
- switch (code)
- {
- case GIMPLE_MODIFY_STMT:
- TREE_SIDE_EFFECTS (t) = 1;
- break;
-
- default:
- break;
- }
-
default:
/* Other classes need no special treatment. */
break;
@@ -756,8 +742,7 @@ copy_node_stat (tree node MEM_STAT_DECL)
t = (tree) ggc_alloc_zone_pass_stat (length, &tree_zone);
memcpy (t, node, length);
- if (!GIMPLE_TUPLE_P (node))
- TREE_CHAIN (t) = 0;
+ TREE_CHAIN (t) = 0;
TREE_ASM_WRITTEN (t) = 0;
TREE_VISITED (t) = 0;
t->base.ann = 0;
@@ -2025,10 +2010,6 @@ expr_align (const_tree t)
align1 = TYPE_ALIGN (TREE_TYPE (t));
return MAX (align0, align1);
- case GIMPLE_MODIFY_STMT:
- /* We should never ask for the alignment of a gimple statement. */
- gcc_unreachable ();
-
case SAVE_EXPR: case COMPOUND_EXPR: case MODIFY_EXPR:
case INIT_EXPR: case TARGET_EXPR: case WITH_CLEANUP_EXPR:
case CLEANUP_POINT_EXPR:
@@ -2400,8 +2381,6 @@ tree_node_structure (const_tree t)
case tcc_statement:
case tcc_vl_exp:
return TS_EXP;
- case tcc_gimple_stmt:
- return TS_GIMPLE_STATEMENT;
default: /* tcc_constant and tcc_exceptional */
break;
}
@@ -2415,13 +2394,10 @@ tree_node_structure (const_tree t)
case VECTOR_CST: return TS_VECTOR;
case STRING_CST: return TS_STRING;
/* tcc_exceptional cases. */
- /* FIXME tuples: eventually this should be TS_BASE. For now, nothing
- returns TS_BASE. */
case ERROR_MARK: return TS_COMMON;
case IDENTIFIER_NODE: return TS_IDENTIFIER;
case TREE_LIST: return TS_LIST;
case TREE_VEC: return TS_VEC;
- case PHI_NODE: return TS_PHI_NODE;
case SSA_NAME: return TS_SSA_NAME;
case PLACEHOLDER_EXPR: return TS_COMMON;
case STATEMENT_LIST: return TS_STATEMENT_LIST;
@@ -2429,6 +2405,8 @@ tree_node_structure (const_tree t)
case CONSTRUCTOR: return TS_CONSTRUCTOR;
case TREE_BINFO: return TS_BINFO;
case OMP_CLAUSE: return TS_OMP_CLAUSE;
+ case OPTIMIZATION_NODE: return TS_OPTIMIZATION;
+ case TARGET_OPTION_NODE: return TS_TARGET_OPTION;
default:
gcc_unreachable ();
@@ -2616,7 +2594,7 @@ substitute_in_expr (tree exp, tree f, tree r)
{
enum tree_code code = TREE_CODE (exp);
tree op0, op1, op2, op3;
- tree new, inner;
+ tree new_tree, inner;
/* We handle TREE_LIST and COMPONENT_REF separately. */
if (code == TREE_LIST)
@@ -2648,7 +2626,7 @@ substitute_in_expr (tree exp, tree f, tree r)
if (op0 == TREE_OPERAND (exp, 0))
return exp;
- new = fold_build3 (COMPONENT_REF, TREE_TYPE (exp),
+ new_tree = fold_build3 (COMPONENT_REF, TREE_TYPE (exp),
op0, TREE_OPERAND (exp, 1), NULL_TREE);
}
else
@@ -2674,7 +2652,7 @@ substitute_in_expr (tree exp, tree f, tree r)
if (op0 == TREE_OPERAND (exp, 0))
return exp;
- new = fold_build1 (code, TREE_TYPE (exp), op0);
+ new_tree = fold_build1 (code, TREE_TYPE (exp), op0);
break;
case 2:
@@ -2684,7 +2662,7 @@ substitute_in_expr (tree exp, tree f, tree r)
if (op0 == TREE_OPERAND (exp, 0) && op1 == TREE_OPERAND (exp, 1))
return exp;
- new = fold_build2 (code, TREE_TYPE (exp), op0, op1);
+ new_tree = fold_build2 (code, TREE_TYPE (exp), op0, op1);
break;
case 3:
@@ -2696,7 +2674,7 @@ substitute_in_expr (tree exp, tree f, tree r)
&& op2 == TREE_OPERAND (exp, 2))
return exp;
- new = fold_build3 (code, TREE_TYPE (exp), op0, op1, op2);
+ new_tree = fold_build3 (code, TREE_TYPE (exp), op0, op1, op2);
break;
case 4:
@@ -2710,7 +2688,7 @@ substitute_in_expr (tree exp, tree f, tree r)
&& op3 == TREE_OPERAND (exp, 3))
return exp;
- new = fold (build4 (code, TREE_TYPE (exp), op0, op1, op2, op3));
+ new_tree = fold (build4 (code, TREE_TYPE (exp), op0, op1, op2, op3));
break;
default:
@@ -2736,7 +2714,7 @@ substitute_in_expr (tree exp, tree f, tree r)
}
if (copy)
- new = fold (copy);
+ new_tree = fold (copy);
else
return exp;
}
@@ -2746,8 +2724,8 @@ substitute_in_expr (tree exp, tree f, tree r)
gcc_unreachable ();
}
- TREE_READONLY (new) = TREE_READONLY (exp);
- return new;
+ TREE_READONLY (new_tree) = TREE_READONLY (exp);
+ return new_tree;
}
/* Similar, but look for a PLACEHOLDER_EXPR in EXP and find a replacement
@@ -3269,15 +3247,6 @@ build2_stat (enum tree_code code, tree tt, tree arg0, tree arg1 MEM_STAT_DECL)
gcc_assert (TREE_CODE_LENGTH (code) == 2);
-#if 1
- /* FIXME tuples: Statement's aren't expressions! */
- if (code == GIMPLE_MODIFY_STMT)
- return build_gimple_modify_stmt_stat (arg0, arg1 PASS_MEM_STAT);
-#else
- /* Must use build_gimple_modify_stmt to construct GIMPLE_MODIFY_STMTs. */
- gcc_assert (code != GIMPLE_MODIFY_STMT);
-#endif
-
if ((code == MINUS_EXPR || code == PLUS_EXPR || code == MULT_EXPR)
&& arg0 && arg1 && tt && POINTER_TYPE_P (tt))
gcc_assert (TREE_CODE (arg0) == INTEGER_CST && TREE_CODE (arg1) == INTEGER_CST);
@@ -3316,21 +3285,6 @@ build2_stat (enum tree_code code, tree tt, tree arg0, tree arg1 MEM_STAT_DECL)
}
-/* Build a GIMPLE_MODIFY_STMT node. This tree code doesn't have a
- type, so we can't use build2 (a.k.a. build2_stat). */
-
-tree
-build_gimple_modify_stmt_stat (tree arg0, tree arg1 MEM_STAT_DECL)
-{
- tree t;
-
- t = make_node_stat (GIMPLE_MODIFY_STMT PASS_MEM_STAT);
- /* ?? We don't care about setting flags for tuples... */
- GIMPLE_STMT_OPERAND (t, 0) = arg0;
- GIMPLE_STMT_OPERAND (t, 1) = arg1;
- return t;
-}
-
tree
build3_stat (enum tree_code code, tree tt, tree arg0, tree arg1,
tree arg2 MEM_STAT_DECL)
@@ -3564,6 +3518,7 @@ expand_location (source_location loc)
xloc.file = NULL;
xloc.line = 0;
xloc.column = 0;
+ xloc.sysp = 0;
}
else
{
@@ -3571,6 +3526,7 @@ expand_location (source_location loc)
xloc.file = map->to_file;
xloc.line = SOURCE_LINE (map, loc);
xloc.column = SOURCE_COLUMN (map, loc);
+ xloc.sysp = map->sysp != 0;
};
return xloc;
}
@@ -3579,79 +3535,14 @@ expand_location (source_location loc)
/* Source location accessor functions. */
-/* The source location of this expression. Non-tree_exp nodes such as
- decls and constants can be shared among multiple locations, so
- return nothing. */
-location_t
-expr_location (const_tree node)
-{
- if (GIMPLE_STMT_P (node))
- return GIMPLE_STMT_LOCUS (node);
- return EXPR_P (node) ? node->exp.locus : UNKNOWN_LOCATION;
-}
-
-void
-set_expr_location (tree node, location_t locus)
-{
- if (GIMPLE_STMT_P (node))
- GIMPLE_STMT_LOCUS (node) = locus;
- else
- EXPR_CHECK (node)->exp.locus = locus;
-}
-
-bool
-expr_has_location (const_tree node)
-{
- return expr_location (node) != UNKNOWN_LOCATION;
-}
-
-source_location *
-expr_locus (const_tree node)
-{
- if (GIMPLE_STMT_P (node))
- return CONST_CAST (source_location *, &GIMPLE_STMT_LOCUS (node));
- return (EXPR_P (node)
- ? CONST_CAST (source_location *, &node->exp.locus)
- : (source_location *) NULL);
-}
-
void
set_expr_locus (tree node, source_location *loc)
{
if (loc == NULL)
- {
- if (GIMPLE_STMT_P (node))
- GIMPLE_STMT_LOCUS (node) = UNKNOWN_LOCATION;
- else
- EXPR_CHECK (node)->exp.locus = UNKNOWN_LOCATION;
- }
+ EXPR_CHECK (node)->exp.locus = UNKNOWN_LOCATION;
else
- {
- if (GIMPLE_STMT_P (node))
- GIMPLE_STMT_LOCUS (node) = *loc;
- else
- EXPR_CHECK (node)->exp.locus = *loc;
- }
-}
-
-/* Return the file name of the location of NODE. */
-const char *
-expr_filename (const_tree node)
-{
- if (GIMPLE_STMT_P (node))
- return LOCATION_FILE (GIMPLE_STMT_LOCUS (node));
- return LOCATION_FILE (EXPR_CHECK (node)->exp.locus);
+ EXPR_CHECK (node)->exp.locus = *loc;
}
-
-/* Return the line number of the location of NODE. */
-int
-expr_lineno (const_tree node)
-{
- if (GIMPLE_STMT_P (node))
- return LOCATION_LINE (GIMPLE_STMT_LOCUS (node));
- return LOCATION_LINE (EXPR_CHECK (node)->exp.locus);
-}
-
/* Return a declaration like DDECL except that its DECL_ATTRIBUTES
is ATTRIBUTE. */
@@ -4024,7 +3915,7 @@ merge_decl_attributes (tree olddecl, tree newdecl)
The second instance of `foo' nullifies the dllimport. */
tree
-merge_dllimport_decl_attributes (tree old, tree new)
+merge_dllimport_decl_attributes (tree old, tree new_tree)
{
tree a;
int delete_dllimport_p = 1;
@@ -4035,16 +3926,16 @@ merge_dllimport_decl_attributes (tree old, tree new)
is not dllimport'd. We also remove a `new' dllimport if the old list
contains dllexport: dllexport always overrides dllimport, regardless
of the order of declaration. */
- if (!VAR_OR_FUNCTION_DECL_P (new))
+ if (!VAR_OR_FUNCTION_DECL_P (new_tree))
delete_dllimport_p = 0;
- else if (DECL_DLLIMPORT_P (new)
+ else if (DECL_DLLIMPORT_P (new_tree)
&& lookup_attribute ("dllexport", DECL_ATTRIBUTES (old)))
{
- DECL_DLLIMPORT_P (new) = 0;
+ DECL_DLLIMPORT_P (new_tree) = 0;
warning (OPT_Wattributes, "%q+D already declared with dllexport attribute: "
- "dllimport ignored", new);
+ "dllimport ignored", new_tree);
}
- else if (DECL_DLLIMPORT_P (old) && !DECL_DLLIMPORT_P (new))
+ else if (DECL_DLLIMPORT_P (old) && !DECL_DLLIMPORT_P (new_tree))
{
/* Warn about overriding a symbol that has already been used, e.g.:
extern int __attribute__ ((dllimport)) foo;
@@ -4054,27 +3945,27 @@ merge_dllimport_decl_attributes (tree old, tree new)
if (TREE_USED (old))
{
warning (0, "%q+D redeclared without dllimport attribute "
- "after being referenced with dll linkage", new);
+ "after being referenced with dll linkage", new_tree);
/* If we have used a variable's address with dllimport linkage,
keep the old DECL_DLLIMPORT_P flag: the ADDR_EXPR using the
decl may already have had TREE_CONSTANT computed.
We still remove the attribute so that assembler code refers
to '&foo rather than '_imp__foo'. */
if (TREE_CODE (old) == VAR_DECL && TREE_ADDRESSABLE (old))
- DECL_DLLIMPORT_P (new) = 1;
+ DECL_DLLIMPORT_P (new_tree) = 1;
}
/* Let an inline definition silently override the external reference,
but otherwise warn about attribute inconsistency. */
- else if (TREE_CODE (new) == VAR_DECL
- || !DECL_DECLARED_INLINE_P (new))
+ else if (TREE_CODE (new_tree) == VAR_DECL
+ || !DECL_DECLARED_INLINE_P (new_tree))
warning (OPT_Wattributes, "%q+D redeclared without dllimport attribute: "
- "previous dllimport ignored", new);
+ "previous dllimport ignored", new_tree);
}
else
delete_dllimport_p = 0;
- a = merge_attributes (DECL_ATTRIBUTES (old), DECL_ATTRIBUTES (new));
+ a = merge_attributes (DECL_ATTRIBUTES (old), DECL_ATTRIBUTES (new_tree));
if (delete_dllimport_p)
{
@@ -5352,7 +5243,7 @@ commutative_tree_code (enum tree_code code)
}
/* Generate a hash value for an expression. This can be used iteratively
- by passing a previous result as the "val" argument.
+ by passing a previous result as the VAL argument.
This function is intended to produce the same hash for expressions which
would compare equal using operand_equal_p. */
@@ -5362,7 +5253,7 @@ iterative_hash_expr (const_tree t, hashval_t val)
{
int i;
enum tree_code code;
- char class;
+ char tclass;
if (t == NULL_TREE)
return iterative_hash_pointer (t, val);
@@ -5431,16 +5322,16 @@ iterative_hash_expr (const_tree t, hashval_t val)
}
/* else FALL THROUGH */
default:
- class = TREE_CODE_CLASS (code);
+ tclass = TREE_CODE_CLASS (code);
- if (class == tcc_declaration)
+ if (tclass == tcc_declaration)
{
/* DECL's have a unique ID */
val = iterative_hash_host_wide_int (DECL_UID (t), val);
}
else
{
- gcc_assert (IS_EXPR_CODE_CLASS (class));
+ gcc_assert (IS_EXPR_CODE_CLASS (tclass));
val = iterative_hash_object (code, val);
@@ -5480,6 +5371,29 @@ iterative_hash_expr (const_tree t, hashval_t val)
break;
}
}
+
+/* Generate a hash value for a pair of expressions. This can be used
+ iteratively by passing a previous result as the VAL argument.
+
+ The same hash value is always returned for a given pair of expressions,
+ regardless of the order in which they are presented. This is useful in
+ hashing the operands of commutative functions. */
+
+hashval_t
+iterative_hash_exprs_commutative (const_tree t1,
+ const_tree t2, hashval_t val)
+{
+ hashval_t one = iterative_hash_expr (t1, 0);
+ hashval_t two = iterative_hash_expr (t2, 0);
+ hashval_t t;
+
+ if (one > two)
+ t = one, one = two, two = t;
+ val = iterative_hash_hashval_t (one, val);
+ val = iterative_hash_hashval_t (two, val);
+
+ return val;
+}
/* Constructors for pointer, array and function types.
(RECORD_TYPE, UNION_TYPE and ENUMERAL_TYPE nodes are
@@ -6467,8 +6381,7 @@ get_type_static_bounds (const_tree type, mpz_t min, mpz_t max)
}
}
-/* auto_var_in_fn_p is called to determine whether VAR is an automatic
- variable defined in function FN. */
+/* Return true if VAR is an automatic variable defined in function FN. */
bool
auto_var_in_fn_p (const_tree var, const_tree fn)
@@ -7106,18 +7019,6 @@ tree_vec_elt_check_failed (int idx, int len, const char *file, int line,
idx + 1, len, function, trim_filename (file), line);
}
-/* Similar to above, except that the check is for the bounds of a PHI_NODE's
- (dynamically sized) vector. */
-
-void
-phi_node_elt_check_failed (int idx, int len, const char *file, int line,
- const char *function)
-{
- internal_error
- ("tree check: accessed elt %d of phi_node with %d elts in %s, at %s:%d",
- idx + 1, len, function, trim_filename (file), line);
-}
-
/* Similar to above, except that the check is for the bounds of the operand
vector of an expression node EXP. */
@@ -8668,6 +8569,10 @@ walk_tree_1 (tree *tp, walk_tree_fn func, void *data,
WALK_SUBTREE_TAIL (TREE_OPERAND (*tp, len));
}
+ case CHANGE_DYNAMIC_TYPE_EXPR:
+ WALK_SUBTREE (CHANGE_DYNAMIC_TYPE_NEW_TYPE (*tp));
+ WALK_SUBTREE_TAIL (CHANGE_DYNAMIC_TYPE_LOCATION (*tp));
+
case DECL_EXPR:
/* If this is a TYPE_DECL, walk into the fields of the type that it's
defining. We only want to walk into these fields of a type in this
@@ -8739,8 +8644,7 @@ walk_tree_1 (tree *tp, walk_tree_fn func, void *data,
/* FALLTHRU */
default:
- if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (code))
- || IS_GIMPLE_STMT_CODE_CLASS (TREE_CODE_CLASS (code)))
+ if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (code)))
{
int i, len;
@@ -8752,8 +8656,8 @@ walk_tree_1 (tree *tp, walk_tree_fn func, void *data,
if (len)
{
for (i = 0; i < len - 1; ++i)
- WALK_SUBTREE (GENERIC_TREE_OPERAND (*tp, i));
- WALK_SUBTREE_TAIL (GENERIC_TREE_OPERAND (*tp, len - 1));
+ WALK_SUBTREE (TREE_OPERAND (*tp, i));
+ WALK_SUBTREE_TAIL (TREE_OPERAND (*tp, len - 1));
}
}
/* If this is a type, walk the needed fields in the type. */
@@ -8785,31 +8689,6 @@ walk_tree_without_duplicates_1 (tree *tp, walk_tree_fn func, void *data,
}
-/* Return true if STMT is an empty statement or contains nothing but
- empty statements. */
-
-bool
-empty_body_p (tree stmt)
-{
- tree_stmt_iterator i;
- tree body;
-
- if (IS_EMPTY_STMT (stmt))
- return true;
- else if (TREE_CODE (stmt) == BIND_EXPR)
- body = BIND_EXPR_BODY (stmt);
- else if (TREE_CODE (stmt) == STATEMENT_LIST)
- body = stmt;
- else
- return false;
-
- for (i = tsi_start (body); !tsi_end_p (i); tsi_next (&i))
- if (!empty_body_p (tsi_stmt (i)))
- return false;
-
- return true;
-}
-
tree *
tree_block (tree t)
{
@@ -8817,28 +8696,10 @@ tree_block (tree t)
if (IS_EXPR_CODE_CLASS (c))
return &t->exp.block;
- else if (IS_GIMPLE_STMT_CODE_CLASS (c))
- return &GIMPLE_STMT_BLOCK (t);
gcc_unreachable ();
return NULL;
}
-tree *
-generic_tree_operand (tree node, int i)
-{
- if (GIMPLE_STMT_P (node))
- return &GIMPLE_STMT_OPERAND (node, i);
- return &TREE_OPERAND (node, i);
-}
-
-tree *
-generic_tree_type (tree node)
-{
- if (GIMPLE_STMT_P (node))
- return &void_type_node;
- return &TREE_TYPE (node);
-}
-
/* Build and return a TREE_LIST of arguments in the CALL_EXPR exp.
FIXME: don't use this function. It exists for compatibility with
the old representation of CALL_EXPRs where a list was used to hold the
@@ -8854,6 +8715,46 @@ call_expr_arglist (tree exp)
return arglist;
}
+
+/* Create a nameless artificial label and put it in the current function
+ context. Returns the newly created label. */
+
+tree
+create_artificial_label (void)
+{
+ tree lab = build_decl (LABEL_DECL, NULL_TREE, void_type_node);
+
+ DECL_ARTIFICIAL (lab) = 1;
+ DECL_IGNORED_P (lab) = 1;
+ DECL_CONTEXT (lab) = current_function_decl;
+ return lab;
+}
+
+/* Given a tree, try to return a useful variable name that we can use
+ to prefix a temporary that is being assigned the value of the tree.
+ I.E. given <temp> = &A, return A. */
+
+const char *
+get_name (tree t)
+{
+ tree stripped_decl;
+
+ stripped_decl = t;
+ STRIP_NOPS (stripped_decl);
+ if (DECL_P (stripped_decl) && DECL_NAME (stripped_decl))
+ return IDENTIFIER_POINTER (DECL_NAME (stripped_decl));
+ else
+ {
+ switch (TREE_CODE (stripped_decl))
+ {
+ case ADDR_EXPR:
+ return get_name (TREE_OPERAND (stripped_decl, 0));
+ default:
+ return NULL;
+ }
+ }
+}
+
/* Return true if TYPE has a variable argument list. */
bool
@@ -8942,4 +8843,132 @@ block_nonartificial_location (tree block)
return ret;
}
+/* These are the hash table functions for the hash table of OPTIMIZATION_NODEq
+ nodes. */
+
+/* Return the hash code code X, an OPTIMIZATION_NODE or TARGET_OPTION code. */
+
+static hashval_t
+cl_option_hash_hash (const void *x)
+{
+ const_tree const t = (const_tree) x;
+ const char *p;
+ size_t i;
+ size_t len = 0;
+ hashval_t hash = 0;
+
+ if (TREE_CODE (t) == OPTIMIZATION_NODE)
+ {
+ p = (const char *)TREE_OPTIMIZATION (t);
+ len = sizeof (struct cl_optimization);
+ }
+
+ else if (TREE_CODE (t) == TARGET_OPTION_NODE)
+ {
+ p = (const char *)TREE_TARGET_OPTION (t);
+ len = sizeof (struct cl_target_option);
+ }
+
+ else
+ gcc_unreachable ();
+
+ /* assume most opt flags are just 0/1, some are 2-3, and a few might be
+ something else. */
+ for (i = 0; i < len; i++)
+ if (p[i])
+ hash = (hash << 4) ^ ((i << 2) | p[i]);
+
+ return hash;
+}
+
+/* Return nonzero if the value represented by *X (an OPTIMIZATION or
+ TARGET_OPTION tree node) is the same as that given by *Y, which is the
+ same. */
+
+static int
+cl_option_hash_eq (const void *x, const void *y)
+{
+ const_tree const xt = (const_tree) x;
+ const_tree const yt = (const_tree) y;
+ const char *xp;
+ const char *yp;
+ size_t len;
+
+ if (TREE_CODE (xt) != TREE_CODE (yt))
+ return 0;
+
+ if (TREE_CODE (xt) == OPTIMIZATION_NODE)
+ {
+ xp = (const char *)TREE_OPTIMIZATION (xt);
+ yp = (const char *)TREE_OPTIMIZATION (yt);
+ len = sizeof (struct cl_optimization);
+ }
+
+ else if (TREE_CODE (xt) == TARGET_OPTION_NODE)
+ {
+ xp = (const char *)TREE_TARGET_OPTION (xt);
+ yp = (const char *)TREE_TARGET_OPTION (yt);
+ len = sizeof (struct cl_target_option);
+ }
+
+ else
+ gcc_unreachable ();
+
+ return (memcmp (xp, yp, len) == 0);
+}
+
+/* Build an OPTIMIZATION_NODE based on the current options. */
+
+tree
+build_optimization_node (void)
+{
+ tree t;
+ void **slot;
+
+ /* Use the cache of optimization nodes. */
+
+ cl_optimization_save (TREE_OPTIMIZATION (cl_optimization_node));
+
+ slot = htab_find_slot (cl_option_hash_table, cl_optimization_node, INSERT);
+ t = (tree) *slot;
+ if (!t)
+ {
+ /* Insert this one into the hash table. */
+ t = cl_optimization_node;
+ *slot = t;
+
+ /* Make a new node for next time round. */
+ cl_optimization_node = make_node (OPTIMIZATION_NODE);
+ }
+
+ return t;
+}
+
+/* Build a TARGET_OPTION_NODE based on the current options. */
+
+tree
+build_target_option_node (void)
+{
+ tree t;
+ void **slot;
+
+ /* Use the cache of optimization nodes. */
+
+ cl_target_option_save (TREE_TARGET_OPTION (cl_target_option_node));
+
+ slot = htab_find_slot (cl_option_hash_table, cl_target_option_node, INSERT);
+ t = (tree) *slot;
+ if (!t)
+ {
+ /* Insert this one into the hash table. */
+ t = cl_target_option_node;
+ *slot = t;
+
+ /* Make a new node for next time round. */
+ cl_target_option_node = make_node (TARGET_OPTION_NODE);
+ }
+
+ return t;
+}
+
#include "gt-tree.h"
diff --git a/gcc/tree.def b/gcc/tree.def
index 48b2f1cbde1..e9c891754bb 100644
--- a/gcc/tree.def
+++ b/gcc/tree.def
@@ -882,14 +882,6 @@ DEFTREECODE (ASM_EXPR, "asm_expr", tcc_statement, 4)
nodes to implement SSA versioning. */
DEFTREECODE (SSA_NAME, "ssa_name", tcc_exceptional, 0)
-/* SSA PHI operator. PHI_RESULT is the new SSA_NAME node created by
- the PHI node. PHI_ARG_LENGTH is the number of arguments.
- PHI_ARG_ELT returns the Ith tuple <ssa_name, edge> from the
- argument list. Each tuple contains the incoming reaching
- definition (SSA_NAME node) and the edge via which that definition
- is coming through. */
-DEFTREECODE (PHI_NODE, "phi_node", tcc_exceptional, 0)
-
/* Used to represent a typed exception handler. CATCH_TYPES is the type (or
list of types) handled, and CATCH_BODY is the code for the handler. */
DEFTREECODE (CATCH_EXPR, "catch_expr", tcc_statement, 2)
@@ -985,32 +977,15 @@ DEFTREECODE (TARGET_MEM_REF, "target_mem_ref", tcc_reference, 7)
exposed to TREE_RANGE_CHECK. */
/* OpenMP - #pragma omp parallel [clause1 ... clauseN]
Operand 0: OMP_PARALLEL_BODY: Code to be executed by all threads.
- Operand 1: OMP_PARALLEL_CLAUSES: List of clauses.
- Operand 2: OMP_PARALLEL_FN: FUNCTION_DECL used when outlining the
- body of the parallel region. Only valid after
- pass_lower_omp.
- Operand 3: OMP_PARALLEL_DATA_ARG: Local variable in the parent
- function containing data to be shared with the child
- function. */
+ Operand 1: OMP_PARALLEL_CLAUSES: List of clauses. */
-DEFTREECODE (OMP_PARALLEL, "omp_parallel", tcc_statement, 4)
+DEFTREECODE (OMP_PARALLEL, "omp_parallel", tcc_statement, 2)
/* OpenMP - #pragma omp task [clause1 ... clauseN]
Operand 0: OMP_TASK_BODY: Code to be executed by all threads.
- Operand 1: OMP_TASK_CLAUSES: List of clauses.
- Operand 2: OMP_TASK_FN: FUNCTION_DECL used when outlining the
- body of the task region. Only valid after
- pass_lower_omp.
- Operand 3: OMP_TASK_DATA_ARG: Local variable in the parent
- function containing data to be shared with the child
- function.
- Operand 4: OMP_TASK_COPYFN: FUNCTION_DECL used for constructing
- firstprivate variables.
- Operand 5: OMP_TASK_ARG_SIZE: Length of the task argument block.
- Operand 6: OMP_TASK_ARG_ALIGN: Required alignment of the task
- argument block. */
-
-DEFTREECODE (OMP_TASK, "omp_task", tcc_statement, 7)
+ Operand 1: OMP_TASK_CLAUSES: List of clauses. */
+
+DEFTREECODE (OMP_TASK, "omp_task", tcc_statement, 2)
/* OpenMP - #pragma omp for [clause1 ... clauseN]
Operand 0: OMP_FOR_BODY: Loop body.
@@ -1026,7 +1001,7 @@ DEFTREECODE (OMP_TASK, "omp_task", tcc_statement, 7)
OMP_FOR structured block, but are evaluated before the loop
body begins.
- VAR must be a signed integer variable, which is implicitly thread
+ VAR must be an integer or pointer variable, which is implicitly thread
private. N1, N2 and INCR are required to be loop invariant integer
expressions that are evaluated without any synchronization.
The evaluation order, frequency of evaluation and side-effects are
@@ -1035,14 +1010,8 @@ DEFTREECODE (OMP_FOR, "omp_for", tcc_statement, 6)
/* OpenMP - #pragma omp sections [clause1 ... clauseN]
Operand 0: OMP_SECTIONS_BODY: Sections body.
- Operand 1: OMP_SECTIONS_CLAUSES: List of clauses.
- Operand 2: OMP_SECTIONS_CONTROL: The control variable used for deciding
- which of the sections to execute. */
-DEFTREECODE (OMP_SECTIONS, "omp_sections", tcc_statement, 3)
-
-/* This tree immediately follows OMP_SECTIONS, and represents the switch
- used to decide which branch is taken. */
-DEFTREECODE (OMP_SECTIONS_SWITCH, "omp_sections_switch", tcc_statement, 0)
+ Operand 1: OMP_SECTIONS_CLAUSES: List of clauses. */
+DEFTREECODE (OMP_SECTIONS, "omp_sections", tcc_statement, 2)
/* OpenMP - #pragma omp single
Operand 0: OMP_SINGLE_BODY: Single section body.
@@ -1066,14 +1035,6 @@ DEFTREECODE (OMP_ORDERED, "omp_ordered", tcc_statement, 1)
Operand 1: OMP_CRITICAL_NAME: Identifier for critical section. */
DEFTREECODE (OMP_CRITICAL, "omp_critical", tcc_statement, 2)
-/* Return from an OpenMP directive. */
-DEFTREECODE (OMP_RETURN, "omp_return", tcc_statement, 0)
-
-/* OpenMP - An intermediate tree code to mark the location of the
- loop or sections iteration in the partially lowered code.
- The arguments are definition and use of the control variable. */
-DEFTREECODE (OMP_CONTINUE, "omp_continue", tcc_statement, 2)
-
/* OpenMP - #pragma omp atomic
Operand 0: The address at which the atomic operation is to be performed.
This address should be stabilized with save_expr.
@@ -1082,18 +1043,6 @@ DEFTREECODE (OMP_CONTINUE, "omp_continue", tcc_statement, 2)
build_fold_indirect_ref of the address. */
DEFTREECODE (OMP_ATOMIC, "omp_atomic", tcc_statement, 2)
-/* Codes used for lowering of OMP_ATOMIC. Although the form of the OMP_ATOMIC
- statement is very simple (just in form mem op= expr), various implicit
- conversions may cause the expression become more complex, so that it does
- not fit the gimple grammar very well. To overcome this problem, OMP_ATOMIC
- is rewritten as a sequence of two codes in gimplification:
-
- OMP_LOAD (tmp, mem)
- val = some computations involving tmp;
- OMP_STORE (val) */
-DEFTREECODE (OMP_ATOMIC_LOAD, "omp_atomic_load", tcc_statement, 2)
-DEFTREECODE (OMP_ATOMIC_STORE, "omp_atomic_store", tcc_statement, 1)
-
/* OpenMP clauses. */
DEFTREECODE (OMP_CLAUSE, "omp_clause", tcc_exceptional, 0)
@@ -1140,11 +1089,6 @@ DEFTREECODE (WIDEN_MULT_EXPR, "widen_mult_expr", tcc_binary, 2)
DEFTREECODE (VEC_LSHIFT_EXPR, "vec_lshift_expr", tcc_binary, 2)
DEFTREECODE (VEC_RSHIFT_EXPR, "vec_rshift_expr", tcc_binary, 2)
-/* GIMPLE tree codes. */
-
-/* Assignment expression. Operand 0 is the what to set; 1, the new value. */
-DEFTREECODE (GIMPLE_MODIFY_STMT, "gimple_modify_stmt", tcc_gimple_stmt, 2)
-
/* Widening vector multiplication.
The two operands are vectors with N elements of size S. Multiplying the
elements of the two vectors will result in N products of size 2*S.
@@ -1194,6 +1138,13 @@ DEFTREECODE (VEC_INTERLEAVE_LOW_EXPR, "vec_interleavelow_expr", tcc_binary, 2)
all conditional branches leading to execution paths executing the
PREDICT_EXPR will get predicted by the specified predictor. */
DEFTREECODE (PREDICT_EXPR, "predict_expr", tcc_unary, 1)
+
+/* OPTIMIZATION_NODE. Node to store the optimization options. */
+DEFTREECODE (OPTIMIZATION_NODE, "optimization_node", tcc_exceptional, 0)
+
+/* TARGET_OPTION_NODE. Node to store the target specific options. */
+DEFTREECODE (TARGET_OPTION_NODE, "target_option_node", tcc_exceptional, 0)
+
/*
Local variables:
mode:c
diff --git a/gcc/tree.h b/gcc/tree.h
index 103f802c806..3f8065da736 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -29,6 +29,7 @@ along with GCC; see the file COPYING3. If not see
#include "vec.h"
#include "double-int.h"
#include "alias.h"
+#include "options.h"
/* Codes of tree nodes */
@@ -68,8 +69,7 @@ enum tree_code_class {
but usually no interesting value. */
tcc_vl_exp, /* A function call or other expression with a
variable-length operand vector. */
- tcc_expression, /* Any other expression. */
- tcc_gimple_stmt /* A GIMPLE statement. */
+ tcc_expression /* Any other expression. */
};
/* Each tree code class has an associated string representation.
@@ -173,32 +173,10 @@ extern const enum tree_code_class tree_code_type[];
#define IS_EXPR_CODE_CLASS(CLASS)\
((CLASS) >= tcc_reference && (CLASS) <= tcc_expression)
-/* Returns nonzero iff CLASS is a GIMPLE statement. */
-
-#define IS_GIMPLE_STMT_CODE_CLASS(CLASS) ((CLASS) == tcc_gimple_stmt)
-
/* Returns nonzero iff NODE is an expression of some kind. */
#define EXPR_P(NODE) IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (NODE)))
-/* Returns nonzero iff NODE is an OpenMP directive. */
-
-#define OMP_DIRECTIVE_P(NODE) \
- (TREE_CODE (NODE) == OMP_PARALLEL \
- || TREE_CODE (NODE) == OMP_TASK \
- || TREE_CODE (NODE) == OMP_FOR \
- || TREE_CODE (NODE) == OMP_SECTIONS \
- || TREE_CODE (NODE) == OMP_SECTIONS_SWITCH \
- || TREE_CODE (NODE) == OMP_SINGLE \
- || TREE_CODE (NODE) == OMP_SECTION \
- || TREE_CODE (NODE) == OMP_MASTER \
- || TREE_CODE (NODE) == OMP_ORDERED \
- || TREE_CODE (NODE) == OMP_CRITICAL \
- || TREE_CODE (NODE) == OMP_RETURN \
- || TREE_CODE (NODE) == OMP_ATOMIC_LOAD \
- || TREE_CODE (NODE) == OMP_ATOMIC_STORE \
- || TREE_CODE (NODE) == OMP_CONTINUE)
-
/* Number of argument-words in each kind of tree-node. */
extern const unsigned char tree_code_length[];
@@ -406,8 +384,6 @@ struct tree_base GTY(())
unsigned spare : 23;
- /* FIXME tuples: Eventually, we need to move this somewhere external to
- the trees. */
union tree_ann_d *ann;
};
@@ -418,16 +394,6 @@ struct tree_common GTY(())
tree type;
};
-/* GIMPLE_MODIFY_STMT */
-struct gimple_stmt GTY(())
-{
- struct tree_base base;
- location_t locus;
- tree block;
- /* FIXME tuples: Eventually this should be of type ``struct gimple_expr''. */
- tree GTY ((length ("TREE_CODE_LENGTH (TREE_CODE (&%h))"))) operands[1];
-};
-
/* The following table lists the uses of each of the above flags and
for which types of nodes they are defined.
@@ -476,7 +442,7 @@ struct gimple_stmt GTY(())
POINTER_TYPE, REFERENCE_TYPE
MOVE_NONTEMPORAL in
- GIMPLE_MODIFY_STMT
+ MODIFY_EXPR
CASE_HIGH_SEEN in
CASE_LABEL_EXPR
@@ -522,9 +488,6 @@ struct gimple_stmt GTY(())
DECL_BY_REFERENCE in
PARM_DECL, RESULT_DECL
- OMP_RETURN_NOWAIT in
- OMP_RETURN
-
OMP_SECTION_LAST in
OMP_SECTION
@@ -814,14 +777,6 @@ enum tree_node_structure_enum {
__FUNCTION__); \
__t; })
-#define GIMPLE_STMT_CHECK(T) __extension__ \
-({ __typeof (T) const __t = (T); \
- char const __c = TREE_CODE_CLASS (TREE_CODE (__t)); \
- if (!IS_GIMPLE_STMT_CODE_CLASS (__c)) \
- tree_class_check_failed (__t, tcc_gimple_stmt, __FILE__, __LINE__,\
- __FUNCTION__); \
- __t; })
-
/* These checks have to be special cased. */
#define NON_TYPE_CHECK(T) __extension__ \
({ __typeof (T) const __t = (T); \
@@ -841,17 +796,6 @@ enum tree_node_structure_enum {
__FILE__, __LINE__, __FUNCTION__); \
&__t->vec.a[__i]; }))
-#define PHI_NODE_ELT_CHECK(T, I) __extension__ \
-(*({__typeof (T) const __t = (T); \
- const int __i = (I); \
- if (TREE_CODE (__t) != PHI_NODE) \
- tree_check_failed (__t, __FILE__, __LINE__, __FUNCTION__, \
- PHI_NODE, 0); \
- if (__i < 0 || __i >= __t->phi.capacity) \
- phi_node_elt_check_failed (__i, __t->phi.num_args, \
- __FILE__, __LINE__, __FUNCTION__); \
- &__t->phi.a[__i]; }))
-
#define OMP_CLAUSE_ELT_CHECK(T, I) __extension__ \
(*({__typeof (T) const __t = (T); \
const int __i = (I); \
@@ -867,8 +811,6 @@ enum tree_node_structure_enum {
#define TREE_OPERAND_CHECK(T, I) __extension__ \
(*({__typeof (T) const __t = EXPR_CHECK (T); \
const int __i = (I); \
- if (GIMPLE_TUPLE_P (__t)) \
- gcc_unreachable (); \
if (__i < 0 || __i >= TREE_OPERAND_LENGTH (__t)) \
tree_operand_check_failed (__i, __t, \
__FILE__, __LINE__, __FUNCTION__); \
@@ -884,15 +826,6 @@ enum tree_node_structure_enum {
__FILE__, __LINE__, __FUNCTION__); \
&__t->exp.operands[__i]; }))
-/* Special checks for GIMPLE_STMT_OPERANDs. */
-#define GIMPLE_STMT_OPERAND_CHECK(T, I) __extension__ \
-(*({__typeof (T) const __t = GIMPLE_STMT_CHECK (T); \
- const int __i = (I); \
- if (__i < 0 || __i >= TREE_OPERAND_LENGTH (__t)) \
- tree_operand_check_failed (__i, __t, \
- __FILE__, __LINE__, __FUNCTION__); \
- &__t->gstmt.operands[__i]; }))
-
#define TREE_RTL_OPERAND_CHECK(T, CODE, I) __extension__ \
(*(rtx *) \
({__typeof (T) const __t = (T); \
@@ -915,8 +848,6 @@ enum tree_node_structure_enum {
#define TREE_CHAIN(NODE) __extension__ \
(*({__typeof (NODE) const __t = (NODE); \
- if (GIMPLE_TUPLE_P (__t)) \
- gcc_unreachable (); \
&__t->common.chain; }))
/* In all nodes that are expressions, this is the data type of the expression.
@@ -925,8 +856,6 @@ enum tree_node_structure_enum {
In VECTOR_TYPE nodes, this is the type of the elements. */
#define TREE_TYPE(NODE) __extension__ \
(*({__typeof (NODE) const __t = (NODE); \
- if (GIMPLE_TUPLE_P (__t)) \
- gcc_unreachable (); \
&__t->common.type; }))
extern void tree_contains_struct_check_failed (const_tree,
@@ -984,14 +913,11 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int,
#define TREE_CLASS_CHECK(T, CODE) (T)
#define TREE_RANGE_CHECK(T, CODE1, CODE2) (T)
#define EXPR_CHECK(T) (T)
-#define GIMPLE_STMT_CHECK(T) (T)
#define NON_TYPE_CHECK(T) (T)
#define TREE_VEC_ELT_CHECK(T, I) ((T)->vec.a[I])
#define TREE_OPERAND_CHECK(T, I) ((T)->exp.operands[I])
#define TREE_OPERAND_CHECK_CODE(T, CODE, I) ((T)->exp.operands[I])
-#define GIMPLE_STMT_OPERAND_CHECK(T, I) ((T)->gstmt.operands[I])
#define TREE_RTL_OPERAND_CHECK(T, CODE, I) (*(rtx *) &((T)->exp.operands[I]))
-#define PHI_NODE_ELT_CHECK(T, i) ((T)->phi.a[i])
#define OMP_CLAUSE_ELT_CHECK(T, i) ((T)->omp_clause.ops[i])
#define OMP_CLAUSE_RANGE_CHECK(T, CODE1, CODE2) (T)
#define OMP_CLAUSE_SUBCODE_CHECK(T, CODE) (T)
@@ -1027,27 +953,6 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int,
TREE_CHECK5 (T, INTEGER_TYPE, ENUMERAL_TYPE, BOOLEAN_TYPE, REAL_TYPE, \
FIXED_POINT_TYPE)
-/* Nonzero if NODE is a GIMPLE statement. */
-#define GIMPLE_STMT_P(NODE) \
- (TREE_CODE_CLASS (TREE_CODE ((NODE))) == tcc_gimple_stmt)
-
-/* Nonzero if NODE is a GIMPLE tuple. */
-#define GIMPLE_TUPLE_P(NODE) (GIMPLE_STMT_P (NODE) || TREE_CODE (NODE) == PHI_NODE)
-
-/* A GIMPLE tuple that has a ``locus'' field. */
-#define GIMPLE_TUPLE_HAS_LOCUS_P(NODE) GIMPLE_STMT_P ((NODE))
-
-/* Like TREE_OPERAND but works with GIMPLE stmt tuples as well.
-
- If you know the NODE is a GIMPLE statement, use GIMPLE_STMT_OPERAND. If the
- NODE code is unknown at compile time, use this macro. */
-#define GENERIC_TREE_OPERAND(NODE, I) *(generic_tree_operand ((NODE), (I)))
-
-/* Like TREE_TYPE but returns void_type_node for gimple tuples that have
- no type. */
-
-#define GENERIC_TREE_TYPE(NODE) *(generic_tree_type ((NODE)))
-
/* Here is how primitive or already-canonicalized types' hash codes
are made. */
#define TYPE_HASH(TYPE) (TYPE_UID (TYPE))
@@ -1056,16 +961,12 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int,
used in hash tables which are saved to a PCH. */
#define TREE_HASH(NODE) ((size_t) (NODE) & 0777777)
-/* The TREE_CHAIN but it is able to handle tuples. */
-#define GENERIC_NEXT(NODE) \
- (TREE_CODE (NODE) == PHI_NODE ? PHI_CHAIN (NODE) : \
- GIMPLE_STMT_P (NODE) ? NULL_TREE : TREE_CHAIN (NODE))
-
-/* Tests if expression is conversion expr (NOP_EXPRs or CONVERT_EXPRs). */
+/* Tests if CODE is a conversion expr (NOP_EXPR or CONVERT_EXPR). */
+#define IS_CONVERT_EXPR_CODE_P(CODE) \
+ ((CODE) == NOP_EXPR || (CODE) == CONVERT_EXPR)
-#define CONVERT_EXPR_P(EXP) \
- (TREE_CODE (EXP) == NOP_EXPR \
- || TREE_CODE (EXP) == CONVERT_EXPR)
+/* Similarly, but accept an expressions instead of a tree code. */
+#define CONVERT_EXPR_P(EXP) IS_CONVERT_EXPR_CODE_P (TREE_CODE (EXP))
/* Generate case for NOP_EXPR, CONVERT_EXPR. */
@@ -1081,7 +982,7 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int,
|| TREE_CODE (EXP) == NON_LVALUE_EXPR) \
&& TREE_OPERAND (EXP, 0) != error_mark_node \
&& (TYPE_MODE (TREE_TYPE (EXP)) \
- == TYPE_MODE (GENERIC_TREE_TYPE (TREE_OPERAND (EXP, 0))))) \
+ == TYPE_MODE (TREE_TYPE (TREE_OPERAND (EXP, 0))))) \
(EXP) = TREE_OPERAND (EXP, 0)
/* Like STRIP_NOPS, but don't let the signedness change either. */
@@ -1278,7 +1179,7 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int,
/* In a MODIFY_EXPR, means that the store in the expression is nontemporal. */
#define MOVE_NONTEMPORAL(NODE) \
- (GIMPLE_MODIFY_STMT_CHECK (NODE)->base.static_flag)
+ (EXPR_CHECK (NODE)->base.static_flag)
/* In an INTEGER_CST, REAL_CST, COMPLEX_CST, or VECTOR_CST, this means
there was an overflow in folding. */
@@ -1657,28 +1558,25 @@ struct tree_constructor GTY(())
#define VL_EXP_OPERAND_LENGTH(NODE) \
((int)TREE_INT_CST_LOW (VL_EXP_CHECK (NODE)->exp.operands[0]))
-/* In gimple statements. */
-#define GIMPLE_STMT_OPERAND(NODE, I) GIMPLE_STMT_OPERAND_CHECK (NODE, I)
-#define GIMPLE_STMT_LOCUS(NODE) (GIMPLE_STMT_CHECK (NODE)->gstmt.locus)
-#define GIMPLE_STMT_BLOCK(NODE) (GIMPLE_STMT_CHECK (NODE)->gstmt.block)
-
/* In a LOOP_EXPR node. */
#define LOOP_EXPR_BODY(NODE) TREE_OPERAND_CHECK_CODE (NODE, LOOP_EXPR, 0)
/* The source location of this expression. Non-tree_exp nodes such as
decls and constants can be shared among multiple locations, so
return nothing. */
-#define EXPR_LOCATION(NODE) expr_location ((NODE))
-#define SET_EXPR_LOCATION(NODE, FROM) set_expr_location ((NODE), (FROM))
-#define EXPR_HAS_LOCATION(NODE) expr_has_location ((NODE))
-#define EXPR_LOCUS(NODE) expr_locus ((NODE))
+#define EXPR_LOCATION(NODE) (EXPR_P ((NODE)) ? (NODE)->exp.locus : UNKNOWN_LOCATION)
+#define SET_EXPR_LOCATION(NODE, LOCUS) EXPR_CHECK ((NODE))->exp.locus = (LOCUS)
+#define EXPR_HAS_LOCATION(NODE) (EXPR_LOCATION (NODE) != UNKNOWN_LOCATION)
+#define EXPR_LOCUS(NODE) (EXPR_P (NODE) \
+ ? CONST_CAST (source_location *, &(NODE)->exp.locus) \
+ : (source_location *) NULL)
#define SET_EXPR_LOCUS(NODE, FROM) set_expr_locus ((NODE), (FROM))
-#define EXPR_FILENAME(NODE) (expr_filename ((NODE)))
-#define EXPR_LINENO(NODE) (expr_lineno ((NODE)))
+#define EXPR_FILENAME(NODE) LOCATION_FILE (EXPR_CHECK ((NODE))->exp.locus)
+#define EXPR_LINENO(NODE) LOCATION_LINE (EXPR_CHECK (NODE)->exp.locus)
/* True if a tree is an expression or statement that can have a
location. */
-#define CAN_HAVE_LOCATION_P(NODE) (EXPR_P (NODE) || GIMPLE_STMT_P (NODE))
+#define CAN_HAVE_LOCATION_P(NODE) (EXPR_P (NODE))
/* In a TARGET_EXPR node. */
#define TARGET_EXPR_SLOT(NODE) TREE_OPERAND_CHECK_CODE (NODE, TARGET_EXPR, 0)
@@ -1804,22 +1702,13 @@ struct tree_constructor GTY(())
#define OMP_PARALLEL_BODY(NODE) TREE_OPERAND (OMP_PARALLEL_CHECK (NODE), 0)
#define OMP_PARALLEL_CLAUSES(NODE) TREE_OPERAND (OMP_PARALLEL_CHECK (NODE), 1)
-#define OMP_PARALLEL_FN(NODE) TREE_OPERAND (OMP_PARALLEL_CHECK (NODE), 2)
-#define OMP_PARALLEL_DATA_ARG(NODE) TREE_OPERAND (OMP_PARALLEL_CHECK (NODE), 3)
#define OMP_TASK_BODY(NODE) TREE_OPERAND (OMP_TASK_CHECK (NODE), 0)
#define OMP_TASK_CLAUSES(NODE) TREE_OPERAND (OMP_TASK_CHECK (NODE), 1)
-#define OMP_TASK_FN(NODE) TREE_OPERAND (OMP_TASK_CHECK (NODE), 2)
-#define OMP_TASK_DATA_ARG(NODE) TREE_OPERAND (OMP_TASK_CHECK (NODE), 3)
-#define OMP_TASK_COPYFN(NODE) TREE_OPERAND (OMP_TASK_CHECK (NODE), 4)
-#define OMP_TASK_ARG_SIZE(NODE) TREE_OPERAND (OMP_TASK_CHECK (NODE), 5)
-#define OMP_TASK_ARG_ALIGN(NODE) TREE_OPERAND (OMP_TASK_CHECK (NODE), 6)
#define OMP_TASKREG_CHECK(NODE) TREE_RANGE_CHECK (NODE, OMP_PARALLEL, OMP_TASK)
#define OMP_TASKREG_BODY(NODE) TREE_OPERAND (OMP_TASKREG_CHECK (NODE), 0)
#define OMP_TASKREG_CLAUSES(NODE) TREE_OPERAND (OMP_TASKREG_CHECK (NODE), 1)
-#define OMP_TASKREG_FN(NODE) TREE_OPERAND (OMP_TASKREG_CHECK (NODE), 2)
-#define OMP_TASKREG_DATA_ARG(NODE) TREE_OPERAND (OMP_TASKREG_CHECK (NODE), 3)
#define OMP_FOR_BODY(NODE) TREE_OPERAND (OMP_FOR_CHECK (NODE), 0)
#define OMP_FOR_CLAUSES(NODE) TREE_OPERAND (OMP_FOR_CHECK (NODE), 1)
@@ -1830,7 +1719,6 @@ struct tree_constructor GTY(())
#define OMP_SECTIONS_BODY(NODE) TREE_OPERAND (OMP_SECTIONS_CHECK (NODE), 0)
#define OMP_SECTIONS_CLAUSES(NODE) TREE_OPERAND (OMP_SECTIONS_CHECK (NODE), 1)
-#define OMP_SECTIONS_CONTROL(NODE) TREE_OPERAND (OMP_SECTIONS_CHECK (NODE), 2)
#define OMP_SECTION_BODY(NODE) TREE_OPERAND (OMP_SECTION_CHECK (NODE), 0)
@@ -1855,13 +1743,6 @@ struct tree_constructor GTY(())
#define OMP_SECTION_LAST(NODE) \
(OMP_SECTION_CHECK (NODE)->base.private_flag)
-/* True on an OMP_RETURN statement if the return does not require a
- thread synchronization via some sort of barrier. The exact barrier
- that would otherwise be emitted is dependent on the OMP statement
- with which this return is associated. */
-#define OMP_RETURN_NOWAIT(NODE) \
- (OMP_RETURN_CHECK (NODE)->base.private_flag)
-
/* True on an OMP_PARALLEL statement if it represents an explicit
combined parallel work-sharing constructs. */
#define OMP_PARALLEL_COMBINED(NODE) \
@@ -1886,6 +1767,8 @@ struct tree_constructor GTY(())
OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, \
OMP_CLAUSE_LASTPRIVATE),\
1)
+#define OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ(NODE) \
+ (OMP_CLAUSE_CHECK (NODE))->omp_clause.gimple_reduction_init
#define OMP_CLAUSE_IF_EXPR(NODE) \
OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_IF), 0)
@@ -1907,6 +1790,10 @@ struct tree_constructor GTY(())
OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_REDUCTION), 1)
#define OMP_CLAUSE_REDUCTION_MERGE(NODE) \
OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_REDUCTION), 2)
+#define OMP_CLAUSE_REDUCTION_GIMPLE_INIT(NODE) \
+ (OMP_CLAUSE_CHECK (NODE))->omp_clause.gimple_reduction_init
+#define OMP_CLAUSE_REDUCTION_GIMPLE_MERGE(NODE) \
+ (OMP_CLAUSE_CHECK (NODE))->omp_clause.gimple_reduction_merge
#define OMP_CLAUSE_REDUCTION_PLACEHOLDER(NODE) \
OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_REDUCTION), 3)
@@ -1950,10 +1837,8 @@ struct tree_exp GTY(())
only field that can be relied upon. */
#define SSA_NAME_VAR(NODE) SSA_NAME_CHECK (NODE)->ssa_name.var
-/* Returns the statement which defines this reference. Note that
- we use the same field when chaining SSA_NAME nodes together on
- the SSA_NAME freelist. */
-#define SSA_NAME_DEF_STMT(NODE) SSA_NAME_CHECK (NODE)->common.chain
+/* Returns the statement which defines this SSA name. */
+#define SSA_NAME_DEF_STMT(NODE) SSA_NAME_CHECK (NODE)->ssa_name.def_stmt
/* Returns the SSA version number of this SSA name. Note that in
tree SSA, version numbers are not per variable and may be recycled. */
@@ -1999,7 +1884,12 @@ typedef struct ssa_use_operand_d GTY(())
{
struct ssa_use_operand_d* GTY((skip(""))) prev;
struct ssa_use_operand_d* GTY((skip(""))) next;
- tree GTY((skip(""))) stmt;
+ /* Immediate uses for a given SSA name are maintained as a cyclic
+ list. To recognize the root of this list, the location field
+ needs to point to the original SSA name. Since statements and
+ SSA names are of different data types, we need this union. See
+ the explanation in struct immediate_use_iterator_d. */
+ union { gimple stmt; tree ssa_name; } GTY((skip(""))) loc;
tree *GTY((skip(""))) use;
} ssa_use_operand_t;
@@ -2013,6 +1903,9 @@ struct tree_ssa_name GTY(())
/* _DECL wrapped by this SSA name. */
tree var;
+ /* Statement that defines this SSA name. */
+ gimple def_stmt;
+
/* SSA version number. */
unsigned int version;
@@ -2030,29 +1923,6 @@ struct tree_ssa_name GTY(())
struct ssa_use_operand_d imm_uses;
};
-/* In a PHI_NODE node. */
-
-/* These 2 macros should be considered off limits for use by developers. If
- you wish to access the use or def fields of a PHI_NODE in the SSA
- optimizers, use the accessor macros found in tree-ssa-operands.h.
- These two macros are to be used only by those accessor macros, and other
- select places where we *absolutely* must take the address of the tree. */
-
-#define PHI_RESULT_TREE(NODE) PHI_NODE_CHECK (NODE)->phi.result
-#define PHI_ARG_DEF_TREE(NODE, I) PHI_NODE_ELT_CHECK (NODE, I).def
-
-/* PHI_NODEs for each basic block are chained together in a single linked
- list. The head of the list is linked from the block annotation, and
- the link to the next PHI is in PHI_CHAIN. */
-#define PHI_CHAIN(NODE) PHI_NODE_CHECK (NODE)->phi.chain
-
-#define PHI_NUM_ARGS(NODE) PHI_NODE_CHECK (NODE)->phi.num_args
-#define PHI_ARG_CAPACITY(NODE) PHI_NODE_CHECK (NODE)->phi.capacity
-#define PHI_ARG_ELT(NODE, I) PHI_NODE_ELT_CHECK (NODE, I)
-#define PHI_ARG_EDGE(NODE, I) (EDGE_PRED (PHI_BB ((NODE)), (I)))
-#define PHI_BB(NODE) PHI_NODE_CHECK (NODE)->phi.bb
-#define PHI_ARG_IMM_USE_NODE(NODE, I) PHI_NODE_ELT_CHECK (NODE, I).imm_use
-
struct phi_arg_d GTY(())
{
/* imm_use MUST be the first element in struct because we do some
@@ -2061,22 +1931,6 @@ struct phi_arg_d GTY(())
tree def;
};
-struct tree_phi_node GTY(())
-{
- struct tree_base common;
- tree chain;
- tree result;
- int num_args;
- int capacity;
-
- /* Basic block holding this PHI node. */
- struct basic_block_def *bb;
-
- /* Arguments of the PHI node. These are maintained in the same
- order as predecessor edge vector BB->PREDS. */
- struct phi_arg_d GTY ((length ("((tree)&%h)->phi.num_args"))) a[1];
-};
-
#define OMP_CLAUSE_CODE(NODE) \
(OMP_CLAUSE_CHECK (NODE))->omp_clause.code
@@ -2099,6 +1953,12 @@ struct tree_omp_clause GTY(())
enum omp_clause_schedule_kind schedule_kind;
enum tree_code reduction_code;
} GTY ((skip)) subcode;
+
+ /* The gimplification of OMP_CLAUSE_REDUCTION_{INIT,MERGE} for omp-low's
+ usage. */
+ gimple_seq gimple_reduction_init;
+ gimple_seq gimple_reduction_merge;
+
tree GTY ((length ("omp_clause_num_ops[OMP_CLAUSE_CODE ((tree)&%h)]"))) ops[1];
};
@@ -3051,7 +2911,7 @@ struct tree_parm_decl GTY(())
/* Nonzero for a given ..._DECL node means that no warnings should be
generated just because this node is unused. */
#define DECL_IN_SYSTEM_HEADER(NODE) \
- (DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.in_system_header_flag)
+ (in_system_header_at (DECL_SOURCE_LOCATION (NODE)))
/* Used to indicate that this DECL has weak linkage. */
#define DECL_WEAK(NODE) (DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.weak_flag)
@@ -3179,7 +3039,6 @@ struct tree_decl_with_vis GTY(())
unsigned shadowed_for_var_p : 1;
/* Don't belong to VAR_DECL exclusively. */
- unsigned in_system_header_flag : 1;
unsigned weak_flag:1;
unsigned seen_in_bind_expr : 1;
unsigned comdat_flag : 1;
@@ -3191,7 +3050,7 @@ struct tree_decl_with_vis GTY(())
/* Belongs to VAR_DECL exclusively. */
ENUM_BITFIELD(tls_model) tls_model : 3;
- /* 11 unused bits. */
+ /* 12 unused bits. */
};
/* In a VAR_DECL that's static,
@@ -3409,6 +3268,16 @@ struct tree_decl_non_common GTY(())
#define DECL_ARGUMENTS(NODE) (FUNCTION_DECL_CHECK (NODE)->decl_non_common.arguments)
#define DECL_ARGUMENT_FLD(NODE) (DECL_NON_COMMON_CHECK (NODE)->decl_non_common.arguments)
+/* In FUNCTION_DECL, the function specific target options to use when compiling
+ this function. */
+#define DECL_FUNCTION_SPECIFIC_TARGET(NODE) \
+ (FUNCTION_DECL_CHECK (NODE)->function_decl.function_specific_target)
+
+/* In FUNCTION_DECL, the function specific optimization options to use when
+ compiling this function. */
+#define DECL_FUNCTION_SPECIFIC_OPTIMIZATION(NODE) \
+ (FUNCTION_DECL_CHECK (NODE)->function_decl.function_specific_optimization)
+
/* FUNCTION_DECL inherits from DECL_NON_COMMON because of the use of the
arguments/result/saved_tree fields by front ends. It was either inherit
FUNCTION_DECL from non_common, or inherit non_common from FUNCTION_DECL,
@@ -3420,6 +3289,10 @@ struct tree_function_decl GTY(())
struct function *f;
+ /* Function specific options that are used by this function. */
+ tree function_specific_target; /* target options */
+ tree function_specific_optimization; /* optimization options */
+
/* In a FUNCTION_DECL for which DECL_BUILT_IN holds, this is
DECL_FUNCTION_CODE. Otherwise unused.
??? The bitfield needs to be able to hold all target function
@@ -3492,6 +3365,39 @@ struct tree_statement_list
struct tree_statement_list_node *tail;
};
+
+/* Optimization options used by a function. */
+
+struct tree_optimization_option GTY(())
+{
+ struct tree_common common;
+
+ /* The optimization options used by the user. */
+ struct cl_optimization opts;
+};
+
+#define TREE_OPTIMIZATION(NODE) \
+ (&OPTIMIZATION_NODE_CHECK (NODE)->optimization.opts)
+
+/* Return a tree node that encapsulates the current optimization options. */
+extern tree build_optimization_node (void);
+
+/* Target options used by a function. */
+
+struct tree_target_option GTY(())
+{
+ struct tree_common common;
+
+ /* The optimization options used by the user. */
+ struct cl_target_option opts;
+};
+
+#define TREE_TARGET_OPTION(NODE) \
+ (&TARGET_OPTION_NODE_CHECK (NODE)->target_option.opts)
+
+/* Return a tree node that encapsulates the current target options. */
+extern tree build_target_option_node (void);
+
/* Define the overall contents of a tree node.
It may be any of the structures declared above
@@ -3527,15 +3433,15 @@ union tree_node GTY ((ptr_alias (union lang_tree_node),
struct tree_vec GTY ((tag ("TS_VEC"))) vec;
struct tree_exp GTY ((tag ("TS_EXP"))) exp;
struct tree_ssa_name GTY ((tag ("TS_SSA_NAME"))) ssa_name;
- struct tree_phi_node GTY ((tag ("TS_PHI_NODE"))) phi;
struct tree_block GTY ((tag ("TS_BLOCK"))) block;
struct tree_binfo GTY ((tag ("TS_BINFO"))) binfo;
struct tree_statement_list GTY ((tag ("TS_STATEMENT_LIST"))) stmt_list;
- struct gimple_stmt GTY ((tag ("TS_GIMPLE_STATEMENT"))) gstmt;
struct tree_constructor GTY ((tag ("TS_CONSTRUCTOR"))) constructor;
struct tree_memory_tag GTY ((tag ("TS_MEMORY_TAG"))) mtag;
struct tree_omp_clause GTY ((tag ("TS_OMP_CLAUSE"))) omp_clause;
struct tree_memory_partition_tag GTY ((tag ("TS_MEMORY_PARTITION_TAG"))) mpt;
+ struct tree_optimization_option GTY ((tag ("TS_OPTIMIZATION"))) optimization;
+ struct tree_target_option GTY ((tag ("TS_TARGET_OPTION"))) target_option;
};
/* Standard named or nameless data types of the C compiler. */
@@ -3683,6 +3589,15 @@ enum tree_index
TI_SAT_UDA_TYPE,
TI_SAT_UTA_TYPE,
+ TI_OPTIMIZATION_DEFAULT,
+ TI_OPTIMIZATION_CURRENT,
+ TI_OPTIMIZATION_COLD,
+ TI_OPTIMIZATION_HOT,
+ TI_TARGET_OPTION_DEFAULT,
+ TI_TARGET_OPTION_CURRENT,
+ TI_CURRENT_OPTION_PRAGMA,
+ TI_CURRENT_OPTIMIZE_PRAGMA,
+
TI_MAX
};
@@ -3850,6 +3765,22 @@ extern GTY(()) tree global_trees[TI_MAX];
#define main_identifier_node global_trees[TI_MAIN_IDENTIFIER]
#define MAIN_NAME_P(NODE) (IDENTIFIER_NODE_CHECK (NODE) == main_identifier_node)
+/* Optimization options (OPTIMIZATION_NODE) to use for default, current, cold,
+ and hot functions. */
+#define optimization_default_node global_trees[TI_OPTIMIZATION_DEFAULT]
+#define optimization_current_node global_trees[TI_OPTIMIZATION_CURRENT]
+#define optimization_cold_node global_trees[TI_OPTIMIZATION_COLD]
+#define optimization_hot_node global_trees[TI_OPTIMIZATION_HOT]
+
+/* Default/current target options (TARGET_OPTION_NODE). */
+#define target_option_default_node global_trees[TI_TARGET_OPTION_DEFAULT]
+#define target_option_current_node global_trees[TI_TARGET_OPTION_CURRENT]
+
+/* Default tree list option(), optimize() pragmas to be linked into the
+ attribute list. */
+#define current_option_pragma global_trees[TI_CURRENT_OPTION_PRAGMA]
+#define current_optimize_pragma global_trees[TI_CURRENT_OPTIMIZE_PRAGMA]
+
/* An enumeration of the standard C integer types. These must be
ordered so that shorter types appear before longer ones, and so
that signed types appear before unsigned ones, for the correct
@@ -3932,8 +3863,8 @@ extern hashval_t decl_assembler_name_hash (const_tree asmname);
extern size_t tree_size (const_tree);
/* Compute the number of bytes occupied by a tree with code CODE. This
- function cannot be used for TREE_VEC or PHI_NODE codes, which are of
- variable length. */
+ function cannot be used for TREE_VEC codes, which are of variable
+ length. */
extern size_t tree_code_size (enum tree_code);
/* Lowest level primitive for allocating a node.
@@ -4009,10 +3940,6 @@ extern tree build7_stat (enum tree_code, tree, tree, tree, tree, tree,
#define build7(c,t1,t2,t3,t4,t5,t6,t7,t8) \
build7_stat (c,t1,t2,t3,t4,t5,t6,t7,t8 MEM_STAT_INFO)
-extern tree build_gimple_modify_stmt_stat (tree, tree MEM_STAT_DECL);
-#define build_gimple_modify_stmt(t1,t2) \
- build_gimple_modify_stmt_stat (t1,t2 MEM_STAT_INFO)
-
extern tree build_int_cst (tree, HOST_WIDE_INT);
extern tree build_int_cst_type (tree, HOST_WIDE_INT);
extern tree build_int_cstu (tree, unsigned HOST_WIDE_INT);
@@ -4747,15 +4674,19 @@ extern bool commutative_tree_code (enum tree_code);
extern tree upper_bound_in_type (tree, tree);
extern tree lower_bound_in_type (tree, tree);
extern int operand_equal_for_phi_arg_p (const_tree, const_tree);
-extern bool empty_body_p (tree);
extern tree call_expr_arg (tree, int);
extern tree *call_expr_argp (tree, int);
extern tree call_expr_arglist (tree);
+extern tree create_artificial_label (void);
+extern const char *get_name (tree);
extern bool stdarg_p (tree);
extern bool prototype_p (tree);
extern int function_args_count (tree);
extern bool auto_var_in_fn_p (const_tree, const_tree);
+/* In gimplify.c */
+extern tree unshare_expr (tree);
+
/* In stmt.c */
extern void expand_expr_stmt (tree);
@@ -4809,10 +4740,12 @@ extern tree fold_ignored_result (tree);
extern tree fold_abs_const (tree, tree);
extern tree fold_indirect_ref_1 (tree, tree);
extern void fold_defer_overflow_warnings (void);
-extern void fold_undefer_overflow_warnings (bool, const_tree, int);
+extern void fold_undefer_overflow_warnings (bool, const_gimple, int);
extern void fold_undefer_and_ignore_overflow_warnings (void);
extern bool fold_deferring_overflow_warnings_p (void);
extern tree maybe_fold_offset_to_reference (tree, tree, tree);
+extern tree maybe_fold_offset_to_address (tree, tree, tree);
+extern tree maybe_fold_stmt_addition (tree, tree, tree);
extern tree force_fit_type_double (tree, unsigned HOST_WIDE_INT, HOST_WIDE_INT,
int, bool);
@@ -4878,7 +4811,6 @@ extern tree constant_boolean_node (int, tree);
extern tree build_low_bits_mask (tree, unsigned);
extern bool tree_swap_operands_p (const_tree, const_tree, bool);
-extern void swap_tree_operands (tree, tree *, tree *);
extern enum tree_code swap_tree_comparison (enum tree_code);
extern bool ptr_difference_const (tree, tree, HOST_WIDE_INT *);
@@ -4895,8 +4827,7 @@ extern bool tree_binary_nonnegative_warnv_p (enum tree_code, tree, tree, tree,
bool *);
extern bool tree_single_nonnegative_warnv_p (tree t, bool *strict_overflow_p);
extern bool tree_invalid_nonnegative_warnv_p (tree t, bool *strict_overflow_p);
-extern bool tree_call_nonnegative_warnv_p (enum tree_code code, tree, tree,
- tree, tree, bool *);
+extern bool tree_call_nonnegative_warnv_p (tree, tree, tree, tree, bool *);
extern bool tree_expr_nonzero_warnv_p (tree, bool *);
@@ -4922,12 +4853,14 @@ extern tree build_call_expr (tree, int, ...);
extern tree mathfn_built_in (tree, enum built_in_function fn);
extern tree strip_float_extensions (tree);
extern tree c_strlen (tree, int);
-extern tree std_gimplify_va_arg_expr (tree, tree, tree *, tree *);
+extern tree std_gimplify_va_arg_expr (tree, tree, gimple_seq *, gimple_seq *);
extern tree build_va_arg_indirect_ref (tree);
extern tree build_string_literal (int, const char *);
extern bool validate_arglist (const_tree, ...);
extern rtx builtin_memset_read_str (void *, HOST_WIDE_INT, enum machine_mode);
extern int get_pointer_alignment (tree, unsigned int);
+extern tree fold_call_stmt (gimple, bool);
+extern tree gimple_fold_builtin_snprintf_chk (gimple, tree, enum built_in_function);
/* In convert.c */
extern tree strip_float_extensions (tree);
@@ -4944,6 +4877,8 @@ extern int tree_log2 (const_tree);
extern int tree_floor_log2 (const_tree);
extern int simple_cst_equal (const_tree, const_tree);
extern hashval_t iterative_hash_expr (const_tree, hashval_t);
+extern hashval_t iterative_hash_exprs_commutative (const_tree,
+ const_tree, hashval_t);
extern hashval_t iterative_hash_hashval_t (hashval_t, hashval_t);
extern int compare_tree_int (const_tree, unsigned HOST_WIDE_INT);
extern int type_list_equal (const_tree, const_tree);
@@ -4975,18 +4910,9 @@ extern tree build_addr (tree, tree);
extern bool fields_compatible_p (const_tree, const_tree);
extern tree find_compatible_field (tree, tree);
-extern location_t expr_location (const_tree);
-extern void set_expr_location (tree, location_t);
-extern bool expr_has_location (const_tree);
-
-extern location_t *expr_locus (const_tree);
extern void set_expr_locus (tree, source_location *);
-extern const char *expr_filename (const_tree);
-extern int expr_lineno (const_tree);
extern tree *tree_block (tree);
-extern tree *generic_tree_operand (tree, int);
-extern tree *generic_tree_type (tree);
extern location_t *block_nonartificial_location (tree);
/* In function.c */
@@ -5007,7 +4933,7 @@ extern void preserve_temp_slots (rtx);
extern int aggregate_value_p (const_tree, const_tree);
extern void push_function_context (void);
extern void pop_function_context (void);
-extern tree gimplify_parameters (void);
+extern gimple_seq gimplify_parameters (void);
/* In print-rtl.c */
#ifdef BUFSIZ
@@ -5065,6 +4991,7 @@ extern int flags_from_decl_or_type (const_tree);
extern int call_expr_flags (const_tree);
extern int setjmp_call_p (const_tree);
+extern bool gimple_alloca_call_p (const_gimple);
extern bool alloca_call_p (const_tree);
extern bool must_pass_in_stack_var_size (enum machine_mode, const_tree);
extern bool must_pass_in_stack_var_size_or_pad (enum machine_mode, const_tree);
@@ -5123,12 +5050,6 @@ extern void expand_anon_union_decl (tree, tree, tree);
extern tree tree_overlaps_hard_reg_set (tree, HARD_REG_SET *);
#endif
-/* In gimplify.c. */
-extern tree create_artificial_label (void);
-extern void gimplify_function_tree (tree);
-extern const char *get_name (const_tree);
-extern tree unshare_expr (tree);
-extern void sort_case_labels (tree);
/* Interface of the DWARF2 unwind info support. */
@@ -5210,14 +5131,12 @@ typedef enum
temp_list_kind,
vec_kind,
binfo_kind,
- phi_kind,
ssa_name_kind,
constr_kind,
x_kind,
lang_decl,
lang_type,
omp_clause_kind,
- gimple_stmt_kind,
all_kinds
} tree_node_kind;
diff --git a/gcc/treestruct.def b/gcc/treestruct.def
index cdf52704ebd..0f3dbbdfb2a 100644
--- a/gcc/treestruct.def
+++ b/gcc/treestruct.def
@@ -63,3 +63,6 @@ DEFTREESTRUCT(TS_CONSTRUCTOR, "constructor")
DEFTREESTRUCT(TS_MEMORY_TAG, "memory tag")
DEFTREESTRUCT(TS_OMP_CLAUSE, "omp clause")
DEFTREESTRUCT(TS_MEMORY_PARTITION_TAG, "memory partition tag")
+DEFTREESTRUCT(TS_OPTIMIZATION, "optimization options")
+DEFTREESTRUCT(TS_TARGET_OPTION, "target options")
+
diff --git a/gcc/value-prof.c b/gcc/value-prof.c
index a16e7d48378..7f776ccaf89 100644
--- a/gcc/value-prof.c
+++ b/gcc/value-prof.c
@@ -78,22 +78,21 @@ static struct value_prof_hooks *value_prof_hooks;
same information as above. */
-static tree tree_divmod_fixed_value (tree, tree, tree, tree,
- tree, int, gcov_type, gcov_type);
-static tree tree_mod_pow2 (tree, tree, tree, tree, int, gcov_type, gcov_type);
-static tree tree_mod_subtract (tree, tree, tree, tree, int, int, int,
- gcov_type, gcov_type, gcov_type);
-static bool tree_divmod_fixed_value_transform (tree);
-static bool tree_mod_pow2_value_transform (tree);
-static bool tree_mod_subtract_transform (tree);
-static bool tree_stringops_transform (block_stmt_iterator *);
-static bool tree_ic_transform (tree);
+static tree gimple_divmod_fixed_value (gimple, tree, int, gcov_type, gcov_type);
+static tree gimple_mod_pow2 (gimple, int, gcov_type, gcov_type);
+static tree gimple_mod_subtract (gimple, int, int, int, gcov_type, gcov_type,
+ gcov_type);
+static bool gimple_divmod_fixed_value_transform (gimple_stmt_iterator *);
+static bool gimple_mod_pow2_value_transform (gimple_stmt_iterator *);
+static bool gimple_mod_subtract_transform (gimple_stmt_iterator *);
+static bool gimple_stringops_transform (gimple_stmt_iterator *);
+static bool gimple_ic_transform (gimple);
/* Allocate histogram value. */
static histogram_value
gimple_alloc_histogram_value (struct function *fun ATTRIBUTE_UNUSED,
- enum hist_type type, tree stmt, tree value)
+ enum hist_type type, gimple stmt, tree value)
{
histogram_value hist = (histogram_value) xcalloc (1, sizeof (*hist));
hist->hvalue.value = value;
@@ -115,13 +114,13 @@ histogram_hash (const void *x)
static int
histogram_eq (const void *x, const void *y)
{
- return ((const_histogram_value) x)->hvalue.stmt == (const_tree)y;
+ return ((const_histogram_value) x)->hvalue.stmt == (const_gimple) y;
}
/* Set histogram for STMT. */
static void
-set_histogram_value (struct function *fun, tree stmt, histogram_value hist)
+set_histogram_value (struct function *fun, gimple stmt, histogram_value hist)
{
void **loc;
if (!hist && !VALUE_HISTOGRAMS (fun))
@@ -144,7 +143,7 @@ set_histogram_value (struct function *fun, tree stmt, histogram_value hist)
/* Get histogram list for STMT. */
histogram_value
-gimple_histogram_value (struct function *fun, tree stmt)
+gimple_histogram_value (struct function *fun, gimple stmt)
{
if (!VALUE_HISTOGRAMS (fun))
return NULL;
@@ -155,16 +154,19 @@ gimple_histogram_value (struct function *fun, tree stmt)
/* Add histogram for STMT. */
void
-gimple_add_histogram_value (struct function *fun, tree stmt, histogram_value hist)
+gimple_add_histogram_value (struct function *fun, gimple stmt,
+ histogram_value hist)
{
hist->hvalue.next = gimple_histogram_value (fun, stmt);
set_histogram_value (fun, stmt, hist);
}
+
/* Remove histogram HIST from STMT's histogram list. */
void
-gimple_remove_histogram_value (struct function *fun, tree stmt, histogram_value hist)
+gimple_remove_histogram_value (struct function *fun, gimple stmt,
+ histogram_value hist)
{
histogram_value hist2 = gimple_histogram_value (fun, stmt);
if (hist == hist2)
@@ -184,13 +186,16 @@ gimple_remove_histogram_value (struct function *fun, tree stmt, histogram_value
free (hist);
}
+
/* Lookup histogram of type TYPE in the STMT. */
histogram_value
-gimple_histogram_value_of_type (struct function *fun, tree stmt, enum hist_type type)
+gimple_histogram_value_of_type (struct function *fun, gimple stmt,
+ enum hist_type type)
{
histogram_value hist;
- for (hist = gimple_histogram_value (fun, stmt); hist; hist = hist->hvalue.next)
+ for (hist = gimple_histogram_value (fun, stmt); hist;
+ hist = hist->hvalue.next)
if (hist->type == type)
return hist;
return NULL;
@@ -302,7 +307,7 @@ dump_histogram_value (FILE *dump_file, histogram_value hist)
/* Dump all histograms attached to STMT to DUMP_FILE. */
void
-dump_histograms_for_stmt (struct function *fun, FILE *dump_file, tree stmt)
+dump_histograms_for_stmt (struct function *fun, FILE *dump_file, gimple stmt)
{
histogram_value hist;
for (hist = gimple_histogram_value (fun, stmt); hist; hist = hist->hvalue.next)
@@ -312,7 +317,7 @@ dump_histograms_for_stmt (struct function *fun, FILE *dump_file, tree stmt)
/* Remove all histograms associated with STMT. */
void
-gimple_remove_stmt_histograms (struct function *fun, tree stmt)
+gimple_remove_stmt_histograms (struct function *fun, gimple stmt)
{
histogram_value val;
while ((val = gimple_histogram_value (fun, stmt)) != NULL)
@@ -322,18 +327,18 @@ gimple_remove_stmt_histograms (struct function *fun, tree stmt)
/* Duplicate all histograms associates with OSTMT to STMT. */
void
-gimple_duplicate_stmt_histograms (struct function *fun, tree stmt,
- struct function *ofun, tree ostmt)
+gimple_duplicate_stmt_histograms (struct function *fun, gimple stmt,
+ struct function *ofun, gimple ostmt)
{
histogram_value val;
for (val = gimple_histogram_value (ofun, ostmt); val != NULL; val = val->hvalue.next)
{
- histogram_value new = gimple_alloc_histogram_value (fun, val->type, NULL, NULL);
- memcpy (new, val, sizeof (*val));
- new->hvalue.stmt = stmt;
- new->hvalue.counters = XNEWVAR (gcov_type, sizeof (*new->hvalue.counters) * new->n_counters);
- memcpy (new->hvalue.counters, val->hvalue.counters, sizeof (*new->hvalue.counters) * new->n_counters);
- gimple_add_histogram_value (fun, stmt, new);
+ histogram_value new_val = gimple_alloc_histogram_value (fun, val->type, NULL, NULL);
+ memcpy (new_val, val, sizeof (*val));
+ new_val->hvalue.stmt = stmt;
+ new_val->hvalue.counters = XNEWVAR (gcov_type, sizeof (*new_val->hvalue.counters) * new_val->n_counters);
+ memcpy (new_val->hvalue.counters, val->hvalue.counters, sizeof (*new_val->hvalue.counters) * new_val->n_counters);
+ gimple_add_histogram_value (fun, stmt, new_val);
}
}
@@ -341,7 +346,7 @@ gimple_duplicate_stmt_histograms (struct function *fun, tree stmt,
/* Move all histograms associated with OSTMT to STMT. */
void
-gimple_move_stmt_histograms (struct function *fun, tree stmt, tree ostmt)
+gimple_move_stmt_histograms (struct function *fun, gimple stmt, gimple ostmt)
{
histogram_value val = gimple_histogram_value (fun, ostmt);
if (val)
@@ -370,36 +375,38 @@ visit_hist (void **slot, void *data)
{
error ("Dead histogram");
dump_histogram_value (stderr, hist);
- debug_generic_stmt (hist->hvalue.stmt);
+ debug_gimple_stmt (hist->hvalue.stmt);
error_found = true;
}
return 1;
}
+
/* Verify sanity of the histograms. */
void
verify_histograms (void)
{
basic_block bb;
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
histogram_value hist;
struct pointer_set_t *visited_hists;
error_found = false;
visited_hists = pointer_set_create ();
FOR_EACH_BB (bb)
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- tree stmt = bsi_stmt (bsi);
+ gimple stmt = gsi_stmt (gsi);
- for (hist = gimple_histogram_value (cfun, stmt); hist; hist = hist->hvalue.next)
+ for (hist = gimple_histogram_value (cfun, stmt); hist;
+ hist = hist->hvalue.next)
{
if (hist->hvalue.stmt != stmt)
{
- error ("Histogram value statement does not correspond to statement"
- " it is associated with");
- debug_generic_stmt (stmt);
+ error ("Histogram value statement does not correspond to "
+ "the statement it is associated with");
+ debug_gimple_stmt (stmt);
dump_histogram_value (stderr, hist);
error_found = true;
}
@@ -439,38 +446,45 @@ free_histograms (void)
}
}
-/* The overall number of invocations of the counter should match execution count
- of basic block. Report it as error rather than internal error as it might
- mean that user has misused the profile somehow. */
+
+/* The overall number of invocations of the counter should match
+ execution count of basic block. Report it as error rather than
+ internal error as it might mean that user has misused the profile
+ somehow. */
+
static bool
-check_counter (tree stmt, const char * name, gcov_type all, gcov_type bb_count)
+check_counter (gimple stmt, const char *name, gcov_type all, gcov_type bb_count)
{
if (all != bb_count)
{
- location_t * locus;
- locus = (stmt != NULL && EXPR_HAS_LOCATION (stmt)
- ? EXPR_LOCUS (stmt)
- : &DECL_SOURCE_LOCATION (current_function_decl));
- error ("%HCorrupted value profile: %s profiler overall count (%d) does not match BB count (%d)",
- locus, name, (int)all, (int)bb_count);
+ location_t locus;
+ locus = (stmt != NULL)
+ ? gimple_location (stmt)
+ : DECL_SOURCE_LOCATION (current_function_decl);
+ error ("%HCorrupted value profile: %s profiler overall count (%d) "
+ "does not match BB count (%d)", &locus, name, (int)all,
+ (int)bb_count);
return true;
}
+
return false;
}
-/* Tree based transformations. */
+
+/* GIMPLE based transformations. */
+
static bool
-tree_value_profile_transformations (void)
+gimple_value_profile_transformations (void)
{
basic_block bb;
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
bool changed = false;
FOR_EACH_BB (bb)
{
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- tree stmt = bsi_stmt (bsi);
+ gimple stmt = gsi_stmt (gsi);
histogram_value th = gimple_histogram_value (cfun, stmt);
if (!th)
continue;
@@ -478,7 +492,7 @@ tree_value_profile_transformations (void)
if (dump_file)
{
fprintf (dump_file, "Trying transformations on stmt ");
- print_generic_stmt (dump_file, stmt, TDF_SLIM);
+ print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM);
dump_histograms_for_stmt (cfun, dump_file, stmt);
}
@@ -490,19 +504,19 @@ tree_value_profile_transformations (void)
current statement remain valid (although possibly
modified) upon return. */
if (flag_value_profile_transformations
- && (tree_mod_subtract_transform (stmt)
- || tree_divmod_fixed_value_transform (stmt)
- || tree_mod_pow2_value_transform (stmt)
- || tree_stringops_transform (&bsi)
- || tree_ic_transform (stmt)))
+ && (gimple_mod_subtract_transform (&gsi)
+ || gimple_divmod_fixed_value_transform (&gsi)
+ || gimple_mod_pow2_value_transform (&gsi)
+ || gimple_stringops_transform (&gsi)
+ || gimple_ic_transform (stmt)))
{
- stmt = bsi_stmt (bsi);
+ stmt = gsi_stmt (gsi);
changed = true;
/* Original statement may no longer be in the same block. */
- if (bb != bb_for_stmt (stmt))
+ if (bb != gimple_bb (stmt))
{
- bb = bb_for_stmt (stmt);
- bsi = bsi_for_stmt (stmt);
+ bb = gimple_bb (stmt);
+ gsi = gsi_for_stmt (stmt);
}
}
}
@@ -516,57 +530,55 @@ tree_value_profile_transformations (void)
return changed;
}
-/* Generate code for transformation 1 (with OPERATION, operands OP1
- and OP2, whose value is expected to be VALUE, parent modify-expr STMT and
- probability of taking the optimal path PROB, which is equivalent to COUNT/ALL
- within roundoff error). This generates the result into a temp and returns
- the temp; it does not replace or alter the original STMT. */
+
+/* Generate code for transformation 1 (with parent gimple assignment
+ STMT and probability of taking the optimal path PROB, which is
+ equivalent to COUNT/ALL within roundoff error). This generates the
+ result into a temp and returns the temp; it does not replace or
+ alter the original STMT. */
+
static tree
-tree_divmod_fixed_value (tree stmt, tree operation,
- tree op1, tree op2, tree value, int prob, gcov_type count,
- gcov_type all)
+gimple_divmod_fixed_value (gimple stmt, tree value, int prob, gcov_type count,
+ gcov_type all)
{
- tree stmt1, stmt2, stmt3;
+ gimple stmt1, stmt2, stmt3;
tree tmp1, tmp2, tmpv;
- tree label_decl1 = create_artificial_label ();
- tree label_decl2 = create_artificial_label ();
- tree label1, label2;
- tree bb1end, bb2end, bb3end;
+ gimple bb1end, bb2end, bb3end;
basic_block bb, bb2, bb3, bb4;
- tree optype = TREE_TYPE (operation);
+ tree optype, op1, op2;
edge e12, e13, e23, e24, e34;
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
- bb = bb_for_stmt (stmt);
- bsi = bsi_for_stmt (stmt);
+ gcc_assert (is_gimple_assign (stmt)
+ && (gimple_assign_rhs_code (stmt) == TRUNC_DIV_EXPR
+ || gimple_assign_rhs_code (stmt) == TRUNC_MOD_EXPR));
+
+ optype = TREE_TYPE (gimple_assign_lhs (stmt));
+ op1 = gimple_assign_rhs1 (stmt);
+ op2 = gimple_assign_rhs2 (stmt);
+
+ bb = gimple_bb (stmt);
+ gsi = gsi_for_stmt (stmt);
tmpv = create_tmp_var (optype, "PROF");
tmp1 = create_tmp_var (optype, "PROF");
- stmt1 = build_gimple_modify_stmt (tmpv, fold_convert (optype, value));
- stmt2 = build_gimple_modify_stmt (tmp1, op2);
- stmt3 = build3 (COND_EXPR, void_type_node,
- build2 (NE_EXPR, boolean_type_node, tmp1, tmpv),
- NULL_TREE, NULL_TREE);
- bsi_insert_before (&bsi, stmt1, BSI_SAME_STMT);
- bsi_insert_before (&bsi, stmt2, BSI_SAME_STMT);
- bsi_insert_before (&bsi, stmt3, BSI_SAME_STMT);
+ stmt1 = gimple_build_assign (tmpv, fold_convert (optype, value));
+ stmt2 = gimple_build_assign (tmp1, op2);
+ stmt3 = gimple_build_cond (NE_EXPR, tmp1, tmpv, NULL_TREE, NULL_TREE);
+ gsi_insert_before (&gsi, stmt1, GSI_SAME_STMT);
+ gsi_insert_before (&gsi, stmt2, GSI_SAME_STMT);
+ gsi_insert_before (&gsi, stmt3, GSI_SAME_STMT);
bb1end = stmt3;
tmp2 = create_tmp_var (optype, "PROF");
- label1 = build1 (LABEL_EXPR, void_type_node, label_decl1);
- stmt1 = build_gimple_modify_stmt (tmp2,
- build2 (TREE_CODE (operation), optype,
- op1, tmpv));
- bsi_insert_before (&bsi, label1, BSI_SAME_STMT);
- bsi_insert_before (&bsi, stmt1, BSI_SAME_STMT);
+ stmt1 = gimple_build_assign_with_ops (gimple_assign_rhs_code (stmt), tmp2,
+ op1, tmpv);
+ gsi_insert_before (&gsi, stmt1, GSI_SAME_STMT);
bb2end = stmt1;
- label2 = build1 (LABEL_EXPR, void_type_node, label_decl2);
- stmt1 = build_gimple_modify_stmt (tmp2,
- build2 (TREE_CODE (operation), optype,
- op1, op2));
- bsi_insert_before (&bsi, label2, BSI_SAME_STMT);
- bsi_insert_before (&bsi, stmt1, BSI_SAME_STMT);
+ stmt1 = gimple_build_assign_with_ops (gimple_assign_rhs_code (stmt), tmp2,
+ op1, op2);
+ gsi_insert_before (&gsi, stmt1, GSI_SAME_STMT);
bb3end = stmt1;
/* Fix CFG. */
@@ -602,35 +614,33 @@ tree_divmod_fixed_value (tree stmt, tree operation,
return tmp2;
}
+
/* Do transform 1) on INSN if applicable. */
+
static bool
-tree_divmod_fixed_value_transform (tree stmt)
+gimple_divmod_fixed_value_transform (gimple_stmt_iterator *si)
{
histogram_value histogram;
enum tree_code code;
gcov_type val, count, all;
- tree modify, op, op1, op2, result, value, tree_val;
+ tree result, value, tree_val;
gcov_type prob;
+ gimple stmt;
- modify = stmt;
- if (TREE_CODE (stmt) == RETURN_EXPR
- && TREE_OPERAND (stmt, 0)
- && TREE_CODE (TREE_OPERAND (stmt, 0)) == GIMPLE_MODIFY_STMT)
- modify = TREE_OPERAND (stmt, 0);
- if (TREE_CODE (modify) != GIMPLE_MODIFY_STMT)
+ stmt = gsi_stmt (*si);
+ if (gimple_code (stmt) != GIMPLE_ASSIGN)
return false;
- op = GIMPLE_STMT_OPERAND (modify, 1);
- if (!INTEGRAL_TYPE_P (TREE_TYPE (op)))
+
+ if (!INTEGRAL_TYPE_P (TREE_TYPE (gimple_assign_lhs (stmt))))
return false;
- code = TREE_CODE (op);
+
+ code = gimple_assign_rhs_code (stmt);
if (code != TRUNC_DIV_EXPR && code != TRUNC_MOD_EXPR)
return false;
- op1 = TREE_OPERAND (op, 0);
- op2 = TREE_OPERAND (op, 1);
-
- histogram = gimple_histogram_value_of_type (cfun, stmt, HIST_TYPE_SINGLE_VALUE);
+ histogram = gimple_histogram_value_of_type (cfun, stmt,
+ HIST_TYPE_SINGLE_VALUE);
if (!histogram)
return false;
@@ -643,11 +653,12 @@ tree_divmod_fixed_value_transform (tree stmt)
/* We require that count is at least half of all; this means
that for the transformation to fire the value must be constant
at least 50% of time (and 75% gives the guarantee of usage). */
- if (simple_cst_equal (op2, value) != 1 || 2 * count < all
- || !maybe_hot_bb_p (bb_for_stmt (stmt)))
+ if (simple_cst_equal (gimple_assign_rhs2 (stmt), value) != 1
+ || 2 * count < all
+ || !maybe_hot_bb_p (gimple_bb (stmt)))
return false;
- if (check_counter (stmt, "value", all, bb_for_stmt (stmt)->count))
+ if (check_counter (stmt, "value", all, gimple_bb (stmt)->count))
return false;
/* Compute probability of taking the optimal path. */
@@ -659,7 +670,7 @@ tree_divmod_fixed_value_transform (tree stmt)
tree_val = build_int_cst_wide (get_gcov_type (),
(unsigned HOST_WIDE_INT) val,
val >> (HOST_BITS_PER_WIDE_INT - 1) >> 1);
- result = tree_divmod_fixed_value (stmt, op, op1, op2, tree_val, prob, count, all);
+ result = gimple_divmod_fixed_value (stmt, tree_val, prob, count, all);
if (dump_file)
{
@@ -668,68 +679,61 @@ tree_divmod_fixed_value_transform (tree stmt)
fprintf (dump_file, "=");
print_generic_expr (dump_file, tree_val, TDF_SLIM);
fprintf (dump_file, " transformation on insn ");
- print_generic_stmt (dump_file, stmt, TDF_SLIM);
+ print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM);
}
- GIMPLE_STMT_OPERAND (modify, 1) = result;
+ gimple_assign_set_rhs_from_tree (si, result);
return true;
}
-/* Generate code for transformation 2 (with OPERATION, operands OP1
- and OP2, parent modify-expr STMT and probability of taking the optimal
- path PROB, which is equivalent to COUNT/ALL within roundoff error).
- This generates the result into a temp and returns
+/* Generate code for transformation 2 (with parent gimple assign STMT and
+ probability of taking the optimal path PROB, which is equivalent to COUNT/ALL
+ within roundoff error). This generates the result into a temp and returns
the temp; it does not replace or alter the original STMT. */
static tree
-tree_mod_pow2 (tree stmt, tree operation, tree op1, tree op2, int prob,
- gcov_type count, gcov_type all)
+gimple_mod_pow2 (gimple stmt, int prob, gcov_type count, gcov_type all)
{
- tree stmt1, stmt2, stmt3, stmt4;
+ gimple stmt1, stmt2, stmt3, stmt4;
tree tmp2, tmp3;
- tree label_decl1 = create_artificial_label ();
- tree label_decl2 = create_artificial_label ();
- tree label1, label2;
- tree bb1end, bb2end, bb3end;
+ gimple bb1end, bb2end, bb3end;
basic_block bb, bb2, bb3, bb4;
- tree optype = TREE_TYPE (operation);
+ tree optype, op1, op2;
edge e12, e13, e23, e24, e34;
- block_stmt_iterator bsi;
- tree result = create_tmp_var (optype, "PROF");
+ gimple_stmt_iterator gsi;
+ tree result;
+
+ gcc_assert (is_gimple_assign (stmt)
+ && gimple_assign_rhs_code (stmt) == TRUNC_MOD_EXPR);
+
+ optype = TREE_TYPE (gimple_assign_lhs (stmt));
+ op1 = gimple_assign_rhs1 (stmt);
+ op2 = gimple_assign_rhs2 (stmt);
- bb = bb_for_stmt (stmt);
- bsi = bsi_for_stmt (stmt);
+ bb = gimple_bb (stmt);
+ gsi = gsi_for_stmt (stmt);
+ result = create_tmp_var (optype, "PROF");
tmp2 = create_tmp_var (optype, "PROF");
tmp3 = create_tmp_var (optype, "PROF");
- stmt2 = build_gimple_modify_stmt (tmp2,
- build2 (PLUS_EXPR, optype, op2,
- build_int_cst (optype, -1)));
- stmt3 = build_gimple_modify_stmt (tmp3,
- build2 (BIT_AND_EXPR, optype, tmp2, op2));
- stmt4 = build3 (COND_EXPR, void_type_node,
- build2 (NE_EXPR, boolean_type_node,
- tmp3, build_int_cst (optype, 0)),
- NULL_TREE, NULL_TREE);
- bsi_insert_before (&bsi, stmt2, BSI_SAME_STMT);
- bsi_insert_before (&bsi, stmt3, BSI_SAME_STMT);
- bsi_insert_before (&bsi, stmt4, BSI_SAME_STMT);
+ stmt2 = gimple_build_assign_with_ops (PLUS_EXPR, tmp2, op2,
+ build_int_cst (optype, -1));
+ stmt3 = gimple_build_assign_with_ops (BIT_AND_EXPR, tmp3, tmp2, op2);
+ stmt4 = gimple_build_cond (NE_EXPR, tmp3, build_int_cst (optype, 0),
+ NULL_TREE, NULL_TREE);
+ gsi_insert_before (&gsi, stmt2, GSI_SAME_STMT);
+ gsi_insert_before (&gsi, stmt3, GSI_SAME_STMT);
+ gsi_insert_before (&gsi, stmt4, GSI_SAME_STMT);
bb1end = stmt4;
- /* tmp2 == op2-1 inherited from previous block */
- label1 = build1 (LABEL_EXPR, void_type_node, label_decl1);
- stmt1 = build_gimple_modify_stmt (result,
- build2 (BIT_AND_EXPR, optype, op1, tmp2));
- bsi_insert_before (&bsi, label1, BSI_SAME_STMT);
- bsi_insert_before (&bsi, stmt1, BSI_SAME_STMT);
+ /* tmp2 == op2-1 inherited from previous block. */
+ stmt1 = gimple_build_assign_with_ops (BIT_AND_EXPR, result, op1, tmp2);
+ gsi_insert_before (&gsi, stmt1, GSI_SAME_STMT);
bb2end = stmt1;
- label2 = build1 (LABEL_EXPR, void_type_node, label_decl2);
- stmt1 = build_gimple_modify_stmt (result,
- build2 (TREE_CODE (operation), optype,
- op1, op2));
- bsi_insert_before (&bsi, label2, BSI_SAME_STMT);
- bsi_insert_before (&bsi, stmt1, BSI_SAME_STMT);
+ stmt1 = gimple_build_assign_with_ops (gimple_assign_rhs_code (stmt), result,
+ op1, op2);
+ gsi_insert_before (&gsi, stmt1, GSI_SAME_STMT);
bb3end = stmt1;
/* Fix CFG. */
@@ -767,32 +771,28 @@ tree_mod_pow2 (tree stmt, tree operation, tree op1, tree op2, int prob,
/* Do transform 2) on INSN if applicable. */
static bool
-tree_mod_pow2_value_transform (tree stmt)
+gimple_mod_pow2_value_transform (gimple_stmt_iterator *si)
{
histogram_value histogram;
enum tree_code code;
gcov_type count, wrong_values, all;
- tree modify, op, op1, op2, result, value;
+ tree lhs_type, result, value;
gcov_type prob;
+ gimple stmt;
- modify = stmt;
- if (TREE_CODE (stmt) == RETURN_EXPR
- && TREE_OPERAND (stmt, 0)
- && TREE_CODE (TREE_OPERAND (stmt, 0)) == GIMPLE_MODIFY_STMT)
- modify = TREE_OPERAND (stmt, 0);
- if (TREE_CODE (modify) != GIMPLE_MODIFY_STMT)
+ stmt = gsi_stmt (*si);
+ if (gimple_code (stmt) != GIMPLE_ASSIGN)
return false;
- op = GIMPLE_STMT_OPERAND (modify, 1);
- if (!INTEGRAL_TYPE_P (TREE_TYPE (op)))
+
+ lhs_type = TREE_TYPE (gimple_assign_lhs (stmt));
+ if (!INTEGRAL_TYPE_P (lhs_type))
return false;
- code = TREE_CODE (op);
+
+ code = gimple_assign_rhs_code (stmt);
- if (code != TRUNC_MOD_EXPR || !TYPE_UNSIGNED (TREE_TYPE (op)))
+ if (code != TRUNC_MOD_EXPR || !TYPE_UNSIGNED (lhs_type))
return false;
- op1 = TREE_OPERAND (op, 0);
- op2 = TREE_OPERAND (op, 1);
-
histogram = gimple_histogram_value_of_type (cfun, stmt, HIST_TYPE_POW2);
if (!histogram)
return false;
@@ -804,20 +804,21 @@ tree_mod_pow2_value_transform (tree stmt)
gimple_remove_histogram_value (cfun, stmt, histogram);
/* We require that we hit a power of 2 at least half of all evaluations. */
- if (simple_cst_equal (op2, value) != 1 || count < wrong_values
- || !maybe_hot_bb_p (bb_for_stmt (stmt)))
+ if (simple_cst_equal (gimple_assign_rhs2 (stmt), value) != 1
+ || count < wrong_values
+ || !maybe_hot_bb_p (gimple_bb (stmt)))
return false;
if (dump_file)
{
fprintf (dump_file, "Mod power of 2 transformation on insn ");
- print_generic_stmt (dump_file, stmt, TDF_SLIM);
+ print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM);
}
/* Compute probability of taking the optimal path. */
all = count + wrong_values;
- if (check_counter (stmt, "pow2", all, bb_for_stmt (stmt)->count))
+ if (check_counter (stmt, "pow2", all, gimple_bb (stmt)->count))
return false;
if (all > 0)
@@ -825,82 +826,70 @@ tree_mod_pow2_value_transform (tree stmt)
else
prob = 0;
- result = tree_mod_pow2 (stmt, op, op1, op2, prob, count, all);
+ result = gimple_mod_pow2 (stmt, prob, count, all);
- GIMPLE_STMT_OPERAND (modify, 1) = result;
+ gimple_assign_set_rhs_from_tree (si, result);
return true;
}
-/* Generate code for transformations 3 and 4 (with OPERATION, operands OP1
- and OP2, parent modify-expr STMT, and NCOUNTS the number of cases to
- support. Currently only NCOUNTS==0 or 1 is supported and this is
- built into this interface. The probabilities of taking the optimal
- paths are PROB1 and PROB2, which are equivalent to COUNT1/ALL and
+/* Generate code for transformations 3 and 4 (with parent gimple assign STMT, and
+ NCOUNTS the number of cases to support. Currently only NCOUNTS==0 or 1 is
+ supported and this is built into this interface. The probabilities of taking
+ the optimal paths are PROB1 and PROB2, which are equivalent to COUNT1/ALL and
COUNT2/ALL respectively within roundoff error). This generates the
result into a temp and returns the temp; it does not replace or alter
the original STMT. */
/* FIXME: Generalize the interface to handle NCOUNTS > 1. */
static tree
-tree_mod_subtract (tree stmt, tree operation, tree op1, tree op2,
- int prob1, int prob2, int ncounts,
- gcov_type count1, gcov_type count2, gcov_type all)
+gimple_mod_subtract (gimple stmt, int prob1, int prob2, int ncounts,
+ gcov_type count1, gcov_type count2, gcov_type all)
{
- tree stmt1, stmt2, stmt3;
+ gimple stmt1, stmt2, stmt3;
tree tmp1;
- tree label_decl1 = create_artificial_label ();
- tree label_decl2 = create_artificial_label ();
- tree label_decl3 = create_artificial_label ();
- tree label1, label2, label3;
- tree bb1end, bb2end = NULL_TREE, bb3end;
+ gimple bb1end, bb2end = NULL, bb3end;
basic_block bb, bb2, bb3, bb4;
- tree optype = TREE_TYPE (operation);
+ tree optype, op1, op2;
edge e12, e23 = 0, e24, e34, e14;
- block_stmt_iterator bsi;
- tree result = create_tmp_var (optype, "PROF");
+ gimple_stmt_iterator gsi;
+ tree result;
- bb = bb_for_stmt (stmt);
- bsi = bsi_for_stmt (stmt);
+ gcc_assert (is_gimple_assign (stmt)
+ && gimple_assign_rhs_code (stmt) == TRUNC_MOD_EXPR);
+ optype = TREE_TYPE (gimple_assign_lhs (stmt));
+ op1 = gimple_assign_rhs1 (stmt);
+ op2 = gimple_assign_rhs2 (stmt);
+
+ bb = gimple_bb (stmt);
+ gsi = gsi_for_stmt (stmt);
+
+ result = create_tmp_var (optype, "PROF");
tmp1 = create_tmp_var (optype, "PROF");
- stmt1 = build_gimple_modify_stmt (result, op1);
- stmt2 = build_gimple_modify_stmt (tmp1, op2);
- stmt3 = build3 (COND_EXPR, void_type_node,
- build2 (LT_EXPR, boolean_type_node, result, tmp1),
- NULL_TREE, NULL_TREE);
- bsi_insert_before (&bsi, stmt1, BSI_SAME_STMT);
- bsi_insert_before (&bsi, stmt2, BSI_SAME_STMT);
- bsi_insert_before (&bsi, stmt3, BSI_SAME_STMT);
+ stmt1 = gimple_build_assign (result, op1);
+ stmt2 = gimple_build_assign (tmp1, op2);
+ stmt3 = gimple_build_cond (LT_EXPR, result, tmp1, NULL_TREE, NULL_TREE);
+ gsi_insert_before (&gsi, stmt1, GSI_SAME_STMT);
+ gsi_insert_before (&gsi, stmt2, GSI_SAME_STMT);
+ gsi_insert_before (&gsi, stmt3, GSI_SAME_STMT);
bb1end = stmt3;
if (ncounts) /* Assumed to be 0 or 1 */
{
- label1 = build1 (LABEL_EXPR, void_type_node, label_decl1);
- stmt1 = build_gimple_modify_stmt (result,
- build2 (MINUS_EXPR, optype,
- result, tmp1));
- stmt2 = build3 (COND_EXPR, void_type_node,
- build2 (LT_EXPR, boolean_type_node, result, tmp1),
- NULL_TREE, NULL_TREE);
- bsi_insert_before (&bsi, label1, BSI_SAME_STMT);
- bsi_insert_before (&bsi, stmt1, BSI_SAME_STMT);
- bsi_insert_before (&bsi, stmt2, BSI_SAME_STMT);
+ stmt1 = gimple_build_assign_with_ops (MINUS_EXPR, result, result, tmp1);
+ stmt2 = gimple_build_cond (LT_EXPR, result, tmp1, NULL_TREE, NULL_TREE);
+ gsi_insert_before (&gsi, stmt1, GSI_SAME_STMT);
+ gsi_insert_before (&gsi, stmt2, GSI_SAME_STMT);
bb2end = stmt2;
}
/* Fallback case. */
- label2 = build1 (LABEL_EXPR, void_type_node, label_decl2);
- stmt1 = build_gimple_modify_stmt (result,
- build2 (TREE_CODE (operation), optype,
- result, tmp1));
- bsi_insert_before (&bsi, label2, BSI_SAME_STMT);
- bsi_insert_before (&bsi, stmt1, BSI_SAME_STMT);
+ stmt1 = gimple_build_assign_with_ops (gimple_assign_rhs_code (stmt), result,
+ result, tmp1);
+ gsi_insert_before (&gsi, stmt1, GSI_SAME_STMT);
bb3end = stmt1;
- label3 = build1 (LABEL_EXPR, void_type_node, label_decl3);
- bsi_insert_before (&bsi, label3, BSI_SAME_STMT);
-
/* Fix CFG. */
/* Edge e23 connects bb2 to bb3, etc. */
/* However block 3 is optional; if it is not there, references
@@ -947,36 +936,34 @@ tree_mod_subtract (tree stmt, tree operation, tree op1, tree op2,
return result;
}
-/* Do transforms 3) and 4) on INSN if applicable. */
+
+/* Do transforms 3) and 4) on the statement pointed-to by SI if applicable. */
+
static bool
-tree_mod_subtract_transform (tree stmt)
+gimple_mod_subtract_transform (gimple_stmt_iterator *si)
{
histogram_value histogram;
enum tree_code code;
gcov_type count, wrong_values, all;
- tree modify, op, op1, op2, result, value;
+ tree lhs_type, result, value;
gcov_type prob1, prob2;
unsigned int i, steps;
gcov_type count1, count2;
+ gimple stmt;
- modify = stmt;
- if (TREE_CODE (stmt) == RETURN_EXPR
- && TREE_OPERAND (stmt, 0)
- && TREE_CODE (TREE_OPERAND (stmt, 0)) == GIMPLE_MODIFY_STMT)
- modify = TREE_OPERAND (stmt, 0);
- if (TREE_CODE (modify) != GIMPLE_MODIFY_STMT)
+ stmt = gsi_stmt (*si);
+ if (gimple_code (stmt) != GIMPLE_ASSIGN)
return false;
- op = GIMPLE_STMT_OPERAND (modify, 1);
- if (!INTEGRAL_TYPE_P (TREE_TYPE (op)))
+
+ lhs_type = TREE_TYPE (gimple_assign_lhs (stmt));
+ if (!INTEGRAL_TYPE_P (lhs_type))
return false;
- code = TREE_CODE (op);
+
+ code = gimple_assign_rhs_code (stmt);
- if (code != TRUNC_MOD_EXPR || !TYPE_UNSIGNED (TREE_TYPE (op)))
+ if (code != TRUNC_MOD_EXPR || !TYPE_UNSIGNED (lhs_type))
return false;
- op1 = TREE_OPERAND (op, 0);
- op2 = TREE_OPERAND (op, 1);
-
histogram = gimple_histogram_value_of_type (cfun, stmt, HIST_TYPE_INTERVAL);
if (!histogram)
return false;
@@ -995,7 +982,7 @@ tree_mod_subtract_transform (tree stmt)
count2 = histogram->hvalue.counters[1];
/* Compute probability of taking the optimal path. */
- if (check_counter (stmt, "interval", all, bb_for_stmt (stmt)->count))
+ if (check_counter (stmt, "interval", all, gimple_bb (stmt)->count))
{
gimple_remove_histogram_value (cfun, stmt, histogram);
return false;
@@ -1011,14 +998,14 @@ tree_mod_subtract_transform (tree stmt)
break;
}
if (i == steps
- || !maybe_hot_bb_p (bb_for_stmt (stmt)))
+ || !maybe_hot_bb_p (gimple_bb (stmt)))
return false;
gimple_remove_histogram_value (cfun, stmt, histogram);
if (dump_file)
{
fprintf (dump_file, "Mod subtract transformation on insn ");
- print_generic_stmt (dump_file, stmt, TDF_SLIM);
+ print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM);
}
/* Compute probability of taking the optimal path(s). */
@@ -1034,10 +1021,9 @@ tree_mod_subtract_transform (tree stmt)
/* In practice, "steps" is always 2. This interface reflects this,
and will need to be changed if "steps" can change. */
- result = tree_mod_subtract (stmt, op, op1, op2, prob1, prob2, i,
- count1, count2, all);
+ result = gimple_mod_subtract (stmt, prob1, prob2, i, count1, count2, all);
- GIMPLE_STMT_OPERAND (modify, 1) = result;
+ gimple_assign_set_rhs_from_tree (si, result);
return true;
}
@@ -1082,52 +1068,40 @@ find_func_by_pid (int pid)
old call
*/
-static tree
-tree_ic (tree stmt, tree call, struct cgraph_node* direct_call,
- int prob, gcov_type count, gcov_type all)
+static gimple
+gimple_ic (gimple stmt, gimple call, struct cgraph_node *direct_call,
+ int prob, gcov_type count, gcov_type all)
{
- tree stmt1, stmt2, stmt3;
+ gimple stmt1, stmt2, stmt3;
tree tmp1, tmpv, tmp;
- tree label_decl1 = create_artificial_label ();
- tree label_decl2 = create_artificial_label ();
- tree label1, label2;
- tree bb1end, bb2end, bb3end;
- tree new_call;
+ gimple bb1end, bb2end, bb3end;
basic_block bb, bb2, bb3, bb4;
tree optype = build_pointer_type (void_type_node);
edge e12, e13, e23, e24, e34;
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
int region;
- bb = bb_for_stmt (stmt);
- bsi = bsi_for_stmt (stmt);
+ bb = gimple_bb (stmt);
+ gsi = gsi_for_stmt (stmt);
tmpv = create_tmp_var (optype, "PROF");
tmp1 = create_tmp_var (optype, "PROF");
- stmt1 = build_gimple_modify_stmt (tmpv,
- unshare_expr (CALL_EXPR_FN (call)));
+ stmt1 = gimple_build_assign (tmpv, unshare_expr (gimple_call_fn (call)));
+
tmp = fold_convert (optype, build_addr (direct_call->decl,
current_function_decl));
- stmt2 = build_gimple_modify_stmt (tmp1, tmp);
- stmt3 = build3 (COND_EXPR, void_type_node,
- build2 (NE_EXPR, boolean_type_node, tmp1, tmpv),
- NULL_TREE, NULL_TREE);
- bsi_insert_before (&bsi, stmt1, BSI_SAME_STMT);
- bsi_insert_before (&bsi, stmt2, BSI_SAME_STMT);
- bsi_insert_before (&bsi, stmt3, BSI_SAME_STMT);
+ stmt2 = gimple_build_assign (tmp1, tmp);
+ stmt3 = gimple_build_cond (NE_EXPR, tmp1, tmpv, NULL_TREE, NULL_TREE);
+ gsi_insert_before (&gsi, stmt1, GSI_SAME_STMT);
+ gsi_insert_before (&gsi, stmt2, GSI_SAME_STMT);
+ gsi_insert_before (&gsi, stmt3, GSI_SAME_STMT);
bb1end = stmt3;
- label1 = build1 (LABEL_EXPR, void_type_node, label_decl1);
- stmt1 = unshare_expr (stmt);
- new_call = get_call_expr_in (stmt1);
- CALL_EXPR_FN (new_call) = build_addr (direct_call->decl,
- current_function_decl);
- bsi_insert_before (&bsi, label1, BSI_SAME_STMT);
- bsi_insert_before (&bsi, stmt1, BSI_SAME_STMT);
+ stmt1 = gimple_copy (stmt);
+ gimple_call_set_fn (stmt,
+ build_addr (direct_call->decl, current_function_decl));
+ gsi_insert_before (&gsi, stmt1, GSI_SAME_STMT);
bb2end = stmt1;
-
- label2 = build1 (LABEL_EXPR, void_type_node, label_decl2);
- bsi_insert_before (&bsi, label2, BSI_SAME_STMT);
bb3end = stmt;
/* Fix CFG. */
@@ -1161,15 +1135,15 @@ tree_ic (tree stmt, tree call, struct cgraph_node* direct_call,
/* Fix eh edges */
region = lookup_stmt_eh_region (stmt);
- if (region >=0 && tree_could_throw_p (stmt1))
+ if (region >= 0 && stmt_could_throw_p (stmt1))
{
add_stmt_to_eh_region (stmt1, region);
make_eh_edges (stmt1);
}
- if (region >=0 && tree_could_throw_p (stmt))
+ if (region >= 0 && stmt_could_throw_p (stmt))
{
- tree_purge_dead_eh_edges (bb4);
+ gimple_purge_dead_eh_edges (bb4);
make_eh_edges (stmt);
}
@@ -1183,22 +1157,21 @@ tree_ic (tree stmt, tree call, struct cgraph_node* direct_call,
*/
static bool
-tree_ic_transform (tree stmt)
+gimple_ic_transform (gimple stmt)
{
histogram_value histogram;
gcov_type val, count, all;
gcov_type prob;
- tree call, callee, modify;
+ tree callee;
+ gimple modify;
struct cgraph_node *direct_call;
- call = get_call_expr_in (stmt);
-
- if (!call || TREE_CODE (call) != CALL_EXPR)
+ if (gimple_code (stmt) != GIMPLE_CALL)
return false;
- callee = CALL_EXPR_FN (call);
+ callee = gimple_call_fn (stmt);
- if (TREE_CODE (callee) == ADDR_EXPR)
+ if (TREE_CODE (callee) == FUNCTION_DECL)
return false;
histogram = gimple_histogram_value_of_type (cfun, stmt, HIST_TYPE_INDIR_CALL);
@@ -1222,18 +1195,18 @@ tree_ic_transform (tree stmt)
if (direct_call == NULL)
return false;
- modify = tree_ic (stmt, call, direct_call, prob, count, all);
+ modify = gimple_ic (stmt, stmt, direct_call, prob, count, all);
if (dump_file)
{
fprintf (dump_file, "Indirect call -> direct call ");
- print_generic_expr (dump_file, call, TDF_SLIM);
+ print_generic_expr (dump_file, gimple_call_fn (stmt), TDF_SLIM);
fprintf (dump_file, "=> ");
print_generic_expr (dump_file, direct_call->decl, TDF_SLIM);
fprintf (dump_file, " transformation on insn ");
- print_generic_stmt (dump_file, stmt, TDF_SLIM);
+ print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM);
fprintf (dump_file, " to ");
- print_generic_stmt (dump_file, modify, TDF_SLIM);
+ print_gimple_stmt (dump_file, modify, 0, TDF_SLIM);
fprintf (dump_file, "hist->count "HOST_WIDEST_INT_PRINT_DEC
" hist->all "HOST_WIDEST_INT_PRINT_DEC"\n", count, all);
}
@@ -1243,7 +1216,7 @@ tree_ic_transform (tree stmt)
/* Return true if the stringop CALL with FNDECL shall be profiled. */
static bool
-interesting_stringop_to_profile_p (tree fndecl, tree call)
+interesting_stringop_to_profile_p (tree fndecl, gimple call)
{
enum built_in_function fcode = DECL_FUNCTION_CODE (fndecl);
@@ -1255,16 +1228,14 @@ interesting_stringop_to_profile_p (tree fndecl, tree call)
{
case BUILT_IN_MEMCPY:
case BUILT_IN_MEMPCPY:
- return validate_arglist (call,
- POINTER_TYPE, POINTER_TYPE, INTEGER_TYPE,
- VOID_TYPE);
+ return validate_gimple_arglist (call, POINTER_TYPE, POINTER_TYPE,
+ INTEGER_TYPE, VOID_TYPE);
case BUILT_IN_MEMSET:
- return validate_arglist (call,
- POINTER_TYPE, INTEGER_TYPE, INTEGER_TYPE,
- VOID_TYPE);
+ return validate_gimple_arglist (call, POINTER_TYPE, INTEGER_TYPE,
+ INTEGER_TYPE, VOID_TYPE);
case BUILT_IN_BZERO:
- return validate_arglist (call, POINTER_TYPE, INTEGER_TYPE,
- VOID_TYPE);
+ return validate_gimple_arglist (call, POINTER_TYPE, INTEGER_TYPE,
+ VOID_TYPE);
default:
gcc_unreachable ();
}
@@ -1279,27 +1250,23 @@ interesting_stringop_to_profile_p (tree fndecl, tree call)
assuming constant propagation of VALUE will happen later.
*/
static void
-tree_stringop_fixed_value (tree stmt, tree value, int prob, gcov_type count,
+gimple_stringop_fixed_value (gimple stmt, tree value, int prob, gcov_type count,
gcov_type all)
{
- tree stmt1, stmt2, stmt3;
+ gimple stmt1, stmt2, stmt3;
tree tmp1, tmpv;
- tree label_decl1 = create_artificial_label ();
- tree label_decl2 = create_artificial_label ();
- tree label1, label2;
- tree bb1end, bb2end;
+ gimple bb1end, bb2end;
basic_block bb, bb2, bb3, bb4;
edge e12, e13, e23, e24, e34;
- block_stmt_iterator bsi;
- tree call = get_call_expr_in (stmt);
- tree blck_size = CALL_EXPR_ARG (call, 2);
+ gimple_stmt_iterator gsi;
+ tree blck_size = gimple_call_arg (stmt, 2);
tree optype = TREE_TYPE (blck_size);
int region;
- bb = bb_for_stmt (stmt);
- bsi = bsi_for_stmt (stmt);
+ bb = gimple_bb (stmt);
+ gsi = gsi_for_stmt (stmt);
- if (bsi_end_p (bsi))
+ if (gsi_end_p (gsi))
{
edge_iterator ei;
for (ei = ei_start (bb->succs); (e34 = ei_safe_edge (ei)); )
@@ -1309,34 +1276,27 @@ tree_stringop_fixed_value (tree stmt, tree value, int prob, gcov_type count,
else
{
e34 = split_block (bb, stmt);
- bsi = bsi_for_stmt (stmt);
+ gsi = gsi_for_stmt (stmt);
}
bb4 = e34->dest;
tmpv = create_tmp_var (optype, "PROF");
tmp1 = create_tmp_var (optype, "PROF");
- stmt1 = build_gimple_modify_stmt (tmpv, fold_convert (optype, value));
- stmt2 = build_gimple_modify_stmt (tmp1, blck_size);
- stmt3 = build3 (COND_EXPR, void_type_node,
- build2 (NE_EXPR, boolean_type_node, tmp1, tmpv),
- NULL_TREE, NULL_TREE);
- bsi_insert_before (&bsi, stmt1, BSI_SAME_STMT);
- bsi_insert_before (&bsi, stmt2, BSI_SAME_STMT);
- bsi_insert_before (&bsi, stmt3, BSI_SAME_STMT);
+ stmt1 = gimple_build_assign (tmpv, fold_convert (optype, value));
+ stmt2 = gimple_build_assign (tmp1, blck_size);
+ stmt3 = gimple_build_cond (NE_EXPR, tmp1, tmpv, NULL_TREE, NULL_TREE);
+ gsi_insert_before (&gsi, stmt1, GSI_SAME_STMT);
+ gsi_insert_before (&gsi, stmt2, GSI_SAME_STMT);
+ gsi_insert_before (&gsi, stmt3, GSI_SAME_STMT);
bb1end = stmt3;
- label1 = build1 (LABEL_EXPR, void_type_node, label_decl1);
- stmt1 = unshare_expr (stmt);
- call = get_call_expr_in (stmt1);
- CALL_EXPR_ARG (call, 2) = value;
- bsi_insert_before (&bsi, label1, BSI_SAME_STMT);
- bsi_insert_before (&bsi, stmt1, BSI_SAME_STMT);
+ stmt1 = gimple_copy (stmt);
+ gimple_call_set_arg (stmt1, 2, value);
+ gsi_insert_before (&gsi, stmt1, GSI_SAME_STMT);
region = lookup_stmt_eh_region (stmt);
if (region >= 0)
add_stmt_to_eh_region (stmt1, region);
bb2end = stmt1;
- label2 = build1 (LABEL_EXPR, void_type_node, label_decl2);
- bsi_insert_before (&bsi, label2, BSI_SAME_STMT);
/* Fix CFG. */
/* Edge e23 connects bb2 to bb3, etc. */
@@ -1369,10 +1329,9 @@ tree_stringop_fixed_value (tree stmt, tree value, int prob, gcov_type count,
/* Find values inside STMT for that we want to measure histograms for
division/modulo optimization. */
static bool
-tree_stringops_transform (block_stmt_iterator *bsi)
+gimple_stringops_transform (gimple_stmt_iterator *gsi)
{
- tree stmt = bsi_stmt (*bsi);
- tree call = get_call_expr_in (stmt);
+ gimple stmt = gsi_stmt (*gsi);
tree fndecl;
tree blck_size;
enum built_in_function fcode;
@@ -1384,19 +1343,19 @@ tree_stringops_transform (block_stmt_iterator *bsi)
gcov_type prob;
tree tree_val;
- if (!call)
+ if (gimple_code (stmt) != GIMPLE_CALL)
return false;
- fndecl = get_callee_fndecl (call);
+ fndecl = gimple_call_fndecl (stmt);
if (!fndecl)
return false;
fcode = DECL_FUNCTION_CODE (fndecl);
- if (!interesting_stringop_to_profile_p (fndecl, call))
+ if (!interesting_stringop_to_profile_p (fndecl, stmt))
return false;
if (fcode == BUILT_IN_BZERO)
- blck_size = CALL_EXPR_ARG (call, 1);
+ blck_size = gimple_call_arg (stmt, 1);
else
- blck_size = CALL_EXPR_ARG (call, 2);
+ blck_size = gimple_call_arg (stmt, 2);
if (TREE_CODE (blck_size) == INTEGER_CST)
return false;
@@ -1411,28 +1370,28 @@ tree_stringops_transform (block_stmt_iterator *bsi)
/* We require that count is at least half of all; this means
that for the transformation to fire the value must be constant
at least 80% of time. */
- if ((6 * count / 5) < all || !maybe_hot_bb_p (bb_for_stmt (stmt)))
+ if ((6 * count / 5) < all || !maybe_hot_bb_p (gimple_bb (stmt)))
return false;
- if (check_counter (stmt, "value", all, bb_for_stmt (stmt)->count))
+ if (check_counter (stmt, "value", all, gimple_bb (stmt)->count))
return false;
if (all > 0)
prob = (count * REG_BR_PROB_BASE + all / 2) / all;
else
prob = 0;
- dest = CALL_EXPR_ARG (call, 0);
+ dest = gimple_call_arg (stmt, 0);
dest_align = get_pointer_alignment (dest, BIGGEST_ALIGNMENT);
switch (fcode)
{
case BUILT_IN_MEMCPY:
case BUILT_IN_MEMPCPY:
- src = CALL_EXPR_ARG (call, 1);
+ src = gimple_call_arg (stmt, 1);
src_align = get_pointer_alignment (src, BIGGEST_ALIGNMENT);
if (!can_move_by_pieces (val, MIN (dest_align, src_align)))
return false;
break;
case BUILT_IN_MEMSET:
if (!can_store_by_pieces (val, builtin_memset_read_str,
- CALL_EXPR_ARG (call, 1),
+ gimple_call_arg (stmt, 1),
dest_align, true))
return false;
break;
@@ -1452,15 +1411,15 @@ tree_stringops_transform (block_stmt_iterator *bsi)
{
fprintf (dump_file, "Single value %i stringop transformation on ",
(int)val);
- print_generic_stmt (dump_file, stmt, TDF_SLIM);
+ print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM);
}
- tree_stringop_fixed_value (stmt, tree_val, prob, count, all);
+ gimple_stringop_fixed_value (stmt, tree_val, prob, count, all);
return true;
}
void
-stringop_block_profile (tree stmt, unsigned int *expected_align,
+stringop_block_profile (gimple stmt, unsigned int *expected_align,
HOST_WIDE_INT *expected_size)
{
histogram_value histogram;
@@ -1520,31 +1479,25 @@ struct value_prof_hooks {
/* Find values inside STMT for that we want to measure histograms for
division/modulo optimization. */
static void
-tree_divmod_values_to_profile (tree stmt, histogram_values *values)
+gimple_divmod_values_to_profile (gimple stmt, histogram_values *values)
{
- tree assign, lhs, rhs, divisor, op0, type;
+ tree lhs, divisor, op0, type;
histogram_value hist;
- if (TREE_CODE (stmt) == RETURN_EXPR)
- assign = TREE_OPERAND (stmt, 0);
- else
- assign = stmt;
-
- if (!assign
- || TREE_CODE (assign) != GIMPLE_MODIFY_STMT)
+ if (gimple_code (stmt) != GIMPLE_ASSIGN)
return;
- lhs = GIMPLE_STMT_OPERAND (assign, 0);
+
+ lhs = gimple_assign_lhs (stmt);
type = TREE_TYPE (lhs);
if (!INTEGRAL_TYPE_P (type))
return;
- rhs = GIMPLE_STMT_OPERAND (assign, 1);
- switch (TREE_CODE (rhs))
+ switch (gimple_assign_rhs_code (stmt))
{
case TRUNC_DIV_EXPR:
case TRUNC_MOD_EXPR:
- divisor = TREE_OPERAND (rhs, 1);
- op0 = TREE_OPERAND (rhs, 0);
+ divisor = gimple_assign_rhs2 (stmt);
+ op0 = gimple_assign_rhs1 (stmt);
VEC_reserve (histogram_value, heap, *values, 3);
@@ -1552,12 +1505,13 @@ tree_divmod_values_to_profile (tree stmt, histogram_values *values)
/* Check for the case where the divisor is the same value most
of the time. */
VEC_quick_push (histogram_value, *values,
- gimple_alloc_histogram_value (cfun, HIST_TYPE_SINGLE_VALUE,
+ gimple_alloc_histogram_value (cfun,
+ HIST_TYPE_SINGLE_VALUE,
stmt, divisor));
/* For mod, check whether it is not often a noop (or replaceable by
a few subtractions). */
- if (TREE_CODE (rhs) == TRUNC_MOD_EXPR
+ if (gimple_assign_rhs_code (stmt) == TRUNC_MOD_EXPR
&& TYPE_UNSIGNED (type))
{
tree val;
@@ -1584,20 +1538,15 @@ tree_divmod_values_to_profile (tree stmt, histogram_values *values)
indirect/virtual call optimization. */
static void
-tree_indirect_call_to_profile (tree stmt, histogram_values *values)
+gimple_indirect_call_to_profile (gimple stmt, histogram_values *values)
{
- tree call;
- tree callee;
+ tree callee;
- call = get_call_expr_in (stmt);
-
- if (!call || TREE_CODE (call) != CALL_EXPR)
+ if (gimple_code (stmt) != GIMPLE_CALL
+ || gimple_call_fndecl (stmt) != NULL_TREE)
return;
- callee = CALL_EXPR_FN (call);
-
- if (TREE_CODE (callee) == ADDR_EXPR)
- return;
+ callee = gimple_call_fn (stmt);
VEC_reserve (histogram_value, heap, *values, 3);
@@ -1611,29 +1560,28 @@ tree_indirect_call_to_profile (tree stmt, histogram_values *values)
/* Find values inside STMT for that we want to measure histograms for
string operations. */
static void
-tree_stringops_values_to_profile (tree stmt, histogram_values *values)
+gimple_stringops_values_to_profile (gimple stmt, histogram_values *values)
{
- tree call = get_call_expr_in (stmt);
tree fndecl;
tree blck_size;
tree dest;
enum built_in_function fcode;
- if (!call)
+ if (gimple_code (stmt) != GIMPLE_CALL)
return;
- fndecl = get_callee_fndecl (call);
+ fndecl = gimple_call_fndecl (stmt);
if (!fndecl)
return;
fcode = DECL_FUNCTION_CODE (fndecl);
- if (!interesting_stringop_to_profile_p (fndecl, call))
+ if (!interesting_stringop_to_profile_p (fndecl, stmt))
return;
- dest = CALL_EXPR_ARG (call, 0);
+ dest = gimple_call_arg (stmt, 0);
if (fcode == BUILT_IN_BZERO)
- blck_size = CALL_EXPR_ARG (call, 1);
+ blck_size = gimple_call_arg (stmt, 1);
else
- blck_size = CALL_EXPR_ARG (call, 2);
+ blck_size = gimple_call_arg (stmt, 2);
if (TREE_CODE (blck_size) != INTEGER_CST)
{
@@ -1654,28 +1602,28 @@ tree_stringops_values_to_profile (tree stmt, histogram_values *values)
them to list VALUES. */
static void
-tree_values_to_profile (tree stmt, histogram_values *values)
+gimple_values_to_profile (gimple stmt, histogram_values *values)
{
if (flag_value_profile_transformations)
{
- tree_divmod_values_to_profile (stmt, values);
- tree_stringops_values_to_profile (stmt, values);
- tree_indirect_call_to_profile (stmt, values);
+ gimple_divmod_values_to_profile (stmt, values);
+ gimple_stringops_values_to_profile (stmt, values);
+ gimple_indirect_call_to_profile (stmt, values);
}
}
static void
-tree_find_values_to_profile (histogram_values *values)
+gimple_find_values_to_profile (histogram_values *values)
{
basic_block bb;
- block_stmt_iterator bsi;
+ gimple_stmt_iterator gsi;
unsigned i;
histogram_value hist = NULL;
*values = NULL;
FOR_EACH_BB (bb)
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
- tree_values_to_profile (bsi_stmt (bsi), values);
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ gimple_values_to_profile (gsi_stmt (gsi), values);
for (i = 0; VEC_iterate (histogram_value, *values, i, hist); i++)
{
@@ -1715,22 +1663,22 @@ tree_find_values_to_profile (histogram_values *values)
if (dump_file)
{
fprintf (dump_file, "Stmt ");
- print_generic_expr (dump_file, hist->hvalue.stmt, TDF_SLIM);
+ print_gimple_stmt (dump_file, hist->hvalue.stmt, 0, TDF_SLIM);
dump_histogram_value (dump_file, hist);
}
}
}
-static struct value_prof_hooks tree_value_prof_hooks = {
- tree_find_values_to_profile,
- tree_value_profile_transformations
+static struct value_prof_hooks gimple_value_prof_hooks = {
+ gimple_find_values_to_profile,
+ gimple_value_profile_transformations
};
void
-tree_register_value_prof_hooks (void)
+gimple_register_value_prof_hooks (void)
{
gcc_assert (current_ir_type () == IR_GIMPLE);
- value_prof_hooks = &tree_value_prof_hooks;
+ value_prof_hooks = &gimple_value_prof_hooks;
}
/* IR-independent entry points. */
diff --git a/gcc/value-prof.h b/gcc/value-prof.h
index 2ab9df1cb53..e66f4e2046a 100644
--- a/gcc/value-prof.h
+++ b/gcc/value-prof.h
@@ -46,7 +46,7 @@ struct histogram_value_t
struct
{
tree value; /* The value to profile. */
- tree stmt; /* Insn containing the value. */
+ gimple stmt; /* Insn containing the value. */
gcov_type *counters; /* Pointer to first counter. */
struct histogram_value_t *next; /* Linked list pointer. */
} hvalue;
@@ -71,7 +71,7 @@ DEF_VEC_ALLOC_P(histogram_value,heap);
typedef VEC(histogram_value,heap) *histogram_values;
/* Hooks registration. */
-extern void tree_register_value_prof_hooks (void);
+extern void gimple_register_value_prof_hooks (void);
/* IR-independent entry points. */
extern void find_values_to_profile (histogram_values *);
@@ -109,17 +109,19 @@ struct profile_hooks {
void (*gen_ior_profiler) (histogram_value, unsigned, unsigned);
};
-histogram_value gimple_histogram_value (struct function *, tree);
-histogram_value gimple_histogram_value_of_type (struct function *, tree, enum hist_type);
-void gimple_add_histogram_value (struct function *, tree, histogram_value);
-void dump_histograms_for_stmt (struct function *, FILE *, tree);
-void gimple_remove_histogram_value (struct function *, tree, histogram_value);
-void gimple_remove_stmt_histograms (struct function *, tree);
-void gimple_duplicate_stmt_histograms (struct function *, tree, struct function *, tree);
-void gimple_move_stmt_histograms (struct function *, tree, tree);
+histogram_value gimple_histogram_value (struct function *, gimple);
+histogram_value gimple_histogram_value_of_type (struct function *, gimple,
+ enum hist_type);
+void gimple_add_histogram_value (struct function *, gimple, histogram_value);
+void dump_histograms_for_stmt (struct function *, FILE *, gimple);
+void gimple_remove_histogram_value (struct function *, gimple, histogram_value);
+void gimple_remove_stmt_histograms (struct function *, gimple);
+void gimple_duplicate_stmt_histograms (struct function *, gimple,
+ struct function *, gimple);
+void gimple_move_stmt_histograms (struct function *, gimple, gimple);
void verify_histograms (void);
void free_histograms (void);
-void stringop_block_profile (tree, unsigned int *, HOST_WIDE_INT *);
+void stringop_block_profile (gimple, unsigned int *, HOST_WIDE_INT *);
/* In profile.c. */
extern void init_branch_prob (void);
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 49cdda4c9a5..941716f73bd 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -470,9 +470,9 @@ static int
section_entry_eq (const void *p1, const void *p2)
{
const section *old = (const section *) p1;
- const char *new = (const char *) p2;
+ const char *new_name = (const char *) p2;
- return strcmp (old->named.name, new) == 0;
+ return strcmp (old->named.name, new_name) == 0;
}
static hashval_t
@@ -498,9 +498,9 @@ static int
object_block_entry_eq (const void *p1, const void *p2)
{
const struct object_block *old = (const struct object_block *) p1;
- const section *new = (const section *) p2;
+ const section *new_section = (const section *) p2;
- return old->sect == new;
+ return old->sect == new_section;
}
static hashval_t
@@ -2228,7 +2228,7 @@ contains_pointers_p (tree type)
}
}
-/* In unit-at-a-time mode, we delay assemble_external processing until
+/* We delay assemble_external processing until
the compilation unit is finalized. This is the best we can do for
right now (i.e. stage 3 of GCC 4.0) - the right thing is to delay
it all the way to final. See PR 17982 for further discussion. */
@@ -5380,7 +5380,7 @@ assemble_alias (tree decl, tree target)
/* If the target has already been emitted, we don't have to queue the
alias. This saves a tad of memory. */
- if (!flag_unit_at_a_time || cgraph_global_info_ready)
+ if (cgraph_global_info_ready)
target_decl = find_decl_and_mark_needed (decl, target);
else
target_decl= NULL;
diff --git a/gcc/varpool.c b/gcc/varpool.c
index 4149c1d1d21..1d1cc9ed630 100644
--- a/gcc/varpool.c
+++ b/gcc/varpool.c
@@ -32,7 +32,7 @@ along with GCC; see the file COPYING3. If not see
#include "debug.h"
#include "target.h"
#include "output.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "tree-flow.h"
/* This file contains basic routines manipulating variable pool.
@@ -61,7 +61,7 @@ struct varpool_node *varpool_nodes;
maintained in forward order. GTY is needed to make it friendly to
PCH.
- During unit-at-a-time compilation we construct the queue of needed variables
+ During compilation we construct the queue of needed variables
twice: first time it is during cgraph construction, second time it is at the
end of compilation in VARPOOL_REMOVE_UNREFERENCED_DECLS so we can avoid
optimized out variables being output.
@@ -214,17 +214,13 @@ varpool_reset_queue (void)
/* Determine if variable DECL is needed. That is, visible to something
either outside this translation unit, something magic in the system
- configury, or (if not doing unit-at-a-time) to something we haven't
- seen yet. */
+ configury */
bool
decide_is_variable_needed (struct varpool_node *node, tree decl)
{
/* If the user told us it is used, then it must be so. */
if (node->externally_visible || node->force_output)
return true;
- if (!flag_unit_at_a_time
- && lookup_attribute ("used", DECL_ATTRIBUTES (decl)))
- return true;
/* ??? If the assembler name is set by hand, it is possible to assemble
the name later after finalizing the function and the fact is noticed
@@ -257,7 +253,7 @@ decide_is_variable_needed (struct varpool_node *node, tree decl)
/* When not reordering top level variables, we have to assume that
we are going to keep everything. */
- if (flag_unit_at_a_time && flag_toplevel_reorder)
+ if (flag_toplevel_reorder)
return false;
/* We want to emit COMDAT variables only when absolutely necessary. */
@@ -280,7 +276,7 @@ varpool_finalize_decl (tree decl)
if this function has already run. */
if (node->finalized)
{
- if (cgraph_global_info_ready || (!flag_unit_at_a_time && !flag_openmp))
+ if (cgraph_global_info_ready)
varpool_assemble_pending_decls ();
return;
}
@@ -295,7 +291,7 @@ varpool_finalize_decl (tree decl)
there. */
else if (TREE_PUBLIC (decl) && !DECL_COMDAT (decl) && !DECL_EXTERNAL (decl))
varpool_mark_needed_node (node);
- if (cgraph_global_info_ready || (!flag_unit_at_a_time && !flag_openmp))
+ if (cgraph_global_info_ready)
varpool_assemble_pending_decls ();
}
@@ -357,7 +353,13 @@ varpool_assemble_decl (struct varpool_node *node)
&& (TREE_CODE (decl) != VAR_DECL || !DECL_HAS_VALUE_EXPR_P (decl)))
{
assemble_variable (decl, 0, 1, 0);
- return TREE_ASM_WRITTEN (decl);
+ if (TREE_ASM_WRITTEN (decl))
+ {
+ node->next_needed = varpool_assembled_nodes_queue;
+ varpool_assembled_nodes_queue = node;
+ node->finalized = 1;
+ return true;
+ }
}
return false;
@@ -423,12 +425,7 @@ varpool_assemble_pending_decls (void)
varpool_nodes_queue = varpool_nodes_queue->next_needed;
if (varpool_assemble_decl (node))
- {
- changed = true;
- node->next_needed = varpool_assembled_nodes_queue;
- varpool_assembled_nodes_queue = node;
- node->finalized = 1;
- }
+ changed = true;
else
node->next_needed = NULL;
}
@@ -438,6 +435,26 @@ varpool_assemble_pending_decls (void)
return changed;
}
+/* Remove all elements from the queue so we can re-use it for debug output. */
+void
+varpool_empty_needed_queue (void)
+{
+ /* EH might mark decls as needed during expansion. This should be safe since
+ we don't create references to new function, but it should not be used
+ elsewhere. */
+ varpool_analyze_pending_decls ();
+
+ while (varpool_nodes_queue)
+ {
+ struct varpool_node *node = varpool_nodes_queue;
+ varpool_nodes_queue = varpool_nodes_queue->next_needed;
+ node->next_needed = NULL;
+ }
+ /* varpool_nodes_queue is now empty, clear the pointer to the last element
+ in the queue. */
+ varpool_last_needed_node = NULL;
+}
+
/* Output all variables enqueued to be assembled. */
void
varpool_output_debug_info (void)
diff --git a/gnattools/ChangeLog b/gnattools/ChangeLog
index 3c6d39f6ef0..169a0143f99 100644
--- a/gnattools/ChangeLog
+++ b/gnattools/ChangeLog
@@ -1,3 +1,31 @@
+2008-08-01 Paolo Bonzini <bonzini@gnu.org>
+
+ * configure.ac (warn_cflags): Substitute.
+ * configure: Regenerate.
+ * Makefile.in (libdir, exeext, WARN_CFLAGS): Substitute.
+ (GCC_WARN_CFLAGS): Remove NOCOMMON_FLAG.
+ (ADA_INCLUDE_DIR, ADA_RTL_OBJ_DIR): Remove as they were unused.
+ (libsubdir): Remove.
+ (libada-mk): Do not include. Include libgcc.mvars instead.
+ (xmake_file): Remove, do not include.
+
+2008-07-30 Paolo Bonzini <bonzini@gnu.org>
+
+ * configure.ac (x_ada_cflags): Remove.
+ (ADA_CFLAGS): Substitute.
+ * configure: Regenerate.
+ * Makefile.in (ADA_CFLAGS): Substitute.
+ (T_ADA_CFLAGS, X_ADA_CFLAGS, ALL_ADA_CFLAGS): Remove.
+ (TOOLS_FLAGS_TO_PASS_1, TOOLS_FLAGS_TO_PASS_1re,
+ TOOLS_FLAGS_TO_PASS_NATIVE, TOOLS_FLAGS_TO_PASS_CROSS):
+ Pass ADA_CFLAGS.
+
+2008-07-30 Laurent Guerby <laurent@guerby.net>
+
+ PR ada/5911
+ * gnattools/Makefile.in: Replace stamp-gnatlib by
+ stamp-gnatlib-rts.
+
2008-06-26 Chris Proctor <chrisp_42@bigpond.com>
* configure.ac, configure: Fix target specific pairs.
diff --git a/gnattools/Makefile.in b/gnattools/Makefile.in
index efc5f7575f0..ed40ba54411 100644
--- a/gnattools/Makefile.in
+++ b/gnattools/Makefile.in
@@ -21,6 +21,7 @@ all: gnattools
# Standard autoconf-set variables.
SHELL = @SHELL@
srcdir = @srcdir@
+libdir = @libdir@
build = @build@
target = @target@
prefix = @prefix@
@@ -33,6 +34,7 @@ LN_S=@LN_S@
target_noncanonical=@target_noncanonical@
# Variables for the user (or the top level) to override.
+exeext = @EXEEXT@
objext=.o
TRACE=no
ADA_FOR_BUILD=
@@ -43,31 +45,16 @@ PWD_COMMAND = $${PWDCMD-pwd}
# The tedious process of getting CFLAGS right.
CFLAGS=-g
LOOSE_WARN = -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes
-GCC_WARN_CFLAGS = $(LOOSE_WARN) $(NOCOMMON_FLAG)
+GCC_WARN_CFLAGS = $(LOOSE_WARN)
+WARN_CFLAGS = @warn_cflags@
-ADA_CFLAGS=
-T_ADA_CFLAGS=
-# HPPA is literally the only target which sets X_ADA_CFLAGS
-X_ADA_CFLAGS=@x_ada_cflags@
-ALL_ADA_CFLAGS=$(X_ADA_CFLAGS) $(T_ADA_CFLAGS) $(ADA_CFLAGS)
+ADA_CFLAGS=@ADA_CFLAGS@
# Variables for gnattools.
ADAFLAGS= -gnatpg -gnata
-ADA_INCLUDE_DIR = $(libsubdir)/adainclude
-ADA_RTL_OBJ_DIR = $(libsubdir)/adalib
# For finding the GCC build dir, which is used far too much
GCC_DIR=../gcc
-# Include fragment generated by GCC configure; shared with libada for now.
-include $(GCC_DIR)/libada-mk
-# Variables based on those gleaned from the GCC makefile. :-P
-libsubdir=$(libdir)/gcc/$(target_noncanonical)/$(gcc_version)
-
-# Get possible host-specific override for libsubdir (ick).
-xmake_file=$(subst /config,/../gcc/config,$(gcc_xmake_file))
-ifneq ($(xmake_file),)
-include $(xmake_file)
-endif
# Absolute srcdir for gcc/ada (why do we want absolute? I dunno)
fsrcdir := $(shell cd $(srcdir)/../gcc/ada/; ${PWD_COMMAND})
@@ -83,6 +70,7 @@ TOOLS_FLAGS_TO_PASS_1= \
"CFLAGS=$(CFLAGS) $(WARN_CFLAGS)" \
"LDFLAGS=$(LDFLAGS)" \
"ADAFLAGS=$(ADAFLAGS)" \
+ "ADA_CFLAGS=$(ADA_CFLAGS)" \
"INCLUDES=$(INCLUDES_FOR_SUBDIR)" \
"ADA_INCLUDES=-I- -I../rts $(ADA_INCLUDES_FOR_SUBDIR)"\
"exeext=$(exeext)" \
@@ -96,6 +84,7 @@ TOOLS_FLAGS_TO_PASS_1re= \
"CC=../../xgcc -B../../" \
"CFLAGS=$(CFLAGS)" \
"ADAFLAGS=$(ADAFLAGS)" \
+ "ADA_CFLAGS=$(ADA_CFLAGS)" \
"INCLUDES=$(INCLUDES_FOR_SUBDIR)" \
"ADA_INCLUDES=-I../rts $(ADA_INCLUDES_FOR_SUBDIR)"\
"exeext=$(exeext)" \
@@ -112,6 +101,7 @@ TOOLS_FLAGS_TO_PASS_NATIVE= \
"CC=../../xgcc -B../../" \
"CFLAGS=$(CFLAGS)" \
"ADAFLAGS=$(ADAFLAGS)" \
+ "ADA_CFLAGS=$(ADA_CFLAGS)" \
"INCLUDES=$(INCLUDES_FOR_SUBDIR)" \
"ADA_INCLUDES=-I../rts $(ADA_INCLUDES_FOR_SUBDIR)" \
"exeext=$(exeext)" \
@@ -128,6 +118,7 @@ TOOLS_FLAGS_TO_PASS_CROSS= \
"CFLAGS=$(CFLAGS) $(WARN_CFLAGS)" \
"LDFLAGS=$(LDFLAGS)" \
"ADAFLAGS=$(ADAFLAGS)" \
+ "ADA_CFLAGS=$(ADA_CFLAGS)" \
"INCLUDES=$(INCLUDES_FOR_SUBDIR)" \
"ADA_INCLUDES=-I$(RTS_DIR)../adainclude -I$(RTS_DIR) $(ADA_INCLUDES_FOR_SUBDIR)" \
"exeext=$(exeext)" \
@@ -153,8 +144,8 @@ TOOLS_TARGET_PAIRS = @TOOLS_TARGET_PAIRS@
gnattools: @default_gnattools_target@
# Sanity check
-$(GCC_DIR)/stamp-gnatlib:
- @if [ ! -f $(GCC_DIR)/stamp-gnatlib ] ; \
+$(GCC_DIR)/stamp-gnatlib-rts:
+ @if [ ! -f $(GCC_DIR)/stamp-gnatlib-rts ] ; \
then \
echo "Cannot build gnattools while gnatlib is out of date or unbuilt" ; \
false; \
@@ -183,7 +174,7 @@ $(GCC_DIR)/stamp-tools:
# to be able to build gnatmake without a version of gnatmake around. Once
# everything has been compiled once, gnatmake can be recompiled with itself
# (see target regnattools)
-gnattools-native: $(GCC_DIR)/stamp-tools $(GCC_DIR)/stamp-gnatlib
+gnattools-native: $(GCC_DIR)/stamp-tools $(GCC_DIR)/stamp-gnatlib-rts
# gnattools1
$(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \
$(TOOLS_FLAGS_TO_PASS_1) \
@@ -195,7 +186,7 @@ gnattools-native: $(GCC_DIR)/stamp-tools $(GCC_DIR)/stamp-gnatlib
# gnatmake/link can be built with recent gnatmake/link if they are available.
# This is especially convenient for building cross tools or for rebuilding
# the tools when the original bootstrap has already be done.
-regnattools: $(GCC_DIR)/stamp-gnatlib
+regnattools: $(GCC_DIR)/stamp-gnatlib-rts
# gnattools1-re
$(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \
$(TOOLS_FLAGS_TO_PASS_1re) \
diff --git a/gnattools/configure b/gnattools/configure
index de26ec95b2e..7e5513b0118 100755
--- a/gnattools/configure
+++ b/gnattools/configure
@@ -272,7 +272,7 @@ PACKAGE_STRING=
PACKAGE_BUGREPORT=
ac_unique_file="Makefile.in"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS MAINT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os target_noncanonical LN_S x_ada_cflags default_gnattools_target TOOLS_TARGET_PAIRS EXTRA_GNATTOOLS LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS MAINT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os target_noncanonical LN_S default_gnattools_target TOOLS_TARGET_PAIRS EXTRA_GNATTOOLS ADA_CFLAGS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT warn_cflags LIBOBJS LTLIBOBJS'
ac_subst_files=''
ac_pwd=`pwd`
@@ -714,6 +714,22 @@ ac_env_target_alias_set=${target_alias+set}
ac_env_target_alias_value=$target_alias
ac_cv_env_target_alias_set=${target_alias+set}
ac_cv_env_target_alias_value=$target_alias
+ac_env_CC_set=${CC+set}
+ac_env_CC_value=$CC
+ac_cv_env_CC_set=${CC+set}
+ac_cv_env_CC_value=$CC
+ac_env_CFLAGS_set=${CFLAGS+set}
+ac_env_CFLAGS_value=$CFLAGS
+ac_cv_env_CFLAGS_set=${CFLAGS+set}
+ac_cv_env_CFLAGS_value=$CFLAGS
+ac_env_LDFLAGS_set=${LDFLAGS+set}
+ac_env_LDFLAGS_value=$LDFLAGS
+ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
+ac_cv_env_LDFLAGS_value=$LDFLAGS
+ac_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_env_CPPFLAGS_value=$CPPFLAGS
+ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_cv_env_CPPFLAGS_value=$CPPFLAGS
#
# Report the --help message.
@@ -793,6 +809,17 @@ Optional Features:
enable make rules and dependencies not useful (and
sometimes confusing) to the casual installer
+Some influential environment variables:
+ CC C compiler command
+ CFLAGS C compiler flags
+ LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
+ nonstandard directory <lib dir>
+ CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
+ headers in a nonstandard directory <include dir>
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
_ACEOF
fi
@@ -1484,13 +1511,6 @@ echo "${ECHO_T}no, using $LN_S" >&6
fi
-# Determine x_ada_cflags
-case $host in
- hppa*) x_ada_cflags=-mdisable-indexing ;;
- *) x_ada_cflags= ;;
-esac
-
-
# Determine what to build for 'gnattools'
if test $build = $target ; then
# Note that build=target is almost certainly the wrong test; FIXME
@@ -1593,6 +1613,955 @@ case "${target}" in
;;
esac
+# From user or toplevel makefile.
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}gcc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="gcc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ CC=$ac_ct_CC
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ CC=$ac_ct_CC
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+fi
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# != 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+ fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in cl
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ test -n "$CC" && break
+ done
+fi
+if test -z "$CC"; then
+ ac_ct_CC=$CC
+ for ac_prog in cl
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ test -n "$ac_ct_CC" && break
+done
+
+ CC=$ac_ct_CC
+fi
+
+fi
+
+
+test -z "$CC" && { { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }; }
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO:" \
+ "checking for C compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
+ (eval $ac_compiler --version </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
+ (eval $ac_compiler -v </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
+ (eval $ac_compiler -V </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
+echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6
+ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
+ (eval $ac_link_default) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # Find the output, starting from the most likely. This scheme is
+# not robust to junk in `.', hence go to wildcards (a.*) only as a last
+# resort.
+
+# Be careful to initialize this variable, since it used to be cached.
+# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
+ac_cv_exeext=
+# b.out is created by i960 compilers.
+for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
+do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
+ ;;
+ conftest.$ac_ext )
+ # This is the source file.
+ ;;
+ [ab].out )
+ # We found the default executable, but exeext='' is most
+ # certainly right.
+ break;;
+ *.* )
+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ # FIXME: I believe we export ac_cv_exeext for Libtool,
+ # but it would be cool to find out if it's true. Does anybody
+ # maintain Libtool? --akim.
+ export ac_cv_exeext
+ break;;
+ * )
+ break;;
+ esac
+done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
+See \`config.log' for more details." >&5
+echo "$as_me: error: C compiler cannot create executables
+See \`config.log' for more details." >&2;}
+ { (exit 77); exit 77; }; }; }
+fi
+
+ac_exeext=$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6
+
+# Check the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
+# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+ if { ac_try='./$ac_file'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }; }
+ fi
+ fi
+fi
+echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+rm -f a.out a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+# Check the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
+echo "$as_me:$LINENO: result: $cross_compiling" >&5
+echo "${ECHO_T}$cross_compiling" >&6
+
+echo "$as_me:$LINENO: checking for suffix of executables" >&5
+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ export ac_cv_exeext
+ break;;
+ * ) break;;
+ esac
+done
+else
+ { { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }; }
+fi
+
+rm -f conftest$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+echo "${ECHO_T}$ac_cv_exeext" >&6
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+echo "$as_me:$LINENO: checking for suffix of object files" >&5
+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
+if test "${ac_cv_objext+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+ break;;
+ esac
+done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }; }
+fi
+
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+echo "${ECHO_T}$ac_cv_objext" >&6
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_compiler_gnu=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_compiler_gnu=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
+GCC=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+CFLAGS="-g"
+echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_g+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_g=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_prog_cc_g=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
+echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_stdc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_prog_cc_stdc=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
+ function prototypes and stuff, but not '\xHH' hex character constants.
+ These don't provoke an error unfortunately, instead are silently treated
+ as 'x'. The following induces an error, until -std1 is added to get
+ proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
+ array size at least. It's necessary to write '\x00'==0 to get something
+ that's true only with -std1. */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+ ;
+ return 0;
+}
+_ACEOF
+# Don't try gcc -ansi; that turns off useful extensions and
+# breaks some systems' header files.
+# AIX -qlanglvl=ansi
+# Ultrix and OSF/1 -std1
+# HP-UX 10.20 and later -Ae
+# HP-UX older versions -Aa -D_HPUX_SOURCE
+# SVR4 -Xc -D__EXTENSIONS__
+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_stdc=$ac_arg
+break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext
+done
+rm -f conftest.$ac_ext conftest.$ac_objext
+CC=$ac_save_CC
+
+fi
+
+case "x$ac_cv_prog_cc_stdc" in
+ x|xno)
+ echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6 ;;
+ *)
+ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
+ CC="$CC $ac_cv_prog_cc_stdc" ;;
+esac
+
+# Some people use a C++ compiler to compile C. Since we use `exit',
+# in C++ we need to declare it. In case someone uses the same compiler
+# for both compiling C and C++ we need to have the C++ compiler decide
+# the declaration of exit, since it's the most demanding environment.
+cat >conftest.$ac_ext <<_ACEOF
+#ifndef __cplusplus
+ choke me
+#endif
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ for ac_declaration in \
+ '' \
+ 'extern "C" void std::exit (int) throw (); using std::exit;' \
+ 'extern "C" void std::exit (int); using std::exit;' \
+ 'extern "C" void exit (int) throw ();' \
+ 'extern "C" void exit (int);' \
+ 'void exit (int);'
+do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_declaration
+#include <stdlib.h>
+int
+main ()
+{
+exit (42);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+continue
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_declaration
+int
+main ()
+{
+exit (42);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+rm -f conftest*
+if test -n "$ac_declaration"; then
+ echo '#ifdef __cplusplus' >>confdefs.h
+ echo $ac_declaration >>confdefs.h
+ echo '#endif' >>confdefs.h
+fi
+
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+warn_cflags=
+if test "x$GCC" = "xyes"; then
+ warn_cflags='$(GCC_WARN_CFLAGS)'
+fi
+
+
# Output: create a Makefile.
ac_config_files="$ac_config_files Makefile"
@@ -2250,10 +3219,18 @@ s,@target_vendor@,$target_vendor,;t t
s,@target_os@,$target_os,;t t
s,@target_noncanonical@,$target_noncanonical,;t t
s,@LN_S@,$LN_S,;t t
-s,@x_ada_cflags@,$x_ada_cflags,;t t
s,@default_gnattools_target@,$default_gnattools_target,;t t
s,@TOOLS_TARGET_PAIRS@,$TOOLS_TARGET_PAIRS,;t t
s,@EXTRA_GNATTOOLS@,$EXTRA_GNATTOOLS,;t t
+s,@ADA_CFLAGS@,$ADA_CFLAGS,;t t
+s,@CC@,$CC,;t t
+s,@CFLAGS@,$CFLAGS,;t t
+s,@LDFLAGS@,$LDFLAGS,;t t
+s,@CPPFLAGS@,$CPPFLAGS,;t t
+s,@ac_ct_CC@,$ac_ct_CC,;t t
+s,@EXEEXT@,$EXEEXT,;t t
+s,@OBJEXT@,$OBJEXT,;t t
+s,@warn_cflags@,$warn_cflags,;t t
s,@LIBOBJS@,$LIBOBJS,;t t
s,@LTLIBOBJS@,$LTLIBOBJS,;t t
CEOF
diff --git a/gnattools/configure.ac b/gnattools/configure.ac
index cd5e8402bd9..ac0c6926633 100644
--- a/gnattools/configure.ac
+++ b/gnattools/configure.ac
@@ -51,13 +51,6 @@ ACX_NONCANONICAL_TARGET
# Need to pass this down for now :-P
AC_PROG_LN_S
-# Determine x_ada_cflags
-case $host in
- hppa*) x_ada_cflags=-mdisable-indexing ;;
- *) x_ada_cflags= ;;
-esac
-AC_SUBST([x_ada_cflags])
-
# Determine what to build for 'gnattools'
if test $build = $target ; then
# Note that build=target is almost certainly the wrong test; FIXME
@@ -160,6 +153,16 @@ case "${target}" in
;;
esac
+# From user or toplevel makefile.
+AC_SUBST(ADA_CFLAGS)
+
+AC_PROG_CC
+warn_cflags=
+if test "x$GCC" = "xyes"; then
+ warn_cflags='$(GCC_WARN_CFLAGS)'
+fi
+AC_SUBST(warn_cflags)
+
# Output: create a Makefile.
AC_CONFIG_FILES([Makefile])
diff --git a/libada/ChangeLog b/libada/ChangeLog
index bf20ed52d24..c95c7342a5d 100644
--- a/libada/ChangeLog
+++ b/libada/ChangeLog
@@ -1,3 +1,35 @@
+2008-08-06 Thomas Quinot <quinot@adacore.com>
+
+ * Makefile.in: generate s-oscons.ads again, previous change was
+ unneeded.
+
+2008-08-06 Samuel Tardieu <sam@rfc1149.net>
+
+ * Makefile.in: Pass FLAGS_TO_PASS to sub-make for target
+ oscons.
+
+2008-08-06 Thomas Quinot <quinot@adacore.com>
+
+ * Makefile.in: Now generate s-oscons-$(THREAD_KIND).
+
+2008-08-05 Thomas Quinot <quinot@adacore.com>
+
+ * Makefile.in (gnatlib*): Now depend on oscons target.
+ (oscons): New target.
+
+2008-08-01 Paolo Bonzini <bonzini@gnu.org>
+
+ * configure.ac (warn_cflags): Substitute.
+ * configure: Regenerate.
+ * Makefile.in (libdir, WARN_CFLAGS): Substitute.
+ (GCC_WARN_CFLAGS): Remove NOCOMMON_FLAG.
+ (ADA_CFLAGS, T_ADA_CFLAGS, X_ADA_CFLAGS, ALL_ADA_CFLAGS): Remove,
+ they were unused.
+ (libada-mk): Do not include. Include libgcc.mvars instead.
+ (tmake_file): Remove, do not include.
+ (FLAGS_TO_PASS): Pass dummy values for exeext and CC.
+ * configure: Regenerate.
+
2008-06-17 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* configure.ac: move sinclude of acx.m4 before AC_INIT,
diff --git a/libada/Makefile.in b/libada/Makefile.in
index 23d6713a5b3..01759f36881 100644
--- a/libada/Makefile.in
+++ b/libada/Makefile.in
@@ -21,6 +21,7 @@ all: gnatlib
# Standard autoconf-set variables.
SHELL = @SHELL@
srcdir = @srcdir@
+libdir = @libdir@
build = @build@
target = @target@
prefix = @prefix@
@@ -39,49 +40,38 @@ LDFLAGS=
# The tedious process of getting CFLAGS right.
CFLAGS=-g
LOOSE_WARN = -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes
-GCC_WARN_CFLAGS = $(LOOSE_WARN) $(NOCOMMON_FLAG)
+GCC_WARN_CFLAGS = $(LOOSE_WARN)
+WARN_CFLAGS = @warn_cflags@
-ADA_CFLAGS=
-T_ADA_CFLAGS=
-# HPPA is literally the only target which sets X_ADA_CFLAGS
-X_ADA_CFLAGS=@x_ada_cflags@
-ALL_ADA_CFLAGS=$(X_ADA_CFLAGS) $(T_ADA_CFLAGS) $(ADA_CFLAGS)
+TARGET_LIBGCC2_CFLAGS=
+GNATLIBCFLAGS= -g -O2
-# For finding the GCC build dir, which is used far too much
+# Get target-specific overrides for TARGET_LIBGCC2_CFLAGS.
host_subdir = @host_subdir@
GCC_DIR=../../$(host_subdir)/gcc
-# Include fragment generated by GCC configure.
-include $(GCC_DIR)/libada-mk
-
-TARGET_LIBGCC2_CFLAGS=
-GNATLIBCFLAGS= -g -O2
-# Get target-specific overrides for TARGET_LIBGCC2_CFLAGS
-# and possibly GNATLIBCFLAGS. Currently this uses files
-# in gcc/config. The 'subst' call is used to rerelativize them
-# from their gcc locations. This is hackery, but there isn't
-# yet a better way to do this.
-tmake_file=$(subst /config,/../gcc/config,$(gcc_tmake_file))
-ifneq ($(tmake_file),)
-include $(tmake_file)
-endif
+include $(GCC_DIR)/libgcc.mvars
+# exeext should not be used because it's the *host* exeext. We're building
+# a *target* library, aren't we?!? Likewise for CC. Still, provide bogus
+# definitions just in case something slips through the safety net provided
+# by recursive make invocations in gcc/ada/Makefile.in
FLAGS_TO_PASS = \
"MAKEOVERRIDES=" \
"LDFLAGS=$(LDFLAGS)" \
"LN_S=$(LN_S)" \
"SHELL=$(SHELL)" \
- "exeext=$(exeext)" \
"objext=$(objext)" \
"prefix=$(prefix)" \
- "CC=$(host_cc_for_libada)" \
+ "exeext=.exeext.should.not.be.used " \
+ 'CC=the.host.compiler.should.not.be.needed' \
"GCC_FOR_TARGET=$(CC)" \
"CFLAGS=$(CFLAGS) $(WARN_CFLAGS)"
# Rules to build gnatlib.
-.PHONY: gnatlib gnatlib-plain gnatlib-sjlj gnatlib-zcx gnatlib-shared
+.PHONY: gnatlib gnatlib-plain gnatlib-sjlj gnatlib-zcx gnatlib-shared oscons
gnatlib: @default_gnatlib_target@
-gnatlib-plain: $(GCC_DIR)/ada/Makefile
+gnatlib-plain: oscons $(GCC_DIR)/ada/Makefile
test -f stamp-libada || \
$(MAKE) -C $(GCC_DIR)/ada $(FLAGS_TO_PASS) \
GNATLIBFLAGS="$(GNATLIBFLAGS)" \
@@ -92,7 +82,7 @@ gnatlib-plain: $(GCC_DIR)/ada/Makefile
gnatlib \
&& touch stamp-libada
-gnatlib-sjlj gnatlib-zcx gnatlib-shared: $(GCC_DIR)/ada/Makefile
+gnatlib-sjlj gnatlib-zcx gnatlib-shared: oscons $(GCC_DIR)/ada/Makefile
test -f stamp-libada || \
$(MAKE) -C $(GCC_DIR)/ada $(FLAGS_TO_PASS) \
GNATLIBFLAGS="$(GNATLIBFLAGS)" \
@@ -103,6 +93,10 @@ gnatlib-sjlj gnatlib-zcx gnatlib-shared: $(GCC_DIR)/ada/Makefile
$@ \
&& touch stamp-libada
+oscons:
+ $(MAKE) -C $(GCC_DIR) THREAD_KIND="$(THREAD_KIND)" \
+ $(FLAGS_TO_PASS) ada/s-oscons.ads
+
# Check uninstalled version.
check:
diff --git a/libada/configure b/libada/configure
index 1d821c407ea..cafd0f0bda3 100755
--- a/libada/configure
+++ b/libada/configure
@@ -272,7 +272,7 @@ PACKAGE_STRING=
PACKAGE_BUGREPORT=
ac_unique_file="Makefile.in"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os target_noncanonical build_libsubdir build_subdir host_subdir target_subdir MAINT enable_shared LN_S x_ada_cflags default_gnatlib_target LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os target_noncanonical build_libsubdir build_subdir host_subdir target_subdir MAINT enable_shared LN_S x_ada_cflags default_gnatlib_target CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT warn_cflags LIBOBJS LTLIBOBJS'
ac_subst_files=''
ac_pwd=`pwd`
@@ -714,6 +714,22 @@ ac_env_target_alias_set=${target_alias+set}
ac_env_target_alias_value=$target_alias
ac_cv_env_target_alias_set=${target_alias+set}
ac_cv_env_target_alias_value=$target_alias
+ac_env_CC_set=${CC+set}
+ac_env_CC_value=$CC
+ac_cv_env_CC_set=${CC+set}
+ac_cv_env_CC_value=$CC
+ac_env_CFLAGS_set=${CFLAGS+set}
+ac_env_CFLAGS_value=$CFLAGS
+ac_cv_env_CFLAGS_set=${CFLAGS+set}
+ac_cv_env_CFLAGS_value=$CFLAGS
+ac_env_LDFLAGS_set=${LDFLAGS+set}
+ac_env_LDFLAGS_value=$LDFLAGS
+ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
+ac_cv_env_LDFLAGS_value=$LDFLAGS
+ac_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_env_CPPFLAGS_value=$CPPFLAGS
+ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_cv_env_CPPFLAGS_value=$CPPFLAGS
#
# Report the --help message.
@@ -799,6 +815,17 @@ Optional Packages:
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-build-libsubdir=DIR Directory where to find libraries for build system
+Some influential environment variables:
+ CC C compiler command
+ CFLAGS C compiler flags
+ LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
+ nonstandard directory <lib dir>
+ CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
+ headers in a nonstandard directory <include dir>
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
_ACEOF
fi
@@ -1483,6 +1510,952 @@ else
fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}gcc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="gcc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ CC=$ac_ct_CC
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ CC=$ac_ct_CC
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+fi
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# != 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+ fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in cl
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ test -n "$CC" && break
+ done
+fi
+if test -z "$CC"; then
+ ac_ct_CC=$CC
+ for ac_prog in cl
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ test -n "$ac_ct_CC" && break
+done
+
+ CC=$ac_ct_CC
+fi
+
+fi
+
+
+test -z "$CC" && { { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }; }
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO:" \
+ "checking for C compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
+ (eval $ac_compiler --version </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
+ (eval $ac_compiler -v </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
+ (eval $ac_compiler -V </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
+echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6
+ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
+ (eval $ac_link_default) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # Find the output, starting from the most likely. This scheme is
+# not robust to junk in `.', hence go to wildcards (a.*) only as a last
+# resort.
+
+# Be careful to initialize this variable, since it used to be cached.
+# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
+ac_cv_exeext=
+# b.out is created by i960 compilers.
+for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
+do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
+ ;;
+ conftest.$ac_ext )
+ # This is the source file.
+ ;;
+ [ab].out )
+ # We found the default executable, but exeext='' is most
+ # certainly right.
+ break;;
+ *.* )
+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ # FIXME: I believe we export ac_cv_exeext for Libtool,
+ # but it would be cool to find out if it's true. Does anybody
+ # maintain Libtool? --akim.
+ export ac_cv_exeext
+ break;;
+ * )
+ break;;
+ esac
+done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
+See \`config.log' for more details." >&5
+echo "$as_me: error: C compiler cannot create executables
+See \`config.log' for more details." >&2;}
+ { (exit 77); exit 77; }; }; }
+fi
+
+ac_exeext=$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6
+
+# Check the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
+# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+ if { ac_try='./$ac_file'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }; }
+ fi
+ fi
+fi
+echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+rm -f a.out a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+# Check the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
+echo "$as_me:$LINENO: result: $cross_compiling" >&5
+echo "${ECHO_T}$cross_compiling" >&6
+
+echo "$as_me:$LINENO: checking for suffix of executables" >&5
+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ export ac_cv_exeext
+ break;;
+ * ) break;;
+ esac
+done
+else
+ { { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }; }
+fi
+
+rm -f conftest$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+echo "${ECHO_T}$ac_cv_exeext" >&6
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+echo "$as_me:$LINENO: checking for suffix of object files" >&5
+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
+if test "${ac_cv_objext+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+ break;;
+ esac
+done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }; }
+fi
+
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+echo "${ECHO_T}$ac_cv_objext" >&6
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_compiler_gnu=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_compiler_gnu=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
+GCC=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+CFLAGS="-g"
+echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_g+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_g=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_prog_cc_g=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
+echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_stdc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_prog_cc_stdc=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
+ function prototypes and stuff, but not '\xHH' hex character constants.
+ These don't provoke an error unfortunately, instead are silently treated
+ as 'x'. The following induces an error, until -std1 is added to get
+ proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
+ array size at least. It's necessary to write '\x00'==0 to get something
+ that's true only with -std1. */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+ ;
+ return 0;
+}
+_ACEOF
+# Don't try gcc -ansi; that turns off useful extensions and
+# breaks some systems' header files.
+# AIX -qlanglvl=ansi
+# Ultrix and OSF/1 -std1
+# HP-UX 10.20 and later -Ae
+# HP-UX older versions -Aa -D_HPUX_SOURCE
+# SVR4 -Xc -D__EXTENSIONS__
+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_stdc=$ac_arg
+break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext
+done
+rm -f conftest.$ac_ext conftest.$ac_objext
+CC=$ac_save_CC
+
+fi
+
+case "x$ac_cv_prog_cc_stdc" in
+ x|xno)
+ echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6 ;;
+ *)
+ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
+ CC="$CC $ac_cv_prog_cc_stdc" ;;
+esac
+
+# Some people use a C++ compiler to compile C. Since we use `exit',
+# in C++ we need to declare it. In case someone uses the same compiler
+# for both compiling C and C++ we need to have the C++ compiler decide
+# the declaration of exit, since it's the most demanding environment.
+cat >conftest.$ac_ext <<_ACEOF
+#ifndef __cplusplus
+ choke me
+#endif
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ for ac_declaration in \
+ '' \
+ 'extern "C" void std::exit (int) throw (); using std::exit;' \
+ 'extern "C" void std::exit (int); using std::exit;' \
+ 'extern "C" void exit (int) throw ();' \
+ 'extern "C" void exit (int);' \
+ 'void exit (int);'
+do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_declaration
+#include <stdlib.h>
+int
+main ()
+{
+exit (42);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+continue
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_declaration
+int
+main ()
+{
+exit (42);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+rm -f conftest*
+if test -n "$ac_declaration"; then
+ echo '#ifdef __cplusplus' >>confdefs.h
+ echo $ac_declaration >>confdefs.h
+ echo '#endif' >>confdefs.h
+fi
+
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+warn_cflags=
+if test "x$GCC" = "xyes"; then
+ warn_cflags='$(GCC_WARN_CFLAGS)'
+fi
+
+
# Output: create a Makefile.
ac_config_files="$ac_config_files Makefile"
@@ -2143,6 +3116,14 @@ s,@enable_shared@,$enable_shared,;t t
s,@LN_S@,$LN_S,;t t
s,@x_ada_cflags@,$x_ada_cflags,;t t
s,@default_gnatlib_target@,$default_gnatlib_target,;t t
+s,@CC@,$CC,;t t
+s,@CFLAGS@,$CFLAGS,;t t
+s,@LDFLAGS@,$LDFLAGS,;t t
+s,@CPPFLAGS@,$CPPFLAGS,;t t
+s,@ac_ct_CC@,$ac_ct_CC,;t t
+s,@EXEEXT@,$EXEEXT,;t t
+s,@OBJEXT@,$OBJEXT,;t t
+s,@warn_cflags@,$warn_cflags,;t t
s,@LIBOBJS@,$LIBOBJS,;t t
s,@LTLIBOBJS@,$LTLIBOBJS,;t t
CEOF
diff --git a/libada/configure.ac b/libada/configure.ac
index a2668125d8e..b0a46d00332 100644
--- a/libada/configure.ac
+++ b/libada/configure.ac
@@ -73,13 +73,6 @@ AC_SUBST([enable_shared])
# Need to pass this down for now :-P
AC_PROG_LN_S
-# Determine x_ada_cflags
-case $host in
- hppa*) x_ada_cflags=-mdisable-indexing ;;
- *) x_ada_cflags= ;;
-esac
-AC_SUBST([x_ada_cflags])
-
# Determine what to build for 'gnatlib'
if test $build = $target \
&& test ${enable_shared} = yes ; then
@@ -90,6 +83,13 @@ else
fi
AC_SUBST([default_gnatlib_target])
+AC_PROG_CC
+warn_cflags=
+if test "x$GCC" = "xyes"; then
+ warn_cflags='$(GCC_WARN_CFLAGS)'
+fi
+AC_SUBST(warn_cflags)
+
# Output: create a Makefile.
AC_CONFIG_FILES([Makefile])
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index 9b3b53e25de..49efadc94c6 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,3 +1,41 @@
+2008-07-31 Jakub Jelinek <jakub@redhat.com>
+
+ PR preprocessor/36649
+ * files.c (struct report_missing_guard_data): New type.
+ (report_missing_guard): Put paths into an array instead of printing
+ them right away. Return 1 rather than 0.
+ (report_missing_guard_cmp): New function.
+ (_cpp_report_missing_guards): Sort and print paths gathered by
+ report_missing_guard callback.
+
+2008-07-22 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR 28079
+ * directives.c (strtolinenum): Handle overflow.
+ (do_line): Give a warning if line number overflowed.
+ (do_linemarker): Update call to strtolinenum.
+
+2008-07-21 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ * include/line-map.h (linenum_type): New typedef.
+ (struct line_map): Use it.
+ (SOURCE_LINE): Second arguments is a LOCATION not a LINE.
+ (SOURCE_COLUMN): Likewise.
+ * macro.c (_cpp_builtin_macro_text): Use linenum_type. Don't store
+ source_location values in a variable of type linenum_type.
+ * directives.c (struct if_stack): Use linenum_type.
+ (strtoul_for_line): Rename as strtolinenum.
+ (do_line): Use linenum_type.
+ (do_linemarker): Use linenum_type and strtolinenum.
+ (_cpp_do_file_change): Use linenum_t.
+ * line-map.c (linemap_add): Likewise.
+ (linemap_line_start): Likewise.
+ * traditional.c (struct fun_macro): 'line' is a source_location.
+ * errors.c (print_location): Use linenum_type.
+ * directives-only.c (_cpp_preprocess_dir_only): Likewise.
+ * internal.h (CPP_INCREMENT_LINE): Likewise.
+ * lex.c (_cpp_skip_block_comment): Use source_location.
+
2008-07-14 Ben Elliston <bje@au.ibm.com>
* include/cpplib.h (NODE_CONDITIONAL): New.
diff --git a/libcpp/directives-only.c b/libcpp/directives-only.c
index d50cebbdae3..addd9a755dc 100644
--- a/libcpp/directives-only.c
+++ b/libcpp/directives-only.c
@@ -42,7 +42,8 @@ _cpp_preprocess_dir_only (cpp_reader *pfile,
const unsigned char *cur, *base, *next_line, *rlimit;
cppchar_t c, last_c;
unsigned flags;
- int lines, col;
+ linenum_type lines;
+ int col;
source_location loc;
restart:
diff --git a/libcpp/directives.c b/libcpp/directives.c
index 370f4ff5b0d..9e0744b23d9 100644
--- a/libcpp/directives.c
+++ b/libcpp/directives.c
@@ -32,7 +32,7 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
struct if_stack
{
struct if_stack *next;
- unsigned int line; /* Line where condition started. */
+ linenum_type line; /* Line where condition started. */
const cpp_hashnode *mi_cmacro;/* macro name for #ifndef around entire file */
bool skip_elses; /* Can future #else / #elif be skipped? */
bool was_skipping; /* If were skipping on entry. */
@@ -102,7 +102,7 @@ static char *glue_header_name (cpp_reader *);
static const char *parse_include (cpp_reader *, int *, const cpp_token ***);
static void push_conditional (cpp_reader *, int, int, const cpp_hashnode *);
static unsigned int read_flag (cpp_reader *, unsigned int);
-static int strtoul_for_line (const uchar *, unsigned int, unsigned long *);
+static bool strtolinenum (const uchar *, size_t, linenum_type *, bool *);
static void do_diagnostic (cpp_reader *, int, int);
static cpp_hashnode *lex_macro_node (cpp_reader *, bool);
static int undefine_macros (cpp_reader *, cpp_hashnode *, void *);
@@ -837,23 +837,30 @@ read_flag (cpp_reader *pfile, unsigned int last)
}
/* Subroutine of do_line and do_linemarker. Convert a number in STR,
- of length LEN, to binary; store it in NUMP, and return 0 if the
- number was well-formed, 1 if not. Temporary, hopefully. */
-static int
-strtoul_for_line (const uchar *str, unsigned int len, long unsigned int *nump)
+ of length LEN, to binary; store it in NUMP, and return false if the
+ number was well-formed, true if not. WRAPPED is set to true if the
+ number did not fit into 'unsigned long'. */
+static bool
+strtolinenum (const uchar *str, size_t len, linenum_type *nump, bool *wrapped)
{
- unsigned long reg = 0;
+ linenum_type reg = 0;
+ linenum_type reg_prev = 0;
+
uchar c;
+ *wrapped = false;
while (len--)
{
c = *str++;
if (!ISDIGIT (c))
- return 1;
+ return true;
reg *= 10;
reg += c - '0';
+ if (reg < reg_prev)
+ *wrapped = true;
+ reg_prev = reg;
}
*nump = reg;
- return 0;
+ return false;
}
/* Interpret #line command.
@@ -871,16 +878,17 @@ do_line (cpp_reader *pfile)
unsigned char map_sysp = map->sysp;
const cpp_token *token;
const char *new_file = map->to_file;
- unsigned long new_lineno;
+ linenum_type new_lineno;
/* C99 raised the minimum limit on #line numbers. */
- unsigned int cap = CPP_OPTION (pfile, c99) ? 2147483647 : 32767;
+ linenum_type cap = CPP_OPTION (pfile, c99) ? 2147483647 : 32767;
+ bool wrapped;
/* #line commands expand macros. */
token = cpp_get_token (pfile);
if (token->type != CPP_NUMBER
- || strtoul_for_line (token->val.str.text, token->val.str.len,
- &new_lineno))
+ || strtolinenum (token->val.str.text, token->val.str.len,
+ &new_lineno, &wrapped))
{
if (token->type == CPP_EOF)
cpp_error (pfile, CPP_DL_ERROR, "unexpected end of file after #line");
@@ -891,8 +899,10 @@ do_line (cpp_reader *pfile)
return;
}
- if (CPP_PEDANTIC (pfile) && (new_lineno == 0 || new_lineno > cap))
+ if (CPP_PEDANTIC (pfile) && (new_lineno == 0 || new_lineno > cap || wrapped))
cpp_error (pfile, CPP_DL_PEDWARN, "line number out of range");
+ else if (wrapped)
+ cpp_error (pfile, CPP_DL_WARNING, "line number out of range");
token = cpp_get_token (pfile);
if (token->type == CPP_STRING)
@@ -925,10 +935,11 @@ do_linemarker (cpp_reader *pfile)
const struct line_map *map = &line_table->maps[line_table->used - 1];
const cpp_token *token;
const char *new_file = map->to_file;
- unsigned long new_lineno;
+ linenum_type new_lineno;
unsigned int new_sysp = map->sysp;
enum lc_reason reason = LC_RENAME;
int flag;
+ bool wrapped;
/* Back up so we can get the number again. Putting this in
_cpp_handle_directive risks two calls to _cpp_backup_tokens in
@@ -938,8 +949,8 @@ do_linemarker (cpp_reader *pfile)
/* #line commands expand macros. */
token = cpp_get_token (pfile);
if (token->type != CPP_NUMBER
- || strtoul_for_line (token->val.str.text, token->val.str.len,
- &new_lineno))
+ || strtolinenum (token->val.str.text, token->val.str.len,
+ &new_lineno, &wrapped))
{
/* Unlike #line, there does not seem to be a way to get an EOF
here. So, it should be safe to always spell the token. */
@@ -999,7 +1010,7 @@ do_linemarker (cpp_reader *pfile)
and zero otherwise. */
void
_cpp_do_file_change (cpp_reader *pfile, enum lc_reason reason,
- const char *to_file, unsigned int file_line,
+ const char *to_file, linenum_type file_line,
unsigned int sysp)
{
const struct line_map *map = linemap_add (pfile->line_table, reason, sysp,
diff --git a/libcpp/errors.c b/libcpp/errors.c
index 5e8e637276d..e3d56292848 100644
--- a/libcpp/errors.c
+++ b/libcpp/errors.c
@@ -42,7 +42,7 @@ print_location (cpp_reader *pfile, source_location line, unsigned int col)
else
{
const struct line_map *map;
- unsigned int lin;
+ linenum_type lin;
map = linemap_lookup (pfile->line_table, line);
linemap_print_containing_files (pfile->line_table, map);
diff --git a/libcpp/files.c b/libcpp/files.c
index 1adc58d88a8..007fce77d53 100644
--- a/libcpp/files.c
+++ b/libcpp/files.c
@@ -1221,12 +1221,19 @@ cpp_change_file (cpp_reader *pfile, enum lc_reason reason,
_cpp_do_file_change (pfile, reason, new_name, 1, 0);
}
+struct report_missing_guard_data
+{
+ const char **paths;
+ size_t count;
+};
+
/* Callback function for htab_traverse. */
static int
-report_missing_guard (void **slot, void *b)
+report_missing_guard (void **slot, void *d)
{
struct file_hash_entry *entry = (struct file_hash_entry *) *slot;
- int *bannerp = (int *) b;
+ struct report_missing_guard_data *data
+ = (struct report_missing_guard_data *) d;
/* Skip directories. */
if (entry->start_dir != NULL)
@@ -1236,19 +1243,25 @@ report_missing_guard (void **slot, void *b)
/* We don't want MI guard advice for the main file. */
if (file->cmacro == NULL && file->stack_count == 1 && !file->main_file)
{
- if (*bannerp == 0)
+ if (data->paths == NULL)
{
- fputs (_("Multiple include guards may be useful for:\n"),
- stderr);
- *bannerp = 1;
+ data->paths = XCNEWVEC (const char *, data->count);
+ data->count = 0;
}
- fputs (entry->u.file->path, stderr);
- putc ('\n', stderr);
+ data->paths[data->count++] = file->path;
}
}
- return 0;
+ /* Keep traversing the hash table. */
+ return 1;
+}
+
+/* Comparison function for qsort. */
+static int
+report_missing_guard_cmp (const void *p1, const void *p2)
+{
+ return strcmp (*(const char *const *) p1, *(const char *const *) p2);
}
/* Report on all files that might benefit from a multiple include guard.
@@ -1256,9 +1269,29 @@ report_missing_guard (void **slot, void *b)
void
_cpp_report_missing_guards (cpp_reader *pfile)
{
- int banner = 0;
+ struct report_missing_guard_data data;
+
+ data.paths = NULL;
+ data.count = htab_elements (pfile->file_hash);
+ htab_traverse (pfile->file_hash, report_missing_guard, &data);
- htab_traverse (pfile->file_hash, report_missing_guard, &banner);
+ if (data.paths != NULL)
+ {
+ size_t i;
+
+ /* Sort the paths to avoid outputting them in hash table
+ order. */
+ qsort (data.paths, data.count, sizeof (const char *),
+ report_missing_guard_cmp);
+ fputs (_("Multiple include guards may be useful for:\n"),
+ stderr);
+ for (i = 0; i < data.count; i++)
+ {
+ fputs (data.paths[i], stderr);
+ putc ('\n', stderr);
+ }
+ free (data.paths);
+ }
}
/* Locate HEADER, and determine whether it is newer than the current
diff --git a/libcpp/include/line-map.h b/libcpp/include/line-map.h
index 3378315238f..81e888bc20f 100644
--- a/libcpp/include/line-map.h
+++ b/libcpp/include/line-map.h
@@ -34,6 +34,9 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
(e.g. a #line directive in C). */
enum lc_reason {LC_ENTER = 0, LC_LEAVE, LC_RENAME};
+/* The type of line numbers. */
+typedef unsigned int linenum_type;
+
/* A logical line/column number, i.e. an "index" into a line_map. */
/* Long-term, we want to use this to replace struct location_s (in input.h),
and effectively typedef source_location location_t. */
@@ -57,7 +60,7 @@ typedef void *(*line_map_realloc) (void *, size_t);
struct line_map GTY(())
{
const char *to_file;
- unsigned int to_line;
+ linenum_type to_line;
source_location start_location;
int included_from;
ENUM_BITFIELD (lc_reason) reason : CHAR_BIT;
@@ -119,7 +122,7 @@ extern void linemap_check_files_exited (struct line_maps *);
the highest_location). */
extern source_location linemap_line_start
-(struct line_maps *set, unsigned int to_line, unsigned int max_column_hint);
+(struct line_maps *set, linenum_type to_line, unsigned int max_column_hint);
/* Add a mapping of logical source line to physical source file and
line number.
@@ -134,7 +137,7 @@ extern source_location linemap_line_start
maps, so any stored line_map pointers should not be used. */
extern const struct line_map *linemap_add
(struct line_maps *, enum lc_reason, unsigned int sysp,
- const char *to_file, unsigned int to_line);
+ const char *to_file, linenum_type to_line);
/* Given a logical line, returns the map from which the corresponding
(source file, line) pair can be deduced. */
@@ -148,11 +151,11 @@ extern void linemap_print_containing_files (struct line_maps *,
const struct line_map *);
/* Converts a map and a source_location to source line. */
-#define SOURCE_LINE(MAP, LINE) \
- ((((LINE) - (MAP)->start_location) >> (MAP)->column_bits) + (MAP)->to_line)
+#define SOURCE_LINE(MAP, LOC) \
+ ((((LOC) - (MAP)->start_location) >> (MAP)->column_bits) + (MAP)->to_line)
-#define SOURCE_COLUMN(MAP, LINE) \
- (((LINE) - (MAP)->start_location) & ((1 << (MAP)->column_bits) - 1))
+#define SOURCE_COLUMN(MAP, LOC) \
+ (((LOC) - (MAP)->start_location) & ((1 << (MAP)->column_bits) - 1))
/* Returns the last source line within a map. This is the (last) line
of the #include, or other directive, that caused a map change. */
diff --git a/libcpp/internal.h b/libcpp/internal.h
index 4fb4e431b81..c5bf35eab84 100644
--- a/libcpp/internal.h
+++ b/libcpp/internal.h
@@ -68,7 +68,7 @@ struct cset_converter
#define CPP_INCREMENT_LINE(PFILE, COLS_HINT) do { \
const struct line_maps *line_table = PFILE->line_table; \
const struct line_map *map = &line_table->maps[line_table->used-1]; \
- unsigned int line = SOURCE_LINE (map, line_table->highest_line); \
+ linenum_type line = SOURCE_LINE (map, line_table->highest_line); \
linemap_line_start (PFILE->line_table, line + 1, COLS_HINT); \
} while (0)
@@ -585,7 +585,7 @@ extern int _cpp_do__Pragma (cpp_reader *);
extern void _cpp_init_directives (cpp_reader *);
extern void _cpp_init_internal_pragmas (cpp_reader *);
extern void _cpp_do_file_change (cpp_reader *, enum lc_reason, const char *,
- unsigned int, unsigned int);
+ linenum_type, unsigned int);
extern void _cpp_pop_buffer (cpp_reader *);
/* In directives.c */
diff --git a/libcpp/lex.c b/libcpp/lex.c
index c1e009da06b..2eb66bd6342 100644
--- a/libcpp/lex.c
+++ b/libcpp/lex.c
@@ -384,7 +384,7 @@ static int
skip_line_comment (cpp_reader *pfile)
{
cpp_buffer *buffer = pfile->buffer;
- unsigned int orig_line = pfile->line_table->highest_line;
+ source_location orig_line = pfile->line_table->highest_line;
while (*buffer->cur != '\n')
buffer->cur++;
diff --git a/libcpp/line-map.c b/libcpp/line-map.c
index 2c6d2510e61..964a7cd9a77 100644
--- a/libcpp/line-map.c
+++ b/libcpp/line-map.c
@@ -85,7 +85,7 @@ linemap_free (struct line_maps *set)
const struct line_map *
linemap_add (struct line_maps *set, enum lc_reason reason,
- unsigned int sysp, const char *to_file, unsigned int to_line)
+ unsigned int sysp, const char *to_file, linenum_type to_line)
{
struct line_map *map;
source_location start_location = set->highest_location + 1;
@@ -182,13 +182,13 @@ linemap_add (struct line_maps *set, enum lc_reason reason,
}
source_location
-linemap_line_start (struct line_maps *set, unsigned int to_line,
+linemap_line_start (struct line_maps *set, linenum_type to_line,
unsigned int max_column_hint)
{
struct line_map *map = &set->maps[set->used - 1];
source_location highest = set->highest_location;
source_location r;
- unsigned int last_line = SOURCE_LINE (map, set->highest_line);
+ linenum_type last_line = SOURCE_LINE (map, set->highest_line);
int line_delta = to_line - last_line;
bool add_map = false;
if (line_delta < 0
diff --git a/libcpp/macro.c b/libcpp/macro.c
index 1563d780d6f..9a470ef460b 100644
--- a/libcpp/macro.c
+++ b/libcpp/macro.c
@@ -118,7 +118,7 @@ _cpp_builtin_macro_text (cpp_reader *pfile, cpp_hashnode *node)
{
const struct line_map *map;
const uchar *result = NULL;
- unsigned int number = 1;
+ linenum_type number = 1;
switch (node->value.builtin)
{
@@ -200,11 +200,10 @@ _cpp_builtin_macro_text (cpp_reader *pfile, cpp_hashnode *node)
/* If __LINE__ is embedded in a macro, it must expand to the
line of the macro's invocation, not its definition.
Otherwise things like assert() will not work properly. */
- if (CPP_OPTION (pfile, traditional))
- number = pfile->line_table->highest_line;
- else
- number = pfile->cur_token[-1].src_loc;
- number = SOURCE_LINE (map, number);
+ number = SOURCE_LINE (map,
+ CPP_OPTION (pfile, traditional)
+ ? pfile->line_table->highest_line
+ : pfile->cur_token[-1].src_loc);
break;
/* __STDC__ has the value 1 under normal circumstances.
diff --git a/libcpp/traditional.c b/libcpp/traditional.c
index 1a384253a90..d23fffe72ca 100644
--- a/libcpp/traditional.c
+++ b/libcpp/traditional.c
@@ -60,7 +60,7 @@ struct fun_macro
size_t offset;
/* The line the macro name appeared on. */
- unsigned int line;
+ source_location line;
/* Zero-based index of argument being currently lexed. */
unsigned int argc;
diff --git a/libffi/ChangeLog b/libffi/ChangeLog
index 05188245ea4..850bbd4b35b 100644
--- a/libffi/ChangeLog
+++ b/libffi/ChangeLog
@@ -1,3 +1,8 @@
+2008-07-16 Kaz Kojima <kkojima@gcc.gnu.org>
+
+ * src/sh/ffi.c (ffi_prep_closure_loc): Turn INSN into an unsigned
+ int.
+
2008-06-17 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* configure: Regenerate.
diff --git a/libffi/src/sh/ffi.c b/libffi/src/sh/ffi.c
index 0cb8c72ccf6..850fde0a022 100644
--- a/libffi/src/sh/ffi.c
+++ b/libffi/src/sh/ffi.c
@@ -1,5 +1,6 @@
/* -----------------------------------------------------------------------
- ffi.c - Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007 Kaz Kojima
+ ffi.c - Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008
+ Kaz Kojima
SuperH Foreign Function Interface
@@ -459,7 +460,7 @@ ffi_prep_closure_loc (ffi_closure* closure,
void *codeloc)
{
unsigned int *tramp;
- unsigned short insn;
+ unsigned int insn;
FFI_ASSERT (cif->abi == FFI_GCC_SYSV);
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog
index 348afc5d227..35f7c8c11ba 100644
--- a/libgcc/ChangeLog
+++ b/libgcc/ChangeLog
@@ -1,3 +1,7 @@
+2008-08-06 Bob Wilson <bob.wilson@acm.org>
+
+ * config.host: Match more processor names for Xtensa.
+
2008-07-08 H.J. Lu <hongjiu.lu@intel.com>
* config/i386/64/t-softfp-compat: Update comments.
diff --git a/libgcc/config.host b/libgcc/config.host
index 93d1dbfacbb..0bca859cdae 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -558,9 +558,9 @@ vax-*-openbsd*)
;;
xstormy16-*-elf)
;;
-xtensa-*-elf*)
+xtensa*-*-elf*)
;;
-xtensa-*-linux*)
+xtensa*-*-linux*)
;;
am33_2.0-*-linux*)
extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o"
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index c845606c803..f2eb39188e5 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,101 @@
+2008-08-14 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR libfortran/37123
+ * intrinsics/cshift0.c (cshift0): Fix 2 typos.
+
+2008-08-14 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR libfortran/36886
+ * Makefile.am: Added $(i_cshift0_c).
+ Added $(i_cshift0_c) to gfor_built_specific_src.
+ Add rule to build from cshift0.m4.
+ * Makefile.in: Regenerated.
+ * libgfortran.h: Addedd prototypes for cshift0_i1,
+ cshift0_i2, cshift0_i4, cshift0_i8, cshift0_i16,
+ cshift0_r4, cshift0_r8, cshift0_r10, cshift0_r16,
+ cshift0_c4, cshift0_c8, cshift0_c10, cshift0_c16.
+ Define Macros GFC_UNALIGNED_C4 and GFC_UNALIGNED_C8.
+ * intrinsics/cshift0.c: Remove helper functions for
+ the innter shift loop.
+ (cshift0): Call specific functions depending on type
+ of array argument. Only call specific functions for
+ correct alignment for other types.
+ * m4/cshift0.m4: New file.
+ * generated/cshift0_i1.c: New file.
+ * generated/cshift0_i2.c: New file.
+ * generated/cshift0_i4.c: New file.
+ * generated/cshift0_i8:.c New file.
+ * generated/cshift0_i16.c: New file.
+ * generated/cshift0_r4.c: New file.
+ * generated/cshift0_r8.c: New file.
+ * generated/cshift0_r10.c: New file.
+ * generated/cshift0_r16.c: New file.
+ * generated/cshift0_c4.c: New file.
+ * generated/cshift0_c8.c: New file.
+ * generated/cshift0_c10.c: New file.
+ * generated/cshift0_c16.c: New file.
+
+2008-07-27 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/36132
+ PR fortran/29952
+ PR fortran/36909
+ * runtime/error.c: New function runtime_error_at.
+ * gfortran.map: Ditto.
+ * libgfortran.h: Ditto.
+
+2008-07-22 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR fortran/36582
+ * io/list_read.c: If variable rank is zero, do not adjust the found
+ namelist object pointer.
+
+2008-07-22 Daniel Kraft <d@domob.eu>
+
+ PR fortran/29835
+ * io/format.c (struct format_data): New member error_element.
+ (unexpected_element): Added '%c' to message.
+ (next_char): Keep track of last parsed character in fmt->error_element.
+ (format_error): If the message is unexpected_element, output the
+ offending character, too.
+
+2008-07-22 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR libfortran/36890
+ * io/file_pos.c: Declare READ_CHUNK as signed to avoid
+ signed/unsigned comparison warning in formatted_backspace.
+
+2008-07-21 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR libfortran/36773
+ * intrinsics/cshift0.c (cshift0): Return early if size of array
+ is zero.
+ * intrinsics/eoshift0.c (eoshift0): Return early if size of
+ return array is zero.
+ * intrinsics/eoshift2.c (eoshift2): Likewise.
+ * m4/eoshift1.m4 (eoshift1): Return early if size of array
+ is zero.
+ * m4/eoshift3.m4 (eoshift3): Likewise.
+ * m4/eoshift2.m4 (eoshift2): Return early if size of return
+ array is zero.
+ * m4/eoshift4.m4 (eoshift2): Return early if size of return
+ array is zero.
+ * generated/cshift1_16.c: Regenerated.
+ * generated/cshift1_4.c: Regenerated.
+ * generated/cshift1_8.c: Regenerated.
+ * generated/eoshift1_16.c: Regenerated.
+ * generated/eoshift1_4.c: Regenerated.
+ * generated/eoshift1_8.c: Regenerated.
+ * generated/eoshift3_16.c: Regenerated.
+ * generated/eoshift3_4.c: Regenerated.
+ * generated/eoshift3_8.c: Regenerated.
+
+2008-07-20 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR fortran/36857
+ * io/write_float.def: Comment out locale dependent code and fix general
+ comments.
+
2008-07-07 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/36341
diff --git a/libgfortran/Makefile.am b/libgfortran/Makefile.am
index 65a307af4bc..2223d61fcf2 100644
--- a/libgfortran/Makefile.am
+++ b/libgfortran/Makefile.am
@@ -379,6 +379,22 @@ $(srcdir)/generated/eoshift3_4.c \
$(srcdir)/generated/eoshift3_8.c \
$(srcdir)/generated/eoshift3_16.c
+i_cshift0_c= \
+$(srcdir)/generated/cshift0_i1.c \
+$(srcdir)/generated/cshift0_i2.c \
+$(srcdir)/generated/cshift0_i4.c \
+$(srcdir)/generated/cshift0_i8.c \
+$(srcdir)/generated/cshift0_i16.c \
+$(srcdir)/generated/cshift0_r4.c \
+$(srcdir)/generated/cshift0_r8.c \
+$(srcdir)/generated/cshift0_r10.c \
+$(srcdir)/generated/cshift0_r16.c \
+$(srcdir)/generated/cshift0_c4.c \
+$(srcdir)/generated/cshift0_c8.c \
+$(srcdir)/generated/cshift0_c10.c \
+$(srcdir)/generated/cshift0_c16.c
+
+
i_cshift1_c= \
$(srcdir)/generated/cshift1_4.c \
$(srcdir)/generated/cshift1_8.c \
@@ -545,7 +561,7 @@ gfor_built_src= $(i_all_c) $(i_any_c) $(i_count_c) $(i_maxloc0_c) \
$(i_exponent_c) $(i_fraction_c) $(i_nearest_c) $(i_set_exponent_c) \
$(i_pow_c) $(i_rrspacing_c) $(i_spacing_c) $(i_pack_c) $(i_unpack_c) \
$(i_spread_c) selected_int_kind.inc selected_real_kind.inc kinds.h \
- kinds.inc c99_protos.inc fpu-target.h
+ $(i_cshift0_c) kinds.inc c99_protos.inc fpu-target.h
# Machine generated specifics
gfor_built_specific_src= \
@@ -829,6 +845,9 @@ $(i_eoshift1_c): m4/eoshift1.m4 $(I_M4_DEPS)
$(i_eoshift3_c): m4/eoshift3.m4 $(I_M4_DEPS)
$(M4) -Dfile=$@ -I$(srcdir)/m4 eoshift3.m4 > $@
+$(i_cshift0_c): m4/cshift0.m4 $(I_M4_DEPS)
+ $(M4) -Dfile=$@ -I$(srcdir)/m4 cshift0.m4 > $@
+
$(i_cshift1_c): m4/cshift1.m4 $(I_M4_DEPS)
$(M4) -Dfile=$@ -I$(srcdir)/m4 cshift1.m4 > $@
diff --git a/libgfortran/Makefile.in b/libgfortran/Makefile.in
index 594d22863c8..4f518301621 100644
--- a/libgfortran/Makefile.in
+++ b/libgfortran/Makefile.in
@@ -397,7 +397,20 @@ am__libgfortran_la_SOURCES_DIST = runtime/backtrace.c \
$(srcdir)/generated/spread_c8.c \
$(srcdir)/generated/spread_c10.c \
$(srcdir)/generated/spread_c16.c selected_int_kind.inc \
- selected_real_kind.inc kinds.h kinds.inc c99_protos.inc \
+ selected_real_kind.inc kinds.h \
+ $(srcdir)/generated/cshift0_i1.c \
+ $(srcdir)/generated/cshift0_i2.c \
+ $(srcdir)/generated/cshift0_i4.c \
+ $(srcdir)/generated/cshift0_i8.c \
+ $(srcdir)/generated/cshift0_i16.c \
+ $(srcdir)/generated/cshift0_r4.c \
+ $(srcdir)/generated/cshift0_r8.c \
+ $(srcdir)/generated/cshift0_r10.c \
+ $(srcdir)/generated/cshift0_r16.c \
+ $(srcdir)/generated/cshift0_c4.c \
+ $(srcdir)/generated/cshift0_c8.c \
+ $(srcdir)/generated/cshift0_c10.c \
+ $(srcdir)/generated/cshift0_c16.c kinds.inc c99_protos.inc \
fpu-target.h io/close.c io/file_pos.c io/format.c io/inquire.c \
io/intrinsics.c io/list_read.c io/lock.c io/open.c io/read.c \
io/size_from_kind.c io/transfer.c io/unit.c io/unix.c \
@@ -679,7 +692,11 @@ am__objects_32 = spread_i1.lo spread_i2.lo spread_i4.lo spread_i8.lo \
spread_i16.lo spread_r4.lo spread_r8.lo spread_r10.lo \
spread_r16.lo spread_c4.lo spread_c8.lo spread_c10.lo \
spread_c16.lo
-am__objects_33 = $(am__objects_2) $(am__objects_3) $(am__objects_4) \
+am__objects_33 = cshift0_i1.lo cshift0_i2.lo cshift0_i4.lo \
+ cshift0_i8.lo cshift0_i16.lo cshift0_r4.lo cshift0_r8.lo \
+ cshift0_r10.lo cshift0_r16.lo cshift0_c4.lo cshift0_c8.lo \
+ cshift0_c10.lo cshift0_c16.lo
+am__objects_34 = $(am__objects_2) $(am__objects_3) $(am__objects_4) \
$(am__objects_5) $(am__objects_6) $(am__objects_7) \
$(am__objects_8) $(am__objects_9) $(am__objects_10) \
$(am__objects_11) $(am__objects_12) $(am__objects_13) \
@@ -689,11 +706,11 @@ am__objects_33 = $(am__objects_2) $(am__objects_3) $(am__objects_4) \
$(am__objects_23) $(am__objects_24) $(am__objects_25) \
$(am__objects_26) $(am__objects_27) $(am__objects_28) \
$(am__objects_29) $(am__objects_30) $(am__objects_31) \
- $(am__objects_32)
-am__objects_34 = close.lo file_pos.lo format.lo inquire.lo \
+ $(am__objects_32) $(am__objects_33)
+am__objects_35 = close.lo file_pos.lo format.lo inquire.lo \
intrinsics.lo list_read.lo lock.lo open.lo read.lo \
size_from_kind.lo transfer.lo unit.lo unix.lo write.lo fbuf.lo
-am__objects_35 = associated.lo abort.lo access.lo args.lo \
+am__objects_36 = associated.lo abort.lo access.lo args.lo \
c99_functions.lo chdir.lo chmod.lo clock.lo cpu_time.lo \
cshift0.lo ctime.lo date_and_time.lo dtime.lo env.lo \
eoshift0.lo eoshift2.lo erfc_scaled.lo etime.lo exit.lo \
@@ -707,8 +724,8 @@ am__objects_35 = associated.lo abort.lo access.lo args.lo \
stat.lo symlnk.lo system_clock.lo time.lo transpose_generic.lo \
umask.lo unlink.lo unpack_generic.lo in_pack_generic.lo \
in_unpack_generic.lo
-am__objects_36 =
-am__objects_37 = _abs_c4.lo _abs_c8.lo _abs_c10.lo _abs_c16.lo \
+am__objects_37 =
+am__objects_38 = _abs_c4.lo _abs_c8.lo _abs_c10.lo _abs_c16.lo \
_abs_i4.lo _abs_i8.lo _abs_i16.lo _abs_r4.lo _abs_r8.lo \
_abs_r10.lo _abs_r16.lo _aimag_c4.lo _aimag_c8.lo \
_aimag_c10.lo _aimag_c16.lo _exp_r4.lo _exp_r8.lo _exp_r10.lo \
@@ -732,18 +749,18 @@ am__objects_37 = _abs_c4.lo _abs_c8.lo _abs_c10.lo _abs_c16.lo \
_conjg_c4.lo _conjg_c8.lo _conjg_c10.lo _conjg_c16.lo \
_aint_r4.lo _aint_r8.lo _aint_r10.lo _aint_r16.lo _anint_r4.lo \
_anint_r8.lo _anint_r10.lo _anint_r16.lo
-am__objects_38 = _sign_i4.lo _sign_i8.lo _sign_i16.lo _sign_r4.lo \
+am__objects_39 = _sign_i4.lo _sign_i8.lo _sign_i16.lo _sign_r4.lo \
_sign_r8.lo _sign_r10.lo _sign_r16.lo _dim_i4.lo _dim_i8.lo \
_dim_i16.lo _dim_r4.lo _dim_r8.lo _dim_r10.lo _dim_r16.lo \
_atan2_r4.lo _atan2_r8.lo _atan2_r10.lo _atan2_r16.lo \
_mod_i4.lo _mod_i8.lo _mod_i16.lo _mod_r4.lo _mod_r8.lo \
_mod_r10.lo _mod_r16.lo
-am__objects_39 = misc_specifics.lo
-am__objects_40 = $(am__objects_37) $(am__objects_38) $(am__objects_39) \
+am__objects_40 = misc_specifics.lo
+am__objects_41 = $(am__objects_38) $(am__objects_39) $(am__objects_40) \
dprod_r8.lo f2c_specifics.lo
-am__objects_41 = $(am__objects_1) $(am__objects_33) $(am__objects_34) \
- $(am__objects_35) $(am__objects_36) $(am__objects_40)
-@onestep_FALSE@am_libgfortran_la_OBJECTS = $(am__objects_41)
+am__objects_42 = $(am__objects_1) $(am__objects_34) $(am__objects_35) \
+ $(am__objects_36) $(am__objects_37) $(am__objects_41)
+@onestep_FALSE@am_libgfortran_la_OBJECTS = $(am__objects_42)
@onestep_TRUE@am_libgfortran_la_OBJECTS = libgfortran_c.lo
libgfortran_la_OBJECTS = $(am_libgfortran_la_OBJECTS)
libgfortranbegin_la_LIBADD =
@@ -1279,6 +1296,21 @@ $(srcdir)/generated/eoshift3_4.c \
$(srcdir)/generated/eoshift3_8.c \
$(srcdir)/generated/eoshift3_16.c
+i_cshift0_c = \
+$(srcdir)/generated/cshift0_i1.c \
+$(srcdir)/generated/cshift0_i2.c \
+$(srcdir)/generated/cshift0_i4.c \
+$(srcdir)/generated/cshift0_i8.c \
+$(srcdir)/generated/cshift0_i16.c \
+$(srcdir)/generated/cshift0_r4.c \
+$(srcdir)/generated/cshift0_r8.c \
+$(srcdir)/generated/cshift0_r10.c \
+$(srcdir)/generated/cshift0_r16.c \
+$(srcdir)/generated/cshift0_c4.c \
+$(srcdir)/generated/cshift0_c8.c \
+$(srcdir)/generated/cshift0_c10.c \
+$(srcdir)/generated/cshift0_c16.c
+
i_cshift1_c = \
$(srcdir)/generated/cshift1_4.c \
$(srcdir)/generated/cshift1_8.c \
@@ -1445,7 +1477,7 @@ gfor_built_src = $(i_all_c) $(i_any_c) $(i_count_c) $(i_maxloc0_c) \
$(i_exponent_c) $(i_fraction_c) $(i_nearest_c) $(i_set_exponent_c) \
$(i_pow_c) $(i_rrspacing_c) $(i_spacing_c) $(i_pack_c) $(i_unpack_c) \
$(i_spread_c) selected_int_kind.inc selected_real_kind.inc kinds.h \
- kinds.inc c99_protos.inc fpu-target.h
+ $(i_cshift0_c) kinds.inc c99_protos.inc fpu-target.h
# Machine generated specifics
@@ -1771,6 +1803,19 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/count_8_l.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu_time.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cshift0.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cshift0_c10.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cshift0_c16.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cshift0_c4.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cshift0_c8.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cshift0_i1.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cshift0_i16.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cshift0_i2.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cshift0_i4.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cshift0_i8.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cshift0_r10.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cshift0_r16.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cshift0_r4.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cshift0_r8.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cshift1_16.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cshift1_4.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cshift1_8.Plo@am__quote@
@@ -5038,6 +5083,97 @@ spread_c16.lo: $(srcdir)/generated/spread_c16.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o spread_c16.lo `test -f '$(srcdir)/generated/spread_c16.c' || echo '$(srcdir)/'`$(srcdir)/generated/spread_c16.c
+cshift0_i1.lo: $(srcdir)/generated/cshift0_i1.c
+@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cshift0_i1.lo -MD -MP -MF "$(DEPDIR)/cshift0_i1.Tpo" -c -o cshift0_i1.lo `test -f '$(srcdir)/generated/cshift0_i1.c' || echo '$(srcdir)/'`$(srcdir)/generated/cshift0_i1.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/cshift0_i1.Tpo" "$(DEPDIR)/cshift0_i1.Plo"; else rm -f "$(DEPDIR)/cshift0_i1.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/generated/cshift0_i1.c' object='cshift0_i1.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cshift0_i1.lo `test -f '$(srcdir)/generated/cshift0_i1.c' || echo '$(srcdir)/'`$(srcdir)/generated/cshift0_i1.c
+
+cshift0_i2.lo: $(srcdir)/generated/cshift0_i2.c
+@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cshift0_i2.lo -MD -MP -MF "$(DEPDIR)/cshift0_i2.Tpo" -c -o cshift0_i2.lo `test -f '$(srcdir)/generated/cshift0_i2.c' || echo '$(srcdir)/'`$(srcdir)/generated/cshift0_i2.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/cshift0_i2.Tpo" "$(DEPDIR)/cshift0_i2.Plo"; else rm -f "$(DEPDIR)/cshift0_i2.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/generated/cshift0_i2.c' object='cshift0_i2.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cshift0_i2.lo `test -f '$(srcdir)/generated/cshift0_i2.c' || echo '$(srcdir)/'`$(srcdir)/generated/cshift0_i2.c
+
+cshift0_i4.lo: $(srcdir)/generated/cshift0_i4.c
+@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cshift0_i4.lo -MD -MP -MF "$(DEPDIR)/cshift0_i4.Tpo" -c -o cshift0_i4.lo `test -f '$(srcdir)/generated/cshift0_i4.c' || echo '$(srcdir)/'`$(srcdir)/generated/cshift0_i4.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/cshift0_i4.Tpo" "$(DEPDIR)/cshift0_i4.Plo"; else rm -f "$(DEPDIR)/cshift0_i4.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/generated/cshift0_i4.c' object='cshift0_i4.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cshift0_i4.lo `test -f '$(srcdir)/generated/cshift0_i4.c' || echo '$(srcdir)/'`$(srcdir)/generated/cshift0_i4.c
+
+cshift0_i8.lo: $(srcdir)/generated/cshift0_i8.c
+@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cshift0_i8.lo -MD -MP -MF "$(DEPDIR)/cshift0_i8.Tpo" -c -o cshift0_i8.lo `test -f '$(srcdir)/generated/cshift0_i8.c' || echo '$(srcdir)/'`$(srcdir)/generated/cshift0_i8.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/cshift0_i8.Tpo" "$(DEPDIR)/cshift0_i8.Plo"; else rm -f "$(DEPDIR)/cshift0_i8.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/generated/cshift0_i8.c' object='cshift0_i8.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cshift0_i8.lo `test -f '$(srcdir)/generated/cshift0_i8.c' || echo '$(srcdir)/'`$(srcdir)/generated/cshift0_i8.c
+
+cshift0_i16.lo: $(srcdir)/generated/cshift0_i16.c
+@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cshift0_i16.lo -MD -MP -MF "$(DEPDIR)/cshift0_i16.Tpo" -c -o cshift0_i16.lo `test -f '$(srcdir)/generated/cshift0_i16.c' || echo '$(srcdir)/'`$(srcdir)/generated/cshift0_i16.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/cshift0_i16.Tpo" "$(DEPDIR)/cshift0_i16.Plo"; else rm -f "$(DEPDIR)/cshift0_i16.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/generated/cshift0_i16.c' object='cshift0_i16.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cshift0_i16.lo `test -f '$(srcdir)/generated/cshift0_i16.c' || echo '$(srcdir)/'`$(srcdir)/generated/cshift0_i16.c
+
+cshift0_r4.lo: $(srcdir)/generated/cshift0_r4.c
+@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cshift0_r4.lo -MD -MP -MF "$(DEPDIR)/cshift0_r4.Tpo" -c -o cshift0_r4.lo `test -f '$(srcdir)/generated/cshift0_r4.c' || echo '$(srcdir)/'`$(srcdir)/generated/cshift0_r4.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/cshift0_r4.Tpo" "$(DEPDIR)/cshift0_r4.Plo"; else rm -f "$(DEPDIR)/cshift0_r4.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/generated/cshift0_r4.c' object='cshift0_r4.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cshift0_r4.lo `test -f '$(srcdir)/generated/cshift0_r4.c' || echo '$(srcdir)/'`$(srcdir)/generated/cshift0_r4.c
+
+cshift0_r8.lo: $(srcdir)/generated/cshift0_r8.c
+@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cshift0_r8.lo -MD -MP -MF "$(DEPDIR)/cshift0_r8.Tpo" -c -o cshift0_r8.lo `test -f '$(srcdir)/generated/cshift0_r8.c' || echo '$(srcdir)/'`$(srcdir)/generated/cshift0_r8.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/cshift0_r8.Tpo" "$(DEPDIR)/cshift0_r8.Plo"; else rm -f "$(DEPDIR)/cshift0_r8.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/generated/cshift0_r8.c' object='cshift0_r8.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cshift0_r8.lo `test -f '$(srcdir)/generated/cshift0_r8.c' || echo '$(srcdir)/'`$(srcdir)/generated/cshift0_r8.c
+
+cshift0_r10.lo: $(srcdir)/generated/cshift0_r10.c
+@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cshift0_r10.lo -MD -MP -MF "$(DEPDIR)/cshift0_r10.Tpo" -c -o cshift0_r10.lo `test -f '$(srcdir)/generated/cshift0_r10.c' || echo '$(srcdir)/'`$(srcdir)/generated/cshift0_r10.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/cshift0_r10.Tpo" "$(DEPDIR)/cshift0_r10.Plo"; else rm -f "$(DEPDIR)/cshift0_r10.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/generated/cshift0_r10.c' object='cshift0_r10.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cshift0_r10.lo `test -f '$(srcdir)/generated/cshift0_r10.c' || echo '$(srcdir)/'`$(srcdir)/generated/cshift0_r10.c
+
+cshift0_r16.lo: $(srcdir)/generated/cshift0_r16.c
+@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cshift0_r16.lo -MD -MP -MF "$(DEPDIR)/cshift0_r16.Tpo" -c -o cshift0_r16.lo `test -f '$(srcdir)/generated/cshift0_r16.c' || echo '$(srcdir)/'`$(srcdir)/generated/cshift0_r16.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/cshift0_r16.Tpo" "$(DEPDIR)/cshift0_r16.Plo"; else rm -f "$(DEPDIR)/cshift0_r16.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/generated/cshift0_r16.c' object='cshift0_r16.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cshift0_r16.lo `test -f '$(srcdir)/generated/cshift0_r16.c' || echo '$(srcdir)/'`$(srcdir)/generated/cshift0_r16.c
+
+cshift0_c4.lo: $(srcdir)/generated/cshift0_c4.c
+@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cshift0_c4.lo -MD -MP -MF "$(DEPDIR)/cshift0_c4.Tpo" -c -o cshift0_c4.lo `test -f '$(srcdir)/generated/cshift0_c4.c' || echo '$(srcdir)/'`$(srcdir)/generated/cshift0_c4.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/cshift0_c4.Tpo" "$(DEPDIR)/cshift0_c4.Plo"; else rm -f "$(DEPDIR)/cshift0_c4.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/generated/cshift0_c4.c' object='cshift0_c4.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cshift0_c4.lo `test -f '$(srcdir)/generated/cshift0_c4.c' || echo '$(srcdir)/'`$(srcdir)/generated/cshift0_c4.c
+
+cshift0_c8.lo: $(srcdir)/generated/cshift0_c8.c
+@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cshift0_c8.lo -MD -MP -MF "$(DEPDIR)/cshift0_c8.Tpo" -c -o cshift0_c8.lo `test -f '$(srcdir)/generated/cshift0_c8.c' || echo '$(srcdir)/'`$(srcdir)/generated/cshift0_c8.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/cshift0_c8.Tpo" "$(DEPDIR)/cshift0_c8.Plo"; else rm -f "$(DEPDIR)/cshift0_c8.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/generated/cshift0_c8.c' object='cshift0_c8.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cshift0_c8.lo `test -f '$(srcdir)/generated/cshift0_c8.c' || echo '$(srcdir)/'`$(srcdir)/generated/cshift0_c8.c
+
+cshift0_c10.lo: $(srcdir)/generated/cshift0_c10.c
+@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cshift0_c10.lo -MD -MP -MF "$(DEPDIR)/cshift0_c10.Tpo" -c -o cshift0_c10.lo `test -f '$(srcdir)/generated/cshift0_c10.c' || echo '$(srcdir)/'`$(srcdir)/generated/cshift0_c10.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/cshift0_c10.Tpo" "$(DEPDIR)/cshift0_c10.Plo"; else rm -f "$(DEPDIR)/cshift0_c10.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/generated/cshift0_c10.c' object='cshift0_c10.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cshift0_c10.lo `test -f '$(srcdir)/generated/cshift0_c10.c' || echo '$(srcdir)/'`$(srcdir)/generated/cshift0_c10.c
+
+cshift0_c16.lo: $(srcdir)/generated/cshift0_c16.c
+@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cshift0_c16.lo -MD -MP -MF "$(DEPDIR)/cshift0_c16.Tpo" -c -o cshift0_c16.lo `test -f '$(srcdir)/generated/cshift0_c16.c' || echo '$(srcdir)/'`$(srcdir)/generated/cshift0_c16.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/cshift0_c16.Tpo" "$(DEPDIR)/cshift0_c16.Plo"; else rm -f "$(DEPDIR)/cshift0_c16.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/generated/cshift0_c16.c' object='cshift0_c16.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cshift0_c16.lo `test -f '$(srcdir)/generated/cshift0_c16.c' || echo '$(srcdir)/'`$(srcdir)/generated/cshift0_c16.c
+
close.lo: io/close.c
@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT close.lo -MD -MP -MF "$(DEPDIR)/close.Tpo" -c -o close.lo `test -f 'io/close.c' || echo '$(srcdir)/'`io/close.c; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/close.Tpo" "$(DEPDIR)/close.Plo"; else rm -f "$(DEPDIR)/close.Tpo"; exit 1; fi
@@ -5973,6 +6109,9 @@ fpu-target.h: $(srcdir)/$(FPU_HOST_HEADER)
@MAINTAINER_MODE_TRUE@$(i_eoshift3_c): m4/eoshift3.m4 $(I_M4_DEPS)
@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 eoshift3.m4 > $@
+@MAINTAINER_MODE_TRUE@$(i_cshift0_c): m4/cshift0.m4 $(I_M4_DEPS)
+@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 cshift0.m4 > $@
+
@MAINTAINER_MODE_TRUE@$(i_cshift1_c): m4/cshift1.m4 $(I_M4_DEPS)
@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 cshift1.m4 > $@
diff --git a/libgfortran/generated/cshift0_c10.c b/libgfortran/generated/cshift0_c10.c
new file mode 100644
index 00000000000..9f0997044d2
--- /dev/null
+++ b/libgfortran/generated/cshift0_c10.c
@@ -0,0 +1,176 @@
+/* Helper function for cshift functions.
+ Copyright 2008 Free Software Foundation, Inc.
+ Contributed by Thomas Koenig <tkoenig@gcc.gnu.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file. (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING. If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA. */
+
+#include "libgfortran.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+
+#if defined (HAVE_GFC_COMPLEX_10)
+
+void
+cshift0_c10 (gfc_array_c10 *ret, const gfc_array_c10 *array, ssize_t shift,
+ int which)
+{
+ /* r.* indicates the return array. */
+ index_type rstride[GFC_MAX_DIMENSIONS];
+ index_type rstride0;
+ index_type roffset;
+ GFC_COMPLEX_10 *rptr;
+
+ /* s.* indicates the source array. */
+ index_type sstride[GFC_MAX_DIMENSIONS];
+ index_type sstride0;
+ index_type soffset;
+ const GFC_COMPLEX_10 *sptr;
+
+ index_type count[GFC_MAX_DIMENSIONS];
+ index_type extent[GFC_MAX_DIMENSIONS];
+ index_type dim;
+ index_type len;
+ index_type n;
+
+ which = which - 1;
+ sstride[0] = 0;
+ rstride[0] = 0;
+
+ extent[0] = 1;
+ count[0] = 0;
+ n = 0;
+ /* Initialized for avoiding compiler warnings. */
+ roffset = 1;
+ soffset = 1;
+ len = 0;
+
+ for (dim = 0; dim < GFC_DESCRIPTOR_RANK (array); dim++)
+ {
+ if (dim == which)
+ {
+ roffset = ret->dim[dim].stride;
+ if (roffset == 0)
+ roffset = 1;
+ soffset = array->dim[dim].stride;
+ if (soffset == 0)
+ soffset = 1;
+ len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+ }
+ else
+ {
+ count[n] = 0;
+ extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+ rstride[n] = ret->dim[dim].stride;
+ sstride[n] = array->dim[dim].stride;
+ n++;
+ }
+ }
+ if (sstride[0] == 0)
+ sstride[0] = 1;
+ if (rstride[0] == 0)
+ rstride[0] = 1;
+
+ dim = GFC_DESCRIPTOR_RANK (array);
+ rstride0 = rstride[0];
+ sstride0 = sstride[0];
+ rptr = ret->data;
+ sptr = array->data;
+
+ shift = len == 0 ? 0 : shift % (ssize_t)len;
+ if (shift < 0)
+ shift += len;
+
+ while (rptr)
+ {
+ /* Do the shift for this dimension. */
+
+ /* If elements are contiguous, perform the operation
+ in two block moves. */
+ if (soffset == 1 && roffset == 1)
+ {
+ size_t len1 = shift * sizeof (GFC_COMPLEX_10);
+ size_t len2 = (len - shift) * sizeof (GFC_COMPLEX_10);
+ memcpy (rptr, sptr + shift, len2);
+ memcpy (rptr + (len - shift), sptr, len1);
+ }
+ else
+ {
+ /* Otherwise, we will have to perform the copy one element at
+ a time. */
+ GFC_COMPLEX_10 *dest = rptr;
+ const GFC_COMPLEX_10 *src = &sptr[shift * soffset];
+
+ for (n = 0; n < len - shift; n++)
+ {
+ *dest = *src;
+ dest += roffset;
+ src += soffset;
+ }
+ for (src = sptr, n = 0; n < shift; n++)
+ {
+ *dest = *src;
+ dest += roffset;
+ src += soffset;
+ }
+ }
+
+ /* Advance to the next section. */
+ rptr += rstride0;
+ sptr += sstride0;
+ count[0]++;
+ n = 0;
+ while (count[n] == extent[n])
+ {
+ /* When we get to the end of a dimension, reset it and increment
+ the next dimension. */
+ count[n] = 0;
+ /* We could precalculate these products, but this is a less
+ frequently used path so probably not worth it. */
+ rptr -= rstride[n] * extent[n];
+ sptr -= sstride[n] * extent[n];
+ n++;
+ if (n >= dim - 1)
+ {
+ /* Break out of the loop. */
+ rptr = NULL;
+ break;
+ }
+ else
+ {
+ count[n]++;
+ rptr += rstride[n];
+ sptr += sstride[n];
+ }
+ }
+ }
+
+ return;
+}
+
+#endif
diff --git a/libgfortran/generated/cshift0_c16.c b/libgfortran/generated/cshift0_c16.c
new file mode 100644
index 00000000000..deabe262937
--- /dev/null
+++ b/libgfortran/generated/cshift0_c16.c
@@ -0,0 +1,176 @@
+/* Helper function for cshift functions.
+ Copyright 2008 Free Software Foundation, Inc.
+ Contributed by Thomas Koenig <tkoenig@gcc.gnu.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file. (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING. If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA. */
+
+#include "libgfortran.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+
+#if defined (HAVE_GFC_COMPLEX_16)
+
+void
+cshift0_c16 (gfc_array_c16 *ret, const gfc_array_c16 *array, ssize_t shift,
+ int which)
+{
+ /* r.* indicates the return array. */
+ index_type rstride[GFC_MAX_DIMENSIONS];
+ index_type rstride0;
+ index_type roffset;
+ GFC_COMPLEX_16 *rptr;
+
+ /* s.* indicates the source array. */
+ index_type sstride[GFC_MAX_DIMENSIONS];
+ index_type sstride0;
+ index_type soffset;
+ const GFC_COMPLEX_16 *sptr;
+
+ index_type count[GFC_MAX_DIMENSIONS];
+ index_type extent[GFC_MAX_DIMENSIONS];
+ index_type dim;
+ index_type len;
+ index_type n;
+
+ which = which - 1;
+ sstride[0] = 0;
+ rstride[0] = 0;
+
+ extent[0] = 1;
+ count[0] = 0;
+ n = 0;
+ /* Initialized for avoiding compiler warnings. */
+ roffset = 1;
+ soffset = 1;
+ len = 0;
+
+ for (dim = 0; dim < GFC_DESCRIPTOR_RANK (array); dim++)
+ {
+ if (dim == which)
+ {
+ roffset = ret->dim[dim].stride;
+ if (roffset == 0)
+ roffset = 1;
+ soffset = array->dim[dim].stride;
+ if (soffset == 0)
+ soffset = 1;
+ len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+ }
+ else
+ {
+ count[n] = 0;
+ extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+ rstride[n] = ret->dim[dim].stride;
+ sstride[n] = array->dim[dim].stride;
+ n++;
+ }
+ }
+ if (sstride[0] == 0)
+ sstride[0] = 1;
+ if (rstride[0] == 0)
+ rstride[0] = 1;
+
+ dim = GFC_DESCRIPTOR_RANK (array);
+ rstride0 = rstride[0];
+ sstride0 = sstride[0];
+ rptr = ret->data;
+ sptr = array->data;
+
+ shift = len == 0 ? 0 : shift % (ssize_t)len;
+ if (shift < 0)
+ shift += len;
+
+ while (rptr)
+ {
+ /* Do the shift for this dimension. */
+
+ /* If elements are contiguous, perform the operation
+ in two block moves. */
+ if (soffset == 1 && roffset == 1)
+ {
+ size_t len1 = shift * sizeof (GFC_COMPLEX_16);
+ size_t len2 = (len - shift) * sizeof (GFC_COMPLEX_16);
+ memcpy (rptr, sptr + shift, len2);
+ memcpy (rptr + (len - shift), sptr, len1);
+ }
+ else
+ {
+ /* Otherwise, we will have to perform the copy one element at
+ a time. */
+ GFC_COMPLEX_16 *dest = rptr;
+ const GFC_COMPLEX_16 *src = &sptr[shift * soffset];
+
+ for (n = 0; n < len - shift; n++)
+ {
+ *dest = *src;
+ dest += roffset;
+ src += soffset;
+ }
+ for (src = sptr, n = 0; n < shift; n++)
+ {
+ *dest = *src;
+ dest += roffset;
+ src += soffset;
+ }
+ }
+
+ /* Advance to the next section. */
+ rptr += rstride0;
+ sptr += sstride0;
+ count[0]++;
+ n = 0;
+ while (count[n] == extent[n])
+ {
+ /* When we get to the end of a dimension, reset it and increment
+ the next dimension. */
+ count[n] = 0;
+ /* We could precalculate these products, but this is a less
+ frequently used path so probably not worth it. */
+ rptr -= rstride[n] * extent[n];
+ sptr -= sstride[n] * extent[n];
+ n++;
+ if (n >= dim - 1)
+ {
+ /* Break out of the loop. */
+ rptr = NULL;
+ break;
+ }
+ else
+ {
+ count[n]++;
+ rptr += rstride[n];
+ sptr += sstride[n];
+ }
+ }
+ }
+
+ return;
+}
+
+#endif
diff --git a/libgfortran/generated/cshift0_c4.c b/libgfortran/generated/cshift0_c4.c
new file mode 100644
index 00000000000..462169f9a26
--- /dev/null
+++ b/libgfortran/generated/cshift0_c4.c
@@ -0,0 +1,176 @@
+/* Helper function for cshift functions.
+ Copyright 2008 Free Software Foundation, Inc.
+ Contributed by Thomas Koenig <tkoenig@gcc.gnu.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file. (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING. If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA. */
+
+#include "libgfortran.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+
+#if defined (HAVE_GFC_COMPLEX_4)
+
+void
+cshift0_c4 (gfc_array_c4 *ret, const gfc_array_c4 *array, ssize_t shift,
+ int which)
+{
+ /* r.* indicates the return array. */
+ index_type rstride[GFC_MAX_DIMENSIONS];
+ index_type rstride0;
+ index_type roffset;
+ GFC_COMPLEX_4 *rptr;
+
+ /* s.* indicates the source array. */
+ index_type sstride[GFC_MAX_DIMENSIONS];
+ index_type sstride0;
+ index_type soffset;
+ const GFC_COMPLEX_4 *sptr;
+
+ index_type count[GFC_MAX_DIMENSIONS];
+ index_type extent[GFC_MAX_DIMENSIONS];
+ index_type dim;
+ index_type len;
+ index_type n;
+
+ which = which - 1;
+ sstride[0] = 0;
+ rstride[0] = 0;
+
+ extent[0] = 1;
+ count[0] = 0;
+ n = 0;
+ /* Initialized for avoiding compiler warnings. */
+ roffset = 1;
+ soffset = 1;
+ len = 0;
+
+ for (dim = 0; dim < GFC_DESCRIPTOR_RANK (array); dim++)
+ {
+ if (dim == which)
+ {
+ roffset = ret->dim[dim].stride;
+ if (roffset == 0)
+ roffset = 1;
+ soffset = array->dim[dim].stride;
+ if (soffset == 0)
+ soffset = 1;
+ len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+ }
+ else
+ {
+ count[n] = 0;
+ extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+ rstride[n] = ret->dim[dim].stride;
+ sstride[n] = array->dim[dim].stride;
+ n++;
+ }
+ }
+ if (sstride[0] == 0)
+ sstride[0] = 1;
+ if (rstride[0] == 0)
+ rstride[0] = 1;
+
+ dim = GFC_DESCRIPTOR_RANK (array);
+ rstride0 = rstride[0];
+ sstride0 = sstride[0];
+ rptr = ret->data;
+ sptr = array->data;
+
+ shift = len == 0 ? 0 : shift % (ssize_t)len;
+ if (shift < 0)
+ shift += len;
+
+ while (rptr)
+ {
+ /* Do the shift for this dimension. */
+
+ /* If elements are contiguous, perform the operation
+ in two block moves. */
+ if (soffset == 1 && roffset == 1)
+ {
+ size_t len1 = shift * sizeof (GFC_COMPLEX_4);
+ size_t len2 = (len - shift) * sizeof (GFC_COMPLEX_4);
+ memcpy (rptr, sptr + shift, len2);
+ memcpy (rptr + (len - shift), sptr, len1);
+ }
+ else
+ {
+ /* Otherwise, we will have to perform the copy one element at
+ a time. */
+ GFC_COMPLEX_4 *dest = rptr;
+ const GFC_COMPLEX_4 *src = &sptr[shift * soffset];
+
+ for (n = 0; n < len - shift; n++)
+ {
+ *dest = *src;
+ dest += roffset;
+ src += soffset;
+ }
+ for (src = sptr, n = 0; n < shift; n++)
+ {
+ *dest = *src;
+ dest += roffset;
+ src += soffset;
+ }
+ }
+
+ /* Advance to the next section. */
+ rptr += rstride0;
+ sptr += sstride0;
+ count[0]++;
+ n = 0;
+ while (count[n] == extent[n])
+ {
+ /* When we get to the end of a dimension, reset it and increment
+ the next dimension. */
+ count[n] = 0;
+ /* We could precalculate these products, but this is a less
+ frequently used path so probably not worth it. */
+ rptr -= rstride[n] * extent[n];
+ sptr -= sstride[n] * extent[n];
+ n++;
+ if (n >= dim - 1)
+ {
+ /* Break out of the loop. */
+ rptr = NULL;
+ break;
+ }
+ else
+ {
+ count[n]++;
+ rptr += rstride[n];
+ sptr += sstride[n];
+ }
+ }
+ }
+
+ return;
+}
+
+#endif
diff --git a/libgfortran/generated/cshift0_c8.c b/libgfortran/generated/cshift0_c8.c
new file mode 100644
index 00000000000..0653e1d3f0d
--- /dev/null
+++ b/libgfortran/generated/cshift0_c8.c
@@ -0,0 +1,176 @@
+/* Helper function for cshift functions.
+ Copyright 2008 Free Software Foundation, Inc.
+ Contributed by Thomas Koenig <tkoenig@gcc.gnu.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file. (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING. If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA. */
+
+#include "libgfortran.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+
+#if defined (HAVE_GFC_COMPLEX_8)
+
+void
+cshift0_c8 (gfc_array_c8 *ret, const gfc_array_c8 *array, ssize_t shift,
+ int which)
+{
+ /* r.* indicates the return array. */
+ index_type rstride[GFC_MAX_DIMENSIONS];
+ index_type rstride0;
+ index_type roffset;
+ GFC_COMPLEX_8 *rptr;
+
+ /* s.* indicates the source array. */
+ index_type sstride[GFC_MAX_DIMENSIONS];
+ index_type sstride0;
+ index_type soffset;
+ const GFC_COMPLEX_8 *sptr;
+
+ index_type count[GFC_MAX_DIMENSIONS];
+ index_type extent[GFC_MAX_DIMENSIONS];
+ index_type dim;
+ index_type len;
+ index_type n;
+
+ which = which - 1;
+ sstride[0] = 0;
+ rstride[0] = 0;
+
+ extent[0] = 1;
+ count[0] = 0;
+ n = 0;
+ /* Initialized for avoiding compiler warnings. */
+ roffset = 1;
+ soffset = 1;
+ len = 0;
+
+ for (dim = 0; dim < GFC_DESCRIPTOR_RANK (array); dim++)
+ {
+ if (dim == which)
+ {
+ roffset = ret->dim[dim].stride;
+ if (roffset == 0)
+ roffset = 1;
+ soffset = array->dim[dim].stride;
+ if (soffset == 0)
+ soffset = 1;
+ len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+ }
+ else
+ {
+ count[n] = 0;
+ extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+ rstride[n] = ret->dim[dim].stride;
+ sstride[n] = array->dim[dim].stride;
+ n++;
+ }
+ }
+ if (sstride[0] == 0)
+ sstride[0] = 1;
+ if (rstride[0] == 0)
+ rstride[0] = 1;
+
+ dim = GFC_DESCRIPTOR_RANK (array);
+ rstride0 = rstride[0];
+ sstride0 = sstride[0];
+ rptr = ret->data;
+ sptr = array->data;
+
+ shift = len == 0 ? 0 : shift % (ssize_t)len;
+ if (shift < 0)
+ shift += len;
+
+ while (rptr)
+ {
+ /* Do the shift for this dimension. */
+
+ /* If elements are contiguous, perform the operation
+ in two block moves. */
+ if (soffset == 1 && roffset == 1)
+ {
+ size_t len1 = shift * sizeof (GFC_COMPLEX_8);
+ size_t len2 = (len - shift) * sizeof (GFC_COMPLEX_8);
+ memcpy (rptr, sptr + shift, len2);
+ memcpy (rptr + (len - shift), sptr, len1);
+ }
+ else
+ {
+ /* Otherwise, we will have to perform the copy one element at
+ a time. */
+ GFC_COMPLEX_8 *dest = rptr;
+ const GFC_COMPLEX_8 *src = &sptr[shift * soffset];
+
+ for (n = 0; n < len - shift; n++)
+ {
+ *dest = *src;
+ dest += roffset;
+ src += soffset;
+ }
+ for (src = sptr, n = 0; n < shift; n++)
+ {
+ *dest = *src;
+ dest += roffset;
+ src += soffset;
+ }
+ }
+
+ /* Advance to the next section. */
+ rptr += rstride0;
+ sptr += sstride0;
+ count[0]++;
+ n = 0;
+ while (count[n] == extent[n])
+ {
+ /* When we get to the end of a dimension, reset it and increment
+ the next dimension. */
+ count[n] = 0;
+ /* We could precalculate these products, but this is a less
+ frequently used path so probably not worth it. */
+ rptr -= rstride[n] * extent[n];
+ sptr -= sstride[n] * extent[n];
+ n++;
+ if (n >= dim - 1)
+ {
+ /* Break out of the loop. */
+ rptr = NULL;
+ break;
+ }
+ else
+ {
+ count[n]++;
+ rptr += rstride[n];
+ sptr += sstride[n];
+ }
+ }
+ }
+
+ return;
+}
+
+#endif
diff --git a/libgfortran/generated/cshift0_i1.c b/libgfortran/generated/cshift0_i1.c
new file mode 100644
index 00000000000..c21d75ebe5e
--- /dev/null
+++ b/libgfortran/generated/cshift0_i1.c
@@ -0,0 +1,176 @@
+/* Helper function for cshift functions.
+ Copyright 2008 Free Software Foundation, Inc.
+ Contributed by Thomas Koenig <tkoenig@gcc.gnu.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file. (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING. If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA. */
+
+#include "libgfortran.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+
+#if defined (HAVE_GFC_INTEGER_1)
+
+void
+cshift0_i1 (gfc_array_i1 *ret, const gfc_array_i1 *array, ssize_t shift,
+ int which)
+{
+ /* r.* indicates the return array. */
+ index_type rstride[GFC_MAX_DIMENSIONS];
+ index_type rstride0;
+ index_type roffset;
+ GFC_INTEGER_1 *rptr;
+
+ /* s.* indicates the source array. */
+ index_type sstride[GFC_MAX_DIMENSIONS];
+ index_type sstride0;
+ index_type soffset;
+ const GFC_INTEGER_1 *sptr;
+
+ index_type count[GFC_MAX_DIMENSIONS];
+ index_type extent[GFC_MAX_DIMENSIONS];
+ index_type dim;
+ index_type len;
+ index_type n;
+
+ which = which - 1;
+ sstride[0] = 0;
+ rstride[0] = 0;
+
+ extent[0] = 1;
+ count[0] = 0;
+ n = 0;
+ /* Initialized for avoiding compiler warnings. */
+ roffset = 1;
+ soffset = 1;
+ len = 0;
+
+ for (dim = 0; dim < GFC_DESCRIPTOR_RANK (array); dim++)
+ {
+ if (dim == which)
+ {
+ roffset = ret->dim[dim].stride;
+ if (roffset == 0)
+ roffset = 1;
+ soffset = array->dim[dim].stride;
+ if (soffset == 0)
+ soffset = 1;
+ len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+ }
+ else
+ {
+ count[n] = 0;
+ extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+ rstride[n] = ret->dim[dim].stride;
+ sstride[n] = array->dim[dim].stride;
+ n++;
+ }
+ }
+ if (sstride[0] == 0)
+ sstride[0] = 1;
+ if (rstride[0] == 0)
+ rstride[0] = 1;
+
+ dim = GFC_DESCRIPTOR_RANK (array);
+ rstride0 = rstride[0];
+ sstride0 = sstride[0];
+ rptr = ret->data;
+ sptr = array->data;
+
+ shift = len == 0 ? 0 : shift % (ssize_t)len;
+ if (shift < 0)
+ shift += len;
+
+ while (rptr)
+ {
+ /* Do the shift for this dimension. */
+
+ /* If elements are contiguous, perform the operation
+ in two block moves. */
+ if (soffset == 1 && roffset == 1)
+ {
+ size_t len1 = shift * sizeof (GFC_INTEGER_1);
+ size_t len2 = (len - shift) * sizeof (GFC_INTEGER_1);
+ memcpy (rptr, sptr + shift, len2);
+ memcpy (rptr + (len - shift), sptr, len1);
+ }
+ else
+ {
+ /* Otherwise, we will have to perform the copy one element at
+ a time. */
+ GFC_INTEGER_1 *dest = rptr;
+ const GFC_INTEGER_1 *src = &sptr[shift * soffset];
+
+ for (n = 0; n < len - shift; n++)
+ {
+ *dest = *src;
+ dest += roffset;
+ src += soffset;
+ }
+ for (src = sptr, n = 0; n < shift; n++)
+ {
+ *dest = *src;
+ dest += roffset;
+ src += soffset;
+ }
+ }
+
+ /* Advance to the next section. */
+ rptr += rstride0;
+ sptr += sstride0;
+ count[0]++;
+ n = 0;
+ while (count[n] == extent[n])
+ {
+ /* When we get to the end of a dimension, reset it and increment
+ the next dimension. */
+ count[n] = 0;
+ /* We could precalculate these products, but this is a less
+ frequently used path so probably not worth it. */
+ rptr -= rstride[n] * extent[n];
+ sptr -= sstride[n] * extent[n];
+ n++;
+ if (n >= dim - 1)
+ {
+ /* Break out of the loop. */
+ rptr = NULL;
+ break;
+ }
+ else
+ {
+ count[n]++;
+ rptr += rstride[n];
+ sptr += sstride[n];
+ }
+ }
+ }
+
+ return;
+}
+
+#endif
diff --git a/libgfortran/generated/cshift0_i16.c b/libgfortran/generated/cshift0_i16.c
new file mode 100644
index 00000000000..e2c88f461af
--- /dev/null
+++ b/libgfortran/generated/cshift0_i16.c
@@ -0,0 +1,176 @@
+/* Helper function for cshift functions.
+ Copyright 2008 Free Software Foundation, Inc.
+ Contributed by Thomas Koenig <tkoenig@gcc.gnu.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file. (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING. If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA. */
+
+#include "libgfortran.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+
+#if defined (HAVE_GFC_INTEGER_16)
+
+void
+cshift0_i16 (gfc_array_i16 *ret, const gfc_array_i16 *array, ssize_t shift,
+ int which)
+{
+ /* r.* indicates the return array. */
+ index_type rstride[GFC_MAX_DIMENSIONS];
+ index_type rstride0;
+ index_type roffset;
+ GFC_INTEGER_16 *rptr;
+
+ /* s.* indicates the source array. */
+ index_type sstride[GFC_MAX_DIMENSIONS];
+ index_type sstride0;
+ index_type soffset;
+ const GFC_INTEGER_16 *sptr;
+
+ index_type count[GFC_MAX_DIMENSIONS];
+ index_type extent[GFC_MAX_DIMENSIONS];
+ index_type dim;
+ index_type len;
+ index_type n;
+
+ which = which - 1;
+ sstride[0] = 0;
+ rstride[0] = 0;
+
+ extent[0] = 1;
+ count[0] = 0;
+ n = 0;
+ /* Initialized for avoiding compiler warnings. */
+ roffset = 1;
+ soffset = 1;
+ len = 0;
+
+ for (dim = 0; dim < GFC_DESCRIPTOR_RANK (array); dim++)
+ {
+ if (dim == which)
+ {
+ roffset = ret->dim[dim].stride;
+ if (roffset == 0)
+ roffset = 1;
+ soffset = array->dim[dim].stride;
+ if (soffset == 0)
+ soffset = 1;
+ len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+ }
+ else
+ {
+ count[n] = 0;
+ extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+ rstride[n] = ret->dim[dim].stride;
+ sstride[n] = array->dim[dim].stride;
+ n++;
+ }
+ }
+ if (sstride[0] == 0)
+ sstride[0] = 1;
+ if (rstride[0] == 0)
+ rstride[0] = 1;
+
+ dim = GFC_DESCRIPTOR_RANK (array);
+ rstride0 = rstride[0];
+ sstride0 = sstride[0];
+ rptr = ret->data;
+ sptr = array->data;
+
+ shift = len == 0 ? 0 : shift % (ssize_t)len;
+ if (shift < 0)
+ shift += len;
+
+ while (rptr)
+ {
+ /* Do the shift for this dimension. */
+
+ /* If elements are contiguous, perform the operation
+ in two block moves. */
+ if (soffset == 1 && roffset == 1)
+ {
+ size_t len1 = shift * sizeof (GFC_INTEGER_16);
+ size_t len2 = (len - shift) * sizeof (GFC_INTEGER_16);
+ memcpy (rptr, sptr + shift, len2);
+ memcpy (rptr + (len - shift), sptr, len1);
+ }
+ else
+ {
+ /* Otherwise, we will have to perform the copy one element at
+ a time. */
+ GFC_INTEGER_16 *dest = rptr;
+ const GFC_INTEGER_16 *src = &sptr[shift * soffset];
+
+ for (n = 0; n < len - shift; n++)
+ {
+ *dest = *src;
+ dest += roffset;
+ src += soffset;
+ }
+ for (src = sptr, n = 0; n < shift; n++)
+ {
+ *dest = *src;
+ dest += roffset;
+ src += soffset;
+ }
+ }
+
+ /* Advance to the next section. */
+ rptr += rstride0;
+ sptr += sstride0;
+ count[0]++;
+ n = 0;
+ while (count[n] == extent[n])
+ {
+ /* When we get to the end of a dimension, reset it and increment
+ the next dimension. */
+ count[n] = 0;
+ /* We could precalculate these products, but this is a less
+ frequently used path so probably not worth it. */
+ rptr -= rstride[n] * extent[n];
+ sptr -= sstride[n] * extent[n];
+ n++;
+ if (n >= dim - 1)
+ {
+ /* Break out of the loop. */
+ rptr = NULL;
+ break;
+ }
+ else
+ {
+ count[n]++;
+ rptr += rstride[n];
+ sptr += sstride[n];
+ }
+ }
+ }
+
+ return;
+}
+
+#endif
diff --git a/libgfortran/generated/cshift0_i2.c b/libgfortran/generated/cshift0_i2.c
new file mode 100644
index 00000000000..ec2ea1d8b6b
--- /dev/null
+++ b/libgfortran/generated/cshift0_i2.c
@@ -0,0 +1,176 @@
+/* Helper function for cshift functions.
+ Copyright 2008 Free Software Foundation, Inc.
+ Contributed by Thomas Koenig <tkoenig@gcc.gnu.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file. (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING. If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA. */
+
+#include "libgfortran.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+
+#if defined (HAVE_GFC_INTEGER_2)
+
+void
+cshift0_i2 (gfc_array_i2 *ret, const gfc_array_i2 *array, ssize_t shift,
+ int which)
+{
+ /* r.* indicates the return array. */
+ index_type rstride[GFC_MAX_DIMENSIONS];
+ index_type rstride0;
+ index_type roffset;
+ GFC_INTEGER_2 *rptr;
+
+ /* s.* indicates the source array. */
+ index_type sstride[GFC_MAX_DIMENSIONS];
+ index_type sstride0;
+ index_type soffset;
+ const GFC_INTEGER_2 *sptr;
+
+ index_type count[GFC_MAX_DIMENSIONS];
+ index_type extent[GFC_MAX_DIMENSIONS];
+ index_type dim;
+ index_type len;
+ index_type n;
+
+ which = which - 1;
+ sstride[0] = 0;
+ rstride[0] = 0;
+
+ extent[0] = 1;
+ count[0] = 0;
+ n = 0;
+ /* Initialized for avoiding compiler warnings. */
+ roffset = 1;
+ soffset = 1;
+ len = 0;
+
+ for (dim = 0; dim < GFC_DESCRIPTOR_RANK (array); dim++)
+ {
+ if (dim == which)
+ {
+ roffset = ret->dim[dim].stride;
+ if (roffset == 0)
+ roffset = 1;
+ soffset = array->dim[dim].stride;
+ if (soffset == 0)
+ soffset = 1;
+ len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+ }
+ else
+ {
+ count[n] = 0;
+ extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+ rstride[n] = ret->dim[dim].stride;
+ sstride[n] = array->dim[dim].stride;
+ n++;
+ }
+ }
+ if (sstride[0] == 0)
+ sstride[0] = 1;
+ if (rstride[0] == 0)
+ rstride[0] = 1;
+
+ dim = GFC_DESCRIPTOR_RANK (array);
+ rstride0 = rstride[0];
+ sstride0 = sstride[0];
+ rptr = ret->data;
+ sptr = array->data;
+
+ shift = len == 0 ? 0 : shift % (ssize_t)len;
+ if (shift < 0)
+ shift += len;
+
+ while (rptr)
+ {
+ /* Do the shift for this dimension. */
+
+ /* If elements are contiguous, perform the operation
+ in two block moves. */
+ if (soffset == 1 && roffset == 1)
+ {
+ size_t len1 = shift * sizeof (GFC_INTEGER_2);
+ size_t len2 = (len - shift) * sizeof (GFC_INTEGER_2);
+ memcpy (rptr, sptr + shift, len2);
+ memcpy (rptr + (len - shift), sptr, len1);
+ }
+ else
+ {
+ /* Otherwise, we will have to perform the copy one element at
+ a time. */
+ GFC_INTEGER_2 *dest = rptr;
+ const GFC_INTEGER_2 *src = &sptr[shift * soffset];
+
+ for (n = 0; n < len - shift; n++)
+ {
+ *dest = *src;
+ dest += roffset;
+ src += soffset;
+ }
+ for (src = sptr, n = 0; n < shift; n++)
+ {
+ *dest = *src;
+ dest += roffset;
+ src += soffset;
+ }
+ }
+
+ /* Advance to the next section. */
+ rptr += rstride0;
+ sptr += sstride0;
+ count[0]++;
+ n = 0;
+ while (count[n] == extent[n])
+ {
+ /* When we get to the end of a dimension, reset it and increment
+ the next dimension. */
+ count[n] = 0;
+ /* We could precalculate these products, but this is a less
+ frequently used path so probably not worth it. */
+ rptr -= rstride[n] * extent[n];
+ sptr -= sstride[n] * extent[n];
+ n++;
+ if (n >= dim - 1)
+ {
+ /* Break out of the loop. */
+ rptr = NULL;
+ break;
+ }
+ else
+ {
+ count[n]++;
+ rptr += rstride[n];
+ sptr += sstride[n];
+ }
+ }
+ }
+
+ return;
+}
+
+#endif
diff --git a/libgfortran/generated/cshift0_i4.c b/libgfortran/generated/cshift0_i4.c
new file mode 100644
index 00000000000..c2dc7b83764
--- /dev/null
+++ b/libgfortran/generated/cshift0_i4.c
@@ -0,0 +1,176 @@
+/* Helper function for cshift functions.
+ Copyright 2008 Free Software Foundation, Inc.
+ Contributed by Thomas Koenig <tkoenig@gcc.gnu.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file. (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING. If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA. */
+
+#include "libgfortran.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+
+#if defined (HAVE_GFC_INTEGER_4)
+
+void
+cshift0_i4 (gfc_array_i4 *ret, const gfc_array_i4 *array, ssize_t shift,
+ int which)
+{
+ /* r.* indicates the return array. */
+ index_type rstride[GFC_MAX_DIMENSIONS];
+ index_type rstride0;
+ index_type roffset;
+ GFC_INTEGER_4 *rptr;
+
+ /* s.* indicates the source array. */
+ index_type sstride[GFC_MAX_DIMENSIONS];
+ index_type sstride0;
+ index_type soffset;
+ const GFC_INTEGER_4 *sptr;
+
+ index_type count[GFC_MAX_DIMENSIONS];
+ index_type extent[GFC_MAX_DIMENSIONS];
+ index_type dim;
+ index_type len;
+ index_type n;
+
+ which = which - 1;
+ sstride[0] = 0;
+ rstride[0] = 0;
+
+ extent[0] = 1;
+ count[0] = 0;
+ n = 0;
+ /* Initialized for avoiding compiler warnings. */
+ roffset = 1;
+ soffset = 1;
+ len = 0;
+
+ for (dim = 0; dim < GFC_DESCRIPTOR_RANK (array); dim++)
+ {
+ if (dim == which)
+ {
+ roffset = ret->dim[dim].stride;
+ if (roffset == 0)
+ roffset = 1;
+ soffset = array->dim[dim].stride;
+ if (soffset == 0)
+ soffset = 1;
+ len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+ }
+ else
+ {
+ count[n] = 0;
+ extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+ rstride[n] = ret->dim[dim].stride;
+ sstride[n] = array->dim[dim].stride;
+ n++;
+ }
+ }
+ if (sstride[0] == 0)
+ sstride[0] = 1;
+ if (rstride[0] == 0)
+ rstride[0] = 1;
+
+ dim = GFC_DESCRIPTOR_RANK (array);
+ rstride0 = rstride[0];
+ sstride0 = sstride[0];
+ rptr = ret->data;
+ sptr = array->data;
+
+ shift = len == 0 ? 0 : shift % (ssize_t)len;
+ if (shift < 0)
+ shift += len;
+
+ while (rptr)
+ {
+ /* Do the shift for this dimension. */
+
+ /* If elements are contiguous, perform the operation
+ in two block moves. */
+ if (soffset == 1 && roffset == 1)
+ {
+ size_t len1 = shift * sizeof (GFC_INTEGER_4);
+ size_t len2 = (len - shift) * sizeof (GFC_INTEGER_4);
+ memcpy (rptr, sptr + shift, len2);
+ memcpy (rptr + (len - shift), sptr, len1);
+ }
+ else
+ {
+ /* Otherwise, we will have to perform the copy one element at
+ a time. */
+ GFC_INTEGER_4 *dest = rptr;
+ const GFC_INTEGER_4 *src = &sptr[shift * soffset];
+
+ for (n = 0; n < len - shift; n++)
+ {
+ *dest = *src;
+ dest += roffset;
+ src += soffset;
+ }
+ for (src = sptr, n = 0; n < shift; n++)
+ {
+ *dest = *src;
+ dest += roffset;
+ src += soffset;
+ }
+ }
+
+ /* Advance to the next section. */
+ rptr += rstride0;
+ sptr += sstride0;
+ count[0]++;
+ n = 0;
+ while (count[n] == extent[n])
+ {
+ /* When we get to the end of a dimension, reset it and increment
+ the next dimension. */
+ count[n] = 0;
+ /* We could precalculate these products, but this is a less
+ frequently used path so probably not worth it. */
+ rptr -= rstride[n] * extent[n];
+ sptr -= sstride[n] * extent[n];
+ n++;
+ if (n >= dim - 1)
+ {
+ /* Break out of the loop. */
+ rptr = NULL;
+ break;
+ }
+ else
+ {
+ count[n]++;
+ rptr += rstride[n];
+ sptr += sstride[n];
+ }
+ }
+ }
+
+ return;
+}
+
+#endif
diff --git a/libgfortran/generated/cshift0_i8.c b/libgfortran/generated/cshift0_i8.c
new file mode 100644
index 00000000000..b4e38659172
--- /dev/null
+++ b/libgfortran/generated/cshift0_i8.c
@@ -0,0 +1,176 @@
+/* Helper function for cshift functions.
+ Copyright 2008 Free Software Foundation, Inc.
+ Contributed by Thomas Koenig <tkoenig@gcc.gnu.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file. (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING. If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA. */
+
+#include "libgfortran.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+
+#if defined (HAVE_GFC_INTEGER_8)
+
+void
+cshift0_i8 (gfc_array_i8 *ret, const gfc_array_i8 *array, ssize_t shift,
+ int which)
+{
+ /* r.* indicates the return array. */
+ index_type rstride[GFC_MAX_DIMENSIONS];
+ index_type rstride0;
+ index_type roffset;
+ GFC_INTEGER_8 *rptr;
+
+ /* s.* indicates the source array. */
+ index_type sstride[GFC_MAX_DIMENSIONS];
+ index_type sstride0;
+ index_type soffset;
+ const GFC_INTEGER_8 *sptr;
+
+ index_type count[GFC_MAX_DIMENSIONS];
+ index_type extent[GFC_MAX_DIMENSIONS];
+ index_type dim;
+ index_type len;
+ index_type n;
+
+ which = which - 1;
+ sstride[0] = 0;
+ rstride[0] = 0;
+
+ extent[0] = 1;
+ count[0] = 0;
+ n = 0;
+ /* Initialized for avoiding compiler warnings. */
+ roffset = 1;
+ soffset = 1;
+ len = 0;
+
+ for (dim = 0; dim < GFC_DESCRIPTOR_RANK (array); dim++)
+ {
+ if (dim == which)
+ {
+ roffset = ret->dim[dim].stride;
+ if (roffset == 0)
+ roffset = 1;
+ soffset = array->dim[dim].stride;
+ if (soffset == 0)
+ soffset = 1;
+ len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+ }
+ else
+ {
+ count[n] = 0;
+ extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+ rstride[n] = ret->dim[dim].stride;
+ sstride[n] = array->dim[dim].stride;
+ n++;
+ }
+ }
+ if (sstride[0] == 0)
+ sstride[0] = 1;
+ if (rstride[0] == 0)
+ rstride[0] = 1;
+
+ dim = GFC_DESCRIPTOR_RANK (array);
+ rstride0 = rstride[0];
+ sstride0 = sstride[0];
+ rptr = ret->data;
+ sptr = array->data;
+
+ shift = len == 0 ? 0 : shift % (ssize_t)len;
+ if (shift < 0)
+ shift += len;
+
+ while (rptr)
+ {
+ /* Do the shift for this dimension. */
+
+ /* If elements are contiguous, perform the operation
+ in two block moves. */
+ if (soffset == 1 && roffset == 1)
+ {
+ size_t len1 = shift * sizeof (GFC_INTEGER_8);
+ size_t len2 = (len - shift) * sizeof (GFC_INTEGER_8);
+ memcpy (rptr, sptr + shift, len2);
+ memcpy (rptr + (len - shift), sptr, len1);
+ }
+ else
+ {
+ /* Otherwise, we will have to perform the copy one element at
+ a time. */
+ GFC_INTEGER_8 *dest = rptr;
+ const GFC_INTEGER_8 *src = &sptr[shift * soffset];
+
+ for (n = 0; n < len - shift; n++)
+ {
+ *dest = *src;
+ dest += roffset;
+ src += soffset;
+ }
+ for (src = sptr, n = 0; n < shift; n++)
+ {
+ *dest = *src;
+ dest += roffset;
+ src += soffset;
+ }
+ }
+
+ /* Advance to the next section. */
+ rptr += rstride0;
+ sptr += sstride0;
+ count[0]++;
+ n = 0;
+ while (count[n] == extent[n])
+ {
+ /* When we get to the end of a dimension, reset it and increment
+ the next dimension. */
+ count[n] = 0;
+ /* We could precalculate these products, but this is a less
+ frequently used path so probably not worth it. */
+ rptr -= rstride[n] * extent[n];
+ sptr -= sstride[n] * extent[n];
+ n++;
+ if (n >= dim - 1)
+ {
+ /* Break out of the loop. */
+ rptr = NULL;
+ break;
+ }
+ else
+ {
+ count[n]++;
+ rptr += rstride[n];
+ sptr += sstride[n];
+ }
+ }
+ }
+
+ return;
+}
+
+#endif
diff --git a/libgfortran/generated/cshift0_r10.c b/libgfortran/generated/cshift0_r10.c
new file mode 100644
index 00000000000..1eb9169e93a
--- /dev/null
+++ b/libgfortran/generated/cshift0_r10.c
@@ -0,0 +1,176 @@
+/* Helper function for cshift functions.
+ Copyright 2008 Free Software Foundation, Inc.
+ Contributed by Thomas Koenig <tkoenig@gcc.gnu.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file. (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING. If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA. */
+
+#include "libgfortran.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+
+#if defined (HAVE_GFC_REAL_10)
+
+void
+cshift0_r10 (gfc_array_r10 *ret, const gfc_array_r10 *array, ssize_t shift,
+ int which)
+{
+ /* r.* indicates the return array. */
+ index_type rstride[GFC_MAX_DIMENSIONS];
+ index_type rstride0;
+ index_type roffset;
+ GFC_REAL_10 *rptr;
+
+ /* s.* indicates the source array. */
+ index_type sstride[GFC_MAX_DIMENSIONS];
+ index_type sstride0;
+ index_type soffset;
+ const GFC_REAL_10 *sptr;
+
+ index_type count[GFC_MAX_DIMENSIONS];
+ index_type extent[GFC_MAX_DIMENSIONS];
+ index_type dim;
+ index_type len;
+ index_type n;
+
+ which = which - 1;
+ sstride[0] = 0;
+ rstride[0] = 0;
+
+ extent[0] = 1;
+ count[0] = 0;
+ n = 0;
+ /* Initialized for avoiding compiler warnings. */
+ roffset = 1;
+ soffset = 1;
+ len = 0;
+
+ for (dim = 0; dim < GFC_DESCRIPTOR_RANK (array); dim++)
+ {
+ if (dim == which)
+ {
+ roffset = ret->dim[dim].stride;
+ if (roffset == 0)
+ roffset = 1;
+ soffset = array->dim[dim].stride;
+ if (soffset == 0)
+ soffset = 1;
+ len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+ }
+ else
+ {
+ count[n] = 0;
+ extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+ rstride[n] = ret->dim[dim].stride;
+ sstride[n] = array->dim[dim].stride;
+ n++;
+ }
+ }
+ if (sstride[0] == 0)
+ sstride[0] = 1;
+ if (rstride[0] == 0)
+ rstride[0] = 1;
+
+ dim = GFC_DESCRIPTOR_RANK (array);
+ rstride0 = rstride[0];
+ sstride0 = sstride[0];
+ rptr = ret->data;
+ sptr = array->data;
+
+ shift = len == 0 ? 0 : shift % (ssize_t)len;
+ if (shift < 0)
+ shift += len;
+
+ while (rptr)
+ {
+ /* Do the shift for this dimension. */
+
+ /* If elements are contiguous, perform the operation
+ in two block moves. */
+ if (soffset == 1 && roffset == 1)
+ {
+ size_t len1 = shift * sizeof (GFC_REAL_10);
+ size_t len2 = (len - shift) * sizeof (GFC_REAL_10);
+ memcpy (rptr, sptr + shift, len2);
+ memcpy (rptr + (len - shift), sptr, len1);
+ }
+ else
+ {
+ /* Otherwise, we will have to perform the copy one element at
+ a time. */
+ GFC_REAL_10 *dest = rptr;
+ const GFC_REAL_10 *src = &sptr[shift * soffset];
+
+ for (n = 0; n < len - shift; n++)
+ {
+ *dest = *src;
+ dest += roffset;
+ src += soffset;
+ }
+ for (src = sptr, n = 0; n < shift; n++)
+ {
+ *dest = *src;
+ dest += roffset;
+ src += soffset;
+ }
+ }
+
+ /* Advance to the next section. */
+ rptr += rstride0;
+ sptr += sstride0;
+ count[0]++;
+ n = 0;
+ while (count[n] == extent[n])
+ {
+ /* When we get to the end of a dimension, reset it and increment
+ the next dimension. */
+ count[n] = 0;
+ /* We could precalculate these products, but this is a less
+ frequently used path so probably not worth it. */
+ rptr -= rstride[n] * extent[n];
+ sptr -= sstride[n] * extent[n];
+ n++;
+ if (n >= dim - 1)
+ {
+ /* Break out of the loop. */
+ rptr = NULL;
+ break;
+ }
+ else
+ {
+ count[n]++;
+ rptr += rstride[n];
+ sptr += sstride[n];
+ }
+ }
+ }
+
+ return;
+}
+
+#endif
diff --git a/libgfortran/generated/cshift0_r16.c b/libgfortran/generated/cshift0_r16.c
new file mode 100644
index 00000000000..c4e229bdaa7
--- /dev/null
+++ b/libgfortran/generated/cshift0_r16.c
@@ -0,0 +1,176 @@
+/* Helper function for cshift functions.
+ Copyright 2008 Free Software Foundation, Inc.
+ Contributed by Thomas Koenig <tkoenig@gcc.gnu.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file. (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING. If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA. */
+
+#include "libgfortran.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+
+#if defined (HAVE_GFC_REAL_16)
+
+void
+cshift0_r16 (gfc_array_r16 *ret, const gfc_array_r16 *array, ssize_t shift,
+ int which)
+{
+ /* r.* indicates the return array. */
+ index_type rstride[GFC_MAX_DIMENSIONS];
+ index_type rstride0;
+ index_type roffset;
+ GFC_REAL_16 *rptr;
+
+ /* s.* indicates the source array. */
+ index_type sstride[GFC_MAX_DIMENSIONS];
+ index_type sstride0;
+ index_type soffset;
+ const GFC_REAL_16 *sptr;
+
+ index_type count[GFC_MAX_DIMENSIONS];
+ index_type extent[GFC_MAX_DIMENSIONS];
+ index_type dim;
+ index_type len;
+ index_type n;
+
+ which = which - 1;
+ sstride[0] = 0;
+ rstride[0] = 0;
+
+ extent[0] = 1;
+ count[0] = 0;
+ n = 0;
+ /* Initialized for avoiding compiler warnings. */
+ roffset = 1;
+ soffset = 1;
+ len = 0;
+
+ for (dim = 0; dim < GFC_DESCRIPTOR_RANK (array); dim++)
+ {
+ if (dim == which)
+ {
+ roffset = ret->dim[dim].stride;
+ if (roffset == 0)
+ roffset = 1;
+ soffset = array->dim[dim].stride;
+ if (soffset == 0)
+ soffset = 1;
+ len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+ }
+ else
+ {
+ count[n] = 0;
+ extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+ rstride[n] = ret->dim[dim].stride;
+ sstride[n] = array->dim[dim].stride;
+ n++;
+ }
+ }
+ if (sstride[0] == 0)
+ sstride[0] = 1;
+ if (rstride[0] == 0)
+ rstride[0] = 1;
+
+ dim = GFC_DESCRIPTOR_RANK (array);
+ rstride0 = rstride[0];
+ sstride0 = sstride[0];
+ rptr = ret->data;
+ sptr = array->data;
+
+ shift = len == 0 ? 0 : shift % (ssize_t)len;
+ if (shift < 0)
+ shift += len;
+
+ while (rptr)
+ {
+ /* Do the shift for this dimension. */
+
+ /* If elements are contiguous, perform the operation
+ in two block moves. */
+ if (soffset == 1 && roffset == 1)
+ {
+ size_t len1 = shift * sizeof (GFC_REAL_16);
+ size_t len2 = (len - shift) * sizeof (GFC_REAL_16);
+ memcpy (rptr, sptr + shift, len2);
+ memcpy (rptr + (len - shift), sptr, len1);
+ }
+ else
+ {
+ /* Otherwise, we will have to perform the copy one element at
+ a time. */
+ GFC_REAL_16 *dest = rptr;
+ const GFC_REAL_16 *src = &sptr[shift * soffset];
+
+ for (n = 0; n < len - shift; n++)
+ {
+ *dest = *src;
+ dest += roffset;
+ src += soffset;
+ }
+ for (src = sptr, n = 0; n < shift; n++)
+ {
+ *dest = *src;
+ dest += roffset;
+ src += soffset;
+ }
+ }
+
+ /* Advance to the next section. */
+ rptr += rstride0;
+ sptr += sstride0;
+ count[0]++;
+ n = 0;
+ while (count[n] == extent[n])
+ {
+ /* When we get to the end of a dimension, reset it and increment
+ the next dimension. */
+ count[n] = 0;
+ /* We could precalculate these products, but this is a less
+ frequently used path so probably not worth it. */
+ rptr -= rstride[n] * extent[n];
+ sptr -= sstride[n] * extent[n];
+ n++;
+ if (n >= dim - 1)
+ {
+ /* Break out of the loop. */
+ rptr = NULL;
+ break;
+ }
+ else
+ {
+ count[n]++;
+ rptr += rstride[n];
+ sptr += sstride[n];
+ }
+ }
+ }
+
+ return;
+}
+
+#endif
diff --git a/libgfortran/generated/cshift0_r4.c b/libgfortran/generated/cshift0_r4.c
new file mode 100644
index 00000000000..112ff97e5d3
--- /dev/null
+++ b/libgfortran/generated/cshift0_r4.c
@@ -0,0 +1,176 @@
+/* Helper function for cshift functions.
+ Copyright 2008 Free Software Foundation, Inc.
+ Contributed by Thomas Koenig <tkoenig@gcc.gnu.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file. (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING. If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA. */
+
+#include "libgfortran.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+
+#if defined (HAVE_GFC_REAL_4)
+
+void
+cshift0_r4 (gfc_array_r4 *ret, const gfc_array_r4 *array, ssize_t shift,
+ int which)
+{
+ /* r.* indicates the return array. */
+ index_type rstride[GFC_MAX_DIMENSIONS];
+ index_type rstride0;
+ index_type roffset;
+ GFC_REAL_4 *rptr;
+
+ /* s.* indicates the source array. */
+ index_type sstride[GFC_MAX_DIMENSIONS];
+ index_type sstride0;
+ index_type soffset;
+ const GFC_REAL_4 *sptr;
+
+ index_type count[GFC_MAX_DIMENSIONS];
+ index_type extent[GFC_MAX_DIMENSIONS];
+ index_type dim;
+ index_type len;
+ index_type n;
+
+ which = which - 1;
+ sstride[0] = 0;
+ rstride[0] = 0;
+
+ extent[0] = 1;
+ count[0] = 0;
+ n = 0;
+ /* Initialized for avoiding compiler warnings. */
+ roffset = 1;
+ soffset = 1;
+ len = 0;
+
+ for (dim = 0; dim < GFC_DESCRIPTOR_RANK (array); dim++)
+ {
+ if (dim == which)
+ {
+ roffset = ret->dim[dim].stride;
+ if (roffset == 0)
+ roffset = 1;
+ soffset = array->dim[dim].stride;
+ if (soffset == 0)
+ soffset = 1;
+ len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+ }
+ else
+ {
+ count[n] = 0;
+ extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+ rstride[n] = ret->dim[dim].stride;
+ sstride[n] = array->dim[dim].stride;
+ n++;
+ }
+ }
+ if (sstride[0] == 0)
+ sstride[0] = 1;
+ if (rstride[0] == 0)
+ rstride[0] = 1;
+
+ dim = GFC_DESCRIPTOR_RANK (array);
+ rstride0 = rstride[0];
+ sstride0 = sstride[0];
+ rptr = ret->data;
+ sptr = array->data;
+
+ shift = len == 0 ? 0 : shift % (ssize_t)len;
+ if (shift < 0)
+ shift += len;
+
+ while (rptr)
+ {
+ /* Do the shift for this dimension. */
+
+ /* If elements are contiguous, perform the operation
+ in two block moves. */
+ if (soffset == 1 && roffset == 1)
+ {
+ size_t len1 = shift * sizeof (GFC_REAL_4);
+ size_t len2 = (len - shift) * sizeof (GFC_REAL_4);
+ memcpy (rptr, sptr + shift, len2);
+ memcpy (rptr + (len - shift), sptr, len1);
+ }
+ else
+ {
+ /* Otherwise, we will have to perform the copy one element at
+ a time. */
+ GFC_REAL_4 *dest = rptr;
+ const GFC_REAL_4 *src = &sptr[shift * soffset];
+
+ for (n = 0; n < len - shift; n++)
+ {
+ *dest = *src;
+ dest += roffset;
+ src += soffset;
+ }
+ for (src = sptr, n = 0; n < shift; n++)
+ {
+ *dest = *src;
+ dest += roffset;
+ src += soffset;
+ }
+ }
+
+ /* Advance to the next section. */
+ rptr += rstride0;
+ sptr += sstride0;
+ count[0]++;
+ n = 0;
+ while (count[n] == extent[n])
+ {
+ /* When we get to the end of a dimension, reset it and increment
+ the next dimension. */
+ count[n] = 0;
+ /* We could precalculate these products, but this is a less
+ frequently used path so probably not worth it. */
+ rptr -= rstride[n] * extent[n];
+ sptr -= sstride[n] * extent[n];
+ n++;
+ if (n >= dim - 1)
+ {
+ /* Break out of the loop. */
+ rptr = NULL;
+ break;
+ }
+ else
+ {
+ count[n]++;
+ rptr += rstride[n];
+ sptr += sstride[n];
+ }
+ }
+ }
+
+ return;
+}
+
+#endif
diff --git a/libgfortran/generated/cshift0_r8.c b/libgfortran/generated/cshift0_r8.c
new file mode 100644
index 00000000000..a167fd3306a
--- /dev/null
+++ b/libgfortran/generated/cshift0_r8.c
@@ -0,0 +1,176 @@
+/* Helper function for cshift functions.
+ Copyright 2008 Free Software Foundation, Inc.
+ Contributed by Thomas Koenig <tkoenig@gcc.gnu.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file. (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING. If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA. */
+
+#include "libgfortran.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+
+#if defined (HAVE_GFC_REAL_8)
+
+void
+cshift0_r8 (gfc_array_r8 *ret, const gfc_array_r8 *array, ssize_t shift,
+ int which)
+{
+ /* r.* indicates the return array. */
+ index_type rstride[GFC_MAX_DIMENSIONS];
+ index_type rstride0;
+ index_type roffset;
+ GFC_REAL_8 *rptr;
+
+ /* s.* indicates the source array. */
+ index_type sstride[GFC_MAX_DIMENSIONS];
+ index_type sstride0;
+ index_type soffset;
+ const GFC_REAL_8 *sptr;
+
+ index_type count[GFC_MAX_DIMENSIONS];
+ index_type extent[GFC_MAX_DIMENSIONS];
+ index_type dim;
+ index_type len;
+ index_type n;
+
+ which = which - 1;
+ sstride[0] = 0;
+ rstride[0] = 0;
+
+ extent[0] = 1;
+ count[0] = 0;
+ n = 0;
+ /* Initialized for avoiding compiler warnings. */
+ roffset = 1;
+ soffset = 1;
+ len = 0;
+
+ for (dim = 0; dim < GFC_DESCRIPTOR_RANK (array); dim++)
+ {
+ if (dim == which)
+ {
+ roffset = ret->dim[dim].stride;
+ if (roffset == 0)
+ roffset = 1;
+ soffset = array->dim[dim].stride;
+ if (soffset == 0)
+ soffset = 1;
+ len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+ }
+ else
+ {
+ count[n] = 0;
+ extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+ rstride[n] = ret->dim[dim].stride;
+ sstride[n] = array->dim[dim].stride;
+ n++;
+ }
+ }
+ if (sstride[0] == 0)
+ sstride[0] = 1;
+ if (rstride[0] == 0)
+ rstride[0] = 1;
+
+ dim = GFC_DESCRIPTOR_RANK (array);
+ rstride0 = rstride[0];
+ sstride0 = sstride[0];
+ rptr = ret->data;
+ sptr = array->data;
+
+ shift = len == 0 ? 0 : shift % (ssize_t)len;
+ if (shift < 0)
+ shift += len;
+
+ while (rptr)
+ {
+ /* Do the shift for this dimension. */
+
+ /* If elements are contiguous, perform the operation
+ in two block moves. */
+ if (soffset == 1 && roffset == 1)
+ {
+ size_t len1 = shift * sizeof (GFC_REAL_8);
+ size_t len2 = (len - shift) * sizeof (GFC_REAL_8);
+ memcpy (rptr, sptr + shift, len2);
+ memcpy (rptr + (len - shift), sptr, len1);
+ }
+ else
+ {
+ /* Otherwise, we will have to perform the copy one element at
+ a time. */
+ GFC_REAL_8 *dest = rptr;
+ const GFC_REAL_8 *src = &sptr[shift * soffset];
+
+ for (n = 0; n < len - shift; n++)
+ {
+ *dest = *src;
+ dest += roffset;
+ src += soffset;
+ }
+ for (src = sptr, n = 0; n < shift; n++)
+ {
+ *dest = *src;
+ dest += roffset;
+ src += soffset;
+ }
+ }
+
+ /* Advance to the next section. */
+ rptr += rstride0;
+ sptr += sstride0;
+ count[0]++;
+ n = 0;
+ while (count[n] == extent[n])
+ {
+ /* When we get to the end of a dimension, reset it and increment
+ the next dimension. */
+ count[n] = 0;
+ /* We could precalculate these products, but this is a less
+ frequently used path so probably not worth it. */
+ rptr -= rstride[n] * extent[n];
+ sptr -= sstride[n] * extent[n];
+ n++;
+ if (n >= dim - 1)
+ {
+ /* Break out of the loop. */
+ rptr = NULL;
+ break;
+ }
+ else
+ {
+ count[n]++;
+ rptr += rstride[n];
+ sptr += sstride[n];
+ }
+ }
+ }
+
+ return;
+}
+
+#endif
diff --git a/libgfortran/generated/cshift1_16.c b/libgfortran/generated/cshift1_16.c
index 2943c3ed86d..06e27468e85 100644
--- a/libgfortran/generated/cshift1_16.c
+++ b/libgfortran/generated/cshift1_16.c
@@ -67,6 +67,7 @@ cshift1 (gfc_array_char * const restrict ret,
index_type n;
int which;
GFC_INTEGER_16 sh;
+ index_type arraysize;
if (pwhich)
which = *pwhich - 1;
@@ -76,11 +77,13 @@ cshift1 (gfc_array_char * const restrict ret,
if (which < 0 || (which + 1) > GFC_DESCRIPTOR_RANK (array))
runtime_error ("Argument 'DIM' is out of range in call to 'CSHIFT'");
+ arraysize = size0 ((array_t *)array);
+
if (ret->data == NULL)
{
int i;
- ret->data = internal_malloc_size (size * size0 ((array_t *)array));
+ ret->data = internal_malloc_size (size * arraysize);
ret->offset = 0;
ret->dtype = array->dtype;
for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
@@ -95,6 +98,9 @@ cshift1 (gfc_array_char * const restrict ret,
}
}
+ if (arraysize == 0)
+ return;
+
extent[0] = 1;
count[0] = 0;
n = 0;
diff --git a/libgfortran/generated/cshift1_4.c b/libgfortran/generated/cshift1_4.c
index 3f4f9e0bf25..3be3c3c15a6 100644
--- a/libgfortran/generated/cshift1_4.c
+++ b/libgfortran/generated/cshift1_4.c
@@ -67,6 +67,7 @@ cshift1 (gfc_array_char * const restrict ret,
index_type n;
int which;
GFC_INTEGER_4 sh;
+ index_type arraysize;
if (pwhich)
which = *pwhich - 1;
@@ -76,11 +77,13 @@ cshift1 (gfc_array_char * const restrict ret,
if (which < 0 || (which + 1) > GFC_DESCRIPTOR_RANK (array))
runtime_error ("Argument 'DIM' is out of range in call to 'CSHIFT'");
+ arraysize = size0 ((array_t *)array);
+
if (ret->data == NULL)
{
int i;
- ret->data = internal_malloc_size (size * size0 ((array_t *)array));
+ ret->data = internal_malloc_size (size * arraysize);
ret->offset = 0;
ret->dtype = array->dtype;
for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
@@ -95,6 +98,9 @@ cshift1 (gfc_array_char * const restrict ret,
}
}
+ if (arraysize == 0)
+ return;
+
extent[0] = 1;
count[0] = 0;
n = 0;
diff --git a/libgfortran/generated/cshift1_8.c b/libgfortran/generated/cshift1_8.c
index 4d246e54d95..b444a691acc 100644
--- a/libgfortran/generated/cshift1_8.c
+++ b/libgfortran/generated/cshift1_8.c
@@ -67,6 +67,7 @@ cshift1 (gfc_array_char * const restrict ret,
index_type n;
int which;
GFC_INTEGER_8 sh;
+ index_type arraysize;
if (pwhich)
which = *pwhich - 1;
@@ -76,11 +77,13 @@ cshift1 (gfc_array_char * const restrict ret,
if (which < 0 || (which + 1) > GFC_DESCRIPTOR_RANK (array))
runtime_error ("Argument 'DIM' is out of range in call to 'CSHIFT'");
+ arraysize = size0 ((array_t *)array);
+
if (ret->data == NULL)
{
int i;
- ret->data = internal_malloc_size (size * size0 ((array_t *)array));
+ ret->data = internal_malloc_size (size * arraysize);
ret->offset = 0;
ret->dtype = array->dtype;
for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
@@ -95,6 +98,9 @@ cshift1 (gfc_array_char * const restrict ret,
}
}
+ if (arraysize == 0)
+ return;
+
extent[0] = 1;
count[0] = 0;
n = 0;
diff --git a/libgfortran/generated/eoshift1_16.c b/libgfortran/generated/eoshift1_16.c
index 63b75bdbd6b..fd145c12e6e 100644
--- a/libgfortran/generated/eoshift1_16.c
+++ b/libgfortran/generated/eoshift1_16.c
@@ -102,6 +102,11 @@ eoshift1 (gfc_array_char * const restrict ret,
ret->dim[i].stride = (ret->dim[i-1].ubound + 1) * ret->dim[i-1].stride;
}
}
+ else
+ {
+ if (size0 ((array_t *) ret) == 0)
+ return;
+ }
n = 0;
for (dim = 0; dim < GFC_DESCRIPTOR_RANK (array); dim++)
diff --git a/libgfortran/generated/eoshift1_4.c b/libgfortran/generated/eoshift1_4.c
index 58ce7e9f5dd..d78c40a1113 100644
--- a/libgfortran/generated/eoshift1_4.c
+++ b/libgfortran/generated/eoshift1_4.c
@@ -102,6 +102,11 @@ eoshift1 (gfc_array_char * const restrict ret,
ret->dim[i].stride = (ret->dim[i-1].ubound + 1) * ret->dim[i-1].stride;
}
}
+ else
+ {
+ if (size0 ((array_t *) ret) == 0)
+ return;
+ }
n = 0;
for (dim = 0; dim < GFC_DESCRIPTOR_RANK (array); dim++)
diff --git a/libgfortran/generated/eoshift1_8.c b/libgfortran/generated/eoshift1_8.c
index 0e9c2f1442a..06d55323369 100644
--- a/libgfortran/generated/eoshift1_8.c
+++ b/libgfortran/generated/eoshift1_8.c
@@ -102,6 +102,11 @@ eoshift1 (gfc_array_char * const restrict ret,
ret->dim[i].stride = (ret->dim[i-1].ubound + 1) * ret->dim[i-1].stride;
}
}
+ else
+ {
+ if (size0 ((array_t *) ret) == 0)
+ return;
+ }
n = 0;
for (dim = 0; dim < GFC_DESCRIPTOR_RANK (array); dim++)
diff --git a/libgfortran/generated/eoshift3_16.c b/libgfortran/generated/eoshift3_16.c
index 214f3783d4f..66a507773ac 100644
--- a/libgfortran/generated/eoshift3_16.c
+++ b/libgfortran/generated/eoshift3_16.c
@@ -103,6 +103,11 @@ eoshift3 (gfc_array_char * const restrict ret,
ret->dim[i].stride = (ret->dim[i-1].ubound + 1) * ret->dim[i-1].stride;
}
}
+ else
+ {
+ if (size0 ((array_t *) ret) == 0)
+ return;
+ }
extent[0] = 1;
diff --git a/libgfortran/generated/eoshift3_4.c b/libgfortran/generated/eoshift3_4.c
index e96ef2504b0..3579cffd483 100644
--- a/libgfortran/generated/eoshift3_4.c
+++ b/libgfortran/generated/eoshift3_4.c
@@ -103,6 +103,11 @@ eoshift3 (gfc_array_char * const restrict ret,
ret->dim[i].stride = (ret->dim[i-1].ubound + 1) * ret->dim[i-1].stride;
}
}
+ else
+ {
+ if (size0 ((array_t *) ret) == 0)
+ return;
+ }
extent[0] = 1;
diff --git a/libgfortran/generated/eoshift3_8.c b/libgfortran/generated/eoshift3_8.c
index dc39b94eb97..de969a0c92b 100644
--- a/libgfortran/generated/eoshift3_8.c
+++ b/libgfortran/generated/eoshift3_8.c
@@ -103,6 +103,11 @@ eoshift3 (gfc_array_char * const restrict ret,
ret->dim[i].stride = (ret->dim[i-1].ubound + 1) * ret->dim[i-1].stride;
}
}
+ else
+ {
+ if (size0 ((array_t *) ret) == 0)
+ return;
+ }
extent[0] = 1;
diff --git a/libgfortran/gfortran.map b/libgfortran/gfortran.map
index 0671b60fb86..93973d5b338 100644
--- a/libgfortran/gfortran.map
+++ b/libgfortran/gfortran.map
@@ -1072,6 +1072,7 @@ GFORTRAN_1.1 {
_gfortran_pack_char4;
_gfortran_pack_s_char4;
_gfortran_reshape_char4;
+ _gfortran_runtime_warning_at;
_gfortran_selected_char_kind;
_gfortran_select_string_char4;
_gfortran_spread_char4;
diff --git a/libgfortran/intrinsics/cshift0.c b/libgfortran/intrinsics/cshift0.c
index 76ce97e0f10..73849d1a44f 100644
--- a/libgfortran/intrinsics/cshift0.c
+++ b/libgfortran/intrinsics/cshift0.c
@@ -33,48 +33,6 @@ Boston, MA 02110-1301, USA. */
#include <assert.h>
#include <string.h>
-
-/* "Templatized" helper function for the inner shift loop. */
-
-#define DEF_COPY_LOOP(NAME, TYPE) \
-static inline void \
-copy_loop_##NAME (void *xdest, const void *xsrc, \
- size_t roff, size_t soff, \
- index_type len, index_type shift) \
-{ \
- TYPE *dest = xdest; \
- const TYPE *src; \
- index_type i; \
- \
- roff /= sizeof (TYPE); \
- soff /= sizeof (TYPE); \
- \
- src = xsrc; \
- src += shift * soff; \
- for (i = 0; i < len - shift; ++i) \
- { \
- *dest = *src; \
- dest += roff; \
- src += soff; \
- } \
- \
- src = xsrc; \
- for (i = 0; i < shift; ++i) \
- { \
- *dest = *src; \
- dest += roff; \
- src += soff; \
- } \
-}
-
-DEF_COPY_LOOP(int, int)
-DEF_COPY_LOOP(long, long)
-DEF_COPY_LOOP(double, double)
-DEF_COPY_LOOP(ldouble, long double)
-DEF_COPY_LOOP(cfloat, _Complex float)
-DEF_COPY_LOOP(cdouble, _Complex double)
-
-
static void
cshift0 (gfc_array_char * ret, const gfc_array_char * array,
ssize_t shift, int which, index_type size)
@@ -96,56 +54,18 @@ cshift0 (gfc_array_char * ret, const gfc_array_char * array,
index_type dim;
index_type len;
index_type n;
- int whichloop;
+ index_type arraysize;
+
+ index_type type_size;
if (which < 1 || which > GFC_DESCRIPTOR_RANK (array))
runtime_error ("Argument 'DIM' is out of range in call to 'CSHIFT'");
- which = which - 1;
- sstride[0] = 0;
- rstride[0] = 0;
-
- extent[0] = 1;
- count[0] = 0;
- n = 0;
-
- /* The values assigned here must match the cases in the inner loop. */
- whichloop = 0;
- switch (GFC_DESCRIPTOR_TYPE (array))
- {
- case GFC_DTYPE_LOGICAL:
- case GFC_DTYPE_INTEGER:
- case GFC_DTYPE_REAL:
- if (size == sizeof (int))
- whichloop = 1;
- else if (size == sizeof (long))
- whichloop = 2;
- else if (size == sizeof (double))
- whichloop = 3;
- else if (size == sizeof (long double))
- whichloop = 4;
- break;
-
- case GFC_DTYPE_COMPLEX:
- if (size == sizeof (_Complex float))
- whichloop = 5;
- else if (size == sizeof (_Complex double))
- whichloop = 6;
- break;
-
- default:
- break;
- }
-
- /* Initialized for avoiding compiler warnings. */
- roffset = size;
- soffset = size;
- len = 0;
+ arraysize = size0 ((array_t *) array);
if (ret->data == NULL)
{
int i;
- index_type arraysize = size0 ((array_t *)array);
ret->offset = 0;
ret->dtype = array->dtype;
@@ -169,6 +89,195 @@ cshift0 (gfc_array_char * ret, const gfc_array_char * array,
return;
}
}
+
+ if (arraysize == 0)
+ return;
+ type_size = GFC_DTYPE_TYPE_SIZE (array);
+
+ switch(type_size)
+ {
+ case GFC_DTYPE_LOGICAL_1:
+ case GFC_DTYPE_INTEGER_1:
+ case GFC_DTYPE_DERIVED_1:
+ cshift0_i1 ((gfc_array_i1 *)ret, (gfc_array_i1 *) array, shift, which);
+ return;
+
+ case GFC_DTYPE_LOGICAL_2:
+ case GFC_DTYPE_INTEGER_2:
+ cshift0_i2 ((gfc_array_i2 *)ret, (gfc_array_i2 *) array, shift, which);
+ return;
+
+ case GFC_DTYPE_LOGICAL_4:
+ case GFC_DTYPE_INTEGER_4:
+ cshift0_i4 ((gfc_array_i4 *)ret, (gfc_array_i4 *) array, shift, which);
+ return;
+
+ case GFC_DTYPE_LOGICAL_8:
+ case GFC_DTYPE_INTEGER_8:
+ cshift0_i8 ((gfc_array_i8 *)ret, (gfc_array_i8 *) array, shift, which);
+ return;
+
+#ifdef HAVE_GFC_INTEGER_16
+ case GFC_DTYPE_LOGICAL_16:
+ case GFC_DTYPE_INTEGER_16:
+ cshift0_i16 ((gfc_array_i16 *)ret, (gfc_array_i16 *) array, shift,
+ which);
+ return;
+#endif
+
+ case GFC_DTYPE_REAL_4:
+ cshift0_r4 ((gfc_array_r4 *)ret, (gfc_array_r4 *) array, shift, which);
+ return;
+
+ case GFC_DTYPE_REAL_8:
+ cshift0_r8 ((gfc_array_r8 *)ret, (gfc_array_r8 *) array, shift, which);
+ return;
+
+#ifdef HAVE_GFC_REAL_10
+ case GFC_DTYPE_REAL_10:
+ cshift0_r10 ((gfc_array_r10 *)ret, (gfc_array_r10 *) array, shift,
+ which);
+ return;
+#endif
+
+#ifdef HAVE_GFC_REAL_16
+ case GFC_DTYPE_REAL_16:
+ cshift0_r16 ((gfc_array_r16 *)ret, (gfc_array_r16 *) array, shift,
+ which);
+ return;
+#endif
+
+ case GFC_DTYPE_COMPLEX_4:
+ cshift0_c4 ((gfc_array_c4 *)ret, (gfc_array_c4 *) array, shift, which);
+ return;
+
+ case GFC_DTYPE_COMPLEX_8:
+ cshift0_c8 ((gfc_array_c8 *)ret, (gfc_array_c8 *) array, shift, which);
+ return;
+
+#ifdef HAVE_GFC_COMPLEX_10
+ case GFC_DTYPE_COMPLEX_10:
+ cshift0_c10 ((gfc_array_c10 *)ret, (gfc_array_c10 *) array, shift,
+ which);
+ return;
+#endif
+
+#ifdef HAVE_GFC_COMPLEX_16
+ case GFC_DTYPE_COMPLEX_16:
+ cshift0_c16 ((gfc_array_c16 *)ret, (gfc_array_c16 *) array, shift,
+ which);
+ return;
+#endif
+
+ default:
+ break;
+ }
+
+ switch (size)
+ {
+ /* Let's check the actual alignment of the data pointers. If they
+ are suitably aligned, we can safely call the unpack functions. */
+
+ case sizeof (GFC_INTEGER_1):
+ cshift0_i1 ((gfc_array_i1 *) ret, (gfc_array_i1 *) array, shift,
+ which);
+ break;
+
+ case sizeof (GFC_INTEGER_2):
+ if (GFC_UNALIGNED_2(ret->data) || GFC_UNALIGNED_2(array->data))
+ break;
+ else
+ {
+ cshift0_i2 ((gfc_array_i2 *) ret, (gfc_array_i2 *) array, shift,
+ which);
+ return;
+ }
+
+ case sizeof (GFC_INTEGER_4):
+ if (GFC_UNALIGNED_4(ret->data) || GFC_UNALIGNED_4(array->data))
+ break;
+ else
+ {
+ cshift0_i4 ((gfc_array_i4 *)ret, (gfc_array_i4 *) array, shift,
+ which);
+ return;
+ }
+
+ case sizeof (GFC_INTEGER_8):
+ if (GFC_UNALIGNED_8(ret->data) || GFC_UNALIGNED_8(array->data))
+ {
+ /* Let's try to use the complex routines. First, a sanity
+ check that the sizes match; this should be optimized to
+ a no-op. */
+ if (sizeof(GFC_INTEGER_8) != sizeof(GFC_COMPLEX_4))
+ break;
+
+ if (GFC_UNALIGNED_C4(ret->data) || GFC_UNALIGNED_C4(array->data))
+ break;
+
+ cshift0_c4 ((gfc_array_c4 *) ret, (gfc_array_c4 *) array, shift,
+ which);
+ return;
+ }
+ else
+ {
+ cshift0_i8 ((gfc_array_i8 *)ret, (gfc_array_i8 *) array, shift,
+ which);
+ return;
+ }
+
+#ifdef HAVE_GFC_INTEGER_16
+ case sizeof (GFC_INTEGER_16):
+ if (GFC_UNALIGNED_16(ret->data) || GFC_UNALIGNED_16(array->data))
+ {
+ /* Let's try to use the complex routines. First, a sanity
+ check that the sizes match; this should be optimized to
+ a no-op. */
+ if (sizeof(GFC_INTEGER_16) != sizeof(GFC_COMPLEX_8))
+ break;
+
+ if (GFC_UNALIGNED_C8(ret->data) || GFC_UNALIGNED_C8(array->data))
+ break;
+
+ cshift0_c8 ((gfc_array_c8 *) ret, (gfc_array_c8 *) array, shift,
+ which);
+ return;
+ }
+ else
+ {
+ cshift0_i16 ((gfc_array_i16 *) ret, (gfc_array_i16 *) array,
+ shift, which);
+ return;
+ }
+#else
+ case sizeof (GFC_COMPLEX_8):
+
+ if (GFC_UNALIGNED_C8(ret->data) || GFC_UNALIGNED_C8(array->data))
+ break;
+ else
+ {
+ cshift0_c8 ((gfc_array_c8 *) ret, (gfc_array_c8 *) array, shift,
+ which);
+ return;
+ }
+#endif
+
+ default:
+ break;
+ }
+
+
+ which = which - 1;
+ sstride[0] = 0;
+ rstride[0] = 0;
+
+ extent[0] = 1;
+ count[0] = 0;
+ n = 0;
+ /* Initialized for avoiding compiler warnings. */
+ roffset = size;
+ soffset = size;
+ len = 0;
for (dim = 0; dim < GFC_DESCRIPTOR_RANK (array); dim++)
{
@@ -222,56 +331,21 @@ cshift0 (gfc_array_char * ret, const gfc_array_char * array,
else
{
/* Otherwise, we'll have to perform the copy one element at
- a time. We can speed this up a tad for common cases of
- fundamental types. */
- switch (whichloop)
+ a time. */
+ char *dest = rptr;
+ const char *src = &sptr[shift * soffset];
+
+ for (n = 0; n < len - shift; n++)
+ {
+ memcpy (dest, src, size);
+ dest += roffset;
+ src += soffset;
+ }
+ for (src = sptr, n = 0; n < shift; n++)
{
- case 0:
- {
- char *dest = rptr;
- const char *src = &sptr[shift * soffset];
-
- for (n = 0; n < len - shift; n++)
- {
- memcpy (dest, src, size);
- dest += roffset;
- src += soffset;
- }
- for (src = sptr, n = 0; n < shift; n++)
- {
- memcpy (dest, src, size);
- dest += roffset;
- src += soffset;
- }
- }
- break;
-
- case 1:
- copy_loop_int (rptr, sptr, roffset, soffset, len, shift);
- break;
-
- case 2:
- copy_loop_long (rptr, sptr, roffset, soffset, len, shift);
- break;
-
- case 3:
- copy_loop_double (rptr, sptr, roffset, soffset, len, shift);
- break;
-
- case 4:
- copy_loop_ldouble (rptr, sptr, roffset, soffset, len, shift);
- break;
-
- case 5:
- copy_loop_cfloat (rptr, sptr, roffset, soffset, len, shift);
- break;
-
- case 6:
- copy_loop_cdouble (rptr, sptr, roffset, soffset, len, shift);
- break;
-
- default:
- abort ();
+ memcpy (dest, src, size);
+ dest += roffset;
+ src += soffset;
}
}
diff --git a/libgfortran/intrinsics/eoshift0.c b/libgfortran/intrinsics/eoshift0.c
index ac7a0ba85b6..fd216b1084b 100644
--- a/libgfortran/intrinsics/eoshift0.c
+++ b/libgfortran/intrinsics/eoshift0.c
@@ -84,6 +84,11 @@ eoshift0 (gfc_array_char * ret, const gfc_array_char * array,
ret->dim[i].stride = (ret->dim[i-1].ubound + 1) * ret->dim[i-1].stride;
}
}
+ else
+ {
+ if (size0 ((array_t *) ret) == 0)
+ return;
+ }
which = which - 1;
diff --git a/libgfortran/intrinsics/eoshift2.c b/libgfortran/intrinsics/eoshift2.c
index 239d9714a99..aa66a8dfe00 100644
--- a/libgfortran/intrinsics/eoshift2.c
+++ b/libgfortran/intrinsics/eoshift2.c
@@ -63,6 +63,7 @@ eoshift2 (gfc_array_char *ret, const gfc_array_char *array,
index_type dim;
index_type len;
index_type n;
+ index_type arraysize;
/* The compiler cannot figure out that these are set, initialize
them to avoid warnings. */
@@ -70,11 +71,13 @@ eoshift2 (gfc_array_char *ret, const gfc_array_char *array,
soffset = 0;
roffset = 0;
+ arraysize = size0 ((array_t *) array);
+
if (ret->data == NULL)
{
int i;
- ret->data = internal_malloc_size (size * size0 ((array_t *)array));
+ ret->data = internal_malloc_size (size * arraysize);
ret->offset = 0;
ret->dtype = array->dtype;
for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
@@ -88,6 +91,14 @@ eoshift2 (gfc_array_char *ret, const gfc_array_char *array,
ret->dim[i].stride = (ret->dim[i-1].ubound + 1) * ret->dim[i-1].stride;
}
}
+ else
+ {
+ if (size0 ((array_t *) ret) == 0)
+ return;
+ }
+
+ if (arraysize == 0 && filler == NULL)
+ return;
which = which - 1;
diff --git a/libgfortran/io/file_pos.c b/libgfortran/io/file_pos.c
index f4864884f33..89c67365429 100644
--- a/libgfortran/io/file_pos.c
+++ b/libgfortran/io/file_pos.c
@@ -39,7 +39,7 @@ Boston, MA 02110-1301, USA. */
record, and we have to sift backwards to find the newline before
that or the start of the file, whichever comes first. */
-static const unsigned int READ_CHUNK = 4096;
+static const int READ_CHUNK = 4096;
static void
formatted_backspace (st_parameter_filepos *fpp, gfc_unit *u)
diff --git a/libgfortran/io/format.c b/libgfortran/io/format.c
index cf299c161a4..02ce2913bd2 100644
--- a/libgfortran/io/format.c
+++ b/libgfortran/io/format.c
@@ -50,6 +50,7 @@ typedef struct format_data
{
char *format_string, *string;
const char *error;
+ char error_element;
format_token saved_token;
int value, format_string_len, reversion_ok;
fnode *avail;
@@ -67,7 +68,7 @@ static const fnode colon_node = { FMT_COLON, 0, NULL, NULL, {{ 0, 0, 0 }}, 0,
static const char posint_required[] = "Positive width required in format",
period_required[] = "Period required in format",
nonneg_required[] = "Nonnegative width required in format",
- unexpected_element[] = "Unexpected element in format",
+ unexpected_element[] = "Unexpected element '%c' in format\n",
unexpected_end[] = "Unexpected end of format string",
bad_string[] = "Unterminated character constant in format",
bad_hollerith[] = "Hollerith constant extends past the end of the format",
@@ -89,7 +90,7 @@ next_char (format_data *fmt, int literal)
return -1;
fmt->format_string_len--;
- c = toupper (*fmt->format_string++);
+ fmt->error_element = c = toupper (*fmt->format_string++);
}
while ((c == ' ' || c == '\t') && !literal);
@@ -948,7 +949,10 @@ format_error (st_parameter_dt *dtp, const fnode *f, const char *message)
if (f != NULL)
fmt->format_string = f->source;
- sprintf (buffer, "%s\n", message);
+ if (message == unexpected_element)
+ sprintf (buffer, message, fmt->error_element);
+ else
+ sprintf (buffer, "%s\n", message);
j = fmt->format_string - dtp->format;
diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c
index ba8de9750e1..34e2ac0698a 100644
--- a/libgfortran/io/list_read.c
+++ b/libgfortran/io/list_read.c
@@ -2791,7 +2791,7 @@ get_name:
if (nl->type == GFC_DTYPE_DERIVED)
nml_touch_nodes (nl);
- if (component_flag)
+ if (component_flag && nl->var_rank > 0)
nl = first_nl;
/* Make sure no extraneous qualifiers are there. */
diff --git a/libgfortran/io/write_float.def b/libgfortran/io/write_float.def
index 090bd712eb4..ed4c45f6277 100644
--- a/libgfortran/io/write_float.def
+++ b/libgfortran/io/write_float.def
@@ -99,32 +99,13 @@ output_float (st_parameter_dt *dtp, const fnode *f, char *buffer, size_t size,
if (d < 0)
internal_error (&dtp->common, "Unspecified precision");
- /* Use sprintf to print the number in the format +D.DDDDe+ddd
- For an N digit exponent, this gives us (MIN_FIELD_WIDTH-5)-N digits
- after the decimal point, plus another one before the decimal point. */
-
sign = calculate_sign (dtp, sign_bit);
-
- /* # The result will always contain a decimal point, even if no
- * digits follow it
- *
- * - The converted value is to be left adjusted on the field boundary
- *
- * + A sign (+ or -) always be placed before a number
- *
- * MIN_FIELD_WIDTH minimum field width
- *
- * * (ndigits-1) is used as the precision
- *
- * e format: [-]d.ddde±dd where there is one digit before the
- * decimal-point character and the number of digits after it is
- * equal to the precision. The exponent always contains at least two
- * digits; if the value is zero, the exponent is 00.
- */
-
- /* Check the given string has punctuation in the correct places. */
- if (d != 0 && (buffer[2] != '.' || buffer[ndigits + 2] != 'e'))
- internal_error (&dtp->common, "printf is broken");
+
+ /* The following code checks the given string has punctuation in the correct
+ places. Uncomment if needed for debugging.
+ if (d != 0 && ((buffer[2] != '.' && buffer[2] != ',')
+ || buffer[ndigits + 2] != 'e'))
+ internal_error (&dtp->common, "printf is broken"); */
/* Read the exponent back in. */
e = atoi (&buffer[ndigits + 3]) + 1;
@@ -702,8 +683,30 @@ OUTPUT_FLOAT_FMT_G(16)
#undef OUTPUT_FLOAT_FMT_G
+
/* Define a macro to build code for write_float. */
+ /* Note: Before output_float is called, sprintf is used to print to buffer the
+ number in the format +D.DDDDe+ddd. For an N digit exponent, this gives us
+ (MIN_FIELD_WIDTH-5)-N digits after the decimal point, plus another one
+ before the decimal point.
+
+ # The result will always contain a decimal point, even if no
+ digits follow it
+
+ - The converted value is to be left adjusted on the field boundary
+
+ + A sign (+ or -) always be placed before a number
+
+ MIN_FIELD_WIDTH minimum field width
+
+ * (ndigits-1) is used as the precision
+
+ e format: [-]d.ddde±dd where there is one digit before the
+ decimal-point character and the number of digits after it is
+ equal to the precision. The exponent always contains at least two
+ digits; if the value is zero, the exponent is 00. */
+
#ifdef HAVE_SNPRINTF
#define DTOA \
diff --git a/libgfortran/libgfortran.h b/libgfortran/libgfortran.h
index 10439bd3e5a..a055483e4ce 100644
--- a/libgfortran/libgfortran.h
+++ b/libgfortran/libgfortran.h
@@ -437,6 +437,12 @@ typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_LOGICAL_16) gfc_array_l16;
(__alignof__(GFC_INTEGER_16) - 1))
#endif
+#define GFC_UNALIGNED_C4(x) (((uintptr_t)(x)) & \
+ (__alignof__(GFC_COMPLEX_4) - 1))
+
+#define GFC_UNALIGNED_C8(x) (((uintptr_t)(x)) & \
+ (__alignof__(GFC_COMPLEX_8) - 1))
+
/* Runtime library include. */
#define stringize(x) expand_macro(x)
#define expand_macro(x) # x
@@ -643,6 +649,9 @@ extern void runtime_error_at (const char *, const char *, ...)
__attribute__ ((noreturn, format (printf, 2, 3)));
iexport_proto(runtime_error_at);
+extern void runtime_warning_at (const char *, const char *, ...);
+iexport_proto(runtime_warning_at);
+
extern void internal_error (st_parameter_common *, const char *)
__attribute__ ((noreturn));
internal_proto(internal_error);
@@ -1207,4 +1216,55 @@ typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, void) array_t;
extern index_type size0 (const array_t * array);
iexport_proto(size0);
+/* Internal auxiliary functions for cshift */
+
+void cshift0_i1 (gfc_array_i1 *, const gfc_array_i1 *, ssize_t, int);
+internal_proto(cshift0_i1);
+
+void cshift0_i2 (gfc_array_i2 *, const gfc_array_i2 *, ssize_t, int);
+internal_proto(cshift0_i2);
+
+void cshift0_i4 (gfc_array_i4 *, const gfc_array_i4 *, ssize_t, int);
+internal_proto(cshift0_i4);
+
+void cshift0_i8 (gfc_array_i8 *, const gfc_array_i8 *, ssize_t, int);
+internal_proto(cshift0_i8);
+
+#ifdef HAVE_GFC_INTEGER_16
+void cshift0_i16 (gfc_array_i16 *, const gfc_array_i16 *, ssize_t, int);
+internal_proto(cshift0_i16);
+#endif
+
+void cshift0_r4 (gfc_array_r4 *, const gfc_array_r4 *, ssize_t, int);
+internal_proto(cshift0_r4);
+
+void cshift0_r8 (gfc_array_r8 *, const gfc_array_r8 *, ssize_t, int);
+internal_proto(cshift0_r8);
+
+#ifdef HAVE_GFC_REAL_10
+void cshift0_r10 (gfc_array_r10 *, const gfc_array_r10 *, ssize_t, int);
+internal_proto(cshift0_r10);
+#endif
+
+#ifdef HAVE_GFC_REAL_16
+void cshift0_r16 (gfc_array_r16 *, const gfc_array_r16 *, ssize_t, int);
+internal_proto(cshift0_r16);
+#endif
+
+void cshift0_c4 (gfc_array_c4 *, const gfc_array_c4 *, ssize_t, int);
+internal_proto(cshift0_c4);
+
+void cshift0_c8 (gfc_array_c8 *, const gfc_array_c8 *, ssize_t, int);
+internal_proto(cshift0_c8);
+
+#ifdef HAVE_GFC_COMPLEX_10
+void cshift0_c10 (gfc_array_c10 *, const gfc_array_c10 *, ssize_t, int);
+internal_proto(cshift0_c10);
+#endif
+
+#ifdef HAVE_GFC_COMPLEX_16
+void cshift0_c16 (gfc_array_c16 *, const gfc_array_c16 *, ssize_t, int);
+internal_proto(cshift0_c16);
+#endif
+
#endif /* LIBGFOR_H */
diff --git a/libgfortran/m4/cshift0.m4 b/libgfortran/m4/cshift0.m4
new file mode 100644
index 00000000000..b633169ae51
--- /dev/null
+++ b/libgfortran/m4/cshift0.m4
@@ -0,0 +1,177 @@
+`/* Helper function for cshift functions.
+ Copyright 2008 Free Software Foundation, Inc.
+ Contributed by Thomas Koenig <tkoenig@gcc.gnu.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file. (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING. If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA. */
+
+#include "libgfortran.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>'
+
+include(iparm.m4)dnl
+
+`#if defined (HAVE_'rtype_name`)
+
+void
+cshift0_'rtype_code` ('rtype` *ret, const 'rtype` *array, ssize_t shift,
+ int which)
+{
+ /* r.* indicates the return array. */
+ index_type rstride[GFC_MAX_DIMENSIONS];
+ index_type rstride0;
+ index_type roffset;
+ 'rtype_name` *rptr;
+
+ /* s.* indicates the source array. */
+ index_type sstride[GFC_MAX_DIMENSIONS];
+ index_type sstride0;
+ index_type soffset;
+ const 'rtype_name` *sptr;
+
+ index_type count[GFC_MAX_DIMENSIONS];
+ index_type extent[GFC_MAX_DIMENSIONS];
+ index_type dim;
+ index_type len;
+ index_type n;
+
+ which = which - 1;
+ sstride[0] = 0;
+ rstride[0] = 0;
+
+ extent[0] = 1;
+ count[0] = 0;
+ n = 0;
+ /* Initialized for avoiding compiler warnings. */
+ roffset = 1;
+ soffset = 1;
+ len = 0;
+
+ for (dim = 0; dim < GFC_DESCRIPTOR_RANK (array); dim++)
+ {
+ if (dim == which)
+ {
+ roffset = ret->dim[dim].stride;
+ if (roffset == 0)
+ roffset = 1;
+ soffset = array->dim[dim].stride;
+ if (soffset == 0)
+ soffset = 1;
+ len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+ }
+ else
+ {
+ count[n] = 0;
+ extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+ rstride[n] = ret->dim[dim].stride;
+ sstride[n] = array->dim[dim].stride;
+ n++;
+ }
+ }
+ if (sstride[0] == 0)
+ sstride[0] = 1;
+ if (rstride[0] == 0)
+ rstride[0] = 1;
+
+ dim = GFC_DESCRIPTOR_RANK (array);
+ rstride0 = rstride[0];
+ sstride0 = sstride[0];
+ rptr = ret->data;
+ sptr = array->data;
+
+ shift = len == 0 ? 0 : shift % (ssize_t)len;
+ if (shift < 0)
+ shift += len;
+
+ while (rptr)
+ {
+ /* Do the shift for this dimension. */
+
+ /* If elements are contiguous, perform the operation
+ in two block moves. */
+ if (soffset == 1 && roffset == 1)
+ {
+ size_t len1 = shift * sizeof ('rtype_name`);
+ size_t len2 = (len - shift) * sizeof ('rtype_name`);
+ memcpy (rptr, sptr + shift, len2);
+ memcpy (rptr + (len - shift), sptr, len1);
+ }
+ else
+ {
+ /* Otherwise, we will have to perform the copy one element at
+ a time. */
+ 'rtype_name` *dest = rptr;
+ const 'rtype_name` *src = &sptr[shift * soffset];
+
+ for (n = 0; n < len - shift; n++)
+ {
+ *dest = *src;
+ dest += roffset;
+ src += soffset;
+ }
+ for (src = sptr, n = 0; n < shift; n++)
+ {
+ *dest = *src;
+ dest += roffset;
+ src += soffset;
+ }
+ }
+
+ /* Advance to the next section. */
+ rptr += rstride0;
+ sptr += sstride0;
+ count[0]++;
+ n = 0;
+ while (count[n] == extent[n])
+ {
+ /* When we get to the end of a dimension, reset it and increment
+ the next dimension. */
+ count[n] = 0;
+ /* We could precalculate these products, but this is a less
+ frequently used path so probably not worth it. */
+ rptr -= rstride[n] * extent[n];
+ sptr -= sstride[n] * extent[n];
+ n++;
+ if (n >= dim - 1)
+ {
+ /* Break out of the loop. */
+ rptr = NULL;
+ break;
+ }
+ else
+ {
+ count[n]++;
+ rptr += rstride[n];
+ sptr += sstride[n];
+ }
+ }
+ }
+
+ return;
+}
+
+#endif'
diff --git a/libgfortran/m4/cshift1.m4 b/libgfortran/m4/cshift1.m4
index 28fae596bd4..861debeed2c 100644
--- a/libgfortran/m4/cshift1.m4
+++ b/libgfortran/m4/cshift1.m4
@@ -68,6 +68,7 @@ cshift1 (gfc_array_char * const restrict ret,
index_type n;
int which;
'atype_name` sh;
+ index_type arraysize;
if (pwhich)
which = *pwhich - 1;
@@ -77,11 +78,13 @@ cshift1 (gfc_array_char * const restrict ret,
if (which < 0 || (which + 1) > GFC_DESCRIPTOR_RANK (array))
runtime_error ("Argument ''`DIM''` is out of range in call to ''`CSHIFT''`");
+ arraysize = size0 ((array_t *)array);
+
if (ret->data == NULL)
{
int i;
- ret->data = internal_malloc_size (size * size0 ((array_t *)array));
+ ret->data = internal_malloc_size (size * arraysize);
ret->offset = 0;
ret->dtype = array->dtype;
for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
@@ -96,6 +99,9 @@ cshift1 (gfc_array_char * const restrict ret,
}
}
+ if (arraysize == 0)
+ return;
+
extent[0] = 1;
count[0] = 0;
n = 0;
diff --git a/libgfortran/m4/eoshift1.m4 b/libgfortran/m4/eoshift1.m4
index 8ce24eff0f5..01ca57ec68d 100644
--- a/libgfortran/m4/eoshift1.m4
+++ b/libgfortran/m4/eoshift1.m4
@@ -103,6 +103,11 @@ eoshift1 (gfc_array_char * const restrict ret,
ret->dim[i].stride = (ret->dim[i-1].ubound + 1) * ret->dim[i-1].stride;
}
}
+ else
+ {
+ if (size0 ((array_t *) ret) == 0)
+ return;
+ }
n = 0;
for (dim = 0; dim < GFC_DESCRIPTOR_RANK (array); dim++)
diff --git a/libgfortran/m4/eoshift3.m4 b/libgfortran/m4/eoshift3.m4
index 081ff927277..6a6929ca0c7 100644
--- a/libgfortran/m4/eoshift3.m4
+++ b/libgfortran/m4/eoshift3.m4
@@ -104,6 +104,11 @@ eoshift3 (gfc_array_char * const restrict ret,
ret->dim[i].stride = (ret->dim[i-1].ubound + 1) * ret->dim[i-1].stride;
}
}
+ else
+ {
+ if (size0 ((array_t *) ret) == 0)
+ return;
+ }
extent[0] = 1;
diff --git a/libgfortran/runtime/error.c b/libgfortran/runtime/error.c
index 8cd966fa23f..0b9c16705eb 100644
--- a/libgfortran/runtime/error.c
+++ b/libgfortran/runtime/error.c
@@ -285,6 +285,21 @@ runtime_error_at (const char *where, const char *message, ...)
iexport(runtime_error_at);
+void
+runtime_warning_at (const char *where, const char *message, ...)
+{
+ va_list ap;
+
+ st_printf ("%s\n", where);
+ st_printf ("Fortran runtime warning: ");
+ va_start (ap, message);
+ st_vprintf (message, ap);
+ va_end (ap);
+ st_printf ("\n");
+}
+iexport(runtime_warning_at);
+
+
/* void internal_error()-- These are this-can't-happen errors
* that indicate something deeply wrong. */
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index 671b48bde76..efa3639920d 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,19 @@
+2008-07-30 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * libgomp.texi: Update to GFDL 1.2. Update copyright years.
+ Do not list GPL as Invariant Section.
+
+2008-07-28 Ilie Garbacea <ilie@mips.com>
+ Chao-ying Fu <fu@mips.com>
+
+ * configure.tgt: Enable futex for MIPS.
+ * config/linux/mips/futex.h: New file.
+
+2008-07-16 Jakub Jelinek <jakub@redhat.com>
+
+ * team.c (gomp_team_end): Free team immediately if it has
+ just one thread.
+
2008-07-08 David Edelsohn <edelsohn@gnu.org>
* testsuite/libgomp.c++/c++.exp: Append multilib library path.
diff --git a/libgomp/config/linux/mips/futex.h b/libgomp/config/linux/mips/futex.h
new file mode 100644
index 00000000000..9327cc84a49
--- /dev/null
+++ b/libgomp/config/linux/mips/futex.h
@@ -0,0 +1,75 @@
+/* Copyright (C) 2005, 2008 Free Software Foundation, Inc.
+ Contributed by Ilie Garbacea <ilie@mips.com>, Chao-ying Fu <fu@mips.com>.
+
+ This file is part of the GNU OpenMP Library (libgomp).
+
+ Libgomp is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
+ more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with libgomp; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+/* As a special exception, if you link this library with other files, some
+ of which are compiled with GCC, to produce an executable, this library
+ does not by itself cause the resulting executable to be covered by the
+ GNU General Public License. This exception does not however invalidate
+ any other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+/* Provide target-specific access to the futex system call. */
+
+#include <sys/syscall.h>
+#define FUTEX_WAIT 0
+#define FUTEX_WAKE 1
+
+static inline void
+sys_futex0 (int *addr, int op, int val)
+{
+ register unsigned long __v0 asm("$2") = (unsigned long) SYS_futex;
+ register unsigned long __a0 asm("$4") = (unsigned long) addr;
+ register unsigned long __a1 asm("$5") = (unsigned long) op;
+ register unsigned long __a2 asm("$6") = (unsigned long) val;
+ register unsigned long __a3 asm("$7") = 0;
+
+ __asm volatile ("syscall"
+ /* returns $a3 (errno), $v0 (return value) */
+ : "=r" (__v0), "=r" (__a3)
+ /* arguments in v0 (syscall) a0-a3 */
+ : "r" (__v0), "r" (__a0), "r" (__a1), "r" (__a2), "r" (__a3)
+ /* clobbers at, v1, t0-t9, memory */
+ : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", "$14",
+ "$15", "$24", "$25", "memory");
+}
+
+static inline void
+futex_wait (int *addr, int val)
+{
+ sys_futex0 (addr, FUTEX_WAIT, val);
+}
+
+static inline void
+futex_wake (int *addr, int count)
+{
+ sys_futex0 (addr, FUTEX_WAKE, count);
+}
+
+static inline void
+cpu_relax (void)
+{
+ __asm volatile ("" : : : "memory");
+}
+
+static inline void
+atomic_write_barrier (void)
+{
+ __sync_synchronize ();
+}
diff --git a/libgomp/configure.tgt b/libgomp/configure.tgt
index 68115abf71d..ef44a12a4bd 100644
--- a/libgomp/configure.tgt
+++ b/libgomp/configure.tgt
@@ -35,6 +35,10 @@ if test $enable_linux_futex = yes; then
config_path="linux/ia64 linux posix"
;;
+ mips*-*-linux*)
+ config_path="linux/mips linux posix"
+ ;;
+
powerpc*-*-linux*)
config_path="linux/powerpc linux posix"
;;
diff --git a/libgomp/libgomp.texi b/libgomp/libgomp.texi
index 6794ebe9335..edc37904b71 100644
--- a/libgomp/libgomp.texi
+++ b/libgomp/libgomp.texi
@@ -7,13 +7,12 @@
@copying
-Copyright @copyright{} 2006 Free Software Foundation, Inc.
+Copyright @copyright{} 2006, 2007, 2008 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
-under the terms of the GNU Free Documentation License, Version 1.1 or
+under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with the
-Invariant Sections being ``GNU General Public License'' and ``Funding
-Free Software'', the Front-Cover
+Invariant Sections being ``Funding Free Software'', the Front-Cover
texts being (a) (see below), and with the Back-Cover Texts being (b)
(see below). A copy of the license is included in the section entitled
``GNU Free Documentation License''.
diff --git a/libgomp/team.c b/libgomp/team.c
index 18b02e72f90..224236c6604 100644
--- a/libgomp/team.c
+++ b/libgomp/team.c
@@ -498,7 +498,8 @@ gomp_team_end (void)
gomp_mutex_destroy (&team->work_share_list_free_lock);
#endif
- if (__builtin_expect (thr->ts.team != NULL, 0))
+ if (__builtin_expect (thr->ts.team != NULL, 0)
+ || __builtin_expect (team->nthreads == 1, 0))
free_team (team);
else
{
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index b77e66df94c..837035c05f1 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,27 @@
+2008-08-07 Aaron W. LaFramboise <aaronavay62@aaronwl.com>
+
+ * pex-win32.c (argv_to_argc): New function.
+ (spawn_script): Duplicate argv before calling win32_spawn.
+
+2008-07-31 Jakub Jelinek <jakub@redhat.com>
+
+ * mkstemps.c (mkstemps): Keep looping even for EISDIR.
+
+2008-07-31 Denys Vlasenko <dvlasenk@redhat.com>
+
+ * mkstemps.c (mkstemps): If open failed with errno other than
+ EEXIST, return immediately.
+ * make-temp-file.c: Include errno.h.
+ (make_temp_file): If mkstemps failed, print an error message
+ before aborting.
+
+2008-07-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * maint-tool (deps): Output config.h instead of stamp-h.
+ * Makefile.in: Rebuild deps.
+ (maintainer-clean-subdir): Depend on stamp-h rather than config.h.
+ Reverts 2007-07-11 change.
+
2008-06-19 Eric Blake <ebb9@byu.net>
Adjust strsignal to POSIX 200x prototype.
diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in
index 40a1d47718b..e18aff75363 100644
--- a/libiberty/Makefile.in
+++ b/libiberty/Makefile.in
@@ -475,13 +475,13 @@ stamp-h: $(srcdir)/config.in config.status Makefile
config.status: $(srcdir)/configure
$(SHELL) ./config.status --recheck
-# Depending on stamp-h makes sure that config.status has been re-run
+# Depending on config.h makes sure that config.status has been re-run
# if needed. This prevents problems with parallel builds, in case
# subdirectories need to run config.status also.
all-subdir check-subdir installcheck-subdir info-subdir \
install-info-subdir clean-info-subdir dvi-subdir pdf-subdir install-subdir \
etags-subdir mostlyclean-subdir clean-subdir distclean-subdir \
-maintainer-clean-subdir: stamp-h
+maintainer-clean-subdir: config.h
@subdirs='$(SUBDIRS)'; \
target=`echo $@ | sed -e 's/-subdir//'`; \
for dir in $$subdirs ; do \
@@ -498,40 +498,41 @@ $(CONFIGURED_OFILES): stamp-picdir
# The dependencies in the remainder of this file are automatically
# generated by "make maint-deps". Manual edits will be lost.
-./_doprnt.o: $(srcdir)/_doprnt.c stamp-h $(INCDIR)/ansidecl.h \
+./_doprnt.o: $(srcdir)/_doprnt.c config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/safe-ctype.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/_doprnt.c -o pic/$@; \
else true; fi
$(COMPILE.c) $(srcdir)/_doprnt.c $(OUTPUT_OPTION)
-./alloca.o: $(srcdir)/alloca.c stamp-h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
+./alloca.o: $(srcdir)/alloca.c config.h $(INCDIR)/ansidecl.h \
+ $(INCDIR)/libiberty.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/alloca.c -o pic/$@; \
else true; fi
$(COMPILE.c) $(srcdir)/alloca.c $(OUTPUT_OPTION)
-./argv.o: $(srcdir)/argv.c stamp-h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
+./argv.o: $(srcdir)/argv.c config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
$(INCDIR)/safe-ctype.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/argv.c -o pic/$@; \
else true; fi
$(COMPILE.c) $(srcdir)/argv.c $(OUTPUT_OPTION)
-./asprintf.o: $(srcdir)/asprintf.c stamp-h $(INCDIR)/ansidecl.h \
+./asprintf.o: $(srcdir)/asprintf.c config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/libiberty.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/asprintf.c -o pic/$@; \
else true; fi
$(COMPILE.c) $(srcdir)/asprintf.c $(OUTPUT_OPTION)
-./atexit.o: $(srcdir)/atexit.c stamp-h
+./atexit.o: $(srcdir)/atexit.c config.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/atexit.c -o pic/$@; \
else true; fi
$(COMPILE.c) $(srcdir)/atexit.c $(OUTPUT_OPTION)
-./basename.o: $(srcdir)/basename.c stamp-h $(INCDIR)/ansidecl.h \
+./basename.o: $(srcdir)/basename.c config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/basename.c -o pic/$@; \
@@ -550,7 +551,7 @@ $(CONFIGURED_OFILES): stamp-picdir
else true; fi
$(COMPILE.c) $(srcdir)/bcopy.c $(OUTPUT_OPTION)
-./bsearch.o: $(srcdir)/bsearch.c stamp-h $(INCDIR)/ansidecl.h
+./bsearch.o: $(srcdir)/bsearch.c config.h $(INCDIR)/ansidecl.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/bsearch.c -o pic/$@; \
else true; fi
@@ -568,20 +569,21 @@ $(CONFIGURED_OFILES): stamp-picdir
else true; fi
$(COMPILE.c) $(srcdir)/calloc.c $(OUTPUT_OPTION)
-./choose-temp.o: $(srcdir)/choose-temp.c stamp-h $(INCDIR)/ansidecl.h \
+./choose-temp.o: $(srcdir)/choose-temp.c config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/libiberty.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/choose-temp.c -o pic/$@; \
else true; fi
$(COMPILE.c) $(srcdir)/choose-temp.c $(OUTPUT_OPTION)
-./clock.o: $(srcdir)/clock.c stamp-h
+./clock.o: $(srcdir)/clock.c config.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/clock.c -o pic/$@; \
else true; fi
$(COMPILE.c) $(srcdir)/clock.c $(OUTPUT_OPTION)
-./concat.o: $(srcdir)/concat.c stamp-h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
+./concat.o: $(srcdir)/concat.c config.h $(INCDIR)/ansidecl.h \
+ $(INCDIR)/libiberty.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/concat.c -o pic/$@; \
else true; fi
@@ -593,7 +595,7 @@ $(CONFIGURED_OFILES): stamp-picdir
else true; fi
$(COMPILE.c) $(srcdir)/copysign.c $(OUTPUT_OPTION)
-./cp-demangle.o: $(srcdir)/cp-demangle.c stamp-h $(INCDIR)/ansidecl.h \
+./cp-demangle.o: $(srcdir)/cp-demangle.c config.h $(INCDIR)/ansidecl.h \
$(srcdir)/cp-demangle.h $(INCDIR)/demangle.h \
$(INCDIR)/dyn-string.h $(INCDIR)/getopt.h $(INCDIR)/libiberty.h
if [ x"$(PICFLAG)" != x ]; then \
@@ -601,7 +603,7 @@ $(CONFIGURED_OFILES): stamp-picdir
else true; fi
$(COMPILE.c) $(srcdir)/cp-demangle.c $(OUTPUT_OPTION)
-./cp-demint.o: $(srcdir)/cp-demint.c stamp-h $(INCDIR)/ansidecl.h \
+./cp-demint.o: $(srcdir)/cp-demint.c config.h $(INCDIR)/ansidecl.h \
$(srcdir)/cp-demangle.h $(INCDIR)/demangle.h \
$(INCDIR)/libiberty.h
if [ x"$(PICFLAG)" != x ]; then \
@@ -609,7 +611,7 @@ $(CONFIGURED_OFILES): stamp-picdir
else true; fi
$(COMPILE.c) $(srcdir)/cp-demint.c $(OUTPUT_OPTION)
-./cplus-dem.o: $(srcdir)/cplus-dem.c stamp-h $(INCDIR)/ansidecl.h \
+./cplus-dem.o: $(srcdir)/cplus-dem.c config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/demangle.h $(INCDIR)/libiberty.h \
$(INCDIR)/safe-ctype.h
if [ x"$(PICFLAG)" != x ]; then \
@@ -617,14 +619,14 @@ $(CONFIGURED_OFILES): stamp-picdir
else true; fi
$(COMPILE.c) $(srcdir)/cplus-dem.c $(OUTPUT_OPTION)
-./dyn-string.o: $(srcdir)/dyn-string.c stamp-h $(INCDIR)/ansidecl.h \
+./dyn-string.o: $(srcdir)/dyn-string.c config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/dyn-string.h $(INCDIR)/libiberty.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/dyn-string.c -o pic/$@; \
else true; fi
$(COMPILE.c) $(srcdir)/dyn-string.c $(OUTPUT_OPTION)
-./fdmatch.o: $(srcdir)/fdmatch.c stamp-h $(INCDIR)/ansidecl.h \
+./fdmatch.o: $(srcdir)/fdmatch.c config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/libiberty.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/fdmatch.c -o pic/$@; \
@@ -637,93 +639,94 @@ $(CONFIGURED_OFILES): stamp-picdir
else true; fi
$(COMPILE.c) $(srcdir)/ffs.c $(OUTPUT_OPTION)
-./fibheap.o: $(srcdir)/fibheap.c stamp-h $(INCDIR)/ansidecl.h $(INCDIR)/fibheap.h \
- $(INCDIR)/libiberty.h
+./fibheap.o: $(srcdir)/fibheap.c config.h $(INCDIR)/ansidecl.h \
+ $(INCDIR)/fibheap.h $(INCDIR)/libiberty.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/fibheap.c -o pic/$@; \
else true; fi
$(COMPILE.c) $(srcdir)/fibheap.c $(OUTPUT_OPTION)
-./filename_cmp.o: $(srcdir)/filename_cmp.c stamp-h $(INCDIR)/filenames.h \
+./filename_cmp.o: $(srcdir)/filename_cmp.c config.h $(INCDIR)/filenames.h \
$(INCDIR)/safe-ctype.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/filename_cmp.c -o pic/$@; \
else true; fi
$(COMPILE.c) $(srcdir)/filename_cmp.c $(OUTPUT_OPTION)
-./floatformat.o: $(srcdir)/floatformat.c stamp-h $(INCDIR)/ansidecl.h \
+./floatformat.o: $(srcdir)/floatformat.c config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/floatformat.h $(INCDIR)/libiberty.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/floatformat.c -o pic/$@; \
else true; fi
$(COMPILE.c) $(srcdir)/floatformat.c $(OUTPUT_OPTION)
-./fnmatch.o: $(srcdir)/fnmatch.c stamp-h $(INCDIR)/fnmatch.h \
+./fnmatch.o: $(srcdir)/fnmatch.c config.h $(INCDIR)/fnmatch.h \
$(INCDIR)/safe-ctype.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/fnmatch.c -o pic/$@; \
else true; fi
$(COMPILE.c) $(srcdir)/fnmatch.c $(OUTPUT_OPTION)
-./fopen_unlocked.o: $(srcdir)/fopen_unlocked.c stamp-h $(INCDIR)/ansidecl.h \
+./fopen_unlocked.o: $(srcdir)/fopen_unlocked.c config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/libiberty.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/fopen_unlocked.c -o pic/$@; \
else true; fi
$(COMPILE.c) $(srcdir)/fopen_unlocked.c $(OUTPUT_OPTION)
-./getcwd.o: $(srcdir)/getcwd.c stamp-h
+./getcwd.o: $(srcdir)/getcwd.c config.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/getcwd.c -o pic/$@; \
else true; fi
$(COMPILE.c) $(srcdir)/getcwd.c $(OUTPUT_OPTION)
-./getopt.o: $(srcdir)/getopt.c stamp-h $(INCDIR)/ansidecl.h $(INCDIR)/getopt.h
+./getopt.o: $(srcdir)/getopt.c config.h $(INCDIR)/ansidecl.h $(INCDIR)/getopt.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/getopt.c -o pic/$@; \
else true; fi
$(COMPILE.c) $(srcdir)/getopt.c $(OUTPUT_OPTION)
-./getopt1.o: $(srcdir)/getopt1.c stamp-h $(INCDIR)/getopt.h
+./getopt1.o: $(srcdir)/getopt1.c config.h $(INCDIR)/getopt.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/getopt1.c -o pic/$@; \
else true; fi
$(COMPILE.c) $(srcdir)/getopt1.c $(OUTPUT_OPTION)
-./getpagesize.o: $(srcdir)/getpagesize.c stamp-h
+./getpagesize.o: $(srcdir)/getpagesize.c config.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/getpagesize.c -o pic/$@; \
else true; fi
$(COMPILE.c) $(srcdir)/getpagesize.c $(OUTPUT_OPTION)
-./getpwd.o: $(srcdir)/getpwd.c stamp-h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
+./getpwd.o: $(srcdir)/getpwd.c config.h $(INCDIR)/ansidecl.h \
+ $(INCDIR)/libiberty.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/getpwd.c -o pic/$@; \
else true; fi
$(COMPILE.c) $(srcdir)/getpwd.c $(OUTPUT_OPTION)
-./getruntime.o: $(srcdir)/getruntime.c stamp-h $(INCDIR)/ansidecl.h \
+./getruntime.o: $(srcdir)/getruntime.c config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/libiberty.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/getruntime.c -o pic/$@; \
else true; fi
$(COMPILE.c) $(srcdir)/getruntime.c $(OUTPUT_OPTION)
-./gettimeofday.o: $(srcdir)/gettimeofday.c stamp-h $(INCDIR)/ansidecl.h \
+./gettimeofday.o: $(srcdir)/gettimeofday.c config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/libiberty.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/gettimeofday.c -o pic/$@; \
else true; fi
$(COMPILE.c) $(srcdir)/gettimeofday.c $(OUTPUT_OPTION)
-./hashtab.o: $(srcdir)/hashtab.c stamp-h $(INCDIR)/ansidecl.h $(INCDIR)/hashtab.h \
- $(INCDIR)/libiberty.h
+./hashtab.o: $(srcdir)/hashtab.c config.h $(INCDIR)/ansidecl.h \
+ $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/hashtab.c -o pic/$@; \
else true; fi
$(COMPILE.c) $(srcdir)/hashtab.c $(OUTPUT_OPTION)
-./hex.o: $(srcdir)/hex.c stamp-h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
+./hex.o: $(srcdir)/hex.c config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
$(INCDIR)/safe-ctype.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/hex.c -o pic/$@; \
@@ -742,7 +745,7 @@ $(CONFIGURED_OFILES): stamp-picdir
else true; fi
$(COMPILE.c) $(srcdir)/insque.c $(OUTPUT_OPTION)
-./lbasename.o: $(srcdir)/lbasename.c stamp-h $(INCDIR)/ansidecl.h \
+./lbasename.o: $(srcdir)/lbasename.c config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
$(INCDIR)/safe-ctype.h
if [ x"$(PICFLAG)" != x ]; then \
@@ -750,28 +753,28 @@ $(CONFIGURED_OFILES): stamp-picdir
else true; fi
$(COMPILE.c) $(srcdir)/lbasename.c $(OUTPUT_OPTION)
-./lrealpath.o: $(srcdir)/lrealpath.c stamp-h $(INCDIR)/ansidecl.h \
+./lrealpath.o: $(srcdir)/lrealpath.c config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/libiberty.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/lrealpath.c -o pic/$@; \
else true; fi
$(COMPILE.c) $(srcdir)/lrealpath.c $(OUTPUT_OPTION)
-./make-relative-prefix.o: $(srcdir)/make-relative-prefix.c stamp-h \
+./make-relative-prefix.o: $(srcdir)/make-relative-prefix.c config.h \
$(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/make-relative-prefix.c -o pic/$@; \
else true; fi
$(COMPILE.c) $(srcdir)/make-relative-prefix.c $(OUTPUT_OPTION)
-./make-temp-file.o: $(srcdir)/make-temp-file.c stamp-h $(INCDIR)/ansidecl.h \
+./make-temp-file.o: $(srcdir)/make-temp-file.c config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/libiberty.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/make-temp-file.c -o pic/$@; \
else true; fi
$(COMPILE.c) $(srcdir)/make-temp-file.c $(OUTPUT_OPTION)
-./md5.o: $(srcdir)/md5.c stamp-h $(INCDIR)/ansidecl.h $(INCDIR)/md5.h
+./md5.o: $(srcdir)/md5.c config.h $(INCDIR)/ansidecl.h $(INCDIR)/md5.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/md5.c -o pic/$@; \
else true; fi
@@ -813,7 +816,7 @@ $(CONFIGURED_OFILES): stamp-picdir
else true; fi
$(COMPILE.c) $(srcdir)/memset.c $(OUTPUT_OPTION)
-./mkstemps.o: $(srcdir)/mkstemps.c stamp-h $(INCDIR)/ansidecl.h
+./mkstemps.o: $(srcdir)/mkstemps.c config.h $(INCDIR)/ansidecl.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/mkstemps.c -o pic/$@; \
else true; fi
@@ -825,41 +828,41 @@ $(CONFIGURED_OFILES): stamp-picdir
else true; fi
$(COMPILE.c) $(srcdir)/msdos.c $(OUTPUT_OPTION)
-./objalloc.o: $(srcdir)/objalloc.c stamp-h $(INCDIR)/ansidecl.h \
+./objalloc.o: $(srcdir)/objalloc.c config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/objalloc.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/objalloc.c -o pic/$@; \
else true; fi
$(COMPILE.c) $(srcdir)/objalloc.c $(OUTPUT_OPTION)
-./obstack.o: $(srcdir)/obstack.c stamp-h $(INCDIR)/obstack.h
+./obstack.o: $(srcdir)/obstack.c config.h $(INCDIR)/obstack.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/obstack.c -o pic/$@; \
else true; fi
$(COMPILE.c) $(srcdir)/obstack.c $(OUTPUT_OPTION)
-./partition.o: $(srcdir)/partition.c stamp-h $(INCDIR)/ansidecl.h \
+./partition.o: $(srcdir)/partition.c config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/libiberty.h $(INCDIR)/partition.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/partition.c -o pic/$@; \
else true; fi
$(COMPILE.c) $(srcdir)/partition.c $(OUTPUT_OPTION)
-./pex-common.o: $(srcdir)/pex-common.c stamp-h $(INCDIR)/ansidecl.h \
+./pex-common.o: $(srcdir)/pex-common.c config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/libiberty.h $(srcdir)/pex-common.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/pex-common.c -o pic/$@; \
else true; fi
$(COMPILE.c) $(srcdir)/pex-common.c $(OUTPUT_OPTION)
-./pex-djgpp.o: $(srcdir)/pex-djgpp.c stamp-h $(INCDIR)/ansidecl.h \
+./pex-djgpp.o: $(srcdir)/pex-djgpp.c config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/libiberty.h $(srcdir)/pex-common.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/pex-djgpp.c -o pic/$@; \
else true; fi
$(COMPILE.c) $(srcdir)/pex-djgpp.c $(OUTPUT_OPTION)
-./pex-msdos.o: $(srcdir)/pex-msdos.c stamp-h $(INCDIR)/ansidecl.h \
+./pex-msdos.o: $(srcdir)/pex-msdos.c config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/libiberty.h $(srcdir)/pex-common.h \
$(INCDIR)/safe-ctype.h
if [ x"$(PICFLAG)" != x ]; then \
@@ -867,42 +870,42 @@ $(CONFIGURED_OFILES): stamp-picdir
else true; fi
$(COMPILE.c) $(srcdir)/pex-msdos.c $(OUTPUT_OPTION)
-./pex-one.o: $(srcdir)/pex-one.c stamp-h $(INCDIR)/ansidecl.h \
+./pex-one.o: $(srcdir)/pex-one.c config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/libiberty.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/pex-one.c -o pic/$@; \
else true; fi
$(COMPILE.c) $(srcdir)/pex-one.c $(OUTPUT_OPTION)
-./pex-unix.o: $(srcdir)/pex-unix.c stamp-h $(INCDIR)/ansidecl.h \
+./pex-unix.o: $(srcdir)/pex-unix.c config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/libiberty.h $(srcdir)/pex-common.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/pex-unix.c -o pic/$@; \
else true; fi
$(COMPILE.c) $(srcdir)/pex-unix.c $(OUTPUT_OPTION)
-./pex-win32.o: $(srcdir)/pex-win32.c stamp-h $(INCDIR)/ansidecl.h \
+./pex-win32.o: $(srcdir)/pex-win32.c config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/libiberty.h $(srcdir)/pex-common.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/pex-win32.c -o pic/$@; \
else true; fi
$(COMPILE.c) $(srcdir)/pex-win32.c $(OUTPUT_OPTION)
-./pexecute.o: $(srcdir)/pexecute.c stamp-h $(INCDIR)/ansidecl.h \
+./pexecute.o: $(srcdir)/pexecute.c config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/libiberty.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/pexecute.c -o pic/$@; \
else true; fi
$(COMPILE.c) $(srcdir)/pexecute.c $(OUTPUT_OPTION)
-./physmem.o: $(srcdir)/physmem.c stamp-h $(INCDIR)/ansidecl.h \
+./physmem.o: $(srcdir)/physmem.c config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/libiberty.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/physmem.c -o pic/$@; \
else true; fi
$(COMPILE.c) $(srcdir)/physmem.c $(OUTPUT_OPTION)
-./putenv.o: $(srcdir)/putenv.c stamp-h $(INCDIR)/ansidecl.h
+./putenv.o: $(srcdir)/putenv.c config.h $(INCDIR)/ansidecl.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/putenv.c -o pic/$@; \
else true; fi
@@ -914,14 +917,14 @@ $(CONFIGURED_OFILES): stamp-picdir
else true; fi
$(COMPILE.c) $(srcdir)/random.c $(OUTPUT_OPTION)
-./regex.o: $(srcdir)/regex.c stamp-h $(INCDIR)/ansidecl.h $(INCDIR)/xregex.h \
+./regex.o: $(srcdir)/regex.c config.h $(INCDIR)/ansidecl.h $(INCDIR)/xregex.h \
$(INCDIR)/xregex2.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/regex.c -o pic/$@; \
else true; fi
$(COMPILE.c) $(srcdir)/regex.c $(OUTPUT_OPTION)
-./rename.o: $(srcdir)/rename.c stamp-h $(INCDIR)/ansidecl.h
+./rename.o: $(srcdir)/rename.c config.h $(INCDIR)/ansidecl.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/rename.c -o pic/$@; \
else true; fi
@@ -940,13 +943,13 @@ $(CONFIGURED_OFILES): stamp-picdir
else true; fi
$(COMPILE.c) $(srcdir)/safe-ctype.c $(OUTPUT_OPTION)
-./setenv.o: $(srcdir)/setenv.c stamp-h $(INCDIR)/ansidecl.h
+./setenv.o: $(srcdir)/setenv.c config.h $(INCDIR)/ansidecl.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/setenv.c -o pic/$@; \
else true; fi
$(COMPILE.c) $(srcdir)/setenv.c $(OUTPUT_OPTION)
-./sha1.o: $(srcdir)/sha1.c stamp-h $(INCDIR)/sha1.h
+./sha1.o: $(srcdir)/sha1.c config.h $(INCDIR)/ansidecl.h $(INCDIR)/sha1.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/sha1.c -o pic/$@; \
else true; fi
@@ -964,20 +967,21 @@ $(CONFIGURED_OFILES): stamp-picdir
else true; fi
$(COMPILE.c) $(srcdir)/snprintf.c $(OUTPUT_OPTION)
-./sort.o: $(srcdir)/sort.c stamp-h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
+./sort.o: $(srcdir)/sort.c config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
$(INCDIR)/sort.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/sort.c -o pic/$@; \
else true; fi
$(COMPILE.c) $(srcdir)/sort.c $(OUTPUT_OPTION)
-./spaces.o: $(srcdir)/spaces.c stamp-h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
+./spaces.o: $(srcdir)/spaces.c config.h $(INCDIR)/ansidecl.h \
+ $(INCDIR)/libiberty.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/spaces.c -o pic/$@; \
else true; fi
$(COMPILE.c) $(srcdir)/spaces.c $(OUTPUT_OPTION)
-./splay-tree.o: $(srcdir)/splay-tree.c stamp-h $(INCDIR)/ansidecl.h \
+./splay-tree.o: $(srcdir)/splay-tree.c config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/libiberty.h $(INCDIR)/splay-tree.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/splay-tree.c -o pic/$@; \
@@ -1014,7 +1018,7 @@ $(CONFIGURED_OFILES): stamp-picdir
else true; fi
$(COMPILE.c) $(srcdir)/strdup.c $(OUTPUT_OPTION)
-./strerror.o: $(srcdir)/strerror.c stamp-h $(INCDIR)/ansidecl.h \
+./strerror.o: $(srcdir)/strerror.c config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/libiberty.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/strerror.c -o pic/$@; \
@@ -1045,7 +1049,7 @@ $(CONFIGURED_OFILES): stamp-picdir
else true; fi
$(COMPILE.c) $(srcdir)/strrchr.c $(OUTPUT_OPTION)
-./strsignal.o: $(srcdir)/strsignal.c stamp-h $(INCDIR)/ansidecl.h \
+./strsignal.o: $(srcdir)/strsignal.c config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/libiberty.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/strsignal.c -o pic/$@; \
@@ -1064,13 +1068,13 @@ $(CONFIGURED_OFILES): stamp-picdir
else true; fi
$(COMPILE.c) $(srcdir)/strtod.c $(OUTPUT_OPTION)
-./strtol.o: $(srcdir)/strtol.c stamp-h $(INCDIR)/safe-ctype.h
+./strtol.o: $(srcdir)/strtol.c config.h $(INCDIR)/safe-ctype.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/strtol.c -o pic/$@; \
else true; fi
$(COMPILE.c) $(srcdir)/strtol.c $(OUTPUT_OPTION)
-./strtoul.o: $(srcdir)/strtoul.c stamp-h $(INCDIR)/ansidecl.h \
+./strtoul.o: $(srcdir)/strtoul.c config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/safe-ctype.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/strtoul.c -o pic/$@; \
@@ -1090,14 +1094,14 @@ $(CONFIGURED_OFILES): stamp-picdir
else true; fi
$(COMPILE.c) $(srcdir)/tmpnam.c $(OUTPUT_OPTION)
-./unlink-if-ordinary.o: $(srcdir)/unlink-if-ordinary.c stamp-h \
+./unlink-if-ordinary.o: $(srcdir)/unlink-if-ordinary.c config.h \
$(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/unlink-if-ordinary.c -o pic/$@; \
else true; fi
$(COMPILE.c) $(srcdir)/unlink-if-ordinary.c $(OUTPUT_OPTION)
-./vasprintf.o: $(srcdir)/vasprintf.c stamp-h $(INCDIR)/ansidecl.h \
+./vasprintf.o: $(srcdir)/vasprintf.c config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/libiberty.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/vasprintf.c -o pic/$@; \
@@ -1122,7 +1126,7 @@ $(CONFIGURED_OFILES): stamp-picdir
else true; fi
$(COMPILE.c) $(srcdir)/vprintf.c $(OUTPUT_OPTION)
-./vsnprintf.o: $(srcdir)/vsnprintf.c stamp-h $(INCDIR)/ansidecl.h \
+./vsnprintf.o: $(srcdir)/vsnprintf.c config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/libiberty.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/vsnprintf.c -o pic/$@; \
@@ -1135,54 +1139,54 @@ $(CONFIGURED_OFILES): stamp-picdir
else true; fi
$(COMPILE.c) $(srcdir)/vsprintf.c $(OUTPUT_OPTION)
-./waitpid.o: $(srcdir)/waitpid.c stamp-h $(INCDIR)/ansidecl.h
+./waitpid.o: $(srcdir)/waitpid.c config.h $(INCDIR)/ansidecl.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/waitpid.c -o pic/$@; \
else true; fi
$(COMPILE.c) $(srcdir)/waitpid.c $(OUTPUT_OPTION)
-./xatexit.o: $(srcdir)/xatexit.c stamp-h $(INCDIR)/ansidecl.h \
+./xatexit.o: $(srcdir)/xatexit.c config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/libiberty.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/xatexit.c -o pic/$@; \
else true; fi
$(COMPILE.c) $(srcdir)/xatexit.c $(OUTPUT_OPTION)
-./xexit.o: $(srcdir)/xexit.c stamp-h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
+./xexit.o: $(srcdir)/xexit.c config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/xexit.c -o pic/$@; \
else true; fi
$(COMPILE.c) $(srcdir)/xexit.c $(OUTPUT_OPTION)
-./xmalloc.o: $(srcdir)/xmalloc.c stamp-h $(INCDIR)/ansidecl.h \
+./xmalloc.o: $(srcdir)/xmalloc.c config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/libiberty.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/xmalloc.c -o pic/$@; \
else true; fi
$(COMPILE.c) $(srcdir)/xmalloc.c $(OUTPUT_OPTION)
-./xmemdup.o: $(srcdir)/xmemdup.c stamp-h $(INCDIR)/ansidecl.h \
+./xmemdup.o: $(srcdir)/xmemdup.c config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/libiberty.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/xmemdup.c -o pic/$@; \
else true; fi
$(COMPILE.c) $(srcdir)/xmemdup.c $(OUTPUT_OPTION)
-./xstrdup.o: $(srcdir)/xstrdup.c stamp-h $(INCDIR)/ansidecl.h \
+./xstrdup.o: $(srcdir)/xstrdup.c config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/libiberty.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/xstrdup.c -o pic/$@; \
else true; fi
$(COMPILE.c) $(srcdir)/xstrdup.c $(OUTPUT_OPTION)
-./xstrerror.o: $(srcdir)/xstrerror.c stamp-h $(INCDIR)/ansidecl.h \
+./xstrerror.o: $(srcdir)/xstrerror.c config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/libiberty.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/xstrerror.c -o pic/$@; \
else true; fi
$(COMPILE.c) $(srcdir)/xstrerror.c $(OUTPUT_OPTION)
-./xstrndup.o: $(srcdir)/xstrndup.c stamp-h $(INCDIR)/ansidecl.h \
+./xstrndup.o: $(srcdir)/xstrndup.c config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/libiberty.h
if [ x"$(PICFLAG)" != x ]; then \
$(COMPILE.c) $(PICFLAG) $(srcdir)/xstrndup.c -o pic/$@; \
diff --git a/libiberty/functions.texi b/libiberty/functions.texi
index e6ab84c6999..34566d8f17a 100644
--- a/libiberty/functions.texi
+++ b/libiberty/functions.texi
@@ -688,7 +688,9 @@ reading and writing.
@c pexecute.txh:266
@deftypefn Extension void pex_free (struct pex_obj @var{obj})
-Clean up and free all data associated with @var{obj}.
+Clean up and free all data associated with @var{obj}. If you have not
+yet called @code{pex_get_times} or @code{pex_get_status}, this will
+try to kill the subprocesses.
@end deftypefn
@@ -814,7 +816,7 @@ the output pipe is you, but you are blocked on the input pipe.
@end deftypefn
-@c pexecute.txh:272
+@c pexecute.txh:274
@deftypefn Extension {const char *} pex_one (int @var{flags}, const char *@var{executable}, char * const *@var{argv}, const char *@var{pname}, const char *@var{outname}, const char *@var{errname}, int *@var{status}, int *@var{err})
An interface to permit the easy execution of a
@@ -977,7 +979,7 @@ form @code{VAR=VALUE}, with the exception of the last element that must be
@end deftypefn
-@c pexecute.txh:284
+@c pexecute.txh:286
@deftypefn Extension int pexecute (const char *@var{program}, char * const *@var{argv}, const char *@var{this_pname}, const char *@var{temp_base}, char **@var{errmsg_fmt}, char **@var{errmsg_arg}, int @var{flags})
This is the old interface to execute one or more programs. It is
@@ -986,7 +988,7 @@ documented.
@end deftypefn
-@c strsignal.c:539
+@c strsignal.c:541
@deftypefn Supplemental void psignal (int @var{signo}, char *@var{message})
Print @var{message} to the standard error, followed by a colon,
@@ -1005,7 +1007,7 @@ name is unset/removed.
@end deftypefn
-@c pexecute.txh:292
+@c pexecute.txh:294
@deftypefn Extension int pwait (int @var{pid}, int *@var{status}, int @var{flags})
Another part of the old execution interface.
@@ -1256,7 +1258,7 @@ call to @code{strsignal}.
@end deftypefn
-@c strsignal.c:446
+@c strsignal.c:448
@deftypefn Extension {const char*} strsigno (int @var{signo})
Given an signal number, returns a pointer to a string containing the
@@ -1322,7 +1324,7 @@ that the converted value is unsigned.
@end deftypefn
-@c strsignal.c:500
+@c strsignal.c:502
@deftypefn Extension int strtosigno (const char *@var{name})
Given the symbolic name of a signal, map it to a signal number. If no
diff --git a/libiberty/maint-tool b/libiberty/maint-tool
index a460b5570e5..e6e87070d37 100644
--- a/libiberty/maint-tool
+++ b/libiberty/maint-tool
@@ -226,6 +226,7 @@ sub deps {
$mine{$f} = "\$(INCDIR)/$f";
$deps{$f} = join(' ', &deps_for("$incdir/$f"));
}
+ $mine{'config.h'} = "config.h";
opendir(INC, $srcdir);
while ($f = readdir INC) {
@@ -233,8 +234,7 @@ sub deps {
$mine{$f} = "\$(srcdir)/$f";
$deps{$f} = join(' ', &deps_for("$srcdir/$f"));
}
-
- $mine{'config.h'} = "stamp-h";
+ $mine{'config.h'} = "config.h";
open(IN, "$srcdir/Makefile.in");
open(OUT, ">$srcdir/Makefile.tmp");
diff --git a/libiberty/make-temp-file.c b/libiberty/make-temp-file.c
index 5e21414ad8e..94c76d700bd 100644
--- a/libiberty/make-temp-file.c
+++ b/libiberty/make-temp-file.c
@@ -23,6 +23,7 @@ Boston, MA 02110-1301, USA. */
#include <stdio.h> /* May get P_tmpdir. */
#include <sys/types.h>
+#include <errno.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
@@ -166,11 +167,14 @@ make_temp_file (const char *suffix)
strcpy (temp_filename + base_len + TEMP_FILE_LEN, suffix);
fd = mkstemps (temp_filename, suffix_len);
- /* If mkstemps failed, then something bad is happening. Maybe we should
- issue a message about a possible security attack in progress? */
+ /* Mkstemps failed. It may be EPERM, ENOSPC etc. */
if (fd == -1)
- abort ();
- /* Similarly if we can not close the file. */
+ {
+ fprintf (stderr, "Cannot create temporary file in %s: %s\n",
+ base, strerror (errno));
+ abort ();
+ }
+ /* We abort on failed close out of sheer paranoia. */
if (close (fd))
abort ();
return temp_filename;
diff --git a/libiberty/mkstemps.c b/libiberty/mkstemps.c
index 6c2e472528b..a0e68a73b49 100644
--- a/libiberty/mkstemps.c
+++ b/libiberty/mkstemps.c
@@ -127,6 +127,13 @@ mkstemps (char *pattern, int suffix_len)
if (fd >= 0)
/* The file does not exist. */
return fd;
+ if (errno != EEXIST
+#ifdef EISDIR
+ && errno != EISDIR
+#endif
+ )
+ /* Fatal error (EPERM, ENOSPC etc). Doesn't make sense to loop. */
+ break;
/* This is a random value. It is only necessary that the next
TMP_MAX values generated by adding 7777 to VALUE are different
diff --git a/libiberty/pex-win32.c b/libiberty/pex-win32.c
index 05d44e9d183..5897866347d 100644
--- a/libiberty/pex-win32.c
+++ b/libiberty/pex-win32.c
@@ -321,6 +321,18 @@ msys_rootify (const char *executable)
}
#endif
+/* Return the number of arguments in an argv array, not including the null
+ terminating argument. */
+
+static int
+argv_to_argc (char *const *argv)
+{
+ char *const *i = argv;
+ while (*i)
+ i++;
+ return i - argv;
+}
+
/* Return a Windows command-line from ARGV. It is the caller's
responsibility to free the string returned. */
@@ -522,6 +534,9 @@ env_compare (const void *a_ptr, const void *b_ptr)
return c1 - c2;
}
+/* Execute a Windows executable as a child process. This will fail if the
+ * target is not actually an executable, such as if it is a shell script. */
+
static pid_t
win32_spawn (const char *executable,
BOOL search,
@@ -619,6 +634,9 @@ win32_spawn (const char *executable,
return (pid_t) -1;
}
+/* Spawn a script. This simulates the Unix script execution mechanism.
+ This function is called as a fallback if win32_spawn fails. */
+
static pid_t
spawn_script (const char *executable, char *const *argv,
char* const *env,
@@ -630,6 +648,8 @@ spawn_script (const char *executable, char *const *argv,
int save_errno = errno;
int fd = _open (executable, _O_RDONLY);
+ /* Try to open script, check header format, extract interpreter path,
+ and spawn script using that interpretter. */
if (fd >= 0)
{
char buf[MAX_PATH + 5];
@@ -642,16 +662,28 @@ spawn_script (const char *executable, char *const *argv,
eol = strchr (buf, '\n');
if (eol && strncmp (buf, "#!", 2) == 0)
{
+
+ /* Header format is OK. */
char *executable1;
- const char ** avhere = (const char **) --argv;
+ int new_argc;
+ const char **avhere;
+
+ /* Extract interpreter path. */
do
*eol = '\0';
while (*--eol == '\r' || *eol == ' ' || *eol == '\t');
for (executable1 = buf + 2; *executable1 == ' ' || *executable1 == '\t'; executable1++)
continue;
-
backslashify (executable1);
+
+ /* Duplicate argv, prepending the interpreter path. */
+ new_argc = argv_to_argc (argv) + 1;
+ avhere = XNEWVEC (const char *, new_argc + 1);
*avhere = executable1;
+ memcpy (avhere + 1, argv, new_argc * sizeof(*argv));
+ argv = (char *const *)avhere;
+
+ /* Spawn the child. */
#ifndef USE_MINGW_MSYS
executable = strrchr (executable1, '\\') + 1;
if (!executable)
@@ -686,6 +718,7 @@ spawn_script (const char *executable, char *const *argv,
}
}
#endif
+ free (avhere);
}
}
}
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 1caf0ef248b..891b4dca588 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,22 @@
+2008-08-07 Andrew Haley <aph@redhat.com>
+
+ * testsuite/libjava.lang/StackTrace2.java: Rewrite to prevent
+ spurious failure when some methods are inlined.
+
+2008-08-05 Matthias Klose <doko@ubuntu.com>
+
+ * HACKING: Update instructions how to build gcj/javaprims.h.
+
+2008-08-04 Tom Tromey <tromey@redhat.com>
+
+ PR libgcj/31890:
+ * gcj/javaprims.h: Regenerate class list.
+
+2008-07-16 Roger Sayle <roger@eyesopen.com>
+ Paolo Bonzini <bonzini@gnu.org>
+
+ * scripts/jar.in: Fix portability problems with Solaris /bin/sh.
+
2008-07-08 Matthias Klose <doko@ubuntu.com>
* libtool-version: Bump soversion.
diff --git a/libjava/HACKING b/libjava/HACKING
index 03563b2afa2..e6a0f4c48f5 100644
--- a/libjava/HACKING
+++ b/libjava/HACKING
@@ -184,6 +184,6 @@ If you add a class to java.lang, java.io, or java.util
entire contents of the namespace)
* Then insert the output of `perl scripts/classes.pl' into the file
- at that point. This must be run from the build tree, in
- <build>/classpath/lib; it uses the .class file name to determine
+ at that point. This must be run from the source tree, in
+ libjava/classpath/lib; it uses the .class file name to determine
what to print.
diff --git a/libjava/gcj/javaprims.h b/libjava/gcj/javaprims.h
index 8d18cdf2da5..a0b99d28361 100644
--- a/libjava/gcj/javaprims.h
+++ b/libjava/gcj/javaprims.h
@@ -1,7 +1,7 @@
// javaprims.h - Main external header file for libgcj. -*- c++ -*-
-/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
Free Software Foundation
This file is part of libgcj.
@@ -440,6 +440,7 @@ extern "Java"
class EnumMap$7;
class EnumSet;
class EnumSet$1;
+ class EnumSet$2;
class Enumeration;
class EventListener;
class EventListenerProxy;
@@ -614,6 +615,11 @@ extern "Java"
class ConcurrentSkipListMap$Values;
class ConcurrentSkipListSet;
class CopyOnWriteArrayList;
+ class CopyOnWriteArrayList$1;
+ class CopyOnWriteArrayList$2;
+ class CopyOnWriteArrayList$3;
+ class CopyOnWriteArrayList$RandomAccessSubList;
+ class CopyOnWriteArrayList$SubList;
class CopyOnWriteArraySet;
class CountDownLatch;
class CountDownLatch$Sync;
diff --git a/libjava/scripts/jar.in b/libjava/scripts/jar.in
index 82ea10c2912..e9cb9f5822e 100644
--- a/libjava/scripts/jar.in
+++ b/libjava/scripts/jar.in
@@ -96,7 +96,7 @@ copy () {
return 0
fi
- if test -e "$2"/"$1"; then
+ if test -f "$2"/"$1"; then
error "$1": Duplicate entry.
fi
dir=`dirname "$1"`
@@ -249,8 +249,7 @@ jar_list_verbose () {
}
# mkdir -p emulation based on the mkinstalldirs script.
-mkdir_p ()
-{
+func_mkdir_p () {
for file
do
case $file in
@@ -290,7 +289,7 @@ mkdir_p ()
if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
mkdir_p='mkdir -p'
else
- mkdir_p='mkdir_p'
+ mkdir_p='func_mkdir_p'
test -d ./-p && rmdir ./-p
test -d ./--version && rmdir ./--version
fi
diff --git a/libjava/testsuite/libjava.lang/StackTrace2.jar b/libjava/testsuite/libjava.lang/StackTrace2.jar
index edb8f0e2e74..0aacb8fa644 100644
--- a/libjava/testsuite/libjava.lang/StackTrace2.jar
+++ b/libjava/testsuite/libjava.lang/StackTrace2.jar
Binary files differ
diff --git a/libjava/testsuite/libjava.lang/StackTrace2.java b/libjava/testsuite/libjava.lang/StackTrace2.java
index 4a69409815e..01c7d5bac7f 100644
--- a/libjava/testsuite/libjava.lang/StackTrace2.java
+++ b/libjava/testsuite/libjava.lang/StackTrace2.java
@@ -7,7 +7,7 @@ public class StackTrace2
{
try
{
- a();
+ new StackTrace2().a();
}
catch (Exception x)
{
@@ -16,14 +16,14 @@ public class StackTrace2
}
}
- static void a()
+ void a()
{
- new Inner();
+ new Inner().foo();
}
- static class Inner
+ class Inner
{
- public Inner()
+ public void foo()
{
doCrash(null);
}
@@ -38,7 +38,7 @@ public class StackTrace2
{
System.out.println("Trace length = " + trace.length);
checkLine(trace[0], "StackTrace2$Inner", "doCrash", 33);
- checkLine(trace[1], "StackTrace2$Inner", "<init>", 28);
+ checkLine(trace[1], "StackTrace2$Inner", "foo", 28);
checkLine(trace[2], "StackTrace2", "a", 21);
checkLine(trace[3], "StackTrace2", "main", 10);
}
diff --git a/libjava/testsuite/libjava.lang/StackTrace2.out b/libjava/testsuite/libjava.lang/StackTrace2.out
index 90cfd48d91f..dafadce812b 100644
--- a/libjava/testsuite/libjava.lang/StackTrace2.out
+++ b/libjava/testsuite/libjava.lang/StackTrace2.out
@@ -1,5 +1,5 @@
Trace length = 4
StackTrace2$Inner.doCrash:OK
-StackTrace2$Inner.<init>:OK
+StackTrace2$Inner.foo:OK
StackTrace2.a:OK
StackTrace2.main:OK
diff --git a/libobjc/ChangeLog b/libobjc/ChangeLog
index aabb9fd9eff..6c3dd17d094 100644
--- a/libobjc/ChangeLog
+++ b/libobjc/ChangeLog
@@ -1,3 +1,12 @@
+2008-07-18 Matthias Klose <doko@ubuntu.com>
+
+ * Makefile.in: Ignore missing ../boehm-gc/threads.mk.
+
+2008-07-18 Matthias Klose <doko@ubuntu.com>
+
+ * Makefile.in: Include ../boehm-gc/threads.mk.
+ (OBJC_BOEHM_GC_LIBS): Define, (libobjc_gc$(libsuffix).la): Use it.
+
2008-07-06 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* Makefile.in (install-info): New stub target.
diff --git a/libobjc/Makefile.in b/libobjc/Makefile.in
index f9538af5cda..0cd77d37bc1 100644
--- a/libobjc/Makefile.in
+++ b/libobjc/Makefile.in
@@ -48,6 +48,8 @@ extra_ldflags_libobjc = @extra_ldflags_libobjc@
top_builddir = .
+-include ../boehm-gc/threads.mk
+
libdir = $(exec_prefix)/lib
libsubdir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version)
@@ -95,6 +97,7 @@ OBJC_GCFLAGS=-DOBJC_WITH_GC=1
OBJC_THREAD_FILE=thr-objc
OBJC_BOEHM_GC=@OBJC_BOEHM_GC@
OBJC_BOEHM_GC_INCLUDES=@OBJC_BOEHM_GC_INCLUDES@
+OBJC_BOEHM_GC_LIBS=../boehm-gc/libgcjgc_convenience.la $(thread_libs_and_flags)
INCLUDES = -I$(srcdir)/objc -I$(srcdir)/$(MULTISRCTOP)../gcc \
-I$(srcdir)/$(MULTISRCTOP)../gcc/config \
@@ -284,7 +287,7 @@ libobjc$(libsuffix).la: $(OBJS)
$(LTLDFLAGS)
libobjc_gc$(libsuffix).la: $(OBJS_GC)
- $(LIBTOOL_LINK) $(CC) -o $@ $(OBJS_GC) \
+ $(LIBTOOL_LINK) $(CC) -o $@ $(OBJS_GC) $(OBJC_BOEHM_GC_LIBS) \
-rpath $(toolexeclibdir) \
-version-info $(LIBOBJC_GC_VERSION) $(extra_ldflags_libobjc) \
$(LTLDFLAGS)
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index e78c7d67f64..11269e69388 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,471 @@
+2008-08-13 Paolo Carlini <paolo.carlini@oracle.com>
+
+ Re-instate last patch, amended to use __exchange_and_add_dispatch
+ and __atomic_add_dispatch in eh_ptr.cc and eh_throw.cc.
+
+2008-08-13 Paolo Carlini <paolo.carlini@oracle.com>
+
+ Revert the last patch.
+
+2008-08-13 Sebastian Redl <sebastian.redl@getdesigned.at>
+
+ Add exception propagation support as per N2179.
+ * libsupc++/exception_ptr.h (exception_ptr, current_exception,
+ copy_exception, rethrow_exception): New file, implement exception
+ propagation.
+ * libsupc++/eh_ptr.cc (exception_ptr, current_exception,
+ rethrow_exception, __gxx_dependent_exception_cleanup): Likewise.
+ * libsupc++/unwind-cxx.h (__cxa_exception): Add reference count.
+ (__cxa_dependent_exception, __cxa_allocate_dependent_exception,
+ __cxa_free_dependent_exception, __get_dependent_exception_from_ue,
+ __GXX_INIT_DEPENDENT_EXCEPTION_CLASS, __is_dependent_exception,
+ __gxx_dependent_exception_class, __get_object_from_ue,
+ __get_object_from_ambiguous_exception): Add.
+ (__GXX_INIT_EXCEPTION_CLASS, __gxx_exception_class): Rename.
+ (__is_gxx_exception_class): Handle dependent exceptions.
+ * libsupc++/eh_arm.cc (__cxa_type_match): Likewise.
+ * libsupc++/eh_call.cc (__cxa_call_unexpected): Likewise.
+ * libsupc++/eh_personality.cc (__gxx_personality_*): Likewise.
+ * libsupc++/eh_type.cc (__cxa_current_exception_type): Likewise.
+ * libsupc++/eh_alloc.cc (__cxa_allocate_dependent_exception,
+ __cxa_free_dependent_exception): Add.
+ * libsupc++/eh_throw.cc (__gxx_exception_cleanup): Handle reference
+ counting.
+ * libsupc++/exception: Conditionally include exception_ptr.h.
+ * libsupc++/Makefile.am: Register new files.
+ * libsupc++/Makefile.in: Regenerate.
+ * config/abi/pre/gnu.ver: Add new symbols.
+ * testsuite/18_support/exception_ptr/current_exception.cc: Test the
+ core functionality of current_exception().
+ * testsuite/18_support/exception_ptr/rethrow_exception.cc: Test the
+ core functionality of rethrow_exception().
+ * testsuite/18_support/exception_ptr/lifespan.cc: Test the life span of
+ exception objects during exception propagation.
+
+2008-08-12 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR libstdc++/37100
+ * include/bits/stl_pair.h: Fix documentation URL in comment.
+
+2008-08-12 Johannes Singler <singler@ira.uka.de>
+
+ * include/paralle/losertree.h
+ (LoserTreePointerBase<>::~LoserTreePointerBase):
+ Replace delete by appropriate delete[].
+
+2008-08-12 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * configure.ac: Run unconditionally GLIBCXX_CHECK_INT64_T and
+ GLIBCXX_CHECK_C99_TR1; remove sigsetjmp and mmap checks (unused).
+ * crossconfig.m4: Adjust; remove HAVE_GETPAGESIZE defines (unused).
+ * configure: Regenerate.
+ * config.h.in: Likewise.
+
+ * acinclude.m4: Minor formatting fixes.
+
+2008-08-11 Stephen M. Webb <stephenw@xandros.com>
+
+ * include/tr1_impl/regex: Formatting fixes.
+ * testsuite/tr1/7_regular_expressions/regex_traits/char/value.cc:
+ New test.
+ * testsuite/tr1/7_regular_expressions/regex_traits/wchar_t/value.cc:
+ New test.
+
+2008-08-11 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * config/locale/generic/c_locale.cc: Include <cstdio>.
+
+2008-08-11 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * configure.ac: Run GLIBCXX_CHECK_STDIO_MACROS unconditionally.
+ * configure: Regenerate.
+
+2008-08-10 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/tr1_impl/type_traits (_DEFINE_SPEC*): Simplify.
+ (_DEFINE_SPEC_BODY): Remove.
+ (__is_void_helper, __is_integral_helper, __is_floating_point_helper,
+ __is_member_object_pointer_helper, __is_member_function_pointer_helper,
+ __remove_pointer_helper): Add.
+ (is_void, is_integral, is_floating_point, is_member_object_pointer,
+ is_member_function_pointer, remove_pointer): Use the latter.
+ * include/tr1/type_traits (_DEFINE_SPEC): Simplify.
+ (_DEFINE_SPEC_HELPER): Remove.
+ (__is_signed_helper, __is_unsigned_helper): Add.
+ (is_signed, is_unsigned): Use the latter.
+
+2008-08-09 Paolo Carlini <paolo.carlini@oracle.com>
+
+ Revert fix for libstdc++/35637, thanks to other/36901.
+ * include/tr1_impl/type_traits (__is_function_helper): New, uses
+ variadic templates.
+ (is_function): Forward to the latter.
+ (__in_array): Remove.
+
+2008-08-09 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * config/locale/darwin/ctype_members.cc: Include <cstdio>.
+
+2008-08-08 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/bits/ios_base.h: Undef _IOS_BASE_SEEK_CUR and
+ _IOS_BASE_SEEK_END at the end of the file.
+ * include/bits/char_traits.h: Likewise for _CHAR_TRAITS_EOF.
+
+2008-08-07 Stephen M. Webb <stephenw@xandros.com>
+
+ * include/tr1_impl/regex (match_results<>::cbegin, cend): Add, per
+ N2691 WD.
+
+2008-08-06 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * acinclude.m4 ([GLIBCXX_CHECK_STDIO_MACROS]): New, checks for
+ common values of EOF, SEEK_CUR, SEEK_END.
+ * configure.ac: Use it.
+ * include/bits/ios_base.h: Likewise.
+ * include/bits/char_traits.h: Likewise.
+ * config/locale/gnu/ctype_members.cc: Include <cstdio>.
+ * config/locale/generic/ctype_members.cc: Likewise.
+ * testsuite/27_io/ios_base/cons/assign_neg.cc: Adjust dg-error lines.
+ * testsuite/27_io/ios_base/cons/copy_neg.cc: Likewise.
+ * configure: Regenerate.
+ * config.h.in: Likewise.
+
+2008-08-06 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * acinclude.m4 ([GLIBCXX_CHECK_INT64_T]): Also check whether int64_t
+ is actually a typedef to long or long long.
+ * include/bits/postypes.h: If int64_t is actually a typedef for
+ long or long long don't include <stdint.h> unnecessarily.
+ * configure: Regenerate.
+ * config.h.in: Likewise.
+
+2008-08-05 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * testsuite/util/testsuite_api.h (diamond_derivation<>::test):
+ Expect ambiguity together with the standard exception classes.
+ * testsuite/27_io/ios_base/failure/cons_virtual_derivation.cc: Remove
+ xfail.
+ * testsuite/19_diagnostics/logic_error/cons_virtual_derivation.cc:
+ Likewise.
+ * testsuite/19_diagnostics/runtime_error/cons_virtual_derivation.cc:
+ Likewise.
+ * testsuite/19_diagnostics/system_error/cons_virtual_derivation.cc:
+ Likewise.
+ * testsuite/18_support/bad_alloc/cons_virtual_derivation.cc: Likewise.
+ * testsuite/18_support/bad_cast/cons_virtual_derivation.cc: Likewise.
+ * testsuite/18_support/bad_exception/cons_virtual_derivation.cc:
+ Likewise.
+ * testsuite/18_support/bad_typeid/cons_virtual_derivation.cc:
+ Likewise.
+ * testsuite/ext/concurrence_lock_error/cons_virtual_derivation.cc:
+ Likewise.
+ * testsuite/ext/forced_exception_error/cons_virtual_derivation.cc:
+ Likewise.
+ * testsuite/ext/concurrence_unlock_error/cons_virtual_derivation.cc:
+ Likewise.
+ * testsuite/20_util/bad_function_call/cons_virtual_derivation.cc:
+ Likewise.
+
+2008-08-04 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/bits/postypes.h: Reinstate inclusion of <stdint.h>;
+ also define the __STDC_* macros.
+ (streamoff): Adjust.
+
+ * include/tr1_impl/cstdint: Check that the __STDC_* macros are
+ not defined before defining.
+
+2008-08-01 Paolo Bonzini <bonzini@gnu.org>
+ Chris Fairles <chris.fairles@gmail.com>
+
+ * acinclude.m4 ([GLIBCXX_CHECK_CLOCK_GETTIME]): Reinstate clock_gettime
+ search, but only in libposix4, never link librt.
+ * src/Makefile.am: Reinstate previous change to add GLIBCXX_LIBS.
+ * configure: Regenerate.
+ * configure.in: Likewise.
+ * Makefile.in: Likewise.
+ * src/Makefile.in: Likewise.
+ * libsup++/Makefile.in: Likewise.
+ * po/Makefile.in: Likewise.
+ * doc/Makefile.in: Likewise.
+
+2008-07-31 Chris Fairles <chris.fairles@gmail.com>
+
+ * include/std/chrono (duration): Use explicitly defaulted ctor, cctor,
+ dtor and assignment. Add diagnostics as per 20.8.3 paragraphs 2, 3
+ and 4 in WD. Other minor tweaks.
+ * testsuite/20_util/duration/cons/1_neg.cc: Adjust line numbers.
+ * testsuite/20_util/duration/requirements/typedefs_neg1.cc: New.
+ * testsuite/20_util/duration/requirements/typedefs_neg2.cc: Likewise.
+ * testsuite/20_util/duration/requirements/typedefs_neg3.cc: Likewise.
+
+2008-07-31 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * testsuite/lib/libstdc++.exp (libstdc++_init): Set v3-libgomp.
+ (check_v3_target_parallel_mode): Robustify, just follow the
+ structure of testsuite/Makefile.am.
+
+2008-07-29 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/debug/set.h: Minor formatting fixes.
+ * include/debug/multiset.h: Likewise.
+ * include/debug/safe_association.h: Likewise.
+ * include/debug/vector: Likewise.
+ * include/debug/map.h: Likewise.
+ * include/debug/string: Likewise.
+ * include/debug/multimap.h: Likewise.
+ * include/bits/stl_list.h: Likewise.
+ * include/bits/stl_map.h: Likewise.
+ * include/bits/stl_set.h: Likewise.
+ * include/bits/stl_multimap.h: Likewise.
+ * include/bits/stl_vector.h: Likewise.
+ * include/bits/stl_multiset.h: Likewise.
+ * include/bits/stl_bvector.h: Likewise.
+
+2008-07-29 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/std/utility: Include <initializer_list>, per the current WP.
+
+ * testsuite/lib/libstdc++.exp (check_v3_target_cstdint): Tweak,
+ don't use -std=gnu++0x unnecessarily.
+ * testsuite/18_support/numeric_limits/char16_32_t.cc: Use
+ dg-require-cstdint.
+ * testsuite/18_support/headers/cstdint/types_std_c++0x.cc: Likewise.
+ * testsuite/tr1/8_c_compatibility/cstdint/types_std_tr1.cc: Likewise.
+
+2008-07-28 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR libstdc++/36949
+ * include/tr1_impl/boost_shared_ptr.h
+ (__shared_ptr(_Sp_make_shared_tag, _Alloc, _Args&&...): Call
+ __enable_shared_from_this_helper.
+ * testsuite/20_util/shared_ptr/creation/36949.cc: New.
+
+2008-07-24 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR libstdc++/36924
+ Revert:
+ 2008-07-23 Chris Fairles <chris.fairles@gmail.com>
+
+ * acinclude.m4 ([GLIBCXX_CHECK_CLOCK_GETTIME]): Define GLIBCXX_LIBS.
+ Holds the lib that defines clock_gettime (-lrt or -lposix4).
+ * src/Makefile.am: Use it.
+ * configure: Regenerate.
+ * configure.in: Likewise.
+ * Makefile.in: Likewise.
+ * src/Makefile.in: Likewise.
+ * libsup++/Makefile.in: Likewise.
+ * po/Makefile.in: Likewise.
+ * doc/Makefile.in: Likewise.
+
+2008-07-23 Chris Fairles <chris.fairles@gmail.com>
+
+ * include/std/condition_variable: Update to N2691 WD.
+ * include/std/mutex: Likewise.
+ * testsuite/30_threads/mutex/cons/assign_neg.cc: Adjust line numbers.
+ * testsuite/30_threads/mutex/cons/copy_neg.cc: Likewise.
+ * testsuite/30_threads/recursive_mutex/cons/assign_neg.cc: Likewise.
+ * testsuite/30_threads/recursive_mutex/cons/copy_neg.cc: Likewise.
+
+2008-07-23 Chris Fairles <chris.fairles@gmail.com>
+
+ * acinclude.m4 ([GLIBCXX_CHECK_CLOCK_GETTIME]): Define GLIBCXX_LIBS.
+ Holds the lib that defines clock_gettime (-lrt or -lposix4).
+ * src/Makefile.am: Use it.
+ * configure: Regenerate.
+ * configure.in: Likewise.
+ * Makefile.in: Likewise.
+ * src/Makefile.in: Likewise.
+ * libsup++/Makefile.in: Likewise.
+ * po/Makefile.in: Likewise.
+ * doc/Makefile.in: Likewise.
+
+2008-07-22 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/ext/sso_string_base.h
+ (__sso_string_base<>::__sso_string_base(std::initializer_list<_CharT>,
+ const _Alloc&)): Remove.
+ * include/ext/rc_string_base.h
+ (__rc_string_base<>::__rc_string_base(std::initializer_list<_CharT>,
+ const _Alloc&)): Likewise.
+ * include/ext/vstring.h
+ (__versa_string<>::__versa_string(std::initializer_list<_CharT>,
+ const _Alloc&)): Adjust.
+
+2008-07-21 Jason Merrill <jason@redhat.com>
+
+ Add initializer_list support as per N2679.
+ * include/debug/unordered_map: Add initializer_list support.
+ * include/debug/safe_association.h: Likewise.
+ * include/debug/unordered_set: Likewise.
+ * include/debug/vector: Likewise.
+ * include/debug/deque: Likewise.
+ * include/debug/map.h: Likewise.
+ * include/debug/set.h: Likewise.
+ * include/debug/string: Likewise.
+ * include/debug/list: Likewise.
+ * include/debug/multimap.h: Likewise.
+ * include/tr1_impl/unordered_map: Likewise.
+ * include/tr1_impl/hashtable: Likewise.
+ * include/tr1_impl/unordered_set: Likewise.
+ * include/tr1_impl/regex: Likewise.
+ * include/std/valarray: Likewise.
+ * include/std/unordered_map: Likewise.
+ * include/std/unordered_set: Likewise.
+ * include/bits/stl_list.h: Likewise.
+ * include/bits/stl_map.h: Likewise.
+ * include/bits/stl_set.h: Likewise.
+ * include/bits/basic_string.h: Likewise.
+ * include/bits/basic_string.tcc: Likewise.
+ * include/bits/stl_multimap.h: Likewise.
+ * include/bits/stl_vector.h: Likewise.
+ * include/bits/stl_deque.h: Likewise.
+ * include/bits/stl_multiset.h: Likewise.
+ * include/bits/stl_bvector.h: Likewise.
+ * include/ext/vstring.h: Likewise.
+ * include/ext/rc_string_base.h: Likewise.
+ * include/ext/sso_string_base.h: Likewise.
+ * src/Makefile.am (w?string-inst): Build with -std=gnu++0x.
+ * src/Makefile.in: Likewise.
+ * config/abi/pre/gnu.ver: Add new w?string exports.
+ * testsuite/21_strings/basic_string/init-list.cc: New test.
+ * testsuite/23_containers/vector/init-list.cc: New test.
+ * testsuite/23_containers/deque/init-list.cc: New test.
+ * testsuite/23_containers/list/init-list.cc: New test.
+ * testsuite/23_containers/map/init-list.cc: New test.
+ * testsuite/23_containers/multimap/init-list.cc: New test.
+ * testsuite/23_containers/set/init-list.cc: New test.
+ * testsuite/23_containers/multiset/init-list.cc: New test.
+ * testsuite/23_containers/unordered_map/init-list.cc: New test.
+ * testsuite/23_containers/unordered_multimap/init-list.cc: New test.
+ * testsuite/23_containers/unordered_set/init-list.cc: New test.
+ * testsuite/23_containers/unordered_multiset/init-list.cc: New test.
+ * testsuite/26_numerics/valarray/init-list.cc: New test.
+ * testsuite/28_regex/init-list.cc: New test.
+ * testsuite/ext/vstring/init-list.cc: New test.
+ * testsuite/23_containers/vector/requirements/dr438/assign_neg.cc:
+ Update error lineno.
+ * testsuite/23_containers/vector/requirements/dr438/insert_neg.cc:
+ Update error lineno.
+ * testsuite/23_containers/vector/requirements/dr438/
+ constructor_1_neg.cc: Update error lineno.
+ * testsuite/23_containers/vector/requirements/dr438/
+ constructor_2_neg.cc: Update error lineno.
+ * testsuite/23_containers/deque/requirements/dr438/assign_neg.cc:
+ Update error lineno.
+ * testsuite/23_containers/deque/requirements/dr438/insert_neg.cc:
+ Update error lineno.
+ * testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc:
+ Update error lineno.
+ * testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc:
+ Update error lineno.
+ * testsuite/23_containers/list/requirements/dr438/assign_neg.cc:
+ Update error lineno.
+ * testsuite/23_containers/list/requirements/dr438/insert_neg.cc:
+ Update error lineno.
+ * testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc:
+ Update error lineno.
+ * testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc:
+ Update error lineno.
+
+2008-07-21 Mark Mitchell <mark@codesourcery.com>
+
+ * config/os/gnu-linux/arm-eabi-extra.ver: New file.
+ * configure.host: Use it for arm*-*-linux-*eabi.
+
+2008-07-19 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/ext/pb_ds/detail/binomial_heap_base_/debug_fn_imps.hpp
+ (assert_node_consistent): Avoid ambiguous else warning.
+
+ * include/ext/pb_ds/detail/debug_map_base.hpp: Include <iostream>.
+
+ * include/bits/c++config: In debug-mode (and parallel-mode) set
+ _GLIBCXX_EXTERN_TEMPLATE to -1, not 0, thus disabling extern
+ templates only for basic_string (per libstdc++/21674).
+ * include/bits/basic_string.tcc: Use extern templates when
+ _GLIBCXX_EXTERN_TEMPLATE > 0.
+
+2008-07-18 Kris Van Hees <kris.van.hees@oracle.com>
+ Holger Hopp <holger.hopp@sap.com>
+
+ * config/abi/pre/gnu.ver: Support char16_t and char32_t.
+ * testsuite/util/testsuite_abi.cc (check_version): Add
+ CXXABI_1.3.3 to known_versions.
+
+2008-07-16 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/debug/vector (insert(iterator, _Tp&&), push_back(_Tp&&)):
+ Enable only when _Tp != bool.
+
+ * testsuite/25_algorithms/heap/1.cc: Avoid unused variable warnings.
+
+2008-07-18 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * testsuite/lib/libstdc++.exp (check_v3_target_c_std): Avoid unused
+ variable warnings leading to spurious fails of the test.
+
+2008-07-16 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * testsuite/30_threads/recursive_mutex/cons/assign_neg.cc: Adjust
+ dg-error lines.
+ * testsuite/30_threads/recursive_mutex/cons/copy_neg.cc: Likewise.
+ * testsuite/20_util/duration/cons/1_neg.cc: Likewise.
+
+ * include/tr1_impl/type_traits: Fix comment typo.
+
+2008-07-16 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/bits/unique_ptr.h: Remove stray character.
+
+2008-07-15 Benjamin Kosnik <bkoz@redhat.com>
+
+ * doc/doxygen/user.cfg.in: Add complex, ratio,
+ intializer_list.
+ (PREDEFINED): Add _GLIBCXX_USE_C99_STDINT_TR1.
+ * doc/doxygen/doxygroups.cc: Add std::chrono.
+ * include/bits/unique_ptr.h (default_delete, unique_ptr): Add markup.
+ * libsupc++/initializer_list (initializer_list): Same.
+ * include/std/ratio: Same.
+ * include/std/chrono: Same.
+ * include/std/complex: Disambiguate file markup.
+
+2008-07-15 Chris Fairles <chris.fairles@gmail.com>
+
+ * include/std/chrono: New, as per N2661.
+ * src/chrono.cc: New.
+ * include/Makefile.am: Update.
+ * src/Makefile.am: Likewise.
+ * include/Makefile.in: Regenerate.
+ * src/Makefile.in: Likewise.
+ * acinclude.m4: Add tests for clock_gettime and gettimeofday that
+ define _GLIBCXX_HAS_CLOCK_GETTIME and/or _GLIBCXX_HAS_GETTIMEOFDAY.
+ * configure.ac: Use them.
+ * configure: Regenerate.
+ * config.h.in: Likewise.
+ * config/abi/pre/gnu.ver: Add symbols for system_clock::now() and
+ system_clock::is_monotonic.
+ * testsuite/20_util/duration/cons/1.cc: New.
+ * testsuite/20_util/duration/cons/2.cc: Likewise.
+ * testsuite/20_util/duration/cons/1_neg.cc: Likewise.
+ * testsuite/20_util/duration/requirements/explicit_instantiation/
+ explicit_instantiation.cc: Likewise.
+ * testsuite/20_util/duration/arithmetic/1.cc: Likewise.
+ * testsuite/20_util/duration/arithmetic/2.cc: Likewise.
+ * testsuite/20_util/duration/comparisons/1.cc: Likewise.
+ * testsuite/20_util/time_point/requirements/explicit_instantiation/
+ explicit_instantiation.cc: Likewise.
+ * testsuite/20_util/time_point/1.cc: Likewise.
+ * testsuite/20_util/time_point/2.cc: Likewise.
+ * testsuite/20_util/time_point/3.cc: Likewise.
+ * testsuite/20_util/clocks/1.cc: Likewise.
+ * testsuite/17_intro/headers/c++200x/all_multiple_inclusion.cc: Add
+ missing headers.
+ * testsuite/17_intro/headers/c++200x/all.cc: Likewise.
+ * include/precompiled/stdc++.h: Likewise and remove <date_time>.
+ * doc/doxygen/user.cfg.in: Likewise.
+
2008-07-15 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/36832
@@ -46,7 +514,7 @@
PR libstdc++/36451
* doc/xml/manual/allocator.xml: Fix links.
* doc/html/*: Regenerate.
-
+
2008-07-09 Joseph Myers <joseph@codesourcery.com>
* libsupc++/unwind-cxx.h (__is_gxx_forced_unwind_class,
@@ -62,7 +530,7 @@
PR libstdc++/36552
* include/ext/pb_ds/detail/left_child_next_sibling_heap_/
null_metadata.hpp: Remove self-include.
-
+
2008-07-09 Joseph Myers <joseph@codesourcery.com>
* testsuite/20_util/make_signed/requirements/typedefs-2.cc,
diff --git a/libstdc++-v3/Makefile.in b/libstdc++-v3/Makefile.in
index 6a272b975e9..ab6de5b70cb 100644
--- a/libstdc++-v3/Makefile.in
+++ b/libstdc++-v3/Makefile.in
@@ -180,6 +180,7 @@ GLIBCXX_HOSTED_TRUE = @GLIBCXX_HOSTED_TRUE@
GLIBCXX_INCLUDES = @GLIBCXX_INCLUDES@
GLIBCXX_LDBL_COMPAT_FALSE = @GLIBCXX_LDBL_COMPAT_FALSE@
GLIBCXX_LDBL_COMPAT_TRUE = @GLIBCXX_LDBL_COMPAT_TRUE@
+GLIBCXX_LIBS = @GLIBCXX_LIBS@
GREP = @GREP@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index 6d2f4c0c691..42a1c4986ce 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -466,8 +466,13 @@ AC_DEFUN([GLIBCXX_CHECK_WRITEV], [
dnl
dnl Check whether int64_t is available in <stdint.h>, and define HAVE_INT64_T.
+dnl Also check whether int64_t is actually a typedef to long or long long.
dnl
AC_DEFUN([GLIBCXX_CHECK_INT64_T], [
+
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+
AC_MSG_CHECKING([for int64_t])
AC_CACHE_VAL(glibcxx_cv_INT64_T, [
AC_TRY_COMPILE(
@@ -476,10 +481,43 @@ AC_DEFUN([GLIBCXX_CHECK_INT64_T], [
[glibcxx_cv_INT64_T=yes],
[glibcxx_cv_INT64_T=no])
])
+
if test $glibcxx_cv_INT64_T = yes; then
AC_DEFINE(HAVE_INT64_T, 1, [Define if int64_t is available in <stdint.h>.])
+ AC_MSG_RESULT($glibcxx_cv_INT64_T)
+
+ AC_MSG_CHECKING([for int64_t as long])
+ AC_CACHE_VAL(glibcxx_cv_int64_t_long, [
+ AC_TRY_COMPILE(
+ [#include <stdint.h>
+ template<typename, typename> struct same { enum { value = -1 }; };
+ template<typename Tp> struct same<Tp, Tp> { enum { value = 1 }; };
+ int array[same<int64_t, long>::value];], [],
+ [glibcxx_cv_int64_t_long=yes], [glibcxx_cv_int64_t_long=no])
+ ])
+
+ if test $glibcxx_cv_int64_t_long = yes; then
+ AC_DEFINE(HAVE_INT64_T_LONG, 1, [Define if int64_t is a long.])
+ AC_MSG_RESULT($glibcxx_cv_int64_t_long)
+ fi
+
+ AC_MSG_CHECKING([for int64_t as long long])
+ AC_CACHE_VAL(glibcxx_cv_int64_t_long_long, [
+ AC_TRY_COMPILE(
+ [#include <stdint.h>
+ template<typename, typename> struct same { enum { value = -1 }; };
+ template<typename Tp> struct same<Tp, Tp> { enum { value = 1 }; };
+ int array[same<int64_t, long long>::value];], [],
+ [glibcxx_cv_int64_t_long_long=yes], [glibcxx_cv_int64_t_long_long=no])
+ ])
+
+ if test $glibcxx_cv_int64_t_long_long = yes; then
+ AC_DEFINE(HAVE_INT64_T_LONG_LONG, 1, [Define if int64_t is a long long.])
+ AC_MSG_RESULT($glibcxx_cv_int64_t_long_long)
+ fi
fi
- AC_MSG_RESULT($glibcxx_cv_INT64_T)
+
+ AC_LANG_RESTORE
])
@@ -1011,6 +1049,105 @@ AC_DEFUN([GLIBCXX_ENABLE_C99], [
dnl
+dnl Check for IEEE Std 1003.1-2001 clock_gettime required for
+dnl 20.8.5 [time.clock] in the current C++0X working draft.
+dnl
+AC_DEFUN([GLIBCXX_CHECK_CLOCK_GETTIME], [
+
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ ac_save_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS="$CXXFLAGS -fno-exceptions"
+ ac_save_LIBS="$LIBS"
+
+ AC_SEARCH_LIBS(clock_gettime, [posix4])
+
+ # Link to -lposix4.
+ case "$ac_cv_search_clock_gettime" in
+ -lposix4*) GLIBCXX_LIBS=$ac_cv_search_clock_gettime
+ esac
+
+ AC_CHECK_HEADERS(unistd.h, ac_has_unistd_h=yes, ac_has_unistd_h=no)
+
+ ac_has_clock_monotonic=no;
+ ac_has_clock_realtime=no;
+ if test x"$ac_has_unistd_h" = x"yes"; then
+ AC_MSG_CHECKING([for monotonic clock])
+ AC_TRY_LINK(
+ [#include <unistd.h>
+ #include <time.h>
+ ],
+ [#if _POSIX_TIMERS > 0 && defined(_POSIX_MONOTONIC_CLOCK)
+ timespec tp;
+ #endif
+ clock_gettime(CLOCK_MONOTONIC, &tp);
+ ], [ac_has_clock_monotonic=yes], [ac_has_clock_monotonic=no])
+
+ AC_MSG_RESULT($ac_has_clock_monotonic)
+
+ AC_MSG_CHECKING([for realtime clock])
+ AC_TRY_LINK(
+ [#include <unistd.h>
+ #include <time.h>
+ ],
+ [#if _POSIX_TIMERS > 0
+ timespec tp;
+ #endif
+ clock_gettime(CLOCK_REALTIME, &tp);
+ ], [ac_has_clock_realtime=yes], [ac_has_clock_realtime=no])
+
+ AC_MSG_RESULT($ac_has_clock_realtime)
+ fi
+
+ if test x"$ac_has_clock_monotonic" = x"yes"; then
+ AC_DEFINE(_GLIBCXX_USE_CLOCK_MONOTONIC, 1,
+ [ Defined if clock_gettime has monotonic clock support. ])
+ fi
+
+ if test x"$ac_has_clock_realtime" = x"yes"; then
+ AC_DEFINE(_GLIBCXX_USE_CLOCK_REALTIME, 1,
+ [ Defined if clock_gettime has realtime clock support. ])
+ fi
+
+ AC_SUBST(GLIBCXX_LIBS)
+
+ CXXFLAGS="$ac_save_CXXFLAGS"
+ LIBS="$ac_save_LIBS"
+ AC_LANG_RESTORE
+])
+
+dnl
+dnl Check for IEEE Std 1003.1-2001 gettimeofday required for
+dnl 20.8.5 [time.clock] in the current C++0X working draft.
+dnl
+AC_DEFUN([GLIBCXX_CHECK_GETTIMEOFDAY], [
+
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ ac_save_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS="$CXXFLAGS -fno-exceptions"
+
+ ac_has_gettimeofday=no;
+ AC_CHECK_HEADERS(sys/time.h, ac_has_sys_time_h=yes, ac_has_sys_time_h=no)
+ if test x"$ac_has_sys_time_h" = x"yes"; then
+ AC_MSG_CHECKING([for gettimeofday])
+ AC_TRY_LINK([#include <sys/time.h>],
+ [timeval tv; gettimeofday(&tv, 0);],
+ [ac_has_gettimeofday=yes], [ac_has_gettimeofday=no])
+
+ AC_MSG_RESULT($ac_has_gettimeofday)
+ fi
+
+ if test x"$ac_has_gettimeofday" = x"yes"; then
+ AC_DEFINE(_GLIBCXX_USE_GETTIMEOFDAY, 1,
+ [ Defined if gettimeofday is available. ])
+ fi
+
+ CXXFLAGS="$ac_save_CXXFLAGS"
+ AC_LANG_RESTORE
+])
+
+dnl
dnl Check for ISO/IEC 9899:1999 "C99" support to ISO/IEC DTR 19768 "TR1"
dnl facilities in Chapter 8, "C compatibility".
dnl
@@ -1069,7 +1206,8 @@ AC_DEFUN([GLIBCXX_CHECK_C99_TR1], [
[int ch;
int ret;
ret = isblank(ch);
- ],[glibcxx_cv_c99_ctype_tr1=yes], [glibcxx_cv_c99_ctype_tr1=no])
+ ],[glibcxx_cv_c99_ctype_tr1=yes],
+ [glibcxx_cv_c99_ctype_tr1=no])
])
AC_MSG_RESULT($glibcxx_cv_c99_ctype_tr1)
if test x"$glibcxx_cv_c99_ctype_tr1" = x"yes"; then
@@ -1140,7 +1278,8 @@ AC_DEFUN([GLIBCXX_CHECK_C99_TR1], [
typedef uint_least64_t my_uint_least64_t;
typedef uintmax_t my_uintmax_t;
typedef uintptr_t my_uintptr_t;
- ],[glibcxx_cv_c99_stdint_tr1=yes], [glibcxx_cv_c99_stdint_tr1=no])
+ ],[glibcxx_cv_c99_stdint_tr1=yes],
+ [glibcxx_cv_c99_stdint_tr1=no])
])
AC_MSG_RESULT($glibcxx_cv_c99_stdint_tr1)
if test x"$glibcxx_cv_c99_stdint_tr1" = x"yes"; then
@@ -1326,6 +1465,29 @@ AC_DEFUN([GLIBCXX_CHECK_RANDOM_TR1], [
])
dnl
+dnl Check whether EOF, SEEK_CUR, and SEEK_END have the most common values:
+dnl in that case including <cstdio> in some C++ headers can be avoided.
+dnl
+AC_DEFUN([GLIBCXX_CHECK_STDIO_MACROS], [
+
+ AC_MSG_CHECKING([for EOF == -1, SEEK_CUR == 1, SEEK_END == 2])
+ AC_CACHE_VAL(glibcxx_cv_stdio_macros, [
+ AC_TRY_COMPILE([#include <stdio.h>],
+ [#if ((EOF != -1) || (SEEK_CUR != 1) || (SEEK_END != 2))
+ unusual values...
+ #endif
+ ], [glibcxx_cv_stdio_macros=yes],
+ [glibcxx_cv_stdio_macros=no])
+ ])
+ AC_MSG_RESULT($glibcxx_cv_stdio_macros)
+ if test x"$glibcxx_cv_stdio_macros" = x"yes"; then
+ AC_DEFINE(_GLIBCXX_STDIO_MACROS, 1,
+ [Define if EOF == -1, SEEK_CUR == 1, SEEK_END == 2.])
+ fi
+
+])
+
+dnl
dnl Check whether macros, etc are present for <system_error>
dnl
AC_DEFUN([GLIBCXX_CHECK_SYSTEM_ERROR], [
diff --git a/libstdc++-v3/config.h.in b/libstdc++-v3/config.h.in
index d107f481be7..20f298df6d7 100644
--- a/libstdc++-v3/config.h.in
+++ b/libstdc++-v3/config.h.in
@@ -159,9 +159,6 @@
/* Define if _Unwind_GetIPInfo is available. */
#undef HAVE_GETIPINFO
-/* Define to 1 if you have the `getpagesize' function. */
-#undef HAVE_GETPAGESIZE
-
/* Define if gthr-default.h exists (meaning that threading support is
enabled). */
#undef HAVE_GTHR_DEFAULT
@@ -184,6 +181,12 @@
/* Define if int64_t is available in <stdint.h>. */
#undef HAVE_INT64_T
+/* Define if int64_t is a long. */
+#undef HAVE_INT64_T_LONG
+
+/* Define if int64_t is a long long. */
+#undef HAVE_INT64_T_LONG_LONG
+
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
@@ -268,9 +271,6 @@
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
-/* Define to 1 if you have a working `mmap' system call. */
-#undef HAVE_MMAP
-
/* Define to 1 if you have the `modf' function. */
#undef HAVE_MODF
@@ -298,9 +298,6 @@
/* Define to 1 if you have the `setenv' function. */
#undef HAVE_SETENV
-/* Define if sigsetjmp is available. */
-#undef HAVE_SIGSETJMP
-
/* Define to 1 if you have the `sincos' function. */
#undef HAVE_SINCOS
@@ -761,6 +758,9 @@
/* Define if the compiler is configured for setjmp/longjmp exceptions. */
#undef _GLIBCXX_SJLJ_EXCEPTIONS
+/* Define if EOF == -1, SEEK_CUR == 1, SEEK_END == 2. */
+#undef _GLIBCXX_STDIO_MACROS
+
/* Define to use symbol versioning in the shared library. */
#undef _GLIBCXX_SYMVER
@@ -811,6 +811,15 @@
namespace std::tr1. */
#undef _GLIBCXX_USE_C99_STDINT_TR1
+/* Defined if clock_gettime has monotonic clock support. */
+#undef _GLIBCXX_USE_CLOCK_MONOTONIC
+
+/* Defined if clock_gettime has realtime clock support. */
+#undef _GLIBCXX_USE_CLOCK_REALTIME
+
+/* Defined if gettimeofday is available. */
+#undef _GLIBCXX_USE_GETTIMEOFDAY
+
/* Define if LFS support is available. */
#undef _GLIBCXX_USE_LFS
diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver
index 8327d10511f..0ec4879ffd4 100644
--- a/libstdc++-v3/config/abi/pre/gnu.ver
+++ b/libstdc++-v3/config/abi/pre/gnu.ver
@@ -66,7 +66,9 @@ GLIBCXX_3.4 {
# std::condition_variable;
std::co[^n]*;
std::c[p-s]*;
- std::c[u-z]*;
+ std::cu[^r]*;
+# std::current_exception
+ std::c[v-z]*;
# std::[d-g]*;
std::d[a-d]*;
std::d[f-z]*;
@@ -112,10 +114,13 @@ GLIBCXX_3.4 {
std::n[^au]*;
std::nu[^m]*;
std::num[^e]*;
- std::[p-r]*;
std::ostrstream*;
std::out_of_range*;
std::overflow_error*;
+ std::[p-q]*;
+ std::r[^e]*;
+ std::re[^t]*;
+# std::rethrow_exception
std::set_new_handler*;
std::set_terminate*;
std::set_unexpected*;
@@ -147,9 +152,12 @@ GLIBCXX_3.4 {
# Names not in an 'extern' block are mangled names.
# std::string
- _ZNSsC*;
+ _ZNSsC[12][EI][PRjmvN]*;
_ZNSsD*;
- _ZNSs[0-9][a-z]*;
+ _ZNSs[0-58-9][a-z]*;
+ _ZNSs[67][a-z]*E[PRcjmv]*;
+ _ZNSs7[a-z]*EES2_[NPRjm]*;
+ _ZNSs7[a-z]*EES2_S[12]*;
_ZNSs12_Alloc_hiderC*;
_ZNSs12_M_leak_hardEv;
_ZNSs12_S_constructE[jm]cRKSaIcE;
@@ -172,9 +180,9 @@ GLIBCXX_3.4 {
_ZNSs4_Rep20_S_empty_rep_storageE;
_ZNSs4_Rep11_S_max_sizeE;
_ZNSs4_Rep11_S_terminalE;
- _ZNSsaSE*;
+ _ZNSsaSE[PRc]*;
_ZNSsixE*;
- _ZNSspLE*;
+ _ZNSspLE[PRc]*;
_ZNKSs[0-9][a-z]*;
_ZNKSs[0-9][0-9][a-z]*;
_ZNKSs[a-z]*;
@@ -189,9 +197,12 @@ GLIBCXX_3.4 {
_ZStplIcSt11char_traitsIcESaIcEESbIT_T0_T1_E*;
# std::wstring
- _ZNSbIwSt11char_traitsIwESaIwEEC*;
+ _ZNSbIwSt11char_traitsIwESaIwEEC[12][EI][PRjmvN]*;
_ZNSbIwSt11char_traitsIwESaIwEED*;
- _ZNSbIwSt11char_traitsIwESaIwEE[0-9][a-z]*;
+ _ZNSbIwSt11char_traitsIwESaIwEE[0-58-9][a-z]*;
+ _ZNSbIwSt11char_traitsIwESaIwEE[67][a-z]*E[PRwjmv]*;
+ _ZNSbIwSt11char_traitsIwESaIwEE7[a-z]*EES6_[NPRjm]*;
+ _ZNSbIwSt11char_traitsIwESaIwEE7[a-z]*EES6_S[56]*;
_ZNSbIwSt11char_traitsIwESaIwEE12_Alloc_hiderC*;
_ZNSbIwSt11char_traitsIwESaIwEE12_M_leak_hardEv;
_ZNSbIwSt11char_traitsIwESaIwEE12_S_constructE[jm]wRKS1_;
@@ -214,9 +225,9 @@ GLIBCXX_3.4 {
_ZNSbIwSt11char_traitsIwESaIwEE4_Rep20_S_empty_rep_storageE;
_ZNSbIwSt11char_traitsIwESaIwEE4_Rep11_S_max_sizeE;
_ZNSbIwSt11char_traitsIwESaIwEE4_Rep11_S_terminalE;
- _ZNSbIwSt11char_traitsIwESaIwEEaSE*;
+ _ZNSbIwSt11char_traitsIwESaIwEEaSE[PRw]*;
_ZNSbIwSt11char_traitsIwESaIwEEixE*;
- _ZNSbIwSt11char_traitsIwESaIwEEpLE*;
+ _ZNSbIwSt11char_traitsIwESaIwEEpLE[PRw]*;
_ZNKSbIwSt11char_traitsIwESaIwEE[0-9][a-z]*;
_ZNKSbIwSt11char_traitsIwESaIwEE[0-9][0-9][a-z]*;
_ZNKSbIwSt11char_traitsIwESaIwEE[a-z]*;
@@ -885,6 +896,28 @@ GLIBCXX_3.4.11 {
# char16_t and char32_t
_ZNSt14numeric_limitsIu8char*;
+ # chrono
+ _ZNSt6chrono12system_clock12is_monotonicE;
+ _ZNSt6chrono12system_clock3nowEv;
+
+ # string/wstring initializer_list overloads
+ _ZNSs6appendESt16initializer_listIcE;
+ _ZNSs6assignESt16initializer_listIcE;
+ _ZNSs6insertEN9__gnu_cxx17__normal_iteratorIPcSsEESt16initializer_listIcE;
+ _ZNSs7replaceEN9__gnu_cxx17__normal_iteratorIPcSsEES2_St16initializer_listIcE;
+ _ZNSsC1ESt16initializer_listIcERKSaIcE;
+ _ZNSsC2ESt16initializer_listIcERKSaIcE;
+ _ZNSsaSESt16initializer_listIcE;
+ _ZNSspLESt16initializer_listIcE;
+ _ZNSbIwSt11char_traitsIwESaIwEE6appendESt16initializer_listIwE;
+ _ZNSbIwSt11char_traitsIwESaIwEE6assignESt16initializer_listIwE;
+ _ZNSbIwSt11char_traitsIwESaIwEE6insertEN9__gnu_cxx17__normal_iteratorIPwS2_EESt16initializer_listIwE;
+ _ZNSbIwSt11char_traitsIwESaIwEE7replaceEN9__gnu_cxx17__normal_iteratorIPwS2_EES6_St16initializer_listIwE;
+ _ZNSbIwSt11char_traitsIwESaIwEEC1ESt16initializer_listIwERKS1_;
+ _ZNSbIwSt11char_traitsIwESaIwEEC2ESt16initializer_listIwERKS1_;
+ _ZNSbIwSt11char_traitsIwESaIwEEaSESt16initializer_listIwE;
+ _ZNSbIwSt11char_traitsIwESaIwEEpLESt16initializer_listIwE;
+
} GLIBCXX_3.4.10;
# Symbols in the support library (libsupc++) have their own tag.
@@ -1008,3 +1041,35 @@ CXXABI_1.3.2 {
_ZTIN10__cxxabiv119__foreign_exceptionE;
} CXXABI_1.3.1;
+
+CXXABI_1.3.3 {
+
+ # typeinfo for char16_t and char32_t
+ _ZTIu8char16_t;
+ _ZTIPu8char16_t;
+ _ZTIPKu8char16_t;
+ _ZTIu8char32_t;
+ _ZTIPu8char32_t;
+ _ZTIPKu8char32_t;
+
+ # exception_ptr
+ _ZNSt15__exception_ptr13exception_ptrC1Ev;
+ _ZNSt15__exception_ptr13exception_ptrC2Ev;
+ _ZNSt15__exception_ptr13exception_ptrC1ERKS0_;
+ _ZNSt15__exception_ptr13exception_ptrC2ERKS0_;
+ _ZNSt15__exception_ptr13exception_ptrC1EMS0_FvvE;
+ _ZNSt15__exception_ptr13exception_ptrC2EMS0_FvvE;
+ _ZNSt15__exception_ptr13exception_ptrD1Ev;
+ _ZNSt15__exception_ptr13exception_ptrD2Ev;
+ _ZNSt15__exception_ptr13exception_ptraSERKS0_;
+ _ZNKSt15__exception_ptr13exception_ptrcvMS0_FvvEEv;
+ _ZNKSt15__exception_ptr13exception_ptrntEv;
+ _ZNKSt15__exception_ptr13exception_ptr20__cxa_exception_typeEv;
+ _ZNSt15__exception_ptr13exception_ptr4swapERS0_;
+ _ZNSt15__exception_ptreqERKNS_13exception_ptrES2_;
+ _ZNSt15__exception_ptrneERKNS_13exception_ptrES2_;
+
+ _ZSt17current_exceptionv;
+ _ZSt17rethrow_exceptionNSt15__exception_ptr13exception_ptrE;
+
+} CXXABI_1.3.2;
diff --git a/libstdc++-v3/config/locale/darwin/ctype_members.cc b/libstdc++-v3/config/locale/darwin/ctype_members.cc
index ebd83219af3..63a422c396a 100644
--- a/libstdc++-v3/config/locale/darwin/ctype_members.cc
+++ b/libstdc++-v3/config/locale/darwin/ctype_members.cc
@@ -1,6 +1,6 @@
// std::ctype implementation details, GNU version -*- C++ -*-
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -38,6 +38,7 @@
#include <bits/c++locale_internal.h>
#include <cstdlib>
#include <cstring>
+#include <cstdio>
namespace std
{
diff --git a/libstdc++-v3/config/locale/generic/c_locale.cc b/libstdc++-v3/config/locale/generic/c_locale.cc
index 80cef2d8818..47c2b4e1a0a 100644
--- a/libstdc++-v3/config/locale/generic/c_locale.cc
+++ b/libstdc++-v3/config/locale/generic/c_locale.cc
@@ -1,6 +1,6 @@
// Wrapper for underlying C-language localization -*- C++ -*-
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -38,6 +38,7 @@
#include <cmath> // For isinf, finite, finitef, fabs
#include <cstdlib> // For strof, strtold
#include <cstring>
+#include <cstdio>
#include <locale>
#include <limits>
#include <cstddef>
diff --git a/libstdc++-v3/config/locale/generic/ctype_members.cc b/libstdc++-v3/config/locale/generic/ctype_members.cc
index ae1c7cf1d0f..6b4fbd7ea7d 100644
--- a/libstdc++-v3/config/locale/generic/ctype_members.cc
+++ b/libstdc++-v3/config/locale/generic/ctype_members.cc
@@ -1,6 +1,6 @@
// std::ctype implementation details, generic version -*- C++ -*-
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -37,6 +37,7 @@
#include <locale>
#include <cstdlib>
#include <cstring>
+#include <cstdio>
_GLIBCXX_BEGIN_NAMESPACE(std)
diff --git a/libstdc++-v3/config/locale/gnu/ctype_members.cc b/libstdc++-v3/config/locale/gnu/ctype_members.cc
index 3aec312f89b..9e517605914 100644
--- a/libstdc++-v3/config/locale/gnu/ctype_members.cc
+++ b/libstdc++-v3/config/locale/gnu/ctype_members.cc
@@ -1,6 +1,6 @@
// std::ctype implementation details, GNU version -*- C++ -*-
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -35,6 +35,7 @@
// Written by Benjamin Kosnik <bkoz@redhat.com>
#include <locale>
+#include <cstdio>
#include <bits/c++locale_internal.h>
_GLIBCXX_BEGIN_NAMESPACE(std)
diff --git a/libstdc++-v3/config/os/gnu-linux/arm-eabi-extra.ver b/libstdc++-v3/config/os/gnu-linux/arm-eabi-extra.ver
new file mode 100644
index 00000000000..5c7dc19e6e0
--- /dev/null
+++ b/libstdc++-v3/config/os/gnu-linux/arm-eabi-extra.ver
@@ -0,0 +1,18 @@
+# Appended to version file.
+
+CXXABI_ARM_1.3.3 {
+ # ARM ABI helper functions provided in libsupc++.
+ __aeabi_atexit;
+ __aeabi_vec_ctor_nocookie_nodtor;
+ __aeabi_vec_ctor_cookie_nodtor;
+ __aeabi_vec_cctor_nocookie_nodtor;
+ __aeabi_vec_new_cookie_noctor;
+ __aeabi_vec_new_nocookie;
+ __aeabi_vec_new_cookie_nodtor;
+ __aeabi_vec_new_cookie;
+ __aeabi_vec_dtor;
+ __aeabi_vec_dtor_cookie;
+ __aeabi_vec_delete;
+ __aeabi_vec_delete3;
+ __aeabi_vec_delete3_nodtor;
+};
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index fb1bacb1481..d7046be8c71 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -458,7 +458,7 @@ ac_includes_default="\
# include <unistd.h>
#endif"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS libtool_VERSION multi_basedir build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar glibcxx_builddir glibcxx_srcdir toplevel_srcdir CC ac_ct_CC EXEEXT OBJEXT CXX ac_ct_CXX CFLAGS CXXFLAGS LN_S AS ac_ct_AS AR ac_ct_AR RANLIB ac_ct_RANLIB MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CPP CPPFLAGS EGREP LIBTOOL SED FGREP GREP LD DUMPBIN ac_ct_DUMPBIN NM lt_ECHO LDFLAGS CXXCPP enable_shared enable_static GLIBCXX_HOSTED_TRUE GLIBCXX_HOSTED_FALSE GLIBCXX_BUILD_PCH_TRUE GLIBCXX_BUILD_PCH_FALSE glibcxx_PCHFLAGS glibcxx_thread_h WERROR SECTION_FLAGS CSTDIO_H BASIC_FILE_H BASIC_FILE_CC check_msgfmt glibcxx_MOFILES glibcxx_POFILES glibcxx_localedir USE_NLS CLOCALE_H CMESSAGES_H CCODECVT_CC CCOLLATE_CC CCTYPE_CC CMESSAGES_CC CMONEY_CC CNUMERIC_CC CTIME_H CTIME_CC CLOCALE_CC CLOCALE_INTERNAL_H ALLOCATOR_H ALLOCATOR_NAME C_INCLUDE_DIR GLIBCXX_C_HEADERS_C_TRUE GLIBCXX_C_HEADERS_C_FALSE GLIBCXX_C_HEADERS_C_STD_TRUE GLIBCXX_C_HEADERS_C_STD_FALSE GLIBCXX_C_HEADERS_C_GLOBAL_TRUE GLIBCXX_C_HEADERS_C_GLOBAL_FALSE GLIBCXX_C_HEADERS_COMPATIBILITY_TRUE GLIBCXX_C_HEADERS_COMPATIBILITY_FALSE GLIBCXX_C_HEADERS_EXTRA_TRUE GLIBCXX_C_HEADERS_EXTRA_FALSE DEBUG_FLAGS GLIBCXX_BUILD_DEBUG_TRUE GLIBCXX_BUILD_DEBUG_FALSE ENABLE_PARALLEL_TRUE ENABLE_PARALLEL_FALSE EXTRA_CXX_FLAGS SECTION_LDFLAGS OPT_LDFLAGS LIBMATHOBJS LIBICONV LTLIBICONV SYMVER_FILE port_specific_symbol_files ENABLE_SYMVERS_TRUE ENABLE_SYMVERS_FALSE ENABLE_SYMVERS_GNU_TRUE ENABLE_SYMVERS_GNU_FALSE ENABLE_SYMVERS_GNU_NAMESPACE_TRUE ENABLE_SYMVERS_GNU_NAMESPACE_FALSE ENABLE_SYMVERS_DARWIN_TRUE ENABLE_SYMVERS_DARWIN_FALSE ENABLE_VISIBILITY_TRUE ENABLE_VISIBILITY_FALSE GLIBCXX_LDBL_COMPAT_TRUE GLIBCXX_LDBL_COMPAT_FALSE baseline_dir ATOMICITY_SRCDIR ATOMIC_WORD_SRCDIR ATOMIC_FLAGS CPU_DEFINES_SRCDIR ABI_TWEAKS_SRCDIR OS_INC_SRCDIR ERROR_CONSTANTS_SRCDIR glibcxx_prefixdir gxx_include_dir glibcxx_toolexecdir glibcxx_toolexeclibdir GLIBCXX_INCLUDES TOPLEVEL_INCLUDES OPTIMIZE_CXXFLAGS WARN_FLAGS LIBSUPCXX_PICFLAGS LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS libtool_VERSION multi_basedir build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar glibcxx_builddir glibcxx_srcdir toplevel_srcdir CC ac_ct_CC EXEEXT OBJEXT CXX ac_ct_CXX CFLAGS CXXFLAGS LN_S AS ac_ct_AS AR ac_ct_AR RANLIB ac_ct_RANLIB MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CPP CPPFLAGS EGREP LIBTOOL SED FGREP GREP LD DUMPBIN ac_ct_DUMPBIN NM lt_ECHO LDFLAGS CXXCPP enable_shared enable_static GLIBCXX_HOSTED_TRUE GLIBCXX_HOSTED_FALSE GLIBCXX_BUILD_PCH_TRUE GLIBCXX_BUILD_PCH_FALSE glibcxx_PCHFLAGS glibcxx_thread_h WERROR SECTION_FLAGS CSTDIO_H BASIC_FILE_H BASIC_FILE_CC check_msgfmt glibcxx_MOFILES glibcxx_POFILES glibcxx_localedir USE_NLS CLOCALE_H CMESSAGES_H CCODECVT_CC CCOLLATE_CC CCTYPE_CC CMESSAGES_CC CMONEY_CC CNUMERIC_CC CTIME_H CTIME_CC CLOCALE_CC CLOCALE_INTERNAL_H ALLOCATOR_H ALLOCATOR_NAME C_INCLUDE_DIR GLIBCXX_C_HEADERS_C_TRUE GLIBCXX_C_HEADERS_C_FALSE GLIBCXX_C_HEADERS_C_STD_TRUE GLIBCXX_C_HEADERS_C_STD_FALSE GLIBCXX_C_HEADERS_C_GLOBAL_TRUE GLIBCXX_C_HEADERS_C_GLOBAL_FALSE GLIBCXX_C_HEADERS_COMPATIBILITY_TRUE GLIBCXX_C_HEADERS_COMPATIBILITY_FALSE GLIBCXX_C_HEADERS_EXTRA_TRUE GLIBCXX_C_HEADERS_EXTRA_FALSE DEBUG_FLAGS GLIBCXX_BUILD_DEBUG_TRUE GLIBCXX_BUILD_DEBUG_FALSE ENABLE_PARALLEL_TRUE ENABLE_PARALLEL_FALSE EXTRA_CXX_FLAGS SECTION_LDFLAGS OPT_LDFLAGS LIBMATHOBJS GLIBCXX_LIBS LIBICONV LTLIBICONV SYMVER_FILE port_specific_symbol_files ENABLE_SYMVERS_TRUE ENABLE_SYMVERS_FALSE ENABLE_SYMVERS_GNU_TRUE ENABLE_SYMVERS_GNU_FALSE ENABLE_SYMVERS_GNU_NAMESPACE_TRUE ENABLE_SYMVERS_GNU_NAMESPACE_FALSE ENABLE_SYMVERS_DARWIN_TRUE ENABLE_SYMVERS_DARWIN_FALSE ENABLE_VISIBILITY_TRUE ENABLE_VISIBILITY_FALSE GLIBCXX_LDBL_COMPAT_TRUE GLIBCXX_LDBL_COMPAT_FALSE baseline_dir ATOMICITY_SRCDIR ATOMIC_WORD_SRCDIR ATOMIC_FLAGS CPU_DEFINES_SRCDIR ABI_TWEAKS_SRCDIR OS_INC_SRCDIR ERROR_CONSTANTS_SRCDIR glibcxx_prefixdir gxx_include_dir glibcxx_toolexecdir glibcxx_toolexeclibdir GLIBCXX_INCLUDES TOPLEVEL_INCLUDES OPTIMIZE_CXXFLAGS WARN_FLAGS LIBSUPCXX_PICFLAGS LIBOBJS LTLIBOBJS'
ac_subst_files=''
ac_pwd=`pwd`
@@ -18249,6 +18249,1341 @@ fi
+# For the streamoff typedef.
+
+
+
+
+ ac_ext=cc
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+
+ echo "$as_me:$LINENO: checking for int64_t" >&5
+echo $ECHO_N "checking for int64_t... $ECHO_C" >&6
+ if test "${glibcxx_cv_INT64_T+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdint.h>
+int
+main ()
+{
+int64_t var;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_cxx_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ glibcxx_cv_INT64_T=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+glibcxx_cv_INT64_T=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+
+
+ if test $glibcxx_cv_INT64_T = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_INT64_T 1
+_ACEOF
+
+ echo "$as_me:$LINENO: result: $glibcxx_cv_INT64_T" >&5
+echo "${ECHO_T}$glibcxx_cv_INT64_T" >&6
+
+ echo "$as_me:$LINENO: checking for int64_t as long" >&5
+echo $ECHO_N "checking for int64_t as long... $ECHO_C" >&6
+ if test "${glibcxx_cv_int64_t_long+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdint.h>
+ template<typename, typename> struct same { enum { value = -1 }; };
+ template<typename Tp> struct same<Tp, Tp> { enum { value = 1 }; };
+ int array[same<int64_t, long>::value];
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_cxx_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ glibcxx_cv_int64_t_long=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+glibcxx_cv_int64_t_long=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+
+
+ if test $glibcxx_cv_int64_t_long = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_INT64_T_LONG 1
+_ACEOF
+
+ echo "$as_me:$LINENO: result: $glibcxx_cv_int64_t_long" >&5
+echo "${ECHO_T}$glibcxx_cv_int64_t_long" >&6
+ fi
+
+ echo "$as_me:$LINENO: checking for int64_t as long long" >&5
+echo $ECHO_N "checking for int64_t as long long... $ECHO_C" >&6
+ if test "${glibcxx_cv_int64_t_long_long+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdint.h>
+ template<typename, typename> struct same { enum { value = -1 }; };
+ template<typename Tp> struct same<Tp, Tp> { enum { value = 1 }; };
+ int array[same<int64_t, long long>::value];
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_cxx_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ glibcxx_cv_int64_t_long_long=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+glibcxx_cv_int64_t_long_long=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+
+
+ if test $glibcxx_cv_int64_t_long_long = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_INT64_T_LONG_LONG 1
+_ACEOF
+
+ echo "$as_me:$LINENO: result: $glibcxx_cv_int64_t_long_long" >&5
+echo "${ECHO_T}$glibcxx_cv_int64_t_long_long" >&6
+ fi
+ fi
+
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+# For C99 support to TR1.
+
+
+
+
+ ac_ext=cc
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+
+ # Use -std=c++98 because the default (-std=gnu++98) leaves __STRICT_ANSI__
+ # undefined and fake C99 facilities may be spuriously enabled.
+ ac_save_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS="$CXXFLAGS -std=c++98"
+
+ # Check for the existence of <complex.h> complex math functions used
+ # by tr1/complex.
+
+for ac_header in complex.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_cxx_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_cxx_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## ----------------------------------------- ##
+## Report this to the package-unused lists. ##
+## ----------------------------------------- ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+ ac_has_complex_h=yes
+else
+ ac_has_complex_h=no
+fi
+
+done
+
+ ac_c99_complex_tr1=no;
+ if test x"$ac_has_complex_h" = x"yes"; then
+ echo "$as_me:$LINENO: checking for ISO C99 support to TR1 in <complex.h>" >&5
+echo $ECHO_N "checking for ISO C99 support to TR1 in <complex.h>... $ECHO_C" >&6
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <complex.h>
+int
+main ()
+{
+typedef __complex__ float float_type; float_type tmpf;
+ cacosf(tmpf);
+ casinf(tmpf);
+ catanf(tmpf);
+ cacoshf(tmpf);
+ casinhf(tmpf);
+ catanhf(tmpf);
+ typedef __complex__ double double_type; double_type tmpd;
+ cacos(tmpd);
+ casin(tmpd);
+ catan(tmpd);
+ cacosh(tmpd);
+ casinh(tmpd);
+ catanh(tmpd);
+ typedef __complex__ long double ld_type; ld_type tmpld;
+ cacosl(tmpld);
+ casinl(tmpld);
+ catanl(tmpld);
+ cacoshl(tmpld);
+ casinhl(tmpld);
+ catanhl(tmpld);
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_cxx_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_c99_complex_tr1=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_c99_complex_tr1=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ fi
+ echo "$as_me:$LINENO: result: $ac_c99_complex_tr1" >&5
+echo "${ECHO_T}$ac_c99_complex_tr1" >&6
+ if test x"$ac_c99_complex_tr1" = x"yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define _GLIBCXX_USE_C99_COMPLEX_TR1 1
+_ACEOF
+
+ fi
+
+ # Check for the existence of <ctype.h> functions.
+ echo "$as_me:$LINENO: checking for ISO C99 support to TR1 in <ctype.h>" >&5
+echo $ECHO_N "checking for ISO C99 support to TR1 in <ctype.h>... $ECHO_C" >&6
+ if test "${glibcxx_cv_c99_ctype_tr1+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ctype.h>
+int
+main ()
+{
+int ch;
+ int ret;
+ ret = isblank(ch);
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_cxx_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ glibcxx_cv_c99_ctype_tr1=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+glibcxx_cv_c99_ctype_tr1=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+
+ echo "$as_me:$LINENO: result: $glibcxx_cv_c99_ctype_tr1" >&5
+echo "${ECHO_T}$glibcxx_cv_c99_ctype_tr1" >&6
+ if test x"$glibcxx_cv_c99_ctype_tr1" = x"yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define _GLIBCXX_USE_C99_CTYPE_TR1 1
+_ACEOF
+
+ fi
+
+ # Check for the existence of <fenv.h> functions.
+
+for ac_header in fenv.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_cxx_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_cxx_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## ----------------------------------------- ##
+## Report this to the package-unused lists. ##
+## ----------------------------------------- ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+ ac_has_fenv_h=yes
+else
+ ac_has_fenv_h=no
+fi
+
+done
+
+ ac_c99_fenv_tr1=no;
+ if test x"$ac_has_fenv_h" = x"yes"; then
+ echo "$as_me:$LINENO: checking for ISO C99 support to TR1 in <fenv.h>" >&5
+echo $ECHO_N "checking for ISO C99 support to TR1 in <fenv.h>... $ECHO_C" >&6
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <fenv.h>
+int
+main ()
+{
+int except, mode;
+ fexcept_t* pflag;
+ fenv_t* penv;
+ int ret;
+ ret = feclearexcept(except);
+ ret = fegetexceptflag(pflag, except);
+ ret = feraiseexcept(except);
+ ret = fesetexceptflag(pflag, except);
+ ret = fetestexcept(except);
+ ret = fegetround();
+ ret = fesetround(mode);
+ ret = fegetenv(penv);
+ ret = feholdexcept(penv);
+ ret = fesetenv(penv);
+ ret = feupdateenv(penv);
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_cxx_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_c99_fenv_tr1=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_c99_fenv_tr1=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ fi
+ echo "$as_me:$LINENO: result: $ac_c99_fenv_tr1" >&5
+echo "${ECHO_T}$ac_c99_fenv_tr1" >&6
+ if test x"$ac_c99_fenv_tr1" = x"yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define _GLIBCXX_USE_C99_FENV_TR1 1
+_ACEOF
+
+ fi
+
+ # Check for the existence of <stdint.h> types.
+ echo "$as_me:$LINENO: checking for ISO C99 support to TR1 in <stdint.h>" >&5
+echo $ECHO_N "checking for ISO C99 support to TR1 in <stdint.h>... $ECHO_C" >&6
+ if test "${glibcxx_cv_c99_stdint_tr1+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdint.h>
+int
+main ()
+{
+typedef int8_t my_int8_t;
+ typedef int16_t my_int16_t;
+ typedef int32_t my_int32_t;
+ typedef int64_t my_int64_t;
+ typedef int_fast8_t my_int_fast8_t;
+ typedef int_fast16_t my_int_fast16_t;
+ typedef int_fast32_t my_int_fast32_t;
+ typedef int_fast64_t my_int_fast64_t;
+ typedef int_least8_t my_int_least8_t;
+ typedef int_least16_t my_int_least16_t;
+ typedef int_least32_t my_int_least32_t;
+ typedef int_least64_t my_int_least64_t;
+ typedef intmax_t my_intmax_t;
+ typedef intptr_t my_intptr_t;
+ typedef uint8_t my_uint8_t;
+ typedef uint16_t my_uint16_t;
+ typedef uint32_t my_uint32_t;
+ typedef uint64_t my_uint64_t;
+ typedef uint_fast8_t my_uint_fast8_t;
+ typedef uint_fast16_t my_uint_fast16_t;
+ typedef uint_fast32_t my_uint_fast32_t;
+ typedef uint_fast64_t my_uint_fast64_t;
+ typedef uint_least8_t my_uint_least8_t;
+ typedef uint_least16_t my_uint_least16_t;
+ typedef uint_least32_t my_uint_least32_t;
+ typedef uint_least64_t my_uint_least64_t;
+ typedef uintmax_t my_uintmax_t;
+ typedef uintptr_t my_uintptr_t;
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_cxx_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ glibcxx_cv_c99_stdint_tr1=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+glibcxx_cv_c99_stdint_tr1=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+
+ echo "$as_me:$LINENO: result: $glibcxx_cv_c99_stdint_tr1" >&5
+echo "${ECHO_T}$glibcxx_cv_c99_stdint_tr1" >&6
+ if test x"$glibcxx_cv_c99_stdint_tr1" = x"yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define _GLIBCXX_USE_C99_STDINT_TR1 1
+_ACEOF
+
+ fi
+
+ # Check for the existence of <math.h> functions.
+ echo "$as_me:$LINENO: checking for ISO C99 support to TR1 in <math.h>" >&5
+echo $ECHO_N "checking for ISO C99 support to TR1 in <math.h>... $ECHO_C" >&6
+ if test "${glibcxx_cv_c99_math_tr1+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <math.h>
+int
+main ()
+{
+typedef double_t my_double_t;
+ typedef float_t my_float_t;
+ acosh(0.0);
+ acoshf(0.0f);
+ acoshl(0.0l);
+ asinh(0.0);
+ asinhf(0.0f);
+ asinhl(0.0l);
+ atanh(0.0);
+ atanhf(0.0f);
+ atanhl(0.0l);
+ cbrt(0.0);
+ cbrtf(0.0f);
+ cbrtl(0.0l);
+ copysign(0.0, 0.0);
+ copysignf(0.0f, 0.0f);
+ copysignl(0.0l, 0.0l);
+ erf(0.0);
+ erff(0.0f);
+ erfl(0.0l);
+ erfc(0.0);
+ erfcf(0.0f);
+ erfcl(0.0l);
+ exp2(0.0);
+ exp2f(0.0f);
+ exp2l(0.0l);
+ expm1(0.0);
+ expm1f(0.0f);
+ expm1l(0.0l);
+ fdim(0.0, 0.0);
+ fdimf(0.0f, 0.0f);
+ fdiml(0.0l, 0.0l);
+ fma(0.0, 0.0, 0.0);
+ fmaf(0.0f, 0.0f, 0.0f);
+ fmal(0.0l, 0.0l, 0.0l);
+ fmax(0.0, 0.0);
+ fmaxf(0.0f, 0.0f);
+ fmaxl(0.0l, 0.0l);
+ fmin(0.0, 0.0);
+ fminf(0.0f, 0.0f);
+ fminl(0.0l, 0.0l);
+ hypot(0.0, 0.0);
+ hypotf(0.0f, 0.0f);
+ hypotl(0.0l, 0.0l);
+ ilogb(0.0);
+ ilogbf(0.0f);
+ ilogbl(0.0l);
+ lgamma(0.0);
+ lgammaf(0.0f);
+ lgammal(0.0l);
+ llrint(0.0);
+ llrintf(0.0f);
+ llrintl(0.0l);
+ llround(0.0);
+ llroundf(0.0f);
+ llroundl(0.0l);
+ log1p(0.0);
+ log1pf(0.0f);
+ log1pl(0.0l);
+ log2(0.0);
+ log2f(0.0f);
+ log2l(0.0l);
+ logb(0.0);
+ logbf(0.0f);
+ logbl(0.0l);
+ lrint(0.0);
+ lrintf(0.0f);
+ lrintl(0.0l);
+ lround(0.0);
+ lroundf(0.0f);
+ lroundl(0.0l);
+ nan(0);
+ nanf(0);
+ nanl(0);
+ nearbyint(0.0);
+ nearbyintf(0.0f);
+ nearbyintl(0.0l);
+ nextafter(0.0, 0.0);
+ nextafterf(0.0f, 0.0f);
+ nextafterl(0.0l, 0.0l);
+ nexttoward(0.0, 0.0);
+ nexttowardf(0.0f, 0.0f);
+ nexttowardl(0.0l, 0.0l);
+ remainder(0.0, 0.0);
+ remainderf(0.0f, 0.0f);
+ remainderl(0.0l, 0.0l);
+ remquo(0.0, 0.0, 0);
+ remquo(0.0f, 0.0f, 0);
+ remquo(0.0l, 0.0l, 0);
+ rint(0.0);
+ rintf(0.0f);
+ rintl(0.0l);
+ round(0.0);
+ roundf(0.0f);
+ roundl(0.0l);
+ scalbln(0.0, 0l);
+ scalblnf(0.0f, 0l);
+ scalblnl(0.0l, 0l);
+ scalbn(0.0, 0);
+ scalbnf(0.0f, 0);
+ scalbnl(0.0l, 0);
+ tgamma(0.0);
+ tgammaf(0.0f);
+ tgammal(0.0l);
+ trunc(0.0);
+ truncf(0.0f);
+ truncl(0.0l);
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_cxx_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ glibcxx_cv_c99_math_tr1=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+glibcxx_cv_c99_math_tr1=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+
+ echo "$as_me:$LINENO: result: $glibcxx_cv_c99_math_tr1" >&5
+echo "${ECHO_T}$glibcxx_cv_c99_math_tr1" >&6
+ if test x"$glibcxx_cv_c99_math_tr1" = x"yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define _GLIBCXX_USE_C99_MATH_TR1 1
+_ACEOF
+
+ fi
+
+ # Check for the existence of <inttypes.h> functions (NB: doesn't make
+ # sense if the previous check fails, per C99, 7.8/1).
+ ac_c99_inttypes_tr1=no;
+ if test x"$glibcxx_cv_c99_stdint_tr1" = x"yes"; then
+ echo "$as_me:$LINENO: checking for ISO C99 support to TR1 in <inttypes.h>" >&5
+echo $ECHO_N "checking for ISO C99 support to TR1 in <inttypes.h>... $ECHO_C" >&6
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <inttypes.h>
+int
+main ()
+{
+intmax_t i, numer, denom, base;
+ const char* s;
+ char** endptr;
+ intmax_t ret = imaxabs(i);
+ imaxdiv_t dret = imaxdiv(numer, denom);
+ ret = strtoimax(s, endptr, base);
+ uintmax_t uret = strtoumax(s, endptr, base);
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_cxx_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_c99_inttypes_tr1=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_c99_inttypes_tr1=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ fi
+ echo "$as_me:$LINENO: result: $ac_c99_inttypes_tr1" >&5
+echo "${ECHO_T}$ac_c99_inttypes_tr1" >&6
+ if test x"$ac_c99_inttypes_tr1" = x"yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define _GLIBCXX_USE_C99_INTTYPES_TR1 1
+_ACEOF
+
+ fi
+
+ # Check for the existence of the <stdbool.h> header.
+
+for ac_header in stdbool.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_cxx_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_cxx_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## ----------------------------------------- ##
+## Report this to the package-unused lists. ##
+## ----------------------------------------- ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+ CXXFLAGS="$ac_save_CXXFLAGS"
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+# For common values of EOF, SEEK_CUR, SEEK_END.
+
+
+ echo "$as_me:$LINENO: checking for EOF == -1, SEEK_CUR == 1, SEEK_END == 2" >&5
+echo $ECHO_N "checking for EOF == -1, SEEK_CUR == 1, SEEK_END == 2... $ECHO_C" >&6
+ if test "${glibcxx_cv_stdio_macros+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdio.h>
+int
+main ()
+{
+#if ((EOF != -1) || (SEEK_CUR != 1) || (SEEK_END != 2))
+ unusual values...
+ #endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ glibcxx_cv_stdio_macros=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+glibcxx_cv_stdio_macros=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+
+ echo "$as_me:$LINENO: result: $glibcxx_cv_stdio_macros" >&5
+echo "${ECHO_T}$glibcxx_cv_stdio_macros" >&6
+ if test x"$glibcxx_cv_stdio_macros" = x"yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define _GLIBCXX_STDIO_MACROS 1
+_ACEOF
+
+ fi
+
+
# Only do link tests if native. Else, hardcode.
if $GLIBCXX_IS_NATIVE; then
@@ -39675,73 +41010,6 @@ _ACEOF
echo "${ECHO_T}$glibcxx_cv_WRITEV" >&6
- # For the __streamoff_base_type typedef.
-
- echo "$as_me:$LINENO: checking for int64_t" >&5
-echo $ECHO_N "checking for int64_t... $ECHO_C" >&6
- if test "${glibcxx_cv_INT64_T+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdint.h>
-int
-main ()
-{
-int64_t var;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- glibcxx_cv_INT64_T=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-glibcxx_cv_INT64_T=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-
-fi
-
- if test $glibcxx_cv_INT64_T = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_INT64_T 1
-_ACEOF
-
- fi
- echo "$as_me:$LINENO: result: $glibcxx_cv_INT64_T" >&5
-echo "${ECHO_T}$glibcxx_cv_INT64_T" >&6
-
-
# For LFS support.
@@ -39841,220 +41109,121 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
- # For C99 support to TR1.
-
-
-
-
- ac_ext=cc
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-
-
- # Use -std=c++98 because the default (-std=gnu++98) leaves __STRICT_ANSI__
- # undefined and fake C99 facilities may be spuriously enabled.
- ac_save_CXXFLAGS="$CXXFLAGS"
- CXXFLAGS="$CXXFLAGS -std=c++98"
+ # For dev/random and dev/urandom for TR1.
- # Check for the existence of <complex.h> complex math functions used
- # by tr1/complex.
-for ac_header in complex.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo "$as_me:$LINENO: checking for \"dev/random\" and \"dev/urandom\" for TR1 random_device" >&5
+echo $ECHO_N "checking for \"dev/random\" and \"dev/urandom\" for TR1 random_device... $ECHO_C" >&6
+ if test "${glibcxx_cv_random_tr1+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
+
+ if test "$cross_compiling" = yes; then
+ glibcxx_cv_random_tr1=no
+else
+ cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
+#include <stdio.h>
+ int main()
+ {
+ return !(fopen("/dev/random", "r")
+ && fopen("/dev/urandom", "r"));
+ }
+
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_cxx_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- ac_header_compiler=yes
+ glibcxx_cv_random_tr1=yes
else
- echo "$as_me: failed program was:" >&5
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-ac_header_compiler=no
+( exit $ac_status )
+glibcxx_cv_random_tr1=no
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_cxx_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
- ac_header_preproc=no
fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ----------------------------------------- ##
-## Report this to the package-unused lists. ##
-## ----------------------------------------- ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+ echo "$as_me:$LINENO: result: $glibcxx_cv_random_tr1" >&5
+echo "${ECHO_T}$glibcxx_cv_random_tr1" >&6
+ if test x"$glibcxx_cv_random_tr1" = x"yes"; then
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+cat >>confdefs.h <<\_ACEOF
+#define _GLIBCXX_USE_RANDOM_TR1 1
_ACEOF
- ac_has_complex_h=yes
-else
- ac_has_complex_h=no
-fi
-done
+ fi
- ac_c99_complex_tr1=no;
- if test x"$ac_has_complex_h" = x"yes"; then
- echo "$as_me:$LINENO: checking for ISO C99 support to TR1 in <complex.h>" >&5
-echo $ECHO_N "checking for ISO C99 support to TR1 in <complex.h>... $ECHO_C" >&6
- cat >conftest.$ac_ext <<_ACEOF
+
+
+ # For clock_gettime support.
+
+
+
+
+ ac_ext=cc
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+ ac_save_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS="$CXXFLAGS -fno-exceptions"
+ ac_save_LIBS="$LIBS"
+
+ echo "$as_me:$LINENO: checking for library containing clock_gettime" >&5
+echo $ECHO_N "checking for library containing clock_gettime... $ECHO_C" >&6
+if test "${ac_cv_search_clock_gettime+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_func_search_save_LIBS=$LIBS
+ac_cv_search_clock_gettime=no
+if test x$gcc_no_link = xyes; then
+ { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
+echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-#include <complex.h>
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char clock_gettime ();
int
main ()
{
-typedef __complex__ float float_type; float_type tmpf;
- cacosf(tmpf);
- casinf(tmpf);
- catanf(tmpf);
- cacoshf(tmpf);
- casinhf(tmpf);
- catanhf(tmpf);
- typedef __complex__ double double_type; double_type tmpd;
- cacos(tmpd);
- casin(tmpd);
- catan(tmpd);
- cacosh(tmpd);
- casinh(tmpd);
- catanh(tmpd);
- typedef __complex__ long double ld_type; ld_type tmpld;
- cacosl(tmpld);
- casinl(tmpld);
- catanl(tmpld);
- cacoshl(tmpld);
- casinhl(tmpld);
- catanhl(tmpld);
-
+clock_gettime ();
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
@@ -40068,59 +41237,53 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
+ { ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- ac_c99_complex_tr1=yes
+ ac_cv_search_clock_gettime="none required"
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-ac_c99_complex_tr1=no
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
- fi
- echo "$as_me:$LINENO: result: $ac_c99_complex_tr1" >&5
-echo "${ECHO_T}$ac_c99_complex_tr1" >&6
- if test x"$ac_c99_complex_tr1" = x"yes"; then
-
-cat >>confdefs.h <<\_ACEOF
-#define _GLIBCXX_USE_C99_COMPLEX_TR1 1
-_ACEOF
-
- fi
-
- # Check for the existence of <ctype.h> functions.
- echo "$as_me:$LINENO: checking for ISO C99 support to TR1 in <ctype.h>" >&5
-echo $ECHO_N "checking for ISO C99 support to TR1 in <ctype.h>... $ECHO_C" >&6
- if test "${glibcxx_cv_c99_ctype_tr1+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-
- cat >conftest.$ac_ext <<_ACEOF
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+if test "$ac_cv_search_clock_gettime" = no; then
+ for ac_lib in posix4; do
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ if test x$gcc_no_link = xyes; then
+ { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
+echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-#include <ctype.h>
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char clock_gettime ();
int
main ()
{
-int ch;
- int ret;
- ret = isblank(ch);
-
+clock_gettime ();
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
@@ -40134,36 +41297,40 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
+ { ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- glibcxx_cv_c99_ctype_tr1=yes
+ ac_cv_search_clock_gettime="-l$ac_lib"
+break
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-glibcxx_cv_c99_ctype_tr1=no
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ done
+fi
+LIBS=$ac_func_search_save_LIBS
fi
+echo "$as_me:$LINENO: result: $ac_cv_search_clock_gettime" >&5
+echo "${ECHO_T}$ac_cv_search_clock_gettime" >&6
+if test "$ac_cv_search_clock_gettime" != no; then
+ test "$ac_cv_search_clock_gettime" = "none required" || LIBS="$ac_cv_search_clock_gettime $LIBS"
- echo "$as_me:$LINENO: result: $glibcxx_cv_c99_ctype_tr1" >&5
-echo "${ECHO_T}$glibcxx_cv_c99_ctype_tr1" >&6
- if test x"$glibcxx_cv_c99_ctype_tr1" = x"yes"; then
+fi
-cat >>confdefs.h <<\_ACEOF
-#define _GLIBCXX_USE_C99_CTYPE_TR1 1
-_ACEOF
- fi
+ # Link to -lposix4.
+ case "$ac_cv_search_clock_gettime" in
+ -lposix4*) GLIBCXX_LIBS=$ac_cv_search_clock_gettime
+ esac
- # Check for the existence of <fenv.h> functions.
-for ac_header in fenv.h
+for ac_header in unistd.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
if eval "test \"\${$as_ac_Header+set}\" = set"; then
@@ -40307,50 +41474,48 @@ if test `eval echo '${'$as_ac_Header'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
- ac_has_fenv_h=yes
+ ac_has_unistd_h=yes
else
- ac_has_fenv_h=no
+ ac_has_unistd_h=no
fi
done
- ac_c99_fenv_tr1=no;
- if test x"$ac_has_fenv_h" = x"yes"; then
- echo "$as_me:$LINENO: checking for ISO C99 support to TR1 in <fenv.h>" >&5
-echo $ECHO_N "checking for ISO C99 support to TR1 in <fenv.h>... $ECHO_C" >&6
- cat >conftest.$ac_ext <<_ACEOF
+
+ ac_has_clock_monotonic=no;
+ ac_has_clock_realtime=no;
+ if test x"$ac_has_unistd_h" = x"yes"; then
+ echo "$as_me:$LINENO: checking for monotonic clock" >&5
+echo $ECHO_N "checking for monotonic clock... $ECHO_C" >&6
+ if test x$gcc_no_link = xyes; then
+ { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
+echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-#include <fenv.h>
+#include <unistd.h>
+ #include <time.h>
+
int
main ()
{
-int except, mode;
- fexcept_t* pflag;
- fenv_t* penv;
- int ret;
- ret = feclearexcept(except);
- ret = fegetexceptflag(pflag, except);
- ret = feraiseexcept(except);
- ret = fesetexceptflag(pflag, except);
- ret = fetestexcept(except);
- ret = fegetround();
- ret = fesetround(mode);
- ret = fegetenv(penv);
- ret = feholdexcept(penv);
- ret = fesetenv(penv);
- ret = feupdateenv(penv);
+#if _POSIX_TIMERS > 0 && defined(_POSIX_MONOTONIC_CLOCK)
+ timespec tp;
+ #endif
+ clock_gettime(CLOCK_MONOTONIC, &tp);
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
@@ -40364,84 +41529,56 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
+ { ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- ac_c99_fenv_tr1=yes
+ ac_has_clock_monotonic=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-ac_c99_fenv_tr1=no
+ac_has_clock_monotonic=no
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
- fi
- echo "$as_me:$LINENO: result: $ac_c99_fenv_tr1" >&5
-echo "${ECHO_T}$ac_c99_fenv_tr1" >&6
- if test x"$ac_c99_fenv_tr1" = x"yes"; then
-
-cat >>confdefs.h <<\_ACEOF
-#define _GLIBCXX_USE_C99_FENV_TR1 1
-_ACEOF
-
- fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
- # Check for the existence of <stdint.h> types.
- echo "$as_me:$LINENO: checking for ISO C99 support to TR1 in <stdint.h>" >&5
-echo $ECHO_N "checking for ISO C99 support to TR1 in <stdint.h>... $ECHO_C" >&6
- if test "${glibcxx_cv_c99_stdint_tr1+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+ echo "$as_me:$LINENO: result: $ac_has_clock_monotonic" >&5
+echo "${ECHO_T}$ac_has_clock_monotonic" >&6
- cat >conftest.$ac_ext <<_ACEOF
+ echo "$as_me:$LINENO: checking for realtime clock" >&5
+echo $ECHO_N "checking for realtime clock... $ECHO_C" >&6
+ if test x$gcc_no_link = xyes; then
+ { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
+echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-#include <stdint.h>
+#include <unistd.h>
+ #include <time.h>
+
int
main ()
{
-typedef int8_t my_int8_t;
- typedef int16_t my_int16_t;
- typedef int32_t my_int32_t;
- typedef int64_t my_int64_t;
- typedef int_fast8_t my_int_fast8_t;
- typedef int_fast16_t my_int_fast16_t;
- typedef int_fast32_t my_int_fast32_t;
- typedef int_fast64_t my_int_fast64_t;
- typedef int_least8_t my_int_least8_t;
- typedef int_least16_t my_int_least16_t;
- typedef int_least32_t my_int_least32_t;
- typedef int_least64_t my_int_least64_t;
- typedef intmax_t my_intmax_t;
- typedef intptr_t my_intptr_t;
- typedef uint8_t my_uint8_t;
- typedef uint16_t my_uint16_t;
- typedef uint32_t my_uint32_t;
- typedef uint64_t my_uint64_t;
- typedef uint_fast8_t my_uint_fast8_t;
- typedef uint_fast16_t my_uint_fast16_t;
- typedef uint_fast32_t my_uint_fast32_t;
- typedef uint_fast64_t my_uint_fast64_t;
- typedef uint_least8_t my_uint_least8_t;
- typedef uint_least16_t my_uint_least16_t;
- typedef uint_least32_t my_uint_least32_t;
- typedef uint_least64_t my_uint_least64_t;
- typedef uintmax_t my_uintmax_t;
- typedef uintptr_t my_uintptr_t;
+#if _POSIX_TIMERS > 0
+ timespec tp;
+ #endif
+ clock_gettime(CLOCK_REALTIME, &tp);
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
@@ -40455,277 +41592,71 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
+ { ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- glibcxx_cv_c99_stdint_tr1=yes
+ ac_has_clock_realtime=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-glibcxx_cv_c99_stdint_tr1=no
+ac_has_clock_realtime=no
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
-fi
+ echo "$as_me:$LINENO: result: $ac_has_clock_realtime" >&5
+echo "${ECHO_T}$ac_has_clock_realtime" >&6
+ fi
- echo "$as_me:$LINENO: result: $glibcxx_cv_c99_stdint_tr1" >&5
-echo "${ECHO_T}$glibcxx_cv_c99_stdint_tr1" >&6
- if test x"$glibcxx_cv_c99_stdint_tr1" = x"yes"; then
+ if test x"$ac_has_clock_monotonic" = x"yes"; then
cat >>confdefs.h <<\_ACEOF
-#define _GLIBCXX_USE_C99_STDINT_TR1 1
+#define _GLIBCXX_USE_CLOCK_MONOTONIC 1
_ACEOF
fi
- # Check for the existence of <math.h> functions.
- echo "$as_me:$LINENO: checking for ISO C99 support to TR1 in <math.h>" >&5
-echo $ECHO_N "checking for ISO C99 support to TR1 in <math.h>... $ECHO_C" >&6
- if test "${glibcxx_cv_c99_math_tr1+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+ if test x"$ac_has_clock_realtime" = x"yes"; then
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
+cat >>confdefs.h <<\_ACEOF
+#define _GLIBCXX_USE_CLOCK_REALTIME 1
_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <math.h>
-int
-main ()
-{
-typedef double_t my_double_t;
- typedef float_t my_float_t;
- acosh(0.0);
- acoshf(0.0f);
- acoshl(0.0l);
- asinh(0.0);
- asinhf(0.0f);
- asinhl(0.0l);
- atanh(0.0);
- atanhf(0.0f);
- atanhl(0.0l);
- cbrt(0.0);
- cbrtf(0.0f);
- cbrtl(0.0l);
- copysign(0.0, 0.0);
- copysignf(0.0f, 0.0f);
- copysignl(0.0l, 0.0l);
- erf(0.0);
- erff(0.0f);
- erfl(0.0l);
- erfc(0.0);
- erfcf(0.0f);
- erfcl(0.0l);
- exp2(0.0);
- exp2f(0.0f);
- exp2l(0.0l);
- expm1(0.0);
- expm1f(0.0f);
- expm1l(0.0l);
- fdim(0.0, 0.0);
- fdimf(0.0f, 0.0f);
- fdiml(0.0l, 0.0l);
- fma(0.0, 0.0, 0.0);
- fmaf(0.0f, 0.0f, 0.0f);
- fmal(0.0l, 0.0l, 0.0l);
- fmax(0.0, 0.0);
- fmaxf(0.0f, 0.0f);
- fmaxl(0.0l, 0.0l);
- fmin(0.0, 0.0);
- fminf(0.0f, 0.0f);
- fminl(0.0l, 0.0l);
- hypot(0.0, 0.0);
- hypotf(0.0f, 0.0f);
- hypotl(0.0l, 0.0l);
- ilogb(0.0);
- ilogbf(0.0f);
- ilogbl(0.0l);
- lgamma(0.0);
- lgammaf(0.0f);
- lgammal(0.0l);
- llrint(0.0);
- llrintf(0.0f);
- llrintl(0.0l);
- llround(0.0);
- llroundf(0.0f);
- llroundl(0.0l);
- log1p(0.0);
- log1pf(0.0f);
- log1pl(0.0l);
- log2(0.0);
- log2f(0.0f);
- log2l(0.0l);
- logb(0.0);
- logbf(0.0f);
- logbl(0.0l);
- lrint(0.0);
- lrintf(0.0f);
- lrintl(0.0l);
- lround(0.0);
- lroundf(0.0f);
- lroundl(0.0l);
- nan(0);
- nanf(0);
- nanl(0);
- nearbyint(0.0);
- nearbyintf(0.0f);
- nearbyintl(0.0l);
- nextafter(0.0, 0.0);
- nextafterf(0.0f, 0.0f);
- nextafterl(0.0l, 0.0l);
- nexttoward(0.0, 0.0);
- nexttowardf(0.0f, 0.0f);
- nexttowardl(0.0l, 0.0l);
- remainder(0.0, 0.0);
- remainderf(0.0f, 0.0f);
- remainderl(0.0l, 0.0l);
- remquo(0.0, 0.0, 0);
- remquo(0.0f, 0.0f, 0);
- remquo(0.0l, 0.0l, 0);
- rint(0.0);
- rintf(0.0f);
- rintl(0.0l);
- round(0.0);
- roundf(0.0f);
- roundl(0.0l);
- scalbln(0.0, 0l);
- scalblnf(0.0f, 0l);
- scalblnl(0.0l, 0l);
- scalbn(0.0, 0);
- scalbnf(0.0f, 0);
- scalbnl(0.0l, 0);
- tgamma(0.0);
- tgammaf(0.0f);
- tgammal(0.0l);
- trunc(0.0);
- truncf(0.0f);
- truncl(0.0l);
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_cxx_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- glibcxx_cv_c99_math_tr1=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+ fi
-glibcxx_cv_c99_math_tr1=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
- echo "$as_me:$LINENO: result: $glibcxx_cv_c99_math_tr1" >&5
-echo "${ECHO_T}$glibcxx_cv_c99_math_tr1" >&6
- if test x"$glibcxx_cv_c99_math_tr1" = x"yes"; then
+ CXXFLAGS="$ac_save_CXXFLAGS"
+ LIBS="$ac_save_LIBS"
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
-cat >>confdefs.h <<\_ACEOF
-#define _GLIBCXX_USE_C99_MATH_TR1 1
-_ACEOF
- fi
- # Check for the existence of <inttypes.h> functions (NB: doesn't make
- # sense if the previous check fails, per C99, 7.8/1).
- ac_c99_inttypes_tr1=no;
- if test x"$glibcxx_cv_c99_stdint_tr1" = x"yes"; then
- echo "$as_me:$LINENO: checking for ISO C99 support to TR1 in <inttypes.h>" >&5
-echo $ECHO_N "checking for ISO C99 support to TR1 in <inttypes.h>... $ECHO_C" >&6
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <inttypes.h>
-int
-main ()
-{
-intmax_t i, numer, denom, base;
- const char* s;
- char** endptr;
- intmax_t ret = imaxabs(i);
- imaxdiv_t dret = imaxdiv(numer, denom);
- ret = strtoimax(s, endptr, base);
- uintmax_t uret = strtoumax(s, endptr, base);
+ # For gettimeofday support.
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_cxx_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_c99_inttypes_tr1=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-ac_c99_inttypes_tr1=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
- fi
- echo "$as_me:$LINENO: result: $ac_c99_inttypes_tr1" >&5
-echo "${ECHO_T}$ac_c99_inttypes_tr1" >&6
- if test x"$ac_c99_inttypes_tr1" = x"yes"; then
-cat >>confdefs.h <<\_ACEOF
-#define _GLIBCXX_USE_C99_INTTYPES_TR1 1
-_ACEOF
- fi
+ ac_ext=cc
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
- # Check for the existence of the <stdbool.h> header.
+ ac_save_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS="$CXXFLAGS -fno-exceptions"
-for ac_header in stdbool.h
+ ac_has_gettimeofday=no;
+
+for ac_header in sys/time.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
if eval "test \"\${$as_ac_Header+set}\" = set"; then
@@ -40869,82 +41800,87 @@ if test `eval echo '${'$as_ac_Header'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
-
+ ac_has_sys_time_h=yes
+else
+ ac_has_sys_time_h=no
fi
done
-
- CXXFLAGS="$ac_save_CXXFLAGS"
- ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-
- # For dev/random and dev/urandom for TR1.
-
-
- echo "$as_me:$LINENO: checking for \"dev/random\" and \"dev/urandom\" for TR1 random_device" >&5
-echo $ECHO_N "checking for \"dev/random\" and \"dev/urandom\" for TR1 random_device... $ECHO_C" >&6
- if test "${glibcxx_cv_random_tr1+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-
- if test "$cross_compiling" = yes; then
- glibcxx_cv_random_tr1=no
-else
- cat >conftest.$ac_ext <<_ACEOF
+ if test x"$ac_has_sys_time_h" = x"yes"; then
+ echo "$as_me:$LINENO: checking for gettimeofday" >&5
+echo $ECHO_N "checking for gettimeofday... $ECHO_C" >&6
+ if test x$gcc_no_link = xyes; then
+ { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
+echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-#include <stdio.h>
- int main()
- {
- return !(fopen("/dev/random", "r")
- && fopen("/dev/urandom", "r"));
- }
-
+#include <sys/time.h>
+int
+main ()
+{
+timeval tv; gettimeofday(&tv, 0);
+ ;
+ return 0;
+}
_ACEOF
-rm -f conftest$ac_exeext
+rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_cxx_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- glibcxx_cv_random_tr1=yes
+ ac_has_gettimeofday=yes
else
- echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
+ echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-( exit $ac_status )
-glibcxx_cv_random_tr1=no
-fi
-rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+ac_has_gettimeofday=no
fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
-fi
+ echo "$as_me:$LINENO: result: $ac_has_gettimeofday" >&5
+echo "${ECHO_T}$ac_has_gettimeofday" >&6
+ fi
- echo "$as_me:$LINENO: result: $glibcxx_cv_random_tr1" >&5
-echo "${ECHO_T}$glibcxx_cv_random_tr1" >&6
- if test x"$glibcxx_cv_random_tr1" = x"yes"; then
+ if test x"$ac_has_gettimeofday" = x"yes"; then
cat >>confdefs.h <<\_ACEOF
-#define _GLIBCXX_USE_RANDOM_TR1 1
+#define _GLIBCXX_USE_GETTIMEOFDAY 1
_ACEOF
fi
+ CXXFLAGS="$ac_save_CXXFLAGS"
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
# For TLS support.
@@ -41554,499 +42490,6 @@ fi
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <setjmp.h>
-int
-main ()
-{
-sigjmp_buf env;
- while (! sigsetjmp (env, 1))
- siglongjmp (env, 1);
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_SIGSETJMP 1
-_ACEOF
-
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-
- if test x$gcc_no_link = xyes; then
- if test "x${ac_cv_func_mmap_fixed_mapped+set}" != xset; then
- ac_cv_func_mmap_fixed_mapped=no
- fi
-fi
-if test "x${ac_cv_func_mmap_fixed_mapped}" != xno; then
-
-
-for ac_header in stdlib.h unistd.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ----------------------------------------- ##
-## Report this to the package-unused lists. ##
-## ----------------------------------------- ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-for ac_func in getpagesize
-do
-as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
-if eval "test \"\${$as_ac_var+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test x$gcc_no_link = xyes; then
- { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
-echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
- { (exit 1); exit 1; }; }
-fi
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-char (*f) () = $ac_func;
-#endif
-#ifdef __cplusplus
-}
-#endif
-
-int
-main ()
-{
-return f != $ac_func;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- eval "$as_ac_var=yes"
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-eval "$as_ac_var=no"
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
-if test `eval echo '${'$as_ac_var'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-echo "$as_me:$LINENO: checking for working mmap" >&5
-echo $ECHO_N "checking for working mmap... $ECHO_C" >&6
-if test "${ac_cv_func_mmap_fixed_mapped+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test "$cross_compiling" = yes; then
- ac_cv_func_mmap_fixed_mapped=no
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-/* malloc might have been renamed as rpl_malloc. */
-#undef malloc
-
-/* Thanks to Mike Haertel and Jim Avera for this test.
- Here is a matrix of mmap possibilities:
- mmap private not fixed
- mmap private fixed at somewhere currently unmapped
- mmap private fixed at somewhere already mapped
- mmap shared not fixed
- mmap shared fixed at somewhere currently unmapped
- mmap shared fixed at somewhere already mapped
- For private mappings, we should verify that changes cannot be read()
- back from the file, nor mmap's back from the file at a different
- address. (There have been systems where private was not correctly
- implemented like the infamous i386 svr4.0, and systems where the
- VM page cache was not coherent with the file system buffer cache
- like early versions of FreeBSD and possibly contemporary NetBSD.)
- For shared mappings, we should conversely verify that changes get
- propagated back to all the places they're supposed to be.
-
- Grep wants private fixed already mapped.
- The main things grep needs to know about mmap are:
- * does it exist and is it safe to write into the mmap'd area
- * how to use it (BSD variants) */
-
-#include <fcntl.h>
-#include <sys/mman.h>
-
-#if !STDC_HEADERS && !HAVE_STDLIB_H
-char *malloc ();
-#endif
-
-/* This mess was copied from the GNU getpagesize.h. */
-#if !HAVE_GETPAGESIZE
-/* Assume that all systems that can run configure have sys/param.h. */
-# if !HAVE_SYS_PARAM_H
-# define HAVE_SYS_PARAM_H 1
-# endif
-
-# ifdef _SC_PAGESIZE
-# define getpagesize() sysconf(_SC_PAGESIZE)
-# else /* no _SC_PAGESIZE */
-# if HAVE_SYS_PARAM_H
-# include <sys/param.h>
-# ifdef EXEC_PAGESIZE
-# define getpagesize() EXEC_PAGESIZE
-# else /* no EXEC_PAGESIZE */
-# ifdef NBPG
-# define getpagesize() NBPG * CLSIZE
-# ifndef CLSIZE
-# define CLSIZE 1
-# endif /* no CLSIZE */
-# else /* no NBPG */
-# ifdef NBPC
-# define getpagesize() NBPC
-# else /* no NBPC */
-# ifdef PAGESIZE
-# define getpagesize() PAGESIZE
-# endif /* PAGESIZE */
-# endif /* no NBPC */
-# endif /* no NBPG */
-# endif /* no EXEC_PAGESIZE */
-# else /* no HAVE_SYS_PARAM_H */
-# define getpagesize() 8192 /* punt totally */
-# endif /* no HAVE_SYS_PARAM_H */
-# endif /* no _SC_PAGESIZE */
-
-#endif /* no HAVE_GETPAGESIZE */
-
-int
-main ()
-{
- char *data, *data2, *data3;
- int i, pagesize;
- int fd;
-
- pagesize = getpagesize ();
-
- /* First, make a file with some known garbage in it. */
- data = (char *) malloc (pagesize);
- if (!data)
- exit (1);
- for (i = 0; i < pagesize; ++i)
- *(data + i) = rand ();
- umask (0);
- fd = creat ("conftest.mmap", 0600);
- if (fd < 0)
- exit (1);
- if (write (fd, data, pagesize) != pagesize)
- exit (1);
- close (fd);
-
- /* Next, try to mmap the file at a fixed address which already has
- something else allocated at it. If we can, also make sure that
- we see the same garbage. */
- fd = open ("conftest.mmap", O_RDWR);
- if (fd < 0)
- exit (1);
- data2 = (char *) malloc (2 * pagesize);
- if (!data2)
- exit (1);
- data2 += (pagesize - ((long) data2 & (pagesize - 1))) & (pagesize - 1);
- if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE,
- MAP_PRIVATE | MAP_FIXED, fd, 0L))
- exit (1);
- for (i = 0; i < pagesize; ++i)
- if (*(data + i) != *(data2 + i))
- exit (1);
-
- /* Finally, make sure that changes to the mapped area do not
- percolate back to the file as seen by read(). (This is a bug on
- some variants of i386 svr4.0.) */
- for (i = 0; i < pagesize; ++i)
- *(data2 + i) = *(data2 + i) + 1;
- data3 = (char *) malloc (pagesize);
- if (!data3)
- exit (1);
- if (read (fd, data3, pagesize) != pagesize)
- exit (1);
- for (i = 0; i < pagesize; ++i)
- if (*(data + i) != *(data3 + i))
- exit (1);
- close (fd);
- exit (0);
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_func_mmap_fixed_mapped=yes
-else
- echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-ac_cv_func_mmap_fixed_mapped=no
-fi
-rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-fi
-echo "$as_me:$LINENO: result: $ac_cv_func_mmap_fixed_mapped" >&5
-echo "${ECHO_T}$ac_cv_func_mmap_fixed_mapped" >&6
-if test $ac_cv_func_mmap_fixed_mapped = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_MMAP 1
-_ACEOF
-
-fi
-rm -f conftest.mmap
-
-fi
-
# For iconv support.
if test "X$prefix" = "XNONE"; then
@@ -42890,11 +43333,6 @@ _ACEOF
#define HAVE_STRTOF 1
_ACEOF
- # AC_FUNC_MMAP
- cat >>confdefs.h <<\_ACEOF
-#define HAVE_MMAP 1
-_ACEOF
-
cat >>confdefs.h <<\_ACEOF
#define HAVE_ACOSF 1
@@ -63967,21 +64405,9 @@ _ACEOF
echo "${ECHO_T}$res" >&6
cat >>confdefs.h <<\_ACEOF
-#define HAVE_SIGSETJMP 1
-_ACEOF
-
- cat >>confdefs.h <<\_ACEOF
-#define HAVE_GETPAGESIZE 1
-_ACEOF
-
- cat >>confdefs.h <<\_ACEOF
#define HAVE_WRITEV 1
_ACEOF
- cat >>confdefs.h <<\_ACEOF
-#define HAVE_INT64_T 1
-_ACEOF
-
cat >>confdefs.h <<\_ACEOF
#define HAVE_LIBM 1
@@ -85166,63 +85592,6 @@ echo "${ECHO_T}$glibcxx_cv_WRITEV" >&6
#define HAVE_LC_MESSAGES 1
_ACEOF
-
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <setjmp.h>
-int
-main ()
-{
-sigjmp_buf env;
- while (! sigsetjmp (env, 1))
- siglongjmp (env, 1);
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_SIGSETJMP 1
-_ACEOF
-
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-
- cat >>confdefs.h <<\_ACEOF
-#define HAVE_MMAP 1
-_ACEOF
-
;;
*djgpp)
@@ -86376,18 +86745,10 @@ done
_ACEOF
cat >>confdefs.h <<\_ACEOF
-#define HAVE_GETPAGESIZE 1
-_ACEOF
-
- cat >>confdefs.h <<\_ACEOF
#define HAVE_SETENV 1
_ACEOF
cat >>confdefs.h <<\_ACEOF
-#define HAVE_SIGSETJMP 1
-_ACEOF
-
- cat >>confdefs.h <<\_ACEOF
#define HAVE_COPYSIGN 1
_ACEOF
@@ -86429,10 +86790,6 @@ _ACEOF
cat >>confdefs.h <<\_ACEOF
-#define HAVE_MMAP 1
-_ACEOF
-
- cat >>confdefs.h <<\_ACEOF
#define HAVE_ACOSF 1
_ACEOF
@@ -108258,10 +108615,6 @@ done
# For LFS.
- cat >>confdefs.h <<\_ACEOF
-#define HAVE_INT64_T 1
-_ACEOF
-
@@ -108952,1049 +109305,6 @@ _ACEOF
echo "${ECHO_T}$glibcxx_cv_WRITEV" >&6
- # For C99 support to TR1.
-
-
-
-
- ac_ext=cc
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-
-
- # Use -std=c++98 because the default (-std=gnu++98) leaves __STRICT_ANSI__
- # undefined and fake C99 facilities may be spuriously enabled.
- ac_save_CXXFLAGS="$CXXFLAGS"
- CXXFLAGS="$CXXFLAGS -std=c++98"
-
- # Check for the existence of <complex.h> complex math functions used
- # by tr1/complex.
-
-for ac_header in complex.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_cxx_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_cxx_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ----------------------------------------- ##
-## Report this to the package-unused lists. ##
-## ----------------------------------------- ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
- ac_has_complex_h=yes
-else
- ac_has_complex_h=no
-fi
-
-done
-
- ac_c99_complex_tr1=no;
- if test x"$ac_has_complex_h" = x"yes"; then
- echo "$as_me:$LINENO: checking for ISO C99 support to TR1 in <complex.h>" >&5
-echo $ECHO_N "checking for ISO C99 support to TR1 in <complex.h>... $ECHO_C" >&6
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <complex.h>
-int
-main ()
-{
-typedef __complex__ float float_type; float_type tmpf;
- cacosf(tmpf);
- casinf(tmpf);
- catanf(tmpf);
- cacoshf(tmpf);
- casinhf(tmpf);
- catanhf(tmpf);
- typedef __complex__ double double_type; double_type tmpd;
- cacos(tmpd);
- casin(tmpd);
- catan(tmpd);
- cacosh(tmpd);
- casinh(tmpd);
- catanh(tmpd);
- typedef __complex__ long double ld_type; ld_type tmpld;
- cacosl(tmpld);
- casinl(tmpld);
- catanl(tmpld);
- cacoshl(tmpld);
- casinhl(tmpld);
- catanhl(tmpld);
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_cxx_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_c99_complex_tr1=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_c99_complex_tr1=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
- fi
- echo "$as_me:$LINENO: result: $ac_c99_complex_tr1" >&5
-echo "${ECHO_T}$ac_c99_complex_tr1" >&6
- if test x"$ac_c99_complex_tr1" = x"yes"; then
-
-cat >>confdefs.h <<\_ACEOF
-#define _GLIBCXX_USE_C99_COMPLEX_TR1 1
-_ACEOF
-
- fi
-
- # Check for the existence of <ctype.h> functions.
- echo "$as_me:$LINENO: checking for ISO C99 support to TR1 in <ctype.h>" >&5
-echo $ECHO_N "checking for ISO C99 support to TR1 in <ctype.h>... $ECHO_C" >&6
- if test "${glibcxx_cv_c99_ctype_tr1+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <ctype.h>
-int
-main ()
-{
-int ch;
- int ret;
- ret = isblank(ch);
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_cxx_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- glibcxx_cv_c99_ctype_tr1=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-glibcxx_cv_c99_ctype_tr1=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-
-fi
-
- echo "$as_me:$LINENO: result: $glibcxx_cv_c99_ctype_tr1" >&5
-echo "${ECHO_T}$glibcxx_cv_c99_ctype_tr1" >&6
- if test x"$glibcxx_cv_c99_ctype_tr1" = x"yes"; then
-
-cat >>confdefs.h <<\_ACEOF
-#define _GLIBCXX_USE_C99_CTYPE_TR1 1
-_ACEOF
-
- fi
-
- # Check for the existence of <fenv.h> functions.
-
-for ac_header in fenv.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_cxx_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_cxx_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ----------------------------------------- ##
-## Report this to the package-unused lists. ##
-## ----------------------------------------- ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
- ac_has_fenv_h=yes
-else
- ac_has_fenv_h=no
-fi
-
-done
-
- ac_c99_fenv_tr1=no;
- if test x"$ac_has_fenv_h" = x"yes"; then
- echo "$as_me:$LINENO: checking for ISO C99 support to TR1 in <fenv.h>" >&5
-echo $ECHO_N "checking for ISO C99 support to TR1 in <fenv.h>... $ECHO_C" >&6
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <fenv.h>
-int
-main ()
-{
-int except, mode;
- fexcept_t* pflag;
- fenv_t* penv;
- int ret;
- ret = feclearexcept(except);
- ret = fegetexceptflag(pflag, except);
- ret = feraiseexcept(except);
- ret = fesetexceptflag(pflag, except);
- ret = fetestexcept(except);
- ret = fegetround();
- ret = fesetround(mode);
- ret = fegetenv(penv);
- ret = feholdexcept(penv);
- ret = fesetenv(penv);
- ret = feupdateenv(penv);
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_cxx_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_c99_fenv_tr1=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_c99_fenv_tr1=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
- fi
- echo "$as_me:$LINENO: result: $ac_c99_fenv_tr1" >&5
-echo "${ECHO_T}$ac_c99_fenv_tr1" >&6
- if test x"$ac_c99_fenv_tr1" = x"yes"; then
-
-cat >>confdefs.h <<\_ACEOF
-#define _GLIBCXX_USE_C99_FENV_TR1 1
-_ACEOF
-
- fi
-
- # Check for the existence of <stdint.h> types.
- echo "$as_me:$LINENO: checking for ISO C99 support to TR1 in <stdint.h>" >&5
-echo $ECHO_N "checking for ISO C99 support to TR1 in <stdint.h>... $ECHO_C" >&6
- if test "${glibcxx_cv_c99_stdint_tr1+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdint.h>
-int
-main ()
-{
-typedef int8_t my_int8_t;
- typedef int16_t my_int16_t;
- typedef int32_t my_int32_t;
- typedef int64_t my_int64_t;
- typedef int_fast8_t my_int_fast8_t;
- typedef int_fast16_t my_int_fast16_t;
- typedef int_fast32_t my_int_fast32_t;
- typedef int_fast64_t my_int_fast64_t;
- typedef int_least8_t my_int_least8_t;
- typedef int_least16_t my_int_least16_t;
- typedef int_least32_t my_int_least32_t;
- typedef int_least64_t my_int_least64_t;
- typedef intmax_t my_intmax_t;
- typedef intptr_t my_intptr_t;
- typedef uint8_t my_uint8_t;
- typedef uint16_t my_uint16_t;
- typedef uint32_t my_uint32_t;
- typedef uint64_t my_uint64_t;
- typedef uint_fast8_t my_uint_fast8_t;
- typedef uint_fast16_t my_uint_fast16_t;
- typedef uint_fast32_t my_uint_fast32_t;
- typedef uint_fast64_t my_uint_fast64_t;
- typedef uint_least8_t my_uint_least8_t;
- typedef uint_least16_t my_uint_least16_t;
- typedef uint_least32_t my_uint_least32_t;
- typedef uint_least64_t my_uint_least64_t;
- typedef uintmax_t my_uintmax_t;
- typedef uintptr_t my_uintptr_t;
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_cxx_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- glibcxx_cv_c99_stdint_tr1=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-glibcxx_cv_c99_stdint_tr1=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-
-fi
-
- echo "$as_me:$LINENO: result: $glibcxx_cv_c99_stdint_tr1" >&5
-echo "${ECHO_T}$glibcxx_cv_c99_stdint_tr1" >&6
- if test x"$glibcxx_cv_c99_stdint_tr1" = x"yes"; then
-
-cat >>confdefs.h <<\_ACEOF
-#define _GLIBCXX_USE_C99_STDINT_TR1 1
-_ACEOF
-
- fi
-
- # Check for the existence of <math.h> functions.
- echo "$as_me:$LINENO: checking for ISO C99 support to TR1 in <math.h>" >&5
-echo $ECHO_N "checking for ISO C99 support to TR1 in <math.h>... $ECHO_C" >&6
- if test "${glibcxx_cv_c99_math_tr1+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <math.h>
-int
-main ()
-{
-typedef double_t my_double_t;
- typedef float_t my_float_t;
- acosh(0.0);
- acoshf(0.0f);
- acoshl(0.0l);
- asinh(0.0);
- asinhf(0.0f);
- asinhl(0.0l);
- atanh(0.0);
- atanhf(0.0f);
- atanhl(0.0l);
- cbrt(0.0);
- cbrtf(0.0f);
- cbrtl(0.0l);
- copysign(0.0, 0.0);
- copysignf(0.0f, 0.0f);
- copysignl(0.0l, 0.0l);
- erf(0.0);
- erff(0.0f);
- erfl(0.0l);
- erfc(0.0);
- erfcf(0.0f);
- erfcl(0.0l);
- exp2(0.0);
- exp2f(0.0f);
- exp2l(0.0l);
- expm1(0.0);
- expm1f(0.0f);
- expm1l(0.0l);
- fdim(0.0, 0.0);
- fdimf(0.0f, 0.0f);
- fdiml(0.0l, 0.0l);
- fma(0.0, 0.0, 0.0);
- fmaf(0.0f, 0.0f, 0.0f);
- fmal(0.0l, 0.0l, 0.0l);
- fmax(0.0, 0.0);
- fmaxf(0.0f, 0.0f);
- fmaxl(0.0l, 0.0l);
- fmin(0.0, 0.0);
- fminf(0.0f, 0.0f);
- fminl(0.0l, 0.0l);
- hypot(0.0, 0.0);
- hypotf(0.0f, 0.0f);
- hypotl(0.0l, 0.0l);
- ilogb(0.0);
- ilogbf(0.0f);
- ilogbl(0.0l);
- lgamma(0.0);
- lgammaf(0.0f);
- lgammal(0.0l);
- llrint(0.0);
- llrintf(0.0f);
- llrintl(0.0l);
- llround(0.0);
- llroundf(0.0f);
- llroundl(0.0l);
- log1p(0.0);
- log1pf(0.0f);
- log1pl(0.0l);
- log2(0.0);
- log2f(0.0f);
- log2l(0.0l);
- logb(0.0);
- logbf(0.0f);
- logbl(0.0l);
- lrint(0.0);
- lrintf(0.0f);
- lrintl(0.0l);
- lround(0.0);
- lroundf(0.0f);
- lroundl(0.0l);
- nan(0);
- nanf(0);
- nanl(0);
- nearbyint(0.0);
- nearbyintf(0.0f);
- nearbyintl(0.0l);
- nextafter(0.0, 0.0);
- nextafterf(0.0f, 0.0f);
- nextafterl(0.0l, 0.0l);
- nexttoward(0.0, 0.0);
- nexttowardf(0.0f, 0.0f);
- nexttowardl(0.0l, 0.0l);
- remainder(0.0, 0.0);
- remainderf(0.0f, 0.0f);
- remainderl(0.0l, 0.0l);
- remquo(0.0, 0.0, 0);
- remquo(0.0f, 0.0f, 0);
- remquo(0.0l, 0.0l, 0);
- rint(0.0);
- rintf(0.0f);
- rintl(0.0l);
- round(0.0);
- roundf(0.0f);
- roundl(0.0l);
- scalbln(0.0, 0l);
- scalblnf(0.0f, 0l);
- scalblnl(0.0l, 0l);
- scalbn(0.0, 0);
- scalbnf(0.0f, 0);
- scalbnl(0.0l, 0);
- tgamma(0.0);
- tgammaf(0.0f);
- tgammal(0.0l);
- trunc(0.0);
- truncf(0.0f);
- truncl(0.0l);
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_cxx_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- glibcxx_cv_c99_math_tr1=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-glibcxx_cv_c99_math_tr1=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-
-fi
-
- echo "$as_me:$LINENO: result: $glibcxx_cv_c99_math_tr1" >&5
-echo "${ECHO_T}$glibcxx_cv_c99_math_tr1" >&6
- if test x"$glibcxx_cv_c99_math_tr1" = x"yes"; then
-
-cat >>confdefs.h <<\_ACEOF
-#define _GLIBCXX_USE_C99_MATH_TR1 1
-_ACEOF
-
- fi
-
- # Check for the existence of <inttypes.h> functions (NB: doesn't make
- # sense if the previous check fails, per C99, 7.8/1).
- ac_c99_inttypes_tr1=no;
- if test x"$glibcxx_cv_c99_stdint_tr1" = x"yes"; then
- echo "$as_me:$LINENO: checking for ISO C99 support to TR1 in <inttypes.h>" >&5
-echo $ECHO_N "checking for ISO C99 support to TR1 in <inttypes.h>... $ECHO_C" >&6
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <inttypes.h>
-int
-main ()
-{
-intmax_t i, numer, denom, base;
- const char* s;
- char** endptr;
- intmax_t ret = imaxabs(i);
- imaxdiv_t dret = imaxdiv(numer, denom);
- ret = strtoimax(s, endptr, base);
- uintmax_t uret = strtoumax(s, endptr, base);
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_cxx_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_c99_inttypes_tr1=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_c99_inttypes_tr1=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
- fi
- echo "$as_me:$LINENO: result: $ac_c99_inttypes_tr1" >&5
-echo "${ECHO_T}$ac_c99_inttypes_tr1" >&6
- if test x"$ac_c99_inttypes_tr1" = x"yes"; then
-
-cat >>confdefs.h <<\_ACEOF
-#define _GLIBCXX_USE_C99_INTTYPES_TR1 1
-_ACEOF
-
- fi
-
- # Check for the existence of the <stdbool.h> header.
-
-for ac_header in stdbool.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_cxx_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_cxx_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ----------------------------------------- ##
-## Report this to the package-unused lists. ##
-## ----------------------------------------- ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
- CXXFLAGS="$ac_save_CXXFLAGS"
- ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-
cat >>confdefs.h <<\_ACEOF
#define _GLIBCXX_USE_RANDOM_TR1 1
_ACEOF
@@ -110212,64 +109522,6 @@ fi
- # Check for sigsetjmp
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <setjmp.h>
-int
-main ()
-{
-sigjmp_buf env;
- while (! sigsetjmp (env, 1))
- siglongjmp (env, 1);
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_SIGSETJMP 1
-_ACEOF
-
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-
- cat >>confdefs.h <<\_ACEOF
-#define HAVE_MMAP 1
-_ACEOF
-
-
# For iconv support.
@@ -114663,14 +113915,6 @@ echo "${ECHO_T}$ac_ld_relro" >&6
cat >>confdefs.h <<\_ACEOF
-#define HAVE_GETPAGESIZE 1
-_ACEOF
-
- cat >>confdefs.h <<\_ACEOF
-#define HAVE_SIGSETJMP 1
-_ACEOF
-
- cat >>confdefs.h <<\_ACEOF
#define HAVE_MBSTATE_T 1
_ACEOF
@@ -114694,10 +113938,6 @@ _ACEOF
#define HAVE_FPCLASS 1
_ACEOF
- cat >>confdefs.h <<\_ACEOF
-#define HAVE_GETPAGESIZE 1
-_ACEOF
-
# All of the dependencies for wide character support are here, so
# turn it on.
cat >>confdefs.h <<\_ACEOF
@@ -114822,10 +114062,6 @@ _ACEOF
;;
esac
cat >>confdefs.h <<\_ACEOF
-#define HAVE_MMAP 1
-_ACEOF
-
- cat >>confdefs.h <<\_ACEOF
#define HAVE_COPYSIGN 1
_ACEOF
@@ -115767,10 +115003,6 @@ _ACEOF
;;
*-vxworks)
cat >>confdefs.h <<\_ACEOF
-#define HAVE_MMAP 1
-_ACEOF
-
- cat >>confdefs.h <<\_ACEOF
#define HAVE_ACOSF 1
_ACEOF
@@ -121974,6 +121206,7 @@ s,@EXTRA_CXX_FLAGS@,$EXTRA_CXX_FLAGS,;t t
s,@SECTION_LDFLAGS@,$SECTION_LDFLAGS,;t t
s,@OPT_LDFLAGS@,$OPT_LDFLAGS,;t t
s,@LIBMATHOBJS@,$LIBMATHOBJS,;t t
+s,@GLIBCXX_LIBS@,$GLIBCXX_LIBS,;t t
s,@LIBICONV@,$LIBICONV,;t t
s,@LTLIBICONV@,$LTLIBICONV,;t t
s,@SYMVER_FILE@,$SYMVER_FILE,;t t
diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
index 19501aac1be..8f984349292 100644
--- a/libstdc++-v3/configure.ac
+++ b/libstdc++-v3/configure.ac
@@ -122,6 +122,14 @@ GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING([no])
# Checks for operating systems support that don't require linking.
GLIBCXX_CHECK_SYSTEM_ERROR
+# For the streamoff typedef.
+GLIBCXX_CHECK_INT64_T
+
+# For C99 support to TR1.
+GLIBCXX_CHECK_C99_TR1
+
+# For common values of EOF, SEEK_CUR, SEEK_END.
+GLIBCXX_CHECK_STDIO_MACROS
# Only do link tests if native. Else, hardcode.
if $GLIBCXX_IS_NATIVE; then
@@ -149,18 +157,18 @@ if $GLIBCXX_IS_NATIVE; then
AC_CHECK_HEADERS(sys/uio.h)
GLIBCXX_CHECK_WRITEV
- # For the __streamoff_base_type typedef.
- GLIBCXX_CHECK_INT64_T
-
# For LFS support.
GLIBCXX_CHECK_LFS
- # For C99 support to TR1.
- GLIBCXX_CHECK_C99_TR1
-
# For dev/random and dev/urandom for TR1.
GLIBCXX_CHECK_RANDOM_TR1
+ # For clock_gettime support.
+ GLIBCXX_CHECK_CLOCK_GETTIME
+
+ # For gettimeofday support.
+ GLIBCXX_CHECK_GETTIMEOFDAY
+
# For TLS support.
GCC_CHECK_TLS
@@ -169,16 +177,6 @@ if $GLIBCXX_IS_NATIVE; then
AC_LC_MESSAGES
- AC_TRY_COMPILE(
- [#include <setjmp.h>],
- [sigjmp_buf env;
- while (! sigsetjmp (env, 1))
- siglongjmp (env, 1);
- ],
- [AC_DEFINE(HAVE_SIGSETJMP, 1, [Define if sigsetjmp is available.])])
-
- AC_FUNC_MMAP
-
# For iconv support.
AM_ICONV
@@ -221,8 +219,6 @@ else
# GLIBCXX_CHECK_STDLIB_SUPPORT
AC_DEFINE(HAVE_STRTOF)
- # AC_FUNC_MMAP
- AC_DEFINE(HAVE_MMAP)
AC_DEFINE(HAVE_ACOSF)
AC_DEFINE(HAVE_ASINF)
diff --git a/libstdc++-v3/configure.host b/libstdc++-v3/configure.host
index f2c75db7195..e368a99926d 100644
--- a/libstdc++-v3/configure.host
+++ b/libstdc++-v3/configure.host
@@ -308,6 +308,11 @@ case "${host}" in
abi_baseline_pair=${try_cpu}-linux-gnu
fi
esac
+ case "${host}" in
+ arm*-*-linux-*eabi)
+ port_specific_symbol_files="\$(srcdir)/../config/os/gnu-linux/arm-eabi-extra.ver"
+ ;;
+ esac
;;
powerpc*-*-darwin*)
port_specific_symbol_files="\$(srcdir)/../config/os/bsd/darwin/ppc-extra.ver"
diff --git a/libstdc++-v3/crossconfig.m4 b/libstdc++-v3/crossconfig.m4
index 6bac0330037..a38a4c306a1 100644
--- a/libstdc++-v3/crossconfig.m4
+++ b/libstdc++-v3/crossconfig.m4
@@ -24,10 +24,7 @@ case "${host}" in
GLIBCXX_CHECK_COMPLEX_MATH_SUPPORT
GLIBCXX_CHECK_STDLIB_SUPPORT
GLIBCXX_CHECK_S_ISREG_OR_S_IFREG
- AC_DEFINE(HAVE_SIGSETJMP)
- AC_DEFINE(HAVE_GETPAGESIZE)
AC_DEFINE(HAVE_WRITEV)
- AC_DEFINE(HAVE_INT64_T)
AC_DEFINE(HAVE_LIBM)
AC_DEFINE(HAVE_COPYSIGN)
@@ -65,16 +62,6 @@ case "${host}" in
GLIBCXX_CHECK_WRITEV
AC_DEFINE(HAVE_LC_MESSAGES)
-
- AC_TRY_COMPILE(
- [#include <setjmp.h>],
- [sigjmp_buf env;
- while (! sigsetjmp (env, 1))
- siglongjmp (env, 1);
- ],
- [AC_DEFINE(HAVE_SIGSETJMP, 1, [Define if sigsetjmp is available.])])
-
- AC_DEFINE(HAVE_MMAP)
;;
*djgpp)
@@ -125,9 +112,7 @@ case "${host}" in
GLIBCXX_CHECK_LINKER_FEATURES
GLIBCXX_CHECK_COMPLEX_MATH_SUPPORT
AC_DEFINE(HAVE_LC_MESSAGES)
- AC_DEFINE(HAVE_GETPAGESIZE)
AC_DEFINE(HAVE_SETENV)
- AC_DEFINE(HAVE_SIGSETJMP)
AC_DEFINE(HAVE_COPYSIGN)
AC_DEFINE(HAVE_COPYSIGNF)
AC_DEFINE(HAVE_FINITEF)
@@ -139,7 +124,6 @@ case "${host}" in
AC_DEFINE(HAVE_ISNAN)
AC_DEFINE(HAVE_ISNANF)
- AC_DEFINE(HAVE_MMAP)
AC_DEFINE(HAVE_ACOSF)
AC_DEFINE(HAVE_ASINF)
AC_DEFINE(HAVE_ATAN2F)
@@ -208,7 +192,6 @@ case "${host}" in
GLIBCXX_CHECK_STDLIB_SUPPORT
# For LFS.
- AC_DEFINE(HAVE_INT64_T)
GLIBCXX_CHECK_LFS
# For showmanyc_helper().
@@ -220,24 +203,10 @@ case "${host}" in
AC_CHECK_HEADERS(sys/uio.h)
GLIBCXX_CHECK_WRITEV
- # For C99 support to TR1.
- GLIBCXX_CHECK_C99_TR1
-
AC_DEFINE(_GLIBCXX_USE_RANDOM_TR1)
AC_LC_MESSAGES
- # Check for sigsetjmp
- AC_TRY_COMPILE(
- [#include <setjmp.h>],
- [sigjmp_buf env;
- while (! sigsetjmp (env, 1))
- siglongjmp (env, 1);
- ],
- [AC_DEFINE(HAVE_SIGSETJMP, 1, [Define if sigsetjmp is available.])])
-
- AC_DEFINE(HAVE_MMAP)
-
# For iconv support.
AM_ICONV
;;
@@ -314,15 +283,12 @@ case "${host}" in
case "$target" in
*-solaris2.7 | *-solaris2.8 | *-solaris2.9 | *-solaris2.10)
GLIBCXX_CHECK_LINKER_FEATURES
- AC_DEFINE(HAVE_GETPAGESIZE)
- AC_DEFINE(HAVE_SIGSETJMP)
AC_DEFINE(HAVE_MBSTATE_T)
AC_DEFINE(HAVE_POLL)
AC_DEFINE(HAVE_S_ISREG)
AC_DEFINE(HAVE_LC_MESSAGES)
AC_DEFINE(HAVE_FINITE)
AC_DEFINE(HAVE_FPCLASS)
- AC_DEFINE(HAVE_GETPAGESIZE)
# All of the dependencies for wide character support are here, so
# turn it on.
AC_DEFINE(_GLIBCXX_USE_WCHAR_T)
@@ -365,7 +331,6 @@ case "${host}" in
AC_DEFINE(HAVE_STRTOLD)
;;
esac
- AC_DEFINE(HAVE_MMAP)
AC_DEFINE(HAVE_COPYSIGN)
AC_DEFINE(HAVE_ISNAN)
AC_DEFINE(HAVE_ISNANF)
@@ -399,7 +364,6 @@ case "${host}" in
fi
;;
*-vxworks)
- AC_DEFINE(HAVE_MMAP)
AC_DEFINE(HAVE_ACOSF)
AC_DEFINE(HAVE_ASINF)
AC_DEFINE(HAVE_ATAN2F)
diff --git a/libstdc++-v3/doc/Makefile.in b/libstdc++-v3/doc/Makefile.in
index 759dbbe20a0..87329416147 100644
--- a/libstdc++-v3/doc/Makefile.in
+++ b/libstdc++-v3/doc/Makefile.in
@@ -148,6 +148,7 @@ GLIBCXX_HOSTED_TRUE = @GLIBCXX_HOSTED_TRUE@
GLIBCXX_INCLUDES = @GLIBCXX_INCLUDES@
GLIBCXX_LDBL_COMPAT_FALSE = @GLIBCXX_LDBL_COMPAT_FALSE@
GLIBCXX_LDBL_COMPAT_TRUE = @GLIBCXX_LDBL_COMPAT_TRUE@
+GLIBCXX_LIBS = @GLIBCXX_LIBS@
GREP = @GREP@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
diff --git a/libstdc++-v3/doc/doxygen/doxygroups.cc b/libstdc++-v3/doc/doxygen/doxygroups.cc
index d0adec9e5fb..d94c9e50b3e 100644
--- a/libstdc++-v3/doc/doxygen/doxygroups.cc
+++ b/libstdc++-v3/doc/doxygen/doxygroups.cc
@@ -28,12 +28,15 @@
/** @namespace std::tr1::__detail
* @brief Implementation details not part of the namespace std::tr1 interface.
*/
-/** @namespace std::regex_constants
- * @brief ISO C++ 0x entities sub namespace for regex.
+/** @namespace std::chrono
+ * @brief ISO C++ 0x entities sub namespace for time and date.
*/
/** @namespace std::placeholders
* @brief ISO C++ 0x entities sub namespace for functional.
*/
+/** @namespace std::regex_constants
+ * @brief ISO C++ 0x entities sub namespace for regex.
+*/
/** @namespace std::this_thread
* @brief ISO C++ 0x entities sub namespace for thread.
*/
diff --git a/libstdc++-v3/doc/doxygen/user.cfg.in b/libstdc++-v3/doc/doxygen/user.cfg.in
index 3c59dcbb831..23204850e11 100644
--- a/libstdc++-v3/doc/doxygen/user.cfg.in
+++ b/libstdc++-v3/doc/doxygen/user.cfg.in
@@ -463,13 +463,15 @@ WARN_LOGFILE =
INPUT = @srcdir@/libsupc++/cxxabi.h \
@srcdir@/libsupc++/cxxabi-forced.h \
@srcdir@/libsupc++/exception \
+ @srcdir@/libsupc++/initializer_list \
@srcdir@/libsupc++/new \
@srcdir@/libsupc++/typeinfo \
include/algorithm \
include/array \
include/bitset \
+ include/chrono \
+ include/complex \
include/condition_variable \
- include/date_time \
include/deque \
include/fstream \
include/functional \
@@ -489,6 +491,7 @@ INPUT = @srcdir@/libsupc++/cxxabi.h \
include/ostream \
include/queue \
include/random \
+ include/ratio \
include/regex \
include/set \
include/sstream \
@@ -1167,6 +1170,7 @@ INCLUDE_FILE_PATTERNS =
PREDEFINED = __cplusplus \
__GTHREADS \
+ __GXX_EXPERIMENTAL_CXX0X__ \
"_GLIBCXX_STD_P= " \
"_GLIBCXX_STD_D= " \
_GLIBCXX_STD=std \
@@ -1182,16 +1186,18 @@ PREDEFINED = __cplusplus \
_GLIBCXX_DEPRECATED \
_GLIBCXX_USE_WCHAR_T \
_GLIBCXX_USE_LONG_LONG \
+ _GLIBCXX_USE_C99_STDINT_TR1 \
__glibcxx_function_requires=// \
__glibcxx_class_requires=// \
__glibcxx_class_requires2=// \
__glibcxx_class_requires3=// \
__glibcxx_class_requires4=//
-# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
-# this tag can be used to specify a list of macro names that should be expanded.
-# The macro definition that is found in the sources will be used.
-# Use the PREDEFINED tag if you want to use a different macro definition.
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES
+# then this tag can be used to specify a list of macro names that
+# should be expanded. The macro definition that is found in the
+# sources will be used. Use the PREDEFINED tag if you want to use a
+# different macro definition.
EXPAND_AS_DEFINED =
diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am
index 11f03ef1707..f1440d520b4 100644
--- a/libstdc++-v3/include/Makefile.am
+++ b/libstdc++-v3/include/Makefile.am
@@ -32,6 +32,7 @@ std_headers = \
${std_srcdir}/array \
${std_srcdir}/bitset \
${std_srcdir}/c++0x_warning.h \
+ ${std_srcdir}/chrono \
${std_srcdir}/complex \
${std_srcdir}/condition_variable \
${std_srcdir}/deque \
diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in
index 20550e4147e..08d28a40c21 100644
--- a/libstdc++-v3/include/Makefile.in
+++ b/libstdc++-v3/include/Makefile.in
@@ -148,6 +148,7 @@ GLIBCXX_HOSTED_TRUE = @GLIBCXX_HOSTED_TRUE@
GLIBCXX_INCLUDES = @GLIBCXX_INCLUDES@
GLIBCXX_LDBL_COMPAT_FALSE = @GLIBCXX_LDBL_COMPAT_FALSE@
GLIBCXX_LDBL_COMPAT_TRUE = @GLIBCXX_LDBL_COMPAT_TRUE@
+GLIBCXX_LIBS = @GLIBCXX_LIBS@
GREP = @GREP@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -285,6 +286,7 @@ std_headers = \
${std_srcdir}/array \
${std_srcdir}/bitset \
${std_srcdir}/c++0x_warning.h \
+ ${std_srcdir}/chrono \
${std_srcdir}/complex \
${std_srcdir}/condition_variable \
${std_srcdir}/deque \
diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h
index 19c79d11cf7..de4cf80234d 100644
--- a/libstdc++-v3/include/bits/basic_string.h
+++ b/libstdc++-v3/include/bits/basic_string.h
@@ -45,6 +45,7 @@
#include <ext/atomicity.h>
#include <debug/debug.h>
+#include <initializer_list>
_GLIBCXX_BEGIN_NAMESPACE(std)
@@ -477,6 +478,15 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
*/
basic_string(size_type __n, _CharT __c, const _Alloc& __a = _Alloc());
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Construct string from an initializer list.
+ * @param l std::initializer_list of characters.
+ * @param a Allocator to use (default is default allocator).
+ */
+ basic_string(initializer_list<_CharT> __l, const _Alloc& __a = _Alloc());
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
/**
* @brief Construct string as copy of a range.
* @param beg Start of range.
@@ -523,6 +533,19 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
return *this;
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Set value to string constructed from initializer list.
+ * @param l std::initializer_list.
+ */
+ basic_string&
+ operator=(initializer_list<_CharT> __l)
+ {
+ this->assign (__l.begin(), __l.end());
+ return *this;
+ }
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
// Iterators:
/**
* Returns a read/write iterator that points to the first character in
@@ -794,6 +817,17 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
return *this;
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Append an initializer_list of characters.
+ * @param l The initializer_list of characters to be appended.
+ * @return Reference to this string.
+ */
+ basic_string&
+ operator+=(initializer_list<_CharT> __l)
+ { return this->append(__l.begin(), __l.end()); }
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
/**
* @brief Append a string to this string.
* @param str The string to append.
@@ -849,6 +883,17 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
basic_string&
append(size_type __n, _CharT __c);
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Append an initializer_list of characters.
+ * @param l The initializer_list of characters to append.
+ * @return Reference to this string.
+ */
+ basic_string&
+ append(initializer_list<_CharT> __l)
+ { return this->append(__l.begin(), __l.end()); }
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
/**
* @brief Append a range of characters.
* @param first Iterator referencing the first character to append.
@@ -957,6 +1002,17 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
assign(_InputIterator __first, _InputIterator __last)
{ return this->replace(_M_ibegin(), _M_iend(), __first, __last); }
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Set value to an initializer_list of characters.
+ * @param l The initializer_list of characters to assign.
+ * @return Reference to this string.
+ */
+ basic_string&
+ assign(initializer_list<_CharT> __l)
+ { return this->assign(__l.begin(), __l.end()); }
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
/**
* @brief Insert multiple characters.
* @param p Iterator referencing location in string to insert at.
@@ -989,6 +1045,18 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
insert(iterator __p, _InputIterator __beg, _InputIterator __end)
{ this->replace(__p, __p, __beg, __end); }
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Insert an initializer_list of characters.
+ * @param p Iterator referencing location in string to insert at.
+ * @param l The initializer_list of characters to insert.
+ * @throw std::length_error If new length exceeds @c max_size().
+ */
+ void
+ insert(iterator __p, initializer_list<_CharT> __l)
+ { this->insert(__p, __l.begin(), __l.end()); }
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
/**
* @brief Insert value of a string.
* @param pos1 Iterator referencing location in string to insert at.
@@ -1434,6 +1502,25 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__k1.base(), __k2 - __k1);
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Replace range of characters with initializer_list.
+ * @param i1 Iterator referencing start of range to replace.
+ * @param i2 Iterator referencing end of range to replace.
+ * @param l The initializer_list of characters to insert.
+ * @return Reference to this string.
+ * @throw std::length_error If new length exceeds @c max_size().
+ *
+ * Removes the characters in the range [i1,i2). In place, characters
+ * in the range [k1,k2) are inserted. If the length of result exceeds
+ * max_size(), length_error is thrown. The value of the string doesn't
+ * change if an error is thrown.
+ */
+ basic_string& replace(iterator __i1, iterator __i2,
+ initializer_list<_CharT> __l)
+ { return this->replace(__i1, __i2, __l.begin(), __l.end()); }
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
private:
template<class _Integer>
basic_string&
diff --git a/libstdc++-v3/include/bits/basic_string.tcc b/libstdc++-v3/include/bits/basic_string.tcc
index 062b02b5982..3201e361830 100644
--- a/libstdc++-v3/include/bits/basic_string.tcc
+++ b/libstdc++-v3/include/bits/basic_string.tcc
@@ -235,6 +235,14 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
: _M_dataplus(_S_construct(__beg, __end, __a), __a)
{ }
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT, _Traits, _Alloc>::
+ basic_string(initializer_list<_CharT> __l, const _Alloc& __a)
+ : _M_dataplus(_S_construct(__l.begin(), __l.end(), __a), __a)
+ { }
+#endif
+
template<typename _CharT, typename _Traits, typename _Alloc>
basic_string<_CharT, _Traits, _Alloc>&
basic_string<_CharT, _Traits, _Alloc>::
@@ -1104,7 +1112,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
// Inhibit implicit instantiations for required instantiations,
// which are defined via explicit instantiations elsewhere.
// NB: This syntax is a GNU extension.
-#if _GLIBCXX_EXTERN_TEMPLATE
+#if _GLIBCXX_EXTERN_TEMPLATE > 0
extern template class basic_string<char>;
extern template
basic_istream<char>&
diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config
index 8f98caddbec..2f4fb6ae6a3 100644
--- a/libstdc++-v3/include/bits/c++config
+++ b/libstdc++-v3/include/bits/c++config
@@ -142,7 +142,7 @@
# define _GLIBCXX_STD __cxx1998
# define _GLIBCXX_BEGIN_NAMESPACE(X) namespace X _GLIBCXX_VISIBILITY_ATTR(default) {
# define _GLIBCXX_END_NAMESPACE }
-# define _GLIBCXX_EXTERN_TEMPLATE 0
+# define _GLIBCXX_EXTERN_TEMPLATE -1
# endif
// parallel
@@ -152,7 +152,7 @@
# define _GLIBCXX_STD __cxx1998
# define _GLIBCXX_BEGIN_NAMESPACE(X) namespace X _GLIBCXX_VISIBILITY_ATTR(default) {
# define _GLIBCXX_END_NAMESPACE }
-# define _GLIBCXX_EXTERN_TEMPLATE 0
+# define _GLIBCXX_EXTERN_TEMPLATE -1
# endif
// debug + parallel
@@ -162,7 +162,7 @@
# define _GLIBCXX_STD __cxx1998
# define _GLIBCXX_BEGIN_NAMESPACE(X) namespace X _GLIBCXX_VISIBILITY_ATTR(default) {
# define _GLIBCXX_END_NAMESPACE }
-# define _GLIBCXX_EXTERN_TEMPLATE 0
+# define _GLIBCXX_EXTERN_TEMPLATE -1
# endif
// profile
diff --git a/libstdc++-v3/include/bits/char_traits.h b/libstdc++-v3/include/bits/char_traits.h
index ae0f6cfbe09..52158efff33 100644
--- a/libstdc++-v3/include/bits/char_traits.h
+++ b/libstdc++-v3/include/bits/char_traits.h
@@ -1,7 +1,7 @@
// Character Traits for use by standard string and iostream -*- C++ -*-
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-// 2006, 2007
+// 2006, 2007, 2008
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -45,9 +45,15 @@
#include <bits/stl_algobase.h> // std::copy, std::fill_n
#include <bits/postypes.h> // For streampos
-#include <cstdio> // For EOF
#include <cwchar> // For WEOF, wmemmove, wmemset, etc.
+#ifndef _GLIBCXX_STDIO_MACROS
+# include <cstdio> // For EOF
+# define _CHAR_TRAITS_EOF EOF
+#else
+# define _CHAR_TRAITS_EOF (-1)
+#endif
+
_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
/**
@@ -138,7 +144,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
static int_type
eof()
- { return static_cast<int_type>(EOF); }
+ { return static_cast<int_type>(_CHAR_TRAITS_EOF); }
static int_type
not_eof(const int_type& __c)
@@ -292,7 +298,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{ return __c1 == __c2; }
static int_type
- eof() { return static_cast<int_type>(EOF); }
+ eof() { return static_cast<int_type>(_CHAR_TRAITS_EOF); }
static int_type
not_eof(const int_type& __c)
@@ -368,4 +374,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_GLIBCXX_END_NAMESPACE
+#undef _CHAR_TRAITS_EOF
+
#endif
diff --git a/libstdc++-v3/include/bits/ios_base.h b/libstdc++-v3/include/bits/ios_base.h
index 95a3d2b9104..6e2cef6a342 100644
--- a/libstdc++-v3/include/bits/ios_base.h
+++ b/libstdc++-v3/include/bits/ios_base.h
@@ -46,7 +46,15 @@
#include <ext/atomicity.h>
#include <bits/localefwd.h>
#include <bits/locale_classes.h>
-#include <cstdio> // For SEEK_CUR, SEEK_END
+
+#ifndef _GLIBCXX_STDIO_MACROS
+# include <cstdio> // For SEEK_CUR, SEEK_END
+# define _IOS_BASE_SEEK_CUR SEEK_CUR
+# define _IOS_BASE_SEEK_END SEEK_END
+#else
+# define _IOS_BASE_SEEK_CUR 1
+# define _IOS_BASE_SEEK_END 2
+#endif
_GLIBCXX_BEGIN_NAMESPACE(std)
@@ -186,8 +194,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
enum _Ios_Seekdir
{
_S_beg = 0,
- _S_cur = SEEK_CUR,
- _S_end = SEEK_END,
+ _S_cur = _IOS_BASE_SEEK_CUR,
+ _S_end = _IOS_BASE_SEEK_END,
_S_ios_seekdir_end = 1L << 16
};
@@ -968,5 +976,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_GLIBCXX_END_NAMESPACE
+#undef _IOS_BASE_SEEK_CUR
+#undef _IOS_BASE_SEEK_END
+
#endif /* _IOS_BASE_H */
diff --git a/libstdc++-v3/include/bits/postypes.h b/libstdc++-v3/include/bits/postypes.h
index 5ead488fa48..1bc972af187 100644
--- a/libstdc++-v3/include/bits/postypes.h
+++ b/libstdc++-v3/include/bits/postypes.h
@@ -46,6 +46,20 @@
#include <cwchar> // For mbstate_t
+// XXX If <stdint.h> is really needed, make sure to define the macros,
+// in order not to break <tr1/cstdint> (and <cstdint> in C++0x).
+// Reconsider all this as soon as possible...
+#if (defined(_GLIBCXX_HAVE_INT64_T) && !defined(_GLIBCXX_HAVE_INT64_T_LONG) \
+ && !defined(_GLIBCXX_HAVE_INT64_T_LONG_LONG))
+#ifndef __STDC_LIMIT_MACROS
+# define __STDC_LIMIT_MACROS
+#endif
+#ifndef __STDC_CONSTANT_MACROS
+# define __STDC_CONSTANT_MACROS
+#endif
+#include <stdint.h> // For int64_t
+#endif
+
_GLIBCXX_BEGIN_NAMESPACE(std)
// The types streamoff, streampos and wstreampos and the class
@@ -63,12 +77,12 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
* Note: In versions of GCC up to and including GCC 3.3, streamoff
* was typedef long.
*/
-#ifdef _GLIBCXX_HAVE_INT64_T
-# if (__CHAR_BIT__ * __SIZEOF_LONG__ == 64)
+#ifdef _GLIBCXX_HAVE_INT64_T_LONG
typedef long streamoff;
-# else
+#elif defined(_GLIBCXX_HAVE_INT64_T_LONG_LONG)
typedef long long streamoff;
-# endif
+#elif defined(_GLIBCXX_HAVE_INT64_T)
+ typedef int64_t streamoff;
#else
typedef long long streamoff;
#endif
diff --git a/libstdc++-v3/include/bits/stl_bvector.h b/libstdc++-v3/include/bits/stl_bvector.h
index 045f20378a6..4409d9c3665 100644
--- a/libstdc++-v3/include/bits/stl_bvector.h
+++ b/libstdc++-v3/include/bits/stl_bvector.h
@@ -1,6 +1,6 @@
// vector<bool> specialization -*- C++ -*-
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -62,6 +62,8 @@
#ifndef _STL_BVECTOR_H
#define _STL_BVECTOR_H 1
+#include <initializer_list>
+
_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
typedef unsigned long _Bit_type;
@@ -529,6 +531,14 @@ template<typename _Alloc>
#ifdef __GXX_EXPERIMENTAL_CXX0X__
vector(vector&& __x)
: _Base(std::forward<_Base>(__x)) { }
+
+ vector(initializer_list<bool> __l,
+ const allocator_type& __a = allocator_type())
+ : _Base(__a)
+ {
+ _M_initialize_range(__l.begin(), __l.end(),
+ random_access_iterator_tag());
+ }
#endif
template<typename _InputIterator>
@@ -566,6 +576,13 @@ template<typename _Alloc>
this->swap(__x);
return *this;
}
+
+ vector&
+ operator=(initializer_list<bool> __l)
+ {
+ this->assign (__l.begin(), __l.end());
+ return *this;
+ }
#endif
// assign(), a generalized assignment member function. Two
@@ -584,6 +601,12 @@ template<typename _Alloc>
_M_assign_dispatch(__first, __last, _Integral());
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ void
+ assign(initializer_list<bool> __l)
+ { this->assign(__l.begin(), __l.end()); }
+#endif
+
iterator
begin()
{ return this->_M_impl._M_start; }
@@ -777,6 +800,11 @@ template<typename _Alloc>
insert(iterator __position, size_type __n, const bool& __x)
{ _M_fill_insert(__position, __n, __x); }
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ void insert(iterator __p, initializer_list<bool> __l)
+ { this->insert(__p, __l.begin(), __l.end()); }
+#endif
+
void
pop_back()
{ --this->_M_impl._M_finish; }
diff --git a/libstdc++-v3/include/bits/stl_deque.h b/libstdc++-v3/include/bits/stl_deque.h
index b778f15a075..070fc078909 100644
--- a/libstdc++-v3/include/bits/stl_deque.h
+++ b/libstdc++-v3/include/bits/stl_deque.h
@@ -65,6 +65,7 @@
#include <bits/concept_check.h>
#include <bits/stl_iterator_base_types.h>
#include <bits/stl_iterator_base_funcs.h>
+#include <initializer_list>
_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
@@ -740,6 +741,25 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
*/
deque(deque&& __x)
: _Base(std::forward<_Base>(__x)) { }
+
+ /**
+ * @brief Builds a %deque from an initializer list.
+ * @param l An initializer_list.
+ * @param a An allocator object.
+ *
+ * Create a %deque consisting of copies of the elements in the
+ * initializer_list @a l.
+ *
+ * This will call the element type's copy constructor N times
+ * (where N is l.size()) and do no memory reallocation.
+ */
+ deque(initializer_list<value_type> __l,
+ const allocator_type& __a = allocator_type())
+ : _Base(__a)
+ {
+ _M_range_initialize(__l.begin(), __l.end(),
+ random_access_iterator_tag());
+ }
#endif
/**
@@ -801,6 +821,24 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
this->swap(__x);
return *this;
}
+
+ /**
+ * @brief Assigns an initializer list to a %deque.
+ * @param l An initializer_list.
+ *
+ * This function fills a %deque with copies of the elements in the
+ * initializer_list @a l.
+ *
+ * Note that the assignment completely changes the %deque and that the
+ * resulting %deque's size is the same as the number of elements
+ * assigned. Old data may be lost.
+ */
+ deque&
+ operator=(initializer_list<value_type> __l)
+ {
+ this->assign(__l.begin(), __l.end());
+ return *this;
+ }
#endif
/**
@@ -837,6 +875,23 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
_M_assign_dispatch(__first, __last, _Integral());
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Assigns an initializer list to a %deque.
+ * @param l An initializer_list.
+ *
+ * This function fills a %deque with copies of the elements in the
+ * initializer_list @a l.
+ *
+ * Note that the assignment completely changes the %deque and that the
+ * resulting %deque's size is the same as the number of elements
+ * assigned. Old data may be lost.
+ */
+ void
+ assign(initializer_list<value_type> __l)
+ { this->assign(__l.begin(), __l.end()); }
+#endif
+
/// Get a copy of the memory allocation object.
allocator_type
get_allocator() const
@@ -1253,6 +1308,19 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
iterator
insert(iterator __position, value_type&& __x)
{ return emplace(__position, std::move(__x)); }
+
+ /**
+ * @brief Inserts an initializer list into the %deque.
+ * @param p An iterator into the %deque.
+ * @param l An initializer_list.
+ *
+ * This function will insert copies of the data in the
+ * initializer_list @a l into the %deque before the location
+ * specified by @a p. This is known as "list insert."
+ */
+ void
+ insert(iterator __p, initializer_list<value_type> __l)
+ { this->insert(__p, __l.begin(), __l.end()); }
#endif
/**
diff --git a/libstdc++-v3/include/bits/stl_list.h b/libstdc++-v3/include/bits/stl_list.h
index 08fb89ef117..91c339c1746 100644
--- a/libstdc++-v3/include/bits/stl_list.h
+++ b/libstdc++-v3/include/bits/stl_list.h
@@ -63,6 +63,7 @@
#define _STL_LIST_H 1
#include <bits/concept_check.h>
+#include <initializer_list>
_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
@@ -541,6 +542,19 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
*/
list(list&& __x)
: _Base(std::forward<_Base>(__x)) { }
+
+ /**
+ * @brief Builds a %list from an initializer_list
+ * @param l An initializer_list of value_type.
+ * @param a An allocator object.
+ *
+ * Create a %list consisting of copies of the elements in the
+ * initializer_list @a l. This is linear in l.size().
+ */
+ list(initializer_list<value_type> __l,
+ const allocator_type& __a = allocator_type())
+ : _Base(__a)
+ { _M_initialize_dispatch(__l.begin(), __l.end(), __false_type()); }
#endif
/**
@@ -597,6 +611,20 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
this->swap(__x);
return *this;
}
+
+ /**
+ * @brief %List initializer list assignment operator.
+ * @param l An initializer_list of value_type.
+ *
+ * Replace the contents of the %list with copies of the elements
+ * in the initializer_list @a l. This is linear in l.size().
+ */
+ list&
+ operator=(initializer_list<value_type> __l)
+ {
+ this->assign(__l.begin(), __l.end());
+ return *this;
+ }
#endif
/**
@@ -634,6 +662,19 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
_M_assign_dispatch(__first, __last, _Integral());
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Assigns an initializer_list to a %list.
+ * @param l An initializer_list of value_type.
+ *
+ * Replace the contents of the %list with copies of the elements
+ * in the initializer_list @a l. This is linear in l.size().
+ */
+ void
+ assign(initializer_list<value_type> __l)
+ { this->assign(__l.begin(), __l.end()); }
+#endif
+
/// Get a copy of the memory allocation object.
allocator_type
get_allocator() const
@@ -951,6 +992,23 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
iterator
insert(iterator __position, value_type&& __x)
{ return emplace(__position, std::move(__x)); }
+
+ /**
+ * @brief Inserts the contents of an initializer_list into %list
+ * before specified iterator.
+ * @param p An iterator into the %list.
+ * @param l An initializer_list of value_type.
+ *
+ * This function will insert copies of the data in the
+ * initializer_list @a l into the %list before the location
+ * specified by @a p.
+ *
+ * This operation is linear in the number of elements inserted and
+ * does not invalidate iterators and references.
+ */
+ void
+ insert(iterator __p, initializer_list<value_type> __l)
+ { this->insert(__p, __l.begin(), __l.end()); }
#endif
/**
diff --git a/libstdc++-v3/include/bits/stl_map.h b/libstdc++-v3/include/bits/stl_map.h
index cd85b9ab75d..3fe69c925d4 100644
--- a/libstdc++-v3/include/bits/stl_map.h
+++ b/libstdc++-v3/include/bits/stl_map.h
@@ -186,6 +186,23 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
*/
map(map&& __x)
: _M_t(std::forward<_Rep_type>(__x._M_t)) { }
+
+ /**
+ * @brief Builds a %map from an initializer_list.
+ * @param l An initializer_list.
+ * @param comp A comparison object.
+ * @param a An allocator object.
+ *
+ * Create a %map consisting of copies of the elements in the
+ * initializer_list @a l.
+ * This is linear in N if the range is already sorted, and NlogN
+ * otherwise (where N is @a l.size()).
+ */
+ map(initializer_list<value_type> __l,
+ const _Compare& __c = _Compare(),
+ const allocator_type& __a = allocator_type())
+ : _M_t(__c, __a)
+ { _M_t._M_insert_unique(__l.begin(), __l.end()); }
#endif
/**
@@ -259,6 +276,25 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
this->swap(__x);
return *this;
}
+
+ /**
+ * @brief %Map list assignment operator.
+ * @param l An initializer_list.
+ *
+ * This function fills a %map with copies of the elements in the
+ * initializer list @a l.
+ *
+ * Note that the assignment completely changes the %map and
+ * that the resulting %map's size is the same as the number
+ * of elements assigned. Old data may be lost.
+ */
+ map&
+ operator=(initializer_list<value_type> __l)
+ {
+ this->clear();
+ this->insert(__l.begin(), __l.end());
+ return *this;
+ }
#endif
/// Get a copy of the memory allocation object.
@@ -476,7 +512,6 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
* inserted.
*
* Complexity similar to that of the range constructor.
- *
*/
void
insert(std::initializer_list<value_type> __list)
diff --git a/libstdc++-v3/include/bits/stl_multimap.h b/libstdc++-v3/include/bits/stl_multimap.h
index ade2750170f..64a23b94920 100644
--- a/libstdc++-v3/include/bits/stl_multimap.h
+++ b/libstdc++-v3/include/bits/stl_multimap.h
@@ -63,6 +63,7 @@
#define _STL_MULTIMAP_H 1
#include <bits/concept_check.h>
+#include <initializer_list>
_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
@@ -183,6 +184,22 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
*/
multimap(multimap&& __x)
: _M_t(std::forward<_Rep_type>(__x._M_t)) { }
+
+ /**
+ * @brief Builds a %multimap from an initializer_list.
+ * @param l An initializer_list.
+ * @param comp A comparison functor.
+ * @param a An allocator object.
+ *
+ * Create a %multimap consisting of copies of the elements from
+ * the initializer_list. This is linear in N if the list is already
+ * sorted, and NlogN otherwise (where N is @a __l.size()).
+ */
+ multimap(initializer_list<value_type> __l,
+ const _Compare& __comp = _Compare(),
+ const allocator_type& __a = allocator_type())
+ : _M_t(__comp, __a)
+ { _M_t._M_insert_equal(__l.begin(), __l.end()); }
#endif
/**
@@ -256,6 +273,25 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
this->swap(__x);
return *this;
}
+
+ /**
+ * @brief %Multimap list assignment operator.
+ * @param l An initializer_list.
+ *
+ * This function fills a %multimap with copies of the elements
+ * in the initializer list @a l.
+ *
+ * Note that the assignment completely changes the %multimap and
+ * that the resulting %multimap's size is the same as the number
+ * of elements assigned. Old data may be lost.
+ */
+ multimap&
+ operator=(initializer_list<value_type> __l)
+ {
+ this->clear();
+ this->insert(__l.begin(), __l.end());
+ return *this;
+ }
#endif
/// Get a copy of the memory allocation object.
@@ -444,6 +480,19 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
insert(_InputIterator __first, _InputIterator __last)
{ _M_t._M_insert_equal(__first, __last); }
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Attempts to insert a list of std::pairs into the %multimap.
+ * @param list A std::initializer_list<value_type> of pairs to be
+ * inserted.
+ *
+ * Complexity similar to that of the range constructor.
+ */
+ void
+ insert(initializer_list<value_type> __l)
+ { this->insert(__l.begin(), __l.end()); }
+#endif
+
/**
* @brief Erases an element from a %multimap.
* @param position An iterator pointing to the element to be erased.
diff --git a/libstdc++-v3/include/bits/stl_multiset.h b/libstdc++-v3/include/bits/stl_multiset.h
index 2cdbdfe4cf3..18757551e5d 100644
--- a/libstdc++-v3/include/bits/stl_multiset.h
+++ b/libstdc++-v3/include/bits/stl_multiset.h
@@ -63,6 +63,7 @@
#define _STL_MULTISET_H 1
#include <bits/concept_check.h>
+#include <initializer_list>
_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
@@ -196,6 +197,22 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
*/
multiset(multiset&& __x)
: _M_t(std::forward<_Rep_type>(__x._M_t)) { }
+
+ /**
+ * @brief Builds a %multiset from an initializer_list.
+ * @param l An initializer_list.
+ * @param comp A comparison functor.
+ * @param a An allocator object.
+ *
+ * Create a %multiset consisting of copies of the elements from
+ * the list. This is linear in N if the list is already sorted,
+ * and NlogN otherwise (where N is @a l.size()).
+ */
+ multiset(initializer_list<value_type> __l,
+ const _Compare& __comp = _Compare(),
+ const allocator_type& __a = allocator_type())
+ : _M_t(__comp, __a)
+ { _M_t._M_insert_equal(__l.begin(), __l.end()); }
#endif
/**
@@ -228,6 +245,25 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
this->swap(__x);
return *this;
}
+
+ /**
+ * @brief %Multiset list assignment operator.
+ * @param l An initializer_list.
+ *
+ * This function fills a %multiset with copies of the elements in the
+ * initializer list @a l.
+ *
+ * Note that the assignment completely changes the %multiset and
+ * that the resulting %multiset's size is the same as the number
+ * of elements assigned. Old data may be lost.
+ */
+ multiset&
+ operator=(initializer_list<value_type> __l)
+ {
+ this->clear();
+ this->insert(__l.begin(), __l.end());
+ return *this;
+ }
#endif
// accessors:
@@ -406,6 +442,19 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
insert(_InputIterator __first, _InputIterator __last)
{ _M_t._M_insert_equal(__first, __last); }
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Attempts to insert a list of elements into the %multiset.
+ * @param list A std::initializer_list<value_type> of elements
+ * to be inserted.
+ *
+ * Complexity similar to that of the range constructor.
+ */
+ void
+ insert(initializer_list<value_type> __l)
+ { this->insert(__l.begin(), __l.end()); }
+#endif
+
/**
* @brief Erases an element from a %multiset.
* @param position An iterator pointing to the element to be erased.
diff --git a/libstdc++-v3/include/bits/stl_pair.h b/libstdc++-v3/include/bits/stl_pair.h
index 5ac85e25fa3..cf61b09945a 100644
--- a/libstdc++-v3/include/bits/stl_pair.h
+++ b/libstdc++-v3/include/bits/stl_pair.h
@@ -151,7 +151,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
{ return __x.first == __y.first && __x.second == __y.second; }
- /// <http://gcc.gnu.org/onlinedocs/libstdc++/20_util/howto.html#pairlt>
+ /// <http://gcc.gnu.org/onlinedocs/libstdc++/manual/utilities.html>
template<class _T1, class _T2>
inline bool
operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
diff --git a/libstdc++-v3/include/bits/stl_set.h b/libstdc++-v3/include/bits/stl_set.h
index 2ef51de858f..65dc13569da 100644
--- a/libstdc++-v3/include/bits/stl_set.h
+++ b/libstdc++-v3/include/bits/stl_set.h
@@ -63,6 +63,7 @@
#define _STL_SET_H 1
#include <bits/concept_check.h>
+#include <initializer_list>
_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
@@ -203,6 +204,22 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
*/
set(set&& __x)
: _M_t(std::forward<_Rep_type>(__x._M_t)) { }
+
+ /**
+ * @brief Builds a %set from an initializer_list.
+ * @param l An initializer_list.
+ * @param comp A comparison functor.
+ * @param a An allocator object.
+ *
+ * Create a %set consisting of copies of the elements in the list.
+ * This is linear in N if the list is already sorted, and NlogN
+ * otherwise (where N is @a l.size()).
+ */
+ set(initializer_list<value_type> __l,
+ const _Compare& __comp = _Compare(),
+ const allocator_type& __a = allocator_type())
+ : _M_t(__comp, __a)
+ { _M_t._M_insert_unique(__l.begin(), __l.end()); }
#endif
/**
@@ -235,6 +252,25 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
this->swap(__x);
return *this;
}
+
+ /**
+ * @brief %Set list assignment operator.
+ * @param l An initializer_list.
+ *
+ * This function fills a %set with copies of the elements in the
+ * initializer list @a l.
+ *
+ * Note that the assignment completely changes the %set and
+ * that the resulting %set's size is the same as the number
+ * of elements assigned. Old data may be lost.
+ */
+ set&
+ operator=(initializer_list<value_type> __l)
+ {
+ this->clear();
+ this->insert(__l.begin(), __l.end());
+ return *this;
+ }
#endif
// accessors:
@@ -418,6 +454,19 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
insert(_InputIterator __first, _InputIterator __last)
{ _M_t._M_insert_unique(__first, __last); }
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Attempts to insert a list of elements into the %set.
+ * @param list A std::initializer_list<value_type> of elements
+ * to be inserted.
+ *
+ * Complexity similar to that of the range constructor.
+ */
+ void
+ insert(initializer_list<value_type> __l)
+ { this->insert(__l.begin(), __l.end()); }
+#endif
+
/**
* @brief Erases an element from a %set.
* @param position An iterator pointing to the element to be erased.
diff --git a/libstdc++-v3/include/bits/stl_vector.h b/libstdc++-v3/include/bits/stl_vector.h
index aa874089d52..28222f408f3 100644
--- a/libstdc++-v3/include/bits/stl_vector.h
+++ b/libstdc++-v3/include/bits/stl_vector.h
@@ -65,6 +65,7 @@
#include <bits/stl_iterator_base_funcs.h>
#include <bits/functexcept.h>
#include <bits/concept_check.h>
+#include <initializer_list>
_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
@@ -262,6 +263,25 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
*/
vector(vector&& __x)
: _Base(std::forward<_Base>(__x)) { }
+
+ /**
+ * @brief Builds a %vector from an initializer list.
+ * @param l An initializer_list.
+ * @param a An allocator.
+ *
+ * Create a %vector consisting of copies of the elements in the
+ * initializer_list @a l.
+ *
+ * This will call the element type's copy constructor N times
+ * (where N is @a l.size()) and do no memory reallocation.
+ */
+ vector(initializer_list<value_type> __l,
+ const allocator_type& __a = allocator_type())
+ : _Base(__a)
+ {
+ _M_range_initialize(__l.begin(), __l.end(),
+ random_access_iterator_tag());
+ }
#endif
/**
@@ -327,6 +347,24 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
this->swap(__x);
return *this;
}
+
+ /**
+ * @brief %Vector list assignment operator.
+ * @param l An initializer_list.
+ *
+ * This function fills a %vector with copies of the elements in the
+ * initializer list @a l.
+ *
+ * Note that the assignment completely changes the %vector and
+ * that the resulting %vector's size is the same as the number
+ * of elements assigned. Old data may be lost.
+ */
+ vector&
+ operator=(initializer_list<value_type> __l)
+ {
+ this->assign(__l.begin(), __l.end());
+ return *this;
+ }
#endif
/**
@@ -364,6 +402,23 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
_M_assign_dispatch(__first, __last, _Integral());
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Assigns an initializer list to a %vector.
+ * @param l An initializer_list.
+ *
+ * This function fills a %vector with copies of the elements in the
+ * initializer list @a l.
+ *
+ * Note that the assignment completely changes the %vector and
+ * that the resulting %vector's size is the same as the number
+ * of elements assigned. Old data may be lost.
+ */
+ void
+ assign(initializer_list<value_type> __l)
+ { this->assign(__l.begin(), __l.end()); }
+#endif
+
/// Get a copy of the memory allocation object.
using _Base::get_allocator;
@@ -766,6 +821,23 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
iterator
insert(iterator __position, value_type&& __x)
{ return emplace(__position, std::move(__x)); }
+
+ /**
+ * @brief Inserts an initializer_list into the %vector.
+ * @param position An iterator into the %vector.
+ * @param l An initializer_list.
+ *
+ * This function will insert copies of the data in the
+ * initializer_list @a l into the %vector before the location
+ * specified by @a position.
+ *
+ * Note that this kind of operation could be expensive for a
+ * %vector and if it is frequently used the user should
+ * consider using std::list.
+ */
+ void
+ insert(iterator __position, initializer_list<value_type> __l)
+ { this->insert(__position, __l.begin(), __l.end()); }
#endif
/**
diff --git a/libstdc++-v3/include/bits/unique_ptr.h b/libstdc++-v3/include/bits/unique_ptr.h
index f2c13b5800a..ead0acf9515 100644
--- a/libstdc++-v3/include/bits/unique_ptr.h
+++ b/libstdc++-v3/include/bits/unique_ptr.h
@@ -47,6 +47,7 @@
_GLIBCXX_BEGIN_NAMESPACE(std)
+ /// Primary template, default_delete.
template<typename _Tp>
struct default_delete
{
@@ -66,6 +67,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// DR 740 - omit specialization for array objects with a compile time length
+ /// Specialization, default_delete.
template<typename _Tp>
struct default_delete<_Tp[]>
{
@@ -78,6 +80,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
}
};
+ /// 20.6.11.2 unique_ptr for single objects.
template <typename _Tp, typename _Tp_Deleter = default_delete<_Tp> >
class unique_ptr
{
@@ -224,7 +227,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__tuple_type _M_t;
};
- // 20.6.11.3 unique_ptr for array objects with a runtime length
+ /// 20.6.11.3 unique_ptr for array objects with a runtime length
// [unique.ptr.runtime]
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// DR 740 - omit specialization for array objects with a compile time length
diff --git a/libstdc++-v3/include/debug/deque b/libstdc++-v3/include/debug/deque
index c37381f084f..845e0dcaaf2 100644
--- a/libstdc++-v3/include/debug/deque
+++ b/libstdc++-v3/include/debug/deque
@@ -94,6 +94,10 @@ namespace __debug
deque(deque&& __x)
: _Base(std::forward<deque>(__x)), _Safe_base()
{ this->_M_swap(__x); }
+
+ deque(initializer_list<value_type> __l,
+ const allocator_type& __a = allocator_type())
+ : _Base(__l, __a), _Safe_base() { }
#endif
~deque() { }
@@ -115,6 +119,14 @@ namespace __debug
swap(__x);
return *this;
}
+
+ deque&
+ operator=(initializer_list<value_type> __l)
+ {
+ *static_cast<_Base*>(this) = __l;
+ this->_M_invalidate_all();
+ return *this;
+ }
#endif
template<class _InputIterator>
@@ -133,6 +145,15 @@ namespace __debug
this->_M_invalidate_all();
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ void
+ assign(initializer_list<value_type> __l)
+ {
+ _Base::assign(__l);
+ this->_M_invalidate_all();
+ }
+#endif
+
using _Base::get_allocator;
// iterators:
@@ -318,6 +339,13 @@ namespace __debug
iterator
insert(iterator __position, _Tp&& __x)
{ return emplace(__position, std::move(__x)); }
+
+ void
+ insert(iterator __p, initializer_list<value_type> __l)
+ {
+ _Base::insert(__p, __l);
+ this->_M_invalidate_all();
+ }
#endif
void
diff --git a/libstdc++-v3/include/debug/list b/libstdc++-v3/include/debug/list
index 7ab0bddff99..312aeebef92 100644
--- a/libstdc++-v3/include/debug/list
+++ b/libstdc++-v3/include/debug/list
@@ -123,6 +123,10 @@ namespace __debug
list(list&& __x)
: _Base(std::forward<list>(__x)), _Safe_base()
{ this->_M_swap(__x); }
+
+ list(initializer_list<value_type> __l,
+ const allocator_type& __a = allocator_type())
+ : _Base(__l, __a), _Safe_base() { }
#endif
~list() { }
@@ -144,6 +148,21 @@ namespace __debug
swap(__x);
return *this;
}
+
+ list&
+ operator=(initializer_list<value_type> __l)
+ {
+ static_cast<_Base&>(*this) = __l;
+ this->_M_invalidate_all();
+ return *this;
+ }
+
+ void
+ assign(initializer_list<value_type> __l)
+ {
+ _Base::assign(__l);
+ this->_M_invalidate_all();
+ }
#endif
template<class _InputIterator>
@@ -331,6 +350,13 @@ namespace __debug
iterator
insert(iterator __position, _Tp&& __x)
{ return emplace(__position, std::move(__x)); }
+
+ void
+ insert(iterator __p, initializer_list<value_type> __l)
+ {
+ __glibcxx_check_insert(__p);
+ _Base::insert(__p, __l);
+ }
#endif
void
diff --git a/libstdc++-v3/include/debug/map.h b/libstdc++-v3/include/debug/map.h
index 16575644da2..88d3e9842f8 100644
--- a/libstdc++-v3/include/debug/map.h
+++ b/libstdc++-v3/include/debug/map.h
@@ -98,6 +98,11 @@ namespace __debug
map(map&& __x)
: _Base(std::forward<map>(__x)), _Safe_base()
{ this->_M_swap(__x); }
+
+ map(initializer_list<value_type> __l,
+ const _Compare& __c = _Compare(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__l, __c, __a), _Safe_base() { }
#endif
~map() { }
@@ -119,6 +124,14 @@ namespace __debug
swap(__x);
return *this;
}
+
+ map&
+ operator=(initializer_list<value_type> __l)
+ {
+ this->clear();
+ this->insert(__l);
+ return *this;
+ }
#endif
// _GLIBCXX_RESOLVE_LIB_DEFECTS
@@ -198,6 +211,12 @@ namespace __debug
__res.second);
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ void
+ insert(std::initializer_list<value_type> __list)
+ { _Base::insert(__list); }
+#endif
+
iterator
insert(iterator __position, const value_type& __x)
{
diff --git a/libstdc++-v3/include/debug/multimap.h b/libstdc++-v3/include/debug/multimap.h
index 72f4411685b..b8e78d153a9 100644
--- a/libstdc++-v3/include/debug/multimap.h
+++ b/libstdc++-v3/include/debug/multimap.h
@@ -99,6 +99,11 @@ namespace __debug
multimap(multimap&& __x)
: _Base(std::forward<multimap>(__x)), _Safe_base()
{ this->_M_swap(__x); }
+
+ multimap(initializer_list<value_type> __l,
+ const _Compare& __c = _Compare(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__l, __c, __a), _Safe_base() { }
#endif
~multimap() { }
@@ -120,6 +125,14 @@ namespace __debug
swap(__x);
return *this;
}
+
+ multimap&
+ operator=(initializer_list<value_type> __l)
+ {
+ this->clear();
+ this->insert(__l);
+ return *this;
+ }
#endif
using _Base::get_allocator;
@@ -185,6 +198,12 @@ namespace __debug
insert(const value_type& __x)
{ return iterator(_Base::insert(__x), this); }
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ void
+ insert(std::initializer_list<value_type> __list)
+ { _Base::insert(__list); }
+#endif
+
iterator
insert(iterator __position, const value_type& __x)
{
diff --git a/libstdc++-v3/include/debug/multiset.h b/libstdc++-v3/include/debug/multiset.h
index ffe5b51548f..ba159b4c537 100644
--- a/libstdc++-v3/include/debug/multiset.h
+++ b/libstdc++-v3/include/debug/multiset.h
@@ -96,6 +96,11 @@ namespace __debug
multiset(multiset&& __x)
: _Base(std::forward<multiset>(__x)), _Safe_base()
{ this->_M_swap(__x); }
+
+ multiset(initializer_list<value_type> __l,
+ const _Compare& __comp = _Compare(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__l, __comp, __a), _Safe_base() { }
#endif
~multiset() { }
@@ -117,6 +122,14 @@ namespace __debug
swap(__x);
return *this;
}
+
+ multiset&
+ operator=(initializer_list<value_type> __l)
+ {
+ this->clear();
+ this->insert(__l);
+ return *this;
+ }
#endif
using _Base::get_allocator;
@@ -197,6 +210,12 @@ namespace __debug
_Base::insert(__first, __last);
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ void
+ insert(initializer_list<value_type> __l)
+ { _Base::insert(__l); }
+#endif
+
void
erase(iterator __position)
{
diff --git a/libstdc++-v3/include/debug/safe_association.h b/libstdc++-v3/include/debug/safe_association.h
index 42c050050b8..de8945301f6 100644
--- a/libstdc++-v3/include/debug/safe_association.h
+++ b/libstdc++-v3/include/debug/safe_association.h
@@ -1,6 +1,6 @@
// Safe associated container base class implementation -*- C++ -*-
-// Copyright (C) 2007 Free Software Foundation, Inc.
+// Copyright (C) 2007, 2008 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -105,6 +105,14 @@ namespace __gnu_debug
__l, __n, __hf, __eql, __a)
{ }
+ _Safe_association(std::initializer_list<value_type> __l,
+ size_type __n,
+ const hasher& __hf,
+ const key_equal& __eql,
+ const allocator_type& __a = allocator_type())
+ : _Base(__l, __n, __hf, __eql, __a)
+ { }
+
_Safe_association(const _Base& __x) : _Base(__x) { }
_Safe_association(_Safe_association&& __x)
@@ -152,6 +160,10 @@ namespace __gnu_debug
_Base::insert(__first.base(), __last.base());
}
+ void
+ insert(std::initializer_list<value_type> __l)
+ { _Base::insert(__l); }
+
const_iterator
find(const key_type& __key) const
{ return const_iterator(_Base::find(__key), this); }
diff --git a/libstdc++-v3/include/debug/set.h b/libstdc++-v3/include/debug/set.h
index 3115610d1e1..310f3ab61a2 100644
--- a/libstdc++-v3/include/debug/set.h
+++ b/libstdc++-v3/include/debug/set.h
@@ -96,6 +96,11 @@ namespace __debug
set(set&& __x)
: _Base(std::forward<set>(__x)), _Safe_base()
{ this->_M_swap(__x); }
+
+ set(initializer_list<value_type> __l,
+ const _Compare& __comp = _Compare(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__l, __comp, __a), _Safe_base() { }
#endif
~set() { }
@@ -117,6 +122,14 @@ namespace __debug
swap(__x);
return *this;
}
+
+ set&
+ operator=(initializer_list<value_type> __l)
+ {
+ this->clear();
+ this->insert(__l);
+ return *this;
+ }
#endif
using _Base::get_allocator;
@@ -202,6 +215,12 @@ namespace __debug
_Base::insert(__first, __last);
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ void
+ insert(initializer_list<value_type> __l)
+ { _Base::insert(__l); }
+#endif
+
void
erase(iterator __position)
{
diff --git a/libstdc++-v3/include/debug/string b/libstdc++-v3/include/debug/string
index 070ca1fe58b..c00e0f38afc 100644
--- a/libstdc++-v3/include/debug/string
+++ b/libstdc++-v3/include/debug/string
@@ -115,6 +115,12 @@ namespace __gnu_debug
: _Base(__gnu_debug::__check_valid_range(__begin, __end), __end, __a)
{ }
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ basic_string(initializer_list<_CharT> __l, const _Alloc& __a = _Alloc())
+ : _Base(__l, __a)
+ { }
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
~basic_string() { }
basic_string&
@@ -142,6 +148,16 @@ namespace __gnu_debug
return *this;
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ basic_string&
+ operator=(initializer_list<_CharT> __l)
+ {
+ *static_cast<_Base*>(this) = __l;
+ this->_M_invalidate_all();
+ return *this;
+ }
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
// 21.3.2 iterators:
iterator
begin()
@@ -259,6 +275,16 @@ namespace __gnu_debug
return *this;
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ basic_string&
+ operator+=(initializer_list<_CharT> __l)
+ {
+ _M_base() += __l;
+ this->_M_invalidate_all();
+ return *this;
+ }
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
basic_string&
append(const basic_string& __str)
{
@@ -372,6 +398,16 @@ namespace __gnu_debug
return *this;
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ basic_string&
+ assign(initializer_list<_CharT> __l)
+ {
+ _Base::assign(__l);
+ this->_M_invalidate_all();
+ return *this;
+ }
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
basic_string&
insert(size_type __pos1, const basic_string& __str)
{
@@ -441,6 +477,15 @@ namespace __gnu_debug
this->_M_invalidate_all();
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ void
+ insert(iterator __p, initializer_list<_CharT> __l)
+ {
+ _Base::insert(__p, __l);
+ this->_M_invalidate_all();
+ }
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
basic_string&
erase(size_type __pos = 0, size_type __n = _Base::npos)
{
@@ -564,6 +609,17 @@ namespace __gnu_debug
return *this;
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ basic_string& replace(iterator __i1, iterator __i2,
+ initializer_list<_CharT> __l)
+ {
+ __glibcxx_check_erase_range(__i1, __i2);
+ _Base::replace(__i1.base(), __i2.base(), __l);
+ this->_M_invalidate_all();
+ return *this;
+ }
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
size_type
copy(_CharT* __s, size_type __n, size_type __pos = 0) const
{
diff --git a/libstdc++-v3/include/debug/unordered_map b/libstdc++-v3/include/debug/unordered_map
index 590d4a3478f..79590f56755 100644
--- a/libstdc++-v3/include/debug/unordered_map
+++ b/libstdc++-v3/include/debug/unordered_map
@@ -40,6 +40,7 @@
#else
# include <c++0x_warning.h>
#endif
+#include <initializer_list>
#include <debug/safe_association.h>
#include <debug/safe_iterator.h>
@@ -64,6 +65,7 @@ namespace __debug
public:
typedef typename _Safe_assoc::size_type size_type;
+ typedef typename _Safe_assoc::value_type value_type;
typedef typename _Safe_assoc::hasher hasher;
typedef typename _Safe_assoc::key_equal key_equal;
typedef typename _Safe_assoc::allocator_type allocator_type;
@@ -91,6 +93,13 @@ namespace __debug
unordered_map(unordered_map&& __x)
: _Safe_assoc(std::forward<_Safe_assoc>(__x)), _Safe_base() { }
+ unordered_map(initializer_list<value_type> __l,
+ size_type __n = 10,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _Safe_assoc(__l, __n, __hf, __eql, __a) { }
+
unordered_map&
operator=(unordered_map&& __x)
{
@@ -100,6 +109,14 @@ namespace __debug
return *this;
}
+ unordered_map&
+ operator=(initializer_list<value_type> __l)
+ {
+ this->clear();
+ this->insert(__l);
+ return *this;
+ }
+
void
swap(unordered_map&& __x)
{
@@ -164,6 +181,7 @@ namespace __debug
public:
typedef typename _Safe_assoc::size_type size_type;
+ typedef typename _Safe_assoc::value_type value_type;
typedef typename _Safe_assoc::hasher hasher;
typedef typename _Safe_assoc::key_equal key_equal;
typedef typename _Safe_assoc::allocator_type allocator_type;
@@ -185,6 +203,13 @@ namespace __debug
: _Safe_assoc(__f, __l, __n, __hf, __eql, __a)
{ }
+ unordered_multimap(initializer_list<value_type> __l,
+ size_type __n = 10,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _Safe_assoc(__l, __n, __hf, __eql, __a) { }
+
unordered_multimap(const _Safe_assoc& __x)
: _Safe_assoc(__x), _Safe_base() { }
@@ -200,6 +225,14 @@ namespace __debug
return *this;
}
+ unordered_multimap&
+ operator=(initializer_list<value_type> __l)
+ {
+ this->clear();
+ this->insert(__l);
+ return *this;
+ }
+
void
swap(unordered_multimap&& __x)
{
diff --git a/libstdc++-v3/include/debug/unordered_set b/libstdc++-v3/include/debug/unordered_set
index b4b9be8a140..4c5d4d5ce34 100644
--- a/libstdc++-v3/include/debug/unordered_set
+++ b/libstdc++-v3/include/debug/unordered_set
@@ -41,6 +41,7 @@
# include <c++0x_warning.h>
#endif
+#include <initializer_list>
#include <debug/safe_association.h>
#include <debug/safe_iterator.h>
@@ -65,6 +66,7 @@ namespace __debug
public:
typedef typename _Safe_assoc::size_type size_type;
+ typedef typename _Safe_assoc::value_type value_type;
typedef typename _Safe_assoc::hasher hasher;
typedef typename _Safe_assoc::key_equal key_equal;
typedef typename _Safe_assoc::allocator_type allocator_type;
@@ -86,6 +88,13 @@ namespace __debug
: _Safe_assoc(__f, __l, __n, __hf, __eql, __a)
{ }
+ unordered_set(initializer_list<value_type> __l,
+ size_type __n = 10,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _Safe_assoc(__l, __n, __hf, __eql, __a) { }
+
unordered_set(const _Safe_assoc& __x)
: _Safe_assoc(__x), _Safe_base() { }
@@ -101,6 +110,14 @@ namespace __debug
return *this;
}
+ unordered_set&
+ operator=(initializer_list<value_type> __l)
+ {
+ this->clear();
+ this->insert(__l);
+ return *this;
+ }
+
void
swap(unordered_set&& __x)
{
@@ -162,6 +179,7 @@ namespace __debug
public:
typedef typename _Safe_assoc::size_type size_type;
+ typedef typename _Safe_assoc::value_type value_type;
typedef typename _Safe_assoc::hasher hasher;
typedef typename _Safe_assoc::key_equal key_equal;
typedef typename _Safe_assoc::allocator_type allocator_type;
@@ -183,6 +201,13 @@ namespace __debug
: _Safe_assoc(__f, __l, __n, __hf, __eql, __a)
{ }
+ unordered_multiset(initializer_list<value_type> __l,
+ size_type __n = 10,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _Safe_assoc(__l, __n, __hf, __eql, __a) { }
+
unordered_multiset(const _Safe_assoc& __x)
: _Safe_assoc(__x), _Safe_base() { }
@@ -198,6 +223,14 @@ namespace __debug
return *this;
}
+ unordered_multiset&
+ operator=(initializer_list<value_type> __l)
+ {
+ this->clear();
+ this->insert(__l);
+ return *this;
+ }
+
void
swap(unordered_multiset&& __x)
{
diff --git a/libstdc++-v3/include/debug/vector b/libstdc++-v3/include/debug/vector
index 12bd52f0b2b..4e8cf5799b6 100644
--- a/libstdc++-v3/include/debug/vector
+++ b/libstdc++-v3/include/debug/vector
@@ -106,6 +106,11 @@ namespace __debug
this->_M_swap(__x);
__x._M_guaranteed_capacity = 0;
}
+
+ vector(initializer_list<value_type> __l,
+ const allocator_type& __a = allocator_type())
+ : _Base(__l, __a), _Safe_base(),
+ _M_guaranteed_capacity(__l.size()) { }
#endif
~vector() { }
@@ -128,6 +133,15 @@ namespace __debug
swap(__x);
return *this;
}
+
+ vector&
+ operator=(initializer_list<value_type> __l)
+ {
+ static_cast<_Base&>(*this) = __l;
+ this->_M_invalidate_all();
+ _M_update_guaranteed_capacity();
+ return *this;
+ }
#endif
template<typename _InputIterator>
@@ -148,6 +162,16 @@ namespace __debug
_M_update_guaranteed_capacity();
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ void
+ assign(initializer_list<value_type> __l)
+ {
+ _Base::assign(__l);
+ this->_M_invalidate_all();
+ _M_update_guaranteed_capacity();
+ }
+#endif
+
using _Base::get_allocator;
// iterators:
@@ -300,9 +324,11 @@ namespace __debug
}
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- void
- push_back(_Tp&& __x)
- { emplace_back(std::move(__x)); }
+ template<typename _Up = _Tp>
+ typename __gnu_cxx::__enable_if<!std::__are_same<_Up, bool>::__value,
+ void>::__type
+ push_back(_Tp&& __x)
+ { emplace_back(std::move(__x)); }
template<typename... _Args>
void
@@ -360,9 +386,15 @@ namespace __debug
}
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- iterator
- insert(iterator __position, _Tp&& __x)
- { return emplace(__position, std::move(__x)); }
+ template<typename _Up = _Tp>
+ typename __gnu_cxx::__enable_if<!std::__are_same<_Up, bool>::__value,
+ iterator>::__type
+ insert(iterator __position, _Tp&& __x)
+ { return emplace(__position, std::move(__x)); }
+
+ void
+ insert(iterator __position, initializer_list<value_type> __l)
+ { this->insert(__position, __l.begin(), __l.end()); }
#endif
void
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/debug_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/debug_fn_imps.hpp
index 200249d8d98..85e5b870ce9 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/debug_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/debug_fn_imps.hpp
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -65,13 +65,15 @@ assert_max() const
return;
_GLIBCXX_DEBUG_ASSERT(base_type::parent(m_p_max) == NULL);
for (const_iterator it = base_type::begin(); it != base_type::end(); ++it)
- _GLIBCXX_DEBUG_ASSERT(!Cmp_Fn::operator()(m_p_max->m_value, it.m_p_nd->m_value));
+ _GLIBCXX_DEBUG_ASSERT(!Cmp_Fn::operator()(m_p_max->m_value,
+ it.m_p_nd->m_value));
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
-assert_node_consistent(const_node_pointer p_nd, bool strictly_binomial, bool increasing) const
+assert_node_consistent(const_node_pointer p_nd, bool strictly_binomial,
+ bool increasing) const
{
_GLIBCXX_DEBUG_ASSERT(increasing || strictly_binomial);
base_type::assert_node_consistent(p_nd, false);
@@ -83,15 +85,20 @@ assert_node_consistent(const_node_pointer p_nd, bool strictly_binomial, bool inc
assert_node_consistent(p_nd->m_p_next_sibling, strictly_binomial, increasing);
assert_node_consistent(p_nd->m_p_l_child, true, false);
if (p_nd->m_p_next_sibling != NULL)
- if (increasing)
- {
- if (strictly_binomial)
- _GLIBCXX_DEBUG_ASSERT(p_nd->m_metadata < p_nd->m_p_next_sibling->m_metadata);
- else
- _GLIBCXX_DEBUG_ASSERT(p_nd->m_metadata <= p_nd->m_p_next_sibling->m_metadata);
- }
- else
- _GLIBCXX_DEBUG_ASSERT(p_nd->m_metadata > p_nd->m_p_next_sibling->m_metadata);
+ {
+ if (increasing)
+ {
+ if (strictly_binomial)
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_metadata
+ < p_nd->m_p_next_sibling->m_metadata);
+ else
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_metadata
+ <= p_nd->m_p_next_sibling->m_metadata);
+ }
+ else
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_metadata
+ > p_nd->m_p_next_sibling->m_metadata);
+ }
}
-#endif
+#endif
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/debug_map_base.hpp b/libstdc++-v3/include/ext/pb_ds/detail/debug_map_base.hpp
index 086a50fc5fd..5319749128b 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/debug_map_base.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/debug_map_base.hpp
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -52,6 +52,7 @@
#include <list>
#include <utility>
#include <cstdlib>
+#include <iostream>
#include <ext/throw_allocator.h>
#include <debug/debug.h>
diff --git a/libstdc++-v3/include/ext/rc_string_base.h b/libstdc++-v3/include/ext/rc_string_base.h
index 0d3224cea10..213e3cf1c97 100644
--- a/libstdc++-v3/include/ext/rc_string_base.h
+++ b/libstdc++-v3/include/ext/rc_string_base.h
@@ -308,7 +308,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
#ifdef __GXX_EXPERIMENTAL_CXX0X__
__rc_string_base(__rc_string_base&& __rcs)
: _M_dataplus(__rcs._M_get_allocator(), __rcs._M_data())
- { __rcs._M_data(_S_empty_rep._M_refcopy()); }
+ { __rcs._M_data(_S_empty_rep._M_refcopy()); }
#endif
__rc_string_base(size_type __n, _CharT __c, const _Alloc& __a);
diff --git a/libstdc++-v3/include/ext/sso_string_base.h b/libstdc++-v3/include/ext/sso_string_base.h
index 9c8c1bc79d6..73c6a1b2df0 100644
--- a/libstdc++-v3/include/ext/sso_string_base.h
+++ b/libstdc++-v3/include/ext/sso_string_base.h
@@ -1,6 +1,6 @@
// Short-string-optimized versatile string base -*- C++ -*-
-// Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
diff --git a/libstdc++-v3/include/ext/vstring.h b/libstdc++-v3/include/ext/vstring.h
index 0e74bfa8cb2..ea1652db54e 100644
--- a/libstdc++-v3/include/ext/vstring.h
+++ b/libstdc++-v3/include/ext/vstring.h
@@ -36,6 +36,7 @@
#pragma GCC system_header
+#include <initializer_list>
#include <ext/vstring_util.h>
#include <ext/rc_string_base.h>
#include <ext/sso_string_base.h>
@@ -156,6 +157,15 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
*/
__versa_string(__versa_string&& __str)
: __vstring_base(std::forward<__vstring_base>(__str)) { }
+
+ /**
+ * @brief Construct string from an initializer list.
+ * @param l std::initializer_list of characters.
+ * @param a Allocator to use (default is default allocator).
+ */
+ __versa_string(std::initializer_list<_CharT> __l,
+ const _Alloc& __a = _Alloc())
+ : __vstring_base(__l.begin(), __l.end(), __a) { }
#endif
/**
@@ -257,6 +267,17 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
this->swap(__str);
return *this;
}
+
+ /**
+ * @brief Set value to string constructed from initializer list.
+ * @param l std::initializer_list.
+ */
+ __versa_string&
+ operator=(std::initializer_list<_CharT> __l)
+ {
+ this->assign(__l.begin(), __l.end());
+ return *this;
+ }
#endif
/**
@@ -623,6 +644,17 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
return *this;
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Append an initializer_list of characters.
+ * @param l The initializer_list of characters to be appended.
+ * @return Reference to this string.
+ */
+ __versa_string&
+ operator+=(std::initializer_list<_CharT> __l)
+ { return this->append(__l.begin(), __l.end()); }
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
/**
* @brief Append a string to this string.
* @param str The string to append.
@@ -690,6 +722,17 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
append(size_type __n, _CharT __c)
{ return _M_replace_aux(this->size(), size_type(0), __n, __c); }
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Append an initializer_list of characters.
+ * @param l The initializer_list of characters to append.
+ * @return Reference to this string.
+ */
+ __versa_string&
+ append(std::initializer_list<_CharT> __l)
+ { return this->append(__l.begin(), __l.end()); }
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
/**
* @brief Append a range of characters.
* @param first Iterator referencing the first character to append.
@@ -807,6 +850,17 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
assign(_InputIterator __first, _InputIterator __last)
{ return this->replace(_M_ibegin(), _M_iend(), __first, __last); }
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Set value to an initializer_list of characters.
+ * @param l The initializer_list of characters to assign.
+ * @return Reference to this string.
+ */
+ __versa_string&
+ assign(std::initializer_list<_CharT> __l)
+ { return this->assign(__l.begin(), __l.end()); }
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
/**
* @brief Insert multiple characters.
* @param p Iterator referencing location in string to insert at.
@@ -839,6 +893,18 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
insert(iterator __p, _InputIterator __beg, _InputIterator __end)
{ this->replace(__p, __p, __beg, __end); }
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Insert an initializer_list of characters.
+ * @param p Iterator referencing location in string to insert at.
+ * @param l The initializer_list of characters to insert.
+ * @throw std::length_error If new length exceeds @c max_size().
+ */
+ void
+ insert(iterator __p, std::initializer_list<_CharT> __l)
+ { this->insert(__p, __l.begin(), __l.end()); }
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
/**
* @brief Insert value of a string.
* @param pos1 Iterator referencing location in string to insert at.
@@ -1295,6 +1361,25 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
__k1.base(), __k2 - __k1);
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Replace range of characters with initializer_list.
+ * @param i1 Iterator referencing start of range to replace.
+ * @param i2 Iterator referencing end of range to replace.
+ * @param l The initializer_list of characters to insert.
+ * @return Reference to this string.
+ * @throw std::length_error If new length exceeds @c max_size().
+ *
+ * Removes the characters in the range [i1,i2). In place, characters
+ * in the range [k1,k2) are inserted. If the length of result exceeds
+ * max_size(), length_error is thrown. The value of the string doesn't
+ * change if an error is thrown.
+ */
+ __versa_string& replace(iterator __i1, iterator __i2,
+ std::initializer_list<_CharT> __l)
+ { return this->replace(__i1, __i2, __l.begin(), __l.end()); }
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
private:
template<class _Integer>
__versa_string&
diff --git a/libstdc++-v3/include/parallel/losertree.h b/libstdc++-v3/include/parallel/losertree.h
index b7f8da036ae..7e50bb13d50 100644
--- a/libstdc++-v3/include/parallel/losertree.h
+++ b/libstdc++-v3/include/parallel/losertree.h
@@ -376,7 +376,7 @@ public:
}
~LoserTreePointerBase()
- { ::operator delete(losers); }
+ { ::operator delete[](losers); }
int get_min_source()
{ return losers[0].source; }
diff --git a/libstdc++-v3/include/precompiled/stdc++.h b/libstdc++-v3/include/precompiled/stdc++.h
index e4b61106734..b9249353678 100644
--- a/libstdc++-v3/include/precompiled/stdc++.h
+++ b/libstdc++-v3/include/precompiled/stdc++.h
@@ -98,8 +98,9 @@
#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <array>
-#include <date_time>
+#include <chrono>
#include <random>
+#include <ratio>
#include <regex>
#include <system_error>
#include <tuple>
diff --git a/libstdc++-v3/include/std/chrono b/libstdc++-v3/include/std/chrono
new file mode 100644
index 00000000000..d20c7f45cd9
--- /dev/null
+++ b/libstdc++-v3/include/std/chrono
@@ -0,0 +1,637 @@
+// <chrono> -*- C++ -*-
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301, USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+/** @file include/chrono
+ * This is a Standard C++ Library header.
+ */
+
+#ifndef _GLIBCXX_CHRONO
+#define _GLIBCXX_CHRONO 1
+
+#pragma GCC system_header
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+# include <c++0x_warning.h>
+#else
+
+#ifdef _GLIBCXX_INCLUDE_AS_TR1
+# error C++0x header cannot be included from TR1 header
+#endif
+
+#include <ratio>
+#include <type_traits>
+#include <limits>
+#include <ctime>
+
+#ifdef _GLIBCXX_USE_C99_STDINT_TR1
+
+namespace std
+{
+ namespace chrono
+ {
+ template<typename _Rep, typename _Period = ratio<1>>
+ struct duration;
+
+ template<typename _Clock, typename _Duration = typename _Clock::duration>
+ struct time_point;
+ }
+
+ // 20.8.2.3 specialization of common_type (for duration)
+ template<typename _Rep1, typename _Period1, typename _Rep2, typename _Period2>
+ struct common_type<chrono::duration<_Rep1, _Period1>,
+ chrono::duration<_Rep2, _Period2>>
+ {
+ typedef chrono::duration<typename common_type<_Rep1, _Rep2>::type,
+ ratio<__static_gcd<_Period1::num, _Period2::num>::value,
+ (_Period1::den / __static_gcd<_Period1::den, _Period2::den>::value)
+ * _Period2::den>> type;
+ };
+
+ // 20.8.2.3 specialization of common_type (for time_point)
+ template<typename _Clock, typename _Duration1, typename _Duration2>
+ struct common_type<chrono::time_point<_Clock, _Duration1>,
+ chrono::time_point<_Clock, _Duration2>>
+ {
+ typedef chrono::time_point<_Clock,
+ typename common_type<_Duration1, _Duration2>::type> type;
+ };
+
+ namespace chrono
+ {
+ // primary template for duration_cast impl.
+ template<typename _ToDuration, typename _CF, typename _CR,
+ bool _NumIsOne = false, bool _DenIsOne = false>
+ struct __duration_cast_impl
+ {
+ template<typename _Rep, typename _Period>
+ static _ToDuration __cast(const duration<_Rep, _Period>& __d)
+ {
+ return _ToDuration(static_cast<
+ typename _ToDuration::rep>(static_cast<_CR>(__d.count())
+ * static_cast<_CR>(_CF::num)
+ / static_cast<_CR>(_CF::den)));
+ }
+ };
+
+ template<typename _ToDuration, typename _CF, typename _CR>
+ struct __duration_cast_impl<_ToDuration, _CF, _CR, true, true>
+ {
+ template<typename _Rep, typename _Period>
+ static _ToDuration __cast(const duration<_Rep, _Period>& __d)
+ {
+ return _ToDuration(
+ static_cast<typename _ToDuration::rep>(__d.count()));
+ }
+ };
+
+ template<typename _ToDuration, typename _CF, typename _CR>
+ struct __duration_cast_impl<_ToDuration, _CF, _CR, true, false>
+ {
+ template<typename _Rep, typename _Period>
+ static _ToDuration __cast(const duration<_Rep, _Period>& __d)
+ {
+ return _ToDuration(static_cast<typename _ToDuration::rep>(
+ static_cast<_CR>(__d.count()) / static_cast<_CR>(_CF::den)));
+ }
+ };
+
+ template<typename _ToDuration, typename _CF, typename _CR>
+ struct __duration_cast_impl<_ToDuration, _CF, _CR, false, true>
+ {
+ template<typename _Rep, typename _Period>
+ static _ToDuration __cast(const duration<_Rep, _Period>& __d)
+ {
+ return _ToDuration(static_cast<typename _ToDuration::rep>(
+ static_cast<_CR>(__d.count()) * static_cast<_CR>(_CF::num)));
+ }
+ };
+
+ template<typename _ToDuration, typename _Rep, typename _Period>
+ inline _ToDuration
+ duration_cast(const duration<_Rep, _Period>& __d)
+ {
+ typedef typename
+ ratio_divide<_Period, typename _ToDuration::period>::type __cf;
+ typedef typename
+ common_type<typename _ToDuration::rep, _Rep, intmax_t>::type __cr;
+
+ return __duration_cast_impl<_ToDuration, __cf, __cr,
+ __cf::num == 1, __cf::den == 1>::__cast(__d);
+ }
+
+ template<typename _Rep>
+ struct treat_as_floating_point
+ : is_floating_point<_Rep>
+ { };
+
+ template<typename _Rep>
+ struct duration_values
+ {
+ static const _Rep
+ zero()
+ { return _Rep(0); }
+
+ static const _Rep
+ max()
+ { return numeric_limits<_Rep>::max(); }
+
+ static const _Rep
+ min()
+ { return numeric_limits<_Rep>::min(); }
+ };
+
+ template<typename _Tp>
+ struct __is_duration
+ : std::false_type
+ { };
+
+ template<typename _Rep, typename _Period>
+ struct __is_duration<duration<_Rep, _Period>>
+ : std::true_type
+ { };
+
+ template<typename T>
+ struct __is_ratio
+ : std::false_type
+ { };
+
+ template<intmax_t _Num, intmax_t _Den>
+ struct __is_ratio<ratio<_Num, _Den>>
+ : std::true_type
+ { };
+
+ /// duration
+ template<typename _Rep, typename _Period>
+ struct duration
+ {
+ static_assert(!__is_duration<_Rep>::value, "rep cannot be a duration");
+ static_assert(__is_ratio<_Period>::value,
+ "period must be a specialization of ratio");
+ static_assert(_Period::num > 0, "period must be positive");
+
+ typedef _Rep rep;
+ typedef _Period period;
+
+ // 20.8.3.1 construction / copy / destroy
+ duration() = default;
+
+ template<typename _Rep2>
+ explicit duration(_Rep2 const& __rep)
+ : __r(static_cast<rep>(__rep))
+ {
+ static_assert(is_convertible<_Rep2,rep>::value
+ && (treat_as_floating_point<rep>::value
+ || !treat_as_floating_point<_Rep2>::value),
+ "cannot construct integral duration with floating point type");
+ }
+
+ template<typename _Rep2, typename _Period2>
+ duration(const duration<_Rep2, _Period2>& __d)
+ : __r(duration_cast<duration>(__d).count())
+ {
+ static_assert(treat_as_floating_point<rep>::value == true
+ || ratio_divide<_Period2, period>::type::den == 1,
+ "the resulting duration is not exactly representable");
+ }
+
+ ~duration() = default;
+ duration(const duration&) = default;
+ duration& operator=(const duration&) = default;
+
+ // 20.8.3.2 observer
+ rep
+ count() const
+ { return __r; }
+
+ // 20.8.3.3 arithmetic
+ duration
+ operator+() const
+ { return *this; }
+
+ duration
+ operator-() const
+ { return duration(-__r); }
+
+ duration&
+ operator++()
+ {
+ ++__r;
+ return *this;
+ }
+
+ duration
+ operator++(int)
+ { return duration(__r++); }
+
+ duration&
+ operator--()
+ {
+ --__r;
+ return *this;
+ }
+
+ duration
+ operator--(int)
+ { return duration(__r--); }
+
+ duration&
+ operator+=(const duration& __d)
+ {
+ __r += __d.count();
+ return *this;
+ }
+
+ duration&
+ operator-=(const duration& __d)
+ {
+ __r -= __d.count();
+ return *this;
+ }
+
+ duration&
+ operator*=(const rep& __rhs)
+ {
+ __r *= __rhs;
+ return *this;
+ }
+
+ duration&
+ operator/=(const rep& __rhs)
+ {
+ __r /= __rhs;
+ return *this;
+ }
+
+ // 20.8.3.4 special values
+ // TODO: These should be constexprs.
+ static const duration
+ zero()
+ { return duration(duration_values<rep>::zero()); }
+
+ static const duration
+ min()
+ { return duration(duration_values<rep>::min()); }
+
+ static const duration
+ max()
+ { return duration(duration_values<rep>::max()); }
+
+ private:
+ rep __r;
+ };
+
+ template<typename _Rep1, typename _Period1,
+ typename _Rep2, typename _Period2>
+ inline typename common_type<duration<_Rep1, _Period1>,
+ duration<_Rep2, _Period2>>::type
+ operator+(const duration<_Rep1, _Period1>& __lhs,
+ const duration<_Rep2, _Period2>& __rhs)
+ {
+ typedef typename common_type<duration<_Rep1, _Period1>,
+ duration<_Rep2, _Period2>>::type __ct;
+ return __ct(__lhs) += __rhs;
+ }
+
+ template<typename _Rep1, typename _Period1,
+ typename _Rep2, typename _Period2>
+ inline typename common_type<duration<_Rep1, _Period1>,
+ duration<_Rep2, _Period2>>::type
+ operator-(const duration<_Rep1, _Period1>& __lhs,
+ const duration<_Rep2, _Period2>& __rhs)
+ {
+ typedef typename common_type<duration<_Rep1, _Period1>,
+ duration<_Rep2, _Period2>>::type __ct;
+ return __ct(__lhs) -= __rhs;
+ }
+
+ template<typename _Rep1, typename _Period, typename _Rep2>
+ inline duration<typename common_type<_Rep1, _Rep2>::type, _Period>
+ operator*(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
+ {
+ typedef typename common_type<_Rep1, _Rep2>::type __cr;
+ return duration<__cr, _Period>(__d) *= __s;
+ }
+
+ template<typename _Rep1, typename _Period, typename _Rep2>
+ inline duration<typename common_type<_Rep1, _Rep2>::type, _Period>
+ operator*(const _Rep2& __s, const duration<_Rep1, _Period>& __d)
+ { return __d * __s; }
+
+ template<typename _Tp, typename _Up, typename _Ep = void>
+ struct __division_impl;
+
+ template<typename _Rep1, typename _Period, typename _Rep2>
+ struct __division_impl<duration<_Rep1, _Period>, _Rep2,
+ typename enable_if<!__is_duration<_Rep2>::value>::type>
+ {
+ typedef typename common_type<_Rep1, _Rep2>::type __cr;
+ typedef
+ duration<typename common_type<_Rep1, _Rep2>::type, _Period> __rt;
+
+ static __rt
+ __divide(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
+ { return duration<__cr, _Period>(__d) /= __s; }
+ };
+
+ template<typename _Rep1, typename _Period1,
+ typename _Rep2, typename _Period2>
+ struct __division_impl<duration<_Rep1, _Period1>,
+ duration<_Rep2, _Period2>>
+ {
+ typedef typename common_type<duration<_Rep1, _Period1>,
+ duration<_Rep2, _Period2>>::type __ct;
+ typedef typename common_type<_Rep1, _Rep2>::type __rt;
+
+ static __rt
+ __divide(const duration<_Rep1, _Period1>& __lhs,
+ const duration<_Rep2, _Period2>& __rhs)
+ { return __ct(__lhs).count() / __ct(__rhs).count(); }
+ };
+
+ template<typename _Rep, typename _Period, typename _Up>
+ inline typename __division_impl<duration<_Rep, _Period>, _Up>::__rt
+ operator/(const duration<_Rep, _Period>& __d, const _Up& __u)
+ {
+ return
+ __division_impl<duration<_Rep, _Period>, _Up>::__divide(__d, __u);
+ }
+
+ // comparisons
+ template<typename _Rep1, typename _Period1,
+ typename _Rep2, typename _Period2>
+ inline bool
+ operator==(const duration<_Rep1, _Period1>& __lhs,
+ const duration<_Rep2, _Period2>& __rhs)
+ {
+ typedef typename common_type<duration<_Rep1, _Period1>,
+ duration<_Rep2, _Period2>>::type __ct;
+ return __ct(__lhs).count() == __ct(__rhs).count();
+ }
+
+ template<typename _Rep1, typename _Period1,
+ typename _Rep2, typename _Period2>
+ inline bool
+ operator<(const duration<_Rep1, _Period1>& __lhs,
+ const duration<_Rep2, _Period2>& __rhs)
+ {
+ typedef typename common_type<duration<_Rep1, _Period1>,
+ duration<_Rep2, _Period2>>::type __ct;
+ return __ct(__lhs).count() < __ct(__rhs).count();
+ }
+
+ template<typename _Rep1, typename _Period1,
+ typename _Rep2, typename _Period2>
+ inline bool
+ operator!=(const duration<_Rep1, _Period1>& __lhs,
+ const duration<_Rep2, _Period2>& __rhs)
+ { return !(__lhs == __rhs); }
+
+ template<typename _Rep1, typename _Period1,
+ typename _Rep2, typename _Period2>
+ inline bool
+ operator<=(const duration<_Rep1, _Period1>& __lhs,
+ const duration<_Rep2, _Period2>& __rhs)
+ { return !(__rhs < __lhs); }
+
+ template<typename _Rep1, typename _Period1,
+ typename _Rep2, typename _Period2>
+ inline bool
+ operator>(const duration<_Rep1, _Period1>& __lhs,
+ const duration<_Rep2, _Period2>& __rhs)
+ { return __rhs < __lhs; }
+
+ template<typename _Rep1, typename _Period1,
+ typename _Rep2, typename _Period2>
+ inline bool
+ operator>=(const duration<_Rep1, _Period1>& __lhs,
+ const duration<_Rep2, _Period2>& __rhs)
+ { return !(__lhs < __rhs); }
+
+ typedef duration<int64_t, nano> nanoseconds;
+ typedef duration<int64_t, micro> microseconds;
+ typedef duration<int64_t, milli> milliseconds;
+ typedef duration<int64_t > seconds;
+ typedef duration<int, ratio< 60>> minutes;
+ typedef duration<int, ratio<3600>> hours;
+
+ /// time_point
+ template<typename _Clock, typename _Duration>
+ struct time_point
+ {
+ typedef _Clock clock;
+ typedef _Duration duration;
+ typedef typename duration::rep rep;
+ typedef typename duration::period period;
+
+ time_point() : __d(duration::zero())
+ { }
+
+ explicit time_point(const duration& __dur)
+ : __d(duration::zero() + __dur)
+ { }
+
+ // conversions
+ template<typename _Duration2>
+ time_point(const time_point<clock, _Duration2>& __t)
+ : __d(__t.time_since_epoch())
+ { }
+
+ // observer
+ duration
+ time_since_epoch() const
+ { return __d; }
+
+ // arithmetic
+ time_point&
+ operator+=(const duration& __dur)
+ {
+ __d += __dur;
+ return *this;
+ }
+
+ time_point&
+ operator-=(const duration& __dur)
+ {
+ __d -= __dur;
+ return *this;
+ }
+
+ // special values
+ // TODO: These should be constexprs.
+ static const time_point
+ min()
+ { return time_point(duration::min()); }
+
+ static const time_point
+ max()
+ { return time_point(duration::max()); }
+
+ private:
+ duration __d;
+ };
+
+ template<typename _ToDuration, typename _Clock, typename _Duration>
+ inline time_point<_Clock, _ToDuration>
+ time_point_cast(const time_point<_Clock, _Duration>& __t)
+ {
+ return time_point<_Clock, _ToDuration>(
+ duration_cast<_ToDuration>(__t.time_since_epoch()));
+ }
+
+ template<typename _Clock, typename _Duration1,
+ typename _Rep2, typename _Period2>
+ inline time_point<_Clock,
+ typename common_type<_Duration1, duration<_Rep2, _Period2>>::type>
+ operator+(const time_point<_Clock, _Duration1>& __lhs,
+ const duration<_Rep2, _Period2>& __rhs)
+ {
+ typedef time_point<_Clock,
+ typename common_type<_Duration1,
+ duration<_Rep2, _Period2>>::type> __ct;
+ return __ct(__lhs) += __rhs;
+ }
+
+ template<typename _Rep1, typename _Period1,
+ typename _Clock, typename _Duration2>
+ inline time_point<_Clock,
+ typename common_type<duration<_Rep1, _Period1>, _Duration2>::type>
+ operator+(const duration<_Rep1, _Period1>& __lhs,
+ const time_point<_Clock, _Duration2>& __rhs)
+ { return __rhs + __lhs; }
+
+ template<typename _Clock, typename _Duration1,
+ typename _Rep2, typename _Period2>
+ inline time_point<_Clock,
+ typename common_type<_Duration1, duration<_Rep2, _Period2>>::type>
+ operator-(const time_point<_Clock, _Duration1>& __lhs,
+ const duration<_Rep2, _Period2>& __rhs)
+ { return __lhs + (-__rhs); }
+
+ template<typename _Clock, typename _Duration1, typename _Duration2>
+ inline typename common_type<_Duration1, _Duration2>::type
+ operator-(const time_point<_Clock, _Duration1>& __lhs,
+ const time_point<_Clock, _Duration2>& __rhs)
+ { return __lhs.time_since_epoch() - __rhs.time_since_epoch(); }
+
+ template<typename _Clock, typename _Duration1, typename _Duration2>
+ inline bool
+ operator==(const time_point<_Clock, _Duration1>& __lhs,
+ const time_point<_Clock, _Duration2>& __rhs)
+ { return __lhs.time_since_epoch() == __rhs.time_since_epoch(); }
+
+ template<typename _Clock, typename _Duration1, typename _Duration2>
+ inline bool
+ operator!=(const time_point<_Clock, _Duration1>& __lhs,
+ const time_point<_Clock, _Duration2>& __rhs)
+ { return !(__lhs == __rhs); }
+
+ template<typename _Clock, typename _Duration1, typename _Duration2>
+ inline bool
+ operator<(const time_point<_Clock, _Duration1>& __lhs,
+ const time_point<_Clock, _Duration2>& __rhs)
+ { return __lhs.time_since_epoch() < __rhs.time_since_epoch(); }
+
+ template<typename _Clock, typename _Duration1, typename _Duration2>
+ inline bool
+ operator<=(const time_point<_Clock, _Duration1>& __lhs,
+ const time_point<_Clock, _Duration2>& __rhs)
+ { return !(__rhs < __lhs); }
+
+ template<typename _Clock, typename _Duration1, typename _Duration2>
+ inline bool
+ operator>(const time_point<_Clock, _Duration1>& __lhs,
+ const time_point<_Clock, _Duration2>& __rhs)
+ { return __rhs < __lhs; }
+
+ template<typename _Clock, typename _Duration1, typename _Duration2>
+ inline bool
+ operator>=(const time_point<_Clock, _Duration1>& __lhs,
+ const time_point<_Clock, _Duration2>& __rhs)
+ { return !(__lhs < __rhs); }
+
+ /// system_clock
+ struct system_clock
+ {
+#if defined(_GLIBCXX_USE_CLOCK_MONOTONIC) || \
+ defined(_GLIBCXX_USE_CLOCK_REALTIME)
+ typedef chrono::nanoseconds duration;
+#elif defined(_GLIBCXX_USE_GETTIMEOFDAY)
+ typedef chrono::microseconds duration;
+#else
+ typedef chrono::seconds duration;
+#endif
+
+ typedef duration::rep rep;
+ typedef duration::period period;
+ typedef chrono::time_point<system_clock, duration> time_point;
+
+#ifdef _GLIBCXX_USE_CLOCK_MONOTONIC
+ static const bool is_monotonic = true;
+#else
+ static const bool is_monotonic = false;
+#endif
+
+ static time_point
+ now();
+
+ // Map to C API
+ static std::time_t
+ to_time_t(const time_point& __t)
+ {
+ return std::time_t(
+ duration_cast<chrono::seconds>(__t.time_since_epoch()).count());
+ }
+
+ static time_point
+ from_time_t(std::time_t __t)
+ {
+ return time_point_cast<system_clock::duration>(
+ chrono::time_point<system_clock, chrono::seconds>(
+ chrono::seconds(__t)));
+ }
+
+ // TODO: requires constexpr
+ /*
+ static_assert(
+ system_clock::duration::min() <
+ system_clock::duration::zero(),
+ "a clock's minimum duration cannot be less than its epoch");
+ */
+ };
+
+ typedef system_clock high_resolution_clock;
+ typedef system_clock monotonic_clock;
+ }
+}
+
+#endif //_GLIBCXX_USE_C99_STDINT_TR1
+
+#endif //__GXX_EXPERIMENTAL_CXX0X__
+
+#endif //_GLIBCXX_CHRONO
diff --git a/libstdc++-v3/include/std/complex b/libstdc++-v3/include/std/complex
index c8845f6728c..1c48251e350 100644
--- a/libstdc++-v3/include/std/complex
+++ b/libstdc++-v3/include/std/complex
@@ -29,7 +29,7 @@
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
-/** @file complex
+/** @file include/complex
* This is a Standard C++ Library header.
*/
diff --git a/libstdc++-v3/include/std/condition_variable b/libstdc++-v3/include/std/condition_variable
index 1dfb7789499..1a7a7cd1f37 100644
--- a/libstdc++-v3/include/std/condition_variable
+++ b/libstdc++-v3/include/std/condition_variable
@@ -44,8 +44,14 @@
namespace std
{
- // XXX
- class system_time;
+ namespace chrono
+ {
+ template<typename _Rep, typename _Period>
+ struct duration;
+
+ template<typename _Clock, typename _Duration>
+ struct time_point;
+ }
/// condition_variable
class condition_variable
@@ -78,22 +84,27 @@ namespace std
wait(__lock);
}
- template<typename _Duration>
- bool
- timed_wait(unique_lock<mutex>& __lock, const _Duration& __rtime);
-
- bool
- timed_wait(unique_lock<mutex>& __lock, const system_time& __atime);
-
- template<typename _Predicate>
- bool
- timed_wait(unique_lock<mutex>& __lock, const system_time& __atime,
- _Predicate pred);
-
- template<typename _Duration, typename _Predicate>
+ template<typename _Clock, typename _Duration>
bool
- timed_wait(unique_lock<mutex>& __lock, const _Duration& __rtime,
- _Predicate pred);
+ wait_until(unique_lock<mutex>& __lock,
+ const chrono::time_point<_Clock, _Duration>& __atime);
+
+ template<typename _Clock, typename _Duration, typename _Predicate>
+ bool
+ wait_until(unique_lock<mutex>& __lock,
+ const chrono::time_point<_Clock, _Duration>& __atime,
+ _Predicate __p);
+
+ template<typename _Rep, typename _Period>
+ bool
+ wait_for(unique_lock<mutex>& __lock,
+ const chrono::duration<_Rep, _Period>& __rtime);
+
+ template<typename _Rep, typename _Period, typename _Predicate>
+ bool
+ wait_for(unique_lock<mutex>& __lock,
+ const chrono::duration<_Rep, _Period>& __rtime,
+ _Predicate __p);
native_handle_type
native_handle() { return _M_cond; }
@@ -132,21 +143,27 @@ namespace std
void
wait(_Lock& __lock, _Predicate __p);
- template<typename _Lock>
- bool
- timed_wait(_Lock& __lock, const system_time& __atime);
-
- template<typename _Lock, typename _Duration>
- bool
- timed_wait(_Lock& __lock, const _Duration& __rtime);
-
- template<typename _Lock, typename _Predicate>
+ template<typename _Lock, typename _Clock, typename _Duration>
bool
- timed_wait(_Lock& __lock, const system_time& __atime, _Predicate __p);
+ wait_until(_Lock& __lock,
+ const chrono::time_point<_Clock, _Duration>& __atime);
- template<typename _Lock, typename _Duration, typename _Predicate>
+ template<typename _Lock, typename _Clock,
+ typename _Duration, typename _Predicate>
bool
- timed_wait(_Lock& __lock, const _Duration& __rtime, _Predicate __p);
+ wait_until(_Lock& __lock,
+ const chrono::time_point<_Clock, _Duration>& __atime,
+ _Predicate __p);
+
+ template<typename _Lock, typename _Rep, typename _Period>
+ bool
+ wait_for(_Lock& __lock, const chrono::duration<_Rep, _Period>& __rtime);
+
+ template<typename _Lock, typename _Rep,
+ typename _Period, typename _Predicate>
+ bool
+ wait_for(_Lock& __lock,
+ const chrono::duration<_Rep, _Period>& __rtime, _Predicate __p);
native_handle_type
native_handle() { return _M_cond; }
diff --git a/libstdc++-v3/include/std/mutex b/libstdc++-v3/include/std/mutex
index 5d4e52105f8..779394a5891 100644
--- a/libstdc++-v3/include/std/mutex
+++ b/libstdc++-v3/include/std/mutex
@@ -48,8 +48,14 @@
namespace std
{
- // XXX
- class system_time;
+ namespace chrono
+ {
+ template<typename _Rep, typename _Period>
+ struct duration;
+
+ template<typename _Clock, typename _Duration>
+ struct time_point;
+ }
/// mutex
class mutex
@@ -74,22 +80,22 @@ namespace std
int __e = __gthread_mutex_lock(&_M_mutex);
// EINVAL, EAGAIN, EBUSY, EINVAL, EDEADLK(may)
- if (__e)
- __throw_system_error(__e);
+ if (__e)
+ __throw_system_error(__e);
}
bool
try_lock()
{
- // XXX EINVAL, EAGAIN, EBUSY
- return !__gthread_mutex_trylock(&_M_mutex);
+ // XXX EINVAL, EAGAIN, EBUSY
+ return !__gthread_mutex_trylock(&_M_mutex);
}
void
unlock()
{
// XXX EINVAL, EAGAIN, EPERM
- __gthread_mutex_unlock(&_M_mutex);
+ __gthread_mutex_unlock(&_M_mutex);
}
native_handle_type
@@ -102,7 +108,6 @@ namespace std
mutex& operator=(const mutex&);
};
-
/// recursive_mutex
class recursive_mutex
{
@@ -120,15 +125,14 @@ namespace std
#endif
}
-
void
lock()
{
int __e = __gthread_recursive_mutex_lock(&_M_mutex);
// EINVAL, EAGAIN, EBUSY, EINVAL, EDEADLK(may)
- if (__e)
- __throw_system_error(__e);
+ if (__e)
+ __throw_system_error(__e);
}
bool
@@ -146,7 +150,8 @@ namespace std
}
native_handle_type
- native_handle() { return _M_mutex; }
+ native_handle()
+ { return _M_mutex; }
private:
native_handle_type _M_mutex;
@@ -155,9 +160,65 @@ namespace std
recursive_mutex& operator=(const recursive_mutex&);
};
+ /// timed_mutex
+ class timed_mutex
+ {
+ public:
+ typedef __gthread_mutex_t native_handle_type;
+
+ void lock();
+ bool try_lock();
+
+ template <class _Rep, class _Period>
+ bool
+ try_lock_for(const chrono::duration<_Rep, _Period>& __rtime);
+
+ template <class _Clock, class _Duration>
+ bool
+ try_lock_until(const chrono::time_point<_Clock, _Duration>& __atime);
+
+ void unlock();
+
+ native_handle_type
+ native_handle()
+ { return _M_mutex; }
+
+ private:
+ native_handle_type _M_mutex;
+
+ timed_mutex(const timed_mutex&);
+ timed_mutex& operator=(const timed_mutex&);
+ };
+
+ /// recursive_timed_mutex
+ class recursive_timed_mutex
+ {
+ public:
+ typedef __gthread_mutex_t native_handle_type;
+
+ void lock();
+ bool try_lock();
+
+ template <class _Rep, class _Period>
+ bool
+ try_lock_for(const chrono::duration<_Rep, _Period>& __rtime);
+
+ template <class _Clock, class _Duration>
+ bool
+ try_lock_until(const chrono::time_point<_Clock, _Duration>& __atime);
+
+ void unlock();
+
+ native_handle_type
+ native_handle()
+ { return _M_mutex; }
+
+ private:
+ native_handle_type _M_mutex;
- // class timed_mutex;
- // class recursive_timed_mutex;
+ recursive_timed_mutex(const recursive_timed_mutex&);
+ recursive_timed_mutex& operator=(const recursive_timed_mutex&);
+ };
/// Do not acquire ownership of the mutex.
struct defer_lock_t { };
@@ -212,19 +273,24 @@ namespace std
public:
typedef _Mutex mutex_type;
- unique_lock() : _M_device(NULL), _M_owns(false) { }
+ unique_lock()
+ : _M_device(NULL), _M_owns(false)
+ { }
- explicit unique_lock(mutex_type& __m) : _M_device(&__m)
+ explicit unique_lock(mutex_type& __m)
+ : _M_device(&__m)
{
lock();
_M_owns = true;
}
unique_lock(mutex_type& __m, defer_lock_t)
- : _M_device(&__m), _M_owns(false) { }
+ : _M_device(&__m), _M_owns(false)
+ { }
unique_lock(mutex_type& __m, try_to_lock_t)
- : _M_device(&__m), _M_owns(_M_device->try_lock()) { }
+ : _M_device(&__m), _M_owns(_M_device->try_lock())
+ { }
unique_lock(mutex_type& __m, adopt_lock_t)
: _M_device(&__m), _M_owns(true)
@@ -232,10 +298,13 @@ namespace std
// XXX calling thread owns mutex
}
- unique_lock(mutex_type& __m, const system_time& abs_time);
+ template<typename _Clock, typename _Duration>
+ unique_lock(mutex_type& __m,
+ const chrono::time_point<_Clock, _Duration>& __atime);
- template<typename _Duration>
- unique_lock(mutex_type& __m, const _Duration& rel_time);
+ template<typename _Rep, typename _Period>
+ unique_lock(mutex_type& __m,
+ const chrono::duration<_Rep, _Period>& __rtime);
~unique_lock()
{
@@ -247,7 +316,6 @@ namespace std
unique_lock& operator=(unique_lock&&);
-
void
lock()
{
@@ -277,12 +345,13 @@ namespace std
throw lock_error();
}
+ template<typename _Rep, typename _Period>
+ bool
+ try_lock_for(const chrono::duration<_Rep, _Period>& __rtime);
- template<typename _Duration>
- bool timed_lock(const _Duration& rel_time);
-
- bool
- timed_lock(const system_time& abs_time);
+ template<typename _Clock, typename _Duration>
+ bool
+ try_lock_until(const chrono::time_point<_Clock, _Duration>& __atime);
void
swap(unique_lock&& __u);
@@ -297,9 +366,11 @@ namespace std
}
bool
- owns_lock() const { return _M_owns; }
+ owns_lock() const
+ { return _M_owns; }
- operator bool () const { return owns_lock(); }
+ operator bool () const
+ { return owns_lock(); }
mutex_type*
mutex() const
diff --git a/libstdc++-v3/include/std/ratio b/libstdc++-v3/include/std/ratio
index 9980571f160..124e9af397a 100644
--- a/libstdc++-v3/include/std/ratio
+++ b/libstdc++-v3/include/std/ratio
@@ -165,6 +165,7 @@ namespace std
template<intmax_t _Num, intmax_t _Den>
const intmax_t ratio<_Num, _Den>::den;
+ /// ratio_add
template<typename _R1, typename _R2>
struct ratio_add
{
@@ -180,6 +181,7 @@ namespace std
__safe_multiply<_R1::den, (_R2::den / __gcd)>::value> type;
};
+ /// ratio_subtract
template<typename _R1, typename _R2>
struct ratio_subtract
{
@@ -188,6 +190,7 @@ namespace std
ratio<-_R2::num, _R2::den>>::type type;
};
+ /// ratio_multiply
template<typename _R1, typename _R2>
struct ratio_multiply
{
@@ -205,6 +208,7 @@ namespace std
(_R2::den / __gcd1)>::value> type;
};
+ /// ratio_divide
template<typename _R1, typename _R2>
struct ratio_divide
{
@@ -215,11 +219,13 @@ namespace std
ratio<_R2::den, _R2::num>>::type type;
};
+ /// ratio_equal
template<typename _R1, typename _R2>
struct ratio_equal
: integral_constant<bool, _R1::num == _R2::num && _R1::den == _R2::den>
{ };
+ /// ratio_not_equal
template<typename _R1, typename _R2>
struct ratio_not_equal
: integral_constant<bool, !ratio_equal<_R1, _R2>::value>
@@ -243,21 +249,25 @@ namespace std
__ratio_less_simple_impl<_R1, _R2>>::type
{ };
+ /// ratio_less
template<typename _R1, typename _R2>
struct ratio_less
: __ratio_less_impl<_R1, _R2>::type
{ };
+ /// ratio_less_equal
template<typename _R1, typename _R2>
struct ratio_less_equal
: integral_constant<bool, !ratio_less<_R2, _R1>::value>
{ };
+ /// ratio_greater
template<typename _R1, typename _R2>
struct ratio_greater
: integral_constant<bool, ratio_less<_R2, _R1>::value>
{ };
+ /// ratio_greater_equal
template<typename _R1, typename _R2>
struct ratio_greater_equal
: integral_constant<bool, !ratio_less<_R1, _R2>::value>
diff --git a/libstdc++-v3/include/std/unordered_map b/libstdc++-v3/include/std/unordered_map
index d20af8ba286..f2586786cc9 100644
--- a/libstdc++-v3/include/std/unordered_map
+++ b/libstdc++-v3/include/std/unordered_map
@@ -46,6 +46,7 @@
#include <utility>
#include <type_traits>
+#include <initializer_list>
#include <bits/stl_algobase.h>
#include <bits/allocator.h>
#include <bits/stl_function.h> // equal_to, _Identity, _Select1st
diff --git a/libstdc++-v3/include/std/unordered_set b/libstdc++-v3/include/std/unordered_set
index 87c8a4d80f4..32d66c2d005 100644
--- a/libstdc++-v3/include/std/unordered_set
+++ b/libstdc++-v3/include/std/unordered_set
@@ -46,6 +46,7 @@
#include <utility>
#include <type_traits>
+#include <initializer_list>
#include <bits/stl_algobase.h>
#include <bits/allocator.h>
#include <bits/stl_function.h> // equal_to, _Identity, _Select1st
diff --git a/libstdc++-v3/include/std/utility b/libstdc++-v3/include/std/utility
index 027d513ccca..8a006ca500b 100644
--- a/libstdc++-v3/include/std/utility
+++ b/libstdc++-v3/include/std/utility
@@ -85,6 +85,7 @@
# undef _GLIBCXX_INCLUDE_AS_CXX0X
# endif
# include <bits/move.h>
+# include <initializer_list>
#endif
#endif /* _GLIBCXX_UTILITY */
diff --git a/libstdc++-v3/include/std/valarray b/libstdc++-v3/include/std/valarray
index 31799c04cce..b0fa5124805 100644
--- a/libstdc++-v3/include/std/valarray
+++ b/libstdc++-v3/include/std/valarray
@@ -45,6 +45,7 @@
#include <cmath>
#include <algorithm>
#include <debug/debug.h>
+#include <initializer_list>
_GLIBCXX_BEGIN_NAMESPACE(std)
@@ -144,6 +145,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
/// Construct an array with the same size and values in @a ia.
valarray(const indirect_array<_Tp>&);
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /// Construct an array with an initializer_list of values.
+ valarray(initializer_list<_Tp>);
+#endif
+
template<class _Dom>
valarray(const _Expr<_Dom, _Tp>& __e);
@@ -209,6 +215,18 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
*/
valarray<_Tp>& operator=(const indirect_array<_Tp>&);
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Assign elements to an initializer_list.
+ *
+ * Assign elements of array to values in @a l. Results are undefined
+ * if @a l does not have the same size as this array.
+ *
+ * @param l initializer_list to get values from.
+ */
+ valarray& operator=(initializer_list<_Tp>);
+#endif
+
template<class _Dom> valarray<_Tp>&
operator= (const _Expr<_Dom, _Tp>&);
@@ -615,6 +633,14 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
(__ia._M_array, __ia._M_index, _Array<_Tp>(_M_data), _M_size);
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Tp>
+ inline
+ valarray<_Tp>::valarray(initializer_list<_Tp> __l)
+ : _M_size(__l.size()), _M_data(__valarray_get_storage<_Tp>(__l.size()))
+ { std::__valarray_copy_construct (__l.begin(), __l.end(), _M_data); }
+#endif
+
template<typename _Tp> template<class _Dom>
inline
valarray<_Tp>::valarray(const _Expr<_Dom, _Tp>& __e)
@@ -638,6 +664,16 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
return *this;
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Tp>
+ inline valarray<_Tp>&
+ valarray<_Tp>::operator=(initializer_list<_Tp> __l)
+ {
+ _GLIBCXX_DEBUG_ASSERT(_M_size == __l.size());
+ std::__valarray_copy(__l.begin(), __l.size(), _M_data);
+ }
+#endif
+
template<typename _Tp>
inline valarray<_Tp>&
valarray<_Tp>::operator=(const _Tp& __t)
diff --git a/libstdc++-v3/include/tr1/type_traits b/libstdc++-v3/include/tr1/type_traits
index 734eec6ab7e..f5cffe88a68 100644
--- a/libstdc++-v3/include/tr1/type_traits
+++ b/libstdc++-v3/include/tr1/type_traits
@@ -1,6 +1,6 @@
// TR1 type_traits -*- C++ -*-
-// Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -60,17 +60,11 @@ namespace std
{
namespace tr1
{
-#define _DEFINE_SPEC_HELPER(_Spec) \
- template<> \
- struct _Spec \
+#define _DEFINE_SPEC(_Trait, _Type) \
+ template<> \
+ struct _Trait<_Type> \
: public true_type { };
-#define _DEFINE_SPEC(_Trait, _Type) \
- _DEFINE_SPEC_HELPER(_Trait<_Type>) \
- _DEFINE_SPEC_HELPER(_Trait<_Type const>) \
- _DEFINE_SPEC_HELPER(_Trait<_Type volatile>) \
- _DEFINE_SPEC_HELPER(_Trait<_Type const volatile>)
-
template<typename>
struct is_reference
: public false_type { };
@@ -120,22 +114,34 @@ namespace tr1
{ };
template<typename>
- struct is_signed
+ struct __is_signed_helper
: public false_type { };
- _DEFINE_SPEC(is_signed, signed char)
- _DEFINE_SPEC(is_signed, short)
- _DEFINE_SPEC(is_signed, int)
- _DEFINE_SPEC(is_signed, long)
- _DEFINE_SPEC(is_signed, long long)
+ _DEFINE_SPEC(__is_signed_helper, signed char)
+ _DEFINE_SPEC(__is_signed_helper, short)
+ _DEFINE_SPEC(__is_signed_helper, int)
+ _DEFINE_SPEC(__is_signed_helper, long)
+ _DEFINE_SPEC(__is_signed_helper, long long)
+
+ template<typename _Tp>
+ struct is_signed
+ : public integral_constant<bool, (__is_signed_helper<typename
+ remove_cv<_Tp>::type>::value)>
+ { };
template<typename>
- struct is_unsigned
+ struct __is_unsigned_helper
: public false_type { };
- _DEFINE_SPEC(is_unsigned, unsigned char)
- _DEFINE_SPEC(is_unsigned, unsigned short)
- _DEFINE_SPEC(is_unsigned, unsigned int)
- _DEFINE_SPEC(is_unsigned, unsigned long)
- _DEFINE_SPEC(is_unsigned, unsigned long long)
+ _DEFINE_SPEC(__is_unsigned_helper, unsigned char)
+ _DEFINE_SPEC(__is_unsigned_helper, unsigned short)
+ _DEFINE_SPEC(__is_unsigned_helper, unsigned int)
+ _DEFINE_SPEC(__is_unsigned_helper, unsigned long)
+ _DEFINE_SPEC(__is_unsigned_helper, unsigned long long)
+
+ template<typename _Tp>
+ struct is_unsigned
+ : public integral_constant<bool, (__is_unsigned_helper<typename
+ remove_cv<_Tp>::type>::value)>
+ { };
template<typename _Base, typename _Derived>
struct __is_base_of_helper
@@ -241,7 +247,6 @@ namespace tr1
};
};
-#undef _DEFINE_SPEC_HELPER
#undef _DEFINE_SPEC
}
}
diff --git a/libstdc++-v3/include/tr1_impl/boost_shared_ptr.h b/libstdc++-v3/include/tr1_impl/boost_shared_ptr.h
index a3fd80e8551..5da40516bd6 100644
--- a/libstdc++-v3/include/tr1_impl/boost_shared_ptr.h
+++ b/libstdc++-v3/include/tr1_impl/boost_shared_ptr.h
@@ -1,6 +1,6 @@
// <tr1_impl/boost_shared_ptr.h> -*- C++ -*-
-// Copyright (C) 2007 Free Software Foundation, Inc.
+// Copyright (C) 2007, 2008 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -505,13 +505,14 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
// This constructor is non-standard, it is used by allocate_shared.
template<typename _Alloc, typename... _Args>
__shared_ptr(_Sp_make_shared_tag __tag, _Alloc __a, _Args&&... __args)
- : _M_ptr()
- , _M_refcount(__tag, (_Tp*)0, __a, std::forward<_Args>(__args)...)
+ : _M_ptr(), _M_refcount(__tag, (_Tp*)0, __a,
+ std::forward<_Args>(__args)...)
{
// _M_ptr needs to point to the newly constructed object.
// This relies on _Sp_counted_ptr_inplace::_M_get_deleter.
- void * __p = _M_refcount._M_get_deleter(typeid(__tag));
+ void* __p = _M_refcount._M_get_deleter(typeid(__tag));
_M_ptr = static_cast<_Tp*>(__p);
+ __enable_shared_from_this_helper(_M_refcount, _M_ptr, _M_ptr);
}
template<typename _Tp1, _Lock_policy _Lp1, typename _Alloc,
diff --git a/libstdc++-v3/include/tr1_impl/cstdint b/libstdc++-v3/include/tr1_impl/cstdint
index 6df74c761cb..93edf7c4fcd 100644
--- a/libstdc++-v3/include/tr1_impl/cstdint
+++ b/libstdc++-v3/include/tr1_impl/cstdint
@@ -1,6 +1,6 @@
// TR1 cstdint -*- C++ -*-
-// Copyright (C) 2007 Free Software Foundation, Inc.
+// Copyright (C) 2007, 2008 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -36,9 +36,13 @@
#if _GLIBCXX_USE_C99_STDINT_TR1
-// For 8.22.1/1 (see C99, Notes 219, 220, 222)
-#define __STDC_LIMIT_MACROS
-#define __STDC_CONSTANT_MACROS
+// For 8.22.1/1 (see C99, Notes 219, 220, 222)
+#ifndef __STDC_LIMIT_MACROS
+# define __STDC_LIMIT_MACROS
+#endif
+#ifndef __STDC_CONSTANT_MACROS
+# define __STDC_CONSTANT_MACROS
+#endif
#include_next <stdint.h>
namespace std
diff --git a/libstdc++-v3/include/tr1_impl/hashtable b/libstdc++-v3/include/tr1_impl/hashtable
index 36194c9c0d4..4a5883485bf 100644
--- a/libstdc++-v3/include/tr1_impl/hashtable
+++ b/libstdc++-v3/include/tr1_impl/hashtable
@@ -437,6 +437,12 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
void
insert(_InputIterator __first, _InputIterator __last);
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ void
+ insert(initializer_list<value_type> __l)
+ { this->insert(__l.begin(), __l.end()); }
+#endif
+
iterator
erase(iterator);
diff --git a/libstdc++-v3/include/tr1_impl/regex b/libstdc++-v3/include/tr1_impl/regex
index f99e0067850..c2a60a2c3ea 100644
--- a/libstdc++-v3/include/tr1_impl/regex
+++ b/libstdc++-v3/include/tr1_impl/regex
@@ -1,6 +1,6 @@
// class template regex -*- C++ -*-
-// Copyright (C) 2007 Free Software Foundation, Inc.
+// Copyright (C) 2007, 2008 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -29,6 +29,8 @@
/**
* @file tr1_impl/regex
+ * @brief The common implementation file for tr1 and std regular expressions.
+ *
* This is an internal header file, included by other library headers.
* You should not attempt to use it directly.
*/
@@ -40,12 +42,15 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
/**
* @addtogroup tr1_regex Regular Expressions
* A facility for performing regular expression pattern matching.
- * @{
*/
+ //@{
namespace regex_constants
{
- // [7.5.1] Bitmask Type syntax_option_type
+ /**
+ * @name 5.1 Regular Expression Syntax Options
+ */
+ //@{
enum __syntax_option
{
_S_icase,
@@ -70,72 +75,103 @@ namespace regex_constants
*
* A valid value of type syntax_option_type shall have exactly one of the
* elements @c ECMAScript, @c basic, @c extended, @c awk, @c grep, @c egrep
- * set.
+ * %set.
*/
typedef unsigned int syntax_option_type;
- /// Specifies that the matching of regular expressions against a character
- /// sequence shall be performed without regard to case.
+ /**
+ * Specifies that the matching of regular expressions against a character
+ * sequence shall be performed without regard to case.
+ */
static const syntax_option_type icase = 1 << _S_icase;
- /// Specifies that when a regular expression is matched against a character
- /// container sequence, no sub-expression matches are to be stored in the
- /// supplied match_results structure.
+ /**
+ * Specifies that when a regular expression is matched against a character
+ * container sequence, no sub-expression matches are to be stored in the
+ * supplied match_results structure.
+ */
static const syntax_option_type nosubs = 1 << _S_nosubs;
- /// Specifies that the regular expression engine should pay more attention to
- /// the speed with which regular expressions are matched, and less to the
- /// speed with which regular expression objects are constructed. Otherwise
- /// it has no detectable effect on the program output.
+ /**
+ * Specifies that the regular expression engine should pay more attention to
+ * the speed with which regular expressions are matched, and less to the
+ * speed with which regular expression objects are constructed. Otherwise
+ * it has no detectable effect on the program output.
+ */
static const syntax_option_type optimize = 1 << _S_optimize;
- /// Specifies that character ranges of the form [a-b] should be locale
- /// sensitive.
+ /**
+ * Specifies that character ranges of the form [a-b] should be locale
+ * sensitive.
+ */
static const syntax_option_type collate = 1 << _S_collate;
- /// Specifies that the grammar recognized by the regular expression engine is
- /// that used by ECMAScript in ECMA-262 [Ecma International, ECMAScript
- /// Language Specification, Standard Ecma-262, third edition, 1999], as
- /// modified in tr1 section [7.13]. This grammar is similar to that defined
- /// in the PERL scripting language but extended with elements found in the
- /// POSIX regular expression grammar.
+ /**
+ * Specifies that the grammar recognized by the regular expression engine is
+ * that used by ECMAScript in ECMA-262 [Ecma International, ECMAScript
+ * Language Specification, Standard Ecma-262, third edition, 1999], as
+ * modified in tr1 section [7.13]. This grammar is similar to that defined
+ * in the PERL scripting language but extended with elements found in the
+ * POSIX regular expression grammar.
+ */
static const syntax_option_type ECMAScript = 1 << _S_ECMAScript;
- /// Specifies that the grammar recognized by the regular expression engine is
- /// that used by POSIX basic regular expressions in IEEE Std 1003.1-2001,
- /// Portable Operating System Interface (POSIX), Base Definitions and
- /// Headers, Section 9, Regular Expressions [IEEE, Information Technology --
- /// Portable Operating System Interface (POSIX), IEEE Standard 1003.1-2001].
+ /**
+ * Specifies that the grammar recognized by the regular expression engine is
+ * that used by POSIX basic regular expressions in IEEE Std 1003.1-2001,
+ * Portable Operating System Interface (POSIX), Base Definitions and
+ * Headers, Section 9, Regular Expressions [IEEE, Information Technology --
+ * Portable Operating System Interface (POSIX), IEEE Standard 1003.1-2001].
+ */
static const syntax_option_type basic = 1 << _S_basic;
- /// Specifies that the grammar recognized by the regular expression engine is
- /// that used by POSIX extended regular expressions in IEEE Std 1003.1-2001,
- /// Portable Operating System Interface (POSIX), Base Definitions and Headers,
- /// Section 9, Regular Expressions.
+ /**
+ * Specifies that the grammar recognized by the regular expression engine is
+ * that used by POSIX extended regular expressions in IEEE Std 1003.1-2001,
+ * Portable Operating System Interface (POSIX), Base Definitions and Headers,
+ * Section 9, Regular Expressions.
+ */
static const syntax_option_type extended = 1 << _S_extended;
- /// Specifies that the grammar recognized by the regular expression engine is
- /// that used by POSIX utility awk in IEEE Std 1003.1-2001. This option is
- /// identical to syntax_option_type extended, except that C-style escape
- /// sequences are supported. These sequences are, explicitly, '\\', '\a',
- /// '\b', '\f', '\n', '\r', '\t' , '\v', '\"', '\\', and '\ddd' (where ddd is
- /// one, two, or three octal digits).
+ /**
+ * Specifies that the grammar recognized by the regular expression engine is
+ * that used by POSIX utility awk in IEEE Std 1003.1-2001. This option is
+ * identical to syntax_option_type extended, except that C-style escape
+ * sequences are supported. These sequences are, explicitly, "\\", "\a",
+ * "\b", "\f", "\n", "\r", "\t" , "\v", "\"", "'",
+ * and "\ddd" (where ddd is one, two, or three octal digits).
+ */
static const syntax_option_type awk = 1 << _S_awk;
- /// Specifies that the grammar recognized by the regular expression engine is
- /// that used by POSIX utility grep in IEEE Std 1003.1-2001. This option is
- /// identical to syntax_option_type basic, except that newlines are treated
- /// as whitespace.
+ /**
+ * Specifies that the grammar recognized by the regular expression engine is
+ * that used by POSIX utility grep in IEEE Std 1003.1-2001. This option is
+ * identical to syntax_option_type basic, except that newlines are treated
+ * as whitespace.
+ */
static const syntax_option_type grep = 1 << _S_grep;
- /// Specifies that the grammar recognized by the regular expression engine is
- /// that used by POSIX utility grep when given the -E option in
- /// IEEE Std 1003.1-2001. This option is identical to syntax_option_type
- /// extended, except that newlines are treated as whitespace.
+ /**
+ * Specifies that the grammar recognized by the regular expression engine is
+ * that used by POSIX utility grep when given the -E option in
+ * IEEE Std 1003.1-2001. This option is identical to syntax_option_type
+ * extended, except that newlines are treated as whitespace.
+ */
static const syntax_option_type egrep = 1 << _S_egrep;
+ //@}
+
+ /**
+ * @name 5.2 Matching Rules
+ *
+ * Matching a regular expression against a sequence of characters [first,
+ * last) proceeds according to the rules of the grammar specified for the
+ * regular expression object, modified according to the effects listed
+ * below for any bitmask elements set.
+ *
+ */
+ //@{
- // [7.5.2] Bitmask Type match_flag_type
enum __match_flag
{
_S_not_bol,
@@ -155,93 +191,122 @@ namespace regex_constants
/**
* @brief This is a bitmask type indicating regex matching rules.
*
- * Matching a regular expression against a sequence of characters [first,
- * last) proceeds according to the rules of the grammar specified for the
- * regular expression object, modified according to the effects listed
- * below for any bitmask elements set.
- *
* The @c match_flag_type is implementation defined but it is valid to
* perform bitwise operations on these values and expect the right thing to
* happen.
*/
typedef std::bitset<_S_match_flag_last> match_flag_type;
+ /**
+ * The default matching rules.
+ */
static const match_flag_type match_default = 0;
- /// The first character in the sequence [first, last) is treated as though it
- /// is not at the beginning of a line, so the character "^" in the regular
- /// expression shall not match [first, first).
+ /**
+ * The first character in the sequence [first, last) is treated as though it
+ * is not at the beginning of a line, so the character "^" in the regular
+ * expression shall not match [first, first).
+ */
static const match_flag_type match_not_bol = 1 << _S_not_bol;
- /// The last character in the sequence [first, last) is treated as though it
- /// is not at the end of a line, so the character "$" in the regular
- /// expression shall not match [last, last).
+ /**
+ * The last character in the sequence [first, last) is treated as though it
+ * is not at the end of a line, so the character "$" in the regular
+ * expression shall not match [last, last).
+ */
static const match_flag_type match_not_eol = 1 << _S_not_eol;
- /// The expression "\b" is not matched against the sub-sequence
- /// [first,first).
+ /**
+ * The expression "\b" is not matched against the sub-sequence
+ * [first,first).
+ */
static const match_flag_type match_not_bow = 1 << _S_not_bow;
- /// The expression "\b" should not be matched against the sub-sequence
- /// [last,last).
+ /**
+ * The expression "\b" should not be matched against the sub-sequence
+ * [last,last).
+ */
static const match_flag_type match_not_eow = 1 << _S_not_eow;
- /// If more than one match is possible then any match is an acceptable
- /// result.
+ /**
+ * If more than one match is possible then any match is an acceptable
+ * result.
+ */
static const match_flag_type match_any = 1 << _S_any;
- /// The expression does not match an empty sequence.
+ /**
+ * The expression does not match an empty sequence.
+ */
static const match_flag_type match_not_null = 1 << _S_not_null;
- /// The expression only matches a sub-sequence that begins at first .
+ /**
+ * The expression only matches a sub-sequence that begins at first .
+ */
static const match_flag_type match_continuous = 1 << _S_continuous;
- /// --first is a valid iterator position. When this flag is set then the
- /// flags match_not_bol and match_not_bow are ignored by the regular
- /// expression algorithms 7.11 and iterators 7.12.
+ /**
+ * --first is a valid iterator position. When this flag is set then the
+ * flags match_not_bol and match_not_bow are ignored by the regular
+ * expression algorithms 7.11 and iterators 7.12.
+ */
static const match_flag_type match_prev_avail = 1 << _S_prev_avail;
- /// When a regular expression match is to be replaced by a new string, the
- /// new string is constructed using the rules used by the ECMAScript replace
- /// function in ECMA- 262 [Ecma International, ECMAScript Language
- /// Specification, Standard Ecma-262, third edition, 1999], part 15.5.4.11
- /// String.prototype.replace. In addition, during search and replace
- /// operations all non-overlapping occurrences of the regular expression
- /// are located and replaced, and sections of the input that did not match
- /// the expression are copied unchanged to the output string.
- ///
- /// Format strings (from ECMA-262 [15.5.4.11]):
- /// $$ $
- /// $& The matched substring.
- /// $` The portion of <em>string</em> that precedes the matched substring.
- /// $' The portion of <em>string</em> that follows the matched substring.
- /// $n The nth capture, where n is in [1,9] and $n is not followed by a
- /// decimal digit. If n <= m and the nth capture is undefined, use the
- /// empty string
- /// instead. If n > m, the result is implementation-defined.
- /// $nn The nnth capture, where nn is a two-digit decimal number on [01, 99].
- /// If nn <= m and the nth capture is undefined, use the empty string
- /// instead. If nn > m, the result is implementation-defined.
- ///
+ /**
+ * When a regular expression match is to be replaced by a new string, the
+ * new string is constructed using the rules used by the ECMAScript replace
+ * function in ECMA- 262 [Ecma International, ECMAScript Language
+ * Specification, Standard Ecma-262, third edition, 1999], part 15.5.4.11
+ * String.prototype.replace. In addition, during search and replace
+ * operations all non-overlapping occurrences of the regular expression
+ * are located and replaced, and sections of the input that did not match
+ * the expression are copied unchanged to the output string.
+ *
+ * Format strings (from ECMA-262 [15.5.4.11]):
+ * @li $$ The dollar-sign itself ($)
+ * @li $& The matched substring.
+ * @li $` The portion of <em>string</em> that precedes the matched substring.
+ * This would be match_results::prefix().
+ * @li $' The portion of <em>string</em> that follows the matched substring.
+ * This would be match_results::suffix().
+ * @li $n The nth capture, where n is in [1,9] and $n is not followed by a
+ * decimal digit. If n <= match_results::size() and the nth capture
+ * is undefined, use the empty string instead. If n >
+ * match_results::size(), the result is implementation-defined.
+ * @li $nn The nnth capture, where nn is a two-digit decimal number on
+ * [01, 99]. If nn <= match_results::size() and the nth capture is
+ * undefined, use the empty string instead. If
+ * nn > match_results::size(), the result is implementation-defined.
+ */
static const match_flag_type format_default = 0;
- /// When a regular expression match is to be replaced by a new string, the
- /// new string is constructed using the rules used by the POSIX sed utility
- /// in IEEE Std 1003.1- 2001 [IEEE, Information Technology -- Portable
- /// Operating System Interface (POSIX), IEEE Standard 1003.1-2001].
+ /**
+ * When a regular expression match is to be replaced by a new string, the
+ * new string is constructed using the rules used by the POSIX sed utility
+ * in IEEE Std 1003.1- 2001 [IEEE, Information Technology -- Portable
+ * Operating System Interface (POSIX), IEEE Standard 1003.1-2001].
+ */
static const match_flag_type format_sed = 1 << _S_sed;
- /// During a search and replace operation, sections of the character
- /// container sequence being searched that do not match the regular
- /// expression shall not be copied to the output string.
+ /**
+ * During a search and replace operation, sections of the character
+ * container sequence being searched that do not match the regular
+ * expression shall not be copied to the output string.
+ */
static const match_flag_type format_no_copy = 1 << _S_no_copy;
- /// When specified during a search and replace operation, only the first
- /// occurrence of the regular expression shall be replaced.
+ /**
+ * When specified during a search and replace operation, only the first
+ * occurrence of the regular expression shall be replaced.
+ */
static const match_flag_type format_first_only = 1 << _S_first_only;
+ //@}
- /// [7.5.3] implementation-defined error type
+ /**
+ * @name 5.3 Error Types
+ */
+ //@{
+
enum error_type
{
_S_error_collate,
@@ -260,63 +325,78 @@ namespace regex_constants
_S_error_last
};
- /// The expression contained an invalid collating element name.
+ /** The expression contained an invalid collating element name. */
static const error_type error_collate(_S_error_collate);
- /// The expression contained an invalid character class name.
+ /** The expression contained an invalid character class name. */
static const error_type error_ctype(_S_error_ctype);
- /// The expression contained an invalid escaped character, or a trailing
- /// escape.
+ /**
+ * The expression contained an invalid escaped character, or a trailing
+ * escape.
+ */
static const error_type error_escape(_S_error_escape);
- /// The expression contained an invalid back reference.
+ /** The expression contained an invalid back reference. */
static const error_type error_backref(_S_error_backref);
- /// The expression contained mismatched [ and ].
+ /** The expression contained mismatched [ and ]. */
static const error_type error_brack(_S_error_brack);
- /// The expression contained mismatched ( and ).
+ /** The expression contained mismatched ( and ). */
static const error_type error_paren(_S_error_paren);
- /// The expression contained mismatched { and }
+ /** The expression contained mismatched { and } */
static const error_type error_brace(_S_error_brace);
- /// The expression contained an invalid range in a {} expression.
+ /** The expression contained an invalid range in a {} expression. */
static const error_type error_badbrace(_S_error_badbrace);
- /// The expression contained an invalid character range,
- /// such as [b-a] in most encodings.
+ /**
+ * The expression contained an invalid character range,
+ * such as [b-a] in most encodings.
+ */
static const error_type error_range(_S_error_range);
- /// There was insufficient memory to convert the expression into a
- /// finite state machine.
+ /**
+ * There was insufficient memory to convert the expression into a
+ * finite state machine.
+ */
static const error_type error_space(_S_error_space);
- /// One of *?+{ was not preceded by a valid regular expression.
+ /**
+ * One of "*?+{" was not preceded by a valid regular expression.
+ */
static const error_type error_badrepeat(_S_error_badrepeat);
- /// The complexity of an attempted match against a regular expression
- /// exceeded a pre-set level.
+ /**
+ * The complexity of an attempted match against a regular expression
+ * exceeded a pre-set level.
+ */
static const error_type error_complexity(_S_error_complexity);
- /// There was insufficient memory to determine whether the
- /// regular expression could match the specified character sequence.
+ /**
+ * There was insufficient memory to determine whether the
+ * regular expression could match the specified character sequence.
+ */
static const error_type error_stack(_S_error_stack);
+
+ //@}
}
// [7.8] Class regex_error
/**
- * Defines the exception objects thrown report errors from the
- * regular expression library.
+ * @brief A regular expression exception class.
+ *
+ * The regular expression library throws objects of this class on error.
*/
class regex_error
: public std::runtime_error
{
public:
/**
- * @brief constructs a regex_error object.
+ * @brief Constructs a regex_error object.
*
* @param ecode the regex error code.
*/
@@ -326,7 +406,7 @@ namespace regex_constants
{ }
/**
- * @brief gets the regex error code.
+ * @brief Gets the regex error code.
*
* @returns the regex error code.
*/
@@ -338,9 +418,10 @@ namespace regex_constants
regex_constants::error_type _M_code;
};
-
// [7.7] Class regex_traits
/**
+ * @brief Describes aspects of a regular expression.
+ *
* A regular expression traits class that satisfies the requirements of tr1
* section [7.2].
*
@@ -526,38 +607,7 @@ namespace regex_constants
* facet.
*/
bool
- isctype(_Ch_type __c, char_class_type __f) const
- {
- using std::ctype;
- using std::use_facet;
- const ctype<_Ch_type>& __ctype(use_facet<
- ctype<_Ch_type> >(_M_locale));
-
- if (__ctype.is(__c, __f))
- return true;
-
- // special case of underscore in [[:w:]]
- if (__c == __ctype.widen('_'))
- {
- const char* const __wb[] = "w";
- char_class_type __wt = this->lookup_classname(__wb,
- __wb + sizeof(__wb));
- if (__f | __wt)
- return true;
- }
-
- // special case of [[:space:]] in [[:blank:]]
- if (__c == __ctype.isspace(__c))
- {
- const char* const __bb[] = "blank";
- char_class_type __bt = this->lookup_classname(__bb,
- __bb + sizeof(__bb));
- if (__f | __bt)
- return true;
- }
-
- return false;
- }
+ isctype(_Ch_type __c, char_class_type __f) const;
/**
* @brief Converts a digit to an int.
@@ -568,8 +618,6 @@ namespace regex_constants
*
* @returns the value represented by the digit ch in base radix if the
* character ch is a valid digit in base radix; otherwise returns -1.
- *
- * @todo Implement this function.
*/
int
value(_Ch_type __ch, int __radix) const;
@@ -604,6 +652,54 @@ namespace regex_constants
locale_type _M_locale;
};
+ template<typename _Ch_type>
+ bool regex_traits<_Ch_type>::
+ isctype(_Ch_type __c, char_class_type __f) const
+ {
+ using std::ctype;
+ using std::use_facet;
+ const ctype<_Ch_type>& __ctype(use_facet<
+ ctype<_Ch_type> >(_M_locale));
+
+ if (__ctype.is(__c, __f))
+ return true;
+
+ // special case of underscore in [[:w:]]
+ if (__c == __ctype.widen('_'))
+ {
+ const char* const __wb[] = "w";
+ char_class_type __wt = this->lookup_classname(__wb,
+ __wb + sizeof(__wb));
+ if (__f | __wt)
+ return true;
+ }
+
+ // special case of [[:space:]] in [[:blank:]]
+ if (__c == __ctype.isspace(__c))
+ {
+ const char* const __bb[] = "blank";
+ char_class_type __bt = this->lookup_classname(__bb,
+ __bb + sizeof(__bb));
+ if (__f | __bt)
+ return true;
+ }
+
+ return false;
+ }
+
+ template<typename _Ch_type>
+ int regex_traits<_Ch_type>::
+ value(_Ch_type __ch, int __radix) const
+ {
+ std::basic_istringstream<_Ch_type> __is(string_type(1, __ch));
+ int __v = -1;
+ if (__radix == 8)
+ __is >> std::oct;
+ else if (__radix == 16)
+ __is >> std::hex;
+ __is >> __v;
+ return __v;
+ }
// [7.8] Class basic_regex
/**
@@ -623,7 +719,11 @@ namespace regex_constants
typedef typename _Rx_traits::locale_type locale_type;
typedef typename _Rx_traits::string_type string_type;
- // [7.8.1] constants
+ /**
+ * @name Constants
+ * tr1 [7.8.1] std [28.8.1]
+ */
+ //@{
static const regex_constants::syntax_option_type icase
= regex_constants::icase;
static const regex_constants::syntax_option_type nosubs
@@ -644,6 +744,7 @@ namespace regex_constants
= regex_constants::grep;
static const regex_constants::syntax_option_type egrep
= regex_constants::egrep;
+ //@}
// [7.8.2] construct/copy/destroy
/**
@@ -722,7 +823,8 @@ namespace regex_constants
* expression.
* @param f The format flags of the regular expression.
*
- * @throws regex_error if @p p is not a valid regular expression.
+ * @throws regex_error if @p [first, last) is not a valid regular
+ * expression.
*/
template<typename _InputIterator>
basic_regex(_InputIterator __first, _InputIterator __last,
@@ -730,6 +832,21 @@ namespace regex_constants
: _M_flags(__f), _M_pattern(__first, __last), _M_mark_count(0)
{ _M_compile(); }
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ /**
+ * @brief Constructs a basic regular expression from an initializer list.
+ *
+ * @param l The initializer list.
+ * @param f The format flags of the regular expression.
+ *
+ * @throws regex_error if @p l is not a valid regular expression.
+ */
+ basic_regex(initializer_list<_Ch_type> __l,
+ flag_type __f = regex_constants::ECMAScript)
+ : _M_flags(__f), _M_pattern(__l.begin(), __l.end()), _M_mark_count(0)
+ { _M_compile(); }
+#endif
+
/**
* @brief Destroys a basic regular expression.
*/
@@ -846,7 +963,7 @@ namespace regex_constants
*
* @throws regex_error if p does not contain a valid regular expression
* pattern interpreted according to @p flags. If regex_error is thrown,
- * *this remains unchanged.
+ * the object remains unchanged.
*/
template<typename _InputIterator>
basic_regex&
@@ -854,6 +971,23 @@ namespace regex_constants
flag_type __flags = regex_constants::ECMAScript)
{ return this->assign(string_type(__first, __last), __flags); }
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ /**
+ * @brief Assigns a new regular expression to a regex object.
+ *
+ * @param l An initializer list representing a regular expression.
+ * @param flags Syntax option flags.
+ *
+ * @throws regex_error if @p l does not contain a valid regular
+ * expression pattern interpreted according to @p flags. If regex_error
+ * is thrown, the object remains unchanged.
+ */
+ basic_regex&
+ assign(initializer_list<_Ch_type> __l,
+ flag_type __f = regex_constants::ECMAScript)
+ { return this->assign(__l.begin(), __l.end(), __f); }
+#endif
+
// [7.8.4] const operations
/**
* @brief Gets the number of marked subexpressions within the regular
@@ -919,8 +1053,10 @@ namespace regex_constants
_Rx_traits _M_traits;
};
+ /** @brief Standard regular expressions. */
typedef basic_regex<char> regex;
#ifdef _GLIBCXX_USE_WCHAR_T
+ /** @brief Standard wide-character regular expressions. */
typedef basic_regex<wchar_t> wregex;
#endif
@@ -1041,10 +1177,14 @@ namespace regex_constants
};
+ /** @brief Standard regex submatch over a C-style null-terminated string. */
typedef sub_match<const char*> csub_match;
+ /** @brief Standard regex submatch over a standard string. */
typedef sub_match<string::const_iterator> ssub_match;
#ifdef _GLIBCXX_USE_WCHAR_T
+ /** @brief Regex submatch over a C-style null-terminated wide string. */
typedef sub_match<const wchar_t*> wcsub_match;
+ /** @brief Regex submatch over a standard wide string. */
typedef sub_match<wstring::const_iterator> wssub_match;
#endif
@@ -1602,6 +1742,8 @@ namespace regex_constants
// [7.10] Class template match_results
/**
+ * @brief The results of a match or search operation.
+ *
* A collection of character sequences representing the result of a regular
* expression match. Storage for the collection is allocated and freed as
* necessary by the member functions of class template match_results.
@@ -1618,6 +1760,8 @@ namespace regex_constants
* of characters [first, second) which formed that match. Otherwise matched
* is false, and members first and second point to the end of the sequence
* that was searched.
+ *
+ * @nosubgrouping
*/
template<typename _Bi_iter,
typename _Allocator = allocator<sub_match<_Bi_iter> > >
@@ -1629,6 +1773,10 @@ namespace regex_constants
_Base_type;
public:
+ /**
+ * @name 10.? Public Types
+ */
+ //@{
typedef sub_match<_Bi_iter> value_type;
typedef typename _Allocator::const_reference const_reference;
typedef const_reference reference;
@@ -1640,11 +1788,17 @@ namespace regex_constants
typedef _Allocator allocator_type;
typedef typename iterator_traits<_Bi_iter>::value_type char_type;
typedef basic_string<char_type> string_type;
+ //@}
public:
- // [7.10.1] construct/copy/destroy
/**
- * @brief Constructs a default match_results container.
+ * @name 10.1 Construction, Copying, and Destruction
+ */
+ //@{
+
+ /**
+ * @brief Constructs a default %match_results container.
+ * @post size() returns 0 and str() returns an empty string.
*/
explicit
match_results(const _Allocator& __a = _Allocator())
@@ -1652,7 +1806,7 @@ namespace regex_constants
{ }
/**
- * @brief Copy constructs a match_result.
+ * @brief Copy constructs a %match_results.
*/
match_results(const match_results& __rhs)
: _Base_type(__rhs), _M_matched(__rhs._M_matched),
@@ -1670,44 +1824,71 @@ namespace regex_constants
}
/**
- * @todo Implement this function.
+ * @brief Destroys a %match_results object.
*/
~match_results()
{ }
- // [7.10.2] size
+ //@}
+
/**
- * @todo Document this function.
+ * @name 10.2 Size
+ */
+ //@{
+
+ /**
+ * @brief Gets the number of matches and submatches.
+ *
+ * The number of matches for a given regular expression will be either 0
+ * if there was no match or mark_count() + 1 if a match was successful.
+ * Some matches may be empty.
+ *
+ * @returns the number of matches found.
*/
size_type
size() const
{ return _M_matched ? _Base_type::size() + 1 : 0; }
- /**
- * @todo Implement this function.
- */
//size_type
//max_size() const;
using _Base_type::max_size;
/**
- * @todo Document this function.
+ * @brief Indicates if the %match_results contains no results.
+ * @retval true The %match_results object is empty.
+ * @retval false The %match_results object is not empty.
*/
bool
empty() const
{ return size() == 0; }
- // [7.10.3] element access
+ //@}
+
+ /**
+ * @name 10.3 Element Access
+ */
+ //@{
+
/**
* @brief Gets the length of the indicated submatch.
* @param sub indicates the submatch.
+ *
+ * This function returns the length of the indicated submatch, or the
+ * length of the entire match if @p sub is zero (the default).
*/
difference_type
length(size_type __sub = 0) const
{ return _M_matched ? this->str(__sub).length() : 0; }
/**
- * @todo Document this function.
+ * @brief Gets the offset of the beginning of the indicated submatch.
+ * @param sub indicates the submatch.
+ *
+ * This function returns the offset from the beginnig of the target
+ * sequence to the beginning of the submatch, unless the value of @p sub
+ * is zero (the default), in which case this function returns the offset
+ * from the beginning of the target sequence to the beginning of the
+ * match.
*/
difference_type
position(size_type __sub = 0) const
@@ -1717,48 +1898,96 @@ namespace regex_constants
}
/**
- * @todo Document this function.
+ * @brief Gets the match or submatch converted to a string type.
+ * @param sub indicates the submatch.
+ *
+ * This function gets the submatch (or match, if @p sub is zero) extracted
+ * from the target range and converted to the associated string type.
*/
string_type
str(size_type __sub = 0) const
{ return _M_matched ? (*this)[__sub].str() : string_type(); }
/**
- * @todo Document this function.
+ * @brief Gets a %sub_match reference for the match or submatch.
+ * @param sub indicates the submatch.
+ *
+ * This function gets a reference to the indicated submatch, or the entire
+ * match if @p sub is zero.
+ *
+ * If @p sub >= size() then this function returns a %sub_match with a
+ * special value indicating no submatch.
*/
const_reference
- operator[](size_type __n) const
- { return _Base_type::operator[](__n); }
+ operator[](size_type __sub) const
+ { return _Base_type::operator[](__sub); }
/**
- * @todo Document this function.
+ * @brief Gets a %sub_match representing the match prefix.
+ *
+ * This function gets a reference to a %sub_match object representing the
+ * part of the target range between the start of the target range and the
+ * start of the match.
*/
const_reference
prefix() const
{ return _M_prefix; }
/**
- * @todo Document this function.
+ * @brief Gets a %sub_match representing the match suffix.
+ *
+ * This function gets a reference to a %sub_match object representing the
+ * part of the target range between the end of the match and the end of
+ * the target range.
*/
const_reference
suffix() const
{ return _M_suffix; }
/**
- * @todo Document this function.
+ * @brief Gets an iterator to the start of the %sub_match collection.
*/
const_iterator
begin() const
{ return _Base_type::begin(); }
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ /**
+ * @brief Gets an iterator to the start of the %sub_match collection.
+ */
+ const_iterator
+ cbegin() const
+ { return _Base_type::begin(); }
+#endif
+
/**
- * @todo Document this function.
+ * @brief Gets an iterator to one-past-the-end of the collection.
*/
const_iterator
end() const
{ return _Base_type::end(); }
- // [7.10.4] format
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ /**
+ * @brief Gets an iterator to one-past-the-end of the collection.
+ */
+ const_iterator
+ cend() const
+ { return _Base_type::end(); }
+#endif
+
+ //@}
+
+ /**
+ * @name 10.4 Formatting
+ *
+ * These functions perform formatted substitution of the matched character
+ * sequences into their target. The format specifiers and escape sequences
+ * accepted by these functions are determined by their @p flags parameter
+ * as documented above.
+ */
+ //@{
+
/**
* @todo Implement this function.
*/
@@ -1777,17 +2006,29 @@ namespace regex_constants
regex_constants::match_flag_type __flags
= regex_constants::format_default) const;
- // [7.10.5] allocator
+ //@}
+
/**
- * @todo Document this function.
+ * @name 10.5 Allocator
+ */
+ //@{
+
+ /**
+ * @brief Gets a copy of the allocator.
*/
//allocator_type
//get_allocator() const;
using _Base_type::get_allocator;
- // [7.10.6] swap
+ //@}
+
/**
- * @todo Document this function.
+ * @name 10.6 Swap
+ */
+ //@{
+
+ /**
+ * @brief Swaps the contents of two match_results.
*/
void
swap(match_results& __that)
@@ -1797,6 +2038,7 @@ namespace regex_constants
std::swap(_M_prefix, __that._M_prefix);
std::swap(_M_suffix, __that._M_suffix);
}
+ //@}
private:
bool _M_matched;
@@ -1813,6 +2055,9 @@ namespace regex_constants
// match_results comparisons
/**
+ * @brief Compares two match_results for equality.
+ * @returns true if the two objects refer to the same match,
+ * false otherwise.
* @todo Implement this function.
*/
template<typename _Bi_iter, typename _Allocator>
@@ -1821,12 +2066,15 @@ namespace regex_constants
const match_results<_Bi_iter, _Allocator>& __m2);
/**
- * @todo Implement this function.
+ * @brief Compares two match_results for inequality.
+ * @returns true if the two objects do not refer to the same match,
+ * false otherwise.
*/
template<typename _Bi_iter, class _Allocator>
inline bool
operator!=(const match_results<_Bi_iter, _Allocator>& __m1,
- const match_results<_Bi_iter, _Allocator>& __m2);
+ const match_results<_Bi_iter, _Allocator>& __m2)
+ { return !(__m1 == __m2); }
// [7.10.6] match_results swap
/**
@@ -1844,6 +2092,11 @@ namespace regex_constants
// [7.11.2] Function template regex_match
/**
+ * @name Matching, Searching, and Replacing
+ */
+ //@{
+
+ /**
* @brief Determines if there is a match between the regular expression @p e
* and all of the character sequence [first, last).
*
@@ -1856,6 +2109,8 @@ namespace regex_constants
* @retval true A match exists.
* @retval false Otherwise.
*
+ * @throws an exception of type regex_error.
+ *
* @todo Implement this function.
*/
template<typename _Bi_iter, typename _Allocator,
@@ -1879,6 +2134,8 @@ namespace regex_constants
*
* @retval true A match exists.
* @retval false Otherwise.
+ *
+ * @throws an exception of type regex_error.
*/
template<typename _Bi_iter, typename _Ch_type, typename _Rx_traits>
bool
@@ -1902,6 +2159,8 @@ namespace regex_constants
*
* @retval true A match exists.
* @retval false Otherwise.
+ *
+ * @throws an exception of type regex_error.
*/
template<typename _Ch_type, typename _Allocator, typename _Rx_traits>
inline bool
@@ -1923,6 +2182,8 @@ namespace regex_constants
*
* @retval true A match exists.
* @retval false Otherwise.
+ *
+ * @throws an exception of type regex_error.
*/
template<typename _Ch_traits, typename _Ch_alloc,
typename _Allocator, typename _Ch_type, typename _Rx_traits>
@@ -1945,6 +2206,8 @@ namespace regex_constants
*
* @retval true A match exists.
* @retval false Otherwise.
+ *
+ * @throws an exception of type regex_error.
*/
template<typename _Ch_type, class _Rx_traits>
inline bool
@@ -1964,6 +2227,8 @@ namespace regex_constants
*
* @retval true A match exists.
* @retval false Otherwise.
+ *
+ * @throws an exception of type regex_error.
*/
template<typename _Ch_traits, typename _Str_allocator,
typename _Ch_type, typename _Rx_traits>
@@ -1985,6 +2250,9 @@ namespace regex_constants
* @retval true A match was found within the string.
* @retval false No match was found within the string, the content of %m is
* undefined.
+ *
+ * @throws an exception of type regex_error.
+ *
* @todo Implement this function.
*/
template<typename _Bi_iter, typename _Allocator,
@@ -2005,7 +2273,9 @@ namespace regex_constants
* @param flags [IN] Search policy flags.
* @retval true A match was found within the string.
* @retval false No match was found within the string.
- * @todo Document me.
+ * @doctodo
+ *
+ * @throws an exception of type regex_error.
*/
template<typename _Bi_iter, typename _Ch_type, typename _Rx_traits>
inline bool
@@ -2027,7 +2297,9 @@ namespace regex_constants
* @retval true A match was found within the string.
* @retval false No match was found within the string, the content of %m is
* undefined.
- * @todo Document me.
+ * @doctodo
+ *
+ * @throws an exception of type regex_error.
*/
template<typename _Ch_type, class _Allocator, class _Rx_traits>
inline bool
@@ -2045,7 +2317,9 @@ namespace regex_constants
* @param f [IN] Search policy flags.
* @retval true A match was found within the string.
* @retval false No match was found within the string.
- * @todo Document me.
+ * @doctodo
+ *
+ * @throws an exception of type regex_error.
*/
template<typename _Ch_type, typename _Rx_traits>
inline bool
@@ -2062,7 +2336,9 @@ namespace regex_constants
* @param flags [IN] Search policy flags.
* @retval true A match was found within the string.
* @retval false No match was found within the string.
- * @todo Document me.
+ * @doctodo
+ *
+ * @throws an exception of type regex_error.
*/
template<typename _Ch_traits, typename _String_allocator,
typename _Ch_type, typename _Rx_traits>
@@ -2083,6 +2359,8 @@ namespace regex_constants
* @retval true A match was found within the string.
* @retval false No match was found within the string, the content of %m is
* undefined.
+ *
+ * @throws an exception of type regex_error.
*/
template<typename _Ch_traits, typename _Ch_alloc,
typename _Allocator, typename _Ch_type,
@@ -2096,10 +2374,20 @@ namespace regex_constants
= regex_constants::match_default)
{ return regex_search(__s.begin(), __s.end(), __m, __e, __f); }
- // [7.11.4] Function template regex_replace
+ // tr1 [7.11.4] std [28.11.4] Function template regex_replace
/**
+ * @doctodo
+ * @param out
+ * @param first
+ * @param last
+ * @param e
+ * @param fmt
+ * @param flags
+ *
+ * @returns out
+ * @throws an exception of type regex_error.
+ *
* @todo Implement this function.
- * @todo Document this function.
*/
template<typename _Out_iter, typename _Bi_iter,
typename _Rx_traits, typename _Ch_type>
@@ -2112,7 +2400,15 @@ namespace regex_constants
{ return __out; }
/**
- * @todo Document me.
+ * @doctodo
+ * @param s
+ * @param e
+ * @param fmt
+ * @param flags
+ *
+ * @returns a copy of string @p s with replacements.
+ *
+ * @throws an exception of type regex_error.
*/
template<typename _Rx_traits, typename _Ch_type>
inline basic_string<_Ch_type>
@@ -2128,7 +2424,9 @@ namespace regex_constants
return __result;
}
- // [7.12.1] Class template regex_iterator
+ //@}
+
+ // tr1 [7.12.1] std [28.12] Class template regex_iterator
/**
* An iterator adaptor that will provide repeated calls of regex_search over
* a range until no more matches remain.
@@ -2151,7 +2449,7 @@ namespace regex_constants
* @brief Provides a singular iterator, useful for indicating
* one-past-the-end of a range.
* @todo Implement this function.
- * @todo Document this function.
+ * @doctodo
*/
regex_iterator();
@@ -2162,7 +2460,7 @@ namespace regex_constants
* @param re [IN] The regular expression to match.
* @param m [IN] Policy flags for match rules.
* @todo Implement this function.
- * @todo Document this function.
+ * @doctodo
*/
regex_iterator(_Bi_iter __a, _Bi_iter __b, const regex_type& __re,
regex_constants::match_flag_type __m
@@ -2171,55 +2469,55 @@ namespace regex_constants
/**
* Copy constructs a %regex_iterator.
* @todo Implement this function.
- * @todo Document this function.
+ * @doctodo
*/
regex_iterator(const regex_iterator& __rhs);
/**
* @todo Implement this function.
- * @todo Document this function.
+ * @doctodo
*/
regex_iterator&
operator=(const regex_iterator& __rhs);
/**
* @todo Implement this function.
- * @todo Document this function.
+ * @doctodo
*/
bool
operator==(const regex_iterator& __rhs);
/**
* @todo Implement this function.
- * @todo Document this function.
+ * @doctodo
*/
bool
operator!=(const regex_iterator& __rhs);
/**
* @todo Implement this function.
- * @todo Document this function.
+ * @doctodo
*/
const value_type&
operator*();
/**
* @todo Implement this function.
- * @todo Document this function.
+ * @doctodo
*/
const value_type*
operator->();
/**
* @todo Implement this function.
- * @todo Document this function.
+ * @doctodo
*/
regex_iterator&
operator++();
/**
* @todo Implement this function.
- * @todo Document this function.
+ * @doctodo
*/
regex_iterator
operator++(int);
@@ -2290,7 +2588,7 @@ namespace regex_constants
* @param m [IN] Policy flags for match rules.
*
* @todo Implement this function.
- * @todo Document this function.
+ * @doctodo
*/
regex_token_iterator(_Bi_iter __a, _Bi_iter __b, const regex_type& __re,
int __submatch = 0,
@@ -2307,7 +2605,7 @@ namespace regex_constants
* @param m [IN] Policy flags for match rules.
*
* @todo Implement this function.
- * @todo Document this function.
+ * @doctodo
*/
regex_token_iterator(_Bi_iter __a, _Bi_iter __b,
const regex_type& __re,
@@ -2325,7 +2623,7 @@ namespace regex_constants
* @param m [IN] Policy flags for match rules.
* @todo Implement this function.
- * @todo Document this function.
+ * @doctodo
*/
template<std::size_t _Nm>
regex_token_iterator(_Bi_iter __a, _Bi_iter __b,
@@ -2401,14 +2699,18 @@ namespace regex_constants
std::vector<int> __subs;
};
+ /** @brief Token iterator for C-style NULL-terminated strings. */
typedef regex_token_iterator<const char*> cregex_token_iterator;
+ /** @brief Token iterator for standard strings. */
typedef regex_token_iterator<string::const_iterator> sregex_token_iterator;
#ifdef _GLIBCXX_USE_WCHAR_T
+ /** @brief Token iterator for C-style NULL-terminated wide strings. */
typedef regex_token_iterator<const wchar_t*> wcregex_token_iterator;
+ /** @brief Token iterator for standard wide-character strings. */
typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator;
#endif
- /** @} */ // group tr1_regex
+ //@} // group tr1_regex
_GLIBCXX_END_NAMESPACE_TR1
}
diff --git a/libstdc++-v3/include/tr1_impl/type_traits b/libstdc++-v3/include/tr1_impl/type_traits
index 5d0824a365f..e3b6af51bdc 100644
--- a/libstdc++-v3/include/tr1_impl/type_traits
+++ b/libstdc++-v3/include/tr1_impl/type_traits
@@ -43,29 +43,19 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
typedef struct { char __arr[2]; } __two;
};
-#define _DEFINE_SPEC_BODY(_Value) \
- : public integral_constant<bool, _Value> { };
+#define _DEFINE_SPEC_0_HELPER \
+ template<>
+
+#define _DEFINE_SPEC_1_HELPER \
+ template<typename _Tp>
-#define _DEFINE_SPEC_0_HELPER(_Spec, _Value) \
- template<> \
- struct _Spec \
- _DEFINE_SPEC_BODY(_Value)
-
-#define _DEFINE_SPEC_1_HELPER(_Spec, _Value) \
- template<typename _Tp> \
- struct _Spec \
- _DEFINE_SPEC_BODY(_Value)
-
-#define _DEFINE_SPEC_2_HELPER(_Spec, _Value) \
- template<typename _Tp, typename _Cp> \
- struct _Spec \
- _DEFINE_SPEC_BODY(_Value)
-
-#define _DEFINE_SPEC(_Order, _Trait, _Type, _Value) \
- _DEFINE_SPEC_##_Order##_HELPER(_Trait<_Type>, _Value) \
- _DEFINE_SPEC_##_Order##_HELPER(_Trait<_Type const>, _Value) \
- _DEFINE_SPEC_##_Order##_HELPER(_Trait<_Type volatile>, _Value) \
- _DEFINE_SPEC_##_Order##_HELPER(_Trait<_Type const volatile>, _Value)
+#define _DEFINE_SPEC_2_HELPER \
+ template<typename _Tp, typename _Cp>
+
+#define _DEFINE_SPEC(_Order, _Trait, _Type, _Value) \
+ _DEFINE_SPEC_##_Order##_HELPER \
+ struct _Trait<_Type> \
+ : public integral_constant<bool, _Value> { };
/// helper classes [4.3].
template<typename _Tp, _Tp __v>
@@ -79,49 +69,70 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
/// typedef for true_type
typedef integral_constant<bool, true> true_type;
- /// typedef for true_type
+ /// typedef for false_type
typedef integral_constant<bool, false> false_type;
template<typename _Tp, _Tp __v>
const _Tp integral_constant<_Tp, __v>::value;
- /// primary type categories [4.5.1].
template<typename>
- struct is_void
+ struct remove_cv;
+
+ template<typename>
+ struct __is_void_helper
: public false_type { };
- _DEFINE_SPEC(0, is_void, void, true)
+ _DEFINE_SPEC(0, __is_void_helper, void, true)
+
+ /// primary type categories [4.5.1].
+ template<typename _Tp>
+ struct is_void
+ : public integral_constant<bool, (__is_void_helper<typename
+ remove_cv<_Tp>::type>::value)>
+ { };
- /// is_integral
template<typename>
- struct is_integral
+ struct __is_integral_helper
: public false_type { };
- _DEFINE_SPEC(0, is_integral, bool, true)
- _DEFINE_SPEC(0, is_integral, char, true)
- _DEFINE_SPEC(0, is_integral, signed char, true)
- _DEFINE_SPEC(0, is_integral, unsigned char, true)
+ _DEFINE_SPEC(0, __is_integral_helper, bool, true)
+ _DEFINE_SPEC(0, __is_integral_helper, char, true)
+ _DEFINE_SPEC(0, __is_integral_helper, signed char, true)
+ _DEFINE_SPEC(0, __is_integral_helper, unsigned char, true)
#ifdef _GLIBCXX_USE_WCHAR_T
- _DEFINE_SPEC(0, is_integral, wchar_t, true)
+ _DEFINE_SPEC(0, __is_integral_helper, wchar_t, true)
#endif
#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
- _DEFINE_SPEC(0, is_integral, char16_t, true)
- _DEFINE_SPEC(0, is_integral, char32_t, true)
+ _DEFINE_SPEC(0, __is_integral_helper, char16_t, true)
+ _DEFINE_SPEC(0, __is_integral_helper, char32_t, true)
#endif
- _DEFINE_SPEC(0, is_integral, short, true)
- _DEFINE_SPEC(0, is_integral, unsigned short, true)
- _DEFINE_SPEC(0, is_integral, int, true)
- _DEFINE_SPEC(0, is_integral, unsigned int, true)
- _DEFINE_SPEC(0, is_integral, long, true)
- _DEFINE_SPEC(0, is_integral, unsigned long, true)
- _DEFINE_SPEC(0, is_integral, long long, true)
- _DEFINE_SPEC(0, is_integral, unsigned long long, true)
+ _DEFINE_SPEC(0, __is_integral_helper, short, true)
+ _DEFINE_SPEC(0, __is_integral_helper, unsigned short, true)
+ _DEFINE_SPEC(0, __is_integral_helper, int, true)
+ _DEFINE_SPEC(0, __is_integral_helper, unsigned int, true)
+ _DEFINE_SPEC(0, __is_integral_helper, long, true)
+ _DEFINE_SPEC(0, __is_integral_helper, unsigned long, true)
+ _DEFINE_SPEC(0, __is_integral_helper, long long, true)
+ _DEFINE_SPEC(0, __is_integral_helper, unsigned long long, true)
+
+ /// is_integral
+ template<typename _Tp>
+ struct is_integral
+ : public integral_constant<bool, (__is_integral_helper<typename
+ remove_cv<_Tp>::type>::value)>
+ { };
- /// is_floating_point
template<typename>
- struct is_floating_point
+ struct __is_floating_point_helper
: public false_type { };
- _DEFINE_SPEC(0, is_floating_point, float, true)
- _DEFINE_SPEC(0, is_floating_point, double, true)
- _DEFINE_SPEC(0, is_floating_point, long double, true)
+ _DEFINE_SPEC(0, __is_floating_point_helper, float, true)
+ _DEFINE_SPEC(0, __is_floating_point_helper, double, true)
+ _DEFINE_SPEC(0, __is_floating_point_helper, long double, true)
+
+ /// is_floating_point
+ template<typename _Tp>
+ struct is_floating_point
+ : public integral_constant<bool, (__is_floating_point_helper<typename
+ remove_cv<_Tp>::type>::value)>
+ { };
/// is_array
template<typename>
@@ -136,11 +147,17 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
struct is_array<_Tp[]>
: public true_type { };
- /// is_pointer
template<typename>
- struct is_pointer
+ struct __is_pointer_helper
: public false_type { };
- _DEFINE_SPEC(1, is_pointer, _Tp*, true)
+ _DEFINE_SPEC(1, __is_pointer_helper, _Tp*, true)
+
+ /// is_pointer
+ template<typename _Tp>
+ struct is_pointer
+ : public integral_constant<bool, (__is_pointer_helper<typename
+ remove_cv<_Tp>::type>::value)>
+ { };
/// is_reference
template<typename _Tp>
@@ -150,20 +167,32 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
template<typename _Tp>
struct is_function;
- /// is_member_object_pointer
template<typename>
- struct is_member_object_pointer
+ struct __is_member_object_pointer_helper
: public false_type { };
- _DEFINE_SPEC(2, is_member_object_pointer, _Tp _Cp::*,
+ _DEFINE_SPEC(2, __is_member_object_pointer_helper, _Tp _Cp::*,
!is_function<_Tp>::value)
- /// is_member_function_pointer
+ /// is_member_object_pointer
+ template<typename _Tp>
+ struct is_member_object_pointer
+ : public integral_constant<bool, (__is_member_object_pointer_helper<
+ typename remove_cv<_Tp>::type>::value)>
+ { };
+
template<typename>
- struct is_member_function_pointer
+ struct __is_member_function_pointer_helper
: public false_type { };
- _DEFINE_SPEC(2, is_member_function_pointer, _Tp _Cp::*,
+ _DEFINE_SPEC(2, __is_member_function_pointer_helper, _Tp _Cp::*,
is_function<_Tp>::value)
+ /// is_member_function_pointer
+ template<typename _Tp>
+ struct is_member_function_pointer
+ : public integral_constant<bool, (__is_member_function_pointer_helper<
+ typename remove_cv<_Tp>::type>::value)>
+ { };
+
/// is_enum
template<typename _Tp>
struct is_enum
@@ -182,31 +211,23 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
: public integral_constant<bool, __is_class(_Tp)>
{ };
- template<typename _Tp>
- struct __in_array
- : public __sfinae_types
- {
- private:
- template<typename _Up>
- static __one __test(_Up(*)[1]);
- template<typename>
- static __two __test(...);
-
- public:
- static const bool __value = sizeof(__test<_Tp>(0)) == 1;
- };
+ template<typename>
+ struct __is_function_helper
+ : public false_type { };
- /// is_abstract
- template<typename _Tp>
- struct is_abstract;
+ template<typename _Res, typename... _ArgTypes>
+ struct __is_function_helper<_Res(_ArgTypes...)>
+ : public true_type { };
+
+ template<typename _Res, typename... _ArgTypes>
+ struct __is_function_helper<_Res(_ArgTypes......)>
+ : public true_type { };
/// is_function
template<typename _Tp>
struct is_function
- : public integral_constant<bool, !(__in_array<_Tp>::__value
- || is_abstract<_Tp>::value
- || is_reference<_Tp>::value
- || is_void<_Tp>::value)>
+ : public integral_constant<bool, (__is_function_helper<typename
+ remove_cv<_Tp>::type>::value)>
{ };
/// composite type traits [4.5.2].
@@ -235,7 +256,7 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
template<typename _Tp>
struct is_member_pointer;
- /// is_scalal
+ /// is_scalar
template<typename _Tp>
struct is_scalar
: public integral_constant<bool, (is_arithmetic<_Tp>::value
@@ -417,18 +438,21 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
{ typedef typename remove_all_extents<_Tp>::type type; };
/// pointer modifications [4.7.4].
-#undef _DEFINE_SPEC_BODY
-#define _DEFINE_SPEC_BODY(_Value) \
+ template<typename _Tp, typename>
+ struct __remove_pointer_helper
{ typedef _Tp type; };
+ template<typename _Tp, typename _Up>
+ struct __remove_pointer_helper<_Tp, _Up*>
+ { typedef _Up type; };
+
/// remove_pointer
template<typename _Tp>
struct remove_pointer
- { typedef _Tp type; };
- _DEFINE_SPEC(1, remove_pointer, _Tp*, false)
+ : public __remove_pointer_helper<_Tp, typename remove_cv<_Tp>::type>
+ { };
- /// remove_reference
- template<typename _Tp>
+ template<typename>
struct remove_reference;
/// add_pointer
@@ -440,7 +464,6 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
#undef _DEFINE_SPEC_1_HELPER
#undef _DEFINE_SPEC_2_HELPER
#undef _DEFINE_SPEC
-#undef _DEFINE_SPEC_BODY
_GLIBCXX_END_NAMESPACE_TR1
}
diff --git a/libstdc++-v3/include/tr1_impl/unordered_map b/libstdc++-v3/include/tr1_impl/unordered_map
index bb69479f277..4f914495ddb 100644
--- a/libstdc++-v3/include/tr1_impl/unordered_map
+++ b/libstdc++-v3/include/tr1_impl/unordered_map
@@ -179,6 +179,7 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
typedef __unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc> _Base;
public:
+ typedef typename _Base::value_type value_type;
typedef typename _Base::size_type size_type;
typedef typename _Base::hasher hasher;
typedef typename _Base::key_equal key_equal;
@@ -205,6 +206,14 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
unordered_map(unordered_map&& __x)
: _Base(std::forward<_Base>(__x)) { }
+ unordered_map(initializer_list<value_type> __l,
+ size_type __n = 10,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__l.begin(), __l.end(), __n, __hf, __eql, __a)
+ { }
+
unordered_map&
operator=(unordered_map&& __x)
{
@@ -213,6 +222,14 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
this->swap(__x);
return *this;
}
+
+ unordered_map&
+ operator=(initializer_list<value_type> __l)
+ {
+ this->clear();
+ this->insert(__l.begin(), __l.end());
+ return *this;
+ }
#endif
};
@@ -227,6 +244,7 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
typedef __unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc> _Base;
public:
+ typedef typename _Base::value_type value_type;
typedef typename _Base::size_type size_type;
typedef typename _Base::hasher hasher;
typedef typename _Base::key_equal key_equal;
@@ -254,6 +272,14 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
unordered_multimap(unordered_multimap&& __x)
: _Base(std::forward<_Base>(__x)) { }
+ unordered_multimap(initializer_list<value_type> __l,
+ size_type __n = 10,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__l.begin(), __l.end(), __n, __hf, __eql, __a)
+ { }
+
unordered_multimap&
operator=(unordered_multimap&& __x)
{
@@ -262,6 +288,14 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
this->swap(__x);
return *this;
}
+
+ unordered_multimap&
+ operator=(initializer_list<value_type> __l)
+ {
+ this->clear();
+ this->insert(__l.begin(), __l.end());
+ return *this;
+ }
#endif
};
diff --git a/libstdc++-v3/include/tr1_impl/unordered_set b/libstdc++-v3/include/tr1_impl/unordered_set
index 80b1ec5f003..5640ebe1f77 100644
--- a/libstdc++-v3/include/tr1_impl/unordered_set
+++ b/libstdc++-v3/include/tr1_impl/unordered_set
@@ -175,6 +175,7 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
typedef __unordered_set<_Value, _Hash, _Pred, _Alloc> _Base;
public:
+ typedef typename _Base::value_type value_type;
typedef typename _Base::size_type size_type;
typedef typename _Base::hasher hasher;
typedef typename _Base::key_equal key_equal;
@@ -201,6 +202,14 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
unordered_set(unordered_set&& __x)
: _Base(std::forward<_Base>(__x)) { }
+ unordered_set(initializer_list<value_type> __l,
+ size_type __n = 10,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__l.begin(), __l.end(), __n, __hf, __eql, __a)
+ { }
+
unordered_set&
operator=(unordered_set&& __x)
{
@@ -209,6 +218,14 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
this->swap(__x);
return *this;
}
+
+ unordered_set&
+ operator=(initializer_list<value_type> __l)
+ {
+ this->clear();
+ this->insert(__l.begin(), __l.end());
+ return *this;
+ }
#endif
};
@@ -223,6 +240,7 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
typedef __unordered_multiset<_Value, _Hash, _Pred, _Alloc> _Base;
public:
+ typedef typename _Base::value_type value_type;
typedef typename _Base::size_type size_type;
typedef typename _Base::hasher hasher;
typedef typename _Base::key_equal key_equal;
@@ -250,6 +268,14 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
unordered_multiset(unordered_multiset&& __x)
: _Base(std::forward<_Base>(__x)) { }
+ unordered_multiset(initializer_list<value_type> __l,
+ size_type __n = 10,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__l.begin(), __l.end(), __n, __hf, __eql, __a)
+ { }
+
unordered_multiset&
operator=(unordered_multiset&& __x)
{
@@ -258,6 +284,14 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
this->swap(__x);
return *this;
}
+
+ unordered_multiset&
+ operator=(initializer_list<value_type> __l)
+ {
+ this->clear();
+ this->insert(__l.begin(), __l.end());
+ return *this;
+ }
#endif
};
diff --git a/libstdc++-v3/libmath/Makefile.in b/libstdc++-v3/libmath/Makefile.in
index 1db093b15cc..1592897335e 100644
--- a/libstdc++-v3/libmath/Makefile.in
+++ b/libstdc++-v3/libmath/Makefile.in
@@ -163,6 +163,7 @@ GLIBCXX_HOSTED_TRUE = @GLIBCXX_HOSTED_TRUE@
GLIBCXX_INCLUDES = @GLIBCXX_INCLUDES@
GLIBCXX_LDBL_COMPAT_FALSE = @GLIBCXX_LDBL_COMPAT_FALSE@
GLIBCXX_LDBL_COMPAT_TRUE = @GLIBCXX_LDBL_COMPAT_TRUE@
+GLIBCXX_LIBS = @GLIBCXX_LIBS@
GREP = @GREP@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
diff --git a/libstdc++-v3/libsupc++/Makefile.am b/libstdc++-v3/libsupc++/Makefile.am
index c0412f0b8ed..680005fbf83 100644
--- a/libstdc++-v3/libsupc++/Makefile.am
+++ b/libstdc++-v3/libsupc++/Makefile.am
@@ -34,7 +34,7 @@ noinst_LTLIBRARIES = libsupc++convenience.la
headers = \
exception new typeinfo cxxabi.h cxxabi-forced.h exception_defines.h \
- initializer_list
+ initializer_list exception_ptr.h
if GLIBCXX_HOSTED
c_sources = \
@@ -60,6 +60,7 @@ sources = \
eh_exception.cc \
eh_globals.cc \
eh_personality.cc \
+ eh_ptr.cc \
eh_term_handler.cc \
eh_terminate.cc \
eh_throw.cc \
diff --git a/libstdc++-v3/libsupc++/Makefile.in b/libstdc++-v3/libsupc++/Makefile.in
index 0f7cf8c517e..c3d1c6c6b43 100644
--- a/libstdc++-v3/libsupc++/Makefile.in
+++ b/libstdc++-v3/libsupc++/Makefile.in
@@ -79,7 +79,7 @@ am__libsupc___la_SOURCES_DIST = array_type_info.cc atexit_arm.cc \
bad_cast.cc bad_typeid.cc class_type_info.cc del_op.cc \
del_opnt.cc del_opv.cc del_opvnt.cc dyncast.cc eh_alloc.cc \
eh_arm.cc eh_aux_runtime.cc eh_call.cc eh_catch.cc \
- eh_exception.cc eh_globals.cc eh_personality.cc \
+ eh_exception.cc eh_globals.cc eh_personality.cc eh_ptr.cc \
eh_term_handler.cc eh_terminate.cc eh_throw.cc eh_type.cc \
eh_unex_handler.cc enum_type_info.cc function_type_info.cc \
fundamental_type_info.cc guard.cc new_handler.cc new_op.cc \
@@ -91,7 +91,7 @@ am__objects_1 = array_type_info.lo atexit_arm.lo bad_cast.lo \
bad_typeid.lo class_type_info.lo del_op.lo del_opnt.lo \
del_opv.lo del_opvnt.lo dyncast.lo eh_alloc.lo eh_arm.lo \
eh_aux_runtime.lo eh_call.lo eh_catch.lo eh_exception.lo \
- eh_globals.lo eh_personality.lo eh_term_handler.lo \
+ eh_globals.lo eh_personality.lo eh_ptr.lo eh_term_handler.lo \
eh_terminate.lo eh_throw.lo eh_type.lo eh_unex_handler.lo \
enum_type_info.lo function_type_info.lo \
fundamental_type_info.lo guard.lo new_handler.lo new_op.lo \
@@ -107,7 +107,7 @@ am__libsupc__convenience_la_SOURCES_DIST = array_type_info.cc \
atexit_arm.cc bad_cast.cc bad_typeid.cc class_type_info.cc \
del_op.cc del_opnt.cc del_opv.cc del_opvnt.cc dyncast.cc \
eh_alloc.cc eh_arm.cc eh_aux_runtime.cc eh_call.cc eh_catch.cc \
- eh_exception.cc eh_globals.cc eh_personality.cc \
+ eh_exception.cc eh_globals.cc eh_personality.cc eh_ptr.cc \
eh_term_handler.cc eh_terminate.cc eh_throw.cc eh_type.cc \
eh_unex_handler.cc enum_type_info.cc function_type_info.cc \
fundamental_type_info.cc guard.cc new_handler.cc new_op.cc \
@@ -218,6 +218,7 @@ GLIBCXX_HOSTED_TRUE = @GLIBCXX_HOSTED_TRUE@
GLIBCXX_INCLUDES = @GLIBCXX_INCLUDES@
GLIBCXX_LDBL_COMPAT_FALSE = @GLIBCXX_LDBL_COMPAT_FALSE@
GLIBCXX_LDBL_COMPAT_TRUE = @GLIBCXX_LDBL_COMPAT_TRUE@
+GLIBCXX_LIBS = @GLIBCXX_LIBS@
GREP = @GREP@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -355,7 +356,7 @@ toolexeclib_LTLIBRARIES = libsupc++.la
noinst_LTLIBRARIES = libsupc++convenience.la
headers = \
exception new typeinfo cxxabi.h cxxabi-forced.h exception_defines.h \
- initializer_list
+ initializer_list exception_ptr.h
@GLIBCXX_HOSTED_TRUE@c_sources = \
@GLIBCXX_HOSTED_TRUE@ cp-demangle.c
@@ -379,6 +380,7 @@ sources = \
eh_exception.cc \
eh_globals.cc \
eh_personality.cc \
+ eh_ptr.cc \
eh_term_handler.cc \
eh_terminate.cc \
eh_throw.cc \
diff --git a/libstdc++-v3/libsupc++/eh_alloc.cc b/libstdc++-v3/libsupc++/eh_alloc.cc
index 553c1c1e858..6bc46fc9a91 100644
--- a/libstdc++-v3/libsupc++/eh_alloc.cc
+++ b/libstdc++-v3/libsupc++/eh_alloc.cc
@@ -1,5 +1,5 @@
// -*- C++ -*- Allocate exception objects.
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2008
// Free Software Foundation, Inc.
//
// This file is part of GCC.
@@ -89,6 +89,9 @@ typedef char one_buffer[EMERGENCY_OBJ_SIZE] __attribute__((aligned));
static one_buffer emergency_buffer[EMERGENCY_OBJ_COUNT];
static bitmask_type emergency_used;
+static __cxa_dependent_exception dependents_buffer[EMERGENCY_OBJ_COUNT];
+static bitmask_type dependents_used;
+
namespace
{
// A single mutex controlling emergency allocations.
@@ -157,3 +160,66 @@ __cxxabiv1::__cxa_free_exception(void *vptr) throw()
else
free (ptr - sizeof (__cxa_exception));
}
+
+
+extern "C" __cxa_dependent_exception*
+__cxxabiv1::__cxa_allocate_dependent_exception() throw()
+{
+ __cxa_dependent_exception *ret;
+
+ ret = static_cast<__cxa_dependent_exception*>
+ (malloc (sizeof (__cxa_dependent_exception)));
+
+ if (!ret)
+ {
+ __gnu_cxx::__scoped_lock sentry(emergency_mutex);
+
+ bitmask_type used = dependents_used;
+ unsigned int which = 0;
+
+ while (used & 1)
+ {
+ used >>= 1;
+ if (++which >= EMERGENCY_OBJ_COUNT)
+ goto failed;
+ }
+
+ dependents_used |= (bitmask_type)1 << which;
+ ret = &dependents_buffer[which];
+
+ failed:;
+
+ if (!ret)
+ std::terminate ();
+ }
+
+ // We have an uncaught exception as soon as we allocate memory. This
+ // yields uncaught_exception() true during the copy-constructor that
+ // initializes the exception object. See Issue 475.
+ __cxa_eh_globals *globals = __cxa_get_globals ();
+ globals->uncaughtExceptions += 1;
+
+ memset (ret, 0, sizeof (__cxa_dependent_exception));
+
+ return ret;
+}
+
+
+extern "C" void
+__cxxabiv1::__cxa_free_dependent_exception
+ (__cxa_dependent_exception *vptr) throw()
+{
+ char *base = (char *) dependents_buffer;
+ char *ptr = (char *) vptr;
+ if (ptr >= base
+ && ptr < base + sizeof (dependents_buffer))
+ {
+ const unsigned int which
+ = (unsigned) (ptr - base) / sizeof (__cxa_dependent_exception);
+
+ __gnu_cxx::__scoped_lock sentry(emergency_mutex);
+ dependents_used &= ~((bitmask_type)1 << which);
+ }
+ else
+ free (vptr);
+}
diff --git a/libstdc++-v3/libsupc++/eh_arm.cc b/libstdc++-v3/libsupc++/eh_arm.cc
index 6f770e95663..f10bb41e5c0 100644
--- a/libstdc++-v3/libsupc++/eh_arm.cc
+++ b/libstdc++-v3/libsupc++/eh_arm.cc
@@ -1,5 +1,5 @@
// -*- C++ -*- ARM specific Exception handling support routines.
-// Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2005, 2008 Free Software Foundation, Inc.
//
// This file is part of GCC.
//
@@ -48,13 +48,19 @@ __cxa_type_match(_Unwind_Exception* ue_header,
{
bool forced_unwind = __is_gxx_forced_unwind_class(ue_header->exception_class);
bool foreign_exception = !forced_unwind && !__is_gxx_exception_class(ue_header->exception_class);
+ bool dependent_exception =
+ __is_dependent_exception(ue_header->exception_class);
__cxa_exception* xh = __get_exception_header_from_ue(ue_header);
+ __cxa_dependent_exception *dx = __get_dependent_exception_from_ue(ue_header);
const std::type_info* throw_type;
if (forced_unwind)
throw_type = &typeid(abi::__forced_unwind);
else if (foreign_exception)
throw_type = &typeid(abi::__foreign_exception);
+ else if (dependent_exception)
+ throw_type = __get_exception_header_from_obj
+ (dx->primaryException)->exceptionType;
else
throw_type = xh->exceptionType;
diff --git a/libstdc++-v3/libsupc++/eh_call.cc b/libstdc++-v3/libsupc++/eh_call.cc
index edf62188a6b..c0bced99533 100644
--- a/libstdc++-v3/libsupc++/eh_call.cc
+++ b/libstdc++-v3/libsupc++/eh_call.cc
@@ -1,5 +1,5 @@
// -*- C++ -*- Helpers for calling unextected and terminate
-// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2003, 2008 Free Software Foundation, Inc.
//
// This file is part of GCC.
//
@@ -125,7 +125,7 @@ __cxa_call_unexpected(void* exc_obj_in)
__cxa_eh_globals* globals = __cxa_get_globals_fast();
__cxa_exception* new_xh = globals->caughtExceptions;
- void* new_ptr = new_xh + 1;
+ void* new_ptr = __gxx_get_object_from_ambiguous_exception (new_xh);
const std::type_info* catch_type;
int n;
bool bad_exception_allowed = false;
diff --git a/libstdc++-v3/libsupc++/eh_personality.cc b/libstdc++-v3/libsupc++/eh_personality.cc
index b7d957c4d37..12b54c16587 100644
--- a/libstdc++-v3/libsupc++/eh_personality.cc
+++ b/libstdc++-v3/libsupc++/eh_personality.cc
@@ -377,7 +377,7 @@ PERSONALITY_FUNCTION (int version,
const unsigned char *p;
_Unwind_Ptr landing_pad, ip;
int handler_switch_value;
- void* thrown_ptr = ue_header + 1;
+ void* thrown_ptr = 0;
bool foreign_exception;
int ip_before_insn = 0;
@@ -543,30 +543,33 @@ PERSONALITY_FUNCTION (int version,
bool saw_handler = false;
#ifdef __ARM_EABI_UNWINDER__
+ // ??? How does this work - more importantly, how does it interact with
+ // dependent exceptions?
throw_type = ue_header;
if (actions & _UA_FORCE_UNWIND)
{
__GXX_INIT_FORCED_UNWIND_CLASS(ue_header->exception_class);
- thrown_ptr = 0;
}
- else if (foreign_exception)
- thrown_ptr = 0;
+ else if (!foreign_exception)
+ thrown_ptr = __get_object_from_ue (ue_header);
#else
// During forced unwinding, match a magic exception type.
if (actions & _UA_FORCE_UNWIND)
{
throw_type = &typeid(abi::__forced_unwind);
- thrown_ptr = 0;
}
// With a foreign exception class, there's no exception type.
// ??? What to do about GNU Java and GNU Ada exceptions?
else if (foreign_exception)
{
throw_type = &typeid(abi::__foreign_exception);
- thrown_ptr = 0;
}
else
- throw_type = xh->exceptionType;
+ {
+ thrown_ptr = __get_object_from_ue (ue_header);
+ throw_type = __get_exception_header_from_obj
+ (thrown_ptr)->exceptionType;
+ }
#endif
while (1)
@@ -758,13 +761,14 @@ __cxa_call_unexpected (void *exc_obj_in)
__cxa_eh_globals *globals = __cxa_get_globals_fast ();
__cxa_exception *new_xh = globals->caughtExceptions;
- void *new_ptr = new_xh + 1;
+ void *new_ptr = __get_object_from_ambiguous_exception (new_xh);
// We don't quite have enough stuff cached; re-parse the LSDA.
parse_lsda_header (0, xh_lsda, &info);
// If this new exception meets the exception spec, allow it.
- if (check_exception_spec (&info, new_xh->exceptionType,
+ if (check_exception_spec (&info, __get_exception_header_from_obj
+ (new_ptr)->exceptionType,
new_ptr, xh_switch_value))
__throw_exception_again;
diff --git a/libstdc++-v3/libsupc++/eh_ptr.cc b/libstdc++-v3/libsupc++/eh_ptr.cc
new file mode 100644
index 00000000000..35ba5f90b87
--- /dev/null
+++ b/libstdc++-v3/libsupc++/eh_ptr.cc
@@ -0,0 +1,236 @@
+// -*- C++ -*- Implement the members of exception_ptr.
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of GCC.
+//
+// GCC is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// GCC is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with GCC; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301, USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <bits/c++config.h>
+#include <exception>
+#include <exception_ptr.h>
+#include "unwind-cxx.h"
+
+using namespace __cxxabiv1;
+
+
+std::__exception_ptr::exception_ptr::exception_ptr() throw()
+ : _M_exception_object(0)
+{
+}
+
+
+std::__exception_ptr::exception_ptr::exception_ptr(void* obj) throw()
+ : _M_exception_object(obj)
+{
+ _M_addref();
+}
+
+
+std::__exception_ptr::exception_ptr::exception_ptr(__safe_bool) throw()
+ : _M_exception_object(0)
+{
+}
+
+
+std::__exception_ptr::exception_ptr::exception_ptr(
+ const exception_ptr& other) throw()
+ : _M_exception_object(other._M_exception_object)
+{
+ _M_addref();
+}
+
+
+std::__exception_ptr::exception_ptr::~exception_ptr() throw()
+{
+ _M_release();
+}
+
+
+std::__exception_ptr::exception_ptr&
+std::__exception_ptr::exception_ptr::operator=(
+ const exception_ptr& other) throw()
+{
+ exception_ptr(other).swap(*this);
+ return *this;
+}
+
+
+void
+std::__exception_ptr::exception_ptr::_M_addref() throw()
+{
+ if (_M_exception_object)
+ {
+ __cxa_exception *eh =
+ __get_exception_header_from_obj (_M_exception_object);
+ __gnu_cxx::__atomic_add_dispatch (&eh->referenceCount, 1);
+ }
+}
+
+
+void
+std::__exception_ptr::exception_ptr::_M_release() throw()
+{
+ if (_M_exception_object)
+ {
+ __cxa_exception *eh =
+ __get_exception_header_from_obj (_M_exception_object);
+ if (__gnu_cxx::__exchange_and_add_dispatch (&eh->referenceCount, -1) == 0)
+ {
+ if (eh->exceptionDestructor)
+ eh->exceptionDestructor (_M_exception_object);
+
+ __cxa_free_exception (_M_exception_object);
+ _M_exception_object = 0;
+ }
+ }
+}
+
+
+void*
+std::__exception_ptr::exception_ptr::_M_get() const throw()
+{
+ return _M_exception_object;
+}
+
+
+void
+std::__exception_ptr::exception_ptr::_M_safe_bool_dummy()
+{
+}
+
+
+void
+std::__exception_ptr::exception_ptr::swap(exception_ptr &other) throw()
+{
+ void *tmp = _M_exception_object;
+ _M_exception_object = other._M_exception_object;
+ other._M_exception_object = tmp;
+}
+
+
+bool
+std::__exception_ptr::exception_ptr::operator!() const throw()
+{
+ return _M_exception_object == 0;
+}
+
+
+std::__exception_ptr::exception_ptr::operator __safe_bool() const throw()
+{
+ return _M_exception_object ? &exception_ptr::_M_safe_bool_dummy : 0;
+}
+
+
+const std::type_info*
+std::__exception_ptr::exception_ptr::__cxa_exception_type() const throw()
+{
+ __cxa_exception *eh = __get_exception_header_from_obj (_M_exception_object);
+ return eh->exceptionType;
+}
+
+
+bool std::__exception_ptr::operator==(const exception_ptr& lhs,
+ const exception_ptr& rhs) throw()
+{
+ return lhs._M_exception_object == rhs._M_exception_object;
+}
+
+
+bool std::__exception_ptr::operator!=(const exception_ptr& lhs,
+ const exception_ptr& rhs) throw()
+{
+ return !(lhs == rhs);
+}
+
+
+std::exception_ptr
+std::current_exception() throw()
+{
+ __cxa_eh_globals *globals = __cxa_get_globals ();
+ __cxa_exception *header = globals->caughtExceptions;
+
+ if (!header)
+ return std::exception_ptr();
+
+ // Since foreign exceptions can't be counted, we can't return them.
+ if (!__is_gxx_exception_class (header->unwindHeader.exception_class))
+ return std::exception_ptr();
+
+ return std::exception_ptr(
+ __get_object_from_ambiguous_exception (header));
+}
+
+
+static void
+__gxx_dependent_exception_cleanup (_Unwind_Reason_Code code,
+ _Unwind_Exception *exc)
+{
+ // This cleanup is set only for dependents.
+ __cxa_dependent_exception *dep = __get_dependent_exception_from_ue (exc);
+ __cxa_exception *header =
+ __get_exception_header_from_obj (dep->primaryException);
+
+ // We only want to be called through _Unwind_DeleteException.
+ // _Unwind_DeleteException in the HP-UX IA64 libunwind library
+ // returns _URC_NO_REASON and not _URC_FOREIGN_EXCEPTION_CAUGHT
+ // like the GCC _Unwind_DeleteException function does.
+ if (code != _URC_FOREIGN_EXCEPTION_CAUGHT && code != _URC_NO_REASON)
+ __terminate (header->terminateHandler);
+
+ if (__gnu_cxx::__exchange_and_add_dispatch (&header->referenceCount, -1) == 0)
+ {
+ if (header->exceptionDestructor)
+ header->exceptionDestructor (header + 1);
+
+ __cxa_free_exception (header + 1);
+ }
+}
+
+
+void
+std::rethrow_exception(std::exception_ptr ep)
+{
+ void *obj = ep._M_get();
+ __cxa_exception *eh = __get_exception_header_from_obj (obj);
+
+ __cxa_dependent_exception *dep = __cxa_allocate_dependent_exception ();
+ dep->primaryException = obj;
+ __gnu_cxx::__atomic_add_dispatch (&eh->referenceCount, 1);
+
+ dep->unexpectedHandler = __unexpected_handler;
+ dep->terminateHandler = __terminate_handler;
+ __GXX_INIT_DEPENDENT_EXCEPTION_CLASS(dep->unwindHeader.exception_class);
+ dep->unwindHeader.exception_cleanup = __gxx_dependent_exception_cleanup;
+
+#ifdef _GLIBCXX_SJLJ_EXCEPTIONS
+ _Unwind_SjLj_RaiseException (&dep->unwindHeader);
+#else
+ _Unwind_RaiseException (&dep->unwindHeader);
+#endif
+
+ // Some sort of unwinding error. Note that terminate is a handler.
+ __cxa_begin_catch (&dep->unwindHeader);
+ std::terminate ();
+}
diff --git a/libstdc++-v3/libsupc++/eh_throw.cc b/libstdc++-v3/libsupc++/eh_throw.cc
index b405f8f7c64..198ff181035 100644
--- a/libstdc++-v3/libsupc++/eh_throw.cc
+++ b/libstdc++-v3/libsupc++/eh_throw.cc
@@ -1,5 +1,5 @@
// -*- C++ -*- Exception handling routines for throwing.
-// Copyright (C) 2001, 2003 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2003, 2008 Free Software Foundation, Inc.
//
// This file is part of GCC.
//
@@ -36,20 +36,23 @@ using namespace __cxxabiv1;
static void
__gxx_exception_cleanup (_Unwind_Reason_Code code, _Unwind_Exception *exc)
{
+ // This cleanup is set only for primaries.
__cxa_exception *header = __get_exception_header_from_ue (exc);
- // If we haven't been caught by a foreign handler, then this is
- // some sort of unwind error. In that case just die immediately.
+ // We only want to be called through _Unwind_DeleteException.
// _Unwind_DeleteException in the HP-UX IA64 libunwind library
- // returns _URC_NO_REASON and not _URC_FOREIGN_EXCEPTION_CAUGHT
+ // returns _URC_NO_REASON and not _URC_FOREIGN_EXCEPTION_CAUGHT
// like the GCC _Unwind_DeleteException function does.
if (code != _URC_FOREIGN_EXCEPTION_CAUGHT && code != _URC_NO_REASON)
__terminate (header->terminateHandler);
- if (header->exceptionDestructor)
- header->exceptionDestructor (header + 1);
+ if (__gnu_cxx::__exchange_and_add_dispatch (&header->referenceCount, -1) == 0)
+ {
+ if (header->exceptionDestructor)
+ header->exceptionDestructor (header + 1);
- __cxa_free_exception (header + 1);
+ __cxa_free_exception (header + 1);
+ }
}
@@ -57,12 +60,14 @@ extern "C" void
__cxxabiv1::__cxa_throw (void *obj, std::type_info *tinfo,
void (*dest) (void *))
{
+ // Definitely a primary.
__cxa_exception *header = __get_exception_header_from_obj (obj);
+ header->referenceCount = 0;
header->exceptionType = tinfo;
header->exceptionDestructor = dest;
header->unexpectedHandler = __unexpected_handler;
header->terminateHandler = __terminate_handler;
- __GXX_INIT_EXCEPTION_CLASS(header->unwindHeader.exception_class);
+ __GXX_INIT_PRIMARY_EXCEPTION_CLASS(header->unwindHeader.exception_class);
header->unwindHeader.exception_cleanup = __gxx_exception_cleanup;
#ifdef _GLIBCXX_SJLJ_EXCEPTIONS
diff --git a/libstdc++-v3/libsupc++/eh_type.cc b/libstdc++-v3/libsupc++/eh_type.cc
index 99627efdd97..03432976714 100644
--- a/libstdc++-v3/libsupc++/eh_type.cc
+++ b/libstdc++-v3/libsupc++/eh_type.cc
@@ -1,5 +1,5 @@
// -*- C++ -*- Exception handling routines for catching.
-// Copyright (C) 2001 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2008 Free Software Foundation, Inc.
//
// This file is part of GCC.
//
@@ -43,7 +43,15 @@ std::type_info *__cxa_current_exception_type ()
__cxa_eh_globals *globals = __cxa_get_globals ();
__cxa_exception *header = globals->caughtExceptions;
if (header)
- return header->exceptionType;
+ {
+ if (__is_dependent_exception (header->unwindHeader.exception_class))
+ {
+ __cxa_dependent_exception *de =
+ __get_dependent_exception_from_ue (&header->unwindHeader);
+ header = __get_exception_header_from_obj (de->primaryException);
+ }
+ return header->exceptionType;
+ }
else
return 0;
}
diff --git a/libstdc++-v3/libsupc++/exception b/libstdc++-v3/libsupc++/exception
index a7e2db78dd1..f1288211e98 100644
--- a/libstdc++-v3/libsupc++/exception
+++ b/libstdc++-v3/libsupc++/exception
@@ -1,7 +1,7 @@
// Exception Handling support header for -*- C++ -*-
// Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
-// 2004, 2005, 2006, 2007
+// 2004, 2005, 2006, 2007, 2008
// Free Software Foundation
//
// This file is part of GCC.
@@ -110,6 +110,7 @@ namespace std
* result in a call of @c terminate() (15.5.1)."
*/
bool uncaught_exception() throw();
+
} // namespace std
_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
@@ -132,4 +133,8 @@ _GLIBCXX_END_NAMESPACE
#pragma GCC visibility pop
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+#include <exception_ptr.h>
+#endif
+
#endif
diff --git a/libstdc++-v3/libsupc++/exception_ptr.h b/libstdc++-v3/libsupc++/exception_ptr.h
new file mode 100644
index 00000000000..77b0431c42f
--- /dev/null
+++ b/libstdc++-v3/libsupc++/exception_ptr.h
@@ -0,0 +1,169 @@
+// Exception Handling support header (exception_ptr class) for -*- C++ -*-
+
+// Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
+// 2004, 2005, 2006, 2007, 2008
+// Free Software Foundation
+//
+// This file is part of GCC.
+//
+// GCC is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// GCC is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with GCC; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301, USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+/** @file exception_ptr.h
+ * This is an internal header file, included by other headers and the
+ * implementation. You should not attempt to use it directly.
+ */
+
+#ifndef __EXCEPTION_PTR_H__
+#define __EXCEPTION_PTR_H__
+
+#pragma GCC visibility push(default)
+
+#include <bits/c++config.h>
+
+extern "C++" {
+
+namespace std
+{
+ // Hide the free operators from other types
+ namespace __exception_ptr
+ {
+ /**
+ * @brief An opaque pointer to an arbitrary exception.
+ */
+ class exception_ptr;
+ }
+
+ using __exception_ptr::exception_ptr;
+
+ /** Obtain an %exception_ptr to the currently handled exception. If there
+ * is none, or the currently handled exception is foreign, return the null
+ * value.
+ */
+ exception_ptr current_exception() throw();
+
+ /// Throw the object pointed to by the %exception_ptr.
+ void rethrow_exception(exception_ptr) __attribute__ ((__noreturn__));
+
+ /// Obtain an %exception_ptr pointing to a copy of the supplied object.
+ template <class _Ex>
+ exception_ptr copy_exception(_Ex __ex) throw();
+
+
+ namespace __exception_ptr
+ {
+ bool operator==(const exception_ptr&,
+ const exception_ptr&) throw();
+ bool operator!=(const exception_ptr&,
+ const exception_ptr&) throw();
+
+ class exception_ptr
+ {
+ void* _M_exception_object;
+
+ explicit exception_ptr(void* __e) throw();
+
+ void _M_addref() throw();
+ void _M_release() throw();
+
+ void *_M_get() const throw();
+
+ void _M_safe_bool_dummy();
+
+ friend exception_ptr std::current_exception() throw();
+ friend void std::rethrow_exception(exception_ptr);
+
+ public:
+ exception_ptr() throw();
+
+ typedef void (exception_ptr::*__safe_bool)();
+
+ // For construction from nullptr or 0.
+ exception_ptr(__safe_bool) throw();
+
+ exception_ptr(const exception_ptr&) throw();
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ exception_ptr(exception_ptr&& __o) throw()
+ : _M_exception_object(__o._M_exception_object)
+ {
+ __o._M_exception_object = 0;
+ }
+#endif
+
+ exception_ptr& operator=(const exception_ptr&) throw();
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ exception_ptr& operator=(exception_ptr&& __o) throw()
+ {
+ exception_ptr(__o).swap(*this);
+ return *this;
+ }
+#endif
+
+ ~exception_ptr() throw();
+
+ void swap(exception_ptr&) throw();
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ void swap(exception_ptr &&__o) throw()
+ {
+ void *__tmp = _M_exception_object;
+ _M_exception_object = __o._M_exception_object;
+ __o._M_exception_object = __tmp;
+ }
+#endif
+
+ bool operator!() const throw();
+ operator __safe_bool() const throw();
+
+ friend bool operator==(const exception_ptr&,
+ const exception_ptr&) throw();
+
+ const type_info *__cxa_exception_type() const throw();
+ };
+
+ } // namespace __exception_ptr
+
+
+ template <class _Ex>
+ exception_ptr copy_exception(_Ex __ex) throw()
+ {
+ try
+ {
+ throw __ex;
+ }
+ catch(...)
+ {
+ return current_exception ();
+ }
+ }
+
+} // namespace std
+
+} // extern "C++"
+
+#pragma GCC visibility pop
+
+#endif
diff --git a/libstdc++-v3/libsupc++/initializer_list b/libstdc++-v3/libsupc++/initializer_list
index 18fb15bc552..e98cd71a1ac 100644
--- a/libstdc++-v3/libsupc++/initializer_list
+++ b/libstdc++-v3/libsupc++/initializer_list
@@ -28,6 +28,10 @@
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
+/** @file initializer_list
+ * This is a Standard C++ Library header.
+ */
+
#ifndef __CXX_INITIALIZER_LIST
#define __CXX_INITIALIZER_LIST
@@ -39,6 +43,7 @@
namespace std
{
+ /// initializer_list
template<class _E>
class initializer_list
{
diff --git a/libstdc++-v3/libsupc++/unwind-cxx.h b/libstdc++-v3/libsupc++/unwind-cxx.h
index 75874fc5da4..9697498026d 100644
--- a/libstdc++-v3/libsupc++/unwind-cxx.h
+++ b/libstdc++-v3/libsupc++/unwind-cxx.h
@@ -1,5 +1,5 @@
// -*- C++ -*- Exception handling and frame unwind runtime interface routines.
-// Copyright (C) 2001 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2008 Free Software Foundation, Inc.
//
// This file is part of GCC.
//
@@ -39,18 +39,22 @@
#include <exception>
#include <cstddef>
#include "unwind.h"
+#include <ext/atomicity.h>
#pragma GCC visibility push(default)
namespace __cxxabiv1
{
-// A C++ exception object consists of a header, which is a wrapper around
-// an unwind object header with additional C++ specific information,
+// A primary C++ exception object consists of a header, which is a wrapper
+// around an unwind object header with additional C++ specific information,
// followed by the exception object itself.
struct __cxa_exception
-{
+{
+ // Manage this header.
+ _Atomic_word referenceCount;
+
// Manage the exception object itself.
std::type_info *exceptionType;
void (*exceptionDestructor)(void *);
@@ -87,6 +91,47 @@ struct __cxa_exception
_Unwind_Exception unwindHeader;
};
+// A dependent C++ exception object consists of a wrapper around an unwind
+// object header with additional C++ specific information, containing a pointer
+// to a primary exception object.
+
+struct __cxa_dependent_exception
+{
+ // The primary exception this thing depends on.
+ void *primaryException;
+
+ // The C++ standard has entertaining rules wrt calling set_terminate
+ // and set_unexpected in the middle of the exception cleanup process.
+ std::unexpected_handler unexpectedHandler;
+ std::terminate_handler terminateHandler;
+
+ // The caught exception stack threads through here.
+ __cxa_exception *nextException;
+
+ // How many nested handlers have caught this exception. A negated
+ // value is a signal that this object has been rethrown.
+ int handlerCount;
+
+#ifdef __ARM_EABI_UNWINDER__
+ // Stack of exceptions in cleanups.
+ __cxa_exception* nextPropagatingException;
+
+ // The nuber of active cleanup handlers for this exception.
+ int propagationCount;
+#else
+ // Cache parsed handler data from the personality routine Phase 1
+ // for Phase 2 and __cxa_call_unexpected.
+ int handlerSwitchValue;
+ const unsigned char *actionRecord;
+ const unsigned char *languageSpecificData;
+ _Unwind_Ptr catchTemp;
+ void *adjustedPtr;
+#endif
+
+ // The generic exception header. Must be last.
+ _Unwind_Exception unwindHeader;
+};
+
// Each thread in a C++ program has access to a __cxa_eh_globals object.
struct __cxa_eh_globals
{
@@ -105,12 +150,20 @@ struct __cxa_eh_globals
extern "C" __cxa_eh_globals *__cxa_get_globals () throw();
extern "C" __cxa_eh_globals *__cxa_get_globals_fast () throw();
-// Allocate memory for the exception plus the thown object.
+// Allocate memory for the primary exception plus the thrown object.
extern "C" void *__cxa_allocate_exception(std::size_t thrown_size) throw();
-// Free the space allocated for the exception.
+// Free the space allocated for the primary exception.
extern "C" void __cxa_free_exception(void *thrown_exception) throw();
+// Allocate memory for a dependent exception.
+extern "C" __cxa_dependent_exception*
+__cxa_allocate_dependent_exception() throw();
+
+// Free the space allocated for the dependent exception.
+extern "C" void
+__cxa_free_dependent_exception(__cxa_dependent_exception *ex) throw();
+
// Throw the exception.
extern "C" void __cxa_throw (void *thrown_exception,
std::type_info *tinfo,
@@ -173,6 +226,12 @@ __get_exception_header_from_ue (_Unwind_Exception *exc)
return reinterpret_cast<__cxa_exception *>(exc + 1) - 1;
}
+static inline __cxa_dependent_exception *
+__get_dependent_exception_from_ue (_Unwind_Exception *exc)
+{
+ return reinterpret_cast<__cxa_dependent_exception *>(exc + 1) - 1;
+}
+
#ifdef __ARM_EABI_UNWINDER__
static inline bool
__is_gxx_exception_class(_Unwind_Exception_Class c)
@@ -185,11 +244,19 @@ __is_gxx_exception_class(_Unwind_Exception_Class c)
&& c[4] == 'C'
&& c[5] == '+'
&& c[6] == '+'
- && c[7] == '\0';
+ && (c[7] == '\0' || c[7] == '\x01');
+}
+
+// Only checks for primary or dependent, but not that it is a C++ exception at
+// all.
+static inline bool
+__is_dependent_exception(_Unwind_Exception_Class c)
+{
+ return c[7] == '\x01';
}
static inline void
-__GXX_INIT_EXCEPTION_CLASS(_Unwind_Exception_Class c)
+__GXX_INIT_PRIMARY_EXCEPTION_CLASS(_Unwind_Exception_Class c)
{
c[0] = 'G';
c[1] = 'N';
@@ -201,6 +268,19 @@ __GXX_INIT_EXCEPTION_CLASS(_Unwind_Exception_Class c)
c[7] = '\0';
}
+static inline void
+__GXX_INIT_DEPENDENT_EXCEPTION_CLASS(_Unwind_Exception_Class c)
+{
+ c[0] = 'G';
+ c[1] = 'N';
+ c[2] = 'U';
+ c[3] = 'C';
+ c[4] = 'C';
+ c[5] = '+';
+ c[6] = '+';
+ c[7] = '\x01';
+}
+
static inline bool
__is_gxx_forced_unwind_class(_Unwind_Exception_Class c)
{
@@ -233,8 +313,8 @@ __gxx_caught_object(_Unwind_Exception* eo)
return (void*)eo->barrier_cache.bitpattern[0];
}
#else // !__ARM_EABI_UNWINDER__
-// This is the exception class we report -- "GNUCC++\0".
-const _Unwind_Exception_Class __gxx_exception_class
+// This is the primary exception class we report -- "GNUCC++\0".
+const _Unwind_Exception_Class __gxx_primary_exception_class
= ((((((((_Unwind_Exception_Class) 'G'
<< 8 | (_Unwind_Exception_Class) 'N')
<< 8 | (_Unwind_Exception_Class) 'U')
@@ -244,13 +324,36 @@ const _Unwind_Exception_Class __gxx_exception_class
<< 8 | (_Unwind_Exception_Class) '+')
<< 8 | (_Unwind_Exception_Class) '\0');
+// This is the dependent (from std::rethrow_exception) exception class we report
+// "GNUCC++\x01"
+const _Unwind_Exception_Class __gxx_dependent_exception_class
+= ((((((((_Unwind_Exception_Class) 'G'
+ << 8 | (_Unwind_Exception_Class) 'N')
+ << 8 | (_Unwind_Exception_Class) 'U')
+ << 8 | (_Unwind_Exception_Class) 'C')
+ << 8 | (_Unwind_Exception_Class) 'C')
+ << 8 | (_Unwind_Exception_Class) '+')
+ << 8 | (_Unwind_Exception_Class) '+')
+ << 8 | (_Unwind_Exception_Class) '\x01');
+
static inline bool
__is_gxx_exception_class(_Unwind_Exception_Class c)
{
- return c == __gxx_exception_class;
+ return c == __gxx_primary_exception_class
+ || c == __gxx_dependent_exception_class;
}
-#define __GXX_INIT_EXCEPTION_CLASS(c) c = __gxx_exception_class
+// Only checks for primary or dependent, but not that it is a C++ exception at
+// all.
+static inline bool
+__is_dependent_exception(_Unwind_Exception_Class c)
+{
+ return (c & 1);
+}
+
+#define __GXX_INIT_PRIMARY_EXCEPTION_CLASS(c) c = __gxx_primary_exception_class
+#define __GXX_INIT_DEPENDENT_EXCEPTION_CLASS(c) \
+ c = __gxx_dependent_exception_class
// GNU C++ personality routine, Version 0.
extern "C" _Unwind_Reason_Code __gxx_personality_v0
@@ -265,11 +368,27 @@ extern "C" _Unwind_Reason_Code __gxx_personality_sj0
static inline void*
__gxx_caught_object(_Unwind_Exception* eo)
{
+ // Bad as it looks, this actually works for dependent exceptions too.
__cxa_exception* header = __get_exception_header_from_ue (eo);
return header->adjustedPtr;
}
#endif // !__ARM_EABI_UNWINDER__
+static inline void*
+__get_object_from_ue(_Unwind_Exception* eo) throw()
+{
+ return __is_dependent_exception (eo->exception_class) ?
+ __get_dependent_exception_from_ue (eo)->primaryException :
+ eo + 1;
+}
+
+static inline void *
+__get_object_from_ambiguous_exception(__cxa_exception *p_or_d) throw()
+{
+ return __get_object_from_ue (&p_or_d->unwindHeader);
+}
+
+
} /* namespace __cxxabiv1 */
#pragma GCC visibility pop
diff --git a/libstdc++-v3/po/Makefile.in b/libstdc++-v3/po/Makefile.in
index c79788dac38..b19c1b4d94b 100644
--- a/libstdc++-v3/po/Makefile.in
+++ b/libstdc++-v3/po/Makefile.in
@@ -148,6 +148,7 @@ GLIBCXX_HOSTED_TRUE = @GLIBCXX_HOSTED_TRUE@
GLIBCXX_INCLUDES = @GLIBCXX_INCLUDES@
GLIBCXX_LDBL_COMPAT_FALSE = @GLIBCXX_LDBL_COMPAT_FALSE@
GLIBCXX_LDBL_COMPAT_TRUE = @GLIBCXX_LDBL_COMPAT_TRUE@
+GLIBCXX_LIBS = @GLIBCXX_LIBS@
GREP = @GREP@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
diff --git a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am
index 08f423238d9..4d0ea282c62 100644
--- a/libstdc++-v3/src/Makefile.am
+++ b/libstdc++-v3/src/Makefile.am
@@ -186,6 +186,7 @@ sources = \
wstring-inst.cc \
mutex.cc \
condition_variable.cc \
+ chrono.cc \
${host_sources} \
${host_sources_extra}
@@ -195,11 +196,15 @@ vpath % $(top_srcdir)
libstdc___la_SOURCES = $(sources)
libstdc___la_LIBADD = \
+ $(GLIBCXX_LIBS) \
$(top_builddir)/libmath/libmath.la \
$(top_builddir)/libsupc++/libsupc++convenience.la \
$(top_builddir)/libprofc++/libprofc++convenience.la
-libstdc___la_DEPENDENCIES = ${version_dep} $(libstdc___la_LIBADD)
+libstdc___la_DEPENDENCIES = \
+ ${version_dep} \
+ $(top_builddir)/libmath/libmath.la \
+ $(top_builddir)/libsupc++/libsupc++convenience.la
libstdc___la_LDFLAGS = \
-version-info $(libtool_VERSION) ${version_arg} -lm
@@ -273,6 +278,21 @@ atomic.lo: atomic.cc
atomic.o: atomic.cc
$(CXXCOMPILE) -x c++ -std=gnu++0x -c $<
+string-inst.lo: string-inst.cc
+ $(LTCXXCOMPILE) -std=gnu++0x -c $<
+string-inst.o: string-inst.cc
+ $(CXXCOMPILE) -std=gnu++0x -c $<
+
+wstring-inst.lo: wstring-inst.cc
+ $(LTCXXCOMPILE) -std=gnu++0x -c $<
+wstring-inst.o: wstring-inst.cc
+ $(CXXCOMPILE) -std=gnu++0x -c $<
+
+chrono.lo: chrono.cc
+ $(LTCXXCOMPILE) -std=gnu++0x -c $<
+chrono.o: chrono.cc
+ $(CXXCOMPILE) -std=gnu++0x -c $<
+
if GLIBCXX_LDBL_COMPAT
# Use special rules for compatibility-ldbl.cc compilation, as we need to
# pass -mlong-double-64.
diff --git a/libstdc++-v3/src/Makefile.in b/libstdc++-v3/src/Makefile.in
index e40d3275f4d..a189614eedb 100644
--- a/libstdc++-v3/src/Makefile.in
+++ b/libstdc++-v3/src/Makefile.in
@@ -72,6 +72,7 @@ am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__installdirs = "$(DESTDIR)$(toolexeclibdir)"
toolexeclibLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(toolexeclib_LTLIBRARIES)
+am__DEPENDENCIES_1 =
am__libstdc___la_SOURCES_DIST = atomic.cc bitmap_allocator.cc \
pool_allocator.cc mt_allocator.cc codecvt.cc compatibility.cc \
complex_io.cc ctype.cc debug.cc functexcept.cc hash.cc \
@@ -84,10 +85,10 @@ am__libstdc___la_SOURCES_DIST = atomic.cc bitmap_allocator.cc \
istream-inst.cc istream.cc locale-inst.cc misc-inst.cc \
ostream-inst.cc sstream-inst.cc streambuf-inst.cc streambuf.cc \
string-inst.cc valarray-inst.cc wlocale-inst.cc \
- wstring-inst.cc mutex.cc condition_variable.cc atomicity.cc \
- codecvt_members.cc collate_members.cc ctype_members.cc \
- messages_members.cc monetary_members.cc numeric_members.cc \
- time_members.cc basic_file.cc c++locale.cc \
+ wstring-inst.cc mutex.cc condition_variable.cc chrono.cc \
+ atomicity.cc codecvt_members.cc collate_members.cc \
+ ctype_members.cc messages_members.cc monetary_members.cc \
+ numeric_members.cc time_members.cc basic_file.cc c++locale.cc \
compatibility-ldbl.cc parallel_list.cc parallel_settings.cc
am__objects_1 = atomicity.lo codecvt_members.lo collate_members.lo \
ctype_members.lo messages_members.lo monetary_members.lo \
@@ -109,7 +110,7 @@ am__objects_5 = atomic.lo bitmap_allocator.lo pool_allocator.lo \
istream-inst.lo istream.lo locale-inst.lo misc-inst.lo \
ostream-inst.lo sstream-inst.lo streambuf-inst.lo streambuf.lo \
string-inst.lo valarray-inst.lo wlocale-inst.lo \
- wstring-inst.lo mutex.lo condition_variable.lo \
+ wstring-inst.lo mutex.lo condition_variable.lo chrono.lo \
$(am__objects_1) $(am__objects_4)
am_libstdc___la_OBJECTS = $(am__objects_5)
libstdc___la_OBJECTS = $(am_libstdc___la_OBJECTS)
@@ -205,6 +206,7 @@ GLIBCXX_HOSTED_TRUE = @GLIBCXX_HOSTED_TRUE@
GLIBCXX_INCLUDES = @GLIBCXX_INCLUDES@
GLIBCXX_LDBL_COMPAT_FALSE = @GLIBCXX_LDBL_COMPAT_FALSE@
GLIBCXX_LDBL_COMPAT_TRUE = @GLIBCXX_LDBL_COMPAT_TRUE@
+GLIBCXX_LIBS = @GLIBCXX_LIBS@
GREP = @GREP@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -422,16 +424,22 @@ sources = \
wstring-inst.cc \
mutex.cc \
condition_variable.cc \
+ chrono.cc \
${host_sources} \
${host_sources_extra}
libstdc___la_SOURCES = $(sources)
libstdc___la_LIBADD = \
+ $(GLIBCXX_LIBS) \
$(top_builddir)/libmath/libmath.la \
$(top_builddir)/libsupc++/libsupc++convenience.la \
$(top_builddir)/libprofc++/libprofc++convenience.la
-libstdc___la_DEPENDENCIES = ${version_dep} $(libstdc___la_LIBADD)
+libstdc___la_DEPENDENCIES = \
+ ${version_dep} \
+ $(top_builddir)/libmath/libmath.la \
+ $(top_builddir)/libsupc++/libsupc++convenience.la
+
libstdc___la_LDFLAGS = \
-version-info $(libtool_VERSION) ${version_arg} -lm
@@ -867,6 +875,21 @@ atomic.lo: atomic.cc
atomic.o: atomic.cc
$(CXXCOMPILE) -x c++ -std=gnu++0x -c $<
+string-inst.lo: string-inst.cc
+ $(LTCXXCOMPILE) -std=gnu++0x -c $<
+string-inst.o: string-inst.cc
+ $(CXXCOMPILE) -std=gnu++0x -c $<
+
+wstring-inst.lo: wstring-inst.cc
+ $(LTCXXCOMPILE) -std=gnu++0x -c $<
+wstring-inst.o: wstring-inst.cc
+ $(CXXCOMPILE) -std=gnu++0x -c $<
+
+chrono.lo: chrono.cc
+ $(LTCXXCOMPILE) -std=gnu++0x -c $<
+chrono.o: chrono.cc
+ $(CXXCOMPILE) -std=gnu++0x -c $<
+
# Use special rules for compatibility-ldbl.cc compilation, as we need to
# pass -mlong-double-64.
@GLIBCXX_LDBL_COMPAT_TRUE@compatibility-ldbl.lo: compatibility-ldbl.cc
diff --git a/libstdc++-v3/src/chrono.cc b/libstdc++-v3/src/chrono.cc
new file mode 100644
index 00000000000..88fb4c180e9
--- /dev/null
+++ b/libstdc++-v3/src/chrono.cc
@@ -0,0 +1,76 @@
+// chrono -*- C++ -*-
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <chrono>
+
+#ifdef _GLIBCXX_USE_C99_STDINT_TR1
+
+// conditional inclusion of sys/time.h for gettimeofday
+#if !defined(_GLIBCXX_USE_CLOCK_MONOTONIC) && \
+ !defined(_GLIBCXX_USE_CLOCK_REALTIME) && \
+ defined(_GLIBCXX_USE_GETTIMEOFDAY)
+#include <sys/time.h>
+#endif
+
+namespace std
+{
+ namespace chrono
+ {
+ const bool system_clock::is_monotonic;
+
+ system_clock::time_point
+ system_clock::now()
+ {
+#ifdef _GLIBCXX_USE_CLOCK_MONOTONIC
+ timespec tp;
+ // -EINVAL, -EFAULT
+ clock_gettime(CLOCK_MONOTONIC, &tp);
+ return time_point(duration(chrono::seconds(tp.tv_sec)
+ + chrono::nanoseconds(tp.tv_nsec)));
+#elif defined(_GLIBCXX_USE_CLOCK_REALTIME)
+ timespec tp;
+ // -EINVAL, -EFAULT
+ clock_gettime(CLOCK_REALTIME, &tp);
+ return time_point(duration(chrono::seconds(tp.tv_sec)
+ + chrono::nanoseconds(tp.tv_nsec)));
+#elif defined(_GLIBCXX_USE_GETTIMEOFDAY)
+ timeval tv;
+ // EINVAL, EFAULT
+ gettimeofday(&tv, NULL);
+ return time_point(duration(chrono::seconds(tv.tv_sec)
+ + chrono::microseconds(tv.tv_usec)));
+#else
+ std::time_t __sec = std::time(0);
+ return system_clock::from_time_t(__sec);
+#endif
+ }
+ }
+}
+
+#endif // _GLIBCXX_USE_C99_STDINT_TR1
diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++200x/all.cc b/libstdc++-v3/testsuite/17_intro/headers/c++200x/all.cc
index 7988666739a..4c2e31be081 100644
--- a/libstdc++-v3/testsuite/17_intro/headers/c++200x/all.cc
+++ b/libstdc++-v3/testsuite/17_intro/headers/c++200x/all.cc
@@ -95,6 +95,7 @@
#include <algorithm>
#include <array>
#include <bitset>
+#include <chrono>
#include <condition_variable>
#include <complex>
#include <deque>
@@ -118,6 +119,7 @@
#include <ostream>
#include <queue>
#include <random>
+#include <ratio>
#include <regex>
#include <set>
#include <sstream>
diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++200x/all_multiple_inclusion.cc b/libstdc++-v3/testsuite/17_intro/headers/c++200x/all_multiple_inclusion.cc
index 814fbc3a144..f88edc8268a 100644
--- a/libstdc++-v3/testsuite/17_intro/headers/c++200x/all_multiple_inclusion.cc
+++ b/libstdc++-v3/testsuite/17_intro/headers/c++200x/all_multiple_inclusion.cc
@@ -93,6 +93,7 @@
#include <algorithm>
#include <array>
#include <bitset>
+#include <chrono>
#include <complex>
#include <deque>
#include <exception>
@@ -114,6 +115,7 @@
#include <ostream>
#include <queue>
#include <random>
+#include <ratio>
#include <regex>
#include <set>
#include <sstream>
@@ -203,6 +205,7 @@
#include <algorithm>
#include <array>
#include <bitset>
+#include <chrono>
#include <complex>
#include <deque>
#include <exception>
@@ -219,11 +222,13 @@
#include <locale>
#include <map>
#include <memory>
+#include <mutex>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <random>
+#include <ratio>
#include <regex>
#include <set>
#include <sstream>
diff --git a/libstdc++-v3/testsuite/18_support/bad_alloc/cons_virtual_derivation.cc b/libstdc++-v3/testsuite/18_support/bad_alloc/cons_virtual_derivation.cc
index dd0d09b6fb4..b7d28cc34d8 100644
--- a/libstdc++-v3/testsuite/18_support/bad_alloc/cons_virtual_derivation.cc
+++ b/libstdc++-v3/testsuite/18_support/bad_alloc/cons_virtual_derivation.cc
@@ -1,7 +1,6 @@
-// { dg-do run { xfail *-*-* } }
// 2007-05-29 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2007 Free Software Foundation, Inc.
+// Copyright (C) 2007, 2008 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
diff --git a/libstdc++-v3/testsuite/18_support/bad_cast/cons_virtual_derivation.cc b/libstdc++-v3/testsuite/18_support/bad_cast/cons_virtual_derivation.cc
index 4efc3466cf9..358f0c5dfd6 100644
--- a/libstdc++-v3/testsuite/18_support/bad_cast/cons_virtual_derivation.cc
+++ b/libstdc++-v3/testsuite/18_support/bad_cast/cons_virtual_derivation.cc
@@ -1,7 +1,6 @@
-// { dg-do run { xfail *-*-* } }
// 2007-05-29 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2007 Free Software Foundation, Inc.
+// Copyright (C) 2007, 2008 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
diff --git a/libstdc++-v3/testsuite/18_support/bad_exception/cons_virtual_derivation.cc b/libstdc++-v3/testsuite/18_support/bad_exception/cons_virtual_derivation.cc
index b66ce7d43ed..8fb71fe6399 100644
--- a/libstdc++-v3/testsuite/18_support/bad_exception/cons_virtual_derivation.cc
+++ b/libstdc++-v3/testsuite/18_support/bad_exception/cons_virtual_derivation.cc
@@ -1,7 +1,6 @@
-// { dg-do run { xfail *-*-* } }
// 2007-05-29 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2007 Free Software Foundation, Inc.
+// Copyright (C) 2007, 2008 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
diff --git a/libstdc++-v3/testsuite/18_support/bad_typeid/cons_virtual_derivation.cc b/libstdc++-v3/testsuite/18_support/bad_typeid/cons_virtual_derivation.cc
index 0da3c9deac8..9d69eb3fd25 100644
--- a/libstdc++-v3/testsuite/18_support/bad_typeid/cons_virtual_derivation.cc
+++ b/libstdc++-v3/testsuite/18_support/bad_typeid/cons_virtual_derivation.cc
@@ -1,7 +1,6 @@
-// { dg-do run { xfail *-*-* } }
// 2007-05-29 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2007 Free Software Foundation, Inc.
+// Copyright (C) 2007, 2008 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
diff --git a/libstdc++-v3/testsuite/18_support/exception_ptr/current_exception.cc b/libstdc++-v3/testsuite/18_support/exception_ptr/current_exception.cc
new file mode 100644
index 00000000000..d4a63e4b001
--- /dev/null
+++ b/libstdc++-v3/testsuite/18_support/exception_ptr/current_exception.cc
@@ -0,0 +1,90 @@
+// { dg-options "-std=gnu++0x" }
+// 2008-05-25 Sebastian Redl <sebastian.redl@getdesigned.at>
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// current_exception() under various conditions.
+
+#include <exception>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ exception_ptr ep = current_exception();
+ VERIFY( !ep );
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ try {
+ throw 0;
+ } catch(...) {
+ exception_ptr ep = current_exception();
+ VERIFY( ep );
+ }
+}
+
+void test03()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ try {
+ throw exception();
+ } catch(std::exception&) {
+ exception_ptr ep = current_exception();
+ VERIFY( ep );
+ }
+}
+
+void test04()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ try {
+ throw 0;
+ } catch(...) {
+ exception_ptr ep1 = current_exception();
+ try {
+ throw 0;
+ } catch(...) {
+ exception_ptr ep2 = current_exception();
+ VERIFY( ep1 != ep2 );
+ }
+ exception_ptr ep3 = current_exception();
+ // Not guaranteed by standard, but by this implementation.
+ VERIFY( ep1 == ep3 );
+ }
+}
+
+int main()
+{
+ test01();
+ test02();
+ test03();
+ test04();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/18_support/exception_ptr/lifespan.cc b/libstdc++-v3/testsuite/18_support/exception_ptr/lifespan.cc
new file mode 100644
index 00000000000..1107a2ece60
--- /dev/null
+++ b/libstdc++-v3/testsuite/18_support/exception_ptr/lifespan.cc
@@ -0,0 +1,188 @@
+// { dg-options "-std=gnu++0x" }
+// 2008-05-25 Sebastian Redl <sebastian.redl@getdesigned.at>
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// Tests the life span of the exception object.
+
+#include <exception>
+#include <testsuite_hooks.h>
+
+bool may_destruct = false;
+
+class destructing
+{
+ mutable bool copied;
+
+public:
+ destructing() : copied(false) { }
+ destructing(const destructing &o) : copied(false) { o.copied = true; }
+ ~destructing() { VERIFY( copied || may_destruct ); }
+};
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ may_destruct = false;
+
+ // Test the destructing class.
+ {
+ destructing *d = new destructing;
+ destructing d2(*d);
+ delete d;
+ may_destruct = true;
+ }
+ may_destruct = false;
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ may_destruct = false;
+
+ try {
+ throw destructing();
+ } catch(...) {
+ may_destruct = true;
+ }
+ may_destruct = false;
+}
+
+void test03()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ may_destruct = false;
+
+ try {
+ throw destructing();
+ } catch(...) {
+ {
+ exception_ptr ep = current_exception();
+ }
+ may_destruct = true;
+ }
+ may_destruct = false;
+}
+
+void test04()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ may_destruct = false;
+
+ {
+ exception_ptr ep;
+ try {
+ throw destructing();
+ } catch(...) {
+ ep = current_exception();
+ }
+ may_destruct = true;
+ }
+ may_destruct = false;
+}
+
+void test05_helper()
+{
+ using namespace std;
+ try {
+ throw destructing();
+ } catch(...) {
+ exception_ptr ep = current_exception();
+ rethrow_exception(ep);
+ }
+}
+
+void test05()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ may_destruct = false;
+
+ try {
+ test05_helper();
+ } catch(...) {
+ may_destruct = true;
+ }
+ may_destruct = false;
+}
+
+void test06_helper()
+{
+ using namespace std;
+ try {
+ throw destructing();
+ } catch(...) {
+ exception_ptr ep = current_exception();
+ throw;
+ }
+}
+
+void test06()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ may_destruct = false;
+
+ try {
+ test06_helper();
+ } catch(...) {
+ may_destruct = true;
+ }
+ may_destruct = false;
+}
+
+std::exception_ptr gep;
+
+void test99()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ may_destruct = false;
+
+ try {
+ throw destructing();
+ } catch(...) {
+ gep = current_exception();
+ }
+}
+
+int main()
+{
+ test01();
+ test02();
+ test03();
+ test04();
+ test05();
+ test06();
+
+ test99();
+ may_destruct = true;
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/18_support/exception_ptr/rethrow_exception.cc b/libstdc++-v3/testsuite/18_support/exception_ptr/rethrow_exception.cc
new file mode 100644
index 00000000000..96d38d5eba3
--- /dev/null
+++ b/libstdc++-v3/testsuite/18_support/exception_ptr/rethrow_exception.cc
@@ -0,0 +1,113 @@
+// { dg-options "-std=gnu++0x" }
+// 2008-05-25 Sebastian Redl <sebastian.redl@getdesigned.at>
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// rethrow_exception() and preservation of data
+
+#include <exception>
+#include <typeinfo>
+#include <cstring>
+#include <stdexcept>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ try {
+ rethrow_exception(copy_exception(0));
+ } catch(...) {
+ }
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ try {
+ rethrow_exception(copy_exception(runtime_error("test")));
+ } catch(exception &e) {
+ VERIFY( typeid(e) == typeid(runtime_error) );
+ VERIFY( strcmp(e.what(), "test") == 0 );
+ }
+}
+
+void test03()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ exception_ptr ep;
+ try {
+ throw 0;
+ } catch(...) {
+ ep = current_exception();
+ }
+ try {
+ rethrow_exception(ep);
+ } catch(...) {
+ }
+}
+
+void test04()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ // Weave the exceptions in an attempt to confuse the machinery.
+ try {
+ throw 0;
+ } catch(...) {
+ exception_ptr ep1 = current_exception();
+ try {
+ throw 1;
+ } catch(...) {
+ exception_ptr ep2 = current_exception();
+ try {
+ rethrow_exception(ep1);
+ } catch(...) {
+ try {
+ rethrow_exception(ep2);
+ } catch(...) {
+ try {
+ rethrow_exception(ep1);
+ } catch(...) {
+ }
+ try {
+ rethrow_exception(ep2);
+ } catch(...) {
+ }
+ }
+ }
+ }
+ }
+}
+
+int main()
+{
+ test01();
+ test02();
+ test03();
+ test04();
+
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/18_support/headers/cstdint/types_std_c++0x.cc b/libstdc++-v3/testsuite/18_support/headers/cstdint/types_std_c++0x.cc
index 7a5363c4f74..eff1d6dd27c 100644
--- a/libstdc++-v3/testsuite/18_support/headers/cstdint/types_std_c++0x.cc
+++ b/libstdc++-v3/testsuite/18_support/headers/cstdint/types_std_c++0x.cc
@@ -1,7 +1,8 @@
-// { dg-options "-std=gnu++0x" }
// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
-// Copyright (C) 2007 Free Software Foundation, Inc.
+// Copyright (C) 2007, 2008 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -23,8 +24,6 @@
void test01()
{
-#if _GLIBCXX_USE_C99_STDINT_TR1
-
typedef std::int8_t my_int8_t;
typedef std::int16_t my_int16_t;
typedef std::int32_t my_int32_t;
@@ -53,6 +52,4 @@ void test01()
typedef std::uint_least64_t my_uint_least64_t;
typedef std::uintmax_t my_uintmax_t;
typedef std::uintptr_t my_uintptr_t;
-
-#endif
}
diff --git a/libstdc++-v3/testsuite/18_support/numeric_limits/char16_32_t.cc b/libstdc++-v3/testsuite/18_support/numeric_limits/char16_32_t.cc
index c2957506cb0..84499480146 100644
--- a/libstdc++-v3/testsuite/18_support/numeric_limits/char16_32_t.cc
+++ b/libstdc++-v3/testsuite/18_support/numeric_limits/char16_32_t.cc
@@ -1,4 +1,6 @@
// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+
// 2008-05-20 Paolo Carlini <paolo.carlini@oracle.com>
//
// Copyright (C) 2008 Free Software Foundation
@@ -69,9 +71,8 @@ template<typename T, typename R>
int main()
{
-#if _GLIBCXX_USE_C99_STDINT_TR1
do_test<char16_t, uint_least16_t>();
do_test<char32_t, uint_least32_t>();
-#endif
+
return 0;
}
diff --git a/libstdc++-v3/testsuite/19_diagnostics/logic_error/cons_virtual_derivation.cc b/libstdc++-v3/testsuite/19_diagnostics/logic_error/cons_virtual_derivation.cc
index 5c936e27f16..350f66d9499 100644
--- a/libstdc++-v3/testsuite/19_diagnostics/logic_error/cons_virtual_derivation.cc
+++ b/libstdc++-v3/testsuite/19_diagnostics/logic_error/cons_virtual_derivation.cc
@@ -1,7 +1,6 @@
-// { dg-do run { xfail *-*-* } }
// 2007-05-29 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2007 Free Software Foundation, Inc.
+// Copyright (C) 2007, 2008 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
diff --git a/libstdc++-v3/testsuite/19_diagnostics/runtime_error/cons_virtual_derivation.cc b/libstdc++-v3/testsuite/19_diagnostics/runtime_error/cons_virtual_derivation.cc
index 86d5bb5ed71..c8870e51efb 100644
--- a/libstdc++-v3/testsuite/19_diagnostics/runtime_error/cons_virtual_derivation.cc
+++ b/libstdc++-v3/testsuite/19_diagnostics/runtime_error/cons_virtual_derivation.cc
@@ -1,7 +1,6 @@
-// { dg-do run { xfail *-*-* } }
// 2007-05-29 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2007 Free Software Foundation, Inc.
+// Copyright (C) 2007, 2008 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
diff --git a/libstdc++-v3/testsuite/19_diagnostics/system_error/cons_virtual_derivation.cc b/libstdc++-v3/testsuite/19_diagnostics/system_error/cons_virtual_derivation.cc
index 8e67ce5edae..098fb575dab 100644
--- a/libstdc++-v3/testsuite/19_diagnostics/system_error/cons_virtual_derivation.cc
+++ b/libstdc++-v3/testsuite/19_diagnostics/system_error/cons_virtual_derivation.cc
@@ -1,8 +1,7 @@
// { dg-options "-std=gnu++0x" }
-// { dg-do run { xfail *-*-* } }
// 2007-05-29 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2007 Free Software Foundation, Inc.
+// Copyright (C) 2007, 2008 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
diff --git a/libstdc++-v3/testsuite/20_util/bad_function_call/cons_virtual_derivation.cc b/libstdc++-v3/testsuite/20_util/bad_function_call/cons_virtual_derivation.cc
index 6cc46c02a51..c31563a3351 100644
--- a/libstdc++-v3/testsuite/20_util/bad_function_call/cons_virtual_derivation.cc
+++ b/libstdc++-v3/testsuite/20_util/bad_function_call/cons_virtual_derivation.cc
@@ -1,8 +1,7 @@
-// { dg-do run { xfail *-*-* } }
// { dg-options "-std=gnu++0x" }
// 2007-05-29 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2007 Free Software Foundation, Inc.
+// Copyright (C) 2007, 2008 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
diff --git a/libstdc++-v3/testsuite/20_util/clocks/1.cc b/libstdc++-v3/testsuite/20_util/clocks/1.cc
new file mode 100644
index 00000000000..bcbe210d22f
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/clocks/1.cc
@@ -0,0 +1,39 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+
+// Copyright (C) 2008 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// 20.8.5 Clocks [time.clock]
+
+#include <chrono>
+
+// 20.8.5.1 system_clock [time.clock.system]
+int
+main()
+{
+ using namespace std::chrono;
+
+ system_clock::time_point t1 = system_clock::now();
+ bool is_monotonic = system_clock::is_monotonic;
+ is_monotonic = is_monotonic; // suppress unused warning
+ std::time_t t2 = system_clock::to_time_t(t1);
+ system_clock::time_point t3 = system_clock::from_time_t(t2);
+
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/20_util/duration/arithmetic/1.cc b/libstdc++-v3/testsuite/20_util/duration/arithmetic/1.cc
new file mode 100644
index 00000000000..55533eb1dde
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/duration/arithmetic/1.cc
@@ -0,0 +1,94 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+
+// Copyright (C) 2008 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// 20.8.3 Class template duration [time.duration]
+
+#include <chrono>
+#include <testsuite_hooks.h>
+
+// 20.8.3.3 duration arithmetic [time.duration.arithmetic] (unary member ops)
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std::chrono;
+
+ duration<int> d0(3);
+ duration<int> d1 = -d0;
+ VERIFY(d0.count() == 3);
+ VERIFY(d1.count() == -3);
+
+ duration<int> d2 = (+d0);
+ VERIFY(d2.count() == 3);
+
+ duration<int> d3(++d2);
+ VERIFY(d2.count() == 4);
+ VERIFY(d3.count() == 4);
+
+ duration<int> d4(d3++);
+ VERIFY(d3.count() == 5);
+ VERIFY(d4.count() == 4);
+
+ duration<int> d5(--d4);
+ VERIFY(d4.count() == 3);
+ VERIFY(d5.count() == 3);
+
+ duration<int> d6(d5--);
+ VERIFY(d5.count() == 2);
+ VERIFY(d6.count() == 3);
+}
+
+// 20.8.3.3 duration arithmetic [time.duration.arithmetic] (binary member ops)
+void
+test02()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std::chrono;
+
+ duration<int> d7(3);
+ duration<int> d8(9);
+ d7 += d8;
+ VERIFY(d7.count() == 12);
+ VERIFY(d8.count() == 9);
+
+ duration<int> d9(3);
+ duration<int> d10(9);
+ d9 -= d10;
+ VERIFY(d9.count() == -6);
+ VERIFY(d10.count() == 9);
+
+ duration<int> d11(9);
+ int i = 3;
+ d11 *= i;
+ VERIFY(d11.count() == 27);
+
+ duration<int> d12(12);
+ d12 /= i;
+ VERIFY(d12.count() == 4);
+}
+
+int
+main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/20_util/duration/arithmetic/2.cc b/libstdc++-v3/testsuite/20_util/duration/arithmetic/2.cc
new file mode 100644
index 00000000000..e096334c980
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/duration/arithmetic/2.cc
@@ -0,0 +1,62 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+
+// Copyright (C) 2008 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// 20.8.3 Class template duration [time.duration]
+
+#include <chrono>
+#include <testsuite_hooks.h>
+
+// 20.8.3.5 duration non-member arithmetic [time.duration.nonmember]
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std::chrono;
+
+ duration<int> d0(12);
+ duration<int> d1(3);
+ int i = 3;
+
+ duration<int> d2 = d0 + d1;
+ VERIFY(d2.count() == 15);
+
+ duration<int> d3 = d0 - d1;
+ VERIFY(d3.count() == 9);
+
+ duration<int> d4 = d0 * i;
+ VERIFY(d4.count() == 36);
+
+ duration<int> d5 = i * d0;
+ VERIFY(d5.count() == 36);
+
+ duration<int> d6 = d0 / i;
+ VERIFY(d6.count() == 4);
+
+ int j = d0 / d1;
+ VERIFY(j == 4);
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/20_util/duration/comparisons/1.cc b/libstdc++-v3/testsuite/20_util/duration/comparisons/1.cc
new file mode 100644
index 00000000000..31ac42ddcee
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/duration/comparisons/1.cc
@@ -0,0 +1,56 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+
+// Copyright (C) 2008 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// 20.8.3 Class template duration [time.duration]
+
+#include <chrono>
+#include <testsuite_hooks.h>
+
+// 20.8.3.6 duration comparisons [time.duration.comparisons]
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std::chrono;
+
+ duration<int> d0(12);
+ duration<int> d1(3);
+ duration<int> d2(3);
+
+ VERIFY(d1 < d0);
+ VERIFY(d0 > d1);
+
+ VERIFY(d0 != d1);
+ VERIFY(d1 == d2);
+
+ VERIFY(d1 <= d2);
+ VERIFY(d1 >= d2);
+
+ VERIFY(d1 <= d0);
+ VERIFY(d0 >= d1);
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/20_util/duration/cons/1.cc b/libstdc++-v3/testsuite/20_util/duration/cons/1.cc
new file mode 100644
index 00000000000..6d12dbb5bd7
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/duration/cons/1.cc
@@ -0,0 +1,138 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+
+// Copyright (C) 2008 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// 20.8.3 Class template duration [time.duration]
+
+#include <chrono>
+#include <type_traits>
+#include <testsuite_hooks.h>
+
+template<typename T>
+struct type_emulator
+{
+ type_emulator()
+ : i(T(0)) { }
+
+ type_emulator(T j)
+ : i(j) { }
+
+ type_emulator(const type_emulator& e)
+ : i(e.i) { }
+
+ type_emulator&
+ operator*=(type_emulator a)
+ {
+ i *= a.i;
+ return *this;
+ }
+
+ type_emulator&
+ operator+=(type_emulator a)
+ {
+ i += a.i;
+ return *this;
+ }
+
+ operator T ()
+ { return i; }
+
+ T i;
+};
+
+template<typename T>
+bool
+operator==(type_emulator<T> a, type_emulator<T> b)
+{ return a.i == b.i; }
+
+template<typename T>
+bool
+operator<(type_emulator<T> a, type_emulator<T> b)
+{ return a.i < b.i; }
+
+template<typename T>
+type_emulator<T>
+operator+(type_emulator<T> a, type_emulator<T> b)
+{ return a += b; }
+
+template<typename T>
+type_emulator<T>
+operator*(type_emulator<T> a, type_emulator<T> b)
+{ return a *= b; }
+
+namespace std
+{
+ template<typename T, typename U>
+ struct common_type<type_emulator<T>, U>
+ { typedef typename common_type<T,U>::type type; };
+
+ template<typename T, typename U>
+ struct common_type<U, type_emulator<T>>
+ { typedef typename common_type<U,T>::type type; };
+
+ template<typename T, typename U>
+ struct common_type<type_emulator<T>, type_emulator<U>>
+ { typedef typename common_type<T,U>::type type; };
+
+ namespace chrono
+ {
+ template<typename T>
+ struct treat_as_floating_point<type_emulator<T>>
+ : is_floating_point<T>
+ { };
+ }
+}
+
+typedef type_emulator<int> int_emulator;
+typedef type_emulator<double> dbl_emulator;
+
+// 20.8.3.1 duration constructors [time.duration.cons]
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using std::chrono::duration;
+
+ duration<int> d0;
+ VERIFY(d0.count() == static_cast<duration<int>::rep>(0));
+
+ int r = 3;
+ duration<int> d1(r);
+ VERIFY(d1.count() == static_cast<duration<int>::rep>(r));
+
+ double s = 8.0;
+ duration<double> d2(s);
+ VERIFY(d2.count() == static_cast<duration<double>::rep>(s));
+
+ int_emulator ie(3);
+ duration<int_emulator> d3(ie);
+ VERIFY(d3.count() == static_cast<duration<int_emulator>::rep>(ie));
+
+ dbl_emulator de(4.0);
+ duration<dbl_emulator> d4(de);
+ VERIFY(d4.count() == static_cast<duration<dbl_emulator>::rep>(de));
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/20_util/duration/cons/1_neg.cc b/libstdc++-v3/testsuite/20_util/duration/cons/1_neg.cc
new file mode 100644
index 00000000000..d8b08dbd4f8
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/duration/cons/1_neg.cc
@@ -0,0 +1,46 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+
+// Copyright (C) 2008 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// 20.8.3.1 duration constructors [time.duration.cons]
+
+#include <chrono>
+
+void
+test01()
+{
+ std::chrono::duration<int> d1(1.0);
+}
+
+void
+test02()
+{
+ using namespace std::chrono;
+
+ duration<int, std::micro> d2(8);
+ duration<int, std::milli> d2_copy(d2);
+}
+
+// { dg-error "instantiated from here" "" { target *-*-* } 30 }
+// { dg-error "instantiated from here" "" { target *-*-* } 39 }
+// { dg-error "not exactly representable" "" { target *-*-* } 218 }
+// { dg-error "integral duration with floating point" "" { target *-*-* } 208 }
+// { dg-excess-errors "In instantiation of" }
diff --git a/libstdc++-v3/testsuite/20_util/duration/cons/2.cc b/libstdc++-v3/testsuite/20_util/duration/cons/2.cc
new file mode 100644
index 00000000000..b491224dc48
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/duration/cons/2.cc
@@ -0,0 +1,120 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+
+// Copyright (C) 2008 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// 20.8.3 Class template duration [time.duration]
+
+#include <chrono>
+#include <type_traits>
+#include <testsuite_hooks.h>
+
+template<typename T>
+struct type_emulator
+{
+ type_emulator() : i(T(0)) { }
+ type_emulator(T j) : i(j) { }
+ type_emulator(const type_emulator& e) : i(e.i) { }
+
+ type_emulator& operator*=(type_emulator a)
+ { i *= a.i; return *this; }
+
+ type_emulator& operator+=(type_emulator a)
+ { i += a.i; return *this; }
+
+ operator T () { return i; }
+ T i;
+};
+
+template<typename T>
+bool operator==(type_emulator<T> a, type_emulator<T> b)
+{ return a.i == b.i; }
+
+template<typename T>
+bool operator<(type_emulator<T> a, type_emulator<T> b)
+{ return a.i < b.i; }
+
+template<typename T>
+type_emulator<T> operator+(type_emulator<T> a, type_emulator<T> b)
+{ return a += b; }
+
+template<typename T>
+type_emulator<T> operator*(type_emulator<T> a, type_emulator<T> b)
+{ return a *= b; }
+
+namespace std
+{
+ template<typename T, typename U>
+ struct common_type<type_emulator<T>, U>
+ { typedef typename common_type<T,U>::type type; };
+
+ template<typename T, typename U>
+ struct common_type<U, type_emulator<T>>
+ { typedef typename common_type<U,T>::type type; };
+
+ template<typename T, typename U>
+ struct common_type<type_emulator<T>, type_emulator<U>>
+ { typedef typename common_type<T,U>::type type; };
+
+ namespace chrono
+ {
+ template<typename T>
+ struct treat_as_floating_point<type_emulator<T>>
+ : is_floating_point<T>
+ { };
+ }
+}
+
+typedef type_emulator<int> int_emulator;
+typedef type_emulator<double> dbl_emulator;
+
+// 20.8.3.1 duration constructors [time.duration.cons]
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std::chrono;
+
+ duration<int> d0(3);
+ duration<int> d0_copy(d0);
+ VERIFY(d0_copy.count() == d0.count());
+
+ duration<int, std::milli> d1(5);
+ duration<int, std::micro> d1_copy(d1);
+ VERIFY(d1.count() * 1000 == d1_copy.count());
+
+ duration<double, std::micro> d2(8.0);
+ duration<double, std::milli> d2_copy(d2);
+ VERIFY(d2.count() == d2_copy.count() * 1000.0);
+
+ duration<int_emulator, std::milli> d3(5);
+ duration<int_emulator, std::micro> d3_copy(d3);
+ VERIFY(d3.count() * 1000 == d3_copy.count());
+
+ duration<dbl_emulator, std::micro> d4(5.0);
+ duration<dbl_emulator, std::milli> d4_copy(d4);
+ VERIFY(d4.count() == d4_copy.count() * dbl_emulator(1000.0));
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/20_util/duration/requirements/explicit_instantiation/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/duration/requirements/explicit_instantiation/explicit_instantiation.cc
new file mode 100644
index 00000000000..7613411879d
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/duration/requirements/explicit_instantiation/explicit_instantiation.cc
@@ -0,0 +1,27 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+
+// Copyright (C) 2008 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301, USA.
+
+#include <ratio>
+#include <chrono>
+
+template class std::chrono::duration<int>;
+template class std::chrono::duration<float, std::ratio<2,3>>;
diff --git a/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg1.cc b/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg1.cc
new file mode 100644
index 00000000000..188950d6347
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg1.cc
@@ -0,0 +1,45 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+// 2008-07-31 Chris Fairles <chris.fairles@gmail.com>
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <chrono>
+
+void test01()
+{
+ // Check if rep is a duration type
+ typedef std::chrono::duration<int> rep_type;
+ typedef std::chrono::duration<rep_type> test_type;
+ test_type d;
+}
+
+// { dg-error "rep cannot be a duration" "" { target *-*-* } 193 }
+// { dg-error "instantiated from here" "" { target *-*-* } 40 }
+// { dg-excess-errors "In instantiation of" }
diff --git a/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg2.cc b/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg2.cc
new file mode 100644
index 00000000000..783044fada6
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg2.cc
@@ -0,0 +1,46 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+// 2008-07-31 Chris Fairles <chris.fairles@gmail.com>
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <chrono>
+
+void test01()
+{
+ // Check if period is a ratio
+ typedef int rep_type;
+ typedef int period_type;
+ typedef std::chrono::duration<rep_type, period_type> test_type;
+ test_type d;
+}
+
+// { dg-error "must be a specialization of ratio" "" { target *-*-* } 194 }
+// { dg-error "instantiated from here" "" { target *-*-* } 41 }
+// { dg-excess-errors "In instantiation of" }
diff --git a/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg3.cc b/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg3.cc
new file mode 100644
index 00000000000..2896845d7d2
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg3.cc
@@ -0,0 +1,47 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+// 2008-07-31 Chris Fairles <chris.fairles@gmail.com>
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <ratio>
+#include <chrono>
+
+void test01()
+{
+ // Check if period is positive
+ typedef int rep_type;
+ typedef std::ratio<-1> period_type;
+ typedef std::chrono::duration<rep_type, period_type> test_type;
+ test_type d;
+}
+
+// { dg-error "period must be positive" "" { target *-*-* } 196 }
+// { dg-error "instantiated from here" "" { target *-*-* } 42 }
+// { dg-excess-errors "In instantiation of" }
diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/creation/36949.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/creation/36949.cc
new file mode 100644
index 00000000000..4fc7db3a610
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/shared_ptr/creation/36949.cc
@@ -0,0 +1,35 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2008 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+#include <memory>
+
+struct A : std::enable_shared_from_this<A> { };
+
+// libstdc++/36949
+void test01()
+{
+ std::make_shared<A>()->shared_from_this();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/20_util/time_point/1.cc b/libstdc++-v3/testsuite/20_util/time_point/1.cc
new file mode 100644
index 00000000000..70f4d7800eb
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/time_point/1.cc
@@ -0,0 +1,49 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+
+// Copyright (C) 2008 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// 20.8.4 Class template time_point [time.point]
+
+#include <chrono>
+#include <testsuite_hooks.h>
+
+// 20.8.4.1 time_point constructors [time.point.cons]
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std::chrono;
+
+ time_point<system_clock> t1;
+ VERIFY(t1.time_since_epoch() == system_clock::duration::zero());
+
+ time_point<monotonic_clock> t2;
+ VERIFY(t2.time_since_epoch() == monotonic_clock::duration::zero());
+
+ time_point<high_resolution_clock> t3;
+ VERIFY(t3.time_since_epoch() == high_resolution_clock::duration::zero());
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/20_util/time_point/2.cc b/libstdc++-v3/testsuite/20_util/time_point/2.cc
new file mode 100644
index 00000000000..91f21a5e0f7
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/time_point/2.cc
@@ -0,0 +1,72 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+
+// Copyright (C) 2008 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// 20.8.4 Class template time_point [time.point]
+
+#include <chrono>
+#include <testsuite_hooks.h>
+
+// 20.8.4.3 time_point arithmetic [time.point.arithmetic]
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std::chrono;
+
+ time_point<system_clock> t1, t2;
+ t1 += seconds(1);
+ VERIFY(t2.time_since_epoch() + seconds(1) == t1.time_since_epoch());
+
+ t1 -= std::chrono::seconds(1);
+ VERIFY(t2.time_since_epoch() == t1.time_since_epoch());
+}
+
+// 20.8.4.5 time_point non-member arithmetic [time.point.nonmember]
+void
+test02()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std::chrono;
+
+ time_point<system_clock> t1;
+ time_point<system_clock> t2(t1 + seconds(1));
+ VERIFY(t2.time_since_epoch() == t1.time_since_epoch() + seconds(1));
+
+ time_point<system_clock> t3(seconds(1) + t1);
+ VERIFY(t3.time_since_epoch() == t1.time_since_epoch() + seconds(1));
+
+ time_point<system_clock> t4(seconds(1));
+ time_point<system_clock> t5(seconds(2));
+
+ time_point<system_clock> t6(t5 - seconds(1));
+ VERIFY(t6.time_since_epoch() == t4.time_since_epoch());
+
+ time_point<system_clock> t7(t5 - t4);
+ VERIFY(t7.time_since_epoch() == t4.time_since_epoch());
+}
+
+int
+main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/20_util/time_point/3.cc b/libstdc++-v3/testsuite/20_util/time_point/3.cc
new file mode 100644
index 00000000000..20820cebea1
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/time_point/3.cc
@@ -0,0 +1,53 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+
+// Copyright (C) 2008 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// 20.8.4 Class template time_point [time.point]
+
+#include <chrono>
+#include <testsuite_hooks.h>
+
+// 20.8.4.6 time_point comparisons [time.point.comparisons]
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std::chrono;
+
+ time_point<system_clock> t1(seconds(1));
+ time_point<system_clock> t2(seconds(1));
+ time_point<system_clock> t3(seconds(2));
+
+ VERIFY(t1 == t2);
+ VERIFY(t1 != t3);
+ VERIFY(t1 < t3);
+ VERIFY(t1 <= t3);
+ VERIFY(t1 <= t2);
+ VERIFY(t3 > t1);
+ VERIFY(t3 >= t1);
+ VERIFY(t2 >= t1);
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/20_util/time_point/requirements/explicit_instantiation/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/time_point/requirements/explicit_instantiation/explicit_instantiation.cc
new file mode 100644
index 00000000000..7f9bbdf3d16
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/time_point/requirements/explicit_instantiation/explicit_instantiation.cc
@@ -0,0 +1,25 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+
+// Copyright (C) 2008 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301, USA.
+
+#include <chrono>
+
+template class std::chrono::time_point<std::chrono::system_clock>;
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/init-list.cc b/libstdc++-v3/testsuite/21_strings/basic_string/init-list.cc
new file mode 100644
index 00000000000..71e03f1d626
--- /dev/null
+++ b/libstdc++-v3/testsuite/21_strings/basic_string/init-list.cc
@@ -0,0 +1,81 @@
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+//
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// { dg-options "-std=gnu++0x" }
+
+#include <string>
+#include <testsuite_hooks.h>
+
+using namespace std;
+
+int test01(void)
+{
+ bool test = true;
+
+ string s1 = { 'a', 'b', 'c' };
+ VERIFY(s1 == "abc");
+
+ s1 = { 'd', 'e', 'f' };
+ VERIFY(s1 == "def");
+
+ s1 += { 'g', 'h', 'i' };
+ VERIFY(s1 == "defghi");
+
+ s1.append({ 'j', 'k', 'l' });
+ VERIFY(s1 == "defghijkl");
+
+ s1.assign({ 'm', 'n', 'o' });
+ VERIFY(s1 == "mno");
+
+ // There aren't actually overloads of insert and replace taking size_type
+ // and initializer_list, but test the usage anyway.
+ s1.insert(2, { 'p', 'q', 'r' });
+ VERIFY(s1 == "mnpqro");
+
+ s1.replace(2, 3, { 's', 't', 'u' });
+ VERIFY(s1 == "mnstuo");
+
+ string::iterator i1, i2;
+
+ i1 = s1.begin()+2;
+ s1.insert(i1, { 'v', 'w', 'x' });
+ VERIFY(s1 == "mnvwxstuo");
+
+ i1 = s1.begin()+2;
+ i2 = i1+6;
+ s1.replace(i1, i2, { 'y', 'z' });
+ VERIFY(s1 == "mnyzo");
+
+ return test;
+}
+
+int main()
+{
+ __gnu_test::set_memory_limits();
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/deque/init-list.cc b/libstdc++-v3/testsuite/23_containers/deque/init-list.cc
new file mode 100644
index 00000000000..715ff948732
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/deque/init-list.cc
@@ -0,0 +1,69 @@
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+//
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// { dg-options "-std=gnu++0x" }
+
+#include <deque>
+#include <testsuite_allocator.h>
+
+using namespace __gnu_test;
+
+int main()
+{
+ typedef std::deque<int, tracker_allocator<int> > Container;
+ const int arr10[10] = { 2, 4, 1, 7, 3, 8, 10, 5, 9, 6 };
+ bool ok = true;
+
+ tracker_allocator_counter::reset();
+ {
+ Container c({ 2, 4, 1 });
+ ok = check_construct_destroy("Construct from init-list", 3, 0) && ok;
+ ok &= (c[0] == 2);
+ ok &= (c[1] == 4);
+ }
+ ok = check_construct_destroy("Construct from init-list", 3, 3) && ok;
+
+ {
+ Container c(arr10, arr10 + 10);
+ tracker_allocator_counter::reset();
+ c.insert(c.begin() + 7, { 234, 42, 1 });
+ ok = check_construct_destroy("Insert init-list", 3, 0) && ok;
+ ok &= (c[7] == 234);
+ }
+ ok = check_construct_destroy("Insert init-list", 3, 13) && ok;
+
+ {
+ Container c;
+ tracker_allocator_counter::reset();
+ c = { 13, 0, 42 };
+ ok = check_construct_destroy("Assign init-list", 3, 0) && ok;
+ ok &= (c[0] == 13);
+ }
+ ok = check_construct_destroy("Assign init-list", 3, 3) && ok;
+
+ return ok ? 0 : 1;;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc
index 2cb464cb86c..242fc98a030 100644
--- a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc
@@ -19,7 +19,7 @@
// USA.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1436 }
+// { dg-error "no matching" "" { target *-*-* } 1504 }
// { dg-excess-errors "" }
#include <deque>
diff --git a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc
index 57c865f34c0..2664aac468d 100644
--- a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc
@@ -19,7 +19,7 @@
// USA.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1375 }
+// { dg-error "no matching" "" { target *-*-* } 1443 }
// { dg-excess-errors "" }
#include <deque>
diff --git a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc
index a46674c52dc..66b76b79a49 100644
--- a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc
@@ -19,7 +19,7 @@
// USA.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1375 }
+// { dg-error "no matching" "" { target *-*-* } 1443 }
// { dg-excess-errors "" }
#include <deque>
diff --git a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc
index 3ae748ca316..cff5332deb5 100644
--- a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc
@@ -19,7 +19,7 @@
// USA.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1520 }
+// { dg-error "no matching" "" { target *-*-* } 1588 }
// { dg-excess-errors "" }
#include <deque>
diff --git a/libstdc++-v3/testsuite/23_containers/list/init-list.cc b/libstdc++-v3/testsuite/23_containers/list/init-list.cc
new file mode 100644
index 00000000000..0dd5ac919cd
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/init-list.cc
@@ -0,0 +1,74 @@
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+//
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// { dg-options "-std=gnu++0x" }
+
+#include <list>
+#include <testsuite_allocator.h>
+
+using namespace __gnu_test;
+
+int main()
+{
+ typedef std::list<int, tracker_allocator<int> > Container;
+ const int arr10[10] = { 2, 4, 1, 7, 3, 8, 10, 5, 9, 6 };
+ bool ok = true;
+
+ tracker_allocator_counter::reset();
+ {
+ Container c({ 2, 4, 1 });
+ ok = check_construct_destroy("Construct from init-list", 3, 0) && ok;
+ Container::iterator i = c.begin();
+ ok &= (*i++ == 2);
+ ok &= (*i++ == 4);
+ }
+ ok = check_construct_destroy("Construct from init-list", 3, 3) && ok;
+
+ {
+ Container c(arr10, arr10 + 10);
+ tracker_allocator_counter::reset();
+ Container::iterator i = c.begin();
+ ++i; ++i; ++i; ++i; ++i; ++i; ++i;
+ c.insert(i, { 234, 42, 1 });
+ ok = check_construct_destroy("Insert init-list", 3, 0) && ok;
+ ok &= (*--i == 1);
+ ok &= (*--i == 42);
+ }
+ ok = check_construct_destroy("Insert init-list", 3, 13) && ok;
+
+ {
+ Container c;
+ tracker_allocator_counter::reset();
+ c = { 13, 0, 42 };
+ ok = check_construct_destroy("Assign init-list", 3, 0) && ok;
+ Container::iterator i = c.begin();
+ ok &= (*i++ == 13);
+ }
+ ok = check_construct_destroy("Assign init-list", 3, 3) && ok;
+
+ return ok ? 0 : 1;;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc
index 8eeff630927..23c541a8d29 100644
--- a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc
@@ -19,7 +19,7 @@
// USA.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1325 }
+// { dg-error "no matching" "" { target *-*-* } 1383 }
// { dg-excess-errors "" }
#include <list>
diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc
index 06b71622421..479c416590f 100644
--- a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc
@@ -19,7 +19,7 @@
// USA.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1294 }
+// { dg-error "no matching" "" { target *-*-* } 1352 }
// { dg-excess-errors "" }
#include <list>
diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc
index bfe871077d7..3fd79856a5e 100644
--- a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc
@@ -19,7 +19,7 @@
// USA.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1294 }
+// { dg-error "no matching" "" { target *-*-* } 1352 }
// { dg-excess-errors "" }
#include <list>
diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc
index d75ed067e24..9b5e13a6e25 100644
--- a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc
@@ -19,7 +19,7 @@
// USA.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1294 }
+// { dg-error "no matching" "" { target *-*-* } 1352 }
// { dg-excess-errors "" }
#include <list>
diff --git a/libstdc++-v3/testsuite/23_containers/map/init-list.cc b/libstdc++-v3/testsuite/23_containers/map/init-list.cc
new file mode 100644
index 00000000000..637303e1ac9
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/map/init-list.cc
@@ -0,0 +1,63 @@
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+//
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// { dg-options "-std=gnu++0x" }
+
+#include <map>
+#include <testsuite_hooks.h>
+
+using namespace std;
+
+int test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ map<int,double> m({ { 1, 1.0 }, { 2, 2.0 }, { 42, 237.0 } });
+ VERIFY(m.size() == 3);
+ VERIFY(m[1] == 1.0);
+ VERIFY(m[2] == 2.0);
+ VERIFY(m[42] == 237.0);
+
+ m = { {5, 55.0}, { 6, 66.0 } };
+ VERIFY(m.size() == 2);
+ VERIFY(m[5] == 55.0);
+ VERIFY(m[6] == 66.0);
+
+ m.insert({ { 7, 77.0 }, { 8, 88.0 } });
+ VERIFY(m.size() == 4);
+ VERIFY(m[5] == 55.0);
+ VERIFY(m[6] == 66.0);
+ VERIFY(m[7] == 77.0);
+ VERIFY(m[8] == 88.0);
+ return test;
+}
+
+int main()
+{
+ __gnu_test::set_memory_limits();
+ test01();
+}
diff --git a/libstdc++-v3/testsuite/23_containers/multimap/init-list.cc b/libstdc++-v3/testsuite/23_containers/multimap/init-list.cc
new file mode 100644
index 00000000000..6043cc17905
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/multimap/init-list.cc
@@ -0,0 +1,72 @@
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+//
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// { dg-options "-std=gnu++0x" }
+
+#include <map>
+#include <testsuite_hooks.h>
+
+using namespace std;
+
+int test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef multimap<int,double> Container;
+ typedef Container::iterator iterator;
+ typedef pair<iterator,iterator> itpair;
+ Container m({ { 1, 1.0 }, { 1, 2.0 }, { 1, 237.0 } });
+ VERIFY(m.size() == 3);
+ itpair ip = m.equal_range(1);
+ VERIFY(distance(ip.first, ip.second) == 3);
+ iterator i = ip.first;
+ VERIFY((*i++).second == 1.0);
+ VERIFY((*i++).second == 2.0);
+ VERIFY((*i++).second == 237.0);
+
+ m = { {5, 55.0}, { 5, 66.0 }, { 42, 4242.0 } };
+ VERIFY(m.size() == 3);
+ ip = m.equal_range(5);
+ VERIFY(distance(ip.first, ip.second) == 2);
+ i = ip.first;
+ VERIFY((*i++).second == 55.0);
+ VERIFY((*i++).second == 66.0);
+
+ m.insert({ { 7, 77.0 }, { 7, 88.0 } });
+ VERIFY(m.size() == 5);
+ VERIFY(m.count(5) == 2);
+ VERIFY(m.count(42) == 1);
+ VERIFY(m.count(7) == 2);
+
+ return test;
+}
+
+int main()
+{
+ __gnu_test::set_memory_limits();
+ test01();
+}
diff --git a/libstdc++-v3/testsuite/23_containers/multiset/init-list.cc b/libstdc++-v3/testsuite/23_containers/multiset/init-list.cc
new file mode 100644
index 00000000000..9b34f227286
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/multiset/init-list.cc
@@ -0,0 +1,68 @@
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+//
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// { dg-options "-std=gnu++0x" }
+
+#include <set>
+#include <testsuite_hooks.h>
+
+using namespace std;
+
+int test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ multiset<int> m({ 1, 5, 5, 37 });
+ VERIFY(m.size() == 4);
+ VERIFY(m.count(1) == 1);
+ VERIFY(m.count(5) == 2);
+ VERIFY(m.count(37) == 1);
+ VERIFY(m.count(42) == 0);
+
+ m = { 28, 37, 37, 37, 102 };
+ VERIFY(m.size() == 5);
+ VERIFY(m.count(28) == 1);
+ VERIFY(m.count(37) == 3);
+ VERIFY(m.count(102) == 1);
+ VERIFY(m.count(1) == 0);
+
+ m.insert({ 42, 42 });
+ VERIFY(m.size() == 7);
+ VERIFY(m.count(28) == 1);
+ VERIFY(m.count(37) == 3);
+ VERIFY(m.count(102) == 1);
+ VERIFY(m.count(42) == 2);
+ VERIFY(m.count(1) == 0);
+
+ return test;
+}
+
+int main()
+{
+ __gnu_test::set_memory_limits();
+ test01();
+}
diff --git a/libstdc++-v3/testsuite/23_containers/set/init-list.cc b/libstdc++-v3/testsuite/23_containers/set/init-list.cc
new file mode 100644
index 00000000000..256ecb38aba
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/init-list.cc
@@ -0,0 +1,68 @@
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+//
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// { dg-options "-std=gnu++0x" }
+
+#include <set>
+#include <testsuite_hooks.h>
+
+using namespace std;
+
+int test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ set<int> m({ 1, 5, 37 });
+ VERIFY(m.size() == 3);
+ VERIFY(m.count(1) == 1);
+ VERIFY(m.count(5) == 1);
+ VERIFY(m.count(37) == 1);
+ VERIFY(m.count(42) == 0);
+
+ m = { 28, 37, 102 };
+ VERIFY(m.size() == 3);
+ VERIFY(m.count(28) == 1);
+ VERIFY(m.count(37) == 1);
+ VERIFY(m.count(102) == 1);
+ VERIFY(m.count(1) == 0);
+
+ m.insert({ 42 });
+ VERIFY(m.size() == 4);
+ VERIFY(m.count(28) == 1);
+ VERIFY(m.count(37) == 1);
+ VERIFY(m.count(102) == 1);
+ VERIFY(m.count(42) == 1);
+ VERIFY(m.count(1) == 0);
+
+ return test;
+}
+
+int main()
+{
+ __gnu_test::set_memory_limits();
+ test01();
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/init-list.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/init-list.cc
new file mode 100644
index 00000000000..983bf2da3b7
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/init-list.cc
@@ -0,0 +1,63 @@
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+//
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// { dg-options "-std=gnu++0x" }
+
+#include <unordered_map>
+#include <testsuite_hooks.h>
+
+using namespace std;
+
+int test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ unordered_map<int,double> m({ { 1, 1.0 }, { 2, 2.0 }, { 42, 237.0 } });
+ VERIFY(m.size() == 3);
+ VERIFY(m[1] == 1.0);
+ VERIFY(m[2] == 2.0);
+ VERIFY(m[42] == 237.0);
+
+ m = { {5, 55.0}, { 6, 66.0 } };
+ VERIFY(m.size() == 2);
+ VERIFY(m[5] == 55.0);
+ VERIFY(m[6] == 66.0);
+
+ m.insert({ { 7, 77.0 }, { 8, 88.0 } });
+ VERIFY(m.size() == 4);
+ VERIFY(m[5] == 55.0);
+ VERIFY(m[6] == 66.0);
+ VERIFY(m[7] == 77.0);
+ VERIFY(m[8] == 88.0);
+ return test;
+}
+
+int main()
+{
+ __gnu_test::set_memory_limits();
+ test01();
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/init-list.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/init-list.cc
new file mode 100644
index 00000000000..ba35b38d85b
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/init-list.cc
@@ -0,0 +1,77 @@
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+//
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// { dg-options "-std=gnu++0x" }
+// XFAIL this test until debug mode container is fixed.
+// { dg-excess-errors "" }
+
+#include <set>
+#include <unordered_map>
+#include <testsuite_hooks.h>
+
+using namespace std;
+
+int test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef unordered_multimap<int,double> Container;
+ typedef Container::const_iterator iterator;
+ typedef pair<iterator,iterator> itpair;
+
+ Container m({ { 1, 1.0 }, { 1, 2.0 }, { 1, 237.0 } });
+ VERIFY(m.size() == 3);
+ itpair ip = m.equal_range(1);
+ VERIFY(distance(ip.first, ip.second) == 3);
+ set<double> s = { 1.0, 2.0, 237.0 };
+ for (iterator i = ip.first; i != ip.second; ++i)
+ s.erase (i->second);
+ VERIFY(s.empty());
+
+ m = { {5, 55.0}, { 5, 66.0 }, { 42, 4242.0 } };
+ VERIFY(m.size() == 3);
+ ip = m.equal_range(5);
+ VERIFY(distance(ip.first, ip.second) == 2);
+ s = { 55.0, 66.0 };
+ for (iterator i = ip.first; i != ip.second; ++i)
+ s.erase (i->second);
+ VERIFY(s.empty());
+
+ m.insert({ { 7, 77.0 }, { 7, 88.0 } });
+ VERIFY(m.size() == 5);
+ VERIFY(m.count(5) == 2);
+ VERIFY(m.count(42) == 1);
+ VERIFY(m.count(7) == 2);
+
+ return test;
+}
+
+int main()
+{
+ __gnu_test::set_memory_limits();
+ test01();
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/init-list.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/init-list.cc
new file mode 100644
index 00000000000..22d9a49b59f
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/init-list.cc
@@ -0,0 +1,68 @@
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+//
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// { dg-options "-std=gnu++0x" }
+
+#include <unordered_set>
+#include <testsuite_hooks.h>
+
+using namespace std;
+
+int test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ unordered_multiset<int> m({ 1, 5, 5, 37 });
+ VERIFY(m.size() == 4);
+ VERIFY(m.count(1) == 1);
+ VERIFY(m.count(5) == 2);
+ VERIFY(m.count(37) == 1);
+ VERIFY(m.count(42) == 0);
+
+ m = { 28, 37, 37, 37, 102 };
+ VERIFY(m.size() == 5);
+ VERIFY(m.count(28) == 1);
+ VERIFY(m.count(37) == 3);
+ VERIFY(m.count(102) == 1);
+ VERIFY(m.count(1) == 0);
+
+ m.insert({ 42, 42 });
+ VERIFY(m.size() == 7);
+ VERIFY(m.count(28) == 1);
+ VERIFY(m.count(37) == 3);
+ VERIFY(m.count(102) == 1);
+ VERIFY(m.count(42) == 2);
+ VERIFY(m.count(1) == 0);
+
+ return test;
+}
+
+int main()
+{
+ __gnu_test::set_memory_limits();
+ test01();
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/init-list.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/init-list.cc
new file mode 100644
index 00000000000..8a4b05deebd
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_set/init-list.cc
@@ -0,0 +1,68 @@
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+//
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// { dg-options "-std=gnu++0x" }
+
+#include <unordered_set>
+#include <testsuite_hooks.h>
+
+using namespace std;
+
+int test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ unordered_set<int> m({ 1, 5, 37 });
+ VERIFY(m.size() == 3);
+ VERIFY(m.count(1) == 1);
+ VERIFY(m.count(5) == 1);
+ VERIFY(m.count(37) == 1);
+ VERIFY(m.count(42) == 0);
+
+ m = { 28, 37, 102 };
+ VERIFY(m.size() == 3);
+ VERIFY(m.count(28) == 1);
+ VERIFY(m.count(37) == 1);
+ VERIFY(m.count(102) == 1);
+ VERIFY(m.count(1) == 0);
+
+ m.insert({ 42 });
+ VERIFY(m.size() == 4);
+ VERIFY(m.count(28) == 1);
+ VERIFY(m.count(37) == 1);
+ VERIFY(m.count(102) == 1);
+ VERIFY(m.count(42) == 1);
+ VERIFY(m.count(1) == 0);
+
+ return test;
+}
+
+int main()
+{
+ __gnu_test::set_memory_limits();
+ test01();
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/init-list.cc b/libstdc++-v3/testsuite/23_containers/vector/init-list.cc
new file mode 100644
index 00000000000..9a3b52c27da
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/init-list.cc
@@ -0,0 +1,69 @@
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+//
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// { dg-options "-std=gnu++0x" }
+
+#include <vector>
+#include <testsuite_allocator.h>
+
+using namespace __gnu_test;
+
+int main()
+{
+ typedef std::vector<int, tracker_allocator<int> > Container;
+ const int arr10[10] = { 2, 4, 1, 7, 3, 8, 10, 5, 9, 6 };
+ bool ok = true;
+
+ tracker_allocator_counter::reset();
+ {
+ Container c({ 2, 4, 1 });
+ ok = check_construct_destroy("Construct from init-list", 3, 0) && ok;
+ ok &= (c[0] == 2);
+ ok &= (c[1] == 4);
+ }
+ ok = check_construct_destroy("Construct from init-list", 3, 3) && ok;
+
+ {
+ Container c(arr10, arr10 + 10);
+ tracker_allocator_counter::reset();
+ c.insert(c.begin() + 7, { 234, 42, 1 });
+ ok = check_construct_destroy("Insert init-list", 13, 10) && ok;
+ ok &= (c[7] == 234);
+ }
+ ok = check_construct_destroy("Insert init-list", 13, 23) && ok;
+
+ {
+ Container c;
+ tracker_allocator_counter::reset();
+ c = { 13, 0, 42 };
+ ok = check_construct_destroy("Assign init-list", 3, 0) && ok;
+ ok &= (c[0] == 13);
+ }
+ ok = check_construct_destroy("Assign init-list", 3, 3) && ok;
+
+ return ok ? 0 : 1;;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc
index 64c6a98dfb5..c5e445fa6db 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc
@@ -19,7 +19,7 @@
// USA.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 986 }
+// { dg-error "no matching" "" { target *-*-* } 1058 }
// { dg-excess-errors "" }
#include <vector>
diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc
index 34e602da583..dd115afd520 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc
@@ -19,7 +19,7 @@
// USA.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 926 }
+// { dg-error "no matching" "" { target *-*-* } 998 }
// { dg-excess-errors "" }
#include <vector>
diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc
index f1af46c43a2..50e51cb8f3f 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc
@@ -19,7 +19,7 @@
// USA.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 926 }
+// { dg-error "no matching" "" { target *-*-* } 998 }
// { dg-excess-errors "" }
#include <vector>
diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc
index a95f57857d8..31642d75c5d 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc
@@ -19,7 +19,7 @@
// USA.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1027 }
+// { dg-error "no matching" "" { target *-*-* } 1099 }
// { dg-excess-errors "" }
#include <vector>
diff --git a/libstdc++-v3/testsuite/25_algorithms/heap/1.cc b/libstdc++-v3/testsuite/25_algorithms/heap/1.cc
index 571a2936ed2..4032ca82e32 100644
--- a/libstdc++-v3/testsuite/25_algorithms/heap/1.cc
+++ b/libstdc++-v3/testsuite/25_algorithms/heap/1.cc
@@ -89,8 +89,10 @@ test02()
Gt gt;
+#ifndef _GLIBCXX_DEBUG
//const int logN = static_cast<int>(std::log(static_cast<double>(N)) + 0.5);
const int logN = 3;
+#endif
int s1[N];
std::copy(A, A + N, s1);
diff --git a/libstdc++-v3/testsuite/26_numerics/valarray/init-list.cc b/libstdc++-v3/testsuite/26_numerics/valarray/init-list.cc
new file mode 100644
index 00000000000..3f4ed5bab3a
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/valarray/init-list.cc
@@ -0,0 +1,58 @@
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+//
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// { dg-options "-std=gnu++0x" }
+
+#include <valarray>
+#include <testsuite_hooks.h>
+
+using namespace std;
+
+int test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ valarray<int> m({ 1, 5, 37 });
+ VERIFY(m.size() == 3);
+ VERIFY(m[0] == 1);
+ VERIFY(m[1] == 5);
+ VERIFY(m[2] == 37);
+
+ m = { 28, 37, 102 };
+ VERIFY(m.size() == 3);
+ VERIFY(m[0] == 28);
+ VERIFY(m[1] == 37);
+ VERIFY(m[2] == 102);
+
+ return test;
+}
+
+int main()
+{
+ __gnu_test::set_memory_limits();
+ test01();
+}
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/cons/assign_neg.cc b/libstdc++-v3/testsuite/27_io/ios_base/cons/assign_neg.cc
index 5325523a0cc..7df9d463343 100644
--- a/libstdc++-v3/testsuite/27_io/ios_base/cons/assign_neg.cc
+++ b/libstdc++-v3/testsuite/27_io/ios_base/cons/assign_neg.cc
@@ -43,5 +43,5 @@ void test01()
}
// { dg-error "synthesized" "" { target *-*-* } 42 }
// { dg-error "within this context" "" { target *-*-* } 35 }
-// { dg-error "is private" "" { target *-*-* } 786 }
+// { dg-error "is private" "" { target *-*-* } 794 }
// { dg-error "operator=" "" { target *-*-* } 0 }
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/cons/copy_neg.cc b/libstdc++-v3/testsuite/27_io/ios_base/cons/copy_neg.cc
index 536682eb6f3..8f17ac6b884 100644
--- a/libstdc++-v3/testsuite/27_io/ios_base/cons/copy_neg.cc
+++ b/libstdc++-v3/testsuite/27_io/ios_base/cons/copy_neg.cc
@@ -43,5 +43,5 @@ void test02()
}
// { dg-error "within this context" "" { target *-*-* } 36 }
// { dg-error "synthesized" "" { target *-*-* } 42 }
-// { dg-error "is private" "" { target *-*-* } 783 }
+// { dg-error "is private" "" { target *-*-* } 791 }
// { dg-error "copy constructor" "" { target *-*-* } 0 }
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/failure/cons_virtual_derivation.cc b/libstdc++-v3/testsuite/27_io/ios_base/failure/cons_virtual_derivation.cc
index 1819726a37b..87bf982407f 100644
--- a/libstdc++-v3/testsuite/27_io/ios_base/failure/cons_virtual_derivation.cc
+++ b/libstdc++-v3/testsuite/27_io/ios_base/failure/cons_virtual_derivation.cc
@@ -1,7 +1,6 @@
-// { dg-do run { xfail *-*-* } }
// 2007-05-29 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2007 Free Software Foundation, Inc.
+// Copyright (C) 2007, 2008 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
diff --git a/libstdc++-v3/testsuite/28_regex/init-list.cc b/libstdc++-v3/testsuite/28_regex/init-list.cc
new file mode 100644
index 00000000000..6852507ee0e
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/init-list.cc
@@ -0,0 +1,58 @@
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+//
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// { dg-options "-std=gnu++0x" }
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+using namespace std;
+
+int test01(void)
+{
+ bool test = true;
+
+ regex r = { 'a', 'b', 'c' };
+ cmatch res;
+ // Enable when regex class actually implemented.
+ // VERIFY(regex_match ("abc", res, r));
+ VERIFY(!regex_match ("ab", res, r));
+
+ r = { 'd', 'e', 'f' };
+ // Enable when regex class actually implemented.
+ // VERIFY(regex_match ("def", res, r));
+ VERIFY(!regex_match ("abc", res, r));
+
+ return test;
+}
+
+int main()
+{
+ __gnu_test::set_memory_limits();
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/30_threads/mutex/cons/assign_neg.cc b/libstdc++-v3/testsuite/30_threads/mutex/cons/assign_neg.cc
index f365d1167c1..8c66bb53cd7 100644
--- a/libstdc++-v3/testsuite/30_threads/mutex/cons/assign_neg.cc
+++ b/libstdc++-v3/testsuite/30_threads/mutex/cons/assign_neg.cc
@@ -39,4 +39,4 @@ void test01()
m1 = m2;
}
// { dg-error "within this context" "" { target *-*-* } 39 }
-// { dg-error "is private" "" { target *-*-* } 102 }
+// { dg-error "is private" "" { target *-*-* } 108 }
diff --git a/libstdc++-v3/testsuite/30_threads/mutex/cons/copy_neg.cc b/libstdc++-v3/testsuite/30_threads/mutex/cons/copy_neg.cc
index d0a91025b54..666506a36b1 100644
--- a/libstdc++-v3/testsuite/30_threads/mutex/cons/copy_neg.cc
+++ b/libstdc++-v3/testsuite/30_threads/mutex/cons/copy_neg.cc
@@ -38,4 +38,4 @@ void test01()
mutex_type m2(m1);
}
// { dg-error "within this context" "" { target *-*-* } 38 }
-// { dg-error "is private" "" { target *-*-* } 101 }
+// { dg-error "is private" "" { target *-*-* } 107 }
diff --git a/libstdc++-v3/testsuite/30_threads/recursive_mutex/cons/assign_neg.cc b/libstdc++-v3/testsuite/30_threads/recursive_mutex/cons/assign_neg.cc
index ca399742287..b7e27847667 100644
--- a/libstdc++-v3/testsuite/30_threads/recursive_mutex/cons/assign_neg.cc
+++ b/libstdc++-v3/testsuite/30_threads/recursive_mutex/cons/assign_neg.cc
@@ -39,4 +39,4 @@ void test01()
m1 = m2;
}
// { dg-error "within this context" "" { target *-*-* } 39 }
-// { dg-error "is private" "" { target *-*-* } 155 }
+// { dg-error "is private" "" { target *-*-* } 160 }
diff --git a/libstdc++-v3/testsuite/30_threads/recursive_mutex/cons/copy_neg.cc b/libstdc++-v3/testsuite/30_threads/recursive_mutex/cons/copy_neg.cc
index 7f530c36e38..2d20cb98c3d 100644
--- a/libstdc++-v3/testsuite/30_threads/recursive_mutex/cons/copy_neg.cc
+++ b/libstdc++-v3/testsuite/30_threads/recursive_mutex/cons/copy_neg.cc
@@ -38,4 +38,4 @@ void test01()
mutex_type m2(m1);
}
// { dg-error "within this context" "" { target *-*-* } 38 }
-// { dg-error "is private" "" { target *-*-* } 154 }
+// { dg-error "is private" "" { target *-*-* } 159 }
diff --git a/libstdc++-v3/testsuite/Makefile.in b/libstdc++-v3/testsuite/Makefile.in
index 468700e8f04..dc4d641ee7a 100644
--- a/libstdc++-v3/testsuite/Makefile.in
+++ b/libstdc++-v3/testsuite/Makefile.in
@@ -152,6 +152,7 @@ GLIBCXX_HOSTED_TRUE = @GLIBCXX_HOSTED_TRUE@
GLIBCXX_INCLUDES = @GLIBCXX_INCLUDES@
GLIBCXX_LDBL_COMPAT_FALSE = @GLIBCXX_LDBL_COMPAT_FALSE@
GLIBCXX_LDBL_COMPAT_TRUE = @GLIBCXX_LDBL_COMPAT_TRUE@
+GLIBCXX_LIBS = @GLIBCXX_LIBS@
GREP = @GREP@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
diff --git a/libstdc++-v3/testsuite/ext/concurrence_lock_error/cons_virtual_derivation.cc b/libstdc++-v3/testsuite/ext/concurrence_lock_error/cons_virtual_derivation.cc
index 07396b0b219..35602c71272 100644
--- a/libstdc++-v3/testsuite/ext/concurrence_lock_error/cons_virtual_derivation.cc
+++ b/libstdc++-v3/testsuite/ext/concurrence_lock_error/cons_virtual_derivation.cc
@@ -1,7 +1,6 @@
-// { dg-do run { xfail *-*-* } }
// 2007-05-29 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2007 Free Software Foundation, Inc.
+// Copyright (C) 2007, 2008 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
diff --git a/libstdc++-v3/testsuite/ext/concurrence_unlock_error/cons_virtual_derivation.cc b/libstdc++-v3/testsuite/ext/concurrence_unlock_error/cons_virtual_derivation.cc
index ddc2c46b8ed..d6e4e8b1b22 100644
--- a/libstdc++-v3/testsuite/ext/concurrence_unlock_error/cons_virtual_derivation.cc
+++ b/libstdc++-v3/testsuite/ext/concurrence_unlock_error/cons_virtual_derivation.cc
@@ -1,7 +1,6 @@
-// { dg-do run { xfail *-*-* } }
// 2007-05-29 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2007 Free Software Foundation, Inc.
+// Copyright (C) 2007, 2008 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
diff --git a/libstdc++-v3/testsuite/ext/forced_exception_error/cons_virtual_derivation.cc b/libstdc++-v3/testsuite/ext/forced_exception_error/cons_virtual_derivation.cc
index ae6ef0bd623..81b5214812f 100644
--- a/libstdc++-v3/testsuite/ext/forced_exception_error/cons_virtual_derivation.cc
+++ b/libstdc++-v3/testsuite/ext/forced_exception_error/cons_virtual_derivation.cc
@@ -1,7 +1,6 @@
-// { dg-do run { xfail *-*-* } }
// 2007-05-29 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2007 Free Software Foundation, Inc.
+// Copyright (C) 2007, 2008 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
diff --git a/libstdc++-v3/testsuite/ext/vstring/init-list.cc b/libstdc++-v3/testsuite/ext/vstring/init-list.cc
new file mode 100644
index 00000000000..27da6828193
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/vstring/init-list.cc
@@ -0,0 +1,79 @@
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+//
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// { dg-options "-std=gnu++0x" }
+
+#include <ext/vstring.h>
+#include <testsuite_hooks.h>
+
+int test01(void)
+{
+ bool test = true;
+
+ __gnu_cxx::__vstring s1 = { 'a', 'b', 'c' };
+ VERIFY(s1 == "abc");
+
+ s1 = { 'd', 'e', 'f' };
+ VERIFY(s1 == "def");
+
+ s1 += { 'g', 'h', 'i' };
+ VERIFY(s1 == "defghi");
+
+ s1.append({ 'j', 'k', 'l' });
+ VERIFY(s1 == "defghijkl");
+
+ s1.assign({ 'm', 'n', 'o' });
+ VERIFY(s1 == "mno");
+
+ // There aren't actually overloads of insert and replace taking size_type
+ // and initializer_list, but test the usage anyway.
+ s1.insert(2, { 'p', 'q', 'r' });
+ VERIFY(s1 == "mnpqro");
+
+ s1.replace(2, 3, { 's', 't', 'u' });
+ VERIFY(s1 == "mnstuo");
+
+ __gnu_cxx::__vstring::iterator i1, i2;
+
+ i1 = s1.begin()+2;
+ s1.insert(i1, { 'v', 'w', 'x' });
+ VERIFY(s1 == "mnvwxstuo");
+
+ i1 = s1.begin()+2;
+ i2 = i1+6;
+ s1.replace(i1, i2, { 'y', 'z' });
+ VERIFY(s1 == "mnyzo");
+
+ return test;
+}
+
+int main()
+{
+ __gnu_test::set_memory_limits();
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp b/libstdc++-v3/testsuite/lib/libstdc++.exp
index d8c168defac..9412ce976ad 100644
--- a/libstdc++-v3/testsuite/lib/libstdc++.exp
+++ b/libstdc++-v3/testsuite/lib/libstdc++.exp
@@ -81,7 +81,7 @@ proc v3-copy-files {srcfiles} {
# Called once, during runtest.exp setup.
proc libstdc++_init { testfile } {
global env
- global v3-sharedlib
+ global v3-sharedlib v3-libgomp
global srcdir blddir objdir tool_root_dir
global cc cxx cxxflags cxxpchflags cxxldflags
global includes
@@ -135,10 +135,13 @@ proc libstdc++_init { testfile } {
v3track gccdir 3
# Locate libgomp. This is only required for parallel mode.
+ set v3-libgomp 0
set libgompdir [lookfor_file $blddir/../libgomp .libs/libgomp.so]
if {$libgompdir != ""} {
+ set v3-libgomp 1
set libgompdir [file dirname $libgompdir]
append ld_library_path_tmp ":${libgompdir}"
+ verbose -log "libgomp support detected"
}
v3track libgompdir 3
@@ -687,7 +690,7 @@ proc check_v3_target_c_std { } {
puts $f " int i = std::tr1::isnan(f);"
puts $f " "
puts $f " using std::wctomb;"
- puts $f " return 0;"
+ puts $f " return i;"
puts $f "}"
close $f
@@ -968,7 +971,7 @@ proc check_v3_target_debug_mode { } {
proc check_v3_target_parallel_mode { } {
global cxxflags
- global DEFAULT_CXXFLAGS
+ global v3-libgomp
global et_parallel_mode
global tool
@@ -993,29 +996,9 @@ proc check_v3_target_parallel_mode { } {
} else {
set et_parallel_mode 0
- # Set up and compile a C++ test program that depends
- # on parallel mode working.
- set src parallel_mode[pid].cc
- set exe parallel_mode[pid].exe
-
- set f [open $src "w"]
- puts $f "#include <omp.h>"
- puts $f "int main()"
- puts $f "{ return 0; }"
- close $f
-
- set cxxflags_saved $cxxflags
- set cxxflags "$cxxflags $DEFAULT_CXXFLAGS -Werror"
-
- set lines [v3_target_compile $src $exe executable ""]
- set cxxflags $cxxflags_saved
- file delete $src
-
- if [string match "" $lines] {
- # No error message, compilation succeeded.
+ # If 'make check-parallel' is running the test succeeds.
+ if { ${v3-libgomp} == 1 && [regexp "libgomp" $cxxflags] } {
set et_parallel_mode 1
- } else {
- verbose "check_v3_target_parallel_mode: compilation failed" 2
}
}
verbose "check_v3_target_parallel_mode: $et_parallel_mode" 2
@@ -1055,7 +1038,7 @@ proc check_v3_target_cstdint { } {
set exe cstdint[pid].exe
set f [open $src "w"]
- puts $f "#include <cstdint>"
+ puts $f "#include <tr1/cstdint>"
puts $f "int main()"
puts $f "#ifdef _GLIBCXX_USE_C99_STDINT_TR1"
puts $f "{ return 0; }"
@@ -1063,7 +1046,7 @@ proc check_v3_target_cstdint { } {
close $f
set cxxflags_saved $cxxflags
- set cxxflags "$cxxflags $DEFAULT_CXXFLAGS -std=gnu++0x -Werror"
+ set cxxflags "$cxxflags $DEFAULT_CXXFLAGS -Werror"
set lines [v3_target_compile $src $exe executable ""]
set cxxflags $cxxflags_saved
diff --git a/libstdc++-v3/testsuite/tr1/7_regular_expressions/regex_traits/char/value.cc b/libstdc++-v3/testsuite/tr1/7_regular_expressions/regex_traits/char/value.cc
new file mode 100644
index 00000000000..a203253e670
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/7_regular_expressions/regex_traits/char/value.cc
@@ -0,0 +1,49 @@
+// { dg-do run }
+
+// 2008-08-11 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// tr1 [7.7] class template regex_traits value() function
+
+#include <tr1/regex>
+#include <testsuite_hooks.h>
+
+// Tests the value() function of the regex_traits<char> class.
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ std::tr1::regex_traits<char> t;
+ VERIFY( t.value('7', 8) == 7 );
+ VERIFY( t.value('7', 10) == 7 );
+ VERIFY( t.value('7', 16) == 7 );
+ VERIFY( t.value('9', 8) == -1 );
+ VERIFY( t.value('9', 10) == 9 );
+ VERIFY( t.value('9', 16) == 9 );
+ VERIFY( t.value('d', 8) == -1 );
+ VERIFY( t.value('d', 10) == -1 );
+ VERIFY( t.value('d', 16) == 13 );
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+};
diff --git a/libstdc++-v3/testsuite/tr1/7_regular_expressions/regex_traits/wchar_t/value.cc b/libstdc++-v3/testsuite/tr1/7_regular_expressions/regex_traits/wchar_t/value.cc
new file mode 100644
index 00000000000..a203253e670
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/7_regular_expressions/regex_traits/wchar_t/value.cc
@@ -0,0 +1,49 @@
+// { dg-do run }
+
+// 2008-08-11 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// tr1 [7.7] class template regex_traits value() function
+
+#include <tr1/regex>
+#include <testsuite_hooks.h>
+
+// Tests the value() function of the regex_traits<char> class.
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ std::tr1::regex_traits<char> t;
+ VERIFY( t.value('7', 8) == 7 );
+ VERIFY( t.value('7', 10) == 7 );
+ VERIFY( t.value('7', 16) == 7 );
+ VERIFY( t.value('9', 8) == -1 );
+ VERIFY( t.value('9', 10) == 9 );
+ VERIFY( t.value('9', 16) == 9 );
+ VERIFY( t.value('d', 8) == -1 );
+ VERIFY( t.value('d', 10) == -1 );
+ VERIFY( t.value('d', 16) == 13 );
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+};
diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdint/types_std_tr1.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdint/types_std_tr1.cc
index d7159739803..3826713f753 100644
--- a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdint/types_std_tr1.cc
+++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdint/types_std_tr1.cc
@@ -1,8 +1,9 @@
// { dg-do compile }
+// { dg-require-cstdint "" }
// 2006-01-29 Paolo Carlini <pcarlini@suse.de>
//
-// Copyright (C) 2006 Free Software Foundation, Inc.
+// Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -26,8 +27,6 @@
void test01()
{
-#if _GLIBCXX_USE_C99_STDINT_TR1
-
typedef std::tr1::int8_t my_int8_t;
typedef std::tr1::int16_t my_int16_t;
typedef std::tr1::int32_t my_int32_t;
@@ -56,6 +55,4 @@ void test01()
typedef std::tr1::uint_least64_t my_uint_least64_t;
typedef std::tr1::uintmax_t my_uintmax_t;
typedef std::tr1::uintptr_t my_uintptr_t;
-
-#endif
}
diff --git a/libstdc++-v3/testsuite/util/testsuite_abi.cc b/libstdc++-v3/testsuite/util/testsuite_abi.cc
index 6466fbabcd8..c15b8b24447 100644
--- a/libstdc++-v3/testsuite/util/testsuite_abi.cc
+++ b/libstdc++-v3/testsuite/util/testsuite_abi.cc
@@ -199,6 +199,7 @@ check_version(symbol& test, bool added)
known_versions.push_back("CXXABI_1.3");
known_versions.push_back("CXXABI_1.3.1");
known_versions.push_back("CXXABI_1.3.2");
+ known_versions.push_back("CXXABI_1.3.3");
known_versions.push_back("CXXABI_LDBL_1.3");
}
compat_list::iterator begin = known_versions.begin();
diff --git a/libstdc++-v3/testsuite/util/testsuite_api.h b/libstdc++-v3/testsuite/util/testsuite_api.h
index cbb606c42a8..74b25d2d950 100644
--- a/libstdc++-v3/testsuite/util/testsuite_api.h
+++ b/libstdc++-v3/testsuite/util/testsuite_api.h
@@ -1,7 +1,7 @@
// -*- C++ -*-
// Exception testing utils for the C++ library testsuite.
//
-// Copyright (C) 2007 Free Software Foundation, Inc.
+// Copyright (C) 2007, 2008 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -47,16 +47,19 @@ namespace __gnu_test
template<typename Exception>
struct diamond_derivation_base<Exception, true>
{
- struct diamond_derivation_error: bad_non_virtual, Exception
+ struct diamond_derivation_error
+ : bad_non_virtual, Exception
{
- diamond_derivation_error() : bad_non_virtual(), Exception() { }
+ diamond_derivation_error()
+ : bad_non_virtual(), Exception() { }
};
};
template<typename Exception>
struct diamond_derivation_base<Exception, false>
{
- struct diamond_derivation_error: bad_non_virtual, Exception
+ struct diamond_derivation_error
+ : bad_non_virtual, Exception
{
diamond_derivation_error()
: bad_non_virtual(), Exception("construct diamond") { }
@@ -64,18 +67,25 @@ namespace __gnu_test
};
template<typename Exception, bool DefaultCons>
- struct diamond_derivation: diamond_derivation_base<Exception, DefaultCons>
+ struct diamond_derivation
+ : diamond_derivation_base<Exception, DefaultCons>
{
typedef diamond_derivation_base<Exception, DefaultCons> base_type;
typedef typename base_type::diamond_derivation_error error_type;
-
+
+ // NB: In the libstdc++-v3 testsuite, all the standard exception
+ // classes (+ a couple of extensions) are checked: since they
+ // all derive *non* virtually from std::exception, the expected
+ // behavior is ambiguity.
static void test()
{
bool test __attribute__((unused)) = true;
- try { throw error_type(); }
- catch (std::exception const& e) { }
- catch (...)
+ try
+ { throw error_type(); }
+ catch (std::exception const&)
{ VERIFY( false ); }
+ catch (...)
+ { VERIFY( true ); }
}
};