Clan  0.8.0
macros.h
Go to the documentation of this file.
00001 
00002    /*+------- <| --------------------------------------------------------**
00003     **         A                     Clan                                **
00004     **---     /.\   -----------------------------------------------------**
00005     **   <|  [""M#                 macros.h                              **
00006     **-   A   | #   -----------------------------------------------------**
00007     **   /.\ [""M#         First version: 30/04/2008                     **
00008     **- [""M# | #  U"U#U  -----------------------------------------------**
00009          | #  | #  \ .:/
00010          | #  | #___| #
00011  ******  | "--'     .-"  ******************************************************
00012  *     |"-"-"-"-"-#-#-##   Clan : the Chunky Loop Analyzer (experimental)     *
00013  ****  |     # ## ######  *****************************************************
00014  *      \       .::::'/                                                       *
00015  *       \      ::::'/     Copyright (C) 2008 University Paris-Sud 11         *
00016  *     :8a|    # # ##                                                         *
00017  *     ::88a      ###      This is free software; you can redistribute it     *
00018  *    ::::888a  8a ##::.   and/or modify it under the terms of the GNU Lesser *
00019  *  ::::::::888a88a[]:::   General Public License as published by the Free    *
00020  *::8:::::::::SUNDOGa8a::. Software Foundation, either version 2.1 of the     *
00021  *::::::::8::::888:Y8888:: License, or (at your option) any later version.    *
00022  *::::':::88::::888::Y88a::::::::::::...                                      *
00023  *::'::..    .   .....   ..   ...  .                                          *
00024  * This software is distributed in the hope that it will be useful, but       *
00025  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *
00026  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   *
00027  * for more details.                                                          *
00028  *                                                                            *
00029  * You should have received a copy of the GNU Lesser General Public License   *
00030  * along with software; if not, write to the Free Software Foundation, Inc.,  *
00031  * 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA                     *
00032  *                                                                            *
00033  * Clan, the Chunky Loop Analyzer                                             *
00034  * Written by Cedric Bastoul, Cedric.Bastoul@u-psud.fr                        *
00035  *                                                                            *
00036  ******************************************************************************/
00037 
00038 
00039 /*+****************************************************************************
00040  *  THIS FILE HAS BEEN AUTOMATICALLY GENERATED FROM macros.h.in BY configure  *
00041  ******************************************************************************/
00042 
00043 #ifndef CLAN_MACROS_H
00044 # define CLAN_MACROS_H
00045 
00046 # define CLAN_VERSION                   "0.8.0"
00047 
00048 # define CLAN_DEBUG                     0
00049 # define CLAN_TRUE                      1
00050 # define CLAN_FALSE                     0
00051 # define CLAN_MAX_LOCAL_VARIABLES     100
00052 # define CLAN_MAX_STRING             2048
00053 # define CLAN_MAX_DEPTH                50 // Max loop + if depth
00054 # define CLAN_MAX_PARAMETERS          128 // Max parameter number
00055 # define CLAN_MAX_LOCAL_DIMS          128 // Max local dims number
00056 # define CLAN_MAX_CONSTRAINTS         256 // Max contraint number for a domain
00057 # define CLAN_MAX_SCOPS               256 // Max number of SCoPs for autoscop
00058 # define CLAN_UNDEFINED                -1
00059 # define CLAN_KEY_START                 1
00060 
00061 # define CLAN_TYPE_ITERATOR             1
00062 # define CLAN_TYPE_ITERATOR_DEC         2
00063 # define CLAN_TYPE_PARAMETER            3
00064 # define CLAN_TYPE_ARRAY                4
00065 # define CLAN_TYPE_LOCAL_DIMS           5
00066 # define CLAN_TYPE_STRUCTURE            6
00067 # define CLAN_TYPE_FIELD                7
00068 # define CLAN_TYPE_FUNCTION             8
00069 # define CLAN_TYPE_READ                 9
00070 # define CLAN_TYPE_WRITE               10
00071 # define CLAN_TYPE_RDWR                11
00072 
00073 # define CLAN_AUTOPRAGMA_FILE           "clan_autopragma.c"
00074 
00075 
00076 /*---------------------------------------------------------------------------+
00077  |                               UTILITY MACROS                              |
00078  +---------------------------------------------------------------------------*/
00079 
00080 # define CLAN_info(msg)                                                    \
00081          do {                                                              \
00082            fprintf(stderr,"[Clan] Info: " msg " (%s).\n", __func__);       \
00083          } while (0)
00084 
00085 # define CLAN_debug(msg)                                                   \
00086          do {                                                              \
00087            if (CLAN_DEBUG)                                                 \
00088              fprintf(stderr,"[Clan] Debug: " msg " (%s).\n", __func__);    \
00089          } while (0)
00090 
00091 # define CLAN_debug_call(function_call)                                    \
00092          do {                                                              \
00093            if (CLAN_DEBUG)                                                 \
00094              function_call;                                                \
00095          } while (0)
00096 
00097 # define CLAN_warning(msg)                                                 \
00098          do {                                                              \
00099            fprintf(stderr,"[Clan] Warning: " msg " (%s).\n", __func__);    \
00100          } while (0)
00101 
00102 # define CLAN_error(msg)                                                   \
00103          do {                                                              \
00104            fprintf(stderr,"[Clan] Error: " msg " (%s).\n", __func__);      \
00105            exit(1);                                                        \
00106          } while (0)
00107 
00108 # define CLAN_malloc(ptr, type, size)                                      \
00109          do {                                                              \
00110            if (((ptr) = (type)malloc(size)) == NULL)                       \
00111              CLAN_error("memory overflow");                                \
00112          } while (0)
00113 
00114 # define CLAN_realloc(ptr, type, size)                                     \
00115          do {                                                              \
00116            if (((ptr) = (type)realloc(ptr, size)) == NULL)                 \
00117              CLAN_error("memory overflow");                                \
00118          } while (0)
00119 
00120 # define CLAN_strdup(destination, source)                                  \
00121          do {                                                              \
00122            if (source != NULL) {                                           \
00123              if (((destination) = strdup(source)) == NULL)                 \
00124                CLAN_error("memory overflow");                              \
00125            }                                                               \
00126            else {                                                          \
00127              destination = NULL;                                           \
00128              CLAN_debug("strdup of a NULL string");                        \
00129            }                                                               \
00130          } while (0)
00131 
00132 # define CLAN_max(x,y) ((x) > (y)? (x) : (y))
00133 
00134 # define CLAN_min(x,y) ((x) < (y)? (x) : (y))
00135 
00136 #endif /* define CLAN_MACROS_H */