#include <stddef.h>
#include "ctrump/common/dll.h"
Go to the source code of this file.
Data Structures | |
struct | ctrump_varray |
可変長配列 More... | |
Defines | |
#define | VA_ELEM(t, a, n) (((t*)((a)->elements))[n]) |
get element of array | |
#define | VA_TOP(t, a) VA_ELEM(t,a,(a)->nelem-1) |
get top element | |
#define | VA_ELEM_PTR(t, a, n) (&(((t*)((a)->elements))[n])) |
get pointer of element | |
#define | VA_LAST_PTR(t, a) (&(((t*)((a)->elements))[(a)->nelem-1])) |
get pointer of last element | |
#define | VA_PUSH(t, a, e) do { if ((a)->nelem>=(a)->size) ctrump_varray_realloc(a); VA_ELEM(t,a,(a)->nelem++) = (e); } while(0) |
append element | |
#define | VA_NEWELEM(a) do { if ((a)->nelem>=(a)->size) ctrump_varray_realloc(a); (a)->nelem++; } while(0) |
append size | |
#define | VA_NEWELEM_P(a, p) do { if ((a)->nelem>=(a)->size) ctrump_varray_realloc_pool(a,p); (a)->nelem++; } while(0) |
append size | |
#define | VA_POP(t, a) VA_ELEM(t, (a), --((a)->nelem)) |
extract and remove element | |
#define | VA_PUSH_P(t, a, e, p) do { if ((a)->nelem>=(a)->size) ctrump_varray_realloc_pool(a,p); VA_ELEM(t,a,(a)->nelem++) = (e); } while(0) |
Functions | |
CTRUMP_EXTDEF void | ctrump_varray_init (struct ctrump_varray *a, size_t n, size_t es) |
create array | |
CTRUMP_EXTDEF void | ctrump_varray_init_pool (struct ctrump_varray *a, size_t n, size_t es, struct ctrump_mempool *pool) |
CTRUMP_EXTDEF void | ctrump_varray_realloc (struct ctrump_varray *a) |
resize array | |
CTRUMP_EXTDEF void | ctrump_varray_realloc_pool (struct ctrump_varray *a, struct ctrump_mempool *pool) |
CTRUMP_EXTDEF void * | ctrump_varray_close (struct ctrump_varray *a, struct ctrump_mempool *p) |
free array and copy contents to buffer that is allocated from pool | |
CTRUMP_EXTDEF void * | ctrump_varray_copy (struct ctrump_varray *a, struct ctrump_mempool *p) |
copy to buffer that is allocated from pool | |
CTRUMP_EXTDEF void | ctrump_varray_discard (struct ctrump_varray *a) |
free array |
Definition in file varray.h.
#define VA_ELEM | ( | t, | |||
a, | |||||
n | ) | (((t*)((a)->elements))[n]) |
get element of array
t | type of element | |
a | array | |
n | index |
Definition at line 64 of file varray.h.
Referenced by build_cfg(), build_dom(), dfs_order(), find_df(), and resolve_bb_vec().
#define VA_ELEM_PTR | ( | t, | |||
a, | |||||
n | ) | (&(((t*)((a)->elements))[n])) |
#define VA_LAST_PTR | ( | t, | |||
a | ) | (&(((t*)((a)->elements))[(a)->nelem-1])) |
get pointer of last element
t | type of element | |
a | array |
Definition at line 86 of file varray.h.
Referenced by add_var_loadstore(), add_var_store(), append_access_info(), append_complicated_subscript(), append_have_complicated_subscript(), append_have_multiple_index(), append_have_multiple_level(), append_have_weak_subscript(), append_index_var_not_inductive(), append_memory_access(), append_memory_load(), append_memory_store(), append_multiple_scaled_index(), append_nd_subscript(), append_ordered_memop(), append_random_access_array(), append_record_member_ref(), assign_var_info_expr(), build_cfg_expr(), classify_memop(), expr_subscripts_to_loop_subscript(), extract_load_store_expr_rval(), recog_array_access(), single_expr_subscripts_to_loop_subscript(), and test_index().
#define VA_NEWELEM | ( | a | ) | do { if ((a)->nelem>=(a)->size) ctrump_varray_realloc(a); (a)->nelem++; } while(0) |
append size
t | type of element | |
a | array |
Definition at line 102 of file varray.h.
Referenced by append_nd_subscript(), append_record_member_ref(), expr_subscripts_to_loop_subscript(), recog_array_access(), and single_expr_subscripts_to_loop_subscript().
#define VA_NEWELEM_P | ( | a, | |||
p | ) | do { if ((a)->nelem>=(a)->size) ctrump_varray_realloc_pool(a,p); (a)->nelem++; } while(0) |
append size
t | type of element | |
a | array |
Definition at line 109 of file varray.h.
Referenced by add_var_loadstore(), add_var_store(), append_access_info(), append_complicated_subscript(), append_have_complicated_subscript(), append_have_multiple_index(), append_have_multiple_level(), append_have_weak_subscript(), append_index_var_not_inductive(), append_memory_access(), append_memory_load(), append_memory_store(), append_multiple_scaled_index(), append_ordered_memop(), append_random_access_array(), assign_var_info_expr(), build_cfg_expr(), classify_memop(), extract_load_store_expr_rval(), and test_index().
#define VA_POP | ( | t, | |||
a | ) | VA_ELEM(t, (a), --((a)->nelem)) |
extract and remove element
t | type of element | |
a | array |
Definition at line 117 of file varray.h.
Referenced by assign_pdg_node_bb(), and single_expr_subscripts_to_loop_subscript().
#define VA_PUSH | ( | t, | |||
a, | |||||
e | ) | do { if ((a)->nelem>=(a)->size) ctrump_varray_realloc(a); VA_ELEM(t,a,(a)->nelem++) = (e); } while(0) |
append element
t | type of element | |
a | array | |
e | element |
Definition at line 95 of file varray.h.
Referenced by alloc_pdg_node(), analyze_loop_control_flow(), append_root(), assign_pdg_node(), assign_pdg_node_bb(), build_bfs_order(), and single_expr_subscripts_to_loop_subscript().
#define VA_PUSH_P | ( | t, | |||
a, | |||||
e, | |||||
p | ) | do { if ((a)->nelem>=(a)->size) ctrump_varray_realloc_pool(a,p); VA_ELEM(t,a,(a)->nelem++) = (e); } while(0) |
Definition at line 119 of file varray.h.
Referenced by append_succs(), build_dom(), find_df(), new_bb(), and test_index().
#define VA_TOP | ( | t, | |||
a | ) | VA_ELEM(t,a,(a)->nelem-1) |
get top element
t | type of element | |
a | array |
Definition at line 71 of file varray.h.
Referenced by assign_pdg_node_bb().
CTRUMP_EXTDEF void* ctrump_varray_close | ( | struct ctrump_varray * | a, | |
struct ctrump_mempool * | p | |||
) |
free array and copy contents to buffer that is allocated from pool
a | array | |
p | memory pool |
Definition at line 101 of file varray.c.
References ctrump_varray_copy(), and ctrump_varray::elements.
Referenced by recog_array_access().
CTRUMP_EXTDEF void* ctrump_varray_copy | ( | struct ctrump_varray * | a, | |
struct ctrump_mempool * | p | |||
) |
copy to buffer that is allocated from pool
a | array | |
p | memory pool |
Definition at line 87 of file varray.c.
References ctrump_mempool_alloc, ctrump_varray::elem_size, ctrump_varray::elements, and ctrump_varray::nelem.
Referenced by analyze_loop_control_flow(), append_nd_subscript(), classify_memop(), ctrump_analyze(), ctrump_varray_close(), expr_subscripts_to_loop_subscript(), and get_distance_vector().
CTRUMP_EXTDEF void ctrump_varray_discard | ( | struct ctrump_varray * | a | ) |
free array
Definition at line 110 of file varray.c.
References ctrump_varray::elements.
Referenced by assign_pdg_node(), build_bfs_order(), build_cfg(), ctrump_analyze(), destroy_build_loop_tree_state(), expr_subscripts_to_loop_subscript(), and recog_array_access().
CTRUMP_EXTDEF void ctrump_varray_init | ( | struct ctrump_varray * | a, | |
size_t | n, | |||
size_t | es | |||
) |
create array
n | initial buffer size | |
es | size of element |
Definition at line 42 of file varray.c.
References ctrump_varray::elem_size, ctrump_varray::elements, ctrump_varray::nelem, and ctrump_varray::size.
Referenced by assign_pdg_node(), build_bfs_order(), build_cfg(), ctrump_analyze(), expr_subscripts_to_loop_subscript(), init_build_loop_tree_state(), recog_array_access(), and single_expr_subscripts_to_loop_subscript().
CTRUMP_EXTDEF void ctrump_varray_init_pool | ( | struct ctrump_varray * | a, | |
size_t | n, | |||
size_t | es, | |||
struct ctrump_mempool * | pool | |||
) |
Definition at line 55 of file varray.c.
References ctrump_mempool_alloc, ctrump_varray::elem_size, ctrump_varray::elements, ctrump_varray::nelem, and ctrump_varray::size.
Referenced by build_cfg(), classify_memop(), ctrump_build_cfg(), get_distance_vector(), new_bb(), and test_index().
CTRUMP_EXTDEF void ctrump_varray_realloc | ( | struct ctrump_varray * | a | ) |
resize array
a | array |
Definition at line 70 of file varray.c.
References ctrump_varray::elem_size, ctrump_varray::elements, and ctrump_varray::size.
CTRUMP_EXTDEF void ctrump_varray_realloc_pool | ( | struct ctrump_varray * | a, | |
struct ctrump_mempool * | pool | |||
) |
Definition at line 77 of file varray.c.
References ctrump_mempool_alloc, ctrump_varray::elem_size, ctrump_varray::elements, and ctrump_varray::size.