gcc/gcc/hw-doloop.h

161 lines
5.5 KiB
C
Raw Permalink Normal View History

/* Code to analyze doloop loops in order for targets to perform late
optimizations converting doloops to other forms of hardware loops.
Copyright (C) 2011-2017 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/>. */
#ifndef GCC_HW_DOLOOP_H
#define GCC_HW_DOLOOP_H
/* We need to keep a vector of loops */
typedef struct hwloop_info_d *hwloop_info;
/* Information about a loop we have found (or are in the process of
finding). */
struct GTY (()) hwloop_info_d
{
/* loop number, for dumps */
int loop_no;
/* Next loop in the graph. */
hwloop_info next;
/* Vector of blocks only within the loop, including those within
inner loops. */
This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. The user-visible changes are described in http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec. I have tested the patch pretty extensively: - Regular bootstraps on x86_64, ppc, ia64, sparc and hppa. - Bootstraps with --enable-checking=release - Bootstraps with --enable-checking=gc,gcac - Basic builds on all targets (using contrib/config-list.mk). We no longer access the vectors via VEC_* macros. The pattern is "VEC_operation (T, A, V, args)" becomes "V.operation (args)". The only thing I could not do is create proper ctors and dtors for the vec class. Since these vectors are stored in unions, we have to keep them as PODs (C++03 does not allow non-PODs in unions). This means that creation and destruction must be explicit. There is a new method vec<type, allocation, layout>::create() and another vec<type, allocation, layout>::destroy() to allocate the internal vector. For vectors that must be pointers, there is a family of free functions that implement the operations that need to tolerate NULL vectors. These functions all start with the prefix 'vec_safe_'. See the wiki page for details. The gengtype change removes the special handling for VEC() that used to exist in gengtype. Additionally, it allows gengtype to recognize templates of more than one argument and introduces the concept of an undefined type (useful for template arguments that may or may not be types). When a TYPE_UNDEFINED is reached, gengtype will ignore it if it happens inside a type marked with GTY((user)). Otherwise, it will emit an error. Finally, gengtype rejects root types marked GTY((user)) that are not first class pointers. 2012-11-16 Diego Novillo <dnovillo@google.com> VEC API overhaul (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * vec.c (register_overhead): Convert it into member function of vec_prefix. (release_overhead): Likewise. (calculate_allocation): Likewise. (vec_heap_free): Remove. (vec_gc_o_reserve_1): Remove. (vec_heap_o_reserve_1): Remove. (vec_stack_o_reserve_1): Remove. (vec_stack_o_reserve_exact): Remove. (register_stack_vec): New. (stack_vec_register_index): New. (unregister_stack_vec): New. (vec_assert_fail): Remove. * vec.h: Conditionally include ggc.h. Document conditional hackery. Update top-level documentation. (ALONE_VEC_CHECK_INFO): Remove. (VEC_CHECK_INFO): Remove. (ALONE_VEC_CHECK_DECL): Remove. (VEC_CHECK_DECL): Remove. (ALONE_VEC_CHECK_PASS): Remove. (VEC_CHECK_PASS): Remove. (VEC_ASSERT): Remove. (vec_prefix): Add friends va_gc, va_gc_atomic, va_heap and va_stack. Mark fields alloc_ and num_ as protected. (struct vec_t): Remove. Remove all function members. (struct vl_embed): Declare. (struct vl_ptr): Declare. (free): Remove. (reserve_exact): Remove. (reserve): Remove. (safe_splice): Remove. (safe_push): Remove. (safe_grow): Remove. (safe_grow_cleared): Remove. (safe_insert): Remove. (DEF_VEC_I): Remove. (DEF_VEC_ALLOC_I): Remove. (DEF_VEC_P): Remove. (DEF_VEC_ALLOC_P): Remove. (DEF_VEC_O): Remove. (DEF_VEC_ALLOC_O): Remove. (DEF_VEC_ALLOC_P_STACK): Remove. (DEF_VEC_ALLOC_O_STACK): Remove. (DEF_VEC_ALLOC_I_STACK): Remove. (DEF_VEC_A): Remove. (DEF_VEC_ALLOC_A): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (VEC_length): Remove. (VEC_empty): Remove. (VEC_address): Remove. (vec_address): Remove. (VEC_last): Remove. (VEC_index): Remove. (VEC_iterate): Remove. (VEC_embedded_size): Remove. (VEC_embedded_init): Remove. (VEC_free): Remove. (VEC_copy): Remove. (VEC_space): Remove. (VEC_reserve): Remove. (VEC_reserve_exact): Remove. (VEC_splice): Remove. (VEC_safe_splice): Remove. (VEC_quick_push): Remove. (VEC_safe_push): Remove. (VEC_pop): Remove. (VEC_truncate): Remove. (VEC_safe_grow): Remove. (VEC_replace): Remove. (VEC_quick_insert): Remove. (VEC_safe_insert): Remove. (VEC_ordered_remove): Remove. (VEC_unordered_remove): Remove. (VEC_block_remove): Remove. (VEC_lower_bound): Remove. (VEC_alloc): Remove. (VEC_qsort): Remove. (va_heap): Declare. (va_heap::default_layout): New typedef to vl_ptr. (va_heap::reserve): New. (va_heap::release): New. (va_gc): Declare. (va_gc::default_layout): New typedef to vl_embed. (va_gc::reserve): New. (va_gc::release): New. (va_gc_atomic): Declare. Inherit from va_gc. (va_stack): Declare. (va_stack::default_layout): New typedef to vl_ptr. (va_stack::alloc): New. (va_stack::reserve): New. (va_stack::release): New. (register_stack_vec): Declare. (stack_vec_register_index): Declare. (unregister_stack_vec): Declare. (vec<T, A = va_heap, L = typename A::default_layout>): Declare empty vec template. (vec<T, A, vl_embed>): Partial specialization for embedded layout. (vec<T, A, vl_embed>::allocated): New. (vec<T, A, vl_embed>::length): New. (vec<T, A, vl_embed>::is_empty): New. (vec<T, A, vl_embed>::address): New. (vec<T, A, vl_embed>::operator[]): New. (vec<T, A, vl_embed>::last New. (vec<T, A, vl_embed>::space): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::copy): New. (vec<T, A, vl_embed>::splice): New. (vec<T, A, vl_embed>::quick_push New. (vec<T, A, vl_embed>::pop New. (vec<T, A, vl_embed>::truncate): New. (vec<T, A, vl_embed>::quick_insert): New. (vec<T, A, vl_embed>::ordered_remove): New. (vec<T, A, vl_embed>::unordered_remove): New. (vec<T, A, vl_embed>::block_remove): New. (vec<T, A, vl_embed>::qsort): New. (vec<T, A, vl_embed>::lower_bound): New. (vec<T, A, vl_embed>::embedded_size): New. (vec<T, A, vl_embed>::embedded_init): New. (vec<T, A, vl_embed>::quick_grow): New. (vec<T, A, vl_embed>::quick_grow_cleared): New. (vec_safe_space): New. (vec_safe_length): New. (vec_safe_address): New. (vec_safe_is_empty): New. (vec_safe_reserve): New. (vec_safe_reserve_exact): New. (vec_alloc): New. (vec_free): New. (vec_safe_grow): New. (vec_safe_grow_cleared): New. (vec_safe_iterate): New. (vec_safe_push): New. (vec_safe_insert): New. (vec_safe_truncate): New. (vec_safe_copy): New. (vec_safe_splice): New. (vec<T, A, vl_ptr>): New partial specialization for the space efficient layout. (vec<T, A, vl_ptr>::exists): New. (vec<T, A, vl_ptr>::is_empty): New. (vec<T, A, vl_ptr>::length): New. (vec<T, A, vl_ptr>::address): New. (vec<T, A, vl_ptr>::operator[]): New. (vec<T, A, vl_ptr>::operator!=): New. (vec<T, A, vl_ptr>::operator==): New. (vec<T, A, vl_ptr>::last): New. (vec<T, A, vl_ptr>::space): New. (vec<T, A, vl_ptr>::iterate): New. (vec<T, A, vl_ptr>::copy): New. (vec<T, A, vl_ptr>::reserve): New. (vec<T, A, vl_ptr>::reserve_exact): New. (vec<T, A, vl_ptr>::splice): New. (vec<T, A, vl_ptr>::safe_splice): New. (vec<T, A, vl_ptr>::quick_push): New. (vec<T, A, vl_ptr>::safe_push): New. (vec<T, A, vl_ptr>::pop): New. (vec<T, A, vl_ptr>::truncate): New. (vec<T, A, vl_ptr>::safe_grow): New. (vec<T, A, vl_ptr>::safe_grow_cleared): New. (vec<T, A, vl_ptr>::quick_grow): New. (vec<T, A, vl_ptr>::quick_grow_cleared): New. (vec<T, A, vl_ptr>::quick_insert): New. (vec<T, A, vl_ptr>::safe_insert): New. (vec<T, A, vl_ptr>::ordered_remove): New. (vec<T, A, vl_ptr>::unordered_remove): New. (vec<T, A, vl_ptr>::block_remove): New. (vec<T, A, vl_ptr>::qsort): New. (vec<T, A, vl_ptr>::lower_bound): New. (vec_stack_alloc): Define. (FOR_EACH_VEC_SAFE_ELT): Define. * vecir.h: Remove. Update all users. * vecprim.h: Remove. Update all users. Move uchar to coretypes.h. * Makefile.in (VEC_H): Add $(GGC_H). Remove vecir.h and vecprim.h dependencies everywhere. 2012-11-16 Diego Novillo <dnovillo@google.com> * gengtype-lex.l (VEC): Remove. Add characters in the set [\!\>\.-]. * gengtype-parse.c (token_names): Remove "VEC". (require_template_declaration): Remove handling of VEC_TOKEN. (type): Likewise. Call create_user_defined_type when parsing GTY((user)). * gengtype-state.c (type_lineloc): handle TYPE_UNDEFINED. (write_state_undefined_type): New. (write_state_type): Call write_state_undefined_type for TYPE_UNDEFINED. (read_state_type): Call read_state_undefined_type for TYPE_UNDEFINED. * gengtype.c (dbgprint_count_type_at): Handle TYPE_UNDEFINED. (create_user_defined_type): Make extern. (type_for_name): Factor out of resolve_typedef. (create_undefined_type): New (resolve_typedef): Call it when we cannot find a previous typedef and the type is not a template. (find_structure): Accept TYPE_UNDEFINED. (set_gc_used_type): Add argument ALLOWED_UNDEFINED_TYPES, default to false. Emit an error for TYPE_UNDEFINED unless LEVEL is GC_UNUSED or ALLOWED_UNDEFINED_TYPES is set. Set ALLOWED_UNDEFINED_TYPES to true for TYPE_USER_STRUCT. (filter_type_name): Accept templates with more than one argument. (output_mangled_typename): Handle TYPE_UNDEFINED (walk_type): Likewise. (write_types_process_field): Likewise. (write_func_for_structure): If CHAIN_NEXT is set, ORIG_S should not be a user-defined type. (write_types_local_user_process_field): Handle TYPE_ARRAY, TYPE_NONE and TYPE_UNDEFINED. (write_types_local_process_field): Likewise. (contains_scalar_p): Return 0 for TYPE_USER_STRUCT. (write_root): Reject user-defined types that are not pointers. Handle TYPE_NONE, TYPE_UNDEFINED, TYPE_UNION, TYPE_LANG_STRUCT and TYPE_PARAM_STRUCT. (output_typename): Handle TYPE_NONE, TYPE_UNDEFINED, and TYPE_ARRAY. (dump_typekind): Handle TYPE_UNDEFINED. * gengtype.h (enum typekind): Add TYPE_UNDEFINED. (create_user_defined_type): Declare. (enum gty_token): Remove VEC_TOKEN. 2012-11-16 Diego Novillo <dnovillo@google.com> Adjust for new vec API (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * coretypes.h (uchar): Define. * alias.c: Use new vec API in vec.h. * asan.c: Likewise. * attribs.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * builtins.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgcleanup.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopanal.c: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * compare-elim.c: Likewise. * coverage.c: Likewise. * cprop.c: Likewise. * data-streamer.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * domwalk.h: Likewise. * dse.c: Likewise. * dwarf2cfi.c: Likewise. * dwarf2out.c: Likewise. * dwarf2out.h: Likewise. * emit-rtl.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genextract.c: Likewise. * genopinit.c: Likewise * ggc-common.c: Likewise. * ggc.h: Likewise. * gimple-low.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple.c: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graph.c: Likewise. * graphds.c: Likewise. * graphds.h: Likewise. * graphite-blocking.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * graphite-dependences.c: Likewise. * graphite-interchange.c: Likewise. * graphite-optimize-isl.c: Likewise. * graphite-poly.c: Likewise. * graphite-poly.h: Likewise. * graphite-scop-detection.c: Likewise. * graphite-scop-detection.h: Likewise. * graphite-sese-to-poly.c: Likewise. * graphite.c: Likewise. * godump.c: Likewise. * haifa-sched.c: Likewise. * hw-doloop.c: Likewise. * hw-doloop.h: Likewise. * ifcvt.c: Likewise. * insn-addr.h: Likewise. * ipa-cp.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-inline-transform.c: Likewise. * ipa-inline.c: Likewise. * ipa-inline.h: Likewise. * ipa-prop.c: Likewise. * ipa-prop.h: Likewise. * ipa-pure-const.c: Likewise. * ipa-ref-inline.h: Likewise. * ipa-ref.c: Likewise. * ipa-ref.h: Likewise. * ipa-reference.c: Likewise. * ipa-split.c: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira.c: Likewise. * loop-invariant.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lra-lives.c: Likewise. * lra.c: Likewise. * lto-cgraph.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * mcf.c: Likewise. * modulo-sched.c: Likewise. * omp-low.c: Likewise. * opts-common.c: Likewise. * opts-global.c: Likewise. * opts.c: Likewise. * opts.h: Likewise. * passes.c: Likewise. * predict.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * profile.h: Likewise. * read-rtl.c: Likewise. * ree.c: Likewise. * reg-stack.c: Likewise. * regrename.c: Likewise. * regrename.h: Likewise. * reload.c: Likewise. * reload.h: Likewise. * reload1.c: Likewise. * rtl.h: Likewise. * sched-deps.c: Likewise. * sched-int.h: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sese.c: Likewise. * sese.h: Likewise. * statistics.h: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * trans-mem.c: Likewise. * tree-browser.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-diagnostic.c: Likewise. * tree-dump.c: Likewise. * tree-eh.c: Likewise. * tree-emutls.c: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-into-ssa.c: Likewise. * tree-iterator.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-mudflap.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-stdarg.c: Likewise. * tree-streamer-in.c: Likewise. * tree-streamer-out.c: Likewise. * tree-streamer.c: Likewise. * tree-streamer.h: Likewise. * tree-switch-conversion.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.h: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vmsdbgout.c: Likewise. * config/bfin/bfin.c: Likewise. * config/c6x/c6x.c: Likewise. * config/darwin.c: Likewise. * config/i386/i386.c: Likewise. * config/ia64/ia64.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/pa.c: Likewise. * config/rs6000/rs6000-c.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/rx/rx.c: Likewise. * config/spu/spu-c.c: Likewise. * config/vms/vms.c: Likewise. * config/vxworks.c: Likewise. * config/epiphany/resolve-sw-modes.c: Likewise. From-SVN: r193595
2012-11-18 03:54:30 +01:00
vec<basic_block> blocks;
/* Same information in a bitmap. */
bitmap block_bitmap;
/* Vector of inner loops within this loop. Includes loops of every
nesting level. */
This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. The user-visible changes are described in http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec. I have tested the patch pretty extensively: - Regular bootstraps on x86_64, ppc, ia64, sparc and hppa. - Bootstraps with --enable-checking=release - Bootstraps with --enable-checking=gc,gcac - Basic builds on all targets (using contrib/config-list.mk). We no longer access the vectors via VEC_* macros. The pattern is "VEC_operation (T, A, V, args)" becomes "V.operation (args)". The only thing I could not do is create proper ctors and dtors for the vec class. Since these vectors are stored in unions, we have to keep them as PODs (C++03 does not allow non-PODs in unions). This means that creation and destruction must be explicit. There is a new method vec<type, allocation, layout>::create() and another vec<type, allocation, layout>::destroy() to allocate the internal vector. For vectors that must be pointers, there is a family of free functions that implement the operations that need to tolerate NULL vectors. These functions all start with the prefix 'vec_safe_'. See the wiki page for details. The gengtype change removes the special handling for VEC() that used to exist in gengtype. Additionally, it allows gengtype to recognize templates of more than one argument and introduces the concept of an undefined type (useful for template arguments that may or may not be types). When a TYPE_UNDEFINED is reached, gengtype will ignore it if it happens inside a type marked with GTY((user)). Otherwise, it will emit an error. Finally, gengtype rejects root types marked GTY((user)) that are not first class pointers. 2012-11-16 Diego Novillo <dnovillo@google.com> VEC API overhaul (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * vec.c (register_overhead): Convert it into member function of vec_prefix. (release_overhead): Likewise. (calculate_allocation): Likewise. (vec_heap_free): Remove. (vec_gc_o_reserve_1): Remove. (vec_heap_o_reserve_1): Remove. (vec_stack_o_reserve_1): Remove. (vec_stack_o_reserve_exact): Remove. (register_stack_vec): New. (stack_vec_register_index): New. (unregister_stack_vec): New. (vec_assert_fail): Remove. * vec.h: Conditionally include ggc.h. Document conditional hackery. Update top-level documentation. (ALONE_VEC_CHECK_INFO): Remove. (VEC_CHECK_INFO): Remove. (ALONE_VEC_CHECK_DECL): Remove. (VEC_CHECK_DECL): Remove. (ALONE_VEC_CHECK_PASS): Remove. (VEC_CHECK_PASS): Remove. (VEC_ASSERT): Remove. (vec_prefix): Add friends va_gc, va_gc_atomic, va_heap and va_stack. Mark fields alloc_ and num_ as protected. (struct vec_t): Remove. Remove all function members. (struct vl_embed): Declare. (struct vl_ptr): Declare. (free): Remove. (reserve_exact): Remove. (reserve): Remove. (safe_splice): Remove. (safe_push): Remove. (safe_grow): Remove. (safe_grow_cleared): Remove. (safe_insert): Remove. (DEF_VEC_I): Remove. (DEF_VEC_ALLOC_I): Remove. (DEF_VEC_P): Remove. (DEF_VEC_ALLOC_P): Remove. (DEF_VEC_O): Remove. (DEF_VEC_ALLOC_O): Remove. (DEF_VEC_ALLOC_P_STACK): Remove. (DEF_VEC_ALLOC_O_STACK): Remove. (DEF_VEC_ALLOC_I_STACK): Remove. (DEF_VEC_A): Remove. (DEF_VEC_ALLOC_A): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (VEC_length): Remove. (VEC_empty): Remove. (VEC_address): Remove. (vec_address): Remove. (VEC_last): Remove. (VEC_index): Remove. (VEC_iterate): Remove. (VEC_embedded_size): Remove. (VEC_embedded_init): Remove. (VEC_free): Remove. (VEC_copy): Remove. (VEC_space): Remove. (VEC_reserve): Remove. (VEC_reserve_exact): Remove. (VEC_splice): Remove. (VEC_safe_splice): Remove. (VEC_quick_push): Remove. (VEC_safe_push): Remove. (VEC_pop): Remove. (VEC_truncate): Remove. (VEC_safe_grow): Remove. (VEC_replace): Remove. (VEC_quick_insert): Remove. (VEC_safe_insert): Remove. (VEC_ordered_remove): Remove. (VEC_unordered_remove): Remove. (VEC_block_remove): Remove. (VEC_lower_bound): Remove. (VEC_alloc): Remove. (VEC_qsort): Remove. (va_heap): Declare. (va_heap::default_layout): New typedef to vl_ptr. (va_heap::reserve): New. (va_heap::release): New. (va_gc): Declare. (va_gc::default_layout): New typedef to vl_embed. (va_gc::reserve): New. (va_gc::release): New. (va_gc_atomic): Declare. Inherit from va_gc. (va_stack): Declare. (va_stack::default_layout): New typedef to vl_ptr. (va_stack::alloc): New. (va_stack::reserve): New. (va_stack::release): New. (register_stack_vec): Declare. (stack_vec_register_index): Declare. (unregister_stack_vec): Declare. (vec<T, A = va_heap, L = typename A::default_layout>): Declare empty vec template. (vec<T, A, vl_embed>): Partial specialization for embedded layout. (vec<T, A, vl_embed>::allocated): New. (vec<T, A, vl_embed>::length): New. (vec<T, A, vl_embed>::is_empty): New. (vec<T, A, vl_embed>::address): New. (vec<T, A, vl_embed>::operator[]): New. (vec<T, A, vl_embed>::last New. (vec<T, A, vl_embed>::space): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::copy): New. (vec<T, A, vl_embed>::splice): New. (vec<T, A, vl_embed>::quick_push New. (vec<T, A, vl_embed>::pop New. (vec<T, A, vl_embed>::truncate): New. (vec<T, A, vl_embed>::quick_insert): New. (vec<T, A, vl_embed>::ordered_remove): New. (vec<T, A, vl_embed>::unordered_remove): New. (vec<T, A, vl_embed>::block_remove): New. (vec<T, A, vl_embed>::qsort): New. (vec<T, A, vl_embed>::lower_bound): New. (vec<T, A, vl_embed>::embedded_size): New. (vec<T, A, vl_embed>::embedded_init): New. (vec<T, A, vl_embed>::quick_grow): New. (vec<T, A, vl_embed>::quick_grow_cleared): New. (vec_safe_space): New. (vec_safe_length): New. (vec_safe_address): New. (vec_safe_is_empty): New. (vec_safe_reserve): New. (vec_safe_reserve_exact): New. (vec_alloc): New. (vec_free): New. (vec_safe_grow): New. (vec_safe_grow_cleared): New. (vec_safe_iterate): New. (vec_safe_push): New. (vec_safe_insert): New. (vec_safe_truncate): New. (vec_safe_copy): New. (vec_safe_splice): New. (vec<T, A, vl_ptr>): New partial specialization for the space efficient layout. (vec<T, A, vl_ptr>::exists): New. (vec<T, A, vl_ptr>::is_empty): New. (vec<T, A, vl_ptr>::length): New. (vec<T, A, vl_ptr>::address): New. (vec<T, A, vl_ptr>::operator[]): New. (vec<T, A, vl_ptr>::operator!=): New. (vec<T, A, vl_ptr>::operator==): New. (vec<T, A, vl_ptr>::last): New. (vec<T, A, vl_ptr>::space): New. (vec<T, A, vl_ptr>::iterate): New. (vec<T, A, vl_ptr>::copy): New. (vec<T, A, vl_ptr>::reserve): New. (vec<T, A, vl_ptr>::reserve_exact): New. (vec<T, A, vl_ptr>::splice): New. (vec<T, A, vl_ptr>::safe_splice): New. (vec<T, A, vl_ptr>::quick_push): New. (vec<T, A, vl_ptr>::safe_push): New. (vec<T, A, vl_ptr>::pop): New. (vec<T, A, vl_ptr>::truncate): New. (vec<T, A, vl_ptr>::safe_grow): New. (vec<T, A, vl_ptr>::safe_grow_cleared): New. (vec<T, A, vl_ptr>::quick_grow): New. (vec<T, A, vl_ptr>::quick_grow_cleared): New. (vec<T, A, vl_ptr>::quick_insert): New. (vec<T, A, vl_ptr>::safe_insert): New. (vec<T, A, vl_ptr>::ordered_remove): New. (vec<T, A, vl_ptr>::unordered_remove): New. (vec<T, A, vl_ptr>::block_remove): New. (vec<T, A, vl_ptr>::qsort): New. (vec<T, A, vl_ptr>::lower_bound): New. (vec_stack_alloc): Define. (FOR_EACH_VEC_SAFE_ELT): Define. * vecir.h: Remove. Update all users. * vecprim.h: Remove. Update all users. Move uchar to coretypes.h. * Makefile.in (VEC_H): Add $(GGC_H). Remove vecir.h and vecprim.h dependencies everywhere. 2012-11-16 Diego Novillo <dnovillo@google.com> * gengtype-lex.l (VEC): Remove. Add characters in the set [\!\>\.-]. * gengtype-parse.c (token_names): Remove "VEC". (require_template_declaration): Remove handling of VEC_TOKEN. (type): Likewise. Call create_user_defined_type when parsing GTY((user)). * gengtype-state.c (type_lineloc): handle TYPE_UNDEFINED. (write_state_undefined_type): New. (write_state_type): Call write_state_undefined_type for TYPE_UNDEFINED. (read_state_type): Call read_state_undefined_type for TYPE_UNDEFINED. * gengtype.c (dbgprint_count_type_at): Handle TYPE_UNDEFINED. (create_user_defined_type): Make extern. (type_for_name): Factor out of resolve_typedef. (create_undefined_type): New (resolve_typedef): Call it when we cannot find a previous typedef and the type is not a template. (find_structure): Accept TYPE_UNDEFINED. (set_gc_used_type): Add argument ALLOWED_UNDEFINED_TYPES, default to false. Emit an error for TYPE_UNDEFINED unless LEVEL is GC_UNUSED or ALLOWED_UNDEFINED_TYPES is set. Set ALLOWED_UNDEFINED_TYPES to true for TYPE_USER_STRUCT. (filter_type_name): Accept templates with more than one argument. (output_mangled_typename): Handle TYPE_UNDEFINED (walk_type): Likewise. (write_types_process_field): Likewise. (write_func_for_structure): If CHAIN_NEXT is set, ORIG_S should not be a user-defined type. (write_types_local_user_process_field): Handle TYPE_ARRAY, TYPE_NONE and TYPE_UNDEFINED. (write_types_local_process_field): Likewise. (contains_scalar_p): Return 0 for TYPE_USER_STRUCT. (write_root): Reject user-defined types that are not pointers. Handle TYPE_NONE, TYPE_UNDEFINED, TYPE_UNION, TYPE_LANG_STRUCT and TYPE_PARAM_STRUCT. (output_typename): Handle TYPE_NONE, TYPE_UNDEFINED, and TYPE_ARRAY. (dump_typekind): Handle TYPE_UNDEFINED. * gengtype.h (enum typekind): Add TYPE_UNDEFINED. (create_user_defined_type): Declare. (enum gty_token): Remove VEC_TOKEN. 2012-11-16 Diego Novillo <dnovillo@google.com> Adjust for new vec API (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * coretypes.h (uchar): Define. * alias.c: Use new vec API in vec.h. * asan.c: Likewise. * attribs.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * builtins.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgcleanup.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopanal.c: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * compare-elim.c: Likewise. * coverage.c: Likewise. * cprop.c: Likewise. * data-streamer.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * domwalk.h: Likewise. * dse.c: Likewise. * dwarf2cfi.c: Likewise. * dwarf2out.c: Likewise. * dwarf2out.h: Likewise. * emit-rtl.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genextract.c: Likewise. * genopinit.c: Likewise * ggc-common.c: Likewise. * ggc.h: Likewise. * gimple-low.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple.c: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graph.c: Likewise. * graphds.c: Likewise. * graphds.h: Likewise. * graphite-blocking.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * graphite-dependences.c: Likewise. * graphite-interchange.c: Likewise. * graphite-optimize-isl.c: Likewise. * graphite-poly.c: Likewise. * graphite-poly.h: Likewise. * graphite-scop-detection.c: Likewise. * graphite-scop-detection.h: Likewise. * graphite-sese-to-poly.c: Likewise. * graphite.c: Likewise. * godump.c: Likewise. * haifa-sched.c: Likewise. * hw-doloop.c: Likewise. * hw-doloop.h: Likewise. * ifcvt.c: Likewise. * insn-addr.h: Likewise. * ipa-cp.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-inline-transform.c: Likewise. * ipa-inline.c: Likewise. * ipa-inline.h: Likewise. * ipa-prop.c: Likewise. * ipa-prop.h: Likewise. * ipa-pure-const.c: Likewise. * ipa-ref-inline.h: Likewise. * ipa-ref.c: Likewise. * ipa-ref.h: Likewise. * ipa-reference.c: Likewise. * ipa-split.c: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira.c: Likewise. * loop-invariant.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lra-lives.c: Likewise. * lra.c: Likewise. * lto-cgraph.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * mcf.c: Likewise. * modulo-sched.c: Likewise. * omp-low.c: Likewise. * opts-common.c: Likewise. * opts-global.c: Likewise. * opts.c: Likewise. * opts.h: Likewise. * passes.c: Likewise. * predict.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * profile.h: Likewise. * read-rtl.c: Likewise. * ree.c: Likewise. * reg-stack.c: Likewise. * regrename.c: Likewise. * regrename.h: Likewise. * reload.c: Likewise. * reload.h: Likewise. * reload1.c: Likewise. * rtl.h: Likewise. * sched-deps.c: Likewise. * sched-int.h: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sese.c: Likewise. * sese.h: Likewise. * statistics.h: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * trans-mem.c: Likewise. * tree-browser.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-diagnostic.c: Likewise. * tree-dump.c: Likewise. * tree-eh.c: Likewise. * tree-emutls.c: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-into-ssa.c: Likewise. * tree-iterator.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-mudflap.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-stdarg.c: Likewise. * tree-streamer-in.c: Likewise. * tree-streamer-out.c: Likewise. * tree-streamer.c: Likewise. * tree-streamer.h: Likewise. * tree-switch-conversion.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.h: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vmsdbgout.c: Likewise. * config/bfin/bfin.c: Likewise. * config/c6x/c6x.c: Likewise. * config/darwin.c: Likewise. * config/i386/i386.c: Likewise. * config/ia64/ia64.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/pa.c: Likewise. * config/rs6000/rs6000-c.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/rx/rx.c: Likewise. * config/spu/spu-c.c: Likewise. * config/vms/vms.c: Likewise. * config/vxworks.c: Likewise. * config/epiphany/resolve-sw-modes.c: Likewise. From-SVN: r193595
2012-11-18 03:54:30 +01:00
vec<hwloop_info> loops;
/* All edges that jump into the loop. */
This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. The user-visible changes are described in http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec. I have tested the patch pretty extensively: - Regular bootstraps on x86_64, ppc, ia64, sparc and hppa. - Bootstraps with --enable-checking=release - Bootstraps with --enable-checking=gc,gcac - Basic builds on all targets (using contrib/config-list.mk). We no longer access the vectors via VEC_* macros. The pattern is "VEC_operation (T, A, V, args)" becomes "V.operation (args)". The only thing I could not do is create proper ctors and dtors for the vec class. Since these vectors are stored in unions, we have to keep them as PODs (C++03 does not allow non-PODs in unions). This means that creation and destruction must be explicit. There is a new method vec<type, allocation, layout>::create() and another vec<type, allocation, layout>::destroy() to allocate the internal vector. For vectors that must be pointers, there is a family of free functions that implement the operations that need to tolerate NULL vectors. These functions all start with the prefix 'vec_safe_'. See the wiki page for details. The gengtype change removes the special handling for VEC() that used to exist in gengtype. Additionally, it allows gengtype to recognize templates of more than one argument and introduces the concept of an undefined type (useful for template arguments that may or may not be types). When a TYPE_UNDEFINED is reached, gengtype will ignore it if it happens inside a type marked with GTY((user)). Otherwise, it will emit an error. Finally, gengtype rejects root types marked GTY((user)) that are not first class pointers. 2012-11-16 Diego Novillo <dnovillo@google.com> VEC API overhaul (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * vec.c (register_overhead): Convert it into member function of vec_prefix. (release_overhead): Likewise. (calculate_allocation): Likewise. (vec_heap_free): Remove. (vec_gc_o_reserve_1): Remove. (vec_heap_o_reserve_1): Remove. (vec_stack_o_reserve_1): Remove. (vec_stack_o_reserve_exact): Remove. (register_stack_vec): New. (stack_vec_register_index): New. (unregister_stack_vec): New. (vec_assert_fail): Remove. * vec.h: Conditionally include ggc.h. Document conditional hackery. Update top-level documentation. (ALONE_VEC_CHECK_INFO): Remove. (VEC_CHECK_INFO): Remove. (ALONE_VEC_CHECK_DECL): Remove. (VEC_CHECK_DECL): Remove. (ALONE_VEC_CHECK_PASS): Remove. (VEC_CHECK_PASS): Remove. (VEC_ASSERT): Remove. (vec_prefix): Add friends va_gc, va_gc_atomic, va_heap and va_stack. Mark fields alloc_ and num_ as protected. (struct vec_t): Remove. Remove all function members. (struct vl_embed): Declare. (struct vl_ptr): Declare. (free): Remove. (reserve_exact): Remove. (reserve): Remove. (safe_splice): Remove. (safe_push): Remove. (safe_grow): Remove. (safe_grow_cleared): Remove. (safe_insert): Remove. (DEF_VEC_I): Remove. (DEF_VEC_ALLOC_I): Remove. (DEF_VEC_P): Remove. (DEF_VEC_ALLOC_P): Remove. (DEF_VEC_O): Remove. (DEF_VEC_ALLOC_O): Remove. (DEF_VEC_ALLOC_P_STACK): Remove. (DEF_VEC_ALLOC_O_STACK): Remove. (DEF_VEC_ALLOC_I_STACK): Remove. (DEF_VEC_A): Remove. (DEF_VEC_ALLOC_A): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (VEC_length): Remove. (VEC_empty): Remove. (VEC_address): Remove. (vec_address): Remove. (VEC_last): Remove. (VEC_index): Remove. (VEC_iterate): Remove. (VEC_embedded_size): Remove. (VEC_embedded_init): Remove. (VEC_free): Remove. (VEC_copy): Remove. (VEC_space): Remove. (VEC_reserve): Remove. (VEC_reserve_exact): Remove. (VEC_splice): Remove. (VEC_safe_splice): Remove. (VEC_quick_push): Remove. (VEC_safe_push): Remove. (VEC_pop): Remove. (VEC_truncate): Remove. (VEC_safe_grow): Remove. (VEC_replace): Remove. (VEC_quick_insert): Remove. (VEC_safe_insert): Remove. (VEC_ordered_remove): Remove. (VEC_unordered_remove): Remove. (VEC_block_remove): Remove. (VEC_lower_bound): Remove. (VEC_alloc): Remove. (VEC_qsort): Remove. (va_heap): Declare. (va_heap::default_layout): New typedef to vl_ptr. (va_heap::reserve): New. (va_heap::release): New. (va_gc): Declare. (va_gc::default_layout): New typedef to vl_embed. (va_gc::reserve): New. (va_gc::release): New. (va_gc_atomic): Declare. Inherit from va_gc. (va_stack): Declare. (va_stack::default_layout): New typedef to vl_ptr. (va_stack::alloc): New. (va_stack::reserve): New. (va_stack::release): New. (register_stack_vec): Declare. (stack_vec_register_index): Declare. (unregister_stack_vec): Declare. (vec<T, A = va_heap, L = typename A::default_layout>): Declare empty vec template. (vec<T, A, vl_embed>): Partial specialization for embedded layout. (vec<T, A, vl_embed>::allocated): New. (vec<T, A, vl_embed>::length): New. (vec<T, A, vl_embed>::is_empty): New. (vec<T, A, vl_embed>::address): New. (vec<T, A, vl_embed>::operator[]): New. (vec<T, A, vl_embed>::last New. (vec<T, A, vl_embed>::space): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::copy): New. (vec<T, A, vl_embed>::splice): New. (vec<T, A, vl_embed>::quick_push New. (vec<T, A, vl_embed>::pop New. (vec<T, A, vl_embed>::truncate): New. (vec<T, A, vl_embed>::quick_insert): New. (vec<T, A, vl_embed>::ordered_remove): New. (vec<T, A, vl_embed>::unordered_remove): New. (vec<T, A, vl_embed>::block_remove): New. (vec<T, A, vl_embed>::qsort): New. (vec<T, A, vl_embed>::lower_bound): New. (vec<T, A, vl_embed>::embedded_size): New. (vec<T, A, vl_embed>::embedded_init): New. (vec<T, A, vl_embed>::quick_grow): New. (vec<T, A, vl_embed>::quick_grow_cleared): New. (vec_safe_space): New. (vec_safe_length): New. (vec_safe_address): New. (vec_safe_is_empty): New. (vec_safe_reserve): New. (vec_safe_reserve_exact): New. (vec_alloc): New. (vec_free): New. (vec_safe_grow): New. (vec_safe_grow_cleared): New. (vec_safe_iterate): New. (vec_safe_push): New. (vec_safe_insert): New. (vec_safe_truncate): New. (vec_safe_copy): New. (vec_safe_splice): New. (vec<T, A, vl_ptr>): New partial specialization for the space efficient layout. (vec<T, A, vl_ptr>::exists): New. (vec<T, A, vl_ptr>::is_empty): New. (vec<T, A, vl_ptr>::length): New. (vec<T, A, vl_ptr>::address): New. (vec<T, A, vl_ptr>::operator[]): New. (vec<T, A, vl_ptr>::operator!=): New. (vec<T, A, vl_ptr>::operator==): New. (vec<T, A, vl_ptr>::last): New. (vec<T, A, vl_ptr>::space): New. (vec<T, A, vl_ptr>::iterate): New. (vec<T, A, vl_ptr>::copy): New. (vec<T, A, vl_ptr>::reserve): New. (vec<T, A, vl_ptr>::reserve_exact): New. (vec<T, A, vl_ptr>::splice): New. (vec<T, A, vl_ptr>::safe_splice): New. (vec<T, A, vl_ptr>::quick_push): New. (vec<T, A, vl_ptr>::safe_push): New. (vec<T, A, vl_ptr>::pop): New. (vec<T, A, vl_ptr>::truncate): New. (vec<T, A, vl_ptr>::safe_grow): New. (vec<T, A, vl_ptr>::safe_grow_cleared): New. (vec<T, A, vl_ptr>::quick_grow): New. (vec<T, A, vl_ptr>::quick_grow_cleared): New. (vec<T, A, vl_ptr>::quick_insert): New. (vec<T, A, vl_ptr>::safe_insert): New. (vec<T, A, vl_ptr>::ordered_remove): New. (vec<T, A, vl_ptr>::unordered_remove): New. (vec<T, A, vl_ptr>::block_remove): New. (vec<T, A, vl_ptr>::qsort): New. (vec<T, A, vl_ptr>::lower_bound): New. (vec_stack_alloc): Define. (FOR_EACH_VEC_SAFE_ELT): Define. * vecir.h: Remove. Update all users. * vecprim.h: Remove. Update all users. Move uchar to coretypes.h. * Makefile.in (VEC_H): Add $(GGC_H). Remove vecir.h and vecprim.h dependencies everywhere. 2012-11-16 Diego Novillo <dnovillo@google.com> * gengtype-lex.l (VEC): Remove. Add characters in the set [\!\>\.-]. * gengtype-parse.c (token_names): Remove "VEC". (require_template_declaration): Remove handling of VEC_TOKEN. (type): Likewise. Call create_user_defined_type when parsing GTY((user)). * gengtype-state.c (type_lineloc): handle TYPE_UNDEFINED. (write_state_undefined_type): New. (write_state_type): Call write_state_undefined_type for TYPE_UNDEFINED. (read_state_type): Call read_state_undefined_type for TYPE_UNDEFINED. * gengtype.c (dbgprint_count_type_at): Handle TYPE_UNDEFINED. (create_user_defined_type): Make extern. (type_for_name): Factor out of resolve_typedef. (create_undefined_type): New (resolve_typedef): Call it when we cannot find a previous typedef and the type is not a template. (find_structure): Accept TYPE_UNDEFINED. (set_gc_used_type): Add argument ALLOWED_UNDEFINED_TYPES, default to false. Emit an error for TYPE_UNDEFINED unless LEVEL is GC_UNUSED or ALLOWED_UNDEFINED_TYPES is set. Set ALLOWED_UNDEFINED_TYPES to true for TYPE_USER_STRUCT. (filter_type_name): Accept templates with more than one argument. (output_mangled_typename): Handle TYPE_UNDEFINED (walk_type): Likewise. (write_types_process_field): Likewise. (write_func_for_structure): If CHAIN_NEXT is set, ORIG_S should not be a user-defined type. (write_types_local_user_process_field): Handle TYPE_ARRAY, TYPE_NONE and TYPE_UNDEFINED. (write_types_local_process_field): Likewise. (contains_scalar_p): Return 0 for TYPE_USER_STRUCT. (write_root): Reject user-defined types that are not pointers. Handle TYPE_NONE, TYPE_UNDEFINED, TYPE_UNION, TYPE_LANG_STRUCT and TYPE_PARAM_STRUCT. (output_typename): Handle TYPE_NONE, TYPE_UNDEFINED, and TYPE_ARRAY. (dump_typekind): Handle TYPE_UNDEFINED. * gengtype.h (enum typekind): Add TYPE_UNDEFINED. (create_user_defined_type): Declare. (enum gty_token): Remove VEC_TOKEN. 2012-11-16 Diego Novillo <dnovillo@google.com> Adjust for new vec API (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * coretypes.h (uchar): Define. * alias.c: Use new vec API in vec.h. * asan.c: Likewise. * attribs.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * builtins.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgcleanup.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopanal.c: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * compare-elim.c: Likewise. * coverage.c: Likewise. * cprop.c: Likewise. * data-streamer.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * domwalk.h: Likewise. * dse.c: Likewise. * dwarf2cfi.c: Likewise. * dwarf2out.c: Likewise. * dwarf2out.h: Likewise. * emit-rtl.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genextract.c: Likewise. * genopinit.c: Likewise * ggc-common.c: Likewise. * ggc.h: Likewise. * gimple-low.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple.c: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graph.c: Likewise. * graphds.c: Likewise. * graphds.h: Likewise. * graphite-blocking.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * graphite-dependences.c: Likewise. * graphite-interchange.c: Likewise. * graphite-optimize-isl.c: Likewise. * graphite-poly.c: Likewise. * graphite-poly.h: Likewise. * graphite-scop-detection.c: Likewise. * graphite-scop-detection.h: Likewise. * graphite-sese-to-poly.c: Likewise. * graphite.c: Likewise. * godump.c: Likewise. * haifa-sched.c: Likewise. * hw-doloop.c: Likewise. * hw-doloop.h: Likewise. * ifcvt.c: Likewise. * insn-addr.h: Likewise. * ipa-cp.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-inline-transform.c: Likewise. * ipa-inline.c: Likewise. * ipa-inline.h: Likewise. * ipa-prop.c: Likewise. * ipa-prop.h: Likewise. * ipa-pure-const.c: Likewise. * ipa-ref-inline.h: Likewise. * ipa-ref.c: Likewise. * ipa-ref.h: Likewise. * ipa-reference.c: Likewise. * ipa-split.c: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira.c: Likewise. * loop-invariant.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lra-lives.c: Likewise. * lra.c: Likewise. * lto-cgraph.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * mcf.c: Likewise. * modulo-sched.c: Likewise. * omp-low.c: Likewise. * opts-common.c: Likewise. * opts-global.c: Likewise. * opts.c: Likewise. * opts.h: Likewise. * passes.c: Likewise. * predict.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * profile.h: Likewise. * read-rtl.c: Likewise. * ree.c: Likewise. * reg-stack.c: Likewise. * regrename.c: Likewise. * regrename.h: Likewise. * reload.c: Likewise. * reload.h: Likewise. * reload1.c: Likewise. * rtl.h: Likewise. * sched-deps.c: Likewise. * sched-int.h: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sese.c: Likewise. * sese.h: Likewise. * statistics.h: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * trans-mem.c: Likewise. * tree-browser.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-diagnostic.c: Likewise. * tree-dump.c: Likewise. * tree-eh.c: Likewise. * tree-emutls.c: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-into-ssa.c: Likewise. * tree-iterator.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-mudflap.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-stdarg.c: Likewise. * tree-streamer-in.c: Likewise. * tree-streamer-out.c: Likewise. * tree-streamer.c: Likewise. * tree-streamer.h: Likewise. * tree-switch-conversion.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.h: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vmsdbgout.c: Likewise. * config/bfin/bfin.c: Likewise. * config/c6x/c6x.c: Likewise. * config/darwin.c: Likewise. * config/i386/i386.c: Likewise. * config/ia64/ia64.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/pa.c: Likewise. * config/rs6000/rs6000-c.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/rx/rx.c: Likewise. * config/spu/spu-c.c: Likewise. * config/vms/vms.c: Likewise. * config/vxworks.c: Likewise. * config/epiphany/resolve-sw-modes.c: Likewise. From-SVN: r193595
2012-11-18 03:54:30 +01:00
vec<edge, va_gc> *incoming;
/* The ports currently using this infrastructure can typically
handle two cases: all incoming edges have the same destination
block, or all incoming edges have the same source block. These
two members are set to the common source or destination we found,
or NULL if different blocks were found. If both are NULL the
loop can't be optimized. */
basic_block incoming_src;
basic_block incoming_dest;
/* First block in the loop. This is the one branched to by the loop_end
insn. */
basic_block head;
/* Last block in the loop (the one with the loop_end insn). */
basic_block tail;
/* The successor block of the loop. This is the one the loop_end insn
falls into. */
basic_block successor;
/* The last instruction in the tail. */
rtx_insn *last_insn;
/* The loop_end insn. */
rtx_insn *loop_end;
/* The iteration register. */
rtx iter_reg;
/* The new label placed at the beginning of the loop. */
NEXT_INSN and PREV_INSN take a const rtx_insn gcc/ 2014-08-28 David Malcolm <dmalcolm@redhat.com> * rtl.h (RTX_PREV): Added checked casts to uses of PREV_INSN and NEXT_INSN. (PREV_INSN): Strengthen param from const_rtx to const rtx_insn *. (NEXT_INSN): Likewise. (JUMP_LABEL_AS_INSN): Add a "const" modifier to param. (reg_used_between_p): Strengthen params 2 and 3 from const_rtx to const rtx_insn *. (no_labels_between_p): Likewise for both params. * config/aarch64/aarch64.c (aarch64_output_casesi): Add a checked cast when using NEXT_INSN on operands[2]. * config/alpha/alpha.c (alpha_set_memflags): Strengthen local "insn" from rtx to rtx_insn *, adding a checked cast. (alpha_handle_trap_shadows): Strengthen locals "i", "n" from rtx to rtx_insn *. * config/arc/arc-protos.h (arc_ccfsm_record_condition): Likewise for third param. (arc_text_label): Likewise for param "insn". * config/arc/arc.c (arc_expand_epilogue): Likewise for local "insn". (arc_ccfsm_record_condition): Likewise for param "jump". (arc_text_label): Likewise for local "label". * config/arc/arc.md (doloop_begin_i): Likewise for local "scan". Introduce a local "seq" via a dyn_cast to rtx_sequence *, and use a method for typesafety. Add a checked cast. * config/arc/constraints.md (Clb): Add a checked cast when getting the CODE_LABEL from a LABEL_REF. * config/arm/arm.c (require_pic_register): Strengthen locals "seq", "insn" from rtx to rtx_insn *. (create_fix_barrier): Likewise for locals "selected", "next". (thumb1_reorg): Likewise for locals "prev", "insn". (arm_expand_prologue): Likewise for local "last". (thumb1_output_casesi): Add a checked cast when using NEXT_INSN on operands[0]. (thumb2_output_casesi): Likewise for operands[2]. * config/avr/avr-log.c (avr_log_vadump): Within 'L' case, strengthen local "insn" from rtx to rtx_insn *. * config/bfin/bfin.c (find_next_insn_start): Likewise for return type and param "insn". (find_prev_insn_start): Likewise. (hwloop_optimize): Likewise for locals "insn", "last_insn", "prev". (gen_one_bundle): Likewise for loal "t". (find_load): Likewise for param "insn". (workaround_speculation): Likewise for locals "insn", "next", "target", "next_tgt". * config/c6x/c6x.c (assign_reservations): Likewise for both params and for locals "insn", "within", "last". (count_unit_reqs): Likewise for params "head", "tail" and local "insn". (try_rename_operands): Likewise for params "head", "tail". (reshuffle_units): Likewise for locals "head", "tail", "insn". (struct c6x_sched_context): Likewise for fields "last_scheduled_insn", "last_scheduled_iter0". (init_sched_state): Replace NULL_RTX with NULL. (reorg_split_calls): Strengthen local "new_cycle_first" from rtx to rtx_insn *. (undo_split_delayed_nonbranch): Likewise for param and for local "prev". (conditionalize_after_sched): Likewise for local "insn". (bb_earliest_end_cycle): Likewise. (filter_insns_above): Likewise for locals "insn", "next". (hwloop_optimize): Remove redundant checked cast. (hwloop_fail): Strengthen local "t" from rtx to rtx_insn *. * config/cris/cris.c (cris_initial_frame_pointer_offset): Replace NULL_RTX with NULL. (cris_simple_epilogue): Likewise. (cris_expand_prologue): Likewise. (cris_expand_epilogue): Likewise. * config/frv/frv.c (frv_function_contains_far_jump): Strengthen local "insn" from rtx to rtx_insn *. (frv_ifcvt_modify_tests): Likewise for locals "last_insn", "insn". (struct frv_packet_group): Likewise for the elements within array fields "insns", "sorted", and for field "nop". (frv_packet): Likewise for the elements within array field "insns". (frv_add_insn_to_packet): Likewise for param "insn". (frv_insert_nop_in_packet): Likewise for param "insn" and local "last". (frv_for_each_packet): Likewise for locals "insn", "next_insn". (frv_sort_insn_group_1): Likewise for local "insn". (frv_optimize_membar_local): Likewise. (frv_align_label): Likewise for locals "x", "last", "barrier", "label". * config/ia64/ia64.c (last_scheduled_insn): Likewise for this local. (ia64_sched_init): Likewise for local "insn". (scheduled_good_insn): Likewise for param "last". (struct _ia64_sched_context): Likewise for field "last_scheduled_insn". (ia64_init_sched_context): Replace NULL_RTX with NULL. (struct bundle_state): Likewise for field "insn". (issue_nops_and_insn): Likewise for param "insn". (get_next_important_insn): Likewise for return type and both params. (ia64_add_bundle_selector_before): Likewise for param "insn". (bundling): Likewise for params "prev_head_insn", "tail" and locals "insn", "next_insn", "b". Eliminate top-level local rtx "nop" in favor of new locals rtx "nop_pat" and rtx_insn *nop; * config/iq2000/iq2000-protos.h (iq2000_fill_delay_slot): Strengthen final param from rtx to rtx_insn *. (iq2000_move_1word): Likewise for second param. * config/iq2000/iq2000.c (iq2000_fill_delay_slot): Likewise for param "cur_insn" and local "next_insn". (iq2000_move_1word): Likewise for param "insn". * config/iq2000/iq2000.md (insn before ADDR_DIFF_VEC): Add checked casts when using NEXT_INSN on operands[1]. * config/m32c/m32c.c (m32c_function_needs_enter): Strengthen local "insn" from rtx to rtx_insn *. * config/m68k/m68k.c (m68k_jump_table_ref_p): Split out uses of "x", introducing local rtx_insn * "insn" for when working with the CODE_LABEL of the LABEL_REF. (m68k_sched_md_init_global): Strengthen local "insn" from rtx to rtx_insn *. * config/mcore/mcore-protos.h (mcore_is_dead): Likewise for first param. * config/mcore/mcore.c (emit_new_cond_insn): Likewise for return type. (conditionalize_block): Likewise for return type and param. (mcore_is_dead): Likewise for param "first" and local "insn". (emit_new_cond_insn): Likewise for return type. (conditionalize_block): Likewise for return type, param, and locals "insn", "blk_1_br", "end_blk_2_insn", "start_blk_3_lab", "newinsn". (conditionalize_optimization): Likewise for local "insn". * config/mep/mep.c (mep_jmp_return_reorg): Add checked cast when using NEXT_INSN. * config/microblaze/microblaze.md: Add checked casts when using NEXT_INSN. * config/mips/mips.c (mips_expand_prologue): Eliminate top-level rtx "insn" in favor of various more tightly-scoped rtx "insn" and and rtx_insn * "insn". * config/mips/mips.md (casesi_internal_mips16_<mode>): Add a checked cast when using NEXT_INSN on operands[2]. * config/mn10300/mn10300.c (mn10300_insert_setlb_lcc): Strengthen local "insn" from rtx to rtx_insn *. * config/nds32/nds32-fp-as-gp.c (nds32_fp_as_gp_check_available): Likewise. * config/nds32/nds32-md-auxiliary.c (nds32_output_casesi_pc_relative): Add a checked cast when using NEXT_INSN on operands[1]. * config/pa/pa-protos.h (pa_following_call): Strengthen param from rtx to rtx_insn *. (pa_output_cbranch): Likewise for final param. (pa_output_lbranch): Likewise for second param. (pa_output_bb): Likewise for third param. (pa_output_bvb): Likewise. (pa_output_dbra): Likewise for second param. (pa_output_movb): Likewise. (pa_output_parallel_movb): Likewise. (pa_output_parallel_addb): Likewise. (pa_output_millicode_call): Likewise for first param. (pa_output_mul_insn): Likewise for second param. (pa_output_div_insn): Likewise for third param. (pa_output_mod_insn): Likewise for second param. (pa_jump_in_call_delay): Likewise for param. * config/pa/pa.c (pa_output_mul_insn): Likewise for param "insn". (pa_output_div_insn): Likewise. (pa_output_mod_insn): Likewise. (pa_output_cbranch): Likewise. (pa_output_lbranch): Likewise. (pa_output_bb): Likewise. (pa_output_bvb): Likewise. (pa_output_dbra): Likewise. (pa_output_movb): Likewise. (pa_output_millicode_call): Likewise; use method of rtx_sequence * to simplify and for typesafety. (pa_output_call): Use method of rtx_sequence *. (forward_branch_p): Strengthen param "insn" from rtx to rtx_insn *. (pa_jump_in_call_delay): Likewise. (pa_output_parallel_movb): Likewise. (pa_output_parallel_addb): Likewise. (pa_following_call): Likewise. (pa_combine_instructions): Likewise for locals "anchor", "floater". (pa_can_combine_p): Likewise for params "anchor", "floater" and locals "start", "end". * config/picochip/picochip.c (picochip_reset_vliw): Likewise for param "insn" and local "local_insn". (picochip_final_prescan_insn): Likewise for local "local_insn". * config/rs6000/rs6000.c (compute_save_world_info): Likewise for local "insn". (uses_TOC): Likewise. * config/s390/s390.c (get_some_local_dynamic_name): Likewise. (s390_mainpool_finish): Eliminate top-level local rtx "insn", splitting out to more tightly-scoped locals, 3 as rtx and one as rtx_insn *. (s390_optimize_nonescaping_tx): Strengthen local "tmp" from rtx to rtx_insn *. (s390_emit_prologue): Introduce a local "insn" to be an rtx_insn * where needed. * config/sh/sh-protos.h (barrier_align): Strenghten param from rtx to rtx_insn *. (fixup_addr_diff_vecs): Likewise. (reg_unused_after): Likewise for param 2. (sh_can_redirect_branch): Likewise for both params. (check_use_sfunc_addr): Likewise for param 1. * config/sh/sh.c (fixup_mova): Likewise for local "worker". (find_barrier): Likewise for local "last_got". (gen_block_redirect): Likewise for return type, param "jump" and locals "prev", "scan", "next", "insn". (struct far_branch): Likewise for fields "near_label", "insert_place", "far_label". (gen_far_branch): Likewise for local "jump". (fixup_addr_diff_vecs): Likewise for param "first" and locals "insn", "prev". (barrier_align): Likewise for param and for locals "prev", "x". Introduce local rtx_sequence * "prev_seq" and use insn method for typesafety and clarity. (sh_reorg): Strengthen local "scan" from rtx to rtx_insn *. (get_dest_uid): Likewise for local "dest". (split_branches): Likewise for locals "next", "beyond", "label", "block", "far_label". Add checked casts when assigning to bp->far_label and "far_label". (reg_unused_after): Strengthen param "scan" from rtx to rtx_insn *. (sequence_insn_p): Likewise. (mark_constant_pool_use): Likewise for locals "insn", "lab". Add a more loop-scoped rtx "insn" when walking LABEL_REFS. (sh_can_redirect_branch): Strengthen both params from rtx to rtx_insn *. (check_use_sfunc_addr): Likewise for param "insn". Introduce a new local rtx_sequence * "seq" via a dyn_cast, and use a method for clarity and typesafety. * config/sh/sh.md (define_expand "epilogue"): Strengthen local "insn" from rtx to rtx_insn *. (define_insn "casesi_worker_1"): Add a checked cast to rtx_insn * when using NEXT_INSN on the CODE_LABEL in operands[2]. (define_insn "casesi_worker_2"): Likewise. (define_insn "casesi_shift_media"): Likewise. (define_insn "casesi_load_media"): Likewise for the CODE_LABEL in operands[3]. * config/sh/sh_optimize_sett_clrt.cc (struct ccreg_value): Strengthen field "insn" from rtx to rtx_insn *. (sh_optimize_sett_clrt::execute): Likewise for locals "next_i", "i". (sh_optimize_sett_clrt::find_last_ccreg_values): Likewise for param "start_insn" and local "start_insn". * config/sh/sh_treg_combine.cc (struct set_of_reg): Likewise for field "insn". (find_set_of_reg_bb): Likewise for param "insn". (trace_reg_uses_1): Likewise for param "start_insn" and local "i". (trace_reg_uses): Likewise for param "start_insn". (sh_treg_combine::cbranch_trace): Likewise for field "cbranch_insn". (sh_treg_combine::cbranch_trace::cbranch_trace): Likewise for param "insn". (sh_treg_combine::record_set_of_reg): Likewise for param "start_insn" and local "i". (sh_treg_combine::can_remove_cstore): Likewise for local "prev_insn". (sh_treg_combine::try_optimize_cbranch): Likewise for param "insn". (sh_treg_combine::execute): Likewise for local "i". * config/sparc/sparc-protos.h (empty_delay_slot): Likewise for param. (sparc_check_64): Likewise for second param. * config/sparc/sparc.c (sparc_do_work_around_errata): Likewise for locals "insn", "next". Introduce local rtx_sequence * "seq" via a dyn_cast, using its insn method for typesafety and clarity. (empty_delay_slot): Strengthen param "insn" from rtx to rtx_insn *. (set_extends): Likewise. (sparc_check_64): Likewise. * config/stormy16/stormy16.c (xstormy16_split_cbranch): Likewise for locals "seq", "last_insn". (combine_bnp): Likewise for param "insn". (xstormy16_reorg): Likewise for local "insn". * config/v850/v850.c (substitute_ep_register): Likewise for params "first_insn", "last_insn" and local "insn". (v850_reorg): Likewise for fields "first_insn", "last_insn" within elements of "regs" array, and local "insn". * except.c (emit_note_eh_region_end): Likewise for param "insn". * final.c (final_sequence): Strengthen this global from rtx to rtx_sequence *. (shorten_branches): Strenthen locals "rel_lab", "prev" from rtx to rtx_insn *. (final_scan_insn): Update assignment to "final_sequence" to be from "seq", the cast version of "body", for type-safety. * function.c (assign_parm_setup_reg): Strengthen locals "insn", "insns" from rtx to rtx_insn *. (thread_prologue_and_epilogue_insns): Likewise for local "seq". * genattr.c (main): When writing out generated insn-attr.h, strengthen params 1 and 3 of eligible_for_delay, eligible_for_annul_true, eligible_for_annul_false from rtx to rtx_insn *. * genattrtab.c (write_eligible_delay): Likewise when writing out generated insn-attrtab.c; also local "insn" the generated functions. * hw-doloop.c (discover_loops): Strengthen local "insn" from rtx to rtx_insn *. * hw-doloop.h (struct GTY hwloop_info_d): Strengthen field "start_label" from rtx to rtx_insn *. * ira.c (decrease_live_ranges_number): Likewise for local "p". (ira_update_equiv_info_by_shuffle_insn): Likewise for param "insns" and local "insn". (validate_equiv_mem): Likewise for param "start" and local "insn". (memref_used_between_p): Likewise for params "start", "end" and local "insn". * ira.h (ira_update_equiv_info_by_shuffle_insn): Likewise for final param. * loop-doloop.c (doloop_optimize): Within region guarded by INSN_P (doloop_pat), introduce a new local rtx_insn * "doloop_insn" via a checked cast, and use it for typesafety, eventually writing the value back into doloop_pat. * output.h (final_sequence): Strengthen this global from rtx to rtx_sequence *. * recog.c (peep2_attempt): Rename param "insn" to "uncast_insn", reintroducing "insn" as an rtx_insn * via a checked cast. Strengthen param "attempt" and local "new_insn"from rtx to rtx_insn *. (peephole2_optimize): Strengthen locals "insn", "attempt" from rtx to rtx_insn *. * ree.c (emit_note_eh_region_end): Likewise for local "insn". * reload1.c (reload_as_needed): Eliminate top-level locals "x" and "p" in favor of more tightly-scoped replacements, sometimes rtx and sometimes rtx_insn *, as appropriate. (delete_output_reload): Eliminate top-level rtx "i1", splitting into two loop-scoped locals, one an rtx, the other an rtx_insn *. * reorg.c (delete_scheduled_jump): Add checked cast. Strengthen local "trial" from rtx to rtx_insn *. (redirect_with_delay_slots_safe_p): Strengthen param "jump" from rtx to rtx_insn *. Strenghten local "pat" from rtx to rtx_sequence * and use methods for clarity and typesafety. (redirect_with_delay_list_safe_p): Strengthen param "jump" from rtx to rtx_insn *. Strenghten local "li" from rtx to rtx_insn_list * and use its methods for clarity and typesafety. (steal_delay_list_from_target): Strengthen param "insn" from rtx to rtx_insn *. (steal_delay_list_from_fallthrough): Likewise. (try_merge_delay_insns): Likewise for param "thread" and locals "trial", "next_trial", "delay_insn". (redundant_insn): Likewise for param "target" and local "trial". (own_thread_p): Likewise for param "thread" and locals "active_insn", "insn". (get_label_before): Likewise for param "insn". (fill_simple_delay_slots): Likewise for local "new_label"; use JUMP_LABEL_AS_INSN as necessary when calling own_thread_p. (label_before_next_insn): Strengthen return type and local "insn" from rtx to rtx_insn *. (relax_delay_slots): Likewise for locals "other", "tmp". (make_return_insns): Likewise for param "first" and locals "insn", "jump_insn", "prev". Move declaration of "pat" to its assignment and strengthen from rtx to rtx_sequence *. Use its methods for clarity and typesafety. * rtlanal.c (no_labels_between_p): Strengthen params from const_rtx to const rtx_insn *. Strengthen local "p" from rtx to rtx_insn *. (reg_used_between_p): Strengthen params "from_insn", "to_insn" from const_rtx to const rtx_insn *. (reg_set_between_p): Rename param "from_insn" to "uncast_from_insn", and reintroduce "from_insn" as a const rtx_insn * via a checked cast. (modified_between_p): Likewise for param "start" as "uncast_start". (tablejump_p): Add a cast when invoking NEXT_INSN on "label". * sel-sched-ir.c (get_seqno_by_preds): Strengthen param and locals "tmp", head" from rtx to rtx_insn *. (recompute_rev_top_order): Likewise for local "insn". * sel-sched-ir.h (get_seqno_by_preds): Likewise for param. * store-motion.c (build_store_vectors): Likewise for local "insn". Strengthen local "st" from rtx to rtx_insn_list * and use methods for clarity and typesafety. * tree-ssa-loop-ivopts.c (seq_cost): Strengthen param "seq" from rtx to rtx_insn *. (computation_cost): Likewise for local "seq". (get_address_cost): Likewise. / 2014-08-28 David Malcolm <dmalcolm@redhat.com> * rtx-classes-status.txt (TODO): NEXT_INSN/PREV_INSN are done. From-SVN: r214698
2014-08-28 23:29:38 +02:00
rtx_insn *start_label;
/* The new label placed at the end of the loop. */
rtx end_label;
/* The length of the loop. */
int length;
/* The nesting depth of the loop. Innermost loops are given a depth
of 1. Only successfully optimized doloops are counted; if an inner
loop was marked as bad, it does not increase the depth of its parent
loop.
This value is valid when the target's optimize function is called. */
int depth;
/* True if we can't optimize this loop. */
bool bad;
/* True if we have visited this loop during the optimization phase. */
bool visited;
/* The following values are collected before calling the target's optimize
function and are not valid earlier. */
/* Record information about control flow: whether the loop has calls
or asm statements, whether it has edges that jump out of the loop,
or edges that jump within the loop. */
bool has_call;
bool has_asm;
bool jumps_within;
bool jumps_outof;
/* True if there is an instruction other than the doloop_end which uses the
iteration register. */
bool iter_reg_used;
/* True if the iteration register lives past the doloop instruction. */
bool iter_reg_used_outside;
/* Hard registers set at any point in the loop, except for the loop counter
register's set in the doloop_end instruction. */
HARD_REG_SET regs_set_in_loop;
};
/* A set of hooks to be defined by a target that wants to use the reorg_loops
functionality.
reorg_loops is intended to handle cases where special hardware loop
setup instructions are required before the loop, for example to set
up loop counter registers that are not exposed to the register
allocator, or to inform the hardware about loop bounds.
reorg_loops performs analysis to discover loop_end patterns created
by the earlier loop-doloop pass, and sets up a hwloop_info
structure for each such insn it finds. It then tries to discover
the basic blocks containing the loop by tracking the lifetime of
the iteration register.
If a valid loop can't be found, the FAIL function is called;
otherwise the OPT function is called for each loop, visiting
innermost loops first and ascending. */
struct hw_doloop_hooks
{
/* Examine INSN. If it is a suitable doloop_end pattern, return the
iteration register, which should be a single hard register.
Otherwise, return NULL_RTX. */
recog_memoized works on an rtx_insn * gcc/ChangeLog: 2014-09-09 David Malcolm <dmalcolm@redhat.com> * caller-save.c (rtx saveinsn): Strengthen this variable from rtx to rtx_insn *. (restinsn): Likewise. * config/aarch64/aarch64-protos.h (aarch64_simd_attr_length_move): Likewise for param. * config/aarch64/aarch64.c (aarch64_simd_attr_length_move): Likewise. * config/arc/arc-protos.h (arc_adjust_insn_length): Likewise for first param. (arc_hazard): Likewise for both params. * config/arc/arc.c (arc600_corereg_hazard): Likewise, adding checked casts to rtx_sequence * and uses of the insn method for type-safety. (arc_hazard): Strengthen both params from rtx to rtx_insn *. (arc_adjust_insn_length): Likewise for param "insn". (struct insn_length_parameters_s): Likewise for first param of "get_variants" callback field. (arc_get_insn_variants): Likewise for first param and local "inner". Replace a check of GET_CODE with a dyn_cast to rtx_sequence *, using methods for type-safety and clarity. * config/arc/arc.h (ADJUST_INSN_LENGTH): Use casts to rtx_sequence * and uses of the insn method for type-safety when invoking arc_adjust_insn_length. * config/arm/arm-protos.h (arm_attr_length_move_neon): Likewise for param. (arm_address_offset_is_imm): Likewise. (struct tune_params): Likewise for params 1 and 3 of the "sched_adjust_cost" callback field. * config/arm/arm.c (cortex_a9_sched_adjust_cost): Likewise for params 1 and 3 ("insn" and "dep"). (xscale_sched_adjust_cost): Likewise. (fa726te_sched_adjust_cost): Likewise. (cortexa7_older_only): Likewise for param "insn". (cortexa7_younger): Likewise. (arm_attr_length_move_neon): Likewise. (arm_address_offset_is_imm): Likewise. * config/avr/avr-protos.h (avr_notice_update_cc): Likewise. * config/avr/avr.c (avr_notice_update_cc): Likewise. * config/bfin/bfin.c (hwloop_pattern_reg): Likewise. (workaround_speculation): Likewise for local "last_condjump". * config/c6x/c6x.c (shadow_p): Likewise for param "insn". (shadow_or_blockage_p): Likewise. (get_unit_reqs): Likewise. (get_unit_operand_masks): Likewise. (c6x_registers_update): Likewise. (returning_call_p): Likewise. (can_use_callp): Likewise. (convert_to_callp): Likewise. (find_last_same_clock): Likwise for local "t". (reorg_split_calls): Likewise for local "shadow". (hwloop_pattern_reg): Likewise for param "insn". * config/frv/frv-protos.h (frv_final_prescan_insn): Likewise. * config/frv/frv.c (frv_final_prescan_insn): Likewise. (frv_extract_membar): Likewise. (frv_optimize_membar_local): Strengthen param "last_membar" from rtx * to rtx_insn **. (frv_optimize_membar_global): Strengthen param "membar" from rtx to rtx_insn *. (frv_optimize_membar): Strengthen local "last_membar" from rtx * to rtx_insn **. * config/ia64/ia64-protos.h (ia64_st_address_bypass_p): Strengthen both params from rtx to rtx_insn *. (ia64_ld_address_bypass_p): Likewise. * config/ia64/ia64.c (ia64_safe_itanium_class): Likewise for param "insn". (ia64_safe_type): Likewise. (group_barrier_needed): Likewise. (safe_group_barrier_needed): Likewise. (ia64_single_set): Likewise. (is_load_p): Likewise. (record_memory_reference): Likewise. (get_mode_no_for_insn): Likewise. (important_for_bundling_p): Likewise. (unknown_for_bundling_p): Likewise. (ia64_st_address_bypass_p): Likewise for both params. (ia64_ld_address_bypass_p): Likewise. (expand_vselect): Introduce new local rtx_insn * "insn", using it in place of rtx "x" after the emit_insn call. * config/i386/i386-protos.h (x86_extended_QIreg_mentioned_p): Strengthen param from rtx to rtx_insn *. (ix86_agi_dependent): Likewise for both params. (ix86_attr_length_immediate_default): Likewise for param 1. (ix86_attr_length_address_default): Likewise for param. (ix86_attr_length_vex_default): Likewise for param 1. * config/i386/i386.c (ix86_attr_length_immediate_default): Likewise for param "insn". (ix86_attr_length_address_default): Likewise. (ix86_attr_length_vex_default): Likewise. (ix86_agi_dependent): Likewise for both params. (x86_extended_QIreg_mentioned_p): Likewise for param "insn". (vselect_insn): Likewise for this variable. * config/m68k/m68k-protos.h (m68k_sched_attr_opx_type): Likewise for param 1. (m68k_sched_attr_opy_type): Likewise. * config/m68k/m68k.c (sched_get_operand): Likewise. (sched_attr_op_type): Likewise. (m68k_sched_attr_opx_type): Likewise. (m68k_sched_attr_opy_type): Likewise. (sched_get_reg_operand): Likewise. (sched_get_mem_operand): Likewise. (m68k_sched_address_bypass_p): Likewise for both params. (sched_get_indexed_address_scale): Likewise. (m68k_sched_indexed_address_bypass_p): Likewise. * config/m68k/m68k.h (m68k_sched_address_bypass_p): Likewise. (m68k_sched_indexed_address_bypass_p): Likewise. * config/mep/mep.c (mep_jmp_return_reorg): Strengthen locals "label", "ret" from rtx to rtx_insn *, adding a checked cast and removing another. * config/mips/mips-protos.h (mips_linked_madd_p): Strengthen both params from rtx to rtx_insn *. (mips_fmadd_bypass): Likewise. * config/mips/mips.c (mips_fmadd_bypass): Likewise. (mips_linked_madd_p): Likewise. (mips_macc_chains_last_hilo): Likewise for this variable. (mips_macc_chains_record): Likewise for param. (vr4130_last_insn): Likewise for this variable. (vr4130_swap_insns_p): Likewise for both params. (mips_ls2_variable_issue): Likewise for param. (mips_need_noat_wrapper_p): Likewise for param "insn". (mips_expand_vselect): Add a new local rtx_insn * "insn", using it in place of "x" after the emit_insn. * config/pa/pa-protos.h (pa_fpstore_bypass_p): Strengthen both params from rtx to rtx_insn *. * config/pa/pa.c (pa_fpstore_bypass_p): Likewise. (pa_combine_instructions): Introduce local "par" for result of gen_rtx_PARALLEL, moving decl and usage of new_rtx for after call to make_insn_raw. (pa_can_combine_p): Strengthen param "new_rtx" from rtx to rtx_insn *. * config/rl78/rl78.c (insn_ok_now): Likewise for param "insn". (rl78_alloc_physical_registers_op1): Likewise. (rl78_alloc_physical_registers_op2): Likewise. (rl78_alloc_physical_registers_ro1): Likewise. (rl78_alloc_physical_registers_cmp): Likewise. (rl78_alloc_physical_registers_umul): Likewise. (rl78_alloc_address_registers_macax): Likewise. (rl78_alloc_physical_registers): Likewise for locals "insn", "curr". * config/s390/predicates.md (execute_operation): Likewise for local "insn". * config/s390/s390-protos.h (s390_agen_dep_p): Likewise for both params. * config/s390/s390.c (s390_safe_attr_type): Likewise for param. (addr_generation_dependency_p): Likewise for param "insn". (s390_agen_dep_p): Likewise for both params. (s390_fpload_toreg): Likewise for param "insn". * config/sh/sh-protos.h (sh_loop_align): Likewise for param. * config/sh/sh.c (sh_loop_align): Likewise for param and local "next". * config/sh/sh.md (define_peephole2): Likewise for local "insn2". * config/sh/sh_treg_combine.cc (sh_treg_combine::make_inv_ccreg_insn): Likewise for return type and local "i". (sh_treg_combine::try_eliminate_cstores): Likewise for local "i". * config/stormy16/stormy16.c (combine_bnp): Likewise for locals "and_insn", "load", "shift". * config/tilegx/tilegx.c (match_pcrel_step2): Likewise for param "insn". * final.c (final_scan_insn): Introduce local rtx_insn * "other" for XEXP (note, 0) of the REG_CC_SETTER note. (cleanup_subreg_operands): Strengthen param "insn" from rtx to rtx_insn *, eliminating a checked cast made redundant by this. * gcse.c (process_insert_insn): Strengthen local "insn" from rtx to rtx_insn *. * genattr.c (main): When writing out the prototype to const_num_delay_slots, strengthen the param from rtx to rtx_insn *. * genattrtab.c (write_const_num_delay_slots): Likewise when writing out the implementation of const_num_delay_slots. * hw-doloop.h (struct hw_doloop_hooks): Strengthen the param "insn" of callback field "end_pattern_reg" from rtx to rtx_insn *. * ifcvt.c (noce_emit_store_flag): Eliminate local rtx "tmp" in favor of new rtx locals "src" and "set" and new local rtx_insn * "insn" and "seq". (noce_emit_move_insn): Strengthen locals "seq" and "insn" from rtx to rtx_insn *. (noce_emit_cmove): Eliminate local rtx "tmp" in favor of new rtx locals "cond", "if_then_else", "set" and new rtx_insn * locals "insn" and "seq". (noce_try_cmove_arith): Strengthen locals "insn_a" and "insn_b", "last" from rtx to rtx_insn *. Likewise for a local "tmp", renaming to "tmp_insn". Eliminate the other local rtx "tmp" from the top-level scope, replacing with new more tightly-scoped rtx locals "reg", "pat", "mem" and rtx_insn * "insn", "copy_of_a", "new_insn", "copy_of_insn_b", and make local rtx "set" more tightly-scoped. * ira-int.h (ira_setup_alts): Strengthen param "insn" from rtx to rtx_insn *. * ira.c (setup_prohibited_mode_move_regs): Likewise for local "move_insn". (ira_setup_alts): Likewise for param "insn". * lra-constraints.c (emit_inc): Likewise for local "add_insn". * lra.c (emit_add3_insn): Split local rtx "insn" in two, an rtx and an rtx_insn *. (lra_emit_add): Eliminate top-level local rtx "insn" in favor of new more-tightly scoped rtx locals "add3_insn", "insn", "add2_insn" and rtx_insn * "move_insn". * postreload-gcse.c (eliminate_partially_redundant_load): Add checked cast on result of gen_move_insn when invoking extract_insn. * recog.c (insn_invalid_p): Strengthen param "insn" from rtx to rtx_insn *. (verify_changes): Add a checked cast on "object" when invoking insn_invalid_p. (extract_insn_cached): Strengthen param "insn" from rtx to rtx_insn *. (extract_constrain_insn_cached): Likewise. (extract_insn): Likewise. * recog.h (insn_invalid_p): Likewise for param 1. (recog_memoized): Likewise for param. (extract_insn): Likewise. (extract_constrain_insn_cached): Likewise. (extract_insn_cached): Likewise. * reload.c (can_reload_into): Likewise for local "test_insn". * reload.h (cleanup_subreg_operands): Likewise for param. * reload1.c (emit_insn_if_valid_for_reload): Rename param from "insn" to "pat", reintroducing "insn" as an rtx_insn * on the result of emit_insn. Remove a checked cast made redundant by this change. * sel-sched-ir.c (sel_insn_rtx_cost): Strengthen param "insn" from rtx to rtx_insn *. * sel-sched.c (get_reg_class): Likewise. From-SVN: r215087
2014-09-09 18:34:56 +02:00
rtx (*end_pattern_reg) (rtx_insn *insn);
/* Optimize LOOP. The target should perform any additional analysis
(e.g. checking that the loop isn't too long), and then perform
its transformations. Return true if successful, false if the
loop should be marked bad. If it returns false, the FAIL
function is called. */
bool (*opt) (hwloop_info loop);
/* Handle a loop that was marked bad for any reason. This could be
used to split the doloop_end pattern. */
void (*fail) (hwloop_info loop);
};
extern void reorg_loops (bool, struct hw_doloop_hooks *);
#endif /* GCC_HW_DOLOOP_H */