LCOV - code coverage report
Current view: top level - metalib_isl - isl_options.c (source / functions) Hit Total Coverage
Test: 2018-10-31_point_maint_greina16.lcov Lines: 3 73 4.1 %
Date: 2018-11-01 11:27:00 Functions: 3 70 4.3 %

          Line data    Source code
       1             : /*
       2             :  * Copyright 2008-2009 Katholieke Universiteit Leuven
       3             :  *
       4             :  * Use of this software is governed by the MIT license
       5             :  *
       6             :  * Written by Sven Verdoolaege, K.U.Leuven, Departement
       7             :  * Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium
       8             :  */
       9             : 
      10             : #include <stdio.h>
      11             : #include <stdlib.h>
      12             : #include <string.h>
      13             : 
      14             : #include <isl/ctx.h>
      15             : #include <isl_options_private.h>
      16             : #include <isl/ast_build.h>
      17             : #include <isl/schedule.h>
      18             : #include <isl/version.h>
      19             : 
      20             : struct isl_arg_choice isl_pip_context_choice[] = {
      21             :         {"gbr",               ISL_CONTEXT_GBR},
      22             :         {"lexmin",    ISL_CONTEXT_LEXMIN},
      23             :         {0}
      24             : };
      25             : 
      26             : struct isl_arg_choice isl_gbr_choice[] = {
      27             :         {"never",     ISL_GBR_NEVER},
      28             :         {"once",      ISL_GBR_ONCE},
      29             :         {"always",    ISL_GBR_ALWAYS},
      30             :         {0}
      31             : };
      32             : 
      33             : struct isl_arg_choice isl_closure_choice[] = {
      34             :         {"isl",               ISL_CLOSURE_ISL},
      35             :         {"box",               ISL_CLOSURE_BOX},
      36             :         {0}
      37             : };
      38             : 
      39             : static struct isl_arg_choice bound[] = {
      40             :         {"bernstein", ISL_BOUND_BERNSTEIN},
      41             :         {"range",     ISL_BOUND_RANGE},
      42             :         {0}
      43             : };
      44             : 
      45             : static struct isl_arg_choice on_error[] = {
      46             :         {"warn",      ISL_ON_ERROR_WARN},
      47             :         {"continue",  ISL_ON_ERROR_CONTINUE},
      48             :         {"abort",     ISL_ON_ERROR_ABORT},
      49             :         {0}
      50             : };
      51             : 
      52             : static struct isl_arg_choice isl_schedule_algorithm_choice[] = {
      53             :         {"isl",               ISL_SCHEDULE_ALGORITHM_ISL},
      54             :         {"feautrier",   ISL_SCHEDULE_ALGORITHM_FEAUTRIER},
      55             :         {0}
      56             : };
      57             : 
      58             : static struct isl_arg_flags bernstein_recurse[] = {
      59             :         {"none",      ISL_BERNSTEIN_FACTORS | ISL_BERNSTEIN_INTERVALS, 0},
      60             :         {"factors",   ISL_BERNSTEIN_FACTORS | ISL_BERNSTEIN_INTERVALS,
      61             :                         ISL_BERNSTEIN_FACTORS},
      62             :         {"intervals", ISL_BERNSTEIN_FACTORS | ISL_BERNSTEIN_INTERVALS,
      63             :                         ISL_BERNSTEIN_INTERVALS},
      64             :         {"full",      ISL_BERNSTEIN_FACTORS | ISL_BERNSTEIN_INTERVALS,
      65             :                         ISL_BERNSTEIN_FACTORS | ISL_BERNSTEIN_INTERVALS},
      66             :         {0}
      67             : };
      68             : 
      69             : static struct isl_arg_choice convex[] = {
      70             :         {"wrap",      ISL_CONVEX_HULL_WRAP},
      71             :         {"fm",                ISL_CONVEX_HULL_FM},
      72             :         {0}
      73             : };
      74             : 
      75             : #define         ISL_SCHEDULE_FUSE_MAX                   0
      76             : #define         ISL_SCHEDULE_FUSE_MIN                   1
      77             : 
      78             : static struct isl_arg_choice fuse[] = {
      79             :         {"max",               ISL_SCHEDULE_FUSE_MAX},
      80             :         {"min",               ISL_SCHEDULE_FUSE_MIN},
      81             :         {0}
      82             : };
      83             : 
      84             : /* Callback for setting the "schedule-fuse" option.
      85             :  * This (now hidden) option tries to mimic an option that was
      86             :  * replaced by the schedule-serialize-sccs option.
      87             :  * Setting the old option to ISL_SCHEDULE_FUSE_MIN is now
      88             :  * expressed by turning on the schedule-serialize-sccs option.
      89             :  */
      90           0 : static int set_fuse(void *opt, unsigned val)
      91             : {
      92           0 :         struct isl_options *options = opt;
      93             : 
      94           0 :         options->schedule_serialize_sccs = (val == ISL_SCHEDULE_FUSE_MIN);
      95             : 
      96           0 :         return 0;
      97             : }
      98             : 
      99             : static struct isl_arg_choice separation_bounds[] = {
     100             :         {"explicit",  ISL_AST_BUILD_SEPARATION_BOUNDS_EXPLICIT},
     101             :         {"implicit",  ISL_AST_BUILD_SEPARATION_BOUNDS_IMPLICIT},
     102             :         {0}
     103             : };
     104             : 
     105           0 : static void print_version(void)
     106             : {
     107           0 :         printf("%s", isl_version());
     108           0 : }
     109             : 
     110             : ISL_ARGS_START(struct isl_options, isl_options_args)
     111             : ISL_ARG_CHOICE(struct isl_options, context, 0, "context", \
     112             :         isl_pip_context_choice, ISL_CONTEXT_GBR,
     113             :         "how to handle the pip context tableau")
     114             : ISL_ARG_CHOICE(struct isl_options, gbr, 0, "gbr", \
     115             :         isl_gbr_choice, ISL_GBR_ALWAYS,
     116             :         "how often to use generalized basis reduction")
     117             : ISL_ARG_CHOICE(struct isl_options, closure, 0, "closure", \
     118             :         isl_closure_choice,     ISL_CLOSURE_ISL,
     119             :         "closure operation to use")
     120             : ISL_ARG_BOOL(struct isl_options, gbr_only_first, 0, "gbr-only-first", 0,
     121             :         "only perform basis reduction in first direction")
     122             : ISL_ARG_CHOICE(struct isl_options, bound, 0, "bound", bound,
     123             :         ISL_BOUND_BERNSTEIN, "algorithm to use for computing bounds")
     124             : ISL_ARG_CHOICE(struct isl_options, on_error, 0, "on-error", on_error,
     125             :         ISL_ON_ERROR_WARN, "how to react if an error is detected")
     126             : ISL_ARG_FLAGS(struct isl_options, bernstein_recurse, 0,
     127             :         "bernstein-recurse", bernstein_recurse, ISL_BERNSTEIN_FACTORS, NULL)
     128             : ISL_ARG_BOOL(struct isl_options, bernstein_triangulate, 0,
     129             :         "bernstein-triangulate", 1,
     130             :         "triangulate domains during Bernstein expansion")
     131             : ISL_ARG_BOOL(struct isl_options, pip_symmetry, 0, "pip-symmetry", 1,
     132             :         "detect simple symmetries in PIP input")
     133             : ISL_ARG_CHOICE(struct isl_options, convex, 0, "convex-hull", \
     134             :         convex, ISL_CONVEX_HULL_WRAP, "convex hull algorithm to use")
     135             : ISL_ARG_BOOL(struct isl_options, coalesce_bounded_wrapping, 0,
     136             :         "coalesce-bounded-wrapping", 1, "bound wrapping during coalescing")
     137             : ISL_ARG_BOOL(struct isl_options, coalesce_preserve_locals, 0,
     138             :         "coalesce-preserve-locals", 0,
     139             :         "preserve local variables during coalescing")
     140             : ISL_ARG_INT(struct isl_options, schedule_max_coefficient, 0,
     141             :         "schedule-max-coefficient", "limit", -1, "Only consider schedules "
     142             :         "where the coefficients of the variable and parameter dimensions "
     143             :         "do not exceed <limit>. A value of -1 allows arbitrary coefficients.")
     144             : ISL_ARG_INT(struct isl_options, schedule_max_constant_term, 0,
     145             :         "schedule-max-constant-term", "limit", -1, "Only consider schedules "
     146             :         "where the coefficients of the constant dimension do not exceed "
     147             :         "<limit>. A value of -1 allows arbitrary coefficients.")
     148             : ISL_ARG_BOOL(struct isl_options, schedule_parametric, 0,
     149             :         "schedule-parametric", 1, "construct possibly parametric schedules")
     150             : ISL_ARG_BOOL(struct isl_options, schedule_outer_coincidence, 0,
     151             :         "schedule-outer-coincidence", 0,
     152             :         "try to construct schedules where the outer member of each band "
     153             :         "satisfies the coincidence constraints")
     154             : ISL_ARG_BOOL(struct isl_options, schedule_maximize_band_depth, 0,
     155             :         "schedule-maximize-band-depth", 0,
     156             :         "maximize the number of scheduling dimensions in a band")
     157             : ISL_ARG_BOOL(struct isl_options, schedule_maximize_coincidence, 0,
     158             :         "schedule-maximize-coincidence", 0,
     159             :         "maximize the number of coincident dimensions in a band")
     160             : ISL_ARG_BOOL(struct isl_options, schedule_split_scaled, 0,
     161             :         "schedule-split-scaled", 1,
     162             :         "split non-tilable bands with scaled schedules")
     163             : ISL_ARG_BOOL(struct isl_options, schedule_treat_coalescing, 0,
     164             :         "schedule-treat-coalescing", 1,
     165             :         "try and prevent or adjust schedules that perform loop coalescing")
     166             : ISL_ARG_BOOL(struct isl_options, schedule_separate_components, 0,
     167             :         "schedule-separate-components", 1,
     168             :         "separate components in dependence graph")
     169             : ISL_ARG_BOOL(struct isl_options, schedule_whole_component, 0,
     170             :         "schedule-whole-component", 1,
     171             :         "try and compute schedule for entire component first")
     172             : ISL_ARG_CHOICE(struct isl_options, schedule_algorithm, 0,
     173             :         "schedule-algorithm", isl_schedule_algorithm_choice,
     174             :         ISL_SCHEDULE_ALGORITHM_ISL, "scheduling algorithm to use")
     175             : ISL_ARG_BOOL(struct isl_options, schedule_carry_self_first, 0,
     176             :         "schedule-carry-self-first", 1, "try and carry self-dependences first")
     177             : ISL_ARG_BOOL(struct isl_options, schedule_serialize_sccs, 0,
     178             :         "schedule-serialize-sccs", 0,
     179             :         "serialize strongly connected components in dependence graph")
     180             : ISL_ARG_PHANTOM_USER_CHOICE_F(0, "schedule-fuse", fuse, &set_fuse,
     181             :         ISL_SCHEDULE_FUSE_MAX, "level of fusion during scheduling",
     182             :         ISL_ARG_HIDDEN)
     183             : ISL_ARG_BOOL(struct isl_options, tile_scale_tile_loops, 0,
     184             :         "tile-scale-tile-loops", 1, "scale tile loops")
     185             : ISL_ARG_BOOL(struct isl_options, tile_shift_point_loops, 0,
     186             :         "tile-shift-point-loops", 1, "shift point loops to start at zero")
     187             : ISL_ARG_STR(struct isl_options, ast_iterator_type, 0,
     188             :         "ast-iterator-type", "type", "int",
     189             :         "type used for iterators during printing of AST")
     190             : ISL_ARG_BOOL(struct isl_options, ast_always_print_block, 0,
     191             :         "ast-always-print-block", 0, "print for and if bodies as a block "
     192             :         "regardless of the number of statements in the body")
     193             : ISL_ARG_BOOL(struct isl_options, ast_print_macro_once, 0,
     194             :         "ast-print-macro-once", 0, "only print macro definitions once")
     195             : ISL_ARG_BOOL(struct isl_options, ast_build_atomic_upper_bound, 0,
     196             :         "ast-build-atomic-upper-bound", 1, "generate atomic upper bounds")
     197             : ISL_ARG_BOOL(struct isl_options, ast_build_prefer_pdiv, 0,
     198             :         "ast-build-prefer-pdiv", 1, "prefer pdiv operation over fdiv")
     199             : ISL_ARG_BOOL(struct isl_options, ast_build_detect_min_max, 0,
     200             :         "ast-build-detect-min-max", 0, "detect min/max expressions")
     201             : ISL_ARG_BOOL(struct isl_options, ast_build_exploit_nested_bounds, 0,
     202             :         "ast-build-exploit-nested-bounds", 1,
     203             :         "simplify conditions based on bounds of nested for loops")
     204             : ISL_ARG_BOOL(struct isl_options, ast_build_group_coscheduled, 0,
     205             :         "ast-build-group-coscheduled", 0,
     206             :         "keep coscheduled domain elements together")
     207             : ISL_ARG_CHOICE(struct isl_options, ast_build_separation_bounds, 0,
     208             :         "ast-build-separation-bounds", separation_bounds,
     209             :         ISL_AST_BUILD_SEPARATION_BOUNDS_EXPLICIT,
     210             :         "bounds to use during separation")
     211             : ISL_ARG_BOOL(struct isl_options, ast_build_scale_strides, 0,
     212             :         "ast-build-scale-strides", 1,
     213             :         "allow iterators of strided loops to be scaled down")
     214             : ISL_ARG_BOOL(struct isl_options, ast_build_allow_else, 0,
     215             :         "ast-build-allow-else", 1, "generate if statements with else branches")
     216             : ISL_ARG_BOOL(struct isl_options, ast_build_allow_or, 0,
     217             :         "ast-build-allow-or", 1, "generate if conditions with disjunctions")
     218             : ISL_ARG_BOOL(struct isl_options, print_stats, 0, "print-stats", 0,
     219             :         "print statistics for every isl_ctx")
     220             : ISL_ARG_ULONG(struct isl_options, max_operations, 0,
     221             :         "max-operations", 0, "default number of maximal operations per isl_ctx")
     222             : ISL_ARG_VERSION(print_version)
     223             : ISL_ARGS_END
     224             : 
     225       37651 : ISL_ARG_DEF(isl_options, struct isl_options, isl_options_args)
     226             : 
     227      532294 : ISL_ARG_CTX_DEF(isl_options, struct isl_options, isl_options_args)
     228             : 
     229           0 : ISL_CTX_SET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args, bound)
     230           0 : ISL_CTX_GET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args, bound)
     231             : 
     232           0 : ISL_CTX_SET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args,
     233             :         on_error)
     234           0 : ISL_CTX_GET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args,
     235             :         on_error)
     236             : 
     237           0 : ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
     238             :         pip_symmetry)
     239           0 : ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
     240             :         pip_symmetry)
     241             : 
     242           0 : ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
     243             :         coalesce_bounded_wrapping)
     244      532294 : ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
     245             :         coalesce_bounded_wrapping)
     246             : 
     247           0 : ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
     248             :         coalesce_preserve_locals)
     249           0 : ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
     250             :         coalesce_preserve_locals)
     251             : 
     252           0 : ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
     253             :         gbr_only_first)
     254           0 : ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
     255             :         gbr_only_first)
     256             : 
     257           0 : ISL_CTX_SET_INT_DEF(isl_options, struct isl_options, isl_options_args,
     258             :         schedule_max_coefficient)
     259           0 : ISL_CTX_GET_INT_DEF(isl_options, struct isl_options, isl_options_args,
     260             :         schedule_max_coefficient)
     261             : 
     262           0 : ISL_CTX_SET_INT_DEF(isl_options, struct isl_options, isl_options_args,
     263             :         schedule_max_constant_term)
     264           0 : ISL_CTX_GET_INT_DEF(isl_options, struct isl_options, isl_options_args,
     265             :         schedule_max_constant_term)
     266             : 
     267           0 : ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
     268             :         schedule_maximize_band_depth)
     269           0 : ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
     270             :         schedule_maximize_band_depth)
     271             : 
     272           0 : ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
     273             :         schedule_maximize_coincidence)
     274           0 : ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
     275             :         schedule_maximize_coincidence)
     276             : 
     277           0 : ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
     278             :         schedule_split_scaled)
     279           0 : ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
     280             :         schedule_split_scaled)
     281             : 
     282           0 : ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
     283             :         schedule_treat_coalescing)
     284           0 : ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
     285             :         schedule_treat_coalescing)
     286             : 
     287           0 : ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
     288             :         schedule_separate_components)
     289           0 : ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
     290             :         schedule_separate_components)
     291             : 
     292           0 : ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
     293             :         schedule_whole_component)
     294           0 : ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
     295             :         schedule_whole_component)
     296             : 
     297           0 : ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
     298             :         schedule_outer_coincidence)
     299           0 : ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
     300             :         schedule_outer_coincidence)
     301             : 
     302           0 : ISL_CTX_SET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args,
     303             :         schedule_algorithm)
     304           0 : ISL_CTX_GET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args,
     305             :         schedule_algorithm)
     306             : 
     307           0 : ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
     308             :         schedule_carry_self_first)
     309           0 : ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
     310             :         schedule_carry_self_first)
     311             : 
     312           0 : ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
     313             :         schedule_serialize_sccs)
     314           0 : ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
     315             :         schedule_serialize_sccs)
     316             : 
     317           0 : ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
     318             :         tile_scale_tile_loops)
     319           0 : ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
     320             :         tile_scale_tile_loops)
     321             : 
     322           0 : ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
     323             :         tile_shift_point_loops)
     324           0 : ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
     325             :         tile_shift_point_loops)
     326             : 
     327           0 : ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
     328             :         ast_build_atomic_upper_bound)
     329           0 : ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
     330             :         ast_build_atomic_upper_bound)
     331             : 
     332           0 : ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
     333             :         ast_build_prefer_pdiv)
     334           0 : ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
     335             :         ast_build_prefer_pdiv)
     336             : 
     337           0 : ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
     338             :         ast_build_detect_min_max)
     339           0 : ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
     340             :         ast_build_detect_min_max)
     341             : 
     342           0 : ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
     343             :         ast_build_exploit_nested_bounds)
     344           0 : ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
     345             :         ast_build_exploit_nested_bounds)
     346             : 
     347           0 : ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
     348             :         ast_build_group_coscheduled)
     349           0 : ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
     350             :         ast_build_group_coscheduled)
     351             : 
     352           0 : ISL_CTX_SET_STR_DEF(isl_options, struct isl_options, isl_options_args,
     353             :         ast_iterator_type)
     354           0 : ISL_CTX_GET_STR_DEF(isl_options, struct isl_options, isl_options_args,
     355             :         ast_iterator_type)
     356             : 
     357           0 : ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
     358             :         ast_always_print_block)
     359           0 : ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
     360             :         ast_always_print_block)
     361             : 
     362           0 : ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
     363             :         ast_print_macro_once)
     364           0 : ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
     365             :         ast_print_macro_once)
     366             : 
     367           0 : ISL_CTX_SET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args,
     368             :         ast_build_separation_bounds)
     369           0 : ISL_CTX_GET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args,
     370             :         ast_build_separation_bounds)
     371             : 
     372           0 : ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
     373             :         ast_build_scale_strides)
     374           0 : ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
     375             :         ast_build_scale_strides)
     376             : 
     377           0 : ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
     378             :         ast_build_allow_else)
     379           0 : ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
     380             :         ast_build_allow_else)
     381             : 
     382           0 : ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
     383             :         ast_build_allow_or)
     384           0 : ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
     385             :         ast_build_allow_or)

Generated by: LCOV version 1.12