gimple-ssa-evrp-analyze.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /* Support routines for Value Range Propagation (VRP).
  2. Copyright (C) 2016-2019 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. value_range *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 *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. value_range *pop_value_range (tree var);
  51. value_range *try_find_new_range (tree, tree op, tree_code code, tree limit);
  52. void record_ranges_from_incoming_edge (basic_block);
  53. void record_ranges_from_phis (basic_block);
  54. void set_ssa_range_info (tree, value_range *);
  55. /* STACK holds the old VR. */
  56. auto_vec<std::pair <tree, value_range*> > stack;
  57. /* True if we are updating global ranges, false otherwise. */
  58. bool m_update_global_ranges;
  59. };
  60. #endif /* GCC_GIMPLE_SSA_EVRP_ANALYZE_H */