CLooG 0.18.4
[cloog.git] / source / state.c
blob7f3fff8494852e677affea4d3a650c4973d9287e
1 #include <stdlib.h>
2 #include "../include/cloog/cloog.h"
4 /**
5 * Allocate state and initialize backend independent part.
6 */
7 CloogState *cloog_core_state_malloc(void)
9 CloogState *state;
11 state = (CloogState *)malloc(sizeof(CloogState));
12 if (!state)
13 cloog_die("memory overflow.\n");
15 state->backend = NULL;
17 cloog_int_init(state->zero);
18 cloog_int_set_si(state->zero, 0);
19 cloog_int_init(state->one);
20 cloog_int_set_si(state->one, 1);
21 cloog_int_init(state->negone);
22 cloog_int_set_si(state->negone, -1);
24 state->block_allocated = 0;
25 state->block_freed = 0;
26 state->block_max = 0;
28 state->domain_allocated = 0;
29 state->domain_freed = 0;
30 state->domain_max = 0;
32 state->loop_allocated = 0;
33 state->loop_freed = 0;
34 state->loop_max = 0;
36 state->statement_allocated = 0;
37 state->statement_freed = 0;
38 state->statement_max = 0;
40 return state;
43 /**
44 * Free state.
46 void cloog_core_state_free(CloogState *state)
48 cloog_int_clear(state->zero);
49 cloog_int_clear(state->one);
50 cloog_int_clear(state->negone);
51 free(state);