libFirm 1.20
|
Defines | |
#define | NEW_ARR_F(type, nelts) ((type *)ir_new_arr_f((nelts), sizeof(type) * (nelts))) |
Creates a flexible array. | |
#define | CLONE_ARR_F(type, arr) NEW_ARR_F(type, ARR_LEN((arr))) |
Creates a new flexible array with the same number of elements as a given one. | |
#define | DUP_ARR_F(type, arr) ((type*) memcpy(CLONE_ARR_F(type, (arr)), (arr), sizeof(type) * ARR_LEN((arr)))) |
Duplicates an array and returns the new flexible one. | |
#define | DEL_ARR_F(arr) (ir_del_arr_f((void *)(arr))) |
Delete a flexible array. | |
#define | NEW_ARR_D(type, obstack, nelts) |
Creates a dynamic array on an obstack. | |
#define | CLONE_ARR_D(type, obstack, arr) NEW_ARR_D(type, (obstack), ARR_LEN((arr))) |
Creates a new dynamic array with the same number of elements as a given one. | |
#define | DUP_ARR_D(type, obstack, arr) ((type*)memcpy(CLONE_ARR_D(type, (obstack), (arr)), (arr), sizeof(type) * ARR_LEN ((arr)))) |
Duplicates an array and returns the new dynamic one. | |
#define | ARR_LEN(arr) (ARR_VRFY((arr)), ARR_DESCR((arr))->nelts) |
Returns the length of an array. | |
#define | ARR_RESIZE(type, arr, n) ((arr) = (type*) ir_arr_resize((void *)(arr), (n), sizeof(type))) |
Resize a flexible array, allocate more data if needed but do NOT reduce. | |
#define | ARR_SETLEN(type, arr, n) ((arr) = (type*) ir_arr_setlen((void *)(arr), (n), sizeof(type) * (n))) |
Resize a flexible array, always reallocate data. | |
#define | ARR_EXTEND(type, arr, delta) ARR_RESIZE(type, (arr), ARR_LEN((arr)) + (delta)) |
Resize a flexible array by growing it by delta elements. | |
#define | ARR_EXTO(type, arr, n) |
Resize a flexible array to hold n elements only if it is currently shorter than n. | |
#define | ARR_APP1(type, arr, elt) (ARR_EXTEND(type, (arr), 1), (arr)[ARR_LEN((arr))-1] = (elt)) |
Append one element to a flexible array. | |
#define | ARR_VRFY(arr) ir_verify_arr(arr) |
Check array for consistency. | |
#define | ARR_IDX_VRFY(arr, idx) assert((0 <= (idx)) && ((idx) < ARR_LEN((arr)))) |
Check if index is within array bounds. |
#define ARR_APP1 | ( | type, | |
arr, | |||
elt | |||
) | (ARR_EXTEND(type, (arr), 1), (arr)[ARR_LEN((arr))-1] = (elt)) |
#define ARR_EXTEND | ( | type, | |
arr, | |||
delta | |||
) | ARR_RESIZE(type, (arr), ARR_LEN((arr)) + (delta)) |
#define ARR_EXTO | ( | type, | |
arr, | |||
n | |||
) |
do { \ if ((n) >= ARR_LEN(arr)) { ARR_RESIZE(type, arr, (n)+1); } \ } while(0)
Resize a flexible array to hold n elements only if it is currently shorter than n.
type | The element type of the array. |
arr | The array, which must be an lvalue. |
n | The new size of the array. |
#define ARR_IDX_VRFY | ( | arr, | |
idx | |||
) | assert((0 <= (idx)) && ((idx) < ARR_LEN((arr)))) |
#define ARR_LEN | ( | arr | ) | (ARR_VRFY((arr)), ARR_DESCR((arr))->nelts) |
#define ARR_RESIZE | ( | type, | |
arr, | |||
n | |||
) | ((arr) = (type*) ir_arr_resize((void *)(arr), (n), sizeof(type))) |
#define ARR_SETLEN | ( | type, | |
arr, | |||
n | |||
) | ((arr) = (type*) ir_arr_setlen((void *)(arr), (n), sizeof(type) * (n))) |
#define ARR_VRFY | ( | arr | ) | ir_verify_arr(arr) |
#define CLONE_ARR_D | ( | type, | |
obstack, | |||
arr | |||
) | NEW_ARR_D(type, (obstack), ARR_LEN((arr))) |
Creates a new dynamic array with the same number of elements as a given one.
type | The element type of the new array. |
obstack | An struct obstack * were the data will be allocated |
arr | An array from which the number of elements will be taken |
This macro creates a dynamic array of a given type at runtime. The size of the array cannot be changed later.
#define CLONE_ARR_F | ( | type, | |
arr | |||
) | NEW_ARR_F(type, ARR_LEN((arr))) |
Creates a new flexible array with the same number of elements as a given one.
type | The element type of the new array. |
arr | An array from which the number of elements will be taken |
This macro creates a flexible array of a given type at runtime. The size of the array can be changed later.
#define DEL_ARR_F | ( | arr | ) | (ir_del_arr_f((void *)(arr))) |
#define DUP_ARR_D | ( | type, | |
obstack, | |||
arr | |||
) | ((type*)memcpy(CLONE_ARR_D(type, (obstack), (arr)), (arr), sizeof(type) * ARR_LEN ((arr)))) |
Duplicates an array and returns the new dynamic one.
type | The element type of the new array. |
obstack | An struct obstack * were the data will be allocated |
arr | An array from which the elements will be duplicated |
This macro creates a dynamic array of a given type at runtime. The size of the array cannot be changed later.
#define DUP_ARR_F | ( | type, | |
arr | |||
) | ((type*) memcpy(CLONE_ARR_F(type, (arr)), (arr), sizeof(type) * ARR_LEN((arr)))) |
Duplicates an array and returns the new flexible one.
type | The element type of the new array. |
arr | An array from which the elements will be duplicated |
This macro creates a flexible array of a given type at runtime. The size of the array can be changed later.
#define NEW_ARR_D | ( | type, | |
obstack, | |||
nelts | |||
) |
( nelts \
? (type *)ir_new_arr_d((obstack), (nelts), sizeof(type) * (nelts)) \
: (type *)arr_mt_descr.elts)
Creates a dynamic array on an obstack.
type | The element type of the new array. |
obstack | A struct obstack * were the data will be allocated |
nelts | A size_t expression evaluating to the number of elements |
This macro creates a dynamic array of a given type at runtime. The size of the array cannot be changed later.
#define NEW_ARR_F | ( | type, | |
nelts | |||
) | ((type *)ir_new_arr_f((nelts), sizeof(type) * (nelts))) |
Creates a flexible array.
type | The element type of the new array. |
nelts | a size_t expression evaluating to the number of elements |
This macro creates a flexible array of a given type at runtime. The size of the array can be changed later.