You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.2KB

  1. /* Traits for hashing trees.
  2. Copyright (C) 2014-2020 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 tree_hash_traits_h
  16. #define tree_hash_traits_h
  17. /* Hash for trees based on operand_equal_p. */
  18. struct tree_operand_hash : ggc_ptr_hash <tree_node>
  19. {
  20. static inline hashval_t hash (const value_type &);
  21. static inline bool equal (const value_type &,
  22. const compare_type &);
  23. };
  24. inline hashval_t
  25. tree_operand_hash::hash (const value_type &t)
  26. {
  27. return iterative_hash_expr (t, 0);
  28. }
  29. inline bool
  30. tree_operand_hash::equal (const value_type &t1,
  31. const compare_type &t2)
  32. {
  33. return operand_equal_p (t1, t2, 0);
  34. }
  35. #endif