libFirm
|
Macros | |
#define | NEW_ARR_F(type, nelts) ((type *)ir_new_arr_f((nelts), sizeof(type) * (nelts))) |
Creates a flexible array. More... | |
#define | NEW_ARR_FZ(type, nelts) ((type*)memset(NEW_ARR_F(type, (nelts)), 0, sizeof(type) * (nelts))) |
Create a flexible array and null its contents. More... | |
#define | DUP_ARR_F(type, arr) ((type*)memcpy(NEW_ARR_F(type, ARR_LEN((arr))), (arr), sizeof(type) * ARR_LEN((arr)))) |
Duplicates an array and returns the new flexible one. More... | |
#define | NEW_ARR_D(type, obstack, nelts) |
Creates a dynamic array on an obstack. More... | |
#define | NEW_ARR_DZ(type, obstack, nelts) ((type*)memset(NEW_ARR_D(type, (obstack), (nelts)), 0, sizeof(type) * (nelts))) |
Create a dynamic array on an obstack and null its contents. More... | |
#define | DUP_ARR_D(type, obstack, arr) ((type*)memcpy(NEW_ARR_D(type, (obstack), ARR_LEN((arr))), (arr), sizeof(type) * ARR_LEN ((arr)))) |
Duplicates an array and returns the new dynamic one. More... | |
#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. More... | |
#define | ARR_SETLEN(type, arr, n) ((arr) = (type*) ir_arr_setlen((void *)(arr), (n), sizeof(type) * (n))) |
Resize a flexible array, always reallocate data. More... | |
#define | ARR_EXTEND(type, arr, delta) ARR_RESIZE(type, (arr), ARR_LEN((arr)) + (delta)) |
Resize a flexible array by growing it by delta elements. More... | |
#define | ARR_EXTO(type, arr, n) |
Resize a flexible array to hold n elements only if it is currently shorter than n. More... | |
#define | ARR_APP1(type, arr, elt) (ARR_EXTEND(type, (arr), 1), (arr)[ARR_LEN((arr))-1] = (elt)) |
Append one element to a flexible array. More... | |
Functions | |
void | DEL_ARR_F (void *arr) |
Delete a flexible array. More... | |
static size_t | ARR_LEN (void const *const arr) |
Returns the length of an array. More... | |
#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 | |||
) |
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_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 DUP_ARR_D | ( | type, | |
obstack, | |||
arr | |||
) | ((type*)memcpy(NEW_ARR_D(type, (obstack), ARR_LEN((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(NEW_ARR_F(type, ARR_LEN((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 | |||
) |
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_DZ | ( | type, | |
obstack, | |||
nelts | |||
) | ((type*)memset(NEW_ARR_D(type, (obstack), (nelts)), 0, sizeof(type) * (nelts))) |
Create a dynamic array on an obstack and null its contents.
Definition at line 185 of file array.h.
Referenced by new_rd_Block().
#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.
#define NEW_ARR_FZ | ( | type, | |
nelts | |||
) | ((type*)memset(NEW_ARR_F(type, (nelts)), 0, sizeof(type) * (nelts))) |
|
inlinestatic |
void DEL_ARR_F | ( | void * | arr | ) |
Delete a flexible array.
arr | The flexible array. |