Mercurial > hg > CbC > CbC_gcc
comparison gcc/tree-hash-traits.h @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | 84e7813d76e9 |
children |
comparison
equal
deleted
inserted
replaced
131:84e7813d76e9 | 145:1830386684a0 |
---|---|
1 /* Traits for hashing trees. | 1 /* Traits for hashing trees. |
2 Copyright (C) 2014-2018 Free Software Foundation, Inc. | 2 Copyright (C) 2014-2020 Free Software Foundation, Inc. |
3 | 3 |
4 This file is part of GCC. | 4 This file is part of GCC. |
5 | 5 |
6 GCC is free software; you can redistribute it and/or modify it under | 6 GCC is free software; you can redistribute it and/or modify it under |
7 the terms of the GNU General Public License as published by the Free | 7 the terms of the GNU General Public License as published by the Free |
39 const compare_type &t2) | 39 const compare_type &t2) |
40 { | 40 { |
41 return operand_equal_p (t1, t2, 0); | 41 return operand_equal_p (t1, t2, 0); |
42 } | 42 } |
43 | 43 |
44 /* Hasher for tree decls. Pointer equality is enough here, but the DECL_UID | |
45 is a better hash than the pointer value and gives a predictable traversal | |
46 order. */ | |
47 struct tree_decl_hash : ggc_ptr_hash <tree_node> | |
48 { | |
49 static inline hashval_t hash (tree); | |
50 }; | |
51 | |
52 inline hashval_t | |
53 tree_decl_hash::hash (tree t) | |
54 { | |
55 return DECL_UID (t); | |
56 } | |
57 | |
58 /* Hash for SSA_NAMEs in the same function. Pointer equality is enough | |
59 here, but the SSA_NAME_VERSION is a better hash than the pointer | |
60 value and gives a predictable traversal order. */ | |
61 struct tree_ssa_name_hash : ggc_ptr_hash <tree_node> | |
62 { | |
63 static inline hashval_t hash (tree); | |
64 }; | |
65 | |
66 inline hashval_t | |
67 tree_ssa_name_hash::hash (tree t) | |
68 { | |
69 return SSA_NAME_VERSION (t); | |
70 } | |
71 | |
72 /* Hasher for general trees, based on their TREE_HASH. */ | |
73 struct tree_hash : ggc_ptr_hash <tree_node> | |
74 { | |
75 static hashval_t hash (tree); | |
76 }; | |
77 | |
78 inline hashval_t | |
79 tree_hash::hash (tree t) | |
80 { | |
81 return TREE_HASH (t); | |
82 } | |
83 | |
84 #endif | 44 #endif |