#include "ctrump/common/intmap.h"
#include "ctrump/common/mempool.h"
#include <stdlib.h>

Go to the source code of this file.
Defines | |
| #define | NELEM(a) (sizeof(a)/sizeof(a[0])) |
Functions | |
| void | ctrump_intmap_init (struct ctrump_intmap *map, int size) |
| 初期化 | |
| void | ctrump_intmap_init_pool (struct ctrump_intmap *map, int size, struct ctrump_mempool *pool) |
| 初期化 | |
| static struct ctrump_intmap_bucket * | ctrump_intmap_lookup_impl (struct ctrump_intmap *map, int *found, unsigned int key, int add) |
| struct ctrump_intmap_bucket * | ctrump_intmap_lookup_add (struct ctrump_intmap *map, int *found, unsigned int key) |
| 検索の実行 値の検索見つからなかった場合は、is_foundを0に設定し、 新たに作ったbucketを返す | |
| void * | ctrump_intmap_lookup (struct ctrump_intmap *map, int *found, unsigned int key) |
| 検索の実行 値が見つからなかった場合は found を0に設定する | |
| struct ctrump_intmap_bucket * | ctrump_intmap_lookup_bucket (struct ctrump_intmap *map, int *found, unsigned int key) |
| 検索の実行 値が見つからなかった場合はfoundを0に設定し、NULLを返す | |
| static void | iter_next (struct ctrump_intmap_iterator *iter, struct ctrump_intmap *map, int begin) |
| void | ctrump_intmap_iterator_begin (struct ctrump_intmap_iterator *iter, struct ctrump_intmap *map) |
| イテレータの初期化 | |
| int | ctrump_intmap_iterator_next (struct ctrump_intmap_bucket **ret, struct ctrump_intmap_iterator *iter, struct ctrump_intmap *map) |
| イテレータを進める | |
| int | ctrump_intmap_get_num_elem (struct ctrump_intmap *map) |
| mapのサイズを取得 | |
| void | ctrump_intmap_resize_pool (struct ctrump_intmap *dest, const struct ctrump_intmap *src, struct ctrump_mempool *pool) |
dest上に新たに適切なサイズのテーブルを作り、srcの内容をコピーする
| |
| void | ctrump_intmap_free (struct ctrump_intmap *map) |
| テーブル解放 | |
Variables | |
| static const int | sizes [] |
整数値をキーにして値を検索するテーブル
Definition in file intmap.c.
| #define NELEM | ( | a | ) | (sizeof(a)/sizeof(a[0])) |
| void ctrump_intmap_free | ( | struct ctrump_intmap * | map | ) |
テーブル解放
Definition at line 289 of file intmap.c.
References ctrump_intmap::buckets, ctrump_intmap_bucket::chain, and ctrump_intmap::size.
Referenced by build_bfs_order().
| int ctrump_intmap_get_num_elem | ( | struct ctrump_intmap * | map | ) |
mapのサイズを取得
Definition at line 189 of file intmap.c.
References ctrump_intmap::buckets, ctrump_intmap_bucket::chain, and ctrump_intmap::size.
| void ctrump_intmap_init | ( | struct ctrump_intmap * | map, | |
| int | size | |||
| ) |
初期化
| map | 初期化するテーブル | |
| size | テーブルサイズ |
Definition at line 44 of file intmap.c.
References ctrump_intmap::buckets, ctrump_intmap::pool, and ctrump_intmap::size.
Referenced by build_bfs_order(), and ctrump_intmap_resize_pool().
| void ctrump_intmap_init_pool | ( | struct ctrump_intmap * | map, | |
| int | size, | |||
| struct ctrump_mempool * | pool | |||
| ) |
初期化
| map | 初期化するテーブル | |
| size | テーブルサイズ | |
| pool | メモリアロケートに使うプール |
Definition at line 59 of file intmap.c.
References ctrump_intmap::buckets, ctrump_mempool_alloc, ctrump_intmap::pool, and ctrump_intmap::size.
Referenced by build_cfg(), ctrump_intmap_resize_pool(), and get_distance_vector().
| void ctrump_intmap_iterator_begin | ( | struct ctrump_intmap_iterator * | i, | |
| struct ctrump_intmap * | map | |||
| ) |
イテレータの初期化
| i | 初期化するイテレータ | |
| map | イテレートする対象 |
Definition at line 162 of file intmap.c.
References iter_next().
Referenced by build_cfg(), and get_distance_vector().
| int ctrump_intmap_iterator_next | ( | struct ctrump_intmap_bucket ** | ret, | |
| struct ctrump_intmap_iterator * | i, | |||
| struct ctrump_intmap * | map | |||
| ) |
イテレータを進める
| ret | [out] 取得したbucket | |
| i | 進めるイテレータ | |
| map | イテレートする対象 |
Definition at line 169 of file intmap.c.
References ctrump_intmap_iterator::buckets_index, ctrump_intmap_bucket::chain, iter_next(), ctrump_intmap_iterator::next, and ctrump_intmap::size.
Referenced by build_cfg(), and get_distance_vector().
| void* ctrump_intmap_lookup | ( | struct ctrump_intmap * | map, | |
| int * | found, | |||
| unsigned int | key | |||
| ) |
検索の実行 値が見つからなかった場合は found を0に設定する
| map | 検索対象 | |
| found | [out] 見つかれば0以外 | |
| key | 検索に使う数値 |
Definition at line 120 of file intmap.c.
References ctrump_intmap_lookup_impl(), and ctrump_intmap_bucket::val.
Referenced by analyze_subscript_coef(), check_var_bmp_p(), extract_load_store_assign(), extract_load_store_expr_rval(), find_iv(), get_var_id(), recog_array_index(), recog_reduction_domtree(), and single_expr_subscripts_to_loop_subscript().
| struct ctrump_intmap_bucket* ctrump_intmap_lookup_add | ( | struct ctrump_intmap * | map, | |
| int * | is_found, | |||
| unsigned int | key | |||
| ) | [read] |
検索の実行 値の検索見つからなかった場合は、is_foundを0に設定し、 新たに作ったbucketを返す
| map | 検索対象 | |
| is_found | [out] 見つかれば0以外 | |
| key | 検索に使う数値 |
Definition at line 112 of file intmap.c.
References ctrump_intmap_lookup_impl().
Referenced by assign_var_info_expr(), build_bfs_order(), and test_index().
| struct ctrump_intmap_bucket* ctrump_intmap_lookup_bucket | ( | struct ctrump_intmap * | map, | |
| int * | found, | |||
| unsigned int | key | |||
| ) | [read] |
検索の実行 値が見つからなかった場合はfoundを0に設定し、NULLを返す
| map | 検索対象 | |
| found | [out] 見つかれば0以外 | |
| key | 検索に使う数値 |
Definition at line 134 of file intmap.c.
References ctrump_intmap_lookup_impl().
Referenced by test_index().
| static struct ctrump_intmap_bucket* ctrump_intmap_lookup_impl | ( | struct ctrump_intmap * | map, | |
| int * | found, | |||
| unsigned int | key, | |||
| int | add | |||
| ) | [static, read] |
Definition at line 74 of file intmap.c.
References ctrump_intmap::buckets, ctrump_intmap_bucket::chain, ctrump_mempool_alloc, ctrump_intmap_bucket::key, ctrump_intmap::pool, and ctrump_intmap::size.
Referenced by ctrump_intmap_lookup(), ctrump_intmap_lookup_add(), and ctrump_intmap_lookup_bucket().
| void ctrump_intmap_resize_pool | ( | struct ctrump_intmap * | dest, | |
| const struct ctrump_intmap * | src, | |||
| struct ctrump_mempool * | pool | |||
| ) |
dest上に新たに適切なサイズのテーブルを作り、srcの内容をコピーする
| dest | 新しくつくるテーブル | |
| src | もとのテーブル | |
| pool | メモリプール |
Definition at line 228 of file intmap.c.
References ctrump_intmap::buckets, ctrump_intmap_bucket::chain, ctrump_intmap_init(), ctrump_intmap_init_pool(), ctrump_mempool_alloc, ctrump_intmap_bucket::key, NELEM, ctrump_intmap::size, sizes, and ctrump_intmap_bucket::val.
Referenced by build_bfs_order(), and build_cfg().
| static void iter_next | ( | struct ctrump_intmap_iterator * | iter, | |
| struct ctrump_intmap * | map, | |||
| int | begin | |||
| ) | [static] |
Definition at line 143 of file intmap.c.
References ctrump_intmap::buckets, ctrump_intmap_iterator::buckets_index, ctrump_intmap_iterator::next, and ctrump_intmap::size.
Referenced by ctrump_intmap_iterator_begin(), and ctrump_intmap_iterator_next().
const int sizes[] [static] |
Initial value:
{
5,
17,
41,
79,
149,
251,
421,
683,
1117,
1823,
2917,
4679,
7489,
11867,
18691,
29443
}
Definition at line 206 of file intmap.c.
Referenced by ctrump_intmap_resize_pool().
1.5.6