isl_tab_pip.c: extract out context handling
[platform/upstream/isl.git] / isl_ctx.c
index a556c6e..a9e29f7 100644 (file)
--- a/isl_ctx.c
+++ b/isl_ctx.c
@@ -8,18 +8,27 @@ struct isl_ctx *isl_ctx_alloc()
 {
        struct isl_ctx *ctx = NULL;
 
-       ctx = isl_alloc_type(NULL, struct isl_ctx);
+       ctx = isl_calloc_type(NULL, struct isl_ctx);
        if (!ctx)
                goto error;
 
        if (isl_hash_table_init(ctx, &ctx->name_hash, 0))
                goto error;
 
+       ctx->stats = isl_calloc_type(ctx, struct isl_stats);
+       if (!ctx->stats)
+               goto error;
+
        ctx->ref = 0;
 
        isl_int_init(ctx->one);
        isl_int_set_si(ctx->one, 1);
 
+       isl_int_init(ctx->negone);
+       isl_int_set_si(ctx->negone, -1);
+
+       isl_int_init(ctx->normalize_gcd);
+
        ctx->n_cached = 0;
 
 #ifdef ISL_POLYLIB
@@ -27,6 +36,11 @@ struct isl_ctx *isl_ctx_alloc()
 #endif
 
        ctx->lp_solver = ISL_LP_TAB;
+       ctx->ilp_solver = ISL_ILP_GBR;
+       ctx->pip = ISL_PIP_TAB;
+
+       ctx->gbr = ISL_GBR_ONCE;
+       ctx->gbr_only_first = 0;
 
        return ctx;
 error:
@@ -53,5 +67,8 @@ void isl_ctx_free(struct isl_ctx *ctx)
        isl_hash_table_clear(&ctx->name_hash);
        isl_blk_clear_cache(ctx);
        isl_int_clear(ctx->one);
+       isl_int_clear(ctx->negone);
+       isl_int_clear(ctx->normalize_gcd);
+       free(ctx->stats);
        free(ctx);
 }