tree-ssa-loop.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /* Header file for SSA loop optimizations.
  2. Copyright (C) 2013-2019 Free Software Foundation, Inc.
  3. This file is part of GCC.
  4. GCC is free software; you can redistribute it and/or modify it under
  5. the terms of the GNU General Public License as published by the Free
  6. Software Foundation; either version 3, or (at your option) any later
  7. version.
  8. GCC is distributed in the hope that it will be useful, but WITHOUT ANY
  9. WARRANTY; without even the implied warranty of MERCHANTABILITY or
  10. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  11. for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GCC; see the file COPYING3. If not see
  14. <http://www.gnu.org/licenses/>. */
  15. #ifndef GCC_TREE_SSA_LOOP_H
  16. #define GCC_TREE_SSA_LOOP_H
  17. /* Affine iv. */
  18. struct affine_iv
  19. {
  20. /* Iv = BASE + STEP * i. */
  21. tree base, step;
  22. /* True if this iv does not overflow. */
  23. bool no_overflow;
  24. };
  25. /* Description of number of iterations of a loop. All the expressions inside
  26. the structure can be evaluated at the end of the loop's preheader
  27. (and due to ssa form, also anywhere inside the body of the loop). */
  28. struct tree_niter_desc
  29. {
  30. tree assumptions; /* The boolean expression. If this expression evaluates
  31. to false, then the other fields in this structure
  32. should not be used; there is no guarantee that they
  33. will be correct. */
  34. tree may_be_zero; /* The boolean expression. If it evaluates to true,
  35. the loop will exit in the first iteration (i.e.
  36. its latch will not be executed), even if the niter
  37. field says otherwise. */
  38. tree niter; /* The expression giving the number of iterations of
  39. a loop (provided that assumptions == true and
  40. may_be_zero == false), more precisely the number
  41. of executions of the latch of the loop. */
  42. widest_int max; /* The upper bound on the number of iterations of
  43. the loop. */
  44. /* The simplified shape of the exit condition. The loop exits if
  45. CONTROL CMP BOUND is false, where CMP is one of NE_EXPR,
  46. LT_EXPR, or GT_EXPR, and step of CONTROL is positive if CMP is
  47. LE_EXPR and negative if CMP is GE_EXPR. This information is used
  48. by loop unrolling. */
  49. affine_iv control;
  50. tree bound;
  51. enum tree_code cmp;
  52. };
  53. extern bool for_each_index (tree *, bool (*) (tree, tree *, void *), void *);
  54. extern char *get_lsm_tmp_name (tree ref, unsigned n, const char *suffix = NULL);
  55. extern unsigned tree_num_loop_insns (struct loop *, struct eni_weights *);
  56. /* Returns the loop of the statement STMT. */
  57. static inline struct loop *
  58. loop_containing_stmt (gimple *stmt)
  59. {
  60. basic_block bb = gimple_bb (stmt);
  61. if (!bb)
  62. return NULL;
  63. return bb->loop_father;
  64. }
  65. #endif /* GCC_TREE_SSA_LOOP_H */