Added test for osl_loop support
[cloog.git] / source / isl / backend.c
blob6ddb9f9adcd567014c90a5bd8983724cf4b919fa
1 #include <cloog/isl/cloog.h>
3 /**
4 * Allocate and initialize full state.
5 */
6 CloogState *cloog_state_malloc(void)
8 return cloog_isl_state_malloc(NULL);
11 /**
12 * Allocate and initialize full state for isl backend.
14 CloogState *cloog_isl_state_malloc(struct isl_ctx *ctx)
16 CloogState *state;
17 int allocated = !ctx;
19 state = cloog_core_state_malloc();
20 if (!ctx)
21 ctx = isl_ctx_alloc();
22 state->backend = isl_alloc_type(ctx, CloogBackend);
23 state->backend->ctx = ctx;
24 state->backend->ctx_allocated = allocated;
25 return state;
28 /**
29 * Free state and backend independent parts.
31 void cloog_state_free(CloogState *state)
33 if (state->backend->ctx_allocated)
34 isl_ctx_free(state->backend->ctx);
35 free(state->backend);
36 cloog_core_state_free(state);