Home | History | Annotate | Download | only in gcc

Lines Matching refs:cache

102 /* Helper for streamer_tree_cache_insert_1.  Add T to CACHE->NODES at
106 streamer_tree_cache_add_to_node_array (struct streamer_tree_cache_d *cache,
110 if (cache->nodes.exists ())
112 if (cache->nodes.length () == ix)
113 cache->nodes.safe_push (t);
115 cache->nodes[ix] = t;
117 if (cache->hashes.exists ())
119 if (cache->hashes.length () == ix)
120 cache->hashes.safe_push (hash);
122 cache->hashes[ix] = hash;
128 CACHE, T, and IX_P are as in streamer_tree_cache_insert.
131 slot in the cache. Otherwise, T is inserted at the position indicated
134 If T already existed in CACHE, return true. Otherwise,
138 streamer_tree_cache_insert_1 (struct streamer_tree_cache_d *cache,
146 unsigned int &ix = cache->node_map->get_or_insert (t, &existed_p);
149 /* Determine the next slot to use in the cache. */
151 ix = cache->next_idx++;
155 streamer_tree_cache_add_to_node_array (cache, ix, t, hash);
165 streamer_tree_cache_add_to_node_array (cache, ix, t, hash);
176 /* Insert tree node T in CACHE. If T already existed in the cache
179 If IX_P is non-null, update it with the index into the cache where
183 streamer_tree_cache_insert (struct streamer_tree_cache_d *cache, tree t,
186 return streamer_tree_cache_insert_1 (cache, t, hash, ix_p, true);
190 /* Replace the tree node with T in CACHE at slot IX. */
193 streamer_tree_cache_replace_tree (struct streamer_tree_cache_d *cache,
197 if (cache->hashes.exists ())
198 hash = streamer_tree_cache_get_hash (cache, ix);
199 if (!cache->node_map)
200 streamer_tree_cache_add_to_node_array (cache, ix, t, hash);
202 streamer_tree_cache_insert_1 (cache, t, hash, &ix, false);
206 /* Appends tree node T to CACHE, even if T already existed in it. */
209 streamer_tree_cache_append (struct streamer_tree_cache_d *cache,
212 unsigned ix = cache->next_idx++;
213 if (!cache->node_map)
214 streamer_tree_cache_add_to_node_array (cache, ix, t, hash);
216 streamer_tree_cache_insert_1 (cache, t, hash, &ix, false);
219 /* Return true if tree node T exists in CACHE, otherwise false. If IX_P is
220 not NULL, write to *IX_P the index into the cache where T is stored
224 streamer_tree_cache_lookup (struct streamer_tree_cache_d *cache, tree t,
233 slot = cache->node_map->get (t);
252 /* Verify that NODE is in CACHE. */
255 verify_common_node_recorded (struct streamer_tree_cache_d *cache, tree node)
263 if (cache->node_map)
264 gcc_assert (streamer_tree_cache_lookup (cache, node, NULL));
268 gcc_assert (cache->nodes.exists ());
270 for (unsigned i = 0; !found && i < cache->nodes.length (); ++i)
271 if (cache->nodes[i] == node)
278 /* Record NODE in CACHE. */
281 record_common_node (struct streamer_tree_cache_d *cache, tree node)
303 just use the position in the cache as hash value.
306 streamer_tree_cache_append (cache, node, cache->next_idx + 0xc001);
326 record_common_node (cache, TREE_TYPE (node));
331 verify_common_node_recorded (cache, TREE_TYPE (node));
341 record_common_node (cache, f);
350 /* Preload common nodes into CACHE and make sure they are merged
354 preload_common_nodes (struct streamer_tree_cache_d *cache)
361 record_common_node (cache, integer_types[i]);
364 record_common_node (cache, sizetype_tab[i]);
392 record_common_node (cache, global_trees[i]);
396 /* Create a cache of pickled nodes. */
401 struct streamer_tree_cache_d *cache;
403 cache = XCNEW (struct streamer_tree_cache_d);
406 cache->node_map = new hash_map<tree, unsigned> (251);
407 cache->next_idx = 0;
409 cache->nodes.create (165);
411 cache->hashes.create (165);
416 preload_common_nodes (cache);
418 return cache;
422 /* Delete the streamer cache C. */