tree-scalar-evolution.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /* Scalar evolution detector.
  2. Copyright (C) 2003-2015 Free Software Foundation, Inc.
  3. Contributed by Sebastian Pop <s.pop@laposte.net>
  4. This file is part of GCC.
  5. GCC is free software; you can redistribute it and/or modify it under
  6. the terms of the GNU General Public License as published by the Free
  7. Software Foundation; either version 3, or (at your option) any later
  8. version.
  9. GCC is distributed in the hope that it will be useful, but WITHOUT ANY
  10. WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  12. for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with GCC; see the file COPYING3. If not see
  15. <http://www.gnu.org/licenses/>. */
  16. #ifndef GCC_TREE_SCALAR_EVOLUTION_H
  17. #define GCC_TREE_SCALAR_EVOLUTION_H
  18. extern tree number_of_latch_executions (struct loop *);
  19. extern gcond *get_loop_exit_condition (const struct loop *);
  20. extern void scev_initialize (void);
  21. extern bool scev_initialized_p (void);
  22. extern void scev_reset (void);
  23. extern void scev_reset_htab (void);
  24. extern void scev_finalize (void);
  25. extern tree analyze_scalar_evolution (struct loop *, tree);
  26. extern tree instantiate_scev (basic_block, struct loop *, tree);
  27. extern tree resolve_mixers (struct loop *, tree);
  28. extern void gather_stats_on_scev_database (void);
  29. extern unsigned int scev_const_prop (void);
  30. extern bool expression_expensive_p (tree);
  31. extern bool simple_iv (struct loop *, struct loop *, tree, struct affine_iv *,
  32. bool);
  33. extern tree compute_overall_effect_of_inner_loop (struct loop *, tree);
  34. /* Returns the basic block preceding LOOP, or the CFG entry block when
  35. the loop is function's body. */
  36. static inline basic_block
  37. block_before_loop (loop_p loop)
  38. {
  39. edge preheader = loop_preheader_edge (loop);
  40. return (preheader ? preheader->src : ENTRY_BLOCK_PTR_FOR_FN (cfun));
  41. }
  42. /* Analyze all the parameters of the chrec that were left under a
  43. symbolic form. LOOP is the loop in which symbolic names have to
  44. be analyzed and instantiated. */
  45. static inline tree
  46. instantiate_parameters (struct loop *loop, tree chrec)
  47. {
  48. return instantiate_scev (block_before_loop (loop), loop, chrec);
  49. }
  50. /* Returns the loop of the polynomial chrec CHREC. */
  51. static inline struct loop *
  52. get_chrec_loop (const_tree chrec)
  53. {
  54. return get_loop (cfun, CHREC_VARIABLE (chrec));
  55. }
  56. #endif /* GCC_TREE_SCALAR_EVOLUTION_H */