1c87b03e5Sespie /* Loop optimization definitions for GNU C-Compiler 2c87b03e5Sespie Copyright (C) 1991, 1995, 1998, 1999, 2000, 2001, 2002 3c87b03e5Sespie Free Software Foundation, Inc. 4c87b03e5Sespie 5c87b03e5Sespie This file is part of GCC. 6c87b03e5Sespie 7c87b03e5Sespie GCC is free software; you can redistribute it and/or modify it under 8c87b03e5Sespie the terms of the GNU General Public License as published by the Free 9c87b03e5Sespie Software Foundation; either version 2, or (at your option) any later 10c87b03e5Sespie version. 11c87b03e5Sespie 12c87b03e5Sespie GCC is distributed in the hope that it will be useful, but WITHOUT ANY 13c87b03e5Sespie WARRANTY; without even the implied warranty of MERCHANTABILITY or 14c87b03e5Sespie FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15c87b03e5Sespie for more details. 16c87b03e5Sespie 17c87b03e5Sespie You should have received a copy of the GNU General Public License 18c87b03e5Sespie along with GCC; see the file COPYING. If not, write to the Free 19c87b03e5Sespie Software Foundation, 59 Temple Place - Suite 330, Boston, MA 20c87b03e5Sespie 02111-1307, USA. */ 21c87b03e5Sespie 22c87b03e5Sespie #include "bitmap.h" 23c87b03e5Sespie #include "sbitmap.h" 24c87b03e5Sespie #include "hard-reg-set.h" 25c87b03e5Sespie #include "basic-block.h" 26c87b03e5Sespie 27c87b03e5Sespie /* Flags passed to loop_optimize. */ 28c87b03e5Sespie #define LOOP_UNROLL 1 29c87b03e5Sespie #define LOOP_BCT 2 30c87b03e5Sespie #define LOOP_PREFETCH 4 31c87b03e5Sespie #define LOOP_AUTO_UNROLL 8 32c87b03e5Sespie 33c87b03e5Sespie /* Get the loop info pointer of a loop. */ 34c87b03e5Sespie #define LOOP_INFO(LOOP) ((struct loop_info *) (LOOP)->aux) 35c87b03e5Sespie 36c87b03e5Sespie /* Get a pointer to the loop movables structure. */ 37c87b03e5Sespie #define LOOP_MOVABLES(LOOP) (&LOOP_INFO (LOOP)->movables) 38c87b03e5Sespie 39c87b03e5Sespie /* Get a pointer to the loop registers structure. */ 40c87b03e5Sespie #define LOOP_REGS(LOOP) (&LOOP_INFO (LOOP)->regs) 41c87b03e5Sespie 42c87b03e5Sespie /* Get a pointer to the loop induction variables structure. */ 43c87b03e5Sespie #define LOOP_IVS(LOOP) (&LOOP_INFO (LOOP)->ivs) 44c87b03e5Sespie 45c87b03e5Sespie /* Get the luid of an insn. Catch the error of trying to reference the LUID 46c87b03e5Sespie of an insn added during loop, since these don't have LUIDs. */ 47c87b03e5Sespie 48c87b03e5Sespie #define INSN_LUID(INSN) \ 49c87b03e5Sespie (INSN_UID (INSN) < max_uid_for_loop ? uid_luid[INSN_UID (INSN)] \ 50c87b03e5Sespie : (abort (), -1)) 51c87b03e5Sespie 52c87b03e5Sespie #define REGNO_FIRST_LUID(REGNO) uid_luid[REGNO_FIRST_UID (REGNO)] 53c87b03e5Sespie #define REGNO_LAST_LUID(REGNO) uid_luid[REGNO_LAST_UID (REGNO)] 54*4e43c760Sespie #define REGNO_LAST_NOTE_LUID(REGNO) uid_luid[REGNO_LAST_NOTE_UID (REGNO)] 55c87b03e5Sespie 56c87b03e5Sespie 57c87b03e5Sespie /* A "basic induction variable" or biv is a pseudo reg that is set 58c87b03e5Sespie (within this loop) only by incrementing or decrementing it. */ 59c87b03e5Sespie /* A "general induction variable" or giv is a pseudo reg whose 60c87b03e5Sespie value is a linear function of a biv. */ 61c87b03e5Sespie 62c87b03e5Sespie /* Bivs are recognized by `basic_induction_var'; 63c87b03e5Sespie Givs by `general_induction_var'. */ 64c87b03e5Sespie 65c87b03e5Sespie /* An enum for the two different types of givs, those that are used 66c87b03e5Sespie as memory addresses and those that are calculated into registers. */ 67c87b03e5Sespie enum g_types 68c87b03e5Sespie { 69c87b03e5Sespie DEST_ADDR, 70c87b03e5Sespie DEST_REG 71c87b03e5Sespie }; 72c87b03e5Sespie 73c87b03e5Sespie 74c87b03e5Sespie /* A `struct induction' is created for every instruction that sets 75c87b03e5Sespie an induction variable (either a biv or a giv). */ 76c87b03e5Sespie 77c87b03e5Sespie struct induction 78c87b03e5Sespie { 79c87b03e5Sespie rtx insn; /* The insn that sets a biv or giv */ 80c87b03e5Sespie rtx new_reg; /* New register, containing strength reduced 81c87b03e5Sespie version of this giv. */ 82c87b03e5Sespie rtx src_reg; /* Biv from which this giv is computed. 83c87b03e5Sespie (If this is a biv, then this is the biv.) */ 84c87b03e5Sespie enum g_types giv_type; /* Indicate whether DEST_ADDR or DEST_REG */ 85c87b03e5Sespie rtx dest_reg; /* Destination register for insn: this is the 86c87b03e5Sespie register which was the biv or giv. 87c87b03e5Sespie For a biv, this equals src_reg. 88c87b03e5Sespie For a DEST_ADDR type giv, this is 0. */ 89c87b03e5Sespie rtx *location; /* Place in the insn where this giv occurs. 90c87b03e5Sespie If GIV_TYPE is DEST_REG, this is 0. */ 91c87b03e5Sespie /* For a biv, this is the place where add_val 92c87b03e5Sespie was found. */ 93c87b03e5Sespie enum machine_mode mode; /* The mode of this biv or giv */ 94c87b03e5Sespie rtx mem; /* For DEST_ADDR, the memory object. */ 95c87b03e5Sespie rtx mult_val; /* Multiplicative factor for src_reg. */ 96c87b03e5Sespie rtx add_val; /* Additive constant for that product. */ 97c87b03e5Sespie int benefit; /* Gain from eliminating this insn. */ 98c87b03e5Sespie rtx final_value; /* If the giv is used outside the loop, and its 99c87b03e5Sespie final value could be calculated, it is put 100c87b03e5Sespie here, and the giv is made replaceable. Set 101c87b03e5Sespie the giv to this value before the loop. */ 102c87b03e5Sespie unsigned combined_with; /* The number of givs this giv has been 103c87b03e5Sespie combined with. If nonzero, this giv 104c87b03e5Sespie cannot combine with any other giv. */ 105c87b03e5Sespie unsigned replaceable : 1; /* 1 if we can substitute the strength-reduced 106c87b03e5Sespie variable for the original variable. 107c87b03e5Sespie 0 means they must be kept separate and the 108c87b03e5Sespie new one must be copied into the old pseudo 109c87b03e5Sespie reg each time the old one is set. */ 110c87b03e5Sespie unsigned not_replaceable : 1; /* Used to prevent duplicating work. This is 111c87b03e5Sespie 1 if we know that the giv definitely can 112c87b03e5Sespie not be made replaceable, in which case we 113c87b03e5Sespie don't bother checking the variable again 114c87b03e5Sespie even if further info is available. 115c87b03e5Sespie Both this and the above can be zero. */ 116c87b03e5Sespie unsigned ignore : 1; /* 1 prohibits further processing of giv */ 117c87b03e5Sespie unsigned always_computable : 1;/* 1 if this value is computable every 118c87b03e5Sespie iteration. */ 119c87b03e5Sespie unsigned always_executed : 1; /* 1 if this set occurs each iteration. */ 120c87b03e5Sespie unsigned maybe_multiple : 1; /* Only used for a biv and 1 if this biv 121c87b03e5Sespie update may be done multiple times per 122c87b03e5Sespie iteration. */ 123c87b03e5Sespie unsigned cant_derive : 1; /* For giv's, 1 if this giv cannot derive 124c87b03e5Sespie another giv. This occurs in many cases 125c87b03e5Sespie where a giv's lifetime spans an update to 126c87b03e5Sespie a biv. */ 127c87b03e5Sespie unsigned maybe_dead : 1; /* 1 if this giv might be dead. In that case, 128c87b03e5Sespie we won't use it to eliminate a biv, it 129c87b03e5Sespie would probably lose. */ 130c87b03e5Sespie unsigned auto_inc_opt : 1; /* 1 if this giv had its increment output next 131c87b03e5Sespie to it to try to form an auto-inc address. */ 132c87b03e5Sespie unsigned unrolled : 1; /* 1 if new register has been allocated and 133c87b03e5Sespie initialized in unrolled loop. */ 134c87b03e5Sespie unsigned shared : 1; 135c87b03e5Sespie unsigned no_const_addval : 1; /* 1 if add_val does not contain a const. */ 136c87b03e5Sespie int lifetime; /* Length of life of this giv */ 137c87b03e5Sespie rtx derive_adjustment; /* If nonzero, is an adjustment to be 138c87b03e5Sespie subtracted from add_val when this giv 139c87b03e5Sespie derives another. This occurs when the 140c87b03e5Sespie giv spans a biv update by incrementation. */ 141c87b03e5Sespie rtx ext_dependent; /* If nonzero, is a sign or zero extension 142c87b03e5Sespie if a biv on which this giv is dependent. */ 143c87b03e5Sespie struct induction *next_iv; /* For givs, links together all givs that are 144c87b03e5Sespie based on the same biv. For bivs, links 145c87b03e5Sespie together all biv entries that refer to the 146c87b03e5Sespie same biv register. */ 147c87b03e5Sespie struct induction *same; /* For givs, if the giv has been combined with 148c87b03e5Sespie another giv, this points to the base giv. 149c87b03e5Sespie The base giv will have COMBINED_WITH nonzero. 150c87b03e5Sespie For bivs, if the biv has the same LOCATION 151c87b03e5Sespie than another biv, this points to the base 152c87b03e5Sespie biv. */ 153c87b03e5Sespie HOST_WIDE_INT const_adjust; /* Used by loop unrolling, when an address giv 154c87b03e5Sespie is split, and a constant is eliminated from 155c87b03e5Sespie the address, the -constant is stored here 156c87b03e5Sespie for later use. */ 157c87b03e5Sespie struct induction *same_insn; /* If there are multiple identical givs in 158c87b03e5Sespie the same insn, then all but one have this 159c87b03e5Sespie field set, and they all point to the giv 160c87b03e5Sespie that doesn't have this field set. */ 161c87b03e5Sespie rtx last_use; /* For a giv made from a biv increment, this is 162c87b03e5Sespie a substitute for the lifetime information. */ 163c87b03e5Sespie }; 164c87b03e5Sespie 165c87b03e5Sespie 166c87b03e5Sespie /* A `struct iv_class' is created for each biv. */ 167c87b03e5Sespie 168c87b03e5Sespie struct iv_class 169c87b03e5Sespie { 170c87b03e5Sespie unsigned int regno; /* Pseudo reg which is the biv. */ 171c87b03e5Sespie int biv_count; /* Number of insns setting this reg. */ 172c87b03e5Sespie struct induction *biv; /* List of all insns that set this reg. */ 173c87b03e5Sespie int giv_count; /* Number of DEST_REG givs computed from this 174c87b03e5Sespie biv. The resulting count is only used in 175c87b03e5Sespie check_dbra_loop. */ 176c87b03e5Sespie struct induction *giv; /* List of all insns that compute a giv 177c87b03e5Sespie from this reg. */ 178c87b03e5Sespie int total_benefit; /* Sum of BENEFITs of all those givs. */ 179c87b03e5Sespie rtx initial_value; /* Value of reg at loop start. */ 180c87b03e5Sespie rtx initial_test; /* Test performed on BIV before loop. */ 181c87b03e5Sespie rtx final_value; /* Value of reg at loop end, if known. */ 182c87b03e5Sespie struct iv_class *next; /* Links all class structures together. */ 183c87b03e5Sespie rtx init_insn; /* insn which initializes biv, 0 if none. */ 184c87b03e5Sespie rtx init_set; /* SET of INIT_INSN, if any. */ 185c87b03e5Sespie unsigned incremented : 1; /* 1 if somewhere incremented/decremented */ 186c87b03e5Sespie unsigned eliminable : 1; /* 1 if plausible candidate for 187c87b03e5Sespie elimination. */ 188c87b03e5Sespie unsigned nonneg : 1; /* 1 if we added a REG_NONNEG note for 189c87b03e5Sespie this. */ 190c87b03e5Sespie unsigned reversed : 1; /* 1 if we reversed the loop that this 191c87b03e5Sespie biv controls. */ 192c87b03e5Sespie unsigned all_reduced : 1; /* 1 if all givs using this biv have 193c87b03e5Sespie been reduced. */ 194c87b03e5Sespie }; 195c87b03e5Sespie 196c87b03e5Sespie 197c87b03e5Sespie /* Definitions used by the basic induction variable discovery code. */ 198c87b03e5Sespie enum iv_mode 199c87b03e5Sespie { 200c87b03e5Sespie UNKNOWN_INDUCT, 201c87b03e5Sespie BASIC_INDUCT, 202c87b03e5Sespie NOT_BASIC_INDUCT, 203c87b03e5Sespie GENERAL_INDUCT 204c87b03e5Sespie }; 205c87b03e5Sespie 206c87b03e5Sespie 207c87b03e5Sespie /* A `struct iv' is created for every register. */ 208c87b03e5Sespie 209c87b03e5Sespie struct iv 210c87b03e5Sespie { 211c87b03e5Sespie enum iv_mode type; 212c87b03e5Sespie union 213c87b03e5Sespie { 214c87b03e5Sespie struct iv_class *class; 215c87b03e5Sespie struct induction *info; 216c87b03e5Sespie } iv; 217c87b03e5Sespie }; 218c87b03e5Sespie 219c87b03e5Sespie 220c87b03e5Sespie #define REG_IV_TYPE(ivs, n) ivs->regs[n].type 221c87b03e5Sespie #define REG_IV_INFO(ivs, n) ivs->regs[n].iv.info 222c87b03e5Sespie #define REG_IV_CLASS(ivs, n) ivs->regs[n].iv.class 223c87b03e5Sespie 224c87b03e5Sespie 225c87b03e5Sespie struct loop_ivs 226c87b03e5Sespie { 227c87b03e5Sespie /* Indexed by register number, contains pointer to `struct 228c87b03e5Sespie iv' if register is an induction variable. */ 229c87b03e5Sespie struct iv *regs; 230c87b03e5Sespie 231c87b03e5Sespie /* Size of regs array. */ 232c87b03e5Sespie unsigned int n_regs; 233c87b03e5Sespie 234c87b03e5Sespie /* The head of a list which links together (via the next field) 235c87b03e5Sespie every iv class for the current loop. */ 236c87b03e5Sespie struct iv_class *list; 237c87b03e5Sespie }; 238c87b03e5Sespie 239c87b03e5Sespie 240c87b03e5Sespie typedef struct loop_mem_info 241c87b03e5Sespie { 242c87b03e5Sespie rtx mem; /* The MEM itself. */ 243c87b03e5Sespie rtx reg; /* Corresponding pseudo, if any. */ 244c87b03e5Sespie int optimize; /* Nonzero if we can optimize access to this MEM. */ 245c87b03e5Sespie } loop_mem_info; 246c87b03e5Sespie 247c87b03e5Sespie 248c87b03e5Sespie 249c87b03e5Sespie struct loop_reg 250c87b03e5Sespie { 251c87b03e5Sespie /* Number of times the reg is set during the loop being scanned. 252c87b03e5Sespie During code motion, a negative value indicates a reg that has 253c87b03e5Sespie been made a candidate; in particular -2 means that it is an 254c87b03e5Sespie candidate that we know is equal to a constant and -1 means that 255c87b03e5Sespie it is a candidate not known equal to a constant. After code 256c87b03e5Sespie motion, regs moved have 0 (which is accurate now) while the 257c87b03e5Sespie failed candidates have the original number of times set. 258c87b03e5Sespie 259c87b03e5Sespie Therefore, at all times, == 0 indicates an invariant register; 260c87b03e5Sespie < 0 a conditionally invariant one. */ 261c87b03e5Sespie int set_in_loop; 262c87b03e5Sespie 263c87b03e5Sespie /* Original value of set_in_loop; same except that this value 264c87b03e5Sespie is not set negative for a reg whose sets have been made candidates 265c87b03e5Sespie and not set to 0 for a reg that is moved. */ 266c87b03e5Sespie int n_times_set; 267c87b03e5Sespie 268c87b03e5Sespie /* Contains the insn in which a register was used if it was used 269c87b03e5Sespie exactly once; contains const0_rtx if it was used more than once. */ 270c87b03e5Sespie rtx single_usage; 271c87b03e5Sespie 272c87b03e5Sespie /* Nonzero indicates that the register cannot be moved or strength 273c87b03e5Sespie reduced. */ 274c87b03e5Sespie char may_not_optimize; 275c87b03e5Sespie 276c87b03e5Sespie /* Nonzero means reg N has already been moved out of one loop. 277c87b03e5Sespie This reduces the desire to move it out of another. */ 278c87b03e5Sespie char moved_once; 279c87b03e5Sespie }; 280c87b03e5Sespie 281c87b03e5Sespie 282c87b03e5Sespie struct loop_regs 283c87b03e5Sespie { 284c87b03e5Sespie int num; /* Number of regs used in table. */ 285c87b03e5Sespie int size; /* Size of table. */ 286c87b03e5Sespie struct loop_reg *array; /* Register usage info. array. */ 287c87b03e5Sespie int multiple_uses; /* Nonzero if a reg has multiple uses. */ 288c87b03e5Sespie }; 289c87b03e5Sespie 290c87b03e5Sespie 291c87b03e5Sespie 292c87b03e5Sespie struct loop_movables 293c87b03e5Sespie { 294c87b03e5Sespie /* Head of movable chain. */ 295c87b03e5Sespie struct movable *head; 296c87b03e5Sespie /* Last movable in chain. */ 297c87b03e5Sespie struct movable *last; 298c87b03e5Sespie }; 299c87b03e5Sespie 300c87b03e5Sespie 301c87b03e5Sespie /* Information pertaining to a loop. */ 302c87b03e5Sespie 303c87b03e5Sespie struct loop_info 304c87b03e5Sespie { 305c87b03e5Sespie /* Nonzero if there is a subroutine call in the current loop. */ 306c87b03e5Sespie int has_call; 307c87b03e5Sespie /* Nonzero if there is a libcall in the current loop. */ 308c87b03e5Sespie int has_libcall; 309c87b03e5Sespie /* Nonzero if there is a non constant call in the current loop. */ 310c87b03e5Sespie int has_nonconst_call; 311c87b03e5Sespie /* Nonzero if there is a prefetch instruction in the current loop. */ 312c87b03e5Sespie int has_prefetch; 313c87b03e5Sespie /* Nonzero if there is a volatile memory reference in the current 314c87b03e5Sespie loop. */ 315c87b03e5Sespie int has_volatile; 316c87b03e5Sespie /* Nonzero if there is a tablejump in the current loop. */ 317c87b03e5Sespie int has_tablejump; 318c87b03e5Sespie /* Nonzero if there are ways to leave the loop other than falling 319c87b03e5Sespie off the end. */ 320c87b03e5Sespie int has_multiple_exit_targets; 321c87b03e5Sespie /* Nonzero if there is an indirect jump in the current function. */ 322c87b03e5Sespie int has_indirect_jump; 323c87b03e5Sespie /* Whether loop unrolling has emitted copies of the loop body so 324c87b03e5Sespie that the main loop needs no exit tests. */ 325c87b03e5Sespie int preconditioned; 326c87b03e5Sespie /* Register or constant initial loop value. */ 327c87b03e5Sespie rtx initial_value; 328c87b03e5Sespie /* Register or constant value used for comparison test. */ 329c87b03e5Sespie rtx comparison_value; 330c87b03e5Sespie /* Register or constant approximate final value. */ 331c87b03e5Sespie rtx final_value; 332c87b03e5Sespie /* Register or constant initial loop value with term common to 333c87b03e5Sespie final_value removed. */ 334c87b03e5Sespie rtx initial_equiv_value; 335c87b03e5Sespie /* Register or constant final loop value with term common to 336c87b03e5Sespie initial_value removed. */ 337c87b03e5Sespie rtx final_equiv_value; 338c87b03e5Sespie /* Register corresponding to iteration variable. */ 339c87b03e5Sespie rtx iteration_var; 340c87b03e5Sespie /* Constant loop increment. */ 341c87b03e5Sespie rtx increment; 342c87b03e5Sespie enum rtx_code comparison_code; 343c87b03e5Sespie /* Holds the number of loop iterations. It is zero if the number 344c87b03e5Sespie could not be calculated. Must be unsigned since the number of 345c87b03e5Sespie iterations can be as high as 2^wordsize - 1. For loops with a 346c87b03e5Sespie wider iterator, this number will be zero if the number of loop 347c87b03e5Sespie iterations is too large for an unsigned integer to hold. */ 348c87b03e5Sespie unsigned HOST_WIDE_INT n_iterations; 349c87b03e5Sespie /* The number of times the loop body was unrolled. */ 350c87b03e5Sespie unsigned int unroll_number; 351c87b03e5Sespie int used_count_register; 352c87b03e5Sespie /* The loop iterator induction variable. */ 353c87b03e5Sespie struct iv_class *iv; 354c87b03e5Sespie /* List of MEMs that are stored in this loop. */ 355c87b03e5Sespie rtx store_mems; 356c87b03e5Sespie /* Array of MEMs that are used (read or written) in this loop, but 357c87b03e5Sespie cannot be aliased by anything in this loop, except perhaps 358c87b03e5Sespie themselves. In other words, if mems[i] is altered during 359c87b03e5Sespie the loop, it is altered by an expression that is rtx_equal_p to 360c87b03e5Sespie it. */ 361c87b03e5Sespie loop_mem_info *mems; 362c87b03e5Sespie /* The index of the next available slot in MEMS. */ 363c87b03e5Sespie int mems_idx; 364c87b03e5Sespie /* The number of elements allocated in MEMS. */ 365c87b03e5Sespie int mems_allocated; 366c87b03e5Sespie /* Nonzero if we don't know what MEMs were changed in the current 367c87b03e5Sespie loop. This happens if the loop contains a call (in which case 368c87b03e5Sespie `has_call' will also be set) or if we store into more than 369c87b03e5Sespie NUM_STORES MEMs. */ 370c87b03e5Sespie int unknown_address_altered; 371c87b03e5Sespie /* The above doesn't count any readonly memory locations that are 372c87b03e5Sespie stored. This does. */ 373c87b03e5Sespie int unknown_constant_address_altered; 374c87b03e5Sespie /* Count of memory write instructions discovered in the loop. */ 375c87b03e5Sespie int num_mem_sets; 376c87b03e5Sespie /* The insn where the first of these was found. */ 377c87b03e5Sespie rtx first_loop_store_insn; 378c87b03e5Sespie /* The chain of movable insns in loop. */ 379c87b03e5Sespie struct loop_movables movables; 380c87b03e5Sespie /* The registers used the in loop. */ 381c87b03e5Sespie struct loop_regs regs; 382c87b03e5Sespie /* The induction variable information in loop. */ 383c87b03e5Sespie struct loop_ivs ivs; 384c87b03e5Sespie /* Nonzero if call is in pre_header extended basic block. */ 385c87b03e5Sespie int pre_header_has_call; 386c87b03e5Sespie }; 387c87b03e5Sespie 388c87b03e5Sespie 389c87b03e5Sespie /* Variables declared in loop.c, but also needed in unroll.c. */ 390c87b03e5Sespie 391c87b03e5Sespie extern int *uid_luid; 392c87b03e5Sespie extern int max_uid_for_loop; 393c87b03e5Sespie extern unsigned int max_reg_before_loop; 394c87b03e5Sespie extern struct loop **uid_loop; 395c87b03e5Sespie extern FILE *loop_dump_stream; 396c87b03e5Sespie 397c87b03e5Sespie 398c87b03e5Sespie /* Forward declarations for non-static functions declared in loop.c and 399c87b03e5Sespie unroll.c. */ 400c87b03e5Sespie int loop_invariant_p PARAMS ((const struct loop *, rtx)); 401c87b03e5Sespie rtx get_condition_for_loop PARAMS ((const struct loop *, rtx)); 402c87b03e5Sespie void loop_iv_add_mult_hoist PARAMS ((const struct loop *, rtx, rtx, rtx, rtx)); 403c87b03e5Sespie void loop_iv_add_mult_sink PARAMS ((const struct loop *, rtx, rtx, rtx, rtx)); 404c87b03e5Sespie void loop_iv_add_mult_emit_before PARAMS ((const struct loop *, rtx, 405c87b03e5Sespie rtx, rtx, rtx, 406c87b03e5Sespie basic_block, rtx)); 407c87b03e5Sespie rtx express_from PARAMS ((struct induction *, struct induction *)); 408c87b03e5Sespie rtx extend_value_for_giv PARAMS ((struct induction *, rtx)); 409c87b03e5Sespie 410c87b03e5Sespie void unroll_loop PARAMS ((struct loop *, int, int)); 411c87b03e5Sespie rtx biv_total_increment PARAMS ((const struct iv_class *)); 412c87b03e5Sespie unsigned HOST_WIDE_INT loop_iterations PARAMS ((struct loop *)); 413c87b03e5Sespie int precondition_loop_p PARAMS ((const struct loop *, 414c87b03e5Sespie rtx *, rtx *, rtx *, 415c87b03e5Sespie enum machine_mode *mode)); 416c87b03e5Sespie rtx final_biv_value PARAMS ((const struct loop *, struct iv_class *)); 417c87b03e5Sespie rtx final_giv_value PARAMS ((const struct loop *, struct induction *)); 418c87b03e5Sespie void emit_unrolled_add PARAMS ((rtx, rtx, rtx)); 419c87b03e5Sespie int back_branch_in_range_p PARAMS ((const struct loop *, rtx)); 420c87b03e5Sespie 421c87b03e5Sespie int loop_insn_first_p PARAMS ((rtx, rtx)); 422c87b03e5Sespie typedef rtx (*loop_insn_callback) PARAMS ((struct loop *, rtx, int, int)); 423c87b03e5Sespie void for_each_insn_in_loop PARAMS ((struct loop *, loop_insn_callback)); 424c87b03e5Sespie rtx loop_insn_emit_before PARAMS((const struct loop *, basic_block, 425c87b03e5Sespie rtx, rtx)); 426c87b03e5Sespie rtx loop_insn_sink PARAMS((const struct loop *, rtx)); 427c87b03e5Sespie rtx loop_insn_hoist PARAMS((const struct loop *, rtx)); 428c87b03e5Sespie 429c87b03e5Sespie /* Forward declarations for non-static functions declared in doloop.c. */ 430c87b03e5Sespie int doloop_optimize PARAMS ((const struct loop *)); 431