gimple-ssa-evrp-analyze.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /* Support routines for Value Range Propagation (VRP).
  2. Copyright (C) 2016-2020 Free Software Foundation, Inc.
  3. This file is part of GCC.
  4. GCC is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3, or (at your option)
  7. any later version.
  8. GCC is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License 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_GIMPLE_SSA_EVRP_ANALYZE_H
  16. #define GCC_GIMPLE_SSA_EVRP_ANALYZE_H
  17. class evrp_range_analyzer
  18. {
  19. public:
  20. evrp_range_analyzer (bool update_global_ranges);
  21. ~evrp_range_analyzer (void)
  22. {
  23. delete vr_values;
  24. stack.release ();
  25. }
  26. void enter (basic_block);
  27. void push_marker (void);
  28. void pop_to_marker (void);
  29. void leave (basic_block);
  30. void record_ranges_from_stmt (gimple *, bool);
  31. /* Main interface to retrieve range information. */
  32. const value_range_equiv *get_value_range (const_tree op)
  33. { return vr_values->get_value_range (op); }
  34. /* Record a new unwindable range. */
  35. void push_value_range (tree var, value_range_equiv *vr);
  36. /* Dump all the current value ranges. This is primarily
  37. a debugging interface. */
  38. void dump_all_value_ranges (FILE *fp)
  39. { vr_values->dump_all_value_ranges (fp); }
  40. /* A bit of a wart. This should ideally go away. */
  41. void vrp_visit_cond_stmt (gcond *cond, edge *e)
  42. { return vr_values->vrp_visit_cond_stmt (cond, e); }
  43. /* Get the underlying vr_values class instance. If TRANSFER is
  44. true, then we are transferring ownership. Else we keep ownership.
  45. This should be converted to a unique_ptr. */
  46. class vr_values *get_vr_values (void) { return vr_values; }
  47. private:
  48. DISABLE_COPY_AND_ASSIGN (evrp_range_analyzer);
  49. class vr_values *vr_values;
  50. void pop_value_range ();
  51. value_range_equiv *try_find_new_range (tree, tree op, tree_code code,
  52. tree limit);
  53. void record_ranges_from_incoming_edge (basic_block);
  54. void record_ranges_from_phis (basic_block);
  55. void set_ssa_range_info (tree, value_range_equiv *);
  56. /* STACK holds the old VR. */
  57. auto_vec<std::pair <tree, value_range_equiv *> > stack;
  58. /* True if we are updating global ranges, false otherwise. */
  59. bool m_update_global_ranges;
  60. };
  61. #endif /* GCC_GIMPLE_SSA_EVRP_ANALYZE_H */